Built motion from commit aab9c2f3.|2.6.24
authorsupport <support@xcally.com>
Fri, 25 Nov 2022 15:11:37 +0000 (15:11 +0000)
committersupport <support@xcally.com>
Fri, 25 Nov 2022 15:11:37 +0000 (15:11 +0000)
1246 files changed:
apidoc/api_data.js
apidoc/api_data.json
apidoc/api_project.js
apidoc/api_project.json
npm-shrinkwrap.json
package.json
public/app/footer/i18n/ar.json
public/app/footer/i18n/bs.json
public/app/footer/i18n/cs.json
public/app/footer/i18n/da.json
public/app/footer/i18n/de.json
public/app/footer/i18n/en.json
public/app/footer/i18n/es.json
public/app/footer/i18n/et.json
public/app/footer/i18n/fa.json
public/app/footer/i18n/fi.json
public/app/footer/i18n/fr.json
public/app/footer/i18n/he.json
public/app/footer/i18n/hi.json
public/app/footer/i18n/hu.json
public/app/footer/i18n/id.json
public/app/footer/i18n/is.json
public/app/footer/i18n/it.json
public/app/footer/i18n/ja.json
public/app/footer/i18n/ko.json
public/app/footer/i18n/lt.json
public/app/footer/i18n/lv.json
public/app/footer/i18n/nl.json
public/app/footer/i18n/no.json
public/app/footer/i18n/pl.json
public/app/footer/i18n/pt-BR.json
public/app/footer/i18n/pt-PT.json
public/app/footer/i18n/ru.json
public/app/footer/i18n/sv.json
public/app/footer/i18n/tr.json
public/app/footer/i18n/zh-CN.json
public/app/footer/i18n/zh-TW.json
public/app/main/apps/settings/i18n/en.json
public/app/main/apps/settings/i18n/it.json
public/app/main/apps/staff/i18n/en.json
public/app/main/apps/staff/i18n/it.json
public/index.html
public/scripts/app.7844957e.js [moved from public/scripts/app.788d460c.js with 53% similarity]
server/api/action/action.attributes.js
server/api/action/action.controller.js
server/api/action/action.model.js
server/api/action/action.rpc.js
server/api/action/index.js
server/api/analyticCustomReport/analyticCustomReport.attributes.js
server/api/analyticCustomReport/analyticCustomReport.controller.js
server/api/analyticCustomReport/analyticCustomReport.model.js
server/api/analyticCustomReport/analyticCustomReport.rpc.js
server/api/analyticCustomReport/index.js
server/api/analyticDefaultReport/analyticDefaultReport.attributes.js
server/api/analyticDefaultReport/analyticDefaultReport.controller.js
server/api/analyticDefaultReport/analyticDefaultReport.model.js
server/api/analyticDefaultReport/analyticDefaultReport.rpc.js
server/api/analyticDefaultReport/index.js
server/api/analyticExtractedReport/analyticExtractedReport.attributes.js
server/api/analyticExtractedReport/analyticExtractedReport.controller.js
server/api/analyticExtractedReport/analyticExtractedReport.model.js
server/api/analyticExtractedReport/analyticExtractedReport.rpc.js
server/api/analyticExtractedReport/index.js
server/api/analyticFieldReport/analyticFieldReport.attributes.js
server/api/analyticFieldReport/analyticFieldReport.controller.js
server/api/analyticFieldReport/analyticFieldReport.model.js
server/api/analyticFieldReport/analyticFieldReport.rpc.js
server/api/analyticFieldReport/index.js
server/api/analyticMetric/analyticMetric.attributes.js
server/api/analyticMetric/analyticMetric.controller.js
server/api/analyticMetric/analyticMetric.model.js
server/api/analyticMetric/analyticMetric.rpc.js
server/api/analyticMetric/index.js
server/api/analyticTreeReport/analyticTreeReport.attributes.js
server/api/analyticTreeReport/analyticTreeReport.controller.js
server/api/analyticTreeReport/analyticTreeReport.model.js
server/api/analyticTreeReport/analyticTreeReport.rpc.js
server/api/analyticTreeReport/index.js
server/api/attachment/attachment.attributes.js
server/api/attachment/attachment.controller.js
server/api/attachment/attachment.model.js
server/api/attachment/attachment.rpc.js
server/api/attachment/index.js
server/api/authActiveDirectory/authActiveDirectory.controller.js
server/api/authActiveDirectory/index.js
server/api/authGoogle/authGoogle.controller.js
server/api/authGoogle/index.js
server/api/authLocal/authLocal.controller.js
server/api/authLocal/index.js
server/api/automation/automation.attributes.js
server/api/automation/automation.controller.js
server/api/automation/automation.model.js
server/api/automation/automation.rpc.js
server/api/automation/index.js
server/api/campaign/campaign.attributes.js
server/api/campaign/campaign.controller.js
server/api/campaign/campaign.model.js
server/api/campaign/campaign.rpc.js
server/api/campaign/index.js
server/api/cannedAnswer/cannedAnswer.attributes.js
server/api/cannedAnswer/cannedAnswer.controller.js
server/api/cannedAnswer/cannedAnswer.model.js
server/api/cannedAnswer/cannedAnswer.rpc.js
server/api/cannedAnswer/index.js
server/api/cdr/cdr.attributes.js
server/api/cdr/cdr.controller.js
server/api/cdr/cdr.model.js
server/api/cdr/cdr.rpc.js
server/api/cdr/index.js
server/api/chatApplication/chatApplication.attributes.js
server/api/chatApplication/chatApplication.controller.js
server/api/chatApplication/chatApplication.model.js
server/api/chatApplication/chatApplication.rpc.js
server/api/chatApplication/index.js
server/api/chatGroup/chatGroup.attributes.js
server/api/chatGroup/chatGroup.controller.js
server/api/chatGroup/chatGroup.events.js
server/api/chatGroup/chatGroup.model.js
server/api/chatGroup/chatGroup.rpc.js
server/api/chatGroup/chatGroup.socket.js
server/api/chatGroup/index.js
server/api/chatInteraction/chatInteraction.attributes.js
server/api/chatInteraction/chatInteraction.controller.js
server/api/chatInteraction/chatInteraction.events.js
server/api/chatInteraction/chatInteraction.model.js
server/api/chatInteraction/chatInteraction.rpc.js
server/api/chatInteraction/chatInteraction.socket.js
server/api/chatInteraction/index.js
server/api/chatInternalMessage/chatInternalMessage.attributes.js
server/api/chatInternalMessage/chatInternalMessage.controller.js
server/api/chatInternalMessage/chatInternalMessage.events.js
server/api/chatInternalMessage/chatInternalMessage.model.js
server/api/chatInternalMessage/chatInternalMessage.rpc.js
server/api/chatInternalMessage/chatInternalMessage.socket.js
server/api/chatInternalMessage/index.js
server/api/chatMessage/chatMessage.attributes.js
server/api/chatMessage/chatMessage.controller.js
server/api/chatMessage/chatMessage.events.js
server/api/chatMessage/chatMessage.model.js
server/api/chatMessage/chatMessage.rpc.js
server/api/chatMessage/chatMessage.socket.js
server/api/chatMessage/index.js
server/api/chatOfflineMessage/chatOfflineMessage.attributes.js
server/api/chatOfflineMessage/chatOfflineMessage.controller.js
server/api/chatOfflineMessage/chatOfflineMessage.events.js
server/api/chatOfflineMessage/chatOfflineMessage.model.js
server/api/chatOfflineMessage/chatOfflineMessage.rpc.js
server/api/chatOfflineMessage/index.js
server/api/chatProactiveAction/chatProactiveAction.attributes.js
server/api/chatProactiveAction/chatProactiveAction.controller.js
server/api/chatProactiveAction/chatProactiveAction.model.js
server/api/chatProactiveAction/chatProactiveAction.rpc.js
server/api/chatProactiveAction/index.js
server/api/chatQueue/chatQueue.attributes.js
server/api/chatQueue/chatQueue.controller.js
server/api/chatQueue/chatQueue.events.js
server/api/chatQueue/chatQueue.model.js
server/api/chatQueue/chatQueue.rpc.js
server/api/chatQueue/chatQueue.socket.js
server/api/chatQueue/index.js
server/api/chatQueueReport/chatQueueReport.attributes.js
server/api/chatQueueReport/chatQueueReport.controller.js
server/api/chatQueueReport/chatQueueReport.model.js
server/api/chatQueueReport/chatQueueReport.rpc.js
server/api/chatQueueReport/index.js
server/api/chatTransferReport/chatTransferReport.attributes.js
server/api/chatTransferReport/chatTransferReport.controller.js
server/api/chatTransferReport/chatTransferReport.model.js
server/api/chatTransferReport/chatTransferReport.rpc.js
server/api/chatTransferReport/index.js
server/api/chatWebsite/chatWebsite.attributes.js
server/api/chatWebsite/chatWebsite.controller.js
server/api/chatWebsite/chatWebsite.events.js
server/api/chatWebsite/chatWebsite.model.js
server/api/chatWebsite/chatWebsite.rpc.js
server/api/chatWebsite/chatWebsite.socket.js
server/api/chatWebsite/index.js
server/api/client-side-logs.js
server/api/cloudProvider/cloudProvider.attributes.js
server/api/cloudProvider/cloudProvider.controller.js
server/api/cloudProvider/cloudProvider.model.js
server/api/cloudProvider/cloudProvider.oauth.js
server/api/cloudProvider/cloudProvider.rpc.js
server/api/cloudProvider/index.js
server/api/cmCompany/cmCompany.attributes.js
server/api/cmCompany/cmCompany.controller.js
server/api/cmCompany/cmCompany.model.js
server/api/cmCompany/cmCompany.rpc.js
server/api/cmCompany/index.js
server/api/cmContact/cmContact.attributes.js
server/api/cmContact/cmContact.controller.js
server/api/cmContact/cmContact.events.js
server/api/cmContact/cmContact.model.js
server/api/cmContact/cmContact.rpc.js
server/api/cmContact/cmContact.socket.js
server/api/cmContact/index.js
server/api/cmContactHasItem/cmContactHasItem.attributes.js
server/api/cmContactHasItem/cmContactHasItem.controller.js
server/api/cmContactHasItem/cmContactHasItem.model.js
server/api/cmContactHasItem/cmContactHasItem.rpc.js
server/api/cmContactHasItem/index.js
server/api/cmCustomField/cmCustomField.attributes.js
server/api/cmCustomField/cmCustomField.controller.js
server/api/cmCustomField/cmCustomField.model.js
server/api/cmCustomField/cmCustomField.rpc.js
server/api/cmCustomField/index.js
server/api/cmHopper/cmHopper.attributes.js
server/api/cmHopper/cmHopper.controller.js
server/api/cmHopper/cmHopper.model.js
server/api/cmHopper/cmHopper.rpc.js
server/api/cmHopper/index.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js
server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js
server/api/cmHopperAdditionalPhone/index.js
server/api/cmHopperBlack/cmHopperBlack.attributes.js
server/api/cmHopperBlack/cmHopperBlack.controller.js
server/api/cmHopperBlack/cmHopperBlack.model.js
server/api/cmHopperBlack/cmHopperBlack.rpc.js
server/api/cmHopperBlack/index.js
server/api/cmHopperFinal/cmHopperFinal.attributes.js
server/api/cmHopperFinal/cmHopperFinal.controller.js
server/api/cmHopperFinal/cmHopperFinal.model.js
server/api/cmHopperFinal/cmHopperFinal.rpc.js
server/api/cmHopperFinal/index.js
server/api/cmHopperHistory/cmHopperHistory.attributes.js
server/api/cmHopperHistory/cmHopperHistory.controller.js
server/api/cmHopperHistory/cmHopperHistory.model.js
server/api/cmHopperHistory/cmHopperHistory.rpc.js
server/api/cmHopperHistory/index.js
server/api/cmList/cmList.attributes.js
server/api/cmList/cmList.controller.js
server/api/cmList/cmList.events.js
server/api/cmList/cmList.model.js
server/api/cmList/cmList.rpc.js
server/api/cmList/cmList.socket.js
server/api/cmList/index.js
server/api/condition/condition.attributes.js
server/api/condition/condition.controller.js
server/api/condition/condition.model.js
server/api/condition/condition.rpc.js
server/api/condition/index.js
server/api/contactItemType/contactItemType.attributes.js
server/api/contactItemType/contactItemType.controller.js
server/api/contactItemType/contactItemType.model.js
server/api/contactItemType/contactItemType.rpc.js
server/api/contactItemType/index.js
server/api/dashboard/dashboard.attributes.js
server/api/dashboard/dashboard.controller.js
server/api/dashboard/dashboard.events.js
server/api/dashboard/dashboard.model.js
server/api/dashboard/dashboard.rpc.js
server/api/dashboard/dashboard.socket.js
server/api/dashboard/index.js
server/api/dashboardItem/dashboardItem.attributes.js
server/api/dashboardItem/dashboardItem.controller.js
server/api/dashboardItem/dashboardItem.events.js
server/api/dashboardItem/dashboardItem.model.js
server/api/dashboardItem/dashboardItem.rpc.js
server/api/dashboardItem/dashboardItem.socket.js
server/api/dashboardItem/index.js
server/api/disposition/disposition.attributes.js
server/api/disposition/disposition.controller.js
server/api/disposition/disposition.model.js
server/api/disposition/disposition.rpc.js
server/api/disposition/index.js
server/api/faxAccount/faxAccount.attributes.js
server/api/faxAccount/faxAccount.controller.js
server/api/faxAccount/faxAccount.events.js
server/api/faxAccount/faxAccount.model.js
server/api/faxAccount/faxAccount.rpc.js
server/api/faxAccount/faxAccount.socket.js
server/api/faxAccount/index.js
server/api/faxApplication/faxApplication.attributes.js
server/api/faxApplication/faxApplication.controller.js
server/api/faxApplication/faxApplication.model.js
server/api/faxApplication/faxApplication.rpc.js
server/api/faxApplication/index.js
server/api/faxInteraction/faxInteraction.attributes.js
server/api/faxInteraction/faxInteraction.controller.js
server/api/faxInteraction/faxInteraction.events.js
server/api/faxInteraction/faxInteraction.model.js
server/api/faxInteraction/faxInteraction.rpc.js
server/api/faxInteraction/faxInteraction.socket.js
server/api/faxInteraction/index.js
server/api/faxMessage/faxMessage.attributes.js
server/api/faxMessage/faxMessage.controller.js
server/api/faxMessage/faxMessage.events.js
server/api/faxMessage/faxMessage.model.js
server/api/faxMessage/faxMessage.rpc.js
server/api/faxMessage/faxMessage.socket.js
server/api/faxMessage/index.js
server/api/faxQueue/faxQueue.attributes.js
server/api/faxQueue/faxQueue.controller.js
server/api/faxQueue/faxQueue.events.js
server/api/faxQueue/faxQueue.model.js
server/api/faxQueue/faxQueue.rpc.js
server/api/faxQueue/faxQueue.socket.js
server/api/faxQueue/index.js
server/api/faxQueueReport/faxQueueReport.attributes.js
server/api/faxQueueReport/faxQueueReport.controller.js
server/api/faxQueueReport/faxQueueReport.model.js
server/api/faxQueueReport/faxQueueReport.rpc.js
server/api/faxQueueReport/index.js
server/api/faxTransferReport/faxTransferReport.attributes.js
server/api/faxTransferReport/faxTransferReport.controller.js
server/api/faxTransferReport/faxTransferReport.model.js
server/api/faxTransferReport/faxTransferReport.rpc.js
server/api/faxTransferReport/index.js
server/api/intDeskAccount/index.js
server/api/intDeskAccount/intDeskAccount.attributes.js
server/api/intDeskAccount/intDeskAccount.controller.js
server/api/intDeskAccount/intDeskAccount.model.js
server/api/intDeskAccount/intDeskAccount.rpc.js
server/api/intDeskConfiguration/index.js
server/api/intDeskConfiguration/intDeskConfiguration.attributes.js
server/api/intDeskConfiguration/intDeskConfiguration.controller.js
server/api/intDeskConfiguration/intDeskConfiguration.model.js
server/api/intDeskConfiguration/intDeskConfiguration.rpc.js
server/api/intDeskField/index.js
server/api/intDeskField/intDeskField.attributes.js
server/api/intDeskField/intDeskField.controller.js
server/api/intDeskField/intDeskField.model.js
server/api/intDeskField/intDeskField.rpc.js
server/api/intDynamics365Account/index.js
server/api/intDynamics365Account/intDynamics365Account.attributes.js
server/api/intDynamics365Account/intDynamics365Account.controller.js
server/api/intDynamics365Account/intDynamics365Account.model.js
server/api/intDynamics365Account/intDynamics365Account.rpc.js
server/api/intDynamics365Configuration/index.js
server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js
server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js
server/api/intDynamics365Configuration/intDynamics365Configuration.model.js
server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js
server/api/intDynamics365Field/index.js
server/api/intDynamics365Field/intDynamics365Field.attributes.js
server/api/intDynamics365Field/intDynamics365Field.controller.js
server/api/intDynamics365Field/intDynamics365Field.model.js
server/api/intDynamics365Field/intDynamics365Field.rpc.js
server/api/intFreshdeskAccount/index.js
server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js
server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js
server/api/intFreshdeskAccount/intFreshdeskAccount.model.js
server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js
server/api/intFreshdeskConfiguration/index.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js
server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js
server/api/intFreshdeskField/index.js
server/api/intFreshdeskField/intFreshdeskField.attributes.js
server/api/intFreshdeskField/intFreshdeskField.controller.js
server/api/intFreshdeskField/intFreshdeskField.model.js
server/api/intFreshdeskField/intFreshdeskField.rpc.js
server/api/intFreshsalesAccount/index.js
server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js
server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js
server/api/intFreshsalesAccount/intFreshsalesAccount.model.js
server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js
server/api/intFreshsalesConfiguration/index.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js
server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js
server/api/intFreshsalesField/index.js
server/api/intFreshsalesField/intFreshsalesField.attributes.js
server/api/intFreshsalesField/intFreshsalesField.controller.js
server/api/intFreshsalesField/intFreshsalesField.model.js
server/api/intFreshsalesField/intFreshsalesField.rpc.js
server/api/intSalesforceAccount/index.js
server/api/intSalesforceAccount/intSalesforceAccount.attributes.js
server/api/intSalesforceAccount/intSalesforceAccount.controller.js
server/api/intSalesforceAccount/intSalesforceAccount.model.js
server/api/intSalesforceAccount/intSalesforceAccount.rpc.js
server/api/intSalesforceConfiguration/index.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js
server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js
server/api/intSalesforceField/index.js
server/api/intSalesforceField/intSalesforceField.attributes.js
server/api/intSalesforceField/intSalesforceField.controller.js
server/api/intSalesforceField/intSalesforceField.model.js
server/api/intSalesforceField/intSalesforceField.rpc.js
server/api/intServicenowAccount/index.js
server/api/intServicenowAccount/intServicenowAccount.attributes.js
server/api/intServicenowAccount/intServicenowAccount.controller.js
server/api/intServicenowAccount/intServicenowAccount.model.js
server/api/intServicenowAccount/intServicenowAccount.rpc.js
server/api/intServicenowConfiguration/index.js
server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js
server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js
server/api/intServicenowConfiguration/intServicenowConfiguration.model.js
server/api/intServicenowConfiguration/intServicenowConfiguration.rpc.js
server/api/intServicenowField/index.js
server/api/intServicenowField/intServicenowField.attributes.js
server/api/intServicenowField/intServicenowField.controller.js
server/api/intServicenowField/intServicenowField.model.js
server/api/intServicenowField/intServicenowField.rpc.js
server/api/intSugarcrmAccount/index.js
server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js
server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js
server/api/intSugarcrmAccount/intSugarcrmAccount.model.js
server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js
server/api/intSugarcrmConfiguration/index.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js
server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js
server/api/intSugarcrmField/index.js
server/api/intSugarcrmField/intSugarcrmField.attributes.js
server/api/intSugarcrmField/intSugarcrmField.controller.js
server/api/intSugarcrmField/intSugarcrmField.model.js
server/api/intSugarcrmField/intSugarcrmField.rpc.js
server/api/intVtigerAccount/index.js
server/api/intVtigerAccount/intVtigerAccount.attributes.js
server/api/intVtigerAccount/intVtigerAccount.controller.js
server/api/intVtigerAccount/intVtigerAccount.model.js
server/api/intVtigerAccount/intVtigerAccount.rpc.js
server/api/intVtigerConfiguration/index.js
server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js
server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js
server/api/intVtigerConfiguration/intVtigerConfiguration.model.js
server/api/intVtigerConfiguration/intVtigerConfiguration.rpc.js
server/api/intVtigerField/index.js
server/api/intVtigerField/intVtigerField.attributes.js
server/api/intVtigerField/intVtigerField.controller.js
server/api/intVtigerField/intVtigerField.model.js
server/api/intVtigerField/intVtigerField.rpc.js
server/api/intZendeskAccount/index.js
server/api/intZendeskAccount/intZendeskAccount.attributes.js
server/api/intZendeskAccount/intZendeskAccount.controller.js
server/api/intZendeskAccount/intZendeskAccount.model.js
server/api/intZendeskAccount/intZendeskAccount.rpc.js
server/api/intZendeskConfiguration/index.js
server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js
server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js
server/api/intZendeskConfiguration/intZendeskConfiguration.model.js
server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js
server/api/intZendeskField/index.js
server/api/intZendeskField/intZendeskField.attributes.js
server/api/intZendeskField/intZendeskField.controller.js
server/api/intZendeskField/intZendeskField.model.js
server/api/intZendeskField/intZendeskField.rpc.js
server/api/intZohoAccount/index.js
server/api/intZohoAccount/intZohoAccount.attributes.js
server/api/intZohoAccount/intZohoAccount.controller.js
server/api/intZohoAccount/intZohoAccount.model.js
server/api/intZohoAccount/intZohoAccount.rpc.js
server/api/intZohoConfiguration/index.js
server/api/intZohoConfiguration/intZohoConfiguration.attributes.js
server/api/intZohoConfiguration/intZohoConfiguration.controller.js
server/api/intZohoConfiguration/intZohoConfiguration.model.js
server/api/intZohoConfiguration/intZohoConfiguration.rpc.js
server/api/intZohoField/index.js
server/api/intZohoField/intZohoField.attributes.js
server/api/intZohoField/intZohoField.controller.js
server/api/intZohoField/intZohoField.model.js
server/api/intZohoField/intZohoField.rpc.js
server/api/integration/index.js
server/api/integration/integration.attributes.js
server/api/integration/integration.controller.js
server/api/integration/integration.model.js
server/api/integration/integration.rpc.js
server/api/integrationReport/index.js
server/api/integrationReport/integrationReport.attributes.js
server/api/integrationReport/integrationReport.controller.js
server/api/integrationReport/integrationReport.model.js
server/api/integrationReport/integrationReport.rpc.js
server/api/interval/index.js
server/api/interval/interval.attributes.js
server/api/interval/interval.controller.js
server/api/interval/interval.model.js
server/api/interval/interval.rpc.js
server/api/jira/index.js
server/api/jira/jira.controller.js
server/api/jscriptyAnswerReport/index.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js
server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js
server/api/jscriptyProject/index.js
server/api/jscriptyProject/jscriptyProject.attributes.js
server/api/jscriptyProject/jscriptyProject.controller.js
server/api/jscriptyProject/jscriptyProject.model.js
server/api/jscriptyProject/jscriptyProject.rpc.js
server/api/jscriptyQuestionReport/index.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js
server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js
server/api/jscriptySessionReport/index.js
server/api/jscriptySessionReport/jscriptySessionReport.attributes.js
server/api/jscriptySessionReport/jscriptySessionReport.controller.js
server/api/jscriptySessionReport/jscriptySessionReport.model.js
server/api/jscriptySessionReport/jscriptySessionReport.rpc.js
server/api/license/index.js
server/api/license/license.attributes.js
server/api/license/license.controller.js
server/api/license/license.model.js
server/api/license/license.rpc.js
server/api/mailAccount/index.js
server/api/mailAccount/mailAccount.attributes.js
server/api/mailAccount/mailAccount.controller.js
server/api/mailAccount/mailAccount.events.js
server/api/mailAccount/mailAccount.model.js
server/api/mailAccount/mailAccount.rpc.js
server/api/mailAccount/mailAccount.socket.js
server/api/mailApplication/index.js
server/api/mailApplication/mailApplication.attributes.js
server/api/mailApplication/mailApplication.controller.js
server/api/mailApplication/mailApplication.model.js
server/api/mailApplication/mailApplication.rpc.js
server/api/mailInteraction/index.js
server/api/mailInteraction/mailInteraction.attributes.js
server/api/mailInteraction/mailInteraction.controller.js
server/api/mailInteraction/mailInteraction.events.js
server/api/mailInteraction/mailInteraction.model.js
server/api/mailInteraction/mailInteraction.rpc.js
server/api/mailInteraction/mailInteraction.socket.js
server/api/mailMessage/index.js
server/api/mailMessage/mailMessage.attributes.js
server/api/mailMessage/mailMessage.controller.js
server/api/mailMessage/mailMessage.events.js
server/api/mailMessage/mailMessage.model.js
server/api/mailMessage/mailMessage.rpc.js
server/api/mailMessage/mailMessage.socket.js
server/api/mailQueue/index.js
server/api/mailQueue/mailQueue.attributes.js
server/api/mailQueue/mailQueue.controller.js
server/api/mailQueue/mailQueue.events.js
server/api/mailQueue/mailQueue.model.js
server/api/mailQueue/mailQueue.rpc.js
server/api/mailQueue/mailQueue.socket.js
server/api/mailQueueReport/index.js
server/api/mailQueueReport/mailQueueReport.attributes.js
server/api/mailQueueReport/mailQueueReport.controller.js
server/api/mailQueueReport/mailQueueReport.model.js
server/api/mailQueueReport/mailQueueReport.rpc.js
server/api/mailServerIn/index.js
server/api/mailServerIn/mailServerIn.attributes.js
server/api/mailServerIn/mailServerIn.model.js
server/api/mailServerIn/mailServerIn.rpc.js
server/api/mailServerOut/index.js
server/api/mailServerOut/mailServerOut.attributes.js
server/api/mailServerOut/mailServerOut.controller.js
server/api/mailServerOut/mailServerOut.model.js
server/api/mailServerOut/mailServerOut.rpc.js
server/api/mailSubstatus/index.js
server/api/mailSubstatus/mailSubstatus.attributes.js
server/api/mailSubstatus/mailSubstatus.controller.js
server/api/mailSubstatus/mailSubstatus.events.js
server/api/mailSubstatus/mailSubstatus.model.js
server/api/mailSubstatus/mailSubstatus.rpc.js
server/api/mailTransferReport/index.js
server/api/mailTransferReport/mailTransferReport.attributes.js
server/api/mailTransferReport/mailTransferReport.controller.js
server/api/mailTransferReport/mailTransferReport.model.js
server/api/mailTransferReport/mailTransferReport.rpc.js
server/api/memberReport/index.js
server/api/memberReport/memberReport.attributes.js
server/api/memberReport/memberReport.controller.js
server/api/memberReport/memberReport.model.js
server/api/memberReport/memberReport.rpc.js
server/api/migration/index.js
server/api/migration/migration.attributes.js
server/api/migration/migration.controller.js
server/api/migration/migration.model.js
server/api/migration/migration.rpc.js
server/api/network/index.js
server/api/network/network.attributes.js
server/api/network/network.controller.js
server/api/network/network.model.js
server/api/network/network.rpc.js
server/api/openchannelAccount/index.js
server/api/openchannelAccount/openchannelAccount.attributes.js
server/api/openchannelAccount/openchannelAccount.controller.js
server/api/openchannelAccount/openchannelAccount.events.js
server/api/openchannelAccount/openchannelAccount.model.js
server/api/openchannelAccount/openchannelAccount.rpc.js
server/api/openchannelAccount/openchannelAccount.socket.js
server/api/openchannelApplication/index.js
server/api/openchannelApplication/openchannelApplication.attributes.js
server/api/openchannelApplication/openchannelApplication.controller.js
server/api/openchannelApplication/openchannelApplication.model.js
server/api/openchannelApplication/openchannelApplication.rpc.js
server/api/openchannelInteraction/index.js
server/api/openchannelInteraction/openchannelInteraction.attributes.js
server/api/openchannelInteraction/openchannelInteraction.controller.js
server/api/openchannelInteraction/openchannelInteraction.events.js
server/api/openchannelInteraction/openchannelInteraction.model.js
server/api/openchannelInteraction/openchannelInteraction.rpc.js
server/api/openchannelInteraction/openchannelInteraction.socket.js
server/api/openchannelMessage/index.js
server/api/openchannelMessage/openchannelMessage.attributes.js
server/api/openchannelMessage/openchannelMessage.controller.js
server/api/openchannelMessage/openchannelMessage.events.js
server/api/openchannelMessage/openchannelMessage.model.js
server/api/openchannelMessage/openchannelMessage.rpc.js
server/api/openchannelMessage/openchannelMessage.socket.js
server/api/openchannelQueue/index.js
server/api/openchannelQueue/openchannelQueue.attributes.js
server/api/openchannelQueue/openchannelQueue.controller.js
server/api/openchannelQueue/openchannelQueue.events.js
server/api/openchannelQueue/openchannelQueue.model.js
server/api/openchannelQueue/openchannelQueue.rpc.js
server/api/openchannelQueue/openchannelQueue.socket.js
server/api/openchannelQueueReport/index.js
server/api/openchannelQueueReport/openchannelQueueReport.attributes.js
server/api/openchannelQueueReport/openchannelQueueReport.controller.js
server/api/openchannelQueueReport/openchannelQueueReport.model.js
server/api/openchannelQueueReport/openchannelQueueReport.rpc.js
server/api/openchannelTransferReport/index.js
server/api/openchannelTransferReport/openchannelTransferReport.attributes.js
server/api/openchannelTransferReport/openchannelTransferReport.controller.js
server/api/openchannelTransferReport/openchannelTransferReport.model.js
server/api/openchannelTransferReport/openchannelTransferReport.rpc.js
server/api/pause/index.js
server/api/pause/pause.attributes.js
server/api/pause/pause.controller.js
server/api/pause/pause.model.js
server/api/pause/pause.rpc.js
server/api/plugin/index.js
server/api/plugin/plugin.attributes.js
server/api/plugin/plugin.controller.js
server/api/plugin/plugin.events.js
server/api/plugin/plugin.model.js
server/api/plugin/plugin.rpc.js
server/api/plugin/plugin.socket.js
server/api/pm2/index.js
server/api/pm2/pm2.controller.js
server/api/realtime/index.js
server/api/realtime/realtime.controller.js
server/api/reportAgentPreview/index.js
server/api/reportAgentPreview/reportAgentPreview.attributes.js
server/api/reportAgentPreview/reportAgentPreview.model.js
server/api/reportAgentPreview/reportAgentPreview.rpc.js
server/api/rpc/index.js
server/api/rpc/rpc.controller.js
server/api/schedule/index.js
server/api/schedule/schedule.attributes.js
server/api/schedule/schedule.controller.js
server/api/schedule/schedule.model.js
server/api/schedule/schedule.rpc.js
server/api/screenRecording/index.js
server/api/screenRecording/screenRecording.attributes.js
server/api/screenRecording/screenRecording.controller.js
server/api/screenRecording/screenRecording.model.js
server/api/screenRecording/screenRecording.rpc.js
server/api/setting/index.js
server/api/setting/setting.attributes.js
server/api/setting/setting.controller.js
server/api/setting/setting.model.js
server/api/setting/setting.rpc.js
server/api/smsAccount/index.js
server/api/smsAccount/smsAccount.attributes.js
server/api/smsAccount/smsAccount.controller.js
server/api/smsAccount/smsAccount.events.js
server/api/smsAccount/smsAccount.model.js
server/api/smsAccount/smsAccount.rpc.js
server/api/smsAccount/smsAccount.socket.js
server/api/smsApplication/index.js
server/api/smsApplication/smsApplication.attributes.js
server/api/smsApplication/smsApplication.controller.js
server/api/smsApplication/smsApplication.model.js
server/api/smsApplication/smsApplication.rpc.js
server/api/smsInteraction/index.js
server/api/smsInteraction/smsInteraction.attributes.js
server/api/smsInteraction/smsInteraction.controller.js
server/api/smsInteraction/smsInteraction.events.js
server/api/smsInteraction/smsInteraction.model.js
server/api/smsInteraction/smsInteraction.rpc.js
server/api/smsInteraction/smsInteraction.socket.js
server/api/smsMessage/index.js
server/api/smsMessage/smsMessage.attributes.js
server/api/smsMessage/smsMessage.controller.js
server/api/smsMessage/smsMessage.events.js
server/api/smsMessage/smsMessage.model.js
server/api/smsMessage/smsMessage.rpc.js
server/api/smsMessage/smsMessage.socket.js
server/api/smsQueue/index.js
server/api/smsQueue/smsQueue.attributes.js
server/api/smsQueue/smsQueue.controller.js
server/api/smsQueue/smsQueue.events.js
server/api/smsQueue/smsQueue.model.js
server/api/smsQueue/smsQueue.rpc.js
server/api/smsQueue/smsQueue.socket.js
server/api/smsQueueReport/index.js
server/api/smsQueueReport/smsQueueReport.attributes.js
server/api/smsQueueReport/smsQueueReport.controller.js
server/api/smsQueueReport/smsQueueReport.model.js
server/api/smsQueueReport/smsQueueReport.rpc.js
server/api/smsTransferReport/index.js
server/api/smsTransferReport/smsTransferReport.attributes.js
server/api/smsTransferReport/smsTransferReport.controller.js
server/api/smsTransferReport/smsTransferReport.model.js
server/api/smsTransferReport/smsTransferReport.rpc.js
server/api/sound/index.js
server/api/sound/sound.attributes.js
server/api/sound/sound.controller.js
server/api/sound/sound.model.js
server/api/sound/sound.rpc.js
server/api/squareMessage/index.js
server/api/squareMessage/squareMessage.attributes.js
server/api/squareMessage/squareMessage.controller.js
server/api/squareMessage/squareMessage.model.js
server/api/squareMessage/squareMessage.rpc.js
server/api/squareOdbc/index.js
server/api/squareOdbc/squareOdbc.attributes.js
server/api/squareOdbc/squareOdbc.controller.js
server/api/squareOdbc/squareOdbc.model.js
server/api/squareOdbc/squareOdbc.rpc.js
server/api/squareProject/index.js
server/api/squareProject/squareProject.attributes.js
server/api/squareProject/squareProject.controller.js
server/api/squareProject/squareProject.events.js
server/api/squareProject/squareProject.model.js
server/api/squareProject/squareProject.rpc.js
server/api/squareProject/squareProject.socket.js
server/api/squareRecording/index.js
server/api/squareRecording/squareRecording.attributes.js
server/api/squareRecording/squareRecording.controller.js
server/api/squareRecording/squareRecording.model.js
server/api/squareRecording/squareRecording.rpc.js
server/api/squareReport/index.js
server/api/squareReport/squareReport.attributes.js
server/api/squareReport/squareReport.controller.js
server/api/squareReport/squareReport.model.js
server/api/squareReport/squareReport.rpc.js
server/api/squareReportDetail/index.js
server/api/squareReportDetail/squareReportDetail.attributes.js
server/api/squareReportDetail/squareReportDetail.controller.js
server/api/squareReportDetail/squareReportDetail.model.js
server/api/squareReportDetail/squareReportDetail.rpc.js
server/api/system/index.js
server/api/system/system.controller.js
server/api/tag/index.js
server/api/tag/tag.attributes.js
server/api/tag/tag.controller.js
server/api/tag/tag.model.js
server/api/tag/tag.rpc.js
server/api/team/index.js
server/api/team/team.attributes.js
server/api/team/team.controller.js
server/api/team/team.events.js
server/api/team/team.model.js
server/api/team/team.rpc.js
server/api/team/team.socket.js
server/api/teamVoicePrefix/teamVoicePrefix.attributes.js
server/api/teamVoicePrefix/teamVoicePrefix.model.js
server/api/teamVoiceQueue/index.js
server/api/teamVoiceQueue/teamVoiceQueue.attributes.js
server/api/teamVoiceQueue/teamVoiceQueue.model.js
server/api/teamVoiceQueue/teamVoiceQueue.rpc.js
server/api/template/index.js
server/api/template/template.attributes.js
server/api/template/template.controller.js
server/api/template/template.model.js
server/api/template/template.rpc.js
server/api/trigger/index.js
server/api/trigger/trigger.attributes.js
server/api/trigger/trigger.controller.js
server/api/trigger/trigger.model.js
server/api/trigger/trigger.rpc.js
server/api/trunk/index.js
server/api/trunk/trunk.attributes.js
server/api/trunk/trunk.controller.js
server/api/trunk/trunk.model.js
server/api/trunk/trunk.rpc.js
server/api/user-setting/index.js
server/api/user-setting/user-setting.attributes.js
server/api/user-setting/user-setting.controller.js
server/api/user-setting/user-setting.events.js
server/api/user-setting/user-setting.model.js
server/api/user-setting/user-setting.socket.js
server/api/user/index.js
server/api/user/user.attributes.js
server/api/user/user.controller.js
server/api/user/user.events.js
server/api/user/user.model.js
server/api/user/user.rpc.js
server/api/user/user.socket.js
server/api/userChatQueue/index.js
server/api/userChatQueue/userChatQueue.attributes.js
server/api/userChatQueue/userChatQueue.model.js
server/api/userChatQueue/userChatQueue.rpc.js
server/api/userFaxQueue/index.js
server/api/userFaxQueue/userFaxQueue.attributes.js
server/api/userFaxQueue/userFaxQueue.model.js
server/api/userFaxQueue/userFaxQueue.rpc.js
server/api/userMailQueue/index.js
server/api/userMailQueue/userMailQueue.attributes.js
server/api/userMailQueue/userMailQueue.model.js
server/api/userMailQueue/userMailQueue.rpc.js
server/api/userNotification/index.js
server/api/userNotification/userNotification.attributes.js
server/api/userNotification/userNotification.controller.js
server/api/userNotification/userNotification.events.js
server/api/userNotification/userNotification.model.js
server/api/userNotification/userNotification.rpc.js
server/api/userNotification/userNotification.socket.js
server/api/userOpenchannelQueue/index.js
server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js
server/api/userOpenchannelQueue/userOpenchannelQueue.model.js
server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js
server/api/userProfile/index.js
server/api/userProfile/userProfile.attributes.js
server/api/userProfile/userProfile.controller.js
server/api/userProfile/userProfile.events.js
server/api/userProfile/userProfile.model.js
server/api/userProfile/userProfile.rpc.js
server/api/userProfile/userProfile.socket.js
server/api/userProfileResource/index.js
server/api/userProfileResource/userProfileResource.attributes.js
server/api/userProfileResource/userProfileResource.controller.js
server/api/userProfileResource/userProfileResource.model.js
server/api/userProfileResource/userProfileResource.rpc.js
server/api/userProfileSection/index.js
server/api/userProfileSection/userProfileSection.attributes.js
server/api/userProfileSection/userProfileSection.controller.js
server/api/userProfileSection/userProfileSection.model.js
server/api/userProfileSection/userProfileSection.rpc.js
server/api/userSmsQueue/index.js
server/api/userSmsQueue/userSmsQueue.attributes.js
server/api/userSmsQueue/userSmsQueue.model.js
server/api/userSmsQueue/userSmsQueue.rpc.js
server/api/userVoicePrefix/userVoicePrefix.attributes.js
server/api/userVoicePrefix/userVoicePrefix.model.js
server/api/userVoiceQueue/index.js
server/api/userVoiceQueue/userVoiceQueue.attributes.js
server/api/userVoiceQueue/userVoiceQueue.model.js
server/api/userVoiceQueue/userVoiceQueue.rpc.js
server/api/userVoiceQueueRt/index.js
server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js
server/api/userVoiceQueueRt/userVoiceQueueRt.events.js
server/api/userVoiceQueueRt/userVoiceQueueRt.model.js
server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js
server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js
server/api/userWhatsappQueue/index.js
server/api/userWhatsappQueue/userWhatsappQueue.attributes.js
server/api/userWhatsappQueue/userWhatsappQueue.model.js
server/api/userWhatsappQueue/userWhatsappQueue.rpc.js
server/api/variable/index.js
server/api/variable/variable.attributes.js
server/api/variable/variable.controller.js
server/api/variable/variable.model.js
server/api/variable/variable.rpc.js
server/api/version/index.js
server/api/version/version.controller.js
server/api/voiceAgentReport/index.js
server/api/voiceAgentReport/voiceAgentReport.attributes.js
server/api/voiceAgentReport/voiceAgentReport.controller.js
server/api/voiceAgentReport/voiceAgentReport.model.js
server/api/voiceAgentReport/voiceAgentReport.rpc.js
server/api/voiceCallReport/index.js
server/api/voiceCallReport/voiceCallReport.attributes.js
server/api/voiceCallReport/voiceCallReport.controller.js
server/api/voiceCallReport/voiceCallReport.model.js
server/api/voiceCallReport/voiceCallReport.rpc.js
server/api/voiceChanSpy/index.js
server/api/voiceChanSpy/voiceChanSpy.attributes.js
server/api/voiceChanSpy/voiceChanSpy.controller.js
server/api/voiceChanSpy/voiceChanSpy.model.js
server/api/voiceChanSpy/voiceChanSpy.rpc.js
server/api/voiceContext/index.js
server/api/voiceContext/voiceContext.attributes.js
server/api/voiceContext/voiceContext.controller.js
server/api/voiceContext/voiceContext.model.js
server/api/voiceContext/voiceContext.rpc.js
server/api/voiceDialReport/index.js
server/api/voiceDialReport/voiceDialReport.attributes.js
server/api/voiceDialReport/voiceDialReport.controller.js
server/api/voiceDialReport/voiceDialReport.model.js
server/api/voiceDialReport/voiceDialReport.rpc.js
server/api/voiceExtension/index.js
server/api/voiceExtension/voiceExtension.attributes.js
server/api/voiceExtension/voiceExtension.controller.js
server/api/voiceExtension/voiceExtension.events.js
server/api/voiceExtension/voiceExtension.model.js
server/api/voiceExtension/voiceExtension.rpc.js
server/api/voiceExtension/voiceExtension.socket.js
server/api/voiceMail/index.js
server/api/voiceMail/voiceMail.attributes.js
server/api/voiceMail/voiceMail.controller.js
server/api/voiceMail/voiceMail.model.js
server/api/voiceMail/voiceMail.rpc.js
server/api/voiceMailMessage/index.js
server/api/voiceMailMessage/voiceMailMessage.attributes.js
server/api/voiceMailMessage/voiceMailMessage.controller.js
server/api/voiceMailMessage/voiceMailMessage.model.js
server/api/voiceMailMessage/voiceMailMessage.rpc.js
server/api/voiceMusicOnHold/index.js
server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js
server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js
server/api/voiceMusicOnHold/voiceMusicOnHold.model.js
server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js
server/api/voicePrefix/index.js
server/api/voicePrefix/voicePrefix.attributes.js
server/api/voicePrefix/voicePrefix.controller.js
server/api/voicePrefix/voicePrefix.events.js
server/api/voicePrefix/voicePrefix.model.js
server/api/voicePrefix/voicePrefix.rpc.js
server/api/voicePrefix/voicePrefix.socket.js
server/api/voiceQueue/index.js
server/api/voiceQueue/voiceQueue.attributes.js
server/api/voiceQueue/voiceQueue.controller.js
server/api/voiceQueue/voiceQueue.events.js
server/api/voiceQueue/voiceQueue.model.js
server/api/voiceQueue/voiceQueue.rpc.js
server/api/voiceQueue/voiceQueue.socket.js
server/api/voiceQueueReport/index.js
server/api/voiceQueueReport/voiceQueueReport.attributes.js
server/api/voiceQueueReport/voiceQueueReport.controller.js
server/api/voiceQueueReport/voiceQueueReport.events.js
server/api/voiceQueueReport/voiceQueueReport.model.js
server/api/voiceQueueReport/voiceQueueReport.rpc.js
server/api/voiceQueueReport/voiceQueueReport.socket.js
server/api/voiceQueuesLog/index.js
server/api/voiceQueuesLog/voiceQueuesLog.attributes.js
server/api/voiceQueuesLog/voiceQueuesLog.controller.js
server/api/voiceQueuesLog/voiceQueuesLog.model.js
server/api/voiceQueuesLog/voiceQueuesLog.rpc.js
server/api/voiceRecording/index.js
server/api/voiceRecording/voiceRecording.attributes.js
server/api/voiceRecording/voiceRecording.controller.js
server/api/voiceRecording/voiceRecording.model.js
server/api/voiceRecording/voiceRecording.rpc.js
server/api/voiceTransferReport/index.js
server/api/voiceTransferReport/voiceTransferReport.attributes.js
server/api/voiceTransferReport/voiceTransferReport.controller.js
server/api/voiceTransferReport/voiceTransferReport.model.js
server/api/voiceTransferReport/voiceTransferReport.rpc.js
server/api/webbar/index.js
server/api/webbar/webbar.controller.js
server/api/whatsappAccount/index.js
server/api/whatsappAccount/whatsappAccount.attributes.js
server/api/whatsappAccount/whatsappAccount.controller.js
server/api/whatsappAccount/whatsappAccount.events.js
server/api/whatsappAccount/whatsappAccount.model.js
server/api/whatsappAccount/whatsappAccount.rpc.js
server/api/whatsappAccount/whatsappAccount.socket.js
server/api/whatsappApplication/index.js
server/api/whatsappApplication/whatsappApplication.attributes.js
server/api/whatsappApplication/whatsappApplication.controller.js
server/api/whatsappApplication/whatsappApplication.model.js
server/api/whatsappApplication/whatsappApplication.rpc.js
server/api/whatsappInteraction/index.js
server/api/whatsappInteraction/whatsappInteraction.attributes.js
server/api/whatsappInteraction/whatsappInteraction.controller.js
server/api/whatsappInteraction/whatsappInteraction.events.js
server/api/whatsappInteraction/whatsappInteraction.model.js
server/api/whatsappInteraction/whatsappInteraction.rpc.js
server/api/whatsappInteraction/whatsappInteraction.socket.js
server/api/whatsappMessage/index.js
server/api/whatsappMessage/whatsappMessage.attributes.js
server/api/whatsappMessage/whatsappMessage.controller.js
server/api/whatsappMessage/whatsappMessage.events.js
server/api/whatsappMessage/whatsappMessage.model.js
server/api/whatsappMessage/whatsappMessage.rpc.js
server/api/whatsappMessage/whatsappMessage.socket.js
server/api/whatsappQueue/index.js
server/api/whatsappQueue/whatsappQueue.attributes.js
server/api/whatsappQueue/whatsappQueue.controller.js
server/api/whatsappQueue/whatsappQueue.events.js
server/api/whatsappQueue/whatsappQueue.model.js
server/api/whatsappQueue/whatsappQueue.rpc.js
server/api/whatsappQueue/whatsappQueue.socket.js
server/api/whatsappQueueReport/index.js
server/api/whatsappQueueReport/whatsappQueueReport.attributes.js
server/api/whatsappQueueReport/whatsappQueueReport.controller.js
server/api/whatsappQueueReport/whatsappQueueReport.model.js
server/api/whatsappQueueReport/whatsappQueueReport.rpc.js
server/api/whatsappTransferReport/index.js
server/api/whatsappTransferReport/whatsappTransferReport.attributes.js
server/api/whatsappTransferReport/whatsappTransferReport.controller.js
server/api/whatsappTransferReport/whatsappTransferReport.model.js
server/api/whatsappTransferReport/whatsappTransferReport.rpc.js
server/app.js
server/components/auth/service.js
server/components/contacts/index.js
server/components/contacts/sql-utils.js
server/components/encryptor/index.js
server/components/export/csv.js
server/components/export/pdf.js
server/components/export/xlsx.js
server/components/extensions/rewrite.js
server/components/import/cm/csv.js
server/components/import/cm/csv2.js
server/components/import/cm/csvUpdates.js
server/components/integrations/configuration.js
server/components/interaction/service.js
server/components/interaction/sql-utils.js
server/components/interaction/update-interaction.js
server/components/interaction/utils.js
server/components/license/service.js
server/components/parsers/advancedSearch.js
server/components/parsers/qs.js
server/components/realtime/agents.js
server/components/realtime/queues.js
server/config/express.js
server/config/license/hardware.js
server/config/license/index.js
server/config/license/util.js
server/config/local.env.js
server/config/logger.js
server/config/pm2/config.js
server/config/pm2/index.js
server/config/schedule/chat.js
server/config/schedule/cloud-provider.js
server/config/schedule/index.js
server/config/schedule/transcribe.js
server/config/schedule/whatsapp.js
server/config/seedContact.js
server/config/seedUsers.js
server/config/socketio.js
server/config/triggers/index.js
server/config/utils.js
server/errors/api.js
server/errors/index.js
server/migrations/2.6.23.js [new file with mode: 0644]
server/migrations/2.6.24.js [new file with mode: 0644]
server/mysqldb/index.js
server/routes.js
server/rpc/index.js
server/services/agi/channel.js
server/services/agi/error.js
server/services/agi/events.js
server/services/agi/graph/index.js
server/services/agi/index.js
server/services/agi/mailRpc/index.js
server/services/agi/project.js
server/services/agi/reply.js
server/services/agi/rpc/index.js
server/services/agi/scripts/aws/index.js
server/services/agi/scripts/aws/lex/index.js
server/services/agi/scripts/aws/lex/lib/api.js
server/services/agi/scripts/aws/polly/index.js
server/services/agi/scripts/aws/polly/lib/api.js
server/services/agi/scripts/google/asr/index.js
server/services/agi/scripts/google/asr/lib/api.js
server/services/agi/scripts/google/index.js
server/services/agi/scripts/index.js
server/services/agi/scripts/sestek/index.js
server/services/agi/scripts/sestek/nda/index.js
server/services/agi/scripts/tilde/asr/index.js
server/services/agi/scripts/tilde/asr/lib/api.js
server/services/agi/scripts/tilde/index.js
server/services/agi/server.js
server/services/agi/vertices.js
server/services/ami/acw/index.js
server/services/ami/ami.js
server/services/ami/client.js
server/services/ami/dialer/index.js
server/services/ami/dialer/models/action.js
server/services/ami/dialer/models/agentComplete.js
server/services/ami/dialer/models/final.js
server/services/ami/dialer/models/hangup.js
server/services/ami/dialer/models/history.js
server/services/ami/dialer/models/queueCallerAbandon.js
server/services/ami/dialer/utils/hopper.js
server/services/ami/dialer/utils/index.js
server/services/ami/fax/action.js
server/services/ami/fax/index.js
server/services/ami/fax/rpcDb.js
server/services/ami/fax/util/gs.js
server/services/ami/fax/util/util.js
server/services/ami/index.js
server/services/ami/model/agent.js
server/services/ami/model/campaign.js
server/services/ami/model/channel.js
server/services/ami/model/deskAccount.js
server/services/ami/model/dynamics365Account.js
server/services/ami/model/faxAccount.js
server/services/ami/model/freshdeskAccount.js
server/services/ami/model/freshsalesAccount.js
server/services/ami/model/queueReport.js
server/services/ami/model/salesforceAccount.js
server/services/ami/model/servicenowAccount.js
server/services/ami/model/sugarcrmAccount.js
server/services/ami/model/telephone.js
server/services/ami/model/template.js
server/services/ami/model/trigger.js
server/services/ami/model/trunk.js
server/services/ami/model/voiceExtension.js
server/services/ami/model/voiceQueue.js
server/services/ami/model/voiceQueueSummary.js
server/services/ami/model/vtigerAccount.js
server/services/ami/model/zendeskAccount.js
server/services/ami/model/zohoAccount.js
server/services/ami/preview/action.js
server/services/ami/preview/index.js
server/services/ami/preview/rpcDb.js
server/services/ami/preview/util/util.js
server/services/ami/properties.js
server/services/ami/realtime/index.js
server/services/ami/realtime/utils.js
server/services/ami/report/index.js
server/services/ami/report/userReport.js
server/services/ami/report/voiceAgentReport.js
server/services/ami/report/voiceCallReport.js
server/services/ami/report/voiceDialReport.js
server/services/ami/report/voiceQueueReport.js
server/services/ami/rpc/agentReportPreview.js
server/services/ami/rpc/attachment.js
server/services/ami/rpc/campaign.js
server/services/ami/rpc/cmContact.js
server/services/ami/rpc/cmHopper.js
server/services/ami/rpc/cmHopperAdditionalPhone.js
server/services/ami/rpc/cmHopperBlack.js
server/services/ami/rpc/cmHopperFinal.js
server/services/ami/rpc/cmHopperHistory.js
server/services/ami/rpc/faxAccount.js
server/services/ami/rpc/faxMessage.js
server/services/ami/rpc/integrations/desk.js
server/services/ami/rpc/integrations/dynamics365.js
server/services/ami/rpc/integrations/freshdesk.js
server/services/ami/rpc/integrations/freshsales.js
server/services/ami/rpc/integrations/salesforce.js
server/services/ami/rpc/integrations/servicenow.js
server/services/ami/rpc/integrations/sugarcrm.js
server/services/ami/rpc/integrations/vtiger.js
server/services/ami/rpc/integrations/zendesk.js
server/services/ami/rpc/integrations/zoho.js
server/services/ami/rpc/interval.js
server/services/ami/rpc/memberReport.js
server/services/ami/rpc/setting.js
server/services/ami/rpc/template.js
server/services/ami/rpc/trigger.js
server/services/ami/rpc/trunk.js
server/services/ami/rpc/user.js
server/services/ami/rpc/voiceAgentReport.js
server/services/ami/rpc/voiceCallReport.js
server/services/ami/rpc/voiceDialReport.js
server/services/ami/rpc/voiceExtension.js
server/services/ami/rpc/voiceQueue.js
server/services/ami/rpc/voiceQueueReport.js
server/services/ami/rpc/voiceQueueRt.js
server/services/ami/rpc/voiceRecording.js
server/services/ami/rpc/voiceTransferReport.js
server/services/ami/server/index.js
server/services/ami/trigger/cmContact/index.js
server/services/ami/trigger/index.js
server/services/ami/trigger/integration/desk.js
server/services/ami/trigger/integration/dynamics365.js
server/services/ami/trigger/integration/freshdesk.js
server/services/ami/trigger/integration/freshsales.js
server/services/ami/trigger/integration/index.js
server/services/ami/trigger/integration/salesforce.js
server/services/ami/trigger/integration/servicenow.js
server/services/ami/trigger/integration/sugarcrm.js
server/services/ami/trigger/integration/util.js
server/services/ami/trigger/integration/vtiger.js
server/services/ami/trigger/integration/zendesk.js
server/services/ami/trigger/integration/zoho.js
server/services/ami/trigger/script/index.js
server/services/ami/trigger/urlforward/index.js
server/services/email/client.js
server/services/email/index.js
server/services/email/lib/email.js
server/services/email/lib/imap.js
server/services/email/lib/smtp.js
server/services/email/lib/utils.js
server/services/email/model/mailAccount.js
server/services/email/realtime/index.js
server/services/email/rpc/mailAccount.js
server/services/email/rpc/setting.js
server/services/email/server/index.js
server/services/express/index.js
server/services/routing/client.js
server/services/routing/index.js
server/services/routing/lib/rule-engine.js
server/services/routing/mailRpc/index.js
server/services/routing/model/agent.js
server/services/routing/model/chatQueue.js
server/services/routing/model/faxQueue.js
server/services/routing/model/interval.js
server/services/routing/model/mailQueue.js
server/services/routing/model/openchannelQueue.js
server/services/routing/model/smsQueue.js
server/services/routing/model/whatsappQueue.js
server/services/routing/realtime/index.js
server/services/routing/rpc/chatInteraction.js
server/services/routing/rpc/chatMessage.js
server/services/routing/rpc/chatQueue.js
server/services/routing/rpc/chatQueueReport.js
server/services/routing/rpc/faxInteraction.js
server/services/routing/rpc/faxMessage.js
server/services/routing/rpc/faxQueue.js
server/services/routing/rpc/faxQueueReport.js
server/services/routing/rpc/interval.js
server/services/routing/rpc/mailInteraction.js
server/services/routing/rpc/mailMessage.js
server/services/routing/rpc/mailQueue.js
server/services/routing/rpc/mailQueueReport.js
server/services/routing/rpc/openchannelInteraction.js
server/services/routing/rpc/openchannelMessage.js
server/services/routing/rpc/openchannelQueue.js
server/services/routing/rpc/openchannelQueueReport.js
server/services/routing/rpc/smsInteraction.js
server/services/routing/rpc/smsMessage.js
server/services/routing/rpc/smsQueue.js
server/services/routing/rpc/smsQueueReport.js
server/services/routing/rpc/user.js
server/services/routing/rpc/whatsappInteraction.js
server/services/routing/rpc/whatsappMessage.js
server/services/routing/rpc/whatsappQueue.js
server/services/routing/rpc/whatsappQueueReport.js
server/services/routing/server/applications/agent.js
server/services/routing/server/applications/amazonlex.js
server/services/routing/server/applications/autoreply.js
server/services/routing/server/applications/close.js
server/services/routing/server/applications/dialogflow.js
server/services/routing/server/applications/dialogflowV2.js
server/services/routing/server/applications/gotoif.js
server/services/routing/server/applications/gotop.js
server/services/routing/server/applications/message.js
server/services/routing/server/applications/noop.js
server/services/routing/server/applications/queue.js
server/services/routing/server/applications/strategy/agent.js
server/services/routing/server/applications/strategy/beepall.js
server/services/routing/server/applications/strategy/index.js
server/services/routing/server/applications/strategy/rrmemory.js
server/services/routing/server/applications/strategy/util.js
server/services/routing/server/applications/system.js
server/services/routing/server/applications/tag.js
server/services/routing/server/applications/tvox.js
server/services/routing/server/applications/utils.js
server/services/routing/server/index.js
server/services/routing/server/interval.js
server/services/xdr/agents.controller.js
server/services/xdr/calls.controller.js
server/services/xdr/core.controller.js
server/services/xdr/dials.controller.js
server/services/xdr/index.js
server/services/xdr/members.controller.js
server/services/xdr/queues.controller.js
server/services/xdr/recordings.controller.js
server/services/xdr/transfers.controller.js
server/services/xdr/utils.js
server/utils/client-side-logger.js
server/utils/iftime.js
server/utils/loggers.js
server/utils/mask-sensitive-data.js
server/utils/safe-template.js
server/utils/update-app-config.js

index e2ef896..e6688c1 100644 (file)
@@ -18647,7 +18647,7 @@ define({ "api": [
     ],
     "name": "notify",
     "group": "Openchannel_Accounts",
-    "description": "<p>Motion will return a HTTP status code <code>201</code> upon success.</p> <p>Motion renders the resulting JSON representation in the response body.</p> <p>Follow this link to check the documentation: <pre>&lt;a target=&quot;_blank&quot; href=&quot;https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896252245/New+Channels+Configuration+Steps&quot;</a></pre></p>",
+    "description": "<p>Motion will return a HTTP status code <code>201</code> upon success.</p> <p>Motion renders the resulting JSON representation in the response body.</p> <p>Follow this link to check the documentation: <pre><a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/New+Channels+Configuration+Steps#NewChannelsConfigurationSteps-BuildyourownChannelservice\">https://wiki.xcallymotion.com/display/XMV/New+Channels+Configuration+Steps#NewChannelsConfigurationSteps-BuildyourownChannelservice</a></pre></p>",
     "version": "0.0.0",
     "filename": "server/api/openchannelAccount/index.js",
     "groupTitle": "Openchannel_Accounts"
index ce85c1f..0586e41 100644 (file)
     ],
     "name": "notify",
     "group": "Openchannel_Accounts",
-    "description": "<p>Motion will return a HTTP status code <code>201</code> upon success.</p> <p>Motion renders the resulting JSON representation in the response body.</p> <p>Follow this link to check the documentation: <pre>&lt;a target=&quot;_blank&quot; href=&quot;https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896252245/New+Channels+Configuration+Steps&quot;</a></pre></p>",
+    "description": "<p>Motion will return a HTTP status code <code>201</code> upon success.</p> <p>Motion renders the resulting JSON representation in the response body.</p> <p>Follow this link to check the documentation: <pre><a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/New+Channels+Configuration+Steps#NewChannelsConfigurationSteps-BuildyourownChannelservice\">https://wiki.xcallymotion.com/display/XMV/New+Channels+Configuration+Steps#NewChannelsConfigurationSteps-BuildyourownChannelservice</a></pre></p>",
     "version": "0.0.0",
     "filename": "server/api/openchannelAccount/index.js",
     "groupTitle": "Openchannel_Accounts"
index 62832fd..5047605 100644 (file)
@@ -1,11 +1,11 @@
 define({
   "name": "xCALLY Motion API",
-  "version": "2.6.22",
+  "version": "2.6.24",
   "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.",
   "title": "xCALLY MOTION API",
   "header": {
     "title": "Introduction",
-    "content": "<h2>The API</h2>\n<p>This is the documentation for the xCALLY MOTION API.</p>\n<p>We make changes to the APIs from time to time. For more information, see <a href=\"https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896252454/Motion+GUI\">Changelog</a>.</p>\n<p>The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.</p>\n<p>The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].</p>\n<p>Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:</p>\n<pre class=\"prettyprint lang-sh\">GET /api/users\n</pre>\n<p>Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:</p>\n<pre class=\"prettyprint lang-sh\">https://motion.xcally.com/api/users\n</pre>\n<p>Curly braces, <code>{}</code>, indicate values you have to supply. Example:</p>\n<pre class=\"prettyprint lang-sh\">GET  /api/users/{id}\n</pre>\n<p>The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].</p>\n<p>The examples use basic authentication requiring a xCALLY username and password.</p>\n<h2>Security and Authentication</h2>\n<p>This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.</p>\n<p>Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.</p>\n<h3>Basic authentication</h3>\n<p>Use the following authentication format with your username and password:\n<code>{username}:{password}</code></p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl -u admin:password https://motion.xcally.com/api/users\n</pre>\n<h3>OAuth access token</h3>\n<p>The xCALLY API supports OAuth authorization flows.</p>\n<p>OAuth access tokens also permit client-side API requests.</p>\n<p>In your requests, specify the access token in an Authorization header as follows:\n<code>Authorization: Bearer {token}</code></p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n</pre>\n<h3>API Key</h3>\n<p>In your request, specify the API Key in apikey query parameter</p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n</pre>\n<h2>Request Format</h2>\n<p>The xCALLY API is a JSON API. You must supply a <code>Content-Type: application/json</code> header in <code>PUT</code> and <code>POST</code> requests. You must set an <code>Accept: application/json</code> header on all requests. You may get a <code>text/plain</code> response in case of an error like a bad request. You should treat this as an error you need to fix.</p>\n<h2>Response Format</h2>\n<p>The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.</p>\n<p>Responses may have the status codes described in the following sections.</p>\n<h3>200 range</h3>\n<p>The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.</p>\n<h3>400 range</h3>\n<p>The request was not successful. The content type of the response may be <code>text/plain</code> for API-level error messages, such as when trying to call the API without SSL. The content type is <code>application/json</code> for business-level error messages because the response includes a JSON object with information about the error.</p>\n<p>If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.</p>\n<h3>500 range</h3>\n<p>When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.</p>\n<p>If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.</p>\n<h2>Data Types</h2>\n<p>The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.</p>\n<h2>ID integers</h2>\n<p>Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.</p>\n<p>The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.</p>\n<h2>Time stamps</h2>\n<p>Time stamps use UTC time and are formatted as ISO 8601 strings. Example: <code>2017-04-16T09:14:57Z</code></p>\n"
+    "content": "<h2>The API</h2>\n<p>This is the documentation for the xCALLY MOTION API.</p>\n<p>We make changes to the APIs from time to time. For more information, see <a href=\"https://wiki.xcallymotion.com/display/XMV/Motion+GUI\">Changelog</a>.</p>\n<p>The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.</p>\n<p>The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].</p>\n<p>Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:</p>\n<pre class=\"prettyprint lang-sh\">GET /api/users\n</pre>\n<p>Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:</p>\n<pre class=\"prettyprint lang-sh\">https://motion.xcally.com/api/users\n</pre>\n<p>Curly braces, <code>{}</code>, indicate values you have to supply. Example:</p>\n<pre class=\"prettyprint lang-sh\">GET  /api/users/{id}\n</pre>\n<p>The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].</p>\n<p>The examples use basic authentication requiring a xCALLY username and password.</p>\n<h2>Security and Authentication</h2>\n<p>This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.</p>\n<p>Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.</p>\n<h3>Basic authentication</h3>\n<p>Use the following authentication format with your username and password:\n<code>{username}:{password}</code></p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl -u admin:password https://motion.xcally.com/api/users\n</pre>\n<h3>OAuth access token</h3>\n<p>The xCALLY API supports OAuth authorization flows.</p>\n<p>OAuth access tokens also permit client-side API requests.</p>\n<p>In your requests, specify the access token in an Authorization header as follows:\n<code>Authorization: Bearer {token}</code></p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n</pre>\n<h3>API Key</h3>\n<p>In your request, specify the API Key in apikey query parameter</p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n</pre>\n<h2>Request Format</h2>\n<p>The xCALLY API is a JSON API. You must supply a <code>Content-Type: application/json</code> header in <code>PUT</code> and <code>POST</code> requests. You must set an <code>Accept: application/json</code> header on all requests. You may get a <code>text/plain</code> response in case of an error like a bad request. You should treat this as an error you need to fix.</p>\n<h2>Response Format</h2>\n<p>The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.</p>\n<p>Responses may have the status codes described in the following sections.</p>\n<h3>200 range</h3>\n<p>The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.</p>\n<h3>400 range</h3>\n<p>The request was not successful. The content type of the response may be <code>text/plain</code> for API-level error messages, such as when trying to call the API without SSL. The content type is <code>application/json</code> for business-level error messages because the response includes a JSON object with information about the error.</p>\n<p>If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.</p>\n<h3>500 range</h3>\n<p>When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.</p>\n<p>If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.</p>\n<h2>Data Types</h2>\n<p>The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.</p>\n<h2>ID integers</h2>\n<p>Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.</p>\n<p>The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.</p>\n<h2>Time stamps</h2>\n<p>Time stamps use UTC time and are formatted as ISO 8601 strings. Example: <code>2017-04-16T09:14:57Z</code></p>\n"
   },
   "template": {
     "withGenerator": false,
@@ -17,7 +17,7 @@ define({
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2022-11-25T09:18:11.844Z",
+    "time": "2022-11-25T15:03:01.932Z",
     "url": "http://apidocjs.com",
     "version": "0.24.0"
   }
index b316e14..ba63bdc 100644 (file)
@@ -1,11 +1,11 @@
 {
   "name": "xCALLY Motion API",
-  "version": "2.6.22",
+  "version": "2.6.24",
   "description": "Thank you for choosing xCALLY MOTION, one of the first Omni Channel solution integrated with AsteriskTM and the most innovative real time solutions available on the market.",
   "title": "xCALLY MOTION API",
   "header": {
     "title": "Introduction",
-    "content": "<h2>The API</h2>\n<p>This is the documentation for the xCALLY MOTION API.</p>\n<p>We make changes to the APIs from time to time. For more information, see <a href=\"https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896252454/Motion+GUI\">Changelog</a>.</p>\n<p>The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.</p>\n<p>The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].</p>\n<p>Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:</p>\n<pre class=\"prettyprint lang-sh\">GET /api/users\n</pre>\n<p>Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:</p>\n<pre class=\"prettyprint lang-sh\">https://motion.xcally.com/api/users\n</pre>\n<p>Curly braces, <code>{}</code>, indicate values you have to supply. Example:</p>\n<pre class=\"prettyprint lang-sh\">GET  /api/users/{id}\n</pre>\n<p>The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].</p>\n<p>The examples use basic authentication requiring a xCALLY username and password.</p>\n<h2>Security and Authentication</h2>\n<p>This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.</p>\n<p>Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.</p>\n<h3>Basic authentication</h3>\n<p>Use the following authentication format with your username and password:\n<code>{username}:{password}</code></p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl -u admin:password https://motion.xcally.com/api/users\n</pre>\n<h3>OAuth access token</h3>\n<p>The xCALLY API supports OAuth authorization flows.</p>\n<p>OAuth access tokens also permit client-side API requests.</p>\n<p>In your requests, specify the access token in an Authorization header as follows:\n<code>Authorization: Bearer {token}</code></p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n</pre>\n<h3>API Key</h3>\n<p>In your request, specify the API Key in apikey query parameter</p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n</pre>\n<h2>Request Format</h2>\n<p>The xCALLY API is a JSON API. You must supply a <code>Content-Type: application/json</code> header in <code>PUT</code> and <code>POST</code> requests. You must set an <code>Accept: application/json</code> header on all requests. You may get a <code>text/plain</code> response in case of an error like a bad request. You should treat this as an error you need to fix.</p>\n<h2>Response Format</h2>\n<p>The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.</p>\n<p>Responses may have the status codes described in the following sections.</p>\n<h3>200 range</h3>\n<p>The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.</p>\n<h3>400 range</h3>\n<p>The request was not successful. The content type of the response may be <code>text/plain</code> for API-level error messages, such as when trying to call the API without SSL. The content type is <code>application/json</code> for business-level error messages because the response includes a JSON object with information about the error.</p>\n<p>If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.</p>\n<h3>500 range</h3>\n<p>When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.</p>\n<p>If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.</p>\n<h2>Data Types</h2>\n<p>The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.</p>\n<h2>ID integers</h2>\n<p>Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.</p>\n<p>The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.</p>\n<h2>Time stamps</h2>\n<p>Time stamps use UTC time and are formatted as ISO 8601 strings. Example: <code>2017-04-16T09:14:57Z</code></p>\n"
+    "content": "<h2>The API</h2>\n<p>This is the documentation for the xCALLY MOTION API.</p>\n<p>We make changes to the APIs from time to time. For more information, see <a href=\"https://wiki.xcallymotion.com/display/XMV/Motion+GUI\">Changelog</a>.</p>\n<p>The xCALLY MOTION API consists of several different APIs. Use the left sidebar menu to select one.</p>\n<p>The API is a JSON API. XML is not supported. To learn more, see [Working with JSON].</p>\n<p>Endpoints are documented with the HTTP method for the request and a partial resource identifier.\nExample:</p>\n<pre class=\"prettyprint lang-sh\">GET /api/users\n</pre>\n<p>Prepend your xCALLY URL to the resource identifier to get the full endpoint URL:</p>\n<pre class=\"prettyprint lang-sh\">https://motion.xcally.com/api/users\n</pre>\n<p>Curly braces, <code>{}</code>, indicate values you have to supply. Example:</p>\n<pre class=\"prettyprint lang-sh\">GET  /api/users/{id}\n</pre>\n<p>The examples in the docs are cURL statements. You can run the statements on a command line to try out different API requests. To learn more, see [Installing and using cURL]. In Windows, you'll need to modify some of the examples in the docs to make them work. See [Using cURL in Windows].</p>\n<p>The examples use basic authentication requiring a xCALLY username and password.</p>\n<h2>Security and Authentication</h2>\n<p>This is an SSL-only API, regardless of how your account is configured. You can authorize against the API using either basic authentication with your username and password or with an OAuth access token or API Key.</p>\n<p>Client-side CORS requests are supported if the request is authenticated with an OAuth access token. The requests are not supported if the request uses basic authentication or API Key.</p>\n<h3>Basic authentication</h3>\n<p>Use the following authentication format with your username and password:\n<code>{username}:{password}</code></p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl -u admin:password https://motion.xcally.com/api/users\n</pre>\n<h3>OAuth access token</h3>\n<p>The xCALLY API supports OAuth authorization flows.</p>\n<p>OAuth access tokens also permit client-side API requests.</p>\n<p>In your requests, specify the access token in an Authorization header as follows:\n<code>Authorization: Bearer {token}</code></p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl -H \"Authorization: Bearer gErypPlm4dOVgGRvA1ZzMH5MQ3nLo8bo\" https://motion.xcally.com/api/users\n</pre>\n<h3>API Key</h3>\n<p>In your request, specify the API Key in apikey query parameter</p>\n<p>Example:</p>\n<pre class=\"prettyprint lang-sh\">curl https://motion.xcally.com/api/users?apikey=eyJhbGciOiJIUzUxMiIsInR5cC...\n</pre>\n<h2>Request Format</h2>\n<p>The xCALLY API is a JSON API. You must supply a <code>Content-Type: application/json</code> header in <code>PUT</code> and <code>POST</code> requests. You must set an <code>Accept: application/json</code> header on all requests. You may get a <code>text/plain</code> response in case of an error like a bad request. You should treat this as an error you need to fix.</p>\n<h2>Response Format</h2>\n<p>The xCALLY API responds to successful requests with HTTP status codes in the 200 or 300 range. When you create or update a resource, the API renders the resulting JSON representation in the response body.</p>\n<p>Responses may have the status codes described in the following sections.</p>\n<h3>200 range</h3>\n<p>The request was successful. The status is 200 for successful GET and PUT requests, 201 for most POST requests, and 204 for DELETE requests.</p>\n<h3>400 range</h3>\n<p>The request was not successful. The content type of the response may be <code>text/plain</code> for API-level error messages, such as when trying to call the API without SSL. The content type is <code>application/json</code> for business-level error messages because the response includes a JSON object with information about the error.</p>\n<p>If you see a response from a known endpoint that looks like plain text, you probably made a syntax error in your request. This type of response commonly occurs when making a request to a nonexistent xCALLY Support instance.</p>\n<h3>500 range</h3>\n<p>When building an API client, we recommend treating any 500 status codes as a warning or temporary state. However, if the status persists and we don't have a publicly announced maintenance or service disruption, contact us at support@xcally.com.</p>\n<p>If submitting a ticket to Support, provide the complete HTTP response. This helps the Support team track down the request in the logs more quickly.</p>\n<h2>Data Types</h2>\n<p>The API returns and accepts JSON values, which can be strings in double quotes, numbers, objects, arrays, true or false, or null. Most programming languages have tools to parse this data.</p>\n<h2>ID integers</h2>\n<p>Most xCALLY Support resources such as queues and users are identified by the integer specified by the id attribute of API responses.</p>\n<p>The default numeric type in JavaScript, Ruby, Python, and PHP is sufficient to represent xCALLY Support ID integers.</p>\n<h2>Time stamps</h2>\n<p>Time stamps use UTC time and are formatted as ISO 8601 strings. Example: <code>2017-04-16T09:14:57Z</code></p>\n"
   },
   "template": {
     "withGenerator": false,
@@ -17,7 +17,7 @@
   "apidoc": "0.3.0",
   "generator": {
     "name": "apidoc",
-    "time": "2022-11-25T09:18:11.844Z",
+    "time": "2022-11-25T15:03:01.932Z",
     "url": "http://apidocjs.com",
     "version": "0.24.0"
   }
index e40c91e..7ce8e58 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "motion",
-  "version": "2.6.22",
+  "version": "2.6.24",
   "dependencies": {
     "@babel/code-frame": {
       "version": "7.18.6",
index 2279703..5d06901 100644 (file)
@@ -1,6 +1,6 @@
 {
   "name": "motion",
-  "version": "2.6.22",
+  "version": "2.6.24",
   "description": "xCALLY Motion is the new Realtime asynchronous solution for your multichannel contact center over Asterisk.",
   "main": "server/app.js",
   "engines": {
index 62367a8..822cea4 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "نحن نستخدم ملفات تعريف الارتباط لنمنحك أفضل تجربة. اقرأ سياسة ملفات تعريف الارتباط."
+    "COOKIE_LAW": "نحن نستخدم ملفات تعريف الارتباط لنمنحك أفضل تجربة. اقرأ <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie Policy\" class=\"blue-fg\"> سياسة ملفات تعريف الارتباط </a>."
   }
 }
index 2d99045..8a47415 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "We use cookies to give you the best experience. Read our cookie policy.",
+    "COOKIE_LAW": "We use cookies to give you the best experience. Read our <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>.",
     "ERRORS": {}
   }
 }
index 2d99045..8a47415 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "We use cookies to give you the best experience. Read our cookie policy.",
+    "COOKIE_LAW": "We use cookies to give you the best experience. Read our <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>.",
     "ERRORS": {}
   }
 }
index 0b99f17..3ce3659 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Vi bruger cookies til at give dig den bedste oplevelse. Læs vores cookiepolitik."
+    "COOKIE_LAW": "Vi bruger cookies til at give dig den bedste oplevelse. Læs vores <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> cookiepolitik </a>."
   }
 }
index ba4c556..11227ad 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Wir verwenden Cookies, um Ihnen die bestmögliche Erfahrung zu bieten. Lesen Sie unsere Cookie-Richtlinie."
+    "COOKIE_LAW": "Wir verwenden Cookies, um Ihnen die bestmögliche Erfahrung zu bieten. Lesen Sie unsere <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> Cookie-Richtlinie </a>."
   }
 }
index 2d99045..8a47415 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "We use cookies to give you the best experience. Read our cookie policy.",
+    "COOKIE_LAW": "We use cookies to give you the best experience. Read our <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>.",
     "ERRORS": {}
   }
 }
index ac52e4e..c74cc69 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Usamos cookies para brindarle la mejor experiencia. Lea nuestra política de cookies."
+    "COOKIE_LAW": "Usamos cookies para brindarle la mejor experiencia. Lea nuestra <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\"class=\"blue-fg\"> política de cookies </a>."
   }
 }
index 002d860..ee6d003 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "Kasutame küpsiseid, et pakkuda Sulle parimat kogemust. Loe meie cookie policy.",
+    "COOKIE_LAW": "Kasutame küpsiseid, et pakkuda Sulle parimat kogemust. Loe meie <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>.",
     "ERRORS": {}
   }
 }
index cad1da2..e643895 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "ما از کوکی ها استفاده می کنیم تا بهترین تجربه را به شما بدهیم. خط مشی کوکی را بخوانید."
+    "COOKIE_LAW": "ما از کوکی ها استفاده می کنیم تا بهترین تجربه را به شما بدهیم. <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> خط مشی کوکی </a> را بخوانید."
   }
 }
index 504129d..95c865f 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Käytämme evästeitä saadaksesi sinulle parhaan mahdollisen kokemuksen. Lue evästekäytäntö."
+    "COOKIE_LAW": "Käytämme evästeitä saadaksesi sinulle parhaan mahdollisen kokemuksen. Lue <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> evästekäytäntö </a>."
   }
 }
index 56b28f3..5319e13 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Nous utilisons des cookies pour vous offrir la meilleure expérience. Lisez notre politique sur les cookies."
+    "COOKIE_LAW": "Nous utilisons des cookies pour vous offrir la meilleure expérience. Lisez notre <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> politique sur les cookies </a>."
   }
 }
index 9e6f38d..e2054af 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "אנו משתמשים בקובצי cookie כדי להעניק לך חוויה מיטבית. לרשותך נוסח המדיניות שלנו בנושא קובצי cookie.",
+    "COOKIE_LAW": "אנו משתמשים בקובצי cookie כדי להעניק לך חוויה מיטבית. לרשותך נוסח <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">המדיניות שלנו בנושא קובצי cookie</a>.",
     "ERRORS": {}
   }
 }
index c27a18b..be3c5b1 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "हम आपको बेहतरीन अनुभव देने के लिए कुकीज़ का उपयोग करते हैं। हमारे कुकी नीति पढ़ें।"
+    "COOKIE_LAW": "हम आपको बेहतरीन अनुभव देने के लिए कुकीज़ का उपयोग करते हैं। हमारे <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> कुकी नीति </a> पढ़ें।"
   }
 }
index 2d99045..8a47415 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "We use cookies to give you the best experience. Read our cookie policy.",
+    "COOKIE_LAW": "We use cookies to give you the best experience. Read our <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>.",
     "ERRORS": {}
   }
 }
index ba65ebe..fb8e39c 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Kami menggunakan cookie untuk memberi Anda pengalaman terbaik. Baca kebijakan cookie kami."
+    "COOKIE_LAW": "Kami menggunakan cookie untuk memberi Anda pengalaman terbaik. Baca <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> kebijakan cookie </a> kami."
   }
 }
index 2d99045..8a47415 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "We use cookies to give you the best experience. Read our cookie policy.",
+    "COOKIE_LAW": "We use cookies to give you the best experience. Read our <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>.",
     "ERRORS": {}
   }
 }
index 364b39e..efbfc38 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Utilizziamo i cookie per fornirti un'esperienza migliore. Leggi la nostra cookie policy."
+    "COOKIE_LAW": "Utilizziamo i cookie per fornirti un'esperienza migliore. Leggi la nostra <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>."
   }
 }
index 639a80b..41f2c92 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "私たちはあなたに最高の経験を与えるためにクッキーを使用しています。クッキーポリシーをご覧ください。"
+    "COOKIE_LAW": "私たちはあなたに最高の経験を与えるためにクッキーを使用しています。 <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie Policy\" class=\"blue-fg\">クッキーポリシー</a>をご覧ください。"
   }
 }
index 8938b02..fb1d248 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "우리는 쿠키를 사용하여 최고의 경험을 제공합니다. 쿠키 정책 을 읽어보십시오."
+    "COOKIE_LAW": "우리는 쿠키를 사용하여 최고의 경험을 제공합니다. <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> 쿠키 정책 </a>을 읽어보십시오."
   }
 }
index 2d99045..8a47415 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "We use cookies to give you the best experience. Read our cookie policy.",
+    "COOKIE_LAW": "We use cookies to give you the best experience. Read our <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>.",
     "ERRORS": {}
   }
 }
index 803db53..201d1ee 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Mēs izmantojam sīkdatnes, lai sniegtu jums vislabāko pieredzi. Lasiet mūsu sīkdatņu politiku."
+    "COOKIE_LAW": "Mēs izmantojam sīkdatnes, lai sniegtu jums vislabāko pieredzi. Lasiet mūsu <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">sīkdatņu politiku</a>."
   }
 }
index 411a580..2ef529e 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Wij gebruiken cookies om u de beste ervaring te bieden. Lees ons cookiebeleid."
+    "COOKIE_LAW": "Wij gebruiken cookies om u de beste ervaring te bieden. Lees ons <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> cookiebeleid </a>."
   }
 }
index d378a1d..2423f0c 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Vi bruker informasjonskapsler for å gi deg den beste opplevelsen. Les vår informasjonskapsel."
+    "COOKIE_LAW": "Vi bruker informasjonskapsler for å gi deg den beste opplevelsen. Les vår <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> informasjonskapsel </a>."
   }
 }
index 8d145f8..230e172 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Używamy plików cookie, aby zapewnić Ci jak najlepsze wrażenia. Przeczytaj naszą politykę dotyczącą plików cookie."
+    "COOKIE_LAW": "Używamy plików cookie, aby zapewnić Ci jak najlepsze wrażenia. Przeczytaj naszą <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> politykę dotyczącą plików cookie </a>."
   }
 }
index 2d99045..8a47415 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
-    "COOKIE_LAW": "We use cookies to give you the best experience. Read our cookie policy.",
+    "COOKIE_LAW": "We use cookies to give you the best experience. Read our <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\">cookie policy</a>.",
     "ERRORS": {}
   }
 }
index 3423241..353f9d8 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Nós usamos cookies para lhe proporcionar a melhor experiência. Leia nossa política de cookies."
+    "COOKIE_LAW": "Nós usamos cookies para lhe proporcionar a melhor experiência. Leia nossa <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> política de cookies </a>."
   }
 }
index d23b6cf..b096c67 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Мы используем файлы cookie, чтобы дать вам лучший опыт. Ознакомьтесь с нашей политикой cookie."
+    "COOKIE_LAW": "Мы используем файлы cookie, чтобы дать вам лучший опыт. Ознакомьтесь с нашей <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> политикой cookie </a>."
   }
 }
index e0e4c3d..5db59f7 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Vi använder cookies för att ge dig den bästa upplevelsen. Läs vår cookie policy."
+    "COOKIE_LAW": "Vi använder cookies för att ge dig den bästa upplevelsen. Läs vår <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> cookie policy </a>."
   }
 }
index 5ebf75e..bb26fe4 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "Size en iyi deneyimi sunmak için çerezleri kullanıyoruz. çerez politikamızı okuyun."
+    "COOKIE_LAW": "Size en iyi deneyimi sunmak için çerezleri kullanıyoruz. <a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> çerez politikamızı </a> okuyun."
   }
 }
index 87fc928..ca6d024 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "我们使用cookies来为您提供最佳体验。请阅读我们的 Cookie政策。"
+    "COOKIE_LAW": "我们使用cookies来为您提供最佳体验。请阅读我们的<a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> Cookie政策</a>。"
   }
 }
index ef32d41..8f290a1 100644 (file)
@@ -1,6 +1,6 @@
 {
   "FOOTER": {
     "ERRORS": {},
-    "COOKIE_LAW": "我們使用cookies來為您提供最佳體驗。請閱讀我們的 Cookie政策。"
+    "COOKIE_LAW": "我們使用cookies來為您提供最佳體驗。請閱讀我們的<a target=\"_blank\" href=\"https://wiki.xcallymotion.com/display/XMV/Cookie+Policy\" class=\"blue-fg\"> Cookie政策</a>。"
   }
 }
index 6a12726..50de0e3 100644 (file)
     "MICROSOFT_AUTHENTICATION_SUCCESS": "Authentication to the Microsoft Identity Platform completed successfully",
     "MICROSOFT_AUTHENTICATION_FAIL": "Something went wrong while authenticating to the Microsoft Identity Platform",
     "UPDATE_CLIENT_SECRET": "Update Client Secret",
+    "FILTER_FULLNAME": "Full Name",
+    "FILTERS": "Filters",
     "HELP": {
       "DEFAULTSCREENRECORDINGPATH": "Enter the path where to store screen recording files on the Agent computer (leave empty for default Video Folder path)",
       "RTLSUPPORT": "Enables the RTL Support for Arabic, Persian and Hebrew languages",
       "SEARCH_ON_ENTER_KEY": "Start searching only after the agent hits the Enter key",
       "INTERACTIONS_RELOAD_TIMEOUT": "Time interval in seconds after which interactions are reloaded (0 = real-time update)",
       "CLIENT_SECRET": "The secret will no longer be visible once the configuration is saved. Store it safely if you want to use it elsewhere.",
-      "LIMIT_TABS": "Maximum number of possible interaction tabs open"
+      "LIMIT_TABS": "Maximum number of possible interaction tabs open",
+      "FILTER_FULLNAME": "Enable filter in Full Name field. Only numbers, letters, spaces and specific characters (_,-) will be supported"
     },
     "ERRORS": {
       "CHATTIMEOUT_REQUIRED": "Mandatory field",
index 9f67454..bcb13b8 100644 (file)
     "MICROSOFT_AUTHENTICATION_FAIL": "Si è verificato un errore durante l'autenticazione a Microsoft Identity Platform",
     "UPDATE_CLIENT_SECRET": "Aggiorna segreto dell'applicazione",
     "DISABLED_COOKIE": "Banner dei cookies",
+    "FILTER_FULLNAME": "Nome completo",
+    "FILTERS": "Filtri",
     "HELP": {
       "ADDRESS": "Indirizzo della rete",
       "LOCALNETADDRESS": "Indirizzo IP/Subnet mask",
       "SEARCH_ON_ENTER_KEY": "Avvia la ricerca soltanto quando l'agente preme il tasto Invio",
       "INTERACTIONS_RELOAD_TIMEOUT": "Intervallo di tempo espresso in secondi dopo cui vengono ricaricate le interazioni (0 = aggiornamento real-time)",
       "CLIENT_SECRET": "Il segreto non sarà più visibile una votla salvata la configurazione. Conservalo in un posto sicuro se vuoi usarlo altrove.",
-      "LIMIT_TABS": "Numero massimo di tab interazione possibili aperte"
+      "LIMIT_TABS": "Numero massimo di tab interazione possibili aperte",
+      "FILTER_FULLNAME": "Abilita il filtro nel campo Nome Completo. Verranno supportati solo numeri, lettere, spazi e caratteri specifici (_,-)"
     },
     "ERRORS": {
       "CHATTIMEOUT_REQUIRED": "Campo obbligatorio",
index a4211b6..cf6d8f9 100644 (file)
       "NOREPLYNUMBER_REQUIRED": "Mandatory field",
       "BUSYNUMBER_REQUIRED": "Mandatory field",
       "USERNAME_MUST_VALID_PATTERN": "Wrong format {{regex}}",
+      "FULLNAME_MUST_VALID_PATTERN": "Wrong format {{regex}}",
+      "CALLERID_MUST_VALID_PATTERN": "Wrong format {{regex}}",
       "REMOTECONTROLPORT_REQUIRED": "Mandatory field",
       "CHATCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO": "The value must be greater than or equal to",
       "MAILCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO": "The value must be greater than or equal to",
       "ENABLEAUTOMATICSCREENRECORDING": "The functionality is available only for voice channel",
       "MASK_SENSITIVE_DATA": "Mask any sensitive data throughout the application (e.g. phone numbers and email addresses)",
       "WSS_PORT": "Default: 8089",
-      "AD_SSO_ENABLED": "Login in with your Active Directory credentials"
+      "AD_SSO_ENABLED": "Login in with your Active Directory credentials",
+      "FILTERFULLNAME": "Only numbers, letters, spaces and specific characters (_,-) are supported"
     },
     "NEW_PASSWORD": "New Password",
     "CONFIRM_PASSWORD": "Confirm Password",
index 5d106f4..230797d 100644 (file)
@@ -79,6 +79,8 @@
       "NOREPLYNUMBER_REQUIRED": "Campo obbligatorio",
       "BUSYNUMBER_REQUIRED": "Campo obbligatorio",
       "USERNAME_MUST_VALID_PATTERN": "Il campo deve avere un formato valido {{regex}}",
+      "FULLNAME_MUST_VALID_PATTERN": "Il campo deve avere un formato valido {{regex}}",
+      "CALLERID_MUST_VALID_PATTERN": "Il campo deve avere un formato valido {{regex}}",
       "REMOTECONTROLPORT_REQUIRED": "Campo obbligatorio",
       "CHATCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO": "Il valore introdotto deve essere superiore o uguale a",
       "MAILCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO": "Il valore introdotto deve essere superiore o uguale a",
       "WHATSAPPCAPACITY": "Numero massimo di interazioni di canale simultanee per agente (0 = illimitato)",
       "MASK_SENSITIVE_DATA": "Maschera i dati sensibili in tutta l'applicazione (es. numeri di telefono e indirizzi email)",
       "WSS_PORT": "Default: 8089",
-      "AD_SSO_ENABLED": "Accedi con le tue credenziali di Active Directory"
+      "AD_SSO_ENABLED": "Accedi con le tue credenziali di Active Directory",
+      "FILTERFULLNAME": "Sono supportati solo numeri, lettere, spazi e caratteri specifici (_,-)"
     },
     "NEW_PASSWORD": "Nuova Password",
     "CONFIRM_PASSWORD": "Conferma Password",
index d3bb31a..eb29f3a 100644 (file)
@@ -66,7 +66,7 @@
   <script src="assets/plugins/angular-material-form-builder/dist/angular-material-form-builder.min.js"></script>
   <!-- ANGULAR-MATERIAL-FORM-BUILDER -->
 
-  <script src="scripts/app.788d460c.js"></script>
+  <script src="scripts/app.7844957e.js"></script>
 
   <!-- CKEDITOR -->
   <script src="assets/plugins/ckeditor/ckeditor.js"></script>
similarity index 53%
rename from public/scripts/app.788d460c.js
rename to public/scripts/app.7844957e.js
index f6f3aee..3d36447 100644 (file)
@@ -1 +1 @@
-!function(){"use strict";angular.module("app.auth",[])}(),function(){"use strict";angular.module("app.client-side-logging",[])}(),function(){"use strict";angular.module("app.core",["ngAnimate","ngAria","ngCookies","ngMessages","ngResource","ngSanitize","ngMaterial","pascalprecht.translate","ui.router","ui.router.state.events","gridster","ds.clock","angucomplete-alt"])}(),function(){"use strict";function e(e,n){e.state("app.errors_error-404",{url:"/errors/error-404",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.errors_error-404":{templateUrl:"app/errors/404/error-404.html",controller:"Error404Controller as vm"}},params:{status:404,statusText:"",data:{},config:{}},bodyClass:"error-404"}),n.addPart("app/errors/404")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-404",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.errors_error-500",{url:"/errors/error-500",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.errors_error-500":{templateUrl:"app/errors/500/error-500.html",controller:"Error500Controller as vm"}},params:{status:500,statusText:"",data:{},config:{}},bodyClass:"error-500"}),n.addPart("app/errors/500")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-500",[]).config(e)}(),function(){"use strict";angular.module("app.errors",["app.errors.error-404","app.errors.error-500"])}(),function(){"use strict";function e(e){e.addPart("app/footer")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.footer",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.forgot",{url:"/forgot",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.forgot":{templateUrl:"app/forgot/forgot.html",controller:"ForgotPasswordController as vm"}},bodyClass:"forgot"}),n.addPart("app/forgot")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.forgot",[]).config(e)}(),function(){"use strict";function e(e){e.addPart("app/header")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.header",[]).config(e)}(),function(){"use strict";angular.module("motion",["angular-toasty","app.core","app.auth","app.navigation","app.toolbar","app.quick-panel","app.header","app.footer","app.realtime","app.dashboards","app.staff","app.contactmanager","app.voice","app.chat","app.mail","app.sms","app.openchannel","app.fax","app.tools","app.callysquare","app.analytics","app.integrations","app.settings","app.motiondialer","app.help","app.jscripty","app.marketplace","app.plugins","app.video","app.whatsapp","app.login","app.forgot","app.reset","app.errors","app.user-setting","app.client-side-logging"])}(),function(){"use strict";function e(e,n){e.state("app.login",{url:"/login?token&userId",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.login":{templateUrl:"app/login/login.html",controller:"LoginController as vm"}},bodyClass:"login"}),n.addPart("app/login")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.login",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.analytics",{abstract:!0,url:"/analytics"}).state("app.analytics.metrics",{url:"/metrics",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/metrics/metrics.html",controller:"MetricsController as vm"}},resolve:{metrics:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("analyticMetric@get",{fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Metrics",fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1201})}]},authenticate:!0,permissionId:1201,bodyClass:"analytics"}).state("app.analytics.extractedReports",{url:"/extractedReports",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/extractedReports/extractedReports.html",controller:"ExtractedReportsController as vm"}},resolve:{extractedReports:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("analyticExtractedReport@get",{fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ExtractedReports",fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1202})}]},authenticate:!0,permissionId:1202,bodyClass:"analytics"}),n.addPart("app/main/apps/analytics")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.analytics",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.analytics.reports"]).config(e)}(),function(){"use strict";function e(e){e.state("app.analytics.reports",{url:"/reports",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/reports/reports.html",controller:"ReportsController as vm"}},resolve:{treeReports:["apiResolver",function(e){return e.resolve("analyticTreeReport@get",{fields:"id,tree",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1203})}]},authenticate:!0,permissionId:1203,bodyClass:"analytics"}).state("app.analytics.reports.edit",{url:"/:id?tab",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/reports/edit/view.html",controller:"ReportController as vm"}},resolve:{report:["apiResolver","$stateParams","$q","describeTable",function(e,n,a,i){var s;return e.resolve("analyticCustomReport@get",{fields:"createdAt,updatedAt,id,name,description,table,conditions,joins",id:n.id}).then(function(e){var n=[];if((s=e).joins)try{s.joins=JSON.parse(s.joins);for(var t=0;t<s.joins.length;t+=1)n.push(i.getColumns(s.joins[t].foreignTable))}catch(e){console.log(e)}return a.all(n)}).then(function(e){for(var n=0;n<e.length;n+=1)s.joins[n].foreignTableFields=_.difference(_.keys(e[n]),["$promise","$resolved"]);return s})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1203})}]},authenticate:!0,permissionId:1203,bodyClass:"analytics"})}e.$inject=["$stateProvider"],angular.module("app.analytics.reports",["ngJsTree"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.callysquare",{abstract:!0,url:"/callysquare"}).state("app.callysquare.odbcs",{url:"/odbcs",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/odbcs/odbcs.html",controller:"OdbcsController as vm"}},resolve:{odbcs:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ODBC",fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1101})}]},authenticate:!0,permissionId:1101,bodyClass:"callysquare"}).state("app.callysquare.squareRecordings",{url:"/squareRecordings",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/squareRecordings/squareRecordings.html",controller:"SquareRecordingsController as vm"}},resolve:{squareRecordings:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareRecording@get",{fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareRecordings",fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadCallySquareRecordings",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1102})}]},authenticate:!0,permissionId:1102,bodyClass:"callysquare"}),n.addPart("app/main/apps/callysquare")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.callysquare",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.callysquare.projects"]).config(e)}(),function(){"use strict";function e(e){e.state("app.callysquare.projects",{url:"/projects",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/projects/projects.html",controller:"ProjectsController as vm"}},resolve:{projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1103})}]},authenticate:!0,permissionId:1103,bodyClass:"callysquare"}).state("app.callysquare.projects.edit",{url:"/:id",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/projects/edit/view.html",controller:"ProjectController as vm"}},params:{crudPermissions:void 0},resolve:{project:["apiResolver","$stateParams",function(e,n){return e.resolve("squareProject@get",{id:n.id})}],users:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,role",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Users",mergeResources:!0,fields:"id,fullname,role",sort:"name",nolimit:!0})}],trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",sort:"name",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",type:"inbound",fields:"id,name",sort:"name",nolimit:!0})}],sounds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("sound@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Sounds",fields:"id,name",sort:"name",nolimit:!0})}],variables:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("variable@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Variables",fields:"id,name",sort:"name",nolimit:!0})}],databases:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ODBC",fields:"id,name",sort:"name",nolimit:!0})}],projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name",sort:"name",nolimit:!0})}],contexts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceContext@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Contexts",fields:"id,name",sort:"name",nolimit:!0})}],intervals:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("interval@get",{fields:"id,name,IntervalId",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Intervals",fields:"id,name,IntervalId",sort:"name",nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"id,name",sort:"name",nolimit:!0})}],templates:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("template@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Templates",fields:"id,name",sort:"name",nolimit:!0})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"name",nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"id,name",sort:"name",nolimit:!0})}],pauses:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("pause@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Pauses",fields:"id,name",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1103})}]},authenticate:!0,permissionId:1103,bodyClass:"callysquare"})}e.$inject=["$stateProvider"],angular.module("app.callysquare.projects",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.chat",{abstract:!0,url:"/chat"}).state("app.chat.chatQueues",{url:"/chatQueues",views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatQueues/chatQueues.html",controller:"ChatQueuesController as vm"}},resolve:{chatQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:501,bodyClass:"chat"}).state("app.chat.chatQueues.edit",{url:"/:id?tab",params:{chatQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatQueues/edit/view.html",controller:"ChatQueueController as vm"}},resolve:{chatQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:501,bodyClass:"chat"}).state("app.chat.chatWebsites",{url:"/chatWebsites",views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatWebsites/chatWebsites.html",controller:"ChatWebsitesController as vm"}},resolve:{chatWebsites:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatWebsites",fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}).state("app.chat.chatWebsites.edit",{url:"/:id?tab",params:{chatWebsite:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatWebsites/edit/view.html",controller:"ChatWebsiteController as vm"}},resolve:{chatWebsite:["apiResolver","$stateParams",function(e,n){return e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}),n.addPart("app/main/apps/chat")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.chat",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.chat.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.chat.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/chat/views/realtime/realtime.html",controller:"ChatRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:510})}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.agents",{url:"/agents",params:{channel:"chat"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.queues",{url:"/queues",params:{channel:"chat"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"ChatQueues":void 0,channel:"chat",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:510})}e.$inject=["$stateProvider"],angular.module("app.chat.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.contactmanager",{abstract:!0,url:"/contactmanager"}).state("app.contactmanager.lists",{url:"/lists",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/lists/lists.html",controller:"ListsController as vm"}},resolve:{lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadContactManagerLists",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:301})}]},authenticate:!0,permissionId:301,bodyClass:"contactmanager"}).state("app.contactmanager.lists.edit",{url:"/:id?tab",params:{list:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/lists/edit/view.html",controller:"ListController as vm"}},resolve:{list:["apiResolver","$stateParams",function(e,n){return e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:301})}]},authenticate:!0,permissionId:301,bodyClass:"contactmanager"}).state("app.contactmanager.companies",{url:"/companies",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/companies/companies.html",controller:"CompaniesController as vm"}},resolve:{companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get",{fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies",fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:302})}]},authenticate:!0,permissionId:302,bodyClass:"contactmanager"}).state("app.contactmanager.companies.edit",{url:"/:id?tab",params:{company:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/companies/edit/view.html",controller:"CompanyController as vm"}},resolve:{company:["apiResolver","$stateParams",function(e,n){return e.resolve("cmCompany@get",{fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:302})}]},authenticate:!0,permissionId:302,bodyClass:"contactmanager"}).state("app.contactmanager.globalCustomFields",{url:"/globalCustomFields",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/globalCustomFields.html",controller:"GlobalCustomFieldsController as vm"}},resolve:{globalCustomFields:["apiResolver","Auth",function(e,n){return e.resolve("cmCustomField@get",{fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",sort:"-updatedAt",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:304})}]},authenticate:!0,permissionId:304,bodyClass:"contactmanager"}),n.addPart("app/main/apps/contactmanager")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.contactmanager",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.contactmanager.contacts"]).config(e)}(),function(){"use strict";function e(e){e.state("app.contactmanager.contacts",{url:"/contacts?ListId&CompanyId",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/contacts/contacts.html",controller:"ContactsController as vm"}},resolve:{contacts:["apiResolver","Auth","$stateParams",function(e,n,t){return n.hasRole("admin")?e.resolve("cmContact@get",_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0},t)):e.resolve("userProfile@getResources",_.merge({id:n.getCurrentUser().userProfileId,section:"Contacts",includeAll:!0,sort:"-updatedAt",limit:10,offset:0},t))}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],listsMap:["lists",function(e){for(var n={},t=0;t<e.rows.length;t++)n[e.rows[t].id]=e.rows[t].name;return n}],companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies",fields:"id,name",sort:"name",nolimit:!0})}],companiesMap:["companies",function(e){for(var n={},t=0;t<e.rows.length;t++)n[e.rows[t].id]=e.rows[t].name;return n}],tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags",fields:"id,name",sort:"name",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:303})}]},authenticate:!0,permissionId:303,bodyClass:"contactmanager"}).state("app.contactmanager.contacts.edit",{url:"/:id?tab",params:{crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/contacts/edit/view.html",controller:"ContactController as vm"}},resolve:{contact:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@get",{id:n.id}).then(function(e){return e.dateOfBirth&&(e.dateOfBirth=new Date(e.dateOfBirth)),e}).catch(function(e){console.error(e)})}],hoppers:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHoppers",{id:n.id,fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,offset:0})}],finals:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHopperFinals",{id:n.id,fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,offset:0})}],histories:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHopperHistories",{id:n.id,fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,offset:0})}],jscriptySessions:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getJscriptySessions",{id:n.id,fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,offset:0})}],companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get"):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies"})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],customFields:["apiResolver","contact",function(e,n){return n.ListId?e.resolve("cmList@getCustomFields",{id:n.ListId}):null}],tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{sort:"name"}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:303})}]},authenticate:!0,permissionId:303,bodyClass:"contactmanager"})}e.$inject=["$stateProvider"],angular.module("app.contactmanager.contacts",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.dashboards",{abstract:!0,url:"/dashboards"}),n.addPart("app/main/apps/dashboards")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.dashboards",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.dashboards.general","app.dashboards.custom"]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.custom",{url:"/custom/:id",views:{"content@app":{templateUrl:"app/main/apps/dashboards/views/custom/custom.html",controller:"DashboardCustomController as vm"}},resolve:{voiceQueues:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("voiceQueue@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"VoiceQueues",mergeResources:!0,fields:"id,name",channel:"voice",nolimit:!0})).then(function(e){return t=e,n.resolve("rpc@getVoiceQueues",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)t&&t.id===e.rows[n].id?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged,a.abandoned+=e.rows[n].abandoned):(a=_.find(t.rows,{id:e.rows[n].id}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged","abandoned"]));return t})}],faxAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("faxAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"FaxAccounts",mergeResources:!0,fields:"id,name",channel:"fax",nolimit:!0})).then(function(e){return t=e,n.resolve("faxInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].FaxAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].FaxAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],chatWebsites:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("chatWebsite@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"ChatWebsites",mergeResources:!0,fields:"id,name",channel:"chat",nolimit:!0})).then(function(e){return t=e,n.resolve("chatInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].ChatWebsiteId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.abandoned+=e.rows[n].abandoned,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].ChatWebsiteId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","abandoned","unmanaged"]));return t})}],smsAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("smsAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"SmsAccounts",mergeResources:!0,fields:"id,name",channel:"sms",nolimit:!0})).then(function(e){return t=e,n.resolve("smsInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].SmsAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].SmsAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],openchannelAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("openchannelAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"OpenchannelAccounts",mergeResources:!0,fields:"id,name",channel:"openchannel",nolimit:!0})).then(function(e){return t=e,n.resolve("openchannelInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].OpenchannelAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].OpenchannelAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],mailAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("mailAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"MailAccounts",mergeResources:!0,fields:"id,name",channel:"mail",nolimit:!0})).then(function(e){return t=e,n.resolve("mailInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].MailAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].MailAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],whatsappAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("whatsappAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"WhatsappAccounts",mergeResources:!0,fields:"id,name",channel:"whatsapp",nolimit:!0})).then(function(e){return t=e,n.resolve("whatsappInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].WhatsappAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].WhatsappAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.custom",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.general",{url:"/general",views:{"content@app":{templateProvider:["$stateParams","$templateFactory","Auth","$window",function(e,n,t,a){var i=t.getCurrentUser();return null===a.localStorage.getItem("motion2.user:"+i.id)&&a.localStorage.setItem("motion2.user:"+i.id,JSON.stringify({authenticationType:"google"})),t.isAgent()?n.fromUrl("app/main/apps/dashboards/views/general/agent/agent.general.html",e):n.fromUrl("app/main/apps/dashboards/views/general/user/user.general.html",e)}],controllerProvider:["Auth",function(e){return e.isAgent()?"AgentDashboardGeneralController as vm":"UserDashboardGeneralController as vm"}]}},resolve:{globalUserLists:["apiResolver","Auth",function(e,n){return e.resolve("user@getLists",{id:n.getCurrentUser().id,sort:"name",nolimit:!0})}],globalLists:["apiResolver",function(e){return e.resolve("cmList@get",{sort:"name",nolimit:!0})}],globalTags:["apiResolver",function(e){return e.resolve("tag@get",{sort:"name",nolimit:!0})}],globalCompanies:["apiResolver",function(e){return e.resolve("cmCompany@get",{sort:"name",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general",["ngMaterialDateRangePicker","app.dashboards.general.user"]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.general.voice",{url:"/voice",data:{selectedTab:0},views:{voice:{templateUrl:"app/main/apps/dashboards/views/general/user/voice/user.general.voice.html",controller:"UserVoiceDashboardGeneralController as vm"}},resolve:{rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}],inboundQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"inbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",fields:"id,name",type:"inbound",channel:"voice",nolimit:!0})}],outbound:["apiResolver",function(e){return e.resolve("rpc@getOutbound")}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.dialer",{url:"/dialer",data:{selectedTab:1},views:{dialer:{templateUrl:"app/main/apps/dashboards/views/general/user/dialer/user.general.dialer.html",controller:"UserVoiceDashboardDialerController as vm"}},resolve:{rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}],outboundQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"outbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",fields:"id,name",type:"outbound",channel:"voice",nolimit:!0})}],rpcCampaigns:["apiResolver",function(e){return e.resolve("rpc@getCampaigns")}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.chat",{url:"/chat",data:{selectedTab:2},views:{chat:{templateUrl:"app/main/apps/dashboards/views/general/user/chat/user.general.chat.html",controller:"UserChatDashboardGeneralController as vm"}},resolve:{chatInteractions:["apiResolver",function(e){return e.resolve("chatInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,ChatWebsiteId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],chatWebsites:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatWebsite@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatWebsites",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.mail",{url:"/mail",data:{selectedTab:3},views:{mail:{templateUrl:"app/main/apps/dashboards/views/general/user/mail/user.general.mail.html",controller:"UserMailDashboardGeneralController as vm"}},resolve:{mailInteractions:["apiResolver",function(e){return e.resolve("mailInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,MailAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.sms",{url:"/sms",data:{selectedTab:4},views:{sms:{templateUrl:"app/main/apps/dashboards/views/general/user/sms/user.general.sms.html",controller:"UserSmsDashboardGeneralController as vm"}},resolve:{smsInteractions:["apiResolver",function(e){return e.resolve("smsInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,SmsAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.openchannel",{url:"/openchannel",data:{selectedTab:5},views:{openchannel:{templateUrl:"app/main/apps/dashboards/views/general/user/openchannel/user.general.openchannel.html",controller:"UserOpenchannelDashboardGeneralController as vm"}},resolve:{openchannelInteractions:["apiResolver",function(e){return e.resolve("openchannelInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,OpenchannelAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],openchannelAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.fax",{url:"/fax",data:{selectedTab:6},views:{fax:{templateUrl:"app/main/apps/dashboards/views/general/user/fax/user.general.fax.html",controller:"UserFaxDashboardGeneralController as vm"}},resolve:{faxInteractions:["apiResolver",function(e){return e.resolve("faxInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,FaxAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.whatsapp",{url:"/whatsapp",data:{selectedTab:7},views:{whatsapp:{templateUrl:"app/main/apps/dashboards/views/general/user/whatsapp/user.general.whatsapp.html",controller:"UserWhatsappDashboardGeneralController as vm"}},resolve:{whatsappInteractions:["apiResolver",function(e){return e.resolve("whatsappInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,WhatsappAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],whatsappAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general.user",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.fax",{abstract:!0,url:"/fax"}).state("app.fax.faxQueues",{url:"/faxQueues",views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxQueues/faxQueues.html",controller:"FaxQueuesController as vm"}},resolve:{faxQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:901,bodyClass:"fax"}).state("app.fax.faxQueues.edit",{url:"/:id?tab",params:{faxQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxQueues/edit/view.html",controller:"FaxQueueController as vm"}},resolve:{faxQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:901,bodyClass:"fax"}).state("app.fax.faxAccounts",{url:"/faxAccounts",views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxAccounts/faxAccounts.html",controller:"FaxAccountsController as vm"}},resolve:{faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}).state("app.fax.faxAccounts.edit",{url:"/:id?tab",params:{faxAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxAccounts/edit/view.html",controller:"FaxAccountController as vm"}},resolve:{faxAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}),n.addPart("app/main/apps/fax")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.fax",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.fax.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.fax.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/fax/views/realtime/realtime.html",controller:"FaxRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:910})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.agents",{url:"/agents",params:{channel:"fax"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.trunks",{url:"/trunks",controller:"TrunksFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/trunks/view.html",resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.queues",{url:"/queues",params:{channel:"fax"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"FaxQueues":void 0,channel:"fax",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.accounts",{url:"/accounts",controller:"FaxAccountsRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/accounts/view.html",resolve:{faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",sort:"name",limit:10,offset:0})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}],rpcFaxAccounts:["apiResolver",function(e){return e.resolve("rpc@getFaxAccounts")}]},authenticate:!0,permissionId:910})}e.$inject=["$stateProvider"],angular.module("app.fax.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.help",{abstract:!0,url:"/help"}),n.addPart("app/main/apps/help")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.help",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.help.about"]).config(e)}(),function(){"use strict";function e(e){e.state("app.help.about",{url:"/about",views:{"content@app":{templateUrl:"app/main/apps/help/views/about/about.html",controller:"AboutController as vm"}},resolve:{info:["apiResolver",function(e){return e.resolve("version@get")}]},authenticate:!0,permissionId:1600,bodyClass:"help"})}e.$inject=["$stateProvider"],angular.module("app.help.about",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.integrations",{abstract:!0,url:"/integrations"}).state("app.integrations.zendeskAccounts",{url:"/zendeskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zendeskAccounts/zendeskAccounts.html",controller:"ZendeskAccountsController as vm"}},resolve:{zendeskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ZendeskAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1301})}]},authenticate:!0,permissionId:1301,bodyClass:"integrations"}).state("app.integrations.zendeskAccounts.edit",{url:"/:id?tab",params:{zendeskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/view.html",controller:"ZendeskAccountController as vm"}},resolve:{zendeskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1301})}]},authenticate:!0,permissionId:1301,bodyClass:"integrations"}).state("app.integrations.salesforceAccounts",{url:"/salesforceAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/salesforceAccounts/salesforceAccounts.html",controller:"SalesforceAccountsController as vm"}},resolve:{salesforceAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SalesforceAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1302})}]},authenticate:!0,permissionId:1302,bodyClass:"integrations"}).state("app.integrations.salesforceAccounts.edit",{url:"/:id?tab",params:{salesforceAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/view.html",controller:"SalesforceAccountController as vm"}},resolve:{salesforceAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1302})}]},authenticate:!0,permissionId:1302,bodyClass:"integrations"}).state("app.integrations.freshdeskAccounts",{url:"/freshdeskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/freshdeskAccounts.html",controller:"FreshdeskAccountsController as vm"}},resolve:{freshdeskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FreshdeskAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1303})}]},authenticate:!0,permissionId:1303,bodyClass:"integrations"}).state("app.integrations.freshdeskAccounts.edit",{url:"/:id?tab",params:{freshdeskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/view.html",controller:"FreshdeskAccountController as vm"}},resolve:{freshdeskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1303})}]},authenticate:!0,permissionId:1303,bodyClass:"integrations"}).state("app.integrations.sugarcrmAccounts",{url:"/sugarcrmAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/sugarcrmAccounts.html",controller:"SugarcrmAccountsController as vm"}},resolve:{sugarcrmAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SugarcrmAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1305})}]},authenticate:!0,permissionId:1305,bodyClass:"integrations"}).state("app.integrations.sugarcrmAccounts.edit",{url:"/:id?tab",params:{sugarcrmAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/view.html",controller:"SugarcrmAccountController as vm"}},resolve:{sugarcrmAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1305})}]},authenticate:!0,permissionId:1305,bodyClass:"integrations"}).state("app.integrations.deskAccounts",{url:"/deskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/deskAccounts/deskAccounts.html",controller:"DeskAccountsController as vm"}},resolve:{deskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"DeskAccounts",fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1306})}]},authenticate:!0,permissionId:1306,bodyClass:"integrations"}).state("app.integrations.deskAccounts.edit",{url:"/:id?tab",params:{deskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/view.html",controller:"DeskAccountController as vm"}},resolve:{deskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1306})}]},authenticate:!0,permissionId:1306,bodyClass:"integrations"}).state("app.integrations.zohoAccounts",{url:"/zohoAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zohoAccounts/zohoAccounts.html",controller:"ZohoAccountsController as vm"}},resolve:{zohoAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ZohoAccounts",fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1307})}]},authenticate:!0,permissionId:1307,bodyClass:"integrations"}).state("app.integrations.zohoAccounts.edit",{url:"/:id?tab",params:{zohoAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/view.html",controller:"ZohoAccountController as vm"}},resolve:{zohoAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1307})}]},authenticate:!0,permissionId:1307,bodyClass:"integrations"}).state("app.integrations.vtigerAccounts",{url:"/vtigerAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/vtigerAccounts/vtigerAccounts.html",controller:"VtigerAccountsController as vm"}},resolve:{vtigerAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VtigerAccounts",fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1308})}]},authenticate:!0,permissionId:1308,bodyClass:"integrations"}).state("app.integrations.vtigerAccounts.edit",{url:"/:id?tab",params:{vtigerAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/view.html",controller:"VtigerAccountController as vm"}},resolve:{vtigerAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1308})}]},authenticate:!0,permissionId:1308,bodyClass:"integrations"}).state("app.integrations.dynamics365Accounts",{url:"/dynamics365Accounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/dynamics365Accounts.html",controller:"Dynamics365AccountsController as vm"}},resolve:{dynamics365Accounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication,CloudProviderId",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dynamics365Accounts",fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",type:"Dynamics365",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1309})}]},authenticate:!0,permissionId:1309,bodyClass:"integrations"}).state("app.integrations.dynamics365Accounts.edit",{url:"/:id?tab",params:{dynamics365Account:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/view.html",controller:"Dynamics365AccountController as vm"}},resolve:{dynamics365Account:["apiResolver","$stateParams",function(e,n){return e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication,CloudProviderId",id:n.id})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",type:"Dynamics365",limit:10,offset:0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1309})}]},authenticate:!0,permissionId:1309,bodyClass:"integrations"}).state("app.integrations.servicenowAccounts",{url:"/servicenowAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/servicenowAccounts/servicenowAccounts.html",controller:"ServicenowAccountsController as vm"}},resolve:{servicenowAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ServicenowAccounts",fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}).state("app.integrations.servicenowAccounts.edit",{url:"/:id?tab",params:{servicenowAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/view.html",controller:"ServicenowAccountController as vm"}},resolve:{servicenowAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}).state("app.integrations.freshsalesAccounts",{url:"/freshsalesAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/freshsalesAccounts.html",controller:"FreshsalesAccountsController as vm"}},resolve:{freshsalesAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intFreshsalesAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FreshsalesAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1304})}]},authenticate:!0,permissionId:1304,bodyClass:"integrations"}).state("app.integrations.freshsalesAccounts.edit",{url:"/:id?tab",params:{freshsalesAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/view.html",controller:"FreshsalesAccountController as vm"}},resolve:{freshsalesAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intFreshsalesAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1304})}]},authenticate:!0,permissionId:1304,bodyClass:"integrations"}),n.addPart("app/main/apps/integrations")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.integrations",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.jscripty",{abstract:!0,url:"/jscripty"}).state("app.jscripty.projects",{url:"/projects",views:{"content@app":{templateUrl:"app/main/apps/jscripty/views/projects/projects.html",controller:"JscriptyProjectsController as vm"}},resolve:{projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Projects",fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadJscriptySessions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}).state("app.jscripty.projects.edit",{url:"/:id?tab",params:{project:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/jscripty/views/projects/edit/view.html",controller:"JscriptyProjectController as vm"}},resolve:{project:["apiResolver","$stateParams",function(e,n){return e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadJscriptySessions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}),n.addPart("app/main/apps/jscripty")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.jscripty",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.mail",{abstract:!0,url:"/mail"}).state("app.mail.mailQueues",{url:"/mailQueues",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailQueues/mailQueues.html",controller:"MailQueuesController as vm"}},resolve:{mailQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:601,bodyClass:"mail"}).state("app.mail.mailQueues.edit",{url:"/:id?tab",params:{mailQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailQueues/edit/view.html",controller:"MailQueueController as vm"}},resolve:{mailQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:601,bodyClass:"mail"}).state("app.mail.mailAccounts",{url:"/mailAccounts",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailAccounts/mailAccounts.html",controller:"MailAccountsController as vm"}},resolve:{mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,key,email,ListId,active,cservice,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"createdAt,updatedAt,id,name,key,email,ListId,active,cservice,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}]},authenticate:!0,permissionId:602,bodyClass:"mail"}).state("app.mail.mailAccounts.edit",{url:"/:id?tab",params:{mailAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailAccounts/edit/view.html",controller:"MailAccountController as vm"}},resolve:{mailAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,key,email,ListId,active,cservice,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}]},authenticate:!0,permissionId:602,bodyClass:"mail"}).state("app.mail.mailSubtatuses",{url:"/mailSubtatuses",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailSubtatuses/mailSubtatuses.html",controller:"MailSubstatusesController as vm"}},resolve:{mailSubtatuses:["apiResolver",function(e){return e.resolve("mailSubstatus@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:603})}]},authenticate:!0,permissionId:603,bodyClass:"mail"}),n.addPart("app/main/apps/mail")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.mail",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.mail.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.mail.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/mail/views/realtime/realtime.html",controller:"MailRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:610})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.agents",{url:"/agents",params:{channel:"mail"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.queues",{url:"/queues",params:{channel:"mail"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"MailQueues":void 0,channel:"mail",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.accounts",{url:"/accounts",controller:"MailAccountsRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/accounts/view.html",resolve:{mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",sort:"name",limit:10,offset:0})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}],rpcMailAccounts:["apiResolver",function(e){return e.resolve("rpc@getMailAccounts")}]},authenticate:!0,permissionId:610})}e.$inject=["$stateProvider"],angular.module("app.mail.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.marketplace",{abstract:!0,url:"/marketplace"}).state("app.marketplace.plugins",{url:"/plugins",views:{"content@app":{templateUrl:"app/main/apps/marketplace/views/plugins/plugins.html",controller:"MarketplacePluginsController as vm"}},resolve:{plugins:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Plugins",fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}).state("app.marketplace.plugins.edit",{url:"/:id?tab",params:{plugin:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/marketplace/views/plugins/edit/view.html",controller:"MarketplacePluginController as vm"}},resolve:{plugin:["apiResolver","$stateParams",function(e,n){return e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}),n.addPart("app/main/apps/marketplace")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.marketplace",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.motiondialer",{abstract:!0,url:"/motiondialer"}).state("app.motiondialer.queueCampaigns",{url:"/queueCampaigns",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/queueCampaigns.html",controller:"QueueCampaignsController as vm"}},resolve:{queueCampaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe,dialPreviewRecallmeReminder",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1501,bodyClass:"motiondialer"}).state("app.motiondialer.queueCampaigns.edit",{url:"/:id?tab",params:{queueCampaign:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/view.html",controller:"QueueCampaignController as vm"}},resolve:{queueCampaign:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe,dialPreviewRecallmeReminder,callAdditionalPhoneAfterMin",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1501,bodyClass:"motiondialer"}).state("app.motiondialer.ivrCampaigns",{url:"/ivrCampaigns",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/ivrCampaigns.html",controller:"IvrCampaignsController as vm"}},resolve:{ivrCampaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("campaign@get",{fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"IvrCampaigns",fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}).state("app.motiondialer.ivrCampaigns.edit",{url:"/:id?tab",params:{ivrCampaign:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/view.html",controller:"IvrCampaignController as vm"}},resolve:{ivrCampaign:["apiResolver","$stateParams",function(e,n){return e.resolve("campaign@get",{fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}),n.addPart("app/main/apps/motiondialer")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.motiondialer",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.motiondialer.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.motiondialer.hopperdate",{url:"/hopperdate",views:{"hopperdate@app":{templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",controller:"HopperdateController as vm"}},resolve:{info:["apiResolver",function(e){return e.resolve("version@get")}]},authenticate:!0,permissionId:1500,bodyClass:"motiondialer"})}e.$inject=["$stateProvider"],angular.module("app.motiondialer.hopperdate",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.motiondialer.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/realtime/realtime.html",controller:"MotionDialerRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1510})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.agents",{url:"/agents",params:{channel:"voice",direction:"outbound"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queues",{url:"/queues",params:{channel:"voice",direction:"outbound"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"QueueCampaigns":void 0,channel:"voice",type:"outbound",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_calls",{url:"/queue_calls",params:{direction:"outbound"},controller:"QueueCallsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queue-calls/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"outbound",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,fields:"id,name",section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}],voiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels",{type:"outbound"})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.abandonedcalls",{url:"/abandonedcalls",controller:"AbandonedCallsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/abandonedcalls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context,createdAt",role:"agent",sort:"-createdAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context,createdAt",role:"agent",sort:"-createdAt",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"name",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_params",{url:"/queue_params",controller:"QueueParamsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queue_params/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",fields:"id,name",sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"name",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.ivr_campaigns",{url:"/ivr_campaigns",controller:"IvrCampaignsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/ivr_campaigns/view.html",resolve:{campaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("campaign@get",{sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"IvrCampaigns",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}],rpcCampaigns:["apiResolver",function(e){return e.resolve("rpc@getCampaigns")}]},authenticate:!0,permissionId:1510})}e.$inject=["$stateProvider"],angular.module("app.motiondialer.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.openchannel",{abstract:!0,url:"/openchannel"}).state("app.openchannel.openchannelQueues",{url:"/openchannelQueues",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelQueues/openchannelQueues.html",controller:"OpenchannelQueuesController as vm"}},resolve:{openchannelQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:801,bodyClass:"openchannel"}).state("app.openchannel.openchannelQueues.edit",{url:"/:id?tab",params:{openchannelQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/view.html",controller:"OpenchannelQueueController as vm"}},resolve:{openchannelQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:801,bodyClass:"openchannel"}).state("app.openchannel.openchannelAccounts",{url:"/openchannelAccounts",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/openchannelAccounts.html",controller:"OpenchannelAccountsController as vm"}},resolve:{openchannelAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}).state("app.openchannel.openchannelAccounts.edit",{url:"/:id?tab",params:{openchannelAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/view.html",controller:"OpenchannelAccountController as vm"}},resolve:{openchannelAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}),n.addPart("app/main/apps/openchannel")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.openchannel",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.openchannel.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.openchannel.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/realtime/realtime.html",controller:"OpenchannelRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:810})}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.agents",{url:"/agents",params:{channel:"openchannel"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.queues",{url:"/queues",params:{channel:"openchannel"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"OpenchannelQueues":void 0,channel:"openchannel",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:810})}e.$inject=["$stateProvider"],angular.module("app.openchannel.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.plugins",{abstract:!0,url:"/plugins"}),n.addPart("app/main/apps/plugins")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.plugins",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.plugins.plugin"]).config(e)}(),function(){"use strict";function e(e){e.state("app.plugins.plugin",{url:"/plugin/:id",views:{"content@app":{templateUrl:"app/main/apps/plugins/views/plugin/plugin.html",controller:"PluginController as vm"}},resolve:{},authenticate:!0,bodyClass:"plugins"})}e.$inject=["$stateProvider"],angular.module("app.plugins.plugin",[]).config(e)}(),function(){"use strict";angular.module("app.realtime",[])}(),function(){"use strict";function e(e,n){e.state("app.settings",{abstract:!0,url:"/settings"}).state("app.settings.generals",{url:"/generals",views:{"content@app":{templateUrl:"app/main/apps/settings/views/generals/generals.html",controller:"GeneralsController as vm"}},resolve:{generals:["apiResolver",function(e){return e.resolve("setting@get",{fields:"createdAt,updatedAt,id,min_internal,securePassword,callRecordingEncryption,chatTimeout,phoneBarAutoUpdater,defaultScreenRecordingPath,phoneBarAutoUpdaterUrl,enableEmailPreview,split,splitSizeCsv,splitSizePdf,splitSizeXlsx,searchOnEnterKey,messagesAlignment,phoneBarRememberMeEnabled,rtlSupport,allowedLoginAttempts,blockDuration,loginMailFrequency,language,bucket,transcribe,transcribeRegion,transcribeAccountId,sentiment,sentimentRegion,sentimentAccountId,googleSsoEnabled,enforcePasswordHistory,passwordHistoryLimit,enablePrivacyPolicyEmail,privacyPolicyEmail,enablePrivacyPolicyName,privacyPolicyName,enablePrivacyPolicyNumber,privacyPolicyNumber,chatInteractionsReloadTimeout,mailInteractionsReloadTimeout,openchannelInteractionsReloadTimeout,smsInteractionsReloadTimeout,whatsappInteractionsReloadTimeout,stopRecordingOnTransfer,adSsoEnabled,disabledCookie,previewRecallmeReminderInterval,limitTabs",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.smtps",{url:"/smtps",views:{"content@app":{templateUrl:"app/main/apps/settings/views/smtps/smtps.html",controller:"SmtpController as vm"}},resolve:{mailAccounts:["apiResolver",function(e){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,service,provider,name,email,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,description",service:"1",limit:10,offset:0})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.networks",{url:"/networks",views:{"content@app":{templateUrl:"app/main/apps/settings/views/networks/networks.html",controller:"NetworksController as vm"}},resolve:{networks:["apiResolver",function(e){return e.resolve("network@get",{fields:"createdAt,updatedAt,id,type,value,username,password",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.customizations",{url:"/customizations",views:{"content@app":{templateUrl:"app/main/apps/settings/views/customizations/customizations.html",controller:"CustomizationsController as vm"}},resolve:{customizations:["apiResolver",function(e){return e.resolve("setting@get",{fields:"createdAt,updatedAt,id,defaultLogo,defaultLoginLogo,defaultFavicon,defaultHeaderWhiteLabel,headerWhiteLabel,defaultPageTitle,pageTitle,defaultPreferred",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.cloudProviders",{url:"/cloudProviders",views:{"content@app":{templateUrl:"app/main/apps/settings/views/cloudProviders/cloudProviders.html",controller:"CloudProvidersController as vm"}},resolve:{cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}),n.addPart("app/main/apps/settings")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.settings",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.settings.updates","app.settings.license","app.settings.system"]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.license",{url:"/license",views:{"content@app":{templateUrl:"app/main/apps/settings/views/license/license.html",controller:"LicenseController as vm"}},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.license",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.system",{url:"/system?tab",views:{"content@app":{templateUrl:"app/main/apps/settings/views/system/system.html",controller:"SystemController as vm"}},resolve:{system:["apiResolver",function(e){return e.resolve("system@get")}],processes:["apiResolver",function(e){return e.resolve("pm2@get")}]},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.system",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.updates",{url:"/updates",views:{"content@app":{templateUrl:"app/main/apps/settings/views/updates/updates.html",controller:"UpdatesController as vm"}},resolve:{version:["apiResolver",function(e){return e.resolve("version@get",{latest:!0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1400})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.updates",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.sms",{abstract:!0,url:"/sms"}).state("app.sms.smsQueues",{url:"/smsQueues",views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsQueues/smsQueues.html",controller:"SmsQueuesController as vm"}},resolve:{smsQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:701,bodyClass:"sms"}).state("app.sms.smsQueues.edit",{url:"/:id?tab",params:{smsQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsQueues/edit/view.html",controller:"SmsQueueController as vm"}},resolve:{smsQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:701,bodyClass:"sms"}).state("app.sms.smsAccounts",{url:"/smsAccounts",views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsAccounts/smsAccounts.html",controller:"SmsAccountsController as vm"}},resolve:{smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}).state("app.sms.smsAccounts.edit",{url:"/:id?tab",params:{smsAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsAccounts/edit/view.html",controller:"SmsAccountController as vm"}},resolve:{smsAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}),n.addPart("app/main/apps/sms")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.sms",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.sms.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.sms.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/sms/views/realtime/realtime.html",controller:"SmsRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:710})}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.agents",{url:"/agents",params:{channel:"sms"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.queues",{url:"/queues",params:{channel:"sms"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"SmsQueues":void 0,channel:"sms",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:710})}e.$inject=["$stateProvider"],angular.module("app.sms.realtime",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.staff",{abstract:!0,url:"/staff"}).state("app.staff.users",{url:"/users",views:{"content@app":{templateUrl:"app/main/apps/staff/views/users/users.html",controller:"UsersController as vm"}},resolve:{users:["apiResolver",function(e){return e.resolve("user@get",{fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",role:"admin,user",sort:"-updatedAt",userSetting:!0,limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:201})}]},authenticate:!0,permissionId:201,bodyClass:"staff"}).state("app.staff.users.edit",{url:"/:id?tab",params:{user:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/users/edit/view.html",controller:"UserController as vm"}},resolve:{user:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",id:n.id,userSetting:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:201})}]},authenticate:!0,permissionId:201,bodyClass:"staff"}).state("app.staff.agents",{url:"/agents",views:{"content@app":{templateUrl:"app/main/apps/staff/views/agents/agents.html",controller:"AgentsController as vm"}},resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",role:"agent",sort:"-updatedAt",userSetting:!0,limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",role:"agent",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:202,bodyClass:"staff"}).state("app.staff.agents.edit",{url:"/:id?tab",params:{agent:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/agents/edit/view.html",controller:"AgentController as vm"}},resolve:{agent:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",id:n.id,userSetting:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:202,bodyClass:"staff"}).state("app.staff.telephones",{url:"/telephones",views:{"content@app":{templateUrl:"app/main/apps/staff/views/telephones/telephones.html",controller:"TelephonesController as vm"}},resolve:{telephones:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Telephones",fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}]},authenticate:!0,permissionId:203,bodyClass:"staff"}).state("app.staff.telephones.edit",{url:"/:id?tab",params:{telephone:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/telephones/edit/view.html",controller:"TelephoneController as vm"}},resolve:{telephone:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}]},authenticate:!0,permissionId:203,bodyClass:"staff"}).state("app.staff.teams",{url:"/teams",views:{"content@app":{templateUrl:"app/main/apps/staff/views/teams/teams.html",controller:"TeamsController as vm"}},resolve:{teams:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("team@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Teams",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:204})}]},authenticate:!0,permissionId:204,bodyClass:"staff"}).state("app.staff.userProfiles",{url:"/userProfiles",views:{"content@app":{templateUrl:"app/main/apps/staff/views/userProfiles/userProfiles.html",controller:"UserProfilesController as vm"}},resolve:{userProfiles:["apiResolver",function(e){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}).state("app.staff.userProfiles.edit",{url:"/:id?tab",params:{userProfile:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/userProfiles/edit/view.html",controller:"UserProfileController as vm"}},resolve:{userProfile:["apiResolver","$stateParams",function(e,n){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}),n.addPart("app/main/apps/staff")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.staff",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.tools",{abstract:!0,url:"/tools"}).state("app.tools.cannedAnswers",{url:"/cannedAnswers",views:{"content@app":{templateUrl:"app/main/apps/tools/views/cannedAnswers/cannedAnswers.html",controller:"CannedAnswersController as vm"}},resolve:{cannedAnswers:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cannedAnswer@get",{fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"CannedAnswers",fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1001})}]},authenticate:!0,permissionId:1001,bodyClass:"tools"}).state("app.tools.customDashboards",{url:"/customDashboards",views:{"content@app":{templateUrl:"app/main/apps/tools/views/customDashboards/customDashboards.html",controller:"CustomDashboardsController as vm"}},resolve:{customDashboards:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"CustomDashboards",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"tools"}).state("app.tools.customDashboards.edit",{url:"/:id?tab",params:{customDashboard:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/customDashboards/edit/view.html",controller:"CustomDashboardController as vm"}},resolve:{customDashboard:["apiResolver","$stateParams",function(e,n){return e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"tools"}).state("app.tools.intervals",{url:"/intervals",views:{"content@app":{templateUrl:"app/main/apps/tools/views/intervals/intervals.html",controller:"IntervalsController as vm"}},resolve:{intervals:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Intervals",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1004})}]},authenticate:!0,permissionId:1004,bodyClass:"tools"}).state("app.tools.intervals.edit",{url:"/:id?tab",params:{interval:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/intervals/edit/view.html",controller:"IntervalController as vm"}},resolve:{interval:["apiResolver","$stateParams",function(e,n){return e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1004})}]},authenticate:!0,permissionId:1004,bodyClass:"tools"}).state("app.tools.pauses",{url:"/pauses",views:{"content@app":{templateUrl:"app/main/apps/tools/views/pauses/pauses.html",controller:"PausesController as vm"}},resolve:{pauses:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("pause@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Pauses",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1005})}]},authenticate:!0,permissionId:1005,bodyClass:"tools"}).state("app.tools.schedules",{url:"/schedules",views:{"content@app":{templateUrl:"app/main/apps/tools/views/schedules/schedules.html",controller:"SchedulesController as vm"}},resolve:{schedules:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("schedule@get",{fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Scheduler",fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1006})}]},authenticate:!0,permissionId:1006,bodyClass:"tools"}).state("app.tools.sounds",{url:"/sounds",views:{"content@app":{templateUrl:"app/main/apps/tools/views/sounds/sounds.html",controller:"SoundsController as vm"}},resolve:{sounds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("sound@get",{fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Sounds",fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1007})}]},authenticate:!0,permissionId:1007,bodyClass:"tools"}).state("app.tools.tags",{url:"/tags",views:{"content@app":{templateUrl:"app/main/apps/tools/views/tags/tags.html",controller:"TagsController as vm"}},resolve:{tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags",fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1008})}]},authenticate:!0,permissionId:1008,bodyClass:"tools"}).state("app.tools.templates",{url:"/templates",views:{"content@app":{templateUrl:"app/main/apps/tools/views/templates/templates.html",controller:"TemplatesController as vm"}},resolve:{templates:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("template@get",{fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Templates",fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1009})}]},authenticate:!0,permissionId:1009,bodyClass:"tools"}).state("app.tools.trunks",{url:"/trunks",views:{"content@app":{templateUrl:"app/main/apps/tools/views/trunks/trunks.html",controller:"TrunksController as vm"}},resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}]},authenticate:!0,permissionId:1011,bodyClass:"tools"}).state("app.tools.trunks.edit",{url:"/:id?tab",params:{trunk:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/trunks/edit/view.html",controller:"TrunkController as vm"}},resolve:{trunk:["apiResolver","$stateParams",function(e,n){return e.resolve("trunk@get",{fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}]},authenticate:!0,permissionId:1011,bodyClass:"tools"}).state("app.tools.variables",{url:"/variables",views:{"content@app":{templateUrl:"app/main/apps/tools/views/variables/variables.html",controller:"VariablesController as vm"}},resolve:{variables:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("variable@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Variables",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1012})}]},authenticate:!0,permissionId:1012,bodyClass:"tools"}).state("app.tools.contact_item_types",{url:"/contact_item_types",views:{"content@app":{templateUrl:"app/main/apps/tools/views/contact_item_types/contact_item_types.html",controller:"ContactItemTypesController as vm"}},resolve:{contact_item_types:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("contactItemType@get",{fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ContactItemType",fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1013})}]},authenticate:!0,permissionId:1013,bodyClass:"tools"}),n.addPart("app/main/apps/tools")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.tools",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.tools.dispositions","app.tools.triggers"]).config(e)}(),function(){"use strict";function e(e){e.state("app.tools.dispositions",{url:"/dispositions",views:{"content@app":{templateUrl:"app/main/apps/tools/views/dispositions/dispositions.html",controller:"DispositionsController as vm"}},resolve:{dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1002})}]},authenticate:!0,permissionId:1002,bodyClass:"tools"})}e.$inject=["$stateProvider"],angular.module("app.tools.dispositions",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.tools.triggers",{url:"/triggers",views:{"content@app":{templateUrl:"app/main/apps/tools/views/triggers/triggers.html",controller:"TriggersController as vm"}},resolve:{triggers:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Triggers",fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,bodyClass:"tools"}).state("app.tools.triggers.edit",{url:"/:id?tab",params:{trigger:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/triggers/edit/view.html",controller:"TriggerController as vm"}},resolve:{trigger:["apiResolver","$stateParams",function(e,n){return e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,bodyClass:"tools"})}e.$inject=["$stateProvider"],angular.module("app.tools.triggers",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.video",{abstract:!0,url:"/video"}).state("app.video.screenRecordings",{url:"/screenRecordings",views:{"content@app":{templateUrl:"app/main/apps/video/views/screenRecordings/screenRecordings.html",controller:"ScreenRecordingsController as vm"}},resolve:{screenRecordings:["apiResolver","Auth","msUtils",function(e,n,t){return n.hasRole("admin")?e.resolve("screenRecording@get",{fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:t.firstLastDayMonth(),includeAll:"true",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ScreenRecordings",fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:t.firstLastDayMonth(),includeAll:"true",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadScreenRecordings",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2001})}]},authenticate:!0,permissionId:2001,bodyClass:"video"}),n.addPart("app/main/apps/video")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.video",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.inboundRoutes",{url:"/inboundRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/inboundRoutes/inboundRoutes.html",controller:"InboundRoutesController as vm"}},resolve:{inboundRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"InboundRoutes",fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"}).state("app.voice.inboundRoutes.edit",{url:"/:id?tab",params:{inboundRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/inboundRoutes/edit/view.html",controller:"InboundRouteController as vm"}},resolve:{inboundRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.inboundRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.internalRoutes",{url:"/internalRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/internalRoutes/internalRoutes.html",controller:"InternalRoutesController as vm"}},resolve:{internalRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"InternalRoutes",fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,bodyClass:"voice"}).state("app.voice.internalRoutes.edit",{url:"/:id?tab",params:{internalRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/internalRoutes/edit/view.html",controller:"InternalRouteController as vm"}},resolve:{internalRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.internalRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.outboundRoutes",{url:"/outboundRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/outboundRoutes/outboundRoutes.html",controller:"OutboundRoutesController as vm"}},resolve:{outboundRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OutboundRoutes",fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"}).state("app.voice.outboundRoutes.edit",{url:"/:id?tab",params:{outboundRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/outboundRoutes/edit/view.html",controller:"OutboundRouteController as vm"}},resolve:{outboundRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.outboundRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/voice/views/realtime/realtime.html",controller:"VoiceRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:411})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.agents",{url:"/agents",params:{channel:"voice",direction:"inbound"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.telephones",{url:"/telephones",controller:"TelephonesVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/telephones/view.html",resolve:{telephones:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,userpic,internal",role:"telephone",sort:"fullname",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Telephones",fields:"id,fullname,userpic,internal",role:"telephone",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}],rpcTelephones:["apiResolver",function(e){return e.resolve("rpc@getTelephones")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.trunks",{url:"/trunks",controller:"TrunksVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/trunks/view.html",resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queues",{url:"/queues",params:{channel:"voice",direction:"inbound"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"VoiceQueues":void 0,channel:"voice",type:"inbound",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_calls",{url:"/queue_calls",params:{direction:"inbound"},controller:"QueueCallsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queue-calls/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"inbound",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,fields:"id,name",section:"VoiceQueues",channel:"voice",type:"inbound",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}],voiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels",{type:"inbound"})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.abandonedcalls",{url:"/abandonedcalls",controller:"AbandonedCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/abandonedcalls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context,createdAt",role:"agent",sort:"-createdAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context,createdAt",role:"agent",sort:"-createdAt",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"name",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_params",{url:"/queue_params",controller:"QueueParamsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queue_params/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"name",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.outbound_calls",{url:"/outbound_calls",controller:"OutboundCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/outbound_calls/view.html",resolve:{rpcCalls:["apiResolver",function(e){return e.resolve("rpc@getOutboundChannels")}]},authenticate:!0,permissionId:411})}e.$inject=["$stateProvider"],angular.module("app.voice.realtime",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.voice",{abstract:!0,url:"/voice"}).state("app.voice.voiceQueues",{url:"/voiceQueues",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceQueues/voiceQueues.html",controller:"VoiceQueuesController as vm"}},resolve:{voiceQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).state("app.voice.voiceQueues.edit",{url:"/:id?tab",params:{voiceQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceQueues/edit/view.html",controller:"VoiceQueueController as vm"}},resolve:{voiceQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).state("app.voice.contexts",{url:"/contexts",views:{"content@app":{templateUrl:"app/main/apps/voice/views/contexts/contexts.html",controller:"ContextsController as vm"}},resolve:{contexts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceContext@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Contexts",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:405})}]},authenticate:!0,permissionId:405,bodyClass:"voice"}).state("app.voice.voicemails",{url:"/voicemails",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicemails/voicemails.html",controller:"VoicemailsController as vm"}},resolve:{voicemails:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceMail@get",{fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Voicemails",fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:406})}]},authenticate:!0,permissionId:406,bodyClass:"voice"}).state("app.voice.voicemails.edit",{url:"/:id?tab",params:{voicemail:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicemails/edit/view.html",controller:"VoicemailController as vm"}},resolve:{voicemail:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceMail@get",{fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:406})}]},authenticate:!0,permissionId:406,bodyClass:"voice"}).state("app.voice.musiconholds",{url:"/musiconholds",views:{"content@app":{templateUrl:"app/main/apps/voice/views/musiconholds/musiconholds.html",controller:"MusicOnHoldsController as vm"}},resolve:{musiconholds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MusicOnHolds",fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:407})}]},authenticate:!0,permissionId:407,bodyClass:"voice"}).state("app.voice.musiconholds.edit",{url:"/:id?tab",params:{musiconhold:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/musiconholds/edit/view.html",controller:"MusicOnHoldController as vm"}},resolve:{musiconhold:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:407})}]},authenticate:!0,permissionId:407,bodyClass:"voice"}).state("app.voice.voiceRecordings",{url:"/voiceRecordings",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceRecordings/voiceRecordings.html",controller:"VoiceRecordingsController as vm"}},resolve:{voiceRecordings:["apiResolver","Auth","msUtils",function(e,n,t){return n.hasRole("admin")?e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:t.firstLastDayMonth(),limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceRecordings",fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:t.firstLastDayMonth(),limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadVoiceRecordings,privacyEnabled",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:408})}]},authenticate:!0,permissionId:408,bodyClass:"voice"}).state("app.voice.voiceRecordings.edit",{url:"/:id?tab",params:{voiceRecording:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceRecordings/edit/view.html",controller:"VoiceRecordingController as vm"}},resolve:{voiceRecording:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadVoiceRecordings,privacyEnabled",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:408})}]},authenticate:!0,permissionId:408,bodyClass:"voice"}).state("app.voice.chanSpies",{url:"/chanSpies",views:{"content@app":{templateUrl:"app/main/apps/voice/views/chanSpies/chanSpies.html",controller:"ChanSpiesController as vm"}},resolve:{chanSpies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceChanSpy@get",{fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChanSpies",fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:409})}]},authenticate:!0,permissionId:409,bodyClass:"voice"}).state("app.voice.voicePrefixes",{url:"/voicePrefixes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicePrefixes/voicePrefixes.html",controller:"VoicePrefixesController as vm"}},resolve:{voicePrefixes:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voicePrefix@get",{fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoicePrefixes",fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:410})}]},authenticate:!0,permissionId:410,bodyClass:"voice"}),n.addPart("app/main/apps/voice")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.voice",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.voice.inboundRoutes","app.voice.outboundRoutes","app.voice.internalRoutes","app.voice.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.whatsapp.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/realtime/realtime.html",controller:"WhatsappRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2110})}]},authenticate:!0,permissionId:2110}).state("app.whatsapp.realtime.agents",{url:"/agents",params:{channel:"whatsapp"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:2110}).state("app.whatsapp.realtime.queues",{url:"/queues",params:{channel:"whatsapp"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"WhatsappQueues":void 0,channel:"whatsapp",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2110})}e.$inject=["$stateProvider"],angular.module("app.whatsapp.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.whatsapp",{abstract:!0,url:"/whatsapp"}).state("app.whatsapp.whatsappQueues",{url:"/whatsappQueues",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/whatsappQueues.html",controller:"WhatsappQueuesController as vm"}},resolve:{whatsappQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2101,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappQueues.edit",{url:"/:id?tab",params:{whatsappQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/view.html",controller:"WhatsappQueueController as vm"}},resolve:{whatsappQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("whatsappQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2101,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappAccounts",{url:"/whatsappAccounts",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/whatsappAccounts.html",controller:"WhatsappAccountsController as vm"}},resolve:{whatsappAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappAccounts",fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2102})}]},authenticate:!0,permissionId:2102,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappAccounts.edit",{url:"/:id?tab",params:{whatsappAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/view.html",controller:"WhatsappAccountController as vm"}},resolve:{whatsappAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2102})}]},authenticate:!0,permissionId:2102,bodyClass:"whatsapp"}),n.addPart("app/main/apps/whatsapp")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.whatsapp",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.whatsapp.realtime"]).config(e)}(),function(){"use strict";angular.module("app.navigation",[]).config(function(){})}(),function(){"use strict";function e(e,n){e.addPart("app/quick-panel")}e.$inject=["$translatePartialLoaderProvider","msApiProvider"],angular.module("app.quick-panel",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.reset",{url:"/reset/:token",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.reset":{templateUrl:"app/reset/reset.html",controller:"ResetPasswordController as vm"}},bodyClass:"reset"}),n.addPart("app/reset")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.reset",[]).config(e)}(),function(){"use strict";function e(e){e.addPart("app/toolbar")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.toolbar",[]).config(e)}(),function(){"use strict";angular.module("app.user-setting",[])}(),function(){"use strict";function e(e){e.interceptors.push("authInterceptor")}e.$inject=["$httpProvider"],angular.module("app.auth").config(e)}(),function(){"use strict";function e(e){e.onBefore({to:function(e){return!0===e.authenticate}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService;return n.isLoggedIn()?n.retrieveUser().catch(function(){return t.target("app.login",void 0,{reload:!0})}):t.target("app.login",void 0,{reload:!0})}),e.onStart({to:function(e){return"app.login"!==e.name}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService,a=e.$to();if(n.hasRole("agent")&&"app.dashboards.general"!=a.name)return t.target("app.dashboards.general",{redirect:!1},{reload:!0})}),e.onFinish({to:function(e){return"app.help"===e.parent.name}},function(e){var n=e.router.stateService;if("app.help"===e.$to().parent.name){var t=e.injector().get("settingsManager"),a=t?t.get():null;if(!a||!a.viewHelpSection)return n.target("app.dashboards.general",{redirect:!1},{reload:!0})}}),e.onFinish({to:function(e){return e.permissionId}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService,a=e.$to();if(n.hasRole("user")){if(!n.hasPermission(a.permissionId))return t.target("app.dashboards.general",{redirect:!1},{reload:!0});var i=e.params().id?Number(e.params().id):void 0;if(i)return n.hasResourcePermission(a.permissionId,i).catch(function(){return t.target(a.parent.name,{redirect:!1},{reload:!0})})}}),e.onFinish({to:function(e){return"app.dashboards.general"===e.parent.name}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService;e.$to();if(n.hasRole("user")&&!n.hasPermission(100))return t.target("app.dashboards.general",{redirect:!1},{reload:!0})})}e.$inject=["$transitions"],angular.module("app.auth").run(e)}(),function(){"use strict";function e(a,e,o,i,s,r,l,d,c){var m;return{getToken:n,getCurrentUser:u,getPermissions:A,hasChildrenPermissions:function(e){return!!e&&_.some(e,function(e){return t(e)})},hasModulePermissions:function(i){return o(function(a,n){f()?a(!0):r.userProfileSection.get({userProfileId:m.userProfileId}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(_.isEmpty(n))a(!1);else{var t=_.filter(n,function(e){return e.enabled});a(_.some(t,["category",i]))}}).catch(function(e){n(e)})})},hasModulesPermissions:function(s){return o(function(a,n){var i={};f()?(s.forEach(function(e){i[e]=!0}),a(i)):r.userProfileSection.get({userProfileId:m.userProfileId}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(_.isEmpty(n))a({});else{var t=_(n).filter(function(e){return e.enabled&&_.includes(s,e.category)}).uniqBy(function(e){return e.category}).map(function(e){return e.category}).value();t.forEach(function(e){i[e]=!0}),a(i)}}).catch(function(e){n(e)})})},hasRole:function(e){return!!m&&m.role===e},hasPermission:t,hasResourcePermission:function(e,s){return o(function(a,i){return r.userProfileSection.get({userProfileId:m.userProfileId,sectionId:e}).$promise.then(function(e){var n=e.rows[0];if(n.autoAssociation)return a();var t=l.getActiveItem().node;return t.permissions&&!1===t.permissions.association?a():r.userProfileResource.get({sectionId:n.id,nolimit:!0}).$promise.then(function(e){var n=e.rows;_.some(n,["resourceId",s])?a():i()})}).catch(function(e){i("Error retrieving user profile permissions",e)})})},hasSectionPermissions:function(a){return o(function(e,n){var t={};return E().then(function(){_.includes(m.permissions,a)&&(t[a]=!0),e(t)}).catch(function(e){n(e)})})},hasSectionsPermissions:function(a){return o(function(e,n){var t={};if(!f())return E().then(function(){a.forEach(function(e){_.includes(m.permissions,e)&&(t[e]=!0)}),e(t)}).catch(function(e){n(e)});a.forEach(function(e){t[e]=!0}),e(t)})},isAgent:h,isAdmin:f,isLoggedIn:function(){return!!n()},isTelephone:function(){return"telephone"===m.role},isUser:b,login:function(e){return o(function(n,t){r.auth.local(e).$promise.then(function(e){return d.get().secureCookieEnabled?c.set("motion.token",e.token,{secure:!0,sameSite:"none"}):c.set("motion.token",e.token),r.user.get({id:e.id}).$promise}).then(function(e){(m=e).lastLoginAt=moment().format("YYYY-MM-DD HH:mm:ss"),y("LOCAL_LOGIN")}).then(function(){if(h()&&1===m.showWebBar&&m.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver",function(e){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return h()&&0!==m.showWebBar?p(e):f()||b()?g(!0):void 0}).then(function(e){m=_.assign(m,e),n()}).catch(function(e){t(e)})})},logout:function(t){return o(function(e,n){t?(v(),e()):o.resolve().then(function(){return h()&&0!==m.showWebBar?o(function(e,n){r.user.logout({id:m.id,device:"web"}).$promise.then(function(){e()}).catch(function(e){n(e)})}):f()||b()?g(!1):void 0}).then(function(){v(),e()}).catch(function(e){n(e)})})},parseCrudPermissions:function(e){return f()?{readOnly:!1,canEdit:!0,canDelete:!0}:e?{readOnly:!(!_.includes(e,"r")||1!==e.length),canEdit:!!_.includes(e,"e"),canDelete:!!_.includes(e,"d")}:{readOnly:!0,canEdit:!1,canDelete:!1}},queueLogin:p,reloadPermissions:E,removeCookies:v,retrieveUser:function(){return o(function(n,t){r.user.whoami({userSetting:!0}).$promise.then(function(n){return"user"===n.role?A(n.userProfileId).then(function(e){return n.permissions=e,n}):n}).then(function(e){n(m=e)}).catch(function(e){t(e)})})},setCurrentUser:function(e){m=_.merge(m,e)},getAuthenticationType:function(){var e=u(),n=i.localStorage.getItem("motion2.user:"+e.id);if(n)return JSON.parse(n).authenticationType;return"NONE"},loginSSO:function(e){"google"!==e&&y("SSO_LOGIN");return"/api/auth/"+e},loginAD:function(e){return o(function(n,t){r.auth.activedirectory(e).$promise.then(function(e){return d.get().secureCookieEnabled?c.set("motion.token",e.token,{secure:!0,sameSite:"none"}):c.set("motion.token",e.token),r.user.get({id:e.id}).$promise}).then(function(e){(m=e).lastLoginAt=moment().format("YYYY-MM-DD HH:mm:ss"),y("SSO_LOGIN")}).then(function(){if(h()&&1===m.showWebBar&&m.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver",function(e){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return h()&&0!==m.showWebBar?p(e):f()||b()?g(!0):void 0}).then(function(e){m=_.assign(m,e),n()}).catch(function(e){t(e)})})},setMessengerSoundNotification:function(e){u().messengerSoundNotification=e}};function n(){return e.get("motion.token")}function u(){return m}function p(e){return o(function(n,t){r.user.login({id:m.id,device:"web",intrf:e}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}function g(a){return o(function(n,t){var e={online:a,lastLoginAt:a?moment().format("YYYY-MM-DD HH:mm:ss"):void 0};r.user.update({id:m.id},e).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}function v(){e.remove("motion.token"),m&&(i.localStorage.removeItem("motion.user:"+m.id),m=null)}function h(){return"agent"===m.role}function f(){return"admin"===m.role}function b(){return"user"===m.role}function t(e){return!!m&&_.includes(m.permissions,e)}function A(e){var a=[];return o(function(n,t){return e||n(a),r.userProfile.getSections({id:e}).$promise.then(function(e){for(var n=0;n<e.length;n++){var t=e[n];a.push(t.sectionId),t.subsections&&(a=_.concat(a,t.subsections))}return a}).then(function(e){n(e)}).catch(function(e){t("Error retrieving user profile permissions",e)})})}function E(){return o(function(n,t){A(m.userProfileId).then(function(e){m.permissions=e,n()}).catch(function(e){t(e)})})}function y(e){var n=u(),t={authenticationType:e};i.localStorage.setItem("motion2.user:"+n.id,JSON.stringify(t))}}e.$inject=["$mdDialog","$cookies","$q","$window","$document","api","msNavigationService","settingsManager","jscookie"],angular.module("app.auth").factory("Auth",e)}(),function(){"use strict";function e(n,e){this.telephones=e,this.closeDialog=function(e){n.hide(e)},e.count&&(this.name=e.rows[0].name)}e.$inject=["$mdDialog","telephones"],angular.module("app.auth").controller("HotDeskDialogController",e)}(),function(){"use strict";function e(n,t,a,i,s){var o;return{request:function(e){var n=a.get("motion.token");return e.headers=e.headers||{},s.isSameOrigin(e.url)&&n&&(e.headers.Authorization="Bearer "+n),e},responseError:function(e){switch(e.status){case 401:a.remove("motion.token"),n.$broadcast("webrtc::logout"),(o||(o=i.get("$state"))).go("app.login")}return t.reject(e)}}}e.$inject=["$rootScope","$q","$cookies","$injector","Util"],angular.module("app.auth").factory("authInterceptor",e)}(),function(){"use strict";function e(n){var t={safeCb:function(e){return angular.isFunction(e)?e:angular.noop},urlParse:function(e){var n=document.createElement("a");return n.href=e,""===n.host&&(n.href=n.href),n},isSameOrigin:function(i,e){return i=t.urlParse(i),(e=(e=e&&[].concat(e)||[]).map(t.urlParse)).push(n.location),1<=(e=e.filter(function(e){var n=i.hostname===e.hostname,t=i.protocol===e.protocol,a=i.port===e.port||""===e.port&&("80"===i.port||"443"===i.port);return n&&t&&a})).length}};return t}e.$inject=["$window"],angular.module("app.auth").factory("Util",e)}(),function(){"use strict";function e(e,n,t){var a={initLogger:function(){return i.init({uri:t.baseUrl+"logs/client-logs",initial_state_name:"client-logs",flushInterval:6e4,debounceInterval:10,sizeLimit:300,silent:!1,autoLog:["error"],heartbeat:!1,logUnload:!1,logPerformance:!1}),i.addHeaderBuilder(function(){return(e=n.get("motion.token"))?{Authorization:"Bearer "+e}:{};var e}),i}},i=e.$logger;if(!i)throw new Error("Beaver Logger not found");return a}function n(d,e,t){var n={getLogger:function(l){var e=function(r){return function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];var a=n[0],i=n.slice(1),s="string"!=typeof a||"string"==typeof a&&0===i.length?l:a,o=1<n.length&&"string"==typeof a?i:n;(function(e,n,t){if(!d.isLoggedIn())return;var a=d.getCurrentUser();if(!a||!a.userSetting.clientSideLoggingEnabled)return;if(i=e,!(c.indexOf(i)>=c.indexOf(m)))return;var i;var s=n,o=t;"string"==typeof n&&void 0===t&&(s=e,o=n);u[e].call(u,s,{data:p(o)})}).call(this,r,s,o)}};return{error:e("error"),warn:e("warn"),info:e("info"),debug:e("debug")}},getLoggingColors:function(){return{disabled:{color:"#616161"},debug:{color:"#283593"},info:{color:"#000000"},warning:{color:"#FBC02D"},error:{color:"#FF5252"}}},flush:a},c=["debug","info","warn","error"],m="debug",u=e.initLogger();function p(t){return Array.isArray(t)?t.map(p):null===t||"object"!=typeof t?t:_.isPlainObject(t)?t:t&&"function"==typeof t.toJSON?t.toJSON():t instanceof Error?Object.getOwnPropertyNames(t).reduce(function(e,n){return e[n]=p(t[n]),e},{}):JSON.parse(JSON.stringifyOnce(t))}function a(){return u.flush()}return t.$on("local:user-setting-updated",function(e,n){n.clientSideLoggingEnabled?t.$broadcast("client-side-logging:enabled"):(a(),t.$broadcast("client-side-logging:disabled")),m=n.clientSideLoggingLevel}),t.$on("local:user-logout",function(){m="debug"}),JSON.stringifyOnce=function(i,s,e){var o=[],r=[];return e||(e=2),JSON.stringify(i,function(e,t){if(2e3<o.length)return"object too long";var a=!1;if(o.forEach(function(e,n){e===t&&(a=n)}),""==e)return o.push(i),r.push("root"),t;if(a+""!="false"&&"object"==typeof t)return"root"==r[a]?"(pointer to root)":"(see "+(t&&t.constructor?t.constructor.name.toLowerCase():typeof t)+" with key "+r[a]+")";var n=e||"(empty key)";return o.push(t),r.push(n),s?s(e,t):t},e)},n}e.$inject=["$window","$cookies","api"],n.$inject=["Auth","clientSideLogger","$rootScope"],angular.module("app.client-side-logging").factory("clientSideLogger",e).service("ClientSideLoggingService",n)}(),function(){"use strict";angular.module("app.core").provider("motionConfig",function(){var t={disableCustomScrollbars:!1,disableMdInkRippleOnMobile:!0,disableCustomScrollbarsOnMobile:!0};this.config=function(e){t=angular.extend({},t,e)},this.$get=function(){var e={getConfig:function(e){if(angular.isUndefined(t[e]))return!1;return t[e]},setConfig:function(e,n){t[e]=n}};return e}})}(),function(){"use strict";function e(e,n,t){n.debugEnabled(!0),e.config({tabindex:!1}),t.config({disableCustomScrollbars:!1,disableCustomScrollbarsOnMobile:!0,disableMdInkRippleOnMobile:!0})}e.$inject=["$ariaProvider","$logProvider","motionConfigProvider"],angular.module("app.core").config(e)}(),function(){"use strict";function e(e,n,t){(n.generate(),t.getConfig("disableMdInkRippleOnMobile")&&e.isMobile())&&angular.element("body").attr("md-no-ink",!0);e.isMobile()&&angular.element("html").addClass("is-mobile");var a=e.detectBrowser();if(a){var i=a.browser+" "+a.version+" "+a.os;angular.element("html").addClass(i)}}e.$inject=["msUtils","motionGenerator","motionConfig"],angular.module("app.core").run(e)}(),function(){"use strict";function e(n,e,t,a,i,s){var l=this;function o(){var e=_.filter(l.searchOptions.conditions,["disabled",!1]),o=[],r="";if(_(e).groupBy("name").forEach(function(e){var n=e[0],t=1<e.length,a=n.query.column;if(t){var i=_(e).groupBy(function(e){return e.query.operator}).mapValues(function(e){return _.chain(e).map(function(e){return e.query.value}).flattenDeep().value()}).value(),s=[];_.keys(i).forEach(function(e){var n=i[e],t=e;_.includes(["$between","$in","$notIn"],e)?t+="["+n+"]":n.forEach(function(e){t+="["+e+"]"}),s.push(t)}),r+=a+":="+s.join(":=")}else r=a+":="+n.query.operator+"["+n.query.value+"]";o.push(r)}),0!==o.length){var n="["+l.searchOptions.matchType+"]";return n+=o.join("||")}}function r(){var e=n.localStorage.getItem("motion2."+s+":"+l.currentUser.id);return e?JSON.parse(e):{}}function d(e){n.localStorage.setItem("motion2."+s+":"+l.currentUser.id,JSON.stringify(e))}function c(){if(s){var e=r();e.advancedSearch=_.omit(l.searchOptions,"fields"),d(e)}}function m(){return!!r().advancedSearch}l.currentUser=t.getCurrentUser(),l.searchOptions={matchType:"$and",conditions:[],fields:i},l.toolbarColor=a,l.onInit=function(){if(s){var e=r();e.hasOwnProperty("advancedSearch")&&(l.searchOptions=_.merge(l.searchOptions,e.advancedSearch))}},l.applyFilter=function(){c(),e.hide({apply:!0,value:o()})},l.clearConditions=function(){l.searchOptions.conditions=[],function(){if(s){var e=r();delete e.advancedSearch,e.query&&delete e.query.search,d(e)}}()},l.minimize=function(){c(),e.hide({apply:!m(),value:o()||m()?!_.isEmpty(l.searchOptions.conditions):void 0})},l.close=function(){e.hide({apply:!m(),value:o()||m()?!_.isEmpty(l.searchOptions.conditions):void 0})}}e.$inject=["$window","$mdDialog","Auth","color","fields","storagePath"],angular.module("app.core").controller("AdvancedSearchController",e)}(),function(){"use strict";function e(a){return{restrict:"A",link:function(e,n,t){e.$watch(t.focusOn,function(e){a(function(){e?n[0].focus():n[0].blur()})})}}}e.$inject=["$timeout"],angular.module("app.core").directive("focusOn",e)}(),function(){"use strict";function e(o,l,d){return{restrict:"E",compile:function(e,n){var s;return n.code||(s=e.html(),e.empty()),function(t,a,r){r.code&&(s=t.$eval(r.code));var i=t.$eval(r.shouldInterpolate);l.when(s).then(function(e){if(e){i&&(e=d(e)(t));var n=angular.element('<pre><code class="highlight" ng-non-bindable></code></pre>');a.append(n),o(function(){!function(e,n){var t=n.find("code"),a=e.split("\n"),i=(a=a.filter(function(e){return e.trim().length}))[0].match(/^\s*/)[0],s=new RegExp("^"+i);a=a.map(function(e){return e.replace(s,"").replace(/\s+$/,"")});var o=hljs.highlight(r.language||r.lang,a.join("\n"),!0);o.value=o.value.replace(/=<span class="hljs-value">""<\/span>/gi,"").replace("<head>","").replace("<head/>",""),t.append(o.value).addClass("highlight")}(e,n)},34,!1)}})}}}}e.$inject=["$timeout","$q","$interpolate"],angular.module("app.core").directive("hljs",e)}(),function(){"use strict";function e(n,a,e,t){var o=this;function i(){var a=o.selectedField.options&&!_.isEmpty(o.selectedField.options.extraOperators),i=o.selectedField.options&&!_.isEmpty(o.selectedField.options.excludedOperators);o.availableOperators=_.filter(o.operators,function(n){var e=!n.applyTo||_.includes(n.applyTo,o.selectedField.type);n.isExtra=a&&_.some(o.selectedField.options.extraOperators,function(e){return e===n.type});var t=_.includes(n.excludeFrom,o.selectedField.type)||i&&_.includes(o.selectedField.options.excludedOperators,n.type);if((e||n.isExtra)&&!t)return n})}function s(n){return e[n.model][n.action](n.params).$promise.then(function(e){return e.rows}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:n.model.toUpperCase()+"."+n.action.toUpperCase(),msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function r(){!o.value||_.isArray(o.value)&&_.isEmpty(o.value)?o.isValidCondition=!1:o.selectedOperator?o.selectedOperator&&"$between"===o.selectedOperator.type?o.isValidCondition=!(!o.endRangeValue||!o.isValidRange):o.isValidCondition=!0:o.isValidCondition=!1}function l(){"number"===o.selectedField.type?_.isNumber(o.endRangeValue)?o.isValidRange=Number(o.endRangeValue)>Number(o.value):o.isValidRange=!0:"date"===o.selectedField.type&&(o.maxDateRange=moment(o.endRangeValue).subtract(1,"day"),o.isValidRange=!0),r()}function d(){var e=m();o.options.conditions.push(e),p()}function c(){var e=m(),n=_.findIndex(o.options.conditions,"style");o.options.conditions.splice(n,1,e),p(),o.pendingCondition.style=null,o.pendingCondition=void 0}function m(){return{name:o.selectedField.name,operator:n.instant("DASHBOARDS."+o.selectedOperator.translate),value:o.value,endValue:o.endRangeValue,displayValue:u(o.value),displayEndValue:u(o.endRangeValue),query:{column:o.selectedField.column,operator:o.selectedOperator.type,value:function(){var e,n=o.value,t=o.endRangeValue;switch(o.selectedField.type){case"date":var a=moment(n).utcOffset(0,!0).format("YYYY-MM-DD");if("$between"===o.selectedOperator.type){var i=moment(t).utcOffset(0,!0).format("YYYY-MM-DD");e=[a,i]}else e=a;break;case"number":e="$between"===o.selectedOperator.type?[n,t]:n;break;case"multiselect":var s=o.selectedField.options.field||"name";e=_.map(n,s);break;case"select":e=n.id;break;case"autocomplete":e=o.selectedOperator.isExtra?n:n.id;break;default:e=n}return e}()},disabled:!1}}function u(e){var n;if(e){switch(o.selectedField.type){case"date":n=moment(e).format("YYYY-MM-DD");break;case"multiselect":var t=_.map(e,function(e){return e.name});n="$eq"===o.selectedOperator.type?t.join(" or "):t.join(" and ");break;case"select":n=e.name;break;case"autocomplete":n=o.selectedOperator.isExtra?e:e.displayValue;break;default:n=e}return n}}function p(){o.value=null,o.endRangeValue=null,o.minDateRange=null,o.maxDateRange=null,o.isValidCondition=!1}o.operators=o.availableOperators=[{type:"$eq",symbol:"=",translate:"EQUALS",excludeFrom:["multiselect"]},{type:"$ne",symbol:"≠",translate:"IS_NOT_EQUAL",excludeFrom:["multiselect"]},{type:"$in",symbol:"∈",translate:"IS_AMONG",applyTo:["multiselect"]},{type:"$notIn",symbol:"∉",translate:"IS_NOT_AMONG",applyTo:["multiselect"]},{type:"$substring",symbol:"⊃",translate:"CONTAINS",applyTo:["text"]},{type:"$startsWith",symbol:"a..",translate:"STARTS_WITH",applyTo:["text"]},{type:"$endsWith",symbol:"..a",translate:"ENDS_WITH",applyTo:["text"]},{type:"$lt",symbol:"<",translate:"IS_LESS_THAN",applyTo:["date","number"]},{type:"$gt",symbol:">",translate:"IS_GREATER_THAN",applyTo:["date","number"]},{type:"$lte",symbol:"≤",translate:"IS_LESS_THAN_OR_EQUAL_TO",applyTo:["date","number"]},{type:"$gte",symbol:"≥",translate:"IS_GREATER_THAN_OR_EQUAL_TO",applyTo:["date","number"]},{type:"$between",symbol:"≬",translate:"IS_BETWEEN",applyTo:["date","number"]}],o.addCondition=d,o.editCondition=function(e){o.pendingCondition=e,o.pendingCondition.style="md-amber-200-bg",o.selectedField=_.find(o.options.fields,["name",o.pendingCondition.name]),i(),o.selectedOperator=_.find(o.availableOperators,["type",o.pendingCondition.query.operator]),"date"===o.selectedField.type&&"string"==typeof o.pendingCondition.value?(o.value=new Date(o.pendingCondition.value),o.minDateRange=moment(o.value).add(1,"day"),o.endRangeValue=o.pendingCondition.endValue?new Date(o.pendingCondition.endValue):void 0):(o.value=o.pendingCondition.value,o.endRangeValue=o.pendingCondition.endValue);o.isValidRange=!0,o.isValidCondition=!0},o.updateCondition=c,o.cancelUpdateCondition=function(){o.pendingCondition.style=null,o.pendingCondition=void 0},o.setConditionStatus=function(e){e.style=e.disabled?void 0:"chip-disabled",e.disabled=!e.disabled},o.removeCondition=function(){_.isEmpty(o.options.conditions)&&o.clearFilter()},o.getValues=function(){return o.selectedField.options.routes&&Array.isArray(o.selectedField.options.routes)?(e=angular.copy(o.selectedField.options.routes).map(function(e){return s(e)}),a.all(e).then(function(e){o.selectedField.values=_.flatten(e)})):o.selectedField.options.route?function(){var e=angular.copy(o.selectedField.options.route);if("autocomplete"===o.selectedField.type)for(var n=0;n<Object.keys(e.params).length;n++){var t=Object.keys(e.params)[n];"@autocomplete"===e.params[t]&&(e.params[t]=o.searchText,e.params.autocomplete=!0)}return a.resolve().then(function(){if(!o.selectedField.values||!0===e.params.autocomplete)return s(e)}).then(function(e){return e&&(o.selectedField.values=e),"autocomplete"===o.selectedField.type?function(e){var n=[];o.searchText&&(n=e.filter(function(e){e.displayValue="";for(var n=0;n<o.selectedField.options.searchFields.length;n++){var t=o.selectedField.options.searchFields[n],a=e[t]||"";e.displayValue+=a+" "}return _.trimEnd(e.displayValue),e.displayValue.toLowerCase().includes(o.searchText.toLowerCase())}));return n}(o.selectedField.values):o.selectedField.values})}():(o.selectedField.values.forEach(function(e){e.translate&&(e.name=n.instant(e.translate))}),o.selectedField.values);var e},o.onFieldChange=function(){o.value=void 0,o.endRangeValue=void 0,o.searchText=void 0,o.isValidCondition=!1,i(),o.autoSelectOperator=1===o.availableOperators.length,o.autoSelectOperator||(o.selectedOperator=void 0)},o.onOperatorChange=function(e){o.isValidRange=!0,o.selectedOperator&&(e?e.applyTo?0<_.difference(o.selectedOperator.applyTo,e.applyTo).length&&(o.value=null):o.selectedOperator.applyTo&&(o.value=null):o.value||(o.value=null),"between"!=o.selectedOperator.type&&(o.endRangeValue=null),o.selectedField.options&&!_.isEmpty(o.selectedField.options.extraOperators)&&(o.selectedOperator.isExtra=_.some(o.selectedField.options.extraOperators,function(e){return e===o.selectedOperator.type})));r()},o.onValueChange=function(){o.selectedOperator&&"$between"===o.selectedOperator.type?"number"===o.selectedField.type?l():"date"===o.selectedField.type&&(o.minDateRange=moment(o.value).add(1,"day"),r()):r()},o.checkRange=l,o.handleKeyboardAction=function(){o.pendingCondition?c():d()}}e.$inject=["$translate","$q","api","toasty"],angular.module("app.core").directive("msAdvancedSearch",function(){return{restrict:"E",scope:{options:"=",clearFilter:"&"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-advanced-search/ms-advanced-search.html"}})}(),function(){"use strict";angular.module("app.core").directive("msCard",function(){return{restrict:"E",scope:{templatePath:"=template",card:"=ngModel",vm:"=viewModel"},template:'<div class="ms-card-content-wrapper" ng-include="templatePath" onload="cardTemplateLoaded()"></div>',compile:function(e){return e.addClass("ms-card"),function(e,n){e.cardTemplateLoaded=function(){e.$emit("msCard::cardTemplateLoaded",n)}}}}})}(),function(){"use strict";angular.module("app.core").directive("msChipColor",function(){return{restrict:"A",link:function(e,i,n){n.$observe("msChipColor",function(e){var n=i.parent().parent();if(n.hasClass("md-background-bg md-hue-3")||n.addClass("md-background-bg md-hue-3"),_.isEmpty(e)){var t=n[0].className.split(" "),a=t.indexOf("md-hue-3");t.length=a+1,n[0].className=t.join(" ")}else n.addClass(e)})}}})}(),function(){"use strict";angular.module("app.core").directive("msClickToCall",function(){return{restrict:"E",scope:{type:"=",disabled:"=",target:"=",prefix:"=",license:"="},controller:["$scope","$rootScope","$http","$translate","$document","$mdDialog","Auth","toasty","api",function(t,n,a,i,s,o,e,r,l){function d(e){switch(t.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(t.currentUser.phoneBarRemoteControlPort||"9888")+"/api/originate/"+c(e));case 2:return n.$broadcast("webrtc::call",{target:c(e)})}}function c(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function m(e){return a.get(e).success(function(){r.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(e){r.error({title:"PhoneBar API Error",msg:i.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}t.currentUser=e.getCurrentUser(),t.privacy=t.currentUser.privacyEnabled,t.showMenu=function(){return t.target&&t.target.indexOf("@")<0&&t.target!=t.currentUser.internal&&t.target!=t.currentUser.name&&(0==t.currentUser.showWebBar&&t.currentUser.phoneBarRemoteControl||2==t.currentUser.showWebBar&&t.license.webrtc)&&!t.disabled},t.call=function(e){return 2!==t.currentUser.showWebBar?(n=e,l.user.getVoicePrefixes({id:t.currentUser.id}).$promise.then(function(e){if(e.count)return o.show({controller:"PrefixDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/prefix/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!0,locals:{prefixes:e,required:t.currentUser.phoneBarPrefixRequired}})}).then(function(e){t.currentUser.phoneBarPrefixRequired?e&&-1!==e&&d(e+n):e&&-1!==e?d(e+n):e||d(n)})):d(e);var n},t.transfer=function(e){switch(t.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(t.currentUser.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+c(e));case 2:n.$broadcast("webrtc::transfer",{target:c(e)})}}}],templateUrl:"app/core/directives/ms-click-to-call/ms-click-to-call.html"}})}(),function(){"use strict";n.$inject=["ClientSideLoggingService","$rootScope","$translate"];var e={bindings:{user:"<"},controller:n,controllerAs:"vm",templateUrl:"app/core/directives/ms-client-side-logging/ms-client-side-logging-icon.html"};function n(e,n,t){var a=this,i=e.getLoggingColors();function s(){a.tooltipHTML=a.user.userSetting.clientSideLoggingEnabled?[t.instant("STAFF.CLIENT_LOGS_ENABLED"),t.instant("STAFF.CLIENT_LOGS_LOGLEVEL",{logLevel:a.user.userSetting.clientSideLoggingLevel}),t.instant("STAFF.CLIENT_LOGS_ENABLED_SINCE",{enabledSince:moment(a.user.userSetting.clientSideLoggingEnabledSince).format("LLLL")})].join("<br>"):t.instant("STAFF.CLIENT_LOGS_DISABLED")}a.tooltipHTML=t.instant("STAFF.CLIENT_LOGS_DISABLED"),a.styleColor=i.disabled,a.styleIcon=a.user.userSetting&&a.user.userSetting.clientSideLoggingEnabled?"icon-checkbox-marked-circle":"icon-close",a.$onInit=function(){if(!a.user.userSetting)return;var e=a.user.userSetting.clientSideLoggingEnabled?a.user.userSetting.clientSideLoggingLevel:"disabled";a.styleColor=i[e],"info"===e&&(a.styleIcon="icon-checkbox-marked-circle-outline");return s()},a.$onDestroy=function(){o()};var o=n.$on("$translateChangeSuccess",s)}angular.module("app.core").component("msClientSideLoggingIcon",e)}(),function(){"use strict";n.$inject=["ClientSideLoggingService","UserSettingService","$q","$translate","$rootScope","$interval"];var e={bindings:{user:"<",onUserUpdate:"&"},controller:n,controllerAs:"vm",templateUrl:"app/core/directives/ms-client-side-logging/ms-client-side-logging.html"};function n(e,t,n,a,i,s){var o=this,r=e.getLoggingColors(),l=null;function d(){l&&s.cancel(l)}o.styleProperties=r.disabled,o.clientSideLoggingEnabledSince="",o.$onInit=function(){m().then(function(){d(),l=s(u,6e4)})},o.$onChanges=function(e){e&&n.resolve().then(m)},o.$onDestroy=function(){d(),c()},o.onEnabledSwitchChange=function(){var e=o.user.userSetting.clientSideLoggingEnabled,n=o.user.userSetting.clientSideLoggingLevel;return p(e,n)},o.onLogLevelSelectionChange=function(){var e=o.user.userSetting.clientSideLoggingEnabled,n=o.user.userSetting.clientSideLoggingLevel;p(e,n)},o.computeStyleForLoggingLevel=function(e){return r[e]};var c=i.$on("$translateChangeSuccess",u);function m(){o.availableClientSideLoggingLevels=Object.keys(r).filter(function(e){return"disabled"!==e});var e=o.user.userSetting&&o.user.userSetting.clientSideLoggingEnabled?o.user.userSetting.clientSideLoggingLevel:"disabled";return o.styleProperties=r[e],u()}function u(){if(o.user.userSetting)return o.user.userSetting.clientSideLoggingEnabled?void(o.clientSideLoggingEnabledSince=a.instant("STAFF.CLIENT_LOGS_ENABLED_SINCE",{enabledSince:moment(moment(o.user.userSetting.clientSideLoggingEnabledSince).format()).fromNow()})):o.clientSideLoggingEnabledSince=""}function p(e,n){return t.updateUserSettingById(o.user.userSetting.id,{clientSideLoggingEnabled:e,clientSideLoggingLevel:n}).then(function(){"function"==typeof o.onUserUpdate&&o.onUserUpdate()})}}angular.module("app.core").component("msClientSideLogging",e)}(),function(){"use strict";function e(i){return{require:"ngModel",priority:1,link:function(e,n,t,a){a.$formatters.push(i.formatter),a.$parsers.push(i.parser)}}}e.$inject=["msDatepickerFixConfig"],angular.module("app.core").provider("msDatepickerFixConfig",function(){var n={formatter:function(e){return e?""===e?e:new Date(e):""},parser:function(e){return e?moment(e).add(moment(e).utcOffset(),"m").toDate():""}};this.config=function(e){n=angular.extend({},n,e)},this.$get=function(){return n}}).directive("msDatepickerFix",e)}(),function(){"use strict";function e(s){return{restrict:"E",scope:{id:"=",model:"=",element:"=",title:"=",path:"="},replace:!0,link:function(n,e){var t=!1,a={};a.id=n.id,_.isNil(n.path)||(a.path=n.path);var i=document.createElement(n.element);i.setAttribute("preload","none"),i.setAttribute("controls","true"),"audio"===n.element&&i.setAttribute("style","width: 265px;"),"video"===n.element&&i.setAttribute("style","max-width: 500px;"),i.setAttribute("title",n.title),i.setAttribute("src"," "),i.onplay=function(e){t||(t=!0,e.preventDefault(),s[n.model].download(a).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type});i.setAttribute("type",e.type),i.setAttribute("src",URL.createObjectURL(t)),i.play()}).catch(function(e){console.error(e)}))},e.append(i)}}}e.$inject=["api"],angular.module("app.core").directive("msDialogRecording",e)}(),function(){"use strict";function e(i){return{restrict:"A",link:function(t,a){a.bind("click",function(e){var n=i('<div layout="row" class="spinner-overlay" layout-sm="column" layout-align="center center" aria-label="wait"><md-progress-circular md-mode="indeterminate"></md-progress-circular></div>')(t);a.closest("md-dialog").prepend(n)})}}}e.$inject=["$compile"],angular.module("app.core").directive("msDialogSpinner",e)}(),function(){"use strict";function e(){var o=this;function a(e,n,t,a){var i=[];if(0<=t)i.push(e[t]),n.push(e[t]),e.splice(t,1);else{for(var s=0;s<e.length;s++)void 0!==e[s].isValid&&e[s].isValid&&n.push(e[s]);for(s=e.length-1;0<=s;s--)e[s].isValid&&e.splice(s,1);i=n}o.options.transferCallback&&o.options.transferCallback(i,a)}o.canTransfer=function(e,n,t){if(void 0!==e.isValid&&e.isValid)return t?a(n.selectedItems,n.items,n.selectedItems.indexOf(e),t):a(n.items,n.selectedItems,n.items.indexOf(e),t)},o.transfer=a,o.getLine=function(e,n){var t="";if(_.isNil(n))return t;{if(_.isArray(n)){for(var a=0;a<n.length;a++)t+=" "+(e[n[a]]?e[n[a]]:"");return t}return e[n]?e[n]:""}}}angular.module("app.core").directive("msDualMultiselect",function(){return{restrict:"E",scope:{options:"=",readOnly:"=",addDisabled:"<"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-dual-multiselect/ms-dual-multiselect.html"}})}(),function(){"use strict";function e(a){return{restrict:"E",replace:!0,scope:{onReply:"&",ngModel:"=",ctrlMethods:"=",pickerPosition:"=",search:"=",recentEmojis:"=",placeholder:"="},template:'<textarea class="emojionearea"></textarea>',link:function(t,e){var n=e.emojioneArea({pickerPosition:t.pickerPosition,search:t.search,recentEmojis:t.recentEmojis,placeholder:a.instant(t.placeholder||"Type a message"),attributes:{spellcheck:!0},events:{keyup:function(e,n){t.ngModel=this.getText(),t.onReply({event:n,body:this.getText()})},emojibtn_click:function(){t.ngModel=this.getText()}}});t.ngModel&&n[0].emojioneArea.setText(t.ngModel),t.internalControl=t.ctrlMethods||{},t.internalControl.setText=function(e){n[0].emojioneArea.setText(e)},t.internalControl.getText=function(){return n[0].emojioneArea.getText()},t.$watch("ngModel",function(e){e||n[0].emojioneArea.setText("")})}}}e.$inject=["$translate"],angular.module("app.core").directive("msEmojiArea",e)}(),function(){"use strict";angular.module("app.core").directive("msFontFamily",function(){return{restrict:"E",scope:{ngModel:"="},controller:["$scope",function(e){e.fonts=[{option:"Arial",value:"Arial,Helvetica,sans-serif"},{option:"Century Gothic",value:"Century Gothic,Futura,Didact Gothic,san-serif"},{option:"Calibri",value:"Calibri, Verdana, Geneva, sans-serif"},{option:"Comic Sans MS",value:"Comic Sans MS,cursive"},{option:"Courier New",value:"Courier New,Courier,monospace"},{option:"Georgia",value:"Georgia,serif"},{option:"Lucida Sans Unicode",value:"Lucida Sans Unicode,Lucida Grande,sans-serif"},{option:"Tahoma",value:"Tahoma,Geneva,sans-serif"},{option:"Times New Roman",value:"Times New Roman,Times,serif"},{option:"Trebuchet MS",value:"Trebuchet MS,Helvetica,sans-serif"},{option:"Verdana",value:"Verdana,Geneva,sans-serif"}]}],templateUrl:"app/core/directives/ms-font-family/ms-font-family.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsFormWizardController",function(){var n=this;function e(){return n.forms.length}function t(){return 0===n.selectedIndex}function a(){return n.selectedIndex===e()-1}n.forms=[],n.selectedIndex=0,n.registerForm=function(e){n.forms.push(e)},n.previousStep=function(){if(t())return;n.selectedIndex--},n.nextStep=function(){if(a())return;n.selectedIndex++},n.firstStep=function(){n.selectedIndex=0},n.lastStep=function(){n.selectedIndex=e()-1},n.totalSteps=e,n.isFirstStep=t,n.isLastStep=a,n.currentStepInvalid=function(){return angular.isDefined(n.forms[n.selectedIndex])&&n.forms[n.selectedIndex].$invalid},n.previousStepInvalid=function(){return 0<n.selectedIndex&&angular.isDefined(n.forms[n.selectedIndex-1])&&n.forms[n.selectedIndex-1].$invalid},n.formsIncomplete=function(){for(var e=0;e<n.forms.length;e++)if(n.forms[e].$invalid)return!0;return!1},n.resetForm=function(){for(var e=n.selectedIndex=0;e<n.forms.length;e++)n.forms[e].$setPristine(),n.forms[e].$setUntouched()}}).directive("msFormWizard",function(){return{restrict:"E",scope:!0,controller:"MsFormWizardController as msWizard",compile:function(e){return e.addClass("ms-form-wizard"),function(){}}}}).directive("msFormWizardForm",function(){return{restrict:"A",require:["form","^msFormWizard"],compile:function(e){return e.addClass("ms-form-wizard-form"),function(e,n,t,a){var i=a[0],s=a[1];s.registerForm(i)}}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{onClose:"&"},transclude:!0,templateUrl:"app/core/directives/ms-info-bar/ms-info-bar.html",link:function(e,n){var t=i.find("ms-info-bar-active"),a="ms-info-bar-active";t.addClass(a),e.removeInfoBar=function(){t.removeClass(a),n.remove(),e.onClose&&e.onClose(),e.$destroy()}}}}e.$inject=["$document"],angular.module("app.core").directive("msInfoBar",e)}(),function(){"use strict";function e(r,a,l,e){var d=this,n={columnCount:5,respectItemOrder:!1,reLayoutDebounce:400,responsive:{md:3,sm:2,xs:1}},t=!0;function i(){t&&e.cancel(t),t=e(function(){!function(){d.containerPos=d.container[0].getBoundingClientRect(),function(){d.columnCount=d.options.columnCount,l("gt-md")?d.columnCount=d.options.columnCount:l("md")?d.columnCount=d.columnCount>d.options.responsive.md?d.options.responsive.md:d.columnCount:l("sm")?d.columnCount=d.columnCount>d.options.responsive.sm?d.options.responsive.sm:d.columnCount:d.columnCount=d.options.responsive.xs;d.columnWidth=d.containerPos.width/d.columnCount}(),r.$broadcast("msMasonry:relayoutStarted"),d.items=d.container.find("ms-masonry-item");for(var e=Array.apply(null,new Array(d.columnCount)).map(function(){return 0}),n=0;n<d.items.length;n++){var t,a,i,s,o=d.items[n];(o=angular.element(o)).scope()&&o.scope().$broadcast("msMasonryItem:startReLayout"),o.css({width:d.columnWidth}),d.options.respectItemOrder?(i=n%d.columnCount,s=e[i]):(s=Math.min.apply(Math,e),i=e.indexOf(s)),e[i]=s+o[0].getBoundingClientRect().height,t=Math.round(i*d.columnWidth),a=s,o.css({transform:"translate3d("+t+"px,"+a+"px,0px)"}),o.addClass("placed"),o.scope()&&o.scope().$broadcast("msMasonryItem:finishReLayout")}}(),r.$broadcast("msMasonry:relayoutFinished")},d.options.reLayoutDebounce)}d.options=null,d.container=[],d.containerPos="",d.columnWidth="",d.items=[],d.reLayout=i,d.initialize=function(){d.options=d.options?angular.extend(n,d.options):n,r.$watch(function(){return d.container.width()},function(e,n){e!==n&&i()})},d.waitImagesLoaded=function(e,n){if("undefined"!=typeof imagesLoaded){var t=a.imagesLoaded(e);t.on("done",function(){n()})}else n()},r.$on("msMasonry:relayout",function(){i()})}function n(o){return{restrict:"AEC",controller:"msMasonryController",compile:function(i,s){return{pre:function(e,n,t,a){a.options=angular.fromJson(s.options||"{}"),a.container=i},post:function(e,n,t,a){o(function(){a.initialize()})}}}}}e.$inject=["$scope","$window","$mdMedia","$timeout"],n.$inject=["$timeout"],angular.module("app.core").controller("msMasonryController",e).directive("msMasonry",n).directive("msMasonryItem",function(){return{restrict:"AEC",require:"^msMasonry",priority:1,link:function(e,n,t,a){a.waitImagesLoaded(n,function(){a.reLayout()}),e.$on("msMasonryItem:finishReLayout",function(){e.$watch(function(){return n.height()},function(e,n){e!==n&&a.reLayout()})}),n.on("$destroy",function(){a.reLayout()})}}})}(),function(){"use strict";function e(t,e,a,i){var s=this;function o(e,n){s.selectedPalette=e,s.selectedHues=n}function r(){o(!(s.selectedColor={palette:"",hue:"",class:""}),!1),d()}function l(e,n){s.selectedColor={palette:e,hue:n,class:"md-"+e+"-"+n+"-bg",bgColorValue:i.rgba(s.palettes[e][n].value),fgColorValue:i.rgba(s.palettes[e][n].contrast)},"obj"!==s.msModelType||angular.equals(s.selectedColor,s.modelCtrl.$viewValue)||d(),o(e,s.palettes[e]),t.$selectedColor=s.selectedColor}function d(){"class"===s.msModelType?s.modelCtrl.$setViewValue(s.selectedColor.class):"obj"===s.msModelType&&s.modelCtrl.$setViewValue(s.selectedColor)}s.palettes=e,s.selectedPalette=!1,s.selectedHues=!1,t.$selectedColor={},s.activateHueSelection=o,s.selectColor=function(e,n){l(e,n),d(),a.hide()},s.removeColor=r,t.$watch("ngModel",function(){if(!s.modelCtrl.$viewValue||""===s.modelCtrl.$viewValue)return void r();var e,n;if("class"===s.msModelType){var t=s.modelCtrl.$viewValue.split("-");n=5<=t.length?(e=t[1]+"-"+t[2],t[3]):(e=t[1],t[2])}else"obj"===s.msModelType&&(e=s.modelCtrl.$viewValue.palette,n=s.modelCtrl.$viewValue.hue||500);l(e,n)})}e.$inject=["$scope","$mdColorPalette","$mdMenu","motionGenerator"],angular.module("app.core").controller("msMaterialColorPickerController",e).directive("msMaterialColorPicker",function(){return{require:["msMaterialColorPicker","ngModel"],restrict:"E",scope:{ngModel:"=",msModelType:"@?"},controller:"msMaterialColorPickerController as vm",transclude:!0,templateUrl:"app/core/directives/ms-material-color-picker/ms-material-color-picker.html",link:function(e,n,t,a,i){var s=a[0];s.modelCtrl=a[1],s.msModelType=e.msModelType||"class",i(e,function(e){(e=e.filter(function(e,n){return 1===n.nodeType})).length&&n.find("ms-color-picker-button").replaceWith(e)})}}})}(),function(){"use strict";function e(p,g,v){return{restrict:"A",link:function(e,n,t){var a="true"===t.msNavIsFolded,i=!1,s=angular.element(p[0].body),o=angular.element('<div id="ms-nav-fold-open-overlay"></div>'),r=angular.element('<div id="ms-nav-fold-close-overlay"></div>'),l=n.parent();function d(){s.addClass("ms-nav-folded"),g.$broadcast("msNav::forceCollapse"),n.scrollTop(0),l.append(o),o.on("mouseenter touchstart",function(e){c(e),i=!0})}function c(e){angular.isDefined(e)&&e.preventDefault(),s.addClass("ms-nav-folded-open"),g.$broadcast("msNav::expandMatchingToggles"),l.find(o).remove(),l.parent().append(r),r.on("mouseenter touchstart",function(e){m(e),i=!1})}function m(e){angular.isDefined(e)&&e.preventDefault(),g.$broadcast("msNav::forceCollapse"),n.scrollTop(0),s.removeClass("ms-nav-folded-open"),l.parent().find(r).remove(),l.append(o),o.on("mouseenter touchstart",function(e){c(e),i=!0})}function u(){s.removeClass("ms-nav-folded ms-nav-folded-open"),g.$broadcast("msNav::expandMatchingToggles"),n.off("mouseenter mouseleave")}v.setFoldable(e,n,a),a?d():u(),e.toggleFold=function(){(a=!a)?d():u()},e.openFolded=c,e.closeFolded=m,e.isNavFoldedOpen=function(){return i},e.$on("$destroy",function(){o.off("mouseenter touchstart"),r.off("mouseenter touchstart"),n.off("mouseenter mouseleave")})}}}function n(t,a,i){return{restrict:"E",scope:{},controller:"MsNavController",compile:function(e){return e.addClass("ms-nav"),function(e){t.$broadcast("msNav::expandMatchingToggles");var n=t.$on("$stateChangeSuccess",function(){t.$broadcast("msNav::expandMatchingToggles"),a.when("navigation").then(function(e){e.close(),i.isNavFoldedOpen()&&i.closeFolded()})});e.$on("$destroy",function(){n()})}}}}function t(m,u,p,g){return{restrict:"A",require:"^msNav",scope:!0,compile:function(e,n){return e.addClass("ms-nav-toggle"),angular.isUndefined(n.collapsed)&&(n.collapsed=!0),e.attr("collapsed",n.collapsed),function(a,i,e,t){var s={expanded:"expanded",expandAnimation:"expand-animation",collapseAnimation:"collapse-animation"},n=i.find("a"),o=[],r=/\(.*\)/g;function l(){return"true"===i.attr("collapsed")}function d(){var e=u.defer();if(!l())return e.reject({error:!0}),e.promise;i.attr("collapsed",!1);var n=angular.element(i.find("ms-nav-toggle-items")[0]);n.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var t=n[0].offsetHeight;return n.css({position:"",visibility:"",display:"",height:""}),a.$evalAsync(function(){p.animate(n,{display:"block",height:"0px"},{height:t+"px"},s.expandAnimation).then(function(){n.addClass(s.expanded),n.css({height:""}),e.resolve({success:!0})})}),e.promise}function c(){var e=u.defer();if(l())return e.reject({error:!0}),e.promise;i.attr("collapsed",!0);var n=angular.element(i.find("ms-nav-toggle-items")[0]),t=n[0].offsetHeight;return a.$evalAsync(function(){p.animate(n,{height:t+"px"},{height:"0px"},s.collapseAnimation).then(function(){n.removeClass(s.expanded),n.css({display:"",height:""}),e.resolve({success:!0})})}),e.promise}angular.forEach(n,function(e){var n=angular.element(e).attr("ui-sref");angular.isUndefined(n)||(n=n.replace(r,""),o.push(n))}),t.setToggleItem(i,a),i.children(".ms-nav-button").on("click",function(){if(t.isDisabled())return;t.disable(),l()?(t.clearLockedItems(),a.$emit("msNav::pushToLockedList"),m.$broadcast("msNav::collapse"),d().then(function(){t.enable()})):a.$broadcast("msNav::forceCollapse")}),a.$on("$destroy",function(){i.children(".ms-nav-button").off("click")}),a.$on("msNav::collapse",function(){var e=t.getLockedItems(),n=!1;angular.forEach(e,function(e){angular.equals(e.scope,a)&&(n=!0)}),n||c().then(function(){t.enable()})}),a.$on("msNav::forceCollapse",function(){c().then(function(){t.enable()})}),a.$on("msNav::expandMatchingToggles",function(){var n=g.current.name,t=!1;angular.forEach(o,function(e){n===e&&(t=!0)}),t?d():c()}),a.$on("msNav::pushToLockedList",function(){t.setLockedItem(i,a)})}}}}e.$inject=["$document","$rootScope","msNavFoldService"],n.$inject=["$rootScope","$mdComponentRegistry","msNavFoldService"],t.$inject=["$rootScope","$q","$animate","$state"],angular.module("app.core").factory("msNavFoldService",function(){var t={};return{setFoldable:function(e,n){t={scope:e,element:n}},isNavFoldedOpen:function(){return t.scope.isNavFoldedOpen()},toggleFold:function(){t.scope.toggleFold()},openFolded:function(){t.scope.openFolded()},closeFolded:function(){t.scope.closeFolded()}}}).directive("msNavIsFolded",e).controller("MsNavController",function(){var e=this,n=!1,t=[],a=[];e.isDisabled=function(){return n},e.enable=function(){n=!1},e.disable=function(){n=!0},e.setToggleItem=function(e,n){t.push({element:e,scope:n})},e.getLockedItems=function(){return a},e.setLockedItem=function(e,n){a.push({element:e,scope:n})},e.clearLockedItems=function(){a=[]}}).directive("msNav",n).directive("msNavTitle",function(){return{restrict:"A",compile:function(e){return e.addClass("ms-nav-title"),function(){}}}}).directive("msNavButton",function(){return{restrict:"AE",compile:function(e){return e.addClass("ms-nav-button"),function(){}}}}).directive("msNavToggle",t)}(),function(){"use strict";function e(e,n){e.root?this.navigation=n.getNavigation(e.root):this.navigation=n.getNavigation(),this.toggleHorizontalMobileMenu=function(){angular.element("body").toggleClass("ms-navigation-horizontal-mobile-menu-active")},n.sort()}function n(c,m,u,p){return{restrict:"E",scope:{folded:"=",root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/vertical.html",transclude:!0,compile:function(e){return e.addClass("ms-navigation"),function(e,n){var t=angular.element("body"),a=angular.element('<div id="ms-navigation-fold-expander"></div>'),i=angular.element('<div id="ms-navigation-fold-collapser"></div>'),s=u("navigation");function o(e){if(p.setFolded(e),e)c.$broadcast("msNavigation::collapse"),t.addClass("ms-navigation-folded"),r();else{var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),t.removeClass("ms-navigation-folded ms-navigation-folded-open"),i.remove()}}function r(){n.parent().append(a),m(function(){a.on("mouseenter touchstart",l)})}function l(e){e&&e.preventDefault(),p.setFoldedOpen(!0);var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),t.addClass("ms-navigation-folded-open"),a.remove(),t.find("#main").append(i),i.on("mouseenter touchstart",d)}function d(e){e&&e.preventDefault(),p.setFoldedOpen(!1),c.$broadcast("msNavigation::collapse"),t.removeClass("ms-navigation-folded-open"),i.remove(),r()}p.setNavigationScope(e),function(){null===p.getFolded()&&p.setFolded(e.folded);p.getFolded()&&(m(function(){c.$broadcast("msNavigation::collapse")}),t.addClass("ms-navigation-folded"),r())}(),e.$watch(function(){return s.isLockedOpen()},function(e,n){if(!angular.isUndefined(e)&&!angular.equals(e,n)&&p.getFolded())if(e)c.$broadcast("msNavigation::collapse");else{var t=p.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched")}}),e.$watch("folded",function(e,n){angular.isUndefined(e)||angular.equals(e,n)||o(e)}),e.toggleFolded=function(){o(!p.getFolded())},e.$on("$stateChangeStart",function(){s.close()}),e.$on("$destroy",function(){i.off("mouseenter touchstart"),a.off("mouseenter touchstart")})}}}}function t(t,e,a,i,n,s){var o=this;o.element=e,o.node=t.node,o.hasChildren=void 0,o.collapsed=void 0,o.collapsable=void 0,o.group=void 0,o.animateHeightClass="animate-height",o.toggleCollapsed=function(){o.collapsed?o.expand():o.collapse()},o.collapse=function(){var e=o.element.children("ul"),n=e[0].offsetHeight;t.$evalAsync(function(){o.collapsed=!0,o.element.addClass("collapsing"),i.animate(e,{display:"block",height:n+"px"},{height:"0px"},o.animateHeightClass).then(function(){e.css({display:"",height:""}),o.element.removeClass("collapsing")}),t.$broadcast("msNavigation::collapse")})},o.expand=function(){var e=o.element.children("ul");e.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var n=e[0].offsetHeight;e.css({position:"",visibility:"",display:"",height:""}),t.$evalAsync(function(){o.collapsed=!1,o.element.addClass("expanding"),i.animate(e,{display:"block",height:"0px"},{height:n+"px"},o.animateHeightClass).then(function(){e.css({height:""}),o.element.removeClass("expanding")}),a.$broadcast("msNavigation::collapse",o.node._path)})},o.getClass=function(){return o.node.class},o.isHidden=function(){if(angular.isDefined(o.node.hidden)&&angular.isFunction(o.node.hidden))return o.node.hidden();return!1},function(){o.hasChildren=0<o.node.children.length,o.group=!(!angular.isDefined(o.node.group)||!0!==o.node.group),!o.hasChildren||o.group?o.collapsable=!1:o.collapsable=!(!angular.isUndefined(o.node.collapsable)&&"boolean"==typeof o.node.collapsable&&!0!==o.node.collapsable);o.collapsable?o.collapsed=!(!angular.isUndefined(o.node.collapsed)&&"boolean"==typeof o.node.collapsed&&!0!==o.node.collapsed):o.collapsed=!1;if(o.node.state===n.current.name||n.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;t.$emit("msNavigation::stateMatched"),s.setActiveItem(o.node,t)}t.$on("msNavigation::stateMatched",function(){o.collapsable&&o.collapsed&&t.$evalAsync(function(){o.collapsed=!1})}),t.$on("msNavigation::collapse",function(e,n){if(!o.collapsed&&o.collapsable)if(angular.isUndefined(n))o.collapse();else{var t=n.split("."),a=[],i=s.getActiveItem();if(i&&(a=i.node._path.split(".")),-1<t.indexOf(o.node._id))return;if(-1<a.indexOf(o.node._id))return;o.collapse()}}),t.$on("$stateChangeSuccess",function(){if(o.node.state===n.current.name){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;s.setActiveItem(o.node,t),a.$broadcast("msNavigation::collapse",o.node._path)}if(n.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;t.$emit("msNavigation::stateMatched")}})}()}function a(n){return{restrict:"E",scope:{root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/horizontal.html",transclude:!0,compile:function(e){return e.addClass("ms-navigation-horizontal"),function(e){n.setNavigationScope(e)}}}}function i(t,e,n,a,i){var s=this;s.element=e,s.node=t.node,s.hasChildren=void 0,s.group=void 0,s.getClass=function(){return s.node.class},function(){if(s.isActive=!1,s.hasChildren=0<s.node.children.length,s.group=!(!angular.isDefined(s.node.group)||!0!==s.node.group),s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;t.$emit("msNavigation::stateMatched"),i.setActiveItem(s.node,t)}t.$on("msNavigation::stateMatched",function(){s.hasChildren&&t.$evalAsync(function(){s.isActive=!0})}),t.$on("msNavigation::clearActive",function(){if(s.hasChildren){var e=[],n=i.getActiveItem();n&&(e=n.node._path.split(".")),-1<e.indexOf(s.node._id)?t.$evalAsync(function(){s.isActive=!0}):t.$evalAsync(function(){s.isActive=!1})}}),t.$on("$stateChangeSuccess",function(){if(s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;i.setActiveItem(s.node,t),n.$broadcast("msNavigation::clearActive")}})}()}function s(i){return{restrict:"A",require:"^msNavigationHorizontalNode",compile:function(e){return e.addClass("ms-navigation-horizontal-item"),function(e,n,t,a){n.on("click",function(){if(!a.hasChildren||i("gt-md"))return;n.toggleClass("expanded")}),e.$on("$destroy",function(){n.off("click")})}}}}e.$inject=["$scope","msNavigationService"],n.$inject=["$rootScope","$timeout","$mdSidenav","msNavigationService"],t.$inject=["$scope","$element","$rootScope","$animate","$state","msNavigationService"],a.$inject=["msNavigationService"],i.$inject=["$scope","$element","$rootScope","$state","msNavigationService"],s.$inject=["$mdMedia"],angular.module("app.core").provider("msNavigationService",function(){var r=angular.injector(["ng"]).get("$log"),l=[];function d(e,n){if(angular.isString(e)){for(var t=e.split("."),a=t[t.length-1],i=function(e){var n=l;if(1===e.length)return n;e.pop();for(var t=0;t<e.length;t++){for(var a=e[t],i=!0,s=0;s<n.length;s++)if(n[s]._id===a){n=n[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};n.push(o),n=o.children}}return n}(t),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,n),s.uisref=u(s)):(n.children=[],!angular.isUndefined(n.weight)&&angular.isNumber(n.weight)||(n.weight=1),n._id=a,n._path=e,n.uisref=u(n),i.push(n))}else r.error("path must be a string (eg. `dashboard.project`)")}function c(e){if(angular.isString(e)){for(var n=l,t=e.split("."),a=0;a<t.length;a++)for(var i=t[a],s=0;s<n.length;s++)if(n[s]._id===i){if(n[s]._path===e)return n.splice(s,1),!0;n=n[s].children;break}return!1}r.error("path must be a string (eg. `dashboard.project`)")}function m(e){e||(e=l).sort(a);for(var n=0;n<e.length;n++){var t=e[n].children;1<t.length&&t.sort(a),0<t.length&&m(t)}}function a(e,n){return parseInt(e.weight)-parseInt(n.weight)}function u(e){var n="";return angular.isDefined(e.state)&&(n=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(n=n+"("+angular.toJson(e.stateParams)+")")),n}this.saveItem=d,this.deleteItem=c,this.sortByWeight=m,this.$get=function(){var t=null,n=null,a=null,i=null,e={saveItem:d,deleteItem:c,sort:m,clearNavigation:function(){l=[],n&&(n.vm.navigation=l)},setActiveItem:function(e,n){t={node:e,scope:n}},getActiveItem:function(){return t},getNavigation:s,getFlatNavigation:o,setNavigationScope:function(e){n=e},setFolded:function(e){a=e},getFolded:function(){return a},setFoldedOpen:function(e){i=e},getFoldedOpen:function(){return i},toggleFolded:function(){n.toggleFolded()},getSectionId:function(n,t){var e=o(),a=_.find(e,function(e){return t?e.route===n&&e.title.toLowerCase()===t.toLowerCase():e.route===n});return a?a.id:0}};return e;function s(e){if(e){for(var n=0;n<l.length;n++)if(l[n]._id===e)return[l[n]];return null}return l}function o(e){var n=s(e);return function e(n){var t=[];for(var a=0;a<n.length;a++){var i=angular.copy(n[a]);i.children=[],t.push(i),0<n[a].children.length&&(t=t.concat(e(n[a].children)))}return t}(n)}}}).controller("MsNavigationController",e).directive("msNavigation",n).controller("MsNavigationNodeController",t).directive("msNavigationNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationNode"},controller:"MsNavigationNodeController as vm",compile:function(e){return e.addClass("ms-navigation-node"),function(e,n,t,a){n.addClass(a.getClass()),a.group&&n.addClass("group")}}}}).directive("msNavigationItem",function(){return{restrict:"A",require:"^msNavigationNode",compile:function(e){return e.addClass("ms-navigation-item"),function(e,n,t,a){a.collapsable&&n.on("click",a.toggleCollapsed),e.$on("$destroy",function(){n.off("click")})}}}}).directive("msNavigationHorizontal",a).controller("MsNavigationHorizontalNodeController",i).directive("msNavigationHorizontalNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationHorizontalNode"},controller:"MsNavigationHorizontalNodeController as vm",compile:function(e){return e.addClass("ms-navigation-horizontal-node"),function(e,n,t,a){n.addClass(a.getClass()),a.group&&n.addClass("group")}}}}).directive("msNavigationHorizontalItem",s)}(),function(){"use strict";function e(p,t,g,e,a,i,n,u,s,o,v,h,f,b,r,A,l){var E=this,d=["ringingId","speakerId","microphoneId","ringingVolume","speakerVolume","microphoneVolume","ringingMute","speakerMute","microphoneMute"],c=JSON.parse(n.localStorage.getItem("motion2.user:"+E.conf.id))||{webrtc:{ringingVolume:.5,speakerVolume:.5,microphoneVolume:1,ringingMute:!1,speakerMute:!1,microphoneMute:!1}};e(function(){},999);var y=l.getLogger("jssip","ms-phonebar");function m(l){var d,c,m;return E.initDeviceInProgress=!0,navigator.mediaDevices.getUserMedia({audio:!0}).then(function(e){return E.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/silence.ogg"),E.soundPlayer.play().catch(function(e){y.error(e.message)}),e.getTracks().forEach(function(e){e.stop()}),navigator.mediaDevices.enumerateDevices()}).then(function(e){var n=_.filter(e,function(e){return"audioinput"===e.kind&&"default"!==e.deviceId&&"communications"!==e.deviceId});if(0<n.length){var t=_.find(e,function(e){return"default"===e.deviceId&&"audioinput"===e.kind});if(m=_.find(n,function(e){return e.groupId===t.groupId}),E.conf.microphoneId&&!l){var a=_.find(n,function(e){return e.deviceId===E.conf.microphoneId});a&&(m=a)}E.conf.microphoneId=m.deviceId}else v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_MICROPHONE_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"});E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0,x("microphone",!1);var i=_.filter(e,function(e){return"audiooutput"===e.kind&&"default"!==e.deviceId&&"communications"!==e.deviceId});if(0<i.length){var s=_.find(e,function(e){return"default"===e.deviceId&&"audiooutput"===e.kind});if(c=d=_.find(i,function(e){return e.groupId===s.groupId}),E.conf.speakerId&&!l){var o=_.find(i,function(e){return e.deviceId===E.conf.speakerId});o&&(c=o)}if(E.conf.speakerId=c.deviceId,E.conf.ringingId&&!l){var r=_.find(i,function(e){return e.deviceId===E.conf.ringingId});r&&(d=r)}E.conf.ringingId=d.deviceId}else v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_SPEAKER_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"});return x("speaker",!1)}).then(function(){return x("ringing",!1)}).then(function(){if(jabra)return jabra.init().then(function(){return E.isJabraInitialized=!0,jabra.getInstallInfo()}).then(function(){return jabra.getUserDeviceMediaExt()}).then(function(e){m&&c&&d&&e&&_.includes([m.groupId,c.groupId,d.groupId],e.deviceInfo.browserGroupId)&&(y.info("Jabra library correctly initialized and device correctly installed"),E.isJabraEnabled=!0,jabra.onHook(),jabra.addEventListener("acceptcall",function(e){var n=_.last(E.sessions);n?"incoming"===n.direction&&n.isInProgress()?E.answer(n):y.error("Unable to find a valid call to answer",e):y.error("Unable to answer the call",e)}.bind(this)),jabra.addEventListener("mute",function(){x("microphone",E.conf.microphoneMute=!0)}.bind(this)),jabra.addEventListener("unmute",function(){E.conf.microphoneMute=!1,x("microphone",!0)}.bind(this)),jabra.addEventListener("flash",function(){E.jabraSession.localHold?E.unhold(E.jabraSession):E.hold(E.jabraSession)}.bind(this)),jabra.addEventListener("endcall",function(){o(function(e){for(var n=null,t=0;t<E.sessions.length;t++)_.has(E.sessions[t],"localHold")&&E.sessions[t].localHold||(n=E.sessions[t]);e(n)}).then(function(e){null!==e&&E.terminate(e)})}.bind(this)))}).catch(function(e){y.warn("Error initializing Jabra integration",e)})}).catch(function(e){y.error("Unable to init media devices",e),"NotFoundError"===e.name&&v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_AUDIO_DEVICES_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}).finally(function(){E.initDeviceInProgress=!1,S(),DetectRTC.load(function(){E.conf.hasMicrophone=DetectRTC.hasMicrophone,E.conf.hasSpeakers="Chrome"!==DetectRTC.browser.name&&"Edge"!==DetectRTC.browser.name&&"Opera"!==DetectRTC.browser.name||DetectRTC.hasSpeakers,E.conf.isWebRTCSupported=DetectRTC.isWebRTCSupported,E.conf.osName=DetectRTC.osName,E.conf.osVersion=DetectRTC.osVersion,E.conf.browserName=DetectRTC.browser.name,E.conf.browserVersion=DetectRTC.browser.version,E.conf.license&&E.conf.isWebRTCSupported&&E.conf.hasMicrophone&&E.conf.hasSpeakers&&"https"===E.conf.protocol&&("chrome"===E.conf.browserName.toLowerCase()||"opera"===E.conf.browserName.toLowerCase()||"safari"===E.conf.browserName.toLowerCase())?E.register||E.ua.start():E.conf.license||v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}.bind(this))})}function S(){c.webrtc=_.pick(E.conf,d),n.localStorage.setItem("motion2.user:"+E.conf.id,JSON.stringify(c))}function T(e,n,t){y.debug("addCall -> target, inbound, fullname",e,n,t),E.calls.unshift({target:e,fullname:t||e,inbound:n,time:moment().format("HH:mm")}),50<E.calls.length&&E.calls.pop()}function I(e){y.debug("answer -> session",e._request),e.notification&&(e.notification.close(),e.notification=null),E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0,e.answer(E.sessionConf),E.isJabraEnabled&&(jabra.offHook(),E.jabraSession=e)}function O(e,n){y.debug("terminate -> session",e._request),e.notification&&(e.notification.close(),e.notification=null);var t={};if(n?t.status_code=n:e.isEstablished()||(t.status_code=603),e.terminate(t),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var a=_.last(E.sessions);a.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=a):jabra.offHook()}}function C(t){return y.debug("getVoiceChannels -> session",t._request),h.rpc.getVoiceChannels().$promise.then(function(e){var n=_.find(e.rows,function(e){return e.sipcalllinkedid===t.call_id?e:e.sipcalluniqueid===t.call_id?e:null});n&&(t.monitor=n.monitor,t.uniqueid=n.uniqueid,t.monitors=n.monitors)})}function w(e){y.debug("onAddstream -> data",e),this.remotePlayer.srcObject=e.stream,this.remotePlayer.play()}function R(){E.canGoInConference=!1,E.isInConference=!1,E.currentconferenceSessions=[]}function x(e,n){switch(e){case"ringing":E.soundPlayer.muted=E.conf.ringingMute,E.conf.ringingId&&E.soundPlayer.setSinkId(E.conf.ringingId).then(function(){E.soundPlayer.volume=E.conf.ringingVolume}).then(function(){n&&S()}).catch(function(e){y.info(e.message,E.conf.ringingId)});break;case"speaker":E.remotePlayer.muted=E.conf.speakerMute,E.conf.speakerId&&E.remotePlayer.setSinkId(E.conf.speakerId).then(function(){E.remotePlayer.volume=E.conf.speakerVolume}).then(function(){n&&S()}).catch(function(e){y.info(e.message,E.conf.speakerId)});break;case"microphone":for(var t=0;t<E.sessions.length;t+=1)E.conf.microphoneMute?E.sessions[t].mute():E.sessions[t].unmute();jabra&&E.isJabraEnabled&&(E.conf.microphoneMute?jabra.mute():jabra.unmute()),n&&S();break;default:y.info("unknown device")}}function N(){E.target="",document.getElementById("ms-target").blur(),document.getElementById("ms-target").value="",p.$broadcast("angucomplete-alt:clearInput","ms-target-wrap")}function D(n){return h.user.getVoicePrefixes({id:E.conf.id}).$promise.then(function(e){if(e.count)return a.show({controller:"PrefixDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/prefix/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{prefixes:e,required:E.conf.phoneBarPrefixRequired}})}).then(function(e){if(E.conf.phoneBarPrefixRequired){if(e&&-1!==e)return e+n}else{if(e&&-1!==e)return e+n;if(!e)return n}})}function P(){if(E.isInConference){var e=E.sessions[0].connection.getReceivers()[0],n=E.sessions[1].connection.getReceivers()[0],t=new MediaStream;t.addTrack(e.track),t.addTrack(n.track);var a=document.getElementById("remote-audio");a.srcObject=t;var i=a.play();void 0!==i&&i.then(function(){}).catch(function(e){y.error(e)})}}function L(e,n,t,a){return y.debug("onReferCallback -> session, textContent, position, delay",e._request,n,t,a),function(){i.show(i.simple().textContent(n).position(t).hideDelay(a)),O(e)}}function k(n){return y.debug("findSessionBySessionId -> sessionId, vm_pb.sessions",n,E.sessions),_.find(E.sessions,function(e){return e.call_id==n})}function M(e,n){return y.debug("callCallback -> url, params",e,n),s({url:e,method:"GET",params:n})}E.currentUser=b.getCurrentUser(),E.direction="right",E.selectedMode="md-scale",E.target="",E.showDialpad=!1,E.soundPlayer=document.getElementById(E.conf.soundPlayerId),E.remotePlayer=document.getElementById(E.conf.remotePlayerId),E.soundPlayer.volume=1,E.sessionConf={mediaConstraints:{audio:!0,video:!1},pcConfig:{iceServers:[]}},E.sessions=[],E.calls=[],E.callbackQueue=[],E.canGoInConference=!1,E.isInConference=!1,E.currentConferenceSessions=[],E.ua=new JsSIP.UA({sockets:[new JsSIP.WebSocketInterface("wss://"+E.conf.host+":"+E.conf.wssPort+"/ws")],uri:new JsSIP.URI("sip",E.conf.name,E.conf.host,5060,null,null).toString(),authorization_user:E.conf.name,ha1:E.conf.ha1,realm:E.conf.realm,user_agent:E.conf.ua,session_timers_refresh_method:"invite",register_expires:E.conf.phoneBarExpires||60,register:!0}),E.conf=_.merge(c.webrtc,E.conf),E.initDeviceInProgress=!1,E.isJabraEnabled=!1,E.isJabraInitialized=!1,E.jabraSession=null,E.jabraClicked=!1,E.buttonClicked=!1,E.originateInProgress=!1,t.bind("keyup",function(e){switch(e.keyCode){case 27:g(function(){E.showDialpad=!1})}}),E.$onInit=function(){m(!1),navigator.mediaDevices.ondevicechange=function(){E.initDeviceInProgress||(E.initDeviceInProgress=!0,jabra&&E.isJabraInitialized?jabra.shutdown().then(function(){E.isJabraInitialized=!1,m(!(E.isJabraEnabled=!1))}).catch(function(e){y.error("Unable to shutdown Jabra library",e)}):m(!0))};var e=[h.network.get({type:"turn",nolimit:!0}).$promise,h.network.get({type:"stun",nolimit:!0}).$promise];o.all(e).then(function(e){var n=e[0].rows,t=e[1].rows,a=[],i=[];t.forEach(function(e){i.push("stun:"+e.value)}),a.push({urls:i}),n.forEach(function(e){var n={urls:"turn:"+e.value};e.username&&(n.username=e.username),e.password&&(n.credential=e.password),a.push(n)}),E.sessionConf.pcConfig={iceServers:a}}),this.ua.on("registered",function(){this.registered=!0}.bind(this)),this.ua.on("unregistered",function(){this.registered=!1}.bind(this)),this.ua.on("newRTCSession",function(e){y.debug("onNewRTCSession -> data",e);var n,t,a,i,s,o=e.session,r=!0,l="",d=0;switch(e.originator){case"local":o.outgoing=!0,o.name=e.request.ruri.user,o.user=e.request.ruri.user,T(o.user,!1),t=e.request.extraHeaders,a="X-callback-url",s=_.find(t,function(e){return _.startsWith(e,a)}),n=!!s&&_.trim(s.replace(a,"").replace(i||":","")),E.isJabraEnabled&&(E.jabraSession&&jabra.resume(),E.jabraSession=o,jabra.offHook());break;case"remote":var c=b.getCurrentUser();c.voicePause&&c.phoneBarDnd&&(r=!1);var m=e.request.getHeader("Call-Type")||"";if(c.ignorePauseForPreviewCalls&&"PREVIEW"===m&&(r=!0),E.originateInProgress&&(r=!1),r&&(o.incoming=!0,o.name=e.request.from.display_name,o.user=e.request.from.uri.user,l=e.request.getHeader("X-Answer-Mode")||"",d=e.request.getHeader("X-Answer-After")||0,function(n){y.debug("getNotification -> session",n._request);var e=n.name?n.name+" <"+n.user+">":n.user;E.currentUser.privacyEnabled&&(e=A.mask(e)),f.create("Incoming call from: ",e,null,function(){I(n)},function(){O(n)},E.conf.autoAnswer).then(function(e){n.notification=e}).catch(function(e){y.error("Error creating notification for incoming call",e)})}(e.session),T(e.session.user,!0),E.isJabraEnabled&&jabra.ring(),E.conf.autoAnswer&&g(function(){o.isInProgress()&&(o.autoAnswer=!0,I(o))},E.conf.autoAnswerDelay?1e3*E.conf.autoAnswerDelay:0),y.debug("xAnswerMode",l),y.debug("xAnswerAfterSec",d),"auto"==l.toLowerCase())){var u=0==d?500:1e3*d;y.debug("auto answer enabled after:"+u+" ms"),g(function(){o.isInProgress()&&(o.autoAnswer=!0,I(o))},u)}}r?(o.call_id=e.request.call_id,n&&M(E.callbackQueue[o.call_id]=n,{call_id:o.call_id}).then(function(){y.info('callbackurl:"'+n+'" called successfully')}).catch(function(e){y.error('fail callbackurl:"'+n+'" err:',e)}),o.connection&&(o.connection.onaddstream=w.bind(this)),o.iceCandidateTimeout=null,o.on("progress",function(e,n){y.debug("onProgress -> session, data",e._request,n),y.error("onProgress -> session, data",e._request,n);var t=!1;switch(n.originator){case"local":this.conf.ringingMute||(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/incoming-call.ogg"),t=!0);break;case"remote":this.putOtherCallsOnHold(e),this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/outgoing-call.ogg"),t=!0}E.originateInProgress&&(E.originateInProgress=!1),t&&(this.soundPlayer.loop="loop",this.soundPlayer.play().catch(function(e){y.error(e.message)})),C(e).then(function(){var n=E.callbackQueue[e.call_id];n&&M(n,{uniqueid:e.uniqueid,call_id:e.call_id,number_called:e.user}).then(function(){y.info('callbackurl:"'+n+'" called successfully')}).catch(function(e){y.error('fail callbackurl:"'+n+'" err:',e)}).finally(function(){delete E.callbackQueue[e.call_id]})}).catch(function(e){y.error("Unable to retrieve voice channels",e)})}.bind(this,o)),o.on("confirmed",function(e,n){y.debug("onConfirmed -> session, data",e._request,n);var t=document.getElementById("div_session_"+e.id.substr(0,32));t&&$(t).scope().$broadcast("timer-start"),e.confirmed=!0,"remote"===n.originator&&e.connection&&(e.connection.onaddstream=w.bind(this),_.head(e.connection.getRemoteStreams())&&(this.remotePlayer.srcObject=_.head(e.connection.getRemoteStreams()),this.remotePlayer.play())),this.soundPlayer.pause(),this.soundPlayer.loop=null,this.putOtherCallsOnHold(e),e.autoAnswer&&(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/beep.ogg"),this.soundPlayer.play().catch(function(e){y.error("Unable to play autoAnswer notification",e)})),E.canGoInConference=2==E.sessions.length,C(e).catch(function(e){y.error("Unable to retrieve voice channels",e)})}.bind(this,o)),o.on("hold",function(e,n){y.debug("onHold -> session, data",e._request,n),"local"===n.originator&&(e.localHold=!0)}.bind(this,o)),o.on("unhold",function(e,n){y.debug("onUnhold -> session, data",e._request,n),"local"===n.originator&&(e.localHold=!1)}.bind(this,o)),o.on("ended",function(e,n){if(y.debug("onEnded -> session, data",e._request,n),E.isInConference&&_.includes(E.currentConferenceSessions,e.id)&&(R(),E.buttonClicked=!0),_.remove(this.sessions,{id:e.id}),2!==E.sessions.length&&(E.canGoInConference=!1),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var t=_.last(E.sessions);t.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=t):jabra.offHook()}0===E.sessions.length&&E.currentUser.voicePause&&h.user.pause({id:E.currentUser.id,type:_.startsWith(E.currentUser.pauseType,"#")?E.currentUser.pauseType.substring(1):E.currentUser.pauseType}).$promise.catch(function(e){v.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:PAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})}),E.conf.microphoneMute=!1,E.initDevice("microphone",!0)}.bind(this,o)),o.on("failed",function(e,n){if(y.debug("onFailed -> session, data",e._request,n),this.soundPlayer.pause(),this.soundPlayer.loop=null,e.notification&&e.notification.close(),E.isInConference&&_.includes(E.currentConferenceSessions,e.id)&&R(),E.originateInProgress&&(E.originateInProgress=!1),_.remove(this.sessions,{id:e.id}),2!==E.sessions.length&&(E.canGoInConference=!1),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var t=_.last(E.sessions);t.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=t):jabra.offHook()}}.bind(this,o)),o.on("icecandidate",function(e,n){y.debug("onIcecandidate -> session, data",e._request,n),null!==e.iceCandidateTimeout&&clearTimeout(e.iceCandidateTimeout),e.iceCandidateTimeout=setTimeout(n.ready,1e3)}.bind(this,o)),E.sessions.push(o),g(function(){p.$apply(),y.debug("onNewRTCSession -> vm_pb.sessions",E.sessions)})):O(o,486)}.bind(this)),r.on("webbar:originate",function(e){y.debug("originateHook -> payload",e);var n=e.callNumber,t=e.callerId,a=e.callbackUrl;E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0;var i=n.replace(/ /g,"");if(i=(i=i.replace(/\(/g,"")).replace(/\)/g,"")){var s=angular.copy(E.sessionConf);s.extraHeaders=[],t&&s.extraHeaders.push("X-CID: "+t),a&&s.extraHeaders.push("X-callback-url: "+a),E.originateInProgress=!0,E.ua.call(i,s)}}.bind(this)),r.on("webbar:hangup",function(e){y.debug("hangupHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];y.info("hangupHook -> sessionToHangup",a),E.terminate(a)}}.bind(this)),r.on("webbar:answer",function(e){var n;y.debug("answerHook -> payload",e),n=e.sessionId?k(e.sessionId):_.find(E.sessions,function(e){return e.incoming&&!e.confirmed}),e.sessionId&&!n&&y.warn("call with session Id "+e.sessionId+" not found"),n&&E.answer(n)}.bind(this)),r.on("webbar:hold",function(e){y.debug("holdHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];E.hold(a)}}.bind(this)),r.on("webbar:unhold",function(e){y.debug("unholdHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];E.unhold(a)}}.bind(this)),r.on("webbar:transfer",function(e){if(y.debug("transferHook -> payload",e),e.sessionId)if(e.transferNumber){var n=k(e.sessionId);n?n.refer(e.transferNumber,{eventHandlers:{requestSucceeded:L(n,"requestSucceeded","top right",3e3),requestFailed:L(n,"requestFailed","top right",3e3)}}):y.warn("call with session Id "+e.sessionId+" not found")}else y.error("transferNumber required");else y.error("sessionId required")}.bind(this)),r.on("webbar:stopmonitors",function(e){if(e.agentId===E.currentUser.id){var n=_.find(E.sessions,["uniqueid",e.uniqueid]);if(!n)return;n.monitors.forEach(function(e){e.status="pause"}),n.monitor=!1}}.bind(this))}.bind(this),E.type=function(e,n){var t=e;switch(E.target||(E.target=""),n&&(E.target+=e,p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target)),e){case"*":t="asterisk";break;case"#":t="pound"}E.conf.enableDtmfTone&&(E.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/dialpad/"+t+".ogg"),E.soundPlayer.play().catch(function(e){y.error(e.message)}));for(var a=0;a<E.sessions.length;a+=1)E.sessions[a].isEstablished()&&!E.sessions[a].isOnHold().local&&E.sessions[a].sendDTMF(e)},E.call=function(){if(E.target&&E.target!==E.conf.name&&E.target!==E.conf.internal){E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0;var e=E.target.replace(/ /g,"");return D(e=(e=e.replace(/\(/g,"")).replace(/\)/g,"")).then(function(e){e&&E.ua.call(e,E.sessionConf)}).then(function(){N()})}},E.hold=function(e){y.debug("hold -> session",e._request),e.hold({useUpdate:!1}),E.isJabraEnabled&&(jabra.hold(),jabra.onHook())},E.refer=function(n){y.debug("refer -> session",n._request);var e=a.prompt().title("Transfer").textContent("Type the target").placeholder("Target").ariaLabel("Target").ok("Transfer").cancel("Cancel");a.show(e).then(function(e){return D(e.replace(/ /g,"").replace(/\(/g,"").replace(/\)/g,""))}).then(function(e){n.refer(e,{eventHandlers:{requestSucceeded:L(n,"requestSucceeded","top right",3e3),requestFailed:L(n,"requestFailed","top right",3e3)}})})},E.record=function(e){y.debug("record -> session",e._request),a.show({controller:"RecordDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/record/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{session:e,sessions:E.sessions}})},E.unhold=function(e){y.debug("unhold -> session",e._request),e.unhold({useUpdate:!1}),E.putOtherCallsOnHold(e),E.isJabraEnabled&&(jabra.offHook(),jabra.resume())},E.answer=I,E.terminate=O,E.selectSession=function(e){y.debug("selectSession -> session",e._request),E.unhold(e)},E.typeWrapper=function(e){switch(e.key.toLowerCase()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"*":case"#":E.type(e.key);break;case"enter":E.call()}},E.toggleDialpad=function(){E.showDialpad=!E.showDialpad},E.referAttended=function(e){y.debug("referAttended -> session",e._request),a.show({controller:"ReferAttendedDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/referAttended/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{session:e,sessions:_.reject(E.sessions,{id:e.id}),isJabraEnabled:E.isJabraEnabled}})},E.closeDialpad=function(){E.showDialpad=!1},E.initDevice=x,E.putOtherCallsOnHold=function(e){if(y.debug("putOtherCallsOnHold -> session",e._request),1<E.sessions.length)for(var n=0;n<E.sessions.length;n+=1)E.sessions[n].id===e.id||E.sessions[n].isOnHold().remote||E.sessions[n].hold({useUpdate:!1})},E.targetChanged=function(e){e?/^(\w|\.|\+|#|\*|\(|\)|\s|-)*$/.test(e)?(E.target=e,p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target)):E.target?p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target):N():N()},E.targetSelected=function(e){e&&(E.target=e.originalObject.target,E.call(),N())},E.start3WayConf=function(){E.isInConference=!0,E.canGoInConference=!1,E.currentConferenceSessions.push(E.sessions[0].id),E.currentConferenceSessions.push(E.sessions[1].id);var e=new AudioContext,n=E.sessions[0].connection.getSenders()[0],t=E.sessions[0].connection.getReceivers()[0];t.track.addEventListener("unmute",function(){setTimeout(function(){P()},1e3)},!1);var a=E.sessions[1].connection.getSenders()[0],i=E.sessions[1].connection.getReceivers()[0];i.track.addEventListener("unmute",function(){setTimeout(function(){P()},1e3)},!1),E.sessions[0].unhold({useUpdate:!1}),E.sessions[1].unhold({useUpdate:!1}),t.track.enabled=!0,i.track.enabled=!0;var s=new MediaStream,o=e.createMediaStreamDestination();o=(e=new AudioContext).createMediaStreamDestination();var r=e.createMediaStreamSource(new MediaStream([i.track]));r.connect(o),(r=e.createMediaStreamSource(new MediaStream([n.track]))).connect(o),n.replaceTrack(o.stream.getTracks()[0]).then(function(){}),o=e.createMediaStreamDestination(),(r=e.createMediaStreamSource(new MediaStream([t.track]))).connect(o),(r=e.createMediaStreamSource(new MediaStream([a.track]))).connect(o),a.replaceTrack(o.stream.getTracks()[0]).then(function(){s.addTrack(t.track),s.addTrack(i.track);var e=document.getElementById("remote-audio");e.srcObject=s;var n=e.play();void 0!==n&&n.then(function(){}).catch(function(e){y.error(e)})})},E.patchConference=P,p.$on("webrtc::settings",function(e){a.show({controller:"SettingsController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/settings/settings.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{devices:function(){return navigator.mediaDevices.enumerateDevices()}},locals:{conf:E.conf,activeSessions:E.sessions}}).then(function(e){e&&(E.conf=e,E.initDeviceInProgress||(E.initDeviceInProgress=!0,jabra&&E.isJabraInitialized?jabra.shutdown().then(function(){E.isJabraInitialized=!1,m(E.isJabraEnabled=!1)}).catch(function(e){y.error("Unable to shutdown Jabra library",e)}):m(!1)))})}),p.$on("webrtc::logout",function(){E.ua.stop(),jabra&&E.isJabraInitialized&&jabra.shutdown(),navigator.mediaDevices.ondevicechange=function(){}}),p.$on("webrtc::call",function(e,n){y.debug("onRemoteCall -> evt, data",e,n),n.target&&(E.target=n.target,E.call())}),p.$on("webrtc::transfer",function(e,n){if(y.debug("onRemoteTransfer -> evt, data",e,n),n.target)for(var t=0;t<E.sessions.length;t+=1)if(E.sessions[t].isEstablished()&&!E.sessions[t].isOnHold().local)return D(n.target).then(function(e){e&&E.sessions[t].refer(e,{eventHandlers:{requestSucceeded:L(E.sessions[t],"requestSucceeded","top right",3e3),requestFailed:L(E.sessions[t],"requestFailed","top right",3e3)}})})}),p.$on("$destroy",function(){y.debug("$destroy event fired"),r.removeAllListeners("webbar:originate"),r.removeAllListeners("webbar:hangup"),r.removeAllListeners("webbar:answer"),r.removeAllListeners("webbar:hold"),r.removeAllListeners("webbar:unhold"),r.removeAllListeners("webbar:transfer"),r.removeAllListeners("webbar:stopmonitors")}),n.onbeforeunload=function(){E.sessions.forEach(function(e){E.terminate(e)})}}e.$inject=["$scope","$document","$timeout","$interval","$mdDialog","$mdToast","$window","$translate","$http","$q","toasty","api","motNotification","Auth","socket","privacyManager","ClientSideLoggingService"],angular.module("app.core").controller("MsPhonebarController",e).directive("msPhonebar",function(){return{restrict:"E",scope:{conf:"=",sessions:"=",registered:"="},require:"msPhonebar",controller:"MsPhonebarController",controllerAs:"vm_pb",bindToController:!0,templateUrl:"assets/ms-phonebar/ms-phonebar.html"}})}(),function(){"use strict";function e(n,e,t){var a=this;a.prefixes=e,a.required=t,a.closeDialog=function(e){n.hide(e)},a.keyPress=function(e){13===e.keyCode&&this.call()},a.call=function(){n.hide(a.prefix)}}e.$inject=["$mdDialog","prefixes","required"],angular.module("app.core").controller("PrefixDialogController",e)}(),function(){"use strict";function e(i){return{restrict:"C",controller:["$scope","$element",function(e,n){function t(){n.css("display","inline"),i(a,1e3)}function a(){n.css("display","none"),i(t,1e3)}t()}],replace:!0}}function n(n,i,s,e,t){var o=this;function a(n,e){console.log("startMonitor");var t=i.defer(),a=(e||n.filename.replace(/^.*[\\\/]/,"")).split(".")[0];return s.rpc.startMonitor({uniqueid:o.session.uniqueid,filename:a,format:"wav"}).$promise.then(function(e){n.filename=a+".wav",n.mixmonitorid=e.mixmonitorid,n.status="rec",o.session.monitor=!0,t.resolve(n)}).catch(function(e){t.reject(e)}),t.promise}o.title="Record",o.sessions=e,o.session=t,o.closeDialog=function(){n.hide()},o.addRecording=function(){var e=n.prompt({skipHide:!0}).title("Start new recording").textContent("Type the file name.").placeholder("File name").ariaLabel("File name").initialValue(function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}()).ok("Start").cancel("Cancel");n.show(e).then(function(e){return a({},e)}).then(function(e){o.session.monitors.push(e)})},o.stop=function(n){return console.log("stopMonitor"),s.rpc.stopMonitor({uniqueid:o.session.uniqueid,mixmonitorid:n.mixmonitorid}).$promise.then(function(e){n.status="pause",o.session.monitor=_.includes(o.session.monitors,{status:"rec"})}).catch(function(e){console.error(e)})},o.start=a}e.$inject=["$timeout"],n.$inject=["$mdDialog","$q","api","sessions","session"],angular.module("app.core").directive("msBlink",e).controller("RecordDialogController",n)}(),function(){"use strict";function e(n,i,a,s,o){var r=this;function l(e,n){var t=n?"Transfer Success":"Transfer Failed",a="top right";return console.debug("onTransferCallback -> session, textContent, position, delay",e,t,a,3e3),function(){i.show(i.simple().textContent(t).position(a).hideDelay(3e3))}}function d(e){n.hide(e)}r.title="Refer Attended",r.sessions=a,r.session=s,r.isJabraEnabled=o,r.sessionTarget=null,a.length&&(r.target=a[0].user),r.closeDialog=d,r.transfer=function(){var e,n,t=_.find(a,function(e){if(e.user===r.target)return e});n=t.outgoing?(e=t,r.session):(e=r.session,t);console.debug("session.refer() -> source, target, replaces, callback",n,e.user,e,"onTransferCallback"),n.refer(e.user,{replaces:e,eventHandlers:{requestSucceeded:l(s,!0),requestFailed:l(s,!1)}}),function(e,n){e.terminate(),jabra&&n&&jabra.onHook();d()}(s,o)}}e.$inject=["$mdDialog","$mdToast","sessions","session","isJabraEnabled"],angular.module("app.core").controller("ReferAttendedDialogController",e)}(),function(){"use strict";function e(e,s,n,t,a,i){var o=this;function r(e,n,t){var a;if(s[t]){if(a=_.find(e,function(e){return e.deviceId===s[t]}))return a.deviceId;var i=_.findIndex(e,function(e){return e.kind===n});if(0<=i)return e[i].deviceId}else(a=_.find(e,function(e){return e.kind===n}))&&(s[t]=a.deviceId);return s[t]||null}o.currentUser=a.getCurrentUser(),o.messengerSoundNotification=o.currentUser.messengerSoundNotification,_.remove(n,function(e){return"audioinput"===e.kind&&("default"===e.deviceId||"communications"===e.deviceId)||"audiooutput"===e.kind&&("default"===e.deviceId||"communications"===e.deviceId)}),s.ringingId=r(n,"audiooutput","ringingId"),s.speakerId=r(n,"audiooutput","speakerId"),s.microphoneId=r(n,"audioinput","microphoneId"),s.ringingVolume=s.ringingVolume||.5,s.speakerVolume=s.speakerVolume||.5,s.microphoneVolume=s.microphoneVolume||1,s.ringingMute=s.ringingMute||!1,s.speakerMute=s.speakerMute||!1,s.microphoneMute=s.microphoneMute||!1,o.conf=angular.copy(s),o.devices=n,o.activeSessions=t,o.saveSettings=function(){i.user.messengerSoundNotification({id:o.currentUser.id,enabled:o.messengerSoundNotification}).$promise.then(function(){a.setMessengerSoundNotification(o.messengerSoundNotification),e.hide(o.conf)})},o.closeDialog=function(){e.hide()},o.isCompatibleBrowser=function(){return"chrome"===o.conf.browserName.toLowerCase()||"opera"===o.conf.browserName.toLowerCase()||"safari"===o.conf.browserName.toLowerCase()}}e.$inject=["$mdDialog","conf","devices","activeSessions","Auth","api"],angular.module("app.toolbar").controller("SettingsController",e)}(),function(){"use strict";function e(e,t,a){var i=this;function s(e,n,t){r(e).then(function(){n&&!1!==t&&i.search()})}function o(e){var n=e.key;i.pickerModels[n].dateStart?!0===e.useFromToKeys?i.query[n]={from:moment(i.pickerModels[n].dateStart).utcOffset(0,!0).format(),to:moment(i.pickerModels[n].dateEnd).utcOffset(0,!0).add(23,"hours").add(59,"minutes").add(59,"seconds").format()}:i.query[n]={$gte:moment(i.pickerModels[n].dateStart).utcOffset(0,!0).format(),$lte:moment(i.pickerModels[n].dateEnd).utcOffset(0,!0).add(23,"hours").add(59,"minutes").add(59,"seconds").format()}:i.query[n]=void 0,i.search()}function r(e){var n=e.key,t={param:i.query[n],resources:e.options,placeholder:e.placeholder,ngValue:e.ngValue};return a.setPlaceholder(t).then(function(e){i.placeholders[n]=e})}i.pickerModels={},i.placeholders={},i.localizationMap=t.localizationMap,i.onMultiselectInit=function(e){r(e)},i.onDateRangeInit=function(e){var n=e.key;i.query[n]?i.pickerModels[n]=t.setSelectedDate(i.query[n]):i.pickerModels[n]={dateStart:null}},i.onMultiselectSelection=s,i.onDateRangeSelection=o,i.clearDate=function(e){var n=e.key;i.pickerModels[n]={dateStart:null},delete i.query[n],i.search()},i.clearSelection=function(e){var n=e.key,t=e.ngValue||"id";i.query[n]=!1===e.clearAll?[_.head(e.options)[t]]:[],r(e).then(function(){i.search()})},i.selectAll=function(e){var n=e.key,t=e.ngValue||"id";i.query[n]=_.map(e.options,t),r(e).then(function(){i.search()})},e.$on("ms-quick-filter:update",function(e,t){t.filters.forEach(function(e){var n=_.find(i.filters,["name",e]);if(n)switch(n.type){case"date":o(n);break;case"multiselect":s(n,!0,t.update);break;case"select":i.search()}})})}e.$inject=["$scope","dateRangeManager","quickFilterManager"],angular.module("app.core").directive("msQuickFilter",function(){return{restrict:"E",scope:{query:"=",filters:"=",search:"&"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-quick-filter/ms-quick-filter.html"}})}(),function(){"use strict";angular.module("app.core").directive("msRandomClass",function(){return{restrict:"A",scope:{msRandomClass:"="},link:function(e,n){var t=e.msRandomClass[Math.floor(Math.random()*e.msRandomClass.length)];n.addClass(t)}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{id:"=",model:"=",download:"="},replace:!0,link:function(n,e){var t=!1,a=document.createElement("audio");n.download||a.setAttribute("controlsList","nodownload"),a.setAttribute("preload","none"),a.setAttribute("controls",""),a.setAttribute("style","width: 265px;"),a.setAttribute("src"," "),a.onplay=function(e){t||(t=!0,e.preventDefault(),i[n.model||"voiceRecording"].download({id:n.id}).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type});a.setAttribute("type",e.type),a.setAttribute("src",URL.createObjectURL(t)),a.play()}).catch(function(e){console.error(e)}))},e.append(a)}}}e.$inject=["api"],angular.module("app.core").directive("msRecording",e)}(),function(){"use strict";angular.module("app.core").directive("msResponsiveTable",function(){return{restrict:"A",link:function(e,n){var t=angular.element('<div class="ms-responsive-table-wrapper"></div>');n.after(t),t.append(n)}}})}(),function(){"use strict";function e(n,i,s,e){var o=this;function t(){angular.isArray(o.onSearch)?a(o.onSearch):o.onResultClick?(o.resultsLoading=!0,n.$parent.$eval("vm.search(query)",{query:o.query.filter}).then(function(e){a(e)}).catch(function(){a([])}).finally(function(){o.resultsLoading=!1})):o.onSearch()}function a(e){o.expanded&&(void 0===e||angular.isArray(e)||null===e)&&(o.selectedResultIndex=0,o.results=e)}function r(){o.expanded=!0,o.displayOn=!0,n.expand()}function l(e){!1!==e&&(o.query.filter=void 0,o.onResultClick?a(null):t()),o.expanded=!1,n.collapse()}function d(e){o.onResultClick&&o.onResultClick({item:e}),l()}function c(){var e=i.find(".ms-search-bar-results"),n=angular.element(e.find(".result")[o.selectedResultIndex]);if(e&&n){var t=n.position().top-8,a=n.position().top+n.outerHeight()+8;o.ignoreMouseEvents=!0,s.cancel(o.mouseEventIgnoreTimeout),o.mouseEventIgnoreTimeout=s(function(){o.ignoreMouseEvents=!1},250),e.scrollTop()>t&&e.scrollTop(t),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}}o.queryOptions={debounce:o.debounce||0},o.searchOnEnterKey=e.get().searchOnEnterKey||!1,o.resultsLoading=!1,o.results=null,o.selectedResultIndex=0,o.ignoreMouseEvents=!1,o.expandBar=r,o.collapseBar=l,o.blurCollapse=function(){if(!o.collapseOnBlur)return;l(!0)},o.onKeyDown=function(e){var n=e.keyCode;-1<[27,38,40].indexOf(n)&&e.preventDefault();switch(n){case 13:if(!o.onResultClick)return t();if(!o.results)return;d(o.results[o.selectedResultIndex]);break;case 27:l(!0);break;case 38:0<=o.selectedResultIndex-1&&(o.selectedResultIndex--,c());break;case 40:if(!o.results)return;o.selectedResultIndex+1<o.results.length&&(o.selectedResultIndex++,c())}},o.absorbEvent=function(e){e.preventDefault()},o.handleMouseenter=function(e){if(o.ignoreMouseEvents)return;o.selectedResultIndex=e},o.handleResultClick=d,n.$watch("vm.displayOn",function(e){angular.isUndefined(e)||(!0!==e||o.expanded?e||!1===o.expanded||l(!1):r())}),n.$watch("vm.query.filter",function(e,n){if(!angular.isUndefined(e)&&0!==e.length&&!angular.equals(e,n)&&!1!==o.displayOn){if(o.expanded){if(!0===o.searchOnEnterKey&&!o.onResultClick)return;if(o.minChars&&o.minChars>e.length)return}else r();t()}})}function n(a){return{restrict:"E",scope:{query:"=?",debounce:"=?",direction:"@",iconColor:"@",onSearch:"&",onResultClick:"&?",onExpand:"&?",onCollapse:"&?",collapseOnBlur:"<?",minChars:"<?",displayOn:"=?"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-search-bar/ms-search-bar.html",compile:function(e){return e.addClass("ms-search-bar"),{post:function(n,t){n.collapse=function(){if(t.removeClass("expanded"),"down"===n.vm.direction){t.removeClass("down");var e=t.closest("md-toolbar");e&&e.removeClass("h-128")}a.find("body").removeClass("ms-search-bar-expanded")},n.expand=function(){if(t.addClass("expanded"),"down"===n.vm.direction){t.addClass("down");var e=t.closest("md-toolbar");e&&e.addClass("h-128")}a.find("body").addClass("ms-search-bar-expanded")}}}}}}e.$inject=["$scope","$element","$timeout","settingsManager"],n.$inject=["$document"],angular.module("app.core").controller("MsSearchBarController",e).directive("msSearchBar",n)}(),function(){"use strict";function e(e,t,i,o,r,l){var d=this;d.query="",d.queryOptions={debounce:300},d.resultsLoading=!1,d.selectedResultIndex=0,d.ignoreMouseEvents=!1,d.mobileBarActive=!1,d.results=null,d.shortcuts=[],d.sortableOptions={ghostClass:"ghost",forceFallback:!0,fallbackClass:"dragging",onSort:function(){d.saveShortcuts()}},d.populateResults=function(){for(var e=[],n=l.getFlatNavigation(),t=r.defer(),a=0;a<n.length;a++)n[a].uisref&&e.push(n[a]);if(d.query){e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(d.query)))return!0});for(var i=0;i<e.length;i++){e[i].hasShortcut=!1;for(var s=0;s<d.shortcuts.length;s++)if(d.shortcuts[s]._id===e[i]._id){e[i].hasShortcut=!0;break}}}else 0<d.shortcuts.length&&(e=d.shortcuts);return d.selectedResultIndex=0,o(function(){t.resolve(e)},250),t.promise},d.loadShortcuts=function(){var e=r.defer(),n=angular.fromJson(t.get("motion.shortcuts"));angular.isUndefined(n)&&(n=[{title:"Agents",icon:"icon-account-multiple",state:"app.staff.agents",weight:5,children:[],uisref:"app.staff.agents",hasShortcut:!0},{title:"License",icon:"icon-cog",state:"app.settings.license",weight:10,children:[],uisref:"app.settings.license",hasShortcut:!0}],t.put("motion.shortcuts",angular.toJson(n)));return e.resolve(n),e.promise},d.saveShortcuts=function(){var e=r.defer();return t.put("motion.shortcuts",angular.toJson(d.shortcuts)),o(function(){e.resolve({success:!0})},250),e.promise},d.addShortcut=function(e){e.hasShortcut=!0,d.shortcuts.push(e),d.saveShortcuts()},d.removeShortcut=function(e){e.hasShortcut=!1;for(var n=0;n<d.shortcuts.length;n++)d.shortcuts[n]._id===e._id&&(d.shortcuts.splice(n,1),d.query||(0===d.shortcuts.length?d.results=null:n>=d.shortcuts.length&&(d.selectedResultIndex=d.shortcuts.length-1)));d.saveShortcuts()},d.handleResultClick=function(e){e.hasShortcut?d.removeShortcut(e):d.addShortcut(e)},d.absorbEvent=function(e){e.preventDefault()},d.handleKeydown=function(e){var n=e.keyCode;-1<[38,40].indexOf(n)&&e.preventDefault();switch(n){case 13:d.handleResultClick(d.results[d.selectedResultIndex]);break;case 38:0<=d.selectedResultIndex-1&&(d.selectedResultIndex--,d.ensureSelectedResultIsVisible());break;case 40:d.selectedResultIndex+1<d.results.length&&(d.selectedResultIndex++,d.ensureSelectedResultIsVisible())}},d.handleMouseenter=function(e){if(d.ignoreMouseEvents)return;d.selectedResultIndex=e},d.temporarilyIgnoreMouseEvents=function(){d.ignoreMouseEvents=!0,o.cancel(d.mouseEventIgnoreTimeout),d.mouseEventIgnoreTimeout=o(function(){d.ignoreMouseEvents=!1},250)},d.ensureSelectedResultIsVisible=function(){var e=i.find("#ms-shortcut-add-menu").find(".results"),n=angular.element(e.find(".result")[d.selectedResultIndex]);if(e&&n){var t=n.position().top-8,a=n.position().top+n.outerHeight()+8;d.temporarilyIgnoreMouseEvents(),e.scrollTop()>t&&e.scrollTop(t),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}},d.toggleMobileBar=function(){d.mobileBarActive=!d.mobileBarActive},d.loadShortcuts().then(function(e){d.shortcuts=e,0<d.shortcuts.length&&(d.results=e)}),e.$watch("MsShortcuts.query",function(e,n){angular.isUndefined(e)||angular.equals(e,n)||(d.resultsLoading=!0,d.populateResults().then(function(e){d.results=e},function(){d.results=[]}).finally(function(){d.resultsLoading=!1}))})}e.$inject=["$scope","$cookies","$document","$timeout","$q","msNavigationService"],angular.module("app.core").controller("MsShortcutsController",e).directive("msShortcuts",function(){return{restrict:"E",scope:{},require:"msShortcuts",controller:"MsShortcutsController as MsShortcuts",bindToController:{},templateUrl:"app/core/directives/ms-shortcuts/ms-shortcuts.html",compile:function(e){return e.addClass("ms-shortcuts"),function(e,n){}}}})}(),function(){"use strict";angular.module("app.core").directive("msSidenavHelper",function(){return{restrict:"A",require:"^mdSidenav",link:function(e,n,t,a){e.$watch(function(){return a.isOpen()&&!a.isLockedOpen()},function(e){angular.isUndefined(e)||(n.parent().toggleClass("full-height",e),angular.element("html").toggleClass("sidenav-open",e))})}}})}(),function(){"use strict";function e(a){return{restrict:"E",link:function(e,n){var t=e.$on("msSplashScreen::remove",function(){a.leave(n).then(function(){t(),e=n=null})})}}}e.$inject=["$animate"],angular.module("app.core").directive("msSplashScreen",e)}(),function(){"use strict";function e(e){var i=this;function n(){i.setCurrentStep(1)}function t(e){return o(e)?i.steps[e-1].scope.optionalStep:null}function a(e){return o(e)?!!i.steps[e-1].scope.hideStep:null}function s(e){return o(e)?!!t(e)||i.steps[e-1].form.$valid:null}function o(e){return!(angular.isUndefined(e)||e<1||e>i.steps.length)}i.mainForm=void 0,i.orientation="horizontal",i.steps=[],i.currentStep=void 0,i.currentStepNumber=1,i.setOrientation=function(e){i.orientation=e||"horizontal"},i.registerMainForm=function(e){i.mainForm=e},i.registerStep=function(e,n,t){var a={element:e,scope:n,form:t,stepNumber:n.step||i.steps.length+1,stepTitle:n.stepTitle,stepTitleTranslate:n.stepTitleTranslate};return i.steps.push(a),i.steps.sort(function(e,n){return e.stepNumber-n.stepNumber}),a},i.setupSteps=function(){i.setCurrentStep(i.currentStepNumber)},i.resetForm=function(){e(function(){for(var e=0;e<i.steps.length;e++)i.steps[e].form.$setPristine(),i.steps[e].form.$setUntouched();i.mainForm.$setPristine(),i.mainForm.$setUntouched(),n()})},i.setCurrentStep=function(e){if(!o(e))return;if(i.currentStepNumber=e,"horizontal"===i.orientation){for(var n=0;n<i.steps.length;n++)i.steps[n].element.hide();i.steps[i.currentStepNumber-1].element.show()}else if("vertical"===i.orientation){for(var t=0;t<i.steps.length;t++)i.steps[t].element.find(".ms-stepper-step-content").hide();i.steps[i.currentStepNumber-1].element.find(".ms-stepper-step-content").show()}},i.gotoStep=function(e){if(a(e))return;i.setCurrentStep(e)},i.gotoPreviousStep=function(){for(var e=i.currentStepNumber-1,n=e;1<=n;n--)if(!a(n)){e=n;break}i.setCurrentStep(e)},i.gotoNextStep=function(){for(var e=i.currentStepNumber+1,n=e;n<=i.steps.length;n++)if(!a(n)){e=n;break}i.setCurrentStep(e)},i.gotoFirstStep=n,i.gotoLastStep=function(){i.setCurrentStep(i.steps.length)},i.isFirstStep=function(){return 1===i.currentStepNumber},i.isLastStep=function(){return i.currentStepNumber===i.steps.length},i.isStepCurrent=function(e){return o(e)?i.currentStepNumber===e:null},i.isStepDisabled=function(e){if(!o(e))return null;for(var n=!1,t=1;t<e;t++)if(!s(t)){n=!0;break}return n},i.isStepOptional=t,i.isStepHidden=a,i.filterHiddenStep=function(e){return!a(e.stepNumber)},i.isStepValid=s,i.isStepNumberValid=o,i.isFormValid=function(){return i.mainForm.$valid}}function n(o){return{restrict:"A",scope:{},require:["form","msVerticalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/vertical.html",compile:function(e){return e.addClass("ms-stepper"),function(e,n,t,a){var i=a[0],s=a[1];o(function(){s.setOrientation("vertical"),s.registerMainForm(i),s.setupSteps()})}}}}e.$inject=["$timeout"],n.$inject=["$timeout"],angular.module("app.core").controller("MsStepperController",e).directive("msHorizontalStepper",function(){return{restrict:"A",scope:{},require:["form","msHorizontalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/horizontal/horizontal.html",compile:function(e){return e.addClass("ms-stepper"),function(e,n,t,a){var i=a[0],s=a[1];s.setOrientation("horizontal"),s.registerMainForm(i),s.setupSteps()}}}}).directive("msHorizontalStepperStep",function(){return{restrict:"E",require:["form","^msHorizontalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},compile:function(e){return e.addClass("ms-stepper-step"),function(e,n,t,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(t.optionalStep),s.registerStep(n,e,i),n.hide()}}}}).directive("msVerticalStepper",n).directive("msVerticalStepperStep",function(){return{restrict:"E",require:["form","^msVerticalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",compile:function(e){return e.addClass("ms-stepper-step"),function(e,n,t,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(t.optionalStep),e.stepInfo=s.registerStep(n,e,i),e.MsStepper=s,n.find(".ms-stepper-step-content").hide()}}}})}(),function(){"use strict";function e(e){return{restrict:"E",scope:{},transclude:!0,controller:"MsTabScrollController",controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-tab-scroll/ms-tab-scroll.html",compile:function(e){return e.addClass("ms-tab-scroll"),function(e,n){}}}}e.$inject=["$document"],angular.module("app.core").controller("MsTabScrollController",function(){function n(){var e=document.getElementById("bar-container"),n=document.getElementById("tab-container");return n.scrollWidth>e.scrollWidth&&0==e.scrollLeft&&0==n.scrollLeft?"right":n.scrollWidth>e.scrollWidth&&n.scrollLeft>e.scrollLeft&&e.scrollWidth+n.scrollLeft>=n.scrollWidth?"left":n.scrollWidth>e.scrollWidth&&n.scrollLeft>e.scrollLeft&&e.scrollWidth+n.scrollLeft<n.scrollWidth?"both":"none"}this.onTabScroll=function(e){"left"==e?$("#tab-container").stop().animate({scrollLeft:"-=400"},1e3):$("#tab-container").stop().animate({scrollLeft:"+=400"},1e3)},this.canScroll=function(e){switch(n()){case"both":return!0;case"left":return"left"==e;case"right":return"right"==e;case"none":default:return!1}}}).directive("msTabScroll",e)}(),function(){"use strict";function e(m,u){return{scope:!0,require:"^msTimeline",compile:function(e){return e.addClass("ms-timeline-item").addClass("hidden"),function(e,t,n,a){var i=72,s=!1,o=!1,r=a.getScrollEl();!function(){t.find("ms-card")?e.$on("msCard::cardTemplateLoaded",function(e,n){var t=angular.element(n[0]);d(t).then(function(){m(function(){s=!0})})}):d(t).then(function(){m(function(){s=!0})});r.on("scroll",c),c()}();var l=e.$watch(function(){return s&&o},function(e,n){angular.equals(e,n)||e&&(t.removeClass("hidden").addClass("animate"),l())},!0);function d(e){var n=u.defer(),t=e.find("img");return 0<t.length?t.on("load",function(){n.resolve("Image is loaded")}):n.resolve("No images"),n.promise}function c(){r.scrollTop()+r.height()>t.position().top+i&&(m(function(){o=!0}),r.off("scroll",c))}}}}}e.$inject=["$timeout","$q"],angular.module("app.core").controller("MsTimelineController",function(){var n=this;n.scrollEl=void 0,n.setScrollEl=function(e){n.scrollEl=e},n.getScrollEl=function(){return n.scrollEl}}).directive("msTimeline",function(){return{scope:{msTimeline:"=?",loadMore:"&?msTimelineLoadMore"},controller:"MsTimelineController",compile:function(e){return e.addClass("ms-timeline"),function(e,n,t,a){var i=angular.element('<div class="ms-timeline-loader md-accent-bg md-whiteframe-4dp"><span class="spinner"></span></div>');n.append(i);var s={scrollEl:"#content"};s=angular.extend(s,e.msTimeline,{});var o=angular.element(s.scrollEl);a.setScrollEl(o);var r=144;function l(){o.scrollTop()+o.height()+r>i.position().top&&(i.addClass("show"),c(),e.loadMore&&e.loadMore().then(function(){i.removeClass("show"),d()},function(){i.remove()}))}function d(){o.on("scroll",l)}function c(){o.off("scroll",l)}d(),e.$on("$destroy",function(){c()})}}}}).directive("msTimelineItem",e)}(),function(){"use strict";function e(e,n,t,a,i){var r=this;function s(){!function(){r.millis=l().diff(moment(r.startingTime));var e=moment.duration(r.millis),n=e.seconds(),t=e.minutes(),a=e.hours(),i=e.days(),s=e.months(),o=e.years();r.seconds=n<10?"0"+n:n,r.minutes=t<10?"0"+t:t,r.hours=a<10?"0"+a:a,r.days=i<10?"0"+i:i,r.months=s<10?"0"+s:s,r.years=o<10?"0"+o:o,r.timer=0<r.days?r.days+"d ":r.hours+":"+r.minutes+":"+r.seconds}(),r.timeoutId=setTimeout(function(){s(),e.$digest()},r.interval)}function l(e){var n=(e||moment()).utcOffset(r.utcOffset).format("YYYY-MM-DD HH:mm:ss");return moment(n)}function o(){t.resolve().then(function(){return null===r.utcOffset||void 0===r.utcOffset?i.getUTCOffset():r.utcOffset}).then(function(e){return r.utcOffset=e,l()}).catch(function(e){throw e}).then(function(e){var n=r.startTime?moment(r.startTime):void 0;r.startTime?n.isAfter(e,"hour")||n.isBefore(e,"hour")?r.startingTime=l(n):r.startingTime=n:r.startingTime=e,s()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.getDate",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}o(),e.$watch("vm.startTime",function(e,n){angular.isUndefined(e)||0!==e.length&&(angular.equals(e,n)||o())}),e.$on("timer-start",function(){r.startTime=void 0,o()}),n.bind("$destroy",function(){r.timeoutId&&clearTimeout(r.timeoutId)})}e.$inject=["$scope","$element","$q","toasty","settingsManager"],angular.module("app.core").directive("timer",function(){return{restrict:"EA",replace:!1,scope:{startTime:"=?",interval:"=?",utcOffset:"=?"},template:"<span ng-cloak>{{ vm.timer }}</span>",compile:function(){return{pre:function(e,n,t){e.interval=t.interval||1e3}}},controller:e,controllerAs:"vm",bindToController:!0}})}(),function(){"use strict";angular.module("app.core").directive("msTimezone",function(){return{restrict:"E",scope:{ngModel:"=",ngChange:"&"},controller:["$scope",function(e){e.timezone=[{name:"Europe/Andorra",utcOffset:60,offsetStr:"+01:00",countries:["AD"]},{name:"Asia/Dubai",utcOffset:240,offsetStr:"+04:00",countries:["AE","OM"]},{name:"Asia/Kabul",utcOffset:270,offsetStr:"+04:30",countries:["AF"]},{name:"Europe/Tirane",utcOffset:60,offsetStr:"+01:00",countries:["AL"]},{name:"Asia/Yerevan",utcOffset:240,offsetStr:"+04:00",countries:["AM"]},{name:"Antarctica/Rothera",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},{name:"Antarctica/Palmer",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},{name:"Antarctica/Mawson",utcOffset:300,offsetStr:"+05:00",countries:["AQ"]},{name:"Antarctica/Davis",utcOffset:420,offsetStr:"+07:00",countries:["AQ"]},{name:"Antarctica/Casey",utcOffset:480,offsetStr:"+08:00",countries:["AQ"]},{name:"Antarctica/Vostok",utcOffset:360,offsetStr:"+06:00",countries:["AQ"]},{name:"Antarctica/DumontDUrville",utcOffset:600,offsetStr:"+10:00",countries:["AQ"]},{name:"Antarctica/Syowa",utcOffset:180,offsetStr:"+03:00",countries:["AQ"]},{name:"Antarctica/Troll",utcOffset:0,offsetStr:"+00:00",countries:["AQ"]},{name:"America/Argentina/Buenos_Aires",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Cordoba",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Salta",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Jujuy",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Tucuman",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Catamarca",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/La_Rioja",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/San_Juan",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Mendoza",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/San_Luis",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Rio_Gallegos",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Ushuaia",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"Pacific/Pago_Pago",utcOffset:-660,offsetStr:"-11:00",countries:["AS","UM"]},{name:"Europe/Vienna",utcOffset:60,offsetStr:"+01:00",countries:["AT"]},{name:"Australia/Lord_Howe",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Antarctica/Macquarie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Hobart",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Currie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Melbourne",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Sydney",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Broken_Hill",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},{name:"Australia/Brisbane",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},{name:"Australia/Lindeman",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},{name:"Australia/Adelaide",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},{name:"Australia/Darwin",utcOffset:570,offsetStr:"+09:30",countries:["AU"]},{name:"Australia/Perth",utcOffset:480,offsetStr:"+08:00",countries:["AU"]},{name:"Australia/Eucla",utcOffset:525,offsetStr:"+08:45",countries:["AU"]},{name:"Asia/Baku",utcOffset:240,offsetStr:"+04:00",countries:["AZ"]},{name:"America/Barbados",utcOffset:-240,offsetStr:"-04:00",countries:["BB"]},{name:"Asia/Dhaka",utcOffset:360,offsetStr:"+06:00",countries:["BD"]},{name:"Europe/Brussels",utcOffset:60,offsetStr:"+01:00",countries:["BE"]},{name:"Europe/Sofia",utcOffset:120,offsetStr:"+02:00",countries:["BG"]},{name:"Atlantic/Bermuda",utcOffset:-240,offsetStr:"-04:00",countries:["BM"]},{name:"Asia/Brunei",utcOffset:480,offsetStr:"+08:00",countries:["BN"]},{name:"America/La_Paz",utcOffset:-240,offsetStr:"-04:00",countries:["BO"]},{name:"America/Noronha",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},{name:"America/Belem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Fortaleza",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Recife",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Araguaina",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Maceio",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Bahia",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Sao_Paulo",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},{name:"America/Campo_Grande",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Cuiaba",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Santarem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Porto_Velho",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Boa_Vista",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Manaus",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Eirunepe",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},{name:"America/Rio_Branco",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},{name:"America/Nassau",utcOffset:-300,offsetStr:"-05:00",countries:["BS"]},{name:"Asia/Thimphu",utcOffset:360,offsetStr:"+06:00",countries:["BT"]},{name:"Europe/Minsk",utcOffset:180,offsetStr:"+03:00",countries:["BY"]},{name:"America/Belize",utcOffset:-360,offsetStr:"-06:00",countries:["BZ"]},{name:"America/St_Johns",utcOffset:-210,offsetStr:"-03:30",countries:["CA"]},{name:"America/Halifax",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Glace_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Moncton",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Goose_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Blanc-Sablon",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Toronto",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Nipigon",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Thunder_Bay",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Iqaluit",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Pangnirtung",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Resolute",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Atikokan",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Rankin_Inlet",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Winnipeg",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Rainy_River",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Regina",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Swift_Current",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Edmonton",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Cambridge_Bay",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Yellowknife",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Inuvik",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Creston",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Dawson_Creek",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Fort_Nelson",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Vancouver",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"America/Whitehorse",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"America/Dawson",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"Indian/Cocos",utcOffset:390,offsetStr:"+06:30",countries:["CC"]},{name:"Europe/Zurich",utcOffset:60,offsetStr:"+01:00",countries:["CH","DE","LI"]},{name:"Africa/Abidjan",utcOffset:0,offsetStr:"+00:00",countries:["CI","BF","GM","GN","ML","MR","SH","SL","SN","ST","TG"]},{name:"Pacific/Rarotonga",utcOffset:-600,offsetStr:"-10:00",countries:["CK"]},{name:"America/Santiago",utcOffset:-180,offsetStr:"-03:00",countries:["CL"]},{name:"Pacific/Easter",utcOffset:-300,offsetStr:"-05:00",countries:["CL"]},{name:"Asia/Shanghai",utcOffset:480,offsetStr:"+08:00",countries:["CN"]},{name:"Asia/Urumqi",utcOffset:360,offsetStr:"+06:00",countries:["CN"]},{name:"America/Bogota",utcOffset:-300,offsetStr:"-05:00",countries:["CO"]},{name:"America/Costa_Rica",utcOffset:-360,offsetStr:"-06:00",countries:["CR"]},{name:"America/Havana",utcOffset:-300,offsetStr:"-05:00",countries:["CU"]},{name:"Atlantic/Cape_Verde",utcOffset:-60,offsetStr:"-01:00",countries:["CV"]},{name:"America/Curacao",utcOffset:-240,offsetStr:"-04:00",countries:["CW","AW","BQ","SX"]},{name:"Indian/Christmas",utcOffset:420,offsetStr:"+07:00",countries:["CX"]},{name:"Asia/Nicosia",utcOffset:120,offsetStr:"+02:00",countries:["CY"]},{name:"Europe/Prague",utcOffset:60,offsetStr:"+01:00",countries:["CZ","SK"]},{name:"Europe/Berlin",utcOffset:60,offsetStr:"+01:00",countries:["DE"]},{name:"Europe/Copenhagen",utcOffset:60,offsetStr:"+01:00",countries:["DK"]},{name:"America/Santo_Domingo",utcOffset:-240,offsetStr:"-04:00",countries:["DO"]},{name:"Africa/Algiers",utcOffset:60,offsetStr:"+01:00",countries:["DZ"]},{name:"America/Guayaquil",utcOffset:-300,offsetStr:"-05:00",countries:["EC"]},{name:"Pacific/Galapagos",utcOffset:-360,offsetStr:"-06:00",countries:["EC"]},{name:"Europe/Tallinn",utcOffset:120,offsetStr:"+02:00",countries:["EE"]},{name:"Africa/Cairo",utcOffset:120,offsetStr:"+02:00",countries:["EG"]},{name:"Africa/El_Aaiun",utcOffset:0,offsetStr:"+00:00",countries:["EH"]},{name:"Europe/Madrid",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},{name:"Africa/Ceuta",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},{name:"Atlantic/Canary",utcOffset:0,offsetStr:"+00:00",countries:["ES"]},{name:"Europe/Helsinki",utcOffset:120,offsetStr:"+02:00",countries:["FI","AX"]},{name:"Pacific/Fiji",utcOffset:720,offsetStr:"+12:00",countries:["FJ"]},{name:"Atlantic/Stanley",utcOffset:-180,offsetStr:"-03:00",countries:["FK"]},{name:"Pacific/Chuuk",utcOffset:600,offsetStr:"+10:00",countries:["FM"]},{name:"Pacific/Pohnpei",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},{name:"Pacific/Kosrae",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},{name:"Atlantic/Faroe",utcOffset:0,offsetStr:"+00:00",countries:["FO"]},{name:"Europe/Paris",utcOffset:60,offsetStr:"+01:00",countries:["FR"]},{name:"Europe/London",utcOffset:0,offsetStr:"+00:00",countries:["GB","GG","IM","JE"]},{name:"Asia/Tbilisi",utcOffset:240,offsetStr:"+04:00",countries:["GE"]},{name:"America/Cayenne",utcOffset:-180,offsetStr:"-03:00",countries:["GF"]},{name:"Africa/Accra",utcOffset:0,offsetStr:"+00:00",countries:["GH"]},{name:"Europe/Gibraltar",utcOffset:60,offsetStr:"+01:00",countries:["GI"]},{name:"America/Godthab",utcOffset:-180,offsetStr:"-03:00",countries:["GL"]},{name:"America/Danmarkshavn",utcOffset:0,offsetStr:"+00:00",countries:["GL"]},{name:"America/Scoresbysund",utcOffset:-60,offsetStr:"-01:00",countries:["GL"]},{name:"America/Thule",utcOffset:-240,offsetStr:"-04:00",countries:["GL"]},{name:"Europe/Athens",utcOffset:120,offsetStr:"+02:00",countries:["GR"]},{name:"Atlantic/South_Georgia",utcOffset:-120,offsetStr:"-02:00",countries:["GS"]},{name:"America/Guatemala",utcOffset:-360,offsetStr:"-06:00",countries:["GT"]},{name:"Pacific/Guam",utcOffset:600,offsetStr:"+10:00",countries:["GU","MP"]},{name:"Africa/Bissau",utcOffset:0,offsetStr:"+00:00",countries:["GW"]},{name:"America/Guyana",utcOffset:-240,offsetStr:"-04:00",countries:["GY"]},{name:"Asia/Hong_Kong",utcOffset:480,offsetStr:"+08:00",countries:["HK"]},{name:"America/Tegucigalpa",utcOffset:-360,offsetStr:"-06:00",countries:["HN"]},{name:"America/Port-au-Prince",utcOffset:-300,offsetStr:"-05:00",countries:["HT"]},{name:"Europe/Budapest",utcOffset:60,offsetStr:"+01:00",countries:["HU"]},{name:"Asia/Jakarta",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},{name:"Asia/Pontianak",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},{name:"Asia/Makassar",utcOffset:480,offsetStr:"+08:00",countries:["ID"]},{name:"Asia/Jayapura",utcOffset:540,offsetStr:"+09:00",countries:["ID"]},{name:"Europe/Dublin",utcOffset:0,offsetStr:"+00:00",countries:["IE"]},{name:"Asia/Jerusalem",utcOffset:120,offsetStr:"+02:00",countries:["IL"]},{name:"Asia/Kolkata",utcOffset:330,offsetStr:"+05:30",countries:["IN"]},{name:"Indian/Chagos",utcOffset:360,offsetStr:"+06:00",countries:["IO"]},{name:"Asia/Baghdad",utcOffset:180,offsetStr:"+03:00",countries:["IQ"]},{name:"Asia/Tehran",utcOffset:210,offsetStr:"+03:30",countries:["IR"]},{name:"Atlantic/Reykjavik",utcOffset:0,offsetStr:"+00:00",countries:["IS"]},{name:"Europe/Rome",utcOffset:60,offsetStr:"+01:00",countries:["IT","SM","VA"]},{name:"America/Jamaica",utcOffset:-300,offsetStr:"-05:00",countries:["JM"]},{name:"Asia/Amman",utcOffset:120,offsetStr:"+02:00",countries:["JO"]},{name:"Asia/Tokyo",utcOffset:540,offsetStr:"+09:00",countries:["JP"]},{name:"Africa/Nairobi",utcOffset:180,offsetStr:"+03:00",countries:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},{name:"Asia/Bishkek",utcOffset:360,offsetStr:"+06:00",countries:["KG"]},{name:"Pacific/Tarawa",utcOffset:720,offsetStr:"+12:00",countries:["KI"]},{name:"Pacific/Enderbury",utcOffset:780,offsetStr:"+13:00",countries:["KI"]},{name:"Pacific/Kiritimati",utcOffset:840,offsetStr:"+14:00",countries:["KI"]},{name:"Asia/Pyongyang",utcOffset:510,offsetStr:"+08:30",countries:["KP"]},{name:"Asia/Seoul",utcOffset:540,offsetStr:"+09:00",countries:["KR"]},{name:"America/Cayman",utcOffset:-300,offsetStr:"-05:00",countries:["KY"]},{name:"Asia/Almaty",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},{name:"Asia/Qyzylorda",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},{name:"Asia/Aqtobe",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Aqtau",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Oral",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Beirut",utcOffset:120,offsetStr:"+02:00",countries:["LB"]},{name:"Asia/Colombo",utcOffset:330,offsetStr:"+05:30",countries:["LK"]},{name:"Africa/Monrovia",utcOffset:0,offsetStr:"+00:00",countries:["LR"]},{name:"Europe/Vilnius",utcOffset:120,offsetStr:"+02:00",countries:["LT"]},{name:"Europe/Luxembourg",utcOffset:60,offsetStr:"+01:00",countries:["LU"]},{name:"Europe/Riga",utcOffset:120,offsetStr:"+02:00",countries:["LV"]},{name:"Africa/Tripoli",utcOffset:120,offsetStr:"+02:00",countries:["LY"]},{name:"Africa/Casablanca",utcOffset:0,offsetStr:"+00:00",countries:["MA"]},{name:"Europe/Monaco",utcOffset:60,offsetStr:"+01:00",countries:["MC"]},{name:"Europe/Chisinau",utcOffset:120,offsetStr:"+02:00",countries:["MD"]},{name:"Pacific/Majuro",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},{name:"Pacific/Kwajalein",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},{name:"Asia/Rangoon",utcOffset:390,offsetStr:"+06:30",countries:["MM"]},{name:"Asia/Ulaanbaatar",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},{name:"Asia/Hovd",utcOffset:420,offsetStr:"+07:00",countries:["MN"]},{name:"Asia/Choibalsan",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},{name:"Asia/Macau",utcOffset:480,offsetStr:"+08:00",countries:["MO"]},{name:"America/Martinique",utcOffset:-240,offsetStr:"-04:00",countries:["MQ"]},{name:"Europe/Malta",utcOffset:60,offsetStr:"+01:00",countries:["MT"]},{name:"Indian/Mauritius",utcOffset:240,offsetStr:"+04:00",countries:["MU"]},{name:"Indian/Maldives",utcOffset:300,offsetStr:"+05:00",countries:["MV"]},{name:"America/Mexico_City",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Cancun",utcOffset:-300,offsetStr:"-05:00",countries:["MX"]},{name:"America/Merida",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Monterrey",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Matamoros",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Mazatlan",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Chihuahua",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Ojinaga",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Hermosillo",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Tijuana",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},{name:"America/Santa_Isabel",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},{name:"America/Bahia_Banderas",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"Asia/Kuala_Lumpur",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},{name:"Asia/Kuching",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},{name:"Africa/Maputo",utcOffset:120,offsetStr:"+02:00",countries:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},{name:"Africa/Windhoek",utcOffset:120,offsetStr:"+02:00",countries:["NA"]},{name:"Pacific/Noumea",utcOffset:660,offsetStr:"+11:00",countries:["NC"]},{name:"Pacific/Norfolk",utcOffset:660,offsetStr:"+11:00",countries:["NF"]},{name:"Africa/Lagos",utcOffset:60,offsetStr:"+01:00",countries:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},{name:"America/Managua",utcOffset:-360,offsetStr:"-06:00",countries:["NI"]},{name:"Europe/Amsterdam",utcOffset:60,offsetStr:"+01:00",countries:["NL"]},{name:"Europe/Oslo",utcOffset:60,offsetStr:"+01:00",countries:["NO","SJ"]},{name:"Asia/Kathmandu",utcOffset:345,offsetStr:"+05:45",countries:["NP"]},{name:"Pacific/Nauru",utcOffset:720,offsetStr:"+12:00",countries:["NR"]},{name:"Pacific/Niue",utcOffset:-660,offsetStr:"-11:00",countries:["NU"]},{name:"Pacific/Auckland",utcOffset:780,offsetStr:"+13:00",countries:["NZ","AQ"]},{name:"Pacific/Chatham",utcOffset:825,offsetStr:"+13:45",countries:["NZ"]},{name:"America/Panama",utcOffset:-300,offsetStr:"-05:00",countries:["PA"]},{name:"America/Lima",utcOffset:-300,offsetStr:"-05:00",countries:["PE"]},{name:"Pacific/Tahiti",utcOffset:-600,offsetStr:"-10:00",countries:["PF"]},{name:"Pacific/Marquesas",utcOffset:-570,offsetStr:"-09:30",countries:["PF"]},{name:"Pacific/Gambier",utcOffset:-540,offsetStr:"-09:00",countries:["PF"]},{name:"Pacific/Port_Moresby",utcOffset:600,offsetStr:"+10:00",countries:["PG"]},{name:"Pacific/Bougainville",utcOffset:660,offsetStr:"+11:00",countries:["PG"]},{name:"Asia/Manila",utcOffset:480,offsetStr:"+08:00",countries:["PH"]},{name:"Asia/Karachi",utcOffset:300,offsetStr:"+05:00",countries:["PK"]},{name:"Europe/Warsaw",utcOffset:60,offsetStr:"+01:00",countries:["PL"]},{name:"America/Miquelon",utcOffset:-180,offsetStr:"-03:00",countries:["PM"]},{name:"Pacific/Pitcairn",utcOffset:-480,offsetStr:"-08:00",countries:["PN"]},{name:"America/Puerto_Rico",utcOffset:-240,offsetStr:"-04:00",countries:["PR"]},{name:"Asia/Gaza",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},{name:"Asia/Hebron",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},{name:"Europe/Lisbon",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},{name:"Atlantic/Madeira",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},{name:"Atlantic/Azores",utcOffset:-60,offsetStr:"-01:00",countries:["PT"]},{name:"Pacific/Palau",utcOffset:540,offsetStr:"+09:00",countries:["PW"]},{name:"America/Asuncion",utcOffset:-180,offsetStr:"-03:00",countries:["PY"]},{name:"Asia/Qatar",utcOffset:180,offsetStr:"+03:00",countries:["QA","BH"]},{name:"Indian/Reunion",utcOffset:240,offsetStr:"+04:00",countries:["RE","TF"]},{name:"Europe/Bucharest",utcOffset:120,offsetStr:"+02:00",countries:["RO"]},{name:"Europe/Belgrade",utcOffset:60,offsetStr:"+01:00",countries:["RS","BA","HR","ME","MK","SI"]},{name:"Europe/Kaliningrad",utcOffset:120,offsetStr:"+02:00",countries:["RU"]},{name:"Europe/Moscow",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Simferopol",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Volgograd",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Samara",utcOffset:240,offsetStr:"+04:00",countries:["RU"]},{name:"Asia/Yekaterinburg",utcOffset:300,offsetStr:"+05:00",countries:["RU"]},{name:"Asia/Omsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},{name:"Asia/Novosibirsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},{name:"Asia/Novokuznetsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},{name:"Asia/Krasnoyarsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},{name:"Asia/Irkutsk",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},{name:"Asia/Chita",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},{name:"Asia/Yakutsk",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},{name:"Asia/Khandyga",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},{name:"Asia/Vladivostok",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Sakhalin",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Ust-Nera",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Magadan",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Srednekolymsk",utcOffset:660,offsetStr:"+11:00",countries:["RU"]},{name:"Asia/Kamchatka",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},{name:"Asia/Anadyr",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},{name:"Asia/Riyadh",utcOffset:180,offsetStr:"+03:00",countries:["SA","KW","YE"]},{name:"Pacific/Guadalcanal",utcOffset:660,offsetStr:"+11:00",countries:["SB"]},{name:"Indian/Mahe",utcOffset:240,offsetStr:"+04:00",countries:["SC"]},{name:"Africa/Khartoum",utcOffset:180,offsetStr:"+03:00",countries:["SD","SS"]},{name:"Europe/Stockholm",utcOffset:60,offsetStr:"+01:00",countries:["SE"]},{name:"Asia/Singapore",utcOffset:480,offsetStr:"+08:00",countries:["SG"]},{name:"America/Paramaribo",utcOffset:-180,offsetStr:"-03:00",countries:["SR"]},{name:"America/El_Salvador",utcOffset:-360,offsetStr:"-06:00",countries:["SV"]},{name:"Asia/Damascus",utcOffset:120,offsetStr:"+02:00",countries:["SY"]},{name:"America/Grand_Turk",utcOffset:-240,offsetStr:"-04:00",countries:["TC"]},{name:"Africa/Ndjamena",utcOffset:60,offsetStr:"+01:00",countries:["TD"]},{name:"Indian/Kerguelen",utcOffset:300,offsetStr:"+05:00",countries:["TF"]},{name:"Asia/Bangkok",utcOffset:420,offsetStr:"+07:00",countries:["TH","KH","LA","VN"]},{name:"Asia/Dushanbe",utcOffset:300,offsetStr:"+05:00",countries:["TJ"]},{name:"Pacific/Fakaofo",utcOffset:780,offsetStr:"+13:00",countries:["TK"]},{name:"Asia/Dili",utcOffset:540,offsetStr:"+09:00",countries:["TL"]},{name:"Asia/Ashgabat",utcOffset:300,offsetStr:"+05:00",countries:["TM"]},{name:"Africa/Tunis",utcOffset:60,offsetStr:"+01:00",countries:["TN"]},{name:"Pacific/Tongatapu",utcOffset:780,offsetStr:"+13:00",countries:["TO"]},{name:"Europe/Istanbul",utcOffset:120,offsetStr:"+02:00",countries:["TR"]},{name:"America/Port_of_Spain",utcOffset:-240,offsetStr:"-04:00",countries:["TT","AG","AI","BL","DM","GD","GP","KN","LC","MF","MS","VC","VG","VI"]},{name:"Pacific/Funafuti",utcOffset:720,offsetStr:"+12:00",countries:["TV"]},{name:"Asia/Taipei",utcOffset:480,offsetStr:"+08:00",countries:["TW"]},{name:"Europe/Kiev",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Europe/Uzhgorod",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Europe/Zaporozhye",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Pacific/Wake",utcOffset:720,offsetStr:"+12:00",countries:["UM"]},{name:"America/New_York",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Detroit",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Kentucky/Louisville",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Kentucky/Monticello",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Indianapolis",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Vincennes",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Winamac",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Marengo",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Petersburg",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Vevay",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Chicago",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Indiana/Tell_City",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Indiana/Knox",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Menominee",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/Center",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/New_Salem",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/Beulah",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Denver",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Boise",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Phoenix",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Los_Angeles",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},{name:"America/Metlakatla",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},{name:"America/Anchorage",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Juneau",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Sitka",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Yakutat",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Nome",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Adak",utcOffset:-600,offsetStr:"-10:00",countries:["US"]},{name:"Pacific/Honolulu",utcOffset:-600,offsetStr:"-10:00",countries:["US","UM"]},{name:"America/Montevideo",utcOffset:-180,offsetStr:"-03:00",countries:["UY"]},{name:"Asia/Samarkand",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},{name:"Asia/Tashkent",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},{name:"America/Caracas",utcOffset:-270,offsetStr:"-04:30",countries:["VE"]},{name:"Asia/Ho_Chi_Minh",utcOffset:420,offsetStr:"+07:00",countries:["VN"]},{name:"Pacific/Efate",utcOffset:660,offsetStr:"+11:00",countries:["VU"]},{name:"Pacific/Wallis",utcOffset:720,offsetStr:"+12:00",countries:["WF"]},{name:"Pacific/Apia",utcOffset:840,offsetStr:"+14:00",countries:["WS"]},{name:"Africa/Johannesburg",utcOffset:120,offsetStr:"+02:00",countries:["ZA","LS","SZ"]}]}],link:function(e,n,t,a){e.updateModel=function(e){a.$setViewValue(e)}},templateUrl:"app/core/directives/ms-timezone/ms-timezone.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsWidgetEngineCounterController",function(){var i=this;i.filter=[],i.filtered=!1,i.fontSize=20,i.label="",i.getCount=function(e){var n=0;if(e){i.fontSize=e.attrs[r]&&e.attrs[r].value?parseInt(e.attrs[r].value)-parseInt(e.attrs[r].value)%2:20;var t=e.attrs.find(function(e){return"attrChannel"===e.name});if(t||e.attrs.push({name:"attrChannel",value:"voice"}),"voice"!==e.attrs[l].value?"talking"===e.attrs[s].value?i.label="Opened":"answered"===e.attrs[s].value?i.label="Managed":i.label=e.attrs[s].value:i.label=e.attrs[s].value,e.attrs[l].value.toLowerCase().includes("voice")){e.attrs[o].value&&e.attrs[o].value.length?(i.filtered=!0,i.filter=_.intersection(e.voiceQueuesSelected,e.attrs[o].value)):(i.filtered=!1,i.filter=e.voiceQueuesSelected);for(var a=0;a<e.voiceQueues.rows.length;a+=1)_.includes(i.filter,e.voiceQueues.rows[a].id)&&(n+=e.voiceQueues.rows[a][e.attrs[s].value]?parseInt(e.voiceQueues.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("chat")){e.attrs[g].value&&e.attrs[g].value.length?(i.filtered=!0,i.filter=_.intersection(e.chatWebsitesSelected,e.attrs[g].value)):(i.filtered=!1,i.filter=e.chatWebsitesSelected);for(var a=0;a<e.chatWebsites.rows.length;a+=1)_.includes(i.filter,e.chatWebsites.rows[a].id)&&(n+=e.chatWebsites.rows[a][e.attrs[s].value]?parseInt(e.chatWebsites.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("fax")){e.attrs[c].value&&e.attrs[c].value.length?(i.filtered=!0,i.filter=_.intersection(e.faxAccountsSelected,e.attrs[c].value)):(i.filtered=!1,i.filter=e.faxAccountsSelected);for(var a=0;a<e.faxAccounts.rows.length;a+=1)_.includes(i.filter,e.faxAccounts.rows[a].id)&&(n+=e.faxAccounts.rows[a][e.attrs[s].value]?parseInt(e.faxAccounts.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("mail")){e.attrs[d].value&&e.attrs[d].value.length?(i.filtered=!0,i.filter=_.intersection(e.mailAccountsSelected,e.attrs[d].value)):(i.filtered=!1,i.filter=e.mailAccountsSelected);for(var a=0;a<e.mailAccounts.rows.length;a+=1)_.includes(i.filter,e.mailAccounts.rows[a].id)&&(n+=e.mailAccounts.rows[a][e.attrs[s].value]?parseInt(e.mailAccounts.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("openchannel")){e.attrs[u].value&&e.attrs[u].value.length?(i.filtered=!0,i.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[u].value)):(i.filtered=!1,i.filter=e.openchannelAccountsSelected);for(var a=0;a<e.openchannelAccounts.rows.length;a+=1)_.includes(i.filter,e.openchannelAccounts.rows[a].id)&&(n+=e.openchannelAccounts.rows[a][e.attrs[s].value]?parseInt(e.openchannelAccounts.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("whatsapp")){e.attrs[p].value&&e.attrs[p].value.length?(i.filtered=!0,i.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[p].value)):(i.filtered=!1,i.filter=e.whatsappAccountsSelected);for(var a=0;a<e.whatsappAccounts.rows.length;a+=1)_.includes(i.filter,e.whatsappAccounts.rows[a].id)&&(n+=e.whatsappAccounts.rows[a][e.attrs[s].value]?parseInt(e.whatsappAccounts.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("sms")){e.attrs[m].value&&e.attrs[m].value.length?(i.filtered=!0,i.filter=_.intersection(e.smsAccountsSelected,e.attrs[m].value)):(i.filtered=!1,i.filter=e.smsAccountsSelected);for(var a=0;a<e.smsAccounts.rows.length;a+=1)_.includes(i.filter,e.smsAccounts.rows[a].id)&&(n+=e.smsAccounts.rows[a][e.attrs[s].value]?parseInt(e.smsAccounts.rows[a][e.attrs[s].value]):0)}}return n};var s=0,o=1,r=2,l=3,d=4,c=5,m=6,u=7,p=8,g=9})}(),function(){"use strict";function e(r,e){var l=this;l.filter=[],l.filtered=!1,l.properties=[],l.multiBarChart={labels:["QUEUE_NAME"],series:["TOTAL"],data:[[50]],options:{responsive:!0,legend:{display:!0,fontColor:"#2196f3"},scales:{xAxes:[{gridLines:{display:!0},ticks:{fontColor:"#2196f3",stepSize:1,beginAtZero:!0}}],yAxes:[{gridLines:{display:!1},ticks:{fontColor:"#2196f3"}}]}}},l.getMultiBarChart=function(e){e&&(e.attrs&&function(e){switch(l.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[4].value){case"voice":e.attrs[3].value&&e.attrs[3].value.length?(l.filtered=!0,l.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(l.filtered=!1,l.filter=e.voiceQueuesSelected);break;case"sms":e.attrs[7].value&&e.attrs[7].value.length?(l.filtered=!0,l.filter=_.intersection(e.smsAccountsSelected,e.attrs[7].value)):(l.filtered=!1,l.filter=e.smsAccountsSelected);break;case"mail":e.attrs[5].value&&e.attrs[5].value.length?(l.filtered=!0,l.filter=_.intersection(e.mailAccountsSelected,e.attrs[5].value)):(l.filtered=!1,l.filter=e.mailAccountsSelected);break;case"chat":e.attrs[10].value&&e.attrs[10].value.length?(l.filtered=!0,l.filter=_.intersection(e.chatWebsitesSelected,e.attrs[10].value)):(l.filtered=!1,l.filter=e.chatWebsitesSelected);break;case"fax":e.attrs[6].value&&e.attrs[6].value.length?(l.filtered=!0,l.filter=_.intersection(e.faxAccountsSelected,e.attrs[6].value)):(l.filtered=!1,l.filter=e.faxAccountsSelected);break;case"openchannel":e.attrs[8].value&&e.attrs[8].value.length?(l.filtered=!0,l.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[8].value)):(l.filtered=!1,l.filter=e.openchannelAccountsSelected);break;case"whatsapp":e.attrs[9].value&&e.attrs[9].value.length?(l.filtered=!0,l.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[9].value)):(l.filtered=!1,l.filter=e.whatsappAccountsSelected);break;default:e.attrs[3].value&&e.attrs[3].value.length?(l.filtered=!0,l.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(l.filtered=!1,l.filter=e.voiceQueuesSelected)}if(l.multiBarChart.series.length>l.properties.length){var n=l.multiBarChart.series.length-l.properties.length;l.multiBarChart.series.splice(0,n),l.multiBarChart.data.splice(0,n)}for(var t=0;t<l.properties.length;t+=1){var a="";if(a="voice"!==e.attrs[4].value?"talking"===l.properties[t]?"Opened":"answered"===l.properties[t]?"Managed":l.properties[t]:l.properties[t],l.multiBarChart.series[t]=r.instant("TOOLS."+a.toUpperCase()),_.isNil(l.multiBarChart.data[t])&&(l.multiBarChart.data[t]=[]),l.multiBarChart.labels.length>l.filter.length){var i=l.multiBarChart.labels.length-l.filter.length;l.multiBarChart.labels.splice(0,i),l.multiBarChart.data[t].splice(0,i)}switch(e.attrs[4].value){case"voice":for(var s=0,o=0;s<e.voiceQueues.rows.length;s+=1)_.includes(l.filter,e.voiceQueues.rows[s].id)&&(l.multiBarChart.labels[o]=e.voiceQueues.rows[s].name,l.multiBarChart.data[t][o]=e.voiceQueues.rows[s][l.properties[t]]?parseInt(e.voiceQueues.rows[s][l.properties[t]]):0,o+=1);break;case"sms":for(var s=0,o=0;s<e.smsAccounts.rows.length;s+=1)_.includes(l.filter,e.smsAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.smsAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.smsAccounts.rows[s][l.properties[t]]?parseInt(e.smsAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"chat":for(var s=0,o=0;s<e.chatWebsites.rows.length;s+=1)_.includes(l.filter,e.chatWebsites.rows[s].id)&&(l.multiBarChart.labels[o]=e.chatWebsites.rows[s].name,l.multiBarChart.data[t][o]=e.chatWebsites.rows[s][l.properties[t]]?parseInt(e.chatWebsites.rows[s][l.properties[t]]):0,o+=1);break;case"fax":for(var s=0,o=0;s<e.faxAccounts.rows.length;s+=1)_.includes(l.filter,e.faxAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.faxAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.faxAccounts.rows[s][l.properties[t]]?parseInt(e.faxAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"mail":for(var s=0,o=0;s<e.mailAccounts.rows.length;s+=1)_.includes(l.filter,e.mailAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.mailAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.mailAccounts.rows[s][l.properties[t]]?parseInt(e.mailAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"openchannel":for(var s=0,o=0;s<e.openchannelAccounts.rows.length;s+=1)_.includes(l.filter,e.openchannelAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.openchannelAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.openchannelAccounts.rows[s][l.properties[t]]?parseInt(e.openchannelAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"whatsapp":for(var s=0,o=0;s<e.whatsappAccounts.rows.length;s+=1)_.includes(l.filter,e.whatsappAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.whatsappAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.whatsappAccounts.rows[s][l.properties[t]]?parseInt(e.whatsappAccounts.rows[s][l.properties[t]]):0,o+=1);break;default:for(var s=0,o=0;s<e.voiceQueues.rows.length;s+=1)_.includes(l.filter,e.voiceQueues.rows[s].id)&&(l.multiBarChart.labels[o]=e.voiceQueues.rows[s].name,l.multiBarChart.data[t][o]=e.voiceQueues.rows[s][l.properties[t]]?parseInt(e.voiceQueues.rows[s][l.properties[t]]):0,o+=1)}}}(e),e.foreground&&function(e){l.multiBarChart.options.legend.fontColor=e.foreground;for(var n=0;n<l.multiBarChart.options.scales.xAxes.length;n+=1)l.multiBarChart.options.scales.xAxes[n].ticks.fontColor=e.foreground;for(var t=0;t<l.multiBarChart.options.scales.yAxes.length;t+=1)l.multiBarChart.options.scales.yAxes[t].ticks.fontColor=e.foreground}(e))}}e.$inject=["$translate","socket"],angular.module("app.core").controller("MsWidgetEngineMultibarChartController",e)}(),function(){"use strict";function e(s){var o=this;o.filter=[],o.filtered=!1,o.properties=[],o.pieChart={labels:["ANSWERED"],data:[30],options:{responsive:!0,legend:{display:!0}}},o.getPieChart=function(e){e&&(e.attrs&&function(e){switch(o.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[4].value){case"voice":e.attrs[3].value&&e.attrs[3].value.length?(o.filtered=!0,o.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(o.filtered=!1,o.filter=e.voiceQueuesSelected);break;case"sms":e.attrs[7].value&&e.attrs[7].value.length?(o.filtered=!0,o.filter=_.intersection(e.smsAccountsSelected,e.attrs[7].value)):(o.filtered=!1,o.filter=e.smsAccountsSelected);break;case"mail":e.attrs[5].value&&e.attrs[5].value.length?(o.filtered=!0,o.filter=_.intersection(e.mailAccountsSelected,e.attrs[5].value)):(o.filtered=!1,o.filter=e.mailAccountsSelected);break;case"chat":e.attrs[10].value&&e.attrs[10].value.length?(o.filtered=!0,o.filter=_.intersection(e.chatWebsitesSelected,e.attrs[10].value)):(o.filtered=!1,o.filter=e.chatWebsitesSelected);break;case"fax":e.attrs[6].value&&e.attrs[6].value.length?(o.filtered=!0,o.filter=_.intersection(e.faxAccountsSelected,e.attrs[6].value)):(o.filtered=!1,o.filter=e.faxAccountsSelected);break;case"openchannel":e.attrs[8].value&&e.attrs[8].value.length?(o.filtered=!0,o.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[8].value)):(o.filtered=!1,o.filter=e.openchannelAccountsSelected);break;case"whatsapp":e.attrs[9].value&&e.attrs[9].value.length?(o.filtered=!0,o.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[9].value)):(o.filtered=!1,o.filter=e.whatsappAccountsSelected);break;default:e.attrs[3].value&&e.attrs[3].value.length?(o.filtered=!0,o.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(o.filtered=!1,o.filter=e.voiceQueuesSelected)}if(o.pieChart.labels.length>o.properties.length){var n=o.pieChart.labels.length-o.properties.length;o.pieChart.labels.splice(0,n),o.pieChart.data.splice(0,n)}for(var t=0,a=0;t<o.properties.length;t+=1){switch("voice"!==e.attrs[4].value?"talking"===o.properties[t]?o.pieChart.labels[t]=s.instant("TOOLS.OPENED"):"answered"===o.properties[t]?o.pieChart.labels[t]=s.instant("TOOLS.MANAGED"):o.pieChart.labels[t]=s.instant("TOOLS."+o.properties[t].toUpperCase()):o.pieChart.labels[t]=s.instant("TOOLS."+o.properties[t].toUpperCase()),e.attrs[4].value){case"voice":for(var i=0;i<e.voiceQueues.rows.length;i+=1)_.includes(o.filter,e.voiceQueues.rows[i].id)&&(a+=e.voiceQueues.rows[i][o.properties[t]]?parseInt(e.voiceQueues.rows[i][o.properties[t]]):0);break;case"sms":for(var i=0;i<e.smsAccounts.rows.length;i+=1)_.includes(o.filter,e.smsAccounts.rows[i].id)&&(a+=e.smsAccounts.rows[i][o.properties[t]]?parseInt(e.smsAccounts.rows[i][o.properties[t]]):0);break;case"chat":for(var i=0;i<e.chatWebsites.rows.length;i+=1)_.includes(o.filter,e.chatWebsites.rows[i].id)&&(a+=e.chatWebsites.rows[i][o.properties[t]]?parseInt(e.chatWebsites.rows[i][o.properties[t]]):0);break;case"fax":for(var i=0;i<e.faxAccounts.rows.length;i+=1)_.includes(o.filter,e.faxAccounts.rows[i].id)&&(a+=e.faxAccounts.rows[i][o.properties[t]]?parseInt(e.faxAccounts.rows[i][o.properties[t]]):0);break;case"mail":for(var i=0;i<e.mailAccounts.rows.length;i+=1)_.includes(o.filter,e.mailAccounts.rows[i].id)&&(a+=e.mailAccounts.rows[i][o.properties[t]]?parseInt(e.mailAccounts.rows[i][o.properties[t]]):0);break;case"openchannel":for(var i=0;i<e.openchannelAccounts.rows.length;i+=1)_.includes(o.filter,e.openchannelAccounts.rows[i].id)&&(a+=e.openchannelAccounts.rows[i][o.properties[t]]?parseInt(e.openchannelAccounts.rows[i][o.properties[t]]):0);break;case"whatsapp":for(var i=0;i<e.whatsappAccounts.rows.length;i+=1)_.includes(o.filter,e.whatsappAccounts.rows[i].id)&&(a+=e.whatsappAccounts.rows[i][o.properties[t]]?parseInt(e.whatsappAccounts.rows[i][o.properties[t]]):0);break;default:for(var i=0;i<e.voiceQueues.rows.length;i+=1)_.includes(o.filter,e.voiceQueues.rows[i].id)&&(a+=e.voiceQueues.rows[i][o.properties[t]]?parseInt(e.voiceQueues.rows[i][o.properties[t]]):0)}o.pieChart.data[t]=a,a=0}}(e),e.foreground&&(n=e,o.pieChart.options.legend.fontColor=n.foreground));var n}}e.$inject=["$translate"],angular.module("app.core").controller("MsWidgetEnginePieChartController",e)}(),function(){"use strict";function e(e,t,a,i){var s=this;function n(e){s.results=e||{count:0,rows:[]}}function o(){s.query.offset=(s.query.page-1)*s.query.limit,s.promise=i[s.reportRoute].run(s.query,n).$promise}s.countDown=0,s.refresh=0,s.title="",s.columns=[],s.results={rows:[],count:0},s.query={limit:10,page:1,startDate:moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),endDate:moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),output:"web"},s.onInit=function e(n){n&&n.attrs&&(n.attrs[0]&&n.attrs[0].value&&(s.query.id=n.attrs[0].value,i.analyticFieldReport.get({fields:"field,alias",nolimit:!0,DefaultReportId:"default"===n.attrs[0].type?n.attrs[0].value:void 0,CustomReportId:"custom"===n.attrs[0].type?n.attrs[0].value:void 0}).$promise.then(function(e){switch(e&&e.rows&&(s.columns=e.rows),n.attrs[0].type){case"default":s.reportRoute="analyticDefaultReport";break;case"custom":s.reportRoute="analyticCustomReport"}return i[s.reportRoute].get({id:n.attrs[0].value,fields:"id,name"}).$promise}).then(function(e){e&&e.name&&(s.title=e.name),o()}).catch(function(e){console.log(e)})),n.attrs[1]&&n.attrs[1].value&&(s.refresh=parseInt(n.attrs[1].value),!_.isNaN(s.refresh)&&0<s.refresh?(s.countDown=parseInt(n.attrs[1].value),s.interval=a(function(){s.countDown-=1},1e3,0),s.timeout=t(function(){s.interval&&a.cancel(s.interval),e(n)},1e3*s.refresh)):(s.interval&&a.cancel(s.interval),s.timeout&&t.cancel(s.timeout))))},s.getResults=o,s.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n},e.$on("$destroy",function(){s.interval&&a.cancel(s.interval),s.timeout&&t.cancel(s.timeout)})}e.$inject=["$scope","$timeout","$interval","api"],angular.module("app.core").controller("MsWidgetEngineWebReportController",e)}(),function(){"use strict";function e(e,n){this.getTrustedURL=function(e){return n.trustAsResourceUrl(e)}}function n(e){return{restrict:"E",scope:{config:"=?",onEdit:"&?",onDelete:"&?"},require:"msWidgetEngine",controller:"MsWidgetEngineController",controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-widget-engine/ms-widget-engine.html"}}e.$inject=["$mdDialog","$sce"],n.$inject=["$document"],angular.module("app.core").controller("MsWidgetEngineController",e).directive("msWidgetEngine",n)}(),function(){"use strict";function e(e,n){var t=this;t.flipped=!1,t.flip=function(){if(!angular.isDefined(e.flippable)||!0!==e.flippable)return;t.flipped=!t.flipped,n.toggleClass("flipped",t.flipped)}}e.$inject=["$scope","$element"],angular.module("app.core").controller("MsWidgetController",e).directive("msWidget",function(){return{restrict:"E",scope:{flippable:"=?"},controller:"MsWidgetController",transclude:!0,compile:function(e){return e.addClass("ms-widget"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)})}}}}).directive("msWidgetFront",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-front"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)}),e.flipWidget=a.flip}}}}).directive("msWidgetBack",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-back"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)}),e.flipWidget=a.flip}}}})}(),function(){"use strict";function e(s,n,o,r){return{restrict:"A",require:"?ngModel",link:function(t,a,e,i){o.isAdmin()||o.isTelephone()||(""!==e.privacy||o.getCurrentUser().privacyEnabled)&&!1!==t.$eval(e.privacy)&&(i?(i.$formatters.push(function(e){if(!e)return e;var n=r.mask(e);return i.$setViewValue(n),i.$render(),i.$viewValue}),i.$parsers.push(function(){return i.$modelValue}),a[0].disabled=!0):n(function(){s(a.contents())(t);var e=a.text();if(e){var n=r.mask(e);a.text(n)}}))}}}e.$inject=["$compile","$timeout","Auth","privacyManager"],angular.module("app.core").directive("privacy",e)}(),function(){"use strict";function e(d,c,t,h){function f(e,n){return"motion2.home."+e+":"+n}function b(e){return _.capitalize(e)+("chat"===e?"Website":"Account")+"Id"}function A(e){return"chat"===e?"Website":"Account"}function E(e,n,t){var a=f(n,t);h.set(a,e)}return{addAccount:function(r,e){var l=e.accounts,d=e.accountId,c=e.filters,m=e.query,u=e.userId,n="get"+_.capitalize(r)+("chat"===r?"Websites":"Accounts"),p=b(r),g=A(r),v=l.rows.length===m[p].length;return t.user[n]({id:u,nolimit:!0}).$promise.then(function(e){var n,t,a,i,s;if(l.rows=e.rows,l.count=e.count,_.find(c,["name",g]).options=l.rows,v){var o=(t=d,a=f(n=r,u),i=b(n),(s=h.get(a)).query&&s.query[i]&&s.query[i].push(t),s);o&&E(o,r,u),m[p].push(d)}return v})},removeAccount:function(t,e){var n=e.accounts,a=e.accountId,i=e.filters,s=e.query,o=e.userId,r=b(t),l=s[r].includes(a);return c.resolve().then(function(){var e=function(e,n,t){var a=f(e,n),i=b(e),s=h.get(a);if(s.query&&s.query[i]){var o=s.query[i].indexOf(t);-1<o&&s.query[i].splice(o,1)}return s}(t,o,a);e||(e=s),s[r]=e.query[r],_.remove(n.rows,function(e){return e.id===a}),n.count=n.rows.length,_.find(i,function(e){var n=A(t);return e.name===n}).options=n.rows,1===n.count&&(e.query[r]=[n.rows[0].id],s[r]=[n.rows[0].id]),E(e,t,o)}).then(function(){var e=A(t);d.$broadcast("ms-quick-filter:update",{filters:[e],update:l})})}}}e.$inject=["$rootScope","$q","api","localStorageManager"],angular.module("app.core").factory("agentAccountAssociationManager",e)}(),function(){"use strict";function e(o,r,i,l,d){var e={get:function(s,a){return o(function(n,t){0===a.offset&&(s=void 0);var e=_.merge({},a);i.cmContact.getJourney(e).$promise.then(function(e){var a,n=_(e.rows).uniqBy(function(e){return e.channel}).map("channel").value();return(a=n,o(function(e,n){var t=a.map(function(n){if("voice"!==n){var e="get"+_.startCase(n)+("chat"===n?"Websites":"Accounts");return i.user[e]({id:l.getCurrentUser().id,attributes:["id","name"],nolimit:!0}).$promise.then(function(e){c[n]=e.rows})}});return o.all(t).then(function(){e()}).catch(function(e){n(e)})})).then(function(){return e.rows.forEach(function(e){var n;e.canOpen=function(e){switch(e.channel){case"chat":return!!c.chat&&_.some(c.chat,["id",e.ChatWebsiteId]);case"fax":return!!c.fax&&_.some(c.fax,["id",e.FaxAccountId]);case"mail":return!!c.mail&&_.some(c.mail,["id",e.MailAccountId]);case"openchannel":return!!c.openchannel&&_.some(c.openchannel,["id",e.OpenchannelAccountId]);case"sms":return!!c.sms&&_.some(c.sms,["id",e.SmsAccountId]);case"voice":return!0;case"whatsapp":return!!c.whatsapp&&_.some(c.whatsapp,["id",e.WhatsappAccountId]);default:return!1}}(e),e.dispositionsValues=(n=e).disposition?"("+_.compact([n.disposition,n.secondDisposition,n.thirdDisposition]).join(" - ")+")":"("+r.instant("DASHBOARDS.NO_DISPOSITION_SET")+")",e.style=function(e){switch(e.channel){case"chat":return{color:"green-A700",icon:"icon-hangouts"};case"fax":return{color:"blue-grey-A200",icon:"icon-deskphone"};case"mail":return{color:"teal",icon:"icon-email"};case"openchannel":return{color:"amber-A200",icon:"icon-google-earth"};case"sms":return{color:"orange",icon:"icon-message-text"};case"voice":return{color:"blue-A700",icon:"icon-phone"};case"whatsapp":return{color:"lime-A700",icon:"icon-whatsapp"}}}(e)}),a=s,i=e,o(function(e,n){try{var t={journey:a?_.union(a,i.rows):i.rows};t.loadMore=0<i.count-t.journey.length,e(t)}catch(e){n(e)}});var a,i})}).then(function(e){n(e)}).catch(function(e){d.error({title:r.instant("CONTACTMANAGER.CUSTOMER_JOURNEY"),msg:r.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),t(e)})})},getQuery:function(){return{range:{from:moment().subtract(3,"M").startOf("month").format("YYYY-MM-DD HH:mm:ss"),to:moment().endOf("month").format("YYYY-MM-DD HH:mm:ss")},limit:10,offset:0}},getQuickFilters:function(){return[{name:"Channel",key:"channel",type:"select",label:"INTEGRATIONS.CHANNEL",customOptions:[{value:void 0,translate:"DASHBOARDS.ALL"},{value:"voice",translate:"DASHBOARDS.VOICE"},{value:"chat",translate:"DASHBOARDS.CHAT"},{value:"mail",translate:"DASHBOARDS.MAIL"},{value:"sms",translate:"DASHBOARDS.SMS"},{value:"fax",translate:"DASHBOARDS.FAX"},{value:"openchannel",translate:"DASHBOARDS.OPENCHANNEL"},{value:"whatsapp",translate:"DASHBOARDS.WHATSAPP"}]},{name:"Start Date",key:"range",type:"date",label:"DASHBOARDS.SELECT_DATE",useFromToKeys:!0}]}},c={};return e}e.$inject=["$q","$translate","api","Auth","toasty"],angular.module("app.core").factory("customerJourneyManager",e)}(),function(){"use strict";function e(p,e){var g={localizationMap:e,setSelectedDate:function(e){var n=e.$gte?new Date(moment.utc(e.$gte).format("YYYY-MM-DD")):new Date(moment.utc(e.from).format("YYYY-MM-DD")),t=e.$lte?new Date(moment.utc(e.$lte).format("YYYY-MM-DD")):new Date(moment.utc(e.to).format("YYYY-MM-DD")),a={dateStart:new Date(n.getFullYear(),n.getMonth(),n.getDate()),dateEnd:new Date(t.getFullYear(),t.getMonth(),t.getDate())};return a.selectedTemplateName=(i=a,moment(i.dateStart).isSame(i.dateEnd)?(u=i,moment().startOf("day").isSame(u.dateStart)?g.localizationMap.Today:(m=i,moment().subtract(1,"days").startOf("day").isSame(m.dateStart)?g.localizationMap.Yesterday:p("date")(i.dateStart,"dd MMM yyyy"))):(c=i,moment().startOf("isoWeek").isSame(c.dateStart,"day")&&moment().endOf("isoWeek").isSame(c.dateEnd,"day")?g.localizationMap["This Week"]:(d=i,moment().subtract(1,"weeks").startOf("isoWeek").isSame(d.dateStart,"day")&&moment().subtract(1,"weeks").endOf("isoWeek").isSame(d.dateEnd,"day")?g.localizationMap["Last Week"]:(l=i,moment().startOf("month").isSame(l.dateStart,"day")&&moment().endOf("month").isSame(l.dateEnd,"day")?g.localizationMap["This Month"]:(r=i,moment().subtract(1,"months").startOf("month").isSame(r.dateStart,"day")&&moment().subtract(1,"months").endOf("month").isSame(r.dateEnd,"day")?g.localizationMap["Last Month"]:(o=i,moment().startOf("year").isSame(o.dateStart,"day")&&moment().endOf("year").isSame(o.dateEnd,"day")?g.localizationMap["This Year"]:(s=i,moment().subtract(1,"years").startOf("year").isSame(s.dateStart,"day")&&moment().subtract(1,"years").endOf("year").isSame(s.dateEnd,"day")?g.localizationMap["Last Year"]:p("date")(i.dateStart,"dd"+(i.dateStart.getMonth()!==i.dateEnd.getMonth()||i.dateStart.getFullYear()!==i.dateEnd.getFullYear()?" MMM":"")+(i.dateStart.getFullYear()!==i.dateEnd.getFullYear()?" yyyy":""))+" - "+p("date")(i.dateEnd,"dd MMM yyyy")))))))),a;var i,s,o,r,l,d,c,m,u}};return g}e.$inject=["$filter","dateFilterLocalizationFactory"],angular.module("app.core").factory("dateRangeManager",e)}(),function(){"use strict";function e(t,a,e,n,i){var s={},o={},r="mail",l={};function d(){if(o=n.getCurrentUser(),e.localStorage.getItem("motion2.home:"+o.id)||(r="dashboard"),l=e.localStorage.getItem("motion2.home."+r+":"+o.id)){var a=JSON.parse(l);a.drafts?o.privacyEnabled&&Object.keys(a.drafts).forEach(function(e){var n=a.drafts[e].title,t=n.split(/-(.+)/)[1].trim();a.drafts[e].title=n.replace(t,i.mask(t))}):a.drafts={},l=a}else l={drafts:{}};return l.drafts}function c(){_.isEmpty(s.drafts)?delete l.drafts:l.drafts=s.drafts,e.localStorage.setItem("motion2.home."+r+":"+o.id,JSON.stringify(l))}return s.init=function(){s.drafts=d()},s.getByInteraction=function(n){return s.drafts=d(),_.find(_.values(s.drafts),function(e){return e.interaction&&e.interaction.id===n})},s.removeByInteraction=function(n){s.drafts=d();var e=_.find(_.values(s.drafts),function(e){return e.interaction&&e.interaction.id===n});e&&(delete s.drafts[e.id],c())},s.add=function(e){s.drafts=d();var n=a.instant("DASHBOARDS.UNTITLED");e.contact?n=e.contact.firstName||e.contact.email:_.isEmpty(e.message.subject)||(n=e.message.subject);var t={type:"draft",title:e.account.key+" - "+n,channel:e.channel,content:e.message,account:e.account,interaction:e.interaction,id:_.random(1e10),openedAt:new Date,saved:!1};s.drafts[t.id]=t,c()},s.update=function(e){s.drafts=d();var n=s.drafts[e.id];n&&(n.content=e.message,s.drafts[e.id]=n,c())},s.open=function(e){s.drafts=d();var n=s.drafts[e];n&&t.$broadcast("open"+_.startCase(r)+"Draft",n)},s.remove=function(e){s.drafts=d(),s.drafts[e]&&(delete s.drafts[e],c())},s}e.$inject=["$rootScope","$translate","$window","Auth","privacyManager"],angular.module("app.core").factory("draftManager",e)}(),function(){"use strict";function e(s){var o=[];return function(n,e){e||(e="global-exception");var t,a=s.get("ClientSideLoggingService").getLogger("global-exception"),i=o.findIndex(function(e){return e===n});-1<i?(t=i,o.splice(t,1)):(!function(e){if(100<=o.length){var n=o.length-100+1;o.splice(0,n)}o.push(e)}(n),a.error(e,n))}}e.$inject=["$injector"],angular.module("app.core").factory("$exceptionHandler",e)}(),function(){"use strict";function e(o,i){function r(e,n){var t=i.localStorage.getItem(e),a=t?JSON.parse(t):{};return n?a[n]:a}function s(e,n){return i.localStorage.setItem(e,JSON.stringify(n))}return{get:r,parseInteractionsKey:function(e,n,t,a){var i="motion2.home."+e+":"+t,s=_.capitalize(e)+("chat"===e?"Website":"Account")+"Id";return o.resolve().then(function(){var e=r(i,"query");return e?((n=_.merge(n,e)).sort&&0<=n.sort.indexOf("lastMessage")&&(n=_.omit(n,"sort")),n.includeAll=!0):n.createdAt={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()},1===a.length?n[s]=[a[0].id]:0===a.length&&(n[s]=[]),n}).catch(function(e){throw e})},set:s,update:function(e,n,t){var a=r(e);t?a[t]=n:a=n;return s(e,a)}}}e.$inject=["$q","$window"],angular.module("app.core").factory("localStorageManager",e)}(),function(){"use strict";function e(i){function s(e,n){var t=i.get(),a=0;if(t)switch(n){case"email":a=t.privacyPolicyEmail;break;case"number":a=t.privacyPolicyNumber;break;default:a=t.privacyPolicyName}return _.isNil(a)?e:0===a||a>e.length?e.replace(/./g,"*"):e.substring(0,e.length-a).padEnd(e.length,"*")}function o(e){return _.startsWith(e,"<")&&_.endsWith(e,">")&&(e=e.substring(1,e.length-1)),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function r(e){if(_.startsWith(e,"<")&&_.endsWith(e,">")){var n=!0;e=e.substring(1,e.length-1)}var t=e.split("@")[0],a=e.split("@")[1],i="";return n&&(i+="<"),i+=s(t,"email"),i+="@",i+=s(a,"email"),n&&(i+=">"),i}return{mask:function n(e){t=e,e=t.replace(/\s\s+/g," ").trim();var t;{if(o(e))return r(e);if(/^[+]?[0-9|.|\-|\s]*$/.test(e))return s(e,"number");var a=[],i=e.split(" ");return 1===i.length?s(e):(i.forEach(function(e){a.push(n(e))}),a.join(" "))}}}}e.$inject=["settingsManager"],angular.module("app.core").factory("privacyManager",e)}(),function(){"use strict";function e(n,i){return{setPlaceholder:function(a){var e;return n(function(n){try{if(_.isEmpty(a.resources))e=i.instant("DASHBOARDS.NONE");else if(_.isEmpty(a.param))e=a.placeholder?i.instant(a.placeholder):i.instant("DASHBOARDS.CHOOSE");else if(a.param.length===a.resources.length)e=i.instant("DASHBOARDS.ALL");else{var t=a.ngValue||"id";e=_(a.resources).filter(function(e){return _.includes(a.param,e[t])}).map("name").value().join(", ")}n(e)}catch(e){n(null)}})}}}e.$inject=["$q","$translate"],angular.module("app.core").factory("quickFilterManager",e)}(),function(){"use strict";function e(h,f){var s=["available","loggedIn","paused","waiting"],o=["busy","inUse","invalid","loggedInDb","notInUse","onHold","ringing","ringInUse","talking","unavailable","unknown"],r=["pTalking","originated","message","statusMessage","dialActive","dialMethod","Trunk","startPredictive","startProgressive","erlangCalls","erlangCallToSecond","erlangAbandonmentRate","erlangBusyFactor","dialPredictiveInterval","dialPredictiveIntervalMaxThreshold","dialPredictiveIntervalMinThreshold","predictiveIntervalAvailable","predictiveIntervalTotalCalls","predictiveIntervalAnsweredCalls","predictiveIntervalDroppedCallsTimeout","predictiveIntervalDroppedCallsCallersExit","predictiveIntervalAvgHoldtime","predictiveIntervalAvgTalktime"],n=["idle","unknown","unavailable","ringing"];function t(e,n){var t=[e.chatPause,e.faxPause,e.mailPause,e.openchannelPause,e.smsPause,e.voicePause,e.whatsappPause];if(!n)return _.every(t);var a=_.filter(t);return 0<a.length&&a.length<t.length}function a(e){return!!_.isNil(e)||_.includes(n,e)}function b(e){var n;return t(e,!1)?"pause":t(e,!0)?"*pause":("idle"!==(n=e).voiceStatus&&n.voicePause?n.voiceStatus="pause":!_.every([n.chatStatus,n.faxStatus,n.mailStatus,n.openchannelStatus,n.smsStatus,n.voiceStatus,n.whatsappStatus],a))?"busy":"idle"}function A(){return moment().set("year","0000").format()}return{INCOMING_CALL_STATUS_STYLES:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},OUTGOING_CALL_STATUS_STYLES:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},STATES_STYLES:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},STATUS_STYLES:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},paginateAgents:function(e,n,t){var a={count:0,rows:[]},i=e.filter(function(e){return e.online});if(i.forEach(function(e){var n,t,a;e.globalStatus=b(e),n=e,f.getChannels().forEach(function(e){n[e+"Pause"]&&"idle"===n[e+"Status"]&&(n[e+"Status"]="pause")}),e.globalStatusDisplayValue=(a=(t=e).globalStatus,"pause"===t.globalStatus?a=t.pauseType||h.instant("VOICE.DEFAULT_PAUSE"):"*pause"===t.globalStatus&&(a="*"+(t.pauseType||h.instant("VOICE.DEFAULT_PAUSE"))),a)}),0<t.globalQueueFilter.length){var s=n.filter(function(e){return t.globalQueueFilter.includes(e.id)}),o=_.uniq(s.flatMap(function(e){return _.map(e.Agents,"id")}));i=i.filter(function(e){return o.includes(e.id)})}if(t.globalStatusFilter&&(i=i.filter(function(e){var n=e.globalStatus===t.globalStatusFilter;return"pause"===e.globalStatus&&t.pauseTypeFilter&&(n=e.pauseType===t.pauseTypeFilter),n})),t.filter){var r=t.filter.toLowerCase();i=i.filter(function(e){return(e.fullname+" "+e.internal).toLowerCase().includes(r)})}var l,d,c,m,u="-"===t.sort[0]?"DESC":"ASC",p="DESC"===u?t.sort.substring(1):t.sort;l=i,c=u,i="globalStatus"===(d=p)?(m=c,l.sort(function(e,n){return e.globalStatus===n.globalStatus?"pause"===e.globalStatus?"DESC"===m?(e.pauseType||"")<(n.pauseType||"")||e.fullname.toLowerCase()>n.fullname.toLowerCase()?1:-1:(e.pauseType||"")<(n.pauseType||"")||e.fullname.toLowerCase()>n.fullname.toLowerCase()?-1:1:"DESC"===m?e.fullname.toLowerCase()<n.fullname.toLowerCase()?1:-1:e.fullname.toLowerCase()<n.fullname.toLowerCase()?-1:1:"DESC"===m?e.globalStatus<n.globalStatus?1:-1:e.globalStatus<n.globalStatus?-1:1})):l.sort(function(e,n){var t=e[d],a=n[d];return"fullname"===d?(t=e[d].toLowerCase(),a=n[d].toLowerCase()):"lastPauseAt"===d&&(t=e.globalStatus.includes("pause")?e[d]:A(),a=n.globalStatus.includes("pause")?n[d]:A()),"DESC"===c?t<a?1:-1:t<a?-1:1}),a.count=i.length;var g=t.offset||0,v=g+t.limit;return a.rows=i.slice(g,v),a},updateQueue:function(e,n){var t=!!n.type,a=s;"inbound"===n.type?a=a.concat(o):"outbound"===n.type&&(a=a.concat(o,r));var i=_.pick(e,a);_.merge(n,i),t&&0<n.ringing&&n.available<n.loggedIn&&(n.available+=n.ringing)}}}e.$inject=["$translate","msUtils"],angular.module("app.core").factory("realtimeManager",e)}(),function(){"use strict";function e(e,n){var t={get:function(){return a},getUTCOffset:function(){return null===i?n.setting.getDate().$promise.then(function(e){return i=e.offset}):e.resolve(i)},set:function(e){e&&(a=e.toJSON())}},a={},i=null;return t}e.$inject=["$q","api"],angular.module("app.core").factory("settingsManager",e)}(),function(){"use strict";function e(c,m){function u(e,n,t){if(_.isEmpty(n))return t;for(var a=0;a<n.length;a++){var i=n[a].key,s=_.find(e,function(e){return e[i]===n[a].value});s&&(_.some(t,["id",s.id])||(s.canSelect=!1,t.push(s)))}return t}return{getResources:function(a,i,s,o,r,l,d){return c(function(t,n){o||(o={}),d||(d="get"),a[s][d](o).$promise.then(function(e){var t=e.rows;if("admin"===i.role)return t;var n=m.getSectionId(s,l);return a.userProfileSection.get({userProfileId:i.userProfileId,sectionId:n}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?t:a.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(t,{id:e.resourceId})});return u(t,r,n)}):c.resolve().then(function(){return e=s,_.includes(["voiceContext"],e)?(o.defaultEntry=1,a[s][d](o).$promise.then(function(e){return e.rows})):[];var e}).then(function(e){return u(t,r,e)})})}).then(function(e){var n={rows:_.orderBy(e,[o.sort]),count:e.length};t(n)}).catch(function(e){n(e)})})}}}e.$inject=["$q","msNavigationService"],angular.module("app.core").factory("userProfileManager",e)}(),function(){"use strict";angular.module("app.core").filter("altDate",function(){return function(e){var n=Date.now()-new Date(e);return n<36e5?moment(e).fromNow():n<864e5?moment(e).format("HH:mm"):n<6048e5?moment(e).format("dddd"):moment(e).calendar()}})}(),function(){"use strict";function e(n){return function(e){return n.trustAsHtml(e)}}e.$inject=["$sce"],angular.module("app.core").filter("toTrusted",e).filter("htmlToPlaintext",function(){return function(e){return String(e).replace(/<[^>]+>/gm,"")}}).filter("nospace",function(){return function(e){return e?e.replace(/ /g,""):""}}).filter("humanizeDoc",function(){return function(e){if(e)return"directive"===e.type?e.name.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):e.label||e.name}})}(),function(){"use strict";angular.module("app.core").filter("capitalize",function(){return function(e){return e?_.capitalize(e):""}})}(),function(){"use strict";angular.module("app.core").filter("filterByIds",function(){return function(e,n){if(0===e.length||!n)return e;if(0===n.length)return[];for(var t=[],a=0;a<e.length;a++){for(var i=e[a],s=!1,o=0;o<n.length;o++){var r=n[o];if(i.id===r){s=!0;break}}s&&t.push(i)}return t}})}(),function(){"use strict";angular.module("app.core").filter("filterByPropIds",function(){return function(e,n,t){if(0===e.length||!t||0===t.length)return e;for(var a=[],i=0;i<e.length;i++){for(var s=e[i],o=!1,r=0;r<t.length;r++){var l=t[r];if(-1<s[n].indexOf(l)){o=!0;break}}o&&a.push(s)}return a}})}(),function(){"use strict";angular.module("app.core").filter("getOptionByValue",function(){return function(n,e,t){if(void 0===n)return"";if(!e)return"";t||(t="option");var a=_.find(e,function(e){return e.value==n});return a?a[t]:""}})}(),function(){"use strict";angular.module("app.core").filter("orderByDate",function(){return function(e){var n=[];return angular.forEach(e,function(e){n.push(e)}),n.sort(function(e,n){return e.hasOwnProperty("openedAt")&&n.hasOwnProperty("openedAt")?e.openedAt>n.openedAt?1:-1:1}),n}})}(),function(){"use strict";angular.module("app.core").filter("secToTime",function(){return function(e){e&&(e=e.toString().replace(",",""));var n=Math.floor(e/86400),t=e%86400,a=new Date(1e3*t).toISOString().substring(11,19);return a.replace(/^(\d+)/,function(e){return(""+(Number(e)+24*n)).padStart(2,"0")})}})}(),function(){"use strict";angular.module("app.core").filter("snakecase",function(){return function(e){return e?_.snakeCase(e):""}})}(),function(){"use strict";angular.module("app.core").filter("startcase",function(){return function(e){return e?_.startCase(e):""}})}(),function(){"use strict";angular.module("app.core").filter("filterByTags",function(){return function(e,t){if(0===e.length||0===t.length)return e;var a=[];return e.forEach(function(e){var n=t.every(function(n){var t=!1;return e.tags.forEach(function(e){e.name!==n.name||(t=!0)}),t});n&&a.push(e)}),a}}).filter("filterSingleByTags",function(){return function(e,n){if(0!==e.length&&0!==n.length){if(e.length<n.length)return[];var t=[],a=n.every(function(n){var t=!1;return e.forEach(function(e){e.name!==n.name||(t=!0)}),t});return a&&t.push(e),t}}})}(),function(){"use strict";angular.module("app.core").filter("toInteger",function(){return function(e){if(e&&"string"==typeof e)return parseInt(e)}})}(),function(){"use strict";function m(e,n,t,a){this.id=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),this.title=e,this.body=n,this.accept=t,this.reject=a,this.close=i}function u(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function i(){var t=this;navigator.serviceWorker.ready.then(function(e){e.getNotifications().then(function(e){var n=_.find(e,function(e){return e.data.id===t.id});n&&n.close()})})}angular.module("app.dashboards").provider("motNotification",function(){return{$get:[function(){var d,t,c=[];"serviceWorker"in navigator&&u()?navigator.serviceWorker.register("notification.js").then(function(e){(d=e).update(),d.installing?t=d.installing:d.waiting?t=d.waiting:d.active&&(t=d.active)}).catch(function(e){console.error("Service worker registration failed",e)}):console.error("Service Worker is not supported");return navigator.serviceWorker.addEventListener("message",function(e){if(e.source===t){var n=_.find(c,{id:e.data.id});if(n)switch(e.data.action){case"accept":n.accept&&n.accept();break;case"reject":n.reject&&n.reject()}}}),{create:function(e,i,s,o,r,l){return new Promise(function(t,n){var a;u()&&(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)?(a=new m(e||"MyTitle",i||"MyBody",o,r),c.push(a),a?window.Notification.requestPermission().then(function(e){if("granted"===e)return d.showNotification(a.title,{body:a.body,requireInteraction:!0,icon:s||"assets/images/business/queueCampaigns.jpg",data:{id:a.id},actions:[{action:"accept",title:"Accept"},{action:"reject",title:"Reject"}]})}).then(function(e){if(l){for(var n=0;n<c.length;n++)c[n].close();t()}else t(a)}).catch(function(e){n(e)}):n(new Error("Notification creating error"))):t()})}}}]}})}(),function(){"use strict";function e(l,d,c){return{resolve:function(e,n){var t=e.split("@"),a=t[0],i=t[1],s=n||{};if(!a||!i)return d.error("apiResolver.resolve requires correct action parameter (ResourceName@methodName)"),!1;var o=l.defer(),r=function(e){for(var n=e.split("."),t=c,a=0;a<n.length;a++){if(angular.isUndefined(t[n[a]])){d.error('Resource part "'+n[a]+'" is not defined!'),t=!1;break}t=t[n[a]]}return t||!1}(a);r?r[i](s,function(e){o.resolve(e)},function(e){o.reject(e)}):(d.error('Resource "'+a+'" is not defined in the api service!'),o.reject('Resource "'+a+'" is not defined in the api service!'));return o.promise}}}e.$inject=["$q","$log","api"],angular.module("app.core").factory("apiResolver",e)}(),function(){"use strict";function e(e){return{showLoadingIndicator:function(){e.loadingProgress=!0},hideLoadingIndicator:function(){e.loadingProgress=!1}}}e.$inject=["$rootScope"],angular.module("app.core").factory("LoadingIndicatorService",e)}(),function(){"use strict";angular.module("app.core").provider("msApi",function(){var t=angular.injector(["ng"]).get("$log"),a="",v=[];function n(e){a=e}function i(){return a}function s(e,n){angular.isString(e)?angular.isArray(n)?v[e]={url:a+(n[0]||""),paramDefaults:n[1]||[],actions:n[2]||[],options:n[3]||{}}:t.error('"resource" must be an array and it must follow $resource definition'):t.error('"path" must be a string (eg. `dashboard.project`)')}this.setBaseUrl=n,this.getBaseUrl=i,this.getApiObject=function(){return v},this.register=s,this.$get=["$log","$q","$resource","$rootScope",function(m,u,p,g){var e={setBaseUrl:n,getBaseUrl:i,register:s,resolve:function(e,n){g.$broadcast("msApi::resolveStart");var t=e.split("@"),a=t[0],i=t[1],s=n||{};if(!a||!i)return m.error("msApi.resolve requires correct action parameter (resourceName@methodName)"),!1;var o=u.defer(),r=v[a];if(r){var l=p(r.url,r.paramDefaults,r.actions,r.options);l[i](s,function(e){o.resolve(e),g.$broadcast("msApi::resolveSuccess")},function(e){o.reject(e),g.$broadcast("msApi::resolveError")})}else m.error('Resource "'+a+'" is not defined in the api service!'),o.reject('Resource "'+a+'" is not defined in the api service!');return o.promise},request:function(e,n,t,a){g.$broadcast("msApi::requestStart");var i=e.split("@"),s=i[0],o=i[1],r=n||{};if(!s||!o)return m.error("msApi.resolve requires correct action parameter (resourceName@methodName)"),!1;var l=u.defer(),d=v[s];if(d){var c=p(d.url,d.paramDefaults,d.actions,d.options);c[o](r,function(e){g.$broadcast("msApi::requestSuccess"),l.resolve(e),angular.isDefined(t)&&angular.isFunction(t)&&t(e)},function(e){g.$broadcast("msApi::requestError"),l.reject(e),angular.isDefined(a)&&angular.isFunction(a)&&a(e)})}else m.error('Resource "'+s+'" is not defined in the api service!'),l.reject('Resource "'+s+'" is not defined in the api service!');return l.promise}};return e}]})}(),function(){"use strict";function e(l){var e=new MobileDetect(l.navigator.userAgent),d=null;return{exists:function(e,n){return-1<n.indexOf(e)},detectBrowser:function(){if(d)return d;var e=[{string:l.navigator.userAgent,subString:"Edge",versionSearch:"Edge",identity:"Edge"},{string:l.navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:l.navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:l.navigator.vendor,subString:"Apple",versionSearch:"Version",identity:"Safari"},{prop:l.opera,identity:"Opera"},{string:l.navigator.vendor,subString:"iCab",identity:"iCab"},{string:l.navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:l.navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:l.navigator.vendor,subString:"Camino",identity:"Camino"},{string:l.navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:l.navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:l.navigator.userAgent,subString:"Trident/7",identity:"Explorer",versionSearch:"rv"},{string:l.navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:l.navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],n=[{string:l.navigator.platform,subString:"Win",identity:"Windows"},{string:l.navigator.platform,subString:"Mac",identity:"Mac"},{string:l.navigator.platform,subString:"Linux",identity:"Linux"},{string:l.navigator.platform,subString:"iPhone",identity:"iPhone"},{string:l.navigator.platform,subString:"iPod",identity:"iPod"},{string:l.navigator.platform,subString:"iPad",identity:"iPad"},{string:l.navigator.platform,subString:"Android",identity:"Android"}],i="";function t(e){for(var n=0;n<e.length;n++){var t=e[n].string,a=e[n].prop;if(i=e[n].versionSearch||e[n].identity,t){if(-1!==t.indexOf(e[n].subString))return e[n].identity}else if(a)return e[n].identity}}function a(e){var n=e.indexOf(i);if(-1!==n)return parseInt(e.substring(n+i.length+1))}var s=t(e)||"unknown-browser",o=a(l.navigator.userAgent)||a(l.navigator.appVersion)||"unknown-version",r=t(n)||"unknown-os";return s=s.toLowerCase(),o=s+"-"+o,r=r.toLowerCase(),d={browser:s,version:o,os:r}},getChannels:function(){return["chat","fax","mail","openchannel","sms","voice","whatsapp"]},guidGenerator:function(){var e=function(){return(65536*(1+Math.random())||0).toString(16).substring(1)};return e()+e()+e()+e()+e()+e()},isMobile:function(){return e.mobile()},toggleInArray:function(e,n){-1===n.indexOf(e)?n.push(e):n.splice(n.indexOf(e),1)},firstLastDayMonth:function(){return{$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()}},getEmailProviders:function(){return[{name:"Custom",value:"custom"},{name:"Gmail",value:"gmail"},{name:"Hotmail",value:"hotmail"},{name:"Yahoo",value:"yahoo"},{name:"Outlook365",value:"outlook365"}]}}}e.$inject=["$window"],angular.module("app.core").factory("msUtils",e)}(),function(){"use strict";function e(e,n){var t=this;t.themes=n.themes,t.layoutModes=[{label:"Boxed",value:"boxed"},{label:"Wide",value:"wide"}],t.layoutStyles=[{label:"Vertical Navigation",value:"verticalNavigation",figure:"/assets/images/theme-options/vertical-nav.jpg"},{label:"Vertical Navigation with Fullwidth Toolbar",value:"verticalNavigationFullwidthToolbar",figure:"/assets/images/theme-options/vertical-nav-with-full-toolbar.jpg"},{label:"Vertical Navigation with Fullwidth Toolbar 2",value:"verticalNavigationFullwidthToolbar2",figure:"/assets/images/theme-options/vertical-nav-with-full-toolbar-2.jpg"},{label:"Horizontal Navigation",value:"horizontalNavigation",figure:"/assets/images/theme-options/horizontal-nav.jpg"},{label:"Content with Toolbar",value:"contentWithToolbar",figure:"/assets/images/theme-options/content-with-toolbar.jpg"},{label:"Content Only",value:"contentOnly",figure:"/assets/images/theme-options/content-only.jpg"}],t.layoutMode="wide",t.layoutStyle=e.get("motion.layoutStyle")||"verticalNavigation",t.setActiveTheme=function(e){n.setActiveTheme(e)},t.getActiveTheme=function(){return n.themes.active},t.updateLayoutMode=function(){angular.element("body").toggleClass("boxed","boxed"===t.layoutMode)},t.updateLayoutStyle=function(){e.put("motion.layoutStyle",t.layoutStyle),location.reload()}}function n(n){return{restrict:"E",scope:{},controller:"MsThemeOptionsController as vm",templateUrl:"app/core/theme-options/theme-options.html",compile:function(e){return e.addClass("ms-theme-options"),function(e){e.toggleOptionsSidenav=function(){n("motion-theme-options").toggle()}}}}}e.$inject=["$cookies","motionTheming"],n.$inject=["$mdSidenav"],angular.module("app.core").controller("MsThemeOptionsController",e).directive("msThemeOptions",n)}(),function(){"use strict";function e(i,a,s){var o={};return{generate:function(){var e=angular.copy(s.getRegisteredThemes()),a=angular.copy(s.getRegisteredPalettes());angular.forEach(e,function(t){o[t.name]={},angular.forEach(t.colors,function(e,n){o[t.name][n]={name:e.name,levels:{default:{color:l(a[e.name][e.hues.default].value),contrast1:l(a[e.name][e.hues.default].contrast,1),contrast2:l(a[e.name][e.hues.default].contrast,2),contrast3:l(a[e.name][e.hues.default].contrast,3),contrast4:l(a[e.name][e.hues.default].contrast,4)},hue1:{color:l(a[e.name][e.hues["hue-1"]].value),contrast1:l(a[e.name][e.hues["hue-1"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-1"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-1"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-1"]].contrast,4)},hue2:{color:l(a[e.name][e.hues["hue-2"]].value),contrast1:l(a[e.name][e.hues["hue-2"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-2"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-2"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-2"]].contrast,4)},hue3:{color:l(a[e.name][e.hues["hue-3"]].value),contrast1:l(a[e.name][e.hues["hue-3"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-3"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-3"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-3"]].contrast,4)}}}})}),function(e){var n=angular.copy(e);angular.forEach(n,function(t){angular.forEach(t,function(e,n){t[n]=e.levels,t[n].color=e.levels.default.color,t[n].contrast1=e.levels.default.contrast1,t[n].contrast2=e.levels.default.contrast2,t[n].contrast3=e.levels.default.contrast3,t[n].contrast4=e.levels.default.contrast4,delete t[n].default})}),s.setThemesList(n);var t=i.get("motion.selectedTheme");t?s.setActiveTheme(t):s.setActiveTheme("default")}(o);var r={};angular.forEach(o,function(e,n){var t,a,i,s,o;(r={})["@themeName"]=n,angular.forEach(e,function(e,a){angular.forEach(e.levels,function(e,t){angular.forEach(e,function(e,n){r["@"+a+d(t)+d(n)]=e})})}),t=r,a=new RegExp(Object.keys(t).join("|"),"gi"),i='/* Content hack because they wont fix */\n/* https://github.com/angular/material/pull/8067 */\n[md-theme="@themeName"] md-content.md-hue-1,\nmd-content.md-@themeName-theme.md-hue-1 {\n    color: @backgroundHue1Contrast1;\n    background-color: @backgroundHue1Color;\n}\n\n[md-theme="@themeName"] md-content.md-hue-2,\nmd-content.md-@themeName-theme.md-hue-2 {\n    color: @backgroundHue2Contrast1;\n    background-color: @backgroundHue2Color;\n}\n\n[md-theme="@themeName"] md-content.md-hue-3,\n md-content.md-@themeName-theme.md-hue-3 {\n    color: @backgroundHue3Contrast1;\n    background-color: @backgroundHue3Color;\n}\n\n/* Text Colors */\n[md-theme="@themeName"] a {\n    color: @accentDefaultColor;\n}\n\n[md-theme="@themeName"] .secondary-text,\n[md-theme="@themeName"] .icon {\n    color: @backgroundDefaultContrast2;\n}\n\n[md-theme="@themeName"] .hint-text,\n[md-theme="@themeName"] .disabled-text {\n    color: @backgroundDefaultContrast3;\n}\n\n[md-theme="@themeName"] .fade-text,\n[md-theme="@themeName"] .divider {\n    color: @backgroundDefaultContrast4;\n}\n\n/* Primary */\n[md-theme="@themeName"] .md-primary-bg {\n    background-color: @primaryDefaultColor;\n    color: @primaryDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg .secondary-text,\n[md-theme="@themeName"] .md-primary-bg .icon {\n    color: @primaryDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg .hint-text,\n[md-theme="@themeName"] .md-primary-bg .disabled-text {\n    color: @primaryDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg .fade-text,\n[md-theme="@themeName"] .md-primary-bg .divider {\n    color: @primaryDefaultContrast4;\n}\n\n/* Primary, Hue-1 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 {\n    background-color: @primaryHue1Color;\n    color: @primaryHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .icon {\n    color: @primaryHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .disabled-text {\n    color: @primaryHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .divider {\n    color: @primaryHue1Contrast4;\n}\n\n/* Primary, Hue-2 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 {\n    background-color: @primaryHue2Color;\n    color: @primaryHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .icon {\n    color: @primaryHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .disabled-text {\n    color: @primaryHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .divider {\n    color: @primaryHue2Contrast4;\n}\n\n/* Primary, Hue-3 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 {\n    background-color: @primaryHue3Color;\n    color: @primaryHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .icon {\n    color: @primaryHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .disabled-text {\n    color: @primaryHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .divider {\n    color: @primaryHue3Contrast4;\n}\n\n/* Primary foreground */\n[md-theme="@themeName"] .md-primary-fg {\n    color: @primaryDefaultColor !important;\n}\n\n/* Primary foreground, Hue-1 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-1 {\n    color: @primaryHue1Color !important;\n}\n\n/* Primary foreground, Hue-2 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-2 {\n    color: @primaryHue2Color !important;\n}\n\n/* Primary foreground, Hue-3 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-3 {\n    color: @primaryHue3Color !important;\n}\n\n/* Accent */\n[md-theme="@themeName"] .md-accent-bg {\n    background-color: @accentDefaultColor;\n    color: @accentDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg .secondary-text,\n[md-theme="@themeName"] .md-accent-bg .icon {\n    color: @accentDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg .hint-text,\n[md-theme="@themeName"] .md-accent-bg .disabled-text {\n    color: @accentDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg .fade-text,\n[md-theme="@themeName"] .md-accent-bg .divider {\n    color: @accentDefaultContrast4;\n}\n\n/* Accent, Hue-1 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 {\n    background-color: @accentHue1Color;\n    color: @accentHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .icon {\n    color: @accentHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .disabled-text {\n    color: @accentHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .divider {\n    color: @accentHue1Contrast4;\n}\n\n/* Accent, Hue-2 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 {\n    background-color: @accentHue2Color;\n    color: @accentHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .icon {\n    color: @accentHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .disabled-text {\n    color: @accentHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .divider {\n    color: @accentHue2Contrast4;\n}\n\n/* Accent, Hue-3 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 {\n    background-color: @accentHue3Color;\n    color: @accentHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .icon {\n    color: @accentHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .disabled-text {\n    color: @accentHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .divider {\n    color: @accentHue3Contrast4;\n}\n\n/* Accent foreground */\n[md-theme="@themeName"] .md-accent-fg {\n    color: @accentDefaultColor !important;\n}\n\n/* Accent foreground, Hue-1 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-1 {\n    color: @accentHue1Color !important;\n}\n\n/* Accent foreground, Hue-2 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-2 {\n    color: @accentHue2Color !important;\n}\n\n/* Accent foreground, Hue-3 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-3 {\n    color: @accentHue3Color !important;\n}\n\n/* Warn */\n[md-theme="@themeName"] .md-warn-bg {\n    background-color: @warnDefaultColor;\n    color: @warnDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg .secondary-text,\n[md-theme="@themeName"] .md-warn-bg .icon {\n    color: @warnDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg .hint-text,\n[md-theme="@themeName"] .md-warn-bg .disabled-text {\n    color: @warnDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg .fade-text,\n[md-theme="@themeName"] .md-warn-bg .divider {\n    color: @warnDefaultContrast4;\n}\n\n/* Warn, Hue-1 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 {\n    background-color: @warnHue1Color;\n    color: @warnHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .icon {\n    color: @warnHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .disabled-text {\n    color: @warnHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .divider {\n    color: @warnHue1Contrast4;\n}\n\n/* Warn, Hue-2 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 {\n    background-color: @warnHue2Color;\n    color: @warnHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .icon {\n    color: @warnHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .disabled-text {\n    color: @warnHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .divider {\n    color: @warnHue2Contrast4;\n}\n\n/* Warn, Hue-3 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 {\n    background-color: @warnHue3Color;\n    color: @warnHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .icon {\n    color: @warnHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .disabled-text {\n    color: @warnHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .divider {\n    color: @warnHue3Contrast4;\n}\n\n/* Warn foreground */\n[md-theme="@themeName"] .md-warn-fg {\n    color: @warnDefaultColor !important;\n}\n\n/* Warn foreground, Hue-1 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-1 {\n    color: @warnHue1Color !important;\n}\n\n/* Warn foreground, Hue-2 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-2 {\n    color: @warnHue2Color !important;\n}\n\n/* Warn foreground, Hue-3 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-3 {\n    color: @warnHue3Color !important;\n}\n\n/* Background */\n[md-theme="@themeName"] .md-background-bg {\n    background-color: @backgroundDefaultColor;\n    color: @backgroundDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg .secondary-text,\n[md-theme="@themeName"] .md-background-bg .icon {\n    color: @backgroundDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg .hint-text,\n[md-theme="@themeName"] .md-background-bg .disabled-text {\n    color: @backgroundDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg .fade-text,\n[md-theme="@themeName"] .md-background-bg .divider {\n    color: @backgroundDefaultContrast4;\n}\n\n/* Background, Hue-1 */\n[md-theme="@themeName"] .md-background-bg.md-hue-1 {\n    background-color: @backgroundHue1Color;\n    color: @backgroundHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .icon {\n    color: @backgroundHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .disabled-text {\n    color: @backgroundHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .divider {\n    color: @backgroundHue1Contrast4;\n}\n\n/* Background, Hue-2 */\n[md-theme="@themeName"] .md-background-bg.md-hue-2 {\n    background-color: @backgroundHue2Color;\n    color: @backgroundHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .icon {\n    color: @backgroundHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .disabled-text {\n    color: @backgroundHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .divider {\n    color: @backgroundHue2Contrast4;\n}\n\n/* Background, Hue-3 */\n[md-theme="@themeName"] .md-background-bg.md-hue-3 {\n    background-color: @backgroundHue3Color;\n    color: @backgroundHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .icon {\n    color: @backgroundHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .disabled-text {\n    color: @backgroundHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .divider {\n    color: @backgroundHue3Contrast4;\n}\n\n/* Background foreground */\n[md-theme="@themeName"] .md-background-fg {\n    color: @backgroundDefaultColor !important;\n}\n\n/* Background foreground, Hue-1 */\n[md-theme="@themeName"] .md-background-fg.md-hue-1 {\n    color: @backgroundHue1Color !important;\n}\n\n/* Background foreground, Hue-2 */\n[md-theme="@themeName"] .md-background-fg.md-hue-2 {\n    color: @backgroundHue2Color !important;\n}\n\n/* Background foreground, Hue-3 */\n[md-theme="@themeName"] .md-background-fg.md-hue-3 {\n    color: @backgroundHue3Color !important;\n}'.replace(a,function(e){return t[e]}),s=angular.element("head"),(o=angular.element('<style type="text/css"></style>')).html(i),s.append(o)})},rgba:l};function l(e,n){var t=n||!1;return 4===e.length&&255===e[0]&&255===e[1]&&255===e[2]&&e.splice(3,4),t&&(e=function(e,n){var t={white:{1:"1",2:"0.7",3:"0.3",4:"0.12"},black:{1:"0.87",2:"0.54",3:"0.26",4:"0.12"}};255===e[0]&&255===e[1]&&255===e[2]?e[3]=t.white[n]:0===e[0]&&0===e[1]&&0===e[2]&&(e[3]=t.black[n]);return e}(e,t)),3===e.length?"rgb("+e.join(",")+")":4===e.length?"rgba("+e.join(",")+")":void a.error("Invalid number of arguments supplied in the color array: "+e.length+"\nThe array must have 3 or 4 colors.")}function d(e){return e.charAt(0).toUpperCase()+e.slice(1)}}e.$inject=["$cookies","$log","motionTheming"],angular.module("app.core").factory("motionGenerator",e)}(),function(){"use strict";angular.module("app.core").constant("motionPalettes",[{name:"motion-blue",options:{50:"#ebf1fa",100:"#c2d4ef",200:"#9ab8e5",300:"#78a0dc",400:"#5688d3",500:"#3470ca",600:"#2e62b1",700:"#275498",800:"#21467e",900:"#1a3865",A100:"#c2d4ef",A200:"#9ab8e5",A400:"#5688d3",A700:"#275498",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}},{name:"motion-paleblue",options:{50:"#ececee",100:"#c5c6cb",200:"#9ea1a9",300:"#7d818c",400:"#5c616f",500:"#3c4252",600:"#353a48",700:"#2d323e",800:"#262933",900:"#1e2129",A100:"#c5c6cb",A200:"#9ea1a9",A400:"#5c616f",A700:"#2d323e",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}}])}(),function(){"use strict";angular.module("app.core").constant("motionThemes",{default:{primary:{name:"motion-paleblue",hues:{default:"700","hue-1":"500","hue-2":"600","hue-3":"400"}},accent:{name:"light-blue",hues:{default:"600","hue-1":"400","hue-2":"700","hue-3":"A100"}},warn:{name:"red"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},pinkTheme:{primary:{name:"blue-grey",hues:{default:"800","hue-1":"600","hue-2":"400","hue-3":"A100"}},accent:{name:"pink",hues:{default:"400","hue-1":"300","hue-2":"600","hue-3":"A100"}},warn:{name:"blue"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},tealTheme:{primary:{name:"motion-blue",hues:{default:"900","hue-1":"600","hue-2":"500","hue-3":"A100"}},accent:{name:"teal",hues:{default:"500","hue-1":"400","hue-2":"600","hue-3":"A100"}},warn:{name:"deep-orange"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}}})}(),function(){"use strict";function e(t,e,n){var a;angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.getObject("motion.customTheme");i&&(n.custom=i),t.alwaysWatchTheme(!0),angular.forEach(e,function(e){t.definePalette(e.name,e.options)}),angular.forEach(n,function(e,n){t.theme(n).primaryPalette(e.primary.name,e.primary.hues).accentPalette(e.accent.name,e.accent.hues).warnPalette(e.warn.name,e.warn.hues).backgroundPalette(e.background.name,e.background.hues)})}e.$inject=["$mdThemingProvider","motionPalettes","motionThemes"],angular.module("app.core").config(e)}(),function(){"use strict";function e(n,t,e){var a={getRegisteredPalettes:function(){return e.PALETTES},getRegisteredThemes:function(){return e.THEMES},setActiveTheme:function(e){if(angular.isUndefined(a.themes.list[e]))return angular.isUndefined(a.themes.list.default)?void t.error('You must have at least one theme named "default"'):(t.warn('The theme "'+e+'" does not exist! Falling back to the "default" theme.'),a.themes.active.name="default",a.themes.active.theme=a.themes.list.default,void n.put("motion.selectedTheme",a.themes.active.name));a.themes.active.name=e,a.themes.active.theme=a.themes.list[e],n.put("motion.selectedTheme",e)},setThemesList:function(e){a.themes.list=e},themes:{list:{},active:{name:"",theme:{}}}};return a}e.$inject=["$cookies","$log","$mdTheming"],angular.module("app.core").service("motionTheming",e)}(),function(){"use strict";function e(n,s,o,r){this.search=function(n){for(var e=[],t=r.getFlatNavigation(),a=o.defer(),i=0;i<t.length;i+=1)t[i].uisref&&e.push(t[i]);n&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(n)))return!0}));return s(function(){a.resolve(e)},1e3),a.promise},this.searchResultClick=function(e){e.uisref&&(e.stateParams?n.go(e.state,e.stateParams):n.go(e.state))}}e.$inject=["$state","$timeout","$q","msNavigationService"],angular.module("app.errors.error-404").controller("Error404Controller",e)}(),function(){"use strict";function e(e,n){var t=this;t.code="",t.send=!1,t.error=e.params,t.sendReport=function(){n.post("/api/jira",t.error).then(function(e){t.send=!0,e.data&&(t.code=e.data.id)},function(e){t.send=!1})}}e.$inject=["$state","$http"],angular.module("app.errors.error-500").controller("Error500Controller",e)}(),function(){"use strict";function e(e,n,t){var a=this;a.currentUser=e.getCurrentUser(),a.cookieAlertHide=n.get("motion.cookieAlertHide:"+a.currentUser.id)||!1,a.cookieAlertOnClose=function(){n.put("motion.cookieAlertHide:"+a.currentUser.id,!0)},a.onInit=function(){t.setting.get({id:1}).$promise.then(function(e){e&&(a.cookieAlertHide=!e.disabledCookie)})},a.onInit()}e.$inject=["Auth","$cookies","api"],angular.module("app.footer").controller("FooterController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.form={},s.forgotPassword=function(){return i.auth.forgot(s.form).$promise.then(function(){n.success({title:t.instant("FORGOTPASSWORD.LINK_SENT"),msg:t.instant("FORGOTPASSWORD.LINNK_SENT_MESSAGE")})}).catch(function(e){e&&n.error({title:t.instant("FORGOTPASSWORD.PASSWORD_RESET_ERROR"),msg:e.data?e.data.message||e.message||e:e.message||e})})},s.onInit=function(){e.isLoggedIn()&&a.go("app.dashboards.general")}}e.$inject=["Auth","toasty","$translate","$state","api"],angular.module("app.forgot").controller("ForgotPasswordController",e)}(),function(){"use strict";function e(e,n){var t=this;t.currentUser=e.getCurrentUser(),t.newsAlertHide=n.get("motion.newsAlertHide:"+t.currentUser.id)||!1,t.newsAlertOnClose=function(){n.put("motion.newsAlertHide:"+t.currentUser.id,!0)}}e.$inject=["Auth","$cookies"],angular.module("app.header").controller("HeaderController",e)}(),function(){"use strict";function e(e,o){var r={getResourcesByRole:function(e,n,t,a,i,s){return o.getResources(r,e,n,t,a,i,s)}};return r.baseUrl="api/",r.auth=e(r.baseUrl+"auth/local",{},{local:{method:"post",url:r.baseUrl+"auth/local"},forgot:{method:"post",url:r.baseUrl+"auth/local/forgot"},reset:{method:"post",url:r.baseUrl+"auth/local/reset/:token",params:{token:"@token"}},user:{method:"get",url:r.baseUrl+"auth/local/user/:token",params:{token:"@token"}},google:{method:"post",url:r.baseUrl+"auth/google"},activedirectory:{method:"post",url:r.baseUrl+"auth/activedirectory"}}),r.jira=e(r.baseUrl+"jira"),r.rpc=e(r.baseUrl+"rpc",{},{startMonitor:{method:"get",url:r.baseUrl+"rpc/voice/channels/:uniqueid/mixmonitor",params:{uniqueid:"@uniqueid"}},stopMonitor:{method:"get",url:r.baseUrl+"rpc/voice/channels/:uniqueid/stopmixmonitor",params:{uniqueid:"@uniqueid"}},getVoiceChannels:{method:"get",url:r.baseUrl+"rpc/voice/channels"},getVoiceQueues:{method:"get",url:r.baseUrl+"rpc/voice/queues"},getChatQueues:{method:"get",url:r.baseUrl+"rpc/chat/queues"},getMailQueues:{method:"get",url:r.baseUrl+"rpc/mail/queues"},getSmsQueues:{method:"get",url:r.baseUrl+"rpc/sms/queues"},getWhatsappQueues:{method:"get",url:r.baseUrl+"rpc/whatsapp/queues"},getOpenchannelQueues:{method:"get",url:r.baseUrl+"rpc/openchannel/queues"},getFaxQueues:{method:"get",url:r.baseUrl+"rpc/fax/queues"},getVoiceQueuesPreview:{method:"get",url:r.baseUrl+"rpc/voice/queues/preview/:id"},getVoiceQueuesChannels:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels"},getVoiceQueuesChannel:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid"},getVoiceQueuesChannelHangup:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid/hangup"},getVoiceQueuesChannelRedirect:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid/redirect/:exten"},getOutbound:{method:"get",url:r.baseUrl+"rpc/outbound"},getOutboundChannels:{method:"get",url:r.baseUrl+"rpc/outbound/channels"},getAgents:{method:"get",url:r.baseUrl+"rpc/agents"},setAgentCapacity:{method:"put",url:r.baseUrl+"rpc/agents/:id/capacity",params:{id:"@id"}},getTelephones:{method:"get",url:r.baseUrl+"rpc/telephones"},getTrunks:{method:"get",url:r.baseUrl+"rpc/trunks"},getCampaigns:{method:"get",url:r.baseUrl+"rpc/campaigns"},getMailAccounts:{method:"get",url:r.baseUrl+"rpc/mail/accounts"},getFaxAccounts:{method:"get",url:r.baseUrl+"rpc/fax/accounts"},getChatQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/chat/queues/waitinginteractions"},getMailQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/mail/queues/waitinginteractions"},getOpenchannelQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/openchannel/queues/waitinginteractions"},getOpenchannelQueuesIdWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/openchannel/queues/:id/waitinginteractions"},getSmsQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/sms/queues/waitinginteractions"},getFaxQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/fax/queues/waitinginteractions"},getWhatsappQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/whatsapp/queues/waitinginteractions"},mailQueueNotify:{method:"post",url:r.baseUrl+"rpc/mail/queues/:id/notify",params:{id:"@id"}},chatQueueNotify:{method:"post",url:r.baseUrl+"rpc/chat/queues/:id/notify",params:{id:"@id"}},faxQueueNotify:{method:"post",url:r.baseUrl+"rpc/fax/queues/:id/notify",params:{id:"@id"}},smsQueueNotify:{method:"post",url:r.baseUrl+"rpc/sms/queues/:id/notify",params:{id:"@id"}},openchannelQueueNotify:{method:"post",url:r.baseUrl+"rpc/openchannel/queues/:id/notify",params:{id:"@id"}},agentNotify:{method:"post",url:r.baseUrl+"rpc/agents/:id/notify",params:{id:"@id"}}}),r.version=e(r.baseUrl+"version",{},{fetch:{method:"get",url:r.baseUrl+"version/fetch"},reset:{method:"get",url:r.baseUrl+"version/reset"},pull:{method:"get",url:r.baseUrl+"version/pull"},restart:{method:"get",url:r.baseUrl+"version/restart"},migrations:{method:"get",url:r.baseUrl+"version/migrations"}}),r.system=e(r.baseUrl+"system",{},{killProcess:{method:"get",url:r.baseUrl+"system/process/:pid/kill",params:{pid:"@pid"}}}),r.pm2=e(r.baseUrl+"pm2/:id",{id:"@id"},{update:{method:"put",isArray:!0}}),r.user=e(r.baseUrl+"users/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"users/describe"},clone:{method:"post",url:r.baseUrl+"users/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/contacts"},bulkCreate:{isArray:!1,method:"post",url:r.baseUrl+"users/create_many"},changePassword:{isArray:!1,method:"put",url:r.baseUrl+"users/:id/password"},addQueues:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/queues"},addAvatar:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/avatar"},getAvatar:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/avatar"},getOpenTabs:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/open_tabs"},getContacts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/contacts"},getQueues:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/queues"},getVoiceQueuesRt:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/queues_rt"},getGroups:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/groups"},getRecordings:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/recordings"},getScreenRecordings:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/screen_recordings"},getChatInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/chat/interactions"},getOpenchannelInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/openchannel/interactions"},getMailInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/mail/interactions"},getSmsInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/sms/interactions"},getFaxInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/fax/interactions"},getWhatsappInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/whatsapp/interactions"},login:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/login"},logout:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/logout"},pause:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/pause"},unpause:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/unpause"},messengerSoundNotification:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/messengerSoundNotification"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/teams"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/lists"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/agents"},addChatInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/chat_interactions"},removeChatInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/chat_interactions"},addMailInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/mail_interactions"},removeMailInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/mail_interactions"},addFaxInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/fax_interactions"},removeFaxInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/fax_interactions"},addSmsInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/sms_interactions"},removeSmsInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/sms_interactions"},addOpenchannelInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/openchannel_interactions"},removeOpenchannelInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/openchannel_interactions"},addWhatsappInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/whatsapp_interactions"},removeWhatsappInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/whatsapp_interactions"},getVoicePrefixes:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/prefixes"},getFaxAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/fax_accounts"},addFaxAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/fax_accounts"},removeFaxAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/fax_accounts"},getMailAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/mail_accounts"},addMailAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/mail_accounts"},removeMailAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/mail_accounts"},getOpenchannelAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/openchannel_accounts"},addOpenchannelAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/openchannel_accounts"},removeOpenchannelAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/openchannel_accounts"},getSmsAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/sms_accounts"},addSmsAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/sms_accounts"},removeSmsAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/sms_accounts"},getChatWebsites:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/chat_websites"},addChatWebsites:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/chat_websites"},removeChatWebsites:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/chat_websites"},getWhatsappAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/whatsapp_accounts"},addWhatsappAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/whatsapp_accounts"},removeWhatsappAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/whatsapp_accounts"},getScheduledCalls:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/scheduled_calls"},getApiKey:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/api_key"},createApiKey:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/api_key"},removeApiKey:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/api_key"},whoami:{isArray:!1,method:"get",url:r.baseUrl+"users/whoami"},getPresence:{isArray:!1,method:"get",url:r.baseUrl+"users/presence"}}),r.voiceChanSpy=e(r.baseUrl+"voice/chanspy/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/chanspy/describe"},clone:{method:"post",url:r.baseUrl+"voice/chanspy/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceContext=e(r.baseUrl+"voice/contexts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/contexts/describe"},clone:{method:"post",url:r.baseUrl+"voice/contexts/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceExtension=e(r.baseUrl+"voice/extensions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/extensions/describe"},clone:{method:"post",url:r.baseUrl+"voice/extensions/:id/clone",params:{includeAll:"@includeAll"}},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"voice/extensions/:id/applications"}}),r.voiceMusicOnHold=e(r.baseUrl+"voice/mohs/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mohs/describe"},clone:{method:"post",url:r.baseUrl+"voice/mohs/:id/clone",params:{includeAll:"@includeAll"}},addSound:{isArray:!1,method:"post",url:r.baseUrl+"voice/mohs/:id/sounds"},removeSound:{isArray:!1,method:"delete",url:r.baseUrl+"voice/mohs/:id/sounds/:id2"},getSounds:{isArray:!1,method:"get",url:r.baseUrl+"voice/mohs/:id/sounds"}}),r.voiceQueue=e(r.baseUrl+"voice/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/queues/describe"},clone:{method:"post",url:r.baseUrl+"voice/queues/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_black"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"voice/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"voice/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/users"},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/members"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/lists"},addLists:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/lists"},removeLists:{isArray:!0,method:"delete",url:r.baseUrl+"voice/queues/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:r.baseUrl+"voice/queues/:id/blacklists"}}),r.voiceRecording=e(r.baseUrl+"voice/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/recordings/describe"},clone:{method:"post",url:r.baseUrl+"voice/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},downloads:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/downloads"},runTranscribe:{isArray:!1,method:"post",url:r.baseUrl+"voice/recordings/:id/transcribe"},downloadTranscribe:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/transcribe",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.screenRecording=e(r.baseUrl+"screen/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"screen/recordings/describe"},clone:{method:"post",url:r.baseUrl+"screen/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"screen/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.voiceMail=e(r.baseUrl+"voice/mails/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mails/describe"},clone:{method:"post",url:r.baseUrl+"voice/mails/:id/clone",params:{includeAll:"@includeAll"}},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"voice/mails/:id/messages"}}),r.voiceMailMessage=e(r.baseUrl+"voice/mails/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mails/messages/describe"},clone:{method:"post",url:r.baseUrl+"voice/mails/messages/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"voice/mails/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.voiceCallReport=e(r.baseUrl+"voice/calls/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/calls/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/calls/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceDialReport=e(r.baseUrl+"voice/dials/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/dials/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/dials/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceAgentReport=e(r.baseUrl+"voice/agents/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/agents/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/agents/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceQueueReport=e(r.baseUrl+"voice/queues/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/queues/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/queues/reports/:id/clone",params:{includeAll:"@includeAll"}},getVoiceQueuesReport:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/reports/index"}}),r.memberReport=e(r.baseUrl+"members/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"members/reports/describe"},clone:{method:"post",url:r.baseUrl+"members/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.trunk=e(r.baseUrl+"trunks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"trunks/describe"},clone:{method:"post",url:r.baseUrl+"trunks/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceTransferReport=e(r.baseUrl+"voice/transfers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/transfers/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/transfers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailServerOut=e(r.baseUrl+"mail/out_servers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/out_servers/describe"},clone:{method:"post",url:r.baseUrl+"mail/out_servers/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailAccount=e(r.baseUrl+"mail/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/accounts/describe"},clone:{method:"post",url:r.baseUrl+"mail/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/canned_answers"},getImap:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/in_servers"},addImap:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/in_servers"},removeImap:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/in_servers"},getSmtp:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/out_servers"},addSmtp:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/out_servers"},removeSmtp:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/out_servers"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/applications"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/messages"},send:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/send"},verifySmtp:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/verify"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"mail/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/users"}}),r.mailQueue=e(r.baseUrl+"mail/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/queues/describe"},clone:{method:"post",url:r.baseUrl+"mail/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"mail/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"mail/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"mail/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"mail/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/users"}}),r.mailSubstatus=e(r.baseUrl+"mail/substatuses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/substatuses/describe"},clone:{method:"post",url:r.baseUrl+"mail/substatuses/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailInteraction=e(r.baseUrl+"mail/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/interactions/describe"},clone:{method:"post",url:r.baseUrl+"mail/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"mail/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"mail/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"mail/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"mail/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"mail/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.mailMessage=e(r.baseUrl+"mail/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/messages/describe"},clone:{method:"post",url:r.baseUrl+"mail/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"mail/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"mail/messages/:id/reject"},download:{isArray:!1,method:"get",url:r.baseUrl+"mail/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.mailApplication=e(r.baseUrl+"mail/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/applications/describe"},clone:{method:"post",url:r.baseUrl+"mail/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailQueueReport=e(r.baseUrl+"mail/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"mail/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.dashboard=e(r.baseUrl+"dashboards/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dashboards/describe"},clone:{method:"post",url:r.baseUrl+"dashboards/:id/clone",params:{includeAll:"@includeAll"}},addItem:{isArray:!1,method:"post",url:r.baseUrl+"dashboards/:id/items"},getItems:{isArray:!1,method:"get",url:r.baseUrl+"dashboards/:id/items"}}),r.dashboardItem=e(r.baseUrl+"dashboards/items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dashboards/items/describe"},clone:{method:"post",url:r.baseUrl+"dashboards/items/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxAccount=e(r.baseUrl+"fax/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/accounts/describe"},clone:{method:"post",url:r.baseUrl+"fax/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/canned_answers"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/applications"},addAccountApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/addaccountapplications"},updateAccountApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/updateaccountapplications"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/messages"},send:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/send"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"fax/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/users"}}),r.faxApplication=e(r.baseUrl+"fax/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/applications/describe"},clone:{method:"post",url:r.baseUrl+"fax/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxInteraction=e(r.baseUrl+"fax/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/interactions/describe"},clone:{method:"post",url:r.baseUrl+"fax/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"fax/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"fax/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"fax/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"fax/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"fax/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.faxMessage=e(r.baseUrl+"fax/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/messages/describe"},clone:{method:"post",url:r.baseUrl+"fax/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"fax/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"fax/messages/:id/reject"},download:{isArray:!1,method:"get",url:r.baseUrl+"fax/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.faxQueue=e(r.baseUrl+"fax/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/queues/describe"},clone:{method:"post",url:r.baseUrl+"fax/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"fax/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"fax/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"fax/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"fax/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/users"}}),r.faxQueueReport=e(r.baseUrl+"fax/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"fax/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsAccount=e(r.baseUrl+"sms/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/accounts/describe"},clone:{method:"post",url:r.baseUrl+"sms/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/interactions"},send:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/send"},status:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/status"},statusGet:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/status"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"sms/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/users"}}),r.smsApplication=e(r.baseUrl+"sms/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/applications/describe"},clone:{method:"post",url:r.baseUrl+"sms/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsInteraction=e(r.baseUrl+"sms/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/interactions/describe"},clone:{method:"post",url:r.baseUrl+"sms/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"sms/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"sms/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"sms/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"sms/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"sms/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.smsMessage=e(r.baseUrl+"sms/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/messages/describe"},clone:{method:"post",url:r.baseUrl+"sms/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"sms/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"sms/messages/:id/reject"},status:{isArray:!1,method:"post",url:r.baseUrl+"sms/messages/:id/status"}}),r.smsQueue=e(r.baseUrl+"sms/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/queues/describe"},clone:{method:"post",url:r.baseUrl+"sms/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"sms/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"sms/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"sms/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"sms/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/users"}}),r.openchannelAccount=e(r.baseUrl+"openchannel/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/accounts/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/interactions"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/users"},send:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/send"}}),r.openchannelApplication=e(r.baseUrl+"openchannel/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/applications/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.openchannelInteraction=e(r.baseUrl+"openchannel/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/interactions/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.openchannelMessage=e(r.baseUrl+"openchannel/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/messages/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"openchannel/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"openchannel/messages/:id/reject"}}),r.openchannelQueue=e(r.baseUrl+"openchannel/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/queues/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/users"}}),r.chatWebsite=e(r.baseUrl+"chat/websites/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/websites/describe"},clone:{method:"post",url:r.baseUrl+"chat/websites/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/canned_answers"},addLogo:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/logo"},addAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/avatar"},addCustomerAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/customer_avatar"},addSystemAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/system_avatar"},getLogo:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/logo"},getAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/avatar"},getCustomerAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/customer_avatar"},getSystemAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/system_avatar"},notify:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/notify"},offline:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/offline"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/interactions"},getSnippet:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/snippet"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/applications"},addProactiveActions:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/proactive_actions"},getProactiveActions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/proactive_actions"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/fields"},getOfflineMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/offline_messages"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"chat/websites/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/users"}}),r.openchannelQueueReport=e(r.baseUrl+"openchannel/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatApplication=e(r.baseUrl+"chat/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/applications/describe"},clone:{method:"post",url:r.baseUrl+"chat/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatInteraction=e(r.baseUrl+"chat/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/interactions/describe"},clone:{method:"post",url:r.baseUrl+"chat/interactions/:id/clone",params:{includeAll:"@includeAll"}},createVidaooSession:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/vidaoo"},customUpdate:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/custom_update"},abandon:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/abandon"},attachmentUpload:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/attachment_upload"},attachmentDownload:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/attachment_download"},close:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/close"},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/messages"},getMyMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/my_messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"chat/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.chatMessage=e(r.baseUrl+"chat/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"chat/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"chat/messages/:id/reject"}}),r.chatOfflineMessage=e(r.baseUrl+"chat/offline_messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/offline_messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/offline_messages/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatQueue=e(r.baseUrl+"chat/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/queues/describe"},clone:{method:"post",url:r.baseUrl+"chat/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"chat/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"chat/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"chat/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"chat/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/users"}}),r.chatGroup=e(r.baseUrl+"chat/groups/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/groups/describe"},clone:{method:"post",url:r.baseUrl+"chat/groups/:id/clone",params:{includeAll:"@includeAll"}},getUnread:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/unread"},addMembers:{isArray:!0,method:"post",url:r.baseUrl+"chat/groups/:id/members"},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/members"},removeMembers:{isArray:!1,method:"delete",url:r.baseUrl+"chat/groups/:id/members"},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"chat/groups/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/messages"}}),r.chatProactiveAction=e(r.baseUrl+"chat/proactive_actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/proactive_actions/describe"},clone:{method:"post",url:r.baseUrl+"chat/proactive_actions/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmCompany=e(r.baseUrl+"cm/companies/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/companies/describe"},clone:{method:"post",url:r.baseUrl+"cm/companies/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!1,method:"post",url:r.baseUrl+"cm/companies/:id/contacts"},getContacts:{isArray:!1,method:"get",url:r.baseUrl+"cm/companies/:id/contacts"}}),r.cmContact=e(r.baseUrl+"cm/contacts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/contacts/describe"},clone:{method:"post",url:r.baseUrl+"cm/contacts/:id/clone",params:{includeAll:"@includeAll"}},merge:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/merge"},bulkCreate:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/create_many"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/tags"},setAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/phones"},getAdditionalPhones:{isArray:!0,method:"get",url:r.baseUrl+"cm/contacts/:id/phones"},duplicateAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/duplicateAdditionalPhones"},rescheduleAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/rescheduleAdditionalPhones"},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hopper_finals"},getJscriptySessions:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/jscripty_sessions"},uploadCsv:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/csv"},upload:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/upload"},import:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/upload/:id"},importUpdates:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/uploadUpdates/:id"},getJourney:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/journey"}}),r.cmHopper=e(r.baseUrl+"cm/hopper/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper/:id/clone",params:{includeAll:"@includeAll"}},getPreview:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper/preview"},getPreviewRecall:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/:id/previewrecall"},getOpenContacts:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/opencontacts"},getTimezones:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/timezones"},getTimezone:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper/timezone"}}),r.cmHopperBlack=e(r.baseUrl+"cm/hopper_black/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_black/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_black/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmHopperFinal=e(r.baseUrl+"cm/hopper_final/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_final/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_final/:id/clone",params:{includeAll:"@includeAll"}},countContactsQueueCampaignHopperFinal:{isArray:!0,method:"get",url:r.baseUrl+"cm/hopper_final/voice/queue/countAttributes/:id"},countContactsIvrCampaignHopperFinal:{isArray:!0,method:"get",url:r.baseUrl+"cm/hopper_final/campaign/countAttributes/:id"},moveContactsQueueCampaignHopperFinal:{isArray:!0,method:"post",url:r.baseUrl+"cm/hopper_final/voice/queue/moveContacts/:id"},moveContactsIvrCampaignHopperFinal:{isArray:!0,method:"post",url:r.baseUrl+"cm/hopper_final/voice/campaign/moveContacts/:id"},checkContactHopper:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper_final/checkContactHopper"}}),r.cmHopperHistory=e(r.baseUrl+"cm/hopper_history/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_history/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_history/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmCustomField=e(r.baseUrl+"cm/custom_fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/custom_fields/describe"},clone:{method:"post",url:r.baseUrl+"cm/custom_fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.action=e(r.baseUrl+"actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"actions/describe"},clone:{method:"post",url:r.baseUrl+"actions/:id/clone",params:{includeAll:"@includeAll"}}}),r.automation=e(r.baseUrl+"automations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"automations/describe"},clone:{method:"post",url:r.baseUrl+"automations/:id/clone",params:{includeAll:"@includeAll"}},addConditions:{isArray:!1,method:"post",url:r.baseUrl+"automations/:id/conditions"},getConditions:{isArray:!1,method:"get",url:r.baseUrl+"automations/:id/conditions"},addActions:{isArray:!1,method:"post",url:r.baseUrl+"automations/:id/actions"},getActions:{isArray:!1,method:"get",url:r.baseUrl+"automations/:id/actions"}}),r.cannedAnswer=e(r.baseUrl+"canned_answers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"canned_answers/describe"},clone:{method:"post",url:r.baseUrl+"canned_answers/:id/clone",params:{includeAll:"@includeAll"}}}),r.disposition=e(r.baseUrl+"dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dispositions/describe"},clone:{method:"post",url:r.baseUrl+"dispositions/:id/clone",params:{includeAll:"@includeAll"}}}),r.condition=e(r.baseUrl+"conditions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"conditions/describe"},clone:{method:"post",url:r.baseUrl+"conditions/:id/clone",params:{includeAll:"@includeAll"}}}),r.interval=e(r.baseUrl+"intervals/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"intervals/describe"},clone:{method:"post",url:r.baseUrl+"intervals/:id/clone",params:{includeAll:"@includeAll"}},addInterval:{isArray:!1,method:"post",url:r.baseUrl+"intervals/:id/sub_intervals"},getIntervals:{isArray:!1,method:"get",url:r.baseUrl+"intervals/:id/sub_intervals"},addIntervals:{isArray:!0,method:"post",url:r.baseUrl+"intervals/:id/sub_intervals/create_many"}}),r.pause=e(r.baseUrl+"pauses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"pauses/describe"},clone:{method:"post",url:r.baseUrl+"pauses/:id/clone",params:{includeAll:"@includeAll"}}}),r.cdr=e(r.baseUrl+"cdr/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cdr/describe"},clone:{method:"post",url:r.baseUrl+"cdr/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceQueuesLog=e(r.baseUrl+"voiceQueuesLog/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voiceQueuesLog/describe"},clone:{method:"post",url:r.baseUrl+"voiceQueuesLog/:id/clone",params:{includeAll:"@includeAll"}}}),r.schedule=e(r.baseUrl+"schedules/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"schedules/describe"},clone:{method:"post",url:r.baseUrl+"schedules/:id/clone",params:{includeAll:"@includeAll"}},run:{isArray:!1,method:"get",url:r.baseUrl+"schedules/:id/run"}}),r.sound=e(r.baseUrl+"sounds/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sounds/describe"},clone:{method:"post",url:r.baseUrl+"sounds/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"sounds/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},delete:{isArray:!1,method:"delete",url:r.baseUrl+"sounds/:id"}}),r.tag=e(r.baseUrl+"tags/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"tags/describe"},clone:{method:"post",url:r.baseUrl+"tags/:id/clone",params:{includeAll:"@includeAll"}}}),r.contactItemType=e(r.baseUrl+"contact_item_types/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"contact_item_types/describe"},clone:{method:"post",url:r.baseUrl+"contact_item_types/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmContactHasItem=e(r.baseUrl+"cm_contact_has_items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm_contact_has_items/describe"},clone:{method:"post",url:r.baseUrl+"cm_contact_has_items/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmHopperAdditionalPhone=e(r.baseUrl+"cm_hopper_additional_phones/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm_hopper_additional_phones/describe"},clone:{method:"post",url:r.baseUrl+"cm_hopper_additional_phones/:id/clone",params:{includeAll:"@includeAll"}}}),r.template=e(r.baseUrl+"templates/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"templates/describe"},clone:{method:"post",url:r.baseUrl+"templates/:id/clone",params:{includeAll:"@includeAll"}}}),r.trigger=e(r.baseUrl+"triggers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"triggers/describe"},clone:{method:"post",url:r.baseUrl+"triggers/:id/clone",params:{includeAll:"@includeAll"}},addAllCondition:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/all_conditions"},addAnyCondition:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/any_conditions"},getAllConditions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/all_conditions"},getAnyConditions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/any_conditions"},addAction:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/actions"},getActions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/actions"}}),r.variable=e(r.baseUrl+"variables/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"variables/describe"},clone:{method:"post",url:r.baseUrl+"variables/:id/clone",params:{includeAll:"@includeAll"}}}),r.integration=e(r.baseUrl+"integrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/:id/clone",params:{includeAll:"@includeAll"}}}),r.integrationReport=e(r.baseUrl+"integrations/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/reports/describe"},clone:{method:"post",url:r.baseUrl+"integrations/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.analyticCustomReport=e(r.baseUrl+"analytics/custom_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/custom_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/custom_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/preview"},run:{isArray:!1,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/run"},query:{isArray:!1,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/query"}}),r.analyticDefaultReport=e(r.baseUrl+"analytics/default_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/default_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/default_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:r.baseUrl+"analytics/default_reports/:id/preview"},run:{isArray:!1,method:"get",url:r.baseUrl+"analytics/default_reports/:id/run"},query:{isArray:!1,method:"get",url:r.baseUrl+"analytics/default_reports/:id/query"}}),r.analyticExtractedReport=e(r.baseUrl+"analytics/extracted_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/extracted_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/extracted_reports/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"analytics/extracted_reports/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.analyticMetric=e(r.baseUrl+"analytics/metrics/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/metrics/describe"},clone:{method:"post",url:r.baseUrl+"analytics/metrics/:id/clone",params:{includeAll:"@includeAll"}}}),r.analyticFieldReport=e(r.baseUrl+"analytics/field_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/field_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/field_reports/:id/clone",params:{includeAll:"@includeAll"}},bulkCreate:{method:"post",url:r.baseUrl+"analytics/field_reports/create_many",isArray:!0},bulkDestroy:{method:"delete",url:r.baseUrl+"analytics/field_reports/destroy_many",isArray:!0},addFields:{isArray:!0,method:"post",url:r.baseUrl+"analytics/field_reports/:id/create_many"}}),r.analyticTreeReport=e(r.baseUrl+"analytics/tree_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/tree_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/tree_reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.intSalesforceAccount=e(r.baseUrl+"integrations/salesforce/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/salesforce/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/accounts/:id/fields"}}),r.intSalesforceConfiguration=e(r.baseUrl+"integrations/salesforce/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/descriptions"}}),r.intSalesforceField=e(r.baseUrl+"integrations/salesforce/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intSugarcrmAccount=e(r.baseUrl+"integrations/sugarcrm/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/fields"}}),r.intSugarcrmConfiguration=e(r.baseUrl+"integrations/sugarcrm/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/descriptions"}}),r.intSugarcrmField=e(r.baseUrl+"integrations/sugarcrm/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intDeskAccount=e(r.baseUrl+"integrations/desk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/desk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/accounts/:id/fields"}}),r.intDeskConfiguration=e(r.baseUrl+"integrations/desk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/desk/configurations/:id/tags"}}),r.intDeskField=e(r.baseUrl+"integrations/desk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intZohoAccount=e(r.baseUrl+"integrations/zoho/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/zoho/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/accounts/:id/fields"}}),r.intZohoConfiguration=e(r.baseUrl+"integrations/zoho/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/descriptions"}}),r.intZohoField=e(r.baseUrl+"integrations/zoho/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intZendeskAccount=e(r.baseUrl+"integrations/zendesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/zendesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/accounts/:id/fields"}}),r.intZendeskConfiguration=e(r.baseUrl+"integrations/zendesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/zendesk/configurations/:id/tags"}}),r.intZendeskField=e(r.baseUrl+"integrations/zendesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intFreshdeskAccount=e(r.baseUrl+"integrations/freshdesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/:id/fields"}}),r.intFreshdeskConfiguration=e(r.baseUrl+"integrations/freshdesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/freshdesk/configurations/:id/tags"}}),r.intFreshdeskField=e(r.baseUrl+"integrations/freshdesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intVtigerAccount=e(r.baseUrl+"integrations/vtiger/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/vtiger/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/accounts/:id/fields"}}),r.intVtigerConfiguration=e(r.baseUrl+"integrations/vtiger/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/descriptions"}}),r.intVtigerField=e(r.baseUrl+"integrations/vtiger/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intServicenowAccount=e(r.baseUrl+"integrations/servicenow/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/servicenow/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/accounts/:id/fields"}}),r.intServicenowConfiguration=e(r.baseUrl+"integrations/servicenow/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/descriptions"}}),r.intServicenowField=e(r.baseUrl+"integrations/servicenow/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intDynamics365Account=e(r.baseUrl+"integrations/dynamics365/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/:id/fields"}}),r.intDynamics365Configuration=e(r.baseUrl+"integrations/dynamics365/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/descriptions"}}),r.intDynamics365Field=e(r.baseUrl+"integrations/dynamics365/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intFreshsalesAccount=e(r.baseUrl+"integrations/freshsales/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/freshsales/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/accounts/:id/fields"}}),r.intFreshsalesConfiguration=e(r.baseUrl+"integrations/freshsales/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/configurations/:id/clone",params:{includeAll:"@includeAll"}},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/descriptions"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/fields"}}),r.intFreshsalesField=e(r.baseUrl+"integrations/freshsales/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.network=e(r.baseUrl+"networks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"networks/describe"},clone:{method:"post",url:r.baseUrl+"networks/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatQueueReport=e(r.baseUrl+"chat/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"chat/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatInternalMessage=e(r.baseUrl+"chat/internal/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/internal/messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/internal/messages/:id/clone",params:{includeAll:"@includeAll"}},getUsers:{isArray:!1,method:"get",url:r.baseUrl+"chat/internal/messages/users"}}),r.jscriptyAnswerReport=e(r.baseUrl+"jscripty/answers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/answers/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/answers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptyQuestionReport=e(r.baseUrl+"jscripty/questions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/questions/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/questions/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptySessionReport=e(r.baseUrl+"jscripty/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/sessions/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/sessions/reports/:id/clone",params:{includeAll:"@includeAll"}},getQuestions:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/sessions/reports/:id/questions"}}),r.smsQueueReport=e(r.baseUrl+"sms/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"sms/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareReport=e(r.baseUrl+"square/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/reports/describe"},clone:{method:"post",url:r.baseUrl+"square/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareReportDetail=e(r.baseUrl+"square/details/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/details/reports/describe"},clone:{method:"post",url:r.baseUrl+"square/details/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptyProject=e(r.baseUrl+"jscripty/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/projects/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/projects/:id/clone",params:{includeAll:"@includeAll"}},getSessions:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/sessions"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/answers"},getSummary:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/summary",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.setting=e(r.baseUrl+"settings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"settings/describe"},clone:{method:"post",url:r.baseUrl+"settings/:id/clone",params:{includeAll:"@includeAll"}},addLogo:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/logo"},addLogoLogin:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/logo_login"},getLogo:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/logo"},getLogoLogin:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/logo_login"},gdpr:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/gdpr"},addPreferred:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/preferred"},getPreferred:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/preferred"},addFavicon:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/favicon"},getFavicon:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/favicon"},getDate:{isArray:!1,method:"get",url:r.baseUrl+"settings/now"}}),r.squareOdbc=e(r.baseUrl+"square/odbc/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/odbc/describe"},clone:{method:"post",url:r.baseUrl+"square/odbc/:id/clone",params:{includeAll:"@includeAll"}},test:{isArray:!1,method:"get",url:r.baseUrl+"square/odbc/:id/test"}}),r.squareProject=e(r.baseUrl+"square/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/projects/describe"},clone:{method:"post",url:r.baseUrl+"square/projects/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareRecording=e(r.baseUrl+"square/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/recordings/describe"},clone:{method:"post",url:r.baseUrl+"square/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"square/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.squareMessage=e(r.baseUrl+"square/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/messages/describe"},clone:{method:"post",url:r.baseUrl+"square/messages/:id/clone",params:{includeAll:"@includeAll"}}}),r.team=e(r.baseUrl+"teams/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"teams/describe"},clone:{method:"post",url:r.baseUrl+"teams/:id/clone",params:{includeAll:"@includeAll"}},getQueues:{isArray:!0,method:"get",url:r.baseUrl+"teams/:id/queues"},addQueues:{isArray:!0,method:"post",url:r.baseUrl+"teams/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:r.baseUrl+"teams/:id/queues"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"teams/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"teams/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"teams/:id/users"}}),r.license=e(r.baseUrl+"license/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"license/describe"},clone:{method:"post",url:r.baseUrl+"license/:id/clone",params:{includeAll:"@includeAll"}},downloadLogFile:{isArray:!1,method:"get",url:r.baseUrl+"license/download_log_file",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.campaign=e(r.baseUrl+"campaigns/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"campaigns/describe"},clone:{method:"post",url:r.baseUrl+"campaigns/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_black"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/lists"},addLists:{isArray:!0,method:"post",url:r.baseUrl+"campaigns/:id/lists"},removeLists:{isArray:!0,method:"delete",url:r.baseUrl+"campaigns/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:r.baseUrl+"campaigns/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:r.baseUrl+"campaigns/:id/blacklists"}}),r.migration=e(r.baseUrl+"migrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"migrations/describe"},clone:{method:"post",url:r.baseUrl+"migrations/:id/clone",params:{includeAll:"@includeAll"}}}),r.attachment=e(r.baseUrl+"attachments/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"attachments/describe"},clone:{method:"post",url:r.baseUrl+"attachments/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"attachments/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.plugin=e(r.baseUrl+"plugins/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"plugins/describe"},clone:{method:"post",url:r.baseUrl+"plugins/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"plugins/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},upload:{isArray:!1,method:"post",url:r.baseUrl+"plugins/"},delete:{isArray:!1,method:"delete",url:r.baseUrl+"plugins/:id"},webhookGet:{isArray:!1,method:"get",url:r.baseUrl+"plugins/webhook"},webhookPost:{isArray:!1,method:"post",url:r.baseUrl+"plugins/webhook"}}),r.mailTransferReport=e(r.baseUrl+"mail/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"mail/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatTransferReport=e(r.baseUrl+"chat/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"chat/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxTransferReport=e(r.baseUrl+"fax/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"fax/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.openchannelTransferReport=e(r.baseUrl+"openchannel/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsTransferReport=e(r.baseUrl+"sms/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"sms/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmList=e(r.baseUrl+"cm/lists/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/lists/describe"},clone:{method:"post",url:r.baseUrl+"cm/lists/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"cm/lists/:id/dispositions"},addContacts:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/contacts"},getContacts:{isArray:!0,method:"get",url:r.baseUrl+"cm/lists/:id/contacts"},getContactsCsv:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/contacts/csv",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},addCustomField:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/fields"},getCustomFields:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/fields"},getGlobalCustomFields:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/global_fields"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"cm/lists/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"cm/lists/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/users"}}),r.voicePrefix=e(r.baseUrl+"voice/prefixes/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/prefixes/describe"},clone:{method:"post",url:r.baseUrl+"voice/prefixes/:id/clone",params:{includeAll:"@includeAll"}},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"voice/prefixes/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"voice/prefixes/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"voice/prefixes/:id/users"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"voice/prefixes/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"voice/prefixes/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"voice/prefixes/:id/teams"}}),r.userProfile=e(r.baseUrl+"userProfiles/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfiles/describe"},clone:{method:"post",url:r.baseUrl+"userProfiles/:id/clone",params:{includeAll:"@includeAll"}},addSections:{isArray:!0,method:"post",url:r.baseUrl+"userProfiles/:id/sections"},removeSections:{isArray:!1,method:"delete",url:r.baseUrl+"userProfiles/:id/sections"},getSections:{isArray:!0,method:"get",url:r.baseUrl+"userProfiles/:id/sections"},addResources:{isArray:!0,method:"post",url:r.baseUrl+"userProfiles/:id/resources"},removeResources:{isArray:!1,method:"delete",url:r.baseUrl+"userProfiles/:id/resources"},getResources:{isArray:!1,method:"get",url:r.baseUrl+"userProfiles/:id/resources"}}),r.userProfileSection=e(r.baseUrl+"userProfile/sections/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfile/sections/describe"},clone:{method:"post",url:r.baseUrl+"userProfile/sections/:id/clone",params:{includeAll:"@includeAll"}}}),r.userProfileResource=e(r.baseUrl+"userProfile/resources/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfile/resources/describe"},clone:{method:"post",url:r.baseUrl+"userProfile/resources/:id/clone",params:{includeAll:"@includeAll"}}}),r.userNotification=e(r.baseUrl+"userNotifications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userNotifications/describe"},clone:{method:"post",url:r.baseUrl+"userNotifications/:id/clone",params:{includeAll:"@includeAll"}},sendUserNotification:{isArray:!1,method:"post",url:r.baseUrl+"userNotifications/"}}),r.whatsappAccount=e(r.baseUrl+"whatsapp/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/accounts/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/users"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/applications"},notify:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/notify"},send:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/send"}}),r.whatsappApplication=e(r.baseUrl+"whatsapp/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/applications/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappInteraction=e(r.baseUrl+"whatsapp/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/interactions/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.whatsappMessage=e(r.baseUrl+"whatsapp/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/messages/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"whatsapp/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"whatsapp/messages/:id/reject"},status:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/messages/:id/status"}}),r.whatsappQueueReport=e(r.baseUrl+"whatsapp/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappTransferReport=e(r.baseUrl+"whatsapp/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappQueue=e(r.baseUrl+"whatsapp/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/queues/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/users"}}),r.cloudProvider=e(r.baseUrl+"cloudProviders/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cloudProviders/describe"},clone:{method:"post",url:r.baseUrl+"cloudProviders/:id/clone",params:{includeAll:"@includeAll"}},oauth2MicrosoftAuthorize:{method:"get",url:r.baseUrl+"cloudProviders/:id/oauth2/microsoft/authorize"}}),r.realtime=e(r.baseUrl+"realtime",{},{getAgents:{isArray:!1,method:"get",url:r.baseUrl+"realtime/agents"},getQueues:{isArray:!1,method:"get",url:r.baseUrl+"realtime/queues"}}),r.userSetting=e(r.baseUrl+"user-settings/:id",{id:"@id"},{update:{method:"put",isArray:!1}}),r}e.$inject=["$resource","userProfileManager"],angular.module("motion").factory("api",e)}(),function(){"use strict";function e(e,n){n.setConfig({position:"top-right",sound:!1,html:!0,theme:"material"}),e.useLoader("$translatePartialLoader",{urlTemplate:"{part}/i18n/{lang}.json"}),e.preferredLanguage("en"),e.fallbackLanguage("en"),e.useSanitizeValueStrategy(null)}e.$inject=["$translateProvider","toastyConfigProvider"],angular.module("motion").config(e)}(),function(){"use strict";angular.module("motion")}(),function(){"use strict";function e(e,n,t,a){var i=this;i.themes=e.themes,i.direction="ltr";var s=t.get("motion.language");s&&(n.use(s),0<=["ar","fa","he"].indexOf(s)&&a.setting.get({id:1}).$promise.then(function(e){e&&e.rtlSupport&&(i.direction="rtl")}).catch(function(e){e&&toasty.error({title:"Error",msg:e.data?e.data.message||e.message||e:e.message||e})}))}e.$inject=["motionTheming","$translate","$cookies","api"],angular.module("motion").controller("IndexController",e)}(),function(){"use strict";function e(a,i){return function(e){var n=new Date,t=new Date(e);return t.getDate()===n.getDate()&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()?a("date")(t.getTime(),"shortTime"):t.getDate()===n.getDate()-1&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()?i.instant("DASHBOARDS.YESTERDAY")+" "+a("date")(t.getTime(),"shortTime"):a("date")(t.getTime(),"MMM d, y h:mm a")}}function n(e){return{Today:e.instant("DASHBOARDS.TODAY"),Yesterday:e.instant("DASHBOARDS.YESTERDAY"),"This Week":e.instant("DASHBOARDS.THIS_WEEK"),"Last Week":e.instant("DASHBOARDS.LAST_WEEK"),"This Month":e.instant("DASHBOARDS.THIS_MONTH"),"Last Month":e.instant("DASHBOARDS.LAST_MONTH"),"This Year":e.instant("DASHBOARDS.THIS_YEAR"),"Last Year":e.instant("DASHBOARDS.LAST_YEAR"),January:e.instant("DASHBOARDS.JANUARY"),February:e.instant("DASHBOARDS.FEBRUARY"),March:e.instant("DASHBOARDS.MARCH"),April:e.instant("DASHBOARDS.APRIL"),May:e.instant("DASHBOARDS.MAY"),June:e.instant("DASHBOARDS.JUNE"),July:e.instant("DASHBOARDS.JULY"),August:e.instant("DASHBOARDS.AUGUST"),September:e.instant("DASHBOARDS.SEPTEMBER"),October:e.instant("DASHBOARDS.OCTOBER"),November:e.instant("DASHBOARDS.NOVEMBER"),December:e.instant("DASHBOARDS.DECEMBER"),Mon:e.instant("DASHBOARDS.MON"),Tue:e.instant("DASHBOARDS.TUE"),Wed:e.instant("DASHBOARDS.WED"),Thu:e.instant("DASHBOARDS.THU"),Fri:e.instant("DASHBOARDS.FRI"),Sat:e.instant("DASHBOARDS.SAT"),Sun:e.instant("DASHBOARDS.SUN")}}e.$inject=["$filter","$translate"],n.$inject=["$translate"],angular.module("motion").filter("limitObjectFromTo",function(){return function(e,n,t){var a,i={},s=0;for(a in e)if(t<=s&&(i[a]=e[a]),++s===t+n)break;return i}}).filter("formatdate",e).factory("IndexFactory",function(){var e=[{value:"jan"},{value:"feb"},{value:"mar"},{value:"apr"},{value:"may"},{value:"jun"},{value:"jul"},{value:"aug"},{value:"sep"},{value:"oct"},{value:"nov"},{value:"dec"}],n=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10"},{value:"11"},{value:"12"}],t=[{value:"mon"},{value:"tue"},{value:"wed"},{value:"thu"},{value:"fri"},{value:"sat"},{value:"sun"}],a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];return{getMonthName:function(){return e},getMonthNumber:function(){return n},getDaysOfWeek:function(){return t},getDaysOfMonth:function(){return a}}}).factory("dateFilterLocalizationFactory",n).factory("jscookie",function(){return Cookies}).factory("Sequence",function(){return{enqueue:function(e){this.tail=this.tail?this.tail.finally(e):e()}}})}(),function(){"use strict";function e(e,n,t){var a;t.html5Mode(!0),n.otherwise("/dashboards/general"),angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.get("motion.layoutStyle")||"verticalNavigation",s={verticalNavigation:{main:"app/core/layouts/vertical-navigation.html",toolbar:"app/toolbar/layouts/vertical-navigation/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html",header:"app/header/layouts/vertical-navigation/header.html",footer:"app/footer/layouts/vertical-navigation/footer.html"},verticalNavigationFullwidthToolbar:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html"},verticalNavigationFullwidthToolbar2:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar-2/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html"},horizontalNavigation:{main:"app/core/layouts/horizontal-navigation.html",toolbar:"app/toolbar/layouts/horizontal-navigation/toolbar.html",navigation:"app/navigation/layouts/horizontal-navigation/navigation.html"},contentOnly:{main:"app/core/layouts/content-only.html",toolbar:"",navigation:""},contentWithToolbar:{main:"app/core/layouts/content-with-toolbar.html",toolbar:"app/toolbar/layouts/content-with-toolbar/toolbar.html",navigation:""}};e.state("app",{abstract:!0,views:{"main@":{templateUrl:s[i].main,controller:"MainController as vm"},"toolbar@app":{templateUrl:s[i].toolbar,controller:"ToolbarController as vm"},"navigation@app":{templateUrl:s[i].navigation,controller:"NavigationController as vm"},"quickPanel@app":{templateUrl:"app/quick-panel/quick-panel.html",controller:"QuickPanelController as vm"},"header@app":{templateUrl:s[i].header,controller:"HeaderController as vm"},"footer@app":{templateUrl:s[i].footer,controller:"FooterController as vm"}},resolve:{license:["apiResolver",function(e){return e.resolve("license@get")}],setting:["apiResolver","settingsManager",function(e,n){return e.resolve("setting@get",{id:1}).then(function(e){return n.set(e),e})}]}})}e.$inject=["$stateProvider","$urlRouterProvider","$locationProvider"],angular.module("motion").config(e)}(),function(){"use strict";function e(e,n){e.onStart({},n.showLoadingIndicator),e.onFinish({},n.hideLoadingIndicator)}e.$inject=["$transitions","LoadingIndicatorService"],angular.module("motion").run(e)}(),function(){"use strict";function e(a,e){var i,o={};function s(){a.$broadcast("socket:connect"),i&&i.connected||(i=io({query:e.getCurrentUser()?"id="+e.getCurrentUser().id:void 0,transports:["websocket","polling"]})).once("disconnect",n)}function n(e){i.once("connect",s),"logout"===e?i.removeAllListeners():a.$broadcast("socket:disconnect"),i&&i.connected&&i.disconnect()}function r(e,n,t){o[e]||(o[e]=[]),o[e].push({wrapper:n,fn:t})}return{connect:s,disconnect:n,getListeners:function(e){return e?o[e]:o},on:function(e,n){n=n||angular.noop,i||s();var t=function(){var e=arguments;a.$applyAsync(function(){n.apply(i,e)})};r(e,t,n),i.on(e,t)},onWithoutApply:function(e,n){n=n||angular.noop,i||s();var t=function(){n.apply(i,arguments)};r(e,t,n),i.on(e,t)},emit:function(e,n,t){t=t||angular.noop,i||s(),i.emit(e,n,function(){var e=arguments;a.$applyAsync(function(){t.apply(i,e)})})},removeAllListeners:function(e){var n;i||s(),i.removeAllListeners(e),n=e,_.isEmpty(o[n])||delete o[n]},removeListener:function(e,n){i||s();var t=function(e,n){var t=o[e];if(!_.isEmpty(t))for(var a=0;a<t.length;a++){var i=t[a];if(i.fn===n){var s=i.wrapper;return t.splice(a,1),s}}}(e,n);i.removeListener(e,t)}}}e.$inject=["$rootScope","Auth"],angular.module("motion").factory("socket",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o,r){var l=this;l.progresslogin=!1,l.googleSsoEnabled=!1,l.adSsoEnabled=!1,l.login=function(){return l.progresslogin=!0,l.message="",s.login(l.form).then(function(){return n.go("app.dashboards.general")}).catch(function(e){l.message=e.data?e.data.message:e.message}).finally(function(){l.progresslogin=!1})},l.loginOauth=function(e){l.message="",t.location.href=s.loginSSO(e)},l.loginAD=function(){return l.progresslogin=!0,l.message="",s.loginAD(l.form).then(function(){return n.go("app.dashboards.general")}).catch(function(e){l.message=e.data?e.data.message:e.message}).finally(function(){l.progresslogin=!1})},l.onInit=function(){{if(n.params.token&&n.params.userId)return s.removeCookies(),l.progresslogin=!0,o.secureCookieEnabled?r.set("motion.token",n.params.token,{secure:!0,sameSite:"none"}):r.set("motion.token",n.params.token),i.user.get({id:n.params.userId}).$promise.then(function(e){e&&(s.setCurrentUser(e),n.go("app.dashboards.general"))}).finally(function(){l.progresslogin=!1});s.isLoggedIn()&&n.go("app.dashboards.general")}l.googleSsoEnabled=o.googleSsoEnabled,l.adSsoEnabled=o.adSsoEnabled},l.onInit()}e.$inject=["$state","$window","$cookies","$timeout","api","Auth","setting","jscookie"],angular.module("app.login").controller("LoginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="ANALYTICS.EDIT_EXTRACTEDREPORT",g.extractedReport=angular.copy(l),g.extractedReports=r,g.newExtractedReport=!1,g.extractedReport||(g.extractedReport={},g.title="ANALYTICS.NEW_EXTRACTEDREPORT",g.newExtractedReport=!0),g.addNewExtractedReport=function(){g.errors=[],d.analyticExtractedReport.save(g.extractedReport).$promise.then(function(e){g.extractedReports.unshift(e.toJSON()),o.success({title:"ExtractedReport properly created",msg:g.extractedReport.name?g.extractedReport.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveExtractedReport=function(){g.errors=[],d.analyticExtractedReport.update({id:g.extractedReport.id},g.extractedReport).$promise.then(function(e){var n=_.find(g.extractedReports,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ExtractedReport properly saved!",msg:g.extractedReport.name?g.extractedReport.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteExtractedReport=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The extractedReport will be deleted.").ariaLabel("Delete ExtractedReport").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.analyticExtractedReport.delete({id:g.extractedReport.id}).$promise.then(function(){_.remove(g.extractedReports,{id:g.extractedReport.id}),o.success({title:"ExtractedReport properly deleted!",msg:(g.extractedReport.name||"extractedReport")+" has been deleted!"}),v(g.extractedReport)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","extractedReports","extractedReport","api","Auth","license","setting","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditExtractedReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.extractedReports=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="extractedReports",f.listOrder="",f.listOrderAsc=null,f.selectedExtractedReports=[],f.query={fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{extractedReport:e,extractedReports:f.extractedReports.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.downloadfile2=function(s,e){return m.analyticExtractedReport.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.savename;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("extractedReport")+"?").htmlContent("<b>"+(e.name||"extractedReport")+"</b> will be deleted.").ariaLabel("delete extractedReport").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getExtractedReports=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.analyticExtractedReport.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ExtractedReports",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditExtractedReport=function(e,n){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{extractedReport:n,extractedReports:f.extractedReports.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteExtractedReport=y,f.exportSelectedExtractedReports=function(){var e=angular.copy(f.selectedExtractedReports);return f.selectedExtractedReports=[],e},f.deleteSelectedExtractedReports=function(e){var n=i.confirm().title("Are you sure want to delete the selected extractedReports?").htmlContent("<b>"+f.selectedExtractedReports.length+" selected</b> will be deleted.").ariaLabel("delete ExtractedReports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedExtractedReports.forEach(function(e){y(e)}),f.selectedExtractedReports=[]})},f.deselectExtractedReports=function(){f.selectedExtractedReports=[]},f.selectAllExtractedReports=function(){f.selectedExtractedReports=f.extractedReports.rows};var b=!0,A=1;function E(e){f.extractedReports=e||{count:0,rows:[]}}function y(e){m.analyticExtractedReport.delete({id:e.id}).$promise.then(function(){_.remove(f.extractedReports.rows,{id:e.id}),f.extractedReports.count-=1,f.extractedReports.rows.length||f.getExtractedReports(),p.success({title:_.startCase("ExtractedReport")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticExtractedReport"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEanalyticExtractedReport",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getExtractedReports())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","extractedReports","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.analytics").controller("ExtractedReportsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="ANALYTICS.EDIT_METRIC",g.metric=angular.copy(l),g.metrics=r,g.newMetric=!1,g.metric||(g.metric={table:"report_agent"},g.title="ANALYTICS.NEW_METRIC",g.newMetric=!0),g.addNewMetric=function(){g.errors=[],d.analyticMetric.save(g.metric).$promise.then(function(e){g.metrics.unshift(e.toJSON()),o.success({title:"Metric properly created",msg:g.metric.name?g.metric.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMetric=function(){g.errors=[],d.analyticMetric.update({id:g.metric.id},g.metric).$promise.then(function(e){var n=_.find(g.metrics,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Metric properly saved!",msg:g.metric.name?g.metric.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMetric=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The metric will be deleted.").ariaLabel("Delete Metric").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.analyticMetric.delete({id:g.metric.id}).$promise.then(function(){_.remove(g.metrics,{id:g.metric.id}),o.success({title:"Metric properly deleted!",msg:(g.metric.name||"metric")+" has been deleted!"}),v(g.metric)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","metrics","metric","api","Auth","license","setting","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditMetricDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.metrics=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="metrics",f.listOrder="",f.listOrderAsc=null,f.selectedMetrics=[],f.query={fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,page:1},f.arraytable=_.keyBy([{option:"Agent Report",value:"'report_agent'"},{option:"Call Report",value:"'report_call'"},{option:"CDR",value:"'cdr'"},{option:"Chat Website",value:"'chat_websites'"},{option:"Chat Interaction",value:"'chat_interactions'"},{option:"Chat Messages",value:"'chat_messages'"},{option:"Chat Offline Messages",value:"'chat_offline_messages'"},{option:"Chat Queues",value:"'chat_queues'"},{option:"Chat Report Queue",value:"'report_chat_queue'"},{option:"Chat Report Transfer",value:"'report_chat_transfer'"},{option:"Companies",value:"'cm_companies'"},{option:"Call transfer report",value:"'report_call_transfer'"},{option:"Contacts",value:"'cm_contacts'"},{option:"CSquare Report",value:"'report_square'"},{option:"CSquare Details Report",value:"'report_square_details'"},{option:"Dial Report",value:"'report_dial'"},{option:"Dialer Hopper Processing",value:"'cm_hopper'"},{option:"Dialer Hopper Logs",value:"'cm_hopper_history'"},{option:"Dialer Hopper Final",value:"'cm_hopper_final'"},{option:"Email Account",value:"'mail_accounts'"},{option:"Email Interaction",value:"'mail_interactions'"},{option:"Email Messages",value:"'mail_messages'"},{option:"Email Queues",value:"'mail_queues'"},{option:"Email Report Queue",value:"'report_mail_queue'"},{option:"Email Report Transfer",value:"'report_mail_transfer'"},{option:"Fax Account",value:"'fax_accounts'"},{option:"Fax Interaction",value:"'fax_interactions'"},{option:"Fax Messages",value:"'fax_messages'"},{option:"Fax Queues",value:"'fax_queues'"},{option:"Fax Report Queue",value:"'report_fax_queue'"},{option:"Fax Report Transfer",value:"'report_fax_transfer'"},{option:"Jscripty Sessions",value:"'report_jscripty_sessions'"},{option:"Jscripty Questions",value:"'report_jscripty_questions'"},{option:"Jscripty Answers",value:"'report_jscripty_answers'"},{option:"Lists",value:"'cm_lists'"},{option:"Member Report",value:"'report_member'"},{option:"Openchannel Account",value:"'openchannel_accounts'"},{option:"Openchannel Interaction",value:"'openchannel_interactions'"},{option:"Openchannel Messages",value:"'openchannel_messages'"},{option:"Openchannel Queues",value:"'openchannel_queues'"},{option:"Openchannel Report Queue",value:"'report_openchannel_queue'"},{option:"Openchannel Report Transfer",value:"'report_openchannel_transfer'"},{option:"Queue Report",value:"'report_queue'"},{option:"SMS Account",value:"'sms_accounts'"},{option:"SMS Interaction",value:"'sms_interactions'"},{option:"SMS Messages",value:"'sms_messages'"},{option:"SMS Queues",value:"'sms_queues'"},{option:"SMS Report Queue",value:"'report_sms_queue'"},{option:"SMS Report Transfer",value:"'report_sms_transfer'"},{option:"Users",value:"'users'"},{option:"Voice Recordings",value:"'voice_recordings'"},{option:"Whatsapp Account",value:"'whatsapp_accounts'"},{option:"Whatsapp Interaction",value:"'whatsapp_interactions'"},{option:"Whatsapp Messages",value:"'whatsapp_messages'"},{option:"Whatsapp Queues",value:"'whatsapp_queues'"},{option:"Whatsapp Report Queue",value:"'report_whatsapp_queue'"},{option:"Whatsapp Report Transfer",value:"'report_whatsapp_transfer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{metric:e,metrics:f.metrics.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("metric")+"?").htmlContent("<b>"+(e.name||"metric")+"</b> will be deleted.").ariaLabel("delete metric").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMetrics=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.analyticMetric.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Metrics",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMetric=function(e,n){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{metric:n,metrics:f.metrics.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMetric=y,f.exportSelectedMetrics=function(){var e=angular.copy(f.selectedMetrics);return f.selectedMetrics=[],e},f.deleteSelectedMetrics=function(e){var n=i.confirm().title("Are you sure want to delete the selected metrics?").htmlContent("<b>"+f.selectedMetrics.length+" selected</b> will be deleted.").ariaLabel("delete Metrics").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMetrics.forEach(function(e){y(e)}),f.selectedMetrics=[]})},f.deselectMetrics=function(){f.selectedMetrics=[]},f.selectAllMetrics=function(){f.selectedMetrics=f.metrics.rows};var b=!0,A=1;function E(e){f.metrics=e||{count:0,rows:[]}}function y(e){m.analyticMetric.delete({id:e.id}).$promise.then(function(){_.remove(f.metrics.rows,{id:e.id}),f.metrics.count-=1,f.metrics.rows.length||f.getMetrics(),p.success({title:_.startCase("Metric")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticMetric"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEanalyticMetric",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMetrics())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","metrics","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.analytics").controller("MetricsController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o){var r=this;function l(){n.hide()}r.errors=[],r.report=angular.copy(t),r.report.name+="-copy",r.treeCustomData=o,r.treeCustomConfig={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},r.treeCustomEvents={select_node:function(e,n){r.currentNode=n.node}},r.copyReport=function(){var t;r.errors=[],i.analyticCustomReport.save({name:r.report.name,description:r.report.description,table:r.report.table,conditions:r.report.conditions,joins:r.report.joins,parent:r.currentNode.id}).$promise.then(function(e){t=e,a.success({title:"Report properly copied!",msg:r.report.name?r.report.name+" has been copied!":""});var n={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return n["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=r.report.id,i.analyticFieldReport.get(n).$promise}).then(function(e){var e=_.map(e.rows,function(e){return _.extend({},e,{CustomReportId:t.id})});return i.analyticFieldReport.bulkCreate(e).$promise}).then(function(){a.success({title:"Fields copied!",msg:"Fields has been copied!"}),l()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:COPYREPORT",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","treeCustomData"],angular.module("app.analytics").controller("CopyReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){n.hide()}c.errors=[],c.joinTables=[],c.title="ANALYTICS.EDIT_REPORT",c.crudPermissions=d,c.report=angular.copy(i),c.reports=a,c.newReport=!1,c.tables=l.getMap(),c.joinTypes=[{key:"join",value:"Join"},{key:"left_join",value:"Left Join"},{key:"right_join",value:"Right Join"},{key:"cross_join",value:"Cross Join"}],c.report||(c.report={name:"",table:"report_agent",description:"",parent:r.id},c.title="ANALYTICS.NEW_REPORT",c.newReport=!0),c.addNewReport=function(){c.errors=[],c.report.joins=_.map(c.joinTables||[],function(e){return{parentKey:e.parentKey,foreignTable:e.name,foreignKey:e.foreignKey,type:e.type.toLowerCase()}}),c.report.joins=JSON.stringify(c.report.joins),s[o].save(c.report).$promise.then(function(e){c.reports.unshift(e),t.success({title:"Report properly created",msg:c.report.name?c.report.name+" has been created!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.save"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveReport=function(){c.errors=[],s[o].update({id:c.report.id},c.report).$promise.then(function(e){var n=_.find(c.reports,{id:e.id});n&&_.merge(n,e),t.success({title:"Report properly saved!",msg:c.report.name?c.report.name+" has been saved!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.update"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticReport.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteReport=function(){c.errors=[];var e=n.confirm().title("Are you sure?").content("The report will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(event);n.show(e).then(function(){s[o].delete({id:c.report.id}).$promise.then(function(){_.remove(c.reports,{id:c.report.id}),t.success({title:"Report properly deleted!",msg:c.report.name?c.report.name+" has been deleted!":""}),m()}).catch(function(e){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.delete"}]})},function(){})},c.closeDialog=m,c.selectedTableChange=function(e){e&&(delete c.selectedItem,c.joinTables.push(e))},c.removeJoin=function(e){c.joinTables.splice(e,1)},c.getFields=function(n,t,e){var a=_.find(c.tables,{name:e});a&&a.api&&s[a.api].describe().$promise.then(function(e){n[t]=_.difference(_.keys(e),["$promise","$resolved"])}).catch(function(e){console.error(e)})}}e.$inject=["$location","$mdDialog","toasty","reports","report","api","apiName","currentNode","describeTable","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditReportDialogController",e)}(),function(){"use strict";function e(i,s,o,e){var r=this;r.report={},r.conditions=e.getConditions,r.init=function(e,n){r.report=e,r.report.condition=angular.fromJson(e.conditions)||{group:{operator:"AND",rules:[]}},r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1};for(var t=0;t<r.report.condition.group.rules.length;t++)if(r.report.condition.group.rules[t].field){var a=r.report.condition.group.rules[t].field.split(".");1===a.length&&(r.report.condition.group.rules[t].field=r.report.table+"."+r.report.condition.group.rules[t].field)}s.getColumns(r.report.table).then(function(e){r.columns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt"])}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data):e.toString()})})},r.addCondition=function(e){e.unshift({condition:"=",field:"",value:""})},r.addGroup=function(e){e.push({group:{operator:"AND",rules:[]}})},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the item?").htmlContent("The item will be deleted.").ariaLabel("delete item").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){e.splice(n,1)},function(){console.log("CANCEL")})},r.isValueByCondition=function(e){return!_.includes(["IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"],e)}}e.$inject=["$mdDialog","describeTable","toasty","sqlUtil"],angular.module("app.analytics").controller("ReportConditionsController",e)}(),function(){"use strict";function e(a){var i={report_call_transfer:"voiceTransferReport",cm_companies:"cmCompany",cm_contacts:"cmContact",cm_hopper:"cmHopper",cm_hopper_final:"cmHopperFinal",cm_hopper_history:"cmHopperHistory",cm_lists:"cmList",chat_websites:"chatWebsite",chat_queues:"chatQueue",chat_interactions:"chatInteraction",chat_messages:"chatMessage",chat_offline_messages:"chatOfflineMessage",report_chat_queue:"chatQueueReport",report_chat_transfer:"chatTransferReport",mail_accounts:"mailAccount",mail_queues:"mailQueue",mail_interactions:"mailInteraction",mail_messages:"mailMessage",report_mail_queue:"mailQueueReport",report_mail_transfer:"mailTransferReport",openchannel_accounts:"openchannelAccount",openchannel_queues:"openchannelQueue",openchannel_interactions:"openchannelInteraction",openchannel_messages:"openchannelMessage",report_openchannel_queue:"openchannelQueueReport",report_openchannel_transfer:"openchannelTransferReport",sms_accounts:"smsAccount",sms_queues:"smsQueue",sms_interactions:"smsInteraction",sms_messages:"smsMessage",report_sms_queue:"smsQueueReport",report_sms_transfer:"smsTransferReport",fax_accounts:"faxAccount",fax_queues:"faxQueue",fax_interactions:"faxInteraction",fax_messages:"faxMessage",report_fax_transfer:"faxTransferReport",report_fax_queue:"faxQueueReport",report_call:"voiceCallReport",report_agent:"voiceAgentReport",report_square:"squareReport",report_member:"memberReport",report_queue:"voiceQueueReport",report_square_details:"squareReportDetail",report_dial:"voiceDialReport",report_jscripty_sessions:"jscriptySessionReport",report_jscripty_questions:"jscriptyQuestionReport",report_jscripty_answers:"jscriptyAnswerReport",users:"user",voice_recordings:"voiceRecording",cdr:"cdr",whatsapp_accounts:"whatsappAccount",whatsapp_queues:"whatsappQueue",whatsapp_interactions:"whatsappInteraction",whatsapp_messages:"whatsappMessage",report_whatsapp_queue:"whatsappQueueReport",report_whatsapp_transfer:"whatsappTransferReport"};return{getMap:function(){var t=[];return _.forIn(i,function(e,n){t.push({name:n,api:e})}),t},getColumns:function(e){var n=i[e],t={};return"cm_contacts"===e&&(t.analytics=!0),a[n].describe(t).$promise}}}e.$inject=["api"],angular.module("app.analytics").factory("describeTable",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;(u.errors=[],u.title="Edit Report Field",u.report=i,u.reportField=angular.copy(o),u.reportFields=s,u.metrics=r,u.columns=l,u.sqlUtil=d,u.newReportField=!1,u.crudPermissions=m,u.reportField)?(u.reportField.type=u.reportField.custom?"custom":u.reportField.MetricId?"metric":"column",u.reportField.field&&!u.reportField.custom&&_.isNil(u.reportField.MetricId)&&1===u.reportField.field.split(".").length&&(u.reportField.field=u.report.table+"."+u.reportField.field)):(u.reportField={type:"column",function:null,format:null,groupBy:!1,orderBy:null},u.title="New Report Field",u.newReportField=!0);function p(){t.hide()}u.addNewReportField=function(){u.errors=[],u.reportField.custom="custom"===u.reportField.type,u.reportField.MetricId="metric"===u.reportField.type?u.reportField.MetricId:null,u.reportField.CustomReportId=u.report.id,c.analyticFieldReport.save(u.reportField).$promise.then(function(e){u.reportFields.push(e),a.success({title:"Report field properly created",msg:u.reportField.field?u.reportField.field+" has been created!":u.reportField.type+" has been created!"}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticFieldReport.save"}]})},u.saveReportField=function(){u.errors=[],u.reportField.custom="custom"===u.reportField.type,u.reportField.MetricId="metric"===u.reportField.type?u.reportField.MetricId:null,c.analyticFieldReport.update({id:u.reportField.id},u.reportField).$promise.then(function(e){var n=_.find(u.reportFields,{id:e.id});n&&_.merge(n,e),a.success({title:"Report Field properly saved!",msg:u.reportField.field?u.reportField.field+" has been saved!":""}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticFieldReport.update"}]})},u.deleteReportField=function(e){u.errors=[];var n=t.confirm().title("Are you sure?").content("The field will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){c.analyticFieldReport.delete({id:u.reportField.id}).$promise.then(function(){_.remove(u.reportFields,{id:u.reportField.id}),a.success({title:"Report Field properly deleted!",msg:u.reportField.field?u.reportField.field+" has been deleted!":""}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReportField.delete"}]})},function(){})},u.closeDialog=p}e.$inject=["$scope","$location","$mdDialog","toasty","report","reportFields","reportField","metrics","columns","sqlUtil","api","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditReportFieldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;c.report={},c.reportFields={count:0,rows:[]},c.functions=_.keyBy(l.getFunctions,"value"),c.formats=_.keyBy(l.getFormats,"value"),c.groupBy=_.keyBy(l.getGroupBy,"value"),c.orderBy=_.keyBy(l.getOrderBy,"value"),c.selectedReportFields=[],c.query={fields:"createdAt,updatedAt,id,field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0},c.sortableTable={animation:100,onSort:function(e){o.analyticFieldReport.addFields({id:c.report.id},e.models).$promise.then(function(e){c.reportFields.rows=e}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDFIELDS"})})}},c.init=function(e,n){c.report=e,c.query.CustomReportId=c.report.id,c.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},c.sortableTable.disabled=!c.crudPermissions.canEdit,r.getColumns(c.report.table).then(function(e){return c.columns=_.difference(_.keys(e),["$promise","$resolved"]),o.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise}).then(function(e){c.metrics=e.rows}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.getReportFields()},c.deleteConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>"+e.field+"</b> will be deleted.").ariaLabel("delete field").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){p(e)},function(){console.log("CANCEL")})},c.success=u,c.getReportFields=function(){c.promise=o.analyticFieldReport.get(c.query,u).$promise},c.createOrEditReportField=function(e,n){a.show({controller:"CreateOrEditReportFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/edit/field/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:c.report,reportField:n,reportFields:c.reportFields.rows,metrics:c.metrics,columns:c.columns,setting:null,crudPermissions:c.crudPermissions}})},c.deleteReportField=p,c.deleteSelectedReportFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+c.selectedReportFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){c.selectedReportFields.forEach(function(e){p(e)}),c.selectedReportFields=[]})},c.getMetricName=function(e){var n=_.find(c.metrics,{id:e});return n?n.name:d.instant("ANALYTICS.NO_METRIC_FOUND")},c.getMetricValue=function(e){var n=_.find(c.metrics,{id:e});return n?n.metric:d.instant("ANALYTICS.NO_METRIC_FOUND")};var m=!0;function u(e){c.reportFields=e||{count:0,rows:[]}}function p(e){o.analyticFieldReport.delete({id:e.id}).$promise.then(function(){c.selectedReportFields=[],_.remove(c.reportFields.rows,{id:e.id}),c.reportFields.count-=1,c.reportFields.rows.length||c.getReportFields(),s.success({title:"Field deleted!",msg:e.field?e.field+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}n.$watch("vm_rf.query.filter",function(e,n){m?t(function(){m=!1}):c.getReportFields()})}e.$inject=["$cookies","$scope","$timeout","$mdDialog","$document","toasty","api","describeTable","sqlUtil","$translate"],angular.module("app.analytics").controller("ReportFieldsController",e)}(),function(){"use strict";angular.module("app.analytics").factory("sqlUtil",function(){return{getFunctions:[{value:"SUM",option:function(e){return"SUM ("+e+")"}},{value:"COUNT",option:function(e){return"COUNT ("+e+")"}},{value:"COUNT DISTINCT",option:function(e){return"COUNT (DISTINCT "+e+")"}},{value:"MAX",option:function(e){return"MAX ("+e+")"}},{value:"MIN",option:function(e){return"MIN ("+e+")"}},{value:"AVG",option:function(e){return"AVG ("+e+")"}},{value:"GROUP_CONCAT",option:function(e){return"GROUP_CONCAT ("+e+")"}},{value:"GROUP_CONCAT ASC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" ASC)"}},{value:"GROUP_CONCAT DESC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" DESC)"}}],getFormats:[{value:"SEC_TO_TIME",option:function(e){return"SEC_TO_TIME ("+e+")"}},{value:"DATE",option:function(e){return"DATE ("+e+")"}},{value:"HOUR",option:function(e){return"HOUR ("+e+")"}},{value:"ROUND",option:function(e){return"ROUND ("+e+")"}},{value:"UNIX_TIMESTAMP",option:function(e){return"UNIX_TIMESTAMP ("+e+")"}}],getGroupBy:[{value:!1,option:function(){return"No"}},{value:!0,option:function(e){return"GROUP BY "+e}}],getOrderBy:[{value:"ASC",option:function(e){return"ORDER BY "+e+" ASC"}},{value:"DESC",option:function(e){return"ORDER BY "+e+" DESC"}}],getConditions:["=","!=","<","<=",">",">=","LIKE","NOT LIKE","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"]}})}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;function r(e){return _.isArray(e)}o.report=a||{},o.userProfileSection=s&&1==s.count?s.rows[0]:null,o.crudPermissions=i.parseCrudPermissions(o.userProfileSection?o.userProfileSection.crudPermissions:null),o.selectedTab=e.params.tab||0,o.gotoReports=function(){e.go("app.analytics.reports",{},{reload:"app.analytics.reports"})},o.saveReport=function(){o.report.conditions=angular.toJson(o.report.condition),t.analyticCustomReport.update({id:o.report.id},_.omit(o.report,"joins")).$promise.then(function(){n.success({title:"Report updated!",msg:o.report.name?o.report.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETreport",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.previewReport=function(){o.columns=[],o.rows=[],o.error=!1,t.analyticFieldReport.get({fields:"field,alias",nolimit:!0,CustomReportId:o.report.id}).$promise.then(function(e){return o.columns=e?e.rows:[],t.analyticCustomReport.preview({id:o.report.id}).$promise}).then(function(e){o.rows=e}).catch(function(e){console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(o.error)})},o.queryReport=function(){return o.queryResult="Loading...",t.analyticCustomReport.query({id:o.report.id}).$promise.then(function(e){o.queryResult=e.sql}).catch(function(e){o.queryResult="",console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(o.error)})},o.mapArray=function(e,n){if(r(e))return _.map(e,n).join(",");return""},o.isArray=r,o.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n}}e.$inject=["$state","toasty","api","report","Auth","userProfileSection"],angular.module("app.analytics").controller("ReportController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.errors=[],o.report=angular.copy(a),o.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n},o.closeDialog=function(){n.hide()},function(){o.columns=[],o.rows=[],o.error=!1;var e={fields:"field,alias",nolimit:!0};e["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=o.report.id,o.promise=i.analyticFieldReport.get(e).$promise.then(function(e){return o.columns=e?e.rows:[],i[s].preview({id:o.report.id}).$promise}).then(function(e){o.rows=e}).catch(function(e){console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},t.error(o.error)})}()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName"],angular.module("app.analytics").controller("PreviewReportDialogController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,n,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.reports={count:0,rows:[]},p.userProfile=r,p.userProfileSection=l&&1==l.count?l.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.selectedReports=[],p.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},p.apiName=null,p.currentPath="",p.customTree=!0,p.editstate=function(e,n){s.go("app.analytics.reports.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.copydialog=function(e,n){i.show({controller:"CopyReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/copy/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,treeCustomData:p.treeCustomInstance.jstree(!0).get_json("#")}}).finally(function(){})},p.previewdialog=function(e,n){i.show({controller:"PreviewReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/preview/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName}})},p.rundialog=function(e,n){i.show({controller:"RunReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,currentPath:p.currentPath}})},p.downloadfile=function(a,e){var i;d.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise.then(function(e){i=_.keyBy(e.rows,"id");var n={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return n["analyticCustomReport"===p.apiName?"CustomReportId":"DefaultReportId"]=a.id,d.analyticFieldReport.get(n).$promise}).then(function(e){for(var n=0;n<e.rows.length;n+=1)e.rows[n].MetricId&&(e.rows[n].field=i[e.rows[n].MetricId].metric,e.rows[n].custom=!0),delete e.rows[n].MetricId;var t=o.document.createElement("a");t.href="data:text/json;charset=utf-8,"+o.encodeURIComponent(angular.toJson({name:a.name,description:a.description,table:a.table,conditions:a.conditions,joins:a.joins,fields:e.rows})),t.download=a.name+".json",t.target="_self",t.click(),m.success({title:"Report downloaded!",msg:a.name?a.name+" has been downloaded!":""})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DOWNLOADJSON",msg:e.data?JSON.stringify(e.data):e.toString()})})},p.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the report?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete report").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){b(e)},function(){console.log("CANCEL")})},p.success=h,p.getReports=f,p.createOrEditReport=function(e,n){i.show({controller:"CreateOrEditReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:n,reports:p.reports.rows,apiName:p.apiName,currentNode:p.currentNode,setting:null,crudPermissions:p.crudPermissions}})},p.importReport=function(e,n,t){if("application/json"===e.file.type){var a=new FileReader;a.onload=function(e){console.log(e.target.result);try{var t=atob(e.target.result.split(",")[1]);t=angular.fromJson(t),d.analyticCustomReport.save({name:t.name,description:t.description,table:t.table,conditions:t.conditions,joins:t.joins,parent:p.currentNode.id}).$promise.then(function(n){p.reports.rows.unshift(n),m.success({title:"Report saved!",msg:n.name?n.name+" has been saved!":""});var e=_.map(t.fields,function(e){return _.extend({},e,{CustomReportId:n.id})});return d.analyticFieldReport.bulkCreate(e).$promise}).then(function(e){m.success({title:"Fields saved!",msg:"Fields has been saved!"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETanalyticReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}catch(e){console.error(e),m.error({title:"Decode File Error",msg:e.toString()})}},a.readAsDataURL(e.file)}else m.error({title:"Format Error",msg:"Please use only json files"})},p.deleteReport=b,p.exportSelectedReports=function(){var e=angular.copy(p.selectedReports);return p.selectedReports=[],e},p.deleteSelectedReports=function(e){var n=i.confirm().title("Are you sure want to delete the selected reports?").htmlContent("<b>"+p.selectedReports.length+" selected</b> will be deleted.").ariaLabel("delete Reports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){p.selectedReports.forEach(function(e){b(e)}),p.selectedReports=[]})},p.deselectReports=function(){p.selectedReports=[]},p.selectAllReports=function(){p.selectedReports=p.reports.rows},p.treeDefaultData=c.rows[0]?angular.fromJson(c.rows[0].tree):[],p.treeCustomData=c.rows[1]?angular.fromJson(c.rows[1].tree):[],p.treeDefaultConfig=S(!1),p.treeCustomConfig=S(!0),p.treeDefaultEvents=T(!1),p.treeCustomEvents=T(!0);var g=!0,v=1;function h(e){p.reports=e||{count:0,rows:[]}}function f(){if(p.query.offset=(p.query.page-1)*p.query.limit,p.apiName)if("admin"===p.currentUser.role||p.userProfileSection.autoAssociation)p.promise=d[p.apiName].get(p.query,h).$promise;else{var a=[];p.promise=d[p.apiName].get(p.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:p.userProfileSection.id,type:"analyticDefaultReport"===p.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),h({count:t.length,rows:t})}return h(null)}):h(null)})}}function b(e){p.apiName&&d[p.apiName].delete({id:e.id}).$promise.then(function(){_.remove(p.reports.rows,{id:e.id}),p.reports.count-=1,p.reports.rows.length||p.getReports(),m.success({title:"Report deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.analyticreport.delete"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticreport.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function A(e,n){p.treeDefaultInstance.jstree(!0).deselect_all(),p.treeDefaultInstance.jstree(!0).close_all(),p.currentNode=n.node,p.currentNode.custom=!0,p.currentPath=p.treeCustomInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticCustomReport",p.query.parent=n.node.id,f()}function E(e,n){p.treeCustomInstance.jstree(!0).deselect_all(),p.treeCustomInstance.jstree(!0).close_all(),p.currentNode=n.node,p.currentNode.custom=!1,p.currentPath=p.treeDefaultInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticDefaultReport",p.query.parent=n.node.id,f()}function y(e,n){var t,a,i;"rename_node"===e.type&&(a=(t=n).node.id,i="","custom"===t.node.parent?t.node.id.includes("custom_report_")||(i="custom_report_"+t.text):i=t.node.parent+"_"+t.text,p.treeCustomInstance.jstree(!0).set_id(t.node,"custom_report_"+i.toLowerCase()),t.node.a_attr.id=t.node.a_attr.id.replace(a,t.node.id),t.node.li_attr.id=t.node.id);var s=angular.toJson(p.treeCustomInstance.jstree(!0).get_json("#"));d.analyticTreeReport.update({id:2,tree:s}).$promise.then(function(){c.rows[1]&&(c.rows[1].tree=s),m.success({title:"Node Updated",msg:n.node.text?n.node.text+" has been updated!":"Node has been updated!"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEanalyticTreeReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}function S(e){return{core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:e?["contextmenu","dnd","search","state","wholerow"]:["search","state","wholerow"],contextmenu:{items:function(t){var e={};return p.crudPermissions.canEdit&&_.assign(e,{create:{label:n.instant("ANALYTICS.CREATE"),action:function(){t=p.treeCustomInstance.jstree(!0).create_node(t),p.treeCustomInstance.jstree(!0).edit(t)}},rename:{_disabled:"#"===t.parent,label:n.instant("ANALYTICS.RENAME"),action:function(){p.treeCustomInstance.jstree(!0).edit(t)}}}),p.crudPermissions.canDelete&&_.assign(e,{remove:{_disabled:"#"===t.parent,label:n.instant("ANALYTICS.REMOVE"),action:function(){var e=i.confirm().title("Are you sure want to delete the node?").htmlContent("<b>"+(t.text?t.text:"Node")+"</b> and its subnode will be deleted.").ariaLabel("delete node").ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n=p.treeCustomInstance.jstree(!0).get_parent(t);n=p.treeCustomInstance.jstree(!0).get_node(n),p.treeCustomInstance.jstree(!0).delete_node(t),e=[t.id].concat(t.children_d||[]),d.analyticCustomReport.get({parent:e.join(","),fields:"id,name"}).$promise.then(function(e){e&&e.rows&&e.rows.forEach(function(e){b(e)})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEreportsByParents",msg:e.data?JSON.stringify(e.data):e.toString()})}),p.treeCustomInstance.jstree(!0).select_node(n)})}}}),e}}}}function T(e){return e?{create_node:y,rename_node:y,move_node:y,delete_node:y,select_node:A}:{select_node:E}}e.$watch("vm.query.filter",function(e,n){g?t(function(){g=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getReports())}),e.$watch("vm.search",function(e,n){p.treeDefaultInstance&&p.treeDefaultInstance.jstree(!0).search(e),p.treeCustomInstance&&p.treeCustomInstance.jstree(!0).search(e)})}e.$inject=["$scope","$timeout","$document","$mdDialog","$state","$window","$translate","userProfile","userProfileSection","api","treeReports","toasty","Auth"],angular.module("app.analytics").controller("ReportsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r){var l=this;function d(){l.export={id:l.report.id,name:l.report.name,startTime:new Date(moment().startOf("day")),startDate:new Date(moment().startOf("day")),endTime:new Date(moment().endOf("day")),endDate:new Date(moment().endOf("day")),output:"xlsx",fullPath:r?r+"/"+l.report.name:l.report.name}}function c(){t.hide()}l.errors=[],l.report=angular.copy(n),l.export={},l.runReport=function(n){l.export.name=l.export.name.replace(/\//g,"_"),l.errors=[],l.exportDate=_.assign({},l.export,{startDate:moment(l.export.startDate).set("hour",l.export.startTime.getHours()).set("minute",l.export.startTime.getMinutes()).set("second",l.export.startTime.getSeconds()).format("YYYY-MM-DD HH:mm:ss"),endDate:moment(l.export.endDate).set("hour",l.export.endTime.getHours()).set("minute",l.export.endTime.getMinutes()).set("second",l.export.endTime.getSeconds()).format("YYYY-MM-DD HH:mm:ss")}),i[s].run(l.exportDate).$promise.then(function(e){"web"===l.export.output?t.show({controller:"WebReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/web/dialog.html",parent:angular.element(o.body),targetEvent:n,skipHide:!0,locals:{apiName:s,exportDate:l.exportDate,results:e},resolve:{columns:["apiResolver",function(e){var n={fields:"field,alias",nolimit:!0};return n["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=l.report.id,e.resolve("analyticFieldReport@get",n)}]}}):(a.success({title:"Report properly run!",msg:l.report.name?l.report.name+" has been run!":""}),c())}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.closeDialog=c,(l.refreshDate=d)()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","$document","currentPath"],angular.module("app.analytics").controller("RunReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o){var r=this;function l(e){r.results=e||{count:0,rows:[]}}r.errors=[],r.columns=a?a.rows:[],r.results=i||{rows:[],count:0},r.query={limit:10,page:1},r.closeDialog=function(){e.hide()},r.getResults=function(){o.offset=(r.query.page-1)*r.query.limit,o.limit=r.query.limit,r.promise=t[s].run(o,l).$promise},r.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n}}e.$inject=["$mdDialog","toasty","api","columns","results","apiName","exportDate"],angular.module("app.analytics").controller("WebReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CALLYSQUARE.EDIT_ODBC",g.odbc=angular.copy(l),g.odbcs=r,g.newOdbc=!1,g.odbc||(g.odbc={},g.title="CALLYSQUARE.NEW_ODBC",g.newOdbc=!0),g.addNewOdbc=function(){g.errors=[],d.squareOdbc.save(g.odbc).$promise.then(function(e){g.odbcs.unshift(e.toJSON()),o.success({title:"Odbc properly created",msg:g.odbc.name?g.odbc.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOdbc=function(){g.errors=[],d.squareOdbc.update({id:g.odbc.id},g.odbc).$promise.then(function(e){var n=_.find(g.odbcs,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Odbc properly saved!",msg:g.odbc.name?g.odbc.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOdbc=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The odbc will be deleted.").ariaLabel("Delete Odbc").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.squareOdbc.delete({id:g.odbc.id}).$promise.then(function(){_.remove(g.odbcs,{id:g.odbc.id}),o.success({title:"Odbc properly deleted!",msg:(g.odbc.name||"odbc")+" has been deleted!"}),v(g.odbc)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","odbcs","odbc","api","Auth","license","setting","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditOdbcDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.odbcs=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="odbcs",f.listOrder="",f.listOrderAsc=null,f.selectedODBC=[],f.query={fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{odbc:e,odbcs:f.odbcs.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.testtestOdbc=function(e,n){return m.squareOdbc.test({id:e.id}).$promise.then(function(){p.success({title:"Square ODBC properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"Square ODBC properly tested",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("odbc")+"?").htmlContent("<b>"+(e.name||"odbc")+"</b> will be deleted.").ariaLabel("delete odbc").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getODBC=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.squareOdbc.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ODBC",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOdbc=function(e,n){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{odbc:n,odbcs:f.odbcs.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOdbc=y,f.exportSelectedODBC=function(){var e=angular.copy(f.selectedODBC);return f.selectedODBC=[],e},f.deleteSelectedODBC=function(e){var n=i.confirm().title("Are you sure want to delete the selected odbcs?").htmlContent("<b>"+f.selectedODBC.length+" selected</b> will be deleted.").ariaLabel("delete Odbcs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedODBC.forEach(function(e){y(e)}),f.selectedODBC=[]})},f.deselectODBC=function(){f.selectedODBC=[]},f.selectAllODBC=function(){f.selectedODBC=f.odbcs.rows};var b=!0,A=1;function E(e){f.odbcs=e||{count:0,rows:[]}}function y(e){m.squareOdbc.delete({id:e.id}).$promise.then(function(){_.remove(f.odbcs.rows,{id:e.id}),f.odbcs.count-=1,f.odbcs.rows.length||f.getODBC(),p.success({title:_.startCase("Odbc")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareOdbc"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsquareOdbc",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getODBC())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","odbcs","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.callysquare").controller("OdbcsController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o,r,l,d){var c=this;function m(e){n.hide(e)}c.errors=[],c.title="CALLYSQUARE.EDIT_PROJECT",c.crudPermissions=d,c.project=angular.copy(o),c.newWindow=!0,c.projects=s,c.newProject=!1,c.openFromEditor=l,c.project||(c.project={name:"",description:""},c.title="CALLYSQUARE.NEW_PROJECT",c.newProject=!0),c.addNewProject=function(){c.errors=[],r.squareProject.save(c.project).$promise.then(function(e){c.projects.unshift(e),i.success({title:"Project properly created",msg:c.project.name?c.project.name+" has been created!":""}),m(e),c.openFromEditor&&(c.newWindow?t.open("/callysquare/projects/"+e.id,"_blank"):a.go("app.callysquare.projects.edit",{id:e.id}))}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareProject.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveProject=function(){c.errors=[],r.squareProject.update({id:c.project.id},c.project).$promise.then(function(e){var n=_.find(c.projects,{id:e.id});n&&_.merge(n,e),i.success({title:"Project properly saved!",msg:c.project.name?c.project.name+" has been saved!":""}),m(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareProject.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteProject=function(){c.errors=[];var e=n.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(event);n.show(e).then(function(){r.squareProject.delete({id:c.project.id}).$promise.then(function(){_.remove(c.projects,{id:c.project.id}),i.success({title:"Project properly deleted!",msg:c.project.name?c.project.name+" has been deleted!":""}),m(c.project)}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.delete"}]})},function(){})},c.closeDialog=m}e.$inject=["$mdDialog","$window","$state","Auth","toasty","projects","project","api","openFromEditor","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditSquareProjectDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S,T,I,O,C,w,R,x,N,D){var P=this,L={playback:["file_id"],answer:["timeout"],menu:["file_id","digit","response","retry"],getdigits:["file_id","variable_id","mindigit","maxdigit","retry"],getsecretdigits:["file_id","variable_id","mindigit","maxdigit","hiddendigitsnum","retry"],vswitch:["variable_id"],database:["odbc_id","query"],ext_dial:["trunk_name","phone","timeout"],set:["variable_id"],math:["variable_id"],gotoc:["context","extension","priority"],system:["command"],agi:["command"],gotoif:["condition"],saydigits:["digits"],saynumber:["number"],sayphonetic:["text"],record:["file","timeout"],goal:["goalname"],dial:["sip_id","timeout"],queue:["queue_id","timeout"],callback:["list_id","name","phone","delay"],gotoiftime:["interval_id"],voicemail:["mailbox"],subproject:["project_id"],sendSMS:["sms_account_id","to","sms_text"],sendMail:["account_id","to"],sendFax:["account_id","to","attachment_path"],google_cloud_tts:["apiKey","google_cloud_tts_text_type","text"],tts:["text"],ispeechtts:["text","key","speed"],ispeechasr:["key","timeout"],custom_app:["application"],googleasr:["key","timeout"],awspolly:["aws_access_key_id","aws_secret_access_key","text","aws_text_type"],lumenvoxtts:["text"],sestektts:["text"],lumenvoxasr:["grammar"],sestekasr:["grammar"],tildeasr:["appid","appsecret","uri"],login:["findBy"],pause:["findBy","pause_id"],unpause:["findBy"],logout:["findBy"],dialogflow:["key","text","dialogflow_language"],awslex:["aws_access_key_id","aws_secret_access_key","aws_lex_region","aws_bot_name","text"],sesteknda:["text","ndauth_url","username","password","ndassistant_url"],restapi:["url","method"],mrcpsynth:["text"],mrcprecog:["grammar"],dialogflowV2:["dialogflowV2_project_id","client_email","private_key","dialogflowV2_language","text"]},k={queue:["file_id"],database:["variable_id"],pause:["pause_id"]},M={sendMail:["to","cc","bcc"],voicemail:["mailbox"]};function U(e,n,t,a){return _.map(e,function(e){return{value:e[n],option:e[t],group:a?e[a]:void 0,canSelect:void 0===e.canSelect||e.canSelect}})}function F(){var e=Number(_.find(P.attributes,{name:"sip_id"}).value);if(!_.some(d,{id:e})&&0<e)return t.user.get({id:e,fields:"id,fullname,role"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,d.push(n),P.values.sip_id=U(d,"id","fullname","role")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_USER",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.sip_id=U(d,"id","fullname","role")}function $(){var e=Number(_.find(P.attributes,{name:"list_id"}).value);if(!_.some(E,{id:e})&&0<e)return t.cmList.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,E.push(n),P.values.list_id=U(E,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_LIST",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.list_id=U(E,"id","name")}function q(){var e=Number(_.find(P.attributes,{name:"trunk_id"}).value);if(!_.some(c,{id:e})&&0<e)return t.trunk.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,c.push(n),P.values.trunk_id=U(c,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.trunk_id=U(c,"id","name")}function G(){var e=_.find(P.attributes,{name:"trunk_name"}).value;if(!_.some(c,{name:e})&&e)return t.trunk.get({name:e,fields:"id,name"}).$promise.then(function(e){if(0<e.count&&0<e.rows.length){var n=e.rows[0];n.canSelect=!1,c.push(n),P.values.trunk_name=U(c,"name","name")}}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.trunk_name=U(c,"name","name")}function H(){var e=Number(_.find(P.attributes,{name:"queue_id"}).value);if(!_.some(m,{id:e})&&0<e)return t.voiceQueue.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,m.push(n),P.values.queue_id=U(m,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_QUEUE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.queue_id=U(m,"id","name")}function V(){var e=Number(_.find(P.attributes,{name:"file_id"}).value);if(!_.some(u,{id:e})&&0<e)return t.sound.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,u.push(n),P.values.file_id=U(u,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SOUND",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.file_id=U(u,"id","name")}function B(){var e=Number(_.find(P.attributes,{name:"variable_id"}).value);if(!_.some(p,{id:e})&&0<e)return t.variable.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,p.push(n),P.values.variable_id=U(p,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_VARIABLE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.variable_id=U(p,"id","name")}function Q(){var e=Number(_.find(P.attributes,{name:"odbc_id"}).value);if(!_.some(g,{id:e})&&0<e)return t.squareOdbc.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,g.push(n),P.values.odbc_id=U(g,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_ODBC",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.odbc_id=U(g,"id","name")}function W(){var e=Number(_.find(P.attributes,{name:"project_id"}).value);if(!_.some(v,{id:e})&&0<e)return t.squareProject.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,v.push(n),P.values.project_id=U(v,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PROJECT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.project_id=U(v,"id","name")}function j(){var e=Number(_.find(P.attributes,{name:"context"}).value);if(!_.some(h,{id:e})&&0<e)return t.voiceContext.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,h.push(n),P.values.context=U(h,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_CONTEXT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.context=U(h,"id","name")}function Y(){var e=Number(_.find(P.attributes,{name:"interval_id"}).value);if(!_.some(f,{id:e})&&0<e)return t.interval.get({id:e,fields:"id,name,IntervalId"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,f.push(n),P.values.interval_id=U(f,"id","name","IntervalId")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_INTERVAL",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.interval_id=U(f,"id","name","IntervalId")}function z(){var e=Number(_.find(P.attributes,{name:"account_id"}).value);if(!_.some(b,{id:e})&&0<e)return t.mailAccount.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,b.push(n),P.values.account_id=U(b,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_MAIL_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.account_id=U(b,"id","name")}function J(){var e=Number(_.find(P.attributes,{name:"sms_account_id"}).value);if(!_.some(O,{id:e})&&0<e)return t.smsAccount.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,O.push(n),P.values.sms_account_id=U(O,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SMS_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.sms_account_id=U(O,"id","name")}function K(){var e=Number(_.find(P.attributes,{name:"template_id"}).value);if(!_.some(A,{id:e})&&0<e)return t.template.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,A.push(n),P.values.template_id=U(A,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TEMPLATE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.template_id=U(A,"id","name")}function X(){var e=Number(_.find(P.attributes,{name:"pause_id"}).value);if(!_.some(C,{id:e})&&0<e)return t.pause.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,C.push(n),P.values.pause_id=U(C,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PAUSE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.pause_id=U(C,"id","name")}P.cellName=y.tagName,P.attributes=_.map(y.attributes,function(e){return{name:e.name,value:e.value,defaultValue:k[P.cellName]&&_.includes(k[P.cellName],e.name),required:L[P.cellName]&&_.includes(L[P.cellName],e.name),help:M[P.cellName]&&_.includes(M[P.cellName],e.name)}}),P.values={authMethod:[{value:"noauth",option:"NO AUTH"},{value:"hmac",option:"HMAC"}],answer:[{value:"yes",option:"Yes"},{value:"no",option:"No"}],ndagenerate_audio:[{value:1,option:"Yes"},{value:0,option:"No"}],ndaactivity_type:[{value:"message",option:"Message"},{value:"conversationUpdate",option:"Conversation Update"},{value:"contactRelationUpdate",option:"Contact Relation Update"},{value:"endOfConversation",option:"End of Conversation"}],hiddendigitspos:[{value:"first",option:"First"},{value:"last",option:"Last"}],recordingFormat:[{value:"wav",option:"Wav"},{value:"gsm",option:"Gsm"}],intkey:[{value:"#",option:"#"},{value:"*",option:"*"}],beep:[{value:"BEEP",option:"Yes"},{value:"NOBEEP",option:"No"}],model:e,ispeech_asr_language:i,ispeech_tts_language:o,languageCode:r,ssmlGender:[{value:"FEMALE",option:"Female"},{value:"MALE",option:"Male"}],google_tts_language:l,google_asr_language:s,google_cloud_tts_text_type:[{value:"text",option:"Text"},{value:"ssml",option:"SSML"}],aws_polly_region:I,aws_polly_voice:T,aws_text_type:[{value:"text",option:"Text"},{value:"ssml",option:"SSML"}],callback_priority:[{option:"Highest",value:4},{option:"High",value:3},{option:"Medium",value:2},{option:"Low",value:1},{option:"Lowest",value:0}],findBy:[{value:"internal",option:"Internal"},{value:"phone",option:"Phone"},{value:"mobile",option:"Mobile"}],dialogflow_language:w,dialogflowV2_language:R,aws_lex_region:x,method:[{value:"GET",option:"GET"},{value:"POST",option:"POST"},{value:"PUT",option:"PUT"},{value:"DELETE",option:"DELETE"}]},P.crudPermissions=D,P.onInit=function(){N.hasRole("admin")?(e={sip_id:U(d,"id","fullname","role"),trunk_name:U(c,"name","name"),trunk_id:U(c,"id","name"),queue_id:U(m,"id","name"),file_id:U(u,"id","name"),variable_id:U(p,"id","name"),odbc_id:U(g,"id","name"),project_id:U(v,"id","name"),context:U(h,"id","name"),interval_id:(t=f,a="id",i="name",s="IntervalId",o=_.filter(t,function(e){return null===e[s]}),r=[],_.forEach(o,function(n){r.push({value:n[a],option:n[i]});var e=_.filter(t,function(e){return e[s]===n.id});_.forEach(e,function(e){r.push({value:e[a],option:" - "+e[i]})})}),r),account_id:U(b,"id","name"),template_id:U(A,"id","name"),list_id:U(E,"id","name"),sms_account_id:U(O,"id","name"),pause_id:U(C,"id","name")},n=_.merge(P.values,e),P.values=n):function(){for(var e=["sip_id","trunk_name","trunk_id","queue_id","file_id","variable_id","odbc_id","project_id","context","interval_id","account_id","template_id","list_id","sms_account_id","pause_id"],n=0;n<P.attributes.length;n++)if(_.includes(e,P.attributes[n].name))switch(P.attributes[n].name){case"sip_id":F();break;case"trunk_name":G();break;case"trunk_id":q();break;case"queue_id":H();break;case"file_id":V();break;case"variable_id":B();break;case"odbc_id":Q();break;case"project_id":W();break;case"context":j();break;case"interval_id":Y();break;case"account_id":z();break;case"template_id":K();break;case"list_id":$();break;case"sms_account_id":J();break;case"pause_id":X()}}();var e,n,t,a,i,s,o,r},P.closeDialog=function(e){e&&S(P.attributes),n.hide()},P.getMap=U}e.$inject=["$mdDialog","api","toasty","ispeechAsrModel","ispeechAsrLanguage","googleAsrLanguage","ispeechTtsLanguage","googleCloudTtslanguageCode","googleTtsLanguage","users","trunks","queues","sounds","variables","databases","projects","contexts","intervals","mailAccounts","templates","lists","cell","saveCallback","awsPollyVoice","awsPollyRegion","smsAccounts","pauses","dialogFlowLanguage","dialogFlowV2Language","awsLexRegion","Auth","crudPermissions"],angular.module("app.callysquare").controller("MxGraphDialogController",e)}(),function(){"use strict";angular.module("app.callysquare").directive("stringToNumber",function(){return{require:"ngModel",link:function(e,n,t,a){a.$parsers.push(function(e){return""+e}),a.$formatters.push(function(e){return parseFloat(e)})}}})}(),function(){"use strict";angular.module("app.callysquare").factory("ispeechAsrModel",function(){return[{value:"0",option:"Default"},{value:"date",option:"Date"},{value:"usmoney",option:"US Money"},{value:"numbersto9",option:"Numbers to 9"},{value:"numbersto99",option:"Numbers to 99"},{value:"numbersto999",option:"Numbers to 999"},{value:"time",option:"Time"},{value:"phonenumber",option:"Phone number"},{value:"streets",option:"Streets"},{value:"citystate",option:"US City/States"}]}).factory("ispeechAsrLanguage",function(){return[{value:"en-US",option:"English (US)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GB",option:"English (UK)"},{value:"en-AU",option:"English (Australia)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-MX",option:"Spanish (Mexico)"},{value:"it-IT",option:"Italian (Italy) / Finnish (Finland)"},{value:"fr-FR",option:"German (Germany)"},{value:"fr-CA",option:"French (Canada)"},{value:"pl-PL",option:"Polish (Poland)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ca-ES",option:"Catalan (Catalan)"},{value:"zh-TW",option:"Chinese (Taiwan)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"ko-KR",option:"Korean (Korea)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"nb-NO",option:"Norwegian (Norway)"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"zh-CN",option:"Chinese (China)"},{value:"zh-HK",option:"Chinese (Hong Kong)"}]}).factory("ispeechTtsLanguage",function(){return[{value:"usenglishfemale",option:"US English Female"},{value:"usenglishmale",option:"US English Male"},{value:"ukenglishfemale",option:"UK English Female"},{value:"ukenglishmale",option:"UK English Male"},{value:"auenglishfemale",option:"Australian English"},{value:"usspanishfemale",option:"US Spanish Female"},{value:"usspanishmale",option:"US Spanish Male"},{value:"chchinesefemale",option:"Chinese Female"},{value:"chchinesemale",option:"Chinese Male"},{value:"hkchinesefemale",option:"Hong Kong Cantonese Female"},{value:"twchinesefemale",option:"Taiwan Chinese Female"},{value:"jpjapanesefemale",option:"Japanese Female"},{value:"jpjapanesemale",option:"Japanese Male"},{value:"krkoreanfemale",option:"Korean Female"},{value:"krkoreanmale",option:"Korean Male"},{value:"caenglishfemale",option:"Canadian English Female"},{value:"huhungarianfemale",option:"Hungarian Female"},{value:"brportuguesefemale",option:"Brazilian Portuguese Female"},{value:"eurportuguesefemale",option:"European Portuguese Female"},{value:"eurportuguesemale",option:"European Portuguese Male"},{value:"eurspanishfemale",option:"European Spanish Female"},{value:"eurspanishmale",option:"European Spanish Male"},{value:"eurcatalanfemale",option:"European Catalan Female"},{value:"eurczechfemale",option:"European Czech Female"},{value:"eurdanishfemale",option:"European Danish Female"},{value:"eurfinnishfemale",option:"European Finnish Female"},{value:"eurfrenchfemale",option:"European French Female"},{value:"eurfrenchmale",option:"European French Male"},{value:"eurnorwegianfemale",option:"European Norwegian Female"},{value:"eurdutchfemale",option:"European Dutch Female"},{value:"eurpolishfemale",option:"European Polish Female"},{value:"euritalianfemale",option:"European Italian Female"},{value:"euritalianmale",option:"European Italian Male"},{value:"eurturkishfemale",option:"European Turkish Female"},{value:"eurturkishmale",option:"European Turkish Male"},{value:"eurgermanfemale",option:"European German Female"},{value:"eurgermanmale",option:"European German Male"},{value:"rurussianfemale",option:"Russian Female"},{value:"rurussianmale",option:"Russian Male"},{value:"swswedishfemale",option:"Swedish Female"},{value:"cafrenchfemale",option:"Canadian French Female"},{value:"cafrenchmale",option:"Canadian French Male"}]}).factory("googleCloudTtslanguageCode",function(){return[{value:"af-ZA",option:"Afrikaans (South Africa)"},{value:"ar-XA",option:"Arabic"},{value:"bn-IN",option:"Bengali (India)"},{value:"bg-BG",option:"Bulgarian (Bulgaria)"},{value:"ca-ES",option:"Catalan (Spain)"},{value:"yue-HK",option:"Chinese (Hong Kong)"},{value:"cs-CZ",option:"Czech (Czech Republic)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"nl-BE",option:"Dutch (Belgium)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"en-AU",option:"English (Australian)"},{value:"en-IN",option:"English (India)"},{value:"en-GB",option:"English (UK)"},{value:"en-US",option:"English (US)"},{value:"fi-FI",option:"Finnish (Finland)"},{value:"fil-PH",option:"Filipino (Philippines)"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"French (France)"},{value:"de-DE",option:"German (Germany)"},{value:"el-GR",option:"Greek (Greece)"},{value:"gu-IN",option:"Gujarati (India)"},{value:"hi-IN",option:"Hindi (India)"},{value:"hu-HU",option:"Hungarian (Hungary)"},{value:"is-IS",option:"Icelandic (Iceland)"},{value:"id-ID",option:"Indonesian (Indonesia)"},{value:"it-IT",option:"Italian (Italy)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"kn-IN",option:"Kannada (India)"},{value:"ko-KR",option:"Korean (South Korea)"},{value:"lv-LV",option:"Latvian (Latvia)"},{value:"ms-MY",option:"Malay (Malaysia)"},{value:"ml-IN",option:"Malayalam (India)"},{value:"cmn-CN",option:"Mandarin Chinese"},{value:"nb-NO",option:"Norwegian (Norway)"},{value:"pl-PL",option:"Polish (Poland)"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ro-RO",option:"Romanian (Romania)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sr-RS",option:"Serbian (Cyrillic)"},{value:"sk-SK",option:"Slovak (Slovakia)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-US",option:"Spanish (US)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"ta-IN",option:"Tamil (India)"},{value:"te-IN",option:"Telugu (India)\t"},{value:"th-TH",option:"Thai (Thailand)"},{value:"tr-TR",option:"Turkish (Turkey)"},{value:"uk-UA",option:"Ukrainian (Ukraine)"},{value:"vi-VN",option:"Vietnamese (Vietnam)"}]}).factory("googleTtsLanguage",function(){return[{value:"af",option:"Afrikaans"},{value:"sq",option:"Albanian"},{value:"ar",option:"Arabic"},{value:"hy",option:"Armenian"},{value:"bn",option:"Bengali"},{value:"bs",option:"Bosnian"},{value:"bg",option:"Bulgarian"},{value:"ca",option:"Catalan"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"hr",option:"Croatian"},{value:"cs",option:"Czech"},{value:"da",option:"Danish"},{value:"nl",option:"Dutch"},{value:"en",option:"English"},{value:"eo",option:"Esperanto"},{value:"et",option:"Estonian"},{value:"tl",option:"Filipino"},{value:"fi",option:"Finnish"},{value:"fr",option:"French"},{value:"de",option:"German"},{value:"el",option:"Greek"},{value:"gu",option:"Gujarati"},{value:"iw",option:"Hebrew"},{value:"hi",option:"Hindi"},{value:"hu",option:"Hungarian"},{value:"is",option:"Icelandic"},{value:"id",option:"Indonesian"},{value:"it",option:"Italian"},{value:"jw",option:"Javanese"},{value:"ja",option:"Japanese"},{value:"kn",option:"Kannada"},{value:"ko",option:"Korean"},{value:"la",option:"Latin"},{value:"lv",option:"Latvian"},{value:"mk",option:"Macedonian"},{value:"ml",option:"Malayalam"},{value:"mr",option:"Marathi"},{value:"ne",option:"Nepali"},{value:"no",option:"Norwegian"},{value:"pl",option:"Polish"},{value:"pt",option:"Portuguese"},{value:"ro",option:"Romanian"},{value:"ru",option:"Russian"},{value:"sr",option:"Serbian"},{value:"si",option:"Sinhalese"},{value:"sk",option:"Slovak"},{value:"es",option:"Spanish"},{value:"su",option:"Sundanese"},{value:"sw",option:"Swahili"},{value:"sv",option:"Swedish"},{value:"ta",option:"Tamil"},{value:"te",option:"Telugu"},{value:"th",option:"Thai"},{value:"tr",option:"Turkish"},{value:"uk",option:"Ukrainian"},{value:"ur",option:"Urdu"},{value:"vi",option:"Vietnamese"},{value:"cy",option:"Welsh"}]}).factory("googleAsrLanguage",function(){return[{option:"Afrikaans (South Africa)",value:"af-ZA"},{option:"Albanian (Albania)",value:"sq-AL"},{option:"Amharic (Ethiopia)",value:"am-ET"},{option:"Arabic (Algeria)",value:"ar-DZ"},{option:"Arabic (Bahrain)",value:"ar-BH"},{option:"Arabic (Egypt)",value:"ar-EG"},{option:"Arabic (Iraq)",value:"ar-IQ"},{option:"Arabic (Israel)",value:"ar-IL"},{option:"Arabic (Jordan)",value:"ar-JO"},{option:"Arabic (Kuwait)",value:"ar-KW"},{option:"Arabic (Lebanon)",value:"ar-LB"},{option:"Arabic (Morocco)",value:"ar-MA"},{option:"Arabic (Oman)",value:"ar-OM"},{option:"Arabic (Qatar)",value:"ar-QA"},{option:"Arabic (Saudi Arabia)",value:"ar-SA"},{option:"Arabic (State of Palestine)",value:"ar-PS"},{option:"Arabic (Tunisia)",value:"ar-TN"},{option:"Arabic (United Arab Emirates)",value:"ar-AE"},{option:"Arabic (Yemen)",value:"ar-YE"},{option:"Armenian (Armenia)",value:"hy-AM"},{option:"Azerbaijani (Azerbaijan)",value:"az-AZ"},{option:"Basque (Spain)",value:"eu-ES"},{option:"Bengali (Bangladesh)",value:"bn-BD"},{option:"Bengali (India)",value:"bn-IN"},{option:"Bosnian (Bosnia and Herzegovina)",value:"bs-BA"},{option:"Bulgarian (Bulgaria)",value:"bg-BG"},{option:"Burmese (Myanmar)",value:"my-MM"},{option:"Catalan (Spain)",value:"ca-ES"},{option:"Chinese, Cantonese (Traditional Hong Kong)",value:"yue-Hant-HK"},{option:"Chinese, Mandarin (Simplified, China)",value:"cmn-Hans-CN"},{option:"Croatian (Croatia)",value:"hr-HR"},{option:"Czech (Czech Republic)",value:"cs-CZ"},{option:"Danish (Denmark)",value:"da-DK"},{option:"Dutch (Belgium)",value:"nl-BE"},{option:"Dutch (Netherlands)",value:"nl-NL"},{option:"English (Australia)",value:"en-AU"},{option:"English (Canada)",value:"en-CA"},{option:"English (Ghana)",value:"en-GH"},{option:"English (Hong Kong)",value:"en-HK"},{option:"English (India)",value:"en-IN"},{option:"English (Ireland)",value:"en-IE"},{option:"English (Kenya)",value:"en-KE"},{option:"English (New Zealand)",value:"en-NZ"},{option:"English (Nigeria)",value:"en-NG"},{option:"English (Pakistan)",value:"en-PK"},{option:"English (Philippines)",value:"en-PH"},{option:"English (Singapore)",value:"en-SG"},{option:"English (South Africa)",value:"en-ZA"},{option:"English (Tanzania)",value:"en-TZ"},{option:"English (United Kingdom)",value:"en-GB"},{option:"English (United States)",value:"en-US"},{option:"Estonian (Estonia)",value:"et-EE"},{option:"Filipino (Philippines)",value:"fil-PH"},{option:"Finnish (Finland)",value:"fi-FI"},{option:"French (Belgium)",value:"fr-BE"},{option:"French (Canada)",value:"fr-CA"},{option:"French (France)",value:"fr-FR"},{option:"French (Switzerland)",value:"fr-CH"},{option:"Galician (Spain)",value:"gl-ES"},{option:"Georgian (Georgia)",value:"ka-GE"},{option:"German (Austria)",value:"de-AT"},{option:"German (Germany)",value:"de-DE"},{option:"German (Switzerland)",value:"de-CH"},{option:"Greek (Greece)",value:"el-GR"},{option:"Gujarati (India)",value:"gu-IN"},{option:"Hebrew (Israel)",value:"iw-IL"},{option:"Hindi (India)",value:"hi-IN"},{option:"Hungarian (Hungary)",value:"hu-HU"},{option:"Icelandic (Iceland)",value:"is-IS"},{option:"Indonesian (Indonesia)",value:"id-ID"},{option:"Italian (Italy)",value:"it-IT"},{option:"Italian (Switzerland)",value:"it-CH"},{option:"Japanese (Japan)",value:"ja-JP"},{option:"Javanese (Indonesia)",value:"jv-ID"},{option:"Kannada (India)",value:"kn-IN"},{option:"Kazakh (Kazakhstan)",value:"kk-KZ"},{option:"Khmer (Cambodia)",value:"km-KH"},{option:"Korean (South Korea)",value:"ko-KR"},{option:"Lao (Laos)",value:"lo-LA"},{option:"Latvian (Latvia)",value:"lv-LV"},{option:"Lithuanian (Lithuania)",value:"lt-LT"},{option:"Macedonian (North Macedonia)",value:"mk-MK"},{option:"Malay (Malaysia)",value:"ms-MY"},{option:"Malayalam (India)",value:"ml-IN"},{option:"Marathi (India)",value:"mr-IN"},{option:"Mongolian (Mongolia)",value:"mn-MN"},{option:"Nepali (Nepal)",value:"ne-NP"},{option:"Norwegian Bokmål (Norway)",value:"no-NO"},{option:"Persian (Iran)",value:"fa-IR"},{option:"Polish (Poland)",value:"pl-PL"},{option:"Portuguese (Brazil)",value:"pt-BR"},{option:"Portuguese (Portugal)",value:"pt-PT"},{option:"Punjabi (Gurmukhi India)",value:"pa-Guru-IN"},{option:"Romanian (Romania)",value:"ro-RO"},{option:"Russian (Russia)",value:"ru-RU"},{option:"Serbian (Serbia)",value:"sr-RS"},{option:"Sinhala (Sri Lanka)",value:"si-LK"},{option:"Slovak (Slovakia)",value:"sk-SK"},{option:"Slovenian (Slovenia)",value:"sl-SI"},{option:"Spanish (Argentina)",value:"es-AR"},{option:"Spanish (Bolivia)",value:"es-BO"},{option:"Spanish (Chile)",value:"es-CL"},{option:"Spanish (Colombia)",value:"es-CO"},{option:"Spanish (Costa Rica)",value:"es-CR"},{option:"Spanish (Dominican Republic)",value:"es-DO"},{option:"Spanish (Ecuador)",value:"es-EC"},{option:"Spanish (El Salvador)",value:"es-SV"},{option:"Spanish (Guatemala)",value:"es-GT"},{option:"Spanish (Honduras)",value:"es-HN"},{option:"Spanish (Mexico)",value:"es-MX"},{option:"Spanish (Nicaragua)",value:"es-NI"},{option:"Spanish (Panama)",value:"es-PA"},{option:"Spanish (Paraguay)",value:"es-PY"},{option:"Spanish (Peru)",value:"es-PE"},{option:"Spanish (Puerto Rico)",value:"es-PR"},{option:"Spanish (Spain)",value:"es-ES"},{option:"Spanish (United States)",value:"es-US"},{option:"Spanish (Uruguay)",value:"es-UY"},{option:"Spanish (Venezuela)",value:"es-VE"},{option:"Sundanese (Indonesia)",value:"su-ID"},{option:"Swahili (Kenya)",value:"sw-KE"},{option:"Swahili (Tanzania)",value:"sw-TZ"},{option:"Swedish (Sweden)",value:"sv-SE"},{option:"Tamil (India)",value:"ta-IN"},{option:"Tamil (Malaysia)",value:"ta-MY"},{option:"Tamil (Singapore)",value:"ta-SG"},{option:"Tamil (Sri Lanka)",value:"ta-LK"},{option:"Telugu (India)",value:"te-IN"},{option:"Thai (Thailand)",value:"th-TH"},{option:"Turkish (Turkey)",value:"tr-TR"},{option:"Ukrainian (Ukraine)",value:"uk-UA"},{option:"Urdu (India)",value:"ur-IN"},{option:"Urdu (Pakistan)",value:"ur-PK"},{option:"Uzbek (Uzbekistan)",value:"uz-UZ"},{option:"Vietnamese (Vietnam)",value:"vi-VN"},{option:"Zulu (South Africa)",value:"zu-ZA"}]}).factory("awsPollyVoice",function(){return[{value:"Zeina",option:"Zeina (Arabic, Female)"},{value:"Zhiyu",option:"Zhiyu (Chinese, Mandarin, Female)"},{value:"Naja",option:"Naja (Danish, Female)"},{value:"Mads",option:"Mads (Danish, Male)"},{value:"Lotte",option:"Lotte (Dutch, Female)"},{value:"Ruben",option:"Ruben (Dutch, Male)"},{value:"Nicole",option:"Nicole (English, Australian, Female)"},{value:"Olivia",option:"Olivia (English, Austrialian, Female)"},{value:"Russell",option:"Russell (English, Austrialian, Male)"},{value:"Amy",option:"Amy (English, British, Female)"},{value:"Emma",option:"Emma (English, British, Female)"},{value:"Brian",option:"Brian (English, British, Male)"},{value:"Aditi",option:"Aditi (English, Indian, Female)"},{value:"Raveena",option:"Raveena (English, Indian, Female)"},{value:"Aria",option:"Aria (English, New Zealand, Female)"},{value:"Ayanda",option:"Ayanda (English, South African, Female)"},{value:"Joanna",option:"Joanna (English, US, Female)"},{value:"Ivy",option:"Ivy (English, US, Female)"},{value:"Joey",option:"Joey (English, US, Male)"},{value:"Justin",option:"Justin (English, US, Male)"},{value:"Kendra",option:"Kendra (English, US, Female)"},{value:"Kimberly",option:"Kimberly (English, US, Female)"},{value:"Salli",option:"Salli (English, US, Female)"},{value:"Kevin",option:"Kevin (English, US, Male)"},{value:"Matthew",option:"Matthew (English, US, Male)"},{value:"Geraint",option:"Geraint (English, Welsh, Male)"},{value:"Celine",option:"Celine (French, Female)"},{value:"Mathieu",option:"Mathieu (French, Male)"},{value:"Léa",option:"Léa (French, Male)"},{value:"Chantal",option:"Chantal (French, Canadian, Female)"},{value:"Gabrielle",option:"Gabrielle (French, Canadian, Female)"},{value:"Vicki",option:"Vicki (German , Female)"},{value:"Hans",option:"Hans (German, Male)"},{value:"Marlene",option:"Marlene (German, Female)"},{value:"Aditi",option:"Aditi (Hindi , Female)"},{value:"Karl",option:"Karl (Icelandic, Male)"},{value:"Dora",option:"Dora (Icelandic, Female)"},{value:"Carla",option:"Carla (Italian, Female)"},{value:"Giorgio",option:"Giorgio (Italian, Male)"},{value:"Bianca",option:"Bianca (Italian, Male)"},{value:"Mizuki",option:"Mizuki (Japanese, Female)"},{value:"Takumi",option:"Takumi (Japanese, Male)"},{value:"Seoyeon",option:"Seoyeon (Korean, Female)"},{value:"Liv",option:"Liv (Norwegian, Female)"},{value:"Ewa",option:"Ewa (Polish, Female)"},{value:"Jacek",option:"Jacek (Polish, Male)"},{value:"Jan",option:"Jan (Polish, Male)"},{value:"Maja",option:"Maja (Polish, Female)"},{value:"Camila",option:"Camila (Portuguese, Brazilian, Female)"},{value:"Ricardo",option:"Ricardo (Portuguese, Brazilian, Male)"},{value:"Vitoria",option:"Vitoria (Portuguese, Brazilian, Female)"},{value:"Cristiano",option:"Cristiano (Portuguese, Male)"},{value:"Ines",option:"Ines (Portuguese, Female)"},{value:"Carmen",option:"Carmen (Romanian, Female)"},{value:"Maxim",option:"Maxim (Russian, Male)"},{value:"Tatyana",option:"Tatyana (Russian, Female)"},{value:"Conchita",option:"Conchita (Spanish, European, Female)"},{value:"Lucia",option:"Lucia (Spanish, European, Female)"},{value:"Enrique",option:"Enrique (Spanish, European, Male)"},{value:"Mia",option:"Mia (Spanish, Mexican, Female)"},{value:"Miguel",option:"Miguel (Spanish, US, Male)"},{value:"Penelope",option:"Penelope (Spanish, US, Female)"},{value:"Lupe",option:"Lupe (Spanish, US, Female)"},{value:"Astrid",option:"Astrid (Swedish, Female)"},{value:"Filiz",option:"Filiz (Turkish, Female)"},{value:"Gwyneth",option:"Gwyneth (Welsh , Female)"}]}).factory("awsPollyRegion",function(){return[{value:"us-east-1",option:"US East (N. Virginia)"},{value:"us-east-2",option:"US East (Ohio)"},{value:"us-west-1",option:"US West (N. California)"},{value:"us-west-2",option:"US West (Oregon)"},{value:"ca-central-1",option:"Canada (Central)"},{value:"eu-west-1",option:"EU (Ireland)"},{value:"eu-central-1",option:"EU (Frankfurt)"},{value:"eu-west-2",option:"EU (London)"},{value:"eu-west-3",option:"EU (Paris)"},{value:"ap-southeast-1",option:"Asia Pacific (Singapore)"},{value:"ap-southeast-2",option:"Asia Pacific (Sydney)"},{value:"ap-northeast-2",option:"Asia Pacific (Seoul)"},{value:"ap-northeast-1",option:"Asia Pacific (Tokyo)"},{value:"ap-south-1",option:"Asia Pacific (Mumbai)"},{value:"sa-east-1",option:"South America (São Paulo)"}]}).factory("awsLexRegion",function(){return[{value:"us-east-1",option:"US East (N. Virginia)"},{value:"us-west-2",option:"US West (Oregon)"},{value:"eu-west-1",option:"EU (Ireland)"},{value:"ap-southeast-2",option:"Asia Pacific (Sydney)"}]}).factory("dialogFlowLanguage",function(){return[{value:"da",option:"Danish"},{value:"en",option:"English"},{value:"de",option:"German"},{value:"it",option:"Italian"},{value:"es",option:"Spanish"},{value:"fr",option:"French"},{value:"id",option:"Indonesian"},{value:"ja",option:"Japanese"},{value:"ko",option:"Korean (South Korea)"},{value:"nl",option:"Dutch"},{value:"no",option:"Norwegian"},{value:"pt",option:"Portuguese (European)"},{value:"pt-br",option:"Portuguese (Nrazilian)"},{value:"ru",option:"Russian"},{value:"sv",option:"Swedish"},{value:"th",option:"Thai"},{value:"uk",option:"Ukrainian"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-HK",option:"Chinese (Hong Kong)"},{value:"zh-TW",option:"Chinese (Traditional)"}]}).factory("dialogFlowV2Language",function(){return[{value:"zh-HK",option:"Chinese (Cantonese)"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"da",option:"Danish"},{value:"nl",option:"Dutch"},{value:"en",option:"English"},{value:"en-AU",option:"English (Australia)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GB",option:"English (Great Britain)"},{value:"en-IN",option:"English (India)"},{value:"en-US",option:"English (US)"},{value:"fr",option:"French"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"France (France)"},{value:"de",option:"German"},{value:"hi",option:"Hindi"},{value:"id",option:"Indonesian"},{value:"it",option:"Italian"},{value:"ja",option:"Japanese"},{value:"ko",option:"Korean"},{value:"no",option:"Norwegian"},{value:"pl",option:"Polish"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ru",option:"Russian"},{value:"es",option:"Spanish"},{value:"es-419",option:"Spanish (Latin America)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"sw",option:"Swedish"},{value:"th",option:"Thai"},{value:"tr",option:"Turkish"},{value:"uk",option:"Ukrainian"}]})}(),function(){"use strict";function e(n,e,t,a){var i=this;i.project={preproduction:t},i.closeDialog=function(e){e?(a(i.project.preproduction),n.hide(i.project.preproduction)):n.hide()}}e.$inject=["$mdDialog","toasty","currentXML","saveCallback"],angular.module("app.callysquare").controller("MxGraphEditXMLController",e)}(),function(){"use strict";function e(n,t){var a=this;function i(e){e?(t(e),n.hide(e)):n.hide()}a.errors=[],a.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:5242880,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},a.ngFlow={flow:{}},a.dropping=!1,a.closeDialog=i,a.fileAdded=function(e){a.errors=[];_.includes(["xml"],e.getExtension())||a.errors.push({message:"The extension "+e.getExtension()+" is not supported!"});5242880<e.size&&a.errors.push({message:"The file is too big. The max allowed size is 5MB"});if(!a.errors.length){var n=new FileReader;n.onload=function(e){i(e.target.result)},n.readAsText(e.file)}}}e.$inject=["$mdDialog","saveCallback"],angular.module("app.callysquare").controller("MxGraphImportXMLController",e)}(),function(){"use strict";function e(n,t,e,a){var i=this;i.project=_.clone(e),i.closeDialog=function(){n.hide()},i.save=function(){i.errors=[],a.squareProject.update({id:i.project.id},{notes:i.project.notes,description:i.project.description}).$promise.then(function(e){t.success({title:"Project updated!",msg:i.project.name?i.project.name+" has been updated!":""}),n.hide(e)}).catch(function(e){console.error(e),i.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}]})}}e.$inject=["$mdDialog","toasty","project","api"],angular.module("app.callysquare").controller("MxGraphUpdateInfoController",e)}(),function(){"use strict";function e(n,e,t,a,i){var s=this;s.projects=t,s.id="",s.newWindow=!0,s.closeDialog=function(e){s.errors=[],e?(n.hide(),s.newWindow?a.open("/callysquare/projects/"+s.id,"_blank"):i.go("app.callysquare.projects.edit",{id:s.id})):n.hide()}}e.$inject=["$mdDialog","toasty","projects","$window","$state"],angular.module("app.callysquare").controller("MxGraphOpenProjectController",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o){var r=this;r.project=angular.copy(e),r.project.name+="_new",r.project.preproduction=a,r.newWindow=!0,r.closeDialog=function(){n.hide()},r.save=function(){delete r.project.id,i.squareProject.save(r.project).$promise.then(function(e){t.success({title:"Project properly created",msg:r.project.name?r.project.name+" has been created!":""}),n.hide(e),r.newWindow?s.open("/callysquare/projects/"+e.id,"_blank"):o.go("app.callysquare.projects.edit",{id:e.id})}).catch(function(e){console.error(e),r.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}]})}}e.$inject=["$mdDialog","toasty","project","currentXML","api","$window","$state"],angular.module("app.callysquare").controller("MxGraphSaveProjectAsController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,r,n,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S,T){var I=this;I.currentUser=T.getCurrentUser(),I.project=n||{},I.userProfileSection=S&&1==S.count?S.rows[0]:null,I.crudPermissions=T.parseCrudPermissions(I.userProfileSection?I.userProfileSection.crudPermissions:null),I.onInit=function(){new EditorUi(I,new Editor,document.getElementById("geEditor")).openString(I.project.preproduction,I.project.name,I.project)},I.saveOrPublishProject=function(e,n){var t={preproduction:e};n&&(t.production=e);r.squareProject.update({id:I.project.id},t).$promise.then(function(e){o.success({title:"Project "+(n?"published":"saved")+"!",msg:I.project.name?I.project.name+" has been "+(n?"published":"saved")+"!":""}),I.project.preproduction=e.preproduction}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsquareProject",msg:e.data?JSON.stringify(e.data):e.toString()})})},I.openDialog=function(e,n){a.show({controller:"MxGraphDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{users:l.rows||[],trunks:d.rows||[],queues:c.rows||[],sounds:m.rows||[],variables:u.rows||[],databases:p.rows||[],contexts:g.rows||[],projects:v.rows||[],intervals:h.rows||[],mailAccounts:f.rows||[],smsAccounts:E.rows||[],pauses:y.rows||[],templates:b.rows||[],lists:A.rows||[],cell:e,saveCallback:n,crudPermissions:I.crudPermissions}})},I.newProject=function(e){a.show({controller:"CreateOrEditSquareProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:e,projects:v.rows,openFromEditor:!0,license:null,setting:null,crudPermissions:I.crudPermissions}})},I.openProject=function(){a.show({controller:"MxGraphOpenProjectController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/open/open.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{projects:v.rows||[]}})},I.saveProjectAs=function(e){a.show({controller:"MxGraphSaveProjectAsController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:I.project,currentXML:e}}).then(function(e){e&&v.rows.push(e)})},I.newVariable=function(n){return i(function(a,n){return r.userProfileSection.get({userProfileId:I.currentUser.userProfileId,sectionId:1012}).$promise.then(function(e){var n=e.rows?e.rows[0]:null,t=T.parseCrudPermissions(n?n.crudPermissions:null);a(t)}).catch(function(e){n(e)})}).then(function(e){e.canEdit?a.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{variable:n,variables:u.rows,license:null,setting:null,crudPermissions:e}}):o.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_CREATION_MESSAGE")})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"API:NEW_VARIABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})},I.updateInfo=function(e){a.show({controller:"MxGraphUpdateInfoController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/info/info.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:I.project}}).then(function(e){e&&_.merge(I.project,e)})},I.editXML=function(e,n){a.show({controller:"MxGraphEditXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/edit/edit.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{currentXML:e,saveCallback:n}}).then(function(e){e&&(I.project.preproduction=e)})},I.importXML=function(e){a.show({controller:"MxGraphImportXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/import/import.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{saveCallback:e}}).then(function(e){e&&(I.project.preproduction=e)})},I.gotoProjects=function(){e.go("app.callysquare.projects",{},{reload:"app.callysquare.projects"})}}e.$inject=["$state","$document","$mdDialog","$q","$translate","toasty","api","project","users","trunks","queues","sounds","variables","databases","contexts","projects","intervals","mailAccounts","templates","lists","smsAccounts","pauses","userProfileSection","Auth"],angular.module("app.callysquare").controller("ProjectController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.projects=a||{count:0,rows:[]},p.userProfile=i,p.userProfileSection=s&&1==s.count?s.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.listOrder="",p.listOrderAsc=null,p.selectedProjects=[],p.query={fields:"id,name,description,notes",sort:"-updatedAt",limit:10,page:1},p.editstate=function(e,n){t.go("app.callysquare.projects.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.deleteconfirm=function(e,n){var t=l.confirm().title("Are you sure want to delete the project?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete project").targetEvent(n).ok("OK").cancel("CANCEL");l.show(t).then(function(){f(e)},function(){console.log("CANCEL")})},p.success=h,p.getProjects=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=o.squareProject.get(p.query,h).$promise:(p.query.id=p.userProfile.id,p.query.section="SquareProjects",p.promise=o.userProfile.getResources(p.query,h).$promise)},p.createOrEditProject=function(e,n){l.show({controller:"CreateOrEditSquareProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(d.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:n,projects:p.projects.rows,openFromEditor:null,setting:null,crudPermissions:p.crudPermissions}})},p.deleteProject=f,p.exportSelectedProjects=function(){var e=angular.copy(p.selectedProjects);return p.selectedProjects=[],e},p.deleteSelectedProjects=function(e){var n=l.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+p.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");l.show(n).then(function(){p.selectedProjects.forEach(function(e){f(e)}),p.selectedProjects=[]})},p.deselectProjects=function(){p.selectedProjects=[]},p.selectAllProjects=function(){p.selectedProjects=p.projects.rows};var g=!0,v=1;function h(e){p.projects=e||{count:0,rows:[]}}function f(e){o.squareProject.delete({id:e.id}).$promise.then(function(){_.remove(p.projects.rows,{id:e.id}),p.projects.count-=1,p.projects.rows.length||p.getProjects(),m.success({title:"Project deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.project.delete"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.project.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){g?c(function(){g=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getProjects())})}e.$inject=["$scope","$state","$mdSidenav","projects","userProfile","userProfileSection","api","msUtils","$mdDialog","$document","$timeout","toasty","Auth"],angular.module("app.callysquare").controller("ProjectsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CALLYSQUARE.EDIT_SQUARERECORDING",g.squareRecording=angular.copy(l),g.squareRecordings=r,g.newSquareRecording=!1,g.squareRecording||(g.squareRecording={},g.title="CALLYSQUARE.NEW_SQUARERECORDING",g.newSquareRecording=!0),g.addNewSquareRecording=function(){g.errors=[],d.squareRecording.save(g.squareRecording).$promise.then(function(e){g.squareRecordings.unshift(e.toJSON()),o.success({title:"SquareRecording properly created",msg:g.squareRecording.name?g.squareRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSquareRecording=function(){g.errors=[],d.squareRecording.update({id:g.squareRecording.id},g.squareRecording).$promise.then(function(e){var n=_.find(g.squareRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SquareRecording properly saved!",msg:g.squareRecording.name?g.squareRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSquareRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The squareRecording will be deleted.").ariaLabel("Delete SquareRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.squareRecording.delete({id:g.squareRecording.id}).$promise.then(function(){_.remove(g.squareRecordings,{id:g.squareRecording.id}),o.success({title:"SquareRecording properly deleted!",msg:(g.squareRecording.name||"squareRecording")+" has been deleted!"}),v(g.squareRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","squareRecordings","squareRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditSquareRecordingDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.squareRecordings=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="squareRecordings",f.listOrder="",f.listOrderAsc=null,f.selectedSquareRecordings=[],f.query={fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,page:1},f.downloadfile2=function(s,e){return m.squareRecording.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid+s.format;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("squareRecording")+"?").htmlContent("<b>"+(e.name||"squareRecording")+"</b> will be deleted.").ariaLabel("delete squareRecording").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSquareRecordings=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.squareRecording.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SquareRecordings",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSquareRecording=function(e,n){i.show({controller:"CreateOrEditSquareRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/squareRecordings/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{squareRecording:n,squareRecordings:f.squareRecordings.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSquareRecording=y,f.exportSelectedSquareRecordings=function(){var e=angular.copy(f.selectedSquareRecordings);return f.selectedSquareRecordings=[],e},f.deleteSelectedSquareRecordings=function(e){var n=i.confirm().title("Are you sure want to delete the selected squareRecordings?").htmlContent("<b>"+f.selectedSquareRecordings.length+" selected</b> will be deleted.").ariaLabel("delete SquareRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSquareRecordings.forEach(function(e){y(e)}),f.selectedSquareRecordings=[]})},f.deselectSquareRecordings=function(){f.selectedSquareRecordings=[]},f.selectAllSquareRecordings=function(){f.selectedSquareRecordings=f.squareRecordings.rows};var b=!0,A=1;function E(e){f.squareRecordings=e||{count:0,rows:[]}}function y(e){m.squareRecording.delete({id:e.id}).$promise.then(function(){_.remove(f.squareRecordings.rows,{id:e.id}),f.squareRecordings.count-=1,f.squareRecordings.rows.length||f.getSquareRecordings(),p.success({title:_.startCase("SquareRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsquareRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSquareRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","squareRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.callysquare").controller("SquareRecordingsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chatQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chatQueues",f.listOrder="",f.listOrderAsc=null,f.selectedChatQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.chat.chatQueues.edit",{id:e.id,chatQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:f.chatQueues?f.chatQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:f.chatQueues?f.chatQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chatQueue")+"?").htmlContent("<b>"+(e.name||"chatQueue")+"</b> will be deleted.").ariaLabel("delete chatQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.chat.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.chat.realtime.queues",{})}},f.success=E,f.getChatQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.chatQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChatQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditChatQueue=function(e,n){i.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:n,chatQueues:f.chatQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteChatQueue=y,f.exportSelectedChatQueues=function(){var e=angular.copy(f.selectedChatQueues);return f.selectedChatQueues=[],e},f.deleteSelectedChatQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected chatQueues?").htmlContent("<b>"+f.selectedChatQueues.length+" selected</b> will be deleted.").ariaLabel("delete ChatQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChatQueues.forEach(function(e){y(e)}),f.selectedChatQueues=[]})},f.deselectChatQueues=function(){f.selectedChatQueues=[]},f.selectAllChatQueues=function(){f.selectedChatQueues=f.chatQueues.rows};var b=!0,A=1;function E(e){f.chatQueues=e||{count:0,rows:[]}}function y(e){m.chatQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.chatQueues.rows,{id:e.id}),f.chatQueues.count-=1,f.chatQueues.rows.length||f.getChatQueues(),p.success({title:_.startCase("ChatQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEchatQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChatQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.chat").controller("ChatQueuesController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="CHAT.EDIT_CHATQUEUE",r.chatQueue=angular.copy(n),r.chatQueues=e,r.newChatQueue=!1,r.chatQueue||(r.chatQueue={strategy:"beepall",timeout:10},r.title="CHAT.NEW_CHATQUEUE",r.newChatQueue=!0),r.addNewChatQueue=function(){r.errors=[],i.chatQueue.save(r.chatQueue).$promise.then(function(e){r.chatQueues.unshift(e.toJSON()),a.success({title:"ChatQueue properly created",msg:r.chatQueue.name?r.chatQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveChatQueue=function(){r.errors=[],i.chatQueue.update({id:r.chatQueue.id},r.chatQueue).$promise.then(function(e){var n=_.find(r.chatQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"ChatQueue properly saved!",msg:r.chatQueue.name?r.chatQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteChatQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The chatQueue will be deleted.").ariaLabel("Delete ChatQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.chatQueue.delete({id:r.chatQueue.id}).$promise.then(function(){_.remove(r.chatQueues,{id:r.chatQueue.id}),a.success({title:"ChatQueue properly deleted!",msg:(r.chatQueue.name||"chatQueue")+" has been deleted!"}),l(r.chatQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","chatQueues","chatQueue","api","Auth","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatQueue.getAgents({id:c.chatQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserChatQueue?"penalty "+e.UserChatQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.chatQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.removeAgents({id:c.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.addAgents({id:c.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","chatQueue","chatQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatQueue.getTeams({id:l.chatQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.chatQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("CHAT.ALL_TEAMS"),labelSelected:t.instant("CHAT.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.removeTeams({id:l.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.addTeams({id:l.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","chatQueue","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.chatQueue=c||e.params.chatQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoChatQueues=function(){e.go("app.chat.chatQueues",{},{reload:"app.chat.chatQueues"})},u.saveChatQueue=function(){r.chatQueue.update({id:u.chatQueue.id},u.chatQueue).$promise.then(function(){l.success({title:"ChatQueue updated!",msg:u.chatQueue.name?u.chatQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","chatQueue","userProfileSection"],angular.module("app.chat").controller("ChatQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chatWebsites=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chatWebsites",f.listOrder="",f.listOrderAsc=null,f.selectedChatWebsites=[],f.query={fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,page:1},f.arrayagentIdentifier=_.keyBy([{option:"WebsiteAlias",value:"'website_alias'"},{option:"AgentAlias",value:"'agent_alias'"},{option:"AgentFullname",value:"'agent_fullname'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayheader_shape=_.keyBy([{option:"Rounded",value:"'rounded'"},{option:"Squared",value:"'squared'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayalignment=_.keyBy([{option:"bottom_right",value:"'bottom_right'"},{option:"right",value:"'right'"},{option:"left",value:"'left'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymessagesAlignment=_.keyBy([{option:"alternate",value:"'alternate'"},{option:"centered",value:"'centered'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayratingType=_.keyBy([{option:"Star",value:"'star'"},{option:"Thumb",value:"'thumb'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,chatWebsite:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,tab:10})},f.offlinemessagesgoto=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,tab:11})},f.agentadddialog=function(e,n){i.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:f.chatWebsites?f.chatWebsites.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chatWebsite")+"?").htmlContent("<b>"+(e.name||"chatWebsite")+"</b> will be deleted.").ariaLabel("delete chatWebsite").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getChatWebsites=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.chatWebsite.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChatWebsites",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditChatWebsite=function(e,n){i.show({controller:"CreateOrEditChatWebsiteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:n,chatWebsites:f.chatWebsites.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteChatWebsite=y,f.exportSelectedChatWebsites=function(){var e=angular.copy(f.selectedChatWebsites);return f.selectedChatWebsites=[],e},f.deleteSelectedChatWebsites=function(e){var n=i.confirm().title("Are you sure want to delete the selected chatWebsites?").htmlContent("<b>"+f.selectedChatWebsites.length+" selected</b> will be deleted.").ariaLabel("delete ChatWebsites").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChatWebsites.forEach(function(e){y(e)}),f.selectedChatWebsites=[]})},f.deselectChatWebsites=function(){f.selectedChatWebsites=[]},f.selectAllChatWebsites=function(){f.selectedChatWebsites=f.chatWebsites.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.chatWebsite&&(t=_.find(f.lists,{id:Number(f.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.chatWebsite&&(a=_.find(f.lists,{id:Number(f.chatWebsite.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.chatWebsite&&(t=_.find(f.interval,{id:Number(f.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.chatWebsite&&(a=_.find(f.interval,{id:Number(f.chatWebsite.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.chatWebsites=e||{count:0,rows:[]}}function y(e){m.chatWebsite.delete({id:e.id}).$promise.then(function(){_.remove(f.chatWebsites.rows,{id:e.id}),f.chatWebsites.count-=1,f.chatWebsites.rows.length||f.getChatWebsites(),p.success({title:_.startCase("ChatWebsite")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChatWebsites())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatWebsites","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.chat").controller("ChatWebsitesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATWEBSITE",g.chatWebsite=angular.copy(l),g.chatWebsites=r,g.newChatWebsite=!1,g.chatWebsite||(g.chatWebsite={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),header_shape:"rounded",alignment:"bottom_right",verticalAlignment:30,labelText:"CHAT",messagesAlignment:"alternate",IntervalId:"null",timezone:"null",waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300,vidaooTopic:"Generated by XCALLY Motion",vidaooNote:"Meeting generated for interaction #{{interaction.id}} by {{agent.name}}"},g.title="CHAT.NEW_CHATWEBSITE",g.newChatWebsite=!0),n.params.id&&(g.chatWebsite.ChatWebsiteId=n.params.id),g.addNewChatWebsite=function(){g.errors=[],d.chatWebsite.save(g.chatWebsite).$promise.then(function(e){g.chatWebsites.unshift(e.toJSON()),o.success({title:"ChatWebsite properly created",msg:g.chatWebsite.name?g.chatWebsite.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatWebsite=function(){g.errors=[],d.chatWebsite.update({id:g.chatWebsite.id},g.chatWebsite).$promise.then(function(e){var n=_.find(g.chatWebsites,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatWebsite properly saved!",msg:g.chatWebsite.name?g.chatWebsite.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatWebsite=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatWebsite will be deleted.").ariaLabel("Delete ChatWebsite").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatWebsite.delete({id:g.chatWebsite.id}).$promise.then(function(){_.remove(g.chatWebsites,{id:g.chatWebsite.id}),o.success({title:"ChatWebsite properly deleted!",msg:(g.chatWebsite.name||"chatWebsite")+" has been deleted!"}),v(g.chatWebsite)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.chatWebsite&&(t=_.find(g.lists,{id:Number(g.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.chatWebsite&&(a=_.find(g.lists,{id:Number(g.chatWebsite.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.chatWebsite&&(t=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.chatWebsite&&(a=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatWebsites","chatWebsite","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatWebsiteDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.chatWebsiteApps.rows.length){var t=r.chatWebsiteApps.rows[n]?r.chatWebsiteApps.rows[n]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsiteApp:t,chatWebsite:r.chatWebsite,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.chatWebsiteApps.rows[n]=e:r.chatWebsiteApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.chatWebsiteApps.rows.length;t++,0){var a=r.chatWebsiteApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.chatWebsite.context,a.exten=r.chatWebsite.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.chatWebsite.addApplications({id:r.chatWebsite.id},_.sortBy(n,"priority")).$promise.then(function(e){r.chatWebsiteApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.chatWebsiteApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.chatWebsite={},r.chatWebsiteApps={count:0,rows:[]},r.selectedChatWebsiteApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"ChatQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"chatQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:501}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",role:"agent",sort:"name",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"tvox",appType:"tvox",type:"tvox",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"serviceid",name:"serviceid",type:"text",param:0},{title:"channelid",name:"channelid",type:"text",param:1},{title:"tvoxurl",name:"tvoxurl",type:"text",param:2},{title:"tvoxloginurl",name:"tvoxloginurl",type:"text",param:3},{title:"tvoxsessionurl",name:"tvoxsessionurl",type:"text",param:4},{title:"tvoxusername",name:"tvoxusername",type:"text",param:5},{title:"tvoxpasswd",name:"tvoxpasswd",type:"password",param:6},{title:"motionurlonring",name:"motionurlonring",type:"text",param:7},{title:"motionurlonanswer",name:"motionurlonanswer",type:"text",param:8},{title:"motiontitle",name:"motiontitle",type:"text",param:9},{title:"motionurl",name:"motionurl",type:"text",param:10}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.chatWebsite=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getChatWebsiteApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.chatWebsiteApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getChatWebsiteApps=function(){r.promise=o.chatWebsite.getApplications(r.query,t).$promise},r.editChatWebsiteApp=n,r.editInterval=function(e,n){if(r.chatWebsiteApps.rows.length){var t=r.chatWebsiteApps.rows[n]?r.chatWebsiteApps.rows[n]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteChatWebsiteApp=function(e){_.remove(r.chatWebsiteApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedChatWebsiteApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedChatWebsiteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedChatWebsiteApps.forEach(function(e){_.remove(r.chatWebsiteApps.rows,{id:e.id})}),r.selectedChatWebsiteApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.chat").controller("ChatWebsiteActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatWebsite.getAgents({id:c.chatWebsite.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserChatWebsite?"penalty "+e.UserChatWebsite.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.chatWebsite=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatWebsite.removeAgents({id:c.chatWebsite.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatWebsite.addAgents({id:c.chatWebsite.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","chatWebsite","chatWebsites","realtime","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatWebsiteagentaddController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsiteagentAvatarController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditChatWebsiteAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("chat")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.chatQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.chatQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:501}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteApptagDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.tvox=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tvox.appdata)switch(l.tvox.appType?l.tvox.appType.toLowerCase():l.tvox.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tvox.appdata.split(",");l.tvox.key=d[0],l.tvox.language=d[1],l.tvox.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tvox.appdata.split(",");l.tvox.projectId=d[0],l.tvox.clientEmail=d[1],l.tvox.privateKey=d[2],l.tvox.language=d[3],l.tvox.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tvox.appdata.split(",");l.tvox.accesskeyid=d[0],l.tvox.secretaccesskey=d[1],l.tvox.lexregion=d[2],l.tvox.botname=d[3],l.tvox.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tvox.appdata.split(",");l.tvox.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tvox.text=d.slice(1,d.length).join(",");break;case"message":l.tvox.text=l.tvox.appdata;break;case"set":l.tvox.name=l.tvox.appdata.split("=")[0],l.tvox.value=l.tvox.appdata.split("=")[1];break;case"agi":l.tvox.project=l.tvox.appdata;break;default:var c=l.tvox.appdata.split(",");l.tvox.serviceid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.tvox.channelid=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.tvox.tvoxurl=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.tvox.tvoxloginurl=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.tvox.tvoxsessionurl=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10),l.tvox.tvoxusername=_.isEmpty(c[5])?c[5]:isNaN(c[5])?c[5]:parseInt(c[5],10),l.tvox.tvoxpasswd=_.isEmpty(c[6])?c[6]:isNaN(c[6])?c[6]:parseInt(c[6],10),l.tvox.motionurlonring=_.isEmpty(c[7])?c[7]:isNaN(c[7])?c[7]:parseInt(c[7],10),l.tvox.motionurlonanswer=_.isEmpty(c[8])?c[8]:isNaN(c[8])?c[8]:parseInt(c[8],10),l.tvox.motiontitle=_.isEmpty(c[9])?c[9]:isNaN(c[9])?c[9]:parseInt(c[9],10),l.tvox.motionurl=_.isEmpty(c[10])?c[10]:isNaN(c[10])?c[10]:parseInt(c[10],10)}function m(e){n.hide(e)}l.tvox.type&&"outbound"===l.tvox.type.toLowerCase()&&"outbounddial"===l.tvox.appType.toLowerCase()&&(l.tvox.prefix=l.tvox.phone?l.tvox.phone.split("$")[0]:void 0,l.tvox.callerId=l.tvox.callerID?"CALLERID(all)="+l.tvox.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.tvox.type&&"outbound"===l.tvox.type.toLowerCase()&&"outboundDial"===l.tvox.appType&&(l.tvox.phone=i.cutdigits?(l.tvox.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tvox.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tvox.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tvox.options+="U(xcally-mixmonitor-context)"):l.tvox.options=l.tvox.options.replace("U(xcally-mixmonitor-context)",""));if(l.tvox.appType&&"custom"===l.tvox.appType);else switch((l.tvox.app||l.tvox.appType).toLowerCase()){case"set":l.tvox.appdata=l.tvox.name+"="+l.tvox.value;break;case"custom":break;default:e[0]=l.tvox.serviceid,e[1]=l.tvox.channelid,e[2]=l.tvox.tvoxurl,e[3]=l.tvox.tvoxloginurl,e[4]=l.tvox.tvoxsessionurl,e[5]=l.tvox.tvoxusername,e[6]=l.tvox.tvoxpasswd,e[7]=l.tvox.motionurlonring,e[8]=l.tvox.motionurlonanswer,e[9]=l.tvox.motiontitle,e[10]=l.tvox.motionurl,l.tvox.appdata=e.join(",")}m(l.tvox)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteApptvoxDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteChatCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteChatCannedAnswers.rows,{id:e.id}),m.chatWebsiteChatCannedAnswers.count-=1,m.chatWebsiteChatCannedAnswers.rows.length||p(),l.success({title:"ChatCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteChatCannedAnswers={count:0,rows:[]},m.selectedChatWebsiteChatCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the chatCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("chatCannedAnswer #")+e.id||"chatCannedAnswer")+"</b> will be deleted.").ariaLabel("delete chatCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteChatCannedAnswers=p,m.createOrEditChatWebsiteChatCannedAnswer=function(e,n){o.show({controller:"CreateOrEditChatCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,chatCannedAnswer:n,chatCannedAnswers:m.chatWebsiteChatCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedChatWebsiteChatCannedAnswers=function(){var e=angular.copy(m.selectedChatWebsiteChatCannedAnswers);return m.selectedChatWebsiteChatCannedAnswers=[],e},m.deleteChatWebsiteChatCannedAnswer=g,m.deleteSelectedChatWebsiteChatCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected chatCannedAnswers?").htmlContent("<b>"+m.selectedChatWebsiteChatCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete chatCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteChatCannedAnswers.forEach(function(e){g(e)}),m.selectedChatWebsiteChatCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteChatCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATCANNEDANSWER",g.chatCannedAnswer=angular.copy(l),g.chatCannedAnswers=r,g.newChatCannedAnswer=!1,g.chatCannedAnswer||(g.chatCannedAnswer={},g.title="CHAT.NEW_CHATCANNEDANSWER",g.newChatCannedAnswer=!0),n.params.id&&(g.chatCannedAnswer.ChatWebsiteId=n.params.id),g.addNewChatCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.chatCannedAnswer).$promise.then(function(e){g.chatCannedAnswers.unshift(e.toJSON()),o.success({title:"ChatCannedAnswer properly created",msg:g.chatCannedAnswer.name?g.chatCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.chatCannedAnswer.id},g.chatCannedAnswer).$promise.then(function(e){var n=_.find(g.chatCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatCannedAnswer properly saved!",msg:g.chatCannedAnswer.name?g.chatCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatCannedAnswer will be deleted.").ariaLabel("Delete ChatCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.chatCannedAnswer.id}).$promise.then(function(){_.remove(g.chatCannedAnswers,{id:g.chatCannedAnswer.id}),o.success({title:"ChatCannedAnswer properly deleted!",msg:(g.chatCannedAnswer.name||"chatCannedAnswer")+" has been deleted!"}),v(g.chatCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatCannedAnswers","chatCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.chatWebsite.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.chatWebsite=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.chatWebsite.id,field:"ChatWebsiteId",route:"chatWebsite"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.chat").controller("ChatWebsiteDispositionsController",e)}(),function(){"use strict";function e(t,e,a){var i=this;i.chatWebsite={},i.offlineForm={},i.buttons=[{type:"label",name:"Label",icon:"icon-label"},{type:"chooseFromList",name:"Select",icon:"icon-playlist-plus"},{type:"input",name:"Input",icon:"icon-keyboard"},{type:"textarea",name:"Textarea",icon:"icon-format-text"},{type:"multipleChoices",name:"Radio Buttons",icon:"icon-radiobox-marked"},{type:"checkboxes",name:"Checkboxes",icon:"icon-checkbox-multiple-marked-outline"},{type:"agreement",name:"Agreement",icon:"icon-checkbox-marked-outline"},{type:"upload",name:"Upload",icon:"icon-upload"}],i.init=function(e){i.fields=[],i.customFields=[],i.uselessFields=["id","createdAt","updatedAt","ListId","CompanyId","$promise","$resolved"],i.chatWebsite=e,_.isEmpty(i.chatWebsite.offlineForm)&&(i.chatWebsite.offlineForm={items:[],fromKey:null});a.cmList.getCustomFields({id:i.chatWebsite.ListId}).$promise.then(function(e){for(var n=0;n<e.rows.length;n++)i.customFields.push({key:"cf_"+e.rows[n].id,value:e.rows[n].alias});return a.cmContact.describe().$promise}).then(function(e){for(var n=_.keys(e),t=0;t<n.length;t++)_.includes(i.uselessFields,n[t])||_.startsWith(n[t],"cf_")||i.fields.unshift({key:n[t],value:n[t]});return a.variable.get().$promise}).then(function(e){return i.variables=e.rows,a.mailAccount.get({fields:"id,name",raw:!0}).$promise.then(function(e){i.email_accounts=e.rows})}).catch(function(e){console.error(e)})},i.up=function(e,n){if(0!==n){var t=i.chatWebsite.offlineForm.items[n-1];i.chatWebsite.offlineForm.items[n]=t,i.chatWebsite.offlineForm.items[n-1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===n?i.chatWebsite.offlineForm.fromKey--:i.chatWebsite.offlineForm.fromKey===n-1&&i.chatWebsite.offlineForm.fromKey++}},i.down=function(e,n){if(n!==i.chatWebsite.offlineForm.items.length-1){var t=i.chatWebsite.offlineForm.items[n+1];i.chatWebsite.offlineForm.items[n]=t,i.chatWebsite.offlineForm.items[n+1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===n?i.chatWebsite.offlineForm.fromKey++:i.chatWebsite.offlineForm.fromKey===n+1&&i.chatWebsite.offlineForm.fromKey--}},i.add=function(e){i.chatWebsite.offlineForm.items.push({type:e,cmField:null,variable:null})},i.remove=function(e){var n=t.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");t.show(n).then(function(){i.chatWebsite.offlineForm.items.splice(e,1)})},i.card_type="offline",i.email_accounts=[]}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteofflineFormController",e)}(),function(){"use strict";function e(t,e,a){var i=this;i.chatWebsite={},i.onlineForm={},i.buttons=[{type:"label",name:"Label",icon:"icon-label"},{type:"chooseFromList",name:"Select",icon:"icon-playlist-plus"},{type:"input",name:"Input",icon:"icon-keyboard"},{type:"textarea",name:"Textarea",icon:"icon-format-text"},{type:"multipleChoices",name:"Radio Buttons",icon:"icon-radiobox-marked"},{type:"checkboxes",name:"Checkboxes",icon:"icon-checkbox-multiple-marked-outline"},{type:"agreement",name:"Agreement",icon:"icon-checkbox-marked-outline"}],i.init=function(e){i.fields=[],i.customFields=[],i.uselessFields=["id","createdAt","updatedAt","ListId","CompanyId","$promise","$resolved"],i.chatWebsite=e,_.isEmpty(i.chatWebsite.onlineForm)&&(i.chatWebsite.onlineForm={items:[],fromKey:null});a.cmList.getCustomFields({id:i.chatWebsite.ListId}).$promise.then(function(e){for(var n=0;n<e.rows.length;n++)i.customFields.push({key:"cf_"+e.rows[n].id,value:e.rows[n].alias});return a.cmContact.describe().$promise}).then(function(e){for(var n=_.keys(e),t=0;t<n.length;t++)_.includes(i.uselessFields,n[t])||_.startsWith(n[t],"cf_")||i.fields.unshift({key:n[t],value:n[t]});return a.variable.get().$promise}).then(function(e){return i.variables=e.rows,a.mailAccount.get({fields:"id,name",raw:!0}).$promise.then(function(e){i.email_accounts=e.rows})}).catch(function(e){console.error(e)})},i.up=function(e,n){if(0!==n){var t=i.chatWebsite.onlineForm.items[n-1];i.chatWebsite.onlineForm.items[n]=t,i.chatWebsite.onlineForm.items[n-1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===n?i.chatWebsite.onlineForm.fromKey--:i.chatWebsite.onlineForm.fromKey===n-1&&i.chatWebsite.onlineForm.fromKey++}},i.down=function(e,n){if(n!==i.chatWebsite.onlineForm.items.length-1){var t=i.chatWebsite.onlineForm.items[n+1];i.chatWebsite.onlineForm.items[n]=t,i.chatWebsite.onlineForm.items[n+1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===n?i.chatWebsite.onlineForm.fromKey++:i.chatWebsite.onlineForm.fromKey===n+1&&i.chatWebsite.onlineForm.fromKey--}},i.add=function(e){i.chatWebsite.onlineForm.items.push({type:e,cmField:null,variable:null})},i.remove=function(e){var n=t.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");t.show(n).then(function(){i.chatWebsite.onlineForm.fromKey===e&&(i.chatWebsite.onlineForm.fromKey=null),i.chatWebsite.onlineForm.items.splice(e,1),i.chatWebsite.onlineForm.items.length||(i.chatWebsite.onlineForm.fromKey=null)})},i.card_type="online",i.email_accounts=[]}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteonlineFormController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/customer_avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitecustomerAvatarController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"chatWebsite",action:"getDispositions",field:"name",params:{id:m.chatWebsite.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.chatWebsiteInteractions=e||{count:0,rows:[]};for(var n=0;n<m.chatWebsiteInteractions.rows.length;n+=1){var t=m.chatWebsiteInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatInteraction.get(m.query,p).$promise}function v(e){d.chatInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteInteractions.rows,{id:e.id}),m.chatWebsiteInteractions.count-=1,m.chatWebsiteInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteInteractions={count:0,rows:[]},m.selectedChatWebsiteInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Customer Ip",column:"customerIp",type:"text",options:{excludedOperators:["$eq","$ne","$startsWith","$endsWith"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.chatInteractionDownload=function(s,e,n){return d.chatInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="chat-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getChatWebsiteInteractions=g,m.createOrEditChatWebsiteInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,interaction:n,interactions:m.chatWebsiteInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spychatInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"chat",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"chat.chatWebsites"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||ChatWebsiteId:=$eq["+m.chatWebsite.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedChatWebsiteInteractions=function(){var e=angular.copy(m.selectedChatWebsiteInteractions);return m.selectedChatWebsiteInteractions=[],e},m.deleteChatWebsiteInteraction=v,m.deleteSelectedChatWebsiteInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedChatWebsiteInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteInteractions.forEach(function(e){v(e)}),m.selectedChatWebsiteInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteInteractionsController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/logo".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitelogoController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteOfflineMessages=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getOfflineMessages(m.query,u).$promise}function g(e){d.chatOfflineMessage.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteOfflineMessages.rows,{id:e.id}),m.chatWebsiteOfflineMessages.count-=1,m.chatWebsiteOfflineMessages.rows.length||p(),l.success({title:"OfflineMessage deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteOfflineMessages={count:0,rows:[]},m.selectedChatWebsiteOfflineMessages=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,attachments,Contact.firstName,ContactId,ChatWebsiteId",sort:"-createdAt",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the offlineMessage?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("offlineMessage #")+e.id||"offlineMessage")+"</b> will be deleted.").ariaLabel("delete offlineMessage").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteOfflineMessages=p,m.createOrEditChatWebsiteOfflineMessage=function(e,n){o.show({controller:"CreateOrEditOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,offlineMessage:n,offlineMessages:m.chatWebsiteOfflineMessages.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.showOfflineMessageChatWebsiteOfflineMessage=function(e,t){o.show({controller:"ShowOfflineMessageOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{message:["apiResolver","$stateParams",function(e,n){return e.resolve("chatOfflineMessage@get",{fields:"id,body",id:t.id})}],attachments:["apiResolver","$stateParams",function(e,n){return e.resolve("attachment@get",{fields:"id,name",ChatOfflineMessageId:t.id})}]}})},m.exportSelectedChatWebsiteOfflineMessages=function(){var e=angular.copy(m.selectedChatWebsiteOfflineMessages);return m.selectedChatWebsiteOfflineMessages=[],e},m.deleteChatWebsiteOfflineMessage=g,m.deleteSelectedChatWebsiteOfflineMessages=function(e){var n=o.confirm().title("Are you sure want to delete the selected offlineMessages?").htmlContent("<b>"+m.selectedChatWebsiteOfflineMessages.length+" selected</b> will be deleted.").ariaLabel("delete offlineMessages").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteOfflineMessages.forEach(function(e){g(e)}),m.selectedChatWebsiteOfflineMessages=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteOfflineMessagesController",e)}(),function(){"use strict";function e(n,e,t,a,i){var s=this;s.title="CHAT.OFFLINE_MESSAGE",s.message=a,s.attachments=i.rows,s.closeDialog=function(e){n.hide(e)},s.download=function(i){return e.attachment.download({id:i.id}).$promise.then(function(e){if(e){var n=new Blob([e.buffer],{type:e.type}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.href=a,t.target="_self",t.download=i.name,document.body.appendChild(t),t.click(),setTimeout(function(){document.body.removeChild(t),window.URL.revokeObjectURL(a)},100)}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.isHtml=_.isNil(s.message.body.match(/\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i))}e.$inject=["$mdDialog","api","toasty","message","attachments"],angular.module("app.chat").controller("ShowOfflineMessageOfflineMessageDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteProactiveActions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getProactiveActions(m.query,u).$promise}function g(e){d.chatProactiveAction.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteProactiveActions.rows,{id:e.id}),m.chatWebsiteProactiveActions.count-=1,m.chatWebsiteProactiveActions.rows.length||p(),l.success({title:"ChatProactiveAction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteProactiveActions={count:0,rows:[]},m.selectedChatWebsiteProactiveActions=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,name,type,selector,timeout",limit:10,page:1},m.arraytype=_.keyBy([{option:"MouseOver",value:"'mouseOver'"},{option:"Timeout",value:"'timeout'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the chatProactiveAction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("chatProactiveAction #")+e.id||"chatProactiveAction")+"</b> will be deleted.").ariaLabel("delete chatProactiveAction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteProactiveActions=p,m.createOrEditChatWebsiteChatProactiveAction=function(e,n){o.show({controller:"CreateOrEditChatProactiveActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,chatProactiveAction:n,proactive:m.chatWebsiteProactiveActions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedChatWebsiteProactiveActions=function(){var e=angular.copy(m.selectedChatWebsiteProactiveActions);return m.selectedChatWebsiteProactiveActions=[],e},m.deleteChatWebsiteChatProactiveAction=g,m.deleteSelectedChatWebsiteProactiveActions=function(e){var n=o.confirm().title("Are you sure want to delete the selected proactive?").htmlContent("<b>"+m.selectedChatWebsiteProactiveActions.length+" selected</b> will be deleted.").ariaLabel("delete proactive").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteProactiveActions.forEach(function(e){g(e)}),m.selectedChatWebsiteProactiveActions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteProactiveActionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATPROACTIVEACTION",g.chatProactiveAction=angular.copy(l),g.proactive=r,g.newChatProactiveAction=!1,g.chatProactiveAction||(g.chatProactiveAction={type:"mouseOver"},g.title="CHAT.NEW_CHATPROACTIVEACTION",g.newChatProactiveAction=!0),n.params.id&&(g.chatProactiveAction.ChatWebsiteId=n.params.id),g.addNewChatProactiveAction=function(){g.errors=[],d.chatProactiveAction.save(g.chatProactiveAction).$promise.then(function(e){g.proactive.unshift(e.toJSON()),o.success({title:"ChatProactiveAction properly created",msg:g.chatProactiveAction.name?g.chatProactiveAction.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatProactiveAction=function(){g.errors=[],d.chatProactiveAction.update({id:g.chatProactiveAction.id},g.chatProactiveAction).$promise.then(function(e){var n=_.find(g.proactive,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatProactiveAction properly saved!",msg:g.chatProactiveAction.name?g.chatProactiveAction.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatProactiveAction=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatProactiveAction will be deleted.").ariaLabel("Delete ChatProactiveAction").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatProactiveAction.delete({id:g.chatProactiveAction.id}).$promise.then(function(){_.remove(g.proactive,{id:g.chatProactiveAction.id}),o.success({title:"ChatProactiveAction properly deleted!",msg:(g.chatProactiveAction.name||"chatProactiveAction")+" has been deleted!"}),v(g.chatProactiveAction)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","proactive","chatProactiveAction","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatProactiveActionDialogController",e)}(),function(){"use strict";function e(e){var n=this;n.chatWebsite={},n.init=function(e){n.chatWebsite=e,n.start="\n\x3c!-- START Motion Chat Script --\x3e",n.script='\n    <script src="'+n.chatWebsite.remote+"/api/chat/websites/"+n.chatWebsite.id+"/snippet?token="+n.chatWebsite.token+'"><\/script>',n.end="\n\x3c!-- START Motion Chat Script --\x3e"},n.info={},e.$watch("vm_ac.chatWebsite.remote",function(e){n.script='\n    <script src="'+n.chatWebsite.remote+"/api/chat/websites/"+n.chatWebsite.id+"/snippet?token="+n.chatWebsite.token+'"><\/script>'})}e.$inject=["$scope"],angular.module("app.chat").controller("ChatWebsiteScriptController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/system_avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitesystemAvatarController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.chatWebsite=c||e.params.chatWebsite||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:p.chatWebsites?p.chatWebsites.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoChatWebsites=function(){e.go("app.chat.chatWebsites",{},{reload:"app.chat.chatWebsites"})},p.saveChatWebsite=function(){r.chatWebsite.update({id:p.chatWebsite.id},p.chatWebsite).$promise.then(function(){l.success({title:"ChatWebsite updated!",msg:p.chatWebsite.name?p.chatWebsite.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.chatWebsite&&(t=_.find(p.lists,{id:Number(p.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.chatWebsite&&(a=_.find(p.lists,{id:Number(p.chatWebsite.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){p.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){p.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.interval,{id:e.resourceId})}),t=null;if(p.chatWebsite&&(t=_.find(p.interval,{id:Number(p.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.interval,{id:t.id});a.canSelect=!1,n.push(a)}p.interval=n})}else{var t=[],a=null;p.chatWebsite&&(a=_.find(p.interval,{id:Number(p.chatWebsite.IntervalId)}));for(var i=0;i<p.interval.length;i++)a&&p.interval[i].id===a.id&&(p.interval[i].canSelect=!1,t.push(p.interval[i]));p.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","chatWebsite","userProfile","userProfileSection"],angular.module("app.chat").controller("ChatWebsiteController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.chat.realtime.agents":this.selectedTab=0;break;case"app.chat.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.chat.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.chat.realtime.agents");break;case 1:t.go("app.chat.realtime.queues");break;default:t.go("app.chat.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.chat").controller("ChatRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.companies=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="companies",f.listOrder="",f.listOrderAsc=null,f.selectedCompanies=[],f.query={fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){a.go("app.contactmanager.companies.edit",{id:e.id,company:e,crudPermissions:f.crudPermissions})},f.gotocontactsgoto=function(t,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{CompanyId:t.id}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{CompanyId:t.id})}},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("company")+"?").htmlContent("<b>"+(e.name||"company")+"</b> will be deleted.").ariaLabel("delete company").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCompanies=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmCompany.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Companies",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCompany=function(e,n){i.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{company:n,companies:f.companies.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCompany=y,f.exportSelectedCompanies=function(){var e=angular.copy(f.selectedCompanies);return f.selectedCompanies=[],e},f.deleteSelectedCompanies=function(e){var n=i.confirm().title("Are you sure want to delete the selected companies?").htmlContent("<b>"+f.selectedCompanies.length+" selected</b> will be deleted.").ariaLabel("delete Companys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCompanies.forEach(function(e){y(e)}),f.selectedCompanies=[]})},f.deselectCompanies=function(){f.selectedCompanies=[]},f.selectAllCompanies=function(){f.selectedCompanies=f.companies.rows};var b=!0,A=1;function E(e){f.companies=e||{count:0,rows:[]}}function y(e){m.cmCompany.delete({id:e.id}).$promise.then(function(){_.remove(f.companies.rows,{id:e.id}),f.companies.count-=1,f.companies.rows.length||f.getCompanies(),p.success({title:_.startCase("Company")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCompany"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmCompany",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCompanies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","companies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("CompaniesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_COMPANY",g.company=angular.copy(l),g.companies=r,g.newCompany=!1,g.company||(g.company={},g.title="CONTACTMANAGER.NEW_COMPANY",g.newCompany=!0),g.addNewCompany=function(){g.errors=[],d.cmCompany.save(g.company).$promise.then(function(e){g.companies.unshift(e.toJSON()),o.success({title:"Company properly created",msg:g.company.name?g.company.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCompany=function(){g.errors=[],d.cmCompany.update({id:g.company.id},g.company).$promise.then(function(e){var n=_.find(g.companies,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Company properly saved!",msg:g.company.name?g.company.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCompany=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The company will be deleted.").ariaLabel("Delete Company").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmCompany.delete({id:g.company.id}).$promise.then(function(){_.remove(g.companies,{id:g.company.id}),o.success({title:"Company properly deleted!",msg:(g.company.name||"company")+" has been deleted!"}),v(g.company)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","companies","company","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditCompanyDialogController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.company=c||a.params.company||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=a.params.tab||0,u.gotogoto=function(t,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{CompanyId:t.id}):l.info({title:i.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:i.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{CompanyId:t.id})}},u.alert=l.info,u.gotoCompanies=function(){a.go("app.contactmanager.companies",{},{reload:"app.contactmanager.companies"})},u.saveCompany=function(){r.cmCompany.update({id:u.company.id},u.company).$promise.then(function(){l.success({title:"Company updated!",msg:u.company.name?u.company.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmCompany",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","company","userProfileSection"],angular.module("app.contactmanager").controller("CompanyController",e)}(),function(){"use strict";function e(n,i,t,a,e,s,o,r,l,d,c,m,u,p,g,v,h,f,b){var A=this;A.currentUser=f.getCurrentUser(),A.license=b,A.userProfile=r,A.userProfileSection=l&&1==l.count?l.rows[0]:null,A.crudPermissions=f.parseCrudPermissions(A.userProfileSection?A.userProfileSection.crudPermissions:null);var E=60,y=1024*E*1024;A.ngFlowOptions={target:"api/cm/contacts/upload",singleFile:!0,maxChunkRetries:1,chunkSize:y,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},A.contacts=c||{count:0,rows:[]},A.options={hidden:!1,hover:!1,isOpen:!1},A.table="cm_contacts",A.selectedContacts=[],A.lists=m||{rows:[],count:0},A.companies=p||{rows:[],count:0},A.tags=v||{rows:[],count:0},A.listsMap=u,A.companiesMap=g,A.selectedTags=[],A.selectedList=null,A.selectedCompany=null,A.query=_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0,page:1},e),A.editdialog=function(e,n){a.go("app.contactmanager.contacts.edit",{id:e.id,crudPermissions:A.crudPermissions})},A.deleteconfirm=function(e,n){var t=s.confirm().title("Are you sure want to delete the contact?").htmlContent("<b>"+(e.firstName||e.email||e.phone||"Contact")+"</b> will be deleted.").ariaLabel("delete contact").targetEvent(n).ok("OK").cancel("CANCEL");s.show(t).then(function(){O(e)})},A.success=I,A.getContacts=function(){A.query.offset=(A.query.page-1)*A.query.limit,f.hasRole("admin")?A.promise=d.cmContact.get(A.query,I).$promise:(A.query.id=A.userProfile.id,A.query.ListId=A.query.ListId?A.query.ListId:_.map(A.lists.rows,"id"),A.query.CompanyId=A.query.CompanyId?A.query.CompanyId:_(A.companies.rows).filter({canSelect:void 0}).map("id").value(),A.query.section="Contacts",A.promise=d.userProfile.getResources(A.query,I).$promise)},A.getAssignedCompanies=function(){if(!f.hasRole("admin")){var e=_(A.contacts.rows).map(function(e){return{id:e.CompanyId}}).uniqBy("id").filter(function(e){return e.id&&0<e.id}).pullAllBy(A.companies.rows,"id").value();if(!_.isEmpty(e)){var n=[];e.forEach(function(e){n.push(d.cmCompany.get({id:e.id,fields:"id,name"}).$promise)}),o.all(n).then(function(e){e.forEach(function(e){var n=e.toJSON();n.canSelect=!1,A.companies.rows.push(n);var t={};t[n.id]=n.name,A.companiesMap=_.assignIn(A.companiesMap,t)})}).catch(function(e){h.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_COMPANY",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}},A.mergeContact=function(e,n){s.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:A.contacts.rows}})},A.duplicateContact=function(e,n){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:A.contacts.rows}})},A.createOrEditContact=function(e,n){n&&n.dateOfBirth&&(n.dateOfBirth=new Date(n.dateOfBirth));s.show({controller:"CreateOrEditContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{ListId:A.query.ListId||a.params.ListId,CompanyId:A.query.CompanyId||a.params.CompanyId,contact:n,contacts:A.contacts.rows,companies:A.companies,lists:A.lists,setting:null,crudPermissions:A.crudPermissions}})},A.deleteContact=O,A.exportSelectedContacts=function(){var e=angular.copy(A.selectedContacts);return A.selectedContacts=[],e},A.deleteSelectedContacts=function(e){var n=s.confirm().title("Are you sure want to delete the selected contacts?").htmlContent("<b>"+A.selectedContacts.length+" selected</b> will be deleted.").ariaLabel("delete Contacts").targetEvent(e).ok("OK").cancel("CANCEL");s.show(n).then(function(){A.selectedContacts.forEach(function(e){O(e)}),A.selectedContacts=[]})},A.deselectContacts=function(){A.selectedContacts=[]},A.selectAllContacts=function(){A.selectedContacts=A.contacts.rows},A.createTag=function(e){var n=s.prompt().title("What would you name your tag?").placeholder("Tag name").ariaLabel("Tag name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.tag.save({name:e});h.error({title:"Error creating tag!",msg:"Invalid tag name."})}).then(function(e){e&&(A.tags.rows.push(e),h.success({title:"Tag properly created!",msg:e.tag?e.name+" has been created!":""}))})},A.createList=function(e){var n=s.prompt().title("What would you name your list?").placeholder("List name").ariaLabel("List name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.cmList.save({name:e});h.error({title:"Error creating list!",msg:"Invalid list name."})}).then(function(e){e&&(A.lists.rows.push(e),h.success({title:"List properly created!",msg:e.name?e.name+" has been created!":""}))})},A.createCompany=function(e){var n=s.prompt().title("What would you name your company?").placeholder("Company name").ariaLabel("Company name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.cmCompany.save({name:e});h.error({title:"Error creating company!",msg:"Invalid company name."})}).then(function(e){e&&(A.companies.rows.push(e),h.success({title:"Company properly created!",msg:e.name?e.name+" has been created!":""}))})},A.importContacts=function(e,n,t){var a=JSON.parse(n);s.show({controller:"ImportContactsDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/import/import.html",parent:angular.element(i.body),clickOutsideToClose:!1,locals:{lists:m,companies:p,file:a.file,fields:a.fields,license:A.license}}).then(function(){A.getContacts()}).catch(function(e){console.error()})},A.importContactsUpdates=function(e,n,t){var a=JSON.parse(n);s.show({controller:"ImportContactsUpdatesDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/import/importUpdates.html",parent:angular.element(i.body),clickOutsideToClose:!1,locals:{lists:m,companies:p,file:a.file,fields:a.fields,license:A.license}}).then(function(){A.getContacts()}).catch(function(e){console.error()})},A.hasPermission=function(){return f.hasPermission(303)||f.hasRole("admin")},A.fileAdded=function(e){var n=["csv"];if(!_.includes(n,e.getExtension()))return h.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>y)return h.error({title:"File too big",msg:"The max allowed size is "+E+"MB"}),!1;return!0},a.params.ListId&&(A.selectedList=a.params.ListId),a.params.CompanyId&&(A.selectedCompany=a.params.CompanyId),n.$watch("vm.options.isOpen",function(e){e?t(function(){n.tooltipVisible=A.options.isOpen},600):n.tooltipVisible=A.options.isOpen});var S=!0,T=1;function I(e){A.contacts=e||{count:0,rows:[]}}function O(e){d.cmContact.delete({id:e.id}).$promise.then(function(){_.remove(A.contacts.rows,{id:e.id}),A.contacts.count-=1,A.contacts.rows.length||A.getContacts(),h.success({title:"Contact deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){A.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}];for(var n=0;n<e.data.errors.length;n++)h.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else h.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}n.$watch("vm.query.filter",function(e,n){S?t(function(){S=!1}):(n||(T=A.query.page),e!==n&&(A.query.page=1),e||(A.query.page=T),A.getContacts())},!0),n.$watch("vm.selectedList",function(e,n){e!==n&&(A.query.ListId=A.selectedList||void 0,A.getContacts())}),n.$watch("vm.selectedCompany",function(e,n){e!==n&&(A.query.CompanyId=A.selectedCompany||void 0,A.getContacts())}),n.$watch("vm.selectedTags",function(e,n){(e.length||n.length)&&A.getContacts()})}e.$inject=["$scope","$document","$timeout","$state","$stateParams","$mdDialog","$q","userProfile","userProfileSection","api","contacts","lists","listsMap","companies","companiesMap","tags","toasty","Auth","license"],angular.module("app.contactmanager").controller("ContactsController",e)}(),function(){"use strict";function e(t,e,a,n,i,s,o,r,l,d,c){var m=this;if(m.errors=[],m.title="CONTACTMANAGER.EDIT_CONTACT",m.crudPermissions=c,m.contact=angular.copy(o),m.additionalItemTypes=[],m.additionalItems=[],m.contacts=n||{rows:[],count:0},m.lists=i||{rows:[],count:0},m.companies=s||{rows:[],count:0},m.customFields={rows:[],count:0},m.newContact=!1,m.newPhone=function(e){return{phone:e,color:"gray"}},m.contactItemTypes=[],m.contact)delete m.contact.List,f(m.contact.ListId),d.cmContact.getAdditionalPhones({id:o.id}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");m.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");m.additionalItems=[];for(var s=0;s<n.length;s++)m.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})}).catch(function(e){console.log(e)});else{m.contact={ListId:r?parseInt(r,10):void 0,CompanyId:l?parseInt(l,10):void 0};var u=_.map(m.contact.Phones,"item"),p=_.map(m.contact.Phones,"description");m.additionalItemTypes=_.map(m.contact.Phones,"ItemTypeId");var g=_.map(m.contact.Phones,"ItemType.rgbBackgroundColor"),v=_.map(m.contact.Phones,"ItemType.name");m.additionalItems=[];for(var h=0;h<u.length;h++)m.additionalItems.push({phone:u[h],type:v[h],color:g[h],description:p[h]});m.title="CONTACTMANAGER.NEW_CONTACT",m.newContact=!0,b()}function f(e){if(e)return d.cmList.getCustomFields({id:e}).$promise.then(function(e){if(e){m.customFields=e;var n=_.map(m.customFields.rows,function(e){return"cf_"+e.id});return d.cmContact.get({id:m.contact.id,attributes:n,raw:!0}).$promise.then(function(e){m.contact=_.merge(m.contact,e)})}}).then(function(){m.customFields.rows.forEach(function(e){"datetime"===e.type&&m.contact["cf_"+e.id]&&(m.contact["cf_"+e.id]=A(m.contact["cf_"+e.id]))}),Object.keys(m.contact).forEach(function(e){if(_.startsWith(e,"cf_")){var n=e.split("_")[1];_.some(m.customFields.rows,["id",Number(n)])||delete m.contact["cf_"+n]}})}).catch(function(e){console.error(e)});m.customFields={rows:[],count:0}}function b(){return d.cmList.getGlobalCustomFields().$promise.then(function(e){if(e){m.customFields=e;_.map(m.customFields.rows,function(e){return"cf_"+e.id})}else;}).catch(function(e){console.error(e)})}function A(e){return null===e?void 0:new Date(e)}function E(){t.hide()}d.contactItemType.get({fields:"id,name,rgbBackgroundColor"}).$promise.then(function(e){m.contactItemTypes=e.rows}),m.addNewContact=function(){m.errors=[],d.cmContact.save(m.contact).$promise.then(function(e){m.contacts.unshift(e),d.cmContact.setAdditionalPhones({id:e.id,items:m.additionalItems,item_types:m.additionalItemTypes}).$promise.then(function(){a.success({title:"Contact properly created",msg:m.contact.name?m.contact.name+" has been created!":""}),E()})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contacts.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveContact=function(){m.errors=[],d.cmContact.update({id:m.contact.id},m.contact).$promise.then(function(e){var n=_.find(m.contacts,{id:e.id});n&&_.merge(n,e)}).then(function(){return d.cmContact.setAdditionalPhones({id:o.id,items:m.additionalItems,item_types:m.additionalItemTypes}).$promise.then(function(){a.success({title:"Contact properly saved!",msg:m.contact.name?m.contact.name+" has been saved!":""}),E()})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteContact=function(e){m.errors=[];var n=t.confirm().title("Are you sure?").content("The contact will be deleted.").ariaLabel("Delete Contact").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmContact.delete({id:m.contact.id}).$promise.then(function(){_.remove(m.contacts,{id:m.contact.id}),a.success({title:"Contact properly deleted!",msg:m.contact.name?m.contact.name+" has been deleted!":""}),E()}).catch(function(e){console.error(e),m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}]})},function(){})},m.closeDialog=E,m.getCustomFields=f,m.getDateFromString=A,e.$watch("vm.contact.ListId",function(e,n){_.isNil(e)&&b()})}e.$inject=["$mdDialog","$scope","toasty","contacts","lists","companies","contact","ListId","CompanyId","api","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactDialogController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.errors=[],o.title="CONTACTMANAGER.COPY_CONTACT",o.contact=angular.copy(n),o.lists=i||{rows:[],count:0},o.addNewContact=function(){o.errors=[];var n=o.contact.id;delete o.contact.id,o.contact.tags&&!o.contact.tags.length&&delete o.contact.tags;s.cmContact.save(o.contact).$promise.then(function(e){return a.unshift(e),s.cmContact.duplicateAdditionalPhones({id:n,fromContactId:n,toContactId:e.id}).$promise.then(function(){t.success({title:"Contact properly created",msg:o.contact.name?o.contact.name+" has been created!":""}),r()})}).catch(function(e){console.error(e),o.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("DuplicateContactDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e){a.hide(e)}d.errors=[],d.title="CONTACTMANAGER.EDIT_HOPPER",d.hopper=angular.copy(o),d.hoppers=s,d.newHopper=!1,d.crudPermissions=l,d.hopper||(d.hopper={},d.title="CONTACTMANAGER.NEW_HOPPER",d.newHopper=!0),d.saveHopper=function(){d.errors=[],r.cmHopper.update({id:d.hopper.id},d.hopper).$promise.then(function(e){var n=_.find(d.hoppers,{id:e.id});n&&_.merge(n,e),i.success({title:"Hopper properly saved!",msg:d.hopper.name?d.hopper.name+" has been saved!":""}),c(e)}).catch(function(e){console.error(e),d.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}]})},d.getDateFromString=function(e){return null===e?void 0:new Date(e)},d.closeDialog=c}e.$inject=["$scope","$state","$location","$mdDialog","toasty","hoppers","hopper","api","crudPermissions"],angular.module("app.contactmanager.contacts").controller("EditHopperDialogController",e)}(),function(){"use strict";function e(a,t,e,i,s,n,o,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y){var S=this;function T(n){return function(e){S[n]=e||{count:0,rows:[]}}}function I(){S.queryHopper.offset=(S.queryHopper.page-1)*S.queryHopper.limit,S.queryHopper.id=S.contact.id,S.promise=r.cmContact.getHoppers(S.queryHopper,T("hoppers")).$promise}function O(){S.queryFinal.offset=(S.queryFinal.page-1)*S.queryFinal.limit,S.queryFinal.id=S.contact.id,S.promise=r.cmContact.getHopperFinals(S.queryFinal,T("finals")).$promise}function C(){S.queryHistory.offset=(S.queryHistory.page-1)*S.queryHistory.limit,S.queryHistory.id=S.contact.id,S.promise=r.cmContact.getHopperHistories(S.queryHistory,T("histories")).$promise}function w(e){S.journeyIsLoading=!0;var n=_.merge(S.journeyOptions,{id:S.contact.id,offset:e||0});return y.get(S.journey,n).then(function(e){S.journey=e.journey,S.canLoadMoreJourney=e.loadMore}).finally(function(){S.journeyIsLoading=!1})}S.currentUser=A.getCurrentUser(),S.license=b,S.journey=[],S.contact=l||{},S.hoppers=d||{rows:[],count:0},S.finals=c||{rows:[],count:0},S.histories=m||{rows:[],count:0},S.companies=p||{rows:[],count:0},S.lists=g||{rows:[],count:0},S.customFields=v||{rows:[],count:0},S.tags=h||{rows:[],count:0},S.jscriptySessions=f||{rows:[],count:0},S.journeyOptions=y.getQuery(),S.quickFilters=y.getQuickFilters(),S.journeyTimelineOptions={scrollEl:"#journey-content"},S.additionalItems=[],S.additionalItemTypes=[],S.contactItemTypes=[],S.firstDayMonth=new Date(moment().startOf("month").subtract(1,"seconds").utcOffset(0,!0).format()),S.lastDayMonth=new Date(moment().endOf("month").subtract(1,"day").utcOffset(0,!0).format()),S.userProfileSection=E&&1==E.count?E.rows[0]:null,S.crudPermissions=A.parseCrudPermissions(S.userProfileSection?S.userProfileSection.crudPermissions:null),S.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.queryHopper={fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,page:1},S.queryFinal={fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-id",limit:10,page:1},S.queryHistory={fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-id",limit:10,page:1},S.queryJscriptySession={fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,page:1},S.selectedTab=e.params.tab||0,S.onInit=function(){A.hasRole("admin")||(function(){if(!_.some(S.companies.rows,{id:S.contact.CompanyId}))r.cmCompany.get({id:S.contact.CompanyId,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,S.companies.rows.push(n)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_COMPANY",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}(),function(){var e=_.map(S.contact.Tags,function(e){return{id:e.id,name:e.name}});if(!_.isEmpty(e))for(var n=0;n<e.length;n++)_.some(S.tags.rows,{id:e.id})||(e[n].canSelect=!1,S.tags.rows.push(e[n]))}());return r.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){S.users=e||{count:0,rows:[]},S.usersMap=_.mapValues(_.keyBy(S.users.rows,"id"),"fullname"),S.Tags=_.map(S.contact.Tags,"id");var n=_.map(S.contact.Phones,"item"),t=_.map(S.contact.Phones,"description");S.additionalItemTypes=_.map(S.contact.Phones,"ItemTypeId");var a=_.map(S.contact.Phones,"ItemType.rgbBackgroundColor"),i=_.map(S.contact.Phones,"ItemType.name"),s=_.map(S.contact.Phones,"ItemType.id");S.additionalItems=[];for(var o=0;o<n.length;o++)S.additionalItems.push({phone:n[o],type:i[o],ItemTypeId:s[o],color:a[o],description:t[o]})}).then(function(e){r.contactItemType.get({fields:"id,name,rgbBackgroundColor"}).$promise.then(function(e){S.contactItemTypes=e.rows})}).finally(function(){S.contact&&w()})},S.gotoContacts=function(){e.go("app.contactmanager.contacts",{},{reload:!0,notify:!0})},S.duplicateContact=function(e){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name"}):e.resolve("userProfile@getResources",{id:S.currentUser.userProfileId,section:"Lists",fields:"id,name"})}]},locals:{contacts:u.rows,contact:l}})},S.saveContact=function(){r.cmContact.update({id:S.contact.id},S.contact).$promise.then(function(){o.success({title:"Contact updated!",msg:S.contact.name?S.contact.name+" has been updated!":""})}).then(function(){return r.cmContact.setTags({id:S.contact.id,ids:S.Tags}).$promise}).then(function(){return r.cmContact.setAdditionalPhones({id:S.contact.id,items:S.additionalItems}).$promise}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})})},S.editCompany=function(e,n){var t=_.find(S.companies.rows,{id:n});s.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{companies:[],license:null,setting:null,crudPermissions:!1===t.canSelect?{readOnly:!0,canEdit:!1,canDelete:!1}:r.userProfileSection.get({userProfileId:S.currentUser.userProfileId,sectionId:302}).$promise.then(function(e){var n=e.rows?e.rows[0]:null;return A.parseCrudPermissions(n?n.crudPermissions:null)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"API:GET_COMPANY_SECTION",msg:e.data?JSON.stringify(e.data):e.toString()})})},resolve:{company:["apiResolver",function(e){return e.resolve("cmCompany@get",{id:n})}]}})},S.onSelectList=function(e){if(S.contact.ListId){var n=s.confirm().title("You are selecting the list number: "+S.contact.ListId).textContent("Warning! You won't select a different list for the contact "+S.contact.firstName||S.contact.lastName||S.contact.id).targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(S.onSelectListSuccess).catch(function(){S.contact.ListId=null})}},S.onSelectListSuccess=function(){return r.cmList.getCustomFields({id:S.contact.ListId}).$promise.then(function(e){S.customFields=e||{rows:[],count:0}}).catch(function(e){console.error(e)})},S.getDateFromString=function(e){return null===e?void 0:new Date(e)},S.getHoppers=I,S.getFinals=O,S.getHistories=C,S.getJscriptySessions=function(){S.queryJscriptySession.offset=(S.queryJscriptySession.page-1)*S.queryJscriptySession.limit,S.queryJscriptySession.id=S.contact.id,S.promise=r.cmContact.getJscriptySessions(S.queryJscriptySession,T("jscriptySessions")).$promise},S.deleteconfirm=function(n,e){var t=s.confirm().title("Are you sure want to delete the agent?").htmlContent("<b>"+(n.phone||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){var e;e=n,r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(S.hoppers.rows,{id:e.id}),S.hoppers.count--,S.hoppers.rows.length||S.getHoppers(),o.success({title:"Hopper deleted!",msg:e.phone?e.phone+" has been deleted!":""})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEhopper",msg:e.data?JSON.stringify(e.data):e.toString()})})},function(){console.log("CANCEL")})},S.editHopper=function(e,n){s.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:n,hoppers:S.hoppers.rows,license:null,setting:null,crudPermissions:S.crudPermissions}})},S.createOrEditIvrCampaignHopper=function(e,n){s.show({controller:"CreateOrEditHopperCampaignIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:n,hoppers:S.hoppers.rows,license:null,setting:null,crudPermissions:S.crudPermissions}})},S.newPhone=function(e){return{phone:e,color:"gray"}},S.getCustomerJourney=w,S.loadMoreJourney=function(){return n(function(e,n){var t=S.journey.length;return e(w(t))})},S.moveUp=function(e){N(e,e-1)},S.moveDown=function(e){N(e,e+1)};var R=!0,x=1;function N(e,n){var t=S.additionalItems[n];S.additionalItems[n]=S.additionalItems[e],S.additionalItems[e]=t,a.additionalPhonesForm.$setDirty()}a.$watch("vm.queryHopper.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryHopper.page),e!==n&&(S.queryHopper.page=1),e||(S.queryHopper.page=x),I())}),a.$watch("vm.queryFinal.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryFinal.page),e!==n&&(S.queryFinal.page=1),e||(S.queryFinal.page=x),O())}),a.$watch("vm.queryHistory.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryHistory.page),e!==n&&(S.queryHistory.page=1),e||(S.queryHistory.page=x),C())})}e.$inject=["$scope","$timeout","$state","$document","$mdDialog","$q","toasty","api","contact","hoppers","finals","histories","contacts","companies","lists","customFields","tags","jscriptySessions","license","Auth","userProfileSection","customerJourneyManager"],angular.module("app.contactmanager.contacts").controller("ContactController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;g.processing=!1,g.stopping=!0,g.license=p,g.pid=0,g.result={finish:!1,rows:0,affectedRows:0,failedRows:0,duplicatedRows:0,errors:[]},g.contactFields=[{key:"firstName",required:!0},{key:"lastName",required:!1},{key:"phone",required:!0},{key:"mobile",required:!1},{key:"email",required:!1},{key:"dateOfBirth",required:!1},{key:"country",required:!1},{key:"city",required:!1},{key:"street",required:!1},{key:"postalCode",required:!1},{key:"fax",required:!1}],g.motionBullFields=[{key:"UserId",required:!1},{key:"scheduledat",required:!1},{key:"priority",required:!1},{key:"dialTimezone",required:!1}],g.contactItemTypes=[],l.contactItemType.get({fields:"id,name,orderBy"}).$promise.then(function(e){var n=e.rows;console.log(n);for(var t=0;t<n.length;t++)g.contactItemTypes.push({key:n[t].name,required:!1})}),g.binding={},g.duplicate=[],g.lists=s||{rows:[],count:0},g.companies=o||{rows:[],count:0},g.customFields={rows:[],count:0},g.fields=u||[],g.closeDialog=function(){d.removeAllListeners("contact:import:"+v),n.hide()},g.onChangeList=function(){return l.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})},g.uploadCsv=function(){g.processing=moment(),l.cmContact.import({id:m.filename,binding:g.binding,ListId:g.ListId,CompanyId:g.CompanyId,duplicates:g.duplicates,socket_timestamp:v}).$promise.then(function(e){g.stopping=!1,e&&e.pid&&(g.pid=e.pid)}).catch(function(e){g.processing=!1,r.error({title:"Import process failed!",msg:"Please retry with a new file"})})},g.getHeaderErrors=function(){var e=u;return e.push("contact_import_error"),e},g.getArrayErrors=function(){for(var e=[],n=0;n<g.result.errors.length;n+=1){var t=g.result.errors[n].row;t.contact_import_error=g.result.errors[n].message,e.push(t)}return e},g.stopUpload=function(){if(g.stopping=!0,g.pid)return l.system.killProcess({pid:g.pid}).$promise.then(function(e){r.success({title:"CSV import process stopped!",msg:"Import has been stopped!"})}).catch(function(e){r.error({title:"CSV stop import process failed!",msg:"pid is unknown"})})};var v=moment().unix();d.on("contact:import:"+v,function(t){i(function(){if(g.result.rows=t.rows,t.errors)for(var e=0;e<t.errors.length;e++)g.result.errors.push(t.errors[e]);if(t.finish){g.result.finish=!0,g.result.affectedRows=t.affectedRows,g.result.failedRows=g.result.errors.length;var n=g.result.rows-g.result.affectedRows-g.result.errors.length;n&&0<n&&(g.duplicates.length?g.result.duplicatedRows=n:g.result.failedRows+=n),g.result.elapsed=moment().diff(g.processing,"seconds")}})}),c.$on("$destroy",function(){d.removeAllListeners("contact:import:"+v)})}e.$inject=["$cookies","$mdDialog","$interval","$q","$timeout","lists","companies","toasty","api","socket","$scope","file","fields","license"],angular.module("app.tools").controller("ImportContactsDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;g.processing=!1,g.stopping=!0,g.license=p,g.pid=0,g.result={finish:!1,rows:0,affectedRows:0,failedRows:0,duplicatedRows:0,errors:[]},g.contactFields=[{key:"id",required:!0},{key:"firstName",required:!1},{key:"lastName",required:!1},{key:"phone",required:!0},{key:"mobile",required:!1},{key:"email",required:!1},{key:"dateOfBirth",required:!1},{key:"country",required:!1},{key:"city",required:!1},{key:"street",required:!1},{key:"postalCode",required:!1},{key:"fax",required:!1}],g.motionBullFields=[{key:"UserId",required:!1},{key:"scheduledat",required:!1},{key:"priority",required:!1}],g.contactItemTypes=[],l.contactItemType.get({fields:"id,name,orderBy"}).$promise.then(function(e){for(var n=e.rows,t=0;t<n.length;t++)g.contactItemTypes.push({key:n[t].name,required:!1})}),g.binding={},g.duplicate=[],g.lists=s||{rows:[],count:0},g.companies=o||{rows:[],count:0},g.customFields={rows:[],count:0},g.fields=u||[],g.closeDialog=function(){d.removeAllListeners("contact:import:"+v),n.hide()},g.onChangeList=function(){return l.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})},g.uploadCsv=function(){g.processing=moment(),l.cmContact.importUpdates({id:m.filename,binding:g.binding,ListId:g.ListId,CompanyId:g.CompanyId,duplicates:g.duplicates,socket_timestamp:v}).$promise.then(function(e){g.stopping=!1,e&&e.pid&&(g.pid=e.pid)}).catch(function(e){g.processing=!1,r.error({title:"Import process failed!",msg:"Please retry with a new file"})})},g.getHeaderErrors=function(){var e=u;return e.push("contact_import_error"),e},g.getArrayErrors=function(){for(var e=[],n=0;n<g.result.errors.length;n+=1){var t=g.result.errors[n].row;t.contact_import_error=g.result.errors[n].message,e.push(t)}return e},g.stopUpload=function(){if(g.stopping=!0,g.pid)return l.system.killProcess({pid:g.pid}).$promise.then(function(e){r.success({title:"CSV import process stopped!",msg:"Import has been stopped!"})}).catch(function(e){r.error({title:"CSV stop import process failed!",msg:"pid is unknown"})})};var v=moment().unix();d.on("contact:import:"+v,function(t){i(function(){if(g.result.rows=t.rows,t.errors)for(var e=0;e<t.errors.length;e++)g.result.errors.push(t.errors[e]);if(t.finish){g.result.finish=!0,g.result.affectedRows=t.affectedRows,g.result.failedRows=g.result.errors.length;var n=g.result.rows-g.result.affectedRows-g.result.errors.length;n&&0<n&&(g.duplicates.length?g.result.duplicatedRows=n:g.result.failedRows+=n),g.result.elapsed=moment().diff(g.processing,"seconds")}})}),c.$on("$destroy",function(){d.removeAllListeners("contact:import:"+v)})}e.$inject=["$cookies","$mdDialog","$interval","$q","$timeout","lists","companies","toasty","api","socket","$scope","file","fields","license"],angular.module("app.tools").controller("ImportContactsUpdatesDialogController",e)}(),function(){"use strict";function e(i,e,s,n,o,t,r){var a=this;a.errors=[],a.title="CONTACTMANAGER.MERGE_CONTACT",a.contact=angular.copy(n),a.lists=t||[],a.change=function(){a.searchTerm?r.cmContact.get({fields:"id,firstName,lastName,phone,email",filter:a.searchTerm,ListId:n.ListId}).$promise.then(function(e){a.contacts=e.rows}).catch(function(e){console.error(e)}):a.contacts=[]},a.showConfirm=function(e,n,t){var a=i.confirm({skipHide:!0}).title("Would you like to merge your contacs?").textContent("All unfilled values of the contact #"+t.id+" will be overwritten by the fields of the contact #"+n.id+".").targetEvent(e).ok("Ok").cancel("Cancel");i.show(a).then(function(){return r.cmContact.merge({to:t.id,from:n.id}).$promise}).then(function(e){i.hide({new:e,to:t,from:n}),_.remove(o,{id:t.id}),_.remove(o,{id:n.id}),o.unshift(e)}).then(function(){s.success({title:"Contact properly merged!"})}).catch(function(e){e&&e.status&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:MERGE_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})})},a.closeDialog=function(){i.hide()}}e.$inject=["$mdDialog","$scope","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("MergeContactDialogController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){t.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD",g.sortable={animation:800,sort:!0,onSort:function(e){a.globalCustomFieldForm.$pristine=!1}},g.globalCustomField=l,g.globalCustomFields=r,g.newGlobalCustomField=!1,g.globalCustomField||(g.globalCustomField={type:"text",actionType:"voice"},g.title="CONTACTMANAGER.NEW_GLOBALCUSTOMFIELD",g.newGlobalCustomField=!0),a.$watch("vm.globalCustomField.type",function(e,n){if(e!==n)switch(e){case"text":g.globalCustomField.values="";break;case"select":g.globalCustomField.values=[]}}),g.addNewGlobalCustomField=function(){g.errors=[],d.cmCustomField.save(g.globalCustomField).$promise.then(function(e){g.globalCustomFields.unshift(e.toJSON()),o.success({title:"GlobalCustomField properly created",msg:g.globalCustomField.name?g.globalCustomField.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveGlobalCustomField=function(){g.errors=[],d.cmCustomField.update({id:g.globalCustomField.id},g.globalCustomField).$promise.then(function(e){var n=_.find(g.globalCustomFields,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"GlobalCustomField properly saved!",msg:g.globalCustomField.name?g.globalCustomField.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteGlobalCustomField=function(e){g.errors=[];var n=t.confirm().title("Are you sure?").content("The globalCustomField will be deleted.").ariaLabel("Delete GlobalCustomField").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmCustomField.delete({id:g.globalCustomField.id}).$promise.then(function(){_.remove(g.globalCustomFields,{id:g.globalCustomField.id}),o.success({title:"GlobalCustomField properly deleted!",msg:(g.globalCustomField.name||"globalCustomField")+" has been deleted!"}),v(g.globalCustomField)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.addItem=function(e){e.push({value:"New Item"}),a.globalCustomFieldForm.$pristine=!1},g.removeItem=function(e,n){e.splice(n,1),a.globalCustomFieldForm.$pristine=!1},g.removeItems=function(e){for(var n=e.length,t=0;t<n;t++)e.splice(0,1);a.globalCustomFieldForm.$pristine=!1},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","globalCustomFields","globalCustomField","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditGlobalCustomFieldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.globalCustomFields=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="globalCustomFields",f.listOrder="",f.listOrderAsc=null,f.selectedGlobalCustomFields=[],f.query={fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",sort:"-updatedAt",ListId:"null",limit:10,page:1},f.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayactionType=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{globalCustomField:e,globalCustomFields:f.globalCustomFields.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("globalCustomField")+"?").htmlContent("<b>"+(e.name||"globalCustomField")+"</b> will be deleted.").ariaLabel("delete globalCustomField").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getGlobalCustomFields=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmCustomField.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="GlobalCustomFields",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditGlobalCustomField=function(e,n){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{globalCustomField:n,globalCustomFields:f.globalCustomFields.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteGlobalCustomField=y,f.exportSelectedGlobalCustomFields=function(){var e=angular.copy(f.selectedGlobalCustomFields);return f.selectedGlobalCustomFields=[],e},f.deleteSelectedGlobalCustomFields=function(e){var n=i.confirm().title("Are you sure want to delete the selected globalCustomFields?").htmlContent("<b>"+f.selectedGlobalCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete GlobalCustomFields").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedGlobalCustomFields.forEach(function(e){y(e)}),f.selectedGlobalCustomFields=[]})},f.deselectGlobalCustomFields=function(){f.selectedGlobalCustomFields=[]},f.selectAllGlobalCustomFields=function(){f.selectedGlobalCustomFields=f.globalCustomFields.rows};var b=!0,A=1;function E(e){f.globalCustomFields=e||{count:0,rows:[]}}function y(e){m.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(f.globalCustomFields.rows,{id:e.id}),f.globalCustomFields.count-=1,f.globalCustomFields.rows.length||f.getGlobalCustomFields(),p.success({title:_.startCase("GlobalCustomField")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCustomField"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmCustomField",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getGlobalCustomFields())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","globalCustomFields","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("GlobalCustomFieldsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_LIST",g.list=angular.copy(l),g.lists=r,g.newList=!1,g.list||(g.list={},g.title="CONTACTMANAGER.NEW_LIST",g.newList=!0),g.addNewList=function(){g.errors=[],d.cmList.save(g.list).$promise.then(function(e){g.lists.unshift(e.toJSON()),o.success({title:"List properly created",msg:g.list.name?g.list.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveList=function(){g.errors=[],d.cmList.update({id:g.list.id},g.list).$promise.then(function(e){var n=_.find(g.lists,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"List properly saved!",msg:g.list.name?g.list.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteList=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The list will be deleted.").ariaLabel("Delete List").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmList.delete({id:g.list.id}).$promise.then(function(){_.remove(g.lists,{id:g.list.id}),o.success({title:"List properly deleted!",msg:(g.list.name||"list")+" has been deleted!"}),v(g.list)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","lists","list","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditListDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.cmList.getAgents({id:c.list.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserList?"penalty "+e.UserList.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.list=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.cmList.removeAgents({id:c.list.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.cmList.addAgents({id:c.list.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CONTACTMANAGER.ALL_AGENTS"),labelSelected:r.instant("CONTACTMANAGER.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","list","lists","realtime","$translate","Auth","crudPermissions"],angular.module("app.contactmanager").controller("ListagentaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.listCustomFields=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.cmList.getCustomFields(m.query,u).$promise}function g(e){d.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(m.listCustomFields.rows,{id:e.id}),m.listCustomFields.count-=1,m.listCustomFields.rows.length||p(),l.success({title:"CustomField deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcmList"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.list={},m.listCustomFields={count:0,rows:[]},m.selectedListCustomFields=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",limit:10,page:1},m.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.arrayactionType=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.list=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ListId=m.list.id,m.query.id=m.list.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the customField?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("customField #")+e.id||"customField")+"</b> will be deleted.").ariaLabel("delete customField").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getListCustomFields=p,m.createOrEditListCustomField=function(e,n){o.show({controller:"CreateOrEditCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:m.list,customField:n,customFields:m.listCustomFields.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedListCustomFields=function(){var e=angular.copy(m.selectedListCustomFields);return m.selectedListCustomFields=[],e},m.deleteListCustomField=g,m.deleteSelectedListCustomFields=function(e){var n=o.confirm().title("Are you sure want to delete the selected customFields?").htmlContent("<b>"+m.selectedListCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete customFields").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedListCustomFields.forEach(function(e){g(e)}),m.selectedListCustomFields=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.contactmanager").controller("ListCustomFieldsController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){t.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_CUSTOMFIELD",g.sortable={animation:800,sort:!0,onSort:function(e){a.customFieldForm.$pristine=!1}},g.customField=l,g.customFields=r,g.newCustomField=!1,g.customField||(g.customField={type:"text",actionType:"voice"},g.title="CONTACTMANAGER.NEW_CUSTOMFIELD",g.newCustomField=!0),e.params.id&&(g.customField.ListId=e.params.id),a.$watch("vm.customField.type",function(e,n){if(e!==n)switch(e){case"text":g.customField.values="";break;case"select":g.customField.values=[]}}),g.addNewCustomField=function(){g.errors=[],d.cmList.addCustomField({id:e.params.id},g.customField).$promise.then(function(e){g.customFields.unshift(e.toJSON()),o.success({title:"CustomField properly created",msg:g.customField.name?g.customField.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomField=function(){g.errors=[],d.cmCustomField.update({id:g.customField.id},g.customField).$promise.then(function(e){var n=_.find(g.customFields,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CustomField properly saved!",msg:g.customField.name?g.customField.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomField=function(e){g.errors=[];var n=t.confirm().title("Are you sure?").content("The customField will be deleted.").ariaLabel("Delete CustomField").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmCustomField.delete({id:g.customField.id}).$promise.then(function(){_.remove(g.customFields,{id:g.customField.id}),o.success({title:"CustomField properly deleted!",msg:(g.customField.name||"customField")+" has been deleted!"}),v(g.customField)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.addItem=function(e){e.push({value:"New Item"}),a.customFieldForm.$pristine=!1},g.removeItem=function(e,n){e.splice(n,1),a.customFieldForm.$pristine=!1},g.removeItems=function(e){for(var n=e.length,t=0;t<n;t++)e.splice(0,1);a.customFieldForm.$pristine=!1},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customFields","customField","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditCustomFieldDialogController",e)}(),function(){"use strict";function e(a,e,t,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.list=c||a.params.list||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=a.params.tab||0,u.gotogoto=function(t,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{ListId:t.id}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{ListId:t.id})}},u.agentadddialog=function(e,n){t.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{list:e,lists:u.lists?u.lists.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoLists=function(){a.go("app.contactmanager.lists",{},{reload:"app.contactmanager.lists"})},u.saveList=function(){r.cmList.update({id:u.list.id},u.list).$promise.then(function(){l.success({title:"List updated!",msg:u.list.name?u.list.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","list","userProfileSection"],angular.module("app.contactmanager").controller("ListController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.cmList.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.list=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ListId=m.list.id,m.query.id=m.list.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.list.id,field:"ListId",route:"cmList"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.contactmanager").controller("ListDispositionsController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.lists=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="lists",f.listOrder="",f.listOrderAsc=null,f.selectedLists=[],f.query={fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){a.go("app.contactmanager.lists.edit",{id:e.id,list:e,crudPermissions:f.crudPermissions})},f.gotocontactsgoto=function(t,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{ListId:t.id}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{ListId:t.id})}},f.exportcsvcontactsexport=function(i,e){return m.cmList.getContactsCsv({id:i.id,nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","exportContacts_"+i.id+".csv"),a.click()}else p.info({title:"EXPORT",msg:"The list is empty"})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.agentadddialog=function(e,n){i.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{list:e,lists:f.lists?f.lists.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("list")+"?").htmlContent("<b>"+(e.name||"list")+"</b> will be deleted.").ariaLabel("delete list").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getLists=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmList.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Lists",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditList=function(e,n){i.show({controller:"CreateOrEditListDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:n,lists:f.lists.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteList=y,f.exportSelectedLists=function(){var e=angular.copy(f.selectedLists);return f.selectedLists=[],e},f.deleteSelectedLists=function(e){var n=i.confirm().title("Are you sure want to delete the selected lists?").htmlContent("<b>"+f.selectedLists.length+" selected</b> will be deleted.").ariaLabel("delete Lists").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedLists.forEach(function(e){y(e)}),f.selectedLists=[]})},f.deselectLists=function(){f.selectedLists=[]},f.selectAllLists=function(){f.selectedLists=f.lists.rows};var b=!0,A=1;function E(e){f.lists=e||{count:0,rows:[]}}function y(e){m.cmList.delete({id:e.id}).$promise.then(function(){_.remove(f.lists.rows,{id:e.id}),f.lists.count-=1,f.lists.rows.length||f.getLists(),p.success({title:_.startCase("List")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmList"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getLists())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","lists","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("ListsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;function b(){return a.smsAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.smsAccounts=e,a.smsInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].SmsAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.smsAccounts.rows,{id:e.rows[t].SmsAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.smsAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.smsAccounts=n})})}function A(){return a.faxAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.faxAccounts=e,a.faxInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].FaxAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.faxAccounts.rows,{id:e.rows[t].FaxAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.faxAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.faxAccounts=n})})}function E(){return a.openchannelAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.openchannelAccounts=e,a.openchannelInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].OpenchannelAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.openchannelAccounts.rows,{id:e.rows[t].OpenchannelAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.openchannelAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.openchannelAccounts=n})})}function y(){return a.whatsappAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.whatsappAccounts=e,a.whatsappInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].WhatsappAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.whatsappAccounts.rows,{id:e.rows[t].WhatsappAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.whatsappAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.whatsappAccounts=n})})}function S(){return a.chatWebsite.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.chatWebsites=e,a.chatInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].ChatWebsiteId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.abandoned+=e.rows[t].abandoned,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.chatWebsites.rows,{id:e.rows[t].ChatWebsiteId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","abandoned","unmanaged"]));return f.chatWebsites}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.chatWebsites=n})})}function T(){return a.mailAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.mailAccounts=e,a.mailInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].MailAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.mailAccounts.rows,{id:e.rows[t].MailAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.mailAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.mailAccounts=n})})}function I(){for(var e=0;e<f.customDashboard.widgets.length;e+=1)f.customDashboard.widgets[e].voiceQueuesSelected=f.voiceQueuesSelected,f.customDashboard.widgets[e].chatWebsitesSelected=f.chatWebsitesSelected,f.customDashboard.widgets[e].smsAccountsSelected=f.smsAccountsSelected,f.customDashboard.widgets[e].faxAccountsSelected=f.faxAccountsSelected,f.customDashboard.widgets[e].mailAccountsSelected=f.mailAccountsSelected,f.customDashboard.widgets[e].openchannelAccountsSelected=f.openchannelAccountsSelected,f.customDashboard.widgets[e].whatsappAccountsSelected=f.whatsappAccountsSelected}f.currentUser=s.getCurrentUser(),f.userProfile=v,f.userProfileSection=h&&1===h.count?h.rows[0]:null,f.crudPermissions=s.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.customDashboard={},f.voiceQueues=l&&l.count?l:{count:0,rows:[]},f.voiceQueuesSelected=l&&l.count?_.map(l.rows,"id"):[],f.faxAccounts=d&&d.count?d:{count:0,rows:[]},f.faxAccountsSelected=d&&d.count?_.map(d.rows,"id"):[],f.chatWebsites=c&&c.count?c:{count:0,rows:[]},f.chatWebsitesSelected=c&&c.count?_.map(c.rows,"id"):[],f.smsAccounts=m&&m.count?m:{count:0,rows:[]},f.smsAccountsSelected=m&&m.count?_.map(m.rows,"id"):[],f.mailAccounts=u&&u.count?u:{count:0,rows:[]},f.mailAccountsSelected=u&&u.count?_.map(u.rows,"id"):[],f.openchannelAccounts=p&&p.count?p:{count:0,rows:[]},f.openchannelAccountsSelected=p&&p.count?_.map(p.rows,"id"):[],f.whatsappAccounts=g&&g.count?g:{count:0,rows:[]},f.whatsappAccountsSelected=g&&g.count?_.map(g.rows,"id"):[],f.interval=n(function(){},1e3),f.goToEdit=function(){e.go("app.tools.customDashboards.edit",{customDashboard:f.customDashboard,id:f.customDashboard.id,tab:1})},f.setFilter=function(e){o.show({controller:"FilterDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/custom/filter/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{vm_parent:f}}).then(function(e){f=e,I()})},f.updateWidget=I,i.onWithoutApply("voice_queue:save",function(e){var n=_.find(f.voiceQueues.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.onWithoutApply("sms_account:save",function(e){var n=_.find(f.smsAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("smsInteraction:update",b),i.on("smsInteraction:save",b),i.onWithoutApply("fax_account:save",function(e){var n=_.find(f.faxAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("faxInteraction:update",A),i.on("faxInteraction:save",A),i.onWithoutApply("mail_account:save",function(e){var n=_.find(f.mailAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("mailInteraction:update",T),i.on("mailInteraction:save",T),i.onWithoutApply("openchannel_account:save",function(e){var n=_.find(f.openchannelAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("openchannelInteraction:update",E),i.on("openchannelInteraction:save",E),i.onWithoutApply("whatsapp_account:save",function(e){var n=_.find(f.whatsappAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("whatsappInteraction:update",y),i.on("whatsappInteraction:save",y),i.onWithoutApply("chat_website:save",function(e){var n=_.find(f.chatWebsites.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("chatInteraction:update",S),i.on("chatInteraction:save",S),a.dashboard.get({id:e.params.id}).$promise.then(function(e){if(e)return f.customDashboard=e,f.customDashboard.widgets=[],f.customDashboard.preview=!0,f.customDashboard.draggable={enabled:!1},f.customDashboard.resizable={enabled:!1},a.dashboard.getItems({id:f.customDashboard.id}).$promise}).then(function(e){if(e&&e.count&&e.rows)for(var n=0;n<e.rows.length;n+=1)e.rows[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[n].type+"/ms-widget-engine."+e.rows[n].type+".html",e.rows[n].voiceQueues=f.voiceQueues,e.rows[n].voiceQueuesSelected=f.voiceQueuesSelected,e.rows[n].faxAccounts=f.faxAccounts,e.rows[n].faxAccountsSelected=f.faxAccountsSelected,e.rows[n].mailAccounts=f.mailAccounts,e.rows[n].mailAccountsSelected=f.mailAccountsSelected,e.rows[n].smsAccounts=f.smsAccounts,e.rows[n].smsAccountsSelected=f.smsAccountsSelected,e.rows[n].chatWebsites=f.chatWebsites,e.rows[n].chatWebsitesSelected=f.chatWebsitesSelected,e.rows[n].openchannelAccounts=f.openchannelAccounts,e.rows[n].openchannelAccountsSelected=f.openchannelAccountsSelected,e.rows[n].whatsappAccounts=f.whatsappAccounts,e.rows[n].whatsappAccountsSelected=f.whatsappAccountsSelected,f.customDashboard.widgets.push(e.rows[n])}).catch(function(){f.customDashboard=void 0}),t.$on("$destroy",function(){i.removeAllListeners("voice_queue:save"),i.removeAllListeners("sms_account:save"),i.removeAllListeners("fax_account:save"),i.removeAllListeners("mail_account:save"),i.removeAllListeners("openchannel_account:save"),i.removeAllListeners("whatsapp_account:save"),i.removeAllListeners("chat_website:save"),i.removeAllListeners("chatInteraction:save"),i.removeAllListeners("chatInteraction:update"),i.removeAllListeners("smsInteraction:save"),i.removeAllListeners("smsInteraction:update"),i.removeAllListeners("openchannelInteraction:save"),i.removeAllListeners("openchannelInteraction:update"),i.removeAllListeners("mailInteraction:save"),i.removeAllListeners("mailInteraction:update"),i.removeAllListeners("faxInteraction:save"),i.removeAllListeners("faxInteraction:update"),i.removeAllListeners("whatsappInteraction:save"),i.removeAllListeners("whatsappInteraction:update"),f.interval&&n.cancel(f.interval)})}e.$inject=["$state","$interval","$scope","api","socket","Auth","$mdDialog","$document","voiceQueues","faxAccounts","chatWebsites","smsAccounts","mailAccounts","openchannelAccounts","whatsappAccounts","userProfile","userProfileSection"],angular.module("app.dashboards.custom").controller("DashboardCustomController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){a.hide(c.parent)}c.title="DASHBOARDS.SETFILTERS",c.currentUser=l.getCurrentUser(),c.parent=d,c.onChangeFilter=function(e){for(var n=0;n<c.parent.customDashboard.widgets.length;n+=1)switch(e){case"voice":c.parent.customDashboard.widgets[n].voiceQueuesSelected=c.parent.voiceQueuesSelected;break;case"sms":c.parent.customDashboard.widgets[n].smsAccountsSelected=c.parent.smsAccountsSelected;break;case"chat":c.parent.customDashboard.widgets[n].chatAccountsSelected=c.parent.chatAccountsSelected;break;case"fax":c.parent.customDashboard.widgets[n].faxAccountsSelected=c.parent.faxAccountsSelected;break;case"mail":c.parent.customDashboard.widgets[n].mailAccountsSelected=c.parent.mailAccountsSelected;break;case"openchannel":c.parent.customDashboard.widgets[n].openchannelAccountsSelected=c.parent.openchannelAccountsSelected;break;case"whatsapp":c.parent.customDashboard.widgets[n].whatsappAccountsSelected=c.parent.whatsappAccountsSelected}},c.confirm=function(){m()},c.closeDialog=m}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","api","Auth","vm_parent"],angular.module("app.tools").controller("FilterDialogController",e)}(),function(){"use strict";function e(e,s,i,c,o,r,m,n,l,t,u,a,d,p,g,v,h,f,b,A,E){var y=this;y.license=v,y.setting=h,y.detectBrowser=b.detectBrowser(),y.user=n.getCurrentUser(),y.currentTab=0,y.notifications={},y.tabs={},y.agentCapacity={},y.autoClose=!1,y.acceptedNotifications=[],y.autoanswerTimeout,y.globalUserLists=a||{count:0,rows:[]},y.globalLists=d||{count:0,rows:[]},y.globalCompanies=p||{count:0,rows:[]},y.globalTags=g||{count:0,rows:[]};var S=E.getLogger("dashboard","agent.general.contact");function T(e){var n={};for(var t in y.tabs)y.tabs.hasOwnProperty(t)&&(n[t]=_.pick(y.tabs[t],["type","title","channel","icon","color","autoCreate","id","saved","badges","openedAt"]),_.isNil(y.tabs[t].contact)||(n[t].contact=_.pick(y.tabs[t].contact,["id","ListId"])),_.isNil(y.tabs[t].calls)||(n[t].calls=y.tabs[t].calls),y.tabs[t].interaction&&(n[t].interaction=_.pick(y.tabs[t].interaction,["id","OpenchannelAccountId","MailAccountId","ChatWebsiteId","FaxAccountId","SmsAccountId","WhatsappAccountId","closed","draft"])));var a=JSON.parse(i.localStorage.getItem("motion2.user:"+y.user.id));a?(a.tabs=n,a.currentTab=y.currentTab,a.autoClose=y.autoClose):a={tabs:n,currentTab:y.currentTab,autoClose:y.autoClose},i.localStorage.setItem("motion2.user:"+y.user.id,JSON.stringify(a)),e&&I(e)}function I(e){if(_.isNil(e)||e&&"interaction"===e.type){var n={id:y.user.id,online:!0,capacity:{mail:0,fax:0,sms:0,whatsapp:0,openchannel:0,chat:0},interaction:{mail:[],fax:[],sms:[],whatsapp:[],openchannel:[],chat:[]}};for(var t in y.tabs)y.tabs.hasOwnProperty(t)&&n.capacity.hasOwnProperty(y.tabs[t].channel)&&y.tabs[t].interaction&&!y.tabs[t].interaction.closed&&(n.capacity[y.tabs[t].channel]+=1,n.interaction[y.tabs[t].channel].push(y.tabs[t].interaction.id));if(!_.isEqual(y.agentCapacity,n.capacity))return y.agentCapacity=n.capacity,l.rpc.setAgentCapacity(n)}}function O(e){y.tabs[e.id]&&(!function(e){if(e.channel&&e.interaction)l.user["remove"+_.upperFirst(e.channel)+"Interactions"]({id:y.user.id,ids:[e.interaction.id]}).$promise.catch(function(e){S.error(e)})}(y.tabs[e.id]),delete y.tabs[e.id],y.currentTab=0,T(e))}function C(e){Object.keys(y.tabs).length!==y.setting.limitTabs?(e.id=_.random(1e10),e.openedAt=(new Date).toISOString(),e.saved=!1,e.badges=0,y.tabs[e.id]=e,y.currentTab=e.id,T(e)):u.warning({title:"",msg:c.instant("DASHBOARD.LIMIT_TABS_REACHED")})}function w(n){return _.find(y.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id==n.interactionId&&e.channel==n.channel})}function R(n,t){var e,a,i={type:"contact",title:n?(e=n,a="",e&&(e.firstName||e.lastName?(e.firstName&&(a+=e.firstName+" "),e.lastName&&(a+=e.lastName)):e.phone&&(a=e.phone)),a=y.user.privacyEnabled?A.mask(a):a):c.instant("DASHBOARDS.NEW_CONTACT"),icon:"icon-account-circle",color:"red",contact:n,calls:t?[t]:[],autoCreate:t?t.autoCreate:0};if(t&&(t.answertime||(t.answertime=t.agentconnectAt),(t.agentcompleteAt||t.endtime)&&U(t)),n){var s=_.find(y.tabs,function(e){return e.contact&&e.contact.id?"contact"===e.type&&e.contact&&e.contact.id==n.id:"contact"===e.type&&e.contact&&e.contact.phone==n.phone});if(s){if(t)return l.voiceCallReport.get({uniqueid:t.uniqueid}).$promise.then(function(e){(e&&0<e.rows.length&&(t.disposedAt=_.first(e.rows).endtime),s.calls)?_.find(s.calls,function(e){return e.uniqueid===t.uniqueid})||s.calls.push(t):s.calls=[t];y.currentTab=s.id})}else{if(n.ListId)return l.disposition.get({ListId:n.ListId,nolimit:!0}).$promise.then(function(e){return i.dispositions=e,l.cmList.getCustomFields({id:n.ListId,nolimit:!0}).$promise}).then(function(e){i.customFields=e}).catch(F()).finally(function(){C(i)});C(i)}}else C(i)}function x(n,t){var e=_.find(y.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id===t.id&&e.channel===n});e?(e.isDraft=t.isDraft||!1,y.currentTab=e.id):C(e={type:"interaction",title:n?n.toUpperCase():"openchannel",icon:function(e){switch(e){case"chat":return"icon-hangouts";case"mail":return"icon-email";case"sms":return"icon-message-text";case"openchannel":return"icon-google-earth";case"fax":return"icon-deskphone";case"whatsapp":return"icon-whatsapp";default:return"icon-hangouts"}}(n),color:function(e){switch(e){case"chat":return"green-A700";case"mail":return"teal";case"sms":return"orange";case"openchannel":return"amber-A200";case"fax":return"blue-grey-A200";case"whatsapp":return"lime-A700";default:return"grey"}}(n),channel:n,interaction:t,isDraft:t.isDraft||!1})}function N(e){var n=0;switch(e){case"chat":n=105;break;case"mail":n=106;break;case"sms":n=107;break;case"openchannel":n=108;break;case"fax":n=109;break;case"whatsapp":n=114}return 0<n&&_.includes(y.user.permissions,n)}function D(t){f.isSupported()?f.requestPermission().then(function(){var e,n;n={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"../../../../../../../assets/images/avatars/customer.png",body:(e=t).queue?"Queue: "+e.queue:"",focusOnclick:!0,closeOnClick:!0},f.show(e.title,n)},function(e){S.error("Please enable browser notifications!",e)}):S.error("Browser notifications are not supported by the browser. Normal notifications will be used.")}function P(n){u.wait({title:n.title,msg:n.msg||"",showClose:!1,clickToClose:!1,timeout:!1,sound:n.sound,html:!0,shake:n.shake||!1,onAdd:function(){y.notifications[n.uniqueid]=this.id},onAccept:function(){if(L(n),l[n.channel+"Message"])return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),y.autoanswerTimeout=null,x(e.channel,e.interaction),u.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(F())},onReject:function(){if(L(n),_.isNil(y.autoanswerTimeout)||(r.cancel(y.autoanswerTimeout),y.autoanswerTimeout=null),l[n.channel+"Message"])return l[n.channel+"Message"].reject({id:n.id,UserId:y.user.id}).$promise.then(function(){u.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(F())}})}function L(e){e&&e.uniqueid&&y.notifications[e.uniqueid]&&(u.clear(y.notifications[e.uniqueid]),delete y.notifications[e.uniqueid])}function k(n){var t=n.uniqueid;for(var e in S.debug("onVoiceChannelRemove -> evt",n),y.tabs)if(y.tabs.hasOwnProperty(e)){var a=y.tabs[e];if(a.calls){S.debug("onVoiceChannelRemove ->  key, tab, tab.calls",e,a,a.calls);var i=_.findIndex(a.calls,function(e){return e.uniqueid===t});i<0&&0<=(i=_.findIndex(a.calls,function(e){return e.uniqueid===n.linkedid}))&&(t=n.linkedid),0<=i&&!a.calls[i].disposedAt?(S.debug("Allowing disposition for call %s",a.calls[i].uniqueid),U(a.calls[i])):S.debug("Call %s not found or already completed",a.calls[i].uniqueid),a.contact&&a.contact.id&&r(M(t,a.contact.id,a),1e3)}}T()}function M(n,e,t){return function(){if(_.find(t.calls,function(e){return e.uniqueid===n}))return l.voiceCallReport.update({id:n,ContactId:e}).$promise.catch(function(e){S.error(e)})}}function U(e){e.disposedAt=new Date}function F(){return function(e){if(404===e.status)u.warning({title:c.instant("DASHBOARDS.ATTENTION"),msg:c.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){y.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)u.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else u.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}function $(e){l.cmHopper.update({id:e,recallmeNotifiedDate:null}).$promise.then(function(e){S.debug(e)}).catch(function(e){S.error(e)}).finally(function(){q(e)})}function q(e){y.toasty.clear(y.notifications[e])}y.onClickTab=function(e){y.currentTab=e,T(y.tabs[e])},y.isActiveTab=function(e){return e===y.currentTab},y.alreadyExistsTab=w,y.addContactTab=R,y.addInteractionTab=x,y.addTab=C,y.removeTab=O,y.updateLocalStorage=T,y.closeTab=function(e){var n=!1,t=s.confirm().title("interaction"===e.type?"Do you want to close the interaction?":"Are you sure want to close the "+e.type+"?").textContent("interaction"===e.type?"":"The "+e.type+" has been modified. Closing will lose all changes!").ariaLabel("Close Contact").ok("interaction"===e.type?"YES":"OK").cancel("interaction"===e.type?"NO":"CANCEL");{if(!e.saved){var a=y.user.voicePause||y.user.chatPause||y.user.mailPause||y.user.openchannelPause||y.user.faxPause;return"interaction"===e.type&&(n=e.interaction.Account.mandatoryDisposition),s.show(t).then(function(){"interaction"===e.type&&s.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(o.body),onRemoving:function(){y.user&&n&&!a&&l.user.unpause({id:y.user.id}).$promise.catch(function(e){S.error(e)})},clickOutsideToClose:!n,escapeToClose:!n,locals:{user:y.user,channel:e.channel,interaction:e.interaction}}),O(e)}).catch(function(){"interaction"===e.type&&O(e)})}if(_.forEach(e.calls,function(e){e.mandatoryDisposition&&(n=!0)}),"contact"===e.type&&0<e.calls.length){if(!n)return t._options.textContent="There is a call that hasn't been disposed yet.",s.show(t).then(function(){O(e)});var i=s.alert().title("Warning").textContent("There is a call that hasn't been disposed yet.").ok("OK");s.show(i).finally(function(){i=void 0})}else O(e)}},y.dialPreviewRecallReminder=function(e){var n,t,a,i,s;if(e&&e.hopper){if(i=m("formatdate")(e.hopper.scheduledat),s=e.hopper,e.hopper.Contact&&(n=e.hopper.Contact),e.hopper.List&&(t=e.hopper.List),e.hopper.id&&(a=e.hopper.id),a&&n&&t&&n.firstName){var o=n.firstName;n.lastName&&(o=o+" "+n.lastName);var r=s.phone||n.phone;y.user.privacyEnabled&&(o=A.mask(o),r=A.mask(r));var l=c.instant("DASHBOARDS.RECALLME_CALL_REMINDER"),d="<div>          <span>"+c.instant("DASHBOARDS.UPCOMING_RECALLME_CALL")+"</span><br>          <span>"+c.instant("DASHBOARDS.CONTACT_NAME")+": "+o+"</span><br>          <span>"+c.instant("DASHBOARDS.CONTACT_PHONE")+": "+r+"</span><br>          <span>"+c.instant("DASHBOARDS.SCHEDULED_TIME")+": "+i+"</span><br>          <span>"+c.instant("DASHBOARDS.LIST_NAME")+": "+t.name+"</span><br>          </div>";S.debug(e),u.info({title:l,msg:d,showClose:!0,clickToClose:!0,timeout:6e4,html:!0,onAdd:function(){y.notifications[a]=this.id},onAccept:function(){delete y.notifications[a],y.openContactTab(a)},onReject:function(){delete y.notifications[a],$(a)},onRemove:function(){setTimeout(function(){y.notifications[a]&&(delete y.notifications[a],$(a))},1e3)}})}}else S.warn("Response does not contain hopper",e)},y.openContactTab=function(e){y.openPreviewDialog(e),q(e)},y.openPreviewDialog=function(e){l.cmHopper.getPreviewRecall({id:e}).$promise.then(function(e){var n=angular.element("#toolbar").scope();n&&n.vm.openPreviewDialog(e,!0)})},y.toasty=u,function(){var e=i.localStorage.getItem("motion2.user:"+y.user.id);if(e)try{e=JSON.parse(e),y.tabs=e.tabs?e.tabs:{},y.currentTab=e.currentTab?e.currentTab:0,y.autoClose=!!e.autoClose&&e.autoClose,I(y.tabs[y.currentTab]),S.debug("Tabs initiated correctly")}catch(e){S.error(e)}}(),e.$on("$destroy",function(){for(var e in y.notifications)y.notifications.hasOwnProperty(e)&&L({uniqueid:e});t.removeAllListeners("trigger:contactmanager"),t.removeAllListeners("trigger:jscripty"),t.removeAllListeners("trigger:browser:url"),t.removeAllListeners("trigger:browser:popup"),t.removeAllListeners("notification:save"),t.removeAllListeners("notification:remove"),t.removeAllListeners("voice_queue_channel:remove"),t.removeAllListeners("voice_outbound_channel:remove")}),t.on("trigger:contactmanager",function(n){_.isNil(n.contacts)||1!==n.contacts.length?s.show({controller:"ContactSelectionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/selection/dialog.html",parent:angular.element(o.body),locals:{contacts:n.contacts,callNumber:n.evt.routeId?n.evt.destcalleridnum:n.evt.calleridnum}}).then(function(e){R(e,n.evt)}):R(n.contact,n.evt)}),t.on("trigger:jscripty",function(t){return l.jscriptyProject.get({id:t.ProjectId}).$promise.then(function(n){if(n){if(!_.isUndefined(t["xmd-contactid"]))return l.cmContact.get({id:t["xmd-contactid"]}).$promise.then(function(e){try{n.formData=Mustache.render(n.formData,_.merge(t,{user:y.user,contact:e}))}catch(e){S.error(e)}C({type:"jscripty",title:n.name,icon:"icon-script",color:"grey",project:n,call:t,contact:e})}).catch(F());try{n.formData=Mustache.render(n.formData,_.merge(t,{user:y.user}))}catch(e){S.error(e)}C({type:"jscripty",title:n.name,icon:"icon-script",color:"grey",project:n,call:t})}}).catch(F())}),t.on("trigger:bot",function(n){var t=n.calleridname&&"<unknown>"!==n.calleridname?n.calleridname:n.calleridnum,a=n.calleridnum;return l.squareMessage.get({fields:"id",limit:1,offset:0,uniqueid:n.uniqueid}).$promise.then(function(e){e.count&&C({type:"bot",title:t+" <"+a+">",icon:"fas fa-robot",color:"pink",data:{uniqueid:n.uniqueid}})})}),t.on("trigger:browser:url",function(e){if(e&&e.uri)if(e.uri=_.replace(e.uri,"&lt%3B",""),e.uri=_.replace(e.uri,"=&gt%3B=",""),e.uriLocation)switch(e.uriLocation){case"0":i.open(e.uri);break;case"1":i.open(e.uri,"_blank","width="+(e.windowWidth||"800")+",height="+e.windowHeight||"600");break;case"2":C({type:"iframe",title:e.uri,icon:"icon-google-earth",color:"blue",src:e.uri});break;default:i.open(e.uri)}else i.open(e.uri)}),t.on("trigger:browser:popup",function(e){e&&e.html&&C({type:"popup",title:e.calleridnum||"popup",icon:"icon-tablet",color:"grey",html:e.html})}),t.on("notification:save",function(n){if(N(n.channel)&&n&&n.uniqueid){D(n);var e=w(n);if(e){if(l[n.channel+"Message"])return y.currentTab!==e.id&&(e.badges+=1),y.acceptedNotifications.push(n.id),l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id}).$promise.catch(F())}else{var t="mail"==n.channel?"email":n.channel,a=y.user[t+"AutoanswerDelay"]?1e3*y.user[t+"AutoanswerDelay"]:0;if(y.user[t+"Autoanswer"]&&y.license[n.channel]&&N(n.channel)){if(0<a)P(n),y.autoanswerTimeout=r(function(){if(l[n.channel+"Message"]&&!_.includes(y.acceptedNotifications,n.id))return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),x(e.channel,e.interaction),L(n)}).catch(F())},y.user[t+"AutoanswerDelay"]?1e3*y.user[t+"AutoanswerDelay"]:0);else if(l[n.channel+"Message"])return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),x(e.channel,e.interaction)}).catch(F())}else P(n)}}}),t.on("notification:remove",L),t.on("voice_queue_channel:remove",k),t.on("voice_outbound_channel:remove",k),t.on("user:dialPreviewRecallReminder",y.dialPreviewRecallReminder)}e.$inject=["$scope","$mdDialog","$window","$translate","$document","$timeout","$filter","Auth","api","socket","toasty","globalUserLists","globalLists","globalCompanies","globalTags","license","setting","desktopNotification","msUtils","privacyManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentDashboardGeneralController",e)}(),function(){"use strict";angular.module("app.dashboards").provider("desktopNotification",function(){var f={autoClose:!0,duration:5,showOnPageHidden:!1};return{config:function(e){for(var n in e)f.hasOwnProperty(n)&&null!=e[n]&&(f[n]=e[n])},$get:["$q","$timeout","$window","PERMISSIONS",function(e,u,n,p){var g=n.Notification||n.mozNotification||n.webkitNotification;return{isSupported:v,currentPermission:h,requestPermission:function(){if(!v())return e.reject("Notification API not supported");var t=e.defer();Promise.resolve(g.requestPermission)==g.requestPermission?g.requestPermission().then(function(e){p.GRANTED===e?t.resolve(e):t.reject(e)}):g.requestPermission(function(e,n){p.GRANTED===e?t.resolve(e):t.reject(e)});return t.promise},show:function(e,n){if(n=n||{},!v()||(t=e,a=n,i=angular.isString(t),s=!a.onClick||angular.isFunction(a.onClick),!i||!s)||function(e){if(e||f.showOnPageHidden)return!(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)}(n.showOnPageHidden)||h()!==p.GRANTED)return;var t,a,i,s;var o=new g(e,n),r=n.duration||f.duration,l=void 0===n.autoClose?f.autoClose:n.autoClose;o.onclick=function(){n.onClick&&n.onClick(),n.focusOnclick&&window.focus(),n.closeOnClick&&o.close()},l&&(d=o,c=r,m=1e3*c,u(d.close.bind(d),m,!1));var d,c,m;return o},permissions:{default:p.DEFAULT,granted:p.GRANTED,denied:p.DENIED}};function v(){return!(void 0===g)}function h(){return(g||{}).permission}}]}}).provider("msNavigationAgentService",function(){var r=angular.injector(["ng"]).get("$log"),l=[];function n(e,n){if(angular.isString(e)){for(var t=e.split("."),a=t[t.length-1],i=function(e){var n=l;if(1===e.length)return n;e.pop();for(var t=0;t<e.length;t++){for(var a=e[t],i=!0,s=0;s<n.length;s++)if(n[s]._id===a){n=n[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};n.push(o),n=o.children}}return n}(t),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,n),s.uisref=d(s)):(n.children=[],!angular.isUndefined(n.weight)&&angular.isNumber(n.weight)||(n.weight=1),n._id=a,n._path=e,n.uisref=d(n),i.push(n))}else r.error("path must be a string (eg. `dashboard.project`)")}function d(e){var n="";return angular.isDefined(e.state)&&(n=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(n=n+"("+angular.toJson(e.stateParams)+")")),n}this.saveItem=n,this.deleteItem=function(e){if(!angular.isString(e))return void r.error("path must be a string (eg. `dashboard.project`)");for(var n=l,t=e.split("."),a=0;a<t.length;a++)for(var i=t[a],s=0;s<n.length;s++)if(n[s]._id===i){if(n[s]._path===e)return n.splice(s,1),!0;n=n[s].children;break}return!1},this.$get=function(){var e={saveItem:n,getNavigation:function(e){if(e){for(var n=0;n<l.length;n++)if(l[n]._id===e)return[l[n]];return null}return l}};return e}}).constant("PERMISSIONS",{DEFAULT:"default",GRANTED:"granted",DENIED:"denied"})}(),function(){"use strict";function e(t){var a=this;a.setting={},a.messages={count:0,rows:[]},a.showInteraction=!1,a.init=function(e,n){{if(a.setting=n,a.tab=e,a.tab.saved=!0,a.tab&&a.tab.data&&a.tab.data.uniqueid)return t.squareMessage.get({uniqueid:a.tab.data.uniqueid}).$promise.then(function(e){a.messages=e}).finally(function(){a.showInteraction=!0});a.showInteraction=!0}},a.getMessagesAlignment=function(e){switch(a.setting.messagesAlignment){case"left":return"in"==e.direction?e.direction:"out-left-aligned";case"right":return"in"==e.direction?"in-right-aligned":e.direction;default:return e.direction}}}e.$inject=["api"],angular.module("app.dashboards").controller("AgentGeneralBotController",e)}(),function(){"use strict";function e(a,d,c,t,m,i,u,p,s,o,e,r,l,n){var g=this;g.user=s.getCurrentUser(),g.detectBrowser=e.detectBrowser(),g.additionalItemTypes=[],g.additionalItems=[],g.contactItemTypes=[],g.newPhone=function(e){return{phone:e,color:"gray"}},g.journey=[],g.queryHopper={fields:"id,phone,scheduledat",sort:"-updatedAt",limit:10,page:1},g.queryFinal={fields:"uniqueid,calleridnum,statedesc,starttime,disposition,secondDisposition,thirdDisposition",sort:"-updatedAt",limit:10,page:1},g.queryHistory={fields:"uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,page:1},g.hoppers={rows:[],count:0},g.finals={rows:[],count:0},g.histories={rows:[],count:0},g.journeyOptions=r.getQuery(),g.quickFilters=r.getQuickFilters(),g.addNewContact=f,g.saveContact=function(){g.errors=[],u.cmContact.update({id:g.contact.id},g.contact).$promise.then(function(e){var n=h(e);return g.tab.title=g.user.privacyEnabled?l.mask(n):n,g.tab.contact=g.contact,m.$parent.vm.updateLocalStorage(),u.user.addContacts({id:s.getCurrentUser().id,ids:[e.id]})}).then(function(){return u.cmContact.setTags({id:g.contact.id,ids:g.tab.Tags}).$promise}).then(function(){return u.cmContact.setAdditionalPhones({id:g.contact.id,items:g.additionalItems,item_types:g.additionalItemTypes}).$promise.then(function(){g.detailForm.$pristine=!0,g.customFieldsForm.$pristine=!0,p.success({title:"Contact properly updated!",msg:g.contact.name?g.contact.name+" has been updated!":""})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.getCustomFields=function(e){return u.cmList.getCustomFields({id:e}).$promise.then(function(e){g.tab.customFields=e}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"LIST:GETCustomFields",msg:e.data?JSON.stringify(e.data):e.toString()})})},g.call=m.$parent.vm.call,g.disposeCall=function(e,i){if(g.newContact)return void p.error({title:"ATTENTION",msg:"Please save the contact before disposing!"});d.show({controller:"DisposeCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",parent:angular.element(c.body),targetEvent:i,clickOutsideToClose:!i.mandatoryDisposition,escapeToClose:!i.mandatoryDisposition,resolve:{globalDispositions:["apiResolver",function(e){return e.resolve("disposition@get",{MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}]},onRemoving:function(){g.user&&i.mandatoryDisposition&&u.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{dispositions:g.tab.dispositions,contact:g.contact,call:i,availableCalls:g.tab.calls.length,autoClose:m.$parent.vm.autoClose}}).then(function(e){var n=e[0];for(var t in m.$parent.vm.autoClose=e[1],n&&("BLACKLIST"===n?p.success({title:o.instant("DASHBOARDS.INFO"),msg:o.instant("DASHBOARDS.CALL_DISPOSED")+" "+n}):"RECALLME"===n||"RESCHEDULE"===n||p.success({title:o.instant("DASHBOARDS.INFO"),msg:o.instant("DASHBOARDS.CALL_SAVED")})),m.$parent.$parent.$parent.vm.tabs)if(m.$parent.$parent.$parent.vm.tabs.hasOwnProperty(t)){var a=m.$parent.$parent.$parent.vm.tabs[t];_.remove(a.calls,function(e){return e.uniqueid===i.uniqueid})}0===g.tab.calls.length&&m.$parent.vm.autoClose&&m.$parent.vm.removeTab(g.tab),m.$parent.vm.updateLocalStorage()})},g.checkCallStatus=function(n){return g.checkingCallStatus=!0,u.voiceCallReport.get({uniqueid:n.uniqueid}).$promise.then(function(e){e&&0<e.rows.length&&(n.disposedAt=_.first(e.rows).endtime)}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"VOICE_CALL_REPORT:GET",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){g.checkingCallStatus=!1})},g.duplicateContact=function(e){d.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(c.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:g.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:s.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}})},g.mergeContact=function(e){d.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(c.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:g.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:s.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}}).then(function(e){if(e){for(var n in m.$parent.$parent.$parent.vm.tabs)if(m.$parent.$parent.$parent.vm.tabs.hasOwnProperty(n)){var t=m.$parent.$parent.$parent.vm.tabs[n];t&&t.contact&&(e.from&&e.from.id&&e.from.id===t.contact.id&&m.$parent.$parent.$parent.vm.removeTab(t),e.to&&e.to.id&&e.to.id===t.contact.id&&m.$parent.$parent.$parent.vm.removeTab(t))}e.new&&m.$parent.$parent.$parent.vm.addContactTab(e.new)}})},g.getDateFromString=S,g.addJscriptyTab=function(e){try{e.formData=Mustache.render(e.formData,{contact:g.contact,user:g.user})}catch(e){v.error(e)}try{m.$parent.$parent.$parent.vm.addTab({type:"jscripty",title:e.name,icon:"icon-script",color:"grey",project:e,contact:g.contact})}catch(e){p.error({title:"ERROR OPENING JSCRIPTY PROJECT",msg:"The project cannot be started"+JSON.stringify(e)})}},g.getHoppers=A,g.getFinals=E,g.getHistories=y,g.getJscriptyProjects=function(){if(g.jscriptyProjects)return;return g.loadingJscriptyProjects=!0,u.jscriptyProject.get({fields:"createdAt,updatedAt,id,name,description,createdAt,formData,enableUncompleteSave",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.jscriptyProjects=e||{count:0,rows:[]}}).catch(function(){p.error({title:o.instant("JSCRIPTY.JSCRIPTY"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.JSCRIPTY_GET_ERROR")})}).finally(function(){g.loadingJscriptyProjects=!1})},g.getAccounts=function(n){if(g[n+"Accounts"])return;var e="get"+_.startCase(n)+"Accounts";return g.loadingAccounts=!0,u.user[e]({id:g.user.id,attributes:["id","name"],nolimit:!0}).$promise.then(function(e){g[n+"Accounts"]=e||{count:0,rows:[]}}).catch(function(){p.error({title:o.instant(n.toUpperCase()+"."+n.toUpperCase()+"ACCOUNTS"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.ACCOUNTS_GET_ERROR",{channel:o.instant("DASHBOARDS."+n.toUpperCase())})})}).finally(function(){g.loadingAccounts=!1})},g.composeInteraction=function(e,o,r,n){var l=o.toLowerCase();d.show({controller:"Compose"+o+"InteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/"+o.toLowerCase()+"/dialog.html",parent:angular.element(c.body),clickOutsideToClose:!1,locals:{account:r,message:{to:"mail"==l?n:n.split(",")},type:"new",interaction:{Contact:g.contact}},fullscreen:!0}).then(function(s){if(!s||_.isNil(s.message)||!s.message.savedAsDraft)return u[l+"Account"].send({id:r.id},s).$promise.then(function(e){if("Mail"===o){var n=e;if(n&&n.Messages&&n.Messages.length){if(s.attachments&&s.attachments.length)for(var t=0;t<s.attachments.length;t+=1)u.attachment.update({id:s.attachments[t].id},{MailMessageId:_.head(n.Messages).id});if(p.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.closed){n.disposition=null;var a=!r.mandatoryDisposition,i=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause;d.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(c.body),onRemoving:function(){g.user&&r.mandatoryDisposition&&!i&&u.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},clickOutsideToClose:a,escapeToClose:a,locals:{user:g.user,channel:"mail",interaction:n}})}else m.$parent.vm.addInteractionTab("mail",n)}}else p.success({title:"Message properly sent!",msg:"Message has been sent!"}),m.$parent.vm.addInteractionTab(l,e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"fax"===l?p.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:o.toUpperCase()+"ACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});var e={type:"draft",channel:"mail",account:r,contact:g.contact,id:g.tab.id,openedAt:new Date,saved:!1,title:r.key+" - Untitled",content:s.message},n=a.localStorage.getItem("motion2.home.mail:"+g.user.id);if(n){var t=JSON.parse(n);t.drafts||(t.drafts={}),n=t}else n={drafts:{}};n.drafts[g.tab.id]=e,a.localStorage.setItem("motion2.home.mail:"+g.user.id,JSON.stringify(n))})},g.init=function(n,e){return g.tab=n,m.$watchGroup(["vm.detailForm.$pristine","vm.customFieldsForm.$pristine"],function(e){g.tab.saved=e[0]&&e[1]}),g.license=e,g.contact=g.tab.contact,g.newContact=!1,g.currentTab=0,u.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){g.users=e||{count:0,rows:[]},g.usersMap=_.mapValues(_.keyBy(g.users.rows,"id"),"fullname")}).then(function(){for(var e=[],n=0;n<g.tab.calls.length;n++){var t=g.tab.calls[n];e.push(u.voiceCallReport.get({uniqueid:t.uniqueid}).$promise.then(function(e){e&&0<e.rows.length&&(t.disposedAt=_.first(e.rows).endtime)}))}return i.all(e)}).then(function(){return u.user.getLists({id:g.user.id,nolimit:!0}).$promise}).then(function(e){if(g.lists=e||{count:0,rows:[]},g.contact&&g.contact.ListId){if(g.list=_.find(g.lists.rows,{id:g.contact.ListId}),g.list)return;return u.cmList.get({id:g.contact.ListId}).$promise.then(function(e){e&&(g.list=e,g.lists.rows=_.unionBy(g.lists.rows,[g.list]))})}}).then(function(){if(g.contact&&g.contact.id){var e={id:g.contact.id,ListId:g.contact.ListId,limit:1,offset:0,sort:"-updatedAt"};return u.cmContact.get(e).$promise.then(function(e){return g.contact=e,g.tab.contact=e,u.user.addContacts({id:g.user.id,ids:[g.contact.id]})}).then(function(){if(g.contact.ListId)return u.disposition.get({ListId:g.contact.ListId,nolimit:!0}).$promise.then(function(e){return g.tab.dispositions=e,u.cmList.getCustomFields({id:g.contact.ListId,nolimit:!0}).$promise}).then(function(e){g.tab.customFields=e})}).then(function(){try{g.tab.companies=m.$parent.$parent.$parent.vm.globalCompanies,g.tab.tags=m.$parent.$parent.$parent.vm.globalTags,g.tab.autoCreate=0}catch(e){}u.contactItemType.get({}).$promise.then(function(e){g.contactItemTypes=e.rows}).then(function(){u.cmContact.getAdditionalPhones({id:g.contact.id}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");g.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");g.additionalItems=[];for(var s=0;s<n.length;s++)g.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})}).catch(function(e){console.log(e)})}),A(),E(),y()}).then(function(){return u.cmContact.getTags({id:g.contact.id}).$promise.then(function(e){g.tab.Tags=_.map(e.rows,"id")})})}return g.newContact=!0,n.autoCreate?f():void 0}).finally(function(){g.contact&&g.contact.id&&(T(),g.contact.dateOfBirth=S(g.contact.dateOfBirth))})},g.hasPermission=function(e){return s.hasPermission(e)},g.openInteraction=function(e){try{return m.$parent.$parent.$parent.vm.addInteractionTab(e.channel,e)}catch(e){p.error({title:o.instant("CONTACTMANAGER.CUSTOMER_JOURNEY"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.INTERACTION_OPEN_ERROR")})}},g.getCustomerJourney=T,g.loadMoreJourney=function(){return i(function(e){var n=g.journey.length;return e(T(n))})};var v=n.getLogger("agent.general.contact");function h(e){return e.firstName||e.lastName?(e.firstName+" "+e.lastName).trim():e.phone}function f(){g.errors=[],u.cmContact.save(g.contact).$promise.then(function(e){g.contact.id=e.id,g.newContact=!1;var n=h(e);return g.tab.title=g.user.privacyEnabled?l.mask(n):n,g.tab.contact=g.contact,u.user.addContacts({id:s.getCurrentUser().id,ids:[e.id]})}).then(function(){g.detailForm.$pristine=!0,g.customFieldsForm.$pristine=!0,p.success({title:"Contact properly created",msg:g.contact.firstName?g.contact.firstName+" has been created!":""})}).then(function(){return u.cmContact.setTags({id:g.contact.id,ids:g.tab.Tags}).$promise}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function b(n){return function(e){g[n]=e||{count:0,rows:[]}}}function A(){g.contact&&g.contact.id&&(g.queryHopper.ContactId=g.contact.id,g.queryHopper.offset=(g.queryHopper.page-1)*g.queryHopper.limit,g.promise=u.cmHopper.get(g.queryHopper,b("hoppers")).$promise)}function E(){g.contact&&g.contact.id&&(g.queryFinal.ContactId=g.contact.id,g.queryFinal.offset=(g.queryFinal.page-1)*g.queryFinal.limit,g.promise=u.cmHopperFinal.get(g.queryFinal,b("finals")).$promise)}function y(){g.contact&&g.contact.id&&(g.queryHistory.ContactId=g.contact.id,g.queryHistory.offset=(g.queryHistory.page-1)*g.queryHistory.limit,g.promise=u.cmHopperHistory.get(g.queryHistory,b("histories")).$promise)}function S(e){return null===e?void 0:new Date(e)}function T(e){g.journeyIsLoading=!0;var n=_.merge(g.journeyOptions,{id:g.contact.id,offset:e||0});return r.get(g.journey,n).then(function(e){g.journey=e.journey,g.canLoadMoreJourney=e.loadMore}).finally(function(){g.journeyIsLoading=!1})}m.$on("$destroy",function(){}),m.$watch("currentTab",function(){1===g.currentTab&&(A(),E(),y())});var I=!0,O=1;m.$watch("queryHopper.filter",function(e,n){I?t(function(){I=!1}):(n||(O=g.queryHopper.page),e!==n&&(g.queryHopper.page=1),e||(g.queryHopper.page=O),A())}),m.$watch("queryFinal.filter",function(e,n){I?t(function(){I=!1}):(n||(O=g.queryFinal.page),e!==n&&(g.queryFinal.page=1),e||(g.queryFinal.page=O),E())}),m.$watch("queryHistory.filter",function(e,n){I?t(function(){I=!1}):(n||(O=g.queryHistory.page),e!==n&&(g.queryHistory.page=1),e||(g.queryHistory.page=O),y())})}e.$inject=["$window","$mdDialog","$document","$timeout","$scope","$q","api","toasty","Auth","$translate","msUtils","customerJourneyManager","privacyManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentGeneralContactController",e)}(),function(){"use strict";function e(n,t,i,s,o,e,a,r,l,d,c,m,u,p,g){var v=this;v.user=d.getCurrentUser(),v.isReschedule=!1,v.recallme=!1,v.queueCampaign=void 0,v.queueCampaigns={count:0,rows:[]},v.dispositions=_.orderBy(_.concat([],e.rows,a.rows),["name"],["asc"]),v.contact=l,v.call=r,v.note=v.call.note||void 0,v.dialerCall=!1,v.hasBlackLists=!1,v.contactTZTime,v.availableCalls=m,v.autoClose=u,v.recalcTZTime=b,v.hopper={minDate:new Date,dateTime:new Date,scheduledAt:new Date},p.$watch("vm.contact.dialTimezone",function(){b()});var h=g.getLogger("dashboard","agent.general.contact.dispose");function f(){return i(function(n){o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name,dialActive,dialMethod",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){v.queueCampaigns=e||{count:0,rows:[]},n()}).catch(function(e){h.error(e),s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.getBlackLists",msg:e.data?JSON.stringify(e.data):e.toString()})})})}function b(){var e=v.dialerCall?Number(v.call["xmd-voicequeueid"]):v.queueCampaign?v.queueCampaign.id:v.call["xmd-campaignid"]?Number(v.call["xmd-campaignid"]):null;if(e)o.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,_.isNil(v.contact.dialTimezone)&&(v.contact.dialTimezone=v.hopper.dialTimezone),n)o.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}});else{o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}}function A(){var e=v.selectedDisposition?v.selectedDisposition.name.toLowerCase():void 0;return{id:v.call.uniqueid,disposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,secondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,thirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null,dispositionat:moment(),amd:"amd"===e,fax:"fax"===e,blacklist:"blacklist"===e,recallme:"recallme"===e,UserId:"recallme"===e?d.getCurrentUser().id:null,OwnerId:d.getCurrentUser().id}}function E(e){t.hide([e,v.autoClose])}v.call&&v.call.variables&&v.call.variables["xmd-voicequeueid"]?(v.dialerCall=!0,o.voiceQueue.getBlackLists({id:v.call.variables["xmd-voicequeueid"]}).$promise.then(function(e){e&&e.rows&&0<e.rows.length&&(v.hasBlackLists=!0)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.getBlackLists",msg:e.data?JSON.stringify(e.data):e.toString()})})):f(),v.onDispositionChange=function(e){switch(e){case"first":v.selectedDisposition=v.firstLevelDisposition,v.anySecondLevelDisposition=_.some(v.dispositions,["ParentId",v.firstLevelDisposition.id]),v.secondLevelDisposition=void 0,v.thirdLevelDisposition=void 0,v.anyThirdLevelDisposition=!1;break;case"second":v.selectedDisposition=v.secondLevelDisposition,v.anyThirdLevelDisposition=_.some(v.dispositions,["ParentId",v.secondLevelDisposition.id]);break;case"third":v.selectedDisposition=v.thirdLevelDisposition}},v.clearDispositionSelection=function(e){"second"===e?(v.secondLevelDisposition=void 0,v.thirdLevelDisposition=void 0,v.selectedDisposition=v.firstLevelDisposition):"third"===e&&(v.thirdLevelDisposition=void 0,v.selectedDisposition=v.secondLevelDisposition)},v.saveDisposition=function(e){v.selectedDisposition=_.isNil(e)?v.selectedDisposition:{name:e},e&&(v.firstLevelDisposition=v.selectedDisposition);v.call.note=v.note,o.voiceCallReport.update({id:v.call.uniqueid,userDisposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,userSecondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,userThirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null,note:v.note,UserId:d.getCurrentUser().id,ContactId:v.contact.id}).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICECALLREPORT",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.voiceRecording.get({uniqueid:v.call.uniqueid}).$promise.then(function(e){if(e)for(var n=0;n<e.rows.length;n+=1)o.voiceRecording.update({id:e.rows[n].id,userDisposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,userSecondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,userThirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null}).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICERECORDING",msg:e.data?JSON.stringify(e.data):e.toString()})})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICERECORDING",msg:e.data?JSON.stringify(e.data):e.toString()})}),v.dialerCall&&(o.cmHopperFinal.update(A()).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERFINAL",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.cmHopperHistory.update(A()).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERHISTORY",msg:e.data?JSON.stringify(e.data):e.toString()})}));if(_.isNil(v.selectedDisposition))E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"");else switch(v.selectedDisposition.name.toLowerCase()){case"blacklist":v.call&&v.call.variables&&v.call.variables["xmd-voicequeueid"]&&function(e){if(e)o.voiceQueue.getBlackLists({id:e,type:"outbound",fields:"id"}).$promise.then(function(e){var n=[];if(e&&0<e.count){for(var t=0;t<e.rows.length;t+=1){var a=angular.copy(v.contact);delete a.id,a.ListId=e.rows[t].id,n.push(o.cmContact.save(a).$promise)}return i.all(n)}s.success({title:c.instant("DASHBOARDS.INFO"),msg:c.instant("DASHBOARDS.NOTAVAILABLE")+" "+v.selectedDisposition}),v.selectedDisposition=void 0}).then(function(e){e&&E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEBLACKLIST",msg:e.data?JSON.stringify(e.data):e.toString()}),E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")})}(v.call.variables["xmd-voicequeueid"]);break;case"reschedule":v.isReschedule=!0,v.recallme=!1;break;case"recallme":v.isReschedule=!0,v.recallme=!0,v.user.selectRecallMeCampaign&&f().then(function(){v.originalCampaign=_.find(v.queueCampaigns.rows,["id",v.call.variables["xmd-voicequeueid"]]);var e=JSON.parse(n.localStorage.getItem("motion2.user:"+v.user.id));v.queueCampaign=e.previewCampaignId?_.find(v.queueCampaigns.rows,["id",Number(e.previewCampaignId)]):v.originalCampaign});break;default:E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}},v.closeDialog=function(){t.cancel()},v.saveReschedule=function(){v.disable=!0;var e=null;v.queueCampaign?e=v.queueCampaign.id:v.dialerCall&&(e=Number(v.call["xmd-voicequeueid"]));return o.cmHopper.save({phone:v.contact.phone,UserId:v.recallme?d.getCurrentUser().id:null,ContactId:v.contact.id,ListId:v.contact.ListId,VoiceQueueId:e,scheduledat:moment(v.hopper.scheduledAt).format("YYYY-MM-DD HH:mm:ss"),dialTimezone:v.contact.dialTimezone,priority:3,recallme:v.recallme,OwnerId:d.getCurrentUser().id}).$promise.then(function(e){o.cmContact.rescheduleAdditionalPhones({id:v.contact.id,hopperId:e.id}).$promise.catch(function(e){console.log(e)})}).then(function(){if(v.dialerCall&&(o.cmHopperFinal.update({id:v.call.uniqueid,rescheduled:!0,rescheduledat:moment(v.hopper.scheduledAt).format("YYYY-MM-DD HH:mm:ss"),recallme:v.recallme}).$promise.catch(function(e){h.error(e)}),v.user.selectRecallMeCampaign)){var e=JSON.parse(n.localStorage.getItem("motion2.user:"+v.user.id));e.previewCampaignId=v.queueCampaign.id,n.localStorage.setItem("motion2.user:"+v.user.id,JSON.stringify(e))}}).then(function(){return o.cmContact.update({id:v.contact.id,dialTimezone:v.contact.dialTimezone})}).then(function(){s.success({title:c.instant("DASHBOARDS.INFO"),msg:c.instant("DASHBOARDS.CALL_DISPOSED")+" "+(v.recallme?c.instant("DASHBOARDS.RECALLME"):c.instant("DASHBOARDS.RESCHEDULE"))})}).catch(function(e){h.error(e),E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}).finally(function(){v.disable=!1,E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")})}}e.$inject=["$window","$mdDialog","$q","toasty","api","dispositions","globalDispositions","call","contact","Auth","$translate","availableCalls","autoClose","$scope","ClientSideLoggingService"],angular.module("app.staff").controller("DisposeCallDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.call=l,u.contact=r,u.hopper={minDate:new Date,dateTime:new Date},u.closeDialog=function(){a.cancel()},u.saveDialog=function(){return u.disable=!0,o.cmHopper.save({phone:u.contact.phone,UserId:c?d.getCurrentUser().id:null,ContactId:u.contact.id,ListId:u.contact.ListId,VoiceQueueId:Number(u.call["xmd-voicequeueid"]),scheduledat:moment(u.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),priority:3,recallme:c,OwnerId:d.getCurrentUser().id}).$promise.then(function(){o.cmHopperFinal.update({id:u.call.uniqueid,rescheduled:!0,rescheduledat:moment(u.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),recallme:c}).$promise}).then(function(){s.success({title:m.instant("DASHBOARDS.INFO"),msg:m.instant("DASHBOARDS.CALL_DISPOSED")+" "+(c?m.instant("DASHBOARDS.RECALLME"):m.instant("DASHBOARDS.RESCHEDULE"))}),a.hide()}).catch(function(e){a.cancel(e)}).finally(function(){u.disable=!1})}}e.$inject=["$scope","$state","$location","$mdDialog","$timeout","toasty","api","contact","call","Auth","recallme","$translate"],angular.module("app.staff").controller("RescheduleCallDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s){var o=this;o.callNumber=i,o.page=1,o.onInit=function(){n.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){o.lists=_.chain(e.rows).keyBy("id").mapValues("name").value(),n.cmCustomField.get({fields:"id,alias",nolimit:!0}).$promise.then(function(e){o.customFields=e.rows,o.contacts=_.map(t,function(t){return Object.keys(t).forEach(function(e){if(Number(t[e])===Number(o.callNumber))if(e.startsWith("cf_")){var n=_.find(o.customFields,["id",Number(_.trimStart(e,"cf_"))]);t.matchingField=n?n.alias:a.instant("DASHBOARDS.UNKNOWN")}else t.matchingField=e}),t})})}).then(function(){o.paginatedContacts=_.chunk(t,4)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},o.selectContact=function(){e.hide(o.selectedContact)}}e.$inject=["$mdDialog","$translate","api","contacts","callNumber","toasty"],angular.module("app.dashboards").controller("ContactSelectionController",e)}(),function(){"use strict";function e(e,n){var t=n(function(){},999);e.$on("$destroy",function(){t&&(n.cancel(t),t=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeAbandonedController",e)}(),function(){"use strict";function e(e,n,a,i,t,s,o,r,l,d){var c=this;function m(){return o.disposition.get({fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise.then(function(e){return c.dispositions=e?e.rows:[],o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise}).then(function(e){c.queues=e||{count:0,rows:[]},c.queuesMap=_.mapValues(_.keyBy(c.queues.rows,"name"),"name"),c.defaultQueues=c.queues.rows?_.map(c.queues.rows,"name").join(","):void 0}).then(function(){c.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:c.currentUser.name,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:c.queues.rows,ngValue:"name",clearAll:!1}]}).catch(function(e){console.log(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.abandoned.bull.calls:"+c.currentUser.id);if(e)(e=JSON.parse(e)).query&&(c.query=_.merge(e.query,c.query));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};c.query.createdAt=n}c.isSearchBarVisible=!!c.query.filter,u()})}function u(){c.query.queue=c.query.queue||c.defaultQueues.split(","),c.query.offset=(c.query.page-1)*c.query.limit;var e={query:c.query};t.localStorage.setItem("motion2.home.abandoned.bull.calls:"+c.currentUser.id,JSON.stringify(e)),c.promise=o.voiceQueueReport.getVoiceQueuesReport(c.query,p).$promise}function p(e){c.abandonedCalls=e||{count:0,rows:[]},c.refresh=!0}c.showTooltip=!1,c.refresh=!0,c.disable=[],c.dispositions={count:0,rows:[]},c.currentUser=r.getCurrentUser(),c.queues={},c.abandonedCalls={count:0,rows:[]},c.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition,note",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},c.getAbandonedCalls=u,c.refreshAbandonedCalls=function(){c.showTooltip=!1,u()},c.onInit=m,c.reserved=function(e){e&&(c.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?c.currentUser.name:null,assigned:e.assigned}).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[e.id]=!1,e.lastAssignedTo=e.assigned?c.currentUser.name:null}))},c.dispose=function(t){a.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(i.body),targetEvent:t,locals:{dispositions:c.dispositions,call:t}}).then(function(e){if(e){c.disable[t.id]=!0;var n={id:t.id,lastAssignedTo:t.assigned?c.currentUser.name:null,assigned:t.assigned,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null,note:e.note||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[t.id]=!1,t.disposition=e.firstLevel,t.secondDisposition=e.secondLevel,t.thirdDisposition=e.thirdLevel})}})},c.call=e.$parent.$parent.$parent.$parent.vm.call,c.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,c.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,c.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",function(e){c.queuesMap&&"outbound"===e.type&&c.queuesMap[e.queue]&&(c.showTooltip=!0)}),l.onWithoutApply("voiceQueueReport:update",function(e){if(e){var n=_.findIndex(c.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(c.abandonedCalls.rows[n],e)}}),m(),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeAbandonedBullController",e)}(),function(){"use strict";function e(n,t,e,a){var i=this;function s(e,n){switch(e){case"first":i.selectedDisposition=i.firstLevelDisposition,i.anySecondLevelDisposition=_.some(i.dispositions,["ParentId",i.firstLevelDisposition.id]),i.secondLevelDisposition=void 0,i.thirdLevelDisposition=void 0,i.anyThirdLevelDisposition=!1;break;case"second":i.selectedDisposition=i.secondLevelDisposition,i.anyThirdLevelDisposition=_.some(i.dispositions,["ParentId",i.secondLevelDisposition.id]);break;case"third":i.selectedDisposition=i.thirdLevelDisposition}n&&function(e){switch(e){case"first":i.call.secondDisposition&&(i.secondLevelDisposition=_.find(i.dispositions,function(e){return e.name===i.call.secondDisposition&&e.ParentId===i.firstLevelDisposition.id}),i.secondLevelDisposition&&s("second",!0));break;case"second":i.call.thirdDisposition&&(i.thirdLevelDisposition=_.find(i.dispositions,function(e){return e.name===i.call.thirdDisposition&e.ParentId===i.secondLevelDisposition.id}),i.thirdLevelDisposition&&s("third",!0))}}(e)}i.dispositions=e,i.call=a,i.note=i.call.note||void 0,i.onDispositionChange=s,i.clearDispositionSelection=function(e){"second"===e?(i.secondLevelDisposition=void 0,i.thirdLevelDisposition=void 0,i.selectedDisposition=i.firstLevelDisposition):"third"===e&&(i.thirdLevelDisposition=void 0,i.selectedDisposition=i.secondLevelDisposition);n.disposition.$setDirty()},i.saveDisposition=function(){i.call.note=i.note;var e={firstLevel:i.firstLevelDisposition?i.firstLevelDisposition.name:void 0,secondLevel:i.secondLevelDisposition?i.secondLevelDisposition.name:void 0,thirdLevel:i.thirdLevelDisposition?i.thirdLevelDisposition.name:void 0,note:i.note?i.note:void 0};t.hide(e)},i.closeDialog=function(){t.cancel()},i.call.disposition&&(i.firstLevelDisposition=_.find(i.dispositions,function(e){return e.name===i.call.disposition}),i.firstLevelDisposition&&s("first",!0))}e.$inject=["$scope","$mdDialog","dispositions","call"],angular.module("app.dashboards").controller("DisposeAbandonedCallDialogController",e)}(),function(){"use strict";function e(e,n,a,i,t,s,o,r,l,d){var c=this;function m(){return o.disposition.get({fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise.then(function(e){return c.dispositions=e?e.rows:[],o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise}).then(function(e){c.queues=e||{count:0,rows:[]},c.queuesMap=_.mapValues(_.keyBy(c.queues.rows,"name"),"name"),c.defaultQueues=c.queues.rows?_.map(c.queues.rows,"name").join(","):void 0}).then(function(){c.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:c.currentUser.name,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_QUEUE",options:c.queues.rows,ngValue:"name",clearAll:!1}]}).catch(function(e){console.log(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.abandoned.voice.calls:"+c.currentUser.id);if(e)(e=JSON.parse(e)).query&&(c.query=_.merge(e.query,c.query));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};c.query.createdAt=n}c.isSearchBarVisible=!!c.query.filter,u()})}function u(){c.query.queue=c.query.queue||c.defaultQueues.split(","),c.query.offset=(c.query.page-1)*c.query.limit;var e={query:c.query};t.localStorage.setItem("motion2.home.abandoned.voice.calls:"+c.currentUser.id,JSON.stringify(e)),c.promise=o.voiceQueueReport.getVoiceQueuesReport(c.query,p).$promise}function p(e){c.abandonedCalls=e||{count:0,rows:[]},c.refresh=!0}c.showTooltip=!1,c.refresh=!0,c.disable=[],c.dispositions={count:0,rows:[]},c.currentUser=r.getCurrentUser(),c.queues={},c.abandonedCalls={count:0,rows:[]},c.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition,note",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},c.getAbandonedCalls=u,c.refreshAbandonedCalls=function(){c.showTooltip=!1,u()},c.onInit=m,c.reserved=function(e){e&&(c.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?c.currentUser.name:null,assigned:e.assigned}).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[e.id]=!1,e.lastAssignedTo=e.assigned?c.currentUser.name:null}))},c.dispose=function(t){a.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(i.body),targetEvent:t,locals:{dispositions:c.dispositions,call:t}}).then(function(e){if(e){c.disable[t.id]=!0;var n={id:t.id,lastAssignedTo:t.assigned?c.currentUser.name:null,assigned:t.assigned,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null,note:e.note||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[t.id]=!1,t.disposition=e.firstLevel,t.secondDisposition=e.secondLevel,t.thirdDisposition=e.thirdLevel})}})},c.call=e.$parent.$parent.$parent.$parent.vm.call,c.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,c.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,c.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",function(e){c.queuesMap&&"inbound"===e.type&&c.queuesMap[e.queue]&&(c.showTooltip=!0)}),l.onWithoutApply("voiceQueueReport:update",function(e){if(e){var n=_.findIndex(c.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(c.abandonedCalls.rows[n],e)}}),m(),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeAbandonedVoiceController",e)}(),function(){"use strict";function e(n,a,t,e,i){var s=this;function o(){var e=angular.element(".agent-general-home-navbar button.current")[0];e&&e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}s.user=t.getCurrentUser(),s.license={},s.plugin={},s.setting={},s.sidebar="dashboard",s.draftManager=i,s.navigation=e.getNavigation(),s.addContactTab=n.$parent.vm.addContactTab,s.addInteractionTab=n.$parent.vm.addInteractionTab,s.init=function(e,n){s.license=e,s.setting=n;var t=a.localStorage.getItem("motion2.home:"+s.user.id);if(t){try{t=JSON.parse(t),s.sidebar=t.currentSidebarTab?t.currentSidebarTab:"dashboard"}catch(e){console.error(e),s.sidebar="dashboard"}"mail"===s.sidebar&&s.draftManager.init()}},s.changeSidebarTab=function(e){s.sidebar=e.view,"plugin"===s.sidebar&&(s.plugin=e.stateParams,s.pluginId=e.id,n.$broadcast("pluginUpdated",{plugin:s.plugin}));a.localStorage.setItem("motion2.home:"+s.user.id,JSON.stringify({currentSidebarTab:e.view}))},s.hasPermission=function(e){return t.hasPermission(e)},angular.element(a).on("resize",o),n.$on("$destroy",function(){angular.element(a).off("resize",o)}),n.$watch("vm_home.sidebar",function(e,n){"mail"===e?s.draftManager.init():s.draftManager.drafts={}})}e.$inject=["$scope","$window","Auth","msNavigationAgentService","draftManager"],angular.module("app.dashboards").controller("AgentGeneralHomeController",e)}(),function(){"use strict";function e(t,n,i,s,a,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.chatInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,ChatWebsiteId:[]},g.sectionColor="green-A700",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getChatWebsites({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.chatAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Website",key:"ChatWebsiteId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.chatAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Customer Ip",column:"customerIp",type:"text",options:{excludedOperators:["$eq","$ne","$startsWith","$endsWith"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Website",column:"ChatWebsiteId",type:"multiselect",options:{route:{model:"user",action:"getChatWebsites",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("chat",g.query,g.user.id,g.chatAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("chatInteraction:save",O),d.on("chatInteraction:update",O),d.on("chatInteractionTags:save",C),d.on("chatMessage:save",w),d.on("chatMessage:update",w),d.on("user_has_chat_interactions:save",T),d.on("user_has_chat_interactions:remove",I),d.on("userChatWebsite:save",f),d.on("userChatWebsite:remove",b),0<g.setting.chatInteractionsReloadTimeout&&R()})},g.success=E,g.getChatInteractions=y,g.showChatInteraction=function(e,n){t.$parent.vm.addInteractionTab("chat",n)},g.downloadChatInteraction=function(e,s,n){r.chatInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="chat-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadChatInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"chat",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getChatWebsiteLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.chat"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.chat");function h(e){return{accounts:g.chatAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.ChatWebsiteId);u.addAccount("chat",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.ChatWebsiteId);u.removeAccount("chat",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.chatAccounts.rows,function(e){return{model:"chatWebsite",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.chatInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.chatInteractions=e||{count:0,rows:[]};for(var n=0;n<g.chatInteractions.rows.length;n+=1)S(g.chatInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=a.localStorage.getItem("motion2.home.chat:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,a.localStorage.setItem("motion2.home.chat:"+g.user.id,JSON.stringify(n)),g.promise=r.chatInteraction.get(g.query,E).$promise}function S(e){"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.chatInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.chatInteractions.rows=_.orderBy(g.chatInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.chatInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.chatInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.chatInteractionsReloadTimeout)}t.$on("$destroy",function(){d.removeAllListeners("chatMessage:save"),d.removeAllListeners("chatMessage:update"),d.removeAllListeners("chatInteraction:save"),d.removeAllListeners("chatInteractionTags:save"),d.removeAllListeners("chatInteraction:update"),d.removeAllListeners("user_has_chat_interactions:save"),d.removeAllListeners("user_has_chat_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeChatController",e)}(),function(){"use strict";function e(t,n,e,a,i,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.contacts=e||{count:0,rows:[]}}function c(e,n){l.searchInProgress=!0,o.cmContact.describe({id:l.query.ListId}).$promise.then(function(e){return _(e.toJSON()).omit("UserId").values().map(function(e){return function(e){var n={name:_.startCase(e.displayName),column:e.columnName,options:{}};if(e.custom)switch(e.custom.type){case"text":n.type="text";break;case"select":n.type="multiselect",n.values=_.map(JSON.parse(e.custom.values),function(e,n){return{id:n,name:e.value,value:e.value}}),n.options.field="name";break;case"switch":n.type="select",n.values=[{id:1,translate:"DASHBOARDS.ENABLED"},{id:0,translate:"DASHBOARDS.DISABLED"}],n.options.excludedOperators=["$ne"];break;case"number":n.type="number";break;case"datetime":n.type="date"}else switch(e.columnName){case"dateOfBirth":n.type="date";break;case"CompanyId":n.name="Company",n.type="autocomplete",n.options.route={model:"cmCompany",action:"get",params:{fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;case"ListId":n.name="List",n.type="autocomplete",n.options.route={model:"user",action:"getLists",params:{id:l.currentUser.id,fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;default:_.includes(e.type.toLowerCase(),"int")?n.type="number":_.includes(e.type.toLowerCase(),"date")?n.type="date":n.type="text"}return n}(e)}).value()}).then(function(e){l.advancedSearch.fields=e;var n=_.findIndex(e,function(e){return _.startsWith(e.column,"cf_")})||e.length-1;n<0&&(n=e.length),l.advancedSearch.fields.splice(n,0,{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"DESCRIBE_CM_CONTACTS",msg:e.data?JSON.stringify(e.data.message):e.toString()})}),e||(l.query.page=1),l.query.offset=(l.query.page-1)*l.query.limit;var t=i.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);(t=t?JSON.parse(t):{}).query=l.query,i.localStorage.setItem("motion2.home.contacts:"+l.currentUser.id,JSON.stringify(t)),l.promise=o.cmContact.get(l.query,d).$promise}l.currentUser=s.getCurrentUser(),l.lists={},l.contacts={count:0,rows:[]},l.tags={count:0,rows:[]},l.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1},l.advancedSearch={fields:[]},l.sectionColor="red",l.getContacts=c,l.refreshContacts=function(){c()},l.mergeContact=function(e,n){a.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.duplicateContact=function(e,n){a.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.openContact=function(e){return o.cmContact.get({id:e}).$promise.then(function(e){n.$parent.vm.addContactTab(e)})},l.call=n.$parent.vm.call,l.onInit=function(){o.user.getLists({id:l.currentUser.id,fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return l.lists=e||{count:0,rows:[]},l.listsMap=_.keyBy(l.lists.rows,"id"),o.tag.get({sort:"name"}).$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"List",key:"ListId",type:"multiselect",label:"CONTACTMANAGER.SELECT_LIST",options:l.lists.rows,clearAll:!1},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:l.tags.rows,placeholder:"DASHBOARDS.TAGS"}]}).catch(function(e){console.error(e)}).finally(function(){var e=i.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query),_.isEmpty(l.lists.rows)?l.query.ListId=[]:_.isEmpty(l.query.ListId)&&(l.query.ListId=_(l.lists.rows).map("id").take().value()))}catch(e){console.log(e)}else l.query.ListId=_.map(l.lists.rows,"id");l.isSearchBarVisible=!(l.query.search||!l.query.filter),c()})},l.openAdvancedSearch=function(){a.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{color:l.sectionColor,fields:l.advancedSearch.fields,storagePath:"home.contacts"},fullscreen:!0}).then(function(e){l.isSearchBarVisible=!(e.value||!l.query.filter),e.apply&&(l.query.search=e.value,c())}).catch(function(e){r.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}e.$inject=["$document","$scope","$timeout","$mdDialog","$window","Auth","api","toasty"],angular.module("app.dashboards").controller("AgentHomeContactsController",e)}(),function(){"use strict";function e(e,n){var t=n(function(){},999);e.$on("$destroy",function(){t&&(n.cancel(t),t=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeDashboardController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["type","waiting","dialMethod","dialActive"];function u(e){c.voiceQueuesTotal=e.count?e.count:0,c.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.voiceQueues,function(e,n){c.rpcVoiceQueues[n]&&(c.voiceQueues[n].waiting=c.rpcVoiceQueues[n].waiting||0)})}c.voiceQueues={},c.voiceQueuesTotal=0,c.rpcVoiceQueues={},c.getVoiceQueues={},c.rpcVoiceQueuesChannels={},c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.load=!0,c.query={id:r.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",type:"outbound",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=u,c.getVoiceQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,u).$promise},c.getSize=function(e){return _.size(e)},c.onSaveQueue=function(e){c.voiceQueues[e.id]&&c.rpcVoiceQueues[e.id]&&(c.rpcVoiceQueues[e.id]=e,_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onSaveChannel=function(e){"outbound"===e.type&&(e.queuecallerleaveAt?(delete c.rpcVoiceQueuesChannels[e.uniqueid],c.load&&c.deleteVoiceQueuesChannels.push(e.uniqueid)):(c.rpcVoiceQueuesChannels[e.uniqueid]=e,c.load&&(c.addVoiceQueuesChannels[e.uniqueid]=e)))},c.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getVoiceQueues()},c.onSaveVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]=_.pick(e,m))},c.onUpdateVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]&&_.merge(c.rpcVoiceQueues[e.id],_.pick(e,m)),c.voiceQueues[e.id]&&_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onRemoveVoiceQueue=function(e){_.isNil(e)||(delete c.rpcVoiceQueues[e.id],delete c.voiceQueues[e.id])},l.onWithoutApply("voice_queue:save",c.onSaveQueue),l.onWithoutApply("voice_queue_channel:save",c.onSaveChannel),l.onWithoutApply("userVoiceQueue:save",c.onUserVoiceQueue),l.onWithoutApply("userVoiceQueue:remove",c.onUserVoiceQueue),l.onWithoutApply("voiceQueue:save",c.onSaveVoiceQueue),l.onWithoutApply("voiceQueue:remove",c.onRemoveVoiceQueue),l.onWithoutApply("voiceQueue:update",c.onUpdateVoiceQueue),o.rpc.getVoiceQueues().$promise.then(function(e){return c.rpcVoiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){c.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,{type:"outbound",queuecallerleaveAt:null}):[],"uniqueid"):{}}).catch(function(e){console.error(e)}).finally(function(){_.merge(c.rpcVoiceQueuesChannels,c.addVoiceQueuesChannels);for(var e=0;e<c.deleteVoiceQueuesChannels.length;e+=1)delete c.rpcVoiceQueuesChannels[c.deleteVoiceQueuesChannels[e]];c.load=!1,c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.getVoiceQueues()});var p=!0,g=1;e.$watch("vm_dc.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getVoiceQueues())}),e.$on("$destroy",function(){l.removeAllListeners("voice_queue:save"),l.removeAllListeners("voice_queue_channel:save"),l.removeAllListeners("userVoiceQueue:save"),l.removeAllListeners("userVoiceQueue:remove"),l.removeAllListeners("voiceQueue:save"),l.removeAllListeners("voiceQueue:update"),l.removeAllListeners("voiceQueue:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardBullController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcChatQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.chatQueuesTotal=e.count?e.count:0,c.chatQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.chatQueues,function(e,n){c.rpcChatQueues[n]&&(c.chatQueues[n].waiting=c.rpcChatQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.chatQueues={},c.chatQueuesTotal=0,c.rpcChatQueues={},c.paginatedInteractions=[],c.deleteChatQueuesWaitingInteractions=[],c.rpcChatQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"chat",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getChatQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.chatQueues[e.id]&&c.rpcChatQueues[e.id]&&(_.merge(c.rpcChatQueues[e.id],_.pick(e,m)),_.merge(c.chatQueues[e.id],_.pick(e,m)))},c.onSaveChatQueue=function(e){_.isNil(e)||(c.rpcChatQueues[e.id]=_.pick(e,m))},c.onUpdateChatQueue=function(e){_.isNil(e)||(c.rpcChatQueues[e.id]&&_.merge(c.rpcChatQueues[e.id],_.pick(e,m)),c.chatQueues[e.id]&&_.merge(c.chatQueues[e.id],_.pick(e,m)))},c.onRemoveChatQueue=function(e){_.isNil(e)||(delete c.rpcChatQueues[e.id],delete c.chatQueues[e.id])},c.onSaveUserChatQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getChatQueues()},c.onRemoveUserChatQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getChatQueues()},c.onSaveChatQueueChannel=function(e){c.chatQueues[e.queue_id]&&(c.rpcChatQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveChatQueueChannel=function(e){delete c.rpcChatQueuesWaitingInteractions[e.id],u&&c.deleteChatQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("chat_queue:save",c.onSaveQueue),l.onWithoutApply("chatQueue:save",c.onSaveChatQueue),l.onWithoutApply("chatQueue:update",c.onUpdateChatQueue),l.onWithoutApply("chatQueue:remove",c.onRemoveChatQueue),l.onWithoutApply("userChatQueue:save",c.onSaveUserChatQueue),l.onWithoutApply("userChatQueue:remove",c.onRemoveUserChatQueue),l.onWithoutApply("chat_queue_waiting_interaction:save",c.onSaveChatQueueChannel),l.onWithoutApply("chat_queue_waiting_interaction:remove",c.onRemoveChatQueueChannel),o.rpc.getChatQueues().$promise.then(function(e){c.rpcChatQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"chat"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getChatQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcChatQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteChatQueuesWaitingInteractions.length;e+=1)delete c.rpcChatQueuesWaitingInteractions[c.deleteChatQueuesWaitingInteractions[e]];u=!1,c.deleteChatQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getChatQueues())}),e.$on("$destroy",function(){l.removeAllListeners("chat_queue:save"),l.removeAllListeners("chatQueue:save"),l.removeAllListeners("chatQueue:update"),l.removeAllListeners("chatQueue:remove"),l.removeAllListeners("userChatQueue:save"),l.removeAllListeners("userChatQueue:remove"),l.removeAllListeners("chat_queue_waiting_interaction:save"),l.removeAllListeners("chat_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelChatController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcFaxQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.faxQueuesTotal=e.count?e.count:0,c.faxQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.faxQueues,function(e,n){c.rpcFaxQueues[n]&&(c.faxQueues[n].waiting=c.rpcFaxQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.faxQueues={},c.faxQueuesTotal=0,c.rpcFaxQueues={},c.paginatedInteractions=[],c.deleteFaxQueuesWaitingInteractions=[],c.rpcFaxQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"fax",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getFaxQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.faxQueues[e.id]&&c.rpcFaxQueues[e.id]&&(_.merge(c.rpcFaxQueues[e.id],_.pick(e,m)),_.merge(c.faxQueues[e.id],_.pick(e,m)))},c.onSaveFaxQueue=function(e){_.isNil(e)||(c.rpcFaxQueues[e.id]=_.pick(e,m))},c.onUpdateFaxQueue=function(e){_.isNil(e)||(c.rpcFaxQueues[e.id]&&_.merge(c.rpcFaxQueues[e.id],_.pick(e,m)),c.faxQueues[e.id]&&_.merge(c.faxQueues[e.id],_.pick(e,m)))},c.onRemoveFaxQueue=function(e){_.isNil(e)||(delete c.rpcFaxQueues[e.id],delete c.faxQueues[e.id])},c.onSaveUserFaxQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getFaxQueues()},c.onRemoveUserFaxQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getFaxQueues()},c.onSaveFaxQueueChannel=function(e){c.faxQueues[e.queue_id]&&(c.rpcFaxQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveFaxQueueChannel=function(e){delete c.rpcFaxQueuesWaitingInteractions[e.id],u&&c.deleteFaxQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("fax_queue:save",c.onSaveQueue),l.onWithoutApply("faxQueue:save",c.onSaveFaxQueue),l.onWithoutApply("faxQueue:update",c.onUpdateFaxQueue),l.onWithoutApply("faxQueue:remove",c.onRemoveFaxQueue),l.onWithoutApply("userFaxQueue:save",c.onSaveUserFaxQueue),l.onWithoutApply("userFaxQueue:remove",c.onRemoveUserFaxQueue),l.onWithoutApply("fax_queue_waiting_interaction:save",c.onSaveFaxQueueChannel),l.onWithoutApply("fax_queue_waiting_interaction:remove",c.onRemoveFaxQueueChannel),o.rpc.getFaxQueues().$promise.then(function(e){c.rpcFaxQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"fax"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getFaxQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcFaxQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteFaxQueuesWaitingInteractions.length;e+=1)delete c.rpcFaxQueuesWaitingInteractions[c.deleteFaxQueuesWaitingInteractions[e]];u=!1,c.deleteFaxQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getFaxQueues())}),e.$on("$destroy",function(){l.removeAllListeners("fax_queue:save"),l.removeAllListeners("faxQueue:save"),l.removeAllListeners("faxQueue:update"),l.removeAllListeners("faxQueue:remove"),l.removeAllListeners("userFaxQueue:save"),l.removeAllListeners("userFaxQueue:remove"),l.removeAllListeners("fax_queue_waiting_interaction:save"),l.removeAllListeners("fax_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelFaxController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcMailQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.mailQueuesTotal=e.count?e.count:0,c.mailQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.mailQueues,function(e,n){c.rpcMailQueues[n]&&(c.mailQueues[n].waiting=c.rpcMailQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.mailQueues={},c.mailQueuesTotal=0,c.rpcMailQueues={},c.paginatedInteractions=[],c.deleteMailQueuesWaitingInteractions=[],c.rpcMailQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"mail",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getMailQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.mailQueues[e.id]&&c.rpcMailQueues[e.id]&&(_.merge(c.rpcMailQueues[e.id],_.pick(e,m)),_.merge(c.mailQueues[e.id],_.pick(e,m)))},c.onSaveMailQueue=function(e){_.isNil(e)||(c.rpcMailQueues[e.id]=_.pick(e,m))},c.onUpdateMailQueue=function(e){_.isNil(e)||(c.rpcMailQueues[e.id]&&_.merge(c.rpcMailQueues[e.id],_.pick(e,m)),c.mailQueues[e.id]&&_.merge(c.mailQueues[e.id],_.pick(e,m)))},c.onRemoveMailQueue=function(e){_.isNil(e)||(delete c.rpcMailQueues[e.id],delete c.mailQueues[e.id])},c.onSaveUserMailQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getMailQueues()},c.onRemoveUserMailQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getMailQueues()},c.onSaveMailQueueChannel=function(e){c.mailQueues[e.queue_id]&&(c.rpcMailQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveMailQueueChannel=function(e){delete c.rpcMailQueuesWaitingInteractions[e.id],u&&c.deleteMailQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("mail_queue:save",c.onSaveQueue),l.onWithoutApply("mailQueue:save",c.onSaveMailQueue),l.onWithoutApply("mailQueue:update",c.onUpdateMailQueue),l.onWithoutApply("mailQueue:remove",c.onRemoveMailQueue),l.onWithoutApply("userMailQueue:save",c.onSaveUserMailQueue),l.onWithoutApply("userMailQueue:remove",c.onRemoveUserMailQueue),l.onWithoutApply("mail_queue_waiting_interaction:save",c.onSaveMailQueueChannel),l.onWithoutApply("mail_queue_waiting_interaction:remove",c.onRemoveMailQueueChannel),o.rpc.getMailQueues().$promise.then(function(e){c.rpcMailQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"mail"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getMailQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcMailQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteMailQueuesWaitingInteractions.length;e+=1)delete c.rpcMailQueuesWaitingInteractions[c.deleteMailQueuesWaitingInteractions[e]];u=!1,c.deleteMailQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getMailQueues())}),e.$on("$destroy",function(){l.removeAllListeners("mail_queue:save"),l.removeAllListeners("mailQueue:save"),l.removeAllListeners("mailQueue:update"),l.removeAllListeners("mailQueue:remove"),l.removeAllListeners("userMailQueue:save"),l.removeAllListeners("userMailQueue:remove"),l.removeAllListeners("mail_queue_waiting_interaction:save"),l.removeAllListeners("mail_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelMailController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcOpenchannelQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.openchannelQueuesTotal=e.count?e.count:0,c.openchannelQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.openchannelQueues,function(e,n){c.rpcOpenchannelQueues[n]&&(c.openchannelQueues[n].waiting=c.rpcOpenchannelQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.openchannelQueues={},c.openchannelQueuesTotal=0,c.rpcOpenchannelQueues={},c.paginatedInteractions=[],c.deleteOpenchannelQueuesWaitingInteractions=[],c.rpcOpenchannelQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"openchannel",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getOpenchannelQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.openchannelQueues[e.id]&&c.rpcOpenchannelQueues[e.id]&&(_.merge(c.rpcOpenchannelQueues[e.id],_.pick(e,m)),_.merge(c.openchannelQueues[e.id],_.pick(e,m)))},c.onSaveOpenchannelQueue=function(e){_.isNil(e)||(c.rpcOpenchannelQueues[e.id]=_.pick(e,m))},c.onUpdateOpenchannelQueue=function(e){_.isNil(e)||(c.rpcOpenchannelQueues[e.id]&&_.merge(c.rpcOpenchannelQueues[e.id],_.pick(e,m)),c.openchannelQueues[e.id]&&_.merge(c.openchannelQueues[e.id],_.pick(e,m)))},c.onRemoveOpenchannelQueue=function(e){_.isNil(e)||(delete c.rpcOpenchannelQueues[e.id],delete c.openchannelQueues[e.id])},c.onSaveUserOpenchannelQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getOpenchannelQueues()},c.onRemoveUserOpenchannelQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getOpenchannelQueues()},c.onSaveOpenchannelQueueChannel=function(e){c.openchannelQueues[e.queue_id]&&(c.rpcOpenchannelQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveOpenchannelQueueChannel=function(e){delete c.rpcOpenchannelQueuesWaitingInteractions[e.id],u&&c.deleteOpenchannelQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("openchannel_queue:save",c.onSaveQueue),l.onWithoutApply("openchannelQueue:save",c.onSaveOpenchannelQueue),l.onWithoutApply("openchannelQueue:update",c.onUpdateOpenchannelQueue),l.onWithoutApply("openchannelQueue:remove",c.onRemoveOpenchannelQueue),l.onWithoutApply("userOpenchannelQueue:save",c.onSaveUserOpenchannelQueue),l.onWithoutApply("userOpenchannelQueue:remove",c.onRemoveUserOpenchannelQueue),l.onWithoutApply("openchannel_queue_waiting_interaction:save",c.onSaveOpenchannelQueueChannel),l.onWithoutApply("openchannel_queue_waiting_interaction:remove",c.onRemoveOpenchannelQueueChannel),o.rpc.getOpenchannelQueues().$promise.then(function(e){c.rpcOpenchannelQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"openchannel"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getOpenchannelQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcOpenchannelQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteOpenchannelQueuesWaitingInteractions.length;e+=1)delete c.rpcOpenchannelQueuesWaitingInteractions[c.deleteOpenchannelQueuesWaitingInteractions[e]];u=!1,c.deleteOpenchannelQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getOpenchannelQueues())}),e.$on("$destroy",function(){l.removeAllListeners("openchannel_queue:save"),l.removeAllListeners("openchannelQueue:save"),l.removeAllListeners("openchannelQueue:update"),l.removeAllListeners("openchannelQueue:remove"),l.removeAllListeners("userOpenchannelQueue:save"),l.removeAllListeners("userOpenchannelQueue:remove"),l.removeAllListeners("openchannel_queue_waiting_interaction:save"),l.removeAllListeners("openchannel_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelOpenchannelController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcSmsQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.smsQueuesTotal=e.count?e.count:0,c.smsQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.smsQueues,function(e,n){c.rpcSmsQueues[n]&&(c.smsQueues[n].waiting=c.rpcSmsQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.smsQueues={},c.smsQueuesTotal=0,c.rpcSmsQueues={},c.paginatedInteractions=[],c.deleteSmsQueuesWaitingInteractions=[],c.rpcSmsQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"sms",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getSmsQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.smsQueues[e.id]&&c.rpcSmsQueues[e.id]&&(_.merge(c.rpcSmsQueues[e.id],_.pick(e,m)),_.merge(c.smsQueues[e.id],_.pick(e,m)))},c.onSaveSmsQueue=function(e){_.isNil(e)||(c.rpcSmsQueues[e.id]=_.pick(e,m))},c.onUpdateSmsQueue=function(e){_.isNil(e)||(c.rpcSmsQueues[e.id]&&_.merge(c.rpcSmsQueues[e.id],_.pick(e,m)),c.smsQueues[e.id]&&_.merge(c.smsQueues[e.id],_.pick(e,m)))},c.onRemoveSmsQueue=function(e){_.isNil(e)||(delete c.rpcSmsQueues[e.id],delete c.smsQueues[e.id])},c.onSaveUserSmsQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getSmsQueues()},c.onRemoveUserSmsQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getSmsQueues()},c.onSaveSmsQueueChannel=function(e){c.smsQueues[e.queue_id]&&(c.rpcSmsQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveSmsQueueChannel=function(e){delete c.rpcSmsQueuesWaitingInteractions[e.id],u&&c.deleteSmsQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("sms_queue:save",c.onSaveQueue),l.onWithoutApply("smsQueue:save",c.onSaveSmsQueue),l.onWithoutApply("smsQueue:update",c.onUpdateSmsQueue),l.onWithoutApply("smsQueue:remove",c.onRemoveSmsQueue),l.onWithoutApply("userSmsQueue:save",c.onSaveUserSmsQueue),l.onWithoutApply("userSmsQueue:remove",c.onRemoveUserSmsQueue),l.onWithoutApply("sms_queue_waiting_interaction:save",c.onSaveSmsQueueChannel),l.onWithoutApply("sms_queue_waiting_interaction:remove",c.onRemoveSmsQueueChannel),o.rpc.getSmsQueues().$promise.then(function(e){c.rpcSmsQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"sms"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getSmsQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcSmsQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteSmsQueuesWaitingInteractions.length;e+=1)delete c.rpcSmsQueuesWaitingInteractions[c.deleteSmsQueuesWaitingInteractions[e]];u=!1,c.deleteSmsQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getSmsQueues())}),e.$on("$destroy",function(){l.removeAllListeners("sms_queue:save"),l.removeAllListeners("smsQueue:save"),l.removeAllListeners("smsQueue:update"),l.removeAllListeners("smsQueue:remove"),l.removeAllListeners("userSmsQueue:save"),l.removeAllListeners("userSmsQueue:remove"),l.removeAllListeners("sms_queue_waiting_interaction:save"),l.removeAllListeners("sms_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelSmsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l){var d=this,c=["type","waiting","dialMethod","dialActive"];function m(e){d.voiceQueuesTotal=e.count?e.count:0,d.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(d.voiceQueues,function(e,n){d.rpcVoiceQueues[n]&&(d.voiceQueues[n].waiting=d.rpcVoiceQueues[n].waiting||0)})}d.voiceQueues={},d.voiceQueuesTotal=0,d.rpcVoiceQueues={},d.getVoiceQueues={},d.rpcVoiceQueuesChannels={},d.addVoiceQueuesChannels={},d.deleteVoiceQueuesChannels=[],d.load=!0,d.query={id:r.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",type:"inbound",limit:10,page:1},d.queryChannels={limit:10,page:1},d.success=m,d.getVoiceQueues=function(){d.query.offset=(d.query.page-1)*d.query.limit,d.promise=o.user.getQueues(d.query,m).$promise},d.getSize=function(e){return _.size(e)},d.onSaveQueue=function(e){d.voiceQueues[e.id]&&d.rpcVoiceQueues[e.id]&&(d.rpcVoiceQueues[e.id]=e,_.merge(d.voiceQueues[e.id],_.pick(e,c)))},d.onSaveChannel=function(e){"inbound"===e.type&&(e.queuecallerleaveAt?(delete d.rpcVoiceQueuesChannels[e.uniqueid],d.load&&d.deleteVoiceQueuesChannels.push(e.uniqueid)):(d.rpcVoiceQueuesChannels[e.uniqueid]=e,d.load&&(d.addVoiceQueuesChannels[e.uniqueid]=e)))},d.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&d.getVoiceQueues()},d.onSaveVoiceQueue=function(e){_.isNil(e)||(d.rpcVoiceQueues[e.id]=_.pick(e,c))},d.onUpdateVoiceQueue=function(e){_.isNil(e)||(d.rpcVoiceQueues[e.id]&&_.merge(d.rpcVoiceQueues[e.id],_.pick(e,c)),d.voiceQueues[e.id]&&_.merge(d.voiceQueues[e.id],_.pick(e,c)))},d.onRemoveVoiceQueue=function(e){_.isNil(e)||(delete d.rpcVoiceQueues[e.id],delete d.voiceQueues[e.id])},l.onWithoutApply("voice_queue:save",d.onSaveQueue),l.onWithoutApply("voice_queue_channel:save",d.onSaveChannel),l.onWithoutApply("voice_queue_channel:remove",function(e){"inbound"===e.type&&delete d.rpcVoiceQueuesChannels[e.uniqueid]}),l.onWithoutApply("userVoiceQueue:save",d.onUserVoiceQueue),l.onWithoutApply("userVoiceQueue:remove",d.onUserVoiceQueue),l.onWithoutApply("voiceQueue:save",d.onSaveVoiceQueue),l.onWithoutApply("voiceQueue:remove",d.onRemoveVoiceQueue),l.onWithoutApply("voiceQueue:update",d.onUpdateVoiceQueue),o.user.getQueues(d.query).$promise.then(function(e){return d.myQueues=e,d.myQueues.count=e.rows.length,o.rpc.getVoiceQueues().$promise}).then(function(e){for(var n=e.rows,t=_.keyBy(n,"id"),a=0;a<d.myQueues.count;a++){var i=d.myQueues.rows[a];d.rpcVoiceQueues[i.id]=t[i.id]}return o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){d.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,function(e){return!("inbound"!==e.type||e.queuecallerleaveAt||!_.find(d.myQueues.rows,{name:e.queue}))}):[],"uniqueid"):{}}).catch(function(e){console.error(e)}).finally(function(){_.merge(d.rpcVoiceQueuesChannels,d.addVoiceQueuesChannels);for(var e=0;e<d.deleteVoiceQueuesChannels.length;e+=1)delete d.rpcVoiceQueuesChannels[d.deleteVoiceQueuesChannels[e]];d.load=!1,d.addVoiceQueuesChannels={},d.deleteVoiceQueuesChannels=[],d.getVoiceQueues()});var u=!0,p=1;e.$watch("vm_dc.query.filter",function(e,n){u?t(function(){u=!1}):(n||(p=d.query.page),e!==n&&(d.query.page=1),e||(d.query.page=p),d.getVoiceQueues())}),e.$on("$destroy",function(){l.removeAllListeners("voice_queue:save"),l.removeAllListeners("voice_queue_channel:save"),l.removeAllListeners("userVoiceQueue:save"),l.removeAllListeners("userVoiceQueue:remove"),l.removeAllListeners("voiceQueue:save"),l.removeAllListeners("voiceQueue:update"),l.removeAllListeners("voiceQueue:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket"],angular.module("app.dashboards").controller("AgentHomeDashboardVoiceController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcWhatsappQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.whatsappQueuesTotal=e.count?e.count:0,c.whatsappQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.whatsappQueues,function(e,n){c.rpcWhatsappQueues[n]&&(c.whatsappQueues[n].waiting=c.rpcWhatsappQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.whatsappQueues={},c.whatsappQueuesTotal=0,c.rpcWhatsappQueues={},c.paginatedInteractions=[],c.deleteWhatsappQueuesWaitingInteractions=[],c.rpcWhatsappQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"whatsapp",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getWhatsappQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.whatsappQueues[e.id]&&c.rpcWhatsappQueues[e.id]&&(_.merge(c.rpcWhatsappQueues[e.id],_.pick(e,m)),_.merge(c.whatsappQueues[e.id],_.pick(e,m)))},c.onSaveWhatsappQueue=function(e){_.isNil(e)||(c.rpcWhatsappQueues[e.id]=_.pick(e,m))},c.onUpdateWhatsappQueue=function(e){_.isNil(e)||(c.rpcWhatsappQueues[e.id]&&_.merge(c.rpcWhatsappQueues[e.id],_.pick(e,m)),c.whatsappQueues[e.id]&&_.merge(c.whatsappQueues[e.id],_.pick(e,m)))},c.onRemoveWhatsappQueue=function(e){_.isNil(e)||(delete c.rpcWhatsappQueues[e.id],delete c.whatsappQueues[e.id])},c.onSaveUserWhatsappQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getWhatsappQueues()},c.onRemoveUserWhatsappQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getWhatsappQueues()},c.onSaveWhatsappQueueChannel=function(e){c.whatsappQueues[e.queue_id]&&(c.rpcWhatsappQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveWhatsappQueueChannel=function(e){delete c.rpcWhatsappQueuesWaitingInteractions[e.id],u&&c.deleteWhatsappQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("whatsapp_queue:save",c.onSaveQueue),l.onWithoutApply("whatsappQueue:save",c.onSaveWhatsappQueue),l.onWithoutApply("whatsappQueue:update",c.onUpdateWhatsappQueue),l.onWithoutApply("whatsappQueue:remove",c.onRemoveWhatsappQueue),l.onWithoutApply("userWhatsappQueue:save",c.onSaveUserWhatsappQueue),l.onWithoutApply("userWhatsappQueue:remove",c.onRemoveUserWhatsappQueue),l.onWithoutApply("whatsapp_queue_waiting_interaction:save",c.onSaveWhatsappQueueChannel),l.onWithoutApply("whatsapp_queue_waiting_interaction:remove",c.onRemoveWhatsappQueueChannel),o.rpc.getWhatsappQueues().$promise.then(function(e){c.rpcWhatsappQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"whatsapp"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getWhatsappQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcWhatsappQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteWhatsappQueuesWaitingInteractions.length;e+=1)delete c.rpcWhatsappQueuesWaitingInteractions[c.deleteWhatsappQueuesWaitingInteractions[e]];u=!1,c.deleteWhatsappQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getWhatsappQueues())}),e.$on("$destroy",function(){l.removeAllListeners("whatsapp_queue:save"),l.removeAllListeners("whatsappQueue:save"),l.removeAllListeners("whatsappQueue:update"),l.removeAllListeners("whatsappQueue:remove"),l.removeAllListeners("userWhatsappQueue:save"),l.removeAllListeners("userWhatsappQueue:remove"),l.removeAllListeners("whatsapp_queue_waiting_interaction:save"),l.removeAllListeners("whatsapp_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelWhatsappController",e)}(),function(){"use strict";function e(a,t,i,s,o,n,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.faxInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,FaxAccountId:[]},g.sectionColor="blue-grey",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getFaxAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.faxAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"FaxAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.faxAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"FaxAccountId",type:"multiselect",options:{route:{model:"user",action:"getFaxAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("fax",g.query,g.user.id,g.faxAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("faxInteraction:save",O),d.on("faxInteraction:update",O),d.on("faxInteractionTags:save",C),d.on("faxMessage:save",w),d.on("faxMessage:update",w),d.on("user_has_fax_interactions:save",T),d.on("user_has_fax_interactions:remove",I),d.on("userFaxAccount:save",f),d.on("userFaxAccount:remove",b)})},g.success=E,g.getFaxInteractions=y,g.showFaxInteraction=function(e,n){a.$parent.vm.addInteractionTab("fax",n)},g.downloadFaxInteraction=function(e,s,n){r.faxInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="fax-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadFaxInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"fax",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?n.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return n.instant("DASHBOARDS.NOT_ASSIGNED")},g.getFaxAccountLabel=function(e){if(e.Account)return e.Account.key;return n.instant("DASHBOARDS.UNKNOWN")},g.composeFaxInteraction=function(e,t){i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.faxAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.fax"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.fax");function h(e){return{accounts:g.faxAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.FaxAccountId);u.addAccount("fax",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.FaxAccountId);u.removeAccount("fax",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.faxAccounts.rows,function(e){return{model:"faxAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.faxInteractionsReloadTimeout&&function(e){e&&g.interactionsInterval&&t.cancel(g.interactionsInterval);g.interactionsInterval=t(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.faxInteractionsReloadTimeout)}(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.faxInteractions=e||{count:0,rows:[]};for(var n=0;n<g.faxInteractions.rows.length;n+=1)S(g.faxInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=o.localStorage.getItem("motion2.home.fax:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,o.localStorage.setItem("motion2.home.fax:"+g.user.id,JSON.stringify(n)),g.promise=r.faxInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.fax:void 0,"Unknown"===e.contactName&&(e.contactName=n.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.faxInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.faxInteractions.rows=_.orderBy(g.faxInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else y(g.query.page)}}function C(e){if(e){var n=_.find(g.faxInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}a.$on("$destroy",function(){d.removeAllListeners("faxMessage:save"),d.removeAllListeners("faxMessage:update"),d.removeAllListeners("faxInteraction:save"),d.removeAllListeners("faxInteractionTags:save"),d.removeAllListeners("faxInteraction:update"),d.removeAllListeners("user_has_fax_interactions:save"),d.removeAllListeners("user_has_fax_interactions:remove"),g.interactionsInterval&&t.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeFaxController",e)}(),function(){"use strict";function e(o,n,r,l,m,t,e,d,a,i,c,u,s,p,g){var v=this;v.user=a.getCurrentUser(),v.license={},v.setting={},v.tags={count:0,rows:[]},v.mailInteractions={count:0,rows:[]},v.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,MailAccountId:[]},v.sectionColor="teal",v.onInit=function(e,n){return v.license=e,v.setting=n,d.user.getMailAccounts({id:v.user.id,nolimit:!0}).$promise.then(function(e){return v.mailAccounts=e||{count:0,rows:[]},d.tag.get({sort:"name"}).$promise}).then(function(e){v.tags=e||{count:0,rows:[]}}).then(function(){return d.mailSubstatus.get({nolimit:!0}).$promise}).then(function(e){v.subStatuses=e||{count:0,rows:[]}}).then(function(){v.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Substatus",key:"substatus",type:"select",label:"DASHBOARDS.SELECT_SUBSTATUS",options:v.subStatuses.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NONE"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name",ngIf:"closed === 0"},{name:"Account",key:"MailAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:v.mailAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:v.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:v.tags.rows,placeholder:"DASHBOARDS.TAGS"}],v.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"plainBody",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Substatus",column:"substatus",type:"multiselect",options:{field:"name",route:{model:"mailSubstatus",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"MailAccountId",type:"multiselect",options:{route:{model:"user",action:"getMailAccounts",params:{id:v.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:E("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:E("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:E("third")}}]}}).catch(function(e){h.error(e)}).finally(function(){s.parseInteractionsKey("mail",v.query,v.user.id,v.mailAccounts.rows).then(function(){v.isSearchBarVisible=!(v.query.search||!v.query.filter),S(v.query.page)}),i.on("mailInteraction:save",w),i.on("mailInteraction:update",w),i.on("mailInteractionTags:save",R),i.on("mailMessage:save",x),i.on("mailMessage:update",x),i.on("user_has_mail_interactions:save",O),i.on("user_has_mail_interactions:remove",C),i.on("userMailAccount:save",b),i.on("userMailAccount:remove",A),0<v.setting.mailInteractionsReloadTimeout&&N()})},v.success=y,v.getMailInteractions=S,v.showMailInteraction=T,v.downloadMailInteraction=function(e,s,n){d.mailInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="mail-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadMailInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.disposeInteraction=function(e,n){var t=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause,a=!n.Account.mandatoryDisposition;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){v.user&&n.Account.mandatoryDisposition&&!t&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},locals:{user:v.user,channel:"mail",interaction:n}})},v.getContactLabel=I,v.getAgentLabel=function(e){if(e.UserId)return e.UserId===v.user.id?t.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return t.instant("DASHBOARDS.NOT_ASSIGNED")},v.getMailAccountLabel=function(e){if(e.Account)return e.Account.key;return t.instant("DASHBOARDS.UNKNOWN")},v.composeMailInteraction=function(e,s){r.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{account:s,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){if(!e.message||!e.message.savedAsDraft){var i=e;return d.mailAccount.send({id:s.id},i).$promise.then(function(e){if(e&&e.Messages&&e.Messages.length){if(i.attachments&&i.attachments.length)for(var n=0;n<i.attachments.length;n+=1)d.attachment.update({id:i.attachments[n].id},{MailMessageId:_.head(e.Messages).id});if(c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed){e.disposition=null;var t=!s.mandatoryDisposition,a=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),onRemoving:function(){v.user&&s.mandatoryDisposition&&!a&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},clickOutsideToClose:t,escapeToClose:t,locals:{user:v.user,channel:"mail",interaction:e}})}else o.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"MAILACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}var n={channel:"mail",account:s,message:e.message,contact:e.contact};u.add(n)}})},v.openAdvancedSearch=function(){r.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{color:v.sectionColor,fields:v.advancedSearch.fields,storagePath:"home.mail"},fullscreen:!0}).then(function(e){v.isSearchBarVisible=!(e.value||!v.query.filter),e.apply&&(v.query.search=e.value,S())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var h=g.getLogger("agent.general.mail");function f(e){return{accounts:v.mailAccounts,accountId:e,filters:v.quickFilters,query:v.query,userId:v.user.id}}function b(e){if(e.UserId===v.user.id){var n=f(e.MailAccountId);p.addAccount("mail",n).then(function(e){e&&S()}).catch(function(e){h.error(e)})}}function A(e){if(e.UserId===v.user.id){var n=f(e.MailAccountId);p.removeAccount("mail",n).catch(function(e){h.error(e)})}}function E(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(v.mailAccounts.rows,function(e){return{model:"mailAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function y(e){!v.reloadingInteractions&&0<v.setting.mailInteractionsReloadTimeout&&N(!0),v.searchInProgress=!1,v.reloadingInteractions=!1,v.mailInteractions=e||{count:0,rows:[]};for(var n=0;n<v.mailInteractions.rows.length;n+=1)I(v.mailInteractions.rows[n])}function S(e){v.searchInProgress=!0,e||(v.query.page=1),(void 0===v.query.closed||null===v.query.closed||v.query.closed)&&delete v.query.substatus,v.query.offset=(v.query.page-1)*v.query.limit;var n=m.localStorage.getItem("motion2.home.mail:"+v.user.id);(n=n?JSON.parse(n):{}).query=v.query,m.localStorage.setItem("motion2.home.mail:"+v.user.id,JSON.stringify(n)),v.promise=d.mailInteraction.get(v.query,y).$promise}function T(e,n){o.$parent.vm.addInteractionTab("mail",n)}function I(e){_.isEmpty(e.to)||!e.Account||_.includes(e.to,e.Account.email)?e.contactInfo=e.Contact?e.Contact.email:void 0:e.contactInfo=e.to.split("<").pop().split(">")[0],"Unknown"===e.contactName&&(e.contactName=t.instant("DASHBOARDS.UNKNOWN"))}function O(e){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function C(e){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function w(e){if(e){var n=_.find(v.mailInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),v.query.sort){var t=_.startsWith(v.query.sort,"-")?"desc":"asc";v.mailInteractions.rows=_.orderBy(v.mailInteractions.rows,_.trimStart(v.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===v.setting.mailInteractionsReloadTimeout&&S(v.query.page)}}function R(e){if(e){var n=_.find(v.mailInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function x(e){if(e&&!e.secret){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function N(e){e&&v.interactionsInterval&&n.cancel(v.interactionsInterval),v.interactionsInterval=n(function(){v.reloadingInteractions=!0,v.searchInProgress||S()},1e3*v.setting.mailInteractionsReloadTimeout)}o.$on("openMailDraft",function(e,s){s.interaction?(s.interaction.isDraft=!0,T(null,s.interaction)):r.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{account:s.account,message:s.content,type:"draft",interaction:{}},fullscreen:!0}).then(function(e){if(e){if(!e.message||!e.message.savedAsDraft){var i=e;return d.mailAccount.send({id:s.account.id},i).$promise.then(function(e){if(u.remove(s.id),e&&e.Messages&&e.Messages.length){if(i.attachments&&i.attachments.length)for(var n=0;n<i.attachments.length;n+=1)d.attachment.update({id:i.attachments[n].id},{MailMessageId:_.head(e.Messages).id});if(c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed){e.disposition=null;var t=!s.account.mandatoryDisposition,a=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),onRemoving:function(){v.user&&s.account.mandatoryDisposition&&!a&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},clickOutsideToClose:t,escapeToClose:t,locals:{user:v.user,channel:"mail",interaction:e}})}else o.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"MAILACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}var n={id:s.id,channel:"mail",account:e.account,message:e.message};u.update(n)}})}),v.resetTooltipPosition=function(e){var n=angular.element(e.currentTarget).children()[1],t=angular.element(n);t.css("top",""),t.css("left",""),t.css("bottom","")},v.adjustTooltipPosition=function(e){var n=angular.element(e.currentTarget).children(),t=n[0],a=n[1],i=angular.element(t),s=angular.element(a),o=m.innerHeight,r=i.offset(),l=r.top,d=r.left,c=o<216+l;s.css("left",d),c?(s.css("top",""),s.css("bottom",o-l)):(s.css("bottom",""),s.css("top",l))},o.$on("$destroy",function(){i.removeAllListeners("mailMessage:save"),i.removeAllListeners("mailMessage:update"),i.removeAllListeners("mailInteraction:save"),i.removeAllListeners("mailInteractionTags:save"),i.removeAllListeners("mailInteraction:update"),i.removeAllListeners("user_has_mail_interactions:save"),i.removeAllListeners("user_has_mail_interactions:remove"),v.interactionsInterval&&n.cancel(v.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","draftManager","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeMailController",e)}(),function(){"use strict";function e(t,a,e,i,n,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.contacts=e||{count:0,rows:[]}}function c(e,n){l.searchInProgress=!0,s.cmContact.describe({id:l.query.ListId}).$promise.then(function(e){return _(e.toJSON()).omit("UserId").values().map(function(e){return function(e){var n={name:_.startCase(e.displayName),column:e.columnName,options:{}};if(e.custom)switch(e.custom.type){case"text":n.type="text";break;case"select":n.type="multiselect",n.values=_.map(JSON.parse(e.custom.values),function(e,n){return{id:n,name:e.value,value:e.value}}),n.options.field="name";break;case"switch":n.type="select",n.values=[{id:1,translate:"DASHBOARDS.ENABLED"},{id:0,translate:"DASHBOARDS.DISABLED"}],n.options.excludedOperators=["$ne"];break;case"number":n.type="number";break;case"datetime":n.type="date"}else switch(e.columnName){case"dateOfBirth":n.type="date";break;case"CompanyId":n.name="Company",n.type="autocomplete",n.options.route={model:"cmCompany",action:"get",params:{fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;case"ListId":n.name="List",n.type="autocomplete",n.options.route={model:"user",action:"getLists",params:{id:l.currentUser.id,fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;default:_.includes(e.type.toLowerCase(),"int")?n.type="number":_.includes(e.type.toLowerCase(),"date")?n.type="date":n.type="text"}return n}(e)}).value()}).then(function(e){l.advancedSearch.fields=e;var n=_.findIndex(e,function(e){return _.startsWith(e.column,"cf_")})||e.length-1;n<0&&(n=e.length),l.advancedSearch.fields.splice(n,0,{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"DESCRIBE_CM_CONTACTS",msg:e.data?JSON.stringify(e.data.message):e.toString()})}),e||(l.query.page=1),l.query.offset=(l.query.page-1)*l.query.limit;var t=o.localStorage.getItem("motion2.home.mycontacts:"+l.currentUser.id);(t=t?JSON.parse(t):{}).query=l.query,o.localStorage.setItem("motion2.home.mycontacts:"+l.currentUser.id,JSON.stringify(t)),l.query.search&&(l.advancedQuery=_.omit(l.query,"id")),l.promise=l.query.search?s.cmContact.get(l.advancedQuery,d).$promise:s.user.getContacts(l.query,d).$promise}l.currentUser=n.getCurrentUser(),l.lists={},l.contacts={count:0,rows:[]},l.tags={count:0,rows:[]},l.query={includeAll:!0,id:l.currentUser.id,sort:"-updatedAt",limit:10,page:1},l.advancedSearch={fields:[]},l.sectionColor="red",l.getContacts=c,l.refreshContacts=function(){c()},l.mergeContact=function(e,n){i.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.duplicateContact=function(e,n){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.openContact=function(e,n){a.$parent.vm.addContactTab(n)},l.call=a.$parent.vm.call,l.onInit=function(){s.cmList.get({fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return l.lists=e||{count:0,rows:[]},l.listsMap=_.keyBy(l.lists.rows,"id"),s.tag.get({sort:"name"}).$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"List",key:"ListId",type:"multiselect",label:"CONTACTMANAGER.SELECT_LIST",options:l.lists.rows,clearAll:!1},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:l.tags.rows,placeholder:"DASHBOARDS.TAGS"}]}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.mycontacts:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query),_.isEmpty(l.lists.rows)?l.query.ListId=[]:_.isEmpty(l.query.ListId)&&(l.query.ListId=_(l.lists.rows).map("id").take().value()))}catch(e){console.error(e)}else l.query.ListId=_.map(l.lists.rows,"id");l.isSearchBarVisible=!(l.query.search||!l.query.filter),c()})},l.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{color:l.sectionColor,fields:l.advancedSearch.fields,storagePath:"home.mycontacts"},fullscreen:!0}).then(function(e){l.isSearchBarVisible=!(e.value||!l.query.filter),e.apply&&(l.query.search=e.value?e.value+="||User:=$eq["+l.currentUser.id+"]":e.value,c())}).catch(function(e){r.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}e.$inject=["$document","$scope","$timeout","$mdDialog","Auth","api","$window","toasty"],angular.module("app.dashboards").controller("AgentHomeMyContactsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.openchannelInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,OpenchannelAccountId:[]},g.sectionColor="amber",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getOpenchannelAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.openchannelAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"OpenchannelAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.openchannelAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"OpenchannelAccountId",type:"multiselect",options:{route:{model:"user",action:"getOpenchannelAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("openchannel",g.query,g.user.id,g.openchannelAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("openchannelInteraction:save",O),d.on("openchannelInteraction:update",O),d.on("openchannelInteractionTags:save",C),d.on("openchannelMessage:save",w),d.on("openchannelMessage:update",w),d.on("user_has_openchannel_interactions:save",T),d.on("user_has_openchannel_interactions:remove",I),d.on("userOpenchannelAccount:save",f),d.on("userOpenchannelAccount:remove",b),0<g.setting.openchannelInteractionsReloadTimeout&&R()})},g.success=E,g.getOpenchannelInteractions=y,g.showOpenchannelInteraction=function(e,n){a.$parent.vm.addInteractionTab("openchannel",n)},g.downloadOpenchannelInteraction=function(e,s,n){r.openchannelInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="openchannel-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadOpenchannelInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"openchannel",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getOpenchannelAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeOpenchannelInteraction=function(e,t){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.openchannelAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("openchannel",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"OPENCHANNELACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.openchannel"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.openchannel");function h(e){return{accounts:g.openchannelAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.OpenchannelAccountId);u.addAccount("openchannel",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.OpenchannelAccountId);u.removeAccount("openchannel",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.openchannelAccounts.rows,function(e){return{model:"openchannelAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.openchannelInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.openchannelInteractions=e||{count:0,rows:[]};for(var n=0;n<g.openchannelInteractions.rows.length;n+=1)S(g.openchannelInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.openchannel:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.openchannel:"+g.user.id,JSON.stringify(n)),g.promise=r.openchannelInteraction.get(g.query,E).$promise}function S(e){"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.openchannelInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.openchannelInteractions.rows=_.orderBy(g.openchannelInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.openchannelInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.openchannelInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.openchannelInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("openchannelMessage:save"),d.removeAllListeners("openchannelMessage:update"),d.removeAllListeners("openchannelInteraction:save"),d.removeAllListeners("openchannelInteractionTags:save"),d.removeAllListeners("openchannelInteraction:update"),d.removeAllListeners("user_has_openchannel_interactions:save"),d.removeAllListeners("user_has_openchannel_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeOpenchannelController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e,n,t){d.license=e,d.setting=n,d.plugin=t}d.currentUser=o.getCurrentUser(),d.plugin={},d.onInit=c,d.getTrustedURL=function(){return s.trustAsResourceUrl(d.plugin.agentUrl)},c(),n.$on("pluginUpdated",function(e,n){d.plugin=n.plugin})}e.$inject=["$document","$scope","$timeout","$mdDialog","$stateParams","$sce","Auth","api","$window"],angular.module("app.dashboards").controller("AgentHomePluginsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(){d.agentsQuery.offset=(d.agentsQuery.page-1)*d.agentsQuery.limit,l.update("motion2.home.presence.agents:"+d.currentUser.id,d.agentsQuery,"query"),i.user.getPresence(d.agentsQuery).$promise.then(function(e){d.agents={count:e.count,rows:_.filter(e.rows,function(e){return e.id!==d.currentUser.id})}}).catch(function(){r.error({title:t.instant("DASHBOARDS.AGENT_PRESENCE"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")})})}function m(){d.queuesQuery.offset=(d.queuesQuery.page-1)*d.queuesQuery.limit,l.update("motion2.home.presence.queues:"+d.currentUser.id,d.queuesQuery,"query"),i.voiceQueue.get(d.queuesQuery).$promise.then(function(e){return d.voiceQueues=e||{rows:[],count:0},i.rpc.getVoiceQueuesChannels().$promise.then(function(e){e.rows.forEach(function(e){var n=_.find(d.voiceQueues.rows,["name",e.name]);n&&(n.calls||(n.calls=[]),n.calls.push(e))})})}).catch(function(){r.error({title:t.instant("VOICE.VOICEQUEUES"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")})})}function u(e){return 0===d.selectedTab?e:"xcallyQueueExtension"+e}function p(e,n,t,a){var i=_.find(d.agents.rows,["id",e]);i&&(i.status=!1===n?"offline":a?"pause":"unavailable"===t?t:_.includes(["idle","unknown","ringing",null,void 0],t)?"online":"busy")}function g(e){e.id!==d.currentUser.id&&p(e.id,e.online,e.voiceStatus,e.voicePause)}d.currentUser=s.getCurrentUser(),d.agents={count:0,rows:[]},d.agentsQuery={fields:"id,name,internal,online",role:"agent",sort:"name",limit:10,page:1},d.queuesQuery={fields:"id,name",type:"inbound",sort:"name",limit:10,page:1},d.onAgentsTabSelection=function(){if(d.agentsQuery.filter||d.agentsQuery.teams||d.agentsQuery.queues)return;_.merge(d.agentsQuery,l.get("motion2.home.presence.agents:"+d.currentUser.id,"query")),d.isSearchBarVisible=!!d.agentsQuery.filter,a.all([a(function(n,e){i.team.get({fields:"id,name",sort:"name",nolimit:!0}).$promise.then(function(e){d.teams=e||{rows:[],count:0},n()}).catch(function(){r.error({title:t.instant("STAFF.TEAMS"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),e()})}),a(function(n,e){i.voiceQueue.get({fields:"id,name",type:"inbound",sort:"name",nolimit:!0}).$promise.then(function(e){d.queues=e||{rows:[],count:0},n()}).catch(function(){r.error({title:t.instant("VOICE.VOICEQUEUES"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),e()})})]).then(function(){d.quickFilters=[{name:"Team",key:"teams",type:"multiselect",label:"DASHBOARDS.SELECT_TEAM",options:d.teams.rows},{name:"Queue",key:"queues",type:"multiselect",label:"DASHBOARDS.SELECT_QUEUE",options:d.queues.rows}],c()}).catch(function(){r.error({title:t.instant("DASHBOARDS.AGENT_PRESENCE"),msg:t.instant("DASHBOARDS.ERRORS.FAILED_INITIALIZATION")})})},d.onQueuesTabSelection=function(){if(d.queuesQuery.filter)return;_.merge(d.queuesQuery,l.get("motion2.home.presence.queues:"+d.currentUser.id,"query")),d.isSearchBarVisible=!!d.queuesQuery.filter,m()},d.getAgents=c,d.getVoiceQueues=m,d.originateCall=function(e){n.$broadcast("webrtc::call",{target:u(e)})},d.transferCall=function(e){n.$broadcast("webrtc::transfer",{target:u(e)})},o.on("user:presence",function(e){if(e.id===d.currentUser.id)return;p(e.id,e.online,e.voiceStatus,e.voicePause)}),o.on("user:update",g),o.on("voice_queue_presence:save",function(e){if(!d.voiceQueues&&d.voiceQueues.rows)return;var n=_.find(d.voiceQueues.rows,["name",e.name]);if(!n)return;n.calls||(n.calls=[]);if(_.some(n.calls,["uniqueid",e.uniqueid]))return;n.calls.push(e)}),o.on("voice_queue_presence:remove",function(e){var n=_.find(d.voiceQueues.rows,["name",e.name]);if(!n)return;_.remove(n.calls,["uniqueid",e.uniqueid])}),e.$on("$destroy",function(){o.removeListener("user:update",g),o.removeAllListeners("user:presence"),o.removeAllListeners("voice_queue_presence:save"),o.removeAllListeners("voice_queue_presence:remove")})}e.$inject=["$scope","$rootScope","$translate","$q","api","Auth","socket","toasty","localStorageManager"],angular.module("app.dashboards").controller("AgentHomePresenceController",e)}(),function(){"use strict";function e(e,t,n,a,o,i){var s=this;function r(e){s.searchInProgress=!1,s.voiceRecordings=e||{count:0,rows:[]}}function l(){s.searchInProgress=!0,s.query.offset=(s.query.page-1)*s.query.limit;var e={query:s.query};t.localStorage.setItem("motion2.home.recordings:"+s.currentUser.id,JSON.stringify(e)),s.promise=a.voiceRecording.get(s.query,r).$promise}s.currentUser=i.getCurrentUser(),s.voiceRecordings={},s.table="voiceRecordings",s.query={UserId:s.currentUser.id,fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,transcribeStatus,UserId",sort:"-updatedAt",limit:10,page:1,type:null},s.downloadfile=function(i,e){return a.voiceRecording.download({id:i.id,exists:!0}).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download",i.uniqueid+i.format),a.click()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.downloadtranscribe=function(s,e){return a.voiceRecording.downloadTranscribe({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.success=r,s.getVoiceRecordings=l,s.onInit=function(){s.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Type",key:"type",type:"select",label:"VOICE.SELECT_TYPE",customOptions:[{value:"internal",translate:"VOICE.INTERNAL"},{value:"inbound",translate:"VOICE.INBOUND"},{value:"outbound",translate:"VOICE.OUTBOUND"},{value:"dialer",translate:"VOICE.DIALER"},{value:null,translate:"VOICE.ALL"}]}];var e=t.localStorage.getItem("motion2.home.recordings:"+s.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(s.query=_.merge(s.query,e.query))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};s.query.createdAt=n}s.isSearchBarVisible=!!s.query.filter,l()}}e.$inject=["$scope","$window","$timeout","api","toasty","Auth"],angular.module("app.dashboards").controller("AgentHomeRecordingsController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,r,n){var l=this;function d(e){l.searchInProgress=!1,l.scheduledCalls=e||{count:0,rows:[]}}l.currentUser=n.getCurrentUser(),l.priorities=["Lowest","Low","Medium","High","Highest"],l.crudPermissions={readOnly:!1,canEdit:!0,canDelete:!0},l.scheduledCalls={},l.query={id:l.currentUser.id,fields:"id,phone,scheduledat,recallme,priority,UserId,OwnerId,dialTimezone",sort:"scheduledat",limit:10,page:1},l.queueCampaigns={rows:[],count:0},l.success=d,l.getScheduledCalls=function(){l.searchInProgress=!0,l.query.id=l.currentUser.id,l.query.includeAll=!0,l.query.offset=(l.query.page-1)*l.query.limit,l.query.fields="id,phone,scheduledat,recallme,priority,UserId,OwnerId,dialTimezone";var e={query:l.query};t.localStorage.setItem("motion2.home.scheduled:"+l.currentUser.id,JSON.stringify(e)),l.promise=r.user.getScheduledCalls(l.query,d).$promise},l.onInit=function(){r.user.getQueues({id:n.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){l.queueCampaigns=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"Start Date",key:"scheduledat",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Campaigns",key:"VoiceQueueId",type:"multiselect",label:"MOTIONDIALER.SELECT_CAMPAIGN",options:l.queueCampaigns.rows}]}).catch(function(e){console.error(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.scheduled:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.omit(e.query,["filter"]))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};l.query.scheduledat=n}l.getScheduledCalls()})},l.isDateBeforeToday=function(e){return moment(e).isBefore(moment())},l.createOrEditQueueCampaignHopper=function(e,n){i.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:null,hopper:n,hoppers:l.scheduledCalls.rows,license:null,setting:null,crudPermissions:l.crudPermissions}})},l.deleteConfirm=function(n,e){var t=i.confirm().title("Are you sure want to delete the scheduled call?").htmlContent("<b>Scheduled call</b> will be deleted.").ariaLabel("delete scheduled call").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){var e;e=n,r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(l.scheduledCalls.rows,{id:e.id}),l.scheduledCalls.count-=1,l.scheduledCalls.rows.length||l.getScheduledCalls(),o.success({title:"Scheduled call deleted!",msg:e.name?"Scheduled call has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE_HOPPER"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETE_HOPPER",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})};var c=!0,m=1;e.$watch("vm.query.filter",function(e,n){c?a(function(){c=!1}):(n||(m=l.query.page),e!==n&&(l.query.page=1),e||(l.query.page=m),l.getScheduledCalls())})}e.$inject=["$scope","$window","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.dashboards").controller("AgentHomeScheduledCallsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.smsInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,SmsAccountId:[]},g.sectionColor="orange",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getSmsAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.smsAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"SmsAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.smsAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"SmsAccountId",type:"multiselect",options:{route:{model:"user",action:"getSmsAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("sms",g.query,g.user.id,g.smsAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("smsInteraction:save",O),d.on("smsInteraction:update",O),d.on("smsInteractionTags:save",C),d.on("smsMessage:save",w),d.on("smsMessage:update",w),d.on("user_has_sms_interactions:save",T),d.on("user_has_sms_interactions:remove",I),d.on("userSmsAccount:save",f),d.on("userSmsAccount:remove",b),0<g.setting.smsInteractionsReloadTimeout&&R()})},g.success=E,g.getSmsInteractions=y,g.showSmsInteraction=function(e,n){a.$parent.vm.addInteractionTab("sms",n)},g.downloadSmsInteraction=function(e,s,n){r.smsInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="sms-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadSmsInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"sms",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getSmsAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeSmsInteraction=function(e,t){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.smsAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("sms",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SMSACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.sms"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.sms");function h(e){return{accounts:g.smsAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.SmsAccountId);u.addAccount("sms",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.SmsAccountId);u.removeAccount("sms",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.smsAccounts.rows,function(e){return{model:"smsAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.smsInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.smsInteractions=e||{count:0,rows:[]};for(var n=0;n<g.smsInteractions.rows.length;n+=1)S(g.smsInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.sms:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.sms:"+g.user.id,JSON.stringify(n)),g.promise=r.smsInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.mobile:void 0,"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.smsInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.smsInteractions.rows=_.orderBy(g.smsInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.smsInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.smsInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.smsInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("smsMessage:save"),d.removeAllListeners("smsMessage:update"),d.removeAllListeners("smsInteraction:save"),d.removeAllListeners("smsInteractionTags:save"),d.removeAllListeners("smsInteraction:update"),d.removeAllListeners("user_has_sms_interactions:save"),d.removeAllListeners("user_has_sms_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeSmsController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.voiceCalls=e||{count:0,rows:[]}}function c(){l.searchInProgress=!0,l.query.offset=(l.query.page-1)*l.query.limit;var e={query:l.query};s.localStorage.setItem("motion2.home.voice:"+l.currentUser.id,JSON.stringify(e)),l.promise=a.voiceCallReport.get(l.query,d).$promise}l.currentUser=e.getCurrentUser(),l.voiceCalls={},l.table="voiceCalls",l.query={UserId:l.currentUser.id,fields:"id,type,uniqueid,tag,starttime,endtime,source,destination,userDisposition,userSecondDisposition,userThirdDisposition,note,duration,billableseconds,answertime",sort:"-updatedAt",limit:10,page:1,type:null},l.success=d,l.getVoiceCalls=c,l.onInit=function(){return a.tag.get({sort:"name"}).$promise.then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Type",key:"type",type:"select",label:"VOICE.SELECT_TYPE",customOptions:[{value:"internal",translate:"VOICE.INTERNAL"},{value:"inbound",translate:"VOICE.INBOUND"},{value:"outbound",translate:"VOICE.OUTBOUND"},{value:"dialer",translate:"VOICE.DIALER"},{value:null,translate:"VOICE.ALL"}]}]}).catch(function(e){i.error({title:"Init error",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}),l.tags={count:0,rows:[]}}).finally(function(){var e=s.localStorage.getItem("motion2.home.voice:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};l.query.createdAt=n}l.isSearchBarVisible=!!l.query.filter,c()})},l.showDetails=function(e){n.show({controller:"AgentHomeVoiceDetailsController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{call:e}})}}e.$inject=["$mdDialog","$document","api","toasty","Auth","$window","$scope","$timeout"],angular.module("app.dashboards").controller("AgentHomeVoiceController",e)}(),function(){"use strict";function e(e,n){this.call=n,this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","call"],angular.module("app.dashboards").controller("AgentHomeVoiceDetailsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.whatsappInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,WhatsappAccountId:[]},g.sectionColor="lime-A700",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getWhatsappAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.whatsappAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"WhatsappAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.whatsappAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"WhatsappAccountId",type:"multiselect",options:{route:{model:"user",action:"getWhatsappAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("whatsapp",g.query,g.user.id,g.whatsappAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("whatsappInteraction:save",O),d.on("whatsappInteraction:update",O),d.on("whatsappInteractionTags:save",C),d.on("whatsappMessage:save",w),d.on("whatsappMessage:update",w),d.on("user_has_whatsapp_interactions:save",T),d.on("user_has_whatsapp_interactions:remove",I),d.on("userWhatsappAccount:save",f),d.on("userWhatsappAccount:remove",b),0<g.setting.whatsappInteractionsReloadTimeout&&R()})},g.success=E,g.getWhatsappInteractions=y,g.showWhatsappInteraction=function(e,n){a.$parent.vm.addInteractionTab("whatsapp",n)},g.downloadWhatsappInteraction=function(e,s,n){r.whatsappInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="whatsapp-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadWhatsappInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"whatsapp",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getWhatsappAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeWhatsappInteraction=function(e,t){i.show({controller:"ComposeWhatsappInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.whatsappAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("whatsapp",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"WHATSAPPACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.whatsapp"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.whatsapp");function h(e){return{accounts:g.whatsappAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.WhatsappAccountId);u.addAccount("whatsapp",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.WhatsappAccountId);u.removeAccount("whatsapp",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.whatsappAccounts.rows,function(e){return{model:"whatsappAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.whatsappInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.whatsappInteractions=e||{count:0,rows:[]};for(var n=0;n<g.whatsappInteractions.rows.length;n+=1)S(g.whatsappInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.whatsapp:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.whatsapp:"+g.user.id,JSON.stringify(n)),g.promise=r.whatsappInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.mobile:void 0,"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.whatsappInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.whatsappInteractions.rows=_.orderBy(g.whatsappInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.whatsappInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.whatsappInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.whatsappInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("whatsappMessage:save"),d.removeAllListeners("whatsappMessage:update"),d.removeAllListeners("whatsappInteraction:save"),d.removeAllListeners("whatsappInteractionTags:save"),d.removeAllListeners("whatsappInteraction:update"),d.removeAllListeners("user_has_whatsapp_interactions:save"),d.removeAllListeners("user_has_whatsapp_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeWhatsappController",e)}(),function(){"use strict";function e(e,n){var t=this;t.setting={},t.messages={count:0,rows:[]},t.showInteraction=!1,t.init=function(e,n){t.setting=n,t.tab=e,t.tab.saved=!0},t.getTrustedURL=function(){return n.trustAsResourceUrl(t.tab.src)}}e.$inject=["$scope","$sce"],angular.module("app.dashboards").controller("AgentGeneralIframeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this,f=16,b=1024*f*1024;function A(){var e=h.user.voicePause||h.user.chatPause||h.user.mailPause||h.user.openchannelPause||h.user.faxPause,n=!h.tab.interaction.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(t.body),clickOutsideToClose:n,escapeToClose:n,onRemoving:function(){h.user&&h.interaction.Account.mandatoryDisposition&&!e&&l.user.unpause({id:h.user.id}).$promise.catch(function(e){d.error(e.data?e.data.message:e.toString())})},locals:{user:h.user,channel:h.tab.channel,interaction:h.tab.interaction}}).then(function(e){h.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(h.tab)})}function E(e,n){h.tab.message=n,i.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:h.tab.message,type:e,interaction:h.interaction},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){if(e)if(e.message&&e.message.savedAsDraft)h.draft?p.update({id:h.draft.id,channel:"mail",account:h.account,message:e.message,contact:h.contact,interaction:h.interaction}):p.add({channel:"mail",account:h.account,message:e.message,contact:h.contact,interaction:h.interaction}),h.draft=p.getByInteraction(h.tab.interaction.id);else{var n=e;n&&S(n),n.Interaction&&h.interaction&&h.interaction.id&&(n.Interaction.id=h.interaction.id,l.mailInteraction.update(n.Interaction).$promise.then(function(e){e&&e.closed?(h.tab.saved=!0,h.interaction.closed=!0,A()):null!==n.Interaction.substatus&&(h.tab.saved=!0,h.tab.interaction.substatus=n.Interaction.substatus,a.$parent.$parent.$parent.vm.closeTab(h.tab))}).catch(function(e){d.error(e.data?e.data.message:e.toString())}))}}).finally(function(){h.tab.isDraft=!1})}function y(){"mail"!==h.tab.channel&&n(function(){var e=angular.element(t.find("md-content[name*='interaction-content-"+h.tab.id+"']"));e&&e[0]&&(e[0].scrollTop=e[0].scrollHeight)},0)}function S(i){if(i)return i["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"]=h.interaction["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"],i[_.capitalize(h.tab.channel)+"InteractionId"]=h.interaction.id,i.UserId=h.user.id,i.ContactId=h.interaction.ContactId,i.direction="out",i.secret=Boolean(h.tab.spy||i.secret),l[h.tab.channel+"Message"].save(i).$promise.then(function(e){if(e&&e.id&&!_.isEmpty(i.attachments)){for(var n=[],t=0;t<i.attachments.length;t++){var a=i.attachments[t];a.MailMessageId?n.push(l.attachment.clone({id:a.id},{name:a.name,basename:a.basename,type:a.type,MailMessageId:e.id}).$promise):n.push(l.attachment.update({id:a.id},{MailMessageId:e.id}).$promise)}return s.all(n)}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SENDMESSAGE",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){"mail"===h.tab.channel&&i.isDraft&&(p.removeByInteraction(h.interaction.id),h.draft=null),h.tab.areaText="",y()})}function T(e){switch(h.tab.channel){case"mail":h.draft.content.originalMessage=e?_.find(h.interaction.Messages,["id",e]):_.findLast(h.interaction.Messages,["secret",!1]),E(h.draft.type,h.draft.content)}}function I(e){h.journeyIsLoading=!0;var n=_.merge(h.journeyOptions,{id:h.contact.id,offset:e||0});return g.get(h.journey,n).then(function(e){h.journey=e.journey,h.canLoadMoreJourney=e.loadMore}).finally(function(){h.journeyIsLoading=!1})}h.showFooter=!1,h.BTNLoadMore=0,h.showInteraction=!1,h.user=c.getCurrentUser(),h.detectBrowser=u.detectBrowser(),h.journey=[],h.acceptedMessages=[],h.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:b,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},h.ngFlow={flow:{}},h.selectedMailShowDetails={},h.selectedMailShowSystemMessage={},h.setting={},h.ctrlMethods={},h.embedOptions={fontSmiley:!0,sanitizeHtml:!0,emoji:!0,link:!0,linkTarget:"_blank"},h.journeyOptions=g.getQuery(),h.quickFilters=g.getQuickFilters(),h.init=function(e,n){h.tab=e,h.tab.saved=!0,h.tab.badges=0,h.setting=n||{},h.tab&&h.tab.channel&&h.tab.interaction&&(h.interaction=h.tab.interaction,l[h.tab.channel+"Interaction"].get({id:h.tab.interaction.id,includeAll:!0}).$promise.then(function(e){return e&&(h.interaction=e,h.tab.interaction=e),h.tab.saved=h.interaction.closed,h.queryMessage={id:h.interaction.id,includeAll:!0},"mail"===h.tab.channel?(h.queryMessage.sort="-id",h.queryMessage.offset=0,h.queryMessage.limit=3,h.queryMessage.inlineCss=!0):(h.queryMessage.sort="id",h.queryMessage.nolimit=!0),l[h.tab.channel+"Interaction"].getMessages(h.queryMessage).$promise}).then(function(e){return e&&(h.BTNLoadMore=e.count-h.queryMessage.limit),h.messages=e||{count:0,rows:[]},l["chat"===h.tab.channel?"chatWebsite":h.tab.channel+"Account"].get({id:h.interaction["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"]}).$promise}).then(function(e){if(h.account=e,h.tab.title=h.account.key||h.account.name,h.interaction.ContactId)return l.cmContact.get({id:h.interaction.ContactId}).$promise}).then(function(e){return e&&(h.contact=e),h.showInteraction=!0,h.contact?h.tab.title+=" - "+(h.user.privacyEnabled?v.mask(h.contact.firstName):h.contact.firstName):h.tab.title+=" - "+r.instant(h.tab.channel.toUpperCase()+".UNKNOWN"),l.user.get({fields:"id,fullname",nolimit:!0}).$promise}).then(function(e){h.users=e||{count:0,rows:[]},h.usersMap=_.mapValues(_.keyBy(h.users.rows,"id"),"fullname")}).then(function(){if(h.tab.channel&&h.interaction)return l.user["add"+_.upperFirst(h.tab.channel)+"Interactions"]({id:h.user.id,ids:[h.interaction.id]})}).then(function(){return l.mailSubstatus.get({sort:"name",nolimit:!0}).$promise}).then(function(e){h.subStatuses=e||{count:0,rows:[]}}).catch(function(){h.showInteraction=!0}).finally(function(){h.contact&&I(),function(){switch(h.user.role){case"admin":return h.downloadPermissions={attachments:!0,interactions:!0};case"agent":return h.downloadPermissions={attachments:h.user.downloadAttachments,interactions:h.user.downloadOmnichannelInteractions};case"user":l.userProfile.get({id:h.user.userProfileId,fields:"downloadAttachments,downloadOmnichannelInteractions"}).$promise.then(function(e){h.downloadPermissions={attachments:e.downloadAttachments,interactions:e.downloadOmnichannelInteractions}}).catch(function(){h.downloadPermissions={attachments:!1,interactions:!1}})}}(),function(){if(!h.tab.spy&&!h.interaction.closed){var t=[],a=_.some(h.messages.rows,["read",!0]);if(h.messages.rows.forEach(function(e){if("in"===e.direction&&!e.read){var n=0===t.length&&!a;t.push(l[h.tab.channel+"Message"].accept({id:e.id,UserId:h.user.id,manual:n}).$promise),h.acceptedMessages.push(e.id)}}),"mail"===h.tab.channel){var e=_(h.interaction.Messages).filter({read:!1,direction:"in"}).differenceBy(h.messages.rows,"id").value();e.forEach(function(e){t.push(l.mailMessage.accept({id:e.id,UserId:h.user.id}).$promise),h.acceptedMessages.push(e.id)})}s.all(t)}}(),y(),m.on(h.tab.channel+"Message:save",h.onMessageSave),m.on(h.tab.channel+"Message:update",h.onMessageSave),m.on(h.tab.channel+"Interaction:save",h.onInteractionSave),m.on(h.tab.channel+"Interaction:update",h.onInteractionSave),m.on("user_has_"+h.tab.channel+"_interactions:save",h.onInteractionOpen),m.on("user_has_"+h.tab.channel+"_interactions:remove",h.onInteractionClose),h.tab.areaText=h.tab.areaText?h.tab.areaText:"",h.showFooter=!0,"mail"===h.tab.channel&&(h.draft=p.getByInteraction(h.tab.interaction.id),h.tab.isDraft&&(h.tab.interaction.closed?(p.removeByInteraction(h.tab.interaction.id),h.draft=null):T()))}))},h.getLabelByMessage=function(e){var n="loading...";if(e)return"in"===e.direction?e.Contact?e.Contact.firstName||"Anonymous":n:e.UserId?h.usersMap?h.usersMap[e.UserId]:n:"System"},h.openContact=function(e,n){try{h.tab&&!h.tab.spy&&a.$parent.$parent.$parent.vm.addContactTab(n||h.contact)}catch(e){d.error({title:"ERROR OPEN CONTACT",msg:"Unable to open the contact"})}},h.openInteraction=function(e){try{if(e.MailAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("mail",e);if(e.ChatWebsiteId)return a.$parent.$parent.$parent.vm.addInteractionTab("chat",e);if(e.SmsAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("sms",e);if(e.WhatsappAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("whatsapp",e);if(e.OpenchannelAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("openchannel",e);if(e.FaxAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("fax",e)}catch(e){d.error({title:"ERROR OPEN INTERACTION",msg:"Customer Journey can't open the interaction"})}},h.disposeInteraction=A,h.tagInteraction=function(){i.show({controller:"TagInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,skipHide:Boolean(h.tab.spy),resolve:{tags:["apiResolver",function(e){return e.resolve("tag@get",{sort:"name",nolimit:!0,fields:"id,name,color"})}]},locals:{channel:h.tab.channel,interaction:h.tab.interaction}})},h.composeMailInteraction=function(n,e){if(e.inReplyTo){var t=_.find(h.messages.rows,{messageId:e.inReplyTo});if(!t)return l.mailMessage.get({messageId:e.inReplyTo}).$promise.then(function(e){E(n,e&&e.count?e.rows[0]:void 0)}).catch(function(e){d.error(e.data?e.data.message:e.toString()),E(n,void 0)});E(n,t)}else E(n,e)},h.composeFaxInteraction=function(e){var n={to:[]};n.to.push(h.contact.fax),i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0}).then(function(e){return l.faxAccount.send({id:h.account.id},e).$promise.then(function(e){d.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})})},h.composeSmsInteraction=function(e,n){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeWhatsappInteraction=function(e,n){i.show({controller:"ComposeWhatsappInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeChatInteraction=function(e,n){i.show({controller:"ComposeChatInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/chat/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeOpenchannelInteraction=function(e,n){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.transferLastMessage=function(){if(h.interaction){var e=_.findLast(h.messages.rows,function(e){return"in"===e.direction});e?i.show({controller:"TransferMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/transfer/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,interaction:h.interaction,message:e,channel:h.tab.channel},resolve:{agents:["apiResolver",function(e){var n={fields:"id,name",$id:{ne:h.user.id},role:"agent",online:!0,sort:"name",nolimit:!0};return n[h.tab.channel+"Pause"]=!1,e.resolve("user@get",n)}],queues:["apiResolver",function(e){return e.resolve(h.tab.channel+"Queue@get",{fields:"id,name",sort:"name",nolimit:!0})}]}}).then(function(e){h.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(h.tab)}):d.error({title:"Invalid transfer",msg:"Message not found!"})}},h.downloadMessage=function(s,e){h.tab.channel&&s.id&&l[h.tab.channel+"Message"].download({id:s.id,attachments:e}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=h.tab.channel+"-message"+s.id+".eml";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.downloadMessage.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.downloadInteraction=function(s,e){h.tab.channel&&s.id&&l[h.tab.channel+"Interaction"].download({id:s.id,attachments:e}).$promise.then(function(e){var n=[e.buffer],t=h.tab.channel+"-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.inteactionMessage.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.openDraft=T,h.createVidaooSession=function(e){var n={id:e.id,account:e.Account,contact:e.Contact};return l.chatInteraction.createVidaooSession(n).$promise.then(function(){d.success({title:"Start Video Call",msg:"Session properly created."})}).catch(function(){d.error({title:"Start Video Call",msg:"Unable to create session!"})})},h.reply=function(e,n){if(e&&13===e.keyCode&&e.shiftKey)return;if(e&&13!==e.keyCode)return;if(""===n.trim())return;S(function(e){var n={},t="chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId";n[t]=h.interaction[t].toString(),n[_.capitalize(h.tab.channel)+"InteractionId"]=h.interaction.id,("sms"===h.tab.channel||"whatsapp"===h.tab.channel)&&(n.phone=h.interaction.phone);e&&(n.UserId=h.user.id,n.ContactId=h.interaction.ContactId,n.body=e);return n}(n.trim()))},h.upload=function(){h.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},h.ngFlow.flow.upload()},h.fileAdded=function(e){if(e.size>b)return d.error({title:"File too big",msg:"The max allowed size is "+f+"MB"}),!1;return!0},h.fileSuccess=function(e,n){var t=JSON.parse(n),a=t.name;"chat"===h.tab.channel&&(a='<a href="'+(h.account.remote?h.account.remote:o.protocol()+"://"+o.host())+"/api/chat/interactions/"+h.interaction.id+"/attachment_download?attachId="+t.id+"&token="+h.account.token+'" target="_self">'+t.name+"</a>");S({body:a,AttachmentId:t.id})},h.onMessageSave=function(e){if(e&&h.interaction.id!=e[_.capitalize(h.tab.channel)+"InteractionId"])return;var n=!1;h.messages?n=_.find(h.messages.rows,{id:e.id}):h.messages={rows:[],count:0};n?_.merge(n,e):("mail"===h.tab.channel?h.messages.rows.unshift(e):h.messages.rows.push(e),y())},h.onInteractionSave=function(e){if(e&&h.interaction.id!==e.id)return;e.closed&&h.interaction.UserId!==h.user.id&&(h.tab.saved=!0);_.merge(h.interaction,e)},h.searchTextChange=function(n){var t=s.defer(),a=[],e={},i="chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId";return e.filter=n,e[i]=h.account.id,l.cannedAnswer.get(e).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},h.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:h.user,account:h.account,interaction:h.interaction,contact:h.interaction&&h.interaction.Contact?h.interaction.Contact:{}};""!==h.tab.areaText&&(h.tab.areaText+=" "),h.tab.areaText+=e(t),h.ctrlMethods.setText(h.tab.areaText)}catch(e){""!==h.tab.areaText&&(h.tab.areaText+=" "),h.tab.areaText+=n.value,h.ctrlMethods.setText(h.tab.areaText)}h.selectedItem=null,h.changeDisplayCannedAnswerInputValue()}},h.getMessagesAlignment=function(e){if(e.secret&&h.user.id!=e.UserId)return"in";switch(h.setting.messagesAlignment){case"left":return"in"==e.direction?e.direction:"out-left-aligned";case"right":return"in"==e.direction?"in-right-aligned":e.direction;default:return e.direction}},h.displayCannedAnswerInput=!1,h.changeDisplayCannedAnswerInputValue=function(){h.displayCannedAnswerInput=!h.displayCannedAnswerInput},h.setAs=function(e){h.tab.channel&&h.interaction&&h.interaction.id&&l[h.tab.channel+"Interaction"].update({id:h.interaction.id,substatus:e}).$promise.catch(function(e){d.error(e.data?e.data.message:e.toString())})},h.markAsUnread=function(){if(h.tab.channel&&h.interaction&&h.interaction.id)if(h.acceptedMessages.length)for(var e=0;e<h.acceptedMessages.length;e+=1)l[h.tab.channel+"Message"].update({id:h.acceptedMessages[e],read:!1,UserId:null});else for(var n=0;n<h.messages.rows.length;n+=1)if("in"===h.messages.rows[n].direction){h.messages.rows[n].UserId===h.user.id?l[h.tab.channel+"Message"].update({id:h.messages.rows[n].id,read:!1,UserId:null}):d.error({title:"You can't mark as unread",msg:"You are not the owner of the last message!"});break}h.tab.saved=!0,a.$parent.$parent.$parent.vm.closeTab(h.tab)},h.getAttachments=function(n){return l.attachment.get({MailMessageId:n.id}).$promise.then(function(e){e&&e.rows&&(n.attachments=e.rows)}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},h.getAttachment=function(i){return l.attachment.download({id:i.id}).$promise.then(function(e){if(e){var n=new Blob([e.buffer],{type:e.type}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.href=a,t.target="_self",t.download=i.name,document.body.appendChild(t),t.click(),setTimeout(function(){document.body.removeChild(t),window.URL.revokeObjectURL(a)},100)}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},h.htmlToPlaintext=function(e){return e?String(e).replace(/<[^>]+>/gm,""):""},h.onInteractionOpen=function(e){var n;h.interaction.id==e[_.upperFirst(h.tab.channel)+"InteractionId"]&&(h.interaction.Users&&(n=_.find(h.interaction.Users,{id:e.UserId})),n||h.interaction.Users.push({id:e.UserId}))},h.onInteractionClose=function(e){h.interaction.id==e[_.upperFirst(h.tab.channel)+"InteractionId"]&&h.interaction.Users&&_.remove(h.interaction.Users,{id:e.UserId})},h.getCustomerJourney=I,h.loadNextPage=function(){var t=s.defer();if(h.queryMessage)return h.queryMessage.offset=h.messages.rows.length,l[h.tab.channel+"Interaction"].getMessages(h.queryMessage).$promise.then(function(e){for(var n=0;n<e.rows.length;n+=1)h.messages.rows.push(e.rows[n]),h.interaction.closed||"in"!==e.rows[n].direction||e.rows[n].read||(l[h.tab.channel+"Message"].accept({id:e.rows[n].id,UserId:h.user.id}),h.acceptedMessages.push(e.rows[n].id));return 0<e.rows.length&&(h.BTNLoadMore=h.BTNLoadMore-e.rows.length),t.resolve(e)}).catch(function(e){return t.reject(e)});return t.reject()},h.interactionTimelineOptions={scrollEl:"#interaction-content"},h.loadMoreJourney=function(){return s(function(e){var n=h.journey.length;return e(I(n))})},h.journeyTimelineOptions={scrollEl:"#journey-content"},a.$on("$destroy",function(){m.removeAllListeners(h.tab.channel+"Message:save"),m.removeAllListeners(h.tab.channel+"Message:update"),m.removeAllListeners(h.tab.channel+"Interaction:save"),m.removeAllListeners(h.tab.channel+"Interaction:update"),m.removeAllListeners("user_has_"+h.tab.channel+"_interactions:save"),m.removeAllListeners("user_has_"+h.tab.channel+"_interactions:remove")})}function n(a){return{scope:{ngBindHtmlUnsafe:"="},template:"<div ng-bind-html='trustedHtml'></div>",link:function(t){t.updateView=function(){var e,n=_.replace(t.ngBindHtmlUnsafe,'<div id="xm-mail-content"','<a style="cursor:pointer" class="toggle-details md-accent-color" onclick="document.getElementById(\''+(e="xm-mail-content-"+Math.floor(9999*Math.random()+1))+"').style.display='block'; this.parentNode.removeChild(this)\">See More</a><div id=\""+e+'" style="display:none"');t.trustedHtml=a.trustAsHtml(n)},t.$watch("ngBindHtmlUnsafe",function(e){t.updateView(e)})}}}e.$inject=["$cookies","$timeout","$document","$scope","$mdDialog","$q","$location","$translate","api","toasty","Auth","socket","msUtils","draftManager","customerJourneyManager","privacyManager"],n.$inject=["$sce"],angular.module("app.dashboards").directive("ngBindHtmlUnsafe",n).controller("AgentGeneralInteractionController",e)}(),function(){"use strict";angular.module("app.dashboards").factory("Emojis",function(){return{watchEmbedData:!1,sanitizeHtml:!1,fontSmiley:!1,emoji:!0,link:!0,linkTarget:"_blank",pdf:{embed:!0},image:{embed:!0},audio:{embed:!0},basicVideo:!1,gdevAuth:"xxxxxxxx",video:{embed:!1,width:null,height:null,ytTheme:"dark",details:!1,thumbnailQuality:"medium",autoPlay:!0},twitchtvEmbed:!0,dailymotionEmbed:!0,tedEmbed:!0,dotsubEmbed:!0,liveleakEmbed:!0,ustreamEmbed:!0,soundCloudEmbed:!0,soundCloudOptions:{height:160,themeColor:"f50000",autoPlay:!1,hideRelated:!1,showComments:!0,showUser:!0,showReposts:!1,visual:!1,download:!1},spotifyEmbed:!0,tweetEmbed:!0,tweetOptions:{maxWidth:550,hideMedia:!1,hideThread:!1,align:"none",lang:"en"},code:{highlight:!0,lineNumbers:!1},codepenEmbed:!0,codepenHeight:300,jsfiddleEmbed:!0,jsfiddleHeight:300,jsbinEmbed:!0,jsbinHeight:300,plunkerEmbed:!0,githubgistEmbed:!0,ideoneEmbed:!0,ideoneHeight:300}})}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,ChatAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeChatInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this,m=25,u=1024*m*1024;c.separatorKeys=[a.KEY_CODE.ENTER,a.KEY_CODE.COMMA,a.KEY_CODE.TAB],c.message={from:i.localstationid,to:_.isNil(s.to)||_.isEmpty(s.to)?[]:s.to,attachments:[]},c.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:u,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},c.ngFlow={flow:{}},c.send=function(e){1===c.message.attachments.length?c.message.to.length?(s.draft=void 0,t.hide({from:c.message.from,to:c.message.to,attach:c.message.attachments.length,attachments:c.message.attachments})):l.error("To is mandatory"):l.error("Attachment is mandatory")},c.upload=function(){c.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},c.ngFlow.flow.upload()},c.fileSuccess=function(e,n){try{(n=JSON.parse(n)).size=e.size,c.message.attachments.push(n)}catch(e){console.error(e)}},c.fileAdded=function(e){var n=["pdf","tif"];if(!_.includes(n,e.getExtension()))return l.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extensions: "+n.join()}),!1;if(e.size>u)return l.error({title:"File too big",msg:"The max allowed size is "+m+"MB"}),!1;return!0},c.getContact=function(e){var n="";e.firstName&&e.firstName!==e.fax&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.fax&&(n+=e.lastName+" ");return n+="<"+e.fax+">"},c.contactSearch=function(e){return i&&i.ListId?r.cmContact.get({ListId:i.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,fax"}).$promise.then(function(e){return e.rows}):[]},c.transformContact=function(e){var n=e;if(_.isObject(e))return e.fax;if(t=n,!/[&\/\\#,()$~%.'":;*?<>{}\s\\|a-zA-Z\pS!òàùè…_§°çéì-]/.test(t))return n;var t;return l.error("Fax "+n+" is not valid"),null},c.closeDialog=function(){s.draft=c.message,t.cancel()}}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q"],angular.module("app.dashboards").controller("ComposeFaxInteractionDialogController",e)}(),function(){"use strict";function e(n,e,i,t,a,s,o,r,l,d,c,m,u,p){var g=this,v=25,h=1024*v*1024;g.currentUser=m.getCurrentUser(),g.secret="note"===r,g.hiddenCC=!0,g.hiddenBCC=!0,g.verifySmtp=!0,g.errors=[],g.separatorKeys=[t.KEY_CODE.ENTER,t.KEY_CODE.COMMA,t.KEY_CODE.TAB],g.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,MailAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},g.selectedItemChange=function(n){if(n&&n.value&&g.ckEditorInstance)try{var e=_.template(n.value),t={user:g.currentUser,account:s,interaction:u,contact:u&&u.Contact?u.Contact:{}},a=e(t),i=a.replace(/(?:\r\n|\r|\n)/g,"<br />");g.ckEditorInstance.insertHtml(i)}catch(e){console.error(e),g.ckEditorInstance.insertHtml(n.value)}document.getElementById("html-area").focus(),g.selectedItem=null},g.onReadyEditor=function(e){try{g.ckEditorInstance=CKEDITOR.instances["html-area"]}catch(e){console.error("Unable to get Html Editor instance",e)}},_.templateSettings.interpolate=/{{([\s\S]+?)}}/g,g.fromTemplate=_.template("{{ name }} <{{ email }}>"),g.replyTemplate=_.template("On {{ date }}, at {{ time }}, {{ from }} wrote:"),g.forwardTemplate=_.template("Begin forwarded message:<br><br><strong>From:</strong> {{ from }}<br><strong>Subject:</strong> {{ subject }}<br><strong>Date:</strong> {{ date }}, at {{ time }}<br><strong>To:</strong> {{ to }}"),g.message={from:g.fromTemplate({name:s.name,email:s.email||s.Smtp.user}),to:[],cc:[],bcc:[],body:S(),type:r,attachments:[],showLastMessage:!0},g.draft=null,g.ckeditor={skin:"office2013",startupFocus:!0,language:"en",allowedContent:!0,extraPlugins:"font,colorbutton,autogrow,autoembed,autocorrect,googlethisterm,pastebase64",toolbarGroups:[{name:"styles",groups:["styles"]},{name:"clipboard",groups:["undo"]},{name:"colors",groups:["colors"]},{name:"basicstyles",groups:["basicstyles"]},{name:"paragraph",groups:["list","indent","align"]}],autoGrow_onStartup:!0,autoGrow_minHeight:g.secret?160:300,autoGrow_maxHeight:e.innerHeight-400,autocorrect_enabled:!0,disableNativeSpellChecker:!1,enterMode:CKEDITOR.ENTER_BR,font_defaultLabel:s.fontFamily?s.fontFamily.split(",")[0]:"Arial",fontSize_defaultLabel:s.fontSize||"12",removePlugins:"magicline"};for(var f=[],b=8;b<=72;b++)f.push(b+"/"+b+"pt");g.ckeditor.fontSize_sizes=f.join(";"),g.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:h,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},g.ngFlow={flow:{}},g.reply=function(e){angular.isDefined(o)&&(g.message.type="reply",g.message.to="in"===o.direction?o.from.split(","):o.to.split(","),g.message.subject=_.startsWith(o.subject,"Re:")?o.subject:"Re: "+o.subject,g.message.inReplyTo=o.messageId,g.message.body=S(),g.message.attachments=[],e&&o.cc&&(g.hiddenCC=!1,g.message.cc=o.cc.split(",")),g.message.showLastMessage=!1)},g.newMail=function(){angular.isDefined(o)&&(g.message.type="new",g.message.to=o.to?o.to.split(","):[])},g.forward=function(){if(angular.isDefined(o)){if(g.message.type="forward",g.message.subject=_.startsWith(o.subject,"Fwd:")?o.subject:"Fwd: "+o.subject,g.message.body=S(),o.Attachments&&o.Attachments.length)for(var e=0;e<o.Attachments.length;e++)g.message.attachments.push(o.Attachments[e]);g.message.showLastMessage=!1}},g.editDraft=function(){g.isDraft=!0,angular.isDefined(o)&&(o.savedAsDraft=!1,g.message=angular.copy(o),_.isEmpty(g.message.cc)||(g.hiddenCC=!1),_.isEmpty(g.message.bcc)||(g.hiddenBCC=!1))},g.send=function(e,n,t){if(!A&&g.message.to&&(g.message.body||o.from))if(g.message.to.length)if(_.isEmpty(g.message.subject)){var a=i.confirm({skipHide:!0}).title("Warning").textContent("This message has no subject. Are you sure you want to send it?").ariaLabel("Warning").targetEvent(e).ok("Send Anyway").cancel("Cancel");i.show(a).then(function(){E(n,t)})}else E(n,t);else d.error("To is mandatory");A=!1},g.note=function(){g.type="note",g.secret=!0,g.message.body='<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'pt"><p></p></div>'},g.addNote=function(){g.message.body&&i.hide({secret:!0,body:g.message.body,attach:g.message.attachments.length,attachments:g.message.attachments})},g.upload=function(e){g.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+n.get("motion.token")},g.ngFlow.flow.upload()},g.fileSuccess=function(e,n){try{(n=JSON.parse(n)).size=e.size,g.message.attachments.push(n)}catch(e){console.error(e)}},g.removeAttachment=function(e){g.message.attachments=_.reject(g.message.attachments,{id:e.id}),e.MailMessageId||l.attachment.delete({id:e.id}).$promise.catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.attachment.delete",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.fileAdded=function(e){if(e.size>h)return d.error({title:"File too big",msg:"The max allowed size is "+v+"MB"}),!1;return!0},g.getContact=function(e){var n="";e.firstName&&e.firstName!==e.email&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.email&&(n+=e.lastName+" ");return n+="<"+e.email+">"},g.contactSearch=function(e){return s&&s.ListId?l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,email"}).$promise.then(function(e){return e.rows}):[]},g.transformContact=function(e,n){if(_.isObject(e))return(g.contact=e).email;if(_.isString(e)){if(y(e))return g.contact={email:e},e;for(var t=e.split(","),a=0;a<t.length;a+=1)y(t[a])?_.isArray(n)&&_.indexOf(n,t[a])<0&&n.push(t[a]):d.error("Email "+t[a]+" is not valid");return g.contact={email:e.split(",")[0]},null}return d.error("Email field is not valid"),null},g.saveDraft=function(){g.message.savedAsDraft=!0,g.draft=p.getByInteraction(u.id);var e={account:s,message:g.message,contact:g.contact,interaction:u};if(g.draft&&!g.isDraft){var n=i.confirm({skipHide:!0}).title(a.instant("DASHBOARDS.DRAFT_SAVE_WARNING_TITLE")).content(a.instant("DASHBOARDS.DRAFT_SAVE_WARNING_MESSAGE")).ariaLabel("Save draft").ok(a.instant("DASHBOARDS.OVERWRITE")).cancel(a.instant("DASHBOARDS.CANCEL"));i.show(n).then(function(){i.hide(e)})}else i.hide(e)},g.closeDialog=function(){i.cancel()},g.loadLastMessage=function(){g.message.body+=T(g.message.type)};var A=!(g.keyPress=function(e){13===e.keyCode&&(A=!0)});switch(r){case"reply":g.reply(!1);break;case"replyAll":g.reply(!0);break;case"forward":g.forward();break;case"draft":g.editDraft();break;case"new":g.newMail();break;case"note":g.note()}function E(e,n){var t={from:g.message.from,to:g.message.to.join(","),cc:g.message.cc.join(","),bcc:g.message.bcc.join(","),subject:g.message.subject,body:g.message.showLastMessage?g.message.body:g.message.body+T(g.message.type),inReplyTo:g.message.inReplyTo,attach:g.message.attachments.length,attachments:g.message.attachments,Interaction:{lastMsgDirection:"out",substatus:n},isDraft:g.isDraft};t.html='<div id="xm-mail-content">'+_.replace(t.body,'<div id="xm-mail-content"',"<div")+"</div>",e&&(t.Interaction.closed=!0),i.hide(t)}function y(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function S(){return'<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'pt">'+function(){if(_.isNil(s.template))return"";try{return _.template(s.template)({user:g.currentUser,account:s,interaction:u,contact:u&&u.Contact?u.Contact:{}})}catch(e){return console.error(e),""}}()+"</div>"}function T(e){var n='<div id="xm-mail-content"><blockquote type="cite">';switch(e){case"reply":case"replyAll":n+=g.replyTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||""});break;case"forward":n+=g.forwardTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||"",to:_.escape(o.to)||"",subject:_.escape(o.subject)||""})}var t,a,i=g.message.showLastMessage&&o.originalMessage||g.isDraft?o.originalMessage.body:o.body;return n+="<br><br>",n+=(t=i?_.replace(i,'<div id="xm-mail-content"',"<div"):"",(a=t.match(/\<body[^>]*\>([^]*)\<\/body/m))?a[1]:t),n+="</blockquote></div>",e?n:""}l.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){g.subStatuses=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}),g.secret||l.mailAccount.verifySmtp({id:s.id}).$promise.catch(function(e){g.verifySmtp=!1,g.errors.push({message:e.data,type:e.status}),g.errors.push({message:"You can't reply or send an email. Please contact the administrator!",type:"500"})})}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","$translate","account","message","type","api","toasty","$q","Auth","interaction","draftManager"],angular.module("app.dashboards").controller("ComposeMailInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,OpenchannelAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=""===p.message.body.trim()?e(t):" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=""===p.message.body.trim()?n.value:" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e[s.mapKey]&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e[s.mapKey]&&(n+=e.lastName+" ");return n+="<"+e[s.mapKey]+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId){var n="firstName,lastName,phone,mobile";return s.mapKey&&(n+=","+s.mapKey),l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:n}).$promise.then(function(e){return e.rows})}return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e[s.mapKey];return n},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeOpenchannelInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,SmsAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=""===p.message.body.trim()?e(t):" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=""===p.message.body.trim()?n.value:" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeSmsInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,WhatsappAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=""===p.message.body.trim()?e(t):" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=""===p.message.body.trim()?n.value:" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeWhatsappInteractionDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.errors=[],r.dispositions=[],r.interaction=angular.copy(e),r.interaction.disposition||(r.interaction.disposition=null),r.channel=i,r.apiRoute=r.channel+"Interaction",r.apiAccountRoute=r.channel+("chat"===r.channel?"Website":"Account"),r.accountProperty=_.capitalize(r.channel)+("chat"===r.channel?"Website":"Account")+"Id",r.firstLevelDisposition=null,r.mandatoryDisposition=!1,r.mandatoryDispositionPause="",r.wasUserInPause=s.voicePause||s.chatPause||s.mailPause||s.openchannelPause||s.faxPause,r.onInit=function(){var n=[],t={fields:"id,name,level,ParentId",sort:"name",nolimit:!0};t[r.accountProperty]=e[r.accountProperty],a[r.apiAccountRoute].get({id:e[r.accountProperty]}).$promise.then(function(e){return r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name),a.disposition.get(t).$promise}).then(function(e){return e.rows.length&&(n=_.concat(n,e.rows)),a.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise}).then(function(e){e.rows.length&&(n=_.concat(n,e.rows))}).catch(function(e){console.error(e)}).finally(function(){r.dispositions=_.orderBy(n,["name"],["asc"]),r.mandatoryDisposition&&!r.wasUserInPause&&a.user.pause({id:s.id,type:r.mandatoryDispositionPause||"DEFAULT PAUSE"}).$promise.then(function(e){}).catch(function(e){console.error(e)})})},r.onDispositionChange=function(e){"first"===e?(r.anySecondLevelDisposition=!!r.firstLevelDisposition&&_.some(r.dispositions,["ParentId",r.firstLevelDisposition.id]),r.firstLevelDisposition||(r.secondLevelDisposition=void 0)):"second"===e&&(r.anyThirdLevelDisposition=_.some(r.dispositions,["ParentId",r.secondLevelDisposition.id]))},r.clearDispositionSelection=function(e){"second"===e?(r.secondLevelDisposition=void 0,r.thirdLevelDisposition=void 0):"third"===e&&(r.thirdLevelDisposition=void 0)},r.saveDisposition=function(){r.errors=[],r.interaction.UserId=s.id,r.interaction.closed=!0,r.interaction.closeReason="agent",r.interaction.disposition=r.firstLevelDisposition?r.firstLevelDisposition.name:null,r.interaction.secondDisposition=r.secondLevelDisposition?r.secondLevelDisposition.name:void 0,r.interaction.thirdDisposition=r.thirdLevelDisposition?r.thirdLevelDisposition.name:void 0,a[r.apiRoute]?a[r.apiRoute].update(_.pick(r.interaction,["MailAccountId","FaxAccountId","SmsAccountId","WhatsappAccountId","ChatWebsiteId","OpenchannelAccountId","closed","closeReason","disposition","secondDisposition","thirdDisposition","id","note","UserId"])).$promise.then(function(e){r.interaction=e,"mail"===r.channel&&o.removeByInteraction(r.interaction.id),t.success({title:"Interaction properly closed!",msg:"Interaction has been closed!"})}).then(function(){l(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.variable.update"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})}):l(!1)},r.closeDialog=l}e.$inject=["$mdDialog","toasty","api","interaction","channel","user","draftManager"],angular.module("app.dashboards").controller("DisposeInteractionDialogController",e)}(),function(){"use strict";function e(n,t,e,a,i,s){var o=this;function r(e){n.hide(e)}o.errors=[],o.tags=s,o.interaction=angular.copy(a),o.interaction.Tags=_.map(o.interaction.Tags,function(e){return{id:e.id,name:e.name,color:e.color}}),o.channel=i,o.autocompleteRequireMatch=!0,o.saveTag=function(){{if(o.errors=[],e[o.apiRoute])return e[o.apiRoute].addTags({id:o.interaction.id,ids:_.map(o.interaction.Tags,"id")}).$promise.then(function(){t.success({title:"Interaction properly tagged!",msg:"Interaction has been tagged!"}),a.Tags=o.interaction.Tags,r(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})});r(!1)}},o.closeDialog=r,o.apiRoute=o.channel+"Interaction"}e.$inject=["$mdDialog","toasty","api","interaction","channel","tags"],angular.module("app.dashboards").controller("TagInteractionDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l,d){var c=this;function m(e){n.hide(e)}c.channel=s.toLowerCase(),c.message=o,c.account=r,c.agents=l,c.queues=d,c.transfer={id:0,type:c.account.queueTransfer?"queue":"agent"},c.onTransfer=function(){m(!0),e(function(){var e="agent"===c.transfer.type?"agentNotify":c.channel+"QueueNotify";return a.rpc[e]({id:c.transfer.id,messageId:c.message.id,channel:c.channel}).$promise.then(function(){i.success({title:t.instant("DASHBOARDS.INFO"),msg:"queue"===c.transfer.type?t.instant("DASHBOARDS.NOTIFICATIONS.TRANSFER_QUEUE_EXECUTED"):t.instant("DASHBOARDS.NOTIFICATIONS.TRANSFER_AGENT_EXECUTED")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.rpc.notify"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.rpc.notify",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},5e3)},c.closeDialog=m}e.$inject=["$mdDialog","$timeout","$translate","api","toasty","channel","message","account","agents","queues"],angular.module("app.dashboards").controller("TransferMessageDialogController",e)}(),function(){"use strict";function e(i,m,s,e,u,o,r,t,n,a,l){var p=this;function d(){try{i.$parent.$parent.$parent.vm.updateLocalStorage()}catch(e){o.error({title:"ERROR UPDATE LOCAL TABS",msg:"Error updating locally stored tabs"})}}function c(t,e){var n,a,l=[],d=[],c=r.getCurrentUser();(n=c,a=m.defer(),p.project.sendUnpauseOnSubmit?u.user.unpause({id:n.id}).$promise.then(function(e){a.resolve()}).catch(function(e){console.log("err"),a.resolve()}):a.resolve(),a.promise).then(function(){return u.jscriptySessionReport.save({starttime:p.starttime,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,VoiceQueueId:p.call&&p.call["xmd-voicequeueid"]?p.call["xmd-voicequeueid"]:void 0,ProjectId:p.project&&p.project.id?p.project.id:void 0,projectname:p.project&&p.project.name?p.project.name:void 0,ContactId:p.contact&&p.contact.id?p.contact.id:void 0,completed:e}).$promise}).then(function(e){if(e)for(var n=p.getResponseSheetHeaders(),t=p.getResponseSheetRow(),a=p.getQuestionWithResponseList(),i=0;i<n.length;i+=1)if(!_.isEmpty(String(t[i]))){try{l.push(u.jscriptyQuestionReport.save({question:n[i],answer:"date"===a[i].type?moment(String(t[i])).format("YYYY-MM-DD"):"time"===a[i].type?moment(String(t[i])).format("HH:mm"):String(t[i]),questionId:a[i].id,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,SessionId:e.id,ProjectId:p.project.id,projectname:p.project.name}))}catch(e){console.error("Unable to convert question",e)}for(var s=String(t[i]).split(";"),o=0;o<s.length;o+=1){var r=s[o].trim();try{d.push(u.jscriptyAnswerReport.save({question:n[i],questionId:a[i].id,answer:"date"===a[i].type?moment(r).format("YYYY-MM-DD"):"time"===a[i].type?moment(r).format("HH:mm"):r,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,SessionId:e.id,ProjectId:p.project.id,projectname:p.project.name}))}catch(e){console.error("Unable to convert answer",e)}}}return m.all(l).then(function(){return m.all(d).then(function(){return e})})}).then(function(e){e?t.resolve(!0):t.reject()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()});t.reject()})}p.formViewer={},p.showResetButton=!0,p.showIncompleteSubmitButton=!1,p.detectBrowser=l.detectBrowser(),p.onSubmit=function(e,n){var t=m.defer();if(n){var a=s.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("YES").cancel("NO");s.show(a).then(function(){c(t,!1)},function(){t.resolve()})}else c(t,!0);return t.promise.then(function(e){e&&(o.success({title:"Session saved",msg:"Your survey session has been properly saved!"}),function(e){try{i.$parent.$parent.$parent.vm.removeTab(e)}catch(e){o.error({title:"ERROR REMOVE TAB",msg:"Error while removing tab"})}}(p.tab))}).catch(function(e){o.error({title:"Session save error",msg:"There has been an error while trying to save your survey session!"})})},p.openContact=function(e,n){try{i.$parent.$parent.$parent.vm.addContactTab(n)}catch(e){o.error({title:"ERROR OPEN CONTACT",msg:"Jscripty can't open the contact"})}},p.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0},p.getResponseSheet=function(){return e.getResponseSheet(p.project.formData,p.project.responseData,!1)},p.getResponseSheetRow=function(){return e.getResponseSheetRow(p.project.formData,p.project.responseData)},p.getResponseSheetHeaders=function(){return e.getResponseSheetHeaders(p.project.formData,!1)},p.getQuestionWithResponseList=function(){return e.getQuestionWithResponseList(p.project.formData,p.project.responseData)},p.init=function(e){p.tab=e,p.tab&&(p.call=p.tab.call,p.starttime=p.tab.openedAt,p.contact=p.tab.contact,p.project=p.tab.project,p.project&&(_.isObjectLike(p.project.formData)?p.project.formData=p.project.formData:p.isJsonString(p.project.formData)?p.project.formData=JSON.parse(p.project.formData):p.project.formData=void 0,p.project.responseData=p.project.responseData||{},void 0!==p.project.currentPage&&a(function(){n.$broadcast("mwForm.pageEvents.changePage",{page:p.project.currentPage})}),i.$on("mwForm.pageEvents.pageCurrentChanged",function(e,n){if(n.currentPage&&(p.project.currentPage=n.currentPage.number-1,d(),p.project.enableUncompleteSave&&(1<=n.currentPage.number&&n.currentPage.number<p.project.formData.pages.length?p.showIncompleteSubmitButton=!0:p.showIncompleteSubmitButton=!1),p.project.formData&&p.project.formData.pages))for(var t=0,a=p.project.formData.pages.length;t<a;t++)if(n.currentPage.number<t+1&&p.project.formData.pages[t].elements)for(var i=0,s=p.project.formData.pages[t].elements.length;i<s;i++)"question"===p.project.formData.pages[t].elements[i].type&&p.project.formData.pages[t].elements[i].question&&delete p.project.responseData[p.project.formData.pages[t].elements[i].question.id]})))},p.resetViewer=function(e){if(p.formViewer.reset){var n=s.confirm().title(t.instant("JSCRIPTY.DO_YOU_WANT_TO_RESET_SESSION")).content(t.instant("JSCRIPTY.ALL_SURVEY_DATA_WILL_BE_LOST")).textContent("").ariaLabel("survey").targetEvent(e).ok(t.instant("JSCRIPTY.YES")).cancel(t.instant("JSCRIPTY.NO"));s.show(n).then(function(){p.showIncompleteSubmitButton=!1,p.project.currentPage=void 0,d(),p.formViewer.reset()})}}}e.$inject=["$scope","$q","$mdDialog","mwFormResponseUtils","api","toasty","Auth","$translate","$rootScope","$timeout","msUtils"],angular.module("app.dashboards").controller("AgentGeneralJscriptyController",e)}(),function(){"use strict";function e(t,a,e,n,i){var s=this;function o(){return function(e){if(404===e.status)a.info({title:t.instant("DASHBOARDS.ATTENTION"),msg:t.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){s.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}s.notification=e,s.user=i.getCurrentUser(),s.accept=function(e){{if(n[s.notification.channel+"Message"])return n[s.notification.channel+"Message"].accept({id:s.notification.id,UserId:s.user.id,manual:!0}).$promise.then(function(e){a.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(o());a.error({title:"API:ERROR",msg:"API accept message not found: "+s.notification.channel+"Message"})}},s.reject=function(e){{if(n[s.notification.channel+"Message"])return n[s.notification.channel+"Message"].reject({id:s.notification.id,UserId:s.user.id}).$promise.then(function(e){a.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(o());a.error({title:"API:ERROR",msg:"API reject message not found: "+s.notification.channel+"Message"})}}}e.$inject=["$translate","toasty","notification","api","Auth"],angular.module("app.dashboards").controller("NotificationController",e)}(),function(){"use strict";angular.module("app.dashboards").controller("AgentGeneralPopupController",function(){var n=this;n.init=function(e){n.tab=e,n.tab&&(n.tab.saved=!0,n.html=n.tab.html)}})}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&"abandoned"===e.disposition?(i.inbound.abandoned+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&!e.UserId&&e.disposition?(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.chatWebsites,{id:_.toNumber(e.ChatWebsiteId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.chatWebsites=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveChatInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateChatInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("chatInteraction:save",i.onSaveChatInteraction),n.on("chatInteraction:update",i.onUpdateChatInteraction),function(){if(0<Object.keys(i.chatWebsites).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("chatInteraction:save"),n.removeAllListeners("chatInteraction:update")})}e.$inject=["$scope","socket","chatInteractions","chatWebsites"],angular.module("app.dashboards").controller("UserChatDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r){var l=this;function d(){s({queues:l.outboundQueues,rpcQueues:l.rpcQueues}).then(function(e){l.inbound=e})}function c(){o({rpcCampaigns:l.rpcCampaigns}).then(function(e){l.ivr=e})}l.outboundQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},l.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},l.rpcCampaigns=r?_.keyBy(r.rows?r.rows:[],"id"):{},l.ivr={originated:0,limitCalls:0},l.inbound={waiting:0,talking:0,pTalking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0,outboundDropCallsDayCallersExit:0,outboundDropCallsDayTimeout:0},l.onSaveQueue=function(e){l.outboundQueues[e.id]&&l.rpcQueues[e.id]&&(l.rpcQueues[e.id]=e)},l.onSaveCampaign=function(e){l.rpcCampaigns[e.id]&&(l.rpcCampaigns[e.id]=e)},t.onWithoutApply("voice_queue:save",l.onSaveQueue),l.interval=n(function(){d(),c()},999),t.onWithoutApply("campaign:save",l.onSaveCampaign),d(),c(),e.$on("$destroy",function(){t.removeListener("voice_queue:save",l.onSaveQueue),t.removeAllListeners("campaign:save"),l.interval&&n.cancel(l.interval)})}e.$inject=["$scope","$interval","socket","outboundQueues","rpcQueues","initializeRealtimeQueue","initializeRealtimeCampaign","rpcCampaigns"],angular.module("app.dashboards").controller("UserVoiceDashboardDialerController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.faxAccounts,{id:_.toNumber(e.FaxAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.faxAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveFaxInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateFaxInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("faxInteraction:save",i.onSaveFaxInteraction),n.on("faxInteraction:update",i.onUpdateFaxInteraction),function(){if(0<Object.keys(i.faxAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("faxInteraction:save"),n.removeAllListeners("faxInteraction:update")})}e.$inject=["$scope","socket","faxInteractions","faxAccounts"],angular.module("app.dashboards").controller("UserFaxDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.mailAccounts,{id:_.toNumber(e.MailAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.mailAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveMailInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateMailInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("mailInteraction:save",i.onSaveMailInteraction),n.on("mailInteraction:update",i.onUpdateMailInteraction),function(){if(0<Object.keys(i.mailAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("mailInteraction:save"),n.removeAllListeners("mailInteraction:update")})}e.$inject=["$scope","socket","mailInteractions","mailAccounts"],angular.module("app.dashboards").controller("UserMailDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.openchannelAccounts,{id:_.toNumber(e.OpenchannelAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.openchannelAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveOpenchannelInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateOpenchannelInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("openchannelInteraction:save",i.onSaveOpenchannelInteraction),n.on("openchannelInteraction:update",i.onUpdateOpenchannelInteraction),function(){if(0<Object.keys(i.openchannelAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("openchannelInteraction:save"),n.removeAllListeners("openchannelInteraction:update")})}e.$inject=["$scope","socket","openchannelInteractions","openchannelAccounts"],angular.module("app.dashboards").controller("UserOpenchannelDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.smsAccounts,{id:_.toNumber(e.SmsAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.smsAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveSmsInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateSmsInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("smsInteraction:save",i.onSaveSmsInteraction),n.on("smsInteraction:update",i.onUpdateSmsInteraction),function(){if(0<Object.keys(i.smsAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("smsInteraction:save"),n.removeAllListeners("smsInteraction:update")})}e.$inject=["$scope","socket","smsInteractions","smsAccounts"],angular.module("app.dashboards").controller("UserSmsDashboardGeneralController",e)}(),function(){"use strict";function e(t){var i=[],s=function(){var t=i[0],a={waiting:0,talking:0,pTalking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0,originated:0,outboundDropCallsDayCallersExit:0,outboundDropCallsDayTimeout:0};_.forIn(t.queues,function(e,n){t.rpcQueues[n]&&(a.waiting+=t.rpcQueues[n].waiting||0,a.talking+=(t.rpcQueues[n].talking||0)+(t.rpcQueues[n].pTalking||0),a.answered+=t.rpcQueues[n].answered||0,a.abandoned+=t.rpcQueues[n].abandoned||0,a.sumHoldTime+=t.rpcQueues[n].sumHoldTime||0,a.sumBillable+=t.rpcQueues[n].sumBillable||0,a.total+=t.rpcQueues[n].total||0,a.originated+=t.rpcQueues[n].originated||0,a.outboundDropCallsDayCallersExit+=t.rpcQueues[n].outboundDropCallsDayCallersExit||0,a.outboundDropCallsDayTimeout+=t.rpcQueues[n].outboundDropCallsDayTimeout||0)});var e=a.total-a.answered-a.abandoned;a.unmanaged=0<e?e:0,a.avgHoldTime=Math.round(0<a.total?a.sumHoldTime/a.total:0),a.avgHoldTime=new Date(1e3*a.avgHoldTime).toISOString().substr(11,8),a.avgTalkTime=Math.round(0<a.answered?a.sumBillable/a.answered:0),a.avgTalkTime=new Date(1e3*a.avgTalkTime).toISOString().substr(11,8),a.answerRate=Math.round((0<a.total?a.answered/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.abandonRate=Math.round((0<a.total?a.abandoned/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundDropRate=Math.round((0<a.total?a.outboundDropCallsDayTimeout/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundAbandonRate=Math.round((0<a.total?a.outboundDropCallsDayCallersExit/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundanswerRate=0<100-a.outboundDropRate-a.outboundAbandonRate&&a.total?100-a.outboundDropRate-a.outboundAbandonRate:0,i.shift(),t.defer.resolve(a),0<i.length&&s()};return function(e){var n=t.defer();return i.push({queues:e.queues,rpcQueues:e.rpcQueues,defer:n}),1===i.length&&s(),n.promise}}function n(t){var i=[],s=function(){var t=i[0],a={originated:0,limitCalls:0};_.forIn(t.rpcCampaigns,function(e,n){t.rpcCampaigns[n]&&(a.originated+=t.rpcCampaigns[n].originated||0,a.limitCalls+=t.rpcCampaigns[n].limitCalls||0)}),i.shift(),t.defer.resolve(a),0<i.length&&s()};return function(e){var n=t.defer();return i.push({rpcCampaigns:e.rpcCampaigns,defer:n}),1===i.length&&s(),n.promise}}function t(t,a,e){var i=this;i.license=e,i.onInit=function(){if(i.hasDashboardPermissions=!a.hasRole("user")||a.hasPermission(101),i.hasDashboardPermissions){var e=t.current.name;switch(e){case"app.dashboards.general":n=[],i.license.voice&&n.push("app.dashboards.general.voice"),i.license.dialer&&n.push("app.dashboards.general.dialer"),i.license.chat&&n.push("app.dashboards.general.chat"),i.license.mail&&n.push("app.dashboards.general.mail"),i.license.messaging&&n.push("app.dashboards.general.sms"),i.license.openchannel&&n.push("app.dashboards.general.openchannel"),i.license.fax&&n.push("app.dashboards.general.fax"),i.license.whatsapp&&n.push("app.dashboards.general.whatsapp"),0<n.length&&t.go(_.first(n));break;case"app.dashboards.general.voice":i.selectedTab=0;break;case"app.dashboards.general.dialer":i.selectedTab=1;break;case"app.dashboards.general.chat":i.selectedTab=2;break;case"app.dashboards.general.mail":i.selectedTab=3;break;case"app.dashboards.general.sms":i.selectedTab=4;break;case"app.dashboards.general.openchannel":i.selectedTab=5;break;case"app.dashboards.general.fax":i.selectedTab=6;break;case"app.dashboards.general.whatsapp":i.selectedTab=7}}var n}}e.$inject=["$q"],n.$inject=["$q"],t.$inject=["$state","Auth","license"],angular.module("app.dashboards").factory("initializeRealtimeQueue",e).factory("initializeRealtimeCampaign",n).controller("UserDashboardGeneralController",t)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;function r(){s({queues:o.inboundQueues,rpcQueues:o.rpcQueues}).then(function(e){o.inbound=e})}o.inboundQueues=t?_.keyBy(t.rows?t.rows:[],"id"):{},o.rpcQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},o.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},o.outbound=i||{answered:0,sumBillable:0,sumDuration:0,sumHoldTime:0,total:0},o.onSaveQueue=function(e){o.inboundQueues[e.id]&&o.rpcQueues[e.id]&&(o.rpcQueues[e.id]=e,r())},o.onSaveOutbound=function(e){o.outbound=e},n.on("voice_queue:save",o.onSaveQueue),n.on("voice_outbound:save",o.onSaveOutbound),r(),e.$on("$destroy",function(){n.removeListener("voice_queue:save",o.onSaveQueue),n.removeAllListeners("voice_outbound:save")})}e.$inject=["$scope","socket","inboundQueues","rpcQueues","outbound","initializeRealtimeQueue"],angular.module("app.dashboards").controller("UserVoiceDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.whatsappAccounts,{id:_.toNumber(e.WhatsappAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.whatsappAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveWhatsappInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateWhatsappInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("whatsappInteraction:save",i.onSaveWhatsappInteraction),n.on("whatsappInteraction:update",i.onUpdateWhatsappInteraction),function(){if(0<Object.keys(i.whatsappAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("whatsappInteraction:save"),n.removeAllListeners("whatsappInteraction:update")})}e.$inject=["$scope","socket","whatsappInteractions","whatsappAccounts"],angular.module("app.dashboards").controller("UserWhatsappDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="FAX.EDIT_FAXACCOUNT",g.faxAccount=angular.copy(l),g.faxAccounts=r,g.newFaxAccount=!1,g.faxAccount||(g.faxAccount={waitForTheAssignedAgent:10,waitfortheassignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="FAX.NEW_FAXACCOUNT",g.newFaxAccount=!0),n.params.id&&(g.faxAccount.FaxAccountId=n.params.id),g.addNewFaxAccount=function(){g.errors=[],d.faxAccount.addAccountApplications(g.faxAccount).$promise.then(function(e){g.faxAccounts.unshift(e.toJSON()),o.success({title:"FaxAccount properly created",msg:g.faxAccount.name?g.faxAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxAccount=function(){g.errors=[],d.faxAccount.updateAccountApplications(g.faxAccount).$promise.then(function(e){var n=_.find(g.faxAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FaxAccount properly saved!",msg:g.faxAccount.name?g.faxAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The faxAccount will be deleted.").ariaLabel("Delete FaxAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.faxAccount.delete({id:g.faxAccount.id}).$promise.then(function(){_.remove(g.faxAccounts,{id:g.faxAccount.id}),o.success({title:"FaxAccount properly deleted!",msg:(g.faxAccount.name||"faxAccount")+" has been deleted!"}),v(g.faxAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),t=null;if(g.faxAccount&&(t=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.trunks,{id:t.id});a.canSelect=!1,n.push(a)}g.trunks=n})}else{var t=[],a=null;g.faxAccount&&(a=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)}));for(var i=0;i<g.trunks.length;i++)a&&g.trunks[i].id===a.id&&(g.trunks[i].canSelect=!1,t.push(g.trunks[i]));g.trunks=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.faxAccount&&(t=_.find(g.lists,{id:Number(g.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.faxAccount&&(a=_.find(g.lists,{id:Number(g.faxAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","faxAccounts","faxAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.faxAccountApps.rows.length){var t=r.faxAccountApps.rows[n]?r.faxAccountApps.rows[n]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccountApp:t,faxAccount:r.faxAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.faxAccountApps.rows[n]=e:r.faxAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.faxAccountApps.rows.length;t++,0){var a=r.faxAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.faxAccount.context,a.exten=r.faxAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.faxAccount.addApplications({id:r.faxAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.faxAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.faxAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.faxAccount={},r.faxAccountApps={count:0,rows:[]},r.selectedFaxAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"FaxQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"faxQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:901}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,defaultValue:300,required:!0,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",role:"agent",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.faxAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getFaxAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.faxAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getFaxAccountApps=function(){r.promise=o.faxAccount.getApplications(r.query,t).$promise},r.editFaxAccountApp=n,r.editInterval=function(e,n){if(r.faxAccountApps.rows.length){var t=r.faxAccountApps.rows[n]?r.faxAccountApps.rows[n]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteFaxAccountApp=function(e){_.remove(r.faxAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedFaxAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedFaxAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedFaxAccountApps.forEach(function(e){_.remove(r.faxAccountApps.rows,{id:e.id})}),r.selectedFaxAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.fax").controller("FaxAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxAccount.getAgents({id:c.faxAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserFaxAccount?"penalty "+e.UserFaxAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.faxAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxAccount.removeAgents({id:c.faxAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxAccount.addAgents({id:c.faxAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","faxAccount","faxAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditFaxAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("fax")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.faxQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.faxQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:901}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountApptagDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.faxAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.faxAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.FaxAccountId=m.faxAccount.id,m.query.id=m.faxAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.faxAccount.id,field:"FaxAccountId",route:"faxAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.fax").controller("FaxAccountDispositionsController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"faxAccount",action:"getDispositions",field:"name",params:{id:m.faxAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.faxAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.faxAccountInteractions.rows.length;n+=1){var t=m.faxAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.faxInteraction.get(m.query,p).$promise}function v(e){d.faxInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.faxAccountInteractions.rows,{id:e.id}),m.faxAccountInteractions.count-=1,m.faxAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETfaxAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?(e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""),e.contactInfo=e.Contact.fax):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.faxAccount={},m.faxAccountInteractions={count:0,rows:[]},m.selectedFaxAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.faxAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.FaxAccountId=m.faxAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.faxInteractionDownload=function(s,e,n){return d.faxInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="fax-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getFaxAccountInteractions=g,m.createOrEditFaxAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:m.faxAccount,interaction:n,interactions:m.faxAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spyfaxInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"fax",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"fax.faxAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||FaxAccountId:=$eq["+m.faxAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedFaxAccountInteractions=function(){var e=angular.copy(m.selectedFaxAccountInteractions);return m.selectedFaxAccountInteractions=[],e},m.deleteFaxAccountInteraction=v,m.deleteSelectedFaxAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedFaxAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedFaxAccountInteractions.forEach(function(e){v(e)}),m.selectedFaxAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.fax").controller("FaxAccountInteractionsController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=n,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=e.protocol()+"://"+e.host(),p.faxAccount=c||t.params.faxAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=t.params.tab||0,p.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.accounts",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.accounts",{})}},p.agentadddialog=function(e,n){a.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:p.faxAccounts?p.faxAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoFaxAccounts=function(){t.go("app.fax.faxAccounts",{},{reload:"app.fax.faxAccounts"})},p.saveFaxAccount=function(){r.faxAccount.updateAccountApplications(p.faxAccount).$promise.then(function(){l.success({title:"FaxAccount updated!",msg:p.faxAccount.name?p.faxAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.trunks,{id:e.resourceId})}),t=null;if(p.faxAccount&&(t=_.find(p.trunks,{id:Number(p.faxAccount.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.trunks,{id:t.id});a.canSelect=!1,n.push(a)}p.trunks=n})}else{var t=[],a=null;p.faxAccount&&(a=_.find(p.trunks,{id:Number(p.faxAccount.TrunkId)}));for(var i=0;i<p.trunks.length;i++)a&&p.trunks[i].id===a.id&&(p.trunks[i].canSelect=!1,t.push(p.trunks[i]));p.trunks=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.faxAccount&&(t=_.find(p.lists,{id:Number(p.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.faxAccount&&(a=_.find(p.lists,{id:Number(p.faxAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","faxAccount","userProfile","userProfileSection"],angular.module("app.fax").controller("FaxAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.faxAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="faxAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFaxAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.arrayecm=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayminrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymaxrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytech=_.keyBy([{option:"SIP",value:"'SIP'"},{option:"IAX",value:"'IAX'"},{option:"DADHI",value:"'DADHI'"},{option:"KHOMP",value:"'KHOMP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.fax.faxAccounts.edit",{id:e.id,faxAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.fax.faxAccounts.edit",{id:e.id,tab:5})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.accounts",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.accounts",{})}},f.agentadddialog=function(e,n){i.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:f.faxAccounts?f.faxAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("faxAccount")+"?").htmlContent("<b>"+(e.name||"faxAccount")+"</b> will be deleted.").ariaLabel("delete faxAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFaxAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.faxAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FaxAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFaxAccount=function(e,n){i.show({controller:"CreateOrEditFaxAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:n,faxAccounts:f.faxAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFaxAccount=y,f.exportSelectedFaxAccounts=function(){var e=angular.copy(f.selectedFaxAccounts);return f.selectedFaxAccounts=[],e},f.deleteSelectedFaxAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected faxAccounts?").htmlContent("<b>"+f.selectedFaxAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FaxAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFaxAccounts.forEach(function(e){y(e)}),f.selectedFaxAccounts=[]})},f.deselectFaxAccounts=function(){f.selectedFaxAccounts=[]},f.selectAllFaxAccounts=function(){f.selectedFaxAccounts=f.faxAccounts.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})}),a=null;a=[],f.faxAccounts.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.trunks,{id:e.id});n.canSelect=!1,t.push(n)}}),f.trunks=t})}else{var t=[],a=[];f.faxAccounts.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)});for(var i=0;i<f.trunks.length;i++){_.some(a,{id:f.trunks[i].id})&&(f.trunks[i].canSelect=!1,t.push(f.trunks[i]))}f.trunks=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.faxAccount&&(t=_.find(f.lists,{id:Number(f.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.faxAccount&&(a=_.find(f.lists,{id:Number(f.faxAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.faxAccounts=e||{count:0,rows:[]}}function y(e){m.faxAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.faxAccounts.rows,{id:e.id}),f.faxAccounts.count-=1,f.faxAccounts.rows.length||f.getFaxAccounts(),p.success({title:_.startCase("FaxAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFaxAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.fax").controller("FaxAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="FAX.EDIT_FAXQUEUE",r.faxQueue=angular.copy(n),r.faxQueues=e,r.newFaxQueue=!1,r.faxQueue||(r.faxQueue={strategy:"beepall",timeout:10},r.title="FAX.NEW_FAXQUEUE",r.newFaxQueue=!0),r.addNewFaxQueue=function(){r.errors=[],i.faxQueue.save(r.faxQueue).$promise.then(function(e){r.faxQueues.unshift(e.toJSON()),a.success({title:"FaxQueue properly created",msg:r.faxQueue.name?r.faxQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveFaxQueue=function(){r.errors=[],i.faxQueue.update({id:r.faxQueue.id},r.faxQueue).$promise.then(function(e){var n=_.find(r.faxQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"FaxQueue properly saved!",msg:r.faxQueue.name?r.faxQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteFaxQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The faxQueue will be deleted.").ariaLabel("Delete FaxQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.faxQueue.delete({id:r.faxQueue.id}).$promise.then(function(){_.remove(r.faxQueues,{id:r.faxQueue.id}),a.success({title:"FaxQueue properly deleted!",msg:(r.faxQueue.name||"faxQueue")+" has been deleted!"}),l(r.faxQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","faxQueues","faxQueue","api","Auth","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxQueue.getAgents({id:c.faxQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserFaxQueue?"penalty "+e.UserFaxQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.faxQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.removeAgents({id:c.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.addAgents({id:c.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","faxQueue","faxQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxQueue.getTeams({id:l.faxQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.faxQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("FAX.ALL_TEAMS"),labelSelected:t.instant("FAX.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.removeTeams({id:l.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.addTeams({id:l.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","faxQueue","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.faxQueue=c||e.params.faxQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoFaxQueues=function(){e.go("app.fax.faxQueues",{},{reload:"app.fax.faxQueues"})},u.saveFaxQueue=function(){r.faxQueue.update({id:u.faxQueue.id},u.faxQueue).$promise.then(function(){l.success({title:"FaxQueue updated!",msg:u.faxQueue.name?u.faxQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","faxQueue","userProfileSection"],angular.module("app.fax").controller("FaxQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.faxQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="faxQueues",f.listOrder="",f.listOrderAsc=null,f.selectedFaxQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.fax.faxQueues.edit",{id:e.id,faxQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:f.faxQueues?f.faxQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:f.faxQueues?f.faxQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("faxQueue")+"?").htmlContent("<b>"+(e.name||"faxQueue")+"</b> will be deleted.").ariaLabel("delete faxQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.queues",{})}},f.success=E,f.getFaxQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.faxQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FaxQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFaxQueue=function(e,n){i.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:n,faxQueues:f.faxQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteFaxQueue=y,f.exportSelectedFaxQueues=function(){var e=angular.copy(f.selectedFaxQueues);return f.selectedFaxQueues=[],e},f.deleteSelectedFaxQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected faxQueues?").htmlContent("<b>"+f.selectedFaxQueues.length+" selected</b> will be deleted.").ariaLabel("delete FaxQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFaxQueues.forEach(function(e){y(e)}),f.selectedFaxQueues=[]})},f.deselectFaxQueues=function(){f.selectedFaxQueues=[]},f.selectAllFaxQueues=function(){f.selectedFaxQueues=f.faxQueues.rows};var b=!0,A=1;function E(e){f.faxQueues=e||{count:0,rows:[]}}function y(e){m.faxQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.faxQueues.rows,{id:e.id}),f.faxQueues.count-=1,f.faxQueues.rows.length||f.getFaxQueues(),p.success({title:_.startCase("FaxQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEfaxQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFaxQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.fax").controller("FaxQueuesController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d){var c=this,m=d&&1==d.count?d.rows[0].crudPermissions:null;function u(){c.faxAccounts.rows.forEach(function(n){var e=_.find(c.rpcFaxAccounts.rows,["id",n.id]);e&&_.merge(n,e);var t={id:n.id,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),fields:"id,createdAt"};i.faxAccount.getMessages(t).$promise.then(function(e){return e&&(n.in=e.count||0,n.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),t.direction="out",i.faxAccount.getMessages(t).$promise}).then(function(e){e&&(n.out=e.count||0,n.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){o.error(e.data?e.data.message:e.toString())})})}function p(e){var n=_.find(c.faxAccounts.rows,["id",e.id]);n&&_.merge(n,e)}function g(e){c.faxAccounts.rows=e.rows,u()}c.currentUser=n.getCurrentUser(),c.faxAccounts=r,c.rpcFaxAccounts=l,c.crudPermissions=n.parseCrudPermissions(m),c.query={sort:"name",limit:10,page:1},c.success=g,c.$onInit=u,c.getFaxAccounts=function(){c.query.offset=(c.query.page-1)*c.query.limit,n.hasRole("admin")?c.promise=i.faxAccount.get(c.query,g).$promise:(c.query.id=c.currentUser.userProfileId,c.query.section="FaxAccounts",c.promise=i.userProfile.getResources(c.query,g).$promise)},c.goToFaxAccount=function(e,n){a.go("app.fax.faxAccounts.edit",{id:n.id,faxAccount:n})},s.on("faxAccount:save",p),s.on("faxAccount:update",p),s.on("faxMessage:save",function(e){var n=_.find(c.faxAccounts.rows,["id",e.FaxAccountId]);n&&("in"==e.direction?(n.in+=1,n.lastIn=e.createdAt):(n.out+=1,n.lastOut=e.createdAt))});var v=!0,h=1;e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=h),c.getFaxAccounts())}),e.$on("$destroy",function(){s.removeAllListeners("faxAccount:save"),s.removeAllListeners("faxAccount:update"),s.removeAllListeners("faxMessage:save")})}e.$inject=["$scope","$timeout","$state","api","Auth","socket","toasty","faxAccounts","rpcFaxAccounts","userProfileSection"],angular.module("app.fax").controller("FaxAccountsRealtimeController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.fax.realtime.agents":this.selectedTab=0;break;case"app.fax.realtime.trunks":this.selectedTab=1;break;case"app.fax.realtime.queues":this.selectedTab=2;break;case"app.fax.realtime.accounts":this.selectedTab=3;break;default:this.selectedTab=0,t.go("app.fax.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.fax.realtime.agents");break;case 1:t.go("app.fax.realtime.trunks");break;case 2:t.go("app.fax.realtime.queues");break;case 3:t.go("app.fax.realtime.accounts");break;default:t.go("app.fax.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.fax").controller("FaxRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m){var u=this,p=["status","stateRegistry","registry","host","port","internal","state","status"];function g(){for(var e,n=0;n<u.trunks.length;n+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[n].id]))&&_.merge(u.trunks[n],_.pick(u.rpcTrunks[e],p))}function v(e,n,t){0<=n&&_.merge(e[n],_.pick(t,p))}u.currentUser=m.getCurrentUser(),u.count=a.count,u.trunks=a?a.rows:[],u.rpcTrunks=i&&i.rows?i.rows:[],u.query={fields:"id,name",active:!0,sort:"name",limit:10,page:1},u.statusClass=r.STATUS_STYLES,u.stateClass=r.STATES_STYLES,u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.success=b,u.$onInit=g,u.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},u.getTrunks=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=s.trunk.get(u.query,b).$promise:(u.query.id=u.userProfile.id,u.query.section="Trunks",u.promise=s.userProfile.getResources(u.query,b).$promise)},u.goToTrunk=function(e,n){l.go("app.tools.trunks.edit",{id:n.id})},u.onSave=function(e){var n=_.findIndex(u.trunks,["id",e.id]),t=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,n,e),v(u.rpcTrunks,t,e)},o.on("trunk:save",u.onSave);var h=!0,f=1;function b(e){u.count=e.count,u.trunks=e&&e.rows?e.rows:[],g()}e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=f),u.getTrunks())}),e.$on("$destroy",function(){o.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","realtimeManager","$state","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("TrunksFaxRealtimeController",e)}(),function(){"use strict";function e(e,n){this.info=e,this.license=n}e.$inject=["info","license"],angular.module("app.help.about").controller("AboutController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DESKACCOUNT",g.deskAccount=angular.copy(l),g.deskAccounts=r,g.newDeskAccount=!1,g.deskAccount||(g.deskAccount={type:"integrationTab",authType:"basic",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_DESKACCOUNT",g.newDeskAccount=!0),g.addNewDeskAccount=function(){g.errors=[],d.intDeskAccount.save(g.deskAccount).$promise.then(function(e){g.deskAccounts.unshift(e.toJSON()),o.success({title:"DeskAccount properly created",msg:g.deskAccount.name?g.deskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDeskAccount=function(){g.errors=[],d.intDeskAccount.update({id:g.deskAccount.id},g.deskAccount).$promise.then(function(e){var n=_.find(g.deskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"DeskAccount properly saved!",msg:g.deskAccount.name?g.deskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The deskAccount will be deleted.").ariaLabel("Delete DeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDeskAccount.delete({id:g.deskAccount.id}).$promise.then(function(){_.remove(g.deskAccounts,{id:g.deskAccount.id}),o.success({title:"DeskAccount properly deleted!",msg:(g.deskAccount.name||"deskAccount")+" has been deleted!"}),v(g.deskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","deskAccounts","deskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskAccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.deskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="deskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedDeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayauthType=_.keyBy([{option:"Basic",value:"'basic'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.deskAccounts.edit",{id:e.id,deskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intDeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"DeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"DeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("deskAccount")+"?").htmlContent("<b>"+(e.name||"deskAccount")+"</b> will be deleted.").ariaLabel("delete deskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getDeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intDeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="DeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditDeskAccount=function(e,n){i.show({controller:"CreateOrEditDeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskAccount:n,deskAccounts:f.deskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteDeskAccount=y,f.exportSelectedDeskAccounts=function(){var e=angular.copy(f.selectedDeskAccounts);return f.selectedDeskAccounts=[],e},f.deleteSelectedDeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected deskAccounts?").htmlContent("<b>"+f.selectedDeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete DeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedDeskAccounts.forEach(function(e){y(e)}),f.selectedDeskAccounts=[]})},f.deselectDeskAccounts=function(){f.selectedDeskAccounts=[]},f.selectAllDeskAccounts=function(){f.selectedDeskAccounts=f.deskAccounts.rows};var b=!0,A=1;function E(e){f.deskAccounts=e||{count:0,rows:[]}}function y(e){m.intDeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.deskAccounts.rows,{id:e.id}),f.deskAccounts.count-=1,f.deskAccounts.rows.length||f.getDeskAccounts(),p.success({title:_.startCase("DeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintDeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getDeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","deskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("DeskAccountsController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.deskAccount={},o.deskConfiguration={},o.configurations=[],o.selectedDeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.deskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intDeskAccount.getConfigurations({id:o.deskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getDeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getDeskConfiguration=function(e){o.deskConfiguration=o.configurations[e],o.selectedDeskConfiguration=e,i.intDeskConfiguration.getSubjects({id:o.deskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intDeskConfiguration.getDescriptions({id:o.deskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intDeskConfiguration.getFields({id:o.deskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intDeskConfiguration.getTags({id:o.deskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditDeskConfiguration=function(e,n){a.show({controller:"CreateOrEditDeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDeskConfiguration(0)})},o.deleteDeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the deskConfiguration?").htmlContent("<b>"+(n.name||"deskConfiguration")+"</b> will be deleted.").ariaLabel("delete deskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intDeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"DeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getDeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intDeskConfiguration.setTags({id:o.deskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("DeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DESKCONFIGURATION",g.deskConfiguration=angular.copy(l),g.configurations=r,g.newDeskConfiguration=!1,g.deskConfiguration||(g.deskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_DESKCONFIGURATION",g.newDeskConfiguration=!0),g.addNewDeskConfiguration=function(){g.errors=[],d.intDeskAccount.addConfiguration({id:n.params.id},g.deskConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"DeskConfiguration properly created",msg:g.deskConfiguration.name?g.deskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDeskConfiguration=function(){g.errors=[],d.intDeskConfiguration.update({id:g.deskConfiguration.id},g.deskConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"DeskConfiguration properly saved!",msg:g.deskConfiguration.name?g.deskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The deskConfiguration will be deleted.").ariaLabel("Delete DeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDeskConfiguration.delete({id:g.deskConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.deskConfiguration.id}),o.success({title:"DeskConfiguration properly deleted!",msg:(g.deskConfiguration.name||"deskConfiguration")+" has been deleted!"}),v(g.deskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","deskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.deskAccount=c||e.params.deskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoDeskAccounts=function(){e.go("app.integrations.deskAccounts",{},{reload:"app.integrations.deskAccounts"})},u.saveDeskAccount=function(){r.intDeskAccount.update({id:u.deskAccount.id},u.deskAccount).$promise.then(function(){l.success({title:"DeskAccount updated!",msg:u.deskAccount.name?u.deskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintDeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","deskAccount","userProfileSection"],angular.module("app.integrations").controller("DeskAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;function h(e){a.hide(e)}v.currentUser=m.getCurrentUser(),v.errors=[],v.setting=p,v.license=u,v.crudPermissions=g,v.hasModulePermissions={},v.passwordPattern=v.setting&&v.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",v.title="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT",v.dynamics365Account=angular.copy(l),v.dynamics365Accounts=r,v.cloudProviders=d,v.newDynamics365Account=!1,v.dynamics365Account||(v.dynamics365Account={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),modernAuthentication:!1},v.title="INTEGRATIONS.NEW_DYNAMICS365ACCOUNT",v.newDynamics365Account=!0),v.addNewDynamics365Account=function(){v.errors=[],c.intDynamics365Account.save(v.dynamics365Account).$promise.then(function(e){v.dynamics365Accounts.unshift(e.toJSON()),o.success({title:"Dynamics365Account properly created",msg:v.dynamics365Account.name?v.dynamics365Account.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveDynamics365Account=function(){v.errors=[],c.intDynamics365Account.update({id:v.dynamics365Account.id},v.dynamics365Account).$promise.then(function(e){var n=_.find(v.dynamics365Accounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Dynamics365Account properly saved!",msg:v.dynamics365Account.name?v.dynamics365Account.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteDynamics365Account=function(e){v.errors=[];var n=a.confirm().title("Are you sure?").content("The dynamics365Account will be deleted.").ariaLabel("Delete Dynamics365Account").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDynamics365Account.delete({id:v.dynamics365Account.id}).$promise.then(function(){_.remove(v.dynamics365Accounts,{id:v.dynamics365Account.id}),o.success({title:"Dynamics365Account properly deleted!",msg:(v.dynamics365Account.name||"dynamics365Account")+" has been deleted!"}),h(v.dynamics365Account)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=h}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dynamics365Accounts","dynamics365Account","cloudProviders","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=h,b.setting=f,b.currentUser=v.getCurrentUser(),b.dynamics365Accounts=l||{count:0,rows:[]},b.cloudProviders=d||{count:0,rows:[]},b.userProfile=c,b.userProfileSection=m&&1==m.count?m.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.table="dynamics365Accounts",b.listOrder="",b.listOrderAsc=null,b.selectedDynamics365Accounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,n){t.go("app.integrations.dynamics365Accounts.edit",{id:e.id,dynamics365Account:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,n){return u.intDynamics365Account.getFields({id:e.id,test:!0}).$promise.then(function(){g.success({title:"Dynamics365Account properly tested",msg:"Connection succeded!"})}).catch(function(e){g.error({title:"Dynamics365Account properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},b.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("dynamics365Account")+"?").htmlContent("<b>"+(e.name||"dynamics365Account")+"</b> will be deleted.").ariaLabel("delete dynamics365Account").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDynamics365Accounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,v.hasRole("admin")?b.promise=u.intDynamics365Account.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Dynamics365Accounts",b.promise=u.userProfile.getResources(b.query,y).$promise)},b.createOrEditDynamics365Account=function(e,n){i.show({controller:"CreateOrEditDynamics365AccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Account:n,dynamics365Accounts:b.dynamics365Accounts.rows,cloudProviders:b.cloudProviders.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteDynamics365Account=S,b.exportSelectedDynamics365Accounts=function(){var e=angular.copy(b.selectedDynamics365Accounts);return b.selectedDynamics365Accounts=[],e},b.deleteSelectedDynamics365Accounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected dynamics365Accounts?").htmlContent("<b>"+b.selectedDynamics365Accounts.length+" selected</b> will be deleted.").ariaLabel("delete Dynamics365Accounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){b.selectedDynamics365Accounts.forEach(function(e){S(e)}),b.selectedDynamics365Accounts=[]})},b.deselectDynamics365Accounts=function(){b.selectedDynamics365Accounts=[]},b.selectAllDynamics365Accounts=function(){b.selectedDynamics365Accounts=b.dynamics365Accounts.rows};var A=!0,E=1;function y(e){b.dynamics365Accounts=e||{count:0,rows:[]}}function S(e){u.intDynamics365Account.delete({id:e.id}).$promise.then(function(){_.remove(b.dynamics365Accounts.rows,{id:e.id}),b.dynamics365Accounts.count-=1,b.dynamics365Accounts.rows.length||b.getDynamics365Accounts(),g.success({title:_.startCase("Dynamics365Account")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDynamics365Account"}];for(var n=0;n<e.data.errors.length;n++)g.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else g.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintDynamics365Account",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){A?o(function(){A=!1}):(n||(E=b.query.page),e!==n&&(b.query.page=1),e||(b.query.page=E),b.getDynamics365Accounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dynamics365Accounts","cloudProviders","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("Dynamics365AccountsController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.dynamics365Account={},o.dynamics365Configuration={},o.configurations=[],o.selectedDynamics365Configuration=-1,o.crudPermissions,o.init=function(e,n){o.dynamics365Account=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intDynamics365Account.getConfigurations({id:o.dynamics365Account.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getDynamics365Configuration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getDynamics365Configuration=function(e){o.advancedForm&&o.advancedForm.$setPristine();o.dynamics365Configuration=o.configurations[e],o.selectedDynamics365Configuration=e,i.intDynamics365Configuration.getSubjects({id:o.dynamics365Configuration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intDynamics365Configuration.getDescriptions({id:o.dynamics365Configuration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intDynamics365Configuration.getFields({id:o.dynamics365Configuration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditDynamics365Configuration=function(e,n){a.show({controller:"CreateOrEditDynamics365ConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Configuration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDynamics365Configuration(0)})},o.deleteDynamics365Configuration=function(e,n){var t=a.confirm().title("Are you sure want to delete the dynamics365Configuration?").htmlContent("<b>"+(n.name||"dynamics365Configuration")+"</b> will be deleted.").ariaLabel("delete dynamics365Configuration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intDynamics365Configuration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"Dynamics365Configuration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getDynamics365Configuration(0)})},function(){console.log("CANCEL")})},o.saveDynamics365Configuration=function(){o.errors=[],i.intDynamics365Configuration.update({id:o.dynamics365Configuration.id},o.dynamics365Configuration).$promise.then(function(e){var n=_.find(o.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.advancedForm.$setPristine(),s.success({title:"Dynamics365Configuration properly saved!",msg:o.dynamics365Configuration.name?o.dynamics365Configuration.name+" has been saved!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){o.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("Dynamics365AccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DYNAMICS365CONFIGURATION",g.dynamics365Configuration=angular.copy(l),g.configurations=r,g.newDynamics365Configuration=!1,g.dynamics365Configuration||(g.dynamics365Configuration={channel:"voice",type:"inbound",ticketType:"incident"},g.title="INTEGRATIONS.NEW_DYNAMICS365CONFIGURATION",g.newDynamics365Configuration=!0),g.addNewDynamics365Configuration=function(){g.errors=[],d.intDynamics365Account.addConfiguration({id:n.params.id},g.dynamics365Configuration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"Dynamics365Configuration properly created",msg:g.dynamics365Configuration.name?g.dynamics365Configuration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDynamics365Configuration=function(){g.errors=[],d.intDynamics365Configuration.update({id:g.dynamics365Configuration.id},g.dynamics365Configuration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Dynamics365Configuration properly saved!",msg:g.dynamics365Configuration.name?g.dynamics365Configuration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDynamics365Configuration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The dynamics365Configuration will be deleted.").ariaLabel("Delete Dynamics365Configuration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDynamics365Configuration.delete({id:g.dynamics365Configuration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.dynamics365Configuration.id}),o.success({title:"Dynamics365Configuration properly deleted!",msg:(g.dynamics365Configuration.name||"dynamics365Configuration")+" has been deleted!"}),v(g.dynamics365Configuration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","dynamics365Configuration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365ConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDynamics365Field.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDynamics365Field.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDynamics365Field.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDynamics365Account.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.dynamics365Account=c||e.params.dynamics365Account||{},p.cloudProviders=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.alert=l.info,p.gotoDynamics365Accounts=function(){e.go("app.integrations.dynamics365Accounts",{},{reload:"app.integrations.dynamics365Accounts"})},p.saveDynamics365Account=function(){r.intDynamics365Account.update({id:p.dynamics365Account.id},p.dynamics365Account).$promise.then(function(){l.success({title:"Dynamics365Account updated!",msg:p.dynamics365Account.name?p.dynamics365Account.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintDynamics365Account",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","dynamics365Account","cloudProviders","userProfileSection"],angular.module("app.integrations").controller("Dynamics365AccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHDESKACCOUNT",g.freshdeskAccount=angular.copy(l),g.freshdeskAccounts=r,g.newFreshdeskAccount=!1,g.freshdeskAccount||(g.freshdeskAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_FRESHDESKACCOUNT",g.newFreshdeskAccount=!0),g.addNewFreshdeskAccount=function(){g.errors=[],d.intFreshdeskAccount.save(g.freshdeskAccount).$promise.then(function(e){g.freshdeskAccounts.unshift(e.toJSON()),o.success({title:"FreshdeskAccount properly created",msg:g.freshdeskAccount.name?g.freshdeskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshdeskAccount=function(){g.errors=[],d.intFreshdeskAccount.update({id:g.freshdeskAccount.id},g.freshdeskAccount).$promise.then(function(e){var n=_.find(g.freshdeskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshdeskAccount properly saved!",msg:g.freshdeskAccount.name?g.freshdeskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshdeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshdeskAccount will be deleted.").ariaLabel("Delete FreshdeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshdeskAccount.delete({id:g.freshdeskAccount.id}).$promise.then(function(){_.remove(g.freshdeskAccounts,{id:g.freshdeskAccount.id}),o.success({title:"FreshdeskAccount properly deleted!",msg:(g.freshdeskAccount.name||"freshdeskAccount")+" has been deleted!"}),v(g.freshdeskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","freshdeskAccounts","freshdeskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.freshdeskAccount={},o.freshdeskConfiguration={},o.configurations=[],o.selectedFreshdeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.freshdeskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intFreshdeskAccount.getConfigurations({id:o.freshdeskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getFreshdeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getFreshdeskConfiguration=function(e){o.freshdeskConfiguration=o.configurations[e],o.selectedFreshdeskConfiguration=e,i.intFreshdeskConfiguration.getSubjects({id:o.freshdeskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intFreshdeskConfiguration.getDescriptions({id:o.freshdeskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intFreshdeskConfiguration.getFields({id:o.freshdeskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intFreshdeskConfiguration.getTags({id:o.freshdeskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditFreshdeskConfiguration=function(e,n){a.show({controller:"CreateOrEditFreshdeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshdeskConfiguration(0)})},o.deleteFreshdeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the freshdeskConfiguration?").htmlContent("<b>"+(n.name||"freshdeskConfiguration")+"</b> will be deleted.").ariaLabel("delete freshdeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intFreshdeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"FreshdeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getFreshdeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intFreshdeskConfiguration.setTags({id:o.freshdeskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("FreshdeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHDESKCONFIGURATION",g.freshdeskConfiguration=angular.copy(l),g.configurations=r,g.newFreshdeskConfiguration=!1,g.freshdeskConfiguration||(g.freshdeskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_FRESHDESKCONFIGURATION",g.newFreshdeskConfiguration=!0),g.addNewFreshdeskConfiguration=function(){g.errors=[],d.intFreshdeskAccount.addConfiguration({id:n.params.id},g.freshdeskConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"FreshdeskConfiguration properly created",msg:g.freshdeskConfiguration.name?g.freshdeskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshdeskConfiguration=function(){g.errors=[],d.intFreshdeskConfiguration.update({id:g.freshdeskConfiguration.id},g.freshdeskConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshdeskConfiguration properly saved!",msg:g.freshdeskConfiguration.name?g.freshdeskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshdeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshdeskConfiguration will be deleted.").ariaLabel("Delete FreshdeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshdeskConfiguration.delete({id:g.freshdeskConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.freshdeskConfiguration.id}),o.success({title:"FreshdeskConfiguration properly deleted!",msg:(g.freshdeskConfiguration.name||"freshdeskConfiguration")+" has been deleted!"}),v(g.freshdeskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","freshdeskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshdeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshdeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intFreshdeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshdeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.freshdeskAccount=c||e.params.freshdeskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoFreshdeskAccounts=function(){e.go("app.integrations.freshdeskAccounts",{},{reload:"app.integrations.freshdeskAccounts"})},u.saveFreshdeskAccount=function(){r.intFreshdeskAccount.update({id:u.freshdeskAccount.id},u.freshdeskAccount).$promise.then(function(){l.success({title:"FreshdeskAccount updated!",msg:u.freshdeskAccount.name?u.freshdeskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshdeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","freshdeskAccount","userProfileSection"],angular.module("app.integrations").controller("FreshdeskAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.freshdeskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="freshdeskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFreshdeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.freshdeskAccounts.edit",{id:e.id,freshdeskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intFreshdeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"FreshdeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"FreshdeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("freshdeskAccount")+"?").htmlContent("<b>"+(e.name||"freshdeskAccount")+"</b> will be deleted.").ariaLabel("delete freshdeskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFreshdeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intFreshdeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FreshdeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFreshdeskAccount=function(e,n){i.show({controller:"CreateOrEditFreshdeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskAccount:n,freshdeskAccounts:f.freshdeskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFreshdeskAccount=y,f.exportSelectedFreshdeskAccounts=function(){var e=angular.copy(f.selectedFreshdeskAccounts);return f.selectedFreshdeskAccounts=[],e},f.deleteSelectedFreshdeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected freshdeskAccounts?").htmlContent("<b>"+f.selectedFreshdeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshdeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFreshdeskAccounts.forEach(function(e){y(e)}),f.selectedFreshdeskAccounts=[]})},f.deselectFreshdeskAccounts=function(){f.selectedFreshdeskAccounts=[]},f.selectAllFreshdeskAccounts=function(){f.selectedFreshdeskAccounts=f.freshdeskAccounts.rows};var b=!0,A=1;function E(e){f.freshdeskAccounts=e||{count:0,rows:[]}}function y(e){m.intFreshdeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.freshdeskAccounts.rows,{id:e.id}),f.freshdeskAccounts.count-=1,f.freshdeskAccounts.rows.length||f.getFreshdeskAccounts(),p.success({title:_.startCase("FreshdeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshdeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintFreshdeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFreshdeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshdeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("FreshdeskAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHSALESACCOUNT",g.freshsalesAccount=angular.copy(l),g.freshsalesAccounts=r,g.newFreshsalesAccount=!1,g.freshsalesAccount||(g.freshsalesAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_FRESHSALESACCOUNT",g.newFreshsalesAccount=!0),g.addNewFreshsalesAccount=function(){g.errors=[],d.intFreshsalesAccount.save(g.freshsalesAccount).$promise.then(function(e){g.freshsalesAccounts.unshift(e.toJSON()),o.success({title:"FreshsalesAccount properly created",msg:g.freshsalesAccount.name?g.freshsalesAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshsalesAccount=function(){g.errors=[],d.intFreshsalesAccount.update({id:g.freshsalesAccount.id},g.freshsalesAccount).$promise.then(function(e){var n=_.find(g.freshsalesAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshsalesAccount properly saved!",msg:g.freshsalesAccount.name?g.freshsalesAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshsalesAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshsalesAccount will be deleted.").ariaLabel("Delete FreshsalesAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshsalesAccount.delete({id:g.freshsalesAccount.id}).$promise.then(function(){_.remove(g.freshsalesAccounts,{id:g.freshsalesAccount.id}),o.success({title:"FreshsalesAccount properly deleted!",msg:(g.freshsalesAccount.name||"freshsalesAccount")+" has been deleted!"}),v(g.freshsalesAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","freshsalesAccounts","freshsalesAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.freshsalesAccount={},o.freshsalesConfiguration={},o.configurations=[],o.selectedFreshsalesConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.freshsalesAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intFreshsalesAccount.getConfigurations({id:o.freshsalesAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getFreshsalesConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getFreshsalesConfiguration=function(e){o.freshsalesConfiguration=o.configurations[e],o.selectedFreshsalesConfiguration=e,i.intFreshsalesConfiguration.getSubjects({id:o.freshsalesConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intFreshsalesConfiguration.getDescriptions({id:o.freshsalesConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intFreshsalesConfiguration.getFields({id:o.freshsalesConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditFreshsalesConfiguration=function(e,n){a.show({controller:"CreateOrEditFreshsalesConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshsalesConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshsalesConfiguration(0)})},o.deleteFreshsalesConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the freshsalesConfiguration?").htmlContent("<b>"+(n.name||"freshsalesConfiguration")+"</b> will be deleted.").ariaLabel("delete freshsalesConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intFreshsalesConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"FreshsalesConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getFreshsalesConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("FreshsalesAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHSALESCONFIGURATION",g.freshsalesConfiguration=angular.copy(l),g.configurations=r,g.newFreshsalesConfiguration=!1,g.freshsalesConfiguration||(g.freshsalesConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_FRESHSALESCONFIGURATION",g.newFreshsalesConfiguration=!0),g.addNewFreshsalesConfiguration=function(){g.errors=[],d.intFreshsalesAccount.addConfiguration({id:n.params.id},g.freshsalesConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"FreshsalesConfiguration properly created",msg:g.freshsalesConfiguration.name?g.freshsalesConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshsalesConfiguration=function(){g.errors=[],d.intFreshsalesConfiguration.update({id:g.freshsalesConfiguration.id},g.freshsalesConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshsalesConfiguration properly saved!",msg:g.freshsalesConfiguration.name?g.freshsalesConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshsalesConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshsalesConfiguration will be deleted.").ariaLabel("Delete FreshsalesConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshsalesConfiguration.delete({id:g.freshsalesConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.freshsalesConfiguration.id}),o.success({title:"FreshsalesConfiguration properly deleted!",msg:(g.freshsalesConfiguration.name||"freshsalesConfiguration")+" has been deleted!"}),v(g.freshsalesConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","freshsalesConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshsalesField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshsalesField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intFreshsalesField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshsalesAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.freshsalesAccount=c||e.params.freshsalesAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoFreshsalesAccounts=function(){e.go("app.integrations.freshsalesAccounts",{},{reload:"app.integrations.freshsalesAccounts"})},u.saveFreshsalesAccount=function(){r.intFreshsalesAccount.update({id:u.freshsalesAccount.id},u.freshsalesAccount).$promise.then(function(){l.success({title:"FreshsalesAccount updated!",msg:u.freshsalesAccount.name?u.freshsalesAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshsalesAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","freshsalesAccount","userProfileSection"],angular.module("app.integrations").controller("FreshsalesAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.freshsalesAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="freshsalesAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFreshsalesAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.freshsalesAccounts.edit",{id:e.id,freshsalesAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intFreshsalesAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"FreshsalesAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"FreshsalesAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("freshsalesAccount")+"?").htmlContent("<b>"+(e.name||"freshsalesAccount")+"</b> will be deleted.").ariaLabel("delete freshsalesAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFreshsalesAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intFreshsalesAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FreshsalesAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFreshsalesAccount=function(e,n){i.show({controller:"CreateOrEditFreshsalesAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshsalesAccount:n,freshsalesAccounts:f.freshsalesAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFreshsalesAccount=y,f.exportSelectedFreshsalesAccounts=function(){var e=angular.copy(f.selectedFreshsalesAccounts);return f.selectedFreshsalesAccounts=[],e},f.deleteSelectedFreshsalesAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected freshsalesAccounts?").htmlContent("<b>"+f.selectedFreshsalesAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshsalesAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFreshsalesAccounts.forEach(function(e){y(e)}),f.selectedFreshsalesAccounts=[]})},f.deselectFreshsalesAccounts=function(){f.selectedFreshsalesAccounts=[]},f.selectAllFreshsalesAccounts=function(){f.selectedFreshsalesAccounts=f.freshsalesAccounts.rows};var b=!0,A=1;function E(e){f.freshsalesAccounts=e||{count:0,rows:[]}}function y(e){m.intFreshsalesAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.freshsalesAccounts.rows,{id:e.id}),f.freshsalesAccounts.count-=1,f.freshsalesAccounts.rows.length||f.getFreshsalesAccounts(),p.success({title:_.startCase("FreshsalesAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshsalesAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintFreshsalesAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFreshsalesAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshsalesAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("FreshsalesAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SALESFORCEACCOUNT",g.salesforceAccount=angular.copy(l),g.salesforceAccounts=r,g.newSalesforceAccount=!1,g.salesforceAccount||(g.salesforceAccount={type:"integrationTab",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SALESFORCEACCOUNT",g.newSalesforceAccount=!0),g.addNewSalesforceAccount=function(){g.errors=[],d.intSalesforceAccount.save(g.salesforceAccount).$promise.then(function(e){g.salesforceAccounts.unshift(e.toJSON()),o.success({title:"SalesforceAccount properly created",msg:g.salesforceAccount.name?g.salesforceAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSalesforceAccount=function(){g.errors=[],d.intSalesforceAccount.update({id:g.salesforceAccount.id},g.salesforceAccount).$promise.then(function(e){var n=_.find(g.salesforceAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SalesforceAccount properly saved!",msg:g.salesforceAccount.name?g.salesforceAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSalesforceAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The salesforceAccount will be deleted.").ariaLabel("Delete SalesforceAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSalesforceAccount.delete({id:g.salesforceAccount.id}).$promise.then(function(){_.remove(g.salesforceAccounts,{id:g.salesforceAccount.id}),o.success({title:"SalesforceAccount properly deleted!",msg:(g.salesforceAccount.name||"salesforceAccount")+" has been deleted!"}),v(g.salesforceAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","salesforceAccounts","salesforceAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function n(){return"Case"===o.salesforceConfiguration.ticketType&&("lead"===o.salesforceConfiguration.moduleCreate||_.includes(["lead","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch))}function r(){return _.includes(["lead","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function l(){return _.includes(["contact","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function d(){return _.includes(["account","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function c(){return i.intSalesforceConfiguration.update({id:o.salesforceConfiguration.id},o.salesforceConfiguration).$promise.then(function(){s.success({title:"Module updated!",msg:"Module has been updated!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function m(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function u(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.salesforceAccount={},o.salesforceConfiguration={},o.configurations=[],o.selectedSalesforceConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.salesforceAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intSalesforceAccount.getConfigurations({id:o.salesforceAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getSalesforceConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getSalesforceConfiguration=function(e){o.salesforceConfiguration=o.configurations[e],o.salesforceConfiguration.isLead=n(),o.salesforceConfiguration.isLeadSearch=r(),o.salesforceConfiguration.isContactSearch=l(),o.salesforceConfiguration.isAccountSearch=d(),o.selectedSalesforceConfiguration=e,i.intSalesforceConfiguration.getSubjects({id:o.salesforceConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intSalesforceConfiguration.getDescriptions({id:o.salesforceConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intSalesforceConfiguration.getFields({id:o.salesforceConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditSalesforceConfiguration=function(e,n){a.show({controller:"CreateOrEditSalesforceConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSalesforceConfiguration(0)})},o.deleteSalesforceConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the salesforceConfiguration?").htmlContent("<b>"+(n.name||"salesforceConfiguration")+"</b> will be deleted.").ariaLabel("delete salesforceConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intSalesforceConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"SalesforceConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getSalesforceConfiguration(0)})},function(){console.log("CANCEL")})},o.selectChangedAdvanced=function(){o.salesforceConfiguration.isLead=n(),o.salesforceConfiguration.isLeadSearch=r(),o.salesforceConfiguration.isContactSearch=l(),o.salesforceConfiguration.isAccountSearch=d(),c()},o.salesforceConfiguration.isLead=!1,o.salesforceConfiguration.isLeadSearch=!1,o.salesforceConfiguration.isContactSearch=!1,o.salesforceConfiguration.isAccountSearch=!1,o.checkIsLead=n,o.checkIsLeadSearch=r,o.checkIsContactSearch=l,o.checkIsAccountSearch=d,o.saveSalesforceConfiguration=c,o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){m(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){m(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){u(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){u(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){p(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){p(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SalesforceAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SALESFORCECONFIGURATION",g.salesforceConfiguration=angular.copy(l),g.configurations=r,g.newSalesforceConfiguration=!1,g.salesforceConfiguration||(g.salesforceConfiguration={channel:"voice",type:"inbound",ticketType:"Task"},g.title="INTEGRATIONS.NEW_SALESFORCECONFIGURATION",g.newSalesforceConfiguration=!0),g.addNewSalesforceConfiguration=function(){g.errors=[],d.intSalesforceAccount.addConfiguration({id:n.params.id},g.salesforceConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"SalesforceConfiguration properly created",msg:g.salesforceConfiguration.name?g.salesforceConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSalesforceConfiguration=function(){g.errors=[],d.intSalesforceConfiguration.update({id:g.salesforceConfiguration.id},g.salesforceConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SalesforceConfiguration properly saved!",msg:g.salesforceConfiguration.name?g.salesforceConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSalesforceConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The salesforceConfiguration will be deleted.").ariaLabel("Delete SalesforceConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSalesforceConfiguration.delete({id:g.salesforceConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.salesforceConfiguration.id}),o.success({title:"SalesforceConfiguration properly deleted!",msg:(g.salesforceConfiguration.name||"salesforceConfiguration")+" has been deleted!"}),v(g.salesforceConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","salesforceConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSalesforceField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSalesforceField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intSalesforceField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSalesforceAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.salesforceAccount=c||e.params.salesforceAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoSalesforceAccounts=function(){e.go("app.integrations.salesforceAccounts",{},{reload:"app.integrations.salesforceAccounts"})},u.saveSalesforceAccount=function(){r.intSalesforceAccount.update({id:u.salesforceAccount.id},u.salesforceAccount).$promise.then(function(){l.success({title:"SalesforceAccount updated!",msg:u.salesforceAccount.name?u.salesforceAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSalesforceAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","salesforceAccount","userProfileSection"],angular.module("app.integrations").controller("SalesforceAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.salesforceAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="salesforceAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSalesforceAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.salesforceAccounts.edit",{id:e.id,salesforceAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intSalesforceAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"SalesforceAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"SalesforceAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("salesforceAccount")+"?").htmlContent("<b>"+(e.name||"salesforceAccount")+"</b> will be deleted.").ariaLabel("delete salesforceAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSalesforceAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intSalesforceAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SalesforceAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSalesforceAccount=function(e,n){i.show({controller:"CreateOrEditSalesforceAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceAccount:n,salesforceAccounts:f.salesforceAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSalesforceAccount=y,f.exportSelectedSalesforceAccounts=function(){var e=angular.copy(f.selectedSalesforceAccounts);return f.selectedSalesforceAccounts=[],e},f.deleteSelectedSalesforceAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected salesforceAccounts?").htmlContent("<b>"+f.selectedSalesforceAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SalesforceAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSalesforceAccounts.forEach(function(e){y(e)}),f.selectedSalesforceAccounts=[]})},f.deselectSalesforceAccounts=function(){f.selectedSalesforceAccounts=[]},f.selectAllSalesforceAccounts=function(){f.selectedSalesforceAccounts=f.salesforceAccounts.rows};var b=!0,A=1;function E(e){f.salesforceAccounts=e||{count:0,rows:[]}}function y(e){m.intSalesforceAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.salesforceAccounts.rows,{id:e.id}),f.salesforceAccounts.count-=1,f.salesforceAccounts.rows.length||f.getSalesforceAccounts(),p.success({title:_.startCase("SalesforceAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSalesforceAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintSalesforceAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSalesforceAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","salesforceAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("SalesforceAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SERVICENOWACCOUNT",g.servicenowAccount=angular.copy(l),g.servicenowAccounts=r,g.newServicenowAccount=!1,g.servicenowAccount||(g.servicenowAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SERVICENOWACCOUNT",g.newServicenowAccount=!0),g.addNewServicenowAccount=function(){g.errors=[],d.intServicenowAccount.save(g.servicenowAccount).$promise.then(function(e){g.servicenowAccounts.unshift(e.toJSON()),o.success({title:"ServicenowAccount properly created",msg:g.servicenowAccount.name?g.servicenowAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveServicenowAccount=function(){g.errors=[],d.intServicenowAccount.update({id:g.servicenowAccount.id},g.servicenowAccount).$promise.then(function(e){var n=_.find(g.servicenowAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ServicenowAccount properly saved!",msg:g.servicenowAccount.name?g.servicenowAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteServicenowAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The servicenowAccount will be deleted.").ariaLabel("Delete ServicenowAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intServicenowAccount.delete({id:g.servicenowAccount.id}).$promise.then(function(){_.remove(g.servicenowAccounts,{id:g.servicenowAccount.id}),o.success({title:"ServicenowAccount properly deleted!",msg:(g.servicenowAccount.name||"servicenowAccount")+" has been deleted!"}),v(g.servicenowAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","servicenowAccounts","servicenowAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.servicenowAccount={},o.servicenowConfiguration={},o.configurations=[],o.selectedServicenowConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.servicenowAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intServicenowAccount.getConfigurations({id:o.servicenowAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getServicenowConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getServicenowConfiguration=function(e){o.servicenowConfiguration=o.configurations[e],o.selectedServicenowConfiguration=e,i.intServicenowConfiguration.getSubjects({id:o.servicenowConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intServicenowConfiguration.getDescriptions({id:o.servicenowConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intServicenowConfiguration.getFields({id:o.servicenowConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditServicenowConfiguration=function(e,n){a.show({controller:"CreateOrEditServicenowConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getServicenowConfiguration(0)})},o.deleteServicenowConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the servicenowConfiguration?").htmlContent("<b>"+(n.name||"servicenowConfiguration")+"</b> will be deleted.").ariaLabel("delete servicenowConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intServicenowConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"ServicenowConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getServicenowConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ServicenowAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SERVICENOWCONFIGURATION",g.servicenowConfiguration=angular.copy(l),g.configurations=r,g.newServicenowConfiguration=!1,g.servicenowConfiguration||(g.servicenowConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_SERVICENOWCONFIGURATION",g.newServicenowConfiguration=!0),g.addNewServicenowConfiguration=function(){g.errors=[],d.intServicenowAccount.addConfiguration({id:n.params.id},g.servicenowConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"ServicenowConfiguration properly created",msg:g.servicenowConfiguration.name?g.servicenowConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveServicenowConfiguration=function(){g.errors=[],d.intServicenowConfiguration.update({id:g.servicenowConfiguration.id},g.servicenowConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ServicenowConfiguration properly saved!",msg:g.servicenowConfiguration.name?g.servicenowConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteServicenowConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The servicenowConfiguration will be deleted.").ariaLabel("Delete ServicenowConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intServicenowConfiguration.delete({id:g.servicenowConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.servicenowConfiguration.id}),o.success({title:"ServicenowConfiguration properly deleted!",msg:(g.servicenowConfiguration.name||"servicenowConfiguration")+" has been deleted!"}),v(g.servicenowConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","servicenowConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intServicenowField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intServicenowField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intServicenowField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intServicenowAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.servicenowAccount=c||e.params.servicenowAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoServicenowAccounts=function(){e.go("app.integrations.servicenowAccounts",{},{reload:"app.integrations.servicenowAccounts"})},u.saveServicenowAccount=function(){r.intServicenowAccount.update({id:u.servicenowAccount.id},u.servicenowAccount).$promise.then(function(){l.success({title:"ServicenowAccount updated!",msg:u.servicenowAccount.name?u.servicenowAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintServicenowAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","servicenowAccount","userProfileSection"],angular.module("app.integrations").controller("ServicenowAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.servicenowAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="servicenowAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedServicenowAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.servicenowAccounts.edit",{id:e.id,servicenowAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intServicenowAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ServicenowAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ServicenowAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("servicenowAccount")+"?").htmlContent("<b>"+(e.name||"servicenowAccount")+"</b> will be deleted.").ariaLabel("delete servicenowAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getServicenowAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intServicenowAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ServicenowAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditServicenowAccount=function(e,n){i.show({controller:"CreateOrEditServicenowAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowAccount:n,servicenowAccounts:f.servicenowAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteServicenowAccount=y,f.exportSelectedServicenowAccounts=function(){var e=angular.copy(f.selectedServicenowAccounts);return f.selectedServicenowAccounts=[],e},f.deleteSelectedServicenowAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected servicenowAccounts?").htmlContent("<b>"+f.selectedServicenowAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ServicenowAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedServicenowAccounts.forEach(function(e){y(e)}),f.selectedServicenowAccounts=[]})},f.deselectServicenowAccounts=function(){f.selectedServicenowAccounts=[]},f.selectAllServicenowAccounts=function(){f.selectedServicenowAccounts=f.servicenowAccounts.rows};var b=!0,A=1;function E(e){f.servicenowAccounts=e||{count:0,rows:[]}}function y(e){m.intServicenowAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.servicenowAccounts.rows,{id:e.id}),f.servicenowAccounts.count-=1,f.servicenowAccounts.rows.length||f.getServicenowAccounts(),p.success({title:_.startCase("ServicenowAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintServicenowAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintServicenowAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getServicenowAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","servicenowAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ServicenowAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SUGARCRMACCOUNT",g.sugarcrmAccount=angular.copy(l),g.sugarcrmAccounts=r,g.newSugarcrmAccount=!1,g.sugarcrmAccount||(g.sugarcrmAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SUGARCRMACCOUNT",g.newSugarcrmAccount=!0),g.addNewSugarcrmAccount=function(){g.errors=[],d.intSugarcrmAccount.save(g.sugarcrmAccount).$promise.then(function(e){g.sugarcrmAccounts.unshift(e.toJSON()),o.success({title:"SugarcrmAccount properly created",msg:g.sugarcrmAccount.name?g.sugarcrmAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSugarcrmAccount=function(){g.errors=[],d.intSugarcrmAccount.update({id:g.sugarcrmAccount.id},g.sugarcrmAccount).$promise.then(function(e){var n=_.find(g.sugarcrmAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SugarcrmAccount properly saved!",msg:g.sugarcrmAccount.name?g.sugarcrmAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSugarcrmAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sugarcrmAccount will be deleted.").ariaLabel("Delete SugarcrmAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSugarcrmAccount.delete({id:g.sugarcrmAccount.id}).$promise.then(function(){_.remove(g.sugarcrmAccounts,{id:g.sugarcrmAccount.id}),o.success({title:"SugarcrmAccount properly deleted!",msg:(g.sugarcrmAccount.name||"sugarcrmAccount")+" has been deleted!"}),v(g.sugarcrmAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","sugarcrmAccounts","sugarcrmAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.sugarcrmAccount={},o.sugarcrmConfiguration={},o.configurations=[],o.selectedSugarcrmConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.sugarcrmAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intSugarcrmAccount.getConfigurations({id:o.sugarcrmAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getSugarcrmConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getSugarcrmConfiguration=function(e){o.sugarcrmConfiguration=o.configurations[e],o.selectedSugarcrmConfiguration=e,i.intSugarcrmConfiguration.getSubjects({id:o.sugarcrmConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intSugarcrmConfiguration.getDescriptions({id:o.sugarcrmConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intSugarcrmConfiguration.getFields({id:o.sugarcrmConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditSugarcrmConfiguration=function(e,n){a.show({controller:"CreateOrEditSugarcrmConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSugarcrmConfiguration(0)})},o.deleteSugarcrmConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the sugarcrmConfiguration?").htmlContent("<b>"+(n.name||"sugarcrmConfiguration")+"</b> will be deleted.").ariaLabel("delete sugarcrmConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intSugarcrmConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"SugarcrmConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getSugarcrmConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SugarcrmAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SUGARCRMCONFIGURATION",g.sugarcrmConfiguration=angular.copy(l),g.configurations=r,g.newSugarcrmConfiguration=!1,g.sugarcrmConfiguration||(g.sugarcrmConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_SUGARCRMCONFIGURATION",g.newSugarcrmConfiguration=!0),g.addNewSugarcrmConfiguration=function(){g.errors=[],d.intSugarcrmAccount.addConfiguration({id:n.params.id},g.sugarcrmConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"SugarcrmConfiguration properly created",msg:g.sugarcrmConfiguration.name?g.sugarcrmConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSugarcrmConfiguration=function(){g.errors=[],d.intSugarcrmConfiguration.update({id:g.sugarcrmConfiguration.id},g.sugarcrmConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SugarcrmConfiguration properly saved!",msg:g.sugarcrmConfiguration.name?g.sugarcrmConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSugarcrmConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sugarcrmConfiguration will be deleted.").ariaLabel("Delete SugarcrmConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSugarcrmConfiguration.delete({id:g.sugarcrmConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.sugarcrmConfiguration.id}),o.success({title:"SugarcrmConfiguration properly deleted!",msg:(g.sugarcrmConfiguration.name||"sugarcrmConfiguration")+" has been deleted!"}),v(g.sugarcrmConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","sugarcrmConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSugarcrmField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSugarcrmField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intSugarcrmField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSugarcrmAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.sugarcrmAccount=c||e.params.sugarcrmAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoSugarcrmAccounts=function(){e.go("app.integrations.sugarcrmAccounts",{},{reload:"app.integrations.sugarcrmAccounts"})},u.saveSugarcrmAccount=function(){r.intSugarcrmAccount.update({id:u.sugarcrmAccount.id},u.sugarcrmAccount).$promise.then(function(){l.success({title:"SugarcrmAccount updated!",msg:u.sugarcrmAccount.name?u.sugarcrmAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSugarcrmAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","sugarcrmAccount","userProfileSection"],angular.module("app.integrations").controller("SugarcrmAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.sugarcrmAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="sugarcrmAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSugarcrmAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.sugarcrmAccounts.edit",{id:e.id,sugarcrmAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intSugarcrmAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"SugarcrmAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"SugarcrmAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("sugarcrmAccount")+"?").htmlContent("<b>"+(e.name||"sugarcrmAccount")+"</b> will be deleted.").ariaLabel("delete sugarcrmAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSugarcrmAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intSugarcrmAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SugarcrmAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSugarcrmAccount=function(e,n){i.show({controller:"CreateOrEditSugarcrmAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmAccount:n,sugarcrmAccounts:f.sugarcrmAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSugarcrmAccount=y,f.exportSelectedSugarcrmAccounts=function(){var e=angular.copy(f.selectedSugarcrmAccounts);return f.selectedSugarcrmAccounts=[],e},f.deleteSelectedSugarcrmAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected sugarcrmAccounts?").htmlContent("<b>"+f.selectedSugarcrmAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SugarcrmAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSugarcrmAccounts.forEach(function(e){y(e)}),f.selectedSugarcrmAccounts=[]})},f.deselectSugarcrmAccounts=function(){f.selectedSugarcrmAccounts=[]},f.selectAllSugarcrmAccounts=function(){f.selectedSugarcrmAccounts=f.sugarcrmAccounts.rows};var b=!0,A=1;function E(e){f.sugarcrmAccounts=e||{count:0,rows:[]}}function y(e){m.intSugarcrmAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.sugarcrmAccounts.rows,{id:e.id}),f.sugarcrmAccounts.count-=1,f.sugarcrmAccounts.rows.length||f.getSugarcrmAccounts(),p.success({title:_.startCase("SugarcrmAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSugarcrmAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintSugarcrmAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSugarcrmAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sugarcrmAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("SugarcrmAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_VTIGERACCOUNT",g.vtigerAccount=angular.copy(l),g.vtigerAccounts=r,g.newVtigerAccount=!1,g.vtigerAccount||(g.vtigerAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_VTIGERACCOUNT",g.newVtigerAccount=!0),g.addNewVtigerAccount=function(){g.errors=[],d.intVtigerAccount.save(g.vtigerAccount).$promise.then(function(e){g.vtigerAccounts.unshift(e.toJSON()),o.success({title:"VtigerAccount properly created",msg:g.vtigerAccount.name?g.vtigerAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVtigerAccount=function(){g.errors=[],d.intVtigerAccount.update({id:g.vtigerAccount.id},g.vtigerAccount).$promise.then(function(e){var n=_.find(g.vtigerAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VtigerAccount properly saved!",msg:g.vtigerAccount.name?g.vtigerAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVtigerAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The vtigerAccount will be deleted.").ariaLabel("Delete VtigerAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intVtigerAccount.delete({id:g.vtigerAccount.id}).$promise.then(function(){_.remove(g.vtigerAccounts,{id:g.vtigerAccount.id}),o.success({title:"VtigerAccount properly deleted!",msg:(g.vtigerAccount.name||"vtigerAccount")+" has been deleted!"}),v(g.vtigerAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","vtigerAccounts","vtigerAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.vtigerAccount={},o.vtigerConfiguration={},o.configurations=[],o.selectedVtigerConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.vtigerAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intVtigerAccount.getConfigurations({id:o.vtigerAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getVtigerConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getVtigerConfiguration=function(e){o.vtigerConfiguration=o.configurations[e],o.selectedVtigerConfiguration=e,i.intVtigerConfiguration.getSubjects({id:o.vtigerConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intVtigerConfiguration.getDescriptions({id:o.vtigerConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intVtigerConfiguration.getFields({id:o.vtigerConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditVtigerConfiguration=function(e,n){a.show({controller:"CreateOrEditVtigerConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getVtigerConfiguration(0)})},o.deleteVtigerConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the vtigerConfiguration?").htmlContent("<b>"+(n.name||"vtigerConfiguration")+"</b> will be deleted.").ariaLabel("delete vtigerConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intVtigerConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"VtigerConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getVtigerConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("VtigerAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_VTIGERCONFIGURATION",g.vtigerConfiguration=angular.copy(l),g.configurations=r,g.newVtigerConfiguration=!1,g.vtigerConfiguration||(g.vtigerConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_VTIGERCONFIGURATION",g.newVtigerConfiguration=!0),g.addNewVtigerConfiguration=function(){g.errors=[],d.intVtigerAccount.addConfiguration({id:n.params.id},g.vtigerConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"VtigerConfiguration properly created",msg:g.vtigerConfiguration.name?g.vtigerConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVtigerConfiguration=function(){g.errors=[],d.intVtigerConfiguration.update({id:g.vtigerConfiguration.id},g.vtigerConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VtigerConfiguration properly saved!",msg:g.vtigerConfiguration.name?g.vtigerConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVtigerConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The vtigerConfiguration will be deleted.").ariaLabel("Delete VtigerConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intVtigerConfiguration.delete({id:g.vtigerConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.vtigerConfiguration.id}),o.success({title:"VtigerConfiguration properly deleted!",msg:(g.vtigerConfiguration.name||"vtigerConfiguration")+" has been deleted!"}),v(g.vtigerConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","vtigerConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intVtigerField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intVtigerField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intVtigerField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intVtigerAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.vtigerAccount=c||e.params.vtigerAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoVtigerAccounts=function(){e.go("app.integrations.vtigerAccounts",{},{reload:"app.integrations.vtigerAccounts"})},u.saveVtigerAccount=function(){r.intVtigerAccount.update({id:u.vtigerAccount.id},u.vtigerAccount).$promise.then(function(){l.success({title:"VtigerAccount updated!",msg:u.vtigerAccount.name?u.vtigerAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintVtigerAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","vtigerAccount","userProfileSection"],angular.module("app.integrations").controller("VtigerAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.vtigerAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="vtigerAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedVtigerAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.vtigerAccounts.edit",{id:e.id,vtigerAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intVtigerAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"VtigerAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"VtigerAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("vtigerAccount")+"?").htmlContent("<b>"+(e.name||"vtigerAccount")+"</b> will be deleted.").ariaLabel("delete vtigerAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVtigerAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intVtigerAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VtigerAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVtigerAccount=function(e,n){i.show({controller:"CreateOrEditVtigerAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerAccount:n,vtigerAccounts:f.vtigerAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVtigerAccount=y,f.exportSelectedVtigerAccounts=function(){var e=angular.copy(f.selectedVtigerAccounts);return f.selectedVtigerAccounts=[],e},f.deleteSelectedVtigerAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected vtigerAccounts?").htmlContent("<b>"+f.selectedVtigerAccounts.length+" selected</b> will be deleted.").ariaLabel("delete VtigerAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVtigerAccounts.forEach(function(e){y(e)}),f.selectedVtigerAccounts=[]})},f.deselectVtigerAccounts=function(){f.selectedVtigerAccounts=[]},f.selectAllVtigerAccounts=function(){f.selectedVtigerAccounts=f.vtigerAccounts.rows};var b=!0,A=1;function E(e){f.vtigerAccounts=e||{count:0,rows:[]}}function y(e){m.intVtigerAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.vtigerAccounts.rows,{id:e.id}),f.vtigerAccounts.count-=1,f.vtigerAccounts.rows.length||f.getVtigerAccounts(),p.success({title:_.startCase("VtigerAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintVtigerAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintVtigerAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVtigerAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","vtigerAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("VtigerAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZENDESKACCOUNT",g.zendeskAccount=angular.copy(l),g.zendeskAccounts=r,g.newZendeskAccount=!1,g.zendeskAccount||(g.zendeskAccount={type:"integrationTab",authType:"password",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_ZENDESKACCOUNT",g.newZendeskAccount=!0),g.addNewZendeskAccount=function(){g.errors=[],d.intZendeskAccount.save(g.zendeskAccount).$promise.then(function(e){g.zendeskAccounts.unshift(e.toJSON()),o.success({title:"ZendeskAccount properly created",msg:g.zendeskAccount.name?g.zendeskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZendeskAccount=function(){g.errors=[],d.intZendeskAccount.update({id:g.zendeskAccount.id},g.zendeskAccount).$promise.then(function(e){var n=_.find(g.zendeskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZendeskAccount properly saved!",msg:g.zendeskAccount.name?g.zendeskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZendeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zendeskAccount will be deleted.").ariaLabel("Delete ZendeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZendeskAccount.delete({id:g.zendeskAccount.id}).$promise.then(function(){_.remove(g.zendeskAccounts,{id:g.zendeskAccount.id}),o.success({title:"ZendeskAccount properly deleted!",msg:(g.zendeskAccount.name||"zendeskAccount")+" has been deleted!"}),v(g.zendeskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zendeskAccounts","zendeskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskAccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZendeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZendeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intZendeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZendeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.zendeskAccount=c||e.params.zendeskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoZendeskAccounts=function(){e.go("app.integrations.zendeskAccounts",{},{reload:"app.integrations.zendeskAccounts"})},u.saveZendeskAccount=function(){r.intZendeskAccount.update({id:u.zendeskAccount.id},u.zendeskAccount).$promise.then(function(){l.success({title:"ZendeskAccount updated!",msg:u.zendeskAccount.name?u.zendeskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZendeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","zendeskAccount","userProfileSection"],angular.module("app.integrations").controller("ZendeskAccountController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.zendeskAccount={},o.zendeskConfiguration={},o.zendeskConfigurations=[],o.selectedZendeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.zendeskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intZendeskAccount.getConfigurations({id:o.zendeskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.zendeskConfigurations=e.rows?e.rows:[],o.zendeskConfigurations.length&&o.getZendeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getZendeskConfiguration=function(e){o.zendeskConfiguration=o.zendeskConfigurations[e],o.selectedZendeskConfiguration=e,i.intZendeskConfiguration.getSubjects({id:o.zendeskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intZendeskConfiguration.getDescriptions({id:o.zendeskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intZendeskConfiguration.getFields({id:o.zendeskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intZendeskConfiguration.getTags({id:o.zendeskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditZendeskConfiguration=function(e,n){a.show({controller:"CreateOrEditZendeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskConfiguration:n,zendeskConfigurations:o.zendeskConfigurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZendeskConfiguration(0)})},o.deleteZendeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the zendeskConfiguration?").htmlContent("<b>"+(n.name||"zendeskConfiguration")+"</b> will be deleted.").ariaLabel("delete zendeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intZendeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.zendeskConfigurations,{id:n.id}),s.success({title:"ZendeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getZendeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intZendeskConfiguration.setTags({id:o.zendeskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ZendeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZENDESKCONFIGURATION",g.zendeskConfiguration=angular.copy(l),g.zendeskConfigurations=r,g.newZendeskConfiguration=!1,g.zendeskConfiguration||(g.zendeskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_ZENDESKCONFIGURATION",g.newZendeskConfiguration=!0),g.addNewZendeskConfiguration=function(){g.errors=[],d.intZendeskAccount.addConfiguration({id:n.params.id},g.zendeskConfiguration).$promise.then(function(e){g.zendeskConfigurations.unshift(e.toJSON()),o.success({title:"ZendeskConfiguration properly created",msg:g.zendeskConfiguration.name?g.zendeskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZendeskConfiguration=function(){g.errors=[],d.intZendeskConfiguration.update({id:g.zendeskConfiguration.id},g.zendeskConfiguration).$promise.then(function(e){var n=_.find(g.zendeskConfigurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZendeskConfiguration properly saved!",msg:g.zendeskConfiguration.name?g.zendeskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZendeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zendeskConfiguration will be deleted.").ariaLabel("Delete ZendeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZendeskConfiguration.delete({id:g.zendeskConfiguration.id}).$promise.then(function(){_.remove(g.zendeskConfigurations,{id:g.zendeskConfiguration.id}),o.success({title:"ZendeskConfiguration properly deleted!",msg:(g.zendeskConfiguration.name||"zendeskConfiguration")+" has been deleted!"}),v(g.zendeskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zendeskConfigurations","zendeskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.zendeskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="zendeskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedZendeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayauthType=_.keyBy([{option:"Password",value:"'password'"},{option:"Token",value:"'token'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.zendeskAccounts.edit",{id:e.id,zendeskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intZendeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ZendeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ZendeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("zendeskAccount")+"?").htmlContent("<b>"+(e.name||"zendeskAccount")+"</b> will be deleted.").ariaLabel("delete zendeskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getZendeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intZendeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ZendeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditZendeskAccount=function(e,n){i.show({controller:"CreateOrEditZendeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskAccount:n,zendeskAccounts:f.zendeskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteZendeskAccount=y,f.exportSelectedZendeskAccounts=function(){var e=angular.copy(f.selectedZendeskAccounts);return f.selectedZendeskAccounts=[],e},f.deleteSelectedZendeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected zendeskAccounts?").htmlContent("<b>"+f.selectedZendeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZendeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedZendeskAccounts.forEach(function(e){y(e)}),f.selectedZendeskAccounts=[]})},f.deselectZendeskAccounts=function(){f.selectedZendeskAccounts=[]},f.selectAllZendeskAccounts=function(){f.selectedZendeskAccounts=f.zendeskAccounts.rows};var b=!0,A=1;function E(e){f.zendeskAccounts=e||{count:0,rows:[]}}function y(e){m.intZendeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.zendeskAccounts.rows,{id:e.id}),f.zendeskAccounts.count-=1,f.zendeskAccounts.rows.length||f.getZendeskAccounts(),p.success({title:_.startCase("ZendeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZendeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintZendeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getZendeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zendeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ZendeskAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZOHOACCOUNT",g.zohoAccount=angular.copy(l),g.zohoAccounts=r,g.newZohoAccount=!1,g.zohoAccount||(g.zohoAccount={host:"zoho.com",zone:"EU",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_ZOHOACCOUNT",g.newZohoAccount=!0),g.addNewZohoAccount=function(){g.errors=[],d.intZohoAccount.save(g.zohoAccount).$promise.then(function(e){g.zohoAccounts.unshift(e.toJSON()),o.success({title:"ZohoAccount properly created",msg:g.zohoAccount.name?g.zohoAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZohoAccount=function(){g.errors=[],d.intZohoAccount.update({id:g.zohoAccount.id},g.zohoAccount).$promise.then(function(e){var n=_.find(g.zohoAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZohoAccount properly saved!",msg:g.zohoAccount.name?g.zohoAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZohoAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zohoAccount will be deleted.").ariaLabel("Delete ZohoAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZohoAccount.delete({id:g.zohoAccount.id}).$promise.then(function(){_.remove(g.zohoAccounts,{id:g.zohoAccount.id}),o.success({title:"ZohoAccount properly deleted!",msg:(g.zohoAccount.name||"zohoAccount")+" has been deleted!"}),v(g.zohoAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zohoAccounts","zohoAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.zohoAccount={},o.zohoConfiguration={},o.configurations=[],o.selectedZohoConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.zohoAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intZohoAccount.getConfigurations({id:o.zohoAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getZohoConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getZohoConfiguration=function(e){o.zohoConfiguration=o.configurations[e],o.selectedZohoConfiguration=e,i.intZohoConfiguration.getSubjects({id:o.zohoConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intZohoConfiguration.getDescriptions({id:o.zohoConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intZohoConfiguration.getFields({id:o.zohoConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditZohoConfiguration=function(e,n){a.show({controller:"CreateOrEditZohoConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZohoConfiguration(0)})},o.deleteZohoConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the zohoConfiguration?").htmlContent("<b>"+(n.name||"zohoConfiguration")+"</b> will be deleted.").ariaLabel("delete zohoConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intZohoConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"ZohoConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getZohoConfiguration(0)})},function(){console.log("CANCEL")})},o.selectChangedAdvanced=function(){i.intZohoConfiguration.update({id:o.zohoConfiguration.id},o.zohoConfiguration).$promise.then(function(){s.success({title:"Module updated!",msg:"Module has been updated!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ZohoAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZOHOCONFIGURATION",g.zohoConfiguration=angular.copy(l),g.configurations=r,g.newZohoConfiguration=!1,g.zohoConfiguration||(g.zohoConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_ZOHOCONFIGURATION",g.newZohoConfiguration=!0),g.addNewZohoConfiguration=function(){g.errors=[],d.intZohoAccount.addConfiguration({id:n.params.id},g.zohoConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"ZohoConfiguration properly created",msg:g.zohoConfiguration.name?g.zohoConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZohoConfiguration=function(){g.errors=[],d.intZohoConfiguration.update({id:g.zohoConfiguration.id},g.zohoConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZohoConfiguration properly saved!",msg:g.zohoConfiguration.name?g.zohoConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZohoConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zohoConfiguration will be deleted.").ariaLabel("Delete ZohoConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZohoConfiguration.delete({id:g.zohoConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.zohoConfiguration.id}),o.success({title:"ZohoConfiguration properly deleted!",msg:(g.zohoConfiguration.name||"zohoConfiguration")+" has been deleted!"}),v(g.zohoConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","zohoConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZohoField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZohoField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intZohoField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZohoAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.zohoAccount=c||e.params.zohoAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoZohoAccounts=function(){e.go("app.integrations.zohoAccounts",{},{reload:"app.integrations.zohoAccounts"})},u.saveZohoAccount=function(){r.intZohoAccount.update({id:u.zohoAccount.id},u.zohoAccount).$promise.then(function(){l.success({title:"ZohoAccount updated!",msg:u.zohoAccount.name?u.zohoAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZohoAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","zohoAccount","userProfileSection"],angular.module("app.integrations").controller("ZohoAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.zohoAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="zohoAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedZohoAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arrayhost=_.keyBy([{option:"zoho.com",value:"'zoho.com'"},{option:"zoho.eu",value:"'zoho.eu'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayzone=_.keyBy([{option:"US",value:"'US'"},{option:"AU",value:"'AU'"},{option:"EU",value:"'EU'"},{option:"IN",value:"'IN'"},{option:"CN",value:"'CN'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.zohoAccounts.edit",{id:e.id,zohoAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intZohoAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ZohoAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ZohoAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("zohoAccount")+"?").htmlContent("<b>"+(e.name||"zohoAccount")+"</b> will be deleted.").ariaLabel("delete zohoAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getZohoAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intZohoAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ZohoAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditZohoAccount=function(e,n){i.show({controller:"CreateOrEditZohoAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoAccount:n,zohoAccounts:f.zohoAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteZohoAccount=y,f.exportSelectedZohoAccounts=function(){var e=angular.copy(f.selectedZohoAccounts);return f.selectedZohoAccounts=[],e},f.deleteSelectedZohoAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected zohoAccounts?").htmlContent("<b>"+f.selectedZohoAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZohoAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedZohoAccounts.forEach(function(e){y(e)}),f.selectedZohoAccounts=[]})},f.deselectZohoAccounts=function(){f.selectedZohoAccounts=[]},f.selectAllZohoAccounts=function(){f.selectedZohoAccounts=f.zohoAccounts.rows};var b=!0,A=1;function E(e){f.zohoAccounts=e||{count:0,rows:[]}}function y(e){m.intZohoAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.zohoAccounts.rows,{id:e.id}),f.zohoAccounts.count-=1,f.zohoAccounts.rows.length||f.getZohoAccounts(),p.success({title:_.startCase("ZohoAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZohoAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintZohoAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getZohoAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zohoAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ZohoAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="JSCRIPTY.EDIT_PROJECT",g.project=angular.copy(l),g.projects=r,g.newProject=!1,g.project||(g.project={enableUncompleteSave:!0,sendUnpauseOnSubmit:!0},g.title="JSCRIPTY.NEW_PROJECT",g.newProject=!0),g.addNewProject=function(){g.errors=[],d.jscriptyProject.save(g.project).$promise.then(function(e){g.projects.unshift(e.toJSON()),o.success({title:"Project properly created",msg:g.project.name?g.project.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveProject=function(){g.errors=[],d.jscriptyProject.update({id:g.project.id},g.project).$promise.then(function(e){var n=_.find(g.projects,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Project properly saved!",msg:g.project.name?g.project.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteProject=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.jscriptyProject.delete({id:g.project.id}).$promise.then(function(){_.remove(g.projects,{id:g.project.id}),o.success({title:"Project properly deleted!",msg:(g.project.name||"project")+" has been deleted!"}),v(g.project)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","projects","project","api","Auth","license","setting","crudPermissions"],angular.module("app.jscripty").controller("CreateOrEditProjectDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o){var r=this;r.currentUser=i.getCurrentUser(),r.project={},r.localizationMap=o;var l=new Date;r.pickerModel={dateStart:new Date(l.getFullYear(),l.getMonth(),1),dateEnd:new Date(l.getFullYear(),l.getMonth()+1,0),selectedTemplate:"TM"},r.init=function(e,n){r.project=e,r.userProfile=n,r.getAnswers()},r.getSummary=function(){return a.jscriptyProject.getSummary({id:r.project.id,startTime:{$gte:r.pickerModel.dateStart,$lte:moment(r.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format()},nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","jscriptyProjectSummary_"+r.project.id+".csv"),a.click()}else s.info({title:"EXPORT",msg:"No answers available"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.getSummary",msg:e.data?JSON.stringify(e.data):e.toString()})})},r.getAnswers=function(){return r.hasIdAnswers=!1,a.jscriptyProject.getAnswers({id:r.project.id,sort:"-createdAt,questionId",createdAt:{$gte:moment(r.pickerModel.dateStart).add(0,"hours").add(0,"minutes").add(0,"seconds").utcOffset(0,!0).format(),$lte:moment(r.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").utcOffset(0,!0).format()},nolimit:!0}).$promise.then(function(e){if(e&&e.rows&&e.hasOwnProperty("count")){r.answers={};for(var n=0,t=e.count;n<t;n++)e.rows[n].questionId&&(r.hasIdAnswers=!0,r.answers.hasOwnProperty(e.rows[n].questionId)||(r.answers[e.rows[n].questionId]={question:e.rows[n].question,answers:{},sum:0}),""===e.rows[n].answer&&(e.rows[n].answer="NO_ANSWER"),r.answers[e.rows[n].questionId].answers[e.rows[n].answer]?r.answers[e.rows[n].questionId].answers[e.rows[n].answer]+=1:r.answers[e.rows[n].questionId].answers[e.rows[n].answer]=1,r.answers[e.rows[n].questionId].sum+=1)}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETANSWERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$mdDialog","$document","$window","api","Auth","toasty","dateFilterLocalizationFactory"],angular.module("app.jscripty").controller("ProjectAnswersController",e)}(),function(){"use strict";angular.module("app.jscripty").controller("ProjectBuilderController",function(){var n=this;n.project={},n.optionsBuilder={questionTypes:["text","textarea","radio","checkbox","select","number","date","time","email","range","url"],elementTypes:["question","paragraph"]},n.init=function(e){n.project=e,_.isObjectLike(e.formData)?n.project.formData=e.formData:n.isJsonString(e.formData)?n.project.formData=JSON.parse(e.formData):n.project.formData={}},n.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0}})}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newProject=!0,r.project=angular.copy(i),r.projects=s,r.title=o.instant("JSCRIPTY.CLONE_PROJECT"),i&&i.name&&(r.title+=": "+i.name),r.cloneProject=function(){return e.jscriptyProject.clone({id:i.id},r.project).$promise.then(function(e){r.projects.unshift(e.toJSON()),a.success({title:"Project properly cloned",msg:r.project.name?r.project.name+" has been cloned!":""}),t.go("app.jscripty.projects.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","project","projects","$translate"],angular.module("app.jscripty").controller("ProjectcloneController",e)}(),function(){"use strict";function e(a,i,n){var o=this;o.project={},o.responseData={},o.formViewer={},o.init=function(e){o.project=e,n.$on("mwForm.pageEvents.pageCurrentChanged",function(e,n){if(n.currentPage&&o.project.formData&&o.project.formData.pages)for(var t=0,a=o.project.formData.pages.length;t<a;t++)if(n.currentPage.number<t+1&&o.project.formData.pages[t].elements)for(var i=0,s=o.project.formData.pages[t].elements.length;i<s;i++)"question"===o.project.formData.pages[t].elements[i].type&&o.project.formData.pages[t].elements[i].question&&delete o.responseData[o.project.formData.pages[t].elements[i].question.id]})},o.onSubmit=function(e){var n=a.defer(),t=i.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("SAVE").cancel("CANCEL");return i.show(t).then(function(){n.resolve(!0)},function(){n.reject()}),n.promise},o.resetViewer=function(){o.formViewer.reset&&o.formViewer.reset()}}e.$inject=["$q","$mdDialog","$scope"],angular.module("app.jscripty").controller("ProjectViewerController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.projectSessions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.jscriptyProject.getSessions(m.query,u).$promise}function g(e){d.jscriptySessionReport.delete({id:e.id}).$promise.then(function(){_.remove(m.projectSessions.rows,{id:e.id}),m.projectSessions.count-=1,m.projectSessions.rows.length||p(),l.success({title:"Session deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETjscriptyProject"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.project={},m.projectSessions={count:0,rows:[]},m.selectedProjectSessions=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,starttime,endtime,membername,calleridnum,completed",sort:"-starttime",limit:10,page:1},m.init=function(e,n,t){m.project=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.id=m.project.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the session?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("session #")+e.id||"session")+"</b> will be deleted.").ariaLabel("delete session").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getProjectSessions=p,m.createOrEditProjectSession=function(e,n){o.show({controller:"CreateOrEditSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:m.project,session:n,sessions:m.projectSessions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.showQuestionsProjectSession=function(e,t){o.show({controller:"ShowQuestionsSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{questions:["apiResolver","$stateParams",function(e,n){return e.resolve("jscriptySessionReport@getQuestions",{fields:"question,answer",sort:"id",id:t.id})}]},locals:{project:m.project,session:t}})},m.exportSelectedProjectSessions=function(){var e=angular.copy(m.selectedProjectSessions);return m.selectedProjectSessions=[],e},m.deleteProjectSession=g,m.deleteSelectedProjectSessions=function(e){var n=o.confirm().title("Are you sure want to delete the selected sessions?").htmlContent("<b>"+m.selectedProjectSessions.length+" selected</b> will be deleted.").ariaLabel("delete sessions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedProjectSessions.forEach(function(e){g(e)}),m.selectedProjectSessions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.jscripty").controller("ProjectSessionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){this.title="JSCRIPTY.SESSION_RESULTS",this.session=s,this.questions=o,this.project=r,this.closeDialog=function(e){a.hide(e)}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","session","questions","project","api"],angular.module("app.jscripty").controller("ShowQuestionsSessionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.project=c||e.params.project||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.clonedialog=function(e,n){t.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{project:e,projects:p.projects?p.projects.rows:[],crudPermissions:p.crudPermissions}})},p.alert=l.info,p.gotoProjects=function(){e.go("app.jscripty.projects",{},{reload:"app.jscripty.projects"})},p.saveProject=function(){r.jscriptyProject.update({id:p.project.id},p.project).$promise.then(function(){l.success({title:"Project updated!",msg:p.project.name?p.project.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","project","userProfile","userProfileSection"],angular.module("app.jscripty").controller("JscriptyProjectController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.projects=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="projects",f.listOrder="",f.listOrderAsc=null,f.selectedProjects=[],f.query={fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.jscripty.projects.edit",{id:e.id,project:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{project:e,projects:f.projects?f.projects.rows:[],crudPermissions:f.crudPermissions}})},f.sessionsgoto=function(e,n){t.go("app.jscripty.projects.edit",{id:e.id,tab:3})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("project")+"?").htmlContent("<b>"+(e.name||"project")+"</b> will be deleted.").ariaLabel("delete project").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getProjects=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.jscriptyProject.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Projects",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditProject=function(e,n){i.show({controller:"CreateOrEditProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:n,projects:f.projects.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteProject=y,f.exportSelectedProjects=function(){var e=angular.copy(f.selectedProjects);return f.selectedProjects=[],e},f.deleteSelectedProjects=function(e){var n=i.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+f.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedProjects.forEach(function(e){y(e)}),f.selectedProjects=[]})},f.deselectProjects=function(){f.selectedProjects=[]},f.selectAllProjects=function(){f.selectedProjects=f.projects.rows};var b=!0,A=1;function E(e){f.projects=e||{count:0,rows:[]}}function y(e){m.jscriptyProject.delete({id:e.id}).$promise.then(function(){_.remove(f.projects.rows,{id:e.id}),f.projects.count-=1,f.projects.rows.length||f.getProjects(),p.success({title:_.startCase("Project")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEjscriptyProject"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getProjects())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","projects","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.jscripty").controller("JscriptyProjectsController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d,c,m,u){var p,g=this;function v(e){t.hide(e)}g.currentUser=l.getCurrentUser(),g.errors=[],g.setting=c,g.license=d,g.crudPermissions=m,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.mailAccount=angular.copy(s),g.mailAccounts=n,g.cloudProviders=o,g.providers=u.getEmailProviders(),g.newMailAccount=!1,g.mailAccount||(g.mailAccount={active:!0,service:"null",authentication:!0,fontSize:13,waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.newMailAccount=!0),e.params.id&&(g.mailAccount.MailAccountId=e.params.id),g.addNewMailAccount=function(){g.errors=[],r.mailAccount.save(g.mailAccount).$promise.then(function(e){g.mailAccounts.unshift(e.toJSON()),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_CREATED_SUCCESS_TITLE")}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailAccount=function(){g.errors=[],r.mailAccount.update({id:g.mailAccount.id},g.mailAccount).$promise.then(function(e){var n=_.find(g.mailAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_SAVED_SUCCESS_TITLE")}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailAccount=function(e){if(g.mailAccount.service)return i.error({title:"Mail Account not deleted!",msg:"You can't remove service account"});g.errors=[];var n=t.confirm().title(a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_TITLE")).content(a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_MESSAGE",{name:g.mailAccount.name})).ariaLabel("Delete Mail Account").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){r.mailAccount.delete({id:g.mailAccount.id}).$promise.then(function(){_.remove(g.mailAccounts,{id:g.mailAccount.id}),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETED_SUCCESS_TITLE")}),v(g.mailAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.onProviderChange=function(){"custom"!==g.mailAccount.provider&&(g.mailAccount.authentication=!0);"outlook365"!==g.mailAccount.provider&&(g.mailAccount.modernAuthentication=!1)},g.closeDialog=v,p=[{key:"id",value:Number(g.mailAccount.ListId)}],r.getResourcesByRole(g.currentUser,"cmList",{fields:"id,name",sort:"name",nolimit:"true"},p).then(function(e){g.lists=e.rows}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$mdDialog","$translate","toasty","mailAccounts","mailAccount","cloudProviders","api","Auth","license","setting","crudPermissions","msUtils"],angular.module("app.mail").controller("CreateOrEditMailAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.mailAccountApps.rows.length){var t=r.mailAccountApps.rows[n]?r.mailAccountApps.rows[n]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccountApp:t,mailAccount:r.mailAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.mailAccountApps.rows[n]=e:r.mailAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.mailAccountApps.rows.length;t++,0){var a=r.mailAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.mailAccount.context,a.exten=r.mailAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.mailAccount.addApplications({id:r.mailAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.mailAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.mailAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.mailAccount={},r.mailAccountApps={count:0,rows:[]},r.selectedMailAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"MailQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"mailQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:601}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Reply_Type",name:"replyType",type:"select",defaultValue:"1",values:[{option:"Reply",value:"0"},{option:"Reply All",value:"1"}],required:!0,param:1},{title:"Text",name:"text",type:"html",required:!0,param:2}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.mailAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getMailAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.mailAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getMailAccountApps=function(){r.promise=o.mailAccount.getApplications(r.query,t).$promise},r.editMailAccountApp=n,r.editInterval=function(e,n){if(r.mailAccountApps.rows.length){var t=r.mailAccountApps.rows[n]?r.mailAccountApps.rows[n]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteMailAccountApp=function(e){_.remove(r.mailAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedMailAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedMailAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedMailAccountApps.forEach(function(e){_.remove(r.mailAccountApps.rows,{id:e.id})}),r.selectedMailAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.mail").controller("MailAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailAccount.getAgents({id:c.mailAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserMailAccount?"penalty "+e.UserMailAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.mailAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailAccount.removeAgents({id:c.mailAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailAccount.addAgents({id:c.mailAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","mailAccount","mailAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.agent.text=d.slice(2,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.autoreply.text=d.slice(2,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.replyType=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.autoreply.text=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.autoreply.times=1,l.autoreply.replyType=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.replyType,e[2]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.close.text=d.slice(2,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.gotoif.text=d.slice(2,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.gotop.text=d.slice(2,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditMailAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.noop.text=d.slice(2,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.queue.text=d.slice(2,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("mail")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.mailQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.mailQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:601}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.system.text=d.slice(2,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.tag.text=d.slice(2,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"mailAccount",action:"getDispositions",field:"name",params:{id:m.mailAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.mailAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.mailAccountInteractions.rows.length;n+=1){var t=m.mailAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,(void 0===m.query.closed||null===m.query.closed||m.query.closed)&&delete m.query.substatus,m.promise=d.mailInteraction.get(m.query,p).$promise}function v(e){d.mailInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.mailAccountInteractions.rows,{id:e.id}),m.mailAccountInteractions.count-=1,m.mailAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){_.isEmpty(e.to)||_.includes(e.to,m.mailAccount.email)?e.contactInfo=e.Contact?e.Contact.email:void 0:(e.contactName=e.to.split(" <")[0],e.contactInfo=e.to.split("<").pop().split(">")[0]),"Unknown"===e.contactName&&(e.contactName=i.instant("MAIL.UNKNOWN"))}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.mailAccount={},m.mailAccountInteractions={count:0,rows:[]},m.selectedMailAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.mailAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.MailAccountId=m.mailAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"plainBody",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Substatus",column:"substatus",type:"multiselect",options:{field:"name",route:{model:"mailSubstatus",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return d.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){m.subStatuses=e||{count:0,rows:[]}})}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Substatus",key:"substatus",type:"select",label:"DASHBOARDS.SELECT_SUBSTATUS",options:m.subStatuses.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NONE"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name",ngIf:"closed === 0"},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.mailInteractionDownload=function(s,e,n){return d.mailInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="mail-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getMailAccountInteractions=g,m.createOrEditMailAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:m.mailAccount,interaction:n,interactions:m.mailAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spymailInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"mail",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"mail.mailAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||MailAccountId:=$eq["+m.mailAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedMailAccountInteractions=function(){var e=angular.copy(m.selectedMailAccountInteractions);return m.selectedMailAccountInteractions=[],e},m.deleteMailAccountInteraction=v,m.deleteSelectedMailAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedMailAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMailAccountInteractions.forEach(function(e){v(e)}),m.selectedMailAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.mailAccountMailCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.mailAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.mailAccountMailCannedAnswers.rows,{id:e.id}),m.mailAccountMailCannedAnswers.count-=1,m.mailAccountMailCannedAnswers.rows.length||p(),l.success({title:"MailCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.mailAccount={},m.mailAccountMailCannedAnswers={count:0,rows:[]},m.selectedMailAccountMailCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.mailAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.MailAccountId=m.mailAccount.id,m.query.id=m.mailAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the mailCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("mailCannedAnswer #")+e.id||"mailCannedAnswer")+"</b> will be deleted.").ariaLabel("delete mailCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getMailAccountMailCannedAnswers=p,m.createOrEditMailAccountMailCannedAnswer=function(e,n){o.show({controller:"CreateOrEditMailCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:m.mailAccount,mailCannedAnswer:n,mailCannedAnswers:m.mailAccountMailCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedMailAccountMailCannedAnswers=function(){var e=angular.copy(m.selectedMailAccountMailCannedAnswers);return m.selectedMailAccountMailCannedAnswers=[],e},m.deleteMailAccountMailCannedAnswer=g,m.deleteSelectedMailAccountMailCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected mailCannedAnswers?").htmlContent("<b>"+m.selectedMailAccountMailCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete mailCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMailAccountMailCannedAnswers.forEach(function(e){g(e)}),m.selectedMailAccountMailCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountMailCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILCANNEDANSWER",g.mailCannedAnswer=angular.copy(l),g.mailCannedAnswers=r,g.newMailCannedAnswer=!1,g.mailCannedAnswer||(g.mailCannedAnswer={},g.title="MAIL.NEW_MAILCANNEDANSWER",g.newMailCannedAnswer=!0),n.params.id&&(g.mailCannedAnswer.MailAccountId=n.params.id),g.addNewMailCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.mailCannedAnswer).$promise.then(function(e){g.mailCannedAnswers.unshift(e.toJSON()),o.success({title:"MailCannedAnswer properly created",msg:g.mailCannedAnswer.name?g.mailCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.mailCannedAnswer.id},g.mailCannedAnswer).$promise.then(function(e){var n=_.find(g.mailCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailCannedAnswer properly saved!",msg:g.mailCannedAnswer.name?g.mailCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailCannedAnswer will be deleted.").ariaLabel("Delete MailCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.mailCannedAnswer.id}).$promise.then(function(){_.remove(g.mailCannedAnswers,{id:g.mailCannedAnswer.id}),o.success({title:"MailCannedAnswer properly deleted!",msg:(g.mailCannedAnswer.name||"mailCannedAnswer")+" has been deleted!"}),v(g.mailCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailCannedAnswers","mailCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.mailAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.mailAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.MailAccountId=m.mailAccount.id,m.query.id=m.mailAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.mailAccount.id,field:"MailAccountId",route:"mailAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.mail").controller("MailAccountDispositionsController",e)}(),function(){"use strict";function e(t,a,i,s,e,n,o,r,l,d,c,m,u,p,g){var v,h,f=this;f.currentUser=d.getCurrentUser(),f.license=n,f.setting=o,f.passwordPattern=f.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",f.mailAccount=c||t.params.mailAccount||{},f.cloudProviders=m||{rows:[],count:0},f.userProfile=u,f.userProfileSection=p&&1==p.count?p.rows[0]:null,f.crudPermissions=d.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.hasModulePermissions={},f.selectedTab=t.params.tab||0,f.providers=g.getEmailProviders(),f.originalProvider=f.mailAccount.provider,f.goToRealtime=function(){return d.hasRole("admin")?t.go("app.mail.realtime.accounts",{}):r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n&&n.enabled)return t.go("app.mail.realtime.accounts",{});l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})})},f.addAgent=function(e,n){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:f.mailAccounts?f.mailAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.goToMailAccounts=function(){t.go("app.mail.mailAccounts",{},{reload:"app.mail.mailAccounts"})},f.saveMailAccount=function(){var e=angular.copy(f.mailAccount);"custom"===e.provider?e.provider=null:(f.originalProvider!==e.provider&&(e.Imap.modernAuthentication?e.Imap.password=null:e.Imap.CloudProviderId=null),e.Smtp.user=e.Imap.user,e.Smtp.pass=e.Imap.password,e.Imap.modernAuthentication||(e.Imap.CloudProviderId=null),e.Smtp.modernAuthentication=e.Imap.modernAuthentication,e.Smtp.CloudProviderId=e.Imap.CloudProviderId,e.Imap=_.omit(e.Imap,["host","port","service"]),e.Smtp=_.omit(e.Smtp,["host","port","secure","service"]));r.mailAccount.update({id:f.mailAccount.id},e).$promise.then(function(){f.originalProvider=e.provider,l.success({title:s.instant("MAIL.NOTIFICATIONS.ACCOUNT_SAVED_SUCCESS_TITLE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.onProviderChange=function(){"custom"!==f.mailAccount.provider&&(f.mailAccount.authentication=!0);"outlook365"!==f.mailAccount.provider&&(f.mailAccount.Imap.modernAuthentication=!1)},e.all((h=[{key:"id",value:Number(f.mailAccount.ListId)}],r.getResourcesByRole(f.currentUser,"cmList",{fields:"id,name",sort:"name",nolimit:"true"},h).then(function(e){f.lists=e.rows}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})),(v=[{key:"id",value:Number(f.mailAccount.mandatoryDispositionPauseId)}],r.getResourcesByRole(f.currentUser,"pause",{fields:"id,name",sort:"name",nolimit:"true"},v).then(function(e){f.pauses=e.rows}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))}e.$inject=["$state","$mdDialog","$document","$translate","$q","license","setting","api","toasty","Auth","mailAccount","cloudProviders","userProfile","userProfileSection","msUtils"],angular.module("app.mail").controller("MailAccountController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,n,r,l,d,c,m,u,p){var g=this;function v(e){g.mailAccounts=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.hasRole("admin")?g.promise=d.mailAccount.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="MailAccounts",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){if(e.service)return c.error({msg:o.instant("MAIL.NOTIFICATIONS.ACCOUNT_SERVICE_DELETE")});d.mailAccount.delete({id:e.id}).$promise.then(function(){_.remove(g.mailAccounts.rows,{id:e.id}),g.mailAccounts.count-=1,g.mailAccounts.rows.length||h(),c.success({title:o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailAccount"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.mailAccounts=n||{count:0,rows:[]},g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedMailAccounts=[],g.query={fields:"createdAt,updatedAt,id,name,key,email,ListId,active,cservice,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},g.editstate=function(e){t.go("app.mail.mailAccounts.edit",{id:e.id,mailAccount:e,crudPermissions:g.crudPermissions})},g.verifySMTP=function(e){return e&&e.id?d.mailAccount.verifySmtp({id:e.id}).$promise.then(function(){c.success({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_SUCCESS_TITLE")})}).catch(function(e){c.error({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:e.data?JSON.stringify(e.data):e.toString()})}):c.error({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:o.instant("MAIL.NOTIFICATIONS.UNKNOWN_SMTP_SERVER")})},g.goToInteractions=function(e){t.go("app.mail.mailAccounts.edit",{id:e.id,tab:"custom"===e.provider?7:6})},g.goToRealtime=function(){return m.hasRole("admin")?t.go("app.mail.realtime.accounts",{}):d.userProfileSection.get({userProfileId:m.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n&&n.enabled)return t.go("app.mail.realtime.accounts",{});c.info({title:o.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:o.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})})},g.addAgent=function(e,n){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:g.mailAccounts?g.mailAccounts.rows:[],crudPermissions:g.crudPermissions,realtime:!1}})},g.deleteconfirm=function(e,n){var t=a.confirm().title(o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_TITLE")).content(o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_MESSAGE",{name:e.name})).ariaLabel("delete mail account").targetEvent(n).ok("OK").cancel(o.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.success=v,g.getMailAccounts=h,g.createOrEditMailAccount=function(e,n){a.show({controller:"CreateOrEditMailAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:n,mailAccounts:g.mailAccounts.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions},resolve:{cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}]}})},g.deleteMailAccount=f,g.exportSelectedMailAccounts=function(){var e=angular.copy(g.selectedMailAccounts);return g.selectedMailAccounts=[],e},g.deleteSelectedMailAccounts=function(e){var n=a.confirm().title(o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETE_TITLE")).content(o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETE_MESSAGE",{total:g.selectedMailAccounts.length})).ariaLabel("delete mail accounts").targetEvent(e).ok("OK").cancel(o.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedMailAccounts.forEach(function(e){f(e)}),g.selectedMailAccounts=[],c.success({title:o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETED_SUCCESS_TITLE")})})},g.deselectMailAccounts=function(){g.selectedMailAccounts=[]},g.selectAllMailAccounts=function(){g.selectedMailAccounts=g.mailAccounts.rows};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?s(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","mailAccounts","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="MAIL.EDIT_MAILQUEUE",r.mailQueue=angular.copy(n),r.mailQueues=e,r.newMailQueue=!1,r.mailQueue||(r.mailQueue={strategy:"beepall",timeout:10},r.title="MAIL.NEW_MAILQUEUE",r.newMailQueue=!0),r.addNewMailQueue=function(){r.errors=[],i.mailQueue.save(r.mailQueue).$promise.then(function(e){r.mailQueues.unshift(e.toJSON()),a.success({title:"MailQueue properly created",msg:r.mailQueue.name?r.mailQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveMailQueue=function(){r.errors=[],i.mailQueue.update({id:r.mailQueue.id},r.mailQueue).$promise.then(function(e){var n=_.find(r.mailQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"MailQueue properly saved!",msg:r.mailQueue.name?r.mailQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteMailQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The mailQueue will be deleted.").ariaLabel("Delete MailQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.mailQueue.delete({id:r.mailQueue.id}).$promise.then(function(){_.remove(r.mailQueues,{id:r.mailQueue.id}),a.success({title:"MailQueue properly deleted!",msg:(r.mailQueue.name||"mailQueue")+" has been deleted!"}),l(r.mailQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","mailQueues","mailQueue","api","Auth","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailQueue.getAgents({id:c.mailQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserMailQueue?"penalty "+e.UserMailQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.mailQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.removeAgents({id:c.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.addAgents({id:c.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","mailQueue","mailQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailQueue.getTeams({id:l.mailQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.mailQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MAIL.ALL_TEAMS"),labelSelected:t.instant("MAIL.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.removeTeams({id:l.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.addTeams({id:l.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","mailQueue","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.mailQueue=c||e.params.mailQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoMailQueues=function(){e.go("app.mail.mailQueues",{},{reload:"app.mail.mailQueues"})},u.saveMailQueue=function(){r.mailQueue.update({id:u.mailQueue.id},u.mailQueue).$promise.then(function(){l.success({title:"MailQueue updated!",msg:u.mailQueue.name?u.mailQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","mailQueue","userProfileSection"],angular.module("app.mail").controller("MailQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.mailQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="mailQueues",f.listOrder="",f.listOrderAsc=null,f.selectedMailQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.mail.mailQueues.edit",{id:e.id,mailQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:f.mailQueues?f.mailQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:f.mailQueues?f.mailQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("mailQueue")+"?").htmlContent("<b>"+(e.name||"mailQueue")+"</b> will be deleted.").ariaLabel("delete mailQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.mail.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.mail.realtime.queues",{})}},f.success=E,f.getMailQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.mailQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MailQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMailQueue=function(e,n){i.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:n,mailQueues:f.mailQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteMailQueue=y,f.exportSelectedMailQueues=function(){var e=angular.copy(f.selectedMailQueues);return f.selectedMailQueues=[],e},f.deleteSelectedMailQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected mailQueues?").htmlContent("<b>"+f.selectedMailQueues.length+" selected</b> will be deleted.").ariaLabel("delete MailQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMailQueues.forEach(function(e){y(e)}),f.selectedMailQueues=[]})},f.deselectMailQueues=function(){f.selectedMailQueues=[]},f.selectAllMailQueues=function(){f.selectedMailQueues=f.mailQueues.rows};var b=!0,A=1;function E(e){f.mailQueues=e||{count:0,rows:[]}}function y(e){m.mailQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.mailQueues.rows,{id:e.id}),f.mailQueues.count-=1,f.mailQueues.rows.length||f.getMailQueues(),p.success({title:_.startCase("MailQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMailQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILSUBSTATUS",g.mailSubstatus=angular.copy(l),g.mailSubtatuses=r,g.newMailSubstatus=!1,g.mailSubstatus||(g.mailSubstatus={},g.title="MAIL.NEW_MAILSUBSTATUS",g.newMailSubstatus=!0),g.addNewMailSubstatus=function(){g.errors=[],d.mailSubstatus.save(g.mailSubstatus).$promise.then(function(e){g.mailSubtatuses.unshift(e.toJSON()),o.success({title:"MailSubstatus properly created",msg:g.mailSubstatus.name?g.mailSubstatus.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailSubstatus=function(){g.errors=[],d.mailSubstatus.update({id:g.mailSubstatus.id},g.mailSubstatus).$promise.then(function(e){var n=_.find(g.mailSubtatuses,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailSubstatus properly saved!",msg:g.mailSubstatus.name?g.mailSubstatus.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailSubstatus=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailSubstatus will be deleted.").ariaLabel("Delete MailSubstatus").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.mailSubstatus.delete({id:g.mailSubstatus.id}).$promise.then(function(){_.remove(g.mailSubtatuses,{id:g.mailSubstatus.id}),o.success({title:"MailSubstatus properly deleted!",msg:(g.mailSubstatus.name||"mailSubstatus")+" has been deleted!"}),v(g.mailSubstatus)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailSubtatuses","mailSubstatus","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailSubstatusDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.mailSubtatuses=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="mailSubtatuses",f.listOrder="",f.listOrderAsc=null,f.selectedMailSubstatuses=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailSubstatus:e,mailSubtatuses:f.mailSubtatuses.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("mailSubstatus")+"?").htmlContent("<b>"+(e.name||"mailSubstatus")+"</b> will be deleted.").ariaLabel("delete mailSubstatus").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMailSubstatuses=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.mailSubstatus.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MailSubstatuses",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMailSubstatus=function(e,n){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailSubstatus:n,mailSubtatuses:f.mailSubtatuses.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMailSubstatus=y,f.exportSelectedMailSubstatuses=function(){var e=angular.copy(f.selectedMailSubstatuses);return f.selectedMailSubstatuses=[],e},f.deleteSelectedMailSubstatuses=function(e){var n=i.confirm().title("Are you sure want to delete the selected mailSubtatuses?").htmlContent("<b>"+f.selectedMailSubstatuses.length+" selected</b> will be deleted.").ariaLabel("delete MailSubstatuss").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMailSubstatuses.forEach(function(e){y(e)}),f.selectedMailSubstatuses=[]})},f.deselectMailSubstatuses=function(){f.selectedMailSubstatuses=[]},f.selectAllMailSubstatuses=function(){f.selectedMailSubstatuses=f.mailSubtatuses.rows};var b=!0,A=1;function E(e){f.mailSubtatuses=e||{count:0,rows:[]}}function y(e){m.mailSubstatus.delete({id:e.id}).$promise.then(function(){_.remove(f.mailSubtatuses.rows,{id:e.id}),f.mailSubtatuses.count-=1,f.mailSubtatuses.rows.length||f.getMailSubstatuses(),p.success({title:_.startCase("MailSubstatus")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailSubstatus"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailSubstatus",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMailSubstatuses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailSubtatuses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailSubstatusesController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d){var c=this,m=d&&1==d.count?d.rows[0].crudPermissions:null;function u(){c.mailAccounts.rows.forEach(function(n){var e=_.find(c.rpcMailAccounts.rows,["id",n.id]);e&&_.merge(n,e);var t={id:n.id,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),fields:"id,createdAt"};i.mailAccount.getMessages(t).$promise.then(function(e){return e&&(n.in=e.count||0,n.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),t.direction="out",i.mailAccount.getMessages(t).$promise}).then(function(e){e&&(n.out=e.count||0,n.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){o.error(e.data?e.data.message:e.toString())})})}function p(e){var n=_.find(c.mailAccounts.rows,["id",e.id]);n&&_.merge(n,e)}function g(e){c.mailAccounts.rows=e.rows,u()}function v(){c.query.offset=(c.query.page-1)*c.query.limit,n.hasRole("admin")?c.promise=i.mailAccount.get(c.query,g).$promise:(c.query.id=c.currentUser.userProfileId,c.query.section="MailAccounts",c.promise=i.userProfile.getResources(c.query,g).$promise)}c.currentUser=n.getCurrentUser(),c.mailAccounts=r,c.rpcMailAccounts=l,c.crudPermissions=n.parseCrudPermissions(m),c.query={sort:"name",limit:10,page:1},c.success=g,c.$onInit=u,c.getMailAccounts=v,c.goToMailAccount=function(e,n){a.go("app.mail.mailAccounts.edit",{id:n.id,mailAccount:n})},c.verifySmtp=function(e,n){{if(n&&n.id)return i.mailAccount.verifySmtp({id:n.id}).$promise.then(function(){o.success({title:"Smtp properly verified",msg:"Connection succeded!"})}).catch(function(e){o.error({title:"Smtp properly verified",msg:e.data?JSON.stringify(e.data):e.toString()})});o.error({title:"Smtp properly verified",msg:"Smpt id unknown"})}},s.on("mailAccount:save",p),s.on("mailAccount:update",p),s.on("mailMessage:save",function(e){var n=_.find(c.mailAccounts.rows,["id",e.MailAccountId]);n&&("in"==e.direction?(n.in+=1,n.lastIn=e.createdAt):(n.out+=1,n.lastOut=e.createdAt))});var h=!0,f=1;e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),v())}),e.$on("$destroy",function(){s.removeAllListeners("mailAccount:save"),s.removeAllListeners("mailAccount:update"),s.removeAllListeners("mailMessage:save")})}e.$inject=["$scope","$timeout","$state","api","Auth","socket","toasty","mailAccounts","rpcMailAccounts","userProfileSection"],angular.module("app.mail").controller("MailAccountsRealtimeController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.mail.realtime.agents":this.selectedTab=0;break;case"app.mail.realtime.queues":this.selectedTab=1;break;case"app.mail.realtime.accounts":this.selectedTab=2;break;default:this.selectedTab=0,t.go("app.mail.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.mail.realtime.agents");break;case 1:t.go("app.mail.realtime.queues");break;case 2:t.go("app.mail.realtime.accounts");break;default:t.go("app.mail.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.mail").controller("MailRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MARKETPLACE.EDIT_PLUGIN",g.plugin=angular.copy(l),g.plugins=r,g.newPlugin=!1,g.plugin||(g.plugin={},g.title="MARKETPLACE.NEW_PLUGIN",g.newPlugin=!0),g.addNewPlugin=function(){g.errors=[],d.plugin.save(g.plugin).$promise.then(function(e){g.plugins.unshift(e.toJSON()),o.success({title:"Plugin properly created",msg:g.plugin.name?g.plugin.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savePlugin=function(){g.errors=[],d.plugin.update({id:g.plugin.id},g.plugin).$promise.then(function(e){var n=_.find(g.plugins,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Plugin properly saved!",msg:g.plugin.name?g.plugin.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletePlugin=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The plugin will be deleted.").ariaLabel("Delete Plugin").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.plugin.delete({id:g.plugin.id}).$promise.then(function(){_.remove(g.plugins,{id:g.plugin.id}),o.success({title:"Plugin properly deleted!",msg:(g.plugin.name||"plugin")+" has been deleted!"}),v(g.plugin)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","plugins","plugin","api","Auth","license","setting","crudPermissions"],angular.module("app.marketplace").controller("CreateOrEditPluginDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.plugin=c||e.params.plugin||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoPlugins=function(){e.go("app.marketplace.plugins",{},{reload:"app.marketplace.plugins"})},u.savePlugin=function(){r.plugin.update({id:u.plugin.id},u.plugin).$promise.then(function(){l.success({title:"Plugin updated!",msg:u.plugin.name?u.plugin.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETplugin",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","plugin","userProfileSection"],angular.module("app.marketplace").controller("MarketplacePluginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.plugins=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="plugins",f.listOrder="",f.listOrderAsc=null,f.selectedPlugins=[],f.query={fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,page:1},f.installing=!1,f.arraysidebar=_.keyBy([{option:"Always",value:"'always'"},{option:"Admin Only",value:"'adminOnly'"},{option:"Agent Only",value:"'agentOnly'"},{option:"Never",value:"'never'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.installplugin=function(e){{if("script"!==e.type)return e.active=!0,m.plugin.update({id:e.id},e).$promise.then(function(){p.success({title:"Plugin installed!",msg:e.name?e.name+" has been installed!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});f.installing=!0,m.pm2.save({name:e.scriptName,script:e.path+"/"+e.scriptPath}).$promise.then(function(){return e.active=!0,m.plugin.update({id:e.id},e).$promise}).then(function(){f.installing=!1,p.success({title:"Plugin installed!",msg:e.name?e.name+" has been installed!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.save"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.save",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}},f.editstate=function(e,n){t.go("app.marketplace.plugins.edit",{id:e.id,plugin:e,crudPermissions:f.crudPermissions})},f.stopplugin=function(e,n){var t=i.confirm().title("Are you sure want to stop the plugin attached process?").htmlContent("<b>"+(e.name||"plugin")+"</b> attached process will be stoppped.").ariaLabel("stop plugin process").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){var t;t=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.update({id:n.pm_id,status:"stopped"}).$promise.then(function(){p.success({title:"Process stopped!",msg:"Attached pm2 process successfully stopped"})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})},f.restartplugin=function(e,n){var t=i.confirm().title("Are you sure want to restart the plugin attached process?").htmlContent("<b>"+(e.name||"plugin")+"</b> attached process will be restarted.").ariaLabel("restart plugin process").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){var t;t=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.update({id:n.pm_id,status:"online"}).$promise.then(function(){p.success({title:"Process restarted!",msg:"Attached pm2 process successfully restarted"})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})},f.downloadfile2=function(s,e){return m.plugin.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.name.replace(" ","_").toLowerCase()+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.uninstallplugin=function(e,n){var t=i.confirm().title("Are you sure want to uninstall the plugin?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be uninstalled.").ariaLabel("uninstall plugin").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){!function(t){"script"===t.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.delete({id:n.pm_id,name:t.scriptName}).$promise}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});t.active=!1,m.plugin.update({id:t.id},t).$promise.then(function(){p.success({title:"Plugin uninstalled!",msg:t.name?t.name+" has been uninstalled!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}(e)},function(){console.log("CANCEL")})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("plugin")+"?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be deleted.").ariaLabel("delete plugin").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getPlugins=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.plugin.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Plugins",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditPlugin=function(e,n){i.show({controller:"CreateOrEditPluginDialogController",controllerAs:"vm",templateUrl:"app/main/apps/marketplace/views/plugins/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{plugin:n,plugins:f.plugins.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletePlugin=y,f.exportSelectedPlugins=function(){var e=angular.copy(f.selectedPlugins);return f.selectedPlugins=[],e},f.deleteSelectedPlugins=function(e){var n=i.confirm().title("Are you sure want to delete the selected plugins?").htmlContent("<b>"+f.selectedPlugins.length+" selected</b> will be deleted.").ariaLabel("delete Plugins").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedPlugins.forEach(function(e){y(e)}),f.selectedPlugins=[]})},f.deselectPlugins=function(){f.selectedPlugins=[]},f.selectAllPlugins=function(){f.selectedPlugins=f.plugins.rows},f.uploadPlugin=function(e){i.show({controller:"UploadPluginDialogController",controllerAs:"vm",templateUrl:"app/main/apps/marketplace/views/plugins/upload/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{plugins:f.plugins.rows}})};var b=!0,A=1;function E(e){f.plugins=e||{count:0,rows:[]}}function y(t){t.active&&"script"==t.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)return p.error({title:"Plugin not deleted!",msg:"Failed to retrieve pm2 processes"});var n=_.find(e.rows,{name:t.scriptName});n?m.pm2.delete({id:n.pm_id,name:t.scriptName}).$promise:console.log("No '%s' process found",t.scriptName)}).catch(function(e){return p.error({title:"PM2 process not found!",msg:"Failed to delete the attached pm2 process"})}),m.plugin.delete({id:t.id}).$promise.then(function(){_.remove(f.plugins.rows,{id:t.id}),f.plugins.count-=1,f.plugins.rows.length||f.getPlugins(),p.success({title:_.startCase("Plugin")+" deleted!",msg:t.name?t.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEplugin"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEplugin",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getPlugins())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","plugins","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.marketplace").controller("MarketplacePluginsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this,r=4,l=1024*r*1024;o.currentUser=s.getCurrentUser(),o.errors=[],o.title="MARKETPLACE.UPLOAD_PLUGIN",o.plugins=a,o.uploadPlugins=[],o.uploadState="none",o.plugin={},o.ngFlowOptions={maxChunkRetries:1,chunkSize:l,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0,target:"api/plugins"},o.ngFlow={flow:{}},o.dropping=!1,o.fileAdded=function(e){var n=["zip"];if(!_.includes(n,e.getExtension()))return t.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>l)return t.error({title:"File too big",msg:"The max allowed size is "+r+"MB"}),!1;return o.plugin={id:e.uniqueIdentifier,file:e},o.uploadPlugins.unshift(o.plugin),!0},o.upload=function(){o.uploadState="uploading",o.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},o.ngFlow.flow.opts.query={role:o.currentUser.role,userProfileId:o.currentUser.userProfileId},o.ngFlow.flow.upload()},o.fileSuccess=function(a,e){o.plugins.unshift(JSON.parse(e)),angular.forEach(o.uploadPlugins,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result}}})},o.uploadError=function(e,n){o.ngFlow.flow.cancel(),t.error({title:"Upload error",msg:"Cannot upload the plugin"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",t.success({title:"Upload completed",msg:o.plugin.file.name+" uploaded successfully"}))},o.closeDialog=function(){n.hide()}}e.$inject=["$cookies","$mdDialog","toasty","plugins","api","Auth"],angular.module("app.marketplace").controller("UploadPluginDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;function h(e){a.hide(e)}v.currentUser=c.getCurrentUser(),v.errors=[],v.setting=u,v.license=m,v.crudPermissions=p,v.hasModulePermissions={},v.passwordPattern=v.setting&&v.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",v.title="MOTIONDIALER.EDIT_HOPPER",v.hopper=angular.copy(l),v.hoppers=r,v.newHopper=!1,v.contact,v.dateTime,v.hopper||(v.hopper={},v.title="MOTIONDIALER.NEW_HOPPER",v.newHopper=!0),n.params.id&&("IvrCampaign"===g?v.hopper.CampaignId=n.params.id:"QueueCampaign"==g?v.hopper.VoiceQueueId=n.params.id:v.hopper.ContactId=n.params.id),v.addNewHopper=function(){v.errors=[],d.cmHopper.save(v.hopper).$promise.then(function(e){v.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:v.hopper.name?v.hopper.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveHopper=function(){var t,a,i,s;v.errors=[],v.hopper.UserId=v.hopper.recallme?v.hopper.UserId:null,v.hopper.OwnerId=c.getCurrentUser().id,d.cmHopper.get({id:v.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){v.hopper.dialTimezone=v.contact.dialTimezone,d.cmHopper.update({id:v.hopper.id},_.omit(v.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.voiceQueue.get({raw:!1,id:a.VoiceQueueId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme}).$promise.then(function(){d.cmContact.update({id:a.ContactId,dialTimezone:v.contact.dialTimezone})})})});var n=_.find(v.hoppers,{id:e.id});n&&_.merge(n,_.pick(e.toJSON(),_.keys(n))),o.success({title:"Hopper properly saved!",msg:v.hopper.name?v.hopper.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},v.deleteHopper=function(e){v.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:v.hopper.id}).$promise.then(function(){_.remove(v.hoppers,{id:v.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(v.hopper.name||"hopper")+" has been deleted!"}),h(v.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=h,v.recalcTZTime=function(){if(_.isNil(v.hopper.VoiceQueueId)){var e=v.hopper.CampaignId;d.campaign.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.hopper.scheduledat=moment(v.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledat=moment(v.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}})}else{var e=v.hopper.VoiceQueueId;e&&d.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.hopper.scheduledat=moment(v.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledat=moment(v.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}})}},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){v.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){v.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(v.agents,{id:e.resourceId})}),t=null;if(v.hopper&&(t=_.find(v.agents,{id:Number(v.hopper.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(v.agents,{id:t.id});a.canSelect=!1,n.push(a)}v.agents=n})}else{var t=[],a=null;v.hopper&&(a=_.find(v.agents,{id:Number(v.hopper.UserId)}));for(var i=0;i<v.agents.length;i++)a&&v.agents[i].id===a.id&&(v.agents[i].canSelect=!1,t.push(v.agents[i]));v.agents=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.cmContact.get({id:v.hopper.ContactId,fields:"dialTimezone"}).$promise.then(function(e){var n;v.contact=e,_.isNil(v.hopper.VoiceQueueId)?(n=v.hopper.CampaignId)&&d.campaign.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;v.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.dateTime=moment(v.hopper.scheduledat).add(n-t,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.dateTime=moment(v.hopper.scheduledat).add(n-0,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):(n=v.hopper.VoiceQueueId)&&d.voiceQueue.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;v.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.dateTime=moment(v.hopper.scheduledat).add(n-t,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.dateTime=moment(v.hopper.scheduledat).add(n-0,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions","from"],angular.module("app.motiondialer").controller("HopperdateController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_IVRCAMPAIGN",g.ivrCampaign=angular.copy(l),g.ivrCampaigns=r,g.newIvrCampaign=!1,g.ivrCampaign||(g.ivrCampaign={active:!0,type:"ivr",dialCheckDuplicateType:"always",dialCutDigit:0,limitCalls:30,dialRandomLastDigitCallerIdNumber:0,dialOriginateTimeout:30,dialGlobalMaxRetry:4,dialCongestionMaxRetry:3,dialCongestionRetryFrequency:150,dialBusyMaxRetry:3,dialBusyRetryFrequency:150,dialNoAnswerMaxRetry:3,dialNoAnswerRetryFrequency:150,dialNoSuchNumberMaxRetry:3,dialNoSuchNumberRetryFrequency:150,dialDropMaxRetry:3,dialDropRetryFrequency:150,dialAbandonedMaxRetry:3,dialAbandonedRetryFrequency:150,dialMachineMaxRetry:3,dialMachineRetryFrequency:150,dialAgentRejectMaxRetry:3,dialAgentRejectRetryFrequency:150,dialOrderByScheduledAt:"ASC",dialGlobalInterval:"07:00-22:00,*,*,*",dialAMDInitialSilence:2500,dialAMDGreeting:1500,dialAMDAfterGreetingSilence:800,dialAMDTotalAnalysisTime:5e3,dialAMDMinWordLength:100,dialAMDBetweenWordsSilence:50,dialAMDMaximumNumberOfWords:3,dialAMDSilenceThreshold:256,dialAMDMaximumWordLength:5e3},g.title="MOTIONDIALER.NEW_IVRCAMPAIGN",g.newIvrCampaign=!0),g.addNewIvrCampaign=function(){g.errors=[],d.campaign.save(g.ivrCampaign).$promise.then(function(e){g.ivrCampaigns.unshift(e.toJSON()),o.success({title:"IvrCampaign properly created",msg:g.ivrCampaign.name?g.ivrCampaign.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveIvrCampaign=function(){g.errors=[],d.campaign.update({id:g.ivrCampaign.id},g.ivrCampaign).$promise.then(function(e){var n=_.find(g.ivrCampaigns,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"IvrCampaign properly saved!",msg:g.ivrCampaign.name?g.ivrCampaign.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteIvrCampaign=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The ivrCampaign will be deleted.").ariaLabel("Delete IvrCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.campaign.delete({id:g.ivrCampaign.id}).$promise.then(function(){_.remove(g.ivrCampaigns,{id:g.ivrCampaign.id}),o.success({title:"IvrCampaign properly deleted!",msg:(g.ivrCampaign.name||"ivrCampaign")+" has been deleted!"}),v(g.ivrCampaign)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})});g.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.trunks=n})}else g.trunks=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.projects=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.projects=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.projects,{id:e.resourceId})}),t=null;if(g.ivrCampaign&&(t=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.projects,{id:t.id});a.canSelect=!1,n.push(a)}g.projects=n})}else{var t=[],a=null;g.ivrCampaign&&(a=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)}));for(var i=0;i<g.projects.length;i++)a&&g.projects[i].id===a.id&&(g.projects[i].canSelect=!1,t.push(g.projects[i]));g.projects=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.ivrCampaign&&(t=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.ivrCampaign&&(a=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","ivrCampaigns","ivrCampaign","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditIvrCampaignDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=n,d.crudPermissions=l,d.apiRoute="campaign",d.getApi="getBlackLists",d.addApi="addBlackLists",d.removeApi="removeBlackLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","ivrCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("IvrCampaignblacklistaddController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newIvrCampaign=!0,r.ivrCampaign=angular.copy(i),r.ivrCampaigns=s,r.title=o.instant("MOTIONDIALER.CLONE_IVRCAMPAIGN"),i&&i.name&&(r.title+=": "+i.name),r.cloneIvrCampaign=function(){return e.campaign.clone({id:i.id},r.ivrCampaign).$promise.then(function(e){r.ivrCampaigns.unshift(e.toJSON()),a.success({title:"IvrCampaign properly cloned",msg:r.ivrCampaign.name?r.ivrCampaign.name+" has been cloned!":""}),t.go("app.motiondialer.ivrCampaigns.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","ivrCampaign","ivrCampaigns","$translate"],angular.module("app.motiondialer").controller("IvrCampaigncloneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperBlacks=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperBlacks(m.query,u).$promise}function g(e){d.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperBlacks.rows,{id:e.id}),m.ivrCampaignHopperBlacks.count-=1,m.ivrCampaignHopperBlacks.rows.length||p(),l.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHopperBlacks={count:0,rows:[]},m.selectedIvrCampaignHopperBlacks=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperBlack #")+e.id||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperBlacks=p,m.createOrEditIvrCampaignHopperBlack=function(e,n){o.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperBlack:n,hopperBlacks:m.ivrCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperBlacks=function(){var e=angular.copy(m.selectedIvrCampaignHopperBlacks);return m.selectedIvrCampaignHopperBlacks=[],e},m.deleteIvrCampaignHopperBlack=g,m.deleteSelectedIvrCampaignHopperBlacks=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+m.selectedIvrCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperBlacks.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperBlacks=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperFinals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperFinals(m.query,u).$promise}function g(e){d.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperFinals.rows,{id:e.id}),m.ivrCampaignHopperFinals.count-=1,m.ivrCampaignHopperFinals.rows.length||p(),l.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function v(a){d.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){l.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var n,t;"Not Found"===e.data?d.cmHopper.save((n=a,t={},t.phone=n.calleridnum,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=0,t.countcongestionretry=0,t.countnoanswerretry=0,t.countglobal=0,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=n.deleted?null:n.UserId,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.priority=n.recallme?3:2,t.recallme=!!n.recallme,t)).$promise.then(function(e){var n,t;l.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&d.cmHopperHistory.save(((t={}).calleridnum=(n=a).calleridnum,t.calleridname=n.calleridname,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=n.countbusyretry,t.countcongestionretry=n.countcongestionretry,t.countnoanswerretry=n.countnoanswerretry,t.countglobal=n.countglobal,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=c.getCurrentUser().id,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),t.edited=!0,t.state=25,t.statedesc="Restored",t.campaign=n.campaign,t.campaigntype=n.VoiceQueueId?"queue":"ivr",t))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):l.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.contacts={},m.ivrCampaign={},m.ivrCampaignHopperFinals={count:0,rows:[]},m.selectedIvrCampaignHopperFinals=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperFinal #")+e.id||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperFinals=p,m.createOrEditIvrCampaignHopperFinal=function(e,n){o.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperFinal:n,hopperFinals:m.ivrCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperFinals=function(){var e=angular.copy(m.selectedIvrCampaignHopperFinals);return m.selectedIvrCampaignHopperFinals=[],e},m.deleteIvrCampaignHopperFinal=g,m.deleteSelectedIvrCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+m.selectedIvrCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperFinals.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperFinals=[]})},m.moveIvrCampaignHopperFinal=v,m.moveContactsIvrCampaignHopperFinal=function(e){d.cmHopperFinal.moveContactsIvrCampaignHopperFinal({id:m.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?l.info({title:"Restored Contacts",msg:"0"}):l.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.countContactsIvrCampaignHopperFinal=function(e){d.cmHopperFinal.countContactsIvrCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(m.contacts,e[0])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.moveConfirm=function(e,n){var t=o.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.moveSelectedIvrCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to restore the selected contacts?").htmlContent("<b> Contacts selected</b> will be restored.").ariaLabel("Restore Contacts").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperFinals.forEach(function(e){v(e)}),m.selectedIvrCampaignHopperFinals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperHistories=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperHistories(m.query,u).$promise}function g(e){d.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperHistories.rows,{id:e.id}),m.ivrCampaignHopperHistories.count-=1,m.ivrCampaignHopperHistories.rows.length||p(),l.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHopperHistories={count:0,rows:[]},m.selectedIvrCampaignHopperHistories=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperHistory #")+e.id||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperHistories=p,m.createOrEditIvrCampaignHopperHistory=function(e,n){o.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperHistory:n,hopperHistories:m.ivrCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperHistories=function(){var e=angular.copy(m.selectedIvrCampaignHopperHistories);return m.selectedIvrCampaignHopperHistories=[],e},m.deleteIvrCampaignHopperHistory=g,m.deleteSelectedIvrCampaignHopperHistories=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+m.selectedIvrCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperHistories.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperHistories=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHoppers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHoppers(m.query,u).$promise}function g(e){d.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHoppers.rows,{id:e.id}),m.ivrCampaignHoppers.count-=1,m.ivrCampaignHoppers.rows.length||p(),l.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHoppers={count:0,rows:[]},m.selectedIvrCampaignHoppers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,scheduledat,priority",sort:"-updatedAt",limit:10,page:1},m.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopper #")+e.id||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHoppers=p,m.createOrEditIvrCampaignHopper=function(e,n){o.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopper:n,hoppers:m.ivrCampaignHoppers.rows,license:null,setting:null,crudPermissions:m.crudPermissions,from:"IvrCampaign"}})},m.exportSelectedIvrCampaignHoppers=function(){var e=angular.copy(m.selectedIvrCampaignHoppers);return m.selectedIvrCampaignHoppers=[],e},m.deleteIvrCampaignHopper=g,m.deleteSelectedIvrCampaignHoppers=function(e){var n=o.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+m.selectedIvrCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHoppers.forEach(function(e){g(e)}),m.selectedIvrCampaignHoppers=[]})},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.agents,{id:e.resourceId})});m.agents.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),m.agents=n})}else m.agents=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHoppersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_HOPPER",g.hopper=angular.copy(l),g.hoppers=r,g.newHopper=!1,g.hopper||(g.hopper={},g.title="MOTIONDIALER.NEW_HOPPER",g.newHopper=!0),n.params.id&&(g.hopper.CampaignId=n.params.id),g.addNewHopper=function(){g.errors=[],d.cmHopper.save(g.hopper).$promise.then(function(e){g.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:g.hopper.name?g.hopper.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveHopper=function(){var t,a,i,s;g.errors=[],g.hopper.UserId=g.hopper.recallme?g.hopper.UserId:null,g.hopper.OwnerId=c.getCurrentUser().id,d.cmHopper.get({id:g.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){d.cmHopper.update({id:g.hopper.id},_.omit(g.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.campaign.get({raw:!1,id:a.CampaignId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme})})});var n=_.find(g.hoppers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Hopper properly saved!",msg:g.hopper.name?g.hopper.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},g.deleteHopper=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:g.hopper.id}).$promise.then(function(){_.remove(g.hoppers,{id:g.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(g.hopper.name||"hopper")+" has been deleted!"}),v(g.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})});g.agents.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.agents=n})}else g.agents=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditHopperCampaignIdDialogController",e)}(),function(){"use strict";function e(t,a){var i=this;i.ivrCampaign={},i.init=function(n){i.ivrCampaign=n,t.cmHopper.get({limit:0,CampaignId:n.id}).$promise.then(function(e){return i.total=e.count||0,t.cmHopper.get({limit:0,CampaignId:n.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0,countnosuchnumberretry:0,countdropretry:0,countabandonedretry:0,countmachineretry:0,countagentrejectretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,t.cmHopperFinal.get({limit:0,CampaignId:n.id}).$promise}).then(function(e){i.closed=e.count||0}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["api","toasty"],angular.module("app.motiondialer").controller("IvrCampaignHopperStatisticsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=n,d.crudPermissions=l,d.apiRoute="campaign",d.getApi="getLists",d.addApi="addLists",d.removeApi="removeLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","ivrCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("IvrCampaignlistaddController",e)}(),function(){"use strict";function e(e,n,a,i,s,t,o,r){var l=this;function d(){n.hide()}function c(e,n){var t=n.id;o.enqueue(function(){return i.campaign.removeLists({id:e,ids:t}).$promise.then(function(){return i.campaign.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}l.selected=[],l.items=t||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,n){return-1<n.indexOf(e)},l.toggle=function(e,n){var t=n.indexOf(e);-1<t?n.splice(t,1):n.push(e)},l.isIndeterminate=function(){return 0!==l.selected.length&&l.selected.length!==l.items.length},l.isChecked=function(){return l.selected.length===l.items.length},l.toggleAll=function(){l.selected.length===l.items.length?l.selected=[]:(0===l.selected.length||0<l.selected.length)&&(l.selected=l.items.slice(0))},l.listSelected=function(){l.loading=!0,r(function(e,n){for(var t=0;t<l.selected.length;t+=1)c(s.id,l.selected[t]);var a;a=e,o.enqueue(function(){return a()})}).finally(function(){l.loading=!1,d()})}}e.$inject=["$scope","$mdDialog","toasty","api","ivrCampaign","listsCampaign","Sequence","$q"],angular.module("app.motiondialer").controller("IvrCampaignresetlistController",e)}(),function(){"use strict";function e(t,e,i,s,a,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.ivrCampaign=c||t.params.ivrCampaign||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,n){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,n){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.resetlistdialog=function(n,t){r.campaign.getLists({id:n.id,fields:"id,name",nolimit:!0}).$promise.then(function(a){if(_.isNil(a.rows)||_.isEmpty(a.rows))l.info({title:"Campaign Without Lists"});else if(1===a.rows.length){var e=i.confirm().title("Are you sure want to reset the list "+a.rows[0].name+" ?").htmlContent("<b>"+a.rows[0].name+"</b> will be reset.").ariaLabel("Reset List").targetEvent(t).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n,t;e=u.ivrCampaign.id,n=a.rows[0],t=n.id,r.campaign.removeLists({id:e,ids:t}).$promise.then(function(){return r.campaign.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ivrCampaign.REMOVELIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}else i.show({controller:"IvrCampaignresetlistController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/resetlist/resetlist.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!1,locals:{ivrCampaign:n,listsCampaign:a?a.rows:[]}})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.ivr_campaigns",{}):l.info({title:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.ivr_campaigns",{})}},u.alert=l.info,u.gotoIvrCampaigns=function(){t.go("app.motiondialer.ivrCampaigns",{},{reload:"app.motiondialer.ivrCampaigns"})},u.saveIvrCampaign=function(){r.campaign.update({id:u.ivrCampaign.id},u.ivrCampaign).$promise.then(function(){l.success({title:"IvrCampaign updated!",msg:u.ivrCampaign.name?u.ivrCampaign.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})});u.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.trunks=n})}else u.trunks=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),t=null;if(u.ivrCampaign&&(t=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.projects,{id:t.id});a.canSelect=!1,n.push(a)}u.projects=n})}else{var t=[],a=null;u.ivrCampaign&&(a=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)}));for(var i=0;i<u.projects.length;i++)a&&u.projects[i].id===a.id&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),t=null;if(u.ivrCampaign&&(t=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.interval,{id:t.id});a.canSelect=!1,n.push(a)}u.interval=n})}else{var t=[],a=null;u.ivrCampaign&&(a=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,t.push(u.interval[i]));u.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","ivrCampaign","userProfileSection"],angular.module("app.motiondialer").controller("IvrCampaignController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.ivrCampaigns=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="ivrCampaigns",f.listOrder="",f.listOrderAsc=null,f.selectedIvrCampaigns=[],f.query={fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,page:1},f.arraydialCheckDuplicateType=_.keyBy([{option:"ALWAYS",value:"'always'"},{option:"NEVER",value:"'never'"},{option:"ONLY_IF_OPEN",value:"'onlyIfOpen'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.motiondialer.ivrCampaigns.edit",{id:e.id,ivrCampaign:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.listadddialog=function(e,n){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.blacklistadddialog=function(e,n){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("ivrCampaign")+"?").htmlContent("<b>"+(e.name||"ivrCampaign")+"</b> will be deleted.").ariaLabel("delete ivrCampaign").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.ivr_campaigns",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.ivr_campaigns",{})}},f.success=E,f.getIvrCampaigns=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.campaign.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="IvrCampaigns",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditIvrCampaign=function(e,n){i.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:n,ivrCampaigns:f.ivrCampaigns.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteIvrCampaign=y,f.exportSelectedIvrCampaigns=function(){var e=angular.copy(f.selectedIvrCampaigns);return f.selectedIvrCampaigns=[],e},f.deleteSelectedIvrCampaigns=function(e){var n=i.confirm().title("Are you sure want to delete the selected ivrCampaigns?").htmlContent("<b>"+f.selectedIvrCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete IvrCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedIvrCampaigns.forEach(function(e){y(e)}),f.selectedIvrCampaigns=[]})},f.deselectIvrCampaigns=function(){f.selectedIvrCampaigns=[]},f.selectAllIvrCampaigns=function(){f.selectedIvrCampaigns=f.ivrCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})});f.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),f.trunks=n})}else f.trunks=[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.projects=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.projects=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.projects,{id:e.resourceId})}),a=null;a=[],f.ivrCampaigns.rows.forEach(function(e){var n=_.find(f.projects,{id:Number(e.SquareProjectId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),f.projects=t})}else{var t=[],a=[];f.ivrCampaigns.rows.forEach(function(e){var n=_.find(f.projects,{id:Number(e.SquareProjectId)});a.push(n)});for(var i=0;i<f.projects.length;i++){_.some(a,{id:f.projects[i].id})&&(f.projects[i].canSelect=!1,t.push(f.projects[i]))}f.projects=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.ivrCampaign&&(t=_.find(f.interval,{id:Number(f.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.ivrCampaign&&(a=_.find(f.interval,{id:Number(f.ivrCampaign.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.ivrCampaigns=e||{count:0,rows:[]}}function y(e){m.campaign.delete({id:e.id}).$promise.then(function(){_.remove(f.ivrCampaigns.rows,{id:e.id}),f.ivrCampaigns.count-=1,f.ivrCampaigns.rows.length||f.getIvrCampaigns(),p.success({title:_.startCase("IvrCampaign")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcampaign"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getIvrCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","ivrCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.motiondialer").controller("IvrCampaignsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_QUEUECAMPAIGN",g.queueCampaign=angular.copy(l),g.queueCampaigns=r,g.newQueueCampaign=!1,g.queueCampaign||(g.queueCampaign={dialActive:!0,type:"outbound",dialCheckDuplicateType:"always",dialCutDigit:0,autopause:"no",ringinuse:"no",timeoutrestart:"no",setinterfacevar:"no",setqueuevar:"no",setqueueentryvar:"no",dialOrderByScheduledAt:"ASC",dialGlobalInterval:"07:00-22:00,*,*,*",dialAMDInitialSilence:2500,dialAMDGreeting:1500,dialAMDAfterGreetingSilence:800,dialAMDTotalAnalysisTime:5e3,dialAMDMinWordLength:100,dialAMDBetweenWordsSilence:50,dialAMDMaximumNumberOfWords:3,dialAMDSilenceThreshold:256,dialAMDMaximumWordLength:5e3,dialMethod:"progressive",dialPowerLevel:1,dialPredictiveOptimization:"dropRate",dialPredictiveOptimizationPercentage:3,dialPredictiveInterval:10,dialLimitQueue:0,dialRandomLastDigitCallerIdNumber:0,dialOriginateTimeout:30,dialQueueOptions:"tTxX",dialQueueTimeout:3,strategy:"rrmemory",timeout:3,retry:3,weight:1,dialGlobalMaxRetry:4,dialCongestionMaxRetry:3,dialCongestionRetryFrequency:150,dialBusyMaxRetry:3,dialBusyRetryFrequency:150,dialNoAnswerMaxRetry:3,dialNoAnswerRetryFrequency:150,dialNoSuchNumberMaxRetry:3,dialNoSuchNumberRetryFrequency:150,dialDropMaxRetry:3,dialDropRetryFrequency:150,dialAbandonedMaxRetry:3,dialAbandonedRetryFrequency:150,dialMachineMaxRetry:3,dialMachineRetryFrequency:150,dialAgentRejectMaxRetry:3,dialAgentRejectRetryFrequency:150,callAdditionalPhoneAfterMin:3,dialPredictiveIntervalMaxThreshold:20,dialPredictiveIntervalMinThreshold:10},g.title="MOTIONDIALER.NEW_QUEUECAMPAIGN",g.newQueueCampaign=!0),g.addNewQueueCampaign=function(){g.errors=[],d.voiceQueue.save(g.queueCampaign).$promise.then(function(e){g.queueCampaigns.unshift(e.toJSON()),o.success({title:"QueueCampaign properly created",msg:g.queueCampaign.name?g.queueCampaign.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveQueueCampaign=function(){g.errors=[],d.voiceQueue.update({id:g.queueCampaign.id},g.queueCampaign).$promise.then(function(e){var n=_.find(g.queueCampaigns,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"QueueCampaign properly saved!",msg:g.queueCampaign.name?g.queueCampaign.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteQueueCampaign=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The queueCampaign will be deleted.").ariaLabel("Delete QueueCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceQueue.delete({id:g.queueCampaign.id}).$promise.then(function(){_.remove(g.queueCampaigns,{id:g.queueCampaign.id}),o.success({title:"QueueCampaign properly deleted!",msg:(g.queueCampaign.name||"queueCampaign")+" has been deleted!"}),v(g.queueCampaign)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),t=null;if(g.queueCampaign&&(t=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.trunks,{id:t.id});a.canSelect=!1,n.push(a)}g.trunks=n})}else{var t=[],a=null;g.queueCampaign&&(a=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)}));for(var i=0;i<g.trunks.length;i++)a&&g.trunks[i].id===a.id&&(g.trunks[i].canSelect=!1,t.push(g.trunks[i]));g.trunks=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.queueCampaign&&(t=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.queueCampaign&&(a=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","queueCampaigns","queueCampaign","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditQueueCampaignDialogController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.voiceQueue.getAgents({id:c.queueCampaign.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.queueCampaign=n,c.crudPermissions=r,c.penalty=0,c.realtime=i,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.voiceQueue.removeAgents({id:c.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else{for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.voiceQueue.addAgents({id:c.queueCampaign.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("MOTIONDIALER.ALL_AGENTS"),labelSelected:s.instant("MOTIONDIALER.SELECTED_AGENTS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","queueCampaigns","realtime","$translate","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=n,d.crudPermissions=l,d.apiRoute="voiceQueue",d.getApi="getBlackLists",d.addApi="addBlackLists",d.removeApi="removeBlackLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignblacklistaddController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newQueueCampaign=!0,r.queueCampaign=angular.copy(i),r.queueCampaigns=s,r.title=o.instant("MOTIONDIALER.CLONE_QUEUECAMPAIGN"),i&&i.name&&(r.title+=": "+i.name),r.cloneQueueCampaign=function(){return e.voiceQueue.clone({id:i.id},r.queueCampaign).$promise.then(function(e){r.queueCampaigns.unshift(e.toJSON()),a.success({title:"QueueCampaign properly cloned",msg:r.queueCampaign.name?r.queueCampaign.name+" has been cloned!":""}),t.go("app.motiondialer.queueCampaigns.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","queueCampaign","queueCampaigns","$translate"],angular.module("app.motiondialer").controller("QueueCampaigncloneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperBlacks=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperBlacks(m.query,u).$promise}function g(e){d.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperBlacks.rows,{id:e.id}),m.queueCampaignHopperBlacks.count-=1,m.queueCampaignHopperBlacks.rows.length||p(),l.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHopperBlacks={count:0,rows:[]},m.selectedQueueCampaignHopperBlacks=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperBlack #")+e.id||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperBlacks=p,m.createOrEditQueueCampaignHopperBlack=function(e,n){o.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperBlack:n,hopperBlacks:m.queueCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperBlacks=function(){var e=angular.copy(m.selectedQueueCampaignHopperBlacks);return m.selectedQueueCampaignHopperBlacks=[],e},m.deleteQueueCampaignHopperBlack=g,m.deleteSelectedQueueCampaignHopperBlacks=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+m.selectedQueueCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperBlacks.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperBlacks=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperFinals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperFinals(m.query,u).$promise}function g(e){d.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperFinals.rows,{id:e.id}),m.queueCampaignHopperFinals.count-=1,m.queueCampaignHopperFinals.rows.length||p(),l.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function v(a){d.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){l.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var n,t;"Not Found"===e.data?d.cmHopper.save((n=a,t={},t.phone=n.calleridnum,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=0,t.countcongestionretry=0,t.countnoanswerretry=0,t.countglobal=0,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=n.deleted?null:n.UserId,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.priority=n.recallme?3:2,t.recallme=!!n.recallme,t)).$promise.then(function(e){var n,t;l.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&d.cmHopperHistory.save(((t={}).calleridnum=(n=a).calleridnum,t.calleridname=n.calleridname,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=n.countbusyretry,t.countcongestionretry=n.countcongestionretry,t.countnoanswerretry=n.countnoanswerretry,t.countglobal=n.countglobal,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=c.getCurrentUser().id,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),t.edited=!0,t.state=25,t.statedesc="Restored",t.campaign=n.campaign,t.campaigntype=n.VoiceQueueId?"queue":"ivr",t))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):l.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.contacts={},m.queueCampaign={},m.queueCampaignHopperFinals={count:0,rows:[]},m.selectedQueueCampaignHopperFinals=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,secondDisposition,thirdDisposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperFinal #")+e.id||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperFinals=p,m.createOrEditQueueCampaignHopperFinal=function(e,n){o.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperFinal:n,hopperFinals:m.queueCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperFinals=function(){var e=angular.copy(m.selectedQueueCampaignHopperFinals);return m.selectedQueueCampaignHopperFinals=[],e},m.deleteQueueCampaignHopperFinal=g,m.deleteSelectedQueueCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+m.selectedQueueCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperFinals.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperFinals=[]})},m.moveQueueCampaignHopperFinal=v,m.moveContactsQueueCampaignHopperFinal=function(e){d.cmHopperFinal.moveContactsQueueCampaignHopperFinal({id:m.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?l.info({title:"Restored Contacts",msg:"0"}):l.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.countContactsQueueCampaignHopperFinal=function(e){d.cmHopperFinal.countContactsQueueCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(m.contacts,e[0])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.moveConfirm=function(e,n){var t=o.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.moveSelectedQueueCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to restore the selected contacts?").htmlContent("<b> Contacts selected</b> will be restored.").ariaLabel("Restore Contacts").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperFinals.forEach(function(e){v(e)}),m.selectedQueueCampaignHopperFinals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperHistories=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperHistories(m.query,u).$promise}function g(e){d.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperHistories.rows,{id:e.id}),m.queueCampaignHopperHistories.count-=1,m.queueCampaignHopperHistories.rows.length||p(),l.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHopperHistories={count:0,rows:[]},m.selectedQueueCampaignHopperHistories=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperHistory #")+e.id||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperHistories=p,m.createOrEditQueueCampaignHopperHistory=function(e,n){o.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperHistory:n,hopperHistories:m.queueCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperHistories=function(){var e=angular.copy(m.selectedQueueCampaignHopperHistories);return m.selectedQueueCampaignHopperHistories=[],e},m.deleteQueueCampaignHopperHistory=g,m.deleteSelectedQueueCampaignHopperHistories=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+m.selectedQueueCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperHistories.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperHistories=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHoppers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHoppers(m.query,u).$promise}function g(e){d.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHoppers.rows,{id:e.id}),m.queueCampaignHoppers.count-=1,m.queueCampaignHoppers.rows.length||p(),l.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHoppers={count:0,rows:[]},m.selectedQueueCampaignHoppers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,scheduledat,priority,recallme,UserId",sort:"-updatedAt",limit:10,page:1},m.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopper #")+e.id||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHoppers=p,m.createOrEditQueueCampaignHopper=function(e,n){o.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopper:n,hoppers:m.queueCampaignHoppers.rows,license:null,setting:null,crudPermissions:m.crudPermissions,from:"QueueCampaign"}})},m.exportSelectedQueueCampaignHoppers=function(){var e=angular.copy(m.selectedQueueCampaignHoppers);return m.selectedQueueCampaignHoppers=[],e},m.deleteQueueCampaignHopper=g,m.deleteSelectedQueueCampaignHoppers=function(e){var n=o.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+m.selectedQueueCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHoppers.forEach(function(e){g(e)}),m.selectedQueueCampaignHoppers=[]})},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.agents,{id:e.resourceId})}),t=null;if(m.queueCampaign&&(t=_.find(m.agents,{id:Number(m.queueCampaign.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(m.agents,{id:t.id});a.canSelect=!1,n.push(a)}m.agents=n})}else{var t=[],a=null;m.queueCampaign&&(a=_.find(m.agents,{id:Number(m.queueCampaign.UserId)}));for(var i=0;i<m.agents.length;i++)a&&m.agents[i].id===a.id&&(m.agents[i].canSelect=!1,t.push(m.agents[i]));m.agents=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHoppersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}function h(){console.log("recalcTZTime hopper",g.hopper);var e=g.hopper.Queue.id;if(e)d.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(g.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),_.isNil(g.dateTime)||(g.hopper.scheduledat=moment(g.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss"))})});else{d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),_.isNil(g.dateTime)||(g.hopper.scheduledat=moment(g.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss"))})}});else{d.cmHopper.getTimezone({id:g.hopper.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.hopper.scheduledat=moment(g.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_HOPPER",g.hopper=angular.copy(l),g.hoppers=r,g.newHopper=!1,g.recalcTZTime=h,e.$watch("vm.contact.dialTimezone",function(){h()}),g.hopper||(g.hopper={},g.title="MOTIONDIALER.NEW_HOPPER",g.newHopper=!0),n.params.id&&(g.hopper.VoiceQueueId=n.params.id),g.addNewHopper=function(){g.errors=[],d.cmHopper.save(g.hopper).$promise.then(function(e){g.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:g.hopper.name?g.hopper.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveHopper=function(){var t,a,i,s;g.errors=[],g.hopper.UserId=g.hopper.recallme?g.hopper.UserId:null,g.hopper.OwnerId=c.getCurrentUser().id,g.hopper.dialTimezone=g.contact.dialTimezone,d.cmHopper.get({id:g.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){d.cmHopper.update({id:g.hopper.id},_.omit(g.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.voiceQueue.get({raw:!1,id:a.VoiceQueueId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme}).$promise.then(function(){d.cmContact.update({id:a.ContactId,dialTimezone:g.contact.dialTimezone})})})});var n=_.find(g.hoppers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Hopper properly saved!",msg:g.hopper.name?g.hopper.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},g.deleteHopper=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:g.hopper.id}).$promise.then(function(){_.remove(g.hoppers,{id:g.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(g.hopper.name||"hopper")+" has been deleted!"}),v(g.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.dateTime,g.contact,d.cmContact.get({id:g.hopper.Contact.id,fields:"dialTimezone"}).$promise.then(function(e){var n;g.contact=e,console.log("initTZTime hopper",g.hopper),_.isNil(g.hopper.Queue.id)?(n=g.hopper.Campaign.id)&&d.campaign.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;g.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;g.dateTime=moment(g.hopper.scheduledat).add(n-t,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.dateTime=moment(g.hopper.scheduledat).add(n-0,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):(n=g.hopper.Queue.id)&&d.voiceQueue.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;g.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;g.dateTime=moment(g.hopper.scheduledat).add(n-t,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.dateTime=moment(g.hopper.scheduledat).add(n-0,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})})}),g.closeDialog=v,c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})}),t=null;if(g.hopper&&(t=_.find(g.agents,{id:Number(g.hopper.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.agents,{id:t.id});a.canSelect=!1,n.push(a)}g.agents=n})}else{var t=[],a=null;g.hopper&&(a=_.find(g.agents,{id:Number(g.hopper.UserId)}));for(var i=0;i<g.agents.length;i++)a&&g.agents[i].id===a.id&&(g.agents[i].canSelect=!1,t.push(g.agents[i]));g.agents=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditHopperVoiceQueueIdDialogController",e)}(),function(){"use strict";function e(t,a){var i=this;i.queueCampaign={},i.init=function(n){i.queueCampaign=n,t.cmHopper.get({limit:0,VoiceQueueId:n.id}).$promise.then(function(e){return i.total=e.count||0,t.cmHopper.get({limit:0,VoiceQueueId:n.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0,countnosuchnumberretry:0,countdropretry:0,countabandonedretry:0,countmachineretry:0,countagentrejectretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,t.cmHopperFinal.get({limit:0,VoiceQueueId:n.id}).$promise}).then(function(e){i.closed=e.count||0}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["api","toasty"],angular.module("app.motiondialer").controller("QueueCampaignHopperStatisticsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=n,d.crudPermissions=l,d.apiRoute="voiceQueue",d.getApi="getLists",d.addApi="addLists",d.removeApi="removeLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignlistaddController",e)}(),function(){"use strict";function e(e,n,a,i,s,t,o,r){var l=this;function d(){n.hide()}function c(e,n){var t=n.id;o.enqueue(function(){return i.voiceQueue.removeLists({id:e,ids:t}).$promise.then(function(){return i.voiceQueue.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}l.selected=[],l.items=t||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,n){return-1<n.indexOf(e)},l.toggle=function(e,n){var t=n.indexOf(e);-1<t?n.splice(t,1):n.push(e)},l.isIndeterminate=function(){return 0!==l.selected.length&&l.selected.length!==l.items.length},l.isChecked=function(){return l.selected.length===l.items.length},l.toggleAll=function(){l.selected.length===l.items.length?l.selected=[]:(0===l.selected.length||0<l.selected.length)&&(l.selected=l.items.slice(0))},l.listSelected=function(){l.loading=!0,r(function(e,n){for(var t=0;t<l.selected.length;t+=1)c(s.id,l.selected[t]);var a;a=e,o.enqueue(function(){return a()})}).finally(function(){l.loading=!1,d()})}}e.$inject=["$scope","$mdDialog","toasty","api","queueCampaign","listsCampaign","Sequence","$q"],angular.module("app.motiondialer").controller("QueueCampaignresetlistController",e)}(),function(){"use strict";function e(e,i,a,s,n,t,o,r){var l=this;function d(){return i(function(t,n){return i(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:i(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),i(function(n,t){return s.voiceQueue.getTeams({id:l.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.queueCampaign=n,l.crudPermissions=r,l.penalty=0,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"penalty",labelAll:t.instant("MOTIONDIALER.ALL_TEAMS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_TEAMS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+l.penalty});var t=_.xorWith(l.startingSelectedItems,l.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):i(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceWith(l.selectedItems,l.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,i(function(e,n){_.isEmpty(t)?e():s.voiceQueue.removeTeams({id:l.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return a=n,i(function(e,n){if(!_.isEmpty(a)){var t=_.map(a,function(e){return{id:e.id,penalty:_.trim(e.penalty,"penalty ")}});return s.voiceQueue.addTeams({id:l.queueCampaign.id,teams:t}).$promise.then(function(){e()}).catch(function(e){n(e)})}e()});var a}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),a.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignteamaddController",e)}(),function(){"use strict";function e(t,e,i,s,a,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.queueCampaign=c||t.params.queueCampaign||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,n){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,n){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.teamadddialog=function(e,n){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.resetlistdialog=function(n,t){r.voiceQueue.getLists({id:n.id,fields:"id,name",nolimit:!0}).$promise.then(function(a){if(_.isNil(a.rows)||_.isEmpty(a.rows))l.info({title:"Campaign Without Lists"});else if(1===a.rows.length){var e=i.confirm().title("Are you sure want to reset the list "+a.rows[0].name+" ?").htmlContent("<b>"+a.rows[0].name+"</b> will be reset.").ariaLabel("Reset List").targetEvent(t).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n,t;e=u.queueCampaign.id,n=a.rows[0],t=n.id,r.voiceQueue.removeLists({id:e,ids:t}).$promise.then(function(){return r.voiceQueue.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.REMOVELIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}else i.show({controller:"QueueCampaignresetlistController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/resetlist/resetlist.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!1,locals:{queueCampaign:n,listsCampaign:a?a.rows:[]}})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.queues",{}):l.info({title:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.queues",{})}},u.alert=l.info,u.gotoQueueCampaigns=function(){t.go("app.motiondialer.queueCampaigns",{},{reload:"app.motiondialer.queueCampaigns"})},u.saveQueueCampaign=function(){r.voiceQueue.update({id:u.queueCampaign.id},u.queueCampaign).$promise.then(function(){l.success({title:"QueueCampaign updated!",msg:u.queueCampaign.name?u.queueCampaign.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MUSICONHOLDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:407}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.musiconholds,{name:u.queueCampaign.musiconhold})),t&&!_.some(n,["id",t.id])){var a=_.find(u.musiconholds,{id:t.id});a.canSelect=!1,n.push(a)}u.musiconholds=n}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true",defaultEntry:1}).$promise.then(function(e){u.musiconholds=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmusiconholds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.trunks,{id:t.id});a.canSelect=!1,n.push(a)}u.trunks=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)}));for(var i=0;i<u.trunks.length;i++)a&&u.trunks[i].id===a.id&&(u.trunks[i].canSelect=!1,t.push(u.trunks[i]));u.trunks=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.projects,{name:u.queueCampaign.dialQueueProject})),t&&!_.some(n,["id",t.id])){var a=_.find(u.projects,{id:t.id});a.canSelect=!1,n.push(a)}u.projects=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.projects,{name:u.queueCampaign.dialQueueProject}));for(var i=0;i<u.projects.length;i++)a&&u.projects[i].id===a.id&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.interval,{id:t.id});a.canSelect=!1,n.push(a)}u.interval=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,t.push(u.interval[i]));u.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.pauses=n})}else u.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","queueCampaign","userProfileSection"],angular.module("app.motiondialer").controller("QueueCampaignController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.queueCampaigns=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="queueCampaigns",f.listOrder="",f.listOrderAsc=null,f.selectedQueueCampaigns=[],f.query={fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},f.arraydialCheckDuplicateType=_.keyBy([{option:"ALWAYS",value:"'always'"},{option:"NEVER",value:"'never'"},{option:"ONLY_IF_OPEN",value:"'onlyIfOpen'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialMethod=_.keyBy([{option:"Progressive",value:"'progressive'"},{option:"PowerDialing",value:"'power'"},{option:"Predictive",value:"'predictive'"},{option:"Preview",value:"'preview'"},{option:"BookedProgressive",value:"'booked'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialPredictiveOptimization=_.keyBy([{option:"AgentBusyFactor",value:"'agentBusyFactor'"},{option:"DropRate",value:"'dropRate'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraystrategy=_.keyBy([{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Round Robin",value:"'roundrobin'",ngIf:"vm.queueCampaign.dialMethod === 'booked'"},{option:"Least Recent",value:"'leastrecent'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Fewest Calls",value:"'fewestcalls'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Random",value:"'random'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Linear",value:"'linear'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Weight Random",value:"'wrandom'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.motiondialer.queueCampaigns.edit",{id:e.id,queueCampaign:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.listadddialog=function(e,n){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.blacklistadddialog=function(e,n){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.teamadddialog=function(e,n){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("queueCampaign")+"?").htmlContent("<b>"+(e.name||"queueCampaign")+"</b> will be deleted.").ariaLabel("delete queueCampaign").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.queues",{})}},f.success=E,f.getQueueCampaigns=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="QueueCampaigns",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditQueueCampaign=function(e,n){i.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n,queueCampaigns:f.queueCampaigns.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteQueueCampaign=y,f.exportSelectedQueueCampaigns=function(){var e=angular.copy(f.selectedQueueCampaigns);return f.selectedQueueCampaigns=[],e},f.deleteSelectedQueueCampaigns=function(e){var n=i.confirm().title("Are you sure want to delete the selected queueCampaigns?").htmlContent("<b>"+f.selectedQueueCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete QueueCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedQueueCampaigns.forEach(function(e){y(e)}),f.selectedQueueCampaigns=[]})},f.deselectQueueCampaigns=function(){f.selectedQueueCampaigns=[]},f.selectAllQueueCampaigns=function(){f.selectedQueueCampaigns=f.queueCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})}),a=null;a=[],f.queueCampaigns.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.trunks,{id:e.id});n.canSelect=!1,t.push(n)}}),f.trunks=t})}else{var t=[],a=[];f.queueCampaigns.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)});for(var i=0;i<f.trunks.length;i++){_.some(a,{id:f.trunks[i].id})&&(f.trunks[i].canSelect=!1,t.push(f.trunks[i]))}f.trunks=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.queueCampaign&&(t=_.find(f.interval,{id:Number(f.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.queueCampaign&&(a=_.find(f.interval,{id:Number(f.queueCampaign.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.queueCampaigns=e||{count:0,rows:[]}}function y(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.queueCampaigns.rows,{id:e.id}),f.queueCampaigns.count-=1,f.queueCampaigns.rows.length||f.getQueueCampaigns(),p.success({title:_.startCase("QueueCampaign")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getQueueCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","queueCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.motiondialer").controller("QueueCampaignsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){return[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",options:g.agents.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:g.queues.rows,ngValue:"name"}]}function h(){return g.refresh=!1,0===g.queues.count?f(null):(g.query.queue=1===g.queues.count?g.queues.rows[0].name:g.query.queue,void 0===g.query.queue&&(g.query.queue=_.map(g.queues.rows,"name")),_.isEmpty(g.query.queue)?f(null):(g.query.offset=(g.query.page-1)*g.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.bull.abandonedCalls:"+g.currentUser.id,JSON.stringify({query:_.omit(g.query,"queue")})),void(g.promise=o.voiceQueueReport.getVoiceQueuesReport(g.query,f).$promise)))}function f(e){g.abandonedCalls=e||{count:0,rows:[]},!1,g.refresh=!0}g.currentUser=d.getCurrentUser(),g.agents=u||[],g.dispositions=p.rows,g.abandonedCalls={count:0,rows:[]},g.showTooltip=!1,g.refresh=!0,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=d.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},g.getAbandonedCalls=h,g.refreshAbandonedCalls=function(){g.showTooltip=!1,h()},g.assignTo=function(e,n){e&&o.voiceQueueReport.update({id:e.id,lastAssignedTo:n?n.name:null,assigned:!!n}).$promise.catch(function(e){console.log(e)})},g.dispose=function(t){n.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(a.body),targetEvent:t,locals:{dispositions:g.dispositions,call:t}}).then(function(e){if(e){var n={id:t.id,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)})}})},g.onSaveVoiceQueueReport=function(e){e&&g.queuesMap&&"outbound"===queue.type&&g.queuesMap[e.queue]&&(g.showTooltip=!0)},g.onUpdateVoiceQueueReport=function(e){if(e){var n=_.findIndex(g.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(g.abandonedCalls.rows[n],e)}},c.onWithoutApply("voiceQueueReport:save",g.onSaveVoiceQueueReport),c.on("voiceQueueReport:update",g.onUpdateVoiceQueueReport),function(){var e=i.localStorage.getItem("motion2.realtime.abandoned.bull.abandonedCalls:"+g.currentUser.id);if(e)(e=JSON.parse(e))&&e.query&&(g.query=_.merge(e.query,_.omit(g.query,["sort","limit","page"])),g.query=_.omit(g.query,"filter"));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};g.query.createdAt=n}d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()}):o.userProfile.getResources({id:g.currentUser.userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()})}();var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?t(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())}),e.$on("$destroy",function(){c.removeAllListeners("voiceQueueReport:save"),c.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","userProfile","userProfileSection","Auth","socket","toasty","agents","dispositions"],angular.module("app.motiondialer").controller("AbandonedCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d,c,m){var u=this,p=["name","active","limitCalls","message","originated","IntervalId","SquareProjectId","Trunk","TrunkId","ivrAnswerCallsDay","dialQueueProject","ivrTotalCallsDays","description"];function g(){u.campaigns.rows.forEach(function(e){u.rpcCampaigns[e.id]&&_.merge(e,_.pick(u.rpcCampaigns[e.id],p))})}u.currentUser=m.getCurrentUser(),u.campaigns=o||{rows:[],count:0},u.rpcCampaigns=s?_.keyBy(s.rows?s.rows:[],"id"):{},u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={sort:"name",limit:10,page:1},u.success=f,u.getCampaigns=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=r.campaign.get(u.query,f).$promise:(u.query.id=u.userProfile.id,u.query.section="IvrCampaigns",u.promise=r.userProfile.getResources(u.query,f).$promise)},u.onSave=function(e){var n=_.find(u.campaigns.rows,["id",e.id]);n&&(_.merge(n,_.pick(e,p)),_.merge(u.rpcCampaigns[e.id],_.pick(e,p)))},u.$onInit=g,u.createOrEditIvrCampaign=function(e,n){a.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:n,ivrCampaigns:u.campaigns.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},l.onWithoutApply("campaign:save",u.onSave),u.interval=n(function(){},999);var v=!0,h=1;function f(e){u.campaigns=e||{count:0,rows:[]},g()}e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=h),u.getCampaigns())}),e.$on("$destroy",function(){l.removeAllListeners("campaign:save"),u.interval&&n.cancel(u.interval)})}e.$inject=["$scope","$timeout","$mdDialog","$document","$interval","rpcCampaigns","campaigns","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("IvrCampaignsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["total","answered","sumHoldTime","sumDuration","sumBillable","outboundNoAnswerCallsDay","outboundBusyCallsDay","outboundCongestionCallsDay","outboundNoSuchCallsDay","outboundUnknownCallsDay","outboundDropCallsDayTimeout","outboundDropCallsDayCallersExit","outboundBlacklistCallsDay","outboundOriginateFailureCallsDay","outboundAnswerAgiCallsDay","outboundReCallsDay","outboundRejectCallsDay"];function u(){c.queues.rows.forEach(function(e){c.rpcQueues[e.id]&&_.merge(e,_.pick(c.rpcQueues[e.id],m))})}c.queues=a||{rows:[],count:0},c.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},c.userProfile=r,c.userProfileSection=l&&1==l.count?l.rows[0]:null,c.crudPermissions=d.parseCrudPermissions(c.userProfileSection?c.userProfileSection.crudPermissions:null),d.hasRole("admin")?c.query={type:"outbound",fields:"id,name",sort:"name",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"outbound",fields:"id,name",sort:"name",limit:10,page:1},c.success=v,c.getQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,d.hasRole("admin")?c.promise=s.voiceQueue.get(c.query,v).$promise:(c.query.id=c.userProfile.id,c.query.section="QueueCampaigns",c.promise=s.userProfile.getResources(c.query,v).$promise)},c.onSave=function(e){var n=_.find(c.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=n(function(){},999);var p=!0,g=1;function v(e){c.queues=e||{count:0,rows:[]},u()}e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&n.cancel(c.interval)})}e.$inject=["$scope","$timeout","$interval","queues","rpcQueues","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueueParamsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.motiondialer.realtime.agents":this.selectedTab=0;break;case"app.motiondialer.realtime.queues":this.selectedTab=1;break;case"app.motiondialer.realtime.queue_calls":this.selectedTab=2;break;case"app.motiondialer.realtime.abandonedcalls":this.selectedTab=3;break;case"app.motiondialer.realtime.queue_params":this.selectedTab=4;break;case"app.motiondialer.realtime.ivr_campaigns":this.selectedTab=5;break;default:this.selectedTab=0,t.go("app.motiondialer.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.motiondialer.realtime.agents");break;case 1:t.go("app.motiondialer.realtime.queues");break;case 2:t.go("app.motiondialer.realtime.queue_calls");break;case 3:t.go("app.motiondialer.realtime.abandonedcalls");break;case 4:t.go("app.motiondialer.realtime.queue_params");break;case 5:t.go("app.motiondialer.realtime.ivr_campaigns");break;default:t.go("app.motiondialer.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.motiondialer").controller("MotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT",g.openchannelAccount=angular.copy(l),g.openchannelAccounts=r,g.newOpenchannelAccount=!1,g.openchannelAccount||(g.openchannelAccount={waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="OPENCHANNEL.NEW_OPENCHANNELACCOUNT",g.newOpenchannelAccount=!0),n.params.id&&(g.openchannelAccount.OpenchannelAccountId=n.params.id),g.addNewOpenchannelAccount=function(){g.errors=[],d.openchannelAccount.save(g.openchannelAccount).$promise.then(function(e){g.openchannelAccounts.unshift(e.toJSON()),o.success({title:"OpenchannelAccount properly created",msg:g.openchannelAccount.name?g.openchannelAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelAccount=function(){g.errors=[],d.openchannelAccount.update({id:g.openchannelAccount.id},g.openchannelAccount).$promise.then(function(e){var n=_.find(g.openchannelAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelAccount properly saved!",msg:g.openchannelAccount.name?g.openchannelAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelAccount will be deleted.").ariaLabel("Delete OpenchannelAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.openchannelAccount.delete({id:g.openchannelAccount.id}).$promise.then(function(){_.remove(g.openchannelAccounts,{id:g.openchannelAccount.id}),o.success({title:"OpenchannelAccount properly deleted!",msg:(g.openchannelAccount.name||"openchannelAccount")+" has been deleted!"}),v(g.openchannelAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.openchannelAccount&&(t=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.openchannelAccount&&(a=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelAccounts","openchannelAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.openchannelAccountApps.rows.length){var t=r.openchannelAccountApps.rows[n]?r.openchannelAccountApps.rows[n]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccountApp:t,openchannelAccount:r.openchannelAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.openchannelAccountApps.rows[n]=e:r.openchannelAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.openchannelAccountApps.rows.length;t++,0){var a=r.openchannelAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.openchannelAccount.context,a.exten=r.openchannelAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.openchannelAccount.addApplications({id:r.openchannelAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.openchannelAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.openchannelAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.openchannelAccount={},r.openchannelAccountApps={count:0,rows:[]},r.selectedOpenchannelAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]},{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"OpenchannelQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"openchannelQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:801}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,defaultValue:300,required:!0,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",role:"agent",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.openchannelAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getOpenchannelAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.openchannelAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getOpenchannelAccountApps=function(){r.promise=o.openchannelAccount.getApplications(r.query,t).$promise},r.editOpenchannelAccountApp=n,r.editInterval=function(e,n){if(r.openchannelAccountApps.rows.length){var t=r.openchannelAccountApps.rows[n]?r.openchannelAccountApps.rows[n]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteOpenchannelAccountApp=function(e){_.remove(r.openchannelAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedOpenchannelAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedOpenchannelAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedOpenchannelAccountApps.forEach(function(e){_.remove(r.openchannelAccountApps.rows,{id:e.id})}),r.selectedOpenchannelAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelAccount.getAgents({id:c.openchannelAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserOpenchannelAccount?"penalty "+e.UserOpenchannelAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelAccount.removeAgents({id:c.openchannelAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelAccount.addAgents({id:c.openchannelAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelAccount","openchannelAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditOpenchannelAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("openChannel")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.openchannelQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.openchannelQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:801}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"openchannelAccount",action:"getDispositions",field:"name",params:{id:m.openchannelAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.openchannelAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.openchannelAccountInteractions.rows.length;n+=1){var t=m.openchannelAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.openchannelInteraction.get(m.query,p).$promise}function v(e){d.openchannelInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.openchannelAccountInteractions.rows,{id:e.id}),m.openchannelAccountInteractions.count-=1,m.openchannelAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.from?e.contactName=e.from:e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("OPENCHANNEL.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.openchannelAccount={},m.openchannelAccountInteractions={count:0,rows:[]},m.selectedOpenchannelAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.openchannelAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.OpenchannelAccountId=m.openchannelAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.openchannelInteractionDownload=function(s,e,n){return d.openchannelInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="openchannel-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getOpenchannelAccountInteractions=g,m.createOrEditOpenchannelAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:m.openchannelAccount,interaction:n,interactions:m.openchannelAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spyopenchannelInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"openchannel",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"openchannel.openchannelAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||OpenchannelAccountId:=$eq["+m.openchannelAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedOpenchannelAccountInteractions=function(){var e=angular.copy(m.selectedOpenchannelAccountInteractions);return m.selectedOpenchannelAccountInteractions=[],e},m.deleteOpenchannelAccountInteraction=v,m.deleteSelectedOpenchannelAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedOpenchannelAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedOpenchannelAccountInteractions.forEach(function(e){v(e)}),m.selectedOpenchannelAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.openchannelAccountOpenchannelCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.openchannelAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.openchannelAccountOpenchannelCannedAnswers.rows,{id:e.id}),m.openchannelAccountOpenchannelCannedAnswers.count-=1,m.openchannelAccountOpenchannelCannedAnswers.rows.length||p(),l.success({title:"OpenchannelCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.openchannelAccount={},m.openchannelAccountOpenchannelCannedAnswers={count:0,rows:[]},m.selectedOpenchannelAccountOpenchannelCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.openchannelAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.OpenchannelAccountId=m.openchannelAccount.id,m.query.id=m.openchannelAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the openchannelCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("openchannelCannedAnswer #")+e.id||"openchannelCannedAnswer")+"</b> will be deleted.").ariaLabel("delete openchannelCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getOpenchannelAccountOpenchannelCannedAnswers=p,m.createOrEditOpenchannelAccountOpenchannelCannedAnswer=function(e,n){o.show({controller:"CreateOrEditOpenchannelCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:m.openchannelAccount,openchannelCannedAnswer:n,openchannelCannedAnswers:m.openchannelAccountOpenchannelCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedOpenchannelAccountOpenchannelCannedAnswers=function(){var e=angular.copy(m.selectedOpenchannelAccountOpenchannelCannedAnswers);return m.selectedOpenchannelAccountOpenchannelCannedAnswers=[],e},m.deleteOpenchannelAccountOpenchannelCannedAnswer=g,m.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected openchannelCannedAnswers?").htmlContent("<b>"+m.selectedOpenchannelAccountOpenchannelCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete openchannelCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedOpenchannelAccountOpenchannelCannedAnswers.forEach(function(e){g(e)}),m.selectedOpenchannelAccountOpenchannelCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELCANNEDANSWER",g.openchannelCannedAnswer=angular.copy(l),g.openchannelCannedAnswers=r,g.newOpenchannelCannedAnswer=!1,g.openchannelCannedAnswer||(g.openchannelCannedAnswer={},g.title="OPENCHANNEL.NEW_OPENCHANNELCANNEDANSWER",g.newOpenchannelCannedAnswer=!0),n.params.id&&(g.openchannelCannedAnswer.OpenchannelAccountId=n.params.id),g.addNewOpenchannelCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.openchannelCannedAnswer).$promise.then(function(e){g.openchannelCannedAnswers.unshift(e.toJSON()),o.success({title:"OpenchannelCannedAnswer properly created",msg:g.openchannelCannedAnswer.name?g.openchannelCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.openchannelCannedAnswer.id},g.openchannelCannedAnswer).$promise.then(function(e){var n=_.find(g.openchannelCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelCannedAnswer properly saved!",msg:g.openchannelCannedAnswer.name?g.openchannelCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelCannedAnswer will be deleted.").ariaLabel("Delete OpenchannelCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.openchannelCannedAnswer.id}).$promise.then(function(){_.remove(g.openchannelCannedAnswers,{id:g.openchannelCannedAnswer.id}),o.success({title:"OpenchannelCannedAnswer properly deleted!",msg:(g.openchannelCannedAnswer.name||"openchannelCannedAnswer")+" has been deleted!"}),v(g.openchannelCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelCannedAnswers","openchannelCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.openchannelAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.openchannelAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.OpenchannelAccountId=m.openchannelAccount.id,m.query.id=m.openchannelAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.openchannelAccount.id,field:"OpenchannelAccountId",route:"openchannelAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.openchannelAccount=c||e.params.openchannelAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:p.openchannelAccounts?p.openchannelAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoOpenchannelAccounts=function(){e.go("app.openchannel.openchannelAccounts",{},{reload:"app.openchannel.openchannelAccounts"})},p.saveOpenchannelAccount=function(){r.openchannelAccount.update({id:p.openchannelAccount.id},p.openchannelAccount).$promise.then(function(){l.success({title:"OpenchannelAccount updated!",msg:p.openchannelAccount.name?p.openchannelAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.openchannelAccount&&(t=_.find(p.lists,{id:Number(p.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.openchannelAccount&&(a=_.find(p.lists,{id:Number(p.openchannelAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.cmContact.describe({id:p.openchannelAccount.ListId}).$promise.then(function(e){p.fields=[];e=_.values(e.toJSON());for(var n=["id","createdAt","updatedAt","deletedAt","scheduledat","ListId","CompanyId"],t=0;t<e.length;t++)_.includes(n,e[t].columnName)||p.fields.push(e[t])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FIELDS",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","openchannelAccount","userProfile","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.openchannelAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="openchannelAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedOpenchannelAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.openchannel.openchannelAccounts.edit",{id:e.id,openchannelAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.openchannel.openchannelAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:f.openchannelAccounts?f.openchannelAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("openchannelAccount")+"?").htmlContent("<b>"+(e.name||"openchannelAccount")+"</b> will be deleted.").ariaLabel("delete openchannelAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getOpenchannelAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.openchannelAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="OpenchannelAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOpenchannelAccount=function(e,n){i.show({controller:"CreateOrEditOpenchannelAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:n,openchannelAccounts:f.openchannelAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOpenchannelAccount=y,f.exportSelectedOpenchannelAccounts=function(){var e=angular.copy(f.selectedOpenchannelAccounts);return f.selectedOpenchannelAccounts=[],e},f.deleteSelectedOpenchannelAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected openchannelAccounts?").htmlContent("<b>"+f.selectedOpenchannelAccounts.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedOpenchannelAccounts.forEach(function(e){y(e)}),f.selectedOpenchannelAccounts=[]})},f.deselectOpenchannelAccounts=function(){f.selectedOpenchannelAccounts=[]},f.selectAllOpenchannelAccounts=function(){f.selectedOpenchannelAccounts=f.openchannelAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.openchannelAccount&&(t=_.find(f.lists,{id:Number(f.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.openchannelAccount&&(a=_.find(f.lists,{id:Number(f.openchannelAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.openchannelAccounts=e||{count:0,rows:[]}}function y(e){m.openchannelAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.openchannelAccounts.rows,{id:e.id}),f.openchannelAccounts.count-=1,f.openchannelAccounts.rows.length||f.getOpenchannelAccounts(),p.success({title:_.startCase("OpenchannelAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getOpenchannelAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.openchannel").controller("OpenchannelAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="OPENCHANNEL.EDIT_OPENCHANNELQUEUE",r.openchannelQueue=angular.copy(n),r.openchannelQueues=e,r.newOpenchannelQueue=!1,r.openchannelQueue||(r.openchannelQueue={strategy:"beepall",timeout:10},r.title="OPENCHANNEL.NEW_OPENCHANNELQUEUE",r.newOpenchannelQueue=!0),r.addNewOpenchannelQueue=function(){r.errors=[],i.openchannelQueue.save(r.openchannelQueue).$promise.then(function(e){r.openchannelQueues.unshift(e.toJSON()),a.success({title:"OpenchannelQueue properly created",msg:r.openchannelQueue.name?r.openchannelQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveOpenchannelQueue=function(){r.errors=[],i.openchannelQueue.update({id:r.openchannelQueue.id},r.openchannelQueue).$promise.then(function(e){var n=_.find(r.openchannelQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"OpenchannelQueue properly saved!",msg:r.openchannelQueue.name?r.openchannelQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteOpenchannelQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The openchannelQueue will be deleted.").ariaLabel("Delete OpenchannelQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.openchannelQueue.delete({id:r.openchannelQueue.id}).$promise.then(function(){_.remove(r.openchannelQueues,{id:r.openchannelQueue.id}),a.success({title:"OpenchannelQueue properly deleted!",msg:(r.openchannelQueue.name||"openchannelQueue")+" has been deleted!"}),l(r.openchannelQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","openchannelQueues","openchannelQueue","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelQueue.getAgents({id:c.openchannelQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserOpenchannelQueue?"penalty "+e.UserOpenchannelQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.removeAgents({id:c.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.addAgents({id:c.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelQueue","openchannelQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelQueue.getTeams({id:l.openchannelQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.openchannelQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("OPENCHANNEL.ALL_TEAMS"),labelSelected:t.instant("OPENCHANNEL.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.removeTeams({id:l.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.addTeams({id:l.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","openchannelQueue","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.openchannelQueue=c||e.params.openchannelQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoOpenchannelQueues=function(){e.go("app.openchannel.openchannelQueues",{},{reload:"app.openchannel.openchannelQueues"})},u.saveOpenchannelQueue=function(){r.openchannelQueue.update({id:u.openchannelQueue.id},u.openchannelQueue).$promise.then(function(){l.success({title:"OpenchannelQueue updated!",msg:u.openchannelQueue.name?u.openchannelQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","openchannelQueue","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.openchannelQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="openchannelQueues",f.listOrder="",f.listOrderAsc=null,f.selectedOpenchannelQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.openchannel.openchannelQueues.edit",{id:e.id,openchannelQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:f.openchannelQueues?f.openchannelQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:f.openchannelQueues?f.openchannelQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("openchannelQueue")+"?").htmlContent("<b>"+(e.name||"openchannelQueue")+"</b> will be deleted.").ariaLabel("delete openchannelQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:810}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.openchannel.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.openchannel.realtime.queues",{})}},f.success=E,f.getOpenchannelQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.openchannelQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="OpenchannelQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOpenchannelQueue=function(e,n){i.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:n,openchannelQueues:f.openchannelQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteOpenchannelQueue=y,f.exportSelectedOpenchannelQueues=function(){var e=angular.copy(f.selectedOpenchannelQueues);return f.selectedOpenchannelQueues=[],e},f.deleteSelectedOpenchannelQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected openchannelQueues?").htmlContent("<b>"+f.selectedOpenchannelQueues.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedOpenchannelQueues.forEach(function(e){y(e)}),f.selectedOpenchannelQueues=[]})},f.deselectOpenchannelQueues=function(){f.selectedOpenchannelQueues=[]},f.selectAllOpenchannelQueues=function(){f.selectedOpenchannelQueues=f.openchannelQueues.rows};var b=!0,A=1;function E(e){f.openchannelQueues=e||{count:0,rows:[]}}function y(e){m.openchannelQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.openchannelQueues.rows,{id:e.id}),f.openchannelQueues.count-=1,f.openchannelQueues.rows.length||f.getOpenchannelQueues(),p.success({title:_.startCase("OpenchannelQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEopenchannelQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getOpenchannelQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.openchannel").controller("OpenchannelQueuesController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.openchannel.realtime.agents":this.selectedTab=0;break;case"app.openchannel.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.openchannel.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.openchannel.realtime.agents");break;case 1:t.go("app.openchannel.realtime.queues");break;default:t.go("app.openchannel.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.openchannel").controller("OpenchannelRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.currentUser=s.getCurrentUser(),o.plugin={},o.getTrustedURL=function(){return t.trustAsResourceUrl(o.plugin.adminUrl)},a.plugin.get({id:e.params.id}).$promise.then(function(e){if(e)return o.plugin=e,a.plugin.get({id:o.plugin.id}).$promise}).catch(function(e){o.plugin=void 0})}e.$inject=["$state","$scope","$sce","api","socket","Auth"],angular.module("app.plugins.plugin").controller("PluginController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o,r,l,d,c,m,u,p,g,v){var h=this,f=i.params.direction||"inbound",b=g&&1==g.count?g.rows[0].crudPermissions:null;function A(n){return h.query.offset=(h.query.page-1)*h.query.limit,e.resolve().then(function(){if(!0===n){var e=Object.assign({},_.omit(h.query,["limit","offset","page"]),{nolimit:!0});return o.realtime.getAgents(e).$promise}}).then(function(e){e&&(h.amiAgents=e)}).then(function(){var e=h.queues?h.queues.rows:[];h.agents=l.paginateAgents(h.amiAgents.rows,e,h.query)}).catch(function(e){c.error({title:s.instant("VOICE.AGENTS"),msg:e.status?JSON.stringify(e.data):e.toString()})})}function E(e){return _.find(h.amiAgents.rows,["id",e])}function y(e){var n=E(e.id);n?(Object.assign(n,e),A()):r.isAdmin()&&A(!0)}function S(){A(!0)}function T(e){var n=E(e.id);n?(Object.assign(n,e),A()):r.isAdmin()&&A(!0)}function I(){A(!0)}function O(e){var n=E(e.id);n?(Object.assign(n,_.pick(e,["queue","destconnectedlinenum","routealias"])),A()):r.isAdmin()&&A(!0)}function C(e){if("ATTENDED"!==e.transfer){var n=E(e.id);n?(delete n.queue,delete n.destconnectedlinenum,delete n.routealias,A()):r.isAdmin()&&A(!0)}}function w(e){if(0!==h.query.globalQueueFilter.length){var n=e[_.capitalize(h.channel)+"QueueId"];if(h.query.globalQueueFilter.includes(n))_.find(h.queues.rows,function(e){return e.id===n}).Agents.push({id:e.UserId}),A()}}function R(n){if(0!==h.query.globalQueueFilter.length){var t=n[_.capitalize(h.channel)+"QueueId"];if(h.query.globalQueueFilter.includes(t)){var e=_.find(h.queues.rows,function(e){return e.id===t});_.remove(e.Agents,function(e){return e.id===n.UserId}),A()}}}function x(){h.queues&&D(!0)}function N(){h.queues&&D(!0)}function D(e){if(!(h.queues&&0<h.queues.count)||e){var n={type:f,fields:"id,name",sort:"name",nolimit:!0,include:[{model:"User",alias:"Agents",fields:["id","name"],raw:!0}]},t=h.channel+"Queue";return o.getResourcesByRole(h.currentUser,t,n,null).then(function(e){h.queues=e}).catch(function(e){c.error({title:s.instant("VOICE.QUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})}}h.currentUser=r.getCurrentUser(),h.channel=i.params.channel,h.amiAgents=m,h.pauses=p,h.license=u,h.crudPermissions=r.parseCrudPermissions(b),h.utcOffset=v,h.query={channel:h.channel,globalQueueFilter:[],globalStatusFilter:null,pauseTypeFilter:null,limit:10,page:1,sort:"fullname"},h.$onInit=function(){d.on("user:remove",I),d.on("user:save",S),d.on("user:update",T),d.on("user:agentconnect",O),d.on("user:agentcomplete",C),d.on("user:ami:update",y),d.on("user:routing:update",y),d.on("user"+_.capitalize(h.channel)+"Queue:save",w),d.on("user"+_.capitalize(h.channel)+"Queue:remove",R),d.on(h.channel+"Queue:save",x),d.on(h.channel+"Queue:remove",N),A()},h.getAgents=A,h.onPaginate=function(){A()},h.onSort=function(){A()},h.logout=function(e){return o.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){c.success({title:"Agent logout",msg:e.fullname+"  properly logout"})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.LOGOUT"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.pause=function(e,n){return o.user.pause({id:e.id,type:n}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.PAUSE"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.unpause=function(e){return o.user.unpause({id:e.id}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.UNPAUSE"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.addQueue=function(e,n){a.show({controller:"AgentQueueAddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,channel:h.channel,direction:f,crudPermissions:h.crudPermissions}})},h.manageScreenRecording=function(e,n){return o.user.update({id:e.id},{screenrecording:n}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.SCREENRECORDING"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.getQueuesByChannel=D,h.selectAllQueues=function(){h.query.globalQueueFilter=h.queues.rows.map(function(e){return e.id})},h.clearQueuesSelection=function(){h.query.globalQueueFilter=[]},n.$on("$destroy",function(){d.removeAllListeners("user:remove"),d.removeAllListeners("user:save"),d.removeAllListeners("user:update"),d.removeAllListeners("user:agentconnect"),d.removeAllListeners("user:agentcomplete"),d.removeAllListeners("user:ami:update"),d.removeAllListeners("user:routing:update"),d.removeAllListeners("user"+_.capitalize(h.channel)+"Queue:save"),d.removeAllListeners("user"+_.capitalize(h.channel)+"Queue:remove")})}e.$inject=["$document","$mdDialog","$q","$scope","$state","$translate","api","Auth","realtimeManager","socket","toasty","agents","license","pauses","userProfileSection","utcOffset"],angular.module("app.realtime").controller("AgentsRealtimeController",e)}(),function(){"use strict";function e(e,a,n,i,s,t,o,r,l,d,c){var m=this,u=c&&1==c.count?c.rows[0].crudPermissions:null;function p(){return m.queues.rows.map(function(e){return e.name})}function g(n){if(n.type===m.voiceQueueType&&p().includes(n.queue)){var e=_.find(m.voiceQueuesChannels.rows,function(e){return e.uniqueid===n.uniqueid});e?Object.assign(e,n):(m.voiceQueuesChannels.rows.push(n),m.voiceQueuesChannels.count=m.voiceQueuesChannels.rows.length)}}function v(n){m.voiceQueuesChannels.rows=_.filter(m.voiceQueuesChannels.rows,function(e){return e.uniqueid!==n.uniqueid}),m.voiceQueuesChannels.count=m.voiceQueuesChannels.rows.length}m.currentUser=t.getCurrentUser(),m.queues=l,m.voiceQueuesChannels=d,m.voiceQueueType=n.params.direction,m.crudPermissions=t.parseCrudPermissions(u),m.query={limit:10,page:1},m.$onInit=function(){o.on("voice_queue_channel:save",g),o.on("voice_queue_channel:remove",v);var n=p(),e=m.voiceQueuesChannels.rows.filter(function(e){if(n.includes(e.queue))return!0});m.voiceQueuesChannels.rows=e,m.voiceQueuesChannels.count=e.length},m.hangup=function(e){return s.rpc.getVoiceQueuesChannelHangup({uniqueid:e}).$promise.then(function(e){r.success({title:i.instant("VOICE.CALL_HANGUP_SUCCESS"),msg:e.message||void 0})}).catch(function(e){r.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},m.getAvailableAgents=function(){m.availableAgents=null;var e={id:t.isUser()?m.currentUser.userProfileId:void 0,fields:"id,name,fullname,internal,context,online,voicePause,voiceStatus",sort:"fullname",online:!0,voicePause:!1};return s.realtime.getAgents(e).$promise.then(function(e){var n=e.rows.filter(function(e){return"idle"===e.voiceStatus});m.availableAgents=n}).catch(function(e){r.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},m.redirectToAgent=function(e,n,t){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:e,exten:n,context:t}).$promise.then(function(e){r.success({title:i.instant("VOICE.CALL_REDIRECT_SUCCESS"),msg:e.message||void 0})}).catch(function(e){r.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},m.redirectToNumber=function(e,n){var t=a.prompt().title(i.instant("VOICE.CALL_NUMBER_REDIRECT")).placeholder(i.instant("DASHBOARDS.NUMBER")).targetEvent(e).ok("Ok").cancel(i.instant("TOOLBAR.CANCEL"));return a.show(t).then(function(e){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e}).$promise}).then(function(e){r.success({title:i.instant("VOICE.CALL_REDIRECT_SUCCESS"),msg:e.message||void 0})}).catch(function(e){e&&r.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},e.$on("$destroy",function(){o.removeAllListeners("voice_queue_channel:save"),o.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$mdDialog","$state","$translate","api","Auth","socket","toasty","queues","voiceQueuesChannels","userProfileSection"],angular.module("app.realtime").controller("QueueCallsRealtimeController",e)}(),function(){"use strict";function e(i,s,e,n,t,a,o,r,l,d,c,m,u){var p=this,g=e(function(){},999),v=u&&1==u.count?u.rows[0].crudPermissions:null,h=t.params.direction,f="outbound"===h?"QueueCampaigns":_.startCase(p.channel)+"Queues";function b(e){var n=_.find(p.queues.rows,["id",e.id]);n&&(n=l.updateQueue(e,n))}p.currentUser=r.getCurrentUser(),p.channel=t.params.channel,p.queues=m,p.crudPermissions=r.parseCrudPermissions(v),p.headersTemplate=null,p.rowsTemplate=null,p.query={id:r.isUser()?p.currentUser.id:void 0,section:r.isUser()?f:void 0,channel:p.channel,type:h,sort:"name",limit:10,page:1},p.$onInit=function(){var e,n;d.on(p.channel+"_queue:save",b),p.headersTemplate=(e="default.html","voice"===p.channel&&(e=h+".html"),"app/main/apps/realtime/views/queues/templates/headers/"+e),p.rowsTemplate=(n="default.html","voice"===p.channel&&(n=h+".html"),"app/main/apps/realtime/views/queues/templates/rows/"+n),"voice"===p.channel&&p.queues.rows.forEach(function(e){0<e.ringing&&e.available<e.loggedIn&&(e.available+=e.ringing)})},p.getQueues=function(){return p.query.offset=(p.query.page-1)*p.query.limit,o.realtime.getQueues(p.query).$promise.then(function(e){p.queues=e}).catch(function(e){c.error({title:a.instant("DASHBOARDS.QUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},p.editQueue=function(e,n){var t={crudPermissions:p.crudPermissions};t[p.channel+"Queue"]=n,t[p.channel+"Queues"]=p.queues.rows;var a={controller:"CreateOrEdit"+_.startCase(p.channel)+"QueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/"+p.channel+"/views/"+p.channel+"Queues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:t};return s.show(a)},p.addOrRemoveAgents=function(e,n){var t={realtime:"voice"===p.channel,crudPermissions:p.crudPermissions};t[p.channel+"Queue"]=n,t[p.channel+"Queues"]=p.queues.rows;var a={controller:_.startCase(p.channel)+"QueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/"+p.channel+"/views/"+p.channel+"Queues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:t};return s.show(a)},p.showPredictiveInfo=function(e,n){var t={controller:"PredictiveInfoDialogController",controllerAs:"vm",templateUrl:"app/main/apps/realtime/views/queues/predictive/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n}};return s.show(t)},n.$on("$destroy",function(){d.removeAllListeners(p.channel+"_queue:save"),g&&e.cancel(g)})}e.$inject=["$document","$mdDialog","$interval","$scope","$state","$translate","api","Auth","realtimeManager","socket","toasty","queues","userProfileSection"],angular.module("app.realtime").controller("QueuesRealtimeController",e)}(),function(){"use strict";function e(e,n){this.queueCampaign=n,this.formatTime=function(e,n){var t=moment(e);return n&&t.add(n,"minutes"),t.format("HH:mm:ss")},this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","queueCampaign"],angular.module("app.realtime").controller("PredictiveInfoDialogController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u){var p=this;function g(e){p.cloudProviders=e||{count:0,rows:[]}}function v(e){r.cloudProvider.delete({id:e.id}).$promise.then(function(){_.remove(p.cloudProviders.rows,{id:e.id}),p.cloudProviders.count-=1,p.cloudProviders.rows.length||p.getAiTools(),d.success({title:s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcloudProvider"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcloudProvider",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}p.license=m,p.setting=u,p.currentUser=c.getCurrentUser(),p.cloudProviders=o||{count:0,rows:[]},p.selectedAiTools=[],p.query={fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data5,data6",sort:"-updatedAt",limit:10,page:1},p.services={AmazonAWS:"AmazonAWS",MicrosoftAzure:"Microsoft Azure"},p.editdialog=function(e,n){a.show({controller:"CreateOrEditCloudProviderDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/create/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{cloudProvider:e,cloudProviders:p.cloudProviders.rows,license:p.license,setting:null,crudPermissions:p.crudPermissions}})},p.deleteconfirm=function(e,n){var t=a.confirm().title(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_TITLE")).content(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_MESSAGE",{name:e.name})).ariaLabel("delete cloud provider").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){v(e)})},p.success=g,p.getAiTools=function(){p.query.offset=(p.query.page-1)*p.query.limit,c.hasRole("admin")?p.promise=r.cloudProvider.get(p.query,g).$promise:(p.query.id=p.userProfile.id,p.query.section="AiTools",p.promise=r.userProfile.getResources(p.query,g).$promise)},p.createOrEditCloudProvider=function(e,n){a.show({controller:"CreateOrEditCloudProviderDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{cloudProvider:n,cloudProviders:p.cloudProviders.rows,license:p.license,setting:p.setting,crudPermissions:p.crudPermissions}})},p.deleteCloudProvider=v,p.exportSelectedAiTools=function(){var e=angular.copy(p.selectedAiTools);return p.selectedAiTools=[],e},p.deleteSelectedAiTools=function(e){var n=a.confirm().title(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETE_TITLE")).content(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETE_MESSAGE",{total:p.selectedAiTools.length})).ariaLabel("delete CloudProviders").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){p.selectedAiTools.forEach(function(e){v(e)}),p.selectedAiTools=[],d.success({title:s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETED_SUCCESS_TITLE")})})},p.deselectAiTools=function(){p.selectedAiTools=[]},p.selectAllAiTools=function(){p.selectedAiTools=p.cloudProviders.rows},p.authenticateToMicrosoftIdentityPlatform=function(e){return r.cloudProvider.oauth2MicrosoftAuthorize({id:e.id}).$promise.then(function(e){p.loginWindow=n.open(e.url,"_blank","width=800,height=600")})},p.updateClientSecret=function(n,e){return a.show({controller:"UpdateClientSecretController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/updateSecret/updateSecret.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{cloudProvider:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,service,data3",id:n.id})}]}})},l.on("microsoftAuthorization:success",function(e){p.currentUser.id===e.id&&(p.loginWindow.close(),d.success({msg:s.instant("SETTINGS.NOTIFICATIONS.MICROSOFT_AUTHENTICATION_SUCCESS")}))}),l.on("microsoftAuthorization:error",function(e){p.currentUser.id===e.id&&(p.loginWindow.close(),d.error({msg:s.instant("SETTINGS.NOTIFICATIONS.MICROSOFT_AUTHENTICATION_FAIL")}))}),e.$on("$destroy",function(){l.removeAllListeners("microsoftAuthorization:success"),l.removeAllListeners("microsoftAuthorization:error")});var h=!0,f=1;e.$watch("vm.query.filter",function(e,n){h?i(function(){h=!1}):(n||(f=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=f),p.getAiTools())})}e.$inject=["$scope","$window","$mdDialog","$document","$timeout","$translate","cloudProviders","api","socket","toasty","Auth","license","setting"],angular.module("app.settings").controller("CloudProvidersController",e)}(),function(){"use strict";function e(t,a,i,e,n,s,o,r){var l=this;function d(e){t.hide(e)}l.currentUser=o.getCurrentUser(),l.license=r,l.cloudProvider=angular.copy(n),l.cloudProviders=e,l.newCloudProvider=!1,l.errors=[],l.cloudProvider||(l.cloudProvider={},l.newCloudProvider=!0),l.addNewCloudProvider=function(){l.errors=[],s.cloudProvider.save(l.cloudProvider).$promise.then(function(e){l.cloudProviders.unshift(e.toJSON()),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_CREATED_SUCCESS_TITLE")}),d(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.saveCloudProvider=function(){l.errors=[],s.cloudProvider.update({id:l.cloudProvider.id},l.cloudProvider).$promise.then(function(e){var n=_.find(l.cloudProviders,{id:e.id});n&&_.merge(n,e.toJSON()),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_SAVED_SUCCESS_TITLE")}),d(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.deleteCloudProvider=function(e){l.errors=[];var n=t.confirm().title(a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_TITLE")).content(a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_MESSAGE",{name:l.cloudProvider.name})).ariaLabel("Delete Cloud Provider").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){s.cloudProvider.delete({id:l.cloudProvider.id}).$promise.then(function(){_.remove(l.cloudProviders,{id:l.cloudProvider.id}),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETED_SUCCESS_TITLE")}),d(l.cloudProvider)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},l.closeDialog=d}e.$inject=["$mdDialog","$translate","toasty","cloudProviders","cloudProvider","api","Auth","license"],angular.module("app.settings").controller("CreateOrEditCloudProviderDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;function o(){e.hide()}s.cloudProvider=i,s.errors=[],s.saveSecret=function(){return s.errors=[],a.cloudProvider.update({id:i.id},{data3:s.newSecret}).$promise.then(function(){t.success({title:n.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_SECRET_UPDATE_SUCCESS_TITLE")}),o()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){s.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.update"}];for(var n=0;n<e.data.errors.length;n+=1)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},s.closeDialog=o}e.$inject=["$mdDialog","$translate","toasty","api","cloudProvider"],angular.module("app.settings").controller("UpdateClientSecretController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SETTINGS.EDIT_CUSTOMIZATION",g.customization=angular.copy(l),g.customizations=r,g.newCustomization=!1,g.customization||(g.customization={},g.title="SETTINGS.NEW_CUSTOMIZATION",g.newCustomization=!0),g.addNewCustomization=function(){g.errors=[],d.setting.save(g.customization).$promise.then(function(e){g.customizations.unshift(e.toJSON()),o.success({title:"Customization properly created",msg:g.customization.name?g.customization.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomization=function(){g.errors=[],d.setting.update({id:g.customization.id},g.customization).$promise.then(function(e){var n=_.find(g.customizations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Customization properly saved!",msg:g.customization.name?g.customization.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomization=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The customization will be deleted.").ariaLabel("Delete Customization").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.setting.delete({id:g.customization.id}).$promise.then(function(){_.remove(g.customizations,{id:g.customization.id}),o.success({title:"Customization properly deleted!",msg:(g.customization.name||"customization")+" has been deleted!"}),v(g.customization)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customizations","customization","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditCustomizationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.customizations=e,s.customization={},s.customizations&&s.customizations.rows&&s.customizations.rows.length&&(s.customization=s.customizations.rows[0]),s.saveCustomization=function(){s.customization.id?n.setting.update({id:s.customization.id},s.customization).$promise.then(function(){t.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):n.setting.save(s.customization).$promise.then(function(e){_.merge(s.customization,e),t.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["customizations","api","toasty","license","Auth"],angular.module("app.settings").controller("CustomizationsController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg","ico"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/favicon".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationfaviconController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/logo".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationlogoController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/logo_login".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationlogologinController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/preferred".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationpreferredController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SETTINGS.EDIT_GENERAL",g.general=angular.copy(l),g.generals=r,g.newGeneral=!1,g.general||(g.general={min_internal:1e3,chatTimeout:30,phoneBarAutoUpdater:!0,phoneBarAutoUpdaterUrl:"https://www.xcally.com/bar/phonebar/autoupdater.xml",splitSizeCsv:5e3,splitSizePdf:1e3,splitSizeXlsx:5e3,messagesAlignment:"alternate",phoneBarRememberMeEnabled:!0,allowedLoginAttempts:5,blockDuration:10,loginMailFrequency:10,enforcePasswordHistory:!0,passwordHistoryLimit:3},g.title="SETTINGS.NEW_GENERAL",g.newGeneral=!0),g.addNewGeneral=function(){g.errors=[],d.setting.save(g.general).$promise.then(function(e){g.generals.unshift(e.toJSON()),o.success({title:"General properly created",msg:g.general.name?g.general.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveGeneral=function(){g.errors=[],d.setting.update({id:g.general.id},g.general).$promise.then(function(e){var n=_.find(g.generals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"General properly saved!",msg:g.general.name?g.general.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteGeneral=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The general will be deleted.").ariaLabel("Delete General").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.setting.delete({id:g.general.id}).$promise.then(function(){_.remove(g.generals,{id:g.general.id}),o.success({title:"General properly deleted!",msg:(g.general.name||"general")+" has been deleted!"}),v(g.general)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,d.cloudProvider.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.cloudProviders=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CLOUDPROVIDERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","generals","general","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditGeneralDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.generals=e,s.general={},s.generals&&s.generals.rows&&s.generals.rows.length&&(s.general=s.generals.rows[0]),_.isNil(s.general.privacyPolicyEmail)||(s.general.enablePrivacyPolicyEmail=!0),_.isNil(s.general.privacyPolicyName)||(s.general.enablePrivacyPolicyName=!0),_.isNil(s.general.privacyPolicyNumber)||(s.general.enablePrivacyPolicyNumber=!0),n.cloudProvider.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){s.cloudProviders=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CLOUDPROVIDERS",msg:e.data?JSON.stringify(e.data):e.toString()})}),s.saveGeneral=function(){s.general.enablePrivacyPolicyEmail||(s.general.privacyPolicyEmail=null),s.general.enablePrivacyPolicyNumber||(s.general.privacyPolicyNumber=null),s.general.enablePrivacyPolicyName||(s.general.privacyPolicyName=null),s.general.id?n.setting.update({id:s.general.id},s.general).$promise.then(function(){t.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):n.setting.save(s.general).$promise.then(function(e){_.merge(s.general,e),t.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.onPrivacyPolicyChange=function(e){switch(e){case"email":s.general.enablePrivacyPolicyEmail&&!s.general.privacyPolicyEmail&&(s.general.privacyPolicyEmail=0);break;case"name":s.general.enablePrivacyPolicyName&&!s.general.privacyPolicyName&&(s.general.privacyPolicyName=0);break;case"number":s.general.enablePrivacyPolicyNumber&&!s.general.privacyPolicyNumber&&(s.general.privacyPolicyNumber=0)}}}e.$inject=["generals","api","toasty","license","Auth"],angular.module("app.settings").controller("GeneralsController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l){var d=this;d.license=i||{},d.agents=0,d.users=0,d.telephones=0,d.channels=[{name:"voice",icon:"icon-phone"},{name:"chat",icon:"icon-hangouts"},{name:"mail",icon:"icon-email"},{name:"messaging",icon:"icon-message-text"},{name:"fax",icon:"icon-deskphone"},{name:"openchannel",icon:"icon-google-earth"},{name:"whatsapp",icon:"icon-whatsapp"}],d.modules=[{name:"cm",icon:"icon-account-circle"},{name:"dialer",icon:"icon-crosshairs"},{name:"jscripty",icon:"icon-console"}],d.addons=[{name:"webrtc",icon:"icon-server-plus"},{name:"jaws",icon:"icon-fish"},{name:"custom",icon:"icon-table-edit"},{name:"screenrecording",icon:"icon-video"},{name:"ai",icon:"icon-text-to-speech"}],d.sessions=[{name:"callysquare",icon:"icon-sitemap",restart:!0,label:"channels",enabled:"voice"},{name:"virtual",icon:"icon-dots-horizontal",restart:!1,label:"sessions",enabled:"chat"}],d.others=[{name:"update",icon:"icon-cloud-download"}],d.requestLicense=function(e){t.show({controller:"RequestLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/request/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i,channels:d.channels,modules:d.modules,addons:d.addons,sessions:d.sessions,others:d.others}})},d.updateLicense=function(e){t.show({controller:"UpdateLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/update/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i}})},d.gotoProcess=function(e){a.go("app.settings.system",{tab:1})},d.alert=s.info,d.downloadLogFile=function(){return o.license.downloadLogFile().$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","license-info.log"),document.body.appendChild(a),a.click(),s.success({title:l.instant("SETTINGS.LICENSE_LOG_FILE"),msg:l.instant("SETTINGS.LICENSE_LOG_FILE_DOWNLOADED")})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DOWNLOADJSON",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.isAdmin=r.isAdmin(),o.user.get({fields:"id",role:"agent",online:!0}).$promise.then(function(e){return d.agents=e&&e.count?e.count:0,o.user.get({fields:"id",role:"user,admin"}).$promise}).then(function(e){return d.users=e&&e.count?e.count:0,o.user.get({fields:"id",role:"telephone"}).$promise}).then(function(e){d.telephones=e&&e.count?e.count:0}).catch(function(e){console.log(e)})}e.$inject=["$document","$window","$mdDialog","$state","license","toasty","api","Auth","$translate"],angular.module("app.settings.license").controller("LicenseController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(){e.hide()}m.errors=[],m.user=d.getCurrentUser(),m.license=angular.copy(t),m.channels=a,m.modules=i,m.addons=s,m.sessions=o,m.others=r,m.license.name=m.user.fullname,m.license.email=m.user.email,m.sendRequest=function(){for(var e in m.errors=[],m.table="||FIELD||OLD||NEW||\n",m.license)m.license.hasOwnProperty(e)&&!_.includes(["$promise","$resolved"],e)&&(t[e]===m.license[e]?m.table+="|"+e+"|"+(void 0!==t[e]?t[e]:"")+"|"+m.license[e]+"|\n":m.table+="|"+e+"|{color:red}"+(void 0!==t[e]?t[e]:"")+"{color}|*"+m.license[e]+"*|\n");l.jira.save({key:"MOTLICENSE",summary:"Motion License Request",description:m.table,issuetype:"License Request"}).$promise.then(function(e){n.success({title:"Request sent!",msg:c.instant("SETTINGS.LICENSE_REQUEST_SENT"),timeout:15e3}),u()}).catch(function(e){console.error(e),m.errors=[{message:c.instant("SETTINGS.JIRA_ERROR_MESSAGE"),type:"api.jira"}]})},m.closeDialog=u}e.$inject=["$mdDialog","toasty","license","channels","modules","addons","sessions","others","api","Auth","$translate"],angular.module("app.settings.license").controller("RequestLicenseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.errors=[],s.license=angular.copy(t),s.licenseKey,s.updateLicense=function(){return a.license.update({id:1,key:s.licenseKey}).$promise.then(function(e){e&&(e.demo?n.error({title:"License update failed!",msg:"Invalid license key"}):n.success({title:"License properly updated!",msg:"The license has been updated!"}))}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATElicense",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","toasty","license","api","$translate"],angular.module("app.settings.license").controller("UpdateLicenseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(e){a.hide(e)}p.currentUser=c.getCurrentUser(),p.errors=[],p.setting=u,p.license=m,p.hasModulePermissions={},p.passwordPattern=p.setting&&p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.title="SETTINGS.EDIT_NETWORK",p.network=angular.copy(l),p.networks=r,p.newNetwork=!1,p.network||(p.network={type:"localnet"},p.title="SETTINGS.NEW_NETWORK",p.newNetwork=!0),p.addNewNetwork=function(){p.errors=[],d.network.save(p.network).$promise.then(function(e){p.networks.unshift(e.toJSON()),o.success({title:"Network properly created",msg:p.network.name?p.network.name+" has been created!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveNetwork=function(){p.errors=[],d.network.update({id:p.network.id},p.network).$promise.then(function(e){var n=_.find(p.networks,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Network properly saved!",msg:p.network.name?p.network.name+" has been saved!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteNetwork=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The network will be deleted.").ariaLabel("Delete Network").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.network.delete({id:p.network.id}).$promise.then(function(){_.remove(p.networks,{id:p.network.id}),o.success({title:"Network properly deleted!",msg:(p.network.name||"network")+" has been deleted!"}),g(p.network)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.getDateFromString=function(e){return null===e?void 0:new Date(e)},p.closeDialog=g}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","networks","network","api","Auth","license","setting"],angular.module("app.settings").controller("CreateOrEditNetworkDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;v.license=p,v.setting=g,v.currentUser=u.getCurrentUser(),v.networks=l||{count:0,rows:[]},v.table="networks",v.listOrder="",v.listOrderAsc=null,v.selectedNetworks=[],v.query={fields:"createdAt,updatedAt,id,type,value,username,password",sort:"-updatedAt",limit:10,page:1},v.arraytype=_.keyBy([{option:"LocalNET",value:"'localnet'"},{option:"ExternIP",value:"'externip'"},{option:"Turn",value:"'turn'"},{option:"Stun",value:"'stun'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),v.editdialog=function(e,n){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{network:e,networks:v.networks.rows,license:v.license,setting:null,crudPermissions:v.crudPermissions}})},v.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("network")+"?").htmlContent("<b>"+(e.name||"network")+"</b> will be deleted.").ariaLabel("delete network").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){A(e)},function(){console.log("CANCEL")})},v.success=b,v.getNetworks=function(){v.query.offset=(v.query.page-1)*v.query.limit,u.hasRole("admin")?v.promise=d.network.get(v.query,b).$promise:(v.query.id=v.userProfile.id,v.query.section="Networks",v.promise=d.userProfile.getResources(v.query,b).$promise)},v.createOrEditNetwork=function(e,n){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{network:n,networks:v.networks.rows,license:v.license,setting:v.setting,crudPermissions:v.crudPermissions}})},v.deleteNetwork=A,v.exportSelectedNetworks=function(){var e=angular.copy(v.selectedNetworks);return v.selectedNetworks=[],e},v.deleteSelectedNetworks=function(e){var n=i.confirm().title("Are you sure want to delete the selected networks?").htmlContent("<b>"+v.selectedNetworks.length+" selected</b> will be deleted.").ariaLabel("delete Networks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){v.selectedNetworks.forEach(function(e){A(e)}),v.selectedNetworks=[]})},v.deselectNetworks=function(){v.selectedNetworks=[]},v.selectAllNetworks=function(){v.selectedNetworks=v.networks.rows};var h=!0,f=1;function b(e){v.networks=e||{count:0,rows:[]}}function A(e){d.network.delete({id:e.id}).$promise.then(function(){_.remove(v.networks.rows,{id:e.id}),v.networks.count-=1,v.networks.rows.length||v.getNetworks(),m.success({title:_.startCase("Network")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEnetwork"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEnetwork",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){h?o(function(){h=!1}):(n||(f=v.query.page),e!==n&&(v.query.page=1),e||(v.query.page=f),v.getNetworks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","networks","api","msUtils","toasty","Auth","license","setting"],angular.module("app.settings").controller("NetworksController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;l.currentUser=o.getCurrentUser(),l.license=s,l.providers=r.getEmailProviders(),l.mailAccounts=e||{rows:[],count:0},l.cloudProviders=t||{rows:[],count:0},l.mailAccount={service:!0,Smtp:{}},0<l.mailAccounts.count&&(l.mailAccount=l.mailAccounts.rows[0]),l.originalProvider=l.mailAccount.provider,l.saveSmtp=function(){var e=angular.copy(l.mailAccount);"custom"===e.provider?e.provider=null:(l.originalProvider!==e.provider&&(e.Smtp.modernAuthentication?e.Smtp.pass=null:e.Smtp.CloudProviderId=null),e.Smtp.modernAuthentication||(e.Smtp.CloudProviderId=null),e.Smtp=_.omit(e.Smtp,["host","port","secure","service"]));l.mailAccount.id?a.mailAccount.update({id:l.mailAccount.id},e).$promise.then(function(){l.originalProvider=e.provider,i.success({msg:n.instant("SETTINGS.NOTIFICATIONS.SMTP_SAVED_SUCCESS_TITLE")})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}):a.mailAccount.save(e).$promise.then(function(e){_.merge(l.mailAccount,e),i.success({msg:n.instant("SETTINGS.NOTIFICATIONS.SMTP_SAVED_SUCCESS_TITLE")})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},l.verifySmtp=function(){a.mailAccount.verifySmtp({id:l.mailAccount.id}).$promise.then(function(){i.success({msg:n.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_SUCCESS_TITLE")})}).catch(function(e){i.error({title:n.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:e.data?JSON.stringify(e.data):e.toString(),timeout:1e4})})},l.onProviderChange=function(){"custom"!==l.mailAccount.provider&&(l.mailAccount.authentication=!0);"outlook365"!==l.mailAccount.provider&&(l.mailAccount.Smtp.modernAuthentication=!1)}}e.$inject=["$translate","mailAccounts","cloudProviders","api","toasty","license","Auth","msUtils"],angular.module("app.settings").controller("SmtpController",e)}(),function(){"use strict";function e(e,i,s,n,t,a,o,r){var l,d=this;d.system=t||{},d.processes=a?a.rows:[],d.processLimit=7,d.selectedTab=n.params.tab||0,d.getInfo=function(){return r.system.get().$promise.then(function(e){_.merge(d.system,e)}).catch(d.cancelInterval)},d.getProcesses=function(){return r.pm2.get().$promise.then(function(e){_.merge(d.processes,e?e.rows:[])}).catch(d.cancelInterval)},d.cancelInterval=function(e){i.cancel(l)},d.updateProcess=function(e,n,t){var a=s.confirm().title("Would you like to change the status of the process #"+n+"?").textContent("The status will be changed to: "+t.toUpperCase()).ariaLabel("Lucky day").targetEvent(e).ok("Ok").cancel("Cancel");s.show(a).then(function(){return r.pm2.update({id:n,status:t})}).then(function(){i(d.getProcesses,1e3,1)}).then(function(){o.success({title:"Process updated!",msg:"Status properly changed to: "+t})})},l=i(d.getInfo,5e3),e.$on("$destroy",function(){d.cancelInterval()})}e.$inject=["$scope","$interval","$mdDialog","$state","system","processes","toasty","api"],angular.module("app.settings.system").controller("SystemController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.title="SETTINGS.UPDATE",s.progress=0,s.updating=!0,s.output="Waiting...",s.success=!0,s.interval=n(function(){s.progress<90&&(s.progress+=1)},1e3),s.closeDialog=function(){e.hide()},s.reload=function(){t.location.reload()},s.stopInterval=function(){angular.isDefined(s.interval)&&(n.cancel(s.interval),s.interval=void 0);s.progress=100,s.updating=!1},i.version.fetch().$promise.then(function(e){return s.output=e.output+"...",i.version.reset().$promise}).then(function(e){return s.output=e.output+"...",i.version.pull().$promise}).then(function(e){return s.output=e.output+"...",i.version.migrations().$promise}).then(function(e){return s.output=e.output+"...",i.version.restart().$promise}).then(function(e){s.output="Waiting to restart motion...",a(function(){s.stopInterval()},3e4)}).catch(function(e){s.success=!1,s.stopInterval(),s.output=JSON.stringify(e)})}e.$inject=["$mdDialog","$interval","$window","$timeout","api"],angular.module("app.settings").controller("UpdateDialogController",e)}(),function(){"use strict";function e(t,e,a,n,i){this.version=n||{},this.updateConfirm=function(e){var n=t.confirm().title("Would you like to update your system?").htmlContent('The system request time for the update should be below 1 minute.<br><br>Do you agree the terms of this <a href="http://www.xcally.com/support/eula-xcally-license-en.pdf" target="_blank">End User License Agreement<a>?').ariaLabel("").targetEvent(e).clickOutsideToClose(!0).parent(angular.element(a.body)).ok("I agree").cancel("Disagree");t.show(n).then(function(){t.show({controller:"UpdateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/updates/update/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!1})})}}e.$inject=["$mdDialog","$interval","$document","version","toasty"],angular.module("app.settings").controller("UpdatesController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.sms.realtime.agents":this.selectedTab=0;break;case"app.sms.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.sms.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.sms.realtime.agents");break;case 1:t.go("app.sms.realtime.queues");break;default:t.go("app.sms.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.sms").controller("SmsRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSACCOUNT",g.smsAccount=angular.copy(l),g.smsAccounts=r,g.newSmsAccount=!1,g.smsAccount||(g.smsAccount={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),type:"twilio",waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="SMS.NEW_SMSACCOUNT",g.newSmsAccount=!0),n.params.id&&(g.smsAccount.SmsAccountId=n.params.id),g.addNewSmsAccount=function(){g.errors=[],d.smsAccount.save(g.smsAccount).$promise.then(function(e){g.smsAccounts.unshift(e.toJSON()),o.success({title:"SmsAccount properly created",msg:g.smsAccount.name?g.smsAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsAccount=function(){g.errors=[],d.smsAccount.update({id:g.smsAccount.id},g.smsAccount).$promise.then(function(e){var n=_.find(g.smsAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsAccount properly saved!",msg:g.smsAccount.name?g.smsAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsAccount will be deleted.").ariaLabel("Delete SmsAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.smsAccount.delete({id:g.smsAccount.id}).$promise.then(function(){_.remove(g.smsAccounts,{id:g.smsAccount.id}),o.success({title:"SmsAccount properly deleted!",msg:(g.smsAccount.name||"smsAccount")+" has been deleted!"}),v(g.smsAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.smsAccount&&(t=_.find(g.lists,{id:Number(g.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.smsAccount&&(a=_.find(g.lists,{id:Number(g.smsAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsAccounts","smsAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.smsAccountApps.rows.length){var t=r.smsAccountApps.rows[n]?r.smsAccountApps.rows[n]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccountApp:t,smsAccount:r.smsAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.smsAccountApps.rows[n]=e:r.smsAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.smsAccountApps.rows.length;t++,0){var a=r.smsAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.smsAccount.context,a.exten=r.smsAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.smsAccount.addApplications({id:r.smsAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.smsAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.smsAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.smsAccount={},r.smsAccountApps={count:0,rows:[]},r.selectedSmsAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"SmsQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"smsQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:701}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.smsAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getSmsAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.smsAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getSmsAccountApps=function(){r.promise=o.smsAccount.getApplications(r.query,t).$promise},r.editSmsAccountApp=n,r.editInterval=function(e,n){if(r.smsAccountApps.rows.length){var t=r.smsAccountApps.rows[n]?r.smsAccountApps.rows[n]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteSmsAccountApp=function(e){_.remove(r.smsAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedSmsAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedSmsAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedSmsAccountApps.forEach(function(e){_.remove(r.smsAccountApps.rows,{id:e.id})}),r.selectedSmsAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.sms").controller("SmsAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsAccount.getAgents({id:c.smsAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserSmsAccount?"penalty "+e.UserSmsAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.smsAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsAccount.removeAgents({id:c.smsAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsAccount.addAgents({id:c.smsAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","smsAccount","smsAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditSmsAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("sms")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.smsQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.smsQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"smsAccount",action:"getDispositions",field:"name",params:{id:m.smsAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.smsAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.smsAccountInteractions.rows.length;n+=1){var t=m.smsAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.smsInteraction.get(m.query,p).$promise}function v(e){d.smsInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.smsAccountInteractions.rows,{id:e.id}),m.smsAccountInteractions.count-=1,m.smsAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?(e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""),e.contactInfo=e.Contact.mobile):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.smsAccount={},m.smsAccountInteractions={count:0,rows:[]},m.selectedSmsAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.smsAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.SmsAccountId=m.smsAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.smsInteractionDownload=function(s,e,n){return d.smsInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="sms-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getSmsAccountInteractions=g,m.createOrEditSmsAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:m.smsAccount,interaction:n,interactions:m.smsAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spysmsInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"sms",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"sms.smsAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||SmsAccountId:=$eq["+m.smsAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedSmsAccountInteractions=function(){var e=angular.copy(m.selectedSmsAccountInteractions);return m.selectedSmsAccountInteractions=[],e},m.deleteSmsAccountInteraction=v,m.deleteSelectedSmsAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedSmsAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedSmsAccountInteractions.forEach(function(e){v(e)}),m.selectedSmsAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.smsAccountSmsCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.smsAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.smsAccountSmsCannedAnswers.rows,{id:e.id}),m.smsAccountSmsCannedAnswers.count-=1,m.smsAccountSmsCannedAnswers.rows.length||p(),l.success({title:"SmsCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.smsAccount={},m.smsAccountSmsCannedAnswers={count:0,rows:[]},m.selectedSmsAccountSmsCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.smsAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.SmsAccountId=m.smsAccount.id,m.query.id=m.smsAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the smsCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("smsCannedAnswer #")+e.id||"smsCannedAnswer")+"</b> will be deleted.").ariaLabel("delete smsCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getSmsAccountSmsCannedAnswers=p,m.createOrEditSmsAccountSmsCannedAnswer=function(e,n){o.show({controller:"CreateOrEditSmsCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:m.smsAccount,smsCannedAnswer:n,smsCannedAnswers:m.smsAccountSmsCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedSmsAccountSmsCannedAnswers=function(){var e=angular.copy(m.selectedSmsAccountSmsCannedAnswers);return m.selectedSmsAccountSmsCannedAnswers=[],e},m.deleteSmsAccountSmsCannedAnswer=g,m.deleteSelectedSmsAccountSmsCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected smsCannedAnswers?").htmlContent("<b>"+m.selectedSmsAccountSmsCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete smsCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedSmsAccountSmsCannedAnswers.forEach(function(e){g(e)}),m.selectedSmsAccountSmsCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountSmsCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSCANNEDANSWER",g.smsCannedAnswer=angular.copy(l),g.smsCannedAnswers=r,g.newSmsCannedAnswer=!1,g.smsCannedAnswer||(g.smsCannedAnswer={},g.title="SMS.NEW_SMSCANNEDANSWER",g.newSmsCannedAnswer=!0),n.params.id&&(g.smsCannedAnswer.SmsAccountId=n.params.id),g.addNewSmsCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.smsCannedAnswer).$promise.then(function(e){g.smsCannedAnswers.unshift(e.toJSON()),o.success({title:"SmsCannedAnswer properly created",msg:g.smsCannedAnswer.name?g.smsCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.smsCannedAnswer.id},g.smsCannedAnswer).$promise.then(function(e){var n=_.find(g.smsCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsCannedAnswer properly saved!",msg:g.smsCannedAnswer.name?g.smsCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsCannedAnswer will be deleted.").ariaLabel("Delete SmsCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.smsCannedAnswer.id}).$promise.then(function(){_.remove(g.smsCannedAnswers,{id:g.smsCannedAnswer.id}),o.success({title:"SmsCannedAnswer properly deleted!",msg:(g.smsCannedAnswer.name||"smsCannedAnswer")+" has been deleted!"}),v(g.smsCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsCannedAnswers","smsCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.smsAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.smsAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.SmsAccountId=m.smsAccount.id,m.query.id=m.smsAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.smsAccount.id,field:"SmsAccountId",route:"smsAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.sms").controller("SmsAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.smsAccount=c||e.params.smsAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:p.smsAccounts?p.smsAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoSmsAccounts=function(){e.go("app.sms.smsAccounts",{},{reload:"app.sms.smsAccounts"})},p.saveSmsAccount=function(){r.smsAccount.update({id:p.smsAccount.id},p.smsAccount).$promise.then(function(){l.success({title:"SmsAccount updated!",msg:p.smsAccount.name?p.smsAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.smsAccount&&(t=_.find(p.lists,{id:Number(p.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.smsAccount&&(a=_.find(p.lists,{id:Number(p.smsAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","smsAccount","userProfile","userProfileSection"],angular.module("app.sms").controller("SmsAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.smsAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="smsAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSmsAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Skebby",value:"'skebby'"},{option:"Connectel",value:"'connectel'"},{option:"ClickSend",value:"'clicksend'"},{option:"Plivo",value:"'plivo'"},{option:"Infobip",value:"'infobip'"},{option:"Clickatell",value:"'clickatell'"},{option:"Bandwidth",value:"'bandwidth'"},{option:"CSCTelecom",value:"'csc'"},{option:"Intelepeer",value:"'intelepeer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysmsMethod=_.keyBy([{option:"Basic",value:"'SI'"},{option:"Classic",value:"'TI'"},{option:"Classic+",value:"'GP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.sms.smsAccounts.edit",{id:e.id,smsAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.sms.smsAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:f.smsAccounts?f.smsAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("smsAccount")+"?").htmlContent("<b>"+(e.name||"smsAccount")+"</b> will be deleted.").ariaLabel("delete smsAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSmsAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.smsAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SmsAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSmsAccount=function(e,n){i.show({controller:"CreateOrEditSmsAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:n,smsAccounts:f.smsAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSmsAccount=y,f.exportSelectedSmsAccounts=function(){var e=angular.copy(f.selectedSmsAccounts);return f.selectedSmsAccounts=[],e},f.deleteSelectedSmsAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected smsAccounts?").htmlContent("<b>"+f.selectedSmsAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SmsAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSmsAccounts.forEach(function(e){y(e)}),f.selectedSmsAccounts=[]})},f.deselectSmsAccounts=function(){f.selectedSmsAccounts=[]},f.selectAllSmsAccounts=function(){f.selectedSmsAccounts=f.smsAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.smsAccount&&(t=_.find(f.lists,{id:Number(f.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.smsAccount&&(a=_.find(f.lists,{id:Number(f.smsAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.smsAccounts=e||{count:0,rows:[]}}function y(e){m.smsAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.smsAccounts.rows,{id:e.id}),f.smsAccounts.count-=1,f.smsAccounts.rows.length||f.getSmsAccounts(),p.success({title:_.startCase("SmsAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSmsAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.sms").controller("SmsAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="SMS.EDIT_SMSQUEUE",r.smsQueue=angular.copy(n),r.smsQueues=e,r.newSmsQueue=!1,r.smsQueue||(r.smsQueue={strategy:"beepall",timeout:10},r.title="SMS.NEW_SMSQUEUE",r.newSmsQueue=!0),r.addNewSmsQueue=function(){r.errors=[],i.smsQueue.save(r.smsQueue).$promise.then(function(e){r.smsQueues.unshift(e.toJSON()),a.success({title:"SmsQueue properly created",msg:r.smsQueue.name?r.smsQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveSmsQueue=function(){r.errors=[],i.smsQueue.update({id:r.smsQueue.id},r.smsQueue).$promise.then(function(e){var n=_.find(r.smsQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"SmsQueue properly saved!",msg:r.smsQueue.name?r.smsQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteSmsQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The smsQueue will be deleted.").ariaLabel("Delete SmsQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.smsQueue.delete({id:r.smsQueue.id}).$promise.then(function(){_.remove(r.smsQueues,{id:r.smsQueue.id}),a.success({title:"SmsQueue properly deleted!",msg:(r.smsQueue.name||"smsQueue")+" has been deleted!"}),l(r.smsQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","smsQueues","smsQueue","api","Auth","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsQueue.getAgents({id:c.smsQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserSmsQueue?"penalty "+e.UserSmsQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.smsQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.removeAgents({id:c.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.addAgents({id:c.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","smsQueue","smsQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsQueue.getTeams({id:l.smsQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.smsQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("SMS.ALL_TEAMS"),labelSelected:t.instant("SMS.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.removeTeams({id:l.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.addTeams({id:l.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","smsQueue","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.smsQueue=c||e.params.smsQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoSmsQueues=function(){e.go("app.sms.smsQueues",{},{reload:"app.sms.smsQueues"})},u.saveSmsQueue=function(){r.smsQueue.update({id:u.smsQueue.id},u.smsQueue).$promise.then(function(){l.success({title:"SmsQueue updated!",msg:u.smsQueue.name?u.smsQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","smsQueue","userProfileSection"],angular.module("app.sms").controller("SmsQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.smsQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="smsQueues",f.listOrder="",f.listOrderAsc=null,f.selectedSmsQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.sms.smsQueues.edit",{id:e.id,smsQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:f.smsQueues?f.smsQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:f.smsQueues?f.smsQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("smsQueue")+"?").htmlContent("<b>"+(e.name||"smsQueue")+"</b> will be deleted.").ariaLabel("delete smsQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:710}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.sms.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.sms.realtime.queues",{})}},f.success=E,f.getSmsQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.smsQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SmsQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSmsQueue=function(e,n){i.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:n,smsQueues:f.smsQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteSmsQueue=y,f.exportSelectedSmsQueues=function(){var e=angular.copy(f.selectedSmsQueues);return f.selectedSmsQueues=[],e},f.deleteSelectedSmsQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected smsQueues?").htmlContent("<b>"+f.selectedSmsQueues.length+" selected</b> will be deleted.").ariaLabel("delete SmsQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSmsQueues.forEach(function(e){y(e)}),f.selectedSmsQueues=[]})},f.deselectSmsQueues=function(){f.selectedSmsQueues=[]},f.selectAllSmsQueues=function(){f.selectedSmsQueues=f.smsQueues.rows};var b=!0,A=1;function E(e){f.smsQueues=e||{count:0,rows:[]}}function y(e){m.smsQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.smsQueues.rows,{id:e.id}),f.smsQueues.count-=1,f.smsQueues.rows.length||f.getSmsQueues(),p.success({title:_.startCase("SmsQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsmsQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSmsQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.sms").controller("SmsQueuesController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.agents=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,c.hasRole("admin")?g.promise=l.user.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="Agents",g.promise=l.userProfile.getResources(g.query,v).$promise)}function f(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(g.agents.rows,{id:e.id}),g.agents.count-=1,g.agents.rows.length||g.getAgents(),d.success({title:_.startCase("Agent")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=m,g.setting=u,g.currentUser=c.getCurrentUser(),g.agents=s||{count:0,rows:[]},g.userProfile=o,g.userProfileSection=r&&1==r.count?r.rows[0]:null,g.crudPermissions=c.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedAgents=[],g.query={fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay",role:"agent",userSetting:!0,sort:"-updatedAt",limit:10,page:1},g.showWebBarOptions=[{option:"Phonebar",value:0},{option:"External",value:1},{option:"WebRTC",value:2}],g.editstate=function(e){n.go("app.staff.agents.edit",{id:e.id,agent:e,crudPermissions:g.crudPermissions})},g.teamadddialog=function(e,n){a.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:g.agents?g.agents.rows:[],crudPermissions:g.crudPermissions}})},g.deleteconfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the "+_.startCase("agent")+"?").htmlContent("<b>"+(e.name||"agent")+"</b> will be deleted.").ariaLabel("delete agent").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){f(e)})},g.success=v,g.getAgents=h,g.createOrEditAgent=function(e,n){a.show({controller:"CreateOrEditAgentDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{agent:n,agents:g.agents.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}})},g.deleteAgent=f,g.exportSelectedAgents=function(){var e=angular.copy(g.selectedAgents);return g.selectedAgents=[],e},g.deleteSelectedAgents=function(e){var n=a.confirm().title("Are you sure want to delete the selected agents?").htmlContent("<b>"+g.selectedAgents.length+" selected</b> will be deleted.").ariaLabel("delete Agents").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){g.selectedAgents.forEach(function(e){f(e)}),g.selectedAgents=[]})},g.deselectAgents=function(){g.selectedAgents=[]},g.selectAllAgents=function(){g.selectedAgents=g.agents.rows};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),g.getAgents())}),p.on("user-setting:update",h),e.$on("$destroy",function(){p.removeListener("user-setting:update",h)})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","agents","userProfile","userProfileSection","api","toasty","Auth","license","setting","socket"],angular.module("app.staff").controller("AgentsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c){var m=this;function u(){return s.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.agent=e})}function p(e){t.hide(e)}m.currentUser=o.getCurrentUser(),m.errors=[],m.setting=l,m.license=r,m.crudPermissions=d,m.hasModulePermissions={},m.passwordPattern=m.setting&&m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.title="STAFF.EDIT_AGENT",m.agent=angular.copy(i),m.agents=n,m.newAgent=!1,m.agent||(m.agent={role:"agent",showWebBar:"0",autointernal:!0,wssPort:8089,type:"friend",context:"from-sip",phoneBarRemoteControl:!0,phoneBarRemoteControlPort:9888,allowmessenger:!0,downloadAttachments:!0,downloadOmnichannelInteractions:!0,downloadVoiceRecordings:!0},m.title="STAFF.NEW_AGENT",m.newAgent=!0),m.addNewAgent=function(){m.errors=[],s.user.save(m.agent).$promise.then(function(e){m.agents.unshift(e.toJSON()),a.success({title:"Agent properly created",msg:m.agent.name?m.agent.name+" has been created!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveAgent=function(){m.errors=[],s.user.update({id:m.agent.id},m.agent).$promise.then(function(e){var n=_.find(m.agents,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"Agent properly saved!",msg:m.agent.name?m.agent.name+" has been saved!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteAgent=function(e){m.errors=[];var n=t.confirm().title("Are you sure?").content("The agent will be deleted.").ariaLabel("Delete Agent").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){s.user.delete({id:m.agent.id}).$promise.then(function(){_.remove(m.agents,{id:m.agent.id}),a.success({title:"Agent properly deleted!",msg:(m.agent.name||"agent")+" has been deleted!"}),p(m.agent)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.closeDialog=p;var g="user-setting:update:user-"+m.agent.id;c.on(g,u),e.$on("$destroy",function(){c.removeListener(g,u)})}e.$inject=["$scope","$mdDialog","toasty","agents","agent","api","Auth","license","setting","crudPermissions","socket"],angular.module("app.staff").controller("CreateOrEditAgentDialogController",e)}(),function(){"use strict";function e(e,a){var i=this;i.agent={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.agent.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.agent.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.agent=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="api/users/"+i.agent.id+"/avatar",i.agent.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.staff").controller("Agentchange_avatarController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.agent=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.agent.id,newPassword:r.password};r.currentUser.id==r.agent.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"Agent password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.agent.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.agent.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.agentForm.password.$setValidity("oldPasswordMatch",!1):t.agentForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","agent","setting","Auth"],angular.module("app.staff").controller("AgentchangepasswordController",e)}(),function(){"use strict";function e(e,n,i,t,s){var o=this;o.agent={},o.navigation=t.getNavigation(),o.crudPermissions,o.init=function(e,n){o.agent=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1}},o.onChange=function(n,t){if((t||n).enabled){if(t)t.enabled=!0,o.agent.permissions.push(t.id);else for(var e=0;e<n.children.length;e++)n.children[e].enabled=!0,o.agent.permissions.push(n.children[e].id);n.enabled=!0,o.agent.permissions.push(n.id)}else if(t)t.enabled=!1,_.remove(o.agent.permissions,function(e){return t.id===e}),_.filter(n.children,{enabled:!1}).length===n.children.length&&(n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e}));else{n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e});for(var a=0;a<n.children.length;a++)n.children[a].enabled=!1,_.remove(o.agent.permissions,function(e){return n.children[a].id===e})}return i.user.update({id:o.agent.id,permissions:_.uniq(o.agent.permissions)}).$promise.then(function(){s.success({title:"agent updated!",msg:o.agent.name?o.agent.name+" has been updated!":""})}).catch(function(e){console.error(e)})}}e.$inject=["$document","$mdDialog","api","msNavigationAgentService","toasty"],angular.module("app.staff").controller("AgentPermissionsController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d[c.apiName].get({fields:"id,name,strategy,type",channel:c.channel,type:"voice"===c.channel?c.direction:void 0,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.user.getQueues({id:c.agent.id,fields:"id,name,strategy,type,penalty",nolimit:!0,type:"voice"===c.channel?c.direction:void 0,channel:c.channel}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return"voice"===c.channel&&(n.penalty=void 0!==n&&void 0!==e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"penalty 0"),n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.agent=n,c.crudPermissions=r,c.penalty=0,c.channel=t,c.direction=i,c.apiName=c.channel+"Queue",c.title=s.instant("STAFF.ADD_AGENT_TO_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"type",line3:"voice"===c.channel?"penalty":"",labelAll:s.instant("STAFF.ALL_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),labelSelected:s.instant("STAFF.SELECTED_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}},c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){var e;switch(c.channel){case"voice":switch(c.direction){case"inbound":e="VoiceQueues";break;case"outbound":e="QueueCampaigns"}break;case"chat":e="ChatQueues";break;case"mail":e="MailQueues";break;case"sms":e="SmsQueues";break;case"openchannel":e="OpenchannelQueues";break;case"fax":e="FaxQueues"}d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:e}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveQueues=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.user.removeQueues({id:c.agent.id,ids:_.map(t,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else if("voice"===c.channel){for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.user.addQueues({id:c.agent.id,ids:_.map(o,"id"),channel:c.channel,penalty:_.trim(s,"penalty ")}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}else d.user.addQueues({id:c.agent.id,ids:_.map(r,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){n(e)})});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Queues association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:QUEUES_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","agent","channel","direction","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("AgentQueueAddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.user.getTeams({id:l.agent.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.agent=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("STAFF.ALL_TEAMS"),labelSelected:t.instant("STAFF.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.user.removeTeams({id:l.agent.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.user.addTeams({id:l.agent.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","agent","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("AgentteamaddController",e)}(),function(){"use strict";function e(e,n,i,s,t,a,o,r,l,d,c){var m=this;m.currentUser=l.getCurrentUser(),m.license=t,m.setting=a,m.passwordPattern=m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.location=n.protocol()+"://"+n.host(),m.agent=d||e.params.agent||{},m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=l.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.hasModulePermissions={},m.selectedTab=e.params.tab||0,m.queueaddchannel=function(e,n,t,a){i.show({controller:"AgentQueueAddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:m.agents?m.agents.rows:[],channel:n,direction:a||"inbound",crudPermissions:m.crudPermissions}})},m.teamadddialog=function(e,n){i.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:m.agents?m.agents.rows:[],crudPermissions:m.crudPermissions}})},m.changepassworddialog=function(e,n){i.show({controller:"AgentchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,setting:a,agents:m.agents?m.agents.rows:[],crudPermissions:m.crudPermissions}})},m.onEnableScreenRecordingByAgentSelection=function(){["phoneBarEnableAutomaticScreenRecording"].forEach(function(e){m.agent.phoneBarEnableScreenRecordingByAgent&&(m.agent[e]=!m.agent.phoneBarEnableScreenRecordingByAgent)})},m.onEnableAutomaticScreenRecordingSelection=function(){["phoneBarEnableScreenRecordingByAgent"].forEach(function(e){m.agent.phoneBarEnableAutomaticScreenRecording&&(m.agent[e]=!m.agent.phoneBarEnableAutomaticScreenRecording)})},m.alert=r.info,m.gotoAgents=function(){e.go("app.staff.agents",{},{reload:"app.staff.agents"})},m.saveAgent=function(){m.agent=_.omit(m.agent,"userpic"),o.user.update({id:m.agent.id},m.agent).$promise.then(function(){r.success({title:"Agent updated!",msg:m.agent.name?m.agent.name+" has been updated!":""})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.refreshAgent=function(){return o.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.agent=e})},l.hasRole("admin")?o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.contexts,{id:e.resourceId})}),t=null;if(m.agent&&(t=_.find(m.contexts,{name:m.agent.context})),t&&!_.some(n,["id",t.id])){var a=_.find(m.contexts,{id:t.id});a.canSelect=!1,n.push(a)}m.contexts=n}):o.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){m.contexts=e.rows||[]})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","license","setting","api","toasty","Auth","agent","userProfileSection"],angular.module("app.staff").controller("AgentController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_TEAM",g.team=angular.copy(l),g.teams=r,g.newTeam=!1,g.team||(g.team={},g.title="STAFF.NEW_TEAM",g.newTeam=!0),g.addNewTeam=function(){g.errors=[],d.team.save(g.team).$promise.then(function(e){g.teams.unshift(e.toJSON()),o.success({title:"Team properly created",msg:g.team.name?g.team.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTeam=function(){g.errors=[],d.team.update({id:g.team.id},g.team).$promise.then(function(e){var n=_.find(g.teams,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Team properly saved!",msg:g.team.name?g.team.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTeam=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The team will be deleted.").ariaLabel("Delete Team").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.team.delete({id:g.team.id}).$promise.then(function(){_.remove(g.teams,{id:g.team.id}),o.success({title:"Team properly deleted!",msg:(g.team.name||"team")+" has been deleted!"}),v(g.team)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","teams","team","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditTeamDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.team.getAgents({id:c.team.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserTeam?"penalty "+e.UserTeam.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.team=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.team.removeAgents({id:c.team.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.team.addAgents({id:c.team.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("STAFF.ALL_AGENTS"),labelSelected:r.instant("STAFF.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","team","teams","realtime","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("TeamagentaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.teams=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="teams",f.listOrder="",f.listOrderAsc=null,f.selectedTeams=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{team:e,teams:f.teams.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"TeamagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{team:e,teams:f.teams?f.teams.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("team")+"?").htmlContent("<b>"+(e.name||"team")+"</b> will be deleted.").ariaLabel("delete team").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTeams=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.team.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Teams",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTeam=function(e,n){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{team:n,teams:f.teams.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTeam=y,f.exportSelectedTeams=function(){var e=angular.copy(f.selectedTeams);return f.selectedTeams=[],e},f.deleteSelectedTeams=function(e){var n=i.confirm().title("Are you sure want to delete the selected teams?").htmlContent("<b>"+f.selectedTeams.length+" selected</b> will be deleted.").ariaLabel("delete Teams").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTeams.forEach(function(e){y(e)}),f.selectedTeams=[]})},f.deselectTeams=function(){f.selectedTeams=[]},f.selectAllTeams=function(){f.selectedTeams=f.teams.rows};var b=!0,A=1;function E(e){f.teams=e||{count:0,rows:[]}}function y(e){m.team.delete({id:e.id}).$promise.then(function(){_.remove(f.teams.rows,{id:e.id}),f.teams.count-=1,f.teams.rows.length||f.getTeams(),p.success({title:_.startCase("Team")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEteam"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEteam",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTeams())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","teams","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("TeamsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_TELEPHONE",g.telephone=angular.copy(l),g.telephones=r,g.newTelephone=!1,g.telephone||(g.telephone={role:"telephone",autointernal:!0,context:"from-sip"},g.title="STAFF.NEW_TELEPHONE",g.newTelephone=!0),g.addNewTelephone=function(){g.errors=[],d.user.save(g.telephone).$promise.then(function(e){g.telephones.unshift(e.toJSON()),o.success({title:"Telephone properly created",msg:g.telephone.name?g.telephone.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTelephone=function(){g.errors=[],d.user.update({id:g.telephone.id},g.telephone).$promise.then(function(e){var n=_.find(g.telephones,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Telephone properly saved!",msg:g.telephone.name?g.telephone.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTelephone=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The telephone will be deleted.").ariaLabel("Delete Telephone").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.user.delete({id:g.telephone.id}).$promise.then(function(){_.remove(g.telephones,{id:g.telephone.id}),o.success({title:"Telephone properly deleted!",msg:(g.telephone.name||"telephone")+" has been deleted!"}),v(g.telephone)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","telephones","telephone","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditTelephoneDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.telephone=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.telephone.id,newPassword:r.password};r.currentUser.id==r.telephone.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"Telephone password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.telephone.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.telephone.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.telephoneForm.password.$setValidity("oldPasswordMatch",!1):t.telephoneForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","telephone","setting","Auth"],angular.module("app.staff").controller("TelephonechangepasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.telephone=c||e.params.telephone||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.changepassworddialog=function(e,n){t.show({controller:"TelephonechangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{telephone:e,setting:o,telephones:u.telephones?u.telephones.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTelephones=function(){e.go("app.staff.telephones",{},{reload:"app.staff.telephones"})},u.saveTelephone=function(){r.user.update({id:u.telephone.id},u.telephone).$promise.then(function(){l.success({title:"Telephone updated!",msg:u.telephone.name?u.telephone.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.telephone&&(t=_.find(u.contexts,{name:u.telephone.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","telephone","userProfileSection"],angular.module("app.staff").controller("TelephoneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.telephones=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="telephones",f.listOrder="",f.listOrderAsc=null,f.selectedTelephones=[],f.query={fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,page:1},f.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.staff.telephones.edit",{id:e.id,telephone:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("telephone")+"?").htmlContent("<b>"+(e.name||"telephone")+"</b> will be deleted.").ariaLabel("delete telephone").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTelephones=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.user.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Telephones",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTelephone=function(e,n){i.show({controller:"CreateOrEditTelephoneDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{telephone:n,telephones:f.telephones.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTelephone=y,f.exportSelectedTelephones=function(){var e=angular.copy(f.selectedTelephones);return f.selectedTelephones=[],e},f.deleteSelectedTelephones=function(e){var n=i.confirm().title("Are you sure want to delete the selected telephones?").htmlContent("<b>"+f.selectedTelephones.length+" selected</b> will be deleted.").ariaLabel("delete Telephones").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTelephones.forEach(function(e){y(e)}),f.selectedTelephones=[]})},f.deselectTelephones=function(){f.selectedTelephones=[]},f.selectAllTelephones=function(){f.selectedTelephones=f.telephones.rows};var b=!0,A=1;function E(e){f.telephones=e||{count:0,rows:[]}}function y(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(f.telephones.rows,{id:e.id}),f.telephones.count-=1,f.telephones.rows.length||f.getTelephones(),p.success({title:_.startCase("Telephone")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTelephones())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","telephones","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("TelephonesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_USERPROFILE",g.userProfile=angular.copy(l),g.userProfiles=r,g.newUserProfile=!1,g.userProfile||(g.userProfile={crudPermissions:["r"],downloadAttachments:!0,downloadCallySquareRecordings:!0,downloadContactManagerLists:!0,downloadJscriptySessions:!0,downloadOmnichannelInteractions:!0,downloadScreenRecordings:!0,downloadVoiceRecordings:!0},g.title="STAFF.NEW_USERPROFILE",g.newUserProfile=!0),g.addNewUserProfile=function(){g.errors=[],d.userProfile.save(g.userProfile).$promise.then(function(e){var n,t;t=[],(n=e).crudPermissions.forEach(function(e){var n;switch(e){case"r":n="READ_PERMISSION";break;case"e":n="EDIT_PERMISSION";break;case"d":n="DELETE_PERMISSION"}t.push(s.instant("STAFF."+n))}),n.selectedcrudPermissions=t.join(", "),g.userProfiles.unshift(e.toJSON()),o.success({title:"UserProfile properly created",msg:g.userProfile.name?g.userProfile.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveUserProfile=function(){g.errors=[],d.userProfile.update({id:g.userProfile.id},g.userProfile).$promise.then(function(e){var n=_.find(g.userProfiles,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"UserProfile properly saved!",msg:g.userProfile.name?g.userProfile.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteUserProfile=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The userProfile will be deleted.").ariaLabel("Delete UserProfile").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.userProfile.delete({id:g.userProfile.id}).$promise.then(function(){_.remove(g.userProfiles,{id:g.userProfile.id}),o.success({title:"UserProfile properly deleted!",msg:(g.userProfile.name||"userProfile")+" has been deleted!"}),v(g.userProfile)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","userProfiles","userProfile","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditUserProfileDialogController",e)}(),function(){"use strict";function e(n,a,i,e,t,s,o){var r=this;function l(e){n.hide(e)}r.newUserProfile=!0,r.userProfile=angular.copy(t),r.userProfiles=s,r.title=o.instant("STAFF.CLONE_USERPROFILE"),t&&t.name&&(r.title+=": "+t.name),r.cloneUserProfile=function(){return e.userProfile.clone({id:t.id},r.userProfile).$promise.then(function(e){var n,t;t=[],(n=e).crudPermissions.forEach(function(e){var n;switch(e){case"r":n="READ_PERMISSION";break;case"e":n="EDIT_PERMISSION";break;case"d":n="DELETE_PERMISSION"}t.push(o.instant("STAFF."+n))}),n.selectedcrudPermissions=t.join(", "),r.userProfiles.unshift(e.toJSON()),i.success({title:"UserProfile properly cloned",msg:r.userProfile.name?r.userProfile.name+" has been cloned!":""}),a.go("app.staff.userProfiles.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.clone"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","userProfile","userProfiles","$translate"],angular.module("app.staff").controller("UserProfilecloneController",e)}(),function(){"use strict";function e(t,o,r,l,d,e,n,c){var m=this;function u(e,n){switch(e.allResourcesEnabled="full"===n,n){case"full":return _.find(m.statusList,["tag","full"]);case"partial":return _.find(m.statusList,["tag","partial"]);case"disabled":return _.find(m.statusList,["tag","disabled"]);case"unlicensed":return _.find(m.statusList,["tag","unlicensed"]);case"unknown":default:return _.find(m.statusList,["tag","unknown"])}}function p(e){return l(function(n,t){var o,a;void 0!==e.channel&&_.includes(e.route,"Queue")?(a=e,l(function(n,t){var e=void 0!==a.channel&&"bull"===a.channel?"outbound":"inbound";return d[a.route].get({fields:"id,name,strategy,type",channel:"bull"===a.channel?"voice":a.channel,type:e,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})).then(function(e){n(e)}).catch(function(e){t(e)}):(o=e,l(function(a,n){switch(o.route){case"voiceExtension":var e;switch(o.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}break;case"interval":var t=!0;break;case"disposition":var i=!0;break;case"user":var s;switch(o.title){case"Agents":s="agent";break;case"Telephones":s="telephone";break;case"Users":s="user"}}if("Reports"===o.title){if(!o.reportType)return d.analyticDefaultReport.get({nolimit:!0}).$promise.then(function(t){d.analyticCustomReport.get({nolimit:!0}).$promise.then(function(e){var n=_.union(t.rows,e.rows);a({count:n.length,rows:n.rows})})}).catch(function(e){n(e)});switch(o.reportType){case"default":o.route="analyticDefaultReport";break;case"custom":o.route="analyticCustomReport"}}return d[o.route].get({role:s||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:t?"null":void 0,MailAccountId:i?"null":void 0,FaxAccountId:i?"null":void 0,SmsAccountId:i?"null":void 0,OpenchannelAccountId:i?"null":void 0,ChatWebsiteId:i?"null":void 0,WhatsappAccountId:i?"null":void 0,ListId:i?"null":void 0,nolimit:!0}).$promise.then(function(e){a(e)}).catch(function(e){n(e)})})).then(function(e){n(e)}).catch(function(e){t(e)})})}function g(e,n,t){var a=e&&0<e.length?e[0]:null;if(!a)return t;var i,s,o=_.find(n,["sectionId",a.id]);return o?(n=_.remove(n,["sectionId",a.id]),(i=a,s=o.id,l(function(n,t){d.userProfileResource.get({sectionId:s}).$promise.then(function(n){return p(i).then(function(e){return _.differenceBy(n.rows,e.rows,"id")})}).then(function(e){_.isEmpty(e)?n():t()}).catch(function(e){t(e)})})).then(function(){return t="full",g(e.shift(),n,t)}).catch(function(e){return l.reject(e)})):void 0}function a(a){var t="Marketplace"===a.title?"AppZone":a.title;m.license?void 0===a.permissions||a.permissions.association?void 0===a.license||m.license[a.license]?d.userProfileSection.get({userProfileId:m.userProfile.id,category:t}).$promise.then(function(e){var n=e&&e.rows&&0<e.rows.length?e.rows:[];if("Dashboards"===a.title)return _.isEmpty(n)?"disabled":n[0].autoAssociation?"full":d.userProfileResource.get({sectionId:n[0].id,resourceId:101}).$promise.then(function(e){return(e&&e.rows?e.rows[0]:null)?"full":"partial"});var t=_.filter(a.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e});return n.length!==t.length?0===n.length?"disabled":"partial":_.every(n,["autoAssociation",!0])?"full":g(_.filter(t,function(e){return void 0===e.permissions||e.permissions.association?e:void 0}),n,"partial")}).then(function(e){a.status=u(a,e)}).catch(function(e){var n=e?"unknown":"partial";a.status=u(a,n),e&&c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GETRESOURCES("+t.toUpperCase()+")",msg:e.status?JSON.stringify(e.data):e.toString()})}):a.status=u(a,"unlicensed"):d.userProfileSection.get({userProfileId:m.userProfile.id,sectionId:a.id}).$promise.then(function(e){var n=(e&&1===e.rows.length?e.rows[0]:null)?"full":"disabled";a.status=u(a,n)}):a.status=u(a,"unknown")}m.userProfile={},m.license={},m.navigation=e.getNavigation(),m.modules=m.navigation[0].children,m.statusList=[{id:0,name:"Fully Enabled",color:"green-A700-bg",info:"All resources enabled",tag:"full"},{id:1,name:"Partially Enabled",color:"orange-A700-bg",info:"Some resources enabled",tag:"partial"},{id:2,name:"Disabled",color:"grey-A400-bg",info:"No resources enabled",tag:"disabled"},{id:3,name:"Unlicensed",color:"red-A700-bg",info:"Module not included in the license",tag:"unlicensed"},{id:4,name:"Unknown",color:"grey-A700-bg",info:"Unknown status",tag:"unknown"}],m.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],m.init=function(e,n){m.userProfile=e,m.license=n},m.onChangeEnableAllResources=function(n){var e=void 0!==n.permissions&&!n.permissions.association,a="Marketplace"===n.title?"AppZone":n.title;if("Fully Enabled"!==n.status.name){var i=[];if(e)return i.push({category:a,sectionId:n.id,name:a,enabled:!0,crudPermissions:"red"}),d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){n.status=u(n,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE_NO_RESOURCES",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})});var t=o.confirm({skipHide:!0}).title("Warning").textContent(r.instant("STAFF.PERMISSIONS_WARNING_ENABLE_ALL",{sectionName:r.instant(n.translate)})).ariaLabel("Warning").ok(r.instant("STAFF.CONFIRM")).cancel(r.instant("STAFF.CANCEL"));o.show(t).then(function(){switch(a){case"Dashboards":_.map(m.dashboardSections,function(e){i.push({category:a,sectionId:e.id,name:e.title,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})});break;default:_.map(n.children,function(e){var n=!(void 0===e.permissions||!e.permissions.hidden);if(!n){var t=e.title;switch(a){case"CallySquare":t="Projects"===t?"SquareProjects":t}i.push({category:a,sectionId:e.id,name:t,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})}})}return d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){n.status=u(n,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})})}).catch(function(e){e?c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()}):n.status=u(n,n.status.tag)})}else if("Fully Enabled"===n.status.name){n.status=u(n,"disabled");var s=[];switch(a){case"Settings":case"Help":s=[n.id];break;case"Dashboards":s=_.map(m.dashboardSections,function(e){return e.id});break;default:s=_.map(n.children,function(e){return e.id})}return d.userProfile.removeSections({id:m.userProfile.id,ids:s}).$promise.then(function(){c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.REMOVESECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})}},m.manageResources=function(e,n){o.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!1,locals:{userProfile:m.userProfile,userProfiles:[],section:e}}).then(function(){a(e)})},m.checkSectionResources=a}e.$inject=["$document","$mdDialog","$translate","$q","api","msNavigationService","Auth","toasty"],angular.module("app.staff").controller("UserProfilePermissionsController",e)}(),function(){"use strict";function e(n,t,i,o,r,e,a,l,s,d){var c=this;function m(){var a=void 0!==c.selectedSection.pending&&c.selectedSection.pending;return i(function(t,n){r.userProfileSection.get({userProfileId:c.userProfile.id,sectionId:c.selectedSection.id}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;a||(c.selectedSection.enabled=!!n&&!!n.enabled,c.selectedSection.autoAssociation=!!n&&!!n.autoAssociation,c.selectedSection.crudPermissions=v(n?n.crudPermissions:c.userProfile.crudPermissions)),t(n)}).catch(function(e){n(e)})})}function u(){return i(function(n,t){c.loadedSection?r.userProfileResource.get({sectionId:c.loadedSection.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)}):n(null)})}function p(){return i(function(n,t){void 0!==c.selectedSection.channel&&_.includes(c.selectedSection.route,"Queue")?i(function(n,t){var e=void 0!==c.selectedSection.channel&&"bull"===c.selectedSection.channel?"outbound":"inbound";return r[c.selectedSection.route].get({fields:"id,name,strategy,type",channel:"bull"===c.selectedSection.channel?"voice":c.selectedSection.channel,type:e,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){n(e)}).catch(function(e){t(e)}):i(function(n,t){var e,a;if("voiceExtension"===c.selectedSection.route)switch(c.selectedSection.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}if("user"===c.selectedSection.route)switch(c.selectedSection.title){case"Agents":a="agent";break;case"Telephones":a="telephone";break;case"Users":a="user"}if("interval"===c.selectedSection.route)var i=!0;if("disposition"===c.selectedSection.route)var s=!0;if("Reports"===c.selectedSection.title&&(c.selectedSection.route="default"===c.selectedSection.reportType?"analyticDefaultReport":"analyticCustomReport"),"Dashboards"!==c.selectedSection.title)return r[c.selectedSection.route].get({role:a||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:i?"null":void 0,MailAccountId:s?"null":void 0,FaxAccountId:s?"null":void 0,SmsAccountId:s?"null":void 0,OpenchannelAccountId:s?"null":void 0,ChatWebsiteId:s?"null":void 0,WhatsappAccountId:s?"null":void 0,ListId:s?"null":void 0,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)});n({count:1,rows:[{id:101,name:l.instant("DASHBOARDS.GENERAL")}]})}).then(function(e){n(e)}).catch(function(e){t(e)})})}function g(){var i=void 0!==c.selectedSection.pending&&c.selectedSection.pending,s=[];return u().then(function(e){var n;return s=e&&e.rows?e.rows:[],"Reports"===c.selectedSection.title&&(c.associatedReports=c.associatedReports?c.associatedReports:s,n=c.associatedReports,s=_.filter(n,{type:"default"===c.selectedSection.reportType?"DefaultReports":"CustomReports"})),void 0===c.selectedSection.permissions||c.selectedSection.permissions.association?p():{rows:[]}}).then(function(e){c.items=e.rows?_.map(e.rows,function(e){var n,t;return"Reports"===c.selectedSection.title&&(e.fullPath=(n=e.parent,t=c.treeStructure[0].text,t=function e(n,t,a){if(!a||_.isEmpty(a.children))return n;var a=_.find(a.children,function(e){return _.includes(t,e.id)?e:void 0});return n+=a?"/"+a.text:"",e(n,t,a)}(t,n,c.treeStructure[0])).replace(" ","_")),e.isValid=!0,e}):[],i||(c.selectedSection.selectedItems=_.map(s,function(e){return _.find(c.items,{id:e.resourceId})}));var n,t=_.differenceBy(c.selectedSection.selectedItems,c.items,"id");switch(_.isEmpty(t)||(c.selectedSection.selectedItems=_.pullAllBy(c.selectedSection.selectedItems,t,"id")),c.selectedSection.title){case"Contexts":c.selectedSection.selectedItems=_.filter(c.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(s,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"MusicOnHolds":c.selectedSection.selectedItems=_.filter(c.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(s,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"Reports":var a=(n=c.allReportsSelected,_.filter(n,function(e){return _.startsWith(e.parent,"default"===c.selectedSection.reportType?"motion":"custom")}));c.selectedSection.selectedItems=b(c.selectedSection.selectedItems),c.selectedSection.selectedItems=_.unionBy(c.selectedSection.selectedItems,a,"id")}c.dualMultiselectOptions.selectedItems=c.selectedSection.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.items,c.dualMultiselectOptions.selectedItems,"id")}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+c.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})}function v(e){return e&&(c.selectedSection.allowEdit=!!_.includes(e,"e"),c.selectedSection.allowDelete=!!_.includes(e,"d")),function(){var e=["r"];if(c.selectedSection.allowEdit)e.push("e");else{var n=_.indexOf(e,["e"]);0<n&&c.selectedSection.crudPermissions.replace("e","")}if(c.selectedSection.allowDelete)e.push("d");else{var n=_.indexOf(e,["d"]);0<n&&c.selectedSection.crudPermissions.replace("d","")}return e}()}function h(e){var n=_.findIndex(c.subsections,function(e){return e.id==c.selectedSection.id});c.subsections[n].pending=e,f()}function f(){return c.pendingChanges=_.some(c.subsections,["pending",!0])}function b(e){return _.remove(e,function(e){return _.startsWith(e.parent,"default"===c.selectedSection.reportType?"motion":"custom")})}function A(){_.isEmpty(c.selectedSection.selectedItems)?c.allReportsSelected=_.remove(c.allReportsSelected,function(e){return e.type===("default"===c.selectedSection.reportType?"CustomReports":"DefaultReports")}):c.selectedSection.selectedItems.forEach(function(e){_.some(c.allReportsSelected,{id:e.id,parent:e.parent})||c.allReportsSelected.push(e)})}c.userProfile=e,c.penalty=0,c.section=angular.copy(d),c.title=l.instant("STAFF.PERMISSIONS_SECTION_TITLE",{sectionName:l.instant(c.section.translate)}),c.items=[],c.selectedItems=[],c.subsections=_.filter(c.section.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e}),c.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],c.dashboardItems=[],"Dashboards"===c.section.title&&(c.dashboardItems=c.subsections,c.subsections=c.dashboardSections),c.selectedSection=null,c.loadedSection=null,c.allReportsSelected=[],c.closeDialog=function(e){if(c.pendingChanges){var n=t.confirm({skipHide:!0}).title("Warning").textContent(l.instant("STAFF.PERMISSIONS_WARNING_CLOSE")).ariaLabel("Warning").targetEvent(e).ok(l.instant("STAFF.CLOSE")).cancel(l.instant("STAFF.CANCEL"));t.show(n).then(function(){t.hide()})}else t.hide()},c.onChangeSection=function(){return m().then(function(e){if(c.loadedSection=e,"Reports"===c.selectedSection.title)return i(function(n,t){r.analyticTreeReport.get({}).$promise.then(function(e){c.treeReports=e.rows||[],n(c.treeReports)}).catch(function(e){t(e)})}).then(function(){if(!c.selectedSection.reportType)return u().then(function(e){c.allReportsSelected=e?_.map(e.rows,function(e){return{id:e.resourceId,name:e.name,type:e.type}}):[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREE_REPORT_STRUCTURE",msg:e.data?JSON.stringify(e.data):e.toString()})});g()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+c.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})},c.onChangeVisibility=function(){c.selectedSection.enabled=!c.selectedSection.enabled,h(!0)},c.onChangeAutoAssociation=function(){if(!c.selectedSection.autoAssociation){for(var e=[],n=0;n<c.dualMultiselectOptions.items.length;n++)e.push(c.dualMultiselectOptions.items[n]),c.dualMultiselectOptions.selectedItems.push(c.dualMultiselectOptions.items[n]);c.dualMultiselectOptions.items=[],c.dualMultiselectOptions.transferCallback(e,!1)}h(!0)},c.onChangeReportType=function(){c.treeStructure="default"===c.selectedSection.reportType?c.treeReports[0]?angular.fromJson(c.treeReports[0].tree):[]:c.treeReports[1]?angular.fromJson(c.treeReports[1].tree):[],c.selectedSection.selectedItems&&(c.allReportsSelected=b(c.allReportsSelected),A());g()},c.setPermission=function(e){"edit"===e?c.selectedSection.allowEdit=!c.selectedSection.allowEdit:"delete"===e&&(c.selectedSection.allowDelete=!c.selectedSection.allowDelete);c.selectedSection.crudPermissions=v(),h(!0)},c.saveSection=function(){var a="Marketplace"===c.section.title?"AppZone":c.section.title,e=_(c.subsections).filter({pending:!0}).map(function(e){var n="CallySquare"===a&&"Projects"===e.title?"SquareProjects":e.title,t="Reports"===n?c.allReportsSelected:e.selectedItems;return"Integrations"===a&&(e.autoAssociation=!0),{category:a,sectionId:e.id,name:n,enabled:e.enabled,autoAssociation:e.autoAssociation,crudPermissions:_.map(e.crudPermissions).join(""),Resources:_.map(t,function(e){return{name:e.name,resourceId:e.id,type:function(e,n){if("Reports"!==e)return e;{if(n.parent){var t=_.startsWith(n.parent,"motion")?"Default":"Custom";return t+e}return n.type}}(n,e)}})}}).value();return r.userProfile.addSections({id:c.userProfile.id},e).$promise.then(function(){c.subsections.forEach(function(e){e.pending=void 0}),c.associatedReports=null,f(),"Reports"!==c.selectedSection.title||c.selectedSection.reportType||n.userProfileForm.$setPristine(),o.success({title:l.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_TITLE",{sectionName:l.instant(a.translate)}),msg:l.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_MESSAGE")})}).then(function(){return m().then(function(e){c.loadedSection=e})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",line4:"fullPath",labelAll:l.instant("STAFF.PERMISSIONS_ALL_RESOURCES"),labelSelected:l.instant("STAFF.PERMISSIONS_SELECTED_RESOURCES"),transferCallback:function(e,n){h(!0),n?(c.selectedSection.selectedItems=_.pullAllBy(c.selectedSection.selectedItems,e,"id"),c.selectedSection.autoAssociation=!1):c.selectedSection.selectedItems=_.unionBy(c.selectedSection.selectedItems,e,"id"),"Reports"===c.selectedSection.title&&A()}}}e.$inject=["$scope","$mdDialog","$q","toasty","api","userProfile","userProfiles","$translate","Auth","section"],angular.module("app.staff").controller("UserProfilepermissionsmanageController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.userProfile=c||e.params.userProfile||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.permissionsmanagedialog=function(e,n){t.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.clonedialog=function(e,n){t.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoUserProfiles=function(){e.go("app.staff.userProfiles",{},{reload:"app.staff.userProfiles"})},u.saveUserProfile=function(){r.userProfile.update({id:u.userProfile.id},u.userProfile).$promise.then(function(){l.success({title:"UserProfile updated!",msg:u.userProfile.name?u.userProfile.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuserProfile",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","userProfile","userProfileSection"],angular.module("app.staff").controller("UserProfileController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.userProfiles=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="userProfiles",f.listOrder="",f.listOrderAsc=null,f.selectedUserProfiles=[],f.query={fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",sort:"-updatedAt",limit:10,page:1},f.arraycrudPermissions=_.keyBy([{option:"Read_permission",value:"'r'",disabled:!0},{option:"Edit_permission",value:"'e'"},{option:"Delete_permission",value:"'d'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.userProfiles&&0<f.userProfiles.count&&f.userProfiles.rows.forEach(function(e){var n=[];e.crudPermissions.forEach(function(e){n.push(f.arraycrudPermissions[e].option)});var t=[];n.forEach(function(e){t.push(r.instant("STAFF."+e.toUpperCase()))}),e.selectedcrudPermissions=t.join(", ")}),f.editstate=function(e,n){t.go("app.staff.userProfiles.edit",{id:e.id,userProfile:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:f.userProfiles?f.userProfiles.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("userProfile")+"?").htmlContent("<b>"+(e.name||"userProfile")+"</b> will be deleted.").ariaLabel("delete userProfile").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getUserProfiles=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.userProfile.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="UserProfiles",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditUserProfile=function(e,n){i.show({controller:"CreateOrEditUserProfileDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{userProfile:n,userProfiles:f.userProfiles.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteUserProfile=y,f.exportSelectedUserProfiles=function(){var e=angular.copy(f.selectedUserProfiles);return f.selectedUserProfiles=[],e},f.deleteSelectedUserProfiles=function(e){var n=i.confirm().title("Are you sure want to delete the selected userProfiles?").htmlContent("<b>"+f.selectedUserProfiles.length+" selected</b> will be deleted.").ariaLabel("delete UserProfiles").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedUserProfiles.forEach(function(e){y(e)}),f.selectedUserProfiles=[]})},f.deselectUserProfiles=function(){f.selectedUserProfiles=[]},f.selectAllUserProfiles=function(){f.selectedUserProfiles=f.userProfiles.rows};var b=!0,A=1;function E(e){f.userProfiles=e||{count:0,rows:[]}}function y(e){m.userProfile.delete({id:e.id}).$promise.then(function(){_.remove(f.userProfiles.rows,{id:e.id}),f.userProfiles.count-=1,f.userProfiles.rows.length||f.getUserProfiles(),p.success({title:_.startCase("UserProfile")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuserProfile"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuserProfile",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getUserProfiles())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","userProfiles","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("UserProfilesController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c){var m=this;function u(){return s.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.user=e})}function p(e){t.hide(e)}m.currentUser=o.getCurrentUser(),m.errors=[],m.setting=l,m.license=r,m.crudPermissions=d,m.hasModulePermissions={},m.passwordPattern=m.setting&&m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.title="STAFF.EDIT_USER",m.user=angular.copy(i),m.users=n,m.newUser=!1,m.user||(m.user={role:"user",autointernal:!0,context:"from-sip"},m.title="STAFF.NEW_USER",m.newUser=!0),m.addNewUser=function(){m.errors=[],s.user.save(m.user).$promise.then(function(e){m.users.unshift(e.toJSON()),a.success({title:"User properly created",msg:m.user.name?m.user.name+" has been created!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveUser=function(){m.errors=[],s.user.update({id:m.user.id},m.user).$promise.then(function(e){var n=_.find(m.users,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"User properly saved!",msg:m.user.name?m.user.name+" has been saved!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteUser=function(e){if(o.getCurrentUser().id===m.user.id)return a.error({title:"User not deleted!",msg:"You can't remove yourself"});m.errors=[];var n=t.confirm().title("Are you sure?").content("The user will be deleted.").ariaLabel("Delete User").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){s.user.delete({id:m.user.id}).$promise.then(function(){_.remove(m.users,{id:m.user.id}),a.success({title:"User properly deleted!",msg:(m.user.name||"user")+" has been deleted!"}),p(m.user)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.closeDialog=p,s.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.userProfiles=e.rows||[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var g="user-setting:update:user-"+m.user.id;c.on(g,u),e.$on("$destroy",function(){c.removeListener(g,u)})}e.$inject=["$scope","$mdDialog","toasty","users","user","api","Auth","license","setting","crudPermissions","socket"],angular.module("app.staff").controller("CreateOrEditUserDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;function o(){e.hide()}s.currentUser=i.getCurrentUser(),s.errors=[],s.user=a,s.generateApiKey=function(){s.errors=[],t.user.createApiKey({id:s.user.id}).$promise.then(function(e){s.user.apiKey=e.api_key||"N/A",n.success({title:"User API key updated!"}),o()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.createApiKey",msg:e.data?JSON.stringify(e.data.message):e.toString()}),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.createApiKey"}]})},s.removeApiKey=function(){s.errors=[],t.user.removeApiKey({id:s.user.id}).$promise.then(function(){s.user.apiKey="N/A",n.success({title:"User API key removed!"}),o()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.removeApiKey",msg:e.data?JSON.stringify(e.data.message):e.toString()}),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.removeApiKey"}]})},s.closeDialog=o}e.$inject=["$mdDialog","toasty","api","user","Auth"],angular.module("app.staff").controller("UserapikeymanagerController",e)}(),function(){"use strict";function e(e,a){var i=this;i.user={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.user.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.user.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.user=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="api/users/"+i.user.id+"/avatar",i.user.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.staff").controller("Userchange_avatarController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.user=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.user.id,newPassword:r.password};r.currentUser.id==r.user.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"User password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.user.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.userForm.password.$setValidity("oldPasswordMatch",!1):t.userForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","user","setting","Auth"],angular.module("app.staff").controller("UserchangepasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;m.currentUser=l.getCurrentUser(),m.license=i,m.setting=s,m.passwordPattern=m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.location=n.protocol()+"://"+n.host(),m.user=d||e.params.user||{},m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=l.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.hasModulePermissions={},m.selectedTab=e.params.tab||0,m.apikeymanagerdialog=function(e,n){t.show({controller:"UserapikeymanagerController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{user:e,users:m.users?m.users.rows:[],crudPermissions:m.crudPermissions}})},m.changepassworddialog=function(e,n){t.show({controller:"UserchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{user:e,setting:s,users:m.users?m.users.rows:[],crudPermissions:m.crudPermissions}})},m.alert=r.info,m.gotoUsers=function(){e.go("app.staff.users",{},{reload:"app.staff.users"})},m.saveUser=function(){m.user=_.omit(m.user,"userpic"),o.user.update({id:m.user.id},m.user).$promise.then(function(){r.success({title:"User updated!",msg:m.user.name?m.user.name+" has been updated!":""})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.refreshUser=function(){return o.user.get({id:m.user.id,userSetting:!0}).$promise.then(function(e){m.user=e})},o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.userProfiles=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.user.getApiKey({id:m.user.id}).$promise.then(function(e){m.user.apiKey=e.api_key?e.api_key:"N/A"}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_APIKEY",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","license","setting","api","toasty","Auth","user","userProfileSection"],angular.module("app.staff").controller("UserController",e)}(),function(){"use strict";function e(e,t,a,i,s,n,o,r,l,d,c,m,u,p){var g=this;g.license=m,g.setting=u,g.currentUser=c.getCurrentUser(),g.users=n||{count:0,rows:[]},g.userProfile=o,g.userProfileSection=r&&1==r.count?r.rows[0]:null,g.crudPermissions=c.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.table="users",g.listOrder="",g.listOrderAsc=null,g.selectedUsers=[],g.query={fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled",role:"admin,user",userSetting:!0,sort:"-updatedAt",limit:10,page:1},g.arrayrole=_.keyBy([{option:"Admin",value:"'admin'"},{option:"User",value:"'user'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.editstate=function(e,n){t.go("app.staff.users.edit",{id:e.id,user:e,crudPermissions:g.crudPermissions})},g.deleteconfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the "+_.startCase("user")+"?").htmlContent("<b>"+(e.name||"user")+"</b> will be deleted.").ariaLabel("delete user").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){A(e)},function(){console.log("CANCEL")})},g.success=f,g.getUsers=b,g.createOrEditUser=function(e,n){a.show({controller:"CreateOrEditUserDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{user:n,users:g.users.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}})},g.deleteUser=A,g.exportSelectedUsers=function(){var e=angular.copy(g.selectedUsers);return g.selectedUsers=[],e},g.deleteSelectedUsers=function(e){var n=a.confirm().title("Are you sure want to delete the selected users?").htmlContent("<b>"+g.selectedUsers.length+" selected</b> will be deleted.").ariaLabel("delete Users").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){g.selectedUsers.forEach(function(e){A(e)}),g.selectedUsers=[]})},g.deselectUsers=function(){g.selectedUsers=[]},g.selectAllUsers=function(){g.selectedUsers=g.users.rows},l.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.userProfiles=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=!0,h=1;function f(e){g.users=e||{count:0,rows:[]}}function b(){g.query.offset=(g.query.page-1)*g.query.limit,c.hasRole("admin")?g.promise=l.user.get(g.query,f).$promise:(g.query.id=g.userProfile.id,g.query.section="Users",g.promise=l.userProfile.getResources(g.query,f).$promise)}function A(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(g.users.rows,{id:e.id}),g.users.count-=1,g.users.rows.length||g.getUsers(),d.success({title:_.startCase("User")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){v?s(function(){v=!1}):(n||(h=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=h),g.getUsers())}),p.on("user-setting:update",b),e.$on("$destroy",function(){p.removeListener("user-setting:update",b)})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","users","userProfile","userProfileSection","api","toasty","Auth","license","setting","socket"],angular.module("app.staff").controller("UsersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.cannedAnswers=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="cannedAnswers",f.listOrder="",f.listOrderAsc=null,f.selectedCannedAnswers=[],f.query={fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{cannedAnswer:e,cannedAnswers:f.cannedAnswers.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("cannedAnswer")+"?").htmlContent("<b>"+(e.name||"cannedAnswer")+"</b> will be deleted.").ariaLabel("delete cannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCannedAnswers=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cannedAnswer.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="CannedAnswers",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCannedAnswer=function(e,n){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{cannedAnswer:n,cannedAnswers:f.cannedAnswers.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCannedAnswer=y,f.exportSelectedCannedAnswers=function(){var e=angular.copy(f.selectedCannedAnswers);return f.selectedCannedAnswers=[],e},f.deleteSelectedCannedAnswers=function(e){var n=i.confirm().title("Are you sure want to delete the selected cannedAnswers?").htmlContent("<b>"+f.selectedCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete CannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCannedAnswers.forEach(function(e){y(e)}),f.selectedCannedAnswers=[]})},f.deselectCannedAnswers=function(){f.selectedCannedAnswers=[]},f.selectAllCannedAnswers=function(){f.selectedCannedAnswers=f.cannedAnswers.rows};var b=!0,A=1;function E(e){f.cannedAnswers=e||{count:0,rows:[]}}function y(e){m.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(f.cannedAnswers.rows,{id:e.id}),f.cannedAnswers.count-=1,f.cannedAnswers.rows.length||f.getCannedAnswers(),p.success({title:_.startCase("CannedAnswer")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcannedAnswer"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcannedAnswer",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCannedAnswers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","cannedAnswers","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("CannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CANNEDANSWER",g.cannedAnswer=angular.copy(l),g.cannedAnswers=r,g.newCannedAnswer=!1,g.cannedAnswer||(g.cannedAnswer={},g.title="TOOLS.NEW_CANNEDANSWER",g.newCannedAnswer=!0),g.addNewCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.cannedAnswer).$promise.then(function(e){g.cannedAnswers.unshift(e.toJSON()),o.success({title:"CannedAnswer properly created",msg:g.cannedAnswer.name?g.cannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.cannedAnswer.id},g.cannedAnswer).$promise.then(function(e){var n=_.find(g.cannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CannedAnswer properly saved!",msg:g.cannedAnswer.name?g.cannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The cannedAnswer will be deleted.").ariaLabel("Delete CannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.cannedAnswer.id}).$promise.then(function(){_.remove(g.cannedAnswers,{id:g.cannedAnswer.id}),o.success({title:"CannedAnswer properly deleted!",msg:(g.cannedAnswer.name||"cannedAnswer")+" has been deleted!"}),v(g.cannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","cannedAnswers","cannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.contact_item_types=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="contact_item_types",f.listOrder="",f.listOrderAsc=null,f.selectedContactItemType=[],f.query={fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditContactItemTypeDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/contact_item_types/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{contactItemType:e,contact_item_types:f.contact_item_types.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("contactItemType")+"?").htmlContent("<b>"+(e.name||"contactItemType")+"</b> will be deleted.").ariaLabel("delete contactItemType").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getContactItemType=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.contactItemType.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ContactItemType",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditContactItemType=function(e,n){i.show({controller:"CreateOrEditContactItemTypeDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/contact_item_types/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{contactItemType:n,contact_item_types:f.contact_item_types.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteContactItemType=y,f.exportSelectedContactItemType=function(){var e=angular.copy(f.selectedContactItemType);return f.selectedContactItemType=[],e},f.deleteSelectedContactItemType=function(e){var n=i.confirm().title("Are you sure want to delete the selected contact_item_types?").htmlContent("<b>"+f.selectedContactItemType.length+" selected</b> will be deleted.").ariaLabel("delete ContactItemTypes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedContactItemType.forEach(function(e){y(e)}),f.selectedContactItemType=[]})},f.deselectContactItemType=function(){f.selectedContactItemType=[]},f.selectAllContactItemType=function(){f.selectedContactItemType=f.contact_item_types.rows};var b=!0,A=1;function E(e){f.contact_item_types=e||{count:0,rows:[]}}function y(e){m.contactItemType.delete({id:e.id}).$promise.then(function(){_.remove(f.contact_item_types.rows,{id:e.id}),f.contact_item_types.count-=1,f.contact_item_types.rows.length||f.getContactItemType(),p.success({title:_.startCase("ContactItemType")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcontactItemType"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcontactItemType",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getContactItemType())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contact_item_types","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("ContactItemTypesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CONTACTITEMTYPE",g.contactItemType=angular.copy(l),g.contact_item_types=r,g.newContactItemType=!1,g.contactItemType||(g.contactItemType={rgbBackgroundColor:"#2196f3"},g.title="TOOLS.NEW_CONTACTITEMTYPE",g.newContactItemType=!0),g.addNewContactItemType=function(){g.errors=[],d.contactItemType.save(g.contactItemType).$promise.then(function(e){g.contact_item_types.unshift(e.toJSON()),o.success({title:"ContactItemType properly created",msg:g.contactItemType.name?g.contactItemType.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveContactItemType=function(){g.errors=[],isNaN(g.contactItemType.OrderBy)?alert(s.instant("TOOLS.ORDER_BY_NUMERIC")):d.contactItemType.update({id:g.contactItemType.id},g.contactItemType).$promise.then(function(e){var n=_.find(g.contact_item_types,{id:e.id});n&&_.merge(n,_.pick(e.toJSON(),_.keys(n))),o.success({title:"ContactItemType properly saved!",msg:g.contactItemType.name?g.contactItemType.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteContactItemType=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The contactItemType will be deleted.").ariaLabel("Delete ContactItemType").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.contactItemType.delete({id:g.contactItemType.id}).$promise.then(function(){_.remove(g.contact_item_types,{id:g.contactItemType.id}),o.success({title:"ContactItemType properly deleted!",msg:(g.contactItemType.name||"contactItemType")+" has been deleted!"}),v(g.contactItemType)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","contact_item_types","contactItemType","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactItemTypeDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CUSTOMDASHBOARD",g.customDashboard=angular.copy(l),g.customDashboards=r,g.newCustomDashboard=!1,g.customDashboard||(g.customDashboard={},g.title="TOOLS.NEW_CUSTOMDASHBOARD",g.newCustomDashboard=!0),g.addNewCustomDashboard=function(){g.errors=[],d.dashboard.save(g.customDashboard).$promise.then(function(e){g.customDashboards.unshift(e.toJSON()),o.success({title:"CustomDashboard properly created",msg:g.customDashboard.name?g.customDashboard.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomDashboard=function(){g.errors=[],d.dashboard.update({id:g.customDashboard.id},g.customDashboard).$promise.then(function(e){var n=_.find(g.customDashboards,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CustomDashboard properly saved!",msg:g.customDashboard.name?g.customDashboard.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomDashboard=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The customDashboard will be deleted.").ariaLabel("Delete CustomDashboard").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.dashboard.delete({id:g.customDashboard.id}).$promise.then(function(){_.remove(g.customDashboards,{id:g.customDashboard.id}),o.success({title:"CustomDashboard properly deleted!",msg:(g.customDashboard.name||"customDashboard")+" has been deleted!"}),v(g.customDashboard)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customDashboards","customDashboard","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditCustomDashboardDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.customDashboards=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="customDashboards",f.listOrder="",f.listOrderAsc=null,f.selectedCustomDashboards=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.tools.customDashboards.edit",{id:e.id,customDashboard:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:f.customDashboards?f.customDashboards.rows:[],crudPermissions:f.crudPermissions}})},f.gotodashboardgoto=function(e,n){t.go("app.dashboards.custom",{id:e.id})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("customDashboard")+"?").htmlContent("<b>"+(e.name||"customDashboard")+"</b> will be deleted.").ariaLabel("delete customDashboard").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCustomDashboards=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.dashboard.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="CustomDashboards",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCustomDashboard=function(e,n){i.show({controller:"CreateOrEditCustomDashboardDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{customDashboard:n,customDashboards:f.customDashboards.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCustomDashboard=y,f.exportSelectedCustomDashboards=function(){var e=angular.copy(f.selectedCustomDashboards);return f.selectedCustomDashboards=[],e},f.deleteSelectedCustomDashboards=function(e){var n=i.confirm().title("Are you sure want to delete the selected customDashboards?").htmlContent("<b>"+f.selectedCustomDashboards.length+" selected</b> will be deleted.").ariaLabel("delete CustomDashboards").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCustomDashboards.forEach(function(e){y(e)}),f.selectedCustomDashboards=[]})},f.deselectCustomDashboards=function(){f.selectedCustomDashboards=[]},f.selectAllCustomDashboards=function(){f.selectedCustomDashboards=f.customDashboards.rows};var b=!0,A=1;function E(e){f.customDashboards=e||{count:0,rows:[]}}function y(e){m.dashboard.delete({id:e.id}).$promise.then(function(){_.remove(f.customDashboards.rows,{id:e.id}),f.customDashboards.count-=1,f.customDashboards.rows.length||f.getCustomDashboards(),p.success({title:_.startCase("CustomDashboard")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdashboard"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdashboard",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCustomDashboards())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","customDashboards","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("CustomDashboardsController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newCustomDashboard=!0,r.customDashboard=angular.copy(i),r.customDashboards=s,r.title=o.instant("TOOLS.CLONE_CUSTOMDASHBOARD"),i&&i.name&&(r.title+=": "+i.name),r.cloneCustomDashboard=function(){return e.dashboard.clone({id:i.id,includeAll:!0},r.customDashboard).$promise.then(function(e){r.customDashboards.unshift(e.toJSON()),a.success({title:"CustomDashboard properly cloned",msg:r.customDashboard.name?r.customDashboard.name+" has been cloned!":""}),t.go("app.tools.customDashboards.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","customDashboard","customDashboards","$translate"],angular.module("app.tools").controller("CustomDashboardcloneController",e)}(),function(){"use strict";function e(t,a,i,s,o){var r=this;r.customDashboard={};var l=[];function d(e,n,t){return o.dashboardItem.update(t).$promise.catch(function(e){console.error(e)})}r.init=function(e,n){return r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.customDashboard=e,r.customDashboard.draggable={enabled:!0,handle:".draggable",stop:d},r.customDashboard.resizable={enabled:!0,handle:".resizable",stop:d},r.customDashboard.widgets=[],r.customDashboard.crudPermissions=r.crudPermissions,l.push(i(function(e){e(r.voiceQueues=o.rpc.getVoiceQueues({fields:"id,name"}))})),l.push(i(function(n){o.chatWebsite.get({fields:"id,name"}).$promise.then(function(e){r.chatWebsites=e||{count:0,rows:[]},n(r.chatWebsites)})})),l.push(i(function(n){o.faxAccount.get({fields:"id,name"}).$promise.then(function(e){r.faxAccounts=e||{count:0,rows:[]},n(r.faxAccounts)})})),l.push(i(function(n){o.mailAccount.get({fields:"id,name"}).$promise.then(function(e){r.mailAccounts=e||{count:0,rows:[]},n(r.mailAccounts)})})),l.push(i(function(n){o.openchannelAccount.get({fields:"id,name"}).$promise.then(function(e){r.openchannelAccounts=e||{count:0,rows:[]},n(r.openchannelAccounts)})})),l.push(i(function(n){o.whatsappAccount.get({fields:"id,name"}).$promise.then(function(e){r.whatsappAccounts=e||{count:0,rows:[]},n(r.whatsappAccounts)})})),l.push(i(function(n){o.smsAccount.get({fields:"id,name"}).$promise.then(function(e){r.smsAccounts=e||{count:0,rows:[]},n(r.smsAccounts)})})),i.all(l).then(function(){return o.dashboard.getItems({id:e.id}).$promise.then(function(e){if(e&&e.count&&e.rows)for(var n=0;n<e.rows.length;n+=1)e.rows[n].voiceQueues=r.voiceQueues,e.rows[n].voiceQueuesSelected=_.map(r.voiceQueues.rows,"id"),e.rows[n].smsAccounts=r.smsAccounts,e.rows[n].smsAccountsSelected=_.map(r.smsAccounts.rows,"id"),e.rows[n].faxAccounts=r.faxAccounts,e.rows[n].faxAccountsSelected=_.map(r.faxAccounts.rows,"id"),e.rows[n].mailAccounts=r.mailAccounts,e.rows[n].mailAccountsSelected=_.map(r.mailAccounts.rows,"id"),e.rows[n].openchannelAccounts=r.openchannelAccounts,e.rows[n].openchannelAccountsSelected=_.map(r.openchannelAccounts.rows,"id"),e.rows[n].chatWebsites=r.chatWebsites,e.rows[n].chatWebsitesSelected=_.map(r.chatWebsites.rows,"id"),e.rows[n].whatsappAccounts=r.whatsappAccounts,e.rows[n].whatsappAccountsSelected=_.map(r.whatsappAccounts.rows,"id"),e.rows[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[n].type+"/ms-widget-engine."+e.rows[n].type+".html",r.customDashboard.widgets.push(e.rows[n])}).catch(function(e){console.error(e)})})},r.createOrEditWidget=function(e){if(e&&e.attrs)for(var n=0;n<e.attrs.length;n+=1)"attrReport"===e.attrs[n].name&&(e.reportType=e.attrs[n].type),e[e.attrs[n].name]=e.attrs[n].value;t.show({controller:"CreateOrEditDashboardItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",parent:angular.element(a.body),clickOutsideToClose:!0,locals:{dashboarditem:e,dashboard:r.customDashboard.widgets,license:null,setting:null,crudPermissions:r.crudPermissions}}).then(function(e){if(e)for(var n=0;n<r.customDashboard.widgets.length;n+=1)r.customDashboard.widgets[n].id===e.id&&(r.customDashboard.widgets[n].attrs=e.attrs,r.customDashboard.widgets[n].voiceQueues=r.voiceQueues,r.customDashboard.widgets[n].voiceQueuesSelected=_.map(r.voiceQueues.rows,"id"),r.customDashboard.widgets[n].smsAccounts=r.smsAccounts,r.customDashboard.widgets[n].smsAccountsSelected=_.map(r.smsAccounts.rows,"id"),r.customDashboard.widgets[n].faxAccounts=r.faxAccounts,r.customDashboard.widgets[n].faxAccountsSelected=_.map(r.faxAccounts.rows,"id"),r.customDashboard.widgets[n].mailAccounts=r.mailAccounts,r.customDashboard.widgets[n].mailAccountsSelected=_.map(r.mailAccounts.rows,"id"),r.customDashboard.widgets[n].openchannelAccounts=r.openchannelAccounts,r.customDashboard.widgets[n].openchannelAccountsSelected=_.map(r.openchannelAccounts.rows,"id"),r.customDashboard.widgets[n].chatWebsites=r.chatWebsites,r.customDashboard.widgets[n].chatWebsitesSelected=_.map(r.chatWebsites.rows,"id"),r.customDashboard.widgets[n].whatsappAccounts=r.whatsappAccounts,r.customDashboard.widgets[n].whatsappAccountsSelected=_.map(r.whatsappAccounts.rows,"id"),r.customDashboard.widgets[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+r.customDashboard.widgets[n].type+"/ms-widget-engine."+r.customDashboard.widgets[n].type+".html")})},r.deleteWidget=function(n){var e=t.confirm().title("Would you like to delete "+n.title+"?").textContent("").ariaLabel("Delete Widget").ok("YES").cancel("NO");t.show(e).then(function(){return o.dashboardItem.delete({id:n.id}).$promise.then(function(e){_.remove(r.customDashboard.widgets,{id:n.id}),s.success({title:"Widget deleted!",msg:n.name?n.name+" has been deleted!":"Widget has been deleted!"})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE.customDashboard"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdashboard",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()});console.error(e)})})}}e.$inject=["$mdDialog","$document","$q","toasty","api"],angular.module("app.tools").controller("CustomDashboardItemsController",e)}(),function(){"use strict";function e(n,e,t,a,o,i,s,r,l,d,c,m,u,p){var g=this;g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_DASHBOARDITEM",g.dashboarditem=angular.copy(l),g.dashboard=r,g.newDashboardItem=!1,g.selectedReport=[],g.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},g.dashboarditem?"web-report"==g.dashboarditem.type&&(g.apiName="custom"===g.dashboarditem.reportType?"analyticCustomReport":"analyticDefaultReport",d[g.apiName].get({fields:"id,name,parent"}).$promise.then(function(e){g.currentReport=_.find(e.rows,{id:g.dashboarditem.attrReport}),g.dashboarditem.report=g.currentReport.name,g.query.parent=g.currentReport.parent})):(g.dashboarditem={type:"counter",attrChannel:"voice",titleFontSize:12,attrUrl:"https://",attrHourFormat:"HH:mm:ss",attrTimezone:"0.00",attrMetric:"total",attrSerie1:"total",attrSerie2:"null",attrSerie3:"null",attrRefresh:10,attrFontSize:20,foreground:"#2196f3",background:"#ffffff"},g.title="TOOLS.NEW_DASHBOARDITEM",g.newDashboardItem=!0),g.addNewDashboardItem=function(){g.errors=[],d.dashboard.addItem({id:e.params.id},g.dashboarditem).$promise.then(function(e){g.dashboard.unshift(e.toJSON()),s.success({title:"DashboardItem properly created",msg:g.dashboarditem.name?g.dashboarditem.name+" has been created!":""}),I(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.save"}];for(var n=0;n<e.data.errors.length;n+=1)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDashboardItem=function(){g.errors=[],d.dashboardItem.update({id:g.dashboarditem.id},g.dashboarditem).$promise.then(function(e){var n=_.find(g.dashboard,{id:e.id});n&&_.merge(n,e.toJSON()),s.success({title:"DashboardItem properly saved!",msg:g.dashboarditem.name?g.dashboarditem.name+" has been saved!":""}),I(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDashboardItem=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The dashboarditem will be deleted.").ariaLabel("Delete DashboardItem").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.dashboardItem.delete({id:g.dashboarditem.id}).$promise.then(function(){_.remove(g.dashboard,{id:g.dashboarditem.id}),s.success({title:"DashboardItem properly deleted!",msg:(g.dashboarditem.name||"dashboarditem")+" has been deleted!"}),I(g.dashboarditem)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.delete"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.getReports=S,g.selectReport=function(){if(g.dashboarditem.report=g.selectedReport[0].name,g.dashboarditem.attrReport=g.selectedReport[0].id,g.dashboarditem.reportType=g.currentNode.custom?"custom":"default",!g.newDashboardItem){var e={name:"attrReport",type:g.dashboarditem.reportType,value:g.selectedReport[0].id};g.dashboarditem.attrs.splice(_.findIndex(g.dashboarditem.attrs,1,e))}n.dashboarditemForm.report.$setDirty(),a.hide()},g.closeReportDialog=function(){a.hide()},g.onTypeChange=function(){["web-report","iframe","clock","custom"].includes(g.dashboarditem.type)&&(g.dashboarditem.attrEmailAccounts=null,g.dashboarditem.attrFaxAccounts=null,g.dashboarditem.attrSmsAccounts=null,g.dashboarditem.attrOpenchannelAccounts=null,g.dashboarditem.attrWhatsappAccounts=null,g.dashboarditem.attrChatWebsites=null)},g.searchReport=function(){g.treeDefaultData=g.treeReports[0]?angular.fromJson(g.treeReports[0].tree):[],g.treeCustomData=g.treeReports[1]?angular.fromJson(g.treeReports[1].tree):[],g.treeConfig=(n={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},"admin"!==g.currentUser.role?d.userProfileSection.get({fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:g.currentUser.userProfileId,sectionId:1203}).$promise.then(function(e){return g.userProfileSection=e&&1==e.count?e.rows[0]:null,n}).catch(function(e){s.error({title:"ERROR",msg:e.message})}):n),g.treeDefaultEvents=f(!1),g.treeCustomEvents=f(!0),a.show({controller:function(){return g},controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/partialViews/reports/treeReports.html",autoWrap:!0,skipHide:!0});var n},g.closeDialog=I,d.analyticTreeReport.get({}).$promise.then(function(e){g.treeReports=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],h=null;function f(e){return e?{loaded:E,select_node:b}:{loaded:y,select_node:A}}function b(e,n){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=n.node.id,S()}function A(e,n){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=n.node.id,S()}function E(){if(!g.newDashboardItem&&"analyticCustomReport"===g.apiName){var e=g.treeCustomInstance.jstree(!0).get_node(g.query.parent);b(0,{node:e,selected:e.id})}}function y(){if(!g.newDashboardItem&&"analyticDefaultReport"===g.apiName){var e=g.treeDefaultInstance.jstree(!0).get_node(g.query.parent);A(0,{node:e,selected:e.id})}}function S(){if(g.query.offset=(g.query.page-1)*g.query.limit,g.apiName)if("admin"===g.currentUser.role)g.promise=d[g.apiName].get(g.query,T).$promise;else{if(!g.userProfileSection)return T(null);if(g.userProfileSection.autoAssociation)g.promise=d[g.apiName].get(g.query,T).$promise;else{var a=[];g.promise=d[g.apiName].get(g.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:g.userProfileSection.id,type:"analyticDefaultReport"===g.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),T({count:t.length,rows:t})}return T(null)}):T(null)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_REPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}}function T(e){g.reports=e||{count:0,rows:[]},g.newDashboardItem||g.selectedReport.push(_.find(g.reports.rows,{id:g.currentReport.id}))}function I(e){a.hide(e)}c.hasRole("admin")?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){g.voiceQueues=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){h=e.rows||[]}).then(function(){for(var e=[],n=0;n<v.length;n++)e.push(d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:v[n].id}).$promise);return o.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<v.length;a++){var i=_.find(n,["sectionId",v[a].id]);if(i)if(i.autoAssociation){var s=[];h.forEach(function(e){e.type===v[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(t)}).then(function(e){var n=[],t=null;g.dashboarditem&&(t=_.find(h,{id:Number(g.dashboarditem.attrVoiceQueues)}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){n.push(e)})}t&&!_.some(n,["resourceId",t.id])&&h.forEach(function(e){e.id===t.id&&(e.canSelect=!1,n.push(e))}),g.voiceQueues=n}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.mailAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.mailAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.mailAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.mailAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.mailAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.mailAccount,{id:Number(g.dashboarditem.attrEmailAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.mailAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.mailAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.mailAccount,{id:Number(g.dashboarditem.attrEmailAccounts)}));for(var i=0;i<g.mailAccount.length;i++)a&&g.mailAccount[i].id===a.id&&(g.mailAccount[i].canSelect=!1,t.push(g.mailAccount[i]));g.mailAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.faxAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.faxAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.faxAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.faxAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.faxAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.faxAccount,{id:Number(g.dashboarditem.attrFaxAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.faxAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.faxAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.faxAccount,{id:Number(g.dashboarditem.attrFaxAccounts)}));for(var i=0;i<g.faxAccount.length;i++)a&&g.faxAccount[i].id===a.id&&(g.faxAccount[i].canSelect=!1,t.push(g.faxAccount[i]));g.faxAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.smsAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.smsAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.smsAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.smsAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.smsAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.smsAccount,{id:Number(g.dashboarditem.attrSmsAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.smsAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.smsAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.smsAccount,{id:Number(g.dashboarditem.attrSmsAccounts)}));for(var i=0;i<g.smsAccount.length;i++)a&&g.smsAccount[i].id===a.id&&(g.smsAccount[i].canSelect=!1,t.push(g.smsAccount[i]));g.smsAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.openchannelAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.openchannelAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.openchannelAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.openchannelAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.openchannelAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.openchannelAccount,{id:Number(g.dashboarditem.attrOpenchannelAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.openchannelAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.openchannelAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.openchannelAccount,{id:Number(g.dashboarditem.attrOpenchannelAccounts)}));for(var i=0;i<g.openchannelAccount.length;i++)a&&g.openchannelAccount[i].id===a.id&&(g.openchannelAccount[i].canSelect=!1,t.push(g.openchannelAccount[i]));g.openchannelAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.whatsappAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.whatsappAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_WHATSAPPACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.whatsappAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.whatsappAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:2102}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.whatsappAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.whatsappAccount,{id:Number(g.dashboarditem.attrWhatsappAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.whatsappAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.whatsappAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.whatsappAccount,{id:Number(g.dashboarditem.attrWhatsappAccounts)}));for(var i=0;i<g.whatsappAccount.length;i++)a&&g.whatsappAccount[i].id===a.id&&(g.whatsappAccount[i].canSelect=!1,t.push(g.whatsappAccount[i]));g.whatsappAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.chatWebsite.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.chatWebsite=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATWEBSITE",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.chatWebsite.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.chatWebsite=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.chatWebsite,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.chatWebsite,{id:Number(g.dashboarditem.attrChatWebsites)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.chatWebsite,{id:t.id});a.canSelect=!1,n.push(a)}g.chatWebsite=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.chatWebsite,{id:Number(g.dashboarditem.attrChatWebsites)}));for(var i=0;i<g.chatWebsite.length;i++)a&&g.chatWebsite[i].id===a.id&&(g.chatWebsite[i].canSelect=!1,t.push(g.chatWebsite[i]));g.chatWebsite=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dashboard","dashboarditem","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditDashboardItemDialogController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.customDashboard=c||t.params.customDashboard||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){a.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:u.customDashboards?u.customDashboards.rows:[],crudPermissions:u.crudPermissions}})},u.gotogoto=function(e,n){t.go("app.dashboards.custom",{id:e.id})},u.alert=l.info,u.gotoCustomDashboards=function(){t.go("app.tools.customDashboards",{},{reload:"app.tools.customDashboards"})},u.saveCustomDashboard=function(){r.dashboard.update({id:u.customDashboard.id},u.customDashboard).$promise.then(function(){l.success({title:"CustomDashboard updated!",msg:u.customDashboard.name?u.customDashboard.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETdashboard",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","customDashboard","userProfileSection"],angular.module("app.tools").controller("CustomDashboardController",e)}(),function(){"use strict";function e(a,i,o,r,e,l,d,n,t,s,c){var m=this;if(m.currentUser=n.getCurrentUser(),m.disposition=angular.copy(e),m.setting=c,m.license=s,m.crudPermissions=t,m.newDisposition=!1,m.errors=[],m.disposition||(m.disposition={level:"first"},m.newDisposition=!0),l){var u=l.field;m.disposition[u]=l.id}function p(){return o(function(t,n){d.disposition.get({fields:"id,name,level,ParentId",sort:"id",nolimit:"true"}).$promise.then(function(e){var n=e.rows||[];return t(n)}).catch(function(e){n(e)})})}function g(e){"first"===e.level?m.firstLevelDisposition=e:(m.anySecondLevelDisposition=!0,m.secondLevelDisposition=e,m.firstLevelDisposition=_.find(m.dispositions,["id",m.secondLevelDisposition.ParentId]),m.firstLevelDisposition||p().then(function(){m.firstLevelDisposition=_.find(m.allDispositions,["id",m.secondLevelDisposition.ParentId]),m.firstLevelDisposition.canSelect=!1,m.dispositions.push(m.firstLevelDisposition)}))}function v(e){a.hide(e)}m.onInit=function(){var e={fields:"id,name,level,ParentId",id:l?l.id:void 0,section:"user"===m.currentUser.role?"Dispositions":void 0,MailAccountId:l?void 0:"null",FaxAccountId:l?void 0:"null",SmsAccountId:l?void 0:"null",OpenchannelAccountId:l?void 0:"null",ChatWebsiteId:l?void 0:"null",WhatsappAccountId:l?void 0:"null",ListId:l?void 0:"null",sort:"id",nolimit:"true"},n="get",t="disposition";l?(n="getDispositions",t=l.route):"user"===m.currentUser.role&&(n="getResources",t="userProfile",e.id=m.currentUser.userProfileId);(a=t,i=n,s=e,o(function(t,n){d[a][i](s).$promise.then(function(e){var n=e.rows||[];return t(n)}).catch(function(e){n(e)})})).then(function(e){m.dispositions=angular.copy(e),m.newDisposition||function(){if("first"===m.disposition.level)return;if(m.parentDisposition=_.find(m.dispositions,["id",m.disposition.ParentId]),!m.parentDisposition)return p().then(function(e){m.allDispositions=e;for(var n=0;n<m.allDispositions.length;n++){var t=m.allDispositions[n];if(t.id===m.disposition.ParentId){g(t),t.canSelect=!1,m.dispositions.push(t);break}}});g(m.parentDisposition)}()}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:["api",t,n].join(":"),msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});var a,i,s},m.onFirstLevelSelection=function(){m.secondLevelDisposition=void 0,m.anySecondLevelDisposition=_.some(m.dispositions,function(e){return e.ParentId===m.firstLevelDisposition.id&&e.id!=m.disposition.id})},m.addNewDisposition=function(){m.errors=[],m.secondLevelDisposition?(m.disposition.ParentId=m.secondLevelDisposition.id,m.disposition.level="third"):m.firstLevelDisposition&&(m.disposition.ParentId=m.firstLevelDisposition.id,m.disposition.level="second");d.disposition.save(m.disposition).$promise.then(function(e){m.dispositions.unshift(e.toJSON()),r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_CREATED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.save"}];for(var n=0;n<e.data.errors.length;n+=1)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveDisposition=function(){m.errors=[],m.secondLevelDisposition?(m.disposition.ParentId=m.secondLevelDisposition.id,m.disposition.level="third"):m.firstLevelDisposition&&(m.disposition.ParentId=m.firstLevelDisposition.id,m.disposition.level="second");d.disposition.update({id:m.disposition.id},m.disposition).$promise.then(function(e){var n=_.find(m.dispositions,{id:e.id});n&&_.merge(n,e.toJSON()),r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_SAVED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.update"}];for(var n=0;n<e.data.errors.length;n++)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteDisposition=function(e){m.errors=[];var n=_.some(m.dispositions,["ParentId",m.disposition.id]),t=a.confirm({skipHide:!0}).title(i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(i.instant("TOOLS.NOTIFICATIONS."+(n?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:m.disposition.name})).ariaLabel("Delete disposition").ok(i.instant("TOOLS.DELETE")).cancel(i.instant("TOOLS.CANCEL")).targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:m.disposition.id}).$promise.then(function(){r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var n=0;n<e.data.errors.length;n++)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},m.clearSelection=function(e){"first"===e?(m.firstLevelDisposition=void 0,m.secondLevelDisposition=void 0,m.anySecondLevelDisposition=!1):m.secondLevelDisposition=void 0},m.closeDialog=v}e.$inject=["$mdDialog","$translate","$q","toasty","disposition","model","api","Auth","crudPermissions","license","setting"],angular.module("app.tools").controller("CreateOrEditDispositionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this;function f(e){h.dispositions=e||{count:0,rows:[]}}function b(){h.query.offset=(h.query.page-1)*h.query.limit,p.isAdmin()?h.promise=m.disposition.get(h.query,f).$promise:(h.query.id=h.userProfile.id,h.query.section="Dispositions",h.promise=m.userProfile.getResources(h.query,f).$promise)}function A(e){m.disposition.delete({id:e.id}).$promise.then(function(){b(),u.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){h.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)u.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else u.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}h.license=g,h.setting=v,h.currentUser=p.getCurrentUser(),h.dispositions=l||{count:0,rows:[]},h.userProfile=d,h.userProfileSection=c&&1==c.count?c.rows[0]:null,h.crudPermissions=p.parseCrudPermissions(h.userProfileSection?h.userProfileSection.crudPermissions:null),h.selectedDispositions=[],h.levels={first:"1st",second:"2nd",third:"3rd"},h.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,page:1},h.deleteconfirm=function(e,n){var t=_.some(h.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){A(e)})},h.success=f,h.getDispositions=b,h.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:null,license:h.license,setting:h.setting,crudPermissions:h.crudPermissions}}).then(function(e){!0===e&&b()})},h.deleteDisposition=A,h.exportSelectedDispositions=function(){var e=angular.copy(h.selectedDispositions);return h.selectedDispositions=[],e},h.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:h.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){h.selectedDispositions.forEach(function(e){A(e)}),h.selectedDispositions=[]})},h.deselectDispositions=function(){h.selectedDispositions=[]},h.selectAllDispositions=function(){h.selectedDispositions=h.dispositions.rows};var E=!0,y=1;e.$watch("vm.query.filter",function(e,n){E?o(function(){E=!1}):(n||(y=h.query.page),e!==n&&(h.query.page=1),e||(h.query.page=y),b())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dispositions","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.tools").controller("DispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_INTERVAL",g.interval=angular.copy(l),g.intervals=r,g.newInterval=!1,g.interval||(g.interval={},g.title="TOOLS.NEW_INTERVAL",g.newInterval=!0),g.addNewInterval=function(){g.errors=[],d.interval.save(g.interval).$promise.then(function(e){g.intervals.unshift(e.toJSON()),o.success({title:"Interval properly created",msg:g.interval.name?g.interval.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInterval=function(){g.errors=[],d.interval.update({id:g.interval.id},g.interval).$promise.then(function(e){var n=_.find(g.intervals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Interval properly saved!",msg:g.interval.name?g.interval.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInterval=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.interval.delete({id:g.interval.id}).$promise.then(function(){_.remove(g.intervals,{id:g.interval.id}),o.success({title:"Interval properly deleted!",msg:(g.interval.name||"interval")+" has been deleted!"}),v(g.interval)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","intervals","interval","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditAppintervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.intervalIntervals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.interval.getIntervals(m.query,u).$promise}function g(e){d.interval.delete({id:e.id}).$promise.then(function(){_.remove(m.intervalIntervals.rows,{id:e.id}),m.intervalIntervals.count-=1,m.intervalIntervals.rows.length||p(),l.success({title:"Interval deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETinterval"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.interval={},m.intervalIntervals={count:0,rows:[]},m.selectedIntervalIntervals=[],m.crudPermissions,m.sortableTable={animation:100,onSort:function(e){d.interval.addIntervals({id:m.interval.id},e.models).$promise.then(function(e){m.intervalIntervals.rows=e}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SORTABLETABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})}},m.query={fields:"createdAt,updatedAt,id,name,interval",nolimit:"true",limit:10,page:1},m.init=function(e,n){m.interval=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.sortableTable.disabled=!m.crudPermissions.canEdit,m.query.id=m.interval.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interval?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interval #")+e.id||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIntervalIntervals=p,m.createOrEditIntervalInterval=function(e,n){o.show({controller:"EditAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:m.interval,interval:n,intervals:m.intervalIntervals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIntervalIntervals=function(){var e=angular.copy(m.selectedIntervalIntervals);return m.selectedIntervalIntervals=[],e},m.deleteIntervalInterval=g,m.deleteSelectedIntervalIntervals=function(e){var n=o.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+m.selectedIntervalIntervals.length+" selected</b> will be deleted.").ariaLabel("delete intervals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIntervalIntervals.forEach(function(e){g(e)}),m.selectedIntervalIntervals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("IntervalIntervalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_INTERVAL",g.interval=angular.copy(l),g.intervals=r,g.newInterval=!1,g.interval||(g.interval={},g.title="TOOLS.NEW_INTERVAL",g.newInterval=!0),g.addNewInterval=function(){g.errors=[],d.interval.save(g.interval).$promise.then(function(e){g.intervals.unshift(e.toJSON()),o.success({title:"Interval properly created",msg:g.interval.name?g.interval.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInterval=function(){g.errors=[],d.interval.update({id:g.interval.id},g.interval).$promise.then(function(e){var n=_.find(g.intervals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Interval properly saved!",msg:g.interval.name?g.interval.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInterval=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.interval.delete({id:g.interval.id}).$promise.then(function(){_.remove(g.intervals,{id:g.interval.id}),o.success({title:"Interval properly deleted!",msg:(g.interval.name||"interval")+" has been deleted!"}),v(g.interval)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","intervals","interval","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.interval=c||e.params.interval||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoIntervals=function(){e.go("app.tools.intervals",{},{reload:"app.tools.intervals"})},u.saveInterval=function(){r.interval.update({id:u.interval.id},u.interval).$promise.then(function(){l.success({title:"Interval updated!",msg:u.interval.name?u.interval.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","interval","userProfileSection"],angular.module("app.tools").controller("IntervalController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.intervals=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="intervals",f.listOrder="",f.listOrderAsc=null,f.selectedIntervals=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,page:1},f.editstate=function(e,n){t.go("app.tools.intervals.edit",{id:e.id,interval:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("interval")+"?").htmlContent("<b>"+(e.name||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getIntervals=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.interval.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Intervals",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditInterval=function(e,n){i.show({controller:"CreateOrEditIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:n,intervals:f.intervals.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteInterval=y,f.exportSelectedIntervals=function(){var e=angular.copy(f.selectedIntervals);return f.selectedIntervals=[],e},f.deleteSelectedIntervals=function(e){var n=i.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+f.selectedIntervals.length+" selected</b> will be deleted.").ariaLabel("delete Intervals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedIntervals.forEach(function(e){y(e)}),f.selectedIntervals=[]})},f.deselectIntervals=function(){f.selectedIntervals=[]},f.selectAllIntervals=function(){f.selectedIntervals=f.intervals.rows};var b=!0,A=1;function E(e){f.intervals=e||{count:0,rows:[]}}function y(e){m.interval.delete({id:e.id}).$promise.then(function(){_.remove(f.intervals.rows,{id:e.id}),f.intervals.count-=1,f.intervals.rows.length||f.getIntervals(),p.success({title:_.startCase("Interval")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEinterval"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getIntervals())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","intervals","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("IntervalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_PAUSE",g.pause=angular.copy(l),g.pauses=r,g.newPause=!1,g.pause||(g.pause={},g.title="TOOLS.NEW_PAUSE",g.newPause=!0),g.addNewPause=function(){g.errors=[],d.pause.save(g.pause).$promise.then(function(e){g.pauses.unshift(e.toJSON()),o.success({title:"Pause properly created",msg:g.pause.name?g.pause.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savePause=function(){g.errors=[],d.pause.update({id:g.pause.id},g.pause).$promise.then(function(e){var n=_.find(g.pauses,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Pause properly saved!",msg:g.pause.name?g.pause.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletePause=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The pause will be deleted.").ariaLabel("Delete Pause").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.pause.delete({id:g.pause.id}).$promise.then(function(){_.remove(g.pauses,{id:g.pause.id}),o.success({title:"Pause properly deleted!",msg:(g.pause.name||"pause")+" has been deleted!"}),v(g.pause)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","pauses","pause","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditPauseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.pauses=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="pauses",f.listOrder="",f.listOrderAsc=null,f.selectedPauses=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{pause:e,pauses:f.pauses.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("pause")+"?").htmlContent("<b>"+(e.name||"pause")+"</b> will be deleted.").ariaLabel("delete pause").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getPauses=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.pause.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Pauses",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditPause=function(e,n){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{pause:n,pauses:f.pauses.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletePause=y,f.exportSelectedPauses=function(){var e=angular.copy(f.selectedPauses);return f.selectedPauses=[],e},f.deleteSelectedPauses=function(e){var n=i.confirm().title("Are you sure want to delete the selected pauses?").htmlContent("<b>"+f.selectedPauses.length+" selected</b> will be deleted.").ariaLabel("delete Pauses").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedPauses.forEach(function(e){y(e)}),f.selectedPauses=[]})},f.deselectPauses=function(){f.selectedPauses=[]},f.selectAllPauses=function(){f.selectedPauses=f.pauses.rows};var b=!0,A=1;function E(e){f.pauses=e||{count:0,rows:[]}}function y(e){m.pause.delete({id:e.id}).$promise.then(function(){_.remove(f.pauses.rows,{id:e.id}),f.pauses.count-=1,f.pauses.rows.length||f.getPauses(),p.success({title:_.startCase("Pause")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEpause"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEpause",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getPauses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","pauses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("PausesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;if(g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_SCHEDULE",g.schedule=angular.copy(l),g.schedules=r,g.newSchedule=!1,g.selectedReport=[],g.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},g.schedule){g.apiName=g.schedule.DefaultReportId?"analyticDefaultReport":"analyticCustomReport";var v=g.schedule.DefaultReportId?g.schedule.DefaultReportId:g.schedule.CustomReportId;d[g.apiName].get({fields:"id,name,parent"}).$promise.then(function(e){g.currentReport=_.find(e.rows,{id:v}),g.schedule.report=g.currentReport.name,g.query.parent=g.currentReport.parent})}else g.schedule={output:"xlsx",active:!0,startAt:new Date,endAt:new Date(Date.now()+2592e6),cron:"0 0 * * *",subtractNumber:1,subtractUnit:"days",sendMail:!1,sendIfEmpty:!0},g.title="TOOLS.NEW_SCHEDULE",g.newSchedule=!0;function h(e){return e?{loaded:A,select_node:f}:{loaded:E,select_node:b}}function f(e,n){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=n.node.id,y()}function b(e,n){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=n.node.id,y()}function A(){if(!g.newSchedule&&"analyticCustomReport"===g.apiName){var e=g.treeCustomInstance.jstree(!0).get_node(g.query.parent);f(0,{node:e,selected:e.id})}}function E(){if(!g.newSchedule&&"analyticDefaultReport"===g.apiName){var e=g.treeDefaultInstance.jstree(!0).get_node(g.query.parent);b(0,{node:e,selected:e.id})}}function y(){if(g.query.offset=(g.query.page-1)*g.query.limit,g.apiName)if("admin"===g.currentUser.role)g.promise=d[g.apiName].get(g.query,S).$promise;else{if(!g.userProfileSection)return S(null);if(g.userProfileSection.autoAssociation)g.promise=d[g.apiName].get(g.query,S).$promise;else{var a=[];g.promise=d[g.apiName].get(g.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:g.userProfileSection.id,type:"analyticDefaultReport"===g.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),S({count:t.length,rows:t})}return S(null)}):S(null)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_REPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}}function S(e){g.reports=e||{count:0,rows:[]},g.newSchedule||g.selectedReport.push(_.find(g.reports.rows,{id:g.currentReport.id}))}function T(e){a.hide(e)}g.addNewSchedule=function(){g.errors=[],d.schedule.save(g.schedule).$promise.then(function(e){g.schedules.unshift(e.toJSON()),o.success({title:"Schedule properly created",msg:g.schedule.name?g.schedule.name+" has been created!":""}),T(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSchedule=function(){g.errors=[],d.schedule.update({id:g.schedule.id},g.schedule).$promise.then(function(e){var n=_.find(g.schedules,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Schedule properly saved!",msg:g.schedule.name?g.schedule.name+" has been saved!":""}),T(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSchedule=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The schedule will be deleted.").ariaLabel("Delete Schedule").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.schedule.delete({id:g.schedule.id}).$promise.then(function(){_.remove(g.schedules,{id:g.schedule.id}),o.success({title:"Schedule properly deleted!",msg:(g.schedule.name||"schedule")+" has been deleted!"}),T(g.schedule)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.getReports=y,g.selectReport=function(){g.schedule.report=g.selectedReport[0].name,g.currentNode.custom?(g.schedule.CustomReportId=g.selectedReport[0].id,delete g.schedule.DefaultReportId):(g.schedule.DefaultReportId=g.selectedReport[0].id,delete g.schedule.CustomReportId);e.scheduleForm.report.$setDirty(),a.hide()},g.closeReportDialog=function(){a.hide()},g.searchReport=function(){g.treeDefaultData=g.treeReports[0]?angular.fromJson(g.treeReports[0].tree):[],g.treeCustomData=g.treeReports[1]?angular.fromJson(g.treeReports[1].tree):[],g.treeConfig=(n={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},"admin"!==g.currentUser.role?d.userProfileSection.get({fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:g.currentUser.userProfileId,sectionId:1203}).$promise.then(function(e){return g.userProfileSection=e&&1==e.count?e.rows[0]:null,n}).catch(function(e){o.error({title:"ERROR",msg:e.message})}):n),g.treeDefaultEvents=h(!1),g.treeCustomEvents=h(!0),a.show({controller:function(){return g},controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/partialViews/reports/treeReports.html",autoWrap:!0,skipHide:!0});var n},g.closeDialog=T,d.analyticTreeReport.get({}).$promise.then(function(e){g.treeReports=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.mailAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.mailAccounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.mailAccounts,{id:e.resourceId})}),t=null;if(g.schedule&&(t=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.mailAccounts,{id:t.id});a.canSelect=!1,n.push(a)}g.mailAccounts=n})}else{var t=[],a=null;g.schedule&&(a=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)}));for(var i=0;i<g.mailAccounts.length;i++)a&&g.mailAccounts[i].id===a.id&&(g.mailAccounts[i].canSelect=!1,t.push(g.mailAccounts[i]));g.mailAccounts=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","schedules","schedule","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditScheduleDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.schedules=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="schedules",f.listOrder="",f.listOrderAsc=null,f.selectedScheduler=[],f.query={fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,page:1},f.arrayoutput=_.keyBy([{option:"CSV",value:"'csv'"},{option:"PDF",value:"'pdf'"},{option:"Excel",value:"'xlsx'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysubtractUnit=_.keyBy([{option:"Minutes",value:"'minutes'"},{option:"Hours",value:"'hours'"},{option:"Days",value:"'days'"},{option:"Weeks",value:"'weeks'"},{option:"Months",value:"'months'"},{option:"Quarters",value:"'quarters'"},{option:"Years",value:"'years'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{schedule:e,schedules:f.schedules.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.runconfirm=function(e,n){var t=i.confirm().title("Are you sure want to run the schedule?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be run.").ariaLabel("delete schedule").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){return m.schedule.run({id:e.id}).$promise},function(){console.log("CANCEL")})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("schedule")+"?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be deleted.").ariaLabel("delete schedule").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getScheduler=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.schedule.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Scheduler",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSchedule=function(e,n){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{schedule:n,schedules:f.schedules.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSchedule=y,f.exportSelectedScheduler=function(){var e=angular.copy(f.selectedScheduler);return f.selectedScheduler=[],e},f.deleteSelectedScheduler=function(e){var n=i.confirm().title("Are you sure want to delete the selected schedules?").htmlContent("<b>"+f.selectedScheduler.length+" selected</b> will be deleted.").ariaLabel("delete Schedules").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedScheduler.forEach(function(e){y(e)}),f.selectedScheduler=[]})},f.deselectScheduler=function(){f.selectedScheduler=[]},f.selectAllScheduler=function(){f.selectedScheduler=f.schedules.rows},m.analyticTreeReport.get({}).$promise.then(function(e){f.treeReports=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.mailAccounts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.mailAccounts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.mailAccounts,{id:e.resourceId})}),t=null;if(f.schedule&&(t=_.find(f.mailAccounts,{id:Number(f.schedule.MailAccountId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.mailAccounts,{id:t.id});a.canSelect=!1,n.push(a)}f.mailAccounts=n})}else{var t=[],a=null;f.schedule&&(a=_.find(f.mailAccounts,{id:Number(f.schedule.MailAccountId)}));for(var i=0;i<f.mailAccounts.length;i++)a&&f.mailAccounts[i].id===a.id&&(f.mailAccounts[i].canSelect=!1,t.push(f.mailAccounts[i]));f.mailAccounts=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.schedules=e||{count:0,rows:[]}}function y(e){m.schedule.delete({id:e.id}).$promise.then(function(){_.remove(f.schedules.rows,{id:e.id}),f.schedules.count-=1,f.schedules.rows.length||f.getScheduler(),p.success({title:_.startCase("Schedule")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEschedule"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEschedule",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getScheduler())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","schedules","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("SchedulesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_SOUND",g.sound=angular.copy(l),g.sounds=r,g.newSound=!1,g.sound||(g.sound={},g.title="TOOLS.NEW_SOUND",g.newSound=!0),g.addNewSound=function(){g.errors=[],d.sound.save(g.sound).$promise.then(function(e){g.sounds.unshift(e.toJSON()),o.success({title:"Sound properly created",msg:g.sound.name?g.sound.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSound=function(){g.errors=[],d.sound.update({id:g.sound.id},g.sound).$promise.then(function(e){var n=_.find(g.sounds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Sound properly saved!",msg:g.sound.name?g.sound.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSound=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sound will be deleted.").ariaLabel("Delete Sound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.sound.delete({id:g.sound.id}).$promise.then(function(){_.remove(g.sounds,{id:g.sound.id}),o.success({title:"Sound properly deleted!",msg:(g.sound.name||"sound")+" has been deleted!"}),v(g.sound)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","sounds","sound","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.sounds=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="sounds",f.listOrder="",f.listOrderAsc=null,f.selectedSounds=[],f.query={fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{sound:e,sounds:f.sounds.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.downloadfile2=function(s,e){return m.sound.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.converted_format?s.save_name+"."+s.converted_format:s.save_name;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("sound")+"?").htmlContent("<b>"+(e.name||"sound")+"</b> will be deleted.").ariaLabel("delete sound").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSounds=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.sound.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Sounds",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSound=function(e,n){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sound:n,sounds:f.sounds.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSound=y,f.exportSelectedSounds=function(){var e=angular.copy(f.selectedSounds);return f.selectedSounds=[],e},f.deleteSelectedSounds=function(e){var n=i.confirm().title("Are you sure want to delete the selected sounds?").htmlContent("<b>"+f.selectedSounds.length+" selected</b> will be deleted.").ariaLabel("delete Sounds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSounds.forEach(function(e){y(e)}),f.selectedSounds=[]})},f.deselectSounds=function(){f.selectedSounds=[]},f.selectAllSounds=function(){f.selectedSounds=f.sounds.rows},f.uploadSound=function(e){i.show({controller:"UploadSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/upload/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sounds:f.sounds.rows}})};var b=!0,A=1;function E(e){f.sounds=e||{count:0,rows:[]}}function y(e){m.sound.delete({id:e.id}).$promise.then(function(){_.remove(f.sounds.rows,{id:e.id}),f.sounds.count-=1,f.sounds.rows.length||f.getSounds(),p.success({title:_.startCase("Sound")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsound"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsound",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSounds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sounds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("SoundsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this,r=15,l=1024*r*1024;o.currentUser=s.getCurrentUser(),o.errors=[],o.title="TOOLS.UPLOAD_SOUND",o.sounds=a,o.uploadSounds=[],o.uploadState="none",o.sound={},o.ngFlowOptions={maxChunkRetries:1,chunkSize:l,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0,target:"api/sounds"},o.ngFlow={flow:{}},o.dropping=!1,o.fileAdded=function(e){var n=["wav","mp3","gsm"];if(!_.includes(n,e.getExtension()))return t.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>l)return t.error({title:"File too big",msg:"The max allowed size is "+r+"MB"}),!1;return o.sound={id:e.uniqueIdentifier,file:e},o.uploadSounds.unshift(o.sound),!0},o.upload=function(){o.uploadState="uploading",o.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},o.ngFlow.flow.opts.query={role:o.currentUser.role,userProfileId:o.currentUser.userProfileId},o.ngFlow.flow.upload()},o.fileSuccess=function(a,e){o.sounds.unshift(JSON.parse(e)),angular.forEach(o.uploadSounds,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result}}})},o.uploadError=function(e,n){o.ngFlow.flow.cancel(),t.error({title:"Upload error",msg:"Cannot upload the sound"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",t.success({title:"Upload completed",msg:o.sound.file.name+" uploaded successfully"}))},o.closeDialog=function(){n.hide()}}e.$inject=["$cookies","$mdDialog","toasty","sounds","api","Auth"],angular.module("app.tools").controller("UploadSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TAG",g.tag=angular.copy(l),g.tags=r,g.newTag=!1,g.tag||(g.tag={},g.title="TOOLS.NEW_TAG",g.newTag=!0),g.addNewTag=function(){g.errors=[],d.tag.save(g.tag).$promise.then(function(e){g.tags.unshift(e.toJSON()),o.success({title:"Tag properly created",msg:g.tag.name?g.tag.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTag=function(){g.errors=[],d.tag.update({id:g.tag.id},g.tag).$promise.then(function(e){var n=_.find(g.tags,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Tag properly saved!",msg:g.tag.name?g.tag.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTag=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The tag will be deleted.").ariaLabel("Delete Tag").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.tag.delete({id:g.tag.id}).$promise.then(function(){_.remove(g.tags,{id:g.tag.id}),o.success({title:"Tag properly deleted!",msg:(g.tag.name||"tag")+" has been deleted!"}),v(g.tag)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","tags","tag","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTagDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.tags=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="tags",f.listOrder="",f.listOrderAsc=null,f.selectedTags=[],f.query={fields:"createdAt,updatedAt,id,name,description,color",sort:"name,-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{tag:e,tags:f.tags.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("tag")+"?").htmlContent("<b>"+(e.name||"tag")+"</b> will be deleted.").ariaLabel("delete tag").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTags=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.tag.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Tags",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTag=function(e,n){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{tag:n,tags:f.tags.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTag=y,f.exportSelectedTags=function(){var e=angular.copy(f.selectedTags);return f.selectedTags=[],e},f.deleteSelectedTags=function(e){var n=i.confirm().title("Are you sure want to delete the selected tags?").htmlContent("<b>"+f.selectedTags.length+" selected</b> will be deleted.").ariaLabel("delete Tags").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTags.forEach(function(e){y(e)}),f.selectedTags=[]})},f.deselectTags=function(){f.selectedTags=[]},f.selectAllTags=function(){f.selectedTags=f.tags.rows};var b=!0,A=1;function E(e){f.tags=e||{count:0,rows:[]}}function y(e){m.tag.delete({id:e.id}).$promise.then(function(){_.remove(f.tags.rows,{id:e.id}),f.tags.count-=1,f.tags.rows.length||f.getTags(),p.success({title:_.startCase("Tag")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtag"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtag",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTags())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","tags","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TagsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TEMPLATE",g.template=angular.copy(l),g.templates=r,g.newTemplate=!1,g.template||(g.template={},g.title="TOOLS.NEW_TEMPLATE",g.newTemplate=!0),g.addNewTemplate=function(){g.errors=[],d.template.save(g.template).$promise.then(function(e){g.templates.unshift(e.toJSON()),o.success({title:"Template properly created",msg:g.template.name?g.template.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTemplate=function(){g.errors=[],d.template.update({id:g.template.id},g.template).$promise.then(function(e){var n=_.find(g.templates,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Template properly saved!",msg:g.template.name?g.template.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTemplate=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The template will be deleted.").ariaLabel("Delete Template").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.template.delete({id:g.template.id}).$promise.then(function(){_.remove(g.templates,{id:g.template.id}),o.success({title:"Template properly deleted!",msg:(g.template.name||"template")+" has been deleted!"}),v(g.template)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","templates","template","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTemplateDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.templates=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="templates",f.listOrder="",f.listOrderAsc=null,f.selectedTemplates=[],f.query={fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{template:e,templates:f.templates.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("template")+"?").htmlContent("<b>"+(e.name||"template")+"</b> will be deleted.").ariaLabel("delete template").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTemplates=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.template.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Templates",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTemplate=function(e,n){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{template:n,templates:f.templates.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTemplate=y,f.exportSelectedTemplates=function(){var e=angular.copy(f.selectedTemplates);return f.selectedTemplates=[],e},f.deleteSelectedTemplates=function(e){var n=i.confirm().title("Are you sure want to delete the selected templates?").htmlContent("<b>"+f.selectedTemplates.length+" selected</b> will be deleted.").ariaLabel("delete Templates").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTemplates.forEach(function(e){y(e)}),f.selectedTemplates=[]})},f.deselectTemplates=function(){f.selectedTemplates=[]},f.selectAllTemplates=function(){f.selectedTemplates=f.templates.rows};var b=!0,A=1;function E(e){f.templates=e||{count:0,rows:[]}}function y(e){m.template.delete({id:e.id}).$promise.then(function(){_.remove(f.templates.rows,{id:e.id}),f.templates.count-=1,f.templates.rows.length||f.getTemplates(),p.success({title:_.startCase("Template")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtemplate"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtemplate",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTemplates())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","templates","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TemplatesController",e)}(),function(){"use strict";function e(t,a,i,e,n,s,o,r,l,d){var c=this;function m(e){t.hide(e)}c.currentUser=o.getCurrentUser(),c.trigger=angular.copy(n),c.triggers=angular.copy(e),c.setting=l,c.license=r,c.crudPermissions=d,c.newTrigger=!1,c.errors=[],c.trigger||(c.trigger={channel:"voice"},c.newTrigger=!0),c.addNewTrigger=function(){c.errors=[],s.trigger.save(c.trigger).$promise.then(function(e){c.triggers.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_CREATED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveTrigger=function(){c.errors=[],s.trigger.update({id:c.trigger.id},c.trigger).$promise.then(function(){c.triggers=_.map(c.triggers,function(e){return e.id===c.trigger.id?c.trigger:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_SAVED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteTrigger=function(e){c.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_MESSAGE",{name:c.trigger.name})).ariaLabel("Delete trigger").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){s.trigger.delete({id:c.trigger.id}).$promise.then(function(){c.triggers=_.filter(c.triggers,function(e){return e.id!==c.trigger.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},c.closeDialog=m}e.$inject=["$mdDialog","$translate","toasty","triggers","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTriggerDialogController",e)}(),function(){"use strict";function e(e,a,n,i,t,s,o,r){var l=this;function d(){_.some(l.triggerActions.rows,["action","contactManager"])&&(l.lists||(r.isAdmin()?o.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.lists=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.lists=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.lists,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var n=_.find(l.lists,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.lists,{id:e.id});n.canSelect=!1,t.push(n)}}),l.lists=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var n=_.find(l.lists,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<l.lists.length;i++)_.some(a,{id:l.lists[i].id})&&(l.lists[i].canSelect=!1,t.push(l.lists[i]));l.lists=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(l.triggerActions.rows,["action","integration"])&&_(l.triggerActions.rows).map(function(e){return"integration"===e.action?e.data1:void 0}).compact().uniq().value().forEach(function(e){var n=e+"Accounts";if(!l[n]){var t="int"+_.startCase(e)+"Account";o[t.replace(/\s+/g,"")].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l[n]=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+n.toUpperCase()+"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}),_.some(l.triggerActions.rows,function(e){return _.includes(["motionbar","browser"],e.action)})&&(l.templates||(r.isAdmin()?o.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l.templates=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l.templates=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.templates,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(l.templates,{id:Number(e.data2)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.templates,{id:e.id});n.canSelect=!1,t.push(n)}}),l.templates=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(l.templates,{id:Number(e.data2)});a.push(n)}});for(var i=0;i<l.templates.length;i++)_.some(a,{id:l.templates[i].id})&&(l.templates[i].canSelect=!1,t.push(l.templates[i]));l.templates=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(l.triggerActions.rows,["action","jscripty"])&&(l.projects||(r.isAdmin()?o.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.projects=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.projects=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.projects,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var n=_.find(l.projects,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),l.projects=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var n=_.find(l.projects,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<l.projects.length;i++)_.some(a,{id:l.projects[i].id})&&(l.projects[i].canSelect=!1,t.push(l.projects[i]));l.projects=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})))}function c(e){l.triggerActions=e||{count:0,rows:[]},d()}function m(){l.query.offset=(l.query.page-1)*l.query.limit,l.promise=o.trigger.getActions(l.query,c).$promise}function u(e,n){o.action.delete({id:e.id}).$promise.then(function(){m(),n&&s.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}l.currentUser=r.getCurrentUser(),l.trigger={},l.triggerActions={count:0,rows:[]},l.selectedTriggerActions=[],l.query={fields:"id,action,contact,data1,data2,data3,data4,data5,data6,data7,createdAt,updatedAt",limit:10,page:1},l.integrationTypes={zendesk:"Zendesk",salesforce:"Salesforce",sugarcrm:"SugarCRM",freshdesk:"Freshdesk",desk:"Desk",zoho:"Zoho",vtiger:"vTiger",dynamics365:"Dynamics365",servicenow:"ServiceNow",freshsales:"Freshsales"},l.motionBarOptions={0:"Popup",1:"CTI URL",2:"Windows App"},l.onInit=function(e,n){l.trigger=e,l.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},l.query.ActionId=l.trigger.id,l.query.id=l.trigger.id,m()},l.success=c,l.getTriggerActions=m,l.createOrEditTriggerAction=function(e,n){i.show({controller:"CreateOrEditActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/actions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:l.trigger,action:n,actions:l.triggerActions.rows,license:null,setting:null,crudPermissions:l.crudPermissions}}).then(function(e){e&&(l.triggerActions={count:e.length,rows:e},d())})},l.exportSelectedTriggerActions=function(){var e=angular.copy(l.selectedTriggerActions);return l.selectedTriggerActions=[],e},l.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETE_TITLE")).ariaLabel("Delete action").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){u(e,!0)})},l.deleteSelectedTriggerActions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETE_MESSAGE",{total:l.selectedTriggerActions.length})).ariaLabel("Delete actions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){l.selectedTriggerActions.forEach(function(e){u(e)}),l.selectedTriggerActions=[],s.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerActionsController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r,l,d,c,m){var u=this;function p(){return new Promise(function(n,t){l.hasSectionsPermissions([1301,1302,1303,1304,1305,1306,1307,1308,1309,1310]).then(function(e){u.hasSectionPermissions=_.merge(u.hasSectionPermissions,e),n(u.hasSectionPermissions)}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SECTIONS_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()}),t()})})}function g(){r.cmList.getCustomFields({id:u.action.data1,ListId:u.action.data1}).$promise.then(function(e){u.listFields=_.filter(e.rows,["type","text"]),u.listFields.forEach(function(e){e.columnName="cf_"+e.id})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LIST_CUSTOM_FIELDS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function v(){l.isAdmin()?r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.templates=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.templates=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.templates,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(u.templates,{id:Number(e.data2)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.templates,{id:e.id});n.canSelect=!1,t.push(n)}}),u.templates=t})}else{var t=[],a=[];u.actions.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(u.templates,{id:Number(e.data2)});a.push(n)}});for(var i=0;i<u.templates.length;i++){_.some(a,{id:u.templates[i].id})&&(u.templates[i].canSelect=!1,t.push(u.templates[i]))}u.templates=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})})}function h(){switch(u.action.action){case"contactManager":u.lists||(l.isAdmin()?r.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.lists=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if("contactManager"===e.action){var n=_.find(u.lists,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.lists,{id:e.id});n.canSelect=!1,t.push(n)}}),u.lists=t})}else{var t=[],a=[];u.actions.forEach(function(e){if("contactManager"===e.action){var n=_.find(u.lists,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<u.lists.length;i++)_.some(a,{id:u.lists[i].id})&&(u.lists[i].canSelect=!1,t.push(u.lists[i]));u.lists=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})),u.contactFields||r.cmContact.describe({}).$promise.then(function(e){u.contactFields=[],u.customFields=[];for(var n=_.values(e.toJSON()),t=0;t<n.length;t++)_.includes(u.allowedStandardFields,n[t].columnName)?u.contactFields.push(n[t]):_.startsWith(n[t].columnName,"cf_")&&"text"===n[t].custom.type&&u.customFields.push(n[t])}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE_CM_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})}),u.action.data3=u.action.data3?u.action.data3.split(","):["phone"],"1"!==u.action.data2||u.action.data4||(u.action.data4="phone");break;case"jscripty":u.projects||(l.isAdmin()?r.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if("jscripty"===e.action){var n=_.find(u.projects,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),u.projects=t})}else{var t=[],a=[];u.actions.forEach(function(e){if("jscripty"===e.action){var n=_.find(u.projects,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<u.projects.length;i++)_.some(a,{id:u.projects[i].id})&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"urlForward":u.action.data5||(u.action.data5=5)}}function f(){u.editAccount||(u.action.data2=void 0,u.action.data3=void 0),u.action.isIntegrationDisabled=!u.newAction&&!function(){switch(u.action.data1){case"zendesk":return u.hasSectionPermissions[1301];case"salesforce":return u.hasSectionPermissions[1302];case"sugarcrm":return u.hasSectionPermissions[1305];case"freshdesk":return u.hasSectionPermissions[1303];case"desk":return u.hasSectionPermissions[1306];case"zoho":return u.hasSectionPermissions[1307];case"vtiger":return u.hasSectionPermissions[1308];case"dynamics365":return u.hasSectionPermissions[1309];case"servicenow":return u.hasSectionPermissions[1310];case"freshsales":return u.hasSectionPermissions[1304]}}();var e="int"+_.capitalize(u.action.data1)+"Account";r[e].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.accounts=e.rows||[],u.editAccount=!1}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.action.data1.toUpperCase()+"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){u.action.data3=u.action.data3?u.action.data3:void 0;var e="int"+_.capitalize(u.action.data1)+"Configuration";r[e].get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){u.configurations=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.action.data1.toUpperCase()+"CONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function A(){var e=angular.copy(u.action);return _.isArray(e.data3)&&(e.data3=u.action.data3.join(",")),e}function E(e){t.hide(e)}u.currentUser=l.getCurrentUser(),void 0!==s&&"urlForward"===s.action&&s.data5&&(s.data5=parseInt(s.data5)),u.action=angular.copy(s),u.actions=angular.copy(e),u.setting=c,u.license=d,u.crudPermissions=m,u.newAction=!1,u.errors=[],u.trigger=angular.copy(o),u.action?function(){switch(u.editAccount=!0,u.action.action){case"integration":return new Promise(function(e){e(p())}).then(function(){return u.editAccount||(u.action.data2=void 0,u.action.data3=void 0,h()),f()}).then(function(){return b()});case"motionbar":case"browser":v()}u.editAccount=!1}():(u.action={},u.newAction=!0),u.action.ActionId=n.params.id||void 0,u.allowedStandardFields=["phone","mobile","fax"],u.addNewAction=function(){u.errors=[];var e=A();r.trigger.addAction({id:n.params.id},e).$promise.then(function(e){u.actions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_CREATED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},u.saveAction=function(){u.errors=[];var n=A();r.action.update({id:n.id},n).$promise.then(function(){u.actions=_.map(u.actions,function(e){return e.id===n.id?n:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_SAVED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},u.deleteAction=function(e){u.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETE_TITLE")).ariaLabel("Delete action").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){r.action.delete({id:u.action.id}).$promise.then(function(){u.actions=_.filter(u.actions,function(e){return e.id!==u.action.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},u.onActionInit=function(){l.hasModulePermissions("Integrations").then(function(e){u.hasIntegrationsPermissions=e}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MODULE_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),u.action.action&&h()},u.onIntegrationInit=p,u.onSearchFieldsInit=function(){u.newAction||g()},u.onActionSelection=function(){u.newAction&&(u.action.data1=void 0,u.action.data2=void 0,u.action.data3=void 0,u.action.data4=void 0,u.action.data5="urlForward"===u.action.action?5:void 0,h())},u.onIntegrationSelection=f,u.onListSelection=function(){g()},u.onTypeSelection=function(){"0"!==u.action.data1||u.templates?(u.action.data2=void 0,u.action.data4="1"===u.action.data1?0:void 0):v()},u.onAutocreateSelection=function(){"0"===u.action.data2&&(u.action.data4=void 0);u.action.data4||"1"!==u.action.data2||(u.action.data4="phone")},u.onIntegrationAccountSelection=b,u.closeDialog=E,u.onActionLocationChange=function(){u.editAccount||(u.action.data5=void 0,u.action.data6=void 0)}}e.$inject=["$state","$mdDialog","$translate","toasty","actions","action","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditActionDialogController",e)}(),function(){"use strict";function e(e,l,a,n,i,t,d,c,m){var u=this;function s(){var o,r;"voice"===u.trigger.channel?(_.some(u.allConditions.rows,["field","queue"])&&(u.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,m.isAdmin()?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u.queues=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(c.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];u.allConditions.rows.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),u.queues=t}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.allConditions.rows,["field","routeId"])&&(u.outboundRoutes||(m.isAdmin()?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.outboundRoutes,{id:e.resourceId})}),a=null;a=[],u.triggerAllConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),u.outboundRoutes=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<u.outboundRoutes.length;i++)_.some(a,{id:u.outboundRoutes[i].id})&&(u.outboundRoutes[i].canSelect=!1,t.push(u.outboundRoutes[i]));u.outboundRoutes=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.allConditions.rows,["field","agent"])&&(u.agents||(m.isAdmin()?c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.agents,{id:e.resourceId})}),a=null;a=[],u.triggerAllConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),u.agents=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}});for(var i=0;i<u.agents.length;i++)_.some(a,{id:u.agents[i].id})&&(u.agents[i].canSelect=!1,t.push(u.agents[i]));u.agents=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))):("mail"===u.trigger.channel&&c.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.mailSubstatuses=e.rows||[]}).catch(function(){d.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})}),function(){var e,s=u.trigger.channel+("chat"===u.trigger.channel?"Websites":"Accounts"),n=u.trigger.channel+("chat"===u.trigger.channel?"Website":"Account");switch(u.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}m.isAdmin()?c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u[s],{id:e.resourceId})}),a=null;a=[],u.allConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u[s],{id:e.id});n.canSelect=!1,t.push(n)}}),u[s]=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}});for(var i=0;i<u[s].length;i++)_.some(a,{id:u[s][i].id})&&(u[s][i].canSelect=!1,t.push(u[s][i]));u[s]=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}())}function o(e){u.allConditions=e||{count:0,rows:[]},s()}function r(){u.query.offset=(u.query.page-1)*u.query.limit,u.promise=c.trigger.getAllConditions(u.query,o).$promise}function p(e,n){c.condition.delete({id:e.id}).$promise.then(function(){r(),n&&d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}u.currentUser=m.getCurrentUser(),u.trigger={},u.allConditions={count:0,rows:[]},u.selectedAllConditions=[],u.query={fields:"id,field,operator,value,createdAt,updatedAt",limit:10,page:1},u.fields={queue:"Queue",lastevent:"Call_Status",routeId:"OutboundRoute",agent:"Agent",account:"Account",interaction:"Interaction",message:"Message",mailSubstatus:"Mail_Substatus",offlineMessage:"Offline_Message"},u.callStatuses={abandoned:"Abandon",timeout:"Timeout",complete:"Hangup",rejected:"Reject",called:"Ring",connect:"Answer",nosuchnumber:"NoSuchNumber",busy:"Busy",noanswer:"NoAnswer",congestion:"Congestion",agentreject:"AgentReject",amd:"AMD"},u.messageStatuses={in:"Incoming",out:"Outgoing",accept:"Accepted",reject:"Rejected"},u.onInit=function(e,n){u.trigger=e,u.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},u.query.TriggerAllId=u.trigger.id,u.query.id=u.trigger.id,r()},u.success=o,u.getAllConditions=r,u.createOrEditAllCondition=function(e,n){i.show({controller:"CreateOrEditAllConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/allconditions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:u.trigger,allCondition:n,allConditions:u.allConditions.rows,license:null,setting:null,crudPermissions:u.crudPermissions}}).then(function(e){e&&(u.allConditions={count:e.length,rows:e},s())})},u.exportSelectedAllConditions=function(){var e=angular.copy(u.selectedAllConditions);return u.selectedAllConditions=[],e},u.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){p(e,!0)})},u.deleteSelectedAllConditions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_MESSAGE",{total:u.selectedAllConditions.length})).ariaLabel("Delete conditions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){u.selectedAllConditions.forEach(function(e){p(e)}),u.selectedAllConditions=[],d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAllConditionsController",e)}(),function(){"use strict";function e(e,t,l,a,i,n,s,o,d,c,r,m,u){var p=this;function g(){switch(p.allCondition.field){case"queue":p.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,c.isAdmin()?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){p.queues=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];p.allConditions.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),p.queues=t}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"routeId":p.outboundRoutes||(c.isAdmin()?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.outboundRoutes,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),p.outboundRoutes=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.outboundRoutes.length;i++)_.some(a,{id:p.outboundRoutes[i].id})&&(p.outboundRoutes[i].canSelect=!1,t.push(p.outboundRoutes[i]));p.outboundRoutes=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"agent":p.agents||(c.isAdmin()?d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.agents,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),p.agents=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}});for(var i=0;i<p.agents.length;i++)_.some(a,{id:p.agents[i].id})&&(p.agents[i].canSelect=!1,t.push(p.agents[i]));p.agents=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"account":!function(){var e,n=p.trigger.channel+("chat"===p.trigger.channel?"Website":"Account");switch(p.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}c.isAdmin()?d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.accounts,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.accounts,{id:e.id});n.canSelect=!1,t.push(n)}}),p.accounts=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.accounts.length;i++)_.some(a,{id:p.accounts[i].id})&&(p.accounts[i].canSelect=!1,t.push(p.accounts[i]));p.accounts=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}();break;case"mailSubstatus":d.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){p.mailSubstatuses=e.rows||[]}).catch(function(){i.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})})}var o,r}function v(e){t.hide(e)}p.currentUser=c.getCurrentUser(),p.allCondition=angular.copy(s),p.allConditions=angular.copy(n),p.setting=m,p.license=r,p.crudPermissions=u,p.hasModulePermissions={},p.newAllCondition=!1,p.errors=[],p.trigger=angular.copy(o),p.allCondition?g():(p.allCondition={operator:"equals"},p.newAllCondition=!0),p.allCondition.TriggerAllId=e.params.id||void 0,p.callStatuses=[{name:"Abandon",value:"abandoned"},{name:"Timeout",value:"timeout"},{name:"Hangup",value:"complete"},{name:"Reject",value:"rejected"},{name:"Ring",value:"called"},{name:"Answer",value:"connect"},{name:"NoSuchNumber",value:"nosuchnumber"},{name:"Busy",value:"busy"},{name:"NoAnswer",value:"noanswer"},{name:"Congestion",value:"congestion"},{name:"AgentReject",value:"agentreject"},{name:"AMD",value:"amd"}],p.onFieldSelection=function(){p.allCondition.value=void 0,g()},p.addNewAllCondition=function(){p.errors=[],d.trigger.addAllCondition({id:e.params.id},p.allCondition).$promise.then(function(e){p.allConditions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_CREATED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveAllCondition=function(){p.errors=[],d.condition.update({id:p.allCondition.id},p.allCondition).$promise.then(function(){p.allConditions=_.map(p.allConditions,function(e){return e.id===p.allCondition.id?p.allCondition:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_SAVED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteAllCondition=function(e){p.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){d.condition.delete({id:p.allCondition.id}).$promise.then(function(){p.allConditions=_.filter(p.allConditions,function(e){return e.id!==p.allCondition.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.closeDialog=v}e.$inject=["$state","$mdDialog","$q","$translate","toasty","allConditions","allCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAllConditionDialogController",e)}(),function(){"use strict";function e(e,l,a,n,i,t,d,c,m){var u=this;function s(){var o,r;"voice"===u.trigger.channel?(_.some(u.anyConditions.rows,["field","queue"])&&(u.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,m.isAdmin()?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u.queues=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(c.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),u.queues=t}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.anyConditions.rows,["field","routeId"])&&(u.outboundRoutes||(m.isAdmin()?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.outboundRoutes,{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),u.outboundRoutes=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<u.outboundRoutes.length;i++)_.some(a,{id:u.outboundRoutes[i].id})&&(u.outboundRoutes[i].canSelect=!1,t.push(u.outboundRoutes[i]));u.outboundRoutes=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.anyConditions.rows,["field","agent"])&&(u.agents||(m.isAdmin()?c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.agents,{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),u.agents=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}});for(var i=0;i<u.agents.length;i++)_.some(a,{id:u.agents[i].id})&&(u.agents[i].canSelect=!1,t.push(u.agents[i]));u.agents=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))):("mail"===u.trigger.channel&&c.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.mailSubstatuses=e.rows||[]}).catch(function(){d.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})}),function(){var e,s=u.trigger.channel+("chat"===u.trigger.channel?"Websites":"Accounts"),n=u.trigger.channel+("chat"===u.trigger.channel?"Website":"Account");switch(u.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}m.isAdmin()?c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u[s],{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u[s],{id:e.id});n.canSelect=!1,t.push(n)}}),u[s]=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}});for(var i=0;i<u[s].length;i++)_.some(a,{id:u[s][i].id})&&(u[s][i].canSelect=!1,t.push(u[s][i]));u[s]=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}())}function o(e){u.anyConditions=e||{count:0,rows:[]},s()}function r(){u.query.offset=(u.query.page-1)*u.query.limit,u.promise=c.trigger.getAnyConditions(u.query,o).$promise}function p(e,n){c.condition.delete({id:e.id}).$promise.then(function(){r(),n&&d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}u.currentUser=m.getCurrentUser(),u.trigger={},u.anyConditions={count:0,rows:[]},u.selectedAnyConditions=[],u.query={fields:"id,field,operator,value,createdAt,updatedAt",limit:10,page:1},u.fields={queue:"Queue",lastevent:"Call_Status",routeId:"OutboundRoute",agent:"Agent",account:"Account",interaction:"Interaction",message:"Message",mailSubstatus:"Mail_Substatus",offlineMessage:"Offline_Message"},u.callStatuses={abandoned:"Abandon",timeout:"Timeout",complete:"Hangup",rejected:"Reject",called:"Ring",connect:"Answer",nosuchnumber:"NoSuchNumber",busy:"Busy",noanswer:"NoAnswer",congestion:"Congestion",agentreject:"AgentReject",amd:"AMD"},u.messageStatuses={in:"Incoming",out:"Outgoing",accept:"Accepted",reject:"Rejected"},u.onInit=function(e,n){u.trigger=e,u.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},u.query.TriggerAnyId=u.trigger.id,u.query.id=u.trigger.id,r()},u.success=o,u.getAnyConditions=r,u.createOrEditAnyCondition=function(e,n){i.show({controller:"CreateOrEditAnyConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/anyconditions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:u.trigger,anyCondition:n,anyConditions:u.anyConditions.rows,license:null,setting:null,crudPermissions:u.crudPermissions}}).then(function(e){e&&(u.anyConditions={count:e.length,rows:e},s())})},u.exportSelectedAnyConditions=function(){var e=angular.copy(u.selectedAnyConditions);return u.selectedAnyConditions=[],e},u.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){p(e,!0)})},u.deleteAnyCondition=p,u.deleteSelectedAnyConditions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_MESSAGE",{total:u.selectedAnyConditions.length})).ariaLabel("Delete conditions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){u.selectedAnyConditions.forEach(function(e){p(e)}),u.selectedAnyConditions=[],d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAnyConditionsController",e)}(),function(){"use strict";function e(e,t,l,a,i,n,s,o,d,c,r,m,u){var p=this;function g(){switch(p.anyCondition.field){case"queue":p.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,c.isAdmin()?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){p.queues=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];p.anyConditions.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),p.queues=t}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"routeId":p.outboundRoutes||(c.isAdmin()?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.outboundRoutes,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),p.outboundRoutes=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.outboundRoutes.length;i++)_.some(a,{id:p.outboundRoutes[i].id})&&(p.outboundRoutes[i].canSelect=!1,t.push(p.outboundRoutes[i]));p.outboundRoutes=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"agent":p.agents||(c.isAdmin()?d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.agents,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),p.agents=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}});for(var i=0;i<p.agents.length;i++)_.some(a,{id:p.agents[i].id})&&(p.agents[i].canSelect=!1,t.push(p.agents[i]));p.agents=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"account":!function(){var e,n=p.trigger.channel+("chat"===p.trigger.channel?"Website":"Account");switch(p.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}c.isAdmin()?d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.accounts,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.accounts,{id:e.id});n.canSelect=!1,t.push(n)}}),p.accounts=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.accounts.length;i++)_.some(a,{id:p.accounts[i].id})&&(p.accounts[i].canSelect=!1,t.push(p.accounts[i]));p.accounts=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}();break;case"mailSubstatus":d.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){p.mailSubstatuses=e.rows||[]}).catch(function(){i.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})})}var o,r}function v(e){t.hide(e)}p.currentUser=c.getCurrentUser(),p.anyCondition=angular.copy(s),p.anyConditions=angular.copy(n),p.setting=m,p.license=r,p.crudPermissions=u,p.hasModulePermissions={},p.newAnyCondition=!1,p.errors=[],p.trigger=angular.copy(o),p.anyCondition?g():(p.anyCondition={operator:"equals"},p.newAnyCondition=!0),p.anyCondition.TriggerAnyId=e.params.id||void 0,p.callStatuses=[{name:"Abandon",value:"abandoned"},{name:"Timeout",value:"timeout"},{name:"Hangup",value:"complete"},{name:"Reject",value:"rejected"},{name:"Ring",value:"called"},{name:"Answer",value:"connect"},{name:"NoSuchNumber",value:"nosuchnumber"},{name:"Busy",value:"busy"},{name:"NoAnswer",value:"noanswer"},{name:"Congestion",value:"congestion"},{name:"AgentReject",value:"agentreject"},{name:"AMD",value:"amd"}],p.onFieldSelection=function(){p.anyCondition.value=void 0,g()},p.addNewAnyCondition=function(){p.errors=[],d.trigger.addAnyCondition({id:e.params.id},p.anyCondition).$promise.then(function(e){p.anyConditions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_CREATED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveAnyCondition=function(){p.errors=[],d.condition.update({id:p.anyCondition.id},p.anyCondition).$promise.then(function(){p.anyConditions=_.map(p.anyConditions,function(e){return e.id===p.anyCondition.id?p.anyCondition:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_SAVED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteAnyCondition=function(e){p.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){d.condition.delete({id:p.anyCondition.id}).$promise.then(function(){p.anyConditions=_.filter(p.anyConditions,function(e){return e.id!==p.allCondition.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.closeDialog=v}e.$inject=["$state","$mdDialog","$q","$translate","toasty","anyConditions","anyCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAnyConditionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;d.currentUser=o.getCurrentUser(),d.license=t,d.setting=a,d.trigger=r||e.params.trigger||{},d.selectedTab=e.params.tab||0,e.params.crudPermissions?d.crudPermissions=e.params.crudPermissions:(d.userProfileSection=l&&1==l.count?l.rows[0]:null,d.crudPermissions=o.parseCrudPermissions(d.userProfileSection?d.userProfileSection.crudPermissions:null)),d.gotoTriggers=function(){e.go("app.tools.triggers",{},{reload:"app.tools.triggers"})},d.saveTrigger=function(){i.trigger.update({id:d.trigger.id},d.trigger).$promise.then(function(){s.success({title:n.instant("TOOLS.NOTIFICATIONS.TRIGGER_SAVED_SUCCESS_TITLE")})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$translate","license","setting","api","toasty","Auth","trigger","userProfileSection"],angular.module("app.tools").controller("TriggerController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){n.go("app.tools.triggers.edit",{id:e.id,trigger:e,crudPermissions:g.crudPermissions})}function h(e){g.triggers=e||{count:0,rows:[]}}function f(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.trigger.get(g.query,h).$promise:(g.query.id=g.userProfile.id,g.query.section="Triggers",g.promise=d.userProfile.getResources(g.query,h).$promise)}function b(e,n){d.trigger.delete({id:e.id}).$promise.then(function(){f(),n&&c.success({title:s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrigger"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.triggers=o||{count:0,rows:[]},g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedTriggers=[],g.query={fields:"id,name,channel,status,description,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},g.goToEditState=v,g.createOrEditTrigger=function(e,n){if(g.crudPermissions.readOnly||g.crudPermissions.canDelete&&!g.crudPermissions.canEdit)return void v(n);a.show({controller:"CreateOrEditTriggerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:n,triggers:g.triggers.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}}).then(function(e){e&&(g.triggers={count:e.length,rows:e})})},g.success=h,g.getTriggers=f,g.deleteconfirm=function(e,n){var t=a.confirm().title(s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_TITLE")).content(s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_MESSAGE",{name:e.name})).ariaLabel("Delete trigger").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){b(e,!0)})},g.exportSelectedTriggers=function(){var e=angular.copy(g.selectedTriggers);return g.selectedTriggers=[],e},g.deleteSelectedTriggers=function(e){var n=a.confirm().title(s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETE_TITLE")).content(s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETE_MESSAGE",{total:g.selectedTriggers.length})).ariaLabel("Delete triggers").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedTriggers.forEach(function(e){b(e)}),g.selectedTriggers=[],c.success({title:s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETED_SUCCESS_TITLE")})})},g.deselectTriggers=function(){g.selectedTriggers=[]},g.selectAllTriggers=function(){g.selectedTriggers=g.triggers.rows};var A=!0,E=1;e.$watch("vm.query.filter",function(e,n){A?i(function(){A=!1}):(n||(E=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=E),f())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","triggers","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.tools").controller("TriggersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TRUNK",g.trunk=angular.copy(l),g.trunks=r,g.newTrunk=!1,g.trunk||(g.trunk={active:!0,type:"friend",dtmfmode:"rfc2833",qualify:"yes",t38pt_udptl:"no"},g.title="TOOLS.NEW_TRUNK",g.newTrunk=!0),g.addNewTrunk=function(){g.errors=[],d.trunk.save(g.trunk).$promise.then(function(e){g.trunks.unshift(e.toJSON()),o.success({title:"Trunk properly created",msg:g.trunk.name?g.trunk.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTrunk=function(){g.errors=[],d.trunk.update({id:g.trunk.id},g.trunk).$promise.then(function(e){var n=_.find(g.trunks,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Trunk properly saved!",msg:g.trunk.name?g.trunk.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTrunk=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The trunk will be deleted.").ariaLabel("Delete Trunk").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.trunk.delete({id:g.trunk.id}).$promise.then(function(){_.remove(g.trunks,{id:g.trunk.id}),o.success({title:"Trunk properly deleted!",msg:(g.trunk.name||"trunk")+" has been deleted!"}),v(g.trunk)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","trunks","trunk","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTrunkDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newTrunk=!0,r.trunk=angular.copy(i),r.trunks=s,r.title=o.instant("TOOLS.CLONE_TRUNK"),i&&i.name&&(r.title+=": "+i.name),r.cloneTrunk=function(){return e.trunk.clone({id:i.id},r.trunk).$promise.then(function(e){r.trunks.unshift(e.toJSON()),a.success({title:"Trunk properly cloned",msg:r.trunk.name?r.trunk.name+" has been cloned!":""}),t.go("app.tools.trunks.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","trunk","trunks","$translate"],angular.module("app.tools").controller("TrunkcloneController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.trunk=c||t.params.trunk||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.trunks",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.trunks",{})}},u.clonedialog=function(e,n){a.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{trunk:e,trunks:u.trunks?u.trunks.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTrunks=function(){t.go("app.tools.trunks",{},{reload:"app.tools.trunks"})},u.saveTrunk=function(){r.trunk.update({id:u.trunk.id},u.trunk).$promise.then(function(){l.success({title:"Trunk updated!",msg:u.trunk.name?u.trunk.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunk",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.trunk&&(t=_.find(u.contexts,{name:u.trunk.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","trunk","userProfileSection"],angular.module("app.tools").controller("TrunkController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.trunks=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="trunks",f.listOrder="",f.listOrderAsc=null,f.selectedTrunks=[],f.query={fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydtmfmode=_.keyBy([{option:"rfc2833",value:"'rfc2833'"},{option:"info",value:"'info'"},{option:"shortinfo",value:"'shortinfo'"},{option:"inband",value:"'inband'"},{option:"auto",value:"'auto'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayqualify=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g723",value:"'g723'"},{option:"g726",value:"'g726'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"ilbc",value:"'ilbc'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayinsecure=_.keyBy([{option:"port",value:"'port'"},{option:"invite",value:"'invite'"},{option:"very",value:"'very'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydirectmedia=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"nonat",value:"'nonat'"},{option:"update",value:"'update'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraycallcounter=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayusereqphone=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytrustrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysendrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"pai",value:"'pai'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.tools.trunks.edit",{id:e.id,trunk:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{trunk:e,trunks:f.trunks?f.trunks.rows:[],crudPermissions:f.crudPermissions}})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.trunks",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.trunks",{})}},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("trunk")+"?").htmlContent("<b>"+(e.name||"trunk")+"</b> will be deleted.").ariaLabel("delete trunk").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTrunks=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.trunk.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Trunks",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTrunk=function(e,n){i.show({controller:"CreateOrEditTrunkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trunk:n,trunks:f.trunks.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTrunk=y,f.exportSelectedTrunks=function(){var e=angular.copy(f.selectedTrunks);return f.selectedTrunks=[],e},f.deleteSelectedTrunks=function(e){var n=i.confirm().title("Are you sure want to delete the selected trunks?").htmlContent("<b>"+f.selectedTrunks.length+" selected</b> will be deleted.").ariaLabel("delete Trunks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTrunks.forEach(function(e){y(e)}),f.selectedTrunks=[]})},f.deselectTrunks=function(){f.selectedTrunks=[]},f.selectAllTrunks=function(){f.selectedTrunks=f.trunks.rows};var b=!0,A=1;function E(e){f.trunks=e||{count:0,rows:[]}}function y(e){m.trunk.delete({id:e.id}).$promise.then(function(){_.remove(f.trunks.rows,{id:e.id}),f.trunks.count-=1,f.trunks.rows.length||f.getTrunks(),p.success({title:_.startCase("Trunk")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrunk"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrunk",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTrunks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","trunks","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TrunksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_VARIABLE",g.variable=angular.copy(l),g.variables=r,g.newVariable=!1,g.variable||(g.variable={},g.title="TOOLS.NEW_VARIABLE",g.newVariable=!0),g.addNewVariable=function(){g.errors=[],d.variable.save(g.variable).$promise.then(function(e){g.variables.unshift(e.toJSON()),o.success({title:"Variable properly created",msg:g.variable.name?g.variable.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVariable=function(){g.errors=[],d.variable.update({id:g.variable.id},g.variable).$promise.then(function(e){var n=_.find(g.variables,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Variable properly saved!",msg:g.variable.name?g.variable.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVariable=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The variable will be deleted.").ariaLabel("Delete Variable").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.variable.delete({id:g.variable.id}).$promise.then(function(){_.remove(g.variables,{id:g.variable.id}),o.success({title:"Variable properly deleted!",msg:(g.variable.name||"variable")+" has been deleted!"}),v(g.variable)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","variables","variable","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditVariableDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.variables=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="variables",f.listOrder="",f.listOrderAsc=null,f.selectedVariables=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{variable:e,variables:f.variables.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("variable")+"?").htmlContent("<b>"+(e.name||"variable")+"</b> will be deleted.").ariaLabel("delete variable").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVariables=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.variable.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Variables",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVariable=function(e,n){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{variable:n,variables:f.variables.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVariable=y,f.exportSelectedVariables=function(){var e=angular.copy(f.selectedVariables);return f.selectedVariables=[],e},f.deleteSelectedVariables=function(e){var n=i.confirm().title("Are you sure want to delete the selected variables?").htmlContent("<b>"+f.selectedVariables.length+" selected</b> will be deleted.").ariaLabel("delete Variables").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVariables.forEach(function(e){y(e)}),f.selectedVariables=[]})},f.deselectVariables=function(){f.selectedVariables=[]},f.selectAllVariables=function(){f.selectedVariables=f.variables.rows};var b=!0,A=1;function E(e){f.variables=e||{count:0,rows:[]}}function y(e){m.variable.delete({id:e.id}).$promise.then(function(){_.remove(f.variables.rows,{id:e.id}),f.variables.count-=1,f.variables.rows.length||f.getVariables(),p.success({title:_.startCase("Variable")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvariable"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvariable",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVariables())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","variables","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("VariablesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VIDEO.EDIT_SCREENRECORDING",g.screenRecording=angular.copy(l),g.screenRecordings=r,g.newscreenRecording=!1,g.screenRecording||(g.screenRecording={},g.title="VIDEO.NEW_SCREENRECORDING",g.newscreenRecording=!0),g.addNewscreenRecording=function(){g.errors=[],d.screenRecording.save(g.screenRecording).$promise.then(function(e){g.screenRecordings.unshift(e.toJSON()),o.success({title:"screenRecording properly created",msg:g.screenRecording.name?g.screenRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savescreenRecording=function(){g.errors=[],d.screenRecording.update({id:g.screenRecording.id},g.screenRecording).$promise.then(function(e){var n=_.find(g.screenRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"screenRecording properly saved!",msg:g.screenRecording.name?g.screenRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletescreenRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The screenRecording will be deleted.").ariaLabel("Delete screenRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.screenRecording.delete({id:g.screenRecording.id}).$promise.then(function(){_.remove(g.screenRecordings,{id:g.screenRecording.id}),o.success({title:"screenRecording properly deleted!",msg:(g.screenRecording.name||"screenRecording")+" has been deleted!"}),v(g.screenRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,d.user.get({fields:"id,name,fullname",sort:"name",nolimit:"true"}).$promise.then(function(e){g.users=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","screenRecordings","screenRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.video").controller("CreateOrEditscreenRecordingDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c,m=this;if(m.loading=!1,m.recording=Object.assign({},i),m.route="screenRecording",m.element=l,m.actionOptions=Object.assign({},s),m.path=r,m.label=o,m.app="video",m.model="screenRecording",console.log("TCL: vm.path",m.path),console.log("TCL: vm.recording[vm.path]",m.recording[m.path]),m.filename=-1<m.recording[m.path].indexOf("/")?m.recording[m.path].substring(m.recording[m.path].lastIndexOf("/")+1):-1<m.recording[m.path].indexOf("\\")?m.recording[m.path].substring(m.recording[m.path].lastIndexOf("\\")+1):m.recording[m.path],m.format=!1,_.isNil(m.recording.format)&&(m.recording.format=m.filename.slice(m.filename.lastIndexOf("."))),(".wav"===m.recording.format&&"audio"===m.element||".mp4"===m.recording.format&&"video"===m.element)&&(m.format=!0),m.found=!0,m.format&&(c=d.defer(),a.screenRecording.download({id:m.recording.id,path:String(m.path)}).$promise.then(function(e){m.format=!0,m.found=!0,c.resolve()}).catch(function(e){console.log("err"),m.format=!1,m.found=!1,c.resolve()}),c.promise),!_.isNil(s.properties)&&s.properties){if(m.properties=Object.assign({},i),Object.keys(i).forEach(function(e){String(e[0].toUpperCase())===String(e[0])&&delete m.properties[e]}),m.propertiesDefault={},!_.isNil(s.propertiesList)&&0<s.propertiesList.length){m.propertiesDefault=Object.assign({},i);var u=s.propertiesList,p=Object.keys(i),g=!0;p.forEach(function(n){g=!0,u.forEach(function(e){String(n)===String(e)&&(g=!1)}),g&&delete m.propertiesDefault[n]}),m.properties=m.propertiesDefault}if(!_.isNil(s.extraData)&&0<s.extraData.length){m.propertiesExtra={};for(var v=s.extraData,h=0;h<v.length;h++)for(var f=v[h].values,b=v[h].model,A=0;A<f.length;A++)m.propertiesExtra[f[A].text]=i[b][f[A].key];m.properties=Object.assign({},m.propertiesDefault,m.propertiesExtra)}}m.closeDialog=function(){n.hide()}}e.$inject=["$scope","$mdDialog","toasty","api","recording","actionOptions","label","varPath","elementTag","$q"],angular.module("app.video").controller("screenRecordingplayController",e)}(),function(){"use strict";function e(e,n,t,a,r,l,i,o,s,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.screenRecordings=s||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="screenRecordings",f.listOrder="",f.listOrderAsc=null,f.selectedScreenRecordings=[],f.query={fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:"@msUtils.firstLastDayMonth()",includeAll:"true",sort:"-updatedAt",limit:10,page:1},f.query.createdAt=u.firstLastDayMonth(),f.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE_RANGE"}],f.playrecording=function(e,n,t,a,i){var s={route:"screenRecording",name:"screenRecordings",model:"screenRecording",singular:"screenRecording"},a=String(a),o=String(t);console.log("TCL:  path",String(t)),r.show({controller:"screenRecordingplayController",controllerAs:"vm",templateUrl:"app/main/apps/video/views/screenRecordings/partialViews/play.html",parent:angular.element(l.body),targetEvent:n,clickOutsideToClose:!0,locals:{recording:e,recordings:f.screenRecordings.rows,license:f.license,setting:null,item:s,actionOptions:{upperTitle:!1,lowerTitle:!0,properties:!0,propertiesIcon:"icon-video",propertiesList:["format","interactionid","duration","startedAt","closedAt","createdAt"],extraData:[{model:"User",values:[{key:"name",text:"agentname"}]}]},label:a,varPath:o,elementTag:String(i)}})},f.downloadfile2=function(e,n){var t=!1,a=_.isNil(e.format)?e.value.substring(e.value.lastIndexOf(".")):e.format;t=".mp4"===a;var s=-1<e.value.lastIndexOf("/")?e.value.substring(e.value.lastIndexOf("/")+1):-1<e.value.lastIndexOf("\\")?e.value.substring(e.value.lastIndexOf("\\")+1):e.value;return m.screenRecording.download({id:e.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:o.instant("VIDEO.CANT_DOWNLOAD_THIS_FILE"),msg:o.instant("VIDEO.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:o.instant("VIDEO.CANT_DOWNLOAD_THIS_FILE"),msg:o.instant("VIDEO.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=r.confirm().title("Are you sure want to delete the "+_.startCase("screenRecording")+"?").htmlContent("<b>"+(e.name||"screenRecording")+"</b> will be deleted.").ariaLabel("delete screenRecording").targetEvent(n).ok("OK").cancel("CANCEL");r.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getScreenRecordings=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.screenRecording.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ScreenRecordings",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditscreenRecording=function(e,n){r.show({controller:"CreateOrEditscreenRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/video/views/screenRecordings/create/dialog.html",parent:angular.element(l.body),targetEvent:e,clickOutsideToClose:!0,locals:{screenRecording:n,screenRecordings:f.screenRecordings.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletescreenRecording=y,f.exportSelectedScreenRecordings=function(){var e=angular.copy(f.selectedScreenRecordings);return f.selectedScreenRecordings=[],e},f.deleteSelectedScreenRecordings=function(e){var n=r.confirm().title("Are you sure want to delete the selected screenRecordings?").htmlContent("<b>"+f.selectedScreenRecordings.length+" selected</b> will be deleted.").ariaLabel("delete screenRecordings").targetEvent(e).ok("OK").cancel("CANCEL");r.show(n).then(function(){f.selectedScreenRecordings.forEach(function(e){y(e)}),f.selectedScreenRecordings=[]})},f.deselectScreenRecordings=function(){f.selectedScreenRecordings=[]},f.selectAllScreenRecordings=function(){f.selectedScreenRecordings=f.screenRecordings.rows},f.convertDuration=function(e){var n=Math.floor(e/1e3%60),t=Math.floor(e/6e4%60),a=Math.floor(e/36e5%24),i=a<10?"0"+String(a):String(a),s=t<10?"0"+String(t):String(t),o=n<10?"0"+String(n):String(n);return i+":"+s+":"+o},m.user.get({fields:"id,name,fullname",sort:"name",nolimit:"true"}).$promise.then(function(e){f.users=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.screenRecordings=e||{count:0,rows:[]}}function y(e){m.screenRecording.delete({id:e.id}).$promise.then(function(){_.remove(f.screenRecordings.rows,{id:e.id}),f.screenRecordings.count-=1,f.screenRecordings.rows.length||f.getScreenRecordings(),p.success({title:_.startCase("screenRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEscreenRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEscreenRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getScreenRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","screenRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.video").controller("ScreenRecordingsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(e){return _.isEmpty(e)||isNaN(e)?e:parseInt(e,10)}function m(e){switch(e){case"sound":if(!d.application.appdata)return;return[{key:"save_name",value:d.application.appdata.split("/").pop()}];case"squareProject":if(!d.application.project)return;return[{key:"name",value:d.application.project.split(",")[1]}];case"tag":if(!d.application.tag)return;return[{key:"name",value:d.application.tag}];case"trunk":if(!d.application.trunk)return;return[{key:"name",value:d.application.trunk}];case"user":if(!d.application.user&&!d.application.users)return;return d.application.user?[{key:"name",value:d.application.user.split("/")[1]}]:_.map(d.application.users,function(e){return{key:"name",value:e.split("/")[1]}});case"variable":if(!d.application.name)return;return[{key:"name",value:d.application.name}];case"voiceContext":if(!d.application.context)return;return[{key:"name",value:d.application.context}];case"voiceMail":if(!d.application.voiceMail)return;return[{key:"mailbox",value:d.application.voiceMail.split("@")[0]}];case"voiceQueue":if(!d.application.queue)return;return[{key:"name",value:d.application.queue}]}}function u(){o.getResourcesByRole(d.currentUser,"trunk",{fields:"id,name",sort:"name",nolimit:"true"},m("trunk")).then(function(e){d.trunks=e}).catch(function(){s.error({title:i.instant("TOOLS.TRUNKS"),msg:i.instant("VOICE.NOTIFICATIONS.TRUNKS_GET_ERROR")})})}function p(){o.getResourcesByRole(d.currentUser,"sound",{fields:"id,name,save_name",sort:"name",nolimit:"true"},m("sound")).then(function(e){d.sounds=e}).catch(function(){s.error({title:i.instant("TOOLS.SOUNDS"),msg:i.instant("VOICE.NOTIFICATIONS.SOUNDS_GET_ERROR")})})}function g(){var e={fields:"id,name,role",sort:"name",nolimit:"true"},n=m("user"),t=[o.getResourcesByRole(d.currentUser,"user",_.merge(e,{role:"agent"}),n,"Agents"),o.getResourcesByRole(d.currentUser,"user",_.merge(e,{role:"telephone"}),n,"Telephones")];a.all(t).then(function(e){var n=_(e).flatMap(function(e){return e.rows}).orderBy([function(e){return e.name.toLowerCase()}]).value();d.users={rows:n,count:n.length}}).catch(function(){s.error({title:i.instant("STAFF.USERS"),msg:i.instant("VOICE.NOTIFICATIONS.USERS_GET_ERROR")})})}function v(){(d.application.appdata||"custom"===d.application.appType)&&e.hide(d.application),e.hide()}d.currentUser=r.getCurrentUser(),d.application=angular.copy(n),d.crudPermissions=l,d.errors=[],d.init=function(){d.application.appdata&&function(){var e=[];switch(d.application.appType){case"agi":d.application.project=d.application.appdata;break;case"dial":e=d.application.appdata.split(","),d.application.tech=c(e[0]),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"externalDial":e=d.application.appdata.split(","),d.application.trunk=e[0].split("/")[1],d.application.phone=e[0].split("/")[2],d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"goTo":e=d.application.appdata.split(","),d.application.context=c(e[0]),d.application.extension=c(e[1]),d.application.priority=c(e[2]);break;case"internalDial":e=d.application.appdata.split(","),d.application.user=c(e[0]),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"outboundDial":e=d.application.appdata.split(","),d.application.trunk=e[0].split("/")[1],d.application.phone=e[0].split("/")[2],d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]),d.application.prefix=d.application.phone?d.application.phone.split("$")[0]:void 0,d.application.callerId=d.application.callerID?"CALLERID(all)="+d.application.callerID:void 0;break;case"playback":e=d.application.appdata.split(","),d.application.appdata=c(e[0]),d.application.options=c(e[1]);break;case"queue":e=d.application.appdata.split(","),d.application.queue=c(e[0]),d.application.options=c(e[1]),d.application.URL=c(e[2]),d.application.sound=c(e[3]),d.application.timeout=c(e[4]),d.application.agi=c(e[5]),d.application.macro=c(e[6]),d.application.gosub=c(e[7]),d.application.rule=c(e[8]),d.application.position=c(e[9]);break;case"ringGroup":e=d.application.appdata.split(","),d.application.users=e[0].split("&"),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"set":e=d.application.appdata.split("="),d.application.name=e[0],d.application.value=e[1];break;case"voicemail":e=d.application.appdata.split(","),d.application.voiceMail=c(e[0]),d.application.options=c(e[1])}}();switch(d.application.appType){case"agi":o.getResourcesByRole(d.currentUser,"squareProject",{fields:"id,name",sort:"name",nolimit:"true"},m("squareProject")).then(function(e){d.projects=e}).catch(function(){s.error({title:i.instant("CALLYSQUARE.CALLYSQUARE")+" "+i.instant("CALLYSQUARE.PROJECTS"),msg:i.instant("VOICE.NOTIFICATIONS.CALLYSQUARE_PROJECTS_GET_ERROR")})});break;case"externalDial":u();break;case"goTo":o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:"true"},m("voiceContext")).then(function(e){d.contexts=e}).catch(function(){s.error({title:i.instant("VOICE.CONTEXTS"),msg:i.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});break;case"internalDial":g();break;case"outboundDial":o.getResourcesByRole(d.currentUser,"tag",{fields:"id,name",sort:"name",nolimit:"true"},m("tag")).then(function(e){d.tags=e}).catch(function(){s.error({title:i.instant("TOOLS.TAGS"),msg:i.instant("VOICE.NOTIFICATIONS.TAGS_GET_ERROR")})}),u();break;case"playback":p();break;case"queue":p(),o.getResourcesByRole(d.currentUser,"voiceQueue",{type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"},m("voiceQueue")).then(function(e){d.queues=e}).catch(function(){s.error({title:i.instant("VOICE.VOICEQUEUES"),msg:i.instant("VOICE.NOTIFICATIONS.QUEUES_GET_ERROR")})});break;case"ringGroup":g();break;case"set":o.getResourcesByRole(d.currentUser,"variable",{fields:"id,name",sort:"name",nolimit:"true"},m("variable")).then(function(e){d.variables=e}).catch(function(){s.error({title:i.instant("TOOLS.VARIABLES"),msg:i.instant("VOICE.NOTIFICATIONS.VARIABLES_GET_ERROR")})});break;case"voicemail":o.getResourcesByRole(d.currentUser,"voiceMail",{fields:"id,mailbox",sort:"mailbox",nolimit:"true"},m("voiceMail")).then(function(e){d.voiceMails=e}).catch(function(){s.error({title:i.instant("VOICE.VOICEMAILS"),msg:i.instant("VOICE.NOTIFICATIONS.VOICEMAILS_GET_ERROR")})})}},d.saveRoutingApp=function(){d.errors=[],function(){var e=[];switch(d.application.appType){case"agi":d.application.appdata=d.application.project;break;case"dial":e[0]=d.application.tech,e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"externalDial":e[0]=["SIP",d.application.trunk,d.application.phone].join("/"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"goTo":e[0]=d.application.context,e[1]=d.application.extension,e[2]=d.application.priority,d.application.appdata=e.join(",");break;case"internalDial":e[0]=d.application.user,e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"outboundDial":d.application.phone=t.cutdigits?(d.application.prefix||"")+"${EXTEN:"+t.cutdigits+"}":(d.application.prefix||"")+"${EXTEN}","none"===t.recordingFormat?d.application.options=d.application.options.replace("U(xcally-mixmonitor-context)",""):d.application.options.indexOf("U(xcally-mixmonitor-context)")<0&&(d.application.options+="U(xcally-mixmonitor-context)"),e[0]=["SIP",d.application.trunk,d.application.phone].join("/"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"playback":e[0]=d.application.appdata,e[1]=d.application.options,d.application.appdata=e.join(",");break;case"queue":e[0]=d.application.queue,e[1]=d.application.options,e[2]=d.application.URL,e[3]=d.application.sound,e[4]=d.application.timeout,e[5]=d.application.agi,e[6]=d.application.macro,e[7]=d.application.gosub,e[8]=d.application.rule,e[9]=d.application.position,d.application.appdata=e.join(",");break;case"ringGroup":e[0]=d.application.users.join("&"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"set":e[0]=d.application.name,e[1]=d.application.value,d.application.appdata=e.join("=");break;case"voicemail":e[0]=d.application.voiceMail,e[1]=d.application.options,d.application.appdata=e.join(",")}}(),v()},d.closeDialog=v}e.$inject=["$mdDialog","$q","$translate","toasty","application","route","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditRoutingAppDialogController",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o,r,l){var d=this;function c(){var e=[{key:"name",value:d.interval.IntervalId}];s.getResourcesByRole(d.currentUser,"interval",{fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0},e).then(function(e){d.intervals=e}).catch(function(){i.error({title:t.instant("TOOLS.INTERVALS"),msg:t.instant("VOICE.NOTIFICATIONS.INTERVALS_GET_ERROR")})})}function m(e){n.hide(e)}d.currentUser=o.getCurrentUser(),d.interval=angular.copy(e),d.intervals=a||{rows:[],count:0},d.types=["always","custom","list"],d.crudPermissions=r,d.errors=[],d.daysOfWeek=l.getDaysOfWeek(),d.monthNumber=l.getMonthNumber(),d.monthName=l.getMonthName(),d.daysOfMonth=l.getDaysOfMonth(),d.initialize=function(){if("*,*,*,*"===d.interval.interval)return d.type=d.interval.IntervalId&&d.interval.application?"list":"always",void("list"===d.type&&c());d.type="custom";var e=d.interval.interval.split(","),n=e[0],t=e[1],a=e[2],i=e[3];if("*"!==n){var s,o=n.split("-")[0],r=n.split("-")[1];(s=new Date).setHours(Number(o.split(":")[0])),s.setMinutes(Number(o.split(":")[1])),d.timeRangeFrom=s,(s=new Date).setHours(Number(r.split(":")[0])),s.setMinutes(Number(r.split(":")[1])),d.timeRangeTo=s}"*"!==t&&(d.dayOfWeekFrom=t.split("-")[0],d.dayOfWeekTo=t.split("-")[1]);"*"!==a&&(d.monthDayFrom=a.split("-")[0],d.monthDayTo=a.split("-")[1]);"*"!==i&&(d.monthFrom=i.split("-")[0],d.monthTo=i.split("-")[1])},d.onTypeChange=function(){"list"===d.type&&0===d.intervals.count&&c()},d.saveInterval=function(){d.errors=[],d.interval.interval=function(){if(["always","list"].includes(d.type))return"*,*,*,*";var e=[];if("*"!==d.timeRangeFrom&&d.timeRangeFrom&&d.timeRangeTo){var n=(d.timeRangeFrom.getHours()<10?"0":"")+d.timeRangeFrom.getHours()+":"+(d.timeRangeFrom.getMinutes()<10?"0":"")+d.timeRangeFrom.getMinutes(),t=(d.timeRangeTo.getHours()<10?"0":"")+d.timeRangeTo.getHours()+":"+(d.timeRangeTo.getMinutes()<10?"0":"")+d.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return d.dayOfWeekFrom?d.dayOfWeekTo?e.push(d.dayOfWeekFrom+"-"+d.dayOfWeekTo):e.push(d.dayOfWeekFrom):e.push("*"),d.monthDayFrom?d.monthDayTo?e.push(d.monthDayFrom+"-"+d.monthDayTo):e.push(d.monthDayFrom):e.push("*"),d.monthFrom?d.monthTo?e.push(d.monthFrom+"-"+d.monthTo):e.push(d.monthFrom):e.push("*"),e.join()}(),"list"!==d.type&&(d.interval.IntervalId=null);m(d.interval)},d.closeDialog=m}e.$inject=["$mdDialog","$translate","interval","intervals","toasty","api","Auth","crudPermissions","IndexFactory"],angular.module("app.voice").controller("EditRoutingIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chanSpies=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chanSpies",f.listOrder="",f.listOrderAsc=null,f.selectedChanSpies=[],f.query={fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,page:1},f.arrayoptions=_.keyBy([{option:"b: Only spy on channels involved in a bridged call.",value:"'b'"},{option:"B: Instead of whispering on a single channel barge in on both channels involved in the call.",value:"'B'"},{option:"E: Exit when the spied-on channel hangs up.",value:"'E'"},{option:"o: Only listen to audio coming from this channel.",value:"'o'"},{option:"q: Don't play a beep when beginning to spy on a channel, or speak the selected channel name.",value:"'q'"},{option:"s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.",value:"'s'"},{option:"S: Stop when no more channels are left to spy on.",value:"'S'"},{option:"w: Enable whisper mode, so the spying channel can talk to the spied-on channel.",value:"'w'"},{option:"W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.",value:"'W'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayrecordingFormat=_.keyBy([{option:"wav",value:"'wav'"},{option:"gsm",value:"'gsm'"},{option:"wav49",value:"'WAV'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chanSpy:e,chanSpies:f.chanSpies.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chanSpy")+"?").htmlContent("<b>"+(e.name||"chanSpy")+"</b> will be deleted.").ariaLabel("delete chanSpy").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getChanSpies=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceChanSpy.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChanSpies",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditchanSpy=function(e,n){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chanSpy:n,chanSpies:f.chanSpies.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletechanSpy=y,f.exportSelectedChanSpies=function(){var e=angular.copy(f.selectedChanSpies);return f.selectedChanSpies=[],e},f.deleteSelectedChanSpies=function(e){var n=i.confirm().title("Are you sure want to delete the selected chanSpies?").htmlContent("<b>"+f.selectedChanSpies.length+" selected</b> will be deleted.").ariaLabel("delete chanSpys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChanSpies.forEach(function(e){y(e)}),f.selectedChanSpies=[]})},f.deselectChanSpies=function(){f.selectedChanSpies=[]},f.selectAllChanSpies=function(){f.selectedChanSpies=f.chanSpies.rows};var b=!0,A=1;function E(e){f.chanSpies=e||{count:0,rows:[]}}function y(e){m.voiceChanSpy.delete({id:e.id}).$promise.then(function(){_.remove(f.chanSpies.rows,{id:e.id}),f.chanSpies.count-=1,f.chanSpies.rows.length||f.getChanSpies(),p.success({title:_.startCase("chanSpy")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceChanSpy"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceChanSpy",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChanSpies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chanSpies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("ChanSpiesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_CHANSPY",g.chanSpy=angular.copy(l),g.chanSpies=r,g.newchanSpy=!1,g.chanSpy||(g.chanSpy={recordingFormat:"wav"},g.title="VOICE.NEW_CHANSPY",g.newchanSpy=!0),g.addNewchanSpy=function(){g.errors=[],d.voiceChanSpy.save(g.chanSpy).$promise.then(function(e){g.chanSpies.unshift(e.toJSON()),o.success({title:"chanSpy properly created",msg:g.chanSpy.name?g.chanSpy.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savechanSpy=function(){g.errors=[],d.voiceChanSpy.update({id:g.chanSpy.id},g.chanSpy).$promise.then(function(e){var n=_.find(g.chanSpies,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"chanSpy properly saved!",msg:g.chanSpy.name?g.chanSpy.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletechanSpy=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chanSpy will be deleted.").ariaLabel("Delete chanSpy").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceChanSpy.delete({id:g.chanSpy.id}).$promise.then(function(){_.remove(g.chanSpies,{id:g.chanSpy.id}),o.success({title:"chanSpy properly deleted!",msg:(g.chanSpy.name||"chanSpy")+" has been deleted!"}),v(g.chanSpy)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chanSpies","chanSpy","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditchanSpyDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.contexts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="contexts",f.listOrder="",f.listOrderAsc=null,f.selectedContexts=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{context:e,contexts:f.contexts.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("context")+"?").htmlContent("<b>"+(e.name||"context")+"</b> will be deleted.").ariaLabel("delete context").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getContexts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceContext.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Contexts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditContext=function(e,n){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{context:n,contexts:f.contexts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteContext=y,f.exportSelectedContexts=function(){var e=angular.copy(f.selectedContexts);return f.selectedContexts=[],e},f.deleteSelectedContexts=function(e){var n=i.confirm().title("Are you sure want to delete the selected contexts?").htmlContent("<b>"+f.selectedContexts.length+" selected</b> will be deleted.").ariaLabel("delete Contexts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedContexts.forEach(function(e){y(e)}),f.selectedContexts=[]})},f.deselectContexts=function(){f.selectedContexts=[]},f.selectAllContexts=function(){f.selectedContexts=f.contexts.rows};var b=!0,A=1;function E(e){f.contexts=e||{count:0,rows:[]}}function y(e){m.voiceContext.delete({id:e.id}).$promise.then(function(){_.remove(f.contexts.rows,{id:e.id}),f.contexts.count-=1,f.contexts.rows.length||f.getContexts(),p.success({title:_.startCase("Context")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceContext"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceContext",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getContexts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contexts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("ContextsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_CONTEXT",g.context=angular.copy(l),g.contexts=r,g.newContext=!1,g.context||(g.context={},g.title="VOICE.NEW_CONTEXT",g.newContext=!0),g.addNewContext=function(){g.errors=[],d.voiceContext.save(g.context).$promise.then(function(e){g.contexts.unshift(e.toJSON()),o.success({title:"Context properly created",msg:g.context.name?g.context.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveContext=function(){g.errors=[],d.voiceContext.update({id:g.context.id},g.context).$promise.then(function(e){var n=_.find(g.contexts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Context properly saved!",msg:g.context.name?g.context.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteContext=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The context will be deleted.").ariaLabel("Delete Context").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceContext.delete({id:g.context.id}).$promise.then(function(){_.remove(g.contexts,{id:g.context.id}),o.success({title:"Context properly deleted!",msg:(g.context.name||"context")+" has been deleted!"}),v(g.context)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","contexts","context","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditContextDialogController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.inboundRoute=angular.copy(s),d.inboundRoutes=n,d.newInboundRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.inboundRoute||(d.inboundRoute={appdata:"Inbound Call",type:"inbound",context:"from-voip-provider"},d.newInboundRoute=!0);e=[{key:"name",value:d.inboundRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newInboundRoute)return;var e={sort:"priority",VoiceExtensionId:d.inboundRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewInboundRoute=function(){d.errors=[],o.voiceExtension.save(d.inboundRoute).$promise.then(function(e){c(e.id).then(function(){d.inboundRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveInboundRoute=function(){d.errors=[],o.voiceExtension.update({id:d.inboundRoute.id},d.inboundRoute).$promise.then(function(e){var n=_.find(d.inboundRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.inboundRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteInboundRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.inboundRoute.exten})).ariaLabel("Delete inbound route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.inboundRoute.id}).$promise.then(function(){_.remove(d.inboundRoutes,{id:d.inboundRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.inboundRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","inboundRoutes","inboundRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInboundRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.inboundRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.inboundRoute=l||e.params.inboundRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.inboundRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"AGI",appAlias:"CallySquare",appType:"agi",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"Dial",appType:"dial",context:"from-sip",type:"Inbound",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Inbound",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Inbound",interval:"*,*,*,*",options:"xX"},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Inbound",interval:"*,*,*,*",options:"xX"},{app:"Playback",appType:"playback",context:"from-sip",type:"Inbound",interval:"*,*,*,*",answer:!0},{app:"Queue",appType:"queue",context:"from-sip",type:"Inbound",options:"xX",appdata:",xX,,,300,,,,,",interval:"*,*,*,*",answer:!0},{app:"Set",appType:"set",context:"from-sip",type:"Inbound",separator:"=",interval:"*,*,*,*"},{app:"Voicemail",appType:"voicemail",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"goto",appType:"goTo",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"hangup",appType:"hangup",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Inbound",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.inboundRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoInboundRoutes=function(){e.go("app.voice.inboundRoutes",{},{reload:"app.voice.inboundRoutes"})},m.saveInboundRoute=function(){o.voiceExtension.update({id:m.inboundRoute.id},m.inboundRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.inboundRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","inboundRoute","contexts","userProfileSection"],angular.module("app.voice").controller("InboundRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.inboundRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="InboundRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.inboundRoutes.rows,{id:e.id}),g.inboundRoutes.count-=1,g.inboundRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.inboundRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedInboundRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.inboundRoutes.edit",{id:e.id,inboundRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditInboundRoute=function(e,n){a.show({controller:"CreateOrEditInboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundRoute:n,inboundRoutes:g.inboundRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getInboundRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedInboundRoutes=function(){var e=angular.copy(g.selectedInboundRoutes);return g.selectedInboundRoutes=[],e},g.deleteSelectedInboundRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedInboundRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedInboundRoutes.forEach(function(e){f(e)}),g.selectedInboundRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","inboundRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("InboundRoutesController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.internalRoute=angular.copy(s),d.internalRoutes=n,d.newInternalRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.internalRoute||(d.internalRoute={appdata:"Internal Call",type:"internal",context:"from-sip"},d.newInternalRoute=!0);e=[{key:"name",value:d.internalRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newInternalRoute)return;var e={sort:"priority",VoiceExtensionId:d.internalRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewInternalRoute=function(){d.errors=[],o.voiceExtension.save(d.internalRoute).$promise.then(function(e){c(e.id).then(function(){d.internalRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveInternalRoute=function(){d.errors=[],o.voiceExtension.update({id:d.internalRoute.id},d.internalRoute).$promise.then(function(e){var n=_.find(d.internalRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.internalRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteInternalRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.internalRoute.exten})).ariaLabel("Delete internal route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.internalRoute.id}).$promise.then(function(){_.remove(d.internalRoutes,{id:d.internalRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.internalRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","internalRoutes","internalRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInternalRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.internalRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.internalRoute=l||e.params.internalRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.internalRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"AGI",appAlias:"CallySquare",appType:"agi",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"Dial",appType:"dial",context:"from-sip",type:"Internal",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Internal",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Internal",interval:"*,*,*,*",options:"xX"},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Internal",interval:"*,*,*,*",options:"xX"},{app:"Playback",appType:"playback",context:"from-sip",type:"Internal",interval:"*,*,*,*",answer:!0},{app:"Queue",appType:"queue",context:"from-sip",type:"Internal",options:"xX",appdata:",xX,,,300,,,,,",interval:"*,*,*,*",answer:!0},{app:"Set",appType:"set",context:"from-sip",type:"Internal",separator:"=",interval:"*,*,*,*"},{app:"Voicemail",appType:"voicemail",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"goto",appType:"goTo",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"hangup",appType:"hangup",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Internal",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.internalRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoInternalRoutes=function(){e.go("app.voice.internalRoutes",{},{reload:"app.voice.internalRoutes"})},m.saveInternalRoute=function(){o.voiceExtension.update({id:m.internalRoute.id},m.internalRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.internalRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","internalRoute","contexts","userProfileSection"],angular.module("app.voice").controller("InternalRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.internalRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="InternalRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.internalRoutes.rows,{id:e.id}),g.internalRoutes.count-=1,g.internalRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.internalRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedInternalRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.internalRoutes.edit",{id:e.id,internalRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditInternalRoute=function(e,n){a.show({controller:"CreateOrEditInternalRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalRoute:n,internalRoutes:g.internalRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getInternalRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedInternalRoutes=function(){var e=angular.copy(g.selectedInternalRoutes);return g.selectedInternalRoutes=[],e},g.deleteSelectedInternalRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedInternalRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedInternalRoutes.forEach(function(e){f(e)}),g.selectedInternalRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","internalRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("InternalRoutesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_MUSICONHOLD",g.musiconhold=angular.copy(l),g.musiconholds=r,g.newMusicOnHold=!1,g.musiconhold||(g.musiconhold={mode:"files"},g.title="VOICE.NEW_MUSICONHOLD",g.newMusicOnHold=!0),g.addNewMusicOnHold=function(){g.errors=[],d.voiceMusicOnHold.save(g.musiconhold).$promise.then(function(e){g.musiconholds.unshift(e.toJSON()),o.success({title:"MusicOnHold properly created",msg:g.musiconhold.name?g.musiconhold.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMusicOnHold=function(){g.errors=[],d.voiceMusicOnHold.update({id:g.musiconhold.id},g.musiconhold).$promise.then(function(e){var n=_.find(g.musiconholds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MusicOnHold properly saved!",msg:g.musiconhold.name?g.musiconhold.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMusicOnHold=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The musiconhold will be deleted.").ariaLabel("Delete MusicOnHold").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMusicOnHold.delete({id:g.musiconhold.id}).$promise.then(function(){_.remove(g.musiconholds,{id:g.musiconhold.id}),o.success({title:"MusicOnHold properly deleted!",msg:(g.musiconhold.name||"musiconhold")+" has been deleted!"}),v(g.musiconhold)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","musiconholds","musiconhold","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditMusicOnHoldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.musiconholdMohSounds=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceMusicOnHold.getSounds(m.query,u).$promise}function g(e){d.voiceMusicOnHold.removeSound({id:t.params.id,id2:e.id}).$promise.then(function(){_.remove(m.musiconholdMohSounds.rows,{id:e.id}),m.musiconholdMohSounds.count-=1,m.musiconholdMohSounds.rows.length||p(),l.success({title:"MohSound deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMusicOnHold"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.musiconhold={},m.musiconholdMohSounds={count:0,rows:[]},m.selectedMusicOnHoldMohSounds=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,save_name,converted_format,audio",limit:10,page:1},m.init=function(e,n){m.musiconhold=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceMusicOnHoldId=m.musiconhold.id,m.query.id=m.musiconhold.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the mohSound?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("mohSound #")+e.id||"mohSound")+"</b> will be deleted.").ariaLabel("delete mohSound").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.voiceMusicOnHoldDownload=function(s,e,n){return d.sound.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="mohSound"+s.id,a=new Blob(n,{type:e.type});t=s.converted_format?s.save_name+"."+s.converted_format:s.save_name;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=u,m.getMusicOnHoldMohSounds=p,m.createOrEditMusicOnHoldMohSound=function(e,n){o.show({controller:"CreateOrEditMohSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:m.musiconhold,mohSound:n,mohSounds:m.musiconholdMohSounds.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedMusicOnHoldMohSounds=function(){var e=angular.copy(m.selectedMusicOnHoldMohSounds);return m.selectedMusicOnHoldMohSounds=[],e},m.deleteMusicOnHoldMohSound=g,m.deleteSelectedMusicOnHoldMohSounds=function(e){var n=o.confirm().title("Are you sure want to delete the selected mohSounds?").htmlContent("<b>"+m.selectedMusicOnHoldMohSounds.length+" selected</b> will be deleted.").ariaLabel("delete mohSounds").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMusicOnHoldMohSounds.forEach(function(e){g(e)}),m.selectedMusicOnHoldMohSounds=[]})},c.hasRole("admin")?d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){m.sounds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){m.sounds=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.sounds,{id:e.resourceId})}),t=null;if(m.musiconhold&&(t=_.find(m.sounds,{id:Number(m.musiconhold.id)})),t&&!_.some(n,["id",t.id])){var a=_.find(m.sounds,{id:t.id});a.canSelect=!1,n.push(a)}m.sounds=n})}else{var t=[],a=null;m.musiconhold&&(a=_.find(m.sounds,{id:Number(m.musiconhold.id)}));for(var i=0;i<m.sounds.length;i++)a&&m.sounds[i].id===a.id&&(m.sounds[i].canSelect=!1,t.push(m.sounds[i]));m.sounds=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("MusicOnHoldMohSoundsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_MOHSOUND",g.mohSound=angular.copy(l),g.mohSounds=r,g.newMohSound=!1,g.mohSound||(g.mohSound={},g.title="VOICE.NEW_MOHSOUND",g.newMohSound=!0),n.params.id&&(g.mohSound.VoiceMusicOnHoldId=n.params.id),g.addNewMohSound=function(){g.errors=[],d.voiceMusicOnHold.addSound({id:n.params.id},g.mohSound).$promise.then(function(e){g.mohSounds.unshift(e.toJSON()),o.success({title:"MohSound properly created",msg:g.mohSound.name?g.mohSound.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMohSound=function(){g.errors=[],d.voiceMusicOnHold.update({id:g.mohSound.id},g.mohSound).$promise.then(function(e){var n=_.find(g.mohSounds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MohSound properly saved!",msg:g.mohSound.name?g.mohSound.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMohSound=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mohSound will be deleted.").ariaLabel("Delete MohSound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMusicOnHold.delete({id:g.mohSound.id}).$promise.then(function(){_.remove(g.mohSounds,{id:g.mohSound.id}),o.success({title:"MohSound properly deleted!",msg:(g.mohSound.name||"mohSound")+" has been deleted!"}),v(g.mohSound)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.sounds=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.sounds=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.sounds,{id:e.resourceId})}),t=null;if(g.mohSound&&(t=_.find(g.sounds,{id:Number(g.mohSound.id)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.sounds,{id:t.id});a.canSelect=!1,n.push(a)}g.sounds=n})}else{var t=[],a=null;g.mohSound&&(a=_.find(g.sounds,{id:Number(g.mohSound.id)}));for(var i=0;i<g.sounds.length;i++)a&&g.sounds[i].id===a.id&&(g.sounds[i].canSelect=!1,t.push(g.sounds[i]));g.sounds=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mohSounds","mohSound","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditMohSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.musiconhold=c||e.params.musiconhold||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoMusicOnHolds=function(){e.go("app.voice.musiconholds",{},{reload:"app.voice.musiconholds"})},u.saveMusicOnHold=function(){r.voiceMusicOnHold.update({id:u.musiconhold.id},u.musiconhold).$promise.then(function(){l.success({title:"MusicOnHold updated!",msg:u.musiconhold.name?u.musiconhold.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","musiconhold","userProfileSection"],angular.module("app.voice").controller("MusicOnHoldController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.musiconholds=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="musiconholds",f.listOrder="",f.listOrderAsc=null,f.selectedMusicOnHolds=[],f.query={fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,page:1},f.arraymode=_.keyBy([{option:"Files",value:"'files'"},{option:"Custom",value:"'custom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysort=_.keyBy([{option:"Random",value:"'random'"},{option:"Alphabetical",value:"'alpha'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.musiconholds.edit",{id:e.id,musiconhold:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("musiconhold")+"?").htmlContent("<b>"+(e.name||"musiconhold")+"</b> will be deleted.").ariaLabel("delete musiconhold").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMusicOnHolds=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceMusicOnHold.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MusicOnHolds",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMusicOnHold=function(e,n){i.show({controller:"CreateOrEditMusicOnHoldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:n,musiconholds:f.musiconholds.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMusicOnHold=y,f.exportSelectedMusicOnHolds=function(){var e=angular.copy(f.selectedMusicOnHolds);return f.selectedMusicOnHolds=[],e},f.deleteSelectedMusicOnHolds=function(e){var n=i.confirm().title("Are you sure want to delete the selected musiconholds?").htmlContent("<b>"+f.selectedMusicOnHolds.length+" selected</b> will be deleted.").ariaLabel("delete MusicOnHolds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMusicOnHolds.forEach(function(e){y(e)}),f.selectedMusicOnHolds=[]})},f.deselectMusicOnHolds=function(){f.selectedMusicOnHolds=[]},f.selectAllMusicOnHolds=function(){f.selectedMusicOnHolds=f.musiconholds.rows};var b=!0,A=1;function E(e){f.musiconholds=e||{count:0,rows:[]}}function y(e){m.voiceMusicOnHold.delete({id:e.id}).$promise.then(function(){_.remove(f.musiconholds.rows,{id:e.id}),f.musiconholds.count-=1,f.musiconholds.rows.length||f.getMusicOnHolds(),p.success({title:_.startCase("MusicOnHold")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMusicOnHold"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMusicOnHolds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","musiconholds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("MusicOnHoldsController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.outboundRoute=angular.copy(s),d.outboundRoutes=n,d.newOutboundRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.outboundRoute||(d.outboundRoute={appdata:"Outbound Call",type:"outbound",context:"from-sip",recordingFormat:"none"},d.newOutboundRoute=!0);e=[{key:"name",value:d.outboundRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newOutboundRoute)return;var e={sort:"priority",VoiceExtensionId:d.outboundRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewOutboundRoute=function(){d.errors=[],o.voiceExtension.save(d.outboundRoute).$promise.then(function(e){c(e.id).then(function(){d.outboundRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveOutboundRoute=function(){d.errors=[],o.voiceExtension.update({id:d.outboundRoute.id},d.outboundRoute).$promise.then(function(e){var n=_.find(d.outboundRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.outboundRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteOutboundRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.outboundRoute.exten})).ariaLabel("Delete outbound route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.outboundRoute.id}).$promise.then(function(){_.remove(d.outboundRoutes,{id:d.outboundRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.outboundRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","outboundRoutes","outboundRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditOutboundRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.outboundRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.outboundRoute=l||e.params.outboundRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.outboundRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",options:"xX",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Outbound",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.outboundRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoOutboundRoutes=function(){e.go("app.voice.outboundRoutes",{},{reload:"app.voice.outboundRoutes"})},m.saveOutboundRoute=function(){o.voiceExtension.update({id:m.outboundRoute.id},m.outboundRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.outboundRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","outboundRoute","contexts","userProfileSection"],angular.module("app.voice").controller("OutboundRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.outboundRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="OutboundRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.outboundRoutes.rows,{id:e.id}),g.outboundRoutes.count-=1,g.outboundRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.outboundRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedOutboundRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.outboundRoutes.edit",{id:e.id,outboundRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditOutboundRoute=function(e,n){a.show({controller:"CreateOrEditOutboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundRoute:n,outboundRoutes:g.outboundRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getOutboundRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedOutboundRoutes=function(){var e=angular.copy(g.selectedOutboundRoutes);return g.selectedOutboundRoutes=[],e},g.deleteSelectedOutboundRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedOutboundRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedOutboundRoutes.forEach(function(e){f(e)}),g.selectedOutboundRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","outboundRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("OutboundRoutesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){return[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",options:g.agents.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:g.queues.rows,ngValue:"name"}]}function h(){return g.refresh=!1,0===g.queues.count?f(null):(g.query.queue=1===g.queues.count?g.queues.rows[0].name:g.query.queue,void 0===g.query.queue&&(g.query.queue=_.map(g.queues.rows,"name")),_.isEmpty(g.query.queue)?f(null):(g.query.offset=(g.query.page-1)*g.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.voice.abandonedCalls:"+g.currentUser.id,JSON.stringify({query:_.omit(g.query,"queue")})),void(g.promise=o.voiceQueueReport.getVoiceQueuesReport(g.query,f).$promise)))}function f(e){g.abandonedCalls=e||{count:0,rows:[]},g.refresh=!0}g.currentUser=d.getCurrentUser(),g.agents=u||[],g.dispositions=p.rows,g.abandonedCalls={count:0,rows:[]},g.showTooltip=!1,g.refresh=!0,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=d.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition,note",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-createdAt",limit:10,page:1},g.getAbandonedCalls=h,g.refreshAbandonedCalls=function(){g.showTooltip=!1,h()},g.assignTo=function(e,n){e&&o.voiceQueueReport.update({id:e.id,lastAssignedTo:n?n.name:null,assigned:!!n}).$promise.catch(function(){})},g.dispose=function(t){n.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(a.body),targetEvent:t,locals:{dispositions:g.dispositions,call:t}}).then(function(e){if(e){var n={id:t.id,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null,note:e.note||null};o.voiceQueueReport.update(n).$promise.catch(function(){})}})},g.onSaveVoiceQueueReport=function(e){e&&g.queuesMap&&"inbound"===g.query.type&&g.queuesMap[e.queue]&&(g.showTooltip=!0)},g.onUpdateVoiceQueueReport=function(e){if(e){var n=_.findIndex(g.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(g.abandonedCalls.rows[n],e)}},c.onWithoutApply("voiceQueueReport:save",g.onSaveVoiceQueueReport),c.on("voiceQueueReport:update",g.onUpdateVoiceQueueReport),function(){var e=i.localStorage.getItem("motion2.realtime.abandoned.voice.abandonedCalls:"+g.currentUser.id);if(e)(e=JSON.parse(e))&&e.query&&(g.query=_.merge(e.query,_.omit(g.query,["sort","limit","page"])),g.query=_.omit(g.query,"filter"));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};g.query.createdAt=n}d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(){}).finally(function(){g.quickFilters=v(),h()}):o.userProfile.getResources({id:g.currentUser.userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(){}).finally(function(){g.quickFilters=v(),h()})}();var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?t(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())}),e.$on("$destroy",function(){c.removeAllListeners("voiceQueueReport:save"),c.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","userProfile","userProfileSection","Auth","socket","toasty","agents","dispositions"],angular.module("app.voice").controller("AbandonedCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;o.calls=i||{rows:[],count:0},o.query={limit:10,page:1},o.channelStatus=s.OUTGOING_CALL_STATUS_STYLES,o.onSave=function(e){var n=_.find(o.calls.rows,{channel:e.channel});e.channelstatedesc=e.dialstatus?"up":"ring",n?_.merge(n,e):e.channel&&o.calls.rows.push(e)},o.onRemove=function(e){var n=_.findIndex(o.calls.rows,{channel:e.channel});0<=n&&(o.calls.rows[n].status="hangup");t(function(){o.calls.rows.splice(n,1)},5e3)},a.on("voice_outbound_channel:save",o.onSave),a.on("voice_outbound_channel:remove",o.onRemove),e.$on("$destroy",function(){a.removeAllListeners("voice_outbound_channel:save"),a.removeAllListeners("voice_outbound_channel:remove")})}e.$inject=["$scope","$timeout","api","socket","rpcCalls","realtimeManager"],angular.module("app.voice").controller("OutboundCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["total","answered","unmanaged","abandoned","sumHoldTime","sumDuration","sumBillable"];function u(){c.queues.rows.forEach(function(e){c.rpcQueues[e.id]&&_.merge(e,_.pick(c.rpcQueues[e.id],m))})}c.queues=a||{rows:[],count:0},c.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},c.userProfile=r,c.userProfileSection=l&&1==l.count?l.rows[0]:null,c.crudPermissions=d.parseCrudPermissions(c.userProfileSection?c.userProfileSection.crudPermissions:null),d.hasRole("admin")?c.query={type:"inbound",fields:"id,name",sort:"name",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"inbound",fields:"id,name",sort:"name",limit:10,page:1},c.success=v,c.getQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,d.hasRole("admin")?c.promise=s.voiceQueue.get(c.query,v).$promise:(c.query.id=c.userProfile.id,c.query.section="VoiceQueues",c.promise=s.userProfile.getResources(c.query,v).$promise)},c.onSave=function(e){var n=_.find(c.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=n(function(){},999);var p=!0,g=1;function v(e){c.queues=e||{count:0,rows:[]},u()}e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&n.cancel(c.interval)})}e.$inject=["$scope","$timeout","$interval","queues","rpcQueues","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueueParamsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n){var a=this;switch(a.selectedTab=0,t.current.name){case"app.voice.realtime.agents":a.selectedTab=0;break;case"app.voice.realtime.telephones":a.selectedTab=1;break;case"app.voice.realtime.trunks":a.selectedTab=2;break;case"app.voice.realtime.queues":a.selectedTab=3;break;case"app.voice.realtime.queue_calls":a.selectedTab=4;break;case"app.voice.realtime.abandonedcalls":a.selectedTab=5;break;case"app.voice.realtime.queue_params":a.selectedTab=6;break;case"app.voice.realtime.outbound_calls":a.selectedTab=7;break;default:a.selectedTab=0,t.go("app.voice.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.voice.realtime.agents");break;case 1:t.go("app.voice.realtime.telephones");break;case 2:t.go("app.voice.realtime.trunks");break;case 3:t.go("app.voice.realtime.queues");break;case 4:t.go("app.voice.realtime.queue_calls");break;case 5:t.go("app.voice.realtime.abandonedcalls");break;case 6:t.go("app.voice.realtime.queue_params");break;case 7:t.go("app.voice.realtime.outbound_calls");break;default:t.go("app.voice.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.voice").controller("VoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c){var m=this,u=["fullname","internal","state","status"];function p(){_.forIn(m.telephones,function(e,n){m.rpcTelephones[n]&&_.merge(e,_.pick(m.rpcTelephones[n],u))})}m.count=a.count,m.telephones=a?a.rows:{},m.rpcTelephones=i?i.rows:{},m.userProfile=l,m.userProfileSection=d&&1==d.count?d.rows[0]:null,m.crudPermissions=c.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={fields:"id,fullname,internal",role:"telephone",sort:"fullname",limit:10,page:1},m.statusClass=r.STATUS_STYLES,m.stateClass=r.STATES_STYLES,m.success=h,m.$onInit=p,m.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},m.getTelephones=function(){m.query.offset=(m.query.page-1)*m.query.limit,c.hasRole("admin")?m.promise=s.user.get(m.query,h).$promise:(m.query.id=m.userProfile.id,m.query.section="Telephones",m.promise=s.userProfile.getResources(m.query,h).$promise)},m.onSave=function(e){m.telephones[e.id]&&_.merge(m.telephones[e.id],_.pick(e,u))},o.on("telephone:save",m.onSave);var g=!0,v=1;function h(e){m.telephones=e?e.rows:{},p()}e.$watch("vm.query.filter",function(e,n){g?t(function(){g=!1}):(n||(v=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=v),m.getTelephones())}),e.$on("$destroy",function(){o.removeAllListeners("telephone:save")})}e.$inject=["$scope","$timeout","$mdDialog","telephones","rpcTelephones","api","socket","realtimeManager","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TelephonesVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m){var u=this,p=["status","stateRegistry","registry","host","port","internal","state","status"];function g(){for(var e,n=0;n<u.trunks.length;n+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[n].id]))&&_.merge(u.trunks[n],_.pick(u.rpcTrunks[e],p))}function v(e,n,t){0<=n&&_.merge(e[n],_.pick(t,p))}u.currentUser=m.getCurrentUser(),u.count=a.count,u.trunks=a?a.rows:[],u.rpcTrunks=i&&i.rows?i.rows:[],u.query={fields:"id,name",active:!0,sort:"name",limit:10,page:1},u.statusClass=r.STATUS_STYLES,u.stateClass=r.STATES_STYLES,u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.success=b,u.$onInit=g,u.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},u.getTrunks=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=s.trunk.get(u.query,b).$promise:(u.query.id=u.userProfile.id,u.query.section="Trunks",u.promise=s.userProfile.getResources(u.query,b).$promise)},u.goToTrunk=function(e,n){l.go("app.tools.trunks.edit",{id:n.id})},u.onSave=function(e){var n=_.findIndex(u.trunks,["id",e.id]),t=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,n,e),v(u.rpcTrunks,t,e)},o.on("trunk:save",u.onSave);var h=!0,f=1;function b(e){u.count=e.count,u.trunks=e&&e.rows?e.rows:[],g()}e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=f),u.getTrunks())}),e.$on("$destroy",function(){o.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","realtimeManager","$state","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TrunksVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEMAIL",g.voicemail=angular.copy(l),g.voicemails=r,g.newVoicemail=!1,g.voicemail||(g.voicemail={attach:"no"},g.title="VOICE.NEW_VOICEMAIL",g.newVoicemail=!0),g.addNewVoicemail=function(){g.errors=[],d.voiceMail.save(g.voicemail).$promise.then(function(e){g.voicemails.unshift(e.toJSON()),o.success({title:"Voicemail properly created",msg:g.voicemail.name?g.voicemail.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoicemail=function(){g.errors=[],d.voiceMail.update({id:g.voicemail.id},g.voicemail).$promise.then(function(e){var n=_.find(g.voicemails,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Voicemail properly saved!",msg:g.voicemail.name?g.voicemail.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoicemail=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voicemail will be deleted.").ariaLabel("Delete Voicemail").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMail.delete({id:g.voicemail.id}).$promise.then(function(){_.remove(g.voicemails,{id:g.voicemail.id}),o.success({title:"Voicemail properly deleted!",msg:(g.voicemail.name||"voicemail")+" has been deleted!"}),v(g.voicemail)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voicemails","voicemail","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoicemailDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.voicemailMessages=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceMail.getMessages(m.query,u).$promise}function g(e){d.voiceMailMessage.delete({id:e.id}).$promise.then(function(){_.remove(m.voicemailMessages.rows,{id:e.id}),m.voicemailMessages.count-=1,m.voicemailMessages.rows.length||p(),l.success({title:"Message deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMail"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.voicemail={},m.voicemailMessages={count:0,rows:[]},m.selectedVoicemailMessages=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,callerid,duration,audio,stamp,msg_id",sort:"-stamp",limit:10,page:1},m.init=function(e,n){m.voicemail=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.id=m.voicemail.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the message?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("message #")+e.id||"message")+"</b> will be deleted.").ariaLabel("delete message").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.voiceMailMessageDownload=function(s,e,n){return d.voiceMailMessage.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="message"+s.id,a=new Blob(n,{type:e.type});t=s.msg_id+".wav";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=u,m.getVoicemailMessages=p,m.createOrEditVoicemailMessage=function(e,n){o.show({controller:"CreateOrEditMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/edit/messages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:m.voicemail,message:n,messages:m.voicemailMessages.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedVoicemailMessages=function(){var e=angular.copy(m.selectedVoicemailMessages);return m.selectedVoicemailMessages=[],e},m.deleteVoicemailMessage=g,m.deleteSelectedVoicemailMessages=function(e){var n=o.confirm().title("Are you sure want to delete the selected messages?").htmlContent("<b>"+m.selectedVoicemailMessages.length+" selected</b> will be deleted.").ariaLabel("delete messages").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedVoicemailMessages.forEach(function(e){g(e)}),m.selectedVoicemailMessages=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("VoicemailMessagesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.voicemail=c||e.params.voicemail||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoVoicemails=function(){e.go("app.voice.voicemails",{},{reload:"app.voice.voicemails"})},u.saveVoicemail=function(){r.voiceMail.update({id:u.voicemail.id},u.voicemail).$promise.then(function(){l.success({title:"Voicemail updated!",msg:u.voicemail.name?u.voicemail.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.voicemail&&(t=_.find(u.contexts,{name:u.voicemail.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voicemail","userProfileSection"],angular.module("app.voice").controller("VoicemailController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voicemails=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voicemails",f.listOrder="",f.listOrderAsc=null,f.selectedVoicemails=[],f.query={fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,page:1},f.arrayattach=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayenvelope=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydelete=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.voicemails.edit",{id:e.id,voicemail:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voicemail")+"?").htmlContent("<b>"+(e.name||"voicemail")+"</b> will be deleted.").ariaLabel("delete voicemail").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVoicemails=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceMail.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Voicemails",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVoicemail=function(e,n){i.show({controller:"CreateOrEditVoicemailDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:n,voicemails:f.voicemails.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVoicemail=y,f.exportSelectedVoicemails=function(){var e=angular.copy(f.selectedVoicemails);return f.selectedVoicemails=[],e},f.deleteSelectedVoicemails=function(e){var n=i.confirm().title("Are you sure want to delete the selected voicemails?").htmlContent("<b>"+f.selectedVoicemails.length+" selected</b> will be deleted.").ariaLabel("delete Voicemails").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoicemails.forEach(function(e){y(e)}),f.selectedVoicemails=[]})},f.deselectVoicemails=function(){f.selectedVoicemails=[]},f.selectAllVoicemails=function(){f.selectedVoicemails=f.voicemails.rows};var b=!0,A=1;function E(e){f.voicemails=e||{count:0,rows:[]}}function y(e){m.voiceMail.delete({id:e.id}).$promise.then(function(){_.remove(f.voicemails.rows,{id:e.id}),f.voicemails.count-=1,f.voicemails.rows.length||f.getVoicemails(),p.success({title:_.startCase("Voicemail")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMail"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoicemails())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicemails","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoicemailsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEPREFIX",g.voicePrefix=angular.copy(l),g.voicePrefixes=r,g.newvoicePrefix=!1,g.voicePrefix||(g.voicePrefix={},g.title="VOICE.NEW_VOICEPREFIX",g.newvoicePrefix=!0),g.addNewvoicePrefix=function(){g.errors=[],d.voicePrefix.save(g.voicePrefix).$promise.then(function(e){g.voicePrefixes.unshift(e.toJSON()),o.success({title:"voicePrefix properly created",msg:g.voicePrefix.name?g.voicePrefix.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savevoicePrefix=function(){g.errors=[],d.voicePrefix.update({id:g.voicePrefix.id},g.voicePrefix).$promise.then(function(e){var n=_.find(g.voicePrefixes,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"voicePrefix properly saved!",msg:g.voicePrefix.name?g.voicePrefix.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletevoicePrefix=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voicePrefix will be deleted.").ariaLabel("Delete voicePrefix").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voicePrefix.delete({id:g.voicePrefix.id}).$promise.then(function(){_.remove(g.voicePrefixes,{id:g.voicePrefix.id}),o.success({title:"voicePrefix properly deleted!",msg:(g.voicePrefix.name||"voicePrefix")+" has been deleted!"}),v(g.voicePrefix)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){g.outboundRoutes=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){g.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.outboundRoutes,{id:e.resourceId})}),t=null;if(g.voicePrefix&&(t=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.outboundRoutes,{id:t.id});a.canSelect=!1,n.push(a)}g.outboundRoutes=n})}else{var t=[],a=null;g.voicePrefix&&(a=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)}));for(var i=0;i<g.outboundRoutes.length;i++)a&&g.outboundRoutes[i].id===a.id&&(g.outboundRoutes[i].canSelect=!1,t.push(g.outboundRoutes[i]));g.outboundRoutes=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voicePrefixes","voicePrefix","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditvoicePrefixDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.voicePrefix.getAgents({id:c.voicePrefix.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UservoicePrefix?"penalty "+e.UservoicePrefix.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.voicePrefix=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.removeAgents({id:c.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.addAgents({id:c.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("VOICE.ALL_AGENTS"),labelSelected:r.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","voicePrefix","voicePrefixes","realtime","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("voicePrefixagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.voicePrefix.getTeams({id:l.voicePrefix.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.voicePrefix=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("VOICE.ALL_TEAMS"),labelSelected:t.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.removeTeams({id:l.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.addTeams({id:l.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","voicePrefix","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("voicePrefixteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voicePrefixes=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voicePrefixes",f.listOrder="",f.listOrderAsc=null,f.selectedVoicePrefixes=[],f.query={fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"voicePrefixagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes?f.voicePrefixes.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.teamadddialog=function(e,n){i.show({controller:"voicePrefixteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes?f.voicePrefixes.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voicePrefix")+"?").htmlContent("<b>"+(e.name||"voicePrefix")+"</b> will be deleted.").ariaLabel("delete voicePrefix").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVoicePrefixes=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voicePrefix.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VoicePrefixes",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditvoicePrefix=function(e,n){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicePrefix:n,voicePrefixes:f.voicePrefixes.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletevoicePrefix=y,f.exportSelectedVoicePrefixes=function(){var e=angular.copy(f.selectedVoicePrefixes);return f.selectedVoicePrefixes=[],e},f.deleteSelectedVoicePrefixes=function(e){var n=i.confirm().title("Are you sure want to delete the selected voicePrefixes?").htmlContent("<b>"+f.selectedVoicePrefixes.length+" selected</b> will be deleted.").ariaLabel("delete voicePrefixs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoicePrefixes.forEach(function(e){y(e)}),f.selectedVoicePrefixes=[]})},f.deselectVoicePrefixes=function(){f.selectedVoicePrefixes=[]},f.selectAllVoicePrefixes=function(){f.selectedVoicePrefixes=f.voicePrefixes.rows},g.hasRole("admin")?m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){f.outboundRoutes=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){f.outboundRoutes=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.outboundRoutes,{id:e.resourceId})}),t=null;if(f.voicePrefix&&(t=_.find(f.outboundRoutes,{id:Number(f.voicePrefix.VoiceExtensionId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.outboundRoutes,{id:t.id});a.canSelect=!1,n.push(a)}f.outboundRoutes=n})}else{var t=[],a=null;f.voicePrefix&&(a=_.find(f.outboundRoutes,{id:Number(f.voicePrefix.VoiceExtensionId)}));for(var i=0;i<f.outboundRoutes.length;i++)a&&f.outboundRoutes[i].id===a.id&&(f.outboundRoutes[i].canSelect=!1,t.push(f.outboundRoutes[i]));f.outboundRoutes=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.voicePrefixes=e||{count:0,rows:[]}}function y(e){m.voicePrefix.delete({id:e.id}).$promise.then(function(){_.remove(f.voicePrefixes.rows,{id:e.id}),f.voicePrefixes.count-=1,f.voicePrefixes.rows.length||f.getVoicePrefixes(),p.success({title:_.startCase("voicePrefix")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoicePrefix"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoicePrefix",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoicePrefixes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicePrefixes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoicePrefixesController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="VOICE.EDIT_VOICEQUEUE",r.voiceQueue=angular.copy(n),r.voiceQueues=e,r.newVoiceQueue=!1,r.voiceQueue||(r.voiceQueue={type:"inbound",strategy:"ringall",timeout:15,retry:2,random_periodic_announce:"no",announce_holdtime:"no",announce_position:"no",reportholdtime:"no",autopause:"no",ringinuse:"no",timeoutrestart:"no",setinterfacevar:"no",setqueuevar:"no",setqueueentryvar:"no"},r.title="VOICE.NEW_VOICEQUEUE",r.newVoiceQueue=!0),r.addNewVoiceQueue=function(){r.errors=[],i.voiceQueue.save(r.voiceQueue).$promise.then(function(e){r.voiceQueues.unshift(e.toJSON()),a.success({title:"VoiceQueue properly created",msg:r.voiceQueue.name?r.voiceQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveVoiceQueue=function(){r.errors=[],i.voiceQueue.update({id:r.voiceQueue.id},r.voiceQueue).$promise.then(function(e){var n=_.find(r.voiceQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"VoiceQueue properly saved!",msg:r.voiceQueue.name?r.voiceQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteVoiceQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The voiceQueue will be deleted.").ariaLabel("Delete VoiceQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.voiceQueue.delete({id:r.voiceQueue.id}).$promise.then(function(){_.remove(r.voiceQueues,{id:r.voiceQueue.id}),a.success({title:"VoiceQueue properly deleted!",msg:(r.voiceQueue.name||"voiceQueue")+" has been deleted!"}),l(r.voiceQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","voiceQueues","voiceQueue","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceQueueDialogController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.voiceQueue.getAgents({id:c.voiceQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.voiceQueue=n,c.crudPermissions=r,c.penalty=0,c.realtime=i,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.voiceQueue.removeAgents({id:c.voiceQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else{for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.voiceQueue.addAgents({id:c.voiceQueue.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("VOICE.ALL_AGENTS"),labelSelected:s.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","voiceQueue","voiceQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("VoiceQueueagentaddController",e)}(),function(){"use strict";function e(e,i,a,s,n,t,o,r){var l=this;function d(){return i(function(t,n){return i(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:i(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),i(function(n,t){return s.voiceQueue.getTeams({id:l.voiceQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.voiceQueue=n,l.crudPermissions=r,l.penalty=0,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"penalty",labelAll:t.instant("VOICE.ALL_TEAMS"),labelSelected:t.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+l.penalty});var t=_.xorWith(l.startingSelectedItems,l.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):i(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceWith(l.selectedItems,l.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,i(function(e,n){_.isEmpty(t)?e():s.voiceQueue.removeTeams({id:l.voiceQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return a=n,i(function(e,n){if(!_.isEmpty(a)){var t=_.map(a,function(e){return{id:e.id,penalty:_.trim(e.penalty,"penalty ")}});return s.voiceQueue.addTeams({id:l.voiceQueue.id,teams:t}).$promise.then(function(){e()}).catch(function(e){n(e)})}e()});var a}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),a.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","voiceQueue","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("VoiceQueueteamaddController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.voiceQueue=c||t.params.voiceQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.teamadddialog=function(e,n){a.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){a.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.queues",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.queues",{})}},u.alert=l.info,u.gotoVoiceQueues=function(){t.go("app.voice.voiceQueues",{},{reload:"app.voice.voiceQueues"})},u.saveVoiceQueue=function(){r.voiceQueue.update({id:u.voiceQueue.id},u.voiceQueue).$promise.then(function(){l.success({title:"VoiceQueue updated!",msg:u.voiceQueue.name?u.voiceQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MUSICONHOLDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:407}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),t=null;if(u.voiceQueue&&(t=_.find(u.musiconholds,{name:u.voiceQueue.musiconhold})),t&&!_.some(n,["id",t.id])){var a=_.find(u.musiconholds,{id:t.id});a.canSelect=!1,n.push(a)}u.musiconholds=n}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true",defaultEntry:1}).$promise.then(function(e){u.musiconholds=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmusiconholds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.sound.get({fields:"id,name,save_name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.sounds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.sound.get({fields:"id,name,save_name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.sounds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.sounds,{id:e.resourceId})});u.sounds.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.sounds=n})}else u.sounds=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.pauses=n})}else u.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voiceQueue","userProfileSection"],angular.module("app.voice").controller("VoiceQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voiceQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voiceQueues",f.listOrder="",f.listOrderAsc=null,f.selectedVoiceQueues=[],f.query={fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Ringall",value:"'ringall'"},{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Least Recent",value:"'leastrecent'"},{option:"Fewest Calls",value:"'fewestcalls'"},{option:"Random",value:"'random'"},{option:"Linear",value:"'linear'"},{option:"Weight Random",value:"'wrandom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayjoinempty=_.keyBy([{option:"no",value:"'no'",disabled:"vm.voiceQueue.joinempty.length === 1  && vm.voiceQueue.joinempty[0] === 'no'"},{option:"yes",value:"'yes'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'yes'"},{option:"strict",value:"'strict'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'strict'"},{option:"loose",value:"'loose'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'loose'"},{option:"paused",value:"'paused'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'paused'"},{option:"penalty",value:"'penalty'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'penalty'"},{option:"inuse",value:"'inuse'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'inuse'"},{option:"ringing",value:"'ringing'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'ringing'"},{option:"unavailable",value:"'unavailable'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'unavailable'"},{option:"invalid",value:"'invalid'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'invalid'"},{option:"unknown",value:"'unknown'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'unknown'"},{option:"wrapup",value:"'wrapup'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayleavewhenempty=_.keyBy([{option:"no",value:"'no'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'no'"},{option:"yes",value:"'yes'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'yes'"},{option:"strict",value:"'strict'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'strict'"},{option:"loose",value:"'loose'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'loose'"},{option:"paused",value:"'paused'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'paused'"},{option:"penalty",value:"'penalty'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'penalty'"},{option:"inuse",value:"'inuse'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'inuse'"},{option:"ringing",value:"'ringing'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'ringing'"},{option:"unavailable",value:"'unavailable'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'unavailable'"},{option:"invalid",value:"'invalid'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'invalid'"},{option:"unknown",value:"'unknown'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'unknown'"},{option:"wrapup",value:"'wrapup'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayrandom_periodic_announce=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayannounce_holdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Once",value:"'once'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayannounce_position=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Limit",value:"'limit'"},{option:"More",value:"'more'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayreportholdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.voiceQueues.edit",{id:e.id,voiceQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:f.voiceQueues?f.voiceQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:f.voiceQueues?f.voiceQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voiceQueue")+"?").htmlContent("<b>"+(e.name||"voiceQueue")+"</b> will be deleted.").ariaLabel("delete voiceQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.queues",{})}},f.success=E,f.getVoiceQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VoiceQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVoiceQueue=function(e,n){i.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:n,voiceQueues:f.voiceQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteVoiceQueue=y,f.exportSelectedVoiceQueues=function(){var e=angular.copy(f.selectedVoiceQueues);return f.selectedVoiceQueues=[],e},f.deleteSelectedVoiceQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected voiceQueues?").htmlContent("<b>"+f.selectedVoiceQueues.length+" selected</b> will be deleted.").ariaLabel("delete VoiceQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoiceQueues.forEach(function(e){y(e)}),f.selectedVoiceQueues=[]})},f.deselectVoiceQueues=function(){f.selectedVoiceQueues=[]},f.selectAllVoiceQueues=function(){f.selectedVoiceQueues=f.voiceQueues.rows};var b=!0,A=1;function E(e){f.voiceQueues=e||{count:0,rows:[]}}function y(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.voiceQueues.rows,{id:e.id}),f.voiceQueues.count-=1,f.voiceQueues.rows.length||f.getVoiceQueues(),p.success({title:_.startCase("VoiceQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoiceQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoiceQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICERECORDING",g.voiceRecording=angular.copy(l),g.voiceRecordings=r,g.newVoiceRecording=!1,g.voiceRecording||(g.voiceRecording={},g.title="VOICE.NEW_VOICERECORDING",g.newVoiceRecording=!0),g.addNewVoiceRecording=function(){g.errors=[],d.voiceRecording.save(g.voiceRecording).$promise.then(function(e){g.voiceRecordings.unshift(e.toJSON()),o.success({title:"VoiceRecording properly created",msg:g.voiceRecording.name?g.voiceRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoiceRecording=function(){g.errors=[],d.voiceRecording.update({id:g.voiceRecording.id},g.voiceRecording).$promise.then(function(e){var n=_.find(g.voiceRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VoiceRecording properly saved!",msg:g.voiceRecording.name?g.voiceRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoiceRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voiceRecording will be deleted.").ariaLabel("Delete VoiceRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceRecording.delete({id:g.voiceRecording.id}).$promise.then(function(){_.remove(g.voiceRecordings,{id:g.voiceRecording.id}),o.success({title:"VoiceRecording properly deleted!",msg:(g.voiceRecording.name||"voiceRecording")+" has been deleted!"}),v(g.voiceRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voiceRecordings","voiceRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceRecordingDialogController",e)}(),function(){"use strict";function e(e,n){var t=this;t.voiceRecording={},t.init=function(e){t.voiceRecording=e}}e.$inject=["api","toasty"],angular.module("app.voice").controller("VoiceRecordingSentimentStatisticsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.voiceRecording=c||e.params.voiceRecording||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.alert=l.info,p.gotoVoiceRecordings=function(){e.go("app.voice.voiceRecordings",{},{reload:"app.voice.voiceRecordings"})},p.saveVoiceRecording=function(){r.voiceRecording.update({id:p.voiceRecording.id},p.voiceRecording).$promise.then(function(){l.success({title:"VoiceRecording updated!",msg:p.voiceRecording.name?p.voiceRecording.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voiceRecording","userProfile","userProfileSection"],angular.module("app.voice").controller("VoiceRecordingController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,l,r,d,c,m,u,p,g,v,h,f){var b=this;function A(n,e){return m.voiceRecording.runTranscribe({id:n.id,runSentiment:!1}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING"),msg:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING")+" succeded!"}),n.transcribeStatus=e.transcribeStatus}).catch(function(e){p.error({title:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}function E(n,e){return m.voiceRecording.runTranscribe({id:n.id,runSentiment:!0}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING"),msg:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING")+" succeded!"}),n.transcribeStatus=e.transcribeStatus}).catch(function(e){p.error({title:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}function y(e,n){return m.voiceRecording.runTranscribe({id:e.id,runSentiment:!0}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING"),msg:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING")+" succeded!"})}).catch(function(e){p.error({title:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voiceRecordings=r||{count:0,rows:[]},b.userProfile=d,b.userProfileSection=c&&1==c.count?c.rows[0]:null,b.crudPermissions=g.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.table="voiceRecordings",b.listOrder="",b.listOrderAsc=null,b.selectedVoiceRecordings=[],b.query={fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:"@msUtils.firstLastDayMonth()",limit:10,page:1},b.query.createdAt=u.firstLastDayMonth(),b.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE_RANGE"}],b.editstate=function(e,n){t.go("app.voice.voiceRecordings.edit",{id:e.id,voiceRecording:e,crudPermissions:b.crudPermissions})},b.runtranscriberuntranscribesentiment=A,b.runtranscribesentimentruntranscribesentiment=E,b.runsentimentruntranscribesentiment=y,b.downloadtranscribefile2=function(s,e){var t=!1,n=_.isNil(s.format)?s.value.substring(s.value.lastIndexOf(".")):s.format;t=".mp4"===n;-1<s.value.lastIndexOf("/")?s.value.substring(s.value.lastIndexOf("/")+1):-1<s.value.lastIndexOf("\\")?s.value.substring(s.value.lastIndexOf("\\")+1):s.value;return m.voiceRecording.downloadTranscribe({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid+".txt";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.downloadfile2=function(r,e){var t=!1,n=_.isNil(r.format)?r.value.substring(r.value.lastIndexOf(".")):r.format;t=".mp4"===n;-1<r.value.lastIndexOf("/")?r.value.substring(r.value.lastIndexOf("/")+1):-1<r.value.lastIndexOf("\\")?r.value.substring(r.value.lastIndexOf("\\")+1):r.value;return m.voiceRecording.download({id:r.id}).$promise.then(function(e){var n,t,a=[e.buffer],i="download",s=new Blob(a,{type:e.type});n=r.value,t=-1<n.lastIndexOf("/")?n.substring(n.lastIndexOf("/")+1):-1<n.lastIndexOf("\\")?n.substring(n.lastIndexOf("\\")+1):n,i=(t=t.substring(0,t.lastIndexOf(".")))+r.format;var o=window.document.createElement("a");o.setAttribute("href",URL.createObjectURL(s)),o.setAttribute("download",i),document.body.appendChild(o),o.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voiceRecording")+"?").htmlContent("<b>"+(e.name||"voiceRecording")+"</b> will be deleted.").ariaLabel("delete voiceRecording").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){O(e)},function(){console.log("CANCEL")})},b.success=I,b.getVoiceRecordings=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceRecording.get(b.query,I).$promise:(b.query.id=b.userProfile.id,b.query.section="VoiceRecordings",b.promise=m.userProfile.getResources(b.query,I).$promise)},b.createOrEditVoiceRecording=function(e,n){i.show({controller:"CreateOrEditVoiceRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceRecordings/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceRecording:n,voiceRecordings:b.voiceRecordings.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoiceRecording=O,b.exportSelectedVoiceRecordings=function(){var e=angular.copy(b.selectedVoiceRecordings);b.selectedVoiceRecordings=[],b.userProfile.privacyEnabled&&_.forEach(e,function(e){e.calleridnum=f.mask(e.calleridnum),e.exten=f.mask(e.exten),e.connectedlinenum=f.mask(e.connectedlinenum),e.membername=f.mask(e.membername)});return e},b.deleteSelectedVoiceRecordings=function(e){var n=i.confirm().title("Are you sure want to delete the selected voiceRecordings?").htmlContent("<b>"+b.selectedVoiceRecordings.length+" selected</b> will be deleted.").ariaLabel("delete VoiceRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){b.selectedVoiceRecordings.forEach(function(e){O(e)}),b.selectedVoiceRecordings=[]})},b.deselectVoiceRecordings=function(){b.selectedVoiceRecordings=[]},b.selectAllVoiceRecordings=function(){b.selectedVoiceRecordings=b.voiceRecordings.rows},b.runtranscribeSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){A(e,n)}),b.selectedVoiceRecordings=[]},b.runtranscribesentimentSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){E(e,n)}),b.selectedVoiceRecordings=[]},b.runsentimentSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){y(e,n)}),b.selectedVoiceRecordings=[]};var S=!0,T=1;function I(e){b.voiceRecordings=e||{count:0,rows:[]}}function O(e){m.voiceRecording.delete({id:e.id}).$promise.then(function(){_.remove(b.voiceRecordings.rows,{id:e.id}),b.voiceRecordings.count-=1,b.voiceRecordings.rows.length||b.getVoiceRecordings(),p.success({title:_.startCase("VoiceRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){S?o(function(){S=!1}):(n||(T=b.query.page),e!==n&&(b.query.page=1),e||(b.query.page=T),b.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","privacyManager"],angular.module("app.voice").controller("VoiceRecordingsController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.whatsapp.realtime.agents":this.selectedTab=0;break;case"app.whatsapp.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.whatsapp.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.whatsapp.realtime.agents");break;case 1:t.go("app.whatsapp.realtime.queues");break;default:t.go("app.whatsapp.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.whatsapp").controller("WhatsappRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){"twilio"===g.whatsappAccount.type&&(g.whatsappAccount.baseUrl=null)}function h(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPACCOUNT",g.whatsappAccount=angular.copy(l),g.whatsappAccounts=r,g.newWhatsappAccount=!1,g.whatsappAccount||(g.whatsappAccount={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),type:"twilio",notificationSound:!0,queueTransferTimeout:300,waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,agentTransferTimeout:300},g.title="WHATSAPP.NEW_WHATSAPPACCOUNT",g.newWhatsappAccount=!0),n.params.id&&(g.whatsappAccount.WhatsappAccountId=n.params.id),g.addNewWhatsappAccount=function(){g.errors=[],v(),d.whatsappAccount.save(g.whatsappAccount).$promise.then(function(e){g.whatsappAccounts.unshift(e.toJSON()),o.success({title:"WhatsappAccount properly created",msg:g.whatsappAccount.name?g.whatsappAccount.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappAccount=function(){g.errors=[],v(),d.whatsappAccount.update({id:g.whatsappAccount.id},g.whatsappAccount).$promise.then(function(e){var n=_.find(g.whatsappAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappAccount properly saved!",msg:g.whatsappAccount.name?g.whatsappAccount.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappAccount will be deleted.").ariaLabel("Delete WhatsappAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.whatsappAccount.delete({id:g.whatsappAccount.id}).$promise.then(function(){_.remove(g.whatsappAccounts,{id:g.whatsappAccount.id}),o.success({title:"WhatsappAccount properly deleted!",msg:(g.whatsappAccount.name||"whatsappAccount")+" has been deleted!"}),h(g.whatsappAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=h,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.whatsappAccount&&(t=_.find(g.lists,{id:Number(g.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.whatsappAccount&&(a=_.find(g.lists,{id:Number(g.whatsappAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){g.pauses=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){g.pauses=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.pauses,{id:e.resourceId})});g.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.pauses=n})}else g.pauses=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappAccounts","whatsappAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.whatsappAccountApps.rows.length){var t=r.whatsappAccountApps.rows[n]?r.whatsappAccountApps.rows[n]:r.whatsappAccountApps.rows[0];i.show({controller:"EditWhatsappAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccountApp:t,whatsappAccount:r.whatsappAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.whatsappAccountApps.rows[n]=e:r.whatsappAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.whatsappAccountApps.rows.length;t++,0){var a=r.whatsappAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.whatsappAccount.context,a.exten=r.whatsappAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.whatsappAccount.addApplications({id:r.whatsappAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.whatsappAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.whatsappAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.whatsappAccount={},r.whatsappAccountApps={count:0,rows:[]},r.selectedWhatsappAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"WhatsappQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"whatsappQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:2102}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.whatsappAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getWhatsappAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.whatsappAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getWhatsappAccountApps=function(){r.promise=o.whatsappAccount.getApplications(r.query,t).$promise},r.editWhatsappAccountApp=n,r.editInterval=function(e,n){if(r.whatsappAccountApps.rows.length){var t=r.whatsappAccountApps.rows[n]?r.whatsappAccountApps.rows[n]:r.whatsappAccountApps.rows[0];i.show({controller:"EditWhatsappAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteWhatsappAccountApp=function(e){_.remove(r.whatsappAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedWhatsappAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedWhatsappAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedWhatsappAccountApps.forEach(function(e){_.remove(r.whatsappAccountApps.rows,{id:e.id})}),r.selectedWhatsappAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappAccount.getAgents({id:c.whatsappAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserWhatsappAccount?"penalty "+e.UserWhatsappAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.whatsappAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappAccount.removeAgents({id:c.whatsappAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappAccount.addAgents({id:c.whatsappAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("WHATSAPP.ALL_AGENTS"),labelSelected:r.instant("WHATSAPP.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","whatsappAccount","whatsappAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditWhatsappAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("whatsapp")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.whatsappQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.whatsappQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:2102}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"whatsappAccount",action:"getDispositions",field:"name",params:{id:m.whatsappAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.whatsappAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.whatsappAccountInteractions.rows.length;n+=1){var t=m.whatsappAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.whatsappInteraction.get(m.query,p).$promise}function v(e){d.whatsappInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.whatsappAccountInteractions.rows,{id:e.id}),m.whatsappAccountInteractions.count-=1,m.whatsappAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.whatsappAccount={},m.whatsappAccountInteractions={count:0,rows:[]},m.selectedWhatsappAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.whatsappAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.WhatsappAccountId=m.whatsappAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.whatsappInteractionDownload=function(s,e,n){return d.whatsappInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="whatsapp-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getWhatsappAccountInteractions=g,m.createOrEditWhatsappAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:m.whatsappAccount,interaction:n,interactions:m.whatsappAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spywhatsappInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"whatsapp",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"whatsapp.whatsappAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||WhatsappAccountId:=$eq["+m.whatsappAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedWhatsappAccountInteractions=function(){var e=angular.copy(m.selectedWhatsappAccountInteractions);return m.selectedWhatsappAccountInteractions=[],e},m.deleteWhatsappAccountInteraction=v,m.deleteSelectedWhatsappAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedWhatsappAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedWhatsappAccountInteractions.forEach(function(e){v(e)}),m.selectedWhatsappAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.whatsappAccount=c||e.params.whatsappAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.baseUrl=[{name:"US Production",url:"https://us1.whatsapp.api.sinch.com"},{name:"EU Production",url:"https://eu1.whatsapp.api.sinch.com"}],p.agentadddialog=function(e,n){t.show({controller:"WhatsappAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappAccount:e,whatsappAccounts:p.whatsappAccounts?p.whatsappAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoWhatsappAccounts=function(){e.go("app.whatsapp.whatsappAccounts",{},{reload:"app.whatsapp.whatsappAccounts"})},p.saveWhatsappAccount=function(){"twilio"===p.whatsappAccount.type&&(p.whatsappAccount.baseUrl=null);r.whatsappAccount.update({id:p.whatsappAccount.id},p.whatsappAccount).$promise.then(function(){l.success({title:"WhatsappAccount updated!",msg:p.whatsappAccount.name?p.whatsappAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.whatsappAccount&&(t=_.find(p.lists,{id:Number(p.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.whatsappAccount&&(a=_.find(p.lists,{id:Number(p.whatsappAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","whatsappAccount","userProfile","userProfileSection"],angular.module("app.whatsapp").controller("WhatsappAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.whatsappAccountWhatsappCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.whatsappAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.whatsappAccountWhatsappCannedAnswers.rows,{id:e.id}),m.whatsappAccountWhatsappCannedAnswers.count-=1,m.whatsappAccountWhatsappCannedAnswers.rows.length||p(),l.success({title:"WhatsappCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.whatsappAccount={},m.whatsappAccountWhatsappCannedAnswers={count:0,rows:[]},m.selectedWhatsappAccountWhatsappCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.whatsappAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.WhatsappAccountId=m.whatsappAccount.id,m.query.id=m.whatsappAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the whatsappCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("whatsappCannedAnswer #")+e.id||"whatsappCannedAnswer")+"</b> will be deleted.").ariaLabel("delete whatsappCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getWhatsappAccountWhatsappCannedAnswers=p,m.createOrEditWhatsappAccountWhatsappCannedAnswer=function(e,n){o.show({controller:"CreateOrEditWhatsappCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/whatsappCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:m.whatsappAccount,whatsappCannedAnswer:n,whatsappCannedAnswers:m.whatsappAccountWhatsappCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedWhatsappAccountWhatsappCannedAnswers=function(){var e=angular.copy(m.selectedWhatsappAccountWhatsappCannedAnswers);return m.selectedWhatsappAccountWhatsappCannedAnswers=[],e},m.deleteWhatsappAccountWhatsappCannedAnswer=g,m.deleteSelectedWhatsappAccountWhatsappCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected whatsappCannedAnswers?").htmlContent("<b>"+m.selectedWhatsappAccountWhatsappCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete whatsappCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedWhatsappAccountWhatsappCannedAnswers.forEach(function(e){g(e)}),m.selectedWhatsappAccountWhatsappCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountWhatsappCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPCANNEDANSWER",g.whatsappCannedAnswer=angular.copy(l),g.whatsappCannedAnswers=r,g.newWhatsappCannedAnswer=!1,g.whatsappCannedAnswer||(g.whatsappCannedAnswer={},g.title="WHATSAPP.NEW_WHATSAPPCANNEDANSWER",g.newWhatsappCannedAnswer=!0),n.params.id&&(g.whatsappCannedAnswer.WhatsappAccountId=n.params.id),g.addNewWhatsappCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.whatsappCannedAnswer).$promise.then(function(e){g.whatsappCannedAnswers.unshift(e.toJSON()),o.success({title:"WhatsappCannedAnswer properly created",msg:g.whatsappCannedAnswer.name?g.whatsappCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.whatsappCannedAnswer.id},g.whatsappCannedAnswer).$promise.then(function(e){var n=_.find(g.whatsappCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappCannedAnswer properly saved!",msg:g.whatsappCannedAnswer.name?g.whatsappCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappCannedAnswer will be deleted.").ariaLabel("Delete WhatsappCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.whatsappCannedAnswer.id}).$promise.then(function(){_.remove(g.whatsappCannedAnswers,{id:g.whatsappCannedAnswer.id}),o.success({title:"WhatsappCannedAnswer properly deleted!",msg:(g.whatsappCannedAnswer.name||"whatsappCannedAnswer")+" has been deleted!"}),v(g.whatsappCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappCannedAnswers","whatsappCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.whatsappAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.whatsappAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.WhatsappAccountId=m.whatsappAccount.id,m.query.id=m.whatsappAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.whatsappAccount.id,field:"WhatsappAccountId",route:"whatsappAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.whatsappAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="whatsappAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedWhatsappAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Sinch",value:"'sinch'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.whatsapp.whatsappAccounts.edit",{id:e.id,whatsappAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.whatsapp.whatsappAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"WhatsappAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappAccount:e,whatsappAccounts:f.whatsappAccounts?f.whatsappAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("whatsappAccount")+"?").htmlContent("<b>"+(e.name||"whatsappAccount")+"</b> will be deleted.").ariaLabel("delete whatsappAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getWhatsappAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.whatsappAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="WhatsappAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditWhatsappAccount=function(e,n){i.show({controller:"CreateOrEditWhatsappAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:n,whatsappAccounts:f.whatsappAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteWhatsappAccount=y,f.exportSelectedWhatsappAccounts=function(){var e=angular.copy(f.selectedWhatsappAccounts);return f.selectedWhatsappAccounts=[],e},f.deleteSelectedWhatsappAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected whatsappAccounts?").htmlContent("<b>"+f.selectedWhatsappAccounts.length+" selected</b> will be deleted.").ariaLabel("delete WhatsappAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedWhatsappAccounts.forEach(function(e){y(e)}),f.selectedWhatsappAccounts=[]})},f.deselectWhatsappAccounts=function(){f.selectedWhatsappAccounts=[]},f.selectAllWhatsappAccounts=function(){f.selectedWhatsappAccounts=f.whatsappAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.whatsappAccount&&(t=_.find(f.lists,{id:Number(f.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.whatsappAccount&&(a=_.find(f.lists,{id:Number(f.whatsappAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){f.pauses=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){f.pauses=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.pauses,{id:e.resourceId})});f.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),f.pauses=n})}else f.pauses=[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.whatsappAccounts=e||{count:0,rows:[]}}function y(e){m.whatsappAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.whatsappAccounts.rows,{id:e.id}),f.whatsappAccounts.count-=1,f.whatsappAccounts.rows.length||f.getWhatsappAccounts(),p.success({title:_.startCase("WhatsappAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getWhatsappAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","whatsappAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.whatsapp").controller("WhatsappAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="WHATSAPP.EDIT_WHATSAPPQUEUE",r.whatsappQueue=angular.copy(n),r.whatsappQueues=e,r.newWhatsappQueue=!1,r.whatsappQueue||(r.whatsappQueue={strategy:"beepall",timeout:10},r.title="WHATSAPP.NEW_WHATSAPPQUEUE",r.newWhatsappQueue=!0),r.addNewWhatsappQueue=function(){r.errors=[],i.whatsappQueue.save(r.whatsappQueue).$promise.then(function(e){r.whatsappQueues.unshift(e.toJSON()),a.success({title:"WhatsappQueue properly created",msg:r.whatsappQueue.name?r.whatsappQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveWhatsappQueue=function(){r.errors=[],i.whatsappQueue.update({id:r.whatsappQueue.id},r.whatsappQueue).$promise.then(function(e){var n=_.find(r.whatsappQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"WhatsappQueue properly saved!",msg:r.whatsappQueue.name?r.whatsappQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteWhatsappQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The whatsappQueue will be deleted.").ariaLabel("Delete WhatsappQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.whatsappQueue.delete({id:r.whatsappQueue.id}).$promise.then(function(){_.remove(r.whatsappQueues,{id:r.whatsappQueue.id}),a.success({title:"WhatsappQueue properly deleted!",msg:(r.whatsappQueue.name||"whatsappQueue")+" has been deleted!"}),l(r.whatsappQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","whatsappQueues","whatsappQueue","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappQueue.getAgents({id:c.whatsappQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserWhatsappQueue?"penalty "+e.UserWhatsappQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.whatsappQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.removeAgents({id:c.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.addAgents({id:c.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("WHATSAPP.ALL_AGENTS"),labelSelected:r.instant("WHATSAPP.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","whatsappQueue","whatsappQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappQueue.getTeams({id:l.whatsappQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.whatsappQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("WHATSAPP.ALL_TEAMS"),labelSelected:t.instant("WHATSAPP.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.removeTeams({id:l.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.addTeams({id:l.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","whatsappQueue","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.whatsappQueue=c||e.params.whatsappQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"WhatsappQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:u.whatsappQueues?u.whatsappQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:u.whatsappQueues?u.whatsappQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoWhatsappQueues=function(){e.go("app.whatsapp.whatsappQueues",{},{reload:"app.whatsapp.whatsappQueues"})},u.saveWhatsappQueue=function(){r.whatsappQueue.update({id:u.whatsappQueue.id},u.whatsappQueue).$promise.then(function(){l.success({title:"WhatsappQueue updated!",msg:u.whatsappQueue.name?u.whatsappQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","whatsappQueue","userProfileSection"],angular.module("app.whatsapp").controller("WhatsappQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.whatsappQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="whatsappQueues",f.listOrder="",f.listOrderAsc=null,f.selectedWhatsappQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.whatsapp.whatsappQueues.edit",{id:e.id,whatsappQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"WhatsappQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:f.whatsappQueues?f.whatsappQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:f.whatsappQueues?f.whatsappQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("whatsappQueue")+"?").htmlContent("<b>"+(e.name||"whatsappQueue")+"</b> will be deleted.").ariaLabel("delete whatsappQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:2110}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.whatsapp.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.whatsapp.realtime.queues",{})}},f.success=E,f.getWhatsappQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.whatsappQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="WhatsappQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditWhatsappQueue=function(e,n){i.show({controller:"CreateOrEditWhatsappQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappQueue:n,whatsappQueues:f.whatsappQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteWhatsappQueue=y,f.exportSelectedWhatsappQueues=function(){var e=angular.copy(f.selectedWhatsappQueues);return f.selectedWhatsappQueues=[],e},f.deleteSelectedWhatsappQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected whatsappQueues?").htmlContent("<b>"+f.selectedWhatsappQueues.length+" selected</b> will be deleted.").ariaLabel("delete WhatsappQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedWhatsappQueues.forEach(function(e){y(e)}),f.selectedWhatsappQueues=[]})},f.deselectWhatsappQueues=function(){f.selectedWhatsappQueues=[]},f.selectAllWhatsappQueues=function(){f.selectedWhatsappQueues=f.whatsappQueues.rows};var b=!0,A=1;function E(e){f.whatsappQueues=e||{count:0,rows:[]}}function y(e){m.whatsappQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.whatsappQueues.rows,{id:e.id}),f.whatsappQueues.count-=1,f.whatsappQueues.rows.length||f.getWhatsappQueues(),p.success({title:_.startCase("WhatsappQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEwhatsappQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEwhatsappQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getWhatsappQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","whatsappQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.whatsapp").controller("WhatsappQueuesController",e)}(),function(){"use strict";function e(n,t,e,a,o,i,s,r,l,d,c,m,u){var p=this;function g(e,n){return{id:e,title:n.name||"NONAME",state:"app.dashboards.custom",stateParams:n,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(e)&&!r.hasRole("admin")}}}function v(e,n){return{id:e,title:n.name||"NONAME",state:"app.plugins.plugin",stateParams:n,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(e)&&!r.hasRole("admin")}}}function h(e,n){var t={user:_.pick(r.getCurrentUser(),["id","name","fullname","email","role","internal","interface"])};n.agentUrl=Mustache.render(n.agentUrl,t),i.saveItem("apps.home.plugin_"+e,{id:e,title:n.name,translate:n.name,state:"plugin_"+n.id,stateParams:n,view:"plugin",icon:n.icon,weight:12,hidden:function(){return!r.hasPermission(e)}})}function f(e){return _.map(e.children,function(e){return e.id})}s.clear(),p.isAgent=function(){return r.getCurrentUser()&&r.hasRole("agent")},o.saveItem("apps",{title:"APPS",group:!0,weight:1,hidden:function(){return r.hasRole("agent")}}),d.version.get().$promise.then(function(e){p.version=e&&e.current?e.current:"UNKNOWN"}).catch(function(){p.version="UNKNOWN"}).finally(function(){o.saveItem("version",{title:"VERSION "+p.version,group:!0,weight:2,hidden:function(){return r.hasRole("agent")}})}),r.isLoggedIn()&&(null===m.userSettings&&m.getUserSettingForUser(),l.gray&&s.warning({msg:e.instant("DASHBOARDS.LICENSE_EXPIRE_REMAINING_DAYS"),showClose:!0,timeout:!1}),d.dashboard.get().$promise.then(function(e){for(var n=0,t=0;t<e.rows.length;t+=1)n=99999+e.rows[t].id,o.saveItem("apps.dashboards.custom_"+n,g(n,e.rows[t]))}),d.plugin.get({active:!0}).$promise.then(function(e){var n=0;if(e.count){var t=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"agentOnly"!=e.sidebar});if(0<t.length){o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",permissions:{hidden:!0},weight:17,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}});for(var a=0;a<t.length;a+=1)n=88888+t[a].id,o.saveItem("apps.plugins.plugin_"+n,v(n,t[a]));o.sort()}var i=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"adminOnly"!=e.sidebar});if(0<i.length)for(var s=0;s<i.length;s+=1)h(n=88888+i[s].id,i[s])}})),l.custom&&!c.defaultPageTitle&&c.pageTitle&&angular.element("#pageTitle").html(c.pageTitle),o.saveItem("apps.dashboards",{id:100,title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",icon:"icon-tile-four",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.dashboards.general",{id:101,title:"General",route:"",translate:"DASHBOARDS.GENERAL",state:"app.dashboards.general",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(101)&&!r.hasRole("admin")}}),o.saveItem("apps.staff",{id:200,title:"Staff",translate:"STAFF.STAFF",icon:"icon-account-multiple",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.staff.users",{id:201,title:"Users",route:"user",translate:"STAFF.USERS",state:"app.staff.users",permissions:{hidden:!0},weight:1,hidden:function(){return r.hasRole("agent")||r.hasRole("user")||!r.hasPermission(201)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.agents",{id:202,title:"Agents",route:"user",translate:"STAFF.AGENTS",state:"app.staff.agents",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(202)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.telephones",{id:203,title:"Telephones",route:"user",translate:"STAFF.TELEPHONES",state:"app.staff.telephones",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(203)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.teams",{id:204,title:"Teams",route:"team",translate:"STAFF.TEAMS",state:"app.staff.teams",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(204)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.userProfiles",{id:205,title:"UserProfiles",route:"userProfile",translate:"STAFF.USERPROFILES",state:"app.staff.userProfiles",permissions:{hidden:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(205)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager",{id:300,title:"ContactManager",translate:"CONTACTMANAGER.CONTACTMANAGER",icon:"icon-account-circle",license:"cm",weight:4,hidden:function(){return!l.cm||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.lists",{id:301,title:"Lists",route:"cmList",translate:"CONTACTMANAGER.LISTS",state:"app.contactmanager.lists",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(301)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.companies",{id:302,title:"Companies",route:"cmCompany",translate:"CONTACTMANAGER.COMPANIES",state:"app.contactmanager.companies",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(302)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.globalCustomFields",{id:304,title:"GlobalCustomFields",route:"cmCustomField",translate:"CONTACTMANAGER.GLOBALCUSTOMFIELDS",state:"app.contactmanager.globalCustomFields",permissions:{association:!1},weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(304)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.contacts",{id:303,title:"Contacts",route:"",translate:"CONTACTMANAGER.CONTACTS",state:"app.contactmanager.contacts",permissions:{association:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(303)&&!r.hasRole("admin")}}),o.saveItem("apps.voice",{id:400,title:"Voice",translate:"VOICE.VOICE",icon:"icon-phone",license:"voice",weight:5,hidden:function(){return!l.voice||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voiceQueues",{id:401,title:"VoiceQueues",route:"voiceQueue",channel:"voice",translate:"VOICE.VOICEQUEUES",state:"app.voice.voiceQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(401)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.contexts",{id:405,title:"Contexts",route:"voiceContext",translate:"VOICE.CONTEXTS",state:"app.voice.contexts",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(405)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voicemails",{id:406,title:"Voicemails",route:"voiceMail",translate:"VOICE.VOICEMAILS",state:"app.voice.voicemails",weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(406)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.musiconholds",{id:407,title:"MusicOnHolds",route:"voiceMusicOnHold",translate:"VOICE.MUSICONHOLDS",state:"app.voice.musiconholds",weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(407)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voiceRecordings",{id:408,title:"VoiceRecordings",route:"voiceRecording",translate:"VOICE.VOICERECORDINGS",state:"app.voice.voiceRecordings",permissions:{association:!1,loading:!0},weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(408)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.chanSpies",{id:409,title:"ChanSpies",route:"voiceChanSpy",translate:"VOICE.CHANSPIES",state:"app.voice.chanSpies",weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(409)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voicePrefixes",{id:410,title:"VoicePrefixes",route:"voicePrefix",translate:"VOICE.VOICEPREFIXES",state:"app.voice.voicePrefixes",weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(410)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.inboundRoutes",{id:402,title:"InboundRoutes",route:"voiceExtension",translate:"VOICE.INBOUNDROUTES",state:"app.voice.inboundRoutes",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(402)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.outboundRoutes",{id:403,title:"OutboundRoutes",route:"voiceExtension",translate:"VOICE.OUTBOUNDROUTES",state:"app.voice.outboundRoutes",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(403)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.internalRoutes",{id:404,title:"InternalRoutes",route:"voiceExtension",translate:"VOICE.INTERNALROUTES",state:"app.voice.internalRoutes",weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(404)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.realtime",{id:411,title:"Realtime",route:"",translate:"VOICE.REALTIME",state:"app.voice.realtime",permissions:{association:!1,crud:!1},weight:11,hidden:function(){return r.hasRole("agent")||!r.hasPermission(411)&&!r.hasRole("admin")}}),o.saveItem("apps.chat",{id:500,title:"Chat",translate:"CHAT.CHAT",icon:"icon-hangouts",license:"chat",weight:6,hidden:function(){return!l.chat||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.chat.chatQueues",{id:501,title:"ChatQueues",route:"chatQueue",channel:"chat",translate:"CHAT.CHATQUEUES",state:"app.chat.chatQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(501)&&!r.hasRole("admin")}}),o.saveItem("apps.chat.chatWebsites",{id:502,title:"ChatWebsites",route:"chatWebsite",channel:"chat",translate:"CHAT.CHATWEBSITES",state:"app.chat.chatWebsites",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(502)&&!r.hasRole("admin")}}),o.saveItem("apps.chat.realtime",{id:510,title:"Realtime",route:"",translate:"CHAT.REALTIME",state:"app.chat.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(510)&&!r.hasRole("admin")}}),o.saveItem("apps.mail",{id:600,title:"Mail",translate:"MAIL.MAIL",icon:"icon-email",license:"mail",weight:7,hidden:function(){return!l.mail||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailQueues",{id:601,title:"MailQueues",route:"mailQueue",channel:"mail",translate:"MAIL.MAILQUEUES",state:"app.mail.mailQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(601)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailAccounts",{id:602,title:"MailAccounts",route:"mailAccount",channel:"mail",translate:"MAIL.MAILACCOUNTS",state:"app.mail.mailAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(602)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailSubtatuses",{id:603,title:"MailSubstatuses",route:"mailSubstatus",channel:"mail",translate:"MAIL.MAILSUBSTATUSES",state:"app.mail.mailSubtatuses",permissions:{association:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(603)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.realtime",{id:610,title:"Realtime",route:"",translate:"MAIL.REALTIME",state:"app.mail.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(610)&&!r.hasRole("admin")}}),o.saveItem("apps.sms",{id:700,title:"Sms",translate:"SMS.SMS",icon:"icon-message-text",license:"messaging",weight:8,hidden:function(){return!l.messaging||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.sms.smsQueues",{id:701,title:"SmsQueues",route:"smsQueue",channel:"sms",translate:"SMS.SMSQUEUES",state:"app.sms.smsQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(701)&&!r.hasRole("admin")}}),o.saveItem("apps.sms.smsAccounts",{id:702,title:"SmsAccounts",route:"smsAccount",channel:"sms",translate:"SMS.SMSACCOUNTS",state:"app.sms.smsAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(702)&&!r.hasRole("admin")}}),o.saveItem("apps.sms.realtime",{id:710,title:"Realtime",route:"",translate:"SMS.REALTIME",state:"app.sms.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(710)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel",{id:800,title:"Openchannel",translate:"OPENCHANNEL.OPENCHANNEL",icon:"icon-google-earth",license:"openchannel",weight:9,hidden:function(){return!l.openchannel||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.openchannelQueues",{id:801,title:"OpenchannelQueues",route:"openchannelQueue",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELQUEUES",state:"app.openchannel.openchannelQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(801)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.openchannelAccounts",{id:802,title:"OpenchannelAccounts",route:"openchannelAccount",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELACCOUNTS",state:"app.openchannel.openchannelAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(802)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.realtime",{id:810,title:"Realtime",route:"",translate:"OPENCHANNEL.REALTIME",state:"app.openchannel.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(810)&&!r.hasRole("admin")}}),o.saveItem("apps.fax",{id:900,title:"Fax",translate:"FAX.FAX",icon:"icon-deskphone",license:"fax",weight:10,hidden:function(){return!l.fax||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.fax.faxQueues",{id:901,title:"FaxQueues",route:"faxQueue",channel:"fax",translate:"FAX.FAXQUEUES",state:"app.fax.faxQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(901)&&!r.hasRole("admin")}}),o.saveItem("apps.fax.faxAccounts",{id:902,title:"FaxAccounts",route:"faxAccount",channel:"fax",translate:"FAX.FAXACCOUNTS",state:"app.fax.faxAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(902)&&!r.hasRole("admin")}}),o.saveItem("apps.fax.realtime",{id:910,title:"Realtime",route:"",translate:"FAX.REALTIME",state:"app.fax.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(910)&&!r.hasRole("admin")}}),o.saveItem("apps.tools",{id:1e3,title:"Tools",translate:"TOOLS.TOOLS",icon:"icon-auto-fix",weight:15,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.tools.cannedAnswers",{id:1001,title:"CannedAnswers",route:"cannedAnswer",translate:"TOOLS.CANNEDANSWERS",state:"app.tools.cannedAnswers",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1001)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.customDashboards",{id:1003,title:"CustomDashboards",route:"dashboard",translate:"TOOLS.CUSTOMDASHBOARDS",state:"app.tools.customDashboards",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1003)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.intervals",{id:1004,title:"Intervals",route:"interval",translate:"TOOLS.INTERVALS",state:"app.tools.intervals",weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1004)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.pauses",{id:1005,title:"Pauses",route:"pause",translate:"TOOLS.PAUSES",state:"app.tools.pauses",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1005)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.schedules",{id:1006,title:"Scheduler",route:"schedule",translate:"TOOLS.SCHEDULER",state:"app.tools.schedules",weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1006)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.sounds",{id:1007,title:"Sounds",route:"sound",translate:"TOOLS.SOUNDS",state:"app.tools.sounds",weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1007)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.tags",{id:1008,title:"Tags",route:"tag",translate:"TOOLS.TAGS",state:"app.tools.tags",weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1008)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.templates",{id:1009,title:"Templates",route:"template",translate:"TOOLS.TEMPLATES",state:"app.tools.templates",weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1009)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.trunks",{id:1011,title:"Trunks",route:"trunk",translate:"TOOLS.TRUNKS",state:"app.tools.trunks",weight:11,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1011)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.variables",{id:1012,title:"Variables",route:"variable",translate:"TOOLS.VARIABLES",state:"app.tools.variables",weight:12,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1012)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.contact_item_types",{id:1013,title:"ContactItemType",route:"contactItemType",translate:"TOOLS.CONTACTITEMTYPE",state:"app.tools.contact_item_types",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1013)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.dispositions",{id:1002,title:"Dispositions",route:"disposition",translate:"TOOLS.DISPOSITIONS",state:"app.tools.dispositions",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1002)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.triggers",{id:1010,title:"Triggers",route:"trigger",translate:"TOOLS.TRIGGERS",state:"app.tools.triggers",weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1010)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare",{id:1100,title:"CallySquare",translate:"CALLYSQUARE.CALLYSQUARE",icon:"icon-sitemap",license:"voice",weight:13,hidden:function(){return!l.voice||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.odbcs",{id:1101,title:"ODBC",route:"squareOdbc",translate:"CALLYSQUARE.ODBC",state:"app.callysquare.odbcs",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1101)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.squareRecordings",{id:1102,title:"SquareRecordings",route:"squareRecording",translate:"CALLYSQUARE.SQUARERECORDINGS",state:"app.callysquare.squareRecordings",permissions:{association:!1,loading:!0},weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1102)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.projects",{id:1103,title:"Projects",route:"squareProject",translate:"CALLYSQUARE.PROJECTS",state:"app.callysquare.projects",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1103)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics",{id:1200,title:"Analytics",translate:"ANALYTICS.ANALYTICS",icon:"icon-chart-line",weight:16,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.metrics",{id:1201,title:"Metrics",route:"analyticMetric",translate:"ANALYTICS.METRICS",state:"app.analytics.metrics",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1201)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.extractedReports",{id:1202,title:"ExtractedReports",route:"analyticExtractedReport",translate:"ANALYTICS.EXTRACTEDREPORTS",state:"app.analytics.extractedReports",permissions:{association:!1,loading:!0},weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1202)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.reports",{id:1203,title:"Reports",route:"",translate:"ANALYTICS.REPORTS",state:"app.analytics.reports",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1203)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations",{id:1300,title:"Integrations",translate:"INTEGRATIONS.INTEGRATIONS",icon:"icon-heart",weight:17,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.zendeskAccounts",{id:1301,title:"ZendeskAccounts",route:"intZendeskAccount",translate:"INTEGRATIONS.ZENDESKACCOUNTS",state:"app.integrations.zendeskAccounts",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1301)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.salesforceAccounts",{id:1302,title:"SalesforceAccounts",route:"intSalesforceAccount",translate:"INTEGRATIONS.SALESFORCEACCOUNTS",state:"app.integrations.salesforceAccounts",permissions:{association:!1,loading:!0},weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1302)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.freshdeskAccounts",{id:1303,title:"FreshdeskAccounts",route:"intFreshdeskAccount",translate:"INTEGRATIONS.FRESHDESKACCOUNTS",state:"app.integrations.freshdeskAccounts",permissions:{association:!1,loading:!0},weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1303)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.sugarcrmAccounts",{id:1305,title:"SugarcrmAccounts",route:"intSugarcrmAccount",translate:"INTEGRATIONS.SUGARCRMACCOUNTS",state:"app.integrations.sugarcrmAccounts",permissions:{association:!1,loading:!0},weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1305)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.deskAccounts",{id:1306,title:"DeskAccounts",route:"intDeskAccount",translate:"INTEGRATIONS.DESKACCOUNTS",state:"app.integrations.deskAccounts",permissions:{association:!1,loading:!0},weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1306)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.zohoAccounts",{id:1307,title:"ZohoAccounts",route:"intZohoAccount",translate:"INTEGRATIONS.ZOHOACCOUNTS",state:"app.integrations.zohoAccounts",permissions:{association:!1,loading:!0},weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1307)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.vtigerAccounts",{id:1308,title:"VtigerAccounts",route:"intVtigerAccount",translate:"INTEGRATIONS.VTIGERACCOUNTS",state:"app.integrations.vtigerAccounts",permissions:{association:!1,loading:!0},weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1308)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.dynamics365Accounts",{id:1309,title:"Dynamics365Accounts",route:"intDynamics365Account",translate:"INTEGRATIONS.DYNAMICS365ACCOUNTS",state:"app.integrations.dynamics365Accounts",permissions:{association:!1,loading:!0},weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1309)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.servicenowAccounts",{id:1310,title:"ServicenowAccounts",route:"intServicenowAccount",translate:"INTEGRATIONS.SERVICENOWACCOUNTS",state:"app.integrations.servicenowAccounts",permissions:{association:!1,loading:!0},weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1310)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.freshsalesAccounts",{id:1304,title:"FreshsalesAccounts",route:"intFreshsalesAccount",translate:"INTEGRATIONS.FRESHSALESACCOUNTS",state:"app.integrations.freshsalesAccounts",permissions:{association:!1,loading:!0},weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1304)&&!r.hasRole("admin")}}),o.saveItem("apps.settings",{id:1400,title:"Settings",translate:"SETTINGS.SETTINGS",icon:"icon-cog",permissions:{hidden:!0},weight:20,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")||r.hasRole("admin")&&!r.getCurrentUser().settingsEnabled}}),o.saveItem("apps.settings.generals",{id:1401,title:"General",route:"setting",translate:"SETTINGS.GENERAL",state:"app.settings.generals",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.smtps",{id:1402,title:"Smtp",route:"mailAccount",translate:"SETTINGS.SMTP",state:"app.settings.smtps",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.networks",{id:1403,title:"Networks",route:"network",translate:"SETTINGS.NETWORKS",state:"app.settings.networks",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.customizations",{id:1407,title:"Customizations",route:"setting",translate:"SETTINGS.CUSTOMIZATIONS",state:"app.settings.customizations",weight:1,hidden:function(){return!l.custom||r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.cloudProviders",{id:1408,title:"AiTools",route:"cloudProvider",translate:"SETTINGS.CLOUD_PROVIDERS",state:"app.settings.cloudProviders",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.updates",{id:1404,title:"Updates",route:"",translate:"SETTINGS.UPDATES",state:"app.settings.updates",weight:1,hidden:function(){return!l.update||r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.license",{id:1405,title:"License",route:"",translate:"SETTINGS.LICENSE",state:"app.settings.license",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.system",{id:1406,title:"System",route:"",translate:"SETTINGS.SYSTEM",state:"app.settings.system",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer",{id:1500,title:"MotionDialer",translate:"MOTIONDIALER.MOTIONDIALER",icon:"icon-fire",license:"dialer",weight:5,hidden:function(){return!l.dialer||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.queueCampaigns",{id:1501,title:"QueueCampaigns",route:"voiceQueue",channel:"bull",translate:"MOTIONDIALER.QUEUECAMPAIGNS",state:"app.motiondialer.queueCampaigns",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1501)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.ivrCampaigns",{id:1502,title:"IvrCampaigns",route:"campaign",translate:"MOTIONDIALER.IVRCAMPAIGNS",state:"app.motiondialer.ivrCampaigns",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1502)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.realtime",{id:1510,title:"Realtime",route:"",translate:"MOTIONDIALER.REALTIME",state:"app.motiondialer.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1510)&&!r.hasRole("admin")}}),o.saveItem("apps.help",{id:1600,title:"Help",translate:"HELP.HELP",icon:"icon-help",permissions:{association:!1},weight:21,hidden:function(){return!c.viewHelpSection||r.hasRole("agent")||!r.hasPermission(1600)&&!r.hasRole("admin")}}),o.saveItem("apps.help.about",{id:1601,title:"About",route:"",translate:"HELP.ABOUT",state:"app.help.about",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1600)&&!r.hasRole("admin")}}),o.saveItem("apps.jscripty",{id:1700,title:"jscripty",translate:"JSCRIPTY.JSCRIPTY",icon:"icon-script",license:"jscripty",weight:14,hidden:function(){return!l.jscripty||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.jscripty.projects",{id:1701,title:"Projects",route:"jscriptyProject",translate:"JSCRIPTY.PROJECTS",state:"app.jscripty.projects",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1701)&&!r.hasRole("admin")}}),o.saveItem("apps.marketplace",{id:1800,title:"Marketplace",translate:"MARKETPLACE.MARKETPLACE",icon:"icon-cart",weight:18,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.marketplace.plugins",{id:1801,title:"Plugins",route:"plugin",translate:"MARKETPLACE.PLUGINS",state:"app.marketplace.plugins",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1801)&&!r.hasRole("admin")}}),o.saveItem("apps.video",{id:2e3,title:"Video",translate:"VIDEO.VIDEO",icon:"icon-video",license:"screenrecording",weight:12,hidden:function(){return!l.screenrecording||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.video.screenRecordings",{id:2001,title:"ScreenRecordings",route:"screenRecording",translate:"VIDEO.SCREENRECORDINGS",state:"app.video.screenRecordings",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2001)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp",{id:2100,title:"Whatsapp",translate:"WHATSAPP.WHATSAPP",icon:"icon-whatsapp",license:"whatsapp",weight:11,hidden:function(){return!l.whatsapp||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.whatsappQueues",{id:2101,title:"WhatsappQueues",route:"whatsappQueue",channel:"whatsapp",translate:"WHATSAPP.WHATSAPPQUEUES",state:"app.whatsapp.whatsappQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2101)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.whatsappAccounts",{id:2102,title:"WhatsappAccounts",route:"whatsappAccount",channel:"whatsapp",translate:"WHATSAPP.WHATSAPPACCOUNTS",state:"app.whatsapp.whatsappAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2102)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.realtime",{id:2110,title:"Realtime",route:"",translate:"WHATSAPP.REALTIME",state:"app.whatsapp.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2110)&&!r.hasRole("admin")}}),o.sort(),i.saveItem("apps",{title:"APPS",group:!0,weight:1}),i.saveItem("apps.home",{id:100,title:"Home",translate:"DASHBOARDS.HOME",icon:"icon-home",weight:1}),i.saveItem("apps.home.dashboard",{id:101,title:"Dashboard",translate:"DASHBOARDS.DASHBOARD",state:"dashboard",view:"dashboard",icon:"icon-tile-four",iconClass:"cyan-500-fg",weight:1,hidden:function(){return!r.hasPermission(101)}}),i.saveItem("apps.home.agentPresence",{id:115,title:"AgentPresence",translate:"DASHBOARDS.AGENT_PRESENCE",state:"agentPresence",view:"agentPresence",icon:"icon-webcam",iconClass:"xenialab-violet-light-fg",weight:2,hidden:function(){return!r.hasPermission(115)}}),i.saveItem("apps.home.contacts",{id:102,title:"Contacts",translate:"DASHBOARDS.CONTACTS",state:"contacts",view:"contacts",icon:"icon-account-circle",iconClass:"red-fg",weight:3,hidden:function(){return!l.cm||!r.hasPermission(102)}}),i.saveItem("apps.home.mycontacts",{id:103,title:"Contacts",translate:"DASHBOARDS.MYCONTACTS",state:"mycontacts",view:"mycontacts",icon:"icon-account-multiple",iconClass:"red-fg",weight:4,hidden:function(){return!l.cm||!r.hasPermission(103)}}),i.saveItem("apps.home.scheduled",{id:113,title:"Scheduled Calls",translate:"DASHBOARDS.SCHEDULED_CALLS",state:"scheduled",view:"scheduled",icon:"icon-calendar-clock",iconClass:"blue-grey-fg",weight:5,hidden:function(){return!l.dialer||!r.hasPermission(113)}}),i.saveItem("apps.home.voice",{id:110,title:"Voice",translate:"DASHBOARDS.VOICE",state:"voice",view:"voice",icon:"icon-phone",iconClass:"blue-A700-fg",weight:6,hidden:function(){return!l.voice||!r.hasPermission(110)}}),i.saveItem("apps.home.abandoned",{id:111,title:"Abandoned",translate:"DASHBOARDS.ABANDONED",state:"abandoned",view:"abandoned",icon:"icon-phone-missed",iconClass:"blue-fg",weight:7,hidden:function(){return!l.voice||!r.hasPermission(111)}}),i.saveItem("apps.home.recordings",{id:104,title:"Recordings",translate:"DASHBOARDS.RECORDINGS",state:"recordings",view:"recordings",icon:"icon-audiobook",iconClass:"indigo-A100-fg",weight:8,hidden:function(){return!l.voice||!r.hasPermission(104)}}),i.saveItem("apps.home.chat",{id:105,title:"Chat",translate:"DASHBOARDS.CHAT",state:"chat",view:"chat",icon:"icon-hangouts",iconClass:"green-A700-fg",weight:9,hidden:function(){return!l.chat||!r.hasPermission(105)}}),i.saveItem("apps.home.mail",{id:106,title:"Mail",translate:"DASHBOARDS.MAIL",state:"mail",view:"mail",icon:"icon-email",iconClass:"teal-fg",weight:10,hidden:function(){return!l.mail||!r.hasPermission(106)}}),i.saveItem("apps.home.sms",{id:107,title:"Sms",translate:"DASHBOARDS.SMS",state:"sms",view:"sms",icon:"icon-message-text",iconClass:"orange-fg",weight:11,hidden:function(){return!l.messaging||!r.hasPermission(107)}}),i.saveItem("apps.home.openchannel",{id:108,title:"Openchannel",translate:"DASHBOARDS.OPENCHANNEL",state:"openchannel",view:"openchannel",icon:"icon-google-earth",iconClass:"amber-fg",weight:12,hidden:function(){return!l.openchannel||!r.hasPermission(108)}}),i.saveItem("apps.home.fax",{id:109,title:"Fax",translate:"DASHBOARDS.FAX",state:"fax",view:"fax",icon:"icon-deskphone",iconClass:"blue-grey-A200-fg",weight:13,hidden:function(){return!l.fax||!r.hasPermission(109)}}),i.saveItem("apps.home.whatsapp",{id:114,title:"Whatsapp",translate:"DASHBOARDS.WHATSAPP",state:"whatsapp",view:"whatsapp",icon:"icon-whatsapp",iconClass:"lime-A700-fg",weight:14,hidden:function(){return!l.whatsapp||!r.hasPermission(114)}}),n.$on("$viewContentAnimationEnded",function(e){e.targetScope.$id===n.$id&&t.$broadcast("msSplashScreen::remove")}),n.$on("socket:connect",function(){t.toastySocketLost&&(s.clear(t.toastySocketLost),t.toastySocketLost=void 0)}),n.$on("socket:disconnect",function(){t.toastySocketLost||s.warning({title:e.instant("TOOLBAR.WARNING"),msg:e.instant("DASHBOARDS.LOST_CONNECTION"),timeout:!1,onAdd:function(){t.toastySocketLost=this.id}})}),n.$on("client-side-logging:enabled",function(){"admin"!==r.getCurrentUser().role&&s.info({title:e.instant("STAFF.CLIENT_LOGS"),msg:e.instant("STAFF.CLIENT_LOGS_ENABLED_MSG")})}),n.$on("client-side-logging:disabled",function(){"admin"!==r.getCurrentUser().role&&s.info({title:e.instant("STAFF.CLIENT_LOGS"),msg:e.instant("STAFF.CLIENT_LOGS_DISABLED_MSG")})}),a.onbeforeunload=function(){r.isTelephone()||u.flush()}}e.$inject=["$scope","$rootScope","$translate","$window","msNavigationService","msNavigationAgentService","toasty","Auth","license","api","setting","UserSettingService","ClientSideLoggingService"],angular.module("motion").controller("MainController",e)}(),function(){"use strict";function e(e,n,t,a,o,r){var i=this;function s(e){if(e&&e.id){var n=99999+e.id;o.saveItem("apps.dashboards.custom_"+n,{id:n,title:e.name||"NONAME",state:"app.dashboards.custom",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(n)&&!r.hasRole("admin")}})}}function l(e){if(e&&e.id&&"never"!=e.sidebar)if(e.active){if("always"==e.sidebar||"adminOnly"==e.sidebar){o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1900)&&!r.hasRole("admin")}});var n=88888+e.id;o.saveItem("apps.plugins.plugin_"+n,{id:n,title:e.name||"NONAME",state:"app.plugins.plugin",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(n)&&!r.hasRole("admin")}}),o.sort()}}else{n=88888+e.id;t=1900,a=n,i=o.getNavigation(),(s=_.find(i[0].children,{id:t}))&&_.some(s.children,{id:a})&&("always"==e.sidebar||"adminOnly"==e.sidebar)&&(o.deleteItem("apps.plugins.plugin_"+n),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}var t,a,i,s}function d(e){var n=o.getNavigation(),t=_.find(n[0].children,{id:e});return!!(t&&0<t.children.length)}i.bodyEl=angular.element("body"),i.setting=t,i.$onInit=function(){i.folded="true"===n.get("motion.folded")||!1},i.toggleMsNavigationFolded=function(){i.folded=!i.folded,n.put("motion.folded",i.folded)},i.getLogo=function(){return i.setting.defaultHeaderWhiteLabel?"xCALLY Motion":i.setting.headerWhiteLabel},a.on("dashboard:save",s),a.on("dashboard:update",s),a.on("dashboard:remove",function(e){if(e&&e.id){var n=99999+e.id;o.deleteItem("apps.dashboards.custom_"+n)}}),a.on("plugin:save",l),a.on("plugin:update",l),a.on("plugin:remove",function(e){if(e&&e.id&&"never"!=e.sidebar){var n=88888+e.id;"always"!=e.sidebar&&"adminOnly"!=e.sidebar||(o.deleteItem("apps.plugins.plugin_"+n),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}}),e.$on("$stateChangeSuccess",function(){i.bodyEl.removeClass("ms-navigation-horizontal-mobile-menu-active")})}e.$inject=["$scope","$cookies","setting","socket","msNavigationService","Auth"],angular.module("app.navigation").controller("NavigationController",e)}(),function(){"use strict";function e(e,a,i,n,t,s,o,r){var l=this;function d(t){o.isSupported()?o.requestPermission().then(function(){var e,n;n={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"api/users/"+(e=t).FromId+"/avatar",body:e.body||"",focusOnclick:!0,closeOnClick:!0},o.show(a.instant("QUICKPANEL.NEW_INTERNAL_MESSAGE"),n)},function(e){console.error("Please enable browser notifications!",e)}):console.error("Browser notifications are not supported by the browser. Normal notifications will be used.")}l.date=moment().format(),l.currentUser=n.getCurrentUser(),l.license=r,l.unreadTotalMessages=0,l.unreadTotalGroupMessages=0,l.userIsNotPhonebar=function(){return"admin"===l.currentUser.role||"user"===l.currentUser.role||"agent"===l.currentUser.role&&0!==l.currentUser.showWebBar},l.onMessageSave=function(e){e.ToId===l.currentUser.id&&e.FromId!==l.currentUser.id&&!e.read&&e.ChatGroupId&&(l.unreadTotalGroupMessages++,d(e));e.ToId!==l.currentUser.id||e.ChatGroupId||(l.unreadTotalMessages+=1,d(e))},l.onMessageUpdate=function(e){e.ToId===l.currentUser.id&&e.read&&0<l.unreadTotalMessages&&!e.ChatGroupId&&(l.unreadTotalMessages-=1);e.ToId==l.currentUser.id&&e.FromId!==l.currentUser.id&&e.ChatGroupId&&e.read&&0<l.unreadTotalGroupMessages&&l.unreadTotalGroupMessages--},t.on("chatInternalMessage:save",l.onMessageSave),t.on("chatInternalMessage:update",l.onMessageUpdate),s.chatInternalMessage.get({fields:"FromId",ToId:l.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){return e&&e.count&&(l.unreadTotalMessages=e.count),s.user.getGroups({id:l.currentUser.id}).$promise}).then(function(e){for(var n=[],t=e.rows,a=0;a<t.length;a++)n.push(s.chatGroup.getUnread({id:t[a].id}).$promise);return i.all(n)}).then(function(e){for(var n=0;n<e.length;n++)l.unreadTotalGroupMessages+=e[n].count}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){t.removeAllListeners("chatInternalMessage:save"),t.removeAllListeners("chatInternalMessage:update")})}e.$inject=["$scope","$translate","$q","Auth","socket","api","desktopNotification","license"],angular.module("app.quick-panel").controller("QuickPanelController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l,d,c){var m=this;function u(){if(!m.hasMoreMessages||m.isLoading)return t.resolve();m.user.messages.length;return function(){m.isLoading=!0;var e={sort:"-createdAt",FromId:m.currentUser.id+","+m.user.id,ToId:m.currentUser.id+","+m.user.id,ChatGroupId:"null",limit:50,offset:m.user.messages.length};return r.chatInternalMessage.get(e).$promise.then(function(e){m.user.messages=m.user.messages.concat(e.rows),m.hasMoreMessages=e.count>m.user.messages.length;for(var n=0;n<m.user.messages.length;n+=1)!1===m.user.messages[n].read&&m.user.messages[n].ToId===m.currentUser.id&&r.chatInternalMessage.update({id:m.user.messages[n].id,read:!0})}).finally(function(){m.isLoading=!1})}()}function p(e){var n=angular.element("#chat-dialog");s(function(){n.animate({scrollTop:0},e)},0)}function g(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function v(e){return n.get(e).success(function(){c.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(){c.error({title:"PhoneBar API Error",msg:o.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}m.currentUser=l.getCurrentUser(),m.user=void 0,m.users={count:0,rows:[]},m.standardDate=moment(0).format("YYYY-MM-DD HH:mm:ss"),m.unreadMessages={},m.replyMessage="",m.disabled=!1,m.defaultAvatar="assets/images/avatars/profile.png",m.init=function(e){m.license=e,t.all([r.chatInternalMessage.get({fields:"FromId",ToId:m.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){m.unreadMessages=_.countBy(e.rows,"FromId")}).catch(function(e){throw e}),r.chatInternalMessage.getUsers().$promise.then(function(e){m.users=e}).catch(function(e){throw e})]).catch(function(e){c.error({msg:e.data?e.data.message:e.message||e})})},m.reply=function(){if(m.disabled=!0,""===m.replyMessage)return void(m.disabled=!1);var e={FromId:m.currentUser.id,ToId:m.user.id,body:m.replyMessage,read:!1};m.replyMessage="",r.chatInternalMessage.save(e).$promise.then(function(e){m.user.messages.unshift(e),m.user.lastMessageAt=e.createdAt,m.user.lastMessage=e}).finally(function(){p(400),m.disabled=!1})},m.webcall=function(e){a.$broadcast("webrtc::call",{target:g(e)})},m.call=function(e){return v("http://127.0.0.1:"+(m.user.phoneBarRemoteControlPort||"9888")+"/api/originate/"+g(e))},m.transfer=function(e){return v("http://127.0.0.1:"+(m.user.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+g(e))},m.beepPlayer=null,m.openChat=function(e){return m.user=angular.copy(e),m.isMessengerAllowed=!1,"agent"!==m.user.role||m.user.allowmessenger?(p(0),m.isMessengerAllowed=!0,m.hasMoreMessages=!0,u()):void c.warning({title:o.instant("QUICKPANEL.WARNING"),msg:o.instant("QUICKPANEL.MESSENGER_DISABLED")})},m.closeChat=function(){m.user=void 0,m.hasMoreMessages=!0},m.scrollToTopOfChat=p,d.on("chatInternalMessage:save",function(e){m.beepPlayer=document.getElementById("beep-player"),e.ToId===m.currentUser.id&&e.ToId!==e.FromId&&m.currentUser.messengerSoundNotification&&m.beepPlayer.play().catch(function(e){console.log(e.message)});if(e.ToId===m.currentUser.id&&!e.ChatGroupId){m.user&&m.user.id===e.FromId?(m.user.messages.unshift(e),p(0),r.chatInternalMessage.update({id:e.id,read:!0})):m.unreadMessages[e.FromId]=m.unreadMessages[e.FromId]?m.unreadMessages[e.FromId]+1:1;var n=_.find(m.users.rows,{id:e.FromId});n&&(n.lastMessageAt=e.createdAt,n.lastMessage=e)}}),d.on("chatInternalMessage:update",function(e){if((e.FromId===m.currentUser.id||e.ToId===m.currentUser.id)&&!e.ChatGroupId){if(m.user){var n=_.find(m.user.messages,{id:e.id});n&&_.merge(n,e)}var t=_.find(m.users.rows,{id:m.currentUser.id===e.FromId?e.ToId:e.FromId});t&&t.lastMessage&&_.merge(t.lastMessage,e),e.ToId===m.currentUser.id&&e.read&&0<m.unreadMessages[e.FromId]&&(m.unreadMessages[e.FromId]-=1)}}),d.on("user:update",function(e){var n=_.find(m.users.rows,{id:e.id});n&&(_.isNil(e.online)||n.online===e.online||(n.online=e.online),_.isNil(e.allowmessenger)||n.allowmessenger===e.allowmessenger||(n.allowmessenger=e.allowmessenger))}),e("quick-panel").onClose(function(){m.user=void 0}),m.loadMoreMessages=u,m.timelineOptions={scrollEl:"#chat-dialog"},i.$on("$destroy",function(){d.removeAllListeners("chatInternalMessage:save"),d.removeAllListeners("chatInternalMessage:update"),d.removeAllListeners("user:update")})}e.$inject=["$http","$mdSidenav","$q","$rootScope","$scope","$timeout","$translate","api","Auth","socket","toasty"],angular.module("app.quick-panel").controller("ChatInternalController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e){a.hide(e)}d.errors=[],d.title="QUICKPANEL.EDIT_CHATGROUP",d.group=angular.copy(r),d.currentUser=o.getCurrentUser(),d.members=l,d.newChatGroup=!0,d.group||(d.group={write:!0,members:[]},d.title="QUICKPANEL.NEW_CHATGROUP"),d.saveChatGroup=function(){var t;return d.errors=[],s.chatGroup.save({name:d.group.name,write:d.group.write}).$promise.then(function(e){var n=_.map(d.group.members,"id");return n.unshift(d.currentUser.id),t=e,s.chatGroup.addMembers({id:t.id,ids:n}).$promise}).then(function(){i.success({title:"Group properly saved!",msg:t.name+" has been saved!"}),c(t)}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.closeDialog=c,d.querySearch=function(e){return e?d.members.rows.filter((n=e,t=angular.lowercase(n),function(e){var n=e.name.toLowerCase();return-1!=n.indexOf(t)})):[];var n,t}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","Auth","group","members"],angular.module("app.quick-panel").controller("CreateOrEditChatGroupDialogController",e)}(),function(){"use strict";function e(e,t,a,s,n,o,i,r,l,d){var c=this;function m(){delete c.group}function u(e){var n=angular.element("#chat-group-dialog");a(function(){n.animate({scrollTop:n[0].scrollHeight},e)},0)}c.currentUser=i.getCurrentUser(),c.unreadGroupMessages={},c.groups={},c.participants,c.group,c.init=function(e){return c.license=e,r.user.getGroups({id:c.currentUser.id}).$promise.then(function(e){for(var n=0,t=[];n<e.rows.length;n++)e.rows[n].unreadGroupMessages=0,c.groups[e.rows[n].id]=e.rows[n],t.push(r.chatGroup.getUnread({id:e.rows[n].id}).$promise);return o.all(t)}).then(function(e){for(var n=0;n<e.length;n++)c.groups[e[n].id].unreadGroupMessages+=e[n].count}).catch(function(e){console.error(e)})},c.back=m,c.addGroup=function(e,n){s.show({controller:"CreateOrEditChatGroupDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/create/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{group:e,me:c.currentUser,license:null,setting:null},resolve:{members:function(){return i.hasRole("admin")?r.user.get({role:"agent"}).$promise:r.userProfile.getResources({id:i.getCurrentUser().userProfileId,section:"Agents",role:"agent"}).$promise}}}).then(function(e){e&&(c.groups[e.id]=e)}).catch(function(e){e&&console.error(e.message)})},c.deleteGroup=function(e,n){var t=s.confirm().title("Are you sure want to delete the selected group?").htmlContent("Group <b>"+e.name+"</b> will be deleted.").ariaLabel("delete Group").targetEvent(n).ok("OK").cancel("CANCEL");s.show(t).then(function(){return r.chatGroup.delete({id:e.id}).$promise}).then(function(){delete c.groups[e.id],d.success({title:"Group properly deleted!",msg:e.name+" has been deleted!"})}).catch(function(e){e&&d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatGroup.delete",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.groupsToArray=function(){return _.values(c.groups)},c.showMessageInfo=function(e,i){s.show({controller:"ShowMessageInfoDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/info/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{message:i},resolve:{data:function(){var a={messages:[]};return r.chatInternalMessage.get({ChatInternalMessageId:i.id}).$promise.then(function(e){var n=[];a.messages=e.rows,a.messages.unshift(i);for(var t=0;t<a.messages.length;t++)n.push(r.user.get({id:a.messages[t].ToId,fields:"id,name,fullname,userpic"}).$promise);return o.all(n)}).then(function(e){return a.users=e,a}).catch(function(e){e&&console.error(e)})}}}).then(function(){}).catch(function(e){e&&console.error(e.message)})},c.toggleChat=function(n){c.group={id:n.id,write:n.write,messages:{}},r.chatGroup.getMembers({id:n.id,fields:"id,name,fullname"}).$promise.then(function(e){return c.group.membersByKeys=_.keyBy(e.rows,"id"),c.group.members=_.differenceBy(e.rows,[{id:c.currentUser.id}],"id"),c.participants=_.map(c.group.members,"fullname").join(", "),r.chatGroup.getMessages({id:n.id,nolimit:!0}).$promise}).then(function(e){for(var n,t=0,a=[];t<e.count;t++)e.rows[t].ToId===c.currentUser.id&&(n=e.rows[t],c.group.messages[n.id]=n,e.rows[t].ToId!=c.currentUser.id||e.rows[t].FromId===c.currentUser.id||n.read||a.push(r.chatInternalMessage.update({id:n.id,read:!0})));return o.all(a)}).then(function(){u(400)}).catch(function(e){console.error(e.message)})},c.reply=function(){if(!c.replyMessage)return;var t={id:c.group.id,FromId:c.currentUser.id,ToId:c.currentUser.id,body:c.replyMessage,read:!0},a=[];c.replyMessage="",r.chatGroup.addMessage(t).$promise.then(function(e){t.read=!1,t.ChatInternalMessageId=e.id;for(var n=0;n<c.group.members.length;n++)c.group.members[n].id!==c.currentUser.id&&(t.ToId=c.group.members[n].id,a.push(r.chatGroup.addMessage(angular.copy(t)).$promise));return o.all(a)}).catch(function(e){console.log(e)})},l.on("chatInternalMessage:save",function(n){if(!c.group&&n.ToId===c.currentUser.id&&n.FromId!==c.currentUser.id&&!n.read&&n.ChatGroupId){var e=c.groups[n.ChatGroupId];if(!e)return r.chatGroup.get({id:n.ChatGroupId}).$promise.then(function(e){e.unreadGroupMessages=1,c.groups[e.id]=e});e.unreadGroupMessages||(e.unreadGroupMessages=0),e.unreadGroupMessages++}c.group&&n.ChatGroupId===c.group.id&&n.ToId===c.currentUser.id&&r.chatInternalMessage.update({id:n.id,read:!0}).$promise.then(function(){var e;e=n,c.group.messages[e.id]=e,u(400)})}),l.on("chatInternalMessage:update",function(e){e.ToId==c.currentUser.id&&e.FromId!==c.currentUser.id&&e.ChatGroupId&&e.read&&(0<c.groups[e.ChatGroupId].unreadGroupMessages&&c.groups[e.ChatGroupId].unreadGroupMessages--,c.group.messages[e.id]&&(c.group.messages[e.id].read=!0))}),l.on("chatGroup:remove",function(e){c.groups[e.id]&&delete c.groups[e.id]}),n("quick-panel").onClose(m),e.$on("$destroy",function(){l.removeAllListeners("chatInternalMessage:save"),l.removeAllListeners("chatInternalMessage:update"),l.removeAllListeners("chatGroup:remove")})}e.$inject=["$scope","$document","$timeout","$mdDialog","$mdSidenav","$q","Auth","api","socket","toasty"],angular.module("app.quick-panel").controller("ChatGroupController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r){this.data=r,this.title="QUICKPANEL.INFO",this.closeDialog=function(){a.hide()}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","Auth","data"],angular.module("app.quick-panel").controller("ShowMessageInfoDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.form={token:s.token},o.setting={},o.resetPassword=function(){return i.auth.reset(o.form).$promise.then(function(){n.success({title:t.instant("RESETPASSWORD.PASSWORD_RESET"),msg:t.instant("RESETPASSWORD.PASSWORD_RESET_MESSAGE")}),a.go("app.login")}).catch(function(e){e&&n.error({title:t.instant("RESETPASSWORD.PASSWORD_RESET_ERROR"),msg:e.data?e.data.message||e.message||e:e.message||e})})},o.onInit=function(){e.isLoggedIn()&&a.go("app.dashboards.general");return i.setting.gdpr({id:1}).$promise.then(function(e){o.setting=e,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:""}).catch(function(e){e&&n.error({title:"Error",msg:e.data?e.data.message||e.message||e:e.message||e})})}}e.$inject=["Auth","toasty","$translate","$state","api","$stateParams"],angular.module("app.reset").controller("ResetPasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){u()}function u(){s.user.get({id:c.user.id}).$promise.then(function(e){c.user.permissions=e.permissions,c.items=[{font_icon:"icon-hangouts",class:"green-700-fg",label:"chat",title:"TOOLBAR.CHAT",value:"chat",permission:r.chat&&(p(105)||e.chatAutoanswer),enabled:e.chatAutoanswer,delay:e.chatAutoanswerDelay},{font_icon:"icon-email",class:"teal-fg",label:"email",title:"TOOLBAR.EMAIL",value:"email",permission:r.mail&&(p(106)||e.emailAutoanswer),enabled:e.emailAutoanswer,delay:e.emailAutoanswerDelay},{font_icon:"icon-message-text",class:"orange-fg",label:"sms",title:"TOOLBAR.SMS",value:"sms",permission:r.messaging&&(p(107)||e.smsAutoanswer),enabled:e.smsAutoanswer,delay:e.smsAutoanswerDelay},{font_icon:"icon-google-earth",class:"amber-fg",label:"openchannel",title:"TOOLBAR.OPENCHANNEL",value:"openchannel",permission:r.openchannel&&(p(108)||e.openchannelAutoanswer),enabled:e.openchannelAutoanswer,delay:e.openchannelAutoanswerDelay},{font_icon:"icon-deskphone",class:"grey-A200-fg",label:"fax",title:"TOOLBAR.FAX",value:"fax",permission:r.fax&&(p(109)||e.faxAutoanswer),enabled:e.faxAutoanswer,delay:e.faxAutoanswerDelay},{font_icon:"icon-whatsapp",class:"lime-A700-fg",label:"whatsapp",title:"TOOLBAR.WHATSAPP",value:"whatsapp",permission:r.whatsapp&&(p(114)||e.whatsappAutoanswer),enabled:e.whatsappAutoanswer,delay:e.whatsappAutoanswerDelay}]})}function p(e){return _.includes(c.user.permissions,e)}c.items=[],c.closeDialog=function(){a.hide()},c.user=d.getCurrentUser(),u(),o.connect(),o.on("userNotification:recalc:"+c.user.id,m)}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","socket","license","user","Auth"],angular.module("app.toolbar").controller("AutoAnswerNotificationsDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.errors=[],r.user=i,r.setting=s,r.reset=o,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.savePassword=function(){r.errors=[],a.user.changePassword({id:r.user.id},{oldPassword:r.oldPassword,newPassword:r.password}).$promise.then(function(){n.show(n.simple().textContent("Your password properly updated").position("top right").hideDelay(5e3)),l()}).catch(function(e){console.error(e),r.errors=e.data.errors&&e.data.errors.length?e.data.errors:[{message:e.data.message||"Authorization error",type:"api.user.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.changePasswordForm.password.$setValidity("oldPasswordMatch",!1):t.changePasswordForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","$mdToast","api","user","setting","reset"],angular.module("app.toolbar").controller("ChangePasswordController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o){var r=this;function l(e,n){var t={id:e.id};n?t.recallmeNotifiedDate=null:r.isRecallNotification?t.recallmeNotifiedDate=null:e.recallme||(t.UserId=null),i.cmHopper.update(t)}function d(e){var n=!1;_.isNil(e)||(n=e),l(r.preview,n),t.hide()}function c(e){return i.cmContact.getAdditionalPhones({id:e}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");r.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");r.additionalItems=[];for(var s=0;s<n.length;s++)r.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})})}r.customFieldsMap=s&&s.rows?_.mapValues(_.keyBy(s.rows,function(e){return"cf_"+e.id}),"name"):{},r.errors=[],r.hopperIds=[],r.additionalItems=[],r.preview=n,r.isRecallNotification=o,r.originated=!1,r.disable=!1,r.disableGetContact=!1,r.hopperIds.push(r.preview.id),r.originatePreview=function(){r.originated=!0,r.disable=!0,_.isEmpty(r.preview)?(a.error({title:"Message",msg:"Contact not available"}),r.disable=!1,r.hopperIds=[],d(!0)):i.rpc.getVoiceQueuesPreview({id:r.preview.id}).$promise.then(function(){d(!0)}).catch(function(e){a.error({title:"Message",msg:e.data}),d(!0)}).finally(function(){r.disable=!1,r.hopperIds=[]})},r.closeDialog=d,r.nextContact=function(){return r.disableGetContact=!0,i.cmHopper.getPreview({hopperIds:r.hopperIds,direction:"next"}).$promise.then(function(e){r.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(r.hopperIds=[],t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e,r.hopperIds.push(r.preview.id))}).catch(function(e){if(r.disableGetContact=!1,r.hopperIds=[],404===e.status)r.getFirstAvailableContact();else if(e.data&&e.data.errors&&e.data.errors.length){t.hide();for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.hide(),a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.previousContact=function(){if(r.disableGetContact=!0,1<r.hopperIds.length){var e=_.without(r.hopperIds,r.preview.id);return i.cmHopper.getPreview({hopperIds:e,direction:"prev"}).$promise.then(function(e){r.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(r.hopperIds=[],t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),_.remove(r.hopperIds,function(e){return e==r.preview.id}),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e)}).catch(function(e){if(404===e.status)r.hopperIds=[r.preview.id],a.info({title:"PREVIEW",msg:"PREVIOUS CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){r.hopperIds=[],t.hide();for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.hopperIds=[],t.hide(),a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}},r.getFirstAvailableContact=function(){return r.disableGetContact=!0,a.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE. REWINDING THE LIST"}),i.cmHopper.getPreview({hopperIds:[r.preview.id],direction:"next"}).$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e,r.hopperIds.push(r.preview.id))}).catch(function(e){if(t.hide(),404===e.status)a.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){r.disableGetContact=!1})},r.isCustomField=function(e){return _.startsWith(e,"cf_")},r.isHiddenField=function(e){return _.includes(["Company","CompanyId","ListId","UserId","createdAt","deletedAt","id","dialTimezone","utcOffset","AdditionalPhones","additionalPhones","priority","scheduledat","tags","updatedAt","facebook","twitter","skype","wechat","teams","viber","line","telegram"],e)},r.isNil=function(e){return _.isNil(e)},_.isNil(r.preview)||c(r.preview.Contact.id),e.$on("$destroy",function(){r.originated||l(r.preview,!1)})}e.$inject=["$scope","$mdDialog","toasty","api","preview","customFields","isRecallNotification"],angular.module("app.toolbar").controller("PreviewDialogController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(n,t,s,a,o,e,i,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S){var T,I=this;I.voiceQueues=[],I.polling=!0,t.global={search:""},I.pauses=[],I.license=b,I.currentUser=v.getCurrentUser(),I.unreadTotalMessages=0,I.unreadTotalGroupMessages=0,I.contacts=0,"agent"===I.currentUser.role&&(T=E(function(){_.some(I.voiceQueues,{dialMethod:"preview",dialActive:!0})&&I.license.dialer&&I.polling?(I.polling=!1,f.cmHopper.getOpenContacts().$promise.then(function(e){e&&_.isNumber(e.contacts)&&(I.contacts=e.contacts)}).finally(function(){I.polling=!0})):I.contacts=0},14999)),I.setting=A,I.bodyEl=angular.element("body"),I.conf={realm:"asterisk",host:e.host(),protocol:e.protocol(),soundPlayerId:"local-audio",remotePlayerId:"remote-audio",ua:"Motion WebRTC Bar 0.2.0",license:I.license.webrtc,phoneBarExpires:I.currentUser.phoneBarExpires,phoneBarPrefixRequired:I.currentUser.phoneBarPrefixRequired,wssPort:I.currentUser.wssPort},I.webRTCSessions=[],I.autoanswerIconColor="green-700-fg",I.userStatusOptions=[{title:"Online",icon:"icon-checkbox-marked-circle",color:"#4CAF50"},{title:"Away",icon:"icon-clock",color:"#FFC107"},{title:"Do not Disturb",icon:"icon-minus-circle",color:"#F44336"},{title:"Invisible",icon:"icon-checkbox-blank-circle-outline",color:"#BDBDBD"},{title:"Offline",icon:"icon-checkbox-blank-circle-outline",color:"#616161"}],I.languages={ar:{title:"Arabic",translation:"TOOLBAR.ARABIC",code:"ar",flag:"ar"},bs:{title:"Bosnian",translation:"TOOLBAR.BOSNIAN",code:"bs",flag:"bs"},cs:{title:"Czech",translation:"TOOLBAR.CZECH",code:"cs",flag:"cs"},da:{title:"Danish",translation:"TOOLBAR.DANISH",code:"da",flag:"da"},de:{title:"German",translation:"TOOLBAR.GERMAN",code:"de",flag:"de"},en:{title:"English",translation:"TOOLBAR.ENGLISH",code:"en",flag:"us"},es:{title:"Spanish",translation:"TOOLBAR.SPANISH",code:"es",flag:"es"},et:{title:"Estonian",translation:"TOOLBAR.ESTONIAN",code:"et",flag:"et"},fa:{title:"Persian",translation:"TOOLBAR.PERSIAN",code:"fa",flag:"fa"},fi:{title:"Finnish",translation:"TOOLBAR.FINNISH",code:"fi",flag:"fi"},fr:{title:"French",translation:"TOOLBAR.FRENCH",code:"fr",flag:"fr"},he:{title:"Hebrew",translation:"TOOLBAR.HEBREW",code:"he",flag:"he"},hi:{title:"Hindi",translation:"TOOLBAR.HINDI",code:"hi",flag:"hi"},hu:{title:"Hungarian",translation:"TOOLBAR.HUNGARIAN",code:"hu",flag:"hu"},id:{title:"Indonesian",translation:"TOOLBAR.INDONESIAN",code:"id",flag:"id"},it:{title:"Italian",translation:"TOOLBAR.ITALIAN",code:"it",flag:"it"},ja:{title:"Japanese",translation:"TOOLBAR.JAPANESE",code:"ja",flag:"ja"},ko:{title:"Korean",translation:"TOOLBAR.KOREAN",code:"ko",flag:"ko"},lv:{title:"Latvian",translation:"TOOLBAR.LATVIAN",code:"lv",flag:"lv"},nl:{title:"Dutch",translation:"TOOLBAR.DUTCH",code:"nl",flag:"nl"},no:{title:"Norwegian",translation:"TOOLBAR.NORWEGIAN",code:"no",flag:"no"},pl:{title:"Polish",translation:"TOOLBAR.POLISH",code:"pl",flag:"pl"},"pt-BR":{title:"Brazilian",translation:"TOOLBAR.BRAZILIAN",code:"pt-BR",flag:"pt-BR"},"pt-PT":{title:"Portuguese",translation:"TOOLBAR.PORTUGUESE",code:"pt-PT",flag:"pt-PT"},ru:{title:"Russian",translation:"TOOLBAR.RUSSIAN",code:"ru",flag:"ru"},sv:{title:"Swedish",translation:"TOOLBAR.SWEDISH",code:"sv",flag:"sv"},tr:{title:"Turkish",translation:"TOOLBAR.TURKISH",code:"tr",flag:"tr"},"zh-CN":{title:"ChineseSimplified",translation:"TOOLBAR.CHINESESIMPLIFIED",code:"zh-CN",flag:"zh-CN"},"zh-TW":{title:"ChineseTraditional",translation:"TOOLBAR.CHINESETRADITIONAL",code:"zh-TW",flag:"zh-TW"}},I.isWebRTCBarRegistered=!1;var O=["ar","fa","he"],C=S.getLogger("toolbar");function w(n){n.queuecallerleaveAt?I.waitingQueueCalls=_.filter(I.waitingQueueCalls,function(e){return e!==n.uniqueid}):I.waitingQueueCalls.push(n.uniqueid)}function R(e){w(e)}function x(e){"inbound"===e.type&&w(e)}function N(){h.connect(),h.on("user:update",H),h.on("user:called",V),h.on("chatInternalMessage:save",F),h.on("chatInternalMessage:update",$),h.on("userVoiceQueue:save",k),h.on("voiceQueue:save",L),h.on("userVoiceQueue:remove",k),h.on("voiceQueue:remove",L),h.on("voiceQueue:update",L),h.on("user:forcelogout",B),h.on("userNotification:send",Q),h.on("userNotification:recalc:"+I.user.id,j),h.onWithoutApply("voice_queue_channel:save",x),h.onWithoutApply("voice_queue_channel:remove",R)}function D(){h.disconnect("logout")}function P(){var e={id:v.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",nolimit:!0};return f.user.getQueues(e).$promise.then(function(e){I.voiceQueues=e.rows})}function L(){P()}function k(e){_.toInteger(e.UserId)===v.getCurrentUser().id&&P()}function M(e,n,t){n||(n=!1),t||(t={type:"click",target:"button.preview-button"}),c.show({controller:"PreviewDialogController",controllerAs:"vm",templateUrl:"app/toolbar/preview/dialog.html",parent:angular.element(m.body),targetEvent:t,clickOutsideToClose:!0,locals:{preview:e,currentUser:I.currentUser,isRecallNotification:n},resolve:{customFields:["apiResolver",function(e){return e.resolve("cmCustomField@get",{nolimit:!0})}]}})}function U(){return I.license.chat&&(I.hasPermission(105)||I.currentUser.chatAutoanswer)||I.license.mail&&I.hasPermission(106)||I.currentUser.emailAutoanswer||I.license.messaging&&I.hasPermission(107)||I.currentUser.smsAutoanswer||I.license.openchannel&&I.hasPermission(108)||I.currentUser.openchannelAutoanswer||I.license.fax&&I.hasPermission(109)||I.currentUser.faxAutoanswer||I.license.whatsapp&&(I.hasPermission(114)||I.currentUser.whatsappAutoanswer)}function F(e){e.ToId!==I.currentUser.id||e.ChatGroupId||(I.unreadTotalMessages+=1),e.ToId===I.currentUser.id&&e.FromId!==I.currentUser.id&&!e.read&&e.ChatGroupId&&I.unreadTotalGroupMessages++}function $(e){e.ToId===I.currentUser.id&&e.read&&0<I.unreadTotalMessages&&!e.ChatGroupId&&(I.unreadTotalMessages-=1),e.ToId===I.currentUser.id&&e.read&&e.ChatGroupId&&0<I.unreadTotalGroupMessages&&I.unreadTotalGroupMessages--}function q(e){return D(),s.resolve().then(function(){if(!v.isTelephone())return S.flush()}).then(function(){return v.logout(e)}).then(function(){return t.$broadcast("webrtc::logout"),a.go("app.login")}).catch(function(e){C.error(e)})}function G(e,n){c.show({controller:"ChangePasswordController",controllerAs:"vm",templateUrl:"app/toolbar/changepassword/changepassword.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!n,escapeToClose:!n,locals:{user:I.user,setting:A,reset:n}})}function H(e){if(e.id===I.user.id)if("agent"===e.role&&_.isBoolean(e.online)&&!e.online)if(0!==I.user.showWebBar){var n;D();var t=c.confirm({title:r.instant("TOOLBAR.WARNING")+"!",htmlContent:"<span>"+r.instant("TOOLBAR.SOMEONE_LOGGED_YOU_OUT")+"</span><br><span>"+r.instant("TOOLBAR.SESSION_TIMEOUT")+"</span>",ariaLabel:r.instant("TOOLBAR.WARNING")+"!",ok:r.instant("TOOLBAR.STAY_LOGGED"),cancel:r.instant("TOOLBAR.LOGOUT"),onComplete:function(){n=setTimeout(function(){c.cancel()},6e4)}});c.show(t).then(function(){return clearTimeout(n),v.queueLogin().then(function(){N(),_.merge(I.user,e),v.setCurrentUser(I.user)})}).catch(function(){clearTimeout(n),q(!0)})}else q(!0);else _.merge(I.user,e),v.setCurrentUser(I.user)}function V(e){if(I.isWebRTCBarRegistered&&2===I.currentUser.showWebBar&&"agent"===I.currentUser.role){var n=I.currentUser.privacyEnabled?y.mask(e.calleridnum):e.calleridnum;p.info({title:"WebRTC Popup",msg:"<div>            <span>Call from: "+n+"</span><br>            <span>Queue: "+e.queue+"</span><br>            <span>Extra: "+(e.variables.extravar?e.variables.extravar:"Not defined")+"</span><br>            </div>",showClose:!0,timeout:1e4,html:!0})}}function B(e){if(C.debug("onForceLogout -> data",e),e.user.id===I.user.id&&0!==I.user.showWebBar)return D(),s.resolve().then(function(){if(!v.isTelephone())return S.flush()}).then(function(){return v.logout(!0)}).then(function(){t.$broadcast("webrtc::logout"),c.show(c.alert().parent(angular.element(m.body)).clickOutsideToClose(!1).escapeToClose(!1).title(r.instant("TOOLBAR.WARNING")).textContent(r.instant("TOOLBAR.USER_FORCE_LOGOUT",{ip:e.ip})).ok("OK")).then(function(){return a.go("app.login")})}).catch(function(e){C.error(e)})}function Q(e){var n=e;if(I.currentUser.id===n.recipient){var t=r.instant("TOOLBAR.NOTIFICATION_TITLE",{sender:n.sender}),a=n.description?r.instant("TOOLBAR.NOTIFICATION_TITLE_RECIPIENT",{recipient:n.description}):null;p.wait({title:a?t+" "+a:t,msg:n.content,clickToClose:!1,timeout:!1,sound:n.beep,html:!0})}}function W(){I.autoanswerIconColor=U()?"green-700-fg":"gray-700-fg"}function j(e){e&&e.permissions&&(I.currentUser.permissions=e.permissions,W())}I.toggleSidenav=function(e){i(e).toggle()},I.logout=q,I.changeLanguage=function(e){if(!I.languages.hasOwnProperty(e.code)){return void l.show({template:'<md-toast id="language-message" layout="column" layout-align="center start"><div class="md-toast-content">Motion supports multiple translations through angular-translate module, but currently we do not support the selected language. If you want to help us, send us a message.</div></md-toast>',hideDelay:7e3,position:"top right",parent:"#content"})}I.selectedLanguage=e,u.put("motion.language",e.code),r.use(e.code),"app.callysquare.projects.edit"===a.current.name&&d.location.reload();0<=O.indexOf(e.code)?p.info({title:r.instant("TOOLBAR.CHANGE_LANGUAGE_TITLE"),msg:r.instant("TOOLBAR.CHANGE_LANGUAGE_MESSAGE")}):n.$parent.$parent.vm.direction="ltr"},I.setUserStatus=function(e){I.userStatus=e},I.toggleHorizontalMobileMenu=function(){I.bodyEl.toggleClass("ms-navigation-horizontal-mobile-menu-active")},I.toggleMsNavigationFolded=function(){g.toggleFolded()},I.search=function(n){for(var e=[],t=g.getFlatNavigation(),a=s.defer(),i=0;i<t.length;i++)t[i].uisref&&e.push(t[i]);n&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(n)))return!0}));return o(function(){a.resolve(e)},1e3),a.promise},I.searchResultClick=function(e){e.uisref&&(e.stateParams?a.go(e.state,e.stateParams):a.go(e.state))},I.openSettings=function(){t.$broadcast("webrtc::settings")},I.changePassword=G,I.isAgent=function(){return v.getCurrentUser()&&v.hasRole("agent")},I.pause=function(e){var n=e||"DEFAULT PAUSE";_.some(I.webRTCSessions,["confirmed",!0])&&(n="#"+n);return f.user.pause({id:I.user.id,type:n}).$promise.catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:PAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})})},I.unpause=function(){return f.user.unpause({id:I.user.id}).$promise.catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UNPAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})})},I.preview=function(n){return I.disable=!0,f.cmHopper.getPreview().$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?p.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"}):M(e,!1,n)}).catch(function(e){if(404===e.status)p.info({title:"PREVIEW",msg:"CONTACT NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){I.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){I.disable=!1})},I.autoAnswerNotificationsDialog=function(e){U()?c.show({controller:"AutoAnswerNotificationsDialogController",controllerAs:"vm",templateUrl:"app/toolbar/autoanswers/dialog.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:I.license,user:I.currentUser}}):alert(r.instant("TOOLBAR.NO_AUTOANSWER_CONFIGURED"))},I.getLogo=function(){return I.setting.defaultHeaderWhiteLabel?"xCALLY Motion":I.setting.headerWhiteLabel},I.userIsNotPhonebar=function(){return"admin"===I.currentUser.role||"user"===I.currentUser.role||"agent"===I.currentUser.role&&0!==I.currentUser.showWebBar},I.hasPermission=function(e){return _.includes(I.currentUser.permissions,e)},I.waitingQueueCalls=[],function(){I.user=v.getCurrentUser(),P().then(function(){return f.rpc.getVoiceQueuesChannels().$promise}).then(function(e){e.rows.forEach(function(n){if("inbound"===n.type&&!n.queuecallerleaveAt){var e=_.find(I.voiceQueues,function(e){return e.name===n.queue});e&&I.waitingQueueCalls.push(n.uniqueid)}})}),I.conf.ha1=I.user.md5secret,I.conf.id=I.user.id,I.conf.name=I.user.name,I.conf.fullname=I.user.fullname,I.conf.internal=I.user.internal,I.conf.recording=I.user.phoneBarEnableRecording,I.conf.autoAnswer=I.user.phoneBarAutoAnswer,I.conf.enableSettings=I.user.phoneBarEnableSettings,I.conf.enableDtmfTone=I.user.phoneBarEnableDtmfTone,I.conf.autoAnswerDelay=I.user.phoneBarAutoAnswerDelay,I.userStatus=I.userStatusOptions[0];var e=u.get("motion.language");e&&I.languages.hasOwnProperty(e)?I.selectedLanguage=I.languages[e]:I.selectedLanguage=I.languages[r.preferredLanguage()];if(f.pause.get({fields:"name",nolimit:!0}).$promise.then(function(e){I.pauses=e.rows?e.rows:[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETPAUSES",msg:e.status?JSON.stringify(e.data):e.toString()})}),"LOCAL_LOGIN"==v.getAuthenticationType()&&I.setting.securePassword)if(I.user.passwordResetAt){var n=moment(I.user.passwordResetAt).add(I.setting.passwordExpiresDays||90,"day");moment().isAfter(n)?G(null,!0):moment().add(15,"day").isAfter(n)&&p.warning({title:r.instant("TOOLBAR.WARNING")+"!",msg:r.instant("TOOLBAR.PASSWORD_EXPIRE_REMAINING_DAYS")+": "+Math.ceil(n.diff(moment(),"days",!0)),timeout:2e4})}else G(null,!0);W()}(),N(),I.openPreviewDialog=M,f.chatInternalMessage.get({fields:"FromId",ToId:I.currentUser.id,read:!1,nolimit:!0}).$promise.then(function(e){I.unreadTotalMessages=e.rows.length}),n.$on("$destroy",function(){h.removeAllListeners("user:called"),h.removeAllListeners("user:update"),h.removeAllListeners("chatInternalMessage:save"),h.removeAllListeners("chatInternalMessage:update"),h.removeAllListeners("userVoiceQueue:save"),h.removeAllListeners("voiceQueue:save"),h.removeAllListeners("userVoiceQueue:remove"),h.removeAllListeners("voiceQueue:remove"),h.removeAllListeners("voiceQueue:update"),h.removeAllListeners("user:forcelogout"),h.removeAllListeners("userNotification:send"),h.removeAllListeners("userNotification:recalc:"+I.user.id),T&&(E.cancel(T),T=null)})}e.$inject=["$scope","$rootScope","$q","$state","$timeout","$location","$mdSidenav","$translate","$mdToast","$window","$mdDialog","$document","$cookies","toasty","msNavigationService","Auth","socket","api","license","setting","$interval","privacyManager","ClientSideLoggingService"],angular.module("app.toolbar").controller("ToolbarController",e)}(),function(){"use strict";function e(a,i,t,s,e){var n={updateUserSettingById:function(e,n){if("number"==typeof e)return i.userSetting.update({id:e},n).$promise;throw new Error("User setting id is missing")}},o=!1,r=a.getCurrentUser(),l=r?r.userSetting:null,d=function(e){var n="user-setting:update:user-"+e;t.$on("local:user-updated",c),s.on(n,c)};function c(){return o?e(function(e){e(l)}):(o=!0,function(e){var n=a.getCurrentUser(),t=null;t="admin"===n.role&&"number"==typeof e?i.user.get({id:e,userSetting:!0}).$promise:i.user.whoami({userSetting:!0}).$promise;return t.then(function(e){return a.setCurrentUser(e),e.userSetting})}().then(function(e){l=e,t.$emit("local:user-setting-updated",l)}).finally(function(){o=!1}))}return r&&d(r.id),t.$on("local:user-login",d),t.$on("local:user-logout",function(e){var n="user-setting:update:user-"+e;s.removeListener(n,c),l=null}),n}e.$inject=["Auth","api","$rootScope","socket","$q"],angular.module("app.user-setting").service("UserSettingService",e)}();var urlParams=function(e){var n=new Object,t=e.lastIndexOf("?");if(0<t)for(var a=e.substring(t+1).split("&"),i=0;i<a.length;i++)0<(t=a[i].indexOf("="))&&(n[a[i].substring(0,t)]=a[i].substring(t+1));return n}(window.location.href),t0=new Date,MAX_REQUEST_SIZE=10485760,MAX_WIDTH=12e3,MAX_HEIGHT=12e3,EXPORT_URL="http://exp.draw.io/ImageExport2/export",SHARE_HOST="http://localhost:3000",SAVE_URL="api/square/projects/",VARIABLE_URL="/api/variables",STENCIL_PATH="/assets/plugins/square/stencils",SHAPES_PATH="/assets/plugins/square/shapes",IMAGE_PATH="/assets/plugins/square/images",STYLE_PATH="/assets/plugins/square/styles",CSS_PATH="/assets/plugins/square/styles",OPEN_FORM="api/square/projects/open",TEMPLATE_PATH="/assets/plugins/square/templates",RESOURCES_PATH="/assets/plugins/square/resources",RESOURCE_BASE=RESOURCES_PATH+"/grapheditor",CRUD_PERMISSIONS={readOnly:!1,canEdit:!1,canDelete:!1},tapAndHoldStartsConnection=!0,showConnectorImg=!0,mxLoadResources=!1,mxLanguages=["it","fr","ko","es","sv","ru","de","ja","zh-CN","zh-TW","nl","fi","da","pt-BR","pt-PT","no","hi","tr","fa"],mxLanguage="en",match=document.cookie.match(new RegExp("(^| )motion.language=([^;]+)"));match&&mxLanguages.includes(match[2])&&(mxLanguage=match[2]);var mxBasePath="assets/plugins/mxgraph",mxClient={VERSION:"2.0.0.0",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&navigator.userAgent.indexOf("MSIE")<0,IS_OP:0<=navigator.userAgent.indexOf("Opera/"),IS_OT:navigator.userAgent.indexOf("Presto/2.4.")<0&&navigator.userAgent.indexOf("Presto/2.3.")<0&&navigator.userAgent.indexOf("Presto/2.2.")<0&&navigator.userAgent.indexOf("Presto/2.1.")<0&&navigator.userAgent.indexOf("Presto/2.0.")<0&&navigator.userAgent.indexOf("Presto/1.")<0,IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&navigator.userAgent.indexOf("Chrome/")<0,IS_GC:0<=navigator.userAgent.indexOf("Chrome/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&navigator.userAgent.indexOf("Firefox/1.")<0&&navigator.userAgent.indexOf("Firefox/2.")<0||0<=navigator.userAgent.indexOf("Iceweasel/")&&navigator.userAgent.indexOf("Iceweasel/1.")<0&&navigator.userAgent.indexOf("Iceweasel/2.")<0||0<=navigator.userAgent.indexOf("SeaMonkey/")&&navigator.userAgent.indexOf("SeaMonkey/1.")<0||0<=navigator.userAgent.indexOf("Iceape/")&&navigator.userAgent.indexOf("Iceape/1.")<0,IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||0<=navigator.userAgent.indexOf("Epiphany/")||0<=navigator.userAgent.indexOf("AppleWebKit/")||0<=navigator.userAgent.indexOf("Gecko/")||0<=navigator.userAgent.indexOf("Opera/"),NO_FO:0<=navigator.userAgent.indexOf("Firefox/1.")||0<=navigator.userAgent.indexOf("Iceweasel/1.")||0<=navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/1.")||0<=navigator.userAgent.indexOf("Camino/1.")||0<=navigator.userAgent.indexOf("Epiphany/2.")||0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Mozilla/2."),IS_VML:"MICROSOFT INTERNET EXPLORER"==navigator.appName.toUpperCase(),IS_MAC:0<navigator.userAgent.toUpperCase().indexOf("MACINTOSH"),IS_TOUCH:0<navigator.userAgent.toUpperCase().indexOf("IPAD")||0<navigator.userAgent.toUpperCase().indexOf("IPOD")||0<navigator.userAgent.toUpperCase().indexOf("IPHONE")||0<navigator.userAgent.toUpperCase().indexOf("ANDROID"),IS_LOCAL:document.location.href.indexOf("http://")<0&&document.location.href.indexOf("https://")<0,isBrowserSupported:function(){return mxClient.IS_VML||mxClient.IS_SVG},link:function(e,n,t){if(t=t||document,mxClient.IS_IE6)t.write('<link rel="'+e+'" href="'+n+'" charset="ISO-8859-1" type="text/css"/>');else{var a=t.createElement("link");a.setAttribute("rel",e),a.setAttribute("href",n),a.setAttribute("charset","ISO-8859-1"),a.setAttribute("type","text/css"),t.getElementsByTagName("head")[0].appendChild(a)}},include:function(e){document.write('<script src="'+e+'"><\/script>')},dispose:function(){for(var e=0;e<mxEvent.objects.length;e++)null!=mxEvent.objects[e].mxListenerList&&mxEvent.removeAllListeners(mxEvent.objects[e])}};if(mxClient.IS_OP&&mxClient.IS_OT?mxClient.CSS_PREFIX="O":mxClient.IS_SF||mxClient.IS_GC?mxClient.CSS_PREFIX="Webkit":mxClient.IS_MT?mxClient.CSS_PREFIX="Moz":mxClient.IS_IE&&9<=document.documentMode&&(mxClient.CSS_PREFIX="ms"),void 0===mxLoadResources&&(mxLoadResources=!0),"undefined"==typeof mxResourceExtension&&(mxResourceExtension=".txt"),"undefined"==typeof mxLoadStylesheets&&(mxLoadStylesheets=!0),void 0!==mxBasePath&&0<mxBasePath.length?("/"==mxBasePath.substring(mxBasePath.length-1)&&(mxBasePath=mxBasePath.substring(0,mxBasePath.length-1)),mxClient.basePath=mxBasePath):mxClient.basePath=".","undefined"!=typeof mxImageBasePath&&0<mxImageBasePath.length?("/"==mxImageBasePath.substring(mxImageBasePath.length-1)&&(mxImageBasePath=mxImageBasePath.substring(0,mxImageBasePath.length-1)),mxClient.imageBasePath=mxImageBasePath):mxClient.imageBasePath=mxClient.basePath+"/images",mxClient.language=void 0!==mxLanguage?mxLanguage:mxClient.IS_IE?navigator.userLanguage:navigator.language,mxClient.defaultLanguage="undefined"!=typeof mxDefaultLanguage?mxDefaultLanguage:"en",mxLoadStylesheets&&mxClient.link("stylesheet",mxClient.basePath+"/css/common.css"),void 0!==mxLanguages&&(mxClient.languages=mxLanguages),mxClient.IS_IE){if(9<=document.documentMode)mxClient.IS_VML=!1,mxClient.IS_SVG=!0;else{8==document.documentMode?(document.namespaces.add(mxClient.VML_PREFIX,"urn:schemas-microsoft-com:vml","#default#VML"),document.namespaces.add(mxClient.OFFICE_PREFIX,"urn:schemas-microsoft-com:office:office","#default#VML")):(document.namespaces.add(mxClient.VML_PREFIX,"urn:schemas-microsoft-com:vml"),document.namespaces.add(mxClient.OFFICE_PREFIX,"urn:schemas-microsoft-com:office:office"));var ss=document.createStyleSheet();ss.cssText="v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}",mxLoadStylesheets&&mxClient.link("stylesheet",mxClient.basePath+"/css/explorer.css")}window.attachEvent("onunload",mxClient.dispose)}var mxLog={consoleName:"Console",TRACE:!1,DEBUG:!0,WARN:!0,buffer:"",init:function(){if(null==mxLog.window&&null!=document.body){var e=mxLog.consoleName+" - mxGraph "+mxClient.VERSION,n=document.createElement("table");n.setAttribute("width","100%"),n.setAttribute("height","100%");var t=document.createElement("tbody"),a=document.createElement("tr"),i=document.createElement("td");if(i.style.verticalAlign="top",mxLog.textarea=document.createElement("textarea"),mxLog.textarea.setAttribute("readOnly","true"),mxLog.textarea.style.height="100%",mxLog.textarea.style.resize="none",mxLog.textarea.value=mxLog.buffer,mxLog.textarea.style.width=mxClient.IS_NS&&"BackCompat"!=document.compatMode?"99%":"100%",i.appendChild(mxLog.textarea),a.appendChild(i),t.appendChild(a),a=document.createElement("tr"),mxLog.td=document.createElement("td"),mxLog.td.style.verticalAlign="top",mxLog.td.setAttribute("height","30px"),a.appendChild(mxLog.td),t.appendChild(a),n.appendChild(t),mxLog.addButton("Info",function(e){mxLog.info()}),mxLog.addButton("DOM",function(e){e=mxUtils.getInnerHtml(document.body),mxLog.debug(e)}),mxLog.addButton("Trace",function(e){mxLog.TRACE=!mxLog.TRACE,mxLog.TRACE?mxLog.debug("Tracing enabled"):mxLog.debug("Tracing disabled")}),mxLog.addButton("Copy",function(e){try{mxUtils.copy(mxLog.textarea.value)}catch(e){mxUtils.alert(e)}}),mxLog.addButton("Show",function(e){try{mxUtils.popup(mxLog.textarea.value)}catch(e){mxUtils.alert(e)}}),mxLog.addButton("Clear",function(e){mxLog.textarea.value=""}),a=t=0,a="number"==typeof window.innerWidth?(t=window.innerHeight,window.innerWidth):(t=document.documentElement.clientHeight||document.body.clientHeight,document.body.clientWidth),mxLog.window=new mxWindow(e,n,Math.max(0,a-320),Math.max(0,t-210),300,160),mxLog.window.setMaximizable(!0),mxLog.window.setScrollable(!1),mxLog.window.setResizable(!0),mxLog.window.setClosable(!0),mxLog.window.destroyOnClose=!1,(mxClient.IS_NS||mxClient.IS_IE)&&!mxClient.IS_GC&&!mxClient.IS_SF&&"BackCompat"!=document.compatMode){var s=mxLog.window.getElement();e=function(e,n){mxLog.textarea.style.height=Math.max(0,s.offsetHeight-70)+"px"};mxLog.window.addListener(mxEvent.RESIZE_END,e),mxLog.window.addListener(mxEvent.MAXIMIZE,e),mxLog.window.addListener(mxEvent.NORMALIZE,e),mxLog.textarea.style.height="92px"}}},info:function(){mxLog.writeln(mxUtils.toString(navigator))},addButton:function(e,n){var t=document.createElement("button");mxUtils.write(t,e),mxEvent.addListener(t,"click",n),mxLog.td.appendChild(t)},isVisible:function(){return null!=mxLog.window&&mxLog.window.isVisible()},show:function(){mxLog.setVisible(!0)},setVisible:function(e){null==mxLog.window&&mxLog.init(),null!=mxLog.window&&mxLog.window.setVisible(e)},enter:function(e){if(mxLog.TRACE)return mxLog.writeln("Entering "+e),(new Date).getTime()},leave:function(e,n){if(mxLog.TRACE){var t=0!=n?" ("+((new Date).getTime()-n)+" ms)":"";mxLog.writeln("Leaving "+e+t)}},debug:function(){mxLog.DEBUG&&mxLog.writeln.apply(this,arguments)},warn:function(){mxLog.WARN&&mxLog.writeln.apply(this,arguments)},write:function(){for(var e="",n=0;n<arguments.length;n++)e+=arguments[n],n<arguments.length-1&&(e+=" ");null!=mxLog.textarea?(mxLog.textarea.value+=e,0<=navigator.userAgent.indexOf("Presto/2.5")&&(mxLog.textarea.style.visibility="hidden",mxLog.textarea.style.visibility="visible"),mxLog.textarea.scrollTop=mxLog.textarea.scrollHeight):mxLog.buffer+=e},writeln:function(){for(var e="",n=0;n<arguments.length;n++)e+=arguments[n],n<arguments.length-1&&(e+=" ");mxLog.write(e+"\n")}},mxObjectIdentity={FIELD_NAME:"mxObjectId",counter:0,get:function(e){if("object"==typeof e&&null==e[mxObjectIdentity.FIELD_NAME]){var n=mxUtils.getFunctionName(e.constructor);e[mxObjectIdentity.FIELD_NAME]=n+"#"+mxObjectIdentity.counter++}return e[mxObjectIdentity.FIELD_NAME]},clear:function(e){"object"==typeof e&&delete e[mxObjectIdentity.FIELD_NAME]}};function mxDictionary(){this.clear()}mxDictionary.prototype.map=null,mxDictionary.prototype.clear=function(){this.map={}},mxDictionary.prototype.get=function(e){return e=mxObjectIdentity.get(e),this.map[e]},mxDictionary.prototype.put=function(e,n){var t=mxObjectIdentity.get(e),a=this.map[t];return this.map[t]=n,a},mxDictionary.prototype.remove=function(e){e=mxObjectIdentity.get(e);var n=this.map[e];return delete this.map[e],n},mxDictionary.prototype.getKeys=function(){var e,n=[];for(e in this.map)n.push(e);return n},mxDictionary.prototype.getValues=function(){var e,n=[];for(e in this.map)n.push(this.map[e]);return n},mxDictionary.prototype.visit=function(e){for(var n in this.map)e(n,this.map[n])};var mxResources={resources:[],extension:mxResourceExtension,resourcesEncoded:!1,loadDefaultBundle:!0,loadSpecialBundle:!0,isLanguageSupported:function(e){return null==mxClient.languages||0<=mxUtils.indexOf(mxClient.languages,e)},getDefaultBundle:function(e,n){return mxResources.loadDefaultBundle||!mxResources.isLanguageSupported(n)?e+mxResources.extension:null},getSpecialBundle:function(e,n){if(null==mxClient.languages||!this.isLanguageSupported(n)){var t=n.indexOf("-");0<t&&(n=n.substring(0,t))}return mxResources.loadSpecialBundle&&mxResources.isLanguageSupported(n)&&n!=mxClient.defaultLanguage?e+"_"+n+mxResources.extension:null},add:function(e,n){if((n=null!=n?n:mxClient.language)!=mxConstants.NONE){var t=mxResources.getDefaultBundle(e,n);if(null!=t)try{var a=mxUtils.load(t);a.isReady()&&mxResources.parse(a.getText())}catch(e){}if(null!=(t=mxResources.getSpecialBundle(e,n)))try{(a=mxUtils.load(t)).isReady()&&mxResources.parse(a.getText())}catch(e){}}},parse:function(e){if(null!=e){e=e.split("\n");for(var n=0;n<e.length;n++)if("#"!=e[n].charAt(0)){var t=e[n].indexOf("=");if(0<t){var a=e[n].substring(0,t),i=e[n].length;13==e[n].charCodeAt(i-1)&&i--,t=e[n].substring(t+1,i),this.resourcesEncoded?(t=t.replace(/\\(?=u[a-fA-F\d]{4})/g,"%"),mxResources.resources[a]=unescape(t)):mxResources.resources[a]=t}}}},get:function(e,n,t){if(null==(e=mxResources.resources[e])&&(e=t),null!=e&&null!=n){t=[];for(var a=null,i=0;i<e.length;i++){var s=e.charAt(i);"{"==s?a="":null!=a&&"}"==s?(0<=(a=parseInt(a)-1)&&a<n.length&&t.push(n[a]),a=null):null!=a?a+=s:t.push(s)}e=t.join("")}return e}};function mxPoint(e,n){this.x=null!=e?e:0,this.y=null!=n?n:0}function mxRectangle(e,n,t,a){mxPoint.call(this,e,n),this.width=null!=t?t:0,this.height=null!=a?a:0}mxPoint.prototype.x=null,mxPoint.prototype.y=null,mxPoint.prototype.equals=function(e){return e.x==this.x&&e.y==this.y},mxPoint.prototype.clone=function(){return mxUtils.clone(this)},mxRectangle.prototype=new mxPoint,mxRectangle.prototype.constructor=mxRectangle,mxRectangle.prototype.width=null,mxRectangle.prototype.height=null,mxRectangle.prototype.setRect=function(e,n,t,a){this.x=e,this.y=n,this.width=t,this.height=a},mxRectangle.prototype.getCenterX=function(){return this.x+this.width/2},mxRectangle.prototype.getCenterY=function(){return this.y+this.height/2},mxRectangle.prototype.add=function(e){if(null!=e){var n=Math.min(this.x,e.x),t=Math.min(this.y,e.y),a=Math.max(this.x+this.width,e.x+e.width);e=Math.max(this.y+this.height,e.y+e.height),this.x=n,this.y=t,this.width=a-n,this.height=e-t}},mxRectangle.prototype.grow=function(e){this.x-=e,this.y-=e,this.width+=2*e,this.height+=2*e},mxRectangle.prototype.getPoint=function(){return new mxPoint(this.x,this.y)},mxRectangle.prototype.equals=function(e){return e.x==this.x&&e.y==this.y&&e.width==this.width&&e.height==this.height};var mxEffects={animateChanges:function(l,d,c){var m=0,u=function(){for(var e=!1,n=0;n<d.length;n++){var t=d[n];if(t instanceof mxGeometryChange||t instanceof mxTerminalChange||t instanceof mxValueChange||t instanceof mxChildChange||t instanceof mxStyleChange){var a=l.getView().getState(t.cell||t.child,!1);if(null!=a)if(e=!0,t.constructor!=mxGeometryChange||l.model.isEdge(t.cell))mxUtils.setOpacity(a.shape.node,100*m/10);else{var i=l.getView().scale,s=(t.geometry.x-t.previous.x)*i,o=(t.geometry.y-t.previous.y)*i,r=(t.geometry.width-t.previous.width)*i;i=(t.geometry.height-t.previous.height)*i;0==m?(a.x-=s,a.y-=o,a.width-=r,a.height-=i):(a.x+=s/10,a.y+=o/10,a.width+=r/10,a.height+=i/10),l.cellRenderer.redraw(a),mxEffects.cascadeOpacity(l,t.cell,100*m/10)}}}m<10&&e?(m++,window.setTimeout(u,p)):null!=c&&c()},p=30;u()},cascadeOpacity:function(e,n,t){for(var a=e.model.getChildCount(n),i=0;i<a;i++){var s=e.model.getChildAt(n,i),o=e.getView().getState(s);null!=o&&(mxUtils.setOpacity(o.shape.node,t),mxEffects.cascadeOpacity(e,s,t))}if(null!=(n=e.model.getEdges(n)))for(i=0;i<n.length;i++)null!=(a=e.getView().getState(n[i]))&&mxUtils.setOpacity(a.shape.node,t)},fadeOut:function(e,n,t,a,i,s){a=a||40,i=i||30;var o=n||100;if(mxUtils.setOpacity(e,o),s||null==s){var r=function(){o=Math.max(o-a,0),mxUtils.setOpacity(e,o),0<o?window.setTimeout(r,i):(e.style.visibility="hidden",t&&e.parentNode&&e.parentNode.removeChild(e))};window.setTimeout(r,i)}else e.style.visibility="hidden",t&&e.parentNode&&e.parentNode.removeChild(e)}},mxUtils={errorResource:"none"!=mxClient.language?"error":"",closeResource:"none"!=mxClient.language?"close":"",errorImage:mxClient.imageBasePath+"/error.gif",removeCursors:function(e){if(null!=e.style&&(e.style.cursor=""),null!=(e=e.childNodes))for(var n=e.length,t=0;t<n;t+=1)mxUtils.removeCursors(e[t])},getCurrentStyle:mxClient.IS_IE?function(e){return null!=e?e.currentStyle:null}:function(e){return null!=e?window.getComputedStyle(e,""):null},hasScrollbars:function(e){return null!=(e=mxUtils.getCurrentStyle(e))&&("scroll"==e.overflow||"auto"==e.overflow)},bind:function(e,n){return function(){return n.apply(e,arguments)}},eval:function(a){var b=null;if(0<=a.indexOf("function"))try{eval("var _mxJavaScriptExpression="+a),b=_mxJavaScriptExpression,_mxJavaScriptExpression=null}catch(e){mxLog.warn(e.message+" while evaluating "+a)}else try{b=eval(a)}catch(e){mxLog.warn(e.message+" while evaluating "+a)}return b},findNode:function(e,n,t){var a=e.getAttribute(n);if(null!=a&&a==t)return e;for(e=e.firstChild;null!=e;){if(null!=(a=mxUtils.findNode(e,n,t)))return a;e=e.nextSibling}return null},findNodeByAttribute:9<=document.documentMode?function(e,n,t){var a=null;if(null!=e)if(e.nodeType==mxConstants.NODETYPE_ELEMENT&&e.getAttribute(n)==t)a=e;else for(e=e.firstChild;null!=e&&null==a;)a=mxUtils.findNodeByAttribute(e,n,t),e=e.nextSibling;return a}:mxClient.IS_IE?function(e,n,t){return null==e?null:e.ownerDocument.selectSingleNode("//*[@"+n+"='"+t+"']")}:function(e,n,t){return null==e?null:e.ownerDocument.evaluate("//*[@"+n+"='"+t+"']",e.ownerDocument,null,XPathResult.ANY_TYPE,null).iterateNext()},getFunctionName:function(e){var n=null;if(null!=e)if(null!=e.name)n=e.name;else{for(e=e.toString(),n=9;" "==e.charAt(n);)n++;var t=e.indexOf("(",n);n=e.substring(n,t)}return n},indexOf:function(e,n){if(null!=e&&null!=n)for(var t=0;t<e.length;t++)if(e[t]==n)return t;return-1},remove:function(e,n){var t=null;if("object"==typeof n)for(var a=mxUtils.indexOf(n,e);0<=a;)n.splice(a,1),t=e,a=mxUtils.indexOf(n,e);for(var i in n)n[i]==e&&(delete n[i],t=e);return t},isNode:function(e,n,t,a){return!(null==e||isNaN(e.nodeType)||null!=n&&e.nodeName.toLowerCase()!=n.toLowerCase())&&(null==t||e.getAttribute(t)==a)},getChildNodes:function(e,n){n=n||mxConstants.NODETYPE_ELEMENT;for(var t=[],a=e.firstChild;null!=a;)a.nodeType==n&&t.push(a),a=a.nextSibling;return t},createXmlDocument:function(){var e=null;return document.implementation&&document.implementation.createDocument?e=document.implementation.createDocument("","",null):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLDOM")),e},parseXml:mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?function(e){var n=mxUtils.createXmlDocument();return n.async="false",n.loadXML(e),n}:function(e){return(new DOMParser).parseFromString(e,"text/xml")},clearSelection:document.selection?function(){document.selection.empty()}:window.getSelection?function(){window.getSelection().removeAllRanges()}:void 0,getPrettyXml:function(e,n,t){var a=[];if(null!=e)if(n=n||"  ",t=t||"",e.nodeType==mxConstants.NODETYPE_TEXT)a.push(e.nodeValue);else{a.push(t+"<"+e.nodeName);var i=e.attributes;if(null!=i)for(var s=0;s<i.length;s++){var o=mxUtils.htmlEntities(i[s].nodeValue);a.push(" "+i[s].nodeName+'="'+o+'"')}if(null!=(i=e.firstChild)){for(a.push(">\n");null!=i;)a.push(mxUtils.getPrettyXml(i,n,t+n)),i=i.nextSibling;a.push(t+"</"+e.nodeName+">\n")}else a.push("/>\n")}return a.join("")},removeWhitespace:function(e,n){for(var t=n?e.previousSibling:e.nextSibling;null!=t&&t.nodeType==mxConstants.NODETYPE_TEXT;){var a=n?t.previousSibling:t.nextSibling,i=mxUtils.getTextContent(t);0==mxUtils.trim(i).length&&t.parentNode.removeChild(t),t=a}},htmlEntities:function(e,n){return e=(e=(e=(e=(e=(e||"").replace(/&/g,"&amp;")).replace(/"/g,"&quot;")).replace(/\'/g,"&#39;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;"),(null==n||n)&&(e=e.replace(/\n/g,"&#xa;")),e},isVml:function(e){return null!=e&&"urn:schemas-microsoft-com:vml"==e.tagUrn},getXml:function(e,n){var t="";return null!=e&&(t=null==(t=e.xml)?e.innerHTML?e.innerHTML:(new XMLSerializer).serializeToString(e):t.replace(/\r\n\t[\t]*/g,"").replace(/>\r\n/g,">").replace(/\r\n/g,"\n")),t.replace(/\n/g,n||"&#xa;")},getTextContent:function(e){var n="";return null!=e&&(null!=e.firstChild&&(e=e.firstChild),n=e.nodeValue||""),n},getInnerHtml:mxClient.IS_IE?function(e){return null!=e?e.innerHTML:""}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},getOuterHtml:mxClient.IS_IE?function(e){if(null==e)return"";if(null!=e.outerHTML)return e.outerHTML;var n=[];n.push("<"+e.nodeName);var t=e.attributes;if(null!=t)for(var a=0;a<t.length;a++){var i=t[a].nodeValue;null!=i&&0<i.length&&(n.push(" "),n.push(t[a].nodeName),n.push('="'),n.push(i),n.push('"'))}return 0==e.innerHTML.length?n.push("/>"):(n.push(">"),n.push(e.innerHTML),n.push("</"+e.nodeName+">")),n.join("")}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},write:function(e,n){var t=e.ownerDocument.createTextNode(n);return null!=e&&e.appendChild(t),t},writeln:function(e,n){var t=e.ownerDocument.createTextNode(n);return null!=e&&(e.appendChild(t),e.appendChild(document.createElement("br"))),t},br:function(e,n){n=n||1;for(var t=null,a=0;a<n;a++)null!=e&&(t=e.ownerDocument.createElement("br"),e.appendChild(t));return t},button:function(e,n,t){return t=(t=null!=t?t:document).createElement("button"),mxUtils.write(t,e),mxEvent.addListener(t,"click",function(e){n(e)}),t},para:function(e,n){var t=document.createElement("p");return mxUtils.write(t,n),null!=e&&e.appendChild(t),t},addTransparentBackgroundFilter:function(e){e.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mxClient.imageBasePath+"/transparent.gif', sizingMethod='scale')"},linkAction:function(e,n,t,a,i){return mxUtils.link(e,n,function(){t.execute(a)},i)},linkInvoke:function(e,n,t,a,i,s){return mxUtils.link(e,n,function(){t[a](i)},s)},link:function(e,n,t,a){var i=document.createElement("span");return i.style.color="blue",i.style.textDecoration="underline",i.style.cursor="pointer",null!=a&&(i.style.paddingLeft=a+"px"),mxEvent.addListener(i,"click",t),mxUtils.write(i,n),null!=e&&e.appendChild(i),i},fit:function(e){var n=parseInt(e.offsetLeft),t=parseInt(e.offsetWidth),a=document.body,i=document.documentElement,s=(a.scrollLeft||i.scrollLeft)+(a.clientWidth||i.clientWidth);s<n+t&&(e.style.left=Math.max(a.scrollLeft||i.scrollLeft,s-t)+"px"),n=parseInt(e.offsetTop),t=parseInt(e.offsetHeight),(s=(a.scrollTop||i.scrollTop)+Math.max(a.clientHeight||0,i.clientHeight))<n+t&&(e.style.top=Math.max(a.scrollTop||i.scrollTop,s-t)+"px")},open:function(e){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return mxUtils.alert("Permission to read file denied."),""}var n=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);return n.initWithPath(e),n.exists()?((e=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream)).init(n,1,4,null),(n=Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream)).init(e),n.read(n.available())):(mxUtils.alert("File not found."),"")}return e=(n=new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(e,1)).readAll(),n.close(),e},save:function(e,n){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return void mxUtils.alert("Permission to write file denied.")}var t=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);t.initWithPath(e),t.exists()||t.create(0,420);var a=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);a.init(t,34,4,null),a.write(n,n.length),a.flush(),a.close()}else(t=new ActiveXObject("Scripting.FileSystemObject").CreateTextFile(e,!0)).Write(n),t.Close()},saveAs:function(e){var n=document.createElement("iframe");n.setAttribute("src",""),n.style.visibility="hidden",document.body.appendChild(n);try{if(mxClient.IS_NS){var t=n.contentDocument;t.open(),t.write(e),t.close();try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"),n.focus(),saveDocument(t)}catch(e){mxUtils.alert("Permission to save document denied.")}}else(t=n.contentWindow.document).write(e),t.execCommand("SaveAs",!1,document.location)}finally{document.body.removeChild(n)}},copy:function(e){if(window.clipboardData)window.clipboardData.setData("Text",e);else{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");var n=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);if(n){var t=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(t){t.addDataFlavor("text/unicode");var a=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);a.data=e,t.setTransferData("text/unicode",a,2*e.length),n.setData(t,null,Components.interfaces.nsIClipboard.kGlobalClipboard)}}}},load:function(e){return(e=new mxXmlRequest(e,null,"GET",!1)).send(),e},get:function(e,n,t){return new mxXmlRequest(e,null,"GET").send(n,t)},post:function(e,n,t,a){return new mxXmlRequest(e,n).send(t,a)},submit:function(e,n,t,a){return new mxXmlRequest(e,n).simulate(t,a)},loadInto:function(e,n,t){mxClient.IS_IE?n.onreadystatechange=function(){4==n.readyState&&t()}:n.addEventListener("load",t,!1),n.load(e)},getValue:function(e,n,t){return null==(e=null!=e?e[n]:null)&&(e=t),e},getNumber:function(e,n,t){return null==(e=null!=e?e[n]:null)&&(e=t||0),Number(e)},getColor:function(e,n,t){return null==(e=null!=e?e[n]:null)?e=t:e==mxConstants.NONE&&(e=null),e},clone:function(e,n,t){t=null!=t&&t;var a=null;if(null!=e&&"function"==typeof e.constructor){var i;a=new e.constructor;for(i in e)i!=mxObjectIdentity.FIELD_NAME&&(null==n||mxUtils.indexOf(n,i)<0)&&(a[i]=t||"object"!=typeof e[i]?e[i]:mxUtils.clone(e[i]))}return a},equalPoints:function(e,n){if(null==e&&null!=n||null!=e&&null==n||null!=e&&null!=n&&e.length!=n.length)return!1;if(null!=e&&null!=n)for(var t=0;t<e.length;t++)if(e[t]==n[t]||null!=e[t]&&!e[t].equals(n[t]))return!1;return!0},equalEntries:function(e,n){if(null==e&&null!=n||null!=e&&null==n||null!=e&&null!=n&&e.length!=n.length)return!1;if(null!=e&&null!=n)for(var t in e)if(e[t]!=n[t])return!1;return!0},extend:function(e,n){var t=function(){};t.prototype=n.prototype,e.prototype=new t,e.prototype.constructor=e},toString:function(e){var n,t="";for(n in e)try{if(null==e[n])t+=n+" = [null]\n";else if("function"==typeof e[n])t+=n+" => [Function]\n";else if("object"==typeof e[n])t=t+(n+" => [")+mxUtils.getFunctionName(e[n].constructor)+"]\n";else t+=n+" = "+e[n]+"\n"}catch(e){t+=n+"="+e.message}return t},toRadians:function(e){return Math.PI*e/180},arcToCurves:function(e,n,t,a,i,s,o,r,l){if(r-=e,l-=n,0===t||0===a)return h;t=Math.abs(t),a=Math.abs(a);var d=-r/2,c=-l/2,m=Math.cos(i*Math.PI/180);i=m*d+(h=Math.sin(i*Math.PI/180))*c;d=-1*h*d+m*c;r=m*(c=(s=1<(v=(c=i*i)/(g=t*t)+(p=d*d)/(A=a*a))?(t*=Math.sqrt(v),a*=Math.sqrt(v),0):(v=1,s===o&&(v=-1),v*Math.sqrt((g*A-g*p-A*c)/(g*p+A*c))))*t*d/a)-h*(p=-1*s*a*i/t)+r/2,l=h*c+m*p+l/2,s=0<=(g=Math.atan2((d-p)/a,(i-c)/t)-Math.atan2(0,1))?g:2*Math.PI+g,i=0<=(g=Math.atan2((-d-p)/a,(-i-c)/t)-Math.atan2((d-p)/a,(i-c)/t))?g:2*Math.PI+g,0==o&&0<i?i-=2*Math.PI:0!=o&&i<0&&(i+=2*Math.PI),o=2*i/Math.PI,i/=o=Math.ceil(o<0?-1*o:o),d=8/3*Math.sin(i/4)*Math.sin(i/4)/Math.sin(i/2),c=m*t,m*=a,t*=h,a*=h;for(var u=Math.cos(s),p=-d*(c*(b=Math.sin(s))+a*u),g=-d*(t*b-m*u),v=A=0,h=[],f=0;f<o;++f){s+=i;var b,A=c*(u=Math.cos(s))-a*(b=Math.sin(s))+r,E=(v=t*u+m*b+l,-d*(c*b+a*u));u=-d*(t*b-m*u);h[b=6*f]=Number(p+e),h[b+1]=Number(g+n),h[b+2]=Number(A-E+e),h[b+3]=Number(v-u+n),h[b+4]=Number(A+e),h[b+5]=Number(v+n),p=A+E,g=v+u}return h},getBoundingBox:function(e,n){var t=null;if(null!=e&&null!=n&&0!=n){var a=mxUtils.toRadians(n),i=(t=Math.cos(a),Math.sin(a)),s=new mxPoint(e.x+e.width/2,e.y+e.height/2),o=new mxPoint(e.x,e.y),r=new mxPoint((a=new mxPoint(e.x+e.width,e.y)).x,e.y+e.height),l=new mxPoint(e.x,r.y);o=mxUtils.getRotatedPoint(o,t,i,s),a=mxUtils.getRotatedPoint(a,t,i,s),r=mxUtils.getRotatedPoint(r,t,i,s),l=mxUtils.getRotatedPoint(l,t,i,s);(t=new mxRectangle(o.x,o.y,0,0)).add(new mxRectangle(a.x,a.y,0,0)),t.add(new mxRectangle(r.x,r.y,0,0)),t.add(new mxRectangle(l.x,l.y,0,0))}return t},getRotatedPoint:function(e,n,t,a){a=null!=a?a:new mxPoint;var i=e.x-a.x;return new mxPoint(i*n-(e=e.y-a.y)*t+a.x,e*n+i*t+a.y)},getPortConstraints:function(e,n,t,a){return null==(e=mxUtils.getValue(e.style,mxConstants.STYLE_PORT_CONSTRAINT,null))?a:(a=e.toString(),e=mxConstants.DIRECTION_MASK_NONE,0<=a.indexOf(mxConstants.DIRECTION_NORTH)&&(e|=mxConstants.DIRECTION_MASK_NORTH),0<=a.indexOf(mxConstants.DIRECTION_WEST)&&(e|=mxConstants.DIRECTION_MASK_WEST),0<=a.indexOf(mxConstants.DIRECTION_SOUTH)&&(e|=mxConstants.DIRECTION_MASK_SOUTH),0<=a.indexOf(mxConstants.DIRECTION_EAST)&&(e|=mxConstants.DIRECTION_MASK_EAST),e)},reversePortConstraints:function(e){return(e&mxConstants.DIRECTION_MASK_WEST)<<3|(e&mxConstants.DIRECTION_MASK_NORTH)<<1|(e&mxConstants.DIRECTION_MASK_SOUTH)>>1|(e&mxConstants.DIRECTION_MASK_EAST)>>3},findNearestSegment:function(e,n,t){var a=-1;if(0<e.absolutePoints.length)for(var i=e.absolutePoints[0],s=null,o=1;o<e.absolutePoints.length;o++){var r=e.absolutePoints[o];i=mxUtils.ptSegDistSq(i.x,i.y,r.x,r.y,n,t);(null==s||i<s)&&(s=i,a=o-1),i=r}return a},rectangleIntersectsSegment:function(e,n,t){var a=e.y,i=e.x,s=a+e.height,o=i+e.width;e=n.x;var r=t.x;if(n.x>t.x&&(e=t.x,r=n.x),o<r&&(r=o),e<i&&(e=i),r<e)return!1;i=n.y,o=t.y;var l=t.x-n.x;return 1e-7<Math.abs(l)&&(i=(t=(t.y-n.y)/l)*e+(n=n.y-t*n.x),o=t*r+n),o<i&&(n=o,o=i,i=n),s<o&&(o=s),i<a&&(i=a),!(o<i)},contains:function(e,n,t){return e.x<=n&&e.x+e.width>=n&&e.y<=t&&e.y+e.height>=t},intersects:function(e,n){var t=e.width,a=e.height,i=n.width,s=n.height;if(i<=0||s<=0||t<=0||a<=0)return!1;var o=e.x,r=e.y,l=n.x,d=n.y;s+=d,t+=o,a+=r;return((i=i+l)<l||o<i)&&(s<d||r<s)&&(t<o||l<t)&&(a<r||d<a)},intersectsHotspot:function(e,n,t,a,i,s){if(i=null!=i?i:0,s=null!=s?s:0,0<(a=null!=a?a:1)){var o=e.getCenterX(),r=e.getCenterY(),l=e.width,d=e.height,c=mxUtils.getValue(e.style,mxConstants.STYLE_STARTSIZE)*e.view.scale;return 0<c&&(mxUtils.getValue(e.style,mxConstants.STYLE_HORIZONTAL,!0)?(r=e.y+c/2,d=c):(o=e.x+c/2,l=c)),l=Math.max(i,l*a),d=Math.max(i,d*a),0<s&&(l=Math.min(l,s),d=Math.min(d,s)),a=new mxRectangle(o-l/2,r-d/2,l,d),0!=(o=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))&&(i=Math.cos(-o),s=Math.sin(-o),o=new mxPoint(e.getCenterX(),e.getCenterY()),n=(e=mxUtils.getRotatedPoint(new mxPoint(n,t),i,s,o)).x,t=e.y),mxUtils.contains(a,n,t)}return!0},getOffset:function(e,n){var t=0,a=0;if(null!=n&&n){var i=document.body,s=document.documentElement;t=t+(i.scrollLeft||s.scrollLeft),a=a+(i.scrollTop||s.scrollTop)}for(;e.offsetParent;)t+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;return new mxPoint(t,a)},getScrollOrigin:function(e){for(var n=document.body,t=document.documentElement,a=new mxPoint(n.scrollLeft||t.scrollLeft,n.scrollTop||t.scrollTop);null!=e&&e!=n&&e!=t;)!isNaN(e.scrollLeft)&&!isNaN(e.scrollTop)&&(a.x+=e.scrollLeft,a.y+=e.scrollTop),e=e.parentNode;return a},convertPoint:function(e,n,t){var a=mxUtils.getScrollOrigin(e);return(e=mxUtils.getOffset(e)).x-=a.x,e.y-=a.y,new mxPoint(n-e.x,t-e.y)},ltrim:function(e,n){return e.replace(RegExp("^["+(n||"\\s")+"]+","g"),"")},rtrim:function(e,n){return e.replace(RegExp("["+(n||"\\s")+"]+$","g"),"")},trim:function(e,n){return mxUtils.ltrim(mxUtils.rtrim(e,n),n)},isNumeric:function(e){return null!=e&&(null==e.length||0<e.length&&e.indexOf("0x")<0&&e.indexOf("0X")<0)&&!isNaN(e)},mod:function(e,n){return(e%n+n)%n},intersection:function(e,n,t,a,i,s,o,r){var l=(r-s)*(t-e)-(o-i)*(a-n);return o=((o-i)*(n-s)-(r-s)*(e-i))/l,i=((t-e)*(n-s)-(a-n)*(e-i))/l,0<=o&&o<=1&&0<=i&&i<=1?new mxPoint(e+o*(t-e),n+o*(a-n)):null},ptSegDistSq:function(e,n,t,a,i,s){return t=(i-=e)*(t-=e)+(s-=n)*(a-=n)<=0?0:(e=(i=t-i)*t+(s=a-s)*a)<=0?0:e*e/(t*t+a*a),(i=i*i+s*s-t)<0&&(i=0),i},relativeCcw:function(e,n,t,a,i,s){return 0==(e=(i-=e)*(a-=n)-(s-=n)*(t-=e))&&(0<(e=i*t+s*a)&&((e=(i-t)*t+(s-a)*a)<0&&(e=0))),e<0?-1:0<e?1:0},animateChanges:function(e,n){mxEffects.animateChanges.apply(this,arguments)},cascadeOpacity:function(e,n,t){mxEffects.cascadeOpacity.apply(this,arguments)},fadeOut:function(e,n,t,a,i,s){mxEffects.fadeOut.apply(this,arguments)},setOpacity:function(e,n){mxUtils.isVml(e)?e.style.filter=100<=n?null:"alpha(opacity="+n/5+")":mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?e.style.filter=100<=n?null:"alpha(opacity="+n+")":e.style.opacity=n/100},createImage:function(e){var n=null;return mxClient.IS_IE6&&"CSS1Compat"!=document.compatMode?((n=document.createElement(mxClient.VML_PREFIX+":image")).setAttribute("src",e),n.style.borderStyle="none"):((n=document.createElement("img")).setAttribute("src",e),n.setAttribute("border","0")),n},sortCells:function(e,i){i=null==i||i;var s=new mxDictionary;return e.sort(function(e,n){var t=s.get(e);null==t&&(t=mxCellPath.create(e).split(mxCellPath.PATH_SEPARATOR),s.put(e,t));var a=s.get(n);return null==a&&(a=mxCellPath.create(n).split(mxCellPath.PATH_SEPARATOR),s.put(n,a)),0==(t=mxCellPath.compare(t,a))?0:0<t==i?1:-1}),e},getStylename:function(e){return null!=e&&(e=e.split(";")[0]).indexOf("=")<0?e:""},getStylenames:function(e){var n=[];if(null!=e){e=e.split(";");for(var t=0;t<e.length;t++)e[t].indexOf("=")<0&&n.push(e[t])}return n},indexOfStylename:function(e,n){if(null!=e&&null!=n)for(var t=e.split(";"),a=0,i=0;i<t.length;i++){if(t[i]==n)return a;a+=t[i].length+1}return-1},addStylename:function(e,n){return mxUtils.indexOfStylename(e,n)<0&&(null==e?e="":0<e.length&&";"!=e.charAt(e.length-1)&&(e+=";"),e+=n),e},removeStylename:function(e,n){var t=[];if(null!=e)for(var a=e.split(";"),i=0;i<a.length;i++)a[i]!=n&&t.push(a[i]);return t.join(";")},removeAllStylenames:function(e){var n=[];if(null!=e){e=e.split(";");for(var t=0;t<e.length;t++)0<=e[t].indexOf("=")&&n.push(e[t])}return n.join(";")},setCellStyles:function(e,n,t,a){if(null!=n&&0<n.length){e.beginUpdate();try{for(var i=0;i<n.length;i++)if(null!=n[i]){var s=mxUtils.setStyle(e.getStyle(n[i]),t,a);e.setStyle(n[i],s)}}finally{e.endUpdate()}}},setStyle:function(e,n,t){var a=null!=t&&(void 0===t.length||0<t.length);if(null==e||0==e.length)a&&(e=n+"="+t);else{var i=e.indexOf(n+"=");i<0?a&&(a=";"==e.charAt(e.length-1)?"":";",e=e+a+n+"="+t):(n=a?n+"="+t:"",t=e.indexOf(";",i),a||t++,e=e.substring(0,i)+n+(i<t?e.substring(t):""))}return e},setCellStyleFlags:function(e,n,t,a,i){if(null!=n&&0<n.length){e.beginUpdate();try{for(var s=0;s<n.length;s++)if(null!=n[s]){var o=mxUtils.setStyleFlag(e.getStyle(n[s]),t,a,i);e.setStyle(n[s],o)}}finally{e.endUpdate()}}},setStyleFlag:function(e,n,t,a){if(null==e||0==e.length)e=a||null==a?n+"="+t:n+"=0";else{var i=e.indexOf(n+"=");if(i<0)i=";"==e.charAt(e.length-1)?"":";",e=a||null==a?e+i+n+"="+t:e+i+n+"=0";else{var s=e.indexOf(";",i),o="";o=s<0?e.substring(i+n.length+1):e.substring(i+n.length+1,s),o=null==a?parseInt(o)^t:a?parseInt(o)|t:parseInt(o)&~t;e=e.substring(0,i)+n+"="+o+(0<=s?e.substring(s):"")}}return e},getAlignmentAsPoint:function(e,n){var t=0,a=0;return e==mxConstants.ALIGN_CENTER?t=-.5:e==mxConstants.ALIGN_RIGHT&&(t=-1),n==mxConstants.ALIGN_MIDDLE?a=-.5:n==mxConstants.ALIGN_BOTTOM&&(a=-1),new mxPoint(t,a)},getSizeForString:function(e,n,t){n=null!=n?n:mxConstants.DEFAULT_FONTSIZE,t=null!=t?t:mxConstants.DEFAULT_FONTFAMILY;var a=document.createElement("div");return a.style.fontFamily=t,a.style.fontSize=Math.round(n)+"px",a.style.lineHeight=Math.round(n*mxConstants.LINE_HEIGHT)+"px",a.style.position="absolute",a.style.whiteSpace="nowrap",a.style.visibility="hidden",a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.innerHTML=e,document.body.appendChild(a),e=new mxRectangle(0,0,a.offsetWidth,a.offsetHeight),document.body.removeChild(a),e},getViewXml:function(e,n,t,a,i){a=null!=a?a:0,i=null!=i?i:0,n=null!=n?n:1,null==t&&(t=[e.getModel().getRoot()]);var s=e.getView(),o=null,r=s.isEventsEnabled();s.setEventsEnabled(!1);var l=s.drawPane,d=s.overlayPane;e.dialect==mxConstants.DIALECT_SVG?(s.drawPane=document.createElementNS(mxConstants.NS_SVG,"g"),s.canvas.appendChild(s.drawPane),s.overlayPane=document.createElementNS(mxConstants.NS_SVG,"g")):(s.drawPane=s.drawPane.cloneNode(!1),s.canvas.appendChild(s.drawPane),s.overlayPane=s.overlayPane.cloneNode(!1)),s.canvas.appendChild(s.overlayPane);var c=s.getTranslate();s.translate=new mxPoint(a,i),n=new mxTemporaryCellStates(e.getView(),n,t);try{o=(new mxCodec).encode(e.getView())}finally{n.destroy(),s.translate=c,s.canvas.removeChild(s.drawPane),s.canvas.removeChild(s.overlayPane),s.drawPane=l,s.overlayPane=d,s.setEventsEnabled(r)}return o},getScaleForPageCount:function(e,n,t,a){if(e<1)return 1;a=null!=a?a:0;var i=(t=null!=t?t:mxConstants.PAGE_FORMAT_A4_PORTRAIT).width-2*a;t=t.height-2*a,a=n.getGraphBounds().clone(),n=n.getView().getScale(),a.width/=n,a.height/=n,t=(n=a.width)/a.height/(i/t),a=Math.sqrt(e);var s=Math.sqrt(t);if(t=a*s,a/=s,t<1&&e<a){var o=a/e;a=e,t/=o}for(a<1&&e<t&&(o=t/e,t=e,a/=o),o=Math.ceil(t)*Math.ceil(a),s=0;e<o;){o=Math.floor(t)/t;var r=Math.floor(a)/a;if(1==o&&(o=Math.floor(t-1)/t),1==r&&(r=Math.floor(a-1)/a),t*=o=r<o?o:r,a*=o,o=Math.ceil(t)*Math.ceil(a),10<++s)break}return i*t/n*.99999},show:function(e,n,t,a){if(t=null!=t?t:0,a=null!=a?a:0,null==n?n=window.open().document:n.open(),t=-(i=e.getGraphBounds()).x+t,a=-i.y+a,mxClient.IS_IE){for(var i="<html><head>",s=document.getElementsByTagName("base"),o=0;o<s.length;o++)i+=s[o].outerHTML;for(i+="<style>",o=0;o<document.styleSheets.length;o++)try{i+=document.styleSheets(o).cssText}catch(e){}i+="</style></head>",i+="<body>",i+=e.container.innerHTML,i+="</body>",i+="<html>",n.writeln(i),n.close(),null!=(e=n.body.getElementsByTagName("DIV")[0])&&(e.style.position="absolute",e.style.left=t+"px",e.style.top=a+"px")}else{for(n.writeln("<html"),n.writeln("<head>"),s=document.getElementsByTagName("base"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("link"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("style"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(n.writeln("</head>"),n.writeln("</html>"),n.close(),null==n.body&&n.documentElement.appendChild(n.createElement("body")),n.body.style.overflow="auto",e=e.container.firstChild;null!=e;)o=e.cloneNode(!0),n.body.appendChild(o),e=e.nextSibling;null!=(e=n.getElementsByTagName("g")[0])&&(e.setAttribute("transform","translate("+t+","+a+")"),(t=e.ownerSVGElement).setAttribute("width",i.width+Math.max(i.x,0)+3),t.setAttribute("height",i.height+Math.max(i.y,0)+3))}return mxUtils.removeCursors(n.body),n},printScreen:function(e){var n=window.open();mxUtils.show(e,n.document),e=function(){n.focus(),n.print(),n.close()},mxClient.IS_GC?n.setTimeout(e,500):e()},popup:function(e,n){if(n){var t=document.createElement("div");t.style.overflow="scroll",t.style.width="636px",t.style.height="460px";var a=document.createElement("pre");a.innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),t.appendChild(a),(t=new mxWindow("Popup Window",t,document.body.clientWidth/2-320,(document.body.clientHeight||document.documentElement.clientHeight)/2-240,640,480,!1,!0)).setClosable(!0),t.setVisible(!0)}else mxClient.IS_NS?((t=window.open()).document.writeln("<pre>"+mxUtils.htmlEntities(e)+"</pre"),t.document.close()):((a=(t=window.open()).document.createElement("pre")).innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),t.document.body.appendChild(a))},alert:function(e){alert(e)},prompt:function(e,n){return prompt(e,n)},confirm:function(e){return confirm(e)},error:function(e,n,t,a){var i=document.createElement("div");i.style.padding="20px";var s=document.createElement("img");s.setAttribute("src",a||mxUtils.errorImage),s.setAttribute("valign","bottom"),s.style.verticalAlign="middle",i.appendChild(s),i.appendChild(document.createTextNode(" ")),i.appendChild(document.createTextNode(" ")),i.appendChild(document.createTextNode(" ")),mxUtils.write(i,e),e=document.body.clientWidth,a=document.body.clientHeight||document.documentElement.clientHeight;var o=new mxWindow(mxResources.get(mxUtils.errorResource)||mxUtils.errorResource,i,(e-n)/2,a/4,n,null,!1,!0);return t&&(mxUtils.br(i),n=document.createElement("p"),t=document.createElement("button"),mxClient.IS_IE?t.style.cssText="float:right":t.setAttribute("style","float:right"),mxEvent.addListener(t,"click",function(e){o.destroy()}),mxUtils.write(t,mxResources.get(mxUtils.closeResource)||mxUtils.closeResource),n.appendChild(t),i.appendChild(n),mxUtils.br(i),o.setClosable(!0)),o.setVisible(!0),o},makeDraggable:function(e,n,t,i,a,s,o,r,l,d){return(e=new mxDragSource(e,t)).dragOffset=new mxPoint(null!=a?a:0,null!=s?s:mxConstants.TOOLTIP_VERTICAL_OFFSET),e.autoscroll=o,e.setGuidesEnabled(!1),null!=l&&(e.highlightDropTargets=l),null!=d&&(e.getDropTarget=d),e.getGraphForEvent=function(e){return"function"==typeof n?n(e):n},null!=i&&(e.createDragElement=function(){return i.cloneNode(!0)},r&&(e.createPreviewElement=function(e){var n=i.cloneNode(!0),t=parseInt(n.style.width),a=parseInt(n.style.height);return n.style.width=Math.round(t*e.view.scale)+"px",n.style.height=Math.round(a*e.view.scale)+"px",n})),e}},mxConstants={DEFAULT_HOTSPOT:.3,MIN_HOTSPOT_SIZE:8,MAX_HOTSPOT_SIZE:0,RENDERING_HINT_EXACT:"exact",RENDERING_HINT_FASTER:"faster",RENDERING_HINT_FASTEST:"fastest",DIALECT_SVG:"svg",DIALECT_VML:"vml",DIALECT_MIXEDHTML:"mixedHtml",DIALECT_PREFERHTML:"preferHtml",DIALECT_STRICTHTML:"strictHtml",NS_SVG:"http://www.w3.org/2000/svg",NS_XHTML:"http://www.w3.org/1999/xhtml",NS_XLINK:"http://www.w3.org/1999/xlink",SHADOWCOLOR:"gray",SHADOW_OFFSET_X:2,SHADOW_OFFSET_Y:3,SHADOW_OPACITY:1,NODETYPE_ELEMENT:1,NODETYPE_ATTRIBUTE:2,NODETYPE_TEXT:3,NODETYPE_CDATA:4,NODETYPE_ENTITY_REFERENCE:5,NODETYPE_ENTITY:6,NODETYPE_PROCESSING_INSTRUCTION:7,NODETYPE_COMMENT:8,NODETYPE_DOCUMENT:9,NODETYPE_DOCUMENTTYPE:10,NODETYPE_DOCUMENT_FRAGMENT:11,NODETYPE_NOTATION:12,TOOLTIP_VERTICAL_OFFSET:16,DEFAULT_VALID_COLOR:"#00FF00",DEFAULT_INVALID_COLOR:"#FF0000",HIGHLIGHT_STROKEWIDTH:3,CURSOR_MOVABLE_VERTEX:"move",CURSOR_MOVABLE_EDGE:"move",CURSOR_LABEL_HANDLE:"default",CURSOR_BEND_HANDLE:"pointer",CURSOR_CONNECT:"pointer",HIGHLIGHT_COLOR:"#00FF00",CONNECT_TARGET_COLOR:"#0000FF",INVALID_CONNECT_TARGET_COLOR:"#FF0000",DROP_TARGET_COLOR:"#0000FF",VALID_COLOR:"#00FF00",INVALID_COLOR:"#FF0000",EDGE_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_STROKEWIDTH:1,EDGE_SELECTION_STROKEWIDTH:1,VERTEX_SELECTION_DASHED:!0,EDGE_SELECTION_DASHED:!0,GUIDE_COLOR:"#FF0000",GUIDE_STROKEWIDTH:1,OUTLINE_COLOR:"#0099FF",OUTLINE_STROKEWIDTH:mxClient.IS_IE?2:3,HANDLE_SIZE:7,LABEL_HANDLE_SIZE:4,HANDLE_FILLCOLOR:"#00FF00",HANDLE_STROKECOLOR:"black",LABEL_HANDLE_FILLCOLOR:"yellow",CONNECT_HANDLE_FILLCOLOR:"#0000FF",LOCKED_HANDLE_FILLCOLOR:"#FF0000",OUTLINE_HANDLE_FILLCOLOR:"#00FFFF",OUTLINE_HANDLE_STROKECOLOR:"#0033FF",DEFAULT_FONTFAMILY:"Arial,Helvetica",DEFAULT_FONTSIZE:11,LINE_HEIGHT:1.2,DEFAULT_FONTSTYLE:0,DEFAULT_STARTSIZE:40,DEFAULT_MARKERSIZE:6,DEFAULT_IMAGESIZE:24,ENTITY_SEGMENT:30,RECTANGLE_ROUNDING_FACTOR:.15,LINE_ARCSIZE:20,ARROW_SPACING:10,ARROW_WIDTH:30,ARROW_SIZE:30,PAGE_FORMAT_A4_PORTRAIT:new mxRectangle(0,0,826,1169),PAGE_FORMAT_A4_LANDSCAPE:new mxRectangle(0,0,1169,826),PAGE_FORMAT_LETTER_PORTRAIT:new mxRectangle(0,0,850,1100),PAGE_FORMAT_LETTER_LANDSCAPE:new mxRectangle(0,0,1100,850),NONE:"none",STYLE_PERIMETER:"perimeter",STYLE_SOURCE_PORT:"sourcePort",STYLE_TARGET_PORT:"targetPort",STYLE_PORT_CONSTRAINT:"portConstraint",STYLE_OPACITY:"opacity",STYLE_TEXT_OPACITY:"textOpacity",STYLE_OVERFLOW:"overflow",STYLE_ORTHOGONAL:"orthogonal",STYLE_EXIT_X:"exitX",STYLE_EXIT_Y:"exitY",STYLE_EXIT_PERIMETER:"exitPerimeter",STYLE_ENTRY_X:"entryX",STYLE_ENTRY_Y:"entryY",STYLE_ENTRY_PERIMETER:"entryPerimeter",STYLE_WHITE_SPACE:"whiteSpace",STYLE_ROTATION:"rotation",STYLE_FILLCOLOR:"fillColor",STYLE_SWIMLANE_FILLCOLOR:"swimlaneFillColor",STYLE_GRADIENTCOLOR:"gradientColor",STYLE_GRADIENT_DIRECTION:"gradientDirection",STYLE_STROKECOLOR:"strokeColor",STYLE_SEPARATORCOLOR:"separatorColor",STYLE_STROKEWIDTH:"strokeWidth",STYLE_ALIGN:"align",STYLE_VERTICAL_ALIGN:"verticalAlign",STYLE_LABEL_POSITION:"labelPosition",STYLE_VERTICAL_LABEL_POSITION:"verticalLabelPosition",STYLE_IMAGE_ASPECT:"imageAspect",STYLE_IMAGE_ALIGN:"imageAlign",STYLE_IMAGE_VERTICAL_ALIGN:"imageVerticalAlign",STYLE_GLASS:"glass",STYLE_IMAGE:"image",STYLE_IMAGE_WIDTH:"imageWidth",STYLE_IMAGE_HEIGHT:"imageHeight",STYLE_IMAGE_BACKGROUND:"imageBackground",STYLE_IMAGE_BORDER:"imageBorder",STYLE_FLIPH:"flipH",STYLE_FLIPV:"flipV",STYLE_NOLABEL:"noLabel",STYLE_NOEDGESTYLE:"noEdgeStyle",STYLE_LABEL_BACKGROUNDCOLOR:"labelBackgroundColor",STYLE_LABEL_BORDERCOLOR:"labelBorderColor",STYLE_LABEL_PADDING:"labelPadding",STYLE_INDICATOR_SHAPE:"indicatorShape",STYLE_INDICATOR_IMAGE:"indicatorImage",STYLE_INDICATOR_COLOR:"indicatorColor",STYLE_INDICATOR_STROKECOLOR:"indicatorStrokeColor",STYLE_INDICATOR_GRADIENTCOLOR:"indicatorGradientColor",STYLE_INDICATOR_SPACING:"indicatorSpacing",STYLE_INDICATOR_WIDTH:"indicatorWidth",STYLE_INDICATOR_HEIGHT:"indicatorHeight",STYLE_INDICATOR_DIRECTION:"indicatorDirection",STYLE_SHADOW:"shadow",STYLE_SEGMENT:"segment",STYLE_ENDARROW:"endArrow",STYLE_STARTARROW:"startArrow",STYLE_ENDSIZE:"endSize",STYLE_STARTSIZE:"startSize",STYLE_SWIMLANE_LINE:"swimlaneLine",STYLE_ENDFILL:"endFill",STYLE_STARTFILL:"startFill",STYLE_DASHED:"dashed",STYLE_DASH_PATTERN:"dashPattern",STYLE_ROUNDED:"rounded",STYLE_CURVED:"curved",STYLE_ARCSIZE:"arcSize",STYLE_SMOOTH:"smooth",STYLE_SOURCE_PERIMETER_SPACING:"sourcePerimeterSpacing",STYLE_TARGET_PERIMETER_SPACING:"targetPerimeterSpacing",STYLE_PERIMETER_SPACING:"perimeterSpacing",STYLE_SPACING:"spacing",STYLE_SPACING_TOP:"spacingTop",STYLE_SPACING_LEFT:"spacingLeft",STYLE_SPACING_BOTTOM:"spacingBottom",STYLE_SPACING_RIGHT:"spacingRight",STYLE_HORIZONTAL:"horizontal",STYLE_DIRECTION:"direction",STYLE_ELBOW:"elbow",STYLE_FONTCOLOR:"fontColor",STYLE_FONTFAMILY:"fontFamily",STYLE_FONTSIZE:"fontSize",STYLE_FONTSTYLE:"fontStyle",STYLE_AUTOSIZE:"autosize",STYLE_FOLDABLE:"foldable",STYLE_EDITABLE:"editable",STYLE_BENDABLE:"bendable",STYLE_MOVABLE:"movable",STYLE_RESIZABLE:"resizable",STYLE_CLONEABLE:"cloneable",STYLE_DELETABLE:"deletable",STYLE_SHAPE:"shape",STYLE_EDGE:"edgeStyle",STYLE_LOOP:"loopStyle",STYLE_ROUTING_CENTER_X:"routingCenterX",STYLE_ROUTING_CENTER_Y:"routingCenterY",FONT_BOLD:1,FONT_ITALIC:2,FONT_UNDERLINE:4,FONT_SHADOW:8,SHAPE_RECTANGLE:"rectangle",SHAPE_ELLIPSE:"ellipse",SHAPE_DOUBLE_ELLIPSE:"doubleEllipse",SHAPE_RHOMBUS:"rhombus",SHAPE_LINE:"line",SHAPE_IMAGE:"image",SHAPE_ARROW:"arrow",SHAPE_LABEL:"label",SHAPE_CYLINDER:"cylinder",SHAPE_SWIMLANE:"swimlane",SHAPE_CONNECTOR:"connector",SHAPE_ACTOR:"actor",SHAPE_CLOUD:"cloud",SHAPE_TRIANGLE:"triangle",SHAPE_HEXAGON:"hexagon",ARROW_CLASSIC:"classic",ARROW_BLOCK:"block",ARROW_OPEN:"open",ARROW_OVAL:"oval",ARROW_DIAMOND:"diamond",ARROW_DIAMOND_THIN:"diamondThin",ALIGN_LEFT:"left",ALIGN_CENTER:"center",ALIGN_RIGHT:"right",ALIGN_TOP:"top",ALIGN_MIDDLE:"middle",ALIGN_BOTTOM:"bottom",DIRECTION_NORTH:"north",DIRECTION_SOUTH:"south",DIRECTION_EAST:"east",DIRECTION_WEST:"west",DIRECTION_MASK_NONE:0,DIRECTION_MASK_WEST:1,DIRECTION_MASK_NORTH:2,DIRECTION_MASK_SOUTH:4,DIRECTION_MASK_EAST:8,DIRECTION_MASK_ALL:15,ELBOW_VERTICAL:"vertical",ELBOW_HORIZONTAL:"horizontal",EDGESTYLE_ELBOW:"elbowEdgeStyle",EDGESTYLE_ENTITY_RELATION:"entityRelationEdgeStyle",EDGESTYLE_LOOP:"loopEdgeStyle",EDGESTYLE_SIDETOSIDE:"sideToSideEdgeStyle",EDGESTYLE_TOPTOBOTTOM:"topToBottomEdgeStyle",EDGESTYLE_ORTHOGONAL:"orthogonalEdgeStyle",EDGESTYLE_SEGMENT:"segmentEdgeStyle",PERIMETER_ELLIPSE:"ellipsePerimeter",PERIMETER_RECTANGLE:"rectanglePerimeter",PERIMETER_RHOMBUS:"rhombusPerimeter",PERIMETER_TRIANGLE:"trianglePerimeter"};function mxEventObject(e){this.name=e,this.properties=[];for(var n=1;n<arguments.length;n+=2)null!=arguments[n+1]&&(this.properties[arguments[n]]=arguments[n+1])}function mxMouseEvent(e,n){this.evt=e,this.state=n}function mxEventSource(e){this.setEventSource(e)}mxEventObject.prototype.name=null,mxEventObject.prototype.properties=null,mxEventObject.prototype.consumed=!1,mxEventObject.prototype.getName=function(){return this.name},mxEventObject.prototype.getProperties=function(){return this.properties},mxEventObject.prototype.getProperty=function(e){return this.properties[e]},mxEventObject.prototype.isConsumed=function(){return this.consumed},mxEventObject.prototype.consume=function(){this.consumed=!0},mxMouseEvent.prototype.consumed=!1,mxMouseEvent.prototype.evt=null,mxMouseEvent.prototype.graphX=null,mxMouseEvent.prototype.graphY=null,mxMouseEvent.prototype.state=null,mxMouseEvent.prototype.getEvent=function(){return this.evt},mxMouseEvent.prototype.getSource=function(){return mxEvent.getSource(this.evt)},mxMouseEvent.prototype.isSource=function(e){if(null!=e)for(var n=this.getSource();null!=n;){if(n==e.node)return!0;n=n.parentNode}return!1},mxMouseEvent.prototype.getX=function(){return mxEvent.getClientX(this.getEvent())},mxMouseEvent.prototype.getY=function(){return mxEvent.getClientY(this.getEvent())},mxMouseEvent.prototype.getGraphX=function(){return this.graphX},mxMouseEvent.prototype.getGraphY=function(){return this.graphY},mxMouseEvent.prototype.getState=function(){return this.state},mxMouseEvent.prototype.getCell=function(){var e=this.getState();return null!=e?e.cell:null},mxMouseEvent.prototype.isPopupTrigger=function(){return mxEvent.isPopupTrigger(this.getEvent())},mxMouseEvent.prototype.isConsumed=function(){return this.consumed},mxMouseEvent.prototype.consume=function(e){(null==e||e)&&this.evt.preventDefault&&this.evt.preventDefault(),this.evt.returnValue=!1,this.consumed=!0},mxEventSource.prototype.eventListeners=null,mxEventSource.prototype.eventsEnabled=!0,mxEventSource.prototype.eventSource=null,mxEventSource.prototype.isEventsEnabled=function(){return this.eventsEnabled},mxEventSource.prototype.setEventsEnabled=function(e){this.eventsEnabled=e},mxEventSource.prototype.getEventSource=function(){return this.eventSource},mxEventSource.prototype.setEventSource=function(e){this.eventSource=e},mxEventSource.prototype.addListener=function(e,n){null==this.eventListeners&&(this.eventListeners=[]),this.eventListeners.push(e),this.eventListeners.push(n)},mxEventSource.prototype.removeListener=function(e){if(null!=this.eventListeners)for(var n=0;n<this.eventListeners.length;)this.eventListeners[n+1]==e?this.eventListeners.splice(n,2):n+=2},mxEventSource.prototype.fireEvent=function(e,n){if(null!=this.eventListeners&&this.isEventsEnabled()){null==e&&(e=new mxEventObject),null==n&&(n=this.getEventSource()),null==n&&(n=this);for(var t=[n,e],a=0;a<this.eventListeners.length;a+=2){var i=this.eventListeners[a];(null==i||i==e.getName())&&this.eventListeners[a+1].apply(this,t)}}};var mxEvent={objects:[],addListener:function(){var a=function(e,n,t){null==e.mxListenerList&&(e.mxListenerList=[],mxEvent.objects.push(e)),e.mxListenerList.push({name:n,f:t})};return window.addEventListener?function(e,n,t){e.addEventListener(n,t,!1),a(e,n,t)}:function(e,n,t){e.attachEvent("on"+n,t),a(e,n,t)}}(),removeListener:function(){var a=function(e,n,t){if(null!=e.mxListenerList){n=e.mxListenerList.length;for(var a=0;a<n;a++)if(e.mxListenerList[a].f==t){e.mxListenerList.splice(a,1);break}0==e.mxListenerList.length&&(e.mxListenerList=null)}};return window.removeEventListener?function(e,n,t){e.removeEventListener(n,t,!1),a(e,n,t)}:function(e,n,t){e.detachEvent("on"+n,t),a(e,n,t)}}(),removeAllListeners:function(e){var n=e.mxListenerList;if(null!=n)for(;0<n.length;){var t=n[0];mxEvent.removeListener(e,t.name,t.f)}},addGestureListeners:function(e,n,t,a){null!=n&&mxEvent.addListener(e,"mousedown",n),null!=t&&mxEvent.addListener(e,"mousemove",t),null!=a&&mxEvent.addListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=n&&mxEvent.addListener(e,"touchstart",n),null!=t&&mxEvent.addListener(e,"touchmove",t),null!=a&&mxEvent.addListener(e,"touchend",a))},removeGestureListeners:function(e,n,t,a){null!=n&&mxEvent.removeListener(e,"mousedown",n),null!=t&&mxEvent.removeListener(e,"mousemove",t),null!=a&&mxEvent.removeListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=n&&mxEvent.removeListener(e,"touchstart",n),null!=t&&mxEvent.removeListener(e,"touchmove",t),null!=a&&mxEvent.removeListener(e,"touchend",a))},redirectMouseEvents:function(e,t,n,a,i,s,o){var r=function(e){return"function"==typeof n?n(e):n};mxEvent.addGestureListeners(e,function(e){null!=a?a(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,r(e)))},function(e){null!=i?i(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,r(e)))},function(e){null!=s?s(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,r(e)))}),mxEvent.addListener(e,"dblclick",function(e){if(null!=o)o(e);else if(!mxEvent.isConsumed(e)){var n=r(e);t.dblClick(e,null!=n?n.cell:null)}})},release:function(e){if(null!=e&&(mxEvent.removeAllListeners(e),null!=(e=e.childNodes)))for(var n=e.length,t=0;t<n;t+=1)mxEvent.release(e[t])},addMouseWheelListener:function(t){if(null!=t){var e=function(e){null==e&&(e=window.event);var n=0;0!=(n=!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC?e.wheelDelta/120:-e.detail/2)&&t(e,0<n)};mxClient.IS_NS?mxEvent.addListener(window,mxClient.IS_SF||mxClient.IS_GC?"mousewheel":"DOMMouseScroll",e):mxEvent.addListener(document,"mousewheel",e)}},disableContextMenu:mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?function(e){mxEvent.addListener(e,"contextmenu",function(){return!1})}:function(e){e.setAttribute("oncontextmenu","return false;")},getSource:function(e){return null!=e.srcElement?e.srcElement:e.target},isConsumed:function(e){return null!=e.isConsumed&&e.isConsumed},isLeftMouseButton:function(e){return e.button==(mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?1:0)},isRightMouseButton:function(e){return 2==e.button},isPopupTrigger:function(e){return mxEvent.isRightMouseButton(e)||mxEvent.isShiftDown(e)&&!mxEvent.isControlDown(e)},isShiftDown:function(e){return null!=e&&e.shiftKey},isAltDown:function(e){return null!=e&&e.altKey},isControlDown:function(e){return null!=e&&e.ctrlKey},isMetaDown:function(e){return null!=e&&e.metaKey},getMainEvent:function(e){return"touchstart"!=e.type&&"touchmove"!=e.type||null==e.touches||null==e.touches[0]?"touchend"==e.type&&null!=e.changedTouches&&null!=e.changedTouches[0]&&(e=e.changedTouches[0]):e=e.touches[0],e},getClientX:function(e){return mxEvent.getMainEvent(e).clientX},getClientY:function(e){return mxEvent.getMainEvent(e).clientY},consume:function(e,n,t){t=null==t||t,(null==n||n)&&(e.preventDefault?(t&&e.stopPropagation(),e.preventDefault()):t&&(e.cancelBubble=!0)),e.isConsumed=!0,e.returnValue=!1},LABEL_HANDLE:-1,ROTATION_HANDLE:-2,MOUSE_DOWN:"mouseDown",MOUSE_MOVE:"mouseMove",MOUSE_UP:"mouseUp",ACTIVATE:"activate",RESIZE_START:"resizeStart",RESIZE:"resize",RESIZE_END:"resizeEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",PAN_START:"panStart",PAN:"pan",PAN_END:"panEnd",MINIMIZE:"minimize",NORMALIZE:"normalize",MAXIMIZE:"maximize",HIDE:"hide",SHOW:"show",CLOSE:"close",DESTROY:"destroy",REFRESH:"refresh",SIZE:"size",SELECT:"select",FIRED:"fired",GET:"get",RECEIVE:"receive",CONNECT:"connect",DISCONNECT:"disconnect",SUSPEND:"suspend",RESUME:"resume",MARK:"mark",SESSION:"session",ROOT:"root",POST:"post",OPEN:"open",SAVE:"save",BEFORE_ADD_VERTEX:"beforeAddVertex",ADD_VERTEX:"addVertex",AFTER_ADD_VERTEX:"afterAddVertex",DONE:"done",EXECUTE:"execute",EXECUTED:"executed",BEGIN_UPDATE:"beginUpdate",START_EDIT:"startEdit",END_UPDATE:"endUpdate",END_EDIT:"endEdit",BEFORE_UNDO:"beforeUndo",UNDO:"undo",REDO:"redo",CHANGE:"change",NOTIFY:"notify",LAYOUT_CELLS:"layoutCells",CLICK:"click",SCALE:"scale",TRANSLATE:"translate",SCALE_AND_TRANSLATE:"scaleAndTranslate",UP:"up",DOWN:"down",ADD:"add",REMOVE:"remove",CLEAR:"clear",ADD_CELLS:"addCells",CELLS_ADDED:"cellsAdded",MOVE_CELLS:"moveCells",CELLS_MOVED:"cellsMoved",RESIZE_CELLS:"resizeCells",CELLS_RESIZED:"cellsResized",TOGGLE_CELLS:"toggleCells",CELLS_TOGGLED:"cellsToggled",ORDER_CELLS:"orderCells",CELLS_ORDERED:"cellsOrdered",REMOVE_CELLS:"removeCells",CELLS_REMOVED:"cellsRemoved",GROUP_CELLS:"groupCells",UNGROUP_CELLS:"ungroupCells",REMOVE_CELLS_FROM_PARENT:"removeCellsFromParent",FOLD_CELLS:"foldCells",CELLS_FOLDED:"cellsFolded",ALIGN_CELLS:"alignCells",LABEL_CHANGED:"labelChanged",CONNECT_CELL:"connectCell",CELL_CONNECTED:"cellConnected",SPLIT_EDGE:"splitEdge",FLIP_EDGE:"flipEdge",START_EDITING:"startEditing",ADD_OVERLAY:"addOverlay",REMOVE_OVERLAY:"removeOverlay",UPDATE_CELL_SIZE:"updateCellSize",ESCAPE:"escape",CLICK:"click",DOUBLE_CLICK:"doubleClick",START:"start",RESET:"reset"};function mxXmlRequest(e,n,t,a,i,s){this.url=e,this.params=n,this.method=t||"POST",this.async=null==a||a,this.username=i,this.password=s}mxXmlRequest.prototype.url=null,mxXmlRequest.prototype.params=null,mxXmlRequest.prototype.method=null,mxXmlRequest.prototype.async=null,mxXmlRequest.prototype.binary=!1,mxXmlRequest.prototype.username=null,mxXmlRequest.prototype.password=null,mxXmlRequest.prototype.request=null,mxXmlRequest.prototype.isBinary=function(){return this.binary},mxXmlRequest.prototype.setBinary=function(e){this.binary=e},mxXmlRequest.prototype.getText=function(){return this.request.responseText},mxXmlRequest.prototype.isReady=function(){return 4==this.request.readyState},mxXmlRequest.prototype.getDocumentElement=function(){var e=this.getXml();return null!=e?e.documentElement:null},mxXmlRequest.prototype.getXml=function(){var e=this.request.responseXML;return(9<=document.documentMode||null==e||null==e.documentElement)&&(e=mxUtils.parseXml(this.request.responseText)),e},mxXmlRequest.prototype.getText=function(){return this.request.responseText},mxXmlRequest.prototype.getStatus=function(){return this.request.status},mxXmlRequest.prototype.create=window.XMLHttpRequest?function(){var e=new XMLHttpRequest;return this.isBinary()&&e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined"),e}:"undefined"!=typeof ActiveXObject?function(){return new ActiveXObject("Microsoft.XMLHTTP")}:void 0,mxXmlRequest.prototype.send=function(e,n){this.request=this.create(),null!=this.request&&(null!=e&&(this.request.onreadystatechange=mxUtils.bind(this,function(){this.isReady()&&(e(this),this.onreadystatechaange=null)})),this.request.open(this.method,this.url,this.async,this.username,this.password),this.setRequestHeaders(this.request,this.params),this.request.send(this.params))},mxXmlRequest.prototype.setRequestHeaders=function(e,n){null!=n&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},mxXmlRequest.prototype.simulate=function(e,n){var t=null;(e=e||document)==document&&(t=window.onbeforeunload,window.onbeforeunload=null);var a=e.createElement("form");a.setAttribute("method",this.method),a.setAttribute("action",this.url),null!=n&&a.setAttribute("target",n),a.style.display="none",a.style.visibility="hidden";for(var i=0<this.params.indexOf("&")?this.params.split("&"):this.params.split(),s=0;s<i.length;s++){if(0<(o=i[s].indexOf("="))){var o,r=i[s].substring(0,o),l=i[s].substring(o+1);(o=e.createElement("textarea")).setAttribute("name",r),l=l.replace(/\n/g,"&#xa;"),r=e.createTextNode(l),o.appendChild(r),a.appendChild(o)}}e.body.appendChild(a),a.submit(),e.body.removeChild(a),null!=t&&(window.onbeforeunload=t)};var mxClipboard={STEPSIZE:10,insertCount:1,cells:null,isEmpty:function(){return null==mxClipboard.cells},cut:function(e,n){return n=mxClipboard.copy(e,n),mxClipboard.insertCount=0,mxClipboard.removeCells(e,n),n},removeCells:function(e,n){e.removeCells(n)},copy:function(e,n){n=n||e.getSelectionCells();var t=e.getExportableCells(n);return mxClipboard.insertCount=1,mxClipboard.cells=e.cloneCells(t),t},paste:function(e){if(null!=mxClipboard.cells){var n=e.getImportableCells(mxClipboard.cells),t=mxClipboard.insertCount*mxClipboard.STEPSIZE,a=e.getDefaultParent();n=e.importCells(n,t,t,a);mxClipboard.insertCount++,e.setSelectionCells(n)}}};function mxWindow(e,n,t,a,i,s,o,r,l,d){null!=n&&(o=null==o||o,this.content=n,this.init(t,a,i,s,d),this.installMaximizeHandler(),this.installMinimizeHandler(),this.installCloseHandler(),this.setMinimizable(o),this.setTitle(e),(null==r||r)&&this.installMoveHandler(),null!=l&&null!=l.parentNode?l.parentNode.replaceChild(this.div,l):document.body.appendChild(this.div))}function mxForm(e){this.table=document.createElement("table"),this.table.className=e,this.body=document.createElement("tbody"),this.table.appendChild(this.body)}function mxImage(e,n,t){this.src=e,this.width=n,this.height=t}function mxDivResizer(e,n){if("div"==e.nodeName.toLowerCase()){null==n&&(n=window),this.div=e;var t=mxUtils.getCurrentStyle(e);null!=t&&(this.resizeWidth="auto"==t.width,this.resizeHeight="auto"==t.height),mxEvent.addListener(n,"resize",mxUtils.bind(this,function(e){this.handlingResize||(this.handlingResize=!0,this.resize(),this.handlingResize=!1)})),this.resize()}}function mxDragSource(e,n){this.element=e,this.dropHandler=n,mxEvent.addGestureListeners(e,mxUtils.bind(this,this.mouseDown))}function mxToolbar(e){this.container=e}function mxSession(n,e,t,a){this.model=n,this.urlInit=e,this.urlPoll=t,this.urlNotify=a,null!=n&&(this.codec=new mxCodec,this.codec.lookup=function(e){return n.getCell(e)}),n.addListener(mxEvent.NOTIFY,mxUtils.bind(this,function(e,n){var t=n.getProperty("edit");(null!=t&&this.debug||this.connected&&!this.suspended)&&this.notify("<edit>"+this.encodeChanges(t.changes,t.undone)+"</edit>")}))}function mxUndoableEdit(e,n){this.source=e,this.changes=[],this.significant=null==n||n}function mxUndoManager(e){this.size=null!=e?e:100,this.clear()}mxWindow.prototype=new mxEventSource,mxWindow.prototype.constructor=mxWindow,mxWindow.prototype.closeImage=mxClient.imageBasePath+"/close.gif",mxWindow.prototype.minimizeImage=mxClient.imageBasePath+"/minimize.gif",mxWindow.prototype.normalizeImage=mxClient.imageBasePath+"/normalize.gif",mxWindow.prototype.maximizeImage=mxClient.imageBasePath+"/maximize.gif",mxWindow.prototype.resizeImage=mxClient.imageBasePath+"/resize.gif",mxWindow.prototype.visible=!1,mxWindow.prototype.content=!1,mxWindow.prototype.minimumSize=new mxRectangle(0,0,50,40),mxWindow.prototype.title=!1,mxWindow.prototype.content=!1,mxWindow.prototype.destroyOnClose=!0,mxWindow.prototype.init=function(e,n,t,a,i){i=null!=i?i:"mxWindow",this.div=document.createElement("div"),this.div.className=i,this.div.style.left=e+"px",this.div.style.top=n+"px",this.table=document.createElement("table"),this.table.className=i,null!=t&&(mxClient.IS_IE||(this.div.style.width=t+"px"),this.table.style.width=t+"px"),null!=a&&(mxClient.IS_IE||(this.div.style.height=a+"px"),this.table.style.height=a+"px"),e=document.createElement("tbody"),n=document.createElement("tr"),this.title=document.createElement("td"),this.title.className=i+"Title",n.appendChild(this.title),e.appendChild(n),n=document.createElement("tr"),this.td=document.createElement("td"),this.td.className=i+"Pane",this.contentWrapper=document.createElement("div"),this.contentWrapper.className=i+"Pane",this.contentWrapper.style.width="100%",this.contentWrapper.appendChild(this.content),(mxClient.IS_IE||"DIV"!=this.content.nodeName.toUpperCase())&&(this.contentWrapper.style.height="100%"),this.td.appendChild(this.contentWrapper),n.appendChild(this.td),e.appendChild(n),this.table.appendChild(e),this.div.appendChild(this.table),i=mxUtils.bind(this,function(e){this.activate()}),mxEvent.addListener(this.title,"mousedown",i),mxEvent.addListener(this.table,"mousedown",i),mxClient.IS_TOUCH&&(mxEvent.addListener(this.title,"touchstart",i),mxEvent.addListener(this.table,"touchstart",i)),this.hide()},mxWindow.prototype.setTitle=function(e){for(var n=this.title.firstChild;null!=n;){var t=n.nextSibling;n.nodeType==mxConstants.NODETYPE_TEXT&&n.parentNode.removeChild(n),n=t}mxUtils.write(this.title,e||"")},mxWindow.prototype.setScrollable=function(e){navigator.userAgent.indexOf("Presto/2.5")<0&&(this.contentWrapper.style.overflow=e?"auto":"hidden")},mxWindow.prototype.activate=function(){if(mxWindow.activeWindow!=this){var e=null!=(e=mxUtils.getCurrentStyle(this.getElement()))?e.zIndex:3;if(mxWindow.activeWindow){var n=mxWindow.activeWindow.getElement();null!=n&&null!=n.style&&(n.style.zIndex=e)}n=mxWindow.activeWindow,this.getElement().style.zIndex=parseInt(e)+1,(mxWindow.activeWindow=this).fireEvent(new mxEventObject(mxEvent.ACTIVATE,"previousWindow",n))}},mxWindow.prototype.getElement=function(){return this.div},mxWindow.prototype.fit=function(){mxUtils.fit(this.div)},mxWindow.prototype.isResizable=function(){return null!=this.resize&&"none"!=this.resize.style.display},mxWindow.prototype.setResizable=function(e){e?null==this.resize?(this.resize=document.createElement("img"),this.resize.style.position="absolute",this.resize.style.bottom="2px",this.resize.style.right="2px",this.resize.setAttribute("src",mxClient.imageBasePath+"/resize.gif"),this.resize.style.cursor="nw-resize",mxEvent.addGestureListeners(this.resize,mxUtils.bind(this,function(e){this.activate();var a=mxEvent.getClientX(e),i=mxEvent.getClientY(e),s=this.div.offsetWidth,o=this.div.offsetHeight,n=mxUtils.bind(this,function(e){var n=mxEvent.getClientX(e)-a,t=mxEvent.getClientY(e)-i;this.setSize(s+n,o+t),this.fireEvent(new mxEventObject(mxEvent.RESIZE,"event",e)),mxEvent.consume(e)}),t=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_START,"event",e)),mxEvent.consume(e)}),null,null),this.div.appendChild(this.resize)):this.resize.style.display="inline":null!=this.resize&&(this.resize.style.display="none")},mxWindow.prototype.setSize=function(e,n){e=Math.max(this.minimumSize.width,e),n=Math.max(this.minimumSize.height,n),mxClient.IS_IE||(this.div.style.width=e+"px",this.div.style.height=n+"px"),this.table.style.width=e+"px",this.table.style.height=n+"px",mxClient.IS_IE||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px")},mxWindow.prototype.setMinimizable=function(e){this.minimize.style.display=e?"":"none"},mxWindow.prototype.getMinimumSize=function(){return new mxRectangle(0,0,0,this.title.offsetHeight)},mxWindow.prototype.installMinimizeHandler=function(){this.minimize=document.createElement("img"),this.minimize.setAttribute("src",this.minimizeImage),this.minimize.setAttribute("align","right"),this.minimize.setAttribute("title","Minimize"),this.minimize.style.cursor="pointer",this.minimize.style.marginRight="1px",this.minimize.style.display="none",this.title.appendChild(this.minimize);var t=!1,a=null,i=null,e=mxUtils.bind(this,function(e){if(this.activate(),t)t=!1,this.minimize.setAttribute("src",this.minimizeImage),this.minimize.setAttribute("title","Minimize"),this.contentWrapper.style.display="",this.maximize.style.display=a,mxClient.IS_IE||(this.div.style.height=i),this.table.style.height=i,null!=this.resize&&(this.resize.style.visibility=""),this.fireEvent(new mxEventObject(mxEvent.NORMALIZE,"event",e));else{t=!0,this.minimize.setAttribute("src",this.normalizeImage),this.minimize.setAttribute("title","Normalize"),this.contentWrapper.style.display="none",a=this.maximize.style.display,this.maximize.style.display="none",i=this.table.style.height;var n=this.getMinimumSize();0<n.height&&(mxClient.IS_IE||(this.div.style.height=n.height+"px"),this.table.style.height=n.height+"px"),0<n.width&&(mxClient.IS_IE||(this.div.style.width=n.width+"px"),this.table.style.width=n.width+"px"),null!=this.resize&&(this.resize.style.visibility="hidden"),this.fireEvent(new mxEventObject(mxEvent.MINIMIZE,"event",e))}mxEvent.consume(e)});mxEvent.addListener(this.minimize,"mousedown",e),mxClient.IS_TOUCH&&mxEvent.addListener(this.minimize,"touchstart",e)},mxWindow.prototype.setMaximizable=function(e){this.maximize.style.display=e?"":"none"},mxWindow.prototype.installMaximizeHandler=function(){this.maximize=document.createElement("img"),this.maximize.setAttribute("src",this.maximizeImage),this.maximize.setAttribute("align","right"),this.maximize.setAttribute("title","Maximize"),this.maximize.style.cursor="default",this.maximize.style.marginLeft="1px",this.maximize.style.cursor="pointer",this.maximize.style.display="none",this.title.appendChild(this.maximize);var t=!1,a=null,i=null,s=null,o=null,e=mxUtils.bind(this,function(e){if(this.activate(),"none"!=this.maximize.style.display){if(t)t=!1,this.maximize.setAttribute("src",this.maximizeImage),this.maximize.setAttribute("title","Maximize"),this.contentWrapper.style.display="",this.minimize.style.visibility="",this.div.style.left=a+"px",this.div.style.top=i+"px",mxClient.IS_IE||(this.div.style.height=s,this.div.style.width=o,"auto"!=(n=mxUtils.getCurrentStyle(this.contentWrapper)).overflow&&null==this.resize)||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px"),this.table.style.height=s,this.table.style.width=o,null!=this.resize&&(this.resize.style.visibility=""),this.fireEvent(new mxEventObject(mxEvent.NORMALIZE,"event",e));else{if(t=!0,this.maximize.setAttribute("src",this.normalizeImage),this.maximize.setAttribute("title","Normalize"),this.contentWrapper.style.display="",this.minimize.style.visibility="hidden",a=parseInt(this.div.style.left),i=parseInt(this.div.style.top),s=this.table.style.height,o=this.table.style.width,this.div.style.left="0px",this.div.style.top="0px",mxClient.IS_IE||(this.div.style.height=document.body.clientHeight-2+"px",this.div.style.width=document.body.clientWidth-2+"px"),this.table.style.width=document.body.clientWidth-2+"px",this.table.style.height=document.body.clientHeight-2+"px",null!=this.resize&&(this.resize.style.visibility="hidden"),!mxClient.IS_IE){var n=mxUtils.getCurrentStyle(this.contentWrapper);"auto"!=n.overflow&&null==this.resize||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px")}this.fireEvent(new mxEventObject(mxEvent.MAXIMIZE,"event",e))}mxEvent.consume(e)}});mxEvent.addGestureListeners(this.maximize,e),mxEvent.addListener(this.title,"dblclick",e)},mxWindow.prototype.installMoveHandler=function(){this.title.style.cursor="move",mxEvent.addGestureListeners(this.title,mxUtils.bind(this,function(e){var a=mxEvent.getClientX(e),i=mxEvent.getClientY(e),s=this.getX(),o=this.getY(),n=mxUtils.bind(this,function(e){var n=mxEvent.getClientX(e)-a,t=mxEvent.getClientY(e)-i;this.setLocation(s+n,o+t),this.fireEvent(new mxEventObject(mxEvent.MOVE,"event",e)),mxEvent.consume(e)}),t=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.MOVE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.MOVE_START,"event",e)),mxEvent.consume(e)}))},mxWindow.prototype.setLocation=function(e,n){this.div.style.left=e+"px",this.div.style.top=n+"px"},mxWindow.prototype.getX=function(){return parseInt(this.div.style.left)},mxWindow.prototype.getY=function(){return parseInt(this.div.style.top)},mxWindow.prototype.installCloseHandler=function(){this.closeImg=document.createElement("img"),this.closeImg.setAttribute("src",this.closeImage),this.closeImg.setAttribute("align","right"),this.closeImg.setAttribute("title","Close"),this.closeImg.style.marginLeft="2px",this.closeImg.style.cursor="pointer",this.closeImg.style.display="none",this.title.insertBefore(this.closeImg,this.title.firstChild),mxEvent.addGestureListeners(this.closeImg,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.CLOSE,"event",e)),this.destroyOnClose?this.destroy():this.setVisible(!1),mxEvent.consume(e)}))},mxWindow.prototype.setImage=function(e){this.image=document.createElement("img"),this.image.setAttribute("src",e),this.image.setAttribute("align","left"),this.image.style.marginRight="4px",this.image.style.marginLeft="0px",this.image.style.marginTop="-2px",this.title.insertBefore(this.image,this.title.firstChild)},mxWindow.prototype.setClosable=function(e){this.closeImg.style.display=e?"":"none"},mxWindow.prototype.isVisible=function(){return null!=this.div&&"hidden"!=this.div.style.visibility},mxWindow.prototype.setVisible=function(e){null!=this.div&&this.isVisible()!=e&&(e?this.show():this.hide())},mxWindow.prototype.show=function(){this.div.style.visibility="",this.activate();var e=mxUtils.getCurrentStyle(this.contentWrapper);mxClient.IS_IE||"auto"!=e.overflow&&null==this.resize||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px"),this.fireEvent(new mxEventObject(mxEvent.SHOW))},mxWindow.prototype.hide=function(){this.div.style.visibility="hidden",this.fireEvent(new mxEventObject(mxEvent.HIDE))},mxWindow.prototype.destroy=function(){this.fireEvent(new mxEventObject(mxEvent.DESTROY)),null!=this.div&&(mxEvent.release(this.div),this.div.parentNode.removeChild(this.div),this.div=null),this.contentWrapper=this.content=this.title=null},mxForm.prototype.table=null,mxForm.prototype.body=!1,mxForm.prototype.getTable=function(){return this.table},mxForm.prototype.addButtons=function(e,n){var t=document.createElement("tr"),a=document.createElement("td");t.appendChild(a);a=document.createElement("td");var i=document.createElement("button");mxUtils.write(i,mxResources.get("ok")||"OK"),a.appendChild(i),mxEvent.addListener(i,"click",function(){e()}),i=document.createElement("button"),mxUtils.write(i,mxResources.get("cancel")||"Cancel"),a.appendChild(i),mxEvent.addListener(i,"click",function(){n()}),t.appendChild(a),this.body.appendChild(t)},mxForm.prototype.addText=function(e,n){var t=document.createElement("input");return t.setAttribute("type","text"),t.value=n,this.addField(e,t)},mxForm.prototype.addCheckbox=function(e,n){var t=document.createElement("input");return t.setAttribute("type","checkbox"),this.addField(e,t),n&&(t.checked=!0),t},mxForm.prototype.addTextarea=function(e,n,t){var a=document.createElement("textarea");return mxClient.IS_NS&&t--,a.setAttribute("rows",t||2),a.value=n,this.addField(e,a)},mxForm.prototype.addCombo=function(e,n,t){var a=document.createElement("select");return null!=t&&a.setAttribute("size",t),n&&a.setAttribute("multiple","true"),this.addField(e,a)},mxForm.prototype.addOption=function(e,n,t,a){var i=document.createElement("option");mxUtils.writeln(i,n),i.setAttribute("value",t),a&&i.setAttribute("selected",a),e.appendChild(i)},mxForm.prototype.addField=function(e,n){var t=document.createElement("tr"),a=document.createElement("td");return mxUtils.write(a,e),t.appendChild(a),(a=document.createElement("td")).appendChild(n),t.appendChild(a),this.body.appendChild(t),n},mxImage.prototype.src=null,mxImage.prototype.width=null,mxImage.prototype.height=null,mxDivResizer.prototype.resizeWidth=!0,mxDivResizer.prototype.resizeHeight=!0,mxDivResizer.prototype.handlingResize=!1,mxDivResizer.prototype.resize=function(){var e=this.getDocumentWidth(),n=this.getDocumentHeight(),t=parseInt(this.div.style.left),a=parseInt(this.div.style.right),i=parseInt(this.div.style.top),s=parseInt(this.div.style.bottom);this.resizeWidth&&!isNaN(t)&&!isNaN(a)&&0<=t&&0<=a&&0<e-a-t&&(this.div.style.width=e-a-t+"px"),this.resizeHeight&&!isNaN(i)&&!isNaN(s)&&0<=i&&0<=s&&0<n-i-s&&(this.div.style.height=n-i-s+"px")},mxDivResizer.prototype.getDocumentWidth=function(){return document.body.clientWidth},mxDivResizer.prototype.getDocumentHeight=function(){return document.body.clientHeight},mxDragSource.prototype.element=null,mxDragSource.prototype.dropHandler=null,mxDragSource.prototype.dragOffset=null,mxDragSource.prototype.dragElement=null,mxDragSource.prototype.previewElement=null,mxDragSource.prototype.enabled=!0,mxDragSource.prototype.currentGraph=null,mxDragSource.prototype.currentDropTarget=null,mxDragSource.prototype.currentPoint=null,mxDragSource.prototype.currentGuide=null,mxDragSource.prototype.currentHighlight=null,mxDragSource.prototype.autoscroll=!0,mxDragSource.prototype.guidesEnabled=!0,mxDragSource.prototype.gridEnabled=!0,mxDragSource.prototype.highlightDropTargets=!0,mxDragSource.prototype.dragElementZIndex=100,mxDragSource.prototype.dragElementOpacity=70,mxDragSource.prototype.isEnabled=function(){return this.enabled},mxDragSource.prototype.setEnabled=function(e){this.enabled=e},mxDragSource.prototype.isGuidesEnabled=function(){return this.guidesEnabled},mxDragSource.prototype.setGuidesEnabled=function(e){this.guidesEnabled=e},mxDragSource.prototype.isGridEnabled=function(){return this.gridEnabled},mxDragSource.prototype.setGridEnabled=function(e){this.gridEnabled=e},mxDragSource.prototype.getGraphForEvent=function(e){return null},mxDragSource.prototype.getDropTarget=function(e,n,t){return e.getCellAt(n,t)},mxDragSource.prototype.createDragElement=function(e){return this.element.cloneNode(!0)},mxDragSource.prototype.createPreviewElement=function(e){return null},mxDragSource.prototype.mouseDown=function(e){this.enabled&&!mxEvent.isConsumed(e)&&null==this.mouseMoveHandler&&(this.startDrag(e),this.mouseMoveHandler=mxUtils.bind(this,this.mouseMove),this.mouseUpHandler=mxUtils.bind(this,this.mouseUp),mxEvent.addGestureListeners(document,null,this.mouseMoveHandler,this.mouseUpHandler),mxEvent.consume(e,!0,!1))},mxDragSource.prototype.startDrag=function(e){this.dragElement=this.createDragElement(e),this.dragElement.style.position="absolute",this.dragElement.style.zIndex=this.dragElementZIndex,mxUtils.setOpacity(this.dragElement,this.dragElementOpacity)},mxDragSource.prototype.stopDrag=function(e){null!=this.dragElement&&(null!=this.dragElement.parentNode&&this.dragElement.parentNode.removeChild(this.dragElement),this.dragElement=null)},mxDragSource.prototype.graphContainsEvent=function(e,n){var t=mxEvent.getClientX(n),a=mxEvent.getClientY(n),i=mxUtils.getOffset(e.container),s=mxUtils.getScrollOrigin();return t>=i.x-s.x&&a>=i.y-s.y&&t<=i.x-s.x+e.container.offsetWidth&&a<=i.y-s.y+e.container.offsetHeight},mxDragSource.prototype.mouseMove=function(e){if(null!=(n=this.getGraphForEvent(e))&&!this.graphContainsEvent(n,e)&&(n=null),n!=this.currentGraph&&(null!=this.currentGraph&&this.dragExit(this.currentGraph),this.currentGraph=n,null!=this.currentGraph&&this.dragEnter(this.currentGraph)),null!=this.currentGraph&&this.dragOver(this.currentGraph,e),null==this.dragElement||null!=this.previewElement&&"visible"==this.previewElement.style.visibility)null!=this.dragElement&&(this.dragElement.style.visibility="hidden");else{var n=mxEvent.getClientX(e),t=mxEvent.getClientY(e);null==this.dragElement.parentNode&&document.body.appendChild(this.dragElement),this.dragElement.style.visibility="visible",null!=this.dragOffset&&(n+=this.dragOffset.x,t+=this.dragOffset.y),n+=document.body.scrollLeft||document.documentElement.scrollLeft,t+=document.body.scrollTop||document.documentElement.scrollTop,this.dragElement.style.left=n+"px",this.dragElement.style.top=t+"px"}mxEvent.consume(e)},mxDragSource.prototype.mouseUp=function(e){if(null!=this.currentGraph){if(null!=this.currentPoint&&(null==this.previewElement||"hidden"!=this.previewElement.style.visibility)){var n=this.currentGraph.view.scale,t=this.currentGraph.view.translate;this.drop(this.currentGraph,e,this.currentDropTarget,this.currentPoint.x/n-t.x,this.currentPoint.y/n-t.y)}this.dragExit(this.currentGraph)}this.stopDrag(e),mxEvent.removeGestureListeners(document,null,this.mouseMoveHandler,this.mouseUpHandler),this.currentGraph=this.mouseUpHandler=this.mouseMoveHandler=null,mxEvent.consume(e)},mxDragSource.prototype.dragEnter=function(e){e.isMouseDown=!0,this.previewElement=this.createPreviewElement(e),this.isGuidesEnabled()&&null!=this.previewElement&&(this.currentGuide=new mxGuide(e,e.graphHandler.getGuideStates())),this.highlightDropTargets&&(this.currentHighlight=new mxCellHighlight(e,mxConstants.DROP_TARGET_COLOR))},mxDragSource.prototype.dragExit=function(e){this.currentPoint=this.currentDropTarget=null,e.isMouseDown=!1,null!=this.previewElement&&(null!=this.previewElement.parentNode&&this.previewElement.parentNode.removeChild(this.previewElement),this.previewElement=null),null!=this.currentGuide&&(this.currentGuide.destroy(),this.currentGuide=null),null!=this.currentHighlight&&(this.currentHighlight.destroy(),this.currentHighlight=null)},mxDragSource.prototype.dragOver=function(e,n){var t=mxUtils.getOffset(e.container),a=mxUtils.getScrollOrigin(e.container),i=mxEvent.getClientX(n)-t.x+a.x;t=mxEvent.getClientY(n)-t.y+a.y;if(e.autoScroll&&(null==this.autoscroll||this.autoscroll)&&e.scrollPointToVisible(i,t,e.autoExtend),null!=this.currentHighlight&&e.isDropEnabled()&&(this.currentDropTarget=this.getDropTarget(e,i,t),a=e.getView().getState(this.currentDropTarget),this.currentHighlight.highlight(a)),null!=this.previewElement){null==this.previewElement.parentNode&&(e.container.appendChild(this.previewElement),this.previewElement.style.zIndex="3",this.previewElement.style.position="absolute");a=this.isGridEnabled()&&e.isGridEnabledEvent(n);var s=!0;if(null!=this.currentGuide&&this.currentGuide.isEnabledForEvent(n))s=new mxRectangle(0,0,s=parseInt(this.previewElement.style.width),o=parseInt(this.previewElement.style.height)),t=new mxPoint(i,t),t=this.currentGuide.move(s,t,a),s=!1,i=t.x,t=t.y;else if(a){a=e.view.scale;var o=e.view.translate,r=e.gridSize/2;i=(e.snap(i/a-o.x-r)+o.x)*a,t=(e.snap(t/a-o.y-r)+o.y)*a}null!=this.currentGuide&&s&&this.currentGuide.hide(),null!=this.previewOffset&&(i+=this.previewOffset.x,t+=this.previewOffset.y),this.previewElement.style.left=Math.round(i)+"px",this.previewElement.style.top=Math.round(t)+"px",this.previewElement.style.visibility="visible"}this.currentPoint=new mxPoint(i,t)},mxDragSource.prototype.drop=function(e,n,t,a,i){this.dropHandler(e,n,t,a,i),e.container.focus()},mxToolbar.prototype=new mxEventSource,mxToolbar.prototype.constructor=mxToolbar,mxToolbar.prototype.container=null,mxToolbar.prototype.enabled=!0,mxToolbar.prototype.noReset=!1,mxToolbar.prototype.updateDefaultMode=!0,mxToolbar.prototype.addItem=function(e,n,t,a,i,s){var o=document.createElement(null!=n?"img":"button"),r=i||(null!=s?"mxToolbarMode":"mxToolbarItem");return o.className=r,o.setAttribute("src",n),null!=e&&(null!=n?o.setAttribute("title",e):mxUtils.write(o,e)),this.container.appendChild(o),null!=t&&(mxEvent.addListener(o,"click",t),mxClient.IS_TOUCH&&mxEvent.addListener(o,"touchend",t)),e=mxUtils.bind(this,function(e){null!=a?o.setAttribute("src",n):o.style.backgroundColor=""}),mxEvent.addGestureListeners(o,mxUtils.bind(this,function(e){if(null!=a?o.setAttribute("src",a):o.style.backgroundColor="gray",null!=s){null==this.menu&&(this.menu=new mxPopupMenu,this.menu.init());var n=this.currentImg;this.menu.isMenuShowing()&&this.menu.hideMenu(),n!=o&&(this.currentImg=o,this.menu.factoryMethod=s,n=new mxPoint(o.offsetLeft,o.offsetTop+o.offsetHeight),this.menu.popup(n.x,n.y,null,e),this.menu.isMenuShowing()&&(o.className=r+"Selected",this.menu.hideMenu=function(){mxPopupMenu.prototype.hideMenu.apply(this),o.className=r,this.currentImg=null}))}}),null,e),mxEvent.addListener(o,"mouseout",e),o},mxToolbar.prototype.addCombo=function(e){var n=document.createElement("div");n.style.display="inline",n.className="mxToolbarComboContainer";var t=document.createElement("select");return t.className=e||"mxToolbarCombo",n.appendChild(t),this.container.appendChild(n),t},mxToolbar.prototype.addActionCombo=function(e,n){var t=document.createElement("select");return t.className=n||"mxToolbarCombo",this.addOption(t,e,null),mxEvent.addListener(t,"change",function(e){var n=t.options[t.selectedIndex];t.selectedIndex=0,null!=n.funct&&n.funct(e)}),this.container.appendChild(t),t},mxToolbar.prototype.addOption=function(e,n,t){var a=document.createElement("option");return mxUtils.writeln(a,n),"function"==typeof t?a.funct=t:a.setAttribute("value",t),e.appendChild(a),a},mxToolbar.prototype.addSwitchMode=function(e,n,t,a,i){var s=document.createElement("img");return s.initialClassName=i||"mxToolbarMode",s.className=s.initialClassName,s.setAttribute("src",n),s.altIcon=a,null!=e&&s.setAttribute("title",e),mxEvent.addListener(s,"click",mxUtils.bind(this,function(e){null!=(e=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",e)):this.selectedMode.className=this.selectedMode.initialClassName,this.updateDefaultMode&&(this.defaultMode=s),null!=(e=(this.selectedMode=s).altIcon)?(s.altIcon=s.getAttribute("src"),s.setAttribute("src",e)):s.className=s.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT)),t()})),this.container.appendChild(s),null==this.defaultMode&&(this.defaultMode=s,this.selectMode(s),t()),s},mxToolbar.prototype.addMode=function(e,n,t,a,i,s){s=null==s||s;var o=document.createElement(null!=n?"img":"button");return o.initialClassName=i||"mxToolbarMode",o.className=o.initialClassName,o.setAttribute("src",n),o.altIcon=a,null!=e&&o.setAttribute("title",e),this.enabled&&s&&(mxEvent.addListener(o,"click",mxUtils.bind(this,function(e){this.selectMode(o,t),this.noReset=!1})),mxEvent.addListener(o,"dblclick",mxUtils.bind(this,function(e){this.selectMode(o,t),this.noReset=!0})),null==this.defaultMode&&(this.defaultMode=o,this.defaultFunction=t,this.selectMode(o,t))),this.container.appendChild(o),o},mxToolbar.prototype.selectMode=function(e,n){if(this.selectedMode!=e){if(null!=this.selectedMode){var t=this.selectedMode.altIcon;null!=t?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",t)):this.selectedMode.className=this.selectedMode.initialClassName}this.selectedMode=e,null!=(t=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",t)):this.selectedMode.className=this.selectedMode.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT,"function",n))}},mxToolbar.prototype.resetMode=function(e){(e||!this.noReset)&&this.selectedMode!=this.defaultMode&&this.selectMode(this.defaultMode,this.defaultFunction)},mxToolbar.prototype.addSeparator=function(e){return this.addItem(null,e,null)},mxToolbar.prototype.addBreak=function(){mxUtils.br(this.container)},mxToolbar.prototype.addLine=function(){var e=document.createElement("hr");e.style.marginRight="6px",e.setAttribute("size","1"),this.container.appendChild(e)},mxToolbar.prototype.destroy=function(){mxEvent.release(this.container),this.selectedMode=this.defaultFunction=this.defaultMode=this.container=null,null!=this.menu&&this.menu.destroy()},mxSession.prototype=new mxEventSource,mxSession.prototype.constructor=mxSession,mxSession.prototype.model=null,mxSession.prototype.urlInit=null,mxSession.prototype.urlPoll=null,mxSession.prototype.urlNotify=null,mxSession.prototype.codec=null,mxSession.prototype.linefeed="&#xa;",mxSession.prototype.escapePostData=!0,mxSession.prototype.significantRemoteChanges=!0,mxSession.prototype.sent=0,mxSession.prototype.received=0,mxSession.prototype.debug=!1,mxSession.prototype.connected=!1,mxSession.prototype.suspended=!1,mxSession.prototype.polling=!1,mxSession.prototype.start=function(){this.debug?(this.connected=!0,this.fireEvent(new mxEventObject(mxEvent.CONNECT))):this.connected||this.get(this.urlInit,mxUtils.bind(this,function(e){this.connected=!0,this.fireEvent(new mxEventObject(mxEvent.CONNECT)),this.poll()}))},mxSession.prototype.suspend=function(){this.connected&&!this.suspended&&(this.suspended=!0,this.fireEvent(new mxEventObject(mxEvent.SUSPEND)))},mxSession.prototype.resume=function(e,n,t){this.connected&&this.suspended&&(this.suspended=!1,this.fireEvent(new mxEventObject(mxEvent.RESUME)),this.polling||this.poll())},mxSession.prototype.stop=function(e){this.connected&&(this.connected=!1),this.fireEvent(new mxEventObject(mxEvent.DISCONNECT,"reason",e))},mxSession.prototype.poll=function(){this.connected&&!this.suspended&&null!=this.urlPoll?(this.polling=!0,this.get(this.urlPoll,mxUtils.bind(this,function(){this.poll()}))):this.polling=!1},mxSession.prototype.notify=function(e,n,t){null!=e&&0<e.length&&(null!=this.urlNotify&&(this.debug?(mxLog.show(),mxLog.debug("mxSession.notify: "+this.urlNotify+" xml="+e)):(e="<message><delta>"+e+"</delta></message>",this.escapePostData&&(e=encodeURIComponent(e)),mxUtils.post(this.urlNotify,"xml="+e,n,t))),this.sent+=e.length,this.fireEvent(new mxEventObject(mxEvent.NOTIFY,"url",this.urlNotify,"xml",e)))},mxSession.prototype.get=function(t,a,n){if(void 0!==mxUtils){var i=mxUtils.bind(this,function(e){null!=n?n(e):this.stop(e)});mxUtils.get(t,mxUtils.bind(this,function(e){if(void 0!==mxUtils)if(e.isReady()&&404!=e.getStatus()){if(this.received+=e.getText().length,this.fireEvent(new mxEventObject(mxEvent.GET,"url",t,"request",e)),this.isValidResponse(e)){if(0<e.getText().length){var n=e.getDocumentElement();null==n?i("Invalid response: "+e.getText()):this.receive(n)}null!=a&&a(e)}}else i("Response not ready")}),function(e){i("Transmission error")})}},mxSession.prototype.isValidResponse=function(e){return e.getText().indexOf("<?php")<0},mxSession.prototype.encodeChanges=function(e,n){for(var t="",a=n?-1:1,i=n?e.length-1:0;0<=i&&i<e.length;i+=a){var s=this.codec.encode(e[i]);t=t+mxUtils.getXml(s,this.linefeed)}return t},mxSession.prototype.receive=function(e){if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){var n=e.getAttribute("namespace");for(null!=n&&(this.model.prefix=n+"-"),n=e.firstChild;null!=n;){var t=n.nodeName.toLowerCase();"state"==t?this.processState(n):"delta"==t&&this.processDelta(n),n=n.nextSibling}this.fireEvent(new mxEventObject(mxEvent.RECEIVE,"node",e))}},mxSession.prototype.processState=function(e){new mxCodec(e.ownerDocument).decode(e.firstChild,this.model)},mxSession.prototype.processDelta=function(e){for(e=e.firstChild;null!=e;)"edit"==e.nodeName&&this.processEdit(e),e=e.nextSibling},mxSession.prototype.processEdit=function(e){if(0<(e=this.decodeChanges(e)).length){var n=this.createUndoableEdit(e);this.model.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",n,"changes",e)),this.model.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",n)),this.fireEvent(new mxEventObject(mxEvent.FIRED,"edit",n))}},mxSession.prototype.createUndoableEdit=function(e){var n=new mxUndoableEdit(this.model,this.significantRemoteChanges);return n.changes=e,n.notify=function(){n.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",n,"changes",n.changes)),n.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",n,"changes",n.changes))},n},mxSession.prototype.decodeChanges=function(e){this.codec.document=e.ownerDocument;var n=[];for(e=e.firstChild;null!=e;){var t=this.decodeChange(e);null!=t&&n.push(t),e=e.nextSibling}return n},mxSession.prototype.decodeChange=function(e){var n=null;return e.nodeType==mxConstants.NODETYPE_ELEMENT&&(null!=(n="mxRootChange"==e.nodeName?new mxCodec(e.ownerDocument).decode(e):this.codec.decode(e))&&(n.model=this.model,n.execute(),"mxChildChange"==e.nodeName&&null==n.parent&&this.cellRemoved(n.child))),n},mxSession.prototype.cellRemoved=function(e,n){this.codec.putObject(e.getId(),e);for(var t=this.model.getChildCount(e),a=0;a<t;a++)this.cellRemoved(this.model.getChildAt(e,a))},mxUndoableEdit.prototype.source=null,mxUndoableEdit.prototype.changes=null,mxUndoableEdit.prototype.significant=null,mxUndoableEdit.prototype.undone=!1,mxUndoableEdit.prototype.redone=!1,mxUndoableEdit.prototype.isEmpty=function(){return 0==this.changes.length},mxUndoableEdit.prototype.isSignificant=function(){return this.significant},mxUndoableEdit.prototype.add=function(e){this.changes.push(e)},mxUndoableEdit.prototype.notify=function(){},mxUndoableEdit.prototype.die=function(){},mxUndoableEdit.prototype.undo=function(){if(!this.undone){this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));for(var e=this.changes.length-1;0<=e;e--){var n=this.changes[e];null!=n.execute?n.execute():null!=n.undo&&n.undo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",n))}this.undone=!0,this.redone=!1,this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT))}this.notify()},mxUndoableEdit.prototype.redo=function(){if(!this.redone){this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));for(var e=this.changes.length,n=0;n<e;n++){var t=this.changes[n];null!=t.execute?t.execute():null!=t.redo&&t.redo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",t))}this.undone=!1,this.redone=!0,this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT))}this.notify()},mxUndoManager.prototype=new mxEventSource,mxUndoManager.prototype.constructor=mxUndoManager,mxUndoManager.prototype.size=null,mxUndoManager.prototype.history=null,mxUndoManager.prototype.indexOfNextAdd=0,mxUndoManager.prototype.isEmpty=function(){return 0==this.history.length},mxUndoManager.prototype.clear=function(){this.history=[],this.indexOfNextAdd=0,this.fireEvent(new mxEventObject(mxEvent.CLEAR))},mxUndoManager.prototype.canUndo=function(){return 0<this.indexOfNextAdd},mxUndoManager.prototype.undo=function(){for(;0<this.indexOfNextAdd;){var e=this.history[--this.indexOfNextAdd];if(e.undo(),e.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",e));break}}},mxUndoManager.prototype.canRedo=function(){return this.indexOfNextAdd<this.history.length},mxUndoManager.prototype.redo=function(){for(var e=this.history.length;this.indexOfNextAdd<e;){var n=this.history[this.indexOfNextAdd++];if(n.redo(),n.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.REDO,"edit",n));break}}},mxUndoManager.prototype.undoableEditHappened=function(e){this.trim(),0<this.size&&this.size==this.history.length&&this.history.shift(),this.history.push(e),this.indexOfNextAdd=this.history.length,this.fireEvent(new mxEventObject(mxEvent.ADD,"edit",e))},mxUndoManager.prototype.trim=function(){if(this.history.length>this.indexOfNextAdd)for(var e=this.history.splice(this.indexOfNextAdd,this.history.length-this.indexOfNextAdd),n=0;n<e.length;n++)e[n].die()};var mxUrlConverter=function(e){var t=!0,a=null,i=null;return{isEnabled:function(){return t},setEnabled:function(e){t=e},getBaseUrl:function(){return a},setBaseUrl:function(e){a=e},getBaseDomain:function(){return a},setBaseDomain:function(e){a=e},isRelativeUrl:function(e){return"http://"!=e.substring(0,7)&&"https://"!=e.substring(0,8)&&"data:image"!=e.substring(0,10)},convert:function(e){if(t&&this.isRelativeUrl(e)){if(null==a){i=location.protocol+"//"+location.host;var n=(a=i+location.pathname).lastIndexOf("/");0<n&&(a=a.substring(0,n+1))}e="/"==e.charAt(0)?i+e:a+e}return e}}};function mxPanningManager(s){this.thread=null,this.active=!1,this.dy=this.dx=this.t0y=this.t0x=this.tdy=this.tdx=0,this.scrollbars=!1,this.scrollTop=this.scrollLeft=0,this.mouseListener={mouseDown:function(e,n){},mouseMove:function(e,n){},mouseUp:mxUtils.bind(this,function(e,n){this.active&&this.stop()})},s.addMouseListener(this.mouseListener),mxEvent.addListener(document,"mouseup",mxUtils.bind(this,function(){this.active&&this.stop()}));var o=mxUtils.bind(this,function(){return this.scrollbars=mxUtils.hasScrollbars(s.container),this.scrollLeft=s.container.scrollLeft,this.scrollTop=s.container.scrollTop,window.setInterval(mxUtils.bind(this,function(){if(this.tdx-=this.dx,this.tdy-=this.dy,this.scrollbars){var e=-s.container.scrollLeft-Math.ceil(this.dx),n=-s.container.scrollTop-Math.ceil(this.dy);s.panGraph(e,n),s.panDx=this.scrollLeft-s.container.scrollLeft,s.panDy=this.scrollTop-s.container.scrollTop,s.fireEvent(new mxEventObject(mxEvent.PAN))}else s.panGraph(this.getDx(),this.getDy())}),this.delay)});this.isActive=function(){return active},this.getDx=function(){return Math.round(this.tdx)},this.getDy=function(){return Math.round(this.tdy)},this.start=function(){this.t0x=s.view.translate.x,this.t0y=s.view.translate.y,this.active=!0},this.panTo=function(e,n,t,a){this.active||this.start(),this.scrollLeft=s.container.scrollLeft,this.scrollTop=s.container.scrollTop,a=null!=a?a:0;var i=s.container;this.dx=e+(null!=t?t:0)-i.scrollLeft-i.clientWidth,this.dx<0&&Math.abs(this.dx)<this.border?this.dx=this.border+this.dx:this.dx=this.handleMouseOut?Math.max(this.dx,0):0,0==this.dx&&(this.dx=e-i.scrollLeft,this.dx=0<this.dx&&this.dx<this.border?this.dx-this.border:this.handleMouseOut?Math.min(0,this.dx):0),this.dy=n+a-i.scrollTop-i.clientHeight,this.dy<0&&Math.abs(this.dy)<this.border?this.dy=this.border+this.dy:this.dy=this.handleMouseOut?Math.max(this.dy,0):0,0==this.dy&&(this.dy=n-i.scrollTop,this.dy=0<this.dy&&this.dy<this.border?this.dy-this.border:this.handleMouseOut?Math.min(0,this.dy):0),0!=this.dx||0!=this.dy?(this.dx*=this.damper,this.dy*=this.damper,null==this.thread&&(this.thread=o())):null!=this.thread&&(window.clearInterval(this.thread),this.thread=null)},this.stop=function(){if(this.active)if(this.active=!1,null!=this.thread&&(window.clearInterval(this.thread),this.thread=null),this.tdy=this.tdx=0,this.scrollbars)s.panDx=0,s.panDy=0,s.fireEvent(new mxEventObject(mxEvent.PAN));else{var e=s.panDx,n=s.panDy;0==e&&0==n||(s.panGraph(0,0),s.view.setTranslate(this.t0x+e/s.view.scale,this.t0y+n/s.view.scale))}},this.destroy=function(){s.removeMouseListener(this.mouseListener)}}function mxPopupMenu(e){null!=(this.factoryMethod=e)&&this.init()}function mxAutoSaveManager(e){this.changeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.graphModelChanged(n.getProperty("edit").changes)}),this.setGraph(e)}function mxAnimation(e){this.delay=null!=e?e:20}function mxMorphing(e,n,t,a){mxAnimation.call(this,a),this.graph=e,this.steps=null!=n?n:6,this.ease=null!=t?t:1.5}function mxImageBundle(e){this.images=[],this.alt=null!=e&&e}function mxImageExport(){}function mxAbstractCanvas2D(){this.converter=this.createUrlConverter(),this.reset()}function mxXmlCanvas2D(e){mxAbstractCanvas2D.call(this),this.root=e,this.writeDefaults()}function mxSvgCanvas2D(e,n){mxAbstractCanvas2D.call(this),this.root=e,this.gradients=[],this.defs=null,this.styleEnabled=null!=n&&n;var t=null;if(e.ownerDocument!=document)for(t=e;null!=t&&"svg"!=t.nodeName;)t=t.parentNode;null!=t&&(0<t.getElementsByTagName("defs").length&&(this.defs=t.getElementsByTagName("defs")[0]),null==this.defs&&(this.defs=this.createElement("defs"),null!=t.firstChild?t.insertBefore(this.defs,t.firstChild):t.appendChild(this.defs)),this.styleEnabled&&this.defs.appendChild(this.createStyle()))}mxPanningManager.prototype.damper=1/6,mxPanningManager.prototype.delay=10,mxPanningManager.prototype.handleMouseOut=!0,mxPanningManager.prototype.border=0,mxPopupMenu.prototype=new mxEventSource,mxPopupMenu.prototype.constructor=mxPopupMenu,mxPopupMenu.prototype.submenuImage=mxClient.imageBasePath+"/submenu.gif",mxPopupMenu.prototype.zIndex=10006,mxPopupMenu.prototype.factoryMethod=null,mxPopupMenu.prototype.useLeftButtonForPopup=!1,mxPopupMenu.prototype.enabled=!0,mxPopupMenu.prototype.itemCount=0,mxPopupMenu.prototype.autoExpand=!1,mxPopupMenu.prototype.smartSeparators=!1,mxPopupMenu.prototype.labels=!0,mxPopupMenu.prototype.init=function(){this.table=document.createElement("table"),this.table.className="mxPopupMenu",this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.div=document.createElement("div"),this.div.className="mxPopupMenu",this.div.style.display="inline",this.div.style.zIndex=this.zIndex,this.div.appendChild(this.table),mxEvent.disableContextMenu(this.div)},mxPopupMenu.prototype.isEnabled=function(){return this.enabled},mxPopupMenu.prototype.setEnabled=function(e){this.enabled=e},mxPopupMenu.prototype.isPopupTrigger=function(e){return e.isPopupTrigger()||this.useLeftButtonForPopup&&mxEvent.isLeftMouseButton(e.getEvent())},mxPopupMenu.prototype.addItem=function(e,n,t,a,i,s){a=a||this,this.itemCount++,a.willAddSeparator&&(a.containsItems&&this.addSeparator(a,!0),a.willAddSeparator=!1),a.containsItems=!0;var o=document.createElement("tr");o.className="mxPopupMenuItem";var r=document.createElement("td");return r.className="mxPopupMenuIcon",null!=n?((i=document.createElement("img")).src=n,r.appendChild(i)):null!=i&&((n=document.createElement("div")).className=i,r.appendChild(n)),o.appendChild(r),this.labels&&((r=document.createElement("td")).className="mxPopupMenuItem"+(null==s||s?"":" disabled"),mxUtils.write(r,e),r.align="left",o.appendChild(r),(e=document.createElement("td")).className="mxPopupMenuItem"+(null==s||s?"":" disabled"),e.style.paddingRight="6px",e.style.textAlign="right",o.appendChild(e),null==a.div&&this.createSubmenu(a)),a.tbody.appendChild(o),(null==s||s)&&(mxEvent.addGestureListeners(o,mxUtils.bind(this,function(e){this.eventReceiver=o,a.activeRow!=o&&a.activeRow!=a&&(null!=a.activeRow&&null!=a.activeRow.div.parentNode&&this.hideSubmenu(a),null!=o.div&&(this.showSubmenu(a,o),a.activeRow=o)),mxEvent.consume(e)}),mxUtils.bind(this,function(e){a.activeRow!=o&&a.activeRow!=a&&(null!=a.activeRow&&null!=a.activeRow.div.parentNode&&this.hideSubmenu(a),this.autoExpand&&null!=o.div&&(this.showSubmenu(a,o),a.activeRow=o)),o.className="mxPopupMenuItemHover"}),mxUtils.bind(this,function(e){this.eventReceiver==o&&(a.activeRow!=o&&this.hideMenu(),null!=t&&t(e)),this.eventReceiver=null,mxEvent.consume(e)})),mxEvent.addListener(o,"mouseout",mxUtils.bind(this,function(e){o.className="mxPopupMenuItem"}))),o},mxPopupMenu.prototype.createSubmenu=function(e){e.table=document.createElement("table"),e.table.className="mxPopupMenu",e.tbody=document.createElement("tbody"),e.table.appendChild(e.tbody),e.div=document.createElement("div"),e.div.className="mxPopupMenu",e.div.style.position="absolute",e.div.style.display="inline",e.div.style.zIndex=this.zIndex,e.div.appendChild(e.table);var n=document.createElement("img");n.setAttribute("src",this.submenuImage),td=e.firstChild.nextSibling.nextSibling,td.appendChild(n)},mxPopupMenu.prototype.showSubmenu=function(e,n){if(null!=n.div){n.div.style.left=e.div.offsetLeft+n.offsetLeft+n.offsetWidth-1+"px",n.div.style.top=e.div.offsetTop+n.offsetTop+"px",document.body.appendChild(n.div);var t=parseInt(n.div.offsetLeft),a=parseInt(n.div.offsetWidth),i=document.body,s=document.documentElement;t+a>(i.scrollLeft||s.scrollLeft)+(i.clientWidth||s.clientWidth)&&(n.div.style.left=e.div.offsetLeft-a+(mxClient.IS_IE?6:-6)+"px"),mxUtils.fit(n.div)}},mxPopupMenu.prototype.addSeparator=function(e,n){if(e=e||this,this.smartSeparators&&!n)e.willAddSeparator=!0;else if(null!=e.tbody){e.willAddSeparator=!1;var t=document.createElement("tr"),a=document.createElement("td");a.className="mxPopupMenuIcon",a.style.padding="0 0 0 0px",t.appendChild(a),(a=document.createElement("td")).style.padding="0 0 0 0px",a.setAttribute("colSpan","2");var i=document.createElement("hr");i.setAttribute("size","1"),a.appendChild(i),t.appendChild(a),e.tbody.appendChild(t)}},mxPopupMenu.prototype.popup=function(e,n,t,a){if(null!=this.div&&null!=this.tbody&&null!=this.factoryMethod){for(this.div.style.left=e+"px",this.div.style.top=n+"px";null!=this.tbody.firstChild;)mxEvent.release(this.tbody.firstChild),this.tbody.removeChild(this.tbody.firstChild);this.itemCount=0,this.factoryMethod(this,t,a),0<this.itemCount&&(this.showMenu(),this.fireEvent(new mxEventObject(mxEvent.SHOW)))}},mxPopupMenu.prototype.isMenuShowing=function(){return null!=this.div&&this.div.parentNode==document.body},mxPopupMenu.prototype.showMenu=function(){9<=document.documentMode&&(this.div.style.filter="none"),document.body.appendChild(this.div),mxUtils.fit(this.div)},mxPopupMenu.prototype.hideMenu=function(){null!=this.div&&(null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.hideSubmenu(this),this.containsItems=!1)},mxPopupMenu.prototype.hideSubmenu=function(e){null!=e.activeRow&&(this.hideSubmenu(e.activeRow),null!=e.activeRow.div.parentNode&&e.activeRow.div.parentNode.removeChild(e.activeRow.div),e.activeRow=null)},mxPopupMenu.prototype.destroy=function(){null!=this.div&&(mxEvent.release(this.div),null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.div=null)},mxAutoSaveManager.prototype=new mxEventSource,mxAutoSaveManager.prototype.constructor=mxAutoSaveManager,mxAutoSaveManager.prototype.graph=null,mxAutoSaveManager.prototype.autoSaveDelay=10,mxAutoSaveManager.prototype.autoSaveThrottle=2,mxAutoSaveManager.prototype.autoSaveThreshold=5,mxAutoSaveManager.prototype.ignoredChanges=0,mxAutoSaveManager.prototype.lastSnapshot=0,mxAutoSaveManager.prototype.enabled=!0,mxAutoSaveManager.prototype.changeHandler=null,mxAutoSaveManager.prototype.isEnabled=function(){return this.enabled},mxAutoSaveManager.prototype.setEnabled=function(e){this.enabled=e},mxAutoSaveManager.prototype.setGraph=function(e){null!=this.graph&&this.graph.getModel().removeListener(this.changeHandler),this.graph=e,null!=this.graph&&this.graph.getModel().addListener(mxEvent.CHANGE,this.changeHandler)},mxAutoSaveManager.prototype.save=function(){},mxAutoSaveManager.prototype.graphModelChanged=function(e){(e=((new Date).getTime()-this.lastSnapshot)/1e3)>this.autoSaveDelay||this.ignoredChanges>=this.autoSaveThreshold&&e>this.autoSaveThrottle?(this.save(),this.reset()):this.ignoredChanges++},mxAutoSaveManager.prototype.reset=function(){this.lastSnapshot=(new Date).getTime(),this.ignoredChanges=0},mxAutoSaveManager.prototype.destroy=function(){this.setGraph(null)},mxAnimation.prototype=new mxEventSource,mxAnimation.prototype.constructor=mxAnimation,mxAnimation.prototype.delay=null,mxAnimation.prototype.thread=null,mxAnimation.prototype.startAnimation=function(){null==this.thread&&(this.thread=window.setInterval(mxUtils.bind(this,this.updateAnimation),this.delay))},mxAnimation.prototype.updateAnimation=function(){this.fireEvent(new mxEventObject(mxEvent.EXECUTE))},mxAnimation.prototype.stopAnimation=function(){null!=this.thread&&(window.clearInterval(this.thread),this.thread=null,this.fireEvent(new mxEventObject(mxEvent.DONE)))},mxMorphing.prototype=new mxAnimation,mxMorphing.prototype.constructor=mxMorphing,mxMorphing.prototype.graph=null,mxMorphing.prototype.steps=null,mxMorphing.prototype.step=0,mxMorphing.prototype.ease=null,mxMorphing.prototype.cells=null,mxMorphing.prototype.updateAnimation=function(){var e=new mxCellStatePreview(this.graph);if(null!=this.cells)for(var n=0;n<this.cells.length;n++)this.animateCell(cells[n],e,!1);else this.animateCell(this.graph.getModel().getRoot(),e,!0);this.show(e),(e.isEmpty()||this.step++>=this.steps)&&this.stopAnimation()},mxMorphing.prototype.show=function(e){e.show()},mxMorphing.prototype.animateCell=function(e,n,t){var a=this.graph.getView().getState(e),i=null;if(null!=a&&(i=this.getDelta(a),this.graph.getModel().isVertex(e)&&(0!=i.x||0!=i.y))){var s=this.graph.view.getTranslate(),o=this.graph.view.getScale();i.x+=s.x*o,i.y+=s.y*o,n.moveState(a,-i.x/this.ease,-i.y/this.ease)}if(t&&!this.stopRecursion(a,i))for(a=this.graph.getModel().getChildCount(e),i=0;i<a;i++)this.animateCell(this.graph.getModel().getChildAt(e,i),n,t)},mxMorphing.prototype.stopRecursion=function(e,n){return null!=n&&(0!=n.x||0!=n.y)},mxMorphing.prototype.getDelta=function(e){var n=this.getOriginForCell(e.cell),t=this.graph.getView().getTranslate(),a=this.graph.getView().getScale();return e=new mxPoint(e.x/a-t.x,e.y/a-t.y),new mxPoint((n.x-e.x)*a,(n.y-e.y)*a)},mxMorphing.prototype.getOriginForCell=function(e){var n=null;return null!=e&&(n=this.getOriginForCell(this.graph.getModel().getParent(e)),null!=(e=this.graph.getCellGeometry(e))&&(n.x+=e.x,n.y+=e.y)),null==n&&(n=new mxPoint(-(n=this.graph.view.getTranslate()).x,-n.y)),n},mxImageBundle.prototype.images=null,mxImageBundle.prototype.images=null,mxImageBundle.prototype.putImage=function(e,n,t){this.images[e]={value:n,fallback:t}},mxImageBundle.prototype.getImage=function(e){var n=null;return null!=e&&(null!=(e=this.images[e])&&(n=this.alt?e.fallback:e.value)),n},mxImageExport.prototype.includeOverlays=!1,mxImageExport.prototype.drawState=function(e,n){null!=e&&(this.visitStatesRecursive(e,n,this.drawCellState),this.includeOverlays&&this.visitStatesRecursive(e,n,this.drawOverlays))},mxImageExport.prototype.visitStatesRecursive=function(e,n,t){if(null!=e){t(e,n);for(var a=e.view.graph,i=a.model.getChildCount(e.cell),s=0;s<i;s++){var o=a.view.getState(a.model.getChildAt(e.cell,s));this.visitStatesRecursive(o,n,t)}}},mxImageExport.prototype.drawCellState=function(e,n){e.shape instanceof mxShape&&(n.save(),e.shape.paint(n),n.restore()),null!=e.text&&(n.save(),e.text.paint(n),n.restore())},mxImageExport.prototype.drawOverlays=function(e,t){null!=e.overlays&&e.overlays.visit(function(e,n){n instanceof mxShape&&n.paint(t)})},mxAbstractCanvas2D.prototype.state=null,mxAbstractCanvas2D.prototype.states=null,mxAbstractCanvas2D.prototype.path=null,mxAbstractCanvas2D.prototype.rotateHtml=!0,mxAbstractCanvas2D.prototype.lastX=0,mxAbstractCanvas2D.prototype.lastY=0,mxAbstractCanvas2D.prototype.moveOp="M",mxAbstractCanvas2D.prototype.lineOp="L",mxAbstractCanvas2D.prototype.quadOp="Q",mxAbstractCanvas2D.prototype.curveOp="C",mxAbstractCanvas2D.prototype.closeOp="Z",mxAbstractCanvas2D.prototype.pointerEvents=!1,mxAbstractCanvas2D.prototype.createUrlConverter=function(){return new mxUrlConverter},mxAbstractCanvas2D.prototype.reset=function(){this.state=this.createState(),this.states=[]},mxAbstractCanvas2D.prototype.createState=function(){return{dx:0,dy:0,scale:1,alpha:1,fillColor:null,fillAlpha:1,gradientColor:null,gradientAlpha:1,gradientDirection:null,strokeColor:null,strokeWidth:1,dashed:!1,dashPattern:"3 3",lineCap:"flat",lineJoin:"miter",miterLimit:10,fontColor:"#000000",fontBackgroundColor:null,fontBorderColor:null,fontSize:mxConstants.DEFAULT_FONTSIZE,fontFamily:mxConstants.DEFAULT_FONTFAMILY,fontStyle:0,shadow:!1,shadowColor:mxConstants.SHADOWCOLOR,shadowAlpha:mxConstants.SHADOW_OPACITY,shadowDx:mxConstants.SHADOW_OFFSET_X,shadowDy:mxConstants.SHADOW_OFFSET_Y,rotation:0,rotationCx:0,rotationCy:0}},mxAbstractCanvas2D.prototype.format=function(e){return Math.round(parseFloat(e))},mxAbstractCanvas2D.prototype.addOp=function(){if(null!=this.path&&(this.path.push(arguments[0]),2<arguments.length))for(var e=this.state,n=2;n<arguments.length;n+=2)this.lastX=arguments[n-1],this.lastY=arguments[n],this.path.push(this.format((this.lastX+e.dx)*e.scale)),this.path.push(this.format((this.lastY+e.dy)*e.scale))},mxAbstractCanvas2D.prototype.rotatePoint=function(e,n,t,a,i){return t*=Math.PI/180,mxUtils.getRotatedPoint(new mxPoint(e,n),Math.cos(t),Math.sin(t),new mxPoint(a,i))},mxAbstractCanvas2D.prototype.save=function(){this.states.push(this.state),this.state=mxUtils.clone(this.state)},mxAbstractCanvas2D.prototype.restore=function(){this.state=this.states.pop()},mxAbstractCanvas2D.prototype.scale=function(e){this.state.scale*=e,this.state.strokeWidth*=e},mxAbstractCanvas2D.prototype.translate=function(e,n){this.state.dx+=e,this.state.dy+=n},mxAbstractCanvas2D.prototype.setAlpha=function(e){this.state.alpha=e},mxAbstractCanvas2D.prototype.setFillColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fillColor=e,this.state.gradientColor=null},mxAbstractCanvas2D.prototype.setGradient=function(e,n,t,a,i,s,o,r,l){(t=this.state).fillColor=e,t.fillAlpha=null!=r?r:1,t.gradientColor=n,t.gradientAlpha=null!=l?l:1,t.gradientDirection=o},mxAbstractCanvas2D.prototype.setStrokeColor=function(e){e==mxConstants.NONE&&(e=null),this.state.strokeColor=e},mxAbstractCanvas2D.prototype.setStrokeWidth=function(e){this.state.strokeWidth=e},mxAbstractCanvas2D.prototype.setDashed=function(e){this.state.dashed=e},mxAbstractCanvas2D.prototype.setDashPattern=function(e){this.state.dashPattern=e},mxAbstractCanvas2D.prototype.setLineCap=function(e){this.state.lineCap=e},mxAbstractCanvas2D.prototype.setLineJoin=function(e){this.state.lineJoin=e},mxAbstractCanvas2D.prototype.setMiterLimit=function(e){this.state.miterLimit=e},mxAbstractCanvas2D.prototype.setFontColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontColor=e},mxAbstractCanvas2D.prototype.setFontBackgroundColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontBackgroundColor=e},mxAbstractCanvas2D.prototype.setFontBorderColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontBorderColor=e},mxAbstractCanvas2D.prototype.setFontSize=function(e){this.state.fontSize=e},mxAbstractCanvas2D.prototype.setFontFamily=function(e){this.state.fontFamily=e},mxAbstractCanvas2D.prototype.setFontStyle=function(e){null==e&&(e=0),this.state.fontStyle=e},mxAbstractCanvas2D.prototype.setShadow=function(e){this.state.shadow=e},mxAbstractCanvas2D.prototype.setShadowColor=function(e){e==mxConstants.NONE&&(e=null),this.state.shadowColor=e},mxAbstractCanvas2D.prototype.setShadowAlpha=function(e){this.state.shadowAlpha=e},mxAbstractCanvas2D.prototype.setShadowOffset=function(e,n){this.state.shadowDx=e,this.state.shadowDy=n},mxAbstractCanvas2D.prototype.begin=function(){this.lastY=this.lastX=0,this.path=[]},mxAbstractCanvas2D.prototype.moveTo=function(e,n){this.addOp(this.moveOp,e,n)},mxAbstractCanvas2D.prototype.lineTo=function(e,n){this.addOp(this.lineOp,e,n)},mxAbstractCanvas2D.prototype.quadTo=function(e,n,t,a){this.addOp(this.quadOp,e,n,t,a)},mxAbstractCanvas2D.prototype.curveTo=function(e,n,t,a,i,s){this.addOp(this.curveOp,e,n,t,a,i,s)},mxAbstractCanvas2D.prototype.arcTo=function(e,n,t,a,i,s,o){for(e=mxUtils.arcToCurves(this.lastX,this.lastY,e,n,t,a,i,s,o),n=0;n<e.length;n+=6)this.curveTo(e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5])},mxAbstractCanvas2D.prototype.close=function(e,n,t,a,i,s){this.addOp(this.closeOp)},mxAbstractCanvas2D.prototype.end=function(){},mxUtils.extend(mxXmlCanvas2D,mxAbstractCanvas2D),mxXmlCanvas2D.prototype.textEnabled=!0,mxXmlCanvas2D.prototype.compressed=!0,mxXmlCanvas2D.prototype.writeDefaults=function(){var e;(e=this.createElement("fontfamily")).setAttribute("family",mxConstants.DEFAULT_FONTFAMILY),this.root.appendChild(e),(e=this.createElement("fontsize")).setAttribute("size",mxConstants.DEFAULT_FONTSIZE),this.root.appendChild(e),(e=this.createElement("shadowcolor")).setAttribute("color",mxConstants.SHADOWCOLOR),this.root.appendChild(e),(e=this.createElement("shadowalpha")).setAttribute("alpha",mxConstants.SHADOW_OPACITY),this.root.appendChild(e),(e=this.createElement("shadowoffset")).setAttribute("dx",mxConstants.SHADOW_OFFSET_X),e.setAttribute("dy",mxConstants.SHADOW_OFFSET_Y),this.root.appendChild(e)},mxXmlCanvas2D.prototype.format=function(e){return parseFloat(parseFloat(e).toFixed(2))},mxXmlCanvas2D.prototype.createElement=function(e){return this.root.ownerDocument.createElement(e)},mxXmlCanvas2D.prototype.save=function(){this.compressed&&mxAbstractCanvas2D.prototype.save.apply(this,arguments),this.root.appendChild(this.createElement("save"))},mxXmlCanvas2D.prototype.restore=function(){this.compressed&&mxAbstractCanvas2D.prototype.restore.apply(this,arguments),this.root.appendChild(this.createElement("restore"))},mxXmlCanvas2D.prototype.scale=function(e){if(this.compressed){if(this.state.scale==e)return;mxAbstractCanvas2D.prototype.setAlpha.apply(this,arguments)}var n=this.createElement("scale");n.setAttribute("scale",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.translate=function(e,n){var t=this.createElement("translate");t.setAttribute("dx",this.format(e)),t.setAttribute("dy",this.format(n)),this.root.appendChild(t)},mxXmlCanvas2D.prototype.rotate=function(e,n,t,a,i){var s=this.createElement("rotate");(0!=e||n||t)&&(s.setAttribute("theta",this.format(e)),s.setAttribute("flipH",n?"1":"0"),s.setAttribute("flipV",t?"1":"0"),s.setAttribute("cx",this.format(a)),s.setAttribute("cy",this.format(i)),this.root.appendChild(s))},mxXmlCanvas2D.prototype.setAlpha=function(e){if(this.compressed){if(this.state.alpha==e)return;mxAbstractCanvas2D.prototype.setAlpha.apply(this,arguments)}var n=this.createElement("alpha");n.setAttribute("alpha",this.format(e)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setFillColor=function(e){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fillColor==e)return;mxAbstractCanvas2D.prototype.setFillColor.apply(this,arguments)}var n=this.createElement("fillcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setGradient=function(e,n,t,a,i,s,o,r,l){if(null!=e&&null!=n){mxAbstractCanvas2D.prototype.setGradient.apply(this,arguments);var d=this.createElement("gradient");d.setAttribute("c1",e),d.setAttribute("c2",n),d.setAttribute("x",this.format(t)),d.setAttribute("y",this.format(a)),d.setAttribute("w",this.format(i)),d.setAttribute("h",this.format(s)),null!=o&&d.setAttribute("direction",o),null!=r&&d.setAttribute("alpha1",r),null!=l&&d.setAttribute("alpha2",l),this.root.appendChild(d)}},mxXmlCanvas2D.prototype.setStrokeColor=function(e){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.strokeColor==e)return;mxAbstractCanvas2D.prototype.setStrokeColor.apply(this,arguments)}var n=this.createElement("strokecolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setStrokeWidth=function(e){if(this.compressed){if(this.state.strokeWidth==e)return;mxAbstractCanvas2D.prototype.setStrokeWidth.apply(this,arguments)}var n=this.createElement("strokewidth");n.setAttribute("width",this.format(e)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setDashed=function(e){if(this.compressed){if(this.state.dashed==e)return;mxAbstractCanvas2D.prototype.setDashed.apply(this,arguments)}var n=this.createElement("dashed");n.setAttribute("dashed",e?"1":"0"),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setDashPattern=function(e){if(this.compressed){if(this.state.dashPattern==e)return;mxAbstractCanvas2D.prototype.setDashPattern.apply(this,arguments)}var n=this.createElement("dashpattern");n.setAttribute("pattern",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setLineCap=function(e){if(this.compressed){if(this.state.lineCap==e)return;mxAbstractCanvas2D.prototype.setLineCap.apply(this,arguments)}var n=this.createElement("linecap");n.setAttribute("cap",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setLineJoin=function(e){if(this.compressed){if(this.state.lineJoin==e)return;mxAbstractCanvas2D.prototype.setLineJoin.apply(this,arguments)}var n=this.createElement("linejoin");n.setAttribute("join",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setMiterLimit=function(e){if(this.compressed){if(this.state.miterLimit==e)return;mxAbstractCanvas2D.prototype.setMiterLimit.apply(this,arguments)}var n=this.createElement("miterlimit");n.setAttribute("limit",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setFontColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontColor==e)return;mxAbstractCanvas2D.prototype.setFontColor.apply(this,arguments)}var n=this.createElement("fontcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontBackgroundColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontBackgroundColor==e)return;mxAbstractCanvas2D.prototype.setFontBackgroundColor.apply(this,arguments)}var n=this.createElement("fontbackgroundcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontBorderColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontBorderColor==e)return;mxAbstractCanvas2D.prototype.setFontBorderColor.apply(this,arguments)}var n=this.createElement("fontbordercolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontSize=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontSize==e)return;mxAbstractCanvas2D.prototype.setFontSize.apply(this,arguments)}var n=this.createElement("fontsize");n.setAttribute("size",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontFamily=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontFamily==e)return;mxAbstractCanvas2D.prototype.setFontFamily.apply(this,arguments)}var n=this.createElement("fontfamily");n.setAttribute("family",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontStyle=function(e){if(this.textEnabled){if(null==e&&(e=0),this.compressed){if(this.state.fontStyle==e)return;mxAbstractCanvas2D.prototype.setFontStyle.apply(this,arguments)}var n=this.createElement("fontstyle");n.setAttribute("style",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setShadow=function(e){if(this.compressed){if(this.state.shadow==e)return;mxAbstractCanvas2D.prototype.setShadow.apply(this,arguments)}var n=this.createElement("shadow");n.setAttribute("enabled",e?"1":"0"),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowColor=function(e){if(this.compressed){if(e==mxConstants.NONE&&(e=null),this.state.shadowColor==e)return;mxAbstractCanvas2D.prototype.setShadowColor.apply(this,arguments)}var n=this.createElement("shadowcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowAlpha=function(e){if(this.compressed){if(this.state.shadowAlpha==e)return;mxAbstractCanvas2D.prototype.setShadowAlpha.apply(this,arguments)}var n=this.createElement("shadowalpha");n.setAttribute("alpha",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowOffset=function(e,n){if(this.compressed){if(this.state.shadowDx==e&&this.state.shadowDy==n)return;mxAbstractCanvas2D.prototype.setShadowOffset.apply(this,arguments)}var t=this.createElement("shadowoffset");t.setAttribute("dx",e),t.setAttribute("dy",n),this.root.appendChild(t)},mxXmlCanvas2D.prototype.rect=function(e,n,t,a){var i=this.createElement("rect");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(n)),i.setAttribute("w",this.format(t)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){var o=this.createElement("roundrect");o.setAttribute("x",this.format(e)),o.setAttribute("y",this.format(n)),o.setAttribute("w",this.format(t)),o.setAttribute("h",this.format(a)),o.setAttribute("dx",this.format(i)),o.setAttribute("dy",this.format(s)),this.root.appendChild(o)},mxXmlCanvas2D.prototype.ellipse=function(e,n,t,a){var i=this.createElement("ellipse");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(n)),i.setAttribute("w",this.format(t)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){i=this.converter.convert(i);var l=this.createElement("image");l.setAttribute("x",this.format(e)),l.setAttribute("y",this.format(n)),l.setAttribute("w",this.format(t)),l.setAttribute("h",this.format(a)),l.setAttribute("src",i),l.setAttribute("aspect",s?"1":"0"),l.setAttribute("flipH",o?"1":"0"),l.setAttribute("flipV",r?"1":"0"),this.root.appendChild(l)},mxXmlCanvas2D.prototype.begin=function(){this.root.appendChild(this.createElement("begin")),this.lastY=this.lastX=0},mxXmlCanvas2D.prototype.moveTo=function(e,n){var t=this.createElement("move");t.setAttribute("x",this.format(e)),t.setAttribute("y",this.format(n)),this.root.appendChild(t),this.lastX=e,this.lastY=n},mxXmlCanvas2D.prototype.lineTo=function(e,n){var t=this.createElement("line");t.setAttribute("x",this.format(e)),t.setAttribute("y",this.format(n)),this.root.appendChild(t),this.lastX=e,this.lastY=n},mxXmlCanvas2D.prototype.quadTo=function(e,n,t,a){var i=this.createElement("quad");i.setAttribute("x1",this.format(e)),i.setAttribute("y1",this.format(n)),i.setAttribute("x2",this.format(t)),i.setAttribute("y2",this.format(a)),this.root.appendChild(i),this.lastX=t,this.lastY=a},mxXmlCanvas2D.prototype.curveTo=function(e,n,t,a,i,s){var o=this.createElement("curve");o.setAttribute("x1",this.format(e)),o.setAttribute("y1",this.format(n)),o.setAttribute("x2",this.format(t)),o.setAttribute("y2",this.format(a)),o.setAttribute("x3",this.format(i)),o.setAttribute("y3",this.format(s)),this.root.appendChild(o),this.lastX=i,this.lastY=s},mxXmlCanvas2D.prototype.close=function(){this.root.appendChild(this.createElement("close"))},mxXmlCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){mxUtils.isNode(i)&&(i=mxUtils.getOuterHtml(i));var u=this.createElement("text");u.setAttribute("x",this.format(e)),u.setAttribute("y",this.format(n)),u.setAttribute("w",this.format(t)),u.setAttribute("h",this.format(a)),u.setAttribute("str",i),null!=s&&u.setAttribute("align",s),null!=o&&u.setAttribute("valign",o),u.setAttribute("wrap",r?"1":"0"),null==l&&(l=""),u.setAttribute("format",l),null!=d&&u.setAttribute("fill",d?"1":"0"),null!=c&&u.setAttribute("clip",c?"1":"0"),null!=m&&u.setAttribute("rotation",m),this.root.appendChild(u)}},mxXmlCanvas2D.prototype.stroke=function(){this.root.appendChild(this.createElement("stroke"))},mxXmlCanvas2D.prototype.fill=function(){this.root.appendChild(this.createElement("fill"))},mxXmlCanvas2D.prototype.fillAndStroke=function(){this.root.appendChild(this.createElement("fillstroke"))},mxUtils.extend(mxSvgCanvas2D,mxAbstractCanvas2D),mxSvgCanvas2D.prototype.node=null,mxSvgCanvas2D.prototype.matchHtmlAlignment=!0,mxSvgCanvas2D.prototype.textEnabled=!0,mxSvgCanvas2D.prototype.foEnabled=!0,mxSvgCanvas2D.prototype.strokeTolerance=0,mxSvgCanvas2D.prototype.refCount=0,mxSvgCanvas2D.prototype.blockImagePointerEvents=!1,mxSvgCanvas2D.prototype.reset=function(){mxAbstractCanvas2D.prototype.reset.apply(this,arguments),this.gradients=[]},mxSvgCanvas2D.prototype.createStyle=function(e){return(e=this.createElement("style")).setAttribute("type","text/css"),mxUtils.write(e,"svg{font-family:"+mxConstants.DEFAULT_FONTFAMILY+";font-size:"+mxConstants.DEFAULT_FONTSIZE+";fill:none;stroke-miterlimit:10}"),e},mxSvgCanvas2D.prototype.createElement=function(e,n){if(null!=this.root.ownerDocument.createElementNS)return this.root.ownerDocument.createElementNS(n||mxConstants.NS_SVG,e);var t=this.root.ownerDocument.createElement(e);return null!=n&&t.setAttribute("xmlns",n),t},mxSvgCanvas2D.prototype.createGradientId=function(e,n,t,a,i){return"#"==e.charAt(0)&&(e=e.substring(1)),"#"==n.charAt(0)&&(n=n.substring(1)),e=e.toLowerCase()+"-"+t,n=n.toLowerCase()+"-"+a,(t=null)==i||i==mxConstants.DIRECTION_SOUTH?t="s":i==mxConstants.DIRECTION_EAST?t="e":(a=e,e=n,n=a,i==mxConstants.DIRECTION_NORTH?t="s":i==mxConstants.DIRECTION_WEST&&(t="e")),"mx-gradient-"+e+"-"+n+"-"+t},mxSvgCanvas2D.prototype.getSvgGradient=function(e,n,t,a,i){var s=this.createGradientId(e,n,t,a,i),o=this.gradients[s];if(null==o){var r=this.root.ownerSVGElement,l=0,d=s+"-"+l;if(null!=r)for(o=r.ownerDocument.getElementById(d);null!=o&&o.ownerSVGElement!=r;)d=s+"-"+l++,o=r.ownerDocument.getElementById(d);else d="id"+ ++this.refCount;null==o&&((o=this.createSvgGradient(e,n,t,a,i)).setAttribute("id",d),null!=this.defs?this.defs.appendChild(o):r.appendChild(o)),this.gradients[s]=o}return o.getAttribute("id")},mxSvgCanvas2D.prototype.createSvgGradient=function(e,n,t,a,i){var s=this.createElement("linearGradient");return s.setAttribute("x1","0%"),s.setAttribute("y1","0%"),s.setAttribute("x2","0%"),s.setAttribute("y2","0%"),null==i||i==mxConstants.DIRECTION_SOUTH?s.setAttribute("y2","100%"):i==mxConstants.DIRECTION_EAST?s.setAttribute("x2","100%"):i==mxConstants.DIRECTION_NORTH?s.setAttribute("y1","100%"):i==mxConstants.DIRECTION_WEST&&s.setAttribute("x1","100%"),t=t<1?";stop-opacity:"+t:"",(i=this.createElement("stop")).setAttribute("offset","0%"),i.setAttribute("style","stop-color:"+e+t),s.appendChild(i),t=a<1?";stop-opacity:"+a:"",(i=this.createElement("stop")).setAttribute("offset","100%"),i.setAttribute("style","stop-color:"+n+t),s.appendChild(i),s},mxSvgCanvas2D.prototype.addNode=function(e,n){var t=this.node,a=this.state;if(null!=t){if("path"==t.nodeName){if(!(null!=this.path&&0<this.path.length))return;t.setAttribute("d",this.path.join(" "))}e&&null!=a.fillColor?this.updateFill():this.styleEnabled||("ellipse"!=t.nodeName||!mxClient.IS_NS||mxClient.IS_GC||mxClient.IS_SF?t.setAttribute("fill","none"):t.setAttribute("fill","transparent"),e=!1),n&&null!=a.strokeColor?this.updateStroke():this.styleEnabled||t.setAttribute("stroke","none"),null!=a.transform&&0<a.transform.length&&t.setAttribute("transform",a.transform),a.shadow&&this.root.appendChild(this.createShadow(t)),0<this.strokeTolerance&&!e&&this.root.appendChild(this.createTolerance(t)),this.pointerEvents&&("path"!=t.nodeName||this.path[this.path.length-1]==this.closeOp)&&t.setAttribute("pointer-events","all"),this.root.appendChild(t)}},mxSvgCanvas2D.prototype.updateFill=function(){var e=this.state;e.alpha<1&&this.node.setAttribute("fill-opacity",e.alpha),null!=e.fillColor&&(null!=e.gradientColor?(e=this.getSvgGradient(e.fillColor,e.gradientColor,e.fillAlpha,e.gradientAlpha,e.gradientDirection),this.node.setAttribute("fill","url(#"+e+")")):this.node.setAttribute("fill",e.fillColor.toLowerCase()))},mxSvgCanvas2D.prototype.updateStroke=function(){var e=this.state;this.node.setAttribute("stroke",e.strokeColor.toLowerCase()),e.alpha<1&&this.node.setAttribute("stroke-opacity",e.alpha);var n=Math.max(1,this.format(e.strokeWidth*e.scale));1!=n&&this.node.setAttribute("stroke-width",n),"path"==this.node.nodeName&&this.updateStrokeAttributes(),e.dashed&&this.node.setAttribute("stroke-dasharray",this.createDashPattern(n))},mxSvgCanvas2D.prototype.updateStrokeAttributes=function(){var e=this.state;if(null!=e.lineJoin&&"miter"!=e.lineJoin&&this.node.setAttribute("stroke-linejoin",e.lineJoin),null!=e.lineCap){var n=e.lineCap;"flat"==n&&(n="butt"),"butt"!=n&&this.node.setAttribute("stroke-linecap",n)}null!=e.miterLimit&&(!this.styleEnabled||10!=e.miterLimit)&&this.node.setAttribute("stroke-miterlimit",e.miterLimit)},mxSvgCanvas2D.prototype.createDashPattern=function(e){var n=this.state.dashPattern.split(" "),t=[];if(0<n.length)for(var a=0;a<n.length;a++)t[a]=Number(n[a])*e;return t.join(" ")},mxSvgCanvas2D.prototype.createTolerance=function(e){e=e.cloneNode(!0);var n=parseFloat(e.getAttribute("stroke-width")||1)+this.strokeTolerance;return e.setAttribute("pointer-events","stroke"),e.setAttribute("visibility","hidden"),e.removeAttribute("stroke-dasharray"),e.setAttribute("stroke-width",n),e.setAttribute("fill","none"),e.setAttribute("stroke",mxClient.IS_OP?"none":"white"),e},mxSvgCanvas2D.prototype.createShadow=function(e){e=e.cloneNode(!0);var n=this.state;return"none"!=e.getAttribute("fill")&&e.setAttribute("fill",n.shadowColor),"none"!=e.getAttribute("stroke")&&e.setAttribute("stroke",n.shadowColor),e.setAttribute("transform","translate("+this.format(n.shadowDx*n.scale)+","+this.format(n.shadowDy*n.scale)+")"+(n.transform||"")),e.setAttribute("opacity",n.shadowAlpha),e},mxSvgCanvas2D.prototype.rotate=function(e,n,t,a,i){if(0!=e||n||t){var s=this.state;if(a+=s.dx,i+=s.dy,a*=s.scale,i*=s.scale,s.transform=s.transform||"",n&&t)e+=180;else if(n^t){var o=n?a:0,r=n?-1:1,l=t?i:0,d=t?-1:1;s.transform+="translate("+this.format(o)+","+this.format(l)+")scale("+this.format(r)+","+this.format(d)+")translate("+this.format(-o)+","+this.format(-l)+")"}(n?!t:t)&&(e*=-1),0!=e&&(s.transform+="rotate("+this.format(e)+","+this.format(a)+","+this.format(i)+")"),s.rotation+=e,s.rotationCx=a,s.rotationCy=i}},mxSvgCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=this.createElement("path")},mxSvgCanvas2D.prototype.rect=function(e,n,t,a){var i=this.state,s=this.createElement("rect");s.setAttribute("x",this.format((e+i.dx)*i.scale)),s.setAttribute("y",this.format((n+i.dy)*i.scale)),s.setAttribute("width",this.format(t*i.scale)),s.setAttribute("height",this.format(a*i.scale)),this.node=s},mxSvgCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){this.rect(e,n,t,a),0<i&&this.node.setAttribute("rx",this.format(i*this.state.scale)),0<s&&this.node.setAttribute("ry",this.format(s*this.state.scale))},mxSvgCanvas2D.prototype.ellipse=function(e,n,t,a){var i=this.state,s=this.createElement("ellipse");s.setAttribute("cx",Math.round((e+t/2+i.dx)*i.scale)),s.setAttribute("cy",Math.round((n+a/2+i.dy)*i.scale)),s.setAttribute("rx",t/2*i.scale),s.setAttribute("ry",a/2*i.scale),this.node=s},mxSvgCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){i=this.converter.convert(i),s=null==s||s,o=null!=o&&o,r=null!=r&&r;var l=this.state;e+=l.dx,n+=l.dy;var d=this.createElement("image");if(d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(n*l.scale)),d.setAttribute("width",this.format(t*l.scale)),d.setAttribute("height",this.format(a*l.scale)),null==d.setAttributeNS?d.setAttribute("xlink:href",i):d.setAttributeNS(mxConstants.NS_XLINK,"href",i),s||d.setAttribute("preserveAspectRatio","none"),l.alpha<1&&d.setAttribute("opacity",l.alpha),i=this.state.transform||"",o||r){var c=s=1,m=0,u=0;o&&(s=-1,m=-t-2*e),r&&(c=-1,u=-a-2*n),i+="scale("+s+","+c+")translate("+m+","+u+")"}0<i.length&&d.setAttribute("transform",i),this.root.appendChild(d),this.blockImagePointerEvents&&(d.setAttribute("style","pointer-events:none"),(d=this.createElement("rect")).setAttribute("visibility","hidden"),d.setAttribute("pointer-events","fill"),d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(n*l.scale)),d.setAttribute("width",this.format(t*l.scale)),d.setAttribute("height",this.format(a*l.scale)),this.root.appendChild(d))},mxSvgCanvas2D.prototype.createDiv=function(e,n,t,a,i){return t=this.state,a="display:inline-block;font-size:"+Math.round(t.fontSize)+"px;font-family:"+t.fontFamily+";color:"+t.fontColor+";line-height:"+Math.round(t.fontSize*mxConstants.LINE_HEIGHT)+"px;"+a,(t.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(a+="font-weight:bold;"),(t.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(a+="font-style:italic;"),(t.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(a+="font-decoration:underline;"),n==mxConstants.ALIGN_CENTER?a+="text-align:center;":n==mxConstants.ALIGN_RIGHT&&(a+="text-align:right;"),n="",null!=t.fontBackgroundColor&&(n+="background-color:"+t.fontBackgroundColor+";"),null!=t.fontBorderColor&&(n+="border:1px solid "+t.fontBorderColor+";"),mxUtils.isNode(e)||((t=document.createElement("textarea")).innerHTML=e.replace(/&lt;/g,"&amp;lt;").replace(/&gt;/g,"&amp;gt;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=t.value,i?a+=n:0<n.length&&(e='<div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;'+n+'">'+e+"</div>")),!mxClient.IS_IE&&document.createElementNS?((i=document.createElementNS("http://www.w3.org/1999/xhtml","div")).setAttribute("style",a),mxUtils.isNode(e)?this.root.ownerDocument!=document?i.appendChild(e.cloneNode(!0)):i.appendChild(e):i.innerHTML=e,i):(mxUtils.isNode(e)&&this.root.ownerDocument!=document&&(e=e.outerHTML),e=e.replace(/<br>/g,"<br />").replace(/<hr>/g,"<hr />"),mxUtils.parseXml('<div xmlns="http://www.w3.org/1999/xhtml" style="'+a+'">'+e+"</div>").documentElement)},mxSvgCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){m=null!=m?m:0;var u=this.state;if(e+=u.dx,n+=u.dy,this.foEnabled&&"html"==l){var p="vertical-align:top;";if(c?(p+="overflow:hidden;",0<a&&(p+="max-height:"+Math.round(a)+"px;"),0<t&&(p+="width:"+Math.round(t)+"px;")):d&&(p+="width:"+Math.round(t)+"px;",0<a&&(p+="max-height:"+Math.round(a)+"px;")),r?(!c&&0<t&&(p+="width:"+Math.round(t)+"px;"),p+="white-space:normal;"):p+="white-space:nowrap;",r=this.createElement("g"),u.alpha<1&&r.setAttribute("opacity",u.alpha),(l=this.createElement("foreignObject")).setAttribute("pointer-events","all"),null!=(p=this.createDiv(i,s,o,p,d))){r.appendChild(l),this.root.appendChild(r);var g=0;if(mxClient.IS_IE&&!mxClient.IS_SVG){var v=document.createElement("div");v.style.cssText=p.getAttribute("style"),v.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",v.style.visibility="hidden",v.innerHTML=mxUtils.isNode(i)?i.outerHTML:i,document.body.appendChild(v),g=v.offsetWidth,a=mxClient.IS_QUIRKS&&0<a&&c?Math.min(a,v.offsetHeight+2):v.offsetHeight,v.parentNode.removeChild(v),l.appendChild(p)}else this.root.ownerDocument!=document?(p.style.visibility="hidden",document.body.appendChild(p),g=p.offsetWidth,a=p.offsetHeight,l.appendChild(p),p.style.visibility=""):(l.appendChild(p),g=p.offsetWidth,a=p.offsetHeight);t=d?Math.max(t,g):g,u.alpha<1&&r.setAttribute("opacity",u.alpha),d=i=0,s==mxConstants.ALIGN_CENTER?i-=t/2:s==mxConstants.ALIGN_RIGHT&&(i-=t),e+=i,o==mxConstants.ALIGN_MIDDLE?d-=a/2:o==mxConstants.ALIGN_BOTTOM&&(d-=a),n+=d,s=1!=u.scale?"scale("+u.scale+")":"",0!=u.rotation&&this.rotateHtml?(s+="rotate("+u.rotation+","+t/2+","+a/2+")",e=(n=this.rotatePoint((e+t/2)*u.scale,(n+a/2)*u.scale,u.rotation,u.rotationCx,u.rotationCy)).x-t*u.scale/2,n=n.y-a*u.scale/2):(e*=u.scale,n*=u.scale),0!=m&&(s+="rotate("+m+","+-i+","+-d+")"),r.setAttribute("transform","translate("+Math.round(e)+","+Math.round(n)+")"+s),l.setAttribute("width",Math.round(Math.max(1,t))),l.setAttribute("height",Math.round(Math.max(1,a)))}}else this.plainText(e,n,t,a,i,s,o,r,d,c,m)}},mxSvgCanvas2D.prototype.createClip=function(e,n,t,a){for(var i="mx-clip-"+(e=Math.round(e))+"-"+(n=Math.round(n))+"-"+(t=Math.round(t))+"-"+(a=Math.round(a)),s=0,o=i+"-"+s;null!=document.getElementById(o);)o=i+"-"+ ++s;return clip=this.createElement("clipPath"),clip.setAttribute("id",o),(i=this.createElement("rect")).setAttribute("x",e),i.setAttribute("y",n),i.setAttribute("width",t),i.setAttribute("height",a),clip.appendChild(i),clip},mxSvgCanvas2D.prototype.plainText=function(e,n,t,a,i,s,o,r,l,d,c){c=null!=c?c:0,r=this.state;var m=Math.round(r.fontSize),u=this.createElement("g"),p=r.transform||"";if(0!=c&&(p+="rotate("+c+","+this.format(e*r.scale)+","+this.format(n*r.scale)+")"),d&&0<t&&0<a){var g=e;c=n,s==mxConstants.ALIGN_CENTER?g-=t/2:s==mxConstants.ALIGN_RIGHT&&(g-=t),o==mxConstants.ALIGN_MIDDLE?c-=a/2:o==mxConstants.ALIGN_BOTTOM&&(c-=a),c=this.createClip(g*r.scale-2,c*r.scale-2,t*r.scale+4,a*r.scale+4),null!=this.defs?this.defs.appendChild(c):this.root.appendChild(c),u.setAttribute("clip-path","url(#"+c.getAttribute("id")+")")}this.updateFont(u,s),"start"!=(c=s==mxConstants.ALIGN_RIGHT?"end":s==mxConstants.ALIGN_CENTER?"middle":"start")&&u.setAttribute("text-anchor",c),(!this.styleEnabled||m!=mxConstants.DEFAULT_FONTSIZE)&&u.setAttribute("font-size",Math.round(m*r.scale)+"px"),0<p.length&&u.setAttribute("transform",p),r.alpha<1&&u.setAttribute("opacity",r.alpha);p=i.split("\n"),g=Math.round(m*mxConstants.LINE_HEIGHT);var v=m+(p.length-1)*g;for(c=n+m-1,o==mxConstants.ALIGN_MIDDLE?c-=(a=(this.matchHtmlAlignment&&d&&0<a?Math.min(v,a):v)/2)+1:o==mxConstants.ALIGN_BOTTOM&&(c-=(a=this.matchHtmlAlignment&&d&&0<a?Math.min(v,a):v)+2),a=0;a<p.length;a++)0<p[a].length&&0<mxUtils.trim(p[a]).length&&((d=this.createElement("text")).setAttribute("x",this.format(e*r.scale)),d.setAttribute("y",this.format(c*r.scale)),mxUtils.write(d,p[a]),u.appendChild(d)),c+=g;this.root.appendChild(u),this.addTextBackground(u,i,e,n,t,v,s,o,l)},mxSvgCanvas2D.prototype.updateFont=function(e){var n=this.state;e.setAttribute("fill",n.fontColor),(!this.styleEnabled||n.fontFamily!=mxConstants.DEFAULT_FONTFAMILY)&&e.setAttribute("font-family",n.fontFamily),(n.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&e.setAttribute("font-weight","bold"),(n.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&e.setAttribute("font-style","italic"),(n.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&e.setAttribute("text-decoration","underline")},mxSvgCanvas2D.prototype.addTextBackground=function(e,n,t,a,i,s,o,r,l){var d=this.state;if(null!=d.fontBackgroundColor||null!=d.fontBorderColor){var c=null;null!=(c=l?(o==mxConstants.ALIGN_CENTER?t-=i/2:o==mxConstants.ALIGN_RIGHT&&(t-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((t+1)*d.scale,a*d.scale,(i-2)*d.scale,(s+2)*d.scale)):null!=e.getBBox&&this.root.ownerDocument==document?(c=e.getBBox(),n=mxClient.IS_IE&&mxClient.IS_SVG,new mxRectangle(c.x,c.y+(n?0:1),c.width,c.height+(n?1:0))):((c=document.createElement("div")).style.lineHeight=Math.round(d.fontSize*mxConstants.LINE_HEIGHT)+"px",c.style.fontSize=Math.round(d.fontSize)+"px",c.style.fontFamily=d.fontFamily,c.style.whiteSpace="nowrap",c.style.position="absolute",c.style.visibility="hidden",c.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",c.style.zoom="1",(d.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(c.style.fontWeight="bold"),(d.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(c.style.fontStyle="italic"),n=mxUtils.htmlEntities(n,!1),c.innerHTML=n.replace(/\n/g,"<br/>"),document.body.appendChild(c),i=c.offsetWidth,s=c.offsetHeight,c.parentNode.removeChild(c),o==mxConstants.ALIGN_CENTER?t-=i/2:o==mxConstants.ALIGN_RIGHT&&(t-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((t+1)*d.scale,(a+2)*d.scale,i*d.scale,(s+1)*d.scale)))&&((n=this.createElement("rect")).setAttribute("fill",d.fontBackgroundColor||"none"),n.setAttribute("stroke",d.fontBorderColor||"none"),n.setAttribute("x",Math.floor(c.x-1)),n.setAttribute("y",Math.floor(c.y-1)),n.setAttribute("width",Math.ceil(c.width+2)),n.setAttribute("height",Math.ceil(c.height)),d=null!=d.fontBorderColor?Math.max(1,this.format(d.scale)):0,n.setAttribute("stroke-width",d),this.root.ownerDocument==document&&1==mxUtils.mod(d,2)&&n.setAttribute("transform","translate(0.5, 0.5)"),e.insertBefore(n,e.firstChild))}},mxSvgCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxSvgCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxSvgCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)};var mxVmlCanvas2D=function(e){mxAbstractCanvas2D.call(this),this.root=e};function mxGuide(e,n){this.graph=e,this.setStates(n)}function mxStencil(e){this.desc=e,this.parseDescription(),this.parseConstraints()}function mxShape(e){this.stencil=e,this.strokewidth=1,this.rotation=0,this.opacity=100,this.flipV=this.flipH=!1}mxUtils.extend(mxVmlCanvas2D,mxAbstractCanvas2D),mxVmlCanvas2D.prototype.node=null,mxVmlCanvas2D.prototype.textEnabled=!0,mxVmlCanvas2D.prototype.moveOp="m",mxVmlCanvas2D.prototype.lineOp="l",mxVmlCanvas2D.prototype.curveOp="c",mxVmlCanvas2D.prototype.closeOp="x",mxVmlCanvas2D.prototype.rotatedHtmlBackground="",mxVmlCanvas2D.prototype.vmlScale=1,mxVmlCanvas2D.prototype.addNode=function(e,n){var t=this.node,a=this.state;if(null!=t){if("shape"==t.nodeName){if(!(null!=this.path&&0<this.path.length))return;t.path=this.path.join(" ")+" e",t.style.width=this.root.style.width,t.style.height=this.root.style.height,t.coordsize=parseInt(t.style.width)+" "+parseInt(t.style.height)}t.strokeweight=this.format(Math.max(1,a.strokeWidth*a.scale/this.vmlScale))+"px",a.shadow&&this.root.appendChild(this.createShadow(t,e&&null!=a.fillColor,n&&null!=a.strokeColor)),n&&null!=a.strokeColor?(t.stroked="true",t.strokecolor=a.strokeColor):t.stroked="false",t.appendChild(this.createStroke()),e&&null!=a.fillColor?t.appendChild(this.createFill()):!this.pointerEvents||"shape"==t.nodeName&&this.path[this.path.length-1]!=this.closeOp?t.filled="false":t.appendChild(this.createTransparentFill()),this.root.appendChild(t)}},mxVmlCanvas2D.prototype.createTransparentFill=function(){var e=document.createElement(mxClient.VML_PREFIX+":fill");return e.src=mxClient.imageBasePath+"/transparent.gif",e.type="tile",e},mxVmlCanvas2D.prototype.createFill=function(){var e=this.state,n=document.createElement(mxClient.VML_PREFIX+":fill");if(n.color=e.fillColor,null!=e.gradientColor){n.type="gradient",n.method="none",n.color2=e.gradientColor;var t=180-e.rotation;t=e.gradientDirection==mxConstants.DIRECTION_WEST?t-(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_EAST?t+(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_NORTH?t-(180+("y"==this.root.style.flip?-180:0)):t+("y"==this.root.style.flip?-180:0);"x"!=this.root.style.flip&&"y"!=this.root.style.flip||(t*=-1),n.angle=mxUtils.mod(t,360),n.opacity=100*e.alpha*e.fillAlpha+"%",n.setAttribute(mxClient.OFFICE_PREFIX+":opacity2",100*e.alpha*e.gradientAlpha+"%")}else e.alpha<1&&(n.opacity=100*e.alpha+"%");return n},mxVmlCanvas2D.prototype.createStroke=function(){var e=this.state,n=document.createElement(mxClient.VML_PREFIX+":stroke");return n.endcap=e.lineCap||"flat",n.joinstyle=e.lineJoin||"miter",n.miterlimit=e.miterLimit||"10",e.alpha<1&&(n.opacity=100*e.alpha+"%"),e.dashed&&(n.dashstyle=this.getVmlDashStyle()),n},mxVmlCanvas2D.prototype.getVmlDashStyle=function(){var e="dash";if(null!=this.state.dashPattern){var n=this.state.dashPattern.split(" ");0<n.length&&1==n[0]&&(e="0 2")}return e},mxVmlCanvas2D.prototype.createShadow=function(e,n,t){var a=this.state,i=-a.rotation*(Math.PI/180),s=Math.cos(i),o=(i=Math.sin(i),a.shadowDx*a.scale),r=a.shadowDy*a.scale;"x"==this.root.style.flip?o*=-1:"y"==this.root.style.flip&&(r*=-1);var l=e.cloneNode(!0);return l.style.marginLeft=Math.round(o*s-r*i)+"px",l.style.marginTop=Math.round(o*i+r*s)+"px",8==document.documentMode&&(l.strokeweight=e.strokeweight,"shape"==e.nodeName&&(l.path=this.path.join(" ")+" e",l.style.width=this.root.style.width,l.style.height=this.root.style.height,l.coordsize=parseInt(e.style.width)+" "+parseInt(e.style.height))),t?(l.strokecolor=a.shadowColor,l.appendChild(this.createShadowStroke())):l.stroked="false",n?l.appendChild(this.createShadowFill()):l.filled="false",l},mxVmlCanvas2D.prototype.createShadowFill=function(){var e=document.createElement(mxClient.VML_PREFIX+":fill");return e.color=this.state.shadowColor,e.opacity=100*this.state.alpha*this.state.shadowAlpha+"%",e},mxVmlCanvas2D.prototype.createShadowStroke=function(){var e=this.createStroke();return e.opacity=100*this.state.alpha*this.state.shadowAlpha+"%",e},mxVmlCanvas2D.prototype.rotate=function(e,n,t,a,i){n&&t?e+=180:n?this.root.style.flip="x":t&&(this.root.style.flip="y"),(n?!t:t)&&(e*=-1),this.root.style.rotation=e,this.state.rotation+=e,this.state.rotationCx=a,this.state.rotationCy=i},mxVmlCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=document.createElement(mxClient.VML_PREFIX+":shape"),this.node.style.position="absolute"},mxVmlCanvas2D.prototype.quadTo=function(e,n,t,a){var i=this.state,s=(this.lastX+i.dx)*i.scale,o=(this.lastY+i.dy)*i.scale;e=(e+i.dx)*i.scale;o+=2/3*((n=(n+i.dy)*i.scale)-o);var r=(t=(t+i.dx)*i.scale)+2/3*(e-t);n=(a=(a+i.dy)*i.scale)+2/3*(n-a),this.path.push("c "+this.format(s+2/3*(e-s))+" "+this.format(o)+" "+this.format(r)+" "+this.format(n)+" "+this.format(t)+" "+this.format(a)),this.lastX=t/i.scale-i.dx,this.lastY=a/i.scale-i.dy},mxVmlCanvas2D.prototype.createRect=function(e,n,t,a,i){var s=this.state;return(e=document.createElement(e)).style.position="absolute",e.style.left=this.format((n+s.dx)*s.scale)+"px",e.style.top=this.format((t+s.dy)*s.scale)+"px",e.style.width=this.format(a*s.scale)+"px",e.style.height=this.format(i*s.scale)+"px",e},mxVmlCanvas2D.prototype.rect=function(e,n,t,a){this.node=this.createRect(mxClient.VML_PREFIX+":rect",e,n,t,a)},mxVmlCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){this.node=this.createRect(mxClient.VML_PREFIX+":roundrect",e,n,t,a),this.node.setAttribute("arcsize",Math.max(100*i/t,100*s/a)+"%")},mxVmlCanvas2D.prototype.ellipse=function(e,n,t,a){this.node=this.createRect(mxClient.VML_PREFIX+":oval",e,n,t,a)},mxVmlCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){var l=null;s?((l=this.createRect(mxClient.VML_PREFIX+":rect",e,n,t,a)).stroked="false",(e=document.createElement(mxClient.VML_PREFIX+":fill")).aspect=s?"atmost":"ignore",e.rotate="true",e.type="frame",e.src=i,l.appendChild(e)):(l=this.createRect(mxClient.VML_PREFIX+":image",e,n,t,a)).src=i,o&&r?l.style.rotation="180":o?l.style.flip="x":r&&(l.style.flip="y"),this.state.alpha<1&&(l.style.filter+="alpha(opacity="+100*this.state.alpha+")"),this.root.appendChild(l)},mxVmlCanvas2D.prototype.createDiv=function(e,n,t,a){t=document.createElement("div");var i=this.state,s="";return null!=i.fontBackgroundColor&&(s+="background-color:"+i.fontBackgroundColor+";"),null!=i.fontBorderColor&&(s+="border:1px solid "+i.fontBorderColor+";"),mxUtils.isNode(e)?t.appendChild(e):0<s.length&&!a?((a=document.createElement("div")).style.cssText=s,a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.innerHTML=e,t.appendChild(a)):(t.style.cssText=s,t.innerHTML=e),(e=t.style).fontSize=Math.round(i.fontSize/this.vmlScale)+"px",e.fontFamily=i.fontFamily,e.color=i.fontColor,e.verticalAlign="top",e.textAlign=n||"left",e.lineHeight=Math.round(i.fontSize*mxConstants.LINE_HEIGHT/this.vmlScale)+"px",(i.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(e.fontWeight="bold"),(i.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(e.fontStyle="italic"),(i.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(e.fontDecoration="underline"),t},mxVmlCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){var u=this.state;if("html"==l){null!=u.rotation&&(e=(n=this.rotatePoint(e,n,u.rotation,u.rotationCx,u.rotationCy)).x,n=n.y),8==document.documentMode?(e+=u.dx,n+=u.dy):(e*=u.scale,n*=u.scale),(l=8==document.documentMode?document.createElement(mxClient.VML_PREFIX+":group"):document.createElement("div")).style.position="absolute",l.style.display="inline",l.style.left=this.format(e)+"px",l.style.top=this.format(n)+"px",l.style.zoom=u.scale;var p=document.createElement("div");p.style.position="relative",p.style.display="inline";var g=(v=mxUtils.getAlignmentAsPoint(s,o)).x,v=v.y;if(i=this.createDiv(i,s,o,d),s=document.createElement("div"),r?(!c&&0<t&&(i.style.width=Math.round(t)+"px"),i.style.whiteSpace="normal"):i.style.whiteSpace="nowrap",r=u.rotation+(m||0),this.rotateHtml&&0!=r?(s.style.display="inline",s.style.zoom="1",s.appendChild(i),8==document.documentMode&&"DIV"!=this.root.nodeName?(p.appendChild(s),l.appendChild(p)):l.appendChild(s)):8==document.documentMode?(p.appendChild(i),l.appendChild(p)):(i.style.display="inline",l.appendChild(i)),"DIV"!=this.root.nodeName?((m=document.createElement(mxClient.VML_PREFIX+":rect")).stroked="false",m.filled="false",m.appendChild(l),this.root.appendChild(m)):this.root.appendChild(l),c?(i.style.overflow="hidden",0<t&&(i.style.width=Math.round(t)+"px"),0<a&&8==document.documentMode&&(i.style.maxHeight=Math.round(a)+"px")):d&&(i.style.width=t+"px",0<a&&(i.style.maxHeight=Math.round(a)+"px")),this.rotateHtml&&0!=r){t=r*(Math.PI/180),r=parseFloat(parseFloat(Math.cos(t)).toFixed(8)),m=parseFloat(parseFloat(Math.sin(-t)).toFixed(8)),(t%=2*Math.PI)<0&&(t+=2*Math.PI),(t%=Math.PI)>Math.PI/2&&(t=Math.PI-t),o=Math.cos(t);var h=Math.sin(t);8==document.documentMode&&(i.style.display="inline-block",s.style.display="inline-block",p.style.display="inline-block"),i.style.visibility="hidden",document.body.appendChild(i),t=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&(c||d)&&a<p&&(p=a,i.style.height=p+"px"),c=((a=p)-a*o+t*-h)/2-m*t*(g+.5)+r*a*(v+.5),d=(t-t*o+a*-h)/2+r*t*(g+.5)+m*a*(v+.5),"group"==l.nodeName&&"DIV"==this.root.nodeName?((g=document.createElement("div")).style.display="inline-block",g.style.position="absolute",g.style.left=this.format(e+(d-t/2)*u.scale)+"px",g.style.top=this.format(n+(c-a/2)*u.scale)+"px",l.parentNode.appendChild(g),g.appendChild(l)):(u=8==document.documentMode?1:u.scale,l.style.left=this.format(e+(d-t/2)*u)+"px",l.style.top=this.format(n+(c-a/2)*u)+"px"),s.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+r+", M12="+m+", M21="+-m+", M22="+r+", sizingMethod='auto expand')",s.style.backgroundColor=this.rotatedHtmlBackground,this.state.alpha<1&&(s.style.filter+="alpha(opacity="+100*this.state.alpha+")"),i.style.visibility="",s.appendChild(i)}else 8!=document.documentMode?(i.style.verticalAlign="top",this.state.alpha<1&&(l.style.filter="alpha(opacity="+100*this.state.alpha+")"),u=i.parentNode,i.style.visibility="hidden",document.body.appendChild(i),t=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&c&&a<p&&(p=a,i.style.height=p+"px"),a=p,i.style.visibility="",u.appendChild(i),l.style.left=this.format(e+t*g*this.state.scale)+"px",l.style.top=this.format(n+a*v*this.state.scale)+"px"):(this.state.alpha<1&&(i.style.filter="alpha(opacity="+100*this.state.alpha+")"),p.style.left=100*g+"%",p.style.top=100*v+"%")}else this.plainText(e,n,t,a,mxUtils.htmlEntities(i,!1),s,o,r,l,d,c,m)}},mxVmlCanvas2D.prototype.plainText=function(e,n,t,a,i,s,o,r,l,d,c,m){e=(e+(a=this.state).dx)*a.scale,n=(n+a.dy)*a.scale,(t=document.createElement(mxClient.VML_PREFIX+":shape")).style.width="1px",t.style.height="1px",t.stroked="false",(d=document.createElement(mxClient.VML_PREFIX+":fill")).color=a.fontColor,d.opacity=100*a.alpha+"%",t.appendChild(d),(d=document.createElement(mxClient.VML_PREFIX+":path")).textpathok="true",d.v="m "+this.format(0)+" "+this.format(0)+" l "+this.format(1)+" "+this.format(0),t.appendChild(d),(d=document.createElement(mxClient.VML_PREFIX+":textpath")).style.cssText="v-text-align:"+s,d.style.align=s,d.style.fontFamily=a.fontFamily,d.string=i,d.on="true",s=Math.round(a.fontSize*a.scale/this.vmlScale),d.style.fontSize=s+"px",(a.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(d.style.fontWeight="bold"),(a.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(d.style.fontStyle="italic"),(a.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(d.style.textDecoration="underline"),a=s+((i=i.split("\n")).length-1)*s*mxConstants.LINE_HEIGHT,s=i=0,o==mxConstants.ALIGN_BOTTOM?s=-a/2:o!=mxConstants.ALIGN_MIDDLE&&(s=a/2),null!=m&&(o=(t.style.rotation=m)*(Math.PI/180),i=Math.sin(o)*s,s*=Math.cos(o)),t.appendChild(d),t.style.left=this.format(e-i)+"px",t.style.top=this.format(n+s)+"px",this.root.appendChild(t)},mxVmlCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxVmlCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxVmlCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)},mxGuide.prototype.graph=null,mxGuide.prototype.states=null,mxGuide.prototype.horizontal=!0,mxGuide.prototype.vertical=!0,mxGuide.prototype.guideX=null,mxGuide.prototype.guideY=null,mxGuide.prototype.setStates=function(e){this.states=e},mxGuide.prototype.isEnabledForEvent=function(e){return!0},mxGuide.prototype.getGuideTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxGuide.prototype.createGuideShape=function(e){return(e=new mxPolyline([],mxConstants.GUIDE_COLOR,mxConstants.GUIDE_STROKEWIDTH)).isDashed=!0,e},mxGuide.prototype.move=function(a,e,n){if(null!=this.states&&(this.horizontal||this.vertical)&&null!=a&&null!=e){var t=this.graph.getView().translate,i=this.graph.getView().scale,s=e.x,o=e.y,r=!1,l=!1,d=f=this.getGuideTolerance(),c=f;(f=a.clone()).x+=e.x,f.y+=e.y;var m=f.x,u=f.x+f.width,p=f.getCenterX(),g=f.y,v=f.y+f.height,h=f.getCenterY();e=function(e){e+=this.graph.panDx;var n=!1;if(Math.abs(e-p)<d?(s=e-a.getCenterX(),d=Math.abs(e-p),n=!0):Math.abs(e-m)<d?(s=e-a.x,d=Math.abs(e-m),n=!0):Math.abs(e-u)<d&&(s=e-a.x-a.width,d=Math.abs(e-u),n=!0),n){null==this.guideX&&(this.guideX=this.createGuideShape(!0),this.guideX.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.guideX.pointerEvents=!1,this.guideX.init(this.graph.getView().getOverlayPane()));var t=this.graph.container;e-=this.graph.panDx,this.guideX.points=[new mxPoint(e,-this.graph.panDy),new mxPoint(e,t.scrollHeight-3-this.graph.panDy)]}r=r||n};for(var f=function(e){e+=this.graph.panDy;var n=!1;if(Math.abs(e-h)<c?(o=e-a.getCenterY(),c=Math.abs(e-h),n=!0):Math.abs(e-g)<c?(o=e-a.y,c=Math.abs(e-g),n=!0):Math.abs(e-v)<c&&(o=e-a.y-a.height,c=Math.abs(e-v),n=!0),n){null==this.guideY&&(this.guideY=this.createGuideShape(!1),this.guideY.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.guideY.pointerEvents=!1,this.guideY.init(this.graph.getView().getOverlayPane()));var t=this.graph.container;e-=this.graph.panDy,this.guideY.points=[new mxPoint(-this.graph.panDx,e),new mxPoint(t.scrollWidth-3-this.graph.panDx,e)]}l=l||n},b=0;b<this.states.length;b++){var A=this.states[b];null!=A&&(this.horizontal&&(e.call(this,A.getCenterX()),e.call(this,A.x),e.call(this,A.x+A.width)),this.vertical&&(f.call(this,A.getCenterY()),f.call(this,A.y),f.call(this,A.y+A.height)))}r||null==this.guideX?null!=this.guideX&&(this.guideX.node.style.visibility="visible",this.guideX.redraw()):this.guideX.node.style.visibility="hidden",l||null==this.guideY?null!=this.guideY&&(this.guideY.node.style.visibility="visible",this.guideY.redraw()):this.guideY.node.style.visibility="hidden",n&&(r||(n=a.x-(this.graph.snap(a.x/i-t.x)+t.x)*i,s=this.graph.snap(s/i)*i-n),l||(t=a.y-(this.graph.snap(a.y/i-t.y)+t.y)*i,o=this.graph.snap(o/i)*i-t)),e=new mxPoint(s,o)}return e},mxGuide.prototype.hide=function(){null!=this.guideX&&(this.guideX.node.style.visibility="hidden"),null!=this.guideY&&(this.guideY.node.style.visibility="hidden")},mxGuide.prototype.destroy=function(){null!=this.guideX&&(this.guideX.destroy(),this.guideX=null),null!=this.guideY&&(this.guideY.destroy(),this.guideY=null)},mxStencil.defaultLocalized=!1,mxStencil.prototype.desc=null,mxStencil.prototype.constraints=null,mxStencil.prototype.aspect=null,mxStencil.prototype.w0=null,mxStencil.prototype.h0=null,mxStencil.prototype.bgNode=null,mxStencil.prototype.fgNode=null,mxStencil.prototype.strokewidth=null,mxStencil.prototype.parseDescription=function(){this.fgNode=this.desc.getElementsByTagName("foreground")[0],this.bgNode=this.desc.getElementsByTagName("background")[0],this.w0=Number(this.desc.getAttribute("w")||100),this.h0=Number(this.desc.getAttribute("h")||100);var e=this.desc.getAttribute("aspect");this.aspect=null!=e?e:"variable",e=this.desc.getAttribute("strokewidth"),this.strokewidth=null!=e?e:"1"},mxStencil.prototype.parseConstraints=function(){var e=this.desc.getElementsByTagName("connections")[0];if(null!=e&&(null!=(e=mxUtils.getChildNodes(e))&&0<e.length)){this.constraints=[];for(var n=0;n<e.length;n++)this.constraints.push(this.parseConstraint(e[n]))}},mxStencil.prototype.parseConstraint=function(e){var n=Number(e.getAttribute("x")),t=Number(e.getAttribute("y"));return e="1"==e.getAttribute("perimeter"),new mxConnectionConstraint(new mxPoint(n,t),e)},mxStencil.prototype.evaluateTextAttribute=function(e,n,t){return n=this.evaluateAttribute(e,n,t),e=e.getAttribute("localized"),(mxStencil.defaultLocalized&&null==e||"1"==e)&&(n=mxResources.get(n)),n},mxStencil.prototype.evaluateAttribute=function(e,n,t){return null==(n=e.getAttribute(n))&&(null!=(e=mxUtils.getTextContent(e))&&("function"==typeof(e=mxUtils.eval(e))&&(n=e(t)))),n},mxStencil.prototype.drawShape=function(e,n,t,a,i,s){this.drawChildren(e,n,t,a,i,s,this.bgNode,!1),this.drawChildren(e,n,t,a,i,s,this.fgNode,!0)},mxStencil.prototype.drawChildren=function(e,n,t,a,i,s,o,r){if(null!=o){var l=mxUtils.getValue(n.style,mxConstants.STYLE_DIRECTION,null);for(t=this.computeAspect(n.style,t,a,i,s,l),a=Math.min(t.width,t.height),a="inherit"==this.strokewidth?Number(mxUtils.getNumber(n.style,mxConstants.STYLE_STROKEWIDTH,1)):Number(this.strokewidth)*a,e.setStrokeWidth(a),o=o.firstChild;null!=o;)o.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,n,o,t,r),o=o.nextSibling}},mxStencil.prototype.computeAspect=function(e,n,t,a,i,s){e=n,n=a/this.w0;var o=i/this.h0;if(s="north"==s||"south"==s){o=a/this.h0,n=i/this.w0;var r=(a-i)/2;e+=r,t-=r}return"fixed"==this.aspect&&(n=o=Math.min(n,o),s?(e+=(i-this.w0*n)/2,t+=(a-this.h0*o)/2):(e+=(a-this.w0*n)/2,t+=(i-this.h0*o)/2)),new mxRectangle(e,t,n,o)},mxStencil.prototype.drawNode=function(e,n,t,a,i){var s=t.nodeName,o=a.x,r=a.y,l=a.width,d=a.height,c=Math.min(l,d);if("save"==s)e.save();else if("restore"==s)e.restore();else if("path"==s)for(e.begin(),t=t.firstChild;null!=t;)t.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,n,t,a,i),t=t.nextSibling;else if("close"==s)e.close();else if("move"==s)e.moveTo(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("line"==s)e.lineTo(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("quad"==s)e.quadTo(o+Number(t.getAttribute("x1"))*l,r+Number(t.getAttribute("y1"))*d,o+Number(t.getAttribute("x2"))*l,r+Number(t.getAttribute("y2"))*d);else if("curve"==s)e.curveTo(o+Number(t.getAttribute("x1"))*l,r+Number(t.getAttribute("y1"))*d,o+Number(t.getAttribute("x2"))*l,r+Number(t.getAttribute("y2"))*d,o+Number(t.getAttribute("x3"))*l,r+Number(t.getAttribute("y3"))*d);else if("arc"==s)e.arcTo(Number(t.getAttribute("rx"))*l,Number(t.getAttribute("ry"))*d,Number(t.getAttribute("x-axis-rotation")),Number(t.getAttribute("large-arc-flag")),Number(t.getAttribute("sweep-flag")),o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("rect"==s)e.rect(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d);else if("roundrect"==s)0==(n=t.getAttribute("arcsize"))&&(n=100*mxConstants.RECTANGLE_ROUNDING_FACTOR),c=Number(t.getAttribute("w"))*l,a=Number(t.getAttribute("h"))*d,n=Number(n)/100,n=Math.min(c*n,a*n),e.roundrect(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,c,a,n,n);else if("ellipse"==s)e.ellipse(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d);else if("image"==s)n=this.evaluateAttribute(t,"src",n),e.image(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d,n,!1,"1"==t.getAttribute("flipH"),"1"==t.getAttribute("flipV"));else if("text"==s){if(c=this.evaluateTextAttribute(t,"str",n),a="1"==t.getAttribute("vertical")?-90:0,"0"==t.getAttribute("align-shape")){var m=n.rotation,u=1==mxUtils.getValue(n.style,mxConstants.STYLE_FLIPH,0);n=1==mxUtils.getValue(n.style,mxConstants.STYLE_FLIPV,0),a=u&&n?a-m:u||n?a+m:a-m}a-=t.getAttribute("rotation"),e.text(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,0,0,c,t.getAttribute("align")||"left",t.getAttribute("valign")||"top",!1,"",!1,!1,a)}else if("include-shape"==s)null!=(m=mxStencilRegistry.getStencil(t.getAttribute("name")))&&(o+=Number(t.getAttribute("x"))*l,r+=Number(t.getAttribute("y"))*d,c=Number(t.getAttribute("w"))*l,a=Number(t.getAttribute("h"))*d,m.drawShape(e,n,o,r,c,a));else if("fillstroke"==s)e.fillAndStroke();else if("fill"==s)e.fill();else if("stroke"==s)e.stroke();else if("strokewidth"==s)e.setStrokeWidth(Number(t.getAttribute("width"))*c);else if("dashed"==s)e.setDashed("1"==t.getAttribute("dashed"));else if("dashpattern"==s){if(null!=(t=t.getAttribute("pattern"))){for(t=t.split(" "),l=[],d=0;d<t.length;d++)0<t[d].length&&l.push(Number(t[d])*c);t=l.join(" "),e.setDashPattern(t)}}else"strokecolor"==s?e.setStrokeColor(t.getAttribute("color")):"linecap"==s?e.setLineCap(t.getAttribute("cap")):"linejoin"==s?e.setLineJoin(t.getAttribute("join")):"miterlimit"==s?e.setMiterLimit(Number(t.getAttribute("limit"))):"fillcolor"==s?e.setFillColor(t.getAttribute("color")):"alpha"==s?e.setAlpha(t.getAttribute("alpha")):"fontcolor"==s?e.setFontColor(t.getAttribute("color")):"fontstyle"==s?e.setFontStyle(t.getAttribute("style")):"fontfamily"==s?e.setFontFamily(t.getAttribute("family")):"fontsize"==s&&e.setFontSize(Number(t.getAttribute("size"))*c);i&&("fillstroke"==s||"fill"==s||"stroke"==s)&&e.setShadow(!1)},mxShape.prototype.dialect=null,mxShape.prototype.scale=1,mxShape.prototype.bounds=null,mxShape.prototype.points=null,mxShape.prototype.node=null,mxShape.prototype.style=null,mxShape.prototype.style=null,mxShape.prototype.boundingBox=null,mxShape.prototype.stencil=null,mxShape.prototype.svgStrokeTolerance=6,mxShape.prototype.pointerEvents=!0,mxShape.prototype.stencilPointerEvents=!1,mxShape.prototype.vmlScale=1,mxShape.prototype.init=function(e){null==this.node&&(this.node=this.create(e),null!=e&&e.appendChild(this.node))},mxShape.prototype.isParseVml=function(){return!0},mxShape.prototype.isHtmlAllowed=function(){return!1},mxShape.prototype.getSvgScreenOffset=function(){return 1==mxUtils.mod(Math.max(1,Math.round(this.strokewidth*this.scale)),2)?.5:0},mxShape.prototype.create=function(e){return null!=e.ownerSVGElement?this.createSvg(e):8==document.documentMode||this.dialect==mxConstants.DIALECT_SVG||this.dialect!=mxConstants.DIALECT_VML&&this.isHtmlAllowed()?this.createHtml(e):this.createVml(e)},mxShape.prototype.createSvg=function(){return document.createElementNS(mxConstants.NS_SVG,"g")},mxShape.prototype.createVml=function(){var e=document.createElement(mxClient.VML_PREFIX+":group");return e.style.position="absolute",e},mxShape.prototype.createHtml=function(){var e=document.createElement("div");return e.style.position="absolute",e},mxShape.prototype.reconfigure=function(){this.redraw()},mxShape.prototype.redraw=function(){this.updateBoundsFromPoints(),this.checkBounds()?(this.node.style.visibility="","DIV"==this.node.nodeName&&this.isHtmlAllowed()?this.redrawHtmlShape():this.redrawShape(),this.updateBoundingBox()):(this.node.style.visibility="hidden",this.boundingBox=null)},mxShape.prototype.updateBoundsFromPoints=function(){var e=this.points;if(null!=e&&0<e.length&&null!=e[0]){this.bounds=new mxRectangle(Number(e[0].x),Number(e[0].y),1,1);for(var n=1;n<this.points.length;n++)null!=e[n]&&this.bounds.add(new mxRectangle(Number(e[n].x),Number(e[n].y),1,1))}},mxShape.prototype.checkBounds=function(){return null!=this.bounds&&!isNaN(this.bounds.x)&&!isNaN(this.bounds.y)&&!isNaN(this.bounds.width)&&!isNaN(this.bounds.height)&&0<this.bounds.width&&0<this.bounds.height},mxShape.prototype.createVmlGroup=function(){var e=document.createElement(mxClient.VML_PREFIX+":group");return e.style.position="absolute",e.style.width=this.node.style.width,e.style.height=this.node.style.height,e},mxShape.prototype.redrawShape=function(){var e=this.createCanvas();for(e.pointerEvents=this.pointerEvents;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);this.paint(e),this.node!=e.root&&this.node.insertAdjacentHTML("beforeend",e.root.outerHTML),"DIV"==this.node.nodeName&&8==document.documentMode&&(this.node.style.filter="",(null==this.stencil||!this.stencilPointerEvents)&&mxUtils.addTransparentBackgroundFilter(this.node)),this.destroyCanvas(e)},mxShape.prototype.createCanvas=function(){var e=null,n=null;if(null!=this.node.ownerSVGElement)(e=new mxSvgCanvas2D(this.node,!1)).strokeTolerance=this.svgStrokeTolerance,e.blockImagePointerEvents=mxClient.IS_NS&&!mxClient.IS_SF&&!mxClient.IS_GC,0!=(n=this.getSvgScreenOffset())?this.node.setAttribute("transform","translate("+n+","+n+")"):this.node.removeAttribute("transform");else{this.updateVmlContainer();var t=Math.max(1,Math.round(this.bounds.width)),a=Math.max(1,Math.round(this.bounds.height));n=8==document.documentMode&&this.isParseVml()?this.createVmlGroup():this.node,e=new mxVmlCanvas2D(n,!1);""!=n.tagUrn&&(n.coordsize=t*this.vmlScale+","+a*this.vmlScale,e.scale(this.vmlScale),e.vmlScale=this.vmlScale),n=this.scale,e.translate(-Math.round(this.bounds.x/n),-Math.round(this.bounds.y/n))}return e},mxShape.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px";var e=Math.max(1,Math.round(this.bounds.width)),n=Math.max(1,Math.round(this.bounds.height));this.node.style.width=e+"px",this.node.style.height=n+"px",this.node.style.overflow="visible"},mxShape.prototype.destroyCanvas=function(e){if(e instanceof mxSvgCanvas2D){for(var n in e.gradients){var t=e.gradients[n];t.mxRefCount=(t.mxRefCount||0)+1}this.releaseSvgGradients(this.oldGradients),this.oldGradients=e.gradients}},mxShape.prototype.paint=function(e){var n=this.scale,t=this.bounds.x/n,a=this.bounds.y/n,i=this.bounds.width/n,s=this.bounds.height/n;if(this.isPaintBoundsInverted()){t=t+(o=(i-s)/2),a=a-o;var o=i;i=s,s=o}if(this.updateTransform(e,t,a,i,s),this.configureCanvas(e,t,a,i,s),null!=this.stencil)this.paintStencilShape(e,t,a,i,s);else if(e.setStrokeWidth(this.strokewidth),null!=this.points){for(t=[],a=0;a<this.points.length;a++)t.push(new mxPoint(this.points[a].x/n,this.points[a].y/n));this.paintEdgeShape(e,t)}else this.paintVertexShape(e,t,a,i,s)},mxShape.prototype.configureCanvas=function(e,n,t,a,i){var s=null;null!=this.style&&(s=this.style.dashPattern),e.setAlpha(this.opacity/100),null!=this.isShadow&&e.setShadow(this.isShadow),null!=this.isDashed&&e.setDashed(this.isDashed),null!=s&&e.setDashPattern(s),null!=this.gradient?(n=this.getGradientBounds(e,n,t,a,i),e.setGradient(this.fill,this.gradient,n.x,n.y,n.width,n.height,this.gradientDirection)):e.setFillColor(this.fill),e.setStrokeColor(this.stroke)},mxShape.prototype.getGradientBounds=function(e,n,t,a,i){return new mxRectangle(n,t,a,i)},mxShape.prototype.updateTransform=function(e,n,t,a,i){e.scale(this.scale),e.rotate(this.getShapeRotation(),this.flipH,this.flipV,n+a/2,t+i/2)},mxShape.prototype.paintStencilShape=function(e,n,t,a,i){this.stencilPointerEvents&&(this.dialect==mxConstants.DIALECT_SVG?this.addTransparentBackgroundRectangle(this.node,n,t,a,i):8!=document.documentMode&&this.setTransparentBackgroundImage(this.node)),this.stencil.drawShape(e,this,n,t,a,i)},mxShape.prototype.paintVertexShape=function(e,n,t,a,i){this.paintBackground(e,n,t,a,i),e.setShadow(!1),this.paintForeground(e,n,t,a,i)},mxShape.prototype.paintBackground=function(e,n,t,a,i){},mxShape.prototype.paintForeground=function(e,n,t,a,i){},mxShape.prototype.paintEdgeShape=function(e,n){},mxShape.prototype.getArcSize=function(e,n){var t=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;return Math.min(e*t,n*t)},mxShape.prototype.paintGlassEffect=function(e,n,t,a,i,s){var o=Math.ceil(this.strokewidth/2);e.setGradient("#ffffff","#ffffff",n,t,a,.6*i,"south",.9,.1),e.begin(),s+=2*o,this.isRounded?(e.moveTo(n-o+s,t-o),e.quadTo(n-o,t-o,n-o,t-o+s),e.lineTo(n-o,t+.4*i),e.quadTo(n+.5*a,t+.7*i,n+a+o,t+.4*i),e.lineTo(n+a+o,t-o+s),e.quadTo(n+a+o,t-o,n+a+o-s,t-o)):(e.moveTo(n-o,t-o),e.lineTo(n-o,t+.4*i),e.quadTo(n+.5*a,t+.7*i,n+a+o,t+.4*i),e.lineTo(n+a+o,t-o)),e.close(),e.fill()},mxShape.prototype.apply=function(e){this.state=e,this.style=e.style,null!=this.style&&(this.fill=mxUtils.getValue(this.style,mxConstants.STYLE_FILLCOLOR,this.fill),this.gradient=mxUtils.getValue(this.style,mxConstants.STYLE_GRADIENTCOLOR,this.gradient),this.gradientDirection=mxUtils.getValue(this.style,mxConstants.STYLE_GRADIENT_DIRECTION,this.gradientDirection),this.opacity=mxUtils.getValue(this.style,mxConstants.STYLE_OPACITY,this.opacity),this.stroke=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,this.stroke),this.strokewidth=mxUtils.getNumber(this.style,mxConstants.STYLE_STROKEWIDTH,this.strokewidth),this.spacing=mxUtils.getValue(this.style,mxConstants.STYLE_SPACING,this.spacing),this.startSize=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,this.startSize),this.endSize=mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,this.endSize),this.startArrow=mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,this.startArrow),this.endArrow=mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,this.endArrow),this.rotation=mxUtils.getValue(this.style,mxConstants.STYLE_ROTATION,this.rotation),this.direction=mxUtils.getValue(this.style,mxConstants.STYLE_DIRECTION,this.direction),this.flipH=1==mxUtils.getValue(this.style,mxConstants.STYLE_FLIPH,0),this.flipV=1==mxUtils.getValue(this.style,mxConstants.STYLE_FLIPV,0),null!=this.stencil&&(this.flipH=1==mxUtils.getValue(this.style,"stencilFlipH",0)||this.flipH,this.flipV=1==mxUtils.getValue(this.style,"stencilFlipV",0)||this.flipV),"north"!=this.direction&&"south"!=this.direction||(e=this.flipH,this.flipH=this.flipV,this.flipV=e),this.isShadow=1==mxUtils.getValue(this.style,mxConstants.STYLE_SHADOW,this.isShadow),this.isDashed=1==mxUtils.getValue(this.style,mxConstants.STYLE_DASHED,this.isDashed),this.isRounded=1==mxUtils.getValue(this.style,mxConstants.STYLE_ROUNDED,this.isRounded),this.glass=1==mxUtils.getValue(this.style,mxConstants.STYLE_GLASS,this.glass),"none"==this.fill&&(this.fill=null),"none"==this.gradient&&(this.gradient=null),"none"==this.stroke&&(this.stroke=null))},mxShape.prototype.setCursor=function(e){null==e&&(e=""),this.cursor=e,null!=this.node&&(this.node.style.cursor=e)},mxShape.prototype.getCursor=function(){return this.cursor},mxShape.prototype.updateBoundingBox=function(){if(null!=this.bounds){var e=this.createBoundingBox();if(null!=e){this.augmentBoundingBox(e);var n=this.getShapeRotation();0!=n&&(e=mxUtils.getBoundingBox(e,n)),e.x=Math.floor(e.x),e.y=Math.floor(e.y),e.width=Math.ceil(e.width),e.height=Math.ceil(e.height)}this.boundingBox=e}},mxShape.prototype.createBoundingBox=function(){var e=this.bounds.clone();if(this.isPaintBoundsInverted()){var n=(e.width-e.height)/2;e.x+=n,e.y-=n,n=e.width,e.width=e.height,e.height=n}return e},mxShape.prototype.augmentBoundingBox=function(e){this.isShadow&&(e.width+=Math.ceil(mxConstants.SHADOW_OFFSET_X*this.scale),e.height+=Math.ceil(mxConstants.SHADOW_OFFSET_Y*this.scale));var n=Math.ceil(this.strokewidth*this.scale);e.grow(Math.ceil(n/2))},mxShape.prototype.isPaintBoundsInverted=function(){return null==this.stencil&&("north"==this.direction||"south"==this.direction)},mxShape.prototype.getRotation=function(){return null!=this.rotation?this.rotation:0},mxShape.prototype.getTextRotation=function(){var e=this.getRotation();return 1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)&&(e+=mxText.prototype.verticalTextRotation),e},mxShape.prototype.getShapeRotation=function(){var e=this.getRotation();return null!=this.direction&&("north"==this.direction?e+=270:"west"==this.direction?e+=180:"south"==this.direction&&(e+=90)),e},mxShape.prototype.addTransparentBackgroundRectangle=function(e,n,t,a,i){(e=document.createElementNS(mxConstants.NS_SVG,"rect")).setAttribute("x",n),e.setAttribute("y",t),e.setAttribute("width",a),e.setAttribute("height",i),e.setAttribute("fill","none"),e.setAttribute("stroke","none"),e.setAttribute("pointer-events","all"),this.node.appendChild(e)},mxShape.prototype.setTransparentBackgroundImage=function(e){e.style.backgroundImage="url('"+mxClient.imageBasePath+"/transparent.gif')"},mxShape.prototype.releaseSvgGradients=function(e){if(null!=e)for(var n in e){var t=e[n];t.mxRefCount=(t.mxRefCount||0)-1,0==t.mxRefCount&&null!=t.parentNode&&t.parentNode.removeChild(t)}},mxShape.prototype.destroy=function(){null!=this.node&&(mxEvent.release(this.node),null!=this.node.parentNode&&this.node.parentNode.removeChild(this.node),this.node=null),this.releaseSvgGradients(this.oldGradients),this.oldGradients=null};var mxStencilRegistry={stencils:[],addStencil:function(e,n){mxStencilRegistry.stencils[e]=n},getStencil:function(e){return mxStencilRegistry.stencils[e]}},mxMarker={markers:[],addMarker:function(e,n){mxMarker.markers[e]=n},createMarker:function(e,n,t,a,i,s,o,r,l,d){var c=mxMarker.markers[t];return null!=c?c(e,n,t,a,i,s,o,r,l,d):null}};function mxActor(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxCloud(e,n,t,a){mxActor.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxRectangleShape(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxEllipse(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxDoubleEllipse(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxRhombus(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxPolyline(e,n,t){mxShape.call(this),this.points=e,this.stroke=n,this.strokewidth=null!=t?t:1}function mxArrow(e,n,t,a,i,s,o){mxShape.call(this),this.points=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1,this.arrowWidth=null!=i?i:mxConstants.ARROW_WIDTH,this.spacing=null!=s?s:mxConstants.ARROW_SPACING,this.endSize=null!=o?o:mxConstants.ARROW_SIZE}function mxText(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,A){mxShape.call(this),this.value=e,this.bounds=n,this.color=null!=i?i:"black",this.align=null!=t?t:"",this.valign=null!=a?a:"",this.family=null!=s?s:mxConstants.DEFAULT_FONTFAMILY,this.size=null!=o?o:mxConstants.DEFAULT_FONTSIZE,this.fontStyle=null!=r?r:mxConstants.DEFAULT_FONTSTYLE,this.spacing=parseInt(l||2),this.spacingTop=this.spacing+parseInt(d||0),this.spacingRight=this.spacing+parseInt(c||0),this.spacingBottom=this.spacing+parseInt(m||0),this.spacingLeft=this.spacing+parseInt(u||0),this.horizontal=null==p||p,this.background=g,this.border=v,this.wrap=null!=h&&h,this.clipped=null!=f&&f,this.overflow=null!=b?b:"visible",this.labelPadding=null!=A?A:0,this.rotation=0}function mxTriangle(){mxActor.call(this)}function mxHexagon(){mxActor.call(this)}function mxLine(e,n,t){mxShape.call(this),this.bounds=e,this.stroke=n,this.strokewidth=null!=t?t:1}function mxImageShape(e,n,t,a,i){mxShape.call(this),this.bounds=e,this.image=n,this.fill=t,this.stroke=a,this.strokewidth=null!=i?i:1,this.shadow=!1}function mxLabel(e,n,t,a){mxRectangleShape.call(this,e,n,t,a)}function mxCylinder(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxConnector(e,n,t){mxPolyline.call(this,e,n,t)}function mxSwimlane(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxGraphLayout(e){this.graph=e}function mxStackLayout(e,n,t,a,i,s){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.spacing=null!=t?t:0,this.x0=null!=a?a:0,this.y0=null!=i?i:0,this.border=null!=s?s:0}function mxPartitionLayout(e,n,t,a){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.spacing=t||0,this.border=a||0}function mxCompactTreeLayout(e,n,t){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.invert=null!=t&&t}function WeightedCellSorter(e,n){this.cell=e,this.weightedValue=n}function mxFastOrganicLayout(e){mxGraphLayout.call(this,e)}function mxCircleLayout(e,n){mxGraphLayout.call(this,e),this.radius=null!=n?n:100}function mxParallelEdgeLayout(e){mxGraphLayout.call(this,e)}function mxCompositeLayout(e,n,t){mxGraphLayout.call(this,e),this.layouts=n,this.master=t}function mxEdgeLabelLayout(e,n){mxGraphLayout.call(this,e)}function mxGraphAbstractHierarchyCell(){this.x=[],this.y=[],this.temp=[]}function mxGraphHierarchyNode(e){mxGraphAbstractHierarchyCell.apply(this,arguments),this.cell=e}function mxGraphHierarchyEdge(e){mxGraphAbstractHierarchyCell.apply(this,arguments),this.edges=e}function mxGraphHierarchyModel(e,n,t,a,i){for(e.getGraph(),this.tightenToSource=i,this.roots=t,this.parent=a,this.vertexMapper={},this.edgeMapper={},this.maxRank=0,t=[],null==n&&(n=this.graph.getChildVertices(a)),this.maxRank=this.SOURCESCANSTARTRANK,this.createInternalCells(e,n,t),a=0;a<n.length;a++){i=t[a].connectsAsSource;for(var s=0;s<i.length;s++){var o=i[s];if(null!=(r=o.edges)&&0<r.length){var r=r[0],l=e.getVisibleTerminal(r,!1);l=mxCellPath.create(l),l=this.vertexMapper[l];t[a]==l&&(l=e.getVisibleTerminal(r,!0),l=mxCellPath.create(l),l=this.vertexMapper[l]),null!=l&&t[a]!=l&&(0==(o.target=l).connectsAsTarget.length&&(l.connectsAsTarget=[]),mxUtils.indexOf(l.connectsAsTarget,o)<0&&l.connectsAsTarget.push(o))}}t[a].temp[0]=1}}function mxHierarchicalLayoutStage(){}function mxMedianHybridCrossingReduction(e){this.layout=e}function MedianCellSorter(){}function mxMinimumCycleRemover(e){this.layout=e}function mxCoordinateAssignment(e,n,t,a,i,s){this.layout=e,this.intraCellSpacing=n,this.interRankCellSpacing=t,this.orientation=a,this.initialX=i,this.parallelEdgeSpacing=s}!function(){function e(e,n,t,a,i,s,o,r,l,d){n=1.118*i*l,r=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=n,c.y-=r,o=t!=mxConstants.ARROW_CLASSIC?1:.75,a.x+=-i*o-n,a.y+=-s*o-r,function(){e.begin(),e.moveTo(c.x,c.y),e.lineTo(c.x-i-s/2,c.y-s+i/2),t==mxConstants.ARROW_CLASSIC&&e.lineTo(c.x-3*i/4,c.y-3*s/4),e.lineTo(c.x+s/2-i,c.y-s-i/2),e.close(),d?e.fillAndStroke():e.stroke()}}function n(e,n,t,a,i,s,o,r,l,d){r=t==mxConstants.ARROW_DIAMOND?.7071:.9862,n=i*l*r,r*=s*l,i*=o+l,s*=o+l;var c=a.clone();c.x-=n,c.y-=r,a.x+=-i-n,a.y+=-s-r;var m=t==mxConstants.ARROW_DIAMOND?2:3.4;return function(){e.begin(),e.moveTo(c.x,c.y),e.lineTo(c.x-i/2-s/m,c.y+i/m-s/2),e.lineTo(c.x-i,c.y-s),e.lineTo(c.x-i/2+s/m,c.y-s/2-i/m),e.close(),d?e.fillAndStroke():e.stroke()}}mxMarker.addMarker("classic",e),mxMarker.addMarker("block",e),mxMarker.addMarker("open",function(e,n,t,a,i,s,o,r,l,d){n=1.118*i*l,t=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=n,c.y-=t,a.x+=2*-n,a.y+=2*-t,function(){e.begin(),e.moveTo(c.x-i-s/2,c.y-s+i/2),e.lineTo(c.x,c.y),e.lineTo(c.x+s/2-i,c.y-s-i/2),e.stroke()}}),mxMarker.addMarker("oval",function(e,n,t,a,i,s,o,r,l,d){var c=o/2,m=a.clone();return a.x-=i*c,a.y-=s*c,function(){e.ellipse(m.x-c,m.y-c,o,o),d?e.fillAndStroke():e.stroke()}}),mxMarker.addMarker("diamond",n),mxMarker.addMarker("diamondThin",n)}(),mxUtils.extend(mxActor,mxShape),mxActor.prototype.paintVertexShape=function(e,n,t,a,i){e.translate(n,t),e.begin(),this.redrawPath(e,n,t,a,i),e.fillAndStroke()},mxActor.prototype.redrawPath=function(e,n,t,a,i){n=a/3,e.moveTo(0,i),e.curveTo(0,3*i/5,0,2*i/5,a/2,2*i/5),e.curveTo(a/2-n,2*i/5,a/2-n,0,a/2,0),e.curveTo(a/2+n,0,a/2+n,2*i/5,a/2,2*i/5),e.curveTo(a,2*i/5,a,3*i/5,a,i),e.close()},mxUtils.extend(mxCloud,mxActor),mxCloud.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(.25*a,.25*i),e.curveTo(.05*a,.25*i,0,.5*i,.16*a,.55*i),e.curveTo(0,.66*i,.18*a,.9*i,.31*a,.8*i),e.curveTo(.4*a,i,.7*a,i,.8*a,.8*i),e.curveTo(a,.8*i,a,.6*i,.875*a,.5*i),e.curveTo(a,.3*i,.8*a,.1*i,.625*a,.2*i),e.curveTo(.5*a,.05*i,.3*a,.05*i,.25*a,.25*i),e.close()},mxUtils.extend(mxRectangleShape,mxShape),mxRectangleShape.prototype.isHtmlAllowed=function(){return!this.isRounded&&!this.glass&&0==this.rotation},mxRectangleShape.prototype.paintBackground=function(e,n,t,a,i){if(this.isRounded){var s=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;s=Math.min(a*s,i*s);e.roundrect(n,t,a,i,s,s)}else e.rect(n,t,a,i);e.fillAndStroke()},mxRectangleShape.prototype.paintForeground=function(e,n,t,a,i){this.glass&&this.paintGlassEffect(e,n,t,a,i,this.getArcSize(a+this.strokewidth,i+this.strokewidth))},mxRectangleShape.prototype.redrawHtmlShape=function(){this.updateHtmlBounds(this.node),this.updateHtmlFilters(this.node),this.updateHtmlColors(this.node)},mxRectangleShape.prototype.updateHtmlBounds=function(e){var n=9<=document.documentMode?0:Math.ceil(this.strokewidth*this.scale);e.style.borderWidth=Math.max(1,n)+"px",e.style.overflow="hidden",e.style.left=Math.round(this.bounds.x-n/2)+"px",e.style.top=Math.round(this.bounds.y-n/2)+"px","CSS1Compat"==document.compatMode&&(n=-n),e.style.width=Math.round(Math.max(0,this.bounds.width+n))+"px",e.style.height=Math.round(Math.max(0,this.bounds.height+n))+"px"},mxRectangleShape.prototype.updateHtmlColors=function(e){var n=this.stroke;null!=n&&n!=mxConstants.NONE?(e.style.borderColor=n,this.isDashed?e.style.borderStyle="dashed":0<this.strokewidth&&(e.style.borderStyle="solid"),e.style.borderWidth=Math.max(1,Math.ceil(this.strokewidth*this.scale))+"px"):e.style.borderWidth="0px",null!=(n=this.fill)&&n!=mxConstants.NONE?(e.style.backgroundColor=n,e.style.backgroundImage="none"):this.pointerEvents?e.style.backgroundColor="transparent":8==document.documentMode?mxUtils.addTransparentBackgroundFilter(e):this.setTransparentBackgroundImage(e)},mxRectangleShape.prototype.updateHtmlFilters=function(e){var n="";if(this.opacity<100&&(n+="alpha(opacity="+this.opacity+")"),this.isShadow&&(n+="progid:DXImageTransform.Microsoft.dropShadow (OffX='"+Math.round(mxConstants.SHADOW_OFFSET_X*this.scale)+"', OffY='"+Math.round(mxConstants.SHADOW_OFFSET_Y*this.scale)+"', Color='"+mxConstants.SHADOWCOLOR+"')"),this.gradient){var t=this.fill,a=this.gradient,i="0",s={east:0,south:1,west:2,north:3},o=null!=this.direction?s[this.direction]:0;null!=this.gradientDirection&&(o=mxUtils.mod(o+s[this.gradientDirection]-1,4)),1==o?(i="1",s=t,t=a,a=s):2==o?(s=t,t=a,a=s):3==o&&(i="1"),n+="progid:DXImageTransform.Microsoft.gradient(startColorStr='"+t+"', endColorStr='"+a+"', gradientType='"+i+"')"}e.style.filter=n},mxUtils.extend(mxEllipse,mxShape),mxEllipse.prototype.paintVertexShape=function(e,n,t,a,i){e.ellipse(n,t,a,i),e.fillAndStroke()},mxUtils.extend(mxDoubleEllipse,mxShape),mxDoubleEllipse.prototype.vmlScale=10,mxDoubleEllipse.prototype.paintBackground=function(e,n,t,a,i){e.ellipse(n,t,a,i),e.fillAndStroke()},mxDoubleEllipse.prototype.paintForeground=function(e,n,t,a,i){var s=Math.min(4,Math.min(a/5,i/5));i-=2*s,0<(a-=2*s)&&0<i&&e.ellipse(n+s,t+s,a,i),e.stroke()},mxUtils.extend(mxRhombus,mxShape),mxRhombus.prototype.paintVertexShape=function(e,n,t,a,i){var s=a/2,o=i/2;e.begin(),e.moveTo(n+s,t),e.lineTo(n+a,t+o),e.lineTo(n+s,t+i),e.lineTo(n,t+o),e.close(),e.fillAndStroke()},mxUtils.extend(mxPolyline,mxShape),mxPolyline.prototype.getRotation=function(){return 0},mxPolyline.prototype.paintEdgeShape=function(e,n){this.paintLine(e,n,this.isRounded)},mxPolyline.prototype.paintLine=function(e,n,t){var a=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,i=n[0],s=n[n.length-1];e.begin(),e.moveTo(i.x,i.y);for(var o=1;o<n.length-1;o++){var r=n[o],l=i.x-r.x;i=i.y-r.y;if(t&&o<n.length-1&&(0!=l||0!=i)){var d=Math.sqrt(l*l+i*i);l=l*Math.min(a,d/2)/d,i=i*Math.min(a,d/2)/d;e.lineTo(r.x+l,r.y+i),l=(i=n[o+1]).x-r.x,i=i.y-r.y,d=Math.max(1,Math.sqrt(l*l+i*i)),l=l*Math.min(a,d/2)/d,i=i*Math.min(a,d/2)/d,l=r.x+l,i=r.y+i,e.quadTo(r.x,r.y,l,i),r=new mxPoint(l,i)}else e.lineTo(r.x,r.y);i=r}e.lineTo(s.x,s.y),e.stroke()},mxUtils.extend(mxArrow,mxShape),mxArrow.prototype.paintEdgeShape=function(e,n){var t=mxConstants.ARROW_SPACING,a=mxConstants.ARROW_WIDTH,i=mxConstants.ARROW_SIZE,s=n[0],o=n[n.length-1],r=o.x-s.x,l=o.y-s.y,d=(c=Math.sqrt(r*r+l*l))-2*t-i,c=(r=r/c,a*(l=l/c)/3),m=(a=-a*r/3,(i=s.x-c/2+t*r)+c),u=(s=s.y-a/2+t*l)+a,p=m+d*r,g=p+c,v=(d=u+d*l)+a,h=g-3*c,f=v-3*a;e.begin(),e.moveTo(i,s),e.lineTo(m,u),e.lineTo(p,d),e.lineTo(g,v),e.lineTo(o.x-t*r,o.y-t*l),e.lineTo(h,f),e.lineTo(h+c,f+a),e.close(),e.fillAndStroke()},mxUtils.extend(mxText,mxShape),mxText.prototype.baseSpacingTop=0,mxText.prototype.baseSpacingBottom=0,mxText.prototype.baseSpacingLeft=0,mxText.prototype.baseSpacingRight=0,mxText.prototype.replaceLinefeeds=!0,mxText.prototype.verticalTextRotation=-90,mxText.prototype.ignoreClippedStringSize=!0,mxText.prototype.ignoreStringSize=!1,mxText.prototype.isParseVml=function(){return!1},mxText.prototype.isHtmlAllowed=function(){return 8!=document.documentMode},mxText.prototype.getSvgScreenOffset=function(){return 0},mxText.prototype.checkBounds=function(){return!(null==this.bounds||isNaN(this.bounds.x)||isNaN(this.bounds.y)||isNaN(this.bounds.width)||isNaN(this.bounds.height))},mxText.prototype.updateBoundingBox=function(){var e=this.node;8==document.documentMode&&null!=e.firstChild&&(null!=(e=e.firstChild).firstChild&&(e=e.firstChild)),this.boundingBox=this.bounds.clone();var n=this.getTextRotation();if(this.ignoreStringSize||null==e||"fill"==this.overflow||this.clipped&&this.ignoreClippedStringSize)this.boundingBox.x+=this.margin.x*this.boundingBox.width,this.boundingBox.y+=this.margin.y*this.boundingBox.height;else{var t=null,a=null;if(null!=e.ownerSVGElement)if(null!=e.firstChild&&null!=e.firstChild.firstChild&&"foreignObject"==e.firstChild.firstChild.nodeName)e=e.firstChild.firstChild,t=this.wrap?this.bounds.width:parseInt(e.getAttribute("width"))*this.scale,a=parseInt(e.getAttribute("height"))*this.scale;else{if(0==(n=e.getBBox()).width&&0==n.height)return;this.boundingBox=new mxRectangle(n.x,n.y,n.width,n.height),n=0}else a=this.state.view.textDiv,a=null!=this.offsetWidth&&null!=this.offsetHeight?(t=this.wrap?this.bounds.width:this.offsetWidth*this.scale,this.offsetHeight*this.scale):null!=a?(this.updateFont(a),this.updateSize(a),mxUtils.isNode(this.value)?a.innerHTML=this.value.outerHTML:(t=this.replaceLinefeeds?this.value.replace(/\n/g,"<br/>"):this.value,a.innerHTML=t),t=this.wrap?this.bounds.width:a.offsetWidth*this.scale,a.offsetHeight*this.scale):(t=this.wrap?this.bounds.width:e.offsetWidth*this.scale,e.offsetHeight*this.scale);null!=t&&null!=a&&(this.boundingBox=new mxRectangle(this.bounds.x+this.margin.x*t,this.bounds.y+this.margin.y*a,t,a))}null!=this.boundingBox&&(0!=n&&(n=mxUtils.getBoundingBox(this.boundingBox,n),this.boundingBox.x=n.x,this.boundingBox.y=n.y,mxClient.IS_QUIRKS||(this.boundingBox.width=n.width,this.boundingBox.height=n.height)),this.boundingBox.x=Math.floor(this.boundingBox.x),this.boundingBox.y=Math.floor(this.boundingBox.y),this.boundingBox.width=Math.ceil(this.boundingBox.width),this.boundingBox.height=Math.ceil(this.boundingBox.height))},mxText.prototype.getShapeRotation=function(){return 0},mxText.prototype.getTextRotation=function(){return null!=this.state&&null!=this.state.shape?this.state.shape.getTextRotation():0},mxText.prototype.isPaintBoundsInverted=function(){return!this.horizontal&&null!=this.state&&this.state.view.graph.model.isVertex(this.state.cell)},mxText.prototype.configureCanvas=function(e,n,t,a,i){mxShape.prototype.configureCanvas.apply(this,arguments),e.setFontColor(this.color),e.setFontBackgroundColor(this.background),e.setFontBorderColor(this.border),e.setFontFamily(this.family),e.setFontSize(this.size),e.setFontStyle(this.fontStyle)},mxText.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width="1px",this.node.style.height="1px",this.node.style.overflow="visible"},mxText.prototype.paint=function(e){var n=this.scale,t=this.bounds.x/n,a=this.bounds.y/n,i=this.bounds.width/n;n=this.bounds.height/n;this.updateTransform(e,t,a,i,n),this.configureCanvas(e,t,a,i,n);var s=mxUtils.isNode(this.value)||this.dialect==mxConstants.DIALECT_STRICTHTML,o=s||e instanceof mxVmlCanvas2D?"html":"",r=this.value;!s&&"html"==o&&(r=mxUtils.htmlEntities(r,!1)),r=!mxUtils.isNode(this.value)&&this.replaceLinefeeds&&"html"==o?r.replace(/\n/g,"<br/>"):r,e.text(t,a,i,n,r,this.align,this.valign,this.wrap,o,"fill"==this.overflow,this.clipped,this.getTextRotation())},mxText.prototype.redrawHtmlShape=function(){var e=this.node.style;e.opacity=this.opacity<1?this.opacity:"",e.overflow="",e.width="",e.height="",this.updateFont(this.node),this.updateSize(this.node),this.updateValue(),this.offsetHeight=this.offsetWidth=null,null!=mxClient.CSS_PREFIX?this.updateHtmlTransform():this.updateHtmlFilter()},mxText.prototype.updateHtmlTransform=function(){var e=this.getTextRotation(),n=this.node.style,t=this.margin.x,a=this.margin.y;0!=e?(n[mxClient.CSS_PREFIX+"TransformOrigin"]=100*-t+"% "+100*-a+"%",n[mxClient.CSS_PREFIX+"Transform"]="translate("+100*t+"%,"+100*a+"%)scale("+this.scale+") rotate("+e+"deg)"):(n[mxClient.CSS_PREFIX+"TransformOrigin"]="0% 0%",n[mxClient.CSS_PREFIX+"Transform"]="scale("+this.scale+")translate("+100*t+"%,"+100*a+"%)"),n.left=Math.round(this.bounds.x)+"px",n.top=Math.round(this.bounds.y)+"px"},mxText.prototype.updateHtmlFilter=function(){var e=this.node.style,n=this.margin.x,t=this.margin.y,a=this.scale;e.filter="";var i=0,s=0;if(null!=(r=null!=this.state?this.state.view.textDiv:null)){if(r.style.overflow="",r.style.height="",r.style.width="",this.updateFont(r),this.updateSize(r),mxUtils.isNode(this.value))r.innerHTML=this.value.outerHTML;else{var o=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(o=mxUtils.htmlEntities(o,!1)),o=this.replaceLinefeeds?o.replace(/\n/g,"<br/>"):o,r.innerHTML=o}i=r.offsetWidth+2,s=r.offsetHeight+2}else i=this.node.offsetWidth,s=this.node.offsetHeight+1;this.offsetWidth=i,this.offsetHeight=s,r=this.bounds.width/a,o=this.bounds.height/a,mxClient.IS_QUIRKS&&(this.clipped||"fill"==this.overflow)&&0<o?(o=Math.min(o,s),e.height=Math.round(o+1)+"px"):o=s,"fill"!=this.overflow&&(mxClient.IS_QUIRKS&&(this.clipped||this.wrap)&&0<r?(r=Math.min(r,i),e.width=Math.round(r)+"px"):r=i);o*=a;var r=r*a,l=(i=this.getTextRotation()*(Math.PI/180),s=parseFloat(parseFloat(Math.cos(i)).toFixed(8)),parseFloat(parseFloat(Math.sin(-i)).toFixed(8)));(i=i%(2*Math.PI))<0&&(i+=2*Math.PI),(i%=Math.PI)>Math.PI/2&&(i=Math.PI-i);var d=Math.cos(i),c=Math.sin(-i),m=(o-o*d+r*c)/2+l*(n=r*-(n+.5))-s*(t=o*-(t+.5));0!=i&&(e.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+s+", M12="+l+", M21="+-l+", M22="+s+", sizingMethod='auto expand')"),e.zoom=a,e.left=Math.round(this.bounds.x+((r-r*d+o*c)/2-s*n-l*t)-r/2)+"px",e.top=Math.round(this.bounds.y+m-o/2)+"px"},mxText.prototype.updateValue=function(){if(mxUtils.isNode(this.value))this.node.innerHTML="",this.node.appendChild(this.value);else{var e=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(e=mxUtils.htmlEntities(e,!1));e=this.replaceLinefeeds?e.replace(/\n/g,"<br/>"):e;var n=null!=this.background&&this.background!=mxConstants.NONE?this.background:null,t=null!=this.border&&this.border!=mxConstants.NONE?this.border:null;if(null!=n||null!=t)if("fill"==this.overflow)null!=n&&(this.node.style.backgroundColor=n),null!=t&&(this.node.style.border="1px solid "+t);else{var a="";null!=n&&(a+="background-color:"+n+";"),null!=t&&(a+="border:1px solid "+t+";"),e='<div style="zoom:1;'+a+"display:inline-block;_display:inline;padding-bottom:1px;padding-right:1px;line-height:"+this.node.style.lineHeight+'">'+e+"</div>",this.node.style.lineHeight=""}this.node.innerHTML=e}},mxText.prototype.updateFont=function(e){(e=e.style).lineHeight=Math.round(this.size*mxConstants.LINE_HEIGHT)+"px",e.fontSize=Math.round(this.size)+"px",e.fontFamily=this.family,e.verticalAlign="top",e.color=this.color,e.fontWeight=(this.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD?"bold":"",e.fontStyle=(this.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC?"italic":"",e.fontDecoration=(this.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE?"underline":"",e.textAlign=this.align==mxConstants.ALIGN_CENTER?"center":this.align==mxConstants.ALIGN_RIGHT?"right":"left"},mxText.prototype.updateSize=function(e){var n=Math.round(this.bounds.width/this.scale),t=Math.round(this.bounds.height/this.scale);e=e.style,this.clipped?(e.overflow="hidden",0<t&&(e.maxHeight=t+"px"),0<n&&(e.width=n+"px")):"fill"==this.overflow&&(e.width=n+"px",0<t&&(e.maxHeight=t+"px")),this.wrap?(!this.clipped&&0<n&&(e.width=n+"px"),e.whiteSpace="normal"):e.whiteSpace="nowrap"},mxText.prototype.updateMargin=function(){this.margin=mxUtils.getAlignmentAsPoint(this.align,this.valign)},mxText.prototype.getSpacing=function(){return new mxPoint(this.align==mxConstants.ALIGN_CENTER?(this.spacingLeft-this.spacingRight)/2:this.align==mxConstants.ALIGN_RIGHT?-this.spacingRight-this.baseSpacingRight:this.spacingLeft+this.baseSpacingLeft,this.valign==mxConstants.ALIGN_MIDDLE?(this.spacingTop-this.spacingBottom)/2:this.valign==mxConstants.ALIGN_BOTTOM?-this.spacingBottom-this.baseSpacingBottom:this.spacingTop+this.baseSpacingTop)},mxUtils.extend(mxTriangle,mxActor),mxTriangle.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(0,0),e.lineTo(a,.5*i),e.lineTo(0,i),e.close()},mxUtils.extend(mxHexagon,mxActor),mxHexagon.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(.25*a,0),e.lineTo(.75*a,0),e.lineTo(a,.5*i),e.lineTo(.75*a,i),e.lineTo(.25*a,i),e.lineTo(0,.5*i),e.close()},mxUtils.extend(mxLine,mxShape),mxLine.prototype.paintVertexShape=function(e,n,t,a,i){t+=i/2,e.begin(),e.moveTo(n,t),e.lineTo(n+a,t),e.stroke()},mxUtils.extend(mxImageShape,mxRectangleShape),mxImageShape.prototype.preserveImageAspect=!0,mxImageShape.prototype.getSvgScreenOffset=function(){return mxClient.IS_IE?0:.5},mxImageShape.prototype.apply=function(e){mxShape.prototype.apply.apply(this,arguments),this.gradient=this.stroke=this.fill=null,null!=this.style&&(this.fill=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BACKGROUND),this.stroke=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BORDER),this.preserveImageAspect=1==mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_ASPECT,1),this.flipH=this.flipH||1==mxUtils.getValue(this.style,"imageFlipH",0),this.flipV=this.flipV||1==mxUtils.getValue(this.style,"imageFlipV",0))},mxImageShape.prototype.isHtmlAllowed=function(){return!this.preserveImageAspect},mxImageShape.prototype.createHtml=function(){var e=document.createElement("div");return e.style.position="absolute",e},mxImageShape.prototype.paintVertexShape=function(e,n,t,a,i){if(null!=this.image){var s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BACKGROUND,null),o=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BORDER,null);null==s&&null==o||(e.setFillColor(s),e.setStrokeColor(o),e.rect(n,t,a,i),e.fillAndStroke()),e.image(n,t,a,i,this.image,this.preserveImageAspect,!1,!1)}else mxRectangleShape.prototype.paintBackground.apply(this,arguments)},mxImageShape.prototype.redrawHtmlShape=function(){if(this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width=Math.max(0,Math.round(this.bounds.width))+"px",this.node.style.height=Math.max(0,Math.round(this.bounds.height))+"px",this.node.style.backgroundColor=this.fill||"",this.node.style.borderColor=this.stroke||"",this.node.innerHTML="",null!=this.image){var e=document.createElement(mxClient.IS_IE6||null==mxClient.CSS_PREFIX&&0!=this.rotation?mxClient.VML_PREFIX+":image":"img");e.style.position="absolute",e.src=this.image;var n=this.opacity<100?"alpha(opacity="+this.opacity+")":"";this.node.style.filter=n,this.flipH&&this.flipV?n+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2)":this.flipH?n+="progid:DXImageTransform.Microsoft.BasicImage(mirror=1)":this.flipV&&(n+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"),e.style.filter!=n&&(e.style.filter=n),"image"==e.nodeName?e.style.rotation=this.rotation:e.style[mxClient.CSS_PREFIX+"Transform"]="rotate("+this.rotation+"deg)",e.style.width=this.node.style.width,e.style.height=this.node.style.height,this.node.style.backgroundImage="",this.node.appendChild(e)}else this.setTransparentBackgroundImage(this.node)},mxUtils.extend(mxLabel,mxRectangleShape),mxLabel.prototype.imageSize=mxConstants.DEFAULT_IMAGESIZE,mxLabel.prototype.spacing=2,mxLabel.prototype.indicatorSize=10,mxLabel.prototype.indicatorSpacing=2,mxLabel.prototype.init=function(e){mxShape.prototype.init.apply(this,arguments),null!=this.indicatorColor&&null!=this.indicatorShape&&(this.indicator=new this.indicatorShape,this.indicator.dialect=this.dialect,this.indicator.bounds=this.bounds,this.indicator.fill=this.indicatorColor,this.indicator.stroke=this.indicatorColor,this.indicator.gradient=this.indicatorGradientColor,this.indicator.direction=this.indicatorDirection,this.indicator.init(this.node))},mxLabel.prototype.redraw=function(){null!=this.indicator&&(this.indicator.fill=this.indicatorColor,this.indicator.stroke=this.indicatorColor,this.indicator.gradient=this.indicatorGradientColor,this.indicator.direction=this.indicatorDirection),mxShape.prototype.redraw.apply(this,arguments)},mxLabel.prototype.isHtmlAllowed=function(){return mxRectangleShape.prototype.isHtmlAllowed.apply(this,arguments)&&null==this.indicatorColor&&null==this.indicatorShape},mxLabel.prototype.paintForeground=function(e,n,t,a,i){this.paintImage(e,n,t,a,i),this.paintIndicator(e,n,t,a,i),mxRectangleShape.prototype.paintForeground.apply(this,arguments)},mxLabel.prototype.paintImage=function(e,n,t,a,i){null!=this.image&&(n=this.getImageBounds(n,t,a,i),e.image(n.x,n.y,n.width,n.height,this.image,!1,!1,!1))},mxLabel.prototype.getImageBounds=function(e,n,t,a){var i=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),o=mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_WIDTH,mxConstants.DEFAULT_IMAGESIZE),r=mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_HEIGHT,mxConstants.DEFAULT_IMAGESIZE),l=mxUtils.getNumber(this.style,mxConstants.STYLE_SPACING,this.spacing)+5;return new mxRectangle(e=i==mxConstants.ALIGN_CENTER?e+(t-o)/2:i==mxConstants.ALIGN_RIGHT?e+(t-o-l):e+l,n=s==mxConstants.ALIGN_TOP?n+l:s==mxConstants.ALIGN_BOTTOM?n+(a-r-l):n+(a-r)/2,o,r)},mxLabel.prototype.paintIndicator=function(e,n,t,a,i){null!=this.indicator?(this.indicator.bounds=this.getIndicatorBounds(n,t,a,i),this.indicator.paint(e)):null!=this.indicatorImage&&(n=this.getIndicatorBounds(n,t,a,i),e.image(n.x,n.y,n.width,n.height,this.indicatorImage,!1,!1,!1))},mxLabel.prototype.getIndicatorBounds=function(e,n,t,a){var i=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),o=mxUtils.getNumber(this.style,mxConstants.STYLE_INDICATOR_WIDTH,this.indicatorSize),r=mxUtils.getNumber(this.style,mxConstants.STYLE_INDICATOR_HEIGHT,this.indicatorSize),l=this.spacing+5;return new mxRectangle(e=i==mxConstants.ALIGN_RIGHT?e+(t-o-l):i==mxConstants.ALIGN_CENTER?e+(t-o)/2:e+l,n=s==mxConstants.ALIGN_BOTTOM?n+(a-r-l):s==mxConstants.ALIGN_TOP?n+l:n+(a-r)/2,o,r)},mxLabel.prototype.redrawHtmlShape=function(){for(mxRectangleShape.prototype.redrawHtmlShape.apply(this,arguments);this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);if(null!=this.image){var e=document.createElement("img");e.style.position="relative",e.setAttribute("border","0");var n=this.getImageBounds(this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height);n.x-=this.bounds.x,n.y-=this.bounds.y,e.style.left=Math.round(n.x)+"px",e.style.top=Math.round(n.y)+"px",e.style.width=Math.round(n.width)+"px",e.style.height=Math.round(n.height)+"px",e.src=this.image,this.node.appendChild(e)}},mxUtils.extend(mxCylinder,mxShape),mxCylinder.prototype.maxHeight=40,mxCylinder.prototype.svgStrokeTolerance=0,mxCylinder.prototype.paintVertexShape=function(e,n,t,a,i){e.translate(n,t),e.begin(),this.redrawPath(e,n,t,a,i,!1),e.fillAndStroke(),e.setShadow(!1),e.begin(),this.redrawPath(e,n,t,a,i,!0),e.stroke()},mxCylinder.prototype.redrawPath=function(e,n,t,a,i,s){n=Math.min(this.maxHeight,Math.round(i/5)),(s&&null!=this.fill||!s&&null==this.fill)&&(e.moveTo(0,n),e.curveTo(0,2*n,a,2*n,a,n),s||(e.stroke(),e.begin())),s||(e.moveTo(0,n),e.curveTo(0,-n/3,a,-n/3,a,n),e.lineTo(a,i-n),e.curveTo(a,i+n/3,0,i+n/3,0,i-n),e.close())},mxUtils.extend(mxConnector,mxPolyline),mxConnector.prototype.paintEdgeShape=function(e,n){var t=this.createMarker(e,n,!0),a=this.createMarker(e,n,!1);null==this.style||1!=this.style[mxConstants.STYLE_CURVED]?this.paintLine(e,n,this.isRounded):this.paintCurvedLine(e,n),e.setFillColor(this.stroke),e.setShadow(!1),e.setDashed(!1),null!=t&&t(),null!=a&&a()},mxConnector.prototype.paintCurvedLine=function(e,n){e.begin();var t=n[0],a=n.length;for(e.moveTo(t.x,t.y),t=1;t<a-2;t++){var i=n[t],s=n[t+1];e.quadTo(i.x,i.y,(i.x+s.x)/2,(i.y+s.y)/2)}i=n[a-2],s=n[a-1],e.quadTo(i.x,i.y,s.x,s.y),e.stroke()},mxConnector.prototype.createMarker=function(e,n,t){var a=n.length,i=t?n[1]:n[a-2],s=(a=(n=t?n[0]:n[a-1]).x-i.x,n.y-i.y),o=(i=a/(o=Math.max(1,Math.sqrt(a*a+s*s))),a=s/o,s=mxUtils.getNumber(this.style,t?mxConstants.STYLE_STARTSIZE:mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE),mxUtils.getValue(this.style,t?mxConstants.STYLE_STARTARROW:mxConstants.STYLE_ENDARROW));return mxMarker.createMarker(e,this,o,n,i,a,s,t,this.strokewidth,0!=this.style[t?mxConstants.STYLE_STARTFILL:mxConstants.STYLE_ENDFILL])},mxConnector.prototype.augmentBoundingBox=function(e){mxShape.prototype.augmentBoundingBox.apply(this,arguments);var n=0;mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,mxConstants.NONE)!=mxConstants.NONE&&(n=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_MARKERSIZE)+1),mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,mxConstants.NONE)!=mxConstants.NONE&&(n=Math.max(n,mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE))+1),e.grow(Math.ceil(n*this.scale))},mxUtils.extend(mxSwimlane,mxShape),mxSwimlane.prototype.imageSize=16,mxSwimlane.prototype.getGradientBounds=function(e,n,t,a,i){return new mxRectangle(n,t,a,Math.min(i,mxUtils.getValue(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)))},mxSwimlane.prototype.getRotation=function(){var e=mxShape.prototype.getRotation.apply(this,arguments);return 1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)&&(e+=mxText.prototype.verticalTextRotation),e},mxSwimlane.prototype.getTextRotation=function(){return this.getRotation()},mxSwimlane.prototype.isPaintBoundsInverted=function(){return mxShape.prototype.isPaintBoundsInverted.apply(this,arguments)||1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)},mxSwimlane.prototype.getArcSize=function(e,n,t){return 3*t*(mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100)},mxSwimlane.prototype.paintVertexShape=function(e,n,t,a,i){var s=Math.min(i,mxUtils.getValue(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),o=mxUtils.getValue(this.style,mxConstants.STYLE_SWIMLANE_FILLCOLOR,mxConstants.NONE),r=1==mxUtils.getValue(this.style,mxConstants.STYLE_SWIMLANE_LINE,1),l=0;e.translate(n,t),this.isRounded?(l=this.getArcSize(a,i,s),this.paintRoundedSwimlane(e,n,t,a,i,s,l,o,r)):this.paintSwimlane(e,n,t,a,i,s,o,r),o=mxUtils.getValue(this.style,mxConstants.STYLE_SEPARATORCOLOR,mxConstants.NONE),this.paintSeparator(e,a,s,i,o),null!=this.image&&(i=this.getImageBounds(n,s,a,i),e.image(i.x-n,i.y-t,i.width,i.height,this.image,!1,!1,!1)),this.glass&&(e.setShadow(!1),this.paintGlassEffect(e,0,0,a,s,l))},mxSwimlane.prototype.paintSwimlane=function(e,n,t,a,i,s,o,r){o!=mxConstants.NONE&&(e.save(),e.setFillColor(o),e.rect(0,0,a,i),e.fillAndStroke(),e.restore(),e.setShadow(!1)),e.begin(),e.moveTo(0,s),e.lineTo(0,0),e.lineTo(a,0),e.lineTo(a,s),r&&e.close(),e.fillAndStroke(),s<i&&o==mxConstants.NONE&&(e.pointerEvents=!1,e.begin(),e.moveTo(0,s),e.lineTo(0,i),e.lineTo(a,i),e.lineTo(a,s),e.stroke())},mxSwimlane.prototype.paintRoundedSwimlane=function(e,n,t,a,i,s,o,r,l){r!=mxConstants.NONE&&(e.save(),e.setFillColor(r),e.roundrect(0,0,a,i,o,o),e.fillAndStroke(),e.restore(),e.setShadow(!1)),e.begin(),e.moveTo(a,s),e.lineTo(a,o),e.quadTo(a,0,a-Math.min(a/2,o),0),e.lineTo(Math.min(a/2,o),0),e.quadTo(0,0,0,o),e.lineTo(0,s),l&&e.close(),e.fillAndStroke(),s<i&&r==mxConstants.NONE&&(e.pointerEvents=!1,e.begin(),e.moveTo(0,s),e.lineTo(0,i-o),e.quadTo(0,i,Math.min(a/2,o),i),e.lineTo(a-Math.min(a/2,o),i),e.quadTo(a,i,a,i-o),e.lineTo(a,s),e.stroke())},mxSwimlane.prototype.paintSeparator=function(e,n,t,a,i){i!=mxConstants.NONE&&(e.setStrokeColor(i),e.setDashed(!0),e.begin(),e.moveTo(n,t),e.lineTo(n,a),e.stroke(),e.setDashed(!1))},mxSwimlane.prototype.getImageBounds=function(e,n,t,a){return new mxRectangle(e+t-this.imageSize,n,this.imageSize,this.imageSize)},mxGraphLayout.prototype.graph=null,mxGraphLayout.prototype.useBoundingBox=!0,mxGraphLayout.prototype.parent=null,mxGraphLayout.prototype.moveCell=function(e,n,t){},mxGraphLayout.prototype.execute=function(e){},mxGraphLayout.prototype.getGraph=function(){return this.graph},mxGraphLayout.prototype.getConstraint=function(e,n,t,a){return null!=(n=null!=(t=this.graph.view.getState(n))?t.style:this.graph.getCellStyle(n))?n[e]:null},mxGraphLayout.traverse=function(e,n,t,a,i){if(null!=t&&null!=e){n=null==n||n,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=t(i[s]=e,a))||a)&&0<(a=this.graph.model.getEdgeCount(e)))for(s=0;s<a;s++){var o=this.graph.model.getEdgeAt(e,s),r=this.graph.model.getTerminal(o,!0)==e;n&&!r||(r=this.graph.view.getVisibleTerminal(o,!r),this.traverse(r,n,t,o,i))}}},mxGraphLayout.prototype.isVertexMovable=function(e){return this.graph.isCellMovable(e)},mxGraphLayout.prototype.isVertexIgnored=function(e){return!this.graph.getModel().isVertex(e)||!this.graph.isCellVisible(e)},mxGraphLayout.prototype.isEdgeIgnored=function(e){var n=this.graph.getModel();return!n.isEdge(e)||!this.graph.isCellVisible(e)||null==n.getTerminal(e,!0)||null==n.getTerminal(e,!1)},mxGraphLayout.prototype.setEdgeStyleEnabled=function(e,n){this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE,n?"0":"1",[e])},mxGraphLayout.prototype.setOrthogonalEdge=function(e,n){this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL,n?"1":"0",[e])},mxGraphLayout.prototype.getParentOffset=function(e){var n=new mxPoint;if(null!=e&&e!=this.parent){var t=this.graph.getModel();if(t.isAncestor(this.parent,e))for(var a=t.getGeometry(e);e!=this.parent;)n.x+=a.x,n.y+=a.y,e=t.getParent(e),a=t.getGeometry(e)}return n},mxGraphLayout.prototype.setEdgePoints=function(e,n){if(null!=e){var t=this.graph.model,a=t.getGeometry(e);if(null==a?(a=new mxGeometry).setRelative(!0):a=a.clone(),null!=this.parent&&null!=n)for(var i=t.getParent(e),s=(i=this.getParentOffset(i),0);s<n.length;s++)n[s].x-=i.x,n[s].y-=i.y;a.points=n,t.setGeometry(e,a)}},mxGraphLayout.prototype.setVertexLocation=function(e,n,t){var a=this.graph.getModel(),i=a.getGeometry(e),s=null;if(null!=i){if(s=new mxRectangle(n,t,i.width,i.height),this.useBoundingBox){var o=this.graph.getView().getState(e);if(null!=o&&null!=o.text&&null!=o.text.boundingBox){var r=this.graph.getView().scale,l=o.text.boundingBox;o.text.boundingBox.x<o.x&&(n+=(o.x-l.x)/r,s.width=l.width),o.text.boundingBox.y<o.y&&(t+=(o.y-l.y)/r,s.height=l.height)}}null!=this.parent&&(null!=(o=a.getParent(e))&&o!=this.parent&&(n-=(o=this.getParentOffset(o)).x,t-=o.y)),i.x==n&&i.y==t||((i=i.clone()).x=n,i.y=t,a.setGeometry(e,i))}return s},mxGraphLayout.prototype.getVertexBounds=function(e){var n=this.graph.getModel().getGeometry(e);if(this.useBoundingBox&&(null!=(r=this.graph.getView().getState(e))&&null!=r.text&&null!=r.text.boundingBox)){var t=this.graph.getView().scale,a=r.text.boundingBox,i=Math.max(r.x-a.x,0)/t,s=Math.max(r.y-a.y,0)/t,o=Math.max(a.x+a.width-(r.x+r.width),0)/t,r=Math.max(a.y+a.height-(r.y+r.height),0)/t;n=new mxRectangle(n.x-i,n.y-s,n.width+i+o,n.height+s+r)}return null!=this.parent&&(e=this.graph.getModel().getParent(e),n=n.clone(),null!=e&&e!=this.parent&&(e=this.getParentOffset(e),n.x+=e.x,n.y+=e.y)),new mxRectangle(n.x,n.y,n.width,n.height)},mxGraphLayout.prototype.arrangeGroups=function(e,n){this.graph.getModel().beginUpdate();try{for(var t=e.length-1;0<=t;t--){var a=e[t],i=this.graph.getChildVertices(a),s=this.graph.getBoundingBoxFromGeometry(i),o=this.graph.getCellGeometry(a),r=0,l=0;if(this.graph.isSwimlane(a)){var d=this.graph.getStartSize(a);r=d.width,l=d.height}null!=s&&null!=o&&((o=o.clone()).x=o.x+s.x-n-r,o.y=o.y+s.y-n-l,o.width=s.width+2*n+r,o.height=s.height+2*n+l,this.graph.getModel().setGeometry(a,o),this.graph.moveCells(i,n+r-s.x,n+l-s.y))}}finally{this.graph.getModel().endUpdate()}},mxStackLayout.prototype=new mxGraphLayout,mxStackLayout.prototype.constructor=mxStackLayout,mxStackLayout.prototype.horizontal=null,mxStackLayout.prototype.spacing=null,mxStackLayout.prototype.x0=null,mxStackLayout.prototype.y0=null,mxStackLayout.prototype.border=0,mxStackLayout.prototype.keepFirstLocation=!1,mxStackLayout.prototype.fill=!1,mxStackLayout.prototype.resizeParent=!1,mxStackLayout.prototype.resizeLast=!1,mxStackLayout.prototype.wrap=null,mxStackLayout.prototype.isHorizontal=function(){return this.horizontal},mxStackLayout.prototype.moveCell=function(e,n,t){var a=this.graph.getModel(),i=a.getParent(e),s=this.isHorizontal();if(null!=e&&null!=i){var o=0,r=0,l=a.getChildCount(i);for(n=s?n:t,null!=(o=this.graph.getView().getState(i))&&(n-=s?o.x:o.y),o=0;o<l;o++)if((t=a.getChildAt(i,o))!=e&&null!=(t=a.getGeometry(t))){if(t=s?t.x+t.width/2:t.y+t.height/2,r<n&&n<t)break;r=t}s=i.getIndex(e),s=Math.max(0,o-(s<o?1:0)),a.add(i,e,s)}},mxStackLayout.prototype.getParentSize=function(e){var n=this.graph.getModel(),t=n.getGeometry(e);return null!=this.graph.container&&(null==t&&n.isLayer(e)||e==this.graph.getView().currentRoot)&&(t=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),t},mxStackLayout.prototype.execute=function(e){if(null!=e){var n=this.isHorizontal(),t=this.graph.getModel(),a=this.getParentSize(e),i=0;null!=a&&(i=n?a.height:a.width);i=i-(2*this.spacing+2*this.border);var s=this.x0+this.border,o=this.y0+this.border;if(this.graph.isSwimlane(e)){var r=this.graph.getCellStyle(e),l=mxUtils.getValue(r,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE);n==(r=mxUtils.getValue(r,mxConstants.STYLE_HORIZONTAL,!0))&&(i-=l),n?o+=l:s+=l}t.beginUpdate();try{l=0,r=null;for(var d=t.getChildCount(e),c=0;c<d;c++){var m=t.getChildAt(e,c);if(!this.isVertexIgnored(m)&&this.isVertexMovable(m)){var u=t.getGeometry(m);null!=u&&(u=u.clone(),null!=this.wrap&&null!=r&&(n&&r.x+r.width+u.width+2*this.spacing>this.wrap||!n&&r.y+r.height+u.height+2*this.spacing>this.wrap)&&(r=null,n?o+=l+this.spacing:s+=l+this.spacing,l=0),l=Math.max(l,n?u.height:u.width),null!=r?n?u.x=r.x+r.width+this.spacing:u.y=r.y+r.height+this.spacing:this.keepFirstLocation||(n?u.x=s:u.y=o),n?u.y=o:u.x=s,this.fill&&0<i&&(n?u.height=i:u.width=i),t.setGeometry(m,u),r=u)}}this.resizeParent&&null!=a&&null!=r&&!this.graph.isCellCollapsed(e)?(a=a.clone(),n?a.width=r.x+r.width+this.spacing:a.height=r.y+r.height+this.spacing,t.setGeometry(e,a)):this.resizeLast&&null!=a&&null!=r&&(n?r.width=a.width-r.x-this.spacing:r.height=a.height-r.y-this.spacing)}finally{t.endUpdate()}}},mxPartitionLayout.prototype=new mxGraphLayout,mxPartitionLayout.prototype.constructor=mxPartitionLayout,mxPartitionLayout.prototype.horizontal=null,mxPartitionLayout.prototype.spacing=null,mxPartitionLayout.prototype.border=null,mxPartitionLayout.prototype.resizeVertices=!0,mxPartitionLayout.prototype.isHorizontal=function(){return this.horizontal},mxPartitionLayout.prototype.moveCell=function(e,n,t){var a=(t=this.graph.getModel()).getParent(e);if(null!=e&&null!=a){var i=0,s=0,o=t.getChildCount(a);for(i=0;i<o;i++){var r=t.getChildAt(a,i);if(null!=(r=this.getVertexBounds(r))){if(r=r.x+r.width/2,s<n&&n<r)break;s=r}}n=a.getIndex(e),n=Math.max(0,i-(n<i?1:0)),t.add(a,e,n)}},mxPartitionLayout.prototype.execute=function(e){var n=this.isHorizontal(),t=this.graph.getModel(),a=t.getGeometry(e);if(null!=this.graph.container&&(null==a&&t.isLayer(e)||e==this.graph.getView().currentRoot)&&(a=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),null!=a){for(var i=[],s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o);!this.isVertexIgnored(r)&&this.isVertexMovable(r)&&i.push(r)}if(0<(s=i.length)){var l=this.border,d=this.border,c=(c=n?a.height:a.width)-2*this.border;if(e=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle,c-=n?e.height:e.width,l+=e.width,d+=e.height,e=this.border+(s-1)*this.spacing,0<(a=n?(a.width-l-e)/s:(a.height-d-e)/s)){t.beginUpdate();try{for(o=0;o<s;o++){r=i[o];var m=t.getGeometry(r);null!=m&&((m=m.clone()).x=l,m.y=d,n?(this.resizeVertices&&(m.width=a,m.height=c),l+=a+this.spacing):(this.resizeVertices&&(m.height=a,m.width=c),d+=a+this.spacing),t.setGeometry(r,m))}}finally{t.endUpdate()}}}}},mxCompactTreeLayout.prototype=new mxGraphLayout,mxCompactTreeLayout.prototype.constructor=mxCompactTreeLayout,mxCompactTreeLayout.prototype.horizontal=null,mxCompactTreeLayout.prototype.invert=null,mxCompactTreeLayout.prototype.resizeParent=!0,mxCompactTreeLayout.prototype.groupPadding=10,mxCompactTreeLayout.prototype.parentsChanged=null,mxCompactTreeLayout.prototype.moveTree=!1,mxCompactTreeLayout.prototype.levelDistance=10,mxCompactTreeLayout.prototype.nodeDistance=20,mxCompactTreeLayout.prototype.resetEdges=!0,mxCompactTreeLayout.prototype.prefHozEdgeSep=5,mxCompactTreeLayout.prototype.prefVertEdgeOff=4,mxCompactTreeLayout.prototype.minEdgeJetty=8,mxCompactTreeLayout.prototype.channelBuffer=4,mxCompactTreeLayout.prototype.edgeRouting=!0,mxCompactTreeLayout.prototype.isVertexIgnored=function(e){return mxGraphLayout.prototype.isVertexIgnored.apply(this,arguments)||0==this.graph.getConnections(e).length},mxCompactTreeLayout.prototype.isHorizontal=function(){return this.horizontal},mxCompactTreeLayout.prototype.execute=function(e,n){this.parent=e;var t=this.graph.getModel();if(null==n)if(0<this.graph.getEdges(e,t.getParent(e),this.invert,!this.invert,!1).length)n=e;else{if(0<(o=this.graph.findTreeRoots(e,!0,this.invert)).length)for(var a=0;a<o.length;a++)if(!this.isVertexIgnored(o[a])&&0<this.graph.getEdges(o[a],null,this.invert,!this.invert,!1).length){n=o[a];break}}if(null!=n){this.parentsChanged=this.resizeParent?{}:null,t.beginUpdate();try{var i=this.dfs(n,e);if(null!=i){this.layout(i);var s=this.graph.gridSize,o=s;if(!this.moveTree){var r=this.getVertexBounds(n);null!=r&&(s=r.x,o=r.y)}if((r=null)!=(r=this.isHorizontal()?this.horizontalLayout(i,s,o):this.verticalLayout(i,null,s,o))){var l=a=0;r.x<0&&(a=Math.abs(s-r.x)),r.y<0&&(l=Math.abs(o-r.y)),(0!=a||0!=l)&&this.moveNode(i,a,l),this.resizeParent&&this.adjustParents(),this.edgeRouting&&this.localEdgeProcessing(i)}}}finally{t.endUpdate()}}},mxCompactTreeLayout.prototype.moveNode=function(e,n,t){for(e.x+=n,e.y+=t,this.apply(e),e=e.child;null!=e;)this.moveNode(e,n,t),e=e.next},mxCompactTreeLayout.prototype.dfs=function(e,n,t){t=null!=t?t:[];var a=mxCellPath.create(e),i=null;if(null!=e&&null==t[a]&&!this.isVertexIgnored(e)){t[a]=e;i=this.createNode(e),a=this.graph.getModel();var s=null;e=this.graph.getEdges(e,n,this.invert,!this.invert,!1,!0);for(var o=this.graph.getView(),r=0;r<e.length;r++){var l=e[r];if(!this.isEdgeIgnored(l)){this.resetEdges&&this.setEdgePoints(l,null),this.edgeRouting&&(this.setEdgeStyleEnabled(l,!1),this.setEdgePoints(l,null));var d;l=null!=(d=o.getState(l))?d.getVisibleTerminal(this.invert):o.getVisibleTerminal(l,this.invert);null!=(d=this.dfs(l,n,t))&&null!=a.getGeometry(l)&&(null==s?i.child=d:s.next=d,s=d)}}}return i},mxCompactTreeLayout.prototype.layout=function(e){if(null!=e){for(var n=e.child;null!=n;)this.layout(n),n=n.next;null!=e.child?this.attachParent(e,this.join(e)):this.layoutLeaf(e)}},mxCompactTreeLayout.prototype.horizontalLayout=function(e,n,t,a){if(e.x+=n+e.offsetX,e.y+=t+e.offsetY,a=this.apply(e,a),null!=(n=e.child)){a=this.horizontalLayout(n,e.x,e.y,a),t=e.y+n.offsetY;for(var i=n.next;null!=i;)a=this.horizontalLayout(i,e.x+n.offsetX,t,a),t+=i.offsetY,i=i.next}return a},mxCompactTreeLayout.prototype.verticalLayout=function(e,n,t,a,i){if(e.x+=t+e.offsetY,e.y+=a+e.offsetX,i=this.apply(e,i),null!=(n=e.child))for(i=this.verticalLayout(n,e,e.x,e.y,i),t=e.x+n.offsetY,a=n.next;null!=a;)i=this.verticalLayout(a,e,t,e.y+n.offsetX,i),t+=a.offsetY,a=a.next;return i},mxCompactTreeLayout.prototype.attachParent=function(e,n){var t=this.nodeDistance+this.levelDistance,a=(n-e.width)/2-this.nodeDistance,i=a+e.width+2*this.nodeDistance-n;e.child.offsetX=t+e.height,e.child.offsetY=i,e.contour.upperHead=this.createLine(e.height,0,this.createLine(t,i,e.contour.upperHead)),e.contour.lowerHead=this.createLine(e.height,0,this.createLine(t,a,e.contour.lowerHead))},mxCompactTreeLayout.prototype.layoutLeaf=function(e){var n=2*this.nodeDistance;e.contour.upperTail=this.createLine(e.height+n,0),e.contour.upperHead=e.contour.upperTail,e.contour.lowerTail=this.createLine(0,-e.width-n),e.contour.lowerHead=this.createLine(e.height+n,0,e.contour.lowerTail)},mxCompactTreeLayout.prototype.join=function(e){var n=2*this.nodeDistance,t=e.child;e.contour=t.contour;var a=t.width+n,i=a;for(t=t.next;null!=t;){var s=this.merge(e.contour,t.contour);t.offsetY=s+a,t.offsetX=0,i+=s+(a=t.width+n),t=t.next}return i},mxCompactTreeLayout.prototype.merge=function(e,n){for(var t=0,a=0,i=0,s=e.lowerHead,o=n.upperHead;null!=o&&null!=s;){var r=this.offset(t,a,o.dx,o.dy,s.dx,s.dy);a=a+r,i=i+r;t+o.dx<=s.dx?(t+=o.dx,a+=o.dy,o=o.next):(t-=s.dx,a-=s.dy,s=s.next)}return null!=o?(t=this.bridge(e.upperTail,0,0,o,t,a),e.upperTail=null!=t.next?n.upperTail:t,e.lowerTail=n.lowerTail):null==(t=this.bridge(n.lowerTail,t,a,s,0,0)).next&&(e.lowerTail=t),e.lowerHead=n.lowerHead,i},mxCompactTreeLayout.prototype.offset=function(e,n,t,a,i,s){var o;return i<=e||e+t<=0?0:0<(o=0<i*a-t*s?e<0?e*a/t-n:0<e?e*s/i-n:-n:i<e+t?s-(n+(i-e)*a/t):e+t<i?(t+e)*s/i-(n+a):s-(n+a))?o:0},mxCompactTreeLayout.prototype.bridge=function(e,n,t,a,i,s){return n=i+a.dx-n,i=i=0,0==a.dx?i=a.dy:(i=n*a.dy,i/=a.dx),n=this.createLine(n,i,a.next),e.next=this.createLine(0,s+a.dy-i-t,n),n},mxCompactTreeLayout.prototype.createNode=function(e){var n={};return n.cell=e,n.x=0,n.y=0,n.width=0,n.height=0,null!=(e=this.getVertexBounds(e))&&(this.isHorizontal()?(n.width=e.height,n.height=e.width):(n.width=e.width,n.height=e.height)),n.offsetX=0,n.offsetY=0,n.contour={},n},mxCompactTreeLayout.prototype.apply=function(e,n){var t=this.graph.getModel(),a=e.cell,i=t.getGeometry(a);return null!=a&&null!=i&&(this.isVertexMovable(a)&&(i=this.setVertexLocation(a,e.x,e.y),this.resizeParent&&(t=t.getParent(a),a=mxCellPath.create(t),null==this.parentsChanged[a]&&(this.parentsChanged[a]=t))),n=null==n?new mxRectangle(i.x,i.y,i.width,i.height):new mxRectangle(Math.min(n.x,i.x),Math.min(n.y,i.y),Math.max(n.x+n.width,i.x+i.width),Math.max(n.y+n.height,i.y+i.height))),n},mxCompactTreeLayout.prototype.createLine=function(e,n,t){var a={};return a.dx=e,a.dy=n,a.next=t,a},mxCompactTreeLayout.prototype.adjustParents=function(){var e,n=[];for(e in this.parentsChanged)n.push(this.parentsChanged[e]);this.arrangeGroups(mxUtils.sortCells(n,!0),this.groupPadding)},mxCompactTreeLayout.prototype.localEdgeProcessing=function(e){for(this.processNodeOutgoing(e),e=e.child;null!=e;)this.localEdgeProcessing(e),e=e.next},mxCompactTreeLayout.prototype.processNodeOutgoing=function(e){for(var n=e.child,t=e.cell,a=0,i=[];null!=n;){a++;var s=n.x;this.horizontal&&(s=n.y),i.push(new WeightedCellSorter(n,s)),n=n.next}i.sort(WeightedCellSorter.prototype.compare),(s=e.width)>(o=(a+1)*this.prefHozEdgeSep)+2*this.prefHozEdgeSep&&(s-=2*this.prefHozEdgeSep),n=(e=s/a)/2,s>o+2*this.prefHozEdgeSep&&(n+=this.prefHozEdgeSep);s=this.minEdgeJetty-this.prefVertEdgeOff;for(var o=0,r=this.getVertexBounds(t),l=0;l<i.length;l++){for(var d=i[l].cell.cell,c=this.getVertexBounds(d),m=(d=this.graph.getEdgesBetween(t,d,!1),[]),u=0,p=0,g=0;g<d.length;g++)this.horizontal?(u=r.x+r.width,p=r.y+n,m.push(new mxPoint(u,p)),u=r.x+r.width+s,m.push(new mxPoint(u,p)),p=c.y+c.height/2):(u=r.x+n,p=r.y+r.height,m.push(new mxPoint(u,p)),p=r.y+r.height+s,m.push(new mxPoint(u,p)),u=c.x+c.width/2),m.push(new mxPoint(u,p)),this.setEdgePoints(d[g],m);l<a/2?s+=this.prefVertEdgeOff:a/2<l&&(s-=this.prefVertEdgeOff),n+=e,o=Math.max(o,s)}},WeightedCellSorter.prototype.weightedValue=0,WeightedCellSorter.prototype.nudge=!1,WeightedCellSorter.prototype.visited=!1,WeightedCellSorter.prototype.rankIndex=null,WeightedCellSorter.prototype.cell=null,WeightedCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.weightedValue>e.weightedValue?1:n.weightedValue<e.weightedValue?-1:n.nudge?1:-1:0},mxFastOrganicLayout.prototype=new mxGraphLayout,mxFastOrganicLayout.prototype.constructor=mxFastOrganicLayout,mxFastOrganicLayout.prototype.useInputOrigin=!0,mxFastOrganicLayout.prototype.resetEdges=!0,mxFastOrganicLayout.prototype.disableEdgeStyle=!0,mxFastOrganicLayout.prototype.forceConstant=50,mxFastOrganicLayout.prototype.forceConstantSquared=0,mxFastOrganicLayout.prototype.minDistanceLimit=2,mxFastOrganicLayout.prototype.maxDistanceLimit=500,mxFastOrganicLayout.prototype.minDistanceLimitSquared=4,mxFastOrganicLayout.prototype.initialTemp=200,mxFastOrganicLayout.prototype.temperature=0,mxFastOrganicLayout.prototype.maxIterations=0,mxFastOrganicLayout.prototype.iteration=0,mxFastOrganicLayout.prototype.allowedToRun=!0,mxFastOrganicLayout.prototype.isVertexIgnored=function(e){return mxGraphLayout.prototype.isVertexIgnored.apply(this,arguments)||0==this.graph.getConnections(e).length},mxFastOrganicLayout.prototype.execute=function(e){var n=this.graph.getModel();this.vertexArray=[];for(var t=this.graph.getChildVertices(e),a=0;a<t.length;a++)this.isVertexIgnored(t[a])||this.vertexArray.push(t[a]);var i=this.useInputOrigin?this.graph.view.getBounds(this.vertexArray):null,s=this.vertexArray.length;for(this.indices=[],this.dispX=[],this.dispY=[],this.cellLocation=[],this.isMoveable=[],this.neighbours=[],this.radius=[],this.radiusSquared=[],this.forceConstant<.001&&(this.forceConstant=.001),this.forceConstantSquared=this.forceConstant*this.forceConstant,a=0;a<this.vertexArray.length;a++){var o=this.vertexArray[a];this.cellLocation[a]=[];var r=mxCellPath.create(o);this.indices[r]=a;var l=this.getVertexBounds(o),d=l.width,c=l.height,m=l.x,u=l.y;this.cellLocation[a][0]=m+d/2,this.cellLocation[a][1]=u+c/2,this.radius[a]=Math.min(d,c),this.radiusSquared[a]=this.radius[a]*this.radius[a]}n.beginUpdate();try{for(a=0;a<s;a++){this.dispX[a]=0,this.dispY[a]=0,this.isMoveable[a]=this.isVertexMovable(this.vertexArray[a]);var p=this.graph.getConnections(this.vertexArray[a],e);t=this.graph.getOpposites(p,this.vertexArray[a]);for(this.neighbours[a]=[],d=0;d<t.length;d++){this.resetEdges&&this.graph.resetEdge(p[d]),this.disableEdgeStyle&&this.setEdgeStyleEnabled(p[d],!1);r=mxCellPath.create(t[d]);var g=this.indices[r];this.neighbours[a][d]=null!=g?g:a}}for(this.temperature=this.initialTemp,0==this.maxIterations&&(this.maxIterations=20*Math.sqrt(s)),this.iteration=0;this.iteration<this.maxIterations;this.iteration++){if(!this.allowedToRun)return;this.calcRepulsion(),this.calcAttraction(),this.calcPositions(),this.reduceTemperature()}for(e=t=null,a=0;a<this.vertexArray.length;a++)o=this.vertexArray[a],this.isVertexMovable(o)&&(null!=(l=this.getVertexBounds(o))&&(this.cellLocation[a][0]-=l.width/2,this.cellLocation[a][1]-=l.height/2,m=this.graph.snap(this.cellLocation[a][0]),u=this.graph.snap(this.cellLocation[a][1]),this.setVertexLocation(o,m,u),t=null==t?m:Math.min(t,m),e=null==e?u:Math.min(e,u)));a=1-(t||0),o=1-(e||0),null!=i&&(a+=i.x,o+=i.y),this.graph.moveCells(this.vertexArray,a,o)}finally{n.endUpdate()}},mxFastOrganicLayout.prototype.calcPositions=function(){for(var e=0;e<this.vertexArray.length;e++)if(this.isMoveable[e]){(t=Math.sqrt(this.dispX[e]*this.dispX[e]+this.dispY[e]*this.dispY[e]))<.001&&(t=.001);var n=this.dispX[e]/t*Math.min(t,this.temperature),t=this.dispY[e]/t*Math.min(t,this.temperature);this.dispX[e]=0,this.dispY[e]=0,this.cellLocation[e][0]+=n,this.cellLocation[e][1]+=t}},mxFastOrganicLayout.prototype.calcAttraction=function(){for(var e=0;e<this.vertexArray.length;e++)for(var n=0;n<this.neighbours[e].length;n++){var t=this.neighbours[e][n];if(e!=t&&this.isMoveable[e]&&this.isMoveable[t]){(a=(s=this.cellLocation[e][0]-this.cellLocation[t][0])*s+(o=this.cellLocation[e][1]-this.cellLocation[t][1])*o-this.radiusSquared[e]-this.radiusSquared[t])<this.minDistanceLimitSquared&&(a=this.minDistanceLimitSquared);var a,i=Math.sqrt(a),s=s/i*(a=a/this.forceConstant),o=o/i*a;this.dispX[e]-=s,this.dispY[e]-=o,this.dispX[t]+=s,this.dispY[t]+=o}}},mxFastOrganicLayout.prototype.calcRepulsion=function(){for(var e=this.vertexArray.length,n=0;n<e;n++)for(var t=n;t<e;t++){if(!this.allowedToRun)return;if(t!=n&&this.isMoveable[n]&&this.isMoveable[t]){var a=this.cellLocation[n][0]-this.cellLocation[t][0],i=this.cellLocation[n][1]-this.cellLocation[t][1];0==a&&(a=.01+Math.random()),0==i&&(i=.01+Math.random());var s=Math.sqrt(a*a+i*i),o=s-this.radius[n]-this.radius[t];o>this.maxDistanceLimit||(o<this.minDistanceLimit&&(o=this.minDistanceLimit),a=a/s*(o=this.forceConstantSquared/o),i=i/s*o,this.dispX[n]+=a,this.dispY[n]+=i,this.dispX[t]-=a,this.dispY[t]-=i)}}},mxFastOrganicLayout.prototype.reduceTemperature=function(){this.temperature=this.initialTemp*(1-this.iteration/this.maxIterations)},mxCircleLayout.prototype=new mxGraphLayout,mxCircleLayout.prototype.constructor=mxCircleLayout,mxCircleLayout.prototype.radius=null,mxCircleLayout.prototype.moveCircle=!1,mxCircleLayout.prototype.x0=0,mxCircleLayout.prototype.y0=0,mxCircleLayout.prototype.resetEdges=!0,mxCircleLayout.prototype.disableEdgeStyle=!0,mxCircleLayout.prototype.execute=function(e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0,a=null,i=null,s=[],o=n.getChildCount(e),r=0;r<o;r++){var l=n.getChildAt(e,r);if(this.isVertexIgnored(l))this.isEdgeIgnored(l)||(this.resetEdges&&this.graph.resetEdge(l),this.disableEdgeStyle&&this.setEdgeStyleEnabled(l,!1));else{s.push(l);var d=this.getVertexBounds(l);a=null==a?d.y:Math.min(a,d.y),i=null==i?d.x:Math.min(i,d.x),t=Math.max(t,Math.max(d.width,d.height))}}var c=this.getRadius(s.length,t);this.moveCircle&&(i=this.x0,a=this.y0),this.circle(s,c,i,a)}finally{n.endUpdate()}},mxCircleLayout.prototype.getRadius=function(e,n){return Math.max(e*n/Math.PI,this.radius)},mxCircleLayout.prototype.circle=function(e,n,t,a){for(var i=e.length,s=2*Math.PI/i,o=0;o<i;o++)this.isVertexMovable(e[o])&&this.setVertexLocation(e[o],t+n+n*Math.sin(o*s),a+n+n*Math.cos(o*s))},mxParallelEdgeLayout.prototype=new mxGraphLayout,mxParallelEdgeLayout.prototype.constructor=mxParallelEdgeLayout,mxParallelEdgeLayout.prototype.spacing=20,mxParallelEdgeLayout.prototype.execute=function(e){e=this.findParallels(e),this.graph.model.beginUpdate();try{for(var n in e){var t=e[n];1<t.length&&this.layout(t)}}finally{this.graph.model.endUpdate()}},mxParallelEdgeLayout.prototype.findParallels=function(e){for(var n=this.graph.getModel(),t=[],a=n.getChildCount(e),i=0;i<a;i++){var s=n.getChildAt(e,i);if(!this.isEdgeIgnored(s)){var o=this.getEdgeId(s);null!=o&&(null==t[o]&&(t[o]=[]),t[o].push(s))}}return t},mxParallelEdgeLayout.prototype.getEdgeId=function(e){var n=this.graph.getView(),t=n.getState(e),a=null!=t?t.getVisibleTerminal(!0):n.getVisibleTerminal(e,!0);return e=null!=t?t.getVisibleTerminal(!1):n.getVisibleTerminal(e,!1),null!=a&&null!=e?(a=mxCellPath.create(a),(e=mxCellPath.create(e))<a?e+"-"+a:a+"-"+e):null},mxParallelEdgeLayout.prototype.layout=function(e){var n=e[0];if((o=(t=this.graph.getModel()).getGeometry(t.getTerminal(n,!0)))==(s=t.getGeometry(t.getTerminal(n,!1)))){n=o.x+o.width+this.spacing;for(var t=o.y+o.height/2,a=0;a<e.length;a++)this.route(e[a],n,t),n+=this.spacing}else if(null!=o&&null!=s){n=o.x+o.width/2,t=o.y+o.height/2,a=s.x+s.width/2-n;var i=s.y+s.height/2-t,s=Math.sqrt(a*a+i*i),o=i*this.spacing/s;for(s=a*this.spacing/s,n=n+a/2+o*(e.length-1)/2,t=t+i/2-s*(e.length-1)/2,a=0;a<e.length;a++)this.route(e[a],n,t),n-=o,t+=s}},mxParallelEdgeLayout.prototype.route=function(e,n,t){this.graph.isCellMovable(e)&&this.setEdgePoints(e,[new mxPoint(n,t)])},mxCompositeLayout.prototype=new mxGraphLayout,mxCompositeLayout.prototype.constructor=mxCompositeLayout,mxCompositeLayout.prototype.layouts=null,mxCompositeLayout.prototype.master=null,mxCompositeLayout.prototype.moveCell=function(e,n,t){null!=this.master?this.master.move.apply(this.master,arguments):this.layouts[0].move.apply(this.layouts[0],arguments)},mxCompositeLayout.prototype.execute=function(e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0;t<this.layouts.length;t++)this.layouts[t].execute.apply(this.layouts[t],arguments)}finally{n.endUpdate()}},mxEdgeLabelLayout.prototype=new mxGraphLayout,mxEdgeLabelLayout.prototype.constructor=mxEdgeLabelLayout,mxEdgeLabelLayout.prototype.execute=function(e){for(var n=this.graph.view,t=this.graph.getModel(),a=[],i=[],s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o),l=n.getState(r);null!=l&&(this.isVertexIgnored(r)?this.isEdgeIgnored(r)||a.push(l):i.push(l))}this.placeLabels(i,a)},mxEdgeLabelLayout.prototype.placeLabels=function(e,n){var t=this.graph.getModel();t.beginUpdate();try{for(var a=0;a<n.length;a++){var i=n[a];if(null!=i&&null!=i.text&&null!=i.text.boundingBox)for(var s=0;s<e.length;s++){var o=e[s];null!=o&&this.avoid(i,o)}}}finally{t.endUpdate()}},mxEdgeLabelLayout.prototype.avoid=function(e,n){var t=this.graph.getModel(),a=e.text.boundingBox;if(mxUtils.intersects(a,n)){var i=-a.y-a.height+n.y,s=-a.y+n.y+n.height;i=Math.abs(i)<Math.abs(s)?i:s,s=-a.x-a.width+n.x,a=-a.x+n.x+n.width,a=Math.abs(s)<Math.abs(a)?s:a;Math.abs(a)<Math.abs(i)?i=0:a=0,null!=(s=t.getGeometry(e.cell))&&(null!=(s=s.clone()).offset?(s.offset.x+=a,s.offset.y+=i):s.offset=new mxPoint(a,i),t.setGeometry(e.cell,s))}},mxGraphAbstractHierarchyCell.prototype.maxRank=-1,mxGraphAbstractHierarchyCell.prototype.minRank=-1,mxGraphAbstractHierarchyCell.prototype.x=null,mxGraphAbstractHierarchyCell.prototype.y=null,mxGraphAbstractHierarchyCell.prototype.width=0,mxGraphAbstractHierarchyCell.prototype.height=0,mxGraphAbstractHierarchyCell.prototype.nextLayerConnectedCells=null,mxGraphAbstractHierarchyCell.prototype.previousLayerConnectedCells=null,mxGraphAbstractHierarchyCell.prototype.temp=null,mxGraphAbstractHierarchyCell.prototype.getNextLayerConnectedCells=function(e){return null},mxGraphAbstractHierarchyCell.prototype.getPreviousLayerConnectedCells=function(e){return null},mxGraphAbstractHierarchyCell.prototype.isEdge=function(){return!1},mxGraphAbstractHierarchyCell.prototype.isVertex=function(){return!1},mxGraphAbstractHierarchyCell.prototype.getGeneralPurposeVariable=function(e){return null},mxGraphAbstractHierarchyCell.prototype.setGeneralPurposeVariable=function(e,n){return null},mxGraphAbstractHierarchyCell.prototype.setX=function(e,n){this.isVertex()?this.x[0]=n:this.isEdge()&&(this.x[e-this.minRank-1]=n)},mxGraphAbstractHierarchyCell.prototype.getX=function(e){return this.isVertex()?this.x[0]:this.isEdge()?this.x[e-this.minRank-1]:0},mxGraphAbstractHierarchyCell.prototype.setY=function(e,n){this.isVertex()?this.y[0]=n:this.isEdge()&&(this.y[e-this.minRank-1]=n)},mxGraphHierarchyNode.prototype=new mxGraphAbstractHierarchyCell,mxGraphHierarchyNode.prototype.constructor=mxGraphHierarchyNode,mxGraphHierarchyNode.prototype.cell=null,mxGraphHierarchyNode.prototype.connectsAsTarget=[],mxGraphHierarchyNode.prototype.connectsAsSource=[],mxGraphHierarchyNode.prototype.hashCode=!1,mxGraphHierarchyNode.prototype.getRankValue=function(e){return this.maxRank},mxGraphHierarchyNode.prototype.getNextLayerConnectedCells=function(e){if(null==this.nextLayerConnectedCells){this.nextLayerConnectedCells=[],this.nextLayerConnectedCells[0]=[];for(var n=0;n<this.connectsAsTarget.length;n++){var t=this.connectsAsTarget[n];-1==t.maxRank||t.maxRank==e+1?this.nextLayerConnectedCells[0].push(t.source):this.nextLayerConnectedCells[0].push(t)}}return this.nextLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[],this.previousLayerConnectedCells[0]=[];for(var n=0;n<this.connectsAsSource.length;n++){var t=this.connectsAsSource[n];-1==t.minRank||t.minRank==e-1?this.previousLayerConnectedCells[0].push(t.target):this.previousLayerConnectedCells[0].push(t)}}return this.previousLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.isVertex=function(){return!0},mxGraphHierarchyNode.prototype.getGeneralPurposeVariable=function(e){return this.temp[0]},mxGraphHierarchyNode.prototype.setGeneralPurposeVariable=function(e,n){this.temp[0]=n},mxGraphHierarchyNode.prototype.isAncestor=function(e){if(null!=e&&null!=this.hashCode&&null!=e.hashCode&&this.hashCode.length<e.hashCode.length){if(this.hashCode==e.hashCode)return!0;if(null==this.hashCode||null==this.hashCode)return!1;for(var n=0;n<this.hashCode.length;n++)if(this.hashCode[n]!=e.hashCode[n])return!1;return!0}return!1},mxGraphHierarchyNode.prototype.getCoreCell=function(){return this.cell},mxGraphHierarchyEdge.prototype=new mxGraphAbstractHierarchyCell,mxGraphHierarchyEdge.prototype.constructor=mxGraphHierarchyEdge,mxGraphHierarchyEdge.prototype.edges=null,mxGraphHierarchyEdge.prototype.source=null,mxGraphHierarchyEdge.prototype.target=null,mxGraphHierarchyEdge.prototype.isReversed=!1,mxGraphHierarchyEdge.prototype.invert=function(e){e=this.source,this.source=this.target,this.target=e,this.isReversed=!this.isReversed},mxGraphHierarchyEdge.prototype.getNextLayerConnectedCells=function(e){if(null==this.nextLayerConnectedCells){this.nextLayerConnectedCells=[];for(var n=0;n<this.temp.length;n++)this.nextLayerConnectedCells[n]=[],n==this.temp.length-1?this.nextLayerConnectedCells[n].push(this.source):this.nextLayerConnectedCells[n].push(this)}return this.nextLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[];for(var n=0;n<this.temp.length;n++)this.previousLayerConnectedCells[n]=[],0==n?this.previousLayerConnectedCells[n].push(this.target):this.previousLayerConnectedCells[n].push(this)}return this.previousLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.isEdge=function(){return!0},mxGraphHierarchyEdge.prototype.getGeneralPurposeVariable=function(e){return this.temp[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.setGeneralPurposeVariable=function(e,n){this.temp[e-this.minRank-1]=n},mxGraphHierarchyEdge.prototype.getCoreCell=function(){return null!=this.edges&&0<this.edges.length?this.edges[0]:null},mxGraphHierarchyModel.prototype.maxRank=null,mxGraphHierarchyModel.prototype.vertexMapper=null,mxGraphHierarchyModel.prototype.edgeMapper=null,mxGraphHierarchyModel.prototype.ranks=null,mxGraphHierarchyModel.prototype.roots=null,mxGraphHierarchyModel.prototype.parent=null,mxGraphHierarchyModel.prototype.dfsCount=0,mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK=1e8,mxGraphHierarchyModel.prototype.tightenToSource=!1,mxGraphHierarchyModel.prototype.createInternalCells=function(e,n,t){for(var a=e.getGraph(),i=0;i<n.length;i++){t[i]=new mxGraphHierarchyNode(n[i]);var s=mxCellPath.create(n[i]);this.vertexMapper[s]=t[i],s=e.getEdges(n[i]),t[i].connectsAsSource=[];for(var o=0;o<s.length;o++){if((d=e.getVisibleTerminal(s[o],!1))!=n[i]&&d!=n[i]&&e.graph.model.isVertex(d)&&!e.isVertexIgnored(d)){var r=e.getEdgesBetween(n[i],d,!1),l=e.getEdgesBetween(n[i],d,!0),d=mxCellPath.create(r[0]);if(null!=r&&0<r.length&&null==this.edgeMapper[d]&&2*l.length>=r.length){l=new mxGraphHierarchyEdge(r);for(var c=0;c<r.length;c++){var m=r[c];d=mxCellPath.create(m);this.edgeMapper[d]=l,a.resetEdge(m),e.disableEdgeStyle&&(e.setEdgeStyleEnabled(m,!1),e.setOrthogonalEdge(m,!0))}l.source=t[i],mxUtils.indexOf(t[i].connectsAsSource,l)<0&&t[i].connectsAsSource.push(l)}}}t[i].temp[0]=0}},mxGraphHierarchyModel.prototype.initialRank=function(){var e=[];if(null!=this.roots)for(var n=0;n<this.roots.length;n++){var t=mxCellPath.create(this.roots[n]);null!=(t=this.vertexMapper[t])&&e.push(t)}for(var a in this.vertexMapper)(t=this.vertexMapper[a]).temp[0]=-1;for(var i=e.slice();0<e.length;){var s,o;s=(t=e[0]).connectsAsTarget,o=t.connectsAsSource;var r=!0,l=this.SOURCESCANSTARTRANK;for(n=0;n<s.length;n++){var d=s[n];if(5270620!=d.temp[0]){r=!1;break}d=d.source,l=Math.min(l,d.temp[0]-1)}if(r){if(t.temp[0]=l,this.maxRank=Math.min(this.maxRank,l),null!=o)for(n=0;n<o.length;n++)(d=o[n]).temp[0]=5270620,-1==(d=d.target).temp[0]&&(e.push(d),d.temp[0]=-2);e.shift()}else if(n=e.shift(),e.push(t),n==t&&1==e.length)break}for(a in this.vertexMapper)(t=this.vertexMapper[a]).temp[0]-=this.maxRank;for(n=0;n<i.length;n++)for(e=0,s=(t=i[n]).connectsAsSource,a=0;a<s.length;a++)d=(d=s[a]).target,t.temp[0]=Math.max(e,d.temp[0]+1),e=t.temp[0];this.maxRank=this.SOURCESCANSTARTRANK-this.maxRank},mxGraphHierarchyModel.prototype.fixRanks=function(){var s=[];this.ranks=[];for(var e=0;e<this.maxRank+1;e++)s[e]=[],this.ranks[e]=s[e];var n=null;if(null!=this.roots){var t=this.roots;for(n=[],e=0;e<t.length;e++){var a=mxCellPath.create(t[e]);n[e]=this.vertexMapper[a]}}this.visit(function(e,n,t,a,i){if(0==i&&n.maxRank<0&&n.minRank<0&&(s[n.temp[0]].push(n),n.maxRank=n.temp[0],n.minRank=n.temp[0],n.temp[0]=s[n.maxRank].length-1),null!=e&&null!=t&&1<e.maxRank-n.maxRank)for(t.maxRank=e.maxRank,t.minRank=n.maxRank,t.temp=[],t.x=[],t.y=[],e=t.minRank+1;e<t.maxRank;e++)s[e].push(t),t.setGeneralPurposeVariable(e,s[e].length-1)},n,!1,null)},mxGraphHierarchyModel.prototype.visit=function(e,n,t,a){if(null!=n){for(var i=0;i<n.length;i++){var s=n[i];null!=s&&(null==a&&(a={}),t?(s.hashCode=[],s.hashCode[0]=this.dfsCount,s.hashCode[1]=i,this.extendedDfs(null,s,null,e,a,s.hashCode,i,0)):this.dfs(null,s,null,e,a,0))}this.dfsCount++}},mxGraphHierarchyModel.prototype.dfs=function(e,n,t,a,i,s){if(null!=n){var o=mxCellPath.create(n.cell);if(null==i[o])for(a(e,i[o]=n,t,s,0),e=n.connectsAsSource.slice(),t=0;t<e.length;t++)o=e[t],this.dfs(n,o.target,o,a,i,s+1);else a(e,n,t,s,1)}},mxGraphHierarchyModel.prototype.extendedDfs=function(e,n,t,a,i,s,o,r){if(null!=n)if(null==e||null!=n.hashCode&&n.hashCode[0]==e.hashCode[0]||(s=e.hashCode.length+1,n.hashCode=e.hashCode.slice(),n.hashCode[s-1]=o),null==i[o=mxCellPath.create(n.cell)])for(a(e,i[o]=n,t,r,0),e=n.connectsAsSource.slice(),t=0;t<e.length;t++)o=e[t],this.extendedDfs(n,o.target,o,a,i,n.hashCode,t,r+1);else a(e,n,t,r,1)},mxHierarchicalLayoutStage.prototype.execute=function(e){},mxMedianHybridCrossingReduction.prototype=new mxHierarchicalLayoutStage,mxMedianHybridCrossingReduction.prototype.constructor=mxMedianHybridCrossingReduction,mxMedianHybridCrossingReduction.prototype.layout=null,mxMedianHybridCrossingReduction.prototype.maxIterations=24,mxMedianHybridCrossingReduction.prototype.nestedBestRanks=null,mxMedianHybridCrossingReduction.prototype.currentBestCrossings=0,mxMedianHybridCrossingReduction.prototype.iterationsWithoutImprovement=0,mxMedianHybridCrossingReduction.prototype.maxNoImprovementIterations=2,mxMedianHybridCrossingReduction.prototype.execute=function(e){e=this.layout.getModel(),this.nestedBestRanks=[];for(var n=0;n<e.ranks.length;n++)this.nestedBestRanks[n]=e.ranks[n].slice();var t=0,a=this.calculateCrossings(e);for(n=0;n<this.maxIterations&&t<this.maxNoImprovementIterations;n++){this.weightedMedian(n,e),this.transpose(n,e);var i=this.calculateCrossings(e);if(i<a)for(a=i,i=t=0;i<this.nestedBestRanks.length;i++)for(var s=e.ranks[i],o=0;o<s.length;o++){var r=s[o];this.nestedBestRanks[i][r.getGeneralPurposeVariable(i)]=r}else for(t++,i=0;i<this.nestedBestRanks.length;i++)for(s=e.ranks[i],o=0;o<s.length;o++)(r=s[o]).setGeneralPurposeVariable(i,o);if(0==a)break}for(t=[],a=[],n=0;n<e.maxRank+1;n++)a[n]=[],t[n]=a[n];for(n=0;n<this.nestedBestRanks.length;n++)for(i=0;i<this.nestedBestRanks[n].length;i++)a[n].push(this.nestedBestRanks[n][i]);e.ranks=t},mxMedianHybridCrossingReduction.prototype.calculateCrossings=function(e){for(var n=e.ranks.length,t=0,a=1;a<n;a++)t+=this.calculateRankCrossing(a,e);return t},mxMedianHybridCrossingReduction.prototype.calculateRankCrossing=function(e,n){for(var t=0,a=n.ranks[e],i=a.length,s=n.ranks[e-1].length,o=[],r=0;r<i;r++)o[r]=[];for(r=0;r<a.length;r++)for(var l=(c=a[r]).getGeneralPurposeVariable(e),d=c.getPreviousLayerConnectedCells(e),c=0;c<d.length;c++){var m=d[c].getGeneralPurposeVariable(e-1);o[l][m]=201207}for(r=0;r<i;r++)for(c=0;c<s;c++)if(201207==o[r][c]){for(a=r+1;a<i;a++)for(l=0;l<c;l++)201207==o[a][l]&&t++;for(a=0;a<r;a++)for(l=c+1;l<s;l++)201207==o[a][l]&&t++}return t/2},mxMedianHybridCrossingReduction.prototype.transpose=function(e,n){for(var t=!0,a=0;t&&a++<10;)for(var i=1==e%2&&1==a%2,s=(t=!1,0);s<n.ranks.length;s++){for(var o=n.ranks[s],r=[],l=0;l<o.length;l++){(b=(f=o[l]).getGeneralPurposeVariable(s))<0&&(b=l),r[b]=f}var d=b=f=null,c=null,m=null,u=null,p=null,g=null,v=null,h=null;for(l=0;l<o.length-1;l++){if(0==l){for(var f=(v=r[l]).getNextLayerConnectedCells(s),b=v.getPreviousLayerConnectedCells(s),A=(m=[],u=[],0);A<f.length;A++)m[A]=f[A].getGeneralPurposeVariable(s+1);for(A=0;A<b.length;A++)u[A]=b[A].getGeneralPurposeVariable(s-1)}else f=d,b=c,m=p,u=g,v=h;for(d=(h=r[l+1]).getNextLayerConnectedCells(s),c=h.getPreviousLayerConnectedCells(s),p=[],g=[],A=0;A<d.length;A++)p[A]=d[A].getGeneralPurposeVariable(s+1);for(A=0;A<c.length;A++)g[A]=c[A].getGeneralPurposeVariable(s-1);var E=0,y=0;for(A=0;A<m.length;A++)for(var S=0;S<p.length;S++)m[A]>p[S]&&E++,m[A]<p[S]&&y++;for(A=0;A<u.length;A++)for(S=0;S<g.length;S++)u[A]>g[S]&&E++,u[A]<g[S]&&y++;(y<E||y==E&&i)&&(d=v.getGeneralPurposeVariable(s),v.setGeneralPurposeVariable(s,h.getGeneralPurposeVariable(s)),h.setGeneralPurposeVariable(s,d),d=f,c=b,p=m,g=u,h=v,i||(t=!0))}}},mxMedianHybridCrossingReduction.prototype.weightedMedian=function(e,n){var t=0==e%2;if(t)for(var a=n.maxRank-1;0<=a;a--)this.medianRank(a,t);else for(a=1;a<n.maxRank;a++)this.medianRank(a,t)},mxMedianHybridCrossingReduction.prototype.medianRank=function(e,n){for(var t=this.nestedBestRanks[e].length,a=[],i=[],s=0;s<t;s++){var o,r,l=this.nestedBestRanks[e][s],d=new MedianCellSorter;d.cell=l,r=n?e+1:e-1,null!=(o=n?l.getNextLayerConnectedCells(e):l.getPreviousLayerConnectedCells(e))&&0!=o.length?(d.medianValue=this.medianValue(o,r),a.push(d)):i[l.getGeneralPurposeVariable(e)]=!0}for(a.sort(MedianCellSorter.prototype.compare),s=0;s<t;s++)null==i[s]&&(l=a.shift().cell).setGeneralPurposeVariable(e,s)},mxMedianHybridCrossingReduction.prototype.medianValue=function(e,n){for(var t=[],a=0,i=0;i<e.length;i++){var s=e[i];t[a++]=s.getGeneralPurposeVariable(n)}return t.sort(function(e,n){return e-n}),1==a%2?t[Math.floor(a/2)]:2==a?(t[0]+t[1])/2:(s=t[(i=a/2)-1]-t[0],a=t[a-1]-t[i],(t[i-1]*a+t[i]*s)/(s+a))},MedianCellSorter.prototype.medianValue=0,MedianCellSorter.prototype.cell=!1,MedianCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.medianValue>e.medianValue?-1:n.medianValue<e.medianValue?1:0:0},mxMinimumCycleRemover.prototype=new mxHierarchicalLayoutStage,mxMinimumCycleRemover.prototype.constructor=mxMinimumCycleRemover,mxMinimumCycleRemover.prototype.layout=null,mxMinimumCycleRemover.prototype.execute=function(e){var n=this.layout.getModel(),s={},o=mxUtils.clone(n.vertexMapper,null,!0),t=null;if(null!=n.roots){var a=n.roots;t=[];for(e=0;e<a.length;e++){var i=mxCellPath.create(a[e]);t[e]=n.vertexMapper[i]}}if(n.visit(function(e,n,t,a,i){n.isAncestor(e)&&(t.invert(),mxUtils.remove(t,e.connectsAsSource),e.connectsAsTarget.push(t),mxUtils.remove(t,n.connectsAsTarget),n.connectsAsSource.push(t)),e=mxCellPath.create(n.cell),s[e]=n,delete o[e]},t,!0,null),t=null,0<o.lenth&&(t=mxUtils.clone(o,null,!0)),e=mxUtils.clone(s,null,!0),n.visit(function(e,n,t,a,i){n.isAncestor(e)&&(t.invert(),mxUtils.remove(t,e.connectsAsSource),n.connectsAsSource.push(t),e.connectsAsTarget.push(t),mxUtils.remove(t,n.connectsAsTarget)),e=mxCellPath.create(n.cell),s[e]=n,delete o[e]},o,!0,e),a=this.layout.getGraph(),null!=t&&0<t.length)for(n=n.roots,e=0;e<t.length;e++)i=t[e].cell,0==a.getIncomingEdges(i).length&&n.push(i)};var mxHierarchicalEdgeStyle={ORTHOGONAL:1,POLYLINE:2,STRAIGHT:3,CURVE:4};function WeightedCellSorter(e,n){this.cell=e,this.weightedValue=n}function mxHierarchicalLayout(e,n,t){mxGraphLayout.call(this,e),this.orientation=null!=n?n:mxConstants.DIRECTION_NORTH,this.deterministic=null==t||t}function mxGraphModel(e){this.currentEdit=this.createUndoableEdit(),null!=e?this.setRoot(e):this.clear()}function mxRootChange(e,n){this.model=e,this.previous=this.root=n}function mxChildChange(e,n,t,a){this.model=e,this.previous=this.parent=n,this.child=t,this.previousIndex=this.index=a}function mxTerminalChange(e,n,t,a){this.model=e,this.cell=n,this.previous=this.terminal=t,this.source=a}function mxValueChange(e,n,t){this.model=e,this.cell=n,this.previous=this.value=t}function mxStyleChange(e,n,t){this.model=e,this.cell=n,this.previous=this.style=t}function mxGeometryChange(e,n,t){this.model=e,this.cell=n,this.previous=this.geometry=t}function mxCollapseChange(e,n,t){this.model=e,this.cell=n,this.previous=this.collapsed=t}function mxVisibleChange(e,n,t){this.model=e,this.cell=n,this.previous=this.visible=t}function mxCellAttributeChange(e,n,t){this.cell=e,this.attribute=n,this.previous=this.value=t}function mxCell(e,n,t){this.value=e,this.setGeometry(n),this.setStyle(t),null!=this.onInit&&this.onInit()}function mxGeometry(e,n,t,a){mxRectangle.call(this,e,n,t,a)}mxCoordinateAssignment.prototype=new mxHierarchicalLayoutStage,mxCoordinateAssignment.prototype.constructor=mxCoordinateAssignment,mxCoordinateAssignment.prototype.layout=null,mxCoordinateAssignment.prototype.intraCellSpacing=30,mxCoordinateAssignment.prototype.interRankCellSpacing=100,mxCoordinateAssignment.prototype.parallelEdgeSpacing=10,mxCoordinateAssignment.prototype.maxIterations=8,mxCoordinateAssignment.prototype.prefHozEdgeSep=5,mxCoordinateAssignment.prototype.prefVertEdgeOff=2,mxCoordinateAssignment.prototype.minEdgeJetty=12,mxCoordinateAssignment.prototype.channelBuffer=4,mxCoordinateAssignment.prototype.jettyPositions=null,mxCoordinateAssignment.prototype.orientation=mxConstants.DIRECTION_NORTH,mxCoordinateAssignment.prototype.initialX=null,mxCoordinateAssignment.prototype.limitX=null,mxCoordinateAssignment.prototype.currentXDelta=null,mxCoordinateAssignment.prototype.widestRank=null,mxCoordinateAssignment.prototype.rankTopY=null,mxCoordinateAssignment.prototype.rankBottomY=null,mxCoordinateAssignment.prototype.widestRankValue=null,mxCoordinateAssignment.prototype.rankWidths=null,mxCoordinateAssignment.prototype.rankY=null,mxCoordinateAssignment.prototype.fineTuning=!0,mxCoordinateAssignment.prototype.edgeStyle=mxHierarchicalEdgeStyle.POLYLINE,mxCoordinateAssignment.prototype.nextLayerConnectedCache=null,mxCoordinateAssignment.prototype.previousLayerConnectedCache=null,mxCoordinateAssignment.prototype.groupPadding=10,mxCoordinateAssignment.prototype.printStatus=function(){var e=this.layout.getModel();mxLog.show(),mxLog.writeln("======Coord assignment debug=======");for(var n=0;n<e.ranks.length;n++){mxLog.write("Rank ",n," : ");for(var t=e.ranks[n],a=0;a<t.length;a++)mxLog.write(t[a].getGeneralPurposeVariable(n),"  ");mxLog.writeln()}mxLog.writeln("====================================")},mxCoordinateAssignment.prototype.execute=function(e){this.jettyPositions=[],e=this.layout.getModel(),this.currentXDelta=0,this.initialCoords(this.layout.getGraph(),e),this.fineTuning&&this.minNode(e);var n=1e8;if(this.fineTuning)for(var t=0;t<this.maxIterations;t++){if(0!=t&&(this.medianPos(t,e),this.minNode(e)),this.currentXDelta<n){for(var a=0;a<e.ranks.length;a++)for(var i=e.ranks[a],s=0;s<i.length;s++){var o=i[s];o.setX(a,o.getGeneralPurposeVariable(a))}n=this.currentXDelta}else for(a=0;a<e.ranks.length;a++)for(i=e.ranks[a],s=0;s<i.length;s++)(o=i[s]).setGeneralPurposeVariable(a,o.getX(a));this.minPath(this.layout.getGraph(),e),this.currentXDelta=0}this.setCellLocations(this.layout.getGraph(),e)},mxCoordinateAssignment.prototype.minNode=function(e){for(var n=[],t=[],a=[],i=0;i<=e.maxRank;i++){a[i]=e.ranks[i];for(var s=0;s<a[i].length;s++){var o=a[i][s];(r=new WeightedCellSorter(o,i)).rankIndex=s,r.visited=!0,n.push(r),t[o=mxCellPath.create(o.getCoreCell())]=r}}for(e=10*n.length,s=0;0<n.length&&s<=e;){i=(r=n.shift()).cell;var r,l=r.weightedValue,d=parseInt(r.rankIndex),c=(o=i.getNextLayerConnectedCells(l),i.getPreviousLayerConnectedCells(l)),m=o.length,u=c.length,p=this.medianXValue(o,l+1),g=this.medianXValue(c,l-1),v=m+u,h=i.getGeneralPurposeVariable(l),f=h;if(0<v&&(f=(p*m+g*u)/v),m=!1,f<h-1?0==d?(i.setGeneralPurposeVariable(l,f),m=!0):(h=(h=(d=a[l][d-1]).getGeneralPurposeVariable(l))+d.width/2+this.intraCellSpacing+i.width/2)<f?(i.setGeneralPurposeVariable(l,f),m=!0):h<i.getGeneralPurposeVariable(l)-1&&(i.setGeneralPurposeVariable(l,h),m=!0):h+1<f&&(d==a[l].length-1?(i.setGeneralPurposeVariable(l,f),m=!0):f<(h=(h=(d=a[l][d+1]).getGeneralPurposeVariable(l))-d.width/2-this.intraCellSpacing-i.width/2)?(i.setGeneralPurposeVariable(l,f),m=!0):h>i.getGeneralPurposeVariable(l)+1&&(i.setGeneralPurposeVariable(l,h),m=!0)),m){for(i=0;i<o.length;i++)l=o[i],null!=(l=t[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,n.push(l));for(i=0;i<c.length;i++)l=c[i],null!=(l=t[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,n.push(l))}r.visited=!1,s++}},mxCoordinateAssignment.prototype.medianPos=function(e,n){if(0==e%2)for(var t=n.maxRank;0<t;t--)this.rankMedianPosition(t-1,n,t);else for(t=0;t<n.maxRank-1;t++)this.rankMedianPosition(t+1,n,t)},mxCoordinateAssignment.prototype.rankMedianPosition=function(e,n,t){n=n.ranks[e];for(var a=[],i=[],s=0;s<n.length;s++){var o=n[s];a[s]=new WeightedCellSorter,a[s].cell=o,a[s].rankIndex=s;var r=mxCellPath.create(o.getCoreCell());i[r]=a[s];var l=null;l=t<e?o.getPreviousLayerConnectedCells(e):o.getNextLayerConnectedCells(e);a[s].weightedValue=this.calculatedWeightedValue(o,l)}for(a.sort(WeightedCellSorter.prototype.compare),s=0;s<a.length;s++){r=0,o=a[s].cell,r=0,null!=(l=t<e?o.getPreviousLayerConnectedCells(e).slice():o.getNextLayerConnectedCells(e).slice())&&(r=0<(r=l.length)?this.medianXValue(l,t):o.getGeneralPurposeVariable(e));for(var d=0,c=(l=-1e8,a[s].rankIndex-1);0<=c;){var m;if(null!=(m=i[m=mxCellPath.create(n[c].getCoreCell())])){var u=m.cell;m.visited?(l=u.getGeneralPurposeVariable(e)+u.width/2+this.intraCellSpacing+d+o.width/2,c=-1):(d+=u.width+this.intraCellSpacing,c--)}}for(d=0,u=1e8,c=a[s].rankIndex+1;c<a.length;)if(null!=(m=i[m=mxCellPath.create(n[c].getCoreCell())])){var p=m.cell;m.visited?(u=p.getGeneralPurposeVariable(e)-p.width/2-this.intraCellSpacing-d-o.width/2,c=a.length):(d+=p.width+this.intraCellSpacing,c++)}l<=r&&r<=u?o.setGeneralPurposeVariable(e,r):r<l?(o.setGeneralPurposeVariable(e,l),this.currentXDelta+=l-r):u<r&&(o.setGeneralPurposeVariable(e,u),this.currentXDelta+=r-u),a[s].visited=!0}},mxCoordinateAssignment.prototype.calculatedWeightedValue=function(e,n){for(var t=0,a=0;a<n.length;a++){var i=n[a];e.isVertex()&&i.isVertex()?t++:t=e.isEdge()&&i.isEdge()?t+8:t+2}return t},mxCoordinateAssignment.prototype.medianXValue=function(e,n){if(0==e.length)return 0;for(var t=[],a=0;a<e.length;a++)t[a]=e[a].getGeneralPurposeVariable(n);return t.sort(function(e,n){return e-n}),1==e.length%2?t[Math.floor(e.length/2)]:(t[(a=e.length/2)-1]+t[a])/2},mxCoordinateAssignment.prototype.initialCoords=function(e,n){this.calculateWidestRank(e,n);for(var t=this.widestRank;0<=t;t--)t<n.maxRank&&this.rankCoordinates(t,e,n);for(t=this.widestRank+1;t<=n.maxRank;t++)0<t&&this.rankCoordinates(t,e,n)},mxCoordinateAssignment.prototype.rankCoordinates=function(e,n,t){n=t.ranks[e],t=0;for(var a=this.initialX+(this.widestRankValue-this.rankWidths[e])/2,i=!1,s=0;s<n.length;s++){var o=n[s];if(o.isVertex()){var r=this.layout.getVertexBounds(o.cell);null!=r?this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(o.width=r.width,o.height=r.height):(o.width=r.height,o.height=r.width):i=!0,t=Math.max(t,o.height)}else o.isEdge()&&(r=1,null!=o.edges?r=o.edges.length:mxLog.warn("edge.edges is null"),o.width=(r-1)*this.parallelEdgeSpacing);a+=o.width/2,o.setX(e,a),o.setGeneralPurposeVariable(e,a),a+=o.width/2,a+=this.intraCellSpacing}1==i&&mxLog.warn("At least one cell has no bounds")},mxCoordinateAssignment.prototype.calculateWidestRank=function(e,n){var t=-this.interRankCellSpacing,a=0;this.rankWidths=[],this.rankY=[];for(var i=n.maxRank;0<=i;i--){for(var s=0,o=n.ranks[i],r=this.initialX,l=!1,d=0;d<o.length;d++){var c=o[d];if(c.isVertex()){var m=this.layout.getVertexBounds(c.cell);null!=m?this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(c.width=m.width,c.height=m.height):(c.width=m.height,c.height=m.width):l=!0,s=Math.max(s,c.height)}else c.isEdge()&&(m=1,null!=c.edges?m=c.edges.length:mxLog.warn("edge.edges is null"),c.width=(m-1)*this.parallelEdgeSpacing);r+=c.width/2,c.setX(i,r),c.setGeneralPurposeVariable(i,r),r+=c.width/2,(r+=this.intraCellSpacing)>this.widestRankValue&&(this.widestRankValue=r,this.widestRank=i),this.rankWidths[i]=r}for(1==l&&mxLog.warn("At least one cell has no bounds"),this.rankY[i]=t,r=s/2+a/2+this.interRankCellSpacing,a=s,t=this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_WEST?t+r:t-r,d=0;d<o.length;d++)o[d].setY(i,t)}},mxCoordinateAssignment.prototype.minPath=function(e,n){var t,a=n.edgeMapper;for(t in a){var i=a[t];if(!(i.maxRank-i.minRank-1<1)){for(var s=i.getGeneralPurposeVariable(i.minRank+1),o=!0,r=0,l=i.minRank+2;l<i.maxRank;l++){s!=(d=i.getGeneralPurposeVariable(l))?(o=!1,s=d):r++}if(!o){o=s=0;var d=[],c=[],m=i.getGeneralPurposeVariable(i.minRank+1);for(l=i.minRank+1;l<i.maxRank-1;l++){var u=i.getX(l+1);m==u?(d[l-i.minRank-1]=m,s++):this.repositionValid(n,i,l+1,m)?(d[l-i.minRank-1]=m,s++):m=d[l-i.minRank-1]=u}for(m=i.getX(l),l=i.maxRank-1;l>i.minRank+1;l--)m==(u=i.getX(l-1))?(c[l-i.minRank-2]=m,o++):this.repositionValid(n,i,l-1,m)?(c[l-i.minRank-2]=m,o++):(c[l-i.minRank-2]=i.getX(l-1),m=u);if(r<o||r<s)if(s<=o)for(l=i.maxRank-2;l>i.minRank;l--)i.setX(l,c[l-i.minRank-1]);else if(o<s)for(l=i.minRank+2;l<i.maxRank;l++)i.setX(l,d[l-i.minRank-2])}}}},mxCoordinateAssignment.prototype.repositionValid=function(e,n,t,a){e=e.ranks[t];for(var i=-1,s=0;s<e.length;s++)if(n==e[s]){i=s;break}if(i<0)return!1;if(a<(s=n.getGeneralPurposeVariable(t))){if(0==i)return!0;if(!((t=(t=(e=e[i-1]).getGeneralPurposeVariable(t))+e.width/2+this.intraCellSpacing+n.width/2)<=a))return!1}else if(s<a){if(i==e.length-1)return!0;if(!(a<=(t=(t=(e=e[i+1]).getGeneralPurposeVariable(t))-e.width/2-this.intraCellSpacing-n.width/2)))return!1}return!0},mxCoordinateAssignment.prototype.setCellLocations=function(e,n){this.rankTopY=[],this.rankBottomY=[];for(var t=0;t<n.ranks.length;t++)this.rankTopY[t]=Number.MAX_VALUE,this.rankBottomY[t]=0;t=null,this.layout.resizeParent&&(t={});var a,i=n.edgeMapper,s=n.vertexMapper;for(a in s){var o=s[a];if(this.setVertexLocation(o),this.layout.resizeParent){o=e.model.getParent(o.cell);var r=mxCellPath.create(o);null==t[r]&&(t[r]=o)}}for(a in this.layout.resizeParent&&null!=t&&this.adjustParents(t),(this.edgeStyle==mxHierarchicalEdgeStyle.ORTHOGONAL||this.edgeStyle==mxHierarchicalEdgeStyle.POLYLINE||this.edgeStyle==mxHierarchicalEdgeStyle.CURVE)&&this.localEdgeProcessing(n),i)this.setEdgePosition(i[a])},mxCoordinateAssignment.prototype.adjustParents=function(e){var n,t=[];for(n in e)t.push(e[n]);this.layout.arrangeGroups(mxUtils.sortCells(t,!0),this.groupPadding)},mxCoordinateAssignment.prototype.localEdgeProcessing=function(e){for(var n=0;n<e.ranks.length;n++)for(var t=e.ranks[n],a=0;a<t.length;a++){var i=t[a];if(i.isVertex())for(var s=i.getPreviousLayerConnectedCells(n),o=n-1,r=0;r<2;r++){if(-1<o&&o<e.ranks.length&&null!=s&&0<s.length){for(var l=[],d=0;d<s.length;d++){var c=new WeightedCellSorter(s[d],s[d].getX(o));l.push(c)}l.sort(WeightedCellSorter.prototype.compare);var m=(c=i.x[0]-i.width/2)+i.width,u=s=0;for(o=[],d=0;d<l.length;d++){var p,g=l[d].cell;if(g.isVertex()){p=0==r?i.connectsAsSource:i.connectsAsTarget;for(var v=0;v<p.length;v++)p[v].source!=g&&p[v].target!=g||(s+=p[v].edges.length,u++,o.push(p[v]))}else s+=g.edges.length,u++,o.push(g)}for(i.width>(s+1)*this.prefHozEdgeSep+2*this.prefHozEdgeSep&&(c+=this.prefHozEdgeSep,m-=this.prefHozEdgeSep),c+=(l=(m-c)/s)/2,m=this.minEdgeJetty-this.prefVertEdgeOff,d=u=0;d<o.length;d++){for(g=o[d].edges.length,v=mxCellPath.create(o[d].edges[0]),null==(p=this.jettyPositions[v])&&(p=[],this.jettyPositions[v]=p),d<s/2?m+=this.prefVertEdgeOff:s/2<d&&(m-=this.prefVertEdgeOff),v=0;v<g;v++)p[4*v+2*r]=c,c+=l,p[4*v+2*r+1]=m;u=Math.max(u,m)}}s=i.getNextLayerConnectedCells(n),o=n+1}}},mxCoordinateAssignment.prototype.setEdgePosition=function(e){var n=0;if(101207!=e.temp[0]){var t=e.maxRank,a=e.minRank;t==a&&(t=e.source.maxRank,a=e.target.minRank);for(var i=0,s=mxCellPath.create(e.edges[0]),o=(s=this.jettyPositions[s],e.isReversed?e.target.cell:e.source.cell),r=this.layout.graph,l=0;l<e.edges.length;l++){var d=e.edges[l],c=this.layout.getVisibleTerminal(d,!0),m=r.model.getTerminal(d,!0),u=[],p=e.isReversed;if(c!=o&&(p=!p),null!=s){var g=p?2:0,v=p?this.rankTopY[a]:this.rankBottomY[t],h=s[4*i+1+g];p&&(h=-h),v+=h,g=s[4*i+g],m=r.model.getTerminal(d,!0),this.layout.isPort(m)&&r.model.getParent(m)==c&&(g=null!=(g=r.view.getState(m))?g.x:c.geometry.x+e.source.width*m.geometry.x),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(u.push(new mxPoint(g,v)),this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(g,v+h))):(u.push(new mxPoint(v,g)),this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(v+h,g)))}for(g=e.x.length-1,v=h=-1,c=e.maxRank-1,p&&(g=0,h=e.x.length,v=1,c=e.minRank+1);e.maxRank!=e.minRank&&g!=h;g+=v){m=e.x[g]+n;var f=(this.rankTopY[c]+this.rankBottomY[c+1])/2,b=(this.rankTopY[c-1]+this.rankBottomY[c])/2;if(p){var A=f;f=b,b=A}this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(u.push(new mxPoint(m,f)),u.push(new mxPoint(m,b))):(u.push(new mxPoint(f,m)),u.push(new mxPoint(b,m))),this.limitX=Math.max(this.limitX,m),c+=v}null!=s&&(g=p?2:0,v=p?this.rankBottomY[t]:this.rankTopY[a],h=s[4*i+3-g],p&&(h=-h),v-=h,g=s[4*i+2-g],p=r.model.getTerminal(d,!1),c=this.layout.getVisibleTerminal(d,!1),this.layout.isPort(p)&&r.model.getParent(p)==c&&(g=null!=(g=r.view.getState(p))?g.x:c.geometry.x+e.target.width*p.geometry.x),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(g,v-h)),u.push(new mxPoint(g,v))):(this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(v-h,g)),u.push(new mxPoint(v,g)))),e.isReversed&&this.processReversedEdge(e,d),this.layout.setEdgePoints(d,u),n=0==n?this.parallelEdgeSpacing:0<n?-n:-n+this.parallelEdgeSpacing,i++}e.temp[0]=101207}},mxCoordinateAssignment.prototype.setVertexLocation=function(e){var n=e.cell,t=e.x[0]-e.width/2,a=e.y[0]-e.height/2;this.rankTopY[e.minRank]=Math.min(this.rankTopY[e.minRank],a),this.rankBottomY[e.minRank]=Math.max(this.rankBottomY[e.minRank],a+e.height),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?this.layout.setVertexLocation(n,t,a):this.layout.setVertexLocation(n,a,t),this.limitX=Math.max(this.limitX,t+e.width)},mxCoordinateAssignment.prototype.processReversedEdge=function(e,n){},WeightedCellSorter.prototype.weightedValue=0,WeightedCellSorter.prototype.nudge=!1,WeightedCellSorter.prototype.visited=!1,WeightedCellSorter.prototype.rankIndex=null,WeightedCellSorter.prototype.cell=null,WeightedCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.weightedValue>e.weightedValue?-1:n.weightedValue<e.weightedValue?1:n.nudge?-1:1:0},mxHierarchicalLayout.prototype=new mxGraphLayout,mxHierarchicalLayout.prototype.constructor=mxHierarchicalLayout,mxHierarchicalLayout.prototype.roots=null,mxHierarchicalLayout.prototype.resizeParent=!1,mxHierarchicalLayout.prototype.moveParent=!1,mxHierarchicalLayout.prototype.parentBorder=0,mxHierarchicalLayout.prototype.intraCellSpacing=30,mxHierarchicalLayout.prototype.interRankCellSpacing=100,mxHierarchicalLayout.prototype.interHierarchySpacing=60,mxHierarchicalLayout.prototype.parallelEdgeSpacing=10,mxHierarchicalLayout.prototype.orientation=mxConstants.DIRECTION_NORTH,mxHierarchicalLayout.prototype.fineTuning=!0,mxHierarchicalLayout.prototype.tightenToSource=!0,mxHierarchicalLayout.prototype.disableEdgeStyle=!0,mxHierarchicalLayout.prototype.traverseAncestors=!0,mxHierarchicalLayout.prototype.model=null,mxHierarchicalLayout.prototype.edgesCache=null,mxHierarchicalLayout.prototype.getModel=function(){return this.model},mxHierarchicalLayout.prototype.execute=function(e,n){this.parent=e;var t=this.graph.model;if(this.edgesCache={},null!=n||null!=e){if(null!=n&&null!=e){for(var a=[],i=0;i<n.length;i++)t.isAncestor(e,n[i])&&a.push(n[i]);this.roots=a}else this.roots=n;t.beginUpdate();try{this.run(e),this.resizeParent&&!this.graph.isCellCollapsed(e)&&this.graph.updateGroupBounds([e],this.parentBorder,this.moveParent)}finally{t.endUpdate()}}},mxHierarchicalLayout.prototype.findRoots=function(e,n){var t=[];if(null!=e&&null!=n){var a,i=this.graph.model,s=null,o=-1e5;for(a in n){var r=n[a];if(i.isVertex(r)&&this.graph.isCellVisible(r)){for(var l=this.getEdges(r),d=0,c=0,m=0;m<l.length;m++)this.getVisibleTerminal(l[m],!0)==r?d++:c++;0==c&&0<d&&t.push(r),o<(l=d-c)&&(o=l,s=r)}}0==t.length&&null!=s&&t.push(s)}return t},mxHierarchicalLayout.prototype.getEdges=function(e){var n=mxCellPath.create(e);if(null!=this.edgesCache[n])return this.edgesCache[n];for(var t=this.graph.model,a=[],i=this.graph.isCellCollapsed(e),s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o);this.isPort(r)?a=a.concat(t.getEdges(r,!0,!0)):!i&&this.graph.isCellVisible(r)||(a=a.concat(t.getEdges(r,!0,!0)))}for(a=a.concat(t.getEdges(e,!0,!0)),t=[],o=0;o<a.length;o++)((i=this.getVisibleTerminal(a[o],!0))==(s=this.getVisibleTerminal(a[o],!1))||i!=s&&(s==e&&(null==this.parent||this.graph.isValidAncestor(i,this.parent,this.traverseAncestors))||i==e&&(null==this.parent||this.graph.isValidAncestor(s,this.parent,this.traverseAncestors))))&&t.push(a[o]);return this.edgesCache[n]=t},mxHierarchicalLayout.prototype.getVisibleTerminal=function(e,n){var t=null!=(t=this.graph.view.getState(e))?t.getVisibleTerminal(n):this.graph.view.getVisibleTerminal(e,n);return this.isPort(t)&&(t=this.graph.model.getParent(t)),t},mxHierarchicalLayout.prototype.run=function(e){var n=[],t=[];if(null==this.roots&&null!=e){var a={};this.filterDescendants(e,a),this.roots=[];var i,s=!0;for(i in a)if(null!=a[i]){s=!1;break}for(;!s;){var o=this.findRoots(e,a);for(s=0;s<o.length;s++){var r=[];n.push(r),this.traverse(o[s],!0,null,t,r,n,a)}for(s=0;s<o.length;s++)this.roots.push(o[s]);for(i in s=!0,a)if(null!=a[i]){s=!1;break}}}else for(s=0;s<roots.length;s++)r=[],n.push(r),traverse(roots.get(s),!0,null,t,r,n,null);for(s=t=0;s<n.length;s++){for(i in a=[],r=n[s])a.push(r[i]);this.model=new mxGraphHierarchyModel(this,a,this.roots,e,this.tightenToSource),this.cycleStage(e),this.layeringStage(),this.crossingStage(e),t=this.placementStage(t,e)}},mxHierarchicalLayout.prototype.filterDescendants=function(e,n){var t=this.graph.model;if(t.isVertex(e)&&e!=this.parent&&this.graph.isCellVisible(e)&&(n[mxCellPath.create(e)]=e),this.traverseAncestors||e==this.parent&&this.graph.isCellVisible(e))for(var a=t.getChildCount(e),i=0;i<a;i++){var s=t.getChildAt(e,i);this.isPort(s)||this.filterDescendants(s,n)}},mxHierarchicalLayout.prototype.isPort=function(e){return!!e.geometry.relative},mxHierarchicalLayout.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;for(var a=this.getEdges(e),i=[],s=0;s<a.length;s++){var o=this.getVisibleTerminal(a[s],!0),r=this.getVisibleTerminal(a[s],!1);(o==e&&r==n||!t&&o==n&&r==e)&&i.push(a[s])}return i},mxHierarchicalLayout.prototype.traverse=function(e,n,t,a,i,s,o){if(null!=e&&null!=a){var r=mxCellPath.create(e);if(null!=a[r]||null!=o&&null==o[r]){if(null==i[r])for(t=0;t<s.length;t++)if(null!=(e=s[t])[r]){for(l in i)e[l]=i[l];return s.pop(),e}}else{null==i[r]&&(i[r]=e),null==a[r]&&(a[r]=e),delete o[r];var l=this.getEdges(e);for(t=0;t<l.length;t++)r=this.getVisibleTerminal(l[t],!0)==e,(!n||r)&&(r=this.getVisibleTerminal(l[t],!r),i=this.traverse(r,n,l[t],a,i,s,o))}}return i},mxHierarchicalLayout.prototype.cycleStage=function(e){new mxMinimumCycleRemover(this).execute(e)},mxHierarchicalLayout.prototype.layeringStage=function(){this.model.initialRank(),this.model.fixRanks()},mxHierarchicalLayout.prototype.crossingStage=function(e){new mxMedianHybridCrossingReduction(this).execute(e)},mxHierarchicalLayout.prototype.placementStage=function(e,n){var t=new mxCoordinateAssignment(this,this.intraCellSpacing,this.interRankCellSpacing,this.orientation,e,this.parallelEdgeSpacing);return t.fineTuning=this.fineTuning,t.execute(n),t.limitX+this.interHierarchySpacing},mxGraphModel.prototype=new mxEventSource,mxGraphModel.prototype.constructor=mxGraphModel,mxGraphModel.prototype.root=null,mxGraphModel.prototype.cells=null,mxGraphModel.prototype.maintainEdgeParent=!0,mxGraphModel.prototype.createIds=!0,mxGraphModel.prototype.prefix="",mxGraphModel.prototype.postfix="",mxGraphModel.prototype.nextId=0,mxGraphModel.prototype.currentEdit=null,mxGraphModel.prototype.updateLevel=0,mxGraphModel.prototype.endingUpdate=!1,mxGraphModel.prototype.clear=function(){this.setRoot(this.createRoot())},mxGraphModel.prototype.isCreateIds=function(){return this.createIds},mxGraphModel.prototype.setCreateIds=function(e){this.createIds=e},mxGraphModel.prototype.createRoot=function(){var e=new mxCell;return e.insert(new mxCell),e},mxGraphModel.prototype.getCell=function(e){return null!=this.cells?this.cells[e]:null},mxGraphModel.prototype.filterCells=function(e,n){var t=null;if(null!=e){t=[];for(var a=0;a<e.length;a++)n(e[a])&&t.push(e[a])}return t},mxGraphModel.prototype.getDescendants=function(e){return this.filterDescendants(null,e)},mxGraphModel.prototype.filterDescendants=function(e,n){var t=[];n=n||this.getRoot(),(null==e||e(n))&&t.push(n);for(var a=this.getChildCount(n),i=0;i<a;i++){var s=this.getChildAt(n,i);t=t.concat(this.filterDescendants(e,s))}return t},mxGraphModel.prototype.getRoot=function(e){var n=e||this.root;if(null!=e)for(;null!=e;)n=e,e=this.getParent(e);return n},mxGraphModel.prototype.setRoot=function(e){return this.execute(new mxRootChange(this,e)),e},mxGraphModel.prototype.rootChanged=function(e){var n=this.root;return this.root=e,this.nextId=0,this.cells=null,this.cellAdded(e),n},mxGraphModel.prototype.isRoot=function(e){return null!=e&&this.root==e},mxGraphModel.prototype.isLayer=function(e){return this.isRoot(this.getParent(e))},mxGraphModel.prototype.isAncestor=function(e,n){for(;null!=n&&n!=e;)n=this.getParent(n);return n==e},mxGraphModel.prototype.contains=function(e){return this.isAncestor(this.root,e)},mxGraphModel.prototype.getParent=function(e){return null!=e?e.getParent():null},mxGraphModel.prototype.add=function(e,n,t){if(n!=e&&null!=e&&null!=n){null==t&&(t=this.getChildCount(e));var a=e!=this.getParent(n);this.execute(new mxChildChange(this,e,n,t)),this.maintainEdgeParent&&a&&this.updateEdgeParents(n)}return n},mxGraphModel.prototype.cellAdded=function(e){if(null!=e){if(null==e.getId()&&this.createIds&&e.setId(this.createId(e)),null!=e.getId())if((n=this.getCell(e.getId()))!=e){for(;null!=n;)e.setId(this.createId(e)),n=this.getCell(e.getId());null==this.cells&&(this.cells={}),this.cells[e.getId()]=e}mxUtils.isNumeric(e.getId())&&(this.nextId=Math.max(this.nextId,e.getId()));for(var n=this.getChildCount(e),t=0;t<n;t++)this.cellAdded(this.getChildAt(e,t))}},mxGraphModel.prototype.createId=function(e){return e=this.nextId,this.nextId++,this.prefix+e+this.postfix},mxGraphModel.prototype.updateEdgeParents=function(e,n){n=n||this.getRoot(e);for(var t=this.getChildCount(e),a=0;a<t;a++){var i=this.getChildAt(e,a);this.updateEdgeParents(i,n)}for(i=this.getEdgeCount(e),t=[],a=0;a<i;a++)t.push(this.getEdgeAt(e,a));for(a=0;a<t.length;a++)i=t[a],this.isAncestor(n,i)&&this.updateEdgeParent(i,n)},mxGraphModel.prototype.updateEdgeParent=function(e,n){for(var t=this.getTerminal(e,!0),a=this.getTerminal(e,!1),i=null;null!=t&&!this.isEdge(t)&&null!=t.geometry&&t.geometry.relative;)t=this.getParent(t);for(;null!=a&&!this.isEdge(a)&&null!=a.geometry&&a.geometry.relative;)a=this.getParent(a);if(this.isAncestor(n,t)&&this.isAncestor(n,a)&&(null!=(i=t==a?this.getParent(t):this.getNearestCommonAncestor(t,a))&&(this.getParent(i)!=this.root||this.isAncestor(i,e))&&this.getParent(e)!=i)){if(null!=(t=this.getGeometry(e))){var s=this.getOrigin(this.getParent(e)),o=this.getOrigin(i);a=o.x-s.x,s=o.y-s.y;(t=t.clone()).translate(-a,-s),this.setGeometry(e,t)}this.add(i,e,this.getChildCount(i))}},mxGraphModel.prototype.getOrigin=function(e){var n=null;return null!=e?(n=this.getOrigin(this.getParent(e)),this.isEdge(e)||null!=(e=this.getGeometry(e))&&(n.x+=e.x,n.y+=e.y)):n=new mxPoint,n},mxGraphModel.prototype.getNearestCommonAncestor=function(e,n){if(null!=e&&null!=n&&(null!=(s=mxCellPath.create(n))&&0<s.length)){var t=e,a=mxCellPath.create(t);if(s.length<a.length){t=n;var i=a,s=(a=s,i)}for(;null!=t;){if(i=this.getParent(t),0==s.indexOf(a+mxCellPath.PATH_SEPARATOR)&&null!=i)return t;a=mxCellPath.getParentPath(a),t=i}}return null},mxGraphModel.prototype.remove=function(e){return e==this.root?this.setRoot(null):null!=this.getParent(e)&&this.execute(new mxChildChange(this,null,e)),e},mxGraphModel.prototype.cellRemoved=function(e){if(null!=e&&null!=this.cells){for(var n=this.getChildCount(e)-1;0<=n;n--)this.cellRemoved(this.getChildAt(e,n));null!=this.cells&&null!=e.getId()&&delete this.cells[e.getId()]}},mxGraphModel.prototype.parentForCellChanged=function(e,n,t){var a=this.getParent(e);return null!=n?(n!=a||a.getIndex(e)!=t)&&n.insert(e,t):null!=a&&(t=a.getIndex(e),a.remove(t)),this.contains(a)||null==n?null==n&&this.cellRemoved(e):this.cellAdded(e),a},mxGraphModel.prototype.getChildCount=function(e){return null!=e?e.getChildCount():0},mxGraphModel.prototype.getChildAt=function(e,n){return null!=e?e.getChildAt(n):null},mxGraphModel.prototype.getChildren=function(e){return null!=e?e.children:null},mxGraphModel.prototype.getChildVertices=function(e){return this.getChildCells(e,!0,!1)},mxGraphModel.prototype.getChildEdges=function(e){return this.getChildCells(e,!1,!0)},mxGraphModel.prototype.getChildCells=function(e,n,t){n=null!=n&&n,t=null!=t&&t;for(var a=this.getChildCount(e),i=[],s=0;s<a;s++){var o=this.getChildAt(e,s);(!t&&!n||t&&this.isEdge(o)||n&&this.isVertex(o))&&i.push(o)}return i},mxGraphModel.prototype.getTerminal=function(e,n){return null!=e?e.getTerminal(n):null},mxGraphModel.prototype.setTerminal=function(e,n,t){var a=n!=this.getTerminal(e,t);return this.execute(new mxTerminalChange(this,e,n,t)),this.maintainEdgeParent&&a&&this.updateEdgeParent(e,this.getRoot()),n},mxGraphModel.prototype.setTerminals=function(e,n,t){this.beginUpdate();try{this.setTerminal(e,n,!0),this.setTerminal(e,t,!1)}finally{this.endUpdate()}},mxGraphModel.prototype.terminalForCellChanged=function(e,n,t){var a=this.getTerminal(e,t);return null!=n?n.insertEdge(e,t):null!=a&&a.removeEdge(e,t),a},mxGraphModel.prototype.getEdgeCount=function(e){return null!=e?e.getEdgeCount():0},mxGraphModel.prototype.getEdgeAt=function(e,n){return null!=e?e.getEdgeAt(n):null},mxGraphModel.prototype.getDirectedEdgeCount=function(e,n,t){for(var a=0,i=this.getEdgeCount(e),s=0;s<i;s++){var o=this.getEdgeAt(e,s);o!=t&&this.getTerminal(o,n)==e&&a++}return a},mxGraphModel.prototype.getConnections=function(e){return this.getEdges(e,!0,!0,!1)},mxGraphModel.prototype.getIncomingEdges=function(e){return this.getEdges(e,!0,!1,!1)},mxGraphModel.prototype.getOutgoingEdges=function(e){return this.getEdges(e,!1,!0,!1)},mxGraphModel.prototype.getEdges=function(e,n,t,a){n=null==n||n,t=null==t||t,a=null==a||a;for(var i=this.getEdgeCount(e),s=[],o=0;o<i;o++){var r=this.getEdgeAt(e,o),l=this.getTerminal(r,!0),d=this.getTerminal(r,!1);(a&&l==d||l!=d&&(n&&d==e||t&&l==e))&&s.push(r)}return s},mxGraphModel.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;var a=this.getEdgeCount(e),i=this.getEdgeCount(n),s=e,o=a;for(i<a&&(o=i,s=n),a=[],i=0;i<o;i++){var r=this.getEdgeAt(s,i),l=this.getTerminal(r,!0),d=this.getTerminal(r,!1);(l==e&&d==n||!t&&(d==e&&l==n))&&a.push(r)}return a},mxGraphModel.prototype.getOpposites=function(e,n,t,a){t=null==t||t,a=null==a||a;var i=[];if(null!=e)for(var s=0;s<e.length;s++){var o=this.getTerminal(e[s],!0),r=this.getTerminal(e[s],!1);o==n&&null!=r&&r!=n&&a?i.push(r):r==n&&null!=o&&o!=n&&t&&i.push(o)}return i},mxGraphModel.prototype.getTopmostCells=function(e){for(var n=[],t=0;t<e.length;t++){for(var a=e[t],i=!0,s=this.getParent(a);null!=s;){if(0<=mxUtils.indexOf(e,s)){i=!1;break}s=this.getParent(s)}i&&n.push(a)}return n},mxGraphModel.prototype.isVertex=function(e){return null!=e&&e.isVertex()},mxGraphModel.prototype.isEdge=function(e){return null!=e&&e.isEdge()},mxGraphModel.prototype.isConnectable=function(e){return null!=e&&e.isConnectable()},mxGraphModel.prototype.getValue=function(e){return null!=e?e.getValue():null},mxGraphModel.prototype.setValue=function(e,n){return this.execute(new mxValueChange(this,e,n)),n},mxGraphModel.prototype.valueForCellChanged=function(e,n){return e.valueChanged(n)},mxGraphModel.prototype.getGeometry=function(e,n){return null!=e?e.getGeometry():null},mxGraphModel.prototype.setGeometry=function(e,n){return n!=this.getGeometry(e)&&this.execute(new mxGeometryChange(this,e,n)),n},mxGraphModel.prototype.geometryForCellChanged=function(e,n){var t=this.getGeometry(e);return e.setGeometry(n),t},mxGraphModel.prototype.getStyle=function(e){return null!=e?e.getStyle():null},mxGraphModel.prototype.setStyle=function(e,n){return n!=this.getStyle(e)&&this.execute(new mxStyleChange(this,e,n)),n},mxGraphModel.prototype.styleForCellChanged=function(e,n){var t=this.getStyle(e);return e.setStyle(n),t},mxGraphModel.prototype.isCollapsed=function(e){return null!=e&&e.isCollapsed()},mxGraphModel.prototype.setCollapsed=function(e,n){return n!=this.isCollapsed(e)&&this.execute(new mxCollapseChange(this,e,n)),n},mxGraphModel.prototype.collapsedStateForCellChanged=function(e,n){var t=this.isCollapsed(e);return e.setCollapsed(n),t},mxGraphModel.prototype.isVisible=function(e){return null!=e&&e.isVisible()},mxGraphModel.prototype.setVisible=function(e,n){return n!=this.isVisible(e)&&this.execute(new mxVisibleChange(this,e,n)),n},mxGraphModel.prototype.visibleStateForCellChanged=function(e,n){var t=this.isVisible(e);return e.setVisible(n),t},mxGraphModel.prototype.execute=function(e){e.execute(),this.beginUpdate(),this.currentEdit.add(e),this.fireEvent(new mxEventObject(mxEvent.EXECUTE,"change",e)),this.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",e)),this.endUpdate()},mxGraphModel.prototype.beginUpdate=function(){this.updateLevel++,this.fireEvent(new mxEventObject(mxEvent.BEGIN_UPDATE)),1==this.updateLevel&&this.fireEvent(new mxEventObject(mxEvent.START_EDIT))},mxGraphModel.prototype.endUpdate=function(){if(this.updateLevel--,0==this.updateLevel&&this.fireEvent(new mxEventObject(mxEvent.END_EDIT)),!this.endingUpdate){this.endingUpdate=0==this.updateLevel,this.fireEvent(new mxEventObject(mxEvent.END_UPDATE,"edit",this.currentEdit));try{if(this.endingUpdate&&!this.currentEdit.isEmpty()){this.fireEvent(new mxEventObject(mxEvent.BEFORE_UNDO,"edit",this.currentEdit));var e=this.currentEdit;this.currentEdit=this.createUndoableEdit(),e.notify(),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",e))}}finally{this.endingUpdate=!1}}},mxGraphModel.prototype.createUndoableEdit=function(){var e=new mxUndoableEdit(this,!0);return e.notify=function(){e.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",e,"changes",e.changes)),e.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",e,"changes",e.changes))},e},mxGraphModel.prototype.mergeChildren=function(e,n,t){t=null==t||t,this.beginUpdate();try{var a={};for(var i in this.mergeChildrenImpl(e,n,t,a),a){var s=a[i],o=this.getTerminal(s,!0);null!=o&&(o=a[mxCellPath.create(o)],this.setTerminal(s,o,!0)),null!=(o=this.getTerminal(s,!1))&&(o=a[mxCellPath.create(o)],this.setTerminal(s,o,!1))}}finally{this.endUpdate()}},mxGraphModel.prototype.mergeChildrenImpl=function(e,n,t,a){this.beginUpdate();try{for(var i=e.getChildCount(),s=0;s<i;s++){var o=e.getChildAt(s);if("function"==typeof o.getId){var r=o.getId(),l=null==r||this.isEdge(o)&&t?null:this.getCell(r);if(null==l){var d=o.clone();d.setId(r),d.setTerminal(o.getTerminal(!0),!0),d.setTerminal(o.getTerminal(!1),!1),l=n.insert(d),this.cellAdded(l)}a[mxCellPath.create(o)]=l,this.mergeChildrenImpl(o,l,t,a)}}}finally{this.endUpdate()}},mxGraphModel.prototype.getParents=function(e){var n=[];if(null!=e)for(var t={},a=0;a<e.length;a++){var i=this.getParent(e[a]);if(null!=i){var s=mxCellPath.create(i);null==t[s]&&(t[s]=i,n.push(i))}}return n},mxGraphModel.prototype.cloneCell=function(e){return null!=e?this.cloneCells([e],!0)[0]:null},mxGraphModel.prototype.cloneCells=function(e,n){for(var t={},a=[],i=0;i<e.length;i++)null!=e[i]?a.push(this.cloneCellImpl(e[i],t,n)):a.push(null);for(i=0;i<a.length;i++)null!=a[i]&&this.restoreClone(a[i],e[i],t);return a},mxGraphModel.prototype.cloneCellImpl=function(e,n,t){var a=this.cellCloned(e);if(n[mxObjectIdentity.get(e)]=a,t){t=this.getChildCount(e);for(var i=0;i<t;i++){var s=this.cloneCellImpl(this.getChildAt(e,i),n,!0);a.insert(s)}}return a},mxGraphModel.prototype.cellCloned=function(e){return e.clone()},mxGraphModel.prototype.restoreClone=function(e,n,t){null!=(a=this.getTerminal(n,!0))&&(null!=(a=t[mxObjectIdentity.get(a)])&&a.insertEdge(e,!0)),null!=(a=this.getTerminal(n,!1))&&(null!=(a=t[mxObjectIdentity.get(a)])&&a.insertEdge(e,!1));for(var a=this.getChildCount(e),i=0;i<a;i++)this.restoreClone(this.getChildAt(e,i),this.getChildAt(n,i),t)},mxRootChange.prototype.execute=function(){this.root=this.previous,this.previous=this.model.rootChanged(this.previous)},mxChildChange.prototype.execute=function(){var e=this.model.getParent(this.child),n=null!=e?e.getIndex(this.child):0;null==this.previous&&this.connect(this.child,!1),e=this.model.parentForCellChanged(this.child,this.previous,this.previousIndex),null!=this.previous&&this.connect(this.child,!0),this.parent=this.previous,this.previous=e,this.index=this.previousIndex,this.previousIndex=n},mxChildChange.prototype.connect=function(e,n){n=null==n||n;var t=e.getTerminal(!0),a=e.getTerminal(!1);for(null!=t&&(n?this.model.terminalForCellChanged(e,t,!0):this.model.terminalForCellChanged(e,null,!0)),null!=a&&(n?this.model.terminalForCellChanged(e,a,!1):this.model.terminalForCellChanged(e,null,!1)),e.setTerminal(t,!0),e.setTerminal(a,!1),t=this.model.getChildCount(e),a=0;a<t;a++)this.connect(this.model.getChildAt(e,a),n)},mxTerminalChange.prototype.execute=function(){this.terminal=this.previous,this.previous=this.model.terminalForCellChanged(this.cell,this.previous,this.source)},mxValueChange.prototype.execute=function(){this.value=this.previous,this.previous=this.model.valueForCellChanged(this.cell,this.previous)},mxStyleChange.prototype.execute=function(){this.style=this.previous,this.previous=this.model.styleForCellChanged(this.cell,this.previous)},mxGeometryChange.prototype.execute=function(){this.geometry=this.previous,this.previous=this.model.geometryForCellChanged(this.cell,this.previous)},mxCollapseChange.prototype.execute=function(){this.collapsed=this.previous,this.previous=this.model.collapsedStateForCellChanged(this.cell,this.previous)},mxVisibleChange.prototype.execute=function(){this.visible=this.previous,this.previous=this.model.visibleStateForCellChanged(this.cell,this.previous)},mxCellAttributeChange.prototype.execute=function(){var e=this.cell.getAttribute(this.attribute);null==this.previous?this.cell.value.removeAttribute(this.attribute):this.cell.setAttribute(this.attribute,this.previous),this.previous=e},mxCell.prototype.id=null,mxCell.prototype.value=null,mxCell.prototype.geometry=null,mxCell.prototype.style=null,mxCell.prototype.vertex=!1,mxCell.prototype.edge=!1,mxCell.prototype.connectable=!0,mxCell.prototype.visible=!0,mxCell.prototype.collapsed=!1,mxCell.prototype.parent=null,mxCell.prototype.source=null,mxCell.prototype.target=null,mxCell.prototype.children=null,mxCell.prototype.edges=null,mxCell.prototype.mxTransient="id value parent source target children edges".split(" "),mxCell.prototype.getId=function(){return this.id},mxCell.prototype.setId=function(e){this.id=e},mxCell.prototype.getValue=function(){return this.value},mxCell.prototype.setValue=function(e){this.value=e},mxCell.prototype.valueChanged=function(e){var n=this.getValue();return this.setValue(e),n},mxCell.prototype.getGeometry=function(){return this.geometry},mxCell.prototype.setGeometry=function(e){this.geometry=e},mxCell.prototype.getStyle=function(){return this.style},mxCell.prototype.setStyle=function(e){this.style=e},mxCell.prototype.isVertex=function(){return this.vertex},mxCell.prototype.setVertex=function(e){this.vertex=e},mxCell.prototype.isEdge=function(){return this.edge},mxCell.prototype.setEdge=function(e){this.edge=e},mxCell.prototype.isConnectable=function(){return this.connectable},mxCell.prototype.setConnectable=function(e){this.connectable=e},mxCell.prototype.isVisible=function(){return this.visible},mxCell.prototype.setVisible=function(e){this.visible=e},mxCell.prototype.isCollapsed=function(){return this.collapsed},mxCell.prototype.setCollapsed=function(e){this.collapsed=e},mxCell.prototype.getParent=function(){return this.parent},mxCell.prototype.setParent=function(e){this.parent=e},mxCell.prototype.getTerminal=function(e){return e?this.source:this.target},mxCell.prototype.setTerminal=function(e,n){return n?this.source=e:this.target=e,e},mxCell.prototype.getChildCount=function(){return null==this.children?0:this.children.length},mxCell.prototype.getIndex=function(e){return mxUtils.indexOf(this.children,e)},mxCell.prototype.getChildAt=function(e){return null==this.children?null:this.children[e]},mxCell.prototype.insert=function(e,n){return null!=e&&(null==n&&(n=this.getChildCount(),e.getParent()==this&&n--),e.removeFromParent(),e.setParent(this),null==this.children?(this.children=[],this.children.push(e)):this.children.splice(n,0,e)),e},mxCell.prototype.remove=function(e){var n=null;return null!=this.children&&0<=e&&(null!=(n=this.getChildAt(e))&&(this.children.splice(e,1),n.setParent(null))),n},mxCell.prototype.removeFromParent=function(){if(null!=this.parent){var e=this.parent.getIndex(this);this.parent.remove(e)}},mxCell.prototype.getEdgeCount=function(){return null==this.edges?0:this.edges.length},mxCell.prototype.getEdgeIndex=function(e){return mxUtils.indexOf(this.edges,e)},mxCell.prototype.getEdgeAt=function(e){return null==this.edges?null:this.edges[e]},mxCell.prototype.insertEdge=function(e,n){return null!=e&&(e.removeFromTerminal(n),e.setTerminal(this,n),null==this.edges||e.getTerminal(!n)!=this||mxUtils.indexOf(this.edges,e)<0)&&(null==this.edges&&(this.edges=[]),this.edges.push(e)),e},mxCell.prototype.removeEdge=function(e,n){if(null!=e){if(e.getTerminal(!n)!=this&&null!=this.edges){var t=this.getEdgeIndex(e);0<=t&&this.edges.splice(t,1)}e.setTerminal(null,n)}return e},mxCell.prototype.removeFromTerminal=function(e){var n=this.getTerminal(e);null!=n&&n.removeEdge(this,e)},mxCell.prototype.getAttribute=function(e,n){var t=this.getValue();return(null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT?t.getAttribute(e):null)||n},mxCell.prototype.setAttribute=function(e,n){var t=this.getValue();null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT&&t.setAttribute(e,n)},mxCell.prototype.clone=function(){var e=mxUtils.clone(this,this.mxTransient);return e.setValue(this.cloneValue()),e},mxCell.prototype.cloneValue=function(){var e=this.getValue();return null!=e&&("function"==typeof e.clone?e=e.clone():isNaN(e.nodeType)||(e=e.cloneNode(!0))),e},mxGeometry.prototype=new mxRectangle,mxGeometry.prototype.constructor=mxGeometry,mxGeometry.prototype.TRANSLATE_CONTROL_POINTS=!0,mxGeometry.prototype.alternateBounds=null,mxGeometry.prototype.sourcePoint=null,mxGeometry.prototype.targetPoint=null,mxGeometry.prototype.points=null,mxGeometry.prototype.offset=null,mxGeometry.prototype.relative=!1,mxGeometry.prototype.swap=function(){if(null!=this.alternateBounds){var e=new mxRectangle(this.x,this.y,this.width,this.height);this.x=this.alternateBounds.x,this.y=this.alternateBounds.y,this.width=this.alternateBounds.width,this.height=this.alternateBounds.height,this.alternateBounds=e}},mxGeometry.prototype.getTerminalPoint=function(e){return e?this.sourcePoint:this.targetPoint},mxGeometry.prototype.setTerminalPoint=function(e,n){return n?this.sourcePoint=e:this.targetPoint=e,e},mxGeometry.prototype.translate=function(e,n){if(this.clone(),this.relative||(this.x+=e,this.y+=n),null!=this.sourcePoint&&(this.sourcePoint.x+=e,this.sourcePoint.y+=n),null!=this.targetPoint&&(this.targetPoint.x+=e,this.targetPoint.y+=n),this.TRANSLATE_CONTROL_POINTS&&null!=this.points)for(var t=this.points.length,a=0;a<t;a++){var i=this.points[a];null!=i&&(i.x+=e,i.y+=n)}};var mxCellPath={PATH_SEPARATOR:".",create:function(e){var n="";if(null!=e)for(var t=e.getParent();null!=t;)n=t.getIndex(e)+mxCellPath.PATH_SEPARATOR+n,t=(e=t).getParent();return 1<(e=n.length)&&(n=n.substring(0,e-1)),n},getParentPath:function(e){if(null!=e){var n=e.lastIndexOf(mxCellPath.PATH_SEPARATOR);if(0<=n)return e.substring(0,n);if(0<e.length)return""}return null},resolve:function(e,n){var t=e;if(null!=n)for(var a=n.split(mxCellPath.PATH_SEPARATOR),i=0;i<a.length;i++)t=t.getChildAt(parseInt(a[i]));return t},compare:function(e,n){for(var t=Math.min(e.length,n.length),a=0,i=0;i<t;i++)if(e[i]!=n[i]){a=0==e[i].length||0==n[i].length?e[i]==n[i]?0:e[i]>n[i]?1:-1:(t=parseInt(e[i]))==(i=parseInt(n[i]))?0:i<t?1:-1;break}return 0==a&&((t=e.length)!=(i=n.length)&&(a=i<t?1:-1)),a}},mxPerimeter={RectanglePerimeter:function(e,n,t,a){n=e.getCenterX();var i=e.getCenterY(),s=Math.atan2(t.y-i,t.x-n),o=new mxPoint(0,0),r=Math.PI,l=Math.PI/2-s,d=Math.atan2(e.height,e.width);return s<-r+d||r-d<s?(o.x=e.x,o.y=i-e.width*Math.tan(s)/2):s<-d?(o.y=e.y,o.x=n-e.height*Math.tan(l)/2):s<d?(o.x=e.x+e.width,o.y=i+e.width*Math.tan(s)/2):(o.y=e.y+e.height,o.x=n+e.height*Math.tan(l)/2),a&&(t.x>=e.x&&t.x<=e.x+e.width?o.x=t.x:t.y>=e.y&&t.y<=e.y+e.height&&(o.y=t.y),t.x<e.x?o.x=e.x:t.x>e.x+e.width&&(o.x=e.x+e.width),t.y<e.y?o.y=e.y:t.y>e.y+e.height&&(o.y=e.y+e.height)),o},EllipsePerimeter:function(e,n,t,a){var i=e.x,s=e.y,o=e.width/2,r=e.height/2,l=i+o,d=s+r;n=t.x,t=t.y;var c=parseInt(n-l),m=parseInt(t-d);if(0==c&&0!=m)return new mxPoint(l,d+r*m/Math.abs(m));if(0==c&&0==m)return new mxPoint(n,t);if(a){if(s<=t&&t<=s+e.height)return e=t-d,e=Math.sqrt(o*o*(1-e*e/(r*r)))||0,n<=i&&(e=-e),new mxPoint(l+e,t);if(i<=n&&n<=i+e.width)return e=n-l,e=Math.sqrt(r*r*(1-e*e/(o*o)))||0,t<=s&&(e=-e),new mxPoint(n,d+e)}return d-=(i=m/c)*l,l=i*(o=(-(e=-2*l*(s=o*o*i*i+r*r))+(r=Math.sqrt(e*e-4*s*(o*o*i*i*l*l+r*r*l*l-o*o*r*r))))/(2*s))+d,d=i*(r=(-e-r)/(2*s))+d,i=Math.sqrt(Math.pow(o-n,2)+Math.pow(l-t,2)),n=Math.sqrt(Math.pow(r-n,2)+Math.pow(d-t,2)),s=t=0,s=i<n?(t=o,l):(t=r,d),new mxPoint(t,s)},RhombusPerimeter:function(e,n,t,a){n=e.x;var i=e.y,s=e.width,o=n+s/2,r=i+(e=e.height)/2,l=t.x;if(t=t.y,o==l)return new mxPoint(o,t<r?i:i+e);if(r==t)return new mxPoint(l<o?n:n+s,r);var d=o,c=r;return a&&(n<=l&&l<=n+s?d=l:i<=t&&t<=i+e&&(c=t)),l<o?t<r?mxUtils.intersection(l,t,d,c,o,i,n,r):mxUtils.intersection(l,t,d,c,o,i+e,n,r):t<r?mxUtils.intersection(l,t,d,c,o,i,n+s,r):mxUtils.intersection(l,t,d,c,o,i+e,n+s,r)},TrianglePerimeter:function(e,n,t,a){var i=(n=null!=n?n.style[mxConstants.STYLE_DIRECTION]:null)==mxConstants.DIRECTION_NORTH||n==mxConstants.DIRECTION_SOUTH,s=e.x,o=e.y,r=e.width,l=s+r/2,d=o+(e=e.height)/2,c=new mxPoint(s,o),m=new mxPoint(s+r,d),u=new mxPoint(s,o+e);n==mxConstants.DIRECTION_NORTH?(c=u,m=new mxPoint(l,o),u=new mxPoint(s+r,o+e)):n==mxConstants.DIRECTION_SOUTH?(m=new mxPoint(l,o+e),u=new mxPoint(s+r,o)):n==mxConstants.DIRECTION_WEST&&(c=new mxPoint(s+r,o),m=new mxPoint(s,d),u=new mxPoint(s+r,o+e));var p=t.x-l,g=t.y-d,v=(p=i?Math.atan2(p,g):Math.atan2(g,p),i?Math.atan2(r,e):Math.atan2(e,r));g=!1,g=n==mxConstants.DIRECTION_NORTH||n==mxConstants.DIRECTION_WEST?-v<p&&p<v:p<-Math.PI+v||p>Math.PI-v,v=null;return null==(v=g?a&&(i&&t.x>=c.x&&t.x<=u.x||!i&&t.y>=c.y&&t.y<=u.y)?i?new mxPoint(t.x,c.y):new mxPoint(c.x,t.y):n==mxConstants.DIRECTION_NORTH?new mxPoint(s+r/2+e*Math.tan(p)/2,o+e):n==mxConstants.DIRECTION_SOUTH?new mxPoint(s+r/2-e*Math.tan(p)/2,o):n==mxConstants.DIRECTION_WEST?new mxPoint(s+r,o+e/2+r*Math.tan(p)/2):new mxPoint(s,o+e/2-r*Math.tan(p)/2):(a&&(a=new mxPoint(l,d),t.y>=o&&t.y<=o+e?(a.x=i?l:n==mxConstants.DIRECTION_WEST?s+r:s,a.y=t.y):t.x>=s&&t.x<=s+r&&(a.x=t.x,a.y=i?n==mxConstants.DIRECTION_NORTH?o+e:o:d),l=a.x,d=a.y),i&&t.x<=s+r/2||!i&&t.y<=o+e/2?mxUtils.intersection(t.x,t.y,l,d,c.x,c.y,m.x,m.y):mxUtils.intersection(t.x,t.y,l,d,m.x,m.y,u.x,u.y)))&&(v=new mxPoint(l,d)),v}};function mxPrintPreview(e,n,t,a,i,s,o,r,l){this.graph=e,this.scale=null!=n?n:1/e.pageScale,this.border=null!=a?a:0,this.pageFormat=null!=t?t:e.pageFormat,this.title=null!=r?r:"Printer-friendly version",this.x0=null!=i?i:0,this.y0=null!=s?s:0,this.borderColor=o,this.pageSelector=null==l||l}function mxStylesheet(){this.styles={},this.putDefaultVertexStyle(this.createDefaultVertexStyle()),this.putDefaultEdgeStyle(this.createDefaultEdgeStyle())}function mxCellState(e,n,t){this.view=e,this.cell=n,this.style=t,this.origin=new mxPoint,this.absoluteOffset=new mxPoint}function mxGraphSelectionModel(e){this.graph=e,this.cells=[]}function mxSelectionChange(e,n,t){this.selectionModel=e,this.added=null!=n?n.slice():null,this.removed=null!=t?t.slice():null}function mxCellEditor(e){this.graph=e}function mxCellRenderer(){}mxPrintPreview.prototype.graph=null,mxPrintPreview.prototype.pageFormat=null,mxPrintPreview.prototype.scale=null,mxPrintPreview.prototype.border=0,mxPrintPreview.prototype.x0=0,mxPrintPreview.prototype.y0=0,mxPrintPreview.prototype.autoOrigin=!0,mxPrintPreview.prototype.printOverlays=!1,mxPrintPreview.prototype.borderColor=null,mxPrintPreview.prototype.title=null,mxPrintPreview.prototype.pageSelector=null,mxPrintPreview.prototype.wnd=null,mxPrintPreview.prototype.pageCount=0,mxPrintPreview.prototype.getWindow=function(){return this.wnd},mxPrintPreview.prototype.getDoctype=function(){var e="";return 8==document.documentMode&&(e='<meta http-equiv="X-UA-Compatible" content="IE=8">'),e},mxPrintPreview.prototype.open=function(e){var n=this.graph.cellRenderer.initializeOverlay,t=null;try{if(this.printOverlays&&(this.graph.cellRenderer.initializeOverlay=function(e,n){n.init(e.view.getDrawPane())}),null==this.wnd){this.wnd=window.open();var a=this.wnd.document,i=this.getDoctype();null!=i&&0<i.length&&a.writeln(i),a.writeln("<html>"),a.writeln("<head>"),this.writeHead(a,e),a.writeln("</head>"),a.writeln('<body class="mxPage">'),mxClient.link("stylesheet",mxClient.basePath+"/css/common.css",a),mxClient.IS_VML&&(a.namespaces.add("v","urn:schemas-microsoft-com:vml"),a.namespaces.add("o","urn:schemas-microsoft-com:office:office"),a.createStyleSheet().cssText="v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}",mxClient.link("stylesheet",mxClient.basePath+"/css/explorer.css",a));var s=this.graph.getGraphBounds().clone(),o=this.graph.getView().getScale(),r=o/this.scale,l=this.graph.getView().getTranslate();this.autoOrigin||(this.x0=-l.x*this.scale,this.y0=-l.y*this.scale,s.width+=s.x,s.height+=s.y,s.x=0,this.border=s.y=0),s.width/=r,s.height/=r;var d=this.pageFormat.width-2*this.border,c=this.pageFormat.height-2*this.border,m=Math.max(1,Math.ceil((s.width+this.x0)/d)),u=Math.max(1,Math.ceil((s.height+this.y0)/c));this.pageCount=m*u;var p=mxUtils.bind(this,function(){if(this.pageSelector&&(1<u||1<m)){var e=this.createPageSelector(u,m);if(a.body.appendChild(e),mxClient.IS_IE){e.style.position="absolute";var n=function(){e.style.top=a.body.scrollTop+10+"px"};mxEvent.addListener(this.wnd,"scroll",function(e){n()}),mxEvent.addListener(this.wnd,"resize",function(e){n()})}}});if(e=function(e,n){if(null!=this.borderColor&&(e.style.borderColor=this.borderColor,e.style.borderStyle="solid",e.style.borderWidth="1px"),e.style.background="white",n&&(e.style.pageBreakAfter="always"),mxClient.IS_IE?(a.writeln(e.outerHTML),e.parentNode.removeChild(e)):(e.parentNode.removeChild(e),a.body.appendChild(e)),n){var t=a.createElement("hr");t.className="mxPageBreak",a.body.appendChild(t)}},null!=(f=this.getCoverPages(this.pageFormat.width,this.pageFormat.height)))for(var g=0;g<f.length;g++)e(f[g],!0);var v=this.getAppendices(this.pageFormat.width,this.pageFormat.height);for(g=0;g<u;g++)for(var h=g*c/this.scale-this.y0/this.scale+(s.y-l.y*o)/o,f=0;f<m;f++){if(null==this.wnd)return null;var b=f*d/this.scale-this.x0/this.scale+(s.x-l.x*o)/o,A=g*m+f+1;(t=this.renderPage(this.pageFormat.width,this.pageFormat.height,mxUtils.bind(this,function(e){this.addGraphFragment(-b,-h,this.scale,A,e)}))).setAttribute("id","mxPage-"+A),e(t,null!=v||g<u-1||f<m-1)}if(null!=v)for(g=0;g<v.length;g++)e(v[g],g<v.length);a.writeln("</body>"),a.writeln("</html>"),a.close(),p(),mxEvent.release(a.body)}this.wnd.focus()}catch(e){null!=t&&null!=t.parentNode&&t.parentNode.removeChild(t)}finally{this.graph.cellRenderer.initializeOverlay=n}return this.wnd},mxPrintPreview.prototype.writeHead=function(e,n){null!=this.title&&e.writeln("<title>"+this.title+"</title>"),e.writeln('<style type="text/css">'),e.writeln("@media print {"),e.writeln("  table.mxPageSelector { display: none; }"),e.writeln("  hr.mxPageBreak { display: none; }"),e.writeln("}"),e.writeln("@media screen {"),e.writeln("  table.mxPageSelector { position: fixed; right: 10px; top: 10px;font-family: Arial; font-size:10pt; border: solid 1px darkgray;background: white; border-collapse:collapse; }"),e.writeln("  table.mxPageSelector td { border: solid 1px gray; padding:4px; }"),e.writeln("  body.mxPage { background: gray; }"),e.writeln("}"),null!=n&&e.writeln(n),e.writeln("</style>")},mxPrintPreview.prototype.createPageSelector=function(e,n){var t=this.wnd.document,a=t.createElement("table");a.className="mxPageSelector",a.setAttribute("border","0");for(var i=t.createElement("tbody"),s=0;s<e;s++){for(var o=t.createElement("tr"),r=0;r<n;r++){var l=s*n+r+1,d=t.createElement("td");if(!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC){var c=t.createElement("a");c.setAttribute("href","#mxPage-"+l),mxUtils.write(c,l,t),d.appendChild(c)}else mxUtils.write(d,l,t);o.appendChild(d)}i.appendChild(o)}return a.appendChild(i),a},mxPrintPreview.prototype.renderPage=function(e,n,t){var a=document.createElement("div");try{a.style.width=e+"px",a.style.height=n+"px",a.style.overflow="hidden",a.style.pageBreakInside="avoid",a.style.position="relative";var i=document.createElement("div");i.style.top=this.border+"px",i.style.left=this.border+"px",i.style.width=e-2*this.border+"px",i.style.height=n-2*this.border+"px",i.style.overflow="hidden",this.graph.dialect==mxConstants.DIALECT_VML&&(i.style.position="absolute"),a.appendChild(i),document.body.appendChild(a),t(i)}catch(e){throw a.parentNode.removeChild(a),e}return a},mxPrintPreview.prototype.addGraphFragment=function(e,n,t,a,i){a=this.graph.getView();var s=this.graph.container;this.graph.container=i;var o=a.getCanvas(),r=a.getBackgroundPane(),l=a.getDrawPane(),d=a.getOverlayPane();this.graph.dialect==mxConstants.DIALECT_SVG?a.createSvg():this.graph.dialect==mxConstants.DIALECT_VML?a.createVml():a.createHtml();var c=a.isEventsEnabled();a.setEventsEnabled(!1);var m=this.graph.isEnabled();this.graph.setEnabled(!1);var u=a.getTranslate();a.translate=new mxPoint(e,n),e=null;try{var p=[this.graph.getModel().getRoot()];e=new mxTemporaryCellStates(a,t,p)}finally{if(mxClient.IS_IE)a.overlayPane.innerHTML="";else for(t=i.firstChild;null!=t;)p=t.nextSibling,"svg"==(n=t.nodeName.toLowerCase())?(t.setAttribute("width",parseInt(i.style.width)),t.setAttribute("height",parseInt(i.style.height))):"default"!=t.style.cursor&&"table"!=n&&t.parentNode.removeChild(t),t=p;a.overlayPane.parentNode.removeChild(a.overlayPane),this.graph.setEnabled(m),this.graph.container=s,a.canvas=o,a.backgroundPane=r,a.drawPane=l,a.overlayPane=d,a.translate=u,e.destroy(),a.setEventsEnabled(c)}},mxPrintPreview.prototype.getCoverPages=function(){return null},mxPrintPreview.prototype.getAppendices=function(){return null},mxPrintPreview.prototype.print=function(){var e=this.open();null!=e&&e.print()},mxPrintPreview.prototype.close=function(){null!=this.wnd&&(this.wnd.close(),this.wnd=null)},mxStylesheet.prototype.createDefaultVertexStyle=function(){var e={};return e[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_RECTANGLE,e[mxConstants.STYLE_PERIMETER]=mxPerimeter.RectanglePerimeter,e[mxConstants.STYLE_VERTICAL_ALIGN]=mxConstants.ALIGN_MIDDLE,e[mxConstants.STYLE_ALIGN]=mxConstants.ALIGN_CENTER,e[mxConstants.STYLE_FILLCOLOR]="#C3D9FF",e[mxConstants.STYLE_STROKECOLOR]="#6482B9",e[mxConstants.STYLE_FONTCOLOR]="#774400",e},mxStylesheet.prototype.createDefaultEdgeStyle=function(){var e={};return e[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_CONNECTOR,e[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,e[mxConstants.STYLE_VERTICAL_ALIGN]=mxConstants.ALIGN_MIDDLE,e[mxConstants.STYLE_ALIGN]=mxConstants.ALIGN_CENTER,e[mxConstants.STYLE_STROKECOLOR]="#6482B9",e[mxConstants.STYLE_FONTCOLOR]="#446299",e},mxStylesheet.prototype.putDefaultVertexStyle=function(e){this.putCellStyle("defaultVertex",e)},mxStylesheet.prototype.putDefaultEdgeStyle=function(e){this.putCellStyle("defaultEdge",e)},mxStylesheet.prototype.getDefaultVertexStyle=function(){return this.styles.defaultVertex},mxStylesheet.prototype.getDefaultEdgeStyle=function(){return this.styles.defaultEdge},mxStylesheet.prototype.putCellStyle=function(e,n){this.styles[e]=n},mxStylesheet.prototype.getCellStyle=function(e,n){var t=n;if(null!=e&&0<e.length)for(var a=e.split(";"),i=(t=null!=t&&";"!=e.charAt(0)?mxUtils.clone(t):{},0);i<a.length;i++){var s=(o=a[i]).indexOf("=");if(0<=s){var o,r=o.substring(0,s);(o=o.substring(s+1))==mxConstants.NONE?delete t[r]:mxUtils.isNumeric(o)?t[r]=parseFloat(o):t[r]=o}else if(null!=(o=this.styles[o]))for(r in o)t[r]=o[r]}return t},mxCellState.prototype=new mxRectangle,mxCellState.prototype.constructor=mxCellState,mxCellState.prototype.view=null,mxCellState.prototype.cell=null,mxCellState.prototype.style=null,mxCellState.prototype.invalid=!0,mxCellState.prototype.invalidOrder=!1,mxCellState.prototype.orderChanged=!1,mxCellState.prototype.origin=null,mxCellState.prototype.absolutePoints=null,mxCellState.prototype.absoluteOffset=null,mxCellState.prototype.visibleSourceState=null,mxCellState.prototype.visibleTargetState=null,mxCellState.prototype.terminalDistance=0,mxCellState.prototype.length=0,mxCellState.prototype.segments=null,mxCellState.prototype.shape=null,mxCellState.prototype.text=null,mxCellState.prototype.getPerimeterBounds=function(e,n){if(e=e||0,n=null!=n?n:new mxRectangle(this.x,this.y,this.width,this.height),null!=this.shape&&null!=this.shape.stencil){var t=this.shape.stencil.computeAspect(this.style,n.x,n.y,n.width,n.height);n.x=t.x,n.y=t.y,n.width=this.shape.stencil.w0*t.width,n.height=this.shape.stencil.h0*t.height}return 0!=e&&n.grow(e),n},mxCellState.prototype.setAbsoluteTerminalPoint=function(e,n){n?(null==this.absolutePoints&&(this.absolutePoints=[]),0==this.absolutePoints.length?this.absolutePoints.push(e):this.absolutePoints[0]=e):null==this.absolutePoints?(this.absolutePoints=[],this.absolutePoints.push(null),this.absolutePoints.push(e)):1==this.absolutePoints.length?this.absolutePoints.push(e):this.absolutePoints[this.absolutePoints.length-1]=e},mxCellState.prototype.setCursor=function(e){null!=this.shape&&this.shape.setCursor(e),null!=this.text&&this.text.setCursor(e)},mxCellState.prototype.getVisibleTerminal=function(e){return null!=(e=this.getVisibleTerminalState(e))?e.cell:null},mxCellState.prototype.getVisibleTerminalState=function(e){return e?this.visibleSourceState:this.visibleTargetState},mxCellState.prototype.setVisibleTerminalState=function(e,n){n?this.visibleSourceState=e:this.visibleTargetState=e},mxCellState.prototype.destroy=function(){this.view.graph.cellRenderer.destroy(this)},mxCellState.prototype.clone=function(){var e=new mxCellState(this.view,this.cell,this.style);if(null!=this.absolutePoints){e.absolutePoints=[];for(var n=0;n<this.absolutePoints.length;n++)e.absolutePoints[n]=this.absolutePoints[n].clone()}return null!=this.origin&&(e.origin=this.origin.clone()),null!=this.absoluteOffset&&(e.absoluteOffset=this.absoluteOffset.clone()),null!=this.boundingBox&&(e.boundingBox=this.boundingBox.clone()),e.terminalDistance=this.terminalDistance,e.segments=this.segments,e.length=this.length,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},mxGraphSelectionModel.prototype=new mxEventSource,mxGraphSelectionModel.prototype.constructor=mxGraphSelectionModel,mxGraphSelectionModel.prototype.doneResource="none"!=mxClient.language?"done":"",mxGraphSelectionModel.prototype.updatingSelectionResource="none"!=mxClient.language?"updatingSelection":"",mxGraphSelectionModel.prototype.graph=null,mxGraphSelectionModel.prototype.singleSelection=!1,mxGraphSelectionModel.prototype.isSingleSelection=function(){return this.singleSelection},mxGraphSelectionModel.prototype.setSingleSelection=function(e){this.singleSelection=e},mxGraphSelectionModel.prototype.isSelected=function(e){return null!=e&&0<=mxUtils.indexOf(this.cells,e)},mxGraphSelectionModel.prototype.isEmpty=function(){return 0==this.cells.length},mxGraphSelectionModel.prototype.clear=function(){this.changeSelection(null,this.cells)},mxGraphSelectionModel.prototype.setCell=function(e){null!=e&&this.setCells([e])},mxGraphSelectionModel.prototype.setCells=function(e){if(null!=e){this.singleSelection&&(e=[this.getFirstSelectableCell(e)]);for(var n=[],t=0;t<e.length;t++)this.graph.isCellSelectable(e[t])&&n.push(e[t]);this.changeSelection(n,this.cells)}},mxGraphSelectionModel.prototype.getFirstSelectableCell=function(e){if(null!=e)for(var n=0;n<e.length;n++)if(this.graph.isCellSelectable(e[n]))return e[n];return null},mxGraphSelectionModel.prototype.addCell=function(e){null!=e&&this.addCells([e])},mxGraphSelectionModel.prototype.addCells=function(e){if(null!=e){var n=null;this.singleSelection&&(n=this.cells,e=[this.getFirstSelectableCell(e)]);for(var t=[],a=0;a<e.length;a++)!this.isSelected(e[a])&&this.graph.isCellSelectable(e[a])&&t.push(e[a]);this.changeSelection(t,n)}},mxGraphSelectionModel.prototype.removeCell=function(e){null!=e&&this.removeCells([e])},mxGraphSelectionModel.prototype.removeCells=function(e){if(null!=e){for(var n=[],t=0;t<e.length;t++)this.isSelected(e[t])&&n.push(e[t]);this.changeSelection(null,n)}},mxGraphSelectionModel.prototype.changeSelection=function(e,n){if(null!=e&&0<e.length&&null!=e[0]||null!=n&&0<n.length&&null!=n[0]){var t=new mxSelectionChange(this,e,n);t.execute();var a=new mxUndoableEdit(this,!1);a.add(t),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",a))}},mxGraphSelectionModel.prototype.cellAdded=function(e){null!=e&&!this.isSelected(e)&&this.cells.push(e)},mxGraphSelectionModel.prototype.cellRemoved=function(e){null!=e&&(0<=(e=mxUtils.indexOf(this.cells,e))&&this.cells.splice(e,1))},mxSelectionChange.prototype.execute=function(){var e=mxLog.enter("mxSelectionChange.execute");if(window.status=mxResources.get(this.selectionModel.updatingSelectionResource)||this.selectionModel.updatingSelectionResource,null!=this.removed)for(var n=0;n<this.removed.length;n++)this.selectionModel.cellRemoved(this.removed[n]);if(null!=this.added)for(n=0;n<this.added.length;n++)this.selectionModel.cellAdded(this.added[n]);n=this.added,this.added=this.removed,this.removed=n,window.status=mxResources.get(this.selectionModel.doneResource)||this.selectionModel.doneResource,mxLog.leave("mxSelectionChange.execute",e),this.selectionModel.fireEvent(new mxEventObject(mxEvent.CHANGE,"added",this.added,"removed",this.removed))},mxCellEditor.prototype.graph=null,mxCellEditor.prototype.textarea=null,mxCellEditor.prototype.editingCell=null,mxCellEditor.prototype.trigger=null,mxCellEditor.prototype.modified=!1,mxCellEditor.prototype.autoSize=!0,mxCellEditor.prototype.emptyLabelText="",mxCellEditor.prototype.textNode="",mxCellEditor.prototype.init=function(){this.textarea=document.createElement("textarea"),this.textarea.className="mxCellEditor",this.textarea.style.position="absolute",this.textarea.style.overflow="visible",this.textarea.setAttribute("cols","20"),this.textarea.setAttribute("rows","4"),mxClient.IS_NS&&(this.textarea.style.resize="none"),mxEvent.addListener(this.textarea,"blur",mxUtils.bind(this,function(e){this.focusLost()})),mxEvent.addListener(this.textarea,"keydown",mxUtils.bind(this,function(e){mxEvent.isConsumed(e)||(113==e.keyCode||this.graph.isEnterStopsCellEditing()&&13==e.keyCode&&!mxEvent.isControlDown(e)&&!mxEvent.isShiftDown(e)?(this.graph.stopEditing(!1),mxEvent.consume(e)):27==e.keyCode?(this.graph.stopEditing(!0),mxEvent.consume(e)):(this.clearOnChange&&(this.clearOnChange=!1,this.textarea.value=""),this.setModified(!0)))})),mxEvent.addListener(this.textarea,"keypress",mxUtils.bind(this,function(e){this.autoSize&&!mxEvent.isConsumed(e)&&setTimeout(mxUtils.bind(this,function(){this.resize()}),0)}))},mxCellEditor.prototype.resize=function(){if(null!=this.textDiv){var e=this.graph.getView().getState(this.editingCell),n=this.graph.isLabelClipped(e.cell),t=this.graph.isWrapping(e.cell);if(this.graph.getModel().isEdge(e.cell))this.bounds.x=e.absoluteOffset.x,this.bounds.y=e.absoluteOffset.y,this.bounds.width=0,this.bounds.height=0;else if(null!=this.bounds){this.bounds.x=e.x,this.bounds.y=e.y,this.bounds.width=e.width,this.bounds.height=e.height,(a=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?this.bounds.x-=e.width:a==mxConstants.ALIGN_RIGHT&&(this.bounds.x+=e.width),(a=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?this.bounds.y-=e.height:a==mxConstants.ALIGN_BOTTOM&&(this.bounds.y+=e.height)}"\n"!=(a=this.textarea.value).charAt(a.length-1)&&""!=a||(a+="&nbsp;"),a=mxUtils.htmlEntities(a,!1),t?(this.textDiv.style.whiteSpace="normal",this.textDiv.style.width=this.bounds.width+"px"):a=a.replace(/ /g,"&nbsp;"),a=a.replace(/\n/g,"<br/>"),this.textDiv.innerHTML=a;var a=this.textDiv.offsetWidth+30,i=this.textDiv.offsetHeight+16;a=Math.max(a,40),i=Math.max(i,20);n&&(a=Math.min(this.bounds.width-4,a),i=Math.min(this.bounds.height,i));var s=null!=e.text?e.text.margin:null;null==s&&(s=mxUtils.getValue(e.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER),e=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),s=mxUtils.getAlignmentAsPoint(s,e)),null!=s&&(!n&&t||(this.textarea.style.left=Math.max(0,Math.round(this.bounds.x-s.x*this.bounds.width+s.x*a)-3)+"px"),this.textarea.style.top=Math.max(0,Math.round(this.bounds.y-s.y*this.bounds.height+s.y*i)+4)+"px"),!n&&t||(this.textarea.style.width=a+"px"),this.textarea.style.height=i+"px"}},mxCellEditor.prototype.isModified=function(){return this.modified},mxCellEditor.prototype.setModified=function(e){this.modified=e},mxCellEditor.prototype.focusLost=function(){this.stopEditing(!this.graph.isInvokesStopCellEditing())},mxCellEditor.prototype.startEditing=function(e,n){null==this.textarea&&this.init(),this.stopEditing(!0);var t=this.graph.getView().getState(e);if(null!=t){this.editingCell=e,this.trigger=n,(this.textNode=null)!=t.text&&this.isHideLabel(t)&&(this.textNode=t.text.node,this.textNode.style.visibility="hidden");var a=this.graph.getView().scale,i=(a=mxUtils.getValue(t.style,mxConstants.STYLE_FONTSIZE,mxConstants.DEFAULT_FONTSIZE)*a,mxUtils.getValue(t.style,mxConstants.STYLE_FONTFAMILY,mxConstants.DEFAULT_FONTFAMILY)),s=mxUtils.getValue(t.style,mxConstants.STYLE_FONTCOLOR,"black"),o=mxUtils.getValue(t.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT),r=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD,l=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC,d=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE;this.textarea.style.fontSize=Math.round(a)+"px",this.textarea.style.lineHeight=Math.round(a*mxConstants.LINE_HEIGHT)+"px",this.textarea.style.fontFamily=i,this.textarea.style.textAlign=o,this.textarea.style.color=s,this.textarea.style.fontWeight=r?"bold":"normal",this.textarea.style.fontStyle=l?"italic":"",this.textarea.style.textDecoration=d?"underline":"",this.textarea.style.overflow="auto",this.textarea.style.outline="none",this.bounds=a=this.getEditorBounds(t),this.textarea.style.left=a.x+"px",this.textarea.style.top=a.y+"px",this.textarea.style.width=a.width+"px",this.textarea.style.height=a.height+"px",this.textarea.style.zIndex=5,null==(t=this.getInitialValue(t,n))||0==t.length?(t=this.getEmptyLabelText(),this.clearOnChange=!0):this.clearOnChange=!1,this.setModified(!1),this.textarea.value=t,this.graph.container.appendChild(this.textarea),"none"!=this.textarea.style.display&&(this.autoSize&&(this.textDiv=this.createTextDiv(),document.body.appendChild(this.textDiv),this.resize()),this.textarea.focus(),this.textarea.select())}},mxCellEditor.prototype.createTextDiv=function(){var e=document.createElement("div"),n=e.style;return n.position="absolute",n.whiteSpace="nowrap",n.visibility="hidden",n.display=mxClient.IS_QUIRKS?"inline":"inline-block",n.zoom="1",n.verticalAlign="top",n.lineHeight=this.textarea.style.lineHeight,n.fontSize=this.textarea.style.fontSize,n.fontFamily=this.textarea.style.fontFamily,n.fontWeight=this.textarea.style.fontWeight,n.textAlign=this.textarea.style.textAlign,n.fontStyle=this.textarea.style.fontStyle,n.textDecoration=this.textarea.style.textDecoration,e},mxCellEditor.prototype.stopEditing=function(e){null!=this.editingCell&&(null!=this.textNode&&(this.textNode.style.visibility="visible",this.textNode=null),!e&&this.isModified()&&this.graph.labelChanged(this.editingCell,this.getCurrentValue(),this.trigger),null!=this.textDiv&&(document.body.removeChild(this.textDiv),this.textDiv=null),this.bounds=this.trigger=this.editingCell=null,this.textarea.blur(),this.textarea.parentNode.removeChild(this.textarea))},mxCellEditor.prototype.getInitialValue=function(e,n){return this.graph.getEditingValue(e.cell,n)},mxCellEditor.prototype.getCurrentValue=function(){return this.textarea.value.replace(/\r/g,"")},mxCellEditor.prototype.isHideLabel=function(e){return!0},mxCellEditor.prototype.getMinimumSize=function(e){var n=this.graph.getView().scale;return new mxRectangle(0,0,null==e.text?30:e.text.size*n+20,"left"==this.textarea.style.textAlign?120:40)},mxCellEditor.prototype.getEditorBounds=function(e){var n=this.graph.getModel().isEdge(e.cell),t=this.graph.getView().scale,a=(i=this.getMinimumSize(e)).width,i=i.height,s=parseInt(e.style[mxConstants.STYLE_SPACING]||2)*t,o=parseInt(e.style[mxConstants.STYLE_SPACING_TOP]||0)*t+s,r=parseInt(e.style[mxConstants.STYLE_SPACING_RIGHT]||0)*t+s,l=parseInt(e.style[mxConstants.STYLE_SPACING_BOTTOM]||0)*t+s;t=parseInt(e.style[mxConstants.STYLE_SPACING_LEFT]||0)*t+s,r=new mxRectangle(e.x,e.y,Math.max(a,e.width-t-r),Math.max(i,e.height-o-l));return n?(r.x=e.absoluteOffset.x,r.y=e.absoluteOffset.y,null!=e.text&&null!=e.text.boundingBox&&(0<e.text.boundingBox.x&&(r.x=e.text.boundingBox.x),0<e.text.boundingBox.y&&(r.y=e.text.boundingBox.y))):null!=e.text&&null!=e.text.boundingBox&&(r.x=Math.min(r.x,e.text.boundingBox.x),r.y=Math.min(r.y,e.text.boundingBox.y)),r.x+=t,r.y+=o,null!=e.text&&null!=e.text.boundingBox&&(n?(r.width=Math.max(a,e.text.boundingBox.width),r.height=Math.max(i,e.text.boundingBox.height)):(r.width=Math.max(r.width,e.text.boundingBox.width),r.height=Math.max(r.height,e.text.boundingBox.height))),this.graph.getModel().isVertex(e.cell)&&((n=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?r.x-=e.width:n==mxConstants.ALIGN_RIGHT&&(r.x+=e.width),(n=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?r.y-=e.height:n==mxConstants.ALIGN_BOTTOM&&(r.y+=e.height)),r},mxCellEditor.prototype.getEmptyLabelText=function(e){return this.emptyLabelText},mxCellEditor.prototype.getEditingCell=function(){return this.editingCell},mxCellEditor.prototype.destroy=function(){null!=this.textarea&&(mxEvent.release(this.textarea),null!=this.textarea.parentNode&&this.textarea.parentNode.removeChild(this.textarea),this.textarea=null)},mxCellRenderer.prototype.defaultEdgeShape=mxConnector,mxCellRenderer.prototype.defaultVertexShape=mxRectangleShape,mxCellRenderer.prototype.defaultTextShape=mxText,mxCellRenderer.prototype.legacyControlPosition=!0,mxCellRenderer.prototype.defaultShapes={},mxCellRenderer.registerShape=function(e,n){mxCellRenderer.prototype.defaultShapes[e]=n},mxCellRenderer.registerShape(mxConstants.SHAPE_RECTANGLE,mxRectangleShape),mxCellRenderer.registerShape(mxConstants.SHAPE_ELLIPSE,mxEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_RHOMBUS,mxRhombus),mxCellRenderer.registerShape(mxConstants.SHAPE_CYLINDER,mxCylinder),mxCellRenderer.registerShape(mxConstants.SHAPE_CONNECTOR,mxConnector),mxCellRenderer.registerShape(mxConstants.SHAPE_ACTOR,mxActor),mxCellRenderer.registerShape(mxConstants.SHAPE_TRIANGLE,mxTriangle),mxCellRenderer.registerShape(mxConstants.SHAPE_HEXAGON,mxHexagon),mxCellRenderer.registerShape(mxConstants.SHAPE_CLOUD,mxCloud),mxCellRenderer.registerShape(mxConstants.SHAPE_LINE,mxLine),mxCellRenderer.registerShape(mxConstants.SHAPE_ARROW,mxArrow),mxCellRenderer.registerShape(mxConstants.SHAPE_DOUBLE_ELLIPSE,mxDoubleEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_SWIMLANE,mxSwimlane),mxCellRenderer.registerShape(mxConstants.SHAPE_IMAGE,mxImageShape),mxCellRenderer.registerShape(mxConstants.SHAPE_LABEL,mxLabel),mxCellRenderer.prototype.initialize=function(e,n){var t=e.view.graph.getModel();null!=e.view.graph.container&&null==e.shape&&e.cell!=e.view.currentRoot&&(t.isVertex(e.cell)||t.isEdge(e.cell))&&(this.createShape(e),null==e.shape||null!=n&&!n||(this.initializeShape(e),e.view.graph.ordered||t.isEdge(e.cell)?e.invalidOrder=!0:e.view.graph.keepEdgesInForeground&&null!=this.firstEdge&&(this.firstEdge.parentNode==e.shape.node.parentNode?this.insertState(e,this.firstEdge):this.firstEdge=null),e.shape.scale=e.view.scale,this.createCellOverlays(e),this.installListeners(e)))},mxCellRenderer.prototype.initializeShape=function(e){e.shape.init(e.view.getDrawPane())},mxCellRenderer.prototype.getPreviousStateInContainer=function(e,n){for(var t=null,a=e.view.graph,i=a.getModel(),s=e.cell,o=i.getParent(s);null!=o&&null==t;)t=this.findPreviousStateInContainer(a,o,s,n),s=o,o=i.getParent(s);return t},mxCellRenderer.prototype.findPreviousStateInContainer=function(e,n,t,a){var i=null,s=e.getModel();for(t=null!=t?n.getIndex(t)-1:s.getChildCount(n)-1;0<=t&&null==i;t--)i=this.findPreviousStateInContainer(e,s.getChildAt(n,t),null,a);return null!=i||(null==(i=e.view.getState(n))||null!=i.shape&&null!=i.shape.node&&i.shape.node.parentNode==a)||(i=null),i},mxCellRenderer.prototype.order=function(e){var n=e.shape.node.parentNode,t=this.getPreviousStateInContainer(e,n),a=n.firstChild;null!=t&&(a=t.shape.node,null!=t.text&&null!=t.text.node&&t.text.node.parentNode==n&&(a=t.text.node),a=a.nextSibling),this.insertState(e,a)},mxCellRenderer.prototype.orderEdge=function(e){var n=(t=e.view).graph.getModel();if(t.graph.keepEdgesInForeground)null!=this.firstEdge&&null!=this.firstEdge.parentNode&&this.firstEdge.parentNode==e.shape.node.parentNode||(this.firstEdge=e.shape.node);else if(t.graph.keepEdgesInBackground){var t,a=e.shape.node,i=a.parentNode;n=n.getParent(e.cell);null!=(i=null!=(t=t.getState(n))&&null!=t.shape&&null!=t.shape.node?t.shape.node.nextSibling:i.firstChild)&&i!=a&&this.insertState(e,i)}},mxCellRenderer.prototype.insertState=function(e,n){e.shape.node.parentNode.insertBefore(e.shape.node,n),null!=e.text&&null!=e.text.node&&e.text.node.parentNode==e.shape.node.parentNode&&e.shape.node.parentNode.insertBefore(e.text.node,e.shape.node.nextSibling)},mxCellRenderer.prototype.createShape=function(e){if(null!=e.style){var n=mxStencilRegistry.getStencil(e.style[mxConstants.STYLE_SHAPE]);null!=n?e.shape=new mxShape(n):(n=this.getShapeConstructor(e),e.shape=new n),e.shape.points=e.absolutePoints,e.shape.bounds=new mxRectangle(e.x,e.y,e.width,e.height),e.shape.dialect=e.view.graph.dialect,this.configureShape(e)}},mxCellRenderer.prototype.getShape=function(e){return null!=e?mxCellRenderer.prototype.defaultShapes[e]:null},mxCellRenderer.prototype.getShapeConstructor=function(e){var n=this.getShape(e.style[mxConstants.STYLE_SHAPE]);return null==n&&(n=e.view.graph.getModel().isEdge(e.cell)?this.defaultEdgeShape:this.defaultVertexShape),n},mxCellRenderer.prototype.configureShape=function(e){e.shape.apply(e),e.shape.image=e.view.graph.getImage(e),e.shape.indicatorShape=this.getShape(e.view.graph.getIndicatorShape(e)),e.shape.indicatorColor=e.view.graph.getIndicatorColor(e),e.shape.indicatorGradientColor=e.view.graph.getIndicatorGradientColor(e),e.shape.indicatorDirection=e.style[mxConstants.STYLE_INDICATOR_DIRECTION],e.shape.indicatorImage=e.view.graph.getIndicatorImage(e),this.postConfigureShape(e)},mxCellRenderer.prototype.postConfigureShape=function(e){null!=e.shape&&(this.resolveColor(e,"indicatorColor",mxConstants.STYLE_FILLCOLOR),this.resolveColor(e,"indicatorGradientColor",mxConstants.STYLE_GRADIENTCOLOR),this.resolveColor(e,"fill",mxConstants.STYLE_FILLCOLOR),this.resolveColor(e,"stroke",mxConstants.STYLE_STROKECOLOR),this.resolveColor(e,"gradient",mxConstants.STYLE_GRADIENTCOLOR))},mxCellRenderer.prototype.resolveColor=function(e,n,t){var a=e.shape[n],i=e.view.graph,s=null;"inherit"==a?s=i.model.getParent(e.cell):"swimlane"==a?(s=null!=i.model.getTerminal(e.cell,!1)?i.model.getTerminal(e.cell,!1):e.cell,s=i.getSwimlane(s),t=i.swimlaneIndicatorColorAttribute):"indicated"==a&&(e.shape[n]=e.shape.indicatorColor),null!=s&&(a=i.getView().getState(s),(e.shape[n]=null)!=a&&(e.shape[n]=null!=a.shape&&"indicatorColor"!=n?a.shape[n]:a.style[t]))},mxCellRenderer.prototype.getLabelValue=function(e){return e.view.graph.getLabel(e.cell)},mxCellRenderer.prototype.createLabel=function(t,e){var a=t.view.graph;if(a.getModel().isEdge(t.cell),0<t.style[mxConstants.STYLE_FONTSIZE]||null==t.style[mxConstants.STYLE_FONTSIZE]){var n=a.isHtmlLabel(t.cell)||null!=e&&mxUtils.isNode(e);t.text=new this.defaultTextShape(e,new mxRectangle,t.style[mxConstants.STYLE_ALIGN]||mxConstants.ALIGN_CENTER,a.getVerticalAlign(t),t.style[mxConstants.STYLE_FONTCOLOR],t.style[mxConstants.STYLE_FONTFAMILY],t.style[mxConstants.STYLE_FONTSIZE],t.style[mxConstants.STYLE_FONTSTYLE],t.style[mxConstants.STYLE_SPACING],t.style[mxConstants.STYLE_SPACING_TOP],t.style[mxConstants.STYLE_SPACING_RIGHT],t.style[mxConstants.STYLE_SPACING_BOTTOM],t.style[mxConstants.STYLE_SPACING_LEFT],t.style[mxConstants.STYLE_HORIZONTAL],t.style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR],t.style[mxConstants.STYLE_LABEL_BORDERCOLOR],a.isWrapping(t.cell)&&a.isHtmlLabel(t.cell),a.isLabelClipped(t.cell),t.style[mxConstants.STYLE_OVERFLOW],t.style[mxConstants.STYLE_LABEL_PADDING]),t.text.opacity=mxUtils.getValue(t.style,mxConstants.STYLE_TEXT_OPACITY,100),t.text.dialect=n?mxConstants.DIALECT_STRICTHTML:t.view.graph.dialect,t.text.state=t,this.initializeLabel(t);var i=!1,s=function(e){var n=t;return(mxClient.IS_TOUCH||i)&&(n=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,n,e),n=a.view.getState(a.getCellAt(e.x,e.y))),n};mxEvent.addGestureListeners(t.text.node,mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,t)),i=a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName)}),mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,s(e)))}),mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,s(e))),i=!1)})),mxEvent.addListener(t.text.node,"dblclick",mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.dblClick(e,t.cell),mxEvent.consume(e))}))}},mxCellRenderer.prototype.initializeLabel=function(e){var n=e.view.graph;e.text.dialect!=mxConstants.DIALECT_SVG&&(mxClient.IS_SVG&&mxClient.NO_FO?e.text.init(n.container):mxUtils.isVml(e.view.getDrawPane())&&(null!=e.shape.label?e.text.init(e.shape.label):e.text.init(e.shape.node))),null==e.text.node&&(e.text.init(e.view.getDrawPane()),null!=e.shape&&null!=e.text&&e.shape.node.parentNode.insertBefore(e.text.node,e.shape.node.nextSibling))},mxCellRenderer.prototype.createCellOverlays=function(e){var n=e.view.graph.getCellOverlays(e.cell),t=null;if(null!=n){t=new mxDictionary;for(var a=0;a<n.length;a++){var i=null!=e.overlays?e.overlays.remove(n[a]):null;null==i&&((i=new mxImageShape(new mxRectangle,n[a].image.src)).dialect=e.view.graph.dialect,i.preserveImageAspect=!1,i.overlay=n[a],this.initializeOverlay(e,i),this.installCellOverlayListeners(e,n[a],i),null!=n[a].cursor&&(i.node.style.cursor=n[a].cursor)),t.put(n[a],i)}}null!=e.overlays&&e.overlays.visit(function(e,n){n.destroy()}),e.overlays=t},mxCellRenderer.prototype.initializeOverlay=function(e,n){n.init(e.view.getOverlayPane())},mxCellRenderer.prototype.installCellOverlayListeners=function(n,t,e){var a=n.view.graph;mxEvent.addListener(e.node,"click",function(e){a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),t.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",n.cell))}),mxEvent.addGestureListeners(e.node,function(e){mxEvent.consume(e)},function(e){a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,n))}),mxClient.IS_TOUCH&&mxEvent.addListener(e.node,"touchend",function(e){t.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",n.cell))})},mxCellRenderer.prototype.createControl=function(t){var a=t.view.graph,e=a.getFoldingImage(t);if(a.foldingEnabled&&null!=e){if(null==t.control){var n=new mxRectangle(0,0,e.width,e.height);t.control=new mxImageShape(n,e.src),t.control.preserveImageAspect=!1,t.control.dialect=a.dialect,this.initControl(t,t.control,!0,function(e){if(a.isEnabled()){var n=!a.isCellCollapsed(t.cell);a.foldCells(n,!1,[t.cell]),mxEvent.consume(e)}})}}else null!=t.control&&(t.control.destroy(),t.control=null)},mxCellRenderer.prototype.initControl=function(n,e,t,a){var i=n.view.graph;return i.isHtmlLabel(n.cell)&&mxClient.NO_FO&&i.dialect==mxConstants.DIALECT_SVG?(e.dialect=mxConstants.DIALECT_PREFERHTML,e.init(i.container),e.node.style.zIndex=1):e.init(n.view.getOverlayPane()),e=e.innerNode||e.node,a&&(i.isEnabled()&&(e.style.cursor="pointer"),mxEvent.addListener(e,"click",a)),t&&mxEvent.addGestureListeners(e,function(e){i.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,n)),mxEvent.consume(e)},function(e){i.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,n))}),e},mxCellRenderer.prototype.isShapeEvent=function(e,n){return!0},mxCellRenderer.prototype.isLabelEvent=function(e,n){return!0},mxCellRenderer.prototype.installListeners=function(t){var a=t.view.graph,n=function(e){var n=t;return(a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName||mxClient.IS_TOUCH)&&(n=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,n,e),n=a.view.getState(a.getCellAt(e.x,e.y))),n},i=!1;mxEvent.addListener(t.shape.node,"gesturestart",mxUtils.bind(this,function(e){a.lastTouchTime=0,i=!0,mxEvent.consume(e)})),mxEvent.addGestureListeners(t.shape.node,mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:t)):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:n(e))):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:n(e))):i&&mxEvent.consume(e)}));var s=mxClient.IS_TOUCH?"gestureend":"dblclick";mxEvent.addListener(t.shape.node,s,mxUtils.bind(this,function(e){i=!1,"gestureend"==s?(a.lastTouchTime=0,a.gestureEnabled&&(a.handleGesture(t,e),mxEvent.consume(e))):this.isShapeEvent(t,e)&&(a.dblClick(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:t.cell),mxEvent.consume(e))}))},mxCellRenderer.prototype.redrawLabel=function(e,n){var t=this.getLabelValue(e);if(null==e.text&&null!=t&&(mxUtils.isNode(t)||0<t.length)?this.createLabel(e,t):null==e.text||null!=t&&0!=t.length||(e.text.destroy(),e.text=null),null!=e.text){var a=(i=e.view.graph).isWrapping(e.cell),i=i.isLabelClipped(e.cell),s=this.getLabelBounds(e);!n&&e.text.value==t&&e.text.isWrapping==a&&e.text.isClipping==i&&e.text.scale==e.view.scale&&e.text.bounds.equals(s)||(e.text.value=t,e.text.bounds=s,e.text.scale=this.getTextScale(e),e.text.isWrapping=a,e.text.isClipping=i,e.text.redraw())}},mxCellRenderer.prototype.getTextScale=function(e){return e.view.scale},mxCellRenderer.prototype.getLabelBounds=function(e){var n=e.view.graph,t=e.view.scale,a=n.getModel().isEdge(e.cell),i=new mxRectangle(e.absoluteOffset.x,e.absoluteOffset.y);return e.text.updateMargin(),a?(a=e.text.getSpacing(),i.x+=a.x*t,i.y+=a.y*t,null!=(n=n.getCellGeometry(e.cell))&&(i.width=Math.max(0,e.text.margin.x*n.width*t-e.text.spacingLeft*t-e.text.spacingRight*t),i.height=Math.max(0,e.text.margin.y*n.height*t-e.text.spacingTop*t-e.text.spacingBottom*t))):(e.text.isPaintBoundsInverted()&&(a=i.x,i.x=i.y,i.y=a),i.x+=e.x,i.y+=e.y,i.width=Math.max(1,e.width),i.height=Math.max(1,e.height),n.isSwimlane(e.cell)&&(0<(n=n.getStartSize(e.cell)).width?(a=Math.min(i.width,n.width*t),e.shape.flipH&&(i.x+=i.width-a),i.width=a):0<n.height&&(a=Math.min(i.height,n.height*t),e.shape.flipV&&(i.y+=i.height-a),i.height=a)),this.rotateLabelBounds(e,i)),i},mxCellRenderer.prototype.rotateLabelBounds=function(e,n){if(e.text.isPaintBoundsInverted()){var t=(e.width-e.height)/2;n.x+=t,n.y-=t,t=n.width,n.width=n.height,n.height=t}if(n.x-=e.text.margin.x*n.width,n.y-=e.text.margin.y*n.height,"fill"!=e.style[mxConstants.STYLE_OVERFLOW]){t=e.view.scale;var a=e.text.getSpacing();n.x+=a.x*t,n.y+=a.y*t,n.width=Math.max(0,n.width-e.text.spacingLeft*t-e.text.spacingRight*t),n.height=Math.max(0,n.height-e.text.spacingTop*t-e.text.spacingBottom*t)}var i=e.text.getTextRotation();0!=i&&null!=e&&e.view.graph.model.isVertex(e.cell)&&(t=e.getCenterX(),a=e.getCenterY(),n.x!=t||n.y!=a)&&(i*=Math.PI/180,pt=mxUtils.getRotatedPoint(new mxPoint(n.x,n.y),Math.cos(i),Math.sin(i),new mxPoint(t,a)),n.x=pt.x,n.y=pt.y)},mxCellRenderer.prototype.redrawCellOverlays=function(s,o){if(this.createCellOverlays(s),null!=s.overlays){var r=mxUtils.mod(mxUtils.getValue(s.style,mxConstants.STYLE_ROTATION,0),90),e=mxUtils.toRadians(r),l=Math.cos(e),d=Math.sin(e);s.overlays.visit(function(e,n){var t=n.overlay.getBounds(s);if(!s.view.graph.getModel().isEdge(s.cell)&&null!=s.shape&&0!=r){var a=t.getCenterX(),i=t.getCenterY();a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),l,d,new mxPoint(s.getCenterX(),s.getCenterY()))).x,i=i.y;t.x=Math.round(a-t.width/2),t.y=Math.round(i-t.height/2)}!o&&null!=n.bounds&&n.scale==s.view.scale&&n.bounds.equals(t)||(n.bounds=t,n.scale=s.view.scale,n.redraw())})}},mxCellRenderer.prototype.redrawControl=function(e,n){if(null!=e.control){var t=this.getControlBounds(e),a=this.legacyControlPosition?mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0):e.shape.getTextRotation(),i=e.view.scale;!n&&e.control.scale==i&&e.control.bounds.equals(t)&&e.control.rotation==a||(e.control.rotation=a,e.control.bounds=t,e.control.scale=i,e.control.redraw())}},mxCellRenderer.prototype.getControlBounds=function(e){if(null==e.control)return null;var n=e.control.scale,t=e.control.bounds.width/n,a=(n=e.control.bounds.height/n,e.view.scale),i=e.getCenterX(),s=e.getCenterY();if(!e.view.graph.getModel().isEdge(e.cell)&&(i=e.x+t*a,s=e.y+n*a,null!=e.shape)){var o=e.shape.getShapeRotation();if(this.legacyControlPosition)o=mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0);else if(e.shape.isPaintBoundsInverted()){var r=(e.width-e.height)/2;i=i+r,s=s-r}0!=o&&(r=mxUtils.toRadians(o),o=Math.cos(r),r=Math.sin(r),i=(s=mxUtils.getRotatedPoint(new mxPoint(i,s),o,r,new mxPoint(e.getCenterX(),e.getCenterY()))).x,s=s.y)}return e.view.graph.getModel().isEdge(e.cell),new mxRectangle(Math.round(i-t/2*a),Math.round(s-n/2*a),Math.round(t*a),Math.round(n*a))},mxCellRenderer.prototype.redraw=function(e,n,t){if(null!=e.shape){var a=!1;e.view.graph.getModel().isEdge(e.cell),reconfigure=null!=n&&n,this.createControl(e),(e.orderChanged||e.invalidOrder)&&(e.view.graph.ordered?this.order(e):this.orderEdge(e)),!e.orderChanged&&mxUtils.equalEntries(e.shape.style,e.style)||(this.configureShape(e),n=!0),delete e.invalidOrder,delete e.orderChanged,!n&&null!=e.shape.bounds&&e.shape.scale==e.view.scale&&e.shape.bounds.equals(e)&&mxUtils.equalPoints(e.shape.points,e.absolutePoints)||(a=!0,e.shape.points=null!=e.absolutePoints?e.absolutePoints.slice():null,e.shape.bounds=new mxRectangle(e.x,e.y,e.width,e.height),e.shape.scale=e.view.scale,null==t||t?e.shape.redraw():e.shape.updateBoundingBox()),(null==t||t)&&(this.redrawLabel(e,a),this.redrawCellOverlays(e,a),this.redrawControl(e,a))}},mxCellRenderer.prototype.destroy=function(e){null!=e.shape&&(null!=e.text&&(e.text.destroy(),e.text=null),null!=e.overlays&&(e.overlays.visit(function(e,n){n.destroy()}),e.overlays=null),null!=e.control&&(e.control.destroy(),e.control=null),e.shape.destroy(),e.shape=null)};var mxEdgeStyle={EntityRelation:function(e,n,t,a,i){var s=e.view,o=s.graph;a=mxUtils.getValue(e.style,mxConstants.STYLE_SEGMENT,mxConstants.ENTITY_SEGMENT)*s.scale;var r=(d=e.absolutePoints)[0],l=d[d.length-1],d=!1;if(null!=r)(n=new mxCellState).x=r.x,n.y=r.y;else{if(null==n)return;var c=mxUtils.getPortConstraints(n,e,!0,mxConstants.DIRECTION_MASK_NONE);c!=mxConstants.DIRECTION_MASK_NONE?d=c==mxConstants.DIRECTION_MASK_WEST:(r=o.getCellGeometry(n.cell)).relative?d=r.x<=.5:null!=t&&(d=t.x+t.width<n.x)}r=!0,null!=l?((t=new mxCellState).x=l.x,t.y=l.y):null!=t&&((c=mxUtils.getPortConstraints(t,e,!1,mxConstants.DIRECTION_MASK_NONE))!=mxConstants.DIRECTION_MASK_NONE?r=c==mxConstants.DIRECTION_MASK_WEST:(e=o.getCellGeometry(t.cell)).relative?r=e.x<=.5:null!=n&&(r=n.x+n.width<t.x)),null!=n&&null!=t&&(e=d?n.x:n.x+n.width,n=s.getRoutingCenterY(n),o=r?t.x:t.x+t.width,t=s.getRoutingCenterY(t),s=new mxPoint(e+(d?-a:a),n),l=new mxPoint(o+(r?-a:a),t),d==r?(a=d?Math.min(e,o)-a:Math.max(e,o)+a,i.push(new mxPoint(a,n)),i.push(new mxPoint(a,t))):(s.x<l.x==d?(a=n+(t-n)/2,i.push(s),i.push(new mxPoint(s.x,a)),i.push(new mxPoint(l.x,a))):i.push(s),i.push(l)))},Loop:function(e,n,t,a,i){if(null!=n){var s=(t=e.view).graph;null!=(a=null!=a&&0<a.length?a[0]:null)&&(a=t.transformControlPoint(e,a),mxUtils.contains(n,a.x,a.y)&&(a=null));var o=0,r=0,l=0,d=0;s=mxUtils.getValue(e.style,mxConstants.STYLE_SEGMENT,s.gridSize)*t.scale;(e=mxUtils.getValue(e.style,mxConstants.STYLE_DIRECTION,mxConstants.DIRECTION_WEST))==mxConstants.DIRECTION_NORTH||e==mxConstants.DIRECTION_SOUTH?(o=t.getRoutingCenterX(n),r=s):(l=t.getRoutingCenterY(n),d=s),null==a||a.x<n.x||a.x>n.x+n.width?null!=a?(o=a.x,d=Math.max(Math.abs(l-a.y),d)):e==mxConstants.DIRECTION_NORTH?l=n.y-2*r:e==mxConstants.DIRECTION_SOUTH?l=n.y+n.height+2*r:o=e==mxConstants.DIRECTION_EAST?n.x-2*d:n.x+n.width+2*d:null!=a&&(o=t.getRoutingCenterX(n),r=Math.max(Math.abs(o-a.x),d),l=a.y,d=0),i.push(new mxPoint(o-r,l-d)),i.push(new mxPoint(o+r,l+d))}},ElbowConnector:function(e,n,t,a,i){var s=null!=a&&0<a.length?a[0]:null,o=!1,r=!1;if(null!=n&&null!=t)if(null!=s){var l=Math.min(n.x,t.x),d=Math.max(n.x+n.width,t.x+t.width),c=(r=Math.min(n.y,t.y),Math.max(n.y+n.height,t.y+t.height));o=(s=e.view.transformControlPoint(e,s)).y<r||s.y>c,r=s.x<l||s.x>d}else(o=(l=Math.max(n.x,t.x))==(d=Math.min(n.x+n.width,t.x+t.width)))||(r=(r=Math.max(n.y,t.y))==(c=Math.min(n.y+n.height,t.y+t.height)));r||!o&&e.style[mxConstants.STYLE_ELBOW]!=mxConstants.ELBOW_VERTICAL?mxEdgeStyle.SideToSide(e,n,t,a,i):mxEdgeStyle.TopToBottom(e,n,t,a,i)},SideToSide:function(e,n,t,a,i){var s=e.view;a=null!=a&&0<a.length?a[0]:null;var o=(r=e.absolutePoints)[0],r=r[r.length-1];null!=a&&(a=s.transformControlPoint(e,a)),null!=o&&((n=new mxCellState).x=o.x,n.y=o.y),null!=r&&((t=new mxCellState).x=r.x,t.y=r.y),null!=n&&null!=t&&(e=Math.max(n.x,t.x),o=Math.min(n.x+n.width,t.x+t.width),e=null!=a?a.x:o+(e-o)/2,o=s.getRoutingCenterY(n),s=s.getRoutingCenterY(t),null!=a&&(a.y>=n.y&&a.y<=n.y+n.height&&(o=a.y),a.y>=t.y&&a.y<=t.y+t.height&&(s=a.y)),!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),!mxUtils.contains(t,e,s)&&!mxUtils.contains(n,e,s)&&i.push(new mxPoint(e,s)),1==i.length&&(null!=a?!mxUtils.contains(t,e,a.y)&&!mxUtils.contains(n,e,a.y)&&i.push(new mxPoint(e,a.y)):(s=Math.max(n.y,t.y),n=Math.min(n.y+n.height,t.y+t.height),i.push(new mxPoint(e,s+(n-s)/2)))))},TopToBottom:function(e,n,t,a,i){var s=e.view;a=null!=a&&0<a.length?a[0]:null;var o=(r=e.absolutePoints)[0],r=r[r.length-1];null!=a&&(a=s.transformControlPoint(e,a)),null!=o&&((n=new mxCellState).x=o.x,n.y=o.y),null!=r&&((t=new mxCellState).x=r.x,t.y=r.y),null!=n&&null!=t&&(o=Math.max(n.y,t.y),r=Math.min(n.y+n.height,t.y+t.height),e=s.getRoutingCenterX(n),null!=a&&a.x>=n.x&&a.x<=n.x+n.width&&(e=a.x),o=null!=a?a.y:r+(o-r)/2,!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),e=null!=a&&a.x>=t.x&&a.x<=t.x+t.width?a.x:s.getRoutingCenterX(t),!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),1==i.length&&(null!=a&&1==i.length?!mxUtils.contains(t,a.x,o)&&!mxUtils.contains(n,a.x,o)&&i.push(new mxPoint(a.x,o)):(s=Math.max(n.x,t.x),n=Math.min(n.x+n.width,t.x+t.width),i.push(new mxPoint(s+(n-s)/2,o)))))},SegmentConnector:function(e,n,t,a,i){var s=e.absolutePoints,o=!0,r=null,l=s[0];null==l&&null!=n?l=new mxPoint(e.view.getRoutingCenterX(n),e.view.getRoutingCenterY(n)):null!=l&&(l=l.clone());var d=s.length-1;if(null!=a&&0<a.length){r=e.view.transformControlPoint(e,a[0]);for(var c=n,m=s[0],u=!1,p=!1,g=(u=r,a.length),v=0;v<2;v++){var h=null!=m&&m.x==u.x,f=null!=m&&m.y==u.y,b=null!=c&&u.y>=c.y&&u.y<=c.y+c.height;c=null!=c&&u.x>=c.x&&u.x<=c.x+c.width,u=f||null==m&&b,p=h||null==m&&c;if(null!=m&&!f&&!h&&(b||c)){o=!b;break}if(p||u){o=u,1==v&&(o=0==a.length%2?u:p);break}c=t,m=s[d],u=e.view.transformControlPoint(e,a[g-1])}for(o&&(null!=s[0]&&s[0].y!=r.y||null==s[0]&&null!=n&&(r.y<n.y||r.y>n.y+n.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[0]&&s[0].x!=r.x||null==s[0]&&null!=n&&(r.x<n.x||r.x>n.x+n.width))&&i.push(new mxPoint(r.x,l.y)),o?l.y=r.y:l.x=r.x,v=0;v<a.length;v++)o=!o,r=e.view.transformControlPoint(e,a[v]),o?l.y=r.y:l.x=r.x,i.push(l.clone())}else r=l,o=!0;if(null==(l=s[d])&&null!=t&&(l=new mxPoint(e.view.getRoutingCenterX(t),e.view.getRoutingCenterY(t))),o&&(null!=s[d]&&s[d].y!=r.y||null==s[d]&&null!=t&&(r.y<t.y||r.y>t.y+t.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[d]&&s[d].x!=r.x||null==s[d]&&null!=t&&(r.x<t.x||r.x>t.x+t.width))&&i.push(new mxPoint(r.x,l.y)),null==s[0]&&null!=n)for(;1<i.length&&mxUtils.contains(n,i[1].x,i[1].y);)i=i.splice(1,1);if(null==s[d]&&null!=t)for(;1<i.length&&mxUtils.contains(t,i[i.length-1].x,i[i.length-1].y);)i=i.splice(i.length-1,1)},orthBuffer:10,dirVectors:[[-1,0],[0,-1],[1,0],[0,1],[-1,0],[0,-1],[1,0]],wayPoints1:[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],routePatterns:[[[513,2308,2081,2562],[513,1090,514,2184,2114,2561],[513,1090,514,2564,2184,2562],[513,2308,2561,1090,514,2568,2308]],[[514,1057,513,2308,2081,2562],[514,2184,2114,2561],[514,2184,2562,1057,513,2564,2184],[514,1057,513,2568,2308,2561]],[[1090,514,1057,513,2308,2081,2562],[2114,2561],[1090,2562,1057,513,2564,2184],[1090,514,1057,513,2308,2561,2568]],[[2081,2562],[1057,513,1090,514,2184,2114,2561],[1057,513,1090,514,2184,2562,2564],[1057,2561,1090,514,2568,2308]]],inlineRoutePatterns:[[null,[2114,2568],null,null],[null,[514,2081,2114,2568],null,null],[null,[2114,2561],null,null],[[2081,2562],[1057,2114,2568],[2184,2562],null]],vertexSeperations:[],limits:[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],LEFT_MASK:32,TOP_MASK:64,RIGHT_MASK:128,BOTTOM_MASK:256,LEFT:1,TOP:2,RIGHT:4,BOTTOM:8,SIDE_MASK:480,CENTER_MASK:512,SOURCE_MASK:1024,TARGET_MASK:2048,VERTEX_MASK:3072,OrthConnector:function(e,n,t,a,i){var s=e.view.graph,o=null!=n&&s.getModel().isEdge(n.cell);s=null!=t&&s.getModel().isEdge(t.cell);if(null!=a&&0<a.length||o||s)mxEdgeStyle.SegmentConnector(e,n,t,a,i);else{var r=(a=e.absolutePoints)[0],l=a[a.length-1];a=null!=n?n.x:r.x;o=null!=n?n.y:r.y;var d=null!=n?n.width:1,c=null!=n?n.height:1,m=null!=t?t.x:l.x,u=null!=t?t.y:l.y,p=null!=t?t.width:1,g=null!=t?t.height:1,v=(s=e.view.scale*mxEdgeStyle.orthBuffer,[mxConstants.DIRECTION_MASK_ALL,mxConstants.DIRECTION_MASK_ALL]);for(null!=n&&(v[0]=mxUtils.getPortConstraints(n,e,!0,mxConstants.DIRECTION_MASK_ALL)),null!=t&&(v[1]=mxUtils.getPortConstraints(t,e,!1,mxConstants.DIRECTION_MASK_ALL)),e=[0,0],a=[[a,o,d,c],[m,u,p,g]],d=0;d<2;d++)mxEdgeStyle.limits[d][1]=a[d][0]-s,mxEdgeStyle.limits[d][2]=a[d][1]-s,mxEdgeStyle.limits[d][4]=a[d][0]+a[d][2]+s,mxEdgeStyle.limits[d][8]=a[d][1]+a[d][3]+s;for(d=a[0][0]+a[0][2]/2-(a[1][0]+a[1][2]/2),c=a[0][1]+a[0][3]/2-(a[1][1]+a[1][3]/2),d<(o=0)?o=c<0?2:1:c<=0&&(o=3,0==d&&(o=2)),(c=null)!=n&&(c=r),n=[[.5,.5],[.5,.5]],d=0;d<2;d++)null!=c&&(n[d][0]=(c.x-a[d][0])/a[d][2],n[d][0]<.01?e[d]=mxConstants.DIRECTION_MASK_WEST:.99<n[d][0]&&(e[d]=mxConstants.DIRECTION_MASK_EAST),n[d][1]=(c.y-a[d][1])/a[d][3],n[d][1]<.01?e[d]=mxConstants.DIRECTION_MASK_NORTH:.99<n[d][1]&&(e[d]=mxConstants.DIRECTION_MASK_SOUTH)),(c=null)!=t&&(c=l);for(d=a[0][1]-(a[1][1]+a[1][3]),c=a[0][0]-(a[1][0]+a[1][2]),m=a[1][1]-(a[0][1]+a[0][3]),u=a[1][0]-(a[0][0]+a[0][2]),mxEdgeStyle.vertexSeperations[1]=Math.max(c-2*s,0),mxEdgeStyle.vertexSeperations[2]=Math.max(d-2*s,0),mxEdgeStyle.vertexSeperations[4]=Math.max(m-2*s,0),mxEdgeStyle.vertexSeperations[3]=Math.max(u-2*s,0),t=[],l=[],(r=[])[0]=u<=c?mxConstants.DIRECTION_MASK_WEST:mxConstants.DIRECTION_MASK_EAST,l[0]=m<=d?mxConstants.DIRECTION_MASK_NORTH:mxConstants.DIRECTION_MASK_SOUTH,r[1]=mxUtils.reversePortConstraints(r[0]),l[1]=mxUtils.reversePortConstraints(l[0]),c=u<=c?c:u,m=m<=d?d:m,p=!(u=[[0,0],[0,0]]),d=0;d<2;d++)0==e[d]&&(0==(r[d]&v[d])&&(r[d]=mxUtils.reversePortConstraints(r[d])),0==(l[d]&v[d])&&(l[d]=mxUtils.reversePortConstraints(l[d])),u[d][0]=l[d],u[d][1]=r[d]);for(2*s<m&&2*s<c&&(0<(r[0]&v[0])&&0<(l[1]&v[1])?(u[0][0]=r[0],u[0][1]=l[0],u[1][0]=l[1],u[1][1]=r[1],p=!0):0<(l[0]&v[0])&&0<(r[1]&v[1])&&(u[0][0]=l[0],u[0][1]=r[0],u[1][0]=r[1],u[1][1]=l[1],p=!0)),2*s<m&&!p&&(u[0][0]=l[0],u[0][1]=r[0],u[1][0]=l[1],u[1][1]=r[1],p=!0),2*s<c&&!p&&(u[0][0]=r[0],u[0][1]=l[0],u[1][0]=r[1],u[1][1]=l[1]),d=0;d<2;d++)0==e[d]&&(0==(u[d][0]&v[d])&&(u[d][0]=u[d][1]),t[d]=u[d][0]&v[d],t[d]|=(u[d][1]&v[d])<<8,t[d]|=(u[1-d][d]&v[d])<<16,t[d]|=(u[1-d][1-d]&v[d])<<24,0==(15&t[d])&&(t[d]<<=8),0==(3840&t[d])&&(t[d]=15&t[d]|t[d]>>8),0==(983040&t[d])&&(t[d]=65535&t[d]|(251658240&t[d])>>8),e[d]=15&t[d],v[d]==mxConstants.DIRECTION_MASK_WEST||v[d]==mxConstants.DIRECTION_MASK_NORTH||v[d]==mxConstants.DIRECTION_MASK_EAST||v[d]==mxConstants.DIRECTION_MASK_SOUTH)&&(e[d]=v[d]);switch(d=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0],v=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(d-=o)<1&&(d+=4),(v-=o)<1&&(v+=4),v=mxEdgeStyle.routePatterns[d-1][v-1],mxEdgeStyle.wayPoints1[0][0]=a[0][0],mxEdgeStyle.wayPoints1[0][1]=a[0][1],e[0]){case mxConstants.DIRECTION_MASK_WEST:mxEdgeStyle.wayPoints1[0][0]-=s,mxEdgeStyle.wayPoints1[0][1]+=n[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_SOUTH:mxEdgeStyle.wayPoints1[0][0]+=n[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]+=a[0][3]+s;break;case mxConstants.DIRECTION_MASK_EAST:mxEdgeStyle.wayPoints1[0][0]+=a[0][2]+s,mxEdgeStyle.wayPoints1[0][1]+=n[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_NORTH:mxEdgeStyle.wayPoints1[0][0]+=n[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]-=s}for(r=t=(s=0)<(e[0]&(mxConstants.DIRECTION_MASK_EAST|mxConstants.DIRECTION_MASK_WEST))?0:1,d=l=0;d<v.length;d++){g=(l=15&v[d])==mxConstants.DIRECTION_MASK_EAST?3:l,4<(g+=o)&&(g-=4),c=mxEdgeStyle.dirVectors[g-1],(l=0<g%2?0:1)!=t&&(s++,mxEdgeStyle.wayPoints1[s][0]=mxEdgeStyle.wayPoints1[s-1][0],mxEdgeStyle.wayPoints1[s][1]=mxEdgeStyle.wayPoints1[s-1][1]);var h=0<(v[d]&mxEdgeStyle.TARGET_MASK);p=0<(v[d]&mxEdgeStyle.SOURCE_MASK);15<(m=(m=(v[d]&mxEdgeStyle.SIDE_MASK)>>5)<<o)&&(m>>=4),u=0<(v[d]&mxEdgeStyle.CENTER_MASK),(p||h)&&m<9?(g=0,p=p?0:1,g=u&&0==l?a[p][0]+n[p][0]*a[p][2]:u?a[p][1]+n[p][1]*a[p][3]:mxEdgeStyle.limits[p][m],0==l?0<(m=(g-mxEdgeStyle.wayPoints1[s][0])*c[0])&&(mxEdgeStyle.wayPoints1[s][0]+=c[0]*m):0<(m=(g-mxEdgeStyle.wayPoints1[s][1])*c[1])&&(mxEdgeStyle.wayPoints1[s][1]+=c[1]*m)):u&&(mxEdgeStyle.wayPoints1[s][0]+=c[0]*Math.abs(mxEdgeStyle.vertexSeperations[g]/2),mxEdgeStyle.wayPoints1[s][1]+=c[1]*Math.abs(mxEdgeStyle.vertexSeperations[g]/2)),0<s&&mxEdgeStyle.wayPoints1[s][l]==mxEdgeStyle.wayPoints1[s-1][l]?s--:t=l}for(d=0;d<=s&&(d!=s||((0<(e[1]&(mxConstants.DIRECTION_MASK_EAST|mxConstants.DIRECTION_MASK_WEST))?0:1)==r?0:1)==(s+1)%2);d++)i.push(new mxPoint(mxEdgeStyle.wayPoints1[d][0],mxEdgeStyle.wayPoints1[d][1]))}},getRoutePattern:function(e,n,t,a){var i=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0];return e=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(i-=n)<1&&(i+=4),(e-=n)<1&&(e+=4),n=routePatterns[i-1][e-1],0!=t&&0!=a||null!=inlineRoutePatterns[i-1][e-1]&&(n=inlineRoutePatterns[i-1][e-1]),n}},mxStyleRegistry={values:[],putValue:function(e,n){mxStyleRegistry.values[e]=n},getValue:function(e){return mxStyleRegistry.values[e]},getName:function(e){for(var n in mxStyleRegistry.values)if(mxStyleRegistry.values[n]==e)return n;return null}};function mxGraphView(e){this.graph=e,this.translate=new mxPoint,this.graphBounds=new mxRectangle,this.states=new mxDictionary}function mxCurrentRootChange(e,n){if(this.view=e,this.previous=this.root=n,this.isUp=null==n,!this.isUp)for(var t=this.view.currentRoot,a=this.view.graph.getModel();null!=t;){if(t==n){this.isUp=!0;break}t=a.getParent(t)}}function mxGraph(e,n,t,a){this.mouseListeners=null,this.renderHint=t,this.dialect=mxClient.IS_SVG?mxConstants.DIALECT_SVG:t==mxConstants.RENDERING_HINT_EXACT&&mxClient.IS_VML?mxConstants.DIALECT_VML:t==mxConstants.RENDERING_HINT_FASTEST?mxConstants.DIALECT_STRICTHTML:t==mxConstants.RENDERING_HINT_FASTER?mxConstants.DIALECT_PREFERHTML:mxConstants.DIALECT_MIXEDHTML,this.model=null!=n?n:new mxGraphModel,this.multiplicities=[],this.imageBundles=[],this.cellRenderer=this.createCellRenderer(),this.setSelectionModel(this.createSelectionModel()),this.setStylesheet(null!=a?a:this.createStylesheet()),this.view=this.createGraphView(),this.graphModelChangeListener=mxUtils.bind(this,function(e,n){this.graphModelChanged(n.getProperty("edit").changes)}),this.model.addListener(mxEvent.CHANGE,this.graphModelChangeListener),this.createHandlers(),null!=e&&this.init(e),this.view.revalidate()}function mxCellOverlay(e,n,t,a,i,s){this.image=e,this.tooltip=n,this.align=null!=t?t:this.align,this.verticalAlign=null!=a?a:this.verticalAlign,this.offset=null!=i?i:new mxPoint,this.cursor=null!=s?s:"help"}function mxOutline(e,n){this.source=e,null!=n&&this.init(n)}function mxMultiplicity(e,n,t,a,i,s,o,r,l,d){this.source=e,this.type=n,this.attr=t,this.value=a,this.min=null!=i?i:0,this.max=null!=s?s:"n",this.validNeighbors=o,this.countError=mxResources.get(r)||r,this.typeError=mxResources.get(l)||l,this.validNeighborsAllowed=null==d||d}function mxLayoutManager(e){this.undoHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.beforeUndo(n.getProperty("edit"))}),this.moveHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsMoved(n.getProperty("cells"),n.getProperty("event"))}),this.setGraph(e)}function mxSpaceManager(e,n,t,a){this.resizeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.foldHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.shiftRightwards=null==n||n,this.shiftDownwards=null==t||t,this.extendParents=null==a||a,this.setGraph(e)}function mxSwimlaneManager(e,n,t,a){this.horizontal=null==n||n,this.addEnabled=null==t||t,this.resizeEnabled=null==a||a,this.addHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.isAddEnabled()&&this.cellsAdded(n.getProperty("cells"))}),this.resizeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.isResizeEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.setGraph(e)}function mxTemporaryCellStates(e,n,t){if(this.view=e,n=null!=n?n:1,this.oldBounds=e.getGraphBounds(),this.oldStates=e.getStates(),this.oldScale=e.getScale(),e.setStates(new mxDictionary),e.setScale(n),null!=t){n=e.createState(new mxCell);for(var a=0;a<t.length;a++)e.validateBounds(n,t[a]);var i=null;for(a=0;a<t.length;a++){var s=e.validatePoints(n,t[a]);null==i?i=s:i.add(s)}null==i&&(i=new mxRectangle),e.setGraphBounds(i)}}function mxCellStatePreview(e){this.graph=e,this.deltas={}}function mxConnectionConstraint(e,n){this.point=e,this.perimeter=null==n||n}function mxGraphHandler(e){this.graph=e,this.graph.addMouseListener(this),this.panHandler=mxUtils.bind(this,function(){this.updatePreviewShape()}),this.graph.addListener(mxEvent.PAN,this.panHandler)}function mxPanningHandler(e,n){null!=e&&(this.graph=e,this.factoryMethod=n,this.graph.addMouseListener(this),this.init())}function mxCellMarker(e,n,t,a){mxEventSource.call(this),null!=e&&(this.graph=e,this.validColor=null!=n?n:mxConstants.DEFAULT_VALID_COLOR,this.invalidColor=null!=n?t:mxConstants.DEFAULT_INVALID_COLOR,this.hotspot=null!=a?a:mxConstants.DEFAULT_HOTSPOT,this.highlight=new mxCellHighlight(e))}function mxSelectionCellsHandler(e){mxEventSource.call(this),this.graph=e,this.handlers=new mxDictionary,this.graph.addMouseListener(this),this.refreshHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.refresh()}),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,this.refreshHandler),this.graph.getModel().addListener(mxEvent.CHANGE,this.refreshHandler),this.graph.getView().addListener(mxEvent.SCALE,this.refreshHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.refreshHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.refreshHandler),this.graph.getView().addListener(mxEvent.DOWN,this.refreshHandler),this.graph.getView().addListener(mxEvent.UP,this.refreshHandler)}function mxConnectionHandler(e,n){mxEventSource.call(this),null!=e&&(this.graph=e,this.factoryMethod=n,this.init())}function mxConstraintHandler(e){this.graph=e}function mxRubberband(e){null!=e&&(this.graph=e,this.graph.addMouseListener(this),this.panHandler=mxUtils.bind(this,function(){this.repaint()}),this.graph.addListener(mxEvent.PAN,this.panHandler),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}function mxVertexHandler(e){null!=e&&(this.state=e,this.init())}function mxEdgeHandler(e){null!=e&&(this.state=e,this.init())}function mxElbowEdgeHandler(e){mxEdgeHandler.call(this,e)}function mxEdgeSegmentHandler(e){mxEdgeHandler.call(this,e)}function mxKeyHandler(e,n){null!=e&&(this.graph=e,this.target=n||document.documentElement,this.normalKeys=[],this.shiftKeys=[],this.controlKeys=[],this.controlShiftKeys=[],mxEvent.addListener(this.target,"keydown",mxUtils.bind(this,function(e){this.keyDown(e)})),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}function mxTooltipHandler(e,n){null!=e&&(this.graph=e,this.delay=n||500,this.graph.addMouseListener(this))}function mxCellTracker(e,n,t){mxCellMarker.call(this,e,n),this.graph.addMouseListener(this),null!=t&&(this.getCell=t),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()}))}function mxCellHighlight(e,n,t,a){null!=e&&(this.graph=e,this.highlightColor=null!=n?n:mxConstants.DEFAULT_VALID_COLOR,this.strokeWidth=null!=t?t:mxConstants.HIGHLIGHT_STROKEWIDTH,this.dashed=null!=a&&a,this.repaintHandler=mxUtils.bind(this,function(){this.repaint()}),this.graph.getView().addListener(mxEvent.SCALE,this.repaintHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.repaintHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.repaintHandler),this.graph.getModel().addListener(mxEvent.CHANGE,this.repaintHandler),this.resetHandler=mxUtils.bind(this,function(){this.hide()}),this.graph.getView().addListener(mxEvent.DOWN,this.resetHandler),this.graph.getView().addListener(mxEvent.UP,this.resetHandler))}function mxDefaultKeyHandler(n){if(null!=n){this.editor=n,this.handler=new mxKeyHandler(n.graph);var t=this.handler.escape;this.handler.escape=function(e){t.apply(this,arguments),n.hideProperties(),n.fireEvent(new mxEventObject(mxEvent.ESCAPE,"event",e))}}}function mxDefaultPopupMenu(e){this.config=e}function mxDefaultToolbar(e,n){this.editor=n,null!=e&&null!=n&&this.init(e)}function mxEditor(e){this.actions=[],this.addActions(),null!=document.body&&(this.cycleAttributeValues=[],this.popupHandler=new mxDefaultPopupMenu,this.undoManager=new mxUndoManager,this.graph=this.createGraph(),this.toolbar=this.createToolbar(),this.keyHandler=new mxDefaultKeyHandler(this),this.configure(e),this.graph.swimlaneIndicatorColorAttribute=this.cycleAttributeName,!mxClient.IS_LOCAL&&null!=this.urlInit&&(this.session=this.createSession()),null!=this.onInit&&this.onInit(),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ELBOW,mxEdgeStyle.ElbowConnector),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ENTITY_RELATION,mxEdgeStyle.EntityRelation),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_LOOP,mxEdgeStyle.Loop),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_SIDETOSIDE,mxEdgeStyle.SideToSide),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_TOPTOBOTTOM,mxEdgeStyle.TopToBottom),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ORTHOGONAL,mxEdgeStyle.OrthConnector),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_SEGMENT,mxEdgeStyle.SegmentConnector),mxStyleRegistry.putValue(mxConstants.PERIMETER_ELLIPSE,mxPerimeter.EllipsePerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_RECTANGLE,mxPerimeter.RectanglePerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_RHOMBUS,mxPerimeter.RhombusPerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_TRIANGLE,mxPerimeter.TrianglePerimeter),mxGraphView.prototype=new mxEventSource,mxGraphView.prototype.constructor=mxGraphView,mxGraphView.prototype.EMPTY_POINT=new mxPoint,mxGraphView.prototype.doneResource="none"!=mxClient.language?"done":"",mxGraphView.prototype.updatingDocumentResource="none"!=mxClient.language?"updatingDocument":"",mxGraphView.prototype.allowEval=!1,mxGraphView.prototype.captureDocumentGesture=!0,mxGraphView.prototype.optimizeVmlReflows=!0,mxGraphView.prototype.rendering=!0,mxGraphView.prototype.graph=null,mxGraphView.prototype.currentRoot=null,mxGraphView.prototype.graphBounds=null,mxGraphView.prototype.scale=1,mxGraphView.prototype.translate=null,mxGraphView.prototype.updateStyle=!1,mxGraphView.prototype.getGraphBounds=function(){return this.graphBounds},mxGraphView.prototype.setGraphBounds=function(e){this.graphBounds=e},mxGraphView.prototype.getBounds=function(e){var n=null;if(null!=e&&0<e.length)for(var t=this.graph.getModel(),a=0;a<e.length;a++)if(t.isVertex(e[a])||t.isEdge(e[a])){var i=this.getState(e[a]);null!=i&&(null==n?n=new mxRectangle(i.x,i.y,i.width,i.height):n.add(i))}return n},mxGraphView.prototype.setCurrentRoot=function(e){if(this.currentRoot!=e){var n=new mxCurrentRootChange(this,e);n.execute();var t=new mxUndoableEdit(this,!1);t.add(n),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",t)),this.graph.sizeDidChange()}return e},mxGraphView.prototype.scaleAndTranslate=function(e,n,t){var a=this.scale,i=new mxPoint(this.translate.x,this.translate.y);this.scale==e&&this.translate.x==n&&this.translate.y==t||(this.scale=e,this.translate.x=n,this.translate.y=t,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE_AND_TRANSLATE,"scale",e,"previousScale",a,"translate",this.translate,"previousTranslate",i))},mxGraphView.prototype.getScale=function(){return this.scale},mxGraphView.prototype.setScale=function(e){var n=this.scale;this.scale!=e&&(this.scale=e,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE,"scale",e,"previousScale",n))},mxGraphView.prototype.getTranslate=function(){return this.translate},mxGraphView.prototype.setTranslate=function(e,n){var t=new mxPoint(this.translate.x,this.translate.y);this.translate.x==e&&this.translate.y==n||(this.translate.x=e,this.translate.y=n,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.TRANSLATE,"translate",this.translate,"previousTranslate",t))},mxGraphView.prototype.refresh=function(){null!=this.currentRoot&&this.clear(),this.revalidate()},mxGraphView.prototype.revalidate=function(){this.invalidate(),this.validate()},mxGraphView.prototype.clear=function(e,n,t){var a=this.graph.getModel();if(e=e||a.getRoot(),n=null!=n&&n,t=null==t||t,this.removeState(e),t&&(n||e!=this.currentRoot)){t=a.getChildCount(e);for(var i=0;i<t;i++)this.clear(a.getChildAt(e,i),n)}else this.invalidate(e)},mxGraphView.prototype.invalidate=function(e,n,t,a){var i=this.graph.getModel();if(e=e||i.getRoot(),n=null==n||n,t=null==t||t,a=null!=a&&a,null!=(o=this.getState(e))&&(o.invalid=!0,a&&(o.orderChanged=!0)),n)for(var s=i.getChildCount(e),o=0;o<s;o++){var r=i.getChildAt(e,o);this.invalidate(r,n,t,a)}if(t)for(a=i.getEdgeCount(e),o=0;o<a;o++)this.invalidate(i.getEdgeAt(e,o),n,t)},mxGraphView.prototype.validate=function(e){var n=mxLog.enter("mxGraphView.validate");window.status=mxResources.get(this.updatingDocumentResource)||this.updatingDocumentResource;var t=null;if(this.optimizeVmlReflows&&null!=this.canvas&&null==this.textDiv&&(8==document.documentMode||mxClient.IS_QUIRKS)){t=this.canvas.style.display,this.canvas.style.display="none";var a=document.createElement("div");a.style.position="absolute",a.style.whiteSpace="nowrap",a.style.visibility="hidden",a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",document.body.appendChild(a),this.textDiv=a}e=e||(null!=this.currentRoot?this.currentRoot:this.graph.getModel().getRoot()),this.validateBounds(null,e),null==(e=this.validatePoints(null,e))&&(e=new mxRectangle),this.setGraphBounds(e),this.validateBackground(),null!=t&&(this.canvas.style.display=t,document.body.removeChild(this.textDiv),this.textDiv=null),window.status=mxResources.get(this.doneResource)||this.doneResource,mxLog.leave("mxGraphView.validate",n)},mxGraphView.prototype.createBackgroundPageShape=function(e){return new mxRectangleShape(e,"white","black")},mxGraphView.prototype.validateBackground=function(){var e=this.graph.getBackgroundImage();if(null!=e){if(null==this.backgroundImage||this.backgroundImage.image!=e.src){null!=this.backgroundImage&&this.backgroundImage.destroy();var n=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(n,e.src),this.backgroundImage.dialect=this.graph.dialect,this.backgroundImage.init(this.backgroundPane),this.backgroundImage.redraw()}this.redrawBackgroundImage(this.backgroundImage,e)}else null!=this.backgroundImage&&(this.backgroundImage.destroy(),this.backgroundImage=null);this.graph.pageVisible?(n=this.getBackgroundPageBounds(),null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(n),this.backgroundPageShape.scale=this.scale,this.backgroundPageShape.isShadow=!0,this.backgroundPageShape.dialect=this.graph.dialect,this.backgroundPageShape.init(this.backgroundPane),this.backgroundPageShape.redraw(),mxEvent.addListener(this.backgroundPageShape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e)})),mxEvent.addGestureListeners(this.backgroundPageShape.node,mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){null!=this.graph.tooltipHandler&&this.graph.tooltipHandler.isHideOnHover()&&this.graph.tooltipHandler.hide(),this.graph.isMouseDown&&!mxEvent.isConsumed(e)&&this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}))):(this.backgroundPageShape.scale=this.scale,this.backgroundPageShape.bounds=n,this.backgroundPageShape.redraw())):null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.graph.pageFormat,n=this.scale*this.graph.pageScale;return new mxRectangle(this.scale*this.translate.x,this.scale*this.translate.y,e.width*n,e.height*n)},mxGraphView.prototype.redrawBackgroundImage=function(e,n){e.scale=this.scale,e.bounds.x=this.scale*this.translate.x,e.bounds.y=this.scale*this.translate.y,e.bounds.width=this.scale*n.width,e.bounds.height=this.scale*n.height,e.redraw()},mxGraphView.prototype.validateBounds=function(e,n){var t=this.graph.getModel(),a=this.getState(n,!0);if(null!=a&&a.invalid){if(this.graph.isCellVisible(n)){if(n!=this.currentRoot&&null!=e)if(a.absoluteOffset.x=0,a.absoluteOffset.y=0,a.origin.x=e.origin.x,a.origin.y=e.origin.y,null!=(s=this.graph.getCellGeometry(n))){if(!t.isEdge(n)){var i=s.offset||this.EMPTY_POINT;s.relative?(a.origin.x+=s.x*e.width/this.scale+i.x,a.origin.y+=s.y*e.height/this.scale+i.y):(a.absoluteOffset.x=this.scale*i.x,a.absoluteOffset.y=this.scale*i.y,a.origin.x+=s.x,a.origin.y+=s.y)}if(a.x=this.scale*(this.translate.x+a.origin.x),a.y=this.scale*(this.translate.y+a.origin.y),a.width=this.scale*s.width,a.height=this.scale*s.height,t.isVertex(n)){if(s.relative&&0!=(i=mxUtils.toRadians(e.style[mxConstants.STYLE_ROTATION]||"0"))){var s=Math.cos(i),o=(i=Math.sin(i),new mxPoint(a.getCenterX(),a.getCenterY())),r=new mxPoint(e.getCenterX(),e.getCenterY());s=mxUtils.getRotatedPoint(o,s,i,r);a.x=s.x-a.width/2,a.y=s.y-a.height/2}this.updateVertexLabelOffset(a)}}}else this.removeState(n);null!=(i=this.graph.getChildOffsetForCell(n))&&(a.origin.x+=i.x,a.origin.y+=i.y)}if(null!=a&&(!this.graph.isCellCollapsed(n)||n==this.currentRoot))for(s=t.getChildCount(n),i=0;i<s;i++)o=t.getChildAt(n,i),this.validateBounds(a,o)},mxGraphView.prototype.updateVertexLabelOffset=function(e){var n=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER);n==mxConstants.ALIGN_LEFT?e.absoluteOffset.x-=e.width:n==mxConstants.ALIGN_RIGHT&&(e.absoluteOffset.x+=e.width),(n=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?e.absoluteOffset.y-=e.height:n==mxConstants.ALIGN_BOTTOM&&(e.absoluteOffset.y+=e.height)},mxGraphView.prototype.validatePoints=function(e,n){var t=this.graph.getModel(),a=this.getState(n),i=null;if(null!=a){if(a.invalid){var s=this.graph.getCellGeometry(n);if(null!=s&&t.isEdge(n)){var o=this.getState(this.getVisibleTerminal(n,!0));if(a.setVisibleTerminalState(o,!0),null!=o&&t.isEdge(o.cell)&&!t.isAncestor(o.cell,n)){var r=this.getState(t.getParent(o.cell));this.validatePoints(r,o.cell)}var l=this.getState(this.getVisibleTerminal(n,!1));a.setVisibleTerminalState(l,!1),null!=l&&t.isEdge(l.cell)&&!t.isAncestor(l.cell,n)&&(r=this.getState(t.getParent(l.cell)),this.validatePoints(r,l.cell)),this.updateFixedTerminalPoints(a,o,l),this.updatePoints(a,s.points,o,l),this.updateFloatingTerminalPoints(a,o,l),this.updateEdgeBounds(a),this.updateEdgeLabelOffset(a)}else null!=s&&s.relative&&null!=e&&t.isEdge(e.cell)&&(null!=(s=this.getPoint(e,s))&&(a.x=s.x,a.y=s.y,s.x=s.x/this.scale-this.translate.x,s.y=s.y/this.scale-this.translate.y,a.origin=s,this.childMoved(e,a)));a.invalid=!1,n!=this.currentRoot&&this.graph.cellRenderer.redraw(a,!1,this.isRendering())}(t.isEdge(n)||t.isVertex(n))&&(null!=a.shape&&null!=a.shape.boundingBox&&(i=a.shape.boundingBox.clone()),null!=a.text&&!this.graph.isLabelClipped(a.cell)&&null!=a.text.boundingBox&&(null!=i?i.add(a.text.boundingBox):i=a.text.boundingBox.clone()))}if(null!=a&&(!this.graph.isCellCollapsed(n)||n==this.currentRoot))for(s=t.getChildCount(n),o=0;o<s;o++)r=t.getChildAt(n,o),null!=(r=this.validatePoints(a,r))&&(null==i?i=r:i.add(r));return i},mxGraphView.prototype.childMoved=function(e,n){var t=n.cell;if(!this.graph.isCellCollapsed(t)||t==this.currentRoot)for(var a=this.graph.getModel(),i=a.getChildCount(t),s=0;s<i;s++)this.validateBounds(n,a.getChildAt(t,s))},mxGraphView.prototype.updateFixedTerminalPoints=function(e,n,t){this.updateFixedTerminalPoint(e,n,!0,this.graph.getConnectionConstraint(e,n,!0)),this.updateFixedTerminalPoint(e,t,!1,this.graph.getConnectionConstraint(e,t,!1))},mxGraphView.prototype.updateFixedTerminalPoint=function(e,n,t,a){var i=null;if(null!=a&&(i=this.graph.getConnectionPoint(n,a)),null==i&&null==n){n=this.scale,a=this.translate;var s=e.origin;null!=(i=this.graph.getCellGeometry(e.cell).getTerminalPoint(t))&&(i=new mxPoint(n*(a.x+i.x+s.x),n*(a.y+i.y+s.y)))}e.setAbsoluteTerminalPoint(i,t)},mxGraphView.prototype.updatePoints=function(e,n,t,a){if(null!=e){var i=[];i.push(e.absolutePoints[0]);var s=this.getEdgeStyle(e,n,t,a);if(null!=s)s(e,t=this.getTerminalPort(e,t,!0),a=this.getTerminalPort(e,a,!1),n,i);else if(null!=n)for(s=0;s<n.length;s++)null!=n[s]&&(a=mxUtils.clone(n[s]),i.push(this.transformControlPoint(e,a)));n=e.absolutePoints,i.push(n[n.length-1]),e.absolutePoints=i}},mxGraphView.prototype.transformControlPoint=function(e,n){var t=e.origin;return new mxPoint(this.scale*(n.x+this.translate.x+t.x),this.scale*(n.y+this.translate.y+t.y))},mxGraphView.prototype.getEdgeStyle=function(e,n,t,a){return"string"==typeof(e=null!=t&&t==a?mxUtils.getValue(e.style,mxConstants.STYLE_LOOP,this.graph.defaultLoopStyle):mxUtils.getValue(e.style,mxConstants.STYLE_NOEDGESTYLE,!1)?null:e.style[mxConstants.STYLE_EDGE])&&(null==(n=mxStyleRegistry.getValue(e))&&this.isAllowEval()&&(n=mxUtils.eval(e)),e=n),"function"==typeof e?e:null},mxGraphView.prototype.updateFloatingTerminalPoints=function(e,n,t){var a=e.absolutePoints,i=a[0];null==a[a.length-1]&&null!=t&&this.updateFloatingTerminalPoint(e,t,n,!1),null==i&&null!=n&&this.updateFloatingTerminalPoint(e,n,t,!0)},mxGraphView.prototype.updateFloatingTerminalPoint=function(e,n,t,a){n=this.getTerminalPort(e,n,a);var i=this.getNextPoint(e,t,a),s=this.graph.isOrthogonal(e);t=mxUtils.toRadians(Number(n.style[mxConstants.STYLE_ROTATION]||"0"));var o=new mxPoint(n.getCenterX(),n.getCenterY());if(0!=t){var r=Math.cos(-t),l=Math.sin(-t);i=mxUtils.getRotatedPoint(i,r,l,o)}r=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0),r+=parseFloat(e.style[a?mxConstants.STYLE_SOURCE_PERIMETER_SPACING:mxConstants.STYLE_TARGET_PERIMETER_SPACING]||0),n=this.getPerimeterPoint(n,i,0==t&&s,r),0!=t&&(r=Math.cos(t),l=Math.sin(t),n=mxUtils.getRotatedPoint(n,r,l,o)),e.setAbsoluteTerminalPoint(n,a)},mxGraphView.prototype.getTerminalPort=function(e,n,t){return null!=(e=mxUtils.getValue(e.style,t?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT))&&(null!=(e=this.getState(this.graph.getModel().getCell(e)))&&(n=e)),n},mxGraphView.prototype.getPerimeterPoint=function(e,n,t,a){var i=null;if(null!=e){var s=this.getPerimeterFunction(e);null!=s&&null!=n&&(0<(a=this.getPerimeterBounds(e,a)).width||0<a.height)&&(i=s(a,e,n,t)),null==i&&(i=this.getPoint(e))}return i},mxGraphView.prototype.getRoutingCenterX=function(e){var n=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_X])||0;return e.getCenterX()+n*e.width},mxGraphView.prototype.getRoutingCenterY=function(e){var n=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_Y])||0;return e.getCenterY()+n*e.height},mxGraphView.prototype.getPerimeterBounds=function(e,n){return n=null!=n?n:0,null!=e&&(n+=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0)),e.getPerimeterBounds(n*this.scale)},mxGraphView.prototype.getPerimeterFunction=function(e){if("string"==typeof(e=e.style[mxConstants.STYLE_PERIMETER])){var n=mxStyleRegistry.getValue(e);null==n&&this.isAllowEval()&&(n=mxUtils.eval(e)),e=n}return"function"==typeof e?e:null},mxGraphView.prototype.getNextPoint=function(e,n,t){var a=null;return null!=(e=e.absolutePoints)&&(t||2<e.length||null==n)&&(a=e.length,a=e[t?Math.min(1,a-1):Math.max(0,a-2)]),null==a&&null!=n&&(a=new mxPoint(n.getCenterX(),n.getCenterY())),a},mxGraphView.prototype.getVisibleTerminal=function(e,n){for(var t=this.graph.getModel(),a=t.getTerminal(e,n),i=a;null!=a&&a!=this.currentRoot;)this.graph.isCellVisible(i)&&!this.graph.isCellCollapsed(a)||(i=a),a=t.getParent(a);return t.getParent(i)==t.getRoot()&&(i=null),i},mxGraphView.prototype.updateEdgeBounds=function(e){var n=e.absolutePoints;if(e.length=0,null!=n&&0<n.length){var t=n[0],a=n[n.length-1];if(null==t||null==a)e.cell!=this.currentRoot&&this.clear(e.cell,!0);else{if(t.x!=a.x||t.y!=a.y){var i=a.x-t.x,s=a.y-t.y;e.terminalDistance=Math.sqrt(i*i+s*s)}else e.terminalDistance=0;a=0;var o=[];if(null!=(s=t)){t=s.x;for(var r=s.y,l=t,d=r,c=1;c<n.length;c++){var m=n[c];null!=m&&(i=s.x-m.x,s=s.y-m.y,i=Math.sqrt(i*i+s*s),o.push(i),a+=i,s=m,t=Math.min(s.x,t),r=Math.min(s.y,r),l=Math.max(s.x,l),d=Math.max(s.y,d))}e.length=a,e.segments=o,e.x=t,e.y=r,e.width=Math.max(1,l-t),e.height=Math.max(1,d-r)}}}},mxGraphView.prototype.getPoint=function(e,n){var t=e.getCenterX(),a=e.getCenterY();if(null==e.segments||null!=n&&!n.relative)null!=n&&(null!=(d=n.offset)&&(t+=d.x,a+=d.y));else{for(var i=e.absolutePoints.length,s=(.5+(null!=n?n.x/2:0))*e.length,o=e.segments[0],r=0,l=1;r+o<s&&l<i-1;)r+=o,o=e.segments[l++];if(i=0==o?0:(s-r)/o,s=e.absolutePoints[l-1],l=e.absolutePoints[l],null!=s&&null!=l){if(r=t=a=0,null!=n){a=n.y;var d=n.offset;null!=d&&(t=d.x,r=d.y)}d=l.x-s.x,l=l.y-s.y,t=s.x+d*i+((0==o?0:l/o)*a+t)*this.scale,a=s.y+l*i-((0==o?0:d/o)*a-r)*this.scale}}return new mxPoint(t,a)},mxGraphView.prototype.getRelativePoint=function(e,n,t){if(null!=(i=this.graph.getModel().getGeometry(e.cell))){var a=e.absolutePoints.length;if(i.relative&&1<a){for(var i=e.length,s=e.segments,o=e.absolutePoints[0],r=e.absolutePoints[1],l=mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t),d=0,c=0,m=0,u=2;u<a;u++)c+=s[u-2],r=e.absolutePoints[u],(o=mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t))<=l&&(l=o,d=u-1,m=c),o=r;return a=s[d],o=e.absolutePoints[d],l=(r=e.absolutePoints[d+1]).x,s=r.y,s=(l=(e=o.x-l)-(l=n-l))*e+(s=(d=o.y-s)-(s=t-s))*d,a<(e=Math.sqrt(s<=0?0:s*s/(e*e+d*d)))&&(e=a),a=Math.sqrt(mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t)),-1==mxUtils.relativeCcw(o.x,o.y,r.x,r.y,n,t)&&(a=-a),new mxPoint((i/2-m-e)/i*-2,a/this.scale)}}return new mxPoint},mxGraphView.prototype.updateEdgeLabelOffset=function(e){var n=e.absolutePoints;if(e.absoluteOffset.x=e.getCenterX(),e.absoluteOffset.y=e.getCenterY(),null!=n&&0<n.length&&null!=e.segments)if((i=this.graph.getCellGeometry(e.cell)).relative){null!=(t=this.getPoint(e,i))&&(e.absoluteOffset=t)}else{var t=n[0],a=n[n.length-1];if(null!=t&&null!=a){n=a.x-t.x;var i,s=a.y-t.y,o=a=0;null!=(i=i.offset)&&(a=i.x,o=i.y),i=t.y+s/2+o*this.scale,e.absoluteOffset.x=t.x+n/2+a*this.scale,e.absoluteOffset.y=i}}},mxGraphView.prototype.getState=function(e,n){n=n||!1;var t=null;return null!=e&&(t=this.states.get(e),this.graph.isCellVisible(e)&&(null==t&&n&&this.graph.isCellVisible(e)?(t=this.createState(e),this.states.put(e,t)):n&&null!=t&&this.updateStyle&&(t.style=this.graph.getCellStyle(e)))),t},mxGraphView.prototype.isRendering=function(){return this.rendering},mxGraphView.prototype.setRendering=function(e){this.rendering=e},mxGraphView.prototype.isAllowEval=function(){return this.allowEval},mxGraphView.prototype.setAllowEval=function(e){this.allowEval=e},mxGraphView.prototype.getStates=function(){return this.states},mxGraphView.prototype.setStates=function(e){this.states=e},mxGraphView.prototype.getCellStates=function(e){if(null==e)return this.states;for(var n=[],t=0;t<e.length;t++){var a=this.getState(e[t]);null!=a&&n.push(a)}return n},mxGraphView.prototype.removeState=function(e){var n=null;return null!=e&&(null!=(n=this.states.remove(e))&&(this.graph.cellRenderer.destroy(n),n.destroy())),n},mxGraphView.prototype.createState=function(e){var n=this.graph.getCellStyle(e);return e=new mxCellState(this,e,n),this.graph.cellRenderer.initialize(e,this.isRendering()),e},mxGraphView.prototype.getCanvas=function(){return this.canvas},mxGraphView.prototype.getBackgroundPane=function(){return this.backgroundPane},mxGraphView.prototype.getDrawPane=function(){return this.drawPane},mxGraphView.prototype.getOverlayPane=function(){return this.overlayPane},mxGraphView.prototype.isContainerEvent=function(e){return(e=mxEvent.getSource(e))==this.graph.container||e.parentNode==this.backgroundPane||null!=e.parentNode&&e.parentNode.parentNode==this.backgroundPane||e==this.canvas.parentNode||e==this.canvas||e==this.backgroundPane||e==this.drawPane||e==this.overlayPane},mxGraphView.prototype.isScrollEvent=function(e){var n=mxUtils.getOffset(this.graph.container);e=new mxPoint(e.clientX-n.x,e.clientY-n.y);n=this.graph.container.offsetWidth;var t=this.graph.container.clientWidth;return t<n&&e.x>t+2&&e.x<=n||(n=this.graph.container.offsetHeight,(t=this.graph.container.clientHeight)<n&&e.y>t+2&&e.y<=n)},mxGraphView.prototype.init=function(){this.installListeners();var e=this.graph;e.dialect==mxConstants.DIALECT_SVG?this.createSvg():e.dialect==mxConstants.DIALECT_VML?this.createVml():this.createHtml()},mxGraphView.prototype.installListeners=function(){var a=this.graph,i=a.container;if(null!=i){mxEvent.addGestureListeners(i,mxUtils.bind(this,function(e){mxClient.IS_TOUCH&&a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),this.isContainerEvent(e)&&(!mxClient.IS_IE&&!mxClient.IS_GC&&!mxClient.IS_OP&&!mxClient.IS_SF||!this.isScrollEvent(e))&&a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.isContainerEvent(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.isContainerEvent(e)&&a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))})),mxEvent.addListener(i,"dblclick",mxUtils.bind(this,function(e){a.dblClick(e)}));a.addMouseListener({mouseDown:function(e,n){a.panningHandler.hideMenu()},mouseMove:function(){},mouseUp:function(){}}),this.moveHandler=mxUtils.bind(this,function(e){var n,t;null!=a.tooltipHandler&&a.tooltipHandler.isHideOnHover()&&a.tooltipHandler.hide(),this.captureDocumentGesture&&a.isMouseDown&&!mxEvent.isConsumed(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,(n=e,t=null,mxClient.IS_TOUCH&&(t=mxEvent.getClientX(n),n=mxEvent.getClientY(n),n=mxUtils.convertPoint(i,t,n),t=a.view.getState(a.getCellAt(n.x,n.y))),t)))}),this.endHandler=mxUtils.bind(this,function(e){this.captureDocumentGesture&&a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}),mxEvent.addGestureListeners(document,null,this.moveHandler,this.endHandler)}},mxGraphView.prototype.createHtml=function(){var e=this.graph.container;null!=e&&(this.canvas=this.createHtmlPane("100%","100%"),this.backgroundPane=this.createHtmlPane("1px","1px"),this.drawPane=this.createHtmlPane("1px","1px"),this.overlayPane=this.createHtmlPane("1px","1px"),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas),mxClient.IS_QUIRKS&&(e=mxUtils.bind(this,function(e){e=this.getGraphBounds(),this.updateHtmlCanvasSize(e.x+e.width+this.graph.border,e.y+e.height+this.graph.border)}),mxEvent.addListener(window,"resize",e)))},mxGraphView.prototype.updateHtmlCanvasSize=function(e,n){if(null!=this.graph.container){var t=this.graph.container.offsetHeight;this.canvas.style.width=this.graph.container.offsetWidth<e?e+"px":"100%",this.canvas.style.height=t<n?n+"px":"100%"}},mxGraphView.prototype.createHtmlPane=function(e,n){var t=document.createElement("DIV");return null!=e&&null!=n?(t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=e,t.style.height=n):t.style.position="relative",t},mxGraphView.prototype.createVml=function(){var e=this.graph.container;if(null!=e){var n=e.offsetWidth,t=e.offsetHeight;this.canvas=this.createVmlPane(n,t),this.backgroundPane=this.createVmlPane(n,t),this.drawPane=this.createVmlPane(n,t),this.overlayPane=this.createVmlPane(n,t),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas)}},mxGraphView.prototype.createVmlPane=function(e,n){var t=document.createElement(mxClient.VML_PREFIX+":group");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=e+"px",t.style.height=n+"px",t.setAttribute("coordsize",e+","+n),t.setAttribute("coordorigin","0,0"),t},mxGraphView.prototype.createSvg=function(){var e=this.graph.container;this.canvas=document.createElementNS(mxConstants.NS_SVG,"g"),this.backgroundPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.backgroundPane),this.drawPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.drawPane),this.overlayPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.overlayPane);var n=document.createElementNS(mxConstants.NS_SVG,"svg");n.style.width="100%",n.style.height="100%",n.style.display="block",n.appendChild(this.canvas),null!=e&&(e.appendChild(n),"static"==mxUtils.getCurrentStyle(e).position&&(e.style.position="relative"))},mxGraphView.prototype.destroy=function(){var e=null!=this.canvas?this.canvas.ownerSVGElement:null;null==e&&(e=this.canvas),null!=e&&null!=e.parentNode&&(this.clear(this.currentRoot,!0),mxEvent.removeGestureListeners(document,null,this.moveHandler,this.endHandler),mxEvent.release(this.graph.container),e.parentNode.removeChild(e),this.overlayPane=this.drawPane=this.backgroundPane=this.canvas=this.endHandler=this.moveHandler=null)},mxCurrentRootChange.prototype.execute=function(){var e=this.view.currentRoot;this.view.currentRoot=this.previous,this.previous=e,null!=(e=this.view.graph.getTranslateForRoot(this.view.currentRoot))&&(this.view.translate=new mxPoint(-e.x,-e.y)),this.view.fireEvent(new mxEventObject(this.isUp?mxEvent.UP:mxEvent.DOWN,"root",this.view.currentRoot,"previous",this.previous)),this.isUp?(this.view.clear(this.view.currentRoot,!0),this.view.validate()):this.view.refresh(),this.isUp=!this.isUp},mxLoadResources&&mxResources.add(mxClient.basePath+"/resources/graph"),mxGraph.prototype=new mxEventSource,mxGraph.prototype.constructor=mxGraph,mxGraph.prototype.EMPTY_ARRAY=[],mxGraph.prototype.mouseListeners=null,mxGraph.prototype.isMouseDown=!1,mxGraph.prototype.model=null,mxGraph.prototype.view=null,mxGraph.prototype.stylesheet=null,mxGraph.prototype.selectionModel=null,mxGraph.prototype.cellEditor=null,mxGraph.prototype.cellRenderer=null,mxGraph.prototype.multiplicities=null,mxGraph.prototype.renderHint=null,mxGraph.prototype.dialect=null,mxGraph.prototype.gridSize=10,mxGraph.prototype.gridEnabled=!0,mxGraph.prototype.portsEnabled=!0,mxGraph.prototype.doubleTapEnabled=!0,mxGraph.prototype.doubleTapTimeout=700,mxGraph.prototype.doubleTapTolerance=25,mxGraph.prototype.lastTouchY=0,mxGraph.prototype.lastTouchY=0,mxGraph.prototype.lastTouchTime=0,mxGraph.prototype.gestureEnabled=!0,mxGraph.prototype.tolerance=4,mxGraph.prototype.defaultOverlap=.5,mxGraph.prototype.defaultParent=null,mxGraph.prototype.alternateEdgeStyle=null,mxGraph.prototype.backgroundImage=null,mxGraph.prototype.pageVisible=!1,mxGraph.prototype.pageBreaksVisible=!1,mxGraph.prototype.pageBreakColor="gray",mxGraph.prototype.pageBreakDashed=!0,mxGraph.prototype.minPageBreakDist=20,mxGraph.prototype.preferPageSize=!1,mxGraph.prototype.pageFormat=mxConstants.PAGE_FORMAT_A4_PORTRAIT,mxGraph.prototype.pageScale=1.5,mxGraph.prototype.enabled=!0,mxGraph.prototype.escapeEnabled=!0,mxGraph.prototype.invokesStopCellEditing=!0,mxGraph.prototype.enterStopsCellEditing=!1,mxGraph.prototype.useScrollbarsForPanning=!0,mxGraph.prototype.exportEnabled=!0,mxGraph.prototype.importEnabled=!0,mxGraph.prototype.cellsLocked=!1,mxGraph.prototype.cellsCloneable=!0,mxGraph.prototype.foldingEnabled=!0,mxGraph.prototype.cellsEditable=!0,mxGraph.prototype.cellsDeletable=!0,mxGraph.prototype.cellsMovable=!0,mxGraph.prototype.edgeLabelsMovable=!0,mxGraph.prototype.vertexLabelsMovable=!1,mxGraph.prototype.dropEnabled=!1,mxGraph.prototype.splitEnabled=!0,mxGraph.prototype.cellsResizable=!0,mxGraph.prototype.cellsBendable=!0,mxGraph.prototype.cellsSelectable=!0,mxGraph.prototype.cellsDisconnectable=!0,mxGraph.prototype.autoSizeCells=!1,mxGraph.prototype.autoScroll=!0,mxGraph.prototype.timerAutoScroll=!1,mxGraph.prototype.allowAutoPanning=!1,mxGraph.prototype.ignoreScrollbars=!1,mxGraph.prototype.autoExtend=!0,mxGraph.prototype.maximumGraphBounds=null,mxGraph.prototype.minimumGraphSize=null,mxGraph.prototype.minimumContainerSize=null,mxGraph.prototype.maximumContainerSize=null,mxGraph.prototype.resizeContainer=!1,mxGraph.prototype.border=0,mxGraph.prototype.ordered=!0,mxGraph.prototype.keepEdgesInForeground=!1,mxGraph.prototype.keepEdgesInBackground=!0,mxGraph.prototype.allowNegativeCoordinates=!0,mxGraph.prototype.constrainChildren=!0,mxGraph.prototype.extendParents=!0,mxGraph.prototype.extendParentsOnAdd=!0,mxGraph.prototype.collapseToPreferredSize=!0,mxGraph.prototype.zoomFactor=1.2,mxGraph.prototype.keepSelectionVisibleOnZoom=!1,mxGraph.prototype.centerZoom=!0,mxGraph.prototype.resetViewOnRootChange=!0,mxGraph.prototype.resetEdgesOnResize=!1,mxGraph.prototype.resetEdgesOnMove=!1,mxGraph.prototype.resetEdgesOnConnect=!0,mxGraph.prototype.allowLoops=!1,mxGraph.prototype.defaultLoopStyle=mxEdgeStyle.Loop,mxGraph.prototype.multigraph=!0,mxGraph.prototype.connectableEdges=!1,mxGraph.prototype.allowDanglingEdges=!0,mxGraph.prototype.cloneInvalidEdges=!1,mxGraph.prototype.disconnectOnMove=!0,mxGraph.prototype.labelsVisible=!0,mxGraph.prototype.htmlLabels=!1,mxGraph.prototype.swimlaneSelectionEnabled=!0,mxGraph.prototype.swimlaneNesting=!0,mxGraph.prototype.swimlaneIndicatorColorAttribute=mxConstants.STYLE_FILLCOLOR,mxGraph.prototype.imageBundles=null,mxGraph.prototype.minFitScale=.1,mxGraph.prototype.maxFitScale=8,mxGraph.prototype.panDx=0,mxGraph.prototype.panDy=0,mxGraph.prototype.collapsedImage=new mxImage(mxClient.imageBasePath+"/collapsed.gif",9,9),mxGraph.prototype.expandedImage=new mxImage(mxClient.imageBasePath+"/expanded.gif",9,9),mxGraph.prototype.warningImage=new mxImage("/assets/plugins/mxgraph/images/warning.gif",16,16),mxGraph.prototype.alreadyConnectedResource="none"!=mxClient.language?"alreadyConnected":"",mxGraph.prototype.containsValidationErrorsResource="none"!=mxClient.language?"containsValidationErrors":"",mxGraph.prototype.collapseExpandResource="none"!=mxClient.language?"collapse-expand":"",mxGraph.prototype.init=function(e){this.container=e,this.cellEditor=this.createCellEditor(),this.view.init(),this.sizeDidChange(),mxClient.IS_IE&&(mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})),mxEvent.addListener(e,"selectstart",mxUtils.bind(this,function(){return this.isEditing()}))),8==document.documentMode&&e.insertAdjacentHTML("beforeend",'<v:group style="DISPLAY: none;"></v:group>')},mxGraph.prototype.createHandlers=function(e){this.tooltipHandler=new mxTooltipHandler(this),this.tooltipHandler.setEnabled(!1),this.panningHandler=new mxPanningHandler(this),this.panningHandler.panningEnabled=!1,this.selectionCellsHandler=new mxSelectionCellsHandler(this),this.connectionHandler=new mxConnectionHandler(this),this.connectionHandler.setEnabled(!1),this.graphHandler=new mxGraphHandler(this)},mxGraph.prototype.createSelectionModel=function(){return new mxGraphSelectionModel(this)},mxGraph.prototype.createStylesheet=function(){return new mxStylesheet},mxGraph.prototype.createGraphView=function(){return new mxGraphView(this)},mxGraph.prototype.createCellRenderer=function(){return new mxCellRenderer},mxGraph.prototype.createCellEditor=function(){return new mxCellEditor(this)},mxGraph.prototype.getModel=function(){return this.model},mxGraph.prototype.getView=function(){return this.view},mxGraph.prototype.getStylesheet=function(){return this.stylesheet},mxGraph.prototype.setStylesheet=function(e){this.stylesheet=e},mxGraph.prototype.getSelectionModel=function(){return this.selectionModel},mxGraph.prototype.setSelectionModel=function(e){this.selectionModel=e},mxGraph.prototype.getSelectionCellsForChanges=function(e){for(var n=[],t=0;t<e.length;t++){var a=e[t];if(a.constructor!=mxRootChange){var i=null;a instanceof mxChildChange&&null==a.previous?i=a.child:null!=a.cell&&a.cell instanceof mxCell&&(i=a.cell),null!=i&&mxUtils.indexOf(n,i)<0&&n.push(i)}}return this.getModel().getTopmostCells(n)},mxGraph.prototype.graphModelChanged=function(e){for(var n=0;n<e.length;n++)this.processChange(e[n]);this.removeSelectionCells(this.getRemovedCellsForChanges(e)),this.view.validate(),this.sizeDidChange()},mxGraph.prototype.getRemovedCellsForChanges=function(e){for(var n=[],t=0;t<e.length;t++){var a=e[t];if(a instanceof mxRootChange)break;a instanceof mxChildChange?null!=a.previous&&null==a.parent&&(n=n.concat(this.model.getDescendants(a.child))):a instanceof mxVisibleChange&&(n=n.concat(this.model.getDescendants(a.cell)))}return n},mxGraph.prototype.processChange=function(e){if(e instanceof mxRootChange)this.clearSelection(),this.removeStateForCell(e.previous),this.resetViewOnRootChange&&(this.view.scale=1,this.view.translate.x=0,this.view.translate.y=0),this.fireEvent(new mxEventObject(mxEvent.ROOT));else if(e instanceof mxChildChange){var n=this.model.getParent(e.child);null!=n?this.view.invalidate(e.child,!0,!1,null!=e.previous):(this.removeStateForCell(e.child),this.view.currentRoot==e.child&&this.home()),n!=e.previous&&(null!=n&&this.view.invalidate(n,!1,!1),null!=e.previous&&this.view.invalidate(e.previous,!1,!1))}else e instanceof mxTerminalChange||e instanceof mxGeometryChange?this.view.invalidate(e.cell):e instanceof mxValueChange?this.view.invalidate(e.cell,!1,!1):e instanceof mxStyleChange?(this.view.invalidate(e.cell,!0,!0,!1),this.view.removeState(e.cell)):null!=e.cell&&e.cell instanceof mxCell&&this.removeStateForCell(e.cell)},mxGraph.prototype.removeStateForCell=function(e){for(var n=this.model.getChildCount(e),t=0;t<n;t++)this.removeStateForCell(this.model.getChildAt(e,t));this.view.removeState(e)},mxGraph.prototype.addCellOverlay=function(e,n){null==e.overlays&&(e.overlays=[]),e.overlays.push(n);var t=this.view.getState(e);return null!=t&&this.cellRenderer.redraw(t),this.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY,"cell",e,"overlay",n)),n},mxGraph.prototype.getCellOverlays=function(e){return e.overlays},mxGraph.prototype.removeCellOverlay=function(e,n){if(null==n)this.removeCellOverlays(e);else{var t=mxUtils.indexOf(e.overlays,n);0<=t?(e.overlays.splice(t,1),0==e.overlays.length&&(e.overlays=null),null!=(t=this.view.getState(e))&&this.cellRenderer.redraw(t),this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",n))):n=null}return n},mxGraph.prototype.removeCellOverlays=function(e){var n=e.overlays;if(null!=n){e.overlays=null;var t=this.view.getState(e);for(null!=t&&this.cellRenderer.redraw(t),t=0;t<n.length;t++)this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",n[t]))}return n},mxGraph.prototype.clearCellOverlays=function(e){e=null!=e?e:this.model.getRoot(),this.removeCellOverlays(e);for(var n=this.model.getChildCount(e),t=0;t<n;t++){var a=this.model.getChildAt(e,t);this.clearCellOverlays(a)}},mxGraph.prototype.setCellWarning=function(t,e,n,a){return null!=e&&0<e.length?(e=new mxCellOverlay(n=null!=n?n:this.warningImage,"<font color=red>"+e+"</font>"),a&&e.addListener(mxEvent.CLICK,mxUtils.bind(this,function(e,n){this.isEnabled()&&this.setSelectionCell(t)})),this.addCellOverlay(t,e)):(this.removeCellOverlays(t),null)},mxGraph.prototype.startEditing=function(e){this.startEditingAtCell(null,e)},mxGraph.prototype.startEditingAtCell=function(e,n){null==e&&(null!=(e=this.getSelectionCell())&&!this.isCellEditable(e)&&(e=null)),null!=e&&(this.fireEvent(new mxEventObject(mxEvent.START_EDITING,"cell",e,"event",n)),this.cellEditor.startEditing(e,n))},mxGraph.prototype.getEditingValue=function(e,n){return this.convertValueToString(e)},mxGraph.prototype.stopEditing=function(e){this.cellEditor.stopEditing(e)},mxGraph.prototype.labelChanged=function(e,n,t){this.model.beginUpdate();try{this.cellLabelChanged(e,n,this.isAutoSizeCell(e)),this.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED,"cell",e,"value",n,"event",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellLabelChanged=function(e,n,t){this.model.beginUpdate();try{this.model.setValue(e,n),t&&this.cellSizeUpdated(e,!1)}finally{this.model.endUpdate()}},mxGraph.prototype.escape=function(e){this.stopEditing(!0),this.connectionHandler.reset(),this.graphHandler.reset(),e=this.getSelectionCells();for(var n=0;n<e.length;n++){var t=this.view.getState(e[n]);null!=t&&null!=t.handler&&t.handler.reset()}},mxGraph.prototype.click=function(e){var n=e.getEvent(),t=e.getCell(),a=new mxEventObject(mxEvent.CLICK,"event",n,"cell",t);e.isConsumed()&&a.consume(),this.fireEvent(a),this.isEnabled()&&!mxEvent.isConsumed(n)&&!a.isConsumed()&&(null!=t?this.selectCellForEvent(t,n):(t=null,this.isSwimlaneSelectionEnabled()&&(t=this.getSwimlaneAt(e.getGraphX(),e.getGraphY())),null!=t?this.selectCellForEvent(t,n):this.isToggleEvent(n)||this.clearSelection()))},mxGraph.prototype.dblClick=function(e,n){var t=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",n);this.fireEvent(t),this.isEnabled()&&!mxEvent.isConsumed(e)&&!t.isConsumed()&&null!=n&&this.isCellEditable(n)&&this.startEditingAtCell(n,e)},mxGraph.prototype.scrollPointToVisible=function(e,n,t,a){if(this.timerAutoScroll||!this.ignoreScrollbars&&!mxUtils.hasScrollbars(this.container))this.allowAutoPanning&&!this.panningHandler.active&&(null==this.panningManager&&(this.panningManager=this.createPanningManager()),this.panningManager.panTo(e+this.panDx,n+this.panDy));else{var i=this.container;if(a=null!=a?a:20,e>=i.scrollLeft&&n>=i.scrollTop&&e<=i.scrollLeft+i.clientWidth&&n<=i.scrollTop+i.clientHeight){var s=i.scrollLeft+i.clientWidth-e;if(s<a){if(e=i.scrollLeft,i.scrollLeft+=a-s,t&&e==i.scrollLeft){if(this.dialect==mxConstants.DIALECT_SVG){e=this.view.getDrawPane().ownerSVGElement;var o=this.container.scrollWidth+a-s}else o=Math.max(i.clientWidth,i.scrollWidth)+a-s,e=this.view.getCanvas();e.style.width=o+"px",i.scrollLeft+=a-s}}else(s=e-i.scrollLeft)<a&&(i.scrollLeft-=a-s);(s=i.scrollTop+i.clientHeight-n)<a?(e=i.scrollTop,i.scrollTop+=a-s,e==i.scrollTop&&t&&(this.dialect==mxConstants.DIALECT_SVG?(e=this.view.getDrawPane().ownerSVGElement,n=this.container.scrollHeight+a-s):(n=Math.max(i.clientHeight,i.scrollHeight)+a-s,e=this.view.getCanvas()),e.style.height=n+"px",i.scrollTop+=a-s)):(s=n-i.scrollTop)<a&&(i.scrollTop-=a-s)}}},mxGraph.prototype.createPanningManager=function(){return new mxPanningManager(this)},mxGraph.prototype.getBorderSizes=function(){function e(e){var n=0;n="thin"==e?2:"medium"==e?4:"thick"==e?6:parseInt(e);return isNaN(n)&&(n=0),n}var n=mxUtils.getCurrentStyle(this.container),t=new mxRectangle;return t.x=e(n.borderLeftWidth)+parseInt(n.paddingLeft||0),t.y=e(n.borderTopWidth)+parseInt(n.paddingTop||0),t.width=e(n.borderRightWidth)+parseInt(n.paddingRight||0),t.height=e(n.borderBottomWidth)+parseInt(n.paddingBottom||0),t},mxGraph.prototype.getPreferredPageSize=function(e,n,t){e=this.view.scale;var a=this.view.translate,i=this.pageFormat,s=e*this.pageScale;i=new mxRectangle(0,0,i.width*s,i.height*s);return n=this.pageBreaksVisible?Math.ceil(n/i.width):1,t=this.pageBreaksVisible?Math.ceil(t/i.height):1,new mxRectangle(0,0,n*i.width+2+a.x/e,t*i.height+2+a.y/e)},mxGraph.prototype.sizeDidChange=function(){var e=this.getGraphBounds();if(null!=this.container){var n=this.getBorder(),t=Math.max(0,e.x+e.width+1+n);n=Math.max(0,e.y+e.height+1+n);if(null!=this.minimumContainerSize&&(t=Math.max(t,this.minimumContainerSize.width),n=Math.max(n,this.minimumContainerSize.height)),this.resizeContainer&&this.doResizeContainer(t,n),this.preferPageSize||!mxClient.IS_IE&&this.pageVisible){var a=this.getPreferredPageSize(e,t,n);null!=a&&(t=a.width,n=a.height)}null!=this.minimumGraphSize&&(t=Math.max(t,this.minimumGraphSize.width*this.view.scale),n=Math.max(n,this.minimumGraphSize.height*this.view.scale)),t=Math.ceil(t-1),n=Math.ceil(n-1),this.dialect==mxConstants.DIALECT_SVG?((a=this.view.getDrawPane().ownerSVGElement).style.minWidth=Math.max(1,t)+"px",a.style.minHeight=Math.max(1,n)+"px",a.style.width="100%",a.style.height="100%"):mxClient.IS_QUIRKS?this.view.updateHtmlCanvasSize(Math.max(1,t),Math.max(1,n)):(this.view.canvas.style.minWidth=Math.max(1,t)+"px",this.view.canvas.style.minHeight=Math.max(1,n)+"px"),this.updatePageBreaks(this.pageBreaksVisible,t-1,n-1)}this.fireEvent(new mxEventObject(mxEvent.SIZE,"bounds",e))},mxGraph.prototype.doResizeContainer=function(e,n){if(mxClient.IS_IE)if(mxClient.IS_QUIRKS){var t=this.getBorderSizes();e+=Math.max(2,t.x+t.width+1),n+=Math.max(2,t.y+t.height+1)}else 9<=document.documentMode?(e+=3,n+=5):(e+=1,n+=1);else n+=1;null!=this.maximumContainerSize&&(e=Math.min(this.maximumContainerSize.width,e),n=Math.min(this.maximumContainerSize.height,n)),this.container.style.width=Math.ceil(e)+"px",this.container.style.height=Math.ceil(n)+"px"},mxGraph.prototype.updatePageBreaks=function(e,n,t){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale;i=new mxRectangle(a*i.x,a*i.y,s.width*o,s.height*o);if(e=e&&Math.min(i.width,i.height)>this.minPageBreakDist,i.x=mxUtils.mod(i.x,i.width),i.y=mxUtils.mod(i.y,i.height),s=e?Math.ceil((n-i.x)/i.width):0,e=e?Math.ceil((t-i.y)/i.height):0,null==this.horizontalPageBreaks&&0<s&&(this.horizontalPageBreaks=[]),null!=this.horizontalPageBreaks){for(o=0;o<=s;o++){var r=[new mxPoint(i.x+o*i.width,1),new mxPoint(i.x+o*i.width,t)];null!=this.horizontalPageBreaks[o]?(this.horizontalPageBreaks[o].scale=1,this.horizontalPageBreaks[o].points=r,this.horizontalPageBreaks[o].redraw()):((r=new mxPolyline(r,this.pageBreakColor,this.scale)).dialect=this.dialect,r.isDashed=this.pageBreakDashed,r.scale=a,r.init(this.view.backgroundPane),r.redraw(),this.horizontalPageBreaks[o]=r)}for(o=s;o<this.horizontalPageBreaks.length;o++)this.horizontalPageBreaks[o].destroy();this.horizontalPageBreaks.splice(s,this.horizontalPageBreaks.length-s)}if(null==this.verticalPageBreaks&&0<e&&(this.verticalPageBreaks=[]),null!=this.verticalPageBreaks){for(o=0;o<=e;o++)r=[new mxPoint(1,i.y+o*i.height),new mxPoint(n,i.y+o*i.height)],null!=this.verticalPageBreaks[o]?(this.verticalPageBreaks[o].scale=1,this.verticalPageBreaks[o].points=r,this.verticalPageBreaks[o].redraw()):((r=new mxPolyline(r,this.pageBreakColor,a)).dialect=this.dialect,r.isDashed=this.pageBreakDashed,r.scale=a,r.init(this.view.backgroundPane),r.redraw(),this.verticalPageBreaks[o]=r);for(o=e;o<this.verticalPageBreaks.length;o++)this.verticalPageBreaks[o].destroy();this.verticalPageBreaks.splice(e,this.verticalPageBreaks.length-e)}},mxGraph.prototype.getCellStyle=function(e){var n=this.model.getStyle(e),t=null;t=this.model.isEdge(e)?this.stylesheet.getDefaultEdgeStyle():this.stylesheet.getDefaultVertexStyle();return null!=n&&(t=this.postProcessCellStyle(this.stylesheet.getCellStyle(n,t))),null==t&&(t=mxGraph.prototype.EMPTY_ARRAY),t},mxGraph.prototype.postProcessCellStyle=function(e){if(null!=e){var n=e[mxConstants.STYLE_IMAGE],t=this.getImageFromBundles(n);null!=t?e[mxConstants.STYLE_IMAGE]=t:t=n,null!=t&&"data:image/"==t.substring(0,11)&&(0<(n=t.indexOf(","))&&(t=t.substring(0,n)+";base64,"+t.substring(n+1)),e[mxConstants.STYLE_IMAGE]=t)}return e},mxGraph.prototype.setCellStyle=function(e,n){if(null!=(n=n||this.getSelectionCells())){this.model.beginUpdate();try{for(var t=0;t<n.length;t++)this.model.setStyle(n[t],e)}finally{this.model.endUpdate()}}},mxGraph.prototype.toggleCellStyle=function(e,n,t){t=t||this.getSelectionCell(),this.toggleCellStyles(e,n,[t])},mxGraph.prototype.toggleCellStyles=function(e,n,t){var a;(n=null!=n&&n,null!=(t=t||this.getSelectionCells())&&0<t.length)&&(null!=(a=null!=(a=this.view.getState(t[0]))?a.style:this.getCellStyle(t[0]))&&(n=mxUtils.getValue(a,e,n)?0:1,this.setCellStyles(e,n,t)))},mxGraph.prototype.setCellStyles=function(e,n,t){t=t||this.getSelectionCells(),mxUtils.setCellStyles(this.model,t,e,n)},mxGraph.prototype.toggleCellStyleFlags=function(e,n,t){this.setCellStyleFlags(e,n,null,t)},mxGraph.prototype.setCellStyleFlags=function(e,n,t,a){if(null!=(a=a||this.getSelectionCells())&&0<a.length){var i;if(null==t)null!=(i=null!=(i=this.view.getState(a[0]))?i.style:this.getCellStyle(a[0]))&&(t=(parseInt(i[e]||0)&n)!=n);mxUtils.setCellStyleFlags(this.model,a,e,n,t)}},mxGraph.prototype.alignCells=function(e,n,t){if(null==n&&(n=this.getSelectionCells()),null!=n&&1<n.length){if(null==t)for(var a=0;a<n.length;a++){var i=this.getCellGeometry(n[a]);if(null!=i&&!this.model.isEdge(n[a]))if(null==t){if(e==mxConstants.ALIGN_CENTER){t=i.x+i.width/2;break}if(e==mxConstants.ALIGN_RIGHT)t=i.x+i.width;else if(e==mxConstants.ALIGN_TOP)t=i.y;else{if(e==mxConstants.ALIGN_MIDDLE){t=i.y+i.height/2;break}t=e==mxConstants.ALIGN_BOTTOM?i.y+i.height:i.x}}else t=e==mxConstants.ALIGN_RIGHT?Math.max(t,i.x+i.width):e==mxConstants.ALIGN_TOP?Math.min(t,i.y):e==mxConstants.ALIGN_BOTTOM?Math.max(t,i.y+i.height):Math.min(t,i.x)}if(null!=t){this.model.beginUpdate();try{for(a=0;a<n.length;a++)null!=(i=this.getCellGeometry(n[a]))&&!this.model.isEdge(n[a])&&(i=i.clone(),e==mxConstants.ALIGN_CENTER?i.x=t-i.width/2:e==mxConstants.ALIGN_RIGHT?i.x=t-i.width:e==mxConstants.ALIGN_TOP?i.y=t:e==mxConstants.ALIGN_MIDDLE?i.y=t-i.height/2:e==mxConstants.ALIGN_BOTTOM?i.y=t-i.height:i.x=t,this.model.setGeometry(n[a],i));this.fireEvent(new mxEventObject(mxEvent.ALIGN_CELLS,"align",e,"cells",n))}finally{this.model.endUpdate()}}}return n},mxGraph.prototype.flipEdge=function(e){if(null!=e&&null!=this.alternateEdgeStyle){this.model.beginUpdate();try{var n=this.model.getStyle(e);null==n||0==n.length?this.model.setStyle(e,this.alternateEdgeStyle):this.model.setStyle(e,null),this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.FLIP_EDGE,"edge",e))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.addImageBundle=function(e){this.imageBundles.push(e)},mxGraph.prototype.removeImageBundle=function(e){for(var n=[],t=0;t<this.imageBundles.length;t++)this.imageBundles[t]!=e&&n.push(this.imageBundles[t]);this.imageBundles=n},mxGraph.prototype.getImageFromBundles=function(e){if(null!=e)for(var n=0;n<this.imageBundles.length;n++){var t=this.imageBundles[n].getImage(e);if(null!=t)return t}return null},mxGraph.prototype.orderCells=function(e,n){null==n&&(n=mxUtils.sortCells(this.getSelectionCells(),!0)),this.model.beginUpdate();try{this.cellsOrdered(n,e),this.fireEvent(new mxEventObject(mxEvent.ORDER_CELLS,"back",e,"cells",n))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsOrdered=function(e,n){if(null!=e){this.model.beginUpdate();try{for(var t=0;t<e.length;t++){var a=this.model.getParent(e[t]);n?this.model.add(a,e[t],t):this.model.add(a,e[t],this.model.getChildCount(a)-1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ORDERED,"back",n,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.groupCells=function(e,n,t){null==t&&(t=mxUtils.sortCells(this.getSelectionCells(),!0)),t=this.getCellsForGroup(t),null==e&&(e=this.createGroupCell(t));var a=this.getBoundsForGroup(e,t,n);if(0<t.length&&null!=a){var i=this.model.getParent(e);null==i&&(i=this.model.getParent(t[0])),this.model.beginUpdate();try{null==this.getCellGeometry(e)&&this.model.setGeometry(e,new mxGeometry);var s=this.model.getChildCount(i);this.cellsAdded([e],i,s,null,null,!1),s=this.model.getChildCount(e),this.cellsAdded(t,e,s,null,null,!1,!1),this.cellsMoved(t,-a.x,-a.y,!1,!0),this.cellsResized([e],[a]),this.fireEvent(new mxEventObject(mxEvent.GROUP_CELLS,"group",e,"border",n,"cells",t))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.getCellsForGroup=function(e){var n=[];if(null!=e&&0<e.length){var t=this.model.getParent(e[0]);n.push(e[0]);for(var a=1;a<e.length;a++)this.model.getParent(e[a])==t&&n.push(e[a])}return n},mxGraph.prototype.getBoundsForGroup=function(e,n,t){return null!=(n=this.getBoundingBoxFromGeometry(n))&&(this.isSwimlane(e)&&(e=this.getStartSize(e),n.x-=e.width,n.y-=e.height,n.width+=e.width,n.height+=e.height),n.x-=t,n.y-=t,n.width+=2*t,n.height+=2*t),n},mxGraph.prototype.createGroupCell=function(e){return(e=new mxCell("")).setVertex(!0),e.setConnectable(!1),e},mxGraph.prototype.ungroupCells=function(e){var n=[];if(null==e){e=this.getSelectionCells();for(var t=[],a=0;a<e.length;a++)0<this.model.getChildCount(e[a])&&t.push(e[a]);e=t}if(null!=e&&0<e.length){this.model.beginUpdate();try{for(a=0;a<e.length;a++){if(null!=(i=this.model.getChildren(e[a]))&&0<i.length){var i=i.slice(),s=this.model.getParent(e[a]),o=this.model.getChildCount(s);this.cellsAdded(i,s,o,null,null,!0),n=n.concat(i)}}this.cellsRemoved(this.addAllEdges(e)),this.fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS,"cells",e))}finally{this.model.endUpdate()}}return n},mxGraph.prototype.removeCellsFromParent=function(e){null==e&&(e=this.getSelectionCells()),this.model.beginUpdate();try{var n=this.getDefaultParent(),t=this.model.getChildCount(n);this.cellsAdded(e,n,t,null,null,!0),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS_FROM_PARENT,"cells",e))}finally{this.model.endUpdate()}return e},mxGraph.prototype.updateGroupBounds=function(e,n,t){null==e&&(e=this.getSelectionCells()),n=null!=n?n:0,t=null!=t&&t,this.model.beginUpdate();try{for(var a=0;a<e.length;a++){if(null!=(r=this.getCellGeometry(e[a]))){var i=this.getChildCells(e[a]);if(null!=i&&0<i.length){var s=this.getBoundingBoxFromGeometry(i);if(0<s.width&&0<s.height){var o=this.isSwimlane(e[a])?this.getStartSize(e[a]):new mxRectangle,r=r.clone();t&&(r.x+=s.x-o.width-n,r.y+=s.y-o.height-n),r.width=s.width+o.width+2*n,r.height=s.height+o.height+2*n,this.model.setGeometry(e[a],r),this.moveCells(i,-s.x+o.width+n,-s.y+o.height+n)}}}}}finally{this.model.endUpdate()}return e},mxGraph.prototype.cloneCells=function(e,n){n=null==n||n;var t=null;if(null!=e){for(var a={},i=(t=[],0);i<e.length;i++){a[s=mxCellPath.create(e[i])]=e[i],t.push(e[i])}if(0<t.length){var s=this.view.scale,o=this.view.translate;for(t=this.model.cloneCells(e,!0),i=0;i<e.length;i++)if(!n&&this.model.isEdge(t[i])&&null!=this.getEdgeValidationError(t[i],this.model.getTerminal(t[i],!0),this.model.getTerminal(t[i],!1)))t[i]=null;else{var r=this.model.getGeometry(t[i]);if(null!=r){var l=this.view.getState(e[i]),d=this.view.getState(this.model.getParent(e[i]));if(null!=l&&null!=d){var c=d.origin.x;d=d.origin.y;if(this.model.isEdge(t[i])){l=l.absolutePoints;for(var m=this.model.getTerminal(e[i],!0),u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);for(null==m&&r.setTerminalPoint(new mxPoint(l[0].x/s-o.x,l[0].y/s-o.y),!0),m=this.model.getTerminal(e[i],!1),u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);if(null==m&&(m=l.length-1,r.setTerminalPoint(new mxPoint(l[m].x/s-o.x,l[m].y/s-o.y),!1)),null!=(r=r.points))for(l=0;l<r.length;l++)r[l].x+=c,r[l].y+=d}else r.x+=c,r.y+=d}}}}else t=[]}return t},mxGraph.prototype.insertVertex=function(e,n,t,a,i,s,o,r,l){return n=this.createVertex(e,n,t,a,i,s,o,r,l),this.addCell(n,e)},mxGraph.prototype.createVertex=function(e,n,t,a,i,s,o,r,l){return(e=new mxGeometry(a,i,s,o)).relative=null!=l&&l,(t=new mxCell(t,e,r)).setId(n),t.setVertex(!0),t.setConnectable(!0),t},mxGraph.prototype.insertEdge=function(e,n,t,a,i,s){return n=this.createEdge(e,n,t,a,i,s),this.addEdge(n,e,a,i)},mxGraph.prototype.createEdge=function(e,n,t,a,i,s){return(e=new mxCell(t,new mxGeometry,s)).setId(n),e.setEdge(!0),e.geometry.relative=!0,e},mxGraph.prototype.addEdge=function(e,n,t,a,i){return this.addCell(e,n,i,t,a)},mxGraph.prototype.addCell=function(e,n,t,a,i){return this.addCells([e],n,t,a,i)[0]},mxGraph.prototype.addCells=function(e,n,t,a,i){null==n&&(n=this.getDefaultParent()),null==t&&(t=this.model.getChildCount(n)),this.model.beginUpdate();try{this.cellsAdded(e,n,t,a,i,!1,!0),this.fireEvent(new mxEventObject(mxEvent.ADD_CELLS,"cells",e,"parent",n,"index",t,"source",a,"target",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsAdded=function(e,n,t,a,i,s,o){if(null!=e&&null!=n&&null!=t){this.model.beginUpdate();try{for(var r=null!=(d=s?this.view.getState(n):null)?d.origin:null,l=new mxPoint(0,0),d=0;d<e.length;d++)if(null==e[d])t--;else{var c=this.model.getParent(e[d]);if(null!=r&&e[d]!=n&&n!=c){var m=this.view.getState(c),u=null!=m?m.origin:l;if(null!=(p=this.model.getGeometry(e[d]))){var p,g=u.x-r.x,v=u.y-r.y;(p=p.clone()).translate(g,v),!p.relative&&this.model.isVertex(e[d])&&!this.isAllowNegativeCoordinates()&&(p.x=Math.max(0,p.x),p.y=Math.max(0,p.y)),this.model.setGeometry(e[d],p)}}n==c&&t+d>this.model.getChildCount(n)&&t--,this.model.add(n,e[d],t+d),this.isExtendParentsOnAdd()&&this.isExtendParent(e[d])&&this.extendParent(e[d]),(null==o||o)&&this.constrainChild(e[d]),null!=a&&this.cellConnected(e[d],a,!0),null!=i&&this.cellConnected(e[d],i,!1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ADDED,"cells",e,"parent",n,"index",t,"source",a,"target",i,"absolute",s))}finally{this.model.endUpdate()}}},mxGraph.prototype.removeCells=function(e,n){n=null==n||n,null==e&&(e=this.getDeletableCells(this.getSelectionCells())),n&&(e=this.getDeletableCells(this.addAllEdges(e))),this.model.beginUpdate();try{this.cellsRemoved(e),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS,"cells",e,"includeEdges",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsRemoved=function(e){if(null!=e&&0<e.length){var n=this.view.scale,t=this.view.translate;this.model.beginUpdate();try{for(var a={},i=0;i<e.length;i++){var s=mxCellPath.create(e[i]);a[s]=e[i]}for(i=0;i<e.length;i++){for(var o=this.getConnections(e[i]),r=0;r<o.length;r++)if(null==a[s=mxCellPath.create(o[r])]){if(null!=(d=this.model.getGeometry(o[r]))){var l=this.view.getState(o[r]);if(null!=l){var d=d.clone(),c=l.getVisibleTerminal(!0)==e[i],m=l.absolutePoints,u=c?0:m.length-1;d.setTerminalPoint(new mxPoint(m[u].x/n-t.x,m[u].y/n-t.y),c),this.model.setTerminal(o[r],null,c),this.model.setGeometry(o[r],d)}}}this.model.remove(e[i])}this.fireEvent(new mxEventObject(mxEvent.CELLS_REMOVED,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.splitEdge=function(e,n,t,a,i){a=a||0,i=i||0,null==t&&(t=this.cloneCells([e])[0]);var s=this.model.getParent(e),o=this.model.getTerminal(e,!0);this.model.beginUpdate();try{this.cellsMoved(n,a,i,!1,!1),this.cellsAdded(n,s,this.model.getChildCount(s),null,null,!0),this.cellsAdded([t],s,this.model.getChildCount(s),o,n[0],!1),this.cellConnected(e,n[0],!0),this.fireEvent(new mxEventObject(mxEvent.SPLIT_EDGE,"edge",e,"cells",n,"newEdge",t,"dx",a,"dy",i))}finally{this.model.endUpdate()}return t},mxGraph.prototype.toggleCells=function(e,n,t){null==n&&(n=this.getSelectionCells()),t&&(n=this.addAllEdges(n)),this.model.beginUpdate();try{this.cellsToggled(n,e),this.fireEvent(new mxEventObject(mxEvent.TOGGLE_CELLS,"show",e,"cells",n,"includeEdges",t))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsToggled=function(e,n){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var t=0;t<e.length;t++)this.model.setVisible(e[t],n)}finally{this.model.endUpdate()}}},mxGraph.prototype.foldCells=function(e,n,t,a){n=null!=n&&n,null==t&&(t=this.getFoldableCells(this.getSelectionCells(),e)),this.stopEditing(!1),this.model.beginUpdate();try{this.cellsFolded(t,e,n,a),this.fireEvent(new mxEventObject(mxEvent.FOLD_CELLS,"collapse",e,"recurse",n,"cells",t))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsFolded=function(e,n,t,a){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var i=0;i<e.length;i++)if((!a||this.isCellFoldable(e[i],n))&&n!=this.isCellCollapsed(e[i])&&(this.model.setCollapsed(e[i],n),this.swapBounds(e[i],n),this.isExtendParent(e[i])&&this.extendParent(e[i]),t)){var s=this.model.getChildren(e[i]);this.foldCells(s,n,t)}this.fireEvent(new mxEventObject(mxEvent.CELLS_FOLDED,"cells",e,"collapse",n,"recurse",t))}finally{this.model.endUpdate()}}},mxGraph.prototype.swapBounds=function(e,n){if(null!=e){var t=this.model.getGeometry(e);null!=t&&(t=t.clone(),this.updateAlternateBounds(e,t,n),t.swap(),this.model.setGeometry(e,t))}},mxGraph.prototype.updateAlternateBounds=function(e,n,t){if(null!=e&&null!=n){if(t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e),null==n.alternateBounds){var a=n;this.collapseToPreferredSize&&(null!=(e=this.getPreferredSizeForCell(e))&&(a=e,0<(e=mxUtils.getValue(t,mxConstants.STYLE_STARTSIZE))&&(a.height=Math.max(a.height,e)))),n.alternateBounds=new mxRectangle(0,0,a.width,a.height)}if(null!=n.alternateBounds){n.alternateBounds.x=n.x,n.alternateBounds.y=n.y;var i=mxUtils.toRadians(t[mxConstants.STYLE_ROTATION]||"0");0!=i&&(e=n.alternateBounds.getCenterX()-n.getCenterX(),t=n.alternateBounds.getCenterY()-n.getCenterY(),a=Math.cos(i),i=Math.sin(i),n.alternateBounds.x+=a*e-i*t-e,n.alternateBounds.y+=i*e+a*t-t)}}},mxGraph.prototype.addAllEdges=function(e){var n=e.slice();return n.concat(this.getAllEdges(e))},mxGraph.prototype.getAllEdges=function(e){var n=[];if(null!=e)for(var t=0;t<e.length;t++){for(var a=this.model.getEdgeCount(e[t]),i=0;i<a;i++)n.push(this.model.getEdgeAt(e[t],i));a=this.model.getChildren(e[t]),n=n.concat(this.getAllEdges(a))}return n},mxGraph.prototype.updateCellSize=function(e,n){n=null!=n&&n,this.model.beginUpdate();try{this.cellSizeUpdated(e,n),this.fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE,"cell",e,"ignoreChildren",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellSizeUpdated=function(e,n){if(null!=e){this.model.beginUpdate();try{var t=this.getPreferredSizeForCell(e),a=this.model.getGeometry(e);if(null!=t&&null!=a){var i=this.isCellCollapsed(e);a=a.clone();if(this.isSwimlane(e)){var s=this.view.getState(e),o=null!=s?s.style:this.getCellStyle(e),r=this.model.getStyle(e);null==r&&(r=""),mxUtils.getValue(o,mxConstants.STYLE_HORIZONTAL,!0)?(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,t.height+8),i&&(a.height=t.height+8),a.width=t.width):(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,t.width+8),i&&(a.width=t.width+8),a.height=t.height),this.model.setStyle(e,r)}else a.width=t.width,a.height=t.height;if(!n&&!i){var l=this.view.getBounds(this.model.getChildren(e));if(null!=l){var d=this.view.translate,c=this.view.scale,m=(l.y+l.height)/c-a.y-d.y;a.width=Math.max(a.width,(l.x+l.width)/c-a.x-d.x),a.height=Math.max(a.height,m)}}this.cellsResized([e],[a])}}finally{this.model.endUpdate()}}},mxGraph.prototype.getPreferredSizeForCell=function(e){var n=null;if(null!=e){var t=this.view.getState(e),a=null!=t?t.style:this.getCellStyle(e);if(null!=a&&!this.model.isEdge(e)){var i=a[mxConstants.STYLE_FONTSIZE]||mxConstants.DEFAULT_FONTSIZE,s=0;n=0;null==this.getImage(t)&&null==a[mxConstants.STYLE_IMAGE]||a[mxConstants.STYLE_SHAPE]!=mxConstants.SHAPE_LABEL||(a[mxConstants.STYLE_VERTICAL_ALIGN]==mxConstants.ALIGN_MIDDLE&&(s+=parseFloat(a[mxConstants.STYLE_IMAGE_WIDTH])||mxLabel.prototype.imageSize),a[mxConstants.STYLE_ALIGN]!=mxConstants.ALIGN_CENTER&&(n+=parseFloat(a[mxConstants.STYLE_IMAGE_HEIGHT])||mxLabel.prototype.imageSize)),s+=2*(a[mxConstants.STYLE_SPACING]||0),s+=a[mxConstants.STYLE_SPACING_LEFT]||0,s+=a[mxConstants.STYLE_SPACING_RIGHT]||0,n+=2*(a[mxConstants.STYLE_SPACING]||0),n+=a[mxConstants.STYLE_SPACING_TOP]||0,n+=a[mxConstants.STYLE_SPACING_BOTTOM]||0,null!=(t=this.getFoldingImage(t))&&(s+=t.width+8),n=null!=(t=this.getLabel(e))&&0<t.length?(this.isHtmlLabel(e)||(t=t.replace(/\n/g,"<br>")),e=(i=mxUtils.getSizeForString(t,i,a[mxConstants.STYLE_FONTFAMILY])).width+s,n=i.height+n,mxUtils.getValue(a,mxConstants.STYLE_HORIZONTAL,!0)||(a=n,n=e,e=a),this.gridEnabled&&(e=this.snap(e+this.gridSize/2),n=this.snap(n+this.gridSize/2)),new mxRectangle(0,0,e,n)):new mxRectangle(0,0,a=4*this.gridSize,a)}}return n},mxGraph.prototype.handleGesture=function(e,n){if(.2<Math.abs(1-n.scale)){var t=this.view.scale,a=this.view.translate,i=e.width*n.scale,s=e.height*n.scale,o=e.y-(s-e.height)/2;t=new mxRectangle(this.snap((e.x-(i-e.width)/2)/t)-a.x,this.snap(o/t)-a.y,this.snap(i/t),this.snap(s/t));this.resizeCell(e.cell,t)}},mxGraph.prototype.resizeCell=function(e,n){return this.resizeCells([e],[n])[0]},mxGraph.prototype.resizeCells=function(e,n){this.model.beginUpdate();try{this.cellsResized(e,n),this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",e,"bounds",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsResized=function(e,n){if(null!=e&&null!=n&&e.length==n.length){this.model.beginUpdate();try{for(var t=0;t<e.length;t++){var a=n[t],i=this.model.getGeometry(e[t]);if(null!=i&&(i.x!=a.x||i.y!=a.y||i.width!=a.width||i.height!=a.height)){if((i=i.clone()).relative){var s=i.offset;null!=s&&(s.x+=a.x-i.x,s.y+=a.y-i.y)}else i.x=a.x,i.y=a.y;i.width=a.width,i.height=a.height,!i.relative&&this.model.isVertex(e[t])&&!this.isAllowNegativeCoordinates()&&(i.x=Math.max(0,i.x),i.y=Math.max(0,i.y)),this.model.setGeometry(e[t],i),this.isExtendParent(e[t])&&this.extendParent(e[t])}}this.resetEdgesOnResize&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED,"cells",e,"bounds",n))}finally{this.model.endUpdate()}}},mxGraph.prototype.extendParent=function(e){if(null!=e){var n=this.model.getParent(e),t=this.model.getGeometry(n);null!=n&&null!=t&&!this.isCellCollapsed(n)&&(null!=(e=this.model.getGeometry(e))&&(t.width<e.x+e.width||t.height<e.y+e.height))&&((t=t.clone()).width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height),this.cellsResized([n],[t]))}},mxGraph.prototype.importCells=function(e,n,t,a,i){return this.moveCells(e,n,t,!0,a,i)},mxGraph.prototype.moveCells=function(e,n,t,a,i,s){if(n=null!=n?n:0,t=null!=t?t:0,a=null!=a&&a,null!=e&&(0!=n||0!=t||a||null!=i)){this.model.beginUpdate();try{a&&(e=this.cloneCells(e,this.isCloneInvalidEdges()),null==i&&(i=this.getDefaultParent()));var o=this.isAllowNegativeCoordinates();if(null!=i&&this.setAllowNegativeCoordinates(!0),this.cellsMoved(e,n,t,!a&&this.isDisconnectOnMove()&&this.isAllowDanglingEdges(),null==i),this.setAllowNegativeCoordinates(o),null!=i){var r=this.model.getChildCount(i);this.cellsAdded(e,i,r,null,null,!0)}this.fireEvent(new mxEventObject(mxEvent.MOVE_CELLS,"cells",e,"dx",n,"dy",t,"clone",a,"target",i,"event",s))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.cellsMoved=function(e,n,t,a,i){if(null!=e&&(0!=n||0!=t)){this.model.beginUpdate();try{a&&this.disconnectGraph(e);for(var s=0;s<e.length;s++)this.translateCell(e[s],n,t),i&&this.constrainChild(e[s]);this.resetEdgesOnMove&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_MOVED,"cells",e,"dx",t,"dy",t,"disconnect",a))}finally{this.model.endUpdate()}}},mxGraph.prototype.translateCell=function(e,n,t){var a=this.model.getGeometry(e);null!=a&&((a=a.clone()).translate(n,t),!a.relative&&this.model.isVertex(e)&&!this.isAllowNegativeCoordinates()&&(a.x=Math.max(0,a.x),a.y=Math.max(0,a.y)),a.relative&&!this.model.isEdge(e)&&(null==a.offset?a.offset=new mxPoint(n,t):(a.offset.x+=n,a.offset.y+=t)),this.model.setGeometry(e,a))},mxGraph.prototype.getCellContainmentArea=function(e){if(null!=e&&!this.model.isEdge(e)){var n=this.model.getParent(e);if(n==this.getDefaultParent()||n==this.getCurrentRoot())return this.getMaximumGraphBounds();if(null!=n&&n!=this.getDefaultParent())if(null!=(i=this.model.getGeometry(n))){var t=e=0,a=i.width,i=i.height;return this.isSwimlane(n)&&(e=(n=this.getStartSize(n)).width,a-=n.width,t=n.height,i-=n.height),new mxRectangle(e,t,a,i)}}return null},mxGraph.prototype.getMaximumGraphBounds=function(){return this.maximumGraphBounds},mxGraph.prototype.constrainChild=function(e){if(null!=e){var n=this.model.getGeometry(e),t=this.isConstrainChild(e)?this.getCellContainmentArea(e):this.getMaximumGraphBounds();null!=n&&null!=t&&!n.relative&&(n.x<t.x||n.y<t.y||t.width<n.x+n.width||t.height<n.y+n.height)&&(e=this.getOverlap(e),0<t.width&&(n.x=Math.min(n.x,t.x+t.width-(1-e)*n.width)),0<t.height&&(n.y=Math.min(n.y,t.y+t.height-(1-e)*n.height)),n.x=Math.max(n.x,t.x-n.width*e),n.y=Math.max(n.y,t.y-n.height*e))}},mxGraph.prototype.resetEdges=function(e){if(null!=e){for(var n={},t=0;t<e.length;t++){var a=mxCellPath.create(e[t]);n[a]=e[t]}this.model.beginUpdate();try{for(t=0;t<e.length;t++){var i=this.model.getEdges(e[t]);if(null!=i)for(a=0;a<i.length;a++){var s=this.view.getState(i[a]),o=null!=s?s.getVisibleTerminal(!0):this.view.getVisibleTerminal(i[a],!0),r=null!=s?s.getVisibleTerminal(!1):this.view.getVisibleTerminal(i[a],!1),l=mxCellPath.create(o),d=mxCellPath.create(r);(null==n[l]||null==n[d])&&this.resetEdge(i[a])}this.resetEdges(this.model.getChildren(e[t]))}}finally{this.model.endUpdate()}}},mxGraph.prototype.resetEdge=function(e){var n=this.model.getGeometry(e);return null!=n&&null!=n.points&&0<n.points.length&&((n=n.clone()).points=[],this.model.setGeometry(e,n)),e},mxGraph.prototype.getAllConnectionConstraints=function(e,n){return null!=e&&null!=e.shape&&null!=e.shape.stencil?e.shape.stencil.constraints:null},mxGraph.prototype.getConnectionConstraint=function(e,n,t){n=null;var a=e.style[t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X];if(null!=a){var i=e.style[t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y];null!=i&&(n=new mxPoint(parseFloat(a),parseFloat(i)))}return a=!1,null!=n&&(a=mxUtils.getValue(e.style,t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,!0)),new mxConnectionConstraint(n,a)},mxGraph.prototype.setConnectionConstraint=function(e,n,t,a){if(null!=a){this.model.beginUpdate();try{null==a||null==a.point?(this.setCellStyles(t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,null,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,null,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e])):null!=a.point&&(this.setCellStyles(t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,a.point.x,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,a.point.y,[e]),a.perimeter?this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e]):this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,"0",[e]))}finally{this.model.endUpdate()}}},mxGraph.prototype.getConnectionPoint=function(e,n){var t=null;if(null!=e){var a=this.view.getPerimeterBounds(e),i=new mxPoint(a.getCenterX(),a.getCenterY()),s=e.style[mxConstants.STYLE_DIRECTION],o=0;if(null!=s&&("north"==s?o+=270:"west"==s?o+=180:"south"==s&&(o+=90),"north"==s||"south"==s)){a.x+=a.width/2-a.height/2,a.y+=a.height/2-a.width/2;var r=a.width;a.width=a.height,a.height=r}if(null!=n.point){var l=t=1,d=0,c=0;if(this.getModel().isVertex(e.cell)){var m=e.style[mxConstants.STYLE_FLIPH],u=e.style[mxConstants.STYLE_FLIPV];null!=e.shape.stencil&&(m=1==mxUtils.getValue(e.style,"stencilFlipH",0)||m,u=1==mxUtils.getValue(e.style,"stencilFlipV",0)||u),"north"!=s&&"south"!=s||(r=m,m=u,u=r),m&&(t=-1,d=-a.width),u&&(l=-1,c=-a.height)}t=new mxPoint(a.x+n.point.x*a.width*t-d,a.y+n.point.y*a.height*l-c)}s=e.style[mxConstants.STYLE_ROTATION]||0,n.perimeter?(0!=o&&null!=t&&(r=a=0,90==o?r=1:180==o?a=-1:270==s&&(r=-1),t=mxUtils.getRotatedPoint(t,a,r,i)),null!=t&&n.perimeter&&(t=this.view.getPerimeterPoint(e,t,!1))):s+=o,0!=s&&null!=t&&(o=mxUtils.toRadians(s),a=Math.cos(o),r=Math.sin(o),t=mxUtils.getRotatedPoint(t,a,r,i))}return t},mxGraph.prototype.connectCell=function(e,n,t,a){this.model.beginUpdate();try{var i=this.model.getTerminal(e,t);this.cellConnected(e,n,t,a),this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL,"edge",e,"terminal",n,"source",t,"previous",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellConnected=function(e,n,t,a){if(null!=e){this.model.beginUpdate();try{var i=this.model.getTerminal(e,t);this.setConnectionConstraint(e,n,t,a),this.isPortsEnabled()&&(a=null,this.isPort(n)&&(a=n.getId(),n=this.getTerminalForPort(n,t)),this.setCellStyles(t?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT,a,[e])),this.model.setTerminal(e,n,t),this.resetEdgesOnConnect&&this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED,"edge",e,"terminal",n,"source",t,"previous",i))}finally{this.model.endUpdate()}}},mxGraph.prototype.disconnectGraph=function(e){if(null!=e){this.model.beginUpdate();try{for(var n=this.view.scale,t=this.view.translate,a={},i=0;i<e.length;i++){a[mxCellPath.create(e[i])]=e[i]}for(i=0;i<e.length;i++)if(this.model.isEdge(e[i])){if(null!=(r=this.model.getGeometry(e[i]))){var s=this.view.getState(e[i]),o=this.view.getState(this.model.getParent(e[i]));if(null!=s&&null!=o){var r=r.clone(),l=-o.origin.x,d=-o.origin.y,c=s.absolutePoints,m=this.model.getTerminal(e[i],!0);if(null!=m&&this.isCellDisconnectable(e[i],m,!0)){for(var u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);null==m&&(r.setTerminalPoint(new mxPoint(c[0].x/n-t.x+l,c[0].y/n-t.y+d),!0),this.model.setTerminal(e[i],null,!0))}var p=this.model.getTerminal(e[i],!1);if(null!=p&&this.isCellDisconnectable(e[i],p,!1)){for(var g=mxCellPath.create(p);null!=p&&null==a[g];)p=this.model.getParent(p),g=mxCellPath.create(p);if(null==p){var v=c.length-1;r.setTerminalPoint(new mxPoint(c[v].x/n-t.x+l,c[v].y/n-t.y+d),!1),this.model.setTerminal(e[i],null,!1)}}this.model.setGeometry(e[i],r)}}}}finally{this.model.endUpdate()}}},mxGraph.prototype.getCurrentRoot=function(){return this.view.currentRoot},mxGraph.prototype.getTranslateForRoot=function(e){return null},mxGraph.prototype.isPort=function(e){return!1},mxGraph.prototype.getTerminalForPort=function(e,n){return this.model.getParent(e)},mxGraph.prototype.getChildOffsetForCell=function(e){return null},mxGraph.prototype.enterGroup=function(e){null!=(e=e||this.getSelectionCell())&&this.isValidRoot(e)&&(this.view.setCurrentRoot(e),this.clearSelection())},mxGraph.prototype.exitGroup=function(){var e=this.model.getRoot(),n=this.getCurrentRoot();if(null!=n){for(var t=this.model.getParent(n);t!=e&&!this.isValidRoot(t)&&this.model.getParent(t)!=e;)t=this.model.getParent(t);t==e||this.model.getParent(t)==e?this.view.setCurrentRoot(null):this.view.setCurrentRoot(t),null!=this.view.getState(n)&&this.setSelectionCell(n)}},mxGraph.prototype.home=function(){var e=this.getCurrentRoot();null!=e&&(this.view.setCurrentRoot(null),null!=this.view.getState(e)&&this.setSelectionCell(e))},mxGraph.prototype.isValidRoot=function(e){return null!=e},mxGraph.prototype.getGraphBounds=function(){return this.view.getGraphBounds()},mxGraph.prototype.getCellBounds=function(e,n,t){var a=[e];if(n&&(a=a.concat(this.model.getEdges(e))),a=this.view.getBounds(a),t){t=this.model.getChildCount(e);for(var i=0;i<t;i++){var s=this.getCellBounds(this.model.getChildAt(e,i),n,!0);null!=a?a.add(s):a=s}}return a},mxGraph.prototype.getBoundingBoxFromGeometry=function(e,n){n=null!=n&&n;var t=null;if(null!=e)for(var a=0;a<e.length;a++)if(n||this.model.isVertex(e[a])){var i=this.getCellGeometry(e[a]);if(null!=i){var s=i.points;if(null!=s&&0<s.length){for(var o=new mxRectangle(s[0].x,s[0].y,0,0),r=function(e){null!=e&&o.add(new mxRectangle(e.x,e.y,0,0))},l=1;l<s.length;l++)r(s[l]);r(i.getTerminalPoint(!0)),r(i.getTerminalPoint(!1))}null==t?t=new mxRectangle(i.x,i.y,i.width,i.height):t.add(i)}}return t},mxGraph.prototype.refresh=function(e){this.view.clear(e,null==e),this.view.validate(),this.sizeDidChange(),this.fireEvent(new mxEventObject(mxEvent.REFRESH))},mxGraph.prototype.snap=function(e){return this.gridEnabled&&(e=Math.round(e/this.gridSize)*this.gridSize),e},mxGraph.prototype.panGraph=function(e,n){if(this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container))this.container.scrollLeft=-e,this.container.scrollTop=-n;else{var t=this.view.getCanvas();if(this.dialect==mxConstants.DIALECT_SVG)if(0==e&&0==n){if(mxClient.IS_IE?t.setAttribute("transform","translate("+e+","+n+")"):t.removeAttribute("transform"),null!=this.shiftPreview1){for(var a=this.shiftPreview1.firstChild;null!=a;){var i=a.nextSibling;this.container.appendChild(a),a=i}for(this.shiftPreview1.parentNode.removeChild(this.shiftPreview1),this.shiftPreview1=null,this.container.appendChild(t.parentNode),a=this.shiftPreview2.firstChild;null!=a;)i=a.nextSibling,this.container.appendChild(a),a=i;this.shiftPreview2.parentNode.removeChild(this.shiftPreview2),this.shiftPreview2=null}}else{if(t.setAttribute("transform","translate("+e+","+n+")"),null==this.shiftPreview1){this.shiftPreview1=document.createElement("div"),this.shiftPreview1.style.position="absolute",this.shiftPreview1.style.overflow="visible",this.shiftPreview2=document.createElement("div"),this.shiftPreview2.style.position="absolute",this.shiftPreview2.style.overflow="visible";var s=this.shiftPreview1;for(a=this.container.firstChild;null!=a;)i=a.nextSibling,a!=t.parentNode?s.appendChild(a):s=this.shiftPreview2,a=i;this.container.insertBefore(this.shiftPreview1,t.parentNode),this.container.appendChild(this.shiftPreview2)}this.shiftPreview1.style.left=e+"px",this.shiftPreview1.style.top=n+"px",this.shiftPreview2.style.left=e+"px",this.shiftPreview2.style.top=n+"px"}else t.style.left=e+"px",t.style.top=n+"px";this.panDx=e,this.panDy=n,this.fireEvent(new mxEventObject(mxEvent.PAN))}},mxGraph.prototype.zoomIn=function(){this.zoom(this.zoomFactor)},mxGraph.prototype.zoomOut=function(){this.zoom(1/this.zoomFactor)},mxGraph.prototype.zoomActual=function(){1==this.view.scale?this.view.setTranslate(0,0):(this.view.translate.x=0,this.view.translate.y=0,this.view.setScale(1))},mxGraph.prototype.zoomTo=function(e,n){this.zoom(e/this.view.scale,n)},mxGraph.prototype.zoom=function(e,n){n=null!=n?n:this.centerZoom;var t=this.view.scale*e,a=this.view.getState(this.getSelectionCell());if(this.keepSelectionVisibleOnZoom&&null!=a)a=new mxRectangle(a.x*e,a.y*e,a.width*e,a.height*e),this.view.scale=t,this.scrollRectToVisible(a)||(this.view.revalidate(),this.view.setScale(t));else if(n&&!mxUtils.hasScrollbars(this.container)){a=this.container.offsetWidth;var i=this.container.offsetHeight;if(1<e){var s=(e-1)/(2*t);a=a*-s,i=i*-s}else a*=s=(1/e-1)/(2*this.view.scale),i*=s;this.view.scaleAndTranslate(t,this.view.translate.x+a,this.view.translate.y+i)}else this.view.setScale(t),mxUtils.hasScrollbars(this.container)&&(i=a=0,n&&(a=this.container.offsetWidth*(e-1)/2,i=this.container.offsetHeight*(e-1)/2),this.container.scrollLeft=Math.round(this.container.scrollLeft*e+a),this.container.scrollTop=Math.round(this.container.scrollTop*e+i))},mxGraph.prototype.zoomToRect=function(e){var n=this.container.clientWidth/e.width/(this.container.clientHeight/e.height);e.x=Math.max(0,e.x),e.y=Math.max(0,e.y);var t=Math.min(this.container.scrollWidth,e.x+e.width),a=Math.min(this.container.scrollHeight,e.y+e.height);e.width=t-e.x,e.height=a-e.y,n<1?(t=((n=e.height/n)-e.height)/2,e.height=n,n=Math.min(e.y,t),e.y-=n,a=Math.min(this.container.scrollHeight,e.y+e.height),e.height=a-e.y):(t=((n*=e.width)-e.width)/2,e.width=n,n=Math.min(e.x,t),e.x-=n,t=Math.min(this.container.scrollWidth,e.x+e.width),e.width=t-e.x),n=this.container.clientWidth/e.width,t=this.view.scale*n,mxUtils.hasScrollbars(this.container)?(this.view.setScale(t),this.container.scrollLeft=Math.round(e.x*n),this.container.scrollTop=Math.round(e.y*n)):this.view.scaleAndTranslate(t,this.view.translate.x-e.x/this.view.scale,this.view.translate.y-e.y/this.view.scale)},mxGraph.prototype.fit=function(e,n){if(null!=this.container){e=null!=e?e:0,n=null!=n&&n;var t=this.container.clientWidth,a=this.container.clientHeight,i=this.view.getGraphBounds();n&&null!=i.x&&null!=i.y&&(i.width+=i.x,i.height+=i.y,i.x=0,i.y=0);var s=this.view.scale,o=i.width/s,r=i.height/s;null!=this.backgroundImage&&(o=Math.max(o,this.backgroundImage.width-i.x/s),r=Math.max(r,this.backgroundImage.height-i.y/s));var l=n?e:2*e;t=Math.floor(100*Math.min(t/(o+l),a/(r+l)))/100;null!=this.minFitScale&&(t=Math.max(t,this.minFitScale)),null!=this.maxFitScale&&(t=Math.min(t,this.maxFitScale)),n?this.view.scale!=t&&this.view.setScale(t):mxUtils.hasScrollbars(this.container)?(this.view.setScale(t),null!=i.x&&(this.container.scrollLeft=Math.round(i.x/s)*t-e-Math.max(0,(this.container.clientWidth-o*t)/2)),null!=i.y&&(this.container.scrollTop=Math.round(i.y/s)*t-e-Math.max(0,(this.container.clientHeight-r*t)/2))):this.view.scaleAndTranslate(t,null!=i.x?Math.floor(this.view.translate.x-i.x/s+e+1):e,null!=i.y?Math.floor(this.view.translate.y-i.y/s+e+1):e)}return this.view.scale},mxGraph.prototype.scrollCellToVisible=function(e,n){var t=-this.view.translate.x,a=-this.view.translate.y,i=this.view.getState(e);null!=i&&(t=new mxRectangle(t+i.x,a+i.y,i.width,i.height),n&&null!=this.container&&(a=this.container.clientWidth,i=this.container.clientHeight,t.x=t.getCenterX()-a/2,t.width=a,t.y=t.getCenterY()-i/2,t.height=i),this.scrollRectToVisible(t)&&this.view.setTranslate(this.view.translate.x,this.view.translate.y))},mxGraph.prototype.scrollRectToVisible=function(e){var n=!1;if(null!=e){var t=this.container.offsetWidth,a=this.container.offsetHeight,i=Math.min(t,e.width),s=Math.min(a,e.height);if(mxUtils.hasScrollbars(this.container)){t=this.container,e.x+=this.view.translate.x,e.y+=this.view.translate.y;var o=t.scrollLeft-e.x;a=Math.max(o-t.scrollLeft,0);0<o?t.scrollLeft-=o+2:0<(o=e.x+i-t.scrollLeft-t.clientWidth)&&(t.scrollLeft+=o+2),i=t.scrollTop-e.y,o=Math.max(0,i-t.scrollTop),0<i?t.scrollTop-=i+2:0<(i=e.y+s-t.scrollTop-t.clientHeight)&&(t.scrollTop+=i+2),!this.useScrollbarsForPanning&&(0!=a||0!=o)&&this.view.setTranslate(a,o)}else{o=-this.view.translate.x;var r=-this.view.translate.y,l=this.view.scale;e.x+i>o+t&&(this.view.translate.x-=(e.x+i-t-o)/l,n=!0),e.y+s>r+a&&(this.view.translate.y-=(e.y+s-a-r)/l,n=!0),e.x<o&&(this.view.translate.x+=(o-e.x)/l,n=!0),e.y<r&&(this.view.translate.y+=(r-e.y)/l,n=!0),n&&(this.view.refresh(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.refresh())}}return n},mxGraph.prototype.getCellGeometry=function(e){return this.model.getGeometry(e)},mxGraph.prototype.isCellVisible=function(e){return this.model.isVisible(e)},mxGraph.prototype.isCellCollapsed=function(e){return this.model.isCollapsed(e)},mxGraph.prototype.isCellConnectable=function(e){return this.model.isConnectable(e)},mxGraph.prototype.isOrthogonal=function(e){var n=e.style[mxConstants.STYLE_ORTHOGONAL];return null!=n?n:(e=this.view.getEdgeStyle(e))==mxEdgeStyle.SegmentConnector||e==mxEdgeStyle.ElbowConnector||e==mxEdgeStyle.SideToSide||e==mxEdgeStyle.TopToBottom||e==mxEdgeStyle.EntityRelation||e==mxEdgeStyle.OrthConnector},mxGraph.prototype.isLoop=function(e){var n=e.getVisibleTerminalState(!0);return e=e.getVisibleTerminalState(!1),null!=n&&n==e},mxGraph.prototype.isCloneEvent=function(e){return mxEvent.isControlDown(e)},mxGraph.prototype.isToggleEvent=function(e){return mxClient.IS_MAC?mxEvent.isMetaDown(e):mxEvent.isControlDown(e)},mxGraph.prototype.isGridEnabledEvent=function(e){return null!=e&&!mxEvent.isAltDown(e)},mxGraph.prototype.isConstrainedEvent=function(e){return mxEvent.isShiftDown(e)},mxGraph.prototype.isForceMarqueeEvent=function(e){return mxEvent.isAltDown(e)},mxGraph.prototype.validationAlert=function(e){mxUtils.alert(e)},mxGraph.prototype.isEdgeValid=function(e,n,t){return null==this.getEdgeValidationError(e,n,t)},mxGraph.prototype.getEdgeValidationError=function(e,n,t){if(null!=e&&!this.isAllowDanglingEdges()&&(null==n||null==t))return"";if(null!=e&&null==this.model.getTerminal(e,!0)&&null==this.model.getTerminal(e,!1))return null;if(!this.allowLoops&&n==t&&null!=n||!this.isValidConnection(n,t))return"";if(null==n||null==t)return this.allowDanglingEdges?null:"";var a="";this.multigraph||(1<(i=this.model.getEdgesBetween(n,t,!0)).length||1==i.length&&i[0]!=e)&&(a+=(mxResources.get(this.alreadyConnectedResource)||this.alreadyConnectedResource)+"\n");var i=this.model.getDirectedEdgeCount(n,!0,e),s=this.model.getDirectedEdgeCount(t,!1,e);if(null!=this.multiplicities)for(var o=0;o<this.multiplicities.length;o++){var r=this.multiplicities[o].check(this,e,n,t,i,s);null!=r&&(a+=r)}return null!=(r=this.validateEdge(e,n,t))&&(a+=r),0<a.length?a:null},mxGraph.prototype.validateEdge=function(e,n,t){return null},mxGraph.prototype.validateGraph=function(e,n){e=null!=e?e:this.model.getRoot(),n=null!=n?n:{};for(var t=!0,a=this.model.getChildCount(e),i=0;i<a;i++){var s=this.model.getChildAt(e,i),o=n;this.isValidRoot(s)&&(o={}),null!=(o=this.validateGraph(s,o))?this.setCellWarning(s,o.replace(/\n/g,"<br>")):this.setCellWarning(s,null),t=t&&null==o}return a="",this.isCellCollapsed(e)&&!t&&(a+=(mxResources.get(this.containsValidationErrorsResource)||this.containsValidationErrorsResource)+"\n"),a=this.model.isEdge(e)?a+(this.getEdgeValidationError(e,this.model.getTerminal(e,!0),this.model.getTerminal(e,!1))||""):a+(this.getCellValidationError(e)||""),null!=(i=this.validateCell(e,n))&&(a+=i),null==this.model.getParent(e)&&this.view.validate(),0<a.length||!t?a:null},mxGraph.prototype.getCellValidationError=function(e){var n=this.model.getDirectedEdgeCount(e,!0),t=this.model.getDirectedEdgeCount(e,!1);e=this.model.getValue(e);var a="";if(null!=this.multiplicities)for(var i=0;i<this.multiplicities.length;i++){var s=this.multiplicities[i];s.source&&mxUtils.isNode(e,s.type,s.attr,s.value)&&(0==s.max&&0<n||1==s.min&&0==n||1==s.max&&1<n)?a+=s.countError+"\n":!s.source&&mxUtils.isNode(e,s.type,s.attr,s.value)&&(0==s.max&&0<t||1==s.min&&0==t||1==s.max&&1<t)&&(a+=s.countError+"\n")}return 0<a.length?a:null},mxGraph.prototype.validateCell=function(e,n){return null},mxGraph.prototype.getBackgroundImage=function(){return this.backgroundImage},mxGraph.prototype.setBackgroundImage=function(e){this.backgroundImage=e},mxGraph.prototype.getFoldingImage=function(e){if(null!=e&&this.foldingEnabled&&!this.getModel().isEdge(e.cell)){var n=this.isCellCollapsed(e.cell);if(this.isCellFoldable(e.cell,!n))return n?this.collapsedImage:this.expandedImage}return null},mxGraph.prototype.convertValueToString=function(e){if(null!=(e=this.model.getValue(e))){if(mxUtils.isNode(e))return e.nodeName;if("function"==typeof e.toString)return e.toString()}return""},mxGraph.prototype.getLabel=function(e){var n="";if(this.labelsVisible&&null!=e){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);mxUtils.getValue(t,mxConstants.STYLE_NOLABEL,!1)||(n=this.convertValueToString(e))}return n},mxGraph.prototype.isHtmlLabel=function(e){return this.isHtmlLabels()},mxGraph.prototype.isHtmlLabels=function(){return this.htmlLabels},mxGraph.prototype.setHtmlLabels=function(e){this.htmlLabels=e},mxGraph.prototype.isWrapping=function(e){var n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&"wrap"==e[mxConstants.STYLE_WHITE_SPACE]},mxGraph.prototype.isLabelClipped=function(e){var n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&"hidden"==e[mxConstants.STYLE_OVERFLOW]},mxGraph.prototype.getTooltip=function(e,t,n,a){var i=null;return null!=e&&(null==e.control||t!=e.control.node&&t.parentNode!=e.control.node||(i=this.collapseExpandResource,i=mxResources.get(i)||i),null==i&&null!=e.overlays&&e.overlays.visit(function(e,n){null!=i||t!=n.node&&t.parentNode!=n.node||(i=n.overlay.toString())}),null==i&&(null!=(n=this.selectionCellsHandler.getHandler(e.cell))&&"function"==typeof n.getTooltipForNode&&(i=n.getTooltipForNode(t))),null==i&&(i=this.getTooltipForCell(e.cell))),i},mxGraph.prototype.getTooltipForCell=function(e){return null!=e&&null!=e.getTooltip?e.getTooltip():this.convertValueToString(e)},mxGraph.prototype.getCursorForCell=function(e){return null},mxGraph.prototype.getStartSize=function(e){var n=new mxRectangle,t=this.view.getState(e);return null!=(e=null!=t?t.style:this.getCellStyle(e))&&(t=parseInt(mxUtils.getValue(e,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,!0)?n.height=t:n.width=t),n},mxGraph.prototype.getImage=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_IMAGE]:null},mxGraph.prototype.getVerticalAlign=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_VERTICAL_ALIGN]||mxConstants.ALIGN_MIDDLE:null},mxGraph.prototype.getIndicatorColor=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_COLOR]:null},mxGraph.prototype.getIndicatorGradientColor=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_GRADIENTCOLOR]:null},mxGraph.prototype.getIndicatorShape=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_SHAPE]:null},mxGraph.prototype.getIndicatorImage=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_IMAGE]:null},mxGraph.prototype.getBorder=function(){return this.border},mxGraph.prototype.setBorder=function(e){this.border=e},mxGraph.prototype.isSwimlane=function(e){var n;if(null!=e&&this.model.getParent(e)!=this.model.getRoot()&&(null!=(n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e))&&!this.model.isEdge(e)))return n[mxConstants.STYLE_SHAPE]==mxConstants.SHAPE_SWIMLANE;return!1},mxGraph.prototype.isResizeContainer=function(){return this.resizeContainer},mxGraph.prototype.setResizeContainer=function(e){this.resizeContainer=e},mxGraph.prototype.isEnabled=function(){return this.enabled},mxGraph.prototype.setEnabled=function(e){this.enabled=e},mxGraph.prototype.isEscapeEnabled=function(){return this.escapeEnabled},mxGraph.prototype.setEscapeEnabled=function(e){this.escapeEnabled=e},mxGraph.prototype.isInvokesStopCellEditing=function(){return this.invokesStopCellEditing},mxGraph.prototype.setInvokesStopCellEditing=function(e){this.invokesStopCellEditing=e},mxGraph.prototype.isEnterStopsCellEditing=function(){return this.enterStopsCellEditing},mxGraph.prototype.setEnterStopsCellEditing=function(e){this.enterStopsCellEditing=e},mxGraph.prototype.isCellLocked=function(e){var n=this.model.getGeometry(e);return this.isCellsLocked()||null!=n&&this.model.isVertex(e)&&n.relative},mxGraph.prototype.isCellsLocked=function(){return this.cellsLocked},mxGraph.prototype.setCellsLocked=function(e){this.cellsLocked=e},mxGraph.prototype.getCloneableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellCloneable(e)}))},mxGraph.prototype.isCellCloneable=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isCellsCloneable()&&0!=e[mxConstants.STYLE_CLONEABLE]},mxGraph.prototype.isCellsCloneable=function(){return this.cellsCloneable},mxGraph.prototype.setCellsCloneable=function(e){this.cellsCloneable=e},mxGraph.prototype.getExportableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.canExportCell(e)}))},mxGraph.prototype.canExportCell=function(e){return this.exportEnabled},mxGraph.prototype.getImportableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.canImportCell(e)}))},mxGraph.prototype.canImportCell=function(e){return this.importEnabled},mxGraph.prototype.isCellSelectable=function(e){return this.isCellsSelectable()},mxGraph.prototype.isCellsSelectable=function(){return this.cellsSelectable},mxGraph.prototype.setCellsSelectable=function(e){this.cellsSelectable=e},mxGraph.prototype.getDeletableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellDeletable(e)}))},mxGraph.prototype.isCellDeletable=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isCellsDeletable()&&0!=e[mxConstants.STYLE_DELETABLE]},mxGraph.prototype.isCellsDeletable=function(){return this.cellsDeletable},mxGraph.prototype.setCellsDeletable=function(e){this.cellsDeletable=e},mxGraph.prototype.isLabelMovable=function(e){return!this.isCellLocked(e)&&(this.model.isEdge(e)&&this.edgeLabelsMovable||this.model.isVertex(e)&&this.vertexLabelsMovable)},mxGraph.prototype.getMovableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellMovable(e)}))},mxGraph.prototype.isCellMovable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsMovable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_MOVABLE]},mxGraph.prototype.isCellsMovable=function(){return this.cellsMovable},mxGraph.prototype.setCellsMovable=function(e){this.cellsMovable=e},mxGraph.prototype.isGridEnabled=function(){return this.gridEnabled},mxGraph.prototype.setGridEnabled=function(e){this.gridEnabled=e},mxGraph.prototype.isPortsEnabled=function(){return this.portsEnabled},mxGraph.prototype.setPortsEnabled=function(e){this.portsEnabled=e},mxGraph.prototype.getGridSize=function(){return this.gridSize},mxGraph.prototype.setGridSize=function(e){this.gridSize=e},mxGraph.prototype.getTolerance=function(){return this.tolerance},mxGraph.prototype.setTolerance=function(e){this.tolerance=e},mxGraph.prototype.isVertexLabelsMovable=function(){return this.vertexLabelsMovable},mxGraph.prototype.setVertexLabelsMovable=function(e){this.vertexLabelsMovable=e},mxGraph.prototype.isEdgeLabelsMovable=function(){return this.edgeLabelsMovable},mxGraph.prototype.setEdgeLabelsMovable=function(e){this.edgeLabelsMovable=e},mxGraph.prototype.isSwimlaneNesting=function(){return this.swimlaneNesting},mxGraph.prototype.setSwimlaneNesting=function(e){this.swimlaneNesting=e},mxGraph.prototype.isSwimlaneSelectionEnabled=function(){return this.swimlaneSelectionEnabled},mxGraph.prototype.setSwimlaneSelectionEnabled=function(e){this.swimlaneSelectionEnabled=e},mxGraph.prototype.isMultigraph=function(){return this.multigraph},mxGraph.prototype.setMultigraph=function(e){this.multigraph=e},mxGraph.prototype.isAllowLoops=function(){return this.allowLoops},mxGraph.prototype.setAllowDanglingEdges=function(e){this.allowDanglingEdges=e},mxGraph.prototype.isAllowDanglingEdges=function(){return this.allowDanglingEdges},mxGraph.prototype.setConnectableEdges=function(e){this.connectableEdges=e},mxGraph.prototype.isConnectableEdges=function(){return this.connectableEdges},mxGraph.prototype.setCloneInvalidEdges=function(e){this.cloneInvalidEdges=e},mxGraph.prototype.isCloneInvalidEdges=function(){return this.cloneInvalidEdges},mxGraph.prototype.setAllowLoops=function(e){this.allowLoops=e},mxGraph.prototype.isDisconnectOnMove=function(){return this.disconnectOnMove},mxGraph.prototype.setDisconnectOnMove=function(e){this.disconnectOnMove=e},mxGraph.prototype.isDropEnabled=function(){return this.dropEnabled},mxGraph.prototype.setDropEnabled=function(e){this.dropEnabled=e},mxGraph.prototype.isSplitEnabled=function(){return this.splitEnabled},mxGraph.prototype.setSplitEnabled=function(e){this.splitEnabled=e},mxGraph.prototype.isCellResizable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsResizable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_RESIZABLE]},mxGraph.prototype.isCellsResizable=function(){return this.cellsResizable},mxGraph.prototype.setCellsResizable=function(e){this.cellsResizable=e},mxGraph.prototype.isTerminalPointMovable=function(e,n){return!0},mxGraph.prototype.isCellBendable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsBendable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_BENDABLE]},mxGraph.prototype.isCellsBendable=function(){return this.cellsBendable},mxGraph.prototype.setCellsBendable=function(e){this.cellsBendable=e},mxGraph.prototype.isCellEditable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsEditable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_EDITABLE]},mxGraph.prototype.isCellsEditable=function(){return this.cellsEditable},mxGraph.prototype.setCellsEditable=function(e){this.cellsEditable=e},mxGraph.prototype.isCellDisconnectable=function(e,n,t){return this.isCellsDisconnectable()&&!this.isCellLocked(e)},mxGraph.prototype.isCellsDisconnectable=function(){return this.cellsDisconnectable},mxGraph.prototype.setCellsDisconnectable=function(e){this.cellsDisconnectable=e},mxGraph.prototype.isValidSource=function(e){return null==e&&this.allowDanglingEdges||null!=e&&(!this.model.isEdge(e)||this.connectableEdges)&&this.isCellConnectable(e)},mxGraph.prototype.isValidTarget=function(e){return this.isValidSource(e)},mxGraph.prototype.isValidConnection=function(e,n){return this.isValidSource(e)&&this.isValidTarget(n)},mxGraph.prototype.setConnectable=function(e){this.connectionHandler.setEnabled(e)},mxGraph.prototype.isConnectable=function(e){return this.connectionHandler.isEnabled()},mxGraph.prototype.setTooltips=function(e){this.tooltipHandler.setEnabled(e)},mxGraph.prototype.setPanning=function(e){this.panningHandler.panningEnabled=e},mxGraph.prototype.isEditing=function(e){if(null==this.cellEditor)return!1;var n=this.cellEditor.getEditingCell();return null==e?null!=n:e==n},mxGraph.prototype.isAutoSizeCell=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isAutoSizeCells()||1==e[mxConstants.STYLE_AUTOSIZE]},mxGraph.prototype.isAutoSizeCells=function(){return this.autoSizeCells},mxGraph.prototype.setAutoSizeCells=function(e){this.autoSizeCells=e},mxGraph.prototype.isExtendParent=function(e){return!this.getModel().isEdge(e)&&this.isExtendParents()},mxGraph.prototype.isExtendParents=function(){return this.extendParents},mxGraph.prototype.setExtendParents=function(e){this.extendParents=e},mxGraph.prototype.isExtendParentsOnAdd=function(){return this.extendParentsOnAdd},mxGraph.prototype.setExtendParentsOnAdd=function(e){this.extendParentsOnAdd=e},mxGraph.prototype.isConstrainChild=function(e){return this.isConstrainChildren()&&!this.getModel().isEdge(this.getModel().getParent(e))},mxGraph.prototype.isConstrainChildren=function(){return this.constrainChildren},mxGraph.prototype.setConstrainChildren=function(e){this.constrainChildren=e},mxGraph.prototype.isAllowNegativeCoordinates=function(){return this.allowNegativeCoordinates},mxGraph.prototype.setAllowNegativeCoordinates=function(e){this.allowNegativeCoordinates=e},mxGraph.prototype.getOverlap=function(e){return this.isAllowOverlapParent(e)?this.defaultOverlap:0},mxGraph.prototype.isAllowOverlapParent=function(e){return!1},mxGraph.prototype.getFoldableCells=function(e,n){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellFoldable(e,n)}))},mxGraph.prototype.isCellFoldable=function(e,n){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return 0<this.model.getChildCount(e)&&0!=t[mxConstants.STYLE_FOLDABLE]},mxGraph.prototype.isValidDropTarget=function(e,n,t){return null!=e&&(this.isSplitEnabled()&&this.isSplitTarget(e,n,t)||!this.model.isEdge(e)&&(this.isSwimlane(e)||0<this.model.getChildCount(e)&&!this.isCellCollapsed(e)))},mxGraph.prototype.isSplitTarget=function(e,n,t){return!(!this.model.isEdge(e)||null==n||1!=n.length||!this.isCellConnectable(n[0])||null!=this.getEdgeValidationError(e,this.model.getTerminal(e,!0),n[0]))&&(t=this.model.getTerminal(e,!0),e=this.model.getTerminal(e,!1),!this.model.isAncestor(n[0],t)&&!this.model.isAncestor(n[0],e))},mxGraph.prototype.getDropTarget=function(e,n,t){if(!this.isSwimlaneNesting())for(var a=0;a<e.length;a++)if(this.isSwimlane(e[a]))return null;if((a=mxUtils.convertPoint(this.container,mxEvent.getClientX(n),mxEvent.getClientY(n))).x-=this.panDx,a.y-=this.panDy,a=this.getSwimlaneAt(a.x,a.y),null==t)t=a;else if(null!=a){for(var i=this.model.getParent(a);null!=i&&this.isSwimlane(i)&&i!=t;)i=this.model.getParent(i);i==t&&(t=a)}for(;null!=t&&!this.isValidDropTarget(t,e,n)&&!this.model.isLayer(t);)t=this.model.getParent(t);return!this.model.isLayer(t)&&mxUtils.indexOf(e,t)<0?t:null},mxGraph.prototype.getDefaultParent=function(){var e=this.defaultParent;return null==e&&(null==(e=this.getCurrentRoot())&&(e=this.model.getRoot(),e=this.model.getChildAt(e,0))),e},mxGraph.prototype.setDefaultParent=function(e){this.defaultParent=e},mxGraph.prototype.getSwimlane=function(e){for(;null!=e&&!this.isSwimlane(e);)e=this.model.getParent(e);return e},mxGraph.prototype.getSwimlaneAt=function(e,n,t){if(null!=(t=t||this.getDefaultParent()))for(var a=this.model.getChildCount(t),i=0;i<a;i++){var s=this.model.getChildAt(t,i),o=this.getSwimlaneAt(e,n,s);if(null!=o)return o;if(this.isSwimlane(s)&&(o=this.view.getState(s),this.intersects(o,e,n)))return s}return null},mxGraph.prototype.getCellAt=function(e,n,t,a,i){if(a=null==a||a,i=null==i||i,null!=(t=null!=t?t:this.getDefaultParent()))for(var s=this.model.getChildCount(t)-1;0<=s;s--){var o=this.model.getChildAt(t,s),r=this.getCellAt(e,n,o,a,i);if(null!=r)return r;if(this.isCellVisible(o)&&(i&&this.model.isEdge(o)||a&&this.model.isVertex(o))&&(r=this.view.getState(o),this.intersects(r,e,n)))return o}return null},mxGraph.prototype.intersects=function(e,n,t){if(null!=e){var a=e.absolutePoints;if(null!=a){e=this.tolerance*this.tolerance;for(var i=a[0],s=1;s<a.length;s++){var o=a[s];if(mxUtils.ptSegDistSq(i.x,i.y,o.x,o.y,n,t)<=e)return!0;i=o}}else if(0!=(i=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))&&(a=Math.cos(-i),i=Math.sin(-i),s=new mxPoint(e.getCenterX(),e.getCenterY()),n=(i=mxUtils.getRotatedPoint(new mxPoint(n,t),a,i,s)).x,t=i.y),mxUtils.contains(e,n,t))return!0}return!1},mxGraph.prototype.hitsSwimlaneContent=function(e,n,t){var a=this.getView().getState(e);if(e=this.getStartSize(e),null!=a){var i=this.getView().getScale();if(n-=a.x,t-=a.y,0<e.width&&0<n&&n>e.width*i||0<e.height&&0<t&&t>e.height*i)return!0}return!1},mxGraph.prototype.getChildVertices=function(e){return this.getChildCells(e,!0,!1)},mxGraph.prototype.getChildEdges=function(e){return this.getChildCells(e,!1,!0)},mxGraph.prototype.getChildCells=function(e,n,t){for(e=null!=e?e:this.getDefaultParent(),e=this.model.getChildCells(e,null!=n&&n,null!=t&&t),n=[],t=0;t<e.length;t++)this.isCellVisible(e[t])&&n.push(e[t]);return n},mxGraph.prototype.getConnections=function(e,n){return this.getEdges(e,n,!0,!0,!1)},mxGraph.prototype.getIncomingEdges=function(e,n){return this.getEdges(e,n,!0,!1,!1)},mxGraph.prototype.getOutgoingEdges=function(e,n){return this.getEdges(e,n,!1,!0,!1)},mxGraph.prototype.getEdges=function(e,n,t,a,i,s){t=null==t||t,a=null==a||a,i=null==i||i,s=null!=s&&s;for(var o=[],r=this.isCellCollapsed(e),l=this.model.getChildCount(e),d=0;d<l;d++){var c=this.model.getChildAt(e,d);!r&&this.isCellVisible(c)||(o=o.concat(this.model.getEdges(c,t,a)))}for(o=o.concat(this.model.getEdges(e,t,a)),r=[],d=0;d<o.length;d++)l=null!=(c=this.view.getState(o[d]))?c.getVisibleTerminal(!0):this.view.getVisibleTerminal(o[d],!0),c=null!=c?c.getVisibleTerminal(!1):this.view.getVisibleTerminal(o[d],!1),(i&&l==c||l!=c&&(t&&c==e&&(null==n||this.isValidAncestor(l,n,s))||a&&l==e&&(null==n||this.isValidAncestor(c,n,s))))&&r.push(o[d]);return r},mxGraph.prototype.isValidAncestor=function(e,n,t){return t?this.model.isAncestor(n,e):this.model.getParent(e)==n},mxGraph.prototype.getOpposites=function(e,n,t,a){t=null==t||t,a=null==a||a;var i=[],s={};if(null!=e)for(var o=0;o<e.length;o++){var r=null!=(l=this.view.getState(e[o]))?l.getVisibleTerminal(!0):this.view.getVisibleTerminal(e[o],!0),l=null!=l?l.getVisibleTerminal(!1):this.view.getVisibleTerminal(e[o],!1);if(r==n&&null!=l&&l!=n&&a){var d=mxCellPath.create(l);null==s[d]&&(s[d]=l,i.push(l))}else l==n&&null!=r&&r!=n&&t&&(null==s[d=mxCellPath.create(r)]&&(s[d]=r,i.push(r)))}return i},mxGraph.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;for(var a=this.getEdges(e),i=[],s=0;s<a.length;s++){var o=null!=(r=this.view.getState(a[s]))?r.getVisibleTerminal(!0):this.view.getVisibleTerminal(a[s],!0),r=null!=r?r.getVisibleTerminal(!1):this.view.getVisibleTerminal(a[s],!1);(o==e&&r==n||!t&&o==n&&r==e)&&i.push(a[s])}return i},mxGraph.prototype.getPointForEvent=function(e,n){var t=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a=this.view.scale,i=this.view.translate,s=0!=n?this.gridSize/2:0;return t.x=this.snap(t.x/a-i.x-s),t.y=this.snap(t.y/a-i.y-s),t},mxGraph.prototype.getCells=function(e,n,t,a,i,s){if(s=null!=s?s:[],0<t||0<a){var o=e+t,r=n+a;if(null!=(i=i||this.getDefaultParent()))for(var l=this.model.getChildCount(i),d=0;d<l;d++){var c=this.model.getChildAt(i,d),m=this.view.getState(c);if(this.isCellVisible(c)&&null!=m){var u=m;0!=(m=mxUtils.getValue(m.style,mxConstants.STYLE_ROTATION)||0)&&(u=mxUtils.getBoundingBox(u,m)),u.x>=e&&u.y+u.height<=r&&u.y>=n&&u.x+u.width<=o?s.push(c):this.getCells(e,n,t,a,c,s)}}}return s},mxGraph.prototype.getCellsBeyond=function(e,n,t,a,i){var s=[];if((a||i)&&(null==t&&(t=this.getDefaultParent()),null!=t))for(var o=this.model.getChildCount(t),r=0;r<o;r++){var l=this.model.getChildAt(t,r),d=this.view.getState(l);this.isCellVisible(l)&&null!=d&&(!a||d.x>=e)&&(!i||d.y>=n)&&s.push(l)}return s},mxGraph.prototype.findTreeRoots=function(e,n,t){n=null!=n&&n,t=null!=t&&t;var a=[];if(null!=e){for(var i=this.getModel(),s=i.getChildCount(e),o=null,r=0,l=0;l<s;l++){var d=i.getChildAt(e,l);if(this.model.isVertex(d)&&this.isCellVisible(d)){for(var c=this.getConnections(d,n?e:null),m=0,u=0,p=0;p<c.length;p++)this.view.getVisibleTerminal(c[p],!0)==d?m++:u++;(t&&0==m&&0<u||!t&&0==u&&0<m)&&a.push(d),r<(c=t?u-m:m-u)&&(r=c,o=d)}}0==a.length&&null!=o&&a.push(o)}return a},mxGraph.prototype.traverse=function(e,n,t,a,i){if(null!=t&&null!=e){n=null==n||n,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=t(i[s]=e,a))||a)&&0<(a=this.model.getEdgeCount(e)))for(s=0;s<a;s++){var o=this.model.getEdgeAt(e,s),r=this.model.getTerminal(o,!0)==e;n&&!r||(r=this.model.getTerminal(o,!r),this.traverse(r,n,t,o,i))}}},mxGraph.prototype.isCellSelected=function(e){return this.getSelectionModel().isSelected(e)},mxGraph.prototype.isSelectionEmpty=function(){return this.getSelectionModel().isEmpty()},mxGraph.prototype.clearSelection=function(){return this.getSelectionModel().clear()},mxGraph.prototype.getSelectionCount=function(){return this.getSelectionModel().cells.length},mxGraph.prototype.getSelectionCell=function(){return this.getSelectionModel().cells[0]},mxGraph.prototype.getSelectionCells=function(){return this.getSelectionModel().cells.slice()},mxGraph.prototype.setSelectionCell=function(e){this.getSelectionModel().setCell(e)},mxGraph.prototype.setSelectionCells=function(e){this.getSelectionModel().setCells(e)},mxGraph.prototype.addSelectionCell=function(e){this.getSelectionModel().addCell(e)},mxGraph.prototype.addSelectionCells=function(e){this.getSelectionModel().addCells(e)},mxGraph.prototype.removeSelectionCell=function(e){this.getSelectionModel().removeCell(e)},mxGraph.prototype.removeSelectionCells=function(e){this.getSelectionModel().removeCells(e)},mxGraph.prototype.selectRegion=function(e,n){var t=this.getCells(e.x,e.y,e.width,e.height);return this.selectCellsForEvent(t,n),t},mxGraph.prototype.selectNextCell=function(){this.selectCell(!0)},mxGraph.prototype.selectPreviousCell=function(){this.selectCell()},mxGraph.prototype.selectParentCell=function(){this.selectCell(!1,!0)},mxGraph.prototype.selectChildCell=function(){this.selectCell(!1,!1,!0)},mxGraph.prototype.selectCell=function(e,n,t){var a=0<(i=this.selectionModel).cells.length?i.cells[0]:null;1<i.cells.length&&i.clear();var i=null!=a?this.model.getParent(a):this.getDefaultParent(),s=this.model.getChildCount(i);null==a&&0<s?(e=this.model.getChildAt(i,0),this.setSelectionCell(e)):null!=a&&!n||null==this.view.getState(i)||null==this.model.getGeometry(i)?null!=a&&t?0<this.model.getChildCount(a)&&(e=this.model.getChildAt(a,0),this.setSelectionCell(e)):0<s&&(n=i.getIndex(a),e=e?(n++,this.model.getChildAt(i,n%s)):(n--,this.model.getChildAt(i,n<0?s-1:n)),this.setSelectionCell(e)):this.getCurrentRoot()!=i&&this.setSelectionCell(i)},mxGraph.prototype.selectAll=function(e){e=e||this.getDefaultParent(),null!=(e=this.model.getChildren(e))&&this.setSelectionCells(e)},mxGraph.prototype.selectVertices=function(e){this.selectCells(!0,!1,e)},mxGraph.prototype.selectEdges=function(e){this.selectCells(!1,!0,e)},mxGraph.prototype.selectCells=function(n,t,e){e=e||this.getDefaultParent();var a=mxUtils.bind(this,function(e){return null!=this.view.getState(e)&&0==this.model.getChildCount(e)&&(this.model.isVertex(e)&&n||this.model.isEdge(e)&&t)});e=this.model.filterDescendants(a,e),this.setSelectionCells(e)},mxGraph.prototype.selectCellForEvent=function(e,n){var t=this.isCellSelected(e);this.isToggleEvent(n)?t?this.removeSelectionCell(e):this.addSelectionCell(e):(!t||1!=this.getSelectionCount())&&this.setSelectionCell(e)},mxGraph.prototype.selectCellsForEvent=function(e,n){this.isToggleEvent(n)?this.addSelectionCells(e):this.setSelectionCells(e)},mxGraph.prototype.createHandler=function(e){var n=null;return null!=e&&(n=this.model.isEdge(e.cell)?(n=this.view.getEdgeStyle(e),this.isLoop(e)||n==mxEdgeStyle.ElbowConnector||n==mxEdgeStyle.SideToSide||n==mxEdgeStyle.TopToBottom?new mxElbowEdgeHandler(e):n==mxEdgeStyle.SegmentConnector||n==mxEdgeStyle.OrthConnector?new mxEdgeSegmentHandler(e):new mxEdgeHandler(e)):new mxVertexHandler(e)),n},mxGraph.prototype.addMouseListener=function(e){null==this.mouseListeners&&(this.mouseListeners=[]),this.mouseListeners.push(e)},mxGraph.prototype.removeMouseListener=function(e){if(null!=this.mouseListeners)for(var n=0;n<this.mouseListeners.length;n++)if(this.mouseListeners[n]==e){this.mouseListeners.splice(n,1);break}},mxGraph.prototype.updateMouseEvent=function(e){if(null==e.graphX||null==e.graphY){var n=mxUtils.convertPoint(this.container,e.getX(),e.getY());e.graphX=n.x-this.panDx,e.graphY=n.y-this.panDy}},mxGraph.prototype.fireMouseEvent=function(e,n,t){if(null==t&&(t=this),this.updateMouseEvent(n),e==mxEvent.MOUSE_DOWN&&(this.isMouseDown=!0),mxClient.IS_TOUCH&&this.doubleTapEnabled&&e==mxEvent.MOUSE_DOWN){var a=(new Date).getTime();a-this.lastTouchTime<this.doubleTapTimeout&&Math.abs(this.lastTouchX-n.getX())<this.doubleTapTolerance&&Math.abs(this.lastTouchY-n.getY())<this.doubleTapTolerance?(this.lastTouchTime=0,this.dblClick(n.getEvent(),n.getCell()),n.getEvent().cancelBubble=!0):(this.lastTouchX=n.getX(),this.lastTouchY=n.getY(),this.lastTouchTime=a)}if(a=2!=n.getEvent().detail,mxClient.IS_IE&&"CSS1Compat"==document.compatMode&&((null!=this.lastMouseX&&Math.abs(this.lastMouseX-n.getX())>this.doubleTapTolerance||null!=this.lastMouseY&&Math.abs(this.lastMouseY-n.getY())>this.doubleTapTolerance)&&(a=!0),e==mxEvent.MOUSE_UP&&(this.lastMouseX=n.getX(),this.lastMouseY=n.getY())),(e!=mxEvent.MOUSE_UP||this.isMouseDown)&&a){if(e==mxEvent.MOUSE_UP&&(this.isMouseDown=!1),!this.isEditing()&&(mxClient.IS_OP||mxClient.IS_SF||mxClient.IS_GC||mxClient.IS_IE&&mxClient.IS_SVG||n.getEvent().target!=this.container)){if(e==mxEvent.MOUSE_MOVE&&this.isMouseDown&&this.autoScroll&&this.scrollPointToVisible(n.getGraphX(),n.getGraphY(),this.autoExtend),null!=this.mouseListeners)for(t=[t,n],n.getEvent().returnValue=!0,a=0;a<this.mouseListeners.length;a++){var i=this.mouseListeners[a];e==mxEvent.MOUSE_DOWN?i.mouseDown.apply(i,t):e==mxEvent.MOUSE_MOVE?i.mouseMove.apply(i,t):e==mxEvent.MOUSE_UP&&i.mouseUp.apply(i,t)}e==mxEvent.MOUSE_UP&&this.click(n)}}else e==mxEvent.MOUSE_UP&&(this.isMouseDown=!1)},mxGraph.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tooltipHandler&&this.tooltipHandler.destroy(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.destroy(),null!=this.panningHandler&&this.panningHandler.destroy(),null!=this.connectionHandler&&this.connectionHandler.destroy(),null!=this.graphHandler&&this.graphHandler.destroy(),null!=this.cellEditor&&this.cellEditor.destroy(),null!=this.view&&this.view.destroy(),null!=this.model&&null!=this.graphModelChangeListener&&(this.model.removeListener(this.graphModelChangeListener),this.graphModelChangeListener=null),this.container=null)},mxCellOverlay.prototype=new mxEventSource,mxCellOverlay.prototype.constructor=mxCellOverlay,mxCellOverlay.prototype.image=null,mxCellOverlay.prototype.tooltip=null,mxCellOverlay.prototype.align=mxConstants.ALIGN_RIGHT,mxCellOverlay.prototype.verticalAlign=mxConstants.ALIGN_BOTTOM,mxCellOverlay.prototype.offset=null,mxCellOverlay.prototype.cursor=null,mxCellOverlay.prototype.defaultOverlap=.5,mxCellOverlay.prototype.getBounds=function(e){var n=e.view.graph.getModel().isEdge(e.cell),t=e.view.scale,a=null,i=this.image.width,s=this.image.height;return n?a=1==(n=e.absolutePoints).length%2?n[Math.floor(n.length/2)]:(e=n[(a=n.length/2)-1],n=n[a],new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2)):((a=new mxPoint).x=this.align==mxConstants.ALIGN_LEFT?e.x:this.align==mxConstants.ALIGN_CENTER?e.x+e.width/2:e.x+e.width,a.y=this.verticalAlign==mxConstants.ALIGN_TOP?e.y:this.verticalAlign==mxConstants.ALIGN_MIDDLE?e.y+e.height/2:e.y+e.height),new mxRectangle(Math.round(a.x-(i*this.defaultOverlap-this.offset.x)*t),Math.round(a.y-(s*this.defaultOverlap-this.offset.y)*t),i*t,s*t)},mxCellOverlay.prototype.toString=function(){return this.tooltip},mxOutline.prototype.source=null,mxOutline.prototype.outline=null,mxOutline.prototype.graphRenderHint=mxConstants.RENDERING_HINT_FASTER,mxOutline.prototype.enabled=!0,mxOutline.prototype.showViewport=!0,mxOutline.prototype.border=10,mxOutline.prototype.sizerSize=8,mxOutline.prototype.updateOnPan=!1,mxOutline.prototype.sizerImage=null,mxOutline.prototype.suspended=!1,mxOutline.prototype.init=function(e){this.outline=new mxGraph(e,this.source.getModel(),this.graphRenderHint,this.source.getStylesheet()),this.outline.foldingEnabled=!1,this.outline.autoScroll=!1;var n=this.outline.graphModelChanged;this.outline.graphModelChanged=mxUtils.bind(this,function(e){!this.suspended&&null!=this.outline&&n.apply(this.outline,arguments)}),mxClient.IS_SVG&&((e=this.outline.getView().getCanvas().parentNode).setAttribute("shape-rendering","optimizeSpeed"),e.setAttribute("image-rendering","optimizeSpeed")),this.outline.labelsVisible=!1,this.outline.setEnabled(!1),this.updateHandler=mxUtils.bind(this,function(e,n){!this.suspended&&!this.active&&this.update()}),this.source.getModel().addListener(mxEvent.CHANGE,this.updateHandler),this.outline.addMouseListener(this),(e=this.source.getView()).addListener(mxEvent.SCALE,this.updateHandler),e.addListener(mxEvent.TRANSLATE,this.updateHandler),e.addListener(mxEvent.SCALE_AND_TRANSLATE,this.updateHandler),e.addListener(mxEvent.DOWN,this.updateHandler),e.addListener(mxEvent.UP,this.updateHandler),mxEvent.addListener(this.source.container,"scroll",this.updateHandler),this.panHandler=mxUtils.bind(this,function(e){this.updateOnPan&&this.updateHandler.apply(this,arguments)}),this.source.addListener(mxEvent.PAN,this.panHandler),this.refreshHandler=mxUtils.bind(this,function(e){this.outline.setStylesheet(this.source.getStylesheet()),this.outline.refresh()}),this.source.addListener(mxEvent.REFRESH,this.refreshHandler),this.bounds=new mxRectangle(0,0,0,0),this.selectionBorder=new mxRectangleShape(this.bounds,null,mxConstants.OUTLINE_COLOR,mxConstants.OUTLINE_STROKEWIDTH),this.selectionBorder.dialect=this.outline.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.init(this.outline.getView().getOverlayPane()),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.outline),this.selectionBorder.node.style.background="",this.sizer=this.createSizer(),this.sizer.init(this.outline.getView().getOverlayPane()),this.enabled&&(this.sizer.node.style.cursor="pointer"),mxEvent.addListener(this.sizer.node,mxClient.IS_TOUCH?"touchstart":"mousedown",mxUtils.bind(this,function(e){this.outline.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))})),this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display,this.selectionBorder.node.style.cursor="move",this.update(!1)},mxOutline.prototype.isEnabled=function(){return this.enabled},mxOutline.prototype.setEnabled=function(e){this.enabled=e},mxOutline.prototype.setZoomEnabled=function(e){this.sizer.node.style.visibility=e?"visible":"hidden"},mxOutline.prototype.refresh=function(){this.update(!0)},mxOutline.prototype.createSizer=function(){var e=null!=this.sizerImage?new mxImageShape(new mxRectangle(0,0,this.sizerImage.width,this.sizerImage.height),this.sizerImage.src):new mxRectangleShape(new mxRectangle(0,0,this.sizerSize,this.sizerSize),mxConstants.OUTLINE_HANDLE_FILLCOLOR,mxConstants.OUTLINE_HANDLE_STROKECOLOR);return e.dialect=this.outline.dialect,e},mxOutline.prototype.getSourceContainerSize=function(){return new mxRectangle(0,0,this.source.container.scrollWidth,this.source.container.scrollHeight)},mxOutline.prototype.getOutlineOffset=function(e){return null},mxOutline.prototype.update=function(e){if(null!=this.source){var n=this.source.view.scale,t=new mxRectangle((t=this.source.getGraphBounds()).x/n+this.source.panDx,t.y/n+this.source.panDy,t.width/n,t.height/n),a=new mxRectangle(0,0,this.source.container.clientWidth/n,this.source.container.clientHeight/n);(s=t.clone()).add(a);var i=this.getSourceContainerSize(),s=(a=Math.max(i.width/n,s.width),n=Math.max(i.height/n,s.height),Math.max(0,this.outline.container.clientWidth-this.border));i=Math.max(0,this.outline.container.clientHeight-this.border);if(0<(s=Math.min(s/a,i/n))){this.outline.getView().scale!=s&&(this.outline.getView().scale=s,e=!0),(a=this.outline.getView()).currentRoot!=this.source.getView().currentRoot&&a.setCurrentRoot(this.source.getView().currentRoot);i=(n=this.source.view.translate).x+this.source.panDx;var o=n.y+this.source.panDy;null!=(s=this.getOutlineOffset(s))&&(i+=s.x,o+=s.y),t.x<0&&(i-=t.x),t.y<0&&(o-=t.y),a.translate.x==i&&a.translate.y==o||(a.translate.x=i,a.translate.y=o,e=!0);t=a.translate,i=(s=this.source.getView().scale)/a.scale,o=1/a.scale;var r=this.source.container;this.bounds=new mxRectangle((t.x-n.x-this.source.panDx)/o,(t.y-n.y-this.source.panDy)/o,r.clientWidth/i,r.clientHeight/i),this.bounds.x+=this.source.container.scrollLeft*a.scale/s,this.bounds.y+=this.source.container.scrollTop*a.scale/s,(t=this.selectionBorder.bounds).x==this.bounds.x&&t.y==this.bounds.y&&t.width==this.bounds.width&&t.height==this.bounds.height||(this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()),t=this.sizer.bounds,a=new mxRectangle(this.bounds.x+this.bounds.width-t.width/2,this.bounds.y+this.bounds.height-t.height/2,t.width,t.height),t.x==a.x&&t.y==a.y&&t.width==a.width&&t.height==a.height||(this.sizer.bounds=a,"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw()),e&&this.outline.view.revalidate()}}},mxOutline.prototype.mouseDown=function(e,n){this.enabled&&this.showViewport&&(this.zoom=n.isSource(this.sizer),this.startX=n.getX(),this.startY=n.getY(),this.active=!0,this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)?(this.dx0=this.source.container.scrollLeft,this.dy0=this.source.container.scrollTop):this.dy0=this.dx0=0),n.consume()},mxOutline.prototype.mouseMove=function(e,n){if(this.active){this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display;var t=n.getX()-this.startX,a=n.getY()-this.startY,i=null;if(this.zoom)a=t/((i=this.source.container).clientWidth/i.clientHeight),i=new mxRectangle(this.bounds.x,this.bounds.y,Math.max(1,this.bounds.width+t),Math.max(1,this.bounds.height+a)),this.selectionBorder.bounds=i,this.selectionBorder.redraw();else{var s=this.outline.getView().scale;i=new mxRectangle(this.bounds.x+t,this.bounds.y+a,this.bounds.width,this.bounds.height);this.selectionBorder.bounds=i,this.selectionBorder.redraw(),t=t/s*this.source.getView().scale,a=a/s*this.source.getView().scale,this.source.panGraph(-t-this.dx0,-a-this.dy0)}t=this.sizer.bounds,this.sizer.bounds=new mxRectangle(i.x+i.width-t.width/2,i.y+i.height-t.height/2,t.width,t.height),"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw(),n.consume()}},mxOutline.prototype.mouseUp=function(e,n){if(this.active){var t=n.getX()-this.startX,a=n.getY()-this.startY;if(0<Math.abs(t)||0<Math.abs(a)){if(this.zoom){a=this.selectionBorder.bounds.width;var i=this.source.getView().scale;this.source.zoomTo(i-t*i/a,!1)}else this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)||(this.source.panGraph(0,0),t/=this.outline.getView().scale,a/=this.outline.getView().scale,i=this.source.getView().translate,this.source.getView().setTranslate(i.x-t,i.y-a));this.update(),n.consume()}this.index=null,this.active=!1}},mxOutline.prototype.destroy=function(){null!=this.source&&(this.source.removeListener(this.panHandler),this.source.removeListener(this.refreshHandler),this.source.getModel().removeListener(this.updateHandler),this.source.getView().removeListener(this.updateHandler),mxEvent.addListener(this.source.container,"scroll",this.updateHandler),this.source=null),null!=this.outline&&(this.outline.removeMouseListener(this),this.outline.destroy(),this.outline=null),null!=this.selectionBorder&&(this.selectionBorder.destroy(),this.selectionBorder=null),null!=this.sizer&&(this.sizer.destroy(),this.sizer=null)},mxMultiplicity.prototype.type=null,mxMultiplicity.prototype.attr=null,mxMultiplicity.prototype.value=null,mxMultiplicity.prototype.source=null,mxMultiplicity.prototype.min=null,mxMultiplicity.prototype.max=null,mxMultiplicity.prototype.validNeighbors=null,mxMultiplicity.prototype.validNeighborsAllowed=!0,mxMultiplicity.prototype.countError=null,mxMultiplicity.prototype.typeError=null,mxMultiplicity.prototype.check=function(e,n,t,a,i,s){var o="";return(this.source&&this.checkTerminal(e,t,n)||!this.source&&this.checkTerminal(e,a,n))&&(null!=this.countError&&(this.source&&(0==this.max||i>=this.max)||!this.source&&(0==this.max||s>=this.max))&&(o+=this.countError+"\n"),null!=this.validNeighbors&&null!=this.typeError&&0<this.validNeighbors.length&&(this.checkNeighbors(e,n,t,a)||(o+=this.typeError+"\n"))),0<o.length?o:null},mxMultiplicity.prototype.checkNeighbors=function(e,n,t,a){n=e.model.getValue(t),a=e.model.getValue(a),t=!this.validNeighborsAllowed;for(var i=this.validNeighbors,s=0;s<i.length;s++){if(this.source&&this.checkType(e,a,i[s])){t=this.validNeighborsAllowed;break}if(!this.source&&this.checkType(e,n,i[s])){t=this.validNeighborsAllowed;break}}return t},mxMultiplicity.prototype.checkTerminal=function(e,n,t){return n=e.model.getValue(n),this.checkType(e,n,this.type,this.attr,this.value)},mxMultiplicity.prototype.checkType=function(e,n,t,a,i){return null!=n&&(isNaN(n.nodeType)?n==t:mxUtils.isNode(n,t,a,i))},mxLayoutManager.prototype=new mxEventSource,mxLayoutManager.prototype.constructor=mxLayoutManager,mxLayoutManager.prototype.graph=null,mxLayoutManager.prototype.bubbling=!0,mxLayoutManager.prototype.enabled=!0,mxLayoutManager.prototype.updateHandler=null,mxLayoutManager.prototype.moveHandler=null,mxLayoutManager.prototype.isEnabled=function(){return this.enabled},mxLayoutManager.prototype.setEnabled=function(e){this.enabled=e},mxLayoutManager.prototype.isBubbling=function(){return this.bubbling},mxLayoutManager.prototype.setBubbling=function(e){this.bubbling=e},mxLayoutManager.prototype.getGraph=function(){return this.graph},mxLayoutManager.prototype.setGraph=function(e){if(null!=this.graph){var n=this.graph.getModel();n.removeListener(this.undoHandler),this.graph.removeListener(this.moveHandler)}this.graph=e,null!=this.graph&&((n=this.graph.getModel()).addListener(mxEvent.BEFORE_UNDO,this.undoHandler),this.graph.addListener(mxEvent.MOVE_CELLS,this.moveHandler))},mxLayoutManager.prototype.getLayout=function(e){return null},mxLayoutManager.prototype.beforeUndo=function(e){e=this.getCellsForChanges(e.changes);var n=this.getGraph().getModel();if(this.isBubbling())for(var t=n.getParents(e);0<t.length;)e=e.concat(t),t=n.getParents(t);this.layoutCells(mxUtils.sortCells(e,!1))},mxLayoutManager.prototype.cellsMoved=function(e,n){if(null!=e&&null!=n)for(var t=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(n),mxEvent.getClientY(n)),a=this.getGraph().getModel(),i=0;i<e.length;i++){var s=this.getLayout(a.getParent(e[i]));null!=s&&s.moveCell(e[i],t.x,t.y)}},mxLayoutManager.prototype.getCellsForChanges=function(e){for(var n=[],t={},a=0;a<e.length;a++){if((i=e[a])instanceof mxRootChange)return[];for(var i=this.getCellsForChange(i),s=0;s<i.length;s++)if(null!=i[s]){var o=mxCellPath.create(i[s]);null==t[o]&&(t[o]=i[s],n.push(i[s]))}}return n},mxLayoutManager.prototype.getCellsForChange=function(e){var n=this.getGraph().getModel();return e instanceof mxChildChange?[e.child,e.previous,n.getParent(e.child)]:e instanceof mxTerminalChange||e instanceof mxGeometryChange?[e.cell,n.getParent(e.cell)]:[]},mxLayoutManager.prototype.layoutCells=function(e){if(0<e.length){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=null,a=0;a<e.length;a++)e[a]!=n.getRoot()&&e[a]!=t&&(t=e[a],this.executeLayout(this.getLayout(t),t));this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS,"cells",e))}finally{n.endUpdate()}}},mxLayoutManager.prototype.executeLayout=function(e,n){null!=e&&null!=n&&e.execute(n)},mxLayoutManager.prototype.destroy=function(){this.setGraph(null)},mxSpaceManager.prototype=new mxEventSource,mxSpaceManager.prototype.constructor=mxSpaceManager,mxSpaceManager.prototype.graph=null,mxSpaceManager.prototype.enabled=!0,mxSpaceManager.prototype.shiftRightwards=!0,mxSpaceManager.prototype.shiftDownwards=!0,mxSpaceManager.prototype.extendParents=!0,mxSpaceManager.prototype.resizeHandler=null,mxSpaceManager.prototype.foldHandler=null,mxSpaceManager.prototype.isCellIgnored=function(e){return!this.getGraph().getModel().isVertex(e)},mxSpaceManager.prototype.isCellShiftable=function(e){return this.getGraph().getModel().isVertex(e)&&this.getGraph().isCellMovable(e)},mxSpaceManager.prototype.isEnabled=function(){return this.enabled},mxSpaceManager.prototype.setEnabled=function(e){this.enabled=e},mxSpaceManager.prototype.isShiftRightwards=function(){return this.shiftRightwards},mxSpaceManager.prototype.setShiftRightwards=function(e){this.shiftRightwards=e},mxSpaceManager.prototype.isShiftDownwards=function(){return this.shiftDownwards},mxSpaceManager.prototype.setShiftDownwards=function(e){this.shiftDownwards=e},mxSpaceManager.prototype.isExtendParents=function(){return this.extendParents},mxSpaceManager.prototype.setExtendParents=function(e){this.extendParents=e},mxSpaceManager.prototype.getGraph=function(){return this.graph},mxSpaceManager.prototype.setGraph=function(e){null!=this.graph&&(this.graph.removeListener(this.resizeHandler),this.graph.removeListener(this.foldHandler)),this.graph=e,null!=this.graph&&(this.graph.addListener(mxEvent.RESIZE_CELLS,this.resizeHandler),this.graph.addListener(mxEvent.FOLD_CELLS,this.foldHandler))},mxSpaceManager.prototype.cellsResized=function(e){if(null!=e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)if(!this.isCellIgnored(e[t])){this.cellResized(e[t]);break}}finally{n.endUpdate()}}},mxSpaceManager.prototype.cellResized=function(e){var n=this.getGraph(),t=n.getView(),a=n.getModel(),i=t.getState(e),s=t.getState(a.getParent(e));if(null!=i&&null!=s){var o=this.getCellsToShift(i),r=a.getGeometry(e);if(null!=o&&null!=r){var l=t.translate,d=t.scale,c=(t=i.x-s.origin.x-l.x*d,s=i.y-s.origin.y-l.y*d,l=i.x+i.width,i.y+i.height),m=i.width-r.width*d+t-r.x*d,u=i.height-r.height*d+s-r.y*d,p=1-r.width*d/i.width;i=1-r.height*d/i.height;a.beginUpdate();try{for(r=0;r<o.length;r++)o[r]!=e&&this.isCellShiftable(o[r])&&this.shiftCell(o[r],m,u,t,s,l,c,p,i,this.isExtendParents()&&n.isExtendParent(o[r]))}finally{a.endUpdate()}}}},mxSpaceManager.prototype.shiftCell=function(e,n,t,a,i,s,o,r,l,d){var c=(a=this.getGraph()).getView().getState(e);if(null!=c){var m=a.getModel();if(null!=(p=m.getGeometry(e))){m.beginUpdate();try{if(this.isShiftRightwards())if(c.x>=s)(p=p.clone()).translate(-n,0);else{var u=Math.max(0,c.x-x0);(p=p.clone()).translate(-r*u,0)}if(this.isShiftDownwards())if(c.y>=o)(p=p.clone()).translate(0,-t);else{var p,g=Math.max(0,c.y-i);(p=p.clone()).translate(0,-l*g)}p!=m.getGeometry(e)&&(m.setGeometry(e,p),d&&a.extendParent(e))}finally{m.endUpdate()}}}},mxSpaceManager.prototype.getCellsToShift=function(e){var n=this.getGraph(),t=n.getModel().getParent(e.cell),a=this.isShiftDownwards(),i=this.isShiftRightwards();return n.getCellsBeyond(e.x+(a?0:e.width),e.y+(a&&i?0:e.height),t,i,a)},mxSpaceManager.prototype.destroy=function(){this.setGraph(null)},mxSwimlaneManager.prototype=new mxEventSource,mxSwimlaneManager.prototype.constructor=mxSwimlaneManager,mxSwimlaneManager.prototype.graph=null,mxSwimlaneManager.prototype.enabled=!0,mxSwimlaneManager.prototype.horizontal=!0,mxSwimlaneManager.prototype.addEnabled=!0,mxSwimlaneManager.prototype.resizeEnabled=!0,mxSwimlaneManager.prototype.addHandler=null,mxSwimlaneManager.prototype.resizeHandler=null,mxSwimlaneManager.prototype.isEnabled=function(){return this.enabled},mxSwimlaneManager.prototype.setEnabled=function(e){this.enabled=e},mxSwimlaneManager.prototype.isHorizontal=function(){return this.horizontal},mxSwimlaneManager.prototype.setHorizontal=function(e){this.horizontal=e},mxSwimlaneManager.prototype.isAddEnabled=function(){return this.addEnabled},mxSwimlaneManager.prototype.setAddEnabled=function(e){this.addEnabled=e},mxSwimlaneManager.prototype.isResizeEnabled=function(){return this.resizeEnabled},mxSwimlaneManager.prototype.setResizeEnabled=function(e){this.resizeEnabled=e},mxSwimlaneManager.prototype.getGraph=function(){return this.graph},mxSwimlaneManager.prototype.setGraph=function(e){null!=this.graph&&(this.graph.removeListener(this.addHandler),this.graph.removeListener(this.resizeHandler)),this.graph=e,null!=this.graph&&(this.graph.addListener(mxEvent.ADD_CELLS,this.addHandler),this.graph.addListener(mxEvent.CELLS_RESIZED,this.resizeHandler))},mxSwimlaneManager.prototype.isSwimlaneIgnored=function(e){return!this.getGraph().isSwimlane(e)},mxSwimlaneManager.prototype.isCellHorizontal=function(e){if(this.graph.isSwimlane(e)){var n=this.graph.view.getState(e);return e=null!=n?n.style:this.graph.getCellStyle(e),1==mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,1)}return!this.isHorizontal()},mxSwimlaneManager.prototype.cellsAdded=function(e){if(null!=e){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)this.isSwimlaneIgnored(e[t])||this.swimlaneAdded(e[t])}finally{n.endUpdate()}}},mxSwimlaneManager.prototype.swimlaneAdded=function(e){for(var n=this.getGraph().getModel(),t=n.getParent(e),a=n.getChildCount(t),i=null,s=0;s<a;s++){var o=n.getChildAt(t,s);if(o!=e&&!this.isSwimlaneIgnored(o)&&null!=(i=n.getGeometry(o)))break}null!=i&&this.resizeSwimlane(e,i.width,i.height)},mxSwimlaneManager.prototype.cellsResized=function(e){if(null!=e){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)if(!this.isSwimlaneIgnored(e[t])){var a=n.getGeometry(e[t]);if(null!=a){for(var i=new mxRectangle(0,0,a.width,a.height),s=o=e[t];null!=s;){var o=s,r=(s=n.getParent(s),this.graph.isSwimlane(s)?this.graph.getStartSize(s):new mxRectangle);i.width+=r.width,i.height+=r.height}this.resizeSwimlane(o,i.width,i.height)}}}finally{n.endUpdate()}}},mxSwimlaneManager.prototype.resizeSwimlane=function(e,n,t){var a=this.getGraph().getModel();a.beginUpdate();try{if(!this.isSwimlaneIgnored(e))if(null!=(r=a.getGeometry(e))){var i=this.isCellHorizontal(e);(i&&r.height!=t||!i&&r.width!=n)&&(r=r.clone(),i?r.height=t:r.width=n,a.setGeometry(e,r))}var s=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle;n-=s.width,t-=s.height;for(var o=a.getChildCount(e),r=0;r<o;r++){var l=a.getChildAt(e,r);this.resizeSwimlane(l,n,t)}}finally{a.endUpdate()}},mxSwimlaneManager.prototype.destroy=function(){this.setGraph(null)},mxTemporaryCellStates.prototype.view=null,mxTemporaryCellStates.prototype.oldStates=null,mxTemporaryCellStates.prototype.oldBounds=null,mxTemporaryCellStates.prototype.oldScale=null,mxTemporaryCellStates.prototype.destroy=function(){this.view.setScale(this.oldScale),this.view.setStates(this.oldStates),this.view.setGraphBounds(this.oldBounds)},mxCellStatePreview.prototype.graph=null,mxCellStatePreview.prototype.deltas=null,mxCellStatePreview.prototype.count=0,mxCellStatePreview.prototype.isEmpty=function(){return 0==this.count},mxCellStatePreview.prototype.moveState=function(e,n,t,a,i){a=null==a||a,i=null==i||i;var s=mxCellPath.create(e.cell),o=this.deltas[s];return null==o?(o=new mxPoint(n,t),this.deltas[s]=o,this.count++):a?(o.X+=n,o.Y+=t):(o.X=n,o.Y=t),i&&this.addEdges(e),o},mxCellStatePreview.prototype.show=function(e){var n,t=this.graph.getModel(),a=t.getRoot();for(n in this.deltas){var i=mxCellPath.resolve(a,n),s=this.graph.view.getState(i),o=this.deltas[n];i=this.graph.view.getState(t.getParent(i));this.translateState(i,s,o.x,o.y)}for(n in this.deltas)i=mxCellPath.resolve(a,n),s=this.graph.view.getState(i),o=this.deltas[n],i=this.graph.view.getState(t.getParent(i)),this.revalidateState(i,s,o.x,o.y,e)},mxCellStatePreview.prototype.translateState=function(e,n,t,a){if(null!=n){var i=this.graph.getModel();if(i.isVertex(n.cell)){n.invalid=!0,this.graph.view.validateBounds(e,n.cell),e=i.getGeometry(n.cell);var s=mxCellPath.create(n.cell);0==t&&0==a||null==e||e.relative&&null==this.deltas[s]||(n.x+=t,n.y+=a)}for(e=i.getChildCount(n.cell),s=0;s<e;s++)this.translateState(n,this.graph.view.getState(i.getChildAt(n.cell,s)),t,a)}},mxCellStatePreview.prototype.revalidateState=function(e,n,t,a,i){if(null!=n){n.invalid=!0,this.graph.view.validatePoints(e,n.cell);var s=mxCellPath.create(n.cell),o=this.graph.getModel(),r=this.graph.getCellGeometry(n.cell);for(0==t&&0==a||null==r||!r.relative||!o.isVertex(n.cell)||null!=e&&!o.isVertex(e.cell)&&null==this.deltas[s]||(n.x+=t,n.y+=a,this.graph.cellRenderer.redraw(n)),null!=i&&i(n),e=o.getChildCount(n.cell),s=0;s<e;s++)this.revalidateState(n,this.graph.view.getState(o.getChildAt(n.cell,s)),t,a,i)}},mxCellStatePreview.prototype.addEdges=function(e){for(var n=this.graph.getModel(),t=n.getEdgeCount(e.cell),a=0;a<t;a++){var i=this.graph.view.getState(n.getEdgeAt(e.cell,a));null!=i&&this.moveState(i,0,0)}},mxConnectionConstraint.prototype.point=null,mxConnectionConstraint.prototype.perimeter=null,mxGraphHandler.prototype.graph=null,mxGraphHandler.prototype.maxCells=mxClient.IS_IE?20:50,mxGraphHandler.prototype.enabled=!0,mxGraphHandler.prototype.highlightEnabled=!0,mxGraphHandler.prototype.cloneEnabled=!0,mxGraphHandler.prototype.moveEnabled=!0,mxGraphHandler.prototype.guidesEnabled=!1,mxGraphHandler.prototype.guide=null,mxGraphHandler.prototype.currentDx=null,mxGraphHandler.prototype.currentDy=null,mxGraphHandler.prototype.updateCursor=!0,mxGraphHandler.prototype.selectEnabled=!0,mxGraphHandler.prototype.removeCellsFromParent=!0,mxGraphHandler.prototype.connectOnDrop=!1,mxGraphHandler.prototype.scrollOnMove=!0,mxGraphHandler.prototype.minimumSize=6,mxGraphHandler.prototype.previewColor="black",mxGraphHandler.prototype.htmlPreview=!1,mxGraphHandler.prototype.shape=null,mxGraphHandler.prototype.scaleGrid=!1,mxGraphHandler.prototype.rotationEnabled=!0,mxGraphHandler.prototype.isEnabled=function(){return this.enabled},mxGraphHandler.prototype.setEnabled=function(e){this.enabled=e},mxGraphHandler.prototype.isCloneEnabled=function(){return this.cloneEnabled},mxGraphHandler.prototype.setCloneEnabled=function(e){this.cloneEnabled=e},mxGraphHandler.prototype.isMoveEnabled=function(){return this.moveEnabled},mxGraphHandler.prototype.setMoveEnabled=function(e){this.moveEnabled=e},mxGraphHandler.prototype.isSelectEnabled=function(){return this.selectEnabled},mxGraphHandler.prototype.setSelectEnabled=function(e){this.selectEnabled=e},mxGraphHandler.prototype.isRemoveCellsFromParent=function(){return this.removeCellsFromParent},mxGraphHandler.prototype.setRemoveCellsFromParent=function(e){this.removeCellsFromParent=e},mxGraphHandler.prototype.getInitialCellForEvent=function(e){return e.getCell()},mxGraphHandler.prototype.isDelayedSelection=function(e){return this.graph.isCellSelected(e)},mxGraphHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&null!=n.getState()){var t=this.getInitialCellForEvent(n);if(this.cell=null,this.delayedSelection=this.isDelayedSelection(t),this.isSelectEnabled()&&!this.delayedSelection&&this.graph.selectCellForEvent(t,n.getEvent()),this.isMoveEnabled()){var a=this.graph.model,i=a.getGeometry(t);this.graph.isCellMovable(t)&&(!a.isEdge(t)||1<this.graph.getSelectionCount()||null!=i.points&&0<i.points.length||null==a.getTerminal(t,!0)||null==a.getTerminal(t,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(n.getEvent())&&this.graph.isCellsCloneable())&&this.start(t,n.getX(),n.getY()),this.cellWasClicked=!0,!mxClient.IS_SF&&!mxClient.IS_GC||"SELECT"!=n.getSource().nodeName?n.consume():mxClient.IS_SF&&"SELECT"==n.getSource().nodeName&&(this.cellWasClicked=!1,this.first=null)}}},mxGraphHandler.prototype.getGuideStates=function(){var e=this.graph.getDefaultParent(),n=this.graph.getModel(),t=mxUtils.bind(this,function(e){return null!=this.graph.view.getState(e)&&n.isVertex(e)&&null!=n.getGeometry(e)&&!n.getGeometry(e).relative});return this.graph.view.getCellStates(n.filterDescendants(t,e))},mxGraphHandler.prototype.getCells=function(e){return!this.delayedSelection&&this.graph.isCellMovable(e)?[e]:this.graph.getMovableCells(this.graph.getSelectionCells())},mxGraphHandler.prototype.getPreviewBounds=function(e){return null!=(e=this.getBoundingBox(e))&&(e.grow(-1,-1),e.width<this.minimumSize&&(e.x-=(this.minimumSize-e.width)/2,e.width=this.minimumSize),e.height<this.minimumSize&&(e.y-=(this.minimumSize-e.height)/2,e.height=this.minimumSize)),e},mxGraphHandler.prototype.getBoundingBox=function(e){var n=null;if(null!=e&&0<e.length)for(var t=this.graph.getModel(),a=0;a<e.length;a++)if(t.isVertex(e[a])||t.isEdge(e[a])){var i=this.graph.view.getState(e[a]);if(null!=i){var s=i;t.isVertex(e[a])&&null!=i.shape&&null!=i.shape.boundingBox&&(s=i.shape.boundingBox),null==n?n=new mxRectangle(s.x,s.y,s.width,s.height):n.add(s)}}return n},mxGraphHandler.prototype.createPreviewShape=function(e){return(e=new mxRectangleShape(e,null,this.previewColor)).isDashed=!0,this.htmlPreview?(e.dialect=mxConstants.DIALECT_STRICTHTML,e.init(this.graph.container)):(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),e.pointerEvents=!1),e},mxGraphHandler.prototype.start=function(e,n,t){this.cell=e,this.first=mxUtils.convertPoint(this.graph.container,n,t),this.cells=this.getCells(this.cell),this.bounds=this.graph.getView().getBounds(this.cells),this.pBounds=this.getPreviewBounds(this.cells),this.guidesEnabled&&(this.guide=new mxGuide(this.graph,this.getGuideStates()))},mxGraphHandler.prototype.useGuidesForEvent=function(e){return null==this.guide||this.guide.isEnabledForEvent(e.getEvent())},mxGraphHandler.prototype.snap=function(e){var n=this.scaleGrid?this.graph.view.scale:1;return e.x=this.graph.snap(e.x/n)*n,e.y=this.graph.snap(e.y/n)*n,e},mxGraphHandler.prototype.mouseMove=function(e,n){var t=this.graph;if(!n.isConsumed()&&t.isMouseDown&&null!=this.cell&&null!=this.first&&null!=this.bounds){var a=(s=mxUtils.convertPoint(t.container,n.getX(),n.getY())).x-this.first.x,i=s.y-this.first.y,s=t.tolerance;if(null!=this.shape||Math.abs(a)>s||Math.abs(i)>s){null==this.highlight&&(this.highlight=new mxCellHighlight(this.graph,mxConstants.DROP_TARGET_COLOR,3)),null==this.shape&&(this.shape=this.createPreviewShape(this.bounds));var o=t.isGridEnabledEvent(n.getEvent());s=!0;if(null!=this.guide&&this.useGuidesForEvent(n))s=!1,a=(i=this.guide.move(this.bounds,new mxPoint(a,i),o)).x,i=i.y;else if(o){var r=t.getView().translate,l=t.getView().scale;o=this.bounds.x-(t.snap(this.bounds.x/l-r.x)+r.x)*l,r=this.bounds.y-(t.snap(this.bounds.y/l-r.y)+r.y)*l,a=(i=this.snap(new mxPoint(a,i))).x-o,i=i.y-r}for(null!=this.guide&&s&&this.guide.hide(),t.isConstrainedEvent(n.getEvent())&&(Math.abs(a)>Math.abs(i)?i=0:a=0),this.currentDx=a,this.currentDy=i,this.updatePreviewShape(),s=null,i=n.getCell(),t.isDropEnabled()&&this.highlightEnabled&&(s=t.getDropTarget(this.cells,n.getEvent(),i)),o=s,r=t.getModel();null!=o&&o!=this.cells[0];)o=r.getParent(o);l=t.isCloneEvent(n.getEvent())&&t.isCellsCloneable()&&this.isCloneEnabled();var d=!1;null==(a=t.getView().getState(s))||null!=o||r.getParent(this.cell)==s&&!l?(this.target=null,this.connectOnDrop&&null!=i&&1==this.cells.length&&t.getModel().isVertex(i)&&t.isCellConnectable(i)&&(null!=(a=t.getView().getState(i))&&(t=null==t.getEdgeValidationError(null,this.cell,i)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR,this.setHighlightColor(t),d=!0))):(this.target!=s&&(this.target=s,this.setHighlightColor(mxConstants.DROP_TARGET_COLOR)),d=!0),null!=a&&d?this.highlight.highlight(a):this.highlight.hide()}n.consume(),mxEvent.consume(n.getEvent())}else!this.isMoveEnabled()&&!this.isCloneEnabled()||!this.updateCursor||n.isConsumed()||null==n.getState()||t.isMouseDown||(null==(a=t.getCursorForCell(n.getCell()))&&t.isEnabled()&&t.isCellMovable(n.getCell())&&(a=t.getModel().isEdge(n.getCell())?mxConstants.CURSOR_MOVABLE_EDGE:mxConstants.CURSOR_MOVABLE_VERTEX),n.getState().setCursor(a),n.consume())},mxGraphHandler.prototype.updatePreviewShape=function(){null!=this.shape&&(this.shape.bounds=new mxRectangle(Math.round(this.pBounds.x+this.currentDx-this.graph.panDx),Math.round(this.pBounds.y+this.currentDy-this.graph.panDy),this.pBounds.width,this.pBounds.height),this.shape.redraw())},mxGraphHandler.prototype.setHighlightColor=function(e){null!=this.highlight&&this.highlight.setHighlightColor(e)},mxGraphHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()){var t=this.graph;if(null!=this.cell&&null!=this.first&&null!=this.shape&&null!=this.currentDx&&null!=this.currentDy){var a=t.getView().scale,i=t.isCloneEvent(n.getEvent())&&t.isCellsCloneable()&&this.isCloneEnabled(),s=this.currentDx/a,o=(a=this.currentDy/a,n.getCell());this.connectOnDrop&&null==this.target&&null!=o&&t.getModel().isVertex(o)&&t.isCellConnectable(o)&&t.isEdgeValid(null,this.cell,o)?t.connectionHandler.connect(this.cell,o,n.getEvent()):(o=this.target,t.isSplitEnabled()&&t.isSplitTarget(o,this.cells,n.getEvent())?t.splitEdge(o,this.cells,null,s,a):this.moveCells(this.cells,s,a,i,this.target,n.getEvent()))}else this.isSelectEnabled()&&this.delayedSelection&&null!=this.cell&&this.selectDelayed(n)}this.cellWasClicked&&n.consume(),this.reset()},mxGraphHandler.prototype.selectDelayed=function(e){this.graph.selectCellForEvent(this.cell,e.getEvent())},mxGraphHandler.prototype.reset=function(){this.destroyShapes(),this.delayedSelection=this.cellWasClicked=!1,this.target=this.cell=this.first=this.guides=this.currentDy=this.currentDx=null},mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(e,n,t){if(this.graph.getModel().isVertex(e)){if(e=this.graph.getView().getState(e),t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(t),mxEvent.getClientY(t)),0!=(a=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))){n=Math.cos(-a);var a=Math.sin(-a),i=new mxPoint(e.getCenterX(),e.getCenterY());t=mxUtils.getRotatedPoint(t,n,a,i)}return null!=e&&!mxUtils.contains(e,t.x,t.y)}return!1},mxGraphHandler.prototype.moveCells=function(e,n,t,a,i,s){a&&(e=this.graph.getCloneableCells(e)),null==i&&this.isRemoveCellsFromParent()&&this.shouldRemoveCellsFromParent(this.graph.getModel().getParent(this.cell),e,s)&&(i=this.graph.getDefaultParent()),e=this.graph.moveCells(e,n-this.graph.panDx/this.graph.view.scale,t-this.graph.panDy/this.graph.view.scale,a,i,s),this.isSelectEnabled()&&this.scrollOnMove&&this.graph.scrollCellToVisible(e[0]),a&&this.graph.setSelectionCells(e)},mxGraphHandler.prototype.destroyShapes=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.guide&&(this.guide.destroy(),this.guide=null),null!=this.highlight&&(this.highlight.destroy(),this.highlight=null)},mxGraphHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),this.graph.removeListener(this.panHandler),this.destroyShapes()},mxPanningHandler.prototype=new mxPopupMenu,mxPanningHandler.prototype.constructor=mxPanningHandler,mxPanningHandler.prototype.graph=null,mxPanningHandler.prototype.triggerX=null,mxPanningHandler.prototype.triggerY=null,mxPanningHandler.prototype.usePopupTrigger=!0,mxPanningHandler.prototype.useLeftButtonForPanning=!1,mxPanningHandler.prototype.selectOnPopup=!0,mxPanningHandler.prototype.clearSelectionOnBackground=!0,mxPanningHandler.prototype.ignoreCell=!1,mxPanningHandler.prototype.previewEnabled=!0,mxPanningHandler.prototype.useGrid=!1,mxPanningHandler.prototype.panningEnabled=!0,mxPanningHandler.prototype.isPanningEnabled=function(){return this.panningEnabled},mxPanningHandler.prototype.setPanningEnabled=function(e){this.panningEnabled=e},mxPanningHandler.prototype.init=function(){mxPopupMenu.prototype.init.apply(this),mxEvent.addListener(this.div,mxClient.IS_TOUCH?"touchmove":"mousemove",mxUtils.bind(this,function(e){this.graph.tooltipHandler.hide()}))},mxPanningHandler.prototype.isPanningTrigger=function(e){var n=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())&&mxEvent.isLeftMouseButton(n)||mxEvent.isControlDown(n)&&mxEvent.isShiftDown(n)||this.usePopupTrigger&&mxEvent.isPopupTrigger(n)},mxPanningHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()){this.hideMenu(),this.dx0=-this.graph.container.scrollLeft,this.dy0=-this.graph.container.scrollTop;var t=mxUtils.convertPoint(this.graph.container,n.getX(),n.getY());this.triggerX=t.x,this.triggerY=t.y,this.popupTrigger=this.isPopupTrigger(n),this.panningTrigger=this.isPanningEnabled()&&this.isPanningTrigger(n),this.startX=n.getX(),this.startY=n.getY(),this.panningTrigger&&this.consumePanningTrigger(n)}},mxPanningHandler.prototype.consumePanningTrigger=function(e){e.consume()},mxPanningHandler.prototype.mouseMove=function(e,n){var t=n.getX()-this.startX,a=n.getY()-this.startY;if(this.active)this.previewEnabled&&(this.useGrid&&(t=this.graph.snap(t),a=this.graph.snap(a)),this.graph.panGraph(t+this.dx0,a+this.dy0)),this.fireEvent(new mxEventObject(mxEvent.PAN,"event",n)),n.consume();else if(this.panningTrigger){var i=this.active;this.active=Math.abs(t)>this.graph.tolerance||Math.abs(a)>this.graph.tolerance,!i&&this.active&&this.fireEvent(new mxEventObject(mxEvent.PAN_START,"event",n))}},mxPanningHandler.prototype.mouseUp=function(e,n){var t=Math.abs(n.getX()-this.startX),a=Math.abs(n.getY()-this.startY);if(this.active){if(!this.graph.useScrollbarsForPanning||!mxUtils.hasScrollbars(this.graph.container)){t=n.getX()-this.startX,a=n.getY()-this.startY,this.useGrid&&(t=this.graph.snap(t),a=this.graph.snap(a));var i=this.graph.getView().scale,s=this.graph.getView().translate;this.graph.panGraph(0,0),this.panGraph(s.x+t/i,s.y+a/i)}this.active=!1,this.fireEvent(new mxEventObject(mxEvent.PAN_END,"event",n)),n.consume()}else this.popupTrigger&&t<this.graph.tolerance&&a<this.graph.tolerance&&(t=this.getCellForPopupEvent(n),this.graph.isEnabled()&&this.selectOnPopup&&null!=t&&!this.graph.isCellSelected(t)?this.graph.setSelectionCell(t):this.clearSelectionOnBackground&&null==t&&this.graph.clearSelection(),this.graph.tooltipHandler.hide(),a=mxUtils.getScrollOrigin(),a=new mxPoint(n.getX()+a.x,n.getY()+a.y),this.popup(a.x+1,a.y+1,t,n.getEvent()),n.consume());this.popupTrigger=this.panningTrigger=!1},mxPanningHandler.prototype.getCellForPopupEvent=function(e){return e.getCell()},mxPanningHandler.prototype.panGraph=function(e,n){this.graph.getView().setTranslate(e,n)},mxPanningHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),mxPopupMenu.prototype.destroy.apply(this)},mxUtils.extend(mxCellMarker,mxEventSource),mxCellMarker.prototype.graph=null,mxCellMarker.prototype.enabled=!0,mxCellMarker.prototype.hotspot=mxConstants.DEFAULT_HOTSPOT,mxCellMarker.prototype.hotspotEnabled=!1,mxCellMarker.prototype.validColor=null,mxCellMarker.prototype.invalidColor=null,mxCellMarker.prototype.currentColor=null,mxCellMarker.prototype.validState=null,mxCellMarker.prototype.markedState=null,mxCellMarker.prototype.setEnabled=function(e){this.enabled=e},mxCellMarker.prototype.isEnabled=function(){return this.enabled},mxCellMarker.prototype.setHotspot=function(e){this.hotspot=e},mxCellMarker.prototype.getHotspot=function(){return this.hotspot},mxCellMarker.prototype.setHotspotEnabled=function(e){this.hotspotEnabled=e},mxCellMarker.prototype.isHotspotEnabled=function(){return this.hotspotEnabled},mxCellMarker.prototype.hasValidState=function(){return null!=this.validState},mxCellMarker.prototype.getValidState=function(){return this.validState},mxCellMarker.prototype.getMarkedState=function(){return this.markedState},mxCellMarker.prototype.reset=function(){(this.validState=null)!=this.markedState&&(this.markedState=null,this.unmark())},mxCellMarker.prototype.process=function(e){var n=null;if(this.isEnabled()){var t=null!=(n=this.getState(e))&&this.isValidState(n);e=this.getMarkerColor(e.getEvent(),n,t),this.validState=t?n:null,n==this.markedState&&e==this.currentColor||(this.currentColor=e,null!=n&&null!=this.currentColor?(this.markedState=n,this.mark()):null!=this.markedState&&(this.markedState=null,this.unmark()))}return n},mxCellMarker.prototype.markCell=function(e,n){var t=this.graph.getView().getState(e);null!=t&&(this.currentColor=null!=n?n:this.validColor,this.markedState=t,this.mark())},mxCellMarker.prototype.mark=function(){this.highlight.setHighlightColor(this.currentColor),this.highlight.highlight(this.markedState),this.fireEvent(new mxEventObject(mxEvent.MARK,"state",this.markedState))},mxCellMarker.prototype.unmark=function(){this.mark()},mxCellMarker.prototype.isValidState=function(e){return!0},mxCellMarker.prototype.getMarkerColor=function(e,n,t){return t?this.validColor:this.invalidColor},mxCellMarker.prototype.getState=function(e){var n=this.graph.getView();return cell=this.getCell(e),null!=(n=this.getStateToMark(n.getState(cell)))&&this.intersects(n,e)?n:null},mxCellMarker.prototype.getCell=function(e){return e.getCell()},mxCellMarker.prototype.getStateToMark=function(e){return e},mxCellMarker.prototype.intersects=function(e,n){return!this.hotspotEnabled||mxUtils.intersectsHotspot(e,n.getGraphX(),n.getGraphY(),this.hotspot,mxConstants.MIN_HOTSPOT_SIZE,mxConstants.MAX_HOTSPOT_SIZE)},mxCellMarker.prototype.destroy=function(){this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),this.highlight.destroy()},mxUtils.extend(mxSelectionCellsHandler,mxEventSource),mxSelectionCellsHandler.prototype.graph=null,mxSelectionCellsHandler.prototype.enabled=!0,mxSelectionCellsHandler.prototype.refreshHandler=null,mxSelectionCellsHandler.prototype.maxHandlers=100,mxSelectionCellsHandler.prototype.handlers=null,mxSelectionCellsHandler.prototype.isEnabled=function(){return this.enabled},mxSelectionCellsHandler.prototype.setEnabled=function(e){this.enabled=e},mxSelectionCellsHandler.prototype.getHandler=function(e){return this.handlers.get(e)},mxSelectionCellsHandler.prototype.reset=function(){this.handlers.visit(function(e,n){n.reset.apply(n)})},mxSelectionCellsHandler.prototype.refresh=function(){var e=this.handlers;this.handlers=new mxDictionary;for(var n=this.graph.getSelectionCells(),t=0;t<n.length;t++){var a=this.graph.view.getState(n[t]);if(null!=a){var i=e.remove(n[t]);null!=i&&(i.state!=a?(i.destroy(),i=null):i.redraw()),null==i&&(i=this.graph.createHandler(a),this.fireEvent(new mxEventObject(mxEvent.ADD,"state",a))),null!=i&&this.handlers.put(n[t],i)}}e.visit(mxUtils.bind(this,function(e,n){this.fireEvent(new mxEventObject(mxEvent.REMOVE,"state",n.state)),n.destroy()}))},mxSelectionCellsHandler.prototype.mouseDown=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseDown.apply(n,t)})}},mxSelectionCellsHandler.prototype.mouseMove=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseMove.apply(n,t)})}},mxSelectionCellsHandler.prototype.mouseUp=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseUp.apply(n,t)})}},mxSelectionCellsHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.refreshHandler&&(this.graph.getSelectionModel().removeListener(this.refreshHandler),this.graph.getModel().removeListener(this.refreshHandler),this.graph.getView().removeListener(this.refreshHandler),this.refreshHandler=null)},mxUtils.extend(mxConnectionHandler,mxEventSource),mxConnectionHandler.prototype.graph=null,mxConnectionHandler.prototype.factoryMethod=!0,mxConnectionHandler.prototype.moveIconFront=!1,mxConnectionHandler.prototype.moveIconBack=!1,mxConnectionHandler.prototype.connectImage=null,mxConnectionHandler.prototype.targetConnectImage=!1,mxConnectionHandler.prototype.enabled=!0,mxConnectionHandler.prototype.select=!0,mxConnectionHandler.prototype.createTarget=!1;mxConnectionHandler.prototype.marker=null,mxConnectionHandler.prototype.constraintHandler=null,mxConnectionHandler.prototype.error=null,mxConnectionHandler.prototype.waypointsEnabled=!1,mxConnectionHandler.prototype.tapAndHoldEnabled=!0,mxConnectionHandler.prototype.tapAndHoldDelay=500,mxConnectionHandler.prototype.tapAndHoldInProgress=!1,mxConnectionHandler.prototype.tapAndHoldValid=!1,mxConnectionHandler.prototype.tapAndHoldTolerance=4,mxConnectionHandler.prototype.initialTouchX=0,mxConnectionHandler.prototype.initialTouchY=0,mxConnectionHandler.prototype.ignoreMouseDown=!1,mxConnectionHandler.prototype.first=null,mxConnectionHandler.prototype.connectIconOffset=new mxPoint(0,mxConstants.TOOLTIP_VERTICAL_OFFSET),mxConnectionHandler.prototype.edgeState=null,mxConnectionHandler.prototype.changeHandler=null,mxConnectionHandler.prototype.drillHandler=null,mxConnectionHandler.prototype.mouseDownCounter=0,mxConnectionHandler.prototype.movePreviewAway=mxClient.IS_VML,mxConnectionHandler.prototype.isEnabled=function(){return this.enabled},mxConnectionHandler.prototype.setEnabled=function(e){this.enabled=e},mxConnectionHandler.prototype.isCreateTarget=function(){return this.createTarget},mxConnectionHandler.prototype.setCreateTarget=function(e){this.createTarget=e},mxConnectionHandler.prototype.createShape=function(){var e=new mxPolyline([],mxConstants.INVALID_COLOR);if(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),e.svgStrokeTolerance=0,e.pointerEvents=!1,e.isDashed=!0,this.graph.dialect==mxConstants.DIALECT_SVG)e.node.setAttribute("pointer-events","none");else{var n=mxUtils.bind(this,function(e){return e=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),this.graph.view.getState(this.graph.getCellAt(e.x,e.y))});mxEvent.redirectMouseEvents(e.node,this.graph,n)}return e},mxConnectionHandler.prototype.init=function(){this.graph.addMouseListener(this),this.marker=this.createMarker(),this.constraintHandler=new mxConstraintHandler(this.graph),this.changeHandler=mxUtils.bind(this,function(e){null!=this.iconState&&(this.iconState=this.graph.getView().getState(this.iconState.cell)),null!=this.iconState?this.redrawIcons(this.icons,this.iconState):(this.destroyIcons(this.icons),this.previous=null),this.constraintHandler.reset()}),this.graph.getModel().addListener(mxEvent.CHANGE,this.changeHandler),this.graph.getView().addListener(mxEvent.SCALE,this.changeHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.changeHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.changeHandler),this.drillHandler=mxUtils.bind(this,function(e){this.destroyIcons(this.icons)}),this.graph.addListener(mxEvent.START_EDITING,this.drillHandler),this.graph.getView().addListener(mxEvent.DOWN,this.drillHandler),this.graph.getView().addListener(mxEvent.UP,this.drillHandler)},mxConnectionHandler.prototype.isConnectableCell=function(e){return!0},mxConnectionHandler.prototype.createMarker=function(){var a=new mxCellMarker(this.graph);return a.hotspotEnabled=!0,a.getCell=mxUtils.bind(this,function(e,n){return n=mxCellMarker.prototype.getCell.apply(a,arguments),this.error=null,this.isConnectableCell(n)?(null!=n?this.isConnecting()?null!=this.previous&&(this.error=this.validateConnection(this.previous.cell,n),null!=this.error&&0==this.error.length&&(n=null,this.isCreateTarget()&&(this.error=null))):this.isValidSource(n)||(n=null):this.isConnecting()&&!this.isCreateTarget()&&!this.graph.allowDanglingEdges&&(this.error=""),n):null}),a.isValidState=mxUtils.bind(this,function(e){return this.isConnecting()?null==this.error:mxCellMarker.prototype.isValidState.apply(a,arguments)}),a.getMarkerColor=mxUtils.bind(this,function(e,n,t){return null==this.connectImage||this.isConnecting()?mxCellMarker.prototype.getMarkerColor.apply(a,arguments):null}),a.intersects=mxUtils.bind(this,function(e,n){return!(null==this.connectImage&&!this.isConnecting())||mxCellMarker.prototype.intersects.apply(a,arguments)}),a},mxConnectionHandler.prototype.start=function(e,n,t,a){this.previous=e,this.first=new mxPoint(n,t),this.edgeState=null!=a?a:this.createEdgeState(null),this.marker.currentColor=this.marker.validColor,this.marker.markedState=e,this.marker.mark(),this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous))},mxConnectionHandler.prototype.isConnecting=function(){return null!=this.first&&null!=this.shape},mxConnectionHandler.prototype.isValidSource=function(e){return this.graph.isValidSource(e)},mxConnectionHandler.prototype.isValidTarget=function(e){return!0},mxConnectionHandler.prototype.validateConnection=function(e,n){return this.isValidTarget(n)?this.graph.getEdgeValidationError(null,e,n):""},mxConnectionHandler.prototype.getConnectImage=function(e){return this.connectImage},mxConnectionHandler.prototype.isMoveIconToFrontForState=function(e){return null!=e.text&&e.text.node.parentNode==this.graph.container||this.moveIconFront},mxConnectionHandler.prototype.createIcons=function(e){if(null==(i=this.getConnectImage(e))||null==e)return null;this.iconState=e;var n=[],t=new mxImageShape(new mxRectangle(0,0,i.width,i.height),i.src,null,null,0);t.preserveImageAspect=!1,this.isMoveIconToFrontForState(e)?(t.dialect=mxConstants.DIALECT_STRICTHTML,t.init(this.graph.container)):(t.dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,t.init(this.graph.getView().getOverlayPane()),this.moveIconBack&&null!=t.node.previousSibling&&t.node.parentNode.insertBefore(t.node,t.node.parentNode.firstChild)),t.node.style.cursor=mxConstants.CURSOR_CONNECT;var a=mxUtils.bind(this,function(){return null!=this.currentState?this.currentState:e}),i=mxUtils.bind(this,function(e){mxEvent.isConsumed(e)||(this.icon=t,this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,a())))});return mxEvent.redirectMouseEvents(t.node,this.graph,a,i),n.push(t),this.redrawIcons(n,this.iconState),n},mxConnectionHandler.prototype.redrawIcons=function(e,n){if(null!=e&&null!=e[0]&&null!=n){var t=this.getIconPosition(e[0],n);e[0].bounds.x=t.x,e[0].bounds.y=t.y,e[0].redraw()}},mxConnectionHandler.prototype.getIconPosition=function(e,n){var t=this.graph.getView().scale,a=n.getCenterX(),i=n.getCenterY();if(this.graph.isSwimlane(n.cell)){a=0!=(s=this.graph.getStartSize(n.cell)).width?n.x+s.width*t/2:a,i=0!=s.height?n.y+s.height*t/2:i;if(0!=(s=mxUtils.toRadians(mxUtils.getValue(n.style,mxConstants.STYLE_ROTATION)||0))){t=Math.cos(s);var s=Math.sin(s),o=new mxPoint(n.getCenterX(),n.getCenterY());a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),t,s,o)).x,i=i.y}}return new mxPoint(a-e.bounds.width/2,i-e.bounds.height/2)},mxConnectionHandler.prototype.destroyIcons=function(e){if(null!=e){this.iconState=null;for(var n=0;n<e.length;n++)e[n].destroy()}},mxConnectionHandler.prototype.isStartEvent=function(e){return!this.graph.isForceMarqueeEvent(e.getEvent())&&(null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint||null!=this.previous&&null==this.error&&(null==this.icons||null!=this.icons&&null!=this.icon))},mxConnectionHandler.prototype.mouseDown=function(e,n){if(this.mouseDownCounter++,this.isEnabled()&&this.graph.isEnabled()&&!n.isConsumed()&&!this.isConnecting()&&this.isStartEvent(n)){if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint?(this.sourceConstraint=this.constraintHandler.currentConstraint,this.previous=this.constraintHandler.currentFocus,this.first=this.constraintHandler.currentPoint.clone()):this.first=new mxPoint(n.getGraphX(),n.getGraphY()),this.edgeState=this.createEdgeState(n),this.mouseDownCounter=1,this.waypointsEnabled&&null==this.shape&&(this.waypoints=null,this.shape=this.createShape()),null==this.previous&&null!=this.edgeState){var t=this.graph.getPointForEvent(n.getEvent());this.edgeState.cell.geometry.setTerminalPoint(t,!0)}this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)),n.consume()}else if(mxClient.IS_TOUCH&&this.tapAndHoldEnabled&&!this.tapAndHoldInProgress&&this.isEnabled()&&this.graph.isEnabled()&&!this.isConnecting()){this.tapAndHoldInProgress=!0,this.initialTouchX=n.getX(),this.initialTouchY=n.getY();var a=this.graph.view.getState(this.marker.getCell(n));this.tapAndHoldThread&&window.clearTimeout(this.tapAndHoldThread),this.tapAndHoldThread=window.setTimeout(mxUtils.bind(this,function(){this.tapAndHoldValid&&this.tapAndHold(n,a),this.tapAndHoldValid=this.tapAndHoldInProgress=!1}),this.tapAndHoldDelay),this.tapAndHoldValid=!0}this.selectedIcon=this.icon,this.icon=null},mxConnectionHandler.prototype.tapAndHold=function(e,n){null!=n&&(this.marker.currentColor=this.marker.validColor,this.marker.markedState=n,this.marker.mark(),this.first=new mxPoint(e.getGraphX(),e.getGraphY()),this.edgeState=this.createEdgeState(e),this.previous=n,this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)))},mxConnectionHandler.prototype.isImmediateConnectSource=function(e){return!this.graph.isCellMovable(e.cell)},mxConnectionHandler.prototype.createEdgeState=function(e){return null},mxConnectionHandler.prototype.updateCurrentState=function(e){var n=this.marker.process(e);this.constraintHandler.update(e,null==this.first),this.currentState=n},mxConnectionHandler.prototype.convertWaypoint=function(e){var n=this.graph.getView().getScale(),t=this.graph.getView().getTranslate();e.x=e.x/n-t.x,e.y=e.y/n-t.y},mxConnectionHandler.prototype.mouseMove=function(e,n){if(this.tapAndHoldValid&&(this.tapAndHoldValid=Math.abs(this.initialTouchX-n.getX())<this.tapAndHoldTolerance&&Math.abs(this.initialTouchY-n.getY())<this.tapAndHoldTolerance),n.isConsumed()||!this.ignoreMouseDown&&null==this.first&&this.graph.isMouseDown)this.constraintHandler.reset();else{if(!this.isEnabled()&&null!=this.currentState&&(this.destroyIcons(this.icons),this.currentState=null),(null!=this.first||this.isEnabled()&&this.graph.isEnabled())&&this.updateCurrentState(n),null!=this.first){var t=this.graph.getView().scale,a=null,i=t=new mxPoint(this.graph.snap(n.getGraphX()/t)*t,this.graph.snap(n.getGraphY()/t)*t);null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint&&(a=this.constraintHandler.currentConstraint,i=this.constraintHandler.currentPoint.clone());var s=this.first;if(null!=this.selectedIcon){var o=this.selectedIcon.bounds.width,r=this.selectedIcon.bounds.height;null!=this.currentState&&this.targetConnectImage?(o=this.getIconPosition(this.selectedIcon,this.currentState),this.selectedIcon.bounds.x=o.x,this.selectedIcon.bounds.y=o.y):(o=new mxRectangle(n.getGraphX()+this.connectIconOffset.x,n.getGraphY()+this.connectIconOffset.y,o,r),this.selectedIcon.bounds=o),this.selectedIcon.redraw()}if(null!=this.edgeState){if(this.edgeState.absolutePoints=[null,null!=this.currentState?null:i],this.graph.view.updateFixedTerminalPoint(this.edgeState,this.previous,!0,this.sourceConstraint),null!=this.currentState&&(null==a&&(a=this.graph.getConnectionConstraint(this.edgeState,this.previous,!1)),this.edgeState.setAbsoluteTerminalPoint(null,!1),this.graph.view.updateFixedTerminalPoint(this.edgeState,this.currentState,!1,a)),(s=null)!=this.waypoints)for(s=[],i=0;i<this.waypoints.length;i++)a=this.waypoints[i].clone(),this.convertWaypoint(a),s[i]=a;this.graph.view.updatePoints(this.edgeState,s,this.previous,this.currentState),this.graph.view.updateFloatingTerminalPoints(this.edgeState,this.previous,this.currentState),i=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-1],s=this.edgeState.absolutePoints[0]}else null!=this.currentState&&null==this.constraintHandler.currentConstraint&&(null!=(o=this.getTargetPerimeterPoint(this.currentState,n))&&(i=o)),null==this.sourceConstraint&&null!=this.previous&&(null!=(o=this.getSourcePerimeterPoint(this.previous,null!=this.waypoints&&0<this.waypoints.length?this.waypoints[0]:i,n))&&(s=o));if(null==this.currentState&&this.movePreviewAway){if(o=s,null!=this.edgeState&&2<this.edgeState.absolutePoints.length&&(null!=(a=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-2])&&(o=a)),a=i.x-o.x,o=i.y-o.y,0==(r=Math.sqrt(a*a+o*o)))return;i.x-=4*a/r,i.y-=4*o/r}null==this.shape&&(a=Math.abs(t.x-this.first.x),o=Math.abs(t.y-this.first.y),a>this.graph.tolerance||o>this.graph.tolerance)&&(this.shape=this.createShape(),this.updateCurrentState(n)),null!=this.shape&&(null!=this.edgeState?this.shape.points=this.edgeState.absolutePoints:(t=[s],null!=this.waypoints&&(t=t.concat(this.waypoints)),t.push(i),this.shape.points=t),this.drawPreview()),mxEvent.consume(n.getEvent()),n.consume()}else this.isEnabled()&&this.graph.isEnabled()?this.previous!=this.currentState&&null==this.edgeState?(this.destroyIcons(this.icons),(this.icons=null)!=this.currentState&&null==this.error&&(this.icons=this.createIcons(this.currentState),null==this.icons&&(this.currentState.setCursor(mxConstants.CURSOR_CONNECT),n.consume())),this.previous=this.currentState):this.previous==this.currentState&&null!=this.currentState&&null==this.icons&&!this.graph.isMouseDown&&n.consume():this.constraintHandler.reset();if(null!=this.constraintHandler.currentConstraint&&this.marker.reset(),!this.graph.isMouseDown&&null!=this.currentState&&null!=this.icons){for(t=!1,s=n.getSource(),i=0;i<this.icons.length&&!t;i++)t=s==this.icons[i].node||s.parentNode==this.icons[i].node;t||this.updateIcons(this.currentState,this.icons,n)}}},mxConnectionHandler.prototype.getTargetPerimeterPoint=function(e,n){var t=null,a=(i=e.view).getPerimeterFunction(e);if(null!=a){var i,s=null!=this.waypoints&&0<this.waypoints.length?this.waypoints[this.waypoints.length-1]:new mxPoint(this.previous.getCenterX(),this.previous.getCenterY());null!=(i=a(i.getPerimeterBounds(e),this.edgeState,s,!1))&&(t=i)}else t=new mxPoint(e.getCenterX(),e.getCenterY());return t},mxConnectionHandler.prototype.getSourcePerimeterPoint=function(e,n,t){t=null;var a=e.view,i=a.getPerimeterFunction(e),s=new mxPoint(e.getCenterX(),e.getCenterY());if(null!=i){var o=mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0),r=-o*(Math.PI/180);0!=o&&(n=mxUtils.getRotatedPoint(new mxPoint(n.x,n.y),Math.cos(r),Math.sin(r),s)),null!=(e=i(a.getPerimeterBounds(e),e,n,!1))&&(0!=o&&(e=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),Math.cos(-r),Math.sin(-r),s)),t=e)}else t=s;return t},mxConnectionHandler.prototype.updateIcons=function(e,n,t){},mxConnectionHandler.prototype.isStopEvent=function(e){return null!=e.getState()},mxConnectionHandler.prototype.addWaypointForEvent=function(e){var n=mxUtils.convertPoint(this.graph.container,e.getX(),e.getY()),t=Math.abs(n.x-this.first.x);n=Math.abs(n.y-this.first.y);(null!=this.waypoints||1<this.mouseDownCounter&&(t>this.graph.tolerance||n>this.graph.tolerance))&&(null==this.waypoints&&(this.waypoints=[]),t=this.graph.view.scale,n=new mxPoint(this.graph.snap(e.getGraphX()/t)*t,this.graph.snap(e.getGraphY()/t)*t),this.waypoints.push(n))},mxConnectionHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()&&this.isConnecting()){if(this.waypointsEnabled&&!this.isStopEvent(n))return this.addWaypointForEvent(n),void n.consume();if(null==this.error){var t=null!=this.previous?this.previous.cell:null,a=null;null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(a=this.constraintHandler.currentFocus.cell),null==a&&this.marker.hasValidState()&&(a=this.marker.validState.cell),this.connect(t,a,n.getEvent(),n.getCell())}else null!=this.previous&&null!=this.marker.validState&&this.previous.cell==this.marker.validState.cell&&this.graph.selectCellForEvent(this.marker.source,evt),0<this.error.length&&this.graph.validationAlert(this.error);this.destroyIcons(this.icons),n.consume()}null!=this.first&&this.reset(),this.tapAndHoldValid=this.tapAndHoldInProgress=!1},mxConnectionHandler.prototype.reset=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),this.destroyIcons(this.icons),this.icons=null,this.marker.reset(),this.constraintHandler.reset(),this.sourceConstraint=this.error=this.previous=this.edgeState=this.selectedIcon=null,this.mouseDownCounter=0,this.icon=this.first=null,this.fireEvent(new mxEventObject(mxEvent.RESET))},mxConnectionHandler.prototype.drawPreview=function(){var e=null==this.error;this.shape.strokewidth=this.getEdgeWidth(e),e=this.getEdgeColor(e),this.shape.stroke=e,this.shape.redraw()},mxConnectionHandler.prototype.getEdgeColor=function(e){return e?mxConstants.VALID_COLOR:mxConstants.INVALID_COLOR},mxConnectionHandler.prototype.getEdgeWidth=function(e){return e?3:1},mxConnectionHandler.prototype.connect=function(e,n,t,a){if(null!=n||this.isCreateTarget()||this.graph.allowDanglingEdges){var i=this.graph.getModel(),s=null;i.beginUpdate();try{if(null!=e&&null==n&&this.isCreateTarget()&&null!=(n=this.createTargetVertex(t,e))){if(null!=(a=this.graph.getDropTarget([n],t,a))&&this.graph.getModel().isEdge(a))a=this.graph.getDefaultParent();else{var o=this.graph.getView().getState(a);if(null!=o){var r=i.getGeometry(n);r.x-=o.origin.x,r.y-=o.origin.y}}this.graph.addCell(n,a)}var l=this.graph.getDefaultParent();if(null!=e&&null!=n&&i.getParent(e)==i.getParent(n)&&i.getParent(i.getParent(e))!=i.getRoot()&&(l=i.getParent(e),null!=e.geometry&&e.geometry.relative&&null!=n.geometry&&n.geometry.relative&&(l=i.getParent(l))),r=o=null,null!=this.edgeState&&(o=this.edgeState.cell.value,r=this.edgeState.cell.style),null!=(s=this.insertEdge(l,null,o,e,n,r))){this.graph.setConnectionConstraint(s,e,!0,this.sourceConstraint),this.graph.setConnectionConstraint(s,n,!1,this.constraintHandler.currentConstraint),null!=this.edgeState&&i.setGeometry(s,this.edgeState.cell.geometry);var d=i.getGeometry(s);if(null==d&&((d=new mxGeometry).relative=!0,i.setGeometry(s,d)),null!=this.waypoints&&0<this.waypoints.length){var c=this.graph.view.scale,m=this.graph.view.translate;for(d.points=[],e=0;e<this.waypoints.length;e++){var u=this.waypoints[e];d.points.push(new mxPoint(u.x/c-m.x,u.y/c-m.y))}}null==n&&((u=this.graph.getPointForEvent(t,!1)).x-=this.graph.panDx/this.graph.view.scale,u.y-=this.graph.panDy/this.graph.view.scale,d.setTerminalPoint(u,!1)),this.fireEvent(new mxEventObject(mxEvent.CONNECT,"cell",s,"event",t,"target",a))}}catch(e){mxLog.show(),mxLog.debug(e.message)}finally{i.endUpdate()}this.select&&this.selectCells(s,n)}},mxConnectionHandler.prototype.selectCells=function(e,n){this.graph.setSelectionCell(e)},mxConnectionHandler.prototype.insertEdge=function(e,n,t,a,i,s){return null==this.factoryMethod?this.graph.insertEdge(e,n,t,a,i,s):(n=this.createEdge(t,a,i,s),this.graph.addEdge(n,e,a,i))},mxConnectionHandler.prototype.createTargetVertex=function(e,n){for(var t=this.graph.getCellGeometry(n);null!=t&&t.relative;)n=this.graph.getModel().getParent(n),t=this.graph.getCellGeometry(n);var a=this.graph.cloneCells([n])[0];if(null!=(t=this.graph.getModel().getGeometry(a))){var i=this.graph.getPointForEvent(e);if(t.x=this.graph.snap(i.x-t.width/2)-this.graph.panDx/this.graph.view.scale,t.y=this.graph.snap(i.y-t.height/2)-this.graph.panDy/this.graph.view.scale,null!=this.first){var s=this.graph.view.getState(n);if(null!=s){var o=this.getAlignmentTolerance();Math.abs(this.graph.snap(this.first.x)-this.graph.snap(i.x))<=o?t.x=s.x:Math.abs(this.graph.snap(this.first.y)-this.graph.snap(i.y))<=o&&(t.y=s.y)}}}return a},mxConnectionHandler.prototype.getAlignmentTolerance=function(){return this.graph.isGridEnabled()?this.graph.gridSize:this.graph.tolerance},mxConnectionHandler.prototype.createEdge=function(e,n,t,a){var i=null;return null!=this.factoryMethod&&(i=this.factoryMethod(n,t,a)),null==i&&((i=new mxCell(e||"")).setEdge(!0),i.setStyle(a),(e=new mxGeometry).relative=!0,i.setGeometry(e)),i},mxConnectionHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getView().removeListener(this.changeHandler),this.changeHandler=null),null!=this.drillHandler&&(this.graph.removeListener(this.drillHandler),this.graph.getView().removeListener(this.drillHandler),this.drillHandler=null)},mxConstraintHandler.prototype.pointImage=new mxImage(mxClient.imageBasePath+"/point.gif",5,5),mxConstraintHandler.prototype.graph=null,mxConstraintHandler.prototype.enabled=!0,mxConstraintHandler.prototype.highlightColor=mxConstants.DEFAULT_VALID_COLOR,mxConstraintHandler.prototype.isEnabled=function(){return this.enabled},mxConstraintHandler.prototype.setEnabled=function(e){this.enabled=e},mxConstraintHandler.prototype.reset=function(){if(null!=this.focusIcons){for(var e=0;e<this.focusIcons.length;e++)this.focusIcons[e].destroy();this.focusIcons=null}null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null),this.focusPoints=this.currentFocus=this.currentPoint=this.currentFocusArea=this.currentConstraint=null},mxConstraintHandler.prototype.getTolerance=function(){return this.graph.getTolerance()},mxConstraintHandler.prototype.getImageForConstraint=function(e,n,t){return this.pointImage},mxConstraintHandler.prototype.isEventIgnored=function(e,n){return!1},mxConstraintHandler.prototype.update=function(e,n){if(this.isEnabled()&&!this.isEventIgnored(e)){var t=this.getTolerance(),a=new mxRectangle(e.getGraphX()-t,e.getGraphY()-t,2*t,2*t),i=null!=e.getCell()&&this.graph.isCellConnectable(e.getCell());if((null==this.currentFocusArea||!mxUtils.intersects(this.currentFocusArea,a)||null!=e.getState()&&null!=this.currentFocus&&i)&&(this.currentFocusArea=null,e.getState()!=this.currentFocus))if(this.currentFocus=null,this.constraints=null!=e.getState()&&i?this.graph.getAllConnectionConstraints(e.getState(),n):null,null!=this.constraints){if(this.currentFocus=e.getState(),this.currentFocusArea=new mxRectangle(e.getState().x,e.getState().y,e.getState().width,e.getState().height),null!=this.focusIcons){for(i=0;i<this.focusIcons.length;i++)this.focusIcons[i].destroy();this.focusPoints=this.focusIcons=null}for(this.focusIcons=[],this.focusPoints=[],i=0;i<this.constraints.length;i++){var s,o=this.graph.getConnectionPoint(e.getState(),this.constraints[i]),r=(s=this.getImageForConstraint(e.getState(),this.constraints[i],o)).src;(s=new mxImageShape(s=new mxRectangle(o.x-s.width/2,o.y-s.height/2,s.width,s.height),r)).dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,s.preserveImageAspect=!1,s.init(this.graph.getView().getOverlayPane()),null!=s.node.previousSibling&&s.node.parentNode.insertBefore(s.node,s.node.parentNode.firstChild),r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),s.redraw(),mxEvent.redirectMouseEvents(s.node,this.graph,r),this.currentFocusArea.add(s.bounds),this.focusIcons.push(s),this.focusPoints.push(o)}this.currentFocusArea.grow(t)}else if(null!=this.focusIcons){for(null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null),i=0;i<this.focusIcons.length;i++)this.focusIcons[i].destroy();this.focusPoints=this.focusIcons=null}if(this.currentPoint=this.currentConstraint=null,null!=this.focusIcons&&null!=this.constraints&&(null==e.getState()||this.currentFocus==e.getState()))for(i=0;i<this.focusIcons.length;i++)if(mxUtils.intersects(this.focusIcons[i].bounds,a)){this.currentConstraint=this.constraints[i],this.currentPoint=this.focusPoints[i],(t=this.focusIcons[i].bounds.clone()).grow(mxClient.IS_IE?3:2),mxClient.IS_IE&&(t.width-=1,t.height-=1),null==this.focusHighlight?((t=new mxRectangleShape(t,null,this.highlightColor,3)).dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,t.init(this.graph.getView().getOverlayPane()),this.focusHighlight=t,r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),mxEvent.redirectMouseEvents(t.node,this.graph,r)):(this.focusHighlight.bounds=t,this.focusHighlight.redraw());break}null==this.currentConstraint&&null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null)}},mxConstraintHandler.prototype.destroy=function(){this.reset()},mxRubberband.prototype.defaultOpacity=20,mxRubberband.prototype.enabled=!0,mxRubberband.prototype.div=null,mxRubberband.prototype.sharedDiv=null,mxRubberband.prototype.currentX=0,mxRubberband.prototype.currentY=0,mxRubberband.prototype.isEnabled=function(){return this.enabled},mxRubberband.prototype.setEnabled=function(e){this.enabled=e},mxRubberband.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&(this.graph.isForceMarqueeEvent(n.getEvent())||null==n.getState())){var t=mxUtils.getOffset(this.graph.container),a=mxUtils.getScrollOrigin(this.graph.container);if(a.x-=t.x,a.y-=t.y,this.start(n.getX()+a.x,n.getY()+a.y),mxClient.IS_NS&&!mxClient.IS_SF&&!mxClient.IS_GC){var i=this.graph.container,s=function(e){e=new mxMouseEvent(e);var n=mxUtils.convertPoint(i,e.getX(),e.getY());return e.graphX=n.x,e.graphY=n.y,e};this.dragHandler=mxUtils.bind(this,function(e){this.mouseMove(this.graph,s(e))}),this.dropHandler=mxUtils.bind(this,function(e){this.mouseUp(this.graph,s(e))}),mxEvent.addListener(document,"mousemove",this.dragHandler),mxEvent.addListener(document,"mouseup",this.dropHandler)}n.consume(!1)}},mxRubberband.prototype.start=function(e,n){this.first=new mxPoint(e,n)},mxRubberband.prototype.mouseMove=function(e,n){if(!n.isConsumed()&&null!=this.first){var t=mxUtils.getScrollOrigin(this.graph.container),a=mxUtils.getOffset(this.graph.container);t.x-=a.x,t.y-=a.y;a=n.getX()+t.x,t=n.getY()+t.y;var i=this.first.x-a,s=this.first.y-t,o=this.graph.tolerance;(null!=this.div||Math.abs(i)>o||Math.abs(s)>o)&&(null==this.div&&(this.div=this.createShape()),mxUtils.clearSelection(),this.update(a,t),n.consume())}},mxRubberband.prototype.createShape=function(){return null==this.sharedDiv&&(this.sharedDiv=document.createElement("div"),this.sharedDiv.className="mxRubberband",mxUtils.setOpacity(this.sharedDiv,this.defaultOpacity)),this.graph.container.appendChild(this.sharedDiv),this.sharedDiv},mxRubberband.prototype.mouseUp=function(e,n){var t=null!=this.div;this.reset(),t&&(t=new mxRectangle(this.x,this.y,this.width,this.height),this.graph.selectRegion(t,n.getEvent()),n.consume())},mxRubberband.prototype.reset=function(){null!=this.div&&this.div.parentNode.removeChild(this.div),null!=this.dragHandler&&(mxEvent.removeListener(document,"mousemove",this.dragHandler),this.dragHandler=null),null!=this.dropHandler&&(mxEvent.removeListener(document,"mouseup",this.dropHandler),this.dropHandler=null),this.currentY=this.currentX=0,this.div=this.first=null},mxRubberband.prototype.update=function(e,n){this.currentX=e,this.currentY=n,this.repaint()},mxRubberband.prototype.repaint=function(){if(null!=this.div){var e=this.currentX-this.graph.panDx,n=this.currentY-this.graph.panDy;this.x=Math.min(this.first.x,e),this.y=Math.min(this.first.y,n),this.width=Math.max(this.first.x,e)-this.x,this.height=Math.max(this.first.y,n)-this.y,e=mxClient.IS_VML?this.graph.panDy:0,this.div.style.left=this.x+(mxClient.IS_VML?this.graph.panDx:0)+"px",this.div.style.top=this.y+e+"px",this.div.style.width=Math.max(1,this.width)+"px",this.div.style.height=Math.max(1,this.height)+"px"}},mxRubberband.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),this.graph.removeListener(this.panHandler),this.reset(),null!=this.sharedDiv&&(this.sharedDiv=null))},mxVertexHandler.prototype.graph=null,mxVertexHandler.prototype.state=null,mxVertexHandler.prototype.singleSizer=!1,mxVertexHandler.prototype.index=null,mxVertexHandler.prototype.allowHandleBoundsCheck=!0,mxVertexHandler.prototype.handleImage=null,mxVertexHandler.prototype.tolerance=0,mxVertexHandler.prototype.rotationEnabled=!1,mxVertexHandler.prototype.rotationRaster=!0,mxVertexHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.selectionBorder=this.createSelectionShape(this.bounds),this.selectionBorder.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.pointerEvents=!1,this.selectionBorder.init(this.graph.getView().getOverlayPane()),this.graph.isCellMovable(this.state.cell)&&(this.selectionBorder.node.style.cursor=mxConstants.CURSOR_MOVABLE_VERTEX),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.graph,this.state),mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells){var e=this.graph.isCellResizable(this.state.cell);if(this.sizers=[],e||this.graph.isLabelMovable(this.state.cell)&&2<=this.state.width&&2<=this.state.height){var n=0;e&&(this.singleSizer||(this.sizers.push(this.createSizer("nw-resize",n++)),this.sizers.push(this.createSizer("n-resize",n++)),this.sizers.push(this.createSizer("ne-resize",n++)),this.sizers.push(this.createSizer("w-resize",n++)),this.sizers.push(this.createSizer("e-resize",n++)),this.sizers.push(this.createSizer("sw-resize",n++)),this.sizers.push(this.createSizer("s-resize",n++))),this.sizers.push(this.createSizer("se-resize",n++))),null!=(e=this.graph.model.getGeometry(this.state.cell))&&!e.relative&&!this.graph.isSwimlane(this.state.cell)&&this.graph.isLabelMovable(this.state.cell)&&(this.labelShape=this.createSizer(mxConstants.CURSOR_LABEL_HANDLE,mxEvent.LABEL_HANDLE,mxConstants.LABEL_HANDLE_SIZE,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}else this.graph.isCellMovable(this.state.cell)&&!this.graph.isCellResizable(this.state.cell)&&this.state.width<2&&this.state.height<2&&(this.labelShape=this.createSizer(mxConstants.CURSOR_MOVABLE_VERTEX,null,null,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}this.rotationEnabled&&(mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells)&&(this.rotationShape=this.createSizer("pointer",mxEvent.ROTATION_HANDLE,mxConstants.HANDLE_SIZE+3,mxConstants.HANDLE_FILLCOLOR),this.sizers.push(this.rotationShape)),this.redraw()},mxVertexHandler.prototype.getSelectionBounds=function(e){return new mxRectangle(Math.round(e.x),Math.round(e.y),Math.round(e.width),Math.round(e.height))},mxVertexHandler.prototype.createSelectionShape=function(e){return(e=new mxRectangleShape(e,null,this.getSelectionColor())).strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxVertexHandler.prototype.getSelectionColor=function(){return mxConstants.VERTEX_SELECTION_COLOR},mxVertexHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.VERTEX_SELECTION_STROKEWIDTH},mxVertexHandler.prototype.isSelectionDashed=function(){return mxConstants.VERTEX_SELECTION_DASHED},mxVertexHandler.prototype.createSizer=function(e,n,t,a){return t=new mxRectangle(0,0,t=t||mxConstants.HANDLE_SIZE,t),(a=this.createSizerShape(t,n,a)).isHtmlAllowed()&&null!=this.state.text&&this.state.text.node.parentNode==this.graph.container?(a.bounds.height-=1,a.bounds.width-=1,a.dialect=mxConstants.DIALECT_STRICTHTML,a.init(this.graph.container)):(a.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,a.init(this.graph.getView().getOverlayPane())),mxEvent.redirectMouseEvents(a.node,this.graph,this.state),this.graph.isEnabled()&&(a.node.style.cursor=e),this.isSizerVisible(n)||(a.node.style.visibility="hidden"),a},mxVertexHandler.prototype.isSizerVisible=function(e){return!0},mxVertexHandler.prototype.createSizerShape=function(e,n,t){return null!=this.handleImage?(e.width=this.handleImage.width,e.height=this.handleImage.height,new mxImageShape(e,this.handleImage.src)):n==mxEvent.ROTATION_HANDLE?new mxEllipse(e,t||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR):new mxRectangleShape(e,t||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)},mxVertexHandler.prototype.moveSizerTo=function(e,n,t){null!=e&&(e.bounds.x=Math.round(n-e.bounds.width/2),e.bounds.y=Math.round(t-e.bounds.height/2),e.redraw())},mxVertexHandler.prototype.getHandleForEvent=function(e){if(e.isSource(this.rotationShape))return mxEvent.ROTATION_HANDLE;if(e.isSource(this.labelShape))return mxEvent.LABEL_HANDLE;if(null!=this.sizers)for(var n=this.tolerance,t=(n=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<n)?new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n):null,0);t<this.sizers.length;t++)if(e.isSource(this.sizers[t])||null!=n&&mxUtils.intersects(this.sizers[t].bounds,n))return t;return null},mxVertexHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&(0<this.tolerance||n.getState()==this.state)){var t=this.getHandleForEvent(n);null!=t&&(this.start(n.getX(),n.getY(),t),n.consume())}},mxVertexHandler.prototype.start=function(e,n,t){e=mxUtils.convertPoint(this.graph.container,e,n),this.startX=e.x,this.startY=e.y,this.index=t,this.selectionBorder.node.style.display=t==mxEvent.ROTATION_HANDLE?"inline":"none",this.preview=this.createSelectionShape(this.bounds),mxClient.IS_SVG&&0!=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")||null==this.state.text||this.state.text.node.parentNode!=this.graph.container?(this.preview.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.preview.init(this.graph.view.getOverlayPane())):(this.preview.dialect=mxConstants.DIALECT_STRICTHTML,this.preview.init(this.graph.container))},mxVertexHandler.prototype.mouseMove=function(e,n){if(n.isConsumed()||null==this.index)null!=this.getHandleForEvent(n)&&n.consume(!1);else{var t=new mxPoint(n.getGraphX(),n.getGraphY()),a=this.graph.isGridEnabledEvent(n.getEvent()),i=this.graph.getView().scale;if(this.index==mxEvent.LABEL_HANDLE)a&&(t.x=this.graph.snap(t.x/i)*i,t.y=this.graph.snap(t.y/i)*i),this.moveSizerTo(this.sizers[this.sizers.length-1],t.x,t.y);else if(this.index==mxEvent.ROTATION_HANDLE){var s=this.state.x+this.state.width/2-t.x,o=this.state.y+this.state.height/2-t.y;this.currentAlpha=0!=s?180*Math.atan(o/s)/Math.PI+90:o<0?180:0,0<s&&(this.currentAlpha-=180),this.rotationRaster&&(s=t.x-this.state.getCenterX(),o=t.y-this.state.getCenterY(),s=Math.abs(Math.sqrt(s*s+o*o)-this.state.height/2-20),s=Math.max(1,5*Math.min(3,Math.max(0,Math.round(80/Math.abs(s))))),this.currentAlpha=Math.round(this.currentAlpha/s)*s),this.selectionBorder.rotation=this.currentAlpha,this.selectionBorder.redraw()}else{var r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),l=Math.cos(-r),d=Math.sin(-r),c=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),m=(s=t.x-this.startX,o=t.y-this.startY,t=this.graph.view.translate,d*s+l*o);s=l*s-d*o;this.bounds=this.union(this.selectionBounds,s,m,this.index,a,i,t),l=Math.cos(r),c=(d=Math.sin(r))*(s=(o=new mxPoint(this.bounds.getCenterX(),this.bounds.getCenterY())).x-c.x)+l*(o=o.y-c.y)-o,this.bounds.x+=l*s-d*o-s,this.bounds.y+=c,this.drawPreview()}n.consume()}},mxVertexHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()&&null!=this.index&&null!=this.state){var t=new mxPoint(n.getGraphX(),n.getGraphY());this.graph.getModel().beginUpdate();try{if(this.index==mxEvent.ROTATION_HANDLE)null!=this.currentAlpha&&this.rotateCell(this.state.cell,this.currentAlpha-(this.state.style[mxConstants.STYLE_ROTATION]||0));else{var a=this.graph.isGridEnabledEvent(n.getEvent()),i=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),s=Math.cos(-i),o=Math.sin(-i),r=(t=o*(r=t.x-this.startX)+s*(l=t.y-this.startY),s*r-o*l),l=t,d=this.graph.view.scale;this.resizeCell(this.state.cell,r/d,l/d,this.index,a)}}finally{this.graph.getModel().endUpdate()}this.reset(),n.consume()}},mxVertexHandler.prototype.rotateCell=function(e,n){var t=this.graph.getModel();if(t.isVertex(e)){if(null!=(s=e==this.state?this.state:this.graph.view.getState(e))&&this.graph.setCellStyles(mxConstants.STYLE_ROTATION,(s.style[mxConstants.STYLE_ROTATION]||0)+n,[e]),this.state.cell!=e&&(null!=(s=this.graph.getCellGeometry(e))&&!s.relative))if(0!=n){var a=this.graph.getModel().getParent(e),i=this.graph.getCellGeometry(a);if(!s.relative&&null!=i){var s,o=mxUtils.toRadians(n),r=(a=Math.cos(o),o=Math.sin(o),new mxPoint(s.getCenterX(),s.getCenterY()));i=new mxPoint(i.width/2,i.height/2),a=mxUtils.getRotatedPoint(r,a,o,i);(s=s.clone()).x=a.x-s.width/2,s.y=a.y-s.height/2,t.setGeometry(e,s)}}else(s=s.clone()).x+=dx,s.y+=dy,t.setGeometry(e,s);for(s=t.getChildCount(e),a=0;a<s;a++)this.rotateCell(t.getChildAt(e,a),n)}},mxVertexHandler.prototype.reset=function(){this.index=this.currentAlpha=null,null!=this.preview&&(this.preview.destroy(),this.preview=null),null!=this.selectionBorder&&(this.selectionBorder.node.style.display="inline",this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.drawPreview())},mxVertexHandler.prototype.resizeCell=function(e,n,t,a,i){var s=this.graph.model.getGeometry(e);if(null!=s)if(a==mxEvent.LABEL_HANDLE)a=this.graph.view.scale,n=(this.labelShape.bounds.getCenterX()-this.startX)/a,t=(this.labelShape.bounds.getCenterY()-this.startY)/a,null==(s=s.clone()).offset?s.offset=new mxPoint(n,t):(s.offset.x+=n,s.offset.y+=t),this.graph.model.setGeometry(e,s);else{if(a=this.union(s,n,t,a,i,1,new mxPoint(0,0)),0!=(r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"))){n=a.getCenterX()-s.getCenterX(),t=a.getCenterY()-s.getCenterY(),i=Math.cos(r);var o=Math.sin(r),r=i*n-o*t-n;n=o*n+i*t-t,t=a.x-s.x;var l=a.y-s.y,d=i*t-o*l;i=o*t+i*l,a.x+=r,a.y+=n,this.graph.isCellCollapsed(e)||0==r&&0==n||(t=s.x-a.x+d,l=s.y-a.y+i,this.moveChildren(e,t,l))}this.graph.resizeCell(e,a)}},mxVertexHandler.prototype.moveChildren=function(e,n,t){for(var a=this.graph.getModel(),i=a.getChildCount(e),s=0;s<i;s++){var o=a.getChildAt(e,s);if(a.isVertex(o)){var r=this.graph.getCellGeometry(o);null!=r&&!r.relative&&((r=r.clone()).x+=n,r.y+=t,a.setGeometry(o,r))}}},mxVertexHandler.prototype.union=function(e,n,t,a,i,s,o){if(this.singleSizer){o=e.x+e.width+n;var r=e.y+e.height+t;return i&&(o=this.graph.snap(o/s)*s,r=this.graph.snap(r/s)*s),(s=new mxRectangle(e.x,e.y,0,0)).add(new mxRectangle(o,r,0,0)),s}var l=(r=e.x-o.x*s)+e.width,d=e.y-o.y*s;return e=d+e.height,4<a?(e+=t,i&&(e=this.graph.snap(e/s)*s)):a<3&&(d+=t,i&&(d=this.graph.snap(d/s)*s)),0==a||3==a||5==a?(r+=n,i&&(r=this.graph.snap(r/s)*s)):2!=a&&4!=a&&7!=a||(l+=n,i&&(l=this.graph.snap(l/s)*s)),e-=d,(i=l-r)<0&&(r+=i,i=Math.abs(i)),e<0&&(d+=e,e=Math.abs(e)),new mxRectangle(r+o.x*s,d+o.y*s,i,e)},mxVertexHandler.prototype.redraw=function(){this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.state.x,this.state.y,this.state.width,this.state.height);var e=this.state;if(null!=this.sizers){var n=e.x+e.width,t=e.y+e.height;if(this.singleSizer)this.moveSizerTo(this.sizers[0],n,t);else{var a=e.x+e.width/2,i=e.y+e.height/2;if(1<this.sizers.length){var s=mxUtils.toRadians(e.style[mxConstants.STYLE_ROTATION]||"0"),o=Math.cos(s),r=(s=Math.sin(s),new mxPoint(e.getCenterX(),e.getCenterY())),l=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),o,s,r);this.moveSizerTo(this.sizers[0],l.x,l.y),l.x=a,l.y=e.y,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[1],l.x,l.y),l.x=n,l.y=e.y,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[2],l.x,l.y),l.x=e.x,l.y=i,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[3],l.x,l.y),l.x=n,l.y=i,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[4],l.x,l.y),l.x=e.x,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[5],l.x,l.y),l.x=a,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[6],l.x,l.y),l.x=n,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[7],l.x,l.y),this.moveSizerTo(this.sizers[8],a+e.absoluteOffset.x,i+e.absoluteOffset.y)}else 2<=this.state.width&&2<=this.state.height?this.moveSizerTo(this.sizers[0],a+e.absoluteOffset.x,i+e.absoluteOffset.y):this.moveSizerTo(this.sizers[0],e.x,e.y)}}null!=this.rotationShape&&(s=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),o=Math.cos(s),s=Math.sin(s),r=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),l=mxUtils.getRotatedPoint(new mxPoint(e.x+e.width/2,e.y-16),o,s,r),this.moveSizerTo(this.rotationShape,l.x,l.y)),this.selectionBorder.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.drawPreview()},mxVertexHandler.prototype.drawPreview=function(){null!=this.preview&&(this.preview.bounds=this.bounds,this.preview.node.parentNode==this.graph.container&&(this.preview.bounds.width=Math.max(0,this.preview.bounds.width-1),this.preview.bounds.height=Math.max(0,this.preview.bounds.height-1)),this.preview.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.preview.redraw()),this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()},mxVertexHandler.prototype.destroy=function(){if(null!=this.preview&&(this.preview.destroy(),this.preview=null),this.selectionBorder.destroy(),this.labelShape=this.selectionBorder=null,null!=this.sizers)for(var e=0;e<this.sizers.length;e++)this.sizers[e].destroy(),this.sizers[e]=null},mxEdgeHandler.prototype.graph=null,mxEdgeHandler.prototype.state=null,mxEdgeHandler.prototype.marker=null,mxEdgeHandler.prototype.constraintHandler=null,mxEdgeHandler.prototype.error=null,mxEdgeHandler.prototype.shape=null,mxEdgeHandler.prototype.bends=null,mxEdgeHandler.prototype.labelShape=null,mxEdgeHandler.prototype.cloneEnabled=!0,mxEdgeHandler.prototype.addEnabled=!1,mxEdgeHandler.prototype.removeEnabled=!1,mxEdgeHandler.prototype.preferHtml=!1,mxEdgeHandler.prototype.allowHandleBoundsCheck=!0,mxEdgeHandler.prototype.snapToTerminals=!1,mxEdgeHandler.prototype.handleImage=null,mxEdgeHandler.prototype.tolerance=0,mxEdgeHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.marker=this.createMarker(),this.constraintHandler=new mxConstraintHandler(this.graph),this.points=[],this.abspoints=this.getSelectionPoints(this.state),this.shape=this.createSelectionShape(this.abspoints),this.shape.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,this.shape.init(this.graph.getView().getOverlayPane()),this.shape.svgStrokeTolerance=0,this.shape.node.style.cursor=mxConstants.CURSOR_MOVABLE_EDGE,mxEvent.addListener(this.shape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e,this.state.cell)})),mxEvent.addGestureListeners(this.shape.node,mxUtils.bind(this,function(e){this.addEnabled&&this.isAddPointEvent(e)?this.addPoint(this.state,e):this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,this.state))}),mxUtils.bind(this,function(e){var n=this.state.cell;if(null!=this.index){var t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));n=this.graph.getCellAt(t.x,t.y);this.graph.isSwimlane(n)&&this.graph.hitsSwimlaneContent(n,t.x,t.y)&&(n=null)}this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,this.graph.getView().getState(n)))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,this.state))})),this.preferHtml=null!=this.state.text&&this.state.text.node.parentNode==this.graph.container,!this.preferHtml){var e=this.state.getVisibleTerminalState(!0);null!=e&&(this.preferHtml=null!=e.text&&e.text.node.parentNode==this.graph.container),this.preferHtml||null!=(e=this.state.getVisibleTerminalState(!1))&&(this.preferHtml=null!=e.text&&e.text.node.parentNode==this.graph.container)}(this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells||mxGraphHandler.prototype.maxCells<=0)&&(this.bends=this.createBends()),this.label=new mxPoint(this.state.absoluteOffset.x,this.state.absoluteOffset.y),this.labelShape=new mxRectangleShape(new mxRectangle,mxConstants.LABEL_HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR),this.labelShape.pointerEvents=!1,this.initBend(this.labelShape),this.labelShape.node.style.cursor=mxConstants.CURSOR_LABEL_HANDLE,mxEvent.redirectMouseEvents(this.labelShape.node,this.graph,this.state),this.redraw()},mxEdgeHandler.prototype.isAddPointEvent=function(e){return mxEvent.isShiftDown(e)},mxEdgeHandler.prototype.isRemovePointEvent=function(e){return mxEvent.isShiftDown(e)},mxEdgeHandler.prototype.getSelectionPoints=function(e){return e.absolutePoints},mxEdgeHandler.prototype.createSelectionShape=function(e){return(e=new mxPolyline(e,this.getSelectionColor())).strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxEdgeHandler.prototype.getSelectionColor=function(){return mxConstants.EDGE_SELECTION_COLOR},mxEdgeHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.EDGE_SELECTION_STROKEWIDTH},mxEdgeHandler.prototype.isSelectionDashed=function(){return mxConstants.EDGE_SELECTION_DASHED},mxEdgeHandler.prototype.isConnectableCell=function(e){return!0},mxEdgeHandler.prototype.createMarker=function(){var e=new mxCellMarker(this.graph),a=this;return e.getCell=function(e){var n=mxCellMarker.prototype.getCell.apply(this,arguments);if(!a.isConnectableCell(n))return null;var t=a.graph.getModel();return(n==a.state.cell||null!=n&&!a.graph.connectableEdges&&t.isEdge(n))&&(n=null),n},e.isValidState=function(e){var n=a.graph.getModel();n=null!=(n=a.graph.view.getTerminalPort(e,a.graph.view.getState(n.getTerminal(a.state.cell,!a.isSource)),!a.isSource))?n.cell:null;return a.error=a.validateConnection(a.isSource?e.cell:n,a.isSource?n:e.cell),null==a.error},e},mxEdgeHandler.prototype.validateConnection=function(e,n){return this.graph.getEdgeValidationError(this.state.cell,e,n)},mxEdgeHandler.prototype.createBends=function(){for(var e=this.state.cell,n=[],t=0;t<this.abspoints.length;t++)if(this.isHandleVisible(t)){var a=t==this.abspoints.length-1;if((a=0==t||a)||this.graph.isCellBendable(e)){var i=this.createHandleShape(t);if(this.initBend(i),mxClient.IS_TOUCH&&i.node.setAttribute("pointer-events","none"),this.isHandleEnabled(t))if(mxClient.IS_TOUCH){var s=mxUtils.bind(this,function(e){return e=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),this.graph.view.getState(this.graph.getCellAt(e.x,e.y))});mxEvent.redirectMouseEvents(i.node,this.graph,s)}else i.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(i.node,this.graph,this.state);n.push(i),a||(this.points.push(new mxPoint(0,0)),i.node.style.visibility="hidden")}}return n},mxEdgeHandler.prototype.isHandleEnabled=function(e){return!0},mxEdgeHandler.prototype.isHandleVisible=function(e){return!0},mxEdgeHandler.prototype.createHandleShape=function(e){return null!=this.handleImage?new mxImageShape(new mxRectangle(0,0,this.handleImage.width,this.handleImage.height),this.handleImage.src):(e=mxConstants.HANDLE_SIZE,this.preferHtml&&(e-=1),new mxRectangleShape(new mxRectangle(0,0,e,e),mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR))},mxEdgeHandler.prototype.initBend=function(e){this.preferHtml?(e.dialect=mxConstants.DIALECT_STRICTHTML,e.init(this.graph.container)):(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()))},mxEdgeHandler.prototype.getHandleForEvent=function(e){if(null!=this.bends)for(var n=this.tolerance,t=(n=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<n)?new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n):null,0);t<this.bends.length;t++)if((e.isSource(this.bends[t])||null!=n&&mxUtils.intersects(this.bends[t].bounds,n))&&"hidden"!=this.bends[t].node.style.visibility)return t;return!(e.isSource(this.labelShape)&&"hidden"!=this.labelShape.node.style.visibility||e.isSource(this.state.text))||(mxClient.IS_SF||mxClient.IS_GC)&&"SELECT"==e.getSource().nodeName?null:mxEvent.LABEL_HANDLE},mxEdgeHandler.prototype.mouseDown=function(e,n){var t=null;null!=(t=this.getHandleForEvent(n))&&!n.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&(this.removeEnabled&&this.isRemovePointEvent(n.getEvent())?this.removePoint(this.state,t):(t!=mxEvent.LABEL_HANDLE||this.graph.isLabelMovable(n.getCell()))&&this.start(n.getX(),n.getY(),t),n.consume())},mxEdgeHandler.prototype.start=function(e,n,t){this.startX=e,this.startY=n,this.isSource=null!=this.bends&&0==t,this.isTarget=null!=this.bends&&t==this.bends.length-1,this.isLabel=t==mxEvent.LABEL_HANDLE,this.isSource||this.isTarget?(e=this.state.cell,(null==(n=this.graph.model.getTerminal(e,this.isSource))&&this.graph.isTerminalPointMovable(e,this.isSource)||null!=n&&this.graph.isCellDisconnectable(e,n,this.isSource))&&(this.index=t)):this.index=t},mxEdgeHandler.prototype.clonePreviewState=function(e,n){return this.state.clone()},mxEdgeHandler.prototype.getSnapToTerminalTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxEdgeHandler.prototype.getPointForEvent=function(e){var t=new mxPoint(e.getGraphX(),e.getGraphY()),a=this.getSnapToTerminalTolerance(),n=this.graph.getView(),i=!1,s=!1;if(this.snapToTerminals&&0<a){var o=function(e){if(null!=e){var n=e.x;Math.abs(t.x-n)<a&&(t.x=n,i=!0),e=e.y,Math.abs(t.y-e)<a&&(t.y=e,s=!0)}},r=function(e){null!=e&&o.call(this,new mxPoint(n.getRoutingCenterX(e),n.getRoutingCenterY(e)))};if(r.call(this,this.state.getVisibleTerminalState(!0)),r.call(this,this.state.getVisibleTerminalState(!1)),null!=this.abspoints)for(r=0;r<this.abspoints;r++)r!=this.index&&o.call(this,this.abspoints[r])}return this.graph.isGridEnabledEvent(e.getEvent())&&(e=n.scale,r=n.translate,i||(t.x=(this.graph.snap(t.x/e-r.x)+r.x)*e),s||(t.y=(this.graph.snap(t.y/e-r.y)+r.y)*e)),t},mxEdgeHandler.prototype.getPreviewTerminalState=function(e){this.constraintHandler.update(e,this.isSource),this.marker.process(e),e=this.marker.getValidState();var n=null;return null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint&&this.marker.reset(),null!=e?n=e:null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(n=this.constraintHandler.currentFocus),n},mxEdgeHandler.prototype.getPreviewPoints=function(e){var n=null!=(n=this.graph.getCellGeometry(this.state.cell)).points?n.points.slice():null;return this.isSource||this.isTarget?this.graph.resetEdgesOnConnect&&(n=null):(this.convertPoint(e,!1),null==n?n=[e]:n[this.index-1]=e),n},mxEdgeHandler.prototype.updatePreviewState=function(e,n,t){var a=this.isSource?t:this.state.getVisibleTerminalState(!0),i=this.isTarget?t:this.state.getVisibleTerminalState(!1),s=this.graph.getConnectionConstraint(e,a,!0),o=this.graph.getConnectionConstraint(e,i,!1),r=this.constraintHandler.currentConstraint;null==r&&(r=new mxConnectionConstraint),this.isSource?s=r:this.isTarget&&(o=r),(!this.isSource||null!=a)&&e.view.updateFixedTerminalPoint(e,a,!0,s),(!this.isTarget||null!=i)&&e.view.updateFixedTerminalPoint(e,i,!1,o),(this.isSource||this.isTarget)&&null==t&&(e.setAbsoluteTerminalPoint(n,this.isSource),null==this.marker.getMarkedState()&&(this.error=this.graph.allowDanglingEdges?null:"")),e.view.updatePoints(e,this.points,a,i),e.view.updateFloatingTerminalPoints(e,a,i)},mxEdgeHandler.prototype.mouseMove=function(e,n){if(null!=this.index&&null!=this.marker){var t=this.getPointForEvent(n);if(this.isLabel)this.label.x=t.x,this.label.y=t.y;else{this.points=this.getPreviewPoints(t);var a=this.isSource||this.isTarget?this.getPreviewTerminalState(n):null,i=this.clonePreviewState(t,null!=a?a.cell:null);this.updatePreviewState(i,t,a),this.setPreviewColor(null==this.error?this.marker.validColor:this.marker.invalidColor),this.abspoints=i.absolutePoints,this.active=!0}this.drawPreview(),mxEvent.consume(n.getEvent()),n.consume()}else mxClient.IS_IE&&null!=this.getHandleForEvent(n)&&n.consume(!1)},mxEdgeHandler.prototype.mouseUp=function(e,n){if(null!=this.index&&null!=this.marker){var t=this.state.cell;if(n.getX()!=this.startX||n.getY()!=this.startY)if(null!=this.error)0<this.error.length&&this.graph.validationAlert(this.error);else if(this.isLabel)this.moveLabel(this.state,this.label.x,this.label.y);else if(this.isSource||this.isTarget){var a=null;if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(a=this.constraintHandler.currentFocus.cell),null==a&&this.marker.hasValidState()&&(a=this.marker.validState.cell),null!=a)t=this.connect(t,a,this.isSource,this.graph.isCloneEvent(n.getEvent())&&this.cloneEnabled&&this.graph.isCellsCloneable(),n);else if(this.graph.isAllowDanglingEdges()){(a=this.abspoints[this.isSource?0:this.abspoints.length-1]).x=a.x/this.graph.view.scale-this.graph.view.translate.x,a.y=a.y/this.graph.view.scale-this.graph.view.translate.y;var i=this.graph.getView().getState(this.graph.getModel().getParent(t));null!=i&&(a.x-=i.origin.x,a.y-=i.origin.y),a.x-=this.graph.panDx/this.graph.view.scale,a.y-=this.graph.panDy/this.graph.view.scale,this.changeTerminalPoint(t,a,this.isSource)}}else this.active?this.changePoints(t,this.points):(this.graph.getView().invalidate(this.state.cell),this.graph.getView().revalidate(this.state.cell));null!=this.marker&&(this.reset(),t!=this.state.cell&&this.graph.setSelectionCell(t)),n.consume()}},mxEdgeHandler.prototype.reset=function(){this.points=this.label=this.index=this.error=null,this.isTarget=this.isSource=this.isLabel=this.active=!1,this.marker.reset(),this.constraintHandler.reset(),this.setPreviewColor(mxConstants.EDGE_SELECTION_COLOR),this.redraw()},mxEdgeHandler.prototype.setPreviewColor=function(e){null!=this.shape&&(this.shape.stroke=e)},mxEdgeHandler.prototype.convertPoint=function(e,n){var t=this.graph.getView().getScale(),a=this.graph.getView().getTranslate();return n&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/t-a.x),e.y=Math.round(e.y/t-a.y),null!=(t=this.graph.getView().getState(this.graph.getModel().getParent(this.state.cell)))&&(e.x-=t.origin.x,e.y-=t.origin.y),e},mxEdgeHandler.prototype.moveLabel=function(e,n,t){var a=this.graph.getModel();if(null!=(i=a.getGeometry(e.cell))){var i=i.clone(),s=this.graph.getView().getRelativePoint(e,n,t);i.x=s.x,i.y=s.y;var o=this.graph.getView().scale;i.offset=new mxPoint(0,0),s=this.graph.view.getPoint(e,i),i.offset=new mxPoint((n-s.x)/o,(t-s.y)/o),a.setGeometry(e.cell,i)}},mxEdgeHandler.prototype.connect=function(e,n,t,a,i){var s=(i=this.graph.getModel()).getParent(e);i.beginUpdate();try{if(a){var o=e.clone();i.add(s,o,i.getChildCount(s));var r=i.getTerminal(e,!t);this.graph.connectCell(o,r,!t),e=o}var l=this.constraintHandler.currentConstraint;null==l&&(l=new mxConnectionConstraint),this.graph.connectCell(e,n,t,l)}finally{i.endUpdate()}return e},mxEdgeHandler.prototype.changeTerminalPoint=function(e,n,t){var a=this.graph.getModel(),i=a.getGeometry(e);if(null!=i){a.beginUpdate();try{(i=i.clone()).setTerminalPoint(n,t),a.setGeometry(e,i),this.graph.connectCell(e,null,t,new mxConnectionConstraint)}finally{a.endUpdate()}}},mxEdgeHandler.prototype.changePoints=function(e,n){var t=this.graph.getModel(),a=t.getGeometry(e);null!=a&&((a=a.clone()).points=n,t.setGeometry(e,a))},mxEdgeHandler.prototype.addPoint=function(e,n){var t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(n),mxEvent.getClientY(n)),a=this.graph.isGridEnabledEvent(n);this.convertPoint(t,a),this.addPointAt(e,t.x,t.y),mxEvent.consume(n)},mxEdgeHandler.prototype.addPointAt=function(e,n,t){var a=this.graph.getCellGeometry(e.cell);if(n=new mxPoint(n,t),null!=a){a=a.clone(),t=this.graph.view.translate;var i=this.graph.view.scale;t=mxUtils.findNearestSegment(e,(n.x+t.x)*i,(n.y+t.y)*i),null==a.points?a.points=[n]:a.points.splice(t,0,n),this.graph.getModel().setGeometry(e.cell,a),this.destroy(),this.init()}},mxEdgeHandler.prototype.removePoint=function(e,n){if(0<n&&n<this.abspoints.length-1){var t=this.graph.getCellGeometry(this.state.cell);null!=t&&null!=t.points&&((t=t.clone()).points.splice(n-1,1),this.graph.getModel().setGeometry(e.cell,t),this.destroy(),this.init())}},mxEdgeHandler.prototype.getHandleFillColor=function(e){e=0==e;var n=this.state.cell,t=this.graph.getModel().getTerminal(n,e),a=mxConstants.HANDLE_FILLCOLOR;return null!=t&&!this.graph.isCellDisconnectable(n,t,e)||null==t&&!this.graph.isTerminalPointMovable(n,e)?a=mxConstants.LOCKED_HANDLE_FILLCOLOR:null!=t&&this.graph.isCellDisconnectable(n,t,e)&&(a=mxConstants.CONNECT_HANDLE_FILLCOLOR),a},mxEdgeHandler.prototype.redraw=function(){this.abspoints=this.state.absolutePoints.slice();var e=this.state.cell,n=mxConstants.LABEL_HANDLE_SIZE;if(this.label=new mxPoint(this.state.absoluteOffset.x,this.state.absoluteOffset.y),this.labelShape.bounds=new mxRectangle(Math.round(this.label.x-n/2),Math.round(this.label.y-n/2),n,n),this.labelShape.redraw(),null!=(n=this.graph.getLabel(e))&&0<n.length&&this.graph.isLabelMovable(e)?this.labelShape.node.style.visibility="visible":this.labelShape.node.style.visibility="hidden",null!=this.bends&&0<this.bends.length){var t=this.abspoints.length-1,a=(e=this.abspoints[0],this.abspoints[0].y);n=this.bends[0].bounds;this.bends[0].bounds=new mxRectangle(Math.round(this.abspoints[0].x-n.width/2),Math.round(a-n.height/2),n.width,n.height),this.bends[0].fill=this.getHandleFillColor(0),this.bends[0].redraw();a=this.abspoints[t];var i=this.abspoints[t].x,s=(t=this.abspoints[t].y,this.bends.length-1);n=this.bends[s].bounds;this.bends[s].bounds=new mxRectangle(Math.round(i-n.width/2),Math.round(t-n.height/2),n.width,n.height),this.bends[s].fill=this.getHandleFillColor(s),this.bends[s].redraw(),this.redrawInnerBends(e,a)}this.drawPreview()},mxEdgeHandler.prototype.redrawInnerBends=function(e,n){var t=this.graph.getModel().getGeometry(this.state.cell).points;if(null!=t){null==this.points&&(this.points=[]);for(var a=1;a<this.bends.length-1;a++)if(null!=this.bends[a])if(null!=this.abspoints[a]){var i=this.abspoints[a].x,s=this.abspoints[a].y,o=this.bends[a].bounds;this.bends[a].node.style.visibility="visible",this.bends[a].bounds=new mxRectangle(Math.round(i-o.width/2),Math.round(s-o.height/2),o.width,o.height),this.bends[a].redraw(),this.points[a-1]=t[a-1]}else this.bends[a].destroy(),this.bends[a]=null}},mxEdgeHandler.prototype.drawPreview=function(){if(this.isLabel){var e=mxConstants.LABEL_HANDLE_SIZE;e=new mxRectangle(Math.round(this.label.x-e/2),Math.round(this.label.y-e/2),e,e);this.labelShape.bounds=e,this.labelShape.redraw()}else this.shape.points=this.abspoints,this.shape.redraw()},mxEdgeHandler.prototype.destroy=function(){if(null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.labelShape&&(this.labelShape.destroy(),this.labelShape=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.bends)for(var e=0;e<this.bends.length;e++)null!=this.bends[e]&&(this.bends[e].destroy(),this.bends[e]=null)},mxUtils.extend(mxElbowEdgeHandler,mxEdgeHandler),mxElbowEdgeHandler.prototype=new mxEdgeHandler,mxElbowEdgeHandler.prototype.constructor=mxElbowEdgeHandler,mxElbowEdgeHandler.prototype.flipEnabled=!0,mxElbowEdgeHandler.prototype.doubleClickOrientationResource="none"!=mxClient.language?"doubleClickOrientation":"",mxElbowEdgeHandler.prototype.createBends=function(){var e=[],n=this.createHandleShape(0);return this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e.push(this.createVirtualBend()),this.points.push(new mxPoint(0,0)),n=this.createHandleShape(2),this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e},mxElbowEdgeHandler.prototype.createVirtualBend=function(){var e=this.createHandleShape();this.initBend(e);var n=this.getCursorForBend();return e.node.style.cursor=n,n=mxUtils.bind(this,function(e){!mxEvent.isConsumed(e)&&this.flipEnabled&&(this.graph.flipEdge(this.state.cell,e),mxEvent.consume(e))}),mxEvent.redirectMouseEvents(e.node,this.graph,this.state,null,null,null,n),this.graph.isCellBendable(this.state.cell)||(e.node.style.display="none"),e},mxElbowEdgeHandler.prototype.getCursorForBend=function(){return this.state.style[mxConstants.STYLE_EDGE]==mxEdgeStyle.TopToBottom||this.state.style[mxConstants.STYLE_EDGE]==mxConstants.EDGESTYLE_TOPTOBOTTOM||(this.state.style[mxConstants.STYLE_EDGE]==mxEdgeStyle.ElbowConnector||this.state.style[mxConstants.STYLE_EDGE]==mxConstants.EDGESTYLE_ELBOW)&&this.state.style[mxConstants.STYLE_ELBOW]==mxConstants.ELBOW_VERTICAL?"row-resize":"col-resize"},mxElbowEdgeHandler.prototype.getTooltipForNode=function(e){var n=null;return null==this.bends||null==this.bends[1]||e!=this.bends[1].node&&e.parentNode!=this.bends[1].node||(n=this.doubleClickOrientationResource,n=mxResources.get(n)||n),n},mxElbowEdgeHandler.prototype.convertPoint=function(e,n){var t=this.graph.getView().getScale(),a=this.graph.getView().getTranslate(),i=this.state.origin;n&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/t-a.x-i.x),e.y=Math.round(e.y/t-a.y-i.y)},mxElbowEdgeHandler.prototype.redrawInnerBends=function(e,n){var t=null==(t=null!=(t=this.graph.getModel().getGeometry(this.state.cell).points)?t[0]:null)?new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2):new mxPoint(this.graph.getView().scale*(t.x+this.graph.getView().translate.x+this.state.origin.x),this.graph.getView().scale*(t.y+this.graph.getView().translate.y+this.state.origin.y)),a=(i=this.bends[1].bounds).width,i=i.height;null==this.handleImage&&(i=a=mxConstants.HANDLE_SIZE);var s=new mxRectangle(Math.round(t.x-a/2),Math.round(t.y-i/2),a,i);null==this.handleImage&&"hidden"!=this.labelShape.node.style.visibility&&mxUtils.intersects(s,this.labelShape.bounds)&&(a+=3,i+=3,s=new mxRectangle(Math.round(t.x-a/2),Math.round(t.y-i/2),a,i)),this.bends[1].bounds=s,this.bends[1].redraw()},mxUtils.extend(mxEdgeSegmentHandler,mxEdgeHandler),mxEdgeSegmentHandler.prototype=new mxElbowEdgeHandler,mxEdgeSegmentHandler.prototype.constructor=mxEdgeSegmentHandler,mxEdgeSegmentHandler.prototype.getPreviewPoints=function(e){if(this.isSource||this.isTarget)return mxElbowEdgeHandler.prototype.getPreviewPoints.apply(this,arguments);this.convertPoint(e,!1);var n=this.state.absolutePoints,t=n[0].clone();this.convertPoint(t,!1);for(var a=[],i=1;i<n.length;i++){var s=n[i].clone();this.convertPoint(s,!1),i==this.index&&(t.x==s.x?(t.x=e.x,s.x=e.x):(t.y=e.y,s.y=e.y)),i<n.length-1&&a.push(s),t=s}if(1==a.length){if(t=this.state.view,i=this.state.getVisibleTerminalState(!0),null!=(s=this.state.getVisibleTerminalState(!1))&null!=i){var o=this.state.origin.x,r=this.state.origin.y;mxUtils.contains(s,a[0].x+o,a[0].y+r)?n[1].y==n[2].y?a[0].y=t.getRoutingCenterY(i)-r:a[0].x=t.getRoutingCenterX(i)-o:mxUtils.contains(i,a[0].x+o,a[0].y+r)&&(n[1].y==n[0].y?a[0].y=t.getRoutingCenterY(s)-r:a[0].x=t.getRoutingCenterX(s)-o)}}else 0==a.length&&(a=[e]);return a},mxEdgeSegmentHandler.prototype.createBends=function(){var e=[],n=this.createHandleShape(0);this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none");var t=this.state.absolutePoints;if(this.graph.isCellBendable(this.state.cell)){null==this.points&&(this.points=[]);for(var a=0;a<t.length-1;a++)n=this.createVirtualBend(),e.push(n),n.node.style.cursor=0==t[a].x-t[a+1].x?"col-resize":"row-resize",this.points.push(new mxPoint(0,0)),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none")}return n=this.createHandleShape(t.length),this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e},mxEdgeSegmentHandler.prototype.redraw=function(){this.refresh(),mxEdgeHandler.prototype.redraw.apply(this,arguments)},mxEdgeSegmentHandler.prototype.refresh=function(){if(null!=this.bends){for(var e=0;e<this.bends.length;e++)null!=this.bends[e]&&(this.bends[e].destroy(),this.bends[e]=null);this.bends=this.createBends()}},mxEdgeSegmentHandler.prototype.redrawInnerBends=function(e,n){if(this.graph.isCellBendable(this.state.cell)){var t=mxConstants.HANDLE_SIZE,a=this.state.absolutePoints;if(null!=a&&1<a.length)for(var i=0;i<this.state.absolutePoints.length-1;i++)if(null!=this.bends[i+1]){e=a[i],n=a[i+1];var s=new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2);this.bends[i+1].bounds=new mxRectangle(Math.round(s.x-t/2),Math.round(s.y-t/2),t,t),this.bends[i+1].redraw()}}},mxEdgeSegmentHandler.prototype.changePoints=function(e,n){n=[];var t=this.abspoints;if(1<t.length)for(var a=t[0],i=t[1],s=2;s<t.length;s++){var o=t[s];Math.round(a.x)==Math.round(i.x)&&Math.round(i.x)==Math.round(o.x)||Math.round(a.y)==Math.round(i.y)&&Math.round(i.y)==Math.round(o.y)||(i=(a=i).clone(),this.convertPoint(i,!1),n.push(i)),i=o}mxElbowEdgeHandler.prototype.changePoints.apply(this,arguments)},mxKeyHandler.prototype.graph=null,mxKeyHandler.prototype.target=null,mxKeyHandler.prototype.normalKeys=null,mxKeyHandler.prototype.shiftKeys=null,mxKeyHandler.prototype.controlKeys=null,mxKeyHandler.prototype.controlShiftKeys=null,mxKeyHandler.prototype.enabled=!0,mxKeyHandler.prototype.isEnabled=function(){return this.enabled},mxKeyHandler.prototype.setEnabled=function(e){this.enabled=e},mxKeyHandler.prototype.bindKey=function(e,n){this.normalKeys[e]=n},mxKeyHandler.prototype.bindShiftKey=function(e,n){this.shiftKeys[e]=n},mxKeyHandler.prototype.bindControlKey=function(e,n){this.controlKeys[e]=n},mxKeyHandler.prototype.bindControlShiftKey=function(e,n){this.controlShiftKeys[e]=n},mxKeyHandler.prototype.isControlDown=function(e){return mxEvent.isControlDown(e)},mxKeyHandler.prototype.getFunction=function(e){return null!=e?this.isControlDown(e)?mxEvent.isShiftDown(e)?this.controlShiftKeys[e.keyCode]:this.controlKeys[e.keyCode]:mxEvent.isShiftDown(e)?this.shiftKeys[e.keyCode]:this.normalKeys[e.keyCode]:null},mxKeyHandler.prototype.isGraphEvent=function(e){if((e=mxEvent.getSource(e))==this.target||e.parentNode==this.target||null!=this.graph.cellEditor&&e==this.graph.cellEditor.textarea)return!0;for(;null!=e;){if(e==this.graph.container)return!0;e=e.parentNode}return!1},mxKeyHandler.prototype.keyDown=function(e){if(this.graph.isEnabled()&&!mxEvent.isConsumed(e)&&this.isGraphEvent(e)&&this.isEnabled())if(27==e.keyCode)this.escape(e);else if(!this.graph.isEditing()){var n=this.getFunction(e);null!=n&&(n(e),mxEvent.consume(e))}},mxKeyHandler.prototype.escape=function(e){this.graph.isEscapeEnabled()&&this.graph.escape(e)},mxKeyHandler.prototype.destroy=function(){this.target=null},mxTooltipHandler.prototype.zIndex=10005,mxTooltipHandler.prototype.graph=null,mxTooltipHandler.prototype.delay=null,mxTooltipHandler.prototype.hideOnHover=!1,mxTooltipHandler.prototype.enabled=!0,mxTooltipHandler.prototype.isEnabled=function(){return this.enabled},mxTooltipHandler.prototype.setEnabled=function(e){this.enabled=e},mxTooltipHandler.prototype.isHideOnHover=function(){return this.hideOnHover},mxTooltipHandler.prototype.setHideOnHover=function(e){this.hideOnHover=e},mxTooltipHandler.prototype.init=function(){null!=document.body&&(this.div=document.createElement("div"),this.div.className="mxTooltip",this.div.style.visibility="hidden",this.div.style.zIndex=this.zIndex,document.body.appendChild(this.div),mxEvent.addListener(this.div,"mousedown",mxUtils.bind(this,function(e){this.hideTooltip()})))},mxTooltipHandler.prototype.mouseDown=function(e,n){this.reset(n,!1),this.hideTooltip()},mxTooltipHandler.prototype.mouseMove=function(e,n){n.getX()==this.lastX&&n.getY()==this.lastY||(this.reset(n,!0),(this.isHideOnHover()||n.getState()!=this.state||n.getSource()!=this.node&&(!this.stateSource||null!=n.getState()&&this.stateSource==(n.isSource(n.getState().shape)||!n.isSource(n.getState().text))))&&this.hideTooltip()),this.lastX=n.getX(),this.lastY=n.getY()},mxTooltipHandler.prototype.mouseUp=function(e,n){this.reset(n,!0),this.hideTooltip()},mxTooltipHandler.prototype.resetTimer=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null)},mxTooltipHandler.prototype.reset=function(e,n){if(this.resetTimer(),n&&this.isEnabled()&&null!=e.getState()&&(null==this.div||"hidden"==this.div.style.visibility)){var t=e.getState(),a=e.getSource(),i=e.getX(),s=e.getY(),o=e.isSource(t.shape)||e.isSource(t.text);this.thread=window.setTimeout(mxUtils.bind(this,function(){if(!this.graph.isEditing()&&!this.graph.panningHandler.isMenuShowing()){var e=this.graph.getTooltip(t,a,i,s);this.show(e,i,s),this.state=t,this.node=a,this.stateSource=o}}),this.delay)}},mxTooltipHandler.prototype.hide=function(){this.resetTimer(),this.hideTooltip()},mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility="hidden")},mxTooltipHandler.prototype.show=function(e,n,t){if(null!=e&&0<e.length){null==this.div&&this.init();var a=mxUtils.getScrollOrigin();this.div.style.left=n+a.x+"px",this.div.style.top=t+mxConstants.TOOLTIP_VERTICAL_OFFSET+a.y+"px",mxUtils.isNode(e)?(this.div.innerHTML="",this.div.appendChild(e)):this.div.innerHTML=e.replace(/\n/g,"<br>"),this.div.style.visibility="",mxUtils.fit(this.div)}},mxTooltipHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),mxEvent.release(this.div),null!=this.div&&null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.div=null},mxUtils.extend(mxCellTracker,mxCellMarker),mxCellTracker.prototype.mouseDown=function(e,n){},mxCellTracker.prototype.mouseMove=function(e,n){this.isEnabled()&&this.process(n)},mxCellTracker.prototype.mouseUp=function(e,n){this.reset()},mxCellTracker.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),mxCellMarker.prototype.destroy.apply(this))},mxCellHighlight.prototype.keepOnTop=!1,mxCellHighlight.prototype.graph=!0,mxCellHighlight.prototype.state=null,mxCellHighlight.prototype.spacing=2,mxCellHighlight.prototype.resetHandler=null,mxCellHighlight.prototype.setHighlightColor=function(e){this.highlightColor=e,null!=this.shape&&(this.shape.stroke=e)},mxCellHighlight.prototype.drawHighlight=function(){this.shape=this.createShape(),this.repaint(),!this.keepOnTop&&this.shape.node.parentNode.firstChild!=this.shape.node&&this.shape.node.parentNode.insertBefore(this.shape.node,this.shape.node.parentNode.firstChild)},mxCellHighlight.prototype.createShape=function(){var e=null;return(e=this.graph.model.isEdge(this.state.cell)?new mxPolyline(this.state.absolutePoints,this.highlightColor,this.strokeWidth):new mxRectangleShape(new mxRectangle,null,this.highlightColor,this.strokeWidth)).dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),mxEvent.redirectMouseEvents(e.node,this.graph,this.state),e.svgStrokeTolerance=0,e.pointerEvents=!1,e.isDashed=this.dashed,e},mxCellHighlight.prototype.repaint=function(){if(null!=this.state&&null!=this.shape){var e=0;this.graph.model.isEdge(this.state.cell)?this.shape.points=this.state.absolutePoints:(this.shape.bounds=new mxRectangle(this.state.x-this.spacing,this.state.y-this.spacing,this.state.width+2*this.spacing,this.state.height+2*this.spacing),e=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")),null!=this.state.shape&&this.shape.setCursor(this.state.shape.getCursor()),0!=e&&(this.shape.rotation=e),this.shape.redraw()}},mxCellHighlight.prototype.hide=function(){this.highlight(null)},mxCellHighlight.prototype.highlight=function(e){this.state!=e&&(null!=this.shape&&(this.shape.destroy(),this.shape=null),this.state=e,null!=this.state&&this.drawHighlight())},mxCellHighlight.prototype.destroy=function(){this.graph.getView().removeListener(this.repaintHandler),this.graph.getModel().removeListener(this.repaintHandler),this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),null!=this.shape&&(this.shape.destroy(),this.shape=null)},mxDefaultKeyHandler.prototype.editor=null,mxDefaultKeyHandler.prototype.handler=null,mxDefaultKeyHandler.prototype.bindAction=function(e,n,t){var a=mxUtils.bind(this,function(){this.editor.execute(n)});t?this.handler.bindControlKey(e,a):this.handler.bindKey(e,a)},mxDefaultKeyHandler.prototype.destroy=function(){this.handler.destroy(),this.handler=null},mxDefaultPopupMenu.prototype.imageBasePath=null,mxDefaultPopupMenu.prototype.config=null,mxDefaultPopupMenu.prototype.createMenu=function(e,n,t,a){if(null!=this.config){var i=this.createConditions(e,t,a);this.addItems(e,n,t,a,i,this.config.firstChild,null)}},mxDefaultPopupMenu.prototype.addItems=function(e,n,t,a,i,s,o){for(var r=!1;null!=s;){if("add"==s.nodeName){if(null==(l=s.getAttribute("if"))||i[l]){var l=s.getAttribute("as"),d=(l=mxResources.get(l)||l,mxUtils.eval(mxUtils.getTextContent(s))),c=s.getAttribute("action"),m=s.getAttribute("icon"),u=s.getAttribute("iconCls");r&&(n.addSeparator(o),r=!1),null!=m&&this.imageBasePath&&(m=this.imageBasePath+m),l=this.addAction(n,e,l,m,d,c,t,o,u),this.addItems(e,n,t,a,i,s.firstChild,l)}}else"separator"==s.nodeName&&(r=!0);s=s.nextSibling}},mxDefaultPopupMenu.prototype.addAction=function(e,n,t,a,i,s,o,r,l){return e.addItem(t,a,function(e){"function"==typeof i&&i.call(n,n,o,e),null!=s&&n.execute(s,o,e)},r,l)},mxDefaultPopupMenu.prototype.createConditions=function(e,n,t){var a=e.graph.getModel(),i=a.getChildCount(n),s=[];for(s.nocell=null==n,s.ncells=1<e.graph.getSelectionCount(),s.notRoot=a.getRoot()!=a.getParent(e.graph.getDefaultParent()),s.cell=null!=n,a=null!=n&&1==e.graph.getSelectionCount(),s.nonEmpty=a&&0<i,s.expandable=a&&e.graph.isCellFoldable(n,!1),s.collapsable=a&&e.graph.isCellFoldable(n,!0),s.validRoot=a&&e.graph.isValidRoot(n),s.emptyValidRoot=s.validRoot&&0==i,s.swimlane=a&&e.graph.isSwimlane(n),i=this.config.getElementsByTagName("condition"),a=0;a<i.length;a++){var o=mxUtils.eval(mxUtils.getTextContent(i[a])),r=i[a].getAttribute("name");null!=r&&"function"==typeof o&&(s[r]=o(e,n,t))}return s},mxDefaultToolbar.prototype.editor=null,mxDefaultToolbar.prototype.toolbar=null,mxDefaultToolbar.prototype.resetHandler=null,mxDefaultToolbar.prototype.spacing=4,mxDefaultToolbar.prototype.connectOnDrop=!1,mxDefaultToolbar.prototype.init=function(e){null!=e&&(this.toolbar=new mxToolbar(e),this.toolbar.addListener(mxEvent.SELECT,mxUtils.bind(this,function(e,n){var t=n.getProperty("function");this.editor.insertFunction=null!=t?mxUtils.bind(this,function(){t.apply(this,arguments),this.toolbar.resetMode()}):null})),this.resetHandler=mxUtils.bind(this,function(){null!=this.toolbar&&this.toolbar.resetMode(!0)}),this.editor.graph.addListener(mxEvent.DOUBLE_CLICK,this.resetHandler),this.editor.addListener(mxEvent.ESCAPE,this.resetHandler))},mxDefaultToolbar.prototype.addItem=function(e,n,t,a){var i=mxUtils.bind(this,function(){null!=t&&0<t.length&&this.editor.execute(t)});return this.toolbar.addItem(e,n,i,a)},mxDefaultToolbar.prototype.addSeparator=function(e){e=e||mxClient.imageBasePath+"/separator.gif",this.toolbar.addSeparator(e)},mxDefaultToolbar.prototype.addCombo=function(){return this.toolbar.addCombo()},mxDefaultToolbar.prototype.addActionCombo=function(e){return this.toolbar.addActionCombo(e)},mxDefaultToolbar.prototype.addActionOption=function(e,n,t){var a=mxUtils.bind(this,function(){this.editor.execute(t)});this.addOption(e,n,a)},mxDefaultToolbar.prototype.addOption=function(e,n,t){return this.toolbar.addOption(e,n,t)},mxDefaultToolbar.prototype.addMode=function(e,n,t,a,i){var s=mxUtils.bind(this,function(){this.editor.setMode(t),null!=i&&i(this.editor)});return this.toolbar.addSwitchMode(e,n,s,a)},mxDefaultToolbar.prototype.addPrototype=function(e,n,t,a,i,s){var o=function(){return"function"==typeof t?t():null!=t?t.clone():null},r=mxUtils.bind(this,function(e,n){"function"==typeof i?i(this.editor,o(),e,n):this.drop(o(),e,n),this.toolbar.resetMode(),mxEvent.consume(e)});return e=this.toolbar.addMode(e,n,r,a,null,s),this.installDropHandler(e,function(e,n,t){r(n,t)}),e},mxDefaultToolbar.prototype.drop=function(e,n,t){var a=this.editor.graph,i=a.getModel();if(null!=t&&!i.isEdge(t)&&this.connectOnDrop&&a.isCellConnectable(t))this.connect(e,n,t);else{for(;null!=t&&!a.isValidDropTarget(t,[e],n);)t=i.getParent(t);this.insert(e,n,t)}},mxDefaultToolbar.prototype.insert=function(e,n,t){var a=this.editor.graph;if(a.canImportCell(e)){var i=mxEvent.getClientX(n),s=mxEvent.getClientY(n);i=mxUtils.convertPoint(a.container,i,s);return a.isSplitEnabled()&&a.isSplitTarget(t,[e],n)?a.splitEdge(t,[e],null,i.x,i.y):this.editor.addVertex(t,e,i.x,i.y)}return null},mxDefaultToolbar.prototype.connect=function(e,n,t){var a=(n=this.editor.graph).getModel();if(null!=t&&n.isCellConnectable(e)&&n.isEdgeValid(null,t,e)){var i=null;a.beginUpdate();try{var s=a.getGeometry(t),o=a.getGeometry(e).clone();o.x=s.x+(s.width-o.width)/2,o.y=s.y+(s.height-o.height)/2;var r=this.spacing*n.gridSize,l=20*a.getDirectedEdgeCount(t,!0);this.editor.horizontalFlow?o.x+=(o.width+s.width)/2+r+l:o.y+=(o.height+s.height)/2+r+l,e.setGeometry(o);var d=a.getParent(t);if(n.addCell(e,d),n.constrainChild(e),i=this.editor.createEdge(t,e),null==a.getGeometry(i)){var c=new mxGeometry;c.relative=!0,a.setGeometry(i,c)}n.addEdge(i,d,t,e)}finally{a.endUpdate()}n.setSelectionCells([e,i]),n.scrollCellToVisible(e)}},mxDefaultToolbar.prototype.installDropHandler=function(n,t){var a=document.createElement("img");a.setAttribute("src",n.getAttribute("src"));var i=mxUtils.bind(this,function(e){a.style.width=2*n.offsetWidth+"px",a.style.height=2*n.offsetHeight+"px",mxUtils.makeDraggable(n,this.editor.graph,t,a),mxEvent.removeListener(a,"load",i)});mxClient.IS_IE?i():mxEvent.addListener(a,"load",i)},mxDefaultToolbar.prototype.destroy=function(){null!=this.resetHandler&&(this.editor.graph.removeListener("dblclick",this.resetHandler),this.editor.removeListener("escape",this.resetHandler),this.resetHandler=null),null!=this.toolbar&&(this.toolbar.destroy(),this.toolbar=null)},mxLoadResources&&mxResources.add(mxClient.basePath+"/resources/editor"),mxEditor.prototype=new mxEventSource,mxEditor.prototype.constructor=mxEditor,mxEditor.prototype.askZoomResource="none"!=mxClient.language?"askZoom":"",mxEditor.prototype.lastSavedResource="none"!=mxClient.language?"lastSaved":"",mxEditor.prototype.currentFileResource="none"!=mxClient.language?"currentFile":"",mxEditor.prototype.propertiesResource="none"!=mxClient.language?"properties":"",mxEditor.prototype.tasksResource="none"!=mxClient.language?"tasks":"",mxEditor.prototype.helpResource="none"!=mxClient.language?"help":"",mxEditor.prototype.outlineResource="none"!=mxClient.language?"outline":"",mxEditor.prototype.outline=null,mxEditor.prototype.graph=null,mxEditor.prototype.graphRenderHint=null,mxEditor.prototype.toolbar=null,mxEditor.prototype.session=null,mxEditor.prototype.status=null,mxEditor.prototype.popupHandler=null,mxEditor.prototype.undoManager=null,mxEditor.prototype.keyHandler=null,mxEditor.prototype.actions=null,mxEditor.prototype.dblClickAction="edit",mxEditor.prototype.swimlaneRequired=!1,mxEditor.prototype.disableContextMenu=!0,mxEditor.prototype.insertFunction=null,mxEditor.prototype.forcedInserting=!1,mxEditor.prototype.templates=null,mxEditor.prototype.defaultEdge=null,mxEditor.prototype.defaultEdgeStyle=null,mxEditor.prototype.defaultGroup=null,mxEditor.prototype.groupBorderSize=null,mxEditor.prototype.filename=null,mxEditor.prototype.linefeed="&#xa;",mxEditor.prototype.postParameterName="xml",mxEditor.prototype.escapePostData=!0,mxEditor.prototype.urlPost=null,mxEditor.prototype.urlImage=null,mxEditor.prototype.urlInit=null,mxEditor.prototype.urlNotify=null,mxEditor.prototype.urlPoll=null,mxEditor.prototype.horizontalFlow=!1,mxEditor.prototype.layoutDiagram=!1,mxEditor.prototype.swimlaneSpacing=0,mxEditor.prototype.maintainSwimlanes=!1,mxEditor.prototype.layoutSwimlanes=!1,mxEditor.prototype.cycleAttributeValues=null,mxEditor.prototype.cycleAttributeIndex=0,mxEditor.prototype.cycleAttributeName="fillColor",mxEditor.prototype.tasks=null,mxEditor.prototype.tasksWindowImage=null,mxEditor.prototype.tasksTop=20,mxEditor.prototype.help=null,mxEditor.prototype.helpWindowImage=null,mxEditor.prototype.urlHelp=null,mxEditor.prototype.helpWidth=300,mxEditor.prototype.helpHeight=260,mxEditor.prototype.propertiesWidth=240,mxEditor.prototype.propertiesHeight=null,mxEditor.prototype.movePropertiesDialog=!1,mxEditor.prototype.validating=!1,mxEditor.prototype.modified=!1,mxEditor.prototype.isModified=function(){return this.modified},mxEditor.prototype.setModified=function(e){this.modified=e},mxEditor.prototype.addActions=function(){this.addAction("save",function(e){e.save()}),this.addAction("print",function(e){new mxPrintPreview(e.graph,1).open()}),this.addAction("show",function(e){mxUtils.show(e.graph,null,10,10)}),this.addAction("exportImage",function(e){var n=e.getUrlImage();if(null==n||mxClient.IS_LOCAL)e.execute("show");else{var t=mxUtils.getViewXml(e.graph,1);t=mxUtils.getXml(t,"\n");mxUtils.submit(n,e.postParameterName+"="+encodeURIComponent(t),document,"_blank")}}),this.addAction("refresh",function(e){e.graph.refresh()}),this.addAction("cut",function(e){e.graph.isEnabled()&&mxClipboard.cut(e.graph)}),this.addAction("copy",function(e){e.graph.isEnabled()&&mxClipboard.copy(e.graph)}),this.addAction("paste",function(e){e.graph.isEnabled()&&mxClipboard.paste(e.graph)}),this.addAction("delete",function(e){e.graph.isEnabled()&&e.graph.removeCells()}),this.addAction("group",function(e){e.graph.isEnabled()&&e.graph.setSelectionCell(e.groupCells())}),this.addAction("ungroup",function(e){e.graph.isEnabled()&&e.graph.setSelectionCells(e.graph.ungroupCells())}),this.addAction("removeFromParent",function(e){e.graph.isEnabled()&&e.graph.removeCellsFromParent()}),this.addAction("undo",function(e){e.graph.isEnabled()&&e.undo()}),this.addAction("redo",function(e){e.graph.isEnabled()&&e.redo()}),this.addAction("zoomIn",function(e){e.graph.zoomIn()}),this.addAction("zoomOut",function(e){e.graph.zoomOut()}),this.addAction("actualSize",function(e){e.graph.zoomActual()}),this.addAction("fit",function(e){e.graph.fit()}),this.addAction("showProperties",function(e,n){e.showProperties(n)}),this.addAction("selectAll",function(e){e.graph.isEnabled()&&e.graph.selectAll()}),this.addAction("selectNone",function(e){e.graph.isEnabled()&&e.graph.clearSelection()}),this.addAction("selectVertices",function(e){e.graph.isEnabled()&&e.graph.selectVertices()}),this.addAction("selectEdges",function(e){e.graph.isEnabled()&&e.graph.selectEdges()}),this.addAction("edit",function(e,n){e.graph.isEnabled()&&e.graph.isCellEditable(n)&&e.graph.startEditingAtCell(n)}),this.addAction("toBack",function(e,n){e.graph.isEnabled()&&e.graph.orderCells(!0)}),this.addAction("toFront",function(e,n){e.graph.isEnabled()&&e.graph.orderCells(!1)}),this.addAction("enterGroup",function(e,n){e.graph.enterGroup(n)}),this.addAction("exitGroup",function(e){e.graph.exitGroup()}),this.addAction("home",function(e){e.graph.home()}),this.addAction("selectPrevious",function(e){e.graph.isEnabled()&&e.graph.selectPreviousCell()}),this.addAction("selectNext",function(e){e.graph.isEnabled()&&e.graph.selectNextCell()}),this.addAction("selectParent",function(e){e.graph.isEnabled()&&e.graph.selectParentCell()}),this.addAction("selectChild",function(e){e.graph.isEnabled()&&e.graph.selectChildCell()}),this.addAction("collapse",function(e){e.graph.isEnabled()&&e.graph.foldCells(!0)}),this.addAction("collapseAll",function(e){if(e.graph.isEnabled()){var n=e.graph.getChildVertices();e.graph.foldCells(!0,!1,n)}}),this.addAction("expand",function(e){e.graph.isEnabled()&&e.graph.foldCells(!1)}),this.addAction("expandAll",function(e){if(e.graph.isEnabled()){var n=e.graph.getChildVertices();e.graph.foldCells(!1,!1,n)}}),this.addAction("bold",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_BOLD)}),this.addAction("italic",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_ITALIC)}),this.addAction("underline",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_UNDERLINE)}),this.addAction("shadow",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_SHADOW)}),this.addAction("alignCellsLeft",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_LEFT)}),this.addAction("alignCellsCenter",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_CENTER)}),this.addAction("alignCellsRight",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_RIGHT)}),this.addAction("alignCellsTop",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_TOP)}),this.addAction("alignCellsMiddle",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_MIDDLE)}),this.addAction("alignCellsBottom",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_BOTTOM)}),this.addAction("alignFontLeft",function(e){e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT)}),this.addAction("alignFontCenter",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER)}),this.addAction("alignFontRight",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_RIGHT)}),this.addAction("alignFontTop",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_TOP)}),this.addAction("alignFontMiddle",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE)}),this.addAction("alignFontBottom",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_BOTTOM)}),this.addAction("zoom",function(e){var n=100*e.graph.getView().scale;n=parseFloat(mxUtils.prompt(mxResources.get(e.askZoomResource)||e.askZoomResource,n))/100;isNaN(n)||e.graph.getView().setScale(n)}),this.addAction("toggleTasks",function(e){null!=e.tasks?e.tasks.setVisible(!e.tasks.isVisible()):e.showTasks()}),this.addAction("toggleHelp",function(e){null!=e.help?e.help.setVisible(!e.help.isVisible()):e.showHelp()}),this.addAction("toggleOutline",function(e){null==e.outline?e.showOutline():e.outline.setVisible(!e.outline.isVisible())}),this.addAction("toggleConsole",function(e){mxLog.setVisible(!mxLog.isVisible())})},mxEditor.prototype.createSession=function(){var e=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.SESSION,"session",e))});return this.connect(this.urlInit,this.urlPoll,this.urlNotify,e)},mxEditor.prototype.configure=function(e){null!=e&&(new mxCodec(e.ownerDocument).decode(e,this),this.resetHistory())},mxEditor.prototype.resetFirstTime=function(){document.cookie="mxgraph=seen; expires=Fri, 27 Jul 2001 02:47:11 UTC; path=/"},mxEditor.prototype.resetHistory=function(){this.lastSnapshot=(new Date).getTime(),this.undoManager.clear(),this.ignoredChanges=0,this.setModified(!1)},mxEditor.prototype.addAction=function(e,n){this.actions[e]=n},mxEditor.prototype.execute=function(n,e,t){var a=this.actions[n];if(null!=a)try{var i=arguments;i[0]=this,a.apply(this,i)}catch(e){throw mxUtils.error("Cannot execute "+n+": "+e.message,280,!0),e}else mxUtils.error("Cannot find action "+n,280,!0)},mxEditor.prototype.addTemplate=function(e,n){this.templates[e]=n},mxEditor.prototype.getTemplate=function(e){return this.templates[e]},mxEditor.prototype.createGraph=function(){var e=new mxGraph(null,null,this.graphRenderHint);return e.setTooltips(!0),e.setPanning(!0),this.installDblClickHandler(e),this.installUndoHandler(e),this.installDrillHandler(e),this.installChangeHandler(e),this.installInsertHandler(e),e.panningHandler.factoryMethod=mxUtils.bind(this,function(e,n,t){return this.createPopupMenu(e,n,t)}),e.connectionHandler.factoryMethod=mxUtils.bind(this,function(e,n){return this.createEdge(e,n)}),this.createSwimlaneManager(e),this.createLayoutManager(e),e},mxEditor.prototype.createSwimlaneManager=function(e){return(e=new mxSwimlaneManager(e,!1)).isHorizontal=mxUtils.bind(this,function(){return this.horizontalFlow}),e.isEnabled=mxUtils.bind(this,function(){return this.maintainSwimlanes}),e},mxEditor.prototype.createLayoutManager=function(a){var e=new mxLayoutManager(a),i=this;return e.getLayout=function(e){var n=null,t=i.graph.getModel();return null!=t.getParent(e)&&(i.layoutSwimlanes&&a.isSwimlane(e)?(null==i.swimlaneLayout&&(i.swimlaneLayout=i.createSwimlaneLayout()),n=i.swimlaneLayout):i.layoutDiagram&&(a.isValidRoot(e)||null==t.getParent(t.getParent(e)))&&(null==i.diagramLayout&&(i.diagramLayout=i.createDiagramLayout()),n=i.diagramLayout)),n},e},mxEditor.prototype.setGraphContainer=function(e){null==this.graph.container&&(this.graph.init(e),this.rubberband=new mxRubberband(this.graph),this.disableContextMenu&&mxEvent.disableContextMenu(e),mxClient.IS_QUIRKS&&new mxDivResizer(e))},mxEditor.prototype.installDblClickHandler=function(a){a.addListener(mxEvent.DOUBLE_CLICK,mxUtils.bind(this,function(e,n){var t=n.getProperty("cell");null!=t&&a.isEnabled()&&null!=this.dblClickAction&&(this.execute(this.dblClickAction,t),n.consume())}))},mxEditor.prototype.installUndoHandler=function(a){var e=mxUtils.bind(this,function(e,n){var t=n.getProperty("edit");this.undoManager.undoableEditHappened(t)});a.getModel().addListener(mxEvent.UNDO,e),a.getView().addListener(mxEvent.UNDO,e),e=function(e,n){var t=n.getProperty("edit").changes;a.setSelectionCells(a.getSelectionCellsForChanges(t))},this.undoManager.addListener(mxEvent.UNDO,e),this.undoManager.addListener(mxEvent.REDO,e)},mxEditor.prototype.installDrillHandler=function(e){var n=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.ROOT))});e.getView().addListener(mxEvent.DOWN,n),e.getView().addListener(mxEvent.UP,n)},mxEditor.prototype.installChangeHandler=function(s){var e=mxUtils.bind(this,function(e,n){this.setModified(!0),1==this.validating&&s.validateGraph();for(var t=n.getProperty("edit").changes,a=0;a<t.length;a++){var i=t[a];if(i instanceof mxRootChange||i instanceof mxValueChange&&i.cell==this.graph.model.root||i instanceof mxCellAttributeChange&&i.cell==this.graph.model.root){this.fireEvent(new mxEventObject(mxEvent.ROOT));break}}});s.getModel().addListener(mxEvent.CHANGE,e)},mxEditor.prototype.installInsertHandler=function(e){var t=this;e.addMouseListener({mouseDown:function(e,n){null==t.insertFunction||n.isPopupTrigger()||!t.forcedInserting&&null!=n.getState()||(t.graph.clearSelection(),t.insertFunction(n.getEvent(),n.getCell()),this.isActive=!0,n.consume())},mouseMove:function(e,n){this.isActive&&n.consume()},mouseUp:function(e,n){this.isActive&&(this.isActive=!1,n.consume())}})},mxEditor.prototype.createDiagramLayout=function(){var e=this.graph.gridSize,n=new mxStackLayout(this.graph,!this.horizontalFlow,this.swimlaneSpacing,2*e,2*e);return n.isVertexIgnored=function(e){return!n.graph.isSwimlane(e)},n},mxEditor.prototype.createSwimlaneLayout=function(){return new mxCompactTreeLayout(this.graph,this.horizontalFlow)},mxEditor.prototype.createToolbar=function(){return new mxDefaultToolbar(null,this)},mxEditor.prototype.setToolbarContainer=function(e){this.toolbar.init(e),mxClient.IS_QUIRKS&&new mxDivResizer(e)},mxEditor.prototype.setStatusContainer=function(e){null==this.status&&(this.status=e,this.addListener(mxEvent.SAVE,mxUtils.bind(this,function(){var e=(new Date).toLocaleString();this.setStatus((mxResources.get(this.lastSavedResource)||this.lastSavedResource)+": "+e)})),this.addListener(mxEvent.OPEN,mxUtils.bind(this,function(){this.setStatus((mxResources.get(this.currentFileResource)||this.currentFileResource)+": "+this.filename)})),mxClient.IS_QUIRKS&&new mxDivResizer(e))},mxEditor.prototype.setStatus=function(e){null!=this.status&&null!=e&&(this.status.innerHTML=e)},mxEditor.prototype.setTitleContainer=function(n){this.addListener(mxEvent.ROOT,mxUtils.bind(this,function(e){n.innerHTML=this.getTitle()})),mxClient.IS_QUIRKS&&new mxDivResizer(n)},mxEditor.prototype.treeLayout=function(e,n){null!=e&&new mxCompactTreeLayout(this.graph,n).execute(e)},mxEditor.prototype.getTitle=function(){for(var e="",n=this.graph,t=n.getCurrentRoot();null!=t&&null!=n.getModel().getParent(n.getModel().getParent(t));)n.isValidRoot(t)&&(e=" > "+n.convertValueToString(t)+e),t=n.getModel().getParent(t);return this.getRootTitle()+e},mxEditor.prototype.getRootTitle=function(){var e=this.graph.getModel().getRoot();return this.graph.convertValueToString(e)},mxEditor.prototype.undo=function(){this.undoManager.undo()},mxEditor.prototype.redo=function(){this.undoManager.redo()},mxEditor.prototype.groupCells=function(){var e=null!=this.groupBorderSize?this.groupBorderSize:this.graph.gridSize;return this.graph.groupCells(this.createGroup(),e)},mxEditor.prototype.createGroup=function(){return this.graph.getModel().cloneCell(this.defaultGroup)},mxEditor.prototype.open=function(e){if(null!=e){var n=mxUtils.load(e).getXml();this.readGraphModel(n.documentElement),this.filename=e,this.fireEvent(new mxEventObject(mxEvent.OPEN,"filename",e))}},mxEditor.prototype.readGraphModel=function(e){new mxCodec(e.ownerDocument).decode(e,this.graph.getModel()),this.resetHistory()},mxEditor.prototype.save=function(e,n){if(null!=(e=e||this.getUrlPost())&&0<e.length){var t=this.writeGraphModel(n);this.postDiagram(e,t),this.setModified(!1)}this.fireEvent(new mxEventObject(mxEvent.SAVE,"url",e))},mxEditor.prototype.postDiagram=function(n,t){this.escapePostData&&(t=encodeURIComponent(t)),mxUtils.post(n,this.postParameterName+"="+t,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.POST,"request",e,"url",n,"data",t))}))},mxEditor.prototype.writeGraphModel=function(e){e=null!=e?e:this.linefeed;var n=(new mxCodec).encode(this.graph.getModel());return mxUtils.getXml(n,e)},mxEditor.prototype.getUrlPost=function(){return this.urlPost},mxEditor.prototype.getUrlImage=function(){return this.urlImage},mxEditor.prototype.connect=function(e,n,t,a){var i=null;return mxClient.IS_LOCAL||((i=new mxSession(this.graph.getModel(),e,n,t)).addListener(mxEvent.RECEIVE,mxUtils.bind(this,function(e,n){null!=n.getProperty("node").getAttribute("namespace")&&this.resetHistory()})),i.addListener(mxEvent.DISCONNECT,a),i.addListener(mxEvent.CONNECT,a),i.addListener(mxEvent.NOTIFY,a),i.addListener(mxEvent.GET,a),i.start()),i},mxEditor.prototype.swapStyles=function(e,n){var t=this.graph.getStylesheet().styles[n];this.graph.getView().getStylesheet().putCellStyle(n,this.graph.getStylesheet().styles[e]),this.graph.getStylesheet().putCellStyle(e,t),this.graph.refresh()},mxEditor.prototype.showProperties=function(e){if(null==(e=e||this.graph.getSelectionCell())&&(null==(e=this.graph.getCurrentRoot())&&(e=this.graph.getModel().getRoot())),null!=e){this.graph.stopEditing(!0);var n=(t=mxUtils.getOffset(this.graph.container)).x+10,t=t.y;if(null==this.properties||this.movePropertiesDialog){var a=this.graph.getCellBounds(e);null!=a&&(n+=a.x+Math.min(200,a.width),t+=a.y)}else n=this.properties.getX(),t=this.properties.getY();this.hideProperties(),null!=(e=this.createProperties(e))&&(this.properties=new mxWindow(mxResources.get(this.propertiesResource)||this.propertiesResource,e,n,t,this.propertiesWidth,this.propertiesHeight,!1),this.properties.setVisible(!0))}},mxEditor.prototype.isPropertiesVisible=function(){return null!=this.properties},mxEditor.prototype.createProperties=function(t){var a=this.graph.getModel(),e=a.getValue(t);if(mxUtils.isNode(e)){var n=new mxForm("properties");n.addText("ID",t.getId()).setAttribute("readonly","true");var i=null,s=null,o=null,r=null,l=null;a.isVertex(t)&&(null!=(i=a.getGeometry(t))&&(s=n.addText("top",i.y),o=n.addText("left",i.x),r=n.addText("width",i.width),l=n.addText("height",i.height)));var d=a.getStyle(t),c=n.addText("Style",d||""),m=e.attributes,u=[];for(e=0;e<m.length;e++)u[e]=n.addTextarea(m[e].nodeName,m[e].nodeValue,"label"==m[e].nodeName?4:2);return e=mxUtils.bind(this,function(){this.hideProperties(),a.beginUpdate();try{null!=i&&((i=i.clone()).x=parseFloat(o.value),i.y=parseFloat(s.value),i.width=parseFloat(r.value),i.height=parseFloat(l.value),a.setGeometry(t,i)),0<c.value.length?a.setStyle(t,c.value):a.setStyle(t,null);for(var e=0;e<m.length;e++){var n=new mxCellAttributeChange(t,m[e].nodeName,u[e].value);a.execute(n)}this.graph.isAutoSizeCell(t)&&this.graph.updateCellSize(t)}finally{a.endUpdate()}}),d=mxUtils.bind(this,function(){this.hideProperties()}),n.addButtons(e,d),n.table}return null},mxEditor.prototype.hideProperties=function(){null!=this.properties&&(this.properties.destroy(),this.properties=null)},mxEditor.prototype.showTasks=function(){if(null==this.tasks){var n=document.createElement("div");n.style.padding="4px",n.style.paddingLeft="20px";var e=document.body.clientWidth;(e=new mxWindow(mxResources.get(this.tasksResource)||this.tasksResource,n,e-220,this.tasksTop,200)).setClosable(!0),e.destroyOnClose=!1;var t=mxUtils.bind(this,function(e){mxEvent.release(n),n.innerHTML="",this.createTasks(n)});this.graph.getModel().addListener(mxEvent.CHANGE,t),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,t),this.graph.addListener(mxEvent.ROOT,t),null!=this.tasksWindowImage&&e.setImage(this.tasksWindowImage),this.tasks=e,this.createTasks(n)}this.tasks.setVisible(!0)},mxEditor.prototype.refreshTasks=function(e){null!=this.tasks&&(e=this.tasks.content,mxEvent.release(e),e.innerHTML="",this.createTasks(e))},mxEditor.prototype.createTasks=function(e){},mxEditor.prototype.showHelp=function(e){if(null==this.help){var n=document.createElement("iframe");n.setAttribute("src",mxResources.get("urlHelp")||this.urlHelp),n.setAttribute("height","100%"),n.setAttribute("width","100%"),n.setAttribute("frameBorder","0"),n.style.backgroundColor="white",e=document.body.clientWidth;var t=document.body.clientHeight||document.documentElement.clientHeight,a=new mxWindow(mxResources.get(this.helpResource)||this.helpResource,n,(e-this.helpWidth)/2,(t-this.helpHeight)/3,this.helpWidth,this.helpHeight);a.setMaximizable(!0),a.setClosable(!0),a.destroyOnClose=!1,a.setResizable(!0),null!=this.helpWindowImage&&a.setImage(this.helpWindowImage),mxClient.IS_NS&&(e=function(e){n.setAttribute("height",a.div.offsetHeight-26+"px")},a.addListener(mxEvent.RESIZE_END,e),a.addListener(mxEvent.MAXIMIZE,e),a.addListener(mxEvent.NORMALIZE,e),a.addListener(mxEvent.SHOW,e)),this.help=a}this.help.setVisible(!0)},mxEditor.prototype.showOutline=function(){if(null==this.outline){var e=document.createElement("div");e.style.overflow="hidden",e.style.width="100%",e.style.height="100%",e.style.background="white",e.style.cursor="move";var n=new mxWindow(mxResources.get(this.outlineResource)||this.outlineResource,e,600,480,200,200,!1),t=new mxOutline(this.graph,e);n.setClosable(!0),n.setResizable(!0),n.destroyOnClose=!1,n.addListener(mxEvent.RESIZE_END,function(){t.update()}),this.outline=n,this.outline.outline=t}this.outline.setVisible(!0),this.outline.outline.update(!0)},mxEditor.prototype.setMode=function(e){"select"==e?(this.graph.panningHandler.useLeftButtonForPanning=!1,this.graph.setConnectable(!1)):"connect"==e?(this.graph.panningHandler.useLeftButtonForPanning=!1,this.graph.setConnectable(!0)):"pan"==e&&(this.graph.panningHandler.useLeftButtonForPanning=!0,this.graph.setConnectable(!1))},mxEditor.prototype.createPopupMenu=function(e,n,t){this.popupHandler.createMenu(this,e,n,t)},mxEditor.prototype.createEdge=function(e,n){var t=null;if(null!=this.defaultEdge)t=this.graph.getModel().cloneCell(this.defaultEdge);else{(t=new mxCell("")).setEdge(!0);var a=new mxGeometry;a.relative=!0,t.setGeometry(a)}return null!=(a=this.getEdgeStyle())&&t.setStyle(a),t},mxEditor.prototype.getEdgeStyle=function(){return this.defaultEdgeStyle},mxEditor.prototype.consumeCycleAttribute=function(e){return null!=this.cycleAttributeValues&&0<this.cycleAttributeValues.length&&this.graph.isSwimlane(e)?this.cycleAttributeValues[this.cycleAttributeIndex++%this.cycleAttributeValues.length]:null},mxEditor.prototype.cycleAttribute=function(e){if(null!=this.cycleAttributeName){var n=this.consumeCycleAttribute(e);null!=n&&e.setStyle(e.getStyle()+";"+this.cycleAttributeName+"="+n)}},mxEditor.prototype.addVertex=function(e,n,t,a){for(var i=this.graph.getModel();null!=e&&!this.graph.isValidDropTarget(e);)e=i.getParent(e);e=null!=e?e:this.graph.getSwimlaneAt(t,a);var s=this.graph.getView().scale,o=i.getGeometry(n),r=i.getGeometry(e);if(this.graph.isSwimlane(n)&&!this.graph.swimlaneNesting)e=null;else{if(null==e&&this.swimlaneRequired)return null;if(null!=e&&null!=r){var l=this.graph.getView().getState(e);if(null!=l){if(t-=l.origin.x*s,a-=l.origin.y*s,this.graph.isConstrainedMoving){r=o.width;var d=o.height,c=l.x+l.width;c<t+r&&(t-=t+r-c),(c=l.y+l.height)<a+d&&(a-=a+d-c)}}else null!=r&&(t-=r.x*s,a-=r.y*s)}}(o=o.clone()).x=this.graph.snap(t/s-this.graph.getView().translate.x-this.graph.gridSize/2),o.y=this.graph.snap(a/s-this.graph.getView().translate.y-this.graph.gridSize/2),n.setGeometry(o),null==e&&(e=this.graph.getDefaultParent()),this.cycleAttribute(n),this.fireEvent(new mxEventObject(mxEvent.BEFORE_ADD_VERTEX,"vertex",n,"parent",e)),i.beginUpdate();try{null!=(n=this.graph.addCell(n,e))&&(this.graph.constrainChild(n),this.fireEvent(new mxEventObject(mxEvent.ADD_VERTEX,"vertex",n)))}finally{i.endUpdate()}return null!=n&&(this.graph.setSelectionCell(n),this.graph.scrollCellToVisible(n),this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,"vertex",n))),n},mxEditor.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tasks&&this.tasks.destroy(),null!=this.outline&&this.outline.destroy(),null!=this.properties&&this.properties.destroy(),null!=this.keyHandler&&this.keyHandler.destroy(),null!=this.rubberband&&this.rubberband.destroy(),null!=this.toolbar&&this.toolbar.destroy(),null!=this.graph&&this.graph.destroy(),this.templates=this.status=null)};var mxCodecRegistry={codecs:[],aliases:[],register:function(e){if(null!=e){var n=e.getName();mxCodecRegistry.codecs[n]=e;var t=mxUtils.getFunctionName(e.template.constructor);t!=n&&mxCodecRegistry.addAlias(t,n)}return e},addAlias:function(e,n){mxCodecRegistry.aliases[e]=n},getCodec:function(e){var n=null;if(null!=e){n=mxUtils.getFunctionName(e);var t=mxCodecRegistry.aliases[n];if(null!=t&&(n=t),null==(n=mxCodecRegistry.codecs[n]))try{n=new mxObjectCodec(new e),mxCodecRegistry.register(n)}catch(e){}}return n}};function mxCodec(e){this.document=e||mxUtils.createXmlDocument(),this.objects=[]}function mxObjectCodec(e,n,t,a){for(var i in this.template=e,this.exclude=null!=n?n:[],this.idrefs=null!=t?t:[],this.mapping=null!=a?a:[],this.reverse={},this.mapping)this.reverse[this.mapping[i]]=i}mxCodec.prototype.document=null,mxCodec.prototype.objects=null,mxCodec.prototype.encodeDefaults=!1,mxCodec.prototype.putObject=function(e,n){return this.objects[e]=n},mxCodec.prototype.getObject=function(e){var n=null;return null!=e&&(null==(n=this.objects[e])&&(null==(n=this.lookup(e))&&(null!=(e=this.getElementById(e))&&(n=this.decode(e))))),n},mxCodec.prototype.lookup=function(e){return null},mxCodec.prototype.getElementById=function(e,n){return mxUtils.findNodeByAttribute(this.document.documentElement,null!=n?n:"id",e)},mxCodec.prototype.getId=function(e){var n=null;return null!=e&&(null==(n=this.reference(e))&&e instanceof mxCell&&(null==(n=e.getId())&&(0==(n=mxCellPath.create(e)).length&&(n="root")))),n},mxCodec.prototype.reference=function(e){return null},mxCodec.prototype.encode=function(e){var n=null;if(null!=e&&null!=e.constructor){var t=mxCodecRegistry.getCodec(e.constructor);null!=t?n=t.encode(this,e):mxUtils.isNode(e)?n=mxClient.IS_IE?e.cloneNode(!0):this.document.importNode(e,!0):mxLog.warn("mxCodec.encode: No codec for "+mxUtils.getFunctionName(e.constructor))}return n},mxCodec.prototype.decode=function(a,b){var c=null;if(null!=a&&a.nodeType==mxConstants.NODETYPE_ELEMENT){var d=null;try{d=eval(a.nodeName)}catch(e){}try{var f=mxCodecRegistry.getCodec(d);null!=f?c=f.decode(this,a,b):(c=a.cloneNode(!0),c.removeAttribute("as"))}catch(e){mxLog.debug("Cannot decode "+a.nodeName+": "+e.message)}}return c},mxCodec.prototype.encodeCell=function(e,n,t){if(n.appendChild(this.encode(e)),null==t||t){t=e.getChildCount();for(var a=0;a<t;a++)this.encodeCell(e.getChildAt(a),n)}},mxCodec.prototype.isCellCodec=function(e){return null!=e&&"function"==typeof e.isCellCodec&&e.isCellCodec()},mxCodec.prototype.decodeCell=function(e,n){n=null==n||n;var t=null;if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){if(t=mxCodecRegistry.getCodec(e.nodeName),!this.isCellCodec(t))for(var a=e.firstChild;null!=a&&!this.isCellCodec(t);)t=mxCodecRegistry.getCodec(a.nodeName),a=a.nextSibling;this.isCellCodec(t)||(t=mxCodecRegistry.getCodec(mxCell)),t=t.decode(this,e),n&&this.insertIntoGraph(t)}return t},mxCodec.prototype.insertIntoGraph=function(e){var n=e.parent,t=e.getTerminal(!0),a=e.getTerminal(!1);e.setTerminal(null,!1),e.setTerminal(null,!0),(e.parent=null)!=n&&n.insert(e),null!=t&&t.insertEdge(e,!0),null!=a&&a.insertEdge(e,!1)},mxCodec.prototype.setAttribute=function(e,n,t){null!=n&&null!=t&&e.setAttribute(n,t)},mxObjectCodec.prototype.template=null,mxObjectCodec.prototype.exclude=null,mxObjectCodec.prototype.idrefs=null,mxObjectCodec.prototype.mapping=null,mxObjectCodec.prototype.reverse=null,mxObjectCodec.prototype.getName=function(){return mxUtils.getFunctionName(this.template.constructor)},mxObjectCodec.prototype.cloneTemplate=function(){return new this.template.constructor},mxObjectCodec.prototype.getFieldName=function(e){if(null!=e){var n=this.reverse[e];null!=n&&(e=n)}return e},mxObjectCodec.prototype.getAttributeName=function(e){if(null!=e){var n=this.mapping[e];null!=n&&(e=n)}return e},mxObjectCodec.prototype.isExcluded=function(e,n,t,a){return n==mxObjectIdentity.FIELD_NAME||0<=mxUtils.indexOf(this.exclude,n)},mxObjectCodec.prototype.isReference=function(e,n,t,a){return 0<=mxUtils.indexOf(this.idrefs,n)},mxObjectCodec.prototype.encode=function(e,n){var t=e.document.createElement(this.getName());return n=this.beforeEncode(e,n,t),this.encodeObject(e,n,t),this.afterEncode(e,n,t)},mxObjectCodec.prototype.encodeObject=function(e,n,t){for(var a in e.setAttribute(t,"id",e.getId(n)),n){var i=a,s=n[i];null!=s&&!this.isExcluded(n,i,s,!0)&&(mxUtils.isNumeric(i)&&(i=null),this.encodeValue(e,n,i,s,t))}},mxObjectCodec.prototype.encodeValue=function(e,n,t,a,i){if(null!=a){if(this.isReference(n,t,a,!0)){var s=e.getId(a);if(null==s)return void mxLog.warn("mxObjectCodec.encode: No ID for "+this.getName()+"."+t+"="+a);a=s}s=this.template[t],(null==t||e.encodeDefaults||s!=a)&&(t=this.getAttributeName(t),this.writeAttribute(e,n,t,a,i))}},mxObjectCodec.prototype.writeAttribute=function(e,n,t,a,i){"object"!=typeof a?this.writePrimitiveAttribute(e,n,t,a,i):this.writeComplexAttribute(e,n,t,a,i)},mxObjectCodec.prototype.writePrimitiveAttribute=function(e,n,t,a,i){a=this.convertValueToXml(a),null==t?(n=e.document.createElement("add"),"function"==typeof a?n.appendChild(e.document.createTextNode(a)):e.setAttribute(n,"value",a),i.appendChild(n)):"function"!=typeof a&&e.setAttribute(i,t,a)},mxObjectCodec.prototype.writeComplexAttribute=function(e,n,t,a,i){null!=(e=e.encode(a))?(null!=t&&e.setAttribute("as",t),i.appendChild(e)):mxLog.warn("mxObjectCodec.encode: No node for "+this.getName()+"."+t+": "+a)},mxObjectCodec.prototype.convertValueToXml=function(e){return void 0!==e.length||1!=e&&0!=e||(e=1==e?"1":"0"),e},mxObjectCodec.prototype.convertValueFromXml=function(e){return mxUtils.isNumeric(e)&&(e=parseFloat(e)),e},mxObjectCodec.prototype.beforeEncode=function(e,n,t){return n},mxObjectCodec.prototype.afterEncode=function(e,n,t){return t},mxObjectCodec.prototype.decode=function(e,n,t){var a=n.getAttribute("id"),i=e.objects[a];return null==i&&(i=t||this.cloneTemplate(),null!=a&&e.putObject(a,i)),n=this.beforeDecode(e,n,i),this.decodeNode(e,n,i),this.afterDecode(e,n,i)},mxObjectCodec.prototype.decodeNode=function(e,n,t){null!=n&&(this.decodeAttributes(e,n,t),this.decodeChildren(e,n,t))},mxObjectCodec.prototype.decodeAttributes=function(e,n,t){if(null!=(n=n.attributes))for(var a=0;a<n.length;a++)this.decodeAttribute(e,n[a],t)},mxObjectCodec.prototype.decodeAttribute=function(e,n,t){var a=n.nodeName;if("as"!=a&&"id"!=a){n="value"==a?n.nodeValue:this.convertValueFromXml(n.nodeValue);var i=this.getFieldName(a);if(this.isReference(t,i,n,!1)){if(null==(e=e.getObject(n)))return void mxLog.warn("mxObjectCodec.decode: No object for "+this.getName()+"."+a+"="+n);n=e}this.isExcluded(t,a,n,!1)||(t[a]=n)}},mxObjectCodec.prototype.decodeChildren=function(e,n,t){for(n=n.firstChild;null!=n;){var a=n.nextSibling;n.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,n,t)&&this.decodeChild(e,n,t),n=a}},mxObjectCodec.prototype.decodeChild=function(e,n,t){var a=this.getFieldName(n.getAttribute("as"));if(null==a||!this.isExcluded(t,a,n,!1)){var i=this.getFieldTemplate(t,a,n),s=null;"add"==n.nodeName?null==(s=n.getAttribute("value"))&&(s=mxUtils.eval(mxUtils.getTextContent(n))):s=e.decode(n,i),this.addObjectValue(t,a,s,i)}},mxObjectCodec.prototype.getFieldTemplate=function(e,n,t){return(e=e[n])instanceof Array&&0<e.length&&(e=null),e},mxObjectCodec.prototype.addObjectValue=function(e,n,t,a){null!=t&&t!=a&&(null!=n&&0<n.length?e[n]=t:e.push(t))},mxObjectCodec.prototype.processInclude=function(e,n,t){if("include"!=n.nodeName)return!1;if(null!=(n=n.getAttribute("name")))try{var a=mxUtils.load(n).getDocumentElement();null!=a&&e.decode(a,t)}catch(e){}return!0},mxObjectCodec.prototype.beforeDecode=function(e,n,t){return n},mxObjectCodec.prototype.afterDecode=function(e,n,t){return t},mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxCell,["children","edges","overlays","mxTransient"],["parent","source","target"]);return e.isCellCodec=function(){return!0},e.isExcluded=function(e,n,t,a){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||a&&"value"==n&&t.nodeType==mxConstants.NODETYPE_ELEMENT},e.afterEncode=function(e,n,t){if(null!=n.value&&n.value.nodeType==mxConstants.NODETYPE_ELEMENT){var a=t;(t=mxClient.IS_IE?n.value.cloneNode(!0):e.document.importNode(n.value,!0)).appendChild(a),e=a.getAttribute("id"),t.setAttribute("id",e),a.removeAttribute("id")}return t},e.beforeDecode=function(e,n,t){var a=n,i=this.getName();if(n.nodeName!=i?(null!=(a=n.getElementsByTagName(i)[0])&&a.parentNode==n?(mxUtils.removeWhitespace(a,!0),mxUtils.removeWhitespace(a,!1),a.parentNode.removeChild(a)):a=null,t.value=n.cloneNode(!0),null!=(n=t.value.getAttribute("id"))&&(t.setId(n),t.value.removeAttribute("id"))):t.setId(n.getAttribute("id")),null!=a)for(n=0;n<this.idrefs.length;n++){i=this.idrefs[n];var s=a.getAttribute(i);if(null!=s){a.removeAttribute(i);var o=e.objects[s]||e.lookup(s);null==o&&(null!=(s=e.getElementById(s))&&(o=(mxCodecRegistry.codecs[s.nodeName]||this).decode(e,s))),t[i]=o}}return a},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphModel);return e.encodeObject=function(e,n,t){var a=e.document.createElement("root");e.encodeCell(n.getRoot(),a),t.appendChild(a)},e.decodeChild=function(e,n,t){"root"==n.nodeName?this.decodeRoot(e,n,t):mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeRoot=function(e,n,t){var a=null;for(n=n.firstChild;null!=n;){var i=e.decodeCell(n);null!=i&&null==i.getParent()&&(a=i),n=n.nextSibling}null!=a&&t.setRoot(a)},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxRootChange,["model","previous","root"]);return e.afterEncode=function(e,n,t){return e.encodeCell(n.root,t),t},e.beforeDecode=function(e,n,t){if(null!=n.firstChild&&n.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(n=n.cloneNode(!0)).firstChild;for(t.root=e.decodeCell(a,!1),t=a.nextSibling,a.parentNode.removeChild(a),a=t;null!=a;)t=a.nextSibling,e.decodeCell(a),a.parentNode.removeChild(a),a=t}return n},e.afterDecode=function(e,n,t){return t.previous=t.root,t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxChildChange,["model","child","previousIndex"],["parent","previous"]);return e.isReference=function(e,n,t,a){return!("child"!=n||null==e.previous&&a)||0<=mxUtils.indexOf(this.idrefs,n)},e.afterEncode=function(e,n,t){return this.isReference(n,"child",n.child,!0)?t.setAttribute("child",e.getId(n.child)):e.encodeCell(n.child,t),t},e.beforeDecode=function(e,n,t){if(null!=n.firstChild&&n.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(n=n.cloneNode(!0)).firstChild;for(t.child=e.decodeCell(a,!1),t=a.nextSibling,a.parentNode.removeChild(a),a=t;null!=a;){if(t=a.nextSibling,a.nodeType==mxConstants.NODETYPE_ELEMENT){var i=a.getAttribute("id");null==e.lookup(i)&&e.decodeCell(a)}a.parentNode.removeChild(a),a=t}}else a=n.getAttribute("child"),t.child=e.getObject(a);return n},e.afterDecode=function(e,n,t){return t.child.parent=t.previous,t.previous=t.parent,t.previousIndex=t.index,t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxTerminalChange,["model","previous"],["cell","terminal"]);return e.afterDecode=function(e,n,t){return t.previous=t.terminal,t},e}());var mxGenericChangeCodec=function(e,a){var n=new mxObjectCodec(e,["model","previous"],["cell"]);return n.afterDecode=function(e,n,t){return mxUtils.isNode(t.cell)&&(t.cell=e.decodeCell(t.cell,!1)),t.previous=t[a],t},n};mxCodecRegistry.register(mxGenericChangeCodec(new mxValueChange,"value")),mxCodecRegistry.register(mxGenericChangeCodec(new mxStyleChange,"style")),mxCodecRegistry.register(mxGenericChangeCodec(new mxGeometryChange,"geometry")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCollapseChange,"collapsed")),mxCodecRegistry.register(mxGenericChangeCodec(new mxVisibleChange,"visible")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCellAttributeChange,"value")),mxCodecRegistry.register(new mxObjectCodec(new mxGraph,"graphListeners eventListeners view container cellRenderer editor selection".split(" "))),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphView);return e.encode=function(e,n){return this.encodeCell(e,n,n.graph.getModel().getRoot())},e.encodeCell=function(e,n,t){var a=n.graph.getModel(),i=n.getState(t),s=a.getParent(t);if(null==s||null!=i){var o=a.getChildCount(t),r=n.graph.getCellGeometry(t),l=null;if(s==a.getRoot()?l="layer":null==s?l="graph":a.isEdge(t)?l="edge":0<o&&null!=r?l="group":a.isVertex(t)&&(l="vertex"),null!=l){var d=e.document.createElement(l);if(null!=n.graph.getLabel(t)&&(d.setAttribute("label",n.graph.getLabel(t)),n.graph.isHtmlLabel(t)&&d.setAttribute("html",!0)),null==s){var c=n.getGraphBounds();null!=c&&(d.setAttribute("x",Math.round(c.x)),d.setAttribute("y",Math.round(c.y)),d.setAttribute("width",Math.round(c.width)),d.setAttribute("height",Math.round(c.height))),d.setAttribute("scale",n.scale)}else if(null!=i&&null!=r){for(c in i.style)"function"==typeof(s=i.style[c])&&"object"==typeof s&&(s=mxStyleRegistry.getName(s)),null!=s&&"function"!=typeof s&&"object"!=typeof s&&d.setAttribute(c,s);if(null!=(s=i.absolutePoints)&&0<s.length){for(r=Math.round(s[0].x)+","+Math.round(s[0].y),c=1;c<s.length;c++)r+=" "+Math.round(s[c].x)+","+Math.round(s[c].y);d.setAttribute("points",r)}else d.setAttribute("x",Math.round(i.x)),d.setAttribute("y",Math.round(i.y)),d.setAttribute("width",Math.round(i.width)),d.setAttribute("height",Math.round(i.height));null!=(c=i.absoluteOffset)&&(0!=c.x&&d.setAttribute("dx",Math.round(c.x)),0!=c.y&&d.setAttribute("dy",Math.round(c.y)))}for(c=0;c<o;c++)null!=(i=this.encodeCell(e,n,a.getChildAt(t,c)))&&d.appendChild(i)}}return d},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxStylesheet);return e.encode=function(e,n){var t,a=e.document.createElement(this.getName());for(t in n.styles){var i=n.styles[t],s=e.document.createElement("add");if(null!=t){for(var o in s.setAttribute("as",t),i){var r=this.getStringValue(o,i[o]);if(null!=r){var l=e.document.createElement("add");l.setAttribute("value",r),l.setAttribute("as",o),s.appendChild(l)}}0<s.childNodes.length&&a.appendChild(s)}}return a},e.getStringValue=function(e,n){var t=typeof n;return"function"==t?n=mxStyleRegistry.getName(style[j]):"object"==t&&(n=null),n},e.decode=function(e,n,t){t=t||new this.template.constructor;var a=n.getAttribute("id");for(null!=a&&(e.objects[a]=t),n=n.firstChild;null!=n;){if(!this.processInclude(e,n,t)&&"add"==n.nodeName&&null!=(a=n.getAttribute("as"))){var i=n.getAttribute("extend"),s=null!=i?mxUtils.clone(t.styles[i]):null;for(null==s&&(null!=i&&mxLog.warn("mxStylesheetCodec.decode: stylesheet "+i+" not found to extend"),s={}),i=n.firstChild;null!=i;){if(i.nodeType==mxConstants.NODETYPE_ELEMENT){var o=i.getAttribute("as");if("add"==i.nodeName){var r=mxUtils.getTextContent(i),l=null;null!=r&&0<r.length?l=mxUtils.eval(r):(l=i.getAttribute("value"),mxUtils.isNumeric(l)&&(l=parseFloat(l))),null!=l&&(s[o]=l)}else"remove"==i.nodeName&&delete s[o]}i=i.nextSibling}t.putCellStyle(a,s)}n=n.nextSibling}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultKeyHandler);return e.encode=function(e,n){return null},e.decode=function(e,n,t){if(null!=t)for(n=n.firstChild;null!=n;){if(!this.processInclude(e,n,t)&&"add"==n.nodeName){var a=n.getAttribute("as"),i=n.getAttribute("action"),s=n.getAttribute("control");t.bindAction(a,i,s)}n=n.nextSibling}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultToolbar);return e.encode=function(e,n){return null},e.decode=function(e,n,t){if(null!=t){var a=t.editor;for(n=n.firstChild;null!=n;){if(n.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,n,t))if("separator"==n.nodeName)t.addSeparator();else if("br"==n.nodeName)t.toolbar.addBreak();else if("hr"==n.nodeName)t.toolbar.addLine();else if("add"==n.nodeName){var i=n.getAttribute("as"),s=(i=mxResources.get(i)||i,n.getAttribute("icon")),o=n.getAttribute("pressedIcon"),r=n.getAttribute("action"),l=n.getAttribute("mode"),d=n.getAttribute("template"),c="0"!=n.getAttribute("toggle"),m=mxUtils.getTextContent(n),u=null;if(null!=r)u=t.addItem(i,s,r,o);else if(null!=l){var p=mxUtils.eval(m);u=t.addMode(i,s,l,o,p)}else if(null!=d||null!=m&&0<m.length)u=a.templates[d],d=n.getAttribute("style"),null!=u&&null!=d&&(u=u.clone()).setStyle(d),(d=null)!=m&&0<m.length&&(d=mxUtils.eval(m)),u=t.addPrototype(i,s,u,o,d,c);else if(0<(o=mxUtils.getChildNodes(n)).length)if(null==s)for(d=t.addActionCombo(i),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?t.addOption(d,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),c=c.getAttribute("action"),t.addActionOption(d,s,c));else{var g=null,v=t.addPrototype(i,s,function(){if(null==(e=a.templates[g.value]))return mxLog.warn("Template "+e+" not found"),null;var e=e.clone(),n=g.options[g.selectedIndex].cellStyle;return null!=n&&e.setStyle(n),e},null,null,c);g=t.addCombo();for(mxEvent.addListener(g,"change",function(){t.toolbar.selectMode(v,function(e){return e=mxUtils.convertPoint(a.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a.addVertex(null,p(),e.x,e.y)}),t.toolbar.noReset=!1}),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?t.addOption(g,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),m=c.getAttribute("template"),t.addOption(g,s,m||d).cellStyle=c.getAttribute("style"))}null!=u&&(null!=(d=n.getAttribute("id"))&&0<d.length&&u.setAttribute("id",d))}n=n.nextSibling}}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultPopupMenu);return e.encode=function(e,n){return null},e.decode=function(e,n,t){var a=n.getElementsByTagName("include")[0];return null!=a?this.processInclude(e,a,t):null!=t&&(t.config=n),t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxEditor,"modified lastSnapshot ignoredChanges undoManager graphContainer toolbarContainer".split(" "));return e.afterDecode=function(e,n,t){return null!=(e=n.getAttribute("defaultEdge"))&&(n.removeAttribute("defaultEdge"),t.defaultEdge=t.templates[e]),null!=(e=n.getAttribute("defaultGroup"))&&(n.removeAttribute("defaultGroup"),t.defaultGroup=t.templates[e]),t},e.decodeChild=function(e,n,t){if("Array"==n.nodeName){if("templates"==n.getAttribute("as"))return void this.decodeTemplates(e,n,t)}else if("ui"==n.nodeName)return void this.decodeUi(e,n,t);mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeUi=function(e,n,t){for(e=n.firstChild;null!=e;){if("add"==e.nodeName){n=e.getAttribute("as");var a=e.getAttribute("element"),i=e.getAttribute("style"),s=null;if(null!=a)null!=(s=document.getElementById(a))&&null!=i&&(s.style.cssText+=";"+i);else{a=parseInt(e.getAttribute("x"));var o=parseInt(e.getAttribute("y")),r=e.getAttribute("width"),l=e.getAttribute("height");(s=document.createElement("div")).style.cssText=i,new mxWindow(mxResources.get(n)||n,s,a,o,r,l,!1,!0).setVisible(!0)}"graph"==n?t.setGraphContainer(s):"toolbar"==n?t.setToolbarContainer(s):"title"==n?t.setTitleContainer(s):"status"==n?t.setStatusContainer(s):"map"==n&&t.setMapContainer(s)}else"resource"==e.nodeName?mxResources.add(e.getAttribute("basename")):"stylesheet"==e.nodeName&&mxClient.link("stylesheet",e.getAttribute("name"));e=e.nextSibling}},e.decodeTemplates=function(e,n,t){null==t.templates&&(t.templates=[]),n=mxUtils.getChildNodes(n);for(var a=0;a<n.length;a++){for(var i=n[a].getAttribute("as"),s=n[a].firstChild;null!=s&&1!=s.nodeType;)s=s.nextSibling;null!=s&&(t.templates[i]=e.decodeCell(s))}},e}()),EditorUi=function(e,n,t){this.projectDesignController=e,this.editor=n||new Editor,this.container=t||document.body;var a=n.graph,i=this;CRUD_PERMISSIONS=this.projectDesignController.crudPermissions;var s=mxUtils.bind(this,function(e){return null==e&&(e=window.event),!!this.isEditingEnabled()&&a.isEditing()});this.container.style.overflow="hidden",(new Image).src=mxPopupMenu.prototype.submenuImage,null!=mxConnectionHandler.prototype.connectImage&&((new Image).src=mxConnectionHandler.prototype.connectImage.src),this.actions=new Actions(this),this.menus=new Menus(this),this.createDivs(),this.refresh(),this.createUi(),this.container==document.body&&(this.menubarContainer.onselectstart=s,this.menubarContainer.onmousedown=s,this.toolbarContainer.onselectstart=s,this.toolbarContainer.onmousedown=s,this.diagramContainer.onselectstart=s,this.diagramContainer.onmousedown=s,this.sidebarContainer.onselectstart=s,this.sidebarContainer.onmousedown=s,this.footerContainer.onselectstart=s,this.footerContainer.onmousedown=s),mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?(mxEvent.addListener(this.diagramContainer,"contextmenu",s),mxEvent.addListener(this.sidebarContainer,"contextmenu",s)):(this.diagramContainer.oncontextmenu=s,this.sidebarContainer.oncontextmenu=s),a.init(this.diagramContainer),a.refresh(),a.setEnabled(this.isEditingEnabled()),a.container.setAttribute("tabindex","0"),a.container.style.cursor="default",a.container.style.backgroundImage="url("+n.gridImage+")",a.container.style.backgroundPosition="-1px -1px",a.container.focus();var o=a.fireMouseEvent;a.fireMouseEvent=function(e,n,t){e==mxEvent.MOUSE_DOWN&&this.container.focus(),o.apply(this,arguments)},this.createMultiplicities(a.multiplicities,["start","finally","end"],[[1,1],[1,1],[0,0]],[[0,0],[0,0],[1,"n"]]),this.createMultiplicities(a.multiplicities,["answer","hangup","dial","ext_dial","queue","voicemail","callback"],[[1,1],[0,0],[0,1],[0,1],[0,1],[1,1],[0,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["login","pause","unpause","logout"],[[1,2],[1,2],[1,2],[1,2]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["set","math"],[[1,1],[1,1]],[[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["background","playback","menu","saydigits","saynumber","sayphonetic","google_cloud_tts","tts","ispeechtts","awspolly","getdigits","getsecretdigits","lumenvoxtts","sestektts","mrcpsynth"],[[1,"n"],[1,1],[1,"n"],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,"n"],[1,"n"],[1,1],[1,1],[1,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["record"],[[1,1]],[[1,"n"]]),this.createMultiplicities(a.multiplicities,["database","ispeechasr","sendSMS","sendMail","sendFax","googleasr","lumenvoxasr","tildeasr","dialogflow","dialogflowV2","awslex","sesteknda","sestekasr","restapi","mrcprecog"],[[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["gotoc","gotoif","gotoiftime","vswitch"],[[0,0],[1,2],[1,2],[1,"n"]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["queuelog","goal"],[[1,1],[1,1]],[[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["noop","system","agi","subproject","custom_app"],[[1,1],[1,1],[0,1],[0,1],[0,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),a.dblClick=function(e,t){var n=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",t);this.fireEvent(n),mxEvent.isConsumed(e)||n.isConsumed()||(this.getModel().isEdge(t)?0<=["background","gotoif","gotoiftime","menu","getdigits","getsecretdigits","vswitch","login","pause","unpause","logout"].indexOf(t.source.value.tagName)&&this.startEditingAtCell(t):this.getModel().isVertex(t)&&i.projectDesignController.openDialog(t.getValue(),function(e){for(var n=0;n<e.length;n+=1)t.setAttribute(e[n].name,e[n].value);a.refresh(t)}),n.consume())},a.panningHandler.autoExpand=!0,a.panningHandler.factoryMethod=mxUtils.bind(this,function(e,n,t){this.isEditingEnabled()&&this.menus.createPopupMenu(e,n,t)}),n.outline.init(this.outlineContainer),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){a.panningHandler.hideMenu()})),mxClient.IS_TOUCH&&(mxEvent.addListener(a.container,"gesturechange",mxUtils.bind(this,function(e){a.view.getDrawPane().setAttribute("transform","scale("+e.scale+")"),a.view.getOverlayPane().style.visibility="hidden"})),mxEvent.addListener(a.container,"gestureend",mxUtils.bind(this,function(e){a.view.getDrawPane().removeAttribute("transform"),a.zoomToCenter=!0,a.zoom(e.scale),a.view.getOverlayPane().style.visibility="visible"})));var r=this.isEditingEnabled()?this.createKeyHandler(n):null;this.getKeyHandler=function(){return r},mxEvent.addListener(window,"resize",mxUtils.bind(this,function(){this.refresh(),a.sizeDidChange(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()})),this.init(),this.open(),this.refresh()},EditorUi.prototype.splitSize=mxClient.IS_TOUCH?16:8,EditorUi.prototype.menubarHeight=33,EditorUi.prototype.toolbarHeight=36,EditorUi.prototype.footerHeight=0,EditorUi.prototype.hsplitPosition=204,EditorUi.prototype.vsplitPosition=190,EditorUi.prototype.init=function(){this.addUndoListener(),this.addSelectionListener();var e=this.actions.get("paste"),n=function(){e.setEnabled(!mxClipboard.isEmpty())},t=mxClipboard.cut;mxClipboard.cut=function(){t.apply(this,arguments),n()};var a=mxClipboard.copy;mxClipboard.copy=function(){a.apply(this,arguments),n()}},EditorUi.prototype.isEditingEnabled=function(){return!!CRUD_PERMISSIONS.canEdit},EditorUi.prototype.exportXML=function(e){var n=window.document.createElement("a");n.href="data:attachment/text;charset=utf-8,"+encodeURIComponent(e),n.download=this.editor.filename+".xml",n.target="_self",n.click()},EditorUi.prototype.open=function(){try{null!=window.opener&&null!=window.opener.openFile&&window.opener.openFile.setConsumer(mxUtils.bind(this,function(e,n){try{var t=mxUtils.parseXml(e);this.editor.setGraphXml(t.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=n&&(this.editor.filename=n)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}}))}catch(e){}},EditorUi.prototype.openString=function(e,n,t){try{var a=mxUtils.parseXml(e);this.editor.setGraphXml(a.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=n&&(this.editor.filename=n),null!=t&&(this.editor.data=t)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}},EditorUi.prototype.validate=function(e,n){for(var t=this.editor.graph,a=(e=null!=e?e:t.model.getRoot(),n=null!=n?n:{},!0),i=t.model.getChildCount(e),s=0;s<i;s++){var o=t.model.getChildAt(e,s),r=n;t.isValidRoot(o)&&(r={}),null!=(r=this.validate(o,r))?t.setCellWarning(o,r.replace(/\n/g,"<br>")):t.setCellWarning(o,null),a=a&&null==r}if(i="",t.model.isVertex(e))switch(e.value.nodeName){case"start":i=this.validateBlock("start")?"":"Only one Start block is allowed\n";break;case"finally":i=this.validateBlock("finally")?"":"Only one Finally block is allowed\n";break;case"playback":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n";break;case"answer":i=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"menu":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("digit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("response")?"":mxResources.get("invalidTimeout")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"getdigits":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n",i+=0<e.value.getAttribute("mindigit")?"":mxResources.get("wrongMinDigit")+"\n",i+=0<e.value.getAttribute("maxdigit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"getsecretdigits":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n",i+=0<e.value.getAttribute("mindigit")?"":mxResources.get("wrongMinDigit")+"\n",i+=0<e.value.getAttribute("maxdigit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("hiddendigitsnum")?"":mxResources.get("wrongHiddenDigitsnum")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"vswitch":i=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n";break;case"database":i=0<e.value.getAttribute("odbc_id")?"":mxResources.get("noDatabaseSelected")+"\n",i+=""!==e.value.getAttribute("query")?"":mxResources.get("missingQuery")+"\n";break;case"set":case"math":i=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n";break;case"gotoc":i=""!==e.value.getAttribute("context")?"":mxResources.get("noContextSelected")+"\n",i+=""!==e.value.getAttribute("extension")?"":mxResources.get("noExtensionSelected")+"\n",i+=1<=e.value.getAttribute("priority")?"":mxResources.get("invalidPriority")+"\n";break;case"system":case"agi":i=""!==e.value.getAttribute("command")?"":mxResources.get("noCommandSelected")+"\n";break;case"gotoif":i=""!==e.value.getAttribute("condition")?"":mxResources.get("noConditionSelected")+"\n";break;case"saydigits":i=""!==e.value.getAttribute("digits")?"":mxResources.get("noDigitsSelected")+"\n";break;case"saynumber":i=""!==e.value.getAttribute("number")?"":mxResources.get("noNumberSelected")+"\n";break;case"sayphonetic":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"record":i=""!==e.value.getAttribute("file")?"":mxResources.get("noFileSelected")+"\n",i+=-1<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"goal":i=""!==e.value.getAttribute("goalname")?"":mxResources.get("noGoalSelected")+"\n";break;case"ext_dial":i=""!==e.value.getAttribute("trunk_name")?"":mxResources.get("noTrunkSelected")+"\n",i+=""!==e.value.getAttribute("phone")?"":mxResources.get("noIdentifierSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"dial":i=0<e.value.getAttribute("sip_id")?"":mxResources.get("noIdentifierSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"queue":i="-1"!==e.value.getAttribute("queue_id")?"":mxResources.get("noQueueSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"callback":i="-1"!==e.value.getAttribute("list_id")?"":mxResources.get("noListSelected")+"\n",i+=""!==e.value.getAttribute("name")?"":mxResources.get("noFirstNameSelected")+"\n",i+=""!==e.value.getAttribute("phone")?"":mxResources.get("noPhoneSelected")+"\n",i+=""!==e.value.getAttribute("delay")?"":mxResources.get("invalidDelay")+"\n";break;case"gotoiftime":i=0<e.value.getAttribute("interval_id")?"":mxResources.get("noIntervalSelected")+"\n";break;case"voicemail":i=""!==e.value.getAttribute("mailbox")?"":mxResources.get("noBoxNumberSelected")+"\n";break;case"subproject":i=0<e.value.getAttribute("project_id")?"":mxResources.get("noProjectSelected")+"\n";break;case"sendSMS":i=0<e.value.getAttribute("sms_account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n",i+=""!==e.value.getAttribute("sms_text")?"":mxResources.get("noTextSelected")+"\n";break;case"sendMail":i=0<e.value.getAttribute("account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n";break;case"sendFax":i=0<e.value.getAttribute("account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n",i+=""!==e.value.getAttribute("attachment_path")?"":mxResources.get("noAttachmentSelected")+"\n";break;case"google_cloud_tts":i=""!==e.value.getAttribute("apiKey")?"":mxResources.get("noApiKeySelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"tts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"awspolly":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("aws_access_key_id")?"":mxResources.get("noAccessKeySelected")+"\n",i+=""!==e.value.getAttribute("aws_secret_access_key")?"":mxResources.get("noSecretAccessKeySelected")+"\n";break;case"awslex":i=""!==e.value.getAttribute("aws_bot_name")?"":mxResources.get("noNameSelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("aws_access_key_id")?"":mxResources.get("noAccessKeySelected")+"\n",i+=""!==e.value.getAttribute("aws_secret_access_key")?"":mxResources.get("noSecretAccessKeySelected")+"\n";break;case"ispeechtts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=-10<=e.value.getAttribute("speed")&&e.value.getAttribute("speed")<=10?"":mxResources.get("invalidSpeed")+"\n";break;case"lumenvoxtts":case"sestektts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"lumenvoxasr":case"sestekasr":i=""!==e.value.getAttribute("grammar")?"":mxResources.get("noGrammarSelected")+"\n";break;case"ispeechasr":case"googleasr":i=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=-1<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"tildeasr":i=""!==e.value.getAttribute("appid")?"":mxResources.get("noAppIdInserted")+"\n",i+=""!==e.value.getAttribute("appsecret")?"":mxResources.get("noAppSecretInserted")+"\n",i+=""!==e.value.getAttribute("uri")?"":mxResources.get("noUrlInserted")+"\n";break;case"custom_app":i=""!==e.value.getAttribute("application")?"":mxResources.get("noApplicationSelected")+"\n";break;case"login":case"pause":case"unpause":case"logout":i=""!==e.value.getAttribute("findBy")?"":mxResources.get("noFindBySelected")+"\n";break;case"sesteknda":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("ndauth_url")?"":mxResources.get("noUrlInserted")+"\n",i+=""!==e.value.getAttribute("ndassistant_url")?"":mxResources.get("noUrlInserted")+"\n",i+=""!==e.value.getAttribute("username")?"":mxResources.get("noUsernameSelected")+"\n",i+=""!==e.value.getAttribute("password")?"":mxResources.get("noPasswordSelected")+"\n";break;case"restapi":i=""!==e.value.getAttribute("url")?"":mxResources.get("noUrlSelected")+"\n",i+=""!==e.value.getAttribute("method")?"":mxResources.get("noMethodSelected")+"\n";case"mrcpsynth":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"mrcprecog":i=""!==e.value.getAttribute("grammar")?"":mxResources.get("noGrammarSelected")+"\n";break;case"dialogflow":i=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("dialogflow_language")?"":mxResources.get("noDialogflowLanguageSelected")+"\n";break;case"dialogflowV2":i=""!==e.value.getAttribute("dialogflowV2_project_id")?"":mxResources.get("noDialogflowProjectSelected")+"\n",i+=""!==e.value.getAttribute("client_email")?"":mxResources.get("noClientEmailSelected")+"\n",i+=""!==e.value.getAttribute("private_key")?"":mxResources.get("noPrivateKeySelected")+"\n",i+=""!==e.value.getAttribute("dialogflowV2_language")?"":mxResources.get("noDialogflowLanguageSelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n"}if(t.model.isEdge(e))switch(t.model.getCell(e.source.getId()).value.nodeName){case"background":case"menu":if(void 0!==e.getValue()){var l=/^[0-9]+$|^[-]{1}$|^[i]{1}$|^[t]{1}$|^[*]{1}$|^[#]{1}$/;String(e.getValue()).split(",").forEach(function(e){i+=l.test(e)?"":mxResources.get("numberOrAll")+"\n"})}else i=i+mxResources.get("numberOrAll")+"\n";break;case"getsecretdigits":case"getdigits":if(void 0!==e.getValue())i+=(l=/^(x|i|-)$/).test(String(e.getValue()))?"":mxResources.get("numberOrInvalidOrDefault")+"\n";else i=i+mxResources.get("numberOrInvalidOrDefault")+"\n";break;case"gotoif":case"gotoiftime":if(void 0!==e.getValue())i+=(l=/^(true){1}$|^(false){1}$/).test(String(e.getValue()))?"":mxResources.get("trueOrFalse")+"\n";else i=i+mxResources.get("trueOrFalse")+"\n";break;case"login":case"pause":case"unpause":case"logout":if(void 0!==e.getValue())i+=(l=/^(success){1}$|^(failure){1}$/).test(String(e.getValue()))?"":mxResources.get("successOrFailure")+"\n";else i=i+mxResources.get("successOrFailure")+"\n"}return t.isCellCollapsed(e)&&!a&&(i+=(mxResources.get(t.containsValidationErrorsResource)||t.containsValidationErrorsResource)+"\n"),i=t.model.isEdge(e)?i+(t.getEdgeValidationError(e,t.model.getTerminal(e,!0),t.model.getTerminal(e,!1))||""):i+(t.getCellValidationError(e)||""),null!=(s=t.validateCell(e,n))&&(i+=s),null==t.model.getParent(e)&&t.view.validate(),0<i.length||!a?i:null},EditorUi.prototype.validateBlock=function(n){var t=this.editor.graph,e=t.getDefaultParent(),a=0;return e.children.forEach(function(e){t.model.isVertex(e)&&e.value.nodeName==n&&a++}),!(1<a)},EditorUi.prototype.getUrl=function(e){var n=null!=e?e:window.location.pathname,t=0<n.indexOf("?")?1:0;for(var a in urlParams)n+=0==t?"?":"&",n+=a+"="+urlParams[a],t++;return n},EditorUi.prototype.addUndoListener=function(){var e=this.actions.get("undo"),n=this.actions.get("redo"),t=this.editor.undoManager,a=function(){e.setEnabled(t.canUndo()),n.setEnabled(t.canRedo())};t.addListener(mxEvent.ADD,a),t.addListener(mxEvent.UNDO,a),t.addListener(mxEvent.REDO,a),t.addListener(mxEvent.CLEAR,a),a()},EditorUi.prototype.addSelectionListener=function(){var e=mxUtils.bind(this,function(){var e=this.editor.graph,n=!e.isSelectionEmpty(),t=!1,a=!1,i=e.getSelectionCells();if(null!=i)for(var s=0;s<i.length;s++){var o=i[s];if(e.getModel().isEdge(o)&&(a=!0),e.getModel().isVertex(o)&&(t=!0),a&&t)break}var r=["cut","copy","delete","duplicate","bold","italic","style","underline","toFront","toBack","dashed","rounded","shadow","tilt","autosize"];for(s=0;s<r.length;s++)this.actions.get(r[s]).setEnabled(n);this.actions.get("curved").setEnabled(a),this.actions.get("rotation").setEnabled(t),this.actions.get("wordWrap").setEnabled(t),this.actions.get("group").setEnabled(1<e.getSelectionCount()),this.actions.get("ungroup").setEnabled(1==e.getSelectionCount()&&0<e.getModel().getChildCount(e.getSelectionCell()));var l=t&&1==e.getSelectionCount();this.actions.get("removeFromGroup").setEnabled(l&&e.getModel().isVertex(e.getModel().getParent(e.getSelectionCell())));var d=["fontFamily","fontSize","alignment","position","text","format","arrange","linewidth","spacing"];for(s=0;s<d.length;s++)this.menus.get(d[s]).setEnabled(n);d=["line","lineend","linestart"];for(s=0;s<d.length;s++)this.menus.get(d[s]).setEnabled(a);this.actions.get("setAsDefaultEdge").setEnabled(a),this.menus.get("align").setEnabled(1<e.getSelectionCount()),this.menus.get("direction").setEnabled(t||a&&e.isLoop(e.view.getState(e.getSelectionCell()))),this.menus.get("navigation").setEnabled(e.foldingEnabled&&(null!=e.view.currentRoot||1==e.getSelectionCount()&&e.isValidRoot(e.getSelectionCell()))),this.actions.get("home").setEnabled(null!=e.view.currentRoot),this.actions.get("exitGroup").setEnabled(null!=e.view.currentRoot);var c=1==e.getSelectionCount()&&e.isValidRoot(e.getSelectionCell());this.actions.get("enterGroup").setEnabled(c),this.actions.get("expand").setEnabled(c),this.actions.get("collapse").setEnabled(c),this.actions.get("editLink").setEnabled(1==e.getSelectionCount()),this.actions.get("openLink").setEnabled(1==e.getSelectionCount()&&null!=e.getLinkForCell(e.getSelectionCell()))});this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},EditorUi.prototype.refresh=function(){var e=mxClient.IS_IE&&(null==document.documentMode||5==document.documentMode),n=this.container.clientWidth+390,t=this.container.clientHeight+190;this.container==document.body&&(n=document.body.clientWidth||document.documentElement.clientWidth,t=e&&document.body.clientHeight||document.documentElement.clientHeight);var a=Math.max(0,Math.min(this.hsplitPosition,n-this.splitSize-20)),i=Math.max(0,Math.min(this.vsplitPosition,t-this.menubarHeight-this.toolbarHeight-this.splitSize-1));this.menubarContainer.style.height=this.menubarHeight+"px",this.toolbarContainer.style.top=this.menubarHeight+"px",this.toolbarContainer.style.height=this.toolbarHeight+"px";var s=this.menubarHeight+this.toolbarHeight;if(mxClient.IS_QUIRKS||(s+=1),this.sidebarContainer.style.top=s+"px",this.sidebarContainer.style.width=a+"px",this.outlineContainer.style.width=a+"px",this.outlineContainer.style.height=i+"px",this.diagramContainer.style.left=this.isEditingEnabled()?a+this.splitSize+"px":"0px",this.diagramContainer.style.top=this.sidebarContainer.style.top,this.hsplit.style.top=this.sidebarContainer.style.top,this.hsplit.style.bottom=this.outlineContainer.style.bottom,this.hsplit.style.left=a+"px",this.vsplit.style.width=this.sidebarContainer.style.width,this.vsplit.style.bottom=i+this.footerHeight+"px",e){this.menubarContainer.style.width=n+"px",this.toolbarContainer.style.width=this.menubarContainer.style.width;var o=t-i-this.splitSize-this.menubarHeight-this.toolbarHeight;this.sidebarContainer.style.height=o+"px",this.diagramContainer.style.width=n-a-this.splitSize+"px";var r=t-this.menubarHeight-this.toolbarHeight;this.diagramContainer.style.height=r+"px",this.hsplit.style.height=r+"px"}else this.sidebarContainer.style.bottom=i+this.splitSize+"px",this.diagramContainer.style.bottom=this.outlineContainer.style.bottom},EditorUi.prototype.createDivs=function(){this.menubarContainer=this.createDiv("geMenubarContainer"),this.toolbarContainer=this.createDiv("geToolbarContainer"),this.sidebarContainer=this.createDiv("geSidebarContainer"),this.outlineContainer=this.createDiv("geOutlineContainer"),this.diagramContainer=this.createDiv("geDiagramContainer"),this.footerContainer=this.createDiv("geFooterContainer"),this.hsplit=this.createDiv("geHsplit"),this.vsplit=this.createDiv("geVsplit"),this.menubarContainer.style.top="0px",this.menubarContainer.style.left="0px",this.menubarContainer.style.right="0px",this.toolbarContainer.style.left="0px",this.toolbarContainer.style.right="0px",this.sidebarContainer.style.left="0px",this.outlineContainer.style.bottom="0px",this.outlineContainer.style.left="0px",this.diagramContainer.style.overflow="scroll",this.diagramContainer.style.right="0px",this.footerContainer.style.left="0px",this.footerContainer.style.right="0px",this.footerContainer.style.bottom="0px",this.vsplit.style.left="0px",this.vsplit.style.height=this.splitSize+"px",this.hsplit.style.width=this.splitSize+"px"},EditorUi.prototype.createUi=function(){this.menubar=this.menus.createMenubar(this.createDiv("geMenubar")),this.menubarContainer.appendChild(this.menubar.container),this.toolbar=this.createToolbar(this.createDiv("geToolbar")),this.toolbarContainer.appendChild(this.toolbar.container),this.sidebar=this.createSidebar(this.sidebarContainer),this.footerContainer.appendChild(this.createFooter()),this.statusContainer=this.createStatusContainer(),this.editor.addListener("statusChanged",mxUtils.bind(this,function(){this.setStatusText(this.editor.getStatus())})),this.setStatusText(this.editor.getStatus()),this.menubar.container.appendChild(this.statusContainer),this.isEditingEnabled()&&(this.container.appendChild(this.sidebarContainer),this.container.appendChild(this.hsplit),this.container.appendChild(this.vsplit)),this.container.appendChild(this.diagramContainer),this.container.appendChild(this.menubarContainer),this.container.appendChild(this.toolbarContainer),this.container.appendChild(this.outlineContainer),this.container.appendChild(this.footerContainer),this.addSplitHandler(this.hsplit,!0,0,mxUtils.bind(this,function(e){this.hsplitPosition=e,this.refresh(),this.editor.graph.sizeDidChange(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()})),this.addSplitHandler(this.vsplit,!1,this.footerHeight,mxUtils.bind(this,function(e){this.vsplitPosition=e,this.refresh(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()}))},EditorUi.prototype.createStatusContainer=function(){var e=document.createElement("a");return e.className="geItem geStatus",e},EditorUi.prototype.createStatusContainer=function(){var e=document.createElement("a");return e.className="geItem geStatus",e},EditorUi.prototype.setStatusText=function(e){this.statusContainer.innerHTML=e},EditorUi.prototype.createToolbar=function(e){return new Toolbar(this,e)},EditorUi.prototype.createSidebar=function(e){return new Sidebar(this,e)},EditorUi.prototype.createFooter=function(){return this.createDiv("geFooter")},EditorUi.prototype.createDiv=function(e){var n=document.createElement("div");return n.className=e,n},EditorUi.prototype.createHeader=function(e){return document.createElement(e)},EditorUi.prototype.createForm=function(e){var n=document.createElement("form");return n.className=e,n},EditorUi.prototype.addSplitHandler=function(n,t,a,i){var s=null,o=null;function r(e){if(null!=s){var n=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e));i(Math.max(0,o+(t?n.x-s.x:s.y-n.y)-a)),mxEvent.consume(e)}}function e(e){r(e),o=s=null}mxEvent.addGestureListeners(n,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e)),o=parseInt(t?n.style.left:n.style.bottom),mxEvent.consume(e)}),mxEvent.addListener(document,"mousemove",r),mxEvent.addListener(document,"touchmove",r),mxEvent.addListener(document,"mouseup",e),mxEvent.addListener(document,"touchend",e)},EditorUi.prototype.executeLayout=function(e,n,t){var a=this.editor.graph,i=a.getSelectionCell();n=null!=this.animate?this.animate:n,a.getModel().beginUpdate();try{e.execute(a.getDefaultParent(),i)}catch(e){throw e}finally{if(n&&navigator.userAgent.indexOf("Camino")<0){var s=new mxMorphing(a);s.addListener(mxEvent.DONE,mxUtils.bind(this,function(){a.getModel().endUpdate()})),s.startAnimation()}else a.getModel().endUpdate()}},EditorUi.prototype.createKeyHandler=function(e){var a=this.editor.graph,o=new mxKeyHandler(a);function n(e){if(!a.isSelectionEmpty()){var n=0,t=0;37==e?n=-1:38==e?t=-1:39==e?n=1:40==e&&(t=1),a.moveCells(a.getSelectionCells(),n,t),a.scrollCellToVisible(a.getSelectionCell())}}o.isControlDown=function(e){return mxEvent.isControlDown(e)||mxClient.IS_MAC&&e.metaKey};var t=mxUtils.bind(this,function(e,n,t,a){var i=this.actions.get(t);if(null!=i){var s=function(){i.enabled&&i.funct()};n?a?o.bindControlShiftKey(e,s):o.bindControlKey(e,s):a?o.bindShiftKey(e,s):o.bindKey(e,s)}});return o.enter=function(){},o.bindKey(8,function(){a.foldCells(!0)}),o.bindKey(13,function(){a.foldCells(!1)}),o.bindKey(33,function(){a.exitGroup()}),o.bindKey(34,function(){a.enterGroup()}),o.bindKey(36,function(){a.home()}),o.bindKey(35,function(){a.refresh()}),o.bindKey(37,function(){n(37)}),o.bindKey(38,function(){n(38)}),o.bindKey(39,function(){n(39)}),o.bindKey(40,function(){n(40)}),o.bindKey(113,function(){a.startEditingAtCell()}),t(46,!1,"delete"),t(82,!0,"tilt"),t(83,!0,"save"),t(83,!0,"saveAs",!0),t(107,!1,"zoomIn"),t(109,!1,"zoomOut"),t(65,!0,"selectAll"),t(86,!0,"selectVertices",!0),t(69,!0,"selectEdges",!0),t(69,!0,"export"),t(66,!0,"toBack"),t(70,!0,"toFront"),t(68,!0,"duplicate"),t(90,!0,"undo"),t(89,!0,"redo"),t(88,!0,"cut"),t(67,!0,"copy"),t(81,!0,"connect"),t(86,!0,"paste"),t(71,!0,"group"),t(71,!0,"grid",!0),t(85,!0,"ungroup"),t(112,!1,"about"),t(80,!0,"publish",!0),o},EditorUi.prototype.createMultiplicities=function(e,n,t,a){for(var i=0;i<n.length;i++)e.push(new mxMultiplicity(!0,n[i],null,null,t[i][0],t[i][1],null,mxResources.get(n[i])+mxResources.get("musthave")+t[i][0]+mxResources.get("outgoingedge"),null)),e.push(new mxMultiplicity(!1,n[i],null,null,a[i][0],a[i][1],null,mxResources.get(n[i])+mxResources.get("musthave")+a[i][0]+mxResources.get("incomingedge"),null))};var useLocalStorage=(mxClient.IS_TOUCH||"local"==urlParams.storage)&&"undefined"!=typeof localStorage,fileSupport=null!=window.File&&null!=window.FileReader&&null!=window.FileList,touchStyle=mxClient.IS_TOUCH||"1"==urlParams.touch,counter=0;try{for(var op=window;null!=op.opener&&!isNaN(op.opener.counter);)op=op.opener;null!=op&&(op.counter++,counter=op.counter)}catch(e){}function Sidebar(e,n){this.editorUi=e,this.container=n,this.palettes=new Object,this.taglist=new Object,this.showTooltips=!0,this.graph=new Graph(document.createElement("div"),null,null,this.editorUi.editor.graph.getStylesheet()),this.graph.resetViewOnRootChange=!1,this.graph.foldingEnabled=!1,this.graph.setConnectable(!1),this.graph.autoScroll=!1,this.graph.setTooltips(!1),this.graph.setEnabled(!1),this.graph.container.style.visibility="hidden",this.graph.container.style.position="absolute",this.graph.container.style.overflow="hidden",this.graph.container.style.height="1px",this.graph.container.style.width="1px",mxClient.IS_IE||mxClient.IS_IE11||(this.graph.container.style.display="none"),document.body.appendChild(this.graph.container),this.pointerUpHandler=mxUtils.bind(this,function(){this.showTooltips=!0}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerup":"mouseup",this.pointerUpHandler),this.pointerDownHandler=mxUtils.bind(this,function(){this.showTooltips=!1,this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerdown":"mousedown",this.pointerDownHandler),this.pointerMoveHandler=mxUtils.bind(this,function(e){for(var n=mxEvent.getSource(e);null!=n;){if(n==this.currentElt)return;n=n.parentNode}this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointermove":"mousemove",this.pointerMoveHandler),this.pointerOutHandler=mxUtils.bind(this,function(e){null==e.toElement&&null==e.relatedTarget&&this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerout":"mouseout",this.pointerOutHandler),mxEvent.addListener(n,"scroll",mxUtils.bind(this,function(){this.showTooltips=!0})),this.init(),mxClient.IS_SVG||((new Image).src=IMAGE_PATH+"/tooltip.png")}function Actions(e){this.editorUi=e,this.actions=new Object,this.init()}function Action(e,n,t,a,i){mxEventSource.call(this),this.label=e,this.funct=n,this.enabled=null==t||t,this.iconCls=a,this.shortcut=i}function Menubar(e,n){this.editorUi=e,this.container=n,mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function Menu(e,n){mxEventSource.call(this),this.funct=e,this.enabled=null==n||n}function Toolbar(e,n){this.editorUi=e,this.container=n,this.init(),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function createCheckbox(e){var n=document.createElement("input");return n.setAttribute("type","checkbox"),e&&n.setAttribute("checked",!0),n}function createDropdownFromApi(e,t,a,i,n,s,o,r){var l=new XMLHttpRequest;l.open("GET",e,!1),l.setRequestHeader("Authorization","Bearer "+n.editor.data.token),l.send(null);var d=[];200===l.status&&(d=JSON.parse(l.response));var c=document.createElement("select"),m=document.createElement("option");return m.text="-- None --",m.value="-1",c.appendChild(m),d.rows.forEach(function(n){r&&n[a]==r||((m=document.createElement("option")).text=n[a],s&&o?(m.value=o,s.forEach(function(e){m.value=m.value.replace("%"+e+"%",n[e])}),m.selected=m.value==t):(m.value=n[i],m.selected=n[i]==t),c.appendChild(m))}),c.className="form-control select2",c}function createDropdownWithOptgroupFromApi(e,n,t,a,i,s){var o=new XMLHttpRequest;o.open("GET",e,!1),o.setRequestHeader("Authorization","Bearer "+i.editor.data.token),o.send(null);var r=[];200===o.status&&(r=JSON.parse(o.response));var l=document.createElement("select"),d=document.createElement("option");d.text="-- None --",d.value="-1",l.appendChild(d);var c=_.groupBy(r.rows,s);for(var m in c)if(c.hasOwnProperty(m)){var u=document.createElement("optgroup");u.label=_.capitalize(m),c[m].forEach(function(e){(d=document.createElement("option")).text=e[t],d.value=e[a],d.selected=e[a]==n,u.appendChild(d)}),l.appendChild(u)}return l.className="form-control select2",l}function createGroupedDropdownFromApi(e,n,t,a,i,s){var o=new XMLHttpRequest;o.open("GET",e,!1),o.setRequestHeader("Authorization","Bearer "+i.editor.data.token),o.send(null);var r=[];200===o.status&&(r=JSON.parse(o.response));var l=document.createElement("select"),d=document.createElement("option");return d.text="-- None --",d.value="0",l.appendChild(d),r.rows.forEach(function(e){(d=document.createElement("option")).className="select-group-father",d.text=e[t].toUpperCase(),d.value=e[a],d.selected=e[a]==n,l.appendChild(d),e[s].forEach(function(e){(d=document.createElement("option")).className="select-group-son",d.text="-"+_.capitalize(e[t]),d.value=e[a],d.selected=e[a]==n,l.appendChild(d)})}),l.className="form-control select2",l}function createDropdownFromArray(e,n){var t=document.createElement("select");for(var a in e){var i=document.createElement("option");i.text=e[a],i.value=a,(0<n||""!=n)&&(i.selected=n===a),t.appendChild(i)}return t.className="form-control select2",t}function createDropdownFromTigerDialList(e){var n=document.createElement("select"),t=[],a=new XMLHttpRequest;try{if(a.open("POST","/api/rest/list/list",!1),a.send(JSON.stringify({page:1,size:6e5})),200===a.status){var i=JSON.parse(a.response);if(0<i.status){var s=i.response.RMI.rows;for(var o in s)t[s[o].id]=s[o].name}}}catch(e){console.log(e)}for(var r in t){var l=document.createElement("option");l.text=t[r],l.value=r,(0<e||""!=e)&&(l.selected=e===r),n.appendChild(l)}return n.className="form-control select2",n}function Dialog(e,n,t,a,i,s,o){var r=0;mxClient.IS_IE&&9!=document.documentMode&&(r=60),t+=r,a+=r;Math.max(0,Math.round((document.body.scrollWidth-t)/2)),Math.max(0,Math.round((Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-a)/3));var l=e.createDiv("geDialog");l.className="modal fade in center",l.style.display="block",l.style.paddingRight="12px";var d=e.createDiv("geModalDialog");d.className="modal-dialog",d.appendChild(n),l.appendChild(d),null==this.bg&&(this.bg=e.createDiv("background"),this.bg.className="modal-backdrop fade in",mxClient.IS_QUIRKS&&new mxDivResizer(this.bg)),i&&document.body.appendChild(this.bg),document.body.appendChild(l),this.onDialogClose=o,this.container=l}function ImportDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("import")+" XML");var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("row"),l=t.createDiv("col-md-12"),d=document.createElement("textarea");d.style.width="100%",d.style.height="374px";var c=document.createElement("input");c.type="file",c.setAttribute("accept","text/xml"),c.addEventListener("change",function(e){var n=e.target.files[0];if(console.log(n),n)if("text/xml"===n.type){var t=new FileReader;t.onload=function(e){var n=e.target.result;mxUtils.write(d,n)},t.readAsText(n)}else alert("Failed to load format file");else alert("Failed to load file")},!1),l.appendChild(c),l.appendChild(d),r.appendChild(l),a.appendChild(r);var m=mxUtils.button(mxResources.get("import"),mxUtils.bind(this,function(e){var n=mxUtils.parseXml(d.value);t.editor.setGraphXml(n.documentElement),t.hideDialog()}));m.className="btn blue";var u=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});u.className="btn default",i.appendChild(m),i.appendChild(u),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function AboutDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("about")+" Cally Square");var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=document.createElement("img");r.style.border="0px",r.setAttribute("width","176"),r.setAttribute("width","151"),r.setAttribute("src",IMAGE_PATH+"/logo.png"),a.appendChild(r),mxUtils.br(a),mxUtils.write(a,"Powered by Xenialab "+mxClient.VERSION),mxUtils.br(a);var l=document.createElement("a");l.setAttribute("href","http://www.callysquare.com/"),l.setAttribute("target","_blank"),mxUtils.write(l,"www.callysquare.com"),a.appendChild(l),mxUtils.br(a),mxUtils.br(a);var d=mxUtils.button(mxResources.get("close"),function(){e.hideDialog()});d.className="btn default",i.appendChild(d),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function SaveDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("saveAs"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_copy"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("save"),function(){e.saveAs(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function NewDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("new"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_new"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("new"),function(){e.new(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function DescriptionDialog(e){console.log(e.editor.data);var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("description"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("form-horizontal form-row-seperated"),l="description",d=e.editor.data.description||"",c=e.createDiv("form-group"),m=document.createElement("label");m.className="col-sm-4 control-label",mxUtils.write(m,mxResources.get(l)),c.appendChild(m);var u=document.createElement("input");u.setAttribute("value",d),u.className="form-control",u.setAttribute("id","_description");var p=e.createDiv("col-sm-8");p.appendChild(u),c.appendChild(p),r.appendChild(c),a.appendChild(r);var g=mxUtils.button(mxResources.get("update"),function(){e.description(u.value),e.hideDialog()});g.className="btn blue";var v=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});v.className="btn default",i.appendChild(g),i.appendChild(v),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function VariableDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("variable"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("form-horizontal form-row-seperated"),l="name",d="_"+l,c="variable name",m=e.createDiv("form-group"),u=document.createElement("label");u.className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var p=document.createElement("input");p.setAttribute("value",c),p.className="form-control",p.setAttribute("id",d);var g=e.createDiv("col-sm-8");g.appendChild(p),m.appendChild(g),r.appendChild(m),d="_"+(l="description"),c="variable description",m=e.createDiv("form-group last"),(u=document.createElement("label")).className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var v=document.createElement("input");v.setAttribute("value",c),v.className="form-control",v.setAttribute("id",d),(g=e.createDiv("col-sm-8")).appendChild(v),m.appendChild(g),r.appendChild(m),a.appendChild(r);var h=mxUtils.button(mxResources.get("new"),function(){e.variable(p.value,v.value),e.hideDialog()});h.className="btn blue";var f=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});f.className="btn default",i.appendChild(h),i.appendChild(f),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function OpenDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("open"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("row"),l=e.createDiv("col-md-4"),d=e.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=new XMLHttpRequest;m.open("GET","/api/square/projects",!1),m.setRequestHeader("Authorization","Bearer "+e.editor.data.token),m.send(null);var u=[];200===m.status&&(u=JSON.parse(m.response));for(var p=document.createElement("select"),g=0;g<u.length;g++){var v=document.createElement("option");v.text=u[g].name,v.value=u[g].id,p.appendChild(v)}p.className="form-control",d.appendChild(p),r.appendChild(l),r.appendChild(d),a.appendChild(r);var h=mxUtils.button(mxResources.get("open"),function(){console.log(p),console.log(p.value),window.open("square/project/"+p.value,"_blank"),e.hideDialog()});h.className="btn blue";var f=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});f.className="btn default",i.appendChild(h),i.appendChild(f),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function RenameDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("rename"));var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("row"),l=t.createDiv("col-md-4"),d=t.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=t.editor.filename,u=document.createElement("input");u.setAttribute("value",m),u.className="form-control",d.appendChild(u),r.appendChild(l),r.appendChild(d),a.appendChild(r);var p=mxUtils.button(mxResources.get("save"),function(){var n=new XMLHttpRequest;n.open("PUT",SAVE_URL+t.editor.data.id,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("Authorization","Bearer "+t.editor.data.token),n.send("name="+u.value),n.onload=function(e){200===n.status?(t.editor.setStatus("Project successfully renamed"),t.editor.filename=u.value):(console.log(n.response),t.editor.setStatus(JSON.parse(n.response).errors[0].message))},n.onerror=function(e){mxUtils.alert(n.statusText)},t.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function EditFileDialog(n){var e=n.createDiv("modal-content"),t=n.createDiv("modal-header"),a=n.createDiv("modal-body"),i=n.createDiv("modal-footer"),s=n.createHeader("h4");mxUtils.write(s,mxResources.get("edit"));var o=mxUtils.button("",function(){n.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=n.createDiv("row"),l=n.createDiv("col-md-12"),d=document.createElement("textarea");if(d.style.width="100%",d.style.height="374px",d.value=mxUtils.getPrettyXml(n.editor.getGraphXml()),fileSupport){d.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()},!1),d.addEventListener("drop",function(e){if(e.stopPropagation(),e.preventDefault(),0<e.dataTransfer.files.length){var n=e.dataTransfer.files[0],t=new FileReader;t.onload=function(e){d.value=e.target.result},t.readAsText(n)}},!1)}l.appendChild(d),r.appendChild(l),a.appendChild(r);var c=mxUtils.button(mxResources.get("save"),function(){var e=mxUtils.parseXml(d.value);n.editor.setGraphXml(e.documentElement),n.hideDialog()});c.className="btn blue";var m=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});m.className="btn default",i.appendChild(c),i.appendChild(m),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function ExportDialog(n){var e=n.createDiv("modal-content"),t=n.createDiv("modal-header"),a=n.createDiv("modal-body form"),i=n.createDiv("modal-footer"),s=n.createHeader("h4");mxUtils.write(s,mxResources.get("export")+" XML");var o=mxUtils.button("",function(){n.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=n.createDiv("form-horizontal form-row-seperated"),l=n.createDiv("form-group last"),d=document.createElement("label");d.className="col-sm-4 control-label",mxUtils.write(d,mxResources.get("filename"));var c=document.createElement("input");c.setAttribute("value",n.editor.getOrCreateFilename()),c.className="form-control";var m=n.createDiv("col-sm-8");m.appendChild(c),l.appendChild(d),l.appendChild(m),r.appendChild(l),a.appendChild(r);var u=mxUtils.button(mxResources.get("export"),mxUtils.bind(this,function(e){n.save(!1);encodeURIComponent(mxUtils.getXml(n.editor.getGraphXml()));new mxXmlRequest(SAVE_URL+n.editor.data.id+"/download","filename="+c.value,"GET").simulate(document,"_blank"),n.hideDialog()}));u.className="btn blue";var p=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});p.className="btn default",i.appendChild(u),i.appendChild(p),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function GeneralDialog(i,s){console.log("general");var o=i.editor.graph,e=i.createDiv("md-dialog"),n=i.createDiv("md-toolbar"),t=i.createDiv("md-dialog-content"),a=i.createDiv("md-dialog-actions"),r=i.createHeader("h4");mxUtils.write(r,mxResources.get("edit")+" "+mxResources.get(s.value.nodeName));var l=mxUtils.button("",function(){i.hideDialog()});l.className="close",n.appendChild(l),n.appendChild(r);for(var d=s.value.attributes.length,c=i.createDiv("form-horizontal form-row-seperated"),m=0;m<d;m++){var u,p=s.value.attributes[m].name,g="_"+p,v=s.value.attributes[m].value,h=i.createDiv(m==d-1?"form-group last":"form-group"),f=document.createElement("label");switch(f.className="col-sm-4 control-label",mxUtils.write(f,mxResources.get(p)),h.appendChild(f),p){case"sip_id":u=createDropdownWithOptgroupFromApi("/api/users/all",v,"fullname","id",i,"role");break;case"queue_id":u=createDropdownFromApi("/api/voice/queues",v,"name","name",i);break;case"trunk_name":u=createDropdownFromApi("/api/trunks",v,"name","name",i);break;case"variable_id":u=createDropdownFromApi("/api/variables",v,"name","id",i);break;case"account_id":u="sendMail"==s.value.nodeName?createDropdownFromApi("/api/mail/servers/out",v,"username","id",i):createDropdownFromApi("/api/sms/accounts",v,"name","id",i);break;case"template_id":u=createDropdownFromApi("/api/templates",v,"name","id",i);break;case"context":u=createDropdownFromApi("/api/voice/contexts",v,"name","name",i);break;case"mailbox":u=createDropdownFromApi("/api/voice/voicemails",v,"mailbox","id",i,["mailbox","context"],"%mailbox%@%context%");break;case"model":u=createDropdownFromArray(ISPEECHASRMODEL,v);break;case"ispeech_asr_language":u=createDropdownFromArray(ISPEECHASRLANG,v);break;case"beep":u=createDropdownFromArray(ISPEECHBEEP,v);break;case"hiddendigitspos":u=createDropdownFromArray(SECRETDIGITSPOS,v);break;case"ispeech_tts_language":u=createDropdownFromArray(ISPEECHLANG,v);break;case"google_tts_language":u=createDropdownFromArray(GOOGLETTSLANG,v);break;case"intKey":u=createDropdownFromArray(ASRINTKEYS,v);break;case"recordingFormat":u=createDropdownFromArray(RECORDINGFORMAT,v);break;case"answer":u=createDropdownFromArray(BOOLSELECT,v);break;case"list_id":u=createDropdownFromTigerDialList(v);break;case"interval_id":u=createGroupedDropdownFromApi("/api/intervals",v,"name","id",i,"SubIntervals");break;case"project_id":u=createDropdownFromApi("/api/square/projects",v,"name","id",i,null,null,i.editor.getOrCreateFilename());break;case"odbc_id":u=createDropdownFromApi("/api/square/odbc",v,"name","id",i);break;case"file_id":u=createDropdownFromApi("/api/sounds",v,"display_name","id",i);break;case"timeout":case"digit":case"mindigit":case"maxdigit":case"response":case"retry":case"speed":(u=document.createElement("input")).setAttribute("type","number"),u.setAttribute("min",0),u.setAttribute("max",1e3),u.setAttribute("value",v),u.className="form-control";break;case"text":case"key":case"query":case"condition":case"command":case"body":(u=document.createElement("textarea")).innerHTML=v,u.className="form-control";break;case"sms_text":(u=document.createElement("textarea")).innerHTML=v,u.className="form-control",u.setAttribute("maxlength","160");break;default:(u=document.createElement("input")).setAttribute("value",v),u.className="form-control"}u.setAttribute("id",g);var b=i.createDiv("col-sm-8");if(b.appendChild(u),mxResources.get("help_"+p)){var A=i.createDiv("p");A.className="help-block",mxUtils.write(A,mxResources.get("help_"+p)),b.appendChild(A)}h.appendChild(b),c.appendChild(h)}t.appendChild(c);var E=mxUtils.button(mxResources.get("save"),mxUtils.bind(this,function(e){for(var n=0;n<s.value.attributes.length;n++){var t="_"+s.value.attributes[n].name,a=s.value.attributes[n].name;s.setAttribute(a,document.getElementById(t).value)}o.refresh(s),i.hideDialog()}));E.className="btn blue";var y=mxUtils.button(mxResources.get("cancel"),function(){i.hideDialog()});y.className="btn default",a.appendChild(E),a.appendChild(y),e.appendChild(n),e.appendChild(t),e.appendChild(a),this.container=e}Editor=function(){mxEventSource.call(this),this.init(),this.initStencilRegistry(),this.graph=new Graph,this.outline=new mxOutline(this.graph),this.outline.updateOnPan=!0,this.undoManager=this.createUndoManager(),this.status="",this.filename=null,this.getOrCreateFilename=function(){return this.filename||mxResources.get("drawing",[counter])+".xml"},this.getFilename=function(){return this.filename},this.setStatus=function(e){this.status=e,this.fireEvent(new mxEventObject("statusChanged"))},this.getStatus=function(){return this.status},this.modified=!1,this.graphChangeListener=function(){this.modified=!0},this.graph.getModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(){this.graphChangeListener.apply(this,arguments)})),window.onbeforeunload=mxUtils.bind(this,function(){if(this.modified)return mxResources.get("allChangesLost")}),this.graph.resetViewOnRootChange=!1,this.graph.scrollbars=!0,this.graph.background=null},mxUtils.extend(Editor,mxEventSource),Editor.prototype.gridImage=IMAGE_PATH+"/grid.gif",Editor.prototype.transparentImage=IMAGE_PATH+"/transparent.gif",Editor.prototype.setGraphXml=function(e){var n=new mxCodec(e.ownerDocument);if("mxGraphModel"==e.nodeName){this.graph.view.scale=Number(e.getAttribute("scale")||1),this.graph.gridEnabled="0"!=e.getAttribute("grid"),this.graph.graphHandler.guidesEnabled="0"!=e.getAttribute("guides"),this.graph.setTooltips("0"!=e.getAttribute("tooltips")),this.graph.setConnectable("0"!=e.getAttribute("connect")),this.graph.foldingEnabled="0"!=e.getAttribute("fold"),this.graph.scrollbars="0"!=e.getAttribute("scrollbars"),this.graph.scrollbars||(this.graph.container.scrollLeft=0,this.graph.container.scrollTop=0,this.graph.view.translate.x=Number(e.getAttribute("dx")||0),this.graph.view.translate.y=Number(e.getAttribute("dy")||0)),this.graph.pageVisible="1"==e.getAttribute("page"),this.graph.pageBreaksVisible=this.graph.pageVisible,this.graph.preferPageSize=this.graph.pageBreaksVisible;var t=e.getAttribute("pageScale");this.graph.pageScale=null!=t?t:1.5;var a=e.getAttribute("pageWidth"),i=e.getAttribute("pageHeight");null!=a&&null!=i&&(this.graph.pageFormat=new mxRectangle(0,0,parseFloat(a),parseFloat(i)),this.outline.outline.pageFormat=this.graph.pageFormat);var s=e.getAttribute("background");null!=s&&0<s.length&&(this.graph.background=s),n.decode(e,this.graph.getModel()),this.updateGraphComponents()}},Editor.prototype.getGraphXml=function(){var e=new mxCodec(mxUtils.createXmlDocument()).encode(this.graph.getModel());return 0==this.graph.view.translate.x&&0==this.graph.view.translate.y||(e.setAttribute("dx",Math.round(100*this.graph.view.translate.x)/100),e.setAttribute("dy",Math.round(100*this.graph.view.translate.y)/100)),1!=this.graph.view.scale&&e.setAttribute("scale",Math.round(1e3*this.graph.view.scale)/1e3),e.setAttribute("grid",this.graph.isGridEnabled()?"1":"0"),e.setAttribute("guides",this.graph.graphHandler.guidesEnabled?"1":"0"),e.setAttribute("guides",this.graph.graphHandler.guidesEnabled?"1":"0"),e.setAttribute("tooltips",this.graph.tooltipHandler.isEnabled()?"1":"0"),e.setAttribute("connect",this.graph.connectionHandler.isEnabled()?"1":"0"),e.setAttribute("fold",this.graph.foldingEnabled?"1":"0"),e.setAttribute("page",this.graph.pageVisible?"1":"0"),e.setAttribute("pageScale",this.graph.pageScale),e.setAttribute("pageWidth",this.graph.pageFormat.width),e.setAttribute("pageHeight",this.graph.pageFormat.height),this.graph.scrollbars||e.setAttribute("scrollbars","0"),null!=this.graph.background&&e.setAttribute("background",this.graph.background),e},Editor.prototype.updateGraphComponents=function(){var e=this.graph,n=this.outline;if(null!=e.container&&null!=n.outline.container){null!=e.background?"none"==e.background?e.container.style.backgroundColor="transparent":(null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.fill=e.background,e.view.backgroundPageShape.reconfigure()),e.container.style.backgroundColor=e.background):e.container.style.backgroundColor="",e.pageVisible?(e.container.style.backgroundColor="#ebebeb",e.container.style.borderStyle="solid",e.container.style.borderColor="#e5e5e5",e.container.style.borderTopWidth="1px",e.container.style.borderLeftWidth="1px",e.container.style.borderRightWidth="0px",e.container.style.borderBottomWidth="0px"):e.container.style.border="",n.outline.container.style.backgroundColor=e.container.style.backgroundColor,n.outline.pageVisible==e.pageVisible&&n.outline.pageScale==e.pageScale||(n.outline.pageScale=e.pageScale,n.outline.pageVisible=e.pageVisible,n.outline.view.validate()),e.scrollbars&&"hidden"==e.container.style.overflow&&!touchStyle?e.container.style.overflow="auto":e.scrollbars&&!touchStyle||(e.container.style.overflow="hidden");var t=mxClient.IS_IE&&9<=document.documentMode?"url("+this.transparentImage+")":"none";e.container.style.backgroundImage=!e.pageVisible&&e.isGridEnabled()?"url("+this.gridImage+")":t,null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.node.style.backgroundImage=this.graph.isGridEnabled()?"url("+this.gridImage+")":"none")}},Editor.prototype.init=function(){mxClient.IS_IE6&&mxClient.link("stylesheet",CSS_PATH+"/grapheditor-ie6.css"),mxResources.loadDefaultBundle=!1,mxResources.add(RESOURCE_BASE),mxConstants.DEFAULT_HOTSPOT=.3;var e=mxConnectionHandler.prototype.createMarker;mxConnectionHandler.prototype.createMarker=function(){var t=e.apply(this,arguments);return t.intersects=mxUtils.bind(this,function(e,n){return!!this.isConnecting()||mxCellMarker.prototype.intersects.apply(t,arguments)}),t},mxConstants.SHADOWCOLOR="#d0d0d0",mxConstants.HANDLE_FILLCOLOR="#99ccff",mxConstants.HANDLE_STROKECOLOR="#0088cf",mxConstants.VERTEX_SELECTION_COLOR="#00a8ff",mxConstants.OUTLINE_COLOR="#00a8ff",mxConstants.OUTLINE_HANDLE_FILLCOLOR="#99ccff",mxConstants.OUTLINE_HANDLE_STROKECOLOR="#00a8ff",mxConstants.CONNECT_HANDLE_FILLCOLOR="#cee7ff",mxConstants.EDGE_SELECTION_COLOR="#00a8ff",mxConstants.DEFAULT_VALID_COLOR="#00a8ff",mxConstants.LABEL_HANDLE_FILLCOLOR="#cee7ff",mxConstants.GUIDE_COLOR="#0088cf",mxGraph.prototype.pageBreakColor="#c0c0c0",mxGraph.prototype.pageScale=1,mxRubberband.prototype.defaultOpacity=30,mxGraphView.prototype.createBackgroundPageShape=function(e){return new mxRectangleShape(e,this.graph.background||"white","#cacaca")},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.getGraphBounds(),n=0<e.width?e.x/this.scale-this.translate.x:0,t=0<e.height?e.y/this.scale-this.translate.y:0,a=e.width/this.scale,i=e.height/this.scale,s=this.graph.pageFormat,o=this.graph.pageScale,r=s.width*o,l=s.height*o,d=Math.floor(Math.min(0,n)/r),c=Math.floor(Math.min(0,t)/l),m=Math.ceil(Math.max(1,n+a)/r)-d,u=Math.ceil(Math.max(1,t+i)/l)-c;return new mxRectangle(this.scale*(this.translate.x+d*r),this.scale*(this.translate.y+c*l),this.scale*m*r,this.scale*u*l)};var t=mxGraph.prototype.panGraph;mxGraph.prototype.panGraph=function(e,n){t.apply(this,arguments),this.dialect==mxConstants.DIALECT_SVG||null==this.view.backgroundPageShape||this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container)||(this.view.backgroundPageShape.node.style.marginLeft=e+"px",this.view.backgroundPageShape.node.style.marginTop=n+"px")};var a=this;mxGraphView.prototype.validateBackground=function(){var e=this.graph.getBackgroundImage();if(null!=e){if(null==this.backgroundImage||this.backgroundImage.image!=e.src){null!=this.backgroundImage&&this.backgroundImage.destroy();var n=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(n,e.src),this.backgroundImage.dialect=this.graph.dialect,this.backgroundImage.init(this.backgroundPane),this.backgroundImage.redraw()}this.redrawBackgroundImage(this.backgroundImage,e)}else null!=this.backgroundImage&&(this.backgroundImage.destroy(),this.backgroundImage=null);if(this.graph.pageVisible){n=this.getBackgroundPageBounds();null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(n),this.backgroundPageShape.scale=1,this.backgroundPageShape.isShadow=!0,this.backgroundPageShape.dialect=mxConstants.DIALECT_STRICTHTML,this.backgroundPageShape.init(this.graph.container),this.graph.container.firstChild.style.position="absolute",this.graph.container.insertBefore(this.backgroundPageShape.node,this.graph.container.firstChild),this.backgroundPageShape.redraw(),this.backgroundPageShape.node.className="geBackgroundPage",this.backgroundPageShape.node.style.backgroundPosition="-1px -1px",mxEvent.addListener(this.backgroundPageShape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e)})),mxEvent.addGestureListeners(this.backgroundPageShape.node,mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){null!=this.graph.tooltipHandler&&this.graph.tooltipHandler.isHideOnHover()&&this.graph.tooltipHandler.hide(),this.graph.isMouseDown&&!mxEvent.isConsumed(e)&&this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}))):(this.backgroundPageShape.scale=1,this.backgroundPageShape.bounds=n,this.backgroundPageShape.redraw()),this.backgroundPageShape.node.style.backgroundImage=this.graph.isGridEnabled()?"url("+a.gridImage+")":"none"}else null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraph.prototype.updatePageBreaks=function(e,n,t){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale,r=this.view.getBackgroundPageBounds();n=r.width,t=r.height;var l=new mxRectangle(a*i.x,a*i.y,s.width*o,s.height*o),d=(e=e&&Math.min(l.width,l.height)>this.minPageBreakDist)?Math.ceil(n/l.width)-1:0,c=e?Math.ceil(t/l.height)-1:0,m=r.x+n,u=r.y+t;if(null==this.horizontalPageBreaks&&0<d&&(this.horizontalPageBreaks=[]),null!=this.horizontalPageBreaks){for(var p=0;p<=d;p++){var g=[new mxPoint(r.x+(p+1)*l.width,r.y),new mxPoint(r.x+(p+1)*l.width,u)];if(null!=this.horizontalPageBreaks[p])this.horizontalPageBreaks[p].scale=1,this.horizontalPageBreaks[p].points=g,this.horizontalPageBreaks[p].redraw();else(v=new mxPolyline(g,this.pageBreakColor,this.scale)).dialect=this.dialect,v.isDashed=this.pageBreakDashed,v.addPipe=!1,v.scale=a,v.init(this.view.backgroundPane),v.redraw(),this.horizontalPageBreaks[p]=v}for(p=d;p<this.horizontalPageBreaks.length;p++)this.horizontalPageBreaks[p].destroy();this.horizontalPageBreaks.splice(d,this.horizontalPageBreaks.length-d)}if(null==this.verticalPageBreaks&&0<c&&(this.verticalPageBreaks=[]),null!=this.verticalPageBreaks){for(p=0;p<=c;p++){var v;g=[new mxPoint(r.x,r.y+(p+1)*l.height),new mxPoint(m,r.y+(p+1)*l.height)];if(null!=this.verticalPageBreaks[p])this.verticalPageBreaks[p].scale=1,this.verticalPageBreaks[p].points=g,this.verticalPageBreaks[p].redraw();else(v=new mxPolyline(g,this.pageBreakColor,a)).dialect=this.dialect,v.isDashed=this.pageBreakDashed,v.addPipe=!1,v.scale=a,v.init(this.view.backgroundPane),v.redraw(),this.verticalPageBreaks[p]=v}for(p=c;p<this.verticalPageBreaks.length;p++)this.verticalPageBreaks[p].destroy();this.verticalPageBreaks.splice(c,this.verticalPageBreaks.length-c)}},mxEdgeHandler.prototype.snapToTerminals=!0,mxGraphHandler.prototype.guidesEnabled=!0;var s=mxGraphHandler.prototype.shouldRemoveCellsFromParent;mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(e,n,t){for(var a=0;a<n.length;a++)if(this.graph.getModel().isVertex(n[a])){var i=this.graph.getCellGeometry(n[a]);if(null!=i&&i.relative)return!1}return s.apply(this,arguments)},mxGuide.prototype.isEnabledForEvent=function(e){return!mxEvent.isAltDown(e)};var r=mxPopupMenu.prototype.addItem;mxPopupMenu.prototype.addItem=function(e,n,t,a,i,s){var o=r.apply(this,arguments);return null==s||s||mxEvent.addListener(o,"mousedown",function(e){mxEvent.consume(e)}),o};var o=mxGraphHandler.prototype.getInitialCellForEvent;mxGraphHandler.prototype.getInitialCellForEvent=function(e){var n=this.graph.getModel(),t=n.getParent(this.graph.getSelectionCell()),a=o.apply(this,arguments),i=n.getParent(a);if(null==t||t!=a&&t!=i)for(;!this.graph.isCellSelected(a)&&!this.graph.isCellSelected(i)&&n.isVertex(i)&&!this.graph.isValidRoot(i);)a=i,i=this.graph.getModel().getParent(a);return a};var l=mxGraphHandler.prototype.isDelayedSelection;mxGraphHandler.prototype.isDelayedSelection=function(e){var n=l.apply(this,arguments),t=this.graph.getModel(),a=t.getParent(this.graph.getSelectionCell()),i=t.getParent(e);return(null==a||a!=e&&a!=i)&&(this.graph.isCellSelected(e)||!t.isVertex(i)||this.graph.isValidRoot(i)||(n=!0)),n},mxGraphHandler.prototype.selectDelayed=function(e){var n=e.getCell();null==n&&(n=this.cell);for(var t=this.graph.getModel(),a=t.getParent(n);this.graph.isCellSelected(n)&&t.isVertex(a)&&!this.graph.isValidRoot(a);)n=a,a=t.getParent(n);this.graph.selectCellForEvent(n,e.getEvent())},mxPanningHandler.prototype.getCellForPopupEvent=function(e){for(var n=e.getCell(),t=this.graph.getModel(),a=t.getParent(n);t.isVertex(a)&&!this.graph.isValidRoot(a);)this.graph.isCellSelected(a)&&(n=a),a=t.getParent(a);return n}},Editor.prototype.createUndoManager=function(){var s=this.graph,t=new mxUndoManager,e=function(e,n){t.undoableEditHappened(n.getProperty("edit"))};s.getModel().addListener(mxEvent.UNDO,e),s.getView().addListener(mxEvent.UNDO,e);var n=function(e,n){for(var t=s.getSelectionCellsForChanges(n.getProperty("edit").changes),a=[],i=1;i<t.length;i++)null!=s.view.getState(t[i])&&a.push(t[i]);s.setSelectionCells(a)};return t.addListener(mxEvent.UNDO,n),t.addListener(mxEvent.REDO,n),t},Editor.prototype.initStencilRegistry=function(){mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/general.xml")},mxStencilRegistry.libraries={},mxStencilRegistry.packages=[],mxStencilRegistry.getStencil=function(e){var n=mxStencilRegistry.stencils[e];if(null==n){var t=mxStencilRegistry.getBasenameForStencil(e);if(null!=t){var a=mxStencilRegistry.libraries[t];if(null!=a){if(null==mxStencilRegistry.packages[t]){mxStencilRegistry.packages[t]=1;for(var i=0;i<a.length;i++){var s=a[i];if(".xml"==s.toLowerCase().substring(s.length-4,s.length))mxStencilRegistry.loadStencilSet(s,null);else if(".js"==s.toLowerCase().substring(s.length-3,s.length)){var o=mxUtils.load(s);null!=o&&eval.call(window,o.getText())}}}}else mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/"+t+".xml",null);n=mxStencilRegistry.stencils[e]}}return n},mxStencilRegistry.getBasenameForStencil=function(e){var n=e.split("."),t=null;if(0<n.length&&"mxgraph"==n[0]){t=n[1];for(var a=2;a<n.length-1;a++)t+="/"+n[a]}return t},mxStencilRegistry.loadStencilSet=function(e,n,t){t=null!=t&&t;var a=mxStencilRegistry.packages[e];if(t||null==a){var i=!1;null==a&&(a=mxUtils.load(e).getXml(),mxStencilRegistry.packages[e]=a,i=!0),mxStencilRegistry.parseStencilSet(a,n,i)}},mxStencilRegistry.parseStencilSet=function(e,n,t){t=null==t||t;var a=e.documentElement,i=a.firstChild,s="",o=a.getAttribute("name");for(null!=o&&(s=o+".");null!=i;){if(i.nodeType==mxConstants.NODETYPE_ELEMENT&&null!=(o=i.getAttribute("name"))){s=s.toLowerCase();var r=o.replace(/ /g,"_");if(t&&mxStencilRegistry.addStencil(s+r.toLowerCase(),new mxStencil(i)),null!=n){var l=i.getAttribute("w"),d=i.getAttribute("h");n(s,r,o,l=null==l?80:parseInt(l,10),d=null==d?80:parseInt(d,10))}}i=i.nextSibling}},OpenFile=function(e){this.producer=null,this.consumer=null,this.done=e},OpenFile.prototype.setConsumer=function(e){this.consumer=e,this.execute()},OpenFile.prototype.setData=function(e,n){this.data=e,this.filename=n,this.execute()},OpenFile.prototype.error=function(e){this.cancel(),mxUtils.alert(e)},OpenFile.prototype.execute=function(){null!=this.consumer&&null!=this.data&&(this.consumer(this.data,this.filename),this.cancel())},OpenFile.prototype.cancel=function(){null!=this.done&&this.done()},Sidebar.prototype.init=function(){var e=STENCIL_PATH;this.addSearchPalette(!0),this.addImagePalette("entry",mxResources.get("entry"),e+"/entry/","_128x128.png",["start","finally","end"],[mxResources.get("start"),mxResources.get("finally"),mxResources.get("end")]),this.addImagePalette("call_management",mxResources.get("call_management"),e+"/call_management/","_128x128.png",["answer","hangup","dial","ext_dial","queue","voicemail","callback"],[mxResources.get("answer"),mxResources.get("hangup"),mxResources.get("dial"),mxResources.get("ext_dial"),mxResources.get("queue"),mxResources.get("voicemail"),mxResources.get("callback")]),this.addImagePalette("agent_management",mxResources.get("agent_management"),e+"/agent_management/","_128x128.png",["login","pause","unpause","logout"],[mxResources.get("login"),mxResources.get("pause"),mxResources.get("unpause"),mxResources.get("logout")]),this.addImagePalette("variable",mxResources.get("variable"),e+"/variable/","_128x128.png",["set","math"],[mxResources.get("set"),mxResources.get("math")]),this.addImagePalette("playback",mxResources.get("playback"),e+"/playback/","_128x128.png",["playback","menu","saydigits","saynumber","sayphonetic","getdigits","getsecretdigits"],[mxResources.get("playback"),mxResources.get("menu"),mxResources.get("saydigits"),mxResources.get("saynumber"),mxResources.get("sayphonetic"),mxResources.get("getdigits"),mxResources.get("getsecretdigits")]),this.addImagePalette("recording",mxResources.get("recording"),e+"/recording/","_128x128.png",["record"],[mxResources.get("record")]),this.addImagePalette("tts","TTS",e+"/tts/","_128x128.png",["google_cloud_tts","tts","ispeechtts","awspolly","lumenvoxtts","sestektts","mrcpsynth"],["Google Cloud TTS","GoogleTTS","ISpeechTTS","AWSPolly","LumenvoxTTS","SestekTTS","MRCPSynth"]),this.addImagePalette("asr","ASR",e+"/asr/","_128x128.png",["googleasr","ispeechasr","lumenvoxasr","tildeasr","sestekasr","mrcprecog"],["GoogleASR","ISpeechASR","LumenvoxASR","TildeASR","SestekASR","MRCPRecog"]),this.addImagePalette("integrationServer",mxResources.get("integrationServer"),e+"/integration_server/","_128x128.png",["database","sendMail","sendSMS","dialogflow","dialogflowV2","awslex","sesteknda","restapi"],[mxResources.get("database"),mxResources.get("sendMail"),mxResources.get("sendSMS"),"Dialogflow","DialogflowV2","AWSLex","SestekNDA","RestAPI"]),this.addImagePalette("callflow",mxResources.get("callflow"),e+"/callflow/","_128x128.png",["gotoc","gotoif","gotoiftime","vswitch"],[mxResources.get("gotoc"),mxResources.get("gotoif"),mxResources.get("gotoiftime"),mxResources.get("vswitch")]),this.addImagePalette("stats",mxResources.get("stats"),e+"/stats/","_128x128.png",["goal"],[mxResources.get("goal")]),this.addImagePalette("general",mxResources.get("general"),e+"/general/","_128x128.png",["noop","system","agi","subproject","custom_app"],[mxResources.get("noop"),mxResources.get("system"),mxResources.get("agi"),mxResources.get("subproject"),mxResources.get("custom_app")])},Sidebar.prototype.collapsedImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQANAIABAJmZmf///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozNUQyRTJFNjZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozNUQyRTJFNzZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjFERjc3MEUxNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFERjc3MEUyNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAA0ADQAAAhSMj6lrwAjcC1GyahV+dcZJgeIIFgA7":IMAGE_PATH+"/collapsed.gif",Sidebar.prototype.expandedImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQANAIABAJmZmf///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxREY3NzBERjZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxREY3NzBFMDZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjFERjc3MERENkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFERjc3MERFNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAA0ADQAAAhGMj6nL3QAjVHIu6azbvPtWAAA7":IMAGE_PATH+"/expanded.gif",Sidebar.prototype.tooltipImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAbCAMAAAB7jU7LAAAACVBMVEX///+ZmZn///9Y2COLAAAAA3RSTlP//wDXyg1BAAAAOElEQVR42mXQMQ4AMAgDsWv//+iutcJmIQSk+9dJpVKpVCqVSqVSqZTdncWzF8/NeP7FkxWenPEDOnUBiL3jWx0AAAAASUVORK5CYII=":IMAGE_PATH+"/tooltip.png",Sidebar.prototype.searchImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAEaSURBVHjabNGxS5VxFIfxz71XaWuQUJCG/gCHhgTD9VpEETg4aMOlQRp0EoezObgcd220KQiXmpretTAHQRBdojlQEJyukPdt+b1ywfvAGc7wnHP4nlZd1yKijQW8xzNc4Su+ZOYfQ3T6/f4YNvEJYzjELXp4VVXVz263+7cR2niBxAFeZ2YPi3iHR/gYERPDwhpOsd6sz8x/mfkNG3iOlWFhFj8y89J9KvzGXER0GuEaD42mgwHqUtoljbcRsTBCeINpfM/MgZLKPpaxFxGbOCqDXmILN7hoJrTKH+axhxmcYRxP0MIDnOBDZv5q1XUNIuJxifJp+UNV7t7BFM6xeic0RMQ4Bpl5W/ol7GISx/eEUUTECrbx+f8A8xhiZht9zsgAAAAASUVORK5CYII=":IMAGE_PATH+"/search.png",Sidebar.prototype.enableTooltips=!0,Sidebar.prototype.tooltipBorder=16,Sidebar.prototype.tooltipDelay=300,Sidebar.prototype.dropTargetDelay=200,Sidebar.prototype.thumbWidth=36,Sidebar.prototype.thumbHeight=36,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2,Sidebar.prototype.sidebarTitleSize=9,Sidebar.prototype.sidebarTitles=!1,Sidebar.prototype.tooltipTitles=!0,Sidebar.prototype.maxTooltipWidth=400,Sidebar.prototype.maxTooltipHeight=400,Sidebar.prototype.addStencilsToIndex=!0,Sidebar.prototype.defaultImageWidth=80,Sidebar.prototype.defaultImageHeight=80,Sidebar.prototype.getOffset=function(e){return{left:(e=e.getBoundingClientRect()).left+window.scrollX,top:e.top+window.scrollY}},Sidebar.prototype.showTooltip=function(c,m,u,p,g,v){if(this.enableTooltips&&this.showTooltips&&this.currentElt!=c){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null);var e=mxUtils.bind(this,function(){null==this.tooltip&&(this.tooltip=document.createElement("div"),this.tooltip.className="geSidebarTooltip",this.tooltip.style.zIndex=mxPopupMenu.prototype.zIndex-1,document.body.appendChild(this.tooltip),this.graph2=new Graph(this.tooltip,null,null,this.editorUi.editor.graph.getStylesheet()),this.graph2.resetViewOnRootChange=!1,this.graph2.foldingEnabled=!1,this.graph2.gridEnabled=!1,this.graph2.autoScroll=!1,this.graph2.setTooltips(!1),this.graph2.setConnectable(!1),this.graph2.setEnabled(!1),mxClient.IS_SVG||(this.graph2.view.canvas.style.position="relative"),this.tooltipImage=mxUtils.createImage(this.tooltipImage),this.tooltipImage.className="geSidebarTooltipImage",this.tooltipImage.style.zIndex=mxPopupMenu.prototype.zIndex-1,this.tooltipImage.style.position="absolute",this.tooltipImage.style.width="14px",this.tooltipImage.style.height="27px",document.body.appendChild(this.tooltipImage)),this.graph2.model.clear(),this.graph2.view.setTranslate(this.tooltipBorder,this.tooltipBorder),u>this.maxTooltipWidth||p>this.maxTooltipHeight?this.graph2.view.scale=Math.round(100*Math.min(this.maxTooltipWidth/u,this.maxTooltipHeight/p))/100:this.graph2.view.scale=1,this.tooltip.style.display="block",this.graph2.labelsVisible=null==v||v,this.graph2.addCells(m);var e=this.graph2.getGraphBounds(),n=e.width+2*this.tooltipBorder+4,t=e.height+2*this.tooltipBorder;if(mxClient.IS_QUIRKS?(t+=4,this.tooltip.style.overflow="hidden"):this.tooltip.style.overflow="visible",this.tooltipImage.style.visibility="visible",this.tooltip.style.width=n+"px",this.tooltipTitles&&null!=g&&0<g.length){null==this.tooltipTitle?(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.style.borderTop="1px solid gray",this.tooltipTitle.style.textAlign="center",this.tooltipTitle.style.width="100%",this.tooltipTitle.style.overflow="hidden",mxClient.IS_SVG||(this.tooltipTitle.style.position="absolute"),this.tooltipTitle.style.paddingTop="6px",this.tooltip.appendChild(this.tooltipTitle)):this.tooltipTitle.innerHTML="",this.tooltipTitle.style.display="",mxUtils.write(this.tooltipTitle,g);var a=this.tooltipTitle.offsetHeight+10;t+=a,mxClient.IS_SVG?this.tooltipTitle.style.marginTop=2-a+"px":(t-=6,this.tooltipTitle.style.top=t-a+"px")}else null!=this.tooltipTitle&&null!=this.tooltipTitle.parentNode&&(this.tooltipTitle.style.display="none");this.tooltip.style.height=t+"px";var i=-Math.round(e.x-this.tooltipBorder),s=-Math.round(e.y-this.tooltipBorder),o=document.body,r=document.documentElement,l=(o.clientHeight||r.clientHeight,document.getElementById("vertical-navigation").offsetWidth+this.container.clientWidth),d=Math.max(0,this.getOffset(c).top-this.container.scrollTop-t/2+16);mxClient.IS_SVG?0!=i||0!=s?this.graph2.view.canvas.setAttribute("transform","translate("+i+","+s+")"):this.graph2.view.canvas.removeAttribute("transform"):(this.graph2.view.drawPane.style.left=i+"px",this.graph2.view.drawPane.style.top=s+"px"),this.tooltip.style.position="absolute",this.tooltip.style.left=l+"px",this.tooltip.style.top=d+"px",this.tooltipImage.style.left=l-13+"px",this.tooltipImage.style.top=d+t/2-13+"px"});null!=this.tooltip&&"none"!=this.tooltip.style.display?e():this.thread=window.setTimeout(e,this.tooltipDelay),this.currentElt=c}},Sidebar.prototype.hideTooltip=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null),null!=this.tooltip&&(this.tooltip.style.display="none",this.tooltipImage.style.visibility="hidden",this.currentElt=null)},Sidebar.prototype.addEntry=function(e,n){if(null!=this.taglist&&null!=e&&0<e.length)for(var t=e.toLowerCase().replace(/[\/\,\(\)]/g," ").split(" "),a=0;a<t.length;a++)if(t[a]=t[a].replace(/\.*\d*$/,""),1<t[a].length){var i=this.taglist[t[a]];null==i&&(i={entries:[],dict:new mxDictionary},this.taglist[t[a]]=i),null==i.dict.get(n)&&(i.dict.put(n,n),i.entries.push(n))}return n},Sidebar.prototype.searchEntries=function(e,n,t,a,i){if(null!=this.taglist&&null!=e){for(var s=e.toLowerCase().split(" "),o=new mxDictionary,r=(t+1)*n,l=[],d=0,c=0;c<s.length;c++)if(0<s[c].length){var m=this.taglist[s[c]],u=new mxDictionary;if(null!=m){var p=m.entries;l=[];for(var g=0;g<p.length;g++){m=p[g];if(0==d==(null==o.get(m))&&(u.put(m,m),l.push(m),c==s.length-1&&l.length==r))return void a(l.slice(t*n,r),r,!0)}}else l=[];o=u,d++}var v=l.length;a(l.slice(t*n,(t+1)*n),v,!1)}else a([])},Sidebar.prototype.filterTags=function(e){if(null==e)return null;for(var n=e.split(" "),t=[],a={},i=0;i<n.length;i++)null==a[n[i]]&&(a[n[i]]="1",t.push(n[i]));return t.join(" ")},Sidebar.prototype.cloneCell=function(e,n){var t=e.clone();return null!=n&&(t.value=n),t},Sidebar.prototype.addSearchPalette=function(e){var n=document.createElement("div");n.style.visibility="hidden",this.container.appendChild(n);var r=document.createElement("div");r.className="geSidebar",r.style.boxSizing="border-box",r.style.overflow="hidden",r.style.width="100%",r.style.padding="8px",r.style.paddingTop="14px",r.style.paddingBottom="0px",e||(r.style.display="none");var t=document.createElement("div");t.style.whiteSpace="nowrap",t.style.textOverflow="clip",t.style.paddingBottom="8px",t.style.cursor="default";var a=document.createElement("input");a.setAttribute("placeholder",mxResources.get("searchShapes")),a.setAttribute("type","text"),a.style.fontSize="12px",a.style.overflow="hidden",a.style.boxSizing="border-box",a.style.border="solid 1px #d5d5d5",a.style.borderRadius="4px",a.style.width="100%",a.style.outline="none",a.style.padding="6px",t.appendChild(a);var i,s=document.createElement("img");s.setAttribute("src",Sidebar.prototype.searchImage),s.setAttribute("title",mxResources.get("search")),s.style.position="relative",s.style.left="-18px",mxClient.IS_QUIRKS?(a.style.height="28px",s.style.top="-4px"):s.style.top="2px",s.style.background="url('"+this.editorUi.editor.transparentImage+"')",t.appendChild(s),r.appendChild(t);var l=document.createElement("center"),d=mxUtils.button(mxResources.get("moreResults"),function(){i()});d.style.display="none",d.style.lineHeight="normal",d.style.marginTop="4px",d.style.marginBottom="8px",l.style.paddingTop="4px",l.style.paddingBottom="8px",l.appendChild(d),r.appendChild(l);var c="",m=!1,u=!1,p=0,g=new Object,v=12,h=mxUtils.bind(this,function(){m=!1,this.currentSearch=null;for(var e=r.firstChild;null!=e;){var n=e.nextSibling;e!=t&&e!=l&&e.parentNode.removeChild(e),e=n}});i=mxUtils.bind(this,function(){if(v=4*Math.max(1,Math.floor(this.container.clientWidth/(this.thumbWidth+10))),this.hideTooltip(),""!=a.value){if(null!=l.parentNode&&(c!=a.value&&(h(),c=a.value,g=new Object,u=!1,p=0),!m&&!u)){d.setAttribute("disabled","true"),d.style.display="",d.style.cursor="wait",d.innerHTML=mxResources.get("loading")+"...",m=!0;var o=new Object;this.currentSearch=o,this.searchEntries(c,v,p,mxUtils.bind(this,function(e,n,t){if(this.currentSearch==o){e=null!=e?e:[],m=!1,p++,l.parentNode.removeChild(l);for(var a=0;a<e.length;a++){var i=e[a]();null==g[i.innerHTML]&&(g[i.innerHTML]="1",r.appendChild(e[a]()))}if(t?(d.removeAttribute("disabled"),d.innerHTML=mxResources.get("moreResults")):(d.innerHTML=mxResources.get("reset"),d.style.display="none",u=!0),d.style.cursor="",0==e.length&&1==p){var s=document.createElement("div");s.className="geTitle",s.style.backgroundColor="transparent",s.style.borderColor="transparent",s.style.color="gray",s.style.padding="0px",s.style.margin="0px 8px 0px 8px",s.style.paddingTop="6px",s.style.textAlign="center",s.style.cursor="default",mxUtils.write(s,mxResources.get("noResultsFor",[c])),r.appendChild(s)}r.appendChild(l)}}),mxUtils.bind(this,function(){d.style.cursor=""}))}}else h(),a.value="",c="",g=new Object,d.style.display="none",u=!1,a.focus()}),mxEvent.addListener(a,"keydown",mxUtils.bind(this,function(e){13==e.keyCode&&i()})),mxEvent.addListener(a,"focus",function(){a.style.paddingRight="",s.style.display="none"}),mxEvent.addListener(a,"blur",function(){a.style.paddingRight="20px",s.style.display=""}),a.style.paddingRight="20px",mxEvent.addListener(a,"keyup",mxUtils.bind(this,function(e){""==a.value?(u=!0,d.style.display="none"):a.value!=c?(d.style.display="none",u=!1):m||(d.style.display=u?"none":"")})),mxEvent.addListener(a,"mousedown",function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0}),mxEvent.addListener(a,"selectstart",function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0});var o=document.createElement("div");o.appendChild(r),this.container.appendChild(o),this.palettes.search=[n,o]},Sidebar.prototype.createTitle=function(e){var n=document.createElement("a");return n.setAttribute("href","javascript:void(0);"),n.setAttribute("title",mxResources.get("sidebarTooltip")),n.className="geTitle",mxUtils.write(n,e),n},Sidebar.prototype.createThumb=function(e,n,t,a,i,s,o,r,l){this.graph.labelsVisible=null==s||s;var d=mxClient.NO_FO;mxClient.NO_FO=Editor.prototype.originalNoForeignObject,this.graph.view.scaleAndTranslate(1,0,0),this.graph.addCells(e);var c=this.graph.getGraphBounds(),m=Math.floor(100*Math.min((n-2*this.thumbBorder)/c.width,(t-2*this.thumbBorder)/c.height))/100;this.graph.view.scaleAndTranslate(m,Math.floor((n-c.width*m)/2/m-c.x),Math.floor((t-c.height*m)/2/m-c.y));var u=null;if(this.graph.dialect!=mxConstants.DIALECT_SVG||mxClient.NO_FO?(u=this.graph.container.cloneNode(!1)).innerHTML=this.graph.container.innerHTML:u=this.graph.view.getCanvas().ownerSVGElement.cloneNode(!0),this.graph.getModel().clear(),mxClient.NO_FO=d,mxClient.IS_IE6&&(a.style.backgroundImage="url("+this.editorUi.editor.transparentImage+")"),u.style.position="relative",u.style.overflow="hidden",u.style.cursor="move",u.style.left=this.thumbBorder+"px",u.style.top=this.thumbBorder+"px",u.style.width=n+"px",u.style.height=t+"px",u.style.visibility="",u.style.minWidth="",u.style.minHeight="",a.appendChild(u),this.sidebarTitles&&null!=i&&0!=o){var p=mxClient.IS_QUIRKS?2*this.thumbPadding+2:0;a.style.height=this.thumbHeight+p+this.sidebarTitleSize+8+"px";var g=document.createElement("div");g.style.fontSize=this.sidebarTitleSize+"px",g.style.color="#303030",g.style.textAlign="center",g.style.whiteSpace="nowrap",mxClient.IS_IE&&(g.style.height=this.sidebarTitleSize+12+"px"),g.style.paddingTop="4px",mxUtils.write(g,i),a.appendChild(g)}return c},Sidebar.prototype.createItem=function(n,t,a,e,i,s,o){var r=document.createElement("a");r.setAttribute("href","javascript:void(0);"),r.className="geItem",r.style.overflow="hidden";var l=mxClient.IS_QUIRKS?8+2*this.thumbPadding:2*this.thumbBorder;r.style.width=this.thumbWidth+l+"px",r.style.height=this.thumbHeight+l+"px",r.style.padding=this.thumbPadding+"px",mxEvent.addListener(r,"click",function(e){mxEvent.consume(e)}),this.createThumb(n,this.thumbWidth,this.thumbHeight,r,t,a,e,i,s);var d=new mxRectangle(0,0,i,s);if(1<n.length||n[0].vertex){var c=this.createDragSource(r,this.createDropHandler(n,!0,o,d),this.createDragPreview(i,s),n,d);this.addClickHandler(r,c,n),c.isGuidesEnabled=mxUtils.bind(this,function(){return this.editorUi.editor.graph.graphHandler.guidesEnabled})}else if(null!=n[0]&&n[0].edge){c=this.createDragSource(r,this.createDropHandler(n,!1,o,d),this.createDragPreview(i,s),n,d);this.addClickHandler(r,c,n)}return mxClient.IS_IOS||mxEvent.addGestureListeners(r,null,mxUtils.bind(this,function(e){this.showTooltip(r,n,d.width,d.height,t,a)})),r},Sidebar.prototype.createDropHandler=function(g,v,h,f){return h=null==h||h,mxUtils.bind(this,function(e,n,t,a,i){if(e.isEnabled()){if(0<(g=e.getImportableCells(g)).length){e.stopEditing();var s=null!=t&&e.isValidDropTarget(t,g,n),o=null;if(null==t||s||(t=null),!e.isCellLocked(t||e.getDefaultParent())){e.model.beginUpdate();try{if(a=Math.round(a),i=Math.round(i),v&&e.isSplitTarget(t,g,n)){var r=e.cloneCells(g);e.splitEdge(t,r,null,a-f.width/2,i-f.height/2),o=r}else 0<g.length&&(o=e.importCells(g,a,i,t));if(null!=e.layoutManager){var l=e.layoutManager.getLayout(t);if(null!=l)for(var d=e.view.scale,c=e.view.translate,m=(a+c.x)*d,u=(i+c.y)*d,p=0;p<o.length;p++)l.moveCell(o[p],m,u)}h&&e.fireEvent(new mxEventObject("cellsInserted","cells",o))}finally{e.model.endUpdate()}null!=o&&0<o.length&&(e.scrollCellToVisible(o[0]),e.setSelectionCells(o))}}mxEvent.consume(n)}})},Sidebar.prototype.createDragPreview=function(e,n){var t=document.createElement("div");return t.style.border="1px dashed black",t.style.width=e+"px",t.style.height=n+"px",t},Sidebar.prototype.createDragSource=function(e,n,t){var a=mxUtils.makeDraggable(e,this.editorUi.editor.graph,n,t,0,0,this.editorUi.editor.graph.autoscroll,!0,!0);return a.getDropTarget=function(e,n,t){var a=mxDragSource.prototype.getDropTarget.apply(this,arguments);return e.isValidRoot(a)||(a=null),a},a},Sidebar.prototype.addClickHandler=function(e,a){var i=this.editorUi.editor.graph,s=null;mxEvent.addGestureListeners(e,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e))});var o=a.mouseUp;a.mouseUp=function(e){if(!mxEvent.isPopupTrigger(e)&&null==this.currentGraph&&null!=s){var n=i.tolerance;if(Math.abs(s.x-mxEvent.getClientX(e))<=n&&Math.abs(s.y-mxEvent.getClientY(e))<=n){var t=i.getGridSize();a.drop(i,e,null,t,t)}}o.apply(this,arguments),s=null}},Sidebar.prototype.createVertexTemplateEntry=function(e,n,t,a,i,s,o,r){return r=null!=r&&0<r.length?r:i.toLowerCase(),this.addEntry(r,mxUtils.bind(this,function(){return this.createVertexTemplate(e,n,t,a,i,s,o)}))},Sidebar.prototype.createXmlDocument=function(e,n,t,a){var i=mxUtils.createXmlDocument().createElement(e);return i.setAttribute("label",n),t.forEach(function(e,n){i.setAttribute(e,a[n]?a[n]:"")}),i},Sidebar.prototype.createVertexTemplate=function(e,n,t,a,i,s,o,r){var l=[],d=[];switch(a){case"answer":l=["timeout"],d=["0"];break;case"start":l=["answer"],d=["yes"];break;case"googleasr":l=["key","google_asr_language","timeout","intKey","beep"],d=["","it-IT","10","#","BEEP"];break;case"tildeasr":l=["uri","appid","appsecret","timeout","intKey","beep"],d=["wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE","","","10","#","BEEP"];break;case"ispeechasr":l=["key","model","ispeech_asr_language","timeout","intKey","beep"],d=["","","it-IT","10","#","BEEP"];break;case"playback":l=["file_id","opts"],d=["0"];break;case"background":l=["file_id","response","digit"],d=["0","5","1"];break;case"menu":l=["file_id","response","digit","retry","variable_id"],d=["0","5","1","1","0"];break;case"getdigits":l=["file_id","response","mindigit","maxdigit","retry","variable_id"],d=["0","5","1","10","1","0"];break;case"getsecretdigits":l=["file_id","response","mindigit","maxdigit","retry","hiddendigitsnum","hiddendigitspos","variable_id"],d=["0","5","1","10","1","0","first","0"];break;case"custom_app":l=["application","options"],d=["",""];break;case"set":l=["variable_id","variable_value"],d=["0",""];break;case"database":l=["odbc_id","query","variable_id"],d=["0","",""];break;case"noop":l=["output"],d=[];break;case"gotoc":l=["context","extension","priority"],d=["","","1"];break;case"system":l=["variable_id","command"],d=[];break;case"agi":l=["command","args"],d=[];break;case"gotoif":l=["condition"],d=[];break;case"gotoiftime":l=["interval_id"],d=["0"];break;case"vswitch":l=["variable_id"],d=["0"];break;case"saydigits":l=["digits","escape_digits"],d=["","#"];break;case"saynumber":l=["number","escape_digits"],d=["","#"];break;case"sayphonetic":l=["text","escape_digits"],d=["","#"];break;case"record":l=["file","recordingFormat","timeout","escape_digits"],d=["","wav","-1","#"];break;case"dial":l=["sip_id","timeout","opts","url"],d=["0","60"];break;case"ext_dial":l=["phone","trunk_name","timeout","opts","url"],d=["","","60"];break;case"google_cloud_tts":l=["apiKey","google_cloud_tts_text_type","text","languageCode","ssmlGender"],d=["","text","","en-US","FEMALE"];break;case"tts":l=["text","google_tts_language"],d=["","it"];break;case"ispeechtts":l=["text","key","ispeech_tts_language","speed","intKey"],d=["","","euritalianfemale","0","#"];break;case"lumenvoxtts":case"sestektts":l=["text","options"],d=["",""];break;case"lumenvoxasr":l=["grammar","options"],d=["",""];break;case"sestekasr":l=["grammar","options"],d=["/usr/local/unimrcp/data/grammar.xml",""];break;case"awspolly":l=["aws_access_key_id","aws_secret_access_key","aws_polly_region","aws_polly_voice","text","aws_text_type"],d=["","","eu-west-1","Amy","","text"];break;case"awslex":l=["aws_access_key_id","aws_secret_access_key","aws_lex_region","aws_bot_name","text"],d=["","","eu-west-1","",""];break;case"queue":l=["queue_id","opts","url","file_id","timeout","agi","macro","gosub","position"],d=["-1","xX","","","300"];break;case"voicemail":l=["mailbox","options"],d=["",""];break;case"subproject":l=["project_id"],d=["0"];break;case"math":l=["operation","variable_id"],d=["","0"];break;case"queuelog":l=["queuename","agent","queue_event","data1","data2","data3","data4","data5"],d=[];break;case"goal":l=["goalname"],d=[];break;case"callback":l=["name","lastName","phone","dialTimezone","list_id","delay","callback_priority"],d=["{CALLERID(name)}","","{CALLERID(num)}","","-1","5","2"];break;case"sendSMS":l=["sms_account_id","to","sms_text"],d=["0"];break;case"sendMail":l=["account_id","to","cc","bcc","subject","text"],d=["0"];break;case"sendFax":l=["account_id","to","choose_attachment","attachment_name","attachment_type","attachment_path"],d=["0"];break;case"login":case"unpause":case"logout":l=["findBy"],d=["internal"];break;case"pause":l=["findBy","pause_id"],d=["internal",""];break;case"dialogflow":l=["key","text","dialogflow_language"],d=["","","it"];break;case"sesteknda":l=["ndauth_url","username","password","ndassistant_url","text","project","ndagenerate_audio","custom_action","custom_action_data","ndaactivity_type"],d=["","","","","","",1,"","","message"];break;case"restapi":l=["url","method","timeout","computedVariables","rawHeaders","rawBody","variable_id"],d=["","GET","5","","","",""];break;case"mrcpsynth":l=["text","options"],d=["",""];break;case"mrcprecog":l=["grammar","options"],d=["",""];break;case"dialogflowV2":l=["dialogflowV2_project_id","client_email","private_key","dialogflowV2_language","text"],d=["","","","en",""];break;default:l=[],d=[]}var c=[new mxCell(this.createXmlDocument(a,i,l,d),new mxGeometry(0,0,n,t),e)];return c[0].vertex=!0,this.createVertexTemplateFromCells(c,n,t,i,s,o,r)},Sidebar.prototype.createVertexTemplateFromCells=function(e,n,t,a,i,s,o){return this.createItem(e,a,i,s,n,t,o)},Sidebar.prototype.createEdgeTemplate=function(e,n,t,a,i,s,o){var r=new mxCell(null!=a?a:"",new mxGeometry(0,0,n,t),e);return r.geometry.setTerminalPoint(new mxPoint(0,t),!0),r.geometry.setTerminalPoint(new mxPoint(n,0),!1),r.geometry.relative=!0,r.edge=!0,this.createEdgeTemplateFromCells([r],n,t,i,s,o)},Sidebar.prototype.createEdgeTemplateFromCells=function(e,n,t,a,i,s){return this.createItem(e,a,i,!0,n,t,s)},Sidebar.prototype.addPaletteFunctions=function(e,n,t,a){this.addPalette(e,n,t,mxUtils.bind(this,function(e){for(var n=0;n<a.length;n++)e.appendChild(a[n](e))}))},Sidebar.prototype.addPalette=function(e,n,t,a){var i=this.createTitle(n);this.container.appendChild(i);var s=document.createElement("div");s.className="geSidebar",mxClient.IS_POINTER&&(s.style.touchAction="none"),mxEvent.addListener(s,"mousemove",mxUtils.bind(this,function(e){mxEvent.getSource(e)==s?s.setAttribute("title",mxResources.get("sidebarTooltip")):s.removeAttribute("title")})),t?(a(s),a=null):s.style.display="none",this.addFoldingHandler(i,s,a);var o=document.createElement("div");return o.appendChild(s),this.container.appendChild(o),null!=e&&(this.palettes[e]=[i,o]),s},Sidebar.prototype.addFoldingHandler=function(t,a,i){var s=!1;(!mxClient.IS_IE||8<=document.documentMode)&&(t.style.backgroundImage="none"==a.style.display?"url('"+this.collapsedImage+"')":"url('"+this.expandedImage+"')"),t.style.backgroundRepeat="no-repeat",t.style.backgroundPosition="0% 50%",mxEvent.addListener(t,"click",mxUtils.bind(this,function(e){if("none"==a.style.display){if(s)a.style.display="block";else if(s=!0,null!=i){t.style.cursor="wait";var n=t.innerHTML;t.innerHTML=mxResources.get("loading")+"...",window.setTimeout(function(){var e=mxClient.NO_FO;mxClient.NO_FO=Editor.prototype.originalNoForeignObject,i(a),mxClient.NO_FO=e,a.style.display="block",t.style.cursor="",t.innerHTML=n},0)}else a.style.display="block";t.style.backgroundImage="url('"+this.expandedImage+"')"}else t.style.backgroundImage="url('"+this.collapsedImage+"')",a.style.display="none";mxEvent.consume(e)}))},Sidebar.prototype.addImagePalette=function(e,n,s,o,r,t,a){for(var l=[],d=0;d<r.length;d++)mxUtils.bind(this,function(e,n,t){if(null==t){var a=e.lastIndexOf("/"),i=e.lastIndexOf(".");t=e.substring(0<=a?a+1:0,0<=i?i:e.length).replace(/[-_]/g," ")}l.push(this.createVertexTemplateEntry("image;html=1;image="+s+e+o,this.defaultImageWidth,this.defaultImageHeight,r[d],n,!1,!0,this.filterTags(t)))})(r[d],null!=t?t[d]:null,null!=a?a[r[d]]:null);this.addPaletteFunctions(e,n,!1,l)},"undefined"!=typeof html4&&(html4.ATTRIBS["a::target"]=0),mxConstants.SHADOW_OPACITY=.25,mxConstants.SHADOWCOLOR="#000000",mxConstants.VML_SHADOWCOLOR="#d0d0d0",mxGraph.prototype.pageBreakColor="#c0c0c0",mxGraph.prototype.pageScale=1,function(){try{if(null!=navigator&&null!=navigator.language){var e=navigator.language.toLowerCase();mxGraph.prototype.pageFormat="en-us"===e||"en-ca"===e||"es-mx"===e?mxConstants.PAGE_FORMAT_LETTER_PORTRAIT:mxConstants.PAGE_FORMAT_A4_PORTRAIT}}catch(e){}}(),mxText.prototype.baseSpacingTop=5,mxText.prototype.baseSpacingBottom=1,mxGraphModel.prototype.ignoreRelativeEdgeParent=!1,mxGraphView.prototype.gridImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhCgAKAJEAAAAAAP///8zMzP///yH5BAEAAAMALAAAAAAKAAoAAAIJ1I6py+0Po2wFADs=":IMAGE_PATH+"/grid.gif",mxGraphView.prototype.gridSteps=4,mxGraphView.prototype.minGridSize=4,mxGraphView.prototype.gridColor="#e0e0e0",mxSvgCanvas2D.prototype.foAltText="[Not supported by viewer]",Graph=function(e,n,t,a){mxGraph.call(this,e,n,t,a),this.setConnectable(!0),this.setDropEnabled(!1),this.setPanning(!0),this.setTooltips(!mxClient.IS_TOUCH),this.setAllowLoops(!1),this.setMultigraph(!1),this.allowAutoPanning=!0,this.resetEdgesOnConnect=!1,this.constrainChildren=!1,this.connectionHandler.targetConnectImage=!0,this.setAllowDanglingEdges(!1),this.connectionHandler.setCreateTarget(!1),this.connectionHandler.isValidSource=function(){return mxConnectionHandler.prototype.isValidSource.apply(this,arguments)&&"2"!=urlParams.connect},this.alternateEdgeStyle="vertical",null==a&&this.loadStylesheet();var i=new mxRubberband(this);this.getRubberband=function(){return i},this.panningHandler.addListener(mxEvent.PAN_START,mxUtils.bind(this,function(){this.container.style.cursor="pointer"})),this.panningHandler.addListener(mxEvent.PAN_END,mxUtils.bind(this,function(){this.container.style.cursor="default"})),this.isHtmlLabel=function(e){var n=this.view.getState(e),t=null!=n?n.style:this.getCellStyle(e);return"1"==t.html||"wrap"==t.whiteSpace},this.cellRenderer.getLabelValue=function(e){var n=mxCellRenderer.prototype.getLabelValue.apply(this,arguments);return"wrap"==e.style.whiteSpace&&1!=e.style.html&&(n=mxUtils.htmlEntities(n,!1)),n},this.isCellLocked=function(e){return!1},this.connectionHandler.tapAndHoldTolerance=16;var s=this.connectionHandler.tapAndHold;this.connectionHandler.tapAndHold=function(e,n){null==n?this.graph.panningHandler.active||(i.start(e.getGraphX(),e.getGraphY()),this.graph.panningHandler.panningTrigger=!1):tapAndHoldStartsConnection?s.apply(this,arguments):this.graph.isCellSelected(n.cell)&&1<this.graph.getSelectionCount()&&this.graph.removeSelectionCell(n.cell)},touchStyle&&this.initTouch()},mxUtils.extend(Graph,mxGraph),Graph.prototype.minFitScale=null,Graph.prototype.maxFitScale=null,Graph.prototype.loadStylesheet=function(){var e=mxUtils.load(STYLE_PATH+"/default.xml").getDocumentElement();new mxCodec(e.ownerDocument).decode(e,this.getStylesheet())},Graph.prototype.flipEdge=function(e){if(null!=e){var n=this.view.getState(e),t=null!=n?n.style:this.getCellStyle(e);if(null!=t){var a=mxUtils.getValue(t,mxConstants.STYLE_ELBOW,mxConstants.ELBOW_HORIZONTAL)==mxConstants.ELBOW_HORIZONTAL?mxConstants.ELBOW_VERTICAL:mxConstants.ELBOW_HORIZONTAL;this.setCellStyles(mxConstants.STYLE_ELBOW,a,[e])}}},Graph.prototype.setDefaultEdge=function(e){if(null!=e&&this.getModel().isEdge(e)){var n=this.getModel().cloneCells([e])[0];null!=n.geometry&&(n.geometry.points=null);var t=n.getStyle();t=mxUtils.setStyle(t,mxConstants.STYLE_ENTRY_X,null),t=mxUtils.setStyle(t,mxConstants.STYLE_ENTRY_Y,null),t=mxUtils.setStyle(t,mxConstants.STYLE_EXIT_X,null),t=mxUtils.setStyle(t,mxConstants.STYLE_EXIT_Y,null),n.setStyle(t),this.connectionHandler.createEdgeState=function(e){return this.graph.view.createState(n)},this.connectionHandler.factoryMethod=function(){return this.graph.cloneCells([n])[0]}}},Graph.prototype.isCellFoldable=function(e){return this.foldingEnabled&&this.isSwimlane(e)},Graph.prototype.isValidRoot=function(e){return this.isSwimlane(e)},Graph.prototype.createGroupCell=function(){var e=mxGraph.prototype.createGroupCell.apply(this,arguments);return e.setStyle("group"),e},Graph.prototype.getTooltipForCell=function(e){var n="";return this.getModel().isVertex(e)?n+=mxResources.get("description_"+e.value.nodeName)||"":this.getModel().isEdge(e)&&(n=mxGraph.prototype.getTooltipForCell.apply(this,arguments)),n},Graph.prototype.convertValueToString=function(e){return null!=e.value&&"object"==typeof e.value?e.value.getAttribute("label"):mxGraph.prototype.convertValueToString.apply(this,arguments)},Graph.prototype.cellLabelChanged=function(e,n,t){if(null!=e.value&&"object"==typeof e.value){var a=e.value.cloneNode(!0);a.setAttribute("label",n),n=a}mxGraph.prototype.cellLabelChanged.apply(this,arguments)},Graph.prototype.setLinkForCell=function(e,n){var t=null;null!=e.value&&"object"==typeof e.value?t=e.value.cloneNode(!0):(t=mxUtils.createXmlDocument().createElement("UserObject")).setAttribute("label",e.value);null!=n&&0<n.length?t.setAttribute("link",n):t.removeAttribute("link"),this.model.setValue(e,t)},Graph.prototype.getLinkForCell=function(e){return null!=e.value&&"object"==typeof e.value?e.value.getAttribute("link"):null},Graph.prototype.initTouch=function(){this.connectionHandler.marker.isEnabled=function(){return null!=this.graph.connectionHandler.first},this.addListener(mxEvent.START_EDITING,function(e,n){this.panningHandler.hideMenu()});var s=!1,o=null;this.updateMouseEvent=function(e){if(mxGraph.prototype.updateMouseEvent.apply(this,arguments),null==e.getState()){var n=this.getCellAt(e.graphX,e.graphY);this.getModel().isEdge(n)&&(e.state=this.view.getState(n),null!=e.state&&null!=e.state.shape&&(this.container.style.cursor=e.state.shape.node.style.cursor))}null==e.getState()&&(this.container.style.cursor="default")},this.fireMouseEvent=function(e,n,t){if(e==mxEvent.MOUSE_DOWN)this.panningHandler.isMenuShowing()?(s=!1,o=null):(o=n.getCell(),s=null!=o?this.isCellSelected(o):this.isSelectionEmpty());else if(e==mxEvent.MOUSE_UP){if(s&&!this.isEditing()){if(!this.panningHandler.isMenuShowing()){var a=mxEvent.getClientX(n.getEvent()),i=mxEvent.getClientY(n.getEvent());this.panningHandler.popup(a+16,i,o,n.getEvent())}return s=!1,o=null,void n.consume()}s=!1,o=null}mxGraph.prototype.fireMouseEvent.apply(this,arguments),e==mxEvent.MOUSE_MOVE&&n.isConsumed()&&(s=!1,o=null)}},function(){if(mxVertexHandler.prototype.rotationEnabled=!0,mxText.prototype.baseSpacingTop=5,mxText.prototype.baseSpacingBottom=1,touchStyle){mxConstants.HANDLE_SIZE=16,mxConstants.LABEL_HANDLE_SIZE=7,mxClient.IS_TOUCH&&(mxVertexHandler.prototype.tolerance=4,mxEdgeHandler.prototype.tolerance=6,Graph.prototype.tolerance=14,Graph.prototype.gridSize=20,mxPanningHandler.prototype.selectOnPopup=!1,mxPanningHandler.prototype.useLeftButtonForPanning=!0,mxPanningHandler.prototype.isPanningTrigger=function(e){var n=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())||mxEvent.isControlDown(n)&&mxEvent.isShiftDown(n)||this.usePopupTrigger&&mxEvent.isPopupTrigger(n)});var t=mxGraphHandler.prototype.mouseDown;mxGraphHandler.prototype.mouseDown=function(e,n){t.apply(this,arguments),this.graph.isCellSelected(n.getCell())&&1<this.graph.getSelectionCount()&&(this.delayedSelection=!1)},Graph.prototype.createHandlers=function(e){this.tooltipHandler=new mxTooltipHandler(this),this.tooltipHandler.setEnabled(!1),this.selectionCellsHandler=new mxSelectionCellsHandler(this),this.panningHandler=new mxPanningHandler(this),this.panningHandler.panningEnabled=!1,this.connectionHandler=new mxConnectionHandler(this),this.connectionHandler.setEnabled(!1),this.graphHandler=new mxGraphHandler(this)},mxConnectionHandler.prototype.selectCells=function(e,n){touchStyle&&null!=n?this.graph.setSelectionCell(n):this.graph.setSelectionCell(e)};var a=mxGraph.prototype.dblClick;Graph.prototype.dblClick=function(e,n){if(null==n){var t=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e));n=this.getCellAt(t.x,t.y)}a.call(this,e,n)};var e=new mxImage(IMAGE_PATH+"/touch-handle.png",16,16);mxVertexHandler.prototype.handleImage=e,mxEdgeHandler.prototype.handleImage=e,mxOutline.prototype.sizerImage=e,(new Image).src=e.src;var n=IMAGE_PATH+"/touch-connector.png",i=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){i.apply(this,arguments),showConnectorImg&&this.graph.connectionHandler.isEnabled()&&this.graph.isCellConnectable(this.state.cell)&&!this.graph.isValidRoot(this.state.cell)&&1==this.graph.getSelectionCount()&&(this.connectorImg=mxUtils.createImage(n),this.connectorImg.style.cursor="pointer",this.connectorImg.style.width="29px",this.connectorImg.style.height="29px",this.connectorImg.style.position="absolute",mxClient.IS_TOUCH||(this.connectorImg.setAttribute("title",mxResources.get("connect")),mxEvent.redirectMouseEvents(this.connectorImg,this.graph,this.state)),this.connectorImg.style.padding="2px",mxEvent.addGestureListeners(this.connectorImg,mxUtils.bind(this,function(e){this.graph.panningHandler.hideMenu();var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,n.x,n.y),this.graph.isMouseDown=!0,mxEvent.consume(e)})),this.graph.container.appendChild(this.connectorImg)),this.redrawTools()};var s=mxVertexHandler.prototype.redraw;mxVertexHandler.prototype.redraw=function(){s.apply(this),this.redrawTools()},mxVertexHandler.prototype.redrawTools=function(){null!=this.state&&null!=this.connectorImg&&(mxVertexHandler.prototype.singleSizer?(this.connectorImg.style.left=this.state.x+this.state.width-this.connectorImg.offsetWidth/2+"px",this.connectorImg.style.top=this.state.y-this.connectorImg.offsetHeight/2+"px"):(this.connectorImg.style.left=this.state.x+this.state.width+mxConstants.HANDLE_SIZE/2+4+"px",this.connectorImg.style.top=this.state.y+(this.state.height-this.connectorImg.offsetHeight)/2+"px"))};var o=mxVertexHandler.prototype.destroy;mxVertexHandler.prototype.destroy=function(e,n){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)},(new Image).src=n}else{var r=new mxImage(IMAGE_PATH+"/connector.png",15,15);if(mxConnectionHandler.prototype.connectImage=r,(new Image).src=r.src,"2"==urlParams.connect){r=new mxImage(IMAGE_PATH+"/connector.png",15,15),i=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){i.apply(this,arguments),showConnectorImg&&this.graph.connectionHandler.isEnabled()&&this.graph.isCellConnectable(this.state.cell)&&!this.graph.isValidRoot(this.state.cell)&&1==this.graph.getSelectionCount()&&(mxClient.IS_IE&&!mxClient.IS_SVG?(this.connectorImg=document.createElement("div"),this.connectorImg.style.backgroundImage="url("+r.src+")",this.connectorImg.style.backgroundPosition="center",this.connectorImg.style.backgroundRepeat="no-repeat",this.connectorImg.style.width=r.width+4+"px",this.connectorImg.style.height=r.height+4+"px",this.connectorImg.style.display=mxClient.IS_QUIRKS?"inline":"inline-block"):(this.connectorImg=mxUtils.createImage(r.src),this.connectorImg.style.width=r.width+"px",this.connectorImg.style.height=r.height+"px"),this.connectorImg.style.cursor="pointer",this.connectorImg.style.position="absolute",this.connectorImg.setAttribute("title",mxResources.get("connect")),mxEvent.redirectMouseEvents(this.connectorImg,this.graph,this.state),this.connectorImg.style.padding="2px",mxEvent.addListener(this.connectorImg,"mousedown",mxUtils.bind(this,function(e){this.graph.panningHandler.hideMenu();var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,n.x,n.y),this.graph.isMouseDown=!0,mxEvent.consume(e)})),this.graph.container.appendChild(this.connectorImg)),this.redrawTools()};s=mxVertexHandler.prototype.redraw;mxVertexHandler.prototype.redraw=function(){s.apply(this),this.redrawTools()},mxVertexHandler.prototype.redrawTools=function(){null!=this.state&&null!=this.connectorImg&&(mxVertexHandler.prototype.singleSizer?(this.connectorImg.style.left=this.state.x+this.state.width-this.connectorImg.offsetWidth/2+"px",this.connectorImg.style.top=this.state.y-this.connectorImg.offsetHeight/2+"px"):(this.connectorImg.style.left=this.state.x+this.state.width+mxConstants.HANDLE_SIZE/2+2+"px",this.connectorImg.style.top=this.state.y+(this.state.height-this.connectorImg.offsetHeight)/2+"px"))};o=mxVertexHandler.prototype.destroy;mxVertexHandler.prototype.destroy=function(e,n){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)}}}}(),Actions.prototype.init=function(){var n=this.editorUi,l=n.editor,d=l.graph;this.addAction("new",function(){n.projectDesignController.newProject()},CRUD_PERMISSIONS.canEdit),this.addAction("open",function(){n.projectDesignController.openProject()},CRUD_PERMISSIONS.canEdit),this.addAction("save",function(){n.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml())),n.editor.modified=!1},CRUD_PERMISSIONS.canEdit,null,"Ctrl+S"),this.addAction("saveAs",function(){n.projectDesignController.saveProjectAs(mxUtils.getPrettyXml(l.getGraphXml()))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+S"),this.addAction("publish",function(){n.editor.setStatus(""),null===n.validate()?(n.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml()),!0),n.editor.modified=!1):(n.editor.setStatus("...Error publishing! Please check the project and try again!"),setTimeout(function(){n.editor.setStatus("")},3e3))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+P"),this.addAction("variable",function(){n.projectDesignController.newVariable()},CRUD_PERMISSIONS.canEdit),this.addAction("import",function(){n.projectDesignController.importXML(function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("export",function(){n.exportXML(mxUtils.getPrettyXml(l.getGraphXml()))},null,null,"Ctrl+E"),this.addAction("editFile",function(){n.projectDesignController.editXML(mxUtils.getPrettyXml(l.getGraphXml()),function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("print",function(){mxUtils.printScreen(d)},null,"sprite-print","Ctrl+P"),this.addAction("preview",function(){mxUtils.show(d,null,10,10)}),this.addAction("undo",function(){l.undoManager.undo()},null,"sprite-undo","Ctrl+Z"),this.addAction("redo",function(){l.undoManager.redo()},null,"sprite-redo","Ctrl+Y"),this.addAction("cut",function(){mxClipboard.cut(d)},null,"sprite-cut","Ctrl+X"),this.addAction("copy",function(){mxClipboard.copy(d)},null,"sprite-copy","Ctrl+C"),this.addAction("paste",function(){mxClipboard.paste(d)},!1,"sprite-paste","Ctrl+V"),this.addAction("delete",function(){d.removeCells()},null,null,"Delete"),this.addAction("duplicate",function(){var e=d.gridSize;d.setSelectionCells(d.moveCells(d.getSelectionCells(),e,e,!0))},null,null,"Ctrl+D"),this.addAction("selectVertices",function(){d.selectVertices()},null,null,"Ctrl+Shift+V"),this.addAction("selectEdges",function(){d.selectEdges()},null,null,"Ctrl+Shift+E"),this.addAction("selectAll",function(){d.selectAll()},null,null,"Ctrl+A"),this.addAction("home",function(){d.home()},null,null,"Home"),this.addAction("exitGroup",function(){d.exitGroup()},null,null,"Page Up"),this.addAction("enterGroup",function(){d.enterGroup()},null,null,"Page Down"),this.addAction("expand",function(){d.foldCells(!1)},null,null,"Enter"),this.addAction("collapse",function(){d.foldCells(!0)},null,null,"Backspace"),this.addAction("toFront",function(){d.orderCells(!1)},null,null,"Ctrl+F"),this.addAction("toBack",function(){d.orderCells(!0)},null,null,"Ctrl+B"),this.addAction("group",function(){d.setSelectionCell(d.groupCells(null,0))},null,null,"Ctrl+G"),this.addAction("ungroup",function(){d.setSelectionCells(d.ungroupCells())},null,null,"Ctrl+U"),this.addAction("removeFromGroup",function(){d.removeCellsFromParent()}),this.addAction("editLink",function(){var e=d.getSelectionCell(),n=d.getLinkForCell(e);null==n&&(n=""),null!=(n=mxUtils.prompt(mxResources.get("enterValue"),n))&&d.setLinkForCell(e,n)}),this.addAction("openLink",function(){var e=d.getSelectionCell(),n=d.getLinkForCell(e);null!=n&&window.open(n)}),this.addAction("autosize",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var n=0;n<e.length;n++){var t=e[n];d.getModel().getChildCount(t)?d.updateGroupBounds([t],20):d.updateCellSize(t)}}finally{d.getModel().endUpdate()}}}),this.addAction("wordWrap",function(){var e=d.getView().getState(d.getSelectionCell()),n="wrap";null!=e&&"wrap"==e.style[mxConstants.STYLE_WHITE_SPACE]&&(n=null),d.setCellStyles(mxConstants.STYLE_WHITE_SPACE,n)}),this.addAction("rotation",function(){var e="0",n=d.getView().getState(d.getSelectionCell());null!=n&&(e=n.style[mxConstants.STYLE_ROTATION]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("rotation")+" 0-360)",e))&&d.setCellStyles(mxConstants.STYLE_ROTATION,e)}),this.addAction("tilt",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var n=0;n<e.length;n++){var t=e[n];if(d.getModel().isVertex(t)&&0==d.getModel().getChildCount(t)){var a=d.getCellGeometry(t);if(null!=a){(a=a.clone()).x+=a.width/2-a.height/2,a.y+=a.height/2-a.width/2;var i=a.width;a.width=a.height,a.height=i,d.getModel().setGeometry(t,a);var s=d.view.getState(t);if(null!=s){var o=s.style[mxConstants.STYLE_DIRECTION]||"east";"east"==o?o="south":"south"==o?o="west":"west"==o?o="north":"north"==o&&(o="east"),d.setCellStyles(mxConstants.STYLE_DIRECTION,o,[t])}}}}}finally{d.getModel().endUpdate()}}},null,null,"Ctrl+R"),this.addAction("actualSize",function(){d.zoomTo(1)}),this.addAction("zoomIn",function(){d.zoomIn()},null,null,"Add"),this.addAction("zoomOut",function(){d.zoomOut()},null,null,"Subtract"),this.addAction("fitWindow",function(){d.fit()}),this.addAction("fitPage",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,n=d.pageScale,t=d.container.clientWidth-20,a=d.container.clientHeight-20,i=Math.floor(100*Math.min(t/e.width/n,a/e.height/n))/100;d.zoomTo(i),d.container.scrollLeft=Math.round(d.view.translate.x*i-Math.max(10,(d.container.clientWidth-e.width*n*i)/2)),d.container.scrollTop=Math.round(d.view.translate.y*i-Math.max(10,(d.container.clientHeight-e.height*n*i)/2))})),this.addAction("fitPageWidth",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,n=d.pageScale,t=d.container.clientWidth-20,a=Math.floor(100*t/e.width/n)/100;d.zoomTo(a),d.container.scrollLeft=Math.round(d.view.translate.x*a-Math.max(10,(d.container.clientWidth-e.width*n*a)/2)),d.container.scrollTop=Math.round(d.view.translate.y*a-Math.max(10,(d.container.clientHeight-e.height*n*a)/2))})),this.put("customZoom",new Action(mxResources.get("custom"),function(){var e=mxUtils.prompt(mxResources.get("enterValue")+" (%)",parseInt(100*d.getView().getScale()));null!=e&&0<e.length&&!isNaN(parseInt(e))&&d.zoomTo(parseInt(e)/100)}));var e=null;(e=this.addAction("grid",function(){d.setGridEnabled(!d.isGridEnabled()),l.updateGraphComponents()},null,null,"Ctrl+Shift+G")).setToggleAction(!0),e.setSelectedCallback(function(){return d.isGridEnabled()}),(e=this.addAction("guides",function(){d.graphHandler.guidesEnabled=!d.graphHandler.guidesEnabled})).setToggleAction(!0),e.setSelectedCallback(function(){return d.graphHandler.guidesEnabled}),(e=this.addAction("tooltips",function(){d.tooltipHandler.setEnabled(!d.tooltipHandler.isEnabled())})).setToggleAction(!0),e.setSelectedCallback(function(){return d.tooltipHandler.isEnabled()}),(e=this.addAction("navigation",function(){d.foldingEnabled=!d.foldingEnabled,d.view.revalidate()})).setToggleAction(!0),e.setSelectedCallback(function(){return d.foldingEnabled}),(e=this.addAction("scrollbars",function(){if(d.scrollbars=!d.scrollbars,l.updateGraphComponents(),d.scrollbars){var e=d.view.translate.x,n=d.view.translate.y;d.view.translate.x=0,d.view.translate.y=0,d.sizeDidChange(),d.container.scrollLeft-=Math.round(e*d.view.scale),d.container.scrollTop-=Math.round(n*d.view.scale)}else{var t=d.view.translate;d.view.setTranslate(t.x-d.container.scrollLeft/d.view.scale,t.y-d.container.scrollTop/d.view.scale),d.container.scrollLeft=0,d.container.scrollTop=0,d.sizeDidChange()}},!mxClient.IS_TOUCH)).setToggleAction(!0),e.setSelectedCallback(function(){return"auto"==d.container.style.overflow}),(e=this.addAction("pageView",mxUtils.bind(this,function(){d.pageVisible=!d.pageVisible,d.pageBreaksVisible=d.pageVisible,d.preferPageSize=d.pageBreaksVisible,d.view.validate(),d.sizeDidChange(),l.updateGraphComponents(),l.outline.update(),mxUtils.hasScrollbars(d.container)&&(d.pageVisible?(d.container.scrollLeft-=20,d.container.scrollTop-=20):(d.container.scrollLeft+=20,d.container.scrollTop+=20))}))).setToggleAction(!0),e.setSelectedCallback(function(){return d.pageVisible}),(e=this.addAction("connect",function(){d.setConnectable(!d.connectionHandler.isEnabled())},null,null,"Ctrl+Q")).setToggleAction(!0),e.setSelectedCallback(function(){return d.connectionHandler.isEnabled()}),(e=this.addAction("copyConnect",function(){d.connectionHandler.setCreateTarget(!d.connectionHandler.isCreateTarget())})).setToggleAction(!0),e.setSelectedCallback(function(){return d.connectionHandler.isCreateTarget()}),this.addAction("help",function(){window.open("https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896251872/Cally+Square")}),this.put("about",new Action(mxResources.get("about")+" Cally Square",function(){window.open("http://callysquare.com/")},null,null,null));var t=mxUtils.bind(this,function(e,n){this.addAction(e,function(){d.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,n)})});t("bold",mxConstants.FONT_BOLD),t("italic",mxConstants.FONT_ITALIC),t("underline",mxConstants.FONT_UNDERLINE),this.addAction("shadow",function(){d.toggleCellStyles(mxConstants.STYLE_SHADOW)}),this.addAction("dashed",function(){d.toggleCellStyles(mxConstants.STYLE_DASHED)}),this.addAction("rounded",function(){d.toggleCellStyles(mxConstants.STYLE_ROUNDED)}),this.addAction("curved",function(){d.toggleCellStyles(mxConstants.STYLE_CURVED)}),this.addAction("style",function(){var e=d.getSelectionCells();if(null!=e&&0<e.length){var n=d.getModel(),t=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("style")+")",n.getStyle(e[0])||"");null!=t&&d.setCellStyle(t,e)}}),this.addAction("setAsDefaultEdge",function(){d.setDefaultEdge(d.getSelectionCell())}),this.addAction("addWaypoint",function(){var e=d.getSelectionCell();if(null!=e&&d.getModel().isEdge(e)){var n=l.graph.selectionCellsHandler.getHandler(e);if(n instanceof mxEdgeHandler){var t=d.view.translate,a=d.view.scale,i=t.x,s=t.y,o=d.getModel().getParent(e),r=d.getCellGeometry(o);d.getModel().isVertex(o)&&null!=r&&(i+=r.x,s+=r.y),n.addPointAt(n.state,d.panningHandler.triggerX/a-i,d.panningHandler.triggerY/a-s)}}}),this.addAction("removeWaypoint",function(){var e=n.actions.get("removeWaypoint");null!=e.handler&&e.handler.removePoint(e.handler.state,e.index)}),this.addAction("image",function(){var e="",n=d.getView().getState(d.getSelectionCell());if(null!=n&&(e=n.style[mxConstants.STYLE_IMAGE]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("url")+")",e))&&0<e.length){var t=new Image;t.onload=function(){!function(e,n,t){var a=null,i=d.getSelectionCells();d.getModel().beginUpdate();try{if(0==i.length){var s=d.getGridSize();a=i=[d.insertVertex(d.getDefaultParent(),null,"",s,s,n,t)]}if(d.setCellStyles(mxConstants.STYLE_IMAGE,e,i),d.setCellStyles(mxConstants.STYLE_SHAPE,"image",i),1==d.getSelectionCount()&&null!=n&&null!=t){var o=i[0],r=d.getModel().getGeometry(o);null!=r&&((r=r.clone()).width=n,r.height=t,d.getModel().setGeometry(o,r))}}finally{d.getModel().endUpdate()}null!=a&&(d.setSelectionCells(a),d.scrollCellToVisible(a[0]))}(e,t.width,t.height)},t.onerror=function(){mxUtils.alert(mxResources.get("fileNotFound"))},t.src=e}})},Actions.prototype.addAction=function(e,n,t,a,i){return this.put(e,new Action(mxResources.get(e),n,t,a,i))},Actions.prototype.put=function(e,n){return this.actions[e]=n},Actions.prototype.get=function(e){return this.actions[e]},mxUtils.extend(Action,mxEventSource),Action.prototype.setEnabled=function(e){this.enabled!=e&&(this.enabled=e,this.fireEvent(new mxEventObject("stateChanged")))},Action.prototype.setToggleAction=function(e){this.toggleAction=e},Action.prototype.setSelectedCallback=function(e){this.selectedCallback=e},Action.prototype.isSelected=function(){return this.selectedCallback()},Menus=function(e){this.editorUi=e,this.menus=new Object,this.init(),(new Image).src=IMAGE_PATH+"/checkmark.gif"},Menus.prototype.init=function(){var i=this.editorUi.editor.graph;this.put("fontFamily",new Menu(mxUtils.bind(this,function(e,n){for(var t=["Helvetica","Verdana","Times New Roman","Garamond","Comic Sans MS","Courier New","Georgia","Lucida Console","Tahoma"],a=0;a<t.length;a++){this.styleChange(e,t[a],[mxConstants.STYLE_FONTFAMILY],[t[a]],null,n).firstChild.nextSibling.style.fontFamily=t[a]}e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"",mxConstants.DEFAULT_FONTFAMILY,mxConstants.STYLE_FONTFAMILY,n)}))),this.put("fontSize",new Menu(mxUtils.bind(this,function(e,n){for(var t=[6,8,9,10,11,12,14,18,24,36,48,72],a=0;a<t.length;a++)this.styleChange(e,t[a],[mxConstants.STYLE_FONTSIZE],[t[a]],null,n);e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"(pt)","12",mxConstants.STYLE_FONTSIZE,n)}))),this.put("linewidth",new Menu(mxUtils.bind(this,function(e,n){for(var t=[1,2,3,4,8,12,16,24],a=0;a<t.length;a++)this.styleChange(e,t[a]+"px",[mxConstants.STYLE_STROKEWIDTH],[t[a]],null,n);e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"(px)","1",mxConstants.STYLE_STROKEWIDTH,n)}))),this.put("line",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("straight"),[mxConstants.STYLE_EDGE],[null],null,n),this.styleChange(e,mxResources.get("entityRelation"),[mxConstants.STYLE_EDGE],["entityRelationEdgeStyle"],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("horizontal"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","horizontal"],null,n),this.styleChange(e,mxResources.get("vertical"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","vertical"],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("manual"),[mxConstants.STYLE_EDGE],["segmentEdgeStyle"],null,n),this.styleChange(e,mxResources.get("automatic"),[mxConstants.STYLE_EDGE],["orthogonalEdgeStyle"],null,n)}))),this.put("lineend",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_CLASSIC],null,n),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OPEN],null,n),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_BLOCK],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OVAL],null,n),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND],null,n),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND_THIN],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_ENDARROW],[mxConstants.NONE],null,n),e.addSeparator(n),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("endFill",!0)},n,null,!0),e.addSeparator(n),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_ENDSIZE,n)}))),this.put("linestart",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_CLASSIC],null,n),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OPEN],null,n),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_BLOCK],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OVAL],null,n),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND],null,n),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND_THIN],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_STARTARROW],[mxConstants.NONE],null,n),e.addSeparator(n),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("startFill",!0)},n,null,!0),e.addSeparator(n),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_STARTSIZE,n)}))),this.put("spacing",new Menu(mxUtils.bind(this,function(e,n){var t=this.editorUi.actions.get("shadow").enabled,a=this.get("line").enabled;(t||e.showDisabled)&&(this.promptChange(e,mxResources.get("top"),"(px)","0",mxConstants.STYLE_SPACING_TOP,n,t),this.promptChange(e,mxResources.get("right"),"(px)","0",mxConstants.STYLE_SPACING_RIGHT,n,t),this.promptChange(e,mxResources.get("bottom"),"(px)","0",mxConstants.STYLE_SPACING_BOTTOM,n,t),this.promptChange(e,mxResources.get("left"),"(px)","0",mxConstants.STYLE_SPACING_LEFT,n,t),e.addSeparator(n),this.promptChange(e,mxResources.get("global"),"(px)","0",mxConstants.STYLE_SPACING,n,t),this.promptChange(e,mxResources.get("perimeter"),"(px)","0",mxConstants.STYLE_PERIMETER_SPACING,n,t)),(a||e.showDisabled)&&(e.addSeparator(n),this.promptChange(e,mxResources.get("sourceSpacing"),"(px)","0",mxConstants.STYLE_SOURCE_PERIMETER_SPACING,n,a),this.promptChange(e,mxResources.get("targetSpacing"),"(px)","0",mxConstants.STYLE_TARGET_PERIMETER_SPACING,n,a))}))),this.put("format",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItem(e,"style",n)}))),this.put("text",new Menu(mxUtils.bind(this,function(e,n){var t=this.get("text").enabled;e.addSeparator(n),this.addSubmenu("fontFamily",e,n),this.addSubmenu("fontSize",e,n),this.addMenuItems(e,["-","bold","italic","underline","-"],n),this.addSubmenu("alignment",e,n),this.addMenuItem(e,"wordWrap",n),e.addSeparator(n),this.promptChange(e,mxResources.get("textOpacity"),"(%)","100",mxConstants.STYLE_TEXT_OPACITY,n,t),e.addItem(mxResources.get("hide"),null,function(){i.toggleCellStyles(mxConstants.STYLE_NOLABEL,!1)},n,null,t)}))),this.put("alignment",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("leftAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT],null,n),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER],null,n),this.styleChange(e,mxResources.get("rightAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("topAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP],null,n),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE],null,n),this.styleChange(e,mxResources.get("bottomAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM],null,n),e.addSeparator(n),this.addSubmenu("position",e,n),this.addSubmenu("spacing",e,n),e.addSeparator(n);var t=this.get("text").enabled;e.addItem(mxResources.get("vertical"),null,function(){i.toggleCellStyles(mxConstants.STYLE_HORIZONTAL,!0)},n,null,t)}))),this.put("position",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("left"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT,mxConstants.ALIGN_RIGHT],null,n),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER,mxConstants.ALIGN_CENTER],null,n),this.styleChange(e,mxResources.get("right"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT,mxConstants.ALIGN_LEFT],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("top"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP,mxConstants.ALIGN_BOTTOM],null,n),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE,mxConstants.ALIGN_MIDDLE],null,n),this.styleChange(e,mxResources.get("bottom"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM,mxConstants.ALIGN_TOP],null,n)}))),this.put("direction",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("flipH"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPH,!1)},n),e.addItem(mxResources.get("flipV"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPV,!1)},n),this.addMenuItems(e,["-","tilt","rotation"],n)}))),this.put("align",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("leftAlign"),null,function(){i.alignCells(mxConstants.ALIGN_LEFT)},n),e.addItem(mxResources.get("center"),null,function(){i.alignCells(mxConstants.ALIGN_CENTER)},n),e.addItem(mxResources.get("rightAlign"),null,function(){i.alignCells(mxConstants.ALIGN_RIGHT)},n),e.addSeparator(n),e.addItem(mxResources.get("topAlign"),null,function(){i.alignCells(mxConstants.ALIGN_TOP)},n),e.addItem(mxResources.get("middle"),null,function(){i.alignCells(mxConstants.ALIGN_MIDDLE)},n),e.addItem(mxResources.get("bottomAlign"),null,function(){i.alignCells(mxConstants.ALIGN_BOTTOM)},n)}))),this.put("layout",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("horizontalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_WEST);this.editorUi.executeLayout(e,!0,!0)}),n),e.addItem(mxResources.get("verticalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_NORTH);this.editorUi.executeLayout(e,!0,!0)}),n)}))),this.put("navigation",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["home","-","exitGroup","enterGroup","-","expand","collapse"],n)}))),this.put("arrange",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["toFront","toBack","-"],n),this.addSubmenu("layout",e,n),e.addSeparator(n),this.addMenuItems(e,["-","group","ungroup","removeFromGroup"],n)}))),this.put("view",new Menu(mxUtils.bind(this,function(n,t){this.addMenuItems(n,["actualSize"],t),n.addSeparator();for(var e=[.25,.5,.75,1,2,4],a=0;a<e.length;a++)!function(e){n.addItem(100*e+"%",null,function(){i.zoomTo(e)},t)}(e[a]);this.addMenuItems(n,["-","zoomIn","zoomOut","-","fitWindow","customZoom","-","fitPage","fitPageWidth"],t)}))),this.put("file",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["new","open","-","save","saveAs","publish","-","variable","-","import","export","-","editFile","description","-","print"],n)}))),this.put("edit",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["undo","redo","-","cut","copy","paste","delete","-","duplicate","-","selectVertices","selectEdges","selectAll"])}))),this.put("help",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["help","-","about"])})))},Menus.prototype.put=function(e,n){this.menus[e]=n},Menus.prototype.get=function(e){return this.menus[e]},Menus.prototype.addSubmenu=function(e,n,t){var a=this.get(e).enabled;if(n.showDisabled||a){var i=n.addItem(mxResources.get(e),null,null,t,null,a);this.addMenu(e,n,i)}},Menus.prototype.addMenu=function(e,n,t){var a=this.get(e);null!=a&&(n.showDisabled||a.enabled)&&this.get(e).execute(n,t)},Menus.prototype.styleChange=function(e,n,t,a,i,s){return e.addItem(n,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph;e.getModel().beginUpdate();try{for(var n=0;n<t.length;n++)e.setCellStyles(t[n],a[n])}finally{e.getModel().endUpdate()}}),s,i)},Menus.prototype.promptChange=function(e,n,a,i,s,t,o){return e.addItem(n,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph,n=i,t=e.getView().getState(e.getSelectionCell());null!=t&&(n=t.style[s]||n),null!=(n=mxUtils.prompt(mxResources.get("enterValue")+(0<a.length?" "+a:""),n))&&0<n.length&&e.setCellStyles(s,n)}),t,null,o)},Menus.prototype.addMenuItem=function(e,n,t){var a=this.editorUi.actions.get(n);if(null==a||!e.showDisabled&&!a.enabled)return null;var i=e.addItem(a.label,null,a.funct,t,null,a.enabled);return a.toggleAction&&a.isSelected()&&this.addCheckmark(i),this.addShortcut(i,a),i},Menus.prototype.addShortcut=function(e,n){if(null!=n.shortcut){var t=e.firstChild.nextSibling.nextSibling,a=document.createElement("span");a.style.color="gray",mxUtils.write(a,n.shortcut),t.appendChild(a)}},Menus.prototype.addCheckmark=function(e){var n=e.firstChild.nextSibling;n.style.backgroundImage="url("+IMAGE_PATH+"/checkmark.gif)",n.style.backgroundRepeat="no-repeat",n.style.backgroundPosition="2px 50%"},Menus.prototype.addMenuItems=function(e,n,t){for(var a=0;a<n.length;a++)"-"==n[a]?e.addSeparator(t):this.addMenuItem(e,n[a],t)},Menus.prototype.createPopupMenu=function(e,n,t){var a=this.editorUi.editor.graph;if(e.smartSeparators=!0,a.isSelectionEmpty()?this.addMenuItems(e,["undo","redo","-","paste","-"]):(this.addMenuItems(e,["delete","-","cut","copy","-","duplicate"]),1==a.getSelectionCount()&&a.getModel().isEdge(a.getSelectionCell())&&this.addMenuItems(e,["setAsDefaultEdge"]),e.addSeparator()),0<a.getSelectionCount()){if(this.addMenuItems(e,["toFront","toBack","-"]),a.getModel().isEdge(a.getSelectionCell())){var i=!1;if(null!=(n=a.getSelectionCell())&&a.getModel().isEdge(n)){var s=a.selectionCellsHandler.getHandler(n);if(s instanceof mxEdgeHandler&&null!=s.bends&&2<s.bends.length){var o=s.getHandleForEvent(new mxMouseEvent(t)),r=this.editorUi.actions.get("removeWaypoint");r.handler=s,i=0<(r.index=o)&&o<s.bends.length}}this.addMenuItems(e,["-",i?"removeWaypoint":"addWaypoint"])}else 1<a.getSelectionCount()&&(e.addSeparator(),this.addMenuItems(e,["group"]));if(e.addSeparator(),1==a.getSelectionCount())null!=a.getLinkForCell(a.getSelectionCell())&&this.addMenuItems(e,["openLink"])}else this.addMenuItems(e,["-","selectVertices","selectEdges","-","selectAll"])},Menus.prototype.createMenubar=function(e){var n=new Menubar(this.editorUi,e),t=[];t=CRUD_PERMISSIONS.canEdit?["file","edit","view","format","text","arrange","help"]:["file","view","help"];for(var a=0;a<t.length;a++)n.addMenu(mxResources.get(t[a]),this.get(t[a]).funct);return n},Menubar.prototype.hideMenu=function(){null!=this.currentMenu&&this.currentMenu.hideMenu()},Menubar.prototype.addMenu=function(e,n){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.className="geItem",mxUtils.write(t,e),this.addMenuHandler(t,n),this.container.appendChild(t),t},Menubar.prototype.getOffset=function(e){return{left:(e=e.getBoundingClientRect()).left+window.scrollX,top:e.top+window.scrollY}},Menubar.prototype.addMenuHandler=function(i,s){if(null!=s){var o=!0,n=mxUtils.bind(this,function(e){if(o&&null==i.enabled||i.enabled){this.editorUi.editor.graph.panningHandler.hideMenu();var n=new mxPopupMenu(s);n.div.className+=" geMenubarMenu",n.smartSeparators=!0,n.showDisabled=!0,n.autoExpand=!0,n.hideMenu=mxUtils.bind(this,function(){mxPopupMenu.prototype.hideMenu.apply(n,arguments),n.destroy(),this.currentMenu=null,this.currentElt=null});var t=this.getOffset(i).left,a=this.getOffset(i).top+i.offsetHeight;n.popup(t,a,null,e),this.currentMenu=n,this.currentElt=i}o=!0,mxEvent.consume(e)});mxEvent.addListener(i,"mousemove",mxUtils.bind(this,function(e){null!=this.currentMenu&&this.currentElt!=i&&(this.hideMenu(),n(e))})),mxEvent.addListener(i,"mousedown",mxUtils.bind(this,function(){o=this.currentElt!=i})),mxEvent.addListener(i,"click",n)}},mxUtils.extend(Menu,mxEventSource),Menu.prototype.setEnabled=function(e){this.enabled!=e&&(this.enabled=e,this.fireEvent(new mxEventObject("stateChanged")))},Menu.prototype.execute=function(e,n){this.funct(e,n)},Toolbar.prototype.init=function(){CRUD_PERMISSIONS.canEdit?this.addItems(["save","publish","-","print","undo","redo","-","copy","cut","paste","delete","-","duplicate","-","actualSize","zoomIn","zoomOut","-"]):this.addItems(["print","actualSize","zoomIn","zoomOut","-"])},Toolbar.prototype.hideMenu=function(){null!=this.currentMenu&&(this.currentMenu.hideMenu(),this.currentMenu.destroy(),this.currentMenu=null)},Toolbar.prototype.addMenu=function(e,n,t,a){var i=this.editorUi.menus.get(a),s=this.addMenuFunction(e,n,t,i.funct);return i.addListener("stateChanged",function(){s.setEnabled(i.enabled)}),s},Toolbar.prototype.addMenuFunction=function(e,n,t,a){var i=t?this.createLabel(e):this.createButton(e);return this.initElement(i,n),this.addMenuHandler(i,t,a),this.container.appendChild(i),i},Toolbar.prototype.addSeparator=function(){var e=document.createElement("div");return e.className="geSeparator",this.container.appendChild(e),e},Toolbar.prototype.addItems=function(e){for(var n=0;n<e.length;n++){var t=e[n];"-"==t?this.addSeparator():this.addItem("geSprite-"+t.toLowerCase(),t)}},Toolbar.prototype.addItem=function(e,n){var t=this.editorUi.actions.get(n),a=null;return null!=t&&((a=this.addButton(e,t.label,t.funct)).setEnabled(t.enabled),t.addListener("stateChanged",function(){a.setEnabled(t.enabled)})),a},Toolbar.prototype.addButton=function(e,n,t){var a=this.createButton(e);return this.initElement(a,n),this.addClickHandler(a,t),this.container.appendChild(a),a},Toolbar.prototype.addSelectionHandler=function(t){var a=this.editorUi.editor.graph,e=function(){for(var e=!a.isSelectionEmpty(),n=0;n<t.length;n++)t[n].setEnabled(e)};a.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.addEdgeSelectionHandler=function(a){var i=this.editorUi.editor.graph,e=function(){var e=!1;if(!i.isSelectionEmpty())for(var n=i.getSelectionCells(),t=0;t<n.length;t++)if(i.getModel().isEdge(n[t])){e=!0;break}for(t=0;t<a.length;t++)a[t].setEnabled(e)};i.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.initElement=function(e,n){e.setAttribute("tabindex","0"),null!=n&&e.setAttribute("title",n),this.addEnabledState(e)},Toolbar.prototype.addEnabledState=function(n){var t=n.className;n.setEnabled=function(e){n.enabled=e,n.className=e?t:t+" geDisabled"},n.setEnabled(!0)},Toolbar.prototype.addClickHandler=function(n,t){null!=t&&mxEvent.addListener(n,"click",function(e){n.enabled&&t(e),mxEvent.consume(e)})},Toolbar.prototype.createButton=function(e){var n=document.createElement("a");n.setAttribute("href","javascript:void(0);"),n.className="geButton";var t=document.createElement("div");return t.className="geSprite "+e,n.appendChild(t),n},Toolbar.prototype.createLabel=function(e,n){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.className="geLabel",mxUtils.write(t,e),t},Toolbar.prototype.addMenuHandler=function(n,t,a,i){if(null!=a){var s=this.editorUi.editor.graph,o=null;mxEvent.addListener(n,"click",mxUtils.bind(this,function(e){(null==n.enabled||n.enabled)&&(s.panningHandler.hideMenu(),(o=new mxPopupMenu(a)).div.className+=" geToolbarMenu",o.showDisabled=i,o.labels=t,o.autoExpand=!0,o.popup(n.offsetLeft,n.offsetTop+n.offsetHeight+34,null,e),this.currentMenu=o),mxEvent.consume(e)}))}},Dialog.prototype.close=function(){null!=this.onDialogClose&&(this.onDialogClose(),this.onDialogClose=null),this.container.parentNode.removeChild(this.container),this.bg.parentNode.removeChild(this.bg)},angular.module("motion").run(["$templateCache",function(e){"use strict";e.put("app/auth/services/hotdesk/dialog.html",'<md-dialog aria-label="Telephone">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="LOGIN.TELEPHONES">Telephones</span>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-select ng-model="vm.name" placeholder="Select a telephone">\n        <md-option value="{{telephone.name}}" ng-repeat="telephone in vm.telephones.rows">{{telephone.fullname}}</md-option>\n      </md-select>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.closeDialog(vm.name)" class="send-button md-accent md-raised" aria-label="call" ng-disabled="!vm.name">\n        <span translate="LOGIN.SELECT">SELECT</span>\n      </md-button>\n      \x3c!-- <md-button ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="cancel">\n                <span translate="LOGIN.CANCEL">Cancel</span>\n            </md-button> --\x3e\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/dialogs/advanced-search/dialog.html",'<md-dialog class="advanced-search-dialog" aria-label="Advanced search" flex="70" ng-init="vm.onInit()">\n  <form ng-cloak>\n    <md-toolbar class="advanced-search-dialog-header" ng-class="{{ \'vm.toolbarColor\' }} + \'-bg\'">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="DASHBOARDS.ADVANCED_SEARCH"></span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.minimize()">\n            <md-icon class="no-margin" md-font-icon="icon-window-minimize" aria-label="Minimize dialog"></md-icon>\n          </md-button>\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.close()">\n            <md-icon class="no-margin" md-font-icon="icon-window-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <ms-advanced-search options="vm.searchOptions" clear-filter="vm.clearConditions()"></ms-advanced-search>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button class="md-primary md-raised" aria-label="Clear" ng-disabled="vm.searchOptions.conditions.length === 0" translate="DASHBOARDS.CLEAR" translate-attr-aria-label="DASHBOARDS.CLEAR" ng-click="vm.clearConditions()"></md-button>\n      <md-button class="md-primary md-accent md-raised" aria-label="Apply" ng-disabled="vm.searchOptions.conditions.length === 0" translate="DASHBOARDS.APPLY" translate-attr-aria-label="DASHBOARDS.APPLY" ng-click="vm.applyFilter()"></md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/directives/ms-advanced-search/ms-advanced-search.html",'<div layout="column" class="advanced-search-container" flex>\n  <div layout-margin>\n    <md-radio-group ng-model="vm.options.matchType" class="md-primary" layout="row">\n      <md-radio-button value="$and" class="md-primary">{{ \'DASHBOARDS.MEET_ALL_CONDITIONS\' | translate }}\n      </md-radio-button>\n      <md-radio-button value="$or">{{ \'DASHBOARDS.MEET_ANY_CONDITIONS\' | translate }}</md-radio-button>\n    </md-radio-group>\n  </div>\n\n  \x3c!-- ACTIVE CONDITIONS --\x3e\n  <div layout="row" ng-if="vm.options.conditions.length > 0" class="advanced-search-conditions">\n    <md-list>\n      <md-list-item>\n        <md-chips ng-model="vm.options.conditions" class="advanced-search-chips" readonly="true" md-removable="true" md-on-remove="vm.removeCondition()">\n          <md-chip-template ms-chip-color="{{ $chip.style }}">\n            <md-menu md-offset="50 0" ng-class="{\'no-click\': vm.pendingCondition}">\n              <span>\n                <p class="filter-text">{{ $chip.name }}</p>\n                <em ng-show="$chip.operator" class="text-lowercase">{{ $chip.operator }}</em>\n                <strong>{{ $chip.displayValue }}</strong>\n                <em ng-show="$chip.displayEndValue" class="text-lowercase">{{ \'DASHBOARDS.AND\' | translate }}</em>\n                <strong>{{ $chip.displayEndValue }}</strong>\n              </span>\n              <md-menu-content width=2 class="md-dense">\n                <md-menu-item ng-hide="$chip.disabled">\n                  <md-button ng-click="vm.editCondition($chip)">Edit\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.setConditionStatus($chip)">\n                    {{ $chip.disabled ? \'Enable\' : \'Disable\' }}\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </md-chip-template>\n          <button type="button" md-chip-remove class="md-primary remove-filter">\n            <md-icon md-font-icon="icon-cancel" aria-label="Remove Filter"></md-icon>\n          </button>\n        </md-chips>\n      </md-list-item>\n    </md-list>\n  </div>\n\n  \x3c!-- FILTERS --\x3e\n  <div layout="row">\n    <div layout="row" class="advanced-search-bar" layout-margin flex>\n      \x3c!-- FIELD --\x3e\n      <md-input-container flex="35">\n        <md-icon md-font-icon="icon-filter-variant"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.selectedField" ng-change="vm.onFieldChange()" placeholder="{{ \'DASHBOARDS.SELECT_FIELD\' | translate }}" aria-label="Field">\n          <md-option ng-value="field" ng-repeat="field in vm.options.fields">{{ field.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- OPERATOR --\x3e\n      <md-input-container flex="30">\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.selectedOperator" ng-change="vm.onOperatorChange(oldValue)" ng-focus="oldValue=vm.selectedOperator" md-selected-text="vm.selectedOperator ? (\'DASHBOARDS.\' + vm.selectedOperator.translate | translate) : (\'DASHBOARDS.SELECT_OPERATOR\' | translate)" ng-disabled="!vm.selectedField" aria-label="Operator">\n          <md-option ng-value="operator" ng-repeat="operator in vm.availableOperators" ng-selected="vm.autoSelectOperator">\n            <div layout="row" class="operators-list">\n              <span class="operator-symbol">\n                {{ operator.symbol }}\n              </span>\n              <span>\n                {{ \'DASHBOARDS.\' + operator.translate | translate }}\n              </span>\n            </div>\n          </md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TEXT INPUT --\x3e\n      <md-input-container ng-if="!vm.selectedField.type || vm.selectedField.type === \'text\'" class="no-errors" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <input type="text" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}">\n      </md-input-container>\n      \x3c!-- NUMERIC INPUT --\x3e\n      <div ng-if="vm.selectedField.type === \'number\'" flex layout="row" layout-margin class="no-margin">\n        <md-input-container class="no-errors" flex>\n          <md-icon md-font-icon="icon-numeric"></md-icon>\n          <input type="number" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" min="0" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ vm.selectedOperator.type === \'$between\' ? \'DASHBOARDS.STARTING_VALUE\' : \'DASHBOARDS.VALUE\' | translate }}">\n        </md-input-container>\n        <md-input-container class="no-errors" ng-if="vm.selectedOperator.type === \'$between\'" ng-class="{\'md-input-invalid\': !vm.isValidRange}" flex>\n          <md-icon md-font-icon=" icon-numeric">\n          </md-icon>\n          <input class="md-input" type="number" aria-label="Value" ng-model="vm.endRangeValue" ng-change="vm.checkRange()" ng-disabled="!vm.value" min="vm.value" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.ENDING_VALUE\' | translate }}">\n          <div ng-if="!vm.isValidRange" class="md-input-message-animation md-input-messages-animation">\n            {{ (\'DASHBOARDS.VALUE_RANGE_CHECK\' | translate) + \' \' + vm.value }}\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- SELECT --\x3e\n      <md-input-container ng-if="vm.selectedField.type === \'select\'" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.value" md-on-open="vm.getValues()" ng-change="vm.onValueChange()" ng-model-options="{trackBy: \'$value.id\'}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}" aria-label="Value">\n          <md-option ng-value="item" ng-repeat="item in vm.selectedField.values">{{item.name}}\n          </md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- MULTISELECT --\x3e\n      <md-input-container ng-if="vm.selectedField.type === \'multiselect\'" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" multiple ng-model="vm.value" md-on-open="vm.getValues()" ng-change="vm.onValueChange()" ng-model-options="{trackBy: \'$value.id\'}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}" aria-label="Value">\n          <md-option ng-value="item" ng-repeat="item in vm.selectedField.values">{{item.name}}\n          </md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- DATE INPUT --\x3e\n      <div ng-if="vm.selectedField.type === \'date\'" flex layout="row">\n        <mdp-date-picker mdp-open-on-click ng-model="vm.value" ng-change="vm.onValueChange()" mdp-max-date="vm.maxDateRange" mdp-placeholder="{{ vm.selectedOperator.type === \'$between\' ? \'DASHBOARDS.STARTING_DATE\' : \'DASHBOARDS.VALUE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n        </mdp-date-picker>\n        <mdp-date-picker mdp-open-on-click ng-if="vm.selectedOperator.type === \'$between\'" ng-change="vm.checkRange()" ng-model="vm.endRangeValue" mdp-min-date="vm.minDateRange" mdp-disabled="!vm.value" mdp-placeholder="{{ \'DASHBOARDS.ENDING_DATE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n        </mdp-date-picker>\n      </div>\n      \x3c!-- AUTOCOMPLETE --\x3e\n      <div layout="row" layout-align="start start" ng-if="vm.selectedField.type === \'autocomplete\' && vm.selectedOperator.type != \'$substring\'" class=" autocomplete-input" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-autocomplete md-selected-item="vm.value" md-selected-item-change="vm.onValueChange()" md-items="item in vm.getValues()" md-search-text="vm.searchText" md-item-text="item.displayValue" md-min-length="4" md-no-cache="true" md-floating-label="{{ \'DASHBOARDS.VALUE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n          <md-item-template>\n            <span md-highlight-text="vm.searchText" md-highlight-flags="i">{{item.displayValue}}</span>\n          </md-item-template>\n        </md-autocomplete>\n      </div>\n      <md-input-container ng-if="vm.selectedField.type === \'autocomplete\' && vm.selectedOperator.type === \'$substring\'" class="no-errors" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <input type="text" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}">\n      </md-input-container>\n    </div>\n    <md-button class="md-fab md-mini md-primary mt-20" ng-if="!vm.pendingCondition" ng-disabled="!vm.isValidCondition" aria-label="Add filter" ng-click="vm.addCondition()" translate-attr-aria-label="DASHBOARDS.ADD">\n      <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    <md-button class="md-fab md-mini mt-20" ng-if="vm.pendingCondition" ng-disabled="!vm.isValidCondition" aria-label="Update filter" ng-click="vm.updateCondition()" translate-attr-aria-label="DASHBOARDS.UPDATE">\n      <md-icon md-font-icon="icon-check"></md-icon>\n    </md-button>\n    <md-button class="md-fab md-mini md-primary mt-20" ng-if="vm.pendingCondition" aria-label="Cancel filter update" ng-click="vm.cancelUpdateCondition()" translate-attr-aria-label="DASHBOARDS.CANCEL">\n      <md-icon md-font-icon="icon-close"></md-icon>\n    </md-button>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-1/template-1.html",'<div class="template-1">\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="content pv-24 ph-16">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="text pt-16" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-10/template-10.html",'<div class="template-10 p-16">\n  <div class="pb-16" layout="row" layout-align="space-between center">\n    <div class="info">\n      <div class="title secondary-text" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h2" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n\n    <div class="media ml-16">\n      <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n    </div>\n  </div>\n\n  <div class="text">\n    {{card.text}}\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-2/template-2.html",'<div class="template-2">\n  <div class="header p-16" layout="row" layout-align="start center">\n    <div ng-if="card.avatar">\n      <img class="avatar mr-16" ng-src="{{card.avatar.src}}" alt="{{card.avatar.alt}}">\n    </div>\n\n    <div class="info">\n      <div class="title" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="text p-16" ng-if="card.text">\n    {{card.text}}\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-3/template-3.html",'<div class="template-3 p-16 teal-bg white-fg" layout="row" layout-align="space-between">\n  <div layout="column" layout-align="space-between">\n    <div class="info">\n      <div class="title h1" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h3 secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n\n    <div class="cta">\n      <md-button class="m-0">{{card.cta}}</md-button>\n    </div>\n  </div>\n\n  <div class="media pl-16">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-4/template-4.html",'<div class="template-4">\n  <div class="info white-fg ph-16 pv-24">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="text" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-5/template-5.html",'<div class="template-5 p-16" layout="row" layout-align="space-between start">\n  <div class="info">\n    <div class="title secondary-text" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="event h2" ng-if="card.event">\n      {{card.event}}\n    </div>\n  </div>\n\n  <div class="media ml-16">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-6/template-6.html",'<div class="template-6">\n  <div class="content pv-24 ph-16">\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="title h2" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="text pt-8" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-7/template-7.html",'<div class="template-7" layout="row" layout-align="space-between">\n  <div class="info" layout="column" layout-align="space-between" layout-fill flex>\n    <div class="p-16">\n      <div class="title h1" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h4 secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n\n      <div class="text h4 pt-8" ng-if="card.text">\n        {{card.text}}\n      </div>\n    </div>\n\n    <div>\n      <md-divider></md-divider>\n      <div class="p-8" layout="row">\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n      </div>\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-8/template-8.html",'<div class="template-8">\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="content pv-24 ph-16">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="buttons pt-16">\n      <md-button class="m-0">{{card.button1}}</md-button>\n      <md-button class="m-0 md-accent">{{card.button2}}</md-button>\n    </div>\n\n    <div class="text pt-16" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-9/template-9.html",'<div class="template-9">\n  <div class="header p-16" layout="row" layout-align="start center">\n    <div ng-if="card.avatar">\n      <img class="avatar mr-16" ng-src="{{card.avatar.src}}" alt="{{card.avatar.alt}}">\n    </div>\n\n    <div class="info">\n      <div class="title" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n\n    </div>\n  </div>\n\n  <div class="text ph-16 pb-16" ng-if="card.text">\n    {{card.text}}\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="buttons m-8">\n    <md-button class="md-icon-button mr-16" aria-label="Favorite">\n      <md-icon md-font-icon="icon-heart-outline" class="s24"></md-icon>\n    </md-button>\n    <md-button class="md-icon-button" aria-label="Share">\n      <md-icon md-font-icon="icon-share" class="s24"></md-icon>\n    </md-button>\n  </div>\n\n</div>'),e.put("app/core/directives/ms-click-to-call/ms-click-to-call.html",'<section ng-if="type !== \'button\'">\n  <span ng-if="!showMenu()" privacy="{{ privacy }}" ng-cloak>{{target}}</span>\n  <md-menu ng-if="showMenu()">\n    <a aria-label="Target" ng-click="$mdOpenMenu($event)">\n      <span ng-if="prefix" privacy="{{ privacy }}" ng-cloak>{{prefix}}-</span>\n      <span privacy="{{ privacy }}" ng-cloak>{{target}}</span>\n    </a>\n    <md-menu-content width="2">\n      <md-menu-item>\n        <md-button ng-click="call(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.CALL_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n      <md-menu-item>\n        <md-button ng-click="transfer(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n    </md-menu-content>\n  </md-menu>\n</section>\n<section ng-if="type === \'button\'">\n  <md-button ng-if="!showMenu()" ng-disabled="true" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW CALL" aria-label="NEW CALL">\n    <md-icon md-font-icon="icon-phone"></md-icon>\n  </md-button>\n  <md-menu ng-if="showMenu()">\n    <md-button class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW CALL" ng-click="$mdOpenMenu($event)" aria-label="NEW CALL">\n      <md-icon md-font-icon="icon-phone"></md-icon>\n    </md-button>\n    <md-menu-content width="2">\n      <md-menu-item>\n        <md-button ng-click="call(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.CALL_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n      <md-menu-item>\n        <md-button ng-click="transfer(target)">\n          {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n    </md-menu-content>\n  </md-menu>\n</section>'),e.put("app/core/directives/ms-client-side-logging/ms-client-side-logging-icon.html",'<md-icon ng-style="vm.styleColor" md-font-icon="{{ vm.styleIcon }}">\n  <md-tooltip class="client-side-logging-tooltip">\n    <span ng-bind-html="vm.tooltipHTML"></span>\n  </md-tooltip>\n</md-icon>'),e.put("app/core/directives/ms-client-side-logging/ms-client-side-logging.html",'<md-content layout="column">\n  <form name="clientSideLoggingSettingsForm">\n    <div flex layout="column" layout-align="stretch center">\n      <div ng-if="vm.user.userSetting.clientSideLoggingEnabled" class="md-amber-500-bg p-10" layout="row" layout-align="start center">\n        <span class="no-margin font-size-14 line-height-30" translate="STAFF.CLIENT_LOGS_ALL_ENABLED_WARNING" flex></span>\n      </div>\n      <md-input-container>\n        <md-switch ng-model="vm.user.userSetting.clientSideLoggingEnabled" aria-label="Manage client side logging" ng-change="vm.onEnabledSwitchChange()">\n          {{ vm.user.userSetting.clientSideLoggingEnabled ? \'STAFF.CLIENT_LOGS_ENABLED\' : \'STAFF.CLIENT_LOGS_DISABLED\' | translate }}\n        </md-switch>\n      </md-input-container>\n      <h2 ng-if="vm.user.userSetting.clientSideLoggingEnabled" class="md-subhead mt-0">{{ vm.clientSideLoggingEnabledSince }}</h2>\n    </div>\n    <div layout="column" layout-align="stretch center">\n      <md-input-container ng-if="vm.user.userSetting.clientSideLoggingEnabled">\n        <label>{{ \'STAFF.CLIENT_LOGS_LOGLEVEL_SELECT\' | translate }}</label>\n        <md-select ng-if="vm.user.userSetting.clientSideLoggingEnabled" ng-model="vm.user.userSetting.clientSideLoggingLevel" placeholder="Debugging level" ng-change="vm.onLogLevelSelectionChange()" flex="30">\n          <md-option ng-value="loggingLevel" ng-repeat="loggingLevel in vm.availableClientSideLoggingLevels">\n            <md-icon ng-style="vm.computeStyleForLoggingLevel(loggingLevel)" md-font-icon="{{ loggingLevel === \'info\' ? \'icon-checkbox-blank-circle-outline\' : \'icon-checkbox-blank-circle\' }}"></md-icon>\n            {{ loggingLevel }}\n          </md-option>\n        </md-select>\n      </md-input-container>\n    </div>\n  </form>\n</md-content>'),e.put("app/core/directives/ms-dual-multiselect/ms-dual-multiselect.html",'<div ng-cloak layout-gt-sm="row" layout="column">\n  <div flex-gt-sm="50" flex="45">\n    <md-input-container class="md-icon-float md-block margin-0">\n      <md-icon md-font-icon="icon-magnify" aria-label="swap"></md-icon>\n      <input ng-model="query" type="text" placeholder="{{ \'STAFF.PERMISSIONS_PLACEHOLDER_SEARCH\' | translate }}">\n    </md-input-container>\n    <md-content class="border h-300">\n      <md-list class="md-dense no-padding" layout-fill layout-align="center center">\n        <md-list-item class="md-3-line" ng-class="{\'read-only-mode\': vm.readOnly || vm.addDisabled}" ng-disabled="vm.readOnly || vm.addDisabled" ng-repeat="item in availableItems = (vm.options.items | filter: query) | orderBy: vm.options.orderBy" ng-click="vm.canTransfer(item, vm.options, false)">\n          <div class="md-list-item-text" layout="column">\n            <h3 ng-if="vm.options.line1">{{vm.getLine(item, vm.options.line1)}}</h3>\n            <h4 ng-if="vm.options.line2">{{vm.getLine(item, vm.options.line2)}}</h4>\n            <p ng-if="vm.options.line3">{{vm.getLine(item, vm.options.line3)}}</p>\n            <p class="ms-dual-multiselect-line-xs" ng-if="vm.options.line4">{{vm.getLine(item, vm.options.line4)}}\n            </p>\n          </div>\n          <md-icon ng-hide="vm.readOnly && !vm.addDisabled" ng-class="{\'add-disabled\': vm.addDisabled}" md-font-icon="icon-arrow-right-bold" aria-label="swap">\n          </md-icon>\n          <md-divider></md-divider>\n        </md-list-item>\n      </md-list>\n    </md-content>\n    <div class="margin-10" layout="row">\n      <span class="h4" flex>{{vm.options.labelAll || \'All Items\'}} ({{availableItems.length}})</span>\n      <md-icon ng-hide="vm.options.showSelectAndDeselectAll === false || vm.readOnly" ng-class="{\'add-disabled\': vm.addDisabled}" ng-disabled="vm.addDisabled" md-font-icon="icon-chevron-double-right" aria-label="swap" ng-click="vm.transfer(vm.options.items, vm.options.selectedItems, -1, false)"></md-icon>\n    </div>\n  </div>\n\n  <div flex="10" layout="row" layout-align="center center">\n    <md-icon md-font-icon="icon-swap-horizontal" aria-label="swap"></md-icon>\n  </div>\n\n  <div flex-gt-sm="50" flex="45">\n    <md-input-container class="md-icon-float md-block margin-0">\n      <md-icon md-font-icon="icon-magnify" aria-label="swap"></md-icon>\n      <input ng-model="selectedQuery" type="text" placeholder="{{ \'STAFF.PERMISSIONS_PLACEHOLDER_SEARCH\' | translate }}">\n    </md-input-container>\n    <md-content class="border h-300">\n      <md-list class="md-dense no-padding" layout-fill layout-align="center center">\n        <md-list-item class="md-3-line" ng-class="{\'read-only-mode\': vm.readOnly || !item.isValid}" ng-disabled="vm.readOnly" ng-repeat="item in associatedItems = (vm.options.selectedItems | filter: selectedQuery) | orderBy: vm.options.orderBy" ng-click="vm.canTransfer(item, vm.options, true)">\n          <md-icon ng-class="{\'hidden\': vm.readOnly || !item.isValid}" md-font-icon="icon-arrow-left-bold" aria-label="swap"></md-icon>\n          <div class="md-list-item-text" layout="column">\n            <h3 ng-if="vm.options.line1">{{vm.getLine(item, vm.options.line1)}}</h3>\n            <h4 ng-if="vm.options.line2">{{vm.getLine(item, vm.options.line2)}}</h4>\n            <p ng-if="vm.options.line3">{{vm.getLine(item, vm.options.line3)}}</p>\n            <p class="ms-dual-multiselect-line-xs" ng-if="vm.options.line4">{{vm.getLine(item, vm.options.line4)}}\n            </p>\n          </div>\n          <md-divider></md-divider>\n        </md-list-item>\n      </md-list>\n    </md-content>\n    <div class="margin-10" layout="row">\n      <md-icon ng-hide="vm.options.showSelectAndDeselectAll === false || vm.readOnly" md-font-icon="icon-chevron-double-left" aria-label="swap" ng-click="vm.transfer(vm.options.selectedItems, vm.options.items, -1, true)"></md-icon>\n      <span class="h4 text-right" flex>{{vm.options.labelSelected || \'Selected Items\'}}\n        ({{associatedItems.length}})</span>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-font-family/ms-font-family.html",'<md-select ng-model="ngModel" class="no-margin">\n  <md-option ng-repeat="font in fonts" ng-value="font.value"><span ng-style="{\'font-family\': font.value}">{{font.option}}</span>\n  </md-option>\n</md-select>'),e.put("app/core/directives/ms-info-bar/ms-info-bar.html",'<div id="ms-info-bar" layout="row" layout-align="start center" flex>\n  <div id="ms-info-bar-message" ng-transclude flex></div>\n  <md-button id="ms-info-bar-close" class="md-icon-button" aria-label="Close" ng-click="removeInfoBar()">\n    <md-icon md-font-icon="icon-close s20"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-material-color-picker/ms-material-color-picker.html",'<md-menu md-position-mode="target-right target">\n\n  <div ng-click="$mdOpenMenu($event)">\n    <ms-color-picker-button>\n      <md-button aria-label="Row Color" md-menu-origin ng-click="$mdOpenMenu($event)" ng-class="vm.selectedColor.class">\n\n        <span ng-show="vm.selectedColor.palette">\n          {{vm.selectedColor.palette}} {{vm.selectedColor.hue}}\n        </span>\n        <span ng-show="!vm.selectedColor.palette">\n          Select Color\n        </span>\n      </md-button>\n    </ms-color-picker-button>\n  </div>\n\n  <md-menu-content class="ms-material-color-picker-menu-content" layout-column>\n\n    <header ng-class="vm.selectedColor.class || \'md-accent-bg\'" class="md-whiteframe-4dp" layout="row" layout-align="space-between center">\n      <md-button md-prevent-menu-close ng-click="vm.activateHueSelection(false,false)" class="md-icon-button" ng-class="{\'hidden\':!vm.selectedPalette}" aria-label="Palette">\n        <md-icon md-font-icon="icon-arrow-left" class="s20"></md-icon>\n      </md-button>\n\n      <span ng-if="vm.selectedColor.palette">\n        {{vm.selectedColor.palette}} {{vm.selectedColor.hue}}\n      </span>\n\n      <span ng-if="!vm.selectedColor.palette">\n        Select Color\n      </span>\n\n      <md-button class="remove-color-button md-icon-button" ng-click="vm.removeColor()" aria-label="Remove Color">\n        <md-icon md-font-icon="icon-delete" class="s20"></md-icon>\n      </md-button>\n    </header>\n\n    <div class="colors">\n      <div ng-show="!vm.selectedPalette" layout="row" layout-wrap>\n        <div class="color" ng-class="\'md-\'+palette+\'-500-bg\'" ng-repeat="(palette, hues) in vm.palettes" ng-click="vm.activateHueSelection(palette,hues)" layout="row" layout-align="start end" md-prevent-menu-close md-ink-ripple>\n          <span class="label">\n            {{palette}}\n          </span>\n        </div>\n      </div>\n\n      <div ng-show="vm.selectedPalette" layout="row" layout-wrap>\n        <div class="color" ng-class="\'md-\'+vm.selectedPalette+\'-\'+hue+\'-bg\'" ng-repeat="(hue, values) in vm.selectedHues" ng-click="vm.selectColor(vm.selectedPalette,hue)" layout="row" layout-align="start end" md-ink-ripple>\n          <span class="label">\n            {{hue}}\n          </span>\n          <i ng-if="vm.selectedPalette == vm.selectedColor.palette && hue == vm.selectedColor.hue" class="s16 icon-check">\n          </i>\n        </div>\n      </div>\n\n    </div>\n\n  </md-menu-content>\n</md-menu>'),e.put("app/core/directives/ms-navigation/templates/horizontal.html",'<div class="navigation-toggle" hide-gt-sm>\n  <md-button class="md-icon-button" ng-click="vm.toggleHorizontalMobileMenu()" aria-label="Toggle Mobile Navigation">\n    <md-icon md-font-icon="icon-menu"></md-icon>\n  </md-button>\n</div>\n\n<ul class="horizontal">\n  <li ng-repeat="node in vm.navigation" ms-navigation-horizontal-node="node" ng-class="{\'has-children\': vm.hasChildren}" ng-include="\'navigation-horizontal-nested.html\'"></li>\n</ul>\n\n\x3c!-- Nested horizontal navigation template --\x3e\n<script type="text/ng-template" id="navigation-horizontal-nested.html">\n\n  <div ms-navigation-horizontal-item layout="row" ng-if="!vm.isHidden()">\n\n        <div class="ms-navigation-horizontal-button" ng-if="!node.uisref && node.title"\n             ng-class="{\'active md-accent-bg md-accent-fg\': vm.isActive}">\n            <i class="icon s18 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg" style="background: {{node.badge.color}}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s18 arrow" ng-if="vm.hasChildren"></i>\n        </div>\n\n        <a class="ms-navigation-horizontal-button" ui-sref="{{node.uisref}}" ui-sref-active="active md-accent-bg"\n           ng-class="{\'active md-accent-bg md-accent-fg\': vm.isActive}"\n           ng-if="node.uisref && node.title">\n            <i class="icon s18 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg" style="background: {{node.badge.color}}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s18 arrow" ng-if="vm.hasChildren"></i>\n        </a>\n\n    </div>\n\n    <ul ng-if="vm.hasChildren && !vm.isHidden()">\n        <li ng-repeat="node in node.children" ms-navigation-horizontal-node="node"\n            ng-class="{\'has-children\': vm.hasChildren}"\n            ng-include="\'navigation-horizontal-nested.html\'"></li>\n    </ul>\n\n<\/script>\n\x3c!-- / Nested navigation template --\x3e'),e.put("app/core/directives/ms-navigation/templates/vertical.html",'<ul>\n  <li ng-repeat="node in vm.navigation" ms-navigation-node="node" ng-class="{\'collapsed\': vm.collapsed, \'has-children\': vm.hasChildren}" ng-include="\'navigation-nested.html\'"></li>\n</ul>\n\n\x3c!-- Nested navigation template --\x3e\n<script type="text/ng-template" id="navigation-nested.html">\n\n  <div id="{{ node.id }}" ms-navigation-item layout="row" ng-if="!vm.isHidden()">\n\n        <div class="ms-navigation-button" ng-if="!node.uisref && node.title">\n            <i class="icon s16 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg margin-right-20" ng-style="{\'background\': node.badge.color}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s16 arrow" ng-if="vm.collapsable && vm.hasChildren"></i>\n        </div>\n\n        <a class="ms-navigation-button" ui-sref="{{node.uisref}}" ui-sref-active="active md-accent-bg" ng-if="node.uisref && node.title">\n            <i class="icon s16 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg margin-right-20" ng-style="{\'background\': node.badge.color}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s16 arrow" ng-if="vm.collapsable && vm.hasChildren"></i>\n        </a>\n\n    </div>\n\n    <ul ng-if="vm.hasChildren && !vm.isHidden()">\n        <li ng-repeat="node in node.children" ms-navigation-node="node"\n            ng-class="{\'collapsed\': vm.collapsed, \'has-children\': vm.hasChildren}"\n            ng-include="\'navigation-nested.html\'"></li>\n    </ul>\n\n<\/script>\n\x3c!-- / Nested navigation template --\x3e'),e.put("assets/ms-phonebar/ms-phonebar-dialpad.html",'\x3c!-- Dialpad --\x3e\n<md-content ng-if="vm_pb.showDialpad" class="num-pad" layout="column">\n  <section layout="row" layout-align="start center">\n    <span><img class="num-pad-logo" layout-padding src="/api/settings/1/logo" alt="logo" /></span>\n    <span class="md-subhead">Dialpad</span>\n    <div layout="row" layout-align="end center" flex>\n      <md-button class="md-icon-button" ng-click="vm_pb.closeDialpad()">\n        <md-icon md-font-icon="icon-close"></md-icon>\n      </md-button>\n    </div>\n  </section>\n  <md-divider></md-divider>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 1, l: []}, {n: 2, l: [\'a\', \'b\', \'c\']}, {n: 3, l: [\'d\', \'e\', \'f\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 4, l: [\'g\', \'h\', \'i\']}, {n: 5, l: [\'j\', \'k\', \'l\']}, {n: 6, l: [\'m\', \'n\', \'o\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 7, l: [\'p\', \'q\', \'r\', \'s\']}, {n: 8, l: [\'t\', \'u\', \'v\']}, {n: 9, l: [\'w\', \'x\', \'y\', \'z\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: \'*\', l: []}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num" layout="column" layout-align="center center">\n        <div class="txt" layout="column" layout-align="center center">\n          {{item.n}}\n        </div>\n      </div>\n    </div>\n    <div class="span4" ng-repeat="item in ::[{n: 0, l: [\'+\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n    <div class="span4" ng-repeat="item in ::[{n: \'#\', l: []}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num" layout="column" layout-align="center center">\n        <div class="txt" layout="column" layout-align="center center">\n          {{item.n}}\n        </div>\n      </div>\n    </div>\n  </section>\n</md-content>\n\x3c!-- Dialpad --\x3e\n\n\x3c!-- Input&Media Area --\x3e\n<div layout="row" layout-align="start center">\n  <div layout="row" layout-align="center center">\n    \x3c!-- START Ringing Tone--\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Ringing" ng-click="vm_pb.conf.ringingMute = !vm_pb.conf.ringingMute; vm_pb.initDevice(\'ringing\', true)" ng-disabled="!vm_pb.registered">\n      <md-icon md-font-icon="{{vm_pb.conf.ringingMute ? \'icon-bell-off\' : \'icon-bell-ring\'}}" class="icon s14" ng-class="vm_pb.conf.ringingMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.RINGING">Ringing</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Ringing Tone --\x3e\n\n    \x3c!-- START Speaker --\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Speaker" ng-click="vm_pb.conf.speakerMute = !vm_pb.conf.speakerMute; vm_pb.initDevice(\'speaker\', true)" ng-disabled="!vm_pb.registered">\n      <md-icon md-font-icon="{{vm_pb.conf.speakerMute ? \'icon-volume-off\' : \'icon-volume\'}}" class="icon s14" ng-class="vm_pb.conf.speakerMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.SPEAKER">Speaker</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Speaker --\x3e\n\n    \x3c!-- START Microphone --\x3e\n    <md-button ng-disabled="(!vm_pb.registered || vm_pb.sessions.length==0)?true:false" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Microphone" ng-click="vm_pb.conf.microphoneMute = !vm_pb.conf.microphoneMute; vm_pb.initDevice(\'microphone\', true)">\n      <md-icon md-font-icon="{{vm_pb.conf.microphoneMute ? \'icon-microphone-off\' : \'icon-microphone\'}}" class="icon s14" ng-class="vm_pb.conf.microphoneMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.MICROPHONE">Microphone</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Microphone --\x3e\n\n    \x3c!-- START Registered --\x3e\n    <span>\n      <span class="quantity-indicator md-red-500-bg" ng-class="vm_pb.registered ? \'md-green-500-bg\' : \'md-red-500-bg\'"></span>\n      <md-tooltip><span>{{vm_pb.conf.license ? (vm_pb.registered ? \'TOOLBAR.REGISTERED\' : \'TOOLBAR.NOT_REGISTERED\') : \'TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD\' | translate}}\n          <timer ng-if="vm_pb.registered"></timer>\n        </span>\n      </md-tooltip>\n    </span>\n    \x3c!-- END Registered --\x3e\n  </div>\n  <div layout="column" layout-align="center start">\n    <div layout="row" layout-align="start center">\n      \x3c!-- START Target --\x3e\n      <angucomplete-alt id="ms-target-wrap" pause="10" local-data="vm_pb.calls" search-fields="target" title-field="target" minlength="0" input-class="input-number" disable-input="!vm_pb.registered" match-class="highlight" template-url="assets/ms-phonebar/ms-phonebar-input.html" input-changed="vm_pb.targetChanged" selected-object="vm_pb.targetSelected" clear-selected="true" ng-keypress="vm_pb.typeWrapper($event)" focus-first="true" disable-autocomplete="vm_pb.currentUser.privacyEnabled"></angucomplete-alt>\n      \x3c!-- END Target --\x3e\n\n      \x3c!-- Auto Answer --\x3e\n      <div ng-if="vm_pb.conf.autoAnswer" class="red-fg" style="padding-left: 10px;">\n        <span class="font-size-20">A<span class="font-size-16">A</span></span>\n      </div>\n      \x3c!-- Auto Answer --\x3e\n\n      <md-button class="md-fab md-mini white-bg width-30 height-30" aria-label="Dialpad" ng-click="vm_pb.toggleDialpad()" ng-disabled="!vm_pb.registered">\n        <md-icon md-font-icon="icon-apps" class="icon grey-fg s16"></md-icon>\n      </md-button>\n      <md-button ng-if="vm_pb.target" class="md-fab md-mini white-bg width-25 height-25" aria-label="Call" style="margin-left: 0px;" ng-click="vm_pb.call()">\n        <md-icon md-font-icon="icon-phone" class="icon green-fg s12"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>\n\x3c!-- Input&Media Area --\x3e\n\n\x3c!-- START 3WC --\x3e\n<md-button ng-if="vm_pb.canGoInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="3Way" ng-click="vm_pb.start3WayConf();  $event.stopPropagation();">\n  <md-icon md-font-icon="icon-account-multiple-plus" class="icon orange-fg s14"></md-icon>\n  <md-tooltip><span translate="TOOLBAR.CONFERENCE">Conference</span></md-tooltip>\n</md-button>\n\x3c!-- END 3Way --\x3e\n\n\n<div class="toolbar-separator"></div>\n\n\x3c!-- Sessions Area --\x3e\n<div class="sessions" layout="row" layout-align="start center" flex>\n  <div layout="row" layout-align="center center" ng-if="!vm_pb.conf.license">\n    <md-icon md-font-icon="icon-account-alert" class="icon s36 red-fg"></md-icon>\n    <span layout-margin translate="TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"></span>\n  </div>\n\n  <div id="{{\'div_session_\'+session.id.substr(0,32)}}" ng-repeat="session in vm_pb.sessions" class="session" layout="row" ng-click="(vm_pb.sessions.length > 1) && vm_pb.selectSession(session)">\n    <md-button ng-if="vm_pb.conf.recording && session.confirmed" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Record" ng-click="vm_pb.record(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-radiobox-marked" class="icon s14" ng-class="session.monitor ? \'red-fg\' : \'grey-fg\'"></md-icon>\n    </md-button>\n    <div layout="column" layout-align="center start">\n      <span class="session-info">\n        <span ng-if="session.user == session.name" privacy ng-cloak>{{session.user}}</span>\n        <span ng-if="session.user != session.name" privacy ng-cloak>{{session.name}}</span> <span ng-if="session.user != session.name" privacy ng-cloak>{{session.user}}</span>\n      </span>\n      <span class="session-info" layout="row" layout="start center">\n        <timer></timer>\n      </span>\n    </div>\n\n    \x3c!-- START Answer --\x3e\n    <md-button ng-if="session.incoming && !session.confirmed" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Anser" ng-click="vm_pb.answer(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone" class="icon green-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Answer --\x3e\n\n    \x3c!-- START Hangup --\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Terminate" ng-click="vm_pb.terminate(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-hangup" class="icon red-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Hangup --\x3e\n\n    \x3c!-- START Hold/Unhold --\x3e\n    <md-button ng-if="session.confirmed && !vm_pb.isInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Hold" ng-click="(session.localHold ? vm_pb.unhold(session) : vm_pb.hold(session)); $event.stopPropagation();">\n      <md-icon md-font-icon="{{session.localHold ? \'icon-play\' : \'icon-pause\'}}" class="icon grey-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Hold/Unhold --\x3e\n\n    \x3c!-- START Transfer --\x3e\n    <md-button ng-if="session.confirmed && !session.localHold && vm_pb.sessions.length == 1 && !vm_pb.isInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Refer" ng-click="vm_pb.refer(session);  $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END transfer --\x3e\n\n    \x3c!-- START Attended Transfer --\x3e\n    <md-button ng-if="session.confirmed && !session.localHold && vm_pb.sessions.length>1" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Refer Attended" ng-click="vm_pb.referAttended(session);  $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Attended Transfer --\x3e\n  </div>\n</div>\n\x3c!-- Sessions Area --\x3e'),e.put("assets/ms-phonebar/ms-phonebar-input.html",'<div class="angucomplete-holder" ng-class="{\'angucomplete-dropdown-visible\': showDropdown}">\n  <input id="ms-target" ng-model="searchStr" ng-disabled="disableInput" type="text" placeholder="{{placeholder}}" ng-focus="onFocusHandler()" class="{{inputClass}}" ng-focus="resetHideResults()" ng-blur="hideResults($event)" autocapitalize="off" autocorrect="off" autocomplete="off" ng-change="inputChangeHandler(searchStr)" />\n  <div class="angucomplete-dropdown" ng-show="showDropdown && !(!searching && (!results || results.length == 0))">\n    <div class="angucomplete-row" ng-repeat="result in results" ng-click="selectResult(result)" ng-mouseenter="hoverRow($index)" ng-class="{\'angucomplete-selected-row\': $index == currentIndex}">\n      <div layout="row" layout-align="start center">\n        <md-icon md-font-icon="{{result.originalObject.inbound ? \'icon-arrow-bottom-left\' : \'icon-arrow-top-right\'}}" class="icon no-margin s22"></md-icon>\n        <span style="margin-left: 8px;">({{result.originalObject.time}}) - <span class="angucomplete-title" ng-if="matchClass" ng-bind-html="result.title" privacy ng-cloak></span></span>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("assets/ms-phonebar/ms-phonebar.html",'<div layout="row" layout-align="start center" flex>\n  \x3c!-- Audio stream --\x3e\n  <audio id="local-audio" autoplay hidden=true></audio>\n  <audio id="remote-audio" autoplay hidden=true></audio>\n  \x3c!-- Audio stream --\x3e\n\n  \x3c!-- WebRtc PhoneBar --\x3e\n  <div class="phonebar-container" ng-include="\'assets/ms-phonebar/ms-phonebar-dialpad.html\'" layout="row" layout-align="start center" flex></div>\n  \x3c!-- WebRtc PhoneBar --\x3e\n</div>'),e.put("assets/ms-phonebar/prefix/dialog.html",'<md-dialog aria-label="Prefix">\n  <form ng-cloak ng-keypress="vm.keyPress($event)">\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.PREFIXES">Prefixes</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog(-1)">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-radio-group ng-model="vm.prefix">\n        <md-radio-button ng-repeat="prefix in vm.prefixes.rows" value="{{prefix.prefix}}" class="md-primary">{{prefix.name}}</md-radio-button>\n        <md-radio-button ng-if="!vm.required" ng-value="null" class="md-primary">no prefix</md-radio-button>\n      </md-radio-group>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.call()" class="send-button md-accent md-raised" aria-label="call" md-autofocus ng-disabled="!vm.prefix && vm.required">\n        <span translate="TOOLBAR.CALL">CALL</span>\n      </md-button>\n      <md-button ng-click="vm.closeDialog(-1)" class="send-button md-accent md-raised" aria-label="cancel">\n        <span translate="TOOLBAR.CANCEL">Cancel</span>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("assets/ms-phonebar/record/dialog.html",'<md-dialog aria-label="Recording" ng-init="vm.onInit()">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.RECORDING">Recording</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding">\n            <md-icon class="no-margin" md-font-icon="icon-plus" aria-label="Add" ng-click="vm.addRecording()"></md-icon>\n          </md-button>\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog()">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-table-container>\n      <table md-table layout-padding>\n        <thead md-head>\n          <tr md-row>\n            <th md-column><span translate="TOOLBAR.FILENAME">File name</span></th>\n            <th md-column><span translate="TOOLBAR.STATUS">Status</span></th>\n            <th md-column><span translate="TOOLBAR.ACTIONS">Actions</span></th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm.session.monitors.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="TOOLBAR.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="monitor in vm.session.monitors">\n            <td md-cell>{{monitor.filename}}</td>\n            <td md-cell class="no-padding">\n              <md-icon md-font-icon="icon-radiobox-marked" class="icon s16" ng-class="(monitor.status == \'rec\') ? \'red-fg ms-blink\' : \'grey-fg\'"></md-icon>\n            </td>\n            <td md-cell class="no-padding">\n              <md-button class="md-fab md-mini white-bg width-35 height-35 margin-5" aria-label="Record" ng-click="(monitor.status == \'rec\') ? vm.stop(monitor) : vm.start(monitor)">\n'+"                <md-icon md-font-icon=\"{{monitor.status == 'rec' ? 'icon-stop' : 'icon-play'}}\" class=\"icon s16\" ng-class=\"monitor.status == 'rec' ? 'grey-fg' : 'red-fg'\"></md-icon>\n              </md-button>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n  </form>\n</md-dialog>"),e.put("assets/ms-phonebar/referAttended/dialog.html",'<md-dialog aria-label="Transfer">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.ATTENDED_TRANSFER">Transfer</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog()">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <label translate="TOOLBAR.TARGET">Target</label>\n      <md-input-container class="md-block">\n        <md-select ng-model="vm.target">\n          <md-option ng-repeat="session in vm.sessions" ng-value="session.user">\n            {{ session.name }}\n          </md-option>\n        </md-select>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.transfer()" class="send-button md-accent md-raised" aria-label="transfer" ng-disabled="!vm.target && !vm.sessionId">\n        <span translate="TOOLBAR.TRANSFER">TRANSFER</span>\n      </md-button>\n      <md-button ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="cancel">\n        <span translate="TOOLBAR.CANCEL">Cancel</span>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("assets/ms-phonebar/settings/settings.html",'<md-dialog class="md-phonebar-dialog" aria-label="{{vm.name}}">\n  <form name="settingsForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="TOOLBAR.SETTINGS">Settings</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content class="no-padding">\n      <md-tabs md-no-pagination md-stretch-tabs="always">\n        <md-tab label="{{ \'TOOLBAR.PROFILE\' | translate}}">\n          <md-content layout-padding layout="column">\n            <span><span translate="TOOLBAR.FULLNAME">Fullname</span>: {{vm.conf.fullname}}</span>\n            <span><span translate="TOOLBAR.NAME">Name</span>: {{vm.conf.name}}</span>\n            <span><span translate="TOOLBAR.INTERNAL">Internal</span>: {{vm.conf.internal}}</span>\n            <span><span translate="TOOLBAR.BROWSER">Browser</span>: {{vm.conf.browserName}} {{vm.conf.browserVersion}}</span>\n            <span><span translate="TOOLBAR.OS">OS</span>: {{vm.conf.osName}} {{vm.conf.osVersion}}</span>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.SERVICES\' | translate}}">\n          <md-content layout-padding>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.conf.autoAnswer" aria-label="Auto Answer">\n                <span translate="TOOLBAR.AUTOANSWER">Auto Answer</span>\n                <span>{{ vm.conf.autoAnswerDelay }} [s]</span>\n              </md-switch>\n              <md-switch ng-model="vm.messengerSoundNotification" aria-label="EnableMessengerSoundNotification">\n                <span translate="TOOLBAR.MESSENGERSOUNDNOTIFICATION">MessengerSoundNotification</span>\n              </md-switch>              \n            </md-input-container>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.AUDIO\' | translate}}">\n          <md-content layout-padding>\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audiooutput\' }).length">\n                <label translate="TOOLBAR.RINGINGDEVICE">Ringing Device</label>\n                <md-select name="ringingDevice" ng-model="vm.conf.ringingId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audiooutput\' }">{{ device.label || (\'Speaker \' + ($index + 1)) }}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'ringingDevice\'].$error" ng-show="settingsForm[\'ringingDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div layout="row" layout-align="space-between center">\n                <md-switch ng-model="vm.conf.ringingMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n\n                <md-slider-container flex="80">\n                  <md-slider flex step="0.1" min="0" max="1" ng-model="vm.conf.ringingVolume" aria-label="volume"></md-slider>\n                </md-slider-container>\n              </div>\n            </div>\n\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audiooutput\' }).length">\n                <label translate="TOOLBAR.SPEAKERDEVICE">Speaker Device</label>\n                <md-select name="speakerDevice" ng-model="vm.conf.speakerId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audiooutput\' }">{{ device.label || (\'Speaker \' + ($index + 1)) }}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'speakerDevice\'].$error" ng-show="settingsForm[\'speakerDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div layout="row" layout-align="space-between cetner">\n                <md-switch ng-model="vm.conf.speakerMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n\n                <md-slider-container flex="80">\n                  <md-slider flex step="0.1" min="0" max="1" ng-model="vm.conf.speakerVolume" aria-label="volume"></md-slider>\n                </md-slider-container>\n              </div>\n            </div>\n\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audioinput\' }).length">\n                <label translate="TOOLBAR.MICROPHONEDEVICE">Microphone Device</label>\n                <md-select name="microphoneDevice" ng-model="vm.conf.microphoneId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audioinput\' }">{{ device.label || (\'Microphone \' + ($index + 1))}}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'microphoneDevice\'].$error" ng-show="settingsForm[\'microphoneDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n              <div layout="row" layout-align="space-between center">\n                <md-switch ng-disabled="vm.activeSessions.length==0" ng-model="vm.conf.microphoneMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n              </div>\n            </div>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.REQUIREMENTS\' | translate}}">\n          <md-content layout-padding>\n            <md-list>\n              <md-list-item>\n                <h3 translate="TOOLBAR.LICENSE">License</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.license ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.license ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.BROWSER_COMPATIBILITY">Browser Compatibility</h3>\n                <md-icon class="md-secondary" ng-class="vm.isCompatibleBrowser() ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.isCompatibleBrowser() ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.HTTPS">HTTPS</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.protocol === \'https\' ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.protocol === \'https\' ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.WEBRTCSUPPORT">WebRTC Support</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.isWebRTCSupported ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.isWebRTCSupported ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.MICROPHONE">Microphone</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.hasMicrophone ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.hasMicrophone ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.SPEAKER">Speaker</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.hasSpeakers ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.hasSpeakers ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n            </md-list>\n          </md-content>\n        </md-tab>\n      </md-tabs>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveSettings()" class="send-button md-accent md-raised" ng-disabled="settingsForm.$invalid || settingsForm.$pristine" aria-label="SAVE" translate="TOOLBAR.SAVE" translate-attr-aria-label="TOOLBAR.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/directives/ms-quick-filter/ms-quick-filter.html",'<div ng-cloak layout="row" class="quick-filter-container" flex>\n  <div ng-repeat="filter in vm.filters" ng-if="filter.ngIf ? $eval(\'vm.query.\' + filter.ngIf) : true" layout="column" class="padding-horizontal-16">\n    <span class="font-size-10" translate="{{ filter.label }}" />\n    <md-select ng-if="filter.type === \'select\'" class="font-size-12 no-margin" ng-model="vm.query[filter.key]" ng-change="vm.search()" aria-label="Filter {{ filter.name }}">\n      <md-option ng-repeat="option in filter.options" ng-value="filter.ngValue ? option[filter.ngValue] : option.id">\n        {{ option.name }}</md-option>\n      <md-option ng-repeat="option in filter.customOptions" ng-value="option.value" translate="{{ option.translate }}">\n      </md-option>\n    </md-select>\n\n    <md-select ng-if="filter.type === \'multiselect\'" multiple class="font-size-12 no-margin" ng-init="vm.onMultiselectInit(filter)" ng-model="vm.query[filter.key]" ng-disabled="filter.options.length === 0" ng-change="vm.onMultiselectSelection(filter, isOpen)" md-selected-text="vm.placeholders[filter.key]" aria-label="Filter {{ filter.name }}" md-on-open="isOpen = true" md-on-close="isOpen = false">\n      <md-option ng-repeat="option in filter.options" ng-value="filter.ngValue ? option[filter.ngValue] : option.id" ng-disabled="filter.clearAll === false && vm.query[filter.key].length === 1 && vm.query[filter.key][0] === (filter.ngValue ? option[filter.ngValue] : option.id)">\n        {{ option.name }}</md-option>\n      <md-button ng-if="vm.query[filter.key].length &lt; filter.options.length" ng-click="vm.selectAll(filter)" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.SELECT_ALL\' | translate}}</md-button>\n      <md-button ng-if="vm.query[filter.key].length === filter.options.length" ng-click="vm.clearSelection(filter)" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.CLEAR\' | translate}}</md-button>\n    </md-select>\n\n    <div ng-if="filter.type === \'date\'" layout="row" layout-align="center center">\n      <md-date-range ng-init="vm.onDateRangeInit(filter)" localization-map="vm.localizationMap" ng-model="vm.pickerModels[filter.key]" auto-confirm="true" show-template="true" md-on-select="vm.onDateRangeSelection(filter)" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}">\n      </md-date-range>\n      <md-button ng-if="vm.pickerModels[filter.key].dateStart" ng-click="vm.clearDate(filter)" class="md-icon-button no-margin no-padding width-20 height-20" aria-label="Clear date filter">\n        <md-icon md-font-icon="icon-close" class="quick-filter-date-clear-button s16"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-search-bar/ms-search-bar.html",'<div flex layout="row" layout-align="start center">\n  <label>\n    <md-button class="ms-search-bar-expander md-icon-button" aria-label="Expand Search Bar" ng-click="vm.expandBar()" ng-if="!vm.resultsLoading || !vm.expanded" ng-class="{\'ms-search-button-expanded\': vm.expanded }">\n      <md-icon id="ms-search-bar-icon" md-font-icon="icon-magnify" class="s24" ng-class="{\'{{ vm.iconColor }}\': vm.iconColor && !vm.expanded }"></md-icon>\n    </md-button>\n    <div class="ms-search-bar-loader" layout="row" layout-align="center center" ng-if="vm.resultsLoading && vm.expanded">\n      <md-progress-circular class="md-accent" md-diameter="32" md-mode="indeterminate"></md-progress-circular>\n    </div>\n  </label>\n  <input ng-if="vm.expanded" focus-on="vm.expanded" type="text" placeholder="{{ \'TOOLBAR.SEARCH\' | translate }}" flex ng-model="vm.query.filter" ng-model-options="vm.queryOptions" ng-blur="vm.blurCollapse()" ng-keydown="vm.onKeyDown($event)" />\n  <md-button class="ms-search-bar-collapser md-icon-button" ng-click="vm.collapseBar(true)" aria-label="Collapse Search Bar">\n    <md-icon md-font-icon="icon-close" class="icon s24"></md-icon>\n  </md-button>\n  <div class="ms-search-bar-results" ng-if="vm.results">\n    <div class="no-results" ng-if="vm.results.length === 0">{{ \'DASHBOARDS.NO_RESULTS_AVAILABLE\' | translate }}</div>\n    <div class="result" ng-repeat="result in vm.results" ng-click="vm.handleResultClick(result)" ng-mouseenter="vm.handleMouseEnter($index)" ng-mousedown="vm.absorbEvent($event)" ng-class="{\'selected\': $index == vm.selectedResultIndex}" md-ink-ripple>\n      <div layout="row" layout-align="start center">\n        <div class="icon-container" layout="row" layout-align="center center">\n          <i ng-if="result.icon" class="icon {{ result.icon }}"></i>\n          <div ng-if="!result.icon" class="square md-accent-bg"></div>\n        </div>\n        <div>\n          <div class="title">{{ result.title }}</div>\n          <div class="description" ng-if="result.description">{{ result.description }}</div>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-shortcuts/ms-shortcuts.html",'<div class="shortcuts-container" layout="row" layout-align="space-between center" flex ng-class="{\'mobile-bar-active\': MsShortcuts.mobileBarActive}">\n\n  <div class="flex-noshrink" layout="row" layout-align="start center" flex>\n    <div class="shortcuts hide show-gt-xs" layout="row" layout-align="start center" ng-if="MsShortcuts.shortcuts.length > 0" ng-sortable="MsShortcuts.sortableOptions">\n      <div ng-repeat="shortcut in MsShortcuts.shortcuts" layout="row" layout-align="center center">\n        <md-button class="md-icon-button shortcut" aria-label="{{shortcut.title}}" ui-sref="{{shortcut.uisref}}">\n          <md-icon ng-if="shortcut.icon" md-font-icon="{{shortcut.icon}}" class="icon s24"></md-icon>\n          <div ng-if="!shortcut.icon" class="first-letter">{{shortcut.title.charAt(0)}}</div>\n          <md-tooltip md-direction="bottom">{{shortcut.title}}</md-tooltip>\n        </md-button>\n      </div>\n    </div>\n\n    \x3c!-- <md-menu md-offset="8 56" class="shortcut-menu hide show-gt-xs">\n            <md-button class="md-icon-button add-shortcut-button" aria-label="Add shortcut"\n                       ng-click="$mdOpenMenu($event)">\n                <md-icon md-menu-origin md-font-icon="icon-star" class="icon amber-600-fg s24"></md-icon>\n                <md-tooltip md-direction="bottom">Click to add/remove shortcut</md-tooltip>\n            </md-button>\n\n            <md-menu-content>\n                <div id="ms-shortcut-add-menu">\n                    <div class="shortcut-search" layout="row" layout-align="start center">\n                        <div class="search-icon" layout="row" layout-align="center center"\n                             ng-if="!MsShortcuts.resultsLoading">\n                            <md-icon md-menu-align-target md-font-icon="icon-magnify" class="icon s24"></md-icon>\n                        </div>\n                        <div class="shortcut-loader" layout="row" layout-align="center center"\n                             ng-if="MsShortcuts.resultsLoading">\n                            <md-progress-circular class="md-accent" md-diameter="20" md-mode="indeterminate">\n                            </md-progress-circular>\n                        </div>\n\n                        <input type="text" placeholder="Search" flex\n                               ng-model="MsShortcuts.query"\n                               ng-model-options="MsShortcuts.queryOptions"\n                               ng-keydown="MsShortcuts.handleKeydown($event)">\n                    </div>\n\n                    <div class="results" ng-if="MsShortcuts.results" >\n                        <div class="no-results" ng-if="MsShortcuts.results.length === 0">No Results!</div>\n\n                        <div class="result" ng-repeat="result in MsShortcuts.results"\n                             ng-click="MsShortcuts.handleResultClick(result)"\n                             ng-mouseenter="MsShortcuts.handleMouseenter($index)"\n                             ng-mousedown="MsShortcuts.absorbEvent($event)"\n                             ng-class="{\'selected\': $index == MsShortcuts.selectedResultIndex}"\n                             md-prevent-menu-close="md-prevent-menu-close"\n                             md-ink-ripple>\n                            <div layout="row" layout-align="start space-between">\n                                <div layout="row" layout-align="start center" flex>\n                                    <div class="icon icon-container" layout="row" layout-align="center center">\n                                        <i ng-if="result.icon" class="{{result.icon}}"></i>\n                                        <div ng-if="!result.icon" class="square md-accent-bg"></div>\n                                    </div>\n                                    <div>\n                                        <div class="title">{{result.title}}</div>\n                                    </div>\n                                </div>\n                                <md-icon md-font-icon="icon-pin" class="icon s18"\n                                         ng-class="{\'fade-text\': !result.hasShortcut}"></md-icon>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </md-menu-content>\n        </md-menu> --\x3e\n  </div>\n\n  <md-button class="md-icon-button toggle-mobile-menu hide-gt-xs" aria-label="Add shortcut" ng-click="MsShortcuts.toggleMobileBar()">\n    <md-icon md-menu-origin md-font-icon="icon-star" class="icon amber-600-fg s24" ng-hide="MsShortcuts.mobileBarActive"></md-icon>\n    <md-icon md-menu-origin md-font-icon="icon-close" class="icon s24" ng-hide="!MsShortcuts.mobileBarActive"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-stepper/templates/horizontal/horizontal.html",'<div class="ms-stepper-horizontal">\n  <div class="ms-stepper-navigation-wrapper">\n    <div class="ms-stepper-navigation" layout="row" layout-align="center center">\n      <md-button class="ms-stepper-navigation-item" ng-class="{\'current\': MsStepper.isStepCurrent(step.stepNumber), \'valid\': MsStepper.isStepValid(step.stepNumber), \'disabled\': MsStepper.isStepDisabled(step.stepNumber), \'optional\': MsStepper.isStepOptional(step.stepNumber)}" ng-click="MsStepper.gotoStep(step.stepNumber)" ng-disabled="MsStepper.isStepDisabled(step.stepNumber)" ng-repeat="step in MsStepper.steps | filter:MsStepper.filterHiddenStep" layout="row" layout-align="start center">\n\n        <div class="step md-accent-bg" layout="row" layout-align="center center">\n          <span ng-if="!MsStepper.isStepValid(step.stepNumber) || MsStepper.isStepOptional(step.stepNumber)">\n            {{$index + 1}}\n          </span>\n          <span ng-if="MsStepper.isStepValid(step.stepNumber) && !MsStepper.isStepOptional(step.stepNumber)">\n            <i class="icon icon-check s18"></i>\n          </span>\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="title" translate="{{step.stepTitleTranslate}}">{{step.stepTitle}}</div>\n          <div class="subtitle" ng-if="MsStepper.isStepOptional(step.stepNumber)">Optional</div>\n        </div>\n      </md-button>\n    </div>\n  </div>\n\n  <div class="ms-stepper-steps" ng-transclude></div>\n\n  <div class="ms-stepper-controls" layout="row" layout-align="center center">\n    <md-button class="md-accent md-raised" ng-disabled="MsStepper.isFirstStep()" ng-click="MsStepper.gotoPreviousStep()">\n      Back\n    </md-button>\n\n    <div class="ms-stepper-dots">\n      <span ng-repeat="step in MsStepper.steps" ng-hide="MsStepper.isStepHidden(step.stepNumber)" ng-class="{\'selected md-accent-bg\':MsStepper.currentStepNumber === $index + 1}">\n      </span>\n    </div>\n\n    <md-button class="md-accent md-raised" ng-if="!MsStepper.isLastStep()" ng-disabled="!MsStepper.isStepValid(MsStepper.currentStepNumber)" ng-click="MsStepper.gotoNextStep()">\n      Next\n    </md-button>\n\n    <md-button type="submit" class="md-accent md-raised" ng-click="MsStepper.resetForm()" ng-if="MsStepper.isLastStep()" ng-disabled="!MsStepper.isFormValid()">\n      Submit\n    </md-button>\n  </div>\n</div>'),e.put("app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",'<md-button class="ms-stepper-navigation-item" ng-class="{\'current\': MsStepper.isStepCurrent(stepInfo.stepNumber), \'valid\': MsStepper.isStepValid(stepInfo.stepNumber), \'disabled\': MsStepper.isStepDisabled(stepInfo.stepNumber), \'optional\': MsStepper.isStepOptional(stepInfo.stepNumber)}" ng-click="MsStepper.gotoStep(stepInfo.stepNumber)" ng-disabled="MsStepper.isStepDisabled(stepInfo.stepNumber)" ng-hide="MsStepper.isStepHidden(stepInfo.stepNumber)" aria-label="Stepper navigation button" layout="row" layout-align="start center">\n\n  <div class="step" layout="row" layout-align="center center">\n    <span ng-if="!MsStepper.isStepValid(stepInfo.stepNumber) || MsStepper.isStepOptional(stepInfo.stepNumber)">\n      <i class="icon icon-checkbox-blank-circle-outline s18 md-accent-fg"></i>\n    </span>\n    <span ng-if="MsStepper.isStepValid(stepInfo.stepNumber) && !MsStepper.isStepOptional(stepInfo.stepNumber)">\n      <i class="icon icon-check-circle s18 md-accent-fg"></i>\n    </span>\n  </div>\n\n  <div layout="column" layout-align="start start">\n    <div class="title" ng-if="stepInfo.stepTitleTranslate">{{stepInfo.stepTitleTranslate | translate }}</div>\n    <div class="title" ng-if="!stepInfo.stepTitleTranslate">{{stepInfo.stepTitle}}</div>\n    <div class="subtitle" ng-if="MsStepper.isStepOptional(stepInfo.stepNumber)">Optional</div>\n  </div>\n</md-button>\n\n<div class="ms-stepper-step-content" ng-transclude></div>\n\n<div class="ms-stepper-controls" layout="row" layout-align="start center" ng-show="MsStepper.isStepCurrent(stepInfo.stepNumber)">\n  <md-button class="md-accent md-raised" ng-disabled="MsStepper.isFirstStep()" ng-click="MsStepper.gotoPreviousStep()">\n    Back\n  </md-button>\n\n  <md-button class="md-accent md-raised" ng-if="!MsStepper.isLastStep()" ng-disabled="!MsStepper.isStepValid(MsStepper.currentStepNumber)" ng-click="MsStepper.gotoNextStep()">\n    Next\n  </md-button>\n\n  <md-button type="submit" class="md-accent md-raised" ng-click="MsStepper.resetForm()" ng-if="MsStepper.isLastStep()" ng-disabled="!MsStepper.isFormValid()">\n    Submit\n  </md-button>\n</div>'),e.put("app/core/directives/ms-stepper/templates/vertical/vertical.html",'<div class="ms-stepper-vertical">\n  <div class="ms-stepper-vertical-line"></div>\n  <div class="ms-stepper-steps" ng-transclude></div>\n</div>'),e.put("app/core/directives/ms-tab-scroll/ms-tab-scroll.html",'<div layout="row">\n  <md-button class="md-icon-button md-mini width-25 no-margin scroll-arrow" ng-click="vm.onTabScroll(\'left\')" ng-if="vm.canScroll(\'left\') == true">\n    <md-icon md-font-icon="icon-chevron-left" class="icon s26"></md-icon>\n  </md-button>\n  <div id="bar-container" layout="row" class="bar-container">\n    <div ng-transclude id="tab-container" layout="row" layout-align="start center" class="scroll-container">\n    </div>\n  </div>\n  <md-button class="md-icon-button md-mini width-25 no-margin scroll-arrow" ng-click="vm.onTabScroll(\'right\')" ng-if="vm.canScroll(\'right\') == true">\n    <md-icon md-font-icon="icon-chevron-right" class="icon s26"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-timezone/ms-timezone.html",'<md-select ng-model="ngModel" class="no-margin" ng-change="ngChange()">\n  <md-option ng-value="null">NONE</md-option>\n  <md-option ng-repeat="t in timezone | orderBy:\'utcOffset\'" value="{{t.name}}">{{t.name}} ({{t.offsetStr}})</md-option>\n</md-select>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-counter/ms-widget-engine.counter.html",'<div class="pt-8 pb-2" layout="column" layout-align="center center" layout-fill ng-controller="MsWidgetEngineCounterController as vm">\n  <div ng-class="\'font-size-\' + (vm.fontSize * 2)" ng-style="{\'color\': widget.foreground}">\n    {{ vm.getCount(widget) }}\n  </div>\n  <div ng-class="\'font-size-\' + vm.fontSize" ng-style="{\'color\': widget.foreground}">{{ \'TOOLS.\' +  vm.label | uppercase | translate }}<span ng-if="vm.filtered">*</span></div>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-multibar-chart/ms-widget-engine.multibar-chart.html",'<div ng-controller="MsWidgetEngineMultibarChartController as vm" ng-init="vm.getMultiBarChart(widget)" layout="column" layout-fill>\n\n  <span ng-show="false">{{ vm.getMultiBarChart(widget)}}</span>\n\n  <canvas style="overflow:scroll" id="bar" class="chart-horizontal-bar" chart-data="vm.multiBarChart.data" chart-options="vm.multiBarChart.options" chart-series="vm.multiBarChart.series" chart-labels="vm.multiBarChart.labels">\n  </canvas>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-pie-chart/ms-widget-engine.pie-chart.html",'<div ng-controller="MsWidgetEnginePieChartController as vm" ng-init="vm.getPieChart(widget)" layout="column" layout-fill>\n\n  <span ng-show="false">{{ vm.getPieChart(widget)}}</span>\n\n  <canvas style="overflow:scroll" id="pie" class="chart-pie" chart-data="vm.pieChart.data" chart-labels="vm.pieChart.labels" chart-options="vm.pieChart.options">\n  </canvas>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-web-report/ms-widget-engine.web-report.html",'<div ng-controller="MsWidgetEngineWebReportController as vm" ng-init="vm.onInit(widget)">\n  <dl ng-if="vm.error">\n    <dt class="text-bold">Query Error</dt>\n    <dd>{{vm.error.sql}}</dd>\n    <dt>Message</dt>\n    <dd>{{vm.error.msg}}</dd>\n  </dl>\n  <md-toolbar class="md-table-toolbar md-default">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{vm.title}}</span>\n      <div flex></div>\n      <md-button class="md-icon-button" ng-click="vm.onInit(widget)" aria-label="refresh">\n        <md-icon md-font-icon="icon-refresh"></md-icon>\n      </md-button>\n      <span ng-if="vm.refresh && vm.countDown" class="md-subhead blue-fg">{{vm.countDown}}</span>\n    </div>\n  </md-toolbar>\n  <md-table-container ng-if="!vm.error">\n    <table md-table md-progress="vm.promise">\n      <thead md-head>\n        <tr md-row>\n          <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-repeat="row in vm.results.rows">\n          <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n        </tr>\n        <tr md-row ng-if="!vm.results.rows.length">\n          <td md-cell colspan="{{vm.columns.length}}">\n            <div layout="row" layout-align="center center">\n              <span>No Data</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.results.count}}" md-on-paginate="vm.getResults" md-page-select></md-table-pagination>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine.html",'<div gridster="vm.config">\n  <ul>\n    <li gridster-item="widget" ng-repeat="widget in vm.config.widgets">\n      <md-card layout-fill>\n        <md-toolbar class="height-40" ng-style="{\'background-color\': widget.background, \'color\': widget.foreground }">\n          <div class="md-toolbar-tools height-40 no-margin" layout="row" layout-align="start center">\n            <a ng-href="{{widget.link ? widget.link : \'javascript:void(0)\'}}" ng-style="{\'color\': widget.foreground, \'font-size\': (widget.titleFontSize || 12) }" class="text-truncate" flex>\n              {{ widget.title || \'No Title\' }}\n            </a>\n            <md-button ng-if="!vm.config.preview && !vm.config.crudPermissions.readOnly" class="draggable md-icon-button width-30 no-margin no-padding" aria-label="Move">\n              <md-tooltip><span translate="TOOLS.MOVE_WIDGET">Move</span></md-tooltip>\n              <md-icon md-font-icon="icon-cursor-move" class="s20" ng-style="{\'color\': widget.foreground}"></md-icon>\n            </md-button>\n            <md-menu ng-if="!vm.config.preview">\n              <md-button ng-click="$mdOpenMenu($event)" class="md-icon-button width-30 no-margin no-padding" aria-label="More">\n                <md-icon md-font-icon="icon-dots-vertical" class="s20" ng-style="{\'color\': widget.foreground}"></md-icon>\n              </md-button>\n              <md-menu-content>\n                <md-menu-item ng-if="vm.config.crudPermissions.canEdit === true">\n                  <md-button ng-click="vm.onEdit({widget: widget})" translate="TOOLS.EDIT_WIDGET">Edit\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.config.crudPermissions.canDelete === true">\n                  <md-button ng-click="vm.onDelete({widget: widget})" translate="TOOLS.DELETE_WIDGET">\n                    Delete</md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n\n          </div>\n        </md-toolbar>\n        <md-card-content class="resizable" layout="column" layout-align="center center" flex style="height: 60px !important; min-height: 60px !important" ng-style="{\'background-color\': widget.background, \'color\': widget.foreground}">\n          <div ng-switch="widget.type" layout-fill>\n            <iframe ng-switch-when="iframe|custom" ng-switch-when-separator="|" ng-src="{{vm.getTrustedURL(widget.attrs[0].value)}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n            <ds-widget-clock ng-class="\'font-size-\' + (widget.attrs[2].value || 12)" ng-switch-when="clock" digital-format="widget.attrs[0].value" gmt-offset="widget.attrs[1].value" data-show-digital show-gmt-info></ds-widget-clock>\n            <div ng-switch-default layout-fill>\n              <div ng-include="widget.templateUrl" layout-fill></div>\n            </div>\n          </div>\n        </md-card-content>\n      </md-card>\n    </li>\n  </ul>\n</div>'),e.put("app/core/layouts/content-only.html",'<div id="layout-content-only" class="template-layout" layout="column" flex>\n  <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n</div>'),e.put("app/core/layouts/content-with-toolbar.html",'<div id="layout-content-with-toolbar" class="template-layout" layout="column" flex>\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n  <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n</div>'),e.put("app/core/layouts/horizontal-navigation.html",'<div id="layout-horizontal-navigation" class="template-layout" layout="column" flex>\n\n  <div id="toolbar-navigation-container" class="md-whiteframe-1dp" layout="column" layout-align="space-between start">\n    <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n    <div id="horizontal-navigation" ui-view="navigation" layout="row" layout-align="start end" flex></div>\n  </div>\n\n  <div id="content-container" flex layout="column">\n    <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n  </div>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n\n</div>'),e.put("app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",'<div id="layout-vertical-navigation-fullwidth-toolbar-2" class="template-layout" layout="column" flex>\n\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp md-accent" ui-view="toolbar"></md-toolbar>\n\n  <div id="main-container" layout="row" flex>\n    <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation"></md-sidenav>\n\n    <div id="content-container" flex layout="column">\n      <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n    </div>\n\n    <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n  </div>\n\n\n</div>'),e.put("app/core/layouts/vertical-navigation-fullwidth-toolbar.html",'<div id="layout-vertical-navigation-fullwidth-toolbar" class="template-layout" layout="column" flex>\n\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp md-accent" ui-view="toolbar"></md-toolbar>\n\n  <div id="main-container" layout="row" flex>\n    <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation"></md-sidenav>\n\n    <div id="content-container" flex layout="column">\n      <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n    </div>\n\n    <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n  </div>\n\n\n</div>'),e.put("app/core/layouts/vertical-navigation.html",'<div id="header" ui-view="header"></div>\n\n<div id="layout-vertical-navigation" class="template-layout" layout="row" flex>\n\n  <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation" ng-if="!vm.isAgent()"></md-sidenav>\n\n  <div id="content-container" flex layout="column">\n    <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n\n    <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n  </div>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n\n</div>\n\n<div id="footer" ui-view="footer"></div>'),e.put("app/core/theme-options/theme-options.html",'<div class="ms-theme-options-button md-primary-bg" ng-click="toggleOptionsSidenav()">\n  <md-icon md-font-icon="icon-cog" class="white-text"></md-icon>\n</div>\n\n<md-sidenav md-component-id="motion-theme-options" class="md-sidenav-right">\n\n  <div class="ms-theme-options-list" layout="column">\n    <div class="theme-option layout-options">\n      <div class="option-title">Layout Style:</div>\n      <md-radio-group layout="row" layout-align="start start" layout-wrap ng-model="vm.layoutStyle" ng-change="vm.updateLayoutStyle()">\n        <md-radio-button ng-repeat="layoutStyle in vm.layoutStyles" ng-value="layoutStyle.value">\n          <div layout="column" layout-align="center center">\n            <img ng-src="{{layoutStyle.figure}}">\n            <span class="text-center font-size-12 mt-8">{{layoutStyle.label}}</span>\n          </div>\n        </md-radio-button>\n      </md-radio-group>\n    </div>\n\n    <md-divider></md-divider>\n\n    <div class="theme-option">\n      <div class="option-title">Layout Mode:</div>\n      <md-radio-group layout="row" layout-align="start center" ng-model="vm.layoutMode" ng-change="vm.updateLayoutMode()">\n        <md-radio-button ng-repeat="layoutMode in vm.layoutModes" ng-value="layoutMode.value">\n          {{layoutMode.label}}\n        </md-radio-button>\n      </md-radio-group>\n    </div>\n\n    <md-divider></md-divider>\n\n    <div class="theme-option color-palettes">\n      <div class="option-title">Color Palette:</div>\n      <div layout="row" layout-align="start start" layout-wrap>\n        <md-button ng-repeat="(themeName, theme) in vm.themes.list" class="md-raised theme-button" layout="row" layout-align="center center" aria-label="{{themeName}}" ng-click="vm.setActiveTheme(themeName)" ng-style="{\'background-color\': theme.primary.color,\'border-color\': theme.accent.color,\'color\': theme.primary.contrast1}" ng-class="{active: vm.getActiveTheme().name === themeName}">\n          <md-icon ng-style="{\'color\': theme.primary.contrast1}" md-font-icon="icon-palette" class="icon s32"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n</md-sidenav>'),e.put("app/errors/404/error-404.html",'<div id="error-404" layout="column" layout-align="center center">\n  <div class="content" layout="column" layout-align="center center">\n    <div class="error-code" translate="ERROR404.CODE">404</div>\n\n    <div class="message" translate="ERROR404.MESSAGE">Sorry but we couldn’t find the page you are looking for</div>\n    <ms-search-bar on-search="vm.search(query)" on-result-click="vm.searchResultClick(item)" debounce="300">Search for anything</ms-search-bar>\n\n    \x3c!-- <div class="search md-whiteframe-1dp" layout="row" layout-align="start center">\n            <md-icon md-font-icon="icon-magnify" class="icon s24"></md-icon>\n            <input ng-model="vm.search" type="text" placeholder="Search for anything" translate translate-attr-placeholder="ERROR404.SEARCH" flex>\n        </div> --\x3e\n\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR404.GO_BACK">Go back to dashboard</a>\n  </div>\n</div>'),e.put("app/errors/500/error-500.html",'<div id="error-500" layout="column" layout-align="center center">\n  <div ng-if="!vm.send" class="content" layout="column" layout-align="center center">\n    <div class="error-code" translate="ERROR500.CODE">500</div>\n    <div class="message" translate="ERROR500.MESSAGE">Well, you broke the internet!</div>\n    <div class="sub-message" translate="ERROR500.SUBMESSAGE">Just kidding, looks like we have an internal issue, please try again in couple minutes\n    </div>\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR500.GO_BACK">Go back to dashboard</a>\n    <md-button class="md-raised md-warn" ng-click="vm.sendReport()" translate="ERROR500.REPORT">Report this problem</md-button>\n  </div>\n  <pre ng-if="!vm.send">\n  {{vm.error}}\n  </pre>\n  <div ng-if="vm.send" class="content" layout="column" layout-align="center center">\n    <div class="error-code">#{{vm.code}}</div>\n    <div class="message" translate="ERROR500.JIRA_MESSAGE">Your request has been received and will be processed shortly.</div>\n    <div class="sub-message" translate="ERROR500.JIRA_SUBMESSAGE">Sorry for the inconvenience. If you have any questions or concerns, please do not hesitate to contact us.</div>\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR500.GO_BACK">Go back to dashboard</a>\n  </div>\n</div>'),e.put("app/footer/layouts/vertical-navigation/footer.html",'<div layout="row" layout-align="start center">\n  <ms-info-bar ng-if="!vm.cookieAlertHide" on-close="vm.cookieAlertOnClose()" class="grey-100-bg">\n    <div layout="row" layout-align="start center">\n      <span flex class="text-center grey-600-fg">\n        <a translate="FOOTER.COOKIE_LAW"target="_blank" href="https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896253188/Cookie+Policy" flex class="text-center grey-600-fg">We use cookies to give you the best experience. Read our cookie policy.</a>\n      </span>\n      </div>\n  </ms-info-bar>\n</div>'),e.put("app/forgot/forgot.html",'<div id="forgot-password" class="flex-scrollable" layout="column" ng-init="vm.onInit()">\n  <div id="forgot-password-form-wrapper" layout="column" layout-align="center center">\n    <div id="forgot-password-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n\n      <div class="title" translate="FORGOTPASSWORD.TITLE">Recover your password</div>\n\n      <form name="forgotPasswordForm" novalidate>\n        <md-input-container class="md-block" md-no-float>\n          <input type="email" name="email" ng-model="vm.form.email" placeholder="Email address" translate translate-attr-placeholder="FORGOTPASSWORD.EMAIL_ADRESS" ng-pattern="/^.+@.+\\..+$/" required>\n          <div ng-messages="forgotPasswordForm.email.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="FORGOTPASSWORD.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="FORGOTPASSWORD.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-button type="button" ng-click="vm.forgotPassword()" class="md-raised md-accent submit-button" aria-label="RESET MY PASSWORD" ng-disabled="forgotPasswordForm.$invalid || forgotPasswordForm.$pristine" translate="FORGOTPASSWORD.SEND_RESET_LINK" translate-attr-aria-label="FORGOTPASSWORD.SEND_RESET_LINK">\n          SEND RESET LINK\n        </md-button>\n      </form>\n\n      <div class="login" layout="row" layout-align="center center">\n        <a class="link" ui-sref="app.login" translate="FORGOTPASSWORD.GO_BACK">Go back to login</a>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/header/layouts/vertical-navigation/header.html",'\x3c!-- <div layout="row" layout-align="start center">\n    <ms-info-bar ng-if="vm.currentUser.role == \'admin\' && !vm.newsAlertHide" on-close="vm.newsAlertOnClose()" class="green-600-bg white-fg">\n        <div layout="row" layout-align="start center">\n            <md-icon md-font-icon="icon-message-text-outline" class="icon margin-right-10 s20"></md-icon>\n            <div flex hide-xs translate="HEADER.NEWS"></div>\n        </div>\n    </ms-info-bar>\n</div> --\x3e'),e.put("app/login/login.html",'<div id="login" class="flex-scrollable" layout="column">\n  <div id="login-form-wrapper" layout="column" layout-align="center center">\n    <div id="login-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n      \x3c!-- <img src="assets/images/logos/login.png" alt="motion_logo_login" /> --\x3e\n\n      <div class="md-subhead padding-top-45" translate="LOGIN.TITLE">Log in to your account</div>\n\n      <form name="loginForm" novalidate ng-if="!vm.progressLogin">\n        <md-input-container class="md-block" md-no-float>\n          <input type="input" name="name" ng-model="vm.form.name" autofocus aria-label="username" translate translate-attr-placeholder="LOGIN.USERNAME" required>\n          <div ng-messages="loginForm.name.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="LOGIN.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="password" ng-model="vm.form.password" aria-label="password" translate translate-attr-placeholder="LOGIN.PASSWORD" required>\n          <div ng-messages="loginForm.password.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="LOGIN.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <div class="remember-forgot-password" layout="row" layout-xs="column" layout-align="end center">\n          \x3c!-- <md-checkbox class="remember-me" ng-model="data.cb1" aria-label="Remember Me">\n                        <span translate="LOGIN.REMEMBER_ME">Remember Me</span>\n                    </md-checkbox> --\x3e\n          <a ui-sref="app.forgot" class="forgot-password md-accent-color" style="cursor:pointer;" translate="LOGIN.FORGOT_PASSWORD">Forgot Password?</a>\n        </div>\n\n        <b layout="row" layout-align="center center" class="md-padding" ng-if="vm.message">\n          <font color="red">{{vm.message}}</font>\n        </b>\n        <md-button type="submit" ng-click="vm.login()" class="md-raised md-accent submit-button" aria-label="LOGIN" translate="LOGIN.LOG_IN" translate-attr-aria-label="LOGIN.LOG_IN">\n          LOG IN\n        </md-button>\n      </form>\n\n      <md-progress-circular ng-if="vm.progressLogin" md-diameter="96"></md-progress-circular>\n\n      <div ng-if="vm.googleSsoEnabled || vm.adSsoEnabled" class="separator">\n        <span class="text" translate="LOGIN.OR">OR</span>\n      </div>\n\n      <md-button ng-if="vm.googleSsoEnabled" ng-click="vm.loginOauth(\'google\')" class="md-raised google">\n        <div layout="row" layout-align="center center">\n          <span>\n            <md-icon md-font-icon="fab fa-google" class="s16"></md-icon>\n            <span translate="LOGIN.WITH_GOOGLE">Log in with Google</span>\n          </span>\n        </div>\n      </md-button>\n\n      <md-button ng-if="vm.adSsoEnabled" ng-click="vm.loginAD()" class="md-raised ad">\n        <div layout="row" layout-align="center center">\n          <span>\n            <md-icon md-font-icon="fas fa-ad" class="s16"></md-icon>\n            <span style="text-transform: none" translate="LOGIN.WITH_AD">Log in with Active Directory</span>\n          </span>\n        </div>\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/analytics/views/extractedReports/create/dialog.html",'<md-dialog class="extractedReport-dialog" aria-label="New ExtractedReport">\n  <form name="extractedReportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.REPORTNAME">ReportName</label>\n        <input type="" name="name" ng-model="vm.extractedReport.name" ng-required="true" autofocus>\n\n        <div ng-messages="extractedReportForm[\'name\'].$error" ng-show="extractedReportForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.REPORTNAME_REQUIRED">ReportName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="" name="basename" ng-model="vm.extractedReport.basename" ng-required="true">\n\n        <div ng-messages="extractedReportForm[\'basename\'].$error" ng-show="extractedReportForm[\'basename\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newExtractedReport" ng-click="vm.saveExtractedReport()" class="send-button md-accent md-raised" ng-disabled="extractedReportForm.$invalid || extractedReportForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newExtractedReport" ng-click="vm.addNewExtractedReport()" class="send-button md-accent md-raised" ng-disabled="extractedReportForm.$invalid" aria-label="ADD" translate="ANALYTICS.ADD_EXTRACTEDREPORT" translate-attr-aria-label="ANALYTICS.ADD_EXTRACTEDREPORT">\n          ADD EXTRACTEDREPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newExtractedReport" ng-click="vm.deleteExtractedReport($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/extractedReports/extractedReports.html",'<div id="extractedReports" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.EXTRACTEDREPORTS">ExtractedReports</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedExtractedReports.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedExtractedReports =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-extractedReports-count">\n          <span>{{vm.selectedExtractedReports.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllExtractedReports()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectExtractedReports()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedExtractedReports" csv-label="true" filename="extractedReports.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedExtractedReports($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- EXTRACTEDREPORT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedExtractedReports" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getExtractedReports">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'ANALYTICS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'ANALYTICS.REPORTNAME\' | translate }}</th>\n                <th md-column md-order-by="basename">{{ \'ANALYTICS.NAME\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'ANALYTICS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="startDate">{{ \'ANALYTICS.DATE_RANGE_FROM\' | translate }}</th>\n                <th md-column md-order-by="endDate">{{ \'ANALYTICS.DATE_RANGE_TO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'ANALYTICS.GENERATED_AT\' | translate }}</th>\n                <th md-column md-order-by="status">{{ \'ANALYTICS.STATUS\' | translate }}</th>\n                <th md-column md-order-by="output">{{ \'ANALYTICS.OUTPUT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.extractedReports.rows.length">\n                <td md-cell colspan="10">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="extractedReport" md-select-id="id" ng-repeat="extractedReport in vm.extractedReports.rows">\n                <td md-cell ng-if="extractedReport.userpic"><img class="avatar" alt="{{extractedReport.name}}" ng-src="api/users/{{extractedReport.id}}/avatar" /></td>\n                <td md-cell ng-if="!extractedReport.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{extractedReport.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="id ">{{extractedReport.id}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="name ">{{extractedReport.name}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="basename ">{{extractedReport.basename}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="type ">{{extractedReport.type}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="startDate ">{{extractedReport.startDate | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="endDate ">{{extractedReport.endDate | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="createdAt ">{{extractedReport.createdAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="status ">{{extractedReport.status}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="output ">{{extractedReport.output}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(extractedReport, $event    )" translate="ANALYTICS.EDIT_EXTRACTEDREPORT">\n                          Edit ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="extractedReport.status == \'Completed\'">\n\n                        <md-button ng-click="vm.downloadfile2(extractedReport, $event  , \'analytics/extracted_reports\'   )" translate="ANALYTICS.DOWNLOAD_EXTRACTEDREPORT">\n                          Download ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(extractedReport, $event    )" translate="ANALYTICS.DELETE_EXTRACTEDREPORT">\n                          Delete ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.extractedReports.count}}" md-on-paginate="vm.getExtractedReports" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / EXTRACTEDREPORT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/metrics/create/dialog.html",'<md-dialog class="metric-dialog" aria-label="New Metric">\n  <form name="metricForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.metric.name" ng-required="true" autofocus>\n\n        <div ng-messages="metricForm[\'name\'].$error" ng-show="metricForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.TABLE">Table</label>\n        <md-select name="table" ng-model="vm.metric.table" required>\n          <md-option ng-value="\'report_agent\'">Agent Report</md-option>\n          <md-option ng-value="\'report_call\'">Call Report</md-option>\n          <md-option ng-value="\'cdr\'">CDR</md-option>\n          <md-option ng-value="\'chat_websites\'">Chat Website</md-option>\n          <md-option ng-value="\'chat_interactions\'">Chat Interaction</md-option>\n          <md-option ng-value="\'chat_messages\'">Chat Messages</md-option>\n          <md-option ng-value="\'chat_offline_messages\'">Chat Offline Messages</md-option>\n          <md-option ng-value="\'chat_queues\'">Chat Queues</md-option>\n          <md-option ng-value="\'report_chat_queue\'">Chat Report Queue</md-option>\n          <md-option ng-value="\'report_chat_transfer\'">Chat Report Transfer</md-option>\n          <md-option ng-value="\'cm_companies\'">Companies</md-option>\n          <md-option ng-value="\'report_call_transfer\'">Call transfer report</md-option>\n          <md-option ng-value="\'cm_contacts\'">Contacts</md-option>\n          <md-option ng-value="\'report_square\'">CSquare Report</md-option>\n          <md-option ng-value="\'report_square_details\'">CSquare Details Report</md-option>\n          <md-option ng-value="\'report_dial\'">Dial Report</md-option>\n          <md-option ng-value="\'cm_hopper\'">Dialer Hopper Processing</md-option>\n          <md-option ng-value="\'cm_hopper_history\'">Dialer Hopper Logs</md-option>\n          <md-option ng-value="\'cm_hopper_final\'">Dialer Hopper Final</md-option>\n          <md-option ng-value="\'mail_accounts\'">Email Account</md-option>\n          <md-option ng-value="\'mail_interactions\'">Email Interaction</md-option>\n          <md-option ng-value="\'mail_messages\'">Email Messages</md-option>\n          <md-option ng-value="\'mail_queues\'">Email Queues</md-option>\n          <md-option ng-value="\'report_mail_queue\'">Email Report Queue</md-option>\n          <md-option ng-value="\'report_mail_transfer\'">Email Report Transfer</md-option>\n          <md-option ng-value="\'fax_accounts\'">Fax Account</md-option>\n          <md-option ng-value="\'fax_interactions\'">Fax Interaction</md-option>\n          <md-option ng-value="\'fax_messages\'">Fax Messages</md-option>\n          <md-option ng-value="\'fax_queues\'">Fax Queues</md-option>\n          <md-option ng-value="\'report_fax_queue\'">Fax Report Queue</md-option>\n          <md-option ng-value="\'report_fax_transfer\'">Fax Report Transfer</md-option>\n          <md-option ng-value="\'report_jscripty_sessions\'">Jscripty Sessions</md-option>\n          <md-option ng-value="\'report_jscripty_questions\'">Jscripty Questions</md-option>\n          <md-option ng-value="\'report_jscripty_answers\'">Jscripty Answers</md-option>\n          <md-option ng-value="\'cm_lists\'">Lists</md-option>\n          <md-option ng-value="\'report_member\'">Member Report</md-option>\n          <md-option ng-value="\'openchannel_accounts\'">Openchannel Account</md-option>\n          <md-option ng-value="\'openchannel_interactions\'">Openchannel Interaction</md-option>\n          <md-option ng-value="\'openchannel_messages\'">Openchannel Messages</md-option>\n          <md-option ng-value="\'openchannel_queues\'">Openchannel Queues</md-option>\n          <md-option ng-value="\'report_openchannel_queue\'">Openchannel Report Queue</md-option>\n          <md-option ng-value="\'report_openchannel_transfer\'">Openchannel Report Transfer</md-option>\n          <md-option ng-value="\'report_queue\'">Queue Report</md-option>\n          <md-option ng-value="\'sms_accounts\'">SMS Account</md-option>\n          <md-option ng-value="\'sms_interactions\'">SMS Interaction</md-option>\n          <md-option ng-value="\'sms_messages\'">SMS Messages</md-option>\n          <md-option ng-value="\'sms_queues\'">SMS Queues</md-option>\n          <md-option ng-value="\'report_sms_queue\'">SMS Report Queue</md-option>\n          <md-option ng-value="\'report_sms_transfer\'">SMS Report Transfer</md-option>\n          <md-option ng-value="\'users\'">Users</md-option>\n          <md-option ng-value="\'voice_recordings\'">Voice Recordings</md-option>\n          <md-option ng-value="\'whatsapp_accounts\'">Whatsapp Account</md-option>\n          <md-option ng-value="\'whatsapp_interactions\'">Whatsapp Interaction</md-option>\n          <md-option ng-value="\'whatsapp_messages\'">Whatsapp Messages</md-option>\n          <md-option ng-value="\'whatsapp_queues\'">Whatsapp Queues</md-option>\n          <md-option ng-value="\'report_whatsapp_queue\'">Whatsapp Report Queue</md-option>\n          <md-option ng-value="\'report_whatsapp_transfer\'">Whatsapp Report Transfer</md-option>\n        </md-select>\n        <div ng-messages="metricForm[\'table\'].$error" ng-show="metricForm[\'table\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TABLE_REQUIRED">Table field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.METRIC">Metric</label>\n        <input type="text" name="metric" ng-model="vm.metric.metric" ng-required="true">\n\n        <div ng-messages="metricForm[\'metric\'].$error" ng-show="metricForm[\'metric\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.metric.description">\n\n        <div ng-messages="metricForm[\'description\'].$error" ng-show="metricForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMetric" ng-click="vm.saveMetric()" class="send-button md-accent md-raised" ng-disabled="metricForm.$invalid || metricForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMetric" ng-click="vm.addNewMetric()" class="send-button md-accent md-raised" ng-disabled="metricForm.$invalid" aria-label="ADD" translate="ANALYTICS.ADD_METRIC" translate-attr-aria-label="ANALYTICS.ADD_METRIC">\n          ADD METRIC\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMetric" ng-click="vm.deleteMetric($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/metrics/metrics.html",'<div id="metrics" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.METRICS">Metrics</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMetrics.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMetrics =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-metrics-count">\n          <span>{{vm.selectedMetrics.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMetrics()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMetrics()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMetrics" csv-label="true" filename="metrics.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMetrics($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- METRIC TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMetrics" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMetrics">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'ANALYTICS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'ANALYTICS.NAME\' | translate }}</th>\n                <th md-column md-order-by="table">{{ \'ANALYTICS.TABLE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'ANALYTICS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.metrics.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="metric" md-select-id="id" ng-repeat="metric in vm.metrics.rows">\n                <td md-cell ng-if="metric.userpic"><img class="avatar" alt="{{metric.name}}" ng-src="api/users/{{metric.id}}/avatar" /></td>\n                <td md-cell ng-if="!metric.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{metric.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="id ">{{metric.id}}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="name ">{{metric.name}}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="table ">{{ vm.arraytable[metric.table].option }}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="description ">{{metric.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(metric, $event    )" translate="ANALYTICS.EDIT_METRIC">\n                          Edit Metric\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(metric, $event    )" translate="ANALYTICS.DELETE_METRIC">\n                          Delete Metric\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.metrics.count}}" md-on-paginate="vm.getMetrics" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / METRIC TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD METRIC BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-metric-button" ng-click="vm.createOrEditMetric($event)" aria-label="add metric" translate translate-attr-aria-label="ANALYTICS.ADD_METRIC">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD METRIC BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/reports/copy/dialog.html",'<md-dialog class="report-dialog" aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.COPY_REPORT">Copy Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input name="name" ng-model="vm.report.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label translate="ANALYTICS.SELECT_NODE">Select Node</label>\n        <div js-tree="vm.treeCustomConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.copyReport()" class="send-button md-accent md-raised" ng-disabled="!vm.currentNode" aria-label="COPY" translate="ANALYTICS.COPY_REPORT" translate-attr-aria-label="ANALYTICS.COPY_REPORT">\n          COPY REPORT\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/create/dialog.html",'<md-dialog class="report-dialog" aria-label="New Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.report.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newReport">\n        <label translate="ANALYTICS.TABLE">Table</label>\n        <md-select ng-model="vm.report.table" required>\n          <md-option ng-repeat="table in vm.tables | orderBy:\'name\'" ng-value="table.name">{{table.name}}</md-option>\n        </md-select>\n        <div ng-messages="reportForm.table.$error" ng-show="reportForm.table.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TABLE_REQUIRED">Table field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.report.description">\n        <div ng-messages="reportForm.description.$error" ng-show="reportForm.description.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-autocomplete ng-if="vm.newReport" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-items="table in vm.tables | filter:vm.searchText" md-item-text="table.name" md-min-length="0" md-selected-item-change="vm.selectedTableChange(table)" placeholder="Select the table to Join">\n        <md-item-template>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{table.name}}</span>\n        </md-item-template>\n        <md-not-found>\n          No states matching "{{vm.searchText}}" were found.\n        </md-not-found>\n      </md-autocomplete>\n\n      <md-card ng-if="vm.newReport" md-theme="default" md-theme-watch ng-repeat="table in vm.joinTables">\n        <md-card-title>\n          <md-card-title-text layout="row">\n            <div layout="row" flex="50">\n              <span class="md-subhead">{{table.name}}</span>\n            </div>\n            <div layout="row" layout-align="end center" flex>\n              <md-button class="md-icon-button" ng-click="vm.removeJoin($index)">\n                <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n              </md-button>\n            </div>\n          </md-card-title-text>\n        </md-card-title>\n        <md-card-content>\n          <md-select ng-model="table.parentKey" placeholder="Select the parent key" ng-init="table.parentFields = []; vm.getFields(table, \'parentFields\', vm.report.table)" required>\n            <md-option ng-repeat="field in table.parentFields" ng-value="field">{{field}}</md-option>\n          </md-select>\n          <md-select ng-model="table.foreignKey" placeholder="Select the foreign key" ng-init="table.foreignFields = []; vm.getFields(table, \'foreignFields\', table.name)" required>\n            <md-option ng-repeat="field in table.foreignFields" ng-value="field">{{field}}</md-option>\n          </md-select>\n          <md-select ng-model="table.type" placeholder="Select join type" required>\n            <md-option ng-repeat="join in vm.joinTypes" ng-value="join.key">{{join.value}}</md-option>\n          </md-select>\n        </md-card-content>\n      </md-card>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newReport" ng-click="vm.saveReport()" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid || reportForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newReport" ng-click="vm.addNewReport()" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid || reportForm.$pristine" aria-label="ADD" translate="ANALYTICS.ADD_REPORT" translate-attr-aria-label="ANALYTICS.ADD_REPORT">\n          ADD REPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newReport" ng-click="vm.deleteReport($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/edit/condition/group.html",'<md-card class="padding-horizontal-15 padding-top-15">\n  <div layout="row" ng-if="vm_rc.crudPermissions.canEdit">\n    <md-input-container class="md-block" flex>\n      <label translate="ANALYTICS.OPERATOR">Operator</label>\n      <md-select ng-model="group.operator" required>\n        <md-option value="AND">AND</md-option>\n        <md-option value="OR">OR</md-option>\n      </md-select>\n      <div ng-messages="conditionsForm.operator.$error" ng-show="conditionsForm.operator.$touched" role="alert">\n        <div ng-message="required">\n          <span translate="ANALYTICS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n        </div>\n      </div>\n    </md-input-container>\n    <md-input-container class="md-block">\n      <md-button class="md-raised md-accent" ng-click="vm_rc.addCondition(group.rules)">\n        <md-icon md-font-icon="icon-plus"></md-icon> {{\'ANALYTICS.CONDITION\' | translate}}\n      </md-button>\n    </md-input-container>\n    <md-input-container class="md-block">\n      <md-button class="md-raised md-accent" ng-click="vm_rc.addGroup(group.rules)">\n        <md-icon md-font-icon="icon-plus"></md-icon> {{\'ANALYTICS.GROUP\' | translate}}\n      </md-button>\n    </md-input-container>\n    <div flex></div>\n    <md-input-container class="md-block" ng-if="parent">\n      <md-button class="md-raised md-warn" ng-click="vm_rc.deleteConfirm(parent, $index, $event)">\n        <md-icon md-font-icon="icon-delete"></md-icon> {{\'ANALYTICS.GROUP\' | translate}}\n      </md-button>\n    </md-input-container>\n  </div>\n  <div layout="column" ng-repeat="rule in group.rules">\n    <div layout="row" ng-if="!rule.group">\n      <md-input-container class="md-block" flex>\n        <label translate="ANALYTICS.COLUMN">COLUMN</label>\n        <md-select name="field" ng-model="rule.field" ng-disabled="!vm_rc.crudPermissions.canEdit" required>\n          <md-optgroup label="{{vm_rc.report.table}}">\n            <md-option ng-repeat="column in vm_rc.columns" value="{{vm_rc.report.table}}.{{column}}">{{column}}</md-option>\n          </md-optgroup>\n          <md-optgroup ng-if="vm_rc.report.joins" ng-repeat="join in vm_rc.report.joins" label="{{join.foreignTable}}">\n            <md-option ng-repeat="field in join.foreignTableFields" value="{{join.foreignTable}}.{{field}}">{{field}}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="conditionsForm.field.$error" ng-show="conditionsForm.field.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.COLUMN_REQUIRED">Column field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" flex>\n        <label translate="ANALYTICS.CONDITION">CONDITION</label>\n        <md-select name="condition" ng-model="rule.condition" ng-disabled="!vm_rc.crudPermissions.canEdit" required>\n          <md-option ng-repeat="condition in vm_rc.conditions" ng-value="condition">{{condition}}</md-option>\n        </md-select>\n        <div ng-messages="conditionsForm.condition.$error" ng-show="conditionsForm.condition.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm_rc.isValueByCondition(rule.condition)" class="md-block" flex>\n        <label translate="ANALYTICS.VALUE">VALUE</label>\n        <input type="text" name="value" ng-model="rule.value" ng-disabled="!vm_rc.crudPermissions.canEdit" required md-autofocus>\n        <div ng-messages="conditionsForm.value.$error" ng-show="conditionsForm.value.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm_rc.crudPermissions.canEdit" flex>\n        <md-button class="md-fab md-mini md-warn" aria-label="Delete row" ng-click="vm_rc.deleteConfirm(group.rules, $index, $event)">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </md-input-container>\n    </div>\n    <div ng-if="rule.group" ng-include="\'app/main/apps/analytics/views/reports/edit/condition/group.html\'" ng-init="parent=group.rules;index=$index;group=rule.group"></div>\n  </div>\n</md-card>'),e.put("app/main/apps/analytics/views/reports/edit/field/dialog.html",'<md-dialog class="reportField-dialog" aria-label="New Report Field">\n  <form name="reportFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{vm.title}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <pre></pre>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.reportField.type" ng-change="vm.reportField.field = undefined" required>\n          <md-option value="column">Select a column</md-option>\n          <md-option value="metric">Select an existing metric</md-option>\n          <md-option value="custom">Write a custom metric</md-option>\n        </md-select>\n        <div ng-messages="reportForm.type.$error" ng-show="reportForm.type.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-switch on="vm.reportField.type">\n        <md-input-container class="md-block" ng-switch-when="column">\n          <label translate="ANALYTICS.COLUMN">Column Name</label>\n          <md-select name="column" ng-model="vm.reportField.field" required>\n            <md-optgroup label="{{vm.report.table}}">\n              <md-option ng-repeat="column in vm.columns" value="{{vm.report.table}}.{{column}}">{{column}}</md-option>\n              \x3c!-- <md-option ng-repeat="column in vm.columns" ng-value="">{{column}}</md-option> --\x3e\n            </md-optgroup>\n            <md-optgroup ng-if="vm.report.joins" ng-repeat="join in vm.report.joins" label="{{join.foreignTable}}">\n              <md-option ng-repeat="field in join.foreignTableFields" value="{{join.foreignTable}}.{{field}}">{{field}}</md-option>\n            </md-optgroup>\n          </md-select>\n          <div ng-messages="reportForm.column.$error" ng-show="reportForm.column.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.COLUMN_REQUIRED">Column field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" ng-switch-when="metric">\n          <label translate="ANALYTICS.METRIC_NAME">Metric Name</label>\n          <md-select name="metric" ng-model="vm.reportField.MetricId" required>\n            <md-option ng-repeat="metric in vm.metrics" ng-value="metric.id">{{metric.name}}</md-option>\n          </md-select>\n          <div ng-messages="reportForm.metric.$error" ng-show="reportForm.metric.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" ng-switch-when="custom">\n          <label translate="ANALYTICS.CUSTOM_METRIC">Custom Metric</label>\n          <input type="text" name="field" ng-model="vm.reportField.field" required md-autofocus>\n          <div ng-messages="reportFieldForm.field.$error" ng-show="reportFieldForm.field.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.CUSTOM_METRIC_REQUIRED">Custom Metric field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.reportField.alias" ng-required="vm.reportField.type === \'custom\' || vm.reportField.type === \'metric\'">\n        <div ng-messages="reportFieldForm.alias.$error" ng-show="reportFieldForm.alias.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.reportField.type !== \'metric\'">\n        <label translate="ANALYTICS.FUNCTION">Function</label>\n        <md-select name="function" ng-model="vm.reportField.function">\n          <md-option ng-value="null">No Function</md-option>\n          <md-option ng-repeat="function in vm.sqlUtil.getFunctions" ng-value="function.value">{{function.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.reportField.type !== \'metric\'">\n        <label translate="ANALYTICS.FORMAT">Format</label>\n        <md-select name="format" ng-model="vm.reportField.format">\n          <md-option ng-value="null">No Format</md-option>\n          <md-option ng-repeat="format in vm.sqlUtil.getFormats" ng-value="format.value">{{format.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.GROUP_BY">Group By</label>\n        <md-select name="groupBy" ng-model="vm.reportField.groupBy">\n          <md-option ng-repeat="gb in vm.sqlUtil.getGroupBy" ng-value="gb.value">{{gb.value ? \'Yes\' : \'No\'}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.ORDER_BY">Order By</label>\n        <md-select name="orderBy" ng-model="vm.reportField.orderBy">\n          <md-option ng-value="null">No Order</md-option>\n          <md-option ng-repeat="ob in vm.sqlUtil.getOrderBy" ng-value="ob.value">{{ob.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newReportField" ng-click="vm.saveReportField()" class="send-button md-accent md-raised" ng-disabled="reportFieldForm.$invalid || reportFieldForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newReportField" ng-click="vm.addNewReportField()" class="send-button md-accent md-raised" ng-disabled="reportFieldForm.$invalid || reportFieldForm.$pristine" aria-label="ADD" translate="ANALYTICS.ADD_REPORTFIELD" translate-attr-aria-label="ANALYTICS.ADD_REPORTFIELD">\n          ADD REPORT FIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newReportField" ng-click="vm.deleteReportField($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/edit/view.html",'<div id="analytics-report" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-reports-button md-icon-button" aria-label="Go to reports" ng-click="vm.gotoReports()" translate translate-attr-aria-label="ANALYTICS.GO_TO_ANALYTICSQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="report-image" hide-xs>\n          <img ng-src="assets/images/business/reports.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.report.id}} {{vm.report.name}}\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="ANALYTICS.CREATED_AT"></span> <span>{{vm.report.createdAt | date:\'medium\'}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span>{{vm.report.description}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveReport()" ng-disabled="generalForm.$pristine && conditionsForm.$pristine" class="send-button md-accent md-raised" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="ANALYTICS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="ANALYTICS.NAME">Name</label>\n                <input type="text" name="name" ng-disabled="!vm.crudPermissions.canEdit" ng-model="vm.report.name" required md-autofocus>\n                <div ng-messages="generalForm.name.$error" ng-show="generalForm.name.$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="ANALYTICS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-disabled="!vm.crudPermissions.canEdit" ng-model="vm.report.description">\n                <div ng-messages="generalForm.description.$error" ng-show="generalForm.description.$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.FIELDS">FIELDS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container fields md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ReportFieldsController as vm_rf" ng-init="vm_rf.init(vm.report, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_rf.selectedReportFields.length">\n                <div class="md-toolbar-tools">\n                  <div layout="row" layout-align="start center">\n                    <div layout="column" layout-align="start start">\n                      <div class="md-subhead" translate="ANALYTICS.FIELDS">\n                        <span translate="ANALYTICS.FIELDS">FIELDS</span>\n                      </div>\n                      <div class="h4">\n                        <span translate="ANALYTICS.TABLE">TABLE</span> <span class="text-bold">{{vm.report.table}}</span>\n                      </div>\n                      <div class="h4" ng-if="vm.report.joins && vm.report.joins.length && vm.isArray(vm.report.joins)">\n                        <span>Join</span> <span class="text-bold">{{ vm.mapArray(vm.report.joins, \'foreignTable\') }}</span>\n                      </div>\n                    </div>\n                  </div>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm_rf.query.filter = query" on-collapse="vm_rf.query.filter = undefined" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-if="vm_rf.crudPermissions.canEdit" ng-click="vm_rf.createOrEditReportField($event)" aria-label="add field" translate translate-attr-label="ANALYTICS.ADD_FIELD">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_rf.selectedReportFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_rf.selectedReportFields.length}} {{vm_rf.selectedReportFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_rf.deleteSelectedReportFields($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table md-row-select="vm_rf.crudPermissions.canDelete" multiple ng-model="vm_rf.selectedReportFields" md-progress="vm_rf.promise">\n                  <thead md-head md-order="vm_rf.query.sort" md-on-reorder="vm_rf.getReportFields">\n                    <tr md-row>\n                      <th md-column width="10px" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-icon md-font-icon="icon-drag-vertical"></md-icon>\n                      </th>\n                      <th md-column>Type</th>\n                      <th md-column>Column or Metric</th>\n                      <th md-column>Alias</th>\n                      <th md-column>Function</th>\n                      <th md-column>Format</th>\n                      <th md-column>Group By</th>\n                      <th md-column>Order By</th>\n                      <th md-column width="10px" ng-if="vm_rf.crudPermissions.canEdit"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body ng-sortable="vm_rf.sortableTable">\n                    <tr md-row md-select="reportField" md-select-id="id" ng-repeat="reportField in vm_rf.reportFields.rows">\n                      <td md-cell class="handle" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-icon md-font-icon="icon-drag-vertical" class="s16"></md-icon>\n                      </td>\n                      <td md-cell>\n                        <div ng-if="reportField.MetricId && !reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-shape-plus s16"></div>\n                        <div ng-if="!reportField.MetricId && reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-pencil-box-outline s16"></div>\n                        <div ng-if="!reportField.MetricId && !reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-view-column s16"></div>\n                      </td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)">{{reportField.MetricId ? vm_rf.getMetricName(reportField.MetricId) : reportField.field}}</td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)">{{reportField.alias}}</td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.function">{{reportField.function}}</span><span ng-if="!reportField.function">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.format">{{reportField.format}}</span><span ng-if="!reportField.format">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.groupBy">YES</span><span ng-if="!reportField.groupBy">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.orderBy">{{reportField.orderBy}}</span><span ng-if="!reportField.orderBy">--</span></td>\n                      <td md-cell class="actions" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_rf.createOrEditReportField($event, reportField)" translate="ANALYTICS.EDIT_REPORTFIELD">\n                                Edit Field\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                              <md-button ng-click="vm_rf.deleteConfirm(reportField, $event)" translate="ANALYTICS.DELETE_REPORTFIELD">\n                                Delete Field\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.CONDITIONS">CONDITIONS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container conditions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ReportConditionsController as vm_rc" ng-init="vm_rc.init(vm.report, vm.crudPermissions)">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text" translate="ANALYTICS.CONDITION">CONDITION</div>\n              </div>\n              <form name="conditionsForm" novalidate>\n                <div ng-if="vm_rc.report.condition.group" ng-include="\'app/main/apps/analytics/views/reports/edit/condition/group.html\'" ng-init="group=vm_rc.report.condition.group"></div>\n              </form>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab md-on-select="vm.previewReport()">\n        <md-tab-label>\n          <span translate="ANALYTICS.PREVIEW">PREVIEW</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container result md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n              <div ng-if="!vm.error" class="h2 secondary-text" translate="ANALYTICS.LIMITED_RESULT">LIMITED RESULT</div>\n            </div>\n            <dl ng-if="vm.error">\n              <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n              <dd>{{vm.error.sql}}</dd>\n              <dt translate="ANALYTICS.MESSAGE">Message</dt>\n              <dd>{{vm.error.msg}}</dd>\n            </dl>\n            <md-table-container ng-if="!vm.error">\n              <table md-table>\n                <thead md-head>\n                  <tr md-row>\n                    <th ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n                  </tr>\n                </thead>\n                <tbody md-body>\n                  <tr md-row ng-repeat="row in vm.rows">\n                    <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n                  </tr>\n                  <tr md-row ng-if="!vm.rows.length">\n                    <td md-cell colspan="{{vm.columns.length}}"><span translate="ANALYTICS.NO_DATA">NO DATA</span></td>\n                  </tr>\n                </tbody>\n              </table>\n            </md-table-container>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab md-on-select="vm.queryReport()">\n        <md-tab-label>\n          <span>Query</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container result md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n              <div ng-if="!vm.error" class="h2 secondary-text">SQL</div>\n            </div>\n            <dl ng-if="vm.error">\n              <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n              <dd>{{vm.error.sql}}</dd>\n              <dt translate="ANALYTICS.MESSAGE">Message</dt>\n              <dd>{{vm.error.msg}}</dd>\n            </dl>\n            <div ng-if="!vm.error">\n              {{vm.queryResult}}\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/analytics/views/reports/preview/dialog.html",'<md-dialog aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.PREVIEW_REPORT">Preview Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n          <div ng-if="!vm.error" class="h2 secondary-text" translate="ANALYTICS.LIMITED_RESULT">LIMITED RESULT</div>\n        </div>\n        <dl ng-if="vm.error">\n          <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n          <dd>{{vm.error.sql}}</dd>\n          <dt translate="ANALYTICS.MESSAGE">Message</dt>\n          <dd>{{vm.error.msg}}</dd>\n        </dl>\n        <md-table-container ng-if="!vm.error">\n          <table md-table md-progress="vm.promise">\n            <thead md-head>\n              <tr md-row>\n                <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-repeat="row in vm.rows">\n                <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n              </tr>\n              <tr md-row ng-if="!vm.rows.length">\n                <td md-cell colspan="{{vm.columns.length}}"><span translate="ANALYTICS.NO_DATA">NO DATA</span></td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div flex></div>\n      <md-button type="submit" ng-click="vm.closeDialog()" class="md-raised" aria-label="CLOSE" translate="ANALYTICS.CLOSE" translate-attr-aria-label="ANALYTICS.CLOSE">\n        CLOSE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/reports.html",'<div id="reports" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.REPORTS">Reports</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedReports.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedReports =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-reports-count">\n          <span>{{vm.selectedReports.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllReports()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectReports()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedReports" csv-label="true" filename="reports.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete && vm.currentNode.custom" class="md-icon-button" ng-click="vm.deleteSelectedReports($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div layout="column" flex="30">\n      <md-card class="padding-top-5 padding-horizontal-10 padding-bottom-0">\n        \x3c!-- SEARCH --\x3e\n        <div layout="row" layout-align="start center">\n          <label for="searchFolder" class="m-0">\n            <md-icon md-font-icon="icon-magnify"></md-icon>\n          </label>\n          <md-input-container md-no-float class="margin-horizontal-0 margin-bottom-0 margin-top-10" flex>\n            <input id="searchFolder" placeholder="Search folder" type="text" ng-model="vm.search" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_FOLDER">\n          </md-input-container>\n        </div>\n        \x3c!-- / SEARCH --\x3e\n      </md-card>\n      <md-card class="padding-10 scrollable">\n        <div js-tree="vm.treeDefaultConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n      </md-card>\n      <md-card class="padding-10 scrollable">\n        <div js-tree="vm.treeCustomConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n      </md-card>\n    </div>\n    <md-card flex="70">\n      <md-toolbar class="md-table-toolbar md-default">\n        <div class="md-toolbar-tools">\n          <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n          <p ng-if="vm.currentPath">\n            <span class="text-boxed">{{vm.currentPath}}</span>\n          </p>\n          <div flex></div>\n          <ms-search-bar on-search="vm.getReports()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n          <div flow-init flow-file-added="vm.importReport($file, $event, $flow)">\n            <md-button ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom" class="md-icon-button" aria-label="import report" translate translate-attr-label="ANALYTICS.IMPORT_REPORT" flow-btn>\n              <md-icon md-font-icon="icon-upload"></md-icon>\n            </md-button>\n          </div>\n          <md-button ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom" class="md-icon-button" ng-click="vm.createOrEditReport($event)" aria-label="add report" translate translate-attr-label="ANALYTICS.ADD_REPORT">\n            <md-icon md-font-icon="icon-plus"></md-icon>\n          </md-button>\n        </div>\n      </md-toolbar>\n      <md-table-container>\n        <table md-table md-row-select multiple ng-model="vm.selectedReports" md-progress="vm.promise">\n          <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n            <tr md-row>\n              <th md-column md-order-by="id" width="10px">{{ \'ANALYTICS.ID\' | translate }}</th>\n              <th md-column md-order-by="name">{{ \'ANALYTICS.NAME\' | translate }}</th>\n              <th md-column md-order-by="description">{{ \'ANALYTICS.DESCRIPTION\' | translate }}</th>\n              <th md-column md-order-by="createdAt">{{ \'ANALYTICS.CREATED_AT\' | translate }}</th>\n              <th md-column width="10px"></th>\n            </tr>\n          </thead>\n          <tbody md-body>\n            <tr md-row ng-hide="vm.reports.rows.length">\n              <td md-cell colspan="5">\n                <div layout="row" layout-align="center center">\n                  <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                </div>\n              </td>\n            </tr>\n            <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="id">{{report.id}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="name">{{report.name}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="description">{{report.description}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="createdAt">{{report.createdAt | date:\'medium\'}}</td>\n              <td md-cell class="actions">\n                <md-menu>\n                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                  </md-button>\n\n                  <md-menu-content width="3">\n                    <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                      <md-button ng-click="vm.copydialog(report, $event)" translate="ANALYTICS.COPY_REPORT">\n                        Copy Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.previewdialog(report, $event)" translate="ANALYTICS.PREVIEW_REPORT">\n                        Preview Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.rundialog(report, $event)" translate="ANALYTICS.RUN_REPORT">\n                        Run Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.downloadfile(report, $event)" translate="ANALYTICS.DOWNLOAD_JSON_REPORT">\n                        Download Json Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-divider ng-if="vm.crudPermissions.canEdit && vm.crudPermissions.canDelete && vm.currentNode.custom">\n                    </md-menu-divider>\n                    <md-menu-item ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom">\n                      <md-button ng-click="vm.editstate(report, $event)" translate="ANALYTICS.EDIT_REPORT">\n                        Edit Report\n                      </md-button>\n                    </md-menu-item>\n\n                    <md-menu-item ng-if="vm.crudPermissions.canDelete && vm.currentNode.custom">\n                      <md-button ng-click="vm.deleteconfirm(report, $event)" translate="ANALYTICS.DELETE_REPORT">\n                        Delete Report\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </md-table-container>\n\n      <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.reports.count}}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n    </md-card>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/reports/run/dialog.html",'<md-dialog class="report-dialog" aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.RUN_REPORT">Run Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input name="name" ng-model="vm.export.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.FORMAT">FORMAT</label>\n        <md-select name="format" ng-model="vm.export.output" required>\n          <md-option value="csv">CSV</md-option>\n          <md-option value="xlsx">Excel (XLSX)</md-option>\n          <md-option value="pdf">PDF</md-option>\n          <md-option value="web">Web</md-option>\n        </md-select>\n        <div ng-messages="reportForm.format.$error" ng-show="reportForm.format.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.FORMAT_REQUIRED">Format field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div layout="row">\n        <div class="md-block" flex>\n          <mdp-date-picker mdp-open-on-click required name="dateRangeFrom" mdp-placeholder="Date Range From" mdp-format="YYYY-MM-DD" mdp-max-date="vm.dateRangeTo" ng-model="vm.export.startDate">\n            <div ng-messages="reportForm.dateRangeFrom.$error" ng-show="reportForm.dateRangeFrom.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_REQUIRED">Date Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_INVALID">Date Range From field is invalid</span>\n              </div>\n              <div ng-message="maxDate">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_MAX_INVALID">Date Range From Max field is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n        <div class="md-block" flex>\n          <mdp-date-picker mdp-open-on-click required name="dateRangeTo" mdp-placeholder="Date Range To" mdp-format="YYYY-MM-DD" mdp-min-date="vm.dateRangeFrom" ng-model="vm.export.endDate">\n            <div ng-messages="reportForm.dateRangeTo.$error" ng-show="reportForm.dateRangeTo.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_TO_REQUIRED">Date Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_TO_INVALID">Date Range From field is invalid</span>\n              </div>\n              <div ng-message="minDate">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_MIN_INVALID">Date Range From Min field is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n      </div>\n      <div layout="row">\n        <div class="md-block" flex>\n          <mdp-time-picker required name="timeRangeFrom" mdp-placeholder="Time Range From" mdp-format="HH:mm:ss" mdp-auto-switch="true" mdp-max-date="vm.dateRangeTo" ng-model="vm.export.startTime">\n            <div ng-messages="reportForm.timeRangeFrom.$error" ng-show="reportForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_FROM_REQUIRED">Time Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex>\n          <mdp-time-picker required name="timeRangeTo" mdp-placeholder="Time Range To" mdp-format="HH:mm:ss" mdp-auto-switch="true" mdp-min-date="vm.dateRangeFrom" ng-model="vm.export.endTime">\n            <div ng-messages="reportForm.timeRangeTo.$error" ng-show="reportForm.timeRangeTo.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_TO_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.runReport($event)" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid" aria-label="RUN" translate="ANALYTICS.RUN_REPORT" translate-attr-aria-label="ANALYTICS.RUN_REPORT">\n          RUN REPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.refreshDate()" aria-label="REFRESH" translate translate-attr-aria-label="ANALYTICS.REFRESH">\n          <md-icon md-font-icon="icon-refresh"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.REFRESH">REFRESH</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/run/web/dialog.html",'<md-dialog class="web-dialog" aria-label="Show Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.WEB_REPORT">Web Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n        </div>\n        <dl ng-if="vm.error">\n          <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n          <dd>{{vm.error.sql}}</dd>\n          <dt translate="ANALYTICS.MESSAGE">Message</dt>\n          <dd>{{vm.error.msg}}</dd>\n        </dl>\n        <md-table-container ng-if="!vm.error">\n          <table md-table md-progress="vm.promise">\n            <thead md-head>\n              <tr md-row>\n                <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-repeat="row in vm.results.rows">\n                <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n              </tr>\n              <tr md-row ng-if="!vm.results.rows.length">\n                <td md-cell colspan="{{vm.columns.length}}">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_DATA">NO DATA</span>\n                  </div>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.results.count}}" md-on-paginate="vm.getResults" md-page-select></md-table-pagination>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div flex></div>\n      <md-button type="submit" ng-click="vm.closeDialog()" class="md-raised" aria-label="CLOSE" translate="ANALYTICS.CLOSE" translate-attr-aria-label="ANALYTICS.CLOSE">\n        CLOSE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/odbcs/create/dialog.html",'<md-dialog class="odbc-dialog" aria-label="New Odbc">\n  <form name="odbcForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.odbc.name" ng-required="true" autofocus>\n\n        <div ng-messages="odbcForm[\'name\'].$error" ng-show="odbcForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DSN">DSN</label>\n        <input type="text" name="dsn" ng-model="vm.odbc.dsn" ng-required="true">\n\n        <div class="hint"><span translate="CALLYSQUARE.HELP.DSN"></span></div>\n        <div ng-messages="odbcForm[\'dsn\'].$error" ng-show="odbcForm[\'dsn\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DSN_REQUIRED">DSN field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.odbc.description">\n\n        <div ng-messages="odbcForm[\'description\'].$error" ng-show="odbcForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOdbc" ng-click="vm.saveOdbc()" class="send-button md-accent md-raised" ng-disabled="odbcForm.$invalid || odbcForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOdbc" ng-click="vm.addNewOdbc()" class="send-button md-accent md-raised" ng-disabled="odbcForm.$invalid" aria-label="ADD" translate="CALLYSQUARE.ADD_ODBC" translate-attr-aria-label="CALLYSQUARE.ADD_ODBC">\n          ADD ODBC\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOdbc" ng-click="vm.deleteOdbc($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/odbcs/odbcs.html",'<div id="odbcs" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-sitemap" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.ODBC">ODBC</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedODBC.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedODBC =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-odbcs-count">\n          <span>{{vm.selectedODBC.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllODBC()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectODBC()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedODBC" csv-label="true" filename="odbcs.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedODBC($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ODBC TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedODBC" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getODBC">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CALLYSQUARE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CALLYSQUARE.NAME\' | translate }}</th>\n                <th md-column md-order-by="dsn">{{ \'CALLYSQUARE.DSN\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CALLYSQUARE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.odbcs.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="odbc" md-select-id="id" ng-repeat="odbc in vm.odbcs.rows">\n                <td md-cell ng-if="odbc.userpic"><img class="avatar" alt="{{odbc.name}}" ng-src="api/users/{{odbc.id}}/avatar" /></td>\n                <td md-cell ng-if="!odbc.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{odbc.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="id ">{{odbc.id}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="name ">{{odbc.name}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="dsn ">{{odbc.dsn}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="description ">{{odbc.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(odbc, $event    )" translate="CALLYSQUARE.EDIT_ODBC">\n                          Edit Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestOdbc(odbc, $event    )" translate="CALLYSQUARE.TEST_ODBC">\n                          Test Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(odbc, $event    )" translate="CALLYSQUARE.DELETE_ODBC">\n                          Delete Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.odbcs.count}}" md-on-paginate="vm.getODBC" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ODBC TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ODBC BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-odbc-button" ng-click="vm.createOrEditOdbc($event)" aria-label="add odbc" translate translate-attr-aria-label="CALLYSQUARE.ADD_ODBC">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ODBC BUTTON --\x3e\n</div>'),e.put("app/main/apps/callysquare/views/projects/create/dialog.html",'<md-dialog class="project-dialog" aria-label="New Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{vm.title | translate}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input name="name" ng-model="vm.project.name" required md-autofocus ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-disabled="!vm.newProject">\n        <div ng-messages="projectForm.name.$error" ng-show="projectForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input name="description" ng-model="vm.project.description">\n        <div ng-messages="projectForm.description.$error" ng-show="projectForm.description.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.openFromEditor" class="md-block">\n        \x3c!-- Added to check if I\'m opening the dialog directly from the square editor --\x3e\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newProject" ng-click="vm.saveProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newProject" ng-click="vm.addNewProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="ADD" translate="CALLYSQUARE.ADD_PROJECT" translate-attr-aria-label="CALLYSQUARE.ADD_PROJECT">\n          ADD PROJECT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newProject" ng-click="vm.deleteProject($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",'<md-dialog class="project-dialog" aria-label="New dialog" ng-init="vm.onInit()">\n  <form name="dialogForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.EDIT"></span> <span translate="CALLYSQUARE.{{vm.cellName | uppercase}}"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block" ng-repeat="attribute in vm.attributes" ng-switch="attribute.name">\n        <label translate="CALLYSQUARE.{{attribute.name | uppercase}}">{{attribute.name | ucfirst }}</label>\n\n        \x3c!--  START SELECT INPUT --\x3e\n        <md-select name="{{attribute.name}}" ng-model="attribute.value" ng-disabled="!vm.crudPermissions.canEdit" ng-switch-when-separator="|" ng-switch-when="answer|trunk_name|trunk_id|queue_id|file_id|variable_id|google_cloud_tts_text_type|google_tts_language|ispeech_tts_language|ispeech_asr_language|google_asr_language|hiddendigitspos|odbc_id|project_id|beep|account_id|interval_id|template_id|list_id|recordingFormat|callback_priority|aws_polly_voice|aws_polly_region|aws_lex_region|sms_account_id|findBy|pause_id|aws_text_type|dialogflow_language|ndagenerate_audio|ndaactivity_type|languageCode|ssmlGender|method|dialogflowV2_language" ng-required="attribute.required">\n          <md-option ng-if="attribute.defaultValue" ng-value="\'\'"> - None - </md-option>\n          <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          <md-option ng-if="!vm.values[attribute.name].length" value="-1">No {{attribute.name}} available!</md-option>\n        </md-select>\n        \x3c!--  END SELECT INPUT --\x3e\n\n        \x3c!--  START SELECT INPUT --\x3e\n        <md-select name="{{attribute.name}}" ng-model="attribute.value" ng-disabled="!vm.crudPermissions.canEdit" ng-switch-when-separator="|" ng-switch-when="sip_id" ng-required="attribute.required">\n          <md-optgroup label="{{\'CALLYSQUARE.AGENTS\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'agent\'" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{\'CALLYSQUARE.TELEPHONES\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'telephone\'" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{\'CALLYSQUARE.USERS\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'admin\' || v.group === \'user\'">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-option ng-if="!vm.values[attribute.name].length" value="-1">No {{attribute.name}} available!</md-option>\n        </md-select>\n        \x3c!--  END SELECT INPUT --\x3e\n\n        \x3c!--  START NUMBER INPUT --\x3e\n        <div ng-switch-when="timeout">\n          <div ng-switch="vm.cellName">\n            <input ng-switch-when-separator="|" ng-switch-when="answer|ext_dial|dial|queue" type="number" step="any" name="{{attribute.name}}" min="0" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-when-separator="|" ng-switch-when="record|ispeechasr|googleasr" type="number" step="any" name="{{attribute.name}}" min="-1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-when-separator="|" ng-switch-when="restapi" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-default type="number" step="any" name="{{attribute.name}}" min="0" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n          </div>\n        </div>\n        <input ng-switch-when-separator="|" ng-switch-when="speed" type="number" step="any" name="{{attribute.name}}" min="-10" max="-10" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        <input ng-switch-when-separator="|" ng-switch-when="maxdigit|mindigit|digit" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        <input ng-switch-when-separator="|" ng-switch-when="retry|response|hiddendigitsnum|priority" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        \x3c!--  END NUMBER INPUT --\x3e\n\n        \x3c!--  START TEXTAREA INPUT --\x3e\n        <textarea name="{{attribute.name}}" ng-model="attribute.value" ng-switch-when-separator="|" ng-switch-when="query|sms_text|condition|text|custom_action_data|headers|body|rawHeaders|rawBody|private_key" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit"></textarea>\n        \x3c!--  END TEXTAREA INPUT --\x3e\n\n        \x3c!-- START URL INPUT --\x3e\n        <input ng-switch-when-separator="|" ng-switch-when="ndauth_url|ndassistant_url|url" type="url" name="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required">\n        \x3c!-- END URL INPUT --\x3e\n\n        \x3c!--  START TEXT INPUT --\x3e\n        <input ng-switch-default name="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit">\n        <div class=\'hint\' ng-if="attribute.name === \'text\' && vm.cellName === \'tts\' ">\n          <span translate="CALLYSQUARE.HELP.MAX_TEXT_TTS" class="ng-scope">Max 250 chars are supported</span>\n        </div>\n        \x3c!--  END TEXT INPUT--\x3e\n\n        <div class="hint" ng-if="attribute.help">\n          <span translate="CALLYSQUARE.HELP.{{attribute.name | uppercase}}"></span>\n        </div>\n        <div ng-messages="dialogForm[attribute.name].$error" ng-show="dialogForm[attribute.name].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.FIELD_REQUIRED">The field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="vm.crudPermissions.canEdit">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="dialogForm.$invalid || dialogForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/edit/edit.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="editForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.EDIT_XML"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label>XML</label>\n        <textarea name="preproduction" ng-model="vm.project.preproduction"></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="editForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/import/import.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.IMPORT_XML"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="xml-uploader" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-file-added="vm.fileAdded($file)" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="CALLYSQUARE.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="CALLYSQUARE.DROP_TO_UPLOAD_MESSAGE">You can also drop files here to upload. Only XML - Max. 5MB</span>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog()" class="send-button md-accent md-raised" ng-disabled="importForm.$invalid" aria-label="CLOSE" translate="CALLYSQUARE.CLOSE" translate-attr-aria-label="CALLYSQUARE.CLOSE">\n          CLOSE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/info/info.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="descriptionFrom" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.UPDATE_INFO"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input name="description" ng-model="vm.project.description" md-autofocus>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NOTES">Description</label>\n        <textarea name="notes" ng-model="vm.project.notes"></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.save()" class="send-button md-accent md-raised" ng-disabled="descriptionFrom.$invalid" aria-label="SAVE" translate="CALLYSQUARE.UPDATE_INFO" translate-attr-aria-label="CALLYSQUARE.UPDATE">\n          UPDATE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/open/open.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="openForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.OPEN_PROJECT"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.PROJECT">Project</label>\n        <md-select name="id" ng-model="vm.id" required>\n          <md-option value="{{p.id}}" ng-repeat="p in vm.projects">{{p.name}}</md-option>\n        </md-select>\n        <div ng-messages="openForm.id.$error" ng-show="openForm.id.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.PROJECT_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="openForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.OPEN_PROJECT" translate-attr-aria-label="CALLYSQUARE.OPEN">\n          OPEN\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="newForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.COPY_PROJECT"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input name="name" ng-model="vm.project.name" required md-autofocus>\n        <div ng-messages="newForm.name.$error" ng-show="newForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.save()" class="send-button md-accent md-raised" ng-disabled="newForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.COPY_PROJECT" translate-attr-aria-label="CALLYSQUARE.COPY">\n          COPY\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/view.html",'<div id="callysquare-project" class="page-layout simple tabbed" layout="column" ng-init="vm.onInit()">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-projects-button md-icon-button" aria-label="Go to projects" ng-click="vm.gotoProjects()" translate translate-attr-aria-label="CALLYSQUARE.GO_TO_PROJECTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="project-image" hide-xs>\n          <img ng-src="assets/images/business/cprojects.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.project.id}} {{vm.project.name}}\n          </div>\n          <div class="subtitle secondary-text text-truncate">\n            <span ng-if="vm.project.description">{{vm.project.description}} - </span><span translate="CALLYSQUARE.CREATED_AT"></span> <span>{{vm.project.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-if="vm.crudPermissions.canEdit" ng-click="vm.updateInfo($event)" class="md-fab md-yellow-700-bg md-icon-button" aria-label="edit">\n        <md-icon md-font-icon="icon-tooltip-edit"></md-icon>\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <md-content class="callysquare-content">\n\n    <div id="geEditor" class="geEditor"></div>\n\n  </md-content>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/callysquare/views/projects/projects.html",'<div id="projects" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-vector-square" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.PROJECTS">Projects</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    \x3c!-- SEARCH --\x3e\n    <div class="search-input-wrapper" layout="row" layout-align="start center">\n      <label for="search">\n        <md-icon md-font-icon="icon-magnify"></md-icon>\n      </label>\n      <md-input-container md-no-float class="m-0">\n        <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n      </md-input-container>\n    </div>\n    \x3c!-- / SEARCH --\x3e\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedProjects.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedProjects =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-projects-count">\n          <span>{{vm.selectedProjects.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllProjects()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectProjects()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedProjects" csv-label="true" filename="projects.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedProjects($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      \x3c!-- PROJECT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedProjects" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getProjects">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'CALLYSQUARE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CALLYSQUARE.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CALLYSQUARE.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="notes">{{ \'CALLYSQUARE.NOTES\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.projects.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="project" md-select-id="id" ng-repeat="project in vm.projects.rows">\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="id ">{{project.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="name ">{{project.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="description ">{{project.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="notes ">{{project.notes}}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(project, ev)" translate="CALLYSQUARE.EDIT_PROJECT">\n                          Edit Project\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(project, ev)" translate="CALLYSQUARE.DELETE_PROJECT">\n                          Delete Project\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.projects.count}}" md-on-paginate="vm.getProjects" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PROJECT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PROJECT BUTTON --\x3e\n  <md-button class="md-fab md-accent md-icon-button" id="add-project-button" ng-if="vm.crudPermissions.canEdit" ng-click="vm.createOrEditProject($event)" aria-label="add project" translate translate-attr-aria-label="CALLYSQUARE.ADD_PROJECT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PROJECT BUTTON --\x3e\n\n</div>'),e.put("app/main/apps/callysquare/views/squareRecordings/create/dialog.html",'<md-dialog class="squareRecording-dialog" aria-label="New SquareRecording">\n  <form name="squareRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.FILENAME">Filename</label>\n        <input type="" name="filename" ng-model="vm.squareRecording.filename" ng-required="true" autofocus>\n\n        <div ng-messages="squareRecordingForm[\'filename\'].$error" ng-show="squareRecordingForm[\'filename\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.FILENAME_REQUIRED">Filename field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSquareRecording" ng-click="vm.saveSquareRecording()" class="send-button md-accent md-raised" ng-disabled="squareRecordingForm.$invalid || squareRecordingForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSquareRecording" ng-click="vm.addNewSquareRecording()" class="send-button md-accent md-raised" ng-disabled="squareRecordingForm.$invalid" aria-label="ADD" translate="CALLYSQUARE.ADD_SQUARERECORDING" translate-attr-aria-label="CALLYSQUARE.ADD_SQUARERECORDING">\n          ADD SQUARERECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSquareRecording" ng-click="vm.deleteSquareRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/squareRecordings/squareRecordings.html",'<div id="squareRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-sitemap" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.SQUARERECORDINGS">SquareRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSquareRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSquareRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-squareRecordings-count">\n          <span>{{vm.selectedSquareRecordings.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSquareRecordings()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSquareRecordings()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSquareRecordings" csv-label="true" filename="squareRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSquareRecordings($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SQUARERECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSquareRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSquareRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="filename">{{ \'CALLYSQUARE.FILENAME\' | translate }}</th>\n                <th md-column md-order-by="projectName">{{ \'CALLYSQUARE.PROJECT\' | translate }}</th>\n                <th md-column md-order-by="uniqueid">{{ \'CALLYSQUARE.UNIQUEID\' | translate }}</th>\n                <th md-column md-order-by="callerid">{{ \'CALLYSQUARE.PHONE\' | translate }}</th>\n                <th md-column md-order-by="extension">{{ \'CALLYSQUARE.EXTEN\' | translate }}</th>\n                <th md-column>{{ \'CALLYSQUARE.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'CALLYSQUARE.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.squareRecordings.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="squareRecording" md-select-id="id" ng-repeat="squareRecording in vm.squareRecordings.rows">\n                <td md-cell ng-if="squareRecording.userpic"><img class="avatar" alt="{{squareRecording.name}}" ng-src="api/users/{{squareRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!squareRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{squareRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="filename ">{{squareRecording.filename}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="projectName ">{{squareRecording.projectName}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="uniqueid ">{{squareRecording.uniqueid}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="callerid ">{{squareRecording.callerid}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="extension ">{{squareRecording.extension}}</td>\n                <td md-cell class="audio " ng-switch="squareRecording.format">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording ng-switch-when=".wav" id="squareRecording.id" model="\'squareRecording\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                  <span ng-switch-when=".gsm|.WAV" ng-switch-when-separator="|">\n                    <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n                  </span>\n                </td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="createdAt ">{{squareRecording.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadCallySquareRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(squareRecording, $event  , \'square/recordings\'   )" translate="CALLYSQUARE.DOWNLOAD_SQUARERECORDING">\n                          Download SquareRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(squareRecording, $event    )" translate="CALLYSQUARE.DELETE_SQUARERECORDING">\n                          Delete SquareRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.squareRecordings.count}}" md-on-paginate="vm.getSquareRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SQUARERECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatQueues/chatQueues.html",'<div id="chatQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-hangouts" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CHAT.CHATQUEUES">ChatQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CHAT.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChatQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChatQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CHAT.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chatQueues-count">\n          <span>{{vm.selectedChatQueues.length}}</span>\n          <span translate="CHAT.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CHAT.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChatQueues()" translate="CHAT.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChatQueues()" translate="CHAT.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChatQueues" csv-label="true" filename="chatQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChatQueues($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHATQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChatQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'CHAT.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chatQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chatQueue" md-select-id="id" ng-repeat="chatQueue in vm.chatQueues.rows">\n                <td md-cell ng-if="chatQueue.userpic"><img class="avatar" alt="{{chatQueue.name}}" ng-src="api/users/{{chatQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!chatQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chatQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="id ">{{chatQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="name ">{{chatQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="strategy ">{{ vm.arraystrategy[chatQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(chatQueue, $event    )" translate="CHAT.EDIT_CHATQUEUE">\n                          Edit ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(chatQueue, $event    )" translate="CHAT.TEAMADD_CHATQUEUE">\n                          teamadd ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(chatQueue, $event    )" translate="CHAT.AGENTADD_CHATQUEUE">\n                          agentadd ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chatQueue, $event    )" translate="CHAT.DELETE_CHATQUEUE">\n                          Delete ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(chatQueue, $event    )" translate="CHAT.GOTOREALTIME_CHATQUEUE">\n                          goToRealtime ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatQueues.count}}" md-on-paginate="vm.getChatQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHATQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHATQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chatQueue-button" ng-click="vm.createOrEditChatQueue($event)" aria-label="add chatQueue" translate translate-attr-aria-label="CHAT.ADD_CHATQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHATQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatQueues/create/dialog.html",'<md-dialog class="chatQueue-dialog" aria-label="New ChatQueue">\n  <form name="chatQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chatQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newChatQueue">\n\n        <div class="hint"><span translate="CHAT.HELP.NAME"></span></div>\n        <div ng-messages="chatQueueForm[\'name\'].$error" ng-show="chatQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="CHAT.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.chatQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="chatQueueForm[\'strategy\'].$error" ng-show="chatQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.chatQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="chatQueueForm[\'timeout\'].$error" ng-show="chatQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatQueue.description">\n\n        <div ng-messages="chatQueueForm[\'description\'].$error" ng-show="chatQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatQueue" ng-click="vm.saveChatQueue()" class="send-button md-accent md-raised" ng-disabled="chatQueueForm.$invalid || chatQueueForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatQueue" ng-click="vm.addNewChatQueue()" class="send-button md-accent md-raised" ng-disabled="chatQueueForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATQUEUE" translate-attr-aria-label="CHAT.ADD_CHATQUEUE">\n          ADD CHATQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatQueue" ng-click="vm.deleteChatQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",'<md-dialog class="chatQueue-dialog" aria-label="chatQueue" ng-init="vm.onInit()">\n  <form name="chatQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.AGENTADD_CHATQUEUE">Add Agent to chatQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",'<md-dialog class="chatQueue-dialog" aria-label="chatQueue" ng-init="vm.onInit()">\n  <form name="chatQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/view.html",'<div id="chat-chatQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-chatQueues-button md-icon-button" aria-label="Go to chatQueues" ng-click="vm.gotoChatQueues()" translate translate-attr-aria-label="CHAT.GO_TO_CHATQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="chatQueue-image" hide-xs>\n          <img ng-src="assets/images/business/chatQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.chatQueue.id}}\n            <span ng-if="vm.chatQueue.name">{{vm.chatQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CHAT.CREATED_AT"></span> <span>{{vm.chatQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.chatQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="CHAT.TEAMADD_CHATQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.chatQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CHAT.AGENTADD_CHATQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveChatQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.chatQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="CHAT.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="CHAT.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.chatQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.chatQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.chatQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/chat/views/chatWebsites/chatWebsites.html",'<div id="chatWebsites" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-hangouts" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CHAT.CHATWEBSITES">ChatWebsites</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CHAT.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChatWebsites.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChatWebsites =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CHAT.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chatWebsites-count">\n          <span>{{vm.selectedChatWebsites.length}}</span>\n          <span translate="CHAT.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CHAT.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChatWebsites()" translate="CHAT.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChatWebsites()" translate="CHAT.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChatWebsites" csv-label="true" filename="chatWebsites.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChatWebsites($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHATWEBSITE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChatWebsites" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatWebsites">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'CHAT.KEY\' | translate }}</th>\n                <th md-column md-order-by="address">{{ \'CHAT.MOTIONADDRESS\' | translate }}</th>\n                <th md-column md-order-by="remote">{{ \'CHAT.MOTIONPROXY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chatWebsites.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chatWebsite" md-select-id="id" ng-repeat="chatWebsite in vm.chatWebsites.rows">\n                <td md-cell ng-if="chatWebsite.userpic"><img class="avatar" alt="{{chatWebsite.name}}" ng-src="api/users/{{chatWebsite.id}}/avatar" /></td>\n                <td md-cell ng-if="!chatWebsite.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chatWebsite.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="id ">{{chatWebsite.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="name ">{{chatWebsite.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="key ">{{chatWebsite.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="address ">{{chatWebsite.address}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="remote ">{{chatWebsite.remote}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="description ">{{chatWebsite.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(chatWebsite, $event    )" translate="CHAT.EDIT_CHATWEBSITE">\n                          Edit ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(chatWebsite, $event    )" translate="CHAT.INTERACTIONS_CHATWEBSITE">\n                          Interactions ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.offlinemessagesgoto(chatWebsite, $event    )" translate="CHAT.OFFLINEMESSAGES_CHATWEBSITE">\n                          OfflineMessages ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(chatWebsite, $event    )" translate="CHAT.AGENTADD_CHATWEBSITE">\n                          AgentAdd ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chatWebsite, $event    )" translate="CHAT.DELETE_CHATWEBSITE">\n                          Delete ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatWebsites.count}}" md-on-paginate="vm.getChatWebsites" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHATWEBSITE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHATWEBSITE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chatWebsite-button" ng-click="vm.createOrEditChatWebsite($event)" aria-label="add chatWebsite" translate translate-attr-aria-label="CHAT.ADD_CHATWEBSITE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHATWEBSITE BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatWebsites/create/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chatWebsite.name" ng-required="true" autofocus ng-disabled="!vm.newChatWebsite">\n\n        <div ng-messages="chatWebsiteForm[\'name\'].$error" ng-show="chatWebsiteForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.chatWebsite.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="chatWebsiteForm[\'key\'].$error" ng-show="chatWebsiteForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONADDRESS">MotionAddress</label>\n        <input type="url" name="address" ng-model="vm.chatWebsite.address" md-maxlength="255" ng-required="true">\n\n        <div ng-messages="chatWebsiteForm[\'address\'].$error" ng-show="chatWebsiteForm[\'address\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_REQUIRED">MotionAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_MUST_VALID_URL">MotionAddress must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionAddress must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.chatWebsite.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="CHAT.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="chatWebsiteForm[\'remote\'].$error" ng-show="chatWebsiteForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.chatWebsite.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="CHAT.HELP.LIST"></span></div>\n        <div ng-messages="chatWebsiteForm[\'ListId\'].$error" ng-show="chatWebsiteForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.chatWebsite.IntervalId">\n          <md-option ng-value="null">Always</md-option>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteForm[\'IntervalId\'].$error" ng-show="chatWebsiteForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatWebsite.description">\n\n        <div ng-messages="chatWebsiteForm[\'description\'].$error" ng-show="chatWebsiteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatWebsite" ng-click="vm.saveChatWebsite()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteForm.$invalid || chatWebsiteForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatWebsite" ng-click="vm.addNewChatWebsite()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATWEBSITE" translate-attr-aria-label="CHAT.ADD_CHATWEBSITE">\n          ADD CHATWEBSITE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatWebsite" ng-click="vm.deleteChatWebsite($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",'<md-dialog class="chatWebsite-dialog" aria-label="chatWebsite" ng-init="vm.onInit()">\n  <form name="chatWebsiteForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.AGENTADD_CHATWEBSITE">Add Agent to chatWebsite</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/agent/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'agent\'].$error" ng-show="chatWebsiteFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'timeout\'].$error" ng-show="chatWebsiteFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/amazonlex/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'accesskeyid\'].$error" ng-show="chatWebsiteFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'secretaccesskey\'].$error" ng-show="chatWebsiteFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'lexregion\'].$error" ng-show="chatWebsiteFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'botname\'].$error" ng-show="chatWebsiteFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/autoreply/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'times\'].$error" ng-show="chatWebsiteFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="chatWebsiteFormApp[\'text\'].$error" ng-show="chatWebsiteFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/close/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'disposition\'].$error" ng-show="chatWebsiteFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/dialogflow/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'key\'].$error" ng-show="chatWebsiteFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'language\'].$error" ng-show="chatWebsiteFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'projectId\'].$error" ng-show="chatWebsiteFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'clientEmail\'].$error" ng-show="chatWebsiteFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="chatWebsiteFormApp[\'privateKey\'].$error" ng-show="chatWebsiteFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'language\'].$error" ng-show="chatWebsiteFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/gotoif/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'condition\'].$error" ng-show="chatWebsiteFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'truepriority\'].$error" ng-show="chatWebsiteFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'falsepriority\'].$error" ng-show="chatWebsiteFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/gotop/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'priority\'].$error" ng-show="chatWebsiteFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/noop/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'value\'].$error" ng-show="chatWebsiteFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/queue/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'queue\'].$error" ng-show="chatWebsiteFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'timeout\'].$error" ng-show="chatWebsiteFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/system/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'command\'].$error" ng-show="chatWebsiteFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'variable\'].$error" ng-show="chatWebsiteFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/tag/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'tag\'].$error" ng-show="chatWebsiteFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/tvox/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.SERVICEID">serviceid</label>\n        <input type="text" name="serviceid" ng-model="vm.tvox.serviceid" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'serviceid\'].$error" ng-show="chatWebsiteFormApp[\'serviceid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SERVICEID_REQUIRED">serviceid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CHANNELID">channelid</label>\n        <input type="text" name="channelid" ng-model="vm.tvox.channelid" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'channelid\'].$error" ng-show="chatWebsiteFormApp[\'channelid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CHANNELID_REQUIRED">channelid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXURL">tvoxurl</label>\n        <input type="text" name="tvoxurl" ng-model="vm.tvox.tvoxurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXURL_REQUIRED">tvoxurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXLOGINURL">tvoxloginurl</label>\n        <input type="text" name="tvoxloginurl" ng-model="vm.tvox.tvoxloginurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxloginurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxloginurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXLOGINURL_REQUIRED">tvoxloginurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXSESSIONURL">tvoxsessionurl</label>\n        <input type="text" name="tvoxsessionurl" ng-model="vm.tvox.tvoxsessionurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxsessionurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxsessionurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXSESSIONURL_REQUIRED">tvoxsessionurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXUSERNAME">tvoxusername</label>\n        <input type="text" name="tvoxusername" ng-model="vm.tvox.tvoxusername" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxusername\'].$error" ng-show="chatWebsiteFormApp[\'tvoxusername\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXUSERNAME_REQUIRED">tvoxusername field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXPASSWD">tvoxpasswd</label>\n        <input type="password" name="tvoxpasswd" ng-model="vm.tvox.tvoxpasswd" placeholder="Password" translate translate-attr-placeholder="CHAT.PASSWORD">\n        <div ng-messages="chatWebsiteFormApp[\'tvoxpasswd\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="CHAT.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURLONRING">motionurlonring</label>\n        <input type="text" name="motionurlonring" ng-model="vm.tvox.motionurlonring" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurlonring\'].$error" ng-show="chatWebsiteFormApp[\'motionurlonring\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURLONRING_REQUIRED">motionurlonring field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURLONANSWER">motionurlonanswer</label>\n        <input type="text" name="motionurlonanswer" ng-model="vm.tvox.motionurlonanswer" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurlonanswer\'].$error" ng-show="chatWebsiteFormApp[\'motionurlonanswer\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURLONANSWER_REQUIRED">motionurlonanswer field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONTITLE">motiontitle</label>\n        <input type="text" name="motiontitle" ng-model="vm.tvox.motiontitle" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motiontitle\'].$error" ng-show="chatWebsiteFormApp[\'motiontitle\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONTITLE_REQUIRED">motiontitle field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURL">motionurl</label>\n        <input type="text" name="motionurl" ng-model="vm.tvox.motionurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurl\'].$error" ng-show="chatWebsiteFormApp[\'motionurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURL_REQUIRED">motionurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",'<md-dialog class="chatCannedAnswer-dialog" aria-label="New ChatCannedAnswer">\n  <form name="chatCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.chatCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="chatCannedAnswerForm[\'key\'].$error" ng-show="chatCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.chatCannedAnswer.value" required></textarea>\n\n        <div ng-messages="chatCannedAnswerForm[\'value\'].$error" ng-show="chatCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatCannedAnswer.description">\n\n        <div ng-messages="chatCannedAnswerForm[\'description\'].$error" ng-show="chatCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatCannedAnswer" ng-click="vm.saveChatCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="chatCannedAnswerForm.$invalid || chatCannedAnswerForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatCannedAnswer" ng-click="vm.addNewChatCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="chatCannedAnswerForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATCANNEDANSWER" translate-attr-aria-label="CHAT.ADD_CHATCANNEDANSWER">\n          ADD CHATCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatCannedAnswer" ng-click="vm.deleteChatCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",'<md-dialog class="offlineMessage-dialog" aria-label="New OfflineMessage">\n  <md-toolbar class="md-accent md-hue-2">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ vm.title | translate }}</span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-content flex layout-padding>\n    <pre ng-if="vm.isHtml">{{vm.message.body}}</pre>\n    <div ng-if="!vm.isHtml" ng-bind-html-unsafe="vm.message.body"></div>\n\n    <span ng-repeat="attachment in vm.attachments">\n      <md-button class="md-icon-button no-margin no-padding" ng-click="vm.download(attachment)">\n        <md-icon class="no-margin material-icons" aria-label="Attachment">attach_file</md-icon>\n      </md-button>\n      <span>{{attachment.name}}</span><br />\n    </span>\n  </md-content>\n\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",'<md-dialog class="chatProactiveAction-dialog" aria-label="New ChatProactiveAction">\n  <form name="chatProactiveActionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.chatProactiveAction.name" ng-required="true" autofocus>\n\n        <div ng-messages="chatProactiveActionForm[\'name\'].$error" ng-show="chatProactiveActionForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.chatProactiveAction.type">\n\n          <md-option ng-value="\'mouseOver\'"> {{ \'CHAT.MOUSEOVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'timeout\'"> {{ \'CHAT.TIMEOUT\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="chatProactiveActionForm[\'type\'].$error" ng-show="chatProactiveActionForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.chatProactiveAction.type === \'mouseOver\'" class="md-block">\n        <label translate="CHAT.SELECTOR">Selector</label>\n        <input type="" name="selector" ng-model="vm.chatProactiveAction.selector" ng-required="true">\n\n        <div ng-messages="chatProactiveActionForm[\'selector\'].$error" ng-show="chatProactiveActionForm[\'selector\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SELECTOR_REQUIRED">Selector field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.chatProactiveAction.type === \'timeout\'" class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.chatProactiveAction.timeout" min="1" ng-required="true">\n\n        <div ng-messages="chatProactiveActionForm[\'timeout\'].$error" ng-show="chatProactiveActionForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatProactiveAction" ng-click="vm.saveChatProactiveAction()" class="send-button md-accent md-raised" ng-disabled="chatProactiveActionForm.$invalid || chatProactiveActionForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatProactiveAction" ng-click="vm.addNewChatProactiveAction()" class="send-button md-accent md-raised" ng-disabled="chatProactiveActionForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATPROACTIVEACTION" translate-attr-aria-label="CHAT.ADD_CHATPROACTIVEACTION">\n          ADD CHATPROACTIVEACTION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatProactiveAction" ng-click="vm.deleteChatProactiveAction($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/view.html",'<div id="chat-chatWebsite" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-chatWebsites-button md-icon-button" aria-label="Go to chatWebsites" ng-click="vm.gotoChatWebsites()" translate translate-attr-aria-label="CHAT.GO_TO_CHATWEBSITES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="chatWebsite-image" hide-xs>\n          <img ng-src="assets/images/business/chatWebsites.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.chatWebsite.id}}\n            <span ng-if="vm.chatWebsite.name">{{vm.chatWebsite.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CHAT.CREATED_AT"></span> <span>{{vm.chatWebsite.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.chatWebsite, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CHAT.AGENTADD_CHATWEBSITE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveChatWebsite()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (scriptForm.$invalid) || (intervalForm.$invalid) || (dispositionForm.$invalid) || (appearanceForm.$invalid) || (onlinestatusForm.$invalid) || (offlinestatusForm.$invalid) || (closingformForm.$invalid) || (unmanagedstatusForm.$invalid) || (interactionForm.$invalid) || (whitelabelForm.$invalid) || (logoForm.$invalid) || (agentAvatarForm.$invalid) || (customerAvatarForm.$invalid) || (systemAvatarForm.$invalid) || (chatFormOnlineForm.$invalid) || (chatFormOfflineForm.$invalid) || (proactiveForm.$invalid) || (chatDispositionsForm.$invalid) || (chatCannedAnswersForm.$invalid) || (vidaooForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid) || (offlineMessagesForm.$invalid)" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.chatWebsite.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.chatWebsite.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MOTIONADDRESS">MotionAddress</label>\n                <input type="url" name="address" ng-model="vm.chatWebsite.address" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'address\'].$error" ng-show="generalForm[\'address\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_REQUIRED">MotionAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_MUST_VALID_URL">MotionAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionAddress must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.chatWebsite.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.fidelity" class="md-block">\n                <label translate="CHAT.TIMEOUT">Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.chatWebsite.timeout" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.chatWebsite.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.chatWebsite.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.chatWebsite.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="CHAT.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.chatWebsite.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.queueTransfer == true" class="md-block">\n                <label translate="CHAT.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.chatWebsite.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.agentTransfer == true" class="md-block">\n                <label translate="CHAT.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.chatWebsite.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container script md-background-bg md-whiteframe-1dp">\n            <form name="scriptForm" flex="100" novalidate>\n              <div ng-controller="ChatWebsiteScriptController as vm_ac" ng-init="vm_ac.init(vm.chatWebsite)" class="content" md-background-bg>\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text" translate="CHAT.SCRIPT">SCRIPT</div>\n                </div>\n\n\n                <md-input-container class="md-block">\n                  <label translate="CHAT.TOKEN">Token</label>\n                  <input type="text" name="token" ng-model="vm_ac.chatWebsite.token" autofocus ng-disabled="true">\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="CHAT.MOTIONPROXY">MotionProxy</label>\n                  <input type="url" name="remote" ng-model="vm_ac.chatWebsite.remote" required>\n                  <div class="hint"><span translate="CHAT.HELP.MOTIONPROXY"></span></div>\n                  <div ng-messages="scriptForm[\'remote\'].$error" ng-show="scriptForm[\'remote\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="CHAT.ERRORS.MOTIONPROXY_REQUIRED">Motion Proxy field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="CHAT.ERRORS.MOTIONPROXY_MUST_VALID_URL">Motion Proxy must be a valid url e.g.: http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="CHAT.WEBSITESCRIPT">WebsiteScript</label>\n                  <div>\n                    <pre style="font-size: 13px;">\n                    {{vm_ac.start}} {{vm_ac.script}} {{vm_ac.end}}\n                    </pre>\n                  </div>\n                  <div class="hint"><span translate="CHAT.HELP.COPYSCRIPTTOCLIPBOARD"></span></div>\n                </md-input-container>\n\n              </div>\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container interval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.INTERVAL">INTERVAL</div>\n            </div>\n            <form name="intervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.chatWebsite.IntervalId" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Always</md-option>\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="intervalForm[\'IntervalId\'].$error" ng-show="intervalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.TIMEZONE">Timezone</label>\n                <ms-timezone name="timezone" ng-model="vm.chatWebsite.timezone" ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="CHAT.HELP.TIMEZONE"></span></div>\n                <div ng-messages="intervalForm[\'timezone\'].$error" ng-show="intervalForm[timezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.mandatoryDisposition" class="md-block">\n                <label translate="CHAT.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.chatWebsite.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SNIPPET">SNIPPET</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container appearance md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.APPEARANCE">APPEARANCE</div>\n            </div>\n            <form name="appearanceForm" novalidate>\n              <div flex md-color-picker ng-model="vm.chatWebsite.color" label="{{\'CHAT.MAINCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.color_button" label="{{\'CHAT.BUTTONCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.textColor" label="{{\'CHAT.TEXTCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.textButtonColor" label="{{\'CHAT.TEXT_BUTTON_COLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.backgroundColor" label="{{\'CHAT.BACKGROUNDCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FONTSIZE">fontSize</label>\n                <input type="number" name="fontSize" ng-model="vm.chatWebsite.fontSize" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'fontSize\'].$error" ng-show="appearanceForm[\'fontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FONTSIZE_REQUIRED">fontSize field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.FONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">fontSize must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADERSHAPE">headershape</label>\n                <md-select name="header_shape" ng-model="vm.chatWebsite.header_shape" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'rounded\'"> {{ \'CHAT.ROUNDED\' | translate }} </md-option>\n\n                  <md-option ng-value="\'squared\'"> {{ \'CHAT.SQUARED\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'header_shape\'].$error" ng-show="appearanceForm[\'header_shape\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADERSHAPE_REQUIRED">headershape field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.showAgentAvatar" aria-label="ShowAgentAvatar" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.SHOWAGENTAVATAR">ShowAgentAvatar</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.showCustomerAvatar" aria-label="showCustomerAvatar" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.SHOWCUSTOMERAVATAR">showCustomerAvatar</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SNIPPETSWIPEOUT">snippetSwipeOut</label>\n                <md-select name="alignment" ng-model="vm.chatWebsite.alignment" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'bottom_right\'"> {{ \'CHAT.BOTTOM_RIGHT\' | translate }} </md-option>\n\n                  <md-option ng-value="\'right\'"> {{ \'CHAT.RIGHT\' | translate }} </md-option>\n\n                  <md-option ng-value="\'left\'"> {{ \'CHAT.LEFT\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'alignment\'].$error" ng-show="appearanceForm[\'alignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SNIPPETSWIPEOUT_REQUIRED">snippetSwipeOut field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.alignment !== \'bottom_right\'" class="md-block">\n                <label translate="CHAT.VERTICALPOSITION">verticalPosition</label>\n                <input type="number" name="verticalAlignment" ng-model="vm.chatWebsite.verticalAlignment" min="0" max="100" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="CHAT.HELP.VERTICALPOSITION"></span></div>\n                <div ng-messages="appearanceForm[\'verticalAlignment\'].$error" ng-show="appearanceForm[\'verticalAlignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_REQUIRED">verticalPosition field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">verticalPosition must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_MUST_BE_LESS_THAN_OR_EQUAL_TO">verticalPosition must be a valid greater or equal than</span> <span>100</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MESSAGESALIGNMENT">messagesAlignment</label>\n                <md-select name="messagesAlignment" ng-model="vm.chatWebsite.messagesAlignment" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'alternate\'"> {{ \'CHAT.ALTERNATE\' | translate }} </md-option>\n\n                  <md-option ng-value="\'centered\'"> {{ \'CHAT.CENTERED\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'messagesAlignment\'].$error" ng-show="appearanceForm[\'messagesAlignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MESSAGESALIGNMENT_REQUIRED">messagesAlignment field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DEFAULTTITLE">defaultTitle</label>\n                <input type="text" name="defaultTitle" ng-model="vm.chatWebsite.defaultTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'defaultTitle\'].$error" ng-show="appearanceForm[\'defaultTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DEFAULTTITLE_REQUIRED">defaultTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.DEFAULTTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>defaultTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.LABELTEXT">labelText</label>\n                <input type="text" name="labelText" ng-model="vm.chatWebsite.labelText" md-maxlength="6" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'labelText\'].$error" ng-show="appearanceForm[\'labelText\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.LABELTEXT_REQUIRED">labelText field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.LABELTEXT_MAX_LENGTH" translate-values=\'{max: 6}\'>labelText\n                      must have a maximum length equal to 6</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container onlinestatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.ONLINESTATUS">ONLINESTATUS</div>\n            </div>\n            <form name="onlinestatusForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADER_ONLINE">header_online</label>\n                <input type="text" name="header_online" ng-model="vm.chatWebsite.header_online" md-maxlength="255" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="onlinestatusForm[\'header_online\'].$error" ng-show="onlinestatusForm[\'header_online\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADER_ONLINE_REQUIRED">header_online field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.HEADER_ONLINE_MAX_LENGTH" translate-values=\'{max: 255}\'>header_online must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.START_CHAT_BUTTON">start_chat_button</label>\n                <input type="text" name="start_chat_button" ng-model="vm.chatWebsite.start_chat_button" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="onlinestatusForm[\'start_chat_button\'].$error" ng-show="onlinestatusForm[\'start_chat_button\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.START_CHAT_BUTTON_REQUIRED">start_chat_button field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.START_CHAT_BUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>start_chat_button must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container offlinestatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.OFFLINESTATUS">OFFLINESTATUS</div>\n            </div>\n            <form name="offlinestatusForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.hideWhenOffline" aria-label="hideWhenOffline" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.HIDEWHENOFFLINE">hideWhenOffline</span></md-switch>\n                <div class="hint"><span translate="CHAT.HELP.HIDEWHENOFFLINE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADER_OFFLINE">header_offline</label>\n                <input type="text" name="header_offline" ng-model="vm.chatWebsite.header_offline" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'header_offline\'].$error" ng-show="offlinestatusForm[\'header_offline\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADER_OFFLINE_REQUIRED">header_offline field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.HEADER_OFFLINE_MAX_LENGTH" translate-values=\'{max: 255}\'>header_offline must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINE_CHAT_BUTTON">offline_chat_button</label>\n                <input type="text" name="offline_chat_button" ng-model="vm.chatWebsite.offline_chat_button" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offline_chat_button\'].$error" ng-show="offlinestatusForm[\'offline_chat_button\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINE_CHAT_BUTTON_REQUIRED">offline_chat_button field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINE_CHAT_BUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>offline_chat_button must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINEMESSAGESUBJECT">offlineMessageSubject</label>\n                <input type="text" name="offlineMessageSubject" ng-model="vm.chatWebsite.offlineMessageSubject" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offlineMessageSubject\'].$error" ng-show="offlinestatusForm[\'offlineMessageSubject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGESUBJECT_REQUIRED">offlineMessageSubject field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGESUBJECT_MAX_LENGTH" translate-values=\'{max: 255}\'>offlineMessageSubject must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINEMESSAGEBODY">offlineMessageBody</label>\n                <input type="text" name="offlineMessageBody" ng-model="vm.chatWebsite.offlineMessageBody" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offlineMessageBody\'].$error" ng-show="offlinestatusForm[\'offlineMessageBody\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGEBODY_REQUIRED">offlineMessageBody field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGEBODY_MAX_LENGTH" translate-values=\'{max: 255}\'>offlineMessageBody must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container closingform md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.CLOSINGFORM">CLOSINGFORM</div>\n            </div>\n            <form name="closingformForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGMESSAGE">closingMessage</label>\n                <textarea name="closingMessage" ng-model="vm.chatWebsite.closingMessage" md-maxlength="255" required autofocus></textarea>\n\n                <div ng-messages="closingformForm[\'closingMessage\'].$error" ng-show="closingformForm[\'closingMessage\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGE_REQUIRED">closingMessage field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>closingMessage must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SKIPMESSAGEBUTTON">skipMessageButton</label>\n                <input type="text" name="skipMessageButton" ng-model="vm.chatWebsite.skipMessageButton" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'skipMessageButton\'].$error" ng-show="closingformForm[\'skipMessageButton\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SKIPMESSAGEBUTTON_REQUIRED">skipMessageButton field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SKIPMESSAGEBUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>skipMessageButton must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableRating" aria-label="enableRating" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLERATING">enableRating</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableRating" class="md-block">\n                <label translate="CHAT.RATINGTYPE">ratingType</label>\n                <md-select name="ratingType" ng-model="vm.chatWebsite.ratingType" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'star\'">Star</md-option>\n                  <md-option ng-value="\'thumb\'">Thumb</md-option>\n                </md-select>\n                <div ng-messages="closingformForm[\'ratingType\'].$error" ng-show="closingformForm[\'ratingType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.RATINGTYPE_REQUIRED">ratingType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableRating && vm.chatWebsite.ratingType === \'star\'" class="md-block">\n                <label translate="CHAT.RATINGSTARSNUMBER">ratingStarsNumber</label>\n                <input type="number" name="ratingStarsNumber" ng-model="vm.chatWebsite.ratingStarsNumber" min="2" max="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'ratingStarsNumber\'].$error" ng-show="closingformForm[\'ratingStarsNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_REQUIRED">ratingStarsNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ratingStarsNumber must be a valid greater or equal than</span> <span>2</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">ratingStarsNumber must be a valid greater or equal than</span> <span>5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableFeedback" aria-label="enableFeedback" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLEFEEDBACK">enableFeedback</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableFeedback" class="md-block">\n                <label translate="CHAT.FEEDBACKTITLE">feedbackTitle</label>\n                <input type="text" name="feedbackTitle" ng-model="vm.chatWebsite.feedbackTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'feedbackTitle\'].$error" ng-show="closingformForm[\'feedbackTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FEEDBACKTITLE_REQUIRED">feedbackTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FEEDBACKTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>feedbackTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.forwardTranscript" aria-label="forwardTranscript" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.FORWARDTRANSCRIPT">forwardTranscript</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.forwardTranscript" class="md-block">\n                <label translate="CHAT.FORWARDTRANSCRIPTMESSAGE">forwardTranscriptMessage</label>\n                <input type="text" name="forwardTranscriptMessage" ng-model="vm.chatWebsite.forwardTranscriptMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'forwardTranscriptMessage\'].$error" ng-show="closingformForm[\'forwardTranscriptMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORWARDTRANSCRIPTMESSAGE_REQUIRED">forwardTranscriptMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORWARDTRANSCRIPTMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>forwardTranscriptMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGMESSAGEBUTTON">closingMessageButton</label>\n                <input type="text" name="closingMessageButton" ng-model="vm.chatWebsite.closingMessageButton" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'closingMessageButton\'].$error" ng-show="closingformForm[\'closingMessageButton\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGEBUTTON_REQUIRED">closingMessageButton field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGEBUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>closingMessageButton must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container unmanagedstatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.UNMANAGEDSTATUS">UNMANAGEDSTATUS</div>\n            </div>\n            <form name="unmanagedstatusForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.autoclose" aria-label="autoclose" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.AUTOCLOSE">autoclose</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableUnmanagedNote" aria-label="enableUnmanagedNote" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLEUNMANAGEDNOTE">enableUnmanagedNote</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.UNMANAGEDMESSAGE">unmanagedMessage</label>\n                <input type="text" name="unmanagedMessage" ng-model="vm.chatWebsite.unmanagedMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'unmanagedMessage\'].$error" ng-show="unmanagedstatusForm[\'unmanagedMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.UNMANAGEDMESSAGE_REQUIRED">unmanagedMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.UNMANAGEDMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>unmanagedMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SKIPUNMANAGED">skipUnmanaged</label>\n                <input type="text" name="skipUnmanaged" ng-model="vm.chatWebsite.skipUnmanaged" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'skipUnmanaged\'].$error" ng-show="unmanagedstatusForm[\'skipUnmanaged\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SKIPUNMANAGED_REQUIRED">skipUnmanaged field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SKIPUNMANAGED_MAX_LENGTH" translate-values=\'{max: 255}\'>skipUnmanaged must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableUnmanagedNote" class="md-block">\n                <label translate="CHAT.SENDUNMANAGED">sendUnmanaged</label>\n                <input type="text" name="sendUnmanaged" ng-model="vm.chatWebsite.sendUnmanaged" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'sendUnmanaged\'].$error" ng-show="unmanagedstatusForm[\'sendUnmanaged\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SENDUNMANAGED_REQUIRED">sendUnmanaged field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SENDUNMANAGED_MAX_LENGTH" translate-values=\'{max: 255}\'>sendUnmanaged must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableUnmanagedNote" class="md-block">\n                <label translate="CHAT.NOTETITLE">noteTitle</label>\n                <input type="text" name="noteTitle" ng-model="vm.chatWebsite.noteTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'noteTitle\'].$error" ng-show="unmanagedstatusForm[\'noteTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NOTETITLE_REQUIRED">noteTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.NOTETITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>noteTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container interaction md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.INTERACTION">INTERACTION</div>\n            </div>\n            <form name="interactionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.AGENTIDENTIFIER">agentIdentifier</label>\n                <md-select name="agentIdentifier" ng-model="vm.chatWebsite.agentIdentifier" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'website_alias\'"> {{ \'CHAT.WEBSITEALIAS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'agent_alias\'"> {{ \'CHAT.AGENTALIAS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'agent_fullname\'"> {{ \'CHAT.AGENTFULLNAME\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.AGENTIDENTIFIER"></span></div>\n                <div ng-messages="interactionForm[\'agentIdentifier\'].$error" ng-show="interactionForm[\'agentIdentifier\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENTIDENTIFIER_REQUIRED">agentIdentifier field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CUSTOMERALIAS">customerAlias</label>\n                <input type="text" name="customerAlias" ng-model="vm.chatWebsite.customerAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'customerAlias\'].$error" ng-show="interactionForm[\'customerAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CUSTOMERALIAS_REQUIRED">customerAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CUSTOMERALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>customerAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MESSAGEFONTSIZE">messageFontSize</label>\n                <input type="number" name="messageFontSize" ng-model="vm.chatWebsite.messageFontSize" min="0" max="20" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'messageFontSize\'].$error" ng-show="interactionForm[\'messageFontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_REQUIRED">messageFontSize field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">messageFontSize must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">messageFontSize must be a valid greater or equal than</span> <span>20</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.agentIdentifier === \'website_alias\'" class="md-block">\n                <label translate="CHAT.WEBSITEALIAS">WebsiteAlias</label>\n                <input type="text" name="agentAlias" ng-model="vm.chatWebsite.agentAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="CHAT.HELP.WEBSITEALIAS"></span></div>\n                <div ng-messages="interactionForm[\'agentAlias\'].$error" ng-show="interactionForm[\'agentAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WEBSITEALIAS_REQUIRED">WebsiteAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WEBSITEALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>WebsiteAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGQUESTION">closingQuestion</label>\n                <input type="text" name="closingQuestion" ng-model="vm.chatWebsite.closingQuestion" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'closingQuestion\'].$error" ng-show="interactionForm[\'closingQuestion\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGQUESTION_REQUIRED">closingQuestion field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGQUESTION_MAX_LENGTH" translate-values=\'{max: 255}\'>closingQuestion must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FORMSUBMITSUCCESSMESSAGE">formSubmitSuccessMessage</label>\n                <input type="text" name="formSubmitSuccessMessage" ng-model="vm.chatWebsite.formSubmitSuccessMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'formSubmitSuccessMessage\'].$error" ng-show="interactionForm[\'formSubmitSuccessMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORMSUBMITSUCCESSMESSAGE_REQUIRED">formSubmitSuccessMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORMSUBMITSUCCESSMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>formSubmitSuccessMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FORMSUBMITFAILUREMESSAGE">formSubmitFailureMessage</label>\n                <input type="text" name="formSubmitFailureMessage" ng-model="vm.chatWebsite.formSubmitFailureMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'formSubmitFailureMessage\'].$error" ng-show="interactionForm[\'formSubmitFailureMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORMSUBMITFAILUREMESSAGE_REQUIRED">formSubmitFailureMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORMSUBMITFAILUREMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>formSubmitFailureMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerWriting" aria-label="enableCustomerWriting" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERWRITING">enableCustomerWriting</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.enableCustomerWriting" class="md-block">\n                <label translate="CHAT.WAITINGTITLE">waitingTitle</label>\n                <input type="text" name="waitingTitle" ng-model="vm.chatWebsite.waitingTitle" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'waitingTitle\'].$error" ng-show="interactionForm[\'waitingTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITINGTITLE_REQUIRED">waitingTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WAITINGTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>waitingTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.enableCustomerWriting" class="md-block">\n                <label translate="CHAT.WAITINGMESSAGE">waitingMessage</label>\n                <textarea name="waitingMessage" ng-model="vm.chatWebsite.waitingMessage" md-maxlength="255" required></textarea>\n\n                <div ng-messages="interactionForm[\'waitingMessage\'].$error" ng-show="interactionForm[\'waitingMessage\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITINGMESSAGE_REQUIRED">waitingMessage field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WAITINGMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>waitingMessage must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.PLACEHOLDERMESSAGE">placeholderMessage</label>\n                <input type="text" name="placeholderMessage" ng-model="vm.chatWebsite.placeholderMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'placeholderMessage\'].$error" ng-show="interactionForm[\'placeholderMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.PLACEHOLDERMESSAGE_REQUIRED">placeholderMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.PLACEHOLDERMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>placeholderMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.download_transcript" aria-label="downloadTranscript" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.DOWNLOADTRANSCRIPT">downloadTranscript</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerAttachment" aria-label="enableCustomerAttachment" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERATTACHMENT">enableCustomerAttachment</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableSendButton" aria-label="enableSendButton" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLESENDBUTTON">enableSendButton</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerCheckmarks" aria-label="enableCustomerCheckmarks" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERCHECKMARKS">enableCustomerCheckmarks</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SYSTEMALIAS">systemAlias</label>\n                <input type="text" name="systemAlias" ng-model="vm.chatWebsite.systemAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'systemAlias\'].$error" ng-show="interactionForm[\'systemAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SYSTEMALIAS_REQUIRED">systemAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SYSTEMALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>systemAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.license.custom" class="chatWebsite-detail-form-container whitelabel md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.WHITELABEL">WHITELABEL</div>\n            </div>\n            <form name="whitelabelForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.defaultWhiteLabel" aria-label="default" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.DEFAULT">default</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.defaultWhiteLabel" class="md-block">\n                <label translate="CHAT.WHITELABEL">whiteLabel</label>\n                <textarea name="whiteLabel" ng-model="vm.chatWebsite.whiteLabel" md-maxlength="255" required></textarea>\n\n                <div ng-messages="whitelabelForm[\'whiteLabel\'].$error" ng-show="whitelabelForm[\'whiteLabel\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WHITELABEL_REQUIRED">whiteLabel field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WHITELABEL_MAX_LENGTH" translate-values=\'{max: 255}\'>whiteLabel must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.license.custom" class="chatWebsite-detail-form-container logo md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.LOGO">LOGO</div>\n            </div>\n            <div ng-controller="ChatWebsitelogoController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="logoimage in vm_ca.chatWebsite.images" ng-switch="logoimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{logoimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="logoimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{logoimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container agentavatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.AGENTAVATAR">AGENTAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsiteagentAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="agentAvatarimage in vm_ca.chatWebsite.images" ng-switch="agentAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{agentAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="agentAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{agentAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container customeravatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.CUSTOMERAVATAR">CUSTOMERAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsitecustomerAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="customerAvatarimage in vm_ca.chatWebsite.images" ng-switch="customerAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{customerAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="customerAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{customerAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container systemavatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.SYSTEMAVATAR">SYSTEMAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsitesystemAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="systemAvatarimage in vm_ca.chatWebsite.images" ng-switch="systemAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{systemAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="systemAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{systemAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ONLINE">ONLINE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatformonline md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteonlineFormController as vm_fonc" ng-init="vm_fonc.init(vm.chatWebsite)" class="content" md-background-bg layout="column">\n              <div flex>\n                \x3c!-- START Buttons --\x3e\n                <md-button aria-label="comment" class="md-fab md-mini" ng-click="vm_fonc.add(button.type)" ng-repeat="button in vm_fonc.buttons">\n                  <md-tooltip md-direction="top">{{button.name}}</md-tooltip>\n                  <md-icon md-font-icon="{{button.icon}}"></md-icon>\n                </md-button>\n                \x3c!-- END Buttons --\x3e\n              </div>\n\n              <div layout="row" flex>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.BUILDER">BUILDER</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content>\n\n                      <form name="onlineForm" novalidate>\n\n                        \x3c!-- START MapKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.onlineForm.items.length">\n                          <label translate="CHAT.HELP.MAPKEY">MapKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.mapKey">\n                            <md-option ng-value="null">None</md-option>\n\n                            <md-optgroup label="standard">\n                              <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n\n                            <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                              <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END MapKey --\x3e\n\n                        \x3c!-- START FromKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.onlineForm.items.length">\n                          <label translate="CHAT.HELP.FROMKEY">FromKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.onlineForm.fromKey" md-selected-text="vm_fonc.chatWebsite.onlineForm.fromKey != null ? vm_fonc.chatWebsite.onlineForm.items[vm_fonc.chatWebsite.onlineForm.fromKey].props.title : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.onlineForm.items" ng-if="item.props.title" ng-value="$index">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END FromKey --\x3e\n\n                        \x3c!-- START EXPANSION PANELS --\x3e\n                        <md-expansion-panel ng-repeat="item in vm_fonc.chatWebsite.onlineForm.items track by $index" md-component-id="{{\'onlinePanel\' + $index}}">\n                          <md-expansion-panel-collapsed md-no-sticky="true">\n                            <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                            </md-button>\n                            <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                            </md-button>\n\n                            <div class="md-title">{{item.props.title || item.type}}</div>\n\n                            <div flex></div>\n                            <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                              <md-icon md-font-icon="icon-chevron-down"></md-icon>\n                            </md-button>\n                          </md-expansion-panel-collapsed>\n\n                          <md-expansion-panel-expanded>\n                            <md-expansion-panel-header>\n                              <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                              </md-button>\n\n                              <div class="md-title">{{item.props.title || item.type}}</div>\n\n                              <div flex></div>\n\n                              <md-button class="md-icon-button md-warn" aria-label="Remove" ng-click="vm_fonc.remove($index)">\n                                <md-icon md-font-icon="icon-delete"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                                <md-icon md-font-icon="icon-chevron-up"></md-icon>\n                              </md-button>\n                            </md-expansion-panel-header>\n\n                            <md-expansion-panel-content>\n                              <form-item type="{{item.type}}" item="item" index="$index"></form-item>\n\n                              <md-input-container class="md-block">\n                                <label translate="CHAT.VARIABLE">Variable</label>\n                                <md-select ng-model="item.variable">\n                                  <md-option ng-value="null">None</md-option>\n                                  <md-option ng-repeat="variable in vm_fonc.variables" ng-value="variable.name">{{ variable.name }}</md-option>\n                                </md-select>\n                              </md-input-container>\n\n                              <md-input-container class="md-block">\n                                <label translate="CHAT.CM_FIELD">Contact Manager Field</label>\n                                <md-select ng-model="item.cmField">\n                                  <md-option ng-value="null">None</md-option>\n\n                                  <md-optgroup label="standard">\n                                    <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n\n                                  <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                                    <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n                                </md-select>\n                              </md-input-container>\n                            </md-expansion-panel-content>\n\n                          </md-expansion-panel-expanded>\n                        </md-expansion-panel>\n                        \x3c!-- END EXPANSION PANELS --\x3e\n                      </form>\n                    </md-card-content>\n                  </md-card>\n                </div>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.PREVIEW">PREVIEW</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content flex>\n                      <form-view form="vm_fonc.chatWebsite.onlineForm" flex="100"></form-view>\n                    </md-card-content>\n                  </md-card>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.OFFLINE">OFFLINE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatformoffline md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteofflineFormController as vm_fonc" ng-init="vm_fonc.init(vm.chatWebsite)" class="content" md-background-bg layout="column">\n              <div flex>\n                \x3c!-- START Buttons --\x3e\n                <md-button aria-label="comment" class="md-fab md-mini" ng-click="vm_fonc.add(button.type)" ng-repeat="button in vm_fonc.buttons">\n                  <md-tooltip md-direction="top">{{button.name}}</md-tooltip>\n                  <md-icon md-font-icon="{{button.icon}}"></md-icon>\n                </md-button>\n                \x3c!-- END Buttons --\x3e\n              </div>\n\n              <div layout="row" flex>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.BUILDER">BUILDER</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content>\n\n                      <form name="offlineForm" novalidate>\n                        <md-input-container class="md-block">\n                          <md-switch ng-model="vm_fonc.chatWebsite.forwardOffline" aria-label="forwardOffline"><span translate="CHAT.FORWARD_OFFLINE">forwardOffline</span></md-switch>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.forwardOffline">\n                          <label translate="CHAT.FORWARD_OFFLINE_ADDRESS">FORWARD OFFLINE ADDRESS</label>\n                          <input type="text" name="forwardOfflineAddress" ng-model="vm_fonc.chatWebsite.forwardOfflineAddress">\n                          <div class="hint"><span translate="CHAT.HELP.FORWARD_OFFLINE"></span></div>\n                          <div ng-messages="offlineForm[\'forwardOfflineAddress\'].$error" ng-show="offlineForm[\'forwardOfflineAddress\'].$touched" role="alert">\n                            <div ng-message="email">\n                              <span translate="CHAT.ERRORS.EMAIL_MUST_BE_VALID">forwardOffline must be a valid e-mail address</span>\n                            </div>\n                          </div>\n                        </md-input-container>\n\n                        <md-input-container class="md-block">\n                          <md-switch ng-model="vm_fonc.chatWebsite.openNewInteraction" aria-label="openNewInteraction">\n                            <span translate="CHAT.OPEN_NEW_INTERACTION">openNewInteraction</span>\n                          </md-switch>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.openNewInteraction">\n                          <label translate="CHAT.EMAIL_ACCOUNT">Email account</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.MailAccountId" required>\n                            <md-option ng-repeat="account in vm_fonc.email_accounts" ng-value="account.id">{{ account.name }}</md-option>\n                          </md-select>\n                          <div ng-messages="offlineForm[\'MailAccountId\'].$error" ng-show="offlineForm[\'MailAccountId\'].$touched" role="alert">\n                            <div ng-message="required">\n                              <span translate="CHAT.ERRORS.EMAIL_ACCOUNT_REQUIRED">Email account field is required</span>\n                            </div>\n                          </div>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.openNewInteraction && vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.SUBJECT">Subject</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.subjectOffline" md-selected-text="vm_fonc.chatWebsite.subjectOffline != null ? vm_fonc.chatWebsite.subjectOffline : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items" ng-if="item.props.title" ng-value="item.props.title">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n\n                        \x3c!-- START MapKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.HELP.MAPKEY">MapKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.mapKeyOffline">\n                            <md-option ng-value="null">None</md-option>\n\n                            <md-optgroup label="standard">\n                              <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n\n                            <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                              <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END MapKey --\x3e\n\n                        \x3c!-- START FromKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.HELP.FROMKEY">FromKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.offlineForm.fromKey" md-selected-text="vm_fonc.chatWebsite.offlineForm.fromKey != null ? vm_fonc.chatWebsite.offlineForm.items[vm_fonc.chatWebsite.offlineForm.fromKey].props.title : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items" ng-if="item.props.title" ng-value="$index">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END FromKey --\x3e\n\n                        \x3c!-- START EXPANSION PANELS --\x3e\n                        <md-expansion-panel ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items track by $index" md-component-id="{{\'offlinePanel\' + $index}}">\n                          <md-expansion-panel-collapsed md-no-sticky="true">\n                            <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                            </md-button>\n                            <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                            </md-button>\n\n                            <div class="md-title">{{item.props.title || item.type}}</div>\n\n                            <div flex></div>\n                            <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                              <md-icon md-font-icon="icon-chevron-down"></md-icon>\n                            </md-button>\n                          </md-expansion-panel-collapsed>\n\n                          <md-expansion-panel-expanded>\n                            <md-expansion-panel-header>\n                              <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                              </md-button>\n\n                              <div class="md-title">{{item.props.title || item.type}}</div>\n\n                              <div flex></div>\n\n                              <md-button class="md-icon-button md-warn" aria-label="Remove" ng-click="vm_fonc.remove($index)">\n                                <md-icon md-font-icon="icon-delete"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                                <md-icon md-font-icon="icon-chevron-up"></md-icon>\n                              </md-button>\n                            </md-expansion-panel-header>\n\n                            <md-expansion-panel-content>\n                              <form-item type="{{item.type}}" item="item" index="$index"></form-item>\n\n\n                              <md-input-container class="md-block" ng-if="item.type != \'upload\'">\n                                <label translate="CHAT.CM_FIELD">Contact Manager Field</label>\n                                <md-select ng-model="item.cmField">\n                                  <md-option ng-value="null">None</md-option>\n\n                                  <md-optgroup label="standard">\n                                    <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n\n                                  <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                                    <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n                                </md-select>\n                              </md-input-container>\n                            </md-expansion-panel-content>\n\n                          </md-expansion-panel-expanded>\n                        </md-expansion-panel>\n                        \x3c!-- END EXPANSION PANELS --\x3e\n                      </form>\n                    </md-card-content>\n                  </md-card>\n                </div>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.PREVIEW">PREVIEW</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content flex>\n                      <form-view form="vm_fonc.chatWebsite.offlineForm" flex="100"></form-view>\n                    </md-card-content>\n                  </md-card>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.PROACTIVEACTIONS">PROACTIVEACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container proactive md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteProactiveActionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteProactiveActions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.PROACTIVEACTIONS">ProactiveActions</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteProactiveActions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event)" aria-label="add chatProactiveAction" translate translate-attr-label="CHAT.ADD_CHATPROACTIVEACTION">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteProactiveActions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteProactiveActions.length}} {{vm_dc.selectedChatWebsiteProactiveActions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteProactiveActions" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteProactiveActions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteProactiveActions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteProactiveActions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="name">\n                        {{ \'CHAT.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="type">\n                        {{ \'CHAT.TYPE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="selector">\n                        {{ \'CHAT.SELECTOR\' | translate }}\n                      </th>\n                      <th md-column md-order-by="timeout">\n                        {{ \'CHAT.TIMEOUT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="chatProactiveAction" md-select-id="id" ng-repeat="chatProactiveAction in vm_dc.chatWebsiteProactiveActions.rows">\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.name}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{ \'CHAT.\' + vm_dc.arraytype[chatProactiveAction.type].option | uppercase | translate }}\n                      </td>\n\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.selector}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.timeout}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{ chatProactiveAction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" translate="CHAT.EDIT_CHATPROACTIVEACTION">\n                                Edit ChatProactiveAction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(chatProactiveAction, $event)" translate="CHAT.DELETE_CHATPROACTIVEACTION">\n                                Delete ChatProactiveAction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteProactiveActions.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_CHATPROACTIVEACTION_AVAILABLE">No chatproactiveaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteProactiveActions.count}}" md-on-paginate="vm_dc.getChatWebsiteProactiveActions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="ChatWebsiteDispositionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="chatWebsite-detail-form-container chatdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="CHAT.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add chat dispositions" translate translate-attr-label="CHAT.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="chatWebsites.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteChatCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteChatCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.CHATCANNEDANSWERS">ChatCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteChatCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event)" aria-label="add chatCannedAnswer" translate translate-attr-label="CHAT.ADD_CHATCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteChatCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteChatCannedAnswers.length}} {{vm_dc.selectedChatWebsiteChatCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteChatCannedAnswers" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteChatCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteChatCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteChatCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'CHAT.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'CHAT.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'CHAT.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="chatCannedAnswer" md-select-id="id" ng-repeat="chatCannedAnswer in vm_dc.chatWebsiteChatCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{ chatCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" translate="CHAT.EDIT_CHATCANNEDANSWER">\n                                Edit ChatCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(chatCannedAnswer, $event)" translate="CHAT.DELETE_CHATCANNEDANSWER">\n                                Delete ChatCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteChatCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_CHATCANNEDANSWER_AVAILABLE">No chatcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteChatCannedAnswers.count}}" md-on-paginate="vm_dc.getChatWebsiteChatCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.VIDEO">VIDEO</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container vidaoo md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.VIDAOO">VIDAOO</div>\n            </div>\n            <form name="vidaooForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.vidaooEscalation" aria-label="vidaooEscalation" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.VIDAOOESCALATION">vidaooEscalation</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOAPIKEY">vidaooApiKey</label>\n                <input type="text" name="vidaooApiKey" ng-model="vm.chatWebsite.vidaooApiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooApiKey\'].$error" ng-show="vidaooForm[\'vidaooApiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOOAPIKEY_REQUIRED">vidaooApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOTOPIC">vidaooTopic</label>\n                <input type="text" name="vidaooTopic" ng-model="vm.chatWebsite.vidaooTopic" value="Generated by XCALLY Motion" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooTopic\'].$error" ng-show="vidaooForm[\'vidaooTopic\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOOTOPIC_REQUIRED">vidaooTopic field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOONOTE">vidaooNote</label>\n                <input type="text" name="vidaooNote" ng-model="vm.chatWebsite.vidaooNote" value="Meeting generated for interaction #{{interaction.id}} by {{agent.name}}" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooNote\'].$error" ng-show="vidaooForm[\'vidaooNote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOONOTE_REQUIRED">vidaooNote field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOMETADATA">vidaooMetadata</label>\n                <textarea name="vidaooMetadata" ng-model="vm.chatWebsite.vidaooMetadata"></textarea>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteActionsController as vm_ac" ng-init="vm_ac.init(vm.chatWebsite, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="CHAT.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedChatWebsiteApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedChatWebsiteApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedChatWebsiteApps.length}} {{vm_ac.selectedChatWebsiteApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedChatWebsiteApps($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedChatWebsiteApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.chatWebsiteApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editChatWebsiteApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.chatWebsiteApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteInteractionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getChatWebsiteInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getChatWebsiteInteractions()" aria-label="refresh Interactions" translate translate-attr-label="CHAT.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteInteractions.length}} {{vm_dc.selectedChatWebsiteInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteInteractions" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteInteractions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'CHAT.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'CHAT.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'CHAT.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'CHAT.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'CHAT.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.chatWebsiteInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'CHAT.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'CHAT.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spychatInteraction($event, interaction)" translate="CHAT.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event, true)" translate="CHAT.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event)" translate="CHAT.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="CHAT.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteInteractions.count}}" md-on-paginate="vm_dc.getChatWebsiteInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.OFFLINEMESSAGES">OFFLINEMESSAGES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container offlinemessages md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteOfflineMessagesController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteOfflineMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.OFFLINEMESSAGES">OfflineMessages</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteOfflineMessages()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteOfflineMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteOfflineMessages.length}} {{vm_dc.selectedChatWebsiteOfflineMessages.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteOfflineMessages" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteOfflineMessages($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteOfflineMessages" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteOfflineMessages">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column>\n                        {{ \'CHAT.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="offlineMessage" md-select-id="id" ng-repeat="offlineMessage in vm_dc.chatWebsiteOfflineMessages.rows">\n                      <td md-cell>\n                        {{offlineMessage.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="offlineMessage.Attachments.length > 0">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{offlineMessage.Contact.firstName}}\n                      </td>\n                      <td md-cell>\n                        {{ offlineMessage.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.showOfflineMessageChatWebsiteOfflineMessage($event, offlineMessage)" translate="CHAT.SHOW_OFFLINEMESSAGE">\n                                SHOW OfflineMessage\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(offlineMessage, $event)" translate="CHAT.DELETE_OFFLINEMESSAGE">\n                                Delete OfflineMessage\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteOfflineMessages.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_OFFLINEMESSAGE_AVAILABLE">No offlinemessage available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteOfflineMessages.count}}" md-on-paginate="vm_dc.getChatWebsiteOfflineMessages" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/chat/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/companies/companies.html",'<div id="companies" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.COMPANIES">Companies</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCompanies.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCompanies =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-companies-count">\n          <span>{{vm.selectedCompanies.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCompanies()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCompanies()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCompanies" csv-label="true" filename="companies.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCompanies($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- COMPANY TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCompanies" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCompanies">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.companies.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="company" md-select-id="id" ng-repeat="company in vm.companies.rows">\n                <td md-cell ng-if="company.userpic"><img class="avatar" alt="{{company.name}}" ng-src="api/users/{{company.id}}/avatar" /></td>\n                <td md-cell ng-if="!company.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{company.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="id ">{{company.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="name ">{{company.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="description ">{{company.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(company, $event    )" translate="CONTACTMANAGER.EDIT_COMPANY">\n                          Edit Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotocontactsgoto(company, $event    )" translate="CONTACTMANAGER.GOTOCONTACTS_COMPANY">\n                          goToContacts Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(company, $event    )" translate="CONTACTMANAGER.DELETE_COMPANY">\n                          Delete Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.companies.count}}" md-on-paginate="vm.getCompanies" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / COMPANY TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD COMPANY BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-company-button" ng-click="vm.createOrEditCompany($event)" aria-label="add company" translate translate-attr-aria-label="CONTACTMANAGER.ADD_COMPANY">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD COMPANY BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/companies/create/dialog.html",'<md-dialog class="company-dialog" aria-label="New Company">\n  <form name="companyForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.company.name" ng-required="true" autofocus>\n\n        <div ng-messages="companyForm[\'name\'].$error" ng-show="companyForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.PHONE">Phone</label>\n        <input type="text" name="phone" ng-model="vm.company.phone">\n\n        <div ng-messages="companyForm[\'phone\'].$error" ng-show="companyForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.VAT">Vat</label>\n        <input type="text" name="vat" ng-model="vm.company.vat">\n\n        <div ng-messages="companyForm[\'vat\'].$error" ng-show="companyForm[\'vat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.VAT_REQUIRED">Vat field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FAX">Fax</label>\n        <input type="text" name="fax" ng-model="vm.company.fax">\n\n        <div ng-messages="companyForm[\'fax\'].$error" ng-show="companyForm[\'fax\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.FAX_REQUIRED">Fax field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.COMPANYID">CompanyId</label>\n        <input type="text" name="companyId" ng-model="vm.company.companyId">\n\n        <div ng-messages="companyForm[\'companyId\'].$error" ng-show="companyForm[\'companyId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.COMPANYID_REQUIRED">CompanyId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <input type="text" name="type" ng-model="vm.company.type">\n\n        <div ng-messages="companyForm[\'type\'].$error" ng-show="companyForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.WEBSITE">Website</label>\n        <input type="text" name="website" ng-model="vm.company.website" md-maxlength="255">\n\n        <div ng-messages="companyForm[\'website\'].$error" ng-show="companyForm[\'website\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.WEBSITE_REQUIRED">Website field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CONTACTMANAGER.ERRORS.WEBSITE_MAX_LENGTH" translate-values=\'{max: 255}\'>Website must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL_DOMAIN">Email_Domain</label>\n        <input type="text" name="emailDomain" ng-model="vm.company.emailDomain">\n\n        <div ng-messages="companyForm[\'emailDomain\'].$error" ng-show="companyForm[\'emailDomain\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_DOMAIN_REQUIRED">Email_Domain field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.company.email">\n\n        <div ng-messages="companyForm[\'email\'].$error" ng-show="companyForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.company.description">\n\n        <div ng-messages="companyForm[\'description\'].$error" ng-show="companyForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCompany" ng-click="vm.saveCompany()" class="send-button md-accent md-raised" ng-disabled="companyForm.$invalid || companyForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCompany" ng-click="vm.addNewCompany()" class="send-button md-accent md-raised" ng-disabled="companyForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_COMPANY" translate-attr-aria-label="CONTACTMANAGER.ADD_COMPANY">\n          ADD COMPANY\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCompany" ng-click="vm.deleteCompany($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/companies/edit/view.html",'<div id="contactmanager-company" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-companies-button md-icon-button" aria-label="Go to companies" ng-click="vm.gotoCompanies()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_COMPANIES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="company-image" hide-xs>\n          <img ng-src="assets/images/business/companies.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.company.id}}\n            <span ng-if="vm.company.name">{{vm.company.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.company.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.company, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="CONTACTMANAGER.GOTO_COMPANY"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveCompany()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (addressForm.$invalid) || (shipmentAddressForm.$invalid)" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.GENERAL">GENERAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.company.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.company.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.VAT">Vat</label>\n                <input type="text" name="vat" ng-model="vm.company.vat" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'vat\'].$error" ng-show="generalForm[\'vat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.VAT_REQUIRED">Vat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.FAX">Fax</label>\n                <input type="text" name="fax" ng-model="vm.company.fax" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'fax\'].$error" ng-show="generalForm[\'fax\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.FAX_REQUIRED">Fax field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COMPANYID">CompanyId</label>\n                <input type="text" name="companyId" ng-model="vm.company.companyId" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'companyId\'].$error" ng-show="generalForm[\'companyId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COMPANYID_REQUIRED">CompanyId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.TYPE">Type</label>\n                <input type="text" name="type" ng-model="vm.company.type" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.WEBSITE">Website</label>\n                <input type="text" name="website" ng-model="vm.company.website" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'website\'].$error" ng-show="generalForm[\'website\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.WEBSITE_REQUIRED">Website field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CONTACTMANAGER.ERRORS.WEBSITE_MAX_LENGTH" translate-values=\'{max: 255}\'>Website must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.EMAIL_DOMAIN">Email_Domain</label>\n                <input type="text" name="emailDomain" ng-model="vm.company.emailDomain" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'emailDomain\'].$error" ng-show="generalForm[\'emailDomain\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_DOMAIN_REQUIRED">Email_Domain field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.company.email" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.company.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.ADDRESS">ADDRESS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container address md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.ADDRESS">ADDRESS</div>\n            </div>\n            <form name="addressForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.STREET">Street</label>\n                <input type="text" name="street" ng-model="vm.company.street" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'street\'].$error" ng-show="addressForm[\'street\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.STREET_REQUIRED">Street field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.POSTAL_CODE">Postal_Code</label>\n                <input type="text" name="postalCode" ng-model="vm.company.postalCode" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'postalCode\'].$error" ng-show="addressForm[\'postalCode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.POSTAL_CODE_REQUIRED">Postal_Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.CITY">City</label>\n                <input type="text" name="city" ng-model="vm.company.city" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'city\'].$error" ng-show="addressForm[\'city\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.CITY_REQUIRED">City field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                <input type="text" name="country" ng-model="vm.company.country" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'country\'].$error" ng-show="addressForm[\'country\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COUNTRY_REQUIRED">Country field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.SHIPMENTADDRESS">SHIPMENTADDRESS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container shipmentaddress md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.SHIPMENTADDRESS">SHIPMENTADDRESS</div>\n            </div>\n            <form name="shipmentAddressForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.STREET">Street</label>\n                <input type="text" name="sStreet" ng-model="vm.company.sStreet" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sStreet\'].$error" ng-show="shipmentAddressForm[\'sStreet\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.STREET_REQUIRED">Street field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.POSTAL_CODE">Postal_Code</label>\n                <input type="text" name="sPostalCode" ng-model="vm.company.sPostalCode" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sPostalCode\'].$error" ng-show="shipmentAddressForm[\'sPostalCode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.POSTAL_CODE_REQUIRED">Postal_Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.CITY">City</label>\n                <input type="text" name="sCity" ng-model="vm.company.sCity" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sCity\'].$error" ng-show="shipmentAddressForm[\'sCity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.CITY_REQUIRED">City field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                <input type="text" name="sCountry" ng-model="vm.company.sCountry" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sCountry\'].$error" ng-show="shipmentAddressForm[\'sCountry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COUNTRY_REQUIRED">Country field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/contacts.html",'<div id="contacts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.CONTACTS">Contacts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    \x3c!-- SEARCH --\x3e\n    <div class="search-input-wrapper" layout="row" layout-align="start center">\n      <label for="search">\n        <md-icon md-font-icon="icon-magnify"></md-icon>\n      </label>\n      <md-input-container md-no-float class="m-0">\n        <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n      </md-input-container>\n    </div>\n    \x3c!-- / SEARCH --\x3e\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContacts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedContacts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-contacts-count">\n          <span>{{vm.selectedContacts.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContacts()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContacts()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContacts" csv-label="true" filename="contacts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedContacts($event)" aria-label="delete selected" translate translate-attr-label="CONTACTS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      <div layout="row">\n        <div class="column" flex="20">\n          <md-card>\n            <md-card-content>\n              <button layout-align="center center" md-mini-fab ng-click="vm.selectedList = null; vm.selectedCompany = null; vm.selectedTags = []">\n                <md-icon md-font-icon="icon-refresh"></md-icon>{{ \'CONTACTMANAGER.ALL_CONTACTS\' | translate }}\n              </button>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_LIST">Select a list</label>\n                <md-select placeholder="Select a list" ng-model="vm.selectedList" ng-disabled="vm.lists.count === 0">\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.ALL">All</em></md-option>\n                  <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_COMPANY">Select a company</label>\n                <md-select placeholder="Select a company" flex="100" ng-model="vm.selectedCompany" ng-disabled="vm.companies.count === 0">\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.ALL">All</em></md-option>\n                  <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_TAGS">Select one or more tags</label>\n                <md-select multiple placeholder="Select one or more tags" flex="100" ng-model="vm.query.tag" ng-change="vm.getContacts()">\n                  <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows">{{tag.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n        </div>\n\n        \x3c!-- USER TABLE --\x3e\n        <md-card flex="80">\n          <md-table-container ng-init="vm.getAssignedCompanies()">\n            <table md-table md-row-select multiple ng-model="vm.selectedContacts" md-progress="vm.promise">\n              <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n                <tr md-row>\n                  <th md-column md-order-by="id">ID</th>\n                  <th md-column md-order-by="firstName">{{\'CONTACTMANAGER.FULLNAME\' | translate}}</th>\n                  <th md-column md-order-by="phone">{{\'CONTACTMANAGER.PHONE\' | translate}}</th>\n                  <th md-column md-order-by="email">{{\'CONTACTMANAGER.EMAIL\' | translate}}</th>\n                  <th md-column md-order-by="createdAt">{{\'CONTACTMANAGER.CREATED_AT\' | translate}}</th>\n                  <th md-column md-order-by="ListId">{{\'CONTACTMANAGER.LIST\' | translate}}</th>\n                  <th md-column md-order-by="CompanyId">{{\'CONTACTMANAGER.COMPANY\' | translate}}</th>\n                  <th md-column md-order-by="tags">{{\'CONTACTMANAGER.TAGS\' | translate}}</th>\n                  <th md-column width="10px"></th>\n                </tr>\n              </thead>\n              <tbody md-body>\n                <tr md-row ng-hide="vm.contacts.rows.length">\n                  <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                      <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                  </td>\n                </tr>\n                <tr md-row md-select="contact" md-select-id="id" ng-repeat="contact in vm.contacts.rows">\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="id">{{contact.id}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="firstName" privacy ng-cloak>{{contact.firstName}} {{contact.lastName}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="phone" privacy ng-cloak>{{contact.phone}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="email" privacy ng-cloak>{{contact.email}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="createdAt">{{contact.createdAt | date:\'medium\'}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="list">{{vm.listsMap[contact.ListId]}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="company">{{vm.companiesMap[contact.CompanyId]}}</td>\n                  <td md-cell class="tag">\n                    <div ng-if="contact.Tags.length">\n                      <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                        <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                        <span class="text-truncate">{{contact.Tags[0].name}}</span>\n                      </div>\n                      <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                        <md-tooltip md-direction="left" layout="row">\n                          <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                        </md-tooltip>\n                        <md-icon md-font-icon="icon-tag"></md-icon>\n                      </div>\n                    </div>\n                  </td>\n                  <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.editdialog(contact, ev)" translate="CONTACTMANAGER.EDIT_CONTACT">\n                            Edit Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.mergeContact(ev, contact)" translate="CONTACTMANAGER.MERGE_CONTACT">\n                            Merge Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.duplicateContact(ev, contact)" translate="CONTACTMANAGER.DUPLICATE_CONTACT">\n                            Duplicate Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-divider ng-if="vm.crudPermissions.canEdit && vm.crudPermissions.canDelete">\n                        </md-menu-divider>\n                        <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                          <md-button ng-click="vm.deleteconfirm(contact, ev)" translate="CONTACTMANAGER.DELETE_CONTACT">\n                            Delete Contact\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n\n          <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n        </md-card>\n        \x3c!-- / USER TABLE --\x3e\n      </div>\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USER BUTTON --\x3e\n  <md-fab-speed-dial id="add-contact-button" ng-if="vm.crudPermissions.canEdit" ng-hide="vm.options.hidden" md-direction="up" md-open="vm.options.isOpen" class="md-scale md-fab" ng-class="{ \'md-hover-full\': vm.options.hover }" ng-mouseenter="vm.options.isOpen=true" ng-mouseleave="vm.options.isOpen=false">\n    <md-fab-trigger>\n      <md-button aria-label="menu" class="md-fab md-accent">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </md-fab-trigger>\n    <md-fab-actions>\n      <md-button class="md-fab md-mini md-primary" flow-btn flow-init="vm.ngFlowOptions" flow-files-submitted="$flow.upload()" flow-file-success="vm.importContactsUpdates($file, $message, $flow)" flow-file-added="vm.fileAdded($file)" aria-label="Select File" translate translate-attr-aria-label="CONTACTMANAGER.UPDATES_EXISTING_CONTACTS">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.UPDATE_EXISTING_CONTACTS\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-upload"></md-icon>\n      </md-button>\n      <md-button class="md-fab md-mini md-warn" flow-btn flow-init="vm.ngFlowOptions" flow-files-submitted="$flow.upload()" flow-file-success="vm.importContacts($file, $message, $flow)" flow-file-added="vm.fileAdded($file)" aria-label="Select File" translate translate-attr-aria-label="CONTACTMANAGER.IMPORT_CONTACTS">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.IMPORT_CONTACTS\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-upload"></md-icon>\n      </md-button>\n      <md-button class="md-fab md-mini md-accent" ng-click="vm.createOrEditContact($event)" aria-label="add contact" translate translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.ADD_CONTACT\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </md-fab-actions>\n  </md-fab-speed-dial>\n  \x3c!-- / ADD USER BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/create/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="New Contact">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FIRSTNAME">First name</label>\n        <input name="firstName" ng-model="vm.contact.firstName" required md-autofocus privacy="!vm.crudPermissions.canEdit" ng-cloak>\n\n        <div ng-messages="contactForm.firstName.$error" ng-show="contactForm.firstName.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED">First name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LASTNAME">Last name</label>\n        <input name="lastName" ng-model="vm.contact.lastName" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.PHONE">Phone</label>\n        <input name="phone" ng-model="vm.contact.phone" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL">Email</label>\n        <input name="email" type="email" ng-model="vm.contact.email" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.MOBILE">Mobile</label>\n        <input name="mobile" ng-model="vm.contact.mobile" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FAX">Fax</label>\n        <input name="fax" ng-model="vm.contact.fax" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LIST">List</label>\n        <md-select name="list" ng-model="vm.contact.ListId" ng-disabled="vm.contact.id && vm.contact.ListId" ng-change="vm.getCustomFields(vm.contact.ListId)" required>\n          <md-optgroup label="Lists">\n            <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="contactForm.list.$error" ng-show="contactForm.list.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" flex-gt-sm="">\n        <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n          <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n            {{ $chip.phone }}\n          </md-chip-template>\n        </md-chips>\n      </md-input-container>\n      <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="100">\n        <div class="pb-16" layout="column" layout-align="start center">\n          <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n        </div>\n        <form flex name="additionalPhonesForm" novalidate>\n          <div ng-repeat="additionalPhone in vm.additionalItems">\n            <div layout="row" flex="1">\n              <md-input-container class="md-block" flex="50">\n                <label>{{$index}} - {{additionalPhone.phone}}</label>\n                <md-select ng-model="vm.additionalItemTypes[$index]" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-block" flex="50">\n                <input ng-model="additionalPhone.description" ng-cloak>\n              </md-input-container>\n            </div>\n          </div>\n        </form>\n      </div>\n\n      <md-input-container>\n        <label translate="CONTACTMANAGER.TIMEZONE">Timezone</label>\n        <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone"></ms-timezone>\n      </md-input-container>\n\n      <div ng-repeat="customField in vm.customFields.rows" class="md-block" ng-switch="customField.type">\n        <div ng-switch-when="datetime">\n          <label>{{customField.alias}}</label>\n          <div>\n            \x3c!-- ng-model="customField.value" --\x3e\n            <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]"></mdp-date-picker>\n            <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n            </mdp-time-picker>\n          </div>\n        </div>\n\n        <div ng-switch-when="select">\n          <label>{{customField.alias}}</label>\n          <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n            <md-option ng-repeat="value in customField.values" ng-value="value.value">{{value.value}}</md-option>\n            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n          </md-select>\n        </div>\n\n        <div ng-switch-when="switch">\n          <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n            {{customField.alias}}\n          </md-switch>\n        </div>\n\n        <md-input-container ng-switch-default>\n          <label>{{customField.alias}}</label>\n          <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.COMPANY">Company</label>\n        <md-select name="company" ng-model="vm.contact.CompanyId">\n          <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows" ng-hide="!vm.contact.CompanyId && company.canSelect === false" ng-disabled="company.canSelect === false">\n            {{company.name}}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <div ng-if="!vm.allFields" layout="row" layout-align="center center">\n        <md-button class="md-accent" ng-click="vm.allFields = true" translate="CONTACTMANAGER.SHOW_ALL_FIELDS">Show All\n          Fields</md-button>\n      </div>\n\n      <md-input-container class="md-block" ng-if="vm.allFields" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\n        <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>\n        <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth">\n        </mdp-date-picker>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n        <input type="text" name="country" ng-model="vm.contact.country">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.CITY">City</label>\n        <input type="text" name="city" ng-model="vm.contact.city">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.STREET">Street</label>\n        <input type="text" name="street" ng-model="vm.contact.street">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.POSTAL_CODE">Postal Code</label>\n        <input type="text" name="postalCode" ng-model="vm.contact.postalCode">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.NOTES">Notes</label>\n        <input type="text" name="description" ng-model="vm.contact.description">\n      </md-input-container>\n\n      <div ng-if="vm.allFields" layout="row" layout-align="center center">\n        <md-button class="md-accent" ng-click="vm.allFields = false" translate="CONTACTMANAGER.FEWER_FIELDS">Fewer\n          Fields</md-button>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newContact" ng-click="vm.saveContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid || contactForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newContact" ng-click="vm.addNewContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid || contactForm.$pristine" aria-label="ADD" translate="CONTACTMANAGER.ADD_CONTACT" translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n          ADD CONTACT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContact" ng-click="vm.deleteContact($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="{{ \'CONTACTMANAGER.DUPLICATE_CONTACT\' | translate }}">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LIST">List</label>\n        <md-select name="list" ng-model="vm.contact.ListId">\n          <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n        </md-select>\n\n        <div ng-messages="contactForm.list.$error" ng-show="contactForm.list.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.addNewContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_CONTACT" translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n          ADD CONTACT\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div flex class="md-block">\n        <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n          <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="CONTACTMANAGER.ERRORS.DATE_REQUIRED">Date is required</span>\n            </div>\n            <div ng-message="format">\n              <span translate="CONTACTMANAGER.ERRORS.DATE_INVALID">Date is invalid</span>\n            </div>\n          </div>\n        </mdp-date-picker>\n      </div>\n\n      <div flex class="md-block">\n        <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n          <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="CONTACTMANAGER.ERRORS.TIME_REQUIRED">Time is required</span>\n            </div>\n            <div ng-message="format">\n              <span translate="CONTACTMANAGER.ERRORS.TIME_INVALID">Time is invalid</span>\n            </div>\n          </div>\n        </mdp-time-picker>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_HOPPER" translate-attr-aria-label="CONTACTMANAGER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="!vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/edit/view.html",'<div id="cm-contact" class="page-layout simple tabbed" layout="column" ng-init="vm.onInit()">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-contacts-button md-icon-button" aria-label="Go to contacts" ng-click="vm.gotoContacts()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_CONTACTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="contact-image" hide-xs>\n          <img ng-src="assets/images/business/contacts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.contact.id}} {{vm.contact.firstName}} {{vm.contact.lastName}}\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.contact.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-if="vm.contact.role && vm.contact.role !== \'admin\'" ng-controller="ContactQueueAddButtonController as vm_contact_qa" ng-cloak>\n      <md-fab-speed-dial ng-hide="vm_contact_qa.hidden" md-direction="left" md-open="vm_contact_qa.isOpen" class="md-scale md-fab" ng-class="{ \'md-hover-full\': vm_contact_qa.hover }" ng-mouseenter="vm_contact_qa.isOpen=true" ng-mouseleave="vm_contact_qa.isOpen=false">\n        <md-fab-trigger>\n          <md-button aria-label="menu" class="md-fab md-primary md-icon-button">\n            <md-tooltip md-direction="top" md-visible="tooltipVisible">Channels</md-tooltip>\n            <md-icon md-font-icon="icon-eye" aria-label="channels"></md-icon>\n          </md-button>\n        </md-fab-trigger>\n        <md-fab-actions>\n          <div ng-repeat="channel in vm_contact_qa.channels">\n            <md-button aria-label="{{channel.name}}" class="md-fab md-raised md-icon-button md-mini" ng-click="vm_contact_qa.openDialog($event, vm.contact, channel)">\n              <md-tooltip md-direction="{{channel.direction}}" md-visible="tooltipVisible" md-autohide="false">\n                {{channel.name}}\n              </md-tooltip>\n              <md-icon md-font-icon="{{channel.icon}}" aria-label="{{channel.name}}"></md-icon>\n            </md-button>\n          </div>\n        </md-fab-actions>\n      </md-fab-speed-dial>\n    </div>\n\n    <div ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.duplicateContact($event)" class="md-fab md-warn md-icon-button" aria-label="DUPLICATE">\n        <md-icon md-font-icon="icon-file-multiple"></md-icon>\n      </md-button>\n      <md-button type="submit" ng-click="vm.saveContact()" class="send-button md-accent md-raised" ng-disabled="detailForm.$pristine && customFieldsForm.$pristine && socialForm.$pristine && additionalPhonesForm.$pristine" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.DETAIL">DETAIL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div layout="column" flex="70">\n              <md-card class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.PERSONAL_INFO">PERSONAL_INFO\n                  </div>\n                </div>\n                <form name="detailForm" novalidate>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- fistName --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.FIRSTNAME">First Name</label>\n                      <md-icon md-font-icon="icon-account" class="firstname"></md-icon>\n                      <input type="text" name="firstName" ng-model="vm.contact.firstName" class="text-truncate" required ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                      <div ng-messages="detailForm.firstName.$error" ng-show="detailForm.firstName.$touched" role="alert">\n                        <div ng-message="required">\n                          <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED">First name field is required</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- lastName --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.LASTNAME">Last Name</label>\n                      <input type="text" name="lastName" ng-model="vm.contact.lastName" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- phone --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.PHONE">Phone</label>\n                      <md-icon md-font-icon="icon-phone"></md-icon>\n                      <input type="text" name="phone" ng-model="vm.contact.phone" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- mobile --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.MOBILE">Mobile</label>\n                      <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n                      <input type="text" name="mobile" ng-model="vm.contact.mobile" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- email --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.EMAIL">Email</label>\n                      <md-icon md-font-icon="icon-email" class="email"></md-icon>\n                      <input type="email" name="email" ng-model="vm.contact.email" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                      <div ng-messages="detailForm.firstName.$error" ng-show="detailForm.firstName.$touched" role="alert">\n                        <div ng-message="email">\n                          <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail\n                            address</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- fax --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.FAX">Fax</label>\n                      <md-icon md-font-icon="icon-deskphone"></md-icon>\n                      <input type="text" name="fax" ng-model="vm.contact.fax" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.TIMEZONE">Timezone</label>\n                      <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.ADDITIONAL_PHONES">Additional Phones</label>\n                      <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n                        <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n                          {{ $chip.phone }}\n                        </md-chip-template>\n                      </md-chips>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\n                      <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>\n                      <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth" mdp-disabled="!vm.crudPermissions.canEdit"></mdp-date-picker>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container ng-if="vm.companies.rows.length" class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.COMPANY">Company</label>\n                      <md-icon md-font-icon="icon-domain"></md-icon>\n                      <md-select name="company" ng-model="vm.contact.CompanyId" ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-optgroup label="Companies">\n                          <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows" ng-disabled="company.canSelect === false">{{company.name}}</md-option>\n                          <md-option ng-value=" null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                        </md-optgroup>\n                      </md-select>\n                      <md-icon class="pointer" ng-show="vm.contact.CompanyId" md-font-icon="icon-information-outline" ng-click="vm.editCompany($event, vm.contact.CompanyId)"></md-icon>\n                    </md-input-container>\n                    <section ng-if="!vm.companies.rows.length" flex-gt-sm="">\n                      <md-icon md-font-icon="icon-briefcase"></md-icon>\n                      <label translate="CONTACTMANAGER.NO_COMPANIES">No Companies</label>\n                    </section>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container ng-if="vm.tags.rows.length" class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.TAGS">Tags</label>\n                      <md-icon md-font-icon="icon-tag"></md-icon>\n                      <md-select ng-model="vm.Tags" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-optgroup label="Tags">\n                          <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows" ng-disabled="tag.canSelect === false">{{tag.name}}</md-option>\n                        </md-optgroup>\n                      </md-select>\n                    </md-input-container>\n                    <section ng-if="!vm.tags.rows.length" flex-gt-sm="">\n                      <md-icon md-font-icon="icon-tag"></md-icon>\n                      <label translate="CONTACTMANAGER.NO_TAG">No Tags</label>\n                      <md-button class="md-accent" translate="CONTACTMANAGER.ADD_TAG">Add Tag</md-button>\n                    </section>\n                  </div>\n\n                  <div ng-if="!vm.allFields" layout="row" layout-align="center center">\n                    <md-button class="md-accent" ng-click="vm.allFields = true" translate="CONTACTMANAGER.SHOW_ALL_FIELDS">Show All Fields</md-button>\n                  </div>\n\n                  <div ng-if="vm.allFields">\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      \x3c!-- country --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                        <md-icon md-font-icon="icon-home" class="country"></md-icon>\n                        <input type="text" name="country" ng-model="vm.contact.country" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                      <div flex="5"></div>\n                      \x3c!-- city --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.CITY">City</label>\n                        <input type="text" name="city" ng-model="vm.contact.city" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                    </div>\n\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      <div flex="5"></div>\n                      \x3c!-- street --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.STREET">Street</label>\n                        <input type="text" name="street" ng-model="vm.contact.street" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                      <div flex="5"></div>\n                      \x3c!-- postalCode --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.POSTALCODE">Postal Code</label>\n                        <input type="text" name="postalCode" ng-model="vm.contact.postalCode" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                    </div>\n\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate translate-attr-placeholder="CONTACTMANAGER.NOTES">Notes</label>\n                        <md-icon md-font-icon="icon-note"></md-icon>\n                        <textarea ng-model="vm.contact.description" type="text" max-rows="4" ng-disabled="!vm.crudPermissions.canEdit"></textarea>\n                      </md-input-container>\n                    </div>\n\n                    <div layout="row" layout-align="center center">\n                      <md-button class="md-accent" ng-click="vm.allFields = false" translate="CONTACTMANAGER.FEWER_FIELDS">Fewer Fields\n                      </md-button>\n                    </div>\n\n                  </div>\n                </form>\n              </md-card>\n              <md-card class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.SOCIAL">Social</div>\n                </div>\n                <form name="socialForm" novalidate>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Facebook</label>\n                      <md-icon md-font-icon="icon-facebook" class="facebook"></md-icon>\n                      <input type="text" name="facebook" ng-model="vm.contact.facebook" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Twitter</label>\n                      <md-icon md-font-icon="icon-twitter" class="twitter"></md-icon>\n                      <input type="text" name="twitter" ng-model="vm.contact.twitter" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                    </md-input-container>\n                  </div>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Line</label>\n                      <md-icon md-font-icon="fab fa-line"></md-icon>\n                      <input type="text" name="line" ng-model="vm.contact.line" class="text-truncate">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Viber</label>\n                      <md-icon md-font-icon="fab fa-viber"></md-icon>\n                      <input type="text" name="viber" ng-model="vm.contact.viber" class="text-truncate">\n                    </md-input-container>\n                  </div>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>WeChat</label>\n                      <md-icon md-font-icon="fab fa-weixin"></md-icon>\n                      <input type="text" name="wechat" ng-model="vm.contact.wechat" class="text-truncate">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Telegram</label>\n                      <md-icon md-font-icon="icon-telegram"></md-icon>\n                      <input type="text" name="telegram" ng-model="vm.contact.telegram" class="text-truncate">\n                    </md-input-container>\n                  </div>\n                </form>\n              </md-card>\n            </div>\n\n            <div flex></div>\n\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.CUSTOM_FIELDS">CUSTOM FIELDS\n                </div>\n              </div>\n              <form name="customFieldsForm" novalidate>\n                <md-input-container class="md-block">\n                  <label translate translate-attr-placeholder="CONTACTMANAGER.LIST">List</label>\n                  <md-select name="list" ng-model="vm.contact.ListId" md-on-close="vm.onSelectList($event)" ng-disabled="vm.contact.ListId">\n                    <md-optgroup label="Lists">\n                      <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">#{{list.id}} - {{list.name}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                    </md-optgroup>\n                  </md-select>\n                </md-input-container>\n                <div ng-repeat="customField in vm.customFields.rows" ng-switch="customField.type">\n                  <md-input-container class="md-block" ng-switch-when="datetime">\n                    <label>{{customField.alias}}</label>\n                    <div ng-init="vm.contact[\'cf_\' + customField.id] = vm.getDateFromString(vm.contact[\'cf_\' + customField.id])">\n                      <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]"></mdp-date-picker>\n                      <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-time-picker>\n                    </div>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="select">\n                    <label>{{customField.alias}}</label>\n                    <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required" ng-disabled="!vm.crudPermissions.canEdit">\n                      <md-option ng-repeat="value in customField.values" ng-value="value.value">{{value.value}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                    </md-select>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="switch">\n                    <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n                      {{customField.alias}}\n                    </md-switch>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-default>\n                    <label>{{customField.alias}}</label>\n                    <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required" ng-disabled="!vm.crudPermissions.canEdit">\n                  </md-input-container>\n                </div>\n              </form>\n            </div>\n\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n              </div>\n              <form name="additionalPhonesForm" novalidate>\n                <div ng-repeat="additionalPhone in vm.additionalItems">\n                  <div layout="row">\n                    <md-button class="md-icon-button" ng-show="!$first" ng-click="vm.moveUp($index)">\n                      <md-tooltip>{{\'CONTACTMANAGER.MOVE_UP\' | translate}}</md-tooltip>\n                      <md-icon md-font-icon="icon-arrow-up"></md-icon>\n                    </md-button>\n                    <md-button class="md-icon-button md-primary" ng-show="!$last" ng-click="vm.moveDown($index)">\n                      <md-tooltip>{{\'CONTACTMANAGER.MOVE_DOWN\' | translate}}</md-tooltip>\n                      <md-icon md-font-icon="icon-arrow-down"></md-icon>\n                    </md-button>\n                  </div>\n                  <div layout="column" style="margin-bottom:5px;border-bottom: 1px solid gray;">\n                    <md-input-container class="md-block">\n                      <label>{{$index}} - {{additionalPhone.phone}}</label>\n                      <md-select ng-model="additionalPhone.ItemTypeId" ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                        <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                      </md-select>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                      <input ng-model="additionalPhone.description" ng-cloak>\n                    </md-input-container>\n                  </div>\n                </div>\n              </form>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab ng-if="vm.license.dialer">\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.MOTION_BULL">MOTION BULL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.HOPPER">Hopper</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryHopper.filter = query;" on-collapse="vm.queryHopper.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getHoppers()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryHopper.sort" md-on-reorder="vm.getHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                      <th md-column md-order-by="phone">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | translate }}</th>\n                      <th md-column md-order-by="priority">{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n                      <th md-column md-order-by="recallme">{{ \'CONTACTMANAGER.RECALLME\' | translate }}</th>\n                      <th md-column md-order-by="VoiceQueueId">{{ \'CONTACTMANAGER.VOICEQUEUEID\' | translate }}</th>\n                      <th md-column md-order-by="CampaignId">{{ \'CONTACTMANAGER.CAMPAIGNID\' | translate }}</th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.hoppers.count">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, hopper) in vm.hoppers.rows">\n                      <td md-cell>{{hopper.id}}</td>\n                      <td md-cell privacy ng-cloak>{{hopper.phone}}</td>\n                      <td md-cell>{{hopper.scheduledat | date:\'medium\'}}</td>\n                      <td md-cell>{{ vm.arraypriority[hopper.priority].option }}</td>\n                      <td md-cell class="recallme ">\n                        <md-icon md-colors="{color: {{hopper.recallme ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{hopper.recallme? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell>{{hopper.VoiceQueueId}}</td>\n                      <td md-cell>{{hopper.CampaignId}}</td>\n                      <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="2">\n                            <md-menu-item>\n                              <md-button ng-if="vm.crudPermissions.canEdit && hopper.VoiceQueueId" ng-click="vm.editHopper($event, hopper)" translate="CONTACTMANAGER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                              <md-button ng-if="vm.crudPermissions.canEdit && hopper.CampaignId" ng-click="vm.createOrEditIvrCampaignHopper($event, hopper)" translate="CONTACTMANAGER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                              <md-button ng-click="vm.crudPermissions.canDelete && vm.deleteconfirm(hopper, $event)" translate="CONTACTMANAGER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHopper.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHopper.page" md-total="{{vm.hoppers.count}}" md-on-paginate="vm.getHoppers" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.FINAL">Final</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryFinal.filter = query;" on-collapse="vm.queryFinal.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getFinals()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryFinal.sort" md-on-reorder="vm.getFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">{{ \'CONTACTMANAGER.UNIQUEID\' | translate }}</th>\n                      <th md-column md-order-by="calleridnum">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="state">{{ \'CONTACTMANAGER.STATE\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="disposition">{{ \'CONTACTMANAGER.DISPOSITION\' | translate }}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.finals.count">\n                      <td md-cell colspan="5">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, final) in vm.finals.rows">\n                      <td md-cell>{{final.uniqueid}}</td>\n                      <td md-cell privacy ng-cloak>{{final.calleridnum}}</td>\n                      <td md-cell>{{final.statedesc}}</td>\n                      <td md-cell>{{final.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{final.disposition}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryFinal.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryFinal.page" md-total="{{vm.finals.count}}" md-on-paginate="vm.getFinals" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.HISTORY">History</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryHistory.filter = query;" on-collapse="vm.queryHistory.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getHistories()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryHistory.sort" md-on-reorder="vm.getHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">{{ \'CONTACTMANAGER.UNIQUEID\' | translate }}</th>\n                      <th md-column md-order-by="calleridnum">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="state">{{ \'CONTACTMANAGER.STATE\' | translate }}</th>\n                      <th md-column md-order-by="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="endtime">{{ \'CONTACTMANAGER.ENDTIME\' | translate }}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.histories.count">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, history) in vm.histories.rows">\n                      <td md-cell>{{history.uniqueid}}</td>\n                      <td md-cell privacy ng-cloak>{{history.calleridnum}}</td>\n                      <td md-cell>{{history.statedesc}}</td>\n                      <td md-cell>{{history.scheduledat | date:\'medium\'}}</td>\n                      <td md-cell>{{history.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{history.endtime | date:\'medium\'}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHistory.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHistory.page" md-total="{{vm.histories.count}}" md-on-paginate="vm.getHistories" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab ng-if="vm.license.jscripty">\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.JSCRIPTY">JSCRIPTY</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.SESSIONS">Sessions</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryJscriptySession.filter = query;" on-collapse="vm.queryJscriptySession.filter = undefined;" debounce="300"></ms-search-bar>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- SESSION TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryJscriptySession.sort" md-on-reorder="vm.getJscriptySessions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="endtime">{{ \'CONTACTMANAGER.ENDTIME\' | translate }}</th>\n                      <th md-column md-order-by="agent">{{ \'CONTACTMANAGER.AGENT\' | translate }}</th>\n                      <th md-column md-order-by="project">{{ \'CONTACTMANAGER.PROJECT\' | translate }}</th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.jscriptySessions.count">\n                      <td md-cell colspan="6">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, session) in vm.jscriptySessions.rows">\n                      <td md-cell>{{session.id}}</td>\n                      <td md-cell>{{session.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{session.endtime | date:\'medium\'}}</td>\n                      <td md-cell>{{session.membername}}</td>\n                      <td md-cell>{{session.projectname}}</td>\n                      <td md-cell class="actions"></td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHopper.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHopper.page" md-total="{{vm.hoppers.count}}" md-on-paginate="vm.getHoppers" md-page-select></md-table-pagination>\n              \x3c!-- / SESSION TABLE --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.CUSTOMER_JOURNEY">CUSTOMER JOURNEY</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <md-content class="md-padding" id="journey-content">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n            </div>\n          </md-content>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/import/import.html",'<md-dialog class="import-dialog" aria-label="Import contact">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="CONTACTMANAGER.IMPORT_CONTACTS">Import Contacts</span>\n        <md-button ng-if="vm.result.finish || !vm.processing" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear ng-disabled="!vm.processing || vm.result.finish" md-mode="indeterminate" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div>\n        <md-content ng-show="!vm.processing">\n          <div class="form-title" translate="CONTACTMANAGER.CONTACTMANAGER">CONTACT MANAGER</div>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="contactField in vm.contactFields">\n            <label>{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</label>\n            <md-select name="{{contactField.key}}" ng-model="vm.binding[contactField.key]" placeholder="{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}" ng-required="contactField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="contactField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.LIST">List</label>\n            <md-select name="list" ng-model="vm.ListId" placeholder="Select a list" ng-change="vm.onChangeList()" required>\n              <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="customField in vm.customFields.rows">\n            <label>{{customField.alias}}</label>\n            <md-select ng-model="vm.binding[\'cf_\' + customField.id]" placeholder="{{customField.alias}}" ng-required="customField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="customField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.COMPANY">Company</label>\n            <md-select name="company" ng-model="vm.CompanyId" placeholder="Select a company">\n              <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n              <md-option ng-value="null">\n                <em translate="CONTACTMANAGER.NONE">None</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <md-select ng-model="vm.duplicates" placeholder="{{ \'CONTACTMANAGER.CHECK_DUPLICATES\' | translate}}" multiple>\n              <md-option ng-value="contactField.key" ng-repeat="contactField in vm.contactFields">{{ \'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <div ng-if="vm.license.dialer">\n            <div class="form-title" translate="CONTACTMANAGER.MOTIONDIALER">MOTION BULL</div>\n\n            <md-input-container class="md-icon-float md-block" ng-repeat="motionBullField in vm.motionBullFields">\n              <label>{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}</label>\n              <md-select name="{{motionBullField.key}}" ng-model="vm.binding[motionBullField.key]" placeholder="{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}" ng-required="motionBullField.required">\n                <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                <md-option ng-value="null" ng-hide="contactField.required">\n                  <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n                </md-option>\n              </md-select>\n            </md-input-container>\n            <div class="form-title" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n            <div layout="row" ng-repeat="additionalPhone in vm.contactItemTypes" flex>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select name="{{additionalPhone.key}}" ng-model="vm.binding[additionalPhone.key]" placeholder="{{additionalPhone.key}}" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select name="{{additionalPhone.key+\'_description\'}}" ng-model="vm.binding[additionalPhone.key+\'_description\']" placeholder="{{additionalPhone.key}} description" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n            </div>\n          </div>\n\n        </md-content>\n\n        <div class="error-list" ng-if="vm.result.finish">\n          <div class="info" layout="row" layout-align="space-between center">\n            <div>\n              <div class="message">{{\'CONTACTMANAGER.UPLOAD_COMPLETED\' | translate | uppercase}} ({{vm.result.elapsed}}s)</div>\n            </div>\n            <md-button class="md-icon-button">\n              <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n            </md-button>\n          </div>\n        </div>\n\n        <div layout="row" ng-if="vm.processing">\n          \x3c!-- WIDGET PROCESSING --\x3e\n          <ms-widget ng-if="!vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.rows"></span>\n                </div>\n                <div ng-if="vm.processing" class="font-weight-500 secondary-text">Please wait, we are processing your contacts...</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET PROCESSING --\x3e\n          \x3c!-- WIDGET SUCCESS --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 green-fg">\n                  <span ng-bind="vm.result.affectedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.SUCCESS">Success</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET SUCCESS --\x3e\n\n          \x3c!-- WIDGET FAILURE --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 red-fg">\n                  <span ng-bind="vm.result.failedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.FAILURE">Failure</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET FAILURE --\x3e\n\n          \x3c!-- WIDGET DUPLICATES --\x3e\n          <ms-widget ng-if="vm.result.duplicatedRows && vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.duplicatedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.DUPLICATES">Duplicates</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET DUPLICATES --\x3e\n        </div>\n\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row">\n        <md-button ng-if="!vm.processing" ng-disabled="importForm.$invalid || importForm.$pristine" ng-click="vm.uploadCsv()" class="md-accent md-raised" aria-label="UPLOAD" translate="CONTACTMANAGER.UPLOAD" translate-attr-aria-label="CONTACTMANAGER.IMPORT">\n          IMPORT\n        </md-button>\n        <md-button ng-if="vm.processing && !vm.result.finish && !vm.stopping" ng-click="vm.stopUpload()" class="md-accent md-raised" aria-label="Stop Upload" translate="CONTACTMANAGER.STOP" translate-attr-aria-label="CONTACTMANAGER.STOP">\n          STOP\n        </md-button>\n        <md-button ng-if="vm.result.finish && vm.result.errors.length" ng-csv="vm.getArrayErrors()" csv-header="vm.getHeaderErrors()" class="md-accent md-raised" aria-label="Export Errors" filename="contacts_import_errors.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon> {{\'CONTACTMANAGER.EXPORT_ERRORS\' | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/import/importUpdates.html",'<md-dialog class="import-dialog" aria-label="Import contact">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="CONTACTMANAGER.UPDATE_EXISTING_CONTACTS">Update Existing Contacts</span>\n        <md-button ng-if="vm.result.finish || !vm.processing" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear ng-disabled="!vm.processing || vm.result.finish" md-mode="indeterminate" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div>\n        <md-content ng-show="!vm.processing">\n          <div class="form-title" translate="CONTACTMANAGER.CONTACTMANAGER">CONTACT MANAGER</div>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="contactField in vm.contactFields">\n            <label>{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</label>\n            <md-select name="{{contactField.key}}" ng-model="vm.binding[contactField.key]" placeholder="{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}" ng-required="contactField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="contactField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.LIST">List</label>\n            <md-select name="list" ng-model="vm.ListId" placeholder="Select a list" ng-change="vm.onChangeList()" required>\n              <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="customField in vm.customFields.rows">\n            <label>{{customField.alias}}</label>\n            <md-select ng-model="vm.binding[\'cf_\' + customField.id]" placeholder="{{customField.alias}}" ng-required="customField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="customField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.COMPANY">Company</label>\n            <md-select name="company" ng-model="vm.CompanyId" placeholder="Select a company">\n              <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n              <md-option ng-value="null">\n                <em translate="CONTACTMANAGER.NONE">None</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <md-select ng-model="vm.duplicates" placeholder="{{ \'CONTACTMANAGER.CHECK_DUPLICATES\' | translate}}" multiple>\n              <md-option ng-value="contactField.key" ng-repeat="contactField in vm.contactFields">{{ \'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <div ng-if="vm.license.dialer">\n            <div class="form-title" translate="CONTACTMANAGER.MOTIONDIALER">MOTION BULL</div>\n\n            <md-input-container class="md-icon-float md-block" ng-repeat="motionBullField in vm.motionBullFields">\n              <label>{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}</label>\n              <md-select name="{{motionBullField.key}}" ng-model="vm.binding[motionBullField.key]" placeholder="{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}" ng-required="motionBullField.required">\n                <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                <md-option ng-value="null" ng-hide="contactField.required">\n                  <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n                </md-option>\n              </md-select>\n            </md-input-container>\n            <div class="form-title" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n            <div layout="row" ng-repeat="additionalPhone in vm.contactItemTypes" flex>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select multiple="true" name="{{additionalPhone.key}}" ng-model="vm.binding[additionalPhone.key]" placeholder="{{additionalPhone.key}}" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select multiple="true" name="{{additionalPhone.key+\'_description\'}}" ng-model="vm.binding[additionalPhone.key+\'_description\']" placeholder="{{additionalPhone.key}} description" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n            </div>\n          </div>\n\n        </md-content>\n\n        <div class="error-list" ng-if="vm.result.finish">\n          <div class="info" layout="row" layout-align="space-between center">\n            <div>\n              <div class="message">{{\'CONTACTMANAGER.UPLOAD_COMPLETED\' | translate | uppercase}} ({{vm.result.elapsed}}s)</div>\n            </div>\n            <md-button class="md-icon-button">\n              <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n            </md-button>\n          </div>\n        </div>\n\n        <div layout="row" ng-if="vm.processing">\n          \x3c!-- WIDGET PROCESSING --\x3e\n          <ms-widget ng-if="!vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.rows"></span>\n                </div>\n                <div ng-if="vm.processing" class="font-weight-500 secondary-text">Please wait, we are processing your contacts...</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET PROCESSING --\x3e\n          \x3c!-- WIDGET SUCCESS --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 green-fg">\n                  <span ng-bind="vm.result.affectedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.SUCCESS">Success</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET SUCCESS --\x3e\n\n          \x3c!-- WIDGET FAILURE --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 red-fg">\n                  <span ng-bind="vm.result.failedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.FAILURE">Failure</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET FAILURE --\x3e\n\n          \x3c!-- WIDGET DUPLICATES --\x3e\n          <ms-widget ng-if="vm.result.duplicatedRows && vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.duplicatedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.DUPLICATES">Duplicates</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET DUPLICATES --\x3e\n        </div>\n\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row">\n        <md-button ng-if="!vm.processing" ng-disabled="importForm.$invalid || importForm.$pristine" ng-click="vm.uploadCsv()" class="md-accent md-raised" aria-label="UPLOAD" translate="CONTACTMANAGER.UPLOAD" translate-attr-aria-label="CONTACTMANAGER.IMPORT">\n          IMPORT\n        </md-button>\n        <md-button ng-if="vm.processing && !vm.result.finish && !vm.stopping" ng-click="vm.stopUpload()" class="md-accent md-raised" aria-label="Stop Upload" translate="CONTACTMANAGER.STOP" translate-attr-aria-label="CONTACTMANAGER.STOP">\n          STOP\n        </md-button>\n        <md-button ng-if="vm.result.finish && vm.result.errors.length" ng-csv="vm.getArrayErrors()" csv-header="vm.getHeaderErrors()" class="md-accent md-raised" aria-label="Export Errors" filename="contacts_import_errors.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon> {{\'CONTACTMANAGER.EXPORT_ERRORS\' | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/merge/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="Merge Contact">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block" flex-gt-sm>\n        <label>Filter</label>\n        <input ng-model="vm.searchTerm" name="searchTerm" ng-model-options="{ debounce: 300 }" ng-change="vm.change()">\n      </md-input-container>\n\n      <md-list flex>\n        <md-subheader class="md-no-sticky" ng-hide="vm.contacts.length"><em>Filter doesn\'t match any contact</em></md-subheader>\n        <md-list-item class="md-3-line" ng-repeat="contact in vm.contacts | filter:{ id: \'!\' + vm.contact.id}" ng-click="vm.showConfirm($event, vm.contact, contact)">\n          <img ng-src="assets/images/avatars/profile.png" class="md-avatar" alt="{{contact.who}}" />\n          <div class="md-list-item-text" layout="column">\n            <h3>#{{ contact.id }} - {{ contact.firstName }} {{ contact.lastName }}</h3>\n            <h4>{{ contact.email }}</h4>\n            <p>{{ contact.phone }}</p>\n          </div>\n        </md-list-item>\n      </md-list>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",'<md-dialog class="globalCustomField-dialog" aria-label="New GlobalCustomField">\n  <form name="globalCustomFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.ALIAS">Alias</label>\n        <input type="" name="alias" ng-model="vm.globalCustomField.alias" ng-required="true" autofocus>\n\n        <div ng-messages="globalCustomFieldForm[\'alias\'].$error" ng-show="globalCustomFieldForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.globalCustomField.type" required ng-disabled="!vm.newGlobalCustomField">\n          <md-option ng-value="\'text\'">Text</md-option>\n          <md-option ng-value="\'select\'">Select</md-option>\n          <md-option ng-value="\'number\'">Number</md-option>\n          <md-option ng-value="\'switch\'">Switch</md-option>\n          <md-option ng-value="\'datetime\'">Datetime</md-option>\n        </md-select>\n        <div ng-messages="globalCustomFieldForm[\'type\'].$error" ng-show="globalCustomFieldForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.globalCustomField.type == \'select\'" class="md-block">\n        <md-list>\n          <md-list-item layout-margin>\n            <md-button class="md-fab md-mini md-secondary" ng-click="vm.addItem(vm.globalCustomField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip>\n              <md-icon md-font-icon="icon-plus" aria-label="alert error"></md-icon>\n            </md-button>\n            <md-button ng-if="vm.globalCustomField.values.length" class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItems(vm.globalCustomField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE_ALL">Delete All</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list ng-sortable="vm.sortable">\n          <md-list-item ng-repeat="item in vm.globalCustomField.values" style="border: 1px solid #ccc!important; border-radius: 7px;" layout-margin>\n            <div>\n              <md-icon class="s24" style="cursor:move" md-font-icon="icon-drag" aria-label="drag"></md-icon>\n              <input type="text" ng-model="item.value" flex>\n            </div>\n            <md-button class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItem(vm.globalCustomField.values, $index);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list>\n          <md-list-item ng-if="!vm.globalCustomField.values.length" layout="row" layout-align="center center">\n            <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS">No Available Items</em>\n          </md-list-item>\n        </md-list>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.globalCustomField.required" aria-label="Required"><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.globalCustomField.type == \'text\'" class="md-block">\n        <md-switch ng-model="vm.globalCustomField.clickToAction" aria-label="ClickToAction"><span translate="CONTACTMANAGER.CLICKTOACTION">ClickToAction</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.globalCustomField.clickToAction" class="md-block">\n        <label translate="CONTACTMANAGER.ACTIONTYPE">ActionType</label>\n        <md-select name="actionType" ng-model="vm.globalCustomField.actionType">\n          <md-option ng-value="\'voice\'">Voice</md-option>\n        </md-select>\n        <div ng-messages="globalCustomFieldForm[\'actionType\'].$error" ng-show="globalCustomFieldForm[\'actionType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED">ActionType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newGlobalCustomField" ng-click="vm.saveGlobalCustomField()" class="send-button md-accent md-raised" ng-disabled="globalCustomFieldForm.$invalid || globalCustomFieldForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newGlobalCustomField" ng-click="vm.addNewGlobalCustomField()" class="send-button md-accent md-raised" ng-disabled="globalCustomFieldForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD" translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD">\n          ADD GLOBALCUSTOMFIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newGlobalCustomField" ng-click="vm.deleteGlobalCustomField($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/globalCustomFields/globalCustomFields.html",'<div id="globalCustomFields" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.GLOBALCUSTOMFIELDS">GlobalCustomFields</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedGlobalCustomFields.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedGlobalCustomFields =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-globalCustomFields-count">\n          <span>{{vm.selectedGlobalCustomFields.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllGlobalCustomFields()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectGlobalCustomFields()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedGlobalCustomFields" csv-label="true" filename="globalCustomFields.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedGlobalCustomFields($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- GLOBALCUSTOMFIELD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedGlobalCustomFields" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getGlobalCustomFields">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="alias">{{ \'CONTACTMANAGER.ALIAS\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'CONTACTMANAGER.TYPE\' | translate }}</th>\n                <th md-column md-order-by="required">{{ \'CONTACTMANAGER.REQUIRED\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.globalCustomFields.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="globalCustomField" md-select-id="id" ng-repeat="globalCustomField in vm.globalCustomFields.rows">\n                <td md-cell ng-if="globalCustomField.userpic"><img class="avatar" alt="{{globalCustomField.name}}" ng-src="api/users/{{globalCustomField.id}}/avatar" /></td>\n                <td md-cell ng-if="!globalCustomField.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{globalCustomField.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="id ">{{globalCustomField.id}}</td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="alias ">{{globalCustomField.alias}}</td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="type ">{{ vm.arraytype[globalCustomField.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(globalCustomField, ev) : vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="required ">\n                  <md-icon md-colors="{color: {{globalCustomField.required ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{globalCustomField.required ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(globalCustomField, $event    )" translate="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD">\n                          Edit GlobalCustomField\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(globalCustomField, $event    )" translate="CONTACTMANAGER.DELETE_GLOBALCUSTOMFIELD">\n                          Delete GlobalCustomField\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.globalCustomFields.count}}" md-on-paginate="vm.getGlobalCustomFields" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / GLOBALCUSTOMFIELD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD GLOBALCUSTOMFIELD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-globalCustomField-button" ng-click="vm.createOrEditGlobalCustomField($event)" aria-label="add globalCustomField" translate translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD GLOBALCUSTOMFIELD BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/lists/create/dialog.html",'<md-dialog class="list-dialog" aria-label="New List">\n  <form name="listForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.list.name" ng-required="true" autofocus>\n\n        <div ng-messages="listForm[\'name\'].$error" ng-show="listForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.list.description">\n\n        <div ng-messages="listForm[\'description\'].$error" ng-show="listForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newList" ng-click="vm.saveList()" class="send-button md-accent md-raised" ng-disabled="listForm.$invalid || listForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newList" ng-click="vm.addNewList()" class="send-button md-accent md-raised" ng-disabled="listForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_LIST" translate-attr-aria-label="CONTACTMANAGER.ADD_LIST">\n          ADD LIST\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newList" ng-click="vm.deleteList($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",'<md-dialog class="list-dialog" aria-label="list" ng-init="vm.onInit()">\n  <form name="listForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CONTACTMANAGER.AGENTADD_LIST">Add Agent to list</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",'<md-dialog class="customField-dialog" aria-label="New CustomField">\n  <form name="customFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.ALIAS">Alias</label>\n        <input type="" name="alias" ng-model="vm.customField.alias" ng-required="true" autofocus>\n\n        <div ng-messages="customFieldForm[\'alias\'].$error" ng-show="customFieldForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.customField.type" required ng-disabled="!vm.newCustomField">\n          <md-option ng-value="\'text\'">Text</md-option>\n          <md-option ng-value="\'select\'">Select</md-option>\n          <md-option ng-value="\'number\'">Number</md-option>\n          <md-option ng-value="\'switch\'">Switch</md-option>\n          <md-option ng-value="\'datetime\'">Datetime</md-option>\n        </md-select>\n        <div ng-messages="customFieldForm[\'type\'].$error" ng-show="customFieldForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.customField.type == \'select\'" class="md-block">\n        <md-list>\n          <md-list-item layout-margin>\n            <md-button class="md-fab md-mini md-secondary" ng-click="vm.addItem(vm.customField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip>\n              <md-icon md-font-icon="icon-plus" aria-label="alert error"></md-icon>\n            </md-button>\n            <md-button ng-if="vm.customField.values.length" class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItems(vm.customField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE_ALL">Delete All</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list ng-sortable="vm.sortable">\n          <md-list-item ng-repeat="item in vm.customField.values" style="border: 1px solid #ccc!important; border-radius: 7px;" layout-margin>\n            <div>\n              <md-icon class="s24" style="cursor:move" md-font-icon="icon-drag" aria-label="drag"></md-icon>\n              <input type="text" ng-model="item.value" flex>\n            </div>\n            <md-button class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItem(vm.customField.values, $index);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list>\n          <md-list-item ng-if="!vm.customField.values.length" layout="row" layout-align="center center">\n            <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS">No Available Items</em>\n          </md-list-item>\n        </md-list>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customField.required" aria-label="Required"><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.customField.type == \'text\'" class="md-block">\n        <md-switch ng-model="vm.customField.clickToAction" aria-label="clickToAction"><span translate="CONTACTMANAGER.CLICKTOACTION">clickToAction</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.customField.clickToAction" class="md-block">\n        <label translate="CONTACTMANAGER.ACTIONTYPE">actionType</label>\n        <md-select name="actionType" ng-model="vm.customField.actionType">\n          <md-option ng-value="\'voice\'">Voice</md-option>\n        </md-select>\n        <div ng-messages="customFieldForm[\'actionType\'].$error" ng-show="customFieldForm[\'actionType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED">actionType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomField" ng-click="vm.saveCustomField()" class="send-button md-accent md-raised" ng-disabled="customFieldForm.$invalid || customFieldForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomField" ng-click="vm.addNewCustomField()" class="send-button md-accent md-raised" ng-disabled="customFieldForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_CUSTOMFIELD" translate-attr-aria-label="CONTACTMANAGER.ADD_CUSTOMFIELD">\n          ADD CUSTOMFIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomField" ng-click="vm.deleteCustomField($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/view.html",'<div id="contactmanager-list" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-lists-button md-icon-button" aria-label="Go to lists" ng-click="vm.gotoLists()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_LISTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="list-image" hide-xs>\n          <img ng-src="assets/images/business/lists.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.list.id}}\n            <span ng-if="vm.list.name">{{vm.list.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.list.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.list, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="CONTACTMANAGER.GOTO_LIST"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.list, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CONTACTMANAGER.AGENTADD_LIST"></span></md-tooltip>\n        <md-icon md-font-icon="icon-eye"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveList()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (customFieldsForm.$invalid) || (voiceDispositionsForm.$invalid)" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="list-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.list.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.list.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.list.dialPrefix" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialPrefix\'].$error" ng-show="generalForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.CUSTOMFIELDS">CUSTOMFIELDS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="list-detail-form-container customfields md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ListCustomFieldsController as vm_dc" ng-init="vm_dc.init(vm.list, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedListCustomFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.CUSTOMFIELDS">CustomFields</span>\n                  <ms-search-bar on-search="vm_dc.getListCustomFields()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditListCustomField($event)" aria-label="add customField" translate translate-attr-label="CONTACTMANAGER.ADD_CUSTOMFIELD">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedListCustomFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedListCustomFields.length}} {{vm_dc.selectedListCustomFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedListCustomFields" csv-label="true" filename="lists.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedListCustomFields($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedListCustomFields" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getListCustomFields">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CONTACTMANAGER.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="alias">\n                        {{ \'CONTACTMANAGER.ALIAS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="type">\n                        {{ \'CONTACTMANAGER.TYPE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="required">\n                        {{ \'CONTACTMANAGER.REQUIRED\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="customField" md-select-id="id" ng-repeat="customField in vm_dc.listCustomFields.rows">\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{customField.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{customField.alias}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{ vm_dc.arraytype[customField.type].option }} </td>\n\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell class="required ">\n                        <md-icon md-colors="{color: {{customField.required ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{customField.required? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditListCustomField($event, customField)" translate="CONTACTMANAGER.EDIT_CUSTOMFIELD">\n                                Edit CustomField\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(customField, $event)" translate="CONTACTMANAGER.DELETE_CUSTOMFIELD">\n                                Delete CustomField\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.listCustomFields.rows.length">\n                      <td md-cell colspan="9">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CONTACTMANAGER.NO_CUSTOMFIELD_AVAILABLE">No customfield available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.listCustomFields.count}}" md-on-paginate="vm_dc.getListCustomFields" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="ListDispositionsController as vm_dc" ng-init="vm_dc.init(vm.list, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="list-detail-form-container voicedispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedListDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="CONTACTMANAGER.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add contactmanager dispositions" translate translate-attr-label="CONTACTMANAGER.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="lists.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/lists/lists.html",'<div id="lists" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.LISTS">Lists</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedLists.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedLists =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-lists-count">\n          <span>{{vm.selectedLists.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllLists()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectLists()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedLists" csv-label="true" filename="lists.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedLists($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- LIST TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedLists" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getLists">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.lists.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="list" md-select-id="id" ng-repeat="list in vm.lists.rows">\n                <td md-cell ng-if="list.userpic"><img class="avatar" alt="{{list.name}}" ng-src="api/users/{{list.id}}/avatar" /></td>\n                <td md-cell ng-if="!list.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{list.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="id ">{{list.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="name ">{{list.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="description ">{{list.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(list, $event    )" translate="CONTACTMANAGER.EDIT_LIST">\n                          Edit List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotocontactsgoto(list, $event    )" translate="CONTACTMANAGER.GOTOCONTACTS_LIST">\n                          goToContacts List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadContactManagerLists">\n\n                        <md-button ng-click="vm.exportcsvcontactsexport(list, $event    )" translate="CONTACTMANAGER.EXPORTCSVCONTACTS_LIST">\n                          exportCsvContacts List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(list, $event    )" translate="CONTACTMANAGER.AGENTADD_LIST">\n                          AgentAdd List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(list, $event    )" translate="CONTACTMANAGER.DELETE_LIST">\n                          Delete List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.lists.count}}" md-on-paginate="vm.getLists" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / LIST TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD LIST BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-list-button" ng-click="vm.createOrEditList($event)" aria-label="add list" translate translate-attr-aria-label="CONTACTMANAGER.ADD_LIST">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD LIST BUTTON --\x3e\n</div>'),e.put("app/main/apps/dashboards/views/custom/custom.html",'<div ng-if="!vm.customDashboard">\n  <p>Custom Dashboard not available...</p>\n</div>\n<div id="dashboard-custom" ng-if="vm.customDashboard" ng-cloak layout-fill>\n  <md-content>\n    <md-toolbar class="md-default md-accent filter-header">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead">{{vm.customDashboard.name}}</span>\n        <div flex></div>\n        <md-button ng-click="vm.setFilter($event)">\n          <md-tooltip md-direction="top"><span translate="DASHBOARDS.FILTERS"></span></md-tooltip>\n          <md-icon md-font-icon="icon-filter" ng-class=""></md-icon>\n        </md-button>\n        <md-button ng-if="vm.crudPermissions.canEdit" class="md-icon-button" ng-click="vm.goToEdit()" aria-label="goToEdit">\n          <md-tooltip md-direction="top"><span translate="DASHBOARDS.EDIT"></span></md-tooltip>\n          <md-icon md-font-icon="icon-table-edit"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <ms-widget-engine config="vm.customDashboard"></ms-widget-engine>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/custom/filter/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="Set Filter">\n  <form name="FilterForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content style="padding:30px;">\n      <div layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-phone"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_VOICE_QUEUES">Filter Voice Queues</span>\n          </div>\n          <md-select placeholder="Select one or more queues" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'voice\')" ng-model="vm.parent.voiceQueuesSelected" multiple aria-label="voiceQueues">\n            <md-option ng-value="voiceQueue.id" ng-repeat="voiceQueue in vm.parent.voiceQueues.rows">{{\n                            voiceQueue.name }}\n            </md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-hangouts"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_CHAT_WEBSITES">Filter Chat\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'chat\')" ng-model="vm.parent.chatWebsitesSelected" multiple aria-label="chatWebsite">\n            <md-option ng-value="chatWebsite.id" ng-repeat="chatWebsite in vm.parent.chatWebsites.rows">{{\n                            chatWebsite.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-message-text"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_SMS_ACCOUNTS">Filter Sms Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'sms\')" ng-model="vm.parent.smsAccountsSelected" multiple aria-label="smsAccount">\n            <md-option ng-value="smsAccount.id" ng-repeat="smsAccount in vm.parent.smsAccounts.rows">{{\n                            smsAccount.name }}</md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-deskphone"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_FAX_ACCOUNTS">Filter Fax Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'fax\')" ng-model="vm.parent.faxAccountsSelected" multiple aria-label="faxAccount">\n            <md-option ng-value="faxAccount.id" ng-repeat="faxAccount in vm.parent.faxAccounts.rows">{{\n                            faxAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-email"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_MAIL_ACCOUNTS">Filter Mail\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'mail\')" ng-model="vm.parent.mailAccountsSelected" multiple aria-label="mailAccount">\n            <md-option ng-value="mailAccount.id" ng-repeat="mailAccount in vm.parent.mailAccounts.rows">{{\n                            mailAccount.name }}</md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-google-earth"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_OPENCHANNEL_ACCOUNTS">Filter Openchannel\n              Websites</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'openchannel\')" ng-model="vm.parent.openchannelAccountsSelected" multiple aria-label="openchannelAccount">\n            <md-option ng-value="openchannelAccount.id" ng-repeat="openchannelAccount in vm.parent.openchannelAccounts.rows">{{\n                            openchannelAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-whatsapp"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_WHATSAPP_ACCOUNTS">Filter Whatsapp\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'whatsapp\')" ng-model="vm.parent.whatsappAccountsSelected" multiple aria-label="whatsappAccount">\n            <md-option ng-value="whatsappAccount.id" ng-repeat="whatsappAccount in vm.parent.whatsappAccounts.rows">\n              {{whatsappAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.confirm()" class="send-button md-accent md-raised" aria-label="CONFIRM" translate="DASHBOARDS.CONFIRM" translate-attr-aria-label="DASHBOARDS.CONFIRM">\n          CONFIRM\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/agent.general.html",'<div id="agent-general" layout="column">\n  <div layout="row" layout-align="start center" class="md-primary-bg">\n    <md-button class="md-raised no-margin width-50" style="border-radius: 0px" ng-class="{\'md-primary\': !vm.isActiveTab(0)}" ng-click="vm.onClickTab(0)" aria-label="home">\n      <md-tooltip md-direction="bottom" md-delay="500">Home</md-tooltip>\n      <md-icon md-font-icon="icon-home" class="icon"></md-icon>\n    </md-button>\n\n    <ms-tab-scroll style="overflow: hidden;">\n      <div layout="column" ng-repeat="(key, tab) in vm.tabs | orderByDate " ng-click="vm.onClickTab(tab.id)" ng-class="{\'grey-50-bg\': vm.isActiveTab(tab.id)}">\n        <div style="height: 34px" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="{{tab.icon}}" class="icon s16 margin-horizontal-5" ng-class="tab.color + \'-fg\'">\n          </md-icon>\n          <span class="text-truncate font-size-12" ng-class="vm.isActiveTab(tab.id) ? \'black-fg\' : \'grey-300-fg\'">\n            {{tab.title}}\n            <span ng-if="tab.badges" class="badge md-white-fg md-red-bg">{{tab.badges}}</span></span>\n          <md-button class="md-icon-button md-mini no-margin" ng-class="vm.isActiveTab(tab.id) ? \'md-primary\' : \'grey-300-fg\'" aria-label="close" ng-click="vm.closeTab(tab); $event.stopPropagation()">\n            <md-icon md-font-icon="icon-close-circle-outline" class="icon s16"></md-icon>\n          </md-button>\n        </div>\n        <div style="height: 2px" ng-class="vm.isActiveTab(tab.id) ? tab.color + \'-bg\' : \'\'"></div>\n      </div>\n    </ms-tab-scroll>\n  </div>\n  \x3c!-- home --\x3e\n  <div layout="row" class="agent-content overflow-hidden" ng-if="vm.isActiveTab(0)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.html\'" ng-controller="AgentGeneralHomeController as vm_home" ng-init="vm_home.init(vm.license, vm.setting)"></div>\n  \x3c!-- other tabs --\x3e\n  <div ng-if="tab.id !== 0 && vm.isActiveTab(tab.id)" ng-repeat="(key, tab) in vm.tabs | orderByDate " ng-switch="tab.type" flex layout="column">\n    <div ng-switch-when="contact" ng-class="{{tab.type}}" flex layout="column">\n      <div class="agent-content" flex layout="column" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/contact/agent.general.contact.html\'" ng-controller="AgentGeneralContactController as vm" ng-init="vm.init(tab,$parent.vm.license)"></div>\n    </div>\n    <div ng-switch-when="popup" ng-class="{{tab.type}}" flex layout="column">\n      <div flex layout="column" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/popup/agent.general.popup.html\'" ng-controller="AgentGeneralPopupController as vm" ng-init="vm.init(tab)"></div>\n    </div>\n    <div ng-switch-when="jscripty" ng-class="{{tab.type}}" flex layout="column">\n      <div class="agent-content" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/jscripty/agent.general.jscripty.html\'" ng-controller="AgentGeneralJscriptyController as vm" ng-init="vm.init(tab)"></div>\n    </div>\n    <div ng-switch-when="bot" ng-class="{{tab.type}}" flex layout="column">\n      <div id="interaction-app" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/bot/agent.general.bot.html\'" ng-controller="AgentGeneralBotController as vm" ng-init="vm.init(tab, $parent.vm.setting)"></div>\n    </div>\n    <div ng-switch-when="interaction" ng-class="{{tab.type}}" flex layout="column">\n      <div id="interaction-app" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html\'" ng-controller="AgentGeneralInteractionController as vm" ng-init="vm.init(tab, $parent.vm.setting)">\n      </div>\n    </div>\n    <div ng-switch-when="iframe" ng-class="{{tab.type}}" flex layout="column">\n      <div id="iframe" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/iframe/agent.general.iframe.html\'" ng-controller="AgentGeneralIframeController as vm" ng-init="vm.init(tab, $parent.vm.setting)">\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/bot/agent.general.bot.html",'\x3c!-- CONTENT CARD --\x3e\n<md-content class="content-card" layout="row" layout-fill>\n\n  <div ng-if="!vm.showInteraction" class="start-point" flex layout="column" layout-align="center center">\n    <div class="big-circle md-whiteframe-4dp">\n      <md-icon class="s128 md-accent pink-fg" md-font-icon="fas fa-robot"></md-icon>\n    </div>\n    <span class="app-title" translate="DASHBOARDS.WAITING">Waiting</span>\n    <span class="hide show-gt-md secondary-text" translate="DASHBOARDS.LOADING_INTERACTION">We are loading the\n      interaction...</span>\n  </div>\n\n  <div ng-if="vm.showInteraction" flex layout="row">\n    <md-card flex="100" class="interaction">\n      \x3c!-- TOOLBAR --\x3e\n      <md-toolbar class="interaction-toolbar">\n        <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="fas fa-robot" class="s20 pink-fg"></md-icon>\n          <div class="padding-left-10" layout="column" layout-align="center start" flex>\n            <div class="font-size-14" layout="row" layout-align="start center" layout-fill>\n              <span>#{{vm.tab.data.uniqueid}} - {{vm.tab.title}}</span>\n            </div>\n          </div>\n          <div layout="row" layout-align="end center">\n\n          </div>\n        </div>\n      </md-toolbar>\n      \x3c!-- / TOOLBAR --\x3e\n\n      \x3c!-- CONTENT --\x3e\n      <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex layout-wrap>\n        <div class="interaction-messages">\n          \x3c!-- MESSAGES --\x3e\n          <div layout="row" ng-repeat="message in vm.messages.rows" class="md-padding message-row" ng-class="vm.getMessagesAlignment(message)">\n            <img ng-if="message.direction ===\'in\'" src="assets/images/avatars/customer.png" class="avatar" />\n            <img ng-if="message.direction ===\'out\'" class="avatar" src="assets/images/avatars/robot.png">\n\n            <div class="bubble" ng-switch="message.direction">\n              <div>\n                <div ng-switch-when="in" class="time secondary-text">\n                  {{vm.tab.title}} - {{message.createdAt | date: \'medium\'}}\n                </div>\n                <div ng-switch-when="out" class="time secondary-text" layout="row" layout-align="end center">\n                  <div layout-padding>\n                    System - {{message.createdAt | date: \'medium\'}}\n                  </div>\n                  <div>\n                    <md-icon class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n                  </div>\n                </div>\n              </div>\n              <div ng-bind-html="message.body | embed:vm.emojiOptions" class="message" layout="row" layout-align="end center"></div>\n            </div>\n          </div>\n          \x3c!-- / MESSAGES --\x3e\n        </div>\n      </md-content>\n      \x3c!-- / CONTENT --\x3e\n    </md-card>\n  </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/contact/agent.general.contact.html",'<md-tabs md-selected="vm.currentTab" md-dynamic-height>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.DETAIL">Detail</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content>\n        <div layout="row" class="pr-10">\n          <div layout="row" flex="75" class="flex-scrollable only-x">\n            <md-card ng-repeat="call in vm.tab.calls track by call.uniqueid" class="call-info-card">\n              <md-progress-linear md-mode="indeterminate" ng-if="vm.checkingCallStatus"></md-progress-linear>\n              <md-card-header layout="row" layout-align="space-between">\n                <span ng-if="call.answertime" class="text-boxed indigo-100-bg ml-0">\n                  <timer start-time="call.answertime"></timer>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.ELAPSED_ANSWERED\' | translate }}\n                  </md-tooltip>\n                </span>\n                <span ng-if="call.disposedAt" class="text-boxed amber-200-bg">\n                  <timer start-time="call.disposedAt"></timer>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.ELAPSED_DISPOSED\' | translate }}\n                  </md-tooltip>\n                </span>\n                <md-button class="md-icon-button no-margin reload-button" ng-click="vm.checkCallStatus(call)" ng-disabled="vm.checkingCallStatus">\n                  <md-icon md-font-icon="icon-reload" class="s22"></md-icon>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.RELOAD\' | translate }}\n                  </md-tooltip>\n                </md-button>\n              </md-card-header>\n              <md-divider></md-divider>\n              <md-card-content>\n                <div layout="column" layout-align="space-between start" class="word-break-all mr-16">\n                  <div layout="row" layout-align="start center">\n                    <md-icon md-font-icon="{{ call.routeId ? \'icon-phone-outgoing\' : \'icon-phone-incoming\'}}" class="s20 mr-5">\n                    </md-icon>\n                    <span class="h2" privacy ng-cloak>{{ call.routeId ? call.destcalleridnum : call.calleridnum }}</span>\n                  </div>\n\n                  <div class="subtitle h4 secondary-text" ng-if="call.calleridname && call.calleridname != \'<unknown>\' && !call.routeId">\n                    <md-icon md-font-icon="icon-account" class="s20"></md-icon>\n                    Name: <span privacy ng-cloak>{{ call.calleridname }}</span>\n                    <div ng-if="(vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum}).length>0">\n                      <span ng-style="{\'color\':(vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].color} ">\n                        {{ (vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].description }} -\n                        {{ (vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].type }}\n                      </span>\n                    </div>\n                  </div>\n\n                  <div class="text h4 pt-8" ng-if="call.queue">\n                    <md-icon md-font-icon="icon-stackoverflow" class="s20"></md-icon>\n                    Queue: {{call.queue}}\n                  </div>\n                  <div class="text h4 pt-8" ng-if="call.variables.extravar">\n                    <md-icon md-font-icon="icon-minus" class="s20"></md-icon>\n                    Extra: {{call.variables.extravar}}\n                  </div>\n                </div>\n                <div layout="row" layout-align="center end" class="mt-8">\n                  <md-button ng-if="call.disposedAt" type="submit" ng-click="vm.disposeCall($event, call)" class="send-button md-accent md-raised mr-0 mv-0">\n                    {{ \'DASHBOARDS.DISPOSE\' | translate}}\n                  </md-button>\n                </div>\n              </md-card-content>\n            </md-card>\n          </div>\n          <div flex="25" layout="row" layout-md="column" layout-sm="column" layout-align="end center" layout-align-md="center center">\n            <md-button type="submit" ng-click="vm.mergeContact($event)" class="send-button md-raised md-accent ng-scope" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="merge">\n              <md-tooltip md-direction="top"><span translate="DASHBOARDS.MERGE"></span></md-tooltip>\n              <md-icon md-font-icon="icon-source-fork"></md-icon>\n            </md-button>\n            <md-button type="submit" ng-click="vm.duplicateContact($event)" class="send-button md-raised md-accent ng-scope" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="duplicate">\n              <md-tooltip md-direction="top"><span translate="DASHBOARDS.DUPLICATE"></span></md-tooltip>\n              <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n            </md-button>\n            <md-button type="submit" ng-click="vm.addNewContact($event)" class="send-button md-accent md-raised" ng-if="vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="add">\n              {{ \'DASHBOARDS.ADD\'| translate }}\n            </md-button>\n            <md-button type="submit" ng-click="vm.saveContact($event)" class="send-button md-accent md-raised" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="save">\n              {{ \'DASHBOARDS.SAVE\' | translate }}\n            </md-button>\n          </div>\n        </div>\n        <div layout="row">\n          <div layout="column" flex="75">\n            <md-card layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.PERSONAL_INFO">\n                PERSONAL_INFO</div>\n              <div class="subtitle secondary-text">\n                <span translate="CONTACTMANAGER.CREATED_AT"></span>\n                <span>{{vm.contact.createdAt | date:\'medium\'}}</span>\n              </div>\n\n              <form name="vm.detailForm" novalidate>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.FIRSTNAME">First Name</label>\n                      <md-icon md-font-icon="icon-account" class="firstname"></md-icon>\n                      <input type="text" name="firstName" ng-model="vm.contact.firstName" class="text-truncate" required privacy ng-cloak>\n                      <div ng-messages="vm.detailForm.firstName.$error" ng-show="vm.detailForm.firstName.$touched" role="alert">\n                        <div ng-message="required">\n                          <span translate="DASHBOARDS.ERRORS.FIRSTNAME_REQUIRED">First name\n                            field is required</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.jscripty" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="JSCRIPTY PROJECTS" ng-click="$mdOpenMenu($event); vm.getJscriptyProjects();" aria-label="jscripty">\n                          <md-icon md-font-icon="icon-script"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingJscriptyProjects">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingJscriptyProjects && vm.jscriptyProjects.count > 0" ng-repeat="project in vm.jscriptyProjects.rows">\n                            <md-button ng-click="vm.addJscriptyTab(project, $event)">\n                              <md-icon md-font-icon="icon-script"></md-icon>\n                              {{project.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingJscriptyProjects && (!vm.jscriptyProjects || vm.jscriptyProjects.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_JSCRIPTY_PROJECTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-script"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.LASTNAME">Last Name</label>\n                    <input type="text" name="lastName" ng-model="vm.contact.lastName" class="text-truncate" privacy ng-cloak>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.PHONE">Phone</label>\n                      <md-icon md-font-icon="icon-phone"></md-icon>\n                      <input type="text" name="phone" ng-model="vm.contact.phone" class="text-truncate" privacy ng-cloak>\n                      <div class="hint"><span ng-show="!vm.user.phoneBarRemoteControl || !vm.contact.phone" translate="CONTACTMANAGER.HELP.PHONEBAR_API"></span></div>\n                    </md-input-container>\n                    <div>\n                      \x3c!-- click to call directive --\x3e\n                      <ms-click-to-call target="vm.contact.phone" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                      \x3c!--  / click to call directive --\x3e\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.MOBILE">Mobile</label>\n                      <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n                      <input type="text" name="mobile" ng-model="vm.contact.mobile" class="text-truncate" privacy ng-cloak>\n                      <div class="hint"><span ng-show="!vm.user.phoneBarRemoteControl || !vm.contact.mobile" translate="CONTACTMANAGER.HELP.PHONEBAR_API"></span></div>\n                    </md-input-container>\n                    <div>\n                      \x3c!-- click to call directive --\x3e\n                      <ms-click-to-call target="vm.contact.mobile" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                      \x3c!--  / click to call directive --\x3e\n                    </div>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.messaging || !vm.hasPermission(107) || !vm.contact.mobile" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW SMS" ng-click="$mdOpenMenu($event); vm.getAccounts(\'sms\')" aria-label="sms">\n                          <md-icon md-font-icon="icon-message-text"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.smsAccounts.count > 0" ng-repeat="account in vm.smsAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Sms\', account, vm.contact.mobile)">\n                              <md-icon md-font-icon="icon-message-text"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.smsAccounts || vm.smsAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_SMS_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-message-text"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.whatsapp || !vm.hasPermission(114) || !vm.contact.mobile" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW WHATSAPP" ng-click="$mdOpenMenu($event); vm.getAccounts(\'whatsapp\')" aria-label="whatsapp">\n                          <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.whatsappAccounts.count > 0" ng-repeat="account in vm.whatsappAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Whatsapp\', account, vm.contact.mobile)">\n                              <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.whatsappAccounts || vm.whatsappAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_WHATSAPP_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.EMAIL">Email</label>\n                      <md-icon md-font-icon="icon-email" class="email"></md-icon>\n                      <input type="email" name="email" ng-model="vm.contact.email" class="text-truncate" privacy ng-cloak>\n                      <div ng-messages="vm.detailForm.firstName.$error" ng-show="vm.detailForm.firstName.$touched" role="alert">\n                        <div ng-message="email">\n                          <span translate="DASHBOARDS.ERRORS.EMAIL_MUST_VALID">Email must be a\n                            valid e-mail address</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.mail || !vm.hasPermission(106) || !vm.contact.email" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW EMAIL" ng-click="$mdOpenMenu($event); vm.getAccounts(\'mail\')" aria-label="email">\n                          <md-icon md-font-icon="icon-email"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.mailAccounts.count > 0" ng-repeat="account in vm.mailAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Mail\', account, vm.contact.email)">\n                              <md-icon md-font-icon="icon-email"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.mailAccounts || vm.mailAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_MAIL_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-email"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.FAX">Fax</label>\n                      <md-icon md-font-icon="icon-deskphone"></md-icon>\n                      <input type="text" name="fax" ng-model="vm.contact.fax" privacy ng-cloak>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.fax || !vm.hasPermission(109) || !vm.contact.fax" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW FAX" ng-click="$mdOpenMenu($event); vm.getAccounts(\'fax\')" aria-label="fax">\n                          <md-icon md-font-icon="icon-deskphone"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.faxAccounts.count > 0" ng-repeat="account in vm.faxAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Fax\', account, vm.contact.fax)">\n                              <md-icon md-font-icon="icon-deskphone"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.faxAccounts || vm.faxAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_FAX_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-deskphone"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n                      <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n                        {{ $chip.phone }}\n                      </md-chip-template>\n                    </md-chips>\n                  </md-input-container>\n                  <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n                    <div class="pb-16" layout="row" layout-align="start center">\n                      <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n                    </div>\n                    <form name="additionalPhonesForm" novalidate>\n                      <div ng-repeat="additionalPhone in vm.additionalItems" layout="column">\n                        <md-input-container class="md-block">\n                          <label>{{$index}} - {{additionalPhone.phone}}</label>\n                          <md-select ng-model="vm.additionalItemTypes[$index]">\n                            <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                          </md-select>\n                        </md-input-container>\n                        <md-input-container class="md-block">\n                          <input ng-model="additionalPhone.description" ng-cloak>\n                        </md-input-container>\n                      </div>\n                    </form>\n                  </div>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.DATE_OF_BIRTH">Date of Birth</label>\n                    <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth"></mdp-date-picker>\n                  </md-input-container>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n                    <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.COMPANY">Company</label>\n                    <md-icon md-font-icon="icon-domain" class="email"></md-icon>\n                    <md-select name="company" ng-model="vm.contact.CompanyId">\n                      <md-option ng-value="company.id" ng-repeat="company in vm.tab.companies.rows">{{company.name}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="DASHBOARDS.NONE">None</em>\n                      </md-option>\n                    </md-select>\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.TAG">TAG</label>\n                    <md-icon md-font-icon="icon-tag"></md-icon>\n                    <md-select ng-model="vm.tab.Tags" multiple>\n                      <md-option ng-value="tag.id" ng-repeat="tag in vm.tab.tags.rows">\n                        {{tag.name}}</md-option>\n                    </md-select>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.COUNTRY">Country</label>\n                    <md-icon md-font-icon="icon-home" class="country"></md-icon>\n                    <input type="text" name="country" ng-model="vm.contact.country" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.CITY">City</label>\n                    <input type="text" name="city" ng-model="vm.contact.city">\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.STREET">Street</label>\n                    <input type="text" name="street" ng-model="vm.contact.street">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.POSTALCODE">Postal Code</label>\n                    <input type="text" name="postalCode" ng-model="vm.contact.postalCode">\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate translate-attr-placeholder="DASHBOARDS.NOTES">Notes</label>\n                    <md-icon md-font-icon="icon-note"></md-icon>\n                    <textarea ng-model="vm.contact.description" type="text" max-rows="4"></textarea>\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n            <md-card layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.SOCIAL">Social</div>\n              <form name="vm.socialForm" novalidate>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Facebook</label>\n                    <md-icon md-font-icon="icon-facebook" class="facebook"></md-icon>\n                    <input type="text" name="facebook" ng-model="vm.contact.facebook" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Twitter</label>\n                    <md-icon md-font-icon="icon-twitter" class="twitter"></md-icon>\n                    <input type="text" name="twitter" ng-model="vm.contact.twitter" class="text-truncate">\n                  </md-input-container>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Line</label>\n                    <md-icon md-font-icon="fab fa-line"></md-icon>\n                    <input type="text" name="line" ng-model="vm.contact.line" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Viber</label>\n                    <md-icon md-font-icon="fab fa-viber"></md-icon>\n                    <input type="text" name="viber" ng-model="vm.contact.viber" class="text-truncate">\n                  </md-input-container>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>WeChat</label>\n                    <md-icon md-font-icon="fab fa-weixin"></md-icon>\n                    <input type="text" name="wechat" ng-model="vm.contact.wechat" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Telegram</label>\n                    <md-icon md-font-icon="icon-telegram"></md-icon>\n                    <input type="text" name="telegram" ng-model="vm.contact.telegram" class="text-truncate">\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n          </div>\n          <div flex="25" layout="column" layout-padding>\n            <md-card flex="100" layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.CUSTOM_FIELDS">CUSTOM\n                FIELDS</div>\n              <form name="vm.customFieldsForm" novalidate>\n\n                \x3c!-- START INPUT LIST --\x3e\n                <md-input-container class="md-block">\n                  <label translate translate-attr-placeholder="DASHBOARDS.LIST">List</label>\n                  <md-select name="list" ng-disabled="!vm.newContact" ng-model="vm.contact.ListId" ng-change="vm.getCustomFields(vm.contact.ListId)" required>\n                    <md-optgroup label="Lists">\n                      <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">#{{list.id}} - {{list.name}}\n                      </md-option>\n                    </md-optgroup>\n                  </md-select>\n                </md-input-container>\n                \x3c!-- END INPUT LIST --\x3e\n\n                <div ng-repeat="customField in vm.tab.customFields.rows" ng-switch="customField.type">\n                  <md-input-container class="md-block" ng-switch-when="datetime">\n                    <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                    <div ng-init="vm.contact[\'cf_\' + customField.id] = vm.getDateFromString(vm.contact[\'cf_\' + customField.id])">\n                      <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-date-picker>\n                      <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-time-picker>\n                    </div>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="select">\n                    <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                    <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n                      <md-option ng-repeat="value in customField.values" ng-value="value.value">\n                        {{value.value}}</md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em>\n                      </md-option>\n                    </md-select>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="switch">\n                    <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n                      {{customField.alias}}<span ng-if="customField.required">*</span>\n                    </md-switch>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-default>\n                    <div layout-gt-sm="row" class="layout-gt-sm-row"></div>\n                    <div layout="row" flex>\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                        <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n                      </md-input-container>\n                      <ms-click-to-call ng-if="customField.clickToAction && customField.actionType === \'voice\'" target="vm.contact[\'cf_\' + customField.id]" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                    </div>\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n          </div>\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CUSTOMER_JOURNEY">Customer Journey</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding" id="journey-content">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n</md-tabs>'),e.put("app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",'<md-dialog class="agent-dialog" aria-label="agent dispose">\n  <form name="disposition" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" ng-if="!vm.call.mandatoryDisposition">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div ng-if="!vm.isReschedule">\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n          <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n          <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n            <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n            <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition" ng-change="vm.onDispositionChange(\'third\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.NOTE">Note</label>\n          <textarea ng-model="vm.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n        </md-input-container>\n        <md-input-container class="md-block" ng-if="vm.availableCalls === 1">\n          <md-switch ng-model="vm.autoClose" aria-label="Auto Close">\n            <span translate="DASHBOARDS.AUTOCLOSE">Automatically close contact tab after disposal</span>\n          </md-switch>\n        </md-input-container>\n      </div>\n      <div ng-if="vm.isReschedule">\n        <div layout="row">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="date" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-change="vm.recalcTZTime()" mdp-min-date="vm.hopper.minDate" ng-model="vm.hopper.dateTime">\n              <div ng-messages="disposition.date.$error" ng-show="disposition.date.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="DASHBOARDS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="DASHBOARDS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="time" mdp-placeholder="Time" ng-change="vm.recalcTZTime()" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.dateTime">\n              <div ng-messages="disposition.time.$error" ng-show="disposition.time.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="DASHBOARDS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="DASHBOARDS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </div>\n        <div layout="row">\n          <div flex class="md-block">\n            <md-input-container class="md-block" flex-gt-sm="">\n              <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n              <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n            </md-input-container>\n          </div>\n          <div flex class="md-block">\n            <md-input-container class="md-block">\n              <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n              <input type="text" readonly value="{{vm.hopper.scheduledAt}}">\n            </md-input-container>\n          </div>\n        </div>\n        <div ng-if="(!vm.dialer || (vm.dialer && vm.recallme && vm.user.selectRecallMeCampaign)) && vm.queueCampaigns.rows.length > 0" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.CAMPAIGN">Campaign</label>\n            <md-select name="queueCampaign" ng-model="vm.queueCampaign" required>\n              <md-option ng-value="queueCampaign" ng-repeat="queueCampaign in vm.queueCampaigns.rows">\n                <md-icon md-font-icon="icon-checkbox-blank-circle" ng-class="{\'green-fg\': queueCampaign.dialActive}" aria-label="Status">\n                </md-icon>\n                {{ queueCampaign.name }}\n              </md-option>\n            </md-select>\n            <div ng-messages="disposition.queueCampaign.$error" ng-show="disposition.queueCampaign.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.CAMPAIGN_REQUIRED">Campaign field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-if="!vm.isReschedule" layout="row">\n      <md-button ng-disabled="disposition.$invalid || disposition.$pristine" class="send-button md-raised md-accent" ng-click="vm.saveDisposition()" ms-dialog-spinner>\n        {{(vm.selectedDisposition.name ? \'DASHBOARDS.DISPOSE\' : \'DASHBOARDS.SAVE\') | translate}}\n      </md-button>\n      <md-button class="send-button md-raised md-primary" translate="DASHBOARDS.RESCHEDULE" ng-click="vm.saveDisposition(\'reschedule\')">\n        Reschedule\n      </md-button>\n      <md-button class="send-button md-accent md-raised" translate="DASHBOARDS.RECALLME" ng-click="vm.saveDisposition(\'recallme\')">\n        Recall Me\n      </md-button>\n      <span flex></span>\n      <md-button ng-if="vm.hasBlackLists" class="md-raised md-warn" translate="DASHBOARDS.BLACKLIST" ng-click="vm.saveDisposition(\'blacklist\')">\n        Blacklist\n      </md-button>\n    </md-dialog-actions>\n    <md-dialog-actions ng-if="vm.isReschedule" layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveReschedule()" class="send-button md-accent md-raised" ng-disabled="disposition.$invalid || disposition.$pristine || vm.disable" aria-label="SAVE" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/contact/reschedule/dialog.html",'<md-dialog class="agent-dialog" aria-label="New Agent">\n  <form name="dateTime" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex class="md-block">\n          <mdp-date-picker mdp-open-on-click required name="date" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" mdp-min-date="vm.hopper.minDate" ng-model="vm.hopper.dateTime">\n            <div ng-messages="dateTime.date.$error" ng-show="dateTime.date.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.DATE_REQUIRED">Date is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="DASHBOARDS.ERRORS.DATE_INVALID">Date is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n\n        <div flex class="md-block">\n          <mdp-time-picker mdp-open-on-click required name="time" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.dateTime">\n            <div ng-messages="dateTime.time.$error" ng-show="dateTime.time.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.TIME_REQUIRED">Time is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="DASHBOARDS.ERRORS.TIME_INVALID">Time is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-disabled="vm.disable" ng-click="vm.saveDialog()" class="send-button md-accent md-raised" ng-disabled="dateTime.$invalid || dateTime.$pristine" aria-label="SAVE" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/contact/selection/dialog.html",'<md-dialog ng-init="vm.onInit()" class="contact-trigger-dialog" aria-label="Select contact" ng-cloak>\n  <md-toolbar class="red-bg">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ \'DASHBOARDS.SELECT_CONTACT\' | translate }}</span>\n    </div>\n  </md-toolbar>\n  <md-dialog-content class="h-400 pv-16">\n    <div layout="row" class="p-10">\n      <span class="font-size-16">{{ \'DASHBOARDS.MULTIPLE_CONTACTS_FOUND\' | translate }}<strong>&nbsp;{{ vm.callNumber }}</strong>.</span>\n      <span class="font-size-16">&nbsp;{{ \'DASHBOARDS.WHICH_ONE_TO_USE\' | translate }}</span>\n    </div>\n    <md-grid-list md-cols-xs="1" md-cols="2" md-row-height="fit" ng-class="vm.paginatedContacts[vm.page - 1].length > 2 ? \'two-rows-layout\' : \'one-row-layout\'" flex>\n      <md-grid-tile ng-repeat="contact in vm.paginatedContacts[vm.page - 1]" md-rowspan="1">\n        <md-card layout="column" class="contact-info" no-padding no-margin ng-click="vm.selectedContact = contact;" ng-class="{ \'light-blue-50-bg\' : vm.selectedContact && vm.selectedContact.id === contact.id }" flex>\n          <md-card-title class="pt-16">\n            <md-card-title-text layout-align="center start">\n              <span class="font-size-16 text-bold">#{{ contact.id }} -\n                <span privacy ng-cloak>{{ contact.firstName }} {{ contact.lastName }}</span>\n              </span>\n              <em class="font-size-12">{{ \'DASHBOARDS.LAST_UPDATED\' | translate }}: {{ contact.updatedAt }}</em>\n              <span class="font-size-12">{{ \'DASHBOARDS.LIST\' | translate }}: {{ vm.lists[contact.ListId] }}</span>\n            </md-card-title-text>\n            <md-button class="md-icon-button no-margin" aria-label="Selected">\n              <md-icon md-font-icon="{{ vm.selectedContact && vm.selectedContact.id === contact.id ? \'icon-checkbox-marked-circle\' : \'icon-checkbox-blank-circle-outline\' }}" ng-class="{ \'green-fg\': vm.selectedContact && vm.selectedContact.id === contact.id }"></md-icon>\n            </md-button>\n          </md-card-title>\n          <md-divider></md-divider>\n          <md-card-content layout="row" layout-align="center start" class="p-10">\n            <span class="font-size-16">{{ \'DASHBOARDS.MATCHING_FIELD\' | translate }}:\n              <strong privacy ng-cloak>{{ contact.matchingField }}</strong>\n            </span>\n          </md-card-content>\n        </md-card>\n      </md-grid-tile>\n    </md-grid-list>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <div ng-if="vm.paginatedContacts.length > 1" layout="row" layout-align="center center" flex>\n      <md-button ng-click="vm.page = vm.page - 1;" class="md-icon-button no-margin" ng-class="{ \'hidden\': vm.page <= 1 }" aria-label="Previous page">\n        <md-icon md-font-icon="icon-chevron-double-left"></md-icon>\n      </md-button>\n      <span>{{ \'DASHBOARDS.PAGE\' | translate }} {{ vm.page }} {{ \'DASHBOARDS.OF\' | translate }}\n        {{ vm.paginatedContacts.length }}</span>\n      <md-button ng-click="vm.page = vm.page + 1;" class="md-icon-button no-margin" ng-class="{ \'hidden\': !vm.paginatedContacts[vm.page] }" aria-label="Next page">\n        <md-icon md-font-icon="icon-chevron-double-right"></md-icon>\n      </md-button>\n    </div>\n    <md-button ng-click="vm.selectContact()" class="select-button md-accent md-raised" ng-disabled="!vm.selectedContact" aria-label="Select" translate="DASHBOARDS.SELECT" translate-attr-aria-label="DASHBOARDS.SELECT">\n      SELECT\n    </md-button>\n  </md-dialog-actions>\n</md-dialog>vc'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/agent.general.abandoned.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-selected="vm.selectedTab" md-dynamic-height md-border-bottom>\n      <md-tab ng-if="vm_home.hasPermission(110)" label="{{\'DASHBOARDS.VOICE\' | translate}}">\n        <md-content ng-if="vm.selectedTab === 0" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html\'" ng-controller="AgentHomeAbandonedVoiceController as vm_voice">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="{{\'DASHBOARDS.MOTION_BULL\' | translate}}">\n        <md-content ng-if="vm.selectedTab === 1" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/bull/agent.general.abandoned.bull.html\'" ng-controller="AgentHomeAbandonedBullController as vm_bull">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/bull/agent.general.abandoned.bull.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header blue-bg" ng-class="{\'h-128\' : vm_bull.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n      <ms-search-bar on-search="vm_bull.getAbandonedCalls()" query="vm_bull.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm_bull.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm_bull.quickFilters" query="vm_bull.query" search="vm_bull.getAbandonedCalls()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm_bull.refresh && vm_bull.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip ng-if="vm_bull.showTooltip" md-visible="vm_bull.showTooltip">\n          {{\'DASHBOARDS.CLICKRELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm_bull.promise">\n      <thead md-head md-order="vm_bull.query.sort" md-on-reorder="vm_bull.getAbandonedCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n          <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n          <th md-column md-order-by="queuecallerexitAt">{{\'DASHBOARDS.QUEUECALLEREXITAT\' | translate}}</th>\n          <th md-column md-order-by="queuecallerexitreason">{{\'DASHBOARDS.QUEUECALLEREXITREASON\' | translate}}\n          </th>\n          <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="secondDisposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="thirdDisposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.RESERVED\' | translate}}</th>\n          <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm_bull.abandonedCalls.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="abandonedCall in vm_bull.abandonedCalls.rows">\n          <td md-cell class="id">{{abandonedCall.id}}</td>\n          <td md-cell class="firstName" privacy ng-cloak>{{abandonedCall.calleridname}}</td>\n          <td md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="abandonedCall.calleridnum" license="vm_home.license" disabled="abandonedCall.lastAssignedTo !== vm_bull.currentUser.name">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="list">{{vm_bull.queuesMap[abandonedCall.queue]}}</td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : (abandonedCall.queuecallerexitAt | formatdate) }}\n          </td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerexitAt ? (abandonedCall.queuecallerexitAt | formatdate) : undefined }}\n          </td>\n          <td md-cell class="list">{{abandonedCall.queuecallerexitreason}}</td>\n          <td md-cell class="list">{{ abandonedCall.disposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.secondDisposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.thirdDisposition }}</td>\n          <td md-cell class="actions">\n            <md-switch no-margin ng-if="abandonedCall.lastAssignedTo === vm_bull.currentUser.name || !abandonedCall.lastAssignedTo" ng-disabled="vm_bull.disable[abandonedCall.id]" ng-model="abandonedCall.assigned" aria-label="reserved" ng-change="vm_bull.reserved(abandonedCall)">\n            </md-switch>\n          </td>\n          <td md-cell class="list">{{abandonedCall.lastAssignedTo}}</td>\n          <td md-cell class="actions">\n            <md-menu ng-if="abandonedCall.lastAssignedTo === vm_bull.currentUser.name">\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="1">\n                <md-menu-item>\n                  <md-button ng-click="vm_bull.dispose(abandonedCall)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm_bull.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_bull.query.page" md-total="{{vm_bull.abandonedCalls.count}}" md-on-paginate="vm_bull.getAbandonedCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",'<md-dialog class="agent-dialog" aria-label="agent dispose">\n  <form name="disposition" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n          <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\',false)" required>\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n          <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n            <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\',false)">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n            <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition" ng-change="vm.onDispositionChange(\'third\',false)">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.NOTE">Note</label>\n          <textarea ng-model="vm.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n        </md-input-container>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button ng-disabled="disposition.$invalid || disposition.$pristine" class="send-button md-raised md-accent" ng-click="vm.saveDisposition()">\n'+"          {{(vm.selectedDisposition.name ? 'DASHBOARDS.DISPOSE' : 'DASHBOARDS.SAVE') | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>"),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header blue-bg" ng-class="{\'h-128\' : vm_voice.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n      <ms-search-bar on-search="vm_voice.getAbandonedCalls()" query="vm_voice.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm_voice.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm_voice.quickFilters" query="vm_voice.query" search="vm_voice.getAbandonedCalls()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm_voice.refresh && vm_voice.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip ng-if="vm_voice.showTooltip" md-visible="vm_voice.showTooltip">\n          {{\'DASHBOARDS.CLICKRELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm_voice.promise">\n      <thead md-head md-order="vm_voice.query.sort" md-on-reorder="vm_voice.getAbandonedCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n          <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n          <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="secondDisposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="thirdDisposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.RESERVED\' | translate}}</th>\n          <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm_voice.abandonedCalls.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="abandonedCall in vm_voice.abandonedCalls.rows">\n          <td md-cell class="id">{{abandonedCall.id}}</td>\n          <td md-cell class="firstName" privacy ng-cloak>{{abandonedCall.calleridname}}</td>\n          <td md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="abandonedCall.calleridnum" license="vm_home.license" disabled="abandonedCall.lastAssignedTo !== vm_voice.currentUser.name">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="list">{{vm_voice.queuesMap[abandonedCall.queue]}}</td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : (abandonedCall.queuecallerexitAt | formatdate) }}\n          </td>\n          <td md-cell class="list">{{ abandonedCall.disposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.secondDisposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.thirdDisposition }}</td>\n          <td md-cell class="actions">\n            <md-switch no-margin ng-if="abandonedCall.lastAssignedTo === vm_voice.currentUser.name || !abandonedCall.lastAssignedTo" ng-disabled="vm_voice.disable[abandonedCall.id]" ng-model="abandonedCall.assigned" aria-label="reserved" ng-change="vm_voice.reserved(abandonedCall)">\n            </md-switch>\n          </td>\n          <td md-cell class="list">{{abandonedCall.lastAssignedTo}}</td>\n          <td md-cell class="actions">\n            <md-menu ng-if="abandonedCall.lastAssignedTo === vm_voice.currentUser.name">\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="1">\n                <md-menu-item>\n                  <md-button ng-click="vm_voice.dispose(abandonedCall)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm_voice.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_voice.query.page" md-total="{{vm_voice.abandonedCalls.count}}" md-on-paginate="vm_voice.getAbandonedCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/agent.general.home.html",'<div layout="column" layout-align="start center" class="agent-general-home-navbar md-primary-bg width-50">\n  <div ng-repeat="node in vm_home.navigation">\n    <div ng-repeat="home in node.children">\n      <md-button ng-repeat="button in home.children  | orderBy:\'weight\'" ng-if="!button.hidden()" class="md-raised width-50 height-50 no-margin" style="border-radius: 0px" aria-label="{{button.state}}" ng-click="vm_home.changeSidebarTab(button)" ng-class="{\'md-primary\': vm_home.sidebar != button.state}">\n        <md-tooltip md-direction="right" md-delay="500"><span translate="{{button.translate}}"></span>\n        </md-tooltip>\n        <md-icon md-font-icon="{{button.icon}}" ng-class="button.iconClass"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>\n<div class="agent-general-home-sections" layout="column" flex>\n  <div layout="column" flex>\n    <div ng-switch="vm_home.sidebar" style="overflow-y: auto; overflow-x: hidden" flex>\n      <div ng-switch-when="agentPresence" class="home-agent-presence">\n        <div ng-if="vm_home.hasPermission(115)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/agent.general.presence.html\'" ng-controller="AgentHomePresenceController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(115)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="contacts" class="home-contacts">\n        <div ng-if="vm_home.hasPermission(102) && vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/contacts/agent.general.contacts.html\'" ng-controller="AgentHomeContactsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(102) || !vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="mycontacts" class="home-mycontacts">\n        <div ng-if="vm_home.hasPermission(103) && vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/mycontacts/agent.general.mycontacts.html\'" ng-controller="AgentHomeMyContactsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(103) || !vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="scheduled" class="home-scheduled">\n        <div ng-if="vm_home.hasPermission(113) && vm_home.license.dialer" ng-include="\'app/main/apps/dashboards/views/general/agent/home/scheduled/agent.general.scheduled.html\'" ng-controller="AgentHomeScheduledCallsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(113) || !vm_home.license.dialer" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="voice" class="home-voice">\n        <div ng-if="vm_home.hasPermission(110) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/voice/agent.general.voice.html\'" ng-controller="AgentHomeVoiceController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(110) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="abandoned" class="home-abandoned">\n        <div ng-if="vm_home.hasPermission(111) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/agent.general.abandoned.html\'" ng-controller="AgentHomeAbandonedController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(111) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="recordings" class="home-recordings">\n        <div ng-if="vm_home.hasPermission(104) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/recordings/agent.general.recordings.html\'" ng-controller="AgentHomeRecordingsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(104) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="chat" class="home-chat">\n        <div ng-if="vm_home.hasPermission(105) && vm_home.license.chat" ng-include="\'app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html\'" ng-controller="AgentHomeChatController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(105) || !vm_home.license.chat" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="mail" class="home-mail">\n        <div ng-if="vm_home.hasPermission(106) && vm_home.license.mail" ng-include="\'app/main/apps/dashboards/views/general/agent/home/mail/agent.general.mail.html\'" ng-controller="AgentHomeMailController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(106) || !vm_home.license.mail" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="sms" class="home-sms">\n        <div ng-if="vm_home.hasPermission(107) && vm_home.license.messaging" ng-include="\'app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html\'" ng-controller="AgentHomeSmsController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(107) || !vm_home.license.messaging" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="openchannel" class="home-openchannel">\n        <div ng-if="vm_home.hasPermission(108) && vm_home.license.openchannel" ng-include="\'app/main/apps/dashboards/views/general/agent/home/openchannel/agent.general.openchannel.html\'" ng-controller="AgentHomeOpenchannelController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(108) || !vm_home.license.openchannel" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="fax" class="home-fax">\n        <div ng-if="vm_home.hasPermission(109) && vm_home.license.fax" ng-include="\'app/main/apps/dashboards/views/general/agent/home/fax/agent.general.fax.html\'" ng-controller="AgentHomeFaxController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(109) || !vm_home.license.fax" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="whatsapp" class="home-whatsapp">\n        <div ng-if="vm_home.hasPermission(114) && vm_home.license.whatsapp" ng-include="\'app/main/apps/dashboards/views/general/agent/home/whatsapp/agent.general.whatsapp.html\'" ng-controller="AgentHomeWhatsappController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(114) || !vm_home.license.whatsapp" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="plugin" class="home-plugin" layout-fill>\n        <div ng-if="vm_home.hasPermission(vm_home.pluginId)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/plugins/agent.general.plugins.html\'" ng-controller="AgentHomePluginsController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting, vm_home.plugin)" layout-fill></div>\n        <div ng-if="!vm_home.hasPermission(vm_home.pluginId)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-default class="home-default">\n        <div ng-if="vm_home.hasPermission(101)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/agent.general.dashboard.html\'" ng-controller=" AgentHomeDashboardController  as vm"></div>\n        <div ng-if="!vm_home.hasPermission(101)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n    </div>\n  </div>\n  <div ng-if="(vm_home.draftManager.drafts | json) != \'{}\'" layout="column" class="draft-manager-bar">\n    <ms-tab-scroll>\n      <div layout="column" ng-repeat="(key, draft) in vm_home.draftManager.drafts" class="grey-50-bg" ng-click="vm_home.draftManager.open(draft.id)">\n        <div class="draft-manager-tab" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="icon-pencil" class="icon s16 margin-horizontal-5 black-fg"></md-icon>\n          <span class="text-truncate font-size-12 black-fg">{{draft.title}}</span>\n          <md-button class="md-icon-button md-mini no-margin md-primary" aria-label="close" ng-click="vm_home.draftManager.remove(draft.id)">\n            <md-icon md-font-icon="icon-close-circle-outline" class="icon s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </ms-tab-scroll>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html",'<md-content layout="row" layout-align="space-around center" flex layout-padding layout-wrap>\n  <div layout="column" layout-align="space-around center" flex="50">\n    <span class="font-size-40 text-center">{{ \'DASHBOARDS.WELCOME_TO_MOTION\' | translate }}!</span>\n    <span class="font-size-30 text-center" translate="DASHBOARDS.WELCOME_MESSAGE">Use the left sidebar to navigate through available sections.</span>\n  </div>\n\n  <div layout="column" flex="50">\n    <img src="assets/images/avatars/permissions.png" alt="permissions">\n  </div>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.CHAT_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getChatInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getChatInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getChatInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.WEBSITE\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.chatInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.chatInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="chatAccount">\n            {{ vm.getChatWebsiteLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showChatInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Chat\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadChatInteraction($event, interaction, true)" translate="CHAT.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadChatInteraction($event, interaction)" translate="CHAT.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatInteractions.count}}" md-on-paginate="vm.getChatInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/contacts/agent.general.contacts.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.CONTACTS">Contacts</span>\n      <ms-search-bar on-search="vm.getContacts()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getContacts()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" ng-click="vm.refreshContacts($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button ng-if="vm.lists.rows && vm.lists.rows.length" class="md-icon-button create-new" ng-click="vm.openContact()" aria-label="Add contact" translate translate-attr-label="DASHBOARDS.ADD_CONTACT">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="firstName">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="mobile">{{\'DASHBOARDS.MOBILE\' | translate}}</th>\n          <th md-column md-order-by="fax">{{\'DASHBOARDS.FAX\' | translate}}</th>\n          <th md-column md-order-by="email">{{\'DASHBOARDS.EMAIL\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.CREATEDAT\' | translate}}</th>\n          <th md-column md-order-by="ListId">{{\'DASHBOARDS.LIST\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.contacts.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="contact in vm.contacts.rows">\n          <td ng-click="vm.openContact(contact.id)" md-cell class="id">{{contact.id}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="firstName" privacy ng-cloak>{{contact.firstName}}\n            {{contact.lastName}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.phone" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="mobile">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.mobile" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="fax" privacy ng-cloak>{{contact.fax}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="email" privacy ng-cloak>{{contact.email}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="createdAt">{{contact.createdAt | formatdate}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="list">{{vm.listsMap[contact.ListId].name}}\n          <td md-cell class="tag">\n            <div ng-if="contact.Tags.length">\n              <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                <span class="text-truncate">{{contact.Tags[0].name}}</span>\n              </div>\n              <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag"></md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.openContact(contact.id)" translate="DASHBOARDS.EDIT">\n                    Edit Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.mergeContact($event, contact)" translate="DASHBOARDS.MERGE">\n                    Merge Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.duplicateContact($event, contact)" translate="DASHBOARDS.DUPLICATE">\n                    Duplicate Contact\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/agent.general.dashboard.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-dynamic-height md-border-bottom>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.voice" label="{{\'DASHBOARDS.VOICE\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/voice/agent.general.dashboard.voice.html\'" ng-controller="AgentHomeDashboardVoiceController as vm_voice" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="{{\'DASHBOARDS.MOTION_BULL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/bull/agent.general.dashboard.bull.html\'" ng-controller="AgentHomeDashboardBullController as vm_bull" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(105) && vm_home.license.chat" label="{{\'DASHBOARDS.CHAT\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/chat/agent.general.dashboard.chat.html\'" ng-controller="AgentHomeDashboardMultiChannelChatController as vm_chat" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(106) && vm_home.license.mail" label="{{\'DASHBOARDS.MAIL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/mail/agent.general.dashboard.mail.html\'" ng-controller="AgentHomeDashboardMultiChannelMailController as vm_mail" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(107) && vm_home.license.messaging" label="{{\'DASHBOARDS.SMS\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/sms/agent.general.dashboard.sms.html\'" ng-controller="AgentHomeDashboardMultiChannelSmsController as vm_sms" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(108) && vm_home.license.openchannel" label="{{\'DASHBOARDS.OPENCHANNEL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/openchannel/agent.general.dashboard.openchannel.html\'" ng-controller="AgentHomeDashboardMultiChannelOpenchannelController as vm_openchannel" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(109) && vm_home.license.fax" label="{{\'DASHBOARDS.FAX\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/fax/agent.general.dashboard.fax.html\'" ng-controller="AgentHomeDashboardMultiChannelFaxController as vm_fax" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(114) && vm_home.license.whatsapp" label="{{\'DASHBOARDS.WHATSAPP\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/whatsapp/agent.general.dashboard.whatsapp.html\'" ng-controller="AgentHomeDashboardMultiChannelWhatsappController as vm_whatsapp" class="md-padding">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/bull/agent.general.dashboard.bull.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header red-900-bg">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_bull.promise">\n        <thead md-head md-order="vm_bull.query.sort" md-on-reorder="vm_bull.getVoiceQueues">\n          <tr md-row>\n            <th md-column>{{ \'VOICE.NAME\' | translate }}</th>\n            <th md-column>{{ \'VOICE.TYPE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n            <th ng-if="voiceQueue.type === \'outbound\'" md-column>{{ \'VOICE.ACTIVE\' | translate }}</th>\n            \x3c!-- <th md-column md-order-by="active">{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_bull.getSize(vm_bull.voiceQueues)">\n            <td md-cell colspan="4">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, voiceQueue) in vm_bull.voiceQueues">\n            <td md-cell class="name">{{voiceQueue.name}}</td>\n            <td ng-if="voiceQueue.type === \'outbound\'" md-cell class="waiting">{{voiceQueue.dialMethod}}</td>\n            <td md-cell class="waiting">{{voiceQueue.waiting || 0}}</td>\n            <td md-cell ng-if="voiceQueue.type === \'outbound\'" class="dialActive ">\n              <md-icon md-colors="{color: {{voiceQueue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{voiceQueue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_bull.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_bull.query.page" md-total="{{vm_bull.voiceQueuesTotal}}" md-on-paginate="vm_bull.getVoiceQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header red-900-bg">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n            <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_bull.getSize(vm_bull.rpcVoiceQueuesChannels)">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, channel) in vm_bull.rpcVoiceQueuesChannels | limitObjectFromTo: vm_bull.queryChannels.limit:(vm_bull.queryChannels.page - 1) * vm_bull.queryChannels.limit">\n            <td md-cell>{{channel.exten}}</td>\n            <td md-cell>{{channel.queue}}</td>\n            <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_bull.queryChannels.limit" md-page="vm_bull.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_bull.getSize(vm_bull.rpcVoiceQueuesChannels)}}" md-page-select>\n    </md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/chat/agent.general.dashboard.chat.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_chat.getColorByChannel(\'chat\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_chat.promise">\n        <thead md-head md-order="vm_chat.query.sort" md-on-reorder="vm_chat.getChatQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_chat.getSize(vm_chat.chatQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_chat.chatQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_chat.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_chat.query.page" md-total="{{vm_chat.chatQueuesTotal}}" md-on-paginate="vm_chat.getChatQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_chat.getColorByChannel(\'chat\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_chat.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_chat.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_chat.queryChannels.limit" md-page="vm_chat.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_chat.paginatedInteractions.length}}" md-on-paginate="vm_chat.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/fax/agent.general.dashboard.fax.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_fax.getColorByChannel(\'fax\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_fax.promise">\n        <thead md-head md-order="vm_fax.query.sort" md-on-reorder="vm_fax.getFaxQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_fax.getSize(vm_fax.faxQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_fax.faxQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_fax.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_fax.query.page" md-total="{{vm_fax.faxQueuesTotal}}" md-on-paginate="vm_fax.getFaxQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_fax.getColorByChannel(\'fax\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_fax.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_fax.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_fax.queryChannels.limit" md-page="vm_fax.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_fax.paginatedInteractions.length}}" md-on-paginate="vm_fax.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/mail/agent.general.dashboard.mail.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_mail.getColorByChannel(\'mail\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_mail.promise">\n        <thead md-head md-order="vm_mail.query.sort" md-on-reorder="vm_mail.getMailQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_mail.getSize(vm_mail.mailQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_mail.mailQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_mail.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_mail.query.page" md-total="{{vm_mail.mailQueuesTotal}}" md-on-paginate="vm_mail.getMailQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_mail.getColorByChannel(\'mail\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_mail.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_mail.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_mail.queryChannels.limit" md-page="vm_mail.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_mail.paginatedInteractions.length}}" md-on-paginate="vm_mail.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/openchannel/agent.general.dashboard.openchannel.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_openchannel.getColorByChannel(\'openchannel\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_openchannel.promise">\n        <thead md-head md-order="vm_openchannel.query.sort" md-on-reorder="vm_openchannel.getOpenchannelQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_openchannel.getSize(vm_openchannel.openchannelQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_openchannel.openchannelQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_openchannel.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_openchannel.query.page" md-total="{{vm_openchannel.openchannelQueuesTotal}}" md-on-paginate="vm_openchannel.getOpenchannelQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_openchannel.getColorByChannel(\'openchannel\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_openchannel.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_openchannel.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_openchannel.queryChannels.limit" md-page="vm_openchannel.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_openchannel.paginatedInteractions.length}}" md-on-paginate="vm_openchannel.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/sms/agent.general.dashboard.sms.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_sms.getColorByChannel(\'sms\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_sms.promise">\n        <thead md-head md-order="vm_sms.query.sort" md-on-reorder="vm_sms.getSmsQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_sms.getSize(vm_sms.smsQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_sms.smsQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_sms.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_sms.query.page" md-total="{{vm_sms.smsQueuesTotal}}" md-on-paginate="vm_sms.getSmsQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_sms.getColorByChannel(\'sms\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_sms.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_sms.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_sms.queryChannels.limit" md-page="vm_sms.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_sms.paginatedInteractions.length}}" md-on-paginate="vm_sms.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/voice/agent.general.dashboard.voice.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg ">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_voice.promise">\n        <thead md-head md-order="vm_voice.query.sort" md-on-reorder="vm_voice.getVoiceQueues">\n          <tr md-row>\n            <th md-column>{{ \'VOICE.NAME\' | translate }}</th>\n            <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n            <th ng-if="voiceQueue.type === \'outbound\'" md-column>{{ \'VOICE.ACTIVE\' | translate }}</th>\n            \x3c!-- <th md-column md-order-by="active">{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_voice.getSize(vm_voice.voiceQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, voiceQueue) in vm_voice.voiceQueues">\n            <td md-cell class="name">{{voiceQueue.name}}</td>\n            <td ng-if="voiceQueue.type === \'outbound\'" md-cell class="waiting">{{voiceQueue.dialMethod}}</td>\n            <td md-cell class="waiting">{{voiceQueue.waiting || 0}}</td>\n            <td md-cell ng-if="voiceQueue.type === \'outbound\'" class="dialActive ">\n              <md-icon md-colors="{color: {{voiceQueue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{voiceQueue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_voice.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_voice.query.page" md-total="{{vm_voice.voiceQueuesTotal}}" md-on-paginate="vm_voice.getVoiceQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg ">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n            <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_voice.getSize(vm_voice.rpcVoiceQueuesChannels)">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, channel) in vm_voice.rpcVoiceQueuesChannels | limitObjectFromTo: vm_voice.queryChannels.limit:(vm_voice.queryChannels.page - 1) * vm_voice.queryChannels.limit">\n            <td md-cell>{{channel.exten}}</td>\n            <td md-cell>{{channel.queue}}</td>\n            <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_voice.queryChannels.limit" md-page="vm_voice.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_voice.getSize(vm_voice.rpcVoiceQueuesChannels)}}" md-page-select>\n    </md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/whatsapp/agent.general.dashboard.whatsapp.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_whatsapp.getColorByChannel(\'whatsapp\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_whatsapp.promise">\n        <thead md-head md-order="vm_whatsapp.query.sort" md-on-reorder="vm_whatsapp.getWhatsappQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_whatsapp.getSize(vm_whatsapp.whatsappQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_whatsapp.whatsappQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_whatsapp.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_whatsapp.query.page" md-total="{{vm_whatsapp.whatsappQueuesTotal}}" md-on-paginate="vm_whatsapp.getWhatsappQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_whatsapp.getColorByChannel(\'whatsapp\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_whatsapp.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_whatsapp.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_whatsapp.queryChannels.limit" md-page="vm_whatsapp.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_whatsapp.paginatedInteractions.length}}" md-on-paginate="vm_whatsapp.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/fax/agent.general.fax.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.FAX_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getFaxInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getFaxInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getFaxInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.faxAccounts.rows && vm.faxAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="faxAccount in vm.faxAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeFaxInteraction($event, faxAccount)">\n              {{ faxAccount.name }} ({{ faxAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.faxInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.faxInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="faxAccount">\n            {{ vm.getFaxAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showFaxInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Fax\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadFaxInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Fax\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxInteractions.count}}" md-on-paginate="vm.getFaxInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/mail/agent.general.mail.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.MAIL_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getMailInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getMailInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getMailInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.mailAccounts.rows && vm.mailAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="mailAccount in vm.mailAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeMailInteraction($event, mailAccount)">\n              {{ mailAccount.name }} ({{ mailAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="subject">{{\'DASHBOARDS.SUBJECT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.mailInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.mailInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div ng-if="vm.setting.enableEmailPreview && interaction.lastMsgText" class="tooltip-preview" ng-mouseleave="vm.resetTooltipPosition($event)" ng-mouseenter="vm.adjustTooltipPosition($event)">\n              <span class="text-truncate font-size-12 subject-text">{{ interaction.subject }}</span>\n              <md-card class="tooltip-preview-text">\n                <md-card-content><span class="email-preview-message">{{ interaction.lastMsgText }}</span>\n                </md-card-content>\n              </md-card>\n            </div>\n            <span ng-if="!interaction.lastMsgText || !vm.setting.enableEmailPreview"><span class="text-truncate font-size-12 subject-text">{{ interaction.subject }}</span></span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="mailAccount">\n            {{ vm.getMailAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showMailInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Mail\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadMailInteraction($event, interaction, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadMailInteraction($event, interaction)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailInteractions.count}}" md-on-paginate="vm.getMailInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/mycontacts/agent.general.mycontacts.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.MYCONTACTS">My Contacts</span>\n      <ms-search-bar on-search="vm.getContacts()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getContacts()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" ng-click="vm.refreshContacts($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button ng-if="vm.lists.rows && vm.lists.rows.length" class="md-icon-button create-new" ng-click="vm.openContact($event)" aria-label="Add contact" translate translate-attr-label="DASHBOARDS.ADD_CONTACT">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="firstName">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="mobile">{{\'DASHBOARDS.MOBILE\' | translate}}</th>\n          <th md-column md-order-by="fax">{{\'DASHBOARDS.FAX\' | translate}}</th>\n          <th md-column md-order-by="email">{{\'DASHBOARDS.EMAIL\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.CREATEDAT\' | translate}}</th>\n          <th md-column md-order-by="ListId">{{\'DASHBOARDS.LIST\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.contacts.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="contact in vm.contacts.rows">\n          <td ng-click="vm.openContact($event, contact)" md-cell class="id">{{contact.id}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="firstName" privacy ng-cloak>\n            {{contact.firstName}} {{contact.lastName}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.phone" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="mobile">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.mobile" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="fax" privacy ng-cloak>\n            {{contact.fax}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="email" privacy ng-cloak>{{contact.email}}\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="createdAt">{{contact.createdAt |\n            formatdate}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="list">\n            {{vm.listsMap[contact.ListId].name}}</td>\n          <td md-cell class="tag">\n            <div ng-if="contact.Tags.length">\n              <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                <span class="text-truncate">{{contact.Tags[0].name}}</span>\n              </div>\n              <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag"></md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.openContact($event, contact)" translate="DASHBOARDS.EDIT">\n                    Edit Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.mergeContact($event, contact)" translate="DASHBOARDS.MERGE">\n                    Merge Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.duplicateContact($event, contact)" translate="DASHBOARDS.DUPLICATE">\n                    Duplicate Contact\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/openchannel/agent.general.openchannel.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.OPENCHANNEL_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getOpenchannelInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getOpenchannelInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getOpenchannelInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.openchannelAccounts.rows && vm.openchannelAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeOpenchannelInteraction($event, openchannelAccount)" ng-disabled="!openchannelAccount.replyUri">\n              {{ openchannelAccount.name }} ({{ openchannelAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.openchannelInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.openchannelInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="openchannelAccount">\n            {{ vm.getOpenchannelAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showOpenchannelInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Openchannel\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadOpenchannelInteraction($event, interaction, true)" translate="OPENCHANNEL.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadOpenchannelInteraction($event, interaction)" translate="OPENCHANNEL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelInteractions.count}}" md-on-paginate="vm.getOpenchannelInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/plugins/agent.general.plugins.html",'<div id="plugin" ng-if="vm.plugin" ng-cloak layout-fill>\n  <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/agent.general.presence.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-selected="vm.selectedTab" md-dynamic-height md-border-bottom>\n      <md-tab label="{{\'DASHBOARDS.AGENTS\' | translate}}" md-on-select="vm.onAgentsTabSelection()">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.agents.html\'">\n        </md-content>\n      </md-tab>\n      <md-tab label="{{\'DASHBOARDS.QUEUES\' | translate}}" md-on-select="vm.onQueuesTabSelection()">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.queues.html\'">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.agents.html",'<md-card ngCloak>\n  <md-toolbar class="md-table-toolbar md-default table-header xenialab-violet-light-bg" ng-class="{\'h-128\' : vm.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.AGENTS"></span>\n      <ms-search-bar on-search="vm.getAgents()" query="vm.agentsQuery" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.agentsQuery" search="vm.getAgents()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getAgents()">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.agentsQuery.sort" md-on-reorder="vm.getAgents">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'DASHBOARDS.NAME\' | translate}}</th>\n          <th md-column md-order-by="internal">{{\'VOICE.INTERNAL\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column class="no-padding width-70"></th>\n          <th md-column class="width-70"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.agents.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="agent in vm.agents.rows">\n          <td md-cell>{{agent.id}}</td>\n          <td md-cell>{{agent.name}}</td>\n          <td md-cell>{{agent.internal}}</td>\n          <td md-cell>\n            <div layout="row">\n              <div layout="column" layout-align="center center">\n                <span class="text-boxed width-120 text-center md-background-bg bl bt padding-5" ng-class="{\'online\':\'lime-300-bg\',\'offline\':\'red-A200-bg\',\'pause\':\'amber-200-bg\',\'busy\':\'indigo-100-bg\'}[agent.status]">\n                  {{ \'VOICE.\' + (agent.status | uppercase) | translate | uppercase }}</span>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="no-padding width-70">\n            <md-button ng-if="agent.status !== \'offline\' && agent.status !== \'unavailable\'" ng-click="vm.originateCall(agent.name)" class="md-fab md-mini md-raised" aria-label="Dial">\n              <md-icon md-font-icon="icon-phone" class="icon green-fg s20">\n                <md-tooltip><span translate="VOICE.DIAL"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n          <td md-cell class="width-70">\n            <md-button ng-if="agent.status !== \'offline\' && agent.status !== \'unavailable\'" ng-click="vm.transferCall(agent.name)" class="md-fab md-mini md-raised" aria-label="Transfer">\n              <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s20">\n                <md-tooltip><span translate="DASHBOARDS.TRANSFER"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.agentsQuery.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.agentsQuery.page" md-total="{{vm.agents.count}}" md-on-paginate="vm.getAgents" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.queues.html",'<md-card ngCloak>\n  <md-toolbar class="md-table-toolbar md-default table-header xenialab-violet-light-bg" ng-class="{\'h-128\' : vm.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.QUEUES"></span>\n      <ms-search-bar on-search="vm.getVoiceQueues()" query="vm.queuesQuery" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.queuesQuery.sort" md-on-reorder="vm.getVoiceQueues">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'DASHBOARDS.NAME\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'VOICE.CALLS\' | translate}}</th>\n          <th md-column class="no-padding width-70"></th>\n          <th md-column class="width-70"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceQueues.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="queue in vm.voiceQueues.rows">\n          <td md-cell>{{queue.id}}</td>\n          <td md-cell>{{queue.name}}</td>\n          <td md-cell>{{queue.calls.length || 0}}</td>\n          <td md-cell class="no-padding width-70">\n            <md-button ng-click="vm.originateCall(queue.name)" class="md-fab md-mini md-raised" aria-label="Dial">\n              <md-icon md-font-icon="icon-phone" class="icon green-fg s20">\n                <md-tooltip><span translate="VOICE.DIAL"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n          <td md-cell class="width-70">\n            <md-button ng-click="vm.transferCall(queue.name)" class="md-fab md-mini md-raised" aria-label="Transfer">\n              <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s20">\n                <md-tooltip><span translate="DASHBOARDS.TRANSFER"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.queuesQuery.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queuesQuery.page" md-total="{{vm.voiceQueues.count}}" md-on-paginate="vm.getVoiceQueues" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/recordings/agent.general.recordings.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header indigo-A100-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="VOICE.RECORDINGS">Recordings</span>\n      <ms-search-bar on-search="vm.getVoiceRecordings()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceRecordings()">\n      </ms-quick-filter>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceRecordings">\n        <tr md-row>\n          <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n          <th md-column md-order-by="uniqueid">{{ \'VOICE.UNIQUEID\' | translate }}</th>\n          <th md-column md-order-by="calleridnum">{{ \'VOICE.CALLER\' | translate }}</th>\n          <th md-column md-order-by="exten">{{ \'VOICE.CALLED\' | translate }}</th>\n          <th md-column md-order-by="connectedlinenum">{{ \'VOICE.CONNECTED\' | translate }}</th>\n          <th md-column md-order-by="queue">{{ \'VOICE.QUEUE\' | translate }}</th>\n          <th md-column md-order-by="rating">{{ \'VOICE.RATING\' | translate }}</th>\n          <th md-column>{{ \'VOICE.AUDIO\' | translate }}</th>\n          <th md-column md-order-by="createdAt">{{ \'VOICE.DATE\' | translate }}</th>\n          <th md-column width="10px" ng-if="vm.currentUser.downloadVoiceRecordings"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n          <td md-cell colspan="{{ vm.currentUser.downloadVoiceRecordings ? 10 : 9}}">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="voiceRecording in vm.voiceRecordings.rows">\n          <td md-cell class="type">{{voiceRecording.type}}</td>\n          <td md-cell class="uniqueid">{{voiceRecording.uniqueid}}</td>\n          <td md-cell class="calleridnum">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.calleridnum" license="vm_home.license">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="exten">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.exten" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="connectedlinenum">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.connectedlinenum" license="vm_home.license">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="queue">{{voiceRecording.queue}}</td>\n          <td md-cell class="rating">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-show="voiceRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:voiceRecording.rating"></md-icon><span ng-hide="voiceRecording.rating" translate="VOICE.NO_RATING">No rating</span>\n          </td>\n          <td md-cell class="audio" ng-switch="voiceRecording.format">\n            \x3c!-- audio recording directive --\x3e\n            <ms-recording ng-switch-when=".wav" id="voiceRecording.id"></ms-recording>\n            \x3c!-- / audio recording directive --\x3e\n            <span ng-switch-when=".gsm">\n              <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n            </span>\n          </td>\n          <td md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n          <td md-cell class="actions" ng-if="vm.currentUser.downloadVoiceRecordings">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.downloadfile(voiceRecording, $event)" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                    Download VoiceRecording\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\'">\n                  <md-button ng-click="vm.downloadtranscribe(voiceRecording, $event)" translate="VOICE.DOWNLOADTRANSCRIBE_VOICERECORDING">\n                    Download Transcribe\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceRecordings.count}}" md-on-paginate="vm.getVoiceRecordings" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/scheduled/agent.general.scheduled.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header blue-grey-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getScheduledCalls()">\n      </ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm.getScheduledCalls()" aria-label="Refresh scheduled calls" translate translate-attr-label="MOTIONDIALER.REFRESH_SCHEDULED_CALLS">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip>{{\'MOTIONDIALER.REFRESH_SCHEDULED_CALLS\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScheduledCalls">\n        <tr md-row>\n          <th md-column>{{\'MOTIONDIALER.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n          <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n          <th md-column>{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n          <th md-column md-order-by="recallme">{{ \'MOTIONDIALER.RECALLME\' | translate }}</th>\n          <th md-column>{{ \'MOTIONDIALER.CAMPAIGN\' | translate }}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.scheduledCalls.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="scheduledCall in vm.scheduledCalls.rows">\n          <td md-cell privacy ng-cloak>{{scheduledCall.Contact.firstName}} {{scheduledCall.Contact.lastName}}</td>\n          <td md-cell>\n            <ms-click-to-call target="scheduledCall.phone" license="vm_home.license"></ms-click-to-call>\n          </td>\n          <td md-colors="{color: {{ vm.isDateBeforeToday(scheduledCall.scheduledat) ? \'\\\'red\\\'\' : \'\\\'green\\\'\' }}}" md-cell>{{ scheduledCall.scheduledat | date:\'medium\' }}</td>\n          <td md-cell>{{ vm.priorities[scheduledCall.priority] }}</td>\n          <td md-cell>\n            <md-icon md-colors="{color: {{ scheduledCall.recallme && scheduledCall.UserId == vm.currentUser.id ? \'\\\'green\\\'\' : \'\\\'grey\\\'\' }}}" md-font-icon="{{ scheduledCall.recallme  && scheduledCall.UserId == vm.currentUser.id ? \'icon-check\' : \'icon-close\' }}">\n            </md-icon>\n          </td>\n          <td md-cell>\n            <md-icon md-colors="{color: {{ scheduledCall.Queue.dialActive? \'\\\'green\\\'\' : \'\\\'red\\\'\' }}}" md-font-icon="icon-checkbox-blank-circle"></md-icon> {{scheduledCall.Queue.name}}\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.createOrEditQueueCampaignHopper($event, scheduledCall)" translate="MOTIONDIALER.EDIT_HOPPER">\n                    Edit Hopper\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.deleteConfirm(scheduledCall, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                    Delete Hopper\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.scheduledCalls.count}}" md-on-paginate="vm.getScheduledCalls" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.SMS_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getSmsInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getSmsInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getSmsInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.smsAccounts.rows && vm.smsAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="smsAccount in vm.smsAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeSmsInteraction($event, smsAccount)">\n              {{ smsAccount.name }} ({{ smsAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.smsInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.smsInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="smsAccount">\n            {{ vm.getSmsAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showSmsInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Sms\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadSmsInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Sms\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsInteractions.count}}" md-on-paginate="vm.getSmsInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/voice/agent.general.voice.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="VOICE.CALLS">Calls</span>\n      <ms-search-bar on-search="vm.getVoiceCalls()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceCalls()">\n      </ms-quick-filter>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'VOICE.ID\' | translate}}</th>\n          <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n          <th md-column md-order-by="source">{{ \'VOICE.SOURCE\' | translate }}</th>\n          <th md-column md-order-by="destination">{{ \'VOICE.DESTINATION\' | translate }}</th>\n          <th md-column md-order-by="starttime">{{ \'VOICE.STARTEDAT\' | translate }}</th>\n          <th md-column md-order-by="endtime">{{ \'VOICE.ENDEDAT\' | translate }}</th>\n          <th md-column md-order-by="userDisposition">{{ \'VOICE.DISPOSITION\' | translate }}</th>\n          <th md-column md-order-by="userSecondDisposition">{{ \'VOICE.SECOND_LEVEL_DISPOSITION\' | translate }}</th>\n          <th md-column md-order-by="userThirdDisposition">{{ \'VOICE.THIRD_LEVEL_DISPOSITION\' | translate }}</th>\n          <th md-column>{{ \'VOICE.NOTE\' | translate }}</th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceCalls.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="voiceCall in vm.voiceCalls.rows" ng-click="vm.showDetails(voiceCall, $event)">\n          <td md-cell class="type">{{voiceCall.id}}</td>\n          <td md-cell class="type">{{ \'VOICE.\' + voiceCall.type.toUpperCase() | translate}}</td>\n          <td md-cell class="source">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceCall.source" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="destination">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceCall.destination" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="starttime">{{voiceCall.starttime | date:\'medium\' }}</td>\n          <td md-cell class="endtime">{{voiceCall.endtime | date:\'medium\' }}</td>\n          <td md-cell class="disposition">{{ voiceCall.userDisposition}}</td>\n          <td md-cell class="disposition">{{ voiceCall.userSecondDisposition}}</td>\n          <td md-cell class="disposition">{{ voiceCall.userThirdDisposition}}</td>\n          <td md-cell class="note">\n            <md-icon ng-if="voiceCall.note" md-font-icon="icon-clipboard-outline"></md-icon>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.showDetails(voiceCall, $event)" translate="VOICE.DETAILS">\n                    Show Details\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceCalls.count}}" md-on-paginate="vm.getVoiceCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",'<md-dialog class="details-dialog" aria-label="details">\n  <md-toolbar class="md-background-bg">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span ng-if="!vm.interaction.closed" class="title" translate="VOICE.DETAILS"></span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <md-list flex>\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.UNIQUEID">Uniqueid</p>\n          <h4>{{vm.call.uniqueid}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.TYPE">Type</p>\n          <h4>{{vm.call.type ? vm.call.type : \'no type\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.SOURCE">Source</p>\n          <h4 privacy ng-cloak>{{vm.call.source ? vm.call.source : \'unknown\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DESTINATION">Destination</p>\n          <h4 privacy ng-cloak>{{vm.call.destination ? vm.call.destination : \'unknown\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.STARTEDAT">Started At</p>\n          <h4>{{vm.call.starttime | date:\'medium\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.ANSWEREDAT">Answered At</p>\n          <h4>{{vm.call.answertime ? (vm.call.answertime | date:\'medium\') : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.ENDEDAT">Ended At</p>\n          <h4>{{vm.call.endtime ? (vm.call.endtime | date:\'medium\') : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DURATION">Duration</p>\n          <h4>{{vm.call.duration ? vm.call.duration : \'--\'}}s</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.BILLABLESECONDS">Billable Seconds</p>\n          <h4>{{vm.call.billableseconds ? vm.call.billableseconds : \'--\'}}s</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DISPOSITION">Disposition</p>\n          <h4>{{vm.call.userDisposition ? vm.call.userDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n          <h4>{{vm.call.userSecondDisposition ? vm.call.userSecondDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n          <h4>{{vm.call.userThirdDisposition ? vm.call.userThirdDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.NOTE">Note</p>\n          <h4>{{vm.call.note ? vm.call.note : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n    </md-list>\n  </md-dialog-content>\n\n  <md-dialog-actions layout="row" layout-align="space-between center">\n    <md-button type="button" ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="DISPOSE" translate="VOICE.CLOSE" translate-attr-aria-label="VOICE.DISPOSE">\n      CLOSE\n    </md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/home/whatsapp/agent.general.whatsapp.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.WHATSAPP_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getWhatsappInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getWhatsappInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getWhatsappInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.whatsappAccounts.rows && vm.whatsappAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="whatsappAccount in vm.whatsappAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeWhatsappInteraction($event, whatsappAccount)">\n              {{ whatsappAccount.name }} ({{ whatsappAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.whatsappInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.whatsappInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="whatsappAccount">\n            {{ vm.getWhatsappAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showWhatsappInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Whatsapp\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadWhatsappInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Whatsapp\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappInteractions.count}}" md-on-paginate="vm.getWhatsappInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/iframe/agent.general.iframe.html",'<md-content layout="row" layout-fill>\n\n  <div flex layout="row">\n\n    <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="width: 100%; height: 100%; border:0px;"></iframe>\n\n  </div>\n\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",'<md-dialog id="agent-general-dialog" aria-label="Spy Dialog">\n  <div id="interaction-app" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html\'"></div>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html",'\x3c!-- CONTENT CARD --\x3e\n<md-content class="content-card" layout="row" layout-fill>\n\n  <div ng-if="!vm.showInteraction" class="start-point" flex layout="column" layout-align="center center" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.loading.html\'"></div>\n\n  <div ng-if="vm.showInteraction" flex layout="row">\n\n    <md-card flex="75" class="interaction">\n\n      <md-content class="interaction-agents" layout="row" layout-align="start center" ng-if="!vm.interaction.closed && vm.interaction.Users.length">\n        <strong layout-margin translate="DASHBOARDS.CURRENTLY_IN_USE_BY">Currently in use by </strong>\n\n        <div ng-repeat="u in vm.interaction.Users">\n          <img class="avatar-small" ng-src="api/users/{{u.id}}/avatar">\n          <md-tooltip> {{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersMap[u.id] | translate }}\n          </md-tooltip>\n        </div>\n      </md-content>\n\n      \x3c!-- TOOLBAR --\x3e\n      <md-toolbar class="interaction-toolbar" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.html\'">\n      </md-toolbar>\n      \x3c!-- / TOOLBAR --\x3e\n\n      \x3c!-- CONTENT --\x3e\n      <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex layout-wrap>\n        <div class="interaction-messages" ng-switch="vm.tab.channel">\n          <div ng-switch-when="mail">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html\'">\n            </div>\n          </div>\n          <div ng-switch-default>\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.html\'">\n            </div>\n          </div>\n        </div>\n      </md-content>\n      \x3c!-- / CONTENT --\x3e\n\n      \x3c!-- FOOTER --\x3e\n      <div ng-if="\n            !vm.interaction.closed && ( vm.tab.channel == \'chat\' \n            || (vm.tab.channel == \'openchannel\' && vm.account.replyUri) \n            || (vm.tab.channel == \'sms\' && !vm.tab.spy) \n            || (vm.tab.channel == \'whatsapp\' && !vm.tab.spy) )\n             && (vm.user.role !== \'admin\' && vm.user.role !== \'user\')" class="interaction-footer flex-noshrink" layout="row" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html\'">\n      </div>\n      \x3c!-- / FOOTER--\x3e\n    </md-card>\n\n    <md-card layout="column" flex class="info" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.html\'">\n    </md-card>\n  </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/chat/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="CHAT.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="CHAT.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="CHAT.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="CHAT.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'CHAT.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'CHAT.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.ChatAccountId" md-font-icon="icon-earth" aria-label="alert chat" class="s16"></md-icon>\n          <md-icon ng-if="item.ChatAccountId" md-font-icon="icon-message-text" aria-label="alert chat" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n\n        <md-not-found>\n          <span translate="CHAT.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="FAX.SEND">SEND</span>\n          </md-button>\n          <md-button ng-disabled="vm.message.attachments.length === 1" class="md-fab md-mini md-white-bg" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-init="vm.ngFlowOptions" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)">\n            <md-icon md-font-icon="icon-paperclip" class="red-fg"></md-icon>\n          </md-button>\n        </div>\n        <span class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="FAX.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block to">\n        <label translate="FAX.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete ng-hide="vm.message.to.length === 1" md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.fax" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" ng-if="composeForm.$dirty">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n          <div ng-message="md-max-chips">You reached the maximum amount of chips</div>\n        </div>\n      </md-input-container>\n      <div class="attachment-list" ng-if="vm.message.attachments.length" layout="row" layout-wrap>\n        <div class="attachment" layout="row" layout-align="space-between center" ng-repeat="attachment in vm.message.attachments">\n          <div>\n            <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            <span class="filename">{{attachment.name}}</span>\n            <span class="size">({{attachment.size | byteFmt: 0}})</span>\n          </div>\n          <md-button class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="FAX.DELETE_ATTACHMENT">\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message" ng-class="{\'mail-no-secret\': !vm.secret}" ng-cloak>\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar ng-class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <div ng-if="!vm.secret" class="md-button md-raised blue-bg no-padding">\n            <button class="white-fg margin-horizontal-10" aria-label="Send message" ng-disabled="!vm.verifySmtp" ng-click="vm.send($event, false, null)">\n              <span>{{ \'MAIL.SEND\' | translate | uppercase }}</span>\n            </button>\n            <span class="white-fg secondary-text vertical-divider"></span>\n            <md-menu>\n              <button ng-disabled="!vm.verifySmtp" class="white-fg margin-left-0" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-menu-down" class="icon s24"></md-icon>\n              </button>\n              <md-menu-content width="2">\n                <md-menu-item ng-if="vm.subStatuses.rows.length">\n                  <md-menu>\n                    <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="MAIL.SEND_AS">\n                      Send as\n                    </md-button>\n                    <md-menu-content>\n                      <md-menu-item ng-repeat="subStatus in vm.subStatuses.rows">\n                        <md-button ng-click="vm.send($event, false, subStatus.name)">\n                          {{subStatus.name}}\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.send($event, true, null)" translate="MAIL.SEND_AND_CLOSE">\n                    Send and Close\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </div>\n          <md-button ng-if="!vm.secret" class=" md-button md-raised blue-bg white-fg margin-horizontal-10" aria-label="Save draft" ng-click="vm.saveDraft()">\n            <span>{{ (vm.isDraft ? \'DASHBOARDS.UPDATE_DRAFT\' : \'DASHBOARDS.SAVE_AS_DRAFT\') | translate | uppercase }}</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="MAIL.ADD_NOTE">Add note</span>\n          </md-button>\n          <md-button ng-disabled="!vm.verifySmtp" class="md-fab md-mini md-white-bg" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload($files)" flow-init="vm.ngFlowOptions" flow-file-success="vm.fileSuccess($file, $message)" flow-file-added="vm.fileAdded($file)">\n            <md-icon md-font-icon="icon-paperclip" class="red-fg"></md-icon>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="MAIL.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to" ng-class="{\'hidden-cc\': vm.hiddenCC, \'hidden-bcc\': vm.hiddenBCC}">\n        <label translate="MAIL.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.to)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n        <div class="cc-bcc" layout="row" layout-align="start center">\n          <div class="show-cc" ng-show="vm.hiddenCC" ng-click="vm.hiddenCC = false">CC</div>\n          <div class="show-bcc" ng-show="vm.hiddenBCC" ng-click="vm.hiddenBCC = false">BCC</div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block" ng-hide="vm.hiddenCC">\n        <label translate="MAIL.CC">Cc</label>\n        <md-chips name="cc" ng-model="vm.message.cc" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.cc)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchCc" md-items="contact in vm.contactSearch(vm.searchCc)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block" ng-hide="vm.hiddenBCC">\n        <label translate="MAIL.BCC">Bcc</label>\n        <md-chips name="bcc" ng-model="vm.message.bcc" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.bcc)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchBcc" md-items="contact in vm.contactSearch(vm.searchBcc)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block no-margin">\n        <label translate="MAIL.SUBJECT">Subject</label>\n        <input ng-model="vm.message.subject" type="text" ng-keypress="vm.keyPress($event)">\n      </md-input-container>\n      <div class="attachment-list" ng-if="vm.message.attachments.length" layout="row" layout-wrap>\n        <div class="attachment" layout="row" layout-align="space-between center" ng-repeat="attachment in vm.message.attachments">\n          <div>\n            <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            <span class="filename">{{attachment.name}}</span>\n            <span class="size" ng-if="attachment.size">({{attachment.size | byteFmt: 0}})</span>\n          </div>\n          <md-button ng-click="vm.removeAttachment(attachment)" class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="MAIL.DELETE_ATTACHMENT">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="padding-top-5">\n        <textarea ckeditor="vm.ckeditor" id="html-area" ng-model="vm.message.body" md-select-on-focus="" ready="vm.onReadyEditor()"></textarea>\n      </div>\n      <md-switch ng-if="!vm.message.showLastMessage && !vm.secret" ng-model="vm.message.showLastMessage" ng-change="vm.loadLastMessage()" aria-label="load last message"><span translate="MAIL.SHOW_ORIGINAL_MESSAGE">Show original message</span></md-switch>\n      <md-autocomplete ng-if="!vm.secret" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'MAIL.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin" ng-keypress="vm.keyPress($event)">\n        <md-item-template>\n          <md-icon ng-if="!item.MailAccountId" md-font-icon="icon-earth" aria-label="alert email" class="s16">\n          </md-icon>\n          <md-icon ng-if="item.MailAccountId" md-font-icon="icon-email" aria-label="alert email" class="s16 teal-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{ item.key }} -\n            {{ item.value | htmlToPlaintext }}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="MAIL.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="OPENCHANNEL.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="OPENCHANNEL.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="OPENCHANNEL.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="OPENCHANNEL.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mapkey" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'OPENCHANNEL.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'OPENCHANNEL.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.OpenchannelAccountId" md-font-icon="icon-earth" aria-label="alert openchannel" class="s16"></md-icon>\n          <md-icon ng-if="item.OpenchannelAccountId" md-font-icon="icon-message-text" aria-label="alert openchannel" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="OPENCHANNEL.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="SMS.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="SMS.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="SMS.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="SMS.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'SMS.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'SMS.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.SmsAccountId" md-font-icon="icon-earth" aria-label="alert sms" class="s16"></md-icon>\n          <md-icon ng-if="item.SmsAccountId" md-font-icon="icon-message-text" aria-label="alert sms" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="SMS.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="WHATSAPP.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="WHATSAPP.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="WHATSAPP.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="WHATSAPP.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'WHATSAPP.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'WHATSAPP.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.WhatsappAccountId" md-font-icon="icon-earth" aria-label="alert whatsapp" class="s16">\n          </md-icon>\n          <md-icon ng-if="item.WhatsappAccountId" md-font-icon="icon-message-text" aria-label="alert whatsapp" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="WHATSAPP.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",'<md-dialog class="disposition-dialog" aria-label="disposition" ng-init="vm.onInit()">\n  <form name="dispositionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span ng-if="!vm.interaction.closed" class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <span ng-if="vm.interaction.closed" class="title" translate="DASHBOARDS.INFO"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" ng-if="!vm.mandatoryDisposition">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n        <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n          <md-option ng-value="null" ng-if="!vm.mandatoryDisposition">NONE</md-option>\n          <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n            {{ disposition.name }}</md-option>\n        </md-select>\n        <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n          <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n          <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.NOTE">Note</label>\n        <textarea ng-model="vm.interaction.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveDisposition()" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && (vm.firstLevelDisposition || vm.secondLevelDisposition || vm.thirdLevelDisposition)" aria-label="CLOSE_AND_DISPOSE" translate="DASHBOARDS.CLOSE_AND_DISPOSE" translate-attr-aria-label="DASHBOARDS.CLOSE_AND_DISPOSE">\n          CLOSE AND DISPOSE\n        </md-button>\n        <md-button type="submit" ng-click="vm.saveDisposition(false)" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && !vm.firstLevelDisposition" ng-disabled="vm.mandatoryDisposition" aria-label="CLOSE_WITHOUT_DISPOSE" translate="DASHBOARDS.CLOSE_WITHOUT_DISPOSE" translate-attr-aria-label="DASHBOARDS.CLOSE_WITHOUT_DISPOSE">\n          CLOSE WITHOUT DISPOSE\n        </md-button>\n        <md-button type="submit" ng-click="vm.saveDisposition()" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="vm.interaction.closed" ng-disabled="vm.mandatoryDisposition && !vm.firstLevelDisposition" aria-label="DISPOSE" translate="DASHBOARDS.DISPOSE" translate-attr-aria-label="DASHBOARDS.DISPOSE">\n          DISPOSE\n        </md-button>\n        <div ng-if="vm.mandatoryDisposition">\n          <md-icon md-font-icon="icon-information-outline" aria-label="Mandatory Disposition"></md-icon>\n          <span class="no-margin font-size-12 line-height-30" translate="DASHBOARDS.HELP.MANDATORY_DISPOSITION_ENABLED"></span>\n        </div>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",'<md-dialog class="tag-dialog" aria-label="tag">\n  <form name="tagForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.TAGS"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <md-chips ng-model="vm.interaction.Tags" md-autocomplete-snap md-require-match="vm.autocompleteRequireMatch">\n          <md-autocomplete ng-blur="vm.searchText = \'\'" md-min-length="0" md-selected-item-change="vm.selectedItemChange" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-items="item in vm.tags.rows | filter:{ name: vm.searchText }" md-item-text="item.name" placeholder="Search for a tag">\n            <span md-highlight-text="vm.searchText">{{item.name}}</span>\n          </md-autocomplete>\n          <md-chip-template>\n            <span>\n              <strong>{{$chip.name}}</strong>\n            </span>\n          </md-chip-template>\n        </md-chips>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveTag(false)" ng-disabled="tagForm.$pristine" class="send-button md-accent md-raised" aria-label="TAG" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/transfer/dialog.html",'<md-dialog class="disposition-dialog" aria-label="disposition">\n  <form name="transferForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.TRANSFER"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(false)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.transfer.type">\n          <md-option ng-value="\'queue\'" ng-if="vm.account.queueTransfer">Queue</md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.account.agentTransfer">Agent</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.transfer.type === \'queue\'">\n        <label translate="DASHBOARDS.QUEUES">Queues</label>\n        <md-select name="queue" ng-model="vm.transfer.id" required>\n          <md-option ng-value="queue.id" ng-repeat="queue in vm.queues.rows">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="transferForm.queue.$error" ng-show="transferForm.queue.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.transfer.type === \'agent\'">\n        <label translate="DASHBOARDS.AGENTS">Agents</label>\n        <md-select name="agent" ng-model="vm.transfer.id" required>\n          <md-option ng-value="agent.id" ng-repeat="agent in vm.agents.rows">{{\n            agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="transferForm.agent.$error" ng-show="transferForm.agent.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.onTransfer(true)" ng-disabled="transferForm.$pristine" class="send-button md-accent md-raised" aria-label="DASHBOARDS.TRANSFER" translate="DASHBOARDS.TRANSFER" translate-attr-aria-label="DASHBOARDS.TRANSFER">\n          TRANSFER\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html",'\x3c!-- REPLY FORM --\x3e\n<div ng-show="vm.showFooter" layout="column" layout-align="center center" flex>\n  <div layout="row" layout-align="center center" style="flex-grow: 1; align-self: stretch" flex>\n    \x3c!-- msEmojyArea directive --\x3e\n    <ms-emoji-area ng-if="vm.tab.channel != \'fax\'" on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.tab.areaText" placeholder="vm.tab.channel.toUpperCase() + \'.INSERT_MESSAGE_HERE\'"></ms-emoji-area>\n    \x3c!-- / msEmojyArea directive --\x3e\n\n    <div layout="row" layout-align="end center">\n      <md-button ng-if="vm.tab.channel != \'fax\'" style="margin:1px;" class="md-icon-button md-mini" ng-click="vm.changeDisplayCannedAnswerInputValue()" aria-label="Search canned answer" translate translate-attr-aria-label="DASHBOARDS.SEND_MESSAGE">\n        <md-icon md-font-icon="icon-auto-fix" class="green-fg"></md-icon>\n      </md-button>\n\n      <md-button ng-if="vm.tab.channel == \'openchannel\' || vm.tab.channel == \'chat\' || vm.tab.channel == \'fax\'" style="margin:1px;" class="md-icon-button md-warn md-mini" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-init="vm.ngFlowOptions" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)">\n        <md-icon md-font-icon="icon-paperclip"></md-icon>\n      </md-button>\n    </div>\n  </div>\n\n  <md-autocomplete ng-hide="!vm.displayCannedAnswerInput" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" placeholder="{{ \'DASHBOARDS.CANNED_ANSWER_SEARCH\' | translate}}" class="cannedarea input-show-hide">\n    <md-item-template>\n      <md-icon ng-if="!item[vm.tab.channel === \'chat\' ? \'ChatWebsiteId\' : _.capitalize(vm.tab.channel) + \'AccountId\']" md-font-icon="icon-earth" aria-label="alert channel" class="s16"></md-icon>\n      <md-icon ng-if="item[vm.tab.channel === \'chat\' ? \'ChatWebsiteId\' : _.capitalize(vm.tab.channel) + \'AccountId\']" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" aria-label="alert channel" class="s16" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n      <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n    </md-item-template>\n\n    <md-not-found>\n      <span translate="DASHBOARDS.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n    </md-not-found>\n  </md-autocomplete>\n</div>\n\x3c!-- / REPLY FORM --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line" ng-if="item.browserName">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.BROWSER_NAME">Browser Name</p>\n      <h4>{{ item.browserName }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.osName">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.OS_NAME">OS Name</p>\n      <h4>{{ item.osName }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.deviceModel">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DEVICE_MODEL">Device Model</p>\n      <h4>{{ item.deviceModel }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.referer">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.REFERER">Referer</p>\n      <h4>{{ item.referer }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.customerIp">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CUSTOMER_IP">Originating IP Address</p>\n      <h4>{{ item.customerIp }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.customerPort">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CUSTOMER_PORT">Originating TCP Port</p>\n      <h4>{{ item.customerPort }}</h4>\n    </div>\n  </md-list-item>\n  <md-divider ng-if="item.closed && item.ratingValue != null || item.ratingMessage"></md-divider>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.ratingValue != null">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.RATING">Rating</p>\n      <md-icon md-font-icon="icon-star" style="color:red" ng-show="!item.ratingType || item.ratingType == \'star\'" ng-repeat="ratingValue in [1,2,3,4,5] | limitTo:item.ratingValue"></md-icon>\n      <md-icon md-font-icon="icon-thumb-up" style="color:green" ng-show="item.ratingType && item.ratingType == \'thumb\' && item.ratingValue == 1"></md-icon>\n      <md-icon md-font-icon="icon-thumb-down" style="color:red" ng-show="item.ratingType && item.ratingType == \'thumb\' && item.ratingValue == 0"></md-icon>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.ratingMessage">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.FEEDBACK">Feedback</p>\n      <h4 style="overflow-wrap: break-word; white-space: normal">{{ item.ratingMessage }}</h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.html",'<md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CONTACT">Contact</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding">\n        <form name="contactForm" class="md-inline-form" novalidate>\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-account"></md-icon>\n            <label translate="DASHBOARDS.NAME">Name</label>\n            <input type="text" name="firstName" ng-model="vm.contact.firstName" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-email"></md-icon>\n            <label translate="DASHBOARDS.EMAIL">Email</label>\n            <input type="email" name="email" ng-model="vm.contact.email" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n            <label translate="DASHBOARDS.PHONE">Phone</label>\n            <input type="text" name="phone" ng-model="vm.contact.phone" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n            <label translate="DASHBOARDS.MOBILE">Mobile</label>\n            <input type="text" name="mobile" ng-model="vm.contact.mobile" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-deskphone"></md-icon>\n            <label translate="DASHBOARDS.FAX">Fax</label>\n            <input type="text" name="fax" ng-model="vm.contact.fax" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <div ng-if="!vm.tab.spy" layout="row" layout-align="center center">\n            <md-button class="md-raised md-accent" ng-click="vm.openContact(ev)" translate="DASHBOARDS.MORE">\n              More\n            </md-button>\n          </div>\n        </form>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.INTERACTION">Interaction</span>\n    </md-tab-label>\n    <md-tab-body>\n      <div layout="column" layout-align="space-between center" class="md-padding">\n        <md-icon class="s42" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n        <span ng-if="vm.interaction.closed" class="md-background-bg red-fg font-size-14">#{{vm.interaction.id}} - <span translate="DASHBOARDS.CLOSED"></span></span>\n        <span ng-if="!vm.interaction.closed" class="md-background-bg green-fg font-size-14">#{{vm.interaction.id}} -\n          <span translate="DASHBOARDS.OPENED"></span></span>\n        <span ng-if="!vm.interaction.closed && vm.interaction.substatus" class="md-background-bg green-fg font-size-14">{{vm.interaction.substatus}}</span>\n      </div>\n      <md-divider></md-divider>\n      <md-list flex>\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.WEBSITE" ng-if="vm.tab.channel == \'chat\'">Website</p>\n            <p translate="DASHBOARDS.ACCOUNT" ng-if="vm.tab.channel != \'chat\'">Account</p>\n            <h4>{{vm.account.name}}</h4>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.AGENT">Agent</p>\n            <h4>{{vm.agent.fullname || vm.usersMap[vm.interaction.UserId]}}</h4>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.externalUrl">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.EXTERNAL_URL">External URL</p>\n            <a href="{{vm.interaction.externalUrl}}" target="_blank">\n              <h4>{{vm.interaction.externalUrl}}</h4>\n            </a>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.CREATED_AT">Created At</p>\n            <h4>{{vm.interaction.createdAt | date: \'medium\'}}</h4>\n          </div>\n        </md-list-item>\n\n        <div ng-switch="vm.tab.channel">\n          <div ng-switch-when="chat">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'">\n            </div>\n          </div>\n          <div ng-switch-when="mail">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'">\n            </div>\n          </div>\n          <div ng-switch-when="openchannel">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.openchannel.html\'">\n            </div>\n          </div>\n        </div>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.Tags.length">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.TAGS">Tags</p>\n            <div class="tags padding-bottom-5" layout="row" layout-align="start center" layout-wrap>\n              <div class="tag margin-right-5 margin-top-5 margin-bottom-5" layout="row" layout-align="center center" ng-repeat="tag in vm.interaction.Tags">\n                <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n                <div class="tag-label">{{tag.name}}</div>\n              </div>\n            </div>\n          </div>\n        </md-list-item>\n\n        <md-divider ng-if="vm.interaction.closed"></md-divider>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.CLOSED_AT">Closed At</p>\n            <h4>{{vm.interaction.closedAt | date: \'medium\'}}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.disposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.DISPOSITION">Disposition</p>\n            <h4>{{ vm.interaction.disposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.secondDisposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n            <h4>{{ vm.interaction.secondDisposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.thirdDisposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n            <h4>{{ vm.interaction.thirdDisposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-3-line md-long-text" ng-if="vm.interaction.closed && vm.interaction.note">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.NOTE">NOTE</p>\n            <h4 style="overflow-wrap: break-word; white-space: normal">{{ vm.interaction.note }}</h4>\n          </div>\n        </md-list-item>\n      </md-list>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CUSTOMER_JOURNEY">Journey</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n</md-tabs>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html",'<md-divider></md-divider>\n<md-list flex>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.AGENT">Agent</p>\n      <h4>{{ vm.agent.fullname || vm.usersMap[item.UserId] || \'DASHBOARDS.NOT_ASSIGNED\' | translate }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.externalUrl">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.EXTERNAL_URL">External URL</p>\n      <a href="{{ item.externalUrl }}" target="_blank">\n        <h4>{{ item.externalUrl }}</h4>\n      </a>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CREATED_AT">Created At</p>\n      <h4>{{ item.createdAt | date: \'medium\' }}</h4>\n    </div>\n  </md-list-item>\n  <div ng-if="item.channel === \'chat\'">\n    <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'">\n    </div>\n  </div>\n  <div ng-if="item.channel === \'mail\'">\n    <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'">\n    </div>\n  </div>\n  <md-divider ng-if="item.closed"></md-divider>\n  <md-list-item class="md-2-line" ng-if="item.closed">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CLOSED_AT">Closed At</p>\n      <h4>{{ item.closedAt | date: \'medium\' }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.disposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DISPOSITION">Disposition</p>\n      <h4>{{ item.disposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.secondDisposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n      <h4>{{ item.secondDisposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.thirdDisposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n      <h4>{{ item.thirdDisposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-3-line md-long-text" ng-if="item.closed && item.note">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.NOTE">NOTE</p>\n      <h4 style="overflow-wrap: break-word; white-space: normal">{{ item.note }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item ng-if="item.Tags.length">\n    <p class="padding-horizontal-15 grey-fg">Tags</p>\n    <div class="tags padding-bottom-5" layout="row" layout-align="start center" layout-wrap>\n      <div class="tag margin-right-5 margin-top-5 margin-bottom-5" layout="row" layout-align="center center" ng-repeat="tag in item.Tags">\n        <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n        <div class="tag-label">{{ tag.name }}</div>\n      </div>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html",'<div layout-margin layout="row" layout-align="center center">\n  <ms-quick-filter filters="vm.quickFilters" query="vm.journeyOptions" search="vm.getCustomerJourney()">\n  </ms-quick-filter>\n</div>\n\n<md-content id="journey-content" flex layout-wrap>\n  <div ng-if="vm.journeyIsLoading" layout="row" layout-align="center center">\n    <md-progress-circular class="md-accent" md-diameter="48" md-mode="indeterminate"></md-progress-circular>\n  </div>\n  <div id="timeline" layout="column" ng-if="vm.journey && vm.journey.length && !vm.journeyIsLoading" ms-timeline="vm.journeyTimelineOptions" ms-timeline-load-more="vm.loadMoreJourney()">\n    \x3c!-- TIMELINE ITEM --\x3e\n    <div class="ms-timeline-item" layout-align="center center" ng-repeat="item in vm.journey">\n      <div class="timeline-card">\n        <md-card class="channel" ng-class="{\'md-grey-200-bg\': item.id == vm.interaction.id}">\n          <div layout="row" layout-align="space-between center">\n            <div class="header p-6" layout="row" layout-align="start center" ng-cloak>\n              <md-button class="md-fab md-mini no-click" aria-label="icon-channel" ng-class="{{ \'item.style.color\' }} + \'-bg\'">\n                <md-icon md-font-icon="{{ item.style.icon }}"></md-icon>\n              </md-button>\n              <div class="info" layout="column" ng-init="item.showMore = false">\n                <span class="font-size-12 text-truncate" ng-if="item.destination">\n                  #{{item.id}} - <span privacy ng-cloak>{{ item.destination }}</span>\n                </span>\n                <span class="font-size-12 text-truncate" ng-if="!item.destination">\n                  #{{item.id}} - {{ item.Account.key }}\n                </span>\n                <span class="font-size-10">{{item.createdAt | date: \'medium\'}}</span>\n                <span>\n                  <a class="toggle-details md-accent-color" ng-click="item.showMore = !item.showMore" translate="{{ item.showMore ? \'DASHBOARDS.HIDE_DETAILS\' : \'DASHBOARDS.SHOW_DETAILS\' }}">\n                  </a>\n                </span>\n              </div>\n            </div>\n            <span>\n              <img ng-if="item.UserId" class="avatar" ng-src="api/users/{{item.UserId}}/avatar">\n              <md-tooltip md-direction="left">{{item.Owner.fullname || item.User.fullname}}</md-tooltip>\n            </span>\n          </div>\n          <div ng-if="item.showMore">\n            <div ng-if="item.channel !== \'voice\'" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html\'">\n            </div>\n            <div ng-if="item.channel === \'voice\'" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html\'">\n            </div>\n          </div>\n          <md-divider></md-divider>\n          <div ng-if="item.id != vm.interaction.id" layout="row" layout-align="space-around center">\n            <div ng-if="item.closed && item.channel !== \'voice\'" class="text-truncate text-boxed-light">\n              <span class="red-fg" title="{{ \'DASHBOARDS.STATUS\' | translate}} : {{ \'DASHBOARDS.CLOSED\' | translate }} {{ item.dispositionsValues }}">\n                {{ \'DASHBOARDS.STATUS\' | translate}} : {{ \'DASHBOARDS.CLOSED\' | translate}} {{ item.dispositionsValues\n                }}\n              </span>\n            </div>\n            <span class="text-boxed md-background-bg green-fg" ng-if="!item.closed && item.channel !== \'voice\'" title="{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.OPENED\' | translate}}">\n              {{ \'DASHBOARDS.STATUS\' | translate}}:\n              {{ \'DASHBOARDS.OPENED\' | translate}}\n              <span ng-if="item.substatus"> - {{ item.substatus }}</span>\n            </span>\n            <span ng-if="item.channel === \'voice\'" class="text-boxed md-background-bg red-fg" title="{{ item.userDisposition ? (\'DASHBOARDS.DISPOSITION\' | translate) + \':\' : \'\'}} {{ item.userDisposition ?\n                item.userDisposition : (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }}">\n              {{ item.userDisposition ? (\'DASHBOARDS.DISPOSITION\' | translate) + \':\' : \'\'}} {{ item.userDisposition ?\n              item.userDisposition : (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }}\n            </span>\n            <span ng-if="item.channel === \'voice\' && item.userSecondDisposition" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}: {{ item.userSecondDisposition }}">\n              {{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:\n              {{ item.userSecondDisposition }}\n            </span>\n            <span ng-if="item.channel === \'voice\' && item.userThirdDisposition" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}: {{ item.userThirdDisposition }}">\n              {{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:\n              {{ item.userThirdDisposition }}\n            </span>\n            <div flex></div>\n            <md-button ng-if="!vm.tab.spy && vm.user.role === \'agent\' && item.canOpen && item.channel !== \'voice\'" class="md-icon-button" aria-label="go" ng-click="vm.openInteraction(item)">\n              <md-icon md-font-icon="icon-open-in-new" class="s20"></md-icon>\n            </md-button>\n          </div>\n        </md-card>\n      </div>\n    </div>\n\n    <div ng-if="vm.canLoadMoreJourney" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row keep-on-top">\n      <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-click="vm.loadMoreJourney()" translate="DASHBOARDS.MORE">\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / TIMELINE ITEM --\x3e\n</md-content>\n\n<div ng-if="!vm.journey || vm.journey.length === 0" layout="row" layout-align="center center">\n  <em translate="DASHBOARDS.NO_DATA_AVAILABLE">No data available</em>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html",'<md-divider></md-divider>\n\n<md-list flex>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.TYPE">Type</p>\n      <h4>{{ item.type ? item.type : \'no type\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SOURCE">Source</p>\n      <h4 privacy ng-cloak>{{ item.source ? item.source : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DESTINATION">Destination</p>\n      <h4 privacy ng-cloak>{{ item.destination ? item.destination : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.UNIQUEID">Uniqueid</p>\n      <h4>{{ item.uniqueid ? item.uniqueid : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CALLERID">Caller Id</p>\n      <h4 privacy ng-cloak>{{ item.callerid ? item.callerid : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.STARTEDAT">Started At</p>\n      <h4>{{ item.starttime | date:\'medium\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.END_AT">End At</p>\n      <h4>{{ item.endtime | date:\'medium\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DURATION">Duration</p>\n      <h4>{{ item.duration ? item.duration : \'--\' }}s</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.NOTE">Note</p>\n      <h4>{{ item.note ? item.note : \'--\' }}</h4>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line" ng-if="item.subject">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SUBJECT">Subject</p>\n      <h4>{{ item.subject }}</h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.openchannel.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.VISIBILITY">Visibility</p>\n      <h4 translate="{{ item.threadId ? \'DASHBOARDS.PUBLIC\' : \'DASHBOARDS.PRIVATE\'}}"></h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.html",'\x3c!-- MESSAGES --\x3e\n<div layout="row" ng-repeat="message in vm.messages.rows" class="md-padding message-row" ng-class="vm.getMessagesAlignment(message)">\n  <img ng-if="message.direction ===\'in\'" src="assets/images/avatars/customer.png" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && message.UserId && !message.secret" ng-src="api/users/{{message.UserId}}/avatar" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && message.UserId && message.secret" ng-src="api/users/{{message.UserId}}/avatar" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && !message.UserId" class="avatar" src="assets/images/avatars/robot.png">\n  <md-button ng-if="vm.tab.channel === \'fax\'" class="md-fab md-mini no-margin" aria-label="Download" ng-click="vm.downloadMessage(message)">\n    <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n  </md-button>\n\n  <div class="bubble" ng-class="{\'md-yellow-200-bg\': message.secret}" ng-switch="message.direction">\n    <div ng-if="message.secret">\n      <div class="time secondary-text" layout="row" layout-align="end center">\n        <div layout-padding>\n          <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n          <span> - {{message.createdAt | date: \'medium\'}}</span>\n        </div>\n        <div ng-if="message.id">\n          <md-icon class="s18" md-font-icon="icon-lock"></md-icon>\n        </div>\n      </div>\n    </div>\n    <div ng-if="!message.secret">\n      <div ng-switch-when="in" class="time secondary-text" ng-click="message.Contact && vm.openContact(ev, message.Contact)">\n        <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n        <span> - {{message.createdAt | date: \'medium\'}}</span>\n      </div>\n      <div ng-switch-when="out" class="time secondary-text" layout="row" layout-align="end center">\n        <div layout-padding>\n          <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n          <span> - {{message.createdAt | date: \'medium\'}}</span>\n        </div>\n        <div ng-if="message.id && vm.tab.channel !== \'fax\'">\n          <md-icon ng-if="!message.read" class="s18" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read" class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n        </div>\n        <div ng-if="message.id && vm.tab.channel === \'fax\'">\n          <md-icon ng-if="!message.read && !(message.failMessage )" class="s18" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read" class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n          <span ng-if="!message.read && message.failMessage" class="s18 red-900-fg"> {{ message.failMessage }}</span>\n          <md-icon ng-if="!message.read && message.failMessage" class="s18 red-900-fg" md-font-icon="icon-close md-accent"></md-icon>\n        </div>\n      </div>\n    </div>\n    <div ng-if="message.AttachmentId" layout="row" layout-align="end center">\n      <md-button ng-if="vm.downloadPermissions.attachments" class="md-raised md-accent" ng-click="vm.getAttachment({id: message.AttachmentId, name: vm.htmlToPlaintext(message.body)})">\n        <span>{{vm.htmlToPlaintext(message.body)}}</span>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </md-button>\n      <div ng-if="!vm.downloadPermissions.attachments" class="disabled-button">\n        <span>{{vm.htmlToPlaintext(message.body)}}</span>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </div>\n    </div>\n    <div ng-if="!message.AttachmentId" class="message" layout="row" layout-align="end center">\n      <span ng-bind-html="message.body | embed: vm.embedOptions"></span>\n    </div>\n  </div>\n</div>\n\x3c!-- / MESSAGES --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html",'<div ms-timeline="vm.interactionTimelineOptions" ms-timeline-load-more="vm.loadNextPage()">\n  <div ng-repeat="message in vm.messages.rows track by message.id" ng-init="vm.selectedMailShowSystemMessage[message.id] = false">\n    <md-card ng-if="message.secret" class="md-padding md-yellow-100-bg" layout="column">\n      <div layout="row" layout-align="start center">\n        <img class="avatar" ng-src="api/users/{{message.UserId}}/avatar">\n        <div layout="column">\n          <span class="grey-fg">{{vm.agent.fullname || vm.usersMap[message.UserId]}}</span>\n          <span class="grey-fg">{{message.createdAt | date:\'medium\'}}</span>\n        </div>\n      </div>\n      <div layout="row" layout-align="center center" layout-fill ng-if="message.attach && vm.downloadPermissions.attachments">\n        <div flex>\n          <md-divider></md-divider>\n        </div>\n        <md-menu>\n          <md-button aria-label="attachments" class="md-icon-button" ng-click="vm.getAttachments(message); $mdOpenMenu($event);">\n            <md-tooltip md-direction="bottom"><span translate="MAIL.ATTACHMENTS">Attachments</span>\n            </md-tooltip>\n            <div layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon>\n              <span>{{message.attach}}</span>\n            </div>\n          </md-button>\n          <md-menu-content width="4">\n            <div layout="column" layout-align="center center" ng-if="!message.attachments">\n              <md-progress-circular md-mode="indeterminate"></md-progress-circular>\n              <span translate="MAIL.ATTACHMENTS">Attachments</span>\n            </div>\n            <md-menu-item ng-if="message.attachments" ng-repeat="attachment in message.attachments">\n              <md-button ng-click="vm.getAttachment(attachment)">\n                {{ attachment.name || (\'attachment-\' + $index) }}</md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n        <div flex>\n          <md-divider></md-divider>\n        </div>\n      </div>\n      <div class="padding-top-5" ng-bind-html-unsafe="message.body"></div>\n    </md-card>\n    <div ng-if="!message.secret">\n      <div layout="row" layout-align="center center" ng-if="message.direction == \'out\' && !message.UserId && !vm.selectedMailShowSystemMessage[message.id]">\n        <md-button class="md-raised blue-grey-300-bg white-fg" ng-click="vm.selectedMailShowSystemMessage[message.id] = !vm.selectedMailShowSystemMessage[message.id]">\n          [{{message.createdAt | date: \'medium\'}}] {{ \'MAIL.SHOW_AUTOREPLY\' | translate }}</md-button>\n      </div>\n      <md-card layout="column" class="md-padding message-row" ng-if="message.direction == \'in\' || (message.direction == \'out\' && (message.UserId || vm.selectedMailShowSystemMessage[message.id]))">\n        <md-content class="mail-content">\n          <div class="info" layout="row" layout-align="space-between start">\n            <div layout="column" layout-align="start start">\n              <div layout="row" layout-align="start start">\n                <div layout="column" layout-align="start start">\n                  <div class="name" ng-click="message.Contact && vm.openContact(ev, message.Contact)">\n                    <strong privacy ng-cloak>{{message.from}}</strong>\n                    <md-icon ng-if="message.attach" md-font-icon="icon-paperclip" class="s16">\n                    </md-icon>\n                  </div>\n                  <div class="name">\n                    <div>{{message.subject}}</div>\n                  </div>\n                  <div class="name" layout="row" layout-align="start center"><span translate="MAIL.TO">To</span>: <span class="padding-left-5 subject text-truncate" privacy ng-cloak>{{ message.originTo || message.to\n                      }}</span>\n                  </div>\n                  <div class="name padding-top-10" layout="row" layout-align="start center" ng-if="message.direction == \'in\' && message.originCc && message.originCc.indexOf(vm.account.email) >= 0">\n                    <em><span class="blue-grey" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are\n                        registered as a</span> <span class="blue-grey">CC</span></em>\n                  </div>\n                  <div class="name padding-top-10" layout="row" layout-align="start center" ng-if="message.direction == \'in\' && message.bcc && message.bcc.indexOf(vm.account.email) >= 0">\n                    <em><span class="red-fg" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are\n                        registered as a</span> <span class="red-fg">BCC</span></em>\n                  </div>\n                </div>\n              </div>\n\n              <a class="toggle-details md-accent-color" ng-hide="vm.selectedMailShowDetails[message.id]" ng-click="vm.selectedMailShowDetails[message.id] = !vm.selectedMailShowDetails[message.id]" translate="MAIL.SHOW_DETAILS">\n                Show Details\n              </a>\n              <a class="toggle-details md-accent-color" ng-show="vm.selectedMailShowDetails[message.id]" ng-click="vm.selectedMailShowDetails[message.id] = !vm.selectedMailShowDetails[message.id]" translate="MAIL.HIDE_DETAILS">\n                Hide Details\n              </a>\n              <div ng-show="vm.selectedMailShowDetails[message.id]" class="details" layout="row" layout-align="start start">\n                <div layout="column">\n                  <span class="title" translate="MAIL.DATE">Date:</span>\n                  <span class="title" translate="MAIL.FROM">From:</span>\n                  <span class="title" translate="MAIL.TO">To:</span>\n                  \x3c!-- NOTE: Start retrocompatibility with replyCc 2.0.66 --\x3e\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'in\' && message.originCc">Cc:</span>\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc">Cc:</span>\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'out\' && message.cc">Cc:</span>\n                  \x3c!-- End retrocompatibility --\x3e\n                  <span class="title" translate="MAIL.BCC" ng-if="message.bcc">Bcc:</span>\n                  <span class="title" translate="MAIL.ACCEPTED" ng-if="message.UserId && message.direction ===\'in\'">Accepted:</span>\n                </div>\n\n                <div layout="column">\n                  <span class="detail">{{message.createdAt | date:\'medium\'}}</span>\n                  <span class="detail" privacy ng-cloak>{{message.from}}</span>\n                  <span class="detail" privacy ng-cloak>{{message.originTo || message.to}}</span>\n                  \x3c!-- NOTE: Start retrocompatibility with replyCc 2.0.66 --\x3e\n                  <span class="detail" ng-if="message.direction === \'in\' && message.originCc" privacy ng-cloak>{{\n                    message.originCc }}</span>\n                  <span class="detail" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc" privacy ng-cloak>{{ message.cc }}</span>\n                  <span class="detail" ng-if="message.direction === \'out\' && message.cc" privacy ng-cloak>{{ message.cc\n                    }}</span>\n                  \x3c!-- End retrocompatibility --\x3e\n                  <span class="detail" ng-if="message.bcc" privacy ng-cloak>{{message.bcc}}</span>\n                  <span class="detail" ng-if="message.UserId && message.direction ===\'in\'">{{vm.usersMap[message.UserId]}}</span>\n                </div>\n              </div>\n            </div>\n\n            <div layout="row" layout-align="center center">\n              <div layout="column" layout-align="center end" class="md-padding">\n                <span class="grey-fg" ng-if="message.direction ===\'in\'" privacy>{{message.from.indexOf(vm.contact.email)\n                  >= 0 ? vm.contact.firstName + \' \' + vm.contact.lastName : \'*\' + message.from}}</span>\n                <span class="grey-fg" ng-if="message.direction ===\'out\' && message.UserId">{{vm.agent.fullname ||\n                  vm.usersMap[message.UserId]}}</span>\n                <span class="grey-fg" ng-if="message.direction ===\'out\' && !message.UserId">System</span>\n                <span class="grey-fg">{{message.createdAt | date:\'medium\'}}</span>\n              </div>\n              <img ng-if="message.direction ===\'in\'" ng-src="assets/images/avatars/customer.png" class="avatar" alt="customer" />\n              <img ng-if="message.direction ===\'out\' && message.UserId" class="avatar" ng-src="api/users/{{message.UserId}}/avatar">\n              <img ng-if="message.direction ===\'out\' && !message.UserId" class="avatar" src="assets/images/avatars/robot.png">\n            </div>\n          </div>\n\n          <div layout="row" layout-align="center center" layout-fill>\n            <div flex>\n              <md-divider></md-divider>\n            </div>\n            <div>\n              <div class="interaction-reply-button-container">\n                <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DRAFT">Draft</span>\n                </md-tooltip>\n                <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="draft" ng-disabled="!vm.draft" ng-click="vm.openDraft(message.id)">\n                  <md-icon md-font-icon="icon-pencil-box" class="icon s24"></md-icon>\n                </md-button>\n              </div>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeMailInteraction(\'reply\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY">Reply</span></md-tooltip>\n                <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="replyAll" ng-click="vm.composeMailInteraction(\'replyAll\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY_ALL">Reply All</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-reply-all" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="forward" ng-click="vm.composeMailInteraction(\'forward\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.FORWARD">Forward</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-forward" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!message.attach && vm.downloadPermissions.interactions" class="md-icon-button" aria-label="forward" ng-click="vm.downloadMessage(message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n              </md-button>\n              <md-menu ng-if="message.attach && vm.downloadPermissions.interactions" class="no-margin" md-position-mode="target-right target">\n                <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="download">\n                  <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span>\n                  </md-tooltip>\n                  <md-icon md-font-icon="icon-download"></md-icon>\n                </md-button>\n                <md-menu-content width="2">\n                  <md-menu-item ng-if="vm.downloadPermissions.attachments">\n                    <md-button ng-click="vm.downloadMessage(message, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                      Download with attachments\n                    </md-button>\n                  </md-menu-item>\n                  <md-menu-item>\n                    <md-button ng-click="vm.downloadMessage(message)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                      Download without attachments\n                    </md-button>\n                  </md-menu-item>\n                </md-menu-content>\n              </md-menu>\n              <md-menu ng-if="message.attach && vm.downloadPermissions.attachments">\n                <md-button aria-label="attachments" class="md-icon-button" ng-click="vm.getAttachments(message); $mdOpenMenu($event);">\n                  <md-tooltip md-direction="bottom"><span translate="MAIL.ATTACHMENTS">Attachments</span></md-tooltip>\n                  <div layout="row" layout-align="start center">\n                    <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon>\n                    <span>{{message.attach}}</span>\n                  </div>\n                </md-button>\n                <md-menu-content width="4">\n                  <div layout="column" layout-align="center center" ng-if="!message.attachments">\n                    <md-progress-circular md-mode="indeterminate"></md-progress-circular>\n                    <span translate="MAIL.ATTACHMENTS">Attachments</span>\n                  </div>\n                  <md-menu-item ng-if="message.attachments" ng-repeat="attachment in message.attachments">\n                    <md-button ng-click="vm.getAttachment(attachment)">\n                      {{ attachment.name || (\'attachment-\' + $index) }}</md-button>\n                  </md-menu-item>\n                </md-menu-content>\n              </md-menu>\n            </div>\n            <div flex>\n              <md-divider></md-divider>\n            </div>\n          </div>\n\n          <md-content ng-bind-html-unsafe="message.body"></md-content>\n        </md-content>\n      </md-card>\n    </div>\n    <div ng-hide="!(vm.BTNLoadMore > 0)" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row">\n      <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-disabled="!(vm.BTNLoadMore > 0)" ng-click="vm.loadNextPage()" translate="DASHBOARDS.MORE">\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.loading.html",'<div class="big-circle md-whiteframe-4dp">\n  <md-icon class="s128 md-accent" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n</div>\n<span class="app-title" translate="DASHBOARDS.WAITING">Waiting</span>\n<span class="hide show-gt-md secondary-text" translate="DASHBOARDS.LOADING_INTERACTION">We are loading the\n  interaction...</span>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.chat.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeChatInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="CHAT.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.fax.html",'<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeFaxInteraction(\'new\')">\n  <md-tooltip md-direction="bottom"><span translate="FAX.REPLY">Reply</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.html",'<div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n  <md-icon md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" class="s20" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n  <div class="padding-left-10" layout="column" layout-align="center start" flex>\n    <div class="font-size-14" layout="row" layout-align="start center" layout-fill>\n      <span>#{{vm.interaction.id}} - {{vm.account.key}}</span>\n      <div layout="row" layout-align="center center" class="p-8">\n        <md-icon ng-if="vm.tab.channel === \'openchannel\' && vm.interaction.threadId" md-font-icon="fas fa-users" class="s16">\n          <md-tooltip><span translate="DASHBOARDS.PUBLIC_INTERACTION">The interaction is public</span></md-tooltip>\n        </md-icon>\n        <md-icon ng-if="vm.interaction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n      </div>\n      <span class="red-fg padding-left-25" ng-if="vm.interaction.closed" translate="DASHBOARDS.CLOSED">CLOSED</span>\n      <span class="green-fg padding-left-25" ng-if="!vm.interaction.closed"><span translate="DASHBOARDS.OPENED">OPENED</span><span ng-if="vm.interaction.substatus"> -\n          {{vm.interaction.substatus}}</span></span>\n      <div layout="row" layout-align="center center" class="blue-grey-300-fg padding-left-40" ng-if="!vm.interaction.closed">\n        <timer start-time="vm.interaction.createdAt"></timer>\n        <md-icon md-font-icon="icon-timelapse" class="s16 padding-left-5"></md-icon>\n      </div>\n    </div>\n    <div class="tags" layout="row" layout-align="start center" ng-if="vm.interaction.Tags.length" ng-class="{\'padding-top-5\': vm.interaction.Tags.length}">\n      <div class="tag margin-right-5" layout="row" layout-align="center center" ng-repeat="tag in vm.interaction.Tags">\n        <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n        <div class="tag-label">{{tag.name}}</div>\n      </div>\n    </div>\n  </div>\n  <div layout="row" layout-align="end center">\n    <div ng-switch="vm.tab.channel">\n      <div ng-switch-when="mail">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.mail.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="fax">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.fax.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="sms">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.sms.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="whatsapp">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.whatsapp.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="chat">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.chat.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="openchannel">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.openchannel.html\'">\n        </div>\n      </div>\n    </div>\n    <md-menu ng-if="[\'fax\', \'sms\', \'whatsapp\'].indexOf(vm.tab.channel) < 0 && vm.downloadPermissions.interactions" class="no-margin" md-position-mode="target-right target">\n      <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="download">\n        <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </md-button>\n      <md-menu-content width="2">\n        <md-menu-item ng-if="vm.downloadPermissions.attachments">\n          <md-button ng-click="vm.downloadInteraction(vm.interaction, true)" translate="DASHBOARDS.DOWNLOAD_WITH_ATTACHMENTS">\n            Download with attachments\n          </md-button>\n        </md-menu-item>\n        <md-menu-item>\n          <md-button ng-click="vm.downloadInteraction(vm.interaction)" translate="DASHBOARDS.DOWNLOAD_WITHOUT_ATTACHMENTS">\n            Download without attachments\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n    <md-menu class="no-margin" ng-if="!vm.interaction.disposition" md-position-mode="target-right target">\n      <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="more">\n        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n      </md-button>\n\n      <md-menu-content width="2">\n\n        <md-menu-item ng-if="vm.tab.channel === \'chat\' && !vm.interaction.closed && !vm.tab.spy && vm.account.vidaooEscalation && vm.account.vidaooApiKey">\n          <md-button ng-click="vm.createVidaooSession(vm.interaction)" translate="DASHBOARDS.VIDAOOSESSION">\n            Start Video Call\n          </md-button>\n        </md-menu-item>\n\n        <md-menu-item>\n          <md-button ng-click="vm.tagInteraction()" translate="DASHBOARDS.TAG">\n            Tag\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="vm.account.queueTransfer || vm.account.agentTransfer">\n          <md-button ng-click="vm.transferLastMessage()" translate="DASHBOARDS.TRANSFER">\n            Transfer\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.interaction.closed && vm.tab.channel == \'mail\' && (vm.subStatuses.rows.length || vm.interaction.substatus != null)">\n          <md-menu>\n            <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.SET_AS">\n              Set as\n            </md-button>\n            <md-menu-content>\n              <md-menu-item ng-if="vm.interaction.substatus != null">\n                <md-button ng-click="vm.setAs(null)" translate="DASHBOARDS.NONE">\n                  None\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-repeat="subStatus in vm.subStatuses.rows">\n                <md-button ng-click="vm.setAs(subStatus.name)">\n                  {{subStatus.name}}\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.interaction.closed && vm.tab.channel == \'mail\' && vm.account.markAsUnread">\n          <md-button ng-click="vm.markAsUnread()" translate="DASHBOARDS.MARK_AS_UNREAD">\n            Unread\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.tab.spy && !vm.interaction.closed">\n          <md-button ng-click="vm.disposeInteraction()" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n            Close and Dispose\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.tab.spy && vm.interaction.closed && !vm.interaction.disposition">\n          <md-button ng-click="vm.disposeInteraction(ev)" translate="DASHBOARDS.DISPOSE">\n            Dispose\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.mail.html",'<div class="interaction-reply-button-container">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DRAFT">Draft</span></md-tooltip>\n  <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="draft" ng-disabled="!vm.draft" ng-click="vm.openDraft()">\n    <md-icon ng-cloak md-font-icon="icon-pencil-box" class="icon s24" ng-class="vm.draft ? \'red-500-fg\' : \'grey-fg\'"></md-icon>\n  </md-button>\n</div>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeMailInteraction(\'reply\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY">Reply</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n</md-button>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="replyAll" ng-click="vm.composeMailInteraction(\'replyAll\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY_ALL">Reply All</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply-all" class="icon s24"></md-icon>\n</md-button>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="forward" ng-click="vm.composeMailInteraction(\'forward\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.FORWARD">Forward</span></md-tooltip>\n  <md-icon md-font-icon="icon-forward" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeMailInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.openchannel.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeOpenchannelInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="OPENCHANNEL.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.sms.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeSmsInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="SMS.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.whatsapp.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeWhatsappInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="WHATSAPP.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/jscripty/agent.general.jscripty.html",'<md-content class="md-padding" layout="column" layout-align="center center">\n  <div layout="row" layout-align="center center">\n    <span ng-if="!vm.tab.saved" class="text-boxed md-green-bg">\n      <timer start-time="vm.starttime"></timer>\n    </span>\n    <span ng-if="vm.contact" class="text-boxed md-gray-bg font-weight-900">{{vm.contact.firstName}} {{vm.contact.lastName}} {{vm.contact.phone}}</span>\n    <md-button ng-if="vm.showResetButton" ng-click="vm.resetViewer()" md-no-ink class="md-raised md-accent orange-bg">\n      <md-icon md-font-icon="icon-rotate-left" class="icon s16"></md-icon> {{\'JSCRIPTY.RESET_SESSION\' | translate}}\n    </md-button>\n    <md-button ng-if="vm.contact" ng-click="vm.openContact($event, vm.contact)" md-no-ink class="md-raised md-accent" translate="JSCRIPTY.OPEN_CONTACT"></md-button>\n    <md-button ng-if="vm.showIncompleteSubmitButton" ng-click="vm.onSubmit($event, true)" md-no-ink class="md-raised md-accent green-bg" translate="JSCRIPTY.SUBMIT"></md-button>\n  </div>\n  <h1 ng-if="!vm.project.formData"><span translate="JSCRIPTY.PROJECT_NOT_AVAILABLE">Project is not available. Please contact the administrator</span></h1>\n  <mw-form-viewer ng-if="vm.project.formData" form-data="vm.project.formData" response-data="vm.project.responseData" on-submit="vm.onSubmit($event)" template-data="call" api="vm.formViewer"></mw-form-viewer>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/notification/dialog.html",'\x3c!-- <md-toast> --\x3e\n<div class="md-padding" layout="column" layout-align="center center">\n  <span class="md-title">#{{vm.notification.id}} {{vm.notification.title}}</span>\n  <span class="md-subhead" ng-if="vm.notification.queue">{{vm.notification.queue}}</span>\n  <div class="padding-top-5" layout="row">\n    <md-button class="md-raised md-accent" ng-click="vm.accept($event)" translate="DASHBOARDS.ACCEPT">\n      ACCEPT\n    </md-button>\n    <md-button class="md-raised md-warn" ng-click="vm.reject($event)" translate="DASHBOARDS.REJECT">\n      REJECT\n    </md-button>\n  </div>\n</div>\n\x3c!-- </md-toast> --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/popup/agent.general.popup.html",'<md-content class="md-padding" flex>\n  <div ng-if="vm.html" ng-bind-html="vm.html"></div>\n  <h1 ng-if="!vm.html">Template is empty. Please contact the administrator</h1>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/user/chat/user.general.chat.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-hangouts" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.abandoned || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDONED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_MANAGED_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_MANAGED_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_MANAGED_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ABANDONED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.ABANDONED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDONED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/dialer/user.general.dialer.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_MOTION_BULL_STATS">Today Motion Bull STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timelapse"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{(vm.inbound.talking || 0) + (vm.inbound.pTalking || 0)}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TALKING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TALKING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TALKING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-missed"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.outboundDropCallsDayCallersExit || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-outgoing"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.outboundDropCallsDayTimeout || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.DROPPED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.DROPPED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.DROPPED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.originated || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ORIGINATED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.ORIGINATED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ORIGINATED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_TALK_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundanswerRate || 0 |number : 1}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundAbandonRate || 0}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDON_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDON_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundDropRate }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.DROP_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.DROP_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.DROP_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET OUTBOUND --\x3e\n\n\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_IVR_CAMPAIGNS_STATS">Today IVR campaigns stats</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.ivr.originated || 0}}/{{vm.ivr.limitCalls || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ORIGINATED\' | translate | uppercase}}/{{\'DASHBOARDS.LIMITED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.LIMITED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ORIGINATEDLIMITED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET IVR --\x3e'),e.put("app/main/apps/dashboards/views/general/user/fax/user.general.fax.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-deskphone" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/mail/user.general.mail.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-email" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/openchannel/user.general.openchannel.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-google-earth" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/sms/user.general.sms.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-message-text" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/user.general.html",'<div id="dashboard-general" ng-init="vm.onInit()" class="page-layout simple right-sidenav" layout="row">\n  \x3c!-- CENTER --\x3e\n  <div class="center" flex>\n    \x3c!-- CONTENT --\x3e\n    <div class="content">\n      <md-tabs ng-if="vm.hasDashboardPermissions" md-selected="vm.selectedTab" md-dynamic-height>\n        <md-tab ng-if="vm.license.voice" label="{{\'DASHBOARDS.VOICE\' | translate}}" ui-sref="app.dashboards.general.voice">\n          <div ui-view="voice"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.dialer" label="{{\'DASHBOARDS.MOTIONDIALER\' | translate}}" ui-sref="app.dashboards.general.dialer">\n          <div ui-view="dialer"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.chat" label="{{\'DASHBOARDS.CHAT\' | translate}}" ui-sref="app.dashboards.general.chat">\n          <div ui-view="chat"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.mail" label="{{\'DASHBOARDS.MAIL\' | translate}}" ui-sref="app.dashboards.general.mail">\n          <div ui-view="mail"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.messaging" label="{{\'DASHBOARDS.SMS\' | translate}}" ui-sref="app.dashboards.general.sms">\n          <div ui-view="sms"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.openchannel" label="{{\'DASHBOARDS.OPENCHANNEL\' | translate}}" ui-sref="app.dashboards.general.openchannel">\n          <div ui-view="openchannel"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.fax" label="{{\'DASHBOARDS.FAX\' | translate}}" ui-sref="app.dashboards.general.fax">\n          <div ui-view="fax"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.whatsapp" label="{{\'DASHBOARDS.WHATSAPP\' | translate}}" ui-sref="app.dashboards.general.whatsapp">\n          <div ui-view="whatsapp"></div>\n        </md-tab>\n      </md-tabs>\n    </div>\n    \x3c!-- END CONTENT --\x3e\n\n    <md-content ng-if="!vm.hasDashboardPermissions" layout="row" layout-align="space-around center" flex layout-padding layout-wrap>\n      <div layout="column" layout-align="space-around center" flex="50">\n        <span class="font-size-40 text-center">{{ \'DASHBOARDS.WELCOME_TO_MOTION\' | translate }}!</span>\n        <span class="font-size-30 text-center" translate="DASHBOARDS.WELCOME_MESSAGE">Use the left sidebar to\n          navigate through available sections.</span>\n      </div>\n\n      <div layout="column" flex="50">\n        <img src="assets/images/avatars/permissions.png" alt="permissions">\n      </div>\n    </md-content>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/user/voice/user.general.voice.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-incoming" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INBOUND_STATS">Today Inbound STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timelapse"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TALKING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TALKING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TALKING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-missed"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.abandoned || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ABANDONED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-incoming"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timer-sand"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_TALK_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDON_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDON_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e\n\n\x3c!-- WIDGET OUTBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_OUTBOUND_STATS">Today Outbound STATS</div>\n  </div>\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-outgoing"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.outbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.outbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OUTBOUND_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.OUTBOUND_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OUTBOUND_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-clock"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{vm.outbound.sumDuration || 0 | secToTime | date:\'HH:mm:ss\'}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOT_DURATION\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.TOT_DURATION_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOT_DURATION\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-division"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{vm.outbound.total ? ((vm.outbound.sumDuration / vm.outbound.total) | number: 0) : 0 | secToTime | date:\'HH:mm:ss\'}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_DURATION\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_DURATION_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_DURATION\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-42 line-height-72">\n            {{vm.outbound.total ? (vm.outbound.answered / vm.outbound.total * 100) : 0 | number: 1}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OUTBOUND_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.OUTBOUND_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OUTBOUND_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET OUTBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/whatsapp/user.general.whatsapp.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-whatsapp" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/fax/views/faxAccounts/create/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.faxAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="faxAccountForm[\'name\'].$error" ng-show="faxAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.faxAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="faxAccountForm[\'key\'].$error" ng-show="faxAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="FAX.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TRUNK">trunk</label>\n        <md-select name="TrunkId" ng-model="vm.faxAccount.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountForm[\'TrunkId\'].$error" ng-show="faxAccountForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TRUNK_REQUIRED">trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.LOCALSTATIONID">localstationid</label>\n        <input type="text" name="localstationid" ng-model="vm.faxAccount.localstationid" ng-required="true">\n\n        <div class="hint"><span translate="FAX.HELP.LOCALSTATIONID"></span></div>\n        <div ng-messages="faxAccountForm[\'localstationid\'].$error" ng-show="faxAccountForm[\'localstationid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.LOCALSTATIONID_REQUIRED">localstationid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.faxAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountForm[\'ListId\'].$error" ng-show="faxAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.faxAccount.description">\n\n        <div ng-messages="faxAccountForm[\'description\'].$error" ng-show="faxAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFaxAccount" ng-click="vm.saveFaxAccount()" class="send-button md-accent md-raised" ng-disabled="faxAccountForm.$invalid || faxAccountForm.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFaxAccount" ng-click="vm.addNewFaxAccount()" class="send-button md-accent md-raised" ng-disabled="faxAccountForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXACCOUNT" translate-attr-aria-label="FAX.ADD_FAXACCOUNT">\n          ADD FAXACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxAccount" ng-click="vm.deleteFaxAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="FAX.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="FAX.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",'<md-dialog class="faxAccount-dialog" aria-label="faxAccount" ng-init="vm.onInit()">\n  <form name="faxAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.AGENTADD_FAXACCOUNT">Add Agent to faxAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/agent/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'agent\'].$error" ng-show="faxAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'timeout\'].$error" ng-show="faxAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/close/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'disposition\'].$error" ng-show="faxAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'condition\'].$error" ng-show="faxAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'truepriority\'].$error" ng-show="faxAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'falsepriority\'].$error" ng-show="faxAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'priority\'].$error" ng-show="faxAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/noop/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'value\'].$error" ng-show="faxAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/queue/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'queue\'].$error" ng-show="faxAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'timeout\'].$error" ng-show="faxAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/system/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'command\'].$error" ng-show="faxAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'variable\'].$error" ng-show="faxAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/tag/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'tag\'].$error" ng-show="faxAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/view.html",'<div id="fax-faxAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-faxAccounts-button md-icon-button" aria-label="Go to faxAccounts" ng-click="vm.gotoFaxAccounts()" translate translate-attr-aria-label="FAX.GO_TO_FAXACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="faxAccount-image" hide-xs>\n          <img ng-src="assets/images/business/faxAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.faxAccount.id}}\n            <span ng-if="vm.faxAccount.name">{{vm.faxAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="FAX.CREATED_AT"></span> <span>{{vm.faxAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.faxAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="FAX.GOTO_FAXACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.faxAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="FAX.AGENTADD_FAXACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFaxAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (advancedForm.$invalid) || (dispositionForm.$invalid) || (faxDispositionsForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.faxAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.faxAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="FAX.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.HEADERINFO">headerinfo</label>\n                <input type="text" name="headerinfo" ng-model="vm.faxAccount.headerinfo" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.HEADERINFO"></span></div>\n                <div ng-messages="generalForm[\'headerinfo\'].$error" ng-show="generalForm[\'headerinfo\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.HEADERINFO_REQUIRED">headerinfo field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.TRUNK">trunk</label>\n                <md-select name="TrunkId" ng-model="vm.faxAccount.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.TRUNK_REQUIRED">trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.LOCALSTATIONID">localstationid</label>\n                <input type="text" name="localstationid" ng-model="vm.faxAccount.localstationid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.LOCALSTATIONID"></span></div>\n                <div ng-messages="generalForm[\'localstationid\'].$error" ng-show="generalForm[\'localstationid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.LOCALSTATIONID_REQUIRED">localstationid field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.faxAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.faxAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.faxAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="FAX.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.faxAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="FAX.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.faxAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.queueTransfer == true" class="md-block">\n                <label translate="FAX.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.faxAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.agentTransfer == true" class="md-block">\n                <label translate="FAX.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.faxAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.ECM">ECM</label>\n                <md-select name="ecm" ng-model="vm.faxAccount.ecm" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.ECM"></span></div>\n                <div ng-messages="advancedForm[\'ecm\'].$error" ng-show="advancedForm[\'ecm\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.ECM_REQUIRED">ECM field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MINRATE">minrate</label>\n                <md-select name="minrate" ng-model="vm.faxAccount.minrate" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'2400\'">2400</md-option>\n                  <md-option ng-value="\'4800\'">4800</md-option>\n                  <md-option ng-value="\'7200\'">7200</md-option>\n                  <md-option ng-value="\'9600\'">9600</md-option>\n                  <md-option ng-value="\'12000\'">12000</md-option>\n                  <md-option ng-value="\'14400\'">14400</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MINRATE"></span></div>\n                <div ng-messages="advancedForm[\'minrate\'].$error" ng-show="advancedForm[\'minrate\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MINRATE_REQUIRED">minrate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MAXRATE">maxrate</label>\n                <md-select name="maxrate" ng-model="vm.faxAccount.maxrate" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'2400\'">2400</md-option>\n                  <md-option ng-value="\'4800\'">4800</md-option>\n                  <md-option ng-value="\'7200\'">7200</md-option>\n                  <md-option ng-value="\'9600\'">9600</md-option>\n                  <md-option ng-value="\'12000\'">12000</md-option>\n                  <md-option ng-value="\'14400\'">14400</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MAXRATE"></span></div>\n                <div ng-messages="advancedForm[\'maxrate\'].$error" ng-show="advancedForm[\'maxrate\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MAXRATE_REQUIRED">maxrate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MODEM">modem</label>\n                <input type="text" name="modem" ng-model="vm.faxAccount.modem" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.MODEM"></span></div>\n                <div ng-messages="advancedForm[\'modem\'].$error" ng-show="advancedForm[\'modem\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MODEM_REQUIRED">modem field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.GATEWAY">gateway</label>\n                <input type="text" name="gateway" ng-model="vm.faxAccount.gateway" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.GATEWAY"></span></div>\n                <div ng-messages="advancedForm[\'gateway\'].$error" ng-show="advancedForm[\'gateway\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.GATEWAY_REQUIRED">gateway field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.FAXDETECT">faxdetect</label>\n                <input type="text" name="faxdetect" ng-model="vm.faxAccount.faxdetect" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.FAXDETECT"></span></div>\n                <div ng-messages="advancedForm[\'faxdetect\'].$error" ng-show="advancedForm[\'faxdetect\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.FAXDETECT_REQUIRED">faxdetect field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.T38TIMEOUT">t38timeout</label>\n                <input type="number" name="t38timeout" ng-model="vm.faxAccount.t38timeout" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.T38TIMEOUT"></span></div>\n                <div ng-messages="advancedForm[\'t38timeout\'].$error" ng-show="advancedForm[\'t38timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.T38TIMEOUT_REQUIRED">t38timeout field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.SIP">SIP</label>\n                <md-select name="tech" ng-model="vm.faxAccount.tech" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'SIP\'">SIP</md-option>\n                  <md-option ng-value="\'IAX\'">IAX</md-option>\n                  <md-option ng-value="\'DADHI\'">DADHI</md-option>\n                  <md-option ng-value="\'KHOMP\'">KHOMP</md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'tech\'].$error" ng-show="advancedForm[\'tech\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.SIP_REQUIRED">SIP field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.mandatoryDisposition" class="md-block">\n                <label translate="FAX.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.faxAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="FaxAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="faxAccount-detail-form-container faxdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="FAX.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add fax dispositions" translate translate-attr-label="FAX.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="faxAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'FAX.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="FaxAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.faxAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="FAX.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedFaxAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedFaxAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedFaxAccountApps.length}} {{vm_ac.selectedFaxAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedFaxAccountApps($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedFaxAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.faxAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editFaxAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.faxAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="FaxAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="FAX.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getFaxAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getFaxAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getFaxAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="FAX.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedFaxAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedFaxAccountInteractions.length}} {{vm_dc.selectedFaxAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedFaxAccountInteractions" csv-label="true" filename="faxAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedFaxAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedFaxAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getFaxAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'FAX.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'FAX.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'FAX.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'FAX.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'FAX.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'FAX.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'FAX.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.faxAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'FAX.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'FAX.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spyfaxInteraction($event, interaction)" translate="FAX.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.faxInteractionDownload(interaction, $event)" translate="FAX.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="FAX.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.faxAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="FAX.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.faxAccountInteractions.count}}" md-on-paginate="vm_dc.getFaxAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/fax/views/faxAccounts/faxAccounts.html",'<div id="faxAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-deskphone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="FAX.FAXACCOUNTS">FaxAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="FAX.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFaxAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFaxAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="FAX.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-faxAccounts-count">\n          <span>{{vm.selectedFaxAccounts.length}}</span>\n          <span translate="FAX.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="FAX.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFaxAccounts()" translate="FAX.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFaxAccounts()" translate="FAX.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFaxAccounts" csv-label="true" filename="faxAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFaxAccounts($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FAXACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFaxAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'FAX.KEY\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'FAX.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="localstationid">{{ \'FAX.LOCALSTATIONID\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'FAX.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.faxAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="faxAccount" md-select-id="id" ng-repeat="faxAccount in vm.faxAccounts.rows">\n                <td md-cell ng-if="faxAccount.userpic"><img class="avatar" alt="{{faxAccount.name}}" ng-src="api/users/{{faxAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!faxAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{faxAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="id ">{{faxAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="name ">{{faxAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="key ">{{faxAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':faxAccount.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="localstationid ">{{faxAccount.localstationid}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="description ">{{faxAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(faxAccount, $event    )" translate="FAX.EDIT_FAXACCOUNT">\n                          Edit FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(faxAccount, $event    )" translate="FAX.INTERACTIONS_FAXACCOUNT">\n                          Interactions FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(faxAccount, $event    )" translate="FAX.GOTOREALTIME_FAXACCOUNT">\n                          goToRealtime FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(faxAccount, $event    )" translate="FAX.AGENTADD_FAXACCOUNT">\n                          AgentAdd FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(faxAccount, $event    )" translate="FAX.DELETE_FAXACCOUNT">\n                          Delete FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxAccounts.count}}" md-on-paginate="vm.getFaxAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FAXACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FAXACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-faxAccount-button" ng-click="vm.createOrEditFaxAccount($event)" aria-label="add faxAccount" translate translate-attr-aria-label="FAX.ADD_FAXACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FAXACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/fax/views/faxQueues/create/dialog.html",'<md-dialog class="faxQueue-dialog" aria-label="New FaxQueue">\n  <form name="faxQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.faxQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newFaxQueue">\n\n        <div class="hint"><span translate="FAX.HELP.NAME"></span></div>\n        <div ng-messages="faxQueueForm[\'name\'].$error" ng-show="faxQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="FAX.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.faxQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="faxQueueForm[\'strategy\'].$error" ng-show="faxQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.faxQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="faxQueueForm[\'timeout\'].$error" ng-show="faxQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.faxQueue.description">\n\n        <div ng-messages="faxQueueForm[\'description\'].$error" ng-show="faxQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFaxQueue" ng-click="vm.saveFaxQueue()" class="send-button md-accent md-raised" ng-disabled="faxQueueForm.$invalid || faxQueueForm.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFaxQueue" ng-click="vm.addNewFaxQueue()" class="send-button md-accent md-raised" ng-disabled="faxQueueForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXQUEUE" translate-attr-aria-label="FAX.ADD_FAXQUEUE">\n          ADD FAXQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxQueue" ng-click="vm.deleteFaxQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="FAX.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="FAX.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",'<md-dialog class="faxQueue-dialog" aria-label="faxQueue" ng-init="vm.onInit()">\n  <form name="faxQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.AGENTADD_FAXQUEUE">Add Agent to faxQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",'<md-dialog class="faxQueue-dialog" aria-label="faxQueue" ng-init="vm.onInit()">\n  <form name="faxQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/view.html",'<div id="fax-faxQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-faxQueues-button md-icon-button" aria-label="Go to faxQueues" ng-click="vm.gotoFaxQueues()" translate translate-attr-aria-label="FAX.GO_TO_FAXQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="faxQueue-image" hide-xs>\n          <img ng-src="assets/images/business/faxQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.faxQueue.id}}\n            <span ng-if="vm.faxQueue.name">{{vm.faxQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="FAX.CREATED_AT"></span> <span>{{vm.faxQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.faxQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="FAX.TEAMADD_FAXQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.faxQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="FAX.AGENTADD_FAXQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFaxQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.faxQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="FAX.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="FAX.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.faxQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.faxQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.faxQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/fax/views/faxQueues/faxQueues.html",'<div id="faxQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-deskphone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="FAX.FAXQUEUES">FaxQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="FAX.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFaxQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFaxQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="FAX.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-faxQueues-count">\n          <span>{{vm.selectedFaxQueues.length}}</span>\n          <span translate="FAX.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="FAX.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFaxQueues()" translate="FAX.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFaxQueues()" translate="FAX.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFaxQueues" csv-label="true" filename="faxQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFaxQueues($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FAXQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFaxQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'FAX.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.faxQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="faxQueue" md-select-id="id" ng-repeat="faxQueue in vm.faxQueues.rows">\n                <td md-cell ng-if="faxQueue.userpic"><img class="avatar" alt="{{faxQueue.name}}" ng-src="api/users/{{faxQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!faxQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{faxQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="id ">{{faxQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="name ">{{faxQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="strategy ">{{ vm.arraystrategy[faxQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(faxQueue, $event    )" translate="FAX.EDIT_FAXQUEUE">\n                          Edit FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(faxQueue, $event    )" translate="FAX.TEAMADD_FAXQUEUE">\n                          teamadd FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(faxQueue, $event    )" translate="FAX.AGENTADD_FAXQUEUE">\n                          agentadd FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(faxQueue, $event    )" translate="FAX.DELETE_FAXQUEUE">\n                          Delete FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(faxQueue, $event    )" translate="FAX.GOTOREALTIME_FAXQUEUE">\n                          goToRealtime FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxQueues.count}}" md-on-paginate="vm.getFaxQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FAXQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FAXQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-faxQueue-button" ng-click="vm.createOrEditFaxQueue($event)" aria-label="add faxQueue" translate translate-attr-aria-label="FAX.ADD_FAXQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FAXQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/fax/views/realtime/accounts/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.ACCOUNTS">Accounts</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.vm.getFaxAccounts()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- ACCOUNTS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxAccounts">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate}}</th>\n        <th md-column>{{\'FAX.KEY\' | translate}}</th>\n        <th md-column>{{\'FAX.TOTAL\' | translate}}</th>\n        <th md-column>{{\'FAX.IN\' | translate}}</th>\n        <th md-column>{{\'FAX.OUT\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.faxAccounts.count > 0">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="account" md-select-id="id" ng-repeat="account in vm.faxAccounts.rows">\n        <td md-cell>{{account.name}}</td>\n        <td md-cell>{{account.key}}</td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(account.in || 0) + (account.out || 0)}}</span>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-down-bold blue-fg"></md-icon>\n            </span>\n            <span class="md-capture blue-fg">{{account.in || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.in">{{account.lastIn ?  (account.lastIn | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-up-bold green-fg"></md-icon>\n            </span>\n            <span class="md-capture green-fg">{{account.out || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.out">{{account.lastOut ?  (account.lastOut | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-button ng-click="vm.goToFaxAccount($event, account)" translate="FAX.EDIT_ACCOUNT">\n                  Edit Account\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxAccounts.count}}" md-on-paginate="vm.getFaxAccounts" md-page-select></md-table-pagination>\n\x3c!-- / ACCOUNTS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/fax/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.TRUNKS">Trunks</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ACCOUNTS">Accounts</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/fax/views/realtime/trunks/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.TRUNKS">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTrunks()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- TRUNKS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n        <th md-column>{{ \'FAX.TRUNK_STATUS\' | translate }}</th>\n        <th md-column>{{ \'FAX.REGISTRY\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.trunks">\n        <td md-cell colspan="3">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, trunk) in vm.trunks">\n        <td md-cell>{{trunk.name}}</td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[trunk.status.toLowerCase()]">\n            <md-tooltip>{{\'FAX.\' + trunk.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.status === \'registered\'" class="text-boxed">{{trunk.address}}</span>\n        </td>\n        <td md-cell>\n          <i ng-if="trunk.registry" ng-class="(trunk.stateRegistry.toLowerCase() === \'registered\') ? \'green-300-fg icon-checkbox-marked-circle\' : \'red-300-fg icon-close-circle\'">\n            <md-tooltip>{{\'FAX.\' + trunk.stateRegistry | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.registry && trunk.host && trunk.port" class="text-boxed">{{trunk.host}}:{{trunk.port}}</span>\n          <span ng-if="!trunk.registry" translate="FAX.NO_REGISTRY">\n            No Registry\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item>\n                <md-button ng-click="vm.goToTrunk($event, trunk)" translate="FAX.EDIT_TRUNK">\n                  Edit Trunk\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n\x3c!-- / TRUNKS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/help/views/about/about.html",'<div id="maintenance" class="flex-scrollable" layout="column">\n  <div id="maintenance-form-wrapper" layout="column" layout-align="center center">\n    <div id="maintenance-form" class="md-whiteframe-8dp">\n      <div>\n        <img src="/api/settings/1/logo_login" alt="logo_login" />\n      </div>\n\n      <br>\n\n      <div>\n        <div class="info-line">\n          <div class="title">Useful pages</div>\n        </div>\n        <section layout="row" flex layout-sm="column" layout-align="center center" layout-wrap>\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button grey-bg" href="https://xcally.atlassian.net/wiki/spaces/XMV/overview" target="_blank">\n              <md-icon md-font-icon="icon-wikipedia"></md-icon>\n            </a>\n            <div class="info"><a href="https://xcally.atlassian.net/wiki/spaces/XMV/overview" target="_blank">Wiki</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button md-accent" href="/apidoc" target="_blank">\n              <md-icon md-font-icon="icon-apple-mobileme"></md-icon>\n            </a>\n            <div class="info"><a href="/apidoc" target="_blank">Motion API</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button orange-bg" href="http://www.xcally.com/bar/phonebar/Setup.msi" target="_blank">\n              <md-icon md-font-icon="icon-headphones"></md-icon>\n            </a>\n            <div class="info"><a href="https://www.xcally.com/bar/phonebar/Setup.msi" target="_blank">Phonebar Download</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button green-bg" href="/demo" target="_blank">\n              <md-icon md-font-icon="icon-console"></md-icon>\n            </a>\n            <div class="info"><a href="/demo" target="_blank">Playground</a></div>\n          </div>\n\n        </section>\n\n        <br>\n\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="title">Follow us on</div>\n        </div>\n        <section ng-if="!vm.license.custom" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n          <a class="md-fab md-mini md-button blue-900-bg" href="https://www.facebook.com/xcallymotion" target="_blank">\n            <md-icon md-font-icon="icon-facebook"></md-icon>\n          </a>\n\n          <a class="md-fab md-mini md-button" href="https://twitter.com/xcallymotion" target="_blank">\n            <md-icon md-font-icon="icon-twitter"></md-icon>\n          </a>\n          <a class="md-fab md-mini md-button md-warn" href="https://plus.google.com/+Xcally" target="_blank">\n            <md-icon md-font-icon="icon-google-plus"></md-icon>\n          </a>\n          <a class="md-fab md-mini md-button light-blue-800-bg" href="https://www.linkedin.com/company/xcally" target="_blank">\n            <md-icon md-font-icon="icon-linkedin"></md-icon>\n          </a>\n        </section>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="title" translate="HELP.CONTACT_US">Contact Us</div>\n        </div>\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="info"><a href="mailto:support@xcally.com" target="_top">support@xcally.com</a></div>\n        </div>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info">xCALLY Motion <u>{{vm.info.current}}</u> | <a href="https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896252454/Motion+GUI#Version-{{vm.info.current}}" target="_blank">Changelog</a></div>\n\n        <br>\n\n        <div class="info" ng-if="!vm.license.custom">xCALLY© 2016 - 2018 | Powered by Xenialab | <a href="http://www.xcally.com/support/eula-xcally-license-en.pdf" target="_blank">EULA</a></div>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info" ng-if="!vm.license.custom"><a href="https://www.xenialab.com/" target="_blank">www.xenialab.com</a> | <a href="https://www.xcallymotion.com/" target="_blank">www.xcallymotion.com</a></div>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/integrations/views/deskAccounts/create/dialog.html",'<md-dialog class="deskAccount-dialog" aria-label="New DeskAccount">\n  <form name="deskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.deskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="deskAccountForm[\'name\'].$error" ng-show="deskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.deskAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskAccountForm[\'type\'].$error" ng-show="deskAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.deskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="deskAccountForm[\'remoteUri\'].$error" ng-show="deskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n        <md-select name="authType" ng-model="vm.deskAccount.authType" required>\n          <md-option ng-value="\'basic\'">Basic</md-option>\n        </md-select>\n        <div ng-messages="deskAccountForm[\'authType\'].$error" ng-show="deskAccountForm[\'authType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.deskAccount.authType == \'basic\'" class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.deskAccount.username" ng-required="true">\n\n        <div ng-messages="deskAccountForm[\'username\'].$error" ng-show="deskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.deskAccount.authType == \'basic\'">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.deskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="deskAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.deskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="deskAccountForm[\'serverUrl\'].$error" ng-show="deskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.deskAccount.description">\n\n        <div ng-messages="deskAccountForm[\'description\'].$error" ng-show="deskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDeskAccount" ng-click="vm.saveDeskAccount()" class="send-button md-accent md-raised" ng-disabled="deskAccountForm.$invalid || deskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDeskAccount" ng-click="vm.addNewDeskAccount()" class="send-button md-accent md-raised" ng-disabled="deskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_DESKACCOUNT">\n          ADD DESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDeskAccount" ng-click="vm.deleteDeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/deskAccounts/deskAccounts.html",'<div id="deskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.DESKACCOUNTS">DeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedDeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-deskAccounts-count">\n          <span>{{vm.selectedDeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDeskAccounts" csv-label="true" filename="deskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- DESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedDeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.deskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="deskAccount" md-select-id="id" ng-repeat="deskAccount in vm.deskAccounts.rows">\n                <td md-cell ng-if="deskAccount.userpic"><img class="avatar" alt="{{deskAccount.name}}" ng-src="api/users/{{deskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!deskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{deskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="id ">{{deskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="name ">{{deskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="remoteUri ">{{deskAccount.remoteUri}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="username ">{{deskAccount.username}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(deskAccount, $event    )" translate="INTEGRATIONS.EDIT_DESKACCOUNT">\n                          Edit DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(deskAccount, $event    )" translate="INTEGRATIONS.TEST_DESKACCOUNT">\n                          Test DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(deskAccount, $event    )" translate="INTEGRATIONS.DELETE_DESKACCOUNT">\n                          Delete DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.deskAccounts.count}}" md-on-paginate="vm.getDeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / DESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD DESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-deskAccount-button" ng-click="vm.createOrEditDeskAccount($event)" aria-label="add deskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_DESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",'<md-dialog class="deskConfiguration-dialog" aria-label="New DeskConfiguration">\n  <form name="deskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.deskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="deskConfigurationForm[\'name\'].$error" ng-show="deskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.deskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskConfigurationForm[\'channel\'].$error" ng-show="deskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.deskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskConfigurationForm[\'type\'].$error" ng-show="deskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDeskConfiguration" ng-click="vm.saveDeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="deskConfigurationForm.$invalid || deskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDeskConfiguration" ng-click="vm.addNewDeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="deskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_DESKCONFIGURATION">\n          ADD DESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDeskConfiguration" ng-click="vm.deleteDeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",'<md-dialog class="deskAccount-item-dialog" aria-label="New Item">\n  <form name="deskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="deskAccountItemForm.content.$error" ng-show="deskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="deskAccountItemForm.key.$error" ng-show="deskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="deskAccountItemForm.keyType.$error" ng-show="deskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="deskAccountItemForm.keyContent.$error" ng-show="deskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="deskAccountItemForm.variableName.$error" ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="deskAccountItemForm.customField.$error" ng-show="deskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="deskAccountItemForm.$invalid || deskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="deskAccountItemForm.$invalid || deskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="deskAccountItemForm.option.$error" ng-show="deskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="deskAccountItemForm.content.$error" ng-show="deskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="deskAccountItemForm.variableName.$error" ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="deskAccountItemForm.content.$error"\n          ng-show="deskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="deskAccountItemForm.variableName.$error"\n          ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/view.html",'<div id="integrations-deskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-deskAccounts-button md-icon-button" aria-label="Go to deskAccounts" ng-click="vm.gotoDeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_DESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="deskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/deskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.deskAccount.id}}\n            <span ng-if="vm.deskAccount.name">{{vm.deskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.deskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveDeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="deskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.deskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.deskAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.deskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n                <md-select name="authType" ng-model="vm.deskAccount.authType" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'basic\'">Basic</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'authType\'].$error" ng-show="generalForm[\'authType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.deskAccount.authType == \'basic\'" class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.deskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.deskAccount.authType == \'basic\'">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.deskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.deskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.deskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="deskAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="DeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.deskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDeskConfiguration($event)" class="md-icon-button" aria-label="create deskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="deskConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedDeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getDeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ deskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteDeskConfiguration($event, deskConfiguration)" translate="INTEGRATIONS.DELETE_DESKCONFIGURATION">\n                            Delete DeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/create/dialog.html",'<md-dialog class="dynamics365Account-dialog" aria-label="New Dynamics365Account">\n  <form name="dynamics365AccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.dynamics365Account.name" ng-required="true" autofocus>\n\n        <div ng-messages="dynamics365AccountForm[\'name\'].$error" ng-show="dynamics365AccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.dynamics365Account.modernAuthentication">\n          <span translate="INTEGRATIONS.MODERN_AUTHENTICATION">Modern Authentication</span>\n        </md-switch>\n        \x3c!-- <div class="hint"><span translate="INTEGRATIONS.HELP.MODERN_AUTHENTICATION"></span></div> --\x3e\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="true">\n\n        <div ng-messages="dynamics365AccountForm[\'username\'].$error" ng-show="dynamics365AccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div ng-if="vm.dynamics365Account.modernAuthentication == false">\n\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.PASSWORD">Password</label>\n          <input type="password" name="password" ng-model="vm.dynamics365Account.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" ng-required="true">\n          <div ng-messages="dynamics365AccountForm[\'password\'].$error" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.URI">Uri</label>\n          <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.remoteUri" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'remoteUri\'].$error" ng-show="dynamics365AccountForm[\'remoteUri\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n            </div>\n            <div ng-message="url">\n              <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.TENANTID">TenantId</label>\n          <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'tenantId\'].$error" ng-show="dynamics365AccountForm[\'tenantId\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.TENANTID_REQUIRED">TenantId field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n          <input type="text" name="clientId" ng-model="vm.dynamics365Account.clientId" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'clientId\'].$error" ng-show="dynamics365AccountForm[\'clientId\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n          <input type="text" name="clientSecret" ng-model="vm.dynamics365Account.clientSecret" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'clientSecret\'].$error" ng-show="dynamics365AccountForm[\'clientSecret\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n          <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" value="LOCALIP" ng-required="true">\n\n          <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n          <div ng-messages="dynamics365AccountForm[\'serverUrl\'].$error" ng-show="dynamics365AccountForm[\'serverUrl\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n            </div>\n            <div ng-message="url">\n              <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n            </div>\n          </div>\n        </md-input-container>\n\n      </div>\n\n      <div ng-if="vm.dynamics365Account.modernAuthentication == true">\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLOUD_PROVIDER">Cloud Provider</label>\n          <md-select ng-model="vm.dynamics365Account.CloudProviderId" placeholder="Cloud Provider connection" ng-required="true">\n            <md-option value="{{provider.id}}" ng-repeat="provider in vm.cloudProviders">{{provider.name}}</md-option>\n          </md-select>\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.dynamics365Account.description">\n\n        <div ng-messages="dynamics365AccountForm[\'description\'].$error" ng-show="dynamics365AccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDynamics365Account" ng-click="vm.saveDynamics365Account()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountForm.$invalid || dynamics365AccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDynamics365Account" ng-click="vm.addNewDynamics365Account()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT">\n          ADD DYNAMICS365ACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDynamics365Account" ng-click="vm.deleteDynamics365Account($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/dynamics365Accounts.html",'<div id="dynamics365Accounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.DYNAMICS365ACCOUNTS">Dynamics365Accounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDynamics365Accounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedDynamics365Accounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-dynamics365Accounts-count">\n          <span>{{vm.selectedDynamics365Accounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDynamics365Accounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDynamics365Accounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDynamics365Accounts" csv-label="true" filename="dynamics365Accounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDynamics365Accounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- DYNAMICS365ACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedDynamics365Accounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDynamics365Accounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="modernAuthentication">{{ \'INTEGRATIONS.MODERN_AUTHENTICATION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.dynamics365Accounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="dynamics365Account" md-select-id="id" ng-repeat="dynamics365Account in vm.dynamics365Accounts.rows">\n                <td md-cell ng-if="dynamics365Account.userpic"><img class="avatar" alt="{{dynamics365Account.name}}" ng-src="api/users/{{dynamics365Account.id}}/avatar" /></td>\n                <td md-cell ng-if="!dynamics365Account.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{dynamics365Account.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="id ">{{dynamics365Account.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="name ">{{dynamics365Account.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="modernAuthentication ">\n                  <md-icon md-colors="{color: {{dynamics365Account.modernAuthentication ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{dynamics365Account.modernAuthentication ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(dynamics365Account, $event    )" translate="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT">\n                          Edit Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(dynamics365Account, $event    )" translate="INTEGRATIONS.TEST_DYNAMICS365ACCOUNT">\n                          Test Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.crudPermissions === 0 || vm.currentUser.role === \'admin\'">\n\n                        <md-button ng-click="vm.deleteconfirm(dynamics365Account, $event    )" translate="INTEGRATIONS.DELETE_DYNAMICS365ACCOUNT">\n                          Delete Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.dynamics365Accounts.count}}" md-on-paginate="vm.getDynamics365Accounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / DYNAMICS365ACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD DYNAMICS365ACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-dynamics365Account-button" ng-click="vm.createOrEditDynamics365Account($event)" aria-label="add dynamics365Account" translate translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DYNAMICS365ACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",'<md-dialog class="dynamics365Configuration-dialog" aria-label="New Dynamics365Configuration">\n  <form name="dynamics365ConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.dynamics365Configuration.name" ng-required="true" autofocus>\n\n        <div ng-messages="dynamics365ConfigurationForm[\'name\'].$error" ng-show="dynamics365ConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.dynamics365Configuration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'channel\'].$error" ng-show="dynamics365ConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.dynamics365Configuration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'type\'].$error" ng-show="dynamics365ConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TICKETTYPE">TicketType</label>\n        <md-select name="ticketType" ng-model="vm.dynamics365Configuration.ticketType" required>\n\n          <md-option ng-value="\'incident\'"> {{ \'INTEGRATIONS.CASE\' | translate }} </md-option>\n\n          <md-option ng-value="\'phonecall\'"> {{ \'INTEGRATIONS.PHONECALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'ticketType\'].$error" ng-show="dynamics365ConfigurationForm[\'ticketType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TICKETTYPE_REQUIRED">TicketType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDynamics365Configuration" ng-click="vm.saveDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="dynamics365ConfigurationForm.$invalid || dynamics365ConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDynamics365Configuration" ng-click="vm.addNewDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="dynamics365ConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DYNAMICS365CONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365CONFIGURATION">\n          ADD DYNAMICS365CONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDynamics365Configuration" ng-click="vm.deleteDynamics365Configuration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",'<md-dialog class="dynamics365Account-item-dialog" aria-label="New Item">\n  <form name="dynamics365AccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="dynamics365AccountItemForm.content.$error" ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="dynamics365AccountItemForm.key.$error" ng-show="dynamics365AccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.keyType.$error" ng-show="dynamics365AccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="dynamics365AccountItemForm.keyContent.$error" ng-show="dynamics365AccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.variableName.$error" ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.customField.$error" ng-show="dynamics365AccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountItemForm.$invalid || dynamics365AccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountItemForm.$invalid || dynamics365AccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="dynamics365AccountItemForm.option.$error" ng-show="dynamics365AccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="dynamics365AccountItemForm.content.$error" ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="dynamics365AccountItemForm.variableName.$error" ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="dynamics365AccountItemForm.content.$error"\n          ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="dynamics365AccountItemForm.variableName.$error"\n          ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/view.html",'<div id="integrations-dynamics365Account" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-dynamics365Accounts-button md-icon-button" aria-label="Go to dynamics365Accounts" ng-click="vm.gotoDynamics365Accounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_DYNAMICS365ACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="dynamics365Account-image" hide-xs>\n          <img ng-src="assets/images/business/dynamics365Accounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.dynamics365Account.id}}\n            <span ng-if="vm.dynamics365Account.name">{{vm.dynamics365Account.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.dynamics365Account.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveDynamics365Account()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="dynamics365Account-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.dynamics365Account.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.dynamics365Account.modernAuthentication">\n                  <span translate="INTEGRATIONS.MODERN_AUTHENTICATION">Modern Authentication</span>\n                </md-switch>\n                \x3c!-- <div class="hint"><span translate="INTEGRATIONS.HELP.MODERN_AUTHENTICATION"></span></div> --\x3e\n              </md-input-container>\n\n              <div ng-if="vm.dynamics365Account.modernAuthentication == true">\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLOUD_PROVIDER">Cloud Provider</label>\n                  <md-select ng-model="vm.dynamics365Account.CloudProviderId" placeholder="Cloud Provider connection" ng-required="true">\n                    <md-option value="{{provider.id}}" ng-repeat="provider in vm.cloudProviders.rows">{{provider.name}}</md-option>\n                  </md-select>\n                </md-input-container>\n              </div>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div ng-if="vm.dynamics365Account.modernAuthentication == false">\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                  <input type="password" name="password" ng-model="vm.dynamics365Account.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" ng-required="vm.dynamics365Account.modernAuthentication == false">\n                  <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                    </div>\n                    <div ng-message="pattern">\n                      <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.URI">Uri</label>\n                  <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.remoteUri" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.TENANTID">TenantId</label>\n                  <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'tenantId\'].$error" ng-show="generalForm[\'tenantId\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.TENANTID_REQUIRED">TenantId field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                  <input type="text" name="clientId" ng-model="vm.dynamics365Account.clientId" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                  <input type="text" name="clientSecret" ng-model="vm.dynamics365Account.clientSecret" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                  <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" value="LOCALIP" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                  <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n              </div>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.dynamics365Account.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="dynamics365Account-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="Dynamics365AccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.dynamics365Account, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDynamics365Configuration($event)" class="md-icon-button" aria-label="create dynamics365Configuration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="dynamics365Configuration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedDynamics365Configuration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getDynamics365Configuration($index)">\n                    <span class="text-truncate" flex="80">{{ dynamics365Configuration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteDynamics365Configuration($event, dynamics365Configuration)" translate="INTEGRATIONS.DELETE_DYNAMICS365CONFIGURATION">\n                            Delete Dynamics365Configuration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">ADVANCED</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div class="dynamics365Account-detail-form-container general md-background-bg">\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="INTEGRATIONS.ADVANCED">ADVANCED</div>\n                        </div>\n                        <form name="vm_cc.advancedForm" novalidate>\n                          <md-input-container class="md-block">\n                            <label translate="INTEGRATIONS.MODULECREATE">Module Create</label>\n                            <md-select name="type" ng-model="vm_cc.dynamics365Configuration.moduleCreate" required>\n                              <md-option ng-value="\'contact\'">{{\'INTEGRATIONS.DYNAMIC365CONTACT\' | translate}}</md-option>\n                              <md-option ng-value="\'nothing\'">{{\'INTEGRATIONS.DYNAMIC365NOTHING\' | translate}}</md-option>\n                            </md-select>\n                            <div ng-messages="vm_cc.advancedForm[\'moduleCreate\'].$error" ng-show="vm_cc.advancedForm[\'moduleCreate\'].$touched" role="alert">\n                              <div ng-message="required">\n                                <span translate="INTEGRATIONS.ERRORS.MODULECREATE_REQUIRED">Type field is required</span>\n                              </div>\n                            </div>\n                          </md-input-container>\n\n\n                          <md-input-container class="md-block">\n                            <md-switch ng-model="vm_cc.dynamics365Configuration.openNewTab">\n                              <span translate="INTEGRATIONS.OPENNEWTAB">Open new tab</span>\n                            </md-switch>\n                          </md-input-container>\n\n\n                          <md-input-container class="md-block">\n                            <label translate="INTEGRATIONS.ADDITIONALSEARCHCONTACT">Additional search contact</label>\n                            <input type="" name="additionalSearchContact" ng-model="vm_cc.dynamics365Configuration.additionalSearchContact" autofocus>\n                          </md-input-container>\n                          <div layout="row" layout-align="end center">\n                            <md-button type="submit" ng-click="vm_cc.saveDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="vm_cc.advancedForm.$invalid || vm_cc.advancedForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n                              SAVE\n                            </md-button>\n                          </div>\n                        </form>\n                      </div>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDynamics365Configuration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n          </div>\n\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",'<md-dialog class="freshdeskAccount-dialog" aria-label="New FreshdeskAccount">\n  <form name="freshdeskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.freshdeskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshdeskAccountForm[\'name\'].$error" ng-show="freshdeskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.freshdeskAccount.username" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'username\'].$error" ng-show="freshdeskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.freshdeskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'remoteUri\'].$error" ng-show="freshdeskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.freshdeskAccount.apiKey" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'apiKey\'].$error" ng-show="freshdeskAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.freshdeskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="freshdeskAccountForm[\'serverUrl\'].$error" ng-show="freshdeskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.freshdeskAccount.description">\n\n        <div ng-messages="freshdeskAccountForm[\'description\'].$error" ng-show="freshdeskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshdeskAccount" ng-click="vm.saveFreshdeskAccount()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountForm.$invalid || freshdeskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshdeskAccount" ng-click="vm.addNewFreshdeskAccount()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHDESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKACCOUNT">\n          ADD FRESHDESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshdeskAccount" ng-click="vm.deleteFreshdeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",'<md-dialog class="freshdeskConfiguration-dialog" aria-label="New FreshdeskConfiguration">\n  <form name="freshdeskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.freshdeskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshdeskConfigurationForm[\'name\'].$error" ng-show="freshdeskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.freshdeskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshdeskConfigurationForm[\'channel\'].$error" ng-show="freshdeskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.freshdeskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshdeskConfigurationForm[\'type\'].$error" ng-show="freshdeskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshdeskConfiguration" ng-click="vm.saveFreshdeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshdeskConfigurationForm.$invalid || freshdeskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshdeskConfiguration" ng-click="vm.addNewFreshdeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshdeskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHDESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKCONFIGURATION">\n          ADD FRESHDESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshdeskConfiguration" ng-click="vm.deleteFreshdeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",'<md-dialog class="freshdeskAccount-item-dialog" aria-label="New Item">\n  <form name="freshdeskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="freshdeskAccountItemForm.content.$error" ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="freshdeskAccountItemForm.key.$error" ng-show="freshdeskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.keyType.$error" ng-show="freshdeskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="freshdeskAccountItemForm.keyContent.$error" ng-show="freshdeskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.variableName.$error" ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.customField.$error" ng-show="freshdeskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountItemForm.$invalid || freshdeskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountItemForm.$invalid || freshdeskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="freshdeskAccountItemForm.option.$error" ng-show="freshdeskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="freshdeskAccountItemForm.content.$error" ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="freshdeskAccountItemForm.variableName.$error" ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="freshdeskAccountItemForm.content.$error"\n          ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="freshdeskAccountItemForm.variableName.$error"\n          ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/view.html",'<div id="integrations-freshdeskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-freshdeskAccounts-button md-icon-button" aria-label="Go to freshdeskAccounts" ng-click="vm.gotoFreshdeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_FRESHDESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="freshdeskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/freshdeskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.freshdeskAccount.id}}\n            <span ng-if="vm.freshdeskAccount.name">{{vm.freshdeskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.freshdeskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFreshdeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshdeskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.freshdeskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.freshdeskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.freshdeskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.freshdeskAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.freshdeskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.freshdeskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshdeskAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="FreshdeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.freshdeskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshdeskConfiguration($event)" class="md-icon-button" aria-label="create freshdeskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="freshdeskConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedFreshdeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getFreshdeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ freshdeskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteFreshdeskConfiguration($event, freshdeskConfiguration)" translate="INTEGRATIONS.DELETE_FRESHDESKCONFIGURATION">\n                            Delete FreshdeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshdeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/freshdeskAccounts.html",'<div id="freshdeskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.FRESHDESKACCOUNTS">FreshdeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFreshdeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFreshdeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-freshdeskAccounts-count">\n          <span>{{vm.selectedFreshdeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFreshdeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFreshdeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFreshdeskAccounts" csv-label="true" filename="freshdeskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFreshdeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FRESHDESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFreshdeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFreshdeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.freshdeskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="freshdeskAccount" md-select-id="id" ng-repeat="freshdeskAccount in vm.freshdeskAccounts.rows">\n                <td md-cell ng-if="freshdeskAccount.userpic"><img class="avatar" alt="{{freshdeskAccount.name}}" ng-src="api/users/{{freshdeskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!freshdeskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{freshdeskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="id ">{{freshdeskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="name ">{{freshdeskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="username ">{{freshdeskAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="remoteUri ">{{freshdeskAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(freshdeskAccount, $event    )" translate="INTEGRATIONS.EDIT_FRESHDESKACCOUNT">\n                          Edit FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(freshdeskAccount, $event    )" translate="INTEGRATIONS.TEST_FRESHDESKACCOUNT">\n                          Test FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(freshdeskAccount, $event    )" translate="INTEGRATIONS.DELETE_FRESHDESKACCOUNT">\n                          Delete FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.freshdeskAccounts.count}}" md-on-paginate="vm.getFreshdeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FRESHDESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FRESHDESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-freshdeskAccount-button" ng-click="vm.createOrEditFreshdeskAccount($event)" aria-label="add freshdeskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FRESHDESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/create/dialog.html",'<md-dialog class="freshsalesAccount-dialog" aria-label="New FreshsalesAccount">\n  <form name="freshsalesAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.freshsalesAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshsalesAccountForm[\'name\'].$error" ng-show="freshsalesAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.freshsalesAccount.username" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'username\'].$error" ng-show="freshsalesAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.freshsalesAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'remoteUri\'].$error" ng-show="freshsalesAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.freshsalesAccount.apiKey" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'apiKey\'].$error" ng-show="freshsalesAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.freshsalesAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="freshsalesAccountForm[\'serverUrl\'].$error" ng-show="freshsalesAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.freshsalesAccount.description">\n\n        <div ng-messages="freshsalesAccountForm[\'description\'].$error" ng-show="freshsalesAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshsalesAccount" ng-click="vm.saveFreshsalesAccount()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountForm.$invalid || freshsalesAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshsalesAccount" ng-click="vm.addNewFreshsalesAccount()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHSALESACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESACCOUNT">\n          ADD FRESHSALESACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshsalesAccount" ng-click="vm.deleteFreshsalesAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/configurations/dialog.html",'<md-dialog class="freshsalesConfiguration-dialog" aria-label="New FreshsalesConfiguration">\n  <form name="freshsalesConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.freshsalesConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshsalesConfigurationForm[\'name\'].$error" ng-show="freshsalesConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.freshsalesConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshsalesConfigurationForm[\'channel\'].$error" ng-show="freshsalesConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.freshsalesConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshsalesConfigurationForm[\'type\'].$error" ng-show="freshsalesConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshsalesConfiguration" ng-click="vm.saveFreshsalesConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshsalesConfigurationForm.$invalid || freshsalesConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshsalesConfiguration" ng-click="vm.addNewFreshsalesConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshsalesConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHSALESCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESCONFIGURATION">\n          ADD FRESHSALESCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshsalesConfiguration" ng-click="vm.deleteFreshsalesConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",'<md-dialog class="freshsalesAccount-item-dialog" aria-label="New Item">\n  <form name="freshsalesAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="freshsalesAccountItemForm.content.$error" ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="freshsalesAccountItemForm.key.$error" ng-show="freshsalesAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.keyType.$error" ng-show="freshsalesAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="freshsalesAccountItemForm.keyContent.$error" ng-show="freshsalesAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.variableName.$error" ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.customField.$error" ng-show="freshsalesAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountItemForm.$invalid || freshsalesAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountItemForm.$invalid || freshsalesAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="freshsalesAccountItemForm.option.$error" ng-show="freshsalesAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="freshsalesAccountItemForm.content.$error" ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="freshsalesAccountItemForm.variableName.$error" ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="freshsalesAccountItemForm.content.$error"\n          ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="freshsalesAccountItemForm.variableName.$error"\n          ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/view.html",'<div id="integrations-freshsalesAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-freshsalesAccounts-button md-icon-button" aria-label="Go to freshsalesAccounts" ng-click="vm.gotoFreshsalesAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_FRESHSALESACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="freshsalesAccount-image" hide-xs>\n          <img ng-src="assets/images/business/freshsalesAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.freshsalesAccount.id}}\n            <span ng-if="vm.freshsalesAccount.name">{{vm.freshsalesAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.freshsalesAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFreshsalesAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshsalesAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.freshsalesAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.freshsalesAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.freshsalesAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.freshsalesAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.freshsalesAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.freshsalesAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshsalesAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="FreshsalesAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.freshsalesAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshsalesConfiguration($event)" class="md-icon-button" aria-label="create freshsalesConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="freshsalesConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedFreshsalesConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getFreshsalesConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ freshsalesConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteFreshsalesConfiguration($event, freshsalesConfiguration)" translate="INTEGRATIONS.DELETE_FRESHSALESCONFIGURATION">\n                            Delete FreshsalesConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshsalesConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/freshsalesAccounts.html",'<div id="freshsalesAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.FRESHSALESACCOUNTS">FreshsalesAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFreshsalesAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFreshsalesAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-freshsalesAccounts-count">\n          <span>{{vm.selectedFreshsalesAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFreshsalesAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFreshsalesAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFreshsalesAccounts" csv-label="true" filename="freshsalesAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFreshsalesAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FRESHSALESACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFreshsalesAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFreshsalesAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.freshsalesAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="freshsalesAccount" md-select-id="id" ng-repeat="freshsalesAccount in vm.freshsalesAccounts.rows">\n                <td md-cell ng-if="freshsalesAccount.userpic"><img class="avatar" alt="{{freshsalesAccount.name}}" ng-src="api/users/{{freshsalesAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!freshsalesAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{freshsalesAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="id ">{{freshsalesAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="name ">{{freshsalesAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="username ">{{freshsalesAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="remoteUri ">{{freshsalesAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(freshsalesAccount, $event    )" translate="INTEGRATIONS.EDIT_FRESHSALESACCOUNT">\n                          Edit FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(freshsalesAccount, $event    )" translate="INTEGRATIONS.TEST_FRESHSALESACCOUNT">\n                          Test FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(freshsalesAccount, $event    )" translate="INTEGRATIONS.DELETE_FRESHSALESACCOUNT">\n                          Delete FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.freshsalesAccounts.count}}" md-on-paginate="vm.getFreshsalesAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FRESHSALESACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FRESHSALESACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-freshsalesAccount-button" ng-click="vm.createOrEditFreshsalesAccount($event)" aria-label="add freshsalesAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FRESHSALESACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",'<md-dialog class="salesforceAccount-dialog" aria-label="New SalesforceAccount">\n  <form name="salesforceAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.salesforceAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="salesforceAccountForm[\'name\'].$error" ng-show="salesforceAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.salesforceAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceAccountForm[\'type\'].$error" ng-show="salesforceAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.salesforceAccount.username" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'username\'].$error" ng-show="salesforceAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.salesforceAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'remoteUri\'].$error" ng-show="salesforceAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.salesforceAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="salesforceAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n        <input type="text" name="clientId" ng-model="vm.salesforceAccount.clientId" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'clientId\'].$error" ng-show="salesforceAccountForm[\'clientId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n        <input type="text" name="clientSecret" ng-model="vm.salesforceAccount.clientSecret" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'clientSecret\'].$error" ng-show="salesforceAccountForm[\'clientSecret\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.SECURITYTOKEN">SecurityToken</label>\n        <input type="text" name="securityToken" ng-model="vm.salesforceAccount.securityToken" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'securityToken\'].$error" ng-show="salesforceAccountForm[\'securityToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.SECURITYTOKEN_REQUIRED">SecurityToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.salesforceAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="salesforceAccountForm[\'serverUrl\'].$error" ng-show="salesforceAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.salesforceAccount.description">\n\n        <div ng-messages="salesforceAccountForm[\'description\'].$error" ng-show="salesforceAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSalesforceAccount" ng-click="vm.saveSalesforceAccount()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountForm.$invalid || salesforceAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSalesforceAccount" ng-click="vm.addNewSalesforceAccount()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SALESFORCEACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCEACCOUNT">\n          ADD SALESFORCEACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSalesforceAccount" ng-click="vm.deleteSalesforceAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",'<md-dialog class="salesforceConfiguration-dialog" aria-label="New SalesforceConfiguration">\n  <form name="salesforceConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.salesforceConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="salesforceConfigurationForm[\'name\'].$error" ng-show="salesforceConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.salesforceConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'channel\'].$error" ng-show="salesforceConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.salesforceConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'type\'].$error" ng-show="salesforceConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TICKETTYPE">TicketType</label>\n        <md-select name="ticketType" ng-model="vm.salesforceConfiguration.ticketType" required>\n\n          <md-option ng-value="\'Task\'"> {{ \'INTEGRATIONS.TASK\' | translate }} </md-option>\n\n          <md-option ng-value="\'Case\'"> {{ \'INTEGRATIONS.CASE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'ticketType\'].$error" ng-show="salesforceConfigurationForm[\'ticketType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TICKETTYPE_REQUIRED">TicketType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSalesforceConfiguration" ng-click="vm.saveSalesforceConfiguration()" class="send-button md-accent md-raised" ng-disabled="salesforceConfigurationForm.$invalid || salesforceConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSalesforceConfiguration" ng-click="vm.addNewSalesforceConfiguration()" class="send-button md-accent md-raised" ng-disabled="salesforceConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SALESFORCECONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCECONFIGURATION">\n          ADD SALESFORCECONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSalesforceConfiguration" ng-click="vm.deleteSalesforceConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",'<md-dialog class="salesforceAccount-item-dialog" aria-label="New Item">\n  <form name="salesforceAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="salesforceAccountItemForm.content.$error" ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="salesforceAccountItemForm.key.$error" ng-show="salesforceAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.keyType.$error" ng-show="salesforceAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="salesforceAccountItemForm.keyContent.$error" ng-show="salesforceAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.variableName.$error" ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.customField.$error" ng-show="salesforceAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountItemForm.$invalid || salesforceAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountItemForm.$invalid || salesforceAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="salesforceAccountItemForm.option.$error" ng-show="salesforceAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="salesforceAccountItemForm.content.$error" ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="salesforceAccountItemForm.variableName.$error" ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="salesforceAccountItemForm.content.$error"\n          ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="salesforceAccountItemForm.variableName.$error"\n          ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/view.html",'<div id="integrations-salesforceAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-salesforceAccounts-button md-icon-button" aria-label="Go to salesforceAccounts" ng-click="vm.gotoSalesforceAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SALESFORCEACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="salesforceAccount-image" hide-xs>\n          <img ng-src="assets/images/business/salesforceAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.salesforceAccount.id}}\n            <span ng-if="vm.salesforceAccount.name">{{vm.salesforceAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.salesforceAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSalesforceAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="salesforceAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.salesforceAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.salesforceAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.salesforceAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.salesforceAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.salesforceAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                <input type="text" name="clientId" ng-model="vm.salesforceAccount.clientId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                <input type="text" name="clientSecret" ng-model="vm.salesforceAccount.clientSecret" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.SECURITYTOKEN">SecurityToken</label>\n                <input type="text" name="securityToken" ng-model="vm.salesforceAccount.securityToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'securityToken\'].$error" ng-show="generalForm[\'securityToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.SECURITYTOKEN_REQUIRED">SecurityToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.salesforceAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.salesforceAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="salesforceAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="SalesforceAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.salesforceAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSalesforceConfiguration($event)" class="md-icon-button" aria-label="create salesforceConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="salesforceConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedSalesforceConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getSalesforceConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ salesforceConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteSalesforceConfiguration($event, salesforceConfiguration)" translate="INTEGRATIONS.DELETE_SALESFORCECONFIGURATION">\n                            Delete SalesforceConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">\n                        ADVANCED\n                      </span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_SEARCH"></label>\n                        <md-select ng-model="vm_cc.salesforceConfiguration.moduleSearch" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'account_contact_lead\', value: \'Account & Contact & Lead\'}, {key: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}, {key: \'account\', value: \'Account\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_CREATE"></label>\n                        <md-select ng-model="vm_cc.salesforceConfiguration.moduleCreate" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'nothing\', value: \'Nothing\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}, {key: \'account\', value: \'Account\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isLead">\n                        <label translate="INTEGRATIONS.LEADID"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.leadId" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.LEADID"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isAccountSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHACCOUNT"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchAccount" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHACCOUNT"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isContactSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHCONTACT"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchContact" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHCONTACT"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isLeadSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHLEAD"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchLead" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHLEAD"></span></div>\n                      </div>\n\n                      <md-button type="submit" ng-click="vm_cc.saveSalesforceConfiguration()" ng-disabled="!vm_cc.crudPermissions.canEdit" class="send-button md-accent md-raised" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n                        SAVE\n                      </md-button>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSalesforceConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/salesforceAccounts/salesforceAccounts.html",'<div id="salesforceAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SALESFORCEACCOUNTS">SalesforceAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSalesforceAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSalesforceAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-salesforceAccounts-count">\n          <span>{{vm.selectedSalesforceAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSalesforceAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSalesforceAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSalesforceAccounts" csv-label="true" filename="salesforceAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSalesforceAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SALESFORCEACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSalesforceAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSalesforceAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.salesforceAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="salesforceAccount" md-select-id="id" ng-repeat="salesforceAccount in vm.salesforceAccounts.rows">\n                <td md-cell ng-if="salesforceAccount.userpic"><img class="avatar" alt="{{salesforceAccount.name}}" ng-src="api/users/{{salesforceAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!salesforceAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{salesforceAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="id ">{{salesforceAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="name ">{{salesforceAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="username ">{{salesforceAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="remoteUri ">{{salesforceAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(salesforceAccount, $event    )" translate="INTEGRATIONS.EDIT_SALESFORCEACCOUNT">\n                          Edit SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(salesforceAccount, $event    )" translate="INTEGRATIONS.TEST_SALESFORCEACCOUNT">\n                          Test SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(salesforceAccount, $event    )" translate="INTEGRATIONS.DELETE_SALESFORCEACCOUNT">\n                          Delete SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.salesforceAccounts.count}}" md-on-paginate="vm.getSalesforceAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SALESFORCEACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SALESFORCEACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-salesforceAccount-button" ng-click="vm.createOrEditSalesforceAccount($event)" aria-label="add salesforceAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCEACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SALESFORCEACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/servicenowAccounts/create/dialog.html",'<md-dialog class="servicenowAccount-dialog" aria-label="New ServicenowAccount">\n  <form name="servicenowAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.servicenowAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="servicenowAccountForm[\'name\'].$error" ng-show="servicenowAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.servicenowAccount.username" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'username\'].$error" ng-show="servicenowAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.servicenowAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="servicenowAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.servicenowAccount.email" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'email\'].$error" ng-show="servicenowAccountForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="INTEGRATIONS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <input type="url" name="remoteUri" ng-model="vm.servicenowAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'remoteUri\'].$error" ng-show="servicenowAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.servicenowAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="servicenowAccountForm[\'serverUrl\'].$error" ng-show="servicenowAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.servicenowAccount.description">\n\n        <div ng-messages="servicenowAccountForm[\'description\'].$error" ng-show="servicenowAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newServicenowAccount" ng-click="vm.saveServicenowAccount()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountForm.$invalid || servicenowAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newServicenowAccount" ng-click="vm.addNewServicenowAccount()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SERVICENOWACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWACCOUNT">\n          ADD SERVICENOWACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newServicenowAccount" ng-click="vm.deleteServicenowAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",'<md-dialog class="servicenowConfiguration-dialog" aria-label="New ServicenowConfiguration">\n  <form name="servicenowConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.servicenowConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="servicenowConfigurationForm[\'name\'].$error" ng-show="servicenowConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.servicenowConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="servicenowConfigurationForm[\'channel\'].$error" ng-show="servicenowConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.servicenowConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="servicenowConfigurationForm[\'type\'].$error" ng-show="servicenowConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newServicenowConfiguration" ng-click="vm.saveServicenowConfiguration()" class="send-button md-accent md-raised" ng-disabled="servicenowConfigurationForm.$invalid || servicenowConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newServicenowConfiguration" ng-click="vm.addNewServicenowConfiguration()" class="send-button md-accent md-raised" ng-disabled="servicenowConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SERVICENOWCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWCONFIGURATION">\n          ADD SERVICENOWCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newServicenowConfiguration" ng-click="vm.deleteServicenowConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",'<md-dialog class="servicenowAccount-item-dialog" aria-label="New Item">\n  <form name="servicenowAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="servicenowAccountItemForm.content.$error" ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="servicenowAccountItemForm.key.$error" ng-show="servicenowAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.keyType.$error" ng-show="servicenowAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="servicenowAccountItemForm.keyContent.$error" ng-show="servicenowAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.variableName.$error" ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.customField.$error" ng-show="servicenowAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountItemForm.$invalid || servicenowAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountItemForm.$invalid || servicenowAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="servicenowAccountItemForm.option.$error" ng-show="servicenowAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="servicenowAccountItemForm.content.$error" ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="servicenowAccountItemForm.variableName.$error" ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="servicenowAccountItemForm.content.$error"\n          ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="servicenowAccountItemForm.variableName.$error"\n          ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/view.html",'<div id="integrations-servicenowAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-servicenowAccounts-button md-icon-button" aria-label="Go to servicenowAccounts" ng-click="vm.gotoServicenowAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SERVICENOWACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="servicenowAccount-image" hide-xs>\n          <img ng-src="assets/images/business/servicenowAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.servicenowAccount.id}}\n            <span ng-if="vm.servicenowAccount.name">{{vm.servicenowAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.servicenowAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveServicenowAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="servicenowAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.servicenowAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.servicenowAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.servicenowAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.servicenowAccount.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="INTEGRATIONS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <input type="url" name="remoteUri" ng-model="vm.servicenowAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.servicenowAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.servicenowAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="servicenowAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ServicenowAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.servicenowAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditServicenowConfiguration($event)" class="md-icon-button" aria-label="create servicenowConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="servicenowConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedServicenowConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getServicenowConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ servicenowConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteServicenowConfiguration($event, servicenowConfiguration)" translate="INTEGRATIONS.DELETE_SERVICENOWCONFIGURATION">\n                            Delete ServicenowConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditServicenowConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/servicenowAccounts/servicenowAccounts.html",'<div id="servicenowAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SERVICENOWACCOUNTS">ServicenowAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedServicenowAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedServicenowAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-servicenowAccounts-count">\n          <span>{{vm.selectedServicenowAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllServicenowAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectServicenowAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedServicenowAccounts" csv-label="true" filename="servicenowAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedServicenowAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SERVICENOWACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedServicenowAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getServicenowAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'INTEGRATIONS.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.servicenowAccounts.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="servicenowAccount" md-select-id="id" ng-repeat="servicenowAccount in vm.servicenowAccounts.rows">\n                <td md-cell ng-if="servicenowAccount.userpic"><img class="avatar" alt="{{servicenowAccount.name}}" ng-src="api/users/{{servicenowAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!servicenowAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{servicenowAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="id ">{{servicenowAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="name ">{{servicenowAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="username ">{{servicenowAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="email ">{{servicenowAccount.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="remoteUri ">{{servicenowAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(servicenowAccount, $event    )" translate="INTEGRATIONS.EDIT_SERVICENOWACCOUNT">\n                          Edit ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(servicenowAccount, $event    )" translate="INTEGRATIONS.TEST_SERVICENOWACCOUNT">\n                          Test ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.crudPermissions === 0 || vm.currentUser.role === \'admin\'">\n\n                        <md-button ng-click="vm.deleteconfirm(servicenowAccount, $event    )" translate="INTEGRATIONS.DELETE_SERVICENOWACCOUNT">\n                          Delete ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.servicenowAccounts.count}}" md-on-paginate="vm.getServicenowAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SERVICENOWACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SERVICENOWACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-servicenowAccount-button" ng-click="vm.createOrEditServicenowAccount($event)" aria-label="add servicenowAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SERVICENOWACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",'<md-dialog class="sugarcrmAccount-dialog" aria-label="New SugarcrmAccount">\n  <form name="sugarcrmAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.sugarcrmAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="sugarcrmAccountForm[\'name\'].$error" ng-show="sugarcrmAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.sugarcrmAccount.username" ng-required="true">\n\n        <div ng-messages="sugarcrmAccountForm[\'username\'].$error" ng-show="sugarcrmAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.sugarcrmAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="sugarcrmAccountForm[\'remoteUri\'].$error" ng-show="sugarcrmAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.sugarcrmAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="sugarcrmAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.sugarcrmAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="sugarcrmAccountForm[\'serverUrl\'].$error" ng-show="sugarcrmAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.sugarcrmAccount.description">\n\n        <div ng-messages="sugarcrmAccountForm[\'description\'].$error" ng-show="sugarcrmAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSugarcrmAccount" ng-click="vm.saveSugarcrmAccount()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountForm.$invalid || sugarcrmAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSugarcrmAccount" ng-click="vm.addNewSugarcrmAccount()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SUGARCRMACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMACCOUNT">\n          ADD SUGARCRMACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSugarcrmAccount" ng-click="vm.deleteSugarcrmAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",'<md-dialog class="sugarcrmConfiguration-dialog" aria-label="New SugarcrmConfiguration">\n  <form name="sugarcrmConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.sugarcrmConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="sugarcrmConfigurationForm[\'name\'].$error" ng-show="sugarcrmConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.sugarcrmConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="sugarcrmConfigurationForm[\'channel\'].$error" ng-show="sugarcrmConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.sugarcrmConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="sugarcrmConfigurationForm[\'type\'].$error" ng-show="sugarcrmConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSugarcrmConfiguration" ng-click="vm.saveSugarcrmConfiguration()" class="send-button md-accent md-raised" ng-disabled="sugarcrmConfigurationForm.$invalid || sugarcrmConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSugarcrmConfiguration" ng-click="vm.addNewSugarcrmConfiguration()" class="send-button md-accent md-raised" ng-disabled="sugarcrmConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SUGARCRMCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMCONFIGURATION">\n          ADD SUGARCRMCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSugarcrmConfiguration" ng-click="vm.deleteSugarcrmConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",'<md-dialog class="sugarcrmAccount-item-dialog" aria-label="New Item">\n  <form name="sugarcrmAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="sugarcrmAccountItemForm.key.$error" ng-show="sugarcrmAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.keyType.$error" ng-show="sugarcrmAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="sugarcrmAccountItemForm.keyContent.$error" ng-show="sugarcrmAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.customField.$error" ng-show="sugarcrmAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="sugarcrmAccountItemForm.option.$error" ng-show="sugarcrmAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="sugarcrmAccountItemForm.content.$error"\n          ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="sugarcrmAccountItemForm.variableName.$error"\n          ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/view.html",'<div id="integrations-sugarcrmAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-sugarcrmAccounts-button md-icon-button" aria-label="Go to sugarcrmAccounts" ng-click="vm.gotoSugarcrmAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SUGARCRMACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="sugarcrmAccount-image" hide-xs>\n          <img ng-src="assets/images/business/sugarcrmAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.sugarcrmAccount.id}}\n            <span ng-if="vm.sugarcrmAccount.name">{{vm.sugarcrmAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.sugarcrmAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSugarcrmAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="sugarcrmAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.sugarcrmAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.sugarcrmAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.sugarcrmAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.sugarcrmAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.sugarcrmAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.sugarcrmAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="sugarcrmAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="SugarcrmAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.sugarcrmAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSugarcrmConfiguration($event)" class="md-icon-button" aria-label="create sugarcrmConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="sugarcrmConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedSugarcrmConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getSugarcrmConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ sugarcrmConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteSugarcrmConfiguration($event, sugarcrmConfiguration)" translate="INTEGRATIONS.DELETE_SUGARCRMCONFIGURATION">\n                            Delete SugarcrmConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSugarcrmConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/sugarcrmAccounts.html",'<div id="sugarcrmAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SUGARCRMACCOUNTS">SugarcrmAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSugarcrmAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSugarcrmAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-sugarcrmAccounts-count">\n          <span>{{vm.selectedSugarcrmAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSugarcrmAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSugarcrmAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSugarcrmAccounts" csv-label="true" filename="sugarcrmAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSugarcrmAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SUGARCRMACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSugarcrmAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSugarcrmAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.sugarcrmAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="sugarcrmAccount" md-select-id="id" ng-repeat="sugarcrmAccount in vm.sugarcrmAccounts.rows">\n                <td md-cell ng-if="sugarcrmAccount.userpic"><img class="avatar" alt="{{sugarcrmAccount.name}}" ng-src="api/users/{{sugarcrmAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!sugarcrmAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{sugarcrmAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="id ">{{sugarcrmAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="name ">{{sugarcrmAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="username ">{{sugarcrmAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="remoteUri ">{{sugarcrmAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(sugarcrmAccount, $event    )" translate="INTEGRATIONS.EDIT_SUGARCRMACCOUNT">\n                          Edit SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(sugarcrmAccount, $event    )" translate="INTEGRATIONS.TEST_SUGARCRMACCOUNT">\n                          Test SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(sugarcrmAccount, $event    )" translate="INTEGRATIONS.DELETE_SUGARCRMACCOUNT">\n                          Delete SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.sugarcrmAccounts.count}}" md-on-paginate="vm.getSugarcrmAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SUGARCRMACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SUGARCRMACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-sugarcrmAccount-button" ng-click="vm.createOrEditSugarcrmAccount($event)" aria-label="add sugarcrmAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SUGARCRMACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/vtigerAccounts/create/dialog.html",'<md-dialog class="vtigerAccount-dialog" aria-label="New VtigerAccount">\n  <form name="vtigerAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.vtigerAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="vtigerAccountForm[\'name\'].$error" ng-show="vtigerAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.vtigerAccount.description">\n\n        <div ng-messages="vtigerAccountForm[\'description\'].$error" ng-show="vtigerAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.VTIGER_USER_NAME">vTiger_User_Name</label>\n        <input type="text" name="username" ng-model="vm.vtigerAccount.username" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'username\'].$error" ng-show="vtigerAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.VTIGER_USER_NAME_REQUIRED">vTiger_User_Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.ACCESS_KEY">Access_Key</label>\n        <input type="text" name="accessKey" ng-model="vm.vtigerAccount.accessKey" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'accessKey\'].$error" ng-show="vtigerAccountForm[\'accessKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.ACCESS_KEY_REQUIRED">Access_Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <input type="url" name="remoteUri" ng-model="vm.vtigerAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'remoteUri\'].$error" ng-show="vtigerAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.vtigerAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="vtigerAccountForm[\'serverUrl\'].$error" ng-show="vtigerAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVtigerAccount" ng-click="vm.saveVtigerAccount()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountForm.$invalid || vtigerAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVtigerAccount" ng-click="vm.addNewVtigerAccount()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_VTIGERACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERACCOUNT">\n          ADD VTIGERACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVtigerAccount" ng-click="vm.deleteVtigerAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",'<md-dialog class="vtigerConfiguration-dialog" aria-label="New VtigerConfiguration">\n  <form name="vtigerConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.vtigerConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="vtigerConfigurationForm[\'name\'].$error" ng-show="vtigerConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.vtigerConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="vtigerConfigurationForm[\'channel\'].$error" ng-show="vtigerConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.vtigerConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="vtigerConfigurationForm[\'type\'].$error" ng-show="vtigerConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVtigerConfiguration" ng-click="vm.saveVtigerConfiguration()" class="send-button md-accent md-raised" ng-disabled="vtigerConfigurationForm.$invalid || vtigerConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVtigerConfiguration" ng-click="vm.addNewVtigerConfiguration()" class="send-button md-accent md-raised" ng-disabled="vtigerConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_VTIGERCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERCONFIGURATION">\n          ADD VTIGERCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVtigerConfiguration" ng-click="vm.deleteVtigerConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",'<md-dialog class="vtigerAccount-item-dialog" aria-label="New Item">\n  <form name="vtigerAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="vtigerAccountItemForm.key.$error" ng-show="vtigerAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.keyType.$error" ng-show="vtigerAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="vtigerAccountItemForm.keyContent.$error" ng-show="vtigerAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.customField.$error" ng-show="vtigerAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="vtigerAccountItemForm.option.$error" ng-show="vtigerAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="vtigerAccountItemForm.content.$error"\n          ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="vtigerAccountItemForm.variableName.$error"\n          ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/view.html",'<div id="integrations-vtigerAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-vtigerAccounts-button md-icon-button" aria-label="Go to vtigerAccounts" ng-click="vm.gotoVtigerAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_VTIGERACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="vtigerAccount-image" hide-xs>\n          <img ng-src="assets/images/business/vtigerAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.vtigerAccount.id}}\n            <span ng-if="vm.vtigerAccount.name">{{vm.vtigerAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.vtigerAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVtigerAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="vtigerAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.vtigerAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.vtigerAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.VTIGER_USER_NAME">vTiger_User_Name</label>\n                <input type="text" name="username" ng-model="vm.vtigerAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.VTIGER_USER_NAME_REQUIRED">vTiger_User_Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.ACCESS_KEY">Access_Key</label>\n                <input type="text" name="accessKey" ng-model="vm.vtigerAccount.accessKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accessKey\'].$error" ng-show="generalForm[\'accessKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.ACCESS_KEY_REQUIRED">Access_Key field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <input type="url" name="remoteUri" ng-model="vm.vtigerAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.vtigerAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="vtigerAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="VtigerAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.vtigerAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditVtigerConfiguration($event)" class="md-icon-button" aria-label="create vtigerConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="vtigerConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedVtigerConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getVtigerConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ vtigerConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteVtigerConfiguration($event, vtigerConfiguration)" translate="INTEGRATIONS.DELETE_VTIGERCONFIGURATION">\n                            Delete VtigerConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditVtigerConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/vtigerAccounts/vtigerAccounts.html",'<div id="vtigerAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.VTIGERACCOUNTS">VtigerAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVtigerAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVtigerAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-vtigerAccounts-count">\n          <span>{{vm.selectedVtigerAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVtigerAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVtigerAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVtigerAccounts" csv-label="true" filename="vtigerAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVtigerAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VTIGERACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVtigerAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVtigerAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.VTIGER_USER_NAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.vtigerAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="vtigerAccount" md-select-id="id" ng-repeat="vtigerAccount in vm.vtigerAccounts.rows">\n                <td md-cell ng-if="vtigerAccount.userpic"><img class="avatar" alt="{{vtigerAccount.name}}" ng-src="api/users/{{vtigerAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!vtigerAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{vtigerAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="id ">{{vtigerAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="name ">{{vtigerAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="username ">{{vtigerAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="remoteUri ">{{vtigerAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(vtigerAccount, $event    )" translate="INTEGRATIONS.EDIT_VTIGERACCOUNT">\n                          Edit VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(vtigerAccount, $event    )" translate="INTEGRATIONS.TEST_VTIGERACCOUNT">\n                          Test VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(vtigerAccount, $event    )" translate="INTEGRATIONS.DELETE_VTIGERACCOUNT">\n                          Delete VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.vtigerAccounts.count}}" md-on-paginate="vm.getVtigerAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VTIGERACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VTIGERACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-vtigerAccount-button" ng-click="vm.createOrEditVtigerAccount($event)" aria-label="add vtigerAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VTIGERACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",'<md-dialog class="zendeskAccount-dialog" aria-label="New ZendeskAccount">\n  <form name="zendeskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.zendeskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="zendeskAccountForm[\'name\'].$error" ng-show="zendeskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zendeskAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskAccountForm[\'type\'].$error" ng-show="zendeskAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.zendeskAccount.username" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'username\'].$error" ng-show="zendeskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.zendeskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'remoteUri\'].$error" ng-show="zendeskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n        <md-select name="authType" ng-model="vm.zendeskAccount.authType" required>\n          <md-option ng-value="\'password\'">Password</md-option>\n          <md-option ng-value="\'token\'">Token</md-option>\n        </md-select>\n        <div ng-messages="zendeskAccountForm[\'authType\'].$error" ng-show="zendeskAccountForm[\'authType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.zendeskAccount.authType == \'password\'">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.zendeskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="zendeskAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.zendeskAccount.authType == \'token\'" class="md-block">\n        <label translate="INTEGRATIONS.TOKEN">Token</label>\n        <input type="text" name="token" ng-model="vm.zendeskAccount.token" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'token\'].$error" ng-show="zendeskAccountForm[\'token\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TOKEN_REQUIRED">Token field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.zendeskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="zendeskAccountForm[\'serverUrl\'].$error" ng-show="zendeskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.zendeskAccount.description">\n\n        <div ng-messages="zendeskAccountForm[\'description\'].$error" ng-show="zendeskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZendeskAccount" ng-click="vm.saveZendeskAccount()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountForm.$invalid || zendeskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZendeskAccount" ng-click="vm.addNewZendeskAccount()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZENDESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKACCOUNT">\n          ADD ZENDESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZendeskAccount" ng-click="vm.deleteZendeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",'<md-dialog class="zendeskAccount-item-dialog" aria-label="New Item">\n  <form name="zendeskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="zendeskAccountItemForm.content.$error" ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="zendeskAccountItemForm.key.$error" ng-show="zendeskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.keyType.$error" ng-show="zendeskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="zendeskAccountItemForm.keyContent.$error" ng-show="zendeskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.variableName.$error" ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.customField.$error" ng-show="zendeskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountItemForm.$invalid || zendeskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountItemForm.$invalid || zendeskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="zendeskAccountItemForm.option.$error" ng-show="zendeskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="zendeskAccountItemForm.content.$error" ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="zendeskAccountItemForm.variableName.$error" ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="zendeskAccountItemForm.content.$error"\n          ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="zendeskAccountItemForm.variableName.$error"\n          ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/view.html",'<div id="integrations-zendeskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-zendeskAccounts-button md-icon-button" aria-label="Go to zendeskAccounts" ng-click="vm.gotoZendeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_ZENDESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="zendeskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/zendeskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.zendeskAccount.id}}\n            <span ng-if="vm.zendeskAccount.name">{{vm.zendeskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.zendeskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveZendeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (zendeskConfigurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zendeskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.zendeskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.zendeskAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.zendeskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.zendeskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n                <md-select name="authType" ng-model="vm.zendeskAccount.authType" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'password\'">Password</md-option>\n                  <md-option ng-value="\'token\'">Token</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'authType\'].$error" ng-show="generalForm[\'authType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.zendeskAccount.authType == \'password\'">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.zendeskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.zendeskAccount.authType == \'token\'" class="md-block">\n                <label translate="INTEGRATIONS.TOKEN">Token</label>\n                <input type="text" name="token" ng-model="vm.zendeskAccount.token" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'token\'].$error" ng-show="generalForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TOKEN_REQUIRED">Token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.zendeskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.zendeskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zendeskAccount-detail-form-container zendeskconfigurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.ZENDESKCONFIGURATIONS">ZENDESKCONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ZendeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.zendeskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZendeskConfiguration($event)" class="md-icon-button" aria-label="create zendeskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="zendeskConfiguration in vm_cc.zendeskConfigurations" class="border-top" md-colors="{background: (vm_cc.selectedZendeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getZendeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ zendeskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteZendeskConfiguration($event, zendeskConfiguration)" translate="INTEGRATIONS.DELETE_ZENDESKCONFIGURATION">\n                            Delete ZendeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.zendeskConfigurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.zendeskConfigurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZendeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",'<md-dialog class="zendeskConfiguration-dialog" aria-label="New ZendeskConfiguration">\n  <form name="zendeskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.zendeskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="zendeskConfigurationForm[\'name\'].$error" ng-show="zendeskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.zendeskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskConfigurationForm[\'channel\'].$error" ng-show="zendeskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zendeskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskConfigurationForm[\'type\'].$error" ng-show="zendeskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZendeskConfiguration" ng-click="vm.saveZendeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="zendeskConfigurationForm.$invalid || zendeskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZendeskConfiguration" ng-click="vm.addNewZendeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="zendeskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZENDESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKCONFIGURATION">\n          ADD ZENDESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZendeskConfiguration" ng-click="vm.deleteZendeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zendeskAccounts/zendeskAccounts.html",'<div id="zendeskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.ZENDESKACCOUNTS">ZendeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedZendeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedZendeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-zendeskAccounts-count">\n          <span>{{vm.selectedZendeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllZendeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectZendeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedZendeskAccounts" csv-label="true" filename="zendeskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedZendeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ZENDESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedZendeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getZendeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.zendeskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="zendeskAccount" md-select-id="id" ng-repeat="zendeskAccount in vm.zendeskAccounts.rows">\n                <td md-cell ng-if="zendeskAccount.userpic"><img class="avatar" alt="{{zendeskAccount.name}}" ng-src="api/users/{{zendeskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!zendeskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{zendeskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="id ">{{zendeskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="name ">{{zendeskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="username ">{{zendeskAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="remoteUri ">{{zendeskAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(zendeskAccount, $event    )" translate="INTEGRATIONS.EDIT_ZENDESKACCOUNT">\n                          Edit ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(zendeskAccount, $event    )" translate="INTEGRATIONS.TEST_ZENDESKACCOUNT">\n                          Test ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(zendeskAccount, $event    )" translate="INTEGRATIONS.DELETE_ZENDESKACCOUNT">\n                          Delete ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.zendeskAccounts.count}}" md-on-paginate="vm.getZendeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ZENDESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ZENDESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-zendeskAccount-button" ng-click="vm.createOrEditZendeskAccount($event)" aria-label="add zendeskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ZENDESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/zohoAccounts/create/dialog.html",'<md-dialog class="zohoAccount-dialog" aria-label="New ZohoAccount">\n  <form name="zohoAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.zohoAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="zohoAccountForm[\'name\'].$error" ng-show="zohoAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <md-select name="host" ng-model="vm.zohoAccount.host" required>\n          <md-option ng-value="\'zoho.com\'">zoho.com</md-option>\n          <md-option ng-value="\'zoho.eu\'">zoho.eu</md-option>\n        </md-select>\n        <div ng-messages="zohoAccountForm[\'host\'].$error" ng-show="zohoAccountForm[\'host\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.ZONE">Zone</label>\n        <md-select name="zone" ng-model="vm.zohoAccount.zone" required>\n          <md-option ng-value="\'US\'">US</md-option>\n          <md-option ng-value="\'AU\'">AU</md-option>\n          <md-option ng-value="\'EU\'">EU</md-option>\n          <md-option ng-value="\'IN\'">IN</md-option>\n          <md-option ng-value="\'CN\'">CN</md-option>\n        </md-select>\n        <div class="hint"><span translate="INTEGRATIONS.HELP.ZONE"></span></div>\n        <div ng-messages="zohoAccountForm[\'zone\'].$error" ng-show="zohoAccountForm[\'zone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.ZONE_REQUIRED">Zone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n        <input type="text" name="clientId" ng-model="vm.zohoAccount.clientId" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTID"></span></div>\n        <div ng-messages="zohoAccountForm[\'clientId\'].$error" ng-show="zohoAccountForm[\'clientId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n        <input type="text" name="clientSecret" ng-model="vm.zohoAccount.clientSecret" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTSECRET"></span></div>\n        <div ng-messages="zohoAccountForm[\'clientSecret\'].$error" ng-show="zohoAccountForm[\'clientSecret\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CODE">Code</label>\n        <input type="text" name="code" ng-model="vm.zohoAccount.code" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CODE"></span></div>\n        <div ng-messages="zohoAccountForm[\'code\'].$error" ng-show="zohoAccountForm[\'code\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CODE_REQUIRED">Code field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.zohoAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="zohoAccountForm[\'serverUrl\'].$error" ng-show="zohoAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.zohoAccount.description">\n\n        <div ng-messages="zohoAccountForm[\'description\'].$error" ng-show="zohoAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZohoAccount" ng-click="vm.saveZohoAccount()" class="send-button md-accent md-raised" ng-disabled="zohoAccountForm.$invalid || zohoAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZohoAccount" ng-click="vm.addNewZohoAccount()" class="send-button md-accent md-raised" ng-disabled="zohoAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZOHOACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOACCOUNT">\n          ADD ZOHOACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZohoAccount" ng-click="vm.deleteZohoAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",'<md-dialog class="zohoConfiguration-dialog" aria-label="New ZohoConfiguration">\n  <form name="zohoConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.zohoConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="zohoConfigurationForm[\'name\'].$error" ng-show="zohoConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.zohoConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zohoConfigurationForm[\'channel\'].$error" ng-show="zohoConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zohoConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zohoConfigurationForm[\'type\'].$error" ng-show="zohoConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZohoConfiguration" ng-click="vm.saveZohoConfiguration()" class="send-button md-accent md-raised" ng-disabled="zohoConfigurationForm.$invalid || zohoConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZohoConfiguration" ng-click="vm.addNewZohoConfiguration()" class="send-button md-accent md-raised" ng-disabled="zohoConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZOHOCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOCONFIGURATION">\n          ADD ZOHOCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZohoConfiguration" ng-click="vm.deleteZohoConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",'<md-dialog class="zohoAccount-item-dialog" aria-label="New Item">\n  <form name="zohoAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="zohoAccountItemForm.content.$error" ng-show="zohoAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="zohoAccountItemForm.key.$error" ng-show="zohoAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.keyType.$error" ng-show="zohoAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="zohoAccountItemForm.keyContent.$error" ng-show="zohoAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.variableName.$error" ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.customField.$error" ng-show="zohoAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="zohoAccountItemForm.$invalid || zohoAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="zohoAccountItemForm.$invalid || zohoAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="zohoAccountItemForm.option.$error" ng-show="zohoAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="zohoAccountItemForm.content.$error" ng-show="zohoAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="zohoAccountItemForm.variableName.$error" ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="zohoAccountItemForm.content.$error"\n          ng-show="zohoAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="zohoAccountItemForm.variableName.$error"\n          ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/view.html",'<div id="integrations-zohoAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-zohoAccounts-button md-icon-button" aria-label="Go to zohoAccounts" ng-click="vm.gotoZohoAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_ZOHOACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="zohoAccount-image" hide-xs>\n          <img ng-src="assets/images/business/zohoAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.zohoAccount.id}}\n            <span ng-if="vm.zohoAccount.name">{{vm.zohoAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.zohoAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveZohoAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zohoAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.zohoAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <md-select name="host" ng-model="vm.zohoAccount.host" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'zoho.com\'">zoho.com</md-option>\n                  <md-option ng-value="\'zoho.eu\'">zoho.eu</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.ZONE">Zone</label>\n                <md-select name="zone" ng-model="vm.zohoAccount.zone" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'US\'">US</md-option>\n                  <md-option ng-value="\'AU\'">AU</md-option>\n                  <md-option ng-value="\'EU\'">EU</md-option>\n                  <md-option ng-value="\'IN\'">IN</md-option>\n                  <md-option ng-value="\'CN\'">CN</md-option>\n                </md-select>\n                <div class="hint"><span translate="INTEGRATIONS.HELP.ZONE"></span></div>\n                <div ng-messages="generalForm[\'zone\'].$error" ng-show="generalForm[\'zone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.ZONE_REQUIRED">Zone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                <input type="text" name="clientId" ng-model="vm.zohoAccount.clientId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTID"></span></div>\n                <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                <input type="text" name="clientSecret" ng-model="vm.zohoAccount.clientSecret" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTSECRET"></span></div>\n                <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CODE">Code</label>\n                <input type="text" name="code" ng-model="vm.zohoAccount.code" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CODE"></span></div>\n                <div ng-messages="generalForm[\'code\'].$error" ng-show="generalForm[\'code\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CODE_REQUIRED">Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.REFRESHTOKEN">RefreshToken</label>\n                <input type="text" name="refreshToken" ng-model="vm.zohoAccount.refreshToken" disabled>\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.REFRESHTOKEN"></span></div>\n                <div ng-messages="generalForm[\'refreshToken\'].$error" ng-show="generalForm[\'refreshToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.REFRESHTOKEN_REQUIRED">RefreshToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.zohoAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.zohoAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zohoAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ZohoAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.zohoAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZohoConfiguration($event)" class="md-icon-button" aria-label="create zohoConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="zohoConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedZohoConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getZohoConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ zohoConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteZohoConfiguration($event, zohoConfiguration)" translate="INTEGRATIONS.DELETE_ZOHOCONFIGURATION">\n                            Delete ZohoConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">\n                        ADVANCED\n                      </span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_SEARCH"></label>\n                        <md-select ng-model="vm_cc.zohoConfiguration.moduleSearch" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_CREATE"></label>\n                        <md-select ng-model="vm_cc.zohoConfiguration.moduleCreate" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'nothing\', value: \'Nothing\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZohoConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/zohoAccounts/zohoAccounts.html",'<div id="zohoAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.ZOHOACCOUNTS">ZohoAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedZohoAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedZohoAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-zohoAccounts-count">\n          <span>{{vm.selectedZohoAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllZohoAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectZohoAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedZohoAccounts" csv-label="true" filename="zohoAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedZohoAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ZOHOACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedZohoAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getZohoAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="host">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column md-order-by="zone">{{ \'INTEGRATIONS.ZONE\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.zohoAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="zohoAccount" md-select-id="id" ng-repeat="zohoAccount in vm.zohoAccounts.rows">\n                <td md-cell ng-if="zohoAccount.userpic"><img class="avatar" alt="{{zohoAccount.name}}" ng-src="api/users/{{zohoAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!zohoAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{zohoAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="id ">{{zohoAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="name ">{{zohoAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="host ">{{ vm.arrayhost[zohoAccount.host].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="zone ">{{ vm.arrayzone[zohoAccount.zone].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(zohoAccount, $event    )" translate="INTEGRATIONS.EDIT_ZOHOACCOUNT">\n                          Edit ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(zohoAccount, $event    )" translate="INTEGRATIONS.TEST_ZOHOACCOUNT">\n                          Test ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(zohoAccount, $event    )" translate="INTEGRATIONS.DELETE_ZOHOACCOUNT">\n                          Delete ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.zohoAccounts.count}}" md-on-paginate="vm.getZohoAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ZOHOACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ZOHOACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-zohoAccount-button" ng-click="vm.createOrEditZohoAccount($event)" aria-label="add zohoAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ZOHOACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/jscripty/views/projects/create/dialog.html",'<md-dialog class="project-dialog" aria-label="New Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newProject">\n\n        <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n        <div ng-messages="projectForm[\'name\'].$error" ng-show="projectForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.project.description">\n\n        <div ng-messages="projectForm[\'description\'].$error" ng-show="projectForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newProject" ng-click="vm.saveProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="SAVE" translate="JSCRIPTY.SAVE" translate-attr-aria-label="JSCRIPTY.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newProject" ng-click="vm.addNewProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid" aria-label="ADD" translate="JSCRIPTY.ADD_PROJECT" translate-attr-aria-label="JSCRIPTY.ADD_PROJECT">\n          ADD PROJECT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newProject" ng-click="vm.deleteProject($event)" aria-label="DELETE" translate translate-attr-aria-label="JSCRIPTY.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="JSCRIPTY.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/clone/clone.html",'<md-dialog class="project-dialog" aria-label="Clone Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newProject">\n\n        <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n        <div ng-messages="projectForm[\'name\'].$error" ng-show="projectForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid" aria-label="CLONE" translate="JSCRIPTY.CLONE_PROJECT" translate-attr-aria-label="JSCRIPTY.CLONE_PROJECT">\n        CLONE PROJECT\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",'<md-dialog class="session-dialog" aria-label="New Session">\n  <form name="sessionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-list>\n        <md-subheader class="md-no-sticky">\n          <div class="margin-bottom-5"><span translate="JSCRIPTY.ANSWERS">Answers</span></div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.STARTTIME" class="ng-scope font-weight-700">Start Time</span>: <span class="ng-binding">{{vm.session.starttime | date:\'medium\'}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.MEMBERNAME" class="ng-scope font-weight-700">Member Name</span>: <span class="ng-binding">{{vm.session.membername}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.PROJECT" class="ng-scope font-weight-700">Project</span>: <span class="ng-binding">{{vm.project.name}}</span>\n          </div>\n        </md-subheader>\n        <md-list-item ng-if="vm.questions.rows.length" class="md-2-line contact-item" ng-repeat="question in vm.questions.rows">\n          <div class="md-list-item-text compact">\n            <h3>{{$index+1}}. {{question.question}}</h3>\n            <p>{{question.answer}}</p>\n          </div>\n          <md-divider ng-if="!$last"></md-divider>\n        </md-list-item>\n        <md-list-item ng-if="!vm.questions.rows.length" class="md-2-line contact-item">\n          <div class="md-list-item-text compact">\n            <h3><span class="text-boxed-light" translate="JSCRIPTY.NO_RESULTS_AVAILABLE">No results available</span></h3>\n          </div>\n        </md-list-item>\n      </md-list>\n\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/view.html",'<div id="jscripty-project" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-projects-button md-icon-button" aria-label="Go to projects" ng-click="vm.gotoProjects()" translate translate-attr-aria-label="JSCRIPTY.GO_TO_PROJECTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="project-image" hide-xs>\n          <img ng-src="assets/images/business/projects.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.project.id}}\n            <span ng-if="vm.project.name">{{vm.project.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.CREATED_AT"></span> <span>{{vm.project.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.project, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="JSCRIPTY.CLONE_PROJECT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveProject()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (builderForm.$invalid) || (previewForm.$invalid) || (sessionsForm.$invalid) || (answersForm.$invalid)" translate="JSCRIPTY.SAVE" translate-attr-aria-label="JSCRIPTY.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="JSCRIPTY.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="JSCRIPTY.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.project.enableUncompleteSave" aria-label="EnableUncompleteSave" ng-disabled="!vm.crudPermissions.canEdit"><span translate="JSCRIPTY.ENABLEUNCOMPLETESAVE">EnableUncompleteSave</span></md-switch>\n                <div class="hint"><span translate="JSCRIPTY.HELP.ENABLEUNCOMPLETESAVE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.project.sendUnpauseOnSubmit" aria-label="SendUnpauseOnSubmit" ng-disabled="!vm.crudPermissions.canEdit"><span translate="JSCRIPTY.SENDUNPAUSEONSUBMIT">SendUnpauseOnSubmit</span></md-switch>\n                <div class="hint"><span translate="JSCRIPTY.HELP.SENDUNPAUSEONSUBMIT"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="JSCRIPTY.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.project.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="JSCRIPTY.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.BUILDER">BUILDER</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container builder md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectBuilderController as vm_bc" ng-init="vm_bc.init(vm.project)">\n              <mw-form-builder ng-if="vm_bc.project.formData" form-data="vm_bc.project.formData" options="vm_bc.optionsBuilder" read-only="false"></mw-form-builder>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.PREVIEW">PREVIEW</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container preview md-background-bg md-whiteframe-1dp">\n            <div layout="column" layout-align="center" ng-controller="ProjectViewerController as vm_vc" ng-init="vm_vc.init(vm.project)">\n              <div layout="row" layout-align="center">\n                <md-button class="md-raised md-accent" aria-label="Reset" ng-click="vm_vc.resetViewer()">\n                  Reset\n                </md-button>\n              </div>\n              <mw-form-viewer ng-if="vm_vc.project.formData" form-data="vm_vc.project.formData" response-data="vm_vc.responseData" on-submit="vm_vc.onSubmit($event)" api="vm_vc.formViewer"></mw-form-viewer>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.SESSIONS">SESSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container sessions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectSessionsController as vm_dc" ng-init="vm_dc.init(vm.project, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedProjectSessions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="JSCRIPTY.SESSIONS">Sessions</span>\n                  <ms-search-bar on-search="vm_dc.getProjectSessions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedProjectSessions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedProjectSessions.length}} {{vm_dc.selectedProjectSessions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedProjectSessions" csv-label="true" filename="projects.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedProjectSessions($event)" aria-label="delete selected" translate translate-attr-label="JSCRIPTY.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedProjectSessions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getProjectSessions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'JSCRIPTY.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'JSCRIPTY.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'JSCRIPTY.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="membername">\n                        {{ \'JSCRIPTY.MEMBERNAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'JSCRIPTY.CALLERIDNUM\' | translate }}\n                      </th>\n                      <th md-column md-order-by="completed">\n                        {{ \'JSCRIPTY.COMPLETE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="session" md-select-id="id" ng-repeat="session in vm_dc.projectSessions.rows">\n                      <td md-cell>\n                        {{session.id}}\n                      </td>\n                      <td md-cell>\n                        {{ session.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ session.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{session.membername}}\n                      </td>\n                      <td md-cell>\n                        {{session.calleridnum}}\n                      </td>\n                      <td md-cell class="completed ">\n                        <md-icon md-colors="{color: {{session.completed ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{session.completed? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="JSCRIPTY.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.showQuestionsProjectSession($event, session)" translate="JSCRIPTY.SHOW_QUESTIONS_SESSION">\n                                Results Session\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(session, $event)" translate="JSCRIPTY.DELETE_SESSION">\n                                Delete Session\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.projectSessions.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="JSCRIPTY.NO_SESSION_AVAILABLE">No session available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'JSCRIPTY.PAGE\' | translate}}:\', rowsPerPage: \'{{\'JSCRIPTY.ROWSPERPAGE\' | translate}}:\', of: \'{{\'JSCRIPTY.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.projectSessions.count}}" md-on-paginate="vm_dc.getProjectSessions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.ANSWERS">ANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container answers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectAnswersController as vm_an" ng-init="vm_an.init(vm.project, vm.userProfile)">\n              <div class="pb-16" layout="row">\n                <div class="h2 secondary-text" translate="JSCRIPTY.ANSWERS" flex>Answers</div>\n                <div layout="row" layout-align="space-between center" flex>\n                  <md-date-range localization-map="vm_an.localizationMap" ng-model="vm_an.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm_an.getAnswers()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                  <md-button type="button" ng-if="vm_an.currentUser.role === \'admin\' || vm_an.userProfile.downloadJscriptySessions" ng-disabled="!vm_an.answers" ng-click="vm_an.getSummary($event)" class="md-accent md-raised md-button ng-scope md-default-theme md-ink-ripple md-green-500-bg md-icon-button" title="{{\'JSCRIPTY.EXPORT_TO_CSV\' | translate}}">\n                    <md-icon md-font-icon="icon-file-excel" class="md-default-theme md-font material-icons icon-file-excel"></md-icon>\n                  </md-button>\n                </div>\n              </div>\n              <div layout="row">\n                <md-card class="md-whiteframe-1dp" ng-if="vm_an.answers && vm_an.hasIdAnswers" flex>\n                  <md-list>\n                    <md-list-item class="md-2-line contact-item" ng-repeat="(key, question) in vm_an.answers">\n                      <div class="md-list-item-text compact" layout-padding>\n                        <h3>{{question.question}}</h3>\n                        <md-table-container>\n                          <table md-table>\n                            <thead md-head>\n                              <tr md-row>\n                                <th md-column></th>\n                                <th md-column>#</th>\n                                <th md-column>%</th>\n                              </tr>\n                            </thead>\n                            <tbody md-body>\n                              <tr md-row ng-repeat="(key, value) in question.answers">\n                                <td md-cell>{{key}}</td>\n                                <td md-cell width="20px">{{value}}</td>\n                                <td md-cell width="20px">{{value*100/question.sum | number:1}}</td>\n                              </tr>\n                              <tr md-row>\n                                <td md-cell><b>{{\'JSCRIPTY.TOTAL\' | translate}}</b></td>\n                                <td md-cell width="20px"><b>{{question.sum}}</b></td>\n                                <td md-cell width="20px"><b>100</b></td>\n                              </tr>\n                            </tbody>\n                          </table>\n                        </md-table-container>\n                      </div>\n                      <md-divider ng-if="!$last"></md-divider>\n                    </md-list-item>\n                  </md-list>\n                </md-card>\n                <span ng-if="!vm_an.answers || !vm_an.hasIdAnswers" class="text-boxed-light" translate="JSCRIPTY.NO_ANSWERS_AVAILABLE">No answers available</span>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/jscripty/views/projects/projects.html",'<div id="projects" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-script" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="JSCRIPTY.PROJECTS">Projects</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="JSCRIPTY.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedProjects.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedProjects =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="JSCRIPTY.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-projects-count">\n          <span>{{vm.selectedProjects.length}}</span>\n          <span translate="JSCRIPTY.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="JSCRIPTY.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllProjects()" translate="JSCRIPTY.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectProjects()" translate="JSCRIPTY.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedProjects" csv-label="true" filename="projects.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedProjects($event)" aria-label="delete selected" translate translate-attr-label="JSCRIPTY.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- PROJECT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedProjects" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getProjects">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'JSCRIPTY.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'JSCRIPTY.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'JSCRIPTY.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'JSCRIPTY.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.projects.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="JSCRIPTY.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="project" md-select-id="id" ng-repeat="project in vm.projects.rows">\n                <td md-cell ng-if="project.userpic"><img class="avatar" alt="{{project.name}}" ng-src="api/users/{{project.id}}/avatar" /></td>\n                <td md-cell ng-if="!project.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{project.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="id ">{{project.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="name ">{{project.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="description ">{{project.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="createdAt ">{{project.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="JSCRIPTY.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(project, $event    )" translate="JSCRIPTY.EDIT_PROJECT">\n                          Edit Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(project, $event    )" translate="JSCRIPTY.CLONE_PROJECT">\n                          clone Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.sessionsgoto(project, $event    )" translate="JSCRIPTY.SESSIONS_PROJECT">\n                          Sessions Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(project, $event    )" translate="JSCRIPTY.DELETE_PROJECT">\n                          Delete Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'JSCRIPTY.PAGE\' | translate}}:\', rowsPerPage: \'{{\'JSCRIPTY.ROWSPERPAGE\' | translate}}:\', of: \'{{\'JSCRIPTY.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.projects.count}}" md-on-paginate="vm.getProjects" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PROJECT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PROJECT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-project-button" ng-click="vm.createOrEditProject($event)" aria-label="add project" translate translate-attr-aria-label="JSCRIPTY.ADD_PROJECT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PROJECT BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/mailAccounts/create/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newMailAccount ? \'MAIL.NEW_MAILACCOUNT\' : \'MAIL.EDIT_MAILACCOUNT\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="mailAccountForm[\'name\'].$error" ng-show="mailAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.mailAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="mailAccountForm[\'key\'].$error" ng-show="mailAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="MAIL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.EMAIL_ADDRESS">Email Address</label>\n        <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true">\n\n        <div ng-messages="mailAccountForm[\'email\'].$error" ng-show="mailAccountForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.EMAIL_ADDRESS_REQUIRED">Email Address field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="MAIL.ERRORS.EMAIL_ADDRESS_MUST_VALID">Email Address must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.mailAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountForm[\'ListId\'].$error" ng-show="mailAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.mailAccount.active" aria-label="Active"><span translate="MAIL.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.newMailAccount" class="md-block">\n        <label translate="MAIL.SERVICE">Service</label>\n        <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" required>\n          <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountForm[\'provider\'].$error" ng-show="mailAccountForm[\'provider\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.SERVICE_REQUIRED">Service field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'">\n        <div layout="row">\n          <md-input-container class="md-block mr-20 mb-0" flex>\n            <label translate="MAIL.IMAP_HOST">IMAP_Host</label>\n            <input type="text" name="Imap.host" ng-model="vm.mailAccount.Imap.host" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Imap.host\'].$error" ng-show="mailAccountForm[\'Imap.host\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.IMAP_HOST_REQUIRED">IMAP_Host field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block mb-0">\n            <label translate="MAIL.IMAP_PORT">IMAP Port</label>\n            <input type="number" name="Imap.port" ng-model="vm.mailAccount.Imap.port" value="465" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Imap.port\'].$error" ng-show="mailAccountForm[\'Imap.port\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.IMAP_PORT_REQUIRED">IMAP Port field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n\n      <div ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'">\n        <div layout="row">\n          <md-input-container class="md-block mr-20 mb-0" flex>\n            <label translate="MAIL.SMTP_HOST">SMTP Host</label>\n            <input type="text" name="Smtp.host" ng-model="vm.mailAccount.Smtp.host" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Smtp.host\'].$error" ng-show="mailAccountForm[\'Smtp.host\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.SMTP_HOST_REQUIRED">SMTP Host field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block mb-0">\n            <label translate="MAIL.SMTP_PORT">SMTP Port</label>\n            <input type="number" name="Smtp.port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Smtp.port\'].$error" ng-show="mailAccountForm[\'Smtp.port\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.SMTP_PORT_REQUIRED">SMTP Port field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n\n      <md-input-container ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'" class="md-block pt-0">\n        <md-switch ng-model="vm.mailAccount.authentication" aria-label="Authentication"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.newMailAccount && vm.mailAccount.provider === \'outlook365\'" class="md-block">\n        <md-switch ng-model="vm.mailAccount.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n      </md-input-container>\n\n      <div ng-if="vm.newMailAccount && vm.mailAccount.authentication && vm.mailAccount.provider">\n        <md-input-container class="md-block">\n          <label translate="MAIL.USERNAME">Username</label>\n          <input type="text" name="username" ng-model="vm.mailAccount.username" ng-required="true">\n          <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n          <div ng-messages="mailAccountForm[\'username\'].$error" ng-show="mailAccountForm[\'username\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.mailAccount.modernAuthentication" class="md-block">\n          <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n          <md-select name="cloudProvider" ng-model="vm.mailAccount.CloudProviderId" required>\n            <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n          </md-select>\n          <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n          <div ng-messages="mailAccountForm[\'cloudProvider\'].$error" ng-show="mailAccountForm[\'cloudProvider\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="!vm.mailAccount.modernAuthentication" class="md-block">\n          <label translate="MAIL.PASSWORD">Password</label>\n          <input type="password" name="password" ng-model="vm.mailAccount.password" translate-attr-placeholder="MAIL.PASSWORD" required>\n          <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n          <div ng-messages="mailAccountForm[\'password\'].$error" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailAccount.description">\n        <div ng-messages="mailAccountForm[\'description\'].$error" ng-show="mailAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailAccount" ng-click="vm.saveMailAccount()" class="send-button md-accent md-raised" ng-disabled="mailAccountForm.$invalid || mailAccountForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailAccount" ng-click="vm.addNewMailAccount()" class="send-button md-accent md-raised" ng-disabled="mailAccountForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILACCOUNT" translate-attr-aria-label="MAIL.ADD_MAILACCOUNT">\n          ADD MAIL ACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailAccount" ng-click="vm.deleteMailAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",'<md-dialog class="mailAccount-dialog" aria-label="mailAccount" ng-init="vm.onInit()">\n  <form name="mailAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.AGENTADD_MAILACCOUNT">Add Agent to mailAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/agent/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'agent\'].$error" ng-show="mailAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'timeout\'].$error" ng-show="mailAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'times\'].$error" ng-show="mailAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.REPLY_TYPE">Reply_Type</label>\n        <md-select name="replyType" ng-model="vm.autoreply.replyType" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="0">Reply</md-option>\n          <md-option ng-value="1">Reply All</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'replyType\'].$error" ng-show="mailAccountFormApp[\'replyType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.REPLY_TYPE_REQUIRED">Reply_Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="MAIL.TEXT">Text</label>\n        <textarea aria-label="Text text" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.autoreply.text"></textarea>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/close/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'disposition\'].$error" ng-show="mailAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'condition\'].$error" ng-show="mailAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'truepriority\'].$error" ng-show="mailAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'falsepriority\'].$error" ng-show="mailAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'priority\'].$error" ng-show="mailAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/noop/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'value\'].$error" ng-show="mailAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/queue/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'queue\'].$error" ng-show="mailAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'timeout\'].$error" ng-show="mailAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/system/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'command\'].$error" ng-show="mailAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'variable\'].$error" ng-show="mailAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/tag/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'tag\'].$error" ng-show="mailAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",'<md-dialog class="mailCannedAnswer-dialog" aria-label="New MailCannedAnswer">\n  <form name="mailCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.mailCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="mailCannedAnswerForm[\'key\'].$error" ng-show="mailCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="MAIL.VALUE">Value</label>\n        <textarea aria-label="Value value" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailCannedAnswer.value"></textarea>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailCannedAnswer.description">\n\n        <div ng-messages="mailCannedAnswerForm[\'description\'].$error" ng-show="mailCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailCannedAnswer" ng-click="vm.saveMailCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="mailCannedAnswerForm.$invalid || mailCannedAnswerForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailCannedAnswer" ng-click="vm.addNewMailCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="mailCannedAnswerForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILCANNEDANSWER" translate-attr-aria-label="MAIL.ADD_MAILCANNEDANSWER">\n          ADD MAILCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailCannedAnswer" ng-click="vm.deleteMailCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/view.html",'<div id="mail-mailAccount" class="page-layout simple tabbed" layout="column">\n\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-mailAccounts-button md-icon-button" aria-label="Go to mailAccounts" ng-click="vm.goToMailAccounts()" translate translate-attr-aria-label="MAIL.GO_TO_MAILACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="mailAccount-image" hide-xs>\n          <img ng-src="assets/images/business/mailAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.mailAccount.id}}\n            <span ng-if="vm.mailAccount.name">{{vm.mailAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MAIL.CREATED_AT"></span> <span>{{vm.mailAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.goToRealtime()" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MAIL.GOTO_MAILACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.addAgent(vm.mailAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MAIL.AGENTADD_MAILACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMailAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (credentialsForm.$invalid) || (templateForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (imapForm.$invalid) || (smtpForm.$invalid) || (dispositionForm.$invalid) || (mailDispositionsForm.$invalid) || (mailCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.mailAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="MAIL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SERVICE">Service</label>\n                <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" class="mb-20" required>\n                  <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'provider\'].$error" ng-show="generalForm[\'provider\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.EMAIL_ADDRESS">Email_Address</label>\n                <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.EMAIL_ADDRESS_REQUIRED">Email_Address field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="MAIL.ERRORS.EMAIL_ADDRESS_MUST_VALID">Email_Address must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.mailAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.active" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.markAsUnread" aria-label="mark_as_unread" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.MARK_AS_UNREAD">mark_as_unread</span></md-switch>\n                <div class="hint"><span translate="MAIL.HELP.MARK_AS_UNREAD"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.mailAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.mailAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="MAIL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.mailAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider !== \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.AUTHENTICATION">Authentication</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.CREDENTIALS">Credentials</div>\n            </div>\n            <form name="credentialsForm" novalidate>\n              <md-input-container ng-if="vm.mailAccount.provider === \'outlook365\'" class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.mailAccount.Imap.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="credentialsForm[\'username\'].$error" ng-show="credentialsForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Imap.modernAuthentication" class="md-block">\n                <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n                <md-select name="cloudProvider" ng-model="vm.mailAccount.Imap.CloudProviderId" required>\n                  <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n                <div ng-messages="credentialsForm[\'cloudProvider\'].$error" ng-show="credentialsForm[\'cloudProvider\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.mailAccount.Imap.modernAuthentication" class="md-block">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.mailAccount.Imap.password" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="credentialsForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container imap md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.IMAP">IMAP</div>\n            </div>\n            <form name="imapForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.tls" aria-label="ssl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SSL">ssl</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.MAILBOX">Mailbox</label>\n                <input type="text" name="Imap.mailbox" ng-model="vm.mailAccount.Imap.mailbox" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.mailbox\'].$error" ng-show="imapForm[\'Imap.mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MAILBOX_REQUIRED">mailbox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.CONNTIMEOUT">Connection Timeout</label>\n                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.connTimeout\'].$error" ng-show="imapForm[\'Imap.connTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_REQUIRED">Connection Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Connection Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AUTHTIMEOUT">Authorization Timeout</label>\n                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" value="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.authTimeout\'].$error" ng-show="imapForm[\'Imap.authTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_REQUIRED">Authorizazion Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Authorizazion Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider === \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.IMAP">IMAP</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container imap md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.IMAP">IMAP</div>\n            </div>\n            <form name="imapForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.IMAP_HOST">IMAP_Host</label>\n                <input type="text" name="Imap.host" ng-model="vm.mailAccount.Imap.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.host\'].$error" ng-show="imapForm[\'Imap.host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.IMAP_HOST_REQUIRED">IMAP_Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.IMAP_PORT">IMAP_Port</label>\n                <input type="number" name="Imap.port" ng-model="vm.mailAccount.Imap.port" value="465" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.port\'].$error" ng-show="imapForm[\'Imap.port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.IMAP_PORT_REQUIRED">IMAP_Port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.tls" aria-label="ssl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SSL">ssl</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.authentication" aria-label="Authentication" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Imap.authentication" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="Imap.user" ng-model="vm.mailAccount.Imap.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="imapForm[\'Imap.user\'].$error" ng-show="imapForm[\'Imap.user\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.mailAccount.Imap.authentication">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="Imap.password" ng-model="vm.mailAccount.Imap.password" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="imapForm[\'Imap.password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.MAILBOX">Mailbox</label>\n                <input type="text" name="Imap.mailbox" ng-model="vm.mailAccount.Imap.mailbox" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.mailbox\'].$error" ng-show="imapForm[\'Imap.mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MAILBOX_REQUIRED">mailbox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.CONNTIMEOUT">Connection Timeout</label>\n                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.connTimeout\'].$error" ng-show="imapForm[\'Imap.connTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_REQUIRED">Connection Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Connection Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AUTHTIMEOUT">Authorization Timeout</label>\n                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" value="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.authTimeout\'].$error" ng-show="imapForm[\'Imap.authTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_REQUIRED">Authorization Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Authorization Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider === \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.SMTP">SMTP</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container smtp md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.SMTP">SMTP</div>\n            </div>\n            <form name="smtpForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SMTP_HOST">SMTP_Host</label>\n                <input type="text" name="Smtp.host" ng-model="vm.mailAccount.Smtp.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="smtpForm[\'Smtp.host\'].$error" ng-show="smtpForm[\'Smtp.host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.SMTP_HOST_REQUIRED">SMTP_Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SMTP_PORT">SMTP_Port</label>\n                <input type="number" name="Smtp.port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="smtpForm[\'Smtp.port\'].$error" ng-show="smtpForm[\'Smtp.port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.SMTP_PORT_REQUIRED">SMTP_Port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Smtp.secure" aria-label="Secure" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SECURE">Secure</span></md-switch>\n                <div class="hint"><span translate="MAIL.HELP.SECURE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Smtp.authentication" aria-label="Authentication" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Smtp.authentication" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="Smtp.user" ng-model="vm.mailAccount.Smtp.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="smtpForm[\'Smtp.user\'].$error" ng-show="smtpForm[\'Smtp.user\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.mailAccount.Smtp.authentication">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="Smtp.pass" ng-model="vm.mailAccount.Smtp.pass" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="smtpForm[\'Smtp.pass\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container template md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.TEMPLATE">TEMPLATE</div>\n            </div>\n            <form name="templateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.FONT_FAMILY">Font_Family</label>\n                <ms-font-family name="fontFamily" ng-model="vm.mailAccount.fontFamily" required></ms-font-family>\n                <div class="hint"><span translate="MAIL.HELP.FONT_FAMILY"></span></div>\n                <div ng-messages="templateForm[\'fontFamily\'].$error" ng-show="templateForm[fontFamily].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FONT_FAMILY_REQUIRED">Font_Family field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.FONT_SIZE">Font_Size</label>\n                <input type="number" name="fontSize" ng-model="vm.mailAccount.fontSize" min="8" max="72" value="13" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MAIL.HELP.FONT_SIZE"></span></div>\n                <div ng-messages="templateForm[\'fontSize\'].$error" ng-show="templateForm[\'fontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_REQUIRED">Font_Size field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Font_Size must be a valid greater or equal than</span> <span>8</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">Font_Size must be a valid greater or equal than</span> <span>72</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="MAIL.TEMPLATE">Template</label>\n                <textarea aria-label="Template template" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailAccount.template"></textarea>\n              </div>\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="MAIL.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.queueTransfer == true" class="md-block">\n                <label translate="MAIL.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.mailAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.agentTransfer == true" class="md-block">\n                <label translate="MAIL.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.mailAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.mandatoryDisposition" class="md-block">\n                <label translate="MAIL.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.mailAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MAIL.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="MailAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="mailAccount-detail-form-container maildispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="MAIL.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add mail dispositions" translate translate-attr-label="MAIL.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="mailAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container mailcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountMailCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountMailCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MAIL.MAILCANNEDANSWERS">MailCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getMailAccountMailCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event)" aria-label="add mailCannedAnswer" translate translate-attr-label="MAIL.ADD_MAILCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMailAccountMailCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMailAccountMailCannedAnswers.length}} {{vm_dc.selectedMailAccountMailCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountMailCannedAnswers" csv-label="true" filename="mailAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMailAccountMailCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMailAccountMailCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountMailCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'MAIL.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'MAIL.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'MAIL.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'MAIL.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'MAIL.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="mailCannedAnswer" md-select-id="id" ng-repeat="mailCannedAnswer in vm_dc.mailAccountMailCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>{{mailCannedAnswer.value | htmlToPlaintext }}</td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{ mailCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" translate="MAIL.EDIT_MAILCANNEDANSWER">\n                                Edit MailCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(mailCannedAnswer, $event)" translate="MAIL.DELETE_MAILCANNEDANSWER">\n                                Delete MailCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.mailAccountMailCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MAIL.NO_MAILCANNEDANSWER_AVAILABLE">No mailcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.mailAccountMailCannedAnswers.count}}" md-on-paginate="vm_dc.getMailAccountMailCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.mailAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="MAIL.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedMailAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedMailAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedMailAccountApps.length}} {{vm_ac.selectedMailAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedMailAccountApps($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedMailAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.mailAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editMailAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.mailAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MAIL.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getMailAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getMailAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getMailAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="MAIL.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMailAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMailAccountInteractions.length}} {{vm_dc.selectedMailAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountInteractions" csv-label="true" filename="mailAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMailAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMailAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'MAIL.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'MAIL.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="subject">\n                        {{ \'MAIL.SUBJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'MAIL.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'MAIL.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'MAIL.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'MAIL.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'MAIL.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.mailAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <div class="width-300">\n                          <span class="text-truncate font-size-12">\n                            {{interaction.subject}}\n                          </span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'MAIL.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'MAIL.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spymailInteraction($event, interaction)" translate="MAIL.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.mailInteractionDownload(interaction, $event, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.mailInteractionDownload(interaction, $event)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="MAIL.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.mailAccountInteractions.rows.length">\n                      <td md-cell colspan="13">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MAIL.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.mailAccountInteractions.count}}" md-on-paginate="vm_dc.getMailAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n</div>'),e.put("app/main/apps/mail/views/mailAccounts/mailAccounts.html",'<div id="mailAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILACCOUNTS">MailAccounts</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n\n  <div ng-show="vm.selectedMailAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailAccounts-count">\n          <span>{{vm.selectedMailAccounts.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailAccounts()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailAccounts()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailAccounts" csv-label="true" filename="mailAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailAccounts($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailAccounts">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="provider">{{ \'MAIL.SERVICE\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'MAIL.KEY\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'MAIL.EMAIL_ADDRESS\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MAIL.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailAccount" md-select-id="id" ng-repeat="mailAccount in vm.mailAccounts.rows" ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)">\n                <td md-cell class="id">{{mailAccount.id}}</td>\n                <td md-cell class="name">{{mailAccount.name}}</td>\n                <td md-cell class="provider">{{ mailAccount.provider ? (mailAccount.provider | startcase) : (\'MAIL.CUSTOM\' | translate) }}</td>\n                <td md-cell class="key">{{mailAccount.key}}</td>\n                <td md-cell class="email">{{mailAccount.email}}</td>\n                <td md-cell class="active">\n                  <md-icon md-colors="{color: {{mailAccount.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{mailAccount.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td md-cell class="description ">{{mailAccount.description}}</td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(mailAccount, $event)" translate="MAIL.EDIT_MAILACCOUNT">\n                          Edit Email Account\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.verifySMTP(mailAccount, $event)" translate="MAIL.VERIFYSMTP_MAILACCOUNT">\n                          Verify SMTP\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.goToInteractions(mailAccount, $event)" translate="MAIL.INTERACTIONS_MAILACCOUNT">\n                          Go To Interactions\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.goToRealtime()" translate="MAIL.GOTOREALTIME_MAILACCOUNT">\n                          Go To Realtime\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.addAgent(mailAccount, $event)" translate="MAIL.AGENTADD_MAILACCOUNT">\n                          Add Agent To Email Account\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(mailAccount, $event)" translate="MAIL.DELETE_MAILACCOUNT">\n                          Delete Email Account\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailAccounts.count}}" md-on-paginate="vm.getMailAccounts" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailAccount-button" ng-click="vm.createOrEditMailAccount($event)" aria-label="add mailAccount" translate translate-attr-aria-label="MAIL.ADD_MAILACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n\n</div>'),e.put("app/main/apps/mail/views/mailQueues/create/dialog.html",'<md-dialog class="mailQueue-dialog" aria-label="New MailQueue">\n  <form name="mailQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newMailQueue">\n\n        <div class="hint"><span translate="MAIL.HELP.NAME"></span></div>\n        <div ng-messages="mailQueueForm[\'name\'].$error" ng-show="mailQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MAIL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.mailQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="mailQueueForm[\'strategy\'].$error" ng-show="mailQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.mailQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="mailQueueForm[\'timeout\'].$error" ng-show="mailQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailQueue.description">\n\n        <div ng-messages="mailQueueForm[\'description\'].$error" ng-show="mailQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailQueue" ng-click="vm.saveMailQueue()" class="send-button md-accent md-raised" ng-disabled="mailQueueForm.$invalid || mailQueueForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailQueue" ng-click="vm.addNewMailQueue()" class="send-button md-accent md-raised" ng-disabled="mailQueueForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILQUEUE" translate-attr-aria-label="MAIL.ADD_MAILQUEUE">\n          ADD MAILQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailQueue" ng-click="vm.deleteMailQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",'<md-dialog class="mailQueue-dialog" aria-label="mailQueue" ng-init="vm.onInit()">\n  <form name="mailQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.AGENTADD_MAILQUEUE">Add Agent to mailQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",'<md-dialog class="mailQueue-dialog" aria-label="mailQueue" ng-init="vm.onInit()">\n  <form name="mailQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/view.html",'<div id="mail-mailQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-mailQueues-button md-icon-button" aria-label="Go to mailQueues" ng-click="vm.gotoMailQueues()" translate translate-attr-aria-label="MAIL.GO_TO_MAILQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="mailQueue-image" hide-xs>\n          <img ng-src="assets/images/business/mailQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.mailQueue.id}}\n            <span ng-if="vm.mailQueue.name">{{vm.mailQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MAIL.CREATED_AT"></span> <span>{{vm.mailQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.mailQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="MAIL.TEAMADD_MAILQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.mailQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MAIL.AGENTADD_MAILQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMailQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.mailQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MAIL.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.mailQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.mailQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.mailQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/mail/views/mailQueues/mailQueues.html",'<div id="mailQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILQUEUES">MailQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMailQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailQueues-count">\n          <span>{{vm.selectedMailQueues.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailQueues()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailQueues()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailQueues" csv-label="true" filename="mailQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailQueues($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MAILQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'MAIL.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailQueue" md-select-id="id" ng-repeat="mailQueue in vm.mailQueues.rows">\n                <td md-cell ng-if="mailQueue.userpic"><img class="avatar" alt="{{mailQueue.name}}" ng-src="api/users/{{mailQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!mailQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="id ">{{mailQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="name ">{{mailQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="strategy ">{{ vm.arraystrategy[mailQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(mailQueue, $event    )" translate="MAIL.EDIT_MAILQUEUE">\n                          Edit MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(mailQueue, $event    )" translate="MAIL.TEAMADD_MAILQUEUE">\n                          teamadd MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(mailQueue, $event    )" translate="MAIL.AGENTADD_MAILQUEUE">\n                          agentadd MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(mailQueue, $event    )" translate="MAIL.DELETE_MAILQUEUE">\n                          Delete MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(mailQueue, $event    )" translate="MAIL.GOTOREALTIME_MAILQUEUE">\n                          goToRealtime MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailQueues.count}}" md-on-paginate="vm.getMailQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MAILQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MAILQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailQueue-button" ng-click="vm.createOrEditMailQueue($event)" aria-label="add mailQueue" translate translate-attr-aria-label="MAIL.ADD_MAILQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MAILQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/mailSubtatuses/create/dialog.html",'<md-dialog class="mailSubstatus-dialog" aria-label="New MailSubstatus">\n  <form name="mailSubstatusForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailSubstatus.name" ng-required="true" autofocus>\n\n        <div ng-messages="mailSubstatusForm[\'name\'].$error" ng-show="mailSubstatusForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailSubstatus.description">\n\n        <div ng-messages="mailSubstatusForm[\'description\'].$error" ng-show="mailSubstatusForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailSubstatus" ng-click="vm.saveMailSubstatus()" class="send-button md-accent md-raised" ng-disabled="mailSubstatusForm.$invalid || mailSubstatusForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailSubstatus" ng-click="vm.addNewMailSubstatus()" class="send-button md-accent md-raised" ng-disabled="mailSubstatusForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILSUBSTATUS" translate-attr-aria-label="MAIL.ADD_MAILSUBSTATUS">\n          ADD MAILSUBSTATUS\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailSubstatus" ng-click="vm.deleteMailSubstatus($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailSubtatuses/mailSubtatuses.html",'<div id="mailSubtatuses" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILSUBSTATUSES">MailSubstatuses</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMailSubstatuses.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailSubstatuses =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailSubtatuses-count">\n          <span>{{vm.selectedMailSubstatuses.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailSubstatuses()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailSubstatuses()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailSubstatuses" csv-label="true" filename="mailSubtatuses.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailSubstatuses($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MAILSUBSTATUS TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailSubstatuses" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailSubstatuses">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailSubtatuses.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailSubstatus" md-select-id="id" ng-repeat="mailSubstatus in vm.mailSubtatuses.rows">\n                <td md-cell ng-if="mailSubstatus.userpic"><img class="avatar" alt="{{mailSubstatus.name}}" ng-src="api/users/{{mailSubstatus.id}}/avatar" /></td>\n                <td md-cell ng-if="!mailSubstatus.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailSubstatus.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="id ">{{mailSubstatus.id}}</td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="name ">{{mailSubstatus.name}}</td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="description ">{{mailSubstatus.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(mailSubstatus, $event    )" translate="MAIL.EDIT_MAILSUBSTATUS">\n                          Edit MailSubstatus\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(mailSubstatus, $event    )" translate="MAIL.DELETE_MAILSUBSTATUS">\n                          Delete MailSubstatus\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailSubtatuses.count}}" md-on-paginate="vm.getMailSubstatuses" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MAILSUBSTATUS TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MAILSUBSTATUS BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailSubstatus-button" ng-click="vm.createOrEditMailSubstatus($event)" aria-label="add mailSubstatus" translate translate-attr-aria-label="MAIL.ADD_MAILSUBSTATUS">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MAILSUBSTATUS BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/realtime/accounts/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MAIL.ACCOUNTS">Accounts</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getMailAccounts()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- ACCOUNTS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailAccounts">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate}}</th>\n        <th md-column>{{\'MAIL.KEY\' | translate}}</th>\n        <th md-column>{{\'MAIL.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MAIL.IN\' | translate}}</th>\n        <th md-column>{{\'MAIL.OUT\' | translate}}</th>\n        <th md-column>{{\'MAIL.IMAP_STATUS\' | translate}}</th>\n        <th md-column>{{\'MAIL.SMTP_STATUS\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.mailAccounts.count > 0">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="account" md-select-id="id" ng-repeat="account in vm.mailAccounts.rows">\n        <td md-cell>{{account.name}}</td>\n        <td md-cell>{{account.key}}</td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(account.in || 0) + (account.out || 0)}}</span>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-down-bold blue-fg"></md-icon>\n            </span>\n            <span class="md-capture blue-fg">{{account.in || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.in">{{account.lastIn ?  (account.lastIn | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-up-bold green-fg"></md-icon>\n            </span>\n            <span class="md-capture green-fg">{{account.out || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.out">{{account.lastOut ?  (account.lastOut | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row" layout-align="start center">\n            <div layout="column" layout-align="center center">\n              <md-button class="md-icon-button" aria-label="Status">\n                <md-tooltip>{{account.Imap.messageStatus}}</md-tooltip>\n                <div ng-switch="account.Imap.status">\n                  <md-icon ng-switch-when="error" md-font-icon="icon-alert yellow-fg"></md-icon>\n                  <md-icon ng-switch-when="disabled" md-font-icon="icon-close grey-fg"></md-icon>\n                  <md-icon ng-switch-default md-font-icon="icon-checkbox-marked-circle-outline green-fg"></md-icon>\n                </div>\n              </md-button>\n              <span class="md-caption grey-fg">{{ (\'MAIL.\' + account.Imap.status.toUpperCase()) | translate}}</span>\n            </div>\n            <span class="text-boxed" ng-if="account.active && (account.Imap.lastSync && account.Imap.lastSync != \'\')">{{account.Imap.lastSync | date: \'shortTime\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row" layout-align="start center" ng-if="account.Smtp.status">\n            <div layout="column" layout-align="center center">\n              <md-button class="md-icon-button" aria-label="Status">\n                <md-tooltip>{{account.Smtp.messageStatus}}</md-tooltip>\n                <md-icon md-font-icon="{{ account.Smtp.status == \'error\' ? \'icon-alert yellow-fg\' : \'icon-checkbox-marked-circle-outline green-fg\'}}"></md-icon>\n              </md-button>\n              <span class="md-caption grey-fg">{{ (\'MAIL.\' + account.Smtp.status.toUpperCase()) | translate}}</span>\n            </div>\n            <span class="text-boxed">{{account.Smtp.lastSync | date: \'shortTime\'}}</span>\n          </div>\n          <span class="md-caption grey-fg" ng-if="!account.Smtp.status">{{ \'MAIL.NEVER_VERIFIED\' | translate }}</span>\n        </td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-button ng-click="vm.goToMailAccount($event, account)" translate="MAIL.EDIT_ACCOUNT">\n                  Edit Account\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.verifySmtp($event, account)" translate="MAIL.VERIFY_SMTP">\n                  Verify Smtp\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailAccounts.count}}" md-on-paginate="vm.getMailAccounts" md-page-select></md-table-pagination>\n\x3c!-- / ACCOUNTS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/mail/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ACCOUNTS">Accounts</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/marketplace/views/plugins/create/dialog.html",'<md-dialog class="plugin-dialog" aria-label="New Plugin">\n  <form name="pluginForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.plugin.name" ng-required="true" autofocus>\n\n        <div ng-messages="pluginForm[\'name\'].$error" ng-show="pluginForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.TYPE">Type</label>\n        <input type="text" name="type" ng-model="vm.plugin.type" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'type\'].$error" ng-show="pluginForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.plugin.active" aria-label="Active" ng-disabled="!vm.newPlugin"><span translate="MARKETPLACE.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.plugin.description">\n\n        <div ng-messages="pluginForm[\'description\'].$error" ng-show="pluginForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.ICON">Icon</label>\n        <input type="text" name="icon" ng-model="vm.plugin.icon" ng-required="true">\n\n        <div ng-messages="pluginForm[\'icon\'].$error" ng-show="pluginForm[\'icon\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.ICON_REQUIRED">Icon field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.SIDEBAR">Sidebar</label>\n        <md-select name="sidebar" ng-model="vm.plugin.sidebar" required>\n          <md-option ng-value="\'always\'">Always</md-option>\n          <md-option ng-value="\'adminOnly\'">Admin Only</md-option>\n          <md-option ng-value="\'agentOnly\'">Agent Only</md-option>\n          <md-option ng-value="\'never\'">Never</md-option>\n        </md-select>\n        <div ng-messages="pluginForm[\'sidebar\'].$error" ng-show="pluginForm[\'sidebar\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SIDEBAR_REQUIRED">Sidebar field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'adminOnly\'" class="md-block">\n        <label translate="MARKETPLACE.ADMINURL">AdminUrl</label>\n        <input type="text" name="adminUrl" ng-model="vm.plugin.adminUrl">\n\n        <div ng-messages="pluginForm[\'adminUrl\'].$error" ng-show="pluginForm[\'adminUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.ADMINURL_REQUIRED">AdminUrl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'agentOnly\'" class="md-block">\n        <label translate="MARKETPLACE.AGENTURL">AgentUrl</label>\n        <input type="text" name="agentUrl" ng-model="vm.plugin.agentUrl">\n\n        <div ng-messages="pluginForm[\'agentUrl\'].$error" ng-show="pluginForm[\'agentUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.AGENTURL_REQUIRED">AgentUrl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n        <label translate="MARKETPLACE.SCRIPTNAME">ScriptName</label>\n        <input type="text" name="scriptName" ng-model="vm.plugin.scriptName" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'scriptName\'].$error" ng-show="pluginForm[\'scriptName\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SCRIPTNAME_REQUIRED">ScriptName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n        <label translate="MARKETPLACE.SCRIPTPATH">ScriptPath</label>\n        <input type="text" name="scriptPath" ng-model="vm.plugin.scriptPath" ng-required="true">\n\n        <div ng-messages="pluginForm[\'scriptPath\'].$error" ng-show="pluginForm[\'scriptPath\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SCRIPTPATH_REQUIRED">ScriptPath field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.VERSION">Version</label>\n        <input type="text" name="version" ng-model="vm.plugin.version" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'version\'].$error" ng-show="pluginForm[\'version\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.VERSION_REQUIRED">Version field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newPlugin" ng-click="vm.savePlugin()" class="send-button md-accent md-raised" ng-disabled="pluginForm.$invalid || pluginForm.$pristine" aria-label="SAVE" translate="MARKETPLACE.SAVE" translate-attr-aria-label="MARKETPLACE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newPlugin" ng-click="vm.addNewPlugin()" class="send-button md-accent md-raised" ng-disabled="pluginForm.$invalid" aria-label="ADD" translate="MARKETPLACE.ADD_PLUGIN" translate-attr-aria-label="MARKETPLACE.ADD_PLUGIN">\n          ADD PLUGIN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newPlugin" ng-click="vm.deletePlugin($event)" aria-label="DELETE" translate translate-attr-aria-label="MARKETPLACE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MARKETPLACE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/marketplace/views/plugins/edit/view.html",'<div id="marketplace-plugin" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-plugins-button md-icon-button" aria-label="Go to plugins" ng-click="vm.gotoPlugins()" translate translate-attr-aria-label="MARKETPLACE.GO_TO_PLUGINS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="plugin-image" hide-xs>\n          <img ng-src="assets/images/business/plugins.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.plugin.id}}\n            <span ng-if="vm.plugin.name">{{vm.plugin.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MARKETPLACE.CREATED_AT"></span> <span>{{vm.plugin.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.savePlugin()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="MARKETPLACE.SAVE" translate-attr-aria-label="MARKETPLACE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MARKETPLACE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="plugin-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MARKETPLACE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.plugin.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.TYPE">Type</label>\n                <input type="text" name="type" ng-model="vm.plugin.type" disabled>\n\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.plugin.active" aria-label="Active" ng-disabled="true"><span translate="MARKETPLACE.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.plugin.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.ICON">Icon</label>\n                <input type="text" name="icon" ng-model="vm.plugin.icon" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'icon\'].$error" ng-show="generalForm[\'icon\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.ICON_REQUIRED">Icon field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.SIDEBAR">Sidebar</label>\n                <md-select name="sidebar" ng-model="vm.plugin.sidebar" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'always\'">Always</md-option>\n                  <md-option ng-value="\'adminOnly\'">Admin Only</md-option>\n                  <md-option ng-value="\'agentOnly\'">Agent Only</md-option>\n                  <md-option ng-value="\'never\'">Never</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'sidebar\'].$error" ng-show="generalForm[\'sidebar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SIDEBAR_REQUIRED">Sidebar field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'adminOnly\'" class="md-block">\n                <label translate="MARKETPLACE.ADMINURL">AdminUrl</label>\n                <input type="text" name="adminUrl" ng-model="vm.plugin.adminUrl" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'adminUrl\'].$error" ng-show="generalForm[\'adminUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.ADMINURL_REQUIRED">AdminUrl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'agentOnly\'" class="md-block">\n                <label translate="MARKETPLACE.AGENTURL">AgentUrl</label>\n                <input type="text" name="agentUrl" ng-model="vm.plugin.agentUrl" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'agentUrl\'].$error" ng-show="generalForm[\'agentUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.AGENTURL_REQUIRED">AgentUrl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n                <label translate="MARKETPLACE.SCRIPTNAME">ScriptName</label>\n                <input type="text" name="scriptName" ng-model="vm.plugin.scriptName" disabled>\n\n                <div ng-messages="generalForm[\'scriptName\'].$error" ng-show="generalForm[\'scriptName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SCRIPTNAME_REQUIRED">ScriptName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n                <label translate="MARKETPLACE.SCRIPTPATH">ScriptPath</label>\n                <input type="text" name="scriptPath" ng-model="vm.plugin.scriptPath" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'scriptPath\'].$error" ng-show="generalForm[\'scriptPath\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SCRIPTPATH_REQUIRED">ScriptPath field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.VERSION">Version</label>\n                <input type="text" name="version" ng-model="vm.plugin.version" disabled>\n\n                <div ng-messages="generalForm[\'version\'].$error" ng-show="generalForm[\'version\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.VERSION_REQUIRED">Version field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/marketplace/views/plugins/plugins.html",'<div id="plugins" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MARKETPLACE.PLUGINS">Plugins</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MARKETPLACE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedPlugins.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedPlugins =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MARKETPLACE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-plugins-count">\n          <span>{{vm.selectedPlugins.length}}</span>\n          <span translate="MARKETPLACE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MARKETPLACE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllPlugins()" translate="MARKETPLACE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectPlugins()" translate="MARKETPLACE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedPlugins" csv-label="true" filename="plugins.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedPlugins($event)" aria-label="delete selected" translate translate-attr-label="MARKETPLACE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div ng-if="vm.installing">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="MARKETPLACE.INSTALLING">Installing</span>\n            <md-progress-linear md-mode="indeterminate" class="md-accent padding-20"></md-progress-linear>\n          </div>\n        </md-card>\n      </div>\n\n      \x3c!-- PLUGIN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedPlugins" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getPlugins">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="name">{{ \'MARKETPLACE.NAME\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'MARKETPLACE.TYPE\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MARKETPLACE.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MARKETPLACE.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="version">{{ \'MARKETPLACE.VERSION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.plugins.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MARKETPLACE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="plugin" md-select-id="id" ng-repeat="plugin in vm.plugins.rows">\n                <td md-cell ng-if="plugin.userpic"><img class="avatar" alt="{{plugin.name}}" ng-src="api/users/{{plugin.id}}/avatar" /></td>\n                <td md-cell ng-if="!plugin.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{plugin.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="name ">{{plugin.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="type ">{{plugin.type}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{plugin.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{plugin.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="description ">{{plugin.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="version ">{{plugin.version}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MARKETPLACE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && !plugin.active">\n\n                        <md-button ng-click="vm.installplugin(plugin, $event    )" translate="MARKETPLACE.INSTALL_PLUGIN">\n                          Install Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(plugin, $event    )" translate="MARKETPLACE.EDIT_PLUGIN">\n                          Edit Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n\n                        <md-button ng-click="vm.stopplugin(plugin, $event    )" translate="MARKETPLACE.STOP_PLUGIN">\n                          Stop Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n\n                        <md-button ng-click="vm.restartplugin(plugin, $event    )" translate="MARKETPLACE.RESTART_PLUGIN">\n                          Restart Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.downloadfile2(plugin, $event  , \'plugins\'   )" translate="MARKETPLACE.DOWNLOAD_PLUGIN">\n                          Download Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active">\n\n                        <md-button ng-click="vm.uninstallplugin(plugin, $event    )" translate="MARKETPLACE.UNINSTALL_PLUGIN">\n                          Uninstall Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(plugin, $event    )" translate="MARKETPLACE.DELETE_PLUGIN">\n                          Delete Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MARKETPLACE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MARKETPLACE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MARKETPLACE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.plugins.count}}" md-on-paginate="vm.getPlugins" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PLUGIN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- UPLOAD PLUGIN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="upload-plugin-button" ng-click="vm.uploadPlugin($event)" aria-label="upload plugin" translate translate-attr-aria-label="MARKETPLACE.UPLOAD_PLUGIN">\n    <md-icon md-font-icon="icon-upload"></md-icon>\n  </md-button>\n  \x3c!-- / UPLOAD PLUGIN BUTTON --\x3e\n</div>'),e.put("app/main/apps/marketplace/views/plugins/upload/dialog.html",'<md-dialog class="upload-dialog" aria-label="Upload ">\n  <form name="uploadForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="plugin-uploader" ng-hide="vm.uploadState == \'uploading\'" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)" flow-error="vm.uploadError($file, $message)" flow-complete="vm.uploadComplete()" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="MARKETPLACE.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="MARKETPLACE.DROP_TO_UPLOAD_MESSAGE">You can also drop your file here to upload.</span>\n        </div>\n      </div>\n\n      <div layout="column" layout-align="space-between center" ng-show="vm.uploadState == \'uploading\'">\n        <div>\n          <span translate="MARKETPLACE.UPLOADING">Uploading</span>\n          <span>{{vm.plugin.file.name}}</span>\n        </div>\n        <md-progress-linear md-mode="indeterminate"></md-progress-linear>\n      </div>\n\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center"></div>\n      <div layout="row">\n        <md-button ng-click="vm.closeDialog()" ng-hide="vm.uploadState == \'uploading\'" class="md-accent md-raised" aria-label="FINISH" translate="MARKETPLACE.FINISH" translate-attr-aria-label="MARKETPLACE.FINISH">\n          FINISH\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/hopperdate/hopperdate.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" ng-change="vm.recalcTZTime()" mdp-format="YYYY-MM-DD" ng-model="vm.dateTime">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" ng-change="vm.recalcTZTime()" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.dateTime">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n\n        </md-content>\n      </div>\n      <md-input-container class="md-block">\n        <div layout="row">\n          <div flex class="md-block">\n            <md-input-container class="md-block" flex-gt-sm="">\n              <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n              <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" ng-change="vm.recalcTZTime()" autofocus>\n            </md-input-container>\n          </div>\n          <div flex class="md-block">\n            <md-input-container class="md-block">\n              <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n              <input type="text" readonly value="{{vm.hopper.scheduledat}}">\n            </md-input-container>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.hopper.recallme" aria-label="RecallAgent"><span translate="MOTIONDIALER.RECALLAGENT">RecallAgent</span></md-switch>\n\n      </md-input-container>\n      <md-input-container ng-if="vm.hopper.recallme" class="md-block">\n        <label translate="MOTIONDIALER.AGENT">Agent</label>\n        <md-select name="UserId" ng-model="vm.hopper.UserId" required>\n          <md-option ng-value="UserId.id" ng-repeat="UserId in vm.agents" ng-disabled="UserId.canSelect === false">{{ UserId.name }}</md-option>\n        </md-select>\n        <div ng-messages="hopperForm[\'UserId\'].$error" ng-show="hopperForm[\'UserId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",'<md-dialog class="ivrCampaign-dialog" aria-label="New IvrCampaign">\n  <form name="ivrCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newIvrCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="ivrCampaignForm[\'name\'].$error" ng-show="ivrCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.ivrCampaign.active" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n        <md-select name="TrunkId" ng-model="vm.ivrCampaign.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'TrunkId\'].$error" ng-show="ivrCampaignForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.ivrCampaign.IntervalId" required>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'IntervalId\'].$error" ng-show="ivrCampaignForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n        <md-select name="dialCheckDuplicateType" ng-model="vm.ivrCampaign.dialCheckDuplicateType" required>\n\n          <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n          <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'dialCheckDuplicateType\'].$error" ng-show="ivrCampaignForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n        <md-select name="SquareProjectId" ng-model="vm.ivrCampaign.SquareProjectId" required>\n          <md-option ng-value="SquareProjectId.id" ng-repeat="SquareProjectId in vm.projects" ng-disabled="SquareProjectId.canSelect === false">{{ SquareProjectId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'SquareProjectId\'].$error" ng-show="ivrCampaignForm[\'SquareProjectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CONCURRENTCALLS">ConcurrentCalls</label>\n        <input type="number" name="limitCalls" ng-model="vm.ivrCampaign.limitCalls" min="1" max="200" value="30" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.CONCURRENTCALLS"></span></div>\n        <div ng-messages="ivrCampaignForm[\'limitCalls\'].$error" ng-show="ivrCampaignForm[\'limitCalls\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_REQUIRED">ConcurrentCalls field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>200</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.ivrCampaign.description">\n\n        <div ng-messages="ivrCampaignForm[\'description\'].$error" ng-show="ivrCampaignForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newIvrCampaign" ng-click="vm.saveIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid || ivrCampaignForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newIvrCampaign" ng-click="vm.addNewIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_IVRCAMPAIGN" translate-attr-aria-label="MOTIONDIALER.ADD_IVRCAMPAIGN">\n          ADD IVRCAMPAIGN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newIvrCampaign" ng-click="vm.deleteIvrCampaign($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",'<md-dialog class="ivrCampaign-dialog" aria-label="ivrCampaign" ng-init="vm.onInit()">\n  <form name="ivrCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">Add List in IVRCAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",'<md-dialog class="ivrCampaign-dialog" aria-label="Clone IvrCampaign">\n  <form name="ivrCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newIvrCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="ivrCampaignForm[\'name\'].$error" ng-show="ivrCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid" aria-label="CLONE" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN" translate-attr-aria-label="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n        CLONE IVRCAMPAIGN\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",'<md-dialog class="ivrCampaign-dialog" aria-label="ivrCampaign" ng-init="vm.onInit()">\n  <form name="ivrCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">Add List in IVRCAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/resetlist/resetlist.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.RESETLIST ">Reset List</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-wrap flex>\n        <div flex-xs flex="50">\n          <md-checkbox aria-label="Select All" ng-checked="vm.isChecked()" md-indeterminate="vm.isIndeterminate()" ng-click="vm.toggleAll()">\n            <span ng-if="vm.isChecked()" translate="MOTIONDIALER.UNSELECTALL"></span>\n            <span ng-if="!vm.isChecked()" translate="MOTIONDIALER.SELECTALL"></span>\n          </md-checkbox>\n        </div>\n        <div flex-xs flex="50">\n        </div>\n        <div flex="{{vm.items.length > 10 ? 50 : 100 }}" ng-repeat="item in vm.items">\n          <md-checkbox ng-checked="vm.exists(item, vm.selected)" ng-click="vm.toggle(item, vm.selected)">\n            {{ item.name | limitTo:40 }}\n          </md-checkbox>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-hide="vm.loading" layout="row" layout-align="end center">\n      <div>\n      </div>\n      <md-button type="submit" ng-click="vm.listSelected()" class="send-button md-accent md-raised" ng-disabled="vm.loading" aria-label="RESET" translate="MOTIONDIALER.RESET" translate-attr-aria-label="MOTIONDIALER.RESET">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/view.html",'<div id="motiondialer-ivrCampaign" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-ivrCampaigns-button md-icon-button" aria-label="Go to ivrCampaigns" ng-click="vm.gotoIvrCampaigns()" translate translate-attr-aria-label="MOTIONDIALER.GO_TO_IVRCAMPAIGNS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="ivrCampaign-image" hide-xs>\n          <img ng-src="assets/images/business/ivrCampaigns.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.ivrCampaign.id}}\n            <span ng-if="vm.ivrCampaign.name">{{vm.ivrCampaign.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MOTIONDIALER.CREATED_AT"></span> <span>{{vm.ivrCampaign.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.ivrCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="MOTIONDIALER.CLONE_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.listadddialog(vm.ivrCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="listadd">\n        <md-tooltip><span translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-format-list-numbers"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.blacklistadddialog(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="blacklistadd">\n        <md-tooltip><span translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-block-helper"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.resetlistdialog(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="resetlist">\n        <md-tooltip><span translate="MOTIONDIALER.RESETLIST_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-restore"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MOTIONDIALER.GOTO_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveIvrCampaign()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (campaignForm.$invalid) || (originateForm.$invalid) || (globalForm.$invalid) || (congestionForm.$invalid) || (busyForm.$invalid) || (noanswerForm.$invalid) || (nosuchnumberForm.$invalid) || (dropForm.$invalid) || (abandonedForm.$invalid) || (machineForm.$invalid) || (agentrejectForm.$invalid) || (advancedForm.$invalid) || (globalintervalForm.$invalid) || (timezoneForm.$invalid) || (amdForm.$invalid) || (hopperStatisticsForm.$invalid) || (hoppersForm.$invalid) || (hopperHistoriesForm.$invalid) || (hopperFinalsForm.$invalid) || (hopperBlacksForm.$invalid)" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.ivrCampaign.active" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n                <md-select name="TrunkId" ng-model="vm.ivrCampaign.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BACKUPTRUNK">BackupTrunk</label>\n                <md-select name="TrunkBackupId" ng-model="vm.ivrCampaign.TrunkBackupId" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="TrunkBackupId.id" ng-repeat="TrunkBackupId in vm.trunks" ng-disabled="TrunkBackupId.canSelect === false">{{ TrunkBackupId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkBackupId\'].$error" ng-show="generalForm[\'TrunkBackupId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BACKUPTRUNK_REQUIRED">BackupTrunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.ivrCampaign.IntervalId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'IntervalId\'].$error" ng-show="generalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n                <md-select name="dialCheckDuplicateType" ng-model="vm.ivrCampaign.dialCheckDuplicateType" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n                  <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'dialCheckDuplicateType\'].$error" ng-show="generalForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CUTDIGIT">CutDigit</label>\n                <input type="number" name="dialCutDigit" ng-model="vm.ivrCampaign.dialCutDigit" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialCutDigit\'].$error" ng-show="generalForm[\'dialCutDigit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_REQUIRED">CutDigit field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.ivrCampaign.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container campaign md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</div>\n            </div>\n            <form name="campaignForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n                <md-select name="SquareProjectId" ng-model="vm.ivrCampaign.SquareProjectId" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="SquareProjectId.id" ng-repeat="SquareProjectId in vm.projects" ng-disabled="SquareProjectId.canSelect === false">{{ SquareProjectId.name }}</md-option>\n                </md-select>\n                <div ng-messages="campaignForm[\'SquareProjectId\'].$error" ng-show="campaignForm[\'SquareProjectId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONCURRENTCALLS">ConcurrentCalls</label>\n                <input type="number" name="limitCalls" ng-model="vm.ivrCampaign.limitCalls" min="1" max="200" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONCURRENTCALLS"></span></div>\n                <div ng-messages="campaignForm[\'limitCalls\'].$error" ng-show="campaignForm[\'limitCalls\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_REQUIRED">ConcurrentCalls field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>200</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container originate md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ORIGINATE">ORIGINATE</div>\n            </div>\n            <form name="originateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNAME">OriginateCallerIdName</label>\n                <input type="text" name="dialOriginateCallerIdName" ng-model="vm.ivrCampaign.dialOriginateCallerIdName" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNAME"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdName\'].$error" ng-show="originateForm[\'dialOriginateCallerIdName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNAME_REQUIRED">OriginateCallerIdName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNUMBER">OriginateCallerIdNumber</label>\n                <input type="text" name="dialOriginateCallerIdNumber" ng-model="vm.ivrCampaign.dialOriginateCallerIdNumber" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdNumber\'].$error" ng-show="originateForm[\'dialOriginateCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNUMBER_REQUIRED">OriginateCallerIdNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RANDOMLASTDIGITCALLERIDNUMBER">RandomLastDigitCallerIdNumber</label>\n                <input type="number" name="dialRandomLastDigitCallerIdNumber" ng-model="vm.ivrCampaign.dialRandomLastDigitCallerIdNumber" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RANDOMLASTDIGITCALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$error" ng-show="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_REQUIRED">RandomLastDigitCallerIdNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATETIMEOUT">OriginateTimeout</label>\n                <input type="number" name="dialOriginateTimeout" ng-model="vm.ivrCampaign.dialOriginateTimeout" min="1" max="999" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATETIMEOUT"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateTimeout\'].$error" ng-show="originateForm[\'dialOriginateTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_REQUIRED">OriginateTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.ivrCampaign.dialPrefix" ng-pattern="/^\\d+$/" value="" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREFIX"></span></div>\n                <div ng-messages="originateForm[\'dialPrefix\'].$error" ng-show="originateForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_MUST_VALID_PATTERN" translate-values="{ regex: \'/^\\d+$/\' }">Prefix must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.RETRYANDFREQUENCY">RETRYANDFREQUENCY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container global md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBAL">GLOBAL</div>\n            </div>\n            <form name="globalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALMAXRETRY">GlobalMaxRetry</label>\n                <input type="number" name="dialGlobalMaxRetry" ng-model="vm.ivrCampaign.dialGlobalMaxRetry" min="1" max="999" value="4" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALMAXRETRY"></span></div>\n                <div ng-messages="globalForm[\'dialGlobalMaxRetry\'].$error" ng-show="globalForm[\'dialGlobalMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_REQUIRED">GlobalMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container congestion md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CONGESTION">CONGESTION</div>\n            </div>\n            <form name="congestionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONMAXRETRY">CongestionMaxRetry</label>\n                <input type="number" name="dialCongestionMaxRetry" ng-model="vm.ivrCampaign.dialCongestionMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONMAXRETRY"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionMaxRetry\'].$error" ng-show="congestionForm[\'dialCongestionMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_REQUIRED">CongestionMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONRETRYTIME">CongestionRetryTime</label>\n                <input type="number" name="dialCongestionRetryFrequency" ng-model="vm.ivrCampaign.dialCongestionRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONRETRYTIME"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionRetryFrequency\'].$error" ng-show="congestionForm[\'dialCongestionRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_REQUIRED">CongestionRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container busy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.BUSY">BUSY</div>\n            </div>\n            <form name="busyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYMAXRETRY">BusyMaxRetry</label>\n                <input type="number" name="dialBusyMaxRetry" ng-model="vm.ivrCampaign.dialBusyMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYMAXRETRY"></span></div>\n                <div ng-messages="busyForm[\'dialBusyMaxRetry\'].$error" ng-show="busyForm[\'dialBusyMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_REQUIRED">BusyMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYRETRYTIME">BusyRetryTime</label>\n                <input type="number" name="dialBusyRetryFrequency" ng-model="vm.ivrCampaign.dialBusyRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYRETRYTIME"></span></div>\n                <div ng-messages="busyForm[\'dialBusyRetryFrequency\'].$error" ng-show="busyForm[\'dialBusyRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_REQUIRED">BusyRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container noanswer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOANSWER">NOANSWER</div>\n            </div>\n            <form name="noanswerForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERMAXRETRY">NoAnswerMaxRetry</label>\n                <input type="number" name="dialNoAnswerMaxRetry" ng-model="vm.ivrCampaign.dialNoAnswerMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERMAXRETRY"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerMaxRetry\'].$error" ng-show="noanswerForm[\'dialNoAnswerMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_REQUIRED">NoAnswerMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERRETRYTIME">NoAnswerRetryTime</label>\n                <input type="number" name="dialNoAnswerRetryFrequency" ng-model="vm.ivrCampaign.dialNoAnswerRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERRETRYTIME"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerRetryFrequency\'].$error" ng-show="noanswerForm[\'dialNoAnswerRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_REQUIRED">NoAnswerRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container nosuchnumber md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOSUCHNUMBER">NOSUCHNUMBER</div>\n            </div>\n            <form name="nosuchnumberForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERMAXRETRY">NoSuchNumberMaxRetry</label>\n                <input type="number" name="dialNoSuchNumberMaxRetry" ng-model="vm.ivrCampaign.dialNoSuchNumberMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERMAXRETRY"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_REQUIRED">NoSuchNumberMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERRETRYTIME">NoSuchNumberRetryTime</label>\n                <input type="number" name="dialNoSuchNumberRetryFrequency" ng-model="vm.ivrCampaign.dialNoSuchNumberRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERRETRYTIME"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_REQUIRED">NoSuchNumberRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container drop md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.DROP">DROP</div>\n            </div>\n            <form name="dropForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPMAXRETRY">DropMaxRetry</label>\n                <input type="number" name="dialDropMaxRetry" ng-model="vm.ivrCampaign.dialDropMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPMAXRETRY"></span></div>\n                <div ng-messages="dropForm[\'dialDropMaxRetry\'].$error" ng-show="dropForm[\'dialDropMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_REQUIRED">DropMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPRETRYTIME">DropRetryTime</label>\n                <input type="number" name="dialDropRetryFrequency" ng-model="vm.ivrCampaign.dialDropRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPRETRYTIME"></span></div>\n                <div ng-messages="dropForm[\'dialDropRetryFrequency\'].$error" ng-show="dropForm[\'dialDropRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_REQUIRED">DropRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container abandoned md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ABANDONED">ABANDONED</div>\n            </div>\n            <form name="abandonedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDMAXRETRY">AbandonedMaxRetry</label>\n                <input type="number" name="dialAbandonedMaxRetry" ng-model="vm.ivrCampaign.dialAbandonedMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDMAXRETRY"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedMaxRetry\'].$error" ng-show="abandonedForm[\'dialAbandonedMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_REQUIRED">AbandonedMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDRETRYTIME">AbandonedRetryTime</label>\n                <input type="number" name="dialAbandonedRetryFrequency" ng-model="vm.ivrCampaign.dialAbandonedRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDRETRYTIME"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedRetryFrequency\'].$error" ng-show="abandonedForm[\'dialAbandonedRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_REQUIRED">AbandonedRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container machine md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.MACHINE">MACHINE</div>\n            </div>\n            <form name="machineForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINEMAXRETRY">MachineMaxRetry</label>\n                <input type="number" name="dialMachineMaxRetry" ng-model="vm.ivrCampaign.dialMachineMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINEMAXRETRY"></span></div>\n                <div ng-messages="machineForm[\'dialMachineMaxRetry\'].$error" ng-show="machineForm[\'dialMachineMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_REQUIRED">MachineMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINERETRYTIME">MachineRetryTime</label>\n                <input type="number" name="dialMachineRetryFrequency" ng-model="vm.ivrCampaign.dialMachineRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINERETRYTIME"></span></div>\n                <div ng-messages="machineForm[\'dialMachineRetryFrequency\'].$error" ng-show="machineForm[\'dialMachineRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_REQUIRED">MachineRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container agentreject md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AGENTREJECT">AGENTREJECT</div>\n            </div>\n            <form name="agentrejectForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTMAXRETRY">AgentRejectMaxRetry</label>\n                <input type="number" name="dialAgentRejectMaxRetry" ng-model="vm.ivrCampaign.dialAgentRejectMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTMAXRETRY"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectMaxRetry\'].$error" ng-show="agentrejectForm[\'dialAgentRejectMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_REQUIRED">AgentRejectMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTRETRYTIME">AgentRejectRetryTime</label>\n                <input type="number" name="dialAgentRejectRetryFrequency" ng-model="vm.ivrCampaign.dialAgentRejectRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTRETRYTIME"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$error" ng-show="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_REQUIRED">AgentRejectRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.ivrCampaign.dialOrderByScheduledAt" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container globalinterval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBALINTERVAL">GLOBALINTERVAL</div>\n            </div>\n            <form name="globalintervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALINTERVAL">GlobalInterval</label>\n                <input type="text" name="dialGlobalInterval" ng-model="vm.ivrCampaign.dialGlobalInterval" value="07:00-22:00,*,*,*" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALINTERVAL"></span></div>\n                <div ng-messages="globalintervalForm[\'dialGlobalInterval\'].$error" ng-show="globalintervalForm[\'dialGlobalInterval\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALINTERVAL_REQUIRED">GlobalInterval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container timezone md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.TIMEZONE">TIMEZONE</div>\n            </div>\n            <form name="timezoneForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEZONE">Timezone</label>\n                <ms-timezone name="dialTimezone" ng-model="vm.ivrCampaign.dialTimezone" autofocus ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span></div>\n                <div ng-messages="timezoneForm[\'dialTimezone\'].$error" ng-show="timezoneForm[dialTimezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container amd md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AMD">AMD</div>\n            </div>\n            <form name="amdForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.ivrCampaign.dialAMDActive" aria-label="AMDActive" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AMDACTIVE">AMDActive</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDACTIVE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDINITIALSILENCE">AMDInitialSilence</label>\n                <input type="number" name="dialAMDInitialSilence" ng-model="vm.ivrCampaign.dialAMDInitialSilence" min="0" value="2500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDINITIALSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDInitialSilence\'].$error" ng-show="amdForm[\'dialAMDInitialSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_REQUIRED">AMDInitialSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDInitialSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDGREETING">AMDGreeting</label>\n                <input type="number" name="dialAMDGreeting" ng-model="vm.ivrCampaign.dialAMDGreeting" min="0" value="1500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDGREETING"></span></div>\n                <div ng-messages="amdForm[\'dialAMDGreeting\'].$error" ng-show="amdForm[\'dialAMDGreeting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_REQUIRED">AMDGreeting field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDGreeting must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDAFTERGREETINGSILENCE">AMDAfterGreetingSilence</label>\n                <input type="number" name="dialAMDAfterGreetingSilence" ng-model="vm.ivrCampaign.dialAMDAfterGreetingSilence" min="0" value="800" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDAFTERGREETINGSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDAfterGreetingSilence\'].$error" ng-show="amdForm[\'dialAMDAfterGreetingSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_REQUIRED">AMDAfterGreetingSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDAfterGreetingSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDTOTALANALYSISTIME">AMDTotalAnalysisTime</label>\n                <input type="number" name="dialAMDTotalAnalysisTime" ng-model="vm.ivrCampaign.dialAMDTotalAnalysisTime" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDTOTALANALYSISTIME"></span></div>\n                <div ng-messages="amdForm[\'dialAMDTotalAnalysisTime\'].$error" ng-show="amdForm[\'dialAMDTotalAnalysisTime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_REQUIRED">AMDTotalAnalysisTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDTotalAnalysisTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMINWORDLENGTH">AMDMinWordLength</label>\n                <input type="number" name="dialAMDMinWordLength" ng-model="vm.ivrCampaign.dialAMDMinWordLength" min="0" value="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMINWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMinWordLength\'].$error" ng-show="amdForm[\'dialAMDMinWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_REQUIRED">AMDMinWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMinWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDBETWEENWORDSSILENCE">AMDBetweenWordsSilence</label>\n                <input type="number" name="dialAMDBetweenWordsSilence" ng-model="vm.ivrCampaign.dialAMDBetweenWordsSilence" min="0" value="50" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDBETWEENWORDSSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDBetweenWordsSilence\'].$error" ng-show="amdForm[\'dialAMDBetweenWordsSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_REQUIRED">AMDBetweenWordsSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDBetweenWordsSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMNUMBEROFWORDS">AMDMaximumNumberOfWords</label>\n                <input type="number" name="dialAMDMaximumNumberOfWords" ng-model="vm.ivrCampaign.dialAMDMaximumNumberOfWords" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMNUMBEROFWORDS"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumNumberOfWords\'].$error" ng-show="amdForm[\'dialAMDMaximumNumberOfWords\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_REQUIRED">AMDMaximumNumberOfWords field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumNumberOfWords must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDSILENCETHRESHOLD">AMDSilenceThreshold</label>\n                <input type="number" name="dialAMDSilenceThreshold" ng-model="vm.ivrCampaign.dialAMDSilenceThreshold" min="0" max="32767" value="256" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDSILENCETHRESHOLD"></span></div>\n                <div ng-messages="amdForm[\'dialAMDSilenceThreshold\'].$error" ng-show="amdForm[\'dialAMDSilenceThreshold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_REQUIRED">AMDSilenceThreshold field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_LESS_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>32767</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMWORDLENGTH">AMDMaximumWordLength</label>\n                <input type="number" name="dialAMDMaximumWordLength" ng-model="vm.ivrCampaign.dialAMDMaximumWordLength" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumWordLength\'].$error" ng-show="amdForm[\'dialAMDMaximumWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_REQUIRED">AMDMaximumWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HOPPERS">HOPPERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperstatistics md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperStatisticsController as vm_hs" ng-init="vm_hs.init(vm.ivrCampaign)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERWIDGET">Hoppers</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_hs.init(vm.ivrCampaign)" aria-label="refresh Hopper" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{(vm_hs.total || 0) + (vm_hs.closed || 0)}}</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.TOTAL\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.fresh || 0}} ({{vm_hs.total ? ((((vm_hs.fresh || 0) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.FRESH\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.total ? (vm_hs.total - (vm_hs.fresh || 0)) : 0}} ({{vm_hs.total ? ((((vm_hs.total - (vm_hs.fresh || 0)) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.OPEN\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.closed ? (vm_hs.closed || 0) : 0}} ({{vm_hs.closed ? ((((vm_hs.closed) * 100)/(vm_hs.closed + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.CLOSED\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n\n          </div>\n          <div class="ivrCampaign-detail-form-container hoppers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHoppersController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERS">Hoppers</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHoppers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHoppers()" aria-label="refresh Hoppers" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHoppers.length}} {{vm_dc.selectedIvrCampaignHoppers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHoppers" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedIvrCampaignHoppers($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHoppers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="priority">\n                        {{ \'MOTIONDIALER.PRIORITY\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopper" md-select-id="id" ng-repeat="hopper in vm_dc.ivrCampaignHoppers.rows">\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.ContactId}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell privacy ng-cloak>\n                        {{hopper.phone}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countcongestionretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countbusyretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnoanswerretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnosuchnumberretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countdropretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countabandonedretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countmachineretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countagentrejectretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{ hopper.scheduledat | formatdate }}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{ vm_dc.arraypriority[hopper.priority].option }} </td>\n\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" translate="MOTIONDIALER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(hopper, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHoppers.rows.length">\n                      <td md-cell colspan="15">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHoppers.count}}" md-on-paginate="vm_dc.getIvrCampaignHoppers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HISTORY">HISTORY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperhistories md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperHistoriesController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERHISTORIES">HopperHistories</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperHistories()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHopperHistories()" aria-label="refresh HopperHistories" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERHISTORIES">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperHistories.length}} {{vm_dc.selectedIvrCampaignHopperHistories.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperHistories" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperHistories" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperHistory" md-select-id="id" ng-repeat="hopperHistory in vm_dc.ivrCampaignHopperHistories.rows">\n                      <td md-cell>\n                        {{hopperHistory.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.scheduledat | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.endtime | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperHistories.rows.length">\n                      <td md-cell colspan="11">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperHistories.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperHistories" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.FINAL">FINAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperfinals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperFinalsController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERFINALS">HopperFinals</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperFinals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHopperFinals()" aria-label="refresh HopperFinals" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERFINALS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                  <td md-cell class="actions">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="vm_dc.countContactsIvrCampaignHopperFinal(vm_dc.query.id); $mdOpenMenu($event);">\n                        <md-icon md-font-icon="icon-backup-restore"></md-icon>\n                        <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(3)">\n                            <span translate="MOTIONDIALER.NOANSWER ">NoAnswer</span>\n                            <span class="badge">({{vm_dc.contacts.noAnswerContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(5)">\n                            <span translate="MOTIONDIALER.BUSY ">Busy</span>\n                            <span class="badge">({{vm_dc.contacts.busyContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(8)">\n                            <span translate="MOTIONDIALER.CONGESTION ">Congestion</span>\n                            <span class="badge">({{vm_dc.contacts.congestionContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(10)">\n                            <span translate="MOTIONDIALER.DROPPED ">Drop</span>\n                            <span class="badge">({{vm_dc.contacts.dropContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(11)">\n                            <span translate="MOTIONDIALER.ABANDONED ">Abandoned</span>\n                            <span class="badge">({{vm_dc.contacts.abandonedContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(22)">\n                            <span translate="MOTIONDIALER.RECALLFAILEDTIMEOUT">Recall</span>\n                            <span class="badge">({{vm_dc.contacts.reCallContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(0)">\n                            <span translate="MOTIONDIALER.NO_SUCH_NUMBER">NoSuchNumber</span>\n                            <span class="badge">({{vm_dc.contacts.noSuchContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(19)">\n                            <span translate="MOTIONDIALER.ANSWERING_MACHINE">AnsweringMachine</span>\n                            <span class="badge">({{vm_dc.contacts.answeringMachine}})</span>\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperFinals.length}} {{vm_dc.selectedIvrCampaignHopperFinals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperFinals" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.moveSelectedIvrCampaignHopperFinals($event)" aria-label="move selected" translate translate-attr-label="MOTIONDIALER.MOVE_SELECTED">\n                    <md-icon md-font-icon="icon-restore"></md-icon>\n                    <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperFinals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="disposition">\n                        {{ \'MOTIONDIALER.DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperFinal" md-select-id="id" ng-repeat="hopperFinal in vm_dc.ivrCampaignHopperFinals.rows">\n                      <td md-cell>\n                        {{hopperFinal.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countcongestionretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countbusyretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnoanswerretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnosuchnumberretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countdropretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countabandonedretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countmachineretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countagentrejectretry}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.disposition}}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.moveConfirm(hopperFinal, $event)" translate="MOTIONDIALER.MOVE_HOPPERFINAL">\n                                Move HopperFinal\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperFinals.rows.length">\n                      <td md-cell colspan="28">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperFinals.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperFinals" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.BLACKLIST">BLACKLIST</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperblacks md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperBlacksController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERBLACKS">HopperBlacks</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperBlacks()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperBlacks.length}} {{vm_dc.selectedIvrCampaignHopperBlacks.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperBlacks" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperBlacks" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperBlacks">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperBlack" md-select-id="id" ng-repeat="hopperBlack in vm_dc.ivrCampaignHopperBlacks.rows">\n                      <td md-cell>\n                        {{hopperBlack.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperBlack.phone}}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperBlacks.rows.length">\n                      <td md-cell colspan="4">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperBlacks.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperBlacks" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/ivrCampaigns.html",'<div id="ivrCampaigns" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-fire" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MOTIONDIALER.IVRCAMPAIGNS">IvrCampaigns</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MOTIONDIALER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedIvrCampaigns.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedIvrCampaigns =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MOTIONDIALER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-ivrCampaigns-count">\n          <span>{{vm.selectedIvrCampaigns.length}}</span>\n          <span translate="MOTIONDIALER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MOTIONDIALER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllIvrCampaigns()" translate="MOTIONDIALER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectIvrCampaigns()" translate="MOTIONDIALER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedIvrCampaigns" csv-label="true" filename="ivrCampaigns.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedIvrCampaigns($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- IVRCAMPAIGN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedIvrCampaigns" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getIvrCampaigns">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MOTIONDIALER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="SquareProjectId">{{ \'MOTIONDIALER.CALLYSQUAREPROJECT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.ivrCampaigns.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="ivrCampaign" md-select-id="id" ng-repeat="ivrCampaign in vm.ivrCampaigns.rows">\n                <td md-cell ng-if="ivrCampaign.userpic"><img class="avatar" alt="{{ivrCampaign.name}}" ng-src="api/users/{{ivrCampaign.id}}/avatar" /></td>\n                <td md-cell ng-if="!ivrCampaign.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{ivrCampaign.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="id ">{{ivrCampaign.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="name ">{{ivrCampaign.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{ivrCampaign.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{ivrCampaign.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':ivrCampaign.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="SquareProjectId ">{{ (vm.projects | filter : {\'id\':ivrCampaign.SquareProjectId} : true)[0].name }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(ivrCampaign, $event    )" translate="MOTIONDIALER.EDIT_IVRCAMPAIGN">\n                          Edit IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(ivrCampaign, $event    )" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n                          clone IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.listadddialog(ivrCampaign, $event    )" translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">\n                          listadd IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.blacklistadddialog(ivrCampaign, $event    )" translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">\n                          blacklistadd IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(ivrCampaign, $event    )" translate="MOTIONDIALER.DELETE_IVRCAMPAIGN">\n                          Delete IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(ivrCampaign, $event    )" translate="MOTIONDIALER.GOTOREALTIME_IVRCAMPAIGN">\n                          goToRealtime IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.ivrCampaigns.count}}" md-on-paginate="vm.getIvrCampaigns" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / IVRCAMPAIGN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD IVRCAMPAIGN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-ivrCampaign-button" ng-click="vm.createOrEditIvrCampaign($event)" aria-label="add ivrCampaign" translate translate-attr-aria-label="MOTIONDIALER.ADD_IVRCAMPAIGN">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD IVRCAMPAIGN BUTTON --\x3e\n</div>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",'<md-dialog class="queueCampaign-dialog" aria-label="New QueueCampaign">\n  <form name="queueCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newQueueCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="queueCampaignForm[\'name\'].$error" ng-show="queueCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n        <md-select name="TrunkId" ng-model="vm.queueCampaign.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'TrunkId\'].$error" ng-show="queueCampaignForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n        <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.queueCampaign.IntervalId" required>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'IntervalId\'].$error" ng-show="queueCampaignForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n        <md-select name="dialCheckDuplicateType" ng-model="vm.queueCampaign.dialCheckDuplicateType" required>\n\n          <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n          <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'dialCheckDuplicateType\'].$error" ng-show="queueCampaignForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.METHOD">Method</label>\n        <md-select name="dialMethod" ng-model="vm.queueCampaign.dialMethod" required>\n          <md-option ng-value="\'progressive\'">Progressive</md-option>\n          <md-option ng-value="\'power\'">PowerDialing</md-option>\n          <md-option ng-value="\'predictive\'">Predictive</md-option>\n          <md-option ng-value="\'preview\'">Preview</md-option>\n          <md-option ng-value="\'booked\'">BookedProgressive</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.METHOD"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialMethod\'].$error" ng-show="queueCampaignForm[\'dialMethod\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.METHOD_REQUIRED">Method field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'power\'" class="md-block">\n        <span translate="MOTIONDIALER.POWERLEVEL">PowerLevel</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.POWERLEVEL"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPowerLevel" min="1" max="10" step="0.1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <label translate="MOTIONDIALER.PREDICTIVEOPTIMIZATION">PredictiveOptimization</label>\n        <md-select name="dialPredictiveOptimization" ng-model="vm.queueCampaign.dialPredictiveOptimization">\n\n          <md-option ng-value="\'agentBusyFactor\'"> {{ \'MOTIONDIALER.AGENTBUSYFACTOR\' | translate }} </md-option>\n\n          <md-option ng-value="\'dropRate\'"> {{ \'MOTIONDIALER.DROPRATE\' | translate }} </md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATION"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialPredictiveOptimization\'].$error" ng-show="queueCampaignForm[\'dialPredictiveOptimization\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PREDICTIVEOPTIMIZATION_REQUIRED">PredictiveOptimization field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <span translate="MOTIONDIALER.PREDICTIVEOPTIMIZATIONPERCENTAGE">PredictiveOptimizationPercentage</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATIONPERCENTAGE"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveOptimizationPercentage" min="1" max="95" step="0.1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <span translate="MOTIONDIALER.PREDICTIVEINTERVAL">PredictiveInterval</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEINTERVAL"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveInterval" min="5" max="30" step="1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n        <label translate="MOTIONDIALER.MAXCONCURRENTCALLS">MaxConcurrentCalls</label>\n        <input type="number" name="dialLimitQueue" ng-model="vm.queueCampaign.dialLimitQueue" min="0" max="9999" value="0" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.MAXCONCURRENTCALLS"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialLimitQueue\'].$error" ng-show="queueCampaignForm[\'dialLimitQueue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_REQUIRED">MaxConcurrentCalls field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>9999</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n        <label translate="MOTIONDIALER.QUEUETIMEOUT">QueueTimeout</label>\n        <input type="number" name="dialQueueTimeout" ng-model="vm.queueCampaign.dialQueueTimeout" min="1" max="999" value="3" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.QUEUETIMEOUT"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialQueueTimeout\'].$error" ng-show="queueCampaignForm[\'dialQueueTimeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_REQUIRED">QueueTimeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>999</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.AGENTTIMEOUT">AgentTimeout</label>\n        <input type="number" name="timeout" ng-model="vm.queueCampaign.timeout" min="0" value="3" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTTIMEOUT"></span></div>\n        <div ng-messages="queueCampaignForm[\'timeout\'].$error" ng-show="queueCampaignForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_REQUIRED">AgentTimeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentTimeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.queueCampaign.description">\n\n        <div ng-messages="queueCampaignForm[\'description\'].$error" ng-show="queueCampaignForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newQueueCampaign" ng-click="vm.saveQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid || queueCampaignForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newQueueCampaign" ng-click="vm.addNewQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_QUEUECAMPAIGN" translate-attr-aria-label="MOTIONDIALER.ADD_QUEUECAMPAIGN">\n          ADD QUEUECAMPAIGN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newQueueCampaign" ng-click="vm.deleteQueueCampaign($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">Add Agent to queueCampaign</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="MOTIONDIALER.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">Add List in QUEUECAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",'<md-dialog class="queueCampaign-dialog" aria-label="Clone QueueCampaign">\n  <form name="queueCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newQueueCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="queueCampaignForm[\'name\'].$error" ng-show="queueCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid" aria-label="CLONE" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN" translate-attr-aria-label="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n        CLONE QUEUECAMPAIGN\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.dateTime" ng-change="vm.recalcTZTime()">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.dateTime" ng-change="vm.recalcTZTime()">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div layout="row">\n        <div flex class="md-block">\n          <md-input-container class="md-block" flex-gt-sm="">\n            <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n            <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n          </md-input-container>\n        </div>\n        <div flex class="md-block">\n          <md-input-container class="md-block">\n            <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n            <input type="text" readonly value="{{vm.hopper.scheduledat}}">\n          </md-input-container>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.hopper.recallme" aria-label="RecallAgent"><span translate="MOTIONDIALER.RECALLAGENT">RecallAgent</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.hopper.recallme" class="md-block">\n        <label translate="MOTIONDIALER.AGENT">Agent</label>\n        <md-select name="UserId" ng-model="vm.hopper.UserId" required>\n          <md-option ng-value="UserId.id" ng-repeat="UserId in vm.agents" ng-disabled="UserId.canSelect === false">{{ UserId.name }}</md-option>\n        </md-select>\n        <div ng-messages="hopperForm[\'UserId\'].$error" ng-show="hopperForm[\'UserId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">Add List in QUEUECAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/resetlist/resetlist.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.RESETLIST ">Reset List</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-wrap flex>\n        <div flex-xs flex="50">\n          <md-checkbox aria-label="Select All" ng-checked="vm.isChecked()" md-indeterminate="vm.isIndeterminate()" ng-click="vm.toggleAll()">\n            <span ng-if="vm.isChecked()" translate="MOTIONDIALER.UNSELECTALL"></span>\n            <span ng-if="!vm.isChecked()" translate="MOTIONDIALER.SELECTALL"></span>\n          </md-checkbox>\n        </div>\n        <div flex-xs flex="50">\n        </div>\n        <div flex="{{vm.items.length > 10 ? 50 : 100 }}" ng-repeat="item in vm.items">\n          <md-checkbox ng-checked="vm.exists(item, vm.selected)" ng-click="vm.toggle(item, vm.selected)">\n            {{ item.name | limitTo:40 }}\n          </md-checkbox>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-hide="vm.loading" layout="row" layout-align="end center">\n      <div>\n      </div>\n      <md-button type="submit" ng-click="vm.listSelected()" class="send-button md-accent md-raised" ng-disabled="vm.loading" aria-label="RESET" translate="MOTIONDIALER.RESET" translate-attr-aria-label="MOTIONDIALER.RESET">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="MOTIONDIALER.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/view.html",'<div id="motiondialer-queueCampaign" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-queueCampaigns-button md-icon-button" aria-label="Go to queueCampaigns" ng-click="vm.gotoQueueCampaigns()" translate translate-attr-aria-label="MOTIONDIALER.GO_TO_QUEUECAMPAIGNS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="queueCampaign-image" hide-xs>\n          <img ng-src="assets/images/business/queueCampaigns.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.queueCampaign.id}}\n            <span ng-if="vm.queueCampaign.name">{{vm.queueCampaign.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MOTIONDIALER.CREATED_AT"></span> <span>{{vm.queueCampaign.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.queueCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.listadddialog(vm.queueCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="listadd">\n        <md-tooltip><span translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-format-list-numbers"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.blacklistadddialog(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="blacklistadd">\n        <md-tooltip><span translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-block-helper"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.queueCampaign, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.queueCampaign, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.resetlistdialog(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="resetlist">\n        <md-tooltip><span translate="MOTIONDIALER.RESETLIST_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-restore"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MOTIONDIALER.GOTO_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveQueueCampaign()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (campaignForm.$invalid) || (queueForm.$invalid) || (originateForm.$invalid) || (globalForm.$invalid) || (congestionForm.$invalid) || (busyForm.$invalid) || (noanswerForm.$invalid) || (nosuchnumberForm.$invalid) || (dropForm.$invalid) || (abandonedForm.$invalid) || (machineForm.$invalid) || (agentrejectForm.$invalid) || (additionalphonesForm.$invalid) || (advancedForm.$invalid) || (advancedpreviewForm.$invalid) || (thresholdsForm.$invalid) || (recallmeForm.$invalid) || (globalintervalForm.$invalid) || (timezoneForm.$invalid) || (amdForm.$invalid) || (hopperStatisticsForm.$invalid) || (hoppersForm.$invalid) || (hopperHistoriesForm.$invalid) || (hopperFinalsForm.$invalid) || (hopperBlacksForm.$invalid)" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n                <md-select name="TrunkId" ng-model="vm.queueCampaign.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BACKUPTRUNK">BackupTrunk</label>\n                <md-select name="TrunkBackupId" ng-model="vm.queueCampaign.TrunkBackupId" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="TrunkBackupId.id" ng-repeat="TrunkBackupId in vm.trunks" ng-disabled="TrunkBackupId.canSelect === false">{{ TrunkBackupId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkBackupId\'].$error" ng-show="generalForm[\'TrunkBackupId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BACKUPTRUNK_REQUIRED">BackupTrunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n                <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.queueCampaign.IntervalId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'IntervalId\'].$error" ng-show="generalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n                <md-select name="dialCheckDuplicateType" ng-model="vm.queueCampaign.dialCheckDuplicateType" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n                  <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'dialCheckDuplicateType\'].$error" ng-show="generalForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CUTDIGIT">CutDigit</label>\n                <input type="number" name="dialCutDigit" ng-model="vm.queueCampaign.dialCutDigit" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialCutDigit\'].$error" ng-show="generalForm[\'dialCutDigit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_REQUIRED">CutDigit field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.queueCampaign.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container campaign md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</div>\n            </div>\n            <form name="campaignForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.METHOD">Method</label>\n                <md-select name="dialMethod" ng-model="vm.queueCampaign.dialMethod" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'progressive\'">Progressive</md-option>\n                  <md-option ng-value="\'power\'">PowerDialing</md-option>\n                  <md-option ng-value="\'predictive\'">Predictive</md-option>\n                  <md-option ng-value="\'preview\'">Preview</md-option>\n                  <md-option ng-value="\'booked\'">BookedProgressive</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.METHOD"></span></div>\n                <div ng-messages="campaignForm[\'dialMethod\'].$error" ng-show="campaignForm[\'dialMethod\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.METHOD_REQUIRED">Method field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'power\'" class="md-block">\n                <span translate="MOTIONDIALER.POWERLEVEL">PowerLevel</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.POWERLEVEL"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPowerLevel" min="1" max="10" step="0.1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <label translate="MOTIONDIALER.PREDICTIVEOPTIMIZATION">PredictiveOptimization</label>\n                <md-select name="dialPredictiveOptimization" ng-model="vm.queueCampaign.dialPredictiveOptimization" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'agentBusyFactor\'"> {{ \'MOTIONDIALER.AGENTBUSYFACTOR\' | translate }} </md-option>\n\n                  <md-option ng-value="\'dropRate\'"> {{ \'MOTIONDIALER.DROPRATE\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATION"></span></div>\n                <div ng-messages="campaignForm[\'dialPredictiveOptimization\'].$error" ng-show="campaignForm[\'dialPredictiveOptimization\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREDICTIVEOPTIMIZATION_REQUIRED">PredictiveOptimization field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEOPTIMIZATIONPERCENTAGE">PredictiveOptimizationPercentage</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATIONPERCENTAGE"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveOptimizationPercentage" min="1" max="95" step="0.1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEINTERVAL">PredictiveInterval</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEINTERVAL"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveInterval" min="5" max="30" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n                <label translate="MOTIONDIALER.MAXCONCURRENTCALLS">MaxConcurrentCalls</label>\n                <input type="number" name="dialLimitQueue" ng-model="vm.queueCampaign.dialLimitQueue" min="0" max="9999" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MAXCONCURRENTCALLS"></span></div>\n                <div ng-messages="campaignForm[\'dialLimitQueue\'].$error" ng-show="campaignForm[\'dialLimitQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_REQUIRED">MaxConcurrentCalls field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>9999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTTIMEOUT">AgentTimeout</label>\n                <input type="number" name="timeout" ng-model="vm.queueCampaign.timeout" min="0" value="3" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTTIMEOUT"></span></div>\n                <div ng-messages="campaignForm[\'timeout\'].$error" ng-show="campaignForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_REQUIRED">AgentTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentTimeout must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container queue md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.QUEUE">QUEUE</div>\n            </div>\n            <form name="queueForm" novalidate>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.QUEUEOPTIONS">QueueOptions</label>\n                <input type="text" name="dialQueueOptions" ng-model="vm.queueCampaign.dialQueueOptions" value="tTxX" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="queueForm[\'dialQueueOptions\'].$error" ng-show="queueForm[\'dialQueueOptions\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUEOPTIONS_REQUIRED">QueueOptions field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.QUEUETIMEOUT">QueueTimeout</label>\n                <input type="number" name="dialQueueTimeout" ng-model="vm.queueCampaign.dialQueueTimeout" min="1" max="999" value="3" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.QUEUETIMEOUT"></span></div>\n                <div ng-messages="queueForm[\'dialQueueTimeout\'].$error" ng-show="queueForm[\'dialQueueTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_REQUIRED">QueueTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'booked\' || vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.queueCampaign.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n                  <md-option ng-value="\'roundrobin\'" ng-if="vm.queueCampaign.dialMethod === \'booked\'">Round Robin</md-option>\n                  <md-option ng-value="\'leastrecent\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Least Recent</md-option>\n                  <md-option ng-value="\'fewestcalls\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Fewest Calls</md-option>\n                  <md-option ng-value="\'random\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Random</md-option>\n                  <md-option ng-value="\'linear\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Linear</md-option>\n                  <md-option ng-value="\'wrandom\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Weight Random</md-option>\n                </md-select>\n                <div ng-messages="queueForm[\'strategy\'].$error" ng-show="queueForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.RETRY">Retry</label>\n                <input type="number" name="retry" ng-model="vm.queueCampaign.retry" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RETRY"></span></div>\n                <div ng-messages="queueForm[\'retry\'].$error" ng-show="queueForm[\'retry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RETRY_REQUIRED">Retry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Retry must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.WRAPUPTIME">WrapupTime</label>\n                <input type="number" name="wrapuptime" ng-model="vm.queueCampaign.wrapuptime" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.WRAPUPTIME"></span></div>\n                <div ng-messages="queueForm[\'wrapuptime\'].$error" ng-show="queueForm[\'wrapuptime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.WRAPUPTIME_REQUIRED">WrapupTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.WRAPUPTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WrapupTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.WEIGHT">Weight</label>\n                <input type="number" name="weight" ng-model="vm.queueCampaign.weight" min="0" value="1" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.WEIGHT"></span></div>\n                <div ng-messages="queueForm[\'weight\'].$error" ng-show="queueForm[\'weight\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.WEIGHT_REQUIRED">Weight field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.WEIGHT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Weight must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.MUSICONHOLD">MusicOnHold</label>\n                <md-select name="musiconhold" ng-model="vm.queueCampaign.musiconhold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="musiconhold.name" ng-repeat="musiconhold in vm.musiconholds" ng-disabled="musiconhold.canSelect === false">{{ musiconhold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MUSICONHOLD"></span></div>\n                <div ng-messages="queueForm[\'musiconhold\'].$error" ng-show="queueForm[\'musiconhold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MUSICONHOLD_REQUIRED">MusicOnHold field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n                <md-select name="dialQueueProject" ng-model="vm.queueCampaign.dialQueueProject" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject.name" ng-repeat="dialQueueProject in vm.projects" ng-disabled="dialQueueProject.canSelect === false">{{ dialQueueProject.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECT"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject\'].$error" ng-show="queueForm[\'dialQueueProject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT2">CallySquareProject2</label>\n                <md-select name="dialQueueProject2" ng-model="vm.queueCampaign.dialQueueProject2" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject2.name" ng-repeat="dialQueueProject2 in vm.projects" ng-disabled="dialQueueProject2.canSelect === false">{{ dialQueueProject2.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECT2"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject2\'].$error" ng-show="queueForm[\'dialQueueProject2\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT2_REQUIRED">CallySquareProject2 field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECTPREVIEW">CallySquareProjectPreview</label>\n                <md-select name="dialQueueProject" ng-model="vm.queueCampaign.dialQueueProject" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject.name" ng-repeat="dialQueueProject in vm.projects" ng-disabled="dialQueueProject.canSelect === false">{{ dialQueueProject.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECTPREVIEW"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject\'].$error" ng-show="queueForm[\'dialQueueProject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECTPREVIEW_REQUIRED">CallySquareProjectPreview field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECTPREVIEW2">CallySquareProjectPreview2</label>\n                <md-select name="dialQueueProject2" ng-model="vm.queueCampaign.dialQueueProject2" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject2.name" ng-repeat="dialQueueProject2 in vm.projects" ng-disabled="dialQueueProject2.canSelect === false">{{ dialQueueProject2.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECTPREVIEW2"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject2\'].$error" ng-show="queueForm[\'dialQueueProject2\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECTPREVIEW2_REQUIRED">CallySquareProjectPreview2 field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialQueueProject2 && (vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\')" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialAgiAfterHangupAgent" aria-label="RunIfHangupAgent" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.RUNIFHANGUPAGENT">RunIfHangupAgent</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RUNIFHANGUPAGENT"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container originate md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ORIGINATE">ORIGINATE</div>\n            </div>\n            <form name="originateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNAME">OriginateCallerIdName</label>\n                <input type="text" name="dialOriginateCallerIdName" ng-model="vm.queueCampaign.dialOriginateCallerIdName" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNAME"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdName\'].$error" ng-show="originateForm[\'dialOriginateCallerIdName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNAME_REQUIRED">OriginateCallerIdName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNUMBER">OriginateCallerIdNumber</label>\n                <input type="text" name="dialOriginateCallerIdNumber" ng-model="vm.queueCampaign.dialOriginateCallerIdNumber" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdNumber\'].$error" ng-show="originateForm[\'dialOriginateCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNUMBER_REQUIRED">OriginateCallerIdNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RANDOMLASTDIGITCALLERIDNUMBER">RandomLastDigitCallerIdNumber</label>\n                <input type="number" name="dialRandomLastDigitCallerIdNumber" ng-model="vm.queueCampaign.dialRandomLastDigitCallerIdNumber" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RANDOMLASTDIGITCALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$error" ng-show="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_REQUIRED">RandomLastDigitCallerIdNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATETIMEOUT">OriginateTimeout</label>\n                <input type="number" name="dialOriginateTimeout" ng-model="vm.queueCampaign.dialOriginateTimeout" min="1" max="999" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATETIMEOUT"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateTimeout\'].$error" ng-show="originateForm[\'dialOriginateTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_REQUIRED">OriginateTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.queueCampaign.dialPrefix" ng-pattern="/^\\d+$/" value="" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREFIX"></span></div>\n                <div ng-messages="originateForm[\'dialPrefix\'].$error" ng-show="originateForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_MUST_VALID_PATTERN" translate-values="{ regex: \'/^\\d+$/\' }">Prefix must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.RETRYANDFREQUENCY">RETRYANDFREQUENCY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container global md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBAL">GLOBAL</div>\n            </div>\n            <form name="globalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALMAXRETRY">GlobalMaxRetry</label>\n                <input type="number" name="dialGlobalMaxRetry" ng-model="vm.queueCampaign.dialGlobalMaxRetry" min="1" max="999" value="4" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALMAXRETRY"></span></div>\n                <div ng-messages="globalForm[\'dialGlobalMaxRetry\'].$error" ng-show="globalForm[\'dialGlobalMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_REQUIRED">GlobalMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container congestion md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CONGESTION">CONGESTION</div>\n            </div>\n            <form name="congestionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONMAXRETRY">CongestionMaxRetry</label>\n                <input type="number" name="dialCongestionMaxRetry" ng-model="vm.queueCampaign.dialCongestionMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONMAXRETRY"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionMaxRetry\'].$error" ng-show="congestionForm[\'dialCongestionMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_REQUIRED">CongestionMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONRETRYTIME">CongestionRetryTime</label>\n                <input type="number" name="dialCongestionRetryFrequency" ng-model="vm.queueCampaign.dialCongestionRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONRETRYTIME"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionRetryFrequency\'].$error" ng-show="congestionForm[\'dialCongestionRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_REQUIRED">CongestionRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container busy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.BUSY">BUSY</div>\n            </div>\n            <form name="busyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYMAXRETRY">BusyMaxRetry</label>\n                <input type="number" name="dialBusyMaxRetry" ng-model="vm.queueCampaign.dialBusyMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYMAXRETRY"></span></div>\n                <div ng-messages="busyForm[\'dialBusyMaxRetry\'].$error" ng-show="busyForm[\'dialBusyMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_REQUIRED">BusyMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYRETRYTIME">BusyRetryTime</label>\n                <input type="number" name="dialBusyRetryFrequency" ng-model="vm.queueCampaign.dialBusyRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYRETRYTIME"></span></div>\n                <div ng-messages="busyForm[\'dialBusyRetryFrequency\'].$error" ng-show="busyForm[\'dialBusyRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_REQUIRED">BusyRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container noanswer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOANSWER">NOANSWER</div>\n            </div>\n            <form name="noanswerForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERMAXRETRY">NoAnswerMaxRetry</label>\n                <input type="number" name="dialNoAnswerMaxRetry" ng-model="vm.queueCampaign.dialNoAnswerMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERMAXRETRY"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerMaxRetry\'].$error" ng-show="noanswerForm[\'dialNoAnswerMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_REQUIRED">NoAnswerMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERRETRYTIME">NoAnswerRetryTime</label>\n                <input type="number" name="dialNoAnswerRetryFrequency" ng-model="vm.queueCampaign.dialNoAnswerRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERRETRYTIME"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerRetryFrequency\'].$error" ng-show="noanswerForm[\'dialNoAnswerRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_REQUIRED">NoAnswerRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container nosuchnumber md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOSUCHNUMBER">NOSUCHNUMBER</div>\n            </div>\n            <form name="nosuchnumberForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERMAXRETRY">NoSuchNumberMaxRetry</label>\n                <input type="number" name="dialNoSuchNumberMaxRetry" ng-model="vm.queueCampaign.dialNoSuchNumberMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERMAXRETRY"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_REQUIRED">NoSuchNumberMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERRETRYTIME">NoSuchNumberRetryTime</label>\n                <input type="number" name="dialNoSuchNumberRetryFrequency" ng-model="vm.queueCampaign.dialNoSuchNumberRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERRETRYTIME"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_REQUIRED">NoSuchNumberRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container drop md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.DROP">DROP</div>\n            </div>\n            <form name="dropForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPMAXRETRY">DropMaxRetry</label>\n                <input type="number" name="dialDropMaxRetry" ng-model="vm.queueCampaign.dialDropMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPMAXRETRY"></span></div>\n                <div ng-messages="dropForm[\'dialDropMaxRetry\'].$error" ng-show="dropForm[\'dialDropMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_REQUIRED">DropMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPRETRYTIME">DropRetryTime</label>\n                <input type="number" name="dialDropRetryFrequency" ng-model="vm.queueCampaign.dialDropRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPRETRYTIME"></span></div>\n                <div ng-messages="dropForm[\'dialDropRetryFrequency\'].$error" ng-show="dropForm[\'dialDropRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_REQUIRED">DropRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container abandoned md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ABANDONED">ABANDONED</div>\n            </div>\n            <form name="abandonedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDMAXRETRY">AbandonedMaxRetry</label>\n                <input type="number" name="dialAbandonedMaxRetry" ng-model="vm.queueCampaign.dialAbandonedMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDMAXRETRY"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedMaxRetry\'].$error" ng-show="abandonedForm[\'dialAbandonedMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_REQUIRED">AbandonedMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDRETRYTIME">AbandonedRetryTime</label>\n                <input type="number" name="dialAbandonedRetryFrequency" ng-model="vm.queueCampaign.dialAbandonedRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDRETRYTIME"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedRetryFrequency\'].$error" ng-show="abandonedForm[\'dialAbandonedRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_REQUIRED">AbandonedRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container machine md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.MACHINE">MACHINE</div>\n            </div>\n            <form name="machineForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINEMAXRETRY">MachineMaxRetry</label>\n                <input type="number" name="dialMachineMaxRetry" ng-model="vm.queueCampaign.dialMachineMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINEMAXRETRY"></span></div>\n                <div ng-messages="machineForm[\'dialMachineMaxRetry\'].$error" ng-show="machineForm[\'dialMachineMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_REQUIRED">MachineMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINERETRYTIME">MachineRetryTime</label>\n                <input type="number" name="dialMachineRetryFrequency" ng-model="vm.queueCampaign.dialMachineRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINERETRYTIME"></span></div>\n                <div ng-messages="machineForm[\'dialMachineRetryFrequency\'].$error" ng-show="machineForm[\'dialMachineRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_REQUIRED">MachineRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container agentreject md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AGENTREJECT">AGENTREJECT</div>\n            </div>\n            <form name="agentrejectForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTMAXRETRY">AgentRejectMaxRetry</label>\n                <input type="number" name="dialAgentRejectMaxRetry" ng-model="vm.queueCampaign.dialAgentRejectMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTMAXRETRY"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectMaxRetry\'].$error" ng-show="agentrejectForm[\'dialAgentRejectMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_REQUIRED">AgentRejectMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTRETRYTIME">AgentRejectRetryTime</label>\n                <input type="number" name="dialAgentRejectRetryFrequency" ng-model="vm.queueCampaign.dialAgentRejectRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTRETRYTIME"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$error" ng-show="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_REQUIRED">AgentRejectRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container additionalphones md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADDITIONALPHONES">ADDITIONALPHONES</div>\n            </div>\n            <form name="additionalphonesForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CALLADDITIONALPHONEAFTERMIN">CallAdditionalPhoneAfterMin</label>\n                <input type="number" name="callAdditionalPhoneAfterMin" ng-model="vm.queueCampaign.callAdditionalPhoneAfterMin" min="1" max="99999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="additionalphonesForm[\'callAdditionalPhoneAfterMin\'].$error" ng-show="additionalphonesForm[\'callAdditionalPhoneAfterMin\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_REQUIRED">CallAdditionalPhoneAfterMin field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CallAdditionalPhoneAfterMin must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_MUST_BE_LESS_THAN_OR_EQUAL_TO">CallAdditionalPhoneAfterMin must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="queueCampaign-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.acw" class="md-block">\n                <label translate="MOTIONDIALER.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.queueCampaign.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedForm[\'acwTimeout\'].$error" ng-show="advancedForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AUTOPAUSE">AutoPause</label>\n                <md-select name="autopause" ng-model="vm.queueCampaign.autopause" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'all\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AUTOPAUSE"></span></div>\n                <div ng-messages="advancedForm[\'autopause\'].$error" ng-show="advancedForm[\'autopause\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AUTOPAUSE_REQUIRED">AutoPause field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RINGINUSE">RingInUse</label>\n                <md-select name="ringinuse" ng-model="vm.queueCampaign.ringinuse" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RINGINUSE"></span></div>\n                <div ng-messages="advancedForm[\'ringinuse\'].$error" ng-show="advancedForm[\'ringinuse\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RINGINUSE_REQUIRED">RingInUse field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MEMBERDELAY">MemberDelay</label>\n                <input type="number" name="memberdelay" ng-model="vm.queueCampaign.memberdelay" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MEMBERDELAY"></span></div>\n                <div ng-messages="advancedForm[\'memberdelay\'].$error" ng-show="advancedForm[\'memberdelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MEMBERDELAY_REQUIRED">MemberDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MEMBERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MemberDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEOUTRESTART">TimeoutRestart</label>\n                <md-select name="timeoutrestart" ng-model="vm.queueCampaign.timeoutrestart" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEOUTRESTART"></span></div>\n                <div ng-messages="advancedForm[\'timeoutrestart\'].$error" ng-show="advancedForm[\'timeoutrestart\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEOUTRESTART_REQUIRED">TimeoutRestart field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.queueCampaign.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedForm[\'monitor_format\'].$error" ng-show="advancedForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONTEXT">Context</label>\n                <input type="text" name="context" ng-model="vm.queueCampaign.context" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONTEXT"></span></div>\n                <div ng-messages="advancedForm[\'context\'].$error" ng-show="advancedForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETINTERFACEVARIABLES">SetInterfaceVariables</label>\n                <md-select name="setinterfacevar" ng-model="vm.queueCampaign.setinterfacevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETINTERFACEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setinterfacevar\'].$error" ng-show="advancedForm[\'setinterfacevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETINTERFACEVARIABLES_REQUIRED">SetInterfaceVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETQUEUEVARIABLES">SetQueueVariables</label>\n                <md-select name="setqueuevar" ng-model="vm.queueCampaign.setqueuevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETQUEUEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueuevar\'].$error" ng-show="advancedForm[\'setqueuevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETQUEUEVARIABLES_REQUIRED">SetQueueVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETQUEUEENTRYVARIABLES">SetQueueEntryVariables</label>\n                <md-select name="setqueueentryvar" ng-model="vm.queueCampaign.setqueueentryvar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETQUEUEENTRYVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueueentryvar\'].$error" ng-show="advancedForm[\'setqueueentryvar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETQUEUEENTRYVARIABLES_REQUIRED">SetQueueEntryVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.queueCampaign.dialOrderByScheduledAt" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.mandatoryDisposition" class="md-block">\n                <label translate="MOTIONDIALER.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.queueCampaign.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="queueCampaign-detail-form-container advancedpreview md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCEDPREVIEW">ADVANCEDPREVIEW</div>\n            </div>\n            <form name="advancedpreviewForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.acw" class="md-block">\n                <label translate="MOTIONDIALER.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.queueCampaign.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedpreviewForm[\'acwTimeout\'].$error" ng-show="advancedpreviewForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.queueCampaign.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedpreviewForm[\'monitor_format\'].$error" ng-show="advancedpreviewForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.queueCampaign.dialOrderByScheduledAt" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedpreviewForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedpreviewForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.mandatoryDisposition" class="md-block">\n                <label translate="MOTIONDIALER.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.queueCampaign.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedpreviewForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedpreviewForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'predictive\'" class="queueCampaign-detail-form-container thresholds md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.THRESHOLDS">THRESHOLDS</div>\n            </div>\n            <form name="thresholdsForm" novalidate>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEMAXTHRESHOLD">PredictiveMaxThreshold</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEMAXTHRESHOLD"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveIntervalMaxThreshold" min="1" max="100" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEMINTHRESHOLD">PredictiveMinThreshold</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEMINTHRESHOLD"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveIntervalMinThreshold" min="1" max="100" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container recallme md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.RECALLME">RECALLME</div>\n            </div>\n            <form name="recallmeForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALRECALLMETIMEOUT">DialRecallMeTimeout</label>\n                <input type="number" name="dialRecallMeTimeout" ng-model="vm.queueCampaign.dialRecallMeTimeout" min="1" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALRECALLMETIMEOUT"></span></div>\n                <div ng-messages="recallmeForm[\'dialRecallMeTimeout\'].$error" ng-show="recallmeForm[\'dialRecallMeTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALRECALLMETIMEOUT_REQUIRED">DialRecallMeTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DIALRECALLMETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DialRecallMeTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialRecallInQueue" aria-label="DialRecallInQueue" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.DIALRECALLINQUEUE">DialRecallInQueue</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALRECALLINQUEUE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'preview\'" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialPreviewAutoRecallMe" aria-label="Preview_Auto_Recall_Me" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.PREVIEW_AUTO_RECALL_ME">Preview_Auto_Recall_Me</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREVIEW_AUTO_RECALL_ME"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'preview\'" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialPreviewRecallmeReminder" aria-label="Preview_Recall_Me_Reminder" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.PREVIEW_RECALL_ME_REMINDER">Preview_Recall_Me_Reminder</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREVIEW_RECALL_ME_REMINDER"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="queueCampaign-detail-form-container globalinterval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBALINTERVAL">GLOBALINTERVAL</div>\n            </div>\n            <form name="globalintervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALINTERVAL">GlobalInterval</label>\n                <input type="text" name="dialGlobalInterval" ng-model="vm.queueCampaign.dialGlobalInterval" value="07:00-22:00,*,*,*" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALINTERVAL"></span></div>\n                <div ng-messages="globalintervalForm[\'dialGlobalInterval\'].$error" ng-show="globalintervalForm[\'dialGlobalInterval\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALINTERVAL_REQUIRED">GlobalInterval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="queueCampaign-detail-form-container timezone md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.TIMEZONE">TIMEZONE</div>\n            </div>\n            <form name="timezoneForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEZONE">Timezone</label>\n                <ms-timezone name="dialTimezone" ng-model="vm.queueCampaign.dialTimezone" autofocus ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span></div>\n                <div ng-messages="timezoneForm[\'dialTimezone\'].$error" ng-show="timezoneForm[dialTimezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="queueCampaign-detail-form-container amd md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AMD">AMD</div>\n            </div>\n            <form name="amdForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialAMDActive" aria-label="AMDActive" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AMDACTIVE">AMDActive</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDACTIVE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDINITIALSILENCE">AMDInitialSilence</label>\n                <input type="number" name="dialAMDInitialSilence" ng-model="vm.queueCampaign.dialAMDInitialSilence" min="0" value="2500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDINITIALSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDInitialSilence\'].$error" ng-show="amdForm[\'dialAMDInitialSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_REQUIRED">AMDInitialSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDInitialSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDGREETING">AMDGreeting</label>\n                <input type="number" name="dialAMDGreeting" ng-model="vm.queueCampaign.dialAMDGreeting" min="0" value="1500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDGREETING"></span></div>\n                <div ng-messages="amdForm[\'dialAMDGreeting\'].$error" ng-show="amdForm[\'dialAMDGreeting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_REQUIRED">AMDGreeting field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDGreeting must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDAFTERGREETINGSILENCE">AMDAfterGreetingSilence</label>\n                <input type="number" name="dialAMDAfterGreetingSilence" ng-model="vm.queueCampaign.dialAMDAfterGreetingSilence" min="0" value="800" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDAFTERGREETINGSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDAfterGreetingSilence\'].$error" ng-show="amdForm[\'dialAMDAfterGreetingSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_REQUIRED">AMDAfterGreetingSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDAfterGreetingSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDTOTALANALYSISTIME">AMDTotalAnalysisTime</label>\n                <input type="number" name="dialAMDTotalAnalysisTime" ng-model="vm.queueCampaign.dialAMDTotalAnalysisTime" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDTOTALANALYSISTIME"></span></div>\n                <div ng-messages="amdForm[\'dialAMDTotalAnalysisTime\'].$error" ng-show="amdForm[\'dialAMDTotalAnalysisTime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_REQUIRED">AMDTotalAnalysisTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDTotalAnalysisTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMINWORDLENGTH">AMDMinWordLength</label>\n                <input type="number" name="dialAMDMinWordLength" ng-model="vm.queueCampaign.dialAMDMinWordLength" min="0" value="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMINWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMinWordLength\'].$error" ng-show="amdForm[\'dialAMDMinWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_REQUIRED">AMDMinWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMinWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDBETWEENWORDSSILENCE">AMDBetweenWordsSilence</label>\n                <input type="number" name="dialAMDBetweenWordsSilence" ng-model="vm.queueCampaign.dialAMDBetweenWordsSilence" min="0" value="50" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDBETWEENWORDSSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDBetweenWordsSilence\'].$error" ng-show="amdForm[\'dialAMDBetweenWordsSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_REQUIRED">AMDBetweenWordsSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDBetweenWordsSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMNUMBEROFWORDS">AMDMaximumNumberOfWords</label>\n                <input type="number" name="dialAMDMaximumNumberOfWords" ng-model="vm.queueCampaign.dialAMDMaximumNumberOfWords" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMNUMBEROFWORDS"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumNumberOfWords\'].$error" ng-show="amdForm[\'dialAMDMaximumNumberOfWords\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_REQUIRED">AMDMaximumNumberOfWords field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumNumberOfWords must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDSILENCETHRESHOLD">AMDSilenceThreshold</label>\n                <input type="number" name="dialAMDSilenceThreshold" ng-model="vm.queueCampaign.dialAMDSilenceThreshold" min="0" max="32767" value="256" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDSILENCETHRESHOLD"></span></div>\n                <div ng-messages="amdForm[\'dialAMDSilenceThreshold\'].$error" ng-show="amdForm[\'dialAMDSilenceThreshold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_REQUIRED">AMDSilenceThreshold field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_LESS_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>32767</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMWORDLENGTH">AMDMaximumWordLength</label>\n                <input type="number" name="dialAMDMaximumWordLength" ng-model="vm.queueCampaign.dialAMDMaximumWordLength" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumWordLength\'].$error" ng-show="amdForm[\'dialAMDMaximumWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_REQUIRED">AMDMaximumWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HOPPERS">HOPPERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperstatistics md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperStatisticsController as vm_hs" ng-init="vm_hs.init(vm.queueCampaign)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERWIDGET">Hoppers</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_hs.init(vm.queueCampaign)" aria-label="refresh Hopper" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{(vm_hs.total || 0) + (vm_hs.closed || 0)}}</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.TOTAL\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.fresh || 0}} ({{vm_hs.total ? ((((vm_hs.fresh || 0) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.FRESH\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.total ? (vm_hs.total - (vm_hs.fresh || 0)) : 0}} ({{vm_hs.total ? ((((vm_hs.total - (vm_hs.fresh || 0)) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.OPEN\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.closed ? (vm_hs.closed || 0) : 0}} ({{vm_hs.closed ? ((((vm_hs.closed) * 100)/(vm_hs.closed + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.CLOSED\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n\n          </div>\n          <div class="queueCampaign-detail-form-container hoppers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHoppersController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERS">Hoppers</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHoppers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHoppers()" aria-label="refresh Hoppers" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHoppers.length}} {{vm_dc.selectedQueueCampaignHoppers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHoppers" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedQueueCampaignHoppers($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHoppers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="priority">\n                        {{ \'MOTIONDIALER.PRIORITY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="recallme">\n                        {{ \'MOTIONDIALER.RECALLAGENT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopper" md-select-id="id" ng-repeat="hopper in vm_dc.queueCampaignHoppers.rows">\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.ContactId}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell privacy ng-cloak>\n                        {{hopper.phone}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countcongestionretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countbusyretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnoanswerretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnosuchnumberretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countdropretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countabandonedretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countmachineretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countagentrejectretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{ hopper.scheduledat | formatdate }}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{ vm_dc.arraypriority[hopper.priority].option }} </td>\n\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell class="recallme ">\n                        <md-icon md-colors="{color: {{hopper.recallme ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{hopper.recallme? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" translate="MOTIONDIALER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(hopper, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHoppers.rows.length">\n                      <td md-cell colspan="17">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHoppers.count}}" md-on-paginate="vm_dc.getQueueCampaignHoppers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HISTORY">HISTORY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperhistories md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperHistoriesController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERHISTORIES">HopperHistories</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperHistories()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHopperHistories()" aria-label="refresh HopperHistories" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERHISTORIES">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperHistories.length}} {{vm_dc.selectedQueueCampaignHopperHistories.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperHistories" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperHistories" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperHistory" md-select-id="id" ng-repeat="hopperHistory in vm_dc.queueCampaignHopperHistories.rows">\n                      <td md-cell>\n                        {{hopperHistory.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.scheduledat | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.endtime | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperHistories.rows.length">\n                      <td md-cell colspan="11">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperHistories.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperHistories" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.FINAL">FINAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperfinals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperFinalsController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERFINALS">HopperFinals</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperFinals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHopperFinals()" aria-label="refresh HopperFinals" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERFINALS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                  <td md-cell class="actions">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="vm_dc.countContactsQueueCampaignHopperFinal(vm_dc.query.id); $mdOpenMenu($event);">\n                        <md-icon md-font-icon="icon-backup-restore"></md-icon>\n                        <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(3)">\n                            <span translate="MOTIONDIALER.NOANSWER ">NoAnswer</span>\n                            <span class="badge">({{vm_dc.contacts.noAnswerContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(5)">\n                            <span translate="MOTIONDIALER.BUSY ">Busy</span>\n                            <span class="badge">({{vm_dc.contacts.busyContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(8)">\n                            <span translate="MOTIONDIALER.CONGESTION ">Congestion</span>\n                            <span class="badge">({{vm_dc.contacts.congestionContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(10)">\n                            <span translate="MOTIONDIALER.DROPPED ">Drop</span>\n                            <span class="badge">({{vm_dc.contacts.dropContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(11)">\n                            <span translate="MOTIONDIALER.ABANDONED ">Abandoned</span>\n                            <span class="badge">({{vm_dc.contacts.abandonedContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(22)">\n                            <span translate="MOTIONDIALER.RECALLFAILEDTIMEOUT">Recall</span>\n                            <span class="badge">({{vm_dc.contacts.reCallContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(0)">\n                            <span translate="MOTIONDIALER.NO_SUCH_NUMBER">NoSuchNumber</span>\n                            <span class="badge">({{vm_dc.contacts.noSuchContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(19)">\n                            <span translate="MOTIONDIALER.ANSWERING_MACHINE">AnsweringMachine</span>\n                            <span class="badge">({{vm_dc.contacts.answeringMachine}})</span>\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperFinals.length}} {{vm_dc.selectedQueueCampaignHopperFinals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperFinals" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.moveSelectedQueueCampaignHopperFinals($event)" aria-label="move selected" translate translate-attr-label="MOTIONDIALER.MOVE_SELECTED">\n                    <md-icon md-font-icon="icon-restore"></md-icon>\n                    <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperFinals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="disposition">\n                        {{ \'MOTIONDIALER.DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="secondDisposition">\n                        {{ \'MOTIONDIALER.SECOND_LEVEL_DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="thirdDisposition">\n                        {{ \'MOTIONDIALER.THIRD_LEVEL_DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperFinal" md-select-id="id" ng-repeat="hopperFinal in vm_dc.queueCampaignHopperFinals.rows">\n                      <td md-cell>\n                        {{hopperFinal.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countcongestionretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countbusyretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnoanswerretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnosuchnumberretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countdropretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countabandonedretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countmachineretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countagentrejectretry}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.disposition}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.secondDisposition}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.thirdDisposition}}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.moveConfirm(hopperFinal, $event)" translate="MOTIONDIALER.MOVE_HOPPERFINAL">\n                                Move HopperFinal\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperFinals.rows.length">\n                      <td md-cell colspan="30">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperFinals.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperFinals" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.BLACKLIST">BLACKLIST</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperblacks md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperBlacksController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERBLACKS">HopperBlacks</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperBlacks()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperBlacks.length}} {{vm_dc.selectedQueueCampaignHopperBlacks.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperBlacks" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperBlacks" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperBlacks">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperBlack" md-select-id="id" ng-repeat="hopperBlack in vm_dc.queueCampaignHopperBlacks.rows">\n                      <td md-cell>\n                        {{hopperBlack.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperBlack.phone}}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperBlacks.rows.length">\n                      <td md-cell colspan="4">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperBlacks.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperBlacks" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/queueCampaigns.html",'<div id="queueCampaigns" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-fire" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MOTIONDIALER.QUEUECAMPAIGNS">QueueCampaigns</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MOTIONDIALER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedQueueCampaigns.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedQueueCampaigns =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MOTIONDIALER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-queueCampaigns-count">\n          <span>{{vm.selectedQueueCampaigns.length}}</span>\n          <span translate="MOTIONDIALER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MOTIONDIALER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllQueueCampaigns()" translate="MOTIONDIALER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectQueueCampaigns()" translate="MOTIONDIALER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedQueueCampaigns" csv-label="true" filename="queueCampaigns.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedQueueCampaigns($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- QUEUECAMPAIGN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedQueueCampaigns" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueueCampaigns">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MOTIONDIALER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th md-column md-order-by="dialActive">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="dialMethod">{{ \'MOTIONDIALER.METHOD\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'MOTIONDIALER.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.queueCampaigns.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="queueCampaign" md-select-id="id" ng-repeat="queueCampaign in vm.queueCampaigns.rows">\n                <td md-cell ng-if="queueCampaign.userpic"><img class="avatar" alt="{{queueCampaign.name}}" ng-src="api/users/{{queueCampaign.id}}/avatar" /></td>\n                <td md-cell ng-if="!queueCampaign.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{queueCampaign.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="id ">{{queueCampaign.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="name ">{{queueCampaign.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="dialActive ">\n                  <md-icon md-colors="{color: {{queueCampaign.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queueCampaign.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':queueCampaign.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="dialMethod ">{{ vm.arraydialMethod[queueCampaign.dialMethod].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="strategy ">{{ vm.arraystrategy[queueCampaign.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(queueCampaign, $event    )" translate="MOTIONDIALER.EDIT_QUEUECAMPAIGN">\n                          Edit QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(queueCampaign, $event    )" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n                          clone QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.listadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">\n                          listadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.blacklistadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">\n                          blacklistadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN">\n                          teamadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">\n                          agentadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(queueCampaign, $event    )" translate="MOTIONDIALER.DELETE_QUEUECAMPAIGN">\n                          Delete QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(queueCampaign, $event    )" translate="MOTIONDIALER.GOTOREALTIME_QUEUECAMPAIGN">\n                          goToRealtime QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queueCampaigns.count}}" md-on-paginate="vm.getQueueCampaigns" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / QUEUECAMPAIGN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD QUEUECAMPAIGN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-queueCampaign-button" ng-click="vm.createOrEditQueueCampaign($event)" aria-label="add queueCampaign" translate translate-attr-aria-label="MOTIONDIALER.ADD_QUEUECAMPAIGN">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD QUEUECAMPAIGN BUTTON --\x3e\n</div>'),e.put("app/main/apps/motiondialer/views/realtime/abandonedcalls/view.html",'<md-toolbar class="md-table-toolbar md-default table-header">\n  <div class="md-toolbar-tools" layout="row" layout-align="center center">\n    <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n    <ms-search-bar on-search="vm.getAbandonedCalls()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300">\n    </ms-search-bar>\n    <div flex></div>\n\n    <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getAbandonedCalls()"></ms-quick-filter>\n\n    <md-button class="md-icon-button" ng-click="vm.refresh && vm.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n      <md-icon md-font-icon="icon-reload"></md-icon>\n      <md-tooltip ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | translate}}\n      </md-tooltip>\n    </md-button>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAbandonedCalls">\n      <tr md-row>\n        <th md-column md-order-by="id">ID</th>\n        <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n        <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n        <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n        <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n        <th md-column md-order-by="queuecallerexitAt">{{\'DASHBOARDS.QUEUECALLEREXITAT\' | translate}}</th>\n        <th md-column md-order-by="queuecallerexitreason">{{\'DASHBOARDS.QUEUECALLEREXITREASON\' | translate}}</th>\n        <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.abandonedCalls.rows.length">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.abandonedCalls.rows">\n        <td md-cell class="id">{{call.id}}</td>\n        <td md-cell class="firstName" privacy ng-cloak>{{call.calleridname}}</td>\n        <td md-cell class="list" privacy ng-cloak>{{call.calleridnum}}</td>\n        <td md-cell class="list">{{vm.queuesMap[call.queue]}}</td>\n        <td md-cell class="list">\n          {{call.queuecallerabandonAt ? (call.queuecallerabandonAt | formatdate) : (call.queuecallerexitAt | formatdate) }}\n        </td>\n        <td md-cell class="list">{{call.queuecallerexitAt ? (call.queuecallerexitAt | formatdate) : undefined }}\n        </td>\n        <td md-cell class="list">{{call.queuecallerexitreason}}</td>\n        <td md-cell class="list">{{call.lastAssignedTo}}</td>\n        <td md-cell class="list">{{ call.disposition }}</td>\n        <td md-cell class="list">{{ call.secondDisposition }}</td>\n        <td md-cell class="list">{{ call.thirdDisposition }}</td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-menu>\n                  <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.ASSIGNTO">\n                    Assigned\n                    to</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="call.lastAssignedTo">\n                      <md-button ng-click="vm.assignTo(call)"><em translate="DASHBOARDS.NONE">Not Assigned</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.agents.rows.length" ng-repeat="agent in vm.agents.rows">\n                      <md-button ng-click="vm.assignTo(call,agent)">{{agent.name}}</md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.dispose(call)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">\n                  Dispose\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.abandonedCalls.count}}" md-on-paginate="vm.getAbandonedCalls" md-page-select></md-table-pagination>'),e.put("app/main/apps/motiondialer/views/realtime/ivr_campaigns/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.IVR_CAMPAIGNS">Ivr Campaigns</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getCampaigns()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCampaigns">\n      <tr md-row>\n        <th md-column md-order-by="name" class="bl">{{\'MOTIONDIALER.NAME\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL_MANAGED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.LIMITED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.ORIGINATED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.MESSAGE\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.CALLYSQUAREPROJECT\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TRUNK\' | translate }}</th>\n        <th md-column>{{\'MOTIONDIALER.ACTIVE\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.campaigns.rows.length > 0">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="campaign in vm.campaigns.rows">\n        <td md-cell>\n          <span>{{campaign.name}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.ivrTotalCallsDays || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.ivrAnswerCallsDay || 0}} ({{(campaign.ivrTotalCallsDays) ? (campaign.ivrAnswerCallsDay || 0) * 100/(campaign.ivrTotalCallsDays ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.limitCalls || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.originated || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.message ? (\'MOTIONDIALER.\'+campaign.message | translate) : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.dialQueueProject || \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{campaign.Trunk ? campaign.Trunk.name : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <md-icon md-colors="{color: {{campaign.active ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{campaign.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.createOrEditIvrCampaign($event, campaign)" translate="MOTIONDIALER.EDIT_CAMPAIGN">\n                  Edit Campaign\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.campaigns.count}}" md-on-paginate="vm.getCampaigns" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/queue_params/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_PARAMETERS">Params</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{\'MOTIONDIALER.NAME\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL_OFFERED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.MANAGED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.ABANDONED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.DROPPED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.AVG_HOLD_TIME\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.AVG_DURATION\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.AVG_BILLABLE\' | translate}}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.rows.length > 0">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="queue in vm.queues.rows">\n        <td md-cell>\n          <span>{{queue.name}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(queue.answered + queue.outboundNoAnswerCallsDay + queue.outboundBusyCallsDay + queue.outboundCongestionCallsDay + queue.outboundNoSuchCallsDay + queue.outboundUnknownCallsDay + queue.outboundDropCallsDayTimeout + queue.outboundDropCallsDayCallersExit + queue.outboundBlacklistCallsDay + queue.outboundOriginateFailureCallsDay + queue.outboundAnswerAgiCallsDay + queue.outboundReCallsDay + queue.outboundRejectCallsDay )|| 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{queue.total || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered || 0}} ({{(queue.answered) ? (100 - (((queue.outboundDropCallsDayTimeout || 0) * 100/(queue.total)) | number:1 ) - (((queue.outboundDropCallsDayCallersExit || 0) * 100/(queue.total )) | number:1 )  ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.outboundDropCallsDayCallersExit || 0}} ({{(queue.outboundDropCallsDayCallersExit) ? (queue.outboundDropCallsDayCallersExit || 0) * 100/(queue.total ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.outboundDropCallsDayTimeout || 0}} ({{(queue.outboundDropCallsDayTimeout) ? (queue.outboundDropCallsDayTimeout || 0) * 100/(queue.total) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? (queue.sumHoldTime / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? (queue.sumDuration / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered ? ((queue.sumBillable || 0) / queue.answered) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUE_CALLS">Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ABANDONEDCALLS">Abandoned Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUE_PARAMS">Queue Parameters</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.IVR_CAMPAIGNS">Ivr Campaigns</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.openchannelAccount.name" ng-required="true" autofocus ng-disabled="!vm.newOpenchannelAccount">\n\n        <div ng-messages="openchannelAccountForm[\'name\'].$error" ng-show="openchannelAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.openchannelAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="openchannelAccountForm[\'key\'].$error" ng-show="openchannelAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.REPLYURI">replyUri</label>\n        <input type="url" name="replyUri" ng-model="vm.openchannelAccount.replyUri">\n\n        <div class="hint"><span translate="OPENCHANNEL.HELP.REPLYURI"></span></div>\n        <div ng-messages="openchannelAccountForm[\'replyUri\'].$error" ng-show="openchannelAccountForm[\'replyUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.REPLYURI_REQUIRED">replyUri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="OPENCHANNEL.ERRORS.REPLYURI_MUST_VALID_URL">replyUri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.openchannelAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.LIST"></span></div>\n        <div ng-messages="openchannelAccountForm[\'ListId\'].$error" ng-show="openchannelAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelAccount.description">\n\n        <div ng-messages="openchannelAccountForm[\'description\'].$error" ng-show="openchannelAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelAccount" ng-click="vm.saveOpenchannelAccount()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountForm.$invalid || openchannelAccountForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelAccount" ng-click="vm.addNewOpenchannelAccount()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELACCOUNT" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELACCOUNT">\n          ADD OPENCHANNELACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelAccount" ng-click="vm.deleteOpenchannelAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",'<md-dialog class="openchannelAccount-dialog" aria-label="openchannelAccount" ng-init="vm.onInit()">\n  <form name="openchannelAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">Add Agent to openchannelAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/agent/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'agent\'].$error" ng-show="openchannelAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'timeout\'].$error" ng-show="openchannelAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'accesskeyid\'].$error" ng-show="openchannelAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'secretaccesskey\'].$error" ng-show="openchannelAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'lexregion\'].$error" ng-show="openchannelAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'botname\'].$error" ng-show="openchannelAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'times\'].$error" ng-show="openchannelAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="openchannelAccountFormApp[\'text\'].$error" ng-show="openchannelAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/close/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'disposition\'].$error" ng-show="openchannelAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'key\'].$error" ng-show="openchannelAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'language\'].$error" ng-show="openchannelAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'projectId\'].$error" ng-show="openchannelAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'clientEmail\'].$error" ng-show="openchannelAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="openchannelAccountFormApp[\'privateKey\'].$error" ng-show="openchannelAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'language\'].$error" ng-show="openchannelAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'condition\'].$error" ng-show="openchannelAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'truepriority\'].$error" ng-show="openchannelAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'falsepriority\'].$error" ng-show="openchannelAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'priority\'].$error" ng-show="openchannelAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/noop/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'value\'].$error" ng-show="openchannelAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/queue/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'queue\'].$error" ng-show="openchannelAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'timeout\'].$error" ng-show="openchannelAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/system/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'command\'].$error" ng-show="openchannelAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'variable\'].$error" ng-show="openchannelAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/tag/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'tag\'].$error" ng-show="openchannelAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",'<md-dialog class="openchannelCannedAnswer-dialog" aria-label="New OpenchannelCannedAnswer">\n  <form name="openchannelCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.openchannelCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="openchannelCannedAnswerForm[\'key\'].$error" ng-show="openchannelCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.openchannelCannedAnswer.value" required></textarea>\n\n        <div ng-messages="openchannelCannedAnswerForm[\'value\'].$error" ng-show="openchannelCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelCannedAnswer.description">\n\n        <div ng-messages="openchannelCannedAnswerForm[\'description\'].$error" ng-show="openchannelCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelCannedAnswer" ng-click="vm.saveOpenchannelCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="openchannelCannedAnswerForm.$invalid || openchannelCannedAnswerForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelCannedAnswer" ng-click="vm.addNewOpenchannelCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="openchannelCannedAnswerForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER">\n          ADD OPENCHANNELCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelCannedAnswer" ng-click="vm.deleteOpenchannelCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/view.html",'<div id="openchannel-openchannelAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-openchannelAccounts-button md-icon-button" aria-label="Go to openchannelAccounts" ng-click="vm.gotoOpenchannelAccounts()" translate translate-attr-aria-label="OPENCHANNEL.GO_TO_OPENCHANNELACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="openchannelAccount-image" hide-xs>\n          <img ng-src="assets/images/business/openchannelAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.openchannelAccount.id}}\n            <span ng-if="vm.openchannelAccount.name">{{vm.openchannelAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="OPENCHANNEL.CREATED_AT"></span> <span>{{vm.openchannelAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.openchannelAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOpenchannelAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (openchannelDispositionsForm.$invalid) || (openchannelCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.openchannelAccount.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.openchannelAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="OPENCHANNEL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.REPLYURI">replyUri</label>\n                <input type="url" name="replyUri" ng-model="vm.openchannelAccount.replyUri" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.REPLYURI"></span></div>\n                <div ng-messages="generalForm[\'replyUri\'].$error" ng-show="generalForm[\'replyUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.REPLYURI_REQUIRED">replyUri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="OPENCHANNEL.ERRORS.REPLYURI_MUST_VALID_URL">replyUri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.openchannelAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.openchannelAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.openchannelAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.MAPKEY">MapKey</label>\n                <md-select name="mapKey" ng-model="vm.openchannelAccount.mapKey" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">None</md-option>\n                  <md-optgroup label="standard">\n                    <md-option ng-value="mapKey.columnName" ng-repeat="mapKey in vm.fields" ng-if="!mapKey.columnName.toString().startsWith(\'cf_\')" ng-disabled="mapKey.canSelect === false">{{ mapKey.displayName }}</md-option>\n                  </md-optgroup>\n                  <md-optgroup label="custom">\n                    <md-option ng-value="mapKey.columnName" ng-repeat="mapKey in vm.fields" ng-if="mapKey.columnName.toString().startsWith(\'cf_\')" ng-disabled="mapKey.canSelect === false">{{ mapKey.displayName }}</md-option>\n                  </md-optgroup>\n                </md-select>\n                <div ng-messages="generalForm[\'mapKey\'].$error" ng-show="generalForm[\'mapKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.MAPKEY_REQUIRED">MapKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.openchannelAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.RECEIVEURI">receiveUri</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUri" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUri" name="receiveUri" ng-value="vm.location + \'/api/openchannel/accounts/\' + vm.openchannelAccount.id + \'/notify\'" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.RECEIVEURI"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="OPENCHANNEL.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.openchannelAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.queueTransfer == true" class="md-block">\n                <label translate="OPENCHANNEL.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.openchannelAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.agentTransfer == true" class="md-block">\n                <label translate="OPENCHANNEL.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.openchannelAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.openchannelAccount.token" autofocus disabled>\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.TOKEN"></span></div>\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.mandatoryDisposition" class="md-block">\n                <label translate="OPENCHANNEL.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.openchannelAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="OpenchannelAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="openchannelAccount-detail-form-container openchanneldispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="OPENCHANNEL.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add openchannel dispositions" translate translate-attr-label="OPENCHANNEL.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="openchannelAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container openchannelcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountOpenchannelCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="OPENCHANNEL.OPENCHANNELCANNEDANSWERS">OpenchannelCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event)" aria-label="add openchannelCannedAnswer" translate translate-attr-label="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length}} {{vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountOpenchannelCannedAnswers" csv-label="true" filename="openchannelAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'OPENCHANNEL.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'OPENCHANNEL.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'OPENCHANNEL.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'OPENCHANNEL.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'OPENCHANNEL.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="openchannelCannedAnswer" md-select-id="id" ng-repeat="openchannelCannedAnswer in vm_dc.openchannelAccountOpenchannelCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{ openchannelCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" translate="OPENCHANNEL.EDIT_OPENCHANNELCANNEDANSWER">\n                                Edit OpenchannelCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(openchannelCannedAnswer, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELCANNEDANSWER">\n                                Delete OpenchannelCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.openchannelAccountOpenchannelCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="OPENCHANNEL.NO_OPENCHANNELCANNEDANSWER_AVAILABLE">No openchannelcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.openchannelAccountOpenchannelCannedAnswers.count}}" md-on-paginate="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.openchannelAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="OPENCHANNEL.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedOpenchannelAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedOpenchannelAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedOpenchannelAccountApps.length}} {{vm_ac.selectedOpenchannelAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedOpenchannelAccountApps($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedOpenchannelAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.openchannelAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editOpenchannelAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.openchannelAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="OPENCHANNEL.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getOpenchannelAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getOpenchannelAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getOpenchannelAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="OPENCHANNEL.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedOpenchannelAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountInteractions.length}} {{vm_dc.selectedOpenchannelAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountInteractions" csv-label="true" filename="openchannelAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedOpenchannelAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedOpenchannelAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'OPENCHANNEL.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'OPENCHANNEL.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'OPENCHANNEL.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'OPENCHANNEL.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'OPENCHANNEL.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'OPENCHANNEL.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'OPENCHANNEL.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.openchannelAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'OPENCHANNEL.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'OPENCHANNEL.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spyopenchannelInteraction($event, interaction)" translate="OPENCHANNEL.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event, true)" translate="OPENCHANNEL.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event)" translate="OPENCHANNEL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="OPENCHANNEL.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.openchannelAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="OPENCHANNEL.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.openchannelAccountInteractions.count}}" md-on-paginate="vm_dc.getOpenchannelAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/openchannelAccounts.html",'<div id="openchannelAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-google-earth" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="OPENCHANNEL.OPENCHANNELACCOUNTS">OpenchannelAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="OPENCHANNEL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedOpenchannelAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedOpenchannelAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="OPENCHANNEL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-openchannelAccounts-count">\n          <span>{{vm.selectedOpenchannelAccounts.length}}</span>\n          <span translate="OPENCHANNEL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="OPENCHANNEL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllOpenchannelAccounts()" translate="OPENCHANNEL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectOpenchannelAccounts()" translate="OPENCHANNEL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOpenchannelAccounts" csv-label="true" filename="openchannelAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOpenchannelAccounts($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- OPENCHANNELACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOpenchannelAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'OPENCHANNEL.KEY\' | translate }}</th>\n                <th md-column md-order-by="replyUri">{{ \'OPENCHANNEL.REPLYURI\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'OPENCHANNEL.LIST\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.openchannelAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="openchannelAccount" md-select-id="id" ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">\n                <td md-cell ng-if="openchannelAccount.userpic"><img class="avatar" alt="{{openchannelAccount.name}}" ng-src="api/users/{{openchannelAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!openchannelAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{openchannelAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="id ">{{openchannelAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="name ">{{openchannelAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="key ">{{openchannelAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="replyUri ">{{openchannelAccount.replyUri}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':openchannelAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="description ">{{openchannelAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(openchannelAccount, $event    )" translate="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT">\n                          Edit OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(openchannelAccount, $event    )" translate="OPENCHANNEL.INTERACTIONS_OPENCHANNELACCOUNT">\n                          Interactions OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(openchannelAccount, $event    )" translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">\n                          AgentAdd OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(openchannelAccount, $event    )" translate="OPENCHANNEL.DELETE_OPENCHANNELACCOUNT">\n                          Delete OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelAccounts.count}}" md-on-paginate="vm.getOpenchannelAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / OPENCHANNELACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD OPENCHANNELACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-openchannelAccount-button" ng-click="vm.createOrEditOpenchannelAccount($event)" aria-label="add openchannelAccount" translate translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD OPENCHANNELACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",'<md-dialog class="openchannelQueue-dialog" aria-label="New OpenchannelQueue">\n  <form name="openchannelQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.openchannelQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newOpenchannelQueue">\n\n        <div class="hint"><span translate="OPENCHANNEL.HELP.NAME"></span></div>\n        <div ng-messages="openchannelQueueForm[\'name\'].$error" ng-show="openchannelQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="OPENCHANNEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.openchannelQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="openchannelQueueForm[\'strategy\'].$error" ng-show="openchannelQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.openchannelQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="openchannelQueueForm[\'timeout\'].$error" ng-show="openchannelQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelQueue.description">\n\n        <div ng-messages="openchannelQueueForm[\'description\'].$error" ng-show="openchannelQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelQueue" ng-click="vm.saveOpenchannelQueue()" class="send-button md-accent md-raised" ng-disabled="openchannelQueueForm.$invalid || openchannelQueueForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelQueue" ng-click="vm.addNewOpenchannelQueue()" class="send-button md-accent md-raised" ng-disabled="openchannelQueueForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELQUEUE" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELQUEUE">\n          ADD OPENCHANNELQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelQueue" ng-click="vm.deleteOpenchannelQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",'<md-dialog class="openchannelQueue-dialog" aria-label="openchannelQueue" ng-init="vm.onInit()">\n  <form name="openchannelQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">Add Agent to openchannelQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",'<md-dialog class="openchannelQueue-dialog" aria-label="openchannelQueue" ng-init="vm.onInit()">\n  <form name="openchannelQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/view.html",'<div id="openchannel-openchannelQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-openchannelQueues-button md-icon-button" aria-label="Go to openchannelQueues" ng-click="vm.gotoOpenchannelQueues()" translate translate-attr-aria-label="OPENCHANNEL.GO_TO_OPENCHANNELQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="openchannelQueue-image" hide-xs>\n          <img ng-src="assets/images/business/openchannelQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.openchannelQueue.id}}\n            <span ng-if="vm.openchannelQueue.name">{{vm.openchannelQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="OPENCHANNEL.CREATED_AT"></span> <span>{{vm.openchannelQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.openchannelQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.openchannelQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOpenchannelQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.openchannelQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.openchannelQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.openchannelQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.openchannelQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/openchannel/views/openchannelQueues/openchannelQueues.html",'<div id="openchannelQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-google-earth" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="OPENCHANNEL.OPENCHANNELQUEUES">OpenchannelQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="OPENCHANNEL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedOpenchannelQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedOpenchannelQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="OPENCHANNEL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-openchannelQueues-count">\n          <span>{{vm.selectedOpenchannelQueues.length}}</span>\n          <span translate="OPENCHANNEL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="OPENCHANNEL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllOpenchannelQueues()" translate="OPENCHANNEL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectOpenchannelQueues()" translate="OPENCHANNEL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOpenchannelQueues" csv-label="true" filename="openchannelQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOpenchannelQueues($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- OPENCHANNELQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOpenchannelQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'OPENCHANNEL.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.openchannelQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="openchannelQueue" md-select-id="id" ng-repeat="openchannelQueue in vm.openchannelQueues.rows">\n                <td md-cell ng-if="openchannelQueue.userpic"><img class="avatar" alt="{{openchannelQueue.name}}" ng-src="api/users/{{openchannelQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!openchannelQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{openchannelQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="id ">{{openchannelQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="name ">{{openchannelQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="strategy ">{{ vm.arraystrategy[openchannelQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(openchannelQueue, $event    )" translate="OPENCHANNEL.EDIT_OPENCHANNELQUEUE">\n                          Edit OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(openchannelQueue, $event    )" translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE">\n                          teamadd OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(openchannelQueue, $event    )" translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">\n                          agentadd OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(openchannelQueue, $event    )" translate="OPENCHANNEL.DELETE_OPENCHANNELQUEUE">\n                          Delete OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(openchannelQueue, $event    )" translate="OPENCHANNEL.GOTOREALTIME_OPENCHANNELQUEUE">\n                          goToRealtime OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelQueues.count}}" md-on-paginate="vm.getOpenchannelQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / OPENCHANNELQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD OPENCHANNELQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-openchannelQueue-button" ng-click="vm.createOrEditOpenchannelQueue($event)" aria-label="add openchannelQueue" translate translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD OPENCHANNELQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/plugins/views/plugin/plugin.html",'<div ng-if="!vm.plugin">\n  <p>Plugin not available...</p>\n</div>\n<div id="plugin" ng-if="vm.plugin" ng-cloak layout-fill>\n  <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n</div>'),e.put("app/main/apps/realtime/views/agents/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools quick-filter-container">\n    <span class="md-subhead" translate="VOICE.AGENTS">Agents</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getAgents()" query="vm.query" debounce="300"></ms-search-bar>\n    <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = null; vm.getAgents()" aria-label="Status filter">\n      <md-option ng-value="null">{{ \'VOICE.ALL\' | translate }}</md-option>\n      <md-option value="pause">{{ \'VOICE.PAUSE\' | translate }}</md-option>\n      <md-option value="*pause">{{ \'VOICE.PARTIALPAUSE\' | translate }}</md-option>\n      <md-option value="busy">{{ \'VOICE.BUSY\' | translate }}</md-option>\n      <md-option value="idle">{{ \'VOICE.IDLE\' | translate }}</md-option>\n    </md-select>\n    <md-select ng-if="vm.query.globalStatusFilter === \'pause\' || vm.query.globalStatusFilter === \'*pause\'" ng-model="vm.query.pauseTypeFilter" class="md-caption ml-16" ng-change="vm.getAgents()">\n      <md-option ng-value="null">{{ \'VOICE.ALL\' | translate }}</md-option>\n      <md-option value="DEFAULT PAUSE">{{ \'VOICE.DEFAULT_PAUSE\' | translate | uppercase }}</md-option>\n      <md-option value="ACW">ACW</md-option>\n      <md-option value="LOGININPAUSE">{{ \'STAFF.LOGININPAUSE\' | translate | uppercase }}</md-option>\n      <md-option value="Auto-Pause">{{ \'VOICE.AUTOPAUSE\' | translate | uppercase }}</md-option>\n      <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n    </md-select>\n    <md-select ng-model="vm.query.globalQueueFilter" multiple class="md-caption margin-left-10 mw-150" placeholder="{{ \'DASHBOARDS.SELECT_QUEUE\' | translate }}" md-on-open="vm.getQueuesByChannel()" md-on-close="vm.getAgents()">\n      <md-button ng-click="vm.selectAllQueues()" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.SELECT_ALL\' | translate}}</md-button>\n      <md-option ng-value="queue.id" ng-repeat="queue in vm.queues.rows">{{\n        queue.name }}</md-option>\n      <md-button ng-click="vm.clearQueuesSelection()" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.CLEAR\' | translate}}</md-button>\n    </md-select>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.getAgents">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.onSort">\n      <tr md-row>\n        <th class="bv text-center" colspan="5">{{ \'VOICE.AGENT\' | translate }}</th>\n        <th class="bv bl text-center" colspan="2">{{ \'VOICE.VOICE\' | translate }}</th>\n        <th ng-if="vm.license.chat" class="bv bl text-center" colspan="2">{{ \'CHAT.CHAT\' | translate }}</th>\n        <th ng-if="vm.license.mail" class="bv bl text-center" colspan="2">{{ \'MAIL.MAIL\' | translate }}</th>\n        <th ng-if="vm.license.messaging" class="bv bl text-center" colspan="2">{{ \'SMS.SMS\' | translate }}</th>\n        <th ng-if="vm.license.openchannel" class="bv bl text-center" colspan="2">\n          {{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n        <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n        <th ng-if="vm.license.whatsapp" class="bv bl text-center" colspan="2">\n          {{ \'WHATSAPP.WHATSAPP\' | translate }}</th>\n        <th width="10px" class="bt bl" rowspan="2"></th>\n      </tr>\n      <tr md-row>\n        <th class="bl" colspan="2" md-column md-order-by="fullname">\n          {{ \'VOICE.NAME\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="globalStatus">\n          {{ \'VOICE.STATUS\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="lastLoginAt">\n          {{ \'VOICE.LOGIN_TIME\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="lastPauseAt">\n          {{ \'VOICE.PAUSE_TIME\' | translate }}</th>\n        <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n        <th class="bl custom-column">Info</th>\n        <th ng-if="vm.license.chat" class="bl text-center">{{ \'CHAT.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.chat" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'CHAT.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.mail" class="bl text-center">{{ \'MAIL.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.mail" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'MAIL.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.messaging" class="bl text-center">{{ \'SMS.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.messaging" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'SMS.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.openchannel" class="bl text-center">{{ \'OPENCHANNEL.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.openchannel" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'OPENCHANNEL.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.fax" class="bl text-center">{{ \'FAX.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.fax" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'FAX.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.whatsapp" class="bl text-center">{{ \'WHATSAPP.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.whatsapp" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'WHATSAPP.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.agents.count > 0">\n        <td md-cell colspan="19">\n          <div layout="row" layout-align="center center">\n            <span>{{ \'VOICE.NO_AGENT_ONLINE\' | translate }}</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-select="agent" md-select-id="id" ng-repeat="agent in vm.agents.rows">\n        <td class="bt padding-5">\n          <div layout="row" layout-align="start center">\n            <img class="avatar" ng-src="{{agent.userpic && \'api/users/\'+ agent.id +\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n            <div layout="column">\n              <span>{{agent.fullname}}</span>\n              <span>{{agent.internal}}</span>\n            </div>\n          </div>\n        </td>\n        <td class="bt padding-5">\n          <div layout="row" layout-align="start center" ng-if="vm.license.screenrecording && (agent.phoneBarEnableScreenRecordingByAgent || agent.phoneBarEnableAutomaticScreenRecording)">\n            <div class="column">\n              <span>\n                <md-icon md-font-icon="icon-camcorder-box" ng-class="agent.screenrecording ? \'green-fg\' : \'grey-fg\'" aria-hidden="true">\n                  <md-tooltip>\n                    {{ agent.screenrecording ? \'VOICE.TOOLTIP_SCREENRECORDING_ON\' : \'VOICE.TOOLTIP_SCREENRECORDING_OFF\'\n                    | translate }}\n                  </md-tooltip>\n                </md-icon>\n              </span>\n            </div>\n          </div>\n        </td>\n        <td class="bt text-center">\n'+"          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','busy':'indigo-100-bg','*pause':'amber-50-bg','pause':'amber-200-bg'}[agent.globalStatus]\">\n            <span ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">{{ 'VOICE.PAUSE' | translate | uppercase }} (</span>{{\n              ['pause', '*pause'].includes(agent.globalStatus) ? \n                ((agent.globalStatusDisplayValue === 'DEFAULT PAUSE' ? ('VOICE.DEFAULT_PAUSE' | translate) : agent.globalStatusDisplayValue) | uppercase) : \n                ('VOICE.' + (agent.globalStatusDisplayValue | uppercase) | translate | uppercase) }}<span ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">)</span>\n          </span>\n        </td>\n        <td class=\"bt custom-column\">\n          <timer start-time=\"agent.lastLoginAt\" utc-offset=\"vm.utcOffset\"></timer>\n        </td>\n        <td class=\"bt custom-column\">\n          <timer ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\" start-time=\"agent.lastPauseAt\" utc-offset=\"vm.utcOffset\"></timer>\n        </td>\n        <td class=\"bt bl text-center\">\n          <span ng-if=\"!agent.onhold\" class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','talking':'indigo-100-bg','ringing':'orange-400-bg','pause':'amber-200-bg'}[agent.voiceStatus]\">\n            {{ 'VOICE.' + (agent.voiceStatus | uppercase) | translate | uppercase }}</span>\n          <span ng-if=\"agent.onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">\n            {{ 'VOICE.ONHOLD' | translate | uppercase }}</span>\n        </td>\n        <td class=\"bt bl\">\n          <div layout=\"column\" ng-if=\"agent.voiceStatus === 'talking' || agent.voiceStatus === 'ringing'\">\n            <span ng-if=\"agent.queue\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">{{\n              agent.queue }}</span>\n            <span ng-if=\"agent.destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\" privacy ng-cloak>{{\n              agent.destconnectedlinenum }}</span>\n            <span ng-if=\"agent.routealias\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">{{\n              agent.routealias }}</span>\n            <span class=\"padding-5\" ng-if=\"agent.queue || agent.destconnectedlinenum\">\n              <timer start-time=\"agent.voiceStatusTime\" utc-offset=\"vm.utcOffset\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">\n              </timer>\n            </span>\n          </div>\n        </td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.chat\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.chatStatus]\">\n            {{ 'VOICE.' + (agent.chatStatus | uppercase) | translate | uppercase }}</span>\n        </td>\n        <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.chatStatus]\">\n          {{ agent.chatCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.mail\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.mailStatus]\">\n            {{ 'VOICE.' + (agent.mailStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.mailStatus]\">\n          {{ agent.mailCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.messaging\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.smsStatus]\">\n            {{ 'VOICE.' + (agent.smsStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.smsStatus]\">\n          {{ agent.smsCurrentCapacity }}</td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.openchannel\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.openchannelStatus]\">\n            {{ 'VOICE.' + (agent.openchannelStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.openchannelStatus]\">\n          {{ agent.openchannelCurrentCapacity }}</td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.fax\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.faxStatus]\">\n            {{ 'VOICE.' + (agent.faxStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.faxStatus]\">\n          {{ agent.faxCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.whatsapp\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.whatsappStatus]\">\n            {{ 'VOICE.' + (agent.whatsappStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.whatsapp\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.whatsappStatus]\">\n          {{ agent.whatsappCurrentCapacity }}</td>\n        <td class=\"bl bt padding-5 text-center\" ng-if=\"vm.crudPermissions.canEdit\">\n          <md-menu>\n            <md-button class=\"md-icon-button\" aria-label=\"More\" translate translate-attr-aria-label=\"STAFF.MORE\" ng-click=\"$mdOpenMenu($event)\">\n              <md-icon md-font-icon=\"icon-dots-vertical\"></md-icon>\n            </md-button>\n            <md-menu-content width=\"4\">\n              <md-menu-item>\n                <md-button ng-click=\"vm.logout(agent, $event)\" translate=\"VOICE.LOGOUT\">\n                  Logout\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click=\"vm.addQueue(agent, $event)\" translate=\"{{ vm.channel.toUpperCase() + '.AGENTADD_QUEUE' }}\">\n                  Add Agent In Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-if=\"vm.license.screenrecording && agent.phoneBarEnableScreenRecordingByAgent\">\n                <md-menu>\n                  <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"VOICE.SCREENRECORDING\">Manage Screen Recording\n                  </md-button>\n                  <md-menu-content>\n                    <md-menu-item>\n                      <md-button ng-click=\"vm.manageScreenRecording(agent, !agent.screenrecording)\" translate=\"{{ agent.screenrecording ? 'VOICE.STOP_SCREENRECORDING' : 'VOICE.START_SCREENRECORDING' }}\" aria-label=\"Screen Recording\">\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu>\n                  <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"VOICE.PAUSE\">Pause</md-button>\n                  <md-menu-content>\n                    <md-menu-item>\n                      <md-button ng-disabled=\"agent.voicePause && 'DEFAULT PAUSE' === agent.pauseType\" ng-click=\"vm.pause(agent)\">\n                        <em translate=\"VOICE.DEFAULT_PAUSE\">Default Pause</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if=\"vm.pauses.rows.length\" ng-repeat=\"pause in vm.pauses.rows\">\n                      <md-button ng-disabled=\"agent.voicePause && pause.name === agent.pauseType\" ng-click=\"vm.pause(agent, pause.name)\">{{pause.name}}\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">\n                <md-button ng-click=\"vm.unpause(agent)\" translate=\"VOICE.UNPAUSE\">\n                  Unpause\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label=\"{page: '{{'VOICE.PAGE' | translate}}:', rowsPerPage: '{{'VOICE.ROWSPERPAGE' | translate}}:', of: '{{'VOICE.OF' | translate}}'}\" md-limit=\"vm.query.limit\" md-limit-options=\"[10, 15, 20, 50, 100, 250]\" md-page=\"vm.query.page\" md-total=\"{{vm.agents.count}}\" md-on-paginate=\"vm.onPaginate\" md-page-select></md-table-pagination>"),e.put("app/main/apps/realtime/views/queue-calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.QUEUE_CALLS">Queue Calls</span>\n  </div>\n</md-toolbar>\n\x3c!-- QUEUES TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n        <th ng-if="vm.voiceQueueType === \'inbound\'" md-column>{{ \'VOICE.ALIAS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n        <th md-column>{{ \'VOICE.AGENT\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DURATION\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.voiceQueuesChannels.count > 0">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="channel in vm.voiceQueuesChannels.rows | limitObjectFromTo: vm.query.limit:(vm.query.page - 1) * vm.query.limit">\n        <td md-cell>\n          <md-icon ng-if="channel.queuecallerleaveAt" md-font-icon="icon-phone-in-talk green-fg"></md-icon>\n          <md-icon ng-if="!channel.queuecallerleaveAt" md-font-icon="icon-phone-incoming md-accent"></md-icon>\n        </td>\n        <td md-cell>{{channel.exten}}</td>\n        <td ng-if="vm.voiceQueueType === \'inbound\'" md-cell>{{channel.routealias}}</td>\n        <td md-cell>{{channel.queue}}</td>\n        <td md-cell privacy ng-cloak>\n          <span ng-if="vm.voiceQueueType === \'inbound\'">{{channel.calleridname}}, </span>\n          <span>{{channel.calleridnum}}</span>\n        </td>\n        <td md-cell>\n          <span ng-if="channel.queuecallerleaveAt">\n            {{channel.connectedlinename}}, {{channel.connectedlinenum}}\n            <span class="text-boxed">\n              <timer start-time="channel.queuecallerleaveAt"></timer>\n            </span>\n          </span>\n          <span ng-if="!channel.queuecallerleaveAt" class="text-boxed">\n            {{ \'VOICE.WAITING_FOR_AGENT\' | translate }}\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell>\n          <span class="text-boxed">\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item>\n                <md-button ng-click="vm.hangup(channel.uniqueid)" translate="VOICE.HANGUP">\n                  Hangup\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.redirectToNumber($event, channel.uniqueid)" translate="VOICE.REDIRECT_TO_NUMBER">\n                  Number\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu class="no-margin">\n                  <md-button ng-mouseenter="vm.getAvailableAgents()" translate="VOICE.REDIRECT_TO_AGENT">\n                    Redirect to Agent</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="!vm.availableAgents">\n                      <md-progress-circular class="md-accent auto-margin" md-diameter="32" md-mode="indeterminate">\n                      </md-progress-circular>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length > 0" ng-repeat="agent in vm.availableAgents">\n                      <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">\n                        {{agent.name}}</md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length === 0">\n                      <span>{{ \'VOICE.NO_AGENT_AVAILABLE\' | translate }}</span>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-page="vm.query.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{ vm.voiceQueuesChannels.count }}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/realtime/views/queues/predictive/dialog.html",'<md-dialog class="predictive-dialog" aria-label="New predictive">\n  <md-toolbar class="md-accent md-hue-2">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ vm.queueCampaign.name }} {{ \'DASHBOARDS.INFO\' | translate }}</span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-dialog-content class="text-center">\n    <ds-widget-clock data-show-digital></ds-widget-clock>\n    <div ng-if="!vm.queueCampaign.startProgressive && !vm.queueCampaign.startPredictive">\n      <div class="md-title"><span translate="MOTIONDIALER.PREDICTIVE_IS_NOT_RUNNING">Predictive is not running</span></div>\n    </div>\n\n    <div ng-if="vm.queueCampaign.startProgressive && !vm.queueCampaign.startPredictive" class="m-10">\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-headline"><span translate="MOTIONDIALER.DATA_COLLECTION_IN_PROGRESSIVE">Data collection in progressive</span></div>\n          <div class="md-subhead">({{vm.queueCampaign.dialPredictiveInterval}} minutes)</div>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.STARTTIME">Start Time</span></div>\n          <div class="md-headline">{{ vm.formatTime(vm.queueCampaign.startProgressive) }}</div>\n        </div>\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.ENDTIME">End Time</span></div>\n          <div class="md-headline">\n            {{ vm.formatTime(vm.queueCampaign.startProgressive, vm.queueCampaign.dialPredictiveInterval) }}\n          </div>\n        </div>\n      </div>\n      <div>\n        <span class="text-boxed blue-bg white-fg">\n          {{vm.queueCampaign.message ? (\'MOTIONDIALER.\' + vm.queueCampaign.message | translate) : \'--\'}}\n        </span>\n      </div>\n    </div>\n    <div ng-if="vm.queueCampaign.startPredictive" class="m-10">\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-headline"><span translate="MOTIONDIALER.PREDICTIVE_IS_RUNNING">Predictive is runnning</span></div>\n          <div class="md-subhead">({{vm.queueCampaign.dialPredictiveInterval}} minutes)</div>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.STARTTIME">Start Time</span></div>\n          <div class="md-headline">{{ vm.formatTime(vm.queueCampaign.startPredictive) }}</div>\n        </div>\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.ENDTIME">End Time</span></div>\n          <div class="md-headline">\n            {{ vm.formatTime(vm.queueCampaign.startPredictive, vm.queueCampaign.dialPredictiveInterval) }}\n          </div>\n        </div>\n      </div>\n      <div>\n        <span class="text-boxed blue-bg white-fg">\n          {{vm.queueCampaign.message ? (\'MOTIONDIALER.\' + vm.queueCampaign.message | translate) : \'--\'}}\n        </span>\n      </div>\n      <div class="row">\n        <md-card>\n          <md-toolbar class="md-table-toolbar md-default">\n            <div class="md-toolbar-tools">\n              <span class="md-subhead">Predictive - {{ \'MOTIONDIALER.PREVIOUS_INTERVAL\' | translate }}</span>\n            </div>\n          </md-toolbar>\n          <md-table-container>\n            <table md-table>\n              <tbody md-body>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.TOTAL_CALLS">Total Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.predictiveIntervalTotalCalls }}</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.ANSWERED_CALLS">Total Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.predictiveIntervalAnsweredCalls }}</td>\n                </tr>\n                \x3c!-- Temporaneamente non mostrate perchè contengono anche i dati dell\'intervallo corrente --\x3e\n                \x3c!-- <tr md-row>\n                      <td md-cell>Dropped Calls Timeout</td>\n                      <td md-cell>{{ vm.queueCampaign.predictiveIntervalDroppedCallsTimeout }}</td>\n                    </tr>\n                    <tr md-row>\n                      <td md-cell>Dropped Calls Caller Exit</td>\n                      <td md-cell>{{ vm.queueCampaign.predictiveIntervalDroppedCallsCallersExit }}\n                      </td>\n                    </tr> --\x3e\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AVG_HOLD_TIME">AVG Hold Time</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.predictiveIntervalAvgHoldtime | number:0 }}s</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AVG_TALK_TIME">AVG Talk Time</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.predictiveIntervalAvgTalktime | number:0 }}s</td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n        </md-card>\n        <md-card>\n          <md-toolbar class="md-table-toolbar md-default">\n            <div class="md-toolbar-tools">\n              <span class="md-subhead">ErlangB - {{ \'MOTIONDIALER.CURRENT_INTERVAL\' | translate }}</span>\n            </div>\n          </md-toolbar>\n          <md-table-container>\n            <table md-table>\n              <tbody md-body>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangCalls }}</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.ONE_CALL_EVERY">One call every</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.erlangCallToSecond | number:0 }}s</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.DROPRATE">Drop Rate</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangAbandonmentRate * 100 | number:2 }}%</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AGENTBUSYFACTOR">Agent Busy Factor</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangBusyFactor * 100 | number:2 }}%</td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n        </md-card>\n      </div>\n    </div>\n  </md-dialog-content>\n</md-dialog>'),e.put("app/main/apps/realtime/views/queues/templates/actions.html",'<md-menu>\n  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n  </md-button>\n  <md-menu-content width="3">\n    <md-menu-item>\n      <md-button ng-click="vm.editQueue($event, queue)" translate="{{ (vm.channel | uppercase) + \'.EDIT_QUEUE\' }}">\n        Edit Queue\n      </md-button>\n    </md-menu-item>\n    <md-menu-item ng-if="queue.dialMethod === \'predictive\'">\n      <md-button ng-click="vm.showPredictiveInfo($event, queue)" translate="MOTIONDIALER.SHOW_PREDICTIVE_QUEUE_CAMPAIGN_INFO">\n        Show Predictive Info\n      </md-button>\n    </md-menu-item>\n    <md-menu-item>\n      <md-button ng-click="vm.addOrRemoveAgents($event, queue)" translate="{{ (vm.channel | uppercase) + \'.AGENTSADD_QUEUE\' }}">\n        Add Agents to queue\n      </md-button>\n    </md-menu-item>\n  </md-menu-content>\n</md-menu>'),e.put("app/main/apps/realtime/views/queues/templates/headers/default.html","<tr md-row>\n  <th md-column md-order-by=\"name\">{{ (vm.channel | uppercase) + '.NAME' | translate }}</th>\n  <th md-column>{{ (vm.channel | uppercase) + '.LOGGED_IN' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.AVAILABLE' | translate }}</th>\n  <th md-column>{{ (vm.channel | uppercase) + '.PAUSED' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.WAITING_INTERACTIONS' | translate }}</th>\n  <th md-column width=\"10px\"></th>\n</tr>"),e.put("app/main/apps/realtime/views/queues/templates/headers/inbound.html","<tr md-row>\n  <th md-column md-order-by=\"name\">{{ 'VOICE.NAME' | translate }}</th>\n  <th md-column>{{ 'VOICE.LOGGED_IN' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.AVAILABLE' | translate }}</th>\n  <th md-column>{{ 'VOICE.PAUSED' | translate }}</th>\n  <th md-column>{{ 'VOICE.TALKING' | translate }}</th>\n  <th md-column>{{ 'VOICE.BUSY' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.WAITING_CALLS' | translate }}</th>\n  <th md-column width=\"10px\"></th>\n</tr>"),e.put("app/main/apps/realtime/views/queues/templates/headers/outbound.html","<tr md-row>\n  <th md-column md-order-by=\"name\">{{ 'MOTIONDIALER.NAME' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.LOGGED_IN' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.AVAILABLE' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.PAUSED' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.TALKING' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.BUSY' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.WAITING_CALLS' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.ORIGINATED_TEXT' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.MESSAGE' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.METHOD' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.TRUNK' | translate }}</th>\n  <th md-column md-order-by=\"dialActive\">{{ 'MOTIONDIALER.ACTIVE' | translate }}</th>\n  <th md-column width=\"10px\"></th>\n</tr>"),e.put("app/main/apps/realtime/views/queues/templates/rows/default.html",'<tr md-row ng-hide="vm.queues.count > 0">\n  <td md-cell colspan="6">\n    <div layout="row" layout-align="center center">\n      <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n    </div>\n  </td>\n</tr>\n<tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n  <td md-cell>{{ queue.name }}</td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n  </td>\n\n  <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit" ng-include="\'app/main/apps/realtime/views/queues/templates/actions.html\'"></td>\n</tr>'),e.put("app/main/apps/realtime/views/queues/templates/rows/inbound.html",'<tr md-row ng-hide="vm.queues.count > 0">\n  <td md-cell colspan="8">\n    <div layout="row" layout-align="center center">\n      <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n    </div>\n  </td>\n</tr>\n<tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n  <td md-cell>{{ queue.name }}</td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.loggedInDb }} ({{ queue.loggedIn }})</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.talking }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.inUse - queue.talking }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n  </td>\n\n  <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit" ng-include="\'app/main/apps/realtime/views/queues/templates/actions.html\'"></td>\n</tr>'),e.put("app/main/apps/realtime/views/queues/templates/rows/outbound.html",'<tr md-row ng-hide="vm.queues.count > 0">\n  <td md-cell colspan="13">\n    <div layout="row" layout-align="center center">\n      <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n    </div>\n  </td>\n</tr>\n<tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n  <td md-cell>{{ queue.name }}</td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.loggedInDb }} ({{ queue.loggedIn }})</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.talking + queue.pTalking }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.inUse - queue.talking - queue.pTalking }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.originated }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-16 grey-fg">{{ queue.message ? (\'MOTIONDIALER.\' + queue.message | translate) : (queue.statusMessage ? (\'MOTIONDIALER.\' + queue.statusMessage | translate) : \'--\')}}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.dialMethod || 0 }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-16 grey-fg">{{ queue.Trunk ? queue.Trunk.name : \'--\' }}</span>\n  </td>\n  <td md-cell>\n'+"    <md-icon md-colors=\"{color: {{queue.dialActive ? '\\'green\\'' : '\\'red\\''}}}\" md-font-icon=\"{{queue.dialActive ? 'icon-check' : 'icon-close'}}\"></md-icon>\n  </td>\n\n  <td md-cell class=\"actions\" ng-if=\"vm.crudPermissions.canEdit\" ng-include=\"'app/main/apps/realtime/views/queues/templates/actions.html'\"></td>\n</tr>"),e.put("app/main/apps/realtime/views/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="{{ (vm.channel | uppercase) + \'.QUEUES\' }}">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues" ng-include="vm.headersTemplate">\n    </thead>\n    <tbody md-body ng-include="vm.rowsTemplate"></tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{ \'DASHBOARDS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'DASHBOARDS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'DASHBOARDS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/settings/views/cloudProviders/cloudProviders.html",'<div id="cloudProviders" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.CLOUD_PROVIDERS">Cloud Providers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SETTINGS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedAiTools.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedAiTools =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SETTINGS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-cloudProviders-count">\n          <span>{{vm.selectedAiTools.length}}</span>\n          <span translate="SETTINGS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SETTINGS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllAiTools()" translate="SETTINGS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectAiTools()" translate="SETTINGS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedAiTools" csv-label="true" filename="cloudProviders.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-click="vm.deleteSelectedAiTools($event)" aria-label="delete selected" translate translate-attr-label="SETTINGS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CLOUDPROVIDER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedAiTools" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAiTools">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SETTINGS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SETTINGS.NAME\' | translate }}</th>\n                <th md-column md-order-by="service">{{ \'SETTINGS.SERVICE\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.cloudProviders.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SETTINGS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="cloudProvider" md-select-id="id" ng-repeat="cloudProvider in vm.cloudProviders.rows">\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="id">{{cloudProvider.id}}</td>\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="name">{{cloudProvider.name}}</td>\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="service">{{ vm.services[cloudProvider.service] }}</td>\n\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SETTINGS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="cloudProvider.service === \'MicrosoftAzure\'">\n                        <md-button ng-click="vm.authenticateToMicrosoftIdentityPlatform(cloudProvider)" translate="SETTINGS.AUTHENTICATE">\n                          Authenticate\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item ng-if="cloudProvider.service === \'MicrosoftAzure\'">\n                        <md-button ng-click="vm.updateClientSecret(cloudProvider, $event)" translate="SETTINGS.UPDATE_CLIENT_SECRET">\n                          Update Client Secret\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item>\n                        <md-button ng-click="vm.editdialog(cloudProvider, $event)" translate="SETTINGS.EDIT_CLOUDPROVIDER">\n                          Edit CloudProvider\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item>\n                        <md-button ng-click="vm.deleteconfirm(cloudProvider, $event)" translate="SETTINGS.DELETE_CLOUDPROVIDER">\n                          Delete CloudProvider\n                        </md-button>\n                      </md-menu-item>\n\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SETTINGS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SETTINGS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SETTINGS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.cloudProviders.count}}" md-on-paginate="vm.getAiTools" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CLOUDPROVIDER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CLOUDPROVIDER BUTTON --\x3e\n  <md-button class="md-fab md-accent" id="add-cloudProvider-button" ng-click="vm.createOrEditCloudProvider($event)" aria-label="add cloudProvider" translate translate-attr-aria-label="SETTINGS.ADD_CLOUDPROVIDER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CLOUDPROVIDER BUTTON --\x3e\n</div>'),e.put("app/main/apps/settings/views/cloudProviders/create/dialog.html",'<md-dialog class="cloudProvider-dialog" aria-label="New CloudProvider">\n  <form name="cloudProviderForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (vm.newCloudProvider ? \'SETTINGS.NEW_CLOUDPROVIDER\' : \'SETTINGS.EDIT_CLOUDPROVIDER\') | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.cloudProvider.name" ng-required="true" autofocus>\n\n        <div ng-messages="cloudProviderForm[\'name\'].$error" ng-show="cloudProviderForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.SERVICE">Service</label>\n        <md-select name="service" ng-model="vm.cloudProvider.service" required ng-disabled="!vm.newCloudProvider">\n          <md-option ng-if="vm.license.ai" ng-value="\'AmazonAWS\'">AmazonAWS</md-option>\n          <md-option ng-value="\'MicrosoftAzure\'">Microsoft Azure</md-option>\n        </md-select>\n        <div ng-messages="cloudProviderForm[\'service\'].$error" ng-show="cloudProviderForm[\'service\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.SERVICE_REQUIRED">Service field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.cloudProvider.service == \'MicrosoftAzure\'" class="md-block">\n        <label translate="SETTINGS.TYPE">Type</label>\n        <md-select name="service" ng-model="vm.cloudProvider.type" required ng-disabled="!vm.newCloudProvider">\n          <md-option ng-value="\'Outlook365\'">Outlook365</md-option>\n          <md-option ng-value="\'Dynamics365\'">Dynamics365</md-option>\n        </md-select>\n        <div ng-messages="cloudProviderForm[\'type\'].$error" ng-show="cloudProviderForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.cloudProvider.service == \'AmazonAWS\'" class="md-block">\n        <label translate="SETTINGS.ACCESSKEY">AccessKey</label>\n        <input type="text" name="data2" ng-model="vm.cloudProvider.data2" ng-required="true">\n\n        <div ng-messages="cloudProviderForm[\'data2\'].$error" ng-show="cloudProviderForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ACCESSKEY_REQUIRED">AccessKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.cloudProvider.service == \'AmazonAWS\'" class="md-block">\n        <label translate="SETTINGS.SECRETACCESSKEY">SecretAccesskey</label>\n        <input type="text" name="data1" ng-model="vm.cloudProvider.data1" ng-required="true">\n\n        <div ng-messages="cloudProviderForm[\'data1\'].$error" ng-show="cloudProviderForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.SECRETACCESSKEY_REQUIRED">SecretAccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div ng-if="vm.cloudProvider.service == \'MicrosoftAzure\'">\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.APPLICATION_ID">Application Id</label>\n          <input type="text" name="data1" ng-model="vm.cloudProvider.data1" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data1\'].$error" ng-show="cloudProviderForm[\'data1\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.TENANT_ID">Tenant Id</label>\n          <input type="text" name="data2" ng-model="vm.cloudProvider.data2" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data2\'].$error" ng-show="cloudProviderForm[\'data2\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container ng-if="vm.newCloudProvider" class="md-block">\n          <label translate="SETTINGS.CLIENT_SECRET">Client Secret</label>\n          <input type="password" name="data3" ng-model="vm.cloudProvider.data3" ng-required="true">\n          <div class="hint"><span translate="SETTINGS.HELP.CLIENT_SECRET"></span></div>\n\n          <div ng-messages="cloudProviderForm[\'data3\'].$error" ng-show="cloudProviderForm[\'data3\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.REDIRECT_URI">Redirect Uri</label>\n          <input type="url" name="data4" ng-model="vm.cloudProvider.data4" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data4\'].$error" ng-show="cloudProviderForm[\'data4\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n            <div ng-message="url">\n              <span translate="SETTINGS.ERRORS.WRONG_FORMAT"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container ng-if="vm.cloudProvider.type == \'Dynamics365\'" class="md-block">\n          <label translate="SETTINGS.REMOTE_URI">Remote Uri</label>\n          <input type="url" name="data7" ng-model="vm.cloudProvider.data7" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data7\'].$error" ng-show="cloudProviderForm[\'data7\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n            <div ng-message="url">\n              <span translate="SETTINGS.ERRORS.WRONG_FORMAT"></span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newCloudProvider" ng-click="vm.saveCloudProvider()" class="send-button md-accent md-raised" ng-disabled="cloudProviderForm.$invalid || cloudProviderForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newCloudProvider" ng-click="vm.addNewCloudProvider()" class="send-button md-accent md-raised" ng-disabled="cloudProviderForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_CLOUDPROVIDER" translate-attr-aria-label="SETTINGS.ADD_CLOUDPROVIDER">\n          ADD CLOUDPROVIDER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.deleteCloudProvider($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/cloudProviders/updateSecret/updateSecret.html",'<md-dialog class="cloudProvider-dialog" aria-label="update client secret">\n  <form name="updateSecretForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'SETTINGS.UPDATE_CLIENT_SECRET\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.user.id">\n        <label translate="SETTINGS.CLIENT_SECRET">Current Client Secret</label>\n        <input type="text" name="currentSecret" ng-model="vm.cloudProvider.data3" disabled>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NEW_CLIENT_SECRET">New Client Secret</label>\n        <input type="password" name="secret" ng-model="vm.newSecret" required>\n        <div ng-messages="updateSecretForm.secret.$error" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">New Client Secret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveSecret()" class="send-button md-accent md-raised" ng-disabled="updateSecretForm.$invalid || updateSecretForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/customizations/create/dialog.html",'<md-dialog class="customization-dialog" aria-label="New Customization">\n  <form name="customizationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultLogo" aria-label="Default_Logo"><span translate="SETTINGS.DEFAULT_LOGO">Default_Logo</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultLoginLogo" aria-label="Default_Login_Logo"><span translate="SETTINGS.DEFAULT_LOGIN_LOGO">Default_Login_Logo</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultFavicon" aria-label="Default_Favicon"><span translate="SETTINGS.DEFAULT_FAVICON">Default_Favicon</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultHeaderWhiteLabel" aria-label="Default_Header_WhiteLabel"><span translate="SETTINGS.DEFAULT_HEADER_WHITELABEL">Default_Header_WhiteLabel</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.customization.defaultHeaderWhiteLabel" class="md-block">\n        <label translate="SETTINGS.HEADER_WHITELABEL">Header_WhiteLabel</label>\n        <input type="text" name="headerWhiteLabel" ng-model="vm.customization.headerWhiteLabel" ng-required="true">\n\n        <div ng-messages="customizationForm[\'headerWhiteLabel\'].$error" ng-show="customizationForm[\'headerWhiteLabel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.HEADER_WHITELABEL_REQUIRED">Header_WhiteLabel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultPageTitle" aria-label="Default_Page_Title"><span translate="SETTINGS.DEFAULT_PAGE_TITLE">Default_Page_Title</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.customization.defaultPageTitle" class="md-block">\n        <label translate="SETTINGS.PAGE_TITLE">Page_Title</label>\n        <input type="text" name="pageTitle" ng-model="vm.customization.pageTitle" ng-required="true">\n\n        <div ng-messages="customizationForm[\'pageTitle\'].$error" ng-show="customizationForm[\'pageTitle\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PAGE_TITLE_REQUIRED">Page_Title field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.license.preferred" class="md-block">\n        <md-switch ng-model="vm.customization.defaultPreferred" aria-label="Default_Preferred"><span translate="SETTINGS.DEFAULT_PREFERRED">Default_Preferred</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomization" ng-click="vm.saveCustomization()" class="send-button md-accent md-raised" ng-disabled="customizationForm.$invalid || customizationForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomization" ng-click="vm.addNewCustomization()" class="send-button md-accent md-raised" ng-disabled="customizationForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_CUSTOMIZATION" translate-attr-aria-label="SETTINGS.ADD_CUSTOMIZATION">\n          ADD CUSTOMIZATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomization" ng-click="vm.deleteCustomization($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/customizations/customizations.html",'<div id="customizations" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.CUSTOMIZATIONS">Customizations</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveCustomization()" ng-disabled="(customizationsForm.$pristine && logoForm.$pristine && logologinForm.$pristine && preferredForm.$pristine && faviconForm.$pristine) || (customizationsForm.$invalid || logoForm.$invalid || logologinForm.$invalid || preferredForm.$invalid || faviconForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div class="customization-detail-form-container customizations md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.CUSTOMIZATIONS">CUSTOMIZATIONS</div>\n        </div>\n        <form name="customizationsForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultLogo" aria-label="Default_Logo"><span translate="SETTINGS.DEFAULT_LOGO">Default_Logo</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultLoginLogo" aria-label="Default_Login_Logo"><span translate="SETTINGS.DEFAULT_LOGIN_LOGO">Default_Login_Logo</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultFavicon" aria-label="Default_Favicon"><span translate="SETTINGS.DEFAULT_FAVICON">Default_Favicon</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultHeaderWhiteLabel" aria-label="Default_Header_WhiteLabel"><span translate="SETTINGS.DEFAULT_HEADER_WHITELABEL">Default_Header_WhiteLabel</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="!vm.customization.defaultHeaderWhiteLabel" class="md-block">\n            <label translate="SETTINGS.HEADER_WHITELABEL">Header_WhiteLabel</label>\n            <input type="text" name="headerWhiteLabel" ng-model="vm.customization.headerWhiteLabel" ng-required="true">\n\n            <div ng-messages="customizationsForm[\'headerWhiteLabel\'].$error" ng-show="customizationsForm[\'headerWhiteLabel\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.HEADER_WHITELABEL_REQUIRED">Header_WhiteLabel field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultPageTitle" aria-label="Default_Page_Title"><span translate="SETTINGS.DEFAULT_PAGE_TITLE">Default_Page_Title</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="!vm.customization.defaultPageTitle" class="md-block">\n            <label translate="SETTINGS.PAGE_TITLE">Page_Title</label>\n            <input type="text" name="pageTitle" ng-model="vm.customization.pageTitle" ng-required="true">\n\n            <div ng-messages="customizationsForm[\'pageTitle\'].$error" ng-show="customizationsForm[\'pageTitle\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PAGE_TITLE_REQUIRED">Page_Title field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.license.preferred" class="md-block">\n            <md-switch ng-model="vm.customization.defaultPreferred" aria-label="Default_Preferred"><span translate="SETTINGS.DEFAULT_PREFERRED">Default_Preferred</span></md-switch>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="!vm.customization.defaultLogo" class="customization-detail-form-container logo md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.LOGO">LOGO</div>\n        </div>\n        <div ng-controller="CustomizationlogoController as vm_cl" ng-init="vm_cl.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cl.ngFlowOptions" flow-name="vm_cl.ngFlow.flow" flow-files-submitted="vm_cl.upload()" flow-file-added="vm_cl.fileAdded($file)" flow-file-success="vm_cl.fileSuccess($file, $message)" flow-complete="vm_cl.uploadComplete()" flow-drop flow-drag-enter="vm_cl.dropping=true" flow-drag-leave="vm_cl.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="logoimage in vm_cl.customization.images" ng-switch="logoimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{logoimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="logoimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{logoimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultLoginLogo" class="customization-detail-form-container logologin md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.LOGOLOGIN">LOGOLOGIN</div>\n        </div>\n        <div ng-controller="CustomizationlogologinController as vm_cll" ng-init="vm_cll.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cll.ngFlowOptions" flow-name="vm_cll.ngFlow.flow" flow-files-submitted="vm_cll.upload()" flow-file-added="vm_cll.fileAdded($file)" flow-file-success="vm_cll.fileSuccess($file, $message)" flow-complete="vm_cll.uploadComplete()" flow-drop flow-drag-enter="vm_cll.dropping=true" flow-drag-leave="vm_cll.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="logologinimage in vm_cll.customization.images" ng-switch="logologinimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{logologinimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="logologinimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{logologinimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultPreferred && vm.license.preferred" class="customization-detail-form-container preferred md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.PREFERRED">PREFERRED</div>\n        </div>\n        <div ng-controller="CustomizationpreferredController as vm_cp" ng-init="vm_cp.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cp.ngFlowOptions" flow-name="vm_cp.ngFlow.flow" flow-files-submitted="vm_cp.upload()" flow-file-added="vm_cp.fileAdded($file)" flow-file-success="vm_cp.fileSuccess($file, $message)" flow-complete="vm_cp.uploadComplete()" flow-drop flow-drag-enter="vm_cp.dropping=true" flow-drag-leave="vm_cp.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="preferredimage in vm_cp.customization.images" ng-switch="preferredimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{preferredimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="preferredimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{preferredimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultFavicon" class="customization-detail-form-container favicon md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.FAVICON">FAVICON</div>\n        </div>\n        <div ng-controller="CustomizationfaviconController as vm_cf" ng-init="vm_cf.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cf.ngFlowOptions" flow-name="vm_cf.ngFlow.flow" flow-files-submitted="vm_cf.upload()" flow-file-added="vm_cf.fileAdded($file)" flow-file-success="vm_cf.fileSuccess($file, $message)" flow-complete="vm_cf.uploadComplete()" flow-drop flow-drag-enter="vm_cf.dropping=true" flow-drag-leave="vm_cf.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG, ICO - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="faviconimage in vm_cf.customization.images" ng-switch="faviconimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{faviconimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="faviconimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{faviconimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/settings/views/generals/create/dialog.html",'<md-dialog class="general-dialog" aria-label="New General">\n  <form name="generalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newGeneral" ng-click="vm.saveGeneral()" class="send-button md-accent md-raised" ng-disabled="generalForm.$invalid || generalForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newGeneral" ng-click="vm.addNewGeneral()" class="send-button md-accent md-raised" ng-disabled="generalForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_GENERAL" translate-attr-aria-label="SETTINGS.ADD_GENERAL">\n          ADD GENERAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newGeneral" ng-click="vm.deleteGeneral($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/generals/generals.html",'<div id="generals" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.GENERAL">General</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveGeneral()" ng-disabled="(globalForm.$pristine && motionbarForm.$pristine && reportForm.$pristine && agentOmniDesktopInterfaceForm.$pristine && screenRecordingForm.$pristine && securityForm.$pristine && imapGeneralSettingsForm.$pristine && SSOForm.$pristine && aiToolsForm.$pristine) || (globalForm.$invalid || motionbarForm.$invalid || reportForm.$invalid || agentOmniDesktopInterfaceForm.$invalid || screenRecordingForm.$invalid || securityForm.$invalid || imapGeneralSettingsForm.$invalid || SSOForm.$invalid || aiToolsForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div class="general-detail-form-container global md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.GLOBAL">GLOBAL</div>\n        </div>\n        <form name="globalForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MIN_INTERNAL">Min_Internal</label>\n            <input type="number" name="min_internal" ng-model="vm.general.min_internal" min="0" value="1000" ng-required="true" autofocus>\n\n            <div ng-messages="globalForm[\'min_internal\'].$error" ng-show="globalForm[\'min_internal\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MIN_INTERNAL_REQUIRED">Min_Internal field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.MIN_INTERNAL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Min_Internal must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.CHATTIMEOUT">chatTimeout</label>\n            <input type="number" name="chatTimeout" ng-model="vm.general.chatTimeout" min="0" value="30" ng-required="true">\n\n            <div ng-messages="globalForm[\'chatTimeout\'].$error" ng-show="globalForm[\'chatTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.CHATTIMEOUT_REQUIRED">chatTimeout field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.CHATTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">chatTimeout must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.rtlSupport" aria-label="RtlSupport"><span translate="SETTINGS.RTLSUPPORT">RtlSupport</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.RTLSUPPORT"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.stopRecordingOnTransfer" aria-label="Stop_Recording_On_Voice_Call_Transfer"><span translate="SETTINGS.STOP_RECORDING_ON_VOICE_CALL_TRANSFER">Stop_Recording_On_Voice_Call_Transfer</span></md-switch>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div class="general-detail-form-container motionbar md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.MOTIONBAR">MOTIONBAR</div>\n        </div>\n        <form name="motionbarForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.phoneBarAutoUpdater" aria-label="MotionbarAutoUpdater"><span translate="SETTINGS.MOTIONBARAUTOUPDATER">MotionbarAutoUpdater</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.phoneBarAutoUpdater" class="md-block">\n            <label translate="SETTINGS.MOTIONBARAUTOUPDATERURL">MotionbarAutoUpdaterUrl</label>\n            <input type="url" name="phoneBarAutoUpdaterUrl" ng-model="vm.general.phoneBarAutoUpdaterUrl" value="https://www.xcally.com/bar/phonebar/autoupdater.xml" ng-required="vm.general.phoneBarAutoUpdater">\n\n            <div ng-messages="motionbarForm[\'phoneBarAutoUpdaterUrl\'].$error" ng-show="motionbarForm[\'phoneBarAutoUpdaterUrl\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MOTIONBARAUTOUPDATERURL_REQUIRED">MotionbarAutoUpdaterUrl field is required</span>\n              </div>\n              <div ng-message="url">\n                <span translate="SETTINGS.ERRORS.MOTIONBARAUTOUPDATERURL_MUST_VALID_URL">MotionbarAutoUpdaterUrl must be a valid url http://www.xcally.com</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.phoneBarRememberMeEnabled" aria-label="MotionbarRememberMe"><span translate="SETTINGS.MOTIONBARREMEMBERME">MotionbarRememberMe</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.MOTIONBARREMEMBERME"></span></div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container report md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.REPORT">REPORT</div>\n        </div>\n        <form name="reportForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.split" aria-label="Split"><span translate="SETTINGS.SPLIT">Split</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZECSV">SplitSizeCsv</label>\n            <input type="number" name="splitSizeCsv" ng-model="vm.general.splitSizeCsv" value="5000">\n\n            <div ng-messages="reportForm[\'splitSizeCsv\'].$error" ng-show="reportForm[\'splitSizeCsv\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZECSV_REQUIRED">SplitSizeCsv field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZEPDF">SplitSizePdf</label>\n            <input type="number" name="splitSizePdf" ng-model="vm.general.splitSizePdf" value="1000">\n\n            <div ng-messages="reportForm[\'splitSizePdf\'].$error" ng-show="reportForm[\'splitSizePdf\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZEPDF_REQUIRED">SplitSizePdf field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZEXLSX">SplitSizeXlsx</label>\n            <input type="number" name="splitSizeXlsx" ng-model="vm.general.splitSizeXlsx" value="5000">\n\n            <div ng-messages="reportForm[\'splitSizeXlsx\'].$error" ng-show="reportForm[\'splitSizeXlsx\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZEXLSX_REQUIRED">SplitSizeXlsx field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container agentomnidesktopinterface md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.AGENTOMNIDESKTOPINTERFACE">AGENTOMNIDESKTOPINTERFACE</div>\n        </div>\n        <form name="agentOmniDesktopInterfaceForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.enableEmailPreview" aria-label="EnableEmailPreview"><span translate="SETTINGS.ENABLEEMAILPREVIEW">EnableEmailPreview</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.searchOnEnterKey" aria-label="Search_On_Enter_Key"><span translate="SETTINGS.SEARCH_ON_ENTER_KEY">Search_On_Enter_Key</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.SEARCH_ON_ENTER_KEY"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MESSAGESALIGNMENT">messagesAlignment</label>\n            <md-select name="messagesAlignment" ng-model="vm.general.messagesAlignment">\n              <md-option ng-value="\'alternate\'">Alternate</md-option>\n              <md-option ng-value="\'left\'">Left</md-option>\n              <md-option ng-value="\'right\'">Right</md-option>\n            </md-select>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'messagesAlignment\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'messagesAlignment\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MESSAGESALIGNMENT_REQUIRED">messagesAlignment field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.CHAT_INTERACTIONS_RELOAD_TIMEOUT">Chat_Interactions_Reload_Timeout</label>\n            <input type="number" name="chatInteractionsReloadTimeout" ng-model="vm.general.chatInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'chatInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'chatInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.CHAT_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Chat_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MAIL_INTERACTIONS_RELOAD_TIMEOUT">Mail_Interactions_Reload_Timeout</label>\n            <input type="number" name="mailInteractionsReloadTimeout" ng-model="vm.general.mailInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'mailInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'mailInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MAIL_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Mail_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.OPENCHANNEL_INTERACTIONS_RELOAD_TIMEOUT">Openchannel_Interactions_Reload_Timeout</label>\n            <input type="number" name="openchannelInteractionsReloadTimeout" ng-model="vm.general.openchannelInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'openchannelInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'openchannelInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.OPENCHANNEL_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Openchannel_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.SMS_INTERACTIONS_RELOAD_TIMEOUT">Sms_Interactions_Reload_Timeout</label>\n            <input type="number" name="smsInteractionsReloadTimeout" ng-model="vm.general.smsInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'smsInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'smsInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SMS_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Sms_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.WHATSAPP_INTERACTIONS_RELOAD_TIMEOUT">Whatsapp_Interactions_Reload_Timeout</label>\n            <input type="number" name="whatsappInteractionsReloadTimeout" ng-model="vm.general.whatsappInteractionsReloadTimeout">\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'whatsappInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'whatsappInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.WHATSAPP_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Whatsapp_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.PREVIEW_RECALLME_REMINDER_INTERVAL">Preview_Recallme_Reminder_Interval</label>\n            <input type="number" name="previewRecallmeReminderInterval" ng-model="vm.general.previewRecallmeReminderInterval" min="1">\n            <div class="hint"><span translate="SETTINGS.HELP.PREVIEW_RECALLME_REMINDER_INTERVAL"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'previewRecallmeReminderInterval\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'previewRecallmeReminderInterval\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PREVIEW_RECALLME_REMINDER_INTERVAL_REQUIRED">Preview_Recallme_Reminder_Interval field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PREVIEW_RECALLME_REMINDER_INTERVAL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Preview_Recallme_Reminder_Interval must be a valid greater or equal than</span> <span>1</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LIMIT_TABS">limitTabs</label>\n            <input type="number" name="limitTabs" ng-model="vm.general.limitTabs" min="0" value="20">\n            <div class="hint"><span translate="SETTINGS.HELP.LIMIT_TABS"></span></div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="vm.license.screenrecording" class="general-detail-form-container screenrecording md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SCREENRECORDING">SCREENRECORDING</div>\n        </div>\n        <form name="screenRecordingForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.DEFAULTSCREENRECORDINGPATH">defaultScreenRecordingPath</label>\n            <input type="text" name="defaultScreenRecordingPath" ng-model="vm.general.defaultScreenRecordingPath" autofocus>\n\n            <div class="hint"><span translate="SETTINGS.HELP.DEFAULTSCREENRECORDINGPATH"></span></div>\n            <div ng-messages="screenRecordingForm[\'defaultScreenRecordingPath\'].$error" ng-show="screenRecordingForm[\'defaultScreenRecordingPath\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.DEFAULTSCREENRECORDINGPATH_REQUIRED">defaultScreenRecordingPath field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container security md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SECURITY">SECURITY</div>\n        </div>\n        <form name="securityForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.securePassword" aria-label="Security_Suite"><span translate="SETTINGS.SECURITY_SUITE">Security_Suite</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.SECURITY_SUITE"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.callRecordingEncryption" aria-label="Call_Recording_Encryption"><span translate="SETTINGS.CALL_RECORDING_ENCRYPTION">Call_Recording_Encryption</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.ALLOWEDLOGINATTEMPTS">allowedLoginAttempts</label>\n            <input type="number" name="allowedLoginAttempts" ng-model="vm.general.allowedLoginAttempts" value="5" ng-required="true">\n\n            <div ng-messages="securityForm[\'allowedLoginAttempts\'].$error" ng-show="securityForm[\'allowedLoginAttempts\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.ALLOWEDLOGINATTEMPTS_REQUIRED">allowedLoginAttempts field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.BLOCKDURATION">blockDuration</label>\n            <input type="number" name="blockDuration" ng-model="vm.general.blockDuration" value="10" ng-required="true">\n\n            <div ng-messages="securityForm[\'blockDuration\'].$error" ng-show="securityForm[\'blockDuration\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.BLOCKDURATION_REQUIRED">blockDuration field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.enforcePasswordHistory" aria-label="Enforce_Password_History"><span translate="SETTINGS.ENFORCE_PASSWORD_HISTORY">Enforce_Password_History</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.ENFORCE_PASSWORD_HISTORY"></span></div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enforcePasswordHistory" class="md-block">\n            <label translate="SETTINGS.PASSWORD_HISTORY_LIMIT">Password_History_Limit</label>\n            <input type="number" name="passwordHistoryLimit" ng-model="vm.general.passwordHistoryLimit" min="2" max="5" value="3">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PASSWORD_HISTORY_LIMIT"></span></div>\n            <div ng-messages="securityForm[\'passwordHistoryLimit\'].$error" ng-show="securityForm[\'passwordHistoryLimit\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_REQUIRED">Password_History_Limit field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Password_History_Limit must be a valid greater or equal than</span> <span>2</span>\n              </div>\n              <div ng-message="max">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Password_History_Limit must be a valid greater or equal than</span> <span>5</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'email\')" ng-model="vm.general.enablePrivacyPolicyEmail" aria-label="Privacy_Policy_Email"><span translate="SETTINGS.PRIVACY_POLICY_EMAIL">Privacy_Policy_Email</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyEmail" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyEmail" ng-model="vm.general.privacyPolicyEmail" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyEmail\'].$error" ng-show="securityForm[\'privacyPolicyEmail\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_EMAIL_REQUIRED">Privacy_Policy_Email field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_EMAIL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Email must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'name\')" ng-model="vm.general.enablePrivacyPolicyName" aria-label="Privacy_Policy_Name"><span translate="SETTINGS.PRIVACY_POLICY_NAME">Privacy_Policy_Name</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyName" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyName" ng-model="vm.general.privacyPolicyName" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyName\'].$error" ng-show="securityForm[\'privacyPolicyName\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NAME_REQUIRED">Privacy_Policy_Name field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NAME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Name must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'number\')" ng-model="vm.general.enablePrivacyPolicyNumber" aria-label="Privacy_Policy_Number"><span translate="SETTINGS.PRIVACY_POLICY_NUMBER">Privacy_Policy_Number</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyNumber" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyNumber" ng-model="vm.general.privacyPolicyNumber" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyNumber\'].$error" ng-show="securityForm[\'privacyPolicyNumber\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NUMBER_REQUIRED">Privacy_Policy_Number field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Number must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.disabledCookie" aria-label="Disabled_Cookie"><span translate="SETTINGS.DISABLED_COOKIE">Disabled_Cookie</span></md-switch>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div class="general-detail-form-container imapgeneralsettings md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.IMAPGENERALSETTINGS">IMAPGENERALSETTINGS</div>\n        </div>\n        <form name="imapGeneralSettingsForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LOGINMAILFREQUENCY">loginMailFrequency</label>\n            <input type="number" name="loginMailFrequency" ng-model="vm.general.loginMailFrequency" min="10" value="10" ng-required="true" autofocus>\n\n            <div class="hint"><span translate="SETTINGS.HELP.LOGINMAILFREQUENCY"></span></div>\n            <div ng-messages="imapGeneralSettingsForm[\'loginMailFrequency\'].$error" ng-show="imapGeneralSettingsForm[\'loginMailFrequency\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.LOGINMAILFREQUENCY_REQUIRED">loginMailFrequency field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.LOGINMAILFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">loginMailFrequency must be a valid greater or equal than</span> <span>10</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container sso md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SSO">SSO</div>\n        </div>\n        <form name="SSOForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.googleSsoEnabled" aria-label="Google_SSO_enabled"><span translate="SETTINGS.GOOGLE_SSO_ENABLED">Google_SSO_enabled</span></md-switch>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.adSsoEnabled" aria-label="AD_SSO_enabled"><span translate="SETTINGS.AD_SSO_ENABLED">AD_SSO_enabled</span></md-switch>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="vm.license.ai" class="general-detail-form-container aitools md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.AITOOLS">AITOOLS</div>\n        </div>\n        <form name="aiToolsForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LANGUAGE">Language</label>\n            <md-select name="language" ng-model="vm.general.language" autofocus required>\n              <md-option ng-value="\'en-US\'">US English</md-option>\n              <md-option ng-value="\'en-AU\'">Australian English</md-option>\n              <md-option ng-value="\'en-GB\'">British English</md-option>\n              <md-option ng-value="\'en-AB\'">Scottish English</md-option>\n              <md-option ng-value="\'en-WL\'">Welsh English</md-option>\n              <md-option ng-value="\'en-IE\'">English (Ireland)</md-option>\n              <md-option ng-value="\'en-IN\'">Indian English</md-option>\n              <md-option ng-value="\'hi-IN\'">Hindi (India)</md-option>\n              <md-option ng-value="\'fr-CA\'">Canadian French</md-option>\n              <md-option ng-value="\'fr-FR\'">French</md-option>\n              <md-option ng-value="\'de-DE\'">German</md-option>\n              <md-option ng-value="\'de-CH\'">German (Switzerland)</md-option>\n              <md-option ng-value="\'it-IT\'">Italian</md-option>\n              <md-option ng-value="\'es-ES\'">Spanish</md-option>\n              <md-option ng-value="\'es-Us\'">US Spanish</md-option>\n              <md-option ng-value="\'pt-BR\'">Brazilian Portuguese</md-option>\n              <md-option ng-value="\'pt-PT\'">Portuguese(Portugal)</md-option>\n              <md-option ng-value="\'ar-SA\'">Modern Standard Arabic</md-option>\n              <md-option ng-value="\'ar-AE\'">Arabic</md-option>\n              <md-option ng-value="\'zh-CN\'">Chinese Mandarin - Mainland</md-option>\n              <md-option ng-value="\'ja-JP\'">Japanese (Japan)</md-option>\n              <md-option ng-value="\'ko-KR\'">Korean (Korea)</md-option>\n              <md-option ng-value="\'he-IL\'">Hebrew (Israel) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ms-MY\'">Malay (Malaysia) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'fa-IR\'">Farsi (Iran) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ru-RU\'">Russian (Russia) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'te-IN\'">Telugu(India) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ta-IN\'">Tamil - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'nl-NL\'">Dutch - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'tr-TR\'">Turkish (Turkey) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'id-ID\'">Indonesian(Indonesia) - This language is not available for the Sentiment Analysis</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'language\'].$error" ng-show="aiToolsForm[\'language\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.LANGUAGE_REQUIRED">Language field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.BUCKET">Bucket</label>\n            <input type="text" name="bucket" ng-model="vm.general.bucket" ng-required="true">\n\n            <div ng-messages="aiToolsForm[\'bucket\'].$error" ng-show="aiToolsForm[\'bucket\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.BUCKET_REQUIRED">Bucket field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.transcribe" aria-label="Transcribe"><span translate="SETTINGS.TRANSCRIBE">Transcribe</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.transcribe == true" class="md-block">\n            <label translate="SETTINGS.TRANSCRIBEREGION">TranscribeRegion</label>\n            <md-select name="transcribeRegion" ng-model="vm.general.transcribeRegion" required>\n              <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n              <md-option ng-value="\'us-east-2\'">US East (Ohio)</md-option>\n              <md-option ng-value="\'us-east-2\'">US West (N. California)</md-option>\n              <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n              <md-option ng-value="\'ap-south-1\'">Asia Pacific (Mumbai)</md-option>\n              <md-option ng-value="\'ap-east-1\'">Asia Pacific (Hong Kong)</md-option>\n              <md-option ng-value="\'ap-northeast-2\'">Asia Pacific (Seoul)</md-option>\n              <md-option ng-value="\'ap-southeast-1\'">Asia Pacific (Singapore)</md-option>\n              <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n              <md-option ng-value="\'ap-northeast-1\'">Asia Pacific (Tokyo)</md-option>\n              <md-option ng-value="\'ca-central-1\'">Canada (Central)</md-option>\n              <md-option ng-value="\'eu-central-1\'">Europe (Frankfurt)</md-option>\n              <md-option ng-value="\'eu-west-1\'">Europe (Ireland)</md-option>\n              <md-option ng-value="\'eu-west-2\'">Europe (London)</md-option>\n              <md-option ng-value="\'eu-west-3\'">Europe (Paris)</md-option>\n              <md-option ng-value="\'me-south-1\'">Middle East (Bahrain)</md-option>\n              <md-option ng-value="\'sa-east-1\'">South America (São Paulo)</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'transcribeRegion\'].$error" ng-show="aiToolsForm[\'transcribeRegion\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.TRANSCRIBEREGION_REQUIRED">TranscribeRegion field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.transcribe == true" class="md-block">\n            <label translate="SETTINGS.TRANSCRIBEACCOUNT">TranscribeAccount</label>\n            <md-select name="transcribeAccountId" ng-model="vm.general.transcribeAccountId" required>\n              <md-option ng-value="transcribeAccountId.id" ng-repeat="transcribeAccountId in vm.cloudProviders" ng-disabled="transcribeAccountId.canSelect === false">{{ transcribeAccountId.name }}</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'transcribeAccountId\'].$error" ng-show="aiToolsForm[\'transcribeAccountId\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.TRANSCRIBEACCOUNT_REQUIRED">TranscribeAccount field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n'+"          <md-input-container ng-if=\"vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <md-switch ng-model=\"vm.general.sentiment\" aria-label=\"SentimentAnalysis\"><span translate=\"SETTINGS.SENTIMENTANALYSIS\">SentimentAnalysis</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if=\"vm.general.sentiment == true && vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <label translate=\"SETTINGS.SENTIMENTREGION\">SentimentRegion</label>\n            <md-select name=\"sentimentRegion\" ng-model=\"vm.general.sentimentRegion\" required>\n              <md-option ng-value=\"'us-east-1'\">US East (N. Virginia)</md-option>\n              <md-option ng-value=\"'us-east-2'\">US East (Ohio)</md-option>\n              <md-option ng-value=\"'us-west-2'\">US West (Oregon)</md-option>\n              <md-option ng-value=\"'ap-south-1'\">Asia Pacific (Mumbai)</md-option>\n              <md-option ng-value=\"'ap-northeast-2'\">Asia Pacific (Seoul)</md-option>\n              <md-option ng-value=\"'ap-southeast-1'\">Asia Pacific (Singapore)</md-option>\n              <md-option ng-value=\"'ap-southeast-2'\">Asia Pacific (Sydney)</md-option>\n              <md-option ng-value=\"'ap-northeast-1'\">Asia Pacific (Tokyo)</md-option>\n              <md-option ng-value=\"'ca-central-1'\">Canada (Central)</md-option>\n              <md-option ng-value=\"'eu-central-1'\">Europe (Frankfurt)</md-option>\n              <md-option ng-value=\"'eu-west-1'\">Europe (Ireland)</md-option>\n              <md-option ng-value=\"'eu-west-2'\">Europe (London)</md-option>\n            </md-select>\n            <div ng-messages=\"aiToolsForm['sentimentRegion'].$error\" ng-show=\"aiToolsForm['sentimentRegion'].$touched\" role=\"alert\">\n              <div ng-message=\"required\">\n                <span translate=\"SETTINGS.ERRORS.SENTIMENTREGION_REQUIRED\">SentimentRegion field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if=\"vm.general.sentiment == true && vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <label translate=\"SETTINGS.SENTIMENTACCOUNT\">SentimentAccount</label>\n            <md-select name=\"sentimentAccountId\" ng-model=\"vm.general.sentimentAccountId\" required>\n              <md-option ng-value=\"sentimentAccountId.id\" ng-repeat=\"sentimentAccountId in vm.cloudProviders\" ng-disabled=\"sentimentAccountId.canSelect === false\">{{ sentimentAccountId.name }}</md-option>\n            </md-select>\n            <div ng-messages=\"aiToolsForm['sentimentAccountId'].$error\" ng-show=\"aiToolsForm['sentimentAccountId'].$touched\" role=\"alert\">\n              <div ng-message=\"required\">\n                <span translate=\"SETTINGS.ERRORS.SENTIMENTACCOUNT_REQUIRED\">SentimentAccount field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>"),e.put("app/main/apps/settings/views/license/license.html",'<div id="license" class="page-layout simple fullwidth doc-page">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.LICENSE">LICENSE</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    \x3c!-- <div>\n                <md-button type="submit" ng-click="vm.requestLicense()" class="send-button md-raised" translate="SETTINGS.REQUEST_LICENSE" translate-attr-aria-label="SETTINGS.REQUEST_LICENSE">\n                    REQUEST LICENSE\n                </md-button>\n            </div> --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      \x3c!-- LICENSE CARD --\x3e\n      <div layout="row" flex>\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="row" layout-align="center">\n            <div flex layout="row" layout-align="start center">\n              <div ng-if="!vm.license.custom">\n                <a href="https://www.xcally.com/plans.html" target="_blank" class="md-button md-fab green-A700-bg" aria-label="Eat cake">\n                  <md-tooltip><span translate="SETTINGS.PRICES">Prices</span></md-tooltip>\n                  <md-icon md-font-icon="icon-coin"></md-icon>\n                </a>\n              </div>\n            </div>\n            <div flex>\n              <div ng-switch="vm.license.months" class="text-center">\n                <span ng-switch-when="1" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.MONTH_TO_MONTH">MONTH TO MONTH</span></span>\n                <span ng-switch-when="12" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.ANNUALLY">ANNUALLY</span></span>\n                <span ng-switch-when="1200" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.PERPETUAL">PERPETUAL</span></span>\n              </div>\n            </div>\n            <div flex layout="row" layout-align="end center">\n              <div>\n                <md-button type="submit" ng-click="vm.updateLicense()" class="md-button md-fab md-accent">\n                  <md-tooltip><span translate="SETTINGS.UPDATE_LICENSE">License</span></md-tooltip>\n                  <md-icon md-font-icon="icon-pencil"></md-icon>\n                </md-button>\n                <md-button type="submit" ng-if="vm.isAdmin" ng-click="vm.downloadLogFile()" class="md-button md-fab md-accent">\n                  <md-tooltip><span translate="SETTINGS.DOWNLOAD_LICENSE_LOG_FILE">Download license log file</span></md-tooltip>\n                  <md-icon md-font-icon="icon-download"></md-icon>\n                </md-button>\n              </div>\n            </div>\n          </div>\n\n          <span ng-if="!vm.license.demo && !vm.license.gray && vm.license.months != 36" class="md-subhead md-warn-fg text-center">{{ \'SETTINGS.EXPIRATION_DATE\' | translate }}: {{vm.license.expiration | date: \'longDate\'}}</span>\n          <span class="text-center padding-bottom-10"> {{ vm.license.machineUuid !== vm.license.uuid ? \'SETTINGS.OLD_TOKEN\' : \'SETTINGS.TOKEN\' | translate }}: <span ngclipboard data-clipboard-target="#licenseUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});" id="licenseUuid" class="hover-token text-italic text-bold">{{vm.license.uuid}}</span>\n            \x3c!--<md-button class="md-button md-fab md-accent" ngclipboard data-clipboard-target="#licenseUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n            <md-tooltip><span translate="SETTINGS.COPY_LICENSE">Copy</span></md-tooltip>\n            <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n          </md-button>--\x3e\n          </span>\n\n          <div layout="column">\n            <span ng-if="vm.license.grayReason == \'changed\'" class="blink md-subhead md-warn-fg text-center">{{ \'SETTINGS.NEW_TOKEN_DETECTED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.NEW_TOKEN\' | translate }}: <span id="licenseMachineUuid" ngclipboard data-clipboard-target="#licenseMachineUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});" class="hover-token text-italic text-bold">{{vm.license.machineUuid}}</span>\n              \x3c!--<md-button class="md-button md-fab md-accent" ngclipboard data-clipboard-target="#licenseMachineUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                <md-tooltip><span translate="SETTINGS.COPY_LICENSE">Copy</span></md-tooltip>                \n                <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n              </md-button>--\x3e\n            </span>\n            <span ng-if="vm.license.gray" class="blink md-subhead md-warn-fg text-center">{{ \'SETTINGS.EXPIRATION_GRAY_PERIOD\' | translate }}: {{vm.license.deadline | date: \'longDate\'}}</span>\n            <span ng-if="vm.license.gray" class="text-center padding-bottom-10 text-italic text-bold"> {{\'SETTINGS.EXPIRATION_REASON\' | translate }} </span>\n            <span ng-if="vm.license.grayReason == \'disabled\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_REASON_MESSAGE_DISABLED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_REASON_MESSAGE_CHANGED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_CHANGED_ADVISE\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10">{{ \'SETTINGS.SEND_EMAIL_TO\' | translate }}: <a href="mailto:license@xcally.com?subject=New%20token%20detected&body=Hi xCALLY, New Token: {{vm.license.machineUuid}}, Old token: {{vm.license.uuid}}">license@xcally.com</a>.</span>\n            <span ng-if="vm.license.grayReason == \'disabled\'" class="text-center padding-bottom-10">{{ \'SETTINGS.SEND_EMAIL_TO\' | translate }}: <a href="mailto:license@xcally.com?subject=License%20disabled&body=Hi xCALLY, My Token: {{vm.license.machineUuid}}">license@xcally.com</a>.</span>\n          </div>\n\n          <div ng-if="vm.license.demo" layout="column">\n            <span class="md-subhead md-warn-fg text-center">{{ \'SETTINGS.TRIAL_VERSION\' | translate }}</span>\n            <span class="md-subhead md-warn-fg text-center"><a href="https://www.xcally.com/en/index.html#pricing-table2-h" target="_blank">{{ \'SETTINGS.PRICES\' | translate}}</a></span>\n          </div>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.STAFF\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-account" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.users || 0 }} <span ng-class="{\'red-fg\': vm.license.users <= vm.users && vm.license.users > 0}">({{vm.license.users >= vm.users ? vm.users : vm.license.users}})</span></h3>\n                <p translate="SETTINGS.USERS">Users</p>\n              </div>\n            </md-list-item>\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-headphones" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.agents || 0 }} <span ng-class="{\'red-fg\': (vm.license.agents <= vm.agents && vm.license.agents > 0) }">({{vm.license.agents >= vm.agents ? vm.agents : vm.license.agents}})</span></h3>\n                <p translate="SETTINGS.AGENTS">Agents</p>\n              </div>\n            </md-list-item>\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-phone" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.telephones || 0 }} <span ng-class="{\'red-fg\': vm.license.telephones <= vm.telephones && vm.license.telephones > 0}">({{vm.license.telephones >= vm.telephones ? vm.telephones : vm.license.telephones}})</span></h3>\n                <p translate="SETTINGS.TELEPHONES">Telephones</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.CHANNELS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3:3">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3:6">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.MODULES\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="module in vm.modules" flex="33">\n              <md-icon md-font-icon="{{module.icon}}" class="md-avatar-icon" ng-class="vm.license[module.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{module.name | uppercase}}"></h3>\n                <p ng-class="vm.license[module.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[module.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.SESSIONS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <div ng-repeat="session in vm.sessions" flex="33">\n              <md-list-item class="md-2-line">\n                <md-icon md-font-icon="{{session.icon}}" class="md-avatar-icon" ng-class="vm.license[session.enabled] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n                <div class="md-list-item-text">\n                  <div layout="row" layout="start center">\n                    <h3 translate="SETTINGS.{{session.name | uppercase}}"></h3>\n                    <button ng-if="session.restart" ng-click="vm.gotoProcess($event)" class="md-mini" aria-label="restart">\n                      <md-tooltip>Restart</md-tooltip>\n                      <md-icon md-font-icon="icon-reload"></md-icon>\n                    </button>\n                  </div>\n                  <p ng-if="vm.license[session.name] && vm.license[session.enabled]" class="green-A700-fg">{{vm.license[session.name]}} {{ \'SETTINGS.\' + session.label | uppercase | translate }}</p>\n                  <p ng-if="!vm.license[session.name] && vm.license[session.enabled]" class="green-A700-fg">UNLIMITED {{ \'SETTINGS.\' + session.label | uppercase | translate }}</p>\n                  <p ng-if="!vm.license[session.enabled]" class="red-A700-fg">{{ \'SETTINGS.DISABLED\' | translate }}</p>\n                </div>\n              </md-list-item>\n\n            </div>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.ADDONS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="addon in vm.addons | limitTo:3" flex="33">\n              <md-icon md-font-icon="{{addon.icon}}" class="md-avatar-icon" ng-class="vm.license[addon.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{addon.name | uppercase}}"></h3>\n                <p ng-class="vm.license[addon.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[addon.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="addon in vm.addons | limitTo:3:3" flex="33">\n              <md-icon md-font-icon="{{addon.icon}}" class="md-avatar-icon" ng-class="vm.license[addon.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{addon.name | uppercase}}"></h3>\n                <p ng-class="vm.license[addon.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[addon.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.OTHERS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="other in vm.others | limitTo:3" flex="33">\n              <md-icon md-font-icon="{{other.icon}}" class="md-avatar-icon" ng-class="vm.license[other.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{other.name | uppercase}}"></h3>\n                <p ng-class="vm.license[other.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[other.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="other in vm.others | limitTo:3:3" flex="33">\n              <md-icon md-font-icon="{{other.icon}}" class="md-avatar-icon" ng-class="vm.license[other.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{other.name | uppercase}}"></h3>\n'+"                <p ng-class=\"vm.license[other.name] ? 'green-A700-fg' : 'red-A700-fg'\">{{ 'SETTINGS.' + (vm.license[other.name] ? 'ENABLED' : 'DISABLED') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n        </md-card>\n      </div>\n      \x3c!-- / LICENSE CARD --\x3e\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>"),e.put("app/main/apps/settings/views/license/request/dialog.html",'<md-dialog class="request-dialog" aria-label="Send Request">\n  <form name="requestForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="SETTINGS.REQUEST_LICENSE">Request License</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.license.name" required>\n        <div ng-messages="requestForm.name.$error" ng-show="requestForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.NAME_REQUIRED">Address field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.license.email" required>\n        <div ng-messages="requestForm.email.$error" ng-show="requestForm.email.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="SETTINGS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.PLAN">Plan</label>\n        <md-select name="plan" ng-model="vm.license.months" required>\n          <md-option ng-value="1"><span translate="SETTINGS.MONTH_TO_MONTH">MONTH TO MONTH</span></md-option>\n          <md-option ng-value="12"><span translate="SETTINGS.ANNUALLY">ANNUALLY</span></md-option>\n          <md-option ng-value="1200"><span translate="SETTINGS.PERPETUAL">PERPETUAL</span></md-option>\n        </md-select>\n        <div ng-messages="requestForm.plan.$error" ng-show="requestForm.plan.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PLAN_REQUIRED">Plan field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.STAFF\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.USERS">Users</label>\n          <input type="number" name="users" ng-model="vm.license.users" required>\n          <div ng-messages="requestForm.users.$error" ng-show="requestForm.users.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.USERS_REQUIRED">Users field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.AGENTS">Agents</label>\n          <input type="number" name="agents" ng-model="vm.license.agents" required>\n          <div ng-messages="requestForm.agents.$error" ng-show="requestForm.agents.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.AGENTS_REQUIRED">Agents field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.TELEPHONES">Telephones</label>\n          <input type="number" name="telephones" ng-model="vm.license.telephones" required>\n          <div ng-messages="requestForm.telephones.$error" ng-show="requestForm.telephones.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.TELEPHONES_REQUIRED">Telephones field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.CHANNELS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[channel.name]" aria-label="{{channel.name}}" ng-repeat="channel in vm.channels | limitTo:3"><span translate="SETTINGS.{{channel.name | uppercase}}"></span></md-switch>\n        <md-switch ng-model="vm.license[channel.name]" aria-label="{{channel.name}}" ng-repeat="channel in vm.channels | limitTo:3:3"><span translate="SETTINGS.{{channel.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.MODULES\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[module.name]" aria-label="{{module.name}}" ng-repeat="module in vm.modules"><span translate="SETTINGS.{{module.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.SESSIONS\' | translate }}</md-subheader>\n      <div layout="row">\n        <md-input-container ng-repeat="session in vm.sessions" class="md-block" flex="50">\n          <label>{{ \'SETTINGS.\' + session.name | uppercase | translate }} ({{ \'SETTINGS.\' + session.label | uppercase | translate }})</label>\n          <input type="number" name="{{session.name}}" ng-model="vm.license[session.name]" required>\n          <div class="hint"><span>0={{ \'SETTINGS.UNLIMITED_CHANNELS\' | translate }}</span></div>\n          <div ng-messages="requestForm[session.name].$error" ng-show="requestForm[session.name].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.CHANNEL_REQUIRED">Mandatory field</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.ADDONS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[addon.name]" aria-label="{{module.name}}" ng-repeat="addon in vm.addons"><span translate="SETTINGS.{{addon.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.OTHERS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[other.name]" aria-label="{{other.name}}" ng-repeat="other in vm.others"><span translate="SETTINGS.{{other.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.DESCRIPTION">Description</label>\n        <textarea name="description" ng-model="vm.license.description"></textarea>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.sendRequest()" class="send-button md-accent md-raised" ng-disabled="requestForm.$invalid || requestForm.$pristine" aria-label="SEND" translate="SETTINGS.SEND" translate-attr-aria-label="SETTINGS.SEND">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/license/update/dialog.html",'<md-dialog class="update-dialog" aria-label="Update License">\n  <form name="updateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="SETTINGS.UPDATE_LICENSE">Update License</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-content layout="row">\n        <span class="md-title" translate="SETTINGS.UPDATE_LICENSE_MANUALLY">Do you want to update your license manually?</span>\n      </md-content>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.ENTER_LICENSE">Enter your license</label>\n        <textarea name="key" ng-model="vm.licenseKey" required></textarea>\n        <div ng-messages="updateForm.name.$error" ng-show="updateForm.key.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.LICENSE_REQUIRED">License key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.updateLicense()" class="send-button md-accent md-raised" ng-disabled="updateForm.$invalid || updateForm.$pristine" aria-label="UPDATE" translate="SETTINGS.UPDATE" translate-attr-aria-label="SETTINGS.UPDATE">\n          UPDATE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/networks/create/dialog.html",'<md-dialog class="network-dialog" aria-label="New Network">\n  <form name="networkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.network.type" autofocus required>\n          <md-option ng-value="\'localnet\'">LocalNET</md-option>\n          <md-option ng-value="\'externip\'">ExternIP</md-option>\n          <md-option ng-value="\'turn\'">Turn</md-option>\n          <md-option ng-value="\'stun\'">Stun</md-option>\n        </md-select>\n        <div ng-messages="networkForm[\'type\'].$error" ng-show="networkForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'localnet\'" class="md-block">\n        <label translate="SETTINGS.LOCALNETADDRESS">localNetAddress</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/" ng-required="true">\n\n        <div class="hint"><span translate="SETTINGS.HELP.LOCALNETADDRESS"></span></div>\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.LOCALNETADDRESS_REQUIRED">localNetAddress field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SETTINGS.ERRORS.LOCALNETADDRESS_MUST_VALID_PATTERN" translate-values="{ regex: \'/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/\' }">localNetAddress must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'externip\'" class="md-block">\n        <label translate="SETTINGS.ADDRESS">Address</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/" ng-required="true">\n\n        <div class="hint"><span translate="SETTINGS.HELP.ADDRESS"></span></div>\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ADDRESS_REQUIRED">Address field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SETTINGS.ERRORS.ADDRESS_MUST_VALID_PATTERN" translate-values="{ regex: \'/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/\' }">Address must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\' || vm.network.type == \'stun\'" class="md-block">\n        <label translate="SETTINGS.ADDRESS">Address</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-required="true">\n\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ADDRESS_REQUIRED">Address field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\'" class="md-block">\n        <label translate="SETTINGS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.network.username" ng-required="vm.network.type == \'turn\'">\n\n        <div class="hint"><span translate="SETTINGS.HELP.USERNAME"></span></div>\n        <div ng-messages="networkForm[\'username\'].$error" ng-show="networkForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\'" class="md-block">\n        <label translate="SETTINGS.PASSWORD">Password</label>\n        <input type="text" name="password" ng-model="vm.network.password" ng-required="vm.network.type == \'turn\'">\n\n        <div class="hint"><span translate="SETTINGS.HELP.PASSWORD"></span></div>\n        <div ng-messages="networkForm[\'password\'].$error" ng-show="networkForm[\'password\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newNetwork" ng-click="vm.saveNetwork()" class="send-button md-accent md-raised" ng-disabled="networkForm.$invalid || networkForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newNetwork" ng-click="vm.addNewNetwork()" class="send-button md-accent md-raised" ng-disabled="networkForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_NETWORK" translate-attr-aria-label="SETTINGS.ADD_NETWORK">\n          ADD NETWORK\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.deleteNetwork($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/networks/networks.html",'<div id="networks" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.NETWORKS">Networks</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SETTINGS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedNetworks.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedNetworks =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SETTINGS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-networks-count">\n          <span>{{vm.selectedNetworks.length}}</span>\n          <span translate="SETTINGS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SETTINGS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllNetworks()" translate="SETTINGS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectNetworks()" translate="SETTINGS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedNetworks" csv-label="true" filename="networks.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-click="vm.deleteSelectedNetworks($event)" aria-label="delete selected" translate translate-attr-label="SETTINGS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- NETWORK TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedNetworks" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getNetworks">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SETTINGS.ID\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'SETTINGS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="value">{{ \'SETTINGS.ADDRESS\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'SETTINGS.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.networks.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SETTINGS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="network" md-select-id="id" ng-repeat="network in vm.networks.rows">\n                <td md-cell ng-if="network.userpic"><img class="avatar" alt="{{network.name}}" ng-src="api/users/{{network.id}}/avatar" /></td>\n                <td md-cell ng-if="!network.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{network.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="id ">{{network.id}}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="type ">{{ vm.arraytype[network.type].option }}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="value ">{{network.value}}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="createdAt ">{{network.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SETTINGS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.editdialog(network, $event    )" translate="SETTINGS.EDIT_NETWORK">\n                          Edit Network\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(network, $event    )" translate="SETTINGS.DELETE_NETWORK">\n                          Delete Network\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SETTINGS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SETTINGS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SETTINGS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.networks.count}}" md-on-paginate="vm.getNetworks" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / NETWORK TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD NETWORK BUTTON --\x3e\n  <md-button class="md-fab md-accent" id="add-network-button" ng-click="vm.createOrEditNetwork($event)" aria-label="add network" translate translate-attr-aria-label="SETTINGS.ADD_NETWORK">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD NETWORK BUTTON --\x3e\n</div>'),e.put("app/main/apps/settings/views/smtps/smtps.html",'<div id="smtps" class="page-layout simple left-sidenav inner-sidenav">\n\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.SMTP">Smtp</span>\n      </div>\n    </div>\n\n    <div>\n      <md-button type="submit" ng-click="vm.verifySmtp()" ng-disabled="!vm.mailAccount.id" class="send-button md-accent md-raised" translate="SETTINGS.VERIFY" translate-attr-aria-label="SETTINGS.VERIFY">\n        VERIFY\n      </md-button>\n      <md-button type="submit" ng-click="vm.saveSmtp()" ng-disabled="(generalForm.$pristine) || (generalForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    <div class="main scrollable">\n      <div class="smtp-detail-form-container general md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.GENERAL">GENERAL</div>\n        </div>\n        <form name="generalForm" novalidate>\n\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.ACCOUNTNAME">Name</label>\n            <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus>\n            <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Name field required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.DESCRIPTION">Description</label>\n            <input type="" name="description" ng-model="vm.mailAccount.description">\n          </md-input-container>\n\n          <md-input-container class="md-block mt-0">\n            <label translate="SETTINGS.EMAILADDRESS">Email Address</label>\n            <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true">\n            <div class="hint"><span translate="SETTINGS.HELP.EMAILADDRESS"></span></div>\n            <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Email Address field required</span>\n              </div>\n              <div ng-message="email">\n                <span translate="SETTINGS.ERRORS.WRONG_FORMAT">Email Address must be a valid e-mail address</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block mt-30">\n            <label translate="SETTINGS.SMTP_SERVICE">Service</label>\n            <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" required>\n              <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n            </md-select>\n            <div ng-messages="generalForm[\'provider\'].$error" ng-show="generalForm[\'provider\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Service field required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <div ng-if="vm.mailAccount.provider === \'custom\'">\n            <md-input-container class="md-block mt-30">\n              <label translate="SETTINGS.SMTP_HOST">Host</label>\n              <input type="text" name="host" ng-model="vm.mailAccount.Smtp.host" ng-required="true">\n              <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Host field required</span>\n                </div>\n              </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <label translate="SETTINGS.SMTP_PORT">Port</label>\n              <input type="number" name="port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true">\n              <div ng-messages="generalForm[\'port\'].$error" ng-show="generalForm[\'port\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Port field required</span>\n                </div>\n              </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.secure" aria-label="SMTP Secure"><span translate="SETTINGS.SMTP_SECURE">Secure</span></md-switch>\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_SECURE"></span></div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.authentication" aria-label="SMTP Authentication"><span translate="SETTINGS.SMTP_AUTHENTICATION">Authentication</span></md-switch>\n            </md-input-container>\n          </div>\n\n          <div ng-if="vm.mailAccount.Smtp.authentication || (vm.mailAccount.provider && vm.mailAccount.provider !== \'custom\')">\n            <md-input-container ng-if="vm.mailAccount.provider === \'outlook365\'" class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="SETTINGS.SMTP_USERNAME">Username</label>\n              <input type="text" name="username" ng-model="vm.mailAccount.Smtp.user" ng-required="true">\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_USERNAME"></span></div>\n              <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Username field required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container ng-if="vm.mailAccount.Smtp.modernAuthentication" class="md-block">\n              <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n              <md-select name="cloudProvider" ng-model="vm.mailAccount.Smtp.CloudProviderId" required>\n                <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n              </md-select>\n              <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n              <div ng-messages="generalForm[\'cloudProvider\'].$error" ng-show="generalForm[\'cloudProvider\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container ng-if="!vm.mailAccount.Smtp.modernAuthentication" class="md-block">\n              <label translate="SETTINGS.SMTP_PASSWORD">Password</label>\n              <input type="password" name="password" ng-model="vm.mailAccount.Smtp.pass" placeholder="Password" translate translate-attr-placeholder="SETTINGS.PASSWORD" required>\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_PASSWORD"></span></div>\n              <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Password field required</span>\n                </div>\n              </div>\n            </md-input-container>\n          </div>\n        </form>\n      </div>\n    </div>\n\n  </div>\n</div>'),e.put("app/main/apps/settings/views/system/system.html",'<div id="system" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.SYSTEM">SYSTEM</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" md-border-bottom flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SETTINGS.GENERAL">GENERAL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="system-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget flex="50" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg">\n                    <div class="h3">OS</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{vm.system.system.manufacturer}} {{vm.system.system.model}}</div>\n                        <div class="h4">{{vm.system.cpu.manufacturer}} {{vm.system.cpu.brand}} - {{vm.system.cpu.speed}} GHz - {{vm.system.cpu.cores}} Cores</div>\n                        <div class="h4">{{vm.system.os.distro}} - {{vm.system.os.release}} - Kernel: {{vm.system.os.kernel}}</div>\n                        <div class="h4">Node.js: {{vm.system.node}}</div>\n                        <div class="h4">Host: {{vm.system.os.hostname}} - Uptime: {{vm.system.time.uptime / 60 | number:0}} m</div>\n                        <div class="h4">TimeZone: {{vm.system.time.timezone}} ({{vm.system.time.timezoneName}})</div>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n              <ms-widget flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-1">\n                    <div class="h3">CPU</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.AVG_LOAD">AVG Load</span>\n                          <span class="h3 secondary-text font-weight-500">{{vm.system.currentLoad.avgload * 100 | number:0}}%</span>\n                        </div>\n                        <md-progress-linear class="red" md-mode="determinate" value="{{vm.system.currentLoad.avgload * 100 | number:0}}"></md-progress-linear>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n              <ms-widget flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">MEM</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.TOTAL\' | translate}}: {{vm.system.mem.total / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.FREE\' | translate}}: {{vm.system.mem.available / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.USED\' | translate}}: {{vm.system.mem.active / 1024 / 1024 / 1024 | number:0}} GB</div>\n                      </div>\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.USED">Used</span>\n                          <span class="h3 secondary-text font-weight-500">{{(vm.system.mem.active / vm.system.mem.total) * 100 | number : 0}}%</span>\n                        </div>\n                        <md-progress-linear class="md-warn" md-mode="determinate" value="{{(vm.system.mem.active / vm.system.mem.total) * 100 | number : 0 }}"></md-progress-linear>\n\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget ng-repeat="disk in vm.system.fsSize" flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">DISK {{$index + 1}}</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.FILE_SYSTEM\' | translate}}: {{disk.fs}}</div>\n                        <div class="h4">{{\'SETTINGS.MOUNT_POINT\' | translate}}: "{{disk.mount}}"</div>\n                        <div class="h4">{{\'SETTINGS.TOTAL\' | translate}}: {{disk.size / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.USED\' | translate}}: {{disk.used / 1024 / 1024 / 1024 | number:0}} GB</div>\n                      </div>\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.USED">Used</span>\n                          <span class="h4 secondary-text font-weight-500">{{disk.use | number:0}}%</span>\n                        </div>\n                        <md-progress-linear class="red" md-mode="determinate" value="{{disk.use | number:0}}"></md-progress-linear>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget ng-repeat="net in vm.system.net" flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">NET {{$index + 1}}</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.INTERFACE\' | translate}}: {{net.iface}}</div>\n                        <div class="h4">IPv4: {{net.ip4}}</div>\n                        <div class="h4">IPv6: {{net.ip6}}</div>\n                        <div class="h4">MAC: {{net.mac}}</div>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row">\n              <div flex>\n                <md-toolbar class="md-table-toolbar md-default">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="SETTINGS.TOP_N_PROCESSES" translate-values="{value: vm.processLimit}"></span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm.searchTerm1 = query" on-collapse="vm.searchTerm1 = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table>\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column>pid</th>\n                        <th md-column>{{\'SETTINGS.NAME\' | translate}}</th>\n                        <th md-column>{{\'SETTINGS.STATE\' | translate}}</th>\n                        <th md-column>pmem</th>\n                        <th md-column>pcpu</th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-repeat="process in vm.system.processes.list | limitTo: vm.processLimit | filter: vm.searchTerm1 | orderBy:\'-pcpu\'">\n                        <td md-cell>{{process.pid}}</td>\n                        <td md-cell>{{process.command}}</td>\n                        <td md-cell>\n                          <span class="text-boxed white-fg" ng-class="{\n                          \'green-600-bg\': process.state == \'running\',\n                          \'yellow-600-bg\': process.state == \'sleeping\',\n                          \'red-600-bg\': process.state == \'blocked\'}">{{process.state | uppercase}}</span>\n                        </td>\n                        <td md-cell>{{process.pmem}}%</td>\n                        <td md-cell>{{process.pcpu}}%</td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n              </div>\n            </md-card>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SETTINGS.PROCESSES">PROCESSES</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="system-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <md-card class="md-whiteframe-1dp padding-20" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SETTINGS.MOTION_PROCESS_MANAGEMENT"></span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.searchTerm2 = query" on-collapse="vm.searchTerm2 = undefined" debounce="300"></ms-search-bar>\n                  <md-button ng-click="vm.getProcesses()" class="md-icon-button" aria-label="Reload">\n                    <md-icon md-font-icon="icon-reload" class="s24"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table>\n                  <thead md-head>\n                    <tr md-row>\n                      <th md-column>id</th>\n                      <th md-column>pid</th>\n                      <th md-column>{{\'SETTINGS.NAME\' | translate}}</th>\n                      <th md-column>{{\'SETTINGS.STATE\' | translate}}</th>\n                      <th md-column>MEM</th>\n                      <th md-column>CPU</th>\n                      <th md-column width="20px">Actions</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-repeat="process in vm.processes | filter: vm.searchTerm2 | orderBy:\'-monit.cpu\'">\n                      <td md-cell>{{process.pm_id}}</td>\n                      <td md-cell>{{process.pid}}</td>\n                      <td md-cell>{{process.name == \'agi\' ? \'agi (Cally Square IVR)\' : process.name}}</td>\n                      <td md-cell>\n                        <span class="text-boxed white-fg" ng-class="{\'green-600-bg\': process.pm2_env.status == \'online\', \'red-600-bg\': process.pm2_env.status == \'stopped\'}">{{process.pm2_env.status | uppercase}}</span>\n                      </td>\n                      <td md-cell>{{process.monit.memory / 1024 / 1024 | number:0}} MB</td>\n                      <td md-cell>{{process.monit.cpu}}%</td>\n                      <td md-cell>\n                        <md-button ng-if="process.pm2_env.status !== \'online\'" ng-click="vm.updateProcess($event, process.pm_id, \'online\')" class="md-icon-button" aria-label="Play">\n                          <md-icon md-font-icon="icon-play" class="s24"></md-icon>\n                        </md-button>\n                        <md-button ng-if="process.pm2_env.status === \'online\'" ng-click="vm.updateProcess($event, process.pm_id, \'stopped\')" class="md-icon-button" aria-label="Stop">\n                          <md-icon md-font-icon="icon-stop" class="s24"></md-icon>\n                        </md-button>\n                      </td>\n                    </tr>\n                  </tbody>\n                  <tfoot md-foot>\n                    <tr md-row>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell>{{ (vm.processes | map: \'monit.memory\' | sum) / 1024 / 1024 | number:0 }} MB</td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                    </tr>\n                  </tfoot>\n                </table>\n              </md-table-container>\n            </md-card>\n            <md-card class="md-whiteframe-1dp padding-20" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SETTINGS.USEFUL_COMMANDS"></span>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table>\n                  <thead md-head>\n                    <tr md-row>\n                      <th md-column width="30%">{{\'SETTINGS.COMMAND\' | translate}}</th>\n                      <th md-column>{{\'SETTINGS.DESCRIPTION\' | translate}}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr>\n                      <td md-cell class="no-border">pm2 list</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_LIST\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 start &lt;id | name&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_START\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 stop &lt;id | name | all&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_STOP\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 restart &lt;id | name&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_RESTART\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 logs [id | name]</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_LOGS\' | translate}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </md-card>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/settings/views/updates/update/dialog.html",'<md-dialog aria-label="Update">\n  <form name="updateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear md-mode="determinate" value="{{vm.progress}}" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content>\n      <div layout="row" layout-align="center center">\n        <div ng-if="vm.updating" layout="column" layout-align="center center">\n          <span class="text-center md-title">Grab a quick coffee and</span>\n          <span class="text-center md-title">get back here as soon as completed!</span>\n          <span class="text-center md-title">{{vm.output}}</span>\n        </div>\n        <div ng-if="!vm.updating">\n          <div ng-if="vm.success" layout="column" layout-align="center center">\n            <span class="text-center md-title">Update Completed! Thank you for your time.</span>\n            <span class="text-center md-title">In order to complete the update,</span>\n            <span class="text-center md-title">please click on reload button</span>\n          </div>\n          <div ng-if="!vm.success" layout="column" layout-align="center center">\n            <span class="text-center md-title">Update Error!</span>\n            <span class="text-center md-title">Please contact your administrator!</span>\n            <span class="text-center md-title">{{vm.output}}</span>\n          </div>\n        </div>\n        <img src="assets/images/business/users.jpg" alt="" width="128" height="128" />\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions ng-if="!vm.updating" layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.reload()" class="send-button md-warm md-raised" aria-label="RELOAD" translate="SETTINGS.RELOAD" translate-attr-aria-label="SETTINGS.RELOAD">\n          RELOAD\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/updates/updates.html",'<div id="updates" class="page-layout simple fullwidth doc-page">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.UPDATES">UPDATES</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      \x3c!-- UPDATE CARD --\x3e\n      <div layout="row" ng-if="!vm.updating">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="SETTINGS.CURRENT_VERSION">CURRENT VERSION</span>\n\n            <span class="md-display-3 padding-20">{{vm.version.current}}</span>\n\n            <md-button href="https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896252454/Motion+GUI#Version-{{vm.version.current}}" target="_blank" class="md-accent" title="CHANGELOG" aria-label="CHANGELOG" translate="SETTINGS.CHANGELOG" translate-attr-aria-label="SETTINGS.CHANGELOG">\n              CHANGELOG\n            </md-button>\n          </div>\n        </md-card>\n        <md-card class="md-whiteframe-20dp padding-20" flex ng-if="vm.version.current != vm.version.latest">\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-warn-fg padding-20 text-bold" translate="SETTINGS.NEW_VERSION">NEW VERSION</span>\n\n            <span class="md-display-3 padding-20">{{vm.version.latest}}</span>\n\n            <md-button href="https://xcally.atlassian.net/wiki/spaces/XMV/pages/1896252454/Motion+GUI#Version-{{vm.version.latest}}" target="_blank" class="md-accent" title="CHANGELOG" aria-label="CHANGELOG" translate="SETTINGS.CHANGELOG" translate-attr-aria-label="SETTINGS.CHANGELOG">\n              CHANGELOG\n            </md-button>\n            <md-button ng-click="vm.updateConfirm($event)" class="md-raised md-warn" aria-label="CHANGELOG" translate="SETTINGS.UPDATE" translate-attr-aria-label="SETTINGS.UPDATE">UPDATE</md-button>\n          </div>\n        </md-card>\n        <md-card class="md-whiteframe-1dp padding-20" flex ng-if="vm.version.current == vm.version.latest">\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-warn-fg padding-20 text-bold" translate="SETTINGS.REMOTE_VERSION">REMOTE VERSION</span>\n\n            <span class="md-subhead padding-20" translate="SETTINGS.NO_NEW_VERSION_AVAILABLE">NO NEW VERSION AVAILABLE</span>\n          </div>\n        </md-card>\n      </div>\n      \x3c!-- / UPDATE CARD --\x3e\n\n      <div ng-if="vm.updating">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="SETTINGS.UPDATING">...</span>\n            <md-progress-linear md-mode="determinate" class="md-accent padding-20" value="{{vm.progress}}"></md-progress-linear>\n            <span class="md-display-1 padding-5 text-center">Grab a quick coffee and</span>\n            <span class="md-display-1 padding-5 text-center">get back here as soon as completed</span>\n            <img src="assets/images/business/users.jpg" alt="" width="40%" height="40%" />\n          </div>\n        </md-card>\n      </div>\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/sms/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/sms/views/smsAccounts/create/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.smsAccount.name" ng-required="true" autofocus ng-disabled="!vm.newSmsAccount">\n\n        <div ng-messages="smsAccountForm[\'name\'].$error" ng-show="smsAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.smsAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'key\'].$error" ng-show="smsAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.smsAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="SMS.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="smsAccountForm[\'remote\'].$error" ng-show="smsAccountForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="SMS.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.smsAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="SMS.HELP.LIST"></span></div>\n        <div ng-messages="smsAccountForm[\'ListId\'].$error" ng-show="smsAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.smsAccount.type" required>\n          <md-option ng-value="\'twilio\'">Twilio</md-option>\n          <md-option ng-value="\'skebby\'">Skebby</md-option>\n          <md-option ng-value="\'connectel\'">Connectel</md-option>\n          <md-option ng-value="\'clicksend\'">ClickSend</md-option>\n          <md-option ng-value="\'plivo\'">Plivo</md-option>\n          <md-option ng-value="\'infobip\'">Infobip</md-option>\n          <md-option ng-value="\'clickatell\'">Clickatell</md-option>\n          <md-option ng-value="\'bandwidth\'">Bandwidth</md-option>\n          <md-option ng-value="\'csc\'">CSCTelecom</md-option>\n          <md-option ng-value="\'intelepeer\'">Intelepeer</md-option>\n        </md-select>\n        <div ng-messages="smsAccountForm[\'type\'].$error" ng-show="smsAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.PHONE">Phone</label>\n        <input type="text" name="phone" ng-model="vm.smsAccount.phone" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'phone\'].$error" ng-show="smsAccountForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'twilio\'" class="md-block">\n        <label translate="SMS.ACCOUNTSID">AccountSID</label>\n        <input type="text" name="accountSid" ng-model="vm.smsAccount.accountSid" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'accountSid\'].$error" ng-show="smsAccountForm[\'accountSid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'plivo\'" class="md-block">\n        <label translate="SMS.AUTHID">AuthID</label>\n        <input type="text" name="authId" ng-model="vm.smsAccount.authId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'authId\'].$error" ng-show="smsAccountForm[\'authId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AUTHID_REQUIRED">AuthID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'twilio\' || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'plivo\'" class="md-block">\n        <label translate="SMS.AUTHTOKEN">AuthToken</label>\n        <input type="text" name="authToken" ng-model="vm.smsAccount.authToken" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'authToken\'].$error" ng-show="smsAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'skebby\'" class="md-block">\n        <label translate="SMS.METHOD">Method</label>\n        <md-select name="smsMethod" ng-model="vm.smsAccount.smsMethod" required>\n          <md-option ng-value="\'SI\'">Basic</md-option>\n          <md-option ng-value="\'TI\'">Classic</md-option>\n          <md-option ng-value="\'GP\'">Classic+</md-option>\n        </md-select>\n        <div ng-messages="smsAccountForm[\'smsMethod\'].$error" ng-show="smsAccountForm[\'smsMethod\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.METHOD_REQUIRED">Method field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.smsAccount.username" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'username\'].$error" ng-show="smsAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'">\n        <label translate="SMS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.smsAccount.password" placeholder="Password" translate translate-attr-placeholder="SMS.PASSWORD" required>\n        <div ng-messages="smsAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SMS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'csc\'" class="md-block">\n        <label translate="SMS.BASEURL">BaseURL</label>\n        <input type="text" name="baseUrl" ng-model="vm.smsAccount.baseUrl" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'baseUrl\'].$error" ng-show="smsAccountForm[\'baseUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.BASEURL_REQUIRED">BaseURL field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n        <label translate="SMS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.smsAccount.apiKey" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'apiKey\'].$error" ng-show="smsAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.ACCOUNTID">AccountId</label>\n        <input type="text" name="accountId" ng-model="vm.smsAccount.accountId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'accountId\'].$error" ng-show="smsAccountForm[\'accountId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCOUNTID_REQUIRED">AccountId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.APPLICATIONID">ApplicationID</label>\n        <input type="text" name="applicationId" ng-model="vm.smsAccount.applicationId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'applicationId\'].$error" ng-show="smsAccountForm[\'applicationId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.APPLICATIONID_REQUIRED">ApplicationID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsAccount.description">\n\n        <div ng-messages="smsAccountForm[\'description\'].$error" ng-show="smsAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsAccount" ng-click="vm.saveSmsAccount()" class="send-button md-accent md-raised" ng-disabled="smsAccountForm.$invalid || smsAccountForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsAccount" ng-click="vm.addNewSmsAccount()" class="send-button md-accent md-raised" ng-disabled="smsAccountForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSACCOUNT" translate-attr-aria-label="SMS.ADD_SMSACCOUNT">\n          ADD SMSACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsAccount" ng-click="vm.deleteSmsAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",'<md-dialog class="smsAccount-dialog" aria-label="smsAccount" ng-init="vm.onInit()">\n  <form name="smsAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.AGENTADD_SMSACCOUNT">Add Agent to smsAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/agent/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'agent\'].$error" ng-show="smsAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'timeout\'].$error" ng-show="smsAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'accesskeyid\'].$error" ng-show="smsAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'secretaccesskey\'].$error" ng-show="smsAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'lexregion\'].$error" ng-show="smsAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'botname\'].$error" ng-show="smsAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'times\'].$error" ng-show="smsAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="smsAccountFormApp[\'text\'].$error" ng-show="smsAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/close/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'disposition\'].$error" ng-show="smsAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'key\'].$error" ng-show="smsAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'language\'].$error" ng-show="smsAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'projectId\'].$error" ng-show="smsAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'clientEmail\'].$error" ng-show="smsAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="smsAccountFormApp[\'privateKey\'].$error" ng-show="smsAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'language\'].$error" ng-show="smsAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'condition\'].$error" ng-show="smsAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'truepriority\'].$error" ng-show="smsAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'falsepriority\'].$error" ng-show="smsAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'priority\'].$error" ng-show="smsAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/noop/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'value\'].$error" ng-show="smsAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/queue/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'queue\'].$error" ng-show="smsAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'timeout\'].$error" ng-show="smsAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/system/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'command\'].$error" ng-show="smsAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'variable\'].$error" ng-show="smsAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/tag/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'tag\'].$error" ng-show="smsAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",'<md-dialog class="smsCannedAnswer-dialog" aria-label="New SmsCannedAnswer">\n  <form name="smsCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.smsCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="smsCannedAnswerForm[\'key\'].$error" ng-show="smsCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.smsCannedAnswer.value" required></textarea>\n\n        <div ng-messages="smsCannedAnswerForm[\'value\'].$error" ng-show="smsCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsCannedAnswer.description">\n\n        <div ng-messages="smsCannedAnswerForm[\'description\'].$error" ng-show="smsCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsCannedAnswer" ng-click="vm.saveSmsCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="smsCannedAnswerForm.$invalid || smsCannedAnswerForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsCannedAnswer" ng-click="vm.addNewSmsCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="smsCannedAnswerForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSCANNEDANSWER" translate-attr-aria-label="SMS.ADD_SMSCANNEDANSWER">\n          ADD SMSCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsCannedAnswer" ng-click="vm.deleteSmsCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/view.html",'<div id="sms-smsAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-smsAccounts-button md-icon-button" aria-label="Go to smsAccounts" ng-click="vm.gotoSmsAccounts()" translate translate-attr-aria-label="SMS.GO_TO_SMSACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="smsAccount-image" hide-xs>\n          <img ng-src="assets/images/business/smsAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.smsAccount.id}}\n            <span ng-if="vm.smsAccount.name">{{vm.smsAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="SMS.CREATED_AT"></span> <span>{{vm.smsAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.smsAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="SMS.AGENTADD_SMSACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSmsAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (smsDispositionsForm.$invalid) || (smsCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.smsAccount.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.smsAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.smsAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="SMS.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.smsAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'twilio\'">Twilio</md-option>\n                  <md-option ng-value="\'skebby\'">Skebby</md-option>\n                  <md-option ng-value="\'connectel\'">Connectel</md-option>\n                  <md-option ng-value="\'clicksend\'">ClickSend</md-option>\n                  <md-option ng-value="\'plivo\'">Plivo</md-option>\n                  <md-option ng-value="\'infobip\'">Infobip</md-option>\n                  <md-option ng-value="\'clickatell\'">Clickatell</md-option>\n                  <md-option ng-value="\'bandwidth\'">Bandwidth</md-option>\n                  <md-option ng-value="\'csc\'">CSCTelecom</md-option>\n                  <md-option ng-value="\'intelepeer\'">Intelepeer</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.smsAccount.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'twilio\'" class="md-block">\n                <label translate="SMS.ACCOUNTSID">AccountSID</label>\n                <input type="text" name="accountSid" ng-model="vm.smsAccount.accountSid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accountSid\'].$error" ng-show="generalForm[\'accountSid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'plivo\'" class="md-block">\n                <label translate="SMS.AUTHID">AuthID</label>\n                <input type="text" name="authId" ng-model="vm.smsAccount.authId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authId\'].$error" ng-show="generalForm[\'authId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AUTHID_REQUIRED">AuthID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'twilio\' || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'plivo\'" class="md-block">\n                <label translate="SMS.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.smsAccount.authToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authToken\'].$error" ng-show="generalForm[\'authToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'skebby\'" class="md-block">\n                <label translate="SMS.METHOD">Method</label>\n                <md-select name="smsMethod" ng-model="vm.smsAccount.smsMethod" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'SI\'">Basic</md-option>\n                  <md-option ng-value="\'TI\'">Classic</md-option>\n                  <md-option ng-value="\'GP\'">Classic+</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'smsMethod\'].$error" ng-show="generalForm[\'smsMethod\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.METHOD_REQUIRED">Method field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.smsAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'">\n                <label translate="SMS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.smsAccount.password" placeholder="Password" translate translate-attr-placeholder="SMS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'csc\'" class="md-block">\n                <label translate="SMS.BASEURL">BaseURL</label>\n                <input type="text" name="baseUrl" ng-model="vm.smsAccount.baseUrl" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'baseUrl\'].$error" ng-show="generalForm[\'baseUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.BASEURL_REQUIRED">BaseURL field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n                <label translate="SMS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.smsAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.ACCOUNTID">AccountId</label>\n                <input type="text" name="accountId" ng-model="vm.smsAccount.accountId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accountId\'].$error" ng-show="generalForm[\'accountId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.ACCOUNTID_REQUIRED">AccountId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.APPLICATIONID">ApplicationID</label>\n                <input type="text" name="applicationId" ng-model="vm.smsAccount.applicationId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'applicationId\'].$error" ng-show="generalForm[\'applicationId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.APPLICATIONID_REQUIRED">ApplicationID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'plivo\'|| vm.smsAccount.type == \'csc\'|| vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n                <label translate="SMS.SENDERSTRING">SenderString</label>\n                <input type="text" name="senderString" ng-model="vm.smsAccount.senderString" md-maxlength="11" ng-pattern="/^[A-Za-z0-9\\.\\s]*$/i" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'senderString\'].$error" ng-show="generalForm[\'senderString\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.SENDERSTRING_REQUIRED">SenderString field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.SENDERSTRING_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\s]*$/i\' }">SenderString must be valid pattern </span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.SENDERSTRING_MAX_LENGTH" translate-values=\'{max: 11}\'>SenderString must have a maximum length equal to 11</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="(vm.smsAccount.type == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\'" class="md-block">\n                <md-switch ng-model="vm.smsAccount.deliveryReport" aria-label="deliveryReport" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.DELIVERYREPORT">deliveryReport</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.smsAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.smsAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.smsAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.RECEIVEURL">receiveUrl</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUrl" name="receiveUrl" ng-value="vm.smsAccount.remote + \'/api/sms/accounts/\' + vm.smsAccount.id + \'/notify?token=\' + vm.smsAccount.token" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="SMS.HELP.RECEIVEURL"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="( ((vm.smsAccount.type == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\') && vm.smsAccount.deliveryReport) || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.DELIVERYREPORTURL">deliveryReportUrl</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-deliveryReportUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-deliveryReportUrl" name="deliveryReportUrl" ng-value="vm.smsAccount.remote + \'/api/sms/accounts/\' + vm.smsAccount.id + \'/status?token=\' + vm.smsAccount.token + (vm.smsAccount.type == \'csc\' ? \'&message-id={message-id}&state={state}\' : \'\')" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="SMS.HELP.DELIVERYREPORTURL"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="SMS.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.smsAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.queueTransfer == true" class="md-block">\n                <label translate="SMS.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.smsAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.agentTransfer == true" class="md-block">\n                <label translate="SMS.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.smsAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.smsAccount.token" autofocus disabled>\n\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.MOTIONPROXY">MotionProxy</label>\n                <input type="url" name="remote" ng-model="vm.smsAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="SMS.HELP.MOTIONPROXY"></span></div>\n                <div ng-messages="proxyForm[\'remote\'].$error" ng-show="proxyForm[\'remote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.mandatoryDisposition" class="md-block">\n                <label translate="SMS.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.smsAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="SMS.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="SmsAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="smsAccount-detail-form-container smsdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="SMS.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add sms dispositions" translate translate-attr-label="SMS.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="smsAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container smscannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountSmsCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountSmsCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SMS.SMSCANNEDANSWERS">SmsCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getSmsAccountSmsCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event)" aria-label="add smsCannedAnswer" translate translate-attr-label="SMS.ADD_SMSCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedSmsAccountSmsCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedSmsAccountSmsCannedAnswers.length}} {{vm_dc.selectedSmsAccountSmsCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountSmsCannedAnswers" csv-label="true" filename="smsAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedSmsAccountSmsCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedSmsAccountSmsCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountSmsCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'SMS.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'SMS.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'SMS.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'SMS.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'SMS.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="smsCannedAnswer" md-select-id="id" ng-repeat="smsCannedAnswer in vm_dc.smsAccountSmsCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{ smsCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" translate="SMS.EDIT_SMSCANNEDANSWER">\n                                Edit SmsCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(smsCannedAnswer, $event)" translate="SMS.DELETE_SMSCANNEDANSWER">\n                                Delete SmsCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.smsAccountSmsCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="SMS.NO_SMSCANNEDANSWER_AVAILABLE">No smscannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.smsAccountSmsCannedAnswers.count}}" md-on-paginate="vm_dc.getSmsAccountSmsCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.smsAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="SMS.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedSmsAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedSmsAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedSmsAccountApps.length}} {{vm_ac.selectedSmsAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedSmsAccountApps($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedSmsAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.smsAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editSmsAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.smsAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SMS.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getSmsAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getSmsAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getSmsAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="SMS.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedSmsAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedSmsAccountInteractions.length}} {{vm_dc.selectedSmsAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountInteractions" csv-label="true" filename="smsAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedSmsAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedSmsAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'SMS.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'SMS.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'SMS.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'SMS.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'SMS.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'SMS.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'SMS.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.smsAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'SMS.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'SMS.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spysmsInteraction($event, interaction)" translate="SMS.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.smsInteractionDownload(interaction, $event)" translate="SMS.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="SMS.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.smsAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="SMS.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.smsAccountInteractions.count}}" md-on-paginate="vm_dc.getSmsAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/sms/views/smsAccounts/smsAccounts.html",'<div id="smsAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-message-text" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SMS.SMSACCOUNTS">SmsAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SMS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSmsAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSmsAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SMS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-smsAccounts-count">\n          <span>{{vm.selectedSmsAccounts.length}}</span>\n          <span translate="SMS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SMS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSmsAccounts()" translate="SMS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSmsAccounts()" translate="SMS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSmsAccounts" csv-label="true" filename="smsAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSmsAccounts($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SMSACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSmsAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'SMS.KEY\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'SMS.LIST\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'SMS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'SMS.PHONE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.smsAccounts.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="smsAccount" md-select-id="id" ng-repeat="smsAccount in vm.smsAccounts.rows">\n                <td md-cell ng-if="smsAccount.userpic"><img class="avatar" alt="{{smsAccount.name}}" ng-src="api/users/{{smsAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!smsAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{smsAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="id ">{{smsAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="name ">{{smsAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="key ">{{smsAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':smsAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="type ">{{ vm.arraytype[smsAccount.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="phone ">{{smsAccount.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="description ">{{smsAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(smsAccount, $event    )" translate="SMS.EDIT_SMSACCOUNT">\n                          Edit SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(smsAccount, $event    )" translate="SMS.INTERACTIONS_SMSACCOUNT">\n                          Interactions SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(smsAccount, $event    )" translate="SMS.AGENTADD_SMSACCOUNT">\n                          AgentAdd SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(smsAccount, $event    )" translate="SMS.DELETE_SMSACCOUNT">\n                          Delete SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsAccounts.count}}" md-on-paginate="vm.getSmsAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SMSACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SMSACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-smsAccount-button" ng-click="vm.createOrEditSmsAccount($event)" aria-label="add smsAccount" translate translate-attr-aria-label="SMS.ADD_SMSACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SMSACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/sms/views/smsQueues/create/dialog.html",'<md-dialog class="smsQueue-dialog" aria-label="New SmsQueue">\n  <form name="smsQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.smsQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newSmsQueue">\n\n        <div class="hint"><span translate="SMS.HELP.NAME"></span></div>\n        <div ng-messages="smsQueueForm[\'name\'].$error" ng-show="smsQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SMS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.smsQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="smsQueueForm[\'strategy\'].$error" ng-show="smsQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.smsQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="smsQueueForm[\'timeout\'].$error" ng-show="smsQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsQueue.description">\n\n        <div ng-messages="smsQueueForm[\'description\'].$error" ng-show="smsQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsQueue" ng-click="vm.saveSmsQueue()" class="send-button md-accent md-raised" ng-disabled="smsQueueForm.$invalid || smsQueueForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsQueue" ng-click="vm.addNewSmsQueue()" class="send-button md-accent md-raised" ng-disabled="smsQueueForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSQUEUE" translate-attr-aria-label="SMS.ADD_SMSQUEUE">\n          ADD SMSQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsQueue" ng-click="vm.deleteSmsQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",'<md-dialog class="smsQueue-dialog" aria-label="smsQueue" ng-init="vm.onInit()">\n  <form name="smsQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.AGENTADD_SMSQUEUE">Add Agent to smsQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",'<md-dialog class="smsQueue-dialog" aria-label="smsQueue" ng-init="vm.onInit()">\n  <form name="smsQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/view.html",'<div id="sms-smsQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-smsQueues-button md-icon-button" aria-label="Go to smsQueues" ng-click="vm.gotoSmsQueues()" translate translate-attr-aria-label="SMS.GO_TO_SMSQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="smsQueue-image" hide-xs>\n          <img ng-src="assets/images/business/smsQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.smsQueue.id}}\n            <span ng-if="vm.smsQueue.name">{{vm.smsQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="SMS.CREATED_AT"></span> <span>{{vm.smsQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.smsQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="SMS.TEAMADD_SMSQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.smsQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="SMS.AGENTADD_SMSQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSmsQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.smsQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="SMS.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.smsQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.smsQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.smsQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/sms/views/smsQueues/smsQueues.html",'<div id="smsQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-message-text" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SMS.SMSQUEUES">SmsQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SMS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSmsQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSmsQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SMS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-smsQueues-count">\n          <span>{{vm.selectedSmsQueues.length}}</span>\n          <span translate="SMS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SMS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSmsQueues()" translate="SMS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSmsQueues()" translate="SMS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSmsQueues" csv-label="true" filename="smsQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSmsQueues($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SMSQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSmsQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'SMS.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.smsQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="smsQueue" md-select-id="id" ng-repeat="smsQueue in vm.smsQueues.rows">\n                <td md-cell ng-if="smsQueue.userpic"><img class="avatar" alt="{{smsQueue.name}}" ng-src="api/users/{{smsQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!smsQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{smsQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="id ">{{smsQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="name ">{{smsQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="strategy ">{{ vm.arraystrategy[smsQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(smsQueue, $event    )" translate="SMS.EDIT_SMSQUEUE">\n                          Edit SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(smsQueue, $event    )" translate="SMS.TEAMADD_SMSQUEUE">\n                          teamadd SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(smsQueue, $event    )" translate="SMS.AGENTADD_SMSQUEUE">\n                          agentadd SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(smsQueue, $event    )" translate="SMS.DELETE_SMSQUEUE">\n                          Delete SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(smsQueue, $event    )" translate="SMS.GOTOREALTIME_SMSQUEUE">\n                          goToRealtime SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsQueues.count}}" md-on-paginate="vm.getSmsQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SMSQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SMSQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-smsQueue-button" ng-click="vm.createOrEditSmsQueue($event)" aria-label="add smsQueue" translate translate-attr-aria-label="SMS.ADD_SMSQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SMSQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/agents/agents.html",'<div id="agents" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.AGENTS">Agents</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedAgents.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedAgents =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-agents-count">\n          <span>{{vm.selectedAgents.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllAgents()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectAgents()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedAgents" csv-label="true" filename="agents.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedAgents($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- AGENT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedAgents" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAgents">\n              <tr md-row>\n                <th md-column width="20px"></th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="showWebBar">{{ \'STAFF.SHOWWEBCONTROL\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'STAFF.PHONE\' | translate }}</th>\n                <th md-column md-order-by="mobile">{{ \'STAFF.MOBILE\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column md-order-by="disabled">{{ \'STAFF.DISABLED\' | translate }}</th>\n                <th md-column md-order-by="blocked">{{ \'STAFF.BLOCKED\' | translate }}</th>\n                <th md-column>{{ \'STAFF.CLIENT_LOGS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.agents.rows.length">\n                <td md-cell colspan="10">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="agent" md-select-id="id" ng-repeat="agent in vm.agents.rows">\n                <td md-cell ng-if="agent.userpic"><img class="avatar" alt="{{agent.name}}" ng-src="api/users/{{agent.id}}/avatar" /></td>\n                <td md-cell ng-if="!agent.userpic"><img class="avatar" alt="{{agent.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="fullname font-weight-600">{{agent.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="name">{{agent.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="showWebBar">{{ agent.showWebBar | getOptionByValue: vm.showWebBarOptions }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="email">{{agent.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="phone">{{agent.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="mobile">{{agent.mobile}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="internal">{{agent.internal}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="disabled">\n                  <md-icon md-colors="{color: {{agent.disabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{agent.disabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="blocked">\n                  <md-icon md-colors="{color: {{agent.blocked ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{agent.blocked ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="client-side-logging">\n                  <ms-client-side-logging-icon user="agent"></ms-client-side-logging-icon>\n                </td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(agent, $event    )" translate="STAFF.EDIT_AGENT">\n                          Edit Agent\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item>\n                        <md-button ng-click="vm.teamadddialog(agent, $event    )" translate="STAFF.TEAMADD_AGENT">\n                          teamadd Agent\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(agent, $event    )" translate="STAFF.DELETE_AGENT">\n                          Delete Agent\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.agents.count}}" md-on-paginate="vm.getAgents" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / AGENT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD AGENT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-agent-button" ng-click="vm.createOrEditAgent($event)" aria-label="add agent" translate translate-attr-aria-label="STAFF.ADD_AGENT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD AGENT BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/agents/create/dialog.html",'<md-dialog class="agent-dialog" aria-label="New Agent">\n  <form name="agentForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="agentForm[\'fullname\'].$error" ng-show="agentForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.agent.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newAgent">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="agentForm[\'name\'].$error" ng-show="agentForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.agent.alias">\n\n        <div ng-messages="agentForm[\'alias\'].$error" ng-show="agentForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.SHOWWEBCONTROL">ShowWebControl</label>\n        <md-select name="showWebBar" ng-model="vm.agent.showWebBar">\n          <md-option ng-value="0">Phonebar</md-option>\n          <md-option ng-value="1">External</md-option>\n          <md-option ng-value="2">WebRTC</md-option>\n        </md-select>\n        <div ng-messages="agentForm[\'showWebBar\'].$error" ng-show="agentForm[\'showWebBar\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.SHOWWEBCONTROL_REQUIRED">ShowWebControl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.agent.email" ng-required="true">\n\n        <div ng-messages="agentForm[\'email\'].$error" ng-show="agentForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newAgent">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.agent.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="agentForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newAgent  && (vm.newAgent)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="agentForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newAgent" class="md-block">\n        <md-switch ng-model="vm.agent.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.agent.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.agent.internal" ng-required="true" ng-disabled="!vm.newAgent">\n\n        <div ng-messages="agentForm[\'internal\'].$error" ng-show="agentForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.agent.description">\n\n        <div ng-messages="agentForm[\'description\'].$error" ng-show="agentForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newAgent" class="md-block">\n        <md-switch ng-model="vm.agent.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.agent.userSetting">\n        <ms-client-side-logging user="vm.agent"></ms-client-side-logging>\n      </md-input-container>\n      <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n        <md-switch ng-model="vm.agent.phoneBarRemoteControl" aria-label="RemoteControl"><span translate="STAFF.REMOTECONTROL">RemoteControl</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.agent.phoneBarRemoteControl && vm.agent.showWebBar == 0" class="md-block">\n        <label translate="STAFF.REMOTECONTROLPORT">RemoteControlPort</label>\n        <input type="number" name="phoneBarRemoteControlPort" ng-model="vm.agent.phoneBarRemoteControlPort" value="9888" ng-required="true">\n\n        <div ng-messages="agentForm[\'phoneBarRemoteControlPort\'].$error" ng-show="agentForm[\'phoneBarRemoteControlPort\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.REMOTECONTROLPORT_REQUIRED">RemoteControlPort field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newUser" class="md-block">\n        <md-switch ng-model="vm.agent.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAgent" ng-click="vm.saveAgent()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid || agentForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAgent" ng-click="vm.addNewAgent()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid" aria-label="ADD" translate="STAFF.ADD_AGENT" translate-attr-aria-label="STAFF.ADD_AGENT">\n          ADD AGENT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAgent" ng-click="vm.deleteAgent($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",'<md-dialog class="agent-dialog" aria-label="{{vm.name}}">\n  <form name="agentForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.agent.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="agentForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="agentForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="agentForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid || agentForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",'<md-dialog class="agent-dialog" aria-label="agent" ng-init="vm.onInit()">\n  <form name="agentForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2>{{vm.title}}</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin" ng-if="vm.agent.role === \'agent\' && vm.channel === \'voice\'">\n        <label translate="STAFF.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="agentForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" add-disabled="vm.channel === \'voice\' && vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveQueues()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",'<md-dialog class="agent-dialog" aria-label="agent" ng-init="vm.onInit()">\n  <form name="agentForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="STAFF.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/view.html",'<div id="staff-agent" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-agents-button md-icon-button" aria-label="Go to agents" ng-click="vm.gotoAgents()" translate translate-attr-aria-label="STAFF.GO_TO_AGENTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="agent-image" hide-xs>\n          <img ng-src="assets/images/business/agents.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.agent.id}}\n            <span ng-if="vm.agent.name">{{vm.agent.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.agent.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-cloak>\n      <md-fab-speed-dial md-direction="left" class="md-scale md-fab">\n        <md-fab-trigger>\n          <md-button aria-label="menu" class="md-fab md-primary md-icon-button">\n            <md-tooltip md-direction="top" md-visible="false"><span translate="STAFF.CHANNELS">Channels</span></md-tooltip>\n            <md-icon md-font-icon="icon-stackoverflow" aria-label="queueadd"></md-icon>\n          </md-button>\n        </md-fab-trigger>\n        <md-fab-actions>\n          <md-button aria-label="voice" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'voice\', $event, \'inbound\')">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="VOICE.VOICE">Voice</span></md-tooltip>\n            <md-icon md-font-icon="icon-phone" aria-label="voice"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.dialer" aria-label="motion bull" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'voice\', $event, \'outbound\')">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="MOTIONDIALER.MOTIONDIALER">Motion Bull</span></md-tooltip>\n            <md-icon md-font-icon="icon-fire" aria-label="motion bull"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.chat" aria-label="chat" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'chat\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="CHAT.CHAT">Chat</span></md-tooltip>\n            <md-icon md-font-icon="icon-hangouts" aria-label="chat"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.mail" aria-label="mail" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'mail\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="MAIL.MAIL">Email</span></md-tooltip>\n            <md-icon md-font-icon="icon-email" aria-label="mail"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.messaging" aria-label="sms" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'sms\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="SMS.SMS">Sms</span></md-tooltip>\n            <md-icon md-font-icon="icon-message-text" aria-label="sms"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.openchannel" aria-label="openchannel" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'openchannel\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="OPENCHANNEL.OPENCHANNEL">Openchannel</span></md-tooltip>\n            <md-icon md-font-icon="icon-google-earth" aria-label="openchannel"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.fax" aria-label="fax" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'fax\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="FAX.FAX">Fax</span></md-tooltip>\n            <md-icon md-font-icon="icon-deskphone" aria-label="fax"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.whatsapp" aria-label="whatsapp" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'whatsapp\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="WHATSAPP.WHATSAPP">whatsapp</span></md-tooltip>\n            <md-icon md-font-icon="icon-whatsapp" aria-label="whatsapp"></md-icon>\n          </md-button>\n        </md-fab-actions>\n      </md-fab-speed-dial>\n    </div>\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.agent, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="STAFF.TEAMADD_AGENT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.agent, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_AGENT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveAgent()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(personal_infoForm.$invalid) || (security_suiteForm.$invalid) || (change_avatarForm.$invalid) || (generalForm.$invalid) || (capacityForm.$invalid) || (settingsForm.$invalid) || (remote_controlForm.$invalid) || (sipForm.$invalid) || (callforwardingForm.$invalid) || (settings_webrtcForm.$invalid) || (sip_webrtcForm.$invalid) || (general_permissionsForm.$invalid) || (download_permissionsForm.$invalid) || (permissionsForm.$invalid) || (autoAnswerForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERSONAL_INFO">PERSONAL_INFO</div>\n            </div>\n            <form name="personal_infoForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.FULLNAME">Fullname</label>\n                <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'fullname\'].$error" ng-show="personal_infoForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.agent.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="personal_infoForm[\'name\'].$error" ng-show="personal_infoForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.agent.alias" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'alias\'].$error" ng-show="personal_infoForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SHOWWEBCONTROL">ShowWebControl</label>\n                <md-select name="showWebBar" ng-model="vm.agent.showWebBar" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="0">Phonebar</md-option>\n                  <md-option ng-value="1">External</md-option>\n                  <md-option ng-value="2">WebRTC</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'showWebBar\'].$error" ng-show="personal_infoForm[\'showWebBar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SHOWWEBCONTROL_REQUIRED">ShowWebControl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.agent.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'email\'].$error" ng-show="personal_infoForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.agent.phone" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'phone\'].$error" ng-show="personal_infoForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.agent.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'mobile\'].$error" ng-show="personal_infoForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 1" class="md-block">\n                <md-switch ng-model="vm.agent.hotdesk" aria-label="Hotdesk" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.HOTDESK">Hotdesk</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.loginInPause" aria-label="LoginInPause" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.LOGININPAUSE">LoginInPause</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.agent.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'description\'].$error" ng-show="personal_infoForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container security_suite md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SECURITY_SUITE">SECURITY_SUITE</div>\n            </div>\n            <form name="security_suiteForm" novalidate>\n              <md-input-container ng-if="vm.agent.passwordResetAt != null" class="md-block">\n                <label translate="STAFF.LAST_PASSWORD_RESET_AT">Last_Password_Reset_At</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.agent.passwordResetAt" autofocus disabled>\n                <div class="hint"><span translate="STAFF.HELP.LAST_PASSWORD_RESET_AT"></span></div>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.LAST_PASSWORD_RESET_AT_REQUIRED">Last_Password_Reset_At field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.passwordResetAt == null" class="md-block">\n                <label translate="STAFF.NO_PASSWORD_CHANGE">No_Password_Change</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.agent.passwordResetAt" disabled>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NO_PASSWORD_CHANGE_REQUIRED">No_Password_Change field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.disabled" aria-label="Disabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DISABLED">Disabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.DISABLED"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.disabled == 0" class="md-block">\n                <md-switch ng-model="vm.agent.blocked" aria-label="Blocked" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.BLOCKED">Blocked</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.BLOCKED"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.privacyEnabled" aria-label="Mask_Sensitive_Data" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTHENTICATION">AUTHENTICATION</div>\n            </div>\n            <form name="authenticationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.adSsoEnabled" aria-label="AD_SSO_Enabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AD_SSO_ENABLED">AD_SSO_Enabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.AD_SSO_ENABLED"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container change_avatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CHANGE_AVATAR">CHANGE_AVATAR</div>\n            </div>\n            <div ng-controller="Agentchange_avatarController as vm_ca" ng-init="vm_ca.init(vm.agent, vm.crudPermissions)" class="agent-detail-form-container md-background-bg md-whiteframe-1dp">\n              <div id="agent-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="change_avatarimage in vm_ca.agent.images" ng-switch="change_avatarimage.type">\n                    <div class="agent-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{change_avatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="change_avatarimage.file">\n                    </div>\n                    <div class="agent-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{change_avatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.agent.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.agent.internal" ng-required="true" autofocus disabled>\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar != 2" class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.agent.transport" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'" ng-if="vm.agent.showWebBar == 1">ws</md-option>\n                  <md-option ng-value="\'wss\'" ng-if="vm.agent.showWebBar == 1">wss</md-option>\n                  <md-option ng-value="\'tls\'" ng-if="vm.agent.showWebBar == 1">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TRANSPORT"></span></div>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.HOST">Host</label>\n                <input type="text" name="host" ng-model="vm.agent.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.HOST"></span></div>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.agent.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.agent.type" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'friend\'">Friend</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                  <md-option ng-value="\'peer\'">Peer</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TYPE"></span></div>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.agent.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input type="text" name="callerid" ng-model="vm.agent.callerid" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.agent.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.agent.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.agent.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.chanspy" aria-label="chanSpy" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CHANSPY">chanSpy</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.agent.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MONITOREXTENSION">MonitorExtension</label>\n                <md-select name="extensionMonitor" ng-model="vm.agent.extensionMonitor" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'WAV\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'extensionMonitor\'].$error" ng-show="generalForm[\'extensionMonitor\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MONITOREXTENSION_REQUIRED">MonitorExtension field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.OTHER_CHANNELS">OTHER_CHANNELS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container capacity md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CAPACITY">CAPACITY</div>\n            </div>\n            <form name="capacityForm" novalidate>\n              <md-input-container ng-if="vm.license.chat" class="md-block">\n                <label translate="STAFF.CHATCAPACITY">ChatCapacity</label>\n                <input type="number" name="chatCapacity" ng-model="vm.agent.chatCapacity" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CHATCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'chatCapacity\'].$error" ng-show="capacityForm[\'chatCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CHATCAPACITY_REQUIRED">ChatCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.CHATCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ChatCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.mail" class="md-block">\n                <label translate="STAFF.MAILCAPACITY">MailCapacity</label>\n                <input type="number" name="mailCapacity" ng-model="vm.agent.mailCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.MAILCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'mailCapacity\'].$error" ng-show="capacityForm[\'mailCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MAILCAPACITY_REQUIRED">MailCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.MAILCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MailCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.messaging" class="md-block">\n                <label translate="STAFF.SMSCAPACITY">SMSCapacity</label>\n                <input type="number" name="smsCapacity" ng-model="vm.agent.smsCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SMSCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'smsCapacity\'].$error" ng-show="capacityForm[\'smsCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SMSCAPACITY_REQUIRED">SMSCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.SMSCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">SMSCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.openchannel" class="md-block">\n                <label translate="STAFF.OPENCHANNELCAPACITY">OpenchannelCapacity</label>\n                <input type="number" name="openchannelCapacity" ng-model="vm.agent.openchannelCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.OPENCHANNELCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'openchannelCapacity\'].$error" ng-show="capacityForm[\'openchannelCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.OPENCHANNELCAPACITY_REQUIRED">OpenchannelCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.OPENCHANNELCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OpenchannelCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.fax" class="md-block">\n                <label translate="STAFF.FAXCAPACITY">FaxCapacity</label>\n                <input type="number" name="faxCapacity" ng-model="vm.agent.faxCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.FAXCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'faxCapacity\'].$error" ng-show="capacityForm[\'faxCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FAXCAPACITY_REQUIRED">FaxCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.FAXCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">FaxCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.whatsapp" class="md-block">\n                <label translate="STAFF.WHATSAPPCAPACITY">WhatsappCapacity</label>\n                <input type="number" name="whatsappCapacity" ng-model="vm.agent.whatsappCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.WHATSAPPCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'whatsappCapacity\'].$error" ng-show="capacityForm[\'whatsappCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.WHATSAPPCAPACITY_REQUIRED">WhatsappCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.WHATSAPPCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WhatsappCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container auto_answer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTO_ANSWER">AUTO_ANSWER</div>\n            </div>\n            <form name="autoAnswerForm" novalidate>\n              <md-input-container ng-if="vm.license.chat" class="md-block">\n                <md-switch ng-model="vm.agent.chatAutoanswer" aria-label="chatAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.CHAT_AUTOANSWER">ChatAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.chatAutoanswer" class="md-block">\n                  <label translate="STAFF.CHAT_AUTOANSWERDELAY">ChatAutoAnswerDelay</label>\n                  <input type="number" name="chatAutoAnswerDelay" ng-model="vm.agent.chatAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.mail" class="md-block">\n                <md-switch ng-model="vm.agent.emailAutoanswer" aria-label="emailAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.EMAIL_AUTOANSWER">EmailAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.emailAutoanswer" class="md-block">\n                  <label translate="STAFF.EMAIL_AUTOANSWERDELAY">EmailAutoAnswerDelay</label>\n                  <input type="number" name="emailAutoAnswerDelay" ng-model="vm.agent.emailAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.messaging" class="md-block">\n                <md-switch ng-model="vm.agent.smsAutoanswer" aria-label="smsAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.SMS_AUTOANSWER">SmsAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.smsAutoanswer" class="md-block">\n                  <label translate="STAFF.SMS_AUTOANSWERDELAY">SmsAutoAnswerDelay</label>\n                  <input type="number" name="smsAutoAnswerDelay" ng-model="vm.agent.smsAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.openchannel" class="md-block">\n                <md-switch ng-model="vm.agent.openchannelAutoanswer" aria-label="openchannelAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.OPENCHANNEL_AUTOANSWER">openchannelAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.openchannelAutoanswer" class="md-block">\n                  <label translate="STAFF.OPENCHANNEL_AUTOANSWERDELAY">openchannelAutoAnswerDelay</label>\n                  <input type="number" name="openchannelAutoAnswerDelay" ng-model="vm.agent.openchannelAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.fax" class="md-block">\n                <md-switch ng-model="vm.agent.faxAutoanswer" aria-label="faxAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.FAX_AUTOANSWER">faxAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.faxAutoanswer" class="md-block">\n                  <label translate="STAFF.FAX_AUTOANSWERDELAY">faxAutoAnswerDelay</label>\n                  <input type="number" name="faxAutoAnswerDelay" ng-model="vm.agent.faxAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.whatsapp" class="md-block">\n                <md-switch ng-model="vm.agent.whatsappAutoanswer" aria-label="whatsappAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.WHATSAPP_AUTOANSWER">whatsappAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.whatsappAutoanswer" class="md-block">\n                  <label translate="STAFF.WHATSAPP_AUTOANSWERDELAY">whatsappAutoAnswerDelay</label>\n                  <input type="number" name="whatsappAutoAnswerDelay" ng-model="vm.agent.whatsappAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.agent.showWebBar == 0">\n        <md-tab-label>\n          <span translate="STAFF.MOTIONBAR">MOTIONBAR</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container settings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SETTINGS">SETTINGS</div>\n            </div>\n            <form name="settingsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableSettings" aria-label="EnableSettings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESETTINGS">EnableSettings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarAutoAnswer" aria-label="AutoAnswer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AUTOANSWER">AutoAnswer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarAutoAnswer" class="md-block">\n                <label translate="STAFF.AUTOANSWERDELAY">AutoAnswerDelay</label>\n                <input type="number" name="phoneBarAutoAnswerDelay" ng-model="vm.agent.phoneBarAutoAnswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="settingsForm[\'phoneBarAutoAnswerDelay\'].$error" ng-show="settingsForm[\'phoneBarAutoAnswerDelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_REQUIRED">AutoAnswerDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AutoAnswerDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarRingInUse" aria-label="RingInUse" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.RINGINUSE">RingInUse</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableRecording" aria-label="EnableRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLERECORDING">EnableRecording</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableDtmfTone" aria-label="EnableDtmfTone" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEDTMFTONE">EnableDtmfTone</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarDnd" aria-label="Dnd" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DND">Dnd</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarUnansweredCallBadge" aria-label="UnansweredCallBadge" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.UNANSWEREDCALLBADGE">UnansweredCallBadge</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableJaws" aria-label="EnableJawsIntegration" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEJAWSINTEGRATION">EnableJawsIntegration</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0 && vm.license.screenrecording" class="md-block">\n                <md-switch ng-change="vm.onEnableScreenRecordingByAgentSelection()" ng-model="vm.agent.phoneBarEnableScreenRecordingByAgent" aria-label="EnableScreenRecordingByAgent" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESCREENRECORDINGBYAGENT">EnableScreenRecordingByAgent</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0 && vm.license.screenrecording" class="md-block">\n                <md-switch ng-change="vm.onEnableAutomaticScreenRecordingSelection()" ng-model="vm.agent.phoneBarEnableAutomaticScreenRecording" aria-label="EnableAutomaticScreenRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEAUTOMATICSCREENRECORDING">EnableAutomaticScreenRecording</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.ENABLEAUTOMATICSCREENRECORDING"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container remote_control md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.REMOTE_CONTROL">REMOTE_CONTROL</div>\n            </div>\n            <form name="remote_controlForm" novalidate>\n              <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarRemoteControl" aria-label="RemoteControl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.REMOTECONTROL">RemoteControl</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarRemoteControl && vm.agent.showWebBar == 0" class="md-block">\n                <label translate="STAFF.REMOTECONTROLPORT">RemoteControlPort</label>\n                <input type="number" name="phoneBarRemoteControlPort" ng-model="vm.agent.phoneBarRemoteControlPort" value="9888" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="remote_controlForm[\'phoneBarRemoteControlPort\'].$error" ng-show="remote_controlForm[\'phoneBarRemoteControlPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.REMOTECONTROLPORT_REQUIRED">RemoteControlPort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container sip md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SIP">SIP</div>\n            </div>\n            <form name="sipForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPEXPIRES">SipExpires</label>\n                <input type="number" name="phoneBarExpires" ng-model="vm.agent.phoneBarExpires" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPEXPIRES"></span></div>\n                <div ng-messages="sipForm[\'phoneBarExpires\'].$error" ng-show="sipForm[\'phoneBarExpires\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPEXPIRES_REQUIRED">SipExpires field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPPORT">SipPort</label>\n                <input type="number" name="phoneBarListenPort" ng-model="vm.agent.phoneBarListenPort" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPPORT"></span></div>\n                <div ng-messages="sipForm[\'phoneBarListenPort\'].$error" ng-show="sipForm[\'phoneBarListenPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPPORT_REQUIRED">SipPort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container callforwarding md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CALLFORWARDING">CALLFORWARDING</div>\n            </div>\n            <form name="callforwardingForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarUnconditional" aria-label="Unconditional" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.UNCONDITIONAL">Unconditional</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarUnconditional" class="md-block">\n                <label translate="STAFF.UNCONDITIONALNUMBER">UnconditionalNumber</label>\n                <input type="text" name="phoneBarUnconditionalNumber" ng-model="vm.agent.phoneBarUnconditionalNumber" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="callforwardingForm[\'phoneBarUnconditionalNumber\'].$error" ng-show="callforwardingForm[\'phoneBarUnconditionalNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.UNCONDITIONALNUMBER_REQUIRED">UnconditionalNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.agent.showWebBar == 2">\n        <md-tab-label>\n          <span translate="STAFF.WEBRTC">WEBRTC</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container settings_webrtc md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SETTINGS_WEBRTC">SETTINGS_WEBRTC</div>\n            </div>\n            <form name="settings_webrtcForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DTLSCERTFILE">dtlscertfile</label>\n                <input type="text" name="dtlscertfile" ng-model="vm.agent.dtlscertfile" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.DTLSCERTFILE"></span></div>\n                <div ng-messages="settings_webrtcForm[\'dtlscertfile\'].$error" ng-show="settings_webrtcForm[\'dtlscertfile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DTLSCERTFILE_REQUIRED">dtlscertfile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DTLSPRIVATEKEY">dtlsprivatekey</label>\n                <input type="text" name="dtlsprivatekey" ng-model="vm.agent.dtlsprivatekey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.DTLSPRIVATEKEY"></span></div>\n                <div ng-messages="settings_webrtcForm[\'dtlsprivatekey\'].$error" ng-show="settings_webrtcForm[\'dtlsprivatekey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DTLSPRIVATEKEY_REQUIRED">dtlsprivatekey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.WSS_PORT">WSS_Port</label>\n                <input type="number" name="wssPort" ng-model="vm.agent.wssPort" min="0" value="8089" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.WSS_PORT"></span></div>\n                <div ng-messages="settings_webrtcForm[\'wssPort\'].$error" ng-show="settings_webrtcForm[\'wssPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.WSS_PORT_REQUIRED">WSS_Port field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.WSS_PORT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WSS_Port must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableSettings" aria-label="EnableSettings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESETTINGS">EnableSettings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarAutoAnswer" aria-label="AutoAnswer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AUTOANSWER">AutoAnswer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarAutoAnswer" class="md-block">\n                <label translate="STAFF.AUTOANSWERDELAY">AutoAnswerDelay</label>\n                <input type="number" name="phoneBarAutoAnswerDelay" ng-model="vm.agent.phoneBarAutoAnswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="settings_webrtcForm[\'phoneBarAutoAnswerDelay\'].$error" ng-show="settings_webrtcForm[\'phoneBarAutoAnswerDelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_REQUIRED">AutoAnswerDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AutoAnswerDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableRecording" aria-label="EnableRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLERECORDING">EnableRecording</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableDtmfTone" aria-label="EnableDtmfTone" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEDTMFTONE">EnableDtmfTone</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarDnd" aria-label="Dnd" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DND">Dnd</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.ignorePauseForPreviewCalls" aria-label="Ignore agent break status for preview calls" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.IGNORE_AGENT_BREAK_STATUS_FOR_PREVIEW_CALLS">Ignore agent break status for preview calls</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container sip_webrtc md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SIP_WEBRTC">SIP_WEBRTC</div>\n            </div>\n            <form name="sip_webrtcForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPEXPIRES">SipExpires</label>\n                <input type="number" name="phoneBarExpires" ng-model="vm.agent.phoneBarExpires" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPEXPIRES"></span></div>\n                <div ng-messages="sip_webrtcForm[\'phoneBarExpires\'].$error" ng-show="sip_webrtcForm[\'phoneBarExpires\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPEXPIRES_REQUIRED">SipExpires field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.PERMISSIONS">PERMISSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container general_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL_PERMISSIONS">GENERAL_PERMISSIONS</div>\n            </div>\n            <form name="general_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.allowmessenger" aria-label="EnableMessenger" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEMESSENGER">EnableMessenger</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.messengerSoundNotification" aria-label="EnableMessengerSoundNotification" \n                ng-if="vm.agent.allowmessenger">\n                  <span translate="STAFF.MESSENGERSOUNDNOTIFICATION">MessengerSoundNotification</span></md-switch>\n            </md-input-container>\n            <md-input-container class="md-block">                \n                <md-switch ng-model="vm.agent.phoneBarPrefixRequired" aria-label="PrefixRequired" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.PREFIXREQUIRED">PrefixRequired</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.selectRecallMeCampaign" aria-label="Select_RecallMe_Campaign" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.SELECT_RECALLME_CAMPAIGN">Select_RecallMe_Campaign</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container download_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.DOWNLOAD_PERMISSIONS">DOWNLOAD_PERMISSIONS</div>\n            </div>\n            <form name="download_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadAttachments" aria-label="Attachments" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ATTACHMENTS">Attachments</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadOmnichannelInteractions" aria-label="Omnichannel_Interactions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.OMNICHANNEL_INTERACTIONS">Omnichannel_Interactions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadVoiceRecordings" aria-label="Voice_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.VOICE_RECORDINGS">Voice_Recordings</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERMISSIONS">PERMISSIONS</div>\n            </div>\n            <div ng-controller="AgentPermissionsController as vm_pc" ng-init="vm_pc.init(vm.agent, vm.crudPermissions)" class="agent-detail-form-container">\n              <md-list ng-repeat="father in vm_pc.navigation[0].children" ng-include="\'permission-nested.html\'" ng-if="vm_pc.agent.role !== \'admin\' && !father.hidden()"></md-list>\n              \x3c!-- Nested navigation template --\x3e\n              <script type="text/ng-template" id="permission-nested.html">\n                <md-list-item>\n        <md-icon md-font-icon="{{father.icon}}"></md-icon>\n        <p translate="{{father.translate}}">{{ father.title }}</p>\n        <md-switch class="md-secondary" ng-model="father.enabled" ng-change="vm_pc.onChange(father)" ng-init="father.enabled = vm_pc.agent.permissions.includes(father.id)" \n                  ng-disabled="!vm_pc.crudPermissions.canEdit"></md-switch>\n      </md-list-item>\n      <md-divider></md-divider>\n      <md-list>\n        <md-list-item ng-repeat="child in father.children" ng-if="child.id !== 201">\n          <md-icon ng-if="child.icon" md-font-icon="{{child.icon}}"></md-icon>\n          <p translate="{{child.translate}}">{{ child.title }}</p>\n          <md-switch ng-model="child.enabled" ng-change="vm_pc.onChange(father, child)" ng-init="child.enabled = vm_pc.agent.permissions.includes(child.id)"\n                    ng-disabled="!vm_pc.crudPermissions.canEdit"></md-switch>\n          </md-list-item>\n      </md-list>\n  <\/script>\n              \x3c!-- / Nested navigation template --\x3e\n              <span ng-if="vm_pc.agent.role === \'admin\'" class="md-headline" translate="STAFF.ALL_MODULES_AVAILABLE">All modules are already available.</span>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.CLIENT_LOGS">CLIENT-SIDE LOGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container client_logs md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CLIENT_LOGS">\n                CLIENT-SIDE LOGS\n              </div>\n            </div>\n            <ms-client-side-logging user="vm.agent" on-user-update="vm.refreshAgent()"></ms-client-side-logging>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/staff/views/teams/create/dialog.html",'<md-dialog class="team-dialog" aria-label="New Team">\n  <form name="teamForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.team.name" ng-required="true" autofocus>\n\n        <div ng-messages="teamForm[\'name\'].$error" ng-show="teamForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.team.description">\n\n        <div ng-messages="teamForm[\'description\'].$error" ng-show="teamForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTeam" ng-click="vm.saveTeam()" class="send-button md-accent md-raised" ng-disabled="teamForm.$invalid || teamForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTeam" ng-click="vm.addNewTeam()" class="send-button md-accent md-raised" ng-disabled="teamForm.$invalid" aria-label="ADD" translate="STAFF.ADD_TEAM" translate-attr-aria-label="STAFF.ADD_TEAM">\n          ADD TEAM\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTeam" ng-click="vm.deleteTeam($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",'<md-dialog class="team-dialog" aria-label="team" ng-init="vm.onInit()">\n  <form name="teamForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="STAFF.AGENTADD_TEAM">Add Agent to team</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/teams/teams.html",'<div id="teams" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.TEAMS">Teams</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTeams.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTeams =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-teams-count">\n          <span>{{vm.selectedTeams.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTeams()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTeams()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTeams" csv-label="true" filename="teams.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTeams($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TEAM TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTeams" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTeams">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'STAFF.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'STAFF.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.teams.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="team" md-select-id="id" ng-repeat="team in vm.teams.rows">\n                <td md-cell ng-if="team.userpic"><img class="avatar" alt="{{team.name}}" ng-src="api/users/{{team.id}}/avatar" /></td>\n                <td md-cell ng-if="!team.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{team.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="id ">{{team.id}}</td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="name ">{{team.name}}</td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="description ">{{team.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(team, $event    )" translate="STAFF.EDIT_TEAM">\n                          Edit Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(team, $event    )" translate="STAFF.AGENTADD_TEAM">\n                          AgentAdd Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(team, $event    )" translate="STAFF.DELETE_TEAM">\n                          Delete Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.teams.count}}" md-on-paginate="vm.getTeams" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TEAM TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TEAM BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-team-button" ng-click="vm.createOrEditTeam($event)" aria-label="add team" translate translate-attr-aria-label="STAFF.ADD_TEAM">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TEAM BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/telephones/create/dialog.html",'<md-dialog class="telephone-dialog" aria-label="New Telephone">\n  <form name="telephoneForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ACCOUNTNAME">Accountname</label>\n        <input type="text" name="fullname" ng-model="vm.telephone.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="telephoneForm[\'fullname\'].$error" ng-show="telephoneForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ACCOUNTNAME_REQUIRED">Accountname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.telephone.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newTelephone">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="telephoneForm[\'name\'].$error" ng-show="telephoneForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.telephone.email" ng-required="true">\n\n        <div ng-messages="telephoneForm[\'email\'].$error" ng-show="telephoneForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newTelephone">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.telephone.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="telephoneForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.newTelephone  && (vm.newTelephone)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="telephoneForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.telephone.description">\n\n        <div ng-messages="telephoneForm[\'description\'].$error" ng-show="telephoneForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newTelephone" class="md-block">\n        <md-switch ng-model="vm.telephone.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.telephone.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.telephone.internal" ng-required="true" ng-disabled="!vm.newTelephone">\n\n        <div ng-messages="telephoneForm[\'internal\'].$error" ng-show="telephoneForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newTelephone" class="md-block">\n        <md-switch ng-model="vm.telephone.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTelephone" ng-click="vm.saveTelephone()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid || telephoneForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTelephone" ng-click="vm.addNewTelephone()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid" aria-label="ADD" translate="STAFF.ADD_TELEPHONE" translate-attr-aria-label="STAFF.ADD_TELEPHONE">\n          ADD TELEPHONE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTelephone" ng-click="vm.deleteTelephone($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",'<md-dialog class="telephone-dialog" aria-label="{{vm.name}}">\n  <form name="telephoneForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.telephone.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="telephoneForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="telephoneForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="telephoneForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid || telephoneForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/telephones/edit/view.html",'<div id="staff-telephone" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-telephones-button md-icon-button" aria-label="Go to telephones" ng-click="vm.gotoTelephones()" translate translate-attr-aria-label="STAFF.GO_TO_TELEPHONES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="telephone-image" hide-xs>\n          <img ng-src="assets/images/business/telephones.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.telephone.id}}\n            <span ng-if="vm.telephone.name">{{vm.telephone.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.telephone.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.telephone, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_TELEPHONE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTelephone()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(accountForm.$invalid) || (generalForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="telephone-detail-form-container account md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.ACCOUNT">ACCOUNT</div>\n            </div>\n            <form name="accountForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ACCOUNTNAME">Accountname</label>\n                <input type="text" name="fullname" ng-model="vm.telephone.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'fullname\'].$error" ng-show="accountForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ACCOUNTNAME_REQUIRED">Accountname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.telephone.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="accountForm[\'name\'].$error" ng-show="accountForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.telephone.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'email\'].$error" ng-show="accountForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.telephone.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'description\'].$error" ng-show="accountForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.telephone.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'phone\'].$error" ng-show="accountForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.telephone.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'mobile\'].$error" ng-show="accountForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="telephone-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.telephone.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.telephone.internal" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.telephone.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TRANSPORT"></span></div>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.telephone.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.telephone.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input type="text" name="callerid" ng-model="vm.telephone.callerid" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.telephone.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.telephone.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.telephone.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.telephone.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ENCRYPTION">Encryption</label>\n                <md-select name="encryption" ng-model="vm.telephone.encryption" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ENCRYPTION"></span></div>\n                <div ng-messages="generalForm[\'encryption\'].$error" ng-show="generalForm[\'encryption\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ENCRYPTION_REQUIRED">Encryption field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/staff/views/telephones/telephones.html",'<div id="telephones" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.TELEPHONES">Telephones</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTelephones.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTelephones =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-telephones-count">\n          <span>{{vm.selectedTelephones.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTelephones()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTelephones()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTelephones" csv-label="true" filename="telephones.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTelephones($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TELEPHONE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTelephones" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTelephones">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.ACCOUNTNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.telephones.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="telephone" md-select-id="id" ng-repeat="telephone in vm.telephones.rows">\n                <td md-cell ng-if="telephone.userpic"><img class="avatar" alt="{{telephone.name}}" ng-src="api/users/{{telephone.id}}/avatar" /></td>\n                <td md-cell ng-if="!telephone.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{telephone.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="fullname font-weight-600">{{telephone.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="name ">{{telephone.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="email ">{{telephone.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="internal ">{{telephone.internal}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(telephone, $event    )" translate="STAFF.EDIT_TELEPHONE">\n                          Edit Telephone\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(telephone, $event    )" translate="STAFF.DELETE_TELEPHONE">\n                          Delete Telephone\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.telephones.count}}" md-on-paginate="vm.getTelephones" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TELEPHONE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TELEPHONE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-telephone-button" ng-click="vm.createOrEditTelephone($event)" aria-label="add telephone" translate translate-attr-aria-label="STAFF.ADD_TELEPHONE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TELEPHONE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/userProfiles/create/dialog.html",'<md-dialog class="userProfile-dialog" aria-label="New UserProfile">\n  <form name="userProfileForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus ng-disabled="!vm.newUserProfile">\n\n        <div ng-messages="userProfileForm[\'name\'].$error" ng-show="userProfileForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.userProfile.description">\n\n        <div ng-messages="userProfileForm[\'description\'].$error" ng-show="userProfileForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n        <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required>\n\n          <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="userProfileForm[\'crudPermissions\'].$error" ng-show="userProfileForm[\'crudPermissions\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n        <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newUserProfile" ng-click="vm.saveUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid || userProfileForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newUserProfile" ng-click="vm.addNewUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid" aria-label="ADD" translate="STAFF.ADD_USERPROFILE" translate-attr-aria-label="STAFF.ADD_USERPROFILE">\n          ADD USERPROFILE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newUserProfile" ng-click="vm.deleteUserProfile($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/clone/clone.html",'<md-dialog class="userProfile-dialog" aria-label="Clone UserProfile">\n  <form name="userProfileForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus ng-disabled="!vm.newUserProfile">\n\n        <div ng-messages="userProfileForm[\'name\'].$error" ng-show="userProfileForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.userProfile.description">\n\n        <div ng-messages="userProfileForm[\'description\'].$error" ng-show="userProfileForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n        <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required>\n\n          <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="userProfileForm[\'crudPermissions\'].$error" ng-show="userProfileForm[\'crudPermissions\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n        <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid" aria-label="CLONE" translate="STAFF.CLONE_USERPROFILE" translate-attr-aria-label="STAFF.CLONE_USERPROFILE">\n        CLONE USERPROFILE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",'<md-dialog class="userProfile-dialog" aria-label="userProfile">\n  <form name="userProfileForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2>{{vm.title}}</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog($event)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div layout="column" class="padding-bottom-10">\n        <div layout="row" class="padding-bottom-10">\n          <md-input-container flex class="no-margin">\n            <label translate="STAFF.SECTIONS">Sections</label>\n            <md-select name="sections" ng-model="vm.selectedSection" placeholder="{{\'STAFF.PERMISSIONS_SELECT_SECTION\' | translate}}" ng-change="vm.onChangeSection()" required>\n              <md-option ng-value="subsection" ng-repeat="subsection in vm.subsections" ng-selected="{{vm.subsections.length === 1 ? \'true\' : \'false\'}}">{{subsection.translate | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n          <div layout="row" ng-show="vm.selectedSection" class="margin-left-10">\n            <md-button ng-switch="vm.selectedSection.enabled" class="md-icon-button md-fab md-mini size-8 padding-10" ng-class="vm.selectedSection.enabled ? \'blue-500-bg\' : \'grey-A400-bg\'" ng-click="vm.onChangeVisibility()" aria-label="Visibility">\n              <md-icon ng-switch-when="true" md-font-icon="icon-eye" aria-label="Visible section">\n                <md-tooltip>{{\'STAFF.PERMISSIONS_SECTION_HIDE\' | translate}}</md-tooltip>\n              </md-icon>\n              <md-icon ng-switch-when="false" md-font-icon="icon-eye-off" aria-label="Hidden section">\n                <md-tooltip>{{\'STAFF.PERMISSIONS_SECTION_SHOW\' | translate}}</md-tooltip>\n              </md-icon>\n            </md-button>\n            <div>\n              <md-button class="md-icon-button md-fab md-mini size-8 green-A700-bg no-margin" ng-disabled="true">\n                <md-icon md-font-icon="icon-monitor" class="md-background-fg" aria-label="Read permission">\n                  <md-tooltip>{{\'STAFF.READ_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n              <md-button class="md-icon-button md-fab md-mini size-8 no-margin" ng-class="vm.selectedSection.allowEdit ? \'green-A700-bg\' : \'grey-A400-bg\'" ng-click="vm.setPermission(\'edit\')">\n                <md-icon md-font-icon="icon-pencil" aria-label="Edit permission">\n                  <md-tooltip>{{\'STAFF.EDIT_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n              <md-button class="md-icon-button md-fab md-mini size-8 no-margin" ng-class="vm.selectedSection.allowDelete ? \'green-A700-bg\' : \'grey-A400-bg\'" ng-click="vm.setPermission(\'delete\')">\n                <md-icon md-font-icon="icon-delete" aria-label="Delete permission">\n                  <md-tooltip>{{\'STAFF.DELETE_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n            </div>\n          </div>\n        </div>\n        <div layout="row" ng-show="vm.selectedSection" class="margin-left-10" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association">\n          <md-switch ng-model="vm.selectedSection.autoAssociation" class="no-margin padding-right-10" aria-label="Auto association" ng-change="vm.onChangeAutoAssociation()">\n          </md-switch>\n          <p class="no-margin font-size-12 line-height-30">{{\'STAFF.PERMISSIONS_AUTO_ASSOCIATION_INFO\' | translate}}</p>\n        </div>\n        <div layout="row" ng-show="vm.selectedSection && vm.selectedSection.title === \'Reports\' && !vm.selectedSection.autoAssociation" class="margin-bottom-10 margin-top-30" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association">\n          <md-input-container flex class="no-margin">\n            <label translate="STAFF.REPORT_TYPE">Report Type</label>\n            <md-select name="type" ng-model="vm.selectedSection.reportType" placeholder="{{\'STAFF.PERMISSIONS_SELECT_REPORT_TYPE\' | translate}}" ng-change="vm.onChangeReportType()" required>\n              <md-option ng-value="\'default\'">Default</md-option>\n              <md-option ng-value="\'custom\'">Custom</md-option>\n            </md-select>\n          </md-input-container>\n        </div>\n        <div ng-show="vm.selectedSection && vm.selectedSection.title === \'Dashboards\'" class="user-profile-section-help margin-bottom-10 margin-top-20">\n          <md-icon md-font-icon="icon-help" aria-label="Dashboards help"></md-icon>\n          <span class="no-margin font-size-12 line-height-30" translate="STAFF.HELP.CUSTOM_DASHBOARDS_PERMISSIONS"></span>\n        </div>\n      </div>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association" ng-hide="vm.selectedSection.autoAssociation"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center">\n      <div>\n        <md-icon md-font-icon="icon-information-outline" aria-label="Delete permission"></md-icon>\n        <span class="no-margin font-size-12 line-height-30" translate="STAFF.HELP.SAVE_PERMISSIONS"></span>\n      </div>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveSection()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/view.html",'<div id="staff-userProfile" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-userProfiles-button md-icon-button" aria-label="Go to userProfiles" ng-click="vm.gotoUserProfiles()" translate translate-attr-aria-label="STAFF.GO_TO_USERPROFILES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="userProfile-image" hide-xs>\n          <img ng-src="assets/images/business/userProfiles.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.userProfile.id}}\n            <span ng-if="vm.userProfile.name">{{vm.userProfile.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.userProfile.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.userProfile, $event)" class="md-fab md-amber-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="STAFF.CLONE_USERPROFILE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveUserProfile()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (modulesForm.$invalid) || (download_permissionsForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.userProfile.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n                <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n                  <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n                  <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'crudPermissions\'].$error" ng-show="generalForm[\'crudPermissions\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.PERMISSIONS">PERMISSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container modules md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.MODULES">MODULES</div>\n            </div>\n            <div ng-controller="UserProfilePermissionsController as vm_pc" ng-init="vm_pc.init(vm.userProfile, vm.license)" class="userProfile-detail-form-container">\n              <md-grid-list flex md-cols-gt-xs="2" md-cols-gt-sm="2" md-cols-gt-md="4" md-cols-gt-lg="6" md-row-height-gt-xs="2:1" md-row-height-gt-sm="3:1" md-row-height-gt-md="3:1" gt-xs-gutter="4px" gt-sm-gutter="4px" gt-md-gutter="16px" gt-lg-gutter="16px">\n                <md-grid-tile ng-repeat="father in vm_pc.modules" ng-if="vm_pc.userProfile.role !== \'admin\' && !father.permissions.hidden" md-colspan="2">\n                  <md-card flex-xs flex-gt-xs="90" layout="column" no-padding no-margin>\n                    <md-card-header>\n                      <md-card-avatar>\n                        <md-icon class="md-avatar-icon auto-size" md-font-icon="{{father.icon}}" ng-class="{ true: father.status.color }[true]">\n                          <md-tooltip>{{ father.status.info }}</md-tooltip>\n                        </md-icon>\n                      </md-card-avatar>\n                      <md-card-header-text layout-align="center start">\n                        <span class="md-title" translate="{{father.translate}}">{{ father.title }}</span>\n                      </md-card-header-text>\n                      <md-card-actions class="no-margin" layout="row" ng-init="vm_pc.checkSectionResources(father)" ng-if="father.status.tag != \'unlicensed\'">\n                        <md-switch class="auto-height no-margin" ng-model="father.allResourcesEnabled" ng-change="vm_pc.onChangeEnableAllResources(father)" aria-label="Enable all"></md-switch>\n                        <md-button class="md-mini auto-width" aria-label="Manage" ng-click="vm_pc.manageResources(father)" ng-hide="father.permissions && !father.permissions.association">\n                          <md-tooltip>{{\'STAFF.PERMISSIONS_MANAGE\' | translate}}\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-cog"></md-icon>\n                        </md-button>\n                      </md-card-actions>\n                      <md-card-header-text ng-if="father.status.tag === \'unlicensed\'" layout-align="center end">\n                        <span class="md-subhead red-A700-fg">{{ father.status.name }}</span>\n                      </md-card-header-text>\n                    </md-card-header>\n                  </md-card>\n                </md-grid-tile>\n              </md-grid-list>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.DOWNLOADS">DOWNLOADS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container download_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.DOWNLOAD_PERMISSIONS">DOWNLOAD_PERMISSIONS</div>\n            </div>\n            <form name="download_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadAttachments" aria-label="Attachments" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ATTACHMENTS">Attachments</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadCallySquareRecordings" aria-label="CallySquare_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CALLYSQUARE_RECORDINGS">CallySquare_Recordings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadContactManagerLists" aria-label="Contact_Manager_Lists" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CONTACT_MANAGER_LISTS">Contact_Manager_Lists</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadJscriptySessions" aria-label="Jscripty_Sessions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.JSCRIPTY_SESSIONS">Jscripty_Sessions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadOmnichannelInteractions" aria-label="Omnichannel_Interactions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.OMNICHANNEL_INTERACTIONS">Omnichannel_Interactions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadScreenRecordings" aria-label="Screen_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.SCREEN_RECORDINGS">Screen_Recordings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadVoiceRecordings" aria-label="Voice_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.VOICE_RECORDINGS">Voice_Recordings</span></md-switch>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/staff/views/userProfiles/userProfiles.html",'<div id="userProfiles" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.USERPROFILES">UserProfiles</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedUserProfiles.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedUserProfiles =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-userProfiles-count">\n          <span>{{vm.selectedUserProfiles.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllUserProfiles()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectUserProfiles()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedUserProfiles" csv-label="true" filename="userProfiles.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedUserProfiles($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- USERPROFILE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedUserProfiles" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getUserProfiles">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'STAFF.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'STAFF.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="crudPermissions">{{ \'STAFF.CRUDPERMISSIONS\' | translate }}</th>\n                <th md-column md-order-by="privacyEnabled">{{ \'STAFF.MASK_SENSITIVE_DATA\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.userProfiles.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="userProfile" md-select-id="id" ng-repeat="userProfile in vm.userProfiles.rows">\n                <td md-cell ng-if="userProfile.userpic"><img class="avatar" alt="{{userProfile.name}}" ng-src="api/users/{{userProfile.id}}/avatar" /></td>\n                <td md-cell ng-if="!userProfile.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{userProfile.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="id ">{{userProfile.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="name ">{{userProfile.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="description ">{{userProfile.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="crudPermissions ">{{userProfile.selectedcrudPermissions}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="privacyEnabled ">\n                  <md-icon md-colors="{color: {{userProfile.privacyEnabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{userProfile.privacyEnabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(userProfile, $event    )" translate="STAFF.EDIT_USERPROFILE">\n                          Edit UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(userProfile, $event    )" translate="STAFF.CLONE_USERPROFILE">\n                          clone UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' && user.id !== vm.currentUser.id">\n\n                        <md-button ng-click="vm.deleteconfirm(userProfile, $event    )" translate="STAFF.DELETE_USERPROFILE">\n                          Delete UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.userProfiles.count}}" md-on-paginate="vm.getUserProfiles" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / USERPROFILE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USERPROFILE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-userProfile-button" ng-click="vm.createOrEditUserProfile($event)" aria-label="add userProfile" translate translate-attr-aria-label="STAFF.ADD_USERPROFILE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD USERPROFILE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/users/create/dialog.html",'<md-dialog class="user-dialog" aria-label="New User">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ROLE">Role</label>\n        <md-select name="role" ng-model="vm.user.role" autofocus required ng-disabled="!vm.newUser">\n          <md-option ng-value="\'admin\'">Admin</md-option>\n          <md-option ng-value="\'user\'">User</md-option>\n        </md-select>\n        <div ng-messages="userForm[\'role\'].$error" ng-show="userForm[\'role\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ROLE_REQUIRED">Role field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.user.role === \'user\'" class="md-block">\n        <label translate="STAFF.USERPROFILE">UserProfile</label>\n        <md-select name="userProfileId" ng-model="vm.user.userProfileId" required>\n          <md-option ng-value="userProfileId.id" ng-repeat="userProfileId in vm.userProfiles" ng-disabled="userProfileId.canSelect === false">{{ userProfileId.name }}</md-option>\n        </md-select>\n        <div ng-messages="userForm[\'userProfileId\'].$error" ng-show="userForm[\'userProfileId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERPROFILE_REQUIRED">UserProfile field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.user.fullname" ng-required="true">\n\n        <div ng-messages="userForm[\'fullname\'].$error" ng-show="userForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.user.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newUser">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="userForm[\'name\'].$error" ng-show="userForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.user.email" ng-required="true">\n\n        <div ng-messages="userForm[\'email\'].$error" ng-show="userForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newUser">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.user.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="userForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newUser  && (vm.newUser)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="userForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.user.description">\n\n        <div ng-messages="userForm[\'description\'].$error" ng-show="userForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newUser" class="md-block">\n        <md-switch ng-model="vm.user.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.user.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.user.internal" ng-required="true" ng-disabled="!vm.newUser">\n\n        <div ng-messages="userForm[\'internal\'].$error" ng-show="userForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.user.userSetting">\n        <ms-client-side-logging user="vm.user"></ms-client-side-logging>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newUser" ng-click="vm.saveUser()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid || userForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newUser" ng-click="vm.addNewUser()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid" aria-label="ADD" translate="STAFF.ADD_USER" translate-attr-aria-label="STAFF.ADD_USER">\n          ADD USER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newUser" ng-click="vm.deleteUser($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.MANAGE_API_KEY\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-card layout-fill layout-padding>\n      <textarea class="api-key-area" ng-model="vm.user.apiKey" rows="6" disabled></textarea>\n    </md-card>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.generateApiKey()" class="send-button md-accent md-raised" aria-label="Generate" translate="{{ vm.user.apiKey === \'N/A\' ? \'STAFF.GENERATE\' : \'STAFF.REGENERATE\' }}" translate-attr-aria-label="STAFF.GENERATE">\n          Generate\n        </md-button>\n        <md-button type="submit" ng-click="vm.removeApiKey()" class="send-button md-accent md-raised" aria-label="Remove" translate="STAFF.REMOVE" translate-attr-aria-label="STAFF.DELETE">\n          Delete\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/changepassword/changepassword.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.user.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="userForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="userForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="userForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid || userForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/view.html",'<div id="staff-user" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-users-button md-icon-button" aria-label="Go to users" ng-click="vm.gotoUsers()" translate translate-attr-aria-label="STAFF.GO_TO_USERS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="user-image" hide-xs>\n          <img ng-src="assets/images/business/users.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.user.id}}\n            <span ng-if="vm.user.name">{{vm.user.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.user.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.apikeymanagerdialog(vm.user, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="apikeymanager">\n        <md-tooltip><span translate="STAFF.APIKEYMANAGER_USER"></span></md-tooltip>\n        <md-icon md-font-icon="fab fa-hubspot"></md-icon>\n      </md-button>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.user, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_USER"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveUser()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(personal_infoForm.$invalid) || (security_suiteForm.$invalid) || (change_avatarForm.$invalid) || (generalForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERSONAL_INFO">PERSONAL_INFO</div>\n            </div>\n            <form name="personal_infoForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ROLE">Role</label>\n                <md-select name="role" ng-model="vm.user.role" autofocus required disabled>\n                  <md-option ng-value="\'admin\'">Admin</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'role\'].$error" ng-show="personal_infoForm[\'role\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ROLE_REQUIRED">Role field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.role === \'user\'" class="md-block">\n                <label translate="STAFF.USERPROFILE">UserProfile</label>\n                <md-select name="userProfileId" ng-model="vm.user.userProfileId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="userProfileId.id" ng-repeat="userProfileId in vm.userProfiles" ng-disabled="userProfileId.canSelect === false">{{ userProfileId.name }}</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'userProfileId\'].$error" ng-show="personal_infoForm[\'userProfileId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERPROFILE_REQUIRED">UserProfile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.FULLNAME">Fullname</label>\n                <input type="text" name="fullname" ng-model="vm.user.fullname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'fullname\'].$error" ng-show="personal_infoForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.user.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="personal_infoForm[\'name\'].$error" ng-show="personal_infoForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.user.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'email\'].$error" ng-show="personal_infoForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.user.phone" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'phone\'].$error" ng-show="personal_infoForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.user.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'mobile\'].$error" ng-show="personal_infoForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.user.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'description\'].$error" ng-show="personal_infoForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="user-detail-form-container security_suite md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SECURITY_SUITE">SECURITY_SUITE</div>\n            </div>\n            <form name="security_suiteForm" novalidate>\n              <md-input-container ng-if="vm.user.passwordResetAt != null" class="md-block">\n                <label translate="STAFF.LAST_PASSWORD_RESET_AT">Last_Password_Reset_At</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.user.passwordResetAt" autofocus disabled>\n                <div class="hint"><span translate="STAFF.HELP.LAST_PASSWORD_RESET_AT"></span></div>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.LAST_PASSWORD_RESET_AT_REQUIRED">Last_Password_Reset_At field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.passwordResetAt == null" class="md-block">\n                <label translate="STAFF.NO_PASSWORD_CHANGE">No_Password_Change</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.user.passwordResetAt" disabled>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NO_PASSWORD_CHANGE_REQUIRED">No_Password_Change field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.APIKEY">ApiKey</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-apiKey" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: \'API Key copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-apiKey" name="apiKey" ng-model="vm.user.apiKey" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="STAFF.HELP.APIKEY"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.id != vm.currentUser.id && vm.currentUser.role == \'admin\'" class="md-block">\n                <md-switch ng-model="vm.user.disabled" aria-label="Disabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DISABLED">Disabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.DISABLED"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.id != vm.currentUser.id && vm.currentUser.role == \'admin\' && vm.user.disabled == 0" class="md-block">\n                <md-switch ng-model="vm.user.blocked" aria-label="Blocked" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.BLOCKED">Blocked</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.BLOCKED"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="user-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTHENTICATION">AUTHENTICATION</div>\n            </div>\n            <form name="authenticationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.user.adSsoEnabled" aria-label="AD_SSO_Enabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AD_SSO_ENABLED">AD_SSO_Enabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.AD_SSO_ENABLED"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="user-detail-form-container change_avatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CHANGE_AVATAR">CHANGE_AVATAR</div>\n            </div>\n            <div ng-controller="Userchange_avatarController as vm_ca" ng-init="vm_ca.init(vm.user, vm.crudPermissions)" class="user-detail-form-container md-background-bg md-whiteframe-1dp">\n              <div id="user-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="change_avatarimage in vm_ca.user.images" ng-switch="change_avatarimage.type">\n                    <div class="user-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{change_avatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="change_avatarimage.file">\n                    </div>\n                    <div class="user-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{change_avatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n          <div class="user-detail-form-container internal-chat md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.INTERNAL_MESSENGER">INTERNAL_MESSENGER</div>\n            </div>\n            <form name="internalChatForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.user.messengerSoundNotification" \n                aria-label="messengerSoundNotification" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.MESSENGERSOUNDNOTIFICATION">MESSENGERSOUNDNOTIFICATION</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MESSENGERSOUNDNOTIFICATION"></span></div>\n              </md-input-container>\n            </form>\n          </div>          \n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.user.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.user.internal" ng-required="true" autofocus disabled>\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.user.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.user.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.user.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.user.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.user.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.user.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.user.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.CLIENT_LOGS">CLIENT-SIDE LOGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container client_logs md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CLIENT_LOGS">\n                CLIENT-SIDE LOGS\n              </div>\n            </div>\n            <ms-client-side-logging user="vm.user" on-user-update="vm.refreshUser()"></ms-client-side-logging>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/staff/views/users/users.html",'<div id="users" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.USERS">Users</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedUsers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedUsers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-users-count">\n          <span>{{vm.selectedUsers.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllUsers()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectUsers()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedUsers" csv-label="true" filename="users.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- USER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedUsers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getUsers">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="role">{{ \'STAFF.ROLE\' | translate }}</th>\n                <th md-column md-order-by="userProfileId">{{ \'STAFF.USERPROFILE\' | translate }}</th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'STAFF.PHONE\' | translate }}</th>\n                <th md-column md-order-by="mobile">{{ \'STAFF.MOBILE\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column md-order-by="disabled">{{ \'STAFF.DISABLED\' | translate }}</th>\n                <th md-column md-order-by="blocked">{{ \'STAFF.BLOCKED\' | translate }}</th>\n                <th md-column>{{ \'STAFF.CLIENT_LOGS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.users.rows.length">\n                <td md-cell colspan="11">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="user" md-select-id="id" ng-repeat="user in vm.users.rows">\n                <td md-cell ng-if="user.userpic"><img class="avatar" alt="{{user.name}}" ng-src="api/users/{{user.id}}/avatar" /></td>\n                <td md-cell ng-if="!user.userpic"><img class="avatar" alt="{{user.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="role ">{{ vm.arrayrole[user.role].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="userProfileId font-weight-600">{{ (vm.userProfiles | filter : {\'id\':user.userProfileId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="fullname font-weight-600">{{user.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="name ">{{user.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="email ">{{user.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="phone ">{{user.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="mobile ">{{user.mobile}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="internal ">{{user.internal}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="disabled ">\n                  <md-icon md-colors="{color: {{user.disabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{user.disabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="blocked ">\n                  <md-icon md-colors="{color: {{user.blocked ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{user.blocked ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditAgent($event, user)" md-cell class="client-side-logging">\n                  <ms-client-side-logging-icon user="user"></ms-client-side-logging-icon>\n                </td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(user, $event    )" translate="STAFF.EDIT_USER">\n                          Edit User\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' && user.id !== vm.currentUser.id">\n                        <md-button ng-click="vm.deleteconfirm(user, $event    )" translate="STAFF.DELETE_USER">\n                          Delete User\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.users.count}}" md-on-paginate="vm.getUsers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / USER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-user-button" ng-click="vm.createOrEditUser($event)" aria-label="add user" translate translate-attr-aria-label="STAFF.ADD_USER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD USER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/cannedAnswers/cannedAnswers.html",'<div id="cannedAnswers" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CANNEDANSWERS">CannedAnswers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCannedAnswers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCannedAnswers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-cannedAnswers-count">\n          <span>{{vm.selectedCannedAnswers.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCannedAnswers()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCannedAnswers()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCannedAnswers" csv-label="true" filename="cannedAnswers.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CANNEDANSWER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCannedAnswers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCannedAnswers">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'TOOLS.KEY\' | translate }}</th>\n                <th md-column md-order-by="value">{{ \'TOOLS.VALUE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.cannedAnswers.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="cannedAnswer" md-select-id="id" ng-repeat="cannedAnswer in vm.cannedAnswers.rows">\n                <td md-cell ng-if="cannedAnswer.userpic"><img class="avatar" alt="{{cannedAnswer.name}}" ng-src="api/users/{{cannedAnswer.id}}/avatar" /></td>\n                <td md-cell ng-if="!cannedAnswer.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{cannedAnswer.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="id ">{{cannedAnswer.id}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="key ">{{cannedAnswer.key}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="value ">{{cannedAnswer.value}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="description ">{{cannedAnswer.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(cannedAnswer, $event    )" translate="TOOLS.EDIT_CANNEDANSWER">\n                          Edit CannedAnswer\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(cannedAnswer, $event    )" translate="TOOLS.DELETE_CANNEDANSWER">\n                          Delete CannedAnswer\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.cannedAnswers.count}}" md-on-paginate="vm.getCannedAnswers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CANNEDANSWER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CANNEDANSWER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-cannedAnswer-button" ng-click="vm.createOrEditCannedAnswer($event)" aria-label="add cannedAnswer" translate translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CANNEDANSWER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/cannedAnswers/create/dialog.html",'<md-dialog class="cannedAnswer-dialog" aria-label="New CannedAnswer">\n  <form name="cannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.cannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="cannedAnswerForm[\'key\'].$error" ng-show="cannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 255}\'>Key must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.cannedAnswer.value" required></textarea>\n\n        <div ng-messages="cannedAnswerForm[\'value\'].$error" ng-show="cannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.cannedAnswer.description">\n\n        <div ng-messages="cannedAnswerForm[\'description\'].$error" ng-show="cannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCannedAnswer" ng-click="vm.saveCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="cannedAnswerForm.$invalid || cannedAnswerForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCannedAnswer" ng-click="vm.addNewCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="cannedAnswerForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CANNEDANSWER" translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER">\n          ADD CANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCannedAnswer" ng-click="vm.deleteCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/contact_item_types/contact_item_types.html",'<div id="contact_item_types" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CONTACTITEMTYPE">ContactItemType</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContactItemType.length > 0" class="selected-bar header animate-slide-down md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedContactItemType =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-contact_item_types-count">\n          <span>{{vm.selectedContactItemType.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContactItemType()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContactItemType()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContactItemType" csv-label="true" filename="contact_item_types.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedContactItemType($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable" ms-scroll>\n\n\n      \x3c!-- CONTACTITEMTYPE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedContactItemType" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContactItemType">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="OrderBy">{{ \'TOOLS.ORDER_BY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.contact_item_types.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="contactItemType" md-select-id="id" ng-repeat="contactItemType in vm.contact_item_types.rows">\n                <td md-cell ng-if="contactItemType.userpic"><img class="avatar" alt="{{contactItemType.name}}" ng-src="api/users/{{contactItemType.id}}/avatar" /></td>\n                <td md-cell ng-if="!contactItemType.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{contactItemType.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="id ">{{contactItemType.id}}</td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="name ">{{contactItemType.name}}</td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="OrderBy ">{{contactItemType.OrderBy}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(contactItemType, $event    )" translate="TOOLS.EDIT_CONTACTITEMTYPE">\n                          Edit ContactItemType\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(contactItemType, $event    )" translate="TOOLS.DELETE_CONTACTITEMTYPE">\n                          Delete ContactItemType\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contact_item_types.count}}" md-on-paginate="vm.getContactItemType" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CONTACTITEMTYPE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CONTACTITEMTYPE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-contactItemType-button" ng-click="vm.createOrEditContactItemType($event)" aria-label="add contactItemType" translate translate-attr-aria-label="TOOLS.ADD_CONTACTITEMTYPE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CONTACTITEMTYPE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/contact_item_types/create/dialog.html",'<md-dialog class="contactItemType-dialog" aria-label="New ContactItemType">\n  <form name="contactItemTypeForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.contactItemType.name" ng-required="true" autofocus>\n\n        <div ng-messages="contactItemTypeForm[\'name\'].$error" ng-show="contactItemTypeForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.ORDER_BY">Order_by</label>\n        <input type="integer" name="OrderBy" ng-model="vm.contactItemType.OrderBy" ng-required="true">\n\n        <div ng-messages="contactItemTypeForm[\'OrderBy\'].$error" ng-show="contactItemTypeForm[\'OrderBy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ORDER_BY_REQUIRED">Order_by field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.contactItemType.rgbBackgroundColor" label="{{\'TOOLS.RGBBACKGROUNDCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newContactItemType" ng-click="vm.saveContactItemType()" class="send-button md-accent md-raised" ng-disabled="contactItemTypeForm.$invalid || contactItemTypeForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newContactItemType" ng-click="vm.addNewContactItemType()" class="send-button md-accent md-raised" ng-disabled="contactItemTypeForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CONTACTITEMTYPE" translate-attr-aria-label="TOOLS.ADD_CONTACTITEMTYPE">\n          ADD CONTACTITEMTYPE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContactItemType" ng-click="vm.deleteContactItemType($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/create/dialog.html",'<md-dialog class="customDashboard-dialog" aria-label="New CustomDashboard">\n  <form name="customDashboardForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus>\n\n        <div ng-messages="customDashboardForm[\'name\'].$error" ng-show="customDashboardForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.customDashboard.description">\n\n        <div ng-messages="customDashboardForm[\'description\'].$error" ng-show="customDashboardForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomDashboard" ng-click="vm.saveCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid || customDashboardForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomDashboard" ng-click="vm.addNewCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CUSTOMDASHBOARD" translate-attr-aria-label="TOOLS.ADD_CUSTOMDASHBOARD">\n          ADD CUSTOMDASHBOARD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomDashboard" ng-click="vm.deleteCustomDashboard($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/customDashboards.html",'<div id="customDashboards" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CUSTOMDASHBOARDS">CustomDashboards</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCustomDashboards.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCustomDashboards =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-customDashboards-count">\n          <span>{{vm.selectedCustomDashboards.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCustomDashboards()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCustomDashboards()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCustomDashboards" csv-label="true" filename="customDashboards.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCustomDashboards($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CUSTOMDASHBOARD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCustomDashboards" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCustomDashboards">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.customDashboards.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="customDashboard" md-select-id="id" ng-repeat="customDashboard in vm.customDashboards.rows">\n                <td md-cell ng-if="customDashboard.userpic"><img class="avatar" alt="{{customDashboard.name}}" ng-src="api/users/{{customDashboard.id}}/avatar" /></td>\n                <td md-cell ng-if="!customDashboard.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{customDashboard.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="id ">{{customDashboard.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="name ">{{customDashboard.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="description ">{{customDashboard.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(customDashboard, $event    )" translate="TOOLS.EDIT_CUSTOMDASHBOARD">\n                          Edit CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(customDashboard, $event    )" translate="TOOLS.CLONE_CUSTOMDASHBOARD">\n                          clone CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotodashboardgoto(customDashboard, $event    )" translate="TOOLS.GOTODASHBOARD_CUSTOMDASHBOARD">\n                          goToDashboard CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(customDashboard, $event    )" translate="TOOLS.DELETE_CUSTOMDASHBOARD">\n                          Delete CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.customDashboards.count}}" md-on-paginate="vm.getCustomDashboards" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CUSTOMDASHBOARD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CUSTOMDASHBOARD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-customDashboard-button" ng-click="vm.createOrEditCustomDashboard($event)" aria-label="add customDashboard" translate translate-attr-aria-label="TOOLS.ADD_CUSTOMDASHBOARD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CUSTOMDASHBOARD BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/customDashboards/edit/clone/clone.html",'<md-dialog class="customDashboard-dialog" aria-label="Clone CustomDashboard">\n  <form name="customDashboardForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus>\n\n        <div ng-messages="customDashboardForm[\'name\'].$error" ng-show="customDashboardForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid" aria-label="CLONE" translate="TOOLS.CLONE_CUSTOMDASHBOARD" translate-attr-aria-label="TOOLS.CLONE_CUSTOMDASHBOARD">\n        CLONE CUSTOMDASHBOARD\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",'<md-dialog class="dashboarditem-dialog" aria-label="New DashboardItem">\n  <form name="dashboarditemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.dashboarditem.type" ng-change="vm.onTypeChange()" autofocus ng-disabled="!vm.newDashboardItem">\n\n          <md-option ng-value="\'counter\'"> {{ \'TOOLS.COUNTER\' | translate }} </md-option>\n\n          <md-option ng-value="\'multibar-chart\'"> {{ \'TOOLS.MULTIBARCHART\' | translate }} </md-option>\n\n          <md-option ng-value="\'pie-chart\'"> {{ \'TOOLS.PIECHART\' | translate }} </md-option>\n\n          <md-option ng-value="\'web-report\'"> {{ \'TOOLS.WEBREPORT\' | translate }} </md-option>\n\n          <md-option ng-value="\'iframe\'"> {{ \'TOOLS.IFRAME\' | translate }} </md-option>\n\n          <md-option ng-value="\'clock\'"> {{ \'TOOLS.CLOCK\' | translate }} </md-option>\n\n          <md-option ng-value="\'custom\'"> {{ \'TOOLS.CUSTOMTYPE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'type\'].$error" ng-show="dashboarditemForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\',\'counter\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.CHANNEL">Channel</label>\n        <md-select name="attrChannel" ng-model="vm.dashboarditem.attrChannel" required>\n\n          <md-option ng-value="\'chat\'"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n\n          <md-option ng-value="\'mail\'"> {{ \'TOOLS.EMAIL\' | translate }} </md-option>\n\n          <md-option ng-value="\'sms\'"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n\n          <md-option ng-value="\'openchannel\'"> {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n\n          <md-option ng-value="\'fax\'"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n\n          <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n\n          <md-option ng-value="\'whatsapp\'"> {{ \'TOOLS.WHATSAPP\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrChannel\'].$error" ng-show="dashboarditemForm[\'attrChannel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="![\'web-report\', \'iframe\',\'clock\', \'custom\'].includes(vm.dashboarditem.type)">\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'mail\'" class="md-block">\n          <label translate="TOOLS.FILTEREMAILACCOUNTS">FilterEmailAccounts</label>\n          <md-select name="attrEmailAccounts" ng-model="vm.dashboarditem.attrEmailAccounts" multiple>\n            <md-option ng-value="attrEmailAccounts.id" ng-repeat="attrEmailAccounts in vm.mailAccount" ng-disabled="attrEmailAccounts.canSelect === false">{{ attrEmailAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrEmailAccounts\'].$error" ng-show="dashboarditemForm[\'attrEmailAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTEREMAILACCOUNTS_REQUIRED">FilterEmailAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'fax\'" class="md-block">\n          <label translate="TOOLS.FILTERFAXACCOUNTS">FilterFaxAccounts</label>\n          <md-select name="attrFaxAccounts" ng-model="vm.dashboarditem.attrFaxAccounts" multiple>\n            <md-option ng-value="attrFaxAccounts.id" ng-repeat="attrFaxAccounts in vm.faxAccount" ng-disabled="attrFaxAccounts.canSelect === false">{{ attrFaxAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrFaxAccounts\'].$error" ng-show="dashboarditemForm[\'attrFaxAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERFAXACCOUNTS_REQUIRED">FilterFaxAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'sms\'" class="md-block">\n          <label translate="TOOLS.FILTERSMSACCOUNTS">FilterSmsAccounts</label>\n          <md-select name="attrSmsAccounts" ng-model="vm.dashboarditem.attrSmsAccounts" multiple>\n            <md-option ng-value="attrSmsAccounts.id" ng-repeat="attrSmsAccounts in vm.smsAccount" ng-disabled="attrSmsAccounts.canSelect === false">{{ attrSmsAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrSmsAccounts\'].$error" ng-show="dashboarditemForm[\'attrSmsAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERSMSACCOUNTS_REQUIRED">FilterSmsAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'openchannel\'" class="md-block">\n          <label translate="TOOLS.FILTEROPENCHANNELACCOUNTS">FilterOpenchannelAccounts</label>\n          <md-select name="attrOpenchannelAccounts" ng-model="vm.dashboarditem.attrOpenchannelAccounts" multiple>\n            <md-option ng-value="attrOpenchannelAccounts.id" ng-repeat="attrOpenchannelAccounts in vm.openchannelAccount" ng-disabled="attrOpenchannelAccounts.canSelect === false">{{ attrOpenchannelAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrOpenchannelAccounts\'].$error" ng-show="dashboarditemForm[\'attrOpenchannelAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTEROPENCHANNELACCOUNTS_REQUIRED">FilterOpenchannelAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'whatsapp\'" class="md-block">\n          <label translate="TOOLS.FILTERWHATSAPPACCOUNTS">FilterWhatsappAccounts</label>\n          <md-select name="attrWhatsappAccounts" ng-model="vm.dashboarditem.attrWhatsappAccounts" multiple>\n            <md-option ng-value="attrWhatsappAccounts.id" ng-repeat="attrWhatsappAccounts in vm.whatsappAccount" ng-disabled="attrWhatsappAccounts.canSelect === false">{{ attrWhatsappAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrWhatsappAccounts\'].$error" ng-show="dashboarditemForm[\'attrWhatsappAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERWHATSAPPACCOUNTS_REQUIRED">FilterWhatsappAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'chat\'" class="md-block">\n          <label translate="TOOLS.FILTERCHATWEBSITES">FilterChatWebsites</label>\n          <md-select name="attrChatWebsites" ng-model="vm.dashboarditem.attrChatWebsites" multiple>\n            <md-option ng-value="attrChatWebsites.id" ng-repeat="attrChatWebsites in vm.chatWebsite" ng-disabled="attrChatWebsites.canSelect === false">{{ attrChatWebsites.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrChatWebsites\'].$error" ng-show="dashboarditemForm[\'attrChatWebsites\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERCHATWEBSITES_REQUIRED">FilterChatWebsites field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\', \'counter\'].includes(vm.dashboarditem.type) && vm.dashboarditem.attrChannel === \'voice\'" class="md-block">\n        <label translate="TOOLS.FILTERVOICEQUEUES">FilterVoiceQueues</label>\n        <md-select name="attrVoiceQueues" ng-model="vm.dashboarditem.attrVoiceQueues" multiple>\n          <md-option ng-value="attrVoiceQueues.id" ng-repeat="attrVoiceQueues in vm.voiceQueues" ng-disabled="attrVoiceQueues.canSelect === false">{{ attrVoiceQueues.name }}</md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrVoiceQueues\'].$error" ng-show="dashboarditemForm[\'attrVoiceQueues\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FILTERVOICEQUEUES_REQUIRED">FilterVoiceQueues field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TITLE">Title</label>\n        <input type="text" name="title" ng-model="vm.dashboarditem.title" md-maxlength="255" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'title\'].$error" ng-show="dashboarditemForm[\'title\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TITLE_REQUIRED">Title field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.TITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>Title must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TITLEFONTSIZE">TitleFontSize</label>\n        <input type="number" name="titleFontSize" ng-model="vm.dashboarditem.titleFontSize" value="12">\n\n        <div ng-messages="dashboarditemForm[\'titleFontSize\'].$error" ng-show="dashboarditemForm[\'titleFontSize\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TITLEFONTSIZE_REQUIRED">TitleFontSize field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'iframe\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="attrUrl" ng-model="vm.dashboarditem.attrUrl" value="https://" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrUrl\'].$error" ng-show="dashboarditemForm[\'attrUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'custom\'" class="md-block">\n        <label translate="TOOLS.PATH">Path</label>\n        <input type="text" name="attrPath" ng-model="vm.dashboarditem.attrPath" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrPath\'].$error" ng-show="dashboarditemForm[\'attrPath\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PATH_REQUIRED">Path field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'clock\'" class="md-block">\n        <label translate="TOOLS.FORMAT">Format</label>\n        <input type="text" name="attrHourFormat" ng-model="vm.dashboarditem.attrHourFormat" value="HH:mm:ss" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrHourFormat\'].$error" ng-show="dashboarditemForm[\'attrHourFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FORMAT_REQUIRED">Format field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'clock\'" class="md-block">\n        <label translate="TOOLS.TIMEZONE">Timezone</label>\n        <md-select name="attrTimezone" ng-model="vm.dashboarditem.attrTimezone" required>\n          <md-option ng-value="\'-12.00\'">GMT-12.00</md-option>\n          <md-option ng-value="\'-11.00\'">GMT-11.00</md-option>\n          <md-option ng-value="\'-10.00\'">GMT-10.00</md-option>\n          <md-option ng-value="\'-9.00\'">GMT-9.00</md-option>\n          <md-option ng-value="\'-8.00\'">GMT-8.00</md-option>\n          <md-option ng-value="\'-7.00\'">GMT-7.00</md-option>\n          <md-option ng-value="\'-6.00\'">GMT-6.00</md-option>\n          <md-option ng-value="\'-5.00\'">GMT-5.00</md-option>\n          <md-option ng-value="\'-4.00\'">GMT-4.00</md-option>\n          <md-option ng-value="\'-3.30\'">GMT-3.30</md-option>\n          <md-option ng-value="\'-3.00\'">GMT-3.00</md-option>\n          <md-option ng-value="\'-2.00\'">GMT-2.00</md-option>\n          <md-option ng-value="\'-1.00\'">GMT-1.00</md-option>\n          <md-option ng-value="\'0.00\'">GMT 0.00</md-option>\n          <md-option ng-value="\'1.00\'">GMT+1.00</md-option>\n          <md-option ng-value="\'2.00\'">GMT+2.00</md-option>\n          <md-option ng-value="\'3.00\'">GMT+3.00</md-option>\n          <md-option ng-value="\'3.30\'">GMT+3.30</md-option>\n          <md-option ng-value="\'4.00\'">GMT+4.00</md-option>\n          <md-option ng-value="\'4.30\'">GMT+4.30</md-option>\n          <md-option ng-value="\'5.00\'">GMT+5.00</md-option>\n          <md-option ng-value="\'5.30\'">GMT+5.30</md-option>\n          <md-option ng-value="\'5.45\'">GMT+5.45</md-option>\n          <md-option ng-value="\'6.00\'">GMT+6.00</md-option>\n          <md-option ng-value="\'6.30\'">GMT+6.30</md-option>\n          <md-option ng-value="\'7.00\'">GMT+7.00</md-option>\n          <md-option ng-value="\'8.00\'">GMT+8.00</md-option>\n          <md-option ng-value="\'9.00\'">GMT+9.00</md-option>\n          <md-option ng-value="\'9.30\'">GMT+9.30</md-option>\n          <md-option ng-value="\'10.00\'">GMT+10.00</md-option>\n          <md-option ng-value="\'11.00\'">GMT+11.00</md-option>\n          <md-option ng-value="\'12.00\'">GMT+12.00</md-option>\n          <md-option ng-value="\'13.00\'">GMT+13.00</md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrTimezone\'].$error" ng-show="dashboarditemForm[\'attrTimezone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type === \'counter\'" class="md-block">\n        <label translate="TOOLS.METRIC">Metric</label>\n        <md-select name="attrMetric" ng-model="vm.dashboarditem.attrMetric" required>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrMetric\'].$error" ng-show="dashboarditemForm[\'attrMetric\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE1">Serie1</label>\n        <md-select name="attrSerie1" ng-model="vm.dashboarditem.attrSerie1" required>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie1\'].$error" ng-show="dashboarditemForm[\'attrSerie1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE1_REQUIRED">Serie1 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE2">Serie2</label>\n        <md-select name="attrSerie2" ng-model="vm.dashboarditem.attrSerie2">\n\n          <md-option ng-value="\'null\'"> {{ \'TOOLS.NONE\' | translate }} </md-option>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie2\'].$error" ng-show="dashboarditemForm[\'attrSerie2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE2_REQUIRED">Serie2 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE3">Serie3</label>\n        <md-select name="attrSerie3" ng-model="vm.dashboarditem.attrSerie3">\n\n          <md-option ng-value="\'null\'"> {{ \'TOOLS.NONE\' | translate }} </md-option>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie3\'].$error" ng-show="dashboarditemForm[\'attrSerie3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE3_REQUIRED">Serie3 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'web-report\'" class="md-block">\n        <label translate="TOOLS.REPORT">Report</label>\n        <input type="search" name="report" ng-model="vm.dashboarditem.report" ng-required="true" autocomplete="off" ng-click="vm.searchReport()">\n        <md-icon md-font-icon="icon-magnify" ng-click="vm.searchReport()" aria-label="Search Report"></md-icon>\n        <div ng-messages="dashboarditemForm[\'report\'].$error" ng-show="dashboarditemForm[\'report\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REPORT_REQUIRED">Report field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'web-report\'" class="md-block">\n        <label translate="TOOLS.REFRESH">Refresh</label>\n        <input type="number" name="attrRefresh" ng-model="vm.dashboarditem.attrRefresh" min="5" value="10" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrRefresh\'].$error" ng-show="dashboarditemForm[\'attrRefresh\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REFRESH_REQUIRED">Refresh field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.REFRESH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Refresh must be a valid greater or equal than</span> <span>5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'counter\', \'clock\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.FONTSIZE">FontSize</label>\n        <input type="number" name="attrFontSize" ng-model="vm.dashboarditem.attrFontSize" min="12" max="40" value="20" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrFontSize\'].$error" ng-show="dashboarditemForm[\'attrFontSize\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FONTSIZE_REQUIRED">FontSize field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.FONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">FontSize must be a valid greater or equal than</span> <span>12</span>\n          </div>\n          <div ng-message="max">\n            <span translate="TOOLS.ERRORS.FONTSIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">FontSize must be a valid greater or equal than</span> <span>40</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.dashboarditem.foreground" label="{{\'TOOLS.FOREGROUND\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n      <div flex md-color-picker ng-model="vm.dashboarditem.background" label="{{\'TOOLS.BACKGROUND\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LINK">link</label>\n        <input type="url" name="link" ng-model="vm.dashboarditem.link">\n\n        <div ng-messages="dashboarditemForm[\'link\'].$error" ng-show="dashboarditemForm[\'link\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LINK_REQUIRED">link field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.LINK_MUST_VALID_URL">link must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDashboardItem" ng-click="vm.saveDashboardItem()" class="send-button md-accent md-raised" ng-disabled="dashboarditemForm.$invalid || dashboarditemForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDashboardItem" ng-click="vm.addNewDashboardItem()" class="send-button md-accent md-raised" ng-disabled="dashboarditemForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_DASHBOARDITEM" translate-attr-aria-label="TOOLS.ADD_DASHBOARDITEM">\n          ADD DASHBOARDITEM\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDashboardItem" ng-click="vm.deleteDashboardItem($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/edit/view.html",'<div id="tools-customDashboard" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-customDashboards-button md-icon-button" aria-label="Go to customDashboards" ng-click="vm.gotoCustomDashboards()" translate translate-attr-aria-label="TOOLS.GO_TO_CUSTOMDASHBOARDS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="customDashboard-image" hide-xs>\n          <img ng-src="assets/images/business/customDashboards.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.customDashboard.id}}\n            <span ng-if="vm.customDashboard.name">{{vm.customDashboard.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.customDashboard.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.customDashboard, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="TOOLS.CLONE_CUSTOMDASHBOARD"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.customDashboard, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="TOOLS.GOTO_CUSTOMDASHBOARD"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveCustomDashboard()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (dashboardForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="customDashboard-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.customDashboard.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.DASHBOARD">DASHBOARD</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="customDashboard-detail-form-container dashboard md-background-bg md-whiteframe-1dp">\n            <div ng-controller="CustomDashboardItemsController as vm_cd" ng-init="vm_cd.init(vm.customDashboard, vm.crudPermissions)" class="customDashboard-detail-form-container no-padding no-margin" layout="column">\n              <div ng-if="vm_cd.customDashboard.widgets.length">\n                <md-button class="md-fab md-mini md-accent" ng-click="vm_cd.createOrEditWidget()" ng-if="vm_cd.crudPermissions.canEdit" aria-label="add item">\n                  <md-tooltip>{{ \'TOOLS.ADD_WIDGET\' | translate }}</md-tooltip>\n                  <md-icon md-font-icon="icon-plus"></md-icon>\n                </md-button>\n                <md-content flex>\n                  <ms-widget-engine config="vm_cd.customDashboard" on-edit="vm_cd.createOrEditWidget(widget)" on-delete="vm_cd.deleteWidget(widget)"></ms-widget-engine>\n                </md-content>\n              </div>\n              <div ng-if="!vm_cd.customDashboard.widgets.length" layout="row" layout-align="center center" flex>\n                <md-button class="width-130 height-130 md-accent md-raised" ng-click="vm_cd.createOrEditWidget()" aria-label="add item" layout="column">\n                  <md-icon md-font-icon="icon-plus-circle" class="s50"></md-icon>\n                  <span layout-wrap translate="TOOLS.ADD_WIDGET"></span>\n                </md-button>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/customDashboards/partialViews/reports/treeReports.html",'<md-dialog class="report-selection-dialog" aria-label="Report Selection" flex="60">\n  <md-toolbar>\n    <div class="md-toolbar-tools">\n      <h2>Select Report</h2>\n      <span flex></span>\n      <md-button class="md-icon-button" ng-click="vm.closeReportDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <div class="content" md-background-bg layout="row" layout-align="start start">\n      <div layout="column" flex="30">\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n        </md-card>\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n        </md-card>\n      </div>\n      <md-card flex="70">\n        <md-toolbar class="md-table-toolbar md-default">\n          <div class="md-toolbar-tools">\n            <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n            <p ng-if="vm.currentPath">\n              <span class="text-boxed">{{vm.currentPath}}</span>\n            </p>\n          </div>\n        </md-toolbar>\n        <md-table-container>\n          <table md-table md-row-select ng-model="vm.selectedReport" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n              <tr md-row>\n                <th md-column md-order-by="id" width="10px">{{ "ANALYTICS.ID" | translate }}</th>\n                <th md-column md-order-by="name">{{ "ANALYTICS.NAME" | translate }}</th>\n                <th md-column md-order-by="description">{{ "ANALYTICS.DESCRIPTION" | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ "ANALYTICS.CREATED_AT" | translate }}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.reports.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n                <td md-cell class="id">{{ report.id }}</td>\n                <td md-cell class="name">{{ report.name }}</td>\n                <td md-cell class="description">{{ report.description }}</td>\n                <td md-cell class="createdAt">{{ report.createdAt | date: "medium" }}</td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{ \'ANALYTICS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'ANALYTICS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'ANALYTICS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10]" md-page="vm.query.page" md-total="{{ vm.reports.count }}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <span flex></span>\n    <md-button class="md-raised" ng-click="vm.closeReportDialog()">CANCEL</md-button>\n    <md-button class="md-accent md-raised" ng-click="vm.selectReport()">CONFIRM</md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/tools/views/dispositions/create/dialog.html",'<md-dialog ng-init="vm.onInit()" class="disposition-dialog" aria-label="New Disposition">\n  <form name="dispositionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newDisposition ? \'TOOLS.NEW_DISPOSITION\' : \'TOOLS.EDIT_DISPOSITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.disposition.name" md-maxlength="255" required md-autofocus>\n        <div ng-messages="dispositionForm[\'name\'].$error" ng-show="dispositionForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.NAME_MAX_LENGTH" translate-values=\'{max: 255}\'>Name must have a maximum length\n              equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.disposition.description" md-maxlength="255">\n        <div ng-messages="dispositionForm[\'description\'].$error" ng-show="dispositionForm[\'description\'].$touched" role="alert">\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_MAX_LENGTH" translate-values=\'{max: 255}\'>Description must have a\n              maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.newDisposition && vm.dispositions.length > 0 || vm.disposition.ParentId" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="TOOLS.FIRST_LEVEL_DISPOSITION">First Level Disposition</label>\n          <md-select name="firstLevelDisposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onFirstLevelSelection()">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' }" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.firstLevelDisposition" ng-click="vm.clearSelection(\'first\'); dispositionForm.$setDirty();" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear first level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="TOOLS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n          <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition">\n            <md-option ng-value="disposition" ng-if="disposition.id != vm.disposition.id" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id }" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearSelection(\'second\'); dispositionForm.$setDirty();" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear first level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDisposition" ng-click="vm.saveDisposition()" class="send-button md-accent md-raised" ng-disabled="dispositionForm.$invalid || dispositionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDisposition" ng-click="vm.addNewDisposition()" class="send-button md-accent md-raised" ng-disabled="dispositionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_DISPOSITION" translate-attr-aria-label="TOOLS.ADD_DISPOSITION">\n          ADD DISPOSITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDisposition" ng-click="vm.deleteDisposition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/dispositions/dispositions.html",'<div id="dispositions" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.DISPOSITIONS">Dispositions</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDispositions.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedDispositions = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-dispositions-count">\n          <span>{{vm.selectedDispositions.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDispositions()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDispositions()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDispositions" csv-label="true" filename="dispositions.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      <div layout="row">\n        <div class="column" flex="20">\n          <md-card>\n            <md-card-content>\n              <button layout-align="center center" md-mini-fab ng-click="vm.query.level = null; vm.getDispositions()">\n                <div layout="row" layout-align="start center">\n                  <md-icon md-font-icon="icon-refresh"></md-icon>\n                  <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                </div>\n              </button>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm.query.level" ng-change="vm.getDispositions()">\n                  <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                  <md-option ng-value="key" ng-repeat="(key, value) in vm.levels">{{ value }}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n        </div>\n        \x3c!-- DISPOSITION TABLE --\x3e\n        <md-card flex="80">\n          <md-table-container>\n            <table md-table md-row-select multiple ng-model="vm.selectedDispositions" md-progress="vm.promise">\n              <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDispositions">\n                <tr md-row>\n                  <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                  <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                  <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                  <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                  <th md-column width="10px"></th>\n                </tr>\n              </thead>\n              <tbody md-body>\n                <tr md-row ng-hide="vm.dispositions.rows.length">\n                  <td md-cell colspan="5">\n                    <div layout="row" layout-align="center center">\n                      <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                  </td>\n                </tr>\n                <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm.dispositions.rows">\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                  </td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                    {{ vm.levels[disposition.level] }}</td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                    {{disposition.name}}</td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                    {{disposition.description}}</td>\n                  <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        \x3c!-- SUBACTIONS --\x3e\n                        \x3c!-- ACTIONS --\x3e\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                            Edit Disposition\n                          </md-button>\n                        </md-menu-item>\n                        \x3c!-- SUBACTIONS --\x3e\n                        \x3c!-- ACTIONS --\x3e\n                        <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                          <md-button ng-click="vm.deleteconfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                            Delete Disposition\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n          <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.dispositions.count}}" md-on-paginate="vm.getDispositions" md-page-select>\n          </md-table-pagination>\n        </md-card>\n        \x3c!-- / DISPOSITION TABLE --\x3e\n      </div>\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n  \x3c!-- ADD DISPOSITION BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-disposition-button" ng-click="vm.createOrEditDisposition($event)" aria-label="add disposition" translate translate-attr-aria-label="TOOLS.ADD_DISPOSITION">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DISPOSITION BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/intervals/create/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.interval.name" ng-required="true" autofocus>\n\n        <div ng-messages="intervalForm[\'name\'].$error" ng-show="intervalForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.interval.description">\n\n        <div ng-messages="intervalForm[\'description\'].$error" ng-show="intervalForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInterval" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInterval" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInterval" ng-click="vm.deleteInterval($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input ng-model="vm.interval.name" type="text" name="name" placeholder="{{\'TOOLS.NAME\' | translate}}" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" md-autofocus required>\n        <div ng-messages="intervalForm.name.$error" ng-show="intervalForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/intervals/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.interval.name" ng-required="true" autofocus>\n\n        <div ng-messages="intervalForm[\'name\'].$error" ng-show="intervalForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInterval" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInterval" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInterval" ng-click="vm.deleteInterval($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/view.html",'<div id="tools-interval" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-intervals-button md-icon-button" aria-label="Go to intervals" ng-click="vm.gotoIntervals()" translate translate-attr-aria-label="TOOLS.GO_TO_INTERVALS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="interval-image" hide-xs>\n          <img ng-src="assets/images/business/intervals.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.interval.id}}\n            <span ng-if="vm.interval.name">{{vm.interval.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.interval.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInterval()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (intervalsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="interval-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.interval.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.interval.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.INTERVALS">INTERVALS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="interval-detail-form-container intervals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IntervalIntervalsController as vm_dc" ng-init="vm_dc.init(vm.interval, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIntervalIntervals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="TOOLS.INTERVALS">Intervals</span>\n                  <ms-search-bar on-search="vm_dc.getIntervalIntervals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditIntervalInterval($event)" aria-label="add interval" translate translate-attr-label="TOOLS.ADD_INTERVAL">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIntervalIntervals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIntervalIntervals.length}} {{vm_dc.selectedIntervalIntervals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIntervalIntervals" csv-label="true" filename="intervals.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedIntervalIntervals($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIntervalIntervals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIntervalIntervals">\n                    <tr md-row>\n                      <th md-column width="10px"></th>\n                      <th md-column md-order-by="id">\n                        {{ \'TOOLS.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="name">\n                        {{ \'TOOLS.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="interval">\n                        {{ \'TOOLS.INTERVAL\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'TOOLS.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body ng-sortable="vm_dc.sortableTable">\n                    <tr md-row md-select="interval" md-select-id="id" ng-repeat="interval in vm_dc.intervalIntervals.rows">\n                      <td md-cell>\n                        <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.name}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.interval}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{ interval.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" translate="TOOLS.EDIT_INTERVAL">\n                                Edit Interval\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interval, $event)" translate="TOOLS.DELETE_INTERVAL">\n                                Delete Interval\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.intervalIntervals.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="TOOLS.NO_INTERVALS_AVAILABLE">No intervals available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/intervals/intervals.html",'<div id="intervals" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.INTERVALS">Intervals</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedIntervals.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedIntervals =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-intervals-count">\n          <span>{{vm.selectedIntervals.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllIntervals()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectIntervals()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedIntervals" csv-label="true" filename="intervals.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedIntervals($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- INTERVAL TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedIntervals" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getIntervals">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.intervals.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="interval" md-select-id="id" ng-repeat="interval in vm.intervals.rows">\n                <td md-cell ng-if="interval.userpic"><img class="avatar" alt="{{interval.name}}" ng-src="api/users/{{interval.id}}/avatar" /></td>\n                <td md-cell ng-if="!interval.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{interval.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="id ">{{interval.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="name ">{{interval.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="description ">{{interval.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(interval, $event    )" translate="TOOLS.EDIT_INTERVAL">\n                          Edit Interval\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(interval, $event    )" translate="TOOLS.DELETE_INTERVAL">\n                          Delete Interval\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.intervals.count}}" md-on-paginate="vm.getIntervals" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / INTERVAL TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD INTERVAL BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-interval-button" ng-click="vm.createOrEditInterval($event)" aria-label="add interval" translate translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD INTERVAL BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/pauses/create/dialog.html",'<md-dialog class="pause-dialog" aria-label="New Pause">\n  <form name="pauseForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.pause.name" ng-required="true" autofocus>\n\n        <div ng-messages="pauseForm[\'name\'].$error" ng-show="pauseForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.pause.description">\n\n        <div ng-messages="pauseForm[\'description\'].$error" ng-show="pauseForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newPause" ng-click="vm.savePause()" class="send-button md-accent md-raised" ng-disabled="pauseForm.$invalid || pauseForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newPause" ng-click="vm.addNewPause()" class="send-button md-accent md-raised" ng-disabled="pauseForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_PAUSE" translate-attr-aria-label="TOOLS.ADD_PAUSE">\n          ADD PAUSE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newPause" ng-click="vm.deletePause($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/pauses/pauses.html",'<div id="pauses" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.PAUSES">Pauses</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedPauses.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedPauses =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-pauses-count">\n          <span>{{vm.selectedPauses.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllPauses()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectPauses()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedPauses" csv-label="true" filename="pauses.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedPauses($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- PAUSE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedPauses" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getPauses">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.pauses.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="pause" md-select-id="id" ng-repeat="pause in vm.pauses.rows">\n                <td md-cell ng-if="pause.userpic"><img class="avatar" alt="{{pause.name}}" ng-src="api/users/{{pause.id}}/avatar" /></td>\n                <td md-cell ng-if="!pause.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{pause.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="id ">{{pause.id}}</td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="name ">{{pause.name}}</td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="description ">{{pause.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(pause, $event    )" translate="TOOLS.EDIT_PAUSE">\n                          Edit Pause\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(pause, $event    )" translate="TOOLS.DELETE_PAUSE">\n                          Delete Pause\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.pauses.count}}" md-on-paginate="vm.getPauses" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PAUSE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PAUSE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-pause-button" ng-click="vm.createOrEditPause($event)" aria-label="add pause" translate translate-attr-aria-label="TOOLS.ADD_PAUSE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PAUSE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/schedules/create/dialog.html",'<md-dialog class="schedule-dialog" aria-label="New Schedule">\n  <form name="scheduleForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.schedule.name" ng-required="true" autofocus>\n\n        <div ng-messages="scheduleForm[\'name\'].$error" ng-show="scheduleForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.REPORT">Report</label>\n        <input type="search" name="report" ng-model="vm.schedule.report" ng-required="true" autocomplete="off" ng-click="vm.searchReport()">\n        <md-icon md-font-icon="icon-magnify" ng-click="vm.searchReport()" aria-label="Search Report"></md-icon>\n        <div ng-messages="scheduleForm[\'report\'].$error" ng-show="scheduleForm[\'report\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REPORT_REQUIRED">Report field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OUTPUT">Output</label>\n        <md-select name="output" ng-model="vm.schedule.output" required>\n          <md-option ng-value="\'csv\'">CSV</md-option>\n          <md-option ng-value="\'pdf\'">PDF</md-option>\n          <md-option ng-value="\'xlsx\'">Excel</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'output\'].$error" ng-show="scheduleForm[\'output\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTPUT_REQUIRED">Output field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.schedule.active" aria-label="Active"><span translate="TOOLS.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <div class="md-block">\n        <label translate="TOOLS.VALIDITYSTART">ValidityStart</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="startAtDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.schedule.startAt" ng-init="vm.schedule.startAt = vm.getDateFromString(vm.schedule.startAt)">\n              <div ng-messages="scheduleForm.dateRangeFrom.$error" ng-show="scheduleForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="startAtTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.schedule.startAt" ng-init="vm.schedule.startAt = vm.getDateFromString(vm.schedule.startAt)">\n              <div ng-messages="scheduleForm.timeRangeFrom.$error" ng-show="scheduleForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div class="md-block">\n        <label translate="TOOLS.VALIDITYEND">ValidityEnd</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="endAtDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.schedule.endAt" ng-init="vm.schedule.endAt = vm.getDateFromString(vm.schedule.endAt)">\n              <div ng-messages="scheduleForm.dateRangeFrom.$error" ng-show="scheduleForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="endAtTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.schedule.endAt" ng-init="vm.schedule.endAt = vm.getDateFromString(vm.schedule.endAt)">\n              <div ng-messages="scheduleForm.timeRangeFrom.$error" ng-show="scheduleForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div flex class="md-block">\n        <label> {{ \'TOOLS.CRON\' | translate }} ({{vm.schedule.cron}})</label>\n        <cron-selection name="cron" ng-model="vm.schedule.cron" template="assets/angular-cron-jobs/template.html" required></cron-selection>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LAST">Last</label>\n        <input type="number" name="subtractNumber" ng-model="vm.schedule.subtractNumber" value="1" ng-required="true">\n\n        <div ng-messages="scheduleForm[\'subtractNumber\'].$error" ng-show="scheduleForm[\'subtractNumber\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LAST_REQUIRED">Last field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LASTUNIT">LastUnit</label>\n        <md-select name="subtractUnit" ng-model="vm.schedule.subtractUnit" required>\n          <md-option ng-value="\'minutes\'">Minutes</md-option>\n          <md-option ng-value="\'hours\'">Hours</md-option>\n          <md-option ng-value="\'days\'">Days</md-option>\n          <md-option ng-value="\'weeks\'">Weeks</md-option>\n          <md-option ng-value="\'months\'">Months</md-option>\n          <md-option ng-value="\'quarters\'">Quarters</md-option>\n          <md-option ng-value="\'years\'">Years</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'subtractUnit\'].$error" ng-show="scheduleForm[\'subtractUnit\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LASTUNIT_REQUIRED">LastUnit field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.schedule.sendMail" aria-label="SendMail"><span translate="TOOLS.SENDMAIL">SendMail</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.MAILACCOUNT">MailAccount</label>\n        <md-select name="MailAccountId" ng-model="vm.schedule.MailAccountId" required>\n          <md-option ng-value="MailAccountId.id" ng-repeat="MailAccountId in vm.mailAccounts" ng-disabled="MailAccountId.canSelect === false">{{ MailAccountId.name }}</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'MailAccountId\'].$error" ng-show="scheduleForm[\'MailAccountId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.MAILACCOUNT_REQUIRED">MailAccount field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILADDRESS">EmailAddress</label>\n        <input type="text" name="email" ng-model="vm.schedule.email" ng-required="true">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'email\'].$error" ng-show="scheduleForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILADDRESS_REQUIRED">EmailAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILCCADDRESS">EmailCcAddress</label>\n        <input type="text" name="cc" ng-model="vm.schedule.cc">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILCCADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'cc\'].$error" ng-show="scheduleForm[\'cc\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILCCADDRESS_REQUIRED">EmailCcAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILBCCADDRESS">EmailBccAddress</label>\n        <input type="text" name="bcc" ng-model="vm.schedule.bcc">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILBCCADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'bcc\'].$error" ng-show="scheduleForm[\'bcc\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILBCCADDRESS_REQUIRED">EmailBccAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <md-switch ng-model="vm.schedule.sendIfEmpty" aria-label="SendIfEmpty"><span translate="TOOLS.SENDIFEMPTY">SendIfEmpty</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="" name="description" ng-model="vm.schedule.description">\n\n        <div ng-messages="scheduleForm[\'description\'].$error" ng-show="scheduleForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSchedule" ng-click="vm.saveSchedule()" class="send-button md-accent md-raised" ng-disabled="scheduleForm.$invalid || scheduleForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSchedule" ng-click="vm.addNewSchedule()" class="send-button md-accent md-raised" ng-disabled="scheduleForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_SCHEDULE" translate-attr-aria-label="TOOLS.ADD_SCHEDULE">\n          ADD SCHEDULE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSchedule" ng-click="vm.deleteSchedule($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/schedules/partialViews/reports/treeReports.html",'<md-dialog class="report-selection-dialog" aria-label="Report Selection" flex="60">\n  <md-toolbar>\n    <div class="md-toolbar-tools">\n      <h2>Select Report</h2>\n      <span flex></span>\n      <md-button class="md-icon-button" ng-click="vm.closeReportDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <div class="content" md-background-bg layout="row" layout-align="start start">\n      <div layout="column" flex="30">\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n        </md-card>\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n        </md-card>\n      </div>\n      <md-card flex="70">\n        <md-toolbar class="md-table-toolbar md-default">\n          <div class="md-toolbar-tools">\n            <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n            <p ng-if="vm.currentPath">\n              <span class="text-boxed">{{vm.currentPath}}</span>\n            </p>\n          </div>\n        </md-toolbar>\n        <md-table-container>\n          <table md-table md-row-select ng-model="vm.selectedReport" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n              <tr md-row>\n                <th md-column md-order-by="id" width="10px">{{ "ANALYTICS.ID" | translate }}</th>\n                <th md-column md-order-by="name">{{ "ANALYTICS.NAME" | translate }}</th>\n                <th md-column md-order-by="description">{{ "ANALYTICS.DESCRIPTION" | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ "ANALYTICS.CREATED_AT" | translate }}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.reports.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n                <td md-cell class="id">{{ report.id }}</td>\n                <td md-cell class="name">{{ report.name }}</td>\n                <td md-cell class="description">{{ report.description }}</td>\n                <td md-cell class="createdAt">{{ report.createdAt | date: "medium" }}</td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{ \'ANALYTICS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'ANALYTICS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'ANALYTICS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10]" md-page="vm.query.page" md-total="{{ vm.reports.count }}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <span flex></span>\n    <md-button class="md-raised" ng-click="vm.closeReportDialog()">CANCEL</md-button>\n    <md-button class="md-accent md-raised" ng-click="vm.selectReport()">CONFIRM</md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/tools/views/schedules/schedules.html",'<div id="schedules" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.SCHEDULER">Scheduler</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedScheduler.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedScheduler =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-schedules-count">\n          <span>{{vm.selectedScheduler.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllScheduler()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectScheduler()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedScheduler" csv-label="true" filename="schedules.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedScheduler($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SCHEDULE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedScheduler" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScheduler">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'TOOLS.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="startAt">{{ \'TOOLS.VALIDITYSTART\' | translate }}</th>\n                <th md-column md-order-by="endAt">{{ \'TOOLS.VALIDITYEND\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.schedules.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="schedule" md-select-id="id" ng-repeat="schedule in vm.schedules.rows">\n                <td md-cell ng-if="schedule.userpic"><img class="avatar" alt="{{schedule.name}}" ng-src="api/users/{{schedule.id}}/avatar" /></td>\n                <td md-cell ng-if="!schedule.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{schedule.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="id ">{{schedule.id}}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="name ">{{schedule.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(schedule, ev) : vm.createOrEditSchedule($event, schedule)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{schedule.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{schedule.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="startAt ">{{schedule.startAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="endAt ">{{schedule.endAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="description ">{{schedule.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(schedule, $event    )" translate="TOOLS.EDIT_SCHEDULE">\n                          Edit Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.runconfirm(schedule, $event    )" translate="TOOLS.RUN_SCHEDULE">\n                          Run Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(schedule, $event    )" translate="TOOLS.DELETE_SCHEDULE">\n                          Delete Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.schedules.count}}" md-on-paginate="vm.getScheduler" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SCHEDULE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SCHEDULE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-schedule-button" ng-click="vm.createOrEditSchedule($event)" aria-label="add schedule" translate translate-attr-aria-label="TOOLS.ADD_SCHEDULE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SCHEDULE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/sounds/create/dialog.html",'<md-dialog class="sound-dialog" aria-label="New Sound">\n  <form name="soundForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.sound.name" ng-required="true" autofocus>\n\n        <div ng-messages="soundForm[\'name\'].$error" ng-show="soundForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.sound.description">\n\n        <div ng-messages="soundForm[\'description\'].$error" ng-show="soundForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSound" ng-click="vm.saveSound()" class="send-button md-accent md-raised" ng-disabled="soundForm.$invalid || soundForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSound" ng-click="vm.addNewSound()" class="send-button md-accent md-raised" ng-disabled="soundForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_SOUND" translate-attr-aria-label="TOOLS.ADD_SOUND">\n          ADD SOUND\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSound" ng-click="vm.deleteSound($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/sounds/sounds.html",'<div id="sounds" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.SOUNDS">Sounds</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSounds.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSounds =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-sounds-count">\n          <span>{{vm.selectedSounds.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSounds()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSounds()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSounds" csv-label="true" filename="sounds.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSounds($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SOUND TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSounds" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSounds">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="audio">{{ \'TOOLS.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.sounds.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="sound" md-select-id="id" ng-repeat="sound in vm.sounds.rows">\n                <td md-cell ng-if="sound.userpic"><img class="avatar" alt="{{sound.name}}" ng-src="api/users/{{sound.id}}/avatar" /></td>\n                <td md-cell ng-if="!sound.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{sound.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="id ">{{sound.id}}</td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="name ">{{sound.name}}</td>\n                <td md-cell class="audio ">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording id="sound.id" model="\'sound\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                </td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="description ">{{sound.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(sound, $event    )" translate="TOOLS.EDIT_SOUND">\n                          Edit Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.downloadfile2(sound, $event  , \'sounds\'   )" translate="TOOLS.DOWNLOAD_SOUND">\n                          Download Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(sound, $event    )" translate="TOOLS.DELETE_SOUND">\n                          Delete Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.sounds.count}}" md-on-paginate="vm.getSounds" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SOUND TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- UPLOAD SOUND BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="upload-sound-button" ng-click="vm.uploadSound($event)" aria-label="upload sound" translate translate-attr-aria-label="TOOLS.UPLOAD_SOUND">\n    <md-icon md-font-icon="icon-upload"></md-icon>\n  </md-button>\n  \x3c!-- / UPLOAD SOUND BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/sounds/upload/dialog.html",'<md-dialog class="upload-dialog" aria-label="Upload ">\n  <form name="uploadForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="sound-uploader" ng-hide="vm.uploadState == \'uploading\'" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)" flow-error="vm.uploadError($file, $message)" flow-complete="vm.uploadComplete()" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="TOOLS.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="TOOLS.DROP_TO_UPLOAD_MESSAGE">You can also drop your file here to upload.</span>\n        </div>\n      </div>\n\n      <div layout="column" layout-align="space-between center" ng-show="vm.uploadState == \'uploading\'">\n        <div>\n          <span translate="TOOLS.UPLOADING">Uploading</span>\n          <span>{{vm.sound.file.name}}</span>\n        </div>\n        <md-progress-linear md-mode="indeterminate"></md-progress-linear>\n      </div>\n\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center"></div>\n      <div layout="row">\n        <md-button ng-click="vm.closeDialog()" ng-hide="vm.uploadState == \'uploading\'" class="md-accent md-raised" aria-label="FINISH" translate="TOOLS.FINISH" translate-attr-aria-label="TOOLS.FINISH">\n          FINISH\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/tags/create/dialog.html",'<md-dialog class="tag-dialog" aria-label="New Tag">\n  <form name="tagForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.tag.name" ng-required="true" autofocus>\n\n        <div ng-messages="tagForm[\'name\'].$error" ng-show="tagForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.tag.description">\n\n        <div ng-messages="tagForm[\'description\'].$error" ng-show="tagForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.tag.color" label="{{\'TOOLS.COLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTag" ng-click="vm.saveTag()" class="send-button md-accent md-raised" ng-disabled="tagForm.$invalid || tagForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTag" ng-click="vm.addNewTag()" class="send-button md-accent md-raised" ng-disabled="tagForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TAG" translate-attr-aria-label="TOOLS.ADD_TAG">\n          ADD TAG\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTag" ng-click="vm.deleteTag($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/tags/tags.html",'<div id="tags" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TAGS">Tags</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTags.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTags =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-tags-count">\n          <span>{{vm.selectedTags.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTags()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTags()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTags" csv-label="true" filename="tags.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTags($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TAG TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTags" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTags">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="color">{{ \'TOOLS.COLOR\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.tags.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="tag" md-select-id="id" ng-repeat="tag in vm.tags.rows">\n                <td md-cell ng-if="tag.userpic"><img class="avatar" alt="{{tag.name}}" ng-src="api/users/{{tag.id}}/avatar" /></td>\n                <td md-cell ng-if="!tag.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{tag.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="id ">{{tag.id}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="name ">{{tag.name}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="description ">{{tag.description}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="color ">{{tag.color}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(tag, $event    )" translate="TOOLS.EDIT_TAG">\n                          Edit Tag\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(tag, $event    )" translate="TOOLS.DELETE_TAG">\n                          Delete Tag\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.tags.count}}" md-on-paginate="vm.getTags" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TAG TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TAG BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-tag-button" ng-click="vm.createOrEditTag($event)" aria-label="add tag" translate translate-attr-aria-label="TOOLS.ADD_TAG">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TAG BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/templates/create/dialog.html",'<md-dialog class="template-dialog" aria-label="New Template">\n  <form name="templateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.template.name" ng-required="true" autofocus>\n\n        <div ng-messages="templateForm[\'name\'].$error" ng-show="templateForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="TOOLS.CONTENT">Content</label>\n        <textarea aria-label="Content html" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.template.html"></textarea>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.template.description">\n\n        <div ng-messages="templateForm[\'description\'].$error" ng-show="templateForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTemplate" ng-click="vm.saveTemplate()" class="send-button md-accent md-raised" ng-disabled="templateForm.$invalid || templateForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTemplate" ng-click="vm.addNewTemplate()" class="send-button md-accent md-raised" ng-disabled="templateForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TEMPLATE" translate-attr-aria-label="TOOLS.ADD_TEMPLATE">\n          ADD TEMPLATE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTemplate" ng-click="vm.deleteTemplate($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/templates/templates.html",'<div id="templates" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TEMPLATES">Templates</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTemplates.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTemplates =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-templates-count">\n          <span>{{vm.selectedTemplates.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTemplates()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTemplates()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTemplates" csv-label="true" filename="templates.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTemplates($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TEMPLATE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTemplates" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTemplates">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.templates.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="template" md-select-id="id" ng-repeat="template in vm.templates.rows">\n                <td md-cell ng-if="template.userpic"><img class="avatar" alt="{{template.name}}" ng-src="api/users/{{template.id}}/avatar" /></td>\n                <td md-cell ng-if="!template.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{template.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="id ">{{template.id}}</td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="name ">{{template.name}}</td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="description ">{{template.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(template, $event    )" translate="TOOLS.EDIT_TEMPLATE">\n                          Edit Template\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(template, $event    )" translate="TOOLS.DELETE_TEMPLATE">\n                          Delete Template\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.templates.count}}" md-on-paginate="vm.getTemplates" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TEMPLATE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TEMPLATE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-template-button" ng-click="vm.createOrEditTemplate($event)" aria-label="add template" translate translate-attr-aria-label="TOOLS.ADD_TEMPLATE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TEMPLATE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/triggers/create/dialog.html",'<md-dialog class="trigger-dialog" aria-label="New Trigger">\n  <form name="triggerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newTrigger ? \'TOOLS.NEW_TRIGGER\' : \'TOOLS.EDIT_TRIGGER\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trigger.name" required md-autofocus>\n        <div ng-messages="triggerForm[\'name\'].$error" ng-show="triggerForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.trigger.channel" required ng-disabled="!vm.newTrigger">\n          <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n          <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel"> {{ \'TOOLS.OPENCHANNEL\' | translate }}\n          </md-option>\n          <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n          <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n          <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n          <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n          <md-option ng-value="\'whatsapp\'" ng-if="vm.license.whatsapp"> {{ \'TOOLS.WHATSAPP\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="triggerForm[\'channel\'].$error" ng-show="triggerForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trigger.status" aria-label="Status"><span translate="TOOLS.STATUS">Status</span>\n        </md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.trigger.description">\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{ error.message }}</span>\n            <span class="type">({{ error.type }})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTrigger" ng-click="vm.saveTrigger()" class="send-button md-accent md-raised" ng-disabled="triggerForm.$invalid || triggerForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTrigger" ng-click="vm.addNewTrigger()" class="send-button md-accent md-raised" ng-disabled="triggerForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TRIGGER" translate-attr-aria-label="TOOLS.ADD_TRIGGER">\n          ADD TRIGGER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTrigger" ng-click="vm.deleteTrigger($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/actions/actions.html",'<div ng-controller="TriggerActionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\r\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerActions.length">\r\n    <div class="md-toolbar-tools">\r\n      <span class="md-subhead" translate="TOOLS.ACTIONS">Actions</span>\r\n      <ms-search-bar on-search="vm_dc.getTriggerActions()" query="vm_dc.query" debounce="300" direction="down">\r\n      </ms-search-bar>\r\n      <div flex></div>\r\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditTriggerAction($event)" aria-label="add action" translate translate-attr-label="TOOLS.ADD_ACTION">\r\n        <md-icon md-font-icon="icon-plus"></md-icon>\r\n      </md-button>\r\n    </div>\r\n  </md-toolbar>\r\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedTriggerActions.length">\r\n    <div class="md-toolbar-tools">\r\n      <span class="md-subhead">{{ vm_dc.selectedTriggerActions.length }}\r\n        {{ vm_dc.selectedTriggerActions.length > 1 ? \'items\' : \'item\' }} selected</span>\r\n      <div flex></div>\r\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerActions" csv-label="true" filename="triggers.csv">\r\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\r\n      </button>\r\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedTriggerActions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\r\n        <md-icon md-font-icon="icon-delete"></md-icon>\r\n      </md-button>\r\n    </div>\r\n  </md-toolbar>\r\n  <md-table-container class="font-size-12">\r\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedTriggerActions" md-progress="vm_dc.promise">\r\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerActions">\r\n        <tr md-row>\r\n          <th md-column md-order-by="id">\r\n            {{ \'TOOLS.ID\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="action">\r\n            {{ \'TOOLS.ACTION\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="data1">\r\n            {{ \'TOOLS.TYPE\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="data2">\r\n            {{ \'TOOLS.INFO\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="createdAt">\r\n            {{ \'TOOLS.CREATED_AT\' | translate }}\r\n          </th>\r\n          <th md-column width="10px"></th>\r\n        </tr>\r\n      </thead>\r\n      <tbody md-body>\r\n        <tr md-row md-select="action" md-select-id="id" ng-repeat="action in vm_dc.triggerActions.rows">\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ action.id }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ \'TOOLS.\' + (action.action | snakecase | uppercase) | translate }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\'" md-cell>\r\n            {{ action.data1 === \'1\' ? \'CTI URL\' : \'Popup\' }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>\r\n            {{ (vm_dc.lists | filter : {\'id\':(action.data1 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>\r\n            {{ action.data2 === \'1\' ? \'TOOLS.YES\' : \'TOOLS.NO\' | uppercase | translate }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>\r\n            {{ action.data1 }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data1" md-cell>\r\n            {{ action.data1 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data2" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'script\' && action.data2" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'script\' && action.data1" md-cell>\r\n            {{ action.data1 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'jscripty\'" md-cell>\r\n            {{ (vm_dc.projects | filter : {\'id\':(action.data1 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\'" md-cell>\r\n            {{ vm_dc.integrationTypes[action.data1] }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zendesk\'" md-cell>\r\n            {{ (vm_dc.zendeskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'desk\'" md-cell>\r\n            {{ (vm_dc.deskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zoho\'" md-cell>\r\n            {{ (vm_dc.zohoAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'salesforce\'" md-cell>\r\n            {{ (vm_dc.salesforceAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'sugarcrm\'" md-cell>\r\n            {{ (vm_dc.sugarcrmAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshdesk\'" md-cell>\r\n            {{ (vm_dc.freshdeskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'vtiger\'" md-cell>\r\n            {{ (vm_dc.vtigerAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'dynamics365\'" md-cell>\r\n            {{ (vm_dc.dynamics365Accounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'servicenow\'" md-cell>\r\n            {{ (vm_dc.servicenowAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshsales\'" md-cell>\r\n            {{ (vm_dc.freshsalesAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\'" md-cell>\r\n            {{ vm_dc.motionBarOptions[action.data1] }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'1\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'2\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'0\'" md-cell>\r\n            {{ (vm_dc.templates | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 === \'0\'" md-cell>\r\n            {{ (vm_dc.templates | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 === \'1\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ action.createdAt | formatdate }}\r\n          </td>\r\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\r\n            <md-menu>\r\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\r\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\r\n              </md-button>\r\n              <md-menu-content width="3">\r\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\r\n                  <md-button ng-click="vm_dc.createOrEditTriggerAction($event, action)" translate="TOOLS.EDIT_ACTION">\r\n                    Edit Action\r\n                  </md-button>\r\n                </md-menu-item>\r\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\r\n                  <md-button ng-click="vm_dc.deleteConfirm(action, $event)" translate="TOOLS.DELETE_ACTION">\r\n                    Delete Action\r\n                  </md-button>\r\n                </md-menu-item>\r\n              </md-menu-content>\r\n            </md-menu>\r\n          </td>\r\n        </tr>\r\n        <tr md-row ng-if="!vm_dc.triggerActions.rows.length">\r\n          <td md-cell colspan="5">\r\n            <div layout="row" layout-align="center center">\r\n              <span class="text-boxed-light" translate="TOOLS.NO_ACTION_AVAILABLE">No action\r\n                available</span>\r\n            </div>\r\n          </td>\r\n        </tr>\r\n      </tbody>\r\n    </table>\r\n  </md-table-container>\r\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.triggerActions.count }}" md-on-paginate="vm_dc.getTriggerActions" md-page-select>\r\n  </md-table-pagination>\r\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/actions/create/dialog.html",'<md-dialog class="action-dialog" aria-label="New Action">\n  <form name="actionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAction ? \'TOOLS.NEW_ACTION\' : \'TOOLS.EDIT_ACTION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.ACTION">Action</label>\n        <md-select name="action" ng-model="vm.action.action" ng-init="vm.onActionInit()" ng-change="vm.onActionSelection()" md-autofocus required ng-disabled="!vm.newAction">\n          <md-option ng-value="\'contactManager\'" ng-if="vm.trigger.channel == \'voice\'">\n            {{ \'TOOLS.CONTACT_MANAGER\' | translate }} </md-option>\n          <md-option ng-value="\'integration\'" ng-if="vm.trigger.channel == \'voice\' && ((vm.newAction && vm.hasIntegrationsPermissions) || !vm.newAction)">\n            {{ \'TOOLS.INTEGRATIONS\' | translate }} </md-option>\n          <md-option ng-value="\'motionbar\'"> {{ \'TOOLS.MOTIONBAR\' | translate }} </md-option>\n          <md-option ng-value="\'jscripty\'"> {{ \'TOOLS.JSCRIPTY\' | translate }} </md-option>\n          <md-option ng-value="\'urlForward\'"> {{ \'TOOLS.URL_FORWARD\' | translate }} </md-option>\n          <md-option ng-value="\'browser\'"> {{ \'TOOLS.BROWSER\' | translate }} </md-option>\n          <md-option ng-value="\'bot\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.BOT\' | translate }} </md-option>\n          <md-option ng-value="\'script\'"> {{ \'TOOLS.SCRIPT\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'action\'].$error" ng-show="actionForm[\'action\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACTION_REQUIRED">Action field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'jscripty\'" class="md-block">\n        <label translate="TOOLS.PROJECT">Project</label>\n        <md-select name="data1" ng-model="vm.action.data1" required>\n          <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.projects" ng-disabled="data1.canSelect === false">\n            {{ data1.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PROJECT_REQUIRED">Project field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onTypeSelection()" required>\n          <md-option ng-value="\'0\'">Popup</md-option>\n          <md-option ng-value="\'1\'">CTI URL</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.LIST">List</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onListSelection()" required>\n          <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.lists" ng-disabled="data1.canSelect === false">\n            {{ data1.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.SEARCH_FIELDS">Search fields</label>\n        <md-select name="fields" ng-model="vm.action.data3" ng-init="vm.onSearchFieldsInit()" multiple required>\n          <md-optgroup label="{{ \'TOOLS.STANDARD\' | translate }}">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.contactFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.LIST\' | translate }}" ng-if="vm.listFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.listFields">\n              {{ field.name }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.GLOBALS\' | translate }}" ng-if="vm.customFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.customFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SEARCH_FIELDS_REQUIRED">Search fields field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.AUTOCREATECONTACT">Create contact automatically</label>\n        <md-select name="data2" ng-model="vm.action.data2" ng-change="vm.onAutocreateSelection()" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AUTOCREATECONTACT_REQUIRED">AutoCreateContact field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\' && vm.action.data2 === \'1\'" class="md-block">\n        <label translate="TOOLS.AUTOCREATE_FIELD">Autocreate field</label>\n        <md-select name="autocreateField" ng-model="vm.action.data4" ng-required="vm.action.data2 === \'1\'">\n          <md-optgroup label="{{ \'TOOLS.STANDARD\' | translate }}">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.contactFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.LIST\' | translate }}" ng-if="vm.listFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.listFields">\n              {{ field.name }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.GLOBALS\' | translate }}" ng-if="vm.customFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.customFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="actionForm[\'data4\'].$error" ng-show="actionForm[\'data4\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AUTOCREATE_FIELD_REQUIRED">Autocreate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.IGNOREDIALERCONTACTID">Ignore dialer contact Id</label>\n        <md-select name="data5" ng-model="vm.action.data5" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.IGNOREDIALERCONTACTID_REQUIRED">Ignore dialer contact Id field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" required>\n          <md-option ng-value="\'GET\'">GET</md-option>\n          <md-option ng-value="\'POST\'">POST</md-option>\n          <md-option ng-value="\'PUT\'">PUT</md-option>\n          <md-option ng-value="\'DELETE\'">DELETE</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.TIMEOUT">Timeout</label>\n        <input type="number" name="data5" ng-model="vm.action.data5" min="1" max="10" ng-required="true">\n        <div class="hint"><span translate="TOOLS.HELP.TIMEOUT"></span></div>\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n              equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="TOOLS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n              equal than</span> <span>10</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.HEADERS">Headers</label>\n        <textarea name="data6" ng-model="vm.action.data6"></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.HEADERS"></span></div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\' && (vm.action.data1 == \'POST\' || vm.action.data1 == \'PUT\')" class="md-block">\n        <label translate="TOOLS.BODY">Body</label>\n        <textarea name="data7" ng-model="vm.action.data7"></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.BODY"></span></div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT_TYPE">Script_Type</label>\n        <input type="input" name="data2" ng-model="vm.action.data2">\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT_TYPE"></span></div>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_TYPE_REQUIRED">Script_Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT_INFO">Script_Info</label>\n        <input type="input" name="data1" ng-model="vm.action.data1">\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT_INFO"></span></div>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_INFO_REQUIRED">Script_Info field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT">Script</label>\n        <textarea name="data3" ng-model="vm.action.data3" required></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT"></span></div>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_REQUIRED">Script field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\'" class="md-block">\n        <label translate="TOOLS.INTEGRATION">Integration</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-init="vm.onIntegrationInit()" ng-change="vm.onIntegrationSelection()" required>\n          <md-option ng-value="\'desk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1306]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1306])">Desk</md-option>\n          <md-option ng-value="\'dynamics365\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1309]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1309])">Dynamics365</md-option>\n          <md-option ng-value="\'freshdesk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1303]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1303])">Freshdesk</md-option>\n          <md-option ng-value="\'freshsales\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1304]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1304])">Freshsales</md-option>\n          <md-option ng-value="\'salesforce\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1302]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1302])">Salesforce</md-option>\n          <md-option ng-value="\'servicenow\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1310]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1310])">ServiceNow</md-option>\n          <md-option ng-value="\'sugarcrm\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1305]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1305])">SugarCRM</md-option>\n          <md-option ng-value="\'vtiger\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1308]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1308])">vTiger</md-option>\n          <md-option ng-value="\'zendesk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1301]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1301])">Zendesk</md-option>\n          <md-option ng-value="\'zoho\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1307]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1307])">Zoho</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.INTEGRATION_REQUIRED">Integration field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\' && vm.action.data1" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="data2" ng-model="vm.action.data2" ng-change="vm.onIntegrationAccountSelection()" ng-disabled="vm.action.isIntegrationDisabled" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.accounts">{{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\'  && vm.action.data1 && vm.action.data2" class="md-block">\n        <label translate="TOOLS.CONFIGURATION">Configuration</label>\n        <md-select name="data3" ng-model="vm.action.data3" required ng-disabled="vm.action.isIntegrationDisabled">\n          <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.configurations | filter : { AccountId: (vm.action.data2 | toInteger) } : true">{{\n            data3.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CONFIGURATION_REQUIRED">Configuration field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onTypeSelection()" required>\n          <md-option ng-value="\'0\'">Popup</md-option>\n          <md-option ng-value="\'1\'">CTI URL</md-option>\n          <md-option ng-value="\'2\'">Windows App</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'2\'" class="md-block">\n        <label translate="TOOLS.APPLICATION">Application</label>\n        <input type="text" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'2\'" class="md-block">\n        <label translate="TOOLS.ARGUMENTS">Arguments</label>\n        <input type="text" name="data3" ng-model="vm.action.data3">\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ARGUMENTS_REQUIRED">Arguments field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'0\'" class="md-block">\n        <label translate="TOOLS.TEMPLATE">Template</label>\n        <md-select name="data2" ng-model="vm.action.data2" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.templates" ng-disabled="data2.canSelect === false">\n            {{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TEMPLATE_REQUIRED">Template field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'0\'" class="md-block">\n        <label translate="TOOLS.TEMPLATE">Template</label>\n        <md-select name="data2" ng-model="vm.action.data2" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.templates" ng-disabled="data2.canSelect === false">\n            {{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TEMPLATE_REQUIRED">Template field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="(vm.action.action == \'motionbar\' || vm.action.action == \'browser\') && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.EVENTVARIABLES">EventVariables</label>\n        <md-select name="data3" ng-model="vm.action.data3" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div class="hint"><span translate="TOOLS.HELP.EVENTVARIABLES"></span></div>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EVENTVARIABLES_REQUIRED">EventVariables field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.LOCATION">Location</label>\n        <md-select name="data4" ng-model="vm.action.data4" required ng-change="vm.onActionLocationChange()">\n          <md-option ng-value="0"> {{ \'TOOLS.NEW_TAB\' | translate }} </md-option>\n          <md-option ng-value="1"> {{ \'TOOLS.NEW_WINDOW\' | translate }} </md-option>\n          <md-option ng-value="2"> {{ \'TOOLS.MOTION_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data4\'].$error" ng-show="actionForm[\'data4\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LOCATION_REQUIRED">Location field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data4 == \'1\'" class="md-block">\n        <label translate="TOOLS.WINDOWWIDTH">WindowWidth</label>\n        <input type="text" name="data5" ng-model="vm.action.data5">\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.WINDOWWIDTH_REQUIRED">WindowWidth field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data4 == \'1\'" class="md-block">\n        <label translate="TOOLS.WINDOWHEIGHT">WindowHeight</label>\n        <input type="text" name="data6" ng-model="vm.action.data6">\n        <div ng-messages="actionForm[\'data6\'].$error" ng-show="actionForm[\'data6\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.WINDOWHEIGHT_REQUIRED">WindowHeight field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAction" ng-click="vm.saveAction()" class="send-button md-accent md-raised" ng-disabled="actionForm.$invalid || actionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAction" ng-click="vm.addNewAction()" class="send-button md-accent md-raised" ng-disabled="actionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ACTION" translate-attr-aria-label="TOOLS.ADD_ACTION">\n          ADD ACTION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAction" ng-click="vm.deleteAction($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/allconditions/allconditions.html",'<div ng-controller="TriggerAllConditionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedAllConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="TOOLS.ALLCONDITIONS">All Conditions</span>\n      <ms-search-bar on-search="vm_dc.getAllConditions()" query="vm_dc.query" debounce="300" direction="down">\n      </ms-search-bar>\n      <div flex></div>\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditAllCondition($event)" aria-label="add allCondition" translate translate-attr-label="TOOLS.ADD_ALLCONDITION">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedAllConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{ vm_dc.selectedAllConditions.length }}\n        {{ vm_dc.selectedAllConditions.length > 1 ? \'items\' : \'item\' }} selected</span>\n      <div flex></div>\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedAllConditions" csv-label="true" filename="triggers.csv">\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\n      </button>\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedAllConditions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n        <md-icon md-font-icon="icon-delete"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container class="font-size-12">\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedAllConditions" md-progress="vm_dc.promise">\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getAllConditions">\n        <tr md-row>\n          <th md-column md-order-by="id">\n            {{ \'TOOLS.ID\' | translate }}\n          </th>\n          <th md-column md-order-by="field">\n            {{ \'TOOLS.FIELD\' | translate }}\n          </th>\n          <th md-column md-order-by="operator">\n            {{ \'TOOLS.OPERATOR\' | translate }}\n          </th>\n          <th md-column md-order-by="value">\n            {{ \'TOOLS.VALUE\' | translate }}\n          </th>\n          <th md-column md-order-by="createdAt">\n            {{ \'TOOLS.CREATED_AT\' | translate }}\n          </th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row md-select="allCondition" md-select-id="id" ng-repeat="allCondition in vm_dc.allConditions.rows">\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ allCondition.id }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ \'TOOLS.\' + vm_dc.fields[allCondition.field] | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ \'TOOLS.\' + allCondition.operator | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="!allCondition.value" md-cell>\n            {{ allCondition.value }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.chatWebsites | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.mailAccounts | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'sms\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.smsAccounts | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'whatsapp\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.whatsappAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'fax\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.faxAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'openchannel\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.openchannelAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'queue\'" md-cell>\n            {{ (vm_dc.queues | filter : {\'name\':allCondition.value} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'routeId\'" md-cell>\n            {{ (vm_dc.outboundRoutes | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].exten }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'agent\'" md-cell>\n            {{ (vm_dc.agents | filter : {\'name\':allCondition.value} : true)[0].fullname }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'lastevent\'" md-cell>\n            {{ vm_dc.callStatuses[allCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'interaction\'" md-cell>\n            {{ allCondition.value | capitalize }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'message\'" md-cell>\n            {{ vm_dc.messageStatuses[allCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'mailSubstatus\'" md-cell>\n            {{ allCondition.value === \'null\' ? (\'TOOLS.NONE\' | translate) : (vm_dc.mailSubstatuses | filter : {\'name\': allCondition.value } : true)[0].name }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'offlineMessage\'" md-cell>\n            {{allCondition.value}} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ allCondition.createdAt | formatdate }}\n          </td>\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="3">\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                  <md-button ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" translate="TOOLS.EDIT_ALLCONDITION">\n                    Edit AllCondition\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                  <md-button ng-click="vm_dc.deleteConfirm(allCondition, $event)" translate="TOOLS.DELETE_ALLCONDITION">\n                    Delete AllCondition\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n        <tr md-row ng-if="!vm_dc.allConditions.rows.length">\n          <td md-cell colspan="5">\n            <div layout="row" layout-align="center center">\n              <span class="text-boxed-light" translate="TOOLS.NO_ALLCONDITION_AVAILABLE">No condition\n                available</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.allConditions.count }}" md-on-paginate="vm_dc.getAllConditions" md-page-select>\n  </md-table-pagination>\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/allconditions/create/dialog.html",'<md-dialog class="allCondition-dialog" aria-label="New AllCondition">\n  <form name="allConditionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAllCondition ? \'TOOLS.NEW_ALLCONDITION\' : \'TOOLS.EDIT_ALLCONDITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.FIELD">Field</label>\n        <md-select name="field" ng-model="vm.allCondition.field" ng-change="vm.onFieldSelection()" md-autofocus required>\n          <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.AGENT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'">\n            {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n          <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'mailSubstatus\'" ng-if="vm.trigger.channel == \'mail\'"> {{ \'TOOLS.MAIL_SUBSTATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'offlineMessage\'" ng-if="vm.trigger.channel == \'chat\'"> {{ \'TOOLS.OFFLINE_MESSAGE\' | translate }}\n          </md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'field\'].$error" ng-show="allConditionForm[\'field\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FIELD_REQUIRED">Field field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OPERATOR">Operator</label>\n        <md-select name="operator" ng-model="vm.allCondition.operator" required>\n          <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n          <md-option ng-value="\'not_equals\'"> {{ \'TOOLS.NOT_EQUALS\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'operator\'].$error" ng-show="allConditionForm[\'operator\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'account\'" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.accounts" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'queue\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.QUEUE">Queue</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.queues" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'routeId\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">\n            {{ value.exten }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'agent\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.AGENT">Agent</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.agents" ng-disabled="value.canSelect === false">\n            {{ value.fullname }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'lastevent\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="status.value" ng-repeat="status in vm.callStatuses">\n            {{ status.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'mailSubstatus\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="mailSubstatus.name" ng-repeat="mailSubstatus in vm.mailSubstatuses">\n            {{ mailSubstatus.name }}</md-option>\n          <md-option ng-value="\'null\'">{{\'TOOLS.NONE\' | translate}}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'interaction\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'opened\'">Opened</md-option>\n          <md-option ng-value="\'closed\'">Closed</md-option>\n          <md-option ng-if="vm.trigger.channel==\'mail\'" ng-value="\'substatus\'">SubStatus</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'message\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'in\'">Incoming</md-option>\n          <md-option ng-value="\'out\'">Outgoing</md-option>\n          <md-option ng-value="\'accept\'">Accepted</md-option>\n          <md-option ng-value="\'reject\'">Rejected</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'offlineMessage\' && vm.trigger.channel == \'chat\'" class="md-block">\n        <label translate="TOOLS.CHAT">Chat</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'created\'">Created</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAllCondition" ng-click="vm.saveAllCondition()" class="send-button md-accent md-raised" ng-disabled="allConditionForm.$invalid || allConditionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAllCondition" ng-click="vm.addNewAllCondition()" class="send-button md-accent md-raised" ng-disabled="allConditionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ALLCONDITION" translate-attr-aria-label="TOOLS.ADD_ALLCONDITION">\n          ADD ALLCONDITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAllCondition" ng-click="vm.deleteAllCondition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/anyconditions/anyconditions.html",'<div ng-controller="TriggerAnyConditionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedAnyConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="TOOLS.ANYCONDITIONS">AnyConditions</span>\n      <ms-search-bar on-search="vm_dc.getAnyConditions()" query="vm_dc.query" debounce="300" direction="down"></ms-search-bar>\n      <div flex></div>\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditAnyCondition($event)" aria-label="add anyCondition" translate translate-attr-label="TOOLS.ADD_ANYCONDITION">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedAnyConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{ vm_dc.selectedAnyConditions.length }}\n        {{ vm_dc.selectedAnyConditions.length > 1 ? \'items\' : \'item\' }} selected</span>\n      <div flex></div>\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedAnyConditions" csv-label="true" filename="triggers.csv">\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\n      </button>\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedAnyConditions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n        <md-icon md-font-icon="icon-delete"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container class="font-size-12">\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedAnyConditions" md-progress="vm_dc.promise">\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getAnyConditions">\n        <tr md-row>\n          <th md-column md-order-by="id">\n            {{ \'TOOLS.ID\' | translate }}\n          </th>\n          <th md-column md-order-by="field">\n            {{ \'TOOLS.FIELD\' | translate }}\n          </th>\n          <th md-column md-order-by="operator">\n            {{ \'TOOLS.OPERATOR\' | translate }}\n          </th>\n          <th md-column md-order-by="value">\n            {{ \'TOOLS.VALUE\' | translate }}\n          </th>\n          <th md-column md-order-by="createdAt">\n            {{ \'TOOLS.CREATED_AT\' | translate }}\n          </th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row md-select="anyCondition" md-select-id="id" ng-repeat="anyCondition in vm_dc.anyConditions.rows">\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ anyCondition.id}}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ \'TOOLS.\' + vm_dc.fields[anyCondition.field] | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ \'TOOLS.\' + anyCondition.operator | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="!anyCondition.value" md-cell>\n            {{ anyCondition.value }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.chatWebsites | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.mailAccounts | filter : {\'id\':(anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'sms\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.smsAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, allCondition)" ng-if="vm.trigger.channel == \'whatsapp\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.whatsappAccounts | filter : {\'id\':(anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'fax\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.faxAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'openchannel\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.openchannelAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'queue\'" md-cell>\n            {{ (vm_dc.queues | filter : {\'name\':anyCondition.value} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'routeId\'" md-cell>\n            {{ (vm_dc.outboundRoutes | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].exten }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'agent\'" md-cell>\n            {{ (vm_dc.agents | filter : {\'name\':anyCondition.value} : true)[0].fullname }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'lastevent\'" md-cell>\n            {{ vm_dc.callStatuses[anyCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'interaction\'" md-cell>\n            {{ anyCondition.value | capitalize }} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'message\'" md-cell>\n            {{ vm_dc.messageStatuses[anyCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'mailSubstatus\'" md-cell>\n            {{ anyCondition.value === \'null\' ? (\'TOOLS.NONE\' | translate) : (vm_dc.mailSubstatuses | filter : {\'name\': anyCondition.value } : true)[0].name }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'offlineMessage\'" md-cell>\n            {{anyCondition.value}} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ anyCondition.createdAt | formatdate }}\n          </td>\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="3">\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                  <md-button ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" translate="TOOLS.EDIT_ANYCONDITION">\n                    Edit AnyCondition\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                  <md-button ng-click="vm_dc.deleteConfirm(anyCondition, $event)" translate="TOOLS.DELETE_ANYCONDITION">\n                    Delete AnyCondition\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n        <tr md-row ng-if="!vm_dc.anyConditions.rows.length">\n          <td md-cell colspan="5">\n            <div layout="row" layout-align="center center">\n              <span class="text-boxed-light" translate="TOOLS.NO_ANYCONDITION_AVAILABLE">No anycondition\n                available</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.anyConditions.count }}" md-on-paginate="vm_dc.getAnyConditions" md-page-select>\n  </md-table-pagination>\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/anyconditions/create/dialog.html",'<md-dialog class="anyCondition-dialog" aria-label="New AnyCondition">\n  <form name="anyConditionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAnyCondition ? \'TOOLS.NEW_ANYCONDITION\' : \'TOOLS.EDIT_ANYCONDITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.FIELD">Field</label>\n        <md-select name="field" ng-model="vm.anyCondition.field" ng-change="vm.onFieldSelection()" md-autofocus required>\n          <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.AGENT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'">\n            {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n          <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'mailSubstatus\'" ng-if="vm.trigger.channel == \'mail\'"> {{ \'TOOLS.MAIL_SUBSTATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'offlineMessage\'" ng-if="vm.trigger.channel == \'chat\'"> {{ \'TOOLS.OFFLINE_MESSAGE\' | translate }}\n          </md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'field\'].$error" ng-show="anyConditionForm[\'field\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FIELD_REQUIRED">Field field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OPERATOR">Operator</label>\n        <md-select name="operator" ng-model="vm.anyCondition.operator" required>\n          <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n          <md-option ng-value="\'not_equals\'"> {{ \'TOOLS.NOT_EQUALS\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'operator\'].$error" ng-show="anyConditionForm[\'operator\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'account\'" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.accounts" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'queue\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.QUEUE">Queue</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.queues" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'routeId\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">\n            {{ value.exten }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'agent\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.AGENT">Agent</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.agents" ng-disabled="value.canSelect === false">\n            {{ value.fullname }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'lastevent\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="status.value" ng-repeat="status in vm.callStatuses">\n            {{ status.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'mailSubstatus\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="mailSubstatus.name" ng-repeat="mailSubstatus in vm.mailSubstatuses">\n            {{ mailSubstatus.name }}</md-option>\n          <md-option ng-value="\'null\'">{{\'TOOLS.NONE\' | translate}}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'interaction\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'opened\'">Opened</md-option>\n          <md-option ng-value="\'closed\'">Closed</md-option>\n          <md-option ng-if="vm.trigger.channel==\'mail\'" ng-value="\'substatus\'">SubStatus</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'message\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'in\'">Incoming</md-option>\n          <md-option ng-value="\'out\'">Outgoing</md-option>\n          <md-option ng-value="\'accept\'">Accepted</md-option>\n          <md-option ng-value="\'reject\'">Rejected</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'offlineMessage\' && vm.trigger.channel == \'chat\'" class="md-block">\n        <label translate="TOOLS.CHAT">Chat</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'created\'">Created</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAnyCondition" ng-click="vm.saveAnyCondition()" class="send-button md-accent md-raised" ng-disabled="anyConditionForm.$invalid || anyConditionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAnyCondition" ng-click="vm.addNewAnyCondition()" class="send-button md-accent md-raised" ng-disabled="anyConditionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ANYCONDITION" translate-attr-aria-label="TOOLS.ADD_ANYCONDITION">\n          ADD ANYCONDITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAnyCondition" ng-click="vm.deleteAnyCondition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/view.html",'<div id="tools-trigger" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-triggers-button md-icon-button" aria-label="Go to triggers" ng-click="vm.gotoTriggers()" translate translate-attr-aria-label="TOOLS.GO_TO_TRIGGERS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="trigger-image" hide-xs>\n          <img ng-src="assets/images/business/triggers.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">#{{ vm.trigger.id }}\n            <span ng-if="vm.trigger.name">{{ vm.trigger.name }}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{ vm.trigger.createdAt | date:\'medium\' }}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTrigger()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (allconditionsForm.$invalid) || (anyconditionsForm.$invalid) || (actionsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trigger-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.trigger.name" required autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CHANNEL">Channel</label>\n                <md-select name="channel" ng-model="vm.trigger.channel" required disabled>\n                  <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n                  <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel">\n                    {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n                  <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n                  <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n                  <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n                  <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n                  <md-option ng-value="\'whatsapp\'" ng-if="vm.license.whatsapp"> {{ \'TOOLS.WHATSAPP\' | translate }}\n                  </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'channel\'].$error" ng-show="generalForm[\'channel\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.trigger.status" aria-label="Status" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="TOOLS.STATUS">Status</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.trigger.description" ng-disabled="!vm.crudPermissions.canEdit">\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.CONDITIONS&ACTIONS">CONDITIONS&ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trigger-detail-form-container allconditions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/allconditions/allconditions.html\'">\n          </div>\n          <div class="trigger-detail-form-container anyconditions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/anyconditions/anyconditions.html\'">\n          </div>\n          <div class="trigger-detail-form-container actions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/actions/actions.html\'">\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/tools/views/triggers/triggers.html",'<div id="triggers" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TRIGGERS">Triggers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTriggers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedTriggers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-triggers-count">\n          <span>{{ vm.selectedTriggers.length }}</span>\n          <span translate="TOOLS.SELECTED">Selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTriggers()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTriggers()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTriggers" csv-label="true" filename="triggers.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTriggers($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      \x3c!-- TRIGGER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTriggers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTriggers">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="channel">{{ \'TOOLS.CHANNEL\' | translate }}</th>\n                <th md-column md-order-by="status">{{ \'TOOLS.STATUS\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.triggers.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="trigger" md-select-id="id" ng-repeat="trigger in vm.triggers.rows">\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="id ">{{ trigger.id }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="name ">{{ trigger.name }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="channel ">\n                  {{ \'TOOLS.\' + trigger.channel | uppercase | translate }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="status ">\n                  <md-icon md-colors="{color: {{ trigger.status ? \'\\\'green\\\'\' : \'\\\'grey\\\'\' }}}" md-font-icon="{{ trigger.status ? \'icon-check\' : \'icon-close\' }}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="description ">\n                  {{ trigger.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.goToEditState(trigger)" translate="TOOLS.EDIT_TRIGGER">\n                          Edit Trigger\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(trigger, $event)" translate="TOOLS.DELETE_TRIGGER">\n                          Delete Trigger\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.triggers.count }}" md-on-paginate="vm.getTriggers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TRIGGER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n  \x3c!-- ADD TRIGGER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-trigger-button" ng-click="vm.createOrEditTrigger($event)" aria-label="add trigger" translate translate-attr-aria-label="TOOLS.ADD_TRIGGER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TRIGGER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/trunks/create/dialog.html",'<md-dialog class="trunk-dialog" aria-label="New Trunk">\n  <form name="trunkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newTrunk">\n\n        <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n        <div ng-messages="trunkForm[\'name\'].$error" ng-show="trunkForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trunk.active" aria-label="active"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.HOST">host</label>\n        <input type="text" name="host" ng-model="vm.trunk.host" ng-required="true">\n\n        <div class="hint"><span translate="TOOLS.HELP.HOST"></span></div>\n        <div ng-messages="trunkForm[\'host\'].$error" ng-show="trunkForm[\'host\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.HOST_REQUIRED">host field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.SECRET">secret</label>\n        <input type="password" name="secret" ng-model="vm.trunk.secret" placeholder="Password" translate translate-attr-placeholder="TOOLS.PASSWORD">\n        <div class="hint"><span translate="TOOLS.HELP.SECRET"></span></div>\n        <div ng-messages="trunkForm[\'secret\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DEFAULTUSER">defaultuser</label>\n        <input type="text" name="defaultuser" ng-model="vm.trunk.defaultuser">\n\n        <div class="hint"><span translate="TOOLS.HELP.DEFAULTUSER"></span></div>\n        <div ng-messages="trunkForm[\'defaultuser\'].$error" ng-show="trunkForm[\'defaultuser\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DEFAULTUSER_REQUIRED">defaultuser field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.REGISTRY">registry</label>\n        <input type="text" name="registry" ng-model="vm.trunk.registry">\n\n        <div class="hint"><span translate="TOOLS.HELP.REGISTRY"></span></div>\n        <div ng-messages="trunkForm[\'registry\'].$error" ng-show="trunkForm[\'registry\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REGISTRY_REQUIRED">registry field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.trunk.description">\n\n        <div ng-messages="trunkForm[\'description\'].$error" ng-show="trunkForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTrunk" ng-click="vm.saveTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid || trunkForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTrunk" ng-click="vm.addNewTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TRUNK" translate-attr-aria-label="TOOLS.ADD_TRUNK">\n          ADD TRUNK\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTrunk" ng-click="vm.deleteTrunk($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/trunks/edit/clone/clone.html",'<md-dialog class="trunk-dialog" aria-label="Clone Trunk">\n  <form name="trunkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newTrunk">\n\n        <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n        <div ng-messages="trunkForm[\'name\'].$error" ng-show="trunkForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trunk.active" aria-label="active"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid" aria-label="CLONE" translate="TOOLS.CLONE_TRUNK" translate-attr-aria-label="TOOLS.CLONE_TRUNK">\n        CLONE TRUNK\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/trunks/edit/view.html",'<div id="tools-trunk" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-trunks-button md-icon-button" aria-label="Go to trunks" ng-click="vm.gotoTrunks()" translate translate-attr-aria-label="TOOLS.GO_TO_TRUNKS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="trunk-image" hide-xs>\n          <img ng-src="assets/images/business/trunks.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.trunk.id}}\n            <span ng-if="vm.trunk.name">{{vm.trunk.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.trunk.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.trunk, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="TOOLS.GOTO_TRUNK"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.trunk, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="TOOLS.CLONE_TRUNK"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTrunk()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (advancedForm.$invalid) || (otherFieldsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.trunk.active" aria-label="active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.HOST">host</label>\n                <input type="text" name="host" ng-model="vm.trunk.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.HOST"></span></div>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.HOST_REQUIRED">host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.SECRET">secret</label>\n                <input type="password" name="secret" ng-model="vm.trunk.secret" placeholder="Password" translate translate-attr-placeholder="TOOLS.PASSWORD">\n                <div class="hint"><span translate="TOOLS.HELP.SECRET"></span></div>\n                <div ng-messages="generalForm[\'secret\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="TOOLS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DEFAULTUSER">defaultuser</label>\n                <input type="text" name="defaultuser" ng-model="vm.trunk.defaultuser" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.DEFAULTUSER"></span></div>\n                <div ng-messages="generalForm[\'defaultuser\'].$error" ng-show="generalForm[\'defaultuser\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DEFAULTUSER_REQUIRED">defaultuser field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CONTEXT">context</label>\n                <md-select name="context" ng-model="vm.trunk.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.CONTEXT"></span></div>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CONTEXT_REQUIRED">context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALLERID">callerid</label>\n                <input type="text" name="callerid" ng-model="vm.trunk.callerid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.CALLERID"></span></div>\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALLERID_REQUIRED">callerid field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.trunk.type" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'friend\'">Friend</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                  <md-option ng-value="\'peer\'">Peer</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TYPE"></span></div>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DTMFMODE">dtmfmode</label>\n                <md-select name="dtmfmode" ng-model="vm.trunk.dtmfmode" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'rfc2833\'">rfc2833</md-option>\n                  <md-option ng-value="\'info\'">info</md-option>\n                  <md-option ng-value="\'shortinfo\'">shortinfo</md-option>\n                  <md-option ng-value="\'inband\'">inband</md-option>\n                  <md-option ng-value="\'auto\'">auto</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.DTMFMODE"></span></div>\n                <div ng-messages="generalForm[\'dtmfmode\'].$error" ng-show="generalForm[\'dtmfmode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DTMFMODE_REQUIRED">dtmfmode field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAT">nat</label>\n                <md-select name="nat" ng-model="vm.trunk.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAT_REQUIRED">nat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.QUALIFY">qualify</label>\n                <md-select name="qualify" ng-model="vm.trunk.qualify" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.QUALIFY"></span></div>\n                <div ng-messages="generalForm[\'qualify\'].$error" ng-show="generalForm[\'qualify\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.QUALIFY_REQUIRED">qualify field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.trunk.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g723\'">g723</md-option>\n                  <md-option ng-value="\'g726\'">g726</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'ilbc\'">ilbc</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.INSECURE">insecure</label>\n                <md-select name="insecure" ng-model="vm.trunk.insecure" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'port\'">port</md-option>\n                  <md-option ng-value="\'invite\'">invite</md-option>\n                  <md-option ng-value="\'very\'">very</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.INSECURE"></span></div>\n                <div ng-messages="generalForm[\'insecure\'].$error" ng-show="generalForm[\'insecure\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.INSECURE_REQUIRED">insecure field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALL_LIMIT">call_limit</label>\n                <input type="number" name="call_limit" ng-model="vm.trunk.call_limit" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.CALL_LIMIT"></span></div>\n                <div ng-messages="generalForm[\'call_limit\'].$error" ng-show="generalForm[\'call_limit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALL_LIMIT_REQUIRED">call_limit field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.trunk.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.REGISTRY">registry</label>\n                <input type="text" name="registry" ng-model="vm.trunk.registry" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.REGISTRY"></span></div>\n                <div ng-messages="advancedForm[\'registry\'].$error" ng-show="advancedForm[\'registry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.REGISTRY_REQUIRED">registry field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DIRECTMEDIA">directmedia</label>\n                <md-select name="directmedia" ng-model="vm.trunk.directmedia" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'nonat\'">nonat</md-option>\n                  <md-option ng-value="\'update\'">update</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.DIRECTMEDIA"></span></div>\n                <div ng-messages="advancedForm[\'directmedia\'].$error" ng-show="advancedForm[\'directmedia\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DIRECTMEDIA_REQUIRED">directmedia field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALLCOUNTER">callcounter</label>\n                <md-select name="callcounter" ng-model="vm.trunk.callcounter" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.CALLCOUNTER"></span></div>\n                <div ng-messages="advancedForm[\'callcounter\'].$error" ng-show="advancedForm[\'callcounter\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALLCOUNTER_REQUIRED">callcounter field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.FROMDOMAIN">fromdomain</label>\n                <input type="text" name="fromdomain" ng-model="vm.trunk.fromdomain" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.FROMDOMAIN"></span></div>\n                <div ng-messages="advancedForm[\'fromdomain\'].$error" ng-show="advancedForm[\'fromdomain\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.FROMDOMAIN_REQUIRED">fromdomain field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.FROMUSER">fromuser</label>\n                <input type="text" name="fromuser" ng-model="vm.trunk.fromuser" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.FROMUSER"></span></div>\n                <div ng-messages="advancedForm[\'fromuser\'].$error" ng-show="advancedForm[\'fromuser\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.FROMUSER_REQUIRED">fromuser field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.OUTBOUNDPROXY">outboundproxy</label>\n                <input type="text" name="outboundproxy" ng-model="vm.trunk.outboundproxy" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.OUTBOUNDPROXY"></span></div>\n                <div ng-messages="advancedForm[\'outboundproxy\'].$error" ng-show="advancedForm[\'outboundproxy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.OUTBOUNDPROXY_REQUIRED">outboundproxy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ADD_PHONE_TO_URI">Add_phone_to_URI</label>\n                <md-select name="usereqphone" ng-model="vm.trunk.usereqphone" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ADD_PHONE_TO_URI"></span></div>\n                <div ng-messages="advancedForm[\'usereqphone\'].$error" ng-show="advancedForm[\'usereqphone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ADD_PHONE_TO_URI_REQUIRED">Add_phone_to_URI field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TRUST_REMOTE_PARTY_ID">Trust_Remote_Party_ID</label>\n                <md-select name="trustrpid" ng-model="vm.trunk.trustrpid" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TRUST_REMOTE_PARTY_ID"></span></div>\n                <div ng-messages="advancedForm[\'trustrpid\'].$error" ng-show="advancedForm[\'trustrpid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TRUST_REMOTE_PARTY_ID_REQUIRED">Trust_Remote_Party_ID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.SEND_REMOTE_PARTY_ID_HEADER">Send_Remote_Party_ID_header</label>\n                <md-select name="sendrpid" ng-model="vm.trunk.sendrpid" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n\n                  <md-option ng-value="\'pai\'"> {{ \'TOOLS.PAI\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.SEND_REMOTE_PARTY_ID_HEADER"></span></div>\n                <div ng-messages="advancedForm[\'sendrpid\'].$error" ng-show="advancedForm[\'sendrpid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.SEND_REMOTE_PARTY_ID_HEADER_REQUIRED">Send_Remote_Party_ID_header field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ENCRYPTION">encryption</label>\n                <md-select name="encryption" ng-model="vm.trunk.encryption" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ENCRYPTION"></span></div>\n                <div ng-messages="advancedForm[\'encryption\'].$error" ng-show="advancedForm[\'encryption\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ENCRYPTION_REQUIRED">encryption field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.PORT">port</label>\n                <input type="number" name="port" ng-model="vm.trunk.port" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.PORT"></span></div>\n                <div ng-messages="advancedForm[\'port\'].$error" ng-show="advancedForm[\'port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.PORT_REQUIRED">port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.trunk.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TRANSPORT"></span></div>\n                <div ng-messages="advancedForm[\'transport\'].$error" ng-show="advancedForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.T38PT_UDPTL">t38pt_udptl</label>\n                <input type="string" name="t38pt_udptl" ng-model="vm.trunk.t38pt_udptl" value="no" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.T38PT_UDPTL"></span></div>\n                <div ng-messages="advancedForm[\'t38pt_udptl\'].$error" ng-show="advancedForm[\'t38pt_udptl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.T38PT_UDPTL_REQUIRED">t38pt_udptl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.trunk.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'videosupport\'].$error" ng-show="advancedForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.OTHERFIELDS">OTHERFIELDS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container otherfields md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.OTHERFIELDS">OTHERFIELDS</div>\n            </div>\n            <form name="otherFieldsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.OTHERFIELDS">otherFields</label>\n                <textarea name="otherFields" ng-model="vm.trunk.otherFields" autofocus></textarea>\n                <div class="hint"><span translate="TOOLS.HELP.OTHERFIELDS"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/trunks/trunks.html",'<div id="trunks" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TRUNKS">Trunks</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTrunks.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTrunks =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-trunks-count">\n          <span>{{vm.selectedTrunks.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTrunks()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTrunks()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTrunks" csv-label="true" filename="trunks.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTrunks($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TRUNK TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTrunks" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'TOOLS.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="host">{{ \'TOOLS.HOST\' | translate }}</th>\n                <th md-column md-order-by="registry">{{ \'TOOLS.REGISTRY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.trunks.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="trunk" md-select-id="id" ng-repeat="trunk in vm.trunks.rows">\n                <td md-cell ng-if="trunk.userpic"><img class="avatar" alt="{{trunk.name}}" ng-src="api/users/{{trunk.id}}/avatar" /></td>\n                <td md-cell ng-if="!trunk.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{trunk.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="id ">{{trunk.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="name ">{{trunk.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{trunk.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{trunk.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="host ">{{trunk.host}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="registry ">{{trunk.registry}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="description ">{{trunk.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(trunk, $event    )" translate="TOOLS.EDIT_TRUNK">\n                          Edit Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(trunk, $event    )" translate="TOOLS.CLONE_TRUNK">\n                          clone Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(trunk, $event    )" translate="TOOLS.GOTOREALTIME_TRUNK">\n                          goToRealtime Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(trunk, $event    )" translate="TOOLS.DELETE_TRUNK">\n                          Delete Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.trunks.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TRUNK TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TRUNK BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-trunk-button" ng-click="vm.createOrEditTrunk($event)" aria-label="add trunk" translate translate-attr-aria-label="TOOLS.ADD_TRUNK">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TRUNK BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/variables/create/dialog.html",'<md-dialog class="variable-dialog" aria-label="New Variable">\n  <form name="variableForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.variable.name" ng-required="true" autofocus>\n\n        <div ng-messages="variableForm[\'name\'].$error" ng-show="variableForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.variable.description">\n\n        <div ng-messages="variableForm[\'description\'].$error" ng-show="variableForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVariable" ng-click="vm.saveVariable()" class="send-button md-accent md-raised" ng-disabled="variableForm.$invalid || variableForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVariable" ng-click="vm.addNewVariable()" class="send-button md-accent md-raised" ng-disabled="variableForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_VARIABLE" translate-attr-aria-label="TOOLS.ADD_VARIABLE">\n          ADD VARIABLE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVariable" ng-click="vm.deleteVariable($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/variables/variables.html",'<div id="variables" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.VARIABLES">Variables</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVariables.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVariables =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-variables-count">\n          <span>{{vm.selectedVariables.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVariables()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVariables()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVariables" csv-label="true" filename="variables.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVariables($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VARIABLE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVariables" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVariables">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.variables.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="variable" md-select-id="id" ng-repeat="variable in vm.variables.rows">\n                <td md-cell ng-if="variable.userpic"><img class="avatar" alt="{{variable.name}}" ng-src="api/users/{{variable.id}}/avatar" /></td>\n                <td md-cell ng-if="!variable.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{variable.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="id ">{{variable.id}}</td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="name ">{{variable.name}}</td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="description ">{{variable.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(variable, $event    )" translate="TOOLS.EDIT_VARIABLE">\n                          Edit Variable\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(variable, $event    )" translate="TOOLS.DELETE_VARIABLE">\n                          Delete Variable\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.variables.count}}" md-on-paginate="vm.getVariables" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VARIABLE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VARIABLE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-variable-button" ng-click="vm.createOrEditVariable($event)" aria-label="add variable" translate translate-attr-aria-label="TOOLS.ADD_VARIABLE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VARIABLE BUTTON --\x3e\n</div>'),e.put("app/main/apps/video/views/screenRecordings/create/dialog.html",'<md-dialog class="screenRecording-dialog" aria-label="New screenRecording">\n  <form name="screenRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VIDEO.RATING">Rating</label>\n        <md-select name="rating" ng-model="vm.screenRecording.rating" autofocus ng-disabled="!vm.newscreenRecording && !vm.crudPermissions.canEdit">\n          <md-option ng-value="null">{{\'VIDEO.NO_RATING\' | translate}}</md-option>\n          <md-option value="1">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n          </md-option>\n          <md-option value="2">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n          </md-option>\n          <md-option value="3">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n          </md-option>\n          <md-option value="4">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n          </md-option>\n          <md-option value="5">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n          </md-option>\n        </md-select>\n        <div ng-messages="screenRecordingForm[\'rating\'].$error" ng-show="screenRecordingForm[rating].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VIDEO.ERRORS.RATING_REQUIRED">Rating field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newscreenRecording" ng-click="vm.savescreenRecording()" class="send-button md-accent md-raised" ng-disabled="screenRecordingForm.$invalid || screenRecordingForm.$pristine" aria-label="SAVE" translate="VIDEO.SAVE" translate-attr-aria-label="VIDEO.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newscreenRecording" ng-click="vm.addNewscreenRecording()" class="send-button md-accent md-raised" ng-disabled="screenRecordingForm.$invalid" aria-label="ADD" translate="VIDEO.ADD_SCREENRECORDING" translate-attr-aria-label="VIDEO.ADD_SCREENRECORDING">\n          ADD SCREENRECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newscreenRecording" ng-click="vm.deletescreenRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="VIDEO.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VIDEO.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/video/views/screenRecordings/partialViews/play.html",'<md-dialog class="play-dialog" aria-label="play">\n  <form name="playForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="{{ vm.app.toUpperCase() }}.{{  vm.label.toUpperCase() }}">Play Recording</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-sm flex>\n        \x3c!-- VIRTUAL field --\x3e\n        <md-card>\n\n          <md-card-title ng-if="vm.actionOptions.upperTitle">\n            <md-card-title-text>\n              <span class="md-headline">{{ vm.filename }}</span>\n              <span class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.UPDATEDAT"></span>: {{ vm.recording.updatedAt}}</span>\n            </md-card-title-text>\n          </md-card-title>\n\n          \x3c!-- video recording directive --\x3e\n          <ms-dialog-recording ng-if="vm.format" id="vm.recording.id" title="vm.filename" element="vm.element" model="vm.route" path="vm.path" class="md-card-image"></ms-dialog-recording>\n          \x3c!-- / video recording directive --\x3e\n\n          <span ng-if="!vm.format">\n            <em ng-if="vm.found">{{ vm.app.toUpperCase() + \'.CANT_PLAY_THIS_FILE\' | translate }}</em>\n            <em ng-if="!vm.found">{{ vm.app.toUpperCase() + \'.FILE_NOT_FOUND\' | translate }}</em>\n          </span>\n\n          <md-card-title ng-if="vm.actionOptions.lowerTitle">\n            <md-card-title-text>\n              <span class="md-headline">{{ vm.filename }}</span>\n              <span class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.UPDATEDAT"></span>:{{ vm.recording.updatedAt}}</span>\n              <span ng-if="vm.actionOptions.properties" class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.PROPERTIES"></span>:</span>\n            </md-card-title-text>\n          </md-card-title>\n\n          <md-card-content ng-if="vm.actionOptions.properties">\n            <md-list>\n              <md-list-item class="md-2-line" ng-repeat="(key,value) in vm.properties" ng-click="null" ng-if="key != \'value\' && key != \'updatedAt\' && key != \'queue\'">\n\n                <md-icon ng-if="vm.icon" class="md-avatar-icon" md-font-icon="vm.actionOptions.propertiesIcon" class="s24"></md-icon>\n\n                <div class="md-list-item-text" layout="column">\n                  <p><b><span translate="{{ vm.app.toUpperCase() }}.{{ key.toUpperCase() }}"></span></b></p>\n                  <p>{{ value }}\n                    <p>\n                </div>\n              </md-list-item>\n            </md-list>\n          </md-card-content>\n\n\n        </md-card>\n      </div>\n    </md-dialog-content>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/video/views/screenRecordings/screenRecordings.html",'<div id="screenRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-video" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VIDEO.SCREENRECORDINGS">ScreenRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VIDEO.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getScreenRecordings()"></ms-quick-filter>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedScreenRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedScreenRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VIDEO.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-screenRecordings-count">\n          <span>{{vm.selectedScreenRecordings.length}}</span>\n          <span translate="VIDEO.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VIDEO.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllScreenRecordings()" translate="VIDEO.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectScreenRecordings()" translate="VIDEO.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedScreenRecordings" csv-label="true" filename="screenRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedScreenRecordings($event)" aria-label="delete selected" translate translate-attr-label="VIDEO.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SCREENRECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedScreenRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScreenRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VIDEO.ID\' | translate }}</th>\n                <th md-column md-order-by="rating">{{ \'VIDEO.RATING\' | translate }}</th>\n                <th md-column md-order-by="UserId">{{ \'VIDEO.AGENT\' | translate }}</th>\n                <th md-column md-order-by="duration">{{ \'VIDEO.DURATION\' | translate }}</th>\n                <th md-column md-order-by="startedAt">{{ \'VIDEO.RECORDSTARTTIME\' | translate }}</th>\n                <th md-column md-order-by="closedAt">{{ \'VIDEO.RECORDENDTIME\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.screenRecordings.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VIDEO.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="screenRecording" md-select-id="id" ng-repeat="screenRecording in vm.screenRecordings.rows">\n                <td md-cell ng-if="screenRecording.userpic"><img class="avatar" alt="{{screenRecording.name}}" ng-src="api/users/{{screenRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!screenRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{screenRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="id ">{{screenRecording.id}}</td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="rating ">\n                  <md-icon md-font-icon="icon-star" style="color:red" ng-show="screenRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:screenRecording.rating"></md-icon><span ng-hide="screenRecording.rating" translate="VIDEO.NO_RATING">No rating</span>\n                </td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="UserId ">{{ (vm.users | filter : {\'id\':screenRecording.UserId} : true)[0].fullname }}</td>\n                <td md-cell><span ng-bind="vm.convertDuration(screenRecording.duration)"></span></td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="startedAt ">{{screenRecording.startedAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="closedAt ">{{screenRecording.closedAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VIDEO.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.playrecording(screenRecording, $event  , \'value\'  , \'play_screenrecording\'  , \'video\' )" translate="VIDEO.PLAY_SCREENRECORDING">\n                          play screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadScreenRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(screenRecording, $event  , \'screen/recordings\'   )" translate="VIDEO.DOWNLOAD_SCREENRECORDING">\n                          Download screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(screenRecording, $event    )" translate="VIDEO.DELETE_SCREENRECORDING">\n                          Delete screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VIDEO.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VIDEO.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VIDEO.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.screenRecordings.count}}" md-on-paginate="vm.getScreenRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SCREENRECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/routing/dialog.html",'<md-dialog ng-init="vm.init()" class="voice-routing-dialog" aria-label="New routing application">\n  <form name="routingAppForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'VOICE.EDIT_\' + vm.application.appType | uppercase | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-switch="vm.application.appType">\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div ng-switch-when="agi">\n        <div ng-include="\'app/main/apps/voice/routing/views/agi.html\'"></div>\n      </div>\n      <div ng-switch-when="custom">\n        <div ng-include="\'app/main/apps/voice/routing/views/custom.html\'"></div>\n      </div>\n      <div ng-switch-when="dial">\n        <div ng-include="\'app/main/apps/voice/routing/views/dial.html\'"></div>\n      </div>\n      <div ng-switch-when="externalDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/externalDial.html\'"></div>\n      </div>\n      <div ng-switch-when="goTo">\n        <div ng-include="\'app/main/apps/voice/routing/views/goTo.html\'"></div>\n      </div>\n      <div ng-switch-when="hangup">\n        <div ng-include="\'app/main/apps/voice/routing/views/hangup.html\'"></div>\n      </div>\n      <div ng-switch-when="internalDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/internalDial.html\'"></div>\n      </div>\n      <div ng-switch-when="outboundDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/outboundDial.html\'"></div>\n      </div>\n      <div ng-switch-when="playback">\n        <div ng-include="\'app/main/apps/voice/routing/views/playback.html\'"></div>\n      </div>\n      <div ng-switch-when="queue">\n        <div ng-include="\'app/main/apps/voice/routing/views/queue.html\'"></div>\n      </div>\n      <div ng-switch-when="ringGroup">\n        <div ng-include="\'app/main/apps/voice/routing/views/ringGroup.html\'"></div>\n      </div>\n      <div ng-switch-when="set">\n        <div ng-include="\'app/main/apps/voice/routing/views/set.html\'"></div>\n      </div>\n      <div ng-switch-when="voicemail">\n        <div ng-include="\'app/main/apps/voice/routing/views/voicemail.html\'"></div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveRoutingApp()" class="send-button md-accent md-raised" ng-disabled="routingAppForm.$invalid || routingAppForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/routing/interval/dialog.html",'<md-dialog ng-init="vm.initialize()" class="interval-dialog" aria-label="Edit Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'TOOLS.EDIT_INTERVAL\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.crudPermissions.canEdit" ng-change="vm.onTypeChange()">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | startcase }}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.crudPermissions.canEdit" required>\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals.rows" ng-disabled="interval.canSelect === false">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | startcase }}</span></md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | startcase }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | startcase }}</span></md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | startcase }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="start center">\n      <md-button type="submit" ng-if="vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/routing/views/agi.html",'<md-input-container class="md-block">\n  <label translate="VOICE.PROJECT">Project</label>\n  <md-select name="project" ng-model="vm.application.project" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'agi://127.0.0.1/square,{{project.name}}\'" ng-repeat="project in vm.projects.rows" ng-disabled="project.canSelect === false">{{ project.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'project\'].$error" ng-show="routingAppForm[\'project\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PROJECT_REQUIRED">Project field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/custom.html",'<md-input-container class="md-block">\n  <label translate="VOICE.APPLICATION_NAME">Application_Name</label>\n  <input type="text" name="app" ng-model="vm.application.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'app\'].$error" ng-show="routingAppForm[\'app\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.APPLICATION_NAME_REQUIRED">Application_Name field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.ARGUMENTS">Arguments</label>\n  <input type="text" name="appdata" ng-model="vm.application.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'appdata\'].$error" ng-show="routingAppForm[\'appdata\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.ARGUMENTS_REQUIRED">Arguments field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/dial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TECHNOLOGY/RESOURCE">Technology/Resource</label>\n  <input type="text" name="tech" ng-model="vm.application.tech" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'tech\'].$error" ng-show="routingAppForm[\'tech\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TECHNOLOGY/RESOURCE_REQUIRED">Technology/Resource field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/externalDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TRUNK">Trunk</label>\n  <md-select name="trunk" ng-model="vm.application.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks.rows" ng-disabled="trunk.canSelect === false">{{\n      trunk.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'trunk\'].$error" ng-show="routingAppForm[\'trunk\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PHONE">Phone</label>\n  <input type="text" name="phone" ng-model="vm.application.phone" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'phone\'].$error" ng-show="routingAppForm[\'phone\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/goTo.html",'<md-input-container class="md-block">\n  <label translate="VOICE.CONTEXT">Context</label>\n  <md-select name="context" ng-model="vm.application.context" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{\n      context.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'context\'].$error" ng-show="routingAppForm[\'context\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.EXTENSION">Extension</label>\n  <input type="text" name="extension" ng-model="vm.application.extension" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'extension\'].$error" ng-show="routingAppForm[\'extension\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.EXTENSION_REQUIRED">Extension field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PRIORITY">Priority</label>\n  <input type="text" name="priority" ng-model="vm.application.priority" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'priority\'].$error" ng-show="routingAppForm[\'priority\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/hangup.html","<md-input-container class=\"md-block\">\n  <label translate=\"VOICE.HANGUP_CAUSE\">Hangup_Cause</label>\n  <md-select name=\"appdata\" ng-model=\"vm.application.appdata\" autofocus required ng-disabled=\"!vm.crudPermissions.canEdit\">\n    <md-option ng-value=\"'1'\"> {{ 'VOICE.HANGUPCAUSE_1' | translate }} </md-option>\n    <md-option ng-value=\"'16'\"> {{ 'VOICE.HANGUPCAUSE_16' | translate }} </md-option>\n    <md-option ng-value=\"'17'\"> {{ 'VOICE.HANGUPCAUSE_17' | translate }} </md-option>\n    <md-option ng-value=\"'18'\"> {{ 'VOICE.HANGUPCAUSE_18' | translate }} </md-option>\n    <md-option ng-value=\"'21'\"> {{ 'VOICE.HANGUPCAUSE_21' | translate }} </md-option>\n    <md-option ng-value=\"'22'\"> {{ 'VOICE.HANGUPCAUSE_22' | translate }} </md-option>\n    <md-option ng-value=\"'27'\"> {{ 'VOICE.HANGUPCAUSE_27' | translate }} </md-option>\n    <md-option ng-value=\"'38'\"> {{ 'VOICE.HANGUPCAUSE_38' | translate }} </md-option>\n    <md-option ng-value=\"'41'\"> {{ 'VOICE.HANGUPCAUSE_41' | translate }} </md-option>\n  </md-select>\n  <div ng-messages=\"routingAppForm['appdata'].$error\" ng-show=\"routingAppForm['appdata'].$touched\" role=\"alert\">\n    <div ng-message=\"required\">\n      <span translate=\"VOICE.ERRORS.HANGUP_CAUSE_REQUIRED\">Hangup_Cause field is required</span>\n    </div>\n  </div>\n</md-input-container>"),e.put("app/main/apps/voice/routing/views/internalDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.USER">User</label>\n  <md-select name="user" ng-model="vm.application.user" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users.rows" ng-disabled="user.canSelect === false">\n      {{ user.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'user\'].$error" ng-show="routingAppForm[\'user\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.USER_REQUIRED">User field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/outboundDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TRUNK">Trunk</label>\n  <md-select name="trunk" ng-model="vm.application.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks.rows" ng-disabled="trunk.canSelect === false">{{\n      trunk.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'trunk\'].$error" ng-show="routingAppForm[\'trunk\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.CALLER_ID">Caller_ID</label>\n  <input type="text" name="callerID" ng-model="vm.application.callerID" ng-disabled="!vm.crudPermissions.canEdit">\n  <div class="hint"><span translate="VOICE.HELP.CALLER_ID"></span></div>\n  <div ng-messages="routingAppForm[\'callerID\'].$error" ng-show="routingAppForm[\'callerID\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.CALLER_ID_REQUIRED">Caller_ID field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PREFIX">Prefix</label>\n  <input type="text" name="prefix" ng-model="vm.application.prefix" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'prefix\'].$error" ng-show="routingAppForm[\'prefix\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TAGS">Tags</label>\n  <md-select name="tag" ng-model="vm.application.tag" ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'--\'">None</md-option>\n    <md-option ng-value="tag.name" ng-repeat="tag in vm.tags.rows" ng-disabled="tag.canSelect === false">{{ tag.name }}\n    </md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'tag\'].$error" ng-show="routingAppForm[\'tag\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TAGS_REQUIRED">Tags field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/playback.html",'<md-input-container class="md-block">\n  <label translate="VOICE.AUDIO_FILES">Audio_Files</label>\n  <md-select name="sound" ng-model="vm.application.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}\'" ng-repeat="sound in vm.sounds.rows" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'sound\'].$error" ng-show="routingAppForm[\'sound\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.AUDIO_FILES_REQUIRED">Audio_Files field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <md-switch ng-model="vm.application.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</span></md-switch>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/queue.html",'<md-input-container class="md-block">\n  <label translate="VOICE.QUEUE">Queue</label>\n  <md-select name="queue" ng-model="vm.application.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows" ng-disabled="queue.canSelect === false">{{\n      queue.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'queue\'].$error" ng-show="routingAppForm[\'queue\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="URL" ng-model="vm.application.URL" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'URL\'].$error" ng-show="routingAppForm[\'URL\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.ANNOUNCE_OVERRIDES">Announce_Overrides</label>\n  <md-select name="sound" ng-model="vm.application.sound" ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'\'">None</md-option>\n    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}\'" ng-repeat="sound in vm.sounds.rows" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'sound\'].$error" ng-show="routingAppForm[\'sound\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.ANNOUNCE_OVERRIDES_REQUIRED">Announce_Overrides field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.AGI">Agi</label>\n  <input type="text" name="agi" ng-model="vm.application.agi" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'agi\'].$error" ng-show="routingAppForm[\'agi\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.AGI_REQUIRED">Agi field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.MACRO">Macro</label>\n  <input type="text" name="macro" ng-model="vm.application.macro" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'macro\'].$error" ng-show="routingAppForm[\'macro\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.MACRO_REQUIRED">Macro field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.GOSUB">GoSub</label>\n  <input type="text" name="gosub" ng-model="vm.application.gosub" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'gosub\'].$error" ng-show="routingAppForm[\'gosub\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.GOSUB_REQUIRED">GoSub field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.RULE">Rule</label>\n  <input type="text" name="rule" ng-model="vm.application.rule" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'rule\'].$error" ng-show="routingAppForm[\'rule\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.RULE_REQUIRED">Rule field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.POSITION">Position</label>\n  <input type="number" name="position" ng-model="vm.application.position" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'position\'].$error" ng-show="routingAppForm[\'position\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.POSITION_REQUIRED">Position field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.POSITION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Position must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <md-switch ng-model="vm.application.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</span></md-switch>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/ringGroup.html",'<md-input-container class="md-block">\n  <label translate="VOICE.USER">User</label>\n  <md-select name="user" ng-model="vm.application.users" autofocus multiple required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users.rows" ng-disabled="user.canSelect === false">\n      {{ user.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'user\'].$error" ng-show="routingAppForm[\'user\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.USER_REQUIRED">User field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/set.html",'<md-input-container class="md-block">\n  <label translate="VOICE.VARIABLE">Variable</label>\n  <md-select name="variable" ng-model="vm.application.name" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="variable.name" ng-repeat="variable in vm.variables.rows" ng-disabled="variable.canSelect === false">{{\n      variable.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'variable\'].$error" ng-show="routingAppForm[\'variable\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.VALUE">Value</label>\n  <input type="text" name="value" ng-model="vm.application.value" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'value\'].$error" ng-show="routingAppForm[\'value\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.VALUE_REQUIRED">Value field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/voicemail.html",'<md-input-container class="md-block">\n  <label translate="VOICE.MAILBOX@CONTEXT">Mailbox@Context</label>\n  <md-select name="voiceMail" ng-model="vm.application.voiceMail" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'{{voiceMail.mailbox}}@from-voicemail\'" ng-repeat="voiceMail in vm.voiceMails.rows" ng-disabled="voiceMail.canSelect === false">{{ voiceMail.mailbox }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'voiceMail\'].$error" ng-show="routingAppForm[\'voiceMail\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.MAILBOX@CONTEXT_REQUIRED">Mailbox@Context field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/views/chanSpies/chanSpies.html",'<div id="chanSpies" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.CHANSPIES">ChanSpies</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChanSpies.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChanSpies =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chanSpies-count">\n          <span>{{vm.selectedChanSpies.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChanSpies()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChanSpies()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChanSpies" csv-label="true" filename="chanSpies.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChanSpies($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHANSPY TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChanSpies" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChanSpies">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="prefix">{{ \'VOICE.PREFIX\' | translate }}</th>\n                <th md-column md-order-by="auth">{{ \'VOICE.AUTH\' | translate }}</th>\n                <th md-column md-order-by="record">{{ \'VOICE.RECORD\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chanSpies.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chanSpy" md-select-id="id" ng-repeat="chanSpy in vm.chanSpies.rows">\n                <td md-cell ng-if="chanSpy.userpic"><img class="avatar" alt="{{chanSpy.name}}" ng-src="api/users/{{chanSpy.id}}/avatar" /></td>\n                <td md-cell ng-if="!chanSpy.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chanSpy.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="id ">{{chanSpy.id}}</td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="name ">{{chanSpy.name}}</td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="prefix ">{{chanSpy.prefix}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chanSpy, ev) : vm.createOrEditchanSpy($event, chanSpy)" md-cell class="auth ">\n                  <md-icon md-colors="{color: {{chanSpy.auth ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{chanSpy.auth ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chanSpy, ev) : vm.createOrEditchanSpy($event, chanSpy)" md-cell class="record ">\n                  <md-icon md-colors="{color: {{chanSpy.record ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{chanSpy.record ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="description ">{{chanSpy.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(chanSpy, $event    )" translate="VOICE.EDIT_CHANSPY">\n                          Edit chanSpy\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chanSpy, $event    )" translate="VOICE.DELETE_CHANSPY">\n                          Delete chanSpy\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chanSpies.count}}" md-on-paginate="vm.getChanSpies" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHANSPY TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHANSPY BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chanSpy-button" ng-click="vm.createOrEditchanSpy($event)" aria-label="add chanSpy" translate translate-attr-aria-label="VOICE.ADD_CHANSPY">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHANSPY BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/chanSpies/create/dialog.html",'<md-dialog class="chanSpy-dialog" aria-label="New chanSpy">\n  <form name="chanSpyForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chanSpy.name" ng-required="true" autofocus>\n\n        <div ng-messages="chanSpyForm[\'name\'].$error" ng-show="chanSpyForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PREFIX">Prefix</label>\n        <input type="text" name="prefix" ng-model="vm.chanSpy.prefix" ng-required="true">\n\n        <div ng-messages="chanSpyForm[\'prefix\'].$error" ng-show="chanSpyForm[\'prefix\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.OPTIONS">Options</label>\n        <md-select name="options" ng-model="vm.chanSpy.options" multiple required>\n          <md-option ng-value="\'b\'">b: Only spy on channels involved in a bridged call.</md-option>\n          <md-option ng-value="\'B\'">B: Instead of whispering on a single channel barge in on both channels involved in the call.</md-option>\n          <md-option ng-value="\'E\'">E: Exit when the spied-on channel hangs up.</md-option>\n          <md-option ng-value="\'o\'">o: Only listen to audio coming from this channel.</md-option>\n          <md-option ng-value="\'q\'">q: Don\'t play a beep when beginning to spy on a channel, or speak the selected channel name.</md-option>\n          <md-option ng-value="\'s\'">s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.</md-option>\n          <md-option ng-value="\'S\'">S: Stop when no more channels are left to spy on.</md-option>\n          <md-option ng-value="\'w\'">w: Enable whisper mode, so the spying channel can talk to the spied-on channel.</md-option>\n          <md-option ng-value="\'W\'">W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.</md-option>\n        </md-select>\n        <div ng-messages="chanSpyForm[\'options\'].$error" ng-show="chanSpyForm[\'options\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.chanSpy.auth" aria-label="Auth"><span translate="VOICE.AUTH">Auth</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.chanSpy.auth">\n        <label translate="VOICE.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.chanSpy.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n        <div ng-messages="chanSpyForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.chanSpy.record" aria-label="Record"><span translate="VOICE.RECORD">Record</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.chanSpy.record" class="md-block">\n        <label translate="VOICE.RECORDINGFORMAT">recordingFormat</label>\n        <md-select name="recordingFormat" ng-model="vm.chanSpy.recordingFormat" required>\n          <md-option ng-value="\'wav\'">wav</md-option>\n          <md-option ng-value="\'gsm\'">gsm</md-option>\n          <md-option ng-value="\'WAV\'">wav49</md-option>\n        </md-select>\n        <div ng-messages="chanSpyForm[\'recordingFormat\'].$error" ng-show="chanSpyForm[\'recordingFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RECORDINGFORMAT_REQUIRED">recordingFormat field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chanSpy.description">\n\n        <div ng-messages="chanSpyForm[\'description\'].$error" ng-show="chanSpyForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newchanSpy" ng-click="vm.savechanSpy()" class="send-button md-accent md-raised" ng-disabled="chanSpyForm.$invalid || chanSpyForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newchanSpy" ng-click="vm.addNewchanSpy()" class="send-button md-accent md-raised" ng-disabled="chanSpyForm.$invalid" aria-label="ADD" translate="VOICE.ADD_CHANSPY" translate-attr-aria-label="VOICE.ADD_CHANSPY">\n          ADD CHANSPY\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newchanSpy" ng-click="vm.deletechanSpy($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/contexts/contexts.html",'<div id="contexts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.CONTEXTS">Contexts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContexts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedContexts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-contexts-count">\n          <span>{{vm.selectedContexts.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContexts()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContexts()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContexts" csv-label="true" filename="contexts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedContexts($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CONTEXT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedContexts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContexts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.contexts.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="context" md-select-id="id" ng-repeat="context in vm.contexts.rows">\n                <td md-cell ng-if="context.userpic"><img class="avatar" alt="{{context.name}}" ng-src="api/users/{{context.id}}/avatar" /></td>\n                <td md-cell ng-if="!context.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{context.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="id ">{{context.id}}</td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="name ">{{context.name}}</td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="description ">{{context.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(context, $event    )" translate="VOICE.EDIT_CONTEXT">\n                          Edit Context\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(context, $event    )" translate="VOICE.DELETE_CONTEXT">\n                          Delete Context\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contexts.count}}" md-on-paginate="vm.getContexts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CONTEXT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CONTEXT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-context-button" ng-click="vm.createOrEditContext($event)" aria-label="add context" translate translate-attr-aria-label="VOICE.ADD_CONTEXT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CONTEXT BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/contexts/create/dialog.html",'<md-dialog class="context-dialog" aria-label="New Context">\n  <form name="contextForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.context.name" ng-required="true" autofocus>\n\n        <div ng-messages="contextForm[\'name\'].$error" ng-show="contextForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.context.description">\n\n        <div ng-messages="contextForm[\'description\'].$error" ng-show="contextForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newContext" ng-click="vm.saveContext()" class="send-button md-accent md-raised" ng-disabled="contextForm.$invalid || contextForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newContext" ng-click="vm.addNewContext()" class="send-button md-accent md-raised" ng-disabled="contextForm.$invalid" aria-label="ADD" translate="VOICE.ADD_CONTEXT" translate-attr-aria-label="VOICE.ADD_CONTEXT">\n          ADD CONTEXT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContext" ng-click="vm.deleteContext($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/inboundRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="inbound-route-dialog" aria-label="New InboundRoute">\n  <form name="inboundrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newInboundRoute ? \'VOICE.NEW_INBOUNDROUTE\' : \'VOICE.EDIT_INBOUNDROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.inboundRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="inboundrouteForm[\'exten\'].$error" ng-show="inboundrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.inboundRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="inboundrouteForm[\'context\'].$error" ng-show="inboundrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.inboundRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="inboundrouteForm[\'alias\'].$error" ng-show="inboundrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.inboundRoute.description">\n        <div ng-messages="inboundrouteForm[\'description\'].$error" ng-show="inboundrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInboundRoute" ng-click="vm.saveInboundRoute()" class="send-button md-accent md-raised" ng-disabled="inboundrouteForm.$invalid || inboundrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInboundRoute" ng-click="vm.addNewInboundRoute()" class="send-button md-accent md-raised" ng-disabled="inboundrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_INBOUNDROUTE" translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n          ADD INBOUNDROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInboundRoute" ng-click="vm.deleteInboundRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/inboundRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-inbound-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-inbound-routes-button md-icon-button" aria-label="Go to inbound routes" ng-click="vm.gotoInboundRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_INBOUNDROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="inbound-route-image" hide-xs>\n          <img ng-src="assets/images/business/inboundroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.inboundRoute.id}}\n            <span ng-if="vm.inboundRoute.exten">{{vm.inboundRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.inboundRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInboundRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="inbound-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.inboundRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.inboundRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.inboundRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.inboundRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="inbound-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/inboundRoutes/inboundRoutes.html",'<div id="inbound-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.INBOUNDROUTES">InboundRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedInboundRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedInboundRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-inbound-routes-count">\n          <span>{{ vm.selectedInboundRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInboundRoutes = vm.inboundRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInboundRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedInboundRoutes" csv-label="true" filename="inbound_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedInboundRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedInboundRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getInboundRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.inboundRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.inboundRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_INBOUNDROUTE">\n                          Edit InboundRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_INBOUNDROUTE">\n                          Delete InboundRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.inboundRoutes.count }}" md-on-paginate="vm.getInboundRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-inbound-route-button" ng-click="vm.createOrEditInboundRoute($event)" aria-label="add inbound route" translate translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/internalRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="internal-route-dialog" aria-label="New InternalRoute">\n  <form name="internalrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newInternalRoute ? \'VOICE.NEW_INTERNALROUTE\' : \'VOICE.EDIT_INTERNALROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.internalRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="internalrouteForm[\'exten\'].$error" ng-show="internalrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.internalRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="internalrouteForm[\'context\'].$error" ng-show="internalrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.internalRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="internalrouteForm[\'alias\'].$error" ng-show="internalrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.internalRoute.description">\n        <div ng-messages="internalrouteForm[\'description\'].$error" ng-show="internalrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInternalRoute" ng-click="vm.saveInternalRoute()" class="send-button md-accent md-raised" ng-disabled="internalrouteForm.$invalid || internalrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInternalRoute" ng-click="vm.addNewInternalRoute()" class="send-button md-accent md-raised" ng-disabled="internalrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_INTERNALROUTE" translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n          ADD INTERNALROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInternalRoute" ng-click="vm.deleteInternalRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/internalRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-internal-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-internal-routes-button md-icon-button" aria-label="Go to internal routes" ng-click="vm.gotoInternalRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_INTERNALROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="internal-route-image" hide-xs>\n          <img ng-src="assets/images/business/internalroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.internalRoute.id}}\n            <span ng-if="vm.internalRoute.exten">{{vm.internalRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.internalRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInternalRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="internal-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.internalRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.internalRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.internalRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.internalRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="internal-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/internalRoutes/internalRoutes.html",'<div id="internal-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.INTERNALROUTES">InternalRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedInternalRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedInternalRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-internal-routes-count">\n          <span>{{ vm.selectedInternalRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInternalRoutes = vm.internalRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInternalRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedInternalRoutes" csv-label="true" filename="internal_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedInternalRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedInternalRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getInternalRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.internalRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.internalRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_INTERNALROUTE">\n                          Edit InternalRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_INTERNALROUTE">\n                          Delete InternalRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.internalRoutes.count }}" md-on-paginate="vm.getInternalRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-internal-route-button" ng-click="vm.createOrEditInternalRoute($event)" aria-label="add internal route" translate translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/musiconholds/create/dialog.html",'<md-dialog class="musiconhold-dialog" aria-label="New MusicOnHold">\n  <form name="musiconholdForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.musiconhold.name" ng-required="true" autofocus ng-disabled="!vm.newMusicOnHold">\n\n        <div ng-messages="musiconholdForm[\'name\'].$error" ng-show="musiconholdForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.MODE">Mode</label>\n        <md-select name="mode" ng-model="vm.musiconhold.mode" required ng-disabled="!vm.newMusicOnHold">\n\n          <md-option ng-value="\'files\'"> {{ \'VOICE.FILES\' | translate }} </md-option>\n\n          <md-option ng-value="\'custom\'"> {{ \'VOICE.CUSTOM\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="musiconholdForm[\'mode\'].$error" ng-show="musiconholdForm[\'mode\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.MODE_REQUIRED">Mode field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n        <label translate="VOICE.DIRECTORY">Directory</label>\n        <input type="" name="directory" ng-model="vm.musiconhold.directory">\n\n        <div ng-messages="musiconholdForm[\'directory\'].$error" ng-show="musiconholdForm[\'directory\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DIRECTORY_REQUIRED">Directory field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n        <label translate="VOICE.APPLICATION">Application</label>\n        <input type="text" name="application" ng-model="vm.musiconhold.application" ng-required="true">\n\n        <div ng-messages="musiconholdForm[\'application\'].$error" ng-show="musiconholdForm[\'application\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'files\'" class="md-block">\n        <label translate="VOICE.SORT">Sort</label>\n        <md-select name="sort" ng-model="vm.musiconhold.sort">\n\n          <md-option ng-value="\'random\'"> {{ \'VOICE.RANDOM\' | translate }} </md-option>\n\n          <md-option ng-value="\'alpha\'"> {{ \'VOICE.ALPHABETICAL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="musiconholdForm[\'sort\'].$error" ng-show="musiconholdForm[\'sort\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.SORT_REQUIRED">Sort field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMusicOnHold" ng-click="vm.saveMusicOnHold()" class="send-button md-accent md-raised" ng-disabled="musiconholdForm.$invalid || musiconholdForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMusicOnHold" ng-click="vm.addNewMusicOnHold()" class="send-button md-accent md-raised" ng-disabled="musiconholdForm.$invalid" aria-label="ADD" translate="VOICE.ADD_MUSICONHOLD" translate-attr-aria-label="VOICE.ADD_MUSICONHOLD">\n          ADD MUSICONHOLD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMusicOnHold" ng-click="vm.deleteMusicOnHold($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",'<md-dialog class="mohSound-dialog" aria-label="New MohSound">\n  <form name="mohSoundForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.FILE">File</label>\n        <md-select name="id" ng-model="vm.mohSound.id" autofocus>\n          <md-option ng-value="id.id" ng-repeat="id in vm.sounds" ng-disabled="id.canSelect === false">{{ id.name }}</md-option>\n        </md-select>\n        <div ng-messages="mohSoundForm[\'id\'].$error" ng-show="mohSoundForm[\'id\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.FILE_REQUIRED">File field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMohSound" ng-click="vm.saveMohSound()" class="send-button md-accent md-raised" ng-disabled="mohSoundForm.$invalid || mohSoundForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMohSound" ng-click="vm.addNewMohSound()" class="send-button md-accent md-raised" ng-disabled="mohSoundForm.$invalid" aria-label="ADD" translate="VOICE.ADD_MOHSOUND" translate-attr-aria-label="VOICE.ADD_MOHSOUND">\n          ADD MOHSOUND\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMohSound" ng-click="vm.deleteMohSound($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/musiconholds/edit/view.html",'<div id="voice-musiconhold" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-musiconholds-button md-icon-button" aria-label="Go to musiconholds" ng-click="vm.gotoMusicOnHolds()" translate translate-attr-aria-label="VOICE.GO_TO_MUSICONHOLDS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="musiconhold-image" hide-xs>\n          <img ng-src="assets/images/business/musiconholds.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.musiconhold.id}}\n            <span ng-if="vm.musiconhold.name">{{vm.musiconhold.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.musiconhold.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMusicOnHold()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (mohSoundsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="musiconhold-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.musiconhold.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MODE">Mode</label>\n                <md-select name="mode" ng-model="vm.musiconhold.mode" required disabled>\n\n                  <md-option ng-value="\'files\'"> {{ \'VOICE.FILES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'custom\'"> {{ \'VOICE.CUSTOM\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'mode\'].$error" ng-show="generalForm[\'mode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MODE_REQUIRED">Mode field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n                <label translate="VOICE.DIRECTORY">Directory</label>\n                <input type="" name="directory" ng-model="vm.musiconhold.directory" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'directory\'].$error" ng-show="generalForm[\'directory\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DIRECTORY_REQUIRED">Directory field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n                <label translate="VOICE.APPLICATION">Application</label>\n                <input type="text" name="application" ng-model="vm.musiconhold.application" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'application\'].$error" ng-show="generalForm[\'application\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'files\'" class="md-block">\n                <label translate="VOICE.SORT">Sort</label>\n                <md-select name="sort" ng-model="vm.musiconhold.sort" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'random\'"> {{ \'VOICE.RANDOM\' | translate }} </md-option>\n\n                  <md-option ng-value="\'alpha\'"> {{ \'VOICE.ALPHABETICAL\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'sort\'].$error" ng-show="generalForm[\'sort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SORT_REQUIRED">Sort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.AUDIOFILES">AUDIOFILES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="musiconhold-detail-form-container mohsounds md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MusicOnHoldMohSoundsController as vm_dc" ng-init="vm_dc.init(vm.musiconhold, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMusicOnHoldMohSounds.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.MOHSOUNDS">MohSounds</span>\n                  <ms-search-bar on-search="vm_dc.getMusicOnHoldMohSounds()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMusicOnHoldMohSound($event)" aria-label="add mohSound" translate translate-attr-label="VOICE.ADD_MOHSOUND">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMusicOnHoldMohSounds.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMusicOnHoldMohSounds.length}} {{vm_dc.selectedMusicOnHoldMohSounds.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMusicOnHoldMohSounds" csv-label="true" filename="musiconholds.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMusicOnHoldMohSounds($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMusicOnHoldMohSounds" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMusicOnHoldMohSounds">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'VOICE.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="audio">\n                        {{ \'VOICE.AUDIO\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'VOICE.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="mohSound" md-select-id="id" ng-repeat="mohSound in vm_dc.musiconholdMohSounds.rows">\n                      <td md-cell>\n                        {{mohSound.id}}\n                      </td>\n                      <td md-cell>\n                        \x3c!-- audio recording directive --\x3e\n                        <ms-recording id="mohSound.id" model="\'sound\'"></ms-recording>\n                        \x3c!-- / audio recording directive --\x3e\n                      </td>\n                      <td md-cell>\n                        {{ mohSound.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(mohSound, $event)" translate="VOICE.DELETE_MOHSOUND">\n                                Delete MohSound\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.musiconholdMohSounds.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="VOICE.NO_MOHSOUND_AVAILABLE">No mohsound available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.musiconholdMohSounds.count}}" md-on-paginate="vm_dc.getMusicOnHoldMohSounds" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/musiconholds/musiconholds.html",'<div id="musiconholds" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.MUSICONHOLDS">MusicOnHolds</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMusicOnHolds.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMusicOnHolds =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-musiconholds-count">\n          <span>{{vm.selectedMusicOnHolds.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMusicOnHolds()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMusicOnHolds()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMusicOnHolds" csv-label="true" filename="musiconholds.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMusicOnHolds($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MUSICONHOLD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMusicOnHolds" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMusicOnHolds">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="mode">{{ \'VOICE.MODE\' | translate }}</th>\n                <th md-column md-order-by="sort">{{ \'VOICE.SORT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.musiconholds.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="musiconhold" md-select-id="id" ng-repeat="musiconhold in vm.musiconholds.rows">\n                <td md-cell ng-if="musiconhold.userpic"><img class="avatar" alt="{{musiconhold.name}}" ng-src="api/users/{{musiconhold.id}}/avatar" /></td>\n                <td md-cell ng-if="!musiconhold.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{musiconhold.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="id ">{{musiconhold.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="name ">{{musiconhold.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="mode ">{{ \'VOICE.\' + vm.arraymode[musiconhold.mode].option | uppercase | translate }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="sort ">{{ \'VOICE.\' + vm.arraysort[musiconhold.sort].option | uppercase | translate }}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(musiconhold, $event    )" translate="VOICE.EDIT_MUSICONHOLD">\n                          Edit MusicOnHold\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(musiconhold, $event    )" translate="VOICE.DELETE_MUSICONHOLD">\n                          Delete MusicOnHold\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.musiconholds.count}}" md-on-paginate="vm.getMusicOnHolds" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MUSICONHOLD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MUSICONHOLD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-musiconhold-button" ng-click="vm.createOrEditMusicOnHold($event)" aria-label="add musiconhold" translate translate-attr-aria-label="VOICE.ADD_MUSICONHOLD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MUSICONHOLD BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/outboundRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="outbound-route-dialog" aria-label="New OutboundRoute">\n  <form name="outboundrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newOutboundRoute ? \'VOICE.NEW_OUTBOUNDROUTE\' : \'VOICE.EDIT_OUTBOUNDROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.outboundRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="outboundrouteForm[\'exten\'].$error" ng-show="outboundrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.outboundRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="outboundrouteForm[\'context\'].$error" ng-show="outboundrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.RECORDING">Recording</label>\n        <md-select name="recordingFormat" ng-model="vm.outboundRoute.recordingFormat" ng-change="vm.getRouting()" required>\n          <md-option ng-value="\'none\'">none</md-option>\n          <md-option ng-value="\'wav\'">wav</md-option>\n          <md-option ng-value="\'WAV\'">wav49</md-option>\n          <md-option ng-value="\'gsm\'">gsm</md-option>\n        </md-select>\n        <div class="hint"><span translate="VOICE.HELP.RECORDING"></span></div>\n        <div ng-messages="outboundrouteForm[\'recordingFormat\'].$error" ng-show="outboundrouteForm[\'recordingFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RECORDING_REQUIRED">Recording field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CUTDIGITS">CutDigits</label>\n        <input type="number" name="cutdigits" ng-model="vm.outboundRoute.cutdigits" min="0">\n        <div ng-messages="outboundrouteForm[\'cutdigits\'].$error" ng-show="outboundrouteForm[\'cutdigits\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CUTDIGITS_REQUIRED">CutDigits field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="VOICE.ERRORS.CUTDIGITS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigits must be a valid greater\n              or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.outboundRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="outboundrouteForm[\'alias\'].$error" ng-show="outboundrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.outboundRoute.description">\n        <div ng-messages="outboundrouteForm[\'description\'].$error" ng-show="outboundrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOutboundRoute" ng-click="vm.saveOutboundRoute()" class="send-button md-accent md-raised" ng-disabled="outboundrouteForm.$invalid || outboundrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOutboundRoute" ng-click="vm.addNewOutboundRoute()" class="send-button md-accent md-raised" ng-disabled="outboundrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_OUTBOUNDROUTE" translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n          ADD OUTBOUNDROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOutboundRoute" ng-click="vm.deleteOutboundRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/outboundRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-outbound-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-outbound-routes-button md-icon-button" aria-label="Go to outbound routes" ng-click="vm.gotoOutboundRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_OUTBOUNDROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="outbound-route-image" hide-xs>\n          <img ng-src="assets/images/business/outboundroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.outboundRoute.id}}\n            <span ng-if="vm.outboundRoute.exten">{{vm.outboundRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.outboundRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOutboundRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="outbound-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.outboundRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.outboundRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RECORDING">Recording</label>\n                <md-select name="recordingFormat" ng-model="vm.outboundRoute.recordingFormat" ng-change="vm.onActionsTabSelection()" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'none\'">none</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'WAV\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RECORDING"></span></div>\n                <div ng-messages="generalForm[\'recordingFormat\'].$error" ng-show="generalForm[\'recordingFormat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RECORDING_REQUIRED">Recording field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CUTDIGITS">CutDigits</label>\n                <input type="number" name="cutdigits" ng-model="vm.outboundRoute.cutdigits" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'cutdigits\'].$error" ng-show="generalForm[\'cutdigits\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CUTDIGITS_REQUIRED">CutDigits field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.CUTDIGITS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigits must be a valid\n                      greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.outboundRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.outboundRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="outbound-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/outboundRoutes/outboundRoutes.html",'<div id="outbound-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.OUTBOUNDROUTES">OutboundRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedOutboundRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedOutboundRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-outbound-routes-count">\n          <span>{{ vm.selectedOutboundRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedOutboundRoutes = vm.outboundRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedOutboundRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOutboundRoutes" csv-label="true" filename="outbound_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOutboundRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOutboundRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOutboundRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.outboundRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.outboundRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_OUTBOUNDROUTE">\n                          Edit OutboundRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_OUTBOUNDROUTE">\n                          Delete OutboundRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.outboundRoutes.count }}" md-on-paginate="vm.getOutboundRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-outbound-route-button" ng-click="vm.createOrEditOutboundRoute($event)" aria-label="add outbound route" translate translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/realtime/abandonedcalls/view.html",'<md-toolbar class="md-table-toolbar md-default table-header">\n  <div class="md-toolbar-tools" layout="row" layout-align="center center">\n    <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n    <ms-search-bar on-search="vm.getAbandonedCalls()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300">\n    </ms-search-bar>\n    <div flex></div>\n\n    <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getAbandonedCalls()"></ms-quick-filter>\n\n    <md-button class="md-icon-button" ng-click="vm.refresh && vm.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n      <md-icon md-font-icon="icon-reload"></md-icon>\n      <md-tooltip ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | translate}}\n      </md-tooltip>\n    </md-button>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAbandonedCalls">\n      <tr md-row>\n        <th md-column md-order-by="id">ID</th>\n        <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n        <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n        <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n        <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n        <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.abandonedCalls.rows.length">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.abandonedCalls.rows">\n        <td md-cell class="id">{{call.id}}</td>\n        <td md-cell class="firstName" privacy ng-cloak>{{call.calleridname}}</td>\n        <td md-cell class="list" privacy ng-cloak>{{call.calleridnum}}</td>\n        <td md-cell class="list">{{vm.queuesMap[call.queue]}}</td>\n        <td md-cell class="list">\n          {{call.queuecallerabandonAt ? (call.queuecallerabandonAt | formatdate) : (call.queuecallerexitAt | formatdate) }}\n        </td>\n        <td md-cell class="list">{{call.lastAssignedTo}}</td>\n        <td md-cell class="list">{{ call.disposition }}</td>\n        <td md-cell class="list">{{ call.secondDisposition }}</td>\n        <td md-cell class="list">{{ call.thirdDisposition }}</td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-menu>\n                  <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.ASSIGNTO">\n                    Assigned\n                    to</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="call.lastAssignedTo">\n                      <md-button ng-click="vm.assignTo(call)"><em translate="DASHBOARDS.NONE">Not Assigned</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.agents.rows.length" ng-repeat="agent in vm.agents.rows">\n                      <md-button ng-click="vm.assignTo(call,agent)">{{agent.name}}</md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.dispose(call)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">\n                  Dispose\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.abandonedCalls.count}}" md-on-paginate="vm.getAbandonedCalls" md-page-select></md-table-pagination>'),e.put("app/main/apps/voice/views/realtime/outbound_calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.OUTBOUND_CALLS">Ooutbound Calls</span>\n  </div>\n</md-toolbar>\n\n\x3c!-- OUTBOUNDS TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'VOICE.SOURCE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DESTINATION\' | translate }}</th>\n        <th md-column>{{ \'VOICE.ALIAS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DURATION\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.calls.rows.length">\n        <td md-cell colspan="5">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.calls.rows | filter: vm.query.filter | limitTo: vm.query.limit: (vm.query.page - 1) * vm.query.limit">\n        <td md-cell>\n          <i ng-class="vm.channelStatus[call.channelstatedesc.toLowerCase()]"></i>\n        </td>\n        <td md-cell privacy ng-cloak>\n          {{call.calleridname}}, {{call.calleridnum}}\n          <span class="text-boxed" ng-if="call.answered">\n            <timer ng-if="call.answertime" start-time="call.answertime"></timer>\n          </span>\n        </td>\n        <td md-cell privacy ng-cloak>{{call.exten}}</td>\n        <td md-cell>{{call.routealias}}</td>\n        <td md-cell>\n          <span class="text-boxed" ng-if="call.channelstatedesc.toLowerCase() !== \'hangup\'">\n            <timer ng-if="call.starttime" start-time="call.starttime"></timer>\n          </span>\n          <span class="text-boxed" ng-if="call.channelstatedesc.toLowerCase() === \'hangup\'" translate="VOICE.CLOSING">Closing</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.calls.count}}"></md-table-pagination>\n\x3c!-- / OUTBOUNDS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/queue_params/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_PARAMETERS">Params</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{\'\n                        VOICE.NAME\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.TOTAL_OFFERED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.ANSWERED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.ABANDONED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.UNMANAGED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_HOLD_TIME\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_DURATION\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_BILLABLE\' | translate}}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.rows.length > 0">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="queue in vm.queues.rows">\n        <td md-cell>\n          <span>{{queue.name}}</span>\n        </td>\n        <td md-cell>\n          \x3c!-- <span class="font-size-20 grey-fg">{{queue.total || 0}}</span> --\x3e\n          <span class="font-size-20 grey-fg">{{ (queue.answered || 0) + (queue.abandoned || 0) + (queue.unmanaged || 0) }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered || 0}} ({{(queue.total) ? (queue.answered || 0) * 100/queue.total : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.abandoned || 0}} ({{(queue.total) ? (queue.abandoned || 0) * 100/queue.total : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.unmanaged || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? ((queue.sumHoldTime || 0) / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{(queue.total ? ((queue.sumDuration || 0) / queue.total) : 0) | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered ? ((queue.sumBillable || 0) / queue.answered) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.TELEPHONES">Telephones</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.TRUNKS">Trunks</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUE_CALLS">Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ABANDONEDCALLS">Abandoned Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUE_PARAMS">Queue Parameters</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.OUTBOUND_CALLS">Outbound Calls</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/realtime/telephones/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.TELEPHONES">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTelephones()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- AGENT TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTelephones">\n      <tr md-row>\n        <th md-column md-order-by="fullname">{{ \'VOICE.ACCOUNTNAME\' | translate }}</th>\n        <th md-column md-order-by="internal">{{ \'VOICE.INTERNAL\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PHONE_STATE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PHONE_STATUS\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.telephones">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="telephone" md-select-id="id" ng-repeat="(id, telephone) in vm.telephones">\n        <td md-cell>{{telephone.fullname}}</td>\n        <td md-cell>{{telephone.internal}}</td>\n        <td md-cell>\n          <i ng-class="vm.stateClass[telephone.state]">\n            <md-tooltip>{{\'VOICE.\' + telephone.state | uppercase | translate}}</md-tooltip>\n          </i>\n        </td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[telephone.status]">\n            <md-tooltip>{{\'VOICE.\' + telephone.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="telephone.status === \'registered\'" class="text-boxed">{{telephone.address}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTelephones" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/trunks/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.TRUNKS">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTrunks()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- TRUNKS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n        <th md-column>{{ \'VOICE.TRUNK_STATUS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.REGISTRY\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.trunks">\n        <td md-cell colspan="3">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, trunk) in vm.trunks">\n        <td md-cell>{{trunk.name}}</td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[trunk.status.toLowerCase()]">\n            <md-tooltip>{{\'VOICE.\' + trunk.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.status === \'registered\'" class="text-boxed">{{trunk.address}}</span>\n        </td>\n        <td md-cell>\n          <i ng-if="trunk.registry" ng-class="(trunk.stateRegistry.toLowerCase() === \'registered\') ? \'green-300-fg icon-checkbox-marked-circle\' : \'red-300-fg icon-close-circle\'">\n            <md-tooltip>{{\'VOICE.\' + trunk.stateRegistry | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.registry && trunk.host && trunk.port" class="text-boxed">{{trunk.host}}:{{trunk.port}}</span>\n          <span ng-if="!trunk.registry" translate="VOICE.NO_REGISTRY">\n            No Registry\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item>\n                <md-button ng-click="vm.goToTrunk($event, trunk)" translate="VOICE.EDIT_TRUNK">\n                  Edit Trunk\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n\x3c!-- / TRUNKS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/voicemails/create/dialog.html",'<md-dialog class="voicemail-dialog" aria-label="New Voicemail">\n  <form name="voicemailForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.FULLNAME">FullName</label>\n        <input type="text" name="fullname" ng-model="vm.voicemail.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="voicemailForm[\'fullname\'].$error" ng-show="voicemailForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.FULLNAME_REQUIRED">FullName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.voicemail.email" ng-required="vm.voicemail.attach === \'yes\'">\n\n        <div ng-messages="voicemailForm[\'email\'].$error" ng-show="voicemailForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="VOICE.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.voicemail.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n        <div ng-messages="voicemailForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.newVoicemail ">\n        <label translate="VOICE.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="voicemailForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="VOICE.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="VOICE.MAILBOX">MailBox</label>\n        <input type="text" name="mailbox" ng-model="vm.voicemail.mailbox" ng-required="true" ng-disabled="!vm.newVoicemail">\n\n        <div ng-messages="voicemailForm[\'mailbox\'].$error" ng-show="voicemailForm[\'mailbox\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.MAILBOX_REQUIRED">MailBox field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ATTACH">Attach</label>\n        <md-select name="attach" ng-model="vm.voicemail.attach">\n\n          <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n          <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="voicemailForm[\'attach\'].$error" ng-show="voicemailForm[\'attach\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ATTACH_REQUIRED">Attach field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoicemail" ng-click="vm.saveVoicemail()" class="send-button md-accent md-raised" ng-disabled="voicemailForm.$invalid || voicemailForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoicemail" ng-click="vm.addNewVoicemail()" class="send-button md-accent md-raised" ng-disabled="voicemailForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEMAIL" translate-attr-aria-label="VOICE.ADD_VOICEMAIL">\n          ADD VOICEMAIL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoicemail" ng-click="vm.deleteVoicemail($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicemails/edit/view.html",'<div id="voice-voicemail" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voicemails-button md-icon-button" aria-label="Go to voicemails" ng-click="vm.gotoVoicemails()" translate translate-attr-aria-label="VOICE.GO_TO_VOICEMAILS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voicemail-image" hide-xs>\n          <img ng-src="assets/images/business/voicemails.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voicemail.id}}\n            <span ng-if="vm.voicemail.name">{{vm.voicemail.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voicemail.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoicemail()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (advancedForm.$invalid) || (messagesForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.FULLNAME">FullName</label>\n                <input type="text" name="fullname" ng-model="vm.voicemail.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'fullname\'].$error" ng-show="generalForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.FULLNAME_REQUIRED">FullName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.voicemail.email" ng-required="vm.voicemail.attach === \'yes\'" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="VOICE.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.voicemail.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block" ng-if="vm.newVoicemail ">\n                <label translate="VOICE.CONFIRM_PASSWORD">Confirm Password</label>\n                <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n                <div ng-messages="generalForm.confirmPassword.$error" role="alert" multiple>\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n                  </div>\n                  <div ng-message="passwordMatch">\n                    <span translate="VOICE.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAILBOX">MailBox</label>\n                <input type="text" name="mailbox" ng-model="vm.voicemail.mailbox" ng-required="true" disabled>\n\n                <div ng-messages="generalForm[\'mailbox\'].$error" ng-show="generalForm[\'mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAILBOX_REQUIRED">MailBox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.VOICEMAIL_CONTEXT">Voicemail_Context</label>\n                <md-select name="context" ng-model="vm.voicemail.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.VOICEMAIL_CONTEXT"></span></div>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.VOICEMAIL_CONTEXT_REQUIRED">Voicemail_Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEZONE">TimeZone</label>\n                <input type="text" name="tz" ng-model="vm.voicemail.tz" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'tz\'].$error" ng-show="advancedForm[\'tz\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEZONE_REQUIRED">TimeZone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ATTACH">Attach</label>\n                <md-select name="attach" ng-model="vm.voicemail.attach" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'attach\'].$error" ng-show="advancedForm[\'attach\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ATTACH_REQUIRED">Attach field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ENVELOPE">Envelope</label>\n                <md-select name="envelope" ng-model="vm.voicemail.envelope" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'envelope\'].$error" ng-show="advancedForm[\'envelope\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ENVELOPE_REQUIRED">Envelope field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DELETE">Delete</label>\n                <md-select name="delete" ng-model="vm.voicemail.delete" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'delete\'].$error" ng-show="advancedForm[\'delete\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DELETE_REQUIRED">Delete field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAILBODY">EmailBody</label>\n                <input type="text" name="emailbody" ng-model="vm.voicemail.emailbody" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'emailbody\'].$error" ng-show="advancedForm[\'emailbody\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAILBODY_REQUIRED">EmailBody field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAILSUBJECT">EmailSubject</label>\n                <input type="text" name="emailsubject" ng-model="vm.voicemail.emailsubject" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'emailsubject\'].$error" ng-show="advancedForm[\'emailsubject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAILSUBJECT_REQUIRED">EmailSubject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXSECONDS">MaxSeconds</label>\n                <input type="number" name="maxsecs" ng-model="vm.voicemail.maxsecs" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'maxsecs\'].$error" ng-show="advancedForm[\'maxsecs\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXSECONDS_REQUIRED">MaxSeconds field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXSECONDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxSeconds must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXMESSAGES">MaxMessages</label>\n                <input type="number" name="maxmsg" ng-model="vm.voicemail.maxmsg" min="0" max="9999" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'maxmsg\'].$error" ng-show="advancedForm[\'maxmsg\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_REQUIRED">MaxMessages field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxMessages must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxMessages must be a valid greater or equal than</span> <span>9999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.MESSAGES">MESSAGES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container messages md-background-bg md-whiteframe-1dp">\n            <div ng-controller="VoicemailMessagesController as vm_dc" ng-init="vm_dc.init(vm.voicemail, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedVoicemailMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.MESSAGES">Messages</span>\n                  <ms-search-bar on-search="vm_dc.getVoicemailMessages()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedVoicemailMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedVoicemailMessages.length}} {{vm_dc.selectedVoicemailMessages.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedVoicemailMessages" csv-label="true" filename="voicemails.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedVoicemailMessages($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedVoicemailMessages" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getVoicemailMessages">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'VOICE.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="callerid">\n                        {{ \'VOICE.CALLER_ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="duration">\n                        {{ \'VOICE.DURATION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="audio">\n                        {{ \'VOICE.AUDIO\' | translate }}\n                      </th>\n                      <th md-column md-order-by="stamp">\n                        {{ \'VOICE.RECEIVED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="message" md-select-id="id" ng-repeat="message in vm_dc.voicemailMessages.rows">\n                      <td md-cell>\n                        {{message.id}}\n                      </td>\n                      <td md-cell>\n                        {{message.callerid}}\n                      </td>\n                      <td md-cell>\n                        {{message.duration}}\n                      </td>\n                      <td md-cell>\n                        \x3c!-- audio recording directive --\x3e\n                        <ms-recording id="message.id" model="\'voiceMailMessage\'"></ms-recording>\n                        \x3c!-- / audio recording directive --\x3e\n                      </td>\n                      <td md-cell>\n                        {{ message.stamp | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(message, $event)" translate="VOICE.DELETE_MESSAGE">\n                                Delete Message\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.voicemailMessages.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="VOICE.NO_MESSAGE_AVAILABLE">No message available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.voicemailMessages.count}}" md-on-paginate="vm_dc.getVoicemailMessages" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voicemails/voicemails.html",'<div id="voicemails" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEMAILS">Voicemails</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoicemails.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoicemails =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voicemails-count">\n          <span>{{vm.selectedVoicemails.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoicemails()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoicemails()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoicemails" csv-label="true" filename="voicemails.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoicemails($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEMAIL TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoicemails" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoicemails">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="fullname">{{ \'VOICE.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'VOICE.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="mailbox">{{ \'VOICE.MAILBOX\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voicemails.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voicemail" md-select-id="id" ng-repeat="voicemail in vm.voicemails.rows">\n                <td md-cell ng-if="voicemail.userpic"><img class="avatar" alt="{{voicemail.name}}" ng-src="api/users/{{voicemail.id}}/avatar" /></td>\n                <td md-cell ng-if="!voicemail.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voicemail.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="id ">{{voicemail.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="fullname ">{{voicemail.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="email ">{{voicemail.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="mailbox ">{{voicemail.mailbox}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voicemail, $event    )" translate="VOICE.EDIT_VOICEMAIL">\n                          Edit Voicemail\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voicemail, $event    )" translate="VOICE.DELETE_VOICEMAIL">\n                          Delete Voicemail\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voicemails.count}}" md-on-paginate="vm.getVoicemails" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEMAIL TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEMAIL BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voicemail-button" ng-click="vm.createOrEditVoicemail($event)" aria-label="add voicemail" translate translate-attr-aria-label="VOICE.ADD_VOICEMAIL">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEMAIL BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voicePrefixes/create/dialog.html",'<md-dialog class="voicePrefix-dialog" aria-label="New voicePrefix">\n  <form name="voicePrefixForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.voicePrefix.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus>\n\n        <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n        <div ng-messages="voicePrefixForm[\'name\'].$error" ng-show="voicePrefixForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="VoiceExtensionId" ng-model="vm.voicePrefix.VoiceExtensionId" required>\n          <md-option ng-value="VoiceExtensionId.id" ng-repeat="VoiceExtensionId in vm.outboundRoutes" ng-disabled="VoiceExtensionId.canSelect === false">{{ VoiceExtensionId.exten }}</md-option>\n        </md-select>\n        <div ng-messages="voicePrefixForm[\'VoiceExtensionId\'].$error" ng-show="voicePrefixForm[\'VoiceExtensionId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CALLERIDALL">CallerIdAll</label>\n        <input type="text" name="callerIdAll" ng-model="vm.voicePrefix.callerIdAll" ng-pattern="/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/">\n\n        <div class="hint"><span translate="VOICE.HELP.CALLERIDALL"></span></div>\n        <div ng-messages="voicePrefixForm[\'callerIdAll\'].$error" ng-show="voicePrefixForm[\'callerIdAll\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CALLERIDALL_REQUIRED">CallerIdAll field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.CALLERIDALL_MUST_VALID_PATTERN" translate-values="{ regex: \'/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/\' }">CallerIdAll must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.voicePrefix.description">\n\n        <div ng-messages="voicePrefixForm[\'description\'].$error" ng-show="voicePrefixForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newvoicePrefix" ng-click="vm.savevoicePrefix()" class="send-button md-accent md-raised" ng-disabled="voicePrefixForm.$invalid || voicePrefixForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newvoicePrefix" ng-click="vm.addNewvoicePrefix()" class="send-button md-accent md-raised" ng-disabled="voicePrefixForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEPREFIX" translate-attr-aria-label="VOICE.ADD_VOICEPREFIX">\n          ADD VOICEPREFIX\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newvoicePrefix" ng-click="vm.deletevoicePrefix($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",'<md-dialog class="voicePrefix-dialog" aria-label="voicePrefix" ng-init="vm.onInit()">\n  <form name="voicePrefixForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.AGENTADD_VOICEPREFIX">Add Agent to voicePrefix</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/edit/teamadd/teamadd.html",'<md-dialog class="voicePrefix-dialog" aria-label="voicePrefix" ng-init="vm.onInit()">\n  <form name="voicePrefixForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/voicePrefixes.html",'<div id="voicePrefixes" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEPREFIXES">VoicePrefixes</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoicePrefixes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoicePrefixes =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voicePrefixes-count">\n          <span>{{vm.selectedVoicePrefixes.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoicePrefixes()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoicePrefixes()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoicePrefixes" csv-label="true" filename="voicePrefixes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoicePrefixes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEPREFIX TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoicePrefixes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoicePrefixes">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="VoiceExtensionId">{{ \'VOICE.OUTBOUNDROUTE\' | translate }}</th>\n                <th md-column md-order-by="callerIdAll">{{ \'VOICE.CALLERIDALL\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voicePrefixes.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voicePrefix" md-select-id="id" ng-repeat="voicePrefix in vm.voicePrefixes.rows">\n                <td md-cell ng-if="voicePrefix.userpic"><img class="avatar" alt="{{voicePrefix.name}}" ng-src="api/users/{{voicePrefix.id}}/avatar" /></td>\n                <td md-cell ng-if="!voicePrefix.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voicePrefix.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="id ">{{voicePrefix.id}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="name ">{{voicePrefix.name}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="VoiceExtensionId ">{{ (vm.outboundRoutes | filter : {\'id\':voicePrefix.VoiceExtensionId} : true)[0].exten }}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="callerIdAll ">{{voicePrefix.callerIdAll}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="description ">{{voicePrefix.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(voicePrefix, $event    )" translate="VOICE.EDIT_VOICEPREFIX">\n                          Edit voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(voicePrefix, $event    )" translate="VOICE.AGENTADD_VOICEPREFIX">\n                          AgentAdd voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(voicePrefix, $event    )" translate="VOICE.TEAMADD_VOICEPREFIX">\n                          teamadd voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voicePrefix, $event    )" translate="VOICE.DELETE_VOICEPREFIX">\n                          Delete voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voicePrefixes.count}}" md-on-paginate="vm.getVoicePrefixes" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEPREFIX TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEPREFIX BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voicePrefix-button" ng-click="vm.createOrEditvoicePrefix($event)" aria-label="add voicePrefix" translate translate-attr-aria-label="VOICE.ADD_VOICEPREFIX">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEPREFIX BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voiceQueues/create/dialog.html",'<md-dialog class="voiceQueue-dialog" aria-label="New VoiceQueue">\n  <form name="voiceQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.voiceQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newVoiceQueue">\n\n        <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n        <div ng-messages="voiceQueueForm[\'name\'].$error" ng-show="voiceQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.voiceQueue.strategy" required>\n          <md-option ng-value="\'ringall\'">Ringall</md-option>\n          <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n          <md-option ng-value="\'leastrecent\'">Least Recent</md-option>\n          <md-option ng-value="\'fewestcalls\'">Fewest Calls</md-option>\n          <md-option ng-value="\'random\'">Random</md-option>\n          <md-option ng-value="\'linear\'">Linear</md-option>\n          <md-option ng-value="\'wrandom\'">Weight Random</md-option>\n        </md-select>\n        <div ng-messages="voiceQueueForm[\'strategy\'].$error" ng-show="voiceQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.voiceQueue.description">\n\n        <div ng-messages="voiceQueueForm[\'description\'].$error" ng-show="voiceQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoiceQueue" ng-click="vm.saveVoiceQueue()" class="send-button md-accent md-raised" ng-disabled="voiceQueueForm.$invalid || voiceQueueForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoiceQueue" ng-click="vm.addNewVoiceQueue()" class="send-button md-accent md-raised" ng-disabled="voiceQueueForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEQUEUE" translate-attr-aria-label="VOICE.ADD_VOICEQUEUE">\n          ADD VOICEQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceQueue" ng-click="vm.deleteVoiceQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",'<md-dialog class="voiceQueue-dialog" aria-label="voiceQueue" ng-init="vm.onInit()">\n  <form name="voiceQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.AGENTADD_VOICEQUEUE">Add Agent to voiceQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="VOICE.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",'<md-dialog class="voiceQueue-dialog" aria-label="voiceQueue" ng-init="vm.onInit()">\n  <form name="voiceQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="VOICE.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/view.html",'<div id="voice-voiceQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voiceQueues-button md-icon-button" aria-label="Go to voiceQueues" ng-click="vm.gotoVoiceQueues()" translate translate-attr-aria-label="VOICE.GO_TO_VOICEQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voiceQueue-image" hide-xs>\n          <img ng-src="assets/images/business/voiceQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voiceQueue.id}}\n            <span ng-if="vm.voiceQueue.name">{{vm.voiceQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voiceQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.voiceQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="VOICE.TEAMADD_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.voiceQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="VOICE.AGENTADD_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.voiceQueue, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="VOICE.GOTO_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoiceQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (settingsForm.$invalid) || (announcementsForm.$invalid) || (advancedForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.voiceQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.voiceQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ringall\'">Ringall</md-option>\n                  <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n                  <md-option ng-value="\'leastrecent\'">Least Recent</md-option>\n                  <md-option ng-value="\'fewestcalls\'">Fewest Calls</md-option>\n                  <md-option ng-value="\'random\'">Random</md-option>\n                  <md-option ng-value="\'linear\'">Linear</md-option>\n                  <md-option ng-value="\'wrandom\'">Weight Random</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEOUT">Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.voiceQueue.timeout" min="0" value="15" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.TIMEOUT"></span></div>\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXLENGTH">MaxLength</label>\n                <input type="number" name="maxlen" ng-model="vm.voiceQueue.maxlen" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MAXLENGTH"></span></div>\n                <div ng-messages="generalForm[\'maxlen\'].$error" ng-show="generalForm[\'maxlen\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXLENGTH_REQUIRED">MaxLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RETRY">Retry</label>\n                <input type="number" name="retry" ng-model="vm.voiceQueue.retry" min="0" value="2" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.RETRY"></span></div>\n                <div ng-messages="generalForm[\'retry\'].$error" ng-show="generalForm[\'retry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RETRY_REQUIRED">Retry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.RETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Retry must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WRAPUPTIME">WrapupTime</label>\n                <input type="number" name="wrapuptime" ng-model="vm.voiceQueue.wrapuptime" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.WRAPUPTIME"></span></div>\n                <div ng-messages="generalForm[\'wrapuptime\'].$error" ng-show="generalForm[\'wrapuptime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WRAPUPTIME_REQUIRED">WrapupTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.WRAPUPTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WrapupTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WEIGHT">Weight</label>\n                <input type="number" name="weight" ng-model="vm.voiceQueue.weight" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.WEIGHT"></span></div>\n                <div ng-messages="generalForm[\'weight\'].$error" ng-show="generalForm[\'weight\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WEIGHT_REQUIRED">Weight field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.WEIGHT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Weight must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.JOINWHENEMPTY">JoinWhenEmpty</label>\n                <md-select name="joinempty" ng-model="vm.voiceQueue.joinempty" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'no\'" ng-disabled="vm.voiceQueue.joinempty.length === 1  && vm.voiceQueue.joinempty[0] === \'no\'">no</md-option>\n                  <md-option ng-value="\'yes\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'yes\'">yes</md-option>\n                  <md-option ng-value="\'strict\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'strict\'">strict</md-option>\n                  <md-option ng-value="\'loose\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'loose\'">loose</md-option>\n                  <md-option ng-value="\'paused\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'paused\'">paused</md-option>\n                  <md-option ng-value="\'penalty\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'penalty\'">penalty</md-option>\n                  <md-option ng-value="\'inuse\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'inuse\'">inuse</md-option>\n                  <md-option ng-value="\'ringing\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'ringing\'">ringing</md-option>\n                  <md-option ng-value="\'unavailable\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'unavailable\'">unavailable</md-option>\n                  <md-option ng-value="\'invalid\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'invalid\'">invalid</md-option>\n                  <md-option ng-value="\'unknown\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'unknown\'">unknown</md-option>\n                  <md-option ng-value="\'wrapup\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'wrapup\'">wrapup</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.JOINWHENEMPTY"></span></div>\n                <div ng-messages="generalForm[\'joinempty\'].$error" ng-show="generalForm[\'joinempty\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.JOINWHENEMPTY_REQUIRED">JoinWhenEmpty field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.LEAVEWHENEMPTY">LeaveWhenEmpty</label>\n                <md-select name="leavewhenempty" ng-model="vm.voiceQueue.leavewhenempty" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'no\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'no\'">no</md-option>\n                  <md-option ng-value="\'yes\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'yes\'">yes</md-option>\n                  <md-option ng-value="\'strict\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'strict\'">strict</md-option>\n                  <md-option ng-value="\'loose\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'loose\'">loose</md-option>\n                  <md-option ng-value="\'paused\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'paused\'">paused</md-option>\n                  <md-option ng-value="\'penalty\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'penalty\'">penalty</md-option>\n                  <md-option ng-value="\'inuse\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'inuse\'">inuse</md-option>\n                  <md-option ng-value="\'ringing\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'ringing\'">ringing</md-option>\n                  <md-option ng-value="\'unavailable\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'unavailable\'">unavailable</md-option>\n                  <md-option ng-value="\'invalid\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'invalid\'">invalid</md-option>\n                  <md-option ng-value="\'unknown\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'unknown\'">unknown</md-option>\n                  <md-option ng-value="\'wrapup\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'wrapup\'">wrapup</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.LEAVEWHENEMPTY"></span></div>\n                <div ng-messages="generalForm[\'leavewhenempty\'].$error" ng-show="generalForm[\'leavewhenempty\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.LEAVEWHENEMPTY_REQUIRED">LeaveWhenEmpty field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MUSICONHOLD">MusicOnHold</label>\n                <md-select name="musiconhold" ng-model="vm.voiceQueue.musiconhold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="musiconhold.name" ng-repeat="musiconhold in vm.musiconholds" ng-disabled="musiconhold.canSelect === false">{{ musiconhold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MUSICONHOLD"></span></div>\n                <div ng-messages="generalForm[\'musiconhold\'].$error" ng-show="generalForm[\'musiconhold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MUSICONHOLD_REQUIRED">MusicOnHold field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCETOAGENT">AnnounceToAgent</label>\n                <md-select name="announce" ng-model="vm.voiceQueue.announce" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'FALSE\'">None</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + announce.save_name" ng-repeat="announce in vm.sounds" ng-disabled="announce.canSelect === false">{{ announce.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCETOAGENT"></span></div>\n                <div ng-messages="generalForm[\'announce\'].$error" ng-show="generalForm[\'announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCETOAGENT_REQUIRED">AnnounceToAgent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.voiceQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ANNOUNCEMENTS">ANNOUNCEMENTS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container settings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.SETTINGS">SETTINGS</div>\n            </div>\n            <form name="settingsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEFREQUENCY">AnnounceFrequency</label>\n                <input type="number" name="announce_frequency" ng-model="vm.voiceQueue.announce_frequency" min="0" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'announce_frequency\'].$error" ng-show="settingsForm[\'announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEFREQUENCY_REQUIRED">AnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.ANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINANNOUNCEFREQUENCY">MinAnnounceFrequency</label>\n                <input type="number" name="min_announce_frequency" ng-model="vm.voiceQueue.min_announce_frequency" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MINANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'min_announce_frequency\'].$error" ng-show="settingsForm[\'min_announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINANNOUNCEFREQUENCY_REQUIRED">MinAnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MINANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MinAnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PERIODICANNOUNCEFREQUENCY">PeriodicAnnounceFrequency</label>\n                <input type="number" name="periodic_announce_frequency" ng-model="vm.voiceQueue.periodic_announce_frequency" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.PERIODICANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'periodic_announce_frequency\'].$error" ng-show="settingsForm[\'periodic_announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCEFREQUENCY_REQUIRED">PeriodicAnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">PeriodicAnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RANDOMPERIODICANNOUNCE">RandomPeriodicAnnounce</label>\n                <md-select name="random_periodic_announce" ng-model="vm.voiceQueue.random_periodic_announce" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RANDOMPERIODICANNOUNCE"></span></div>\n                <div ng-messages="settingsForm[\'random_periodic_announce\'].$error" ng-show="settingsForm[\'random_periodic_announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RANDOMPERIODICANNOUNCE_REQUIRED">RandomPeriodicAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEHOLDTIME">AnnounceHoldtime</label>\n                <md-select name="announce_holdtime" ng-model="vm.voiceQueue.announce_holdtime" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'once\'">Once</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEHOLDTIME"></span></div>\n                <div ng-messages="settingsForm[\'announce_holdtime\'].$error" ng-show="settingsForm[\'announce_holdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEHOLDTIME_REQUIRED">AnnounceHoldtime field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCECALLERPOSITION">AnnounceCallerPosition</label>\n                <md-select name="announce_position" ng-model="vm.voiceQueue.announce_position" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'limit\'">Limit</md-option>\n                  <md-option ng-value="\'more\'">More</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCECALLERPOSITION"></span></div>\n                <div ng-messages="settingsForm[\'announce_position\'].$error" ng-show="settingsForm[\'announce_position\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCECALLERPOSITION_REQUIRED">AnnounceCallerPosition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEPOSITIONLIMIT">AnnouncePositionLimit</label>\n                <input type="number" name="announce_position_limit" ng-model="vm.voiceQueue.announce_position_limit" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEPOSITIONLIMIT"></span></div>\n                <div ng-messages="settingsForm[\'announce_position_limit\'].$error" ng-show="settingsForm[\'announce_position_limit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEPOSITIONLIMIT_REQUIRED">AnnouncePositionLimit field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.REPORTHOLDTIMEAGENT">ReportHoldtimeAgent</label>\n                <md-select name="reportholdtime" ng-model="vm.voiceQueue.reportholdtime" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.REPORTHOLDTIMEAGENT"></span></div>\n                <div ng-messages="settingsForm[\'reportholdtime\'].$error" ng-show="settingsForm[\'reportholdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.REPORTHOLDTIMEAGENT_REQUIRED">ReportHoldtimeAgent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="voiceQueue-detail-form-container announcements md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ANNOUNCEMENTS">ANNOUNCEMENTS</div>\n            </div>\n            <form name="announcementsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PERIODICANNOUNCE">PeriodicAnnounce</label>\n                <md-select name="periodic_announce" ng-model="vm.voiceQueue.periodic_announce" autofocus multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Default</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + periodic_announce.save_name" ng-repeat="periodic_announce in vm.sounds" ng-disabled="periodic_announce.canSelect === false">{{ periodic_announce.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.PERIODICANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'periodic_announce\'].$error" ng-show="announcementsForm[\'periodic_announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCE_REQUIRED">PeriodicAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.HOLDTIMEANNOUNCE">HoldTimeAnnounce</label>\n                <md-select name="queue_reporthold" ng-model="vm.voiceQueue.queue_reporthold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_reporthold.save_name" ng-repeat="queue_reporthold in vm.sounds" ng-disabled="queue_reporthold.canSelect === false">{{ queue_reporthold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.HOLDTIMEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_reporthold\'].$error" ng-show="announcementsForm[\'queue_reporthold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.HOLDTIMEANNOUNCE_REQUIRED">HoldTimeAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.YOUARENEXTANNOUNCE">YouareNextAnnounce</label>\n                <md-select name="queue_youarenext" ng-model="vm.voiceQueue.queue_youarenext" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_youarenext.save_name" ng-repeat="queue_youarenext in vm.sounds" ng-disabled="queue_youarenext.canSelect === false">{{ queue_youarenext.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.YOUARENEXTANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_youarenext\'].$error" ng-show="announcementsForm[\'queue_youarenext\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.YOUARENEXTANNOUNCE_REQUIRED">YouareNextAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THEREAREANNOUNCE">ThereareAnnounce</label>\n                <md-select name="queue_thereare" ng-model="vm.voiceQueue.queue_thereare" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_thereare.save_name" ng-repeat="queue_thereare in vm.sounds" ng-disabled="queue_thereare.canSelect === false">{{ queue_thereare.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.THEREAREANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_thereare\'].$error" ng-show="announcementsForm[\'queue_thereare\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THEREAREANNOUNCE_REQUIRED">ThereareAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WAITINGCALLSANNOUNCE">WaitingCallsAnnounce</label>\n                <md-select name="queue_callswaiting" ng-model="vm.voiceQueue.queue_callswaiting" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_callswaiting.save_name" ng-repeat="queue_callswaiting in vm.sounds" ng-disabled="queue_callswaiting.canSelect === false">{{ queue_callswaiting.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.WAITINGCALLSANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_callswaiting\'].$error" ng-show="announcementsForm[\'queue_callswaiting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WAITINGCALLSANNOUNCE_REQUIRED">WaitingCallsAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ESTIMATEDHOLDTIMEANNOUNCE">EstimatedHoldTimeAnnounce</label>\n                <md-select name="queue_holdtime" ng-model="vm.voiceQueue.queue_holdtime" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_holdtime.save_name" ng-repeat="queue_holdtime in vm.sounds" ng-disabled="queue_holdtime.canSelect === false">{{ queue_holdtime.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ESTIMATEDHOLDTIMEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_holdtime\'].$error" ng-show="announcementsForm[\'queue_holdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ESTIMATEDHOLDTIMEANNOUNCE_REQUIRED">EstimatedHoldTimeAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINUTESANNOUNCE">MinutesAnnounce</label>\n                <md-select name="queue_minutes" ng-model="vm.voiceQueue.queue_minutes" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_minutes.save_name" ng-repeat="queue_minutes in vm.sounds" ng-disabled="queue_minutes.canSelect === false">{{ queue_minutes.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MINUTESANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_minutes\'].$error" ng-show="announcementsForm[\'queue_minutes\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINUTESANNOUNCE_REQUIRED">MinutesAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINUTEANNOUNCE">MinuteAnnounce</label>\n                <md-select name="queue_minute" ng-model="vm.voiceQueue.queue_minute" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_minute.save_name" ng-repeat="queue_minute in vm.sounds" ng-disabled="queue_minute.canSelect === false">{{ queue_minute.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MINUTEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_minute\'].$error" ng-show="announcementsForm[\'queue_minute\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINUTEANNOUNCE_REQUIRED">MinuteAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SECONDSANNOUNCE">SecondsAnnounce</label>\n                <md-select name="queue_seconds" ng-model="vm.voiceQueue.queue_seconds" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_seconds.save_name" ng-repeat="queue_seconds in vm.sounds" ng-disabled="queue_seconds.canSelect === false">{{ queue_seconds.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SECONDSANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_seconds\'].$error" ng-show="announcementsForm[\'queue_seconds\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SECONDSANNOUNCE_REQUIRED">SecondsAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THANKYOUANNOUNCE">ThankYouAnnounce</label>\n                <md-select name="queue_thankyou" ng-model="vm.voiceQueue.queue_thankyou" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_thankyou.save_name" ng-repeat="queue_thankyou in vm.sounds" ng-disabled="queue_thankyou.canSelect === false">{{ queue_thankyou.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.THANKYOUANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_thankyou\'].$error" ng-show="announcementsForm[\'queue_thankyou\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THANKYOUANNOUNCE_REQUIRED">ThankYouAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.voiceQueue.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="VOICE.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceQueue.acw" class="md-block">\n                <label translate="VOICE.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.voiceQueue.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedForm[\'acwTimeout\'].$error" ng-show="advancedForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.AUTOPAUSE">AutoPause</label>\n                <md-select name="autopause" ng-model="vm.voiceQueue.autopause" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'all\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.AUTOPAUSE"></span></div>\n                <div ng-messages="advancedForm[\'autopause\'].$error" ng-show="advancedForm[\'autopause\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AUTOPAUSE_REQUIRED">AutoPause field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RINGINUSE">RingInUse</label>\n                <md-select name="ringinuse" ng-model="vm.voiceQueue.ringinuse" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RINGINUSE"></span></div>\n                <div ng-messages="advancedForm[\'ringinuse\'].$error" ng-show="advancedForm[\'ringinuse\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RINGINUSE_REQUIRED">RingInUse field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MEMBERDELAY">MemberDelay</label>\n                <input type="number" name="memberdelay" ng-model="vm.voiceQueue.memberdelay" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MEMBERDELAY"></span></div>\n                <div ng-messages="advancedForm[\'memberdelay\'].$error" ng-show="advancedForm[\'memberdelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MEMBERDELAY_REQUIRED">MemberDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MEMBERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MemberDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEOUTRESTART">TimeoutRestart</label>\n                <md-select name="timeoutrestart" ng-model="vm.voiceQueue.timeoutrestart" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.TIMEOUTRESTART"></span></div>\n                <div ng-messages="advancedForm[\'timeoutrestart\'].$error" ng-show="advancedForm[\'timeoutrestart\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEOUTRESTART_REQUIRED">TimeoutRestart field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.voiceQueue.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedForm[\'monitor_format\'].$error" ng-show="advancedForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <input type="text" name="context" ng-model="vm.voiceQueue.context" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.CONTEXT"></span></div>\n                <div ng-messages="advancedForm[\'context\'].$error" ng-show="advancedForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETINTERFACEVARIABLES">SetInterfaceVariables</label>\n                <md-select name="setinterfacevar" ng-model="vm.voiceQueue.setinterfacevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETINTERFACEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setinterfacevar\'].$error" ng-show="advancedForm[\'setinterfacevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETINTERFACEVARIABLES_REQUIRED">SetInterfaceVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETQUEUEVARIABLES">SetQueueVariables</label>\n                <md-select name="setqueuevar" ng-model="vm.voiceQueue.setqueuevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETQUEUEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueuevar\'].$error" ng-show="advancedForm[\'setqueuevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETQUEUEVARIABLES_REQUIRED">SetQueueVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETQUEUEENTRYVARIABLES">SetQueueEntryVariables</label>\n                <md-select name="setqueueentryvar" ng-model="vm.voiceQueue.setqueueentryvar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETQUEUEENTRYVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueueentryvar\'].$error" ng-show="advancedForm[\'setqueueentryvar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETQUEUEENTRYVARIABLES_REQUIRED">SetQueueEntryVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SERVICELEVEL">ServiceLevel</label>\n                <input type="number" name="servicelevel" ng-model="vm.voiceQueue.servicelevel" min="0" max="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.SERVICELEVEL"></span></div>\n                <div ng-messages="advancedForm[\'servicelevel\'].$error" ng-show="advancedForm[\'servicelevel\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_REQUIRED">ServiceLevel field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ServiceLevel must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_MUST_BE_LESS_THAN_OR_EQUAL_TO">ServiceLevel must be a valid greater or equal than</span> <span>100</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.voiceQueue.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceQueue.mandatoryDisposition" class="md-block">\n                <label translate="VOICE.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.voiceQueue.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voiceQueues/voiceQueues.html",'<div id="voiceQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEQUEUES">VoiceQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoiceQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoiceQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voiceQueues-count">\n          <span>{{vm.selectedVoiceQueues.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoiceQueues()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoiceQueues()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoiceQueues" csv-label="true" filename="voiceQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceQueues($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoiceQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'VOICE.STRATEGY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voiceQueues.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voiceQueue" md-select-id="id" ng-repeat="voiceQueue in vm.voiceQueues.rows">\n                <td md-cell ng-if="voiceQueue.userpic"><img class="avatar" alt="{{voiceQueue.name}}" ng-src="api/users/{{voiceQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!voiceQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voiceQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="id ">{{voiceQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="name ">{{voiceQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="strategy ">{{ vm.arraystrategy[voiceQueue.strategy].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="description ">{{voiceQueue.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voiceQueue, $event    )" translate="VOICE.EDIT_VOICEQUEUE">\n                          Edit VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(voiceQueue, $event    )" translate="VOICE.TEAMADD_VOICEQUEUE">\n                          teamadd VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(voiceQueue, $event    )" translate="VOICE.AGENTADD_VOICEQUEUE">\n                          agentadd VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voiceQueue, $event    )" translate="VOICE.DELETE_VOICEQUEUE">\n                          Delete VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(voiceQueue, $event    )" translate="VOICE.GOTOREALTIME_VOICEQUEUE">\n                          goToRealtime VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceQueues.count}}" md-on-paginate="vm.getVoiceQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voiceQueue-button" ng-click="vm.createOrEditVoiceQueue($event)" aria-label="add voiceQueue" translate translate-attr-aria-label="VOICE.ADD_VOICEQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voiceRecordings/create/dialog.html",'<md-dialog class="voiceRecording-dialog" aria-label="New VoiceRecording">\n  <form name="voiceRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.RATING">Rating</label>\n        <md-select name="rating" ng-model="vm.voiceRecording.rating" autofocus ng-disabled="!vm.newVoiceRecording && !vm.crudPermissions.canEdit">\n          <md-option ng-value="null">{{\'VOICE.NO_RATING\' | translate}}</md-option>\n          <md-option value="1">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n          </md-option>\n          <md-option value="2">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n          </md-option>\n          <md-option value="3">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n          </md-option>\n          <md-option value="4">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n          </md-option>\n          <md-option value="5">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n          </md-option>\n        </md-select>\n        <div ng-messages="voiceRecordingForm[\'rating\'].$error" ng-show="voiceRecordingForm[rating].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RATING_REQUIRED">Rating field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoiceRecording" ng-click="vm.saveVoiceRecording()" class="send-button md-accent md-raised" ng-disabled="voiceRecordingForm.$invalid || voiceRecordingForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoiceRecording" ng-click="vm.addNewVoiceRecording()" class="send-button md-accent md-raised" ng-disabled="voiceRecordingForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICERECORDING" translate-attr-aria-label="VOICE.ADD_VOICERECORDING">\n          ADD VOICERECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceRecording" ng-click="vm.deleteVoiceRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceRecordings/edit/view.html",'<div id="voice-voiceRecording" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voiceRecordings-button md-icon-button" aria-label="Go to voiceRecordings" ng-click="vm.gotoVoiceRecordings()" translate translate-attr-aria-label="VOICE.GO_TO_VOICERECORDINGS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voiceRecording-image" hide-xs>\n          <img ng-src="assets/images/business/voiceRecordings.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voiceRecording.id}}\n            <span ng-if="vm.voiceRecording.name">{{vm.voiceRecording.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voiceRecording.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoiceRecording()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(voiceRecordingsForm.$invalid) || (transcriptForm.$invalid) || (sentimentAnalysisForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.GENERAL">GENERAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceRecording-detail-form-container voicerecordings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.VOICERECORDINGS">VOICERECORDINGS</div>\n            </div>\n            <form name="voiceRecordingsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TYPE">Type</label>\n                <input type="" name="type" ng-model="vm.voiceRecording.type" autofocus disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'type\'].$error" ng-show="voiceRecordingsForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.UNIQUEID">UniqueId</label>\n                <input type="" name="uniqueid" ng-model="vm.voiceRecording.uniqueid" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'uniqueid\'].$error" ng-show="voiceRecordingsForm[\'uniqueid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.UNIQUEID_REQUIRED">UniqueId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CALLER">Caller</label>\n                <input type="" name="calleridnum" ng-model="vm.voiceRecording.calleridnum" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'calleridnum\'].$error" ng-show="voiceRecordingsForm[\'calleridnum\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CALLER_REQUIRED">Caller field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CALLED">Called</label>\n                <input type="" name="exten" ng-model="vm.voiceRecording.exten" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'exten\'].$error" ng-show="voiceRecordingsForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CALLED_REQUIRED">Called field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONNECTED">Connected</label>\n                <input type="" name="connectedlinenum" ng-model="vm.voiceRecording.connectedlinenum" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'connectedlinenum\'].$error" ng-show="voiceRecordingsForm[\'connectedlinenum\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONNECTED_REQUIRED">Connected field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.QUEUE">Queue</label>\n                <input type="" name="queue" ng-model="vm.voiceRecording.queue" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'queue\'].$error" ng-show="voiceRecordingsForm[\'queue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.AGENT">Agent</label>\n                <input type="text" name="membername" ng-model="vm.voiceRecording.membername" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'membername\'].$error" ng-show="voiceRecordingsForm[\'membername\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RATING">Rating</label>\n                <md-select name="rating" ng-model="vm.voiceRecording.rating" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">{{\'VOICE.NO_RATING\' | translate}}</md-option>\n                  <md-option value="1">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n                  </md-option>\n                  <md-option value="2">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n                  </md-option>\n                  <md-option value="3">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n                  </md-option>\n                  <md-option value="4">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n                  </md-option>\n                  <md-option value="5">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n                  </md-option>\n                </md-select>\n                <div ng-messages="voiceRecordingsForm[\'rating\'].$error" ng-show="voiceRecordingsForm[rating].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RATING_REQUIRED">Rating field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DISPOSITION">Disposition</label>\n                <input type="text" name="userDisposition" ng-model="vm.voiceRecording.userDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userDisposition\'].$error" ng-show="voiceRecordingsForm[\'userDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SECOND_LEVEL_DISPOSITION">Second_Level_Disposition</label>\n                <input type="text" name="userSecondDisposition" ng-model="vm.voiceRecording.userSecondDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userSecondDisposition\'].$error" ng-show="voiceRecordingsForm[\'userSecondDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SECOND_LEVEL_DISPOSITION_REQUIRED">Second_Level_Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THIRD_LEVEL_DISPOSITION">Third_Level_Disposition</label>\n                <input type="text" name="userThirdDisposition" ng-model="vm.voiceRecording.userThirdDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userThirdDisposition\'].$error" ng-show="voiceRecordingsForm[\'userThirdDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THIRD_LEVEL_DISPOSITION_REQUIRED">Third_Level_Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.license.ai">\n        <md-tab-label>\n          <span translate="VOICE.TRANSCRIPTANALYSIS">TRANSCRIPTANALYSIS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceRecording-detail-form-container transcript md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.TRANSCRIPT">TRANSCRIPT</div>\n            </div>\n            <form name="transcriptForm" novalidate>\n              <md-input-container ng-if="vm.voiceRecording.transcribeStatus == \'COMPLETED\'" class="md-block">\n                <label translate="VOICE.TEXT">Text</label>\n                <textarea name="fileText" ng-model="vm.voiceRecording.fileText" autofocus ng-disabled="true"></textarea>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceRecording.transcribeStatus == \'FAILED\'" class="md-block">\n                <label translate="VOICE.FAILUREREASON">FailureReason</label>\n                <textarea name="failureReason" ng-model="vm.voiceRecording.failureReason" ng-disabled="true"></textarea>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="voiceRecording-detail-form-container sentimentanalysis md-background-bg md-whiteframe-1dp">\n            <div ng-controller="VoiceRecordingSentimentStatisticsController as vm_ss" ng-init="vm_ss.init(vm.voiceRecording)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.SENTIMENTANALYSIS" style="width: 50px;">Sentiment Analysis</span>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8 sentiment" ng-class="vm_ss.voiceRecording.sentiment">\n                        {{vm_ss.voiceRecording.sentiment}}\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sPositive || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_POSITIVE\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sNegative || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_NEGATIVE\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 4 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sNeutral || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_NEUTRAL\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 4 --\x3e\n\n                \x3c!-- WIDGET 5 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sMixed || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_MIXED\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 5 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voiceRecordings/voiceRecordings.html",'<div id="voiceRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICERECORDINGS">VoiceRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceRecordings()"></ms-quick-filter>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoiceRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoiceRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voiceRecordings-count">\n          <span>{{vm.selectedVoiceRecordings.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoiceRecordings()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoiceRecordings()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoiceRecordings" csv-label="true" filename="voiceRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runtranscribesentimentSelectedVoiceRecordings($event)" aria-label="transcribesentiment selected" translate translate-attr-label="VOICERECORDINGS.TRANSCRIBESENTIMENT_SELECTED">\n          <md-icon md-font-icon="icon-text-to-speech"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runtranscribeSelectedVoiceRecordings($event)" aria-label="transcribe selected" translate translate-attr-label="VOICERECORDINGS.TRANSCRIBE_SELECTED">\n          <md-icon md-font-icon="icon-format-size"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNTRANSCRIBE_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runsentimentSelectedVoiceRecordings($event)" aria-label="transcribe selected" translate translate-attr-label="VOICERECORDINGS.SENTIMENT_SELECTED">\n          <md-icon md-font-icon="icon-heart-outline"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNSENTIMENT_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceRecordings($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICERECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoiceRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n                <th md-column md-order-by="uniqueid">{{ \'VOICE.UNIQUEID\' | translate }}</th>\n                <th md-column md-order-by="calleridnum">{{ \'VOICE.CALLER\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.CALLED\' | translate }}</th>\n                <th md-column md-order-by="connectedlinenum">{{ \'VOICE.CONNECTED\' | translate }}</th>\n                <th md-column md-order-by="queue">{{ \'VOICE.QUEUE\' | translate }}</th>\n                <th md-column md-order-by="membername">{{ \'VOICE.AGENT\' | translate }}</th>\n                <th md-column md-order-by="rating">{{ \'VOICE.RATING\' | translate }}</th>\n                <th md-column>{{ \'VOICE.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'VOICE.DATE\' | translate }}</th>\n                <th md-column md-order-by="userDisposition">{{ \'VOICE.DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="userSecondDisposition">{{ \'VOICE.SECOND_LEVEL_DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="userThirdDisposition">{{ \'VOICE.THIRD_LEVEL_DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="transcribeStatus" ng-if="vm.license.ai">{{ \'VOICE.TRANSCRIBE\' | translate }}</th>\n                <th md-column md-order-by="sentiment" ng-if="vm.license.ai">{{ \'VOICE.SENTIMENTANALYSIS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n                <td md-cell colspan="16">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voiceRecording" md-select-id="id" ng-repeat="voiceRecording in vm.voiceRecordings.rows">\n                <td md-cell ng-if="voiceRecording.userpic"><img class="avatar" alt="{{voiceRecording.name}}" ng-src="api/users/{{voiceRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!voiceRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voiceRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="type ">{{voiceRecording.type}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="uniqueid ">{{voiceRecording.uniqueid}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="calleridnum " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.calleridnum}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="exten " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.exten}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="connectedlinenum " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.connectedlinenum}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="queue ">{{voiceRecording.queue}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="membername " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.membername}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="rating ">\n                  <md-icon md-font-icon="icon-star" style="color:red" ng-show="voiceRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:voiceRecording.rating"></md-icon><span ng-hide="voiceRecording.rating" translate="VOICE.NO_RATING">No rating</span>\n                </td>\n                <td md-cell class="audio " ng-switch="voiceRecording.format">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording ng-switch-when=".wav" id="voiceRecording.id" model="\'voiceRecording\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                  <span ng-switch-when=".gsm|.WAV" ng-switch-when-separator="|">\n                    <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n                  </span>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userDisposition ">{{voiceRecording.userDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userSecondDisposition ">{{voiceRecording.userSecondDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userThirdDisposition ">{{voiceRecording.userThirdDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="transcribeStatus " ng-if="vm.license.ai">{{ \'VOICE.TRANSCRIBESTATUS_\' + voiceRecording.transcribeStatus | translate}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="sentiment " ng-if="vm.license.ai">{{voiceRecording.sentiment}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voiceRecording, $event    )" translate="VOICE.EDIT_VOICERECORDING">\n                          Edit VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'NEW\' && vm.license.ai">\n\n                        <md-button ng-click="vm.runtranscriberuntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNTRANSCRIBE_VOICERECORDING">\n                          RunTranscribe VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'NEW\' && vm.license.ai">\n\n                        <md-button ng-click="vm.runtranscribesentimentruntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING">\n                          RunTranscribeSentiment VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\' && voiceRecording.sentiment == null && vm.license.ai">\n\n                        <md-button ng-click="vm.runsentimentruntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNSENTIMENT_VOICERECORDING">\n                          RunSentiment VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\' && vm.license.ai">\n\n                        <md-button ng-click="vm.downloadtranscribefile2(voiceRecording, $event    )" translate="VOICE.DOWNLOADTRANSCRIBE_VOICERECORDING">\n                          DownloadTranscribe VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadVoiceRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(voiceRecording, $event  , \'voice/recordings\'   )" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                          Download VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voiceRecording, $event    )" translate="VOICE.DELETE_VOICERECORDING">\n                          Delete VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceRecordings.count}}" md-on-paginate="vm.getVoiceRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICERECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/create/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.whatsappAccount.name" ng-required="true" autofocus ng-disabled="!vm.newWhatsappAccount">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n        <div ng-messages="whatsappAccountForm[\'name\'].$error" ng-show="whatsappAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.whatsappAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'key\'].$error" ng-show="whatsappAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.whatsappAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="WHATSAPP.HELP.LIST"></span></div>\n        <div ng-messages="whatsappAccountForm[\'ListId\'].$error" ng-show="whatsappAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.whatsappAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="whatsappAccountForm[\'remote\'].$error" ng-show="whatsappAccountForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.whatsappAccount.type">\n          <md-option ng-value="\'twilio\'">Twilio</md-option>\n          <md-option ng-value="\'sinch\'">Sinch</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountForm[\'type\'].$error" ng-show="whatsappAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\' || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.ACCOUNTSID">AccountSID</label>\n        <input type="text" name="accountSid" ng-model="vm.whatsappAccount.accountSid" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'accountSid\'].$error" ng-show="whatsappAccountForm[\'accountSid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\' || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.AUTHTOKEN">AuthToken</label>\n        <input type="text" name="authToken" ng-model="vm.whatsappAccount.authToken" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'authToken\'].$error" ng-show="whatsappAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.BASEURL">Base URL</label>\n\n        \x3c!--    <input type="text" name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" ng-required="true"> --\x3e\n\n        <md-select name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" required>\n          <md-option ng-value="\'https://us1.whatsapp.api.sinch.com\'">US Production</md-option>\n          <md-option ng-value="\'https://eu1.whatsapp.api.sinch.com\'">EU Production</md-option>\n        </md-select>\n\n        <div ng-messages="whatsappAccountForm[\'authToken\'].$error" ng-show="whatsappAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PHONE">phone</label>\n        <input type="text" name="phone" ng-model="vm.whatsappAccount.phone" ng-required="true">\n        <div ng-messages="whatsappAccountForm[\'phone\'].$error" ng-show="whatsappAccountForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PHONE_REQUIRED">phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappAccount.description">\n\n        <div ng-messages="whatsappAccountForm[\'description\'].$error" ng-show="whatsappAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappAccount" ng-click="vm.saveWhatsappAccount()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountForm.$invalid || whatsappAccountForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappAccount" ng-click="vm.addNewWhatsappAccount()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPACCOUNT" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPACCOUNT">\n          ADD WHATSAPPACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappAccount" ng-click="vm.deleteWhatsappAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",'<md-dialog class="whatsappAccount-dialog" aria-label="whatsappAccount" ng-init="vm.onInit()">\n  <form name="whatsappAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT">Add Agent to whatsappAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/agent/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'agent\'].$error" ng-show="whatsappAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'timeout\'].$error" ng-show="whatsappAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'accesskeyid\'].$error" ng-show="whatsappAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'secretaccesskey\'].$error" ng-show="whatsappAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'lexregion\'].$error" ng-show="whatsappAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'botname\'].$error" ng-show="whatsappAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'times\'].$error" ng-show="whatsappAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="whatsappAccountFormApp[\'text\'].$error" ng-show="whatsappAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/close/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'disposition\'].$error" ng-show="whatsappAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'key\'].$error" ng-show="whatsappAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'language\'].$error" ng-show="whatsappAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'projectId\'].$error" ng-show="whatsappAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'clientEmail\'].$error" ng-show="whatsappAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="whatsappAccountFormApp[\'privateKey\'].$error" ng-show="whatsappAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'language\'].$error" ng-show="whatsappAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'condition\'].$error" ng-show="whatsappAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'truepriority\'].$error" ng-show="whatsappAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'falsepriority\'].$error" ng-show="whatsappAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'priority\'].$error" ng-show="whatsappAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/noop/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'value\'].$error" ng-show="whatsappAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/queue/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'queue\'].$error" ng-show="whatsappAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'timeout\'].$error" ng-show="whatsappAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/system/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'command\'].$error" ng-show="whatsappAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'variable\'].$error" ng-show="whatsappAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/tag/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'tag\'].$error" ng-show="whatsappAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/view.html",'<div id="whatsapp-whatsappAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-whatsappAccounts-button md-icon-button" aria-label="Go to whatsappAccounts" ng-click="vm.gotoWhatsappAccounts()" translate translate-attr-aria-label="WHATSAPP.GO_TO_WHATSAPPACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="whatsappAccount-image" hide-xs>\n          <img ng-src="assets/images/business/whatsappAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.whatsappAccount.id}}\n            <span ng-if="vm.whatsappAccount.name">{{vm.whatsappAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="WHATSAPP.CREATED_AT"></span> <span>{{vm.whatsappAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.whatsappAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveWhatsappAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (whatsappDispositionsForm.$invalid) || (whatsappCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.whatsappAccount.name" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.whatsappAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="WHATSAPP.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.whatsappAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="WHATSAPP.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\'  || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.ACCOUNTSID">AccountSID</label>\n                <input type="text" name="accountSid" ng-model="vm.whatsappAccount.accountSid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'accountSid\'].$error" ng-show="generalForm[\'accountSid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\'  || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.whatsappAccount.authToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authToken\'].$error" ng-show="generalForm[\'authToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container ng-if="vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.BASEURL">BaseURL</label>\n\n                <md-select name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryBaseUrl.url" ng-repeat="mandatoryBaseUrl in vm.baseUrl" ng-disabled="mandatoryBaseUrl.canSelect === false">{{ mandatoryBaseUrl.name }}</md-option>\n                </md-select>\n\n                <div ng-messages="generalForm[\'baseUrl\'].$error" ng-show="generalForm[\'baseUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.BASEURL_REQUIRED">Base URL field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.PHONE">phone</label>\n                <input type="text" name="phone" ng-model="vm.whatsappAccount.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.PHONE_REQUIRED">phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.RECEIVEURL">receiveUrl</label>\n\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUrl" name="receiveUrl" ng-value="vm.whatsappAccount.remote + \'/api/whatsapp/accounts/\' + vm.whatsappAccount.id + \'/notify?token=\' + vm.whatsappAccount.token" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="WHATSAPP.HELP.RECEIVEURL"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.whatsappAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.whatsappAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.whatsappAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="WHATSAPP.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.whatsappAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.queueTransfer == true" class="md-block">\n                <label translate="WHATSAPP.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.whatsappAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.agentTransfer == true" class="md-block">\n                <label translate="WHATSAPP.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.whatsappAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.MOTIONPROXY">MotionProxy</label>\n                <input type="url" name="remote" ng-model="vm.whatsappAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="WHATSAPP.HELP.MOTIONPROXY"></span></div>\n                <div ng-messages="proxyForm[\'remote\'].$error" ng-show="proxyForm[\'remote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.whatsappAccount.token" disabled>\n\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.mandatoryDisposition" class="md-block">\n                <label translate="WHATSAPP.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.whatsappAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="WHATSAPP.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="WhatsappAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="whatsappAccount-detail-form-container whatsappdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="WHATSAPP.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add whatsapp dispositions" translate translate-attr-label="WHATSAPP.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="whatsappAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'WHATSAPP.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container whatsappcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountWhatsappCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="WHATSAPP.WHATSAPPCANNEDANSWERS">WhatsappCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getWhatsappAccountWhatsappCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event)" aria-label="add whatsappCannedAnswer" translate translate-attr-label="WHATSAPP.ADD_WHATSAPPCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length}} {{vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedWhatsappAccountWhatsappCannedAnswers" csv-label="true" filename="whatsappAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedWhatsappAccountWhatsappCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getWhatsappAccountWhatsappCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'WHATSAPP.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'WHATSAPP.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'WHATSAPP.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'WHATSAPP.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'WHATSAPP.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="whatsappCannedAnswer" md-select-id="id" ng-repeat="whatsappCannedAnswer in vm_dc.whatsappAccountWhatsappCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{ whatsappCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" translate="WHATSAPP.EDIT_WHATSAPPCANNEDANSWER">\n                                Edit WhatsappCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(whatsappCannedAnswer, $event)" translate="WHATSAPP.DELETE_WHATSAPPCANNEDANSWER">\n                                Delete WhatsappCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.whatsappAccountWhatsappCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="WHATSAPP.NO_WHATSAPPCANNEDANSWER_AVAILABLE">No whatsappcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.whatsappAccountWhatsappCannedAnswers.count}}" md-on-paginate="vm_dc.getWhatsappAccountWhatsappCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.whatsappAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="WHATSAPP.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedWhatsappAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedWhatsappAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedWhatsappAccountApps.length}} {{vm_ac.selectedWhatsappAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedWhatsappAccountApps($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedWhatsappAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.whatsappAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editWhatsappAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.whatsappAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="WHATSAPP.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getWhatsappAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getWhatsappAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getWhatsappAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="WHATSAPP.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedWhatsappAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedWhatsappAccountInteractions.length}} {{vm_dc.selectedWhatsappAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedWhatsappAccountInteractions" csv-label="true" filename="whatsappAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedWhatsappAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedWhatsappAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getWhatsappAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'WHATSAPP.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'WHATSAPP.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'WHATSAPP.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'WHATSAPP.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'WHATSAPP.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'WHATSAPP.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'WHATSAPP.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.whatsappAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'WHATSAPP.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'WHATSAPP.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spywhatsappInteraction($event, interaction)" translate="WHATSAPP.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.whatsappInteractionDownload(interaction, $event)" translate="WHATSAPP.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="WHATSAPP.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.whatsappAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="WHATSAPP.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.whatsappAccountInteractions.count}}" md-on-paginate="vm_dc.getWhatsappAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/whatsappCannedAnswers/dialog.html",'<md-dialog class="whatsappCannedAnswer-dialog" aria-label="New WhatsappCannedAnswer">\n  <form name="whatsappCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.whatsappCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="whatsappCannedAnswerForm[\'key\'].$error" ng-show="whatsappCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.whatsappCannedAnswer.value" required></textarea>\n\n        <div ng-messages="whatsappCannedAnswerForm[\'value\'].$error" ng-show="whatsappCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappCannedAnswer.description">\n\n        <div ng-messages="whatsappCannedAnswerForm[\'description\'].$error" ng-show="whatsappCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappCannedAnswer" ng-click="vm.saveWhatsappCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="whatsappCannedAnswerForm.$invalid || whatsappCannedAnswerForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappCannedAnswer" ng-click="vm.addNewWhatsappCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="whatsappCannedAnswerForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPCANNEDANSWER" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPCANNEDANSWER">\n          ADD WHATSAPPCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappCannedAnswer" ng-click="vm.deleteWhatsappCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/whatsappAccounts.html",'<div id="whatsappAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-whatsapp" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="WHATSAPP.WHATSAPPACCOUNTS">WhatsappAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="WHATSAPP.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedWhatsappAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedWhatsappAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="WHATSAPP.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-whatsappAccounts-count">\n          <span>{{vm.selectedWhatsappAccounts.length}}</span>\n          <span translate="WHATSAPP.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="WHATSAPP.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllWhatsappAccounts()" translate="WHATSAPP.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectWhatsappAccounts()" translate="WHATSAPP.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedWhatsappAccounts" csv-label="true" filename="whatsappAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedWhatsappAccounts($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- WHATSAPPACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedWhatsappAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'WHATSAPP.KEY\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'WHATSAPP.LIST\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'WHATSAPP.TYPE\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'WHATSAPP.PHONE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'WHATSAPP.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.whatsappAccounts.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="whatsappAccount" md-select-id="id" ng-repeat="whatsappAccount in vm.whatsappAccounts.rows">\n                <td md-cell ng-if="whatsappAccount.userpic"><img class="avatar" alt="{{whatsappAccount.name}}" ng-src="api/users/{{whatsappAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!whatsappAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{whatsappAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="id ">{{whatsappAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="name ">{{whatsappAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="key ">{{whatsappAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':whatsappAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="type ">{{ vm.arraytype[whatsappAccount.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="phone ">{{whatsappAccount.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="description ">{{whatsappAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(whatsappAccount, $event    )" translate="WHATSAPP.EDIT_WHATSAPPACCOUNT">\n                          Edit WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(whatsappAccount, $event    )" translate="WHATSAPP.INTERACTIONS_WHATSAPPACCOUNT">\n                          Interactions WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(whatsappAccount, $event    )" translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT">\n                          AgentAdd WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(whatsappAccount, $event    )" translate="WHATSAPP.DELETE_WHATSAPPACCOUNT">\n                          Delete WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappAccounts.count}}" md-on-paginate="vm.getWhatsappAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / WHATSAPPACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD WHATSAPPACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-whatsappAccount-button" ng-click="vm.createOrEditWhatsappAccount($event)" aria-label="add whatsappAccount" translate translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD WHATSAPPACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",'<md-dialog class="whatsappQueue-dialog" aria-label="New WhatsappQueue">\n  <form name="whatsappQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.whatsappQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newWhatsappQueue">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n        <div ng-messages="whatsappQueueForm[\'name\'].$error" ng-show="whatsappQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="WHATSAPP.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.whatsappQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="whatsappQueueForm[\'strategy\'].$error" ng-show="whatsappQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.whatsappQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="whatsappQueueForm[\'timeout\'].$error" ng-show="whatsappQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappQueue.description">\n\n        <div ng-messages="whatsappQueueForm[\'description\'].$error" ng-show="whatsappQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappQueue" ng-click="vm.saveWhatsappQueue()" class="send-button md-accent md-raised" ng-disabled="whatsappQueueForm.$invalid || whatsappQueueForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappQueue" ng-click="vm.addNewWhatsappQueue()" class="send-button md-accent md-raised" ng-disabled="whatsappQueueForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPQUEUE" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPQUEUE">\n          ADD WHATSAPPQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappQueue" ng-click="vm.deleteWhatsappQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",'<md-dialog class="whatsappQueue-dialog" aria-label="whatsappQueue" ng-init="vm.onInit()">\n  <form name="whatsappQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE">Add Agent to whatsappQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",'<md-dialog class="whatsappQueue-dialog" aria-label="whatsappQueue" ng-init="vm.onInit()">\n  <form name="whatsappQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/view.html",'<div id="whatsapp-whatsappQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-whatsappQueues-button md-icon-button" aria-label="Go to whatsappQueues" ng-click="vm.gotoWhatsappQueues()" translate translate-attr-aria-label="WHATSAPP.GO_TO_WHATSAPPQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="whatsappQueue-image" hide-xs>\n          <img ng-src="assets/images/business/whatsappQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.whatsappQueue.id}}\n            <span ng-if="vm.whatsappQueue.name">{{vm.whatsappQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="WHATSAPP.CREATED_AT"></span> <span>{{vm.whatsappQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.whatsappQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="WHATSAPP.TEAMADD_WHATSAPPQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.whatsappQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveWhatsappQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.whatsappQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="WHATSAPP.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.whatsappQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.whatsappQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.whatsappQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/whatsappQueues.html",'<div id="whatsappQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-whatsapp" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="WHATSAPP.WHATSAPPQUEUES">WhatsappQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="WHATSAPP.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedWhatsappQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedWhatsappQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="WHATSAPP.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-whatsappQueues-count">\n          <span>{{vm.selectedWhatsappQueues.length}}</span>\n          <span translate="WHATSAPP.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="WHATSAPP.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllWhatsappQueues()" translate="WHATSAPP.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectWhatsappQueues()" translate="WHATSAPP.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedWhatsappQueues" csv-label="true" filename="whatsappQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedWhatsappQueues($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- WHATSAPPQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedWhatsappQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'WHATSAPP.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.whatsappQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="whatsappQueue" md-select-id="id" ng-repeat="whatsappQueue in vm.whatsappQueues.rows">\n                <td md-cell ng-if="whatsappQueue.userpic"><img class="avatar" alt="{{whatsappQueue.name}}" ng-src="api/users/{{whatsappQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!whatsappQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{whatsappQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="id ">{{whatsappQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="name ">{{whatsappQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="strategy ">{{ vm.arraystrategy[whatsappQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(whatsappQueue, $event    )" translate="WHATSAPP.EDIT_WHATSAPPQUEUE">\n                          Edit WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(whatsappQueue, $event    )" translate="WHATSAPP.TEAMADD_WHATSAPPQUEUE">\n                          teamadd WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(whatsappQueue, $event    )" translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE">\n                          agentadd WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(whatsappQueue, $event    )" translate="WHATSAPP.DELETE_WHATSAPPQUEUE">\n                          Delete WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(whatsappQueue, $event    )" translate="WHATSAPP.GOTOREALTIME_WHATSAPPQUEUE">\n                          goToRealtime WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappQueues.count}}" md-on-paginate="vm.getWhatsappQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / WHATSAPPQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD WHATSAPPQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-whatsappQueue-button" ng-click="vm.createOrEditWhatsappQueue($event)" aria-label="add whatsappQueue" translate translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD WHATSAPPQUEUE BUTTON --\x3e\n</div>'),e.put("app/navigation/layouts/horizontal-navigation/navigation.html",'<div layout="row" layout-align="start center">\n  <ms-navigation-horizontal></ms-navigation-horizontal>\n</div>'),e.put("app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html",'<ms-navigation class="scrollable" folded="vm.folded"></ms-navigation>'),e.put("app/navigation/layouts/vertical-navigation/navigation.html",'<md-toolbar class="navigation-header md-whiteframe-1dp" layout="row" layout-align="space-between center">\n  <div class="logo" layout="row" layout-align="start center">\n    <span class="logo-image"><img src="/api/settings/1/logo" alt="logo" /></span>\n    \x3c!-- <span class="logo-image"><img src="assets/images/logos/whisker_32x32.png" alt="motion_whisker_32x32" /></span> --\x3e\n    <span class="logo-text text-truncate">{{vm.getLogo() | uppercase}}</span>\n  </div>\n  <md-icon class="fold-toggle s18" md-font-icon="icon-backburger" hide show-gt-sm ng-click="vm.toggleMsNavigationFolded()"></md-icon>\n</md-toolbar>\n\n<ms-navigation class="scrollable" folded="vm.folded"></ms-navigation>'),e.put("app/quick-panel/quick-panel.html",'<md-content>\n  <md-tabs md-no-pagination md-swipe-content md-stretch-tabs="always">\n    <md-tab>\n      <md-tab-label>\n        <span translate="QUICKPANEL.TODAY">TODAY</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="today-tab scrollable" ng-include="\'app/quick-panel/tabs/today/today-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n    <md-tab ng-if="vm.currentUser.allowmessenger || vm.currentUser.role !== \'agent\'" ng-include="\'app/quick-panel/tabs/chat/chat-tab.html\'" ng-controller="ChatInternalController as vm_ct" ng-init="vm_ct.init(vm.license)" md-on-deselect="vm_ct.user = undefined">\n      <md-tab-label>\n        <div ng-if="vm.unreadTotalMessages" class="md-accent-bg unread-message-count-chat">{{vm.unreadTotalMessages}}</div>\n        <span>MESSENGER</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="chat-tab scrollable" ng-include="\'app/quick-panel/tabs/chat/chat-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n    <md-tab ng-if="vm.currentUser.allowmessenger || vm.currentUser.role !== \'agent\'" ng-include="\'app/quick-panel/tabs/groups/group-tab.html\'" ng-controller="ChatGroupController as vm_cg" ng-init="vm_cg.init(vm.license)" md-on-deselect="vm_cg.group = undefined">\n      <md-tab-label>\n        <div ng-if="vm.unreadTotalGroupMessages" class="md-accent-bg unread-message-count-chat">{{vm.unreadTotalGroupMessages}}</div>\n        <span translate="QUICKPANEL.GROUPS">GROUPS</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="group-tab scrollable" ng-include="\'app/quick-panel/tabs/groups/group-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n  </md-tabs>\n</md-content>'),e.put("app/quick-panel/tabs/activity/activity-tab.html",'<md-list class="friends">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.FRIENDS">Friends</span>\n  </md-subheader>\n\n  <md-list-item class="friend md-3-line" ng-repeat="friend in vm.activities.friends">\n    <img ng-src="{{friend.avatar}}" class="md-avatar" alt="{{friend.name}}" />\n\n    <div class="status {{friend.status}}"></div>\n\n    <div ng-if="contact.unread" class="md-accent-bg unread-message-count">{{contact.unread}}</div>\n\n    <div class="md-list-item-text">\n      <h3 class="message">{{friend.message}}</h3>\n      <p class="time">{{friend.time}}</p>\n    </div>\n  </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list class="servers">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.APP_SERVERS">Application Servers</span>\n  </md-subheader>\n\n  <md-list-item class="server md-3-line" ng-repeat="server in vm.activities.servers">\n    <md-icon md-font-icon="icon-checkbox-blank-circle" class="s16 status" ng-class="server.status"></md-icon>\n\n    <div class="md-list-item-text">\n      <h3>{{server.location}}</h3>\n      <p>{{server.detail}}</p>\n    </div>\n  </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list class="stats">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.USER_STATS">User Stats</span>\n  </md-subheader>\n\n  <md-list-item class="stat md-2-line" ng-repeat="stat in vm.activities.stats">\n    <div class="md-list-item-text">\n      <span>{{stat.title}} ({{stat.current}} / {{stat.total}})</span>\n      <md-progress-linear ng-class="stat.status" md-mode="determinate" value="{{stat.percent}}"></md-progress-linear>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/quick-panel/tabs/chat/chat-tab.html",'<div class="main" ng-hide="vm_ct.user && vm_ct.isMessengerAllowed">\n  <audio id="beep-player" hidden src="/assets/ms-phonebar/sounds/beep.ogg"></audio>\n  <md-subheader class="md-no-sticky">\n    <div class="search" layout="row" layout-align="space-between center">\n      <md-icon md-font-icon="icon-magnify" class="icon search-icon"></md-icon>\n      <input class="search-input" ng-model="vm_ct.search.$" type="text" translate translate-attr-placeholder="QUICKPANEL.SEARCH" flex>\n      <md-select ng-model="vm_ct.search.online" class="height-50 no-padding no-margin" aria-label="Chat Tab Search">\n        <md-option ng-value="undefined" translate="DASHBOARDS.ALL">All</md-option>\n        <md-option ng-value="true">\n          <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg" translate="CHAT.ONLINE"></md-icon>Online\n        </md-option>\n        <md-option ng-value="false">\n          <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 red-fg" translate="CHAT.OFFLINE"></md-icon>Offline\n        </md-option>\n      </md-select>\n    </div>\n  </md-subheader>\n  <md-divider></md-divider>\n  <md-list class="recent">\n    <md-list-item class="contact md-3-line" ng-if="user.id !== vm_ct.currentUser.id" ng-repeat="user in vm_ct.users.rows | orderBy: \'-lastMessageAt\' | filter: vm_ct.search" ng-click="vm_ct.openChat(user)">\n      <md-divider></md-divider>\n      <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : vm_ct.defaultAvatar}}" class="md-avatar" alt="{{user.fullname}}" />\n      <div class="status" ng-class="{true: \'online\', false: \'offline\'}[user.online]"></div>\n      <div ng-if="vm_ct.unreadMessages[user.id]" class="md-accent-bg unread-message-count">\n        {{vm_ct.unreadMessages[user.id]}}</div>\n      <div class="md-list-item-text">\n        <div layout="row">\n          <h3>{{user.fullname}}</h3>\n          <md-icon ng-if="!user.allowmessenger && user.role === \'agent\'" class="s16 margin-left-5" ng-style="{\'color\': \'red\' }" md-font-icon="icon-block-helper">\n          </md-icon>\n        </div>\n        <p>{{user.name}} &#60;{{user.internal}}&#62;</p>\n        <div layout="row" layout-align="start center">\n          <md-icon ng-if="user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" ng-class="{\'md-accent\': user.lastMessage.read}" md-font-icon="{{ user.lastMessage.read ? \'icon-check-all\' : \'icon-check\' }}"></md-icon>\n          <p>{{user.lastMessage.body | limitTo:20 }}{{user.lastMessage.body.length > 20 ? \'...\' : \'\' }}</p>\n          <span flex></span>\n          <p class="last-message" ng-if="user.lastMessageAt != vm_ct.standardDate">\n            {{user.lastMessageAt | formatdate}}</p>\n        </div>\n    </md-list-item>\n</div>\n</md-list>\n</div>\n\n<div class="chat" ng-show="vm_ct.user && vm_ct.isMessengerAllowed" layout="column">\n  <md-toolbar class="md-accent">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n\n      <div layout="row" layout-align="start center">\n        <md-button class="md-icon-button" ng-click="vm_ct.closeChat()" aria-label="Back" translate translate-attr-aria-label="QUICKPANEL.BACK">\n          <md-icon md-font-icon="icon-keyboard-backspace"></md-icon>\n        </md-button>\n        <h4>\n          <span>{{vm_ct.user.fullname}}</span>\n        </h4>\n      </div>\n\n      <div layout="row" layout-align="end center">\n        <md-button ng-if="vm_ct.license.webrtc && vm_ct.currentUser.role === \'agent\' && vm_ct.currentUser.showWebBar === 2 && vm_ct.user.role === \'agent\'" class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="vm_ct.webcall(vm_ct.user.name)">\n          <md-icon md-font-icon="icon-phone"></md-icon>\n        </md-button>\n        <md-menu ng-if="vm_ct.currentUser.phoneBarRemoteControl && vm_ct.currentUser.role === \'agent\' && vm_ct.currentUser.showWebBar === 0 && vm_ct.user.role === \'agent\'">\n          <md-button class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="$mdOpenMenu($event)">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n\n          <md-menu-content width="3">\n            <md-menu-item ng-disabled="!vm_ct.currentUser.phoneBarRemoteControl">\n              <md-button ng-click="vm_ct.call(vm_ct.user.name)">\n                {{\'DASHBOARDS.CALL_NUMBER\' | translate}} ({{vm_ct.user.name}})\n              </md-button>\n            </md-menu-item>\n            <md-menu-item ng-disabled="!vm_ct.currentUser.phoneBarRemoteControl">\n              <md-button ng-click="vm_ct.transfer(vm_ct.user.name)">\n                {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} ({{vm_ct.user.name}})\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n    </div>\n\n  </md-toolbar>\n  <md-content flex layout-paddings ms-scroll id="chat-dialog">\n    <div ng-if="vm_ct.isLoading" layout="row" layout-align="center center">\n      <md-progress-circular class="md-accent" md-diameter="48" md-mode="indeterminate"></md-progress-circular>\n    </div>\n    <div ms-timeline="vm_ct.timelineOptions" ms-timeline-load-more="vm_ct.loadMoreMessages()">\n      <div layout="row" ng-repeat="message in vm_ct.user.messages" class="ms-timeline-item md-padding message-row" ng-class="message.FromId === vm_ct.currentUser.id ? \'user\' : \'contact\'">\n        <img ng-if="message.FromId === vm_ct.user.id" ng-src="{{ vm_ct.user.userpic ? \'api/users/\' + vm_ct.user.id + \'/avatar\' : vm_ct.defaultAvatar }}" class="avatar" alt="{{vm_ct.user.fullname}}" />\n        <img ng-if="message.FromId === vm_ct.currentUser.id" ng-src="{{ vm_ct.currentUser.userpic ? \'api/users/\' + vm_ct.currentUser.id + \'/avatar\' : vm_ct.defaultAvatar }}" class="avatar">\n        <div class="bubble timeline-card" flex>\n          <span class="message" ng-bind-html="message.body | embed:{linkTarget:\'_blank\',emoji:false,fontSmiley:false}"></span>\n          <div layout="row" layout-align="end center">\n            <span class="time secondary-text">{{ message.createdAt | formatdate }}</span>\n            <md-icon ng-if="message.FromId === vm_ct.currentUser.id" class="s16 margin-5" ng-class="{\'md-accent\': message.read}" md-font-icon="{{ message.read ? \'icon-check-all\' : \'icon-check\' }}"></md-icon>\n          </div>\n        </div>\n      </div>\n\n      <div ng-if="vm_ct.hasMoreMessages" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row">\n        <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-click="vm_ct.loadMoreMessages()" translate="DASHBOARDS.MORE">\n        </md-button>\n      </div>\n      <div ng-if="!vm_ct.hasMoreMessages && vm_ct.user.messages.length > 20" layout="row" layout-align="end center" class="ng-scope layout-align-center-center layout-row">\n        <md-button class="md-fab md-mini" type="button" ng-click="vm_ct.scrollToTopOfChat(0)">\n          <md-icon md-font-icon="icon-arrow-up-bold"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-content>\n\n  <form ng-submit="vm_ct.reply()" layout="row" class="reply" layout-align="start center">\n    <textarea ng-keyup="$event.keyCode == 13 && !vm_ct.disabled? vm_ct.reply() : null" flex ng-model="vm_ct.replyMessage" placeholder="Type and hit enter to send message" translate translate-attr-placeholder="QUICKPANEL.REPLY_PLACEHOLDER" autofocus></textarea>\n    <md-button ng-disable="vm_ct.disabled" class="md-fab md-mini" type="submit" aria-label="Send message" translate translate-attr-aria-label="QUICKPANEL.SEND_MESSAGE">\n      <md-icon md-font-icon="icon-send"></md-icon>\n    </md-button>\n  </form>\n</div>'),e.put("app/quick-panel/tabs/groups/create/dialog.html",'<md-dialog class="group-dialog" aria-label="New ChatGroup">\n  <form name="groupForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(null)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      \x3c!--START Error--\x3e\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      \x3c!--END Error--\x3e\n\n      \x3c!--START NAME--\x3e\n      <md-input-container class="md-block">\n        <label translate="QUICKPANEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.group.name" required autofocus>\n        <div ng-messages="groupForm[\'name\'].$error" ng-show="groupForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="QUICKPANEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="QUICKPANEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      \x3c!--END NAME--\x3e\n\n      \x3c!--START Members--\x3e\n      <md-input-container class="md-block">\n        <label translate="QUICKPANEL.MEMBERS">Members</label>\n        <md-contact-chips ng-model="vm.group.members" md-contacts="vm.querySearch($query)" md-contact-name="name" md-contact-image="image" md-require-match="true" md-highlight-flags="i" placeholder="{{\'QUICKPANEL.MEMBERS\' | translate}}">\n        </md-contact-chips>\n        <div ng-messages="groupForm[\'strategy\'].$error" ng-show="groupForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="QUICKPANEL.ERRORS.MEMBERS_REQUIRED">Members field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      \x3c!--END Members--\x3e\n\n      \x3c!--START Writing--\x3e\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.group.write" aria-label="Write">\n          {{\'QUICKPANEL.ENABLE_WRITING\' | translate}}\n        </md-switch>\n      </md-input-container>\n      \x3c!--END Writing--\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.newChatGroup" ng-click="vm.saveChatGroup()" class="send-button md-accent md-raised" ng-disabled="groupForm.$invalid || groupForm.$pristine || (vm.group.members.length < 1)" aria-label="SAVE" translate="QUICKPANEL.SAVE" translate-attr-aria-label="QUICKPANEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/quick-panel/tabs/groups/group-tab.html",'<div class="main" ng-if="!vm_cg.group">\n  <md-subheader>\n    <div layout="row">\n      \x3c!-- START Search --\x3e\n      <div class="search" layout="row" layout-align="start center" flex>\n        <md-icon md-font-icon="icon-magnify" class="icon search-icon"></md-icon>\n        <input ng-model="vm_cg.search" type="text" translate translate-attr-placeholder="QUICKPANEL.SEARCH" flex>\n      </div>\n      \x3c!-- END Search --\x3e\n\n      \x3c!-- START New Group --\x3e\n      <md-button ng-if="vm_cg.currentUser.role !== \'agent\'" class="md-icon-button" aria-label="New" ng-click="vm_cg.addGroup(null, $event)">\n        <md-icon md-font-icon="icon-account-multiple-plus" class="icon"></md-icon>\n      </md-button>\n      \x3c!-- END New Group --\x3e\n    </div>\n  </md-subheader>\n\n  <md-divider></md-divider>\n\n  \x3c!-- START Groups --\x3e\n  <md-list class="recent no-padding">\n    \x3c!-- START Group --\x3e\n    <md-list-item class="contact" ng-repeat="group in vm_cg.groupsToArray() | filter:vm_cg.search" ng-click="vm_cg.toggleChat(group)">\n      <img src="assets/images/avatars/group.png" class="md-avatar" alt="{{group.name}}" />\n      <div ng-if="group.unreadGroupMessages" class="md-accent-bg unread-message-count">{{group.unreadGroupMessages}}</div>\n      <div class="md-list-item-text">\n        <div layout="row">\n          <h3>{{group.name}}</h3>\n        </div>\n      </div>\n\n      <md-button ng-if="vm_cg.currentUser.role !== \'agent\'" class="md-secondary md-icon-button" aria-label="Remove" ng-click="vm_cg.deleteGroup(group, $event)">\n        <md-icon md-font-icon="icon-delete" class="icon s18"></md-icon>\n      </md-button>\n\n      <md-divider ng-if="!$last"></md-divider>\n    </md-list-item>\n    <md-list-item>\n      <div ng-if="!vm_cg.groupsToArray().length" layout="row" layout-align="center center" flex>\n        <span>{{\'QUICKPANEL.NO_AVAILABLE_GROUPS\' | translate}}</span>\n      </div>\n    </md-list-item>\n    \x3c!-- END Group --\x3e\n  </md-list>\n  \x3c!-- END Groups --\x3e\n</div>\n\n<div class="chat" ng-if="vm_cg.group" layout="column">\n  <md-toolbar class="md-accent">\n    <div class="md-toolbar-tools " layout="row" layout-align="space-between center">\n      <md-button class="md-icon-button" ng-click="vm_cg.back()" aria-label="Back" translate translate-attr-aria-label="QUICKPANEL.BACK" flex="15">\n        <md-icon md-font-icon="icon-keyboard-backspace"></md-icon>\n      </md-button>\n      <h4 flex layout-align="start center" style="max-height: 100%; overflow-y:auto;">\n        <span translate="QUICKPANEL.YOU" translate-values=\'{participants: vm_cg.participants}\'></span>\n      </h4>\n\n      <div layout="row" layout-align="end center">\n        <md-button ng-if="vm_cg.license.webrtc && vm_cg.currentUser.role === \'agent\' && vm_cg.currentUser.showWebBar === 2 && vm_cg.user.role === \'agent\' && vm_cg.user.showWebBar === 2" class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="vm_cg.webcall(vm_cg.user.name)">\n          <md-icon md-font-icon="icon-phone"></md-icon>\n        </md-button>\n      </div>\n    </div>\n\n  </md-toolbar>\n  <md-content flex layout-paddings id="chat-group-dialog">\n    <div layout="row" ng-repeat="message in vm_cg.group.messages" class="message-row" ng-class="message.FromId === vm_cg.currentUser.id ? \'user\' : \'contact\'">\n      <img ng-if="message.FromId !== vm_cg.currentUser.id" ng-src="{{\'api/users/\' + message.FromId + \'/avatar\'}}" class="avatar" alt="{{vm_cg.user.fullname}}" />\n      <img ng-if="message.FromId === vm_cg.currentUser.id" class="avatar" ng-src="{{vm_cg.currentUser.userpic ? \'api/users/\' + vm_cg.currentUser.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}">\n      <div class="bubble" flex>\n        <div ng-if="message.FromId !== vm_cg.currentUser.id">\n          <span style="font-size: 12px;">{{vm_cg.group.membersByKeys[message.FromId].fullname}}</span>\n        </div>\n        <span class="message" ng-bind-html="message.body | embed:{linkTarget:\'_blank\',emoji:false,fontSmiley:false}"></span>\n        <div layout="row" layout-align="end center">\n          <span class="time secondary-text" style="margin-top: 0px;">{{message.createdAt | formatdate }}</span>\n          <md-icon ng-if="message.FromId === vm_cg.currentUser.id" class="s16 margin-5" style="cursor: pointer;" md-font-icon="icon-information-outline" ng-click="vm_cg.showMessageInfo($event, message)"></md-icon>\n        </div>\n      </div>\n    </div>\n  </md-content>\n\n  <form ng-if="(vm_cg.currentUser.role !== \'agent\') || vm_cg.group.write" ng-submit="vm_cg.reply()" layout="row" class="reply" layout-align="start center">\n    <textarea ng-keyup="$event.keyCode == 13 ? vm_cg.reply() : null" flex ng-model="vm_cg.replyMessage" placeholder="Type and hit enter to send message" translate translate-attr-placeholder="QUICKPANEL.REPLY_PLACEHOLDER" autofocus></textarea>\n\n    <md-button class="md-fab md-mini" type="submit" aria-label="Send message" translate translate-attr-aria-label="QUICKPANEL.SEND_MESSAGE">\n      <md-icon md-font-icon="icon-send"></md-icon>\n    </md-button>\n  </form>\n</div>'),e.put("app/quick-panel/tabs/groups/info/dialog.html",'<md-dialog class="group-dialog" aria-label="New ChatGroup">\n  <form name="groupForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(null)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div ng-if="vm.data.messages[$index].FromId !== vm.data.messages[$index].ToId" ng-repeat="user in vm.data.users" layout-margin>\n        <div layout="row">\n          <div layout="row" layout-align="start center">\n            <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" class="avatar" alt="{{user.fullname}}" />\n            <span>{{user.fullname}}</span>\n          </div>\n          <div layout="row" layout-align="end center" flex>\n            <md-icon class="s16 margin-5" md-font-icon="{{vm.data.messages[$index].read ? \'icon-check-all md-accent\' : \'icon-check\'}}"></md-icon>\n            <span class="time secondary-text">{{vm.data.messages[$index].updatedAt | formatdate }}</span>\n          </div>\n        </div>\n        <div>\n          <md-divider ng-if="!$last"></md-divider>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/quick-panel/tabs/today/today-tab.html",'<md-list class="date">\n  <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.TODAY">Today</span></md-subheader>\n  <md-list-item class="md-display-1 md-2-line">\n    <div class="secondary-text">\n      <div translate="QUICKPANEL.{{ (vm.date | date:\'EEEE\').toUpperCase() }}"></div>\n      <div layout="row" layout-align="start start">\n        <span> {{vm.date | date:\'d\'}}</span>\n        <span class="md-subhead">th</span>\n        <span translate="QUICKPANEL.{{ (vm.date | date:\'MMMM\').toUpperCase() }}"></span>\n      </div>\n    </div>\n  </md-list-item>\n</md-list>\n\n\x3c!-- <md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.EVENTS">Events</span></md-subheader>\n\n    <md-list-item class="md-2-line" ng-repeat="event in vm.events" ng-click="dummyFunction()">\n        <div class="md-list-item-text">\n            <h3>{{event.title}}</h3>\n\n            <p>{{event.detail}}</p>\n        </div>\n    </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.NOTES">Notes</span></md-subheader>\n    <md-list-item class="md-2-line" ng-repeat="note in vm.notes" ng-click="dummyFunction()">\n        <div class="md-list-item-text">\n            <h3>{{note.title}}</h3>\n\n            <p>{{note.detail}}</p>\n        </div>\n    </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.QUICK_SETTINGS">Quick Settings</span></md-subheader>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.NOTIFICATIONS">Notifications</h3>\n        <md-switch class="md-secondary" ng-model="vm.settings.notify" aria-label="Notifications" translate\n                   translate-attr-aria-label="QUICKPANEL.NOTIFICATIONS"></md-switch>\n    </md-list-item>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.CLOUD_SYNC">Cloud Sync</h3>\n        <md-switch class="md-secondary" ng-model="vm.settings.cloud" aria-label="Cloud Sync" translate\n                   translate-attr-aria-label="QUICKPANEL.CLOUD_SYNC"></md-switch>\n    </md-list-item>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.RETRO_THRUSTERS">Retro Thrusters</h3>\n        <md-switch class="md-secondary md-warn" ng-model="vm.settings.retro" aria-label="Retro Thrusters" translate\n                   translate-attr-aria-label="QUICKPANEL.RETRO_THRUSTERS"></md-switch>\n    </md-list-item>\n</md-list> --\x3e'),e.put("app/reset/reset.html",'<div id="reset-password" class="flex-scrollable" layout="column" ng-init="vm.onInit()">\n  <div id="reset-password-form-wrapper" layout="column" layout-align="center center">\n    <div id="reset-password-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n\n      <div class="title" translate="RESETPASSWORD.TITLE">Reset your password</div>\n\n      <form name="resetPasswordForm" novalidate>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="password" ng-model="vm.form.password" ng-pattern="vm.passwordPattern" placeholder="Password" translate translate-attr-placeholder="RESETPASSWORD.PASSWORD" required>\n          <div ng-messages="resetPasswordForm.password.$error" role="alert">\n            <div ng-message="required">\n              <span translate="RESETPASSWORD.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="RESETPASSWORD.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="passwordConfirm" ng-model="vm.form.passwordConfirm" placeholder="Password (Confirm)" match-password="password" translate translate-attr-placeholder="RESETPASSWORD.PASSWORD_CONFIRM">\n          <div ng-messages="resetPasswordForm.passwordConfirm.$error" role="alert">\n            <div ng-message="passwordMatch">\n              <span translate="TOOLBAR.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-button type="button" ng-click="vm.resetPassword()" class="md-raised md-accent submit-button" aria-label="UPDATE MY PASSWORD" ng-disabled="resetPasswordForm.$invalid || resetPasswordForm.$pristine" translate="RESETPASSWORD.UPDATE_PASSWORD" translate-attr-aria-label="RESETPASSWORD.UPDATE_PASSWORD">\n          RESET MY PASSWORD\n        </md-button>\n      </form>\n    </div>\n  </div>\n</div>'),e.put("app/toolbar/autoanswers/dialog.html",'<md-dialog class="autoanswers-dialog" aria-label="autoanswers">\n  <form name="autoanswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (\'TOOLBAR.AUTOANSWER_NOTIFICATIONS\' | translate)  }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content layout-padding>\n      <md-table-container>\n        <table md-table multiple>\n          <thead md-head>\n            <tr md-row>\n              <th></th>\n              <th md-column>{{ \'TOOLBAR.CHANNEL\' | translate }}</th>\n              <th md-column>{{ \'TOOLBAR.NOTIFICATIONS\' | translate }}</th>\n              <th md-column>{{ \'TOOLBAR.DELAY\' | translate }}</th>\n            </tr>\n          </thead>\n          <tbody md-body>\n            <tr md-row ng-repeat="item in vm.items" ng-if="item.permission">\n              <td>\n                <md-icon md-font-icon="{{item.font_icon}}" class="icon {{item.class}} {{item.font_icon}}" aria-label="{{item.label}}"></md-icon>\n              </td>\n              <td md-cell>\n                <div layout="row">\n                  <span translate="{{item.title}}"></span>\n                </div>\n              </td>\n              <td md-cell align="center">\n                <div layout="row" layout-align="center">\n                  <md-icon ng-if="item.enabled" md-font-icon="icon-check-circle" class="icon green-700-fg"></md-icon>\n                  <span ng-if="!item.enabled" style="color:red">X</span>\n                </div>\n              </td>\n              <td md-cell align="right">\n                <div layout="row" layout-align="end">\n                  <span ng-if="item.enabled">{{item.delay}}</span>\n                </div>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </md-table-container>\n    </md-dialog-content>\n\n    <md-dialog-actions class="md-dialog-action-center padding-rigth-15">\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/toolbar/changepassword/changepassword.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="changePasswordForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span ng-if="vm.reset" class="title" translate="TOOLBAR.RESETPASSWORD">Reset Password</span>\n        <span ng-if="!vm.reset" class="title" translate="TOOLBAR.CHANGEPASSWORD">Change Password</span>\n        <md-button ng-if="!vm.reset" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="TOOLBAR.OLD_PASSWORD" required>\n        <div ng-messages="changePasswordForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="TOOLBAR.NEW_PASSWORD" required>\n        <div ng-messages="changePasswordForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLBAR.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="changePasswordForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="TOOLBAR.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="changePasswordForm.$invalid || changePasswordForm.$pristine" aria-label="SAVE" translate="TOOLBAR.SAVE" translate-attr-aria-label="TOOLBAR.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/toolbar/layouts/vertical-navigation/toolbar.html",'<div layout="row" layout-align="start center">\n  <div layout="row" layout-align="start center" flex>\n    <md-button id="navigation-toggle" class="md-icon-button" ng-click="vm.toggleSidenav(\'navigation\')" hide-gt-sm aria-label="Toggle navigation" translate translate-attr-aria-label="TOOLBAR.TOGGLE_NAVIGATION">\n      <md-icon md-font-icon="icon-menu" class="icon"></md-icon>\n    </md-button>\n\n    <ms-shortcuts ng-if="!vm.isAgent()"></ms-shortcuts>\n\n    <div class="toolbar-separator"></div>\n\n    <div ng-if="vm.license.demo" class="blink md-padding">\n      <span class="md-warn-fg" translate="TOOLBAR.TRIAL_VERSION">Trial Version</span>\n    </div>\n\n    <div ng-if="vm.isAgent()" class="logo" layout-padding-left-8 layout="row" layout-align="start center">\n      <span class="logo-image"><img src="/api/settings/1/logo" alt="logo" /></span>\n      <span ng-show="vm.isAgent() && (vm.user.showWebBar != 2)" class="logo-text text-truncate">{{ vm.getLogo() |\n        uppercase }}</span>\n    </div>\n\n    \x3c!-- phonebar directive WebRtc type--\x3e\n    <ms-phonebar class="ms-phonebar" ng-if="vm.isAgent() && (vm.user.showWebBar == 2)" conf="vm.conf" sessions="vm.webRTCSessions" registered="vm.isWebRTCBarRegistered" flex></ms-phonebar>\n    \x3c!-- phonebar directive --\x3e\n  </div>\n\n  <div layout="row" layout-align="start center">\n\n    <md-progress-circular id="toolbar-progress" ng-if="$root.loadingProgress" class="md-accent" md-diameter="32">\n    </md-progress-circular>\n\n    \x3c!-- Pause Management --\x3e\n    <div ng-if="vm.isAgent() && (vm.user.showWebBar != 0)" layout="row" layout-align="end center">\n      <div class="toolbar-separator"></div>\n\n      <div class="border brad-5" layout="row" layout-align="center center" layout-margin>\n        <md-button ng-if="vm.user.voicePause" class="md-icon-button no-margin" ng-click="vm.unpause()">\n          <md-icon md-font-icon="icon-play-circle-outline" class="icon s24"></md-icon>\n          <md-tooltip md-direction="bottom">{{\'TOOLBAR.RESUME\' | translate}}</md-tooltip>\n        </md-button>\n\n        <md-button ng-disabled="vm.user.voicePause && \'DEFAULT PAUSE\' === vm.user.pauseType" class="md-icon-button no-margin" ng-click="vm.pause()">\n          <md-icon md-font-icon="icon-pause-circle-outline" class="icon s24"></md-icon>\n          <md-tooltip md-direction="bottom">{{\'TOOLBAR.PAUSE\' | translate}}</md-tooltip>\n        </md-button>\n\n        <md-menu>\n          <md-button aria-label="Pauses" class="md-icon-button no-margin" ng-click="$mdOpenMenu($event)">\n            <md-icon md-menu-origin md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-menu-content width="4">\n            <md-menu-item ng-if="!vm.pauses.length">\n              <md-button disabled="disabled">\n                <md-icon md-font-icon="icon-pause-octagon" md-menu-align-target></md-icon>\n                {{\'TOOLBAR.NO_PAUSES_AVAILABLE\' | translate}}\n              </md-button>\n            </md-menu-item>\n            <md-menu-item ng-repeat="pause in vm.pauses">\n              <md-button ng-disabled="vm.user.voicePause && pause.name === vm.user.pauseType" ng-click="vm.pause(pause.name)">\n                <md-icon md-font-icon="icon-pause-circle" md-menu-align-target></md-icon>\n                {{pause.name}}\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n    </div>\n    \x3c!-- Pause Management --\x3e\n\n    <div class="h5 padding-10" ng-if="vm.isAgent() && (vm.user.showWebBar != 0)">\n      <div layout="row" layout-align="space-between center">\n        <timer ng-if="vm.user.lastLoginAt" start-time="vm.user.lastLoginAt"></timer>\n        <md-tooltip>{{\'TOOLBAR.LOGIN_TIME\' | translate}}</md-tooltip>\n        <md-icon md-font-icon="icon-timelapse" class="icon s16"></md-icon>\n      </div>\n      <div layout="row" layout-align="center center" ng-if="vm.user.voicePause">\n        <timer start-time="vm.user.lastPauseAt"></timer>\n        <md-tooltip>{{\'TOOLBAR.PAUSE_TIME\' | translate}}</md-tooltip>\n        <md-icon md-font-icon="icon-coffee" class="icon s16"></md-icon>\n      </div>\n      <div ng-if="vm.user.voicePause">\n        <span class="blink red-fg">{{vm.user.pauseType || \'default\' | uppercase}}</span>\n      </div>\n    </div>\n\n    <div class="toolbar-separator" ng-if="vm.isAgent() && (vm.user.showWebBar != 0)"></div>\n\n    <md-menu-bar id="user-menu">\n      <md-menu md-position-mode="left bottom">\n        <md-button class="user-button" ng-click="$mdOpenMenu()" aria-label="User settings" translate translate-attr-aria-label="TOOLBAR.USER_SETTINGS">\n          <div layout="row" layout-align="space-between center">\n            <div class="avatar-wrapper">\n              <img md-menu-align-target class="avatar" src="assets/images/avatars/profile.png" ng-if="!vm.user.userpic">\n              <img md-menu-align-target class="avatar" ng-src="api/users/{{vm.user.id}}/avatar" ng-if="vm.user.userpic">\n              <md-icon md-font-icon ng-class="vm.userStatus.icon" ng-style="{\'color\': vm.userStatus.color }" class="icon status s16"></md-icon>\n            </div>\n            <div layout="column" layout-align="center center" class="padding-horizontal-5">\n              <span class="font-size-14 md-subhead">{{vm.user.fullname}}</span>\n              <span class="font-size-12 md-subhead">{{vm.user.name}} &#60;{{vm.user.internal}}&#62;</span>\n            </div>\n\n            <md-icon md-font-icon="icon-chevron-down" class="icon s16" hide-xs></md-icon>\n          </div>\n        </md-button>\n\n        <md-menu-content width="3">\n          <md-menu-item ng-if="vm.user.showWebBar == 2 && vm.user.phoneBarEnableSettings" class="md-indent">\n            <md-icon md-font-icon="icon-cog" class="icon"></md-icon>\n            <md-button ng-click="vm.openSettings($event)" ng-disabled="!vm.license.webrtc"><span translate="TOOLBAR.SETTINGS">SETTINGS</span></md-button>\n          </md-menu-item>\n\n          <md-menu-item class="md-indent">\n            <md-icon md-font-icon="icon-key-variant" class="icon"></md-icon>\n            <md-button ng-click="vm.changePassword($event)"><span translate="TOOLBAR.CHANGEPASSWORD">Change\n                Password</span></md-button>\n          </md-menu-item>\n\n          <md-menu-divider></md-menu-divider>\n\n          <md-menu-item class="md-indent">\n            <md-icon md-font-icon="icon-logout" class="icon"></md-icon>\n            <md-button ng-click="vm.logout()">Logout</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </md-menu-bar>\n\n    <div class="toolbar-separator"></div>\n\n    <md-button ng-if="vm.user.role === \'agent\' && (vm.license.chat || vm.license.mail || vm.license.messaging || vm.license.openchannel || vm.license.fax || vm.license.whatsapp)" class="preview-button no-margin" ng-disabled="vm.disable" ng-click="vm.autoAnswerNotificationsDialog($event)" aria-label="Language" md-menu-origin md-menu-align-target>\n      <md-icon md-font-icon="icon-reply" class="icon {{ vm.autoanswerIconColor }}"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.AUTOANSWER_NOTIFICATIONS">Notifications</span></md-tooltip>\n    </md-button>\n\n    <md-button ng-if="vm.user.role === \'agent\' && vm.license.dialer" class="preview-button no-margin" ng-disabled="vm.disable" ng-click="vm.preview($event)" aria-label="Language" md-menu-origin md-menu-align-target>\n      <div ng-if="vm.contacts" class="md-accent-bg open-contact-count badge-count">{{vm.contacts > 99 ? \'99+\' : vm.contacts}}</div>\n      <md-icon md-font-icon="icon-fire" class="icon red-900-fg"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.PREVIEW">Preview</span></md-tooltip>\n    </md-button>\n    \n    \x3c!-- \n      ADD V3\n      \n      <md-button ng-if="vm.user.role === \'agent\' && vm.license.voice && vm.user.permissions.includes(110)" class="preview-button no-margin" ng-disabled="vm.disable" aria-label="Language" md-menu-origin md-menu-align-target>\n      <div ng-if="vm.waitingQueueCalls.length > 0" class="md-accent-bg queues-call-count badge-count">{{vm.waitingQueueCalls.length}}</div>\n      <md-icon md-font-icon="icon-phone-incoming blue-fg" class="icon"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.WAITINGQUEUECALLS">Waiting Queues Calls</span></md-tooltip>\n    </md-button> --\x3e\n\n    \x3c!-- \n      ADD V3\n      \n      <md-button ng-if="vm.user.role === \'agent\' && vm.license.voice && vm.user.permissions.includes(110)" class="preview-button no-margin" ng-disabled="vm.disable" aria-label="Language" md-menu-origin md-menu-align-target>\n      <div ng-if="vm.waitingQueueCalls.length > 0" class="md-accent-bg queues-call-count badge-count">{{vm.waitingQueueCalls.length}}</div>\n      <md-icon md-font-icon="icon-phone-incoming blue-fg" class="icon"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.WAITINGQUEUECALLS">Waiting Queues Calls</span></md-tooltip>\n    </md-button> --\x3e\n\n    <ms-search-bar ng-if="vm.user.role !== \'agent\'" on-search="vm.search(query)" on-result-click="vm.searchResultClick(item)" debounce="300" collapse-on-blur="true"></ms-search-bar>\n\n    <md-menu id="language-menu" md-offset="0 72" md-position-mode="target-right target" layout="column" layout-align="center center">\n      <md-button class="md-icon-button no-margin" ng-click="$mdOpenMenu()" aria-label="Language" md-menu-origin md-menu-align-target>\n        <div layout="row" layout-align="center center">\n          <img class="flag" ng-src="assets/images/flags/{{vm.selectedLanguage.flag}}.png">\n        </div>\n      </md-button>\n\n      <md-menu-content width="3" id="language-menu-content">\n        <md-menu-item ng-repeat="(iso, lang) in vm.languages">\n          <md-button ng-click="vm.changeLanguage(lang)" aria-label="{{lang.title}}" translate translate-attr-aria-label="{{lang.title}}">\n            <span layout="row" layout-align="start center">\n              <img class="flag flag-24" ng-src="assets/images/flags/{{lang.flag}}.png">\n              <span>{{ lang.translation | translate | startcase }}</span>\n            </span>\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n\n    <div class="toolbar-separator"></div>\n\n    <md-button ng-if="vm.license.gray && vm.user.role !== \'agent\'" class="md-icon-button" ui-sref="app.settings.license" aria-label="Toggle quick panel">\n      <md-icon md-font-icon="icon-alert" class="icon md-warn blink"></md-icon>\n    </md-button>\n    <md-button ng-if="vm.license.gray && vm.user.role === \'agent\'" class="md-icon-button" aria-label="Toggle quick panel">\n      <md-icon md-font-icon="icon-alert" class="icon md-warn blink"></md-icon>\n    </md-button>\n\n    <div ng-if="vm.license.gray" class="toolbar-separator"></div>\n\n    <md-button id="quick-panel-toggle" class="md-icon-button" ng-click="vm.toggleSidenav(\'quick-panel\')" aria-label="Toggle quick panel" translate translate-attr-aria-label="TOOLBAR.TOGGLE_QUICK_PANEL">\n      <div ng-if="(vm.unreadTotalMessages + vm.unreadTotalGroupMessages)" class="md-accent-bg unread-message-count">\n        {{vm.unreadTotalMessages + vm.unreadTotalGroupMessages}}</div>\n      <md-icon md-font-icon="icon-format-list-bulleted" class="icon"></md-icon>\n    </md-button>\n  </div>\n</div>'),e.put("app/toolbar/preview/dialog.html",'<md-dialog class="preview-dialog" aria-label="preview">\n  <form name="previewForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (\'TOOLBAR.PREVIEW\' | translate) + (vm.preview.recallme ? \' - \' +\n          (\'CONTACTMANAGER.RECALLME\' | translate | uppercase) : \'\') }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div ng-if="vm.preview">\n        <div ng-if="vm.preview.recallme" layout="row" class="recall-me-info">\n          <md-icon md-font-icon="icon-information-outline" aria-label="Recall Me"></md-icon>\n          <p class="ml-5" translate="TOOLBAR.HELP.PREVIEW_RECALLME" translate-values="{ date: (vm.preview.scheduledat | date:\'short\') }" flex></p>\n        </div>\n        <div layout="row">\n          <div class="md-padding md-margin" layout="column" flex="30">\n            <md-input-container ng-if="vm.preview.Contact.id" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.ID">ID</label>\n              <input type="text" ng-model="vm.preview.Contact.id" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Queue.name" class="md-block no-margin">\n              <label translate="VOICE.QUEUE">Queue</label>\n              <input type="text" ng-model="vm.preview.Queue.name" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.List.name" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.LIST">List</label>\n              <input type="text" ng-model="vm.preview.List.name" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Contact.tags && vm.preview.Contact.tags.length" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.TAGS">Tags</label>\n              <input type="text" ng-model="vm.preview.Contact.tags" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Contact.Company && vm.preview.Contact.Company.name" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.COMPANY">Company</label>\n              <input type="text" ng-model="vm.preview.Contact.Company.name" disabled="true">\n            </md-input-container>\n          </div>\n          <md-divider></md-divider>\n          <div class="md-padding md-margin" layout="column" flex="35">\n            <md-input-container ng-repeat="(key, value) in vm.preview.Contact" ng-if="!vm.isNil(value) && !vm.isCustomField(key) && !vm.isHiddenField(key)" class="md-block no-margin">\n              <label>{{ \'CONTACTMANAGER.\' + key.toUpperCase() | translate}}</label>\n              <input type="text" ng-model="value" disabled="true">\n            </md-input-container>\n\n            <md-input-container ng-if="vm.additionalItems.length>0" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.ADDITIONAL_PHONES">Additional phones</label>\n              <md-chips ng-model="vm.additionalItems" placeholder="Phone numbers" readonly="true">\n                <md-chip-template custom-chip alt="{{$chip.type}} {{$chip.description}}" title="{{$chip.type}} {{$chip.description}}">\n                  {{ $chip.phone }}\n                </md-chip-template>\n              </md-chips>\n            </md-input-container>\n\n          </div>\n          <div class="md-padding md-margin" layout="column" flex="35">\n            <md-input-container ng-repeat="(key, value) in vm.preview.Contact" ng-if="!vm.isNil(value) && vm.isCustomField(key) && !vm.isHiddenField(key)" class="md-block no-margin">\n              <label>{{ vm.customFieldsMap[key] || key }}</label>\n              <input type="text" ng-model="value" disabled="true">\n            </md-input-container>\n          </div>\n        </div>\n      </div>\n      <div layout="row" ng-if="!vm.preview">\n        <span>no contacts available</span>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions class="md-dialog-action-center padding-rigth-15">\n      <md-button class="md-icon-button md-primary" ng-if="!vm.isRecallNotification" ng-hide="vm.hopperIds.length <= 1" ng-disabled="vm.disableGetContact" ng-click="vm.previousContact()" aria-label="PREVIOUSCONTACT" translate-attr-aria-label="TOOLS.PREVIOUSCONTACT">\n        <md-icon md-font-icon="icon-chevron-left"></md-icon>\n      </md-button>\n      <md-button class="md-fab green-bg" aria-label="CALL" translate-attr-aria-label="TOOLS.CALL" ng-disabled="vm.disable" ng-click="vm.originatePreview($event)">\n        <md-icon md-font-icon="icon-phone"></md-icon>\n      </md-button>\n      <md-button class="md-icon-button md-primary" ng-if="!vm.isRecallNotification" ng-disabled="vm.disableGetContact" ng-click="vm.nextContact()" aria-label="NEXTCONTACT" translate-attr-aria-label="TOOLS.NEXTCONTACT">\n        <md-icon md-font-icon="icon-chevron-right"></md-icon>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>')}]);
\ No newline at end of file
+!function(){"use strict";angular.module("app.auth",[])}(),function(){"use strict";angular.module("app.client-side-logging",[])}(),function(){"use strict";angular.module("app.core",["ngAnimate","ngAria","ngCookies","ngMessages","ngResource","ngSanitize","ngMaterial","pascalprecht.translate","ui.router","ui.router.state.events","gridster","ds.clock","angucomplete-alt"])}(),function(){"use strict";function e(e,n){e.state("app.errors_error-404",{url:"/errors/error-404",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.errors_error-404":{templateUrl:"app/errors/404/error-404.html",controller:"Error404Controller as vm"}},params:{status:404,statusText:"",data:{},config:{}},bodyClass:"error-404"}),n.addPart("app/errors/404")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-404",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.errors_error-500",{url:"/errors/error-500",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.errors_error-500":{templateUrl:"app/errors/500/error-500.html",controller:"Error500Controller as vm"}},params:{status:500,statusText:"",data:{},config:{}},bodyClass:"error-500"}),n.addPart("app/errors/500")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.errors.error-500",[]).config(e)}(),function(){"use strict";angular.module("app.errors",["app.errors.error-404","app.errors.error-500"])}(),function(){"use strict";function e(e){e.addPart("app/footer")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.footer",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.forgot",{url:"/forgot",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.forgot":{templateUrl:"app/forgot/forgot.html",controller:"ForgotPasswordController as vm"}},bodyClass:"forgot"}),n.addPart("app/forgot")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.forgot",[]).config(e)}(),function(){"use strict";function e(e){e.addPart("app/header")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.header",[]).config(e)}(),function(){"use strict";angular.module("motion",["angular-toasty","app.core","app.auth","app.navigation","app.toolbar","app.quick-panel","app.header","app.footer","app.realtime","app.dashboards","app.staff","app.contactmanager","app.voice","app.chat","app.mail","app.sms","app.openchannel","app.fax","app.tools","app.callysquare","app.analytics","app.integrations","app.settings","app.motiondialer","app.help","app.jscripty","app.marketplace","app.plugins","app.video","app.whatsapp","app.login","app.forgot","app.reset","app.errors","app.user-setting","app.client-side-logging"])}(),function(){"use strict";function e(e,n){e.state("app.login",{url:"/login?token&userId",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.login":{templateUrl:"app/login/login.html",controller:"LoginController as vm"}},bodyClass:"login"}),n.addPart("app/login")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.login",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.analytics",{abstract:!0,url:"/analytics"}).state("app.analytics.metrics",{url:"/metrics",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/metrics/metrics.html",controller:"MetricsController as vm"}},resolve:{metrics:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("analyticMetric@get",{fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Metrics",fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1201})}]},authenticate:!0,permissionId:1201,bodyClass:"analytics"}).state("app.analytics.extractedReports",{url:"/extractedReports",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/extractedReports/extractedReports.html",controller:"ExtractedReportsController as vm"}},resolve:{extractedReports:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("analyticExtractedReport@get",{fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ExtractedReports",fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1202})}]},authenticate:!0,permissionId:1202,bodyClass:"analytics"}),n.addPart("app/main/apps/analytics")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.analytics",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.analytics.reports"]).config(e)}(),function(){"use strict";function e(e){e.state("app.analytics.reports",{url:"/reports",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/reports/reports.html",controller:"ReportsController as vm"}},resolve:{treeReports:["apiResolver",function(e){return e.resolve("analyticTreeReport@get",{fields:"id,tree",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1203})}]},authenticate:!0,permissionId:1203,bodyClass:"analytics"}).state("app.analytics.reports.edit",{url:"/:id?tab",views:{"content@app":{templateUrl:"app/main/apps/analytics/views/reports/edit/view.html",controller:"ReportController as vm"}},resolve:{report:["apiResolver","$stateParams","$q","describeTable",function(e,n,a,i){var s;return e.resolve("analyticCustomReport@get",{fields:"createdAt,updatedAt,id,name,description,table,conditions,joins",id:n.id}).then(function(e){var n=[];if((s=e).joins)try{s.joins=JSON.parse(s.joins);for(var t=0;t<s.joins.length;t+=1)n.push(i.getColumns(s.joins[t].foreignTable))}catch(e){console.log(e)}return a.all(n)}).then(function(e){for(var n=0;n<e.length;n+=1)s.joins[n].foreignTableFields=_.difference(_.keys(e[n]),["$promise","$resolved"]);return s})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1203})}]},authenticate:!0,permissionId:1203,bodyClass:"analytics"})}e.$inject=["$stateProvider"],angular.module("app.analytics.reports",["ngJsTree"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.callysquare",{abstract:!0,url:"/callysquare"}).state("app.callysquare.odbcs",{url:"/odbcs",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/odbcs/odbcs.html",controller:"OdbcsController as vm"}},resolve:{odbcs:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ODBC",fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1101})}]},authenticate:!0,permissionId:1101,bodyClass:"callysquare"}).state("app.callysquare.squareRecordings",{url:"/squareRecordings",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/squareRecordings/squareRecordings.html",controller:"SquareRecordingsController as vm"}},resolve:{squareRecordings:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareRecording@get",{fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareRecordings",fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadCallySquareRecordings",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1102})}]},authenticate:!0,permissionId:1102,bodyClass:"callysquare"}),n.addPart("app/main/apps/callysquare")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.callysquare",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.callysquare.projects"]).config(e)}(),function(){"use strict";function e(e){e.state("app.callysquare.projects",{url:"/projects",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/projects/projects.html",controller:"ProjectsController as vm"}},resolve:{projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name,description,notes",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1103})}]},authenticate:!0,permissionId:1103,bodyClass:"callysquare"}).state("app.callysquare.projects.edit",{url:"/:id",views:{"content@app":{templateUrl:"app/main/apps/callysquare/views/projects/edit/view.html",controller:"ProjectController as vm"}},params:{crudPermissions:void 0},resolve:{project:["apiResolver","$stateParams",function(e,n){return e.resolve("squareProject@get",{id:n.id})}],users:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,role",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Users",mergeResources:!0,fields:"id,fullname,role",sort:"name",nolimit:!0})}],trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",sort:"name",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",type:"inbound",fields:"id,name",sort:"name",nolimit:!0})}],sounds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("sound@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Sounds",fields:"id,name",sort:"name",nolimit:!0})}],variables:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("variable@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Variables",fields:"id,name",sort:"name",nolimit:!0})}],databases:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareOdbc@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ODBC",fields:"id,name",sort:"name",nolimit:!0})}],projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("squareProject@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SquareProjects",fields:"id,name",sort:"name",nolimit:!0})}],contexts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceContext@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Contexts",fields:"id,name",sort:"name",nolimit:!0})}],intervals:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("interval@get",{fields:"id,name,IntervalId",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Intervals",fields:"id,name,IntervalId",sort:"name",nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"id,name",sort:"name",nolimit:!0})}],templates:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("template@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Templates",fields:"id,name",sort:"name",nolimit:!0})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"name",nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"id,name",sort:"name",nolimit:!0})}],pauses:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("pause@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Pauses",fields:"id,name",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1103})}]},authenticate:!0,permissionId:1103,bodyClass:"callysquare"})}e.$inject=["$stateProvider"],angular.module("app.callysquare.projects",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.chat",{abstract:!0,url:"/chat"}).state("app.chat.chatQueues",{url:"/chatQueues",views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatQueues/chatQueues.html",controller:"ChatQueuesController as vm"}},resolve:{chatQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:501,bodyClass:"chat"}).state("app.chat.chatQueues.edit",{url:"/:id?tab",params:{chatQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatQueues/edit/view.html",controller:"ChatQueueController as vm"}},resolve:{chatQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("chatQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:501,bodyClass:"chat"}).state("app.chat.chatWebsites",{url:"/chatWebsites",views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatWebsites/chatWebsites.html",controller:"ChatWebsitesController as vm"}},resolve:{chatWebsites:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatWebsites",fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}).state("app.chat.chatWebsites.edit",{url:"/:id?tab",params:{chatWebsite:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/chat/views/chatWebsites/edit/view.html",controller:"ChatWebsiteController as vm"}},resolve:{chatWebsite:["apiResolver","$stateParams",function(e,n){return e.resolve("chatWebsite@get",{fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:502})}]},authenticate:!0,permissionId:502,bodyClass:"chat"}),n.addPart("app/main/apps/chat")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.chat",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.chat.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.chat.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/chat/views/realtime/realtime.html",controller:"ChatRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:510})}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.agents",{url:"/agents",params:{channel:"chat"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:510}).state("app.chat.realtime.queues",{url:"/queues",params:{channel:"chat"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"ChatQueues":void 0,channel:"chat",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:501})}]},authenticate:!0,permissionId:510})}e.$inject=["$stateProvider"],angular.module("app.chat.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.contactmanager",{abstract:!0,url:"/contactmanager"}).state("app.contactmanager.lists",{url:"/lists",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/lists/lists.html",controller:"ListsController as vm"}},resolve:{lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadContactManagerLists",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:301})}]},authenticate:!0,permissionId:301,bodyClass:"contactmanager"}).state("app.contactmanager.lists.edit",{url:"/:id?tab",params:{list:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/lists/edit/view.html",controller:"ListController as vm"}},resolve:{list:["apiResolver","$stateParams",function(e,n){return e.resolve("cmList@get",{fields:"createdAt,updatedAt,id,name,description,dialPrefix",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:301})}]},authenticate:!0,permissionId:301,bodyClass:"contactmanager"}).state("app.contactmanager.companies",{url:"/companies",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/companies/companies.html",controller:"CompaniesController as vm"}},resolve:{companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get",{fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies",fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:302})}]},authenticate:!0,permissionId:302,bodyClass:"contactmanager"}).state("app.contactmanager.companies.edit",{url:"/:id?tab",params:{company:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/companies/edit/view.html",controller:"CompanyController as vm"}},resolve:{company:["apiResolver","$stateParams",function(e,n){return e.resolve("cmCompany@get",{fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:302})}]},authenticate:!0,permissionId:302,bodyClass:"contactmanager"}).state("app.contactmanager.globalCustomFields",{url:"/globalCustomFields",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/globalCustomFields.html",controller:"GlobalCustomFieldsController as vm"}},resolve:{globalCustomFields:["apiResolver","Auth",function(e,n){return e.resolve("cmCustomField@get",{fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",sort:"-updatedAt",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:304})}]},authenticate:!0,permissionId:304,bodyClass:"contactmanager"}),n.addPart("app/main/apps/contactmanager")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.contactmanager",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.contactmanager.contacts"]).config(e)}(),function(){"use strict";function e(e){e.state("app.contactmanager.contacts",{url:"/contacts?ListId&CompanyId",views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/contacts/contacts.html",controller:"ContactsController as vm"}},resolve:{contacts:["apiResolver","Auth","$stateParams",function(e,n,t){return n.hasRole("admin")?e.resolve("cmContact@get",_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0},t)):e.resolve("userProfile@getResources",_.merge({id:n.getCurrentUser().userProfileId,section:"Contacts",includeAll:!0,sort:"-updatedAt",limit:10,offset:0},t))}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],listsMap:["lists",function(e){for(var n={},t=0;t<e.rows.length;t++)n[e.rows[t].id]=e.rows[t].name;return n}],companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies",fields:"id,name",sort:"name",nolimit:!0})}],companiesMap:["companies",function(e){for(var n={},t=0;t<e.rows.length;t++)n[e.rows[t].id]=e.rows[t].name;return n}],tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{fields:"id,name",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags",fields:"id,name",sort:"name",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:303})}]},authenticate:!0,permissionId:303,bodyClass:"contactmanager"}).state("app.contactmanager.contacts.edit",{url:"/:id?tab",params:{crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/contactmanager/views/contacts/edit/view.html",controller:"ContactController as vm"}},resolve:{contact:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@get",{id:n.id}).then(function(e){return e.dateOfBirth&&(e.dateOfBirth=new Date(e.dateOfBirth)),e}).catch(function(e){console.error(e)})}],hoppers:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHoppers",{id:n.id,fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,offset:0})}],finals:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHopperFinals",{id:n.id,fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-updatedAt",limit:10,offset:0})}],histories:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getHopperHistories",{id:n.id,fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,offset:0})}],jscriptySessions:["apiResolver","$stateParams",function(e,n){return e.resolve("cmContact@getJscriptySessions",{id:n.id,fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,offset:0})}],companies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmCompany@get"):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Companies"})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",sort:"-updatedAt",nolimit:!0})}],customFields:["apiResolver","contact",function(e,n){return n.ListId?e.resolve("cmList@getCustomFields",{id:n.ListId}):null}],tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{sort:"name"}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:303})}]},authenticate:!0,permissionId:303,bodyClass:"contactmanager"})}e.$inject=["$stateProvider"],angular.module("app.contactmanager.contacts",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.dashboards",{abstract:!0,url:"/dashboards"}),n.addPart("app/main/apps/dashboards")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.dashboards",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.dashboards.general","app.dashboards.custom"]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.custom",{url:"/custom/:id",views:{"content@app":{templateUrl:"app/main/apps/dashboards/views/custom/custom.html",controller:"DashboardCustomController as vm"}},resolve:{voiceQueues:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("voiceQueue@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"VoiceQueues",mergeResources:!0,fields:"id,name",channel:"voice",nolimit:!0})).then(function(e){return t=e,n.resolve("rpc@getVoiceQueues",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)t&&t.id===e.rows[n].id?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged,a.abandoned+=e.rows[n].abandoned):(a=_.find(t.rows,{id:e.rows[n].id}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged","abandoned"]));return t})}],faxAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("faxAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"FaxAccounts",mergeResources:!0,fields:"id,name",channel:"fax",nolimit:!0})).then(function(e){return t=e,n.resolve("faxInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].FaxAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].FaxAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],chatWebsites:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("chatWebsite@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"ChatWebsites",mergeResources:!0,fields:"id,name",channel:"chat",nolimit:!0})).then(function(e){return t=e,n.resolve("chatInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].ChatWebsiteId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.abandoned+=e.rows[n].abandoned,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].ChatWebsiteId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","abandoned","unmanaged"]));return t})}],smsAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("smsAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"SmsAccounts",mergeResources:!0,fields:"id,name",channel:"sms",nolimit:!0})).then(function(e){return t=e,n.resolve("smsInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].SmsAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].SmsAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],openchannelAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("openchannelAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"OpenchannelAccounts",mergeResources:!0,fields:"id,name",channel:"openchannel",nolimit:!0})).then(function(e){return t=e,n.resolve("openchannelInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].OpenchannelAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].OpenchannelAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],mailAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("mailAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"MailAccounts",mergeResources:!0,fields:"id,name",channel:"mail",nolimit:!0})).then(function(e){return t=e,n.resolve("mailInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].MailAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].MailAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],whatsappAccounts:["apiResolver","Auth",function(n,e){var t,a;return(e.hasRole("admin")?n.resolve("whatsappAccount@get",{fields:"id,name",nolimit:!0}):n.resolve("userProfile@getResources",{id:e.getCurrentUser().userProfileId,section:"WhatsappAccounts",mergeResources:!0,fields:"id,name",channel:"whatsapp",nolimit:!0})).then(function(e){return t=e,n.resolve("whatsappInteraction@get",{createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}).then(function(e){if(e&&0<e.count)for(var n=0;n<e.rows.length;n+=1)a&&a.id===e.rows[n].WhatsappAccountId?(a.total+=e.rows[n].total,a.waiting+=e.rows[n].waiting,a.talking+=e.rows[n].talking,a.answered+=e.rows[n].answered,a.unmanaged+=e.rows[n].unmanaged):(a=_.find(t.rows,{id:e.rows[n].WhatsappAccountId}))&&_.merge(a,_.pick(e.rows[n],["waiting","total","talking","answered","unmanaged"]));return t})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.custom",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.general",{url:"/general",views:{"content@app":{templateProvider:["$stateParams","$templateFactory","Auth","$window",function(e,n,t,a){var i=t.getCurrentUser();return null===a.localStorage.getItem("motion2.user:"+i.id)&&a.localStorage.setItem("motion2.user:"+i.id,JSON.stringify({authenticationType:"google"})),t.isAgent()?n.fromUrl("app/main/apps/dashboards/views/general/agent/agent.general.html",e):n.fromUrl("app/main/apps/dashboards/views/general/user/user.general.html",e)}],controllerProvider:["Auth",function(e){return e.isAgent()?"AgentDashboardGeneralController as vm":"UserDashboardGeneralController as vm"}]}},resolve:{globalUserLists:["apiResolver","Auth",function(e,n){return e.resolve("user@getLists",{id:n.getCurrentUser().id,sort:"name",nolimit:!0})}],globalLists:["apiResolver",function(e){return e.resolve("cmList@get",{sort:"name",nolimit:!0})}],globalTags:["apiResolver",function(e){return e.resolve("tag@get",{sort:"name",nolimit:!0})}],globalCompanies:["apiResolver",function(e){return e.resolve("cmCompany@get",{sort:"name",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general",["ngMaterialDateRangePicker","app.dashboards.general.user"]).config(e)}(),function(){"use strict";function e(e){e.state("app.dashboards.general.voice",{url:"/voice",data:{selectedTab:0},views:{voice:{templateUrl:"app/main/apps/dashboards/views/general/user/voice/user.general.voice.html",controller:"UserVoiceDashboardGeneralController as vm"}},resolve:{rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}],inboundQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"inbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",fields:"id,name",type:"inbound",channel:"voice",nolimit:!0})}],outbound:["apiResolver",function(e){return e.resolve("rpc@getOutbound")}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.dialer",{url:"/dialer",data:{selectedTab:1},views:{dialer:{templateUrl:"app/main/apps/dashboards/views/general/user/dialer/user.general.dialer.html",controller:"UserVoiceDashboardDialerController as vm"}},resolve:{rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}],outboundQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"outbound",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",fields:"id,name",type:"outbound",channel:"voice",nolimit:!0})}],rpcCampaigns:["apiResolver",function(e){return e.resolve("rpc@getCampaigns")}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.chat",{url:"/chat",data:{selectedTab:2},views:{chat:{templateUrl:"app/main/apps/dashboards/views/general/user/chat/user.general.chat.html",controller:"UserChatDashboardGeneralController as vm"}},resolve:{chatInteractions:["apiResolver",function(e){return e.resolve("chatInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,ChatWebsiteId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],chatWebsites:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("chatWebsite@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChatWebsites",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.mail",{url:"/mail",data:{selectedTab:3},views:{mail:{templateUrl:"app/main/apps/dashboards/views/general/user/mail/user.general.mail.html",controller:"UserMailDashboardGeneralController as vm"}},resolve:{mailInteractions:["apiResolver",function(e){return e.resolve("mailInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,MailAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.sms",{url:"/sms",data:{selectedTab:4},views:{sms:{templateUrl:"app/main/apps/dashboards/views/general/user/sms/user.general.sms.html",controller:"UserSmsDashboardGeneralController as vm"}},resolve:{smsInteractions:["apiResolver",function(e){return e.resolve("smsInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,SmsAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.openchannel",{url:"/openchannel",data:{selectedTab:5},views:{openchannel:{templateUrl:"app/main/apps/dashboards/views/general/user/openchannel/user.general.openchannel.html",controller:"UserOpenchannelDashboardGeneralController as vm"}},resolve:{openchannelInteractions:["apiResolver",function(e){return e.resolve("openchannelInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,OpenchannelAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],openchannelAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.fax",{url:"/fax",data:{selectedTab:6},views:{fax:{templateUrl:"app/main/apps/dashboards/views/general/user/fax/user.general.fax.html",controller:"UserFaxDashboardGeneralController as vm"}},resolve:{faxInteractions:["apiResolver",function(e){return e.resolve("faxInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,FaxAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"}).state("app.dashboards.general.whatsapp",{url:"/whatsapp",data:{selectedTab:7},views:{whatsapp:{templateUrl:"app/main/apps/dashboards/views/general/user/whatsapp/user.general.whatsapp.html",controller:"UserWhatsappDashboardGeneralController as vm"}},resolve:{whatsappInteractions:["apiResolver",function(e){return e.resolve("whatsappInteraction@get",{fields:"id,closed,createdAt,closedAt,disposition,read1stAt,UserId,WhatsappAccountId",createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0})}],whatsappAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappAccount@get",{fields:"id,name",sort:"-updatedAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappAccounts",fields:"id,name",sort:"-updatedAt",nolimit:!0})}]},authenticate:!0,bodyClass:"dashboards"})}e.$inject=["$stateProvider"],angular.module("app.dashboards.general.user",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.fax",{abstract:!0,url:"/fax"}).state("app.fax.faxQueues",{url:"/faxQueues",views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxQueues/faxQueues.html",controller:"FaxQueuesController as vm"}},resolve:{faxQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:901,bodyClass:"fax"}).state("app.fax.faxQueues.edit",{url:"/:id?tab",params:{faxQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxQueues/edit/view.html",controller:"FaxQueueController as vm"}},resolve:{faxQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("faxQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:901,bodyClass:"fax"}).state("app.fax.faxAccounts",{url:"/faxAccounts",views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxAccounts/faxAccounts.html",controller:"FaxAccountsController as vm"}},resolve:{faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}).state("app.fax.faxAccounts.edit",{url:"/:id?tab",params:{faxAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/fax/views/faxAccounts/edit/view.html",controller:"FaxAccountController as vm"}},resolve:{faxAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("faxAccount@get",{fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}]},authenticate:!0,permissionId:902,bodyClass:"fax"}),n.addPart("app/main/apps/fax")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.fax",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.fax.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.fax.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/fax/views/realtime/realtime.html",controller:"FaxRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:910})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.agents",{url:"/agents",params:{channel:"fax"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.trunks",{url:"/trunks",controller:"TrunksFaxRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/trunks/view.html",resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.queues",{url:"/queues",params:{channel:"fax"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"FaxQueues":void 0,channel:"fax",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:901})}]},authenticate:!0,permissionId:910}).state("app.fax.realtime.accounts",{url:"/accounts",controller:"FaxAccountsRealtimeController as vm",templateUrl:"app/main/apps/fax/views/realtime/accounts/view.html",resolve:{faxAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("faxAccount@get",{sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FaxAccounts",sort:"name",limit:10,offset:0})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:902})}],rpcFaxAccounts:["apiResolver",function(e){return e.resolve("rpc@getFaxAccounts")}]},authenticate:!0,permissionId:910})}e.$inject=["$stateProvider"],angular.module("app.fax.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.help",{abstract:!0,url:"/help"}),n.addPart("app/main/apps/help")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.help",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.help.about"]).config(e)}(),function(){"use strict";function e(e){e.state("app.help.about",{url:"/about",views:{"content@app":{templateUrl:"app/main/apps/help/views/about/about.html",controller:"AboutController as vm"}},resolve:{info:["apiResolver",function(e){return e.resolve("version@get")}]},authenticate:!0,permissionId:1600,bodyClass:"help"})}e.$inject=["$stateProvider"],angular.module("app.help.about",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.integrations",{abstract:!0,url:"/integrations"}).state("app.integrations.zendeskAccounts",{url:"/zendeskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zendeskAccounts/zendeskAccounts.html",controller:"ZendeskAccountsController as vm"}},resolve:{zendeskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ZendeskAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1301})}]},authenticate:!0,permissionId:1301,bodyClass:"integrations"}).state("app.integrations.zendeskAccounts.edit",{url:"/:id?tab",params:{zendeskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/view.html",controller:"ZendeskAccountController as vm"}},resolve:{zendeskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intZendeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1301})}]},authenticate:!0,permissionId:1301,bodyClass:"integrations"}).state("app.integrations.salesforceAccounts",{url:"/salesforceAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/salesforceAccounts/salesforceAccounts.html",controller:"SalesforceAccountsController as vm"}},resolve:{salesforceAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SalesforceAccounts",fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1302})}]},authenticate:!0,permissionId:1302,bodyClass:"integrations"}).state("app.integrations.salesforceAccounts.edit",{url:"/:id?tab",params:{salesforceAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/view.html",controller:"SalesforceAccountController as vm"}},resolve:{salesforceAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intSalesforceAccount@get",{fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1302})}]},authenticate:!0,permissionId:1302,bodyClass:"integrations"}).state("app.integrations.freshdeskAccounts",{url:"/freshdeskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/freshdeskAccounts.html",controller:"FreshdeskAccountsController as vm"}},resolve:{freshdeskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FreshdeskAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1303})}]},authenticate:!0,permissionId:1303,bodyClass:"integrations"}).state("app.integrations.freshdeskAccounts.edit",{url:"/:id?tab",params:{freshdeskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/view.html",controller:"FreshdeskAccountController as vm"}},resolve:{freshdeskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intFreshdeskAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1303})}]},authenticate:!0,permissionId:1303,bodyClass:"integrations"}).state("app.integrations.sugarcrmAccounts",{url:"/sugarcrmAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/sugarcrmAccounts.html",controller:"SugarcrmAccountsController as vm"}},resolve:{sugarcrmAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SugarcrmAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1305})}]},authenticate:!0,permissionId:1305,bodyClass:"integrations"}).state("app.integrations.sugarcrmAccounts.edit",{url:"/:id?tab",params:{sugarcrmAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/view.html",controller:"SugarcrmAccountController as vm"}},resolve:{sugarcrmAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intSugarcrmAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1305})}]},authenticate:!0,permissionId:1305,bodyClass:"integrations"}).state("app.integrations.deskAccounts",{url:"/deskAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/deskAccounts/deskAccounts.html",controller:"DeskAccountsController as vm"}},resolve:{deskAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"DeskAccounts",fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1306})}]},authenticate:!0,permissionId:1306,bodyClass:"integrations"}).state("app.integrations.deskAccounts.edit",{url:"/:id?tab",params:{deskAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/view.html",controller:"DeskAccountController as vm"}},resolve:{deskAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intDeskAccount@get",{fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1306})}]},authenticate:!0,permissionId:1306,bodyClass:"integrations"}).state("app.integrations.zohoAccounts",{url:"/zohoAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zohoAccounts/zohoAccounts.html",controller:"ZohoAccountsController as vm"}},resolve:{zohoAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ZohoAccounts",fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1307})}]},authenticate:!0,permissionId:1307,bodyClass:"integrations"}).state("app.integrations.zohoAccounts.edit",{url:"/:id?tab",params:{zohoAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/view.html",controller:"ZohoAccountController as vm"}},resolve:{zohoAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intZohoAccount@get",{fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1307})}]},authenticate:!0,permissionId:1307,bodyClass:"integrations"}).state("app.integrations.vtigerAccounts",{url:"/vtigerAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/vtigerAccounts/vtigerAccounts.html",controller:"VtigerAccountsController as vm"}},resolve:{vtigerAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VtigerAccounts",fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1308})}]},authenticate:!0,permissionId:1308,bodyClass:"integrations"}).state("app.integrations.vtigerAccounts.edit",{url:"/:id?tab",params:{vtigerAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/view.html",controller:"VtigerAccountController as vm"}},resolve:{vtigerAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intVtigerAccount@get",{fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1308})}]},authenticate:!0,permissionId:1308,bodyClass:"integrations"}).state("app.integrations.dynamics365Accounts",{url:"/dynamics365Accounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/dynamics365Accounts.html",controller:"Dynamics365AccountsController as vm"}},resolve:{dynamics365Accounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication,CloudProviderId",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dynamics365Accounts",fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",type:"Dynamics365",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1309})}]},authenticate:!0,permissionId:1309,bodyClass:"integrations"}).state("app.integrations.dynamics365Accounts.edit",{url:"/:id?tab",params:{dynamics365Account:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/view.html",controller:"Dynamics365AccountController as vm"}},resolve:{dynamics365Account:["apiResolver","$stateParams",function(e,n){return e.resolve("intDynamics365Account@get",{fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication,CloudProviderId",id:n.id})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",type:"Dynamics365",limit:10,offset:0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1309})}]},authenticate:!0,permissionId:1309,bodyClass:"integrations"}).state("app.integrations.servicenowAccounts",{url:"/servicenowAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/servicenowAccounts/servicenowAccounts.html",controller:"ServicenowAccountsController as vm"}},resolve:{servicenowAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ServicenowAccounts",fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}).state("app.integrations.servicenowAccounts.edit",{url:"/:id?tab",params:{servicenowAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/view.html",controller:"ServicenowAccountController as vm"}},resolve:{servicenowAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intServicenowAccount@get",{fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1310})}]},authenticate:!0,permissionId:1310,bodyClass:"integrations"}).state("app.integrations.freshsalesAccounts",{url:"/freshsalesAccounts",views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/freshsalesAccounts.html",controller:"FreshsalesAccountsController as vm"}},resolve:{freshsalesAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("intFreshsalesAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"FreshsalesAccounts",fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1304})}]},authenticate:!0,permissionId:1304,bodyClass:"integrations"}).state("app.integrations.freshsalesAccounts.edit",{url:"/:id?tab",params:{freshsalesAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/view.html",controller:"FreshsalesAccountController as vm"}},resolve:{freshsalesAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("intFreshsalesAccount@get",{fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1304})}]},authenticate:!0,permissionId:1304,bodyClass:"integrations"}),n.addPart("app/main/apps/integrations")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.integrations",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.jscripty",{abstract:!0,url:"/jscripty"}).state("app.jscripty.projects",{url:"/projects",views:{"content@app":{templateUrl:"app/main/apps/jscripty/views/projects/projects.html",controller:"JscriptyProjectsController as vm"}},resolve:{projects:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Projects",fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadJscriptySessions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}).state("app.jscripty.projects.edit",{url:"/:id?tab",params:{project:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/jscripty/views/projects/edit/view.html",controller:"JscriptyProjectController as vm"}},resolve:{project:["apiResolver","$stateParams",function(e,n){return e.resolve("jscriptyProject@get",{fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadJscriptySessions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1701})}]},authenticate:!0,permissionId:1701,bodyClass:"jscripty"}),n.addPart("app/main/apps/jscripty")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.jscripty",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.mail",{abstract:!0,url:"/mail"}).state("app.mail.mailQueues",{url:"/mailQueues",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailQueues/mailQueues.html",controller:"MailQueuesController as vm"}},resolve:{mailQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:601,bodyClass:"mail"}).state("app.mail.mailQueues.edit",{url:"/:id?tab",params:{mailQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailQueues/edit/view.html",controller:"MailQueueController as vm"}},resolve:{mailQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("mailQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:601,bodyClass:"mail"}).state("app.mail.mailAccounts",{url:"/mailAccounts",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailAccounts/mailAccounts.html",controller:"MailAccountsController as vm"}},resolve:{mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,key,email,ListId,active,cservice,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",fields:"createdAt,updatedAt,id,name,key,email,ListId,active,cservice,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}]},authenticate:!0,permissionId:602,bodyClass:"mail"}).state("app.mail.mailAccounts.edit",{url:"/:id?tab",params:{mailAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailAccounts/edit/view.html",controller:"MailAccountController as vm"}},resolve:{mailAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,name,key,email,ListId,active,cservice,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}]},authenticate:!0,permissionId:602,bodyClass:"mail"}).state("app.mail.mailSubtatuses",{url:"/mailSubtatuses",views:{"content@app":{templateUrl:"app/main/apps/mail/views/mailSubtatuses/mailSubtatuses.html",controller:"MailSubstatusesController as vm"}},resolve:{mailSubtatuses:["apiResolver",function(e){return e.resolve("mailSubstatus@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:603})}]},authenticate:!0,permissionId:603,bodyClass:"mail"}),n.addPart("app/main/apps/mail")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.mail",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.mail.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.mail.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/mail/views/realtime/realtime.html",controller:"MailRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:610})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.agents",{url:"/agents",params:{channel:"mail"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.queues",{url:"/queues",params:{channel:"mail"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"MailQueues":void 0,channel:"mail",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:601})}]},authenticate:!0,permissionId:610}).state("app.mail.realtime.accounts",{url:"/accounts",controller:"MailAccountsRealtimeController as vm",templateUrl:"app/main/apps/mail/views/realtime/accounts/view.html",resolve:{mailAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("mailAccount@get",{sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MailAccounts",sort:"name",limit:10,offset:0})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:602})}],rpcMailAccounts:["apiResolver",function(e){return e.resolve("rpc@getMailAccounts")}]},authenticate:!0,permissionId:610})}e.$inject=["$stateProvider"],angular.module("app.mail.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.marketplace",{abstract:!0,url:"/marketplace"}).state("app.marketplace.plugins",{url:"/plugins",views:{"content@app":{templateUrl:"app/main/apps/marketplace/views/plugins/plugins.html",controller:"MarketplacePluginsController as vm"}},resolve:{plugins:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Plugins",fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}).state("app.marketplace.plugins.edit",{url:"/:id?tab",params:{plugin:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/marketplace/views/plugins/edit/view.html",controller:"MarketplacePluginController as vm"}},resolve:{plugin:["apiResolver","$stateParams",function(e,n){return e.resolve("plugin@get",{fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1801})}]},authenticate:!0,permissionId:1801,bodyClass:"marketplace"}),n.addPart("app/main/apps/marketplace")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.marketplace",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.motiondialer",{abstract:!0,url:"/motiondialer"}).state("app.motiondialer.queueCampaigns",{url:"/queueCampaigns",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/queueCampaigns.html",controller:"QueueCampaignsController as vm"}},resolve:{queueCampaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe,dialPreviewRecallmeReminder",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1501,bodyClass:"motiondialer"}).state("app.motiondialer.queueCampaigns.edit",{url:"/:id?tab",params:{queueCampaign:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/view.html",controller:"QueueCampaignController as vm"}},resolve:{queueCampaign:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe,dialPreviewRecallmeReminder,callAdditionalPhoneAfterMin",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1501,bodyClass:"motiondialer"}).state("app.motiondialer.ivrCampaigns",{url:"/ivrCampaigns",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/ivrCampaigns.html",controller:"IvrCampaignsController as vm"}},resolve:{ivrCampaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("campaign@get",{fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"IvrCampaigns",fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}).state("app.motiondialer.ivrCampaigns.edit",{url:"/:id?tab",params:{ivrCampaign:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/view.html",controller:"IvrCampaignController as vm"}},resolve:{ivrCampaign:["apiResolver","$stateParams",function(e,n){return e.resolve("campaign@get",{fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}]},authenticate:!0,permissionId:1502,bodyClass:"motiondialer"}),n.addPart("app/main/apps/motiondialer")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.motiondialer",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.motiondialer.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.motiondialer.hopperdate",{url:"/hopperdate",views:{"hopperdate@app":{templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",controller:"HopperdateController as vm"}},resolve:{info:["apiResolver",function(e){return e.resolve("version@get")}]},authenticate:!0,permissionId:1500,bodyClass:"motiondialer"})}e.$inject=["$stateProvider"],angular.module("app.motiondialer.hopperdate",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.motiondialer.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/motiondialer/views/realtime/realtime.html",controller:"MotionDialerRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1510})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.agents",{url:"/agents",params:{channel:"voice",direction:"outbound"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queues",{url:"/queues",params:{channel:"voice",direction:"outbound"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"QueueCampaigns":void 0,channel:"voice",type:"outbound",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_calls",{url:"/queue_calls",params:{direction:"outbound"},controller:"QueueCallsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queue-calls/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"outbound",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,fields:"id,name",section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}],voiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels",{type:"outbound"})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.abandonedcalls",{url:"/abandonedcalls",controller:"AbandonedCallsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/abandonedcalls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context,createdAt",role:"agent",sort:"-createdAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context,createdAt",role:"agent",sort:"-createdAt",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"name",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.queue_params",{url:"/queue_params",controller:"QueueParamsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/queue_params/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"outbound",fields:"id,name",sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"name",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1501})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:1510}).state("app.motiondialer.realtime.ivr_campaigns",{url:"/ivr_campaigns",controller:"IvrCampaignsMotionDialerRealtimeController as vm",templateUrl:"app/main/apps/motiondialer/views/realtime/ivr_campaigns/view.html",resolve:{campaigns:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("campaign@get",{sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"IvrCampaigns",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1502})}],rpcCampaigns:["apiResolver",function(e){return e.resolve("rpc@getCampaigns")}]},authenticate:!0,permissionId:1510})}e.$inject=["$stateProvider"],angular.module("app.motiondialer.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.openchannel",{abstract:!0,url:"/openchannel"}).state("app.openchannel.openchannelQueues",{url:"/openchannelQueues",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelQueues/openchannelQueues.html",controller:"OpenchannelQueuesController as vm"}},resolve:{openchannelQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:801,bodyClass:"openchannel"}).state("app.openchannel.openchannelQueues.edit",{url:"/:id?tab",params:{openchannelQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/view.html",controller:"OpenchannelQueueController as vm"}},resolve:{openchannelQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("openchannelQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:801,bodyClass:"openchannel"}).state("app.openchannel.openchannelAccounts",{url:"/openchannelAccounts",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/openchannelAccounts.html",controller:"OpenchannelAccountsController as vm"}},resolve:{openchannelAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OpenchannelAccounts",fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}).state("app.openchannel.openchannelAccounts.edit",{url:"/:id?tab",params:{openchannelAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/view.html",controller:"OpenchannelAccountController as vm"}},resolve:{openchannelAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("openchannelAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadAttachments,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:802})}]},authenticate:!0,permissionId:802,bodyClass:"openchannel"}),n.addPart("app/main/apps/openchannel")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.openchannel",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.openchannel.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.openchannel.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/openchannel/views/realtime/realtime.html",controller:"OpenchannelRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:810})}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.agents",{url:"/agents",params:{channel:"openchannel"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:810}).state("app.openchannel.realtime.queues",{url:"/queues",params:{channel:"openchannel"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"OpenchannelQueues":void 0,channel:"openchannel",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:801})}]},authenticate:!0,permissionId:810})}e.$inject=["$stateProvider"],angular.module("app.openchannel.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.plugins",{abstract:!0,url:"/plugins"}),n.addPart("app/main/apps/plugins")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.plugins",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.plugins.plugin"]).config(e)}(),function(){"use strict";function e(e){e.state("app.plugins.plugin",{url:"/plugin/:id",views:{"content@app":{templateUrl:"app/main/apps/plugins/views/plugin/plugin.html",controller:"PluginController as vm"}},resolve:{},authenticate:!0,bodyClass:"plugins"})}e.$inject=["$stateProvider"],angular.module("app.plugins.plugin",[]).config(e)}(),function(){"use strict";angular.module("app.realtime",[])}(),function(){"use strict";function e(e,n){e.state("app.settings",{abstract:!0,url:"/settings"}).state("app.settings.generals",{url:"/generals",views:{"content@app":{templateUrl:"app/main/apps/settings/views/generals/generals.html",controller:"GeneralsController as vm"}},resolve:{generals:["apiResolver",function(e){return e.resolve("setting@get",{fields:"createdAt,updatedAt,id,min_internal,securePassword,callRecordingEncryption,chatTimeout,phoneBarAutoUpdater,defaultScreenRecordingPath,phoneBarAutoUpdaterUrl,enableEmailPreview,split,splitSizeCsv,splitSizePdf,splitSizeXlsx,searchOnEnterKey,messagesAlignment,phoneBarRememberMeEnabled,rtlSupport,allowedLoginAttempts,blockDuration,loginMailFrequency,language,bucket,transcribe,transcribeRegion,transcribeAccountId,sentiment,sentimentRegion,sentimentAccountId,googleSsoEnabled,enforcePasswordHistory,passwordHistoryLimit,enablePrivacyPolicyEmail,privacyPolicyEmail,enablePrivacyPolicyName,privacyPolicyName,enablePrivacyPolicyNumber,privacyPolicyNumber,chatInteractionsReloadTimeout,mailInteractionsReloadTimeout,openchannelInteractionsReloadTimeout,smsInteractionsReloadTimeout,whatsappInteractionsReloadTimeout,stopRecordingOnTransfer,adSsoEnabled,disabledCookie,previewRecallmeReminderInterval,limitTabs,filterFullName",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.smtps",{url:"/smtps",views:{"content@app":{templateUrl:"app/main/apps/settings/views/smtps/smtps.html",controller:"SmtpController as vm"}},resolve:{mailAccounts:["apiResolver",function(e){return e.resolve("mailAccount@get",{fields:"createdAt,updatedAt,id,service,provider,name,email,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,description",service:"1",limit:10,offset:0})}],cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.networks",{url:"/networks",views:{"content@app":{templateUrl:"app/main/apps/settings/views/networks/networks.html",controller:"NetworksController as vm"}},resolve:{networks:["apiResolver",function(e){return e.resolve("network@get",{fields:"createdAt,updatedAt,id,type,value,username,password",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.customizations",{url:"/customizations",views:{"content@app":{templateUrl:"app/main/apps/settings/views/customizations/customizations.html",controller:"CustomizationsController as vm"}},resolve:{customizations:["apiResolver",function(e){return e.resolve("setting@get",{fields:"createdAt,updatedAt,id,defaultLogo,defaultLoginLogo,defaultFavicon,defaultHeaderWhiteLabel,headerWhiteLabel,defaultPageTitle,pageTitle,defaultPreferred",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}).state("app.settings.cloudProviders",{url:"/cloudProviders",views:{"content@app":{templateUrl:"app/main/apps/settings/views/cloudProviders/cloudProviders.html",controller:"CloudProvidersController as vm"}},resolve:{cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data7",sort:"-updatedAt",limit:10,offset:0})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"}),n.addPart("app/main/apps/settings")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.settings",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.settings.updates","app.settings.license","app.settings.system"]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.license",{url:"/license",views:{"content@app":{templateUrl:"app/main/apps/settings/views/license/license.html",controller:"LicenseController as vm"}},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.license",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.system",{url:"/system?tab",views:{"content@app":{templateUrl:"app/main/apps/settings/views/system/system.html",controller:"SystemController as vm"}},resolve:{system:["apiResolver",function(e){return e.resolve("system@get")}],processes:["apiResolver",function(e){return e.resolve("pm2@get")}]},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.system",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.settings.updates",{url:"/updates",views:{"content@app":{templateUrl:"app/main/apps/settings/views/updates/updates.html",controller:"UpdatesController as vm"}},resolve:{version:["apiResolver",function(e){return e.resolve("version@get",{latest:!0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1400})}]},authenticate:!0,permissionId:1400,bodyClass:"settings"})}e.$inject=["$stateProvider"],angular.module("app.settings.updates",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.sms",{abstract:!0,url:"/sms"}).state("app.sms.smsQueues",{url:"/smsQueues",views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsQueues/smsQueues.html",controller:"SmsQueuesController as vm"}},resolve:{smsQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:701,bodyClass:"sms"}).state("app.sms.smsQueues.edit",{url:"/:id?tab",params:{smsQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsQueues/edit/view.html",controller:"SmsQueueController as vm"}},resolve:{smsQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("smsQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:701,bodyClass:"sms"}).state("app.sms.smsAccounts",{url:"/smsAccounts",views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsAccounts/smsAccounts.html",controller:"SmsAccountsController as vm"}},resolve:{smsAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"SmsAccounts",fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}).state("app.sms.smsAccounts.edit",{url:"/:id?tab",params:{smsAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/sms/views/smsAccounts/edit/view.html",controller:"SmsAccountController as vm"}},resolve:{smsAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("smsAccount@get",{fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:702})}]},authenticate:!0,permissionId:702,bodyClass:"sms"}),n.addPart("app/main/apps/sms")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.sms",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.sms.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.sms.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/sms/views/realtime/realtime.html",controller:"SmsRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:710})}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.agents",{url:"/agents",params:{channel:"sms"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:710}).state("app.sms.realtime.queues",{url:"/queues",params:{channel:"sms"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"SmsQueues":void 0,channel:"sms",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:701})}]},authenticate:!0,permissionId:710})}e.$inject=["$stateProvider"],angular.module("app.sms.realtime",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.staff",{abstract:!0,url:"/staff"}).state("app.staff.users",{url:"/users",views:{"content@app":{templateUrl:"app/main/apps/staff/views/users/users.html",controller:"UsersController as vm"}},resolve:{users:["apiResolver",function(e){return e.resolve("user@get",{fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",role:"admin,user",sort:"-updatedAt",userSetting:!0,limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:201})}]},authenticate:!0,permissionId:201,bodyClass:"staff"}).state("app.staff.users.edit",{url:"/:id?tab",params:{user:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/users/edit/view.html",controller:"UserController as vm"}},resolve:{user:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",id:n.id,userSetting:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:201})}]},authenticate:!0,permissionId:201,bodyClass:"staff"}).state("app.staff.agents",{url:"/agents",views:{"content@app":{templateUrl:"app/main/apps/staff/views/agents/agents.html",controller:"AgentsController as vm"}},resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",role:"agent",sort:"-updatedAt",userSetting:!0,limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",role:"agent",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:202,bodyClass:"staff"}).state("app.staff.agents.edit",{url:"/:id?tab",params:{agent:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/agents/edit/view.html",controller:"AgentController as vm"}},resolve:{agent:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay,emailAutoanswer,emailAutoanswerDelay,smsAutoanswer,smsAutoanswerDelay,faxAutoanswer,faxAutoanswerDelay,whatsappAutoanswer,whatsappAutoanswerDelay,openchannelAutoanswer,openchannelAutoanswerDelay,messengerSoundNotification",id:n.id,userSetting:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}]},authenticate:!0,permissionId:202,bodyClass:"staff"}).state("app.staff.telephones",{url:"/telephones",views:{"content@app":{templateUrl:"app/main/apps/staff/views/telephones/telephones.html",controller:"TelephonesController as vm"}},resolve:{telephones:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Telephones",fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}]},authenticate:!0,permissionId:203,bodyClass:"staff"}).state("app.staff.telephones.edit",{url:"/:id?tab",params:{telephone:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/telephones/edit/view.html",controller:"TelephoneController as vm"}},resolve:{telephone:["apiResolver","$stateParams",function(e,n){return e.resolve("user@get",{fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}]},authenticate:!0,permissionId:203,bodyClass:"staff"}).state("app.staff.teams",{url:"/teams",views:{"content@app":{templateUrl:"app/main/apps/staff/views/teams/teams.html",controller:"TeamsController as vm"}},resolve:{teams:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("team@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Teams",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:204})}]},authenticate:!0,permissionId:204,bodyClass:"staff"}).state("app.staff.userProfiles",{url:"/userProfiles",views:{"content@app":{templateUrl:"app/main/apps/staff/views/userProfiles/userProfiles.html",controller:"UserProfilesController as vm"}},resolve:{userProfiles:["apiResolver",function(e){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}).state("app.staff.userProfiles.edit",{url:"/:id?tab",params:{userProfile:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/staff/views/userProfiles/edit/view.html",controller:"UserProfileController as vm"}},resolve:{userProfile:["apiResolver","$stateParams",function(e,n){return e.resolve("userProfile@get",{fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:205})}]},authenticate:!0,permissionId:205,bodyClass:"staff"}),n.addPart("app/main/apps/staff")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.staff",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.tools",{abstract:!0,url:"/tools"}).state("app.tools.cannedAnswers",{url:"/cannedAnswers",views:{"content@app":{templateUrl:"app/main/apps/tools/views/cannedAnswers/cannedAnswers.html",controller:"CannedAnswersController as vm"}},resolve:{cannedAnswers:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cannedAnswer@get",{fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"CannedAnswers",fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1001})}]},authenticate:!0,permissionId:1001,bodyClass:"tools"}).state("app.tools.customDashboards",{url:"/customDashboards",views:{"content@app":{templateUrl:"app/main/apps/tools/views/customDashboards/customDashboards.html",controller:"CustomDashboardsController as vm"}},resolve:{customDashboards:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"CustomDashboards",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"tools"}).state("app.tools.customDashboards.edit",{url:"/:id?tab",params:{customDashboard:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/customDashboards/edit/view.html",controller:"CustomDashboardController as vm"}},resolve:{customDashboard:["apiResolver","$stateParams",function(e,n){return e.resolve("dashboard@get",{fields:"createdAt,updatedAt,id,name,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1003})}]},authenticate:!0,permissionId:1003,bodyClass:"tools"}).state("app.tools.intervals",{url:"/intervals",views:{"content@app":{templateUrl:"app/main/apps/tools/views/intervals/intervals.html",controller:"IntervalsController as vm"}},resolve:{intervals:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Intervals",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1004})}]},authenticate:!0,permissionId:1004,bodyClass:"tools"}).state("app.tools.intervals.edit",{url:"/:id?tab",params:{interval:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/intervals/edit/view.html",controller:"IntervalController as vm"}},resolve:{interval:["apiResolver","$stateParams",function(e,n){return e.resolve("interval@get",{fields:"createdAt,updatedAt,id,name,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1004})}]},authenticate:!0,permissionId:1004,bodyClass:"tools"}).state("app.tools.pauses",{url:"/pauses",views:{"content@app":{templateUrl:"app/main/apps/tools/views/pauses/pauses.html",controller:"PausesController as vm"}},resolve:{pauses:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("pause@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Pauses",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1005})}]},authenticate:!0,permissionId:1005,bodyClass:"tools"}).state("app.tools.schedules",{url:"/schedules",views:{"content@app":{templateUrl:"app/main/apps/tools/views/schedules/schedules.html",controller:"SchedulesController as vm"}},resolve:{schedules:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("schedule@get",{fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Scheduler",fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1006})}]},authenticate:!0,permissionId:1006,bodyClass:"tools"}).state("app.tools.sounds",{url:"/sounds",views:{"content@app":{templateUrl:"app/main/apps/tools/views/sounds/sounds.html",controller:"SoundsController as vm"}},resolve:{sounds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("sound@get",{fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Sounds",fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1007})}]},authenticate:!0,permissionId:1007,bodyClass:"tools"}).state("app.tools.tags",{url:"/tags",views:{"content@app":{templateUrl:"app/main/apps/tools/views/tags/tags.html",controller:"TagsController as vm"}},resolve:{tags:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("tag@get",{fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Tags",fields:"createdAt,updatedAt,id,name,description,color",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1008})}]},authenticate:!0,permissionId:1008,bodyClass:"tools"}).state("app.tools.templates",{url:"/templates",views:{"content@app":{templateUrl:"app/main/apps/tools/views/templates/templates.html",controller:"TemplatesController as vm"}},resolve:{templates:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("template@get",{fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Templates",fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1009})}]},authenticate:!0,permissionId:1009,bodyClass:"tools"}).state("app.tools.trunks",{url:"/trunks",views:{"content@app":{templateUrl:"app/main/apps/tools/views/trunks/trunks.html",controller:"TrunksController as vm"}},resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}]},authenticate:!0,permissionId:1011,bodyClass:"tools"}).state("app.tools.trunks.edit",{url:"/:id?tab",params:{trunk:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/trunks/edit/view.html",controller:"TrunkController as vm"}},resolve:{trunk:["apiResolver","$stateParams",function(e,n){return e.resolve("trunk@get",{fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}]},authenticate:!0,permissionId:1011,bodyClass:"tools"}).state("app.tools.variables",{url:"/variables",views:{"content@app":{templateUrl:"app/main/apps/tools/views/variables/variables.html",controller:"VariablesController as vm"}},resolve:{variables:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("variable@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Variables",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1012})}]},authenticate:!0,permissionId:1012,bodyClass:"tools"}).state("app.tools.contact_item_types",{url:"/contact_item_types",views:{"content@app":{templateUrl:"app/main/apps/tools/views/contact_item_types/contact_item_types.html",controller:"ContactItemTypesController as vm"}},resolve:{contact_item_types:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("contactItemType@get",{fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ContactItemType",fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1013})}]},authenticate:!0,permissionId:1013,bodyClass:"tools"}),n.addPart("app/main/apps/tools")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.tools",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.tools.dispositions","app.tools.triggers"]).config(e)}(),function(){"use strict";function e(e){e.state("app.tools.dispositions",{url:"/dispositions",views:{"content@app":{templateUrl:"app/main/apps/tools/views/dispositions/dispositions.html",controller:"DispositionsController as vm"}},resolve:{dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1002})}]},authenticate:!0,permissionId:1002,bodyClass:"tools"})}e.$inject=["$stateProvider"],angular.module("app.tools.dispositions",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.tools.triggers",{url:"/triggers",views:{"content@app":{templateUrl:"app/main/apps/tools/views/triggers/triggers.html",controller:"TriggersController as vm"}},resolve:{triggers:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Triggers",fields:"createdAt,updatedAt,id,name,channel,status,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,bodyClass:"tools"}).state("app.tools.triggers.edit",{url:"/:id?tab",params:{trigger:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/tools/views/triggers/edit/view.html",controller:"TriggerController as vm"}},resolve:{trigger:["apiResolver","$stateParams",function(e,n){return e.resolve("trigger@get",{fields:"createdAt,updatedAt,id,name,channel,status,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1010})}]},authenticate:!0,permissionId:1010,bodyClass:"tools"})}e.$inject=["$stateProvider"],angular.module("app.tools.triggers",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.video",{abstract:!0,url:"/video"}).state("app.video.screenRecordings",{url:"/screenRecordings",views:{"content@app":{templateUrl:"app/main/apps/video/views/screenRecordings/screenRecordings.html",controller:"ScreenRecordingsController as vm"}},resolve:{screenRecordings:["apiResolver","Auth","msUtils",function(e,n,t){return n.hasRole("admin")?e.resolve("screenRecording@get",{fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:t.firstLastDayMonth(),includeAll:"true",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ScreenRecordings",fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:t.firstLastDayMonth(),includeAll:"true",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadScreenRecordings",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2001})}]},authenticate:!0,permissionId:2001,bodyClass:"video"}),n.addPart("app/main/apps/video")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.video",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter"]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.inboundRoutes",{url:"/inboundRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/inboundRoutes/inboundRoutes.html",controller:"InboundRoutesController as vm"}},resolve:{inboundRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"InboundRoutes",fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"}).state("app.voice.inboundRoutes.edit",{url:"/:id?tab",params:{inboundRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/inboundRoutes/edit/view.html",controller:"InboundRouteController as vm"}},resolve:{inboundRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:402})}]},authenticate:!0,permissionId:402,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.inboundRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.internalRoutes",{url:"/internalRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/internalRoutes/internalRoutes.html",controller:"InternalRoutesController as vm"}},resolve:{internalRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"InternalRoutes",fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,bodyClass:"voice"}).state("app.voice.internalRoutes.edit",{url:"/:id?tab",params:{internalRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/internalRoutes/edit/view.html",controller:"InternalRouteController as vm"}},resolve:{internalRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:404})}]},authenticate:!0,permissionId:404,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.internalRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.outboundRoutes",{url:"/outboundRoutes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/outboundRoutes/outboundRoutes.html",controller:"OutboundRoutesController as vm"}},resolve:{outboundRoutes:["apiResolver","Auth",function(e,n){return n.isAdmin()?e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"OutboundRoutes",fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"}).state("app.voice.outboundRoutes.edit",{url:"/:id?tab",params:{outboundRoute:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/outboundRoutes/edit/view.html",controller:"OutboundRouteController as vm"}},resolve:{outboundRoute:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceExtension@get",{fields:"id,appdata,type,exten,context,recordingFormat,cutdigits,description,alias,createdAt,updatedAt",id:n.id})}],contexts:["apiResolver",function(e){return e.resolve("voiceContext@get",{fields:"id,name",sort:"name"})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:403})}]},authenticate:!0,permissionId:403,bodyClass:"voice"})}e.$inject=["$stateProvider"],angular.module("app.voice.outboundRoutes",[]).config(e)}(),function(){"use strict";function e(e){e.state("app.voice.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/voice/views/realtime/realtime.html",controller:"VoiceRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:411})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.agents",{url:"/agents",params:{channel:"voice",direction:"inbound"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.telephones",{url:"/telephones",controller:"TelephonesVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/telephones/view.html",resolve:{telephones:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,fullname,userpic,internal",role:"telephone",sort:"fullname",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Telephones",fields:"id,fullname,userpic,internal",role:"telephone",sort:"fullname",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:203})}],rpcTelephones:["apiResolver",function(e){return e.resolve("rpc@getTelephones")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.trunks",{url:"/trunks",controller:"TrunksVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/trunks/view.html",resolve:{trunks:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("trunk@get",{fields:"id,name",active:!0,sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Trunks",fields:"id,name",active:!0,sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:1011})}],rpcTrunks:["apiResolver",function(e){return e.resolve("rpc@getTrunks")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queues",{url:"/queues",params:{channel:"voice",direction:"inbound"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"VoiceQueues":void 0,channel:"voice",type:"inbound",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_calls",{url:"/queue_calls",params:{direction:"inbound"},controller:"QueueCallsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queue-calls/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"id,name",type:"inbound",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,fields:"id,name",section:"VoiceQueues",channel:"voice",type:"inbound",sort:"name",nolimit:!0})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}],voiceQueuesChannels:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueuesChannels",{type:"inbound"})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.abandonedcalls",{url:"/abandonedcalls",controller:"AbandonedCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/abandonedcalls/view.html",resolve:{agents:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("user@get",{fields:"id,name,role,context,createdAt",role:"agent",sort:"-createdAt",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Agents",fields:"id,name,role,context,createdAt",role:"agent",sort:"-createdAt",nolimit:!0})}],queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",sort:"name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"name",nolimit:!0})}],dispositions:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("disposition@get",{fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Dispositions",fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.queue_params",{url:"/queue_params",controller:"QueueParamsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/queue_params/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{type:"inbound",fields:"id,name",sort:"name",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"name",nolimit:!0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}],rpcQueues:["apiResolver",function(e){return e.resolve("rpc@getVoiceQueues")}]},authenticate:!0,permissionId:411}).state("app.voice.realtime.outbound_calls",{url:"/outbound_calls",controller:"OutboundCallsVoiceRealtimeController as vm",templateUrl:"app/main/apps/voice/views/realtime/outbound_calls/view.html",resolve:{rpcCalls:["apiResolver",function(e){return e.resolve("rpc@getOutboundChannels")}]},authenticate:!0,permissionId:411})}e.$inject=["$stateProvider"],angular.module("app.voice.realtime",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.voice",{abstract:!0,url:"/voice"}).state("app.voice.voiceQueues",{url:"/voiceQueues",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceQueues/voiceQueues.html",controller:"VoiceQueuesController as vm"}},resolve:{voiceQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceQueues",fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).state("app.voice.voiceQueues.edit",{url:"/:id?tab",params:{voiceQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceQueues/edit/view.html",controller:"VoiceQueueController as vm"}},resolve:{voiceQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceQueue@get",{fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:401})}]},authenticate:!0,permissionId:401,bodyClass:"voice"}).state("app.voice.contexts",{url:"/contexts",views:{"content@app":{templateUrl:"app/main/apps/voice/views/contexts/contexts.html",controller:"ContextsController as vm"}},resolve:{contexts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceContext@get",{fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Contexts",fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:405})}]},authenticate:!0,permissionId:405,bodyClass:"voice"}).state("app.voice.voicemails",{url:"/voicemails",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicemails/voicemails.html",controller:"VoicemailsController as vm"}},resolve:{voicemails:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceMail@get",{fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Voicemails",fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:406})}]},authenticate:!0,permissionId:406,bodyClass:"voice"}).state("app.voice.voicemails.edit",{url:"/:id?tab",params:{voicemail:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicemails/edit/view.html",controller:"VoicemailController as vm"}},resolve:{voicemail:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceMail@get",{fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:406})}]},authenticate:!0,permissionId:406,bodyClass:"voice"}).state("app.voice.musiconholds",{url:"/musiconholds",views:{"content@app":{templateUrl:"app/main/apps/voice/views/musiconholds/musiconholds.html",controller:"MusicOnHoldsController as vm"}},resolve:{musiconholds:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"MusicOnHolds",fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:407})}]},authenticate:!0,permissionId:407,bodyClass:"voice"}).state("app.voice.musiconholds.edit",{url:"/:id?tab",params:{musiconhold:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/musiconholds/edit/view.html",controller:"MusicOnHoldController as vm"}},resolve:{musiconhold:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceMusicOnHold@get",{fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:407})}]},authenticate:!0,permissionId:407,bodyClass:"voice"}).state("app.voice.voiceRecordings",{url:"/voiceRecordings",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceRecordings/voiceRecordings.html",controller:"VoiceRecordingsController as vm"}},resolve:{voiceRecordings:["apiResolver","Auth","msUtils",function(e,n,t){return n.hasRole("admin")?e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:t.firstLastDayMonth(),limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoiceRecordings",fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:t.firstLastDayMonth(),limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadVoiceRecordings,privacyEnabled",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:408})}]},authenticate:!0,permissionId:408,bodyClass:"voice"}).state("app.voice.voiceRecordings.edit",{url:"/:id?tab",params:{voiceRecording:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/voice/views/voiceRecordings/edit/view.html",controller:"VoiceRecordingController as vm"}},resolve:{voiceRecording:["apiResolver","$stateParams",function(e,n){return e.resolve("voiceRecording@get",{fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadVoiceRecordings,privacyEnabled",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:408})}]},authenticate:!0,permissionId:408,bodyClass:"voice"}).state("app.voice.chanSpies",{url:"/chanSpies",views:{"content@app":{templateUrl:"app/main/apps/voice/views/chanSpies/chanSpies.html",controller:"ChanSpiesController as vm"}},resolve:{chanSpies:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voiceChanSpy@get",{fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"ChanSpies",fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:409})}]},authenticate:!0,permissionId:409,bodyClass:"voice"}).state("app.voice.voicePrefixes",{url:"/voicePrefixes",views:{"content@app":{templateUrl:"app/main/apps/voice/views/voicePrefixes/voicePrefixes.html",controller:"VoicePrefixesController as vm"}},resolve:{voicePrefixes:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("voicePrefix@get",{fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"VoicePrefixes",fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:410})}]},authenticate:!0,permissionId:410,bodyClass:"voice"}),n.addPart("app/main/apps/voice")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.voice",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.voice.inboundRoutes","app.voice.outboundRoutes","app.voice.internalRoutes","app.voice.realtime"]).config(e)}(),function(){"use strict";function e(e){e.state("app.whatsapp.realtime",{url:"/realtime",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/realtime/realtime.html",controller:"WhatsappRealtimeController as vm"}},resolve:{userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2110})}]},authenticate:!0,permissionId:2110}).state("app.whatsapp.realtime.agents",{url:"/agents",params:{channel:"whatsapp"},controller:"AgentsRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/agents/view.html",resolve:{pauses:["apiResolver",function(e){return e.resolve("pause@get",{sort:"name",nolimit:!0})}],agents:["apiResolver",function(e){return e.resolve("realtime@getAgents",{sort:"fullname"})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:202})}],utcOffset:["settingsManager",function(e){return e.getUTCOffset()}]},authenticate:!0,permissionId:2110}).state("app.whatsapp.realtime.queues",{url:"/queues",params:{channel:"whatsapp"},controller:"QueuesRealtimeController as vm",templateUrl:"app/main/apps/realtime/views/queues/view.html",resolve:{queues:["apiResolver","Auth",function(e,n){return e.resolve("realtime@getQueues",{id:n.isUser()?n.getCurrentUser().userProfileId:void 0,section:n.isUser()?"WhatsappQueues":void 0,channel:"whatsapp",sort:"name",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2110})}e.$inject=["$stateProvider"],angular.module("app.whatsapp.realtime",[]).config(e)}(),function(){"use strict";function e(e,n,t,a){e.state("app.whatsapp",{abstract:!0,url:"/whatsapp"}).state("app.whatsapp.whatsappQueues",{url:"/whatsappQueues",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/whatsappQueues.html",controller:"WhatsappQueuesController as vm"}},resolve:{whatsappQueues:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappQueues",fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2101,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappQueues.edit",{url:"/:id?tab",params:{whatsappQueue:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/view.html",controller:"WhatsappQueueController as vm"}},resolve:{whatsappQueue:["apiResolver","$stateParams",function(e,n){return e.resolve("whatsappQueue@get",{fields:"createdAt,updatedAt,id,name,strategy,timeout,description",id:n.id})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2101})}]},authenticate:!0,permissionId:2101,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappAccounts",{url:"/whatsappAccounts",views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/whatsappAccounts.html",controller:"WhatsappAccountsController as vm"}},resolve:{whatsappAccounts:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",sort:"-updatedAt",limit:10,offset:0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"WhatsappAccounts",fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description",sort:"-updatedAt",limit:10,offset:0})}],userProfile:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?null:e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2102})}]},authenticate:!0,permissionId:2102,bodyClass:"whatsapp"}).state("app.whatsapp.whatsappAccounts.edit",{url:"/:id?tab",params:{whatsappAccount:void 0,crudPermissions:void 0},views:{"content@app":{templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/view.html",controller:"WhatsappAccountController as vm"}},resolve:{whatsappAccount:["apiResolver","$stateParams",function(e,n){return e.resolve("whatsappAccount@get",{fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",id:n.id})}],userProfile:["apiResolver","Auth",function(e,n){return n.isAdmin()?null:e.resolve("userProfile@get",{fields:"id,name,crudPermissions,downloadOmnichannelInteractions",id:n.getCurrentUser().userProfileId})}],userProfileSection:["apiResolver","Auth",function(e,n){return e.resolve("userProfileSection@get",{fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:n.getCurrentUser().userProfileId,sectionId:2102})}]},authenticate:!0,permissionId:2102,bodyClass:"whatsapp"}),n.addPart("app/main/apps/whatsapp")}e.$inject=["$stateProvider","$translatePartialLoaderProvider","msApiProvider","msNavigationServiceProvider"],angular.module("app.whatsapp",["ngCsv","ngPassword","md.data.table","flow","mdColorPicker","ckeditor","ng-sortable","ngAria","ngAnimate","mdPickers","mwFormBuilder","mwFormViewer","mwFormUtils","ngclipboard","angular-cron-jobs","ngEmbed","angularMaterialFormBuilder","material.components.expansionPanels","chart.js","angular.filter","app.whatsapp.realtime"]).config(e)}(),function(){"use strict";angular.module("app.navigation",[]).config(function(){})}(),function(){"use strict";function e(e,n){e.addPart("app/quick-panel")}e.$inject=["$translatePartialLoaderProvider","msApiProvider"],angular.module("app.quick-panel",[]).config(e)}(),function(){"use strict";function e(e,n){e.state("app.reset",{url:"/reset/:token",views:{"main@":{templateUrl:"app/core/layouts/content-only.html",controller:"MainController as vm"},"content@app.reset":{templateUrl:"app/reset/reset.html",controller:"ResetPasswordController as vm"}},bodyClass:"reset"}),n.addPart("app/reset")}e.$inject=["$stateProvider","$translatePartialLoaderProvider"],angular.module("app.reset",[]).config(e)}(),function(){"use strict";function e(e){e.addPart("app/toolbar")}e.$inject=["$translatePartialLoaderProvider"],angular.module("app.toolbar",[]).config(e)}(),function(){"use strict";angular.module("app.user-setting",[])}(),function(){"use strict";function e(e){e.interceptors.push("authInterceptor")}e.$inject=["$httpProvider"],angular.module("app.auth").config(e)}(),function(){"use strict";function e(e){e.onBefore({to:function(e){return!0===e.authenticate}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService;return n.isLoggedIn()?n.retrieveUser().catch(function(){return t.target("app.login",void 0,{reload:!0})}):t.target("app.login",void 0,{reload:!0})}),e.onStart({to:function(e){return"app.login"!==e.name}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService,a=e.$to();if(n.hasRole("agent")&&"app.dashboards.general"!=a.name)return t.target("app.dashboards.general",{redirect:!1},{reload:!0})}),e.onFinish({to:function(e){return"app.help"===e.parent.name}},function(e){var n=e.router.stateService;if("app.help"===e.$to().parent.name){var t=e.injector().get("settingsManager"),a=t?t.get():null;if(!a||!a.viewHelpSection)return n.target("app.dashboards.general",{redirect:!1},{reload:!0})}}),e.onFinish({to:function(e){return e.permissionId}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService,a=e.$to();if(n.hasRole("user")){if(!n.hasPermission(a.permissionId))return t.target("app.dashboards.general",{redirect:!1},{reload:!0});var i=e.params().id?Number(e.params().id):void 0;if(i)return n.hasResourcePermission(a.permissionId,i).catch(function(){return t.target(a.parent.name,{redirect:!1},{reload:!0})})}}),e.onFinish({to:function(e){return"app.dashboards.general"===e.parent.name}},function(e){var n=e.injector().get("Auth"),t=e.router.stateService;e.$to();if(n.hasRole("user")&&!n.hasPermission(100))return t.target("app.dashboards.general",{redirect:!1},{reload:!0})})}e.$inject=["$transitions"],angular.module("app.auth").run(e)}(),function(){"use strict";function e(a,e,o,i,s,r,l,d,c){var m;return{getToken:n,getCurrentUser:u,getPermissions:A,hasChildrenPermissions:function(e){return!!e&&_.some(e,function(e){return t(e)})},hasModulePermissions:function(i){return o(function(a,n){f()?a(!0):r.userProfileSection.get({userProfileId:m.userProfileId}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(_.isEmpty(n))a(!1);else{var t=_.filter(n,function(e){return e.enabled});a(_.some(t,["category",i]))}}).catch(function(e){n(e)})})},hasModulesPermissions:function(s){return o(function(a,n){var i={};f()?(s.forEach(function(e){i[e]=!0}),a(i)):r.userProfileSection.get({userProfileId:m.userProfileId}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(_.isEmpty(n))a({});else{var t=_(n).filter(function(e){return e.enabled&&_.includes(s,e.category)}).uniqBy(function(e){return e.category}).map(function(e){return e.category}).value();t.forEach(function(e){i[e]=!0}),a(i)}}).catch(function(e){n(e)})})},hasRole:function(e){return!!m&&m.role===e},hasPermission:t,hasResourcePermission:function(e,s){return o(function(a,i){return r.userProfileSection.get({userProfileId:m.userProfileId,sectionId:e}).$promise.then(function(e){var n=e.rows[0];if(n.autoAssociation)return a();var t=l.getActiveItem().node;return t.permissions&&!1===t.permissions.association?a():r.userProfileResource.get({sectionId:n.id,nolimit:!0}).$promise.then(function(e){var n=e.rows;_.some(n,["resourceId",s])?a():i()})}).catch(function(e){i("Error retrieving user profile permissions",e)})})},hasSectionPermissions:function(a){return o(function(e,n){var t={};return E().then(function(){_.includes(m.permissions,a)&&(t[a]=!0),e(t)}).catch(function(e){n(e)})})},hasSectionsPermissions:function(a){return o(function(e,n){var t={};if(!f())return E().then(function(){a.forEach(function(e){_.includes(m.permissions,e)&&(t[e]=!0)}),e(t)}).catch(function(e){n(e)});a.forEach(function(e){t[e]=!0}),e(t)})},isAgent:h,isAdmin:f,isLoggedIn:function(){return!!n()},isTelephone:function(){return"telephone"===m.role},isUser:b,login:function(e){return o(function(n,t){r.auth.local(e).$promise.then(function(e){return d.get().secureCookieEnabled?c.set("motion.token",e.token,{secure:!0,sameSite:"none"}):c.set("motion.token",e.token),r.user.get({id:e.id}).$promise}).then(function(e){(m=e).lastLoginAt=moment().format("YYYY-MM-DD HH:mm:ss"),y("LOCAL_LOGIN")}).then(function(){if(h()&&1===m.showWebBar&&m.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver",function(e){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return h()&&0!==m.showWebBar?p(e):f()||b()?g(!0):void 0}).then(function(e){m=_.assign(m,e),n()}).catch(function(e){t(e)})})},logout:function(t){return o(function(e,n){t?(v(),e()):o.resolve().then(function(){return h()&&0!==m.showWebBar?o(function(e,n){r.user.logout({id:m.id,device:"web"}).$promise.then(function(){e()}).catch(function(e){n(e)})}):f()||b()?g(!1):void 0}).then(function(){v(),e()}).catch(function(e){n(e)})})},parseCrudPermissions:function(e){return f()?{readOnly:!1,canEdit:!0,canDelete:!0}:e?{readOnly:!(!_.includes(e,"r")||1!==e.length),canEdit:!!_.includes(e,"e"),canDelete:!!_.includes(e,"d")}:{readOnly:!0,canEdit:!1,canDelete:!1}},queueLogin:p,reloadPermissions:E,removeCookies:v,retrieveUser:function(){return o(function(n,t){r.user.whoami({userSetting:!0}).$promise.then(function(n){return"user"===n.role?A(n.userProfileId).then(function(e){return n.permissions=e,n}):n}).then(function(e){n(m=e)}).catch(function(e){t(e)})})},setCurrentUser:function(e){m=_.merge(m,e)},getAuthenticationType:function(){var e=u(),n=i.localStorage.getItem("motion2.user:"+e.id);if(n)return JSON.parse(n).authenticationType;return"NONE"},loginSSO:function(e){"google"!==e&&y("SSO_LOGIN");return"/api/auth/"+e},loginAD:function(e){return o(function(n,t){r.auth.activedirectory(e).$promise.then(function(e){return d.get().secureCookieEnabled?c.set("motion.token",e.token,{secure:!0,sameSite:"none"}):c.set("motion.token",e.token),r.user.get({id:e.id}).$promise}).then(function(e){(m=e).lastLoginAt=moment().format("YYYY-MM-DD HH:mm:ss"),y("SSO_LOGIN")}).then(function(){if(h()&&1===m.showWebBar&&m.hotdesk)return a.show({controller:"HotDeskDialogController",controllerAs:"vm",templateUrl:"app/auth/services/hotdesk/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,resolve:{telephones:["apiResolver",function(e){return e.resolve("user@get",{fields:"id,fullname,name,internal",role:"telephone",nolimit:!0})}]}})}).then(function(e){return h()&&0!==m.showWebBar?p(e):f()||b()?g(!0):void 0}).then(function(e){m=_.assign(m,e),n()}).catch(function(e){t(e)})})},setMessengerSoundNotification:function(e){u().messengerSoundNotification=e}};function n(){return e.get("motion.token")}function u(){return m}function p(e){return o(function(n,t){r.user.login({id:m.id,device:"web",intrf:e}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}function g(a){return o(function(n,t){var e={online:a,lastLoginAt:a?moment().format("YYYY-MM-DD HH:mm:ss"):void 0};r.user.update({id:m.id},e).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}function v(){e.remove("motion.token"),m&&(i.localStorage.removeItem("motion.user:"+m.id),m=null)}function h(){return"agent"===m.role}function f(){return"admin"===m.role}function b(){return"user"===m.role}function t(e){return!!m&&_.includes(m.permissions,e)}function A(e){var a=[];return o(function(n,t){return e||n(a),r.userProfile.getSections({id:e}).$promise.then(function(e){for(var n=0;n<e.length;n++){var t=e[n];a.push(t.sectionId),t.subsections&&(a=_.concat(a,t.subsections))}return a}).then(function(e){n(e)}).catch(function(e){t("Error retrieving user profile permissions",e)})})}function E(){return o(function(n,t){A(m.userProfileId).then(function(e){m.permissions=e,n()}).catch(function(e){t(e)})})}function y(e){var n=u(),t={authenticationType:e};i.localStorage.setItem("motion2.user:"+n.id,JSON.stringify(t))}}e.$inject=["$mdDialog","$cookies","$q","$window","$document","api","msNavigationService","settingsManager","jscookie"],angular.module("app.auth").factory("Auth",e)}(),function(){"use strict";function e(n,e){this.telephones=e,this.closeDialog=function(e){n.hide(e)},e.count&&(this.name=e.rows[0].name)}e.$inject=["$mdDialog","telephones"],angular.module("app.auth").controller("HotDeskDialogController",e)}(),function(){"use strict";function e(n,t,a,i,s){var o;return{request:function(e){var n=a.get("motion.token");return e.headers=e.headers||{},s.isSameOrigin(e.url)&&n&&(e.headers.Authorization="Bearer "+n),e},responseError:function(e){switch(e.status){case 401:a.remove("motion.token"),n.$broadcast("webrtc::logout"),(o||(o=i.get("$state"))).go("app.login")}return t.reject(e)}}}e.$inject=["$rootScope","$q","$cookies","$injector","Util"],angular.module("app.auth").factory("authInterceptor",e)}(),function(){"use strict";function e(n){var t={safeCb:function(e){return angular.isFunction(e)?e:angular.noop},urlParse:function(e){var n=document.createElement("a");return n.href=e,""===n.host&&(n.href=n.href),n},isSameOrigin:function(i,e){return i=t.urlParse(i),(e=(e=e&&[].concat(e)||[]).map(t.urlParse)).push(n.location),1<=(e=e.filter(function(e){var n=i.hostname===e.hostname,t=i.protocol===e.protocol,a=i.port===e.port||""===e.port&&("80"===i.port||"443"===i.port);return n&&t&&a})).length}};return t}e.$inject=["$window"],angular.module("app.auth").factory("Util",e)}(),function(){"use strict";function e(e,n,t){var a={initLogger:function(){return i.init({uri:t.baseUrl+"logs/client-logs",initial_state_name:"client-logs",flushInterval:6e4,debounceInterval:10,sizeLimit:300,silent:!1,autoLog:["error"],heartbeat:!1,logUnload:!1,logPerformance:!1}),i.addHeaderBuilder(function(){return(e=n.get("motion.token"))?{Authorization:"Bearer "+e}:{};var e}),i}},i=e.$logger;if(!i)throw new Error("Beaver Logger not found");return a}function n(d,e,t){var n={getLogger:function(l){var e=function(r){return function(){for(var e=arguments.length,n=Array(e),t=0;t<e;t++)n[t]=arguments[t];var a=n[0],i=n.slice(1),s="string"!=typeof a||"string"==typeof a&&0===i.length?l:a,o=1<n.length&&"string"==typeof a?i:n;(function(e,n,t){if(!d.isLoggedIn())return;var a=d.getCurrentUser();if(!a||!a.userSetting.clientSideLoggingEnabled)return;if(i=e,!(c.indexOf(i)>=c.indexOf(m)))return;var i;var s=n,o=t;"string"==typeof n&&void 0===t&&(s=e,o=n);u[e].call(u,s,{data:p(o)})}).call(this,r,s,o)}};return{error:e("error"),warn:e("warn"),info:e("info"),debug:e("debug")}},getLoggingColors:function(){return{disabled:{color:"#616161"},debug:{color:"#283593"},info:{color:"#000000"},warning:{color:"#FBC02D"},error:{color:"#FF5252"}}},flush:a},c=["debug","info","warn","error"],m="debug",u=e.initLogger();function p(t){return Array.isArray(t)?t.map(p):null===t||"object"!=typeof t?t:_.isPlainObject(t)?t:t&&"function"==typeof t.toJSON?t.toJSON():t instanceof Error?Object.getOwnPropertyNames(t).reduce(function(e,n){return e[n]=p(t[n]),e},{}):JSON.parse(JSON.stringifyOnce(t))}function a(){return u.flush()}return t.$on("local:user-setting-updated",function(e,n){n.clientSideLoggingEnabled?t.$broadcast("client-side-logging:enabled"):(a(),t.$broadcast("client-side-logging:disabled")),m=n.clientSideLoggingLevel}),t.$on("local:user-logout",function(){m="debug"}),JSON.stringifyOnce=function(i,s,e){var o=[],r=[];return e||(e=2),JSON.stringify(i,function(e,t){if(2e3<o.length)return"object too long";var a=!1;if(o.forEach(function(e,n){e===t&&(a=n)}),""==e)return o.push(i),r.push("root"),t;if(a+""!="false"&&"object"==typeof t)return"root"==r[a]?"(pointer to root)":"(see "+(t&&t.constructor?t.constructor.name.toLowerCase():typeof t)+" with key "+r[a]+")";var n=e||"(empty key)";return o.push(t),r.push(n),s?s(e,t):t},e)},n}e.$inject=["$window","$cookies","api"],n.$inject=["Auth","clientSideLogger","$rootScope"],angular.module("app.client-side-logging").factory("clientSideLogger",e).service("ClientSideLoggingService",n)}(),function(){"use strict";angular.module("app.core").provider("motionConfig",function(){var t={disableCustomScrollbars:!1,disableMdInkRippleOnMobile:!0,disableCustomScrollbarsOnMobile:!0};this.config=function(e){t=angular.extend({},t,e)},this.$get=function(){var e={getConfig:function(e){if(angular.isUndefined(t[e]))return!1;return t[e]},setConfig:function(e,n){t[e]=n}};return e}})}(),function(){"use strict";function e(e,n,t){n.debugEnabled(!0),e.config({tabindex:!1}),t.config({disableCustomScrollbars:!1,disableCustomScrollbarsOnMobile:!0,disableMdInkRippleOnMobile:!0})}e.$inject=["$ariaProvider","$logProvider","motionConfigProvider"],angular.module("app.core").config(e)}(),function(){"use strict";function e(e,n,t){(n.generate(),t.getConfig("disableMdInkRippleOnMobile")&&e.isMobile())&&angular.element("body").attr("md-no-ink",!0);e.isMobile()&&angular.element("html").addClass("is-mobile");var a=e.detectBrowser();if(a){var i=a.browser+" "+a.version+" "+a.os;angular.element("html").addClass(i)}}e.$inject=["msUtils","motionGenerator","motionConfig"],angular.module("app.core").run(e)}(),function(){"use strict";function e(n,e,t,a,i,s){var l=this;function o(){var e=_.filter(l.searchOptions.conditions,["disabled",!1]),o=[],r="";if(_(e).groupBy("name").forEach(function(e){var n=e[0],t=1<e.length,a=n.query.column;if(t){var i=_(e).groupBy(function(e){return e.query.operator}).mapValues(function(e){return _.chain(e).map(function(e){return e.query.value}).flattenDeep().value()}).value(),s=[];_.keys(i).forEach(function(e){var n=i[e],t=e;_.includes(["$between","$in","$notIn"],e)?t+="["+n+"]":n.forEach(function(e){t+="["+e+"]"}),s.push(t)}),r+=a+":="+s.join(":=")}else r=a+":="+n.query.operator+"["+n.query.value+"]";o.push(r)}),0!==o.length){var n="["+l.searchOptions.matchType+"]";return n+=o.join("||")}}function r(){var e=n.localStorage.getItem("motion2."+s+":"+l.currentUser.id);return e?JSON.parse(e):{}}function d(e){n.localStorage.setItem("motion2."+s+":"+l.currentUser.id,JSON.stringify(e))}function c(){if(s){var e=r();e.advancedSearch=_.omit(l.searchOptions,"fields"),d(e)}}function m(){return!!r().advancedSearch}l.currentUser=t.getCurrentUser(),l.searchOptions={matchType:"$and",conditions:[],fields:i},l.toolbarColor=a,l.onInit=function(){if(s){var e=r();e.hasOwnProperty("advancedSearch")&&(l.searchOptions=_.merge(l.searchOptions,e.advancedSearch))}},l.applyFilter=function(){c(),e.hide({apply:!0,value:o()})},l.clearConditions=function(){l.searchOptions.conditions=[],function(){if(s){var e=r();delete e.advancedSearch,e.query&&delete e.query.search,d(e)}}()},l.minimize=function(){c(),e.hide({apply:!m(),value:o()||m()?!_.isEmpty(l.searchOptions.conditions):void 0})},l.close=function(){e.hide({apply:!m(),value:o()||m()?!_.isEmpty(l.searchOptions.conditions):void 0})}}e.$inject=["$window","$mdDialog","Auth","color","fields","storagePath"],angular.module("app.core").controller("AdvancedSearchController",e)}(),function(){"use strict";function e(a){return{restrict:"A",link:function(e,n,t){e.$watch(t.focusOn,function(e){a(function(){e?n[0].focus():n[0].blur()})})}}}e.$inject=["$timeout"],angular.module("app.core").directive("focusOn",e)}(),function(){"use strict";function e(o,l,d){return{restrict:"E",compile:function(e,n){var s;return n.code||(s=e.html(),e.empty()),function(t,a,r){r.code&&(s=t.$eval(r.code));var i=t.$eval(r.shouldInterpolate);l.when(s).then(function(e){if(e){i&&(e=d(e)(t));var n=angular.element('<pre><code class="highlight" ng-non-bindable></code></pre>');a.append(n),o(function(){!function(e,n){var t=n.find("code"),a=e.split("\n"),i=(a=a.filter(function(e){return e.trim().length}))[0].match(/^\s*/)[0],s=new RegExp("^"+i);a=a.map(function(e){return e.replace(s,"").replace(/\s+$/,"")});var o=hljs.highlight(r.language||r.lang,a.join("\n"),!0);o.value=o.value.replace(/=<span class="hljs-value">""<\/span>/gi,"").replace("<head>","").replace("<head/>",""),t.append(o.value).addClass("highlight")}(e,n)},34,!1)}})}}}}e.$inject=["$timeout","$q","$interpolate"],angular.module("app.core").directive("hljs",e)}(),function(){"use strict";function e(n,a,e,t){var o=this;function i(){var a=o.selectedField.options&&!_.isEmpty(o.selectedField.options.extraOperators),i=o.selectedField.options&&!_.isEmpty(o.selectedField.options.excludedOperators);o.availableOperators=_.filter(o.operators,function(n){var e=!n.applyTo||_.includes(n.applyTo,o.selectedField.type);n.isExtra=a&&_.some(o.selectedField.options.extraOperators,function(e){return e===n.type});var t=_.includes(n.excludeFrom,o.selectedField.type)||i&&_.includes(o.selectedField.options.excludedOperators,n.type);if((e||n.isExtra)&&!t)return n})}function s(n){return e[n.model][n.action](n.params).$promise.then(function(e){return e.rows}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:n.model.toUpperCase()+"."+n.action.toUpperCase(),msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function r(){!o.value||_.isArray(o.value)&&_.isEmpty(o.value)?o.isValidCondition=!1:o.selectedOperator?o.selectedOperator&&"$between"===o.selectedOperator.type?o.isValidCondition=!(!o.endRangeValue||!o.isValidRange):o.isValidCondition=!0:o.isValidCondition=!1}function l(){"number"===o.selectedField.type?_.isNumber(o.endRangeValue)?o.isValidRange=Number(o.endRangeValue)>Number(o.value):o.isValidRange=!0:"date"===o.selectedField.type&&(o.maxDateRange=moment(o.endRangeValue).subtract(1,"day"),o.isValidRange=!0),r()}function d(){var e=m();o.options.conditions.push(e),p()}function c(){var e=m(),n=_.findIndex(o.options.conditions,"style");o.options.conditions.splice(n,1,e),p(),o.pendingCondition.style=null,o.pendingCondition=void 0}function m(){return{name:o.selectedField.name,operator:n.instant("DASHBOARDS."+o.selectedOperator.translate),value:o.value,endValue:o.endRangeValue,displayValue:u(o.value),displayEndValue:u(o.endRangeValue),query:{column:o.selectedField.column,operator:o.selectedOperator.type,value:function(){var e,n=o.value,t=o.endRangeValue;switch(o.selectedField.type){case"date":var a=moment(n).utcOffset(0,!0).format("YYYY-MM-DD");if("$between"===o.selectedOperator.type){var i=moment(t).utcOffset(0,!0).format("YYYY-MM-DD");e=[a,i]}else e=a;break;case"number":e="$between"===o.selectedOperator.type?[n,t]:n;break;case"multiselect":var s=o.selectedField.options.field||"name";e=_.map(n,s);break;case"select":e=n.id;break;case"autocomplete":e=o.selectedOperator.isExtra?n:n.id;break;default:e=n}return e}()},disabled:!1}}function u(e){var n;if(e){switch(o.selectedField.type){case"date":n=moment(e).format("YYYY-MM-DD");break;case"multiselect":var t=_.map(e,function(e){return e.name});n="$eq"===o.selectedOperator.type?t.join(" or "):t.join(" and ");break;case"select":n=e.name;break;case"autocomplete":n=o.selectedOperator.isExtra?e:e.displayValue;break;default:n=e}return n}}function p(){o.value=null,o.endRangeValue=null,o.minDateRange=null,o.maxDateRange=null,o.isValidCondition=!1}o.operators=o.availableOperators=[{type:"$eq",symbol:"=",translate:"EQUALS",excludeFrom:["multiselect"]},{type:"$ne",symbol:"≠",translate:"IS_NOT_EQUAL",excludeFrom:["multiselect"]},{type:"$in",symbol:"∈",translate:"IS_AMONG",applyTo:["multiselect"]},{type:"$notIn",symbol:"∉",translate:"IS_NOT_AMONG",applyTo:["multiselect"]},{type:"$substring",symbol:"⊃",translate:"CONTAINS",applyTo:["text"]},{type:"$startsWith",symbol:"a..",translate:"STARTS_WITH",applyTo:["text"]},{type:"$endsWith",symbol:"..a",translate:"ENDS_WITH",applyTo:["text"]},{type:"$lt",symbol:"<",translate:"IS_LESS_THAN",applyTo:["date","number"]},{type:"$gt",symbol:">",translate:"IS_GREATER_THAN",applyTo:["date","number"]},{type:"$lte",symbol:"≤",translate:"IS_LESS_THAN_OR_EQUAL_TO",applyTo:["date","number"]},{type:"$gte",symbol:"≥",translate:"IS_GREATER_THAN_OR_EQUAL_TO",applyTo:["date","number"]},{type:"$between",symbol:"≬",translate:"IS_BETWEEN",applyTo:["date","number"]}],o.addCondition=d,o.editCondition=function(e){o.pendingCondition=e,o.pendingCondition.style="md-amber-200-bg",o.selectedField=_.find(o.options.fields,["name",o.pendingCondition.name]),i(),o.selectedOperator=_.find(o.availableOperators,["type",o.pendingCondition.query.operator]),"date"===o.selectedField.type&&"string"==typeof o.pendingCondition.value?(o.value=new Date(o.pendingCondition.value),o.minDateRange=moment(o.value).add(1,"day"),o.endRangeValue=o.pendingCondition.endValue?new Date(o.pendingCondition.endValue):void 0):(o.value=o.pendingCondition.value,o.endRangeValue=o.pendingCondition.endValue);o.isValidRange=!0,o.isValidCondition=!0},o.updateCondition=c,o.cancelUpdateCondition=function(){o.pendingCondition.style=null,o.pendingCondition=void 0},o.setConditionStatus=function(e){e.style=e.disabled?void 0:"chip-disabled",e.disabled=!e.disabled},o.removeCondition=function(){_.isEmpty(o.options.conditions)&&o.clearFilter()},o.getValues=function(){return o.selectedField.options.routes&&Array.isArray(o.selectedField.options.routes)?(e=angular.copy(o.selectedField.options.routes).map(function(e){return s(e)}),a.all(e).then(function(e){o.selectedField.values=_.flatten(e)})):o.selectedField.options.route?function(){var e=angular.copy(o.selectedField.options.route);if("autocomplete"===o.selectedField.type)for(var n=0;n<Object.keys(e.params).length;n++){var t=Object.keys(e.params)[n];"@autocomplete"===e.params[t]&&(e.params[t]=o.searchText,e.params.autocomplete=!0)}return a.resolve().then(function(){if(!o.selectedField.values||!0===e.params.autocomplete)return s(e)}).then(function(e){return e&&(o.selectedField.values=e),"autocomplete"===o.selectedField.type?function(e){var n=[];o.searchText&&(n=e.filter(function(e){e.displayValue="";for(var n=0;n<o.selectedField.options.searchFields.length;n++){var t=o.selectedField.options.searchFields[n],a=e[t]||"";e.displayValue+=a+" "}return _.trimEnd(e.displayValue),e.displayValue.toLowerCase().includes(o.searchText.toLowerCase())}));return n}(o.selectedField.values):o.selectedField.values})}():(o.selectedField.values.forEach(function(e){e.translate&&(e.name=n.instant(e.translate))}),o.selectedField.values);var e},o.onFieldChange=function(){o.value=void 0,o.endRangeValue=void 0,o.searchText=void 0,o.isValidCondition=!1,i(),o.autoSelectOperator=1===o.availableOperators.length,o.autoSelectOperator||(o.selectedOperator=void 0)},o.onOperatorChange=function(e){o.isValidRange=!0,o.selectedOperator&&(e?e.applyTo?0<_.difference(o.selectedOperator.applyTo,e.applyTo).length&&(o.value=null):o.selectedOperator.applyTo&&(o.value=null):o.value||(o.value=null),"between"!=o.selectedOperator.type&&(o.endRangeValue=null),o.selectedField.options&&!_.isEmpty(o.selectedField.options.extraOperators)&&(o.selectedOperator.isExtra=_.some(o.selectedField.options.extraOperators,function(e){return e===o.selectedOperator.type})));r()},o.onValueChange=function(){o.selectedOperator&&"$between"===o.selectedOperator.type?"number"===o.selectedField.type?l():"date"===o.selectedField.type&&(o.minDateRange=moment(o.value).add(1,"day"),r()):r()},o.checkRange=l,o.handleKeyboardAction=function(){o.pendingCondition?c():d()}}e.$inject=["$translate","$q","api","toasty"],angular.module("app.core").directive("msAdvancedSearch",function(){return{restrict:"E",scope:{options:"=",clearFilter:"&"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-advanced-search/ms-advanced-search.html"}})}(),function(){"use strict";angular.module("app.core").directive("msCard",function(){return{restrict:"E",scope:{templatePath:"=template",card:"=ngModel",vm:"=viewModel"},template:'<div class="ms-card-content-wrapper" ng-include="templatePath" onload="cardTemplateLoaded()"></div>',compile:function(e){return e.addClass("ms-card"),function(e,n){e.cardTemplateLoaded=function(){e.$emit("msCard::cardTemplateLoaded",n)}}}}})}(),function(){"use strict";angular.module("app.core").directive("msChipColor",function(){return{restrict:"A",link:function(e,i,n){n.$observe("msChipColor",function(e){var n=i.parent().parent();if(n.hasClass("md-background-bg md-hue-3")||n.addClass("md-background-bg md-hue-3"),_.isEmpty(e)){var t=n[0].className.split(" "),a=t.indexOf("md-hue-3");t.length=a+1,n[0].className=t.join(" ")}else n.addClass(e)})}}})}(),function(){"use strict";angular.module("app.core").directive("msClickToCall",function(){return{restrict:"E",scope:{type:"=",disabled:"=",target:"=",prefix:"=",license:"="},controller:["$scope","$rootScope","$http","$translate","$document","$mdDialog","Auth","toasty","api",function(t,n,a,i,s,o,e,r,l){function d(e){switch(t.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(t.currentUser.phoneBarRemoteControlPort||"9888")+"/api/originate/"+c(e));case 2:return n.$broadcast("webrtc::call",{target:c(e)})}}function c(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function m(e){return a.get(e).success(function(){r.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(e){r.error({title:"PhoneBar API Error",msg:i.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}t.currentUser=e.getCurrentUser(),t.privacy=t.currentUser.privacyEnabled,t.showMenu=function(){return t.target&&t.target.indexOf("@")<0&&t.target!=t.currentUser.internal&&t.target!=t.currentUser.name&&(0==t.currentUser.showWebBar&&t.currentUser.phoneBarRemoteControl||2==t.currentUser.showWebBar&&t.license.webrtc)&&!t.disabled},t.call=function(e){return 2!==t.currentUser.showWebBar?(n=e,l.user.getVoicePrefixes({id:t.currentUser.id}).$promise.then(function(e){if(e.count)return o.show({controller:"PrefixDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/prefix/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!0,locals:{prefixes:e,required:t.currentUser.phoneBarPrefixRequired}})}).then(function(e){t.currentUser.phoneBarPrefixRequired?e&&-1!==e&&d(e+n):e&&-1!==e?d(e+n):e||d(n)})):d(e);var n},t.transfer=function(e){switch(t.currentUser.showWebBar){case 0:return m("http://127.0.0.1:"+(t.currentUser.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+c(e));case 2:n.$broadcast("webrtc::transfer",{target:c(e)})}}}],templateUrl:"app/core/directives/ms-click-to-call/ms-click-to-call.html"}})}(),function(){"use strict";n.$inject=["ClientSideLoggingService","$rootScope","$translate"];var e={bindings:{user:"<"},controller:n,controllerAs:"vm",templateUrl:"app/core/directives/ms-client-side-logging/ms-client-side-logging-icon.html"};function n(e,n,t){var a=this,i=e.getLoggingColors();function s(){a.tooltipHTML=a.user.userSetting.clientSideLoggingEnabled?[t.instant("STAFF.CLIENT_LOGS_ENABLED"),t.instant("STAFF.CLIENT_LOGS_LOGLEVEL",{logLevel:a.user.userSetting.clientSideLoggingLevel}),t.instant("STAFF.CLIENT_LOGS_ENABLED_SINCE",{enabledSince:moment(a.user.userSetting.clientSideLoggingEnabledSince).format("LLLL")})].join("<br>"):t.instant("STAFF.CLIENT_LOGS_DISABLED")}a.tooltipHTML=t.instant("STAFF.CLIENT_LOGS_DISABLED"),a.styleColor=i.disabled,a.styleIcon=a.user.userSetting&&a.user.userSetting.clientSideLoggingEnabled?"icon-checkbox-marked-circle":"icon-close",a.$onInit=function(){if(!a.user.userSetting)return;var e=a.user.userSetting.clientSideLoggingEnabled?a.user.userSetting.clientSideLoggingLevel:"disabled";a.styleColor=i[e],"info"===e&&(a.styleIcon="icon-checkbox-marked-circle-outline");return s()},a.$onDestroy=function(){o()};var o=n.$on("$translateChangeSuccess",s)}angular.module("app.core").component("msClientSideLoggingIcon",e)}(),function(){"use strict";n.$inject=["ClientSideLoggingService","UserSettingService","$q","$translate","$rootScope","$interval"];var e={bindings:{user:"<",onUserUpdate:"&"},controller:n,controllerAs:"vm",templateUrl:"app/core/directives/ms-client-side-logging/ms-client-side-logging.html"};function n(e,t,n,a,i,s){var o=this,r=e.getLoggingColors(),l=null;function d(){l&&s.cancel(l)}o.styleProperties=r.disabled,o.clientSideLoggingEnabledSince="",o.$onInit=function(){m().then(function(){d(),l=s(u,6e4)})},o.$onChanges=function(e){e&&n.resolve().then(m)},o.$onDestroy=function(){d(),c()},o.onEnabledSwitchChange=function(){var e=o.user.userSetting.clientSideLoggingEnabled,n=o.user.userSetting.clientSideLoggingLevel;return p(e,n)},o.onLogLevelSelectionChange=function(){var e=o.user.userSetting.clientSideLoggingEnabled,n=o.user.userSetting.clientSideLoggingLevel;p(e,n)},o.computeStyleForLoggingLevel=function(e){return r[e]};var c=i.$on("$translateChangeSuccess",u);function m(){o.availableClientSideLoggingLevels=Object.keys(r).filter(function(e){return"disabled"!==e});var e=o.user.userSetting&&o.user.userSetting.clientSideLoggingEnabled?o.user.userSetting.clientSideLoggingLevel:"disabled";return o.styleProperties=r[e],u()}function u(){if(o.user.userSetting)return o.user.userSetting.clientSideLoggingEnabled?void(o.clientSideLoggingEnabledSince=a.instant("STAFF.CLIENT_LOGS_ENABLED_SINCE",{enabledSince:moment(moment(o.user.userSetting.clientSideLoggingEnabledSince).format()).fromNow()})):o.clientSideLoggingEnabledSince=""}function p(e,n){return t.updateUserSettingById(o.user.userSetting.id,{clientSideLoggingEnabled:e,clientSideLoggingLevel:n}).then(function(){"function"==typeof o.onUserUpdate&&o.onUserUpdate()})}}angular.module("app.core").component("msClientSideLogging",e)}(),function(){"use strict";function e(i){return{require:"ngModel",priority:1,link:function(e,n,t,a){a.$formatters.push(i.formatter),a.$parsers.push(i.parser)}}}e.$inject=["msDatepickerFixConfig"],angular.module("app.core").provider("msDatepickerFixConfig",function(){var n={formatter:function(e){return e?""===e?e:new Date(e):""},parser:function(e){return e?moment(e).add(moment(e).utcOffset(),"m").toDate():""}};this.config=function(e){n=angular.extend({},n,e)},this.$get=function(){return n}}).directive("msDatepickerFix",e)}(),function(){"use strict";function e(s){return{restrict:"E",scope:{id:"=",model:"=",element:"=",title:"=",path:"="},replace:!0,link:function(n,e){var t=!1,a={};a.id=n.id,_.isNil(n.path)||(a.path=n.path);var i=document.createElement(n.element);i.setAttribute("preload","none"),i.setAttribute("controls","true"),"audio"===n.element&&i.setAttribute("style","width: 265px;"),"video"===n.element&&i.setAttribute("style","max-width: 500px;"),i.setAttribute("title",n.title),i.setAttribute("src"," "),i.onplay=function(e){t||(t=!0,e.preventDefault(),s[n.model].download(a).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type});i.setAttribute("type",e.type),i.setAttribute("src",URL.createObjectURL(t)),i.play()}).catch(function(e){console.error(e)}))},e.append(i)}}}e.$inject=["api"],angular.module("app.core").directive("msDialogRecording",e)}(),function(){"use strict";function e(i){return{restrict:"A",link:function(t,a){a.bind("click",function(e){var n=i('<div layout="row" class="spinner-overlay" layout-sm="column" layout-align="center center" aria-label="wait"><md-progress-circular md-mode="indeterminate"></md-progress-circular></div>')(t);a.closest("md-dialog").prepend(n)})}}}e.$inject=["$compile"],angular.module("app.core").directive("msDialogSpinner",e)}(),function(){"use strict";function e(){var o=this;function a(e,n,t,a){var i=[];if(0<=t)i.push(e[t]),n.push(e[t]),e.splice(t,1);else{for(var s=0;s<e.length;s++)void 0!==e[s].isValid&&e[s].isValid&&n.push(e[s]);for(s=e.length-1;0<=s;s--)e[s].isValid&&e.splice(s,1);i=n}o.options.transferCallback&&o.options.transferCallback(i,a)}o.canTransfer=function(e,n,t){if(void 0!==e.isValid&&e.isValid)return t?a(n.selectedItems,n.items,n.selectedItems.indexOf(e),t):a(n.items,n.selectedItems,n.items.indexOf(e),t)},o.transfer=a,o.getLine=function(e,n){var t="";if(_.isNil(n))return t;{if(_.isArray(n)){for(var a=0;a<n.length;a++)t+=" "+(e[n[a]]?e[n[a]]:"");return t}return e[n]?e[n]:""}}}angular.module("app.core").directive("msDualMultiselect",function(){return{restrict:"E",scope:{options:"=",readOnly:"=",addDisabled:"<"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-dual-multiselect/ms-dual-multiselect.html"}})}(),function(){"use strict";function e(a){return{restrict:"E",replace:!0,scope:{onReply:"&",ngModel:"=",ctrlMethods:"=",pickerPosition:"=",search:"=",recentEmojis:"=",placeholder:"="},template:'<textarea class="emojionearea"></textarea>',link:function(t,e){var n=e.emojioneArea({pickerPosition:t.pickerPosition,search:t.search,recentEmojis:t.recentEmojis,placeholder:a.instant(t.placeholder||"Type a message"),attributes:{spellcheck:!0},events:{keyup:function(e,n){t.ngModel=this.getText(),t.onReply({event:n,body:this.getText()})},emojibtn_click:function(){t.ngModel=this.getText()}}});t.ngModel&&n[0].emojioneArea.setText(t.ngModel),t.internalControl=t.ctrlMethods||{},t.internalControl.setText=function(e){n[0].emojioneArea.setText(e)},t.internalControl.getText=function(){return n[0].emojioneArea.getText()},t.$watch("ngModel",function(e){e||n[0].emojioneArea.setText("")})}}}e.$inject=["$translate"],angular.module("app.core").directive("msEmojiArea",e)}(),function(){"use strict";angular.module("app.core").directive("msFontFamily",function(){return{restrict:"E",scope:{ngModel:"="},controller:["$scope",function(e){e.fonts=[{option:"Arial",value:"Arial,Helvetica,sans-serif"},{option:"Century Gothic",value:"Century Gothic,Futura,Didact Gothic,san-serif"},{option:"Calibri",value:"Calibri, Verdana, Geneva, sans-serif"},{option:"Comic Sans MS",value:"Comic Sans MS,cursive"},{option:"Courier New",value:"Courier New,Courier,monospace"},{option:"Georgia",value:"Georgia,serif"},{option:"Lucida Sans Unicode",value:"Lucida Sans Unicode,Lucida Grande,sans-serif"},{option:"Tahoma",value:"Tahoma,Geneva,sans-serif"},{option:"Times New Roman",value:"Times New Roman,Times,serif"},{option:"Trebuchet MS",value:"Trebuchet MS,Helvetica,sans-serif"},{option:"Verdana",value:"Verdana,Geneva,sans-serif"}]}],templateUrl:"app/core/directives/ms-font-family/ms-font-family.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsFormWizardController",function(){var n=this;function e(){return n.forms.length}function t(){return 0===n.selectedIndex}function a(){return n.selectedIndex===e()-1}n.forms=[],n.selectedIndex=0,n.registerForm=function(e){n.forms.push(e)},n.previousStep=function(){if(t())return;n.selectedIndex--},n.nextStep=function(){if(a())return;n.selectedIndex++},n.firstStep=function(){n.selectedIndex=0},n.lastStep=function(){n.selectedIndex=e()-1},n.totalSteps=e,n.isFirstStep=t,n.isLastStep=a,n.currentStepInvalid=function(){return angular.isDefined(n.forms[n.selectedIndex])&&n.forms[n.selectedIndex].$invalid},n.previousStepInvalid=function(){return 0<n.selectedIndex&&angular.isDefined(n.forms[n.selectedIndex-1])&&n.forms[n.selectedIndex-1].$invalid},n.formsIncomplete=function(){for(var e=0;e<n.forms.length;e++)if(n.forms[e].$invalid)return!0;return!1},n.resetForm=function(){for(var e=n.selectedIndex=0;e<n.forms.length;e++)n.forms[e].$setPristine(),n.forms[e].$setUntouched()}}).directive("msFormWizard",function(){return{restrict:"E",scope:!0,controller:"MsFormWizardController as msWizard",compile:function(e){return e.addClass("ms-form-wizard"),function(){}}}}).directive("msFormWizardForm",function(){return{restrict:"A",require:["form","^msFormWizard"],compile:function(e){return e.addClass("ms-form-wizard-form"),function(e,n,t,a){var i=a[0],s=a[1];s.registerForm(i)}}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{onClose:"&"},transclude:!0,templateUrl:"app/core/directives/ms-info-bar/ms-info-bar.html",link:function(e,n){var t=i.find("ms-info-bar-active"),a="ms-info-bar-active";t.addClass(a),e.removeInfoBar=function(){t.removeClass(a),n.remove(),e.onClose&&e.onClose(),e.$destroy()}}}}e.$inject=["$document"],angular.module("app.core").directive("msInfoBar",e)}(),function(){"use strict";function e(r,a,l,e){var d=this,n={columnCount:5,respectItemOrder:!1,reLayoutDebounce:400,responsive:{md:3,sm:2,xs:1}},t=!0;function i(){t&&e.cancel(t),t=e(function(){!function(){d.containerPos=d.container[0].getBoundingClientRect(),function(){d.columnCount=d.options.columnCount,l("gt-md")?d.columnCount=d.options.columnCount:l("md")?d.columnCount=d.columnCount>d.options.responsive.md?d.options.responsive.md:d.columnCount:l("sm")?d.columnCount=d.columnCount>d.options.responsive.sm?d.options.responsive.sm:d.columnCount:d.columnCount=d.options.responsive.xs;d.columnWidth=d.containerPos.width/d.columnCount}(),r.$broadcast("msMasonry:relayoutStarted"),d.items=d.container.find("ms-masonry-item");for(var e=Array.apply(null,new Array(d.columnCount)).map(function(){return 0}),n=0;n<d.items.length;n++){var t,a,i,s,o=d.items[n];(o=angular.element(o)).scope()&&o.scope().$broadcast("msMasonryItem:startReLayout"),o.css({width:d.columnWidth}),d.options.respectItemOrder?(i=n%d.columnCount,s=e[i]):(s=Math.min.apply(Math,e),i=e.indexOf(s)),e[i]=s+o[0].getBoundingClientRect().height,t=Math.round(i*d.columnWidth),a=s,o.css({transform:"translate3d("+t+"px,"+a+"px,0px)"}),o.addClass("placed"),o.scope()&&o.scope().$broadcast("msMasonryItem:finishReLayout")}}(),r.$broadcast("msMasonry:relayoutFinished")},d.options.reLayoutDebounce)}d.options=null,d.container=[],d.containerPos="",d.columnWidth="",d.items=[],d.reLayout=i,d.initialize=function(){d.options=d.options?angular.extend(n,d.options):n,r.$watch(function(){return d.container.width()},function(e,n){e!==n&&i()})},d.waitImagesLoaded=function(e,n){if("undefined"!=typeof imagesLoaded){var t=a.imagesLoaded(e);t.on("done",function(){n()})}else n()},r.$on("msMasonry:relayout",function(){i()})}function n(o){return{restrict:"AEC",controller:"msMasonryController",compile:function(i,s){return{pre:function(e,n,t,a){a.options=angular.fromJson(s.options||"{}"),a.container=i},post:function(e,n,t,a){o(function(){a.initialize()})}}}}}e.$inject=["$scope","$window","$mdMedia","$timeout"],n.$inject=["$timeout"],angular.module("app.core").controller("msMasonryController",e).directive("msMasonry",n).directive("msMasonryItem",function(){return{restrict:"AEC",require:"^msMasonry",priority:1,link:function(e,n,t,a){a.waitImagesLoaded(n,function(){a.reLayout()}),e.$on("msMasonryItem:finishReLayout",function(){e.$watch(function(){return n.height()},function(e,n){e!==n&&a.reLayout()})}),n.on("$destroy",function(){a.reLayout()})}}})}(),function(){"use strict";function e(t,e,a,i){var s=this;function o(e,n){s.selectedPalette=e,s.selectedHues=n}function r(){o(!(s.selectedColor={palette:"",hue:"",class:""}),!1),d()}function l(e,n){s.selectedColor={palette:e,hue:n,class:"md-"+e+"-"+n+"-bg",bgColorValue:i.rgba(s.palettes[e][n].value),fgColorValue:i.rgba(s.palettes[e][n].contrast)},"obj"!==s.msModelType||angular.equals(s.selectedColor,s.modelCtrl.$viewValue)||d(),o(e,s.palettes[e]),t.$selectedColor=s.selectedColor}function d(){"class"===s.msModelType?s.modelCtrl.$setViewValue(s.selectedColor.class):"obj"===s.msModelType&&s.modelCtrl.$setViewValue(s.selectedColor)}s.palettes=e,s.selectedPalette=!1,s.selectedHues=!1,t.$selectedColor={},s.activateHueSelection=o,s.selectColor=function(e,n){l(e,n),d(),a.hide()},s.removeColor=r,t.$watch("ngModel",function(){if(!s.modelCtrl.$viewValue||""===s.modelCtrl.$viewValue)return void r();var e,n;if("class"===s.msModelType){var t=s.modelCtrl.$viewValue.split("-");n=5<=t.length?(e=t[1]+"-"+t[2],t[3]):(e=t[1],t[2])}else"obj"===s.msModelType&&(e=s.modelCtrl.$viewValue.palette,n=s.modelCtrl.$viewValue.hue||500);l(e,n)})}e.$inject=["$scope","$mdColorPalette","$mdMenu","motionGenerator"],angular.module("app.core").controller("msMaterialColorPickerController",e).directive("msMaterialColorPicker",function(){return{require:["msMaterialColorPicker","ngModel"],restrict:"E",scope:{ngModel:"=",msModelType:"@?"},controller:"msMaterialColorPickerController as vm",transclude:!0,templateUrl:"app/core/directives/ms-material-color-picker/ms-material-color-picker.html",link:function(e,n,t,a,i){var s=a[0];s.modelCtrl=a[1],s.msModelType=e.msModelType||"class",i(e,function(e){(e=e.filter(function(e,n){return 1===n.nodeType})).length&&n.find("ms-color-picker-button").replaceWith(e)})}}})}(),function(){"use strict";function e(p,g,v){return{restrict:"A",link:function(e,n,t){var a="true"===t.msNavIsFolded,i=!1,s=angular.element(p[0].body),o=angular.element('<div id="ms-nav-fold-open-overlay"></div>'),r=angular.element('<div id="ms-nav-fold-close-overlay"></div>'),l=n.parent();function d(){s.addClass("ms-nav-folded"),g.$broadcast("msNav::forceCollapse"),n.scrollTop(0),l.append(o),o.on("mouseenter touchstart",function(e){c(e),i=!0})}function c(e){angular.isDefined(e)&&e.preventDefault(),s.addClass("ms-nav-folded-open"),g.$broadcast("msNav::expandMatchingToggles"),l.find(o).remove(),l.parent().append(r),r.on("mouseenter touchstart",function(e){m(e),i=!1})}function m(e){angular.isDefined(e)&&e.preventDefault(),g.$broadcast("msNav::forceCollapse"),n.scrollTop(0),s.removeClass("ms-nav-folded-open"),l.parent().find(r).remove(),l.append(o),o.on("mouseenter touchstart",function(e){c(e),i=!0})}function u(){s.removeClass("ms-nav-folded ms-nav-folded-open"),g.$broadcast("msNav::expandMatchingToggles"),n.off("mouseenter mouseleave")}v.setFoldable(e,n,a),a?d():u(),e.toggleFold=function(){(a=!a)?d():u()},e.openFolded=c,e.closeFolded=m,e.isNavFoldedOpen=function(){return i},e.$on("$destroy",function(){o.off("mouseenter touchstart"),r.off("mouseenter touchstart"),n.off("mouseenter mouseleave")})}}}function n(t,a,i){return{restrict:"E",scope:{},controller:"MsNavController",compile:function(e){return e.addClass("ms-nav"),function(e){t.$broadcast("msNav::expandMatchingToggles");var n=t.$on("$stateChangeSuccess",function(){t.$broadcast("msNav::expandMatchingToggles"),a.when("navigation").then(function(e){e.close(),i.isNavFoldedOpen()&&i.closeFolded()})});e.$on("$destroy",function(){n()})}}}}function t(m,u,p,g){return{restrict:"A",require:"^msNav",scope:!0,compile:function(e,n){return e.addClass("ms-nav-toggle"),angular.isUndefined(n.collapsed)&&(n.collapsed=!0),e.attr("collapsed",n.collapsed),function(a,i,e,t){var s={expanded:"expanded",expandAnimation:"expand-animation",collapseAnimation:"collapse-animation"},n=i.find("a"),o=[],r=/\(.*\)/g;function l(){return"true"===i.attr("collapsed")}function d(){var e=u.defer();if(!l())return e.reject({error:!0}),e.promise;i.attr("collapsed",!1);var n=angular.element(i.find("ms-nav-toggle-items")[0]);n.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var t=n[0].offsetHeight;return n.css({position:"",visibility:"",display:"",height:""}),a.$evalAsync(function(){p.animate(n,{display:"block",height:"0px"},{height:t+"px"},s.expandAnimation).then(function(){n.addClass(s.expanded),n.css({height:""}),e.resolve({success:!0})})}),e.promise}function c(){var e=u.defer();if(l())return e.reject({error:!0}),e.promise;i.attr("collapsed",!0);var n=angular.element(i.find("ms-nav-toggle-items")[0]),t=n[0].offsetHeight;return a.$evalAsync(function(){p.animate(n,{height:t+"px"},{height:"0px"},s.collapseAnimation).then(function(){n.removeClass(s.expanded),n.css({display:"",height:""}),e.resolve({success:!0})})}),e.promise}angular.forEach(n,function(e){var n=angular.element(e).attr("ui-sref");angular.isUndefined(n)||(n=n.replace(r,""),o.push(n))}),t.setToggleItem(i,a),i.children(".ms-nav-button").on("click",function(){if(t.isDisabled())return;t.disable(),l()?(t.clearLockedItems(),a.$emit("msNav::pushToLockedList"),m.$broadcast("msNav::collapse"),d().then(function(){t.enable()})):a.$broadcast("msNav::forceCollapse")}),a.$on("$destroy",function(){i.children(".ms-nav-button").off("click")}),a.$on("msNav::collapse",function(){var e=t.getLockedItems(),n=!1;angular.forEach(e,function(e){angular.equals(e.scope,a)&&(n=!0)}),n||c().then(function(){t.enable()})}),a.$on("msNav::forceCollapse",function(){c().then(function(){t.enable()})}),a.$on("msNav::expandMatchingToggles",function(){var n=g.current.name,t=!1;angular.forEach(o,function(e){n===e&&(t=!0)}),t?d():c()}),a.$on("msNav::pushToLockedList",function(){t.setLockedItem(i,a)})}}}}e.$inject=["$document","$rootScope","msNavFoldService"],n.$inject=["$rootScope","$mdComponentRegistry","msNavFoldService"],t.$inject=["$rootScope","$q","$animate","$state"],angular.module("app.core").factory("msNavFoldService",function(){var t={};return{setFoldable:function(e,n){t={scope:e,element:n}},isNavFoldedOpen:function(){return t.scope.isNavFoldedOpen()},toggleFold:function(){t.scope.toggleFold()},openFolded:function(){t.scope.openFolded()},closeFolded:function(){t.scope.closeFolded()}}}).directive("msNavIsFolded",e).controller("MsNavController",function(){var e=this,n=!1,t=[],a=[];e.isDisabled=function(){return n},e.enable=function(){n=!1},e.disable=function(){n=!0},e.setToggleItem=function(e,n){t.push({element:e,scope:n})},e.getLockedItems=function(){return a},e.setLockedItem=function(e,n){a.push({element:e,scope:n})},e.clearLockedItems=function(){a=[]}}).directive("msNav",n).directive("msNavTitle",function(){return{restrict:"A",compile:function(e){return e.addClass("ms-nav-title"),function(){}}}}).directive("msNavButton",function(){return{restrict:"AE",compile:function(e){return e.addClass("ms-nav-button"),function(){}}}}).directive("msNavToggle",t)}(),function(){"use strict";function e(e,n){e.root?this.navigation=n.getNavigation(e.root):this.navigation=n.getNavigation(),this.toggleHorizontalMobileMenu=function(){angular.element("body").toggleClass("ms-navigation-horizontal-mobile-menu-active")},n.sort()}function n(c,m,u,p){return{restrict:"E",scope:{folded:"=",root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/vertical.html",transclude:!0,compile:function(e){return e.addClass("ms-navigation"),function(e,n){var t=angular.element("body"),a=angular.element('<div id="ms-navigation-fold-expander"></div>'),i=angular.element('<div id="ms-navigation-fold-collapser"></div>'),s=u("navigation");function o(e){if(p.setFolded(e),e)c.$broadcast("msNavigation::collapse"),t.addClass("ms-navigation-folded"),r();else{var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),t.removeClass("ms-navigation-folded ms-navigation-folded-open"),i.remove()}}function r(){n.parent().append(a),m(function(){a.on("mouseenter touchstart",l)})}function l(e){e&&e.preventDefault(),p.setFoldedOpen(!0);var n=p.getActiveItem();n&&n.scope.$emit("msNavigation::stateMatched"),t.addClass("ms-navigation-folded-open"),a.remove(),t.find("#main").append(i),i.on("mouseenter touchstart",d)}function d(e){e&&e.preventDefault(),p.setFoldedOpen(!1),c.$broadcast("msNavigation::collapse"),t.removeClass("ms-navigation-folded-open"),i.remove(),r()}p.setNavigationScope(e),function(){null===p.getFolded()&&p.setFolded(e.folded);p.getFolded()&&(m(function(){c.$broadcast("msNavigation::collapse")}),t.addClass("ms-navigation-folded"),r())}(),e.$watch(function(){return s.isLockedOpen()},function(e,n){if(!angular.isUndefined(e)&&!angular.equals(e,n)&&p.getFolded())if(e)c.$broadcast("msNavigation::collapse");else{var t=p.getActiveItem();t&&t.scope.$emit("msNavigation::stateMatched")}}),e.$watch("folded",function(e,n){angular.isUndefined(e)||angular.equals(e,n)||o(e)}),e.toggleFolded=function(){o(!p.getFolded())},e.$on("$stateChangeStart",function(){s.close()}),e.$on("$destroy",function(){i.off("mouseenter touchstart"),a.off("mouseenter touchstart")})}}}}function t(t,e,a,i,n,s){var o=this;o.element=e,o.node=t.node,o.hasChildren=void 0,o.collapsed=void 0,o.collapsable=void 0,o.group=void 0,o.animateHeightClass="animate-height",o.toggleCollapsed=function(){o.collapsed?o.expand():o.collapse()},o.collapse=function(){var e=o.element.children("ul"),n=e[0].offsetHeight;t.$evalAsync(function(){o.collapsed=!0,o.element.addClass("collapsing"),i.animate(e,{display:"block",height:n+"px"},{height:"0px"},o.animateHeightClass).then(function(){e.css({display:"",height:""}),o.element.removeClass("collapsing")}),t.$broadcast("msNavigation::collapse")})},o.expand=function(){var e=o.element.children("ul");e.css({position:"absolute",visibility:"hidden",display:"block",height:"auto"});var n=e[0].offsetHeight;e.css({position:"",visibility:"",display:"",height:""}),t.$evalAsync(function(){o.collapsed=!1,o.element.addClass("expanding"),i.animate(e,{display:"block",height:"0px"},{height:n+"px"},o.animateHeightClass).then(function(){e.css({height:""}),o.element.removeClass("expanding")}),a.$broadcast("msNavigation::collapse",o.node._path)})},o.getClass=function(){return o.node.class},o.isHidden=function(){if(angular.isDefined(o.node.hidden)&&angular.isFunction(o.node.hidden))return o.node.hidden();return!1},function(){o.hasChildren=0<o.node.children.length,o.group=!(!angular.isDefined(o.node.group)||!0!==o.node.group),!o.hasChildren||o.group?o.collapsable=!1:o.collapsable=!(!angular.isUndefined(o.node.collapsable)&&"boolean"==typeof o.node.collapsable&&!0!==o.node.collapsable);o.collapsable?o.collapsed=!(!angular.isUndefined(o.node.collapsed)&&"boolean"==typeof o.node.collapsed&&!0!==o.node.collapsed):o.collapsed=!1;if(o.node.state===n.current.name||n.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;t.$emit("msNavigation::stateMatched"),s.setActiveItem(o.node,t)}t.$on("msNavigation::stateMatched",function(){o.collapsable&&o.collapsed&&t.$evalAsync(function(){o.collapsed=!1})}),t.$on("msNavigation::collapse",function(e,n){if(!o.collapsed&&o.collapsable)if(angular.isUndefined(n))o.collapse();else{var t=n.split("."),a=[],i=s.getActiveItem();if(i&&(a=i.node._path.split(".")),-1<t.indexOf(o.node._id))return;if(-1<a.indexOf(o.node._id))return;o.collapse()}}),t.$on("$stateChangeSuccess",function(){if(o.node.state===n.current.name){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;s.setActiveItem(o.node,t),a.$broadcast("msNavigation::collapse",o.node._path)}if(n.includes(o.node.state)){if(angular.isDefined(o.node.stateParams)&&angular.isDefined(n.params)&&!angular.equals(o.node.stateParams,n.params))return;t.$emit("msNavigation::stateMatched")}})}()}function a(n){return{restrict:"E",scope:{root:"@"},controller:"MsNavigationController as vm",templateUrl:"app/core/directives/ms-navigation/templates/horizontal.html",transclude:!0,compile:function(e){return e.addClass("ms-navigation-horizontal"),function(e){n.setNavigationScope(e)}}}}function i(t,e,n,a,i){var s=this;s.element=e,s.node=t.node,s.hasChildren=void 0,s.group=void 0,s.getClass=function(){return s.node.class},function(){if(s.isActive=!1,s.hasChildren=0<s.node.children.length,s.group=!(!angular.isDefined(s.node.group)||!0!==s.node.group),s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;t.$emit("msNavigation::stateMatched"),i.setActiveItem(s.node,t)}t.$on("msNavigation::stateMatched",function(){s.hasChildren&&t.$evalAsync(function(){s.isActive=!0})}),t.$on("msNavigation::clearActive",function(){if(s.hasChildren){var e=[],n=i.getActiveItem();n&&(e=n.node._path.split(".")),-1<e.indexOf(s.node._id)?t.$evalAsync(function(){s.isActive=!0}):t.$evalAsync(function(){s.isActive=!1})}}),t.$on("$stateChangeSuccess",function(){if(s.node.state===a.current.name||a.includes(s.node.state)){if(angular.isDefined(s.node.stateParams)&&angular.isDefined(a.params)&&!angular.equals(s.node.stateParams,a.params))return;i.setActiveItem(s.node,t),n.$broadcast("msNavigation::clearActive")}})}()}function s(i){return{restrict:"A",require:"^msNavigationHorizontalNode",compile:function(e){return e.addClass("ms-navigation-horizontal-item"),function(e,n,t,a){n.on("click",function(){if(!a.hasChildren||i("gt-md"))return;n.toggleClass("expanded")}),e.$on("$destroy",function(){n.off("click")})}}}}e.$inject=["$scope","msNavigationService"],n.$inject=["$rootScope","$timeout","$mdSidenav","msNavigationService"],t.$inject=["$scope","$element","$rootScope","$animate","$state","msNavigationService"],a.$inject=["msNavigationService"],i.$inject=["$scope","$element","$rootScope","$state","msNavigationService"],s.$inject=["$mdMedia"],angular.module("app.core").provider("msNavigationService",function(){var r=angular.injector(["ng"]).get("$log"),l=[];function d(e,n){if(angular.isString(e)){for(var t=e.split("."),a=t[t.length-1],i=function(e){var n=l;if(1===e.length)return n;e.pop();for(var t=0;t<e.length;t++){for(var a=e[t],i=!0,s=0;s<n.length;s++)if(n[s]._id===a){n=n[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};n.push(o),n=o.children}}return n}(t),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,n),s.uisref=u(s)):(n.children=[],!angular.isUndefined(n.weight)&&angular.isNumber(n.weight)||(n.weight=1),n._id=a,n._path=e,n.uisref=u(n),i.push(n))}else r.error("path must be a string (eg. `dashboard.project`)")}function c(e){if(angular.isString(e)){for(var n=l,t=e.split("."),a=0;a<t.length;a++)for(var i=t[a],s=0;s<n.length;s++)if(n[s]._id===i){if(n[s]._path===e)return n.splice(s,1),!0;n=n[s].children;break}return!1}r.error("path must be a string (eg. `dashboard.project`)")}function m(e){e||(e=l).sort(a);for(var n=0;n<e.length;n++){var t=e[n].children;1<t.length&&t.sort(a),0<t.length&&m(t)}}function a(e,n){return parseInt(e.weight)-parseInt(n.weight)}function u(e){var n="";return angular.isDefined(e.state)&&(n=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(n=n+"("+angular.toJson(e.stateParams)+")")),n}this.saveItem=d,this.deleteItem=c,this.sortByWeight=m,this.$get=function(){var t=null,n=null,a=null,i=null,e={saveItem:d,deleteItem:c,sort:m,clearNavigation:function(){l=[],n&&(n.vm.navigation=l)},setActiveItem:function(e,n){t={node:e,scope:n}},getActiveItem:function(){return t},getNavigation:s,getFlatNavigation:o,setNavigationScope:function(e){n=e},setFolded:function(e){a=e},getFolded:function(){return a},setFoldedOpen:function(e){i=e},getFoldedOpen:function(){return i},toggleFolded:function(){n.toggleFolded()},getSectionId:function(n,t){var e=o(),a=_.find(e,function(e){return t?e.route===n&&e.title.toLowerCase()===t.toLowerCase():e.route===n});return a?a.id:0}};return e;function s(e){if(e){for(var n=0;n<l.length;n++)if(l[n]._id===e)return[l[n]];return null}return l}function o(e){var n=s(e);return function e(n){var t=[];for(var a=0;a<n.length;a++){var i=angular.copy(n[a]);i.children=[],t.push(i),0<n[a].children.length&&(t=t.concat(e(n[a].children)))}return t}(n)}}}).controller("MsNavigationController",e).directive("msNavigation",n).controller("MsNavigationNodeController",t).directive("msNavigationNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationNode"},controller:"MsNavigationNodeController as vm",compile:function(e){return e.addClass("ms-navigation-node"),function(e,n,t,a){n.addClass(a.getClass()),a.group&&n.addClass("group")}}}}).directive("msNavigationItem",function(){return{restrict:"A",require:"^msNavigationNode",compile:function(e){return e.addClass("ms-navigation-item"),function(e,n,t,a){a.collapsable&&n.on("click",a.toggleCollapsed),e.$on("$destroy",function(){n.off("click")})}}}}).directive("msNavigationHorizontal",a).controller("MsNavigationHorizontalNodeController",i).directive("msNavigationHorizontalNode",function(){return{restrict:"A",bindToController:{node:"=msNavigationHorizontalNode"},controller:"MsNavigationHorizontalNodeController as vm",compile:function(e){return e.addClass("ms-navigation-horizontal-node"),function(e,n,t,a){n.addClass(a.getClass()),a.group&&n.addClass("group")}}}}).directive("msNavigationHorizontalItem",s)}(),function(){"use strict";function e(p,t,g,e,a,i,n,u,s,o,v,h,f,b,r,A,l){var E=this,d=["ringingId","speakerId","microphoneId","ringingVolume","speakerVolume","microphoneVolume","ringingMute","speakerMute","microphoneMute"],c=JSON.parse(n.localStorage.getItem("motion2.user:"+E.conf.id))||{webrtc:{ringingVolume:.5,speakerVolume:.5,microphoneVolume:1,ringingMute:!1,speakerMute:!1,microphoneMute:!1}};e(function(){},999);var y=l.getLogger("jssip","ms-phonebar");function m(l){var d,c,m;return E.initDeviceInProgress=!0,navigator.mediaDevices.getUserMedia({audio:!0}).then(function(e){return E.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/silence.ogg"),E.soundPlayer.play().catch(function(e){y.error(e.message)}),e.getTracks().forEach(function(e){e.stop()}),navigator.mediaDevices.enumerateDevices()}).then(function(e){var n=_.filter(e,function(e){return"audioinput"===e.kind&&"default"!==e.deviceId&&"communications"!==e.deviceId});if(0<n.length){var t=_.find(e,function(e){return"default"===e.deviceId&&"audioinput"===e.kind});if(m=_.find(n,function(e){return e.groupId===t.groupId}),E.conf.microphoneId&&!l){var a=_.find(n,function(e){return e.deviceId===E.conf.microphoneId});a&&(m=a)}E.conf.microphoneId=m.deviceId}else v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_MICROPHONE_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"});E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0,x("microphone",!1);var i=_.filter(e,function(e){return"audiooutput"===e.kind&&"default"!==e.deviceId&&"communications"!==e.deviceId});if(0<i.length){var s=_.find(e,function(e){return"default"===e.deviceId&&"audiooutput"===e.kind});if(c=d=_.find(i,function(e){return e.groupId===s.groupId}),E.conf.speakerId&&!l){var o=_.find(i,function(e){return e.deviceId===E.conf.speakerId});o&&(c=o)}if(E.conf.speakerId=c.deviceId,E.conf.ringingId&&!l){var r=_.find(i,function(e){return e.deviceId===E.conf.ringingId});r&&(d=r)}E.conf.ringingId=d.deviceId}else v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_SPEAKER_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"});return x("speaker",!1)}).then(function(){return x("ringing",!1)}).then(function(){if(jabra)return jabra.init().then(function(){return E.isJabraInitialized=!0,jabra.getInstallInfo()}).then(function(){return jabra.getUserDeviceMediaExt()}).then(function(e){m&&c&&d&&e&&_.includes([m.groupId,c.groupId,d.groupId],e.deviceInfo.browserGroupId)&&(y.info("Jabra library correctly initialized and device correctly installed"),E.isJabraEnabled=!0,jabra.onHook(),jabra.addEventListener("acceptcall",function(e){var n=_.last(E.sessions);n?"incoming"===n.direction&&n.isInProgress()?E.answer(n):y.error("Unable to find a valid call to answer",e):y.error("Unable to answer the call",e)}.bind(this)),jabra.addEventListener("mute",function(){x("microphone",E.conf.microphoneMute=!0)}.bind(this)),jabra.addEventListener("unmute",function(){E.conf.microphoneMute=!1,x("microphone",!0)}.bind(this)),jabra.addEventListener("flash",function(){E.jabraSession.localHold?E.unhold(E.jabraSession):E.hold(E.jabraSession)}.bind(this)),jabra.addEventListener("endcall",function(){o(function(e){for(var n=null,t=0;t<E.sessions.length;t++)_.has(E.sessions[t],"localHold")&&E.sessions[t].localHold||(n=E.sessions[t]);e(n)}).then(function(e){null!==e&&E.terminate(e)})}.bind(this)))}).catch(function(e){y.warn("Error initializing Jabra integration",e)})}).catch(function(e){y.error("Unable to init media devices",e),"NotFoundError"===e.name&&v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_AUDIO_DEVICES_NOT_AVAILABLE"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}).finally(function(){E.initDeviceInProgress=!1,S(),DetectRTC.load(function(){E.conf.hasMicrophone=DetectRTC.hasMicrophone,E.conf.hasSpeakers="Chrome"!==DetectRTC.browser.name&&"Edge"!==DetectRTC.browser.name&&"Opera"!==DetectRTC.browser.name||DetectRTC.hasSpeakers,E.conf.isWebRTCSupported=DetectRTC.isWebRTCSupported,E.conf.osName=DetectRTC.osName,E.conf.osVersion=DetectRTC.osVersion,E.conf.browserName=DetectRTC.browser.name,E.conf.browserVersion=DetectRTC.browser.version,E.conf.license&&E.conf.isWebRTCSupported&&E.conf.hasMicrophone&&E.conf.hasSpeakers&&"https"===E.conf.protocol&&("chrome"===E.conf.browserName.toLowerCase()||"opera"===E.conf.browserName.toLowerCase()||"safari"===E.conf.browserName.toLowerCase())?E.register||E.ua.start():E.conf.license||v.warning({title:u.instant("TOOLBAR.WARNING"),msg:u.instant("TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"),clickToClose:!0,showClose:!0,shake:!1,timeout:!1,position:"bottom-right"})}.bind(this))})}function S(){c.webrtc=_.pick(E.conf,d),n.localStorage.setItem("motion2.user:"+E.conf.id,JSON.stringify(c))}function T(e,n,t){y.debug("addCall -> target, inbound, fullname",e,n,t),E.calls.unshift({target:e,fullname:t||e,inbound:n,time:moment().format("HH:mm")}),50<E.calls.length&&E.calls.pop()}function I(e){y.debug("answer -> session",e._request),e.notification&&(e.notification.close(),e.notification=null),E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0,e.answer(E.sessionConf),E.isJabraEnabled&&(jabra.offHook(),E.jabraSession=e)}function O(e,n){y.debug("terminate -> session",e._request),e.notification&&(e.notification.close(),e.notification=null);var t={};if(n?t.status_code=n:e.isEstablished()||(t.status_code=603),e.terminate(t),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var a=_.last(E.sessions);a.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=a):jabra.offHook()}}function C(t){return y.debug("getVoiceChannels -> session",t._request),h.rpc.getVoiceChannels().$promise.then(function(e){var n=_.find(e.rows,function(e){return e.sipcalllinkedid===t.call_id?e:e.sipcalluniqueid===t.call_id?e:null});n&&(t.monitor=n.monitor,t.uniqueid=n.uniqueid,t.monitors=n.monitors)})}function w(e){y.debug("onAddstream -> data",e),this.remotePlayer.srcObject=e.stream,this.remotePlayer.play()}function R(){E.canGoInConference=!1,E.isInConference=!1,E.currentconferenceSessions=[]}function x(e,n){switch(e){case"ringing":E.soundPlayer.muted=E.conf.ringingMute,E.conf.ringingId&&E.soundPlayer.setSinkId(E.conf.ringingId).then(function(){E.soundPlayer.volume=E.conf.ringingVolume}).then(function(){n&&S()}).catch(function(e){y.info(e.message,E.conf.ringingId)});break;case"speaker":E.remotePlayer.muted=E.conf.speakerMute,E.conf.speakerId&&E.remotePlayer.setSinkId(E.conf.speakerId).then(function(){E.remotePlayer.volume=E.conf.speakerVolume}).then(function(){n&&S()}).catch(function(e){y.info(e.message,E.conf.speakerId)});break;case"microphone":for(var t=0;t<E.sessions.length;t+=1)E.conf.microphoneMute?E.sessions[t].mute():E.sessions[t].unmute();jabra&&E.isJabraEnabled&&(E.conf.microphoneMute?jabra.mute():jabra.unmute()),n&&S();break;default:y.info("unknown device")}}function N(){E.target="",document.getElementById("ms-target").blur(),document.getElementById("ms-target").value="",p.$broadcast("angucomplete-alt:clearInput","ms-target-wrap")}function D(n){return h.user.getVoicePrefixes({id:E.conf.id}).$promise.then(function(e){if(e.count)return a.show({controller:"PrefixDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/prefix/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{prefixes:e,required:E.conf.phoneBarPrefixRequired}})}).then(function(e){if(E.conf.phoneBarPrefixRequired){if(e&&-1!==e)return e+n}else{if(e&&-1!==e)return e+n;if(!e)return n}})}function P(){if(E.isInConference){var e=E.sessions[0].connection.getReceivers()[0],n=E.sessions[1].connection.getReceivers()[0],t=new MediaStream;t.addTrack(e.track),t.addTrack(n.track);var a=document.getElementById("remote-audio");a.srcObject=t;var i=a.play();void 0!==i&&i.then(function(){}).catch(function(e){y.error(e)})}}function L(e,n,t,a){return y.debug("onReferCallback -> session, textContent, position, delay",e._request,n,t,a),function(){i.show(i.simple().textContent(n).position(t).hideDelay(a)),O(e)}}function k(n){return y.debug("findSessionBySessionId -> sessionId, vm_pb.sessions",n,E.sessions),_.find(E.sessions,function(e){return e.call_id==n})}function M(e,n){return y.debug("callCallback -> url, params",e,n),s({url:e,method:"GET",params:n})}E.currentUser=b.getCurrentUser(),E.direction="right",E.selectedMode="md-scale",E.target="",E.showDialpad=!1,E.soundPlayer=document.getElementById(E.conf.soundPlayerId),E.remotePlayer=document.getElementById(E.conf.remotePlayerId),E.soundPlayer.volume=1,E.sessionConf={mediaConstraints:{audio:!0,video:!1},pcConfig:{iceServers:[]}},E.sessions=[],E.calls=[],E.callbackQueue=[],E.canGoInConference=!1,E.isInConference=!1,E.currentConferenceSessions=[],E.ua=new JsSIP.UA({sockets:[new JsSIP.WebSocketInterface("wss://"+E.conf.host+":"+E.conf.wssPort+"/ws")],uri:new JsSIP.URI("sip",E.conf.name,E.conf.host,5060,null,null).toString(),authorization_user:E.conf.name,ha1:E.conf.ha1,realm:E.conf.realm,user_agent:E.conf.ua,session_timers_refresh_method:"invite",register_expires:E.conf.phoneBarExpires||60,register:!0}),E.conf=_.merge(c.webrtc,E.conf),E.initDeviceInProgress=!1,E.isJabraEnabled=!1,E.isJabraInitialized=!1,E.jabraSession=null,E.jabraClicked=!1,E.buttonClicked=!1,E.originateInProgress=!1,t.bind("keyup",function(e){switch(e.keyCode){case 27:g(function(){E.showDialpad=!1})}}),E.$onInit=function(){m(!1),navigator.mediaDevices.ondevicechange=function(){E.initDeviceInProgress||(E.initDeviceInProgress=!0,jabra&&E.isJabraInitialized?jabra.shutdown().then(function(){E.isJabraInitialized=!1,m(!(E.isJabraEnabled=!1))}).catch(function(e){y.error("Unable to shutdown Jabra library",e)}):m(!0))};var e=[h.network.get({type:"turn",nolimit:!0}).$promise,h.network.get({type:"stun",nolimit:!0}).$promise];o.all(e).then(function(e){var n=e[0].rows,t=e[1].rows,a=[],i=[];t.forEach(function(e){i.push("stun:"+e.value)}),a.push({urls:i}),n.forEach(function(e){var n={urls:"turn:"+e.value};e.username&&(n.username=e.username),e.password&&(n.credential=e.password),a.push(n)}),E.sessionConf.pcConfig={iceServers:a}}),this.ua.on("registered",function(){this.registered=!0}.bind(this)),this.ua.on("unregistered",function(){this.registered=!1}.bind(this)),this.ua.on("newRTCSession",function(e){y.debug("onNewRTCSession -> data",e);var n,t,a,i,s,o=e.session,r=!0,l="",d=0;switch(e.originator){case"local":o.outgoing=!0,o.name=e.request.ruri.user,o.user=e.request.ruri.user,T(o.user,!1),t=e.request.extraHeaders,a="X-callback-url",s=_.find(t,function(e){return _.startsWith(e,a)}),n=!!s&&_.trim(s.replace(a,"").replace(i||":","")),E.isJabraEnabled&&(E.jabraSession&&jabra.resume(),E.jabraSession=o,jabra.offHook());break;case"remote":var c=b.getCurrentUser();c.voicePause&&c.phoneBarDnd&&(r=!1);var m=e.request.getHeader("Call-Type")||"";if(c.ignorePauseForPreviewCalls&&"PREVIEW"===m&&(r=!0),E.originateInProgress&&(r=!1),r&&(o.incoming=!0,o.name=e.request.from.display_name,o.user=e.request.from.uri.user,l=e.request.getHeader("X-Answer-Mode")||"",d=e.request.getHeader("X-Answer-After")||0,function(n){y.debug("getNotification -> session",n._request);var e=n.name?n.name+" <"+n.user+">":n.user;E.currentUser.privacyEnabled&&(e=A.mask(e)),f.create("Incoming call from: ",e,null,function(){I(n)},function(){O(n)},E.conf.autoAnswer).then(function(e){n.notification=e}).catch(function(e){y.error("Error creating notification for incoming call",e)})}(e.session),T(e.session.user,!0),E.isJabraEnabled&&jabra.ring(),E.conf.autoAnswer&&g(function(){o.isInProgress()&&(o.autoAnswer=!0,I(o))},E.conf.autoAnswerDelay?1e3*E.conf.autoAnswerDelay:0),y.debug("xAnswerMode",l),y.debug("xAnswerAfterSec",d),"auto"==l.toLowerCase())){var u=0==d?500:1e3*d;y.debug("auto answer enabled after:"+u+" ms"),g(function(){o.isInProgress()&&(o.autoAnswer=!0,I(o))},u)}}r?(o.call_id=e.request.call_id,n&&M(E.callbackQueue[o.call_id]=n,{call_id:o.call_id}).then(function(){y.info('callbackurl:"'+n+'" called successfully')}).catch(function(e){y.error('fail callbackurl:"'+n+'" err:',e)}),o.connection&&(o.connection.onaddstream=w.bind(this)),o.iceCandidateTimeout=null,o.on("progress",function(e,n){y.debug("onProgress -> session, data",e._request,n),y.error("onProgress -> session, data",e._request,n);var t=!1;switch(n.originator){case"local":this.conf.ringingMute||(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/incoming-call.ogg"),t=!0);break;case"remote":this.putOtherCallsOnHold(e),this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/outgoing-call.ogg"),t=!0}E.originateInProgress&&(E.originateInProgress=!1),t&&(this.soundPlayer.loop="loop",this.soundPlayer.play().catch(function(e){y.error(e.message)})),C(e).then(function(){var n=E.callbackQueue[e.call_id];n&&M(n,{uniqueid:e.uniqueid,call_id:e.call_id,number_called:e.user}).then(function(){y.info('callbackurl:"'+n+'" called successfully')}).catch(function(e){y.error('fail callbackurl:"'+n+'" err:',e)}).finally(function(){delete E.callbackQueue[e.call_id]})}).catch(function(e){y.error("Unable to retrieve voice channels",e)})}.bind(this,o)),o.on("confirmed",function(e,n){y.debug("onConfirmed -> session, data",e._request,n);var t=document.getElementById("div_session_"+e.id.substr(0,32));t&&$(t).scope().$broadcast("timer-start"),e.confirmed=!0,"remote"===n.originator&&e.connection&&(e.connection.onaddstream=w.bind(this),_.head(e.connection.getRemoteStreams())&&(this.remotePlayer.srcObject=_.head(e.connection.getRemoteStreams()),this.remotePlayer.play())),this.soundPlayer.pause(),this.soundPlayer.loop=null,this.putOtherCallsOnHold(e),e.autoAnswer&&(this.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/beep.ogg"),this.soundPlayer.play().catch(function(e){y.error("Unable to play autoAnswer notification",e)})),E.canGoInConference=2==E.sessions.length,C(e).catch(function(e){y.error("Unable to retrieve voice channels",e)})}.bind(this,o)),o.on("hold",function(e,n){y.debug("onHold -> session, data",e._request,n),"local"===n.originator&&(e.localHold=!0)}.bind(this,o)),o.on("unhold",function(e,n){y.debug("onUnhold -> session, data",e._request,n),"local"===n.originator&&(e.localHold=!1)}.bind(this,o)),o.on("ended",function(e,n){if(y.debug("onEnded -> session, data",e._request,n),E.isInConference&&_.includes(E.currentConferenceSessions,e.id)&&(R(),E.buttonClicked=!0),_.remove(this.sessions,{id:e.id}),2!==E.sessions.length&&(E.canGoInConference=!1),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var t=_.last(E.sessions);t.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=t):jabra.offHook()}0===E.sessions.length&&E.currentUser.voicePause&&"ACW"!==E.currentUser.pauseType&&h.user.pause({id:E.currentUser.id,type:_.startsWith(E.currentUser.pauseType,"#")?E.currentUser.pauseType.substring(1):E.currentUser.pauseType}).$promise.catch(function(e){v.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:PAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})}),E.conf.microphoneMute=!1,E.initDevice("microphone",!0)}.bind(this,o)),o.on("failed",function(e,n){if(y.debug("onFailed -> session, data",e._request,n),this.soundPlayer.pause(),this.soundPlayer.loop=null,e.notification&&e.notification.close(),E.isInConference&&_.includes(E.currentConferenceSessions,e.id)&&R(),E.originateInProgress&&(E.originateInProgress=!1),_.remove(this.sessions,{id:e.id}),2!==E.sessions.length&&(E.canGoInConference=!1),E.isJabraEnabled)if(0===E.sessions.length)e.localHold&&jabra.resume(),jabra.onHook(),E.jabraSession=null;else{var t=_.last(E.sessions);t.localHold?(jabra.onHook(),jabra.hold(),E.jabraSession=t):jabra.offHook()}}.bind(this,o)),o.on("icecandidate",function(e,n){y.debug("onIcecandidate -> session, data",e._request,n),null!==e.iceCandidateTimeout&&clearTimeout(e.iceCandidateTimeout),e.iceCandidateTimeout=setTimeout(n.ready,1e3)}.bind(this,o)),E.sessions.push(o),g(function(){p.$apply(),y.debug("onNewRTCSession -> vm_pb.sessions",E.sessions)})):O(o,486)}.bind(this)),r.on("webbar:originate",function(e){y.debug("originateHook -> payload",e);var n=e.callNumber,t=e.callerId,a=e.callbackUrl;E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0;var i=n.replace(/ /g,"");if(i=(i=i.replace(/\(/g,"")).replace(/\)/g,"")){var s=angular.copy(E.sessionConf);s.extraHeaders=[],t&&s.extraHeaders.push("X-CID: "+t),a&&s.extraHeaders.push("X-callback-url: "+a),E.originateInProgress=!0,E.ua.call(i,s)}}.bind(this)),r.on("webbar:hangup",function(e){y.debug("hangupHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];y.info("hangupHook -> sessionToHangup",a),E.terminate(a)}}.bind(this)),r.on("webbar:answer",function(e){var n;y.debug("answerHook -> payload",e),n=e.sessionId?k(e.sessionId):_.find(E.sessions,function(e){return e.incoming&&!e.confirmed}),e.sessionId&&!n&&y.warn("call with session Id "+e.sessionId+" not found"),n&&E.answer(n)}.bind(this)),r.on("webbar:hold",function(e){y.debug("holdHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];E.hold(a)}}.bind(this)),r.on("webbar:unhold",function(e){y.debug("unholdHook -> payload",e);var n=E.sessions;if(e.sessionId&&((n=[]).push(k(e.sessionId)),0==n.length))y.warn("call with session Id "+e.sessionId+" not found");else for(var t=0;t<n.length;t++){var a=n[t];E.unhold(a)}}.bind(this)),r.on("webbar:transfer",function(e){if(y.debug("transferHook -> payload",e),e.sessionId)if(e.transferNumber){var n=k(e.sessionId);n?n.refer(e.transferNumber,{eventHandlers:{requestSucceeded:L(n,"requestSucceeded","top right",3e3),requestFailed:L(n,"requestFailed","top right",3e3)}}):y.warn("call with session Id "+e.sessionId+" not found")}else y.error("transferNumber required");else y.error("sessionId required")}.bind(this)),r.on("webbar:stopmonitors",function(e){if(e.agentId===E.currentUser.id){var n=_.find(E.sessions,["uniqueid",e.uniqueid]);if(!n)return;n.monitors.forEach(function(e){e.status="pause"}),n.monitor=!1}}.bind(this))}.bind(this),E.type=function(e,n){var t=e;switch(E.target||(E.target=""),n&&(E.target+=e,p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target)),e){case"*":t="asterisk";break;case"#":t="pound"}E.conf.enableDtmfTone&&(E.soundPlayer.setAttribute("src","assets/ms-phonebar/sounds/dialpad/"+t+".ogg"),E.soundPlayer.play().catch(function(e){y.error(e.message)}));for(var a=0;a<E.sessions.length;a+=1)E.sessions[a].isEstablished()&&!E.sessions[a].isOnHold().local&&E.sessions[a].sendDTMF(e)},E.call=function(){if(E.target&&E.target!==E.conf.name&&E.target!==E.conf.internal){E.conf.microphoneId?E.sessionConf.mediaConstraints.audio={deviceId:E.conf.microphoneId}:E.sessionConf.mediaConstraints.audio=!0;var e=E.target.replace(/ /g,"");return D(e=(e=e.replace(/\(/g,"")).replace(/\)/g,"")).then(function(e){e&&E.ua.call(e,E.sessionConf)}).then(function(){N()})}},E.hold=function(e){y.debug("hold -> session",e._request),e.hold({useUpdate:!1}),E.isJabraEnabled&&(jabra.hold(),jabra.onHook())},E.refer=function(n){y.debug("refer -> session",n._request);var e=a.prompt().title("Transfer").textContent("Type the target").placeholder("Target").ariaLabel("Target").ok("Transfer").cancel("Cancel");a.show(e).then(function(e){return D(e.replace(/ /g,"").replace(/\(/g,"").replace(/\)/g,""))}).then(function(e){n.refer(e,{eventHandlers:{requestSucceeded:L(n,"requestSucceeded","top right",3e3),requestFailed:L(n,"requestFailed","top right",3e3)}})})},E.record=function(e){y.debug("record -> session",e._request),a.show({controller:"RecordDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/record/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{session:e,sessions:E.sessions}})},E.unhold=function(e){y.debug("unhold -> session",e._request),e.unhold({useUpdate:!1}),E.putOtherCallsOnHold(e),E.isJabraEnabled&&(jabra.offHook(),jabra.resume())},E.answer=I,E.terminate=O,E.selectSession=function(e){y.debug("selectSession -> session",e._request),E.unhold(e)},E.typeWrapper=function(e){switch(e.key.toLowerCase()){case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":case"*":case"#":E.type(e.key);break;case"enter":E.call()}},E.toggleDialpad=function(){E.showDialpad=!E.showDialpad},E.referAttended=function(e){y.debug("referAttended -> session",e._request),a.show({controller:"ReferAttendedDialogController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/referAttended/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{session:e,sessions:_.reject(E.sessions,{id:e.id}),isJabraEnabled:E.isJabraEnabled}})},E.closeDialpad=function(){E.showDialpad=!1},E.initDevice=x,E.putOtherCallsOnHold=function(e){if(y.debug("putOtherCallsOnHold -> session",e._request),1<E.sessions.length)for(var n=0;n<E.sessions.length;n+=1)E.sessions[n].id===e.id||E.sessions[n].isOnHold().remote||E.sessions[n].hold({useUpdate:!1})},E.targetChanged=function(e){e?/^(\w|\.|\+|#|\*|\(|\)|\s|-)*$/.test(e)?(E.target=e,p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target)):E.target?p.$broadcast("angucomplete-alt:changeInput","ms-target-wrap",E.target):N():N()},E.targetSelected=function(e){e&&(E.target=e.originalObject.target,E.call(),N())},E.start3WayConf=function(){E.isInConference=!0,E.canGoInConference=!1,E.currentConferenceSessions.push(E.sessions[0].id),E.currentConferenceSessions.push(E.sessions[1].id);var e=new AudioContext,n=E.sessions[0].connection.getSenders()[0],t=E.sessions[0].connection.getReceivers()[0];t.track.addEventListener("unmute",function(){setTimeout(function(){P()},1e3)},!1);var a=E.sessions[1].connection.getSenders()[0],i=E.sessions[1].connection.getReceivers()[0];i.track.addEventListener("unmute",function(){setTimeout(function(){P()},1e3)},!1),E.sessions[0].unhold({useUpdate:!1}),E.sessions[1].unhold({useUpdate:!1}),t.track.enabled=!0,i.track.enabled=!0;var s=new MediaStream,o=e.createMediaStreamDestination();o=(e=new AudioContext).createMediaStreamDestination();var r=e.createMediaStreamSource(new MediaStream([i.track]));r.connect(o),(r=e.createMediaStreamSource(new MediaStream([n.track]))).connect(o),n.replaceTrack(o.stream.getTracks()[0]).then(function(){}),o=e.createMediaStreamDestination(),(r=e.createMediaStreamSource(new MediaStream([t.track]))).connect(o),(r=e.createMediaStreamSource(new MediaStream([a.track]))).connect(o),a.replaceTrack(o.stream.getTracks()[0]).then(function(){s.addTrack(t.track),s.addTrack(i.track);var e=document.getElementById("remote-audio");e.srcObject=s;var n=e.play();void 0!==n&&n.then(function(){}).catch(function(e){y.error(e)})})},E.patchConference=P,p.$on("webrtc::settings",function(e){a.show({controller:"SettingsController",controllerAs:"vm",templateUrl:"assets/ms-phonebar/settings/settings.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{devices:function(){return navigator.mediaDevices.enumerateDevices()}},locals:{conf:E.conf,activeSessions:E.sessions}}).then(function(e){e&&(E.conf=e,E.initDeviceInProgress||(E.initDeviceInProgress=!0,jabra&&E.isJabraInitialized?jabra.shutdown().then(function(){E.isJabraInitialized=!1,m(E.isJabraEnabled=!1)}).catch(function(e){y.error("Unable to shutdown Jabra library",e)}):m(!1)))})}),p.$on("webrtc::logout",function(){E.ua.stop(),jabra&&E.isJabraInitialized&&jabra.shutdown(),navigator.mediaDevices.ondevicechange=function(){}}),p.$on("webrtc::call",function(e,n){y.debug("onRemoteCall -> evt, data",e,n),n.target&&(E.target=n.target,E.call())}),p.$on("webrtc::transfer",function(e,n){if(y.debug("onRemoteTransfer -> evt, data",e,n),n.target)for(var t=0;t<E.sessions.length;t+=1)if(E.sessions[t].isEstablished()&&!E.sessions[t].isOnHold().local)return D(n.target).then(function(e){e&&E.sessions[t].refer(e,{eventHandlers:{requestSucceeded:L(E.sessions[t],"requestSucceeded","top right",3e3),requestFailed:L(E.sessions[t],"requestFailed","top right",3e3)}})})}),p.$on("$destroy",function(){y.debug("$destroy event fired"),r.removeAllListeners("webbar:originate"),r.removeAllListeners("webbar:hangup"),r.removeAllListeners("webbar:answer"),r.removeAllListeners("webbar:hold"),r.removeAllListeners("webbar:unhold"),r.removeAllListeners("webbar:transfer"),r.removeAllListeners("webbar:stopmonitors")}),n.onbeforeunload=function(){E.sessions.forEach(function(e){E.terminate(e)})}}e.$inject=["$scope","$document","$timeout","$interval","$mdDialog","$mdToast","$window","$translate","$http","$q","toasty","api","motNotification","Auth","socket","privacyManager","ClientSideLoggingService"],angular.module("app.core").controller("MsPhonebarController",e).directive("msPhonebar",function(){return{restrict:"E",scope:{conf:"=",sessions:"=",registered:"="},require:"msPhonebar",controller:"MsPhonebarController",controllerAs:"vm_pb",bindToController:!0,templateUrl:"assets/ms-phonebar/ms-phonebar.html"}})}(),function(){"use strict";function e(n,e,t){var a=this;a.prefixes=e,a.required=t,a.closeDialog=function(e){n.hide(e)},a.keyPress=function(e){13===e.keyCode&&this.call()},a.call=function(){n.hide(a.prefix)}}e.$inject=["$mdDialog","prefixes","required"],angular.module("app.core").controller("PrefixDialogController",e)}(),function(){"use strict";function e(i){return{restrict:"C",controller:["$scope","$element",function(e,n){function t(){n.css("display","inline"),i(a,1e3)}function a(){n.css("display","none"),i(t,1e3)}t()}],replace:!0}}function n(n,i,s,e,t){var o=this;function a(n,e){console.log("startMonitor");var t=i.defer(),a=(e||n.filename.replace(/^.*[\\\/]/,"")).split(".")[0];return s.rpc.startMonitor({uniqueid:o.session.uniqueid,filename:a,format:"wav"}).$promise.then(function(e){n.filename=a+".wav",n.mixmonitorid=e.mixmonitorid,n.status="rec",o.session.monitor=!0,t.resolve(n)}).catch(function(e){t.reject(e)}),t.promise}o.title="Record",o.sessions=e,o.session=t,o.closeDialog=function(){n.hide()},o.addRecording=function(){var e=n.prompt({skipHide:!0}).title("Start new recording").textContent("Type the file name.").placeholder("File name").ariaLabel("File name").initialValue(function(){function e(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return e()+e()+"-"+e()+"-"+e()+"-"+e()+"-"+e()+e()+e()}()).ok("Start").cancel("Cancel");n.show(e).then(function(e){return a({},e)}).then(function(e){o.session.monitors.push(e)})},o.stop=function(n){return console.log("stopMonitor"),s.rpc.stopMonitor({uniqueid:o.session.uniqueid,mixmonitorid:n.mixmonitorid}).$promise.then(function(e){n.status="pause",o.session.monitor=_.includes(o.session.monitors,{status:"rec"})}).catch(function(e){console.error(e)})},o.start=a}e.$inject=["$timeout"],n.$inject=["$mdDialog","$q","api","sessions","session"],angular.module("app.core").directive("msBlink",e).controller("RecordDialogController",n)}(),function(){"use strict";function e(n,i,a,s,o){var r=this;function l(e,n){var t=n?"Transfer Success":"Transfer Failed",a="top right";return console.debug("onTransferCallback -> session, textContent, position, delay",e,t,a,3e3),function(){i.show(i.simple().textContent(t).position(a).hideDelay(3e3))}}function d(e){n.hide(e)}r.title="Refer Attended",r.sessions=a,r.session=s,r.isJabraEnabled=o,r.sessionTarget=null,a.length&&(r.target=a[0].user),r.closeDialog=d,r.transfer=function(){var e,n,t=_.find(a,function(e){if(e.user===r.target)return e});n=t.outgoing?(e=t,r.session):(e=r.session,t);console.debug("session.refer() -> source, target, replaces, callback",n,e.user,e,"onTransferCallback"),n.refer(e.user,{replaces:e,eventHandlers:{requestSucceeded:l(s,!0),requestFailed:l(s,!1)}}),function(e,n){e.terminate(),jabra&&n&&jabra.onHook();d()}(s,o)}}e.$inject=["$mdDialog","$mdToast","sessions","session","isJabraEnabled"],angular.module("app.core").controller("ReferAttendedDialogController",e)}(),function(){"use strict";function e(e,s,n,t,a,i){var o=this;function r(e,n,t){var a;if(s[t]){if(a=_.find(e,function(e){return e.deviceId===s[t]}))return a.deviceId;var i=_.findIndex(e,function(e){return e.kind===n});if(0<=i)return e[i].deviceId}else(a=_.find(e,function(e){return e.kind===n}))&&(s[t]=a.deviceId);return s[t]||null}o.currentUser=a.getCurrentUser(),o.messengerSoundNotification=o.currentUser.messengerSoundNotification,_.remove(n,function(e){return"audioinput"===e.kind&&("default"===e.deviceId||"communications"===e.deviceId)||"audiooutput"===e.kind&&("default"===e.deviceId||"communications"===e.deviceId)}),s.ringingId=r(n,"audiooutput","ringingId"),s.speakerId=r(n,"audiooutput","speakerId"),s.microphoneId=r(n,"audioinput","microphoneId"),s.ringingVolume=s.ringingVolume||.5,s.speakerVolume=s.speakerVolume||.5,s.microphoneVolume=s.microphoneVolume||1,s.ringingMute=s.ringingMute||!1,s.speakerMute=s.speakerMute||!1,s.microphoneMute=s.microphoneMute||!1,o.conf=angular.copy(s),o.devices=n,o.activeSessions=t,o.saveSettings=function(){i.user.messengerSoundNotification({id:o.currentUser.id,enabled:o.messengerSoundNotification}).$promise.then(function(){a.setMessengerSoundNotification(o.messengerSoundNotification),e.hide(o.conf)})},o.closeDialog=function(){e.hide()},o.isCompatibleBrowser=function(){return"chrome"===o.conf.browserName.toLowerCase()||"opera"===o.conf.browserName.toLowerCase()||"safari"===o.conf.browserName.toLowerCase()}}e.$inject=["$mdDialog","conf","devices","activeSessions","Auth","api"],angular.module("app.toolbar").controller("SettingsController",e)}(),function(){"use strict";function e(e,t,a){var i=this;function s(e,n,t){r(e).then(function(){n&&!1!==t&&i.search()})}function o(e){var n=e.key;i.pickerModels[n].dateStart?!0===e.useFromToKeys?i.query[n]={from:moment(i.pickerModels[n].dateStart).utcOffset(0,!0).format(),to:moment(i.pickerModels[n].dateEnd).utcOffset(0,!0).add(23,"hours").add(59,"minutes").add(59,"seconds").format()}:i.query[n]={$gte:moment(i.pickerModels[n].dateStart).utcOffset(0,!0).format(),$lte:moment(i.pickerModels[n].dateEnd).utcOffset(0,!0).add(23,"hours").add(59,"minutes").add(59,"seconds").format()}:i.query[n]=void 0,i.search()}function r(e){var n=e.key,t={param:i.query[n],resources:e.options,placeholder:e.placeholder,ngValue:e.ngValue};return a.setPlaceholder(t).then(function(e){i.placeholders[n]=e})}i.pickerModels={},i.placeholders={},i.localizationMap=t.localizationMap,i.onMultiselectInit=function(e){r(e)},i.onDateRangeInit=function(e){var n=e.key;i.query[n]?i.pickerModels[n]=t.setSelectedDate(i.query[n]):i.pickerModels[n]={dateStart:null}},i.onMultiselectSelection=s,i.onDateRangeSelection=o,i.clearDate=function(e){var n=e.key;i.pickerModels[n]={dateStart:null},delete i.query[n],i.search()},i.clearSelection=function(e){var n=e.key,t=e.ngValue||"id";i.query[n]=!1===e.clearAll?[_.head(e.options)[t]]:[],r(e).then(function(){i.search()})},i.selectAll=function(e){var n=e.key,t=e.ngValue||"id";i.query[n]=_.map(e.options,t),r(e).then(function(){i.search()})},e.$on("ms-quick-filter:update",function(e,t){t.filters.forEach(function(e){var n=_.find(i.filters,["name",e]);if(n)switch(n.type){case"date":o(n);break;case"multiselect":s(n,!0,t.update);break;case"select":i.search()}})})}e.$inject=["$scope","dateRangeManager","quickFilterManager"],angular.module("app.core").directive("msQuickFilter",function(){return{restrict:"E",scope:{query:"=",filters:"=",search:"&"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-quick-filter/ms-quick-filter.html"}})}(),function(){"use strict";angular.module("app.core").directive("msRandomClass",function(){return{restrict:"A",scope:{msRandomClass:"="},link:function(e,n){var t=e.msRandomClass[Math.floor(Math.random()*e.msRandomClass.length)];n.addClass(t)}}})}(),function(){"use strict";function e(i){return{restrict:"E",scope:{id:"=",model:"=",download:"="},replace:!0,link:function(n,e){var t=!1,a=document.createElement("audio");n.download||a.setAttribute("controlsList","nodownload"),a.setAttribute("preload","none"),a.setAttribute("controls",""),a.setAttribute("style","width: 265px;"),a.setAttribute("src"," "),a.onplay=function(e){t||(t=!0,e.preventDefault(),i[n.model||"voiceRecording"].download({id:n.id}).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type});a.setAttribute("type",e.type),a.setAttribute("src",URL.createObjectURL(t)),a.play()}).catch(function(e){console.error(e)}))},e.append(a)}}}e.$inject=["api"],angular.module("app.core").directive("msRecording",e)}(),function(){"use strict";angular.module("app.core").directive("msResponsiveTable",function(){return{restrict:"A",link:function(e,n){var t=angular.element('<div class="ms-responsive-table-wrapper"></div>');n.after(t),t.append(n)}}})}(),function(){"use strict";function e(n,i,s,e){var o=this;function t(){angular.isArray(o.onSearch)?a(o.onSearch):o.onResultClick?(o.resultsLoading=!0,n.$parent.$eval("vm.search(query)",{query:o.query.filter}).then(function(e){a(e)}).catch(function(){a([])}).finally(function(){o.resultsLoading=!1})):o.onSearch()}function a(e){o.expanded&&(void 0===e||angular.isArray(e)||null===e)&&(o.selectedResultIndex=0,o.results=e)}function r(){o.expanded=!0,o.displayOn=!0,n.expand()}function l(e){!1!==e&&(o.query.filter=void 0,o.onResultClick?a(null):t()),o.expanded=!1,n.collapse()}function d(e){o.onResultClick&&o.onResultClick({item:e}),l()}function c(){var e=i.find(".ms-search-bar-results"),n=angular.element(e.find(".result")[o.selectedResultIndex]);if(e&&n){var t=n.position().top-8,a=n.position().top+n.outerHeight()+8;o.ignoreMouseEvents=!0,s.cancel(o.mouseEventIgnoreTimeout),o.mouseEventIgnoreTimeout=s(function(){o.ignoreMouseEvents=!1},250),e.scrollTop()>t&&e.scrollTop(t),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}}o.queryOptions={debounce:o.debounce||0},o.searchOnEnterKey=e.get().searchOnEnterKey||!1,o.resultsLoading=!1,o.results=null,o.selectedResultIndex=0,o.ignoreMouseEvents=!1,o.expandBar=r,o.collapseBar=l,o.blurCollapse=function(){if(!o.collapseOnBlur)return;l(!0)},o.onKeyDown=function(e){var n=e.keyCode;-1<[27,38,40].indexOf(n)&&e.preventDefault();switch(n){case 13:if(!o.onResultClick)return t();if(!o.results)return;d(o.results[o.selectedResultIndex]);break;case 27:l(!0);break;case 38:0<=o.selectedResultIndex-1&&(o.selectedResultIndex--,c());break;case 40:if(!o.results)return;o.selectedResultIndex+1<o.results.length&&(o.selectedResultIndex++,c())}},o.absorbEvent=function(e){e.preventDefault()},o.handleMouseenter=function(e){if(o.ignoreMouseEvents)return;o.selectedResultIndex=e},o.handleResultClick=d,n.$watch("vm.displayOn",function(e){angular.isUndefined(e)||(!0!==e||o.expanded?e||!1===o.expanded||l(!1):r())}),n.$watch("vm.query.filter",function(e,n){if(!angular.isUndefined(e)&&0!==e.length&&!angular.equals(e,n)&&!1!==o.displayOn){if(o.expanded){if(!0===o.searchOnEnterKey&&!o.onResultClick)return;if(o.minChars&&o.minChars>e.length)return}else r();t()}})}function n(a){return{restrict:"E",scope:{query:"=?",debounce:"=?",direction:"@",iconColor:"@",onSearch:"&",onResultClick:"&?",onExpand:"&?",onCollapse:"&?",collapseOnBlur:"<?",minChars:"<?",displayOn:"=?"},controller:e,controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-search-bar/ms-search-bar.html",compile:function(e){return e.addClass("ms-search-bar"),{post:function(n,t){n.collapse=function(){if(t.removeClass("expanded"),"down"===n.vm.direction){t.removeClass("down");var e=t.closest("md-toolbar");e&&e.removeClass("h-128")}a.find("body").removeClass("ms-search-bar-expanded")},n.expand=function(){if(t.addClass("expanded"),"down"===n.vm.direction){t.addClass("down");var e=t.closest("md-toolbar");e&&e.addClass("h-128")}a.find("body").addClass("ms-search-bar-expanded")}}}}}}e.$inject=["$scope","$element","$timeout","settingsManager"],n.$inject=["$document"],angular.module("app.core").controller("MsSearchBarController",e).directive("msSearchBar",n)}(),function(){"use strict";function e(e,t,i,o,r,l){var d=this;d.query="",d.queryOptions={debounce:300},d.resultsLoading=!1,d.selectedResultIndex=0,d.ignoreMouseEvents=!1,d.mobileBarActive=!1,d.results=null,d.shortcuts=[],d.sortableOptions={ghostClass:"ghost",forceFallback:!0,fallbackClass:"dragging",onSort:function(){d.saveShortcuts()}},d.populateResults=function(){for(var e=[],n=l.getFlatNavigation(),t=r.defer(),a=0;a<n.length;a++)n[a].uisref&&e.push(n[a]);if(d.query){e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(d.query)))return!0});for(var i=0;i<e.length;i++){e[i].hasShortcut=!1;for(var s=0;s<d.shortcuts.length;s++)if(d.shortcuts[s]._id===e[i]._id){e[i].hasShortcut=!0;break}}}else 0<d.shortcuts.length&&(e=d.shortcuts);return d.selectedResultIndex=0,o(function(){t.resolve(e)},250),t.promise},d.loadShortcuts=function(){var e=r.defer(),n=angular.fromJson(t.get("motion.shortcuts"));angular.isUndefined(n)&&(n=[{title:"Agents",icon:"icon-account-multiple",state:"app.staff.agents",weight:5,children:[],uisref:"app.staff.agents",hasShortcut:!0},{title:"License",icon:"icon-cog",state:"app.settings.license",weight:10,children:[],uisref:"app.settings.license",hasShortcut:!0}],t.put("motion.shortcuts",angular.toJson(n)));return e.resolve(n),e.promise},d.saveShortcuts=function(){var e=r.defer();return t.put("motion.shortcuts",angular.toJson(d.shortcuts)),o(function(){e.resolve({success:!0})},250),e.promise},d.addShortcut=function(e){e.hasShortcut=!0,d.shortcuts.push(e),d.saveShortcuts()},d.removeShortcut=function(e){e.hasShortcut=!1;for(var n=0;n<d.shortcuts.length;n++)d.shortcuts[n]._id===e._id&&(d.shortcuts.splice(n,1),d.query||(0===d.shortcuts.length?d.results=null:n>=d.shortcuts.length&&(d.selectedResultIndex=d.shortcuts.length-1)));d.saveShortcuts()},d.handleResultClick=function(e){e.hasShortcut?d.removeShortcut(e):d.addShortcut(e)},d.absorbEvent=function(e){e.preventDefault()},d.handleKeydown=function(e){var n=e.keyCode;-1<[38,40].indexOf(n)&&e.preventDefault();switch(n){case 13:d.handleResultClick(d.results[d.selectedResultIndex]);break;case 38:0<=d.selectedResultIndex-1&&(d.selectedResultIndex--,d.ensureSelectedResultIsVisible());break;case 40:d.selectedResultIndex+1<d.results.length&&(d.selectedResultIndex++,d.ensureSelectedResultIsVisible())}},d.handleMouseenter=function(e){if(d.ignoreMouseEvents)return;d.selectedResultIndex=e},d.temporarilyIgnoreMouseEvents=function(){d.ignoreMouseEvents=!0,o.cancel(d.mouseEventIgnoreTimeout),d.mouseEventIgnoreTimeout=o(function(){d.ignoreMouseEvents=!1},250)},d.ensureSelectedResultIsVisible=function(){var e=i.find("#ms-shortcut-add-menu").find(".results"),n=angular.element(e.find(".result")[d.selectedResultIndex]);if(e&&n){var t=n.position().top-8,a=n.position().top+n.outerHeight()+8;d.temporarilyIgnoreMouseEvents(),e.scrollTop()>t&&e.scrollTop(t),a>e.height()+e.scrollTop()&&e.scrollTop(a-e.height())}},d.toggleMobileBar=function(){d.mobileBarActive=!d.mobileBarActive},d.loadShortcuts().then(function(e){d.shortcuts=e,0<d.shortcuts.length&&(d.results=e)}),e.$watch("MsShortcuts.query",function(e,n){angular.isUndefined(e)||angular.equals(e,n)||(d.resultsLoading=!0,d.populateResults().then(function(e){d.results=e},function(){d.results=[]}).finally(function(){d.resultsLoading=!1}))})}e.$inject=["$scope","$cookies","$document","$timeout","$q","msNavigationService"],angular.module("app.core").controller("MsShortcutsController",e).directive("msShortcuts",function(){return{restrict:"E",scope:{},require:"msShortcuts",controller:"MsShortcutsController as MsShortcuts",bindToController:{},templateUrl:"app/core/directives/ms-shortcuts/ms-shortcuts.html",compile:function(e){return e.addClass("ms-shortcuts"),function(e,n){}}}})}(),function(){"use strict";angular.module("app.core").directive("msSidenavHelper",function(){return{restrict:"A",require:"^mdSidenav",link:function(e,n,t,a){e.$watch(function(){return a.isOpen()&&!a.isLockedOpen()},function(e){angular.isUndefined(e)||(n.parent().toggleClass("full-height",e),angular.element("html").toggleClass("sidenav-open",e))})}}})}(),function(){"use strict";function e(a){return{restrict:"E",link:function(e,n){var t=e.$on("msSplashScreen::remove",function(){a.leave(n).then(function(){t(),e=n=null})})}}}e.$inject=["$animate"],angular.module("app.core").directive("msSplashScreen",e)}(),function(){"use strict";function e(e){var i=this;function n(){i.setCurrentStep(1)}function t(e){return o(e)?i.steps[e-1].scope.optionalStep:null}function a(e){return o(e)?!!i.steps[e-1].scope.hideStep:null}function s(e){return o(e)?!!t(e)||i.steps[e-1].form.$valid:null}function o(e){return!(angular.isUndefined(e)||e<1||e>i.steps.length)}i.mainForm=void 0,i.orientation="horizontal",i.steps=[],i.currentStep=void 0,i.currentStepNumber=1,i.setOrientation=function(e){i.orientation=e||"horizontal"},i.registerMainForm=function(e){i.mainForm=e},i.registerStep=function(e,n,t){var a={element:e,scope:n,form:t,stepNumber:n.step||i.steps.length+1,stepTitle:n.stepTitle,stepTitleTranslate:n.stepTitleTranslate};return i.steps.push(a),i.steps.sort(function(e,n){return e.stepNumber-n.stepNumber}),a},i.setupSteps=function(){i.setCurrentStep(i.currentStepNumber)},i.resetForm=function(){e(function(){for(var e=0;e<i.steps.length;e++)i.steps[e].form.$setPristine(),i.steps[e].form.$setUntouched();i.mainForm.$setPristine(),i.mainForm.$setUntouched(),n()})},i.setCurrentStep=function(e){if(!o(e))return;if(i.currentStepNumber=e,"horizontal"===i.orientation){for(var n=0;n<i.steps.length;n++)i.steps[n].element.hide();i.steps[i.currentStepNumber-1].element.show()}else if("vertical"===i.orientation){for(var t=0;t<i.steps.length;t++)i.steps[t].element.find(".ms-stepper-step-content").hide();i.steps[i.currentStepNumber-1].element.find(".ms-stepper-step-content").show()}},i.gotoStep=function(e){if(a(e))return;i.setCurrentStep(e)},i.gotoPreviousStep=function(){for(var e=i.currentStepNumber-1,n=e;1<=n;n--)if(!a(n)){e=n;break}i.setCurrentStep(e)},i.gotoNextStep=function(){for(var e=i.currentStepNumber+1,n=e;n<=i.steps.length;n++)if(!a(n)){e=n;break}i.setCurrentStep(e)},i.gotoFirstStep=n,i.gotoLastStep=function(){i.setCurrentStep(i.steps.length)},i.isFirstStep=function(){return 1===i.currentStepNumber},i.isLastStep=function(){return i.currentStepNumber===i.steps.length},i.isStepCurrent=function(e){return o(e)?i.currentStepNumber===e:null},i.isStepDisabled=function(e){if(!o(e))return null;for(var n=!1,t=1;t<e;t++)if(!s(t)){n=!0;break}return n},i.isStepOptional=t,i.isStepHidden=a,i.filterHiddenStep=function(e){return!a(e.stepNumber)},i.isStepValid=s,i.isStepNumberValid=o,i.isFormValid=function(){return i.mainForm.$valid}}function n(o){return{restrict:"A",scope:{},require:["form","msVerticalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/vertical.html",compile:function(e){return e.addClass("ms-stepper"),function(e,n,t,a){var i=a[0],s=a[1];o(function(){s.setOrientation("vertical"),s.registerMainForm(i),s.setupSteps()})}}}}e.$inject=["$timeout"],n.$inject=["$timeout"],angular.module("app.core").controller("MsStepperController",e).directive("msHorizontalStepper",function(){return{restrict:"A",scope:{},require:["form","msHorizontalStepper"],priority:1001,controller:"MsStepperController as MsStepper",bindToController:{model:"=ngModel"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/horizontal/horizontal.html",compile:function(e){return e.addClass("ms-stepper"),function(e,n,t,a){var i=a[0],s=a[1];s.setOrientation("horizontal"),s.registerMainForm(i),s.setupSteps()}}}}).directive("msHorizontalStepperStep",function(){return{restrict:"E",require:["form","^msHorizontalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},compile:function(e){return e.addClass("ms-stepper-step"),function(e,n,t,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(t.optionalStep),s.registerStep(n,e,i),n.hide()}}}}).directive("msVerticalStepper",n).directive("msVerticalStepperStep",function(){return{restrict:"E",require:["form","^msVerticalStepper"],priority:1e3,scope:{step:"=?",stepTitle:"=?",stepTitleTranslate:"=?",optionalStep:"=?",hideStep:"=?"},transclude:!0,templateUrl:"app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",compile:function(e){return e.addClass("ms-stepper-step"),function(e,n,t,a){var i=a[0],s=a[1];e.optionalStep=angular.isDefined(t.optionalStep),e.stepInfo=s.registerStep(n,e,i),e.MsStepper=s,n.find(".ms-stepper-step-content").hide()}}}})}(),function(){"use strict";function e(e){return{restrict:"E",scope:{},transclude:!0,controller:"MsTabScrollController",controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-tab-scroll/ms-tab-scroll.html",compile:function(e){return e.addClass("ms-tab-scroll"),function(e,n){}}}}e.$inject=["$document"],angular.module("app.core").controller("MsTabScrollController",function(){function n(){var e=document.getElementById("bar-container"),n=document.getElementById("tab-container");return n.scrollWidth>e.scrollWidth&&0==e.scrollLeft&&0==n.scrollLeft?"right":n.scrollWidth>e.scrollWidth&&n.scrollLeft>e.scrollLeft&&e.scrollWidth+n.scrollLeft>=n.scrollWidth?"left":n.scrollWidth>e.scrollWidth&&n.scrollLeft>e.scrollLeft&&e.scrollWidth+n.scrollLeft<n.scrollWidth?"both":"none"}this.onTabScroll=function(e){"left"==e?$("#tab-container").stop().animate({scrollLeft:"-=400"},1e3):$("#tab-container").stop().animate({scrollLeft:"+=400"},1e3)},this.canScroll=function(e){switch(n()){case"both":return!0;case"left":return"left"==e;case"right":return"right"==e;case"none":default:return!1}}}).directive("msTabScroll",e)}(),function(){"use strict";function e(m,u){return{scope:!0,require:"^msTimeline",compile:function(e){return e.addClass("ms-timeline-item").addClass("hidden"),function(e,t,n,a){var i=72,s=!1,o=!1,r=a.getScrollEl();!function(){t.find("ms-card")?e.$on("msCard::cardTemplateLoaded",function(e,n){var t=angular.element(n[0]);d(t).then(function(){m(function(){s=!0})})}):d(t).then(function(){m(function(){s=!0})});r.on("scroll",c),c()}();var l=e.$watch(function(){return s&&o},function(e,n){angular.equals(e,n)||e&&(t.removeClass("hidden").addClass("animate"),l())},!0);function d(e){var n=u.defer(),t=e.find("img");return 0<t.length?t.on("load",function(){n.resolve("Image is loaded")}):n.resolve("No images"),n.promise}function c(){r.scrollTop()+r.height()>t.position().top+i&&(m(function(){o=!0}),r.off("scroll",c))}}}}}e.$inject=["$timeout","$q"],angular.module("app.core").controller("MsTimelineController",function(){var n=this;n.scrollEl=void 0,n.setScrollEl=function(e){n.scrollEl=e},n.getScrollEl=function(){return n.scrollEl}}).directive("msTimeline",function(){return{scope:{msTimeline:"=?",loadMore:"&?msTimelineLoadMore"},controller:"MsTimelineController",compile:function(e){return e.addClass("ms-timeline"),function(e,n,t,a){var i=angular.element('<div class="ms-timeline-loader md-accent-bg md-whiteframe-4dp"><span class="spinner"></span></div>');n.append(i);var s={scrollEl:"#content"};s=angular.extend(s,e.msTimeline,{});var o=angular.element(s.scrollEl);a.setScrollEl(o);var r=144;function l(){o.scrollTop()+o.height()+r>i.position().top&&(i.addClass("show"),c(),e.loadMore&&e.loadMore().then(function(){i.removeClass("show"),d()},function(){i.remove()}))}function d(){o.on("scroll",l)}function c(){o.off("scroll",l)}d(),e.$on("$destroy",function(){c()})}}}}).directive("msTimelineItem",e)}(),function(){"use strict";function e(e,n,t,a,i){var r=this;function s(){!function(){r.millis=l().diff(moment(r.startingTime));var e=moment.duration(r.millis),n=e.seconds(),t=e.minutes(),a=e.hours(),i=e.days(),s=e.months(),o=e.years();r.seconds=n<10?"0"+n:n,r.minutes=t<10?"0"+t:t,r.hours=a<10?"0"+a:a,r.days=i<10?"0"+i:i,r.months=s<10?"0"+s:s,r.years=o<10?"0"+o:o,r.timer=0<r.days?r.days+"d ":r.hours+":"+r.minutes+":"+r.seconds}(),r.timeoutId=setTimeout(function(){s(),e.$digest()},r.interval)}function l(e){var n=(e||moment()).utcOffset(r.utcOffset).format("YYYY-MM-DD HH:mm:ss");return moment(n)}function o(){t.resolve().then(function(){return null===r.utcOffset||void 0===r.utcOffset?i.getUTCOffset():r.utcOffset}).then(function(e){return r.utcOffset=e,l()}).catch(function(e){throw e}).then(function(e){var n=r.startTime?moment(r.startTime):void 0;r.startTime?n.isAfter(e,"hour")||n.isBefore(e,"hour")?r.startingTime=l(n):r.startingTime=n:r.startingTime=e,s()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.getDate",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}o(),e.$watch("vm.startTime",function(e,n){angular.isUndefined(e)||0!==e.length&&(angular.equals(e,n)||o())}),e.$on("timer-start",function(){r.startTime=void 0,o()}),n.bind("$destroy",function(){r.timeoutId&&clearTimeout(r.timeoutId)})}e.$inject=["$scope","$element","$q","toasty","settingsManager"],angular.module("app.core").directive("timer",function(){return{restrict:"EA",replace:!1,scope:{startTime:"=?",interval:"=?",utcOffset:"=?"},template:"<span ng-cloak>{{ vm.timer }}</span>",compile:function(){return{pre:function(e,n,t){e.interval=t.interval||1e3}}},controller:e,controllerAs:"vm",bindToController:!0}})}(),function(){"use strict";angular.module("app.core").directive("msTimezone",function(){return{restrict:"E",scope:{ngModel:"=",ngChange:"&"},controller:["$scope",function(e){e.timezone=[{name:"Europe/Andorra",utcOffset:60,offsetStr:"+01:00",countries:["AD"]},{name:"Asia/Dubai",utcOffset:240,offsetStr:"+04:00",countries:["AE","OM"]},{name:"Asia/Kabul",utcOffset:270,offsetStr:"+04:30",countries:["AF"]},{name:"Europe/Tirane",utcOffset:60,offsetStr:"+01:00",countries:["AL"]},{name:"Asia/Yerevan",utcOffset:240,offsetStr:"+04:00",countries:["AM"]},{name:"Antarctica/Rothera",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},{name:"Antarctica/Palmer",utcOffset:-180,offsetStr:"-03:00",countries:["AQ"]},{name:"Antarctica/Mawson",utcOffset:300,offsetStr:"+05:00",countries:["AQ"]},{name:"Antarctica/Davis",utcOffset:420,offsetStr:"+07:00",countries:["AQ"]},{name:"Antarctica/Casey",utcOffset:480,offsetStr:"+08:00",countries:["AQ"]},{name:"Antarctica/Vostok",utcOffset:360,offsetStr:"+06:00",countries:["AQ"]},{name:"Antarctica/DumontDUrville",utcOffset:600,offsetStr:"+10:00",countries:["AQ"]},{name:"Antarctica/Syowa",utcOffset:180,offsetStr:"+03:00",countries:["AQ"]},{name:"Antarctica/Troll",utcOffset:0,offsetStr:"+00:00",countries:["AQ"]},{name:"America/Argentina/Buenos_Aires",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Cordoba",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Salta",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Jujuy",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Tucuman",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Catamarca",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/La_Rioja",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/San_Juan",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Mendoza",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/San_Luis",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Rio_Gallegos",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"America/Argentina/Ushuaia",utcOffset:-180,offsetStr:"-03:00",countries:["AR"]},{name:"Pacific/Pago_Pago",utcOffset:-660,offsetStr:"-11:00",countries:["AS","UM"]},{name:"Europe/Vienna",utcOffset:60,offsetStr:"+01:00",countries:["AT"]},{name:"Australia/Lord_Howe",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Antarctica/Macquarie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Hobart",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Currie",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Melbourne",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Sydney",utcOffset:660,offsetStr:"+11:00",countries:["AU"]},{name:"Australia/Broken_Hill",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},{name:"Australia/Brisbane",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},{name:"Australia/Lindeman",utcOffset:600,offsetStr:"+10:00",countries:["AU"]},{name:"Australia/Adelaide",utcOffset:630,offsetStr:"+10:30",countries:["AU"]},{name:"Australia/Darwin",utcOffset:570,offsetStr:"+09:30",countries:["AU"]},{name:"Australia/Perth",utcOffset:480,offsetStr:"+08:00",countries:["AU"]},{name:"Australia/Eucla",utcOffset:525,offsetStr:"+08:45",countries:["AU"]},{name:"Asia/Baku",utcOffset:240,offsetStr:"+04:00",countries:["AZ"]},{name:"America/Barbados",utcOffset:-240,offsetStr:"-04:00",countries:["BB"]},{name:"Asia/Dhaka",utcOffset:360,offsetStr:"+06:00",countries:["BD"]},{name:"Europe/Brussels",utcOffset:60,offsetStr:"+01:00",countries:["BE"]},{name:"Europe/Sofia",utcOffset:120,offsetStr:"+02:00",countries:["BG"]},{name:"Atlantic/Bermuda",utcOffset:-240,offsetStr:"-04:00",countries:["BM"]},{name:"Asia/Brunei",utcOffset:480,offsetStr:"+08:00",countries:["BN"]},{name:"America/La_Paz",utcOffset:-240,offsetStr:"-04:00",countries:["BO"]},{name:"America/Noronha",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},{name:"America/Belem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Fortaleza",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Recife",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Araguaina",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Maceio",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Bahia",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Sao_Paulo",utcOffset:-120,offsetStr:"-02:00",countries:["BR"]},{name:"America/Campo_Grande",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Cuiaba",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Santarem",utcOffset:-180,offsetStr:"-03:00",countries:["BR"]},{name:"America/Porto_Velho",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Boa_Vista",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Manaus",utcOffset:-240,offsetStr:"-04:00",countries:["BR"]},{name:"America/Eirunepe",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},{name:"America/Rio_Branco",utcOffset:-300,offsetStr:"-05:00",countries:["BR"]},{name:"America/Nassau",utcOffset:-300,offsetStr:"-05:00",countries:["BS"]},{name:"Asia/Thimphu",utcOffset:360,offsetStr:"+06:00",countries:["BT"]},{name:"Europe/Minsk",utcOffset:180,offsetStr:"+03:00",countries:["BY"]},{name:"America/Belize",utcOffset:-360,offsetStr:"-06:00",countries:["BZ"]},{name:"America/St_Johns",utcOffset:-210,offsetStr:"-03:30",countries:["CA"]},{name:"America/Halifax",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Glace_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Moncton",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Goose_Bay",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Blanc-Sablon",utcOffset:-240,offsetStr:"-04:00",countries:["CA"]},{name:"America/Toronto",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Nipigon",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Thunder_Bay",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Iqaluit",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Pangnirtung",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Resolute",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Atikokan",utcOffset:-300,offsetStr:"-05:00",countries:["CA"]},{name:"America/Rankin_Inlet",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Winnipeg",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Rainy_River",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Regina",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Swift_Current",utcOffset:-360,offsetStr:"-06:00",countries:["CA"]},{name:"America/Edmonton",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Cambridge_Bay",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Yellowknife",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Inuvik",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Creston",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Dawson_Creek",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Fort_Nelson",utcOffset:-420,offsetStr:"-07:00",countries:["CA"]},{name:"America/Vancouver",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"America/Whitehorse",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"America/Dawson",utcOffset:-480,offsetStr:"-08:00",countries:["CA"]},{name:"Indian/Cocos",utcOffset:390,offsetStr:"+06:30",countries:["CC"]},{name:"Europe/Zurich",utcOffset:60,offsetStr:"+01:00",countries:["CH","DE","LI"]},{name:"Africa/Abidjan",utcOffset:0,offsetStr:"+00:00",countries:["CI","BF","GM","GN","ML","MR","SH","SL","SN","ST","TG"]},{name:"Pacific/Rarotonga",utcOffset:-600,offsetStr:"-10:00",countries:["CK"]},{name:"America/Santiago",utcOffset:-180,offsetStr:"-03:00",countries:["CL"]},{name:"Pacific/Easter",utcOffset:-300,offsetStr:"-05:00",countries:["CL"]},{name:"Asia/Shanghai",utcOffset:480,offsetStr:"+08:00",countries:["CN"]},{name:"Asia/Urumqi",utcOffset:360,offsetStr:"+06:00",countries:["CN"]},{name:"America/Bogota",utcOffset:-300,offsetStr:"-05:00",countries:["CO"]},{name:"America/Costa_Rica",utcOffset:-360,offsetStr:"-06:00",countries:["CR"]},{name:"America/Havana",utcOffset:-300,offsetStr:"-05:00",countries:["CU"]},{name:"Atlantic/Cape_Verde",utcOffset:-60,offsetStr:"-01:00",countries:["CV"]},{name:"America/Curacao",utcOffset:-240,offsetStr:"-04:00",countries:["CW","AW","BQ","SX"]},{name:"Indian/Christmas",utcOffset:420,offsetStr:"+07:00",countries:["CX"]},{name:"Asia/Nicosia",utcOffset:120,offsetStr:"+02:00",countries:["CY"]},{name:"Europe/Prague",utcOffset:60,offsetStr:"+01:00",countries:["CZ","SK"]},{name:"Europe/Berlin",utcOffset:60,offsetStr:"+01:00",countries:["DE"]},{name:"Europe/Copenhagen",utcOffset:60,offsetStr:"+01:00",countries:["DK"]},{name:"America/Santo_Domingo",utcOffset:-240,offsetStr:"-04:00",countries:["DO"]},{name:"Africa/Algiers",utcOffset:60,offsetStr:"+01:00",countries:["DZ"]},{name:"America/Guayaquil",utcOffset:-300,offsetStr:"-05:00",countries:["EC"]},{name:"Pacific/Galapagos",utcOffset:-360,offsetStr:"-06:00",countries:["EC"]},{name:"Europe/Tallinn",utcOffset:120,offsetStr:"+02:00",countries:["EE"]},{name:"Africa/Cairo",utcOffset:120,offsetStr:"+02:00",countries:["EG"]},{name:"Africa/El_Aaiun",utcOffset:0,offsetStr:"+00:00",countries:["EH"]},{name:"Europe/Madrid",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},{name:"Africa/Ceuta",utcOffset:60,offsetStr:"+01:00",countries:["ES"]},{name:"Atlantic/Canary",utcOffset:0,offsetStr:"+00:00",countries:["ES"]},{name:"Europe/Helsinki",utcOffset:120,offsetStr:"+02:00",countries:["FI","AX"]},{name:"Pacific/Fiji",utcOffset:720,offsetStr:"+12:00",countries:["FJ"]},{name:"Atlantic/Stanley",utcOffset:-180,offsetStr:"-03:00",countries:["FK"]},{name:"Pacific/Chuuk",utcOffset:600,offsetStr:"+10:00",countries:["FM"]},{name:"Pacific/Pohnpei",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},{name:"Pacific/Kosrae",utcOffset:660,offsetStr:"+11:00",countries:["FM"]},{name:"Atlantic/Faroe",utcOffset:0,offsetStr:"+00:00",countries:["FO"]},{name:"Europe/Paris",utcOffset:60,offsetStr:"+01:00",countries:["FR"]},{name:"Europe/London",utcOffset:0,offsetStr:"+00:00",countries:["GB","GG","IM","JE"]},{name:"Asia/Tbilisi",utcOffset:240,offsetStr:"+04:00",countries:["GE"]},{name:"America/Cayenne",utcOffset:-180,offsetStr:"-03:00",countries:["GF"]},{name:"Africa/Accra",utcOffset:0,offsetStr:"+00:00",countries:["GH"]},{name:"Europe/Gibraltar",utcOffset:60,offsetStr:"+01:00",countries:["GI"]},{name:"America/Godthab",utcOffset:-180,offsetStr:"-03:00",countries:["GL"]},{name:"America/Danmarkshavn",utcOffset:0,offsetStr:"+00:00",countries:["GL"]},{name:"America/Scoresbysund",utcOffset:-60,offsetStr:"-01:00",countries:["GL"]},{name:"America/Thule",utcOffset:-240,offsetStr:"-04:00",countries:["GL"]},{name:"Europe/Athens",utcOffset:120,offsetStr:"+02:00",countries:["GR"]},{name:"Atlantic/South_Georgia",utcOffset:-120,offsetStr:"-02:00",countries:["GS"]},{name:"America/Guatemala",utcOffset:-360,offsetStr:"-06:00",countries:["GT"]},{name:"Pacific/Guam",utcOffset:600,offsetStr:"+10:00",countries:["GU","MP"]},{name:"Africa/Bissau",utcOffset:0,offsetStr:"+00:00",countries:["GW"]},{name:"America/Guyana",utcOffset:-240,offsetStr:"-04:00",countries:["GY"]},{name:"Asia/Hong_Kong",utcOffset:480,offsetStr:"+08:00",countries:["HK"]},{name:"America/Tegucigalpa",utcOffset:-360,offsetStr:"-06:00",countries:["HN"]},{name:"America/Port-au-Prince",utcOffset:-300,offsetStr:"-05:00",countries:["HT"]},{name:"Europe/Budapest",utcOffset:60,offsetStr:"+01:00",countries:["HU"]},{name:"Asia/Jakarta",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},{name:"Asia/Pontianak",utcOffset:420,offsetStr:"+07:00",countries:["ID"]},{name:"Asia/Makassar",utcOffset:480,offsetStr:"+08:00",countries:["ID"]},{name:"Asia/Jayapura",utcOffset:540,offsetStr:"+09:00",countries:["ID"]},{name:"Europe/Dublin",utcOffset:0,offsetStr:"+00:00",countries:["IE"]},{name:"Asia/Jerusalem",utcOffset:120,offsetStr:"+02:00",countries:["IL"]},{name:"Asia/Kolkata",utcOffset:330,offsetStr:"+05:30",countries:["IN"]},{name:"Indian/Chagos",utcOffset:360,offsetStr:"+06:00",countries:["IO"]},{name:"Asia/Baghdad",utcOffset:180,offsetStr:"+03:00",countries:["IQ"]},{name:"Asia/Tehran",utcOffset:210,offsetStr:"+03:30",countries:["IR"]},{name:"Atlantic/Reykjavik",utcOffset:0,offsetStr:"+00:00",countries:["IS"]},{name:"Europe/Rome",utcOffset:60,offsetStr:"+01:00",countries:["IT","SM","VA"]},{name:"America/Jamaica",utcOffset:-300,offsetStr:"-05:00",countries:["JM"]},{name:"Asia/Amman",utcOffset:120,offsetStr:"+02:00",countries:["JO"]},{name:"Asia/Tokyo",utcOffset:540,offsetStr:"+09:00",countries:["JP"]},{name:"Africa/Nairobi",utcOffset:180,offsetStr:"+03:00",countries:["KE","DJ","ER","ET","KM","MG","SO","TZ","UG","YT"]},{name:"Asia/Bishkek",utcOffset:360,offsetStr:"+06:00",countries:["KG"]},{name:"Pacific/Tarawa",utcOffset:720,offsetStr:"+12:00",countries:["KI"]},{name:"Pacific/Enderbury",utcOffset:780,offsetStr:"+13:00",countries:["KI"]},{name:"Pacific/Kiritimati",utcOffset:840,offsetStr:"+14:00",countries:["KI"]},{name:"Asia/Pyongyang",utcOffset:510,offsetStr:"+08:30",countries:["KP"]},{name:"Asia/Seoul",utcOffset:540,offsetStr:"+09:00",countries:["KR"]},{name:"America/Cayman",utcOffset:-300,offsetStr:"-05:00",countries:["KY"]},{name:"Asia/Almaty",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},{name:"Asia/Qyzylorda",utcOffset:360,offsetStr:"+06:00",countries:["KZ"]},{name:"Asia/Aqtobe",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Aqtau",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Oral",utcOffset:300,offsetStr:"+05:00",countries:["KZ"]},{name:"Asia/Beirut",utcOffset:120,offsetStr:"+02:00",countries:["LB"]},{name:"Asia/Colombo",utcOffset:330,offsetStr:"+05:30",countries:["LK"]},{name:"Africa/Monrovia",utcOffset:0,offsetStr:"+00:00",countries:["LR"]},{name:"Europe/Vilnius",utcOffset:120,offsetStr:"+02:00",countries:["LT"]},{name:"Europe/Luxembourg",utcOffset:60,offsetStr:"+01:00",countries:["LU"]},{name:"Europe/Riga",utcOffset:120,offsetStr:"+02:00",countries:["LV"]},{name:"Africa/Tripoli",utcOffset:120,offsetStr:"+02:00",countries:["LY"]},{name:"Africa/Casablanca",utcOffset:0,offsetStr:"+00:00",countries:["MA"]},{name:"Europe/Monaco",utcOffset:60,offsetStr:"+01:00",countries:["MC"]},{name:"Europe/Chisinau",utcOffset:120,offsetStr:"+02:00",countries:["MD"]},{name:"Pacific/Majuro",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},{name:"Pacific/Kwajalein",utcOffset:720,offsetStr:"+12:00",countries:["MH"]},{name:"Asia/Rangoon",utcOffset:390,offsetStr:"+06:30",countries:["MM"]},{name:"Asia/Ulaanbaatar",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},{name:"Asia/Hovd",utcOffset:420,offsetStr:"+07:00",countries:["MN"]},{name:"Asia/Choibalsan",utcOffset:480,offsetStr:"+08:00",countries:["MN"]},{name:"Asia/Macau",utcOffset:480,offsetStr:"+08:00",countries:["MO"]},{name:"America/Martinique",utcOffset:-240,offsetStr:"-04:00",countries:["MQ"]},{name:"Europe/Malta",utcOffset:60,offsetStr:"+01:00",countries:["MT"]},{name:"Indian/Mauritius",utcOffset:240,offsetStr:"+04:00",countries:["MU"]},{name:"Indian/Maldives",utcOffset:300,offsetStr:"+05:00",countries:["MV"]},{name:"America/Mexico_City",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Cancun",utcOffset:-300,offsetStr:"-05:00",countries:["MX"]},{name:"America/Merida",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Monterrey",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Matamoros",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"America/Mazatlan",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Chihuahua",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Ojinaga",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Hermosillo",utcOffset:-420,offsetStr:"-07:00",countries:["MX"]},{name:"America/Tijuana",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},{name:"America/Santa_Isabel",utcOffset:-480,offsetStr:"-08:00",countries:["MX"]},{name:"America/Bahia_Banderas",utcOffset:-360,offsetStr:"-06:00",countries:["MX"]},{name:"Asia/Kuala_Lumpur",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},{name:"Asia/Kuching",utcOffset:480,offsetStr:"+08:00",countries:["MY"]},{name:"Africa/Maputo",utcOffset:120,offsetStr:"+02:00",countries:["MZ","BI","BW","CD","MW","RW","ZM","ZW"]},{name:"Africa/Windhoek",utcOffset:120,offsetStr:"+02:00",countries:["NA"]},{name:"Pacific/Noumea",utcOffset:660,offsetStr:"+11:00",countries:["NC"]},{name:"Pacific/Norfolk",utcOffset:660,offsetStr:"+11:00",countries:["NF"]},{name:"Africa/Lagos",utcOffset:60,offsetStr:"+01:00",countries:["NG","AO","BJ","CD","CF","CG","CM","GA","GQ","NE"]},{name:"America/Managua",utcOffset:-360,offsetStr:"-06:00",countries:["NI"]},{name:"Europe/Amsterdam",utcOffset:60,offsetStr:"+01:00",countries:["NL"]},{name:"Europe/Oslo",utcOffset:60,offsetStr:"+01:00",countries:["NO","SJ"]},{name:"Asia/Kathmandu",utcOffset:345,offsetStr:"+05:45",countries:["NP"]},{name:"Pacific/Nauru",utcOffset:720,offsetStr:"+12:00",countries:["NR"]},{name:"Pacific/Niue",utcOffset:-660,offsetStr:"-11:00",countries:["NU"]},{name:"Pacific/Auckland",utcOffset:780,offsetStr:"+13:00",countries:["NZ","AQ"]},{name:"Pacific/Chatham",utcOffset:825,offsetStr:"+13:45",countries:["NZ"]},{name:"America/Panama",utcOffset:-300,offsetStr:"-05:00",countries:["PA"]},{name:"America/Lima",utcOffset:-300,offsetStr:"-05:00",countries:["PE"]},{name:"Pacific/Tahiti",utcOffset:-600,offsetStr:"-10:00",countries:["PF"]},{name:"Pacific/Marquesas",utcOffset:-570,offsetStr:"-09:30",countries:["PF"]},{name:"Pacific/Gambier",utcOffset:-540,offsetStr:"-09:00",countries:["PF"]},{name:"Pacific/Port_Moresby",utcOffset:600,offsetStr:"+10:00",countries:["PG"]},{name:"Pacific/Bougainville",utcOffset:660,offsetStr:"+11:00",countries:["PG"]},{name:"Asia/Manila",utcOffset:480,offsetStr:"+08:00",countries:["PH"]},{name:"Asia/Karachi",utcOffset:300,offsetStr:"+05:00",countries:["PK"]},{name:"Europe/Warsaw",utcOffset:60,offsetStr:"+01:00",countries:["PL"]},{name:"America/Miquelon",utcOffset:-180,offsetStr:"-03:00",countries:["PM"]},{name:"Pacific/Pitcairn",utcOffset:-480,offsetStr:"-08:00",countries:["PN"]},{name:"America/Puerto_Rico",utcOffset:-240,offsetStr:"-04:00",countries:["PR"]},{name:"Asia/Gaza",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},{name:"Asia/Hebron",utcOffset:120,offsetStr:"+02:00",countries:["PS"]},{name:"Europe/Lisbon",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},{name:"Atlantic/Madeira",utcOffset:0,offsetStr:"+00:00",countries:["PT"]},{name:"Atlantic/Azores",utcOffset:-60,offsetStr:"-01:00",countries:["PT"]},{name:"Pacific/Palau",utcOffset:540,offsetStr:"+09:00",countries:["PW"]},{name:"America/Asuncion",utcOffset:-180,offsetStr:"-03:00",countries:["PY"]},{name:"Asia/Qatar",utcOffset:180,offsetStr:"+03:00",countries:["QA","BH"]},{name:"Indian/Reunion",utcOffset:240,offsetStr:"+04:00",countries:["RE","TF"]},{name:"Europe/Bucharest",utcOffset:120,offsetStr:"+02:00",countries:["RO"]},{name:"Europe/Belgrade",utcOffset:60,offsetStr:"+01:00",countries:["RS","BA","HR","ME","MK","SI"]},{name:"Europe/Kaliningrad",utcOffset:120,offsetStr:"+02:00",countries:["RU"]},{name:"Europe/Moscow",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Simferopol",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Volgograd",utcOffset:180,offsetStr:"+03:00",countries:["RU"]},{name:"Europe/Samara",utcOffset:240,offsetStr:"+04:00",countries:["RU"]},{name:"Asia/Yekaterinburg",utcOffset:300,offsetStr:"+05:00",countries:["RU"]},{name:"Asia/Omsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},{name:"Asia/Novosibirsk",utcOffset:360,offsetStr:"+06:00",countries:["RU"]},{name:"Asia/Novokuznetsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},{name:"Asia/Krasnoyarsk",utcOffset:420,offsetStr:"+07:00",countries:["RU"]},{name:"Asia/Irkutsk",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},{name:"Asia/Chita",utcOffset:480,offsetStr:"+08:00",countries:["RU"]},{name:"Asia/Yakutsk",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},{name:"Asia/Khandyga",utcOffset:540,offsetStr:"+09:00",countries:["RU"]},{name:"Asia/Vladivostok",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Sakhalin",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Ust-Nera",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Magadan",utcOffset:600,offsetStr:"+10:00",countries:["RU"]},{name:"Asia/Srednekolymsk",utcOffset:660,offsetStr:"+11:00",countries:["RU"]},{name:"Asia/Kamchatka",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},{name:"Asia/Anadyr",utcOffset:720,offsetStr:"+12:00",countries:["RU"]},{name:"Asia/Riyadh",utcOffset:180,offsetStr:"+03:00",countries:["SA","KW","YE"]},{name:"Pacific/Guadalcanal",utcOffset:660,offsetStr:"+11:00",countries:["SB"]},{name:"Indian/Mahe",utcOffset:240,offsetStr:"+04:00",countries:["SC"]},{name:"Africa/Khartoum",utcOffset:180,offsetStr:"+03:00",countries:["SD","SS"]},{name:"Europe/Stockholm",utcOffset:60,offsetStr:"+01:00",countries:["SE"]},{name:"Asia/Singapore",utcOffset:480,offsetStr:"+08:00",countries:["SG"]},{name:"America/Paramaribo",utcOffset:-180,offsetStr:"-03:00",countries:["SR"]},{name:"America/El_Salvador",utcOffset:-360,offsetStr:"-06:00",countries:["SV"]},{name:"Asia/Damascus",utcOffset:120,offsetStr:"+02:00",countries:["SY"]},{name:"America/Grand_Turk",utcOffset:-240,offsetStr:"-04:00",countries:["TC"]},{name:"Africa/Ndjamena",utcOffset:60,offsetStr:"+01:00",countries:["TD"]},{name:"Indian/Kerguelen",utcOffset:300,offsetStr:"+05:00",countries:["TF"]},{name:"Asia/Bangkok",utcOffset:420,offsetStr:"+07:00",countries:["TH","KH","LA","VN"]},{name:"Asia/Dushanbe",utcOffset:300,offsetStr:"+05:00",countries:["TJ"]},{name:"Pacific/Fakaofo",utcOffset:780,offsetStr:"+13:00",countries:["TK"]},{name:"Asia/Dili",utcOffset:540,offsetStr:"+09:00",countries:["TL"]},{name:"Asia/Ashgabat",utcOffset:300,offsetStr:"+05:00",countries:["TM"]},{name:"Africa/Tunis",utcOffset:60,offsetStr:"+01:00",countries:["TN"]},{name:"Pacific/Tongatapu",utcOffset:780,offsetStr:"+13:00",countries:["TO"]},{name:"Europe/Istanbul",utcOffset:120,offsetStr:"+02:00",countries:["TR"]},{name:"America/Port_of_Spain",utcOffset:-240,offsetStr:"-04:00",countries:["TT","AG","AI","BL","DM","GD","GP","KN","LC","MF","MS","VC","VG","VI"]},{name:"Pacific/Funafuti",utcOffset:720,offsetStr:"+12:00",countries:["TV"]},{name:"Asia/Taipei",utcOffset:480,offsetStr:"+08:00",countries:["TW"]},{name:"Europe/Kiev",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Europe/Uzhgorod",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Europe/Zaporozhye",utcOffset:120,offsetStr:"+02:00",countries:["UA"]},{name:"Pacific/Wake",utcOffset:720,offsetStr:"+12:00",countries:["UM"]},{name:"America/New_York",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Detroit",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Kentucky/Louisville",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Kentucky/Monticello",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Indianapolis",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Vincennes",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Winamac",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Marengo",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Petersburg",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Indiana/Vevay",utcOffset:-300,offsetStr:"-05:00",countries:["US"]},{name:"America/Chicago",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Indiana/Tell_City",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Indiana/Knox",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Menominee",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/Center",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/New_Salem",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/North_Dakota/Beulah",utcOffset:-360,offsetStr:"-06:00",countries:["US"]},{name:"America/Denver",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Boise",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Phoenix",utcOffset:-420,offsetStr:"-07:00",countries:["US"]},{name:"America/Los_Angeles",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},{name:"America/Metlakatla",utcOffset:-480,offsetStr:"-08:00",countries:["US"]},{name:"America/Anchorage",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Juneau",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Sitka",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Yakutat",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Nome",utcOffset:-540,offsetStr:"-09:00",countries:["US"]},{name:"America/Adak",utcOffset:-600,offsetStr:"-10:00",countries:["US"]},{name:"Pacific/Honolulu",utcOffset:-600,offsetStr:"-10:00",countries:["US","UM"]},{name:"America/Montevideo",utcOffset:-180,offsetStr:"-03:00",countries:["UY"]},{name:"Asia/Samarkand",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},{name:"Asia/Tashkent",utcOffset:300,offsetStr:"+05:00",countries:["UZ"]},{name:"America/Caracas",utcOffset:-270,offsetStr:"-04:30",countries:["VE"]},{name:"Asia/Ho_Chi_Minh",utcOffset:420,offsetStr:"+07:00",countries:["VN"]},{name:"Pacific/Efate",utcOffset:660,offsetStr:"+11:00",countries:["VU"]},{name:"Pacific/Wallis",utcOffset:720,offsetStr:"+12:00",countries:["WF"]},{name:"Pacific/Apia",utcOffset:840,offsetStr:"+14:00",countries:["WS"]},{name:"Africa/Johannesburg",utcOffset:120,offsetStr:"+02:00",countries:["ZA","LS","SZ"]}]}],link:function(e,n,t,a){e.updateModel=function(e){a.$setViewValue(e)}},templateUrl:"app/core/directives/ms-timezone/ms-timezone.html"}})}(),function(){"use strict";angular.module("app.core").controller("MsWidgetEngineCounterController",function(){var i=this;i.filter=[],i.filtered=!1,i.fontSize=20,i.label="",i.getCount=function(e){var n=0;if(e){i.fontSize=e.attrs[r]&&e.attrs[r].value?parseInt(e.attrs[r].value)-parseInt(e.attrs[r].value)%2:20;var t=e.attrs.find(function(e){return"attrChannel"===e.name});if(t||e.attrs.push({name:"attrChannel",value:"voice"}),"voice"!==e.attrs[l].value?"talking"===e.attrs[s].value?i.label="Opened":"answered"===e.attrs[s].value?i.label="Managed":i.label=e.attrs[s].value:i.label=e.attrs[s].value,e.attrs[l].value.toLowerCase().includes("voice")){e.attrs[o].value&&e.attrs[o].value.length?(i.filtered=!0,i.filter=_.intersection(e.voiceQueuesSelected,e.attrs[o].value)):(i.filtered=!1,i.filter=e.voiceQueuesSelected);for(var a=0;a<e.voiceQueues.rows.length;a+=1)_.includes(i.filter,e.voiceQueues.rows[a].id)&&(n+=e.voiceQueues.rows[a][e.attrs[s].value]?parseInt(e.voiceQueues.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("chat")){e.attrs[g].value&&e.attrs[g].value.length?(i.filtered=!0,i.filter=_.intersection(e.chatWebsitesSelected,e.attrs[g].value)):(i.filtered=!1,i.filter=e.chatWebsitesSelected);for(var a=0;a<e.chatWebsites.rows.length;a+=1)_.includes(i.filter,e.chatWebsites.rows[a].id)&&(n+=e.chatWebsites.rows[a][e.attrs[s].value]?parseInt(e.chatWebsites.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("fax")){e.attrs[c].value&&e.attrs[c].value.length?(i.filtered=!0,i.filter=_.intersection(e.faxAccountsSelected,e.attrs[c].value)):(i.filtered=!1,i.filter=e.faxAccountsSelected);for(var a=0;a<e.faxAccounts.rows.length;a+=1)_.includes(i.filter,e.faxAccounts.rows[a].id)&&(n+=e.faxAccounts.rows[a][e.attrs[s].value]?parseInt(e.faxAccounts.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("mail")){e.attrs[d].value&&e.attrs[d].value.length?(i.filtered=!0,i.filter=_.intersection(e.mailAccountsSelected,e.attrs[d].value)):(i.filtered=!1,i.filter=e.mailAccountsSelected);for(var a=0;a<e.mailAccounts.rows.length;a+=1)_.includes(i.filter,e.mailAccounts.rows[a].id)&&(n+=e.mailAccounts.rows[a][e.attrs[s].value]?parseInt(e.mailAccounts.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("openchannel")){e.attrs[u].value&&e.attrs[u].value.length?(i.filtered=!0,i.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[u].value)):(i.filtered=!1,i.filter=e.openchannelAccountsSelected);for(var a=0;a<e.openchannelAccounts.rows.length;a+=1)_.includes(i.filter,e.openchannelAccounts.rows[a].id)&&(n+=e.openchannelAccounts.rows[a][e.attrs[s].value]?parseInt(e.openchannelAccounts.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("whatsapp")){e.attrs[p].value&&e.attrs[p].value.length?(i.filtered=!0,i.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[p].value)):(i.filtered=!1,i.filter=e.whatsappAccountsSelected);for(var a=0;a<e.whatsappAccounts.rows.length;a+=1)_.includes(i.filter,e.whatsappAccounts.rows[a].id)&&(n+=e.whatsappAccounts.rows[a][e.attrs[s].value]?parseInt(e.whatsappAccounts.rows[a][e.attrs[s].value]):0)}else if(e.attrs[l].value.toLowerCase().includes("sms")){e.attrs[m].value&&e.attrs[m].value.length?(i.filtered=!0,i.filter=_.intersection(e.smsAccountsSelected,e.attrs[m].value)):(i.filtered=!1,i.filter=e.smsAccountsSelected);for(var a=0;a<e.smsAccounts.rows.length;a+=1)_.includes(i.filter,e.smsAccounts.rows[a].id)&&(n+=e.smsAccounts.rows[a][e.attrs[s].value]?parseInt(e.smsAccounts.rows[a][e.attrs[s].value]):0)}}return n};var s=0,o=1,r=2,l=3,d=4,c=5,m=6,u=7,p=8,g=9})}(),function(){"use strict";function e(r,e){var l=this;l.filter=[],l.filtered=!1,l.properties=[],l.multiBarChart={labels:["QUEUE_NAME"],series:["TOTAL"],data:[[50]],options:{responsive:!0,legend:{display:!0,fontColor:"#2196f3"},scales:{xAxes:[{gridLines:{display:!0},ticks:{fontColor:"#2196f3",stepSize:1,beginAtZero:!0}}],yAxes:[{gridLines:{display:!1},ticks:{fontColor:"#2196f3"}}]}}},l.getMultiBarChart=function(e){e&&(e.attrs&&function(e){switch(l.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[4].value){case"voice":e.attrs[3].value&&e.attrs[3].value.length?(l.filtered=!0,l.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(l.filtered=!1,l.filter=e.voiceQueuesSelected);break;case"sms":e.attrs[7].value&&e.attrs[7].value.length?(l.filtered=!0,l.filter=_.intersection(e.smsAccountsSelected,e.attrs[7].value)):(l.filtered=!1,l.filter=e.smsAccountsSelected);break;case"mail":e.attrs[5].value&&e.attrs[5].value.length?(l.filtered=!0,l.filter=_.intersection(e.mailAccountsSelected,e.attrs[5].value)):(l.filtered=!1,l.filter=e.mailAccountsSelected);break;case"chat":e.attrs[10].value&&e.attrs[10].value.length?(l.filtered=!0,l.filter=_.intersection(e.chatWebsitesSelected,e.attrs[10].value)):(l.filtered=!1,l.filter=e.chatWebsitesSelected);break;case"fax":e.attrs[6].value&&e.attrs[6].value.length?(l.filtered=!0,l.filter=_.intersection(e.faxAccountsSelected,e.attrs[6].value)):(l.filtered=!1,l.filter=e.faxAccountsSelected);break;case"openchannel":e.attrs[8].value&&e.attrs[8].value.length?(l.filtered=!0,l.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[8].value)):(l.filtered=!1,l.filter=e.openchannelAccountsSelected);break;case"whatsapp":e.attrs[9].value&&e.attrs[9].value.length?(l.filtered=!0,l.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[9].value)):(l.filtered=!1,l.filter=e.whatsappAccountsSelected);break;default:e.attrs[3].value&&e.attrs[3].value.length?(l.filtered=!0,l.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(l.filtered=!1,l.filter=e.voiceQueuesSelected)}if(l.multiBarChart.series.length>l.properties.length){var n=l.multiBarChart.series.length-l.properties.length;l.multiBarChart.series.splice(0,n),l.multiBarChart.data.splice(0,n)}for(var t=0;t<l.properties.length;t+=1){var a="";if(a="voice"!==e.attrs[4].value?"talking"===l.properties[t]?"Opened":"answered"===l.properties[t]?"Managed":l.properties[t]:l.properties[t],l.multiBarChart.series[t]=r.instant("TOOLS."+a.toUpperCase()),_.isNil(l.multiBarChart.data[t])&&(l.multiBarChart.data[t]=[]),l.multiBarChart.labels.length>l.filter.length){var i=l.multiBarChart.labels.length-l.filter.length;l.multiBarChart.labels.splice(0,i),l.multiBarChart.data[t].splice(0,i)}switch(e.attrs[4].value){case"voice":for(var s=0,o=0;s<e.voiceQueues.rows.length;s+=1)_.includes(l.filter,e.voiceQueues.rows[s].id)&&(l.multiBarChart.labels[o]=e.voiceQueues.rows[s].name,l.multiBarChart.data[t][o]=e.voiceQueues.rows[s][l.properties[t]]?parseInt(e.voiceQueues.rows[s][l.properties[t]]):0,o+=1);break;case"sms":for(var s=0,o=0;s<e.smsAccounts.rows.length;s+=1)_.includes(l.filter,e.smsAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.smsAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.smsAccounts.rows[s][l.properties[t]]?parseInt(e.smsAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"chat":for(var s=0,o=0;s<e.chatWebsites.rows.length;s+=1)_.includes(l.filter,e.chatWebsites.rows[s].id)&&(l.multiBarChart.labels[o]=e.chatWebsites.rows[s].name,l.multiBarChart.data[t][o]=e.chatWebsites.rows[s][l.properties[t]]?parseInt(e.chatWebsites.rows[s][l.properties[t]]):0,o+=1);break;case"fax":for(var s=0,o=0;s<e.faxAccounts.rows.length;s+=1)_.includes(l.filter,e.faxAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.faxAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.faxAccounts.rows[s][l.properties[t]]?parseInt(e.faxAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"mail":for(var s=0,o=0;s<e.mailAccounts.rows.length;s+=1)_.includes(l.filter,e.mailAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.mailAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.mailAccounts.rows[s][l.properties[t]]?parseInt(e.mailAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"openchannel":for(var s=0,o=0;s<e.openchannelAccounts.rows.length;s+=1)_.includes(l.filter,e.openchannelAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.openchannelAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.openchannelAccounts.rows[s][l.properties[t]]?parseInt(e.openchannelAccounts.rows[s][l.properties[t]]):0,o+=1);break;case"whatsapp":for(var s=0,o=0;s<e.whatsappAccounts.rows.length;s+=1)_.includes(l.filter,e.whatsappAccounts.rows[s].id)&&(l.multiBarChart.labels[o]=e.whatsappAccounts.rows[s].name,l.multiBarChart.data[t][o]=e.whatsappAccounts.rows[s][l.properties[t]]?parseInt(e.whatsappAccounts.rows[s][l.properties[t]]):0,o+=1);break;default:for(var s=0,o=0;s<e.voiceQueues.rows.length;s+=1)_.includes(l.filter,e.voiceQueues.rows[s].id)&&(l.multiBarChart.labels[o]=e.voiceQueues.rows[s].name,l.multiBarChart.data[t][o]=e.voiceQueues.rows[s][l.properties[t]]?parseInt(e.voiceQueues.rows[s][l.properties[t]]):0,o+=1)}}}(e),e.foreground&&function(e){l.multiBarChart.options.legend.fontColor=e.foreground;for(var n=0;n<l.multiBarChart.options.scales.xAxes.length;n+=1)l.multiBarChart.options.scales.xAxes[n].ticks.fontColor=e.foreground;for(var t=0;t<l.multiBarChart.options.scales.yAxes.length;t+=1)l.multiBarChart.options.scales.yAxes[t].ticks.fontColor=e.foreground}(e))}}e.$inject=["$translate","socket"],angular.module("app.core").controller("MsWidgetEngineMultibarChartController",e)}(),function(){"use strict";function e(s){var o=this;o.filter=[],o.filtered=!1,o.properties=[],o.pieChart={labels:["ANSWERED"],data:[30],options:{responsive:!0,legend:{display:!0}}},o.getPieChart=function(e){e&&(e.attrs&&function(e){switch(o.properties=_.map(_.filter(e.attrs,function(e){return e.name&&0<=e.name.indexOf("attrSerie")&&e.value&&"null"!==e.value}),"value"),e.attrs[4].value){case"voice":e.attrs[3].value&&e.attrs[3].value.length?(o.filtered=!0,o.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(o.filtered=!1,o.filter=e.voiceQueuesSelected);break;case"sms":e.attrs[7].value&&e.attrs[7].value.length?(o.filtered=!0,o.filter=_.intersection(e.smsAccountsSelected,e.attrs[7].value)):(o.filtered=!1,o.filter=e.smsAccountsSelected);break;case"mail":e.attrs[5].value&&e.attrs[5].value.length?(o.filtered=!0,o.filter=_.intersection(e.mailAccountsSelected,e.attrs[5].value)):(o.filtered=!1,o.filter=e.mailAccountsSelected);break;case"chat":e.attrs[10].value&&e.attrs[10].value.length?(o.filtered=!0,o.filter=_.intersection(e.chatWebsitesSelected,e.attrs[10].value)):(o.filtered=!1,o.filter=e.chatWebsitesSelected);break;case"fax":e.attrs[6].value&&e.attrs[6].value.length?(o.filtered=!0,o.filter=_.intersection(e.faxAccountsSelected,e.attrs[6].value)):(o.filtered=!1,o.filter=e.faxAccountsSelected);break;case"openchannel":e.attrs[8].value&&e.attrs[8].value.length?(o.filtered=!0,o.filter=_.intersection(e.openchannelAccountsSelected,e.attrs[8].value)):(o.filtered=!1,o.filter=e.openchannelAccountsSelected);break;case"whatsapp":e.attrs[9].value&&e.attrs[9].value.length?(o.filtered=!0,o.filter=_.intersection(e.whatsappAccountsSelected,e.attrs[9].value)):(o.filtered=!1,o.filter=e.whatsappAccountsSelected);break;default:e.attrs[3].value&&e.attrs[3].value.length?(o.filtered=!0,o.filter=_.intersection(e.voiceQueuesSelected,e.attrs[3].value)):(o.filtered=!1,o.filter=e.voiceQueuesSelected)}if(o.pieChart.labels.length>o.properties.length){var n=o.pieChart.labels.length-o.properties.length;o.pieChart.labels.splice(0,n),o.pieChart.data.splice(0,n)}for(var t=0,a=0;t<o.properties.length;t+=1){switch("voice"!==e.attrs[4].value?"talking"===o.properties[t]?o.pieChart.labels[t]=s.instant("TOOLS.OPENED"):"answered"===o.properties[t]?o.pieChart.labels[t]=s.instant("TOOLS.MANAGED"):o.pieChart.labels[t]=s.instant("TOOLS."+o.properties[t].toUpperCase()):o.pieChart.labels[t]=s.instant("TOOLS."+o.properties[t].toUpperCase()),e.attrs[4].value){case"voice":for(var i=0;i<e.voiceQueues.rows.length;i+=1)_.includes(o.filter,e.voiceQueues.rows[i].id)&&(a+=e.voiceQueues.rows[i][o.properties[t]]?parseInt(e.voiceQueues.rows[i][o.properties[t]]):0);break;case"sms":for(var i=0;i<e.smsAccounts.rows.length;i+=1)_.includes(o.filter,e.smsAccounts.rows[i].id)&&(a+=e.smsAccounts.rows[i][o.properties[t]]?parseInt(e.smsAccounts.rows[i][o.properties[t]]):0);break;case"chat":for(var i=0;i<e.chatWebsites.rows.length;i+=1)_.includes(o.filter,e.chatWebsites.rows[i].id)&&(a+=e.chatWebsites.rows[i][o.properties[t]]?parseInt(e.chatWebsites.rows[i][o.properties[t]]):0);break;case"fax":for(var i=0;i<e.faxAccounts.rows.length;i+=1)_.includes(o.filter,e.faxAccounts.rows[i].id)&&(a+=e.faxAccounts.rows[i][o.properties[t]]?parseInt(e.faxAccounts.rows[i][o.properties[t]]):0);break;case"mail":for(var i=0;i<e.mailAccounts.rows.length;i+=1)_.includes(o.filter,e.mailAccounts.rows[i].id)&&(a+=e.mailAccounts.rows[i][o.properties[t]]?parseInt(e.mailAccounts.rows[i][o.properties[t]]):0);break;case"openchannel":for(var i=0;i<e.openchannelAccounts.rows.length;i+=1)_.includes(o.filter,e.openchannelAccounts.rows[i].id)&&(a+=e.openchannelAccounts.rows[i][o.properties[t]]?parseInt(e.openchannelAccounts.rows[i][o.properties[t]]):0);break;case"whatsapp":for(var i=0;i<e.whatsappAccounts.rows.length;i+=1)_.includes(o.filter,e.whatsappAccounts.rows[i].id)&&(a+=e.whatsappAccounts.rows[i][o.properties[t]]?parseInt(e.whatsappAccounts.rows[i][o.properties[t]]):0);break;default:for(var i=0;i<e.voiceQueues.rows.length;i+=1)_.includes(o.filter,e.voiceQueues.rows[i].id)&&(a+=e.voiceQueues.rows[i][o.properties[t]]?parseInt(e.voiceQueues.rows[i][o.properties[t]]):0)}o.pieChart.data[t]=a,a=0}}(e),e.foreground&&(n=e,o.pieChart.options.legend.fontColor=n.foreground));var n}}e.$inject=["$translate"],angular.module("app.core").controller("MsWidgetEnginePieChartController",e)}(),function(){"use strict";function e(e,t,a,i){var s=this;function n(e){s.results=e||{count:0,rows:[]}}function o(){s.query.offset=(s.query.page-1)*s.query.limit,s.promise=i[s.reportRoute].run(s.query,n).$promise}s.countDown=0,s.refresh=0,s.title="",s.columns=[],s.results={rows:[],count:0},s.query={limit:10,page:1,startDate:moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),endDate:moment().endOf("day").format("YYYY-MM-DD HH:mm:ss"),output:"web"},s.onInit=function e(n){n&&n.attrs&&(n.attrs[0]&&n.attrs[0].value&&(s.query.id=n.attrs[0].value,i.analyticFieldReport.get({fields:"field,alias",nolimit:!0,DefaultReportId:"default"===n.attrs[0].type?n.attrs[0].value:void 0,CustomReportId:"custom"===n.attrs[0].type?n.attrs[0].value:void 0}).$promise.then(function(e){switch(e&&e.rows&&(s.columns=e.rows),n.attrs[0].type){case"default":s.reportRoute="analyticDefaultReport";break;case"custom":s.reportRoute="analyticCustomReport"}return i[s.reportRoute].get({id:n.attrs[0].value,fields:"id,name"}).$promise}).then(function(e){e&&e.name&&(s.title=e.name),o()}).catch(function(e){console.log(e)})),n.attrs[1]&&n.attrs[1].value&&(s.refresh=parseInt(n.attrs[1].value),!_.isNaN(s.refresh)&&0<s.refresh?(s.countDown=parseInt(n.attrs[1].value),s.interval=a(function(){s.countDown-=1},1e3,0),s.timeout=t(function(){s.interval&&a.cancel(s.interval),e(n)},1e3*s.refresh)):(s.interval&&a.cancel(s.interval),s.timeout&&t.cancel(s.timeout))))},s.getResults=o,s.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n},e.$on("$destroy",function(){s.interval&&a.cancel(s.interval),s.timeout&&t.cancel(s.timeout)})}e.$inject=["$scope","$timeout","$interval","api"],angular.module("app.core").controller("MsWidgetEngineWebReportController",e)}(),function(){"use strict";function e(e,n){this.getTrustedURL=function(e){return n.trustAsResourceUrl(e)}}function n(e){return{restrict:"E",scope:{config:"=?",onEdit:"&?",onDelete:"&?"},require:"msWidgetEngine",controller:"MsWidgetEngineController",controllerAs:"vm",bindToController:!0,templateUrl:"app/core/directives/ms-widget-engine/ms-widget-engine.html"}}e.$inject=["$mdDialog","$sce"],n.$inject=["$document"],angular.module("app.core").controller("MsWidgetEngineController",e).directive("msWidgetEngine",n)}(),function(){"use strict";function e(e,n){var t=this;t.flipped=!1,t.flip=function(){if(!angular.isDefined(e.flippable)||!0!==e.flippable)return;t.flipped=!t.flipped,n.toggleClass("flipped",t.flipped)}}e.$inject=["$scope","$element"],angular.module("app.core").controller("MsWidgetController",e).directive("msWidget",function(){return{restrict:"E",scope:{flippable:"=?"},controller:"MsWidgetController",transclude:!0,compile:function(e){return e.addClass("ms-widget"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)})}}}}).directive("msWidgetFront",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-front"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)}),e.flipWidget=a.flip}}}}).directive("msWidgetBack",function(){return{restrict:"E",require:"^msWidget",transclude:!0,compile:function(e){return e.addClass("ms-widget-back"),function(e,n,t,a,i){i(function(e){n.empty(),n.append(e)}),e.flipWidget=a.flip}}}})}(),function(){"use strict";function e(s,n,o,r){return{restrict:"A",require:"?ngModel",link:function(t,a,e,i){o.isAdmin()||o.isTelephone()||(""!==e.privacy||o.getCurrentUser().privacyEnabled)&&!1!==t.$eval(e.privacy)&&(i?(i.$formatters.push(function(e){if(!e)return e;var n=r.mask(e);return i.$setViewValue(n),i.$render(),i.$viewValue}),i.$parsers.push(function(){return i.$modelValue}),a[0].disabled=!0):n(function(){s(a.contents())(t);var e=a.text();if(e){var n=r.mask(e);a.text(n)}}))}}}e.$inject=["$compile","$timeout","Auth","privacyManager"],angular.module("app.core").directive("privacy",e)}(),function(){"use strict";function e(d,c,t,h){function f(e,n){return"motion2.home."+e+":"+n}function b(e){return _.capitalize(e)+("chat"===e?"Website":"Account")+"Id"}function A(e){return"chat"===e?"Website":"Account"}function E(e,n,t){var a=f(n,t);h.set(a,e)}return{addAccount:function(r,e){var l=e.accounts,d=e.accountId,c=e.filters,m=e.query,u=e.userId,n="get"+_.capitalize(r)+("chat"===r?"Websites":"Accounts"),p=b(r),g=A(r),v=l.rows.length===m[p].length;return t.user[n]({id:u,nolimit:!0}).$promise.then(function(e){var n,t,a,i,s;if(l.rows=e.rows,l.count=e.count,_.find(c,["name",g]).options=l.rows,v){var o=(t=d,a=f(n=r,u),i=b(n),(s=h.get(a)).query&&s.query[i]&&s.query[i].push(t),s);o&&E(o,r,u),m[p].push(d)}return v})},removeAccount:function(t,e){var n=e.accounts,a=e.accountId,i=e.filters,s=e.query,o=e.userId,r=b(t),l=s[r].includes(a);return c.resolve().then(function(){var e=function(e,n,t){var a=f(e,n),i=b(e),s=h.get(a);if(s.query&&s.query[i]){var o=s.query[i].indexOf(t);-1<o&&s.query[i].splice(o,1)}return s}(t,o,a);e||(e=s),s[r]=e.query[r],_.remove(n.rows,function(e){return e.id===a}),n.count=n.rows.length,_.find(i,function(e){var n=A(t);return e.name===n}).options=n.rows,1===n.count&&(e.query[r]=[n.rows[0].id],s[r]=[n.rows[0].id]),E(e,t,o)}).then(function(){var e=A(t);d.$broadcast("ms-quick-filter:update",{filters:[e],update:l})})}}}e.$inject=["$rootScope","$q","api","localStorageManager"],angular.module("app.core").factory("agentAccountAssociationManager",e)}(),function(){"use strict";function e(o,r,i,l,d){var e={get:function(s,a){return o(function(n,t){0===a.offset&&(s=void 0);var e=_.merge({},a);i.cmContact.getJourney(e).$promise.then(function(e){var a,n=_(e.rows).uniqBy(function(e){return e.channel}).map("channel").value();return(a=n,o(function(e,n){var t=a.map(function(n){if("voice"!==n){var e="get"+_.startCase(n)+("chat"===n?"Websites":"Accounts");return i.user[e]({id:l.getCurrentUser().id,attributes:["id","name"],nolimit:!0}).$promise.then(function(e){c[n]=e.rows})}});return o.all(t).then(function(){e()}).catch(function(e){n(e)})})).then(function(){return e.rows.forEach(function(e){var n;e.canOpen=function(e){switch(e.channel){case"chat":return!!c.chat&&_.some(c.chat,["id",e.ChatWebsiteId]);case"fax":return!!c.fax&&_.some(c.fax,["id",e.FaxAccountId]);case"mail":return!!c.mail&&_.some(c.mail,["id",e.MailAccountId]);case"openchannel":return!!c.openchannel&&_.some(c.openchannel,["id",e.OpenchannelAccountId]);case"sms":return!!c.sms&&_.some(c.sms,["id",e.SmsAccountId]);case"voice":return!0;case"whatsapp":return!!c.whatsapp&&_.some(c.whatsapp,["id",e.WhatsappAccountId]);default:return!1}}(e),e.dispositionsValues=(n=e).disposition?"("+_.compact([n.disposition,n.secondDisposition,n.thirdDisposition]).join(" - ")+")":"("+r.instant("DASHBOARDS.NO_DISPOSITION_SET")+")",e.style=function(e){switch(e.channel){case"chat":return{color:"green-A700",icon:"icon-hangouts"};case"fax":return{color:"blue-grey-A200",icon:"icon-deskphone"};case"mail":return{color:"teal",icon:"icon-email"};case"openchannel":return{color:"amber-A200",icon:"icon-google-earth"};case"sms":return{color:"orange",icon:"icon-message-text"};case"voice":return{color:"blue-A700",icon:"icon-phone"};case"whatsapp":return{color:"lime-A700",icon:"icon-whatsapp"}}}(e)}),a=s,i=e,o(function(e,n){try{var t={journey:a?_.union(a,i.rows):i.rows};t.loadMore=0<i.count-t.journey.length,e(t)}catch(e){n(e)}});var a,i})}).then(function(e){n(e)}).catch(function(e){d.error({title:r.instant("CONTACTMANAGER.CUSTOMER_JOURNEY"),msg:r.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),t(e)})})},getQuery:function(){return{range:{from:moment().subtract(3,"M").startOf("month").format("YYYY-MM-DD HH:mm:ss"),to:moment().endOf("month").format("YYYY-MM-DD HH:mm:ss")},limit:10,offset:0}},getQuickFilters:function(){return[{name:"Channel",key:"channel",type:"select",label:"INTEGRATIONS.CHANNEL",customOptions:[{value:void 0,translate:"DASHBOARDS.ALL"},{value:"voice",translate:"DASHBOARDS.VOICE"},{value:"chat",translate:"DASHBOARDS.CHAT"},{value:"mail",translate:"DASHBOARDS.MAIL"},{value:"sms",translate:"DASHBOARDS.SMS"},{value:"fax",translate:"DASHBOARDS.FAX"},{value:"openchannel",translate:"DASHBOARDS.OPENCHANNEL"},{value:"whatsapp",translate:"DASHBOARDS.WHATSAPP"}]},{name:"Start Date",key:"range",type:"date",label:"DASHBOARDS.SELECT_DATE",useFromToKeys:!0}]}},c={};return e}e.$inject=["$q","$translate","api","Auth","toasty"],angular.module("app.core").factory("customerJourneyManager",e)}(),function(){"use strict";function e(p,e){var g={localizationMap:e,setSelectedDate:function(e){var n=e.$gte?new Date(moment.utc(e.$gte).format("YYYY-MM-DD")):new Date(moment.utc(e.from).format("YYYY-MM-DD")),t=e.$lte?new Date(moment.utc(e.$lte).format("YYYY-MM-DD")):new Date(moment.utc(e.to).format("YYYY-MM-DD")),a={dateStart:new Date(n.getFullYear(),n.getMonth(),n.getDate()),dateEnd:new Date(t.getFullYear(),t.getMonth(),t.getDate())};return a.selectedTemplateName=(i=a,moment(i.dateStart).isSame(i.dateEnd)?(u=i,moment().startOf("day").isSame(u.dateStart)?g.localizationMap.Today:(m=i,moment().subtract(1,"days").startOf("day").isSame(m.dateStart)?g.localizationMap.Yesterday:p("date")(i.dateStart,"dd MMM yyyy"))):(c=i,moment().startOf("isoWeek").isSame(c.dateStart,"day")&&moment().endOf("isoWeek").isSame(c.dateEnd,"day")?g.localizationMap["This Week"]:(d=i,moment().subtract(1,"weeks").startOf("isoWeek").isSame(d.dateStart,"day")&&moment().subtract(1,"weeks").endOf("isoWeek").isSame(d.dateEnd,"day")?g.localizationMap["Last Week"]:(l=i,moment().startOf("month").isSame(l.dateStart,"day")&&moment().endOf("month").isSame(l.dateEnd,"day")?g.localizationMap["This Month"]:(r=i,moment().subtract(1,"months").startOf("month").isSame(r.dateStart,"day")&&moment().subtract(1,"months").endOf("month").isSame(r.dateEnd,"day")?g.localizationMap["Last Month"]:(o=i,moment().startOf("year").isSame(o.dateStart,"day")&&moment().endOf("year").isSame(o.dateEnd,"day")?g.localizationMap["This Year"]:(s=i,moment().subtract(1,"years").startOf("year").isSame(s.dateStart,"day")&&moment().subtract(1,"years").endOf("year").isSame(s.dateEnd,"day")?g.localizationMap["Last Year"]:p("date")(i.dateStart,"dd"+(i.dateStart.getMonth()!==i.dateEnd.getMonth()||i.dateStart.getFullYear()!==i.dateEnd.getFullYear()?" MMM":"")+(i.dateStart.getFullYear()!==i.dateEnd.getFullYear()?" yyyy":""))+" - "+p("date")(i.dateEnd,"dd MMM yyyy")))))))),a;var i,s,o,r,l,d,c,m,u}};return g}e.$inject=["$filter","dateFilterLocalizationFactory"],angular.module("app.core").factory("dateRangeManager",e)}(),function(){"use strict";function e(t,a,e,n,i){var s={},o={},r="mail",l={};function d(){if(o=n.getCurrentUser(),e.localStorage.getItem("motion2.home:"+o.id)||(r="dashboard"),l=e.localStorage.getItem("motion2.home."+r+":"+o.id)){var a=JSON.parse(l);a.drafts?o.privacyEnabled&&Object.keys(a.drafts).forEach(function(e){var n=a.drafts[e].title,t=n.split(/-(.+)/)[1].trim();a.drafts[e].title=n.replace(t,i.mask(t))}):a.drafts={},l=a}else l={drafts:{}};return l.drafts}function c(){_.isEmpty(s.drafts)?delete l.drafts:l.drafts=s.drafts,e.localStorage.setItem("motion2.home."+r+":"+o.id,JSON.stringify(l))}return s.init=function(){s.drafts=d()},s.getByInteraction=function(n){return s.drafts=d(),_.find(_.values(s.drafts),function(e){return e.interaction&&e.interaction.id===n})},s.removeByInteraction=function(n){s.drafts=d();var e=_.find(_.values(s.drafts),function(e){return e.interaction&&e.interaction.id===n});e&&(delete s.drafts[e.id],c())},s.add=function(e){s.drafts=d();var n=a.instant("DASHBOARDS.UNTITLED");e.contact?n=e.contact.firstName||e.contact.email:_.isEmpty(e.message.subject)||(n=e.message.subject);var t={type:"draft",title:e.account.key+" - "+n,channel:e.channel,content:e.message,account:e.account,interaction:e.interaction,id:_.random(1e10),openedAt:new Date,saved:!1};s.drafts[t.id]=t,c()},s.update=function(e){s.drafts=d();var n=s.drafts[e.id];n&&(n.content=e.message,s.drafts[e.id]=n,c())},s.open=function(e){s.drafts=d();var n=s.drafts[e];n&&t.$broadcast("open"+_.startCase(r)+"Draft",n)},s.remove=function(e){s.drafts=d(),s.drafts[e]&&(delete s.drafts[e],c())},s}e.$inject=["$rootScope","$translate","$window","Auth","privacyManager"],angular.module("app.core").factory("draftManager",e)}(),function(){"use strict";function e(s){var o=[];return function(n,e){e||(e="global-exception");var t,a=s.get("ClientSideLoggingService").getLogger("global-exception"),i=o.findIndex(function(e){return e===n});-1<i?(t=i,o.splice(t,1)):(!function(e){if(100<=o.length){var n=o.length-100+1;o.splice(0,n)}o.push(e)}(n),a.error(e,n))}}e.$inject=["$injector"],angular.module("app.core").factory("$exceptionHandler",e)}(),function(){"use strict";function e(o,i){function r(e,n){var t=i.localStorage.getItem(e),a=t?JSON.parse(t):{};return n?a[n]:a}function s(e,n){return i.localStorage.setItem(e,JSON.stringify(n))}return{get:r,parseInteractionsKey:function(e,n,t,a){var i="motion2.home."+e+":"+t,s=_.capitalize(e)+("chat"===e?"Website":"Account")+"Id";return o.resolve().then(function(){var e=r(i,"query");return e?((n=_.merge(n,e)).sort&&0<=n.sort.indexOf("lastMessage")&&(n=_.omit(n,"sort")),n.includeAll=!0):n.createdAt={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()},1===a.length?n[s]=[a[0].id]:0===a.length&&(n[s]=[]),n}).catch(function(e){throw e})},set:s,update:function(e,n,t){var a=r(e);t?a[t]=n:a=n;return s(e,a)}}}e.$inject=["$q","$window"],angular.module("app.core").factory("localStorageManager",e)}(),function(){"use strict";function e(i){function s(e,n){var t=i.get(),a=0;if(t)switch(n){case"email":a=t.privacyPolicyEmail;break;case"number":a=t.privacyPolicyNumber;break;default:a=t.privacyPolicyName}return _.isNil(a)?e:0===a||a>e.length?e.replace(/./g,"*"):e.substring(0,e.length-a).padEnd(e.length,"*")}function o(e){return _.startsWith(e,"<")&&_.endsWith(e,">")&&(e=e.substring(1,e.length-1)),/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}function r(e){if(_.startsWith(e,"<")&&_.endsWith(e,">")){var n=!0;e=e.substring(1,e.length-1)}var t=e.split("@")[0],a=e.split("@")[1],i="";return n&&(i+="<"),i+=s(t,"email"),i+="@",i+=s(a,"email"),n&&(i+=">"),i}return{mask:function n(e){t=e,e=t.replace(/\s\s+/g," ").trim();var t;{if(o(e))return r(e);if(/^[+]?[0-9|.|\-|\s]*$/.test(e))return s(e,"number");var a=[],i=e.split(" ");return 1===i.length?s(e):(i.forEach(function(e){a.push(n(e))}),a.join(" "))}}}}e.$inject=["settingsManager"],angular.module("app.core").factory("privacyManager",e)}(),function(){"use strict";function e(n,i){return{setPlaceholder:function(a){var e;return n(function(n){try{if(_.isEmpty(a.resources))e=i.instant("DASHBOARDS.NONE");else if(_.isEmpty(a.param))e=a.placeholder?i.instant(a.placeholder):i.instant("DASHBOARDS.CHOOSE");else if(a.param.length===a.resources.length)e=i.instant("DASHBOARDS.ALL");else{var t=a.ngValue||"id";e=_(a.resources).filter(function(e){return _.includes(a.param,e[t])}).map("name").value().join(", ")}n(e)}catch(e){n(null)}})}}}e.$inject=["$q","$translate"],angular.module("app.core").factory("quickFilterManager",e)}(),function(){"use strict";function e(h,f){var s=["available","loggedIn","paused","waiting"],o=["busy","inUse","invalid","loggedInDb","notInUse","onHold","ringing","ringInUse","talking","unavailable","unknown"],r=["pTalking","originated","message","statusMessage","dialActive","dialMethod","Trunk","startPredictive","startProgressive","erlangCalls","erlangCallToSecond","erlangAbandonmentRate","erlangBusyFactor","dialPredictiveInterval","dialPredictiveIntervalMaxThreshold","dialPredictiveIntervalMinThreshold","predictiveIntervalAvailable","predictiveIntervalTotalCalls","predictiveIntervalAnsweredCalls","predictiveIntervalDroppedCallsTimeout","predictiveIntervalDroppedCallsCallersExit","predictiveIntervalAvgHoldtime","predictiveIntervalAvgTalktime"],n=["idle","unknown","unavailable","ringing"];function t(e,n){var t=[e.chatPause,e.faxPause,e.mailPause,e.openchannelPause,e.smsPause,e.voicePause,e.whatsappPause];if(!n)return _.every(t);var a=_.filter(t);return 0<a.length&&a.length<t.length}function a(e){return!!_.isNil(e)||_.includes(n,e)}function b(e){var n;return t(e,!1)?"pause":t(e,!0)?"*pause":("idle"!==(n=e).voiceStatus&&n.voicePause?n.voiceStatus="pause":!_.every([n.chatStatus,n.faxStatus,n.mailStatus,n.openchannelStatus,n.smsStatus,n.voiceStatus,n.whatsappStatus],a))?"busy":"idle"}function A(){return moment().set("year","0000").format()}return{INCOMING_CALL_STATUS_STYLES:{ring:"blue-300-fg icon-phone-incoming",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},OUTGOING_CALL_STATUS_STYLES:{ring:"blue-300-fg icon-phone-outgoing",up:"green-300-fg icon-phone-in-talk",hangup:"red-300-fg icon-phone-hangup"},STATES_STYLES:{unknown:"grey-fg icon-phone-hangup",not_inuse:"green-300-fg icon-phone-hangup",inuse:"red-300-fg icon-phone-in-talk",busy:"red-300-fg icon-phone-locked",invalid:"grey-fg icon-phone-hangup",unavailable:"grey-fg icon-phone-hangup",ringing:"blue-300-fg icon-phone-incoming",ringinuse:"blue-300-fg icon-phone-incoming",onhold:"blue-300-fg icon-phone-paused"},STATUS_STYLES:{registered:"green-300-fg icon-checkbox-marked-circle",unregistered:"red-300-fg icon-close-circle",lagged:"red-300-fg icon-close-circle",reachable:"green-300-fg icon-checkbox-marked-circle",unreachable:"red-300-fg icon-close-circle",unknown:"grey-fg icon-minus-circle"},paginateAgents:function(e,n,t){var a={count:0,rows:[]},i=e.filter(function(e){return e.online});if(i.forEach(function(e){var n,t,a;e.globalStatus=b(e),n=e,f.getChannels().forEach(function(e){n[e+"Pause"]&&"idle"===n[e+"Status"]&&(n[e+"Status"]="pause")}),e.globalStatusDisplayValue=(a=(t=e).globalStatus,"pause"===t.globalStatus?a=t.pauseType||h.instant("VOICE.DEFAULT_PAUSE"):"*pause"===t.globalStatus&&(a="*"+(t.pauseType||h.instant("VOICE.DEFAULT_PAUSE"))),a)}),0<t.globalQueueFilter.length){var s=n.filter(function(e){return t.globalQueueFilter.includes(e.id)}),o=_.uniq(s.flatMap(function(e){return _.map(e.Agents,"id")}));i=i.filter(function(e){return o.includes(e.id)})}if(t.globalStatusFilter&&(i=i.filter(function(e){var n=e.globalStatus===t.globalStatusFilter;return"pause"===e.globalStatus&&t.pauseTypeFilter&&(n=e.pauseType===t.pauseTypeFilter),n})),t.filter){var r=t.filter.toLowerCase();i=i.filter(function(e){return(e.fullname+" "+e.internal).toLowerCase().includes(r)})}var l,d,c,m,u="-"===t.sort[0]?"DESC":"ASC",p="DESC"===u?t.sort.substring(1):t.sort;l=i,c=u,i="globalStatus"===(d=p)?(m=c,l.sort(function(e,n){return e.globalStatus===n.globalStatus?"pause"===e.globalStatus?"DESC"===m?(e.pauseType||"")<(n.pauseType||"")||e.fullname.toLowerCase()>n.fullname.toLowerCase()?1:-1:(e.pauseType||"")<(n.pauseType||"")||e.fullname.toLowerCase()>n.fullname.toLowerCase()?-1:1:"DESC"===m?e.fullname.toLowerCase()<n.fullname.toLowerCase()?1:-1:e.fullname.toLowerCase()<n.fullname.toLowerCase()?-1:1:"DESC"===m?e.globalStatus<n.globalStatus?1:-1:e.globalStatus<n.globalStatus?-1:1})):l.sort(function(e,n){var t=e[d],a=n[d];return"fullname"===d?(t=e[d].toLowerCase(),a=n[d].toLowerCase()):"lastPauseAt"===d&&(t=e.globalStatus.includes("pause")?e[d]:A(),a=n.globalStatus.includes("pause")?n[d]:A()),"DESC"===c?t<a?1:-1:t<a?-1:1}),a.count=i.length;var g=t.offset||0,v=g+t.limit;return a.rows=i.slice(g,v),a},updateQueue:function(e,n){var t=!!n.type,a=s;"inbound"===n.type?a=a.concat(o):"outbound"===n.type&&(a=a.concat(o,r));var i=_.pick(e,a);_.merge(n,i),t&&0<n.ringing&&n.available<n.loggedIn&&(n.available+=n.ringing)}}}e.$inject=["$translate","msUtils"],angular.module("app.core").factory("realtimeManager",e)}(),function(){"use strict";function e(e,n){var t={get:function(){return a},getUTCOffset:function(){return null===i?n.setting.getDate().$promise.then(function(e){return i=e.offset}):e.resolve(i)},set:function(e){e&&(a=e.toJSON())}},a={},i=null;return t}e.$inject=["$q","api"],angular.module("app.core").factory("settingsManager",e)}(),function(){"use strict";function e(c,m){function u(e,n,t){if(_.isEmpty(n))return t;for(var a=0;a<n.length;a++){var i=n[a].key,s=_.find(e,function(e){return e[i]===n[a].value});s&&(_.some(t,["id",s.id])||(s.canSelect=!1,t.push(s)))}return t}return{getResources:function(a,i,s,o,r,l,d){return c(function(t,n){o||(o={}),d||(d="get"),a[s][d](o).$promise.then(function(e){var t=e.rows;if("admin"===i.role)return t;var n=m.getSectionId(s,l);return a.userProfileSection.get({userProfileId:i.userProfileId,sectionId:n}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?t:a.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(t,{id:e.resourceId})});return u(t,r,n)}):c.resolve().then(function(){return e=s,_.includes(["voiceContext"],e)?(o.defaultEntry=1,a[s][d](o).$promise.then(function(e){return e.rows})):[];var e}).then(function(e){return u(t,r,e)})})}).then(function(e){var n={rows:_.orderBy(e,[o.sort]),count:e.length};t(n)}).catch(function(e){n(e)})})}}}e.$inject=["$q","msNavigationService"],angular.module("app.core").factory("userProfileManager",e)}(),function(){"use strict";angular.module("app.core").filter("altDate",function(){return function(e){var n=Date.now()-new Date(e);return n<36e5?moment(e).fromNow():n<864e5?moment(e).format("HH:mm"):n<6048e5?moment(e).format("dddd"):moment(e).calendar()}})}(),function(){"use strict";function e(n){return function(e){return n.trustAsHtml(e)}}e.$inject=["$sce"],angular.module("app.core").filter("toTrusted",e).filter("htmlToPlaintext",function(){return function(e){return String(e).replace(/<[^>]+>/gm,"")}}).filter("nospace",function(){return function(e){return e?e.replace(/ /g,""):""}}).filter("humanizeDoc",function(){return function(e){if(e)return"directive"===e.type?e.name.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()}):e.label||e.name}})}(),function(){"use strict";angular.module("app.core").filter("capitalize",function(){return function(e){return e?_.capitalize(e):""}})}(),function(){"use strict";angular.module("app.core").filter("filterByIds",function(){return function(e,n){if(0===e.length||!n)return e;if(0===n.length)return[];for(var t=[],a=0;a<e.length;a++){for(var i=e[a],s=!1,o=0;o<n.length;o++){var r=n[o];if(i.id===r){s=!0;break}}s&&t.push(i)}return t}})}(),function(){"use strict";angular.module("app.core").filter("filterByPropIds",function(){return function(e,n,t){if(0===e.length||!t||0===t.length)return e;for(var a=[],i=0;i<e.length;i++){for(var s=e[i],o=!1,r=0;r<t.length;r++){var l=t[r];if(-1<s[n].indexOf(l)){o=!0;break}}o&&a.push(s)}return a}})}(),function(){"use strict";angular.module("app.core").filter("getOptionByValue",function(){return function(n,e,t){if(void 0===n)return"";if(!e)return"";t||(t="option");var a=_.find(e,function(e){return e.value==n});return a?a[t]:""}})}(),function(){"use strict";angular.module("app.core").filter("orderByDate",function(){return function(e){var n=[];return angular.forEach(e,function(e){n.push(e)}),n.sort(function(e,n){return e.hasOwnProperty("openedAt")&&n.hasOwnProperty("openedAt")?e.openedAt>n.openedAt?1:-1:1}),n}})}(),function(){"use strict";angular.module("app.core").filter("secToTime",function(){return function(e){e&&(e=e.toString().replace(",",""));var n=Math.floor(e/86400),t=e%86400,a=new Date(1e3*t).toISOString().substring(11,19);return a.replace(/^(\d+)/,function(e){return(""+(Number(e)+24*n)).padStart(2,"0")})}})}(),function(){"use strict";angular.module("app.core").filter("snakecase",function(){return function(e){return e?_.snakeCase(e):""}})}(),function(){"use strict";angular.module("app.core").filter("startcase",function(){return function(e){return e?_.startCase(e):""}})}(),function(){"use strict";angular.module("app.core").filter("filterByTags",function(){return function(e,t){if(0===e.length||0===t.length)return e;var a=[];return e.forEach(function(e){var n=t.every(function(n){var t=!1;return e.tags.forEach(function(e){e.name!==n.name||(t=!0)}),t});n&&a.push(e)}),a}}).filter("filterSingleByTags",function(){return function(e,n){if(0!==e.length&&0!==n.length){if(e.length<n.length)return[];var t=[],a=n.every(function(n){var t=!1;return e.forEach(function(e){e.name!==n.name||(t=!0)}),t});return a&&t.push(e),t}}})}(),function(){"use strict";angular.module("app.core").filter("toInteger",function(){return function(e){if(e&&"string"==typeof e)return parseInt(e)}})}(),function(){"use strict";function m(e,n,t,a){this.id=Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15),this.title=e,this.body=n,this.accept=t,this.reject=a,this.close=i}function u(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)}function i(){var t=this;navigator.serviceWorker.ready.then(function(e){e.getNotifications().then(function(e){var n=_.find(e,function(e){return e.data.id===t.id});n&&n.close()})})}angular.module("app.dashboards").provider("motNotification",function(){return{$get:[function(){var d,t,c=[];"serviceWorker"in navigator&&u()?navigator.serviceWorker.register("notification.js").then(function(e){(d=e).update(),d.installing?t=d.installing:d.waiting?t=d.waiting:d.active&&(t=d.active)}).catch(function(e){console.error("Service worker registration failed",e)}):console.error("Service Worker is not supported");return navigator.serviceWorker.addEventListener("message",function(e){if(e.source===t){var n=_.find(c,{id:e.data.id});if(n)switch(e.data.action){case"accept":n.accept&&n.accept();break;case"reject":n.reject&&n.reject()}}}),{create:function(e,i,s,o,r,l){return new Promise(function(t,n){var a;u()&&(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)?(a=new m(e||"MyTitle",i||"MyBody",o,r),c.push(a),a?window.Notification.requestPermission().then(function(e){if("granted"===e)return d.showNotification(a.title,{body:a.body,requireInteraction:!0,icon:s||"assets/images/business/queueCampaigns.jpg",data:{id:a.id},actions:[{action:"accept",title:"Accept"},{action:"reject",title:"Reject"}]})}).then(function(e){if(l){for(var n=0;n<c.length;n++)c[n].close();t()}else t(a)}).catch(function(e){n(e)}):n(new Error("Notification creating error"))):t()})}}}]}})}(),function(){"use strict";function e(l,d,c){return{resolve:function(e,n){var t=e.split("@"),a=t[0],i=t[1],s=n||{};if(!a||!i)return d.error("apiResolver.resolve requires correct action parameter (ResourceName@methodName)"),!1;var o=l.defer(),r=function(e){for(var n=e.split("."),t=c,a=0;a<n.length;a++){if(angular.isUndefined(t[n[a]])){d.error('Resource part "'+n[a]+'" is not defined!'),t=!1;break}t=t[n[a]]}return t||!1}(a);r?r[i](s,function(e){o.resolve(e)},function(e){o.reject(e)}):(d.error('Resource "'+a+'" is not defined in the api service!'),o.reject('Resource "'+a+'" is not defined in the api service!'));return o.promise}}}e.$inject=["$q","$log","api"],angular.module("app.core").factory("apiResolver",e)}(),function(){"use strict";function e(e){return{showLoadingIndicator:function(){e.loadingProgress=!0},hideLoadingIndicator:function(){e.loadingProgress=!1}}}e.$inject=["$rootScope"],angular.module("app.core").factory("LoadingIndicatorService",e)}(),function(){"use strict";angular.module("app.core").provider("msApi",function(){var t=angular.injector(["ng"]).get("$log"),a="",v=[];function n(e){a=e}function i(){return a}function s(e,n){angular.isString(e)?angular.isArray(n)?v[e]={url:a+(n[0]||""),paramDefaults:n[1]||[],actions:n[2]||[],options:n[3]||{}}:t.error('"resource" must be an array and it must follow $resource definition'):t.error('"path" must be a string (eg. `dashboard.project`)')}this.setBaseUrl=n,this.getBaseUrl=i,this.getApiObject=function(){return v},this.register=s,this.$get=["$log","$q","$resource","$rootScope",function(m,u,p,g){var e={setBaseUrl:n,getBaseUrl:i,register:s,resolve:function(e,n){g.$broadcast("msApi::resolveStart");var t=e.split("@"),a=t[0],i=t[1],s=n||{};if(!a||!i)return m.error("msApi.resolve requires correct action parameter (resourceName@methodName)"),!1;var o=u.defer(),r=v[a];if(r){var l=p(r.url,r.paramDefaults,r.actions,r.options);l[i](s,function(e){o.resolve(e),g.$broadcast("msApi::resolveSuccess")},function(e){o.reject(e),g.$broadcast("msApi::resolveError")})}else m.error('Resource "'+a+'" is not defined in the api service!'),o.reject('Resource "'+a+'" is not defined in the api service!');return o.promise},request:function(e,n,t,a){g.$broadcast("msApi::requestStart");var i=e.split("@"),s=i[0],o=i[1],r=n||{};if(!s||!o)return m.error("msApi.resolve requires correct action parameter (resourceName@methodName)"),!1;var l=u.defer(),d=v[s];if(d){var c=p(d.url,d.paramDefaults,d.actions,d.options);c[o](r,function(e){g.$broadcast("msApi::requestSuccess"),l.resolve(e),angular.isDefined(t)&&angular.isFunction(t)&&t(e)},function(e){g.$broadcast("msApi::requestError"),l.reject(e),angular.isDefined(a)&&angular.isFunction(a)&&a(e)})}else m.error('Resource "'+s+'" is not defined in the api service!'),l.reject('Resource "'+s+'" is not defined in the api service!');return l.promise}};return e}]})}(),function(){"use strict";function e(l){var e=new MobileDetect(l.navigator.userAgent),d=null;return{exists:function(e,n){return-1<n.indexOf(e)},detectBrowser:function(){if(d)return d;var e=[{string:l.navigator.userAgent,subString:"Edge",versionSearch:"Edge",identity:"Edge"},{string:l.navigator.userAgent,subString:"Chrome",identity:"Chrome"},{string:l.navigator.userAgent,subString:"OmniWeb",versionSearch:"OmniWeb/",identity:"OmniWeb"},{string:l.navigator.vendor,subString:"Apple",versionSearch:"Version",identity:"Safari"},{prop:l.opera,identity:"Opera"},{string:l.navigator.vendor,subString:"iCab",identity:"iCab"},{string:l.navigator.vendor,subString:"KDE",identity:"Konqueror"},{string:l.navigator.userAgent,subString:"Firefox",identity:"Firefox"},{string:l.navigator.vendor,subString:"Camino",identity:"Camino"},{string:l.navigator.userAgent,subString:"Netscape",identity:"Netscape"},{string:l.navigator.userAgent,subString:"MSIE",identity:"Explorer",versionSearch:"MSIE"},{string:l.navigator.userAgent,subString:"Trident/7",identity:"Explorer",versionSearch:"rv"},{string:l.navigator.userAgent,subString:"Gecko",identity:"Mozilla",versionSearch:"rv"},{string:l.navigator.userAgent,subString:"Mozilla",identity:"Netscape",versionSearch:"Mozilla"}],n=[{string:l.navigator.platform,subString:"Win",identity:"Windows"},{string:l.navigator.platform,subString:"Mac",identity:"Mac"},{string:l.navigator.platform,subString:"Linux",identity:"Linux"},{string:l.navigator.platform,subString:"iPhone",identity:"iPhone"},{string:l.navigator.platform,subString:"iPod",identity:"iPod"},{string:l.navigator.platform,subString:"iPad",identity:"iPad"},{string:l.navigator.platform,subString:"Android",identity:"Android"}],i="";function t(e){for(var n=0;n<e.length;n++){var t=e[n].string,a=e[n].prop;if(i=e[n].versionSearch||e[n].identity,t){if(-1!==t.indexOf(e[n].subString))return e[n].identity}else if(a)return e[n].identity}}function a(e){var n=e.indexOf(i);if(-1!==n)return parseInt(e.substring(n+i.length+1))}var s=t(e)||"unknown-browser",o=a(l.navigator.userAgent)||a(l.navigator.appVersion)||"unknown-version",r=t(n)||"unknown-os";return s=s.toLowerCase(),o=s+"-"+o,r=r.toLowerCase(),d={browser:s,version:o,os:r}},getChannels:function(){return["chat","fax","mail","openchannel","sms","voice","whatsapp"]},guidGenerator:function(){var e=function(){return(65536*(1+Math.random())||0).toString(16).substring(1)};return e()+e()+e()+e()+e()+e()},isMobile:function(){return e.mobile()},toggleInArray:function(e,n){-1===n.indexOf(e)?n.push(e):n.splice(n.indexOf(e),1)},firstLastDayMonth:function(){return{$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()}},getEmailProviders:function(){return[{name:"Custom",value:"custom"},{name:"Gmail",value:"gmail"},{name:"Hotmail",value:"hotmail"},{name:"Yahoo",value:"yahoo"},{name:"Outlook365",value:"outlook365"}]}}}e.$inject=["$window"],angular.module("app.core").factory("msUtils",e)}(),function(){"use strict";function e(e,n){var t=this;t.themes=n.themes,t.layoutModes=[{label:"Boxed",value:"boxed"},{label:"Wide",value:"wide"}],t.layoutStyles=[{label:"Vertical Navigation",value:"verticalNavigation",figure:"/assets/images/theme-options/vertical-nav.jpg"},{label:"Vertical Navigation with Fullwidth Toolbar",value:"verticalNavigationFullwidthToolbar",figure:"/assets/images/theme-options/vertical-nav-with-full-toolbar.jpg"},{label:"Vertical Navigation with Fullwidth Toolbar 2",value:"verticalNavigationFullwidthToolbar2",figure:"/assets/images/theme-options/vertical-nav-with-full-toolbar-2.jpg"},{label:"Horizontal Navigation",value:"horizontalNavigation",figure:"/assets/images/theme-options/horizontal-nav.jpg"},{label:"Content with Toolbar",value:"contentWithToolbar",figure:"/assets/images/theme-options/content-with-toolbar.jpg"},{label:"Content Only",value:"contentOnly",figure:"/assets/images/theme-options/content-only.jpg"}],t.layoutMode="wide",t.layoutStyle=e.get("motion.layoutStyle")||"verticalNavigation",t.setActiveTheme=function(e){n.setActiveTheme(e)},t.getActiveTheme=function(){return n.themes.active},t.updateLayoutMode=function(){angular.element("body").toggleClass("boxed","boxed"===t.layoutMode)},t.updateLayoutStyle=function(){e.put("motion.layoutStyle",t.layoutStyle),location.reload()}}function n(n){return{restrict:"E",scope:{},controller:"MsThemeOptionsController as vm",templateUrl:"app/core/theme-options/theme-options.html",compile:function(e){return e.addClass("ms-theme-options"),function(e){e.toggleOptionsSidenav=function(){n("motion-theme-options").toggle()}}}}}e.$inject=["$cookies","motionTheming"],n.$inject=["$mdSidenav"],angular.module("app.core").controller("MsThemeOptionsController",e).directive("msThemeOptions",n)}(),function(){"use strict";function e(i,a,s){var o={};return{generate:function(){var e=angular.copy(s.getRegisteredThemes()),a=angular.copy(s.getRegisteredPalettes());angular.forEach(e,function(t){o[t.name]={},angular.forEach(t.colors,function(e,n){o[t.name][n]={name:e.name,levels:{default:{color:l(a[e.name][e.hues.default].value),contrast1:l(a[e.name][e.hues.default].contrast,1),contrast2:l(a[e.name][e.hues.default].contrast,2),contrast3:l(a[e.name][e.hues.default].contrast,3),contrast4:l(a[e.name][e.hues.default].contrast,4)},hue1:{color:l(a[e.name][e.hues["hue-1"]].value),contrast1:l(a[e.name][e.hues["hue-1"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-1"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-1"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-1"]].contrast,4)},hue2:{color:l(a[e.name][e.hues["hue-2"]].value),contrast1:l(a[e.name][e.hues["hue-2"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-2"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-2"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-2"]].contrast,4)},hue3:{color:l(a[e.name][e.hues["hue-3"]].value),contrast1:l(a[e.name][e.hues["hue-3"]].contrast,1),contrast2:l(a[e.name][e.hues["hue-3"]].contrast,2),contrast3:l(a[e.name][e.hues["hue-3"]].contrast,3),contrast4:l(a[e.name][e.hues["hue-3"]].contrast,4)}}}})}),function(e){var n=angular.copy(e);angular.forEach(n,function(t){angular.forEach(t,function(e,n){t[n]=e.levels,t[n].color=e.levels.default.color,t[n].contrast1=e.levels.default.contrast1,t[n].contrast2=e.levels.default.contrast2,t[n].contrast3=e.levels.default.contrast3,t[n].contrast4=e.levels.default.contrast4,delete t[n].default})}),s.setThemesList(n);var t=i.get("motion.selectedTheme");t?s.setActiveTheme(t):s.setActiveTheme("default")}(o);var r={};angular.forEach(o,function(e,n){var t,a,i,s,o;(r={})["@themeName"]=n,angular.forEach(e,function(e,a){angular.forEach(e.levels,function(e,t){angular.forEach(e,function(e,n){r["@"+a+d(t)+d(n)]=e})})}),t=r,a=new RegExp(Object.keys(t).join("|"),"gi"),i='/* Content hack because they wont fix */\n/* https://github.com/angular/material/pull/8067 */\n[md-theme="@themeName"] md-content.md-hue-1,\nmd-content.md-@themeName-theme.md-hue-1 {\n    color: @backgroundHue1Contrast1;\n    background-color: @backgroundHue1Color;\n}\n\n[md-theme="@themeName"] md-content.md-hue-2,\nmd-content.md-@themeName-theme.md-hue-2 {\n    color: @backgroundHue2Contrast1;\n    background-color: @backgroundHue2Color;\n}\n\n[md-theme="@themeName"] md-content.md-hue-3,\n md-content.md-@themeName-theme.md-hue-3 {\n    color: @backgroundHue3Contrast1;\n    background-color: @backgroundHue3Color;\n}\n\n/* Text Colors */\n[md-theme="@themeName"] a {\n    color: @accentDefaultColor;\n}\n\n[md-theme="@themeName"] .secondary-text,\n[md-theme="@themeName"] .icon {\n    color: @backgroundDefaultContrast2;\n}\n\n[md-theme="@themeName"] .hint-text,\n[md-theme="@themeName"] .disabled-text {\n    color: @backgroundDefaultContrast3;\n}\n\n[md-theme="@themeName"] .fade-text,\n[md-theme="@themeName"] .divider {\n    color: @backgroundDefaultContrast4;\n}\n\n/* Primary */\n[md-theme="@themeName"] .md-primary-bg {\n    background-color: @primaryDefaultColor;\n    color: @primaryDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg .secondary-text,\n[md-theme="@themeName"] .md-primary-bg .icon {\n    color: @primaryDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg .hint-text,\n[md-theme="@themeName"] .md-primary-bg .disabled-text {\n    color: @primaryDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg .fade-text,\n[md-theme="@themeName"] .md-primary-bg .divider {\n    color: @primaryDefaultContrast4;\n}\n\n/* Primary, Hue-1 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 {\n    background-color: @primaryHue1Color;\n    color: @primaryHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .icon {\n    color: @primaryHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .disabled-text {\n    color: @primaryHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-1 .divider {\n    color: @primaryHue1Contrast4;\n}\n\n/* Primary, Hue-2 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 {\n    background-color: @primaryHue2Color;\n    color: @primaryHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .icon {\n    color: @primaryHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .disabled-text {\n    color: @primaryHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-2 .divider {\n    color: @primaryHue2Contrast4;\n}\n\n/* Primary, Hue-3 */\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 {\n    background-color: @primaryHue3Color;\n    color: @primaryHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .icon {\n    color: @primaryHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .disabled-text {\n    color: @primaryHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-primary-bg.md-hue-3 .divider {\n    color: @primaryHue3Contrast4;\n}\n\n/* Primary foreground */\n[md-theme="@themeName"] .md-primary-fg {\n    color: @primaryDefaultColor !important;\n}\n\n/* Primary foreground, Hue-1 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-1 {\n    color: @primaryHue1Color !important;\n}\n\n/* Primary foreground, Hue-2 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-2 {\n    color: @primaryHue2Color !important;\n}\n\n/* Primary foreground, Hue-3 */\n[md-theme="@themeName"] .md-primary-fg.md-hue-3 {\n    color: @primaryHue3Color !important;\n}\n\n/* Accent */\n[md-theme="@themeName"] .md-accent-bg {\n    background-color: @accentDefaultColor;\n    color: @accentDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg .secondary-text,\n[md-theme="@themeName"] .md-accent-bg .icon {\n    color: @accentDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg .hint-text,\n[md-theme="@themeName"] .md-accent-bg .disabled-text {\n    color: @accentDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg .fade-text,\n[md-theme="@themeName"] .md-accent-bg .divider {\n    color: @accentDefaultContrast4;\n}\n\n/* Accent, Hue-1 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 {\n    background-color: @accentHue1Color;\n    color: @accentHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .icon {\n    color: @accentHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .disabled-text {\n    color: @accentHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-1 .divider {\n    color: @accentHue1Contrast4;\n}\n\n/* Accent, Hue-2 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 {\n    background-color: @accentHue2Color;\n    color: @accentHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .icon {\n    color: @accentHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .disabled-text {\n    color: @accentHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-2 .divider {\n    color: @accentHue2Contrast4;\n}\n\n/* Accent, Hue-3 */\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 {\n    background-color: @accentHue3Color;\n    color: @accentHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .icon {\n    color: @accentHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .disabled-text {\n    color: @accentHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-accent-bg.md-hue-3 .divider {\n    color: @accentHue3Contrast4;\n}\n\n/* Accent foreground */\n[md-theme="@themeName"] .md-accent-fg {\n    color: @accentDefaultColor !important;\n}\n\n/* Accent foreground, Hue-1 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-1 {\n    color: @accentHue1Color !important;\n}\n\n/* Accent foreground, Hue-2 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-2 {\n    color: @accentHue2Color !important;\n}\n\n/* Accent foreground, Hue-3 */\n[md-theme="@themeName"] .md-accent-fg.md-hue-3 {\n    color: @accentHue3Color !important;\n}\n\n/* Warn */\n[md-theme="@themeName"] .md-warn-bg {\n    background-color: @warnDefaultColor;\n    color: @warnDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg .secondary-text,\n[md-theme="@themeName"] .md-warn-bg .icon {\n    color: @warnDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg .hint-text,\n[md-theme="@themeName"] .md-warn-bg .disabled-text {\n    color: @warnDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg .fade-text,\n[md-theme="@themeName"] .md-warn-bg .divider {\n    color: @warnDefaultContrast4;\n}\n\n/* Warn, Hue-1 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 {\n    background-color: @warnHue1Color;\n    color: @warnHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .icon {\n    color: @warnHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .disabled-text {\n    color: @warnHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-1 .divider {\n    color: @warnHue1Contrast4;\n}\n\n/* Warn, Hue-2 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 {\n    background-color: @warnHue2Color;\n    color: @warnHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .icon {\n    color: @warnHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .disabled-text {\n    color: @warnHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-2 .divider {\n    color: @warnHue2Contrast4;\n}\n\n/* Warn, Hue-3 */\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 {\n    background-color: @warnHue3Color;\n    color: @warnHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .icon {\n    color: @warnHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .disabled-text {\n    color: @warnHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-warn-bg.md-hue-3 .divider {\n    color: @warnHue3Contrast4;\n}\n\n/* Warn foreground */\n[md-theme="@themeName"] .md-warn-fg {\n    color: @warnDefaultColor !important;\n}\n\n/* Warn foreground, Hue-1 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-1 {\n    color: @warnHue1Color !important;\n}\n\n/* Warn foreground, Hue-2 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-2 {\n    color: @warnHue2Color !important;\n}\n\n/* Warn foreground, Hue-3 */\n[md-theme="@themeName"] .md-warn-fg.md-hue-3 {\n    color: @warnHue3Color !important;\n}\n\n/* Background */\n[md-theme="@themeName"] .md-background-bg {\n    background-color: @backgroundDefaultColor;\n    color: @backgroundDefaultContrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg .secondary-text,\n[md-theme="@themeName"] .md-background-bg .icon {\n    color: @backgroundDefaultContrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg .hint-text,\n[md-theme="@themeName"] .md-background-bg .disabled-text {\n    color: @backgroundDefaultContrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg .fade-text,\n[md-theme="@themeName"] .md-background-bg .divider {\n    color: @backgroundDefaultContrast4;\n}\n\n/* Background, Hue-1 */\n[md-theme="@themeName"] .md-background-bg.md-hue-1 {\n    background-color: @backgroundHue1Color;\n    color: @backgroundHue1Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .icon {\n    color: @backgroundHue1Contrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .disabled-text {\n    color: @backgroundHue1Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-1 .divider {\n    color: @backgroundHue1Contrast4;\n}\n\n/* Background, Hue-2 */\n[md-theme="@themeName"] .md-background-bg.md-hue-2 {\n    background-color: @backgroundHue2Color;\n    color: @backgroundHue2Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .icon {\n    color: @backgroundHue2Contrast2;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .disabled-text {\n    color: @backgroundHue2Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-2 .divider {\n    color: @backgroundHue2Contrast4;\n}\n\n/* Background, Hue-3 */\n[md-theme="@themeName"] .md-background-bg.md-hue-3 {\n    background-color: @backgroundHue3Color;\n    color: @backgroundHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .secondary-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .icon {\n    color: @backgroundHue3Contrast1;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .hint-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .disabled-text {\n    color: @backgroundHue3Contrast3;\n}\n\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .fade-text,\n[md-theme="@themeName"] .md-background-bg.md-hue-3 .divider {\n    color: @backgroundHue3Contrast4;\n}\n\n/* Background foreground */\n[md-theme="@themeName"] .md-background-fg {\n    color: @backgroundDefaultColor !important;\n}\n\n/* Background foreground, Hue-1 */\n[md-theme="@themeName"] .md-background-fg.md-hue-1 {\n    color: @backgroundHue1Color !important;\n}\n\n/* Background foreground, Hue-2 */\n[md-theme="@themeName"] .md-background-fg.md-hue-2 {\n    color: @backgroundHue2Color !important;\n}\n\n/* Background foreground, Hue-3 */\n[md-theme="@themeName"] .md-background-fg.md-hue-3 {\n    color: @backgroundHue3Color !important;\n}'.replace(a,function(e){return t[e]}),s=angular.element("head"),(o=angular.element('<style type="text/css"></style>')).html(i),s.append(o)})},rgba:l};function l(e,n){var t=n||!1;return 4===e.length&&255===e[0]&&255===e[1]&&255===e[2]&&e.splice(3,4),t&&(e=function(e,n){var t={white:{1:"1",2:"0.7",3:"0.3",4:"0.12"},black:{1:"0.87",2:"0.54",3:"0.26",4:"0.12"}};255===e[0]&&255===e[1]&&255===e[2]?e[3]=t.white[n]:0===e[0]&&0===e[1]&&0===e[2]&&(e[3]=t.black[n]);return e}(e,t)),3===e.length?"rgb("+e.join(",")+")":4===e.length?"rgba("+e.join(",")+")":void a.error("Invalid number of arguments supplied in the color array: "+e.length+"\nThe array must have 3 or 4 colors.")}function d(e){return e.charAt(0).toUpperCase()+e.slice(1)}}e.$inject=["$cookies","$log","motionTheming"],angular.module("app.core").factory("motionGenerator",e)}(),function(){"use strict";angular.module("app.core").constant("motionPalettes",[{name:"motion-blue",options:{50:"#ebf1fa",100:"#c2d4ef",200:"#9ab8e5",300:"#78a0dc",400:"#5688d3",500:"#3470ca",600:"#2e62b1",700:"#275498",800:"#21467e",900:"#1a3865",A100:"#c2d4ef",A200:"#9ab8e5",A400:"#5688d3",A700:"#275498",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}},{name:"motion-paleblue",options:{50:"#ececee",100:"#c5c6cb",200:"#9ea1a9",300:"#7d818c",400:"#5c616f",500:"#3c4252",600:"#353a48",700:"#2d323e",800:"#262933",900:"#1e2129",A100:"#c5c6cb",A200:"#9ea1a9",A400:"#5c616f",A700:"#2d323e",contrastDefaultColor:"light",contrastDarkColors:"50 100 200 A100",contrastStrongLightColors:"300 400"}}])}(),function(){"use strict";angular.module("app.core").constant("motionThemes",{default:{primary:{name:"motion-paleblue",hues:{default:"700","hue-1":"500","hue-2":"600","hue-3":"400"}},accent:{name:"light-blue",hues:{default:"600","hue-1":"400","hue-2":"700","hue-3":"A100"}},warn:{name:"red"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},pinkTheme:{primary:{name:"blue-grey",hues:{default:"800","hue-1":"600","hue-2":"400","hue-3":"A100"}},accent:{name:"pink",hues:{default:"400","hue-1":"300","hue-2":"600","hue-3":"A100"}},warn:{name:"blue"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}},tealTheme:{primary:{name:"motion-blue",hues:{default:"900","hue-1":"600","hue-2":"500","hue-3":"A100"}},accent:{name:"teal",hues:{default:"500","hue-1":"400","hue-2":"600","hue-3":"A100"}},warn:{name:"deep-orange"},background:{name:"grey",hues:{default:"A100","hue-1":"A100","hue-2":"100","hue-3":"300"}}}})}(),function(){"use strict";function e(t,e,n){var a;angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.getObject("motion.customTheme");i&&(n.custom=i),t.alwaysWatchTheme(!0),angular.forEach(e,function(e){t.definePalette(e.name,e.options)}),angular.forEach(n,function(e,n){t.theme(n).primaryPalette(e.primary.name,e.primary.hues).accentPalette(e.accent.name,e.accent.hues).warnPalette(e.warn.name,e.warn.hues).backgroundPalette(e.background.name,e.background.hues)})}e.$inject=["$mdThemingProvider","motionPalettes","motionThemes"],angular.module("app.core").config(e)}(),function(){"use strict";function e(n,t,e){var a={getRegisteredPalettes:function(){return e.PALETTES},getRegisteredThemes:function(){return e.THEMES},setActiveTheme:function(e){if(angular.isUndefined(a.themes.list[e]))return angular.isUndefined(a.themes.list.default)?void t.error('You must have at least one theme named "default"'):(t.warn('The theme "'+e+'" does not exist! Falling back to the "default" theme.'),a.themes.active.name="default",a.themes.active.theme=a.themes.list.default,void n.put("motion.selectedTheme",a.themes.active.name));a.themes.active.name=e,a.themes.active.theme=a.themes.list[e],n.put("motion.selectedTheme",e)},setThemesList:function(e){a.themes.list=e},themes:{list:{},active:{name:"",theme:{}}}};return a}e.$inject=["$cookies","$log","$mdTheming"],angular.module("app.core").service("motionTheming",e)}(),function(){"use strict";function e(n,s,o,r){this.search=function(n){for(var e=[],t=r.getFlatNavigation(),a=o.defer(),i=0;i<t.length;i+=1)t[i].uisref&&e.push(t[i]);n&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(n)))return!0}));return s(function(){a.resolve(e)},1e3),a.promise},this.searchResultClick=function(e){e.uisref&&(e.stateParams?n.go(e.state,e.stateParams):n.go(e.state))}}e.$inject=["$state","$timeout","$q","msNavigationService"],angular.module("app.errors.error-404").controller("Error404Controller",e)}(),function(){"use strict";function e(e,n){var t=this;t.code="",t.send=!1,t.error=e.params,t.sendReport=function(){n.post("/api/jira",t.error).then(function(e){t.send=!0,e.data&&(t.code=e.data.id)},function(e){t.send=!1})}}e.$inject=["$state","$http"],angular.module("app.errors.error-500").controller("Error500Controller",e)}(),function(){"use strict";function e(e,n,t){var a=this;a.currentUser=e.getCurrentUser(),a.cookieAlertHide=n.get("motion.cookieAlertHide:"+a.currentUser.id)||!1,a.cookieAlertOnClose=function(){n.put("motion.cookieAlertHide:"+a.currentUser.id,!0)},a.onInit=function(){t.setting.get({id:1}).$promise.then(function(e){e&&(a.cookieAlertHide=!e.disabledCookie)})},a.onInit()}e.$inject=["Auth","$cookies","api"],angular.module("app.footer").controller("FooterController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.form={},s.forgotPassword=function(){return i.auth.forgot(s.form).$promise.then(function(){n.success({title:t.instant("FORGOTPASSWORD.LINK_SENT"),msg:t.instant("FORGOTPASSWORD.LINNK_SENT_MESSAGE")})}).catch(function(e){e&&n.error({title:t.instant("FORGOTPASSWORD.PASSWORD_RESET_ERROR"),msg:e.data?e.data.message||e.message||e:e.message||e})})},s.onInit=function(){e.isLoggedIn()&&a.go("app.dashboards.general")}}e.$inject=["Auth","toasty","$translate","$state","api"],angular.module("app.forgot").controller("ForgotPasswordController",e)}(),function(){"use strict";function e(e,n){var t=this;t.currentUser=e.getCurrentUser(),t.newsAlertHide=n.get("motion.newsAlertHide:"+t.currentUser.id)||!1,t.newsAlertOnClose=function(){n.put("motion.newsAlertHide:"+t.currentUser.id,!0)}}e.$inject=["Auth","$cookies"],angular.module("app.header").controller("HeaderController",e)}(),function(){"use strict";function e(e,o){var r={getResourcesByRole:function(e,n,t,a,i,s){return o.getResources(r,e,n,t,a,i,s)}};return r.baseUrl="api/",r.auth=e(r.baseUrl+"auth/local",{},{local:{method:"post",url:r.baseUrl+"auth/local"},forgot:{method:"post",url:r.baseUrl+"auth/local/forgot"},reset:{method:"post",url:r.baseUrl+"auth/local/reset/:token",params:{token:"@token"}},user:{method:"get",url:r.baseUrl+"auth/local/user/:token",params:{token:"@token"}},google:{method:"post",url:r.baseUrl+"auth/google"},activedirectory:{method:"post",url:r.baseUrl+"auth/activedirectory"}}),r.jira=e(r.baseUrl+"jira"),r.rpc=e(r.baseUrl+"rpc",{},{startMonitor:{method:"get",url:r.baseUrl+"rpc/voice/channels/:uniqueid/mixmonitor",params:{uniqueid:"@uniqueid"}},stopMonitor:{method:"get",url:r.baseUrl+"rpc/voice/channels/:uniqueid/stopmixmonitor",params:{uniqueid:"@uniqueid"}},getVoiceChannels:{method:"get",url:r.baseUrl+"rpc/voice/channels"},getVoiceQueues:{method:"get",url:r.baseUrl+"rpc/voice/queues"},getChatQueues:{method:"get",url:r.baseUrl+"rpc/chat/queues"},getMailQueues:{method:"get",url:r.baseUrl+"rpc/mail/queues"},getSmsQueues:{method:"get",url:r.baseUrl+"rpc/sms/queues"},getWhatsappQueues:{method:"get",url:r.baseUrl+"rpc/whatsapp/queues"},getOpenchannelQueues:{method:"get",url:r.baseUrl+"rpc/openchannel/queues"},getFaxQueues:{method:"get",url:r.baseUrl+"rpc/fax/queues"},getVoiceQueuesPreview:{method:"get",url:r.baseUrl+"rpc/voice/queues/preview/:id"},getVoiceQueuesChannels:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels"},getVoiceQueuesChannel:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid"},getVoiceQueuesChannelHangup:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid/hangup"},getVoiceQueuesChannelRedirect:{method:"get",url:r.baseUrl+"rpc/voice/queues/channels/:uniqueid/redirect/:exten"},getOutbound:{method:"get",url:r.baseUrl+"rpc/outbound"},getOutboundChannels:{method:"get",url:r.baseUrl+"rpc/outbound/channels"},getAgents:{method:"get",url:r.baseUrl+"rpc/agents"},setAgentCapacity:{method:"put",url:r.baseUrl+"rpc/agents/:id/capacity",params:{id:"@id"}},getTelephones:{method:"get",url:r.baseUrl+"rpc/telephones"},getTrunks:{method:"get",url:r.baseUrl+"rpc/trunks"},getCampaigns:{method:"get",url:r.baseUrl+"rpc/campaigns"},getMailAccounts:{method:"get",url:r.baseUrl+"rpc/mail/accounts"},getFaxAccounts:{method:"get",url:r.baseUrl+"rpc/fax/accounts"},getChatQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/chat/queues/waitinginteractions"},getMailQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/mail/queues/waitinginteractions"},getOpenchannelQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/openchannel/queues/waitinginteractions"},getOpenchannelQueuesIdWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/openchannel/queues/:id/waitinginteractions"},getSmsQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/sms/queues/waitinginteractions"},getFaxQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/fax/queues/waitinginteractions"},getWhatsappQueuesWaitingInteractions:{method:"get",url:r.baseUrl+"rpc/whatsapp/queues/waitinginteractions"},mailQueueNotify:{method:"post",url:r.baseUrl+"rpc/mail/queues/:id/notify",params:{id:"@id"}},chatQueueNotify:{method:"post",url:r.baseUrl+"rpc/chat/queues/:id/notify",params:{id:"@id"}},faxQueueNotify:{method:"post",url:r.baseUrl+"rpc/fax/queues/:id/notify",params:{id:"@id"}},smsQueueNotify:{method:"post",url:r.baseUrl+"rpc/sms/queues/:id/notify",params:{id:"@id"}},openchannelQueueNotify:{method:"post",url:r.baseUrl+"rpc/openchannel/queues/:id/notify",params:{id:"@id"}},agentNotify:{method:"post",url:r.baseUrl+"rpc/agents/:id/notify",params:{id:"@id"}}}),r.version=e(r.baseUrl+"version",{},{fetch:{method:"get",url:r.baseUrl+"version/fetch"},reset:{method:"get",url:r.baseUrl+"version/reset"},pull:{method:"get",url:r.baseUrl+"version/pull"},restart:{method:"get",url:r.baseUrl+"version/restart"},migrations:{method:"get",url:r.baseUrl+"version/migrations"}}),r.system=e(r.baseUrl+"system",{},{killProcess:{method:"get",url:r.baseUrl+"system/process/:pid/kill",params:{pid:"@pid"}}}),r.pm2=e(r.baseUrl+"pm2/:id",{id:"@id"},{update:{method:"put",isArray:!0}}),r.user=e(r.baseUrl+"users/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"users/describe"},clone:{method:"post",url:r.baseUrl+"users/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/contacts"},bulkCreate:{isArray:!1,method:"post",url:r.baseUrl+"users/create_many"},changePassword:{isArray:!1,method:"put",url:r.baseUrl+"users/:id/password"},addQueues:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/queues"},addAvatar:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/avatar"},getAvatar:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/avatar"},getOpenTabs:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/open_tabs"},getContacts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/contacts"},getQueues:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/queues"},getVoiceQueuesRt:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/queues_rt"},getGroups:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/groups"},getRecordings:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/recordings"},getScreenRecordings:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/screen_recordings"},getChatInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/chat/interactions"},getOpenchannelInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/openchannel/interactions"},getMailInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/mail/interactions"},getSmsInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/sms/interactions"},getFaxInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/fax/interactions"},getWhatsappInteractions:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/whatsapp/interactions"},login:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/login"},logout:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/logout"},pause:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/pause"},unpause:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/unpause"},messengerSoundNotification:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/messengerSoundNotification"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/teams"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/lists"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/agents"},addChatInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/chat_interactions"},removeChatInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/chat_interactions"},addMailInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/mail_interactions"},removeMailInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/mail_interactions"},addFaxInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/fax_interactions"},removeFaxInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/fax_interactions"},addSmsInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/sms_interactions"},removeSmsInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/sms_interactions"},addOpenchannelInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/openchannel_interactions"},removeOpenchannelInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/openchannel_interactions"},addWhatsappInteractions:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/whatsapp_interactions"},removeWhatsappInteractions:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/whatsapp_interactions"},getVoicePrefixes:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/prefixes"},getFaxAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/fax_accounts"},addFaxAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/fax_accounts"},removeFaxAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/fax_accounts"},getMailAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/mail_accounts"},addMailAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/mail_accounts"},removeMailAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/mail_accounts"},getOpenchannelAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/openchannel_accounts"},addOpenchannelAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/openchannel_accounts"},removeOpenchannelAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/openchannel_accounts"},getSmsAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/sms_accounts"},addSmsAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/sms_accounts"},removeSmsAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/sms_accounts"},getChatWebsites:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/chat_websites"},addChatWebsites:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/chat_websites"},removeChatWebsites:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/chat_websites"},getWhatsappAccounts:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/whatsapp_accounts"},addWhatsappAccounts:{isArray:!0,method:"post",url:r.baseUrl+"users/:id/whatsapp_accounts"},removeWhatsappAccounts:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/whatsapp_accounts"},getScheduledCalls:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/scheduled_calls"},getApiKey:{isArray:!1,method:"get",url:r.baseUrl+"users/:id/api_key"},createApiKey:{isArray:!1,method:"post",url:r.baseUrl+"users/:id/api_key"},removeApiKey:{isArray:!1,method:"delete",url:r.baseUrl+"users/:id/api_key"},whoami:{isArray:!1,method:"get",url:r.baseUrl+"users/whoami"},getPresence:{isArray:!1,method:"get",url:r.baseUrl+"users/presence"}}),r.voiceChanSpy=e(r.baseUrl+"voice/chanspy/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/chanspy/describe"},clone:{method:"post",url:r.baseUrl+"voice/chanspy/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceContext=e(r.baseUrl+"voice/contexts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/contexts/describe"},clone:{method:"post",url:r.baseUrl+"voice/contexts/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceExtension=e(r.baseUrl+"voice/extensions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/extensions/describe"},clone:{method:"post",url:r.baseUrl+"voice/extensions/:id/clone",params:{includeAll:"@includeAll"}},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"voice/extensions/:id/applications"}}),r.voiceMusicOnHold=e(r.baseUrl+"voice/mohs/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mohs/describe"},clone:{method:"post",url:r.baseUrl+"voice/mohs/:id/clone",params:{includeAll:"@includeAll"}},addSound:{isArray:!1,method:"post",url:r.baseUrl+"voice/mohs/:id/sounds"},removeSound:{isArray:!1,method:"delete",url:r.baseUrl+"voice/mohs/:id/sounds/:id2"},getSounds:{isArray:!1,method:"get",url:r.baseUrl+"voice/mohs/:id/sounds"}}),r.voiceQueue=e(r.baseUrl+"voice/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/queues/describe"},clone:{method:"post",url:r.baseUrl+"voice/queues/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/hopper_black"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"voice/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"voice/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/users"},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/members"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/lists"},addLists:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/lists"},removeLists:{isArray:!0,method:"delete",url:r.baseUrl+"voice/queues/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:r.baseUrl+"voice/queues/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:r.baseUrl+"voice/queues/:id/blacklists"}}),r.voiceRecording=e(r.baseUrl+"voice/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/recordings/describe"},clone:{method:"post",url:r.baseUrl+"voice/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},downloads:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/downloads"},runTranscribe:{isArray:!1,method:"post",url:r.baseUrl+"voice/recordings/:id/transcribe"},downloadTranscribe:{isArray:!1,method:"get",url:r.baseUrl+"voice/recordings/:id/transcribe",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.screenRecording=e(r.baseUrl+"screen/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"screen/recordings/describe"},clone:{method:"post",url:r.baseUrl+"screen/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"screen/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.voiceMail=e(r.baseUrl+"voice/mails/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mails/describe"},clone:{method:"post",url:r.baseUrl+"voice/mails/:id/clone",params:{includeAll:"@includeAll"}},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"voice/mails/:id/messages"}}),r.voiceMailMessage=e(r.baseUrl+"voice/mails/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/mails/messages/describe"},clone:{method:"post",url:r.baseUrl+"voice/mails/messages/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"voice/mails/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.voiceCallReport=e(r.baseUrl+"voice/calls/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/calls/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/calls/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceDialReport=e(r.baseUrl+"voice/dials/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/dials/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/dials/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceAgentReport=e(r.baseUrl+"voice/agents/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/agents/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/agents/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceQueueReport=e(r.baseUrl+"voice/queues/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/queues/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/queues/reports/:id/clone",params:{includeAll:"@includeAll"}},getVoiceQueuesReport:{isArray:!1,method:"get",url:r.baseUrl+"voice/queues/reports/index"}}),r.memberReport=e(r.baseUrl+"members/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"members/reports/describe"},clone:{method:"post",url:r.baseUrl+"members/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.trunk=e(r.baseUrl+"trunks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"trunks/describe"},clone:{method:"post",url:r.baseUrl+"trunks/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceTransferReport=e(r.baseUrl+"voice/transfers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/transfers/reports/describe"},clone:{method:"post",url:r.baseUrl+"voice/transfers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailServerOut=e(r.baseUrl+"mail/out_servers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/out_servers/describe"},clone:{method:"post",url:r.baseUrl+"mail/out_servers/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailAccount=e(r.baseUrl+"mail/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/accounts/describe"},clone:{method:"post",url:r.baseUrl+"mail/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/canned_answers"},getImap:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/in_servers"},addImap:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/in_servers"},removeImap:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/in_servers"},getSmtp:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/out_servers"},addSmtp:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/out_servers"},removeSmtp:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/out_servers"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/applications"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/messages"},send:{isArray:!1,method:"post",url:r.baseUrl+"mail/accounts/:id/send"},verifySmtp:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/verify"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"mail/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"mail/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"mail/accounts/:id/users"}}),r.mailQueue=e(r.baseUrl+"mail/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/queues/describe"},clone:{method:"post",url:r.baseUrl+"mail/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"mail/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"mail/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"mail/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"mail/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"mail/queues/:id/users"}}),r.mailSubstatus=e(r.baseUrl+"mail/substatuses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/substatuses/describe"},clone:{method:"post",url:r.baseUrl+"mail/substatuses/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailInteraction=e(r.baseUrl+"mail/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/interactions/describe"},clone:{method:"post",url:r.baseUrl+"mail/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"mail/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"mail/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"mail/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"mail/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"mail/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.mailMessage=e(r.baseUrl+"mail/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/messages/describe"},clone:{method:"post",url:r.baseUrl+"mail/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"mail/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"mail/messages/:id/reject"},download:{isArray:!1,method:"get",url:r.baseUrl+"mail/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.mailApplication=e(r.baseUrl+"mail/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/applications/describe"},clone:{method:"post",url:r.baseUrl+"mail/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.mailQueueReport=e(r.baseUrl+"mail/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"mail/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.dashboard=e(r.baseUrl+"dashboards/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dashboards/describe"},clone:{method:"post",url:r.baseUrl+"dashboards/:id/clone",params:{includeAll:"@includeAll"}},addItem:{isArray:!1,method:"post",url:r.baseUrl+"dashboards/:id/items"},getItems:{isArray:!1,method:"get",url:r.baseUrl+"dashboards/:id/items"}}),r.dashboardItem=e(r.baseUrl+"dashboards/items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dashboards/items/describe"},clone:{method:"post",url:r.baseUrl+"dashboards/items/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxAccount=e(r.baseUrl+"fax/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/accounts/describe"},clone:{method:"post",url:r.baseUrl+"fax/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/canned_answers"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/interactions"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/applications"},addAccountApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/addaccountapplications"},updateAccountApplications:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/updateaccountapplications"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/messages"},send:{isArray:!1,method:"post",url:r.baseUrl+"fax/accounts/:id/send"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"fax/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"fax/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"fax/accounts/:id/users"}}),r.faxApplication=e(r.baseUrl+"fax/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/applications/describe"},clone:{method:"post",url:r.baseUrl+"fax/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxInteraction=e(r.baseUrl+"fax/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/interactions/describe"},clone:{method:"post",url:r.baseUrl+"fax/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"fax/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"fax/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"fax/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"fax/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"fax/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.faxMessage=e(r.baseUrl+"fax/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/messages/describe"},clone:{method:"post",url:r.baseUrl+"fax/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"fax/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"fax/messages/:id/reject"},download:{isArray:!1,method:"get",url:r.baseUrl+"fax/messages/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.faxQueue=e(r.baseUrl+"fax/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/queues/describe"},clone:{method:"post",url:r.baseUrl+"fax/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"fax/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"fax/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"fax/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"fax/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"fax/queues/:id/users"}}),r.faxQueueReport=e(r.baseUrl+"fax/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"fax/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsAccount=e(r.baseUrl+"sms/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/accounts/describe"},clone:{method:"post",url:r.baseUrl+"sms/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/interactions"},send:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/send"},status:{isArray:!1,method:"post",url:r.baseUrl+"sms/accounts/:id/status"},statusGet:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/status"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"sms/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"sms/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"sms/accounts/:id/users"}}),r.smsApplication=e(r.baseUrl+"sms/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/applications/describe"},clone:{method:"post",url:r.baseUrl+"sms/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsInteraction=e(r.baseUrl+"sms/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/interactions/describe"},clone:{method:"post",url:r.baseUrl+"sms/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"sms/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"sms/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"sms/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"sms/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"sms/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.smsMessage=e(r.baseUrl+"sms/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/messages/describe"},clone:{method:"post",url:r.baseUrl+"sms/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"sms/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"sms/messages/:id/reject"},status:{isArray:!1,method:"post",url:r.baseUrl+"sms/messages/:id/status"}}),r.smsQueue=e(r.baseUrl+"sms/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/queues/describe"},clone:{method:"post",url:r.baseUrl+"sms/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"sms/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"sms/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"sms/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"sms/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"sms/queues/:id/users"}}),r.openchannelAccount=e(r.baseUrl+"openchannel/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/accounts/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/canned_answers"},notify:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/notify"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/applications"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/interactions"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/accounts/:id/users"},send:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/accounts/:id/send"}}),r.openchannelApplication=e(r.baseUrl+"openchannel/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/applications/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.openchannelInteraction=e(r.baseUrl+"openchannel/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/interactions/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"openchannel/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.openchannelMessage=e(r.baseUrl+"openchannel/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/messages/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"openchannel/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"openchannel/messages/:id/reject"}}),r.openchannelQueue=e(r.baseUrl+"openchannel/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/queues/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"openchannel/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"openchannel/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"openchannel/queues/:id/users"}}),r.chatWebsite=e(r.baseUrl+"chat/websites/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/websites/describe"},clone:{method:"post",url:r.baseUrl+"chat/websites/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/canned_answers"},addLogo:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/logo"},addAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/avatar"},addCustomerAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/customer_avatar"},addSystemAvatar:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/system_avatar"},getLogo:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/logo"},getAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/avatar"},getCustomerAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/customer_avatar"},getSystemAvatar:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/system_avatar"},notify:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/notify"},offline:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/offline"},addInteraction:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/interactions"},getInteractions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/interactions"},getSnippet:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/snippet"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/applications"},addProactiveActions:{isArray:!1,method:"post",url:r.baseUrl+"chat/websites/:id/proactive_actions"},getProactiveActions:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/proactive_actions"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/fields"},getOfflineMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/offline_messages"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"chat/websites/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"chat/websites/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"chat/websites/:id/users"}}),r.openchannelQueueReport=e(r.baseUrl+"openchannel/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatApplication=e(r.baseUrl+"chat/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/applications/describe"},clone:{method:"post",url:r.baseUrl+"chat/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatInteraction=e(r.baseUrl+"chat/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/interactions/describe"},clone:{method:"post",url:r.baseUrl+"chat/interactions/:id/clone",params:{includeAll:"@includeAll"}},createVidaooSession:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/vidaoo"},customUpdate:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/custom_update"},abandon:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/abandon"},attachmentUpload:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/attachment_upload"},attachmentDownload:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/attachment_download"},close:{isArray:!1,method:"put",url:r.baseUrl+"chat/interactions/:id/close"},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/messages"},getMyMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/my_messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"chat/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"chat/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"chat/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.chatMessage=e(r.baseUrl+"chat/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"chat/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"chat/messages/:id/reject"}}),r.chatOfflineMessage=e(r.baseUrl+"chat/offline_messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/offline_messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/offline_messages/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatQueue=e(r.baseUrl+"chat/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/queues/describe"},clone:{method:"post",url:r.baseUrl+"chat/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"chat/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"chat/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"chat/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"chat/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"chat/queues/:id/users"}}),r.chatGroup=e(r.baseUrl+"chat/groups/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/groups/describe"},clone:{method:"post",url:r.baseUrl+"chat/groups/:id/clone",params:{includeAll:"@includeAll"}},getUnread:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/unread"},addMembers:{isArray:!0,method:"post",url:r.baseUrl+"chat/groups/:id/members"},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/members"},removeMembers:{isArray:!1,method:"delete",url:r.baseUrl+"chat/groups/:id/members"},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"chat/groups/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"chat/groups/:id/messages"}}),r.chatProactiveAction=e(r.baseUrl+"chat/proactive_actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/proactive_actions/describe"},clone:{method:"post",url:r.baseUrl+"chat/proactive_actions/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmCompany=e(r.baseUrl+"cm/companies/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/companies/describe"},clone:{method:"post",url:r.baseUrl+"cm/companies/:id/clone",params:{includeAll:"@includeAll"}},addContacts:{isArray:!1,method:"post",url:r.baseUrl+"cm/companies/:id/contacts"},getContacts:{isArray:!1,method:"get",url:r.baseUrl+"cm/companies/:id/contacts"}}),r.cmContact=e(r.baseUrl+"cm/contacts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/contacts/describe"},clone:{method:"post",url:r.baseUrl+"cm/contacts/:id/clone",params:{includeAll:"@includeAll"}},merge:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/merge"},bulkCreate:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/create_many"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/tags"},setAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/phones"},getAdditionalPhones:{isArray:!0,method:"get",url:r.baseUrl+"cm/contacts/:id/phones"},duplicateAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/duplicateAdditionalPhones"},rescheduleAdditionalPhones:{isArray:!0,method:"post",url:r.baseUrl+"cm/contacts/:id/rescheduleAdditionalPhones"},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/hopper_finals"},getJscriptySessions:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/jscripty_sessions"},uploadCsv:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/csv"},upload:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/upload"},import:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/upload/:id"},importUpdates:{isArray:!1,method:"post",url:r.baseUrl+"cm/contacts/uploadUpdates/:id"},getJourney:{isArray:!1,method:"get",url:r.baseUrl+"cm/contacts/:id/journey"}}),r.cmHopper=e(r.baseUrl+"cm/hopper/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper/:id/clone",params:{includeAll:"@includeAll"}},getPreview:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper/preview"},getPreviewRecall:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/:id/previewrecall"},getOpenContacts:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/opencontacts"},getTimezones:{isArray:!1,method:"get",url:r.baseUrl+"cm/hopper/timezones"},getTimezone:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper/timezone"}}),r.cmHopperBlack=e(r.baseUrl+"cm/hopper_black/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_black/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_black/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmHopperFinal=e(r.baseUrl+"cm/hopper_final/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_final/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_final/:id/clone",params:{includeAll:"@includeAll"}},countContactsQueueCampaignHopperFinal:{isArray:!0,method:"get",url:r.baseUrl+"cm/hopper_final/voice/queue/countAttributes/:id"},countContactsIvrCampaignHopperFinal:{isArray:!0,method:"get",url:r.baseUrl+"cm/hopper_final/campaign/countAttributes/:id"},moveContactsQueueCampaignHopperFinal:{isArray:!0,method:"post",url:r.baseUrl+"cm/hopper_final/voice/queue/moveContacts/:id"},moveContactsIvrCampaignHopperFinal:{isArray:!0,method:"post",url:r.baseUrl+"cm/hopper_final/voice/campaign/moveContacts/:id"},checkContactHopper:{isArray:!1,method:"post",url:r.baseUrl+"cm/hopper_final/checkContactHopper"}}),r.cmHopperHistory=e(r.baseUrl+"cm/hopper_history/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/hopper_history/describe"},clone:{method:"post",url:r.baseUrl+"cm/hopper_history/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmCustomField=e(r.baseUrl+"cm/custom_fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/custom_fields/describe"},clone:{method:"post",url:r.baseUrl+"cm/custom_fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.action=e(r.baseUrl+"actions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"actions/describe"},clone:{method:"post",url:r.baseUrl+"actions/:id/clone",params:{includeAll:"@includeAll"}}}),r.automation=e(r.baseUrl+"automations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"automations/describe"},clone:{method:"post",url:r.baseUrl+"automations/:id/clone",params:{includeAll:"@includeAll"}},addConditions:{isArray:!1,method:"post",url:r.baseUrl+"automations/:id/conditions"},getConditions:{isArray:!1,method:"get",url:r.baseUrl+"automations/:id/conditions"},addActions:{isArray:!1,method:"post",url:r.baseUrl+"automations/:id/actions"},getActions:{isArray:!1,method:"get",url:r.baseUrl+"automations/:id/actions"}}),r.cannedAnswer=e(r.baseUrl+"canned_answers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"canned_answers/describe"},clone:{method:"post",url:r.baseUrl+"canned_answers/:id/clone",params:{includeAll:"@includeAll"}}}),r.disposition=e(r.baseUrl+"dispositions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"dispositions/describe"},clone:{method:"post",url:r.baseUrl+"dispositions/:id/clone",params:{includeAll:"@includeAll"}}}),r.condition=e(r.baseUrl+"conditions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"conditions/describe"},clone:{method:"post",url:r.baseUrl+"conditions/:id/clone",params:{includeAll:"@includeAll"}}}),r.interval=e(r.baseUrl+"intervals/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"intervals/describe"},clone:{method:"post",url:r.baseUrl+"intervals/:id/clone",params:{includeAll:"@includeAll"}},addInterval:{isArray:!1,method:"post",url:r.baseUrl+"intervals/:id/sub_intervals"},getIntervals:{isArray:!1,method:"get",url:r.baseUrl+"intervals/:id/sub_intervals"},addIntervals:{isArray:!0,method:"post",url:r.baseUrl+"intervals/:id/sub_intervals/create_many"}}),r.pause=e(r.baseUrl+"pauses/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"pauses/describe"},clone:{method:"post",url:r.baseUrl+"pauses/:id/clone",params:{includeAll:"@includeAll"}}}),r.cdr=e(r.baseUrl+"cdr/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cdr/describe"},clone:{method:"post",url:r.baseUrl+"cdr/:id/clone",params:{includeAll:"@includeAll"}}}),r.voiceQueuesLog=e(r.baseUrl+"voiceQueuesLog/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voiceQueuesLog/describe"},clone:{method:"post",url:r.baseUrl+"voiceQueuesLog/:id/clone",params:{includeAll:"@includeAll"}}}),r.schedule=e(r.baseUrl+"schedules/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"schedules/describe"},clone:{method:"post",url:r.baseUrl+"schedules/:id/clone",params:{includeAll:"@includeAll"}},run:{isArray:!1,method:"get",url:r.baseUrl+"schedules/:id/run"}}),r.sound=e(r.baseUrl+"sounds/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sounds/describe"},clone:{method:"post",url:r.baseUrl+"sounds/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"sounds/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},delete:{isArray:!1,method:"delete",url:r.baseUrl+"sounds/:id"}}),r.tag=e(r.baseUrl+"tags/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"tags/describe"},clone:{method:"post",url:r.baseUrl+"tags/:id/clone",params:{includeAll:"@includeAll"}}}),r.contactItemType=e(r.baseUrl+"contact_item_types/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"contact_item_types/describe"},clone:{method:"post",url:r.baseUrl+"contact_item_types/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmContactHasItem=e(r.baseUrl+"cm_contact_has_items/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm_contact_has_items/describe"},clone:{method:"post",url:r.baseUrl+"cm_contact_has_items/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmHopperAdditionalPhone=e(r.baseUrl+"cm_hopper_additional_phones/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm_hopper_additional_phones/describe"},clone:{method:"post",url:r.baseUrl+"cm_hopper_additional_phones/:id/clone",params:{includeAll:"@includeAll"}}}),r.template=e(r.baseUrl+"templates/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"templates/describe"},clone:{method:"post",url:r.baseUrl+"templates/:id/clone",params:{includeAll:"@includeAll"}}}),r.trigger=e(r.baseUrl+"triggers/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"triggers/describe"},clone:{method:"post",url:r.baseUrl+"triggers/:id/clone",params:{includeAll:"@includeAll"}},addAllCondition:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/all_conditions"},addAnyCondition:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/any_conditions"},getAllConditions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/all_conditions"},getAnyConditions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/any_conditions"},addAction:{isArray:!1,method:"post",url:r.baseUrl+"triggers/:id/actions"},getActions:{isArray:!1,method:"get",url:r.baseUrl+"triggers/:id/actions"}}),r.variable=e(r.baseUrl+"variables/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"variables/describe"},clone:{method:"post",url:r.baseUrl+"variables/:id/clone",params:{includeAll:"@includeAll"}}}),r.integration=e(r.baseUrl+"integrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/:id/clone",params:{includeAll:"@includeAll"}}}),r.integrationReport=e(r.baseUrl+"integrations/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/reports/describe"},clone:{method:"post",url:r.baseUrl+"integrations/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.analyticCustomReport=e(r.baseUrl+"analytics/custom_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/custom_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/custom_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/preview"},run:{isArray:!1,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/run"},query:{isArray:!1,method:"get",url:r.baseUrl+"analytics/custom_reports/:id/query"}}),r.analyticDefaultReport=e(r.baseUrl+"analytics/default_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/default_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/default_reports/:id/clone",params:{includeAll:"@includeAll"}},preview:{isArray:!0,method:"get",url:r.baseUrl+"analytics/default_reports/:id/preview"},run:{isArray:!1,method:"get",url:r.baseUrl+"analytics/default_reports/:id/run"},query:{isArray:!1,method:"get",url:r.baseUrl+"analytics/default_reports/:id/query"}}),r.analyticExtractedReport=e(r.baseUrl+"analytics/extracted_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/extracted_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/extracted_reports/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"analytics/extracted_reports/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.analyticMetric=e(r.baseUrl+"analytics/metrics/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/metrics/describe"},clone:{method:"post",url:r.baseUrl+"analytics/metrics/:id/clone",params:{includeAll:"@includeAll"}}}),r.analyticFieldReport=e(r.baseUrl+"analytics/field_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/field_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/field_reports/:id/clone",params:{includeAll:"@includeAll"}},bulkCreate:{method:"post",url:r.baseUrl+"analytics/field_reports/create_many",isArray:!0},bulkDestroy:{method:"delete",url:r.baseUrl+"analytics/field_reports/destroy_many",isArray:!0},addFields:{isArray:!0,method:"post",url:r.baseUrl+"analytics/field_reports/:id/create_many"}}),r.analyticTreeReport=e(r.baseUrl+"analytics/tree_reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"analytics/tree_reports/describe"},clone:{method:"post",url:r.baseUrl+"analytics/tree_reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.intSalesforceAccount=e(r.baseUrl+"integrations/salesforce/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/salesforce/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/accounts/:id/fields"}}),r.intSalesforceConfiguration=e(r.baseUrl+"integrations/salesforce/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/salesforce/configurations/:id/descriptions"}}),r.intSalesforceField=e(r.baseUrl+"integrations/salesforce/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/salesforce/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/salesforce/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intSugarcrmAccount=e(r.baseUrl+"integrations/sugarcrm/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/accounts/:id/fields"}}),r.intSugarcrmConfiguration=e(r.baseUrl+"integrations/sugarcrm/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/sugarcrm/configurations/:id/descriptions"}}),r.intSugarcrmField=e(r.baseUrl+"integrations/sugarcrm/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/sugarcrm/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/sugarcrm/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intDeskAccount=e(r.baseUrl+"integrations/desk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/desk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/accounts/:id/fields"}}),r.intDeskConfiguration=e(r.baseUrl+"integrations/desk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/desk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/desk/configurations/:id/tags"}}),r.intDeskField=e(r.baseUrl+"integrations/desk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/desk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/desk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intZohoAccount=e(r.baseUrl+"integrations/zoho/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/zoho/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/accounts/:id/fields"}}),r.intZohoConfiguration=e(r.baseUrl+"integrations/zoho/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zoho/configurations/:id/descriptions"}}),r.intZohoField=e(r.baseUrl+"integrations/zoho/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zoho/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zoho/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intZendeskAccount=e(r.baseUrl+"integrations/zendesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/zendesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/accounts/:id/fields"}}),r.intZendeskConfiguration=e(r.baseUrl+"integrations/zendesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/zendesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/zendesk/configurations/:id/tags"}}),r.intZendeskField=e(r.baseUrl+"integrations/zendesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/zendesk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/zendesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intFreshdeskAccount=e(r.baseUrl+"integrations/freshdesk/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/freshdesk/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/accounts/:id/fields"}}),r.intFreshdeskConfiguration=e(r.baseUrl+"integrations/freshdesk/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/descriptions"},getTags:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshdesk/configurations/:id/tags"},setTags:{isArray:!0,method:"post",url:r.baseUrl+"integrations/freshdesk/configurations/:id/tags"}}),r.intFreshdeskField=e(r.baseUrl+"integrations/freshdesk/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshdesk/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshdesk/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intVtigerAccount=e(r.baseUrl+"integrations/vtiger/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/vtiger/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/accounts/:id/fields"}}),r.intVtigerConfiguration=e(r.baseUrl+"integrations/vtiger/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/vtiger/configurations/:id/descriptions"}}),r.intVtigerField=e(r.baseUrl+"integrations/vtiger/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/vtiger/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/vtiger/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intServicenowAccount=e(r.baseUrl+"integrations/servicenow/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/servicenow/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/accounts/:id/fields"}}),r.intServicenowConfiguration=e(r.baseUrl+"integrations/servicenow/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/servicenow/configurations/:id/descriptions"}}),r.intServicenowField=e(r.baseUrl+"integrations/servicenow/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/servicenow/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/servicenow/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intDynamics365Account=e(r.baseUrl+"integrations/dynamics365/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/dynamics365/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/accounts/:id/fields"}}),r.intDynamics365Configuration=e(r.baseUrl+"integrations/dynamics365/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/configurations/:id/clone",params:{includeAll:"@includeAll"}},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/fields"},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/dynamics365/configurations/:id/descriptions"}}),r.intDynamics365Field=e(r.baseUrl+"integrations/dynamics365/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/dynamics365/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/dynamics365/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.intFreshsalesAccount=e(r.baseUrl+"integrations/freshsales/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/accounts/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/accounts/:id/clone",params:{includeAll:"@includeAll"}},getConfigurations:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/accounts/:id/configurations"},addConfiguration:{isArray:!1,method:"post",url:r.baseUrl+"integrations/freshsales/accounts/:id/configurations"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/accounts/:id/fields"}}),r.intFreshsalesConfiguration=e(r.baseUrl+"integrations/freshsales/configurations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/configurations/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/configurations/:id/clone",params:{includeAll:"@includeAll"}},getSubjects:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/subjects"},getDescriptions:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/descriptions"},getFields:{isArray:!1,method:"get",url:r.baseUrl+"integrations/freshsales/configurations/:id/fields"}}),r.intFreshsalesField=e(r.baseUrl+"integrations/freshsales/fields/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"integrations/freshsales/fields/describe"},clone:{method:"post",url:r.baseUrl+"integrations/freshsales/fields/:id/clone",params:{includeAll:"@includeAll"}}}),r.network=e(r.baseUrl+"networks/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"networks/describe"},clone:{method:"post",url:r.baseUrl+"networks/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatQueueReport=e(r.baseUrl+"chat/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"chat/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatInternalMessage=e(r.baseUrl+"chat/internal/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/internal/messages/describe"},clone:{method:"post",url:r.baseUrl+"chat/internal/messages/:id/clone",params:{includeAll:"@includeAll"}},getUsers:{isArray:!1,method:"get",url:r.baseUrl+"chat/internal/messages/users"}}),r.jscriptyAnswerReport=e(r.baseUrl+"jscripty/answers/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/answers/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/answers/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptyQuestionReport=e(r.baseUrl+"jscripty/questions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/questions/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/questions/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptySessionReport=e(r.baseUrl+"jscripty/sessions/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/sessions/reports/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/sessions/reports/:id/clone",params:{includeAll:"@includeAll"}},getQuestions:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/sessions/reports/:id/questions"}}),r.smsQueueReport=e(r.baseUrl+"sms/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"sms/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareReport=e(r.baseUrl+"square/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/reports/describe"},clone:{method:"post",url:r.baseUrl+"square/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareReportDetail=e(r.baseUrl+"square/details/reports/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/details/reports/describe"},clone:{method:"post",url:r.baseUrl+"square/details/reports/:id/clone",params:{includeAll:"@includeAll"}}}),r.jscriptyProject=e(r.baseUrl+"jscripty/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"jscripty/projects/describe"},clone:{method:"post",url:r.baseUrl+"jscripty/projects/:id/clone",params:{includeAll:"@includeAll"}},getSessions:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/sessions"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/answers"},getSummary:{isArray:!1,method:"get",url:r.baseUrl+"jscripty/projects/:id/summary",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.setting=e(r.baseUrl+"settings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"settings/describe"},clone:{method:"post",url:r.baseUrl+"settings/:id/clone",params:{includeAll:"@includeAll"}},addLogo:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/logo"},addLogoLogin:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/logo_login"},getLogo:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/logo"},getLogoLogin:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/logo_login"},gdpr:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/gdpr"},addPreferred:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/preferred"},getPreferred:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/preferred"},addFavicon:{isArray:!1,method:"post",url:r.baseUrl+"settings/:id/favicon"},getFavicon:{isArray:!1,method:"get",url:r.baseUrl+"settings/:id/favicon"},getDate:{isArray:!1,method:"get",url:r.baseUrl+"settings/now"}}),r.squareOdbc=e(r.baseUrl+"square/odbc/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/odbc/describe"},clone:{method:"post",url:r.baseUrl+"square/odbc/:id/clone",params:{includeAll:"@includeAll"}},test:{isArray:!1,method:"get",url:r.baseUrl+"square/odbc/:id/test"}}),r.squareProject=e(r.baseUrl+"square/projects/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/projects/describe"},clone:{method:"post",url:r.baseUrl+"square/projects/:id/clone",params:{includeAll:"@includeAll"}}}),r.squareRecording=e(r.baseUrl+"square/recordings/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/recordings/describe"},clone:{method:"post",url:r.baseUrl+"square/recordings/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"square/recordings/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.squareMessage=e(r.baseUrl+"square/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"square/messages/describe"},clone:{method:"post",url:r.baseUrl+"square/messages/:id/clone",params:{includeAll:"@includeAll"}}}),r.team=e(r.baseUrl+"teams/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"teams/describe"},clone:{method:"post",url:r.baseUrl+"teams/:id/clone",params:{includeAll:"@includeAll"}},getQueues:{isArray:!0,method:"get",url:r.baseUrl+"teams/:id/queues"},addQueues:{isArray:!0,method:"post",url:r.baseUrl+"teams/:id/queues"},removeQueues:{isArray:!1,method:"delete",url:r.baseUrl+"teams/:id/queues"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"teams/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"teams/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"teams/:id/users"}}),r.license=e(r.baseUrl+"license/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"license/describe"},clone:{method:"post",url:r.baseUrl+"license/:id/clone",params:{includeAll:"@includeAll"}},downloadLogFile:{isArray:!1,method:"get",url:r.baseUrl+"license/download_log_file",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.campaign=e(r.baseUrl+"campaigns/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"campaigns/describe"},clone:{method:"post",url:r.baseUrl+"campaigns/:id/clone",params:{includeAll:"@includeAll"}},getHoppers:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hoppers"},getHopperHistories:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_histories"},getHopperFinals:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_finals"},getHopperBlacks:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/hopper_black"},getLists:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/lists"},addLists:{isArray:!0,method:"post",url:r.baseUrl+"campaigns/:id/lists"},removeLists:{isArray:!0,method:"delete",url:r.baseUrl+"campaigns/:id/lists"},getBlackLists:{isArray:!1,method:"get",url:r.baseUrl+"campaigns/:id/blacklists"},addBlackLists:{isArray:!0,method:"post",url:r.baseUrl+"campaigns/:id/blacklists"},removeBlackLists:{isArray:!0,method:"delete",url:r.baseUrl+"campaigns/:id/blacklists"}}),r.migration=e(r.baseUrl+"migrations/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"migrations/describe"},clone:{method:"post",url:r.baseUrl+"migrations/:id/clone",params:{includeAll:"@includeAll"}}}),r.attachment=e(r.baseUrl+"attachments/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"attachments/describe"},clone:{method:"post",url:r.baseUrl+"attachments/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"attachments/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.plugin=e(r.baseUrl+"plugins/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"plugins/describe"},clone:{method:"post",url:r.baseUrl+"plugins/:id/clone",params:{includeAll:"@includeAll"}},download:{isArray:!1,method:"get",url:r.baseUrl+"plugins/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},upload:{isArray:!1,method:"post",url:r.baseUrl+"plugins/"},delete:{isArray:!1,method:"delete",url:r.baseUrl+"plugins/:id"},webhookGet:{isArray:!1,method:"get",url:r.baseUrl+"plugins/webhook"},webhookPost:{isArray:!1,method:"post",url:r.baseUrl+"plugins/webhook"}}),r.mailTransferReport=e(r.baseUrl+"mail/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"mail/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"mail/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.chatTransferReport=e(r.baseUrl+"chat/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"chat/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"chat/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.faxTransferReport=e(r.baseUrl+"fax/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"fax/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"fax/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.openchannelTransferReport=e(r.baseUrl+"openchannel/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"openchannel/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"openchannel/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.smsTransferReport=e(r.baseUrl+"sms/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"sms/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"sms/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.cmList=e(r.baseUrl+"cm/lists/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cm/lists/describe"},clone:{method:"post",url:r.baseUrl+"cm/lists/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"cm/lists/:id/dispositions"},addContacts:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/contacts"},getContacts:{isArray:!0,method:"get",url:r.baseUrl+"cm/lists/:id/contacts"},getContactsCsv:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/contacts/csv",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}},addCustomField:{isArray:!1,method:"post",url:r.baseUrl+"cm/lists/:id/fields"},getCustomFields:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/fields"},getGlobalCustomFields:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/global_fields"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"cm/lists/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"cm/lists/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"cm/lists/:id/users"}}),r.voicePrefix=e(r.baseUrl+"voice/prefixes/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"voice/prefixes/describe"},clone:{method:"post",url:r.baseUrl+"voice/prefixes/:id/clone",params:{includeAll:"@includeAll"}},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"voice/prefixes/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"voice/prefixes/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"voice/prefixes/:id/users"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"voice/prefixes/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"voice/prefixes/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"voice/prefixes/:id/teams"}}),r.userProfile=e(r.baseUrl+"userProfiles/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfiles/describe"},clone:{method:"post",url:r.baseUrl+"userProfiles/:id/clone",params:{includeAll:"@includeAll"}},addSections:{isArray:!0,method:"post",url:r.baseUrl+"userProfiles/:id/sections"},removeSections:{isArray:!1,method:"delete",url:r.baseUrl+"userProfiles/:id/sections"},getSections:{isArray:!0,method:"get",url:r.baseUrl+"userProfiles/:id/sections"},addResources:{isArray:!0,method:"post",url:r.baseUrl+"userProfiles/:id/resources"},removeResources:{isArray:!1,method:"delete",url:r.baseUrl+"userProfiles/:id/resources"},getResources:{isArray:!1,method:"get",url:r.baseUrl+"userProfiles/:id/resources"}}),r.userProfileSection=e(r.baseUrl+"userProfile/sections/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfile/sections/describe"},clone:{method:"post",url:r.baseUrl+"userProfile/sections/:id/clone",params:{includeAll:"@includeAll"}}}),r.userProfileResource=e(r.baseUrl+"userProfile/resources/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userProfile/resources/describe"},clone:{method:"post",url:r.baseUrl+"userProfile/resources/:id/clone",params:{includeAll:"@includeAll"}}}),r.userNotification=e(r.baseUrl+"userNotifications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"userNotifications/describe"},clone:{method:"post",url:r.baseUrl+"userNotifications/:id/clone",params:{includeAll:"@includeAll"}},sendUserNotification:{isArray:!1,method:"post",url:r.baseUrl+"userNotifications/"}}),r.whatsappAccount=e(r.baseUrl+"whatsapp/accounts/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/accounts/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/accounts/:id/clone",params:{includeAll:"@includeAll"}},addDisposition:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},getDispositions:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},removeDispositions:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/dispositions"},addAnswer:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},getAnswers:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},removeAnswers:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/canned_answers"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/accounts/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/users"},addApplications:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/applications"},getApplications:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/accounts/:id/applications"},notify:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/notify"},send:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/accounts/:id/send"}}),r.whatsappApplication=e(r.baseUrl+"whatsapp/applications/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/applications/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/applications/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappInteraction=e(r.baseUrl+"whatsapp/interactions/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/interactions/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/interactions/:id/clone",params:{includeAll:"@includeAll"}},addMessage:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/interactions/:id/messages"},getMessages:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/interactions/:id/messages"},addTags:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/interactions/:id/tags"},removeTags:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/interactions/:id/tags"},download:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/interactions/:id/download",responseType:"arraybuffer",cache:!1,transformResponse:function(e,n){var t=n();return{type:t["content-type"],length:t["content-length"],buffer:e}}}}),r.whatsappMessage=e(r.baseUrl+"whatsapp/messages/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/messages/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/messages/:id/clone",params:{includeAll:"@includeAll"}},accept:{isArray:!1,method:"put",url:r.baseUrl+"whatsapp/messages/:id/accept"},reject:{isArray:!1,method:"put",url:r.baseUrl+"whatsapp/messages/:id/reject"},status:{isArray:!1,method:"post",url:r.baseUrl+"whatsapp/messages/:id/status"}}),r.whatsappQueueReport=e(r.baseUrl+"whatsapp/reports/queue/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/reports/queue/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/reports/queue/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappTransferReport=e(r.baseUrl+"whatsapp/reports/transfer/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/reports/transfer/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/reports/transfer/:id/clone",params:{includeAll:"@includeAll"}}}),r.whatsappQueue=e(r.baseUrl+"whatsapp/queues/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"whatsapp/queues/describe"},clone:{method:"post",url:r.baseUrl+"whatsapp/queues/:id/clone",params:{includeAll:"@includeAll"}},getMembers:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/members"},getTeams:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/teams"},addTeams:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/queues/:id/teams"},removeTeams:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/queues/:id/teams"},addAgents:{isArray:!0,method:"post",url:r.baseUrl+"whatsapp/queues/:id/users"},removeAgents:{isArray:!1,method:"delete",url:r.baseUrl+"whatsapp/queues/:id/users"},getAgents:{isArray:!1,method:"get",url:r.baseUrl+"whatsapp/queues/:id/users"}}),r.cloudProvider=e(r.baseUrl+"cloudProviders/:id",{id:"@id"},{update:{method:"put"},describe:{method:"get",url:r.baseUrl+"cloudProviders/describe"},clone:{method:"post",url:r.baseUrl+"cloudProviders/:id/clone",params:{includeAll:"@includeAll"}},oauth2MicrosoftAuthorize:{method:"get",url:r.baseUrl+"cloudProviders/:id/oauth2/microsoft/authorize"}}),r.realtime=e(r.baseUrl+"realtime",{},{getAgents:{isArray:!1,method:"get",url:r.baseUrl+"realtime/agents"},getQueues:{isArray:!1,method:"get",url:r.baseUrl+"realtime/queues"}}),r.userSetting=e(r.baseUrl+"user-settings/:id",{id:"@id"},{update:{method:"put",isArray:!1}}),r}e.$inject=["$resource","userProfileManager"],angular.module("motion").factory("api",e)}(),function(){"use strict";function e(e,n){n.setConfig({position:"top-right",sound:!1,html:!0,theme:"material"}),e.useLoader("$translatePartialLoader",{urlTemplate:"{part}/i18n/{lang}.json"}),e.preferredLanguage("en"),e.fallbackLanguage("en"),e.useSanitizeValueStrategy(null)}e.$inject=["$translateProvider","toastyConfigProvider"],angular.module("motion").config(e)}(),function(){"use strict";angular.module("motion")}(),function(){"use strict";function e(e,n,t,a){var i=this;i.themes=e.themes,i.direction="ltr";var s=t.get("motion.language");s&&(n.use(s),0<=["ar","fa","he"].indexOf(s)&&a.setting.get({id:1}).$promise.then(function(e){e&&e.rtlSupport&&(i.direction="rtl")}).catch(function(e){e&&toasty.error({title:"Error",msg:e.data?e.data.message||e.message||e:e.message||e})}))}e.$inject=["motionTheming","$translate","$cookies","api"],angular.module("motion").controller("IndexController",e)}(),function(){"use strict";function e(a,i){return function(e){var n=new Date,t=new Date(e);return t.getDate()===n.getDate()&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()?a("date")(t.getTime(),"shortTime"):t.getDate()===n.getDate()-1&&t.getMonth()===n.getMonth()&&t.getFullYear()===n.getFullYear()?i.instant("DASHBOARDS.YESTERDAY")+" "+a("date")(t.getTime(),"shortTime"):a("date")(t.getTime(),"MMM d, y h:mm a")}}function n(e){return{Today:e.instant("DASHBOARDS.TODAY"),Yesterday:e.instant("DASHBOARDS.YESTERDAY"),"This Week":e.instant("DASHBOARDS.THIS_WEEK"),"Last Week":e.instant("DASHBOARDS.LAST_WEEK"),"This Month":e.instant("DASHBOARDS.THIS_MONTH"),"Last Month":e.instant("DASHBOARDS.LAST_MONTH"),"This Year":e.instant("DASHBOARDS.THIS_YEAR"),"Last Year":e.instant("DASHBOARDS.LAST_YEAR"),January:e.instant("DASHBOARDS.JANUARY"),February:e.instant("DASHBOARDS.FEBRUARY"),March:e.instant("DASHBOARDS.MARCH"),April:e.instant("DASHBOARDS.APRIL"),May:e.instant("DASHBOARDS.MAY"),June:e.instant("DASHBOARDS.JUNE"),July:e.instant("DASHBOARDS.JULY"),August:e.instant("DASHBOARDS.AUGUST"),September:e.instant("DASHBOARDS.SEPTEMBER"),October:e.instant("DASHBOARDS.OCTOBER"),November:e.instant("DASHBOARDS.NOVEMBER"),December:e.instant("DASHBOARDS.DECEMBER"),Mon:e.instant("DASHBOARDS.MON"),Tue:e.instant("DASHBOARDS.TUE"),Wed:e.instant("DASHBOARDS.WED"),Thu:e.instant("DASHBOARDS.THU"),Fri:e.instant("DASHBOARDS.FRI"),Sat:e.instant("DASHBOARDS.SAT"),Sun:e.instant("DASHBOARDS.SUN")}}e.$inject=["$filter","$translate"],n.$inject=["$translate"],angular.module("motion").filter("limitObjectFromTo",function(){return function(e,n,t){var a,i={},s=0;for(a in e)if(t<=s&&(i[a]=e[a]),++s===t+n)break;return i}}).filter("formatdate",e).factory("IndexFactory",function(){var e=[{value:"jan"},{value:"feb"},{value:"mar"},{value:"apr"},{value:"may"},{value:"jun"},{value:"jul"},{value:"aug"},{value:"sep"},{value:"oct"},{value:"nov"},{value:"dec"}],n=[{value:"1"},{value:"2"},{value:"3"},{value:"4"},{value:"5"},{value:"6"},{value:"7"},{value:"8"},{value:"9"},{value:"10"},{value:"11"},{value:"12"}],t=[{value:"mon"},{value:"tue"},{value:"wed"},{value:"thu"},{value:"fri"},{value:"sat"},{value:"sun"}],a=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31];return{getMonthName:function(){return e},getMonthNumber:function(){return n},getDaysOfWeek:function(){return t},getDaysOfMonth:function(){return a}}}).factory("dateFilterLocalizationFactory",n).factory("jscookie",function(){return Cookies}).factory("Sequence",function(){return{enqueue:function(e){this.tail=this.tail?this.tail.finally(e):e()}}})}(),function(){"use strict";function e(e,n,t){var a;t.html5Mode(!0),n.otherwise("/dashboards/general"),angular.injector(["ngCookies"]).invoke(["$cookies",function(e){a=e}]);var i=a.get("motion.layoutStyle")||"verticalNavigation",s={verticalNavigation:{main:"app/core/layouts/vertical-navigation.html",toolbar:"app/toolbar/layouts/vertical-navigation/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html",header:"app/header/layouts/vertical-navigation/header.html",footer:"app/footer/layouts/vertical-navigation/footer.html"},verticalNavigationFullwidthToolbar:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation/navigation.html"},verticalNavigationFullwidthToolbar2:{main:"app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",toolbar:"app/toolbar/layouts/vertical-navigation-fullwidth-toolbar-2/toolbar.html",navigation:"app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html"},horizontalNavigation:{main:"app/core/layouts/horizontal-navigation.html",toolbar:"app/toolbar/layouts/horizontal-navigation/toolbar.html",navigation:"app/navigation/layouts/horizontal-navigation/navigation.html"},contentOnly:{main:"app/core/layouts/content-only.html",toolbar:"",navigation:""},contentWithToolbar:{main:"app/core/layouts/content-with-toolbar.html",toolbar:"app/toolbar/layouts/content-with-toolbar/toolbar.html",navigation:""}};e.state("app",{abstract:!0,views:{"main@":{templateUrl:s[i].main,controller:"MainController as vm"},"toolbar@app":{templateUrl:s[i].toolbar,controller:"ToolbarController as vm"},"navigation@app":{templateUrl:s[i].navigation,controller:"NavigationController as vm"},"quickPanel@app":{templateUrl:"app/quick-panel/quick-panel.html",controller:"QuickPanelController as vm"},"header@app":{templateUrl:s[i].header,controller:"HeaderController as vm"},"footer@app":{templateUrl:s[i].footer,controller:"FooterController as vm"}},resolve:{license:["apiResolver",function(e){return e.resolve("license@get")}],setting:["apiResolver","settingsManager",function(e,n){return e.resolve("setting@get",{id:1}).then(function(e){return n.set(e),e})}]}})}e.$inject=["$stateProvider","$urlRouterProvider","$locationProvider"],angular.module("motion").config(e)}(),function(){"use strict";function e(e,n){e.onStart({},n.showLoadingIndicator),e.onFinish({},n.hideLoadingIndicator)}e.$inject=["$transitions","LoadingIndicatorService"],angular.module("motion").run(e)}(),function(){"use strict";function e(a,e){var i,o={};function s(){a.$broadcast("socket:connect"),i&&i.connected||(i=io({query:e.getCurrentUser()?"id="+e.getCurrentUser().id:void 0,transports:["websocket","polling"]})).once("disconnect",n)}function n(e){i.once("connect",s),"logout"===e?i.removeAllListeners():a.$broadcast("socket:disconnect"),i&&i.connected&&i.disconnect()}function r(e,n,t){o[e]||(o[e]=[]),o[e].push({wrapper:n,fn:t})}return{connect:s,disconnect:n,getListeners:function(e){return e?o[e]:o},on:function(e,n){n=n||angular.noop,i||s();var t=function(){var e=arguments;a.$applyAsync(function(){n.apply(i,e)})};r(e,t,n),i.on(e,t)},onWithoutApply:function(e,n){n=n||angular.noop,i||s();var t=function(){n.apply(i,arguments)};r(e,t,n),i.on(e,t)},emit:function(e,n,t){t=t||angular.noop,i||s(),i.emit(e,n,function(){var e=arguments;a.$applyAsync(function(){t.apply(i,e)})})},removeAllListeners:function(e){var n;i||s(),i.removeAllListeners(e),n=e,_.isEmpty(o[n])||delete o[n]},removeListener:function(e,n){i||s();var t=function(e,n){var t=o[e];if(!_.isEmpty(t))for(var a=0;a<t.length;a++){var i=t[a];if(i.fn===n){var s=i.wrapper;return t.splice(a,1),s}}}(e,n);i.removeListener(e,t)}}}e.$inject=["$rootScope","Auth"],angular.module("motion").factory("socket",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o,r){var l=this;l.progresslogin=!1,l.googleSsoEnabled=!1,l.adSsoEnabled=!1,l.login=function(){return l.progresslogin=!0,l.message="",s.login(l.form).then(function(){return n.go("app.dashboards.general")}).catch(function(e){l.message=e.data?e.data.message:e.message}).finally(function(){l.progresslogin=!1})},l.loginOauth=function(e){l.message="",t.location.href=s.loginSSO(e)},l.loginAD=function(){return l.progresslogin=!0,l.message="",s.loginAD(l.form).then(function(){return n.go("app.dashboards.general")}).catch(function(e){l.message=e.data?e.data.message:e.message}).finally(function(){l.progresslogin=!1})},l.onInit=function(){{if(n.params.token&&n.params.userId)return s.removeCookies(),l.progresslogin=!0,o.secureCookieEnabled?r.set("motion.token",n.params.token,{secure:!0,sameSite:"none"}):r.set("motion.token",n.params.token),i.user.get({id:n.params.userId}).$promise.then(function(e){e&&(s.setCurrentUser(e),n.go("app.dashboards.general"))}).finally(function(){l.progresslogin=!1});s.isLoggedIn()&&n.go("app.dashboards.general")}l.googleSsoEnabled=o.googleSsoEnabled,l.adSsoEnabled=o.adSsoEnabled},l.onInit()}e.$inject=["$state","$window","$cookies","$timeout","api","Auth","setting","jscookie"],angular.module("app.login").controller("LoginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="ANALYTICS.EDIT_EXTRACTEDREPORT",g.extractedReport=angular.copy(l),g.extractedReports=r,g.newExtractedReport=!1,g.extractedReport||(g.extractedReport={},g.title="ANALYTICS.NEW_EXTRACTEDREPORT",g.newExtractedReport=!0),g.addNewExtractedReport=function(){g.errors=[],d.analyticExtractedReport.save(g.extractedReport).$promise.then(function(e){g.extractedReports.unshift(e.toJSON()),o.success({title:"ExtractedReport properly created",msg:g.extractedReport.name?g.extractedReport.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveExtractedReport=function(){g.errors=[],d.analyticExtractedReport.update({id:g.extractedReport.id},g.extractedReport).$promise.then(function(e){var n=_.find(g.extractedReports,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ExtractedReport properly saved!",msg:g.extractedReport.name?g.extractedReport.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteExtractedReport=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The extractedReport will be deleted.").ariaLabel("Delete ExtractedReport").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.analyticExtractedReport.delete({id:g.extractedReport.id}).$promise.then(function(){_.remove(g.extractedReports,{id:g.extractedReport.id}),o.success({title:"ExtractedReport properly deleted!",msg:(g.extractedReport.name||"extractedReport")+" has been deleted!"}),v(g.extractedReport)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticExtractedReport.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","extractedReports","extractedReport","api","Auth","license","setting","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditExtractedReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.extractedReports=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="extractedReports",f.listOrder="",f.listOrderAsc=null,f.selectedExtractedReports=[],f.query={fields:"createdAt,updatedAt,id,name,basename,savename,type,startDate,endDate,status,output,reportId,reportType",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{extractedReport:e,extractedReports:f.extractedReports.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.downloadfile2=function(s,e){return m.analyticExtractedReport.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.savename;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticExtractedReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("extractedReport")+"?").htmlContent("<b>"+(e.name||"extractedReport")+"</b> will be deleted.").ariaLabel("delete extractedReport").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getExtractedReports=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.analyticExtractedReport.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ExtractedReports",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditExtractedReport=function(e,n){i.show({controller:"CreateOrEditExtractedReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/extractedReports/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{extractedReport:n,extractedReports:f.extractedReports.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteExtractedReport=y,f.exportSelectedExtractedReports=function(){var e=angular.copy(f.selectedExtractedReports);return f.selectedExtractedReports=[],e},f.deleteSelectedExtractedReports=function(e){var n=i.confirm().title("Are you sure want to delete the selected extractedReports?").htmlContent("<b>"+f.selectedExtractedReports.length+" selected</b> will be deleted.").ariaLabel("delete ExtractedReports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedExtractedReports.forEach(function(e){y(e)}),f.selectedExtractedReports=[]})},f.deselectExtractedReports=function(){f.selectedExtractedReports=[]},f.selectAllExtractedReports=function(){f.selectedExtractedReports=f.extractedReports.rows};var b=!0,A=1;function E(e){f.extractedReports=e||{count:0,rows:[]}}function y(e){m.analyticExtractedReport.delete({id:e.id}).$promise.then(function(){_.remove(f.extractedReports.rows,{id:e.id}),f.extractedReports.count-=1,f.extractedReports.rows.length||f.getExtractedReports(),p.success({title:_.startCase("ExtractedReport")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticExtractedReport"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEanalyticExtractedReport",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getExtractedReports())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","extractedReports","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.analytics").controller("ExtractedReportsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="ANALYTICS.EDIT_METRIC",g.metric=angular.copy(l),g.metrics=r,g.newMetric=!1,g.metric||(g.metric={table:"report_agent"},g.title="ANALYTICS.NEW_METRIC",g.newMetric=!0),g.addNewMetric=function(){g.errors=[],d.analyticMetric.save(g.metric).$promise.then(function(e){g.metrics.unshift(e.toJSON()),o.success({title:"Metric properly created",msg:g.metric.name?g.metric.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMetric=function(){g.errors=[],d.analyticMetric.update({id:g.metric.id},g.metric).$promise.then(function(e){var n=_.find(g.metrics,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Metric properly saved!",msg:g.metric.name?g.metric.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMetric=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The metric will be deleted.").ariaLabel("Delete Metric").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.analyticMetric.delete({id:g.metric.id}).$promise.then(function(){_.remove(g.metrics,{id:g.metric.id}),o.success({title:"Metric properly deleted!",msg:(g.metric.name||"metric")+" has been deleted!"}),v(g.metric)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.analyticMetric.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticMetric.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","metrics","metric","api","Auth","license","setting","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditMetricDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.metrics=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="metrics",f.listOrder="",f.listOrderAsc=null,f.selectedMetrics=[],f.query={fields:"createdAt,updatedAt,id,name,table,metric,description",sort:"-updatedAt",limit:10,page:1},f.arraytable=_.keyBy([{option:"Agent Report",value:"'report_agent'"},{option:"Call Report",value:"'report_call'"},{option:"CDR",value:"'cdr'"},{option:"Chat Website",value:"'chat_websites'"},{option:"Chat Interaction",value:"'chat_interactions'"},{option:"Chat Messages",value:"'chat_messages'"},{option:"Chat Offline Messages",value:"'chat_offline_messages'"},{option:"Chat Queues",value:"'chat_queues'"},{option:"Chat Report Queue",value:"'report_chat_queue'"},{option:"Chat Report Transfer",value:"'report_chat_transfer'"},{option:"Companies",value:"'cm_companies'"},{option:"Call transfer report",value:"'report_call_transfer'"},{option:"Contacts",value:"'cm_contacts'"},{option:"CSquare Report",value:"'report_square'"},{option:"CSquare Details Report",value:"'report_square_details'"},{option:"Dial Report",value:"'report_dial'"},{option:"Dialer Hopper Processing",value:"'cm_hopper'"},{option:"Dialer Hopper Logs",value:"'cm_hopper_history'"},{option:"Dialer Hopper Final",value:"'cm_hopper_final'"},{option:"Email Account",value:"'mail_accounts'"},{option:"Email Interaction",value:"'mail_interactions'"},{option:"Email Messages",value:"'mail_messages'"},{option:"Email Queues",value:"'mail_queues'"},{option:"Email Report Queue",value:"'report_mail_queue'"},{option:"Email Report Transfer",value:"'report_mail_transfer'"},{option:"Fax Account",value:"'fax_accounts'"},{option:"Fax Interaction",value:"'fax_interactions'"},{option:"Fax Messages",value:"'fax_messages'"},{option:"Fax Queues",value:"'fax_queues'"},{option:"Fax Report Queue",value:"'report_fax_queue'"},{option:"Fax Report Transfer",value:"'report_fax_transfer'"},{option:"Jscripty Sessions",value:"'report_jscripty_sessions'"},{option:"Jscripty Questions",value:"'report_jscripty_questions'"},{option:"Jscripty Answers",value:"'report_jscripty_answers'"},{option:"Lists",value:"'cm_lists'"},{option:"Member Report",value:"'report_member'"},{option:"Openchannel Account",value:"'openchannel_accounts'"},{option:"Openchannel Interaction",value:"'openchannel_interactions'"},{option:"Openchannel Messages",value:"'openchannel_messages'"},{option:"Openchannel Queues",value:"'openchannel_queues'"},{option:"Openchannel Report Queue",value:"'report_openchannel_queue'"},{option:"Openchannel Report Transfer",value:"'report_openchannel_transfer'"},{option:"Queue Report",value:"'report_queue'"},{option:"SMS Account",value:"'sms_accounts'"},{option:"SMS Interaction",value:"'sms_interactions'"},{option:"SMS Messages",value:"'sms_messages'"},{option:"SMS Queues",value:"'sms_queues'"},{option:"SMS Report Queue",value:"'report_sms_queue'"},{option:"SMS Report Transfer",value:"'report_sms_transfer'"},{option:"Users",value:"'users'"},{option:"Voice Recordings",value:"'voice_recordings'"},{option:"Whatsapp Account",value:"'whatsapp_accounts'"},{option:"Whatsapp Interaction",value:"'whatsapp_interactions'"},{option:"Whatsapp Messages",value:"'whatsapp_messages'"},{option:"Whatsapp Queues",value:"'whatsapp_queues'"},{option:"Whatsapp Report Queue",value:"'report_whatsapp_queue'"},{option:"Whatsapp Report Transfer",value:"'report_whatsapp_transfer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{metric:e,metrics:f.metrics.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("metric")+"?").htmlContent("<b>"+(e.name||"metric")+"</b> will be deleted.").ariaLabel("delete metric").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMetrics=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.analyticMetric.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Metrics",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMetric=function(e,n){i.show({controller:"CreateOrEditMetricDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/metrics/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{metric:n,metrics:f.metrics.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMetric=y,f.exportSelectedMetrics=function(){var e=angular.copy(f.selectedMetrics);return f.selectedMetrics=[],e},f.deleteSelectedMetrics=function(e){var n=i.confirm().title("Are you sure want to delete the selected metrics?").htmlContent("<b>"+f.selectedMetrics.length+" selected</b> will be deleted.").ariaLabel("delete Metrics").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMetrics.forEach(function(e){y(e)}),f.selectedMetrics=[]})},f.deselectMetrics=function(){f.selectedMetrics=[]},f.selectAllMetrics=function(){f.selectedMetrics=f.metrics.rows};var b=!0,A=1;function E(e){f.metrics=e||{count:0,rows:[]}}function y(e){m.analyticMetric.delete({id:e.id}).$promise.then(function(){_.remove(f.metrics.rows,{id:e.id}),f.metrics.count-=1,f.metrics.rows.length||f.getMetrics(),p.success({title:_.startCase("Metric")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEanalyticMetric"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEanalyticMetric",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMetrics())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","metrics","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.analytics").controller("MetricsController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o){var r=this;function l(){n.hide()}r.errors=[],r.report=angular.copy(t),r.report.name+="-copy",r.treeCustomData=o,r.treeCustomConfig={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},r.treeCustomEvents={select_node:function(e,n){r.currentNode=n.node}},r.copyReport=function(){var t;r.errors=[],i.analyticCustomReport.save({name:r.report.name,description:r.report.description,table:r.report.table,conditions:r.report.conditions,joins:r.report.joins,parent:r.currentNode.id}).$promise.then(function(e){t=e,a.success({title:"Report properly copied!",msg:r.report.name?r.report.name+" has been copied!":""});var n={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return n["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=r.report.id,i.analyticFieldReport.get(n).$promise}).then(function(e){var e=_.map(e.rows,function(e){return _.extend({},e,{CustomReportId:t.id})});return i.analyticFieldReport.bulkCreate(e).$promise}).then(function(){a.success({title:"Fields copied!",msg:"Fields has been copied!"}),l()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:COPYREPORT",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","treeCustomData"],angular.module("app.analytics").controller("CopyReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){n.hide()}c.errors=[],c.joinTables=[],c.title="ANALYTICS.EDIT_REPORT",c.crudPermissions=d,c.report=angular.copy(i),c.reports=a,c.newReport=!1,c.tables=l.getMap(),c.joinTypes=[{key:"join",value:"Join"},{key:"left_join",value:"Left Join"},{key:"right_join",value:"Right Join"},{key:"cross_join",value:"Cross Join"}],c.report||(c.report={name:"",table:"report_agent",description:"",parent:r.id},c.title="ANALYTICS.NEW_REPORT",c.newReport=!0),c.addNewReport=function(){c.errors=[],c.report.joins=_.map(c.joinTables||[],function(e){return{parentKey:e.parentKey,foreignTable:e.name,foreignKey:e.foreignKey,type:e.type.toLowerCase()}}),c.report.joins=JSON.stringify(c.report.joins),s[o].save(c.report).$promise.then(function(e){c.reports.unshift(e),t.success({title:"Report properly created",msg:c.report.name?c.report.name+" has been created!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.save"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticReport.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveReport=function(){c.errors=[],s[o].update({id:c.report.id},c.report).$promise.then(function(e){var n=_.find(c.reports,{id:e.id});n&&_.merge(n,e),t.success({title:"Report properly saved!",msg:c.report.name?c.report.name+" has been saved!":""}),m()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.update"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticReport.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteReport=function(){c.errors=[];var e=n.confirm().title("Are you sure?").content("The report will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(event);n.show(e).then(function(){s[o].delete({id:c.report.id}).$promise.then(function(){_.remove(c.reports,{id:c.report.id}),t.success({title:"Report properly deleted!",msg:c.report.name?c.report.name+" has been deleted!":""}),m()}).catch(function(e){c.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReport.delete"}]})},function(){})},c.closeDialog=m,c.selectedTableChange=function(e){e&&(delete c.selectedItem,c.joinTables.push(e))},c.removeJoin=function(e){c.joinTables.splice(e,1)},c.getFields=function(n,t,e){var a=_.find(c.tables,{name:e});a&&a.api&&s[a.api].describe().$promise.then(function(e){n[t]=_.difference(_.keys(e),["$promise","$resolved"])}).catch(function(e){console.error(e)})}}e.$inject=["$location","$mdDialog","toasty","reports","report","api","apiName","currentNode","describeTable","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditReportDialogController",e)}(),function(){"use strict";function e(i,s,o,e){var r=this;r.report={},r.conditions=e.getConditions,r.init=function(e,n){r.report=e,r.report.condition=angular.fromJson(e.conditions)||{group:{operator:"AND",rules:[]}},r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1};for(var t=0;t<r.report.condition.group.rules.length;t++)if(r.report.condition.group.rules[t].field){var a=r.report.condition.group.rules[t].field.split(".");1===a.length&&(r.report.condition.group.rules[t].field=r.report.table+"."+r.report.condition.group.rules[t].field)}s.getColumns(r.report.table).then(function(e){r.columns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt"])}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data):e.toString()})})},r.addCondition=function(e){e.unshift({condition:"=",field:"",value:""})},r.addGroup=function(e){e.push({group:{operator:"AND",rules:[]}})},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the item?").htmlContent("The item will be deleted.").ariaLabel("delete item").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){e.splice(n,1)},function(){console.log("CANCEL")})},r.isValueByCondition=function(e){return!_.includes(["IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"],e)}}e.$inject=["$mdDialog","describeTable","toasty","sqlUtil"],angular.module("app.analytics").controller("ReportConditionsController",e)}(),function(){"use strict";function e(a){var i={report_call_transfer:"voiceTransferReport",cm_companies:"cmCompany",cm_contacts:"cmContact",cm_hopper:"cmHopper",cm_hopper_final:"cmHopperFinal",cm_hopper_history:"cmHopperHistory",cm_lists:"cmList",chat_websites:"chatWebsite",chat_queues:"chatQueue",chat_interactions:"chatInteraction",chat_messages:"chatMessage",chat_offline_messages:"chatOfflineMessage",report_chat_queue:"chatQueueReport",report_chat_transfer:"chatTransferReport",mail_accounts:"mailAccount",mail_queues:"mailQueue",mail_interactions:"mailInteraction",mail_messages:"mailMessage",report_mail_queue:"mailQueueReport",report_mail_transfer:"mailTransferReport",openchannel_accounts:"openchannelAccount",openchannel_queues:"openchannelQueue",openchannel_interactions:"openchannelInteraction",openchannel_messages:"openchannelMessage",report_openchannel_queue:"openchannelQueueReport",report_openchannel_transfer:"openchannelTransferReport",sms_accounts:"smsAccount",sms_queues:"smsQueue",sms_interactions:"smsInteraction",sms_messages:"smsMessage",report_sms_queue:"smsQueueReport",report_sms_transfer:"smsTransferReport",fax_accounts:"faxAccount",fax_queues:"faxQueue",fax_interactions:"faxInteraction",fax_messages:"faxMessage",report_fax_transfer:"faxTransferReport",report_fax_queue:"faxQueueReport",report_call:"voiceCallReport",report_agent:"voiceAgentReport",report_square:"squareReport",report_member:"memberReport",report_queue:"voiceQueueReport",report_square_details:"squareReportDetail",report_dial:"voiceDialReport",report_jscripty_sessions:"jscriptySessionReport",report_jscripty_questions:"jscriptyQuestionReport",report_jscripty_answers:"jscriptyAnswerReport",users:"user",voice_recordings:"voiceRecording",cdr:"cdr",whatsapp_accounts:"whatsappAccount",whatsapp_queues:"whatsappQueue",whatsapp_interactions:"whatsappInteraction",whatsapp_messages:"whatsappMessage",report_whatsapp_queue:"whatsappQueueReport",report_whatsapp_transfer:"whatsappTransferReport"};return{getMap:function(){var t=[];return _.forIn(i,function(e,n){t.push({name:n,api:e})}),t},getColumns:function(e){var n=i[e],t={};return"cm_contacts"===e&&(t.analytics=!0),a[n].describe(t).$promise}}}e.$inject=["api"],angular.module("app.analytics").factory("describeTable",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;(u.errors=[],u.title="Edit Report Field",u.report=i,u.reportField=angular.copy(o),u.reportFields=s,u.metrics=r,u.columns=l,u.sqlUtil=d,u.newReportField=!1,u.crudPermissions=m,u.reportField)?(u.reportField.type=u.reportField.custom?"custom":u.reportField.MetricId?"metric":"column",u.reportField.field&&!u.reportField.custom&&_.isNil(u.reportField.MetricId)&&1===u.reportField.field.split(".").length&&(u.reportField.field=u.report.table+"."+u.reportField.field)):(u.reportField={type:"column",function:null,format:null,groupBy:!1,orderBy:null},u.title="New Report Field",u.newReportField=!0);function p(){t.hide()}u.addNewReportField=function(){u.errors=[],u.reportField.custom="custom"===u.reportField.type,u.reportField.MetricId="metric"===u.reportField.type?u.reportField.MetricId:null,u.reportField.CustomReportId=u.report.id,c.analyticFieldReport.save(u.reportField).$promise.then(function(e){u.reportFields.push(e),a.success({title:"Report field properly created",msg:u.reportField.field?u.reportField.field+" has been created!":u.reportField.type+" has been created!"}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticFieldReport.save"}]})},u.saveReportField=function(){u.errors=[],u.reportField.custom="custom"===u.reportField.type,u.reportField.MetricId="metric"===u.reportField.type?u.reportField.MetricId:null,c.analyticFieldReport.update({id:u.reportField.id},u.reportField).$promise.then(function(e){var n=_.find(u.reportFields,{id:e.id});n&&_.merge(n,e),a.success({title:"Report Field properly saved!",msg:u.reportField.field?u.reportField.field+" has been saved!":""}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticFieldReport.update"}]})},u.deleteReportField=function(e){u.errors=[];var n=t.confirm().title("Are you sure?").content("The field will be deleted.").ariaLabel("Delete Report").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){c.analyticFieldReport.delete({id:u.reportField.id}).$promise.then(function(){_.remove(u.reportFields,{id:u.reportField.id}),a.success({title:"Report Field properly deleted!",msg:u.reportField.field?u.reportField.field+" has been deleted!":""}),p()}).catch(function(e){u.errors=e.data.errors||[{message:e.toString(),type:"api.analyticReportField.delete"}]})},function(){})},u.closeDialog=p}e.$inject=["$scope","$location","$mdDialog","toasty","report","reportFields","reportField","metrics","columns","sqlUtil","api","crudPermissions"],angular.module("app.analytics").controller("CreateOrEditReportFieldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;c.report={},c.reportFields={count:0,rows:[]},c.functions=_.keyBy(l.getFunctions,"value"),c.formats=_.keyBy(l.getFormats,"value"),c.groupBy=_.keyBy(l.getGroupBy,"value"),c.orderBy=_.keyBy(l.getOrderBy,"value"),c.selectedReportFields=[],c.query={fields:"createdAt,updatedAt,id,field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0},c.sortableTable={animation:100,onSort:function(e){o.analyticFieldReport.addFields({id:c.report.id},e.models).$promise.then(function(e){c.reportFields.rows=e}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDFIELDS"})})}},c.init=function(e,n){c.report=e,c.query.CustomReportId=c.report.id,c.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},c.sortableTable.disabled=!c.crudPermissions.canEdit,r.getColumns(c.report.table).then(function(e){return c.columns=_.difference(_.keys(e),["$promise","$resolved"]),o.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise}).then(function(e){c.metrics=e.rows}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.getReportFields()},c.deleteConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>"+e.field+"</b> will be deleted.").ariaLabel("delete field").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){p(e)},function(){console.log("CANCEL")})},c.success=u,c.getReportFields=function(){c.promise=o.analyticFieldReport.get(c.query,u).$promise},c.createOrEditReportField=function(e,n){a.show({controller:"CreateOrEditReportFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/edit/field/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:c.report,reportField:n,reportFields:c.reportFields.rows,metrics:c.metrics,columns:c.columns,setting:null,crudPermissions:c.crudPermissions}})},c.deleteReportField=p,c.deleteSelectedReportFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+c.selectedReportFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){c.selectedReportFields.forEach(function(e){p(e)}),c.selectedReportFields=[]})},c.getMetricName=function(e){var n=_.find(c.metrics,{id:e});return n?n.name:d.instant("ANALYTICS.NO_METRIC_FOUND")},c.getMetricValue=function(e){var n=_.find(c.metrics,{id:e});return n?n.metric:d.instant("ANALYTICS.NO_METRIC_FOUND")};var m=!0;function u(e){c.reportFields=e||{count:0,rows:[]}}function p(e){o.analyticFieldReport.delete({id:e.id}).$promise.then(function(){c.selectedReportFields=[],_.remove(c.reportFields.rows,{id:e.id}),c.reportFields.count-=1,c.reportFields.rows.length||c.getReportFields(),s.success({title:"Field deleted!",msg:e.field?e.field+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}n.$watch("vm_rf.query.filter",function(e,n){m?t(function(){m=!1}):c.getReportFields()})}e.$inject=["$cookies","$scope","$timeout","$mdDialog","$document","toasty","api","describeTable","sqlUtil","$translate"],angular.module("app.analytics").controller("ReportFieldsController",e)}(),function(){"use strict";angular.module("app.analytics").factory("sqlUtil",function(){return{getFunctions:[{value:"SUM",option:function(e){return"SUM ("+e+")"}},{value:"COUNT",option:function(e){return"COUNT ("+e+")"}},{value:"COUNT DISTINCT",option:function(e){return"COUNT (DISTINCT "+e+")"}},{value:"MAX",option:function(e){return"MAX ("+e+")"}},{value:"MIN",option:function(e){return"MIN ("+e+")"}},{value:"AVG",option:function(e){return"AVG ("+e+")"}},{value:"GROUP_CONCAT",option:function(e){return"GROUP_CONCAT ("+e+")"}},{value:"GROUP_CONCAT ASC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" ASC)"}},{value:"GROUP_CONCAT DESC",option:function(e){return"GROUP_CONCAT ("+e+" ORDER BY "+e+" DESC)"}}],getFormats:[{value:"SEC_TO_TIME",option:function(e){return"SEC_TO_TIME ("+e+")"}},{value:"DATE",option:function(e){return"DATE ("+e+")"}},{value:"HOUR",option:function(e){return"HOUR ("+e+")"}},{value:"ROUND",option:function(e){return"ROUND ("+e+")"}},{value:"UNIX_TIMESTAMP",option:function(e){return"UNIX_TIMESTAMP ("+e+")"}}],getGroupBy:[{value:!1,option:function(){return"No"}},{value:!0,option:function(e){return"GROUP BY "+e}}],getOrderBy:[{value:"ASC",option:function(e){return"ORDER BY "+e+" ASC"}},{value:"DESC",option:function(e){return"ORDER BY "+e+" DESC"}}],getConditions:["=","!=","<","<=",">",">=","LIKE","NOT LIKE","IS NULL","IS NOT NULL","IS EMPTY","IS NOT EMPTY"]}})}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;function r(e){return _.isArray(e)}o.report=a||{},o.userProfileSection=s&&1==s.count?s.rows[0]:null,o.crudPermissions=i.parseCrudPermissions(o.userProfileSection?o.userProfileSection.crudPermissions:null),o.selectedTab=e.params.tab||0,o.gotoReports=function(){e.go("app.analytics.reports",{},{reload:"app.analytics.reports"})},o.saveReport=function(){o.report.conditions=angular.toJson(o.report.condition),t.analyticCustomReport.update({id:o.report.id},_.omit(o.report,"joins")).$promise.then(function(){n.success({title:"Report updated!",msg:o.report.name?o.report.name+" has been updated!":""})}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETreport",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.previewReport=function(){o.columns=[],o.rows=[],o.error=!1,t.analyticFieldReport.get({fields:"field,alias",nolimit:!0,CustomReportId:o.report.id}).$promise.then(function(e){return o.columns=e?e.rows:[],t.analyticCustomReport.preview({id:o.report.id}).$promise}).then(function(e){o.rows=e}).catch(function(e){console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(o.error)})},o.queryReport=function(){return o.queryResult="Loading...",t.analyticCustomReport.query({id:o.report.id}).$promise.then(function(e){o.queryResult=e.sql}).catch(function(e){o.queryResult="",console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},n.error(o.error)})},o.mapArray=function(e,n){if(r(e))return _.map(e,n).join(",");return""},o.isArray=r,o.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n}}e.$inject=["$state","toasty","api","report","Auth","userProfileSection"],angular.module("app.analytics").controller("ReportController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.errors=[],o.report=angular.copy(a),o.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n},o.closeDialog=function(){n.hide()},function(){o.columns=[],o.rows=[],o.error=!1;var e={fields:"field,alias",nolimit:!0};e["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=o.report.id,o.promise=i.analyticFieldReport.get(e).$promise.then(function(e){return o.columns=e?e.rows:[],i[s].preview({id:o.report.id}).$promise}).then(function(e){o.rows=e}).catch(function(e){console.log(e),o.error={title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:analyticFieldReport",msg:e.data?e.data.message:e.toString(),sql:e.data&&e.data.parent?e.data.parent.sql:"NO QUERY"},t.error(o.error)})}()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName"],angular.module("app.analytics").controller("PreviewReportDialogController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,n,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.reports={count:0,rows:[]},p.userProfile=r,p.userProfileSection=l&&1==l.count?l.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.selectedReports=[],p.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},p.apiName=null,p.currentPath="",p.customTree=!0,p.editstate=function(e,n){s.go("app.analytics.reports.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.copydialog=function(e,n){i.show({controller:"CopyReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/copy/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,treeCustomData:p.treeCustomInstance.jstree(!0).get_json("#")}}).finally(function(){})},p.previewdialog=function(e,n){i.show({controller:"PreviewReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/preview/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName}})},p.rundialog=function(e,n){i.show({controller:"RunReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/dialog.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{report:e,apiName:p.apiName,currentPath:p.currentPath}})},p.downloadfile=function(a,e){var i;d.analyticMetric.get({fields:"id,name,metric,table",nolimit:!0}).$promise.then(function(e){i=_.keyBy(e.rows,"id");var n={fields:"field,alias,function,format,groupBy,orderBy,custom,MetricId",nolimit:!0};return n["analyticCustomReport"===p.apiName?"CustomReportId":"DefaultReportId"]=a.id,d.analyticFieldReport.get(n).$promise}).then(function(e){for(var n=0;n<e.rows.length;n+=1)e.rows[n].MetricId&&(e.rows[n].field=i[e.rows[n].MetricId].metric,e.rows[n].custom=!0),delete e.rows[n].MetricId;var t=o.document.createElement("a");t.href="data:text/json;charset=utf-8,"+o.encodeURIComponent(angular.toJson({name:a.name,description:a.description,table:a.table,conditions:a.conditions,joins:a.joins,fields:e.rows})),t.download=a.name+".json",t.target="_self",t.click(),m.success({title:"Report downloaded!",msg:a.name?a.name+" has been downloaded!":""})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DOWNLOADJSON",msg:e.data?JSON.stringify(e.data):e.toString()})})},p.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the report?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete report").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){b(e)},function(){console.log("CANCEL")})},p.success=h,p.getReports=f,p.createOrEditReport=function(e,n){i.show({controller:"CreateOrEditReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/create/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{report:n,reports:p.reports.rows,apiName:p.apiName,currentNode:p.currentNode,setting:null,crudPermissions:p.crudPermissions}})},p.importReport=function(e,n,t){if("application/json"===e.file.type){var a=new FileReader;a.onload=function(e){console.log(e.target.result);try{var t=atob(e.target.result.split(",")[1]);t=angular.fromJson(t),d.analyticCustomReport.save({name:t.name,description:t.description,table:t.table,conditions:t.conditions,joins:t.joins,parent:p.currentNode.id}).$promise.then(function(n){p.reports.rows.unshift(n),m.success({title:"Report saved!",msg:n.name?n.name+" has been saved!":""});var e=_.map(t.fields,function(e){return _.extend({},e,{CustomReportId:n.id})});return d.analyticFieldReport.bulkCreate(e).$promise}).then(function(e){m.success({title:"Fields saved!",msg:"Fields has been saved!"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETanalyticReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}catch(e){console.error(e),m.error({title:"Decode File Error",msg:e.toString()})}},a.readAsDataURL(e.file)}else m.error({title:"Format Error",msg:"Please use only json files"})},p.deleteReport=b,p.exportSelectedReports=function(){var e=angular.copy(p.selectedReports);return p.selectedReports=[],e},p.deleteSelectedReports=function(e){var n=i.confirm().title("Are you sure want to delete the selected reports?").htmlContent("<b>"+p.selectedReports.length+" selected</b> will be deleted.").ariaLabel("delete Reports").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){p.selectedReports.forEach(function(e){b(e)}),p.selectedReports=[]})},p.deselectReports=function(){p.selectedReports=[]},p.selectAllReports=function(){p.selectedReports=p.reports.rows},p.treeDefaultData=c.rows[0]?angular.fromJson(c.rows[0].tree):[],p.treeCustomData=c.rows[1]?angular.fromJson(c.rows[1].tree):[],p.treeDefaultConfig=S(!1),p.treeCustomConfig=S(!0),p.treeDefaultEvents=T(!1),p.treeCustomEvents=T(!0);var g=!0,v=1;function h(e){p.reports=e||{count:0,rows:[]}}function f(){if(p.query.offset=(p.query.page-1)*p.query.limit,p.apiName)if("admin"===p.currentUser.role||p.userProfileSection.autoAssociation)p.promise=d[p.apiName].get(p.query,h).$promise;else{var a=[];p.promise=d[p.apiName].get(p.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:p.userProfileSection.id,type:"analyticDefaultReport"===p.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),h({count:t.length,rows:t})}return h(null)}):h(null)})}}function b(e){p.apiName&&d[p.apiName].delete({id:e.id}).$promise.then(function(){_.remove(p.reports.rows,{id:e.id}),p.reports.count-=1,p.reports.rows.length||p.getReports(),m.success({title:"Report deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.analyticreport.delete"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.analyticreport.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function A(e,n){p.treeDefaultInstance.jstree(!0).deselect_all(),p.treeDefaultInstance.jstree(!0).close_all(),p.currentNode=n.node,p.currentNode.custom=!0,p.currentPath=p.treeCustomInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticCustomReport",p.query.parent=n.node.id,f()}function E(e,n){p.treeCustomInstance.jstree(!0).deselect_all(),p.treeCustomInstance.jstree(!0).close_all(),p.currentNode=n.node,p.currentNode.custom=!1,p.currentPath=p.treeDefaultInstance.jstree(!0).get_path(p.currentNode).join("/ "),p.apiName="analyticDefaultReport",p.query.parent=n.node.id,f()}function y(e,n){var t,a,i;"rename_node"===e.type&&(a=(t=n).node.id,i="","custom"===t.node.parent?t.node.id.includes("custom_report_")||(i="custom_report_"+t.text):i=t.node.parent+"_"+t.text,p.treeCustomInstance.jstree(!0).set_id(t.node,"custom_report_"+i.toLowerCase()),t.node.a_attr.id=t.node.a_attr.id.replace(a,t.node.id),t.node.li_attr.id=t.node.id);var s=angular.toJson(p.treeCustomInstance.jstree(!0).get_json("#"));d.analyticTreeReport.update({id:2,tree:s}).$promise.then(function(){c.rows[1]&&(c.rows[1].tree=s),m.success({title:"Node Updated",msg:n.node.text?n.node.text+" has been updated!":"Node has been updated!"})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEanalyticTreeReport",msg:e.data?JSON.stringify(e.data):e.toString()})})}function S(e){return{core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:e?["contextmenu","dnd","search","state","wholerow"]:["search","state","wholerow"],contextmenu:{items:function(t){var e={};return p.crudPermissions.canEdit&&_.assign(e,{create:{label:n.instant("ANALYTICS.CREATE"),action:function(){t=p.treeCustomInstance.jstree(!0).create_node(t),p.treeCustomInstance.jstree(!0).edit(t)}},rename:{_disabled:"#"===t.parent,label:n.instant("ANALYTICS.RENAME"),action:function(){p.treeCustomInstance.jstree(!0).edit(t)}}}),p.crudPermissions.canDelete&&_.assign(e,{remove:{_disabled:"#"===t.parent,label:n.instant("ANALYTICS.REMOVE"),action:function(){var e=i.confirm().title("Are you sure want to delete the node?").htmlContent("<b>"+(t.text?t.text:"Node")+"</b> and its subnode will be deleted.").ariaLabel("delete node").ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n=p.treeCustomInstance.jstree(!0).get_parent(t);n=p.treeCustomInstance.jstree(!0).get_node(n),p.treeCustomInstance.jstree(!0).delete_node(t),e=[t.id].concat(t.children_d||[]),d.analyticCustomReport.get({parent:e.join(","),fields:"id,name"}).$promise.then(function(e){e&&e.rows&&e.rows.forEach(function(e){b(e)})}).catch(function(e){m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEreportsByParents",msg:e.data?JSON.stringify(e.data):e.toString()})}),p.treeCustomInstance.jstree(!0).select_node(n)})}}}),e}}}}function T(e){return e?{create_node:y,rename_node:y,move_node:y,delete_node:y,select_node:A}:{select_node:E}}e.$watch("vm.query.filter",function(e,n){g?t(function(){g=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getReports())}),e.$watch("vm.search",function(e,n){p.treeDefaultInstance&&p.treeDefaultInstance.jstree(!0).search(e),p.treeCustomInstance&&p.treeCustomInstance.jstree(!0).search(e)})}e.$inject=["$scope","$timeout","$document","$mdDialog","$state","$window","$translate","userProfile","userProfileSection","api","treeReports","toasty","Auth"],angular.module("app.analytics").controller("ReportsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r){var l=this;function d(){l.export={id:l.report.id,name:l.report.name,startTime:new Date(moment().startOf("day")),startDate:new Date(moment().startOf("day")),endTime:new Date(moment().endOf("day")),endDate:new Date(moment().endOf("day")),output:"xlsx",fullPath:r?r+"/"+l.report.name:l.report.name}}function c(){t.hide()}l.errors=[],l.report=angular.copy(n),l.export={},l.runReport=function(n){l.export.name=l.export.name.replace(/\//g,"_"),l.errors=[],l.exportDate=_.assign({},l.export,{startDate:moment(l.export.startDate).set("hour",l.export.startTime.getHours()).set("minute",l.export.startTime.getMinutes()).set("second",l.export.startTime.getSeconds()).format("YYYY-MM-DD HH:mm:ss"),endDate:moment(l.export.endDate).set("hour",l.export.endTime.getHours()).set("minute",l.export.endTime.getMinutes()).set("second",l.export.endTime.getSeconds()).format("YYYY-MM-DD HH:mm:ss")}),i[s].run(l.exportDate).$promise.then(function(e){"web"===l.export.output?t.show({controller:"WebReportDialogController",controllerAs:"vm",templateUrl:"app/main/apps/analytics/views/reports/run/web/dialog.html",parent:angular.element(o.body),targetEvent:n,skipHide:!0,locals:{apiName:s,exportDate:l.exportDate,results:e},resolve:{columns:["apiResolver",function(e){var n={fields:"field,alias",nolimit:!0};return n["analyticCustomReport"===s?"CustomReportId":"DefaultReportId"]=l.report.id,e.resolve("analyticFieldReport@get",n)}]}}):(a.success({title:"Report properly run!",msg:l.report.name?l.report.name+" has been run!":""}),c())}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.closeDialog=c,(l.refreshDate=d)()}e.$inject=["$location","$mdDialog","toasty","report","api","apiName","$document","currentPath"],angular.module("app.analytics").controller("RunReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o){var r=this;function l(e){r.results=e||{count:0,rows:[]}}r.errors=[],r.columns=a?a.rows:[],r.results=i||{rows:[],count:0},r.query={limit:10,page:1},r.closeDialog=function(){e.hide()},r.getResults=function(){o.offset=(r.query.page-1)*r.query.limit,o.limit=r.query.limit,r.promise=t[s].run(o,l).$promise},r.valueReplacer=function(e,n){moment(n,"YYYY-MM-DDTHH:mm:ssZ",!0).isValid()&&(n=moment(n,"").format("YYYY-MM-DD HH:mm:ss"));return n}}e.$inject=["$mdDialog","toasty","api","columns","results","apiName","exportDate"],angular.module("app.analytics").controller("WebReportDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CALLYSQUARE.EDIT_ODBC",g.odbc=angular.copy(l),g.odbcs=r,g.newOdbc=!1,g.odbc||(g.odbc={},g.title="CALLYSQUARE.NEW_ODBC",g.newOdbc=!0),g.addNewOdbc=function(){g.errors=[],d.squareOdbc.save(g.odbc).$promise.then(function(e){g.odbcs.unshift(e.toJSON()),o.success({title:"Odbc properly created",msg:g.odbc.name?g.odbc.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOdbc=function(){g.errors=[],d.squareOdbc.update({id:g.odbc.id},g.odbc).$promise.then(function(e){var n=_.find(g.odbcs,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Odbc properly saved!",msg:g.odbc.name?g.odbc.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOdbc=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The odbc will be deleted.").ariaLabel("Delete Odbc").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.squareOdbc.delete({id:g.odbc.id}).$promise.then(function(){_.remove(g.odbcs,{id:g.odbc.id}),o.success({title:"Odbc properly deleted!",msg:(g.odbc.name||"odbc")+" has been deleted!"}),v(g.odbc)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareOdbc.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareOdbc.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","odbcs","odbc","api","Auth","license","setting","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditOdbcDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.odbcs=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="odbcs",f.listOrder="",f.listOrderAsc=null,f.selectedODBC=[],f.query={fields:"createdAt,updatedAt,id,name,dsn,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{odbc:e,odbcs:f.odbcs.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.testtestOdbc=function(e,n){return m.squareOdbc.test({id:e.id}).$promise.then(function(){p.success({title:"Square ODBC properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"Square ODBC properly tested",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("odbc")+"?").htmlContent("<b>"+(e.name||"odbc")+"</b> will be deleted.").ariaLabel("delete odbc").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getODBC=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.squareOdbc.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ODBC",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOdbc=function(e,n){i.show({controller:"CreateOrEditOdbcDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/odbcs/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{odbc:n,odbcs:f.odbcs.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOdbc=y,f.exportSelectedODBC=function(){var e=angular.copy(f.selectedODBC);return f.selectedODBC=[],e},f.deleteSelectedODBC=function(e){var n=i.confirm().title("Are you sure want to delete the selected odbcs?").htmlContent("<b>"+f.selectedODBC.length+" selected</b> will be deleted.").ariaLabel("delete Odbcs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedODBC.forEach(function(e){y(e)}),f.selectedODBC=[]})},f.deselectODBC=function(){f.selectedODBC=[]},f.selectAllODBC=function(){f.selectedODBC=f.odbcs.rows};var b=!0,A=1;function E(e){f.odbcs=e||{count:0,rows:[]}}function y(e){m.squareOdbc.delete({id:e.id}).$promise.then(function(){_.remove(f.odbcs.rows,{id:e.id}),f.odbcs.count-=1,f.odbcs.rows.length||f.getODBC(),p.success({title:_.startCase("Odbc")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareOdbc"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsquareOdbc",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getODBC())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","odbcs","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.callysquare").controller("OdbcsController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o,r,l,d){var c=this;function m(e){n.hide(e)}c.errors=[],c.title="CALLYSQUARE.EDIT_PROJECT",c.crudPermissions=d,c.project=angular.copy(o),c.newWindow=!0,c.projects=s,c.newProject=!1,c.openFromEditor=l,c.project||(c.project={name:"",description:""},c.title="CALLYSQUARE.NEW_PROJECT",c.newProject=!0),c.addNewProject=function(){c.errors=[],r.squareProject.save(c.project).$promise.then(function(e){c.projects.unshift(e),i.success({title:"Project properly created",msg:c.project.name?c.project.name+" has been created!":""}),m(e),c.openFromEditor&&(c.newWindow?t.open("/callysquare/projects/"+e.id,"_blank"):a.go("app.callysquare.projects.edit",{id:e.id}))}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareProject.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveProject=function(){c.errors=[],r.squareProject.update({id:c.project.id},c.project).$promise.then(function(e){var n=_.find(c.projects,{id:e.id});n&&_.merge(n,e),i.success({title:"Project properly saved!",msg:c.project.name?c.project.name+" has been saved!":""}),m(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareProject.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteProject=function(){c.errors=[];var e=n.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(event);n.show(e).then(function(){r.squareProject.delete({id:c.project.id}).$promise.then(function(){_.remove(c.projects,{id:c.project.id}),i.success({title:"Project properly deleted!",msg:c.project.name?c.project.name+" has been deleted!":""}),m(c.project)}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.delete"}]})},function(){})},c.closeDialog=m}e.$inject=["$mdDialog","$window","$state","Auth","toasty","projects","project","api","openFromEditor","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditSquareProjectDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S,T,I,O,C,w,R,x,N,D){var P=this,L={playback:["file_id"],answer:["timeout"],menu:["file_id","digit","response","retry"],getdigits:["file_id","variable_id","mindigit","maxdigit","retry"],getsecretdigits:["file_id","variable_id","mindigit","maxdigit","hiddendigitsnum","retry"],vswitch:["variable_id"],database:["odbc_id","query"],ext_dial:["trunk_name","phone","timeout"],set:["variable_id"],math:["variable_id"],gotoc:["context","extension","priority"],system:["command"],agi:["command"],gotoif:["condition"],saydigits:["digits"],saynumber:["number"],sayphonetic:["text"],record:["file","timeout"],goal:["goalname"],dial:["sip_id","timeout"],queue:["queue_id","timeout"],callback:["list_id","name","phone","delay"],gotoiftime:["interval_id"],voicemail:["mailbox"],subproject:["project_id"],sendSMS:["sms_account_id","to","sms_text"],sendMail:["account_id","to"],sendFax:["account_id","to","attachment_path"],google_cloud_tts:["apiKey","google_cloud_tts_text_type","text"],tts:["text"],ispeechtts:["text","key","speed"],ispeechasr:["key","timeout"],custom_app:["application"],googleasr:["key","timeout"],awspolly:["aws_access_key_id","aws_secret_access_key","text","aws_text_type"],lumenvoxtts:["text"],sestektts:["text"],lumenvoxasr:["grammar"],sestekasr:["grammar"],tildeasr:["appid","appsecret","uri"],login:["findBy"],pause:["findBy","pause_id"],unpause:["findBy"],logout:["findBy"],dialogflow:["key","text","dialogflow_language"],awslex:["aws_access_key_id","aws_secret_access_key","aws_lex_region","aws_bot_name","text"],sesteknda:["text","ndauth_url","username","password","ndassistant_url"],restapi:["url","method"],mrcpsynth:["text"],mrcprecog:["grammar"],dialogflowV2:["dialogflowV2_project_id","client_email","private_key","dialogflowV2_language","text"]},k={queue:["file_id"],database:["variable_id"],pause:["pause_id"]},M={sendMail:["to","cc","bcc"],voicemail:["mailbox"]};function U(e,n,t,a){return _.map(e,function(e){return{value:e[n],option:e[t],group:a?e[a]:void 0,canSelect:void 0===e.canSelect||e.canSelect}})}function F(){var e=Number(_.find(P.attributes,{name:"sip_id"}).value);if(!_.some(d,{id:e})&&0<e)return t.user.get({id:e,fields:"id,fullname,role"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,d.push(n),P.values.sip_id=U(d,"id","fullname","role")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_USER",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.sip_id=U(d,"id","fullname","role")}function $(){var e=Number(_.find(P.attributes,{name:"list_id"}).value);if(!_.some(E,{id:e})&&0<e)return t.cmList.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,E.push(n),P.values.list_id=U(E,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_LIST",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.list_id=U(E,"id","name")}function q(){var e=Number(_.find(P.attributes,{name:"trunk_id"}).value);if(!_.some(c,{id:e})&&0<e)return t.trunk.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,c.push(n),P.values.trunk_id=U(c,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.trunk_id=U(c,"id","name")}function G(){var e=_.find(P.attributes,{name:"trunk_name"}).value;if(!_.some(c,{name:e})&&e)return t.trunk.get({name:e,fields:"id,name"}).$promise.then(function(e){if(0<e.count&&0<e.rows.length){var n=e.rows[0];n.canSelect=!1,c.push(n),P.values.trunk_name=U(c,"name","name")}}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TRUNK",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.trunk_name=U(c,"name","name")}function H(){var e=Number(_.find(P.attributes,{name:"queue_id"}).value);if(!_.some(m,{id:e})&&0<e)return t.voiceQueue.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,m.push(n),P.values.queue_id=U(m,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_QUEUE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.queue_id=U(m,"id","name")}function V(){var e=Number(_.find(P.attributes,{name:"file_id"}).value);if(!_.some(u,{id:e})&&0<e)return t.sound.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,u.push(n),P.values.file_id=U(u,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SOUND",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.file_id=U(u,"id","name")}function B(){var e=Number(_.find(P.attributes,{name:"variable_id"}).value);if(!_.some(p,{id:e})&&0<e)return t.variable.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,p.push(n),P.values.variable_id=U(p,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_VARIABLE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.variable_id=U(p,"id","name")}function Q(){var e=Number(_.find(P.attributes,{name:"odbc_id"}).value);if(!_.some(g,{id:e})&&0<e)return t.squareOdbc.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,g.push(n),P.values.odbc_id=U(g,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_ODBC",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.odbc_id=U(g,"id","name")}function W(){var e=Number(_.find(P.attributes,{name:"project_id"}).value);if(!_.some(v,{id:e})&&0<e)return t.squareProject.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,v.push(n),P.values.project_id=U(v,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PROJECT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.project_id=U(v,"id","name")}function j(){var e=Number(_.find(P.attributes,{name:"context"}).value);if(!_.some(h,{id:e})&&0<e)return t.voiceContext.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,h.push(n),P.values.context=U(h,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_CONTEXT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.context=U(h,"id","name")}function Y(){var e=Number(_.find(P.attributes,{name:"interval_id"}).value);if(!_.some(f,{id:e})&&0<e)return t.interval.get({id:e,fields:"id,name,IntervalId"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,f.push(n),P.values.interval_id=U(f,"id","name","IntervalId")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_INTERVAL",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.interval_id=U(f,"id","name","IntervalId")}function z(){var e=Number(_.find(P.attributes,{name:"account_id"}).value);if(!_.some(b,{id:e})&&0<e)return t.mailAccount.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,b.push(n),P.values.account_id=U(b,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_MAIL_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.account_id=U(b,"id","name")}function J(){var e=Number(_.find(P.attributes,{name:"sms_account_id"}).value);if(!_.some(O,{id:e})&&0<e)return t.smsAccount.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,O.push(n),P.values.sms_account_id=U(O,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_SMS_ACCOUNT",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.sms_account_id=U(O,"id","name")}function K(){var e=Number(_.find(P.attributes,{name:"template_id"}).value);if(!_.some(A,{id:e})&&0<e)return t.template.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,A.push(n),P.values.template_id=U(A,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_TEMPLATE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.template_id=U(A,"id","name")}function X(){var e=Number(_.find(P.attributes,{name:"pause_id"}).value);if(!_.some(C,{id:e})&&0<e)return t.pause.get({id:e,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,C.push(n),P.values.pause_id=U(C,"id","name")}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_PAUSE",msg:e.data?JSON.stringify(e.data.message):e.toString()})});P.values.pause_id=U(C,"id","name")}P.cellName=y.tagName,P.attributes=_.map(y.attributes,function(e){return{name:e.name,value:e.value,defaultValue:k[P.cellName]&&_.includes(k[P.cellName],e.name),required:L[P.cellName]&&_.includes(L[P.cellName],e.name),help:M[P.cellName]&&_.includes(M[P.cellName],e.name)}}),P.values={authMethod:[{value:"noauth",option:"NO AUTH"},{value:"hmac",option:"HMAC"}],answer:[{value:"yes",option:"Yes"},{value:"no",option:"No"}],ndagenerate_audio:[{value:1,option:"Yes"},{value:0,option:"No"}],ndaactivity_type:[{value:"message",option:"Message"},{value:"conversationUpdate",option:"Conversation Update"},{value:"contactRelationUpdate",option:"Contact Relation Update"},{value:"endOfConversation",option:"End of Conversation"}],hiddendigitspos:[{value:"first",option:"First"},{value:"last",option:"Last"}],recordingFormat:[{value:"wav",option:"Wav"},{value:"gsm",option:"Gsm"}],intkey:[{value:"#",option:"#"},{value:"*",option:"*"}],beep:[{value:"BEEP",option:"Yes"},{value:"NOBEEP",option:"No"}],model:e,ispeech_asr_language:i,ispeech_tts_language:o,languageCode:r,ssmlGender:[{value:"FEMALE",option:"Female"},{value:"MALE",option:"Male"}],google_tts_language:l,google_asr_language:s,google_cloud_tts_text_type:[{value:"text",option:"Text"},{value:"ssml",option:"SSML"}],aws_polly_region:I,aws_polly_voice:T,aws_text_type:[{value:"text",option:"Text"},{value:"ssml",option:"SSML"}],callback_priority:[{option:"Highest",value:4},{option:"High",value:3},{option:"Medium",value:2},{option:"Low",value:1},{option:"Lowest",value:0}],findBy:[{value:"internal",option:"Internal"},{value:"phone",option:"Phone"},{value:"mobile",option:"Mobile"}],dialogflow_language:w,dialogflowV2_language:R,aws_lex_region:x,method:[{value:"GET",option:"GET"},{value:"POST",option:"POST"},{value:"PUT",option:"PUT"},{value:"DELETE",option:"DELETE"}]},P.crudPermissions=D,P.onInit=function(){N.hasRole("admin")?(e={sip_id:U(d,"id","fullname","role"),trunk_name:U(c,"name","name"),trunk_id:U(c,"id","name"),queue_id:U(m,"id","name"),file_id:U(u,"id","name"),variable_id:U(p,"id","name"),odbc_id:U(g,"id","name"),project_id:U(v,"id","name"),context:U(h,"id","name"),interval_id:(t=f,a="id",i="name",s="IntervalId",o=_.filter(t,function(e){return null===e[s]}),r=[],_.forEach(o,function(n){r.push({value:n[a],option:n[i]});var e=_.filter(t,function(e){return e[s]===n.id});_.forEach(e,function(e){r.push({value:e[a],option:" - "+e[i]})})}),r),account_id:U(b,"id","name"),template_id:U(A,"id","name"),list_id:U(E,"id","name"),sms_account_id:U(O,"id","name"),pause_id:U(C,"id","name")},n=_.merge(P.values,e),P.values=n):function(){for(var e=["sip_id","trunk_name","trunk_id","queue_id","file_id","variable_id","odbc_id","project_id","context","interval_id","account_id","template_id","list_id","sms_account_id","pause_id"],n=0;n<P.attributes.length;n++)if(_.includes(e,P.attributes[n].name))switch(P.attributes[n].name){case"sip_id":F();break;case"trunk_name":G();break;case"trunk_id":q();break;case"queue_id":H();break;case"file_id":V();break;case"variable_id":B();break;case"odbc_id":Q();break;case"project_id":W();break;case"context":j();break;case"interval_id":Y();break;case"account_id":z();break;case"template_id":K();break;case"list_id":$();break;case"sms_account_id":J();break;case"pause_id":X()}}();var e,n,t,a,i,s,o,r},P.closeDialog=function(e){e&&S(P.attributes),n.hide()},P.getMap=U}e.$inject=["$mdDialog","api","toasty","ispeechAsrModel","ispeechAsrLanguage","googleAsrLanguage","ispeechTtsLanguage","googleCloudTtslanguageCode","googleTtsLanguage","users","trunks","queues","sounds","variables","databases","projects","contexts","intervals","mailAccounts","templates","lists","cell","saveCallback","awsPollyVoice","awsPollyRegion","smsAccounts","pauses","dialogFlowLanguage","dialogFlowV2Language","awsLexRegion","Auth","crudPermissions"],angular.module("app.callysquare").controller("MxGraphDialogController",e)}(),function(){"use strict";angular.module("app.callysquare").directive("stringToNumber",function(){return{require:"ngModel",link:function(e,n,t,a){a.$parsers.push(function(e){return""+e}),a.$formatters.push(function(e){return parseFloat(e)})}}})}(),function(){"use strict";angular.module("app.callysquare").factory("ispeechAsrModel",function(){return[{value:"0",option:"Default"},{value:"date",option:"Date"},{value:"usmoney",option:"US Money"},{value:"numbersto9",option:"Numbers to 9"},{value:"numbersto99",option:"Numbers to 99"},{value:"numbersto999",option:"Numbers to 999"},{value:"time",option:"Time"},{value:"phonenumber",option:"Phone number"},{value:"streets",option:"Streets"},{value:"citystate",option:"US City/States"}]}).factory("ispeechAsrLanguage",function(){return[{value:"en-US",option:"English (US)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GB",option:"English (UK)"},{value:"en-AU",option:"English (Australia)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-MX",option:"Spanish (Mexico)"},{value:"it-IT",option:"Italian (Italy) / Finnish (Finland)"},{value:"fr-FR",option:"German (Germany)"},{value:"fr-CA",option:"French (Canada)"},{value:"pl-PL",option:"Polish (Poland)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ca-ES",option:"Catalan (Catalan)"},{value:"zh-TW",option:"Chinese (Taiwan)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"ko-KR",option:"Korean (Korea)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"nb-NO",option:"Norwegian (Norway)"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"zh-CN",option:"Chinese (China)"},{value:"zh-HK",option:"Chinese (Hong Kong)"}]}).factory("ispeechTtsLanguage",function(){return[{value:"usenglishfemale",option:"US English Female"},{value:"usenglishmale",option:"US English Male"},{value:"ukenglishfemale",option:"UK English Female"},{value:"ukenglishmale",option:"UK English Male"},{value:"auenglishfemale",option:"Australian English"},{value:"usspanishfemale",option:"US Spanish Female"},{value:"usspanishmale",option:"US Spanish Male"},{value:"chchinesefemale",option:"Chinese Female"},{value:"chchinesemale",option:"Chinese Male"},{value:"hkchinesefemale",option:"Hong Kong Cantonese Female"},{value:"twchinesefemale",option:"Taiwan Chinese Female"},{value:"jpjapanesefemale",option:"Japanese Female"},{value:"jpjapanesemale",option:"Japanese Male"},{value:"krkoreanfemale",option:"Korean Female"},{value:"krkoreanmale",option:"Korean Male"},{value:"caenglishfemale",option:"Canadian English Female"},{value:"huhungarianfemale",option:"Hungarian Female"},{value:"brportuguesefemale",option:"Brazilian Portuguese Female"},{value:"eurportuguesefemale",option:"European Portuguese Female"},{value:"eurportuguesemale",option:"European Portuguese Male"},{value:"eurspanishfemale",option:"European Spanish Female"},{value:"eurspanishmale",option:"European Spanish Male"},{value:"eurcatalanfemale",option:"European Catalan Female"},{value:"eurczechfemale",option:"European Czech Female"},{value:"eurdanishfemale",option:"European Danish Female"},{value:"eurfinnishfemale",option:"European Finnish Female"},{value:"eurfrenchfemale",option:"European French Female"},{value:"eurfrenchmale",option:"European French Male"},{value:"eurnorwegianfemale",option:"European Norwegian Female"},{value:"eurdutchfemale",option:"European Dutch Female"},{value:"eurpolishfemale",option:"European Polish Female"},{value:"euritalianfemale",option:"European Italian Female"},{value:"euritalianmale",option:"European Italian Male"},{value:"eurturkishfemale",option:"European Turkish Female"},{value:"eurturkishmale",option:"European Turkish Male"},{value:"eurgermanfemale",option:"European German Female"},{value:"eurgermanmale",option:"European German Male"},{value:"rurussianfemale",option:"Russian Female"},{value:"rurussianmale",option:"Russian Male"},{value:"swswedishfemale",option:"Swedish Female"},{value:"cafrenchfemale",option:"Canadian French Female"},{value:"cafrenchmale",option:"Canadian French Male"}]}).factory("googleCloudTtslanguageCode",function(){return[{value:"af-ZA",option:"Afrikaans (South Africa)"},{value:"ar-XA",option:"Arabic"},{value:"bn-IN",option:"Bengali (India)"},{value:"bg-BG",option:"Bulgarian (Bulgaria)"},{value:"ca-ES",option:"Catalan (Spain)"},{value:"yue-HK",option:"Chinese (Hong Kong)"},{value:"cs-CZ",option:"Czech (Czech Republic)"},{value:"da-DK",option:"Danish (Denmark)"},{value:"nl-BE",option:"Dutch (Belgium)"},{value:"nl-NL",option:"Dutch (Netherlands)"},{value:"en-AU",option:"English (Australian)"},{value:"en-IN",option:"English (India)"},{value:"en-GB",option:"English (UK)"},{value:"en-US",option:"English (US)"},{value:"fi-FI",option:"Finnish (Finland)"},{value:"fil-PH",option:"Filipino (Philippines)"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"French (France)"},{value:"de-DE",option:"German (Germany)"},{value:"el-GR",option:"Greek (Greece)"},{value:"gu-IN",option:"Gujarati (India)"},{value:"hi-IN",option:"Hindi (India)"},{value:"hu-HU",option:"Hungarian (Hungary)"},{value:"is-IS",option:"Icelandic (Iceland)"},{value:"id-ID",option:"Indonesian (Indonesia)"},{value:"it-IT",option:"Italian (Italy)"},{value:"ja-JP",option:"Japanese (Japan)"},{value:"kn-IN",option:"Kannada (India)"},{value:"ko-KR",option:"Korean (South Korea)"},{value:"lv-LV",option:"Latvian (Latvia)"},{value:"ms-MY",option:"Malay (Malaysia)"},{value:"ml-IN",option:"Malayalam (India)"},{value:"cmn-CN",option:"Mandarin Chinese"},{value:"nb-NO",option:"Norwegian (Norway)"},{value:"pl-PL",option:"Polish (Poland)"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ro-RO",option:"Romanian (Romania)"},{value:"ru-RU",option:"Russian (Russia)"},{value:"sr-RS",option:"Serbian (Cyrillic)"},{value:"sk-SK",option:"Slovak (Slovakia)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"es-US",option:"Spanish (US)"},{value:"sv-SE",option:"Swedish (Sweden)"},{value:"ta-IN",option:"Tamil (India)"},{value:"te-IN",option:"Telugu (India)\t"},{value:"th-TH",option:"Thai (Thailand)"},{value:"tr-TR",option:"Turkish (Turkey)"},{value:"uk-UA",option:"Ukrainian (Ukraine)"},{value:"vi-VN",option:"Vietnamese (Vietnam)"}]}).factory("googleTtsLanguage",function(){return[{value:"af",option:"Afrikaans"},{value:"sq",option:"Albanian"},{value:"ar",option:"Arabic"},{value:"hy",option:"Armenian"},{value:"bn",option:"Bengali"},{value:"bs",option:"Bosnian"},{value:"bg",option:"Bulgarian"},{value:"ca",option:"Catalan"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"hr",option:"Croatian"},{value:"cs",option:"Czech"},{value:"da",option:"Danish"},{value:"nl",option:"Dutch"},{value:"en",option:"English"},{value:"eo",option:"Esperanto"},{value:"et",option:"Estonian"},{value:"tl",option:"Filipino"},{value:"fi",option:"Finnish"},{value:"fr",option:"French"},{value:"de",option:"German"},{value:"el",option:"Greek"},{value:"gu",option:"Gujarati"},{value:"iw",option:"Hebrew"},{value:"hi",option:"Hindi"},{value:"hu",option:"Hungarian"},{value:"is",option:"Icelandic"},{value:"id",option:"Indonesian"},{value:"it",option:"Italian"},{value:"jw",option:"Javanese"},{value:"ja",option:"Japanese"},{value:"kn",option:"Kannada"},{value:"ko",option:"Korean"},{value:"la",option:"Latin"},{value:"lv",option:"Latvian"},{value:"mk",option:"Macedonian"},{value:"ml",option:"Malayalam"},{value:"mr",option:"Marathi"},{value:"ne",option:"Nepali"},{value:"no",option:"Norwegian"},{value:"pl",option:"Polish"},{value:"pt",option:"Portuguese"},{value:"ro",option:"Romanian"},{value:"ru",option:"Russian"},{value:"sr",option:"Serbian"},{value:"si",option:"Sinhalese"},{value:"sk",option:"Slovak"},{value:"es",option:"Spanish"},{value:"su",option:"Sundanese"},{value:"sw",option:"Swahili"},{value:"sv",option:"Swedish"},{value:"ta",option:"Tamil"},{value:"te",option:"Telugu"},{value:"th",option:"Thai"},{value:"tr",option:"Turkish"},{value:"uk",option:"Ukrainian"},{value:"ur",option:"Urdu"},{value:"vi",option:"Vietnamese"},{value:"cy",option:"Welsh"}]}).factory("googleAsrLanguage",function(){return[{option:"Afrikaans (South Africa)",value:"af-ZA"},{option:"Albanian (Albania)",value:"sq-AL"},{option:"Amharic (Ethiopia)",value:"am-ET"},{option:"Arabic (Algeria)",value:"ar-DZ"},{option:"Arabic (Bahrain)",value:"ar-BH"},{option:"Arabic (Egypt)",value:"ar-EG"},{option:"Arabic (Iraq)",value:"ar-IQ"},{option:"Arabic (Israel)",value:"ar-IL"},{option:"Arabic (Jordan)",value:"ar-JO"},{option:"Arabic (Kuwait)",value:"ar-KW"},{option:"Arabic (Lebanon)",value:"ar-LB"},{option:"Arabic (Morocco)",value:"ar-MA"},{option:"Arabic (Oman)",value:"ar-OM"},{option:"Arabic (Qatar)",value:"ar-QA"},{option:"Arabic (Saudi Arabia)",value:"ar-SA"},{option:"Arabic (State of Palestine)",value:"ar-PS"},{option:"Arabic (Tunisia)",value:"ar-TN"},{option:"Arabic (United Arab Emirates)",value:"ar-AE"},{option:"Arabic (Yemen)",value:"ar-YE"},{option:"Armenian (Armenia)",value:"hy-AM"},{option:"Azerbaijani (Azerbaijan)",value:"az-AZ"},{option:"Basque (Spain)",value:"eu-ES"},{option:"Bengali (Bangladesh)",value:"bn-BD"},{option:"Bengali (India)",value:"bn-IN"},{option:"Bosnian (Bosnia and Herzegovina)",value:"bs-BA"},{option:"Bulgarian (Bulgaria)",value:"bg-BG"},{option:"Burmese (Myanmar)",value:"my-MM"},{option:"Catalan (Spain)",value:"ca-ES"},{option:"Chinese, Cantonese (Traditional Hong Kong)",value:"yue-Hant-HK"},{option:"Chinese, Mandarin (Simplified, China)",value:"cmn-Hans-CN"},{option:"Croatian (Croatia)",value:"hr-HR"},{option:"Czech (Czech Republic)",value:"cs-CZ"},{option:"Danish (Denmark)",value:"da-DK"},{option:"Dutch (Belgium)",value:"nl-BE"},{option:"Dutch (Netherlands)",value:"nl-NL"},{option:"English (Australia)",value:"en-AU"},{option:"English (Canada)",value:"en-CA"},{option:"English (Ghana)",value:"en-GH"},{option:"English (Hong Kong)",value:"en-HK"},{option:"English (India)",value:"en-IN"},{option:"English (Ireland)",value:"en-IE"},{option:"English (Kenya)",value:"en-KE"},{option:"English (New Zealand)",value:"en-NZ"},{option:"English (Nigeria)",value:"en-NG"},{option:"English (Pakistan)",value:"en-PK"},{option:"English (Philippines)",value:"en-PH"},{option:"English (Singapore)",value:"en-SG"},{option:"English (South Africa)",value:"en-ZA"},{option:"English (Tanzania)",value:"en-TZ"},{option:"English (United Kingdom)",value:"en-GB"},{option:"English (United States)",value:"en-US"},{option:"Estonian (Estonia)",value:"et-EE"},{option:"Filipino (Philippines)",value:"fil-PH"},{option:"Finnish (Finland)",value:"fi-FI"},{option:"French (Belgium)",value:"fr-BE"},{option:"French (Canada)",value:"fr-CA"},{option:"French (France)",value:"fr-FR"},{option:"French (Switzerland)",value:"fr-CH"},{option:"Galician (Spain)",value:"gl-ES"},{option:"Georgian (Georgia)",value:"ka-GE"},{option:"German (Austria)",value:"de-AT"},{option:"German (Germany)",value:"de-DE"},{option:"German (Switzerland)",value:"de-CH"},{option:"Greek (Greece)",value:"el-GR"},{option:"Gujarati (India)",value:"gu-IN"},{option:"Hebrew (Israel)",value:"iw-IL"},{option:"Hindi (India)",value:"hi-IN"},{option:"Hungarian (Hungary)",value:"hu-HU"},{option:"Icelandic (Iceland)",value:"is-IS"},{option:"Indonesian (Indonesia)",value:"id-ID"},{option:"Italian (Italy)",value:"it-IT"},{option:"Italian (Switzerland)",value:"it-CH"},{option:"Japanese (Japan)",value:"ja-JP"},{option:"Javanese (Indonesia)",value:"jv-ID"},{option:"Kannada (India)",value:"kn-IN"},{option:"Kazakh (Kazakhstan)",value:"kk-KZ"},{option:"Khmer (Cambodia)",value:"km-KH"},{option:"Korean (South Korea)",value:"ko-KR"},{option:"Lao (Laos)",value:"lo-LA"},{option:"Latvian (Latvia)",value:"lv-LV"},{option:"Lithuanian (Lithuania)",value:"lt-LT"},{option:"Macedonian (North Macedonia)",value:"mk-MK"},{option:"Malay (Malaysia)",value:"ms-MY"},{option:"Malayalam (India)",value:"ml-IN"},{option:"Marathi (India)",value:"mr-IN"},{option:"Mongolian (Mongolia)",value:"mn-MN"},{option:"Nepali (Nepal)",value:"ne-NP"},{option:"Norwegian Bokmål (Norway)",value:"no-NO"},{option:"Persian (Iran)",value:"fa-IR"},{option:"Polish (Poland)",value:"pl-PL"},{option:"Portuguese (Brazil)",value:"pt-BR"},{option:"Portuguese (Portugal)",value:"pt-PT"},{option:"Punjabi (Gurmukhi India)",value:"pa-Guru-IN"},{option:"Romanian (Romania)",value:"ro-RO"},{option:"Russian (Russia)",value:"ru-RU"},{option:"Serbian (Serbia)",value:"sr-RS"},{option:"Sinhala (Sri Lanka)",value:"si-LK"},{option:"Slovak (Slovakia)",value:"sk-SK"},{option:"Slovenian (Slovenia)",value:"sl-SI"},{option:"Spanish (Argentina)",value:"es-AR"},{option:"Spanish (Bolivia)",value:"es-BO"},{option:"Spanish (Chile)",value:"es-CL"},{option:"Spanish (Colombia)",value:"es-CO"},{option:"Spanish (Costa Rica)",value:"es-CR"},{option:"Spanish (Dominican Republic)",value:"es-DO"},{option:"Spanish (Ecuador)",value:"es-EC"},{option:"Spanish (El Salvador)",value:"es-SV"},{option:"Spanish (Guatemala)",value:"es-GT"},{option:"Spanish (Honduras)",value:"es-HN"},{option:"Spanish (Mexico)",value:"es-MX"},{option:"Spanish (Nicaragua)",value:"es-NI"},{option:"Spanish (Panama)",value:"es-PA"},{option:"Spanish (Paraguay)",value:"es-PY"},{option:"Spanish (Peru)",value:"es-PE"},{option:"Spanish (Puerto Rico)",value:"es-PR"},{option:"Spanish (Spain)",value:"es-ES"},{option:"Spanish (United States)",value:"es-US"},{option:"Spanish (Uruguay)",value:"es-UY"},{option:"Spanish (Venezuela)",value:"es-VE"},{option:"Sundanese (Indonesia)",value:"su-ID"},{option:"Swahili (Kenya)",value:"sw-KE"},{option:"Swahili (Tanzania)",value:"sw-TZ"},{option:"Swedish (Sweden)",value:"sv-SE"},{option:"Tamil (India)",value:"ta-IN"},{option:"Tamil (Malaysia)",value:"ta-MY"},{option:"Tamil (Singapore)",value:"ta-SG"},{option:"Tamil (Sri Lanka)",value:"ta-LK"},{option:"Telugu (India)",value:"te-IN"},{option:"Thai (Thailand)",value:"th-TH"},{option:"Turkish (Turkey)",value:"tr-TR"},{option:"Ukrainian (Ukraine)",value:"uk-UA"},{option:"Urdu (India)",value:"ur-IN"},{option:"Urdu (Pakistan)",value:"ur-PK"},{option:"Uzbek (Uzbekistan)",value:"uz-UZ"},{option:"Vietnamese (Vietnam)",value:"vi-VN"},{option:"Zulu (South Africa)",value:"zu-ZA"}]}).factory("awsPollyVoice",function(){return[{value:"Zeina",option:"Zeina (Arabic, Female)"},{value:"Zhiyu",option:"Zhiyu (Chinese, Mandarin, Female)"},{value:"Naja",option:"Naja (Danish, Female)"},{value:"Mads",option:"Mads (Danish, Male)"},{value:"Lotte",option:"Lotte (Dutch, Female)"},{value:"Ruben",option:"Ruben (Dutch, Male)"},{value:"Nicole",option:"Nicole (English, Australian, Female)"},{value:"Olivia",option:"Olivia (English, Austrialian, Female)"},{value:"Russell",option:"Russell (English, Austrialian, Male)"},{value:"Amy",option:"Amy (English, British, Female)"},{value:"Emma",option:"Emma (English, British, Female)"},{value:"Brian",option:"Brian (English, British, Male)"},{value:"Aditi",option:"Aditi (English, Indian, Female)"},{value:"Raveena",option:"Raveena (English, Indian, Female)"},{value:"Aria",option:"Aria (English, New Zealand, Female)"},{value:"Ayanda",option:"Ayanda (English, South African, Female)"},{value:"Joanna",option:"Joanna (English, US, Female)"},{value:"Ivy",option:"Ivy (English, US, Female)"},{value:"Joey",option:"Joey (English, US, Male)"},{value:"Justin",option:"Justin (English, US, Male)"},{value:"Kendra",option:"Kendra (English, US, Female)"},{value:"Kimberly",option:"Kimberly (English, US, Female)"},{value:"Salli",option:"Salli (English, US, Female)"},{value:"Kevin",option:"Kevin (English, US, Male)"},{value:"Matthew",option:"Matthew (English, US, Male)"},{value:"Geraint",option:"Geraint (English, Welsh, Male)"},{value:"Celine",option:"Celine (French, Female)"},{value:"Mathieu",option:"Mathieu (French, Male)"},{value:"Léa",option:"Léa (French, Male)"},{value:"Chantal",option:"Chantal (French, Canadian, Female)"},{value:"Gabrielle",option:"Gabrielle (French, Canadian, Female)"},{value:"Vicki",option:"Vicki (German , Female)"},{value:"Hans",option:"Hans (German, Male)"},{value:"Marlene",option:"Marlene (German, Female)"},{value:"Aditi",option:"Aditi (Hindi , Female)"},{value:"Karl",option:"Karl (Icelandic, Male)"},{value:"Dora",option:"Dora (Icelandic, Female)"},{value:"Carla",option:"Carla (Italian, Female)"},{value:"Giorgio",option:"Giorgio (Italian, Male)"},{value:"Bianca",option:"Bianca (Italian, Male)"},{value:"Mizuki",option:"Mizuki (Japanese, Female)"},{value:"Takumi",option:"Takumi (Japanese, Male)"},{value:"Seoyeon",option:"Seoyeon (Korean, Female)"},{value:"Liv",option:"Liv (Norwegian, Female)"},{value:"Ewa",option:"Ewa (Polish, Female)"},{value:"Jacek",option:"Jacek (Polish, Male)"},{value:"Jan",option:"Jan (Polish, Male)"},{value:"Maja",option:"Maja (Polish, Female)"},{value:"Camila",option:"Camila (Portuguese, Brazilian, Female)"},{value:"Ricardo",option:"Ricardo (Portuguese, Brazilian, Male)"},{value:"Vitoria",option:"Vitoria (Portuguese, Brazilian, Female)"},{value:"Cristiano",option:"Cristiano (Portuguese, Male)"},{value:"Ines",option:"Ines (Portuguese, Female)"},{value:"Carmen",option:"Carmen (Romanian, Female)"},{value:"Maxim",option:"Maxim (Russian, Male)"},{value:"Tatyana",option:"Tatyana (Russian, Female)"},{value:"Conchita",option:"Conchita (Spanish, European, Female)"},{value:"Lucia",option:"Lucia (Spanish, European, Female)"},{value:"Enrique",option:"Enrique (Spanish, European, Male)"},{value:"Mia",option:"Mia (Spanish, Mexican, Female)"},{value:"Miguel",option:"Miguel (Spanish, US, Male)"},{value:"Penelope",option:"Penelope (Spanish, US, Female)"},{value:"Lupe",option:"Lupe (Spanish, US, Female)"},{value:"Astrid",option:"Astrid (Swedish, Female)"},{value:"Filiz",option:"Filiz (Turkish, Female)"},{value:"Gwyneth",option:"Gwyneth (Welsh , Female)"}]}).factory("awsPollyRegion",function(){return[{value:"us-east-1",option:"US East (N. Virginia)"},{value:"us-east-2",option:"US East (Ohio)"},{value:"us-west-1",option:"US West (N. California)"},{value:"us-west-2",option:"US West (Oregon)"},{value:"ca-central-1",option:"Canada (Central)"},{value:"eu-west-1",option:"EU (Ireland)"},{value:"eu-central-1",option:"EU (Frankfurt)"},{value:"eu-west-2",option:"EU (London)"},{value:"eu-west-3",option:"EU (Paris)"},{value:"ap-southeast-1",option:"Asia Pacific (Singapore)"},{value:"ap-southeast-2",option:"Asia Pacific (Sydney)"},{value:"ap-northeast-2",option:"Asia Pacific (Seoul)"},{value:"ap-northeast-1",option:"Asia Pacific (Tokyo)"},{value:"ap-south-1",option:"Asia Pacific (Mumbai)"},{value:"sa-east-1",option:"South America (São Paulo)"}]}).factory("awsLexRegion",function(){return[{value:"us-east-1",option:"US East (N. Virginia)"},{value:"us-west-2",option:"US West (Oregon)"},{value:"eu-west-1",option:"EU (Ireland)"},{value:"ap-southeast-2",option:"Asia Pacific (Sydney)"}]}).factory("dialogFlowLanguage",function(){return[{value:"da",option:"Danish"},{value:"en",option:"English"},{value:"de",option:"German"},{value:"it",option:"Italian"},{value:"es",option:"Spanish"},{value:"fr",option:"French"},{value:"id",option:"Indonesian"},{value:"ja",option:"Japanese"},{value:"ko",option:"Korean (South Korea)"},{value:"nl",option:"Dutch"},{value:"no",option:"Norwegian"},{value:"pt",option:"Portuguese (European)"},{value:"pt-br",option:"Portuguese (Nrazilian)"},{value:"ru",option:"Russian"},{value:"sv",option:"Swedish"},{value:"th",option:"Thai"},{value:"uk",option:"Ukrainian"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-HK",option:"Chinese (Hong Kong)"},{value:"zh-TW",option:"Chinese (Traditional)"}]}).factory("dialogFlowV2Language",function(){return[{value:"zh-HK",option:"Chinese (Cantonese)"},{value:"zh-CN",option:"Chinese (Simplified)"},{value:"zh-TW",option:"Chinese (Traditional)"},{value:"da",option:"Danish"},{value:"nl",option:"Dutch"},{value:"en",option:"English"},{value:"en-AU",option:"English (Australia)"},{value:"en-CA",option:"English (Canada)"},{value:"en-GB",option:"English (Great Britain)"},{value:"en-IN",option:"English (India)"},{value:"en-US",option:"English (US)"},{value:"fr",option:"French"},{value:"fr-CA",option:"French (Canada)"},{value:"fr-FR",option:"France (France)"},{value:"de",option:"German"},{value:"hi",option:"Hindi"},{value:"id",option:"Indonesian"},{value:"it",option:"Italian"},{value:"ja",option:"Japanese"},{value:"ko",option:"Korean"},{value:"no",option:"Norwegian"},{value:"pl",option:"Polish"},{value:"pt-BR",option:"Portuguese (Brazil)"},{value:"pt-PT",option:"Portuguese (Portugal)"},{value:"ru",option:"Russian"},{value:"es",option:"Spanish"},{value:"es-419",option:"Spanish (Latin America)"},{value:"es-ES",option:"Spanish (Spain)"},{value:"sw",option:"Swedish"},{value:"th",option:"Thai"},{value:"tr",option:"Turkish"},{value:"uk",option:"Ukrainian"}]})}(),function(){"use strict";function e(n,e,t,a){var i=this;i.project={preproduction:t},i.closeDialog=function(e){e?(a(i.project.preproduction),n.hide(i.project.preproduction)):n.hide()}}e.$inject=["$mdDialog","toasty","currentXML","saveCallback"],angular.module("app.callysquare").controller("MxGraphEditXMLController",e)}(),function(){"use strict";function e(n,t){var a=this;function i(e){e?(t(e),n.hide(e)):n.hide()}a.errors=[],a.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:5242880,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},a.ngFlow={flow:{}},a.dropping=!1,a.closeDialog=i,a.fileAdded=function(e){a.errors=[];_.includes(["xml"],e.getExtension())||a.errors.push({message:"The extension "+e.getExtension()+" is not supported!"});5242880<e.size&&a.errors.push({message:"The file is too big. The max allowed size is 5MB"});if(!a.errors.length){var n=new FileReader;n.onload=function(e){i(e.target.result)},n.readAsText(e.file)}}}e.$inject=["$mdDialog","saveCallback"],angular.module("app.callysquare").controller("MxGraphImportXMLController",e)}(),function(){"use strict";function e(n,t,e,a){var i=this;i.project=_.clone(e),i.closeDialog=function(){n.hide()},i.save=function(){i.errors=[],a.squareProject.update({id:i.project.id},{notes:i.project.notes,description:i.project.description}).$promise.then(function(e){t.success({title:"Project updated!",msg:i.project.name?i.project.name+" has been updated!":""}),n.hide(e)}).catch(function(e){console.error(e),i.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.update"}]})}}e.$inject=["$mdDialog","toasty","project","api"],angular.module("app.callysquare").controller("MxGraphUpdateInfoController",e)}(),function(){"use strict";function e(n,e,t,a,i){var s=this;s.projects=t,s.id="",s.newWindow=!0,s.closeDialog=function(e){s.errors=[],e?(n.hide(),s.newWindow?a.open("/callysquare/projects/"+s.id,"_blank"):i.go("app.callysquare.projects.edit",{id:s.id})):n.hide()}}e.$inject=["$mdDialog","toasty","projects","$window","$state"],angular.module("app.callysquare").controller("MxGraphOpenProjectController",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o){var r=this;r.project=angular.copy(e),r.project.name+="_new",r.project.preproduction=a,r.newWindow=!0,r.closeDialog=function(){n.hide()},r.save=function(){delete r.project.id,i.squareProject.save(r.project).$promise.then(function(e){t.success({title:"Project properly created",msg:r.project.name?r.project.name+" has been created!":""}),n.hide(e),r.newWindow?s.open("/callysquare/projects/"+e.id,"_blank"):o.go("app.callysquare.projects.edit",{id:e.id})}).catch(function(e){console.error(e),r.errors=e.data.errors||[{message:e.toString(),type:"api.squareProject.save"}]})}}e.$inject=["$mdDialog","toasty","project","currentXML","api","$window","$state"],angular.module("app.callysquare").controller("MxGraphSaveProjectAsController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,r,n,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S,T){var I=this;I.currentUser=T.getCurrentUser(),I.project=n||{},I.userProfileSection=S&&1==S.count?S.rows[0]:null,I.crudPermissions=T.parseCrudPermissions(I.userProfileSection?I.userProfileSection.crudPermissions:null),I.onInit=function(){new EditorUi(I,new Editor,document.getElementById("geEditor")).openString(I.project.preproduction,I.project.name,I.project)},I.saveOrPublishProject=function(e,n){var t={preproduction:e};n&&(t.production=e);r.squareProject.update({id:I.project.id},t).$promise.then(function(e){o.success({title:"Project "+(n?"published":"saved")+"!",msg:I.project.name?I.project.name+" has been "+(n?"published":"saved")+"!":""}),I.project.preproduction=e.preproduction}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsquareProject",msg:e.data?JSON.stringify(e.data):e.toString()})})},I.openDialog=function(e,n){a.show({controller:"MxGraphDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{users:l.rows||[],trunks:d.rows||[],queues:c.rows||[],sounds:m.rows||[],variables:u.rows||[],databases:p.rows||[],contexts:g.rows||[],projects:v.rows||[],intervals:h.rows||[],mailAccounts:f.rows||[],smsAccounts:E.rows||[],pauses:y.rows||[],templates:b.rows||[],lists:A.rows||[],cell:e,saveCallback:n,crudPermissions:I.crudPermissions}})},I.newProject=function(e){a.show({controller:"CreateOrEditSquareProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:e,projects:v.rows,openFromEditor:!0,license:null,setting:null,crudPermissions:I.crudPermissions}})},I.openProject=function(){a.show({controller:"MxGraphOpenProjectController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/open/open.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{projects:v.rows||[]}})},I.saveProjectAs=function(e){a.show({controller:"MxGraphSaveProjectAsController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{project:I.project,currentXML:e}}).then(function(e){e&&v.rows.push(e)})},I.newVariable=function(n){return i(function(a,n){return r.userProfileSection.get({userProfileId:I.currentUser.userProfileId,sectionId:1012}).$promise.then(function(e){var n=e.rows?e.rows[0]:null,t=T.parseCrudPermissions(n?n.crudPermissions:null);a(t)}).catch(function(e){n(e)})}).then(function(e){e.canEdit?a.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{variable:n,variables:u.rows,license:null,setting:null,crudPermissions:e}}):o.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_CREATION_MESSAGE")})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"API:NEW_VARIABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})},I.updateInfo=function(e){a.show({controller:"MxGraphUpdateInfoController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/info/info.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:I.project}}).then(function(e){e&&_.merge(I.project,e)})},I.editXML=function(e,n){a.show({controller:"MxGraphEditXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/edit/edit.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{currentXML:e,saveCallback:n}}).then(function(e){e&&(I.project.preproduction=e)})},I.importXML=function(e){a.show({controller:"MxGraphImportXMLController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/edit/import/import.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{saveCallback:e}}).then(function(e){e&&(I.project.preproduction=e)})},I.gotoProjects=function(){e.go("app.callysquare.projects",{},{reload:"app.callysquare.projects"})}}e.$inject=["$state","$document","$mdDialog","$q","$translate","toasty","api","project","users","trunks","queues","sounds","variables","databases","contexts","projects","intervals","mailAccounts","templates","lists","smsAccounts","pauses","userProfileSection","Auth"],angular.module("app.callysquare").controller("ProjectController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=u.getCurrentUser(),p.projects=a||{count:0,rows:[]},p.userProfile=i,p.userProfileSection=s&&1==s.count?s.rows[0]:null,p.crudPermissions=u.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.listOrder="",p.listOrderAsc=null,p.selectedProjects=[],p.query={fields:"id,name,description,notes",sort:"-updatedAt",limit:10,page:1},p.editstate=function(e,n){t.go("app.callysquare.projects.edit",{id:e.id,crudPermissions:p.crudPermissions})},p.deleteconfirm=function(e,n){var t=l.confirm().title("Are you sure want to delete the project?").htmlContent("<b>"+e.name+"</b> will be deleted.").ariaLabel("delete project").targetEvent(n).ok("OK").cancel("CANCEL");l.show(t).then(function(){f(e)},function(){console.log("CANCEL")})},p.success=h,p.getProjects=function(){p.query.offset=(p.query.page-1)*p.query.limit,u.hasRole("admin")?p.promise=o.squareProject.get(p.query,h).$promise:(p.query.id=p.userProfile.id,p.query.section="SquareProjects",p.promise=o.userProfile.getResources(p.query,h).$promise)},p.createOrEditProject=function(e,n){l.show({controller:"CreateOrEditSquareProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/projects/create/dialog.html",parent:angular.element(d.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:n,projects:p.projects.rows,openFromEditor:null,setting:null,crudPermissions:p.crudPermissions}})},p.deleteProject=f,p.exportSelectedProjects=function(){var e=angular.copy(p.selectedProjects);return p.selectedProjects=[],e},p.deleteSelectedProjects=function(e){var n=l.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+p.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");l.show(n).then(function(){p.selectedProjects.forEach(function(e){f(e)}),p.selectedProjects=[]})},p.deselectProjects=function(){p.selectedProjects=[]},p.selectAllProjects=function(){p.selectedProjects=p.projects.rows};var g=!0,v=1;function h(e){p.projects=e||{count:0,rows:[]}}function f(e){o.squareProject.delete({id:e.id}).$promise.then(function(){_.remove(p.projects.rows,{id:e.id}),p.projects.count-=1,p.projects.rows.length||p.getProjects(),m.success({title:"Project deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.project.delete"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.project.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){g?c(function(){g=!1}):(n||(v=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=v),p.getProjects())})}e.$inject=["$scope","$state","$mdSidenav","projects","userProfile","userProfileSection","api","msUtils","$mdDialog","$document","$timeout","toasty","Auth"],angular.module("app.callysquare").controller("ProjectsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CALLYSQUARE.EDIT_SQUARERECORDING",g.squareRecording=angular.copy(l),g.squareRecordings=r,g.newSquareRecording=!1,g.squareRecording||(g.squareRecording={},g.title="CALLYSQUARE.NEW_SQUARERECORDING",g.newSquareRecording=!0),g.addNewSquareRecording=function(){g.errors=[],d.squareRecording.save(g.squareRecording).$promise.then(function(e){g.squareRecordings.unshift(e.toJSON()),o.success({title:"SquareRecording properly created",msg:g.squareRecording.name?g.squareRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSquareRecording=function(){g.errors=[],d.squareRecording.update({id:g.squareRecording.id},g.squareRecording).$promise.then(function(e){var n=_.find(g.squareRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SquareRecording properly saved!",msg:g.squareRecording.name?g.squareRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSquareRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The squareRecording will be deleted.").ariaLabel("Delete SquareRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.squareRecording.delete({id:g.squareRecording.id}).$promise.then(function(){_.remove(g.squareRecordings,{id:g.squareRecording.id}),o.success({title:"SquareRecording properly deleted!",msg:(g.squareRecording.name||"squareRecording")+" has been deleted!"}),v(g.squareRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.squareRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","squareRecordings","squareRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.callysquare").controller("CreateOrEditSquareRecordingDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.squareRecordings=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="squareRecordings",f.listOrder="",f.listOrderAsc=null,f.selectedSquareRecordings=[],f.query={fields:"createdAt,updatedAt,id,filename,projectName,uniqueid,callerid,extension,audio,savePath,format",sort:"-createdAt",limit:10,page:1},f.downloadfile2=function(s,e){return m.squareRecording.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid+s.format;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.squareRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("squareRecording")+"?").htmlContent("<b>"+(e.name||"squareRecording")+"</b> will be deleted.").ariaLabel("delete squareRecording").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSquareRecordings=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.squareRecording.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SquareRecordings",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSquareRecording=function(e,n){i.show({controller:"CreateOrEditSquareRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/callysquare/views/squareRecordings/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{squareRecording:n,squareRecordings:f.squareRecordings.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSquareRecording=y,f.exportSelectedSquareRecordings=function(){var e=angular.copy(f.selectedSquareRecordings);return f.selectedSquareRecordings=[],e},f.deleteSelectedSquareRecordings=function(e){var n=i.confirm().title("Are you sure want to delete the selected squareRecordings?").htmlContent("<b>"+f.selectedSquareRecordings.length+" selected</b> will be deleted.").ariaLabel("delete SquareRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSquareRecordings.forEach(function(e){y(e)}),f.selectedSquareRecordings=[]})},f.deselectSquareRecordings=function(){f.selectedSquareRecordings=[]},f.selectAllSquareRecordings=function(){f.selectedSquareRecordings=f.squareRecordings.rows};var b=!0,A=1;function E(e){f.squareRecordings=e||{count:0,rows:[]}}function y(e){m.squareRecording.delete({id:e.id}).$promise.then(function(){_.remove(f.squareRecordings.rows,{id:e.id}),f.squareRecordings.count-=1,f.squareRecordings.rows.length||f.getSquareRecordings(),p.success({title:_.startCase("SquareRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsquareRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsquareRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSquareRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","squareRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.callysquare").controller("SquareRecordingsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chatQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chatQueues",f.listOrder="",f.listOrderAsc=null,f.selectedChatQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"chat",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.chat.chatQueues.edit",{id:e.id,chatQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:f.chatQueues?f.chatQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:f.chatQueues?f.chatQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chatQueue")+"?").htmlContent("<b>"+(e.name||"chatQueue")+"</b> will be deleted.").ariaLabel("delete chatQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.chat.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.chat.realtime.queues",{})}},f.success=E,f.getChatQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.chatQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChatQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditChatQueue=function(e,n){i.show({controller:"CreateOrEditChatQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatQueue:n,chatQueues:f.chatQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteChatQueue=y,f.exportSelectedChatQueues=function(){var e=angular.copy(f.selectedChatQueues);return f.selectedChatQueues=[],e},f.deleteSelectedChatQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected chatQueues?").htmlContent("<b>"+f.selectedChatQueues.length+" selected</b> will be deleted.").ariaLabel("delete ChatQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChatQueues.forEach(function(e){y(e)}),f.selectedChatQueues=[]})},f.deselectChatQueues=function(){f.selectedChatQueues=[]},f.selectAllChatQueues=function(){f.selectedChatQueues=f.chatQueues.rows};var b=!0,A=1;function E(e){f.chatQueues=e||{count:0,rows:[]}}function y(e){m.chatQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.chatQueues.rows,{id:e.id}),f.chatQueues.count-=1,f.chatQueues.rows.length||f.getChatQueues(),p.success({title:_.startCase("ChatQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEchatQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChatQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.chat").controller("ChatQueuesController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="CHAT.EDIT_CHATQUEUE",r.chatQueue=angular.copy(n),r.chatQueues=e,r.newChatQueue=!1,r.chatQueue||(r.chatQueue={strategy:"beepall",timeout:10},r.title="CHAT.NEW_CHATQUEUE",r.newChatQueue=!0),r.addNewChatQueue=function(){r.errors=[],i.chatQueue.save(r.chatQueue).$promise.then(function(e){r.chatQueues.unshift(e.toJSON()),a.success({title:"ChatQueue properly created",msg:r.chatQueue.name?r.chatQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveChatQueue=function(){r.errors=[],i.chatQueue.update({id:r.chatQueue.id},r.chatQueue).$promise.then(function(e){var n=_.find(r.chatQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"ChatQueue properly saved!",msg:r.chatQueue.name?r.chatQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteChatQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The chatQueue will be deleted.").ariaLabel("Delete ChatQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.chatQueue.delete({id:r.chatQueue.id}).$promise.then(function(){_.remove(r.chatQueues,{id:r.chatQueue.id}),a.success({title:"ChatQueue properly deleted!",msg:(r.chatQueue.name||"chatQueue")+" has been deleted!"}),l(r.chatQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.chatQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","chatQueues","chatQueue","api","Auth","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatQueue.getAgents({id:c.chatQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserChatQueue?"penalty "+e.UserChatQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.chatQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.removeAgents({id:c.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.addAgents({id:c.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","chatQueue","chatQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatQueue.getTeams({id:l.chatQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.chatQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("CHAT.ALL_TEAMS"),labelSelected:t.instant("CHAT.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.removeTeams({id:l.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatQueue.addTeams({id:l.chatQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","chatQueue","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.chatQueue=c||e.params.chatQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"ChatQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"ChatQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatQueue:e,chatQueues:u.chatQueues?u.chatQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoChatQueues=function(){e.go("app.chat.chatQueues",{},{reload:"app.chat.chatQueues"})},u.saveChatQueue=function(){r.chatQueue.update({id:u.chatQueue.id},u.chatQueue).$promise.then(function(){l.success({title:"ChatQueue updated!",msg:u.chatQueue.name?u.chatQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","chatQueue","userProfileSection"],angular.module("app.chat").controller("ChatQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chatWebsites=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chatWebsites",f.listOrder="",f.listOrderAsc=null,f.selectedChatWebsites=[],f.query={fields:"createdAt,updatedAt,id,token,agentIdentifier,customerAlias,messageFontSize,name,key,address,remote,ListId,fidelity,timeout,agentAlias,closingQuestion,formSubmitSuccessMessage,formSubmitFailureMessage,color,color_focus,color_button,textColor,textButtonColor,backgroundColor,fontSize,header_shape,showAgentAvatar,showCustomerAvatar,alignment,verticalAlignment,labelText,messagesAlignment,defaultTitle,animation,defaultWhiteLabel,whiteLabel,defaultLogo,conditionAgreement,autoclose,enableUnmanagedNote,unmanagedMessage,skipUnmanaged,sendUnmanaged,enableCustomerWriting,waitingTitle,waitingMessage,closingMessage,noteTitle,placeholderMessage,skipMessageButton,enableRating,ratingType,ratingStarsNumber,enableFeedback,feedbackTitle,forwardTranscript,forwardTranscriptMessage,closingMessageButton,download_transcript,enableCustomerAttachment,enableSendButton,enableCustomerCheckmarks,systemAlias,enquiry_enable,enquiry_forwarding,enquiry_forwarding_address,name_title,username_placeholder,email_title,email_placeholder,header_online,hideWhenOffline,header_offline,start_chat_button,offline_chat_button,offlineMessageSubject,offlineMessageBody,offline_message,message_title,enquiry_message_placeholder,enquiry_button,rating_message,rating_send,rating_skip,onlineForm,offlineForm,mapKey,mapKeyOffline,forwardOffline,MailAccountId,openNewInteraction,forwardOfflineAddress,subjectOffline,IntervalId,timezone,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout,vidaooEscalation,vidaooApiKey,vidaooTopic,vidaooNote,vidaooMetadata",sort:"-updatedAt",limit:10,page:1},f.arrayagentIdentifier=_.keyBy([{option:"WebsiteAlias",value:"'website_alias'"},{option:"AgentAlias",value:"'agent_alias'"},{option:"AgentFullname",value:"'agent_fullname'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayheader_shape=_.keyBy([{option:"Rounded",value:"'rounded'"},{option:"Squared",value:"'squared'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayalignment=_.keyBy([{option:"bottom_right",value:"'bottom_right'"},{option:"right",value:"'right'"},{option:"left",value:"'left'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymessagesAlignment=_.keyBy([{option:"alternate",value:"'alternate'"},{option:"centered",value:"'centered'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayratingType=_.keyBy([{option:"Star",value:"'star'"},{option:"Thumb",value:"'thumb'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,chatWebsite:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,tab:10})},f.offlinemessagesgoto=function(e,n){t.go("app.chat.chatWebsites.edit",{id:e.id,tab:11})},f.agentadddialog=function(e,n){i.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:f.chatWebsites?f.chatWebsites.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chatWebsite")+"?").htmlContent("<b>"+(e.name||"chatWebsite")+"</b> will be deleted.").ariaLabel("delete chatWebsite").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getChatWebsites=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.chatWebsite.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChatWebsites",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditChatWebsite=function(e,n){i.show({controller:"CreateOrEditChatWebsiteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:n,chatWebsites:f.chatWebsites.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteChatWebsite=y,f.exportSelectedChatWebsites=function(){var e=angular.copy(f.selectedChatWebsites);return f.selectedChatWebsites=[],e},f.deleteSelectedChatWebsites=function(e){var n=i.confirm().title("Are you sure want to delete the selected chatWebsites?").htmlContent("<b>"+f.selectedChatWebsites.length+" selected</b> will be deleted.").ariaLabel("delete ChatWebsites").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChatWebsites.forEach(function(e){y(e)}),f.selectedChatWebsites=[]})},f.deselectChatWebsites=function(){f.selectedChatWebsites=[]},f.selectAllChatWebsites=function(){f.selectedChatWebsites=f.chatWebsites.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.chatWebsite&&(t=_.find(f.lists,{id:Number(f.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.chatWebsite&&(a=_.find(f.lists,{id:Number(f.chatWebsite.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.chatWebsite&&(t=_.find(f.interval,{id:Number(f.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.chatWebsite&&(a=_.find(f.interval,{id:Number(f.chatWebsite.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.chatWebsites=e||{count:0,rows:[]}}function y(e){m.chatWebsite.delete({id:e.id}).$promise.then(function(){_.remove(f.chatWebsites.rows,{id:e.id}),f.chatWebsites.count-=1,f.chatWebsites.rows.length||f.getChatWebsites(),p.success({title:_.startCase("ChatWebsite")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChatWebsites())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chatWebsites","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.chat").controller("ChatWebsitesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATWEBSITE",g.chatWebsite=angular.copy(l),g.chatWebsites=r,g.newChatWebsite=!1,g.chatWebsite||(g.chatWebsite={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),header_shape:"rounded",alignment:"bottom_right",verticalAlignment:30,labelText:"CHAT",messagesAlignment:"alternate",IntervalId:"null",timezone:"null",waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300,vidaooTopic:"Generated by XCALLY Motion",vidaooNote:"Meeting generated for interaction #{{interaction.id}} by {{agent.name}}"},g.title="CHAT.NEW_CHATWEBSITE",g.newChatWebsite=!0),n.params.id&&(g.chatWebsite.ChatWebsiteId=n.params.id),g.addNewChatWebsite=function(){g.errors=[],d.chatWebsite.save(g.chatWebsite).$promise.then(function(e){g.chatWebsites.unshift(e.toJSON()),o.success({title:"ChatWebsite properly created",msg:g.chatWebsite.name?g.chatWebsite.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatWebsite=function(){g.errors=[],d.chatWebsite.update({id:g.chatWebsite.id},g.chatWebsite).$promise.then(function(e){var n=_.find(g.chatWebsites,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatWebsite properly saved!",msg:g.chatWebsite.name?g.chatWebsite.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatWebsite=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatWebsite will be deleted.").ariaLabel("Delete ChatWebsite").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatWebsite.delete({id:g.chatWebsite.id}).$promise.then(function(){_.remove(g.chatWebsites,{id:g.chatWebsite.id}),o.success({title:"ChatWebsite properly deleted!",msg:(g.chatWebsite.name||"chatWebsite")+" has been deleted!"}),v(g.chatWebsite)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatWebsite.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.chatWebsite&&(t=_.find(g.lists,{id:Number(g.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.chatWebsite&&(a=_.find(g.lists,{id:Number(g.chatWebsite.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.chatWebsite&&(t=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.chatWebsite&&(a=_.find(g.interval,{id:Number(g.chatWebsite.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatWebsites","chatWebsite","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatWebsiteDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.chatWebsiteApps.rows.length){var t=r.chatWebsiteApps.rows[n]?r.chatWebsiteApps.rows[n]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsiteApp:t,chatWebsite:r.chatWebsite,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.chatWebsiteApps.rows[n]=e:r.chatWebsiteApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.chatWebsiteApps.rows.length;t++,0){var a=r.chatWebsiteApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.chatWebsite.context,a.exten=r.chatWebsite.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.chatWebsite.addApplications({id:r.chatWebsite.id},_.sortBy(n,"priority")).$promise.then(function(e){r.chatWebsiteApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.chatWebsiteApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.chatWebsite={},r.chatWebsiteApps={count:0,rows:[]},r.selectedChatWebsiteApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"ChatQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"chatQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:501}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",role:"agent",sort:"name",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"tvox",appType:"tvox",type:"tvox",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"serviceid",name:"serviceid",type:"text",param:0},{title:"channelid",name:"channelid",type:"text",param:1},{title:"tvoxurl",name:"tvoxurl",type:"text",param:2},{title:"tvoxloginurl",name:"tvoxloginurl",type:"text",param:3},{title:"tvoxsessionurl",name:"tvoxsessionurl",type:"text",param:4},{title:"tvoxusername",name:"tvoxusername",type:"text",param:5},{title:"tvoxpasswd",name:"tvoxpasswd",type:"password",param:6},{title:"motionurlonring",name:"motionurlonring",type:"text",param:7},{title:"motionurlonanswer",name:"motionurlonanswer",type:"text",param:8},{title:"motiontitle",name:"motiontitle",type:"text",param:9},{title:"motionurl",name:"motionurl",type:"text",param:10}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.chatWebsite=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getChatWebsiteApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.chatWebsiteApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getChatWebsiteApps=function(){r.promise=o.chatWebsite.getApplications(r.query,t).$promise},r.editChatWebsiteApp=n,r.editInterval=function(e,n){if(r.chatWebsiteApps.rows.length){var t=r.chatWebsiteApps.rows[n]?r.chatWebsiteApps.rows[n]:r.chatWebsiteApps.rows[0];i.show({controller:"EditChatWebsiteAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteChatWebsiteApp=function(e){_.remove(r.chatWebsiteApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedChatWebsiteApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedChatWebsiteApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedChatWebsiteApps.forEach(function(e){_.remove(r.chatWebsiteApps.rows,{id:e.id})}),r.selectedChatWebsiteApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.chat").controller("ChatWebsiteActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.chatWebsite.getAgents({id:c.chatWebsite.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserChatWebsite?"penalty "+e.UserChatWebsite.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.chatWebsite=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.chatWebsite.removeAgents({id:c.chatWebsite.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.chatWebsite.addAgents({id:c.chatWebsite.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CHAT.ALL_AGENTS"),labelSelected:r.instant("CHAT.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","chatWebsite","chatWebsites","realtime","$translate","Auth","crudPermissions"],angular.module("app.chat").controller("ChatWebsiteagentaddController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsiteagentAvatarController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditChatWebsiteAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("chat")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.chatQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.chatQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:501}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteApptagDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="CHAT.EDIT_"+(a.appType||a.app).toUpperCase(),l.tvox=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tvox.appdata)switch(l.tvox.appType?l.tvox.appType.toLowerCase():l.tvox.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tvox.appdata.split(",");l.tvox.key=d[0],l.tvox.language=d[1],l.tvox.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tvox.appdata.split(",");l.tvox.projectId=d[0],l.tvox.clientEmail=d[1],l.tvox.privateKey=d[2],l.tvox.language=d[3],l.tvox.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tvox.appdata.split(",");l.tvox.accesskeyid=d[0],l.tvox.secretaccesskey=d[1],l.tvox.lexregion=d[2],l.tvox.botname=d[3],l.tvox.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tvox.appdata.split(",");l.tvox.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tvox.text=d.slice(1,d.length).join(",");break;case"message":l.tvox.text=l.tvox.appdata;break;case"set":l.tvox.name=l.tvox.appdata.split("=")[0],l.tvox.value=l.tvox.appdata.split("=")[1];break;case"agi":l.tvox.project=l.tvox.appdata;break;default:var c=l.tvox.appdata.split(",");l.tvox.serviceid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.tvox.channelid=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.tvox.tvoxurl=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.tvox.tvoxloginurl=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.tvox.tvoxsessionurl=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10),l.tvox.tvoxusername=_.isEmpty(c[5])?c[5]:isNaN(c[5])?c[5]:parseInt(c[5],10),l.tvox.tvoxpasswd=_.isEmpty(c[6])?c[6]:isNaN(c[6])?c[6]:parseInt(c[6],10),l.tvox.motionurlonring=_.isEmpty(c[7])?c[7]:isNaN(c[7])?c[7]:parseInt(c[7],10),l.tvox.motionurlonanswer=_.isEmpty(c[8])?c[8]:isNaN(c[8])?c[8]:parseInt(c[8],10),l.tvox.motiontitle=_.isEmpty(c[9])?c[9]:isNaN(c[9])?c[9]:parseInt(c[9],10),l.tvox.motionurl=_.isEmpty(c[10])?c[10]:isNaN(c[10])?c[10]:parseInt(c[10],10)}function m(e){n.hide(e)}l.tvox.type&&"outbound"===l.tvox.type.toLowerCase()&&"outbounddial"===l.tvox.appType.toLowerCase()&&(l.tvox.prefix=l.tvox.phone?l.tvox.phone.split("$")[0]:void 0,l.tvox.callerId=l.tvox.callerID?"CALLERID(all)="+l.tvox.callerID:void 0),l.saveChatWebsiteApp=function(){l.errors=[];var e=[];l.tvox.type&&"outbound"===l.tvox.type.toLowerCase()&&"outboundDial"===l.tvox.appType&&(l.tvox.phone=i.cutdigits?(l.tvox.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tvox.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tvox.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tvox.options+="U(xcally-mixmonitor-context)"):l.tvox.options=l.tvox.options.replace("U(xcally-mixmonitor-context)",""));if(l.tvox.appType&&"custom"===l.tvox.appType);else switch((l.tvox.app||l.tvox.appType).toLowerCase()){case"set":l.tvox.appdata=l.tvox.name+"="+l.tvox.value;break;case"custom":break;default:e[0]=l.tvox.serviceid,e[1]=l.tvox.channelid,e[2]=l.tvox.tvoxurl,e[3]=l.tvox.tvoxloginurl,e[4]=l.tvox.tvoxsessionurl,e[5]=l.tvox.tvoxusername,e[6]=l.tvox.tvoxpasswd,e[7]=l.tvox.motionurlonring,e[8]=l.tvox.motionurlonanswer,e[9]=l.tvox.motiontitle,e[10]=l.tvox.motionurl,l.tvox.appdata=e.join(",")}m(l.tvox)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","chatWebsiteApp","chatWebsite","api","Auth","crudPermissions"],angular.module("app.chat").controller("EditChatWebsiteApptvoxDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteChatCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteChatCannedAnswers.rows,{id:e.id}),m.chatWebsiteChatCannedAnswers.count-=1,m.chatWebsiteChatCannedAnswers.rows.length||p(),l.success({title:"ChatCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteChatCannedAnswers={count:0,rows:[]},m.selectedChatWebsiteChatCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the chatCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("chatCannedAnswer #")+e.id||"chatCannedAnswer")+"</b> will be deleted.").ariaLabel("delete chatCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteChatCannedAnswers=p,m.createOrEditChatWebsiteChatCannedAnswer=function(e,n){o.show({controller:"CreateOrEditChatCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,chatCannedAnswer:n,chatCannedAnswers:m.chatWebsiteChatCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedChatWebsiteChatCannedAnswers=function(){var e=angular.copy(m.selectedChatWebsiteChatCannedAnswers);return m.selectedChatWebsiteChatCannedAnswers=[],e},m.deleteChatWebsiteChatCannedAnswer=g,m.deleteSelectedChatWebsiteChatCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected chatCannedAnswers?").htmlContent("<b>"+m.selectedChatWebsiteChatCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete chatCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteChatCannedAnswers.forEach(function(e){g(e)}),m.selectedChatWebsiteChatCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteChatCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATCANNEDANSWER",g.chatCannedAnswer=angular.copy(l),g.chatCannedAnswers=r,g.newChatCannedAnswer=!1,g.chatCannedAnswer||(g.chatCannedAnswer={},g.title="CHAT.NEW_CHATCANNEDANSWER",g.newChatCannedAnswer=!0),n.params.id&&(g.chatCannedAnswer.ChatWebsiteId=n.params.id),g.addNewChatCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.chatCannedAnswer).$promise.then(function(e){g.chatCannedAnswers.unshift(e.toJSON()),o.success({title:"ChatCannedAnswer properly created",msg:g.chatCannedAnswer.name?g.chatCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.chatCannedAnswer.id},g.chatCannedAnswer).$promise.then(function(e){var n=_.find(g.chatCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatCannedAnswer properly saved!",msg:g.chatCannedAnswer.name?g.chatCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatCannedAnswer will be deleted.").ariaLabel("Delete ChatCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.chatCannedAnswer.id}).$promise.then(function(){_.remove(g.chatCannedAnswers,{id:g.chatCannedAnswer.id}),o.success({title:"ChatCannedAnswer properly deleted!",msg:(g.chatCannedAnswer.name||"chatCannedAnswer")+" has been deleted!"}),v(g.chatCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chatCannedAnswers","chatCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.chatWebsite.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.chatWebsite=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.chatWebsite.id,field:"ChatWebsiteId",route:"chatWebsite"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.chat").controller("ChatWebsiteDispositionsController",e)}(),function(){"use strict";function e(t,e,a){var i=this;i.chatWebsite={},i.offlineForm={},i.buttons=[{type:"label",name:"Label",icon:"icon-label"},{type:"chooseFromList",name:"Select",icon:"icon-playlist-plus"},{type:"input",name:"Input",icon:"icon-keyboard"},{type:"textarea",name:"Textarea",icon:"icon-format-text"},{type:"multipleChoices",name:"Radio Buttons",icon:"icon-radiobox-marked"},{type:"checkboxes",name:"Checkboxes",icon:"icon-checkbox-multiple-marked-outline"},{type:"agreement",name:"Agreement",icon:"icon-checkbox-marked-outline"},{type:"upload",name:"Upload",icon:"icon-upload"}],i.init=function(e){i.fields=[],i.customFields=[],i.uselessFields=["id","createdAt","updatedAt","ListId","CompanyId","$promise","$resolved"],i.chatWebsite=e,_.isEmpty(i.chatWebsite.offlineForm)&&(i.chatWebsite.offlineForm={items:[],fromKey:null});a.cmList.getCustomFields({id:i.chatWebsite.ListId}).$promise.then(function(e){for(var n=0;n<e.rows.length;n++)i.customFields.push({key:"cf_"+e.rows[n].id,value:e.rows[n].alias});return a.cmContact.describe().$promise}).then(function(e){for(var n=_.keys(e),t=0;t<n.length;t++)_.includes(i.uselessFields,n[t])||_.startsWith(n[t],"cf_")||i.fields.unshift({key:n[t],value:n[t]});return a.variable.get().$promise}).then(function(e){return i.variables=e.rows,a.mailAccount.get({fields:"id,name",raw:!0}).$promise.then(function(e){i.email_accounts=e.rows})}).catch(function(e){console.error(e)})},i.up=function(e,n){if(0!==n){var t=i.chatWebsite.offlineForm.items[n-1];i.chatWebsite.offlineForm.items[n]=t,i.chatWebsite.offlineForm.items[n-1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===n?i.chatWebsite.offlineForm.fromKey--:i.chatWebsite.offlineForm.fromKey===n-1&&i.chatWebsite.offlineForm.fromKey++}},i.down=function(e,n){if(n!==i.chatWebsite.offlineForm.items.length-1){var t=i.chatWebsite.offlineForm.items[n+1];i.chatWebsite.offlineForm.items[n]=t,i.chatWebsite.offlineForm.items[n+1]=angular.copy(e),i.chatWebsite.offlineForm.fromKey===n?i.chatWebsite.offlineForm.fromKey++:i.chatWebsite.offlineForm.fromKey===n+1&&i.chatWebsite.offlineForm.fromKey--}},i.add=function(e){i.chatWebsite.offlineForm.items.push({type:e,cmField:null,variable:null})},i.remove=function(e){var n=t.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");t.show(n).then(function(){i.chatWebsite.offlineForm.items.splice(e,1)})},i.card_type="offline",i.email_accounts=[]}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteofflineFormController",e)}(),function(){"use strict";function e(t,e,a){var i=this;i.chatWebsite={},i.onlineForm={},i.buttons=[{type:"label",name:"Label",icon:"icon-label"},{type:"chooseFromList",name:"Select",icon:"icon-playlist-plus"},{type:"input",name:"Input",icon:"icon-keyboard"},{type:"textarea",name:"Textarea",icon:"icon-format-text"},{type:"multipleChoices",name:"Radio Buttons",icon:"icon-radiobox-marked"},{type:"checkboxes",name:"Checkboxes",icon:"icon-checkbox-multiple-marked-outline"},{type:"agreement",name:"Agreement",icon:"icon-checkbox-marked-outline"}],i.init=function(e){i.fields=[],i.customFields=[],i.uselessFields=["id","createdAt","updatedAt","ListId","CompanyId","$promise","$resolved"],i.chatWebsite=e,_.isEmpty(i.chatWebsite.onlineForm)&&(i.chatWebsite.onlineForm={items:[],fromKey:null});a.cmList.getCustomFields({id:i.chatWebsite.ListId}).$promise.then(function(e){for(var n=0;n<e.rows.length;n++)i.customFields.push({key:"cf_"+e.rows[n].id,value:e.rows[n].alias});return a.cmContact.describe().$promise}).then(function(e){for(var n=_.keys(e),t=0;t<n.length;t++)_.includes(i.uselessFields,n[t])||_.startsWith(n[t],"cf_")||i.fields.unshift({key:n[t],value:n[t]});return a.variable.get().$promise}).then(function(e){return i.variables=e.rows,a.mailAccount.get({fields:"id,name",raw:!0}).$promise.then(function(e){i.email_accounts=e.rows})}).catch(function(e){console.error(e)})},i.up=function(e,n){if(0!==n){var t=i.chatWebsite.onlineForm.items[n-1];i.chatWebsite.onlineForm.items[n]=t,i.chatWebsite.onlineForm.items[n-1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===n?i.chatWebsite.onlineForm.fromKey--:i.chatWebsite.onlineForm.fromKey===n-1&&i.chatWebsite.onlineForm.fromKey++}},i.down=function(e,n){if(n!==i.chatWebsite.onlineForm.items.length-1){var t=i.chatWebsite.onlineForm.items[n+1];i.chatWebsite.onlineForm.items[n]=t,i.chatWebsite.onlineForm.items[n+1]=angular.copy(e),i.chatWebsite.onlineForm.fromKey===n?i.chatWebsite.onlineForm.fromKey++:i.chatWebsite.onlineForm.fromKey===n+1&&i.chatWebsite.onlineForm.fromKey--}},i.add=function(e){i.chatWebsite.onlineForm.items.push({type:e,cmField:null,variable:null})},i.remove=function(e){var n=t.confirm().title("The component will be deleted.").textContent("Are you sure?").ariaLabel("Lucky day").ok("Ok").cancel("Cancel");t.show(n).then(function(){i.chatWebsite.onlineForm.fromKey===e&&(i.chatWebsite.onlineForm.fromKey=null),i.chatWebsite.onlineForm.items.splice(e,1),i.chatWebsite.onlineForm.items.length||(i.chatWebsite.onlineForm.fromKey=null)})},i.card_type="online",i.email_accounts=[]}e.$inject=["$mdDialog","$document","api"],angular.module("app.chat").controller("ChatWebsiteonlineFormController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/customer_avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitecustomerAvatarController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"chatWebsite",action:"getDispositions",field:"name",params:{id:m.chatWebsite.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.chatWebsiteInteractions=e||{count:0,rows:[]};for(var n=0;n<m.chatWebsiteInteractions.rows.length;n+=1){var t=m.chatWebsiteInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatInteraction.get(m.query,p).$promise}function v(e){d.chatInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteInteractions.rows,{id:e.id}),m.chatWebsiteInteractions.count-=1,m.chatWebsiteInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteInteractions={count:0,rows:[]},m.selectedChatWebsiteInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Customer Ip",column:"customerIp",type:"text",options:{excludedOperators:["$eq","$ne","$startsWith","$endsWith"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.chatInteractionDownload=function(s,e,n){return d.chatInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="chat-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatWebsite.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getChatWebsiteInteractions=g,m.createOrEditChatWebsiteInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,interaction:n,interactions:m.chatWebsiteInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spychatInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"chat",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"chat.chatWebsites"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||ChatWebsiteId:=$eq["+m.chatWebsite.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedChatWebsiteInteractions=function(){var e=angular.copy(m.selectedChatWebsiteInteractions);return m.selectedChatWebsiteInteractions=[],e},m.deleteChatWebsiteInteraction=v,m.deleteSelectedChatWebsiteInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedChatWebsiteInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteInteractions.forEach(function(e){v(e)}),m.selectedChatWebsiteInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteInteractionsController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/logo".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitelogoController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteOfflineMessages=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getOfflineMessages(m.query,u).$promise}function g(e){d.chatOfflineMessage.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteOfflineMessages.rows,{id:e.id}),m.chatWebsiteOfflineMessages.count-=1,m.chatWebsiteOfflineMessages.rows.length||p(),l.success({title:"OfflineMessage deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteOfflineMessages={count:0,rows:[]},m.selectedChatWebsiteOfflineMessages=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,attachments,Contact.firstName,ContactId,ChatWebsiteId",sort:"-createdAt",limit:10,page:1},m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the offlineMessage?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("offlineMessage #")+e.id||"offlineMessage")+"</b> will be deleted.").ariaLabel("delete offlineMessage").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteOfflineMessages=p,m.createOrEditChatWebsiteOfflineMessage=function(e,n){o.show({controller:"CreateOrEditOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,offlineMessage:n,offlineMessages:m.chatWebsiteOfflineMessages.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.showOfflineMessageChatWebsiteOfflineMessage=function(e,t){o.show({controller:"ShowOfflineMessageOfflineMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{message:["apiResolver","$stateParams",function(e,n){return e.resolve("chatOfflineMessage@get",{fields:"id,body",id:t.id})}],attachments:["apiResolver","$stateParams",function(e,n){return e.resolve("attachment@get",{fields:"id,name",ChatOfflineMessageId:t.id})}]}})},m.exportSelectedChatWebsiteOfflineMessages=function(){var e=angular.copy(m.selectedChatWebsiteOfflineMessages);return m.selectedChatWebsiteOfflineMessages=[],e},m.deleteChatWebsiteOfflineMessage=g,m.deleteSelectedChatWebsiteOfflineMessages=function(e){var n=o.confirm().title("Are you sure want to delete the selected offlineMessages?").htmlContent("<b>"+m.selectedChatWebsiteOfflineMessages.length+" selected</b> will be deleted.").ariaLabel("delete offlineMessages").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteOfflineMessages.forEach(function(e){g(e)}),m.selectedChatWebsiteOfflineMessages=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteOfflineMessagesController",e)}(),function(){"use strict";function e(n,e,t,a,i){var s=this;s.title="CHAT.OFFLINE_MESSAGE",s.message=a,s.attachments=i.rows,s.closeDialog=function(e){n.hide(e)},s.download=function(i){return e.attachment.download({id:i.id}).$promise.then(function(e){if(e){var n=new Blob([e.buffer],{type:e.type}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.href=a,t.target="_self",t.download=i.name,document.body.appendChild(t),t.click(),setTimeout(function(){document.body.removeChild(t),window.URL.revokeObjectURL(a)},100)}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.isHtml=_.isNil(s.message.body.match(/\s?<!doctype html>|(<html\b[^>]*>|<body\b[^>]*>|<x-[^>]+>)+/i))}e.$inject=["$mdDialog","api","toasty","message","attachments"],angular.module("app.chat").controller("ShowOfflineMessageOfflineMessageDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.chatWebsiteProactiveActions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.chatWebsite.getProactiveActions(m.query,u).$promise}function g(e){d.chatProactiveAction.delete({id:e.id}).$promise.then(function(){_.remove(m.chatWebsiteProactiveActions.rows,{id:e.id}),m.chatWebsiteProactiveActions.count-=1,m.chatWebsiteProactiveActions.rows.length||p(),l.success({title:"ChatProactiveAction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETchatWebsite"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.chatWebsite={},m.chatWebsiteProactiveActions={count:0,rows:[]},m.selectedChatWebsiteProactiveActions=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,name,type,selector,timeout",limit:10,page:1},m.arraytype=_.keyBy([{option:"MouseOver",value:"'mouseOver'"},{option:"Timeout",value:"'timeout'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n,t){m.chatWebsite=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.ChatWebsiteId=m.chatWebsite.id,m.query.id=m.chatWebsite.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the chatProactiveAction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("chatProactiveAction #")+e.id||"chatProactiveAction")+"</b> will be deleted.").ariaLabel("delete chatProactiveAction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getChatWebsiteProactiveActions=p,m.createOrEditChatWebsiteChatProactiveAction=function(e,n){o.show({controller:"CreateOrEditChatProactiveActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{chatWebsite:m.chatWebsite,chatProactiveAction:n,proactive:m.chatWebsiteProactiveActions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedChatWebsiteProactiveActions=function(){var e=angular.copy(m.selectedChatWebsiteProactiveActions);return m.selectedChatWebsiteProactiveActions=[],e},m.deleteChatWebsiteChatProactiveAction=g,m.deleteSelectedChatWebsiteProactiveActions=function(e){var n=o.confirm().title("Are you sure want to delete the selected proactive?").htmlContent("<b>"+m.selectedChatWebsiteProactiveActions.length+" selected</b> will be deleted.").ariaLabel("delete proactive").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedChatWebsiteProactiveActions.forEach(function(e){g(e)}),m.selectedChatWebsiteProactiveActions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.chat").controller("ChatWebsiteProactiveActionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CHAT.EDIT_CHATPROACTIVEACTION",g.chatProactiveAction=angular.copy(l),g.proactive=r,g.newChatProactiveAction=!1,g.chatProactiveAction||(g.chatProactiveAction={type:"mouseOver"},g.title="CHAT.NEW_CHATPROACTIVEACTION",g.newChatProactiveAction=!0),n.params.id&&(g.chatProactiveAction.ChatWebsiteId=n.params.id),g.addNewChatProactiveAction=function(){g.errors=[],d.chatProactiveAction.save(g.chatProactiveAction).$promise.then(function(e){g.proactive.unshift(e.toJSON()),o.success({title:"ChatProactiveAction properly created",msg:g.chatProactiveAction.name?g.chatProactiveAction.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveChatProactiveAction=function(){g.errors=[],d.chatProactiveAction.update({id:g.chatProactiveAction.id},g.chatProactiveAction).$promise.then(function(e){var n=_.find(g.proactive,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ChatProactiveAction properly saved!",msg:g.chatProactiveAction.name?g.chatProactiveAction.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteChatProactiveAction=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chatProactiveAction will be deleted.").ariaLabel("Delete ChatProactiveAction").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.chatProactiveAction.delete({id:g.chatProactiveAction.id}).$promise.then(function(){_.remove(g.proactive,{id:g.chatProactiveAction.id}),o.success({title:"ChatProactiveAction properly deleted!",msg:(g.chatProactiveAction.name||"chatProactiveAction")+" has been deleted!"}),v(g.chatProactiveAction)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.chatProactiveAction.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatProactiveAction.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","proactive","chatProactiveAction","api","Auth","license","setting","crudPermissions"],angular.module("app.chat").controller("CreateOrEditChatProactiveActionDialogController",e)}(),function(){"use strict";function e(e){var n=this;n.chatWebsite={},n.init=function(e){n.chatWebsite=e,n.start="\n\x3c!-- START Motion Chat Script --\x3e",n.script='\n    <script src="'+n.chatWebsite.remote+"/api/chat/websites/"+n.chatWebsite.id+"/snippet?token="+n.chatWebsite.token+'"><\/script>',n.end="\n\x3c!-- START Motion Chat Script --\x3e"},n.info={},e.$watch("vm_ac.chatWebsite.remote",function(e){n.script='\n    <script src="'+n.chatWebsite.remote+"/api/chat/websites/"+n.chatWebsite.id+"/snippet?token="+n.chatWebsite.token+'"><\/script>'})}e.$inject=["$scope"],angular.module("app.chat").controller("ChatWebsiteScriptController",e)}(),function(){"use strict";function e(e,a){var i=this;i.chatWebsite={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.chatWebsite.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.chatWebsite.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.chatWebsite=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="/api/chat/websites/:id/system_avatar".replace(":id",i.chatWebsite.id),i.chatWebsite.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.chat").controller("ChatWebsitesystemAvatarController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.chatWebsite=c||e.params.chatWebsite||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"ChatWebsiteagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{chatWebsite:e,chatWebsites:p.chatWebsites?p.chatWebsites.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoChatWebsites=function(){e.go("app.chat.chatWebsites",{},{reload:"app.chat.chatWebsites"})},p.saveChatWebsite=function(){r.chatWebsite.update({id:p.chatWebsite.id},p.chatWebsite).$promise.then(function(){l.success({title:"ChatWebsite updated!",msg:p.chatWebsite.name?p.chatWebsite.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.chatWebsite&&(t=_.find(p.lists,{id:Number(p.chatWebsite.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.chatWebsite&&(a=_.find(p.lists,{id:Number(p.chatWebsite.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){p.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){p.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.interval,{id:e.resourceId})}),t=null;if(p.chatWebsite&&(t=_.find(p.interval,{id:Number(p.chatWebsite.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.interval,{id:t.id});a.canSelect=!1,n.push(a)}p.interval=n})}else{var t=[],a=null;p.chatWebsite&&(a=_.find(p.interval,{id:Number(p.chatWebsite.IntervalId)}));for(var i=0;i<p.interval.length;i++)a&&p.interval[i].id===a.id&&(p.interval[i].canSelect=!1,t.push(p.interval[i]));p.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","chatWebsite","userProfile","userProfileSection"],angular.module("app.chat").controller("ChatWebsiteController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.chat.realtime.agents":this.selectedTab=0;break;case"app.chat.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.chat.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.chat.realtime.agents");break;case 1:t.go("app.chat.realtime.queues");break;default:t.go("app.chat.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.chat").controller("ChatRealtimeController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.companies=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="companies",f.listOrder="",f.listOrderAsc=null,f.selectedCompanies=[],f.query={fields:"createdAt,updatedAt,id,name,phone,vat,fax,companyId,type,website,emailDomain,email,description,sStreet,sPostalCode,sCity,sCountry,street,postalCode,city,country",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){a.go("app.contactmanager.companies.edit",{id:e.id,company:e,crudPermissions:f.crudPermissions})},f.gotocontactsgoto=function(t,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{CompanyId:t.id}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{CompanyId:t.id})}},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("company")+"?").htmlContent("<b>"+(e.name||"company")+"</b> will be deleted.").ariaLabel("delete company").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCompanies=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmCompany.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Companies",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCompany=function(e,n){i.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{company:n,companies:f.companies.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCompany=y,f.exportSelectedCompanies=function(){var e=angular.copy(f.selectedCompanies);return f.selectedCompanies=[],e},f.deleteSelectedCompanies=function(e){var n=i.confirm().title("Are you sure want to delete the selected companies?").htmlContent("<b>"+f.selectedCompanies.length+" selected</b> will be deleted.").ariaLabel("delete Companys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCompanies.forEach(function(e){y(e)}),f.selectedCompanies=[]})},f.deselectCompanies=function(){f.selectedCompanies=[]},f.selectAllCompanies=function(){f.selectedCompanies=f.companies.rows};var b=!0,A=1;function E(e){f.companies=e||{count:0,rows:[]}}function y(e){m.cmCompany.delete({id:e.id}).$promise.then(function(){_.remove(f.companies.rows,{id:e.id}),f.companies.count-=1,f.companies.rows.length||f.getCompanies(),p.success({title:_.startCase("Company")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCompany"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmCompany",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCompanies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","companies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("CompaniesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_COMPANY",g.company=angular.copy(l),g.companies=r,g.newCompany=!1,g.company||(g.company={},g.title="CONTACTMANAGER.NEW_COMPANY",g.newCompany=!0),g.addNewCompany=function(){g.errors=[],d.cmCompany.save(g.company).$promise.then(function(e){g.companies.unshift(e.toJSON()),o.success({title:"Company properly created",msg:g.company.name?g.company.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCompany=function(){g.errors=[],d.cmCompany.update({id:g.company.id},g.company).$promise.then(function(e){var n=_.find(g.companies,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Company properly saved!",msg:g.company.name?g.company.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCompany=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The company will be deleted.").ariaLabel("Delete Company").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmCompany.delete({id:g.company.id}).$promise.then(function(){_.remove(g.companies,{id:g.company.id}),o.success({title:"Company properly deleted!",msg:(g.company.name||"company")+" has been deleted!"}),v(g.company)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCompany.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCompany.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","companies","company","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditCompanyDialogController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.company=c||a.params.company||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=a.params.tab||0,u.gotogoto=function(t,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{CompanyId:t.id}):l.info({title:i.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:i.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{CompanyId:t.id})}},u.alert=l.info,u.gotoCompanies=function(){a.go("app.contactmanager.companies",{},{reload:"app.contactmanager.companies"})},u.saveCompany=function(){r.cmCompany.update({id:u.company.id},u.company).$promise.then(function(){l.success({title:"Company updated!",msg:u.company.name?u.company.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmCompany",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","company","userProfileSection"],angular.module("app.contactmanager").controller("CompanyController",e)}(),function(){"use strict";function e(n,i,t,a,e,s,o,r,l,d,c,m,u,p,g,v,h,f,b){var A=this;A.currentUser=f.getCurrentUser(),A.license=b,A.userProfile=r,A.userProfileSection=l&&1==l.count?l.rows[0]:null,A.crudPermissions=f.parseCrudPermissions(A.userProfileSection?A.userProfileSection.crudPermissions:null);var E=60,y=1024*E*1024;A.ngFlowOptions={target:"api/cm/contacts/upload",singleFile:!0,maxChunkRetries:1,chunkSize:y,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},A.contacts=c||{count:0,rows:[]},A.options={hidden:!1,hover:!1,isOpen:!1},A.table="cm_contacts",A.selectedContacts=[],A.lists=m||{rows:[],count:0},A.companies=p||{rows:[],count:0},A.tags=v||{rows:[],count:0},A.listsMap=u,A.companiesMap=g,A.selectedTags=[],A.selectedList=null,A.selectedCompany=null,A.query=_.merge({includeAll:!0,sort:"-updatedAt",limit:10,offset:0,page:1},e),A.editdialog=function(e,n){a.go("app.contactmanager.contacts.edit",{id:e.id,crudPermissions:A.crudPermissions})},A.deleteconfirm=function(e,n){var t=s.confirm().title("Are you sure want to delete the contact?").htmlContent("<b>"+(e.firstName||e.email||e.phone||"Contact")+"</b> will be deleted.").ariaLabel("delete contact").targetEvent(n).ok("OK").cancel("CANCEL");s.show(t).then(function(){O(e)})},A.success=I,A.getContacts=function(){A.query.offset=(A.query.page-1)*A.query.limit,f.hasRole("admin")?A.promise=d.cmContact.get(A.query,I).$promise:(A.query.id=A.userProfile.id,A.query.ListId=A.query.ListId?A.query.ListId:_.map(A.lists.rows,"id"),A.query.CompanyId=A.query.CompanyId?A.query.CompanyId:_(A.companies.rows).filter({canSelect:void 0}).map("id").value(),A.query.section="Contacts",A.promise=d.userProfile.getResources(A.query,I).$promise)},A.getAssignedCompanies=function(){if(!f.hasRole("admin")){var e=_(A.contacts.rows).map(function(e){return{id:e.CompanyId}}).uniqBy("id").filter(function(e){return e.id&&0<e.id}).pullAllBy(A.companies.rows,"id").value();if(!_.isEmpty(e)){var n=[];e.forEach(function(e){n.push(d.cmCompany.get({id:e.id,fields:"id,name"}).$promise)}),o.all(n).then(function(e){e.forEach(function(e){var n=e.toJSON();n.canSelect=!1,A.companies.rows.push(n);var t={};t[n.id]=n.name,A.companiesMap=_.assignIn(A.companiesMap,t)})}).catch(function(e){h.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_COMPANY",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}},A.mergeContact=function(e,n){s.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:A.contacts.rows}})},A.duplicateContact=function(e,n){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name",nolimit:!0}):e.resolve("userProfile@getResources",{id:n.getCurrentUser().userProfileId,section:"Lists",fields:"id,name",nolimit:!0})}]},locals:{contacts:A.contacts.rows}})},A.createOrEditContact=function(e,n){n&&n.dateOfBirth&&(n.dateOfBirth=new Date(n.dateOfBirth));s.show({controller:"CreateOrEditContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{ListId:A.query.ListId||a.params.ListId,CompanyId:A.query.CompanyId||a.params.CompanyId,contact:n,contacts:A.contacts.rows,companies:A.companies,lists:A.lists,setting:null,crudPermissions:A.crudPermissions}})},A.deleteContact=O,A.exportSelectedContacts=function(){var e=angular.copy(A.selectedContacts);return A.selectedContacts=[],e},A.deleteSelectedContacts=function(e){var n=s.confirm().title("Are you sure want to delete the selected contacts?").htmlContent("<b>"+A.selectedContacts.length+" selected</b> will be deleted.").ariaLabel("delete Contacts").targetEvent(e).ok("OK").cancel("CANCEL");s.show(n).then(function(){A.selectedContacts.forEach(function(e){O(e)}),A.selectedContacts=[]})},A.deselectContacts=function(){A.selectedContacts=[]},A.selectAllContacts=function(){A.selectedContacts=A.contacts.rows},A.createTag=function(e){var n=s.prompt().title("What would you name your tag?").placeholder("Tag name").ariaLabel("Tag name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.tag.save({name:e});h.error({title:"Error creating tag!",msg:"Invalid tag name."})}).then(function(e){e&&(A.tags.rows.push(e),h.success({title:"Tag properly created!",msg:e.tag?e.name+" has been created!":""}))})},A.createList=function(e){var n=s.prompt().title("What would you name your list?").placeholder("List name").ariaLabel("List name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.cmList.save({name:e});h.error({title:"Error creating list!",msg:"Invalid list name."})}).then(function(e){e&&(A.lists.rows.push(e),h.success({title:"List properly created!",msg:e.name?e.name+" has been created!":""}))})},A.createCompany=function(e){var n=s.prompt().title("What would you name your company?").placeholder("Company name").ariaLabel("Company name").targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(function(e){if(e)return d.cmCompany.save({name:e});h.error({title:"Error creating company!",msg:"Invalid company name."})}).then(function(e){e&&(A.companies.rows.push(e),h.success({title:"Company properly created!",msg:e.name?e.name+" has been created!":""}))})},A.importContacts=function(e,n,t){var a=JSON.parse(n);s.show({controller:"ImportContactsDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/import/import.html",parent:angular.element(i.body),clickOutsideToClose:!1,locals:{lists:m,companies:p,file:a.file,fields:a.fields,license:A.license}}).then(function(){A.getContacts()}).catch(function(e){console.error()})},A.importContactsUpdates=function(e,n,t){var a=JSON.parse(n);s.show({controller:"ImportContactsUpdatesDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/import/importUpdates.html",parent:angular.element(i.body),clickOutsideToClose:!1,locals:{lists:m,companies:p,file:a.file,fields:a.fields,license:A.license}}).then(function(){A.getContacts()}).catch(function(e){console.error()})},A.hasPermission=function(){return f.hasPermission(303)||f.hasRole("admin")},A.fileAdded=function(e){var n=["csv"];if(!_.includes(n,e.getExtension()))return h.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>y)return h.error({title:"File too big",msg:"The max allowed size is "+E+"MB"}),!1;return!0},a.params.ListId&&(A.selectedList=a.params.ListId),a.params.CompanyId&&(A.selectedCompany=a.params.CompanyId),n.$watch("vm.options.isOpen",function(e){e?t(function(){n.tooltipVisible=A.options.isOpen},600):n.tooltipVisible=A.options.isOpen});var S=!0,T=1;function I(e){A.contacts=e||{count:0,rows:[]}}function O(e){d.cmContact.delete({id:e.id}).$promise.then(function(){_.remove(A.contacts.rows,{id:e.id}),A.contacts.count-=1,A.contacts.rows.length||A.getContacts(),h.success({title:"Contact deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){A.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}];for(var n=0;n<e.data.errors.length;n++)h.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else h.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}n.$watch("vm.query.filter",function(e,n){S?t(function(){S=!1}):(n||(T=A.query.page),e!==n&&(A.query.page=1),e||(A.query.page=T),A.getContacts())},!0),n.$watch("vm.selectedList",function(e,n){e!==n&&(A.query.ListId=A.selectedList||void 0,A.getContacts())}),n.$watch("vm.selectedCompany",function(e,n){e!==n&&(A.query.CompanyId=A.selectedCompany||void 0,A.getContacts())}),n.$watch("vm.selectedTags",function(e,n){(e.length||n.length)&&A.getContacts()})}e.$inject=["$scope","$document","$timeout","$state","$stateParams","$mdDialog","$q","userProfile","userProfileSection","api","contacts","lists","listsMap","companies","companiesMap","tags","toasty","Auth","license"],angular.module("app.contactmanager").controller("ContactsController",e)}(),function(){"use strict";function e(t,e,a,n,i,s,o,r,l,d,c){var m=this;if(m.errors=[],m.title="CONTACTMANAGER.EDIT_CONTACT",m.crudPermissions=c,m.contact=angular.copy(o),m.additionalItemTypes=[],m.additionalItems=[],m.contacts=n||{rows:[],count:0},m.lists=i||{rows:[],count:0},m.companies=s||{rows:[],count:0},m.customFields={rows:[],count:0},m.newContact=!1,m.newPhone=function(e){return{phone:e,color:"gray"}},m.contactItemTypes=[],m.contact)delete m.contact.List,f(m.contact.ListId),d.cmContact.getAdditionalPhones({id:o.id}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");m.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");m.additionalItems=[];for(var s=0;s<n.length;s++)m.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})}).catch(function(e){console.log(e)});else{m.contact={ListId:r?parseInt(r,10):void 0,CompanyId:l?parseInt(l,10):void 0};var u=_.map(m.contact.Phones,"item"),p=_.map(m.contact.Phones,"description");m.additionalItemTypes=_.map(m.contact.Phones,"ItemTypeId");var g=_.map(m.contact.Phones,"ItemType.rgbBackgroundColor"),v=_.map(m.contact.Phones,"ItemType.name");m.additionalItems=[];for(var h=0;h<u.length;h++)m.additionalItems.push({phone:u[h],type:v[h],color:g[h],description:p[h]});m.title="CONTACTMANAGER.NEW_CONTACT",m.newContact=!0,b()}function f(e){if(e)return d.cmList.getCustomFields({id:e}).$promise.then(function(e){if(e){m.customFields=e;var n=_.map(m.customFields.rows,function(e){return"cf_"+e.id});return d.cmContact.get({id:m.contact.id,attributes:n,raw:!0}).$promise.then(function(e){m.contact=_.merge(m.contact,e)})}}).then(function(){m.customFields.rows.forEach(function(e){"datetime"===e.type&&m.contact["cf_"+e.id]&&(m.contact["cf_"+e.id]=A(m.contact["cf_"+e.id]))}),Object.keys(m.contact).forEach(function(e){if(_.startsWith(e,"cf_")){var n=e.split("_")[1];_.some(m.customFields.rows,["id",Number(n)])||delete m.contact["cf_"+n]}})}).catch(function(e){console.error(e)});m.customFields={rows:[],count:0}}function b(){return d.cmList.getGlobalCustomFields().$promise.then(function(e){if(e){m.customFields=e;_.map(m.customFields.rows,function(e){return"cf_"+e.id})}else;}).catch(function(e){console.error(e)})}function A(e){return null===e?void 0:new Date(e)}function E(){t.hide()}d.contactItemType.get({fields:"id,name,rgbBackgroundColor"}).$promise.then(function(e){m.contactItemTypes=e.rows}),m.addNewContact=function(){m.errors=[],d.cmContact.save(m.contact).$promise.then(function(e){m.contacts.unshift(e),d.cmContact.setAdditionalPhones({id:e.id,items:m.additionalItems,item_types:m.additionalItemTypes}).$promise.then(function(){a.success({title:"Contact properly created",msg:m.contact.name?m.contact.name+" has been created!":""}),E()})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contacts.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveContact=function(){m.errors=[],d.cmContact.update({id:m.contact.id},m.contact).$promise.then(function(e){var n=_.find(m.contacts,{id:e.id});n&&_.merge(n,e)}).then(function(){return d.cmContact.setAdditionalPhones({id:o.id,items:m.additionalItems,item_types:m.additionalItemTypes}).$promise.then(function(){a.success({title:"Contact properly saved!",msg:m.contact.name?m.contact.name+" has been saved!":""}),E()})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteContact=function(e){m.errors=[];var n=t.confirm().title("Are you sure?").content("The contact will be deleted.").ariaLabel("Delete Contact").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmContact.delete({id:m.contact.id}).$promise.then(function(){_.remove(m.contacts,{id:m.contact.id}),a.success({title:"Contact properly deleted!",msg:m.contact.name?m.contact.name+" has been deleted!":""}),E()}).catch(function(e){console.error(e),m.errors=e.data.errors||[{message:e.toString(),type:"api.contact.delete"}]})},function(){})},m.closeDialog=E,m.getCustomFields=f,m.getDateFromString=A,e.$watch("vm.contact.ListId",function(e,n){_.isNil(e)&&b()})}e.$inject=["$mdDialog","$scope","toasty","contacts","lists","companies","contact","ListId","CompanyId","api","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactDialogController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;function r(){e.hide()}o.errors=[],o.title="CONTACTMANAGER.COPY_CONTACT",o.contact=angular.copy(n),o.lists=i||{rows:[],count:0},o.addNewContact=function(){o.errors=[];var n=o.contact.id;delete o.contact.id,o.contact.tags&&!o.contact.tags.length&&delete o.contact.tags;s.cmContact.save(o.contact).$promise.then(function(e){return a.unshift(e),s.cmContact.duplicateAdditionalPhones({id:n,fromContactId:n,toContactId:e.id}).$promise.then(function(){t.success({title:"Contact properly created",msg:o.contact.name?o.contact.name+" has been created!":""}),r()})}).catch(function(e){console.error(e),o.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}]})},o.closeDialog=r}e.$inject=["$mdDialog","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("DuplicateContactDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e){a.hide(e)}d.errors=[],d.title="CONTACTMANAGER.EDIT_HOPPER",d.hopper=angular.copy(o),d.hoppers=s,d.newHopper=!1,d.crudPermissions=l,d.hopper||(d.hopper={},d.title="CONTACTMANAGER.NEW_HOPPER",d.newHopper=!0),d.saveHopper=function(){d.errors=[],r.cmHopper.update({id:d.hopper.id},d.hopper).$promise.then(function(e){var n=_.find(d.hoppers,{id:e.id});n&&_.merge(n,e),i.success({title:"Hopper properly saved!",msg:d.hopper.name?d.hopper.name+" has been saved!":""}),c(e)}).catch(function(e){console.error(e),d.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}]})},d.getDateFromString=function(e){return null===e?void 0:new Date(e)},d.closeDialog=c}e.$inject=["$scope","$state","$location","$mdDialog","toasty","hoppers","hopper","api","crudPermissions"],angular.module("app.contactmanager.contacts").controller("EditHopperDialogController",e)}(),function(){"use strict";function e(a,t,e,i,s,n,o,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y){var S=this;function T(n){return function(e){S[n]=e||{count:0,rows:[]}}}function I(){S.queryHopper.offset=(S.queryHopper.page-1)*S.queryHopper.limit,S.queryHopper.id=S.contact.id,S.promise=r.cmContact.getHoppers(S.queryHopper,T("hoppers")).$promise}function O(){S.queryFinal.offset=(S.queryFinal.page-1)*S.queryFinal.limit,S.queryFinal.id=S.contact.id,S.promise=r.cmContact.getHopperFinals(S.queryFinal,T("finals")).$promise}function C(){S.queryHistory.offset=(S.queryHistory.page-1)*S.queryHistory.limit,S.queryHistory.id=S.contact.id,S.promise=r.cmContact.getHopperHistories(S.queryHistory,T("histories")).$promise}function w(e){S.journeyIsLoading=!0;var n=_.merge(S.journeyOptions,{id:S.contact.id,offset:e||0});return y.get(S.journey,n).then(function(e){S.journey=e.journey,S.canLoadMoreJourney=e.loadMore}).finally(function(){S.journeyIsLoading=!1})}S.currentUser=A.getCurrentUser(),S.license=b,S.journey=[],S.contact=l||{},S.hoppers=d||{rows:[],count:0},S.finals=c||{rows:[],count:0},S.histories=m||{rows:[],count:0},S.companies=p||{rows:[],count:0},S.lists=g||{rows:[],count:0},S.customFields=v||{rows:[],count:0},S.tags=h||{rows:[],count:0},S.jscriptySessions=f||{rows:[],count:0},S.journeyOptions=y.getQuery(),S.quickFilters=y.getQuickFilters(),S.journeyTimelineOptions={scrollEl:"#journey-content"},S.additionalItems=[],S.additionalItemTypes=[],S.contactItemTypes=[],S.firstDayMonth=new Date(moment().startOf("month").subtract(1,"seconds").utcOffset(0,!0).format()),S.lastDayMonth=new Date(moment().endOf("month").subtract(1,"day").utcOffset(0,!0).format()),S.userProfileSection=E&&1==E.count?E.rows[0]:null,S.crudPermissions=A.parseCrudPermissions(S.userProfileSection?S.userProfileSection.crudPermissions:null),S.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),S.queryHopper={fields:"id,phone,scheduledat,priority,recallme,VoiceQueueId,CampaignId,UserId",sort:"-updatedAt",limit:10,page:1},S.queryFinal={fields:"id,uniqueid,calleridnum,statedesc,starttime,disposition",sort:"-id",limit:10,page:1},S.queryHistory={fields:"id,uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-id",limit:10,page:1},S.queryJscriptySession={fields:"id,starttime,endtime,membername,projectname",sort:"-starttime",limit:10,page:1},S.selectedTab=e.params.tab||0,S.onInit=function(){A.hasRole("admin")||(function(){if(!_.some(S.companies.rows,{id:S.contact.CompanyId}))r.cmCompany.get({id:S.contact.CompanyId,fields:"id,name"}).$promise.then(function(e){var n=e.toJSON();n.canSelect=!1,S.companies.rows.push(n)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"GET_COMPANY",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}(),function(){var e=_.map(S.contact.Tags,function(e){return{id:e.id,name:e.name}});if(!_.isEmpty(e))for(var n=0;n<e.length;n++)_.some(S.tags.rows,{id:e.id})||(e[n].canSelect=!1,S.tags.rows.push(e[n]))}());return r.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){S.users=e||{count:0,rows:[]},S.usersMap=_.mapValues(_.keyBy(S.users.rows,"id"),"fullname"),S.Tags=_.map(S.contact.Tags,"id");var n=_.map(S.contact.Phones,"item"),t=_.map(S.contact.Phones,"description");S.additionalItemTypes=_.map(S.contact.Phones,"ItemTypeId");var a=_.map(S.contact.Phones,"ItemType.rgbBackgroundColor"),i=_.map(S.contact.Phones,"ItemType.name"),s=_.map(S.contact.Phones,"ItemType.id");S.additionalItems=[];for(var o=0;o<n.length;o++)S.additionalItems.push({phone:n[o],type:i[o],ItemTypeId:s[o],color:a[o],description:t[o]})}).then(function(e){r.contactItemType.get({fields:"id,name,rgbBackgroundColor"}).$promise.then(function(e){S.contactItemTypes=e.rows})}).finally(function(){S.contact&&w()})},S.gotoContacts=function(){e.go("app.contactmanager.contacts",{},{reload:!0,notify:!0})},S.duplicateContact=function(e){s.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,resolve:{lists:["apiResolver","Auth",function(e,n){return n.hasRole("admin")?e.resolve("cmList@get",{fields:"id,name"}):e.resolve("userProfile@getResources",{id:S.currentUser.userProfileId,section:"Lists",fields:"id,name"})}]},locals:{contacts:u.rows,contact:l}})},S.saveContact=function(){r.cmContact.update({id:S.contact.id},S.contact).$promise.then(function(){o.success({title:"Contact updated!",msg:S.contact.name?S.contact.name+" has been updated!":""})}).then(function(){return r.cmContact.setTags({id:S.contact.id,ids:S.Tags}).$promise}).then(function(){return r.cmContact.setAdditionalPhones({id:S.contact.id,items:S.additionalItems}).$promise}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEcontact",msg:e.data?JSON.stringify(e.data):e.toString()})})},S.editCompany=function(e,n){var t=_.find(S.companies.rows,{id:n});s.show({controller:"CreateOrEditCompanyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/companies/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{companies:[],license:null,setting:null,crudPermissions:!1===t.canSelect?{readOnly:!0,canEdit:!1,canDelete:!1}:r.userProfileSection.get({userProfileId:S.currentUser.userProfileId,sectionId:302}).$promise.then(function(e){var n=e.rows?e.rows[0]:null;return A.parseCrudPermissions(n?n.crudPermissions:null)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"API:GET_COMPANY_SECTION",msg:e.data?JSON.stringify(e.data):e.toString()})})},resolve:{company:["apiResolver",function(e){return e.resolve("cmCompany@get",{id:n})}]}})},S.onSelectList=function(e){if(S.contact.ListId){var n=s.confirm().title("You are selecting the list number: "+S.contact.ListId).textContent("Warning! You won't select a different list for the contact "+S.contact.firstName||S.contact.lastName||S.contact.id).targetEvent(e).ok("Ok").cancel("Cancel");return s.show(n).then(S.onSelectListSuccess).catch(function(){S.contact.ListId=null})}},S.onSelectListSuccess=function(){return r.cmList.getCustomFields({id:S.contact.ListId}).$promise.then(function(e){S.customFields=e||{rows:[],count:0}}).catch(function(e){console.error(e)})},S.getDateFromString=function(e){return null===e?void 0:new Date(e)},S.getHoppers=I,S.getFinals=O,S.getHistories=C,S.getJscriptySessions=function(){S.queryJscriptySession.offset=(S.queryJscriptySession.page-1)*S.queryJscriptySession.limit,S.queryJscriptySession.id=S.contact.id,S.promise=r.cmContact.getJscriptySessions(S.queryJscriptySession,T("jscriptySessions")).$promise},S.deleteconfirm=function(n,e){var t=s.confirm().title("Are you sure want to delete the agent?").htmlContent("<b>"+(n.phone||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(e).ok("OK").cancel("CANCEL");s.show(t).then(function(){var e;e=n,r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(S.hoppers.rows,{id:e.id}),S.hoppers.count--,S.hoppers.rows.length||S.getHoppers(),o.success({title:"Hopper deleted!",msg:e.phone?e.phone+" has been deleted!":""})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEhopper",msg:e.data?JSON.stringify(e.data):e.toString()})})},function(){console.log("CANCEL")})},S.editHopper=function(e,n){s.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:n,hoppers:S.hoppers.rows,license:null,setting:null,crudPermissions:S.crudPermissions}})},S.createOrEditIvrCampaignHopper=function(e,n){s.show({controller:"CreateOrEditHopperCampaignIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{hopper:n,hoppers:S.hoppers.rows,license:null,setting:null,crudPermissions:S.crudPermissions}})},S.newPhone=function(e){return{phone:e,color:"gray"}},S.getCustomerJourney=w,S.loadMoreJourney=function(){return n(function(e,n){var t=S.journey.length;return e(w(t))})},S.moveUp=function(e){N(e,e-1)},S.moveDown=function(e){N(e,e+1)};var R=!0,x=1;function N(e,n){var t=S.additionalItems[n];S.additionalItems[n]=S.additionalItems[e],S.additionalItems[e]=t,a.additionalPhonesForm.$setDirty()}a.$watch("vm.queryHopper.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryHopper.page),e!==n&&(S.queryHopper.page=1),e||(S.queryHopper.page=x),I())}),a.$watch("vm.queryFinal.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryFinal.page),e!==n&&(S.queryFinal.page=1),e||(S.queryFinal.page=x),O())}),a.$watch("vm.queryHistory.filter",function(e,n){R?t(function(){R=!1}):(n||(x=S.queryHistory.page),e!==n&&(S.queryHistory.page=1),e||(S.queryHistory.page=x),C())})}e.$inject=["$scope","$timeout","$state","$document","$mdDialog","$q","toasty","api","contact","hoppers","finals","histories","contacts","companies","lists","customFields","tags","jscriptySessions","license","Auth","userProfileSection","customerJourneyManager"],angular.module("app.contactmanager.contacts").controller("ContactController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;g.processing=!1,g.stopping=!0,g.license=p,g.pid=0,g.result={finish:!1,rows:0,affectedRows:0,failedRows:0,duplicatedRows:0,errors:[]},g.contactFields=[{key:"firstName",required:!0},{key:"lastName",required:!1},{key:"phone",required:!0},{key:"mobile",required:!1},{key:"email",required:!1},{key:"dateOfBirth",required:!1},{key:"country",required:!1},{key:"city",required:!1},{key:"street",required:!1},{key:"postalCode",required:!1},{key:"fax",required:!1}],g.motionBullFields=[{key:"UserId",required:!1},{key:"scheduledat",required:!1},{key:"priority",required:!1},{key:"dialTimezone",required:!1}],g.contactItemTypes=[],l.contactItemType.get({fields:"id,name,orderBy"}).$promise.then(function(e){var n=e.rows;console.log(n);for(var t=0;t<n.length;t++)g.contactItemTypes.push({key:n[t].name,required:!1})}),g.binding={},g.duplicate=[],g.lists=s||{rows:[],count:0},g.companies=o||{rows:[],count:0},g.customFields={rows:[],count:0},g.fields=u||[],g.closeDialog=function(){d.removeAllListeners("contact:import:"+v),n.hide()},g.onChangeList=function(){return l.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})},g.uploadCsv=function(){g.processing=moment(),l.cmContact.import({id:m.filename,binding:g.binding,ListId:g.ListId,CompanyId:g.CompanyId,duplicates:g.duplicates,socket_timestamp:v}).$promise.then(function(e){g.stopping=!1,e&&e.pid&&(g.pid=e.pid)}).catch(function(e){g.processing=!1,r.error({title:"Import process failed!",msg:"Please retry with a new file"})})},g.getHeaderErrors=function(){var e=u;return e.push("contact_import_error"),e},g.getArrayErrors=function(){for(var e=[],n=0;n<g.result.errors.length;n+=1){var t=g.result.errors[n].row;t.contact_import_error=g.result.errors[n].message,e.push(t)}return e},g.stopUpload=function(){if(g.stopping=!0,g.pid)return l.system.killProcess({pid:g.pid}).$promise.then(function(e){r.success({title:"CSV import process stopped!",msg:"Import has been stopped!"})}).catch(function(e){r.error({title:"CSV stop import process failed!",msg:"pid is unknown"})})};var v=moment().unix();d.on("contact:import:"+v,function(t){i(function(){if(g.result.rows=t.rows,t.errors)for(var e=0;e<t.errors.length;e++)g.result.errors.push(t.errors[e]);if(t.finish){g.result.finish=!0,g.result.affectedRows=t.affectedRows,g.result.failedRows=g.result.errors.length;var n=g.result.rows-g.result.affectedRows-g.result.errors.length;n&&0<n&&(g.duplicates.length?g.result.duplicatedRows=n:g.result.failedRows+=n),g.result.elapsed=moment().diff(g.processing,"seconds")}})}),c.$on("$destroy",function(){d.removeAllListeners("contact:import:"+v)})}e.$inject=["$cookies","$mdDialog","$interval","$q","$timeout","lists","companies","toasty","api","socket","$scope","file","fields","license"],angular.module("app.tools").controller("ImportContactsDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;g.processing=!1,g.stopping=!0,g.license=p,g.pid=0,g.result={finish:!1,rows:0,affectedRows:0,failedRows:0,duplicatedRows:0,errors:[]},g.contactFields=[{key:"id",required:!0},{key:"firstName",required:!1},{key:"lastName",required:!1},{key:"phone",required:!0},{key:"mobile",required:!1},{key:"email",required:!1},{key:"dateOfBirth",required:!1},{key:"country",required:!1},{key:"city",required:!1},{key:"street",required:!1},{key:"postalCode",required:!1},{key:"fax",required:!1}],g.motionBullFields=[{key:"UserId",required:!1},{key:"scheduledat",required:!1},{key:"priority",required:!1}],g.contactItemTypes=[],l.contactItemType.get({fields:"id,name,orderBy"}).$promise.then(function(e){for(var n=e.rows,t=0;t<n.length;t++)g.contactItemTypes.push({key:n[t].name,required:!1})}),g.binding={},g.duplicate=[],g.lists=s||{rows:[],count:0},g.companies=o||{rows:[],count:0},g.customFields={rows:[],count:0},g.fields=u||[],g.closeDialog=function(){d.removeAllListeners("contact:import:"+v),n.hide()},g.onChangeList=function(){return l.cmList.getCustomFields({id:g.ListId}).$promise.then(function(e){g.customFields=e}).catch(function(e){console.error(e)})},g.uploadCsv=function(){g.processing=moment(),l.cmContact.importUpdates({id:m.filename,binding:g.binding,ListId:g.ListId,CompanyId:g.CompanyId,duplicates:g.duplicates,socket_timestamp:v}).$promise.then(function(e){g.stopping=!1,e&&e.pid&&(g.pid=e.pid)}).catch(function(e){g.processing=!1,r.error({title:"Import process failed!",msg:"Please retry with a new file"})})},g.getHeaderErrors=function(){var e=u;return e.push("contact_import_error"),e},g.getArrayErrors=function(){for(var e=[],n=0;n<g.result.errors.length;n+=1){var t=g.result.errors[n].row;t.contact_import_error=g.result.errors[n].message,e.push(t)}return e},g.stopUpload=function(){if(g.stopping=!0,g.pid)return l.system.killProcess({pid:g.pid}).$promise.then(function(e){r.success({title:"CSV import process stopped!",msg:"Import has been stopped!"})}).catch(function(e){r.error({title:"CSV stop import process failed!",msg:"pid is unknown"})})};var v=moment().unix();d.on("contact:import:"+v,function(t){i(function(){if(g.result.rows=t.rows,t.errors)for(var e=0;e<t.errors.length;e++)g.result.errors.push(t.errors[e]);if(t.finish){g.result.finish=!0,g.result.affectedRows=t.affectedRows,g.result.failedRows=g.result.errors.length;var n=g.result.rows-g.result.affectedRows-g.result.errors.length;n&&0<n&&(g.duplicates.length?g.result.duplicatedRows=n:g.result.failedRows+=n),g.result.elapsed=moment().diff(g.processing,"seconds")}})}),c.$on("$destroy",function(){d.removeAllListeners("contact:import:"+v)})}e.$inject=["$cookies","$mdDialog","$interval","$q","$timeout","lists","companies","toasty","api","socket","$scope","file","fields","license"],angular.module("app.tools").controller("ImportContactsUpdatesDialogController",e)}(),function(){"use strict";function e(i,e,s,n,o,t,r){var a=this;a.errors=[],a.title="CONTACTMANAGER.MERGE_CONTACT",a.contact=angular.copy(n),a.lists=t||[],a.change=function(){a.searchTerm?r.cmContact.get({fields:"id,firstName,lastName,phone,email",filter:a.searchTerm,ListId:n.ListId}).$promise.then(function(e){a.contacts=e.rows}).catch(function(e){console.error(e)}):a.contacts=[]},a.showConfirm=function(e,n,t){var a=i.confirm({skipHide:!0}).title("Would you like to merge your contacs?").textContent("All unfilled values of the contact #"+t.id+" will be overwritten by the fields of the contact #"+n.id+".").targetEvent(e).ok("Ok").cancel("Cancel");i.show(a).then(function(){return r.cmContact.merge({to:t.id,from:n.id}).$promise}).then(function(e){i.hide({new:e,to:t,from:n}),_.remove(o,{id:t.id}),_.remove(o,{id:n.id}),o.unshift(e)}).then(function(){s.success({title:"Contact properly merged!"})}).catch(function(e){e&&e.status&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:MERGE_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})})},a.closeDialog=function(){i.hide()}}e.$inject=["$mdDialog","$scope","toasty","contact","contacts","lists","api"],angular.module("app.tools").controller("MergeContactDialogController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){t.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD",g.sortable={animation:800,sort:!0,onSort:function(e){a.globalCustomFieldForm.$pristine=!1}},g.globalCustomField=l,g.globalCustomFields=r,g.newGlobalCustomField=!1,g.globalCustomField||(g.globalCustomField={type:"text",actionType:"voice"},g.title="CONTACTMANAGER.NEW_GLOBALCUSTOMFIELD",g.newGlobalCustomField=!0),a.$watch("vm.globalCustomField.type",function(e,n){if(e!==n)switch(e){case"text":g.globalCustomField.values="";break;case"select":g.globalCustomField.values=[]}}),g.addNewGlobalCustomField=function(){g.errors=[],d.cmCustomField.save(g.globalCustomField).$promise.then(function(e){g.globalCustomFields.unshift(e.toJSON()),o.success({title:"GlobalCustomField properly created",msg:g.globalCustomField.name?g.globalCustomField.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveGlobalCustomField=function(){g.errors=[],d.cmCustomField.update({id:g.globalCustomField.id},g.globalCustomField).$promise.then(function(e){var n=_.find(g.globalCustomFields,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"GlobalCustomField properly saved!",msg:g.globalCustomField.name?g.globalCustomField.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteGlobalCustomField=function(e){g.errors=[];var n=t.confirm().title("Are you sure?").content("The globalCustomField will be deleted.").ariaLabel("Delete GlobalCustomField").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmCustomField.delete({id:g.globalCustomField.id}).$promise.then(function(){_.remove(g.globalCustomFields,{id:g.globalCustomField.id}),o.success({title:"GlobalCustomField properly deleted!",msg:(g.globalCustomField.name||"globalCustomField")+" has been deleted!"}),v(g.globalCustomField)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.addItem=function(e){e.push({value:"New Item"}),a.globalCustomFieldForm.$pristine=!1},g.removeItem=function(e,n){e.splice(n,1),a.globalCustomFieldForm.$pristine=!1},g.removeItems=function(e){for(var n=e.length,t=0;t<n;t++)e.splice(0,1);a.globalCustomFieldForm.$pristine=!1},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","globalCustomFields","globalCustomField","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditGlobalCustomFieldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.globalCustomFields=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="globalCustomFields",f.listOrder="",f.listOrderAsc=null,f.selectedGlobalCustomFields=[],f.query={fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",sort:"-updatedAt",ListId:"null",limit:10,page:1},f.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayactionType=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{globalCustomField:e,globalCustomFields:f.globalCustomFields.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("globalCustomField")+"?").htmlContent("<b>"+(e.name||"globalCustomField")+"</b> will be deleted.").ariaLabel("delete globalCustomField").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getGlobalCustomFields=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmCustomField.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="GlobalCustomFields",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditGlobalCustomField=function(e,n){i.show({controller:"CreateOrEditGlobalCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{globalCustomField:n,globalCustomFields:f.globalCustomFields.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteGlobalCustomField=y,f.exportSelectedGlobalCustomFields=function(){var e=angular.copy(f.selectedGlobalCustomFields);return f.selectedGlobalCustomFields=[],e},f.deleteSelectedGlobalCustomFields=function(e){var n=i.confirm().title("Are you sure want to delete the selected globalCustomFields?").htmlContent("<b>"+f.selectedGlobalCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete GlobalCustomFields").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedGlobalCustomFields.forEach(function(e){y(e)}),f.selectedGlobalCustomFields=[]})},f.deselectGlobalCustomFields=function(){f.selectedGlobalCustomFields=[]},f.selectAllGlobalCustomFields=function(){f.selectedGlobalCustomFields=f.globalCustomFields.rows};var b=!0,A=1;function E(e){f.globalCustomFields=e||{count:0,rows:[]}}function y(e){m.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(f.globalCustomFields.rows,{id:e.id}),f.globalCustomFields.count-=1,f.globalCustomFields.rows.length||f.getGlobalCustomFields(),p.success({title:_.startCase("GlobalCustomField")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmCustomField"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmCustomField",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getGlobalCustomFields())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","globalCustomFields","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("GlobalCustomFieldsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_LIST",g.list=angular.copy(l),g.lists=r,g.newList=!1,g.list||(g.list={},g.title="CONTACTMANAGER.NEW_LIST",g.newList=!0),g.addNewList=function(){g.errors=[],d.cmList.save(g.list).$promise.then(function(e){g.lists.unshift(e.toJSON()),o.success({title:"List properly created",msg:g.list.name?g.list.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveList=function(){g.errors=[],d.cmList.update({id:g.list.id},g.list).$promise.then(function(e){var n=_.find(g.lists,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"List properly saved!",msg:g.list.name?g.list.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteList=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The list will be deleted.").ariaLabel("Delete List").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmList.delete({id:g.list.id}).$promise.then(function(){_.remove(g.lists,{id:g.list.id}),o.success({title:"List properly deleted!",msg:(g.list.name||"list")+" has been deleted!"}),v(g.list)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmList.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","lists","list","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditListDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.cmList.getAgents({id:c.list.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserList?"penalty "+e.UserList.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.list=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.cmList.removeAgents({id:c.list.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.cmList.addAgents({id:c.list.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("CONTACTMANAGER.ALL_AGENTS"),labelSelected:r.instant("CONTACTMANAGER.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","list","lists","realtime","$translate","Auth","crudPermissions"],angular.module("app.contactmanager").controller("ListagentaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.listCustomFields=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.cmList.getCustomFields(m.query,u).$promise}function g(e){d.cmCustomField.delete({id:e.id}).$promise.then(function(){_.remove(m.listCustomFields.rows,{id:e.id}),m.listCustomFields.count-=1,m.listCustomFields.rows.length||p(),l.success({title:"CustomField deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcmList"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.list={},m.listCustomFields={count:0,rows:[]},m.selectedListCustomFields=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,alias,type,values,required,clickToAction,actionType",limit:10,page:1},m.arraytype=_.keyBy([{option:"Text",value:"'text'"},{option:"Select",value:"'select'"},{option:"Number",value:"'number'"},{option:"Switch",value:"'switch'"},{option:"Datetime",value:"'datetime'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.arrayactionType=_.keyBy([{option:"Voice",value:"'voice'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.list=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ListId=m.list.id,m.query.id=m.list.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the customField?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("customField #")+e.id||"customField")+"</b> will be deleted.").ariaLabel("delete customField").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getListCustomFields=p,m.createOrEditListCustomField=function(e,n){o.show({controller:"CreateOrEditCustomFieldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:m.list,customField:n,customFields:m.listCustomFields.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedListCustomFields=function(){var e=angular.copy(m.selectedListCustomFields);return m.selectedListCustomFields=[],e},m.deleteListCustomField=g,m.deleteSelectedListCustomFields=function(e){var n=o.confirm().title("Are you sure want to delete the selected customFields?").htmlContent("<b>"+m.selectedListCustomFields.length+" selected</b> will be deleted.").ariaLabel("delete customFields").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedListCustomFields.forEach(function(e){g(e)}),m.selectedListCustomFields=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.contactmanager").controller("ListCustomFieldsController",e)}(),function(){"use strict";function e(a,e,n,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){t.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="CONTACTMANAGER.EDIT_CUSTOMFIELD",g.sortable={animation:800,sort:!0,onSort:function(e){a.customFieldForm.$pristine=!1}},g.customField=l,g.customFields=r,g.newCustomField=!1,g.customField||(g.customField={type:"text",actionType:"voice"},g.title="CONTACTMANAGER.NEW_CUSTOMFIELD",g.newCustomField=!0),e.params.id&&(g.customField.ListId=e.params.id),a.$watch("vm.customField.type",function(e,n){if(e!==n)switch(e){case"text":g.customField.values="";break;case"select":g.customField.values=[]}}),g.addNewCustomField=function(){g.errors=[],d.cmList.addCustomField({id:e.params.id},g.customField).$promise.then(function(e){g.customFields.unshift(e.toJSON()),o.success({title:"CustomField properly created",msg:g.customField.name?g.customField.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomField=function(){g.errors=[],d.cmCustomField.update({id:g.customField.id},g.customField).$promise.then(function(e){var n=_.find(g.customFields,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CustomField properly saved!",msg:g.customField.name?g.customField.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomField=function(e){g.errors=[];var n=t.confirm().title("Are you sure?").content("The customField will be deleted.").ariaLabel("Delete CustomField").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){d.cmCustomField.delete({id:g.customField.id}).$promise.then(function(){_.remove(g.customFields,{id:g.customField.id}),o.success({title:"CustomField properly deleted!",msg:(g.customField.name||"customField")+" has been deleted!"}),v(g.customField)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmCustomField.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmCustomField.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.addItem=function(e){e.push({value:"New Item"}),a.customFieldForm.$pristine=!1},g.removeItem=function(e,n){e.splice(n,1),a.customFieldForm.$pristine=!1},g.removeItems=function(e){for(var n=e.length,t=0;t<n;t++)e.splice(0,1);a.customFieldForm.$pristine=!1},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customFields","customField","api","Auth","license","setting","crudPermissions"],angular.module("app.contactmanager").controller("CreateOrEditCustomFieldDialogController",e)}(),function(){"use strict";function e(a,e,t,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.list=c||a.params.list||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=a.params.tab||0,u.gotogoto=function(t,e){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{ListId:t.id}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{ListId:t.id})}},u.agentadddialog=function(e,n){t.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{list:e,lists:u.lists?u.lists.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoLists=function(){a.go("app.contactmanager.lists",{},{reload:"app.contactmanager.lists"})},u.saveList=function(){r.cmList.update({id:u.list.id},u.list).$promise.then(function(){l.success({title:"List updated!",msg:u.list.name?u.list.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","list","userProfileSection"],angular.module("app.contactmanager").controller("ListController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.cmList.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.list=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.ListId=m.list.id,m.query.id=m.list.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.list.id,field:"ListId",route:"cmList"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.contactmanager").controller("ListDispositionsController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.lists=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="lists",f.listOrder="",f.listOrderAsc=null,f.selectedLists=[],f.query={fields:"createdAt,updatedAt,id,name,description,dialPrefix",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){a.go("app.contactmanager.lists.edit",{id:e.id,list:e,crudPermissions:f.crudPermissions})},f.gotocontactsgoto=function(t,e){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:303}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?a.go("app.contactmanager.contacts",{ListId:t.id}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});a.go("app.contactmanager.contacts",{ListId:t.id})}},f.exportcsvcontactsexport=function(i,e){return m.cmList.getContactsCsv({id:i.id,nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","exportContacts_"+i.id+".csv"),a.click()}else p.info({title:"EXPORT",msg:"The list is empty"})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcmList",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.agentadddialog=function(e,n){i.show({controller:"ListagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{list:e,lists:f.lists?f.lists.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("list")+"?").htmlContent("<b>"+(e.name||"list")+"</b> will be deleted.").ariaLabel("delete list").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getLists=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cmList.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Lists",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditList=function(e,n){i.show({controller:"CreateOrEditListDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/lists/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{list:n,lists:f.lists.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteList=y,f.exportSelectedLists=function(){var e=angular.copy(f.selectedLists);return f.selectedLists=[],e},f.deleteSelectedLists=function(e){var n=i.confirm().title("Are you sure want to delete the selected lists?").htmlContent("<b>"+f.selectedLists.length+" selected</b> will be deleted.").ariaLabel("delete Lists").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedLists.forEach(function(e){y(e)}),f.selectedLists=[]})},f.deselectLists=function(){f.selectedLists=[]},f.selectAllLists=function(){f.selectedLists=f.lists.rows};var b=!0,A=1;function E(e){f.lists=e||{count:0,rows:[]}}function y(e){m.cmList.delete({id:e.id}).$promise.then(function(){_.remove(f.lists.rows,{id:e.id}),f.lists.count-=1,f.lists.rows.length||f.getLists(),p.success({title:_.startCase("List")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcmList"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcmList",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getLists())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","lists","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.contactmanager").controller("ListsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;function b(){return a.smsAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.smsAccounts=e,a.smsInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].SmsAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.smsAccounts.rows,{id:e.rows[t].SmsAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.smsAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.smsAccounts=n})})}function A(){return a.faxAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.faxAccounts=e,a.faxInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].FaxAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.faxAccounts.rows,{id:e.rows[t].FaxAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.faxAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.faxAccounts=n})})}function E(){return a.openchannelAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.openchannelAccounts=e,a.openchannelInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].OpenchannelAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.openchannelAccounts.rows,{id:e.rows[t].OpenchannelAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.openchannelAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.openchannelAccounts=n})})}function y(){return a.whatsappAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.whatsappAccounts=e,a.whatsappInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].WhatsappAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.whatsappAccounts.rows,{id:e.rows[t].WhatsappAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.whatsappAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.whatsappAccounts=n})})}function S(){return a.chatWebsite.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.chatWebsites=e,a.chatInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].ChatWebsiteId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.abandoned+=e.rows[t].abandoned,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.chatWebsites.rows,{id:e.rows[t].ChatWebsiteId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","abandoned","unmanaged"]));return f.chatWebsites}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.chatWebsites=n})})}function T(){return a.mailAccount.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){return f.mailAccounts=e,a.mailInteraction.get({createdAt:{$gte:moment().startOf("day").utcOffset(0,!0).format(),$lte:moment().endOf("day").utcOffset(0,!0).format()},nolimit:!0}).$promise}).then(function(e){var n;if(e&&0<e.count)for(var t=0;t<e.rows.length;t+=1)n&&n.id===e.rows[t].MailAccountId?(n.total+=e.rows[t].total,n.waiting+=e.rows[t].waiting,n.talking+=e.rows[t].talking,n.answered+=e.rows[t].answered,n.unmanaged+=e.rows[t].unmanaged):(n=_.find(f.mailAccounts.rows,{id:e.rows[t].MailAccountId}))&&_.merge(n,_.pick(e.rows[t],["waiting","total","talking","answered","unmanaged"]));return f.mailAccounts}).then(function(n){f.customDashboard.widgets.forEach(function(e){e.mailAccounts=n})})}function I(){for(var e=0;e<f.customDashboard.widgets.length;e+=1)f.customDashboard.widgets[e].voiceQueuesSelected=f.voiceQueuesSelected,f.customDashboard.widgets[e].chatWebsitesSelected=f.chatWebsitesSelected,f.customDashboard.widgets[e].smsAccountsSelected=f.smsAccountsSelected,f.customDashboard.widgets[e].faxAccountsSelected=f.faxAccountsSelected,f.customDashboard.widgets[e].mailAccountsSelected=f.mailAccountsSelected,f.customDashboard.widgets[e].openchannelAccountsSelected=f.openchannelAccountsSelected,f.customDashboard.widgets[e].whatsappAccountsSelected=f.whatsappAccountsSelected}f.currentUser=s.getCurrentUser(),f.userProfile=v,f.userProfileSection=h&&1===h.count?h.rows[0]:null,f.crudPermissions=s.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.customDashboard={},f.voiceQueues=l&&l.count?l:{count:0,rows:[]},f.voiceQueuesSelected=l&&l.count?_.map(l.rows,"id"):[],f.faxAccounts=d&&d.count?d:{count:0,rows:[]},f.faxAccountsSelected=d&&d.count?_.map(d.rows,"id"):[],f.chatWebsites=c&&c.count?c:{count:0,rows:[]},f.chatWebsitesSelected=c&&c.count?_.map(c.rows,"id"):[],f.smsAccounts=m&&m.count?m:{count:0,rows:[]},f.smsAccountsSelected=m&&m.count?_.map(m.rows,"id"):[],f.mailAccounts=u&&u.count?u:{count:0,rows:[]},f.mailAccountsSelected=u&&u.count?_.map(u.rows,"id"):[],f.openchannelAccounts=p&&p.count?p:{count:0,rows:[]},f.openchannelAccountsSelected=p&&p.count?_.map(p.rows,"id"):[],f.whatsappAccounts=g&&g.count?g:{count:0,rows:[]},f.whatsappAccountsSelected=g&&g.count?_.map(g.rows,"id"):[],f.interval=n(function(){},1e3),f.goToEdit=function(){e.go("app.tools.customDashboards.edit",{customDashboard:f.customDashboard,id:f.customDashboard.id,tab:1})},f.setFilter=function(e){o.show({controller:"FilterDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/custom/filter/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{vm_parent:f}}).then(function(e){f=e,I()})},f.updateWidget=I,i.onWithoutApply("voice_queue:save",function(e){var n=_.find(f.voiceQueues.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.onWithoutApply("sms_account:save",function(e){var n=_.find(f.smsAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("smsInteraction:update",b),i.on("smsInteraction:save",b),i.onWithoutApply("fax_account:save",function(e){var n=_.find(f.faxAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("faxInteraction:update",A),i.on("faxInteraction:save",A),i.onWithoutApply("mail_account:save",function(e){var n=_.find(f.mailAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("mailInteraction:update",T),i.on("mailInteraction:save",T),i.onWithoutApply("openchannel_account:save",function(e){var n=_.find(f.openchannelAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("openchannelInteraction:update",E),i.on("openchannelInteraction:save",E),i.onWithoutApply("whatsapp_account:save",function(e){var n=_.find(f.whatsappAccounts.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("whatsappInteraction:update",y),i.on("whatsappInteraction:save",y),i.onWithoutApply("chat_website:save",function(e){var n=_.find(f.chatWebsites.rows,{id:e.id});n&&_.merge(n,_.pick(e,_.keys(n)))}),i.on("chatInteraction:update",S),i.on("chatInteraction:save",S),a.dashboard.get({id:e.params.id}).$promise.then(function(e){if(e)return f.customDashboard=e,f.customDashboard.widgets=[],f.customDashboard.preview=!0,f.customDashboard.draggable={enabled:!1},f.customDashboard.resizable={enabled:!1},a.dashboard.getItems({id:f.customDashboard.id}).$promise}).then(function(e){if(e&&e.count&&e.rows)for(var n=0;n<e.rows.length;n+=1)e.rows[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[n].type+"/ms-widget-engine."+e.rows[n].type+".html",e.rows[n].voiceQueues=f.voiceQueues,e.rows[n].voiceQueuesSelected=f.voiceQueuesSelected,e.rows[n].faxAccounts=f.faxAccounts,e.rows[n].faxAccountsSelected=f.faxAccountsSelected,e.rows[n].mailAccounts=f.mailAccounts,e.rows[n].mailAccountsSelected=f.mailAccountsSelected,e.rows[n].smsAccounts=f.smsAccounts,e.rows[n].smsAccountsSelected=f.smsAccountsSelected,e.rows[n].chatWebsites=f.chatWebsites,e.rows[n].chatWebsitesSelected=f.chatWebsitesSelected,e.rows[n].openchannelAccounts=f.openchannelAccounts,e.rows[n].openchannelAccountsSelected=f.openchannelAccountsSelected,e.rows[n].whatsappAccounts=f.whatsappAccounts,e.rows[n].whatsappAccountsSelected=f.whatsappAccountsSelected,f.customDashboard.widgets.push(e.rows[n])}).catch(function(){f.customDashboard=void 0}),t.$on("$destroy",function(){i.removeAllListeners("voice_queue:save"),i.removeAllListeners("sms_account:save"),i.removeAllListeners("fax_account:save"),i.removeAllListeners("mail_account:save"),i.removeAllListeners("openchannel_account:save"),i.removeAllListeners("whatsapp_account:save"),i.removeAllListeners("chat_website:save"),i.removeAllListeners("chatInteraction:save"),i.removeAllListeners("chatInteraction:update"),i.removeAllListeners("smsInteraction:save"),i.removeAllListeners("smsInteraction:update"),i.removeAllListeners("openchannelInteraction:save"),i.removeAllListeners("openchannelInteraction:update"),i.removeAllListeners("mailInteraction:save"),i.removeAllListeners("mailInteraction:update"),i.removeAllListeners("faxInteraction:save"),i.removeAllListeners("faxInteraction:update"),i.removeAllListeners("whatsappInteraction:save"),i.removeAllListeners("whatsappInteraction:update"),f.interval&&n.cancel(f.interval)})}e.$inject=["$state","$interval","$scope","api","socket","Auth","$mdDialog","$document","voiceQueues","faxAccounts","chatWebsites","smsAccounts","mailAccounts","openchannelAccounts","whatsappAccounts","userProfile","userProfileSection"],angular.module("app.dashboards.custom").controller("DashboardCustomController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){a.hide(c.parent)}c.title="DASHBOARDS.SETFILTERS",c.currentUser=l.getCurrentUser(),c.parent=d,c.onChangeFilter=function(e){for(var n=0;n<c.parent.customDashboard.widgets.length;n+=1)switch(e){case"voice":c.parent.customDashboard.widgets[n].voiceQueuesSelected=c.parent.voiceQueuesSelected;break;case"sms":c.parent.customDashboard.widgets[n].smsAccountsSelected=c.parent.smsAccountsSelected;break;case"chat":c.parent.customDashboard.widgets[n].chatAccountsSelected=c.parent.chatAccountsSelected;break;case"fax":c.parent.customDashboard.widgets[n].faxAccountsSelected=c.parent.faxAccountsSelected;break;case"mail":c.parent.customDashboard.widgets[n].mailAccountsSelected=c.parent.mailAccountsSelected;break;case"openchannel":c.parent.customDashboard.widgets[n].openchannelAccountsSelected=c.parent.openchannelAccountsSelected;break;case"whatsapp":c.parent.customDashboard.widgets[n].whatsappAccountsSelected=c.parent.whatsappAccountsSelected}},c.confirm=function(){m()},c.closeDialog=m}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","api","Auth","vm_parent"],angular.module("app.tools").controller("FilterDialogController",e)}(),function(){"use strict";function e(e,s,i,c,o,r,m,n,l,t,u,a,d,p,g,v,h,f,b,A,E){var y=this;y.license=v,y.setting=h,y.detectBrowser=b.detectBrowser(),y.user=n.getCurrentUser(),y.currentTab=0,y.notifications={},y.tabs={},y.agentCapacity={},y.autoClose=!1,y.acceptedNotifications=[],y.autoanswerTimeout,y.globalUserLists=a||{count:0,rows:[]},y.globalLists=d||{count:0,rows:[]},y.globalCompanies=p||{count:0,rows:[]},y.globalTags=g||{count:0,rows:[]};var S=E.getLogger("dashboard","agent.general.contact");function T(e){var n={};for(var t in y.tabs)y.tabs.hasOwnProperty(t)&&(n[t]=_.pick(y.tabs[t],["type","title","channel","icon","color","autoCreate","id","saved","badges","openedAt"]),_.isNil(y.tabs[t].contact)||(n[t].contact=_.pick(y.tabs[t].contact,["id","ListId"])),_.isNil(y.tabs[t].calls)||(n[t].calls=y.tabs[t].calls),y.tabs[t].interaction&&(n[t].interaction=_.pick(y.tabs[t].interaction,["id","OpenchannelAccountId","MailAccountId","ChatWebsiteId","FaxAccountId","SmsAccountId","WhatsappAccountId","closed","draft"])));var a=JSON.parse(i.localStorage.getItem("motion2.user:"+y.user.id));a?(a.tabs=n,a.currentTab=y.currentTab,a.autoClose=y.autoClose):a={tabs:n,currentTab:y.currentTab,autoClose:y.autoClose},i.localStorage.setItem("motion2.user:"+y.user.id,JSON.stringify(a)),e&&I(e)}function I(e){if(_.isNil(e)||e&&"interaction"===e.type){var n={id:y.user.id,online:!0,capacity:{mail:0,fax:0,sms:0,whatsapp:0,openchannel:0,chat:0},interaction:{mail:[],fax:[],sms:[],whatsapp:[],openchannel:[],chat:[]}};for(var t in y.tabs)y.tabs.hasOwnProperty(t)&&n.capacity.hasOwnProperty(y.tabs[t].channel)&&y.tabs[t].interaction&&!y.tabs[t].interaction.closed&&(n.capacity[y.tabs[t].channel]+=1,n.interaction[y.tabs[t].channel].push(y.tabs[t].interaction.id));if(!_.isEqual(y.agentCapacity,n.capacity))return y.agentCapacity=n.capacity,l.rpc.setAgentCapacity(n)}}function O(e){y.tabs[e.id]&&(!function(e){if(e.channel&&e.interaction)l.user["remove"+_.upperFirst(e.channel)+"Interactions"]({id:y.user.id,ids:[e.interaction.id]}).$promise.catch(function(e){S.error(e)})}(y.tabs[e.id]),delete y.tabs[e.id],y.currentTab=0,T(e))}function C(e){Object.keys(y.tabs).length!==y.setting.limitTabs?(e.id=_.random(1e10),e.openedAt=(new Date).toISOString(),e.saved=!1,e.badges=0,y.tabs[e.id]=e,y.currentTab=e.id,T(e)):u.warning({title:"",msg:c.instant("DASHBOARD.LIMIT_TABS_REACHED")})}function w(n){return _.find(y.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id==n.interactionId&&e.channel==n.channel})}function R(n,t){var e,a,i={type:"contact",title:n?(e=n,a="",e&&(e.firstName||e.lastName?(e.firstName&&(a+=e.firstName+" "),e.lastName&&(a+=e.lastName)):e.phone&&(a=e.phone)),a=y.user.privacyEnabled?A.mask(a):a):c.instant("DASHBOARDS.NEW_CONTACT"),icon:"icon-account-circle",color:"red",contact:n,calls:t?[t]:[],autoCreate:t?t.autoCreate:0};if(t&&(t.answertime||(t.answertime=t.agentconnectAt),(t.agentcompleteAt||t.endtime)&&U(t)),n){var s=_.find(y.tabs,function(e){return e.contact&&e.contact.id?"contact"===e.type&&e.contact&&e.contact.id==n.id:"contact"===e.type&&e.contact&&e.contact.phone==n.phone});if(s){if(t)return l.voiceCallReport.get({uniqueid:t.uniqueid}).$promise.then(function(e){(e&&0<e.rows.length&&(t.disposedAt=_.first(e.rows).endtime),s.calls)?_.find(s.calls,function(e){return e.uniqueid===t.uniqueid})||s.calls.push(t):s.calls=[t];y.currentTab=s.id})}else{if(n.ListId)return l.disposition.get({ListId:n.ListId,nolimit:!0}).$promise.then(function(e){return i.dispositions=e,l.cmList.getCustomFields({id:n.ListId,nolimit:!0}).$promise}).then(function(e){i.customFields=e}).catch(F()).finally(function(){C(i)});C(i)}}else C(i)}function x(n,t){var e=_.find(y.tabs,function(e){return"interaction"===e.type&&e.interaction&&e.interaction.id===t.id&&e.channel===n});e?(e.isDraft=t.isDraft||!1,y.currentTab=e.id):C(e={type:"interaction",title:n?n.toUpperCase():"openchannel",icon:function(e){switch(e){case"chat":return"icon-hangouts";case"mail":return"icon-email";case"sms":return"icon-message-text";case"openchannel":return"icon-google-earth";case"fax":return"icon-deskphone";case"whatsapp":return"icon-whatsapp";default:return"icon-hangouts"}}(n),color:function(e){switch(e){case"chat":return"green-A700";case"mail":return"teal";case"sms":return"orange";case"openchannel":return"amber-A200";case"fax":return"blue-grey-A200";case"whatsapp":return"lime-A700";default:return"grey"}}(n),channel:n,interaction:t,isDraft:t.isDraft||!1})}function N(e){var n=0;switch(e){case"chat":n=105;break;case"mail":n=106;break;case"sms":n=107;break;case"openchannel":n=108;break;case"fax":n=109;break;case"whatsapp":n=114}return 0<n&&_.includes(y.user.permissions,n)}function D(t){f.isSupported()?f.requestPermission().then(function(){var e,n;n={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"../../../../../../../assets/images/avatars/customer.png",body:(e=t).queue?"Queue: "+e.queue:"",focusOnclick:!0,closeOnClick:!0},f.show(e.title,n)},function(e){S.error("Please enable browser notifications!",e)}):S.error("Browser notifications are not supported by the browser. Normal notifications will be used.")}function P(n){u.wait({title:n.title,msg:n.msg||"",showClose:!1,clickToClose:!1,timeout:!1,sound:n.sound,html:!0,shake:n.shake||!1,onAdd:function(){y.notifications[n.uniqueid]=this.id},onAccept:function(){if(L(n),l[n.channel+"Message"])return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),y.autoanswerTimeout=null,x(e.channel,e.interaction),u.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(F())},onReject:function(){if(L(n),_.isNil(y.autoanswerTimeout)||(r.cancel(y.autoanswerTimeout),y.autoanswerTimeout=null),l[n.channel+"Message"])return l[n.channel+"Message"].reject({id:n.id,UserId:y.user.id}).$promise.then(function(){u.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(F())}})}function L(e){e&&e.uniqueid&&y.notifications[e.uniqueid]&&(u.clear(y.notifications[e.uniqueid]),delete y.notifications[e.uniqueid])}function k(n){var t=n.uniqueid;for(var e in S.debug("onVoiceChannelRemove -> evt",n),y.tabs)if(y.tabs.hasOwnProperty(e)){var a=y.tabs[e];if(a.calls){S.debug("onVoiceChannelRemove ->  key, tab, tab.calls",e,a,a.calls);var i=_.findIndex(a.calls,function(e){return e.uniqueid===t});i<0&&0<=(i=_.findIndex(a.calls,function(e){return e.uniqueid===n.linkedid}))&&(t=n.linkedid),0<=i&&!a.calls[i].disposedAt?(S.debug("Allowing disposition for call %s",a.calls[i].uniqueid),U(a.calls[i])):S.debug("Call %s not found or already completed",a.calls[i].uniqueid),a.contact&&a.contact.id&&r(M(t,a.contact.id,a),1e3)}}T()}function M(n,e,t){return function(){if(_.find(t.calls,function(e){return e.uniqueid===n}))return l.voiceCallReport.update({id:n,ContactId:e}).$promise.catch(function(e){S.error(e)})}}function U(e){e.disposedAt=new Date}function F(){return function(e){if(404===e.status)u.warning({title:c.instant("DASHBOARDS.ATTENTION"),msg:c.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){y.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)u.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else u.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}function $(e){l.cmHopper.update({id:e,recallmeNotifiedDate:null}).$promise.then(function(e){S.debug(e)}).catch(function(e){S.error(e)}).finally(function(){q(e)})}function q(e){y.toasty.clear(y.notifications[e])}y.onClickTab=function(e){y.currentTab=e,T(y.tabs[e])},y.isActiveTab=function(e){return e===y.currentTab},y.alreadyExistsTab=w,y.addContactTab=R,y.addInteractionTab=x,y.addTab=C,y.removeTab=O,y.updateLocalStorage=T,y.closeTab=function(e){var n=!1,t=s.confirm().title("interaction"===e.type?"Do you want to close the interaction?":"Are you sure want to close the "+e.type+"?").textContent("interaction"===e.type?"":"The "+e.type+" has been modified. Closing will lose all changes!").ariaLabel("Close Contact").ok("interaction"===e.type?"YES":"OK").cancel("interaction"===e.type?"NO":"CANCEL");{if(!e.saved){var a=y.user.voicePause||y.user.chatPause||y.user.mailPause||y.user.openchannelPause||y.user.faxPause;return"interaction"===e.type&&(n=e.interaction.Account.mandatoryDisposition),s.show(t).then(function(){"interaction"===e.type&&s.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(o.body),onRemoving:function(){y.user&&n&&!a&&l.user.unpause({id:y.user.id}).$promise.catch(function(e){S.error(e)})},clickOutsideToClose:!n,escapeToClose:!n,locals:{user:y.user,channel:e.channel,interaction:e.interaction}}),O(e)}).catch(function(){"interaction"===e.type&&O(e)})}if(_.forEach(e.calls,function(e){e.mandatoryDisposition&&(n=!0)}),"contact"===e.type&&0<e.calls.length){if(!n)return t._options.textContent="There is a call that hasn't been disposed yet.",s.show(t).then(function(){O(e)});var i=s.alert().title("Warning").textContent("There is a call that hasn't been disposed yet.").ok("OK");s.show(i).finally(function(){i=void 0})}else O(e)}},y.dialPreviewRecallReminder=function(e){var n,t,a,i,s;if(e&&e.hopper){if(i=m("formatdate")(e.hopper.scheduledat),s=e.hopper,e.hopper.Contact&&(n=e.hopper.Contact),e.hopper.List&&(t=e.hopper.List),e.hopper.id&&(a=e.hopper.id),a&&n&&t&&n.firstName){var o=n.firstName;n.lastName&&(o=o+" "+n.lastName);var r=s.phone||n.phone;y.user.privacyEnabled&&(o=A.mask(o),r=A.mask(r));var l=c.instant("DASHBOARDS.RECALLME_CALL_REMINDER"),d="<div>          <span>"+c.instant("DASHBOARDS.UPCOMING_RECALLME_CALL")+"</span><br>          <span>"+c.instant("DASHBOARDS.CONTACT_NAME")+": "+o+"</span><br>          <span>"+c.instant("DASHBOARDS.CONTACT_PHONE")+": "+r+"</span><br>          <span>"+c.instant("DASHBOARDS.SCHEDULED_TIME")+": "+i+"</span><br>          <span>"+c.instant("DASHBOARDS.LIST_NAME")+": "+t.name+"</span><br>          </div>";S.debug(e),u.info({title:l,msg:d,showClose:!0,clickToClose:!0,timeout:6e4,html:!0,onAdd:function(){y.notifications[a]=this.id},onAccept:function(){delete y.notifications[a],y.openContactTab(a)},onReject:function(){delete y.notifications[a],$(a)},onRemove:function(){setTimeout(function(){y.notifications[a]&&(delete y.notifications[a],$(a))},1e3)}})}}else S.warn("Response does not contain hopper",e)},y.openContactTab=function(e){y.openPreviewDialog(e),q(e)},y.openPreviewDialog=function(e){l.cmHopper.getPreviewRecall({id:e}).$promise.then(function(e){var n=angular.element("#toolbar").scope();n&&n.vm.openPreviewDialog(e,!0)})},y.toasty=u,function(){var e=i.localStorage.getItem("motion2.user:"+y.user.id);if(e)try{e=JSON.parse(e),y.tabs=e.tabs?e.tabs:{},y.currentTab=e.currentTab?e.currentTab:0,y.autoClose=!!e.autoClose&&e.autoClose,I(y.tabs[y.currentTab]),S.debug("Tabs initiated correctly")}catch(e){S.error(e)}}(),e.$on("$destroy",function(){for(var e in y.notifications)y.notifications.hasOwnProperty(e)&&L({uniqueid:e});t.removeAllListeners("trigger:contactmanager"),t.removeAllListeners("trigger:jscripty"),t.removeAllListeners("trigger:browser:url"),t.removeAllListeners("trigger:browser:popup"),t.removeAllListeners("notification:save"),t.removeAllListeners("notification:remove"),t.removeAllListeners("voice_queue_channel:remove"),t.removeAllListeners("voice_outbound_channel:remove")}),t.on("trigger:contactmanager",function(n){_.isNil(n.contacts)||1!==n.contacts.length?s.show({controller:"ContactSelectionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/selection/dialog.html",parent:angular.element(o.body),locals:{contacts:n.contacts,callNumber:n.evt.routeId?n.evt.destcalleridnum:n.evt.calleridnum}}).then(function(e){R(e,n.evt)}):R(n.contact,n.evt)}),t.on("trigger:jscripty",function(t){return l.jscriptyProject.get({id:t.ProjectId}).$promise.then(function(n){if(n){if(!_.isUndefined(t["xmd-contactid"]))return l.cmContact.get({id:t["xmd-contactid"]}).$promise.then(function(e){try{n.formData=Mustache.render(n.formData,_.merge(t,{user:y.user,contact:e}))}catch(e){S.error(e)}C({type:"jscripty",title:n.name,icon:"icon-script",color:"grey",project:n,call:t,contact:e})}).catch(F());try{n.formData=Mustache.render(n.formData,_.merge(t,{user:y.user}))}catch(e){S.error(e)}C({type:"jscripty",title:n.name,icon:"icon-script",color:"grey",project:n,call:t})}}).catch(F())}),t.on("trigger:bot",function(n){var t=n.calleridname&&"<unknown>"!==n.calleridname?n.calleridname:n.calleridnum,a=n.calleridnum;return l.squareMessage.get({fields:"id",limit:1,offset:0,uniqueid:n.uniqueid}).$promise.then(function(e){e.count&&C({type:"bot",title:t+" <"+a+">",icon:"fas fa-robot",color:"pink",data:{uniqueid:n.uniqueid}})})}),t.on("trigger:browser:url",function(e){if(e&&e.uri)if(e.uri=_.replace(e.uri,"&lt%3B",""),e.uri=_.replace(e.uri,"=&gt%3B=",""),e.uriLocation)switch(e.uriLocation){case"0":i.open(e.uri);break;case"1":i.open(e.uri,"_blank","width="+(e.windowWidth||"800")+",height="+e.windowHeight||"600");break;case"2":C({type:"iframe",title:e.uri,icon:"icon-google-earth",color:"blue",src:e.uri});break;default:i.open(e.uri)}else i.open(e.uri)}),t.on("trigger:browser:popup",function(e){e&&e.html&&C({type:"popup",title:e.calleridnum||"popup",icon:"icon-tablet",color:"grey",html:e.html})}),t.on("notification:save",function(n){if(N(n.channel)&&n&&n.uniqueid){D(n);var e=w(n);if(e){if(l[n.channel+"Message"])return y.currentTab!==e.id&&(e.badges+=1),y.acceptedNotifications.push(n.id),l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id}).$promise.catch(F())}else{var t="mail"==n.channel?"email":n.channel,a=y.user[t+"AutoanswerDelay"]?1e3*y.user[t+"AutoanswerDelay"]:0;if(y.user[t+"Autoanswer"]&&y.license[n.channel]&&N(n.channel)){if(0<a)P(n),y.autoanswerTimeout=r(function(){if(l[n.channel+"Message"]&&!_.includes(y.acceptedNotifications,n.id))return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),x(e.channel,e.interaction),L(n)}).catch(F())},y.user[t+"AutoanswerDelay"]?1e3*y.user[t+"AutoanswerDelay"]:0);else if(l[n.channel+"Message"])return l[n.channel+"Message"].accept({id:n.id,UserId:y.user.id,manual:!0}).$promise.then(function(e){y.acceptedNotifications.push(n.id),x(e.channel,e.interaction)}).catch(F())}else P(n)}}}),t.on("notification:remove",L),t.on("voice_queue_channel:remove",k),t.on("voice_outbound_channel:remove",k),t.on("user:dialPreviewRecallReminder",y.dialPreviewRecallReminder)}e.$inject=["$scope","$mdDialog","$window","$translate","$document","$timeout","$filter","Auth","api","socket","toasty","globalUserLists","globalLists","globalCompanies","globalTags","license","setting","desktopNotification","msUtils","privacyManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentDashboardGeneralController",e)}(),function(){"use strict";angular.module("app.dashboards").provider("desktopNotification",function(){var f={autoClose:!0,duration:5,showOnPageHidden:!1};return{config:function(e){for(var n in e)f.hasOwnProperty(n)&&null!=e[n]&&(f[n]=e[n])},$get:["$q","$timeout","$window","PERMISSIONS",function(e,u,n,p){var g=n.Notification||n.mozNotification||n.webkitNotification;return{isSupported:v,currentPermission:h,requestPermission:function(){if(!v())return e.reject("Notification API not supported");var t=e.defer();Promise.resolve(g.requestPermission)==g.requestPermission?g.requestPermission().then(function(e){p.GRANTED===e?t.resolve(e):t.reject(e)}):g.requestPermission(function(e,n){p.GRANTED===e?t.resolve(e):t.reject(e)});return t.promise},show:function(e,n){if(n=n||{},!v()||(t=e,a=n,i=angular.isString(t),s=!a.onClick||angular.isFunction(a.onClick),!i||!s)||function(e){if(e||f.showOnPageHidden)return!(window.document.hidden||window.document.mozHidden||window.document.webkitHidden)}(n.showOnPageHidden)||h()!==p.GRANTED)return;var t,a,i,s;var o=new g(e,n),r=n.duration||f.duration,l=void 0===n.autoClose?f.autoClose:n.autoClose;o.onclick=function(){n.onClick&&n.onClick(),n.focusOnclick&&window.focus(),n.closeOnClick&&o.close()},l&&(d=o,c=r,m=1e3*c,u(d.close.bind(d),m,!1));var d,c,m;return o},permissions:{default:p.DEFAULT,granted:p.GRANTED,denied:p.DENIED}};function v(){return!(void 0===g)}function h(){return(g||{}).permission}}]}}).provider("msNavigationAgentService",function(){var r=angular.injector(["ng"]).get("$log"),l=[];function n(e,n){if(angular.isString(e)){for(var t=e.split("."),a=t[t.length-1],i=function(e){var n=l;if(1===e.length)return n;e.pop();for(var t=0;t<e.length;t++){for(var a=e[t],i=!0,s=0;s<n.length;s++)if(n[s]._id===a){n=n[s].children,i=!1;break}if(i){var o={_id:a,_path:e.join("."),title:a,weight:1,children:[]};n.push(o),n=o.children}}return n}(t),s=!1,o=0;o<i.length;o++)if(i[o]._id===a){s=i[o];break}s?(angular.extend(s,n),s.uisref=d(s)):(n.children=[],!angular.isUndefined(n.weight)&&angular.isNumber(n.weight)||(n.weight=1),n._id=a,n._path=e,n.uisref=d(n),i.push(n))}else r.error("path must be a string (eg. `dashboard.project`)")}function d(e){var n="";return angular.isDefined(e.state)&&(n=e.state,angular.isDefined(e.stateParams)&&angular.isObject(e.stateParams)&&(n=n+"("+angular.toJson(e.stateParams)+")")),n}this.saveItem=n,this.deleteItem=function(e){if(!angular.isString(e))return void r.error("path must be a string (eg. `dashboard.project`)");for(var n=l,t=e.split("."),a=0;a<t.length;a++)for(var i=t[a],s=0;s<n.length;s++)if(n[s]._id===i){if(n[s]._path===e)return n.splice(s,1),!0;n=n[s].children;break}return!1},this.$get=function(){var e={saveItem:n,getNavigation:function(e){if(e){for(var n=0;n<l.length;n++)if(l[n]._id===e)return[l[n]];return null}return l}};return e}}).constant("PERMISSIONS",{DEFAULT:"default",GRANTED:"granted",DENIED:"denied"})}(),function(){"use strict";function e(t){var a=this;a.setting={},a.messages={count:0,rows:[]},a.showInteraction=!1,a.init=function(e,n){{if(a.setting=n,a.tab=e,a.tab.saved=!0,a.tab&&a.tab.data&&a.tab.data.uniqueid)return t.squareMessage.get({uniqueid:a.tab.data.uniqueid}).$promise.then(function(e){a.messages=e}).finally(function(){a.showInteraction=!0});a.showInteraction=!0}},a.getMessagesAlignment=function(e){switch(a.setting.messagesAlignment){case"left":return"in"==e.direction?e.direction:"out-left-aligned";case"right":return"in"==e.direction?"in-right-aligned":e.direction;default:return e.direction}}}e.$inject=["api"],angular.module("app.dashboards").controller("AgentGeneralBotController",e)}(),function(){"use strict";function e(a,d,c,t,m,i,u,p,s,o,e,r,l,n){var g=this;g.user=s.getCurrentUser(),g.detectBrowser=e.detectBrowser(),g.additionalItemTypes=[],g.additionalItems=[],g.contactItemTypes=[],g.newPhone=function(e){return{phone:e,color:"gray"}},g.journey=[],g.queryHopper={fields:"id,phone,scheduledat",sort:"-updatedAt",limit:10,page:1},g.queryFinal={fields:"uniqueid,calleridnum,statedesc,starttime,disposition,secondDisposition,thirdDisposition",sort:"-updatedAt",limit:10,page:1},g.queryHistory={fields:"uniqueid,calleridnum,statedesc,scheduledat,starttime,endtime",sort:"-updatedAt",limit:10,page:1},g.hoppers={rows:[],count:0},g.finals={rows:[],count:0},g.histories={rows:[],count:0},g.journeyOptions=r.getQuery(),g.quickFilters=r.getQuickFilters(),g.addNewContact=f,g.saveContact=function(){g.errors=[],u.cmContact.update({id:g.contact.id},g.contact).$promise.then(function(e){var n=h(e);return g.tab.title=g.user.privacyEnabled?l.mask(n):n,g.tab.contact=g.contact,m.$parent.vm.updateLocalStorage(),u.user.addContacts({id:s.getCurrentUser().id,ids:[e.id]})}).then(function(){return u.cmContact.setTags({id:g.contact.id,ids:g.tab.Tags}).$promise}).then(function(){return u.cmContact.setAdditionalPhones({id:g.contact.id,items:g.additionalItems,item_types:g.additionalItemTypes}).$promise.then(function(){g.detailForm.$pristine=!0,g.customFieldsForm.$pristine=!0,p.success({title:"Contact properly updated!",msg:g.contact.name?g.contact.name+" has been updated!":""})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.getCustomFields=function(e){return u.cmList.getCustomFields({id:e}).$promise.then(function(e){g.tab.customFields=e}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"LIST:GETCustomFields",msg:e.data?JSON.stringify(e.data):e.toString()})})},g.call=m.$parent.vm.call,g.disposeCall=function(e,i){if(g.newContact)return void p.error({title:"ATTENTION",msg:"Please save the contact before disposing!"});d.show({controller:"DisposeCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",parent:angular.element(c.body),targetEvent:i,clickOutsideToClose:!i.mandatoryDisposition,escapeToClose:!i.mandatoryDisposition,resolve:{globalDispositions:["apiResolver",function(e){return e.resolve("disposition@get",{MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0})}]},onRemoving:function(){g.user&&i.mandatoryDisposition&&u.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{dispositions:g.tab.dispositions,contact:g.contact,call:i,availableCalls:g.tab.calls.length,autoClose:m.$parent.vm.autoClose}}).then(function(e){var n=e[0];for(var t in m.$parent.vm.autoClose=e[1],n&&("BLACKLIST"===n?p.success({title:o.instant("DASHBOARDS.INFO"),msg:o.instant("DASHBOARDS.CALL_DISPOSED")+" "+n}):"RECALLME"===n||"RESCHEDULE"===n||p.success({title:o.instant("DASHBOARDS.INFO"),msg:o.instant("DASHBOARDS.CALL_SAVED")})),m.$parent.$parent.$parent.vm.tabs)if(m.$parent.$parent.$parent.vm.tabs.hasOwnProperty(t)){var a=m.$parent.$parent.$parent.vm.tabs[t];_.remove(a.calls,function(e){return e.uniqueid===i.uniqueid})}0===g.tab.calls.length&&m.$parent.vm.autoClose&&m.$parent.vm.removeTab(g.tab),m.$parent.vm.updateLocalStorage()})},g.checkCallStatus=function(n){return g.checkingCallStatus=!0,u.voiceCallReport.get({uniqueid:n.uniqueid}).$promise.then(function(e){e&&0<e.rows.length&&(n.disposedAt=_.first(e.rows).endtime)}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"VOICE_CALL_REPORT:GET",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){g.checkingCallStatus=!1})},g.duplicateContact=function(e){d.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(c.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:g.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:s.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}})},g.mergeContact=function(e){d.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(c.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:g.contact.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:s.getCurrentUser().id,fields:"id,name"})}]},locals:{contacts:[]}}).then(function(e){if(e){for(var n in m.$parent.$parent.$parent.vm.tabs)if(m.$parent.$parent.$parent.vm.tabs.hasOwnProperty(n)){var t=m.$parent.$parent.$parent.vm.tabs[n];t&&t.contact&&(e.from&&e.from.id&&e.from.id===t.contact.id&&m.$parent.$parent.$parent.vm.removeTab(t),e.to&&e.to.id&&e.to.id===t.contact.id&&m.$parent.$parent.$parent.vm.removeTab(t))}e.new&&m.$parent.$parent.$parent.vm.addContactTab(e.new)}})},g.getDateFromString=S,g.addJscriptyTab=function(e){try{e.formData=Mustache.render(e.formData,{contact:g.contact,user:g.user})}catch(e){v.error(e)}try{m.$parent.$parent.$parent.vm.addTab({type:"jscripty",title:e.name,icon:"icon-script",color:"grey",project:e,contact:g.contact})}catch(e){p.error({title:"ERROR OPENING JSCRIPTY PROJECT",msg:"The project cannot be started"+JSON.stringify(e)})}},g.getHoppers=A,g.getFinals=E,g.getHistories=y,g.getJscriptyProjects=function(){if(g.jscriptyProjects)return;return g.loadingJscriptyProjects=!0,u.jscriptyProject.get({fields:"createdAt,updatedAt,id,name,description,createdAt,formData,enableUncompleteSave",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.jscriptyProjects=e||{count:0,rows:[]}}).catch(function(){p.error({title:o.instant("JSCRIPTY.JSCRIPTY"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.JSCRIPTY_GET_ERROR")})}).finally(function(){g.loadingJscriptyProjects=!1})},g.getAccounts=function(n){if(g[n+"Accounts"])return;var e="get"+_.startCase(n)+"Accounts";return g.loadingAccounts=!0,u.user[e]({id:g.user.id,attributes:["id","name"],nolimit:!0}).$promise.then(function(e){g[n+"Accounts"]=e||{count:0,rows:[]}}).catch(function(){p.error({title:o.instant(n.toUpperCase()+"."+n.toUpperCase()+"ACCOUNTS"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.ACCOUNTS_GET_ERROR",{channel:o.instant("DASHBOARDS."+n.toUpperCase())})})}).finally(function(){g.loadingAccounts=!1})},g.composeInteraction=function(e,o,r,n){var l=o.toLowerCase();d.show({controller:"Compose"+o+"InteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/"+o.toLowerCase()+"/dialog.html",parent:angular.element(c.body),clickOutsideToClose:!1,locals:{account:r,message:{to:"mail"==l?n:n.split(",")},type:"new",interaction:{Contact:g.contact}},fullscreen:!0}).then(function(s){if(!s||_.isNil(s.message)||!s.message.savedAsDraft)return u[l+"Account"].send({id:r.id},s).$promise.then(function(e){if("Mail"===o){var n=e;if(n&&n.Messages&&n.Messages.length){if(s.attachments&&s.attachments.length)for(var t=0;t<s.attachments.length;t+=1)u.attachment.update({id:s.attachments[t].id},{MailMessageId:_.head(n.Messages).id});if(p.success({title:"Message properly sent!",msg:"Message has been sent!"}),n.closed){n.disposition=null;var a=!r.mandatoryDisposition,i=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause;d.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(c.body),onRemoving:function(){g.user&&r.mandatoryDisposition&&!i&&u.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},clickOutsideToClose:a,escapeToClose:a,locals:{user:g.user,channel:"mail",interaction:n}})}else m.$parent.vm.addInteractionTab("mail",n)}}else p.success({title:"Message properly sent!",msg:"Message has been sent!"}),m.$parent.vm.addInteractionTab(l,e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"fax"===l?p.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:o.toUpperCase()+"ACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});var e={type:"draft",channel:"mail",account:r,contact:g.contact,id:g.tab.id,openedAt:new Date,saved:!1,title:r.key+" - Untitled",content:s.message},n=a.localStorage.getItem("motion2.home.mail:"+g.user.id);if(n){var t=JSON.parse(n);t.drafts||(t.drafts={}),n=t}else n={drafts:{}};n.drafts[g.tab.id]=e,a.localStorage.setItem("motion2.home.mail:"+g.user.id,JSON.stringify(n))})},g.init=function(n,e){return g.tab=n,m.$watchGroup(["vm.detailForm.$pristine","vm.customFieldsForm.$pristine"],function(e){g.tab.saved=e[0]&&e[1]}),g.license=e,g.contact=g.tab.contact,g.newContact=!1,g.currentTab=0,u.user.get({fields:"id,fullname",nolimit:!0}).$promise.then(function(e){g.users=e||{count:0,rows:[]},g.usersMap=_.mapValues(_.keyBy(g.users.rows,"id"),"fullname")}).then(function(){for(var e=[],n=0;n<g.tab.calls.length;n++){var t=g.tab.calls[n];e.push(u.voiceCallReport.get({uniqueid:t.uniqueid}).$promise.then(function(e){e&&0<e.rows.length&&(t.disposedAt=_.first(e.rows).endtime)}))}return i.all(e)}).then(function(){return u.user.getLists({id:g.user.id,nolimit:!0}).$promise}).then(function(e){if(g.lists=e||{count:0,rows:[]},g.contact&&g.contact.ListId){if(g.list=_.find(g.lists.rows,{id:g.contact.ListId}),g.list)return;return u.cmList.get({id:g.contact.ListId}).$promise.then(function(e){e&&(g.list=e,g.lists.rows=_.unionBy(g.lists.rows,[g.list]))})}}).then(function(){if(g.contact&&g.contact.id){var e={id:g.contact.id,ListId:g.contact.ListId,limit:1,offset:0,sort:"-updatedAt"};return u.cmContact.get(e).$promise.then(function(e){return g.contact=e,g.tab.contact=e,u.user.addContacts({id:g.user.id,ids:[g.contact.id]})}).then(function(){if(g.contact.ListId)return u.disposition.get({ListId:g.contact.ListId,nolimit:!0}).$promise.then(function(e){return g.tab.dispositions=e,u.cmList.getCustomFields({id:g.contact.ListId,nolimit:!0}).$promise}).then(function(e){g.tab.customFields=e})}).then(function(){try{g.tab.companies=m.$parent.$parent.$parent.vm.globalCompanies,g.tab.tags=m.$parent.$parent.$parent.vm.globalTags,g.tab.autoCreate=0}catch(e){}u.contactItemType.get({}).$promise.then(function(e){g.contactItemTypes=e.rows}).then(function(){u.cmContact.getAdditionalPhones({id:g.contact.id}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");g.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");g.additionalItems=[];for(var s=0;s<n.length;s++)g.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})}).catch(function(e){console.log(e)})}),A(),E(),y()}).then(function(){return u.cmContact.getTags({id:g.contact.id}).$promise.then(function(e){g.tab.Tags=_.map(e.rows,"id")})})}return g.newContact=!0,n.autoCreate?f():void 0}).finally(function(){g.contact&&g.contact.id&&(T(),g.contact.dateOfBirth=S(g.contact.dateOfBirth))})},g.hasPermission=function(e){return s.hasPermission(e)},g.openInteraction=function(e){try{return m.$parent.$parent.$parent.vm.addInteractionTab(e.channel,e)}catch(e){p.error({title:o.instant("CONTACTMANAGER.CUSTOMER_JOURNEY"),msg:o.instant("CONTACTMANAGER.NOTIFICATIONS.INTERACTION_OPEN_ERROR")})}},g.getCustomerJourney=T,g.loadMoreJourney=function(){return i(function(e){var n=g.journey.length;return e(T(n))})};var v=n.getLogger("agent.general.contact");function h(e){return e.firstName||e.lastName?(e.firstName+" "+e.lastName).trim():e.phone}function f(){g.errors=[],u.cmContact.save(g.contact).$promise.then(function(e){g.contact.id=e.id,g.newContact=!1;var n=h(e);return g.tab.title=g.user.privacyEnabled?l.mask(n):n,g.tab.contact=g.contact,u.user.addContacts({id:s.getCurrentUser().id,ids:[e.id]})}).then(function(){g.detailForm.$pristine=!0,g.customFieldsForm.$pristine=!0,p.success({title:"Contact properly created",msg:g.contact.firstName?g.contact.firstName+" has been created!":""})}).then(function(){return u.cmContact.setTags({id:g.contact.id,ids:g.tab.Tags}).$promise}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}function b(n){return function(e){g[n]=e||{count:0,rows:[]}}}function A(){g.contact&&g.contact.id&&(g.queryHopper.ContactId=g.contact.id,g.queryHopper.offset=(g.queryHopper.page-1)*g.queryHopper.limit,g.promise=u.cmHopper.get(g.queryHopper,b("hoppers")).$promise)}function E(){g.contact&&g.contact.id&&(g.queryFinal.ContactId=g.contact.id,g.queryFinal.offset=(g.queryFinal.page-1)*g.queryFinal.limit,g.promise=u.cmHopperFinal.get(g.queryFinal,b("finals")).$promise)}function y(){g.contact&&g.contact.id&&(g.queryHistory.ContactId=g.contact.id,g.queryHistory.offset=(g.queryHistory.page-1)*g.queryHistory.limit,g.promise=u.cmHopperHistory.get(g.queryHistory,b("histories")).$promise)}function S(e){return null===e?void 0:new Date(e)}function T(e){g.journeyIsLoading=!0;var n=_.merge(g.journeyOptions,{id:g.contact.id,offset:e||0});return r.get(g.journey,n).then(function(e){g.journey=e.journey,g.canLoadMoreJourney=e.loadMore}).finally(function(){g.journeyIsLoading=!1})}m.$on("$destroy",function(){}),m.$watch("currentTab",function(){1===g.currentTab&&(A(),E(),y())});var I=!0,O=1;m.$watch("queryHopper.filter",function(e,n){I?t(function(){I=!1}):(n||(O=g.queryHopper.page),e!==n&&(g.queryHopper.page=1),e||(g.queryHopper.page=O),A())}),m.$watch("queryFinal.filter",function(e,n){I?t(function(){I=!1}):(n||(O=g.queryFinal.page),e!==n&&(g.queryFinal.page=1),e||(g.queryFinal.page=O),E())}),m.$watch("queryHistory.filter",function(e,n){I?t(function(){I=!1}):(n||(O=g.queryHistory.page),e!==n&&(g.queryHistory.page=1),e||(g.queryHistory.page=O),y())})}e.$inject=["$window","$mdDialog","$document","$timeout","$scope","$q","api","toasty","Auth","$translate","msUtils","customerJourneyManager","privacyManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentGeneralContactController",e)}(),function(){"use strict";function e(n,t,i,s,o,e,a,r,l,d,c,m,u,p,g){var v=this;v.user=d.getCurrentUser(),v.isReschedule=!1,v.recallme=!1,v.queueCampaign=void 0,v.queueCampaigns={count:0,rows:[]},v.dispositions=_.orderBy(_.concat([],e.rows,a.rows),["name"],["asc"]),v.contact=l,v.call=r,v.note=v.call.note||void 0,v.dialerCall=!1,v.hasBlackLists=!1,v.contactTZTime,v.availableCalls=m,v.autoClose=u,v.recalcTZTime=b,v.hopper={minDate:new Date,dateTime:new Date,scheduledAt:new Date},p.$watch("vm.contact.dialTimezone",function(){b()});var h=g.getLogger("dashboard","agent.general.contact.dispose");function f(){return i(function(n){o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name,dialActive,dialMethod",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){v.queueCampaigns=e||{count:0,rows:[]},n()}).catch(function(e){h.error(e),s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.getBlackLists",msg:e.data?JSON.stringify(e.data):e.toString()})})})}function b(){var e=v.dialerCall?Number(v.call["xmd-voicequeueid"]):v.queueCampaign?v.queueCampaign.id:v.call["xmd-campaignid"]?Number(v.call["xmd-campaignid"]):null;if(e)o.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,_.isNil(v.contact.dialTimezone)&&(v.contact.dialTimezone=v.hopper.dialTimezone),n)o.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}});else{o.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledAt=moment(v.hopper.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}}function A(){var e=v.selectedDisposition?v.selectedDisposition.name.toLowerCase():void 0;return{id:v.call.uniqueid,disposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,secondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,thirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null,dispositionat:moment(),amd:"amd"===e,fax:"fax"===e,blacklist:"blacklist"===e,recallme:"recallme"===e,UserId:"recallme"===e?d.getCurrentUser().id:null,OwnerId:d.getCurrentUser().id}}function E(e){t.hide([e,v.autoClose])}v.call&&v.call.variables&&v.call.variables["xmd-voicequeueid"]?(v.dialerCall=!0,o.voiceQueue.getBlackLists({id:v.call.variables["xmd-voicequeueid"]}).$promise.then(function(e){e&&e.rows&&0<e.rows.length&&(v.hasBlackLists=!0)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.getBlackLists",msg:e.data?JSON.stringify(e.data):e.toString()})})):f(),v.onDispositionChange=function(e){switch(e){case"first":v.selectedDisposition=v.firstLevelDisposition,v.anySecondLevelDisposition=_.some(v.dispositions,["ParentId",v.firstLevelDisposition.id]),v.secondLevelDisposition=void 0,v.thirdLevelDisposition=void 0,v.anyThirdLevelDisposition=!1;break;case"second":v.selectedDisposition=v.secondLevelDisposition,v.anyThirdLevelDisposition=_.some(v.dispositions,["ParentId",v.secondLevelDisposition.id]);break;case"third":v.selectedDisposition=v.thirdLevelDisposition}},v.clearDispositionSelection=function(e){"second"===e?(v.secondLevelDisposition=void 0,v.thirdLevelDisposition=void 0,v.selectedDisposition=v.firstLevelDisposition):"third"===e&&(v.thirdLevelDisposition=void 0,v.selectedDisposition=v.secondLevelDisposition)},v.saveDisposition=function(e){v.selectedDisposition=_.isNil(e)?v.selectedDisposition:{name:e},e&&(v.firstLevelDisposition=v.selectedDisposition);v.call.note=v.note,o.voiceCallReport.update({id:v.call.uniqueid,userDisposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,userSecondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,userThirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null,note:v.note,UserId:d.getCurrentUser().id,ContactId:v.contact.id}).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICECALLREPORT",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.voiceRecording.get({uniqueid:v.call.uniqueid}).$promise.then(function(e){if(e)for(var n=0;n<e.rows.length;n+=1)o.voiceRecording.update({id:e.rows[n].id,userDisposition:v.firstLevelDisposition?v.firstLevelDisposition.name:null,userSecondDisposition:v.secondLevelDisposition?v.secondLevelDisposition.name:null,userThirdDisposition:v.thirdLevelDisposition?v.thirdLevelDisposition.name:null}).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICERECORDING",msg:e.data?JSON.stringify(e.data):e.toString()})})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEVOICERECORDING",msg:e.data?JSON.stringify(e.data):e.toString()})}),v.dialerCall&&(o.cmHopperFinal.update(A()).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERFINAL",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.cmHopperHistory.update(A()).$promise.catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECMHOPPERHISTORY",msg:e.data?JSON.stringify(e.data):e.toString()})}));if(_.isNil(v.selectedDisposition))E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"");else switch(v.selectedDisposition.name.toLowerCase()){case"blacklist":v.call&&v.call.variables&&v.call.variables["xmd-voicequeueid"]&&function(e){if(e)o.voiceQueue.getBlackLists({id:e,type:"outbound",fields:"id"}).$promise.then(function(e){var n=[];if(e&&0<e.count){for(var t=0;t<e.rows.length;t+=1){var a=angular.copy(v.contact);delete a.id,a.ListId=e.rows[t].id,n.push(o.cmContact.save(a).$promise)}return i.all(n)}s.success({title:c.instant("DASHBOARDS.INFO"),msg:c.instant("DASHBOARDS.NOTAVAILABLE")+" "+v.selectedDisposition}),v.selectedDisposition=void 0}).then(function(e){e&&E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATEBLACKLIST",msg:e.data?JSON.stringify(e.data):e.toString()}),E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")})}(v.call.variables["xmd-voicequeueid"]);break;case"reschedule":v.isReschedule=!0,v.recallme=!1;break;case"recallme":v.isReschedule=!0,v.recallme=!0,v.user.selectRecallMeCampaign&&f().then(function(){v.originalCampaign=_.find(v.queueCampaigns.rows,["id",v.call.variables["xmd-voicequeueid"]]);var e=JSON.parse(n.localStorage.getItem("motion2.user:"+v.user.id));v.queueCampaign=e.previewCampaignId?_.find(v.queueCampaigns.rows,["id",Number(e.previewCampaignId)]):v.originalCampaign});break;default:E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}},v.closeDialog=function(){t.cancel()},v.saveReschedule=function(){v.disable=!0;var e=null;v.queueCampaign?e=v.queueCampaign.id:v.dialerCall&&(e=Number(v.call["xmd-voicequeueid"]));return o.cmHopper.save({phone:v.contact.phone,UserId:v.recallme?d.getCurrentUser().id:null,ContactId:v.contact.id,ListId:v.contact.ListId,VoiceQueueId:e,scheduledat:moment(v.hopper.scheduledAt).format("YYYY-MM-DD HH:mm:ss"),dialTimezone:v.contact.dialTimezone,priority:3,recallme:v.recallme,OwnerId:d.getCurrentUser().id}).$promise.then(function(e){o.cmContact.rescheduleAdditionalPhones({id:v.contact.id,hopperId:e.id}).$promise.catch(function(e){console.log(e)})}).then(function(){if(v.dialerCall&&(o.cmHopperFinal.update({id:v.call.uniqueid,rescheduled:!0,rescheduledat:moment(v.hopper.scheduledAt).format("YYYY-MM-DD HH:mm:ss"),recallme:v.recallme}).$promise.catch(function(e){h.error(e)}),v.user.selectRecallMeCampaign)){var e=JSON.parse(n.localStorage.getItem("motion2.user:"+v.user.id));e.previewCampaignId=v.queueCampaign.id,n.localStorage.setItem("motion2.user:"+v.user.id,JSON.stringify(e))}}).then(function(){return o.cmContact.update({id:v.contact.id,dialTimezone:v.contact.dialTimezone})}).then(function(){s.success({title:c.instant("DASHBOARDS.INFO"),msg:c.instant("DASHBOARDS.CALL_DISPOSED")+" "+(v.recallme?c.instant("DASHBOARDS.RECALLME"):c.instant("DASHBOARDS.RESCHEDULE"))})}).catch(function(e){h.error(e),E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")}).finally(function(){v.disable=!1,E(v.selectedDisposition?v.selectedDisposition.name.toUpperCase():"")})}}e.$inject=["$window","$mdDialog","$q","toasty","api","dispositions","globalDispositions","call","contact","Auth","$translate","availableCalls","autoClose","$scope","ClientSideLoggingService"],angular.module("app.staff").controller("DisposeCallDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.call=l,u.contact=r,u.hopper={minDate:new Date,dateTime:new Date},u.closeDialog=function(){a.cancel()},u.saveDialog=function(){return u.disable=!0,o.cmHopper.save({phone:u.contact.phone,UserId:c?d.getCurrentUser().id:null,ContactId:u.contact.id,ListId:u.contact.ListId,VoiceQueueId:Number(u.call["xmd-voicequeueid"]),scheduledat:moment(u.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),priority:3,recallme:c,OwnerId:d.getCurrentUser().id}).$promise.then(function(){o.cmHopperFinal.update({id:u.call.uniqueid,rescheduled:!0,rescheduledat:moment(u.hopper.dateTime).format("YYYY-MM-DD HH:mm:ss"),recallme:c}).$promise}).then(function(){s.success({title:m.instant("DASHBOARDS.INFO"),msg:m.instant("DASHBOARDS.CALL_DISPOSED")+" "+(c?m.instant("DASHBOARDS.RECALLME"):m.instant("DASHBOARDS.RESCHEDULE"))}),a.hide()}).catch(function(e){a.cancel(e)}).finally(function(){u.disable=!1})}}e.$inject=["$scope","$state","$location","$mdDialog","$timeout","toasty","api","contact","call","Auth","recallme","$translate"],angular.module("app.staff").controller("RescheduleCallDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s){var o=this;o.callNumber=i,o.page=1,o.onInit=function(){n.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){o.lists=_.chain(e.rows).keyBy("id").mapValues("name").value(),n.cmCustomField.get({fields:"id,alias",nolimit:!0}).$promise.then(function(e){o.customFields=e.rows,o.contacts=_.map(t,function(t){return Object.keys(t).forEach(function(e){if(Number(t[e])===Number(o.callNumber))if(e.startsWith("cf_")){var n=_.find(o.customFields,["id",Number(_.trimStart(e,"cf_"))]);t.matchingField=n?n.alias:a.instant("DASHBOARDS.UNKNOWN")}else t.matchingField=e}),t})})}).then(function(){o.paginatedContacts=_.chunk(t,4)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmList.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},o.selectContact=function(){e.hide(o.selectedContact)}}e.$inject=["$mdDialog","$translate","api","contacts","callNumber","toasty"],angular.module("app.dashboards").controller("ContactSelectionController",e)}(),function(){"use strict";function e(e,n){var t=n(function(){},999);e.$on("$destroy",function(){t&&(n.cancel(t),t=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeAbandonedController",e)}(),function(){"use strict";function e(e,n,a,i,t,s,o,r,l,d){var c=this;function m(){return o.disposition.get({fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise.then(function(e){return c.dispositions=e?e.rows:[],o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise}).then(function(e){c.queues=e||{count:0,rows:[]},c.queuesMap=_.mapValues(_.keyBy(c.queues.rows,"name"),"name"),c.defaultQueues=c.queues.rows?_.map(c.queues.rows,"name").join(","):void 0}).then(function(){c.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:c.currentUser.name,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:c.queues.rows,ngValue:"name",clearAll:!1}]}).catch(function(e){console.log(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.abandoned.bull.calls:"+c.currentUser.id);if(e)(e=JSON.parse(e)).query&&(c.query=_.merge(e.query,c.query));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};c.query.createdAt=n}c.isSearchBarVisible=!!c.query.filter,u()})}function u(){c.query.queue=c.query.queue||c.defaultQueues.split(","),c.query.offset=(c.query.page-1)*c.query.limit;var e={query:c.query};t.localStorage.setItem("motion2.home.abandoned.bull.calls:"+c.currentUser.id,JSON.stringify(e)),c.promise=o.voiceQueueReport.getVoiceQueuesReport(c.query,p).$promise}function p(e){c.abandonedCalls=e||{count:0,rows:[]},c.refresh=!0}c.showTooltip=!1,c.refresh=!0,c.disable=[],c.dispositions={count:0,rows:[]},c.currentUser=r.getCurrentUser(),c.queues={},c.abandonedCalls={count:0,rows:[]},c.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition,note",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},c.getAbandonedCalls=u,c.refreshAbandonedCalls=function(){c.showTooltip=!1,u()},c.onInit=m,c.reserved=function(e){e&&(c.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?c.currentUser.name:null,assigned:e.assigned}).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[e.id]=!1,e.lastAssignedTo=e.assigned?c.currentUser.name:null}))},c.dispose=function(t){a.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(i.body),targetEvent:t,locals:{dispositions:c.dispositions,call:t}}).then(function(e){if(e){c.disable[t.id]=!0;var n={id:t.id,lastAssignedTo:t.assigned?c.currentUser.name:null,assigned:t.assigned,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null,note:e.note||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[t.id]=!1,t.disposition=e.firstLevel,t.secondDisposition=e.secondLevel,t.thirdDisposition=e.thirdLevel})}})},c.call=e.$parent.$parent.$parent.$parent.vm.call,c.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,c.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,c.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",function(e){c.queuesMap&&"outbound"===e.type&&c.queuesMap[e.queue]&&(c.showTooltip=!0)}),l.onWithoutApply("voiceQueueReport:update",function(e){if(e){var n=_.findIndex(c.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(c.abandonedCalls.rows[n],e)}}),m(),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeAbandonedBullController",e)}(),function(){"use strict";function e(n,t,e,a){var i=this;function s(e,n){switch(e){case"first":i.selectedDisposition=i.firstLevelDisposition,i.anySecondLevelDisposition=_.some(i.dispositions,["ParentId",i.firstLevelDisposition.id]),i.secondLevelDisposition=void 0,i.thirdLevelDisposition=void 0,i.anyThirdLevelDisposition=!1;break;case"second":i.selectedDisposition=i.secondLevelDisposition,i.anyThirdLevelDisposition=_.some(i.dispositions,["ParentId",i.secondLevelDisposition.id]);break;case"third":i.selectedDisposition=i.thirdLevelDisposition}n&&function(e){switch(e){case"first":i.call.secondDisposition&&(i.secondLevelDisposition=_.find(i.dispositions,function(e){return e.name===i.call.secondDisposition&&e.ParentId===i.firstLevelDisposition.id}),i.secondLevelDisposition&&s("second",!0));break;case"second":i.call.thirdDisposition&&(i.thirdLevelDisposition=_.find(i.dispositions,function(e){return e.name===i.call.thirdDisposition&e.ParentId===i.secondLevelDisposition.id}),i.thirdLevelDisposition&&s("third",!0))}}(e)}i.dispositions=e,i.call=a,i.note=i.call.note||void 0,i.onDispositionChange=s,i.clearDispositionSelection=function(e){"second"===e?(i.secondLevelDisposition=void 0,i.thirdLevelDisposition=void 0,i.selectedDisposition=i.firstLevelDisposition):"third"===e&&(i.thirdLevelDisposition=void 0,i.selectedDisposition=i.secondLevelDisposition);n.disposition.$setDirty()},i.saveDisposition=function(){i.call.note=i.note;var e={firstLevel:i.firstLevelDisposition?i.firstLevelDisposition.name:void 0,secondLevel:i.secondLevelDisposition?i.secondLevelDisposition.name:void 0,thirdLevel:i.thirdLevelDisposition?i.thirdLevelDisposition.name:void 0,note:i.note?i.note:void 0};t.hide(e)},i.closeDialog=function(){t.cancel()},i.call.disposition&&(i.firstLevelDisposition=_.find(i.dispositions,function(e){return e.name===i.call.disposition}),i.firstLevelDisposition&&s("first",!0))}e.$inject=["$scope","$mdDialog","dispositions","call"],angular.module("app.dashboards").controller("DisposeAbandonedCallDialogController",e)}(),function(){"use strict";function e(e,n,a,i,t,s,o,r,l,d){var c=this;function m(){return o.disposition.get({fields:"createdAt,updatedAt,id,name,level,ParentId",sort:"name",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise.then(function(e){return c.dispositions=e?e.rows:[],o.user.getQueues({id:r.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise}).then(function(e){c.queues=e||{count:0,rows:[]},c.queuesMap=_.mapValues(_.keyBy(c.queues.rows,"name"),"name"),c.defaultQueues=c.queues.rows?_.map(c.queues.rows,"name").join(","):void 0}).then(function(){c.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:c.currentUser.name,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_QUEUE",options:c.queues.rows,ngValue:"name",clearAll:!1}]}).catch(function(e){console.log(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.abandoned.voice.calls:"+c.currentUser.id);if(e)(e=JSON.parse(e)).query&&(c.query=_.merge(e.query,c.query));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};c.query.createdAt=n}c.isSearchBarVisible=!!c.query.filter,u()})}function u(){c.query.queue=c.query.queue||c.defaultQueues.split(","),c.query.offset=(c.query.page-1)*c.query.limit;var e={query:c.query};t.localStorage.setItem("motion2.home.abandoned.voice.calls:"+c.currentUser.id,JSON.stringify(e)),c.promise=o.voiceQueueReport.getVoiceQueuesReport(c.query,p).$promise}function p(e){c.abandonedCalls=e||{count:0,rows:[]},c.refresh=!0}c.showTooltip=!1,c.refresh=!0,c.disable=[],c.dispositions={count:0,rows:[]},c.currentUser=r.getCurrentUser(),c.queues={},c.abandonedCalls={count:0,rows:[]},c.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition,note",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},c.getAbandonedCalls=u,c.refreshAbandonedCalls=function(){c.showTooltip=!1,u()},c.onInit=m,c.reserved=function(e){e&&(c.disable[e.id]=!0,o.voiceQueueReport.update({id:e.id,lastAssignedTo:e.assigned?c.currentUser.name:null,assigned:e.assigned}).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[e.id]=!1,e.lastAssignedTo=e.assigned?c.currentUser.name:null}))},c.dispose=function(t){a.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(i.body),targetEvent:t,locals:{dispositions:c.dispositions,call:t}}).then(function(e){if(e){c.disable[t.id]=!0;var n={id:t.id,lastAssignedTo:t.assigned?c.currentUser.name:null,assigned:t.assigned,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null,note:e.note||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)}).finally(function(){c.disable[t.id]=!1,t.disposition=e.firstLevel,t.secondDisposition=e.secondLevel,t.thirdDisposition=e.thirdLevel})}})},c.call=e.$parent.$parent.$parent.$parent.vm.call,c.transfer=e.$parent.$parent.$parent.$parent.vm.transfer,c.webcall=e.$parent.$parent.$parent.$parent.vm.webcall,c.webtransfer=e.$parent.$parent.$parent.$parent.vm.webtransfer,l.onWithoutApply("voiceQueueReport:save",function(e){c.queuesMap&&"inbound"===e.type&&c.queuesMap[e.queue]&&(c.showTooltip=!0)}),l.onWithoutApply("voiceQueueReport:update",function(e){if(e){var n=_.findIndex(c.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(c.abandonedCalls.rows[n],e)}}),m(),e.$on("$destroy",function(){l.removeAllListeners("voiceQueueReport:save"),l.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeAbandonedVoiceController",e)}(),function(){"use strict";function e(n,a,t,e,i){var s=this;function o(){var e=angular.element(".agent-general-home-navbar button.current")[0];e&&e.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"})}s.user=t.getCurrentUser(),s.license={},s.plugin={},s.setting={},s.sidebar="dashboard",s.draftManager=i,s.navigation=e.getNavigation(),s.addContactTab=n.$parent.vm.addContactTab,s.addInteractionTab=n.$parent.vm.addInteractionTab,s.init=function(e,n){s.license=e,s.setting=n;var t=a.localStorage.getItem("motion2.home:"+s.user.id);if(t){try{t=JSON.parse(t),s.sidebar=t.currentSidebarTab?t.currentSidebarTab:"dashboard"}catch(e){console.error(e),s.sidebar="dashboard"}"mail"===s.sidebar&&s.draftManager.init()}},s.changeSidebarTab=function(e){s.sidebar=e.view,"plugin"===s.sidebar&&(s.plugin=e.stateParams,s.pluginId=e.id,n.$broadcast("pluginUpdated",{plugin:s.plugin}));a.localStorage.setItem("motion2.home:"+s.user.id,JSON.stringify({currentSidebarTab:e.view}))},s.hasPermission=function(e){return t.hasPermission(e)},angular.element(a).on("resize",o),n.$on("$destroy",function(){angular.element(a).off("resize",o)}),n.$watch("vm_home.sidebar",function(e,n){"mail"===e?s.draftManager.init():s.draftManager.drafts={}})}e.$inject=["$scope","$window","Auth","msNavigationAgentService","draftManager"],angular.module("app.dashboards").controller("AgentGeneralHomeController",e)}(),function(){"use strict";function e(t,n,i,s,a,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.chatInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,ChatWebsiteId:[]},g.sectionColor="green-A700",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getChatWebsites({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.chatAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Website",key:"ChatWebsiteId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.chatAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Customer Ip",column:"customerIp",type:"text",options:{excludedOperators:["$eq","$ne","$startsWith","$endsWith"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Website",column:"ChatWebsiteId",type:"multiselect",options:{route:{model:"user",action:"getChatWebsites",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("chat",g.query,g.user.id,g.chatAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("chatInteraction:save",O),d.on("chatInteraction:update",O),d.on("chatInteractionTags:save",C),d.on("chatMessage:save",w),d.on("chatMessage:update",w),d.on("user_has_chat_interactions:save",T),d.on("user_has_chat_interactions:remove",I),d.on("userChatWebsite:save",f),d.on("userChatWebsite:remove",b),0<g.setting.chatInteractionsReloadTimeout&&R()})},g.success=E,g.getChatInteractions=y,g.showChatInteraction=function(e,n){t.$parent.vm.addInteractionTab("chat",n)},g.downloadChatInteraction=function(e,s,n){r.chatInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="chat-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadChatInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"chat",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getChatWebsiteLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.chat"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.chat");function h(e){return{accounts:g.chatAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.ChatWebsiteId);u.addAccount("chat",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.ChatWebsiteId);u.removeAccount("chat",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.chatAccounts.rows,function(e){return{model:"chatWebsite",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.chatInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.chatInteractions=e||{count:0,rows:[]};for(var n=0;n<g.chatInteractions.rows.length;n+=1)S(g.chatInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=a.localStorage.getItem("motion2.home.chat:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,a.localStorage.setItem("motion2.home.chat:"+g.user.id,JSON.stringify(n)),g.promise=r.chatInteraction.get(g.query,E).$promise}function S(e){"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.chatInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.chatInteractions.rows=_.orderBy(g.chatInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.chatInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.chatInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.chatInteractions.rows,{id:e.ChatInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.chatInteractionsReloadTimeout)}t.$on("$destroy",function(){d.removeAllListeners("chatMessage:save"),d.removeAllListeners("chatMessage:update"),d.removeAllListeners("chatInteraction:save"),d.removeAllListeners("chatInteractionTags:save"),d.removeAllListeners("chatInteraction:update"),d.removeAllListeners("user_has_chat_interactions:save"),d.removeAllListeners("user_has_chat_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeChatController",e)}(),function(){"use strict";function e(t,n,e,a,i,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.contacts=e||{count:0,rows:[]}}function c(e,n){l.searchInProgress=!0,o.cmContact.describe({id:l.query.ListId}).$promise.then(function(e){return _(e.toJSON()).omit("UserId").values().map(function(e){return function(e){var n={name:_.startCase(e.displayName),column:e.columnName,options:{}};if(e.custom)switch(e.custom.type){case"text":n.type="text";break;case"select":n.type="multiselect",n.values=_.map(JSON.parse(e.custom.values),function(e,n){return{id:n,name:e.value,value:e.value}}),n.options.field="name";break;case"switch":n.type="select",n.values=[{id:1,translate:"DASHBOARDS.ENABLED"},{id:0,translate:"DASHBOARDS.DISABLED"}],n.options.excludedOperators=["$ne"];break;case"number":n.type="number";break;case"datetime":n.type="date"}else switch(e.columnName){case"dateOfBirth":n.type="date";break;case"CompanyId":n.name="Company",n.type="autocomplete",n.options.route={model:"cmCompany",action:"get",params:{fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;case"ListId":n.name="List",n.type="autocomplete",n.options.route={model:"user",action:"getLists",params:{id:l.currentUser.id,fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;default:_.includes(e.type.toLowerCase(),"int")?n.type="number":_.includes(e.type.toLowerCase(),"date")?n.type="date":n.type="text"}return n}(e)}).value()}).then(function(e){l.advancedSearch.fields=e;var n=_.findIndex(e,function(e){return _.startsWith(e.column,"cf_")})||e.length-1;n<0&&(n=e.length),l.advancedSearch.fields.splice(n,0,{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"DESCRIBE_CM_CONTACTS",msg:e.data?JSON.stringify(e.data.message):e.toString()})}),e||(l.query.page=1),l.query.offset=(l.query.page-1)*l.query.limit;var t=i.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);(t=t?JSON.parse(t):{}).query=l.query,i.localStorage.setItem("motion2.home.contacts:"+l.currentUser.id,JSON.stringify(t)),l.promise=o.cmContact.get(l.query,d).$promise}l.currentUser=s.getCurrentUser(),l.lists={},l.contacts={count:0,rows:[]},l.tags={count:0,rows:[]},l.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1},l.advancedSearch={fields:[]},l.sectionColor="red",l.getContacts=c,l.refreshContacts=function(){c()},l.mergeContact=function(e,n){a.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.duplicateContact=function(e,n){a.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.openContact=function(e){return o.cmContact.get({id:e}).$promise.then(function(e){n.$parent.vm.addContactTab(e)})},l.call=n.$parent.vm.call,l.onInit=function(){o.user.getLists({id:l.currentUser.id,fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return l.lists=e||{count:0,rows:[]},l.listsMap=_.keyBy(l.lists.rows,"id"),o.tag.get({sort:"name"}).$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"List",key:"ListId",type:"multiselect",label:"CONTACTMANAGER.SELECT_LIST",options:l.lists.rows,clearAll:!1},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:l.tags.rows,placeholder:"DASHBOARDS.TAGS"}]}).catch(function(e){console.error(e)}).finally(function(){var e=i.localStorage.getItem("motion2.home.contacts:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query),_.isEmpty(l.lists.rows)?l.query.ListId=[]:_.isEmpty(l.query.ListId)&&(l.query.ListId=_(l.lists.rows).map("id").take().value()))}catch(e){console.log(e)}else l.query.ListId=_.map(l.lists.rows,"id");l.isSearchBarVisible=!(l.query.search||!l.query.filter),c()})},l.openAdvancedSearch=function(){a.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{color:l.sectionColor,fields:l.advancedSearch.fields,storagePath:"home.contacts"},fullscreen:!0}).then(function(e){l.isSearchBarVisible=!(e.value||!l.query.filter),e.apply&&(l.query.search=e.value,c())}).catch(function(e){r.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}e.$inject=["$document","$scope","$timeout","$mdDialog","$window","Auth","api","toasty"],angular.module("app.dashboards").controller("AgentHomeContactsController",e)}(),function(){"use strict";function e(e,n){var t=n(function(){},999);e.$on("$destroy",function(){t&&(n.cancel(t),t=null)})}e.$inject=["$scope","$interval"],angular.module("app.dashboards").controller("AgentHomeDashboardController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["type","waiting","dialMethod","dialActive"];function u(e){c.voiceQueuesTotal=e.count?e.count:0,c.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.voiceQueues,function(e,n){c.rpcVoiceQueues[n]&&(c.voiceQueues[n].waiting=c.rpcVoiceQueues[n].waiting||0)})}c.voiceQueues={},c.voiceQueuesTotal=0,c.rpcVoiceQueues={},c.getVoiceQueues={},c.rpcVoiceQueuesChannels={},c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.load=!0,c.query={id:r.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",type:"outbound",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=u,c.getVoiceQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,u).$promise},c.getSize=function(e){return _.size(e)},c.onSaveQueue=function(e){c.voiceQueues[e.id]&&c.rpcVoiceQueues[e.id]&&(c.rpcVoiceQueues[e.id]=e,_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onSaveChannel=function(e){"outbound"===e.type&&(e.queuecallerleaveAt?(delete c.rpcVoiceQueuesChannels[e.uniqueid],c.load&&c.deleteVoiceQueuesChannels.push(e.uniqueid)):(c.rpcVoiceQueuesChannels[e.uniqueid]=e,c.load&&(c.addVoiceQueuesChannels[e.uniqueid]=e)))},c.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getVoiceQueues()},c.onSaveVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]=_.pick(e,m))},c.onUpdateVoiceQueue=function(e){_.isNil(e)||(c.rpcVoiceQueues[e.id]&&_.merge(c.rpcVoiceQueues[e.id],_.pick(e,m)),c.voiceQueues[e.id]&&_.merge(c.voiceQueues[e.id],_.pick(e,m)))},c.onRemoveVoiceQueue=function(e){_.isNil(e)||(delete c.rpcVoiceQueues[e.id],delete c.voiceQueues[e.id])},l.onWithoutApply("voice_queue:save",c.onSaveQueue),l.onWithoutApply("voice_queue_channel:save",c.onSaveChannel),l.onWithoutApply("userVoiceQueue:save",c.onUserVoiceQueue),l.onWithoutApply("userVoiceQueue:remove",c.onUserVoiceQueue),l.onWithoutApply("voiceQueue:save",c.onSaveVoiceQueue),l.onWithoutApply("voiceQueue:remove",c.onRemoveVoiceQueue),l.onWithoutApply("voiceQueue:update",c.onUpdateVoiceQueue),o.rpc.getVoiceQueues().$promise.then(function(e){return c.rpcVoiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){c.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,{type:"outbound",queuecallerleaveAt:null}):[],"uniqueid"):{}}).catch(function(e){console.error(e)}).finally(function(){_.merge(c.rpcVoiceQueuesChannels,c.addVoiceQueuesChannels);for(var e=0;e<c.deleteVoiceQueuesChannels.length;e+=1)delete c.rpcVoiceQueuesChannels[c.deleteVoiceQueuesChannels[e]];c.load=!1,c.addVoiceQueuesChannels={},c.deleteVoiceQueuesChannels=[],c.getVoiceQueues()});var p=!0,g=1;e.$watch("vm_dc.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getVoiceQueues())}),e.$on("$destroy",function(){l.removeAllListeners("voice_queue:save"),l.removeAllListeners("voice_queue_channel:save"),l.removeAllListeners("userVoiceQueue:save"),l.removeAllListeners("userVoiceQueue:remove"),l.removeAllListeners("voiceQueue:save"),l.removeAllListeners("voiceQueue:update"),l.removeAllListeners("voiceQueue:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardBullController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcChatQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.chatQueuesTotal=e.count?e.count:0,c.chatQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.chatQueues,function(e,n){c.rpcChatQueues[n]&&(c.chatQueues[n].waiting=c.rpcChatQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.chatQueues={},c.chatQueuesTotal=0,c.rpcChatQueues={},c.paginatedInteractions=[],c.deleteChatQueuesWaitingInteractions=[],c.rpcChatQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"chat",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getChatQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.chatQueues[e.id]&&c.rpcChatQueues[e.id]&&(_.merge(c.rpcChatQueues[e.id],_.pick(e,m)),_.merge(c.chatQueues[e.id],_.pick(e,m)))},c.onSaveChatQueue=function(e){_.isNil(e)||(c.rpcChatQueues[e.id]=_.pick(e,m))},c.onUpdateChatQueue=function(e){_.isNil(e)||(c.rpcChatQueues[e.id]&&_.merge(c.rpcChatQueues[e.id],_.pick(e,m)),c.chatQueues[e.id]&&_.merge(c.chatQueues[e.id],_.pick(e,m)))},c.onRemoveChatQueue=function(e){_.isNil(e)||(delete c.rpcChatQueues[e.id],delete c.chatQueues[e.id])},c.onSaveUserChatQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getChatQueues()},c.onRemoveUserChatQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getChatQueues()},c.onSaveChatQueueChannel=function(e){c.chatQueues[e.queue_id]&&(c.rpcChatQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveChatQueueChannel=function(e){delete c.rpcChatQueuesWaitingInteractions[e.id],u&&c.deleteChatQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("chat_queue:save",c.onSaveQueue),l.onWithoutApply("chatQueue:save",c.onSaveChatQueue),l.onWithoutApply("chatQueue:update",c.onUpdateChatQueue),l.onWithoutApply("chatQueue:remove",c.onRemoveChatQueue),l.onWithoutApply("userChatQueue:save",c.onSaveUserChatQueue),l.onWithoutApply("userChatQueue:remove",c.onRemoveUserChatQueue),l.onWithoutApply("chat_queue_waiting_interaction:save",c.onSaveChatQueueChannel),l.onWithoutApply("chat_queue_waiting_interaction:remove",c.onRemoveChatQueueChannel),o.rpc.getChatQueues().$promise.then(function(e){c.rpcChatQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"chat"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getChatQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcChatQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteChatQueuesWaitingInteractions.length;e+=1)delete c.rpcChatQueuesWaitingInteractions[c.deleteChatQueuesWaitingInteractions[e]];u=!1,c.deleteChatQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getChatQueues())}),e.$on("$destroy",function(){l.removeAllListeners("chat_queue:save"),l.removeAllListeners("chatQueue:save"),l.removeAllListeners("chatQueue:update"),l.removeAllListeners("chatQueue:remove"),l.removeAllListeners("userChatQueue:save"),l.removeAllListeners("userChatQueue:remove"),l.removeAllListeners("chat_queue_waiting_interaction:save"),l.removeAllListeners("chat_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelChatController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcFaxQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.faxQueuesTotal=e.count?e.count:0,c.faxQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.faxQueues,function(e,n){c.rpcFaxQueues[n]&&(c.faxQueues[n].waiting=c.rpcFaxQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.faxQueues={},c.faxQueuesTotal=0,c.rpcFaxQueues={},c.paginatedInteractions=[],c.deleteFaxQueuesWaitingInteractions=[],c.rpcFaxQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"fax",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getFaxQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.faxQueues[e.id]&&c.rpcFaxQueues[e.id]&&(_.merge(c.rpcFaxQueues[e.id],_.pick(e,m)),_.merge(c.faxQueues[e.id],_.pick(e,m)))},c.onSaveFaxQueue=function(e){_.isNil(e)||(c.rpcFaxQueues[e.id]=_.pick(e,m))},c.onUpdateFaxQueue=function(e){_.isNil(e)||(c.rpcFaxQueues[e.id]&&_.merge(c.rpcFaxQueues[e.id],_.pick(e,m)),c.faxQueues[e.id]&&_.merge(c.faxQueues[e.id],_.pick(e,m)))},c.onRemoveFaxQueue=function(e){_.isNil(e)||(delete c.rpcFaxQueues[e.id],delete c.faxQueues[e.id])},c.onSaveUserFaxQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getFaxQueues()},c.onRemoveUserFaxQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getFaxQueues()},c.onSaveFaxQueueChannel=function(e){c.faxQueues[e.queue_id]&&(c.rpcFaxQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveFaxQueueChannel=function(e){delete c.rpcFaxQueuesWaitingInteractions[e.id],u&&c.deleteFaxQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("fax_queue:save",c.onSaveQueue),l.onWithoutApply("faxQueue:save",c.onSaveFaxQueue),l.onWithoutApply("faxQueue:update",c.onUpdateFaxQueue),l.onWithoutApply("faxQueue:remove",c.onRemoveFaxQueue),l.onWithoutApply("userFaxQueue:save",c.onSaveUserFaxQueue),l.onWithoutApply("userFaxQueue:remove",c.onRemoveUserFaxQueue),l.onWithoutApply("fax_queue_waiting_interaction:save",c.onSaveFaxQueueChannel),l.onWithoutApply("fax_queue_waiting_interaction:remove",c.onRemoveFaxQueueChannel),o.rpc.getFaxQueues().$promise.then(function(e){c.rpcFaxQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"fax"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getFaxQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcFaxQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteFaxQueuesWaitingInteractions.length;e+=1)delete c.rpcFaxQueuesWaitingInteractions[c.deleteFaxQueuesWaitingInteractions[e]];u=!1,c.deleteFaxQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getFaxQueues())}),e.$on("$destroy",function(){l.removeAllListeners("fax_queue:save"),l.removeAllListeners("faxQueue:save"),l.removeAllListeners("faxQueue:update"),l.removeAllListeners("faxQueue:remove"),l.removeAllListeners("userFaxQueue:save"),l.removeAllListeners("userFaxQueue:remove"),l.removeAllListeners("fax_queue_waiting_interaction:save"),l.removeAllListeners("fax_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelFaxController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcMailQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.mailQueuesTotal=e.count?e.count:0,c.mailQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.mailQueues,function(e,n){c.rpcMailQueues[n]&&(c.mailQueues[n].waiting=c.rpcMailQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.mailQueues={},c.mailQueuesTotal=0,c.rpcMailQueues={},c.paginatedInteractions=[],c.deleteMailQueuesWaitingInteractions=[],c.rpcMailQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"mail",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getMailQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.mailQueues[e.id]&&c.rpcMailQueues[e.id]&&(_.merge(c.rpcMailQueues[e.id],_.pick(e,m)),_.merge(c.mailQueues[e.id],_.pick(e,m)))},c.onSaveMailQueue=function(e){_.isNil(e)||(c.rpcMailQueues[e.id]=_.pick(e,m))},c.onUpdateMailQueue=function(e){_.isNil(e)||(c.rpcMailQueues[e.id]&&_.merge(c.rpcMailQueues[e.id],_.pick(e,m)),c.mailQueues[e.id]&&_.merge(c.mailQueues[e.id],_.pick(e,m)))},c.onRemoveMailQueue=function(e){_.isNil(e)||(delete c.rpcMailQueues[e.id],delete c.mailQueues[e.id])},c.onSaveUserMailQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getMailQueues()},c.onRemoveUserMailQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getMailQueues()},c.onSaveMailQueueChannel=function(e){c.mailQueues[e.queue_id]&&(c.rpcMailQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveMailQueueChannel=function(e){delete c.rpcMailQueuesWaitingInteractions[e.id],u&&c.deleteMailQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("mail_queue:save",c.onSaveQueue),l.onWithoutApply("mailQueue:save",c.onSaveMailQueue),l.onWithoutApply("mailQueue:update",c.onUpdateMailQueue),l.onWithoutApply("mailQueue:remove",c.onRemoveMailQueue),l.onWithoutApply("userMailQueue:save",c.onSaveUserMailQueue),l.onWithoutApply("userMailQueue:remove",c.onRemoveUserMailQueue),l.onWithoutApply("mail_queue_waiting_interaction:save",c.onSaveMailQueueChannel),l.onWithoutApply("mail_queue_waiting_interaction:remove",c.onRemoveMailQueueChannel),o.rpc.getMailQueues().$promise.then(function(e){c.rpcMailQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"mail"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getMailQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcMailQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteMailQueuesWaitingInteractions.length;e+=1)delete c.rpcMailQueuesWaitingInteractions[c.deleteMailQueuesWaitingInteractions[e]];u=!1,c.deleteMailQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getMailQueues())}),e.$on("$destroy",function(){l.removeAllListeners("mail_queue:save"),l.removeAllListeners("mailQueue:save"),l.removeAllListeners("mailQueue:update"),l.removeAllListeners("mailQueue:remove"),l.removeAllListeners("userMailQueue:save"),l.removeAllListeners("userMailQueue:remove"),l.removeAllListeners("mail_queue_waiting_interaction:save"),l.removeAllListeners("mail_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelMailController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcOpenchannelQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.openchannelQueuesTotal=e.count?e.count:0,c.openchannelQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.openchannelQueues,function(e,n){c.rpcOpenchannelQueues[n]&&(c.openchannelQueues[n].waiting=c.rpcOpenchannelQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.openchannelQueues={},c.openchannelQueuesTotal=0,c.rpcOpenchannelQueues={},c.paginatedInteractions=[],c.deleteOpenchannelQueuesWaitingInteractions=[],c.rpcOpenchannelQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"openchannel",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getOpenchannelQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.openchannelQueues[e.id]&&c.rpcOpenchannelQueues[e.id]&&(_.merge(c.rpcOpenchannelQueues[e.id],_.pick(e,m)),_.merge(c.openchannelQueues[e.id],_.pick(e,m)))},c.onSaveOpenchannelQueue=function(e){_.isNil(e)||(c.rpcOpenchannelQueues[e.id]=_.pick(e,m))},c.onUpdateOpenchannelQueue=function(e){_.isNil(e)||(c.rpcOpenchannelQueues[e.id]&&_.merge(c.rpcOpenchannelQueues[e.id],_.pick(e,m)),c.openchannelQueues[e.id]&&_.merge(c.openchannelQueues[e.id],_.pick(e,m)))},c.onRemoveOpenchannelQueue=function(e){_.isNil(e)||(delete c.rpcOpenchannelQueues[e.id],delete c.openchannelQueues[e.id])},c.onSaveUserOpenchannelQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getOpenchannelQueues()},c.onRemoveUserOpenchannelQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getOpenchannelQueues()},c.onSaveOpenchannelQueueChannel=function(e){c.openchannelQueues[e.queue_id]&&(c.rpcOpenchannelQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveOpenchannelQueueChannel=function(e){delete c.rpcOpenchannelQueuesWaitingInteractions[e.id],u&&c.deleteOpenchannelQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("openchannel_queue:save",c.onSaveQueue),l.onWithoutApply("openchannelQueue:save",c.onSaveOpenchannelQueue),l.onWithoutApply("openchannelQueue:update",c.onUpdateOpenchannelQueue),l.onWithoutApply("openchannelQueue:remove",c.onRemoveOpenchannelQueue),l.onWithoutApply("userOpenchannelQueue:save",c.onSaveUserOpenchannelQueue),l.onWithoutApply("userOpenchannelQueue:remove",c.onRemoveUserOpenchannelQueue),l.onWithoutApply("openchannel_queue_waiting_interaction:save",c.onSaveOpenchannelQueueChannel),l.onWithoutApply("openchannel_queue_waiting_interaction:remove",c.onRemoveOpenchannelQueueChannel),o.rpc.getOpenchannelQueues().$promise.then(function(e){c.rpcOpenchannelQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"openchannel"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getOpenchannelQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcOpenchannelQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteOpenchannelQueuesWaitingInteractions.length;e+=1)delete c.rpcOpenchannelQueuesWaitingInteractions[c.deleteOpenchannelQueuesWaitingInteractions[e]];u=!1,c.deleteOpenchannelQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getOpenchannelQueues())}),e.$on("$destroy",function(){l.removeAllListeners("openchannel_queue:save"),l.removeAllListeners("openchannelQueue:save"),l.removeAllListeners("openchannelQueue:update"),l.removeAllListeners("openchannelQueue:remove"),l.removeAllListeners("userOpenchannelQueue:save"),l.removeAllListeners("userOpenchannelQueue:remove"),l.removeAllListeners("openchannel_queue_waiting_interaction:save"),l.removeAllListeners("openchannel_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelOpenchannelController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcSmsQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.smsQueuesTotal=e.count?e.count:0,c.smsQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.smsQueues,function(e,n){c.rpcSmsQueues[n]&&(c.smsQueues[n].waiting=c.rpcSmsQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.smsQueues={},c.smsQueuesTotal=0,c.rpcSmsQueues={},c.paginatedInteractions=[],c.deleteSmsQueuesWaitingInteractions=[],c.rpcSmsQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"sms",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getSmsQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.smsQueues[e.id]&&c.rpcSmsQueues[e.id]&&(_.merge(c.rpcSmsQueues[e.id],_.pick(e,m)),_.merge(c.smsQueues[e.id],_.pick(e,m)))},c.onSaveSmsQueue=function(e){_.isNil(e)||(c.rpcSmsQueues[e.id]=_.pick(e,m))},c.onUpdateSmsQueue=function(e){_.isNil(e)||(c.rpcSmsQueues[e.id]&&_.merge(c.rpcSmsQueues[e.id],_.pick(e,m)),c.smsQueues[e.id]&&_.merge(c.smsQueues[e.id],_.pick(e,m)))},c.onRemoveSmsQueue=function(e){_.isNil(e)||(delete c.rpcSmsQueues[e.id],delete c.smsQueues[e.id])},c.onSaveUserSmsQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getSmsQueues()},c.onRemoveUserSmsQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getSmsQueues()},c.onSaveSmsQueueChannel=function(e){c.smsQueues[e.queue_id]&&(c.rpcSmsQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveSmsQueueChannel=function(e){delete c.rpcSmsQueuesWaitingInteractions[e.id],u&&c.deleteSmsQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("sms_queue:save",c.onSaveQueue),l.onWithoutApply("smsQueue:save",c.onSaveSmsQueue),l.onWithoutApply("smsQueue:update",c.onUpdateSmsQueue),l.onWithoutApply("smsQueue:remove",c.onRemoveSmsQueue),l.onWithoutApply("userSmsQueue:save",c.onSaveUserSmsQueue),l.onWithoutApply("userSmsQueue:remove",c.onRemoveUserSmsQueue),l.onWithoutApply("sms_queue_waiting_interaction:save",c.onSaveSmsQueueChannel),l.onWithoutApply("sms_queue_waiting_interaction:remove",c.onRemoveSmsQueueChannel),o.rpc.getSmsQueues().$promise.then(function(e){c.rpcSmsQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"sms"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getSmsQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcSmsQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteSmsQueuesWaitingInteractions.length;e+=1)delete c.rpcSmsQueuesWaitingInteractions[c.deleteSmsQueuesWaitingInteractions[e]];u=!1,c.deleteSmsQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getSmsQueues())}),e.$on("$destroy",function(){l.removeAllListeners("sms_queue:save"),l.removeAllListeners("smsQueue:save"),l.removeAllListeners("smsQueue:update"),l.removeAllListeners("smsQueue:remove"),l.removeAllListeners("userSmsQueue:save"),l.removeAllListeners("userSmsQueue:remove"),l.removeAllListeners("sms_queue_waiting_interaction:save"),l.removeAllListeners("sms_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelSmsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l){var d=this,c=["type","waiting","dialMethod","dialActive"];function m(e){d.voiceQueuesTotal=e.count?e.count:0,d.voiceQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(d.voiceQueues,function(e,n){d.rpcVoiceQueues[n]&&(d.voiceQueues[n].waiting=d.rpcVoiceQueues[n].waiting||0)})}d.voiceQueues={},d.voiceQueuesTotal=0,d.rpcVoiceQueues={},d.getVoiceQueues={},d.rpcVoiceQueuesChannels={},d.addVoiceQueuesChannels={},d.deleteVoiceQueuesChannels=[],d.load=!0,d.query={id:r.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",type:"inbound",limit:10,page:1},d.queryChannels={limit:10,page:1},d.success=m,d.getVoiceQueues=function(){d.query.offset=(d.query.page-1)*d.query.limit,d.promise=o.user.getQueues(d.query,m).$promise},d.getSize=function(e){return _.size(e)},d.onSaveQueue=function(e){d.voiceQueues[e.id]&&d.rpcVoiceQueues[e.id]&&(d.rpcVoiceQueues[e.id]=e,_.merge(d.voiceQueues[e.id],_.pick(e,c)))},d.onSaveChannel=function(e){"inbound"===e.type&&(e.queuecallerleaveAt?(delete d.rpcVoiceQueuesChannels[e.uniqueid],d.load&&d.deleteVoiceQueuesChannels.push(e.uniqueid)):(d.rpcVoiceQueuesChannels[e.uniqueid]=e,d.load&&(d.addVoiceQueuesChannels[e.uniqueid]=e)))},d.onUserVoiceQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&d.getVoiceQueues()},d.onSaveVoiceQueue=function(e){_.isNil(e)||(d.rpcVoiceQueues[e.id]=_.pick(e,c))},d.onUpdateVoiceQueue=function(e){_.isNil(e)||(d.rpcVoiceQueues[e.id]&&_.merge(d.rpcVoiceQueues[e.id],_.pick(e,c)),d.voiceQueues[e.id]&&_.merge(d.voiceQueues[e.id],_.pick(e,c)))},d.onRemoveVoiceQueue=function(e){_.isNil(e)||(delete d.rpcVoiceQueues[e.id],delete d.voiceQueues[e.id])},l.onWithoutApply("voice_queue:save",d.onSaveQueue),l.onWithoutApply("voice_queue_channel:save",d.onSaveChannel),l.onWithoutApply("voice_queue_channel:remove",function(e){"inbound"===e.type&&delete d.rpcVoiceQueuesChannels[e.uniqueid]}),l.onWithoutApply("userVoiceQueue:save",d.onUserVoiceQueue),l.onWithoutApply("userVoiceQueue:remove",d.onUserVoiceQueue),l.onWithoutApply("voiceQueue:save",d.onSaveVoiceQueue),l.onWithoutApply("voiceQueue:remove",d.onRemoveVoiceQueue),l.onWithoutApply("voiceQueue:update",d.onUpdateVoiceQueue),o.user.getQueues(d.query).$promise.then(function(e){return d.myQueues=e,d.myQueues.count=e.rows.length,o.rpc.getVoiceQueues().$promise}).then(function(e){for(var n=e.rows,t=_.keyBy(n,"id"),a=0;a<d.myQueues.count;a++){var i=d.myQueues.rows[a];d.rpcVoiceQueues[i.id]=t[i.id]}return o.rpc.getVoiceQueuesChannels().$promise}).then(function(e){d.rpcVoiceQueuesChannels=e?_.keyBy(e.rows?_.filter(e.rows,function(e){return!("inbound"!==e.type||e.queuecallerleaveAt||!_.find(d.myQueues.rows,{name:e.queue}))}):[],"uniqueid"):{}}).catch(function(e){console.error(e)}).finally(function(){_.merge(d.rpcVoiceQueuesChannels,d.addVoiceQueuesChannels);for(var e=0;e<d.deleteVoiceQueuesChannels.length;e+=1)delete d.rpcVoiceQueuesChannels[d.deleteVoiceQueuesChannels[e]];d.load=!1,d.addVoiceQueuesChannels={},d.deleteVoiceQueuesChannels=[],d.getVoiceQueues()});var u=!0,p=1;e.$watch("vm_dc.query.filter",function(e,n){u?t(function(){u=!1}):(n||(p=d.query.page),e!==n&&(d.query.page=1),e||(d.query.page=p),d.getVoiceQueues())}),e.$on("$destroy",function(){l.removeAllListeners("voice_queue:save"),l.removeAllListeners("voice_queue_channel:save"),l.removeAllListeners("userVoiceQueue:save"),l.removeAllListeners("userVoiceQueue:remove"),l.removeAllListeners("voiceQueue:save"),l.removeAllListeners("voiceQueue:update"),l.removeAllListeners("voiceQueue:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket"],angular.module("app.dashboards").controller("AgentHomeDashboardVoiceController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["id","name","mapAgentsId","waiting"],u=!0;function p(){var e=(c.queryChannels.page-1)*c.queryChannels.limit;c.paginatedInteractions=_.orderBy(c.rpcWhatsappQueuesWaitingInteractions,["joinAt"],["desc"]),c.interactions=_.drop(c.paginatedInteractions,e).slice(0,c.queryChannels.limit)}function g(e){c.whatsappQueuesTotal=e.count?e.count:0,c.whatsappQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{},_.forIn(c.whatsappQueues,function(e,n){c.rpcWhatsappQueues[n]&&(c.whatsappQueues[n].waiting=c.rpcWhatsappQueues[n].waiting||0)})}function v(){c.query.offset=(c.query.page-1)*c.query.limit,c.promise=o.user.getQueues(c.query,g).$promise}c.whatsappQueues={},c.whatsappQueuesTotal=0,c.rpcWhatsappQueues={},c.paginatedInteractions=[],c.deleteWhatsappQueuesWaitingInteractions=[],c.rpcWhatsappQueuesWaitingInteractions={},c.query={id:r.getCurrentUser().id,channel:"whatsapp",fields:"id,name,mapAgentsId,waiting",limit:10,page:1},c.queryChannels={limit:10,page:1},c.success=g,c.getWhatsappQueues=v,c.getSize=function(e){return _.size(e)},c.getColorByChannel=function(e){switch(e){case"chat":return"green-A700-bg";case"mail":return"teal-bg";case"sms":return"orange-bg";case"whatsapp":return"lime-A700-bg";case"openchannel":return"amber-A200-bg";case"fax":return"blue-grey-A200-bg";default:return"white-bg"}},c.paginate=p,c.onSaveQueue=function(e){c.whatsappQueues[e.id]&&c.rpcWhatsappQueues[e.id]&&(_.merge(c.rpcWhatsappQueues[e.id],_.pick(e,m)),_.merge(c.whatsappQueues[e.id],_.pick(e,m)))},c.onSaveWhatsappQueue=function(e){_.isNil(e)||(c.rpcWhatsappQueues[e.id]=_.pick(e,m))},c.onUpdateWhatsappQueue=function(e){_.isNil(e)||(c.rpcWhatsappQueues[e.id]&&_.merge(c.rpcWhatsappQueues[e.id],_.pick(e,m)),c.whatsappQueues[e.id]&&_.merge(c.whatsappQueues[e.id],_.pick(e,m)))},c.onRemoveWhatsappQueue=function(e){_.isNil(e)||(delete c.rpcWhatsappQueues[e.id],delete c.whatsappQueues[e.id])},c.onSaveUserWhatsappQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getWhatsappQueues()},c.onRemoveUserWhatsappQueue=function(e){_.toInteger(e.UserId)===r.getCurrentUser().id&&c.getWhatsappQueues()},c.onSaveWhatsappQueueChannel=function(e){c.whatsappQueues[e.queue_id]&&(c.rpcWhatsappQueuesWaitingInteractions[e.id]=e,p())},c.onRemoveWhatsappQueueChannel=function(e){delete c.rpcWhatsappQueuesWaitingInteractions[e.id],u&&c.deleteWhatsappQueuesWaitingInteractions.push(e.id);p()},l.onWithoutApply("whatsapp_queue:save",c.onSaveQueue),l.onWithoutApply("whatsappQueue:save",c.onSaveWhatsappQueue),l.onWithoutApply("whatsappQueue:update",c.onUpdateWhatsappQueue),l.onWithoutApply("whatsappQueue:remove",c.onRemoveWhatsappQueue),l.onWithoutApply("userWhatsappQueue:save",c.onSaveUserWhatsappQueue),l.onWithoutApply("userWhatsappQueue:remove",c.onRemoveUserWhatsappQueue),l.onWithoutApply("whatsapp_queue_waiting_interaction:save",c.onSaveWhatsappQueueChannel),l.onWithoutApply("whatsapp_queue_waiting_interaction:remove",c.onRemoveWhatsappQueueChannel),o.rpc.getWhatsappQueues().$promise.then(function(e){c.rpcWhatsappQueues=e?_.keyBy(e.rows?e.rows:[],"id"):{}}).then(function(e){return o.user.getQueues({id:r.getCurrentUser().id,channel:"whatsapp"}).$promise}).then(function(e){return c.myQueues=e.rows,o.rpc.getWhatsappQueuesWaitingInteractions().$promise}).then(function(e){var n=_.filter(e.rows,function(e){return _.find(c.myQueues,{id:e.queue_id})});e.rows=n,e.count=n.length,_.merge(c.rpcWhatsappQueuesWaitingInteractions,e?_.keyBy(e.rows?e.rows:[],"id"):{})}).catch(function(e){console.error(e)}).finally(function(){for(var e=0;e<c.deleteWhatsappQueuesWaitingInteractions.length;e+=1)delete c.rpcWhatsappQueuesWaitingInteractions[c.deleteWhatsappQueuesWaitingInteractions[e]];u=!1,c.deleteWhatsappQueuesWaitingInteractions=[],v(),p()});var h=!0,f=1;e.$watch("vm_dc.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),c.getWhatsappQueues())}),e.$on("$destroy",function(){l.removeAllListeners("whatsapp_queue:save"),l.removeAllListeners("whatsappQueue:save"),l.removeAllListeners("whatsappQueue:update"),l.removeAllListeners("whatsappQueue:remove"),l.removeAllListeners("userWhatsappQueue:save"),l.removeAllListeners("userWhatsappQueue:remove"),l.removeAllListeners("whatsapp_queue_waiting_interaction:save"),l.removeAllListeners("whatsapp_queue_waiting_interaction:remove")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","Auth","socket","toasty"],angular.module("app.dashboards").controller("AgentHomeDashboardMultiChannelWhatsappController",e)}(),function(){"use strict";function e(a,t,i,s,o,n,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.faxInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,FaxAccountId:[]},g.sectionColor="blue-grey",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getFaxAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.faxAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"FaxAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.faxAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"FaxAccountId",type:"multiselect",options:{route:{model:"user",action:"getFaxAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("fax",g.query,g.user.id,g.faxAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("faxInteraction:save",O),d.on("faxInteraction:update",O),d.on("faxInteractionTags:save",C),d.on("faxMessage:save",w),d.on("faxMessage:update",w),d.on("user_has_fax_interactions:save",T),d.on("user_has_fax_interactions:remove",I),d.on("userFaxAccount:save",f),d.on("userFaxAccount:remove",b)})},g.success=E,g.getFaxInteractions=y,g.showFaxInteraction=function(e,n){a.$parent.vm.addInteractionTab("fax",n)},g.downloadFaxInteraction=function(e,s,n){r.faxInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="fax-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadFaxInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"fax",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?n.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return n.instant("DASHBOARDS.NOT_ASSIGNED")},g.getFaxAccountLabel=function(e){if(e.Account)return e.Account.key;return n.instant("DASHBOARDS.UNKNOWN")},g.composeFaxInteraction=function(e,t){i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.faxAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.fax"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.fax");function h(e){return{accounts:g.faxAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.FaxAccountId);u.addAccount("fax",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.FaxAccountId);u.removeAccount("fax",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.faxAccounts.rows,function(e){return{model:"faxAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.faxInteractionsReloadTimeout&&function(e){e&&g.interactionsInterval&&t.cancel(g.interactionsInterval);g.interactionsInterval=t(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.faxInteractionsReloadTimeout)}(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.faxInteractions=e||{count:0,rows:[]};for(var n=0;n<g.faxInteractions.rows.length;n+=1)S(g.faxInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=o.localStorage.getItem("motion2.home.fax:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,o.localStorage.setItem("motion2.home.fax:"+g.user.id,JSON.stringify(n)),g.promise=r.faxInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.fax:void 0,"Unknown"===e.contactName&&(e.contactName=n.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.faxInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.faxInteractions.rows=_.orderBy(g.faxInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else y(g.query.page)}}function C(e){if(e){var n=_.find(g.faxInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.faxInteractions.rows,{id:e.FaxInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}a.$on("$destroy",function(){d.removeAllListeners("faxMessage:save"),d.removeAllListeners("faxMessage:update"),d.removeAllListeners("faxInteraction:save"),d.removeAllListeners("faxInteractionTags:save"),d.removeAllListeners("faxInteraction:update"),d.removeAllListeners("user_has_fax_interactions:save"),d.removeAllListeners("user_has_fax_interactions:remove"),g.interactionsInterval&&t.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeFaxController",e)}(),function(){"use strict";function e(o,n,r,l,m,t,e,d,a,i,c,u,s,p,g){var v=this;v.user=a.getCurrentUser(),v.license={},v.setting={},v.tags={count:0,rows:[]},v.mailInteractions={count:0,rows:[]},v.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,MailAccountId:[]},v.sectionColor="teal",v.onInit=function(e,n){return v.license=e,v.setting=n,d.user.getMailAccounts({id:v.user.id,nolimit:!0}).$promise.then(function(e){return v.mailAccounts=e||{count:0,rows:[]},d.tag.get({sort:"name"}).$promise}).then(function(e){v.tags=e||{count:0,rows:[]}}).then(function(){return d.mailSubstatus.get({nolimit:!0}).$promise}).then(function(e){v.subStatuses=e||{count:0,rows:[]}}).then(function(){v.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Substatus",key:"substatus",type:"select",label:"DASHBOARDS.SELECT_SUBSTATUS",options:v.subStatuses.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NONE"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name",ngIf:"closed === 0"},{name:"Account",key:"MailAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:v.mailAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:v.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:v.tags.rows,placeholder:"DASHBOARDS.TAGS"}],v.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"plainBody",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Substatus",column:"substatus",type:"multiselect",options:{field:"name",route:{model:"mailSubstatus",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"MailAccountId",type:"multiselect",options:{route:{model:"user",action:"getMailAccounts",params:{id:v.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:E("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:E("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:E("third")}}]}}).catch(function(e){h.error(e)}).finally(function(){s.parseInteractionsKey("mail",v.query,v.user.id,v.mailAccounts.rows).then(function(){v.isSearchBarVisible=!(v.query.search||!v.query.filter),S(v.query.page)}),i.on("mailInteraction:save",w),i.on("mailInteraction:update",w),i.on("mailInteractionTags:save",R),i.on("mailMessage:save",x),i.on("mailMessage:update",x),i.on("user_has_mail_interactions:save",O),i.on("user_has_mail_interactions:remove",C),i.on("userMailAccount:save",b),i.on("userMailAccount:remove",A),0<v.setting.mailInteractionsReloadTimeout&&N()})},v.success=y,v.getMailInteractions=S,v.showMailInteraction=T,v.downloadMailInteraction=function(e,s,n){d.mailInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="mail-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadMailInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.disposeInteraction=function(e,n){var t=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause,a=!n.Account.mandatoryDisposition;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){v.user&&n.Account.mandatoryDisposition&&!t&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},locals:{user:v.user,channel:"mail",interaction:n}})},v.getContactLabel=I,v.getAgentLabel=function(e){if(e.UserId)return e.UserId===v.user.id?t.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return t.instant("DASHBOARDS.NOT_ASSIGNED")},v.getMailAccountLabel=function(e){if(e.Account)return e.Account.key;return t.instant("DASHBOARDS.UNKNOWN")},v.composeMailInteraction=function(e,s){r.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{account:s,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){if(!e.message||!e.message.savedAsDraft){var i=e;return d.mailAccount.send({id:s.id},i).$promise.then(function(e){if(e&&e.Messages&&e.Messages.length){if(i.attachments&&i.attachments.length)for(var n=0;n<i.attachments.length;n+=1)d.attachment.update({id:i.attachments[n].id},{MailMessageId:_.head(e.Messages).id});if(c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed){e.disposition=null;var t=!s.mandatoryDisposition,a=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),onRemoving:function(){v.user&&s.mandatoryDisposition&&!a&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},clickOutsideToClose:t,escapeToClose:t,locals:{user:v.user,channel:"mail",interaction:e}})}else o.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"MAILACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}var n={channel:"mail",account:s,message:e.message,contact:e.contact};u.add(n)}})},v.openAdvancedSearch=function(){r.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{color:v.sectionColor,fields:v.advancedSearch.fields,storagePath:"home.mail"},fullscreen:!0}).then(function(e){v.isSearchBarVisible=!(e.value||!v.query.filter),e.apply&&(v.query.search=e.value,S())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var h=g.getLogger("agent.general.mail");function f(e){return{accounts:v.mailAccounts,accountId:e,filters:v.quickFilters,query:v.query,userId:v.user.id}}function b(e){if(e.UserId===v.user.id){var n=f(e.MailAccountId);p.addAccount("mail",n).then(function(e){e&&S()}).catch(function(e){h.error(e)})}}function A(e){if(e.UserId===v.user.id){var n=f(e.MailAccountId);p.removeAccount("mail",n).catch(function(e){h.error(e)})}}function E(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(v.mailAccounts.rows,function(e){return{model:"mailAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function y(e){!v.reloadingInteractions&&0<v.setting.mailInteractionsReloadTimeout&&N(!0),v.searchInProgress=!1,v.reloadingInteractions=!1,v.mailInteractions=e||{count:0,rows:[]};for(var n=0;n<v.mailInteractions.rows.length;n+=1)I(v.mailInteractions.rows[n])}function S(e){v.searchInProgress=!0,e||(v.query.page=1),(void 0===v.query.closed||null===v.query.closed||v.query.closed)&&delete v.query.substatus,v.query.offset=(v.query.page-1)*v.query.limit;var n=m.localStorage.getItem("motion2.home.mail:"+v.user.id);(n=n?JSON.parse(n):{}).query=v.query,m.localStorage.setItem("motion2.home.mail:"+v.user.id,JSON.stringify(n)),v.promise=d.mailInteraction.get(v.query,y).$promise}function T(e,n){o.$parent.vm.addInteractionTab("mail",n)}function I(e){_.isEmpty(e.to)||!e.Account||_.includes(e.to,e.Account.email)?e.contactInfo=e.Contact?e.Contact.email:void 0:e.contactInfo=e.to.split("<").pop().split(">")[0],"Unknown"===e.contactName&&(e.contactName=t.instant("DASHBOARDS.UNKNOWN"))}function O(e){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function C(e){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function w(e){if(e){var n=_.find(v.mailInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),v.query.sort){var t=_.startsWith(v.query.sort,"-")?"desc":"asc";v.mailInteractions.rows=_.orderBy(v.mailInteractions.rows,_.trimStart(v.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===v.setting.mailInteractionsReloadTimeout&&S(v.query.page)}}function R(e){if(e){var n=_.find(v.mailInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function x(e){if(e&&!e.secret){var n=_.find(v.mailInteractions.rows,{id:e.MailInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function N(e){e&&v.interactionsInterval&&n.cancel(v.interactionsInterval),v.interactionsInterval=n(function(){v.reloadingInteractions=!0,v.searchInProgress||S()},1e3*v.setting.mailInteractionsReloadTimeout)}o.$on("openMailDraft",function(e,s){s.interaction?(s.interaction.isDraft=!0,T(null,s.interaction)):r.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(l.body),clickOutsideToClose:!1,locals:{account:s.account,message:s.content,type:"draft",interaction:{}},fullscreen:!0}).then(function(e){if(e){if(!e.message||!e.message.savedAsDraft){var i=e;return d.mailAccount.send({id:s.account.id},i).$promise.then(function(e){if(u.remove(s.id),e&&e.Messages&&e.Messages.length){if(i.attachments&&i.attachments.length)for(var n=0;n<i.attachments.length;n+=1)d.attachment.update({id:i.attachments[n].id},{MailMessageId:_.head(e.Messages).id});if(c.success({title:"Message properly sent!",msg:"Message has been sent!"}),e.closed){e.disposition=null;var t=!s.account.mandatoryDisposition,a=v.user.voicePause||v.user.chatPause||v.user.mailPause||v.user.openchannelPause||v.user.faxPause;r.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(l.body),onRemoving:function(){v.user&&s.account.mandatoryDisposition&&!a&&d.user.unpause({id:v.user.id}).$promise.catch(function(e){h.error(e)})},clickOutsideToClose:t,escapeToClose:t,locals:{user:v.user,channel:"mail",interaction:e}})}else o.$parent.vm.addInteractionTab("mail",e)}}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"MAILACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}var n={id:s.id,channel:"mail",account:e.account,message:e.message};u.update(n)}})}),v.resetTooltipPosition=function(e){var n=angular.element(e.currentTarget).children()[1],t=angular.element(n);t.css("top",""),t.css("left",""),t.css("bottom","")},v.adjustTooltipPosition=function(e){var n=angular.element(e.currentTarget).children(),t=n[0],a=n[1],i=angular.element(t),s=angular.element(a),o=m.innerHeight,r=i.offset(),l=r.top,d=r.left,c=o<216+l;s.css("left",d),c?(s.css("top",""),s.css("bottom",o-l)):(s.css("bottom",""),s.css("top",l))},o.$on("$destroy",function(){i.removeAllListeners("mailMessage:save"),i.removeAllListeners("mailMessage:update"),i.removeAllListeners("mailInteraction:save"),i.removeAllListeners("mailInteractionTags:save"),i.removeAllListeners("mailInteraction:update"),i.removeAllListeners("user_has_mail_interactions:save"),i.removeAllListeners("user_has_mail_interactions:remove"),v.interactionsInterval&&n.cancel(v.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","draftManager","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeMailController",e)}(),function(){"use strict";function e(t,a,e,i,n,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.contacts=e||{count:0,rows:[]}}function c(e,n){l.searchInProgress=!0,s.cmContact.describe({id:l.query.ListId}).$promise.then(function(e){return _(e.toJSON()).omit("UserId").values().map(function(e){return function(e){var n={name:_.startCase(e.displayName),column:e.columnName,options:{}};if(e.custom)switch(e.custom.type){case"text":n.type="text";break;case"select":n.type="multiselect",n.values=_.map(JSON.parse(e.custom.values),function(e,n){return{id:n,name:e.value,value:e.value}}),n.options.field="name";break;case"switch":n.type="select",n.values=[{id:1,translate:"DASHBOARDS.ENABLED"},{id:0,translate:"DASHBOARDS.DISABLED"}],n.options.excludedOperators=["$ne"];break;case"number":n.type="number";break;case"datetime":n.type="date"}else switch(e.columnName){case"dateOfBirth":n.type="date";break;case"CompanyId":n.name="Company",n.type="autocomplete",n.options.route={model:"cmCompany",action:"get",params:{fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;case"ListId":n.name="List",n.type="autocomplete",n.options.route={model:"user",action:"getLists",params:{id:l.currentUser.id,fields:"id,name",nolimit:!0}},n.options.searchFields=["name"],n.options.excludedOperators=["$ne"];break;default:_.includes(e.type.toLowerCase(),"int")?n.type="number":_.includes(e.type.toLowerCase(),"date")?n.type="date":n.type="text"}return n}(e)}).value()}).then(function(e){l.advancedSearch.fields=e;var n=_.findIndex(e,function(e){return _.startsWith(e.column,"cf_")})||e.length-1;n<0&&(n=e.length),l.advancedSearch.fields.splice(n,0,{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"DESCRIBE_CM_CONTACTS",msg:e.data?JSON.stringify(e.data.message):e.toString()})}),e||(l.query.page=1),l.query.offset=(l.query.page-1)*l.query.limit;var t=o.localStorage.getItem("motion2.home.mycontacts:"+l.currentUser.id);(t=t?JSON.parse(t):{}).query=l.query,o.localStorage.setItem("motion2.home.mycontacts:"+l.currentUser.id,JSON.stringify(t)),l.query.search&&(l.advancedQuery=_.omit(l.query,"id")),l.promise=l.query.search?s.cmContact.get(l.advancedQuery,d).$promise:s.user.getContacts(l.query,d).$promise}l.currentUser=n.getCurrentUser(),l.lists={},l.contacts={count:0,rows:[]},l.tags={count:0,rows:[]},l.query={includeAll:!0,id:l.currentUser.id,sort:"-updatedAt",limit:10,page:1},l.advancedSearch={fields:[]},l.sectionColor="red",l.getContacts=c,l.refreshContacts=function(){c()},l.mergeContact=function(e,n){i.show({controller:"MergeContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/merge/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.duplicateContact=function(e,n){i.show({controller:"DuplicateContactDialogController",controllerAs:"vm",templateUrl:"app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{contact:["apiResolver",function(e){return e.resolve("cmContact@get",{id:n.id})}],lists:["apiResolver",function(e){return e.resolve("user@getLists",{id:l.currentUser.id,fields:"id,name"})}]},locals:{contacts:l.contacts.rows}})},l.openContact=function(e,n){a.$parent.vm.addContactTab(n)},l.call=a.$parent.vm.call,l.onInit=function(){s.cmList.get({fields:"id,name,dialPrefix",sort:"name",nolimit:!0}).$promise.then(function(e){return l.lists=e||{count:0,rows:[]},l.listsMap=_.keyBy(l.lists.rows,"id"),s.tag.get({sort:"name"}).$promise}).then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"List",key:"ListId",type:"multiselect",label:"CONTACTMANAGER.SELECT_LIST",options:l.lists.rows,clearAll:!1},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:l.tags.rows,placeholder:"DASHBOARDS.TAGS"}]}).catch(function(e){console.error(e)}).finally(function(){var e=o.localStorage.getItem("motion2.home.mycontacts:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query),_.isEmpty(l.lists.rows)?l.query.ListId=[]:_.isEmpty(l.query.ListId)&&(l.query.ListId=_(l.lists.rows).map("id").take().value()))}catch(e){console.error(e)}else l.query.ListId=_.map(l.lists.rows,"id");l.isSearchBarVisible=!(l.query.search||!l.query.filter),c()})},l.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{color:l.sectionColor,fields:l.advancedSearch.fields,storagePath:"home.mycontacts"},fullscreen:!0}).then(function(e){l.isSearchBarVisible=!(e.value||!l.query.filter),e.apply&&(l.query.search=e.value?e.value+="||User:=$eq["+l.currentUser.id+"]":e.value,c())}).catch(function(e){r.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}}e.$inject=["$document","$scope","$timeout","$mdDialog","Auth","api","$window","toasty"],angular.module("app.dashboards").controller("AgentHomeMyContactsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.openchannelInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,OpenchannelAccountId:[]},g.sectionColor="amber",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getOpenchannelAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.openchannelAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"OpenchannelAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.openchannelAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"OpenchannelAccountId",type:"multiselect",options:{route:{model:"user",action:"getOpenchannelAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("openchannel",g.query,g.user.id,g.openchannelAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("openchannelInteraction:save",O),d.on("openchannelInteraction:update",O),d.on("openchannelInteractionTags:save",C),d.on("openchannelMessage:save",w),d.on("openchannelMessage:update",w),d.on("user_has_openchannel_interactions:save",T),d.on("user_has_openchannel_interactions:remove",I),d.on("userOpenchannelAccount:save",f),d.on("userOpenchannelAccount:remove",b),0<g.setting.openchannelInteractionsReloadTimeout&&R()})},g.success=E,g.getOpenchannelInteractions=y,g.showOpenchannelInteraction=function(e,n){a.$parent.vm.addInteractionTab("openchannel",n)},g.downloadOpenchannelInteraction=function(e,s,n){r.openchannelInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="openchannel-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadOpenchannelInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"openchannel",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getOpenchannelAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeOpenchannelInteraction=function(e,t){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.openchannelAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("openchannel",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"OPENCHANNELACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.openchannel"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.openchannel");function h(e){return{accounts:g.openchannelAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.OpenchannelAccountId);u.addAccount("openchannel",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.OpenchannelAccountId);u.removeAccount("openchannel",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.openchannelAccounts.rows,function(e){return{model:"openchannelAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.openchannelInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.openchannelInteractions=e||{count:0,rows:[]};for(var n=0;n<g.openchannelInteractions.rows.length;n+=1)S(g.openchannelInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.openchannel:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.openchannel:"+g.user.id,JSON.stringify(n)),g.promise=r.openchannelInteraction.get(g.query,E).$promise}function S(e){"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.openchannelInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.openchannelInteractions.rows=_.orderBy(g.openchannelInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.openchannelInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.openchannelInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.openchannelInteractions.rows,{id:e.OpenchannelInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.openchannelInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("openchannelMessage:save"),d.removeAllListeners("openchannelMessage:update"),d.removeAllListeners("openchannelInteraction:save"),d.removeAllListeners("openchannelInteractionTags:save"),d.removeAllListeners("openchannelInteraction:update"),d.removeAllListeners("user_has_openchannel_interactions:save"),d.removeAllListeners("user_has_openchannel_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeOpenchannelController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e,n,t){d.license=e,d.setting=n,d.plugin=t}d.currentUser=o.getCurrentUser(),d.plugin={},d.onInit=c,d.getTrustedURL=function(){return s.trustAsResourceUrl(d.plugin.agentUrl)},c(),n.$on("pluginUpdated",function(e,n){d.plugin=n.plugin})}e.$inject=["$document","$scope","$timeout","$mdDialog","$stateParams","$sce","Auth","api","$window"],angular.module("app.dashboards").controller("AgentHomePluginsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(){d.agentsQuery.offset=(d.agentsQuery.page-1)*d.agentsQuery.limit,l.update("motion2.home.presence.agents:"+d.currentUser.id,d.agentsQuery,"query"),i.user.getPresence(d.agentsQuery).$promise.then(function(e){d.agents={count:e.count,rows:_.filter(e.rows,function(e){return e.id!==d.currentUser.id})}}).catch(function(){r.error({title:t.instant("DASHBOARDS.AGENT_PRESENCE"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")})})}function m(){d.queuesQuery.offset=(d.queuesQuery.page-1)*d.queuesQuery.limit,l.update("motion2.home.presence.queues:"+d.currentUser.id,d.queuesQuery,"query"),i.voiceQueue.get(d.queuesQuery).$promise.then(function(e){return d.voiceQueues=e||{rows:[],count:0},i.rpc.getVoiceQueuesChannels().$promise.then(function(e){e.rows.forEach(function(e){var n=_.find(d.voiceQueues.rows,["name",e.name]);n&&(n.calls||(n.calls=[]),n.calls.push(e))})})}).catch(function(){r.error({title:t.instant("VOICE.VOICEQUEUES"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")})})}function u(e){return 0===d.selectedTab?e:"xcallyQueueExtension"+e}function p(e,n,t,a){var i=_.find(d.agents.rows,["id",e]);i&&(i.status=!1===n?"offline":a?"pause":"unavailable"===t?t:_.includes(["idle","unknown","ringing",null,void 0],t)?"online":"busy")}function g(e){e.id!==d.currentUser.id&&p(e.id,e.online,e.voiceStatus,e.voicePause)}d.currentUser=s.getCurrentUser(),d.agents={count:0,rows:[]},d.agentsQuery={fields:"id,name,internal,online",role:"agent",sort:"name",limit:10,page:1},d.queuesQuery={fields:"id,name",type:"inbound",sort:"name",limit:10,page:1},d.onAgentsTabSelection=function(){if(d.agentsQuery.filter||d.agentsQuery.teams||d.agentsQuery.queues)return;_.merge(d.agentsQuery,l.get("motion2.home.presence.agents:"+d.currentUser.id,"query")),d.isSearchBarVisible=!!d.agentsQuery.filter,a.all([a(function(n,e){i.team.get({fields:"id,name",sort:"name",nolimit:!0}).$promise.then(function(e){d.teams=e||{rows:[],count:0},n()}).catch(function(){r.error({title:t.instant("STAFF.TEAMS"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),e()})}),a(function(n,e){i.voiceQueue.get({fields:"id,name",type:"inbound",sort:"name",nolimit:!0}).$promise.then(function(e){d.queues=e||{rows:[],count:0},n()}).catch(function(){r.error({title:t.instant("VOICE.VOICEQUEUES"),msg:t.instant("CONTACTMANAGER.NOTIFICATIONS.NO_DATA_ERROR")}),e()})})]).then(function(){d.quickFilters=[{name:"Team",key:"teams",type:"multiselect",label:"DASHBOARDS.SELECT_TEAM",options:d.teams.rows},{name:"Queue",key:"queues",type:"multiselect",label:"DASHBOARDS.SELECT_QUEUE",options:d.queues.rows}],c()}).catch(function(){r.error({title:t.instant("DASHBOARDS.AGENT_PRESENCE"),msg:t.instant("DASHBOARDS.ERRORS.FAILED_INITIALIZATION")})})},d.onQueuesTabSelection=function(){if(d.queuesQuery.filter)return;_.merge(d.queuesQuery,l.get("motion2.home.presence.queues:"+d.currentUser.id,"query")),d.isSearchBarVisible=!!d.queuesQuery.filter,m()},d.getAgents=c,d.getVoiceQueues=m,d.originateCall=function(e){n.$broadcast("webrtc::call",{target:u(e)})},d.transferCall=function(e){n.$broadcast("webrtc::transfer",{target:u(e)})},o.on("user:presence",function(e){if(e.id===d.currentUser.id)return;p(e.id,e.online,e.voiceStatus,e.voicePause)}),o.on("user:update",g),o.on("voice_queue_presence:save",function(e){if(!d.voiceQueues&&d.voiceQueues.rows)return;var n=_.find(d.voiceQueues.rows,["name",e.name]);if(!n)return;n.calls||(n.calls=[]);if(_.some(n.calls,["uniqueid",e.uniqueid]))return;n.calls.push(e)}),o.on("voice_queue_presence:remove",function(e){var n=_.find(d.voiceQueues.rows,["name",e.name]);if(!n)return;_.remove(n.calls,["uniqueid",e.uniqueid])}),e.$on("$destroy",function(){o.removeListener("user:update",g),o.removeAllListeners("user:presence"),o.removeAllListeners("voice_queue_presence:save"),o.removeAllListeners("voice_queue_presence:remove")})}e.$inject=["$scope","$rootScope","$translate","$q","api","Auth","socket","toasty","localStorageManager"],angular.module("app.dashboards").controller("AgentHomePresenceController",e)}(),function(){"use strict";function e(e,t,n,a,o,i){var s=this;function r(e){s.searchInProgress=!1,s.voiceRecordings=e||{count:0,rows:[]}}function l(){s.searchInProgress=!0,s.query.offset=(s.query.page-1)*s.query.limit;var e={query:s.query};t.localStorage.setItem("motion2.home.recordings:"+s.currentUser.id,JSON.stringify(e)),s.promise=a.voiceRecording.get(s.query,r).$promise}s.currentUser=i.getCurrentUser(),s.voiceRecordings={},s.table="voiceRecordings",s.query={UserId:s.currentUser.id,fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,rating,audio,transcribeStatus,UserId",sort:"-updatedAt",limit:10,page:1,type:null},s.downloadfile=function(i,e){return a.voiceRecording.download({id:i.id,exists:!0}).$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download",i.uniqueid+i.format),a.click()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.downloadtranscribe=function(s,e){return a.voiceRecording.downloadTranscribe({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.success=r,s.getVoiceRecordings=l,s.onInit=function(){s.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Type",key:"type",type:"select",label:"VOICE.SELECT_TYPE",customOptions:[{value:"internal",translate:"VOICE.INTERNAL"},{value:"inbound",translate:"VOICE.INBOUND"},{value:"outbound",translate:"VOICE.OUTBOUND"},{value:"dialer",translate:"VOICE.DIALER"},{value:null,translate:"VOICE.ALL"}]}];var e=t.localStorage.getItem("motion2.home.recordings:"+s.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(s.query=_.merge(s.query,e.query))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};s.query.createdAt=n}s.isSearchBarVisible=!!s.query.filter,l()}}e.$inject=["$scope","$window","$timeout","api","toasty","Auth"],angular.module("app.dashboards").controller("AgentHomeRecordingsController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,r,n){var l=this;function d(e){l.searchInProgress=!1,l.scheduledCalls=e||{count:0,rows:[]}}l.currentUser=n.getCurrentUser(),l.priorities=["Lowest","Low","Medium","High","Highest"],l.crudPermissions={readOnly:!1,canEdit:!0,canDelete:!0},l.scheduledCalls={},l.query={id:l.currentUser.id,fields:"id,phone,scheduledat,recallme,priority,UserId,OwnerId,dialTimezone",sort:"scheduledat",limit:10,page:1},l.queueCampaigns={rows:[],count:0},l.success=d,l.getScheduledCalls=function(){l.searchInProgress=!0,l.query.id=l.currentUser.id,l.query.includeAll=!0,l.query.offset=(l.query.page-1)*l.query.limit,l.query.fields="id,phone,scheduledat,recallme,priority,UserId,OwnerId,dialTimezone";var e={query:l.query};t.localStorage.setItem("motion2.home.scheduled:"+l.currentUser.id,JSON.stringify(e)),l.promise=r.user.getScheduledCalls(l.query,d).$promise},l.onInit=function(){r.user.getQueues({id:n.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){l.queueCampaigns=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"Start Date",key:"scheduledat",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Campaigns",key:"VoiceQueueId",type:"multiselect",label:"MOTIONDIALER.SELECT_CAMPAIGN",options:l.queueCampaigns.rows}]}).catch(function(e){console.error(e)}).finally(function(){var e=t.localStorage.getItem("motion2.home.scheduled:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.omit(e.query,["filter"]))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};l.query.scheduledat=n}l.getScheduledCalls()})},l.isDateBeforeToday=function(e){return moment(e).isBefore(moment())},l.createOrEditQueueCampaignHopper=function(e,n){i.show({controller:"CreateOrEditHopperVoiceQueueIdDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:null,hopper:n,hoppers:l.scheduledCalls.rows,license:null,setting:null,crudPermissions:l.crudPermissions}})},l.deleteConfirm=function(n,e){var t=i.confirm().title("Are you sure want to delete the scheduled call?").htmlContent("<b>Scheduled call</b> will be deleted.").ariaLabel("delete scheduled call").targetEvent(e).ok("OK").cancel("CANCEL");i.show(t).then(function(){var e;e=n,r.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(l.scheduledCalls.rows,{id:e.id}),l.scheduledCalls.count-=1,l.scheduledCalls.rows.length||l.getScheduledCalls(),o.success({title:"Scheduled call deleted!",msg:e.name?"Scheduled call has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE_HOPPER"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETE_HOPPER",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})};var c=!0,m=1;e.$watch("vm.query.filter",function(e,n){c?a(function(){c=!1}):(n||(m=l.query.page),e!==n&&(l.query.page=1),e||(l.query.page=m),l.getScheduledCalls())})}e.$inject=["$scope","$window","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.dashboards").controller("AgentHomeScheduledCallsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.smsInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,SmsAccountId:[]},g.sectionColor="orange",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getSmsAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.smsAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"SmsAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.smsAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"SmsAccountId",type:"multiselect",options:{route:{model:"user",action:"getSmsAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("sms",g.query,g.user.id,g.smsAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("smsInteraction:save",O),d.on("smsInteraction:update",O),d.on("smsInteractionTags:save",C),d.on("smsMessage:save",w),d.on("smsMessage:update",w),d.on("user_has_sms_interactions:save",T),d.on("user_has_sms_interactions:remove",I),d.on("userSmsAccount:save",f),d.on("userSmsAccount:remove",b),0<g.setting.smsInteractionsReloadTimeout&&R()})},g.success=E,g.getSmsInteractions=y,g.showSmsInteraction=function(e,n){a.$parent.vm.addInteractionTab("sms",n)},g.downloadSmsInteraction=function(e,s,n){r.smsInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="sms-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadSmsInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"sms",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getSmsAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeSmsInteraction=function(e,t){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.smsAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("sms",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SMSACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.sms"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.sms");function h(e){return{accounts:g.smsAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.SmsAccountId);u.addAccount("sms",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.SmsAccountId);u.removeAccount("sms",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.smsAccounts.rows,function(e){return{model:"smsAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.smsInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.smsInteractions=e||{count:0,rows:[]};for(var n=0;n<g.smsInteractions.rows.length;n+=1)S(g.smsInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.sms:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.sms:"+g.user.id,JSON.stringify(n)),g.promise=r.smsInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.mobile:void 0,"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.smsInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.smsInteractions.rows=_.orderBy(g.smsInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.smsInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.smsInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.smsInteractions.rows,{id:e.SmsInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.smsInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("smsMessage:save"),d.removeAllListeners("smsMessage:update"),d.removeAllListeners("smsInteraction:save"),d.removeAllListeners("smsInteractionTags:save"),d.removeAllListeners("smsInteraction:update"),d.removeAllListeners("user_has_sms_interactions:save"),d.removeAllListeners("user_has_sms_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeSmsController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r){var l=this;function d(e){l.searchInProgress=!1,l.voiceCalls=e||{count:0,rows:[]}}function c(){l.searchInProgress=!0,l.query.offset=(l.query.page-1)*l.query.limit;var e={query:l.query};s.localStorage.setItem("motion2.home.voice:"+l.currentUser.id,JSON.stringify(e)),l.promise=a.voiceCallReport.get(l.query,d).$promise}l.currentUser=e.getCurrentUser(),l.voiceCalls={},l.table="voiceCalls",l.query={UserId:l.currentUser.id,fields:"id,type,uniqueid,tag,starttime,endtime,source,destination,userDisposition,userSecondDisposition,userThirdDisposition,note,duration,billableseconds,answertime",sort:"-updatedAt",limit:10,page:1,type:null},l.success=d,l.getVoiceCalls=c,l.onInit=function(){return a.tag.get({sort:"name"}).$promise.then(function(e){l.tags=e||{count:0,rows:[]}}).then(function(){l.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Type",key:"type",type:"select",label:"VOICE.SELECT_TYPE",customOptions:[{value:"internal",translate:"VOICE.INTERNAL"},{value:"inbound",translate:"VOICE.INBOUND"},{value:"outbound",translate:"VOICE.OUTBOUND"},{value:"dialer",translate:"VOICE.DIALER"},{value:null,translate:"VOICE.ALL"}]}]}).catch(function(e){i.error({title:"Init error",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}),l.tags={count:0,rows:[]}}).finally(function(){var e=s.localStorage.getItem("motion2.home.voice:"+l.currentUser.id);if(e)try{(e=JSON.parse(e)).query&&(l.query=_.merge(l.query,e.query))}catch(e){console.error(e)}else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};l.query.createdAt=n}l.isSearchBarVisible=!!l.query.filter,c()})},l.showDetails=function(e){n.show({controller:"AgentHomeVoiceDetailsController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,locals:{call:e}})}}e.$inject=["$mdDialog","$document","api","toasty","Auth","$window","$scope","$timeout"],angular.module("app.dashboards").controller("AgentHomeVoiceController",e)}(),function(){"use strict";function e(e,n){this.call=n,this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","call"],angular.module("app.dashboards").controller("AgentHomeVoiceDetailsController",e)}(),function(){"use strict";function e(a,n,i,s,t,o,e,r,l,d,c,m,u,p){var g=this;g.user=l.getCurrentUser(),g.license={},g.setting={},g.tags={count:0,rows:[]},g.whatsappInteractions={count:0,rows:[]},g.query={includeAll:!0,sort:"-updatedAt",limit:10,page:1,read:null,closed:null,WhatsappAccountId:[]},g.sectionColor="lime-A700",g.onInit=function(e,n){return g.license=e,g.setting=n,r.user.getWhatsappAccounts({id:g.user.id,nolimit:!0}).$promise.then(function(e){return g.whatsappAccounts=e||{count:0,rows:[]},r.tag.get({sort:"name"}).$promise}).then(function(e){g.tags=e||{count:0,rows:[]}}).then(function(){g.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Account",key:"WhatsappAccountId",type:"multiselect",label:"DASHBOARDS.SELECT_ACCOUNT",options:g.whatsappAccounts.rows,clearAll:!1},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:g.user.id,translate:"DASHBOARDS.ME"},{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:g.tags.rows,placeholder:"DASHBOARDS.TAGS"}],g.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Account",column:"WhatsappAccountId",type:"multiselect",options:{route:{model:"user",action:"getWhatsappAccounts",params:{id:g.user.id,nolimit:!0}}}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:A("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:A("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:A("third")}}]}}).catch(function(e){v.error(e)}).finally(function(){m.parseInteractionsKey("whatsapp",g.query,g.user.id,g.whatsappAccounts.rows).then(function(){g.isSearchBarVisible=!(g.query.search||!g.query.filter),y(g.query.page)}),d.on("whatsappInteraction:save",O),d.on("whatsappInteraction:update",O),d.on("whatsappInteractionTags:save",C),d.on("whatsappMessage:save",w),d.on("whatsappMessage:update",w),d.on("user_has_whatsapp_interactions:save",T),d.on("user_has_whatsapp_interactions:remove",I),d.on("userWhatsappAccount:save",f),d.on("userWhatsappAccount:remove",b),0<g.setting.whatsappInteractionsReloadTimeout&&R()})},g.success=E,g.getWhatsappInteractions=y,g.showWhatsappInteraction=function(e,n){a.$parent.vm.addInteractionTab("whatsapp",n)},g.downloadWhatsappInteraction=function(e,s,n){r.whatsappInteraction.download({id:s.id,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="whatsapp-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"downloadWhatsappInteraction",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.disposeInteraction=function(e,n){var t=g.user.voicePause||g.user.chatPause||g.user.mailPause||g.user.openchannelPause||g.user.faxPause,a=!n.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(s.body),clickOutsideToClose:a,escapeToClose:a,onRemoving:function(){g.user&&n.Account.mandatoryDisposition&&!t&&r.user.unpause({id:g.user.id}).$promise.catch(function(e){v.error(e)})},locals:{user:g.user,channel:"whatsapp",interaction:n}})},g.getContactLabel=S,g.getAgentLabel=function(e){if(e.UserId)return e.UserId===g.user.id?o.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">";return o.instant("DASHBOARDS.NOT_ASSIGNED")},g.getWhatsappAccountLabel=function(e){if(e.Account)return e.Account.key;return o.instant("DASHBOARDS.UNKNOWN")},g.composeWhatsappInteraction=function(e,t){i.show({controller:"ComposeWhatsappInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{account:t,message:{},type:"new",interaction:{}},fullscreen:!0}).then(function(e){if(e){var n=e;return r.whatsappAccount.send({id:t.id},n).$promise.then(function(e){c.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("whatsapp",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"WHATSAPPACCOUNT:SEND",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}})},g.openAdvancedSearch=function(){i.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(s.body),clickOutsideToClose:!1,locals:{color:g.sectionColor,fields:g.advancedSearch.fields,storagePath:"home.whatsapp"},fullscreen:!0}).then(function(e){g.isSearchBarVisible=!(e.value||!g.query.filter),e.apply&&(g.query.search=e.value,y())}).catch(function(e){c.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})};var v=p.getLogger("agent.general.whatsapp");function h(e){return{accounts:g.whatsappAccounts,accountId:e,filters:g.quickFilters,query:g.query,userId:g.user.id}}function f(e){if(e.UserId===g.user.id){var n=h(e.WhatsappAccountId);u.addAccount("whatsapp",n).then(function(e){e&&y()}).catch(function(e){v.error(e)})}}function b(e){if(e.UserId===g.user.id){var n=h(e.WhatsappAccountId);u.removeAccount("whatsapp",n).catch(function(e){v.error(e)})}}function A(n){var e=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:n,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=_.map(g.whatsappAccounts.rows,function(e){return{model:"whatsappAccount",action:"getDispositions",field:"name",params:{id:e.id,field:"name,level",level:n,nolimit:!0}}});return _.concat(t,e)}function E(e){!g.reloadingInteractions&&0<g.setting.whatsappInteractionsReloadTimeout&&R(!0),g.searchInProgress=!1,g.reloadingInteractions=!1,g.whatsappInteractions=e||{count:0,rows:[]};for(var n=0;n<g.whatsappInteractions.rows.length;n+=1)S(g.whatsappInteractions.rows[n])}function y(e){g.searchInProgress=!0,e||(g.query.page=1),g.query.offset=(g.query.page-1)*g.query.limit;var n=t.localStorage.getItem("motion2.home.whatsapp:"+g.user.id);(n=n?JSON.parse(n):{}).query=g.query,t.localStorage.setItem("motion2.home.whatsapp:"+g.user.id,JSON.stringify(n)),g.promise=r.whatsappInteraction.get(g.query,E).$promise}function S(e){e.contactInfo=e.Contact?e.Contact.mobile:void 0,"Unknown"===e.contactName&&(e.contactName=o.instant("DASHBOARDS.UNKNOWN"))}function T(e){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});n&&n.Users&&(_.find(n.Users,{id:e.UserId})||n.Users.push({id:e.UserId}))}function I(e){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});n&&n.Users&&_.remove(n.Users,{id:e.UserId})}function O(e){if(e){var n=_.find(g.whatsappInteractions.rows,{id:e.id});if(n){if(n.Users=[],e.closed&&(n.unreadMessages=0),g.query.sort){var t=_.startsWith(g.query.sort,"-")?"desc":"asc";g.whatsappInteractions.rows=_.orderBy(g.whatsappInteractions.rows,_.trimStart(g.query.sort,"-"),t)}_.merge(n,_.pick(e,_.keys(n)))}else 0===g.setting.whatsappInteractionsReloadTimeout&&y(g.query.page)}}function C(e){if(e){var n=_.find(g.whatsappInteractions.rows,{id:e.id});n&&(n.Tags=e.tags||[],_.merge(n,_.pick(e,_.keys(n))))}}function w(e){if(e&&!e.secret){var n=_.find(g.whatsappInteractions.rows,{id:e.WhatsappInteractionId});if(n){var t=_.find(n.Messages,{id:e.id});t?_.merge(t,_.pick(e,_.keys(t))):(_.isNil(n.Messages)&&(n.Messages={count:0}),e.read||(n.Messages.count+=1))}}}function R(e){e&&g.interactionsInterval&&n.cancel(g.interactionsInterval),g.interactionsInterval=n(function(){g.reloadingInteractions=!0,g.searchInProgress||y()},1e3*g.setting.whatsappInteractionsReloadTimeout)}a.$on("$destroy",function(){d.removeAllListeners("whatsappMessage:save"),d.removeAllListeners("whatsappMessage:update"),d.removeAllListeners("whatsappInteraction:save"),d.removeAllListeners("whatsappInteractionTags:save"),d.removeAllListeners("whatsappInteraction:update"),d.removeAllListeners("user_has_whatsapp_interactions:save"),d.removeAllListeners("user_has_whatsapp_interactions:remove"),g.interactionsInterval&&n.cancel(g.interactionsInterval)})}e.$inject=["$scope","$interval","$mdDialog","$document","$window","$translate","$q","api","Auth","socket","toasty","localStorageManager","agentAccountAssociationManager","ClientSideLoggingService"],angular.module("app.dashboards").controller("AgentHomeWhatsappController",e)}(),function(){"use strict";function e(e,n){var t=this;t.setting={},t.messages={count:0,rows:[]},t.showInteraction=!1,t.init=function(e,n){t.setting=n,t.tab=e,t.tab.saved=!0},t.getTrustedURL=function(){return n.trustAsResourceUrl(t.tab.src)}}e.$inject=["$scope","$sce"],angular.module("app.dashboards").controller("AgentGeneralIframeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this,f=16,b=1024*f*1024;function A(){var e=h.user.voicePause||h.user.chatPause||h.user.mailPause||h.user.openchannelPause||h.user.faxPause,n=!h.tab.interaction.Account.mandatoryDisposition;i.show({controller:"DisposeInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",parent:angular.element(t.body),clickOutsideToClose:n,escapeToClose:n,onRemoving:function(){h.user&&h.interaction.Account.mandatoryDisposition&&!e&&l.user.unpause({id:h.user.id}).$promise.catch(function(e){d.error(e.data?e.data.message:e.toString())})},locals:{user:h.user,channel:h.tab.channel,interaction:h.tab.interaction}}).then(function(e){h.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(h.tab)})}function E(e,n){h.tab.message=n,i.show({controller:"ComposeMailInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:h.tab.message,type:e,interaction:h.interaction},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){if(e)if(e.message&&e.message.savedAsDraft)h.draft?p.update({id:h.draft.id,channel:"mail",account:h.account,message:e.message,contact:h.contact,interaction:h.interaction}):p.add({channel:"mail",account:h.account,message:e.message,contact:h.contact,interaction:h.interaction}),h.draft=p.getByInteraction(h.tab.interaction.id);else{var n=e;n&&S(n),n.Interaction&&h.interaction&&h.interaction.id&&(n.Interaction.id=h.interaction.id,l.mailInteraction.update(n.Interaction).$promise.then(function(e){e&&e.closed?(h.tab.saved=!0,h.interaction.closed=!0,A()):null!==n.Interaction.substatus&&(h.tab.saved=!0,h.tab.interaction.substatus=n.Interaction.substatus,a.$parent.$parent.$parent.vm.closeTab(h.tab))}).catch(function(e){d.error(e.data?e.data.message:e.toString())}))}}).finally(function(){h.tab.isDraft=!1})}function y(){"mail"!==h.tab.channel&&n(function(){var e=angular.element(t.find("md-content[name*='interaction-content-"+h.tab.id+"']"));e&&e[0]&&(e[0].scrollTop=e[0].scrollHeight)},0)}function S(i){if(i)return i["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"]=h.interaction["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"],i[_.capitalize(h.tab.channel)+"InteractionId"]=h.interaction.id,i.UserId=h.user.id,i.ContactId=h.interaction.ContactId,i.direction="out",i.secret=Boolean(h.tab.spy||i.secret),l[h.tab.channel+"Message"].save(i).$promise.then(function(e){if(e&&e.id&&!_.isEmpty(i.attachments)){for(var n=[],t=0;t<i.attachments.length;t++){var a=i.attachments[t];a.MailMessageId?n.push(l.attachment.clone({id:a.id},{name:a.name,basename:a.basename,type:a.type,MailMessageId:e.id}).$promise):n.push(l.attachment.update({id:a.id},{MailMessageId:e.id}).$promise)}return s.all(n)}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SENDMESSAGE",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){"mail"===h.tab.channel&&i.isDraft&&(p.removeByInteraction(h.interaction.id),h.draft=null),h.tab.areaText="",y()})}function T(e){switch(h.tab.channel){case"mail":h.draft.content.originalMessage=e?_.find(h.interaction.Messages,["id",e]):_.findLast(h.interaction.Messages,["secret",!1]),E(h.draft.type,h.draft.content)}}function I(e){h.journeyIsLoading=!0;var n=_.merge(h.journeyOptions,{id:h.contact.id,offset:e||0});return g.get(h.journey,n).then(function(e){h.journey=e.journey,h.canLoadMoreJourney=e.loadMore}).finally(function(){h.journeyIsLoading=!1})}h.showFooter=!1,h.BTNLoadMore=0,h.showInteraction=!1,h.user=c.getCurrentUser(),h.detectBrowser=u.detectBrowser(),h.journey=[],h.acceptedMessages=[],h.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:b,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},h.ngFlow={flow:{}},h.selectedMailShowDetails={},h.selectedMailShowSystemMessage={},h.setting={},h.ctrlMethods={},h.embedOptions={fontSmiley:!0,sanitizeHtml:!0,emoji:!0,link:!0,linkTarget:"_blank"},h.journeyOptions=g.getQuery(),h.quickFilters=g.getQuickFilters(),h.init=function(e,n){h.tab=e,h.tab.saved=!0,h.tab.badges=0,h.setting=n||{},h.tab&&h.tab.channel&&h.tab.interaction&&(h.interaction=h.tab.interaction,l[h.tab.channel+"Interaction"].get({id:h.tab.interaction.id,includeAll:!0}).$promise.then(function(e){return e&&(h.interaction=e,h.tab.interaction=e),h.tab.saved=h.interaction.closed,h.queryMessage={id:h.interaction.id,includeAll:!0},"mail"===h.tab.channel?(h.queryMessage.sort="-id",h.queryMessage.offset=0,h.queryMessage.limit=3,h.queryMessage.inlineCss=!0):(h.queryMessage.sort="id",h.queryMessage.nolimit=!0),l[h.tab.channel+"Interaction"].getMessages(h.queryMessage).$promise}).then(function(e){return e&&(h.BTNLoadMore=e.count-h.queryMessage.limit),h.messages=e||{count:0,rows:[]},l["chat"===h.tab.channel?"chatWebsite":h.tab.channel+"Account"].get({id:h.interaction["chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId"]}).$promise}).then(function(e){if(h.account=e,h.tab.title=h.account.key||h.account.name,h.interaction.ContactId)return l.cmContact.get({id:h.interaction.ContactId}).$promise}).then(function(e){return e&&(h.contact=e),h.showInteraction=!0,h.contact?h.tab.title+=" - "+(h.user.privacyEnabled?v.mask(h.contact.firstName):h.contact.firstName):h.tab.title+=" - "+r.instant(h.tab.channel.toUpperCase()+".UNKNOWN"),l.user.get({fields:"id,fullname",nolimit:!0}).$promise}).then(function(e){h.users=e||{count:0,rows:[]},h.usersMap=_.mapValues(_.keyBy(h.users.rows,"id"),"fullname")}).then(function(){if(h.tab.channel&&h.interaction)return l.user["add"+_.upperFirst(h.tab.channel)+"Interactions"]({id:h.user.id,ids:[h.interaction.id]})}).then(function(){return l.mailSubstatus.get({sort:"name",nolimit:!0}).$promise}).then(function(e){h.subStatuses=e||{count:0,rows:[]}}).catch(function(){h.showInteraction=!0}).finally(function(){h.contact&&I(),function(){switch(h.user.role){case"admin":return h.downloadPermissions={attachments:!0,interactions:!0};case"agent":return h.downloadPermissions={attachments:h.user.downloadAttachments,interactions:h.user.downloadOmnichannelInteractions};case"user":l.userProfile.get({id:h.user.userProfileId,fields:"downloadAttachments,downloadOmnichannelInteractions"}).$promise.then(function(e){h.downloadPermissions={attachments:e.downloadAttachments,interactions:e.downloadOmnichannelInteractions}}).catch(function(){h.downloadPermissions={attachments:!1,interactions:!1}})}}(),function(){if(!h.tab.spy&&!h.interaction.closed){var t=[],a=_.some(h.messages.rows,["read",!0]);if(h.messages.rows.forEach(function(e){if("in"===e.direction&&!e.read){var n=0===t.length&&!a;t.push(l[h.tab.channel+"Message"].accept({id:e.id,UserId:h.user.id,manual:n}).$promise),h.acceptedMessages.push(e.id)}}),"mail"===h.tab.channel){var e=_(h.interaction.Messages).filter({read:!1,direction:"in"}).differenceBy(h.messages.rows,"id").value();e.forEach(function(e){t.push(l.mailMessage.accept({id:e.id,UserId:h.user.id}).$promise),h.acceptedMessages.push(e.id)})}s.all(t)}}(),y(),m.on(h.tab.channel+"Message:save",h.onMessageSave),m.on(h.tab.channel+"Message:update",h.onMessageSave),m.on(h.tab.channel+"Interaction:save",h.onInteractionSave),m.on(h.tab.channel+"Interaction:update",h.onInteractionSave),m.on("user_has_"+h.tab.channel+"_interactions:save",h.onInteractionOpen),m.on("user_has_"+h.tab.channel+"_interactions:remove",h.onInteractionClose),h.tab.areaText=h.tab.areaText?h.tab.areaText:"",h.showFooter=!0,"mail"===h.tab.channel&&(h.draft=p.getByInteraction(h.tab.interaction.id),h.tab.isDraft&&(h.tab.interaction.closed?(p.removeByInteraction(h.tab.interaction.id),h.draft=null):T()))}))},h.getLabelByMessage=function(e){var n="loading...";if(e)return"in"===e.direction?e.Contact?e.Contact.firstName||"Anonymous":n:e.UserId?h.usersMap?h.usersMap[e.UserId]:n:"System"},h.openContact=function(e,n){try{h.tab&&!h.tab.spy&&a.$parent.$parent.$parent.vm.addContactTab(n||h.contact)}catch(e){d.error({title:"ERROR OPEN CONTACT",msg:"Unable to open the contact"})}},h.openInteraction=function(e){try{if(e.MailAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("mail",e);if(e.ChatWebsiteId)return a.$parent.$parent.$parent.vm.addInteractionTab("chat",e);if(e.SmsAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("sms",e);if(e.WhatsappAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("whatsapp",e);if(e.OpenchannelAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("openchannel",e);if(e.FaxAccountId)return a.$parent.$parent.$parent.vm.addInteractionTab("fax",e)}catch(e){d.error({title:"ERROR OPEN INTERACTION",msg:"Customer Journey can't open the interaction"})}},h.disposeInteraction=A,h.tagInteraction=function(){i.show({controller:"TagInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!0,skipHide:Boolean(h.tab.spy),resolve:{tags:["apiResolver",function(e){return e.resolve("tag@get",{sort:"name",nolimit:!0,fields:"id,name,color"})}]},locals:{channel:h.tab.channel,interaction:h.tab.interaction}})},h.composeMailInteraction=function(n,e){if(e.inReplyTo){var t=_.find(h.messages.rows,{messageId:e.inReplyTo});if(!t)return l.mailMessage.get({messageId:e.inReplyTo}).$promise.then(function(e){E(n,e&&e.count?e.rows[0]:void 0)}).catch(function(e){d.error(e.data?e.data.message:e.toString()),E(n,void 0)});E(n,t)}else E(n,e)},h.composeFaxInteraction=function(e){var n={to:[]};n.to.push(h.contact.fax),i.show({controller:"ComposeFaxInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0}).then(function(e){return l.faxAccount.send({id:h.account.id},e).$promise.then(function(e){d.success({title:"Message properly sent!",msg:"Message has been sent!"}),a.$parent.vm.addInteractionTab("fax",e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:"FAX:SEND",msg:e.data?JSON.stringify(e.data):e.message||e.toString()})})})},h.composeSmsInteraction=function(e,n){i.show({controller:"ComposeSmsInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeWhatsappInteraction=function(e,n){i.show({controller:"ComposeWhatsappInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeChatInteraction=function(e,n){i.show({controller:"ComposeChatInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/chat/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.composeOpenchannelInteraction=function(e,n){i.show({controller:"ComposeOpenchannelInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,message:n,type:e},fullscreen:!0,skipHide:Boolean(h.tab.spy)}).then(function(e){e&&S(e)})},h.transferLastMessage=function(){if(h.interaction){var e=_.findLast(h.messages.rows,function(e){return"in"===e.direction});e?i.show({controller:"TransferMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/transfer/dialog.html",parent:angular.element(t.body),clickOutsideToClose:!1,locals:{account:h.account,interaction:h.interaction,message:e,channel:h.tab.channel},resolve:{agents:["apiResolver",function(e){var n={fields:"id,name",$id:{ne:h.user.id},role:"agent",online:!0,sort:"name",nolimit:!0};return n[h.tab.channel+"Pause"]=!1,e.resolve("user@get",n)}],queues:["apiResolver",function(e){return e.resolve(h.tab.channel+"Queue@get",{fields:"id,name",sort:"name",nolimit:!0})}]}}).then(function(e){h.tab.saved=Boolean(e),e&&a.$parent.$parent.$parent.vm.closeTab(h.tab)}):d.error({title:"Invalid transfer",msg:"Message not found!"})}},h.downloadMessage=function(s,e){h.tab.channel&&s.id&&l[h.tab.channel+"Message"].download({id:s.id,attachments:e}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=h.tab.channel+"-message"+s.id+".eml";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.downloadMessage.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.downloadInteraction=function(s,e){h.tab.channel&&s.id&&l[h.tab.channel+"Interaction"].download({id:s.id,attachments:e}).$promise.then(function(e){var n=[e.buffer],t=h.tab.channel+"-interaction"+s.id+".zip",a=new Blob(n,{type:e.type}),i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.inteactionMessage.get",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.openDraft=T,h.createVidaooSession=function(e){var n={id:e.id,account:e.Account,contact:e.Contact};return l.chatInteraction.createVidaooSession(n).$promise.then(function(){d.success({title:"Start Video Call",msg:"Session properly created."})}).catch(function(){d.error({title:"Start Video Call",msg:"Unable to create session!"})})},h.reply=function(e,n){if(e&&13===e.keyCode&&e.shiftKey)return;if(e&&13!==e.keyCode)return;if(""===n.trim())return;S(function(e){var n={},t="chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId";n[t]=h.interaction[t].toString(),n[_.capitalize(h.tab.channel)+"InteractionId"]=h.interaction.id,("sms"===h.tab.channel||"whatsapp"===h.tab.channel)&&(n.phone=h.interaction.phone);e&&(n.UserId=h.user.id,n.ContactId=h.interaction.ContactId,n.body=e);return n}(n.trim()))},h.upload=function(){h.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},h.ngFlow.flow.upload()},h.fileAdded=function(e){if(e.size>b)return d.error({title:"File too big",msg:"The max allowed size is "+f+"MB"}),!1;return!0},h.fileSuccess=function(e,n){var t=JSON.parse(n),a=t.name;"chat"===h.tab.channel&&(a='<a href="'+(h.account.remote?h.account.remote:o.protocol()+"://"+o.host())+"/api/chat/interactions/"+h.interaction.id+"/attachment_download?attachId="+t.id+"&token="+h.account.token+'" target="_self">'+t.name+"</a>");S({body:a,AttachmentId:t.id})},h.onMessageSave=function(e){if(e&&h.interaction.id!=e[_.capitalize(h.tab.channel)+"InteractionId"])return;var n=!1;h.messages?n=_.find(h.messages.rows,{id:e.id}):h.messages={rows:[],count:0};n?_.merge(n,e):("mail"===h.tab.channel?h.messages.rows.unshift(e):h.messages.rows.push(e),y())},h.onInteractionSave=function(e){if(e&&h.interaction.id!==e.id)return;e.closed&&h.interaction.UserId!==h.user.id&&(h.tab.saved=!0);_.merge(h.interaction,e)},h.searchTextChange=function(n){var t=s.defer(),a=[],e={},i="chat"===h.tab.channel?"ChatWebsiteId":_.capitalize(h.tab.channel)+"AccountId";return e.filter=n,e[i]=h.account.id,l.cannedAnswer.get(e).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},h.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:h.user,account:h.account,interaction:h.interaction,contact:h.interaction&&h.interaction.Contact?h.interaction.Contact:{}};""!==h.tab.areaText&&(h.tab.areaText+=" "),h.tab.areaText+=e(t),h.ctrlMethods.setText(h.tab.areaText)}catch(e){""!==h.tab.areaText&&(h.tab.areaText+=" "),h.tab.areaText+=n.value,h.ctrlMethods.setText(h.tab.areaText)}h.selectedItem=null,h.changeDisplayCannedAnswerInputValue()}},h.getMessagesAlignment=function(e){if(e.secret&&h.user.id!=e.UserId)return"in";switch(h.setting.messagesAlignment){case"left":return"in"==e.direction?e.direction:"out-left-aligned";case"right":return"in"==e.direction?"in-right-aligned":e.direction;default:return e.direction}},h.displayCannedAnswerInput=!1,h.changeDisplayCannedAnswerInputValue=function(){h.displayCannedAnswerInput=!h.displayCannedAnswerInput},h.setAs=function(e){h.tab.channel&&h.interaction&&h.interaction.id&&l[h.tab.channel+"Interaction"].update({id:h.interaction.id,substatus:e}).$promise.catch(function(e){d.error(e.data?e.data.message:e.toString())})},h.markAsUnread=function(){if(h.tab.channel&&h.interaction&&h.interaction.id)if(h.acceptedMessages.length)for(var e=0;e<h.acceptedMessages.length;e+=1)l[h.tab.channel+"Message"].update({id:h.acceptedMessages[e],read:!1,UserId:null});else for(var n=0;n<h.messages.rows.length;n+=1)if("in"===h.messages.rows[n].direction){h.messages.rows[n].UserId===h.user.id?l[h.tab.channel+"Message"].update({id:h.messages.rows[n].id,read:!1,UserId:null}):d.error({title:"You can't mark as unread",msg:"You are not the owner of the last message!"});break}h.tab.saved=!0,a.$parent.$parent.$parent.vm.closeTab(h.tab)},h.getAttachments=function(n){return l.attachment.get({MailMessageId:n.id}).$promise.then(function(e){e&&e.rows&&(n.attachments=e.rows)}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},h.getAttachment=function(i){return l.attachment.download({id:i.id}).$promise.then(function(e){if(e){var n=new Blob([e.buffer],{type:e.type}),t=document.createElement("a"),a=window.URL.createObjectURL(n);t.href=a,t.target="_self",t.download=i.name,document.body.appendChild(t),t.click(),setTimeout(function(){document.body.removeChild(t),window.URL.revokeObjectURL(a)},100)}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"ATTACHMENTS:GET",msg:e.data?JSON.stringify(e.data):e.toString()})})},h.htmlToPlaintext=function(e){return e?String(e).replace(/<[^>]+>/gm,""):""},h.onInteractionOpen=function(e){var n;h.interaction.id==e[_.upperFirst(h.tab.channel)+"InteractionId"]&&(h.interaction.Users&&(n=_.find(h.interaction.Users,{id:e.UserId})),n||h.interaction.Users.push({id:e.UserId}))},h.onInteractionClose=function(e){h.interaction.id==e[_.upperFirst(h.tab.channel)+"InteractionId"]&&h.interaction.Users&&_.remove(h.interaction.Users,{id:e.UserId})},h.getCustomerJourney=I,h.loadNextPage=function(){var t=s.defer();if(h.queryMessage)return h.queryMessage.offset=h.messages.rows.length,l[h.tab.channel+"Interaction"].getMessages(h.queryMessage).$promise.then(function(e){for(var n=0;n<e.rows.length;n+=1)h.messages.rows.push(e.rows[n]),h.interaction.closed||"in"!==e.rows[n].direction||e.rows[n].read||(l[h.tab.channel+"Message"].accept({id:e.rows[n].id,UserId:h.user.id}),h.acceptedMessages.push(e.rows[n].id));return 0<e.rows.length&&(h.BTNLoadMore=h.BTNLoadMore-e.rows.length),t.resolve(e)}).catch(function(e){return t.reject(e)});return t.reject()},h.interactionTimelineOptions={scrollEl:"#interaction-content"},h.loadMoreJourney=function(){return s(function(e){var n=h.journey.length;return e(I(n))})},h.journeyTimelineOptions={scrollEl:"#journey-content"},a.$on("$destroy",function(){m.removeAllListeners(h.tab.channel+"Message:save"),m.removeAllListeners(h.tab.channel+"Message:update"),m.removeAllListeners(h.tab.channel+"Interaction:save"),m.removeAllListeners(h.tab.channel+"Interaction:update"),m.removeAllListeners("user_has_"+h.tab.channel+"_interactions:save"),m.removeAllListeners("user_has_"+h.tab.channel+"_interactions:remove")})}function n(a){return{scope:{ngBindHtmlUnsafe:"="},template:"<div ng-bind-html='trustedHtml'></div>",link:function(t){t.updateView=function(){var e,n=_.replace(t.ngBindHtmlUnsafe,'<div id="xm-mail-content"','<a style="cursor:pointer" class="toggle-details md-accent-color" onclick="document.getElementById(\''+(e="xm-mail-content-"+Math.floor(9999*Math.random()+1))+"').style.display='block'; this.parentNode.removeChild(this)\">See More</a><div id=\""+e+'" style="display:none"');t.trustedHtml=a.trustAsHtml(n)},t.$watch("ngBindHtmlUnsafe",function(e){t.updateView(e)})}}}e.$inject=["$cookies","$timeout","$document","$scope","$mdDialog","$q","$location","$translate","api","toasty","Auth","socket","msUtils","draftManager","customerJourneyManager","privacyManager"],n.$inject=["$sce"],angular.module("app.dashboards").directive("ngBindHtmlUnsafe",n).controller("AgentGeneralInteractionController",e)}(),function(){"use strict";angular.module("app.dashboards").factory("Emojis",function(){return{watchEmbedData:!1,sanitizeHtml:!1,fontSmiley:!1,emoji:!0,link:!0,linkTarget:"_blank",pdf:{embed:!0},image:{embed:!0},audio:{embed:!0},basicVideo:!1,gdevAuth:"xxxxxxxx",video:{embed:!1,width:null,height:null,ytTheme:"dark",details:!1,thumbnailQuality:"medium",autoPlay:!0},twitchtvEmbed:!0,dailymotionEmbed:!0,tedEmbed:!0,dotsubEmbed:!0,liveleakEmbed:!0,ustreamEmbed:!0,soundCloudEmbed:!0,soundCloudOptions:{height:160,themeColor:"f50000",autoPlay:!1,hideRelated:!1,showComments:!0,showUser:!0,showReposts:!1,visual:!1,download:!1},spotifyEmbed:!0,tweetEmbed:!0,tweetOptions:{maxWidth:550,hideMedia:!1,hideThread:!1,align:"none",lang:"en"},code:{highlight:!0,lineNumbers:!1},codepenEmbed:!0,codepenHeight:300,jsfiddleEmbed:!0,jsfiddleHeight:300,jsbinEmbed:!0,jsbinHeight:300,plunkerEmbed:!0,githubgistEmbed:!0,ideoneEmbed:!0,ideoneHeight:300}})}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,ChatAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeChatInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this,m=25,u=1024*m*1024;c.separatorKeys=[a.KEY_CODE.ENTER,a.KEY_CODE.COMMA,a.KEY_CODE.TAB],c.message={from:i.localstationid,to:_.isNil(s.to)||_.isEmpty(s.to)?[]:s.to,attachments:[]},c.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:u,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},c.ngFlow={flow:{}},c.send=function(e){1===c.message.attachments.length?c.message.to.length?(s.draft=void 0,t.hide({from:c.message.from,to:c.message.to,attach:c.message.attachments.length,attachments:c.message.attachments})):l.error("To is mandatory"):l.error("Attachment is mandatory")},c.upload=function(){c.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},c.ngFlow.flow.upload()},c.fileSuccess=function(e,n){try{(n=JSON.parse(n)).size=e.size,c.message.attachments.push(n)}catch(e){console.error(e)}},c.fileAdded=function(e){var n=["pdf","tif"];if(!_.includes(n,e.getExtension()))return l.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extensions: "+n.join()}),!1;if(e.size>u)return l.error({title:"File too big",msg:"The max allowed size is "+m+"MB"}),!1;return!0},c.getContact=function(e){var n="";e.firstName&&e.firstName!==e.fax&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.fax&&(n+=e.lastName+" ");return n+="<"+e.fax+">"},c.contactSearch=function(e){return i&&i.ListId?r.cmContact.get({ListId:i.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,fax"}).$promise.then(function(e){return e.rows}):[]},c.transformContact=function(e){var n=e;if(_.isObject(e))return e.fax;if(t=n,!/[&\/\\#,()$~%.'":;*?<>{}\s\\|a-zA-Z\pS!òàùè…_§°çéì-]/.test(t))return n;var t;return l.error("Fax "+n+" is not valid"),null},c.closeDialog=function(){s.draft=c.message,t.cancel()}}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q"],angular.module("app.dashboards").controller("ComposeFaxInteractionDialogController",e)}(),function(){"use strict";function e(n,e,i,t,a,s,o,r,l,d,c,m,u,p){var g=this,v=25,h=1024*v*1024;g.currentUser=m.getCurrentUser(),g.secret="note"===r,g.hiddenCC=!0,g.hiddenBCC=!0,g.verifySmtp=!0,g.errors=[],g.separatorKeys=[t.KEY_CODE.ENTER,t.KEY_CODE.COMMA,t.KEY_CODE.TAB],g.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,MailAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},g.selectedItemChange=function(n){if(n&&n.value&&g.ckEditorInstance)try{var e=_.template(n.value),t={user:g.currentUser,account:s,interaction:u,contact:u&&u.Contact?u.Contact:{}},a=e(t),i=a.replace(/(?:\r\n|\r|\n)/g,"<br />");g.ckEditorInstance.insertHtml(i)}catch(e){console.error(e),g.ckEditorInstance.insertHtml(n.value)}document.getElementById("html-area").focus(),g.selectedItem=null},g.onReadyEditor=function(e){try{g.ckEditorInstance=CKEDITOR.instances["html-area"]}catch(e){console.error("Unable to get Html Editor instance",e)}},_.templateSettings.interpolate=/{{([\s\S]+?)}}/g,g.fromTemplate=_.template("{{ name }} <{{ email }}>"),g.replyTemplate=_.template("On {{ date }}, at {{ time }}, {{ from }} wrote:"),g.forwardTemplate=_.template("Begin forwarded message:<br><br><strong>From:</strong> {{ from }}<br><strong>Subject:</strong> {{ subject }}<br><strong>Date:</strong> {{ date }}, at {{ time }}<br><strong>To:</strong> {{ to }}"),g.message={from:g.fromTemplate({name:s.name,email:s.email||s.Smtp.user}),to:[],cc:[],bcc:[],body:S(),type:r,attachments:[],showLastMessage:!0},g.draft=null,g.ckeditor={skin:"office2013",startupFocus:!0,language:"en",allowedContent:!0,extraPlugins:"font,colorbutton,autogrow,autoembed,autocorrect,googlethisterm,pastebase64",toolbarGroups:[{name:"styles",groups:["styles"]},{name:"clipboard",groups:["undo"]},{name:"colors",groups:["colors"]},{name:"basicstyles",groups:["basicstyles"]},{name:"paragraph",groups:["list","indent","align"]}],autoGrow_onStartup:!0,autoGrow_minHeight:g.secret?160:300,autoGrow_maxHeight:e.innerHeight-400,autocorrect_enabled:!0,disableNativeSpellChecker:!1,enterMode:CKEDITOR.ENTER_BR,font_defaultLabel:s.fontFamily?s.fontFamily.split(",")[0]:"Arial",fontSize_defaultLabel:s.fontSize||"12",removePlugins:"magicline"};for(var f=[],b=8;b<=72;b++)f.push(b+"/"+b+"pt");g.ckeditor.fontSize_sizes=f.join(";"),g.ngFlowOptions={target:"api/attachments",singleFile:!0,maxChunkRetries:1,chunkSize:h,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},g.ngFlow={flow:{}},g.reply=function(e){angular.isDefined(o)&&(g.message.type="reply",g.message.to="in"===o.direction?o.from.split(","):o.to.split(","),g.message.subject=_.startsWith(o.subject,"Re:")?o.subject:"Re: "+o.subject,g.message.inReplyTo=o.messageId,g.message.body=S(),g.message.attachments=[],e&&o.cc&&(g.hiddenCC=!1,g.message.cc=o.cc.split(",")),g.message.showLastMessage=!1)},g.newMail=function(){angular.isDefined(o)&&(g.message.type="new",g.message.to=o.to?o.to.split(","):[])},g.forward=function(){if(angular.isDefined(o)){if(g.message.type="forward",g.message.subject=_.startsWith(o.subject,"Fwd:")?o.subject:"Fwd: "+o.subject,g.message.body=S(),o.Attachments&&o.Attachments.length)for(var e=0;e<o.Attachments.length;e++)g.message.attachments.push(o.Attachments[e]);g.message.showLastMessage=!1}},g.editDraft=function(){g.isDraft=!0,angular.isDefined(o)&&(o.savedAsDraft=!1,g.message=angular.copy(o),_.isEmpty(g.message.cc)||(g.hiddenCC=!1),_.isEmpty(g.message.bcc)||(g.hiddenBCC=!1))},g.send=function(e,n,t){if(!A&&g.message.to&&(g.message.body||o.from))if(g.message.to.length)if(_.isEmpty(g.message.subject)){var a=i.confirm({skipHide:!0}).title("Warning").textContent("This message has no subject. Are you sure you want to send it?").ariaLabel("Warning").targetEvent(e).ok("Send Anyway").cancel("Cancel");i.show(a).then(function(){E(n,t)})}else E(n,t);else d.error("To is mandatory");A=!1},g.note=function(){g.type="note",g.secret=!0,g.message.body='<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'pt"><p></p></div>'},g.addNote=function(){g.message.body&&i.hide({secret:!0,body:g.message.body,attach:g.message.attachments.length,attachments:g.message.attachments})},g.upload=function(e){g.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+n.get("motion.token")},g.ngFlow.flow.upload()},g.fileSuccess=function(e,n){try{(n=JSON.parse(n)).size=e.size,g.message.attachments.push(n)}catch(e){console.error(e)}},g.removeAttachment=function(e){g.message.attachments=_.reject(g.message.attachments,{id:e.id}),e.MailMessageId||l.attachment.delete({id:e.id}).$promise.catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.attachment.delete",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.fileAdded=function(e){if(e.size>h)return d.error({title:"File too big",msg:"The max allowed size is "+v+"MB"}),!1;return!0},g.getContact=function(e){var n="";e.firstName&&e.firstName!==e.email&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.email&&(n+=e.lastName+" ");return n+="<"+e.email+">"},g.contactSearch=function(e){return s&&s.ListId?l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,email"}).$promise.then(function(e){return e.rows}):[]},g.transformContact=function(e,n){if(_.isObject(e))return(g.contact=e).email;if(_.isString(e)){if(y(e))return g.contact={email:e},e;for(var t=e.split(","),a=0;a<t.length;a+=1)y(t[a])?_.isArray(n)&&_.indexOf(n,t[a])<0&&n.push(t[a]):d.error("Email "+t[a]+" is not valid");return g.contact={email:e.split(",")[0]},null}return d.error("Email field is not valid"),null},g.saveDraft=function(){g.message.savedAsDraft=!0,g.draft=p.getByInteraction(u.id);var e={account:s,message:g.message,contact:g.contact,interaction:u};if(g.draft&&!g.isDraft){var n=i.confirm({skipHide:!0}).title(a.instant("DASHBOARDS.DRAFT_SAVE_WARNING_TITLE")).content(a.instant("DASHBOARDS.DRAFT_SAVE_WARNING_MESSAGE")).ariaLabel("Save draft").ok(a.instant("DASHBOARDS.OVERWRITE")).cancel(a.instant("DASHBOARDS.CANCEL"));i.show(n).then(function(){i.hide(e)})}else i.hide(e)},g.closeDialog=function(){i.cancel()},g.loadLastMessage=function(){g.message.body+=T(g.message.type)};var A=!(g.keyPress=function(e){13===e.keyCode&&(A=!0)});switch(r){case"reply":g.reply(!1);break;case"replyAll":g.reply(!0);break;case"forward":g.forward();break;case"draft":g.editDraft();break;case"new":g.newMail();break;case"note":g.note()}function E(e,n){var t={from:g.message.from,to:g.message.to.join(","),cc:g.message.cc.join(","),bcc:g.message.bcc.join(","),subject:g.message.subject,body:g.message.showLastMessage?g.message.body:g.message.body+T(g.message.type),inReplyTo:g.message.inReplyTo,attach:g.message.attachments.length,attachments:g.message.attachments,Interaction:{lastMsgDirection:"out",substatus:n},isDraft:g.isDraft};t.html='<div id="xm-mail-content">'+_.replace(t.body,'<div id="xm-mail-content"',"<div")+"</div>",e&&(t.Interaction.closed=!0),i.hide(t)}function y(e){return/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/.test(e)}function S(){return'<div style="font-family:'+s.fontFamily+";font-size:"+s.fontSize+'pt">'+function(){if(_.isNil(s.template))return"";try{return _.template(s.template)({user:g.currentUser,account:s,interaction:u,contact:u&&u.Contact?u.Contact:{}})}catch(e){return console.error(e),""}}()+"</div>"}function T(e){var n='<div id="xm-mail-content"><blockquote type="cite">';switch(e){case"reply":case"replyAll":n+=g.replyTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||""});break;case"forward":n+=g.forwardTemplate({date:moment(o.createdAt).format("D MMM YYYY")||"",time:moment(o.createdAt).format("HH:mm")||"",from:_.escape(o.from)||"",to:_.escape(o.to)||"",subject:_.escape(o.subject)||""})}var t,a,i=g.message.showLastMessage&&o.originalMessage||g.isDraft?o.originalMessage.body:o.body;return n+="<br><br>",n+=(t=i?_.replace(i,'<div id="xm-mail-content"',"<div"):"",(a=t.match(/\<body[^>]*\>([^]*)\<\/body/m))?a[1]:t),n+="</blockquote></div>",e?n:""}l.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){g.subStatuses=e||{count:0,rows:[]}}).catch(function(e){console.error(e)}),g.secret||l.mailAccount.verifySmtp({id:s.id}).$promise.catch(function(e){g.verifySmtp=!1,g.errors.push({message:e.data,type:e.status}),g.errors.push({message:"You can't reply or send an email. Please contact the administrator!",type:"500"})})}e.$inject=["$cookies","$window","$mdDialog","$mdConstant","$translate","account","message","type","api","toasty","$q","Auth","interaction","draftManager"],angular.module("app.dashboards").controller("ComposeMailInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,OpenchannelAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=""===p.message.body.trim()?e(t):" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=""===p.message.body.trim()?n.value:" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e[s.mapKey]&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e[s.mapKey]&&(n+=e.lastName+" ");return n+="<"+e[s.mapKey]+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId){var n="firstName,lastName,phone,mobile";return s.mapKey&&(n+=","+s.mapKey),l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:n}).$promise.then(function(e){return e.rows})}return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e[s.mapKey];return n},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeOpenchannelInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,SmsAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=""===p.message.body.trim()?e(t):" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=""===p.message.body.trim()?n.value:" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeSmsInteractionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;switch(p.currentUser=u.getCurrentUser(),p.errors=[],p.separatorKeys=[i.KEY_CODE.ENTER,i.KEY_CODE.COMMA,i.KEY_CODE.TAB],p.searchTextChange=function(n){var t=c.defer(),a=[];return l.cannedAnswer.get({filter:n,WhatsappAccountId:s.id}).$promise.then(function(e){return a=_.concat(a,e.rows),l.cannedAnswer.get({filter:n}).$promise}).then(function(e){a=_.concat(a,_.filter(e.rows,function(e){return!(e.MailAccountId||e.FaxAccountId||e.SmsAccountId||e.WhatsappAccountId||e.OpenchannelAccountId||e.ChatWebsiteId)})),t.resolve(a)}).catch(function(e){t.reject(e)}),t.promise},p.selectedItemChange=function(n){if(n){try{_.templateSettings.interpolate=/{{([\s\S]+?)}}/g;var e=_.template(n.value),t={user:p.currentUser,account:s};p.message.body+=""===p.message.body.trim()?e(t):" "+e(t),p.ctrlMethods.setText(p.message.body)}catch(e){p.message.body+=""===p.message.body.trim()?n.value:" "+n.value,p.ctrlMethods.setText(p.message.body)}p.selectedItem=null}},p.note=function(){p.secret=!0},p.addNote=function(){p.message.body&&a.hide({secret:!0,body:p.message.body})},p.ctrlMethods={},p.message={from:s.phone,to:_.isNil(o.to)||_.isEmpty(o.to)?[]:o.to,body:""},p.send=function(e){p.message.to&&p.message.body&&(p.message.to.length?(n=p.message.body,a.hide({to:p.message.to.join(","),body:n})):d.error("To is mandatory"));var n},p.getContact=function(e){var n="";e.firstName&&e.firstName!==e.mobile&&(n+=e.firstName+" ");e.lastName&&e.lastName!==e.mobile&&(n+=e.lastName+" ");return n+="<"+e.mobile+">"},p.closeDialog=function(){a.cancel()},p.contactSearch=function(e){if(s&&s.ListId)return l.cmContact.get({ListId:s.ListId,nolimit:!0,filter:e,fields:"firstName,lastName,mobile"}).$promise.then(function(e){return e.rows});return[]},p.transformContact=function(e){var n=e;if(_.isObject(n))return e.mobile;if(t=n,/^(\+|\d)[0-9]{7,16}$/.test(t))return n;var t;return d.error("Mobile "+n+" is not valid"),null},r){case"note":p.note()}}e.$inject=["$cookies","$timeout","$window","$mdDialog","$mdConstant","account","message","type","api","toasty","$q","$translate","Auth"],angular.module("app.dashboards").controller("ComposeWhatsappInteractionDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.errors=[],r.dispositions=[],r.interaction=angular.copy(e),r.interaction.disposition||(r.interaction.disposition=null),r.channel=i,r.apiRoute=r.channel+"Interaction",r.apiAccountRoute=r.channel+("chat"===r.channel?"Website":"Account"),r.accountProperty=_.capitalize(r.channel)+("chat"===r.channel?"Website":"Account")+"Id",r.firstLevelDisposition=null,r.mandatoryDisposition=!1,r.mandatoryDispositionPause="",r.wasUserInPause=s.voicePause||s.chatPause||s.mailPause||s.openchannelPause||s.faxPause,r.onInit=function(){var n=[],t={fields:"id,name,level,ParentId",sort:"name",nolimit:!0};t[r.accountProperty]=e[r.accountProperty],a[r.apiAccountRoute].get({id:e[r.accountProperty]}).$promise.then(function(e){return r.mandatoryDisposition=e.mandatoryDisposition,r.mandatoryDisposition&&(r.mandatoryDispositionPause=e.mandatoryDispositionPause.name),a.disposition.get(t).$promise}).then(function(e){return e.rows.length&&(n=_.concat(n,e.rows)),a.disposition.get({MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",WhatsappAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",ListId:"null",nolimit:!0}).$promise}).then(function(e){e.rows.length&&(n=_.concat(n,e.rows))}).catch(function(e){console.error(e)}).finally(function(){r.dispositions=_.orderBy(n,["name"],["asc"]),r.mandatoryDisposition&&!r.wasUserInPause&&a.user.pause({id:s.id,type:r.mandatoryDispositionPause||"DEFAULT PAUSE"}).$promise.then(function(e){}).catch(function(e){console.error(e)})})},r.onDispositionChange=function(e){"first"===e?(r.anySecondLevelDisposition=!!r.firstLevelDisposition&&_.some(r.dispositions,["ParentId",r.firstLevelDisposition.id]),r.firstLevelDisposition||(r.secondLevelDisposition=void 0)):"second"===e&&(r.anyThirdLevelDisposition=_.some(r.dispositions,["ParentId",r.secondLevelDisposition.id]))},r.clearDispositionSelection=function(e){"second"===e?(r.secondLevelDisposition=void 0,r.thirdLevelDisposition=void 0):"third"===e&&(r.thirdLevelDisposition=void 0)},r.saveDisposition=function(){r.errors=[],r.interaction.UserId=s.id,r.interaction.closed=!0,r.interaction.closeReason="agent",r.interaction.disposition=r.firstLevelDisposition?r.firstLevelDisposition.name:null,r.interaction.secondDisposition=r.secondLevelDisposition?r.secondLevelDisposition.name:void 0,r.interaction.thirdDisposition=r.thirdLevelDisposition?r.thirdLevelDisposition.name:void 0,a[r.apiRoute]?a[r.apiRoute].update(_.pick(r.interaction,["MailAccountId","FaxAccountId","SmsAccountId","WhatsappAccountId","ChatWebsiteId","OpenchannelAccountId","closed","closeReason","disposition","secondDisposition","thirdDisposition","id","note","UserId"])).$promise.then(function(e){r.interaction=e,"mail"===r.channel&&o.removeByInteraction(r.interaction.id),t.success({title:"Interaction properly closed!",msg:"Interaction has been closed!"})}).then(function(){l(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.variable.update"}];for(var n=0;n<e.data.errors.length;n++)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})}):l(!1)},r.closeDialog=l}e.$inject=["$mdDialog","toasty","api","interaction","channel","user","draftManager"],angular.module("app.dashboards").controller("DisposeInteractionDialogController",e)}(),function(){"use strict";function e(n,t,e,a,i,s){var o=this;function r(e){n.hide(e)}o.errors=[],o.tags=s,o.interaction=angular.copy(a),o.interaction.Tags=_.map(o.interaction.Tags,function(e){return{id:e.id,name:e.name,color:e.color}}),o.channel=i,o.autocompleteRequireMatch=!0,o.saveTag=function(){{if(o.errors=[],e[o.apiRoute])return e[o.apiRoute].addTags({id:o.interaction.id,ids:_.map(o.interaction.Tags,"id")}).$promise.then(function(){t.success({title:"Interaction properly tagged!",msg:"Interaction has been tagged!"}),a.Tags=o.interaction.Tags,r(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})});r(!1)}},o.closeDialog=r,o.apiRoute=o.channel+"Interaction"}e.$inject=["$mdDialog","toasty","api","interaction","channel","tags"],angular.module("app.dashboards").controller("TagInteractionDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l,d){var c=this;function m(e){n.hide(e)}c.channel=s.toLowerCase(),c.message=o,c.account=r,c.agents=l,c.queues=d,c.transfer={id:0,type:c.account.queueTransfer?"queue":"agent"},c.onTransfer=function(){m(!0),e(function(){var e="agent"===c.transfer.type?"agentNotify":c.channel+"QueueNotify";return a.rpc[e]({id:c.transfer.id,messageId:c.message.id,channel:c.channel}).$promise.then(function(){i.success({title:t.instant("DASHBOARDS.INFO"),msg:"queue"===c.transfer.type?t.instant("DASHBOARDS.NOTIFICATIONS.TRANSFER_QUEUE_EXECUTED"):t.instant("DASHBOARDS.NOTIFICATIONS.TRANSFER_AGENT_EXECUTED")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.rpc.notify"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.rpc.notify",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},5e3)},c.closeDialog=m}e.$inject=["$mdDialog","$timeout","$translate","api","toasty","channel","message","account","agents","queues"],angular.module("app.dashboards").controller("TransferMessageDialogController",e)}(),function(){"use strict";function e(i,m,s,e,u,o,r,t,n,a,l){var p=this;function d(){try{i.$parent.$parent.$parent.vm.updateLocalStorage()}catch(e){o.error({title:"ERROR UPDATE LOCAL TABS",msg:"Error updating locally stored tabs"})}}function c(t,e){var n,a,l=[],d=[],c=r.getCurrentUser();(n=c,a=m.defer(),p.project.sendUnpauseOnSubmit?u.user.unpause({id:n.id}).$promise.then(function(e){a.resolve()}).catch(function(e){console.log("err"),a.resolve()}):a.resolve(),a.promise).then(function(){return u.jscriptySessionReport.save({starttime:p.starttime,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,VoiceQueueId:p.call&&p.call["xmd-voicequeueid"]?p.call["xmd-voicequeueid"]:void 0,ProjectId:p.project&&p.project.id?p.project.id:void 0,projectname:p.project&&p.project.name?p.project.name:void 0,ContactId:p.contact&&p.contact.id?p.contact.id:void 0,completed:e}).$promise}).then(function(e){if(e)for(var n=p.getResponseSheetHeaders(),t=p.getResponseSheetRow(),a=p.getQuestionWithResponseList(),i=0;i<n.length;i+=1)if(!_.isEmpty(String(t[i]))){try{l.push(u.jscriptyQuestionReport.save({question:n[i],answer:"date"===a[i].type?moment(String(t[i])).format("YYYY-MM-DD"):"time"===a[i].type?moment(String(t[i])).format("HH:mm"):String(t[i]),questionId:a[i].id,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,SessionId:e.id,ProjectId:p.project.id,projectname:p.project.name}))}catch(e){console.error("Unable to convert question",e)}for(var s=String(t[i]).split(";"),o=0;o<s.length;o+=1){var r=s[o].trim();try{d.push(u.jscriptyAnswerReport.save({question:n[i],questionId:a[i].id,answer:"date"===a[i].type?moment(r).format("YYYY-MM-DD"):"time"===a[i].type?moment(r).format("HH:mm"):r,membername:p.call&&p.call.membername?p.call.membername:c.name,calleridname:p.call&&p.call.calleridname?p.call.calleridname:void 0,calleridnum:p.call&&p.call.calleridnum?p.call.calleridnum:void 0,queue:p.call&&p.call.queue?p.call.queue:void 0,uniqueid:p.call&&p.call.uniqueid?p.call.uniqueid:void 0,SessionId:e.id,ProjectId:p.project.id,projectname:p.project.name}))}catch(e){console.error("Unable to convert answer",e)}}}return m.all(l).then(function(){return m.all(d).then(function(){return e})})}).then(function(e){e?t.resolve(!0):t.reject()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.contact.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contact.save",msg:e.data?JSON.stringify(e.data.message):e.toString()});t.reject()})}p.formViewer={},p.showResetButton=!0,p.showIncompleteSubmitButton=!1,p.detectBrowser=l.detectBrowser(),p.onSubmit=function(e,n){var t=m.defer();if(n){var a=s.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("YES").cancel("NO");s.show(a).then(function(){c(t,!1)},function(){t.resolve()})}else c(t,!0);return t.promise.then(function(e){e&&(o.success({title:"Session saved",msg:"Your survey session has been properly saved!"}),function(e){try{i.$parent.$parent.$parent.vm.removeTab(e)}catch(e){o.error({title:"ERROR REMOVE TAB",msg:"Error while removing tab"})}}(p.tab))}).catch(function(e){o.error({title:"Session save error",msg:"There has been an error while trying to save your survey session!"})})},p.openContact=function(e,n){try{i.$parent.$parent.$parent.vm.addContactTab(n)}catch(e){o.error({title:"ERROR OPEN CONTACT",msg:"Jscripty can't open the contact"})}},p.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0},p.getResponseSheet=function(){return e.getResponseSheet(p.project.formData,p.project.responseData,!1)},p.getResponseSheetRow=function(){return e.getResponseSheetRow(p.project.formData,p.project.responseData)},p.getResponseSheetHeaders=function(){return e.getResponseSheetHeaders(p.project.formData,!1)},p.getQuestionWithResponseList=function(){return e.getQuestionWithResponseList(p.project.formData,p.project.responseData)},p.init=function(e){p.tab=e,p.tab&&(p.call=p.tab.call,p.starttime=p.tab.openedAt,p.contact=p.tab.contact,p.project=p.tab.project,p.project&&(_.isObjectLike(p.project.formData)?p.project.formData=p.project.formData:p.isJsonString(p.project.formData)?p.project.formData=JSON.parse(p.project.formData):p.project.formData=void 0,p.project.responseData=p.project.responseData||{},void 0!==p.project.currentPage&&a(function(){n.$broadcast("mwForm.pageEvents.changePage",{page:p.project.currentPage})}),i.$on("mwForm.pageEvents.pageCurrentChanged",function(e,n){if(n.currentPage&&(p.project.currentPage=n.currentPage.number-1,d(),p.project.enableUncompleteSave&&(1<=n.currentPage.number&&n.currentPage.number<p.project.formData.pages.length?p.showIncompleteSubmitButton=!0:p.showIncompleteSubmitButton=!1),p.project.formData&&p.project.formData.pages))for(var t=0,a=p.project.formData.pages.length;t<a;t++)if(n.currentPage.number<t+1&&p.project.formData.pages[t].elements)for(var i=0,s=p.project.formData.pages[t].elements.length;i<s;i++)"question"===p.project.formData.pages[t].elements[i].type&&p.project.formData.pages[t].elements[i].question&&delete p.project.responseData[p.project.formData.pages[t].elements[i].question.id]})))},p.resetViewer=function(e){if(p.formViewer.reset){var n=s.confirm().title(t.instant("JSCRIPTY.DO_YOU_WANT_TO_RESET_SESSION")).content(t.instant("JSCRIPTY.ALL_SURVEY_DATA_WILL_BE_LOST")).textContent("").ariaLabel("survey").targetEvent(e).ok(t.instant("JSCRIPTY.YES")).cancel(t.instant("JSCRIPTY.NO"));s.show(n).then(function(){p.showIncompleteSubmitButton=!1,p.project.currentPage=void 0,d(),p.formViewer.reset()})}}}e.$inject=["$scope","$q","$mdDialog","mwFormResponseUtils","api","toasty","Auth","$translate","$rootScope","$timeout","msUtils"],angular.module("app.dashboards").controller("AgentGeneralJscriptyController",e)}(),function(){"use strict";function e(t,a,e,n,i){var s=this;function o(){return function(e){if(404===e.status)a.info({title:t.instant("DASHBOARDS.ATTENTION"),msg:t.instant("DASHBOARDS.ACCEPT_ELSEWHERE")});else if(e.data&&e.data.errors&&e.data.errors.length){s.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}}s.notification=e,s.user=i.getCurrentUser(),s.accept=function(e){{if(n[s.notification.channel+"Message"])return n[s.notification.channel+"Message"].accept({id:s.notification.id,UserId:s.user.id,manual:!0}).$promise.then(function(e){a.success({title:"Message properly accepted!",msg:"Message has been accepted!"})}).catch(o());a.error({title:"API:ERROR",msg:"API accept message not found: "+s.notification.channel+"Message"})}},s.reject=function(e){{if(n[s.notification.channel+"Message"])return n[s.notification.channel+"Message"].reject({id:s.notification.id,UserId:s.user.id}).$promise.then(function(e){a.success({title:"Message properly rejected!",msg:"Message has been rejected!"})}).catch(o());a.error({title:"API:ERROR",msg:"API reject message not found: "+s.notification.channel+"Message"})}}}e.$inject=["$translate","toasty","notification","api","Auth"],angular.module("app.dashboards").controller("NotificationController",e)}(),function(){"use strict";angular.module("app.dashboards").controller("AgentGeneralPopupController",function(){var n=this;n.init=function(e){n.tab=e,n.tab&&(n.tab.saved=!0,n.html=n.tab.html)}})}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&"abandoned"===e.disposition?(i.inbound.abandoned+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&!e.UserId&&e.disposition?(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)):e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.chatWebsites,{id:_.toNumber(e.ChatWebsiteId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.chatWebsites=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveChatInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateChatInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("chatInteraction:save",i.onSaveChatInteraction),n.on("chatInteraction:update",i.onUpdateChatInteraction),function(){if(0<Object.keys(i.chatWebsites).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("chatInteraction:save"),n.removeAllListeners("chatInteraction:update")})}e.$inject=["$scope","socket","chatInteractions","chatWebsites"],angular.module("app.dashboards").controller("UserChatDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r){var l=this;function d(){s({queues:l.outboundQueues,rpcQueues:l.rpcQueues}).then(function(e){l.inbound=e})}function c(){o({rpcCampaigns:l.rpcCampaigns}).then(function(e){l.ivr=e})}l.outboundQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},l.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},l.rpcCampaigns=r?_.keyBy(r.rows?r.rows:[],"id"):{},l.ivr={originated:0,limitCalls:0},l.inbound={waiting:0,talking:0,pTalking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0,outboundDropCallsDayCallersExit:0,outboundDropCallsDayTimeout:0},l.onSaveQueue=function(e){l.outboundQueues[e.id]&&l.rpcQueues[e.id]&&(l.rpcQueues[e.id]=e)},l.onSaveCampaign=function(e){l.rpcCampaigns[e.id]&&(l.rpcCampaigns[e.id]=e)},t.onWithoutApply("voice_queue:save",l.onSaveQueue),l.interval=n(function(){d(),c()},999),t.onWithoutApply("campaign:save",l.onSaveCampaign),d(),c(),e.$on("$destroy",function(){t.removeListener("voice_queue:save",l.onSaveQueue),t.removeAllListeners("campaign:save"),l.interval&&n.cancel(l.interval)})}e.$inject=["$scope","$interval","socket","outboundQueues","rpcQueues","initializeRealtimeQueue","initializeRealtimeCampaign","rpcCampaigns"],angular.module("app.dashboards").controller("UserVoiceDashboardDialerController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.faxAccounts,{id:_.toNumber(e.FaxAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.faxAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveFaxInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateFaxInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("faxInteraction:save",i.onSaveFaxInteraction),n.on("faxInteraction:update",i.onUpdateFaxInteraction),function(){if(0<Object.keys(i.faxAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("faxInteraction:save"),n.removeAllListeners("faxInteraction:update")})}e.$inject=["$scope","socket","faxInteractions","faxAccounts"],angular.module("app.dashboards").controller("UserFaxDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.mailAccounts,{id:_.toNumber(e.MailAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.mailAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveMailInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateMailInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("mailInteraction:save",i.onSaveMailInteraction),n.on("mailInteraction:update",i.onUpdateMailInteraction),function(){if(0<Object.keys(i.mailAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("mailInteraction:save"),n.removeAllListeners("mailInteraction:update")})}e.$inject=["$scope","socket","mailInteractions","mailAccounts"],angular.module("app.dashboards").controller("UserMailDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.openchannelAccounts,{id:_.toNumber(e.OpenchannelAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.openchannelAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveOpenchannelInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateOpenchannelInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("openchannelInteraction:save",i.onSaveOpenchannelInteraction),n.on("openchannelInteraction:update",i.onUpdateOpenchannelInteraction),function(){if(0<Object.keys(i.openchannelAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("openchannelInteraction:save"),n.removeAllListeners("openchannelInteraction:update")})}e.$inject=["$scope","socket","openchannelInteractions","openchannelAccounts"],angular.module("app.dashboards").controller("UserOpenchannelDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.smsAccounts,{id:_.toNumber(e.SmsAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.smsAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveSmsInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateSmsInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("smsInteraction:save",i.onSaveSmsInteraction),n.on("smsInteraction:update",i.onUpdateSmsInteraction),function(){if(0<Object.keys(i.smsAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("smsInteraction:save"),n.removeAllListeners("smsInteraction:update")})}e.$inject=["$scope","socket","smsInteractions","smsAccounts"],angular.module("app.dashboards").controller("UserSmsDashboardGeneralController",e)}(),function(){"use strict";function e(t){var i=[],s=function(){var t=i[0],a={waiting:0,talking:0,pTalking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0,originated:0,outboundDropCallsDayCallersExit:0,outboundDropCallsDayTimeout:0};_.forIn(t.queues,function(e,n){t.rpcQueues[n]&&(a.waiting+=t.rpcQueues[n].waiting||0,a.talking+=(t.rpcQueues[n].talking||0)+(t.rpcQueues[n].pTalking||0),a.answered+=t.rpcQueues[n].answered||0,a.abandoned+=t.rpcQueues[n].abandoned||0,a.sumHoldTime+=t.rpcQueues[n].sumHoldTime||0,a.sumBillable+=t.rpcQueues[n].sumBillable||0,a.total+=t.rpcQueues[n].total||0,a.originated+=t.rpcQueues[n].originated||0,a.outboundDropCallsDayCallersExit+=t.rpcQueues[n].outboundDropCallsDayCallersExit||0,a.outboundDropCallsDayTimeout+=t.rpcQueues[n].outboundDropCallsDayTimeout||0)});var e=a.total-a.answered-a.abandoned;a.unmanaged=0<e?e:0,a.avgHoldTime=Math.round(0<a.total?a.sumHoldTime/a.total:0),a.avgHoldTime=new Date(1e3*a.avgHoldTime).toISOString().substr(11,8),a.avgTalkTime=Math.round(0<a.answered?a.sumBillable/a.answered:0),a.avgTalkTime=new Date(1e3*a.avgTalkTime).toISOString().substr(11,8),a.answerRate=Math.round((0<a.total?a.answered/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.abandonRate=Math.round((0<a.total?a.abandoned/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundDropRate=Math.round((0<a.total?a.outboundDropCallsDayTimeout/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundAbandonRate=Math.round((0<a.total?a.outboundDropCallsDayCallersExit/a.total*100:0)*Math.pow(10,1))/Math.pow(10,1),a.outboundanswerRate=0<100-a.outboundDropRate-a.outboundAbandonRate&&a.total?100-a.outboundDropRate-a.outboundAbandonRate:0,i.shift(),t.defer.resolve(a),0<i.length&&s()};return function(e){var n=t.defer();return i.push({queues:e.queues,rpcQueues:e.rpcQueues,defer:n}),1===i.length&&s(),n.promise}}function n(t){var i=[],s=function(){var t=i[0],a={originated:0,limitCalls:0};_.forIn(t.rpcCampaigns,function(e,n){t.rpcCampaigns[n]&&(a.originated+=t.rpcCampaigns[n].originated||0,a.limitCalls+=t.rpcCampaigns[n].limitCalls||0)}),i.shift(),t.defer.resolve(a),0<i.length&&s()};return function(e){var n=t.defer();return i.push({rpcCampaigns:e.rpcCampaigns,defer:n}),1===i.length&&s(),n.promise}}function t(t,a,e){var i=this;i.license=e,i.onInit=function(){if(i.hasDashboardPermissions=!a.hasRole("user")||a.hasPermission(101),i.hasDashboardPermissions){var e=t.current.name;switch(e){case"app.dashboards.general":n=[],i.license.voice&&n.push("app.dashboards.general.voice"),i.license.dialer&&n.push("app.dashboards.general.dialer"),i.license.chat&&n.push("app.dashboards.general.chat"),i.license.mail&&n.push("app.dashboards.general.mail"),i.license.messaging&&n.push("app.dashboards.general.sms"),i.license.openchannel&&n.push("app.dashboards.general.openchannel"),i.license.fax&&n.push("app.dashboards.general.fax"),i.license.whatsapp&&n.push("app.dashboards.general.whatsapp"),0<n.length&&t.go(_.first(n));break;case"app.dashboards.general.voice":i.selectedTab=0;break;case"app.dashboards.general.dialer":i.selectedTab=1;break;case"app.dashboards.general.chat":i.selectedTab=2;break;case"app.dashboards.general.mail":i.selectedTab=3;break;case"app.dashboards.general.sms":i.selectedTab=4;break;case"app.dashboards.general.openchannel":i.selectedTab=5;break;case"app.dashboards.general.fax":i.selectedTab=6;break;case"app.dashboards.general.whatsapp":i.selectedTab=7}}var n}}e.$inject=["$q"],n.$inject=["$q"],t.$inject=["$state","Auth","license"],angular.module("app.dashboards").factory("initializeRealtimeQueue",e).factory("initializeRealtimeCampaign",n).controller("UserDashboardGeneralController",t)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;function r(){s({queues:o.inboundQueues,rpcQueues:o.rpcQueues}).then(function(e){o.inbound=e})}o.inboundQueues=t?_.keyBy(t.rows?t.rows:[],"id"):{},o.rpcQueues=a?_.keyBy(a.rows?a.rows:[],"id"):{},o.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},o.outbound=i||{answered:0,sumBillable:0,sumDuration:0,sumHoldTime:0,total:0},o.onSaveQueue=function(e){o.inboundQueues[e.id]&&o.rpcQueues[e.id]&&(o.rpcQueues[e.id]=e,r())},o.onSaveOutbound=function(e){o.outbound=e},n.on("voice_queue:save",o.onSaveQueue),n.on("voice_outbound:save",o.onSaveOutbound),r(),e.$on("$destroy",function(){n.removeListener("voice_queue:save",o.onSaveQueue),n.removeAllListeners("voice_outbound:save")})}e.$inject=["$scope","socket","inboundQueues","rpcQueues","outbound","initializeRealtimeQueue"],angular.module("app.dashboards").controller("UserVoiceDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a){var i=this,s=[];function o(e,n){e.closed||e.UserId||!n||(i.inbound.waiting+=1),e.closed||!e.UserId||_.includes(s,e.id)||(i.inbound.talking+=1,s.push(e.id),!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),e.closed&&e.UserId&&(i.inbound.sumBillable+=moment(e.closedAt).diff(moment(e.read1stAt),i.config.unit),i.inbound.sumHoldTime+=moment(e.read1stAt).diff(moment(e.createdAt),i.config.unit),i.inbound.answered+=1,!n&&i.inbound.talking&&(i.inbound.talking-=1)),e.closed&&!e.UserId&&(i.inbound.unmanaged+=1,!n&&i.inbound.waiting&&(i.inbound.waiting-=1)),n&&(i.inbound.total+=1)}function r(){i.inbound.abandonRate=Math.round((i.inbound.abandoned+i.inbound.unmanaged)/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.answerRate=Math.round(i.inbound.answered/(i.inbound.total-i.inbound.talking-i.inbound.waiting)*100,-2),i.inbound.avgHoldTime=moment.duration(Math.round(i.inbound.sumHoldTime/i.inbound.answered),i.config.unit).format(i.config.format,i.config),i.inbound.avgTalkTime=moment.duration(Math.round(i.inbound.sumBillable/i.inbound.answered),i.config.unit).format(i.config.format,i.config)}function l(e){return!!_.some(i.whatsappAccounts,{id:_.toNumber(e.WhatsappAccountId)})}function d(e){var n=moment().utcOffset(0,!0).startOf("day"),t=moment().utcOffset(0,!0).endOf("day");return moment(e).utcOffset(0,!0).isBetween(n,t)}i.config={format:"hh:mm:ss",unit:"seconds",trim:!1},i.inbound={waiting:0,talking:0,answered:0,abandoned:0,unmanaged:0,sumHoldTime:0,sumBillable:0,total:0,avgHoldTime:"00:00:00",avgTalkTime:"00:00:00",answerRate:0,abandonRate:0},i.whatsappAccounts=a?_.keyBy(a.rows?a.rows:[],"id"):{},i.onSaveWhatsappInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!0),r())},i.onUpdateWhatsappInteraction=function(e){l(e)&&d(e.createdAt)&&(o(e,!1),r())},n.on("whatsappInteraction:save",i.onSaveWhatsappInteraction),n.on("whatsappInteraction:update",i.onUpdateWhatsappInteraction),function(){if(0<Object.keys(i.whatsappAccounts).length)for(var e=0;e<t.rows.length;e+=1)if(l(t.rows[e])){var n=t.rows[e];o(n,!0),r()}}(),e.$on("$destroy",function(){n.removeAllListeners("whatsappInteraction:save"),n.removeAllListeners("whatsappInteraction:update")})}e.$inject=["$scope","socket","whatsappInteractions","whatsappAccounts"],angular.module("app.dashboards").controller("UserWhatsappDashboardGeneralController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="FAX.EDIT_FAXACCOUNT",g.faxAccount=angular.copy(l),g.faxAccounts=r,g.newFaxAccount=!1,g.faxAccount||(g.faxAccount={waitForTheAssignedAgent:10,waitfortheassignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="FAX.NEW_FAXACCOUNT",g.newFaxAccount=!0),n.params.id&&(g.faxAccount.FaxAccountId=n.params.id),g.addNewFaxAccount=function(){g.errors=[],d.faxAccount.addAccountApplications(g.faxAccount).$promise.then(function(e){g.faxAccounts.unshift(e.toJSON()),o.success({title:"FaxAccount properly created",msg:g.faxAccount.name?g.faxAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFaxAccount=function(){g.errors=[],d.faxAccount.updateAccountApplications(g.faxAccount).$promise.then(function(e){var n=_.find(g.faxAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FaxAccount properly saved!",msg:g.faxAccount.name?g.faxAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFaxAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The faxAccount will be deleted.").ariaLabel("Delete FaxAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.faxAccount.delete({id:g.faxAccount.id}).$promise.then(function(){_.remove(g.faxAccounts,{id:g.faxAccount.id}),o.success({title:"FaxAccount properly deleted!",msg:(g.faxAccount.name||"faxAccount")+" has been deleted!"}),v(g.faxAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.faxAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),t=null;if(g.faxAccount&&(t=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.trunks,{id:t.id});a.canSelect=!1,n.push(a)}g.trunks=n})}else{var t=[],a=null;g.faxAccount&&(a=_.find(g.trunks,{id:Number(g.faxAccount.TrunkId)}));for(var i=0;i<g.trunks.length;i++)a&&g.trunks[i].id===a.id&&(g.trunks[i].canSelect=!1,t.push(g.trunks[i]));g.trunks=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.faxAccount&&(t=_.find(g.lists,{id:Number(g.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.faxAccount&&(a=_.find(g.lists,{id:Number(g.faxAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","faxAccounts","faxAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.faxAccountApps.rows.length){var t=r.faxAccountApps.rows[n]?r.faxAccountApps.rows[n]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccountApp:t,faxAccount:r.faxAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.faxAccountApps.rows[n]=e:r.faxAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.faxAccountApps.rows.length;t++,0){var a=r.faxAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.faxAccount.context,a.exten=r.faxAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.faxAccount.addApplications({id:r.faxAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.faxAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.faxAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.faxAccount={},r.faxAccountApps={count:0,rows:[]},r.selectedFaxAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"FaxQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"faxQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:901}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,defaultValue:300,required:!0,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",role:"agent",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.faxAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getFaxAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.faxAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getFaxAccountApps=function(){r.promise=o.faxAccount.getApplications(r.query,t).$promise},r.editFaxAccountApp=n,r.editInterval=function(e,n){if(r.faxAccountApps.rows.length){var t=r.faxAccountApps.rows[n]?r.faxAccountApps.rows[n]:r.faxAccountApps.rows[0];i.show({controller:"EditFaxAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteFaxAccountApp=function(e){_.remove(r.faxAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedFaxAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedFaxAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedFaxAccountApps.forEach(function(e){_.remove(r.faxAccountApps.rows,{id:e.id})}),r.selectedFaxAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.fax").controller("FaxAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxAccount.getAgents({id:c.faxAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserFaxAccount?"penalty "+e.UserFaxAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.faxAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxAccount.removeAgents({id:c.faxAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxAccount.addAgents({id:c.faxAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","faxAccount","faxAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditFaxAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("fax")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.faxQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.faxQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:901}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="FAX.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveFaxAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","faxAccountApp","faxAccount","api","Auth","crudPermissions"],angular.module("app.fax").controller("EditFaxAccountApptagDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.faxAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.faxAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.FaxAccountId=m.faxAccount.id,m.query.id=m.faxAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.faxAccount.id,field:"FaxAccountId",route:"faxAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.fax").controller("FaxAccountDispositionsController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"faxAccount",action:"getDispositions",field:"name",params:{id:m.faxAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.faxAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.faxAccountInteractions.rows.length;n+=1){var t=m.faxAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.faxInteraction.get(m.query,p).$promise}function v(e){d.faxInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.faxAccountInteractions.rows,{id:e.id}),m.faxAccountInteractions.count-=1,m.faxAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETfaxAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?(e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""),e.contactInfo=e.Contact.fax):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.faxAccount={},m.faxAccountInteractions={count:0,rows:[]},m.selectedFaxAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.faxAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.FaxAccountId=m.faxAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.faxInteractionDownload=function(s,e,n){return d.faxInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="fax-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getFaxAccountInteractions=g,m.createOrEditFaxAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:m.faxAccount,interaction:n,interactions:m.faxAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spyfaxInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"fax",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"fax.faxAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||FaxAccountId:=$eq["+m.faxAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedFaxAccountInteractions=function(){var e=angular.copy(m.selectedFaxAccountInteractions);return m.selectedFaxAccountInteractions=[],e},m.deleteFaxAccountInteraction=v,m.deleteSelectedFaxAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedFaxAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedFaxAccountInteractions.forEach(function(e){v(e)}),m.selectedFaxAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.fax").controller("FaxAccountInteractionsController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=n,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=e.protocol()+"://"+e.host(),p.faxAccount=c||t.params.faxAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=t.params.tab||0,p.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.accounts",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.accounts",{})}},p.agentadddialog=function(e,n){a.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:p.faxAccounts?p.faxAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoFaxAccounts=function(){t.go("app.fax.faxAccounts",{},{reload:"app.fax.faxAccounts"})},p.saveFaxAccount=function(){r.faxAccount.updateAccountApplications(p.faxAccount).$promise.then(function(){l.success({title:"FaxAccount updated!",msg:p.faxAccount.name?p.faxAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.trunks,{id:e.resourceId})}),t=null;if(p.faxAccount&&(t=_.find(p.trunks,{id:Number(p.faxAccount.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.trunks,{id:t.id});a.canSelect=!1,n.push(a)}p.trunks=n})}else{var t=[],a=null;p.faxAccount&&(a=_.find(p.trunks,{id:Number(p.faxAccount.TrunkId)}));for(var i=0;i<p.trunks.length;i++)a&&p.trunks[i].id===a.id&&(p.trunks[i].canSelect=!1,t.push(p.trunks[i]));p.trunks=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.faxAccount&&(t=_.find(p.lists,{id:Number(p.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.faxAccount&&(a=_.find(p.lists,{id:Number(p.faxAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","faxAccount","userProfile","userProfileSection"],angular.module("app.fax").controller("FaxAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.faxAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="faxAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFaxAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,headerinfo,TrunkId,localstationid,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,ecm,minrate,maxrate,modem,gateway,faxdetect,t38timeout,tech,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.arrayecm=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayminrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymaxrate=_.keyBy([{option:"2400",value:"'2400'"},{option:"4800",value:"'4800'"},{option:"7200",value:"'7200'"},{option:"9600",value:"'9600'"},{option:"12000",value:"'12000'"},{option:"14400",value:"'14400'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytech=_.keyBy([{option:"SIP",value:"'SIP'"},{option:"IAX",value:"'IAX'"},{option:"DADHI",value:"'DADHI'"},{option:"KHOMP",value:"'KHOMP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.fax.faxAccounts.edit",{id:e.id,faxAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.fax.faxAccounts.edit",{id:e.id,tab:5})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.accounts",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.accounts",{})}},f.agentadddialog=function(e,n){i.show({controller:"FaxAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxAccount:e,faxAccounts:f.faxAccounts?f.faxAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("faxAccount")+"?").htmlContent("<b>"+(e.name||"faxAccount")+"</b> will be deleted.").ariaLabel("delete faxAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFaxAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.faxAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FaxAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFaxAccount=function(e,n){i.show({controller:"CreateOrEditFaxAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxAccount:n,faxAccounts:f.faxAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFaxAccount=y,f.exportSelectedFaxAccounts=function(){var e=angular.copy(f.selectedFaxAccounts);return f.selectedFaxAccounts=[],e},f.deleteSelectedFaxAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected faxAccounts?").htmlContent("<b>"+f.selectedFaxAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FaxAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFaxAccounts.forEach(function(e){y(e)}),f.selectedFaxAccounts=[]})},f.deselectFaxAccounts=function(){f.selectedFaxAccounts=[]},f.selectAllFaxAccounts=function(){f.selectedFaxAccounts=f.faxAccounts.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})}),a=null;a=[],f.faxAccounts.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.trunks,{id:e.id});n.canSelect=!1,t.push(n)}}),f.trunks=t})}else{var t=[],a=[];f.faxAccounts.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)});for(var i=0;i<f.trunks.length;i++){_.some(a,{id:f.trunks[i].id})&&(f.trunks[i].canSelect=!1,t.push(f.trunks[i]))}f.trunks=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.faxAccount&&(t=_.find(f.lists,{id:Number(f.faxAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.faxAccount&&(a=_.find(f.lists,{id:Number(f.faxAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.faxAccounts=e||{count:0,rows:[]}}function y(e){m.faxAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.faxAccounts.rows,{id:e.id}),f.faxAccounts.count-=1,f.faxAccounts.rows.length||f.getFaxAccounts(),p.success({title:_.startCase("FaxAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEfaxAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFaxAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.fax").controller("FaxAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="FAX.EDIT_FAXQUEUE",r.faxQueue=angular.copy(n),r.faxQueues=e,r.newFaxQueue=!1,r.faxQueue||(r.faxQueue={strategy:"beepall",timeout:10},r.title="FAX.NEW_FAXQUEUE",r.newFaxQueue=!0),r.addNewFaxQueue=function(){r.errors=[],i.faxQueue.save(r.faxQueue).$promise.then(function(e){r.faxQueues.unshift(e.toJSON()),a.success({title:"FaxQueue properly created",msg:r.faxQueue.name?r.faxQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveFaxQueue=function(){r.errors=[],i.faxQueue.update({id:r.faxQueue.id},r.faxQueue).$promise.then(function(e){var n=_.find(r.faxQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"FaxQueue properly saved!",msg:r.faxQueue.name?r.faxQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteFaxQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The faxQueue will be deleted.").ariaLabel("Delete FaxQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.faxQueue.delete({id:r.faxQueue.id}).$promise.then(function(){_.remove(r.faxQueues,{id:r.faxQueue.id}),a.success({title:"FaxQueue properly deleted!",msg:(r.faxQueue.name||"faxQueue")+" has been deleted!"}),l(r.faxQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.faxQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.faxQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","faxQueues","faxQueue","api","Auth","crudPermissions"],angular.module("app.fax").controller("CreateOrEditFaxQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxQueue.getAgents({id:c.faxQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserFaxQueue?"penalty "+e.UserFaxQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.faxQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.removeAgents({id:c.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.addAgents({id:c.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("FAX.ALL_AGENTS"),labelSelected:r.instant("FAX.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","faxQueue","faxQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.faxQueue.getTeams({id:l.faxQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.faxQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("FAX.ALL_TEAMS"),labelSelected:t.instant("FAX.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.removeTeams({id:l.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.faxQueue.addTeams({id:l.faxQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","faxQueue","$translate","Auth","crudPermissions"],angular.module("app.fax").controller("FaxQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.faxQueue=c||e.params.faxQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:u.faxQueues?u.faxQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoFaxQueues=function(){e.go("app.fax.faxQueues",{},{reload:"app.fax.faxQueues"})},u.saveFaxQueue=function(){r.faxQueue.update({id:u.faxQueue.id},u.faxQueue).$promise.then(function(){l.success({title:"FaxQueue updated!",msg:u.faxQueue.name?u.faxQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","faxQueue","userProfileSection"],angular.module("app.fax").controller("FaxQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.faxQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="faxQueues",f.listOrder="",f.listOrderAsc=null,f.selectedFaxQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"fax",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.fax.faxQueues.edit",{id:e.id,faxQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"FaxQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:f.faxQueues?f.faxQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"FaxQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{faxQueue:e,faxQueues:f.faxQueues?f.faxQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("faxQueue")+"?").htmlContent("<b>"+(e.name||"faxQueue")+"</b> will be deleted.").ariaLabel("delete faxQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:910}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.fax.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.fax.realtime.queues",{})}},f.success=E,f.getFaxQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.faxQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FaxQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFaxQueue=function(e,n){i.show({controller:"CreateOrEditFaxQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/fax/views/faxQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{faxQueue:n,faxQueues:f.faxQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteFaxQueue=y,f.exportSelectedFaxQueues=function(){var e=angular.copy(f.selectedFaxQueues);return f.selectedFaxQueues=[],e},f.deleteSelectedFaxQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected faxQueues?").htmlContent("<b>"+f.selectedFaxQueues.length+" selected</b> will be deleted.").ariaLabel("delete FaxQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFaxQueues.forEach(function(e){y(e)}),f.selectedFaxQueues=[]})},f.deselectFaxQueues=function(){f.selectedFaxQueues=[]},f.selectAllFaxQueues=function(){f.selectedFaxQueues=f.faxQueues.rows};var b=!0,A=1;function E(e){f.faxQueues=e||{count:0,rows:[]}}function y(e){m.faxQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.faxQueues.rows,{id:e.id}),f.faxQueues.count-=1,f.faxQueues.rows.length||f.getFaxQueues(),p.success({title:_.startCase("FaxQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEfaxQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEfaxQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFaxQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","faxQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.fax").controller("FaxQueuesController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d){var c=this,m=d&&1==d.count?d.rows[0].crudPermissions:null;function u(){c.faxAccounts.rows.forEach(function(n){var e=_.find(c.rpcFaxAccounts.rows,["id",n.id]);e&&_.merge(n,e);var t={id:n.id,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),fields:"id,createdAt"};i.faxAccount.getMessages(t).$promise.then(function(e){return e&&(n.in=e.count||0,n.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),t.direction="out",i.faxAccount.getMessages(t).$promise}).then(function(e){e&&(n.out=e.count||0,n.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){o.error(e.data?e.data.message:e.toString())})})}function p(e){var n=_.find(c.faxAccounts.rows,["id",e.id]);n&&_.merge(n,e)}function g(e){c.faxAccounts.rows=e.rows,u()}c.currentUser=n.getCurrentUser(),c.faxAccounts=r,c.rpcFaxAccounts=l,c.crudPermissions=n.parseCrudPermissions(m),c.query={sort:"name",limit:10,page:1},c.success=g,c.$onInit=u,c.getFaxAccounts=function(){c.query.offset=(c.query.page-1)*c.query.limit,n.hasRole("admin")?c.promise=i.faxAccount.get(c.query,g).$promise:(c.query.id=c.currentUser.userProfileId,c.query.section="FaxAccounts",c.promise=i.userProfile.getResources(c.query,g).$promise)},c.goToFaxAccount=function(e,n){a.go("app.fax.faxAccounts.edit",{id:n.id,faxAccount:n})},s.on("faxAccount:save",p),s.on("faxAccount:update",p),s.on("faxMessage:save",function(e){var n=_.find(c.faxAccounts.rows,["id",e.FaxAccountId]);n&&("in"==e.direction?(n.in+=1,n.lastIn=e.createdAt):(n.out+=1,n.lastOut=e.createdAt))});var v=!0,h=1;e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=h),c.getFaxAccounts())}),e.$on("$destroy",function(){s.removeAllListeners("faxAccount:save"),s.removeAllListeners("faxAccount:update"),s.removeAllListeners("faxMessage:save")})}e.$inject=["$scope","$timeout","$state","api","Auth","socket","toasty","faxAccounts","rpcFaxAccounts","userProfileSection"],angular.module("app.fax").controller("FaxAccountsRealtimeController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.fax.realtime.agents":this.selectedTab=0;break;case"app.fax.realtime.trunks":this.selectedTab=1;break;case"app.fax.realtime.queues":this.selectedTab=2;break;case"app.fax.realtime.accounts":this.selectedTab=3;break;default:this.selectedTab=0,t.go("app.fax.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.fax.realtime.agents");break;case 1:t.go("app.fax.realtime.trunks");break;case 2:t.go("app.fax.realtime.queues");break;case 3:t.go("app.fax.realtime.accounts");break;default:t.go("app.fax.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.fax").controller("FaxRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m){var u=this,p=["status","stateRegistry","registry","host","port","internal","state","status"];function g(){for(var e,n=0;n<u.trunks.length;n+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[n].id]))&&_.merge(u.trunks[n],_.pick(u.rpcTrunks[e],p))}function v(e,n,t){0<=n&&_.merge(e[n],_.pick(t,p))}u.currentUser=m.getCurrentUser(),u.count=a.count,u.trunks=a?a.rows:[],u.rpcTrunks=i&&i.rows?i.rows:[],u.query={fields:"id,name",active:!0,sort:"name",limit:10,page:1},u.statusClass=r.STATUS_STYLES,u.stateClass=r.STATES_STYLES,u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.success=b,u.$onInit=g,u.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},u.getTrunks=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=s.trunk.get(u.query,b).$promise:(u.query.id=u.userProfile.id,u.query.section="Trunks",u.promise=s.userProfile.getResources(u.query,b).$promise)},u.goToTrunk=function(e,n){l.go("app.tools.trunks.edit",{id:n.id})},u.onSave=function(e){var n=_.findIndex(u.trunks,["id",e.id]),t=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,n,e),v(u.rpcTrunks,t,e)},o.on("trunk:save",u.onSave);var h=!0,f=1;function b(e){u.count=e.count,u.trunks=e&&e.rows?e.rows:[],g()}e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=f),u.getTrunks())}),e.$on("$destroy",function(){o.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","realtimeManager","$state","userProfile","userProfileSection","Auth"],angular.module("app.fax").controller("TrunksFaxRealtimeController",e)}(),function(){"use strict";function e(e,n){this.info=e,this.license=n}e.$inject=["info","license"],angular.module("app.help.about").controller("AboutController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DESKACCOUNT",g.deskAccount=angular.copy(l),g.deskAccounts=r,g.newDeskAccount=!1,g.deskAccount||(g.deskAccount={type:"integrationTab",authType:"basic",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_DESKACCOUNT",g.newDeskAccount=!0),g.addNewDeskAccount=function(){g.errors=[],d.intDeskAccount.save(g.deskAccount).$promise.then(function(e){g.deskAccounts.unshift(e.toJSON()),o.success({title:"DeskAccount properly created",msg:g.deskAccount.name?g.deskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDeskAccount=function(){g.errors=[],d.intDeskAccount.update({id:g.deskAccount.id},g.deskAccount).$promise.then(function(e){var n=_.find(g.deskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"DeskAccount properly saved!",msg:g.deskAccount.name?g.deskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The deskAccount will be deleted.").ariaLabel("Delete DeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDeskAccount.delete({id:g.deskAccount.id}).$promise.then(function(){_.remove(g.deskAccounts,{id:g.deskAccount.id}),o.success({title:"DeskAccount properly deleted!",msg:(g.deskAccount.name||"deskAccount")+" has been deleted!"}),v(g.deskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","deskAccounts","deskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskAccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.deskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="deskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedDeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,remoteUri,authType,username,password,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayauthType=_.keyBy([{option:"Basic",value:"'basic'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.deskAccounts.edit",{id:e.id,deskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intDeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"DeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"DeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("deskAccount")+"?").htmlContent("<b>"+(e.name||"deskAccount")+"</b> will be deleted.").ariaLabel("delete deskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getDeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intDeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="DeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditDeskAccount=function(e,n){i.show({controller:"CreateOrEditDeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskAccount:n,deskAccounts:f.deskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteDeskAccount=y,f.exportSelectedDeskAccounts=function(){var e=angular.copy(f.selectedDeskAccounts);return f.selectedDeskAccounts=[],e},f.deleteSelectedDeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected deskAccounts?").htmlContent("<b>"+f.selectedDeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete DeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedDeskAccounts.forEach(function(e){y(e)}),f.selectedDeskAccounts=[]})},f.deselectDeskAccounts=function(){f.selectedDeskAccounts=[]},f.selectAllDeskAccounts=function(){f.selectedDeskAccounts=f.deskAccounts.rows};var b=!0,A=1;function E(e){f.deskAccounts=e||{count:0,rows:[]}}function y(e){m.intDeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.deskAccounts.rows,{id:e.id}),f.deskAccounts.count-=1,f.deskAccounts.rows.length||f.getDeskAccounts(),p.success({title:_.startCase("DeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintDeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getDeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","deskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("DeskAccountsController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intDeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.deskAccount={},o.deskConfiguration={},o.configurations=[],o.selectedDeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.deskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intDeskAccount.getConfigurations({id:o.deskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getDeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getDeskConfiguration=function(e){o.deskConfiguration=o.configurations[e],o.selectedDeskConfiguration=e,i.intDeskConfiguration.getSubjects({id:o.deskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intDeskConfiguration.getDescriptions({id:o.deskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intDeskConfiguration.getFields({id:o.deskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intDeskConfiguration.getTags({id:o.deskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditDeskConfiguration=function(e,n){a.show({controller:"CreateOrEditDeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{deskConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDeskConfiguration(0)})},o.deleteDeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the deskConfiguration?").htmlContent("<b>"+(n.name||"deskConfiguration")+"</b> will be deleted.").ariaLabel("delete deskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intDeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"DeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getDeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intDeskConfiguration.setTags({id:o.deskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditDeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.deskConfiguration,account:o.deskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("DeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DESKCONFIGURATION",g.deskConfiguration=angular.copy(l),g.configurations=r,g.newDeskConfiguration=!1,g.deskConfiguration||(g.deskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_DESKCONFIGURATION",g.newDeskConfiguration=!0),g.addNewDeskConfiguration=function(){g.errors=[],d.intDeskAccount.addConfiguration({id:n.params.id},g.deskConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"DeskConfiguration properly created",msg:g.deskConfiguration.name?g.deskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDeskConfiguration=function(){g.errors=[],d.intDeskConfiguration.update({id:g.deskConfiguration.id},g.deskConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"DeskConfiguration properly saved!",msg:g.deskConfiguration.name?g.deskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The deskConfiguration will be deleted.").ariaLabel("Delete DeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDeskConfiguration.delete({id:g.deskConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.deskConfiguration.id}),o.success({title:"DeskConfiguration properly deleted!",msg:(g.deskConfiguration.name||"deskConfiguration")+" has been deleted!"}),v(g.deskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","deskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.deskAccount=c||e.params.deskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoDeskAccounts=function(){e.go("app.integrations.deskAccounts",{},{reload:"app.integrations.deskAccounts"})},u.saveDeskAccount=function(){r.intDeskAccount.update({id:u.deskAccount.id},u.deskAccount).$promise.then(function(){l.success({title:"DeskAccount updated!",msg:u.deskAccount.name?u.deskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintDeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","deskAccount","userProfileSection"],angular.module("app.integrations").controller("DeskAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;function h(e){a.hide(e)}v.currentUser=m.getCurrentUser(),v.errors=[],v.setting=p,v.license=u,v.crudPermissions=g,v.hasModulePermissions={},v.passwordPattern=v.setting&&v.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",v.title="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT",v.dynamics365Account=angular.copy(l),v.dynamics365Accounts=r,v.cloudProviders=d,v.newDynamics365Account=!1,v.dynamics365Account||(v.dynamics365Account={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),modernAuthentication:!1},v.title="INTEGRATIONS.NEW_DYNAMICS365ACCOUNT",v.newDynamics365Account=!0),v.addNewDynamics365Account=function(){v.errors=[],c.intDynamics365Account.save(v.dynamics365Account).$promise.then(function(e){v.dynamics365Accounts.unshift(e.toJSON()),o.success({title:"Dynamics365Account properly created",msg:v.dynamics365Account.name?v.dynamics365Account.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveDynamics365Account=function(){v.errors=[],c.intDynamics365Account.update({id:v.dynamics365Account.id},v.dynamics365Account).$promise.then(function(e){var n=_.find(v.dynamics365Accounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Dynamics365Account properly saved!",msg:v.dynamics365Account.name?v.dynamics365Account.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.deleteDynamics365Account=function(e){v.errors=[];var n=a.confirm().title("Are you sure?").content("The dynamics365Account will be deleted.").ariaLabel("Delete Dynamics365Account").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDynamics365Account.delete({id:v.dynamics365Account.id}).$promise.then(function(){_.remove(v.dynamics365Accounts,{id:v.dynamics365Account.id}),o.success({title:"Dynamics365Account properly deleted!",msg:(v.dynamics365Account.name||"dynamics365Account")+" has been deleted!"}),h(v.dynamics365Account)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Account.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Account.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=h}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dynamics365Accounts","dynamics365Account","cloudProviders","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f){var b=this;b.license=h,b.setting=f,b.currentUser=v.getCurrentUser(),b.dynamics365Accounts=l||{count:0,rows:[]},b.cloudProviders=d||{count:0,rows:[]},b.userProfile=c,b.userProfileSection=m&&1==m.count?m.rows[0]:null,b.crudPermissions=v.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.table="dynamics365Accounts",b.listOrder="",b.listOrderAsc=null,b.selectedDynamics365Accounts=[],b.query={fields:"createdAt,updatedAt,id,name,username,password,remoteUri,tenantId,clientId,clientSecret,serverUrl,description,modernAuthentication",sort:"-updatedAt",limit:10,page:1},b.editstate=function(e,n){t.go("app.integrations.dynamics365Accounts.edit",{id:e.id,dynamics365Account:e,crudPermissions:b.crudPermissions})},b.testtestintegrationaccount=function(e,n){return u.intDynamics365Account.getFields({id:e.id,test:!0}).$promise.then(function(){g.success({title:"Dynamics365Account properly tested",msg:"Connection succeded!"})}).catch(function(e){g.error({title:"Dynamics365Account properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},b.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("dynamics365Account")+"?").htmlContent("<b>"+(e.name||"dynamics365Account")+"</b> will be deleted.").ariaLabel("delete dynamics365Account").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){S(e)},function(){console.log("CANCEL")})},b.success=y,b.getDynamics365Accounts=function(){b.query.offset=(b.query.page-1)*b.query.limit,v.hasRole("admin")?b.promise=u.intDynamics365Account.get(b.query,y).$promise:(b.query.id=b.userProfile.id,b.query.section="Dynamics365Accounts",b.promise=u.userProfile.getResources(b.query,y).$promise)},b.createOrEditDynamics365Account=function(e,n){i.show({controller:"CreateOrEditDynamics365AccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Account:n,dynamics365Accounts:b.dynamics365Accounts.rows,cloudProviders:b.cloudProviders.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteDynamics365Account=S,b.exportSelectedDynamics365Accounts=function(){var e=angular.copy(b.selectedDynamics365Accounts);return b.selectedDynamics365Accounts=[],e},b.deleteSelectedDynamics365Accounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected dynamics365Accounts?").htmlContent("<b>"+b.selectedDynamics365Accounts.length+" selected</b> will be deleted.").ariaLabel("delete Dynamics365Accounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){b.selectedDynamics365Accounts.forEach(function(e){S(e)}),b.selectedDynamics365Accounts=[]})},b.deselectDynamics365Accounts=function(){b.selectedDynamics365Accounts=[]},b.selectAllDynamics365Accounts=function(){b.selectedDynamics365Accounts=b.dynamics365Accounts.rows};var A=!0,E=1;function y(e){b.dynamics365Accounts=e||{count:0,rows:[]}}function S(e){u.intDynamics365Account.delete({id:e.id}).$promise.then(function(){_.remove(b.dynamics365Accounts.rows,{id:e.id}),b.dynamics365Accounts.count-=1,b.dynamics365Accounts.rows.length||b.getDynamics365Accounts(),g.success({title:_.startCase("Dynamics365Account")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintDynamics365Account"}];for(var n=0;n<e.data.errors.length;n++)g.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else g.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintDynamics365Account",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){A?o(function(){A=!1}):(n||(E=b.query.page),e!==n&&(b.query.page=1),e||(b.query.page=E),b.getDynamics365Accounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dynamics365Accounts","cloudProviders","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("Dynamics365AccountsController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intDynamics365Field.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.dynamics365Account={},o.dynamics365Configuration={},o.configurations=[],o.selectedDynamics365Configuration=-1,o.crudPermissions,o.init=function(e,n){o.dynamics365Account=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intDynamics365Account.getConfigurations({id:o.dynamics365Account.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getDynamics365Configuration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getDynamics365Configuration=function(e){o.advancedForm&&o.advancedForm.$setPristine();o.dynamics365Configuration=o.configurations[e],o.selectedDynamics365Configuration=e,i.intDynamics365Configuration.getSubjects({id:o.dynamics365Configuration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intDynamics365Configuration.getDescriptions({id:o.dynamics365Configuration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intDynamics365Configuration.getFields({id:o.dynamics365Configuration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditDynamics365Configuration=function(e,n){a.show({controller:"CreateOrEditDynamics365ConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{dynamics365Configuration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getDynamics365Configuration(0)})},o.deleteDynamics365Configuration=function(e,n){var t=a.confirm().title("Are you sure want to delete the dynamics365Configuration?").htmlContent("<b>"+(n.name||"dynamics365Configuration")+"</b> will be deleted.").ariaLabel("delete dynamics365Configuration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intDynamics365Configuration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"Dynamics365Configuration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getDynamics365Configuration(0)})},function(){console.log("CANCEL")})},o.saveDynamics365Configuration=function(){o.errors=[],i.intDynamics365Configuration.update({id:o.dynamics365Configuration.id},o.dynamics365Configuration).$promise.then(function(e){var n=_.find(o.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.advancedForm.$setPristine(),s.success({title:"Dynamics365Configuration properly saved!",msg:o.dynamics365Configuration.name?o.dynamics365Configuration.name+" has been saved!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){o.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditDynamics365AccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.dynamics365Configuration,account:o.dynamics365Account,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("Dynamics365AccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_DYNAMICS365CONFIGURATION",g.dynamics365Configuration=angular.copy(l),g.configurations=r,g.newDynamics365Configuration=!1,g.dynamics365Configuration||(g.dynamics365Configuration={channel:"voice",type:"inbound",ticketType:"incident"},g.title="INTEGRATIONS.NEW_DYNAMICS365CONFIGURATION",g.newDynamics365Configuration=!0),g.addNewDynamics365Configuration=function(){g.errors=[],d.intDynamics365Account.addConfiguration({id:n.params.id},g.dynamics365Configuration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"Dynamics365Configuration properly created",msg:g.dynamics365Configuration.name?g.dynamics365Configuration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDynamics365Configuration=function(){g.errors=[],d.intDynamics365Configuration.update({id:g.dynamics365Configuration.id},g.dynamics365Configuration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Dynamics365Configuration properly saved!",msg:g.dynamics365Configuration.name?g.dynamics365Configuration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDynamics365Configuration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The dynamics365Configuration will be deleted.").ariaLabel("Delete Dynamics365Configuration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intDynamics365Configuration.delete({id:g.dynamics365Configuration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.dynamics365Configuration.id}),o.success({title:"Dynamics365Configuration properly deleted!",msg:(g.dynamics365Configuration.name||"dynamics365Configuration")+" has been deleted!"}),v(g.dynamics365Configuration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intDynamics365Configuration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intDynamics365Configuration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","dynamics365Configuration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365ConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDynamics365Field.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intDynamics365Field.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intDynamics365Field.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intDynamics365Account.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditDynamics365AccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.dynamics365Account=c||e.params.dynamics365Account||{},p.cloudProviders=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.alert=l.info,p.gotoDynamics365Accounts=function(){e.go("app.integrations.dynamics365Accounts",{},{reload:"app.integrations.dynamics365Accounts"})},p.saveDynamics365Account=function(){r.intDynamics365Account.update({id:p.dynamics365Account.id},p.dynamics365Account).$promise.then(function(){l.success({title:"Dynamics365Account updated!",msg:p.dynamics365Account.name?p.dynamics365Account.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintDynamics365Account",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","dynamics365Account","cloudProviders","userProfileSection"],angular.module("app.integrations").controller("Dynamics365AccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHDESKACCOUNT",g.freshdeskAccount=angular.copy(l),g.freshdeskAccounts=r,g.newFreshdeskAccount=!1,g.freshdeskAccount||(g.freshdeskAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_FRESHDESKACCOUNT",g.newFreshdeskAccount=!0),g.addNewFreshdeskAccount=function(){g.errors=[],d.intFreshdeskAccount.save(g.freshdeskAccount).$promise.then(function(e){g.freshdeskAccounts.unshift(e.toJSON()),o.success({title:"FreshdeskAccount properly created",msg:g.freshdeskAccount.name?g.freshdeskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshdeskAccount=function(){g.errors=[],d.intFreshdeskAccount.update({id:g.freshdeskAccount.id},g.freshdeskAccount).$promise.then(function(e){var n=_.find(g.freshdeskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshdeskAccount properly saved!",msg:g.freshdeskAccount.name?g.freshdeskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshdeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshdeskAccount will be deleted.").ariaLabel("Delete FreshdeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshdeskAccount.delete({id:g.freshdeskAccount.id}).$promise.then(function(){_.remove(g.freshdeskAccounts,{id:g.freshdeskAccount.id}),o.success({title:"FreshdeskAccount properly deleted!",msg:(g.freshdeskAccount.name||"freshdeskAccount")+" has been deleted!"}),v(g.freshdeskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","freshdeskAccounts","freshdeskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intFreshdeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.freshdeskAccount={},o.freshdeskConfiguration={},o.configurations=[],o.selectedFreshdeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.freshdeskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intFreshdeskAccount.getConfigurations({id:o.freshdeskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getFreshdeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getFreshdeskConfiguration=function(e){o.freshdeskConfiguration=o.configurations[e],o.selectedFreshdeskConfiguration=e,i.intFreshdeskConfiguration.getSubjects({id:o.freshdeskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intFreshdeskConfiguration.getDescriptions({id:o.freshdeskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intFreshdeskConfiguration.getFields({id:o.freshdeskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intFreshdeskConfiguration.getTags({id:o.freshdeskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditFreshdeskConfiguration=function(e,n){a.show({controller:"CreateOrEditFreshdeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshdeskConfiguration(0)})},o.deleteFreshdeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the freshdeskConfiguration?").htmlContent("<b>"+(n.name||"freshdeskConfiguration")+"</b> will be deleted.").ariaLabel("delete freshdeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intFreshdeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"FreshdeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getFreshdeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intFreshdeskConfiguration.setTags({id:o.freshdeskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditFreshdeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.freshdeskConfiguration,account:o.freshdeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("FreshdeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHDESKCONFIGURATION",g.freshdeskConfiguration=angular.copy(l),g.configurations=r,g.newFreshdeskConfiguration=!1,g.freshdeskConfiguration||(g.freshdeskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_FRESHDESKCONFIGURATION",g.newFreshdeskConfiguration=!0),g.addNewFreshdeskConfiguration=function(){g.errors=[],d.intFreshdeskAccount.addConfiguration({id:n.params.id},g.freshdeskConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"FreshdeskConfiguration properly created",msg:g.freshdeskConfiguration.name?g.freshdeskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshdeskConfiguration=function(){g.errors=[],d.intFreshdeskConfiguration.update({id:g.freshdeskConfiguration.id},g.freshdeskConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshdeskConfiguration properly saved!",msg:g.freshdeskConfiguration.name?g.freshdeskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshdeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshdeskConfiguration will be deleted.").ariaLabel("Delete FreshdeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshdeskConfiguration.delete({id:g.freshdeskConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.freshdeskConfiguration.id}),o.success({title:"FreshdeskConfiguration properly deleted!",msg:(g.freshdeskConfiguration.name||"freshdeskConfiguration")+" has been deleted!"}),v(g.freshdeskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshdeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshdeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","freshdeskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshdeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshdeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intFreshdeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshdeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshdeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.freshdeskAccount=c||e.params.freshdeskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoFreshdeskAccounts=function(){e.go("app.integrations.freshdeskAccounts",{},{reload:"app.integrations.freshdeskAccounts"})},u.saveFreshdeskAccount=function(){r.intFreshdeskAccount.update({id:u.freshdeskAccount.id},u.freshdeskAccount).$promise.then(function(){l.success({title:"FreshdeskAccount updated!",msg:u.freshdeskAccount.name?u.freshdeskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshdeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","freshdeskAccount","userProfileSection"],angular.module("app.integrations").controller("FreshdeskAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.freshdeskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="freshdeskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFreshdeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.freshdeskAccounts.edit",{id:e.id,freshdeskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intFreshdeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"FreshdeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"FreshdeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("freshdeskAccount")+"?").htmlContent("<b>"+(e.name||"freshdeskAccount")+"</b> will be deleted.").ariaLabel("delete freshdeskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFreshdeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intFreshdeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FreshdeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFreshdeskAccount=function(e,n){i.show({controller:"CreateOrEditFreshdeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshdeskAccount:n,freshdeskAccounts:f.freshdeskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFreshdeskAccount=y,f.exportSelectedFreshdeskAccounts=function(){var e=angular.copy(f.selectedFreshdeskAccounts);return f.selectedFreshdeskAccounts=[],e},f.deleteSelectedFreshdeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected freshdeskAccounts?").htmlContent("<b>"+f.selectedFreshdeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshdeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFreshdeskAccounts.forEach(function(e){y(e)}),f.selectedFreshdeskAccounts=[]})},f.deselectFreshdeskAccounts=function(){f.selectedFreshdeskAccounts=[]},f.selectAllFreshdeskAccounts=function(){f.selectedFreshdeskAccounts=f.freshdeskAccounts.rows};var b=!0,A=1;function E(e){f.freshdeskAccounts=e||{count:0,rows:[]}}function y(e){m.intFreshdeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.freshdeskAccounts.rows,{id:e.id}),f.freshdeskAccounts.count-=1,f.freshdeskAccounts.rows.length||f.getFreshdeskAccounts(),p.success({title:_.startCase("FreshdeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshdeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintFreshdeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFreshdeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshdeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("FreshdeskAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHSALESACCOUNT",g.freshsalesAccount=angular.copy(l),g.freshsalesAccounts=r,g.newFreshsalesAccount=!1,g.freshsalesAccount||(g.freshsalesAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_FRESHSALESACCOUNT",g.newFreshsalesAccount=!0),g.addNewFreshsalesAccount=function(){g.errors=[],d.intFreshsalesAccount.save(g.freshsalesAccount).$promise.then(function(e){g.freshsalesAccounts.unshift(e.toJSON()),o.success({title:"FreshsalesAccount properly created",msg:g.freshsalesAccount.name?g.freshsalesAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshsalesAccount=function(){g.errors=[],d.intFreshsalesAccount.update({id:g.freshsalesAccount.id},g.freshsalesAccount).$promise.then(function(e){var n=_.find(g.freshsalesAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshsalesAccount properly saved!",msg:g.freshsalesAccount.name?g.freshsalesAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshsalesAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshsalesAccount will be deleted.").ariaLabel("Delete FreshsalesAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshsalesAccount.delete({id:g.freshsalesAccount.id}).$promise.then(function(){_.remove(g.freshsalesAccounts,{id:g.freshsalesAccount.id}),o.success({title:"FreshsalesAccount properly deleted!",msg:(g.freshsalesAccount.name||"freshsalesAccount")+" has been deleted!"}),v(g.freshsalesAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","freshsalesAccounts","freshsalesAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intFreshsalesField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.freshsalesAccount={},o.freshsalesConfiguration={},o.configurations=[],o.selectedFreshsalesConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.freshsalesAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intFreshsalesAccount.getConfigurations({id:o.freshsalesAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getFreshsalesConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getFreshsalesConfiguration=function(e){o.freshsalesConfiguration=o.configurations[e],o.selectedFreshsalesConfiguration=e,i.intFreshsalesConfiguration.getSubjects({id:o.freshsalesConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intFreshsalesConfiguration.getDescriptions({id:o.freshsalesConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intFreshsalesConfiguration.getFields({id:o.freshsalesConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditFreshsalesConfiguration=function(e,n){a.show({controller:"CreateOrEditFreshsalesConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshsalesConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getFreshsalesConfiguration(0)})},o.deleteFreshsalesConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the freshsalesConfiguration?").htmlContent("<b>"+(n.name||"freshsalesConfiguration")+"</b> will be deleted.").ariaLabel("delete freshsalesConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intFreshsalesConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"FreshsalesConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getFreshsalesConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditFreshsalesAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.freshsalesConfiguration,account:o.freshsalesAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("FreshsalesAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_FRESHSALESCONFIGURATION",g.freshsalesConfiguration=angular.copy(l),g.configurations=r,g.newFreshsalesConfiguration=!1,g.freshsalesConfiguration||(g.freshsalesConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_FRESHSALESCONFIGURATION",g.newFreshsalesConfiguration=!0),g.addNewFreshsalesConfiguration=function(){g.errors=[],d.intFreshsalesAccount.addConfiguration({id:n.params.id},g.freshsalesConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"FreshsalesConfiguration properly created",msg:g.freshsalesConfiguration.name?g.freshsalesConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveFreshsalesConfiguration=function(){g.errors=[],d.intFreshsalesConfiguration.update({id:g.freshsalesConfiguration.id},g.freshsalesConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"FreshsalesConfiguration properly saved!",msg:g.freshsalesConfiguration.name?g.freshsalesConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteFreshsalesConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The freshsalesConfiguration will be deleted.").ariaLabel("Delete FreshsalesConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intFreshsalesConfiguration.delete({id:g.freshsalesConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.freshsalesConfiguration.id}),o.success({title:"FreshsalesConfiguration properly deleted!",msg:(g.freshsalesConfiguration.name||"freshsalesConfiguration")+" has been deleted!"}),v(g.freshsalesConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intFreshsalesConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intFreshsalesConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","freshsalesConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshsalesField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intFreshsalesField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intFreshsalesField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intFreshsalesAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditFreshsalesAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.freshsalesAccount=c||e.params.freshsalesAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoFreshsalesAccounts=function(){e.go("app.integrations.freshsalesAccounts",{},{reload:"app.integrations.freshsalesAccounts"})},u.saveFreshsalesAccount=function(){r.intFreshsalesAccount.update({id:u.freshsalesAccount.id},u.freshsalesAccount).$promise.then(function(){l.success({title:"FreshsalesAccount updated!",msg:u.freshsalesAccount.name?u.freshsalesAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintFreshsalesAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","freshsalesAccount","userProfileSection"],angular.module("app.integrations").controller("FreshsalesAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.freshsalesAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="freshsalesAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedFreshsalesAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,apiKey,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.freshsalesAccounts.edit",{id:e.id,freshsalesAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intFreshsalesAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"FreshsalesAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"FreshsalesAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("freshsalesAccount")+"?").htmlContent("<b>"+(e.name||"freshsalesAccount")+"</b> will be deleted.").ariaLabel("delete freshsalesAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getFreshsalesAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intFreshsalesAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="FreshsalesAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditFreshsalesAccount=function(e,n){i.show({controller:"CreateOrEditFreshsalesAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/freshsalesAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{freshsalesAccount:n,freshsalesAccounts:f.freshsalesAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteFreshsalesAccount=y,f.exportSelectedFreshsalesAccounts=function(){var e=angular.copy(f.selectedFreshsalesAccounts);return f.selectedFreshsalesAccounts=[],e},f.deleteSelectedFreshsalesAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected freshsalesAccounts?").htmlContent("<b>"+f.selectedFreshsalesAccounts.length+" selected</b> will be deleted.").ariaLabel("delete FreshsalesAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedFreshsalesAccounts.forEach(function(e){y(e)}),f.selectedFreshsalesAccounts=[]})},f.deselectFreshsalesAccounts=function(){f.selectedFreshsalesAccounts=[]},f.selectAllFreshsalesAccounts=function(){f.selectedFreshsalesAccounts=f.freshsalesAccounts.rows};var b=!0,A=1;function E(e){f.freshsalesAccounts=e||{count:0,rows:[]}}function y(e){m.intFreshsalesAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.freshsalesAccounts.rows,{id:e.id}),f.freshsalesAccounts.count-=1,f.freshsalesAccounts.rows.length||f.getFreshsalesAccounts(),p.success({title:_.startCase("FreshsalesAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintFreshsalesAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintFreshsalesAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getFreshsalesAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","freshsalesAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("FreshsalesAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SALESFORCEACCOUNT",g.salesforceAccount=angular.copy(l),g.salesforceAccounts=r,g.newSalesforceAccount=!1,g.salesforceAccount||(g.salesforceAccount={type:"integrationTab",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SALESFORCEACCOUNT",g.newSalesforceAccount=!0),g.addNewSalesforceAccount=function(){g.errors=[],d.intSalesforceAccount.save(g.salesforceAccount).$promise.then(function(e){g.salesforceAccounts.unshift(e.toJSON()),o.success({title:"SalesforceAccount properly created",msg:g.salesforceAccount.name?g.salesforceAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSalesforceAccount=function(){g.errors=[],d.intSalesforceAccount.update({id:g.salesforceAccount.id},g.salesforceAccount).$promise.then(function(e){var n=_.find(g.salesforceAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SalesforceAccount properly saved!",msg:g.salesforceAccount.name?g.salesforceAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSalesforceAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The salesforceAccount will be deleted.").ariaLabel("Delete SalesforceAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSalesforceAccount.delete({id:g.salesforceAccount.id}).$promise.then(function(){_.remove(g.salesforceAccounts,{id:g.salesforceAccount.id}),o.success({title:"SalesforceAccount properly deleted!",msg:(g.salesforceAccount.name||"salesforceAccount")+" has been deleted!"}),v(g.salesforceAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","salesforceAccounts","salesforceAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function n(){return"Case"===o.salesforceConfiguration.ticketType&&("lead"===o.salesforceConfiguration.moduleCreate||_.includes(["lead","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch))}function r(){return _.includes(["lead","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function l(){return _.includes(["contact","contact_lead","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function d(){return _.includes(["account","account_contact_lead"],o.salesforceConfiguration.moduleSearch)}function c(){return i.intSalesforceConfiguration.update({id:o.salesforceConfiguration.id},o.salesforceConfiguration).$promise.then(function(){s.success({title:"Module updated!",msg:"Module has been updated!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function m(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function u(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(e){i.intSalesforceField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.salesforceAccount={},o.salesforceConfiguration={},o.configurations=[],o.selectedSalesforceConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.salesforceAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intSalesforceAccount.getConfigurations({id:o.salesforceAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getSalesforceConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getSalesforceConfiguration=function(e){o.salesforceConfiguration=o.configurations[e],o.salesforceConfiguration.isLead=n(),o.salesforceConfiguration.isLeadSearch=r(),o.salesforceConfiguration.isContactSearch=l(),o.salesforceConfiguration.isAccountSearch=d(),o.selectedSalesforceConfiguration=e,i.intSalesforceConfiguration.getSubjects({id:o.salesforceConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intSalesforceConfiguration.getDescriptions({id:o.salesforceConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intSalesforceConfiguration.getFields({id:o.salesforceConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditSalesforceConfiguration=function(e,n){a.show({controller:"CreateOrEditSalesforceConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSalesforceConfiguration(0)})},o.deleteSalesforceConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the salesforceConfiguration?").htmlContent("<b>"+(n.name||"salesforceConfiguration")+"</b> will be deleted.").ariaLabel("delete salesforceConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intSalesforceConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"SalesforceConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getSalesforceConfiguration(0)})},function(){console.log("CANCEL")})},o.selectChangedAdvanced=function(){o.salesforceConfiguration.isLead=n(),o.salesforceConfiguration.isLeadSearch=r(),o.salesforceConfiguration.isContactSearch=l(),o.salesforceConfiguration.isAccountSearch=d(),c()},o.salesforceConfiguration.isLead=!1,o.salesforceConfiguration.isLeadSearch=!1,o.salesforceConfiguration.isContactSearch=!1,o.salesforceConfiguration.isAccountSearch=!1,o.checkIsLead=n,o.checkIsLeadSearch=r,o.checkIsContactSearch=l,o.checkIsAccountSearch=d,o.saveSalesforceConfiguration=c,o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){m(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){m(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){u(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){u(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditSalesforceAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.salesforceConfiguration,account:o.salesforceAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){p(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){p(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SalesforceAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SALESFORCECONFIGURATION",g.salesforceConfiguration=angular.copy(l),g.configurations=r,g.newSalesforceConfiguration=!1,g.salesforceConfiguration||(g.salesforceConfiguration={channel:"voice",type:"inbound",ticketType:"Task"},g.title="INTEGRATIONS.NEW_SALESFORCECONFIGURATION",g.newSalesforceConfiguration=!0),g.addNewSalesforceConfiguration=function(){g.errors=[],d.intSalesforceAccount.addConfiguration({id:n.params.id},g.salesforceConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"SalesforceConfiguration properly created",msg:g.salesforceConfiguration.name?g.salesforceConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSalesforceConfiguration=function(){g.errors=[],d.intSalesforceConfiguration.update({id:g.salesforceConfiguration.id},g.salesforceConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SalesforceConfiguration properly saved!",msg:g.salesforceConfiguration.name?g.salesforceConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSalesforceConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The salesforceConfiguration will be deleted.").ariaLabel("Delete SalesforceConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSalesforceConfiguration.delete({id:g.salesforceConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.salesforceConfiguration.id}),o.success({title:"SalesforceConfiguration properly deleted!",msg:(g.salesforceConfiguration.name||"salesforceConfiguration")+" has been deleted!"}),v(g.salesforceConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSalesforceConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSalesforceConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","salesforceConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSalesforceField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSalesforceField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intSalesforceField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSalesforceAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSalesforceAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.salesforceAccount=c||e.params.salesforceAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoSalesforceAccounts=function(){e.go("app.integrations.salesforceAccounts",{},{reload:"app.integrations.salesforceAccounts"})},u.saveSalesforceAccount=function(){r.intSalesforceAccount.update({id:u.salesforceAccount.id},u.salesforceAccount).$promise.then(function(){l.success({title:"SalesforceAccount updated!",msg:u.salesforceAccount.name?u.salesforceAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSalesforceAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","salesforceAccount","userProfileSection"],angular.module("app.integrations").controller("SalesforceAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.salesforceAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="salesforceAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSalesforceAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,password,clientId,clientSecret,securityToken,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.salesforceAccounts.edit",{id:e.id,salesforceAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intSalesforceAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"SalesforceAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"SalesforceAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("salesforceAccount")+"?").htmlContent("<b>"+(e.name||"salesforceAccount")+"</b> will be deleted.").ariaLabel("delete salesforceAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSalesforceAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intSalesforceAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SalesforceAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSalesforceAccount=function(e,n){i.show({controller:"CreateOrEditSalesforceAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{salesforceAccount:n,salesforceAccounts:f.salesforceAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSalesforceAccount=y,f.exportSelectedSalesforceAccounts=function(){var e=angular.copy(f.selectedSalesforceAccounts);return f.selectedSalesforceAccounts=[],e},f.deleteSelectedSalesforceAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected salesforceAccounts?").htmlContent("<b>"+f.selectedSalesforceAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SalesforceAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSalesforceAccounts.forEach(function(e){y(e)}),f.selectedSalesforceAccounts=[]})},f.deselectSalesforceAccounts=function(){f.selectedSalesforceAccounts=[]},f.selectAllSalesforceAccounts=function(){f.selectedSalesforceAccounts=f.salesforceAccounts.rows};var b=!0,A=1;function E(e){f.salesforceAccounts=e||{count:0,rows:[]}}function y(e){m.intSalesforceAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.salesforceAccounts.rows,{id:e.id}),f.salesforceAccounts.count-=1,f.salesforceAccounts.rows.length||f.getSalesforceAccounts(),p.success({title:_.startCase("SalesforceAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSalesforceAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintSalesforceAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSalesforceAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","salesforceAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("SalesforceAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SERVICENOWACCOUNT",g.servicenowAccount=angular.copy(l),g.servicenowAccounts=r,g.newServicenowAccount=!1,g.servicenowAccount||(g.servicenowAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SERVICENOWACCOUNT",g.newServicenowAccount=!0),g.addNewServicenowAccount=function(){g.errors=[],d.intServicenowAccount.save(g.servicenowAccount).$promise.then(function(e){g.servicenowAccounts.unshift(e.toJSON()),o.success({title:"ServicenowAccount properly created",msg:g.servicenowAccount.name?g.servicenowAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveServicenowAccount=function(){g.errors=[],d.intServicenowAccount.update({id:g.servicenowAccount.id},g.servicenowAccount).$promise.then(function(e){var n=_.find(g.servicenowAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ServicenowAccount properly saved!",msg:g.servicenowAccount.name?g.servicenowAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteServicenowAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The servicenowAccount will be deleted.").ariaLabel("Delete ServicenowAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intServicenowAccount.delete({id:g.servicenowAccount.id}).$promise.then(function(){_.remove(g.servicenowAccounts,{id:g.servicenowAccount.id}),o.success({title:"ServicenowAccount properly deleted!",msg:(g.servicenowAccount.name||"servicenowAccount")+" has been deleted!"}),v(g.servicenowAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","servicenowAccounts","servicenowAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intServicenowField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.servicenowAccount={},o.servicenowConfiguration={},o.configurations=[],o.selectedServicenowConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.servicenowAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intServicenowAccount.getConfigurations({id:o.servicenowAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getServicenowConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getServicenowConfiguration=function(e){o.servicenowConfiguration=o.configurations[e],o.selectedServicenowConfiguration=e,i.intServicenowConfiguration.getSubjects({id:o.servicenowConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intServicenowConfiguration.getDescriptions({id:o.servicenowConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intServicenowConfiguration.getFields({id:o.servicenowConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditServicenowConfiguration=function(e,n){a.show({controller:"CreateOrEditServicenowConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getServicenowConfiguration(0)})},o.deleteServicenowConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the servicenowConfiguration?").htmlContent("<b>"+(n.name||"servicenowConfiguration")+"</b> will be deleted.").ariaLabel("delete servicenowConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intServicenowConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"ServicenowConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getServicenowConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditServicenowAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.servicenowConfiguration,account:o.servicenowAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ServicenowAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SERVICENOWCONFIGURATION",g.servicenowConfiguration=angular.copy(l),g.configurations=r,g.newServicenowConfiguration=!1,g.servicenowConfiguration||(g.servicenowConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_SERVICENOWCONFIGURATION",g.newServicenowConfiguration=!0),g.addNewServicenowConfiguration=function(){g.errors=[],d.intServicenowAccount.addConfiguration({id:n.params.id},g.servicenowConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"ServicenowConfiguration properly created",msg:g.servicenowConfiguration.name?g.servicenowConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveServicenowConfiguration=function(){g.errors=[],d.intServicenowConfiguration.update({id:g.servicenowConfiguration.id},g.servicenowConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ServicenowConfiguration properly saved!",msg:g.servicenowConfiguration.name?g.servicenowConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteServicenowConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The servicenowConfiguration will be deleted.").ariaLabel("Delete ServicenowConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intServicenowConfiguration.delete({id:g.servicenowConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.servicenowConfiguration.id}),o.success({title:"ServicenowConfiguration properly deleted!",msg:(g.servicenowConfiguration.name||"servicenowConfiguration")+" has been deleted!"}),v(g.servicenowConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intServicenowConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intServicenowConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","servicenowConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intServicenowField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intServicenowField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intServicenowField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intServicenowAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditServicenowAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.servicenowAccount=c||e.params.servicenowAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoServicenowAccounts=function(){e.go("app.integrations.servicenowAccounts",{},{reload:"app.integrations.servicenowAccounts"})},u.saveServicenowAccount=function(){r.intServicenowAccount.update({id:u.servicenowAccount.id},u.servicenowAccount).$promise.then(function(){l.success({title:"ServicenowAccount updated!",msg:u.servicenowAccount.name?u.servicenowAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintServicenowAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","servicenowAccount","userProfileSection"],angular.module("app.integrations").controller("ServicenowAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.servicenowAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="servicenowAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedServicenowAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,password,email,remoteUri,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.servicenowAccounts.edit",{id:e.id,servicenowAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intServicenowAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ServicenowAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ServicenowAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("servicenowAccount")+"?").htmlContent("<b>"+(e.name||"servicenowAccount")+"</b> will be deleted.").ariaLabel("delete servicenowAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getServicenowAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intServicenowAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ServicenowAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditServicenowAccount=function(e,n){i.show({controller:"CreateOrEditServicenowAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/servicenowAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{servicenowAccount:n,servicenowAccounts:f.servicenowAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteServicenowAccount=y,f.exportSelectedServicenowAccounts=function(){var e=angular.copy(f.selectedServicenowAccounts);return f.selectedServicenowAccounts=[],e},f.deleteSelectedServicenowAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected servicenowAccounts?").htmlContent("<b>"+f.selectedServicenowAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ServicenowAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedServicenowAccounts.forEach(function(e){y(e)}),f.selectedServicenowAccounts=[]})},f.deselectServicenowAccounts=function(){f.selectedServicenowAccounts=[]},f.selectAllServicenowAccounts=function(){f.selectedServicenowAccounts=f.servicenowAccounts.rows};var b=!0,A=1;function E(e){f.servicenowAccounts=e||{count:0,rows:[]}}function y(e){m.intServicenowAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.servicenowAccounts.rows,{id:e.id}),f.servicenowAccounts.count-=1,f.servicenowAccounts.rows.length||f.getServicenowAccounts(),p.success({title:_.startCase("ServicenowAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintServicenowAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintServicenowAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getServicenowAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","servicenowAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ServicenowAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SUGARCRMACCOUNT",g.sugarcrmAccount=angular.copy(l),g.sugarcrmAccounts=r,g.newSugarcrmAccount=!1,g.sugarcrmAccount||(g.sugarcrmAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_SUGARCRMACCOUNT",g.newSugarcrmAccount=!0),g.addNewSugarcrmAccount=function(){g.errors=[],d.intSugarcrmAccount.save(g.sugarcrmAccount).$promise.then(function(e){g.sugarcrmAccounts.unshift(e.toJSON()),o.success({title:"SugarcrmAccount properly created",msg:g.sugarcrmAccount.name?g.sugarcrmAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSugarcrmAccount=function(){g.errors=[],d.intSugarcrmAccount.update({id:g.sugarcrmAccount.id},g.sugarcrmAccount).$promise.then(function(e){var n=_.find(g.sugarcrmAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SugarcrmAccount properly saved!",msg:g.sugarcrmAccount.name?g.sugarcrmAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSugarcrmAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sugarcrmAccount will be deleted.").ariaLabel("Delete SugarcrmAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSugarcrmAccount.delete({id:g.sugarcrmAccount.id}).$promise.then(function(){_.remove(g.sugarcrmAccounts,{id:g.sugarcrmAccount.id}),o.success({title:"SugarcrmAccount properly deleted!",msg:(g.sugarcrmAccount.name||"sugarcrmAccount")+" has been deleted!"}),v(g.sugarcrmAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","sugarcrmAccounts","sugarcrmAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intSugarcrmField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.sugarcrmAccount={},o.sugarcrmConfiguration={},o.configurations=[],o.selectedSugarcrmConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.sugarcrmAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intSugarcrmAccount.getConfigurations({id:o.sugarcrmAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getSugarcrmConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getSugarcrmConfiguration=function(e){o.sugarcrmConfiguration=o.configurations[e],o.selectedSugarcrmConfiguration=e,i.intSugarcrmConfiguration.getSubjects({id:o.sugarcrmConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intSugarcrmConfiguration.getDescriptions({id:o.sugarcrmConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intSugarcrmConfiguration.getFields({id:o.sugarcrmConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditSugarcrmConfiguration=function(e,n){a.show({controller:"CreateOrEditSugarcrmConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getSugarcrmConfiguration(0)})},o.deleteSugarcrmConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the sugarcrmConfiguration?").htmlContent("<b>"+(n.name||"sugarcrmConfiguration")+"</b> will be deleted.").ariaLabel("delete sugarcrmConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intSugarcrmConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"SugarcrmConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getSugarcrmConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditSugarcrmAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.sugarcrmConfiguration,account:o.sugarcrmAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("SugarcrmAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_SUGARCRMCONFIGURATION",g.sugarcrmConfiguration=angular.copy(l),g.configurations=r,g.newSugarcrmConfiguration=!1,g.sugarcrmConfiguration||(g.sugarcrmConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_SUGARCRMCONFIGURATION",g.newSugarcrmConfiguration=!0),g.addNewSugarcrmConfiguration=function(){g.errors=[],d.intSugarcrmAccount.addConfiguration({id:n.params.id},g.sugarcrmConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"SugarcrmConfiguration properly created",msg:g.sugarcrmConfiguration.name?g.sugarcrmConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSugarcrmConfiguration=function(){g.errors=[],d.intSugarcrmConfiguration.update({id:g.sugarcrmConfiguration.id},g.sugarcrmConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SugarcrmConfiguration properly saved!",msg:g.sugarcrmConfiguration.name?g.sugarcrmConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSugarcrmConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sugarcrmConfiguration will be deleted.").ariaLabel("Delete SugarcrmConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intSugarcrmConfiguration.delete({id:g.sugarcrmConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.sugarcrmConfiguration.id}),o.success({title:"SugarcrmConfiguration properly deleted!",msg:(g.sugarcrmConfiguration.name||"sugarcrmConfiguration")+" has been deleted!"}),v(g.sugarcrmConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intSugarcrmConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intSugarcrmConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","sugarcrmConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSugarcrmField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intSugarcrmField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intSugarcrmField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intSugarcrmAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditSugarcrmAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.sugarcrmAccount=c||e.params.sugarcrmAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoSugarcrmAccounts=function(){e.go("app.integrations.sugarcrmAccounts",{},{reload:"app.integrations.sugarcrmAccounts"})},u.saveSugarcrmAccount=function(){r.intSugarcrmAccount.update({id:u.sugarcrmAccount.id},u.sugarcrmAccount).$promise.then(function(){l.success({title:"SugarcrmAccount updated!",msg:u.sugarcrmAccount.name?u.sugarcrmAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintSugarcrmAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","sugarcrmAccount","userProfileSection"],angular.module("app.integrations").controller("SugarcrmAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.sugarcrmAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="sugarcrmAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSugarcrmAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,username,remoteUri,password,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.sugarcrmAccounts.edit",{id:e.id,sugarcrmAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intSugarcrmAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"SugarcrmAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"SugarcrmAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("sugarcrmAccount")+"?").htmlContent("<b>"+(e.name||"sugarcrmAccount")+"</b> will be deleted.").ariaLabel("delete sugarcrmAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSugarcrmAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intSugarcrmAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SugarcrmAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSugarcrmAccount=function(e,n){i.show({controller:"CreateOrEditSugarcrmAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sugarcrmAccount:n,sugarcrmAccounts:f.sugarcrmAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSugarcrmAccount=y,f.exportSelectedSugarcrmAccounts=function(){var e=angular.copy(f.selectedSugarcrmAccounts);return f.selectedSugarcrmAccounts=[],e},f.deleteSelectedSugarcrmAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected sugarcrmAccounts?").htmlContent("<b>"+f.selectedSugarcrmAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SugarcrmAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSugarcrmAccounts.forEach(function(e){y(e)}),f.selectedSugarcrmAccounts=[]})},f.deselectSugarcrmAccounts=function(){f.selectedSugarcrmAccounts=[]},f.selectAllSugarcrmAccounts=function(){f.selectedSugarcrmAccounts=f.sugarcrmAccounts.rows};var b=!0,A=1;function E(e){f.sugarcrmAccounts=e||{count:0,rows:[]}}function y(e){m.intSugarcrmAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.sugarcrmAccounts.rows,{id:e.id}),f.sugarcrmAccounts.count-=1,f.sugarcrmAccounts.rows.length||f.getSugarcrmAccounts(),p.success({title:_.startCase("SugarcrmAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintSugarcrmAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintSugarcrmAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSugarcrmAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sugarcrmAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("SugarcrmAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_VTIGERACCOUNT",g.vtigerAccount=angular.copy(l),g.vtigerAccounts=r,g.newVtigerAccount=!1,g.vtigerAccount||(g.vtigerAccount={serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_VTIGERACCOUNT",g.newVtigerAccount=!0),g.addNewVtigerAccount=function(){g.errors=[],d.intVtigerAccount.save(g.vtigerAccount).$promise.then(function(e){g.vtigerAccounts.unshift(e.toJSON()),o.success({title:"VtigerAccount properly created",msg:g.vtigerAccount.name?g.vtigerAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVtigerAccount=function(){g.errors=[],d.intVtigerAccount.update({id:g.vtigerAccount.id},g.vtigerAccount).$promise.then(function(e){var n=_.find(g.vtigerAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VtigerAccount properly saved!",msg:g.vtigerAccount.name?g.vtigerAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVtigerAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The vtigerAccount will be deleted.").ariaLabel("Delete VtigerAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intVtigerAccount.delete({id:g.vtigerAccount.id}).$promise.then(function(){_.remove(g.vtigerAccounts,{id:g.vtigerAccount.id}),o.success({title:"VtigerAccount properly deleted!",msg:(g.vtigerAccount.name||"vtigerAccount")+" has been deleted!"}),v(g.vtigerAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","vtigerAccounts","vtigerAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intVtigerField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.vtigerAccount={},o.vtigerConfiguration={},o.configurations=[],o.selectedVtigerConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.vtigerAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intVtigerAccount.getConfigurations({id:o.vtigerAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getVtigerConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getVtigerConfiguration=function(e){o.vtigerConfiguration=o.configurations[e],o.selectedVtigerConfiguration=e,i.intVtigerConfiguration.getSubjects({id:o.vtigerConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intVtigerConfiguration.getDescriptions({id:o.vtigerConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intVtigerConfiguration.getFields({id:o.vtigerConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditVtigerConfiguration=function(e,n){a.show({controller:"CreateOrEditVtigerConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getVtigerConfiguration(0)})},o.deleteVtigerConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the vtigerConfiguration?").htmlContent("<b>"+(n.name||"vtigerConfiguration")+"</b> will be deleted.").ariaLabel("delete vtigerConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intVtigerConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"VtigerConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getVtigerConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditVtigerAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.vtigerConfiguration,account:o.vtigerAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("VtigerAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_VTIGERCONFIGURATION",g.vtigerConfiguration=angular.copy(l),g.configurations=r,g.newVtigerConfiguration=!1,g.vtigerConfiguration||(g.vtigerConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_VTIGERCONFIGURATION",g.newVtigerConfiguration=!0),g.addNewVtigerConfiguration=function(){g.errors=[],d.intVtigerAccount.addConfiguration({id:n.params.id},g.vtigerConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"VtigerConfiguration properly created",msg:g.vtigerConfiguration.name?g.vtigerConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVtigerConfiguration=function(){g.errors=[],d.intVtigerConfiguration.update({id:g.vtigerConfiguration.id},g.vtigerConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VtigerConfiguration properly saved!",msg:g.vtigerConfiguration.name?g.vtigerConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVtigerConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The vtigerConfiguration will be deleted.").ariaLabel("Delete VtigerConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intVtigerConfiguration.delete({id:g.vtigerConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.vtigerConfiguration.id}),o.success({title:"VtigerConfiguration properly deleted!",msg:(g.vtigerConfiguration.name||"vtigerConfiguration")+" has been deleted!"}),v(g.vtigerConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intVtigerConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intVtigerConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","vtigerConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intVtigerField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intVtigerField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intVtigerField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intVtigerAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditVtigerAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.vtigerAccount=c||e.params.vtigerAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoVtigerAccounts=function(){e.go("app.integrations.vtigerAccounts",{},{reload:"app.integrations.vtigerAccounts"})},u.saveVtigerAccount=function(){r.intVtigerAccount.update({id:u.vtigerAccount.id},u.vtigerAccount).$promise.then(function(){l.success({title:"VtigerAccount updated!",msg:u.vtigerAccount.name?u.vtigerAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintVtigerAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","vtigerAccount","userProfileSection"],angular.module("app.integrations").controller("VtigerAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.vtigerAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="vtigerAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedVtigerAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,description,username,accessKey,remoteUri,serverUrl",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.integrations.vtigerAccounts.edit",{id:e.id,vtigerAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intVtigerAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"VtigerAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"VtigerAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("vtigerAccount")+"?").htmlContent("<b>"+(e.name||"vtigerAccount")+"</b> will be deleted.").ariaLabel("delete vtigerAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVtigerAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intVtigerAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VtigerAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVtigerAccount=function(e,n){i.show({controller:"CreateOrEditVtigerAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/vtigerAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{vtigerAccount:n,vtigerAccounts:f.vtigerAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVtigerAccount=y,f.exportSelectedVtigerAccounts=function(){var e=angular.copy(f.selectedVtigerAccounts);return f.selectedVtigerAccounts=[],e},f.deleteSelectedVtigerAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected vtigerAccounts?").htmlContent("<b>"+f.selectedVtigerAccounts.length+" selected</b> will be deleted.").ariaLabel("delete VtigerAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVtigerAccounts.forEach(function(e){y(e)}),f.selectedVtigerAccounts=[]})},f.deselectVtigerAccounts=function(){f.selectedVtigerAccounts=[]},f.selectAllVtigerAccounts=function(){f.selectedVtigerAccounts=f.vtigerAccounts.rows};var b=!0,A=1;function E(e){f.vtigerAccounts=e||{count:0,rows:[]}}function y(e){m.intVtigerAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.vtigerAccounts.rows,{id:e.id}),f.vtigerAccounts.count-=1,f.vtigerAccounts.rows.length||f.getVtigerAccounts(),p.success({title:_.startCase("VtigerAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintVtigerAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintVtigerAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVtigerAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","vtigerAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("VtigerAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZENDESKACCOUNT",g.zendeskAccount=angular.copy(l),g.zendeskAccounts=r,g.newZendeskAccount=!1,g.zendeskAccount||(g.zendeskAccount={type:"integrationTab",authType:"password",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_ZENDESKACCOUNT",g.newZendeskAccount=!0),g.addNewZendeskAccount=function(){g.errors=[],d.intZendeskAccount.save(g.zendeskAccount).$promise.then(function(e){g.zendeskAccounts.unshift(e.toJSON()),o.success({title:"ZendeskAccount properly created",msg:g.zendeskAccount.name?g.zendeskAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZendeskAccount=function(){g.errors=[],d.intZendeskAccount.update({id:g.zendeskAccount.id},g.zendeskAccount).$promise.then(function(e){var n=_.find(g.zendeskAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZendeskAccount properly saved!",msg:g.zendeskAccount.name?g.zendeskAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZendeskAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zendeskAccount will be deleted.").ariaLabel("Delete ZendeskAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZendeskAccount.delete({id:g.zendeskAccount.id}).$promise.then(function(){_.remove(g.zendeskAccounts,{id:g.zendeskAccount.id}),o.success({title:"ZendeskAccount properly deleted!",msg:(g.zendeskAccount.name||"zendeskAccount")+" has been deleted!"}),v(g.zendeskAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zendeskAccounts","zendeskAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskAccountDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZendeskField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZendeskField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intZendeskField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZendeskAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.zendeskAccount=c||e.params.zendeskAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoZendeskAccounts=function(){e.go("app.integrations.zendeskAccounts",{},{reload:"app.integrations.zendeskAccounts"})},u.saveZendeskAccount=function(){r.intZendeskAccount.update({id:u.zendeskAccount.id},u.zendeskAccount).$promise.then(function(){l.success({title:"ZendeskAccount updated!",msg:u.zendeskAccount.name?u.zendeskAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZendeskAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","zendeskAccount","userProfileSection"],angular.module("app.integrations").controller("ZendeskAccountController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intZendeskField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.zendeskAccount={},o.zendeskConfiguration={},o.zendeskConfigurations=[],o.selectedZendeskConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.zendeskAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intZendeskAccount.getConfigurations({id:o.zendeskAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.zendeskConfigurations=e.rows?e.rows:[],o.zendeskConfigurations.length&&o.getZendeskConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getZendeskConfiguration=function(e){o.zendeskConfiguration=o.zendeskConfigurations[e],o.selectedZendeskConfiguration=e,i.intZendeskConfiguration.getSubjects({id:o.zendeskConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intZendeskConfiguration.getDescriptions({id:o.zendeskConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intZendeskConfiguration.getFields({id:o.zendeskConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})}),i.intZendeskConfiguration.getTags({id:o.zendeskConfiguration.id}).$promise.then(function(e){o.selectedTags=e.rows?_.map(e.rows,"id"):[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditZendeskConfiguration=function(e,n){a.show({controller:"CreateOrEditZendeskConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskConfiguration:n,zendeskConfigurations:o.zendeskConfigurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZendeskConfiguration(0)})},o.deleteZendeskConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the zendeskConfiguration?").htmlContent("<b>"+(n.name||"zendeskConfiguration")+"</b> will be deleted.").ariaLabel("delete zendeskConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intZendeskConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.zendeskConfigurations,{id:n.id}),s.success({title:"ZendeskConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getZendeskConfiguration(0)})},function(){console.log("CANCEL")})},o.selectedTags=[],o.selectTagsChanged=function(e){i.intZendeskConfiguration.setTags({id:o.zendeskConfiguration.id,ids:o.selectedTags}).$promise.then(function(){s.success({title:"Tags set!",msg:"Tags has been set!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ADDTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})},i.tag.get({nolimit:!0,sort:"name"}).$promise.then(function(e){o.tags=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditZendeskAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.zendeskConfiguration,account:o.zendeskAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ZendeskAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZENDESKCONFIGURATION",g.zendeskConfiguration=angular.copy(l),g.zendeskConfigurations=r,g.newZendeskConfiguration=!1,g.zendeskConfiguration||(g.zendeskConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_ZENDESKCONFIGURATION",g.newZendeskConfiguration=!0),g.addNewZendeskConfiguration=function(){g.errors=[],d.intZendeskAccount.addConfiguration({id:n.params.id},g.zendeskConfiguration).$promise.then(function(e){g.zendeskConfigurations.unshift(e.toJSON()),o.success({title:"ZendeskConfiguration properly created",msg:g.zendeskConfiguration.name?g.zendeskConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZendeskConfiguration=function(){g.errors=[],d.intZendeskConfiguration.update({id:g.zendeskConfiguration.id},g.zendeskConfiguration).$promise.then(function(e){var n=_.find(g.zendeskConfigurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZendeskConfiguration properly saved!",msg:g.zendeskConfiguration.name?g.zendeskConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZendeskConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zendeskConfiguration will be deleted.").ariaLabel("Delete ZendeskConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZendeskConfiguration.delete({id:g.zendeskConfiguration.id}).$promise.then(function(){_.remove(g.zendeskConfigurations,{id:g.zendeskConfiguration.id}),o.success({title:"ZendeskConfiguration properly deleted!",msg:(g.zendeskConfiguration.name||"zendeskConfiguration")+" has been deleted!"}),v(g.zendeskConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZendeskConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZendeskConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zendeskConfigurations","zendeskConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZendeskConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.zendeskAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="zendeskAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedZendeskAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,type,username,remoteUri,authType,password,token,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Integration_Tab",value:"'integrationTab'"},{option:"New_Tab",value:"'newTab'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayauthType=_.keyBy([{option:"Password",value:"'password'"},{option:"Token",value:"'token'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.zendeskAccounts.edit",{id:e.id,zendeskAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intZendeskAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ZendeskAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ZendeskAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("zendeskAccount")+"?").htmlContent("<b>"+(e.name||"zendeskAccount")+"</b> will be deleted.").ariaLabel("delete zendeskAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getZendeskAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intZendeskAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ZendeskAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditZendeskAccount=function(e,n){i.show({controller:"CreateOrEditZendeskAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{zendeskAccount:n,zendeskAccounts:f.zendeskAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteZendeskAccount=y,f.exportSelectedZendeskAccounts=function(){var e=angular.copy(f.selectedZendeskAccounts);return f.selectedZendeskAccounts=[],e},f.deleteSelectedZendeskAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected zendeskAccounts?").htmlContent("<b>"+f.selectedZendeskAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZendeskAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedZendeskAccounts.forEach(function(e){y(e)}),f.selectedZendeskAccounts=[]})},f.deselectZendeskAccounts=function(){f.selectedZendeskAccounts=[]},f.selectAllZendeskAccounts=function(){f.selectedZendeskAccounts=f.zendeskAccounts.rows};var b=!0,A=1;function E(e){f.zendeskAccounts=e||{count:0,rows:[]}}function y(e){m.intZendeskAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.zendeskAccounts.rows,{id:e.id}),f.zendeskAccounts.count-=1,f.zendeskAccounts.rows.length||f.getZendeskAccounts(),p.success({title:_.startCase("ZendeskAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZendeskAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintZendeskAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getZendeskAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zendeskAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ZendeskAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZOHOACCOUNT",g.zohoAccount=angular.copy(l),g.zohoAccounts=r,g.newZohoAccount=!1,g.zohoAccount||(g.zohoAccount={host:"zoho.com",zone:"EU",serverUrl:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():"")},g.title="INTEGRATIONS.NEW_ZOHOACCOUNT",g.newZohoAccount=!0),g.addNewZohoAccount=function(){g.errors=[],d.intZohoAccount.save(g.zohoAccount).$promise.then(function(e){g.zohoAccounts.unshift(e.toJSON()),o.success({title:"ZohoAccount properly created",msg:g.zohoAccount.name?g.zohoAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZohoAccount=function(){g.errors=[],d.intZohoAccount.update({id:g.zohoAccount.id},g.zohoAccount).$promise.then(function(e){var n=_.find(g.zohoAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZohoAccount properly saved!",msg:g.zohoAccount.name?g.zohoAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZohoAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zohoAccount will be deleted.").ariaLabel("Delete ZohoAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZohoAccount.delete({id:g.zohoAccount.id}).$promise.then(function(){_.remove(g.zohoAccounts,{id:g.zohoAccount.id}),o.success({title:"ZohoAccount properly deleted!",msg:(g.zohoAccount.name||"zohoAccount")+" has been deleted!"}),v(g.zohoAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","zohoAccounts","zohoAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoAccountDialogController",e)}(),function(){"use strict";function e(a,t,i,s,e){var o=this;function r(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.subjects,{id:e.id}),s.success({title:"Subject deleted!",msg:"Subject has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function l(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.descriptions,{id:e.id}),s.success({title:"Description deleted!",msg:"Description has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}function d(e){i.intZohoField.delete({id:e.id}).$promise.then(function(){_.remove(o.fields,{id:e.id}),s.success({title:"Field deleted!",msg:"Field has been deleted!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})}o.currentUser=e.getCurrentUser(),o.zohoAccount={},o.zohoConfiguration={},o.configurations=[],o.selectedZohoConfiguration=-1,o.crudPermissions,o.init=function(e,n){o.zohoAccount=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.intZohoAccount.getConfigurations({id:o.zohoAccount.id,sort:"-updatedAt"}).$promise.then(function(e){return o.configurations=e.rows?e.rows:[],o.configurations.length&&o.getZohoConfiguration(0),i.variable.get({nolimit:!0,sort:"name"}).$promise}).then(function(e){o.variables=e.rows?e.rows:[],o.variablesById=_.keyBy(o.variables,"id")}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETCONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.getZohoConfiguration=function(e){o.zohoConfiguration=o.configurations[e],o.selectedZohoConfiguration=e,i.intZohoConfiguration.getSubjects({id:o.zohoConfiguration.id}).$promise.then(function(e){return o.subjects=e.rows?e.rows:[],i.intZohoConfiguration.getDescriptions({id:o.zohoConfiguration.id}).$promise}).then(function(e){return o.descriptions=e.rows?e.rows:[],i.intZohoConfiguration.getFields({id:o.zohoConfiguration.id}).$promise}).then(function(e){o.fields=e.rows?e.rows:[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETConfigurations",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.createOrEditZohoConfiguration=function(e,n){a.show({controller:"CreateOrEditZohoConfigurationDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoConfiguration:n,configurations:o.configurations,license:null,setting:null,crudPermissions:o.crudPermissions}}).finally(function(){o.getZohoConfiguration(0)})},o.deleteZohoConfiguration=function(e,n){var t=a.confirm().title("Are you sure want to delete the zohoConfiguration?").htmlContent("<b>"+(n.name||"zohoConfiguration")+"</b> will be deleted.").ariaLabel("delete zohoConfiguration").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){i.intZohoConfiguration.delete({id:n.id}).$promise.then(function(){_.remove(o.configurations,{id:n.id}),s.success({title:"ZohoConfiguration deleted!",msg:n.name?n.name+" has been deleted!":""})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETECONFIGURATION",msg:e.data?JSON.stringify(e.data):e.toString()})}).finally(function(){o.getZohoConfiguration(0)})},function(){console.log("CANCEL")})},o.selectChangedAdvanced=function(){i.intZohoConfiguration.update({id:o.zohoConfiguration.id},o.zohoConfiguration).$promise.then(function(){s.success({title:"Module updated!",msg:"Module has been updated!"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATECONFIGURATIONFIELD",msg:e.data?JSON.stringify(e.data):e.toString()})})},o.selectedSubjects=[],o.createOrEditSubject=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"subject",item:n,items:o.subjects,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteSubjectConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the subject?").htmlContent("<b>Subject</b> will be deleted.").ariaLabel("delete subject").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){r(n)},function(){console.log("CANCEL")})},o.deleteSelectedSubjects=function(e){var n=a.confirm().title("Are you sure want to delete the selected subjects?").htmlContent("<b>"+o.selectedSubjects.length+" selected</b> will be deleted.").ariaLabel("delete subjects").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedSubjects.forEach(function(e){r(e)}),o.selectedSubjects=[]})},o.selectedDescriptions=[],o.createOrEditDescription=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"description",item:n,items:o.descriptions,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteDescriptionConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the description?").htmlContent("<b>Description</b> will be deleted.").ariaLabel("delete description").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){l(n)},function(){console.log("CANCEL")})},o.deleteSelectedDescriptions=function(e){var n=a.confirm().title("Are you sure want to delete the selected descriptions?").htmlContent("<b>"+o.selectedDescriptions.length+" selected</b> will be deleted.").ariaLabel("delete descriptions").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedDescriptions.forEach(function(e){l(e)}),o.selectedDescriptions=[]})},o.selectedFields=[],o.createOrEditField=function(e,n){a.show({controller:"CreateOrEditZohoAccountItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{type:"field",item:n,items:o.fields,configuration:o.zohoConfiguration,account:o.zohoAccount,license:null,setting:null,crudPermissions:o.crudPermissions}})},o.deleteFieldConfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the field?").htmlContent("<b>Field</b> will be deleted.").ariaLabel("delete field").targetEvent(e).ok("OK").cancel("CANCEL");a.show(t).then(function(){d(n)},function(){console.log("CANCEL")})},o.deleteSelectedFields=function(e){var n=a.confirm().title("Are you sure want to delete the selected fields?").htmlContent("<b>"+o.selectedFields.length+" selected</b> will be deleted.").ariaLabel("delete fields").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){o.selectedFields.forEach(function(e){d(e)}),o.selectedFields=[]})}}e.$inject=["$mdDialog","$document","api","toasty","Auth"],angular.module("app.integrations").controller("ZohoAccountConfigurationsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="INTEGRATIONS.EDIT_ZOHOCONFIGURATION",g.zohoConfiguration=angular.copy(l),g.configurations=r,g.newZohoConfiguration=!1,g.zohoConfiguration||(g.zohoConfiguration={channel:"voice",type:"inbound"},g.title="INTEGRATIONS.NEW_ZOHOCONFIGURATION",g.newZohoConfiguration=!0),g.addNewZohoConfiguration=function(){g.errors=[],d.intZohoAccount.addConfiguration({id:n.params.id},g.zohoConfiguration).$promise.then(function(e){g.configurations.unshift(e.toJSON()),o.success({title:"ZohoConfiguration properly created",msg:g.zohoConfiguration.name?g.zohoConfiguration.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveZohoConfiguration=function(){g.errors=[],d.intZohoConfiguration.update({id:g.zohoConfiguration.id},g.zohoConfiguration).$promise.then(function(e){var n=_.find(g.configurations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"ZohoConfiguration properly saved!",msg:g.zohoConfiguration.name?g.zohoConfiguration.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteZohoConfiguration=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The zohoConfiguration will be deleted.").ariaLabel("Delete ZohoConfiguration").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.intZohoConfiguration.delete({id:g.zohoConfiguration.id}).$promise.then(function(){_.remove(g.configurations,{id:g.zohoConfiguration.id}),o.success({title:"ZohoConfiguration properly deleted!",msg:(g.zohoConfiguration.name||"zohoConfiguration")+" has been deleted!"}),v(g.zohoConfiguration)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.intZohoConfiguration.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.intZohoConfiguration.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","configurations","zohoConfiguration","api","Auth","license","setting","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoConfigurationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(){a.hide()}p.currentUser=m.getCurrentUser(),p.errors=[],p.title="INTEGRATIONS.EDIT_"+_.toUpper(d),p.item=angular.copy(r),p.items=o,p.type=d,p.crudPermissions=u,p.newItem=!1,p.item||(p.item={type:"string"},p.item[_.capitalize(d)+"Id"]=s.id,p.title="INTEGRATIONS.NEW_"+_.toUpper(d),p.newItem=!0),p.addNewItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZohoField.save(p.item).$promise.then(function(e){p.items.unshift(e),i.success({title:_.capitalize(d)+" properly created",msg:_.capitalize(d)+" has been created!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.save"}]})},p.saveItem=function(){p.errors=[],p.customField&&(p.item.idField=p.customField.id,p.item.nameField=p.customField.name,p.item.customField=p.customField.custom);c.intZohoField.update({id:p.item.id},p.item).$promise.then(function(e){var n=_.find(p.items,{id:e.id});n&&_.merge(n,e),i.success({title:_.capitalize(d)+" properly saved!",msg:_.capitalize(d)+" has been saved!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.intItem.update"}]})},p.deleteItem=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The "+d+" will be deleted.").ariaLabel("Delete "+_.capitalize(d)).ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){c.intZohoField.delete({id:p.item.id}).$promise.then(function(){_.remove(p.items,{id:p.item.id}),i.success({title:_.capitalize(d)+" properly deleted!",msg:_.capitalize(d)+" has been deleted!"}),g()}).catch(function(e){console.error(e),p.errors=e.data.errors||[{message:e.toString(),type:"api.item.delete"}]})},function(){})},p.getSelectedVariable=function(){return void 0!==p.item.variableName?p.item.variableName:"Please select a variable"},p.closeDialog=g,c.variable.get({nolimit:!0}).$promise.then(function(e){return p.variables=e.rows?e.rows:[],c.voiceAgentReport.describe().$promise}).then(function(e){return p.voiceAgentReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceAgentReportColumns.push("recordingURL"),c.voiceDialReport.describe().$promise}).then(function(e){p.voiceDialReportColumns=_.difference(_.keys(e),["$promise","$resolved","createdAt","updatedAt","sourceid"]),p.voiceDialReportColumns.push("recordingURL")}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETVARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.intZohoAccount.getFields({id:l.id,ticketType:s.ticketType?s.ticketType:void 0}).$promise.then(function(e){p.accountConnected=!0,p.fields=e.rows?e.rows:[],p.item.idField&&(p.customField=_.find(p.fields,{id:p.item.idField}))}).catch(function(e){p.accountConnected=!1,console.error(e)})}e.$inject=["$scope","$state","$location","$mdDialog","toasty","configuration","items","item","account","type","api","Auth","crudPermissions"],angular.module("app.integrations").controller("CreateOrEditZohoAccountItemDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.zohoAccount=c||e.params.zohoAccount||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoZohoAccounts=function(){e.go("app.integrations.zohoAccounts",{},{reload:"app.integrations.zohoAccounts"})},u.saveZohoAccount=function(){r.intZohoAccount.update({id:u.zohoAccount.id},u.zohoAccount).$promise.then(function(){l.success({title:"ZohoAccount updated!",msg:u.zohoAccount.name?u.zohoAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETintZohoAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","zohoAccount","userProfileSection"],angular.module("app.integrations").controller("ZohoAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.zohoAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="zohoAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedZohoAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,host,zone,clientId,clientSecret,code,refreshToken,serverUrl,description",sort:"-updatedAt",limit:10,page:1},f.arrayhost=_.keyBy([{option:"zoho.com",value:"'zoho.com'"},{option:"zoho.eu",value:"'zoho.eu'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayzone=_.keyBy([{option:"US",value:"'US'"},{option:"AU",value:"'AU'"},{option:"EU",value:"'EU'"},{option:"IN",value:"'IN'"},{option:"CN",value:"'CN'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.integrations.zohoAccounts.edit",{id:e.id,zohoAccount:e,crudPermissions:f.crudPermissions})},f.testtestintegrationaccount=function(e,n){return m.intZohoAccount.getFields({id:e.id,test:!0}).$promise.then(function(){p.success({title:"ZohoAccount properly tested",msg:"Connection succeded!"})}).catch(function(e){p.error({title:"ZohoAccount properly tested",msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("zohoAccount")+"?").htmlContent("<b>"+(e.name||"zohoAccount")+"</b> will be deleted.").ariaLabel("delete zohoAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getZohoAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.intZohoAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ZohoAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditZohoAccount=function(e,n){i.show({controller:"CreateOrEditZohoAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/integrations/views/zohoAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{zohoAccount:n,zohoAccounts:f.zohoAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteZohoAccount=y,f.exportSelectedZohoAccounts=function(){var e=angular.copy(f.selectedZohoAccounts);return f.selectedZohoAccounts=[],e},f.deleteSelectedZohoAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected zohoAccounts?").htmlContent("<b>"+f.selectedZohoAccounts.length+" selected</b> will be deleted.").ariaLabel("delete ZohoAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedZohoAccounts.forEach(function(e){y(e)}),f.selectedZohoAccounts=[]})},f.deselectZohoAccounts=function(){f.selectedZohoAccounts=[]},f.selectAllZohoAccounts=function(){f.selectedZohoAccounts=f.zohoAccounts.rows};var b=!0,A=1;function E(e){f.zohoAccounts=e||{count:0,rows:[]}}function y(e){m.intZohoAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.zohoAccounts.rows,{id:e.id}),f.zohoAccounts.count-=1,f.zohoAccounts.rows.length||f.getZohoAccounts(),p.success({title:_.startCase("ZohoAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEintZohoAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEintZohoAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getZohoAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","zohoAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.integrations").controller("ZohoAccountsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="JSCRIPTY.EDIT_PROJECT",g.project=angular.copy(l),g.projects=r,g.newProject=!1,g.project||(g.project={enableUncompleteSave:!0,sendUnpauseOnSubmit:!0},g.title="JSCRIPTY.NEW_PROJECT",g.newProject=!0),g.addNewProject=function(){g.errors=[],d.jscriptyProject.save(g.project).$promise.then(function(e){g.projects.unshift(e.toJSON()),o.success({title:"Project properly created",msg:g.project.name?g.project.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveProject=function(){g.errors=[],d.jscriptyProject.update({id:g.project.id},g.project).$promise.then(function(e){var n=_.find(g.projects,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Project properly saved!",msg:g.project.name?g.project.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteProject=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The project will be deleted.").ariaLabel("Delete Project").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.jscriptyProject.delete({id:g.project.id}).$promise.then(function(){_.remove(g.projects,{id:g.project.id}),o.success({title:"Project properly deleted!",msg:(g.project.name||"project")+" has been deleted!"}),v(g.project)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","projects","project","api","Auth","license","setting","crudPermissions"],angular.module("app.jscripty").controller("CreateOrEditProjectDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o){var r=this;r.currentUser=i.getCurrentUser(),r.project={},r.localizationMap=o;var l=new Date;r.pickerModel={dateStart:new Date(l.getFullYear(),l.getMonth(),1),dateEnd:new Date(l.getFullYear(),l.getMonth()+1,0),selectedTemplate:"TM"},r.init=function(e,n){r.project=e,r.userProfile=n,r.getAnswers()},r.getSummary=function(){return a.jscriptyProject.getSummary({id:r.project.id,startTime:{$gte:r.pickerModel.dateStart,$lte:moment(r.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").format()},nolimit:!0}).$promise.then(function(e){if(void 0!==e.length){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","jscriptyProjectSummary_"+r.project.id+".csv"),a.click()}else s.info({title:"EXPORT",msg:"No answers available"})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.getSummary",msg:e.data?JSON.stringify(e.data):e.toString()})})},r.getAnswers=function(){return r.hasIdAnswers=!1,a.jscriptyProject.getAnswers({id:r.project.id,sort:"-createdAt,questionId",createdAt:{$gte:moment(r.pickerModel.dateStart).add(0,"hours").add(0,"minutes").add(0,"seconds").utcOffset(0,!0).format(),$lte:moment(r.pickerModel.dateEnd).add(23,"hours").add(59,"minutes").add(59,"seconds").utcOffset(0,!0).format()},nolimit:!0}).$promise.then(function(e){if(e&&e.rows&&e.hasOwnProperty("count")){r.answers={};for(var n=0,t=e.count;n<t;n++)e.rows[n].questionId&&(r.hasIdAnswers=!0,r.answers.hasOwnProperty(e.rows[n].questionId)||(r.answers[e.rows[n].questionId]={question:e.rows[n].question,answers:{},sum:0}),""===e.rows[n].answer&&(e.rows[n].answer="NO_ANSWER"),r.answers[e.rows[n].questionId].answers[e.rows[n].answer]?r.answers[e.rows[n].questionId].answers[e.rows[n].answer]+=1:r.answers[e.rows[n].questionId].answers[e.rows[n].answer]=1,r.answers[e.rows[n].questionId].sum+=1)}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETANSWERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$mdDialog","$document","$window","api","Auth","toasty","dateFilterLocalizationFactory"],angular.module("app.jscripty").controller("ProjectAnswersController",e)}(),function(){"use strict";angular.module("app.jscripty").controller("ProjectBuilderController",function(){var n=this;n.project={},n.optionsBuilder={questionTypes:["text","textarea","radio","checkbox","select","number","date","time","email","range","url"],elementTypes:["question","paragraph"]},n.init=function(e){n.project=e,_.isObjectLike(e.formData)?n.project.formData=e.formData:n.isJsonString(e.formData)?n.project.formData=JSON.parse(e.formData):n.project.formData={}},n.isJsonString=function(e){if(_.isNil(e))return!1;try{JSON.parse(e)}catch(e){return!1}return!0}})}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newProject=!0,r.project=angular.copy(i),r.projects=s,r.title=o.instant("JSCRIPTY.CLONE_PROJECT"),i&&i.name&&(r.title+=": "+i.name),r.cloneProject=function(){return e.jscriptyProject.clone({id:i.id},r.project).$promise.then(function(e){r.projects.unshift(e.toJSON()),a.success({title:"Project properly cloned",msg:r.project.name?r.project.name+" has been cloned!":""}),t.go("app.jscripty.projects.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.jscriptyProject.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.jscriptyProject.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","project","projects","$translate"],angular.module("app.jscripty").controller("ProjectcloneController",e)}(),function(){"use strict";function e(a,i,n){var o=this;o.project={},o.responseData={},o.formViewer={},o.init=function(e){o.project=e,n.$on("mwForm.pageEvents.pageCurrentChanged",function(e,n){if(n.currentPage&&o.project.formData&&o.project.formData.pages)for(var t=0,a=o.project.formData.pages.length;t<a;t++)if(n.currentPage.number<t+1&&o.project.formData.pages[t].elements)for(var i=0,s=o.project.formData.pages[t].elements.length;i<s;i++)"question"===o.project.formData.pages[t].elements[i].type&&o.project.formData.pages[t].elements[i].question&&delete o.responseData[o.project.formData.pages[t].elements[i].question.id]})},o.onSubmit=function(e){var n=a.defer(),t=i.confirm().title("Would you like to save your survey?").textContent("").ariaLabel("survey").targetEvent(e).ok("SAVE").cancel("CANCEL");return i.show(t).then(function(){n.resolve(!0)},function(){n.reject()}),n.promise},o.resetViewer=function(){o.formViewer.reset&&o.formViewer.reset()}}e.$inject=["$q","$mdDialog","$scope"],angular.module("app.jscripty").controller("ProjectViewerController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.projectSessions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.jscriptyProject.getSessions(m.query,u).$promise}function g(e){d.jscriptySessionReport.delete({id:e.id}).$promise.then(function(){_.remove(m.projectSessions.rows,{id:e.id}),m.projectSessions.count-=1,m.projectSessions.rows.length||p(),l.success({title:"Session deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETjscriptyProject"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.project={},m.projectSessions={count:0,rows:[]},m.selectedProjectSessions=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,starttime,endtime,membername,calleridnum,completed",sort:"-starttime",limit:10,page:1},m.init=function(e,n,t){m.project=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.id=m.project.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the session?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("session #")+e.id||"session")+"</b> will be deleted.").ariaLabel("delete session").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getProjectSessions=p,m.createOrEditProjectSession=function(e,n){o.show({controller:"CreateOrEditSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:m.project,session:n,sessions:m.projectSessions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.showQuestionsProjectSession=function(e,t){o.show({controller:"ShowQuestionsSessionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,resolve:{questions:["apiResolver","$stateParams",function(e,n){return e.resolve("jscriptySessionReport@getQuestions",{fields:"question,answer",sort:"id",id:t.id})}]},locals:{project:m.project,session:t}})},m.exportSelectedProjectSessions=function(){var e=angular.copy(m.selectedProjectSessions);return m.selectedProjectSessions=[],e},m.deleteProjectSession=g,m.deleteSelectedProjectSessions=function(e){var n=o.confirm().title("Are you sure want to delete the selected sessions?").htmlContent("<b>"+m.selectedProjectSessions.length+" selected</b> will be deleted.").ariaLabel("delete sessions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedProjectSessions.forEach(function(e){g(e)}),m.selectedProjectSessions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.jscripty").controller("ProjectSessionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){this.title="JSCRIPTY.SESSION_RESULTS",this.session=s,this.questions=o,this.project=r,this.closeDialog=function(e){a.hide(e)}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","session","questions","project","api"],angular.module("app.jscripty").controller("ShowQuestionsSessionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.project=c||e.params.project||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.clonedialog=function(e,n){t.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{project:e,projects:p.projects?p.projects.rows:[],crudPermissions:p.crudPermissions}})},p.alert=l.info,p.gotoProjects=function(){e.go("app.jscripty.projects",{},{reload:"app.jscripty.projects"})},p.saveProject=function(){r.jscriptyProject.update({id:p.project.id},p.project).$promise.then(function(){l.success({title:"Project updated!",msg:p.project.name?p.project.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETjscriptyProject",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","project","userProfile","userProfileSection"],angular.module("app.jscripty").controller("JscriptyProjectController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.projects=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="projects",f.listOrder="",f.listOrderAsc=null,f.selectedProjects=[],f.query={fields:"createdAt,updatedAt,id,name,enableUncompleteSave,sendUnpauseOnSubmit,description,formData",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.jscripty.projects.edit",{id:e.id,project:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"ProjectcloneController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{project:e,projects:f.projects?f.projects.rows:[],crudPermissions:f.crudPermissions}})},f.sessionsgoto=function(e,n){t.go("app.jscripty.projects.edit",{id:e.id,tab:3})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("project")+"?").htmlContent("<b>"+(e.name||"project")+"</b> will be deleted.").ariaLabel("delete project").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getProjects=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.jscriptyProject.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Projects",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditProject=function(e,n){i.show({controller:"CreateOrEditProjectDialogController",controllerAs:"vm",templateUrl:"app/main/apps/jscripty/views/projects/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{project:n,projects:f.projects.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteProject=y,f.exportSelectedProjects=function(){var e=angular.copy(f.selectedProjects);return f.selectedProjects=[],e},f.deleteSelectedProjects=function(e){var n=i.confirm().title("Are you sure want to delete the selected projects?").htmlContent("<b>"+f.selectedProjects.length+" selected</b> will be deleted.").ariaLabel("delete Projects").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedProjects.forEach(function(e){y(e)}),f.selectedProjects=[]})},f.deselectProjects=function(){f.selectedProjects=[]},f.selectAllProjects=function(){f.selectedProjects=f.projects.rows};var b=!0,A=1;function E(e){f.projects=e||{count:0,rows:[]}}function y(e){m.jscriptyProject.delete({id:e.id}).$promise.then(function(){_.remove(f.projects.rows,{id:e.id}),f.projects.count-=1,f.projects.rows.length||f.getProjects(),p.success({title:_.startCase("Project")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEjscriptyProject"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEjscriptyProject",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getProjects())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","projects","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.jscripty").controller("JscriptyProjectsController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d,c,m,u){var p,g=this;function v(e){t.hide(e)}g.currentUser=l.getCurrentUser(),g.errors=[],g.setting=c,g.license=d,g.crudPermissions=m,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.mailAccount=angular.copy(s),g.mailAccounts=n,g.cloudProviders=o,g.providers=u.getEmailProviders(),g.newMailAccount=!1,g.mailAccount||(g.mailAccount={active:!0,service:"null",authentication:!0,fontSize:13,waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.newMailAccount=!0),e.params.id&&(g.mailAccount.MailAccountId=e.params.id),g.addNewMailAccount=function(){g.errors=[],r.mailAccount.save(g.mailAccount).$promise.then(function(e){g.mailAccounts.unshift(e.toJSON()),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_CREATED_SUCCESS_TITLE")}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailAccount=function(){g.errors=[],r.mailAccount.update({id:g.mailAccount.id},g.mailAccount).$promise.then(function(e){var n=_.find(g.mailAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_SAVED_SUCCESS_TITLE")}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailAccount=function(e){if(g.mailAccount.service)return i.error({title:"Mail Account not deleted!",msg:"You can't remove service account"});g.errors=[];var n=t.confirm().title(a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_TITLE")).content(a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_MESSAGE",{name:g.mailAccount.name})).ariaLabel("Delete Mail Account").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){r.mailAccount.delete({id:g.mailAccount.id}).$promise.then(function(){_.remove(g.mailAccounts,{id:g.mailAccount.id}),i.success({title:a.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETED_SUCCESS_TITLE")}),v(g.mailAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.onProviderChange=function(){"custom"!==g.mailAccount.provider&&(g.mailAccount.authentication=!0);"outlook365"!==g.mailAccount.provider&&(g.mailAccount.modernAuthentication=!1)},g.closeDialog=v,p=[{key:"id",value:Number(g.mailAccount.ListId)}],r.getResourcesByRole(g.currentUser,"cmList",{fields:"id,name",sort:"name",nolimit:"true"},p).then(function(e){g.lists=e.rows}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$mdDialog","$translate","toasty","mailAccounts","mailAccount","cloudProviders","api","Auth","license","setting","crudPermissions","msUtils"],angular.module("app.mail").controller("CreateOrEditMailAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.mailAccountApps.rows.length){var t=r.mailAccountApps.rows[n]?r.mailAccountApps.rows[n]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccountApp:t,mailAccount:r.mailAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.mailAccountApps.rows[n]=e:r.mailAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.mailAccountApps.rows.length;t++,0){var a=r.mailAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.mailAccount.context,a.exten=r.mailAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.mailAccount.addApplications({id:r.mailAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.mailAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.mailAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.mailAccount={},r.mailAccountApps={count:0,rows:[]},r.selectedMailAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"MailQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"mailQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:601}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Reply_Type",name:"replyType",type:"select",defaultValue:"1",values:[{option:"Reply",value:"0"},{option:"Reply All",value:"1"}],required:!0,param:1},{title:"Text",name:"text",type:"html",required:!0,param:2}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.mailAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getMailAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.mailAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getMailAccountApps=function(){r.promise=o.mailAccount.getApplications(r.query,t).$promise},r.editMailAccountApp=n,r.editInterval=function(e,n){if(r.mailAccountApps.rows.length){var t=r.mailAccountApps.rows[n]?r.mailAccountApps.rows[n]:r.mailAccountApps.rows[0];i.show({controller:"EditMailAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteMailAccountApp=function(e){_.remove(r.mailAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedMailAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedMailAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedMailAccountApps.forEach(function(e){_.remove(r.mailAccountApps.rows,{id:e.id})}),r.selectedMailAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.mail").controller("MailAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailAccount.getAgents({id:c.mailAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserMailAccount?"penalty "+e.UserMailAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.mailAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailAccount.removeAgents({id:c.mailAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailAccount.addAgents({id:c.mailAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","mailAccount","mailAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.agent.text=d.slice(2,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.autoreply.text=d.slice(2,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.replyType=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.autoreply.text=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.autoreply.times=1,l.autoreply.replyType=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.replyType,e[2]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.close.text=d.slice(2,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.gotoif.text=d.slice(2,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.gotop.text=d.slice(2,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditMailAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.noop.text=d.slice(2,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.queue.text=d.slice(2,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("mail")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.mailQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.mailQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:601}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.system.text=d.slice(2,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="MAIL.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.replyType=isNaN(d[1])?d[1]:parseInt(d[1],10),l.tag.text=d.slice(2,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveMailAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","mailAccountApp","mailAccount","api","Auth","crudPermissions"],angular.module("app.mail").controller("EditMailAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"mailAccount",action:"getDispositions",field:"name",params:{id:m.mailAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.mailAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.mailAccountInteractions.rows.length;n+=1){var t=m.mailAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,(void 0===m.query.closed||null===m.query.closed||m.query.closed)&&delete m.query.substatus,m.promise=d.mailInteraction.get(m.query,p).$promise}function v(e){d.mailInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.mailAccountInteractions.rows,{id:e.id}),m.mailAccountInteractions.count-=1,m.mailAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){_.isEmpty(e.to)||_.includes(e.to,m.mailAccount.email)?e.contactInfo=e.Contact?e.Contact.email:void 0:(e.contactName=e.to.split(" <")[0],e.contactInfo=e.to.split("<").pop().split(">")[0]),"Unknown"===e.contactName&&(e.contactName=i.instant("MAIL.UNKNOWN"))}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.mailAccount={},m.mailAccountInteractions={count:0,rows:[]},m.selectedMailAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.mailAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.MailAccountId=m.mailAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"plainBody",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Substatus",column:"substatus",type:"multiselect",options:{field:"name",route:{model:"mailSubstatus",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){return d.mailSubstatus.get({nolimit:!0}).$promise.then(function(e){m.subStatuses=e||{count:0,rows:[]}})}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Substatus",key:"substatus",type:"select",label:"DASHBOARDS.SELECT_SUBSTATUS",options:m.subStatuses.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NONE"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name",ngIf:"closed === 0"},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.mailInteractionDownload=function(s,e,n){return d.mailInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="mail-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getMailAccountInteractions=g,m.createOrEditMailAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:m.mailAccount,interaction:n,interactions:m.mailAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spymailInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"mail",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"mail.mailAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||MailAccountId:=$eq["+m.mailAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedMailAccountInteractions=function(){var e=angular.copy(m.selectedMailAccountInteractions);return m.selectedMailAccountInteractions=[],e},m.deleteMailAccountInteraction=v,m.deleteSelectedMailAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedMailAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMailAccountInteractions.forEach(function(e){v(e)}),m.selectedMailAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.mailAccountMailCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.mailAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.mailAccountMailCannedAnswers.rows,{id:e.id}),m.mailAccountMailCannedAnswers.count-=1,m.mailAccountMailCannedAnswers.rows.length||p(),l.success({title:"MailCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETmailAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.mailAccount={},m.mailAccountMailCannedAnswers={count:0,rows:[]},m.selectedMailAccountMailCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.mailAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.MailAccountId=m.mailAccount.id,m.query.id=m.mailAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the mailCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("mailCannedAnswer #")+e.id||"mailCannedAnswer")+"</b> will be deleted.").ariaLabel("delete mailCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getMailAccountMailCannedAnswers=p,m.createOrEditMailAccountMailCannedAnswer=function(e,n){o.show({controller:"CreateOrEditMailCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:m.mailAccount,mailCannedAnswer:n,mailCannedAnswers:m.mailAccountMailCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedMailAccountMailCannedAnswers=function(){var e=angular.copy(m.selectedMailAccountMailCannedAnswers);return m.selectedMailAccountMailCannedAnswers=[],e},m.deleteMailAccountMailCannedAnswer=g,m.deleteSelectedMailAccountMailCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected mailCannedAnswers?").htmlContent("<b>"+m.selectedMailAccountMailCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete mailCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMailAccountMailCannedAnswers.forEach(function(e){g(e)}),m.selectedMailAccountMailCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.mail").controller("MailAccountMailCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILCANNEDANSWER",g.mailCannedAnswer=angular.copy(l),g.mailCannedAnswers=r,g.newMailCannedAnswer=!1,g.mailCannedAnswer||(g.mailCannedAnswer={},g.title="MAIL.NEW_MAILCANNEDANSWER",g.newMailCannedAnswer=!0),n.params.id&&(g.mailCannedAnswer.MailAccountId=n.params.id),g.addNewMailCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.mailCannedAnswer).$promise.then(function(e){g.mailCannedAnswers.unshift(e.toJSON()),o.success({title:"MailCannedAnswer properly created",msg:g.mailCannedAnswer.name?g.mailCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.mailCannedAnswer.id},g.mailCannedAnswer).$promise.then(function(e){var n=_.find(g.mailCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailCannedAnswer properly saved!",msg:g.mailCannedAnswer.name?g.mailCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailCannedAnswer will be deleted.").ariaLabel("Delete MailCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.mailCannedAnswer.id}).$promise.then(function(){_.remove(g.mailCannedAnswers,{id:g.mailCannedAnswer.id}),o.success({title:"MailCannedAnswer properly deleted!",msg:(g.mailCannedAnswer.name||"mailCannedAnswer")+" has been deleted!"}),v(g.mailCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailCannedAnswers","mailCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.mailAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.mailAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.MailAccountId=m.mailAccount.id,m.query.id=m.mailAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.mailAccount.id,field:"MailAccountId",route:"mailAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.mail").controller("MailAccountDispositionsController",e)}(),function(){"use strict";function e(t,a,i,s,e,n,o,r,l,d,c,m,u,p,g){var v,h,f=this;f.currentUser=d.getCurrentUser(),f.license=n,f.setting=o,f.passwordPattern=f.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",f.mailAccount=c||t.params.mailAccount||{},f.cloudProviders=m||{rows:[],count:0},f.userProfile=u,f.userProfileSection=p&&1==p.count?p.rows[0]:null,f.crudPermissions=d.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.hasModulePermissions={},f.selectedTab=t.params.tab||0,f.providers=g.getEmailProviders(),f.originalProvider=f.mailAccount.provider,f.goToRealtime=function(){return d.hasRole("admin")?t.go("app.mail.realtime.accounts",{}):r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n&&n.enabled)return t.go("app.mail.realtime.accounts",{});l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})})},f.addAgent=function(e,n){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:f.mailAccounts?f.mailAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.goToMailAccounts=function(){t.go("app.mail.mailAccounts",{},{reload:"app.mail.mailAccounts"})},f.saveMailAccount=function(){var e=angular.copy(f.mailAccount);"custom"===e.provider?e.provider=null:(f.originalProvider!==e.provider&&(e.Imap.modernAuthentication?e.Imap.password=null:e.Imap.CloudProviderId=null),e.Smtp.user=e.Imap.user,e.Smtp.pass=e.Imap.password,e.Imap.modernAuthentication||(e.Imap.CloudProviderId=null),e.Smtp.modernAuthentication=e.Imap.modernAuthentication,e.Smtp.CloudProviderId=e.Imap.CloudProviderId,e.Imap=_.omit(e.Imap,["host","port","service"]),e.Smtp=_.omit(e.Smtp,["host","port","secure","service"]));r.mailAccount.update({id:f.mailAccount.id},e).$promise.then(function(){f.originalProvider=e.provider,l.success({title:s.instant("MAIL.NOTIFICATIONS.ACCOUNT_SAVED_SUCCESS_TITLE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},f.onProviderChange=function(){"custom"!==f.mailAccount.provider&&(f.mailAccount.authentication=!0);"outlook365"!==f.mailAccount.provider&&(f.mailAccount.Imap.modernAuthentication=!1)},e.all((h=[{key:"id",value:Number(f.mailAccount.ListId)}],r.getResourcesByRole(f.currentUser,"cmList",{fields:"id,name",sort:"name",nolimit:"true"},h).then(function(e){f.lists=e.rows}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})),(v=[{key:"id",value:Number(f.mailAccount.mandatoryDispositionPauseId)}],r.getResourcesByRole(f.currentUser,"pause",{fields:"id,name",sort:"name",nolimit:"true"},v).then(function(e){f.pauses=e.rows}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))}e.$inject=["$state","$mdDialog","$document","$translate","$q","license","setting","api","toasty","Auth","mailAccount","cloudProviders","userProfile","userProfileSection","msUtils"],angular.module("app.mail").controller("MailAccountController",e)}(),function(){"use strict";function e(e,t,a,i,s,o,n,r,l,d,c,m,u,p){var g=this;function v(e){g.mailAccounts=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.hasRole("admin")?g.promise=d.mailAccount.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="MailAccounts",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){if(e.service)return c.error({msg:o.instant("MAIL.NOTIFICATIONS.ACCOUNT_SERVICE_DELETE")});d.mailAccount.delete({id:e.id}).$promise.then(function(){_.remove(g.mailAccounts.rows,{id:e.id}),g.mailAccounts.count-=1,g.mailAccounts.rows.length||h(),c.success({title:o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailAccount"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.mailAccounts=n||{count:0,rows:[]},g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedMailAccounts=[],g.query={fields:"createdAt,updatedAt,id,name,key,email,ListId,active,cservice,Imap.service,Imap.host,Imap.port,Imap.tls,Imap.authentication,Imap.user,Imap.password,Imap.mailbox,Imap.connTimeout,Imap.authTimeout,Smtp.service,Smtp.host,Smtp.port,Smtp.secure,Smtp.authentication,Smtp.user,Smtp.pass,cauthentication,cuser,cpassword,fontFamily,fontSize,template,markAsUnread,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},g.editstate=function(e){t.go("app.mail.mailAccounts.edit",{id:e.id,mailAccount:e,crudPermissions:g.crudPermissions})},g.verifySMTP=function(e){return e&&e.id?d.mailAccount.verifySmtp({id:e.id}).$promise.then(function(){c.success({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_SUCCESS_TITLE")})}).catch(function(e){c.error({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:e.data?JSON.stringify(e.data):e.toString()})}):c.error({title:o.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:o.instant("MAIL.NOTIFICATIONS.UNKNOWN_SMTP_SERVER")})},g.goToInteractions=function(e){t.go("app.mail.mailAccounts.edit",{id:e.id,tab:"custom"===e.provider?7:6})},g.goToRealtime=function(){return m.hasRole("admin")?t.go("app.mail.realtime.accounts",{}):d.userProfileSection.get({userProfileId:m.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n&&n.enabled)return t.go("app.mail.realtime.accounts",{});c.info({title:o.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:o.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})})},g.addAgent=function(e,n){a.show({controller:"MailAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailAccount:e,mailAccounts:g.mailAccounts?g.mailAccounts.rows:[],crudPermissions:g.crudPermissions,realtime:!1}})},g.deleteconfirm=function(e,n){var t=a.confirm().title(o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_TITLE")).content(o.instant("MAIL.NOTIFICATIONS.ACCOUNT_DELETE_MESSAGE",{name:e.name})).ariaLabel("delete mail account").targetEvent(n).ok("OK").cancel(o.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.success=v,g.getMailAccounts=h,g.createOrEditMailAccount=function(e,n){a.show({controller:"CreateOrEditMailAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailAccounts/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailAccount:n,mailAccounts:g.mailAccounts.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions},resolve:{cloudProviders:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,name",sort:"name",type:"outlook365"})}]}})},g.deleteMailAccount=f,g.exportSelectedMailAccounts=function(){var e=angular.copy(g.selectedMailAccounts);return g.selectedMailAccounts=[],e},g.deleteSelectedMailAccounts=function(e){var n=a.confirm().title(o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETE_TITLE")).content(o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETE_MESSAGE",{total:g.selectedMailAccounts.length})).ariaLabel("delete mail accounts").targetEvent(e).ok("OK").cancel(o.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedMailAccounts.forEach(function(e){f(e)}),g.selectedMailAccounts=[],c.success({title:o.instant("MAIL.NOTIFICATIONS.ACCOUNTS_DELETED_SUCCESS_TITLE")})})},g.deselectMailAccounts=function(){g.selectedMailAccounts=[]},g.selectAllMailAccounts=function(){g.selectedMailAccounts=g.mailAccounts.rows};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?s(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","mailAccounts","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="MAIL.EDIT_MAILQUEUE",r.mailQueue=angular.copy(n),r.mailQueues=e,r.newMailQueue=!1,r.mailQueue||(r.mailQueue={strategy:"beepall",timeout:10},r.title="MAIL.NEW_MAILQUEUE",r.newMailQueue=!0),r.addNewMailQueue=function(){r.errors=[],i.mailQueue.save(r.mailQueue).$promise.then(function(e){r.mailQueues.unshift(e.toJSON()),a.success({title:"MailQueue properly created",msg:r.mailQueue.name?r.mailQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveMailQueue=function(){r.errors=[],i.mailQueue.update({id:r.mailQueue.id},r.mailQueue).$promise.then(function(e){var n=_.find(r.mailQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"MailQueue properly saved!",msg:r.mailQueue.name?r.mailQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteMailQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The mailQueue will be deleted.").ariaLabel("Delete MailQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.mailQueue.delete({id:r.mailQueue.id}).$promise.then(function(){_.remove(r.mailQueues,{id:r.mailQueue.id}),a.success({title:"MailQueue properly deleted!",msg:(r.mailQueue.name||"mailQueue")+" has been deleted!"}),l(r.mailQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.mailQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","mailQueues","mailQueue","api","Auth","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailQueue.getAgents({id:c.mailQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserMailQueue?"penalty "+e.UserMailQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.mailQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.removeAgents({id:c.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.addAgents({id:c.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("MAIL.ALL_AGENTS"),labelSelected:r.instant("MAIL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","mailQueue","mailQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.mailQueue.getTeams({id:l.mailQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.mailQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MAIL.ALL_TEAMS"),labelSelected:t.instant("MAIL.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.removeTeams({id:l.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.mailQueue.addTeams({id:l.mailQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","mailQueue","$translate","Auth","crudPermissions"],angular.module("app.mail").controller("MailQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.mailQueue=c||e.params.mailQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:u.mailQueues?u.mailQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoMailQueues=function(){e.go("app.mail.mailQueues",{},{reload:"app.mail.mailQueues"})},u.saveMailQueue=function(){r.mailQueue.update({id:u.mailQueue.id},u.mailQueue).$promise.then(function(){l.success({title:"MailQueue updated!",msg:u.mailQueue.name?u.mailQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","mailQueue","userProfileSection"],angular.module("app.mail").controller("MailQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.mailQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="mailQueues",f.listOrder="",f.listOrderAsc=null,f.selectedMailQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"mail",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.mail.mailQueues.edit",{id:e.id,mailQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"MailQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:f.mailQueues?f.mailQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"MailQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailQueue:e,mailQueues:f.mailQueues?f.mailQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("mailQueue")+"?").htmlContent("<b>"+(e.name||"mailQueue")+"</b> will be deleted.").ariaLabel("delete mailQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:610}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.mail.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.mail.realtime.queues",{})}},f.success=E,f.getMailQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.mailQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MailQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMailQueue=function(e,n){i.show({controller:"CreateOrEditMailQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailQueue:n,mailQueues:f.mailQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteMailQueue=y,f.exportSelectedMailQueues=function(){var e=angular.copy(f.selectedMailQueues);return f.selectedMailQueues=[],e},f.deleteSelectedMailQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected mailQueues?").htmlContent("<b>"+f.selectedMailQueues.length+" selected</b> will be deleted.").ariaLabel("delete MailQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMailQueues.forEach(function(e){y(e)}),f.selectedMailQueues=[]})},f.deselectMailQueues=function(){f.selectedMailQueues=[]},f.selectAllMailQueues=function(){f.selectedMailQueues=f.mailQueues.rows};var b=!0,A=1;function E(e){f.mailQueues=e||{count:0,rows:[]}}function y(e){m.mailQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.mailQueues.rows,{id:e.id}),f.mailQueues.count-=1,f.mailQueues.rows.length||f.getMailQueues(),p.success({title:_.startCase("MailQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMailQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MAIL.EDIT_MAILSUBSTATUS",g.mailSubstatus=angular.copy(l),g.mailSubtatuses=r,g.newMailSubstatus=!1,g.mailSubstatus||(g.mailSubstatus={},g.title="MAIL.NEW_MAILSUBSTATUS",g.newMailSubstatus=!0),g.addNewMailSubstatus=function(){g.errors=[],d.mailSubstatus.save(g.mailSubstatus).$promise.then(function(e){g.mailSubtatuses.unshift(e.toJSON()),o.success({title:"MailSubstatus properly created",msg:g.mailSubstatus.name?g.mailSubstatus.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMailSubstatus=function(){g.errors=[],d.mailSubstatus.update({id:g.mailSubstatus.id},g.mailSubstatus).$promise.then(function(e){var n=_.find(g.mailSubtatuses,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MailSubstatus properly saved!",msg:g.mailSubstatus.name?g.mailSubstatus.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMailSubstatus=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mailSubstatus will be deleted.").ariaLabel("Delete MailSubstatus").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.mailSubstatus.delete({id:g.mailSubstatus.id}).$promise.then(function(){_.remove(g.mailSubtatuses,{id:g.mailSubstatus.id}),o.success({title:"MailSubstatus properly deleted!",msg:(g.mailSubstatus.name||"mailSubstatus")+" has been deleted!"}),v(g.mailSubstatus)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.mailSubstatus.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.mailSubstatus.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mailSubtatuses","mailSubstatus","api","Auth","license","setting","crudPermissions"],angular.module("app.mail").controller("CreateOrEditMailSubstatusDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.mailSubtatuses=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="mailSubtatuses",f.listOrder="",f.listOrderAsc=null,f.selectedMailSubstatuses=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{mailSubstatus:e,mailSubtatuses:f.mailSubtatuses.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("mailSubstatus")+"?").htmlContent("<b>"+(e.name||"mailSubstatus")+"</b> will be deleted.").ariaLabel("delete mailSubstatus").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMailSubstatuses=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.mailSubstatus.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MailSubstatuses",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMailSubstatus=function(e,n){i.show({controller:"CreateOrEditMailSubstatusDialogController",controllerAs:"vm",templateUrl:"app/main/apps/mail/views/mailSubtatuses/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{mailSubstatus:n,mailSubtatuses:f.mailSubtatuses.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMailSubstatus=y,f.exportSelectedMailSubstatuses=function(){var e=angular.copy(f.selectedMailSubstatuses);return f.selectedMailSubstatuses=[],e},f.deleteSelectedMailSubstatuses=function(e){var n=i.confirm().title("Are you sure want to delete the selected mailSubtatuses?").htmlContent("<b>"+f.selectedMailSubstatuses.length+" selected</b> will be deleted.").ariaLabel("delete MailSubstatuss").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMailSubstatuses.forEach(function(e){y(e)}),f.selectedMailSubstatuses=[]})},f.deselectMailSubstatuses=function(){f.selectedMailSubstatuses=[]},f.selectAllMailSubstatuses=function(){f.selectedMailSubstatuses=f.mailSubtatuses.rows};var b=!0,A=1;function E(e){f.mailSubtatuses=e||{count:0,rows:[]}}function y(e){m.mailSubstatus.delete({id:e.id}).$promise.then(function(){_.remove(f.mailSubtatuses.rows,{id:e.id}),f.mailSubtatuses.count-=1,f.mailSubtatuses.rows.length||f.getMailSubstatuses(),p.success({title:_.startCase("MailSubstatus")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEmailSubstatus"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEmailSubstatus",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMailSubstatuses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","mailSubtatuses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.mail").controller("MailSubstatusesController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d){var c=this,m=d&&1==d.count?d.rows[0].crudPermissions:null;function u(){c.mailAccounts.rows.forEach(function(n){var e=_.find(c.rpcMailAccounts.rows,["id",n.id]);e&&_.merge(n,e);var t={id:n.id,sort:"-id",direction:"in",limit:1,offset:0,$gte:"createdAt,"+moment().startOf("day").format("YYYY-MM-DD HH:mm:ss"),fields:"id,createdAt"};i.mailAccount.getMessages(t).$promise.then(function(e){return e&&(n.in=e.count||0,n.lastIn=e.rows&&e.rows.length?e.rows[0].createdAt:void 0),t.direction="out",i.mailAccount.getMessages(t).$promise}).then(function(e){e&&(n.out=e.count||0,n.lastOut=e.rows&&e.rows.length?e.rows[0].createdAt:void 0)}).catch(function(e){o.error(e.data?e.data.message:e.toString())})})}function p(e){var n=_.find(c.mailAccounts.rows,["id",e.id]);n&&_.merge(n,e)}function g(e){c.mailAccounts.rows=e.rows,u()}function v(){c.query.offset=(c.query.page-1)*c.query.limit,n.hasRole("admin")?c.promise=i.mailAccount.get(c.query,g).$promise:(c.query.id=c.currentUser.userProfileId,c.query.section="MailAccounts",c.promise=i.userProfile.getResources(c.query,g).$promise)}c.currentUser=n.getCurrentUser(),c.mailAccounts=r,c.rpcMailAccounts=l,c.crudPermissions=n.parseCrudPermissions(m),c.query={sort:"name",limit:10,page:1},c.success=g,c.$onInit=u,c.getMailAccounts=v,c.goToMailAccount=function(e,n){a.go("app.mail.mailAccounts.edit",{id:n.id,mailAccount:n})},c.verifySmtp=function(e,n){{if(n&&n.id)return i.mailAccount.verifySmtp({id:n.id}).$promise.then(function(){o.success({title:"Smtp properly verified",msg:"Connection succeded!"})}).catch(function(e){o.error({title:"Smtp properly verified",msg:e.data?JSON.stringify(e.data):e.toString()})});o.error({title:"Smtp properly verified",msg:"Smpt id unknown"})}},s.on("mailAccount:save",p),s.on("mailAccount:update",p),s.on("mailMessage:save",function(e){var n=_.find(c.mailAccounts.rows,["id",e.MailAccountId]);n&&("in"==e.direction?(n.in+=1,n.lastIn=e.createdAt):(n.out+=1,n.lastOut=e.createdAt))});var h=!0,f=1;e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=f),v())}),e.$on("$destroy",function(){s.removeAllListeners("mailAccount:save"),s.removeAllListeners("mailAccount:update"),s.removeAllListeners("mailMessage:save")})}e.$inject=["$scope","$timeout","$state","api","Auth","socket","toasty","mailAccounts","rpcMailAccounts","userProfileSection"],angular.module("app.mail").controller("MailAccountsRealtimeController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.mail.realtime.agents":this.selectedTab=0;break;case"app.mail.realtime.queues":this.selectedTab=1;break;case"app.mail.realtime.accounts":this.selectedTab=2;break;default:this.selectedTab=0,t.go("app.mail.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.mail.realtime.agents");break;case 1:t.go("app.mail.realtime.queues");break;case 2:t.go("app.mail.realtime.accounts");break;default:t.go("app.mail.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.mail").controller("MailRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MARKETPLACE.EDIT_PLUGIN",g.plugin=angular.copy(l),g.plugins=r,g.newPlugin=!1,g.plugin||(g.plugin={},g.title="MARKETPLACE.NEW_PLUGIN",g.newPlugin=!0),g.addNewPlugin=function(){g.errors=[],d.plugin.save(g.plugin).$promise.then(function(e){g.plugins.unshift(e.toJSON()),o.success({title:"Plugin properly created",msg:g.plugin.name?g.plugin.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savePlugin=function(){g.errors=[],d.plugin.update({id:g.plugin.id},g.plugin).$promise.then(function(e){var n=_.find(g.plugins,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Plugin properly saved!",msg:g.plugin.name?g.plugin.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletePlugin=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The plugin will be deleted.").ariaLabel("Delete Plugin").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.plugin.delete({id:g.plugin.id}).$promise.then(function(){_.remove(g.plugins,{id:g.plugin.id}),o.success({title:"Plugin properly deleted!",msg:(g.plugin.name||"plugin")+" has been deleted!"}),v(g.plugin)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","plugins","plugin","api","Auth","license","setting","crudPermissions"],angular.module("app.marketplace").controller("CreateOrEditPluginDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.plugin=c||e.params.plugin||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoPlugins=function(){e.go("app.marketplace.plugins",{},{reload:"app.marketplace.plugins"})},u.savePlugin=function(){r.plugin.update({id:u.plugin.id},u.plugin).$promise.then(function(){l.success({title:"Plugin updated!",msg:u.plugin.name?u.plugin.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETplugin",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","plugin","userProfileSection"],angular.module("app.marketplace").controller("MarketplacePluginController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.plugins=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="plugins",f.listOrder="",f.listOrderAsc=null,f.selectedPlugins=[],f.query={fields:"createdAt,updatedAt,id,name,type,active,description,icon,sidebar,path,adminUrl,agentUrl,scriptName,scriptPath,version",sort:"-updatedAt",limit:10,page:1},f.installing=!1,f.arraysidebar=_.keyBy([{option:"Always",value:"'always'"},{option:"Admin Only",value:"'adminOnly'"},{option:"Agent Only",value:"'agentOnly'"},{option:"Never",value:"'never'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.installplugin=function(e){{if("script"!==e.type)return e.active=!0,m.plugin.update({id:e.id},e).$promise.then(function(){p.success({title:"Plugin installed!",msg:e.name?e.name+" has been installed!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});f.installing=!0,m.pm2.save({name:e.scriptName,script:e.path+"/"+e.scriptPath}).$promise.then(function(){return e.active=!0,m.plugin.update({id:e.id},e).$promise}).then(function(){f.installing=!1,p.success({title:"Plugin installed!",msg:e.name?e.name+" has been installed!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.save"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.save",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}},f.editstate=function(e,n){t.go("app.marketplace.plugins.edit",{id:e.id,plugin:e,crudPermissions:f.crudPermissions})},f.stopplugin=function(e,n){var t=i.confirm().title("Are you sure want to stop the plugin attached process?").htmlContent("<b>"+(e.name||"plugin")+"</b> attached process will be stoppped.").ariaLabel("stop plugin process").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){var t;t=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.update({id:n.pm_id,status:"stopped"}).$promise.then(function(){p.success({title:"Process stopped!",msg:"Attached pm2 process successfully stopped"})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})},f.restartplugin=function(e,n){var t=i.confirm().title("Are you sure want to restart the plugin attached process?").htmlContent("<b>"+(e.name||"plugin")+"</b> attached process will be restarted.").ariaLabel("restart plugin process").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){var t;t=e,m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.update({id:n.pm_id,status:"online"}).$promise.then(function(){p.success({title:"Process restarted!",msg:"Attached pm2 process successfully restarted"})})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.pm2.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){console.log("CANCEL")})},f.downloadfile2=function(s,e){return m.plugin.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.name.replace(" ","_").toLowerCase()+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.uninstallplugin=function(e,n){var t=i.confirm().title("Are you sure want to uninstall the plugin?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be uninstalled.").ariaLabel("uninstall plugin").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){!function(t){"script"===t.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)throw new Error("Failed to retrieve pm2 processes");var n=_.find(e.rows,{name:t.scriptName});if(!n)throw new Error("No corresponding process found");m.pm2.delete({id:n.pm_id,name:t.scriptName}).$promise}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pm2.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});t.active=!1,m.plugin.update({id:t.id},t).$promise.then(function(){p.success({title:"Plugin uninstalled!",msg:t.name?t.name+" has been uninstalled!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"api.plugin.update"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.plugin.update",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}(e)},function(){console.log("CANCEL")})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("plugin")+"?").htmlContent("<b>"+(e.name||"plugin")+"</b> will be deleted.").ariaLabel("delete plugin").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getPlugins=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.plugin.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Plugins",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditPlugin=function(e,n){i.show({controller:"CreateOrEditPluginDialogController",controllerAs:"vm",templateUrl:"app/main/apps/marketplace/views/plugins/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{plugin:n,plugins:f.plugins.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletePlugin=y,f.exportSelectedPlugins=function(){var e=angular.copy(f.selectedPlugins);return f.selectedPlugins=[],e},f.deleteSelectedPlugins=function(e){var n=i.confirm().title("Are you sure want to delete the selected plugins?").htmlContent("<b>"+f.selectedPlugins.length+" selected</b> will be deleted.").ariaLabel("delete Plugins").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedPlugins.forEach(function(e){y(e)}),f.selectedPlugins=[]})},f.deselectPlugins=function(){f.selectedPlugins=[]},f.selectAllPlugins=function(){f.selectedPlugins=f.plugins.rows},f.uploadPlugin=function(e){i.show({controller:"UploadPluginDialogController",controllerAs:"vm",templateUrl:"app/main/apps/marketplace/views/plugins/upload/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{plugins:f.plugins.rows}})};var b=!0,A=1;function E(e){f.plugins=e||{count:0,rows:[]}}function y(t){t.active&&"script"==t.type&&m.pm2.get().$promise.then(function(e){if(!e||!e.rows)return p.error({title:"Plugin not deleted!",msg:"Failed to retrieve pm2 processes"});var n=_.find(e.rows,{name:t.scriptName});n?m.pm2.delete({id:n.pm_id,name:t.scriptName}).$promise:console.log("No '%s' process found",t.scriptName)}).catch(function(e){return p.error({title:"PM2 process not found!",msg:"Failed to delete the attached pm2 process"})}),m.plugin.delete({id:t.id}).$promise.then(function(){_.remove(f.plugins.rows,{id:t.id}),f.plugins.count-=1,f.plugins.rows.length||f.getPlugins(),p.success({title:_.startCase("Plugin")+" deleted!",msg:t.name?t.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEplugin"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEplugin",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getPlugins())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","plugins","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.marketplace").controller("MarketplacePluginsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this,r=4,l=1024*r*1024;o.currentUser=s.getCurrentUser(),o.errors=[],o.title="MARKETPLACE.UPLOAD_PLUGIN",o.plugins=a,o.uploadPlugins=[],o.uploadState="none",o.plugin={},o.ngFlowOptions={maxChunkRetries:1,chunkSize:l,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0,target:"api/plugins"},o.ngFlow={flow:{}},o.dropping=!1,o.fileAdded=function(e){var n=["zip"];if(!_.includes(n,e.getExtension()))return t.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>l)return t.error({title:"File too big",msg:"The max allowed size is "+r+"MB"}),!1;return o.plugin={id:e.uniqueIdentifier,file:e},o.uploadPlugins.unshift(o.plugin),!0},o.upload=function(){o.uploadState="uploading",o.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},o.ngFlow.flow.opts.query={role:o.currentUser.role,userProfileId:o.currentUser.userProfileId},o.ngFlow.flow.upload()},o.fileSuccess=function(a,e){o.plugins.unshift(JSON.parse(e)),angular.forEach(o.uploadPlugins,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result}}})},o.uploadError=function(e,n){o.ngFlow.flow.cancel(),t.error({title:"Upload error",msg:"Cannot upload the plugin"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",t.success({title:"Upload completed",msg:o.plugin.file.name+" uploaded successfully"}))},o.closeDialog=function(){n.hide()}}e.$inject=["$cookies","$mdDialog","toasty","plugins","api","Auth"],angular.module("app.marketplace").controller("UploadPluginDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;function h(e){a.hide(e)}v.currentUser=c.getCurrentUser(),v.errors=[],v.setting=u,v.license=m,v.crudPermissions=p,v.hasModulePermissions={},v.passwordPattern=v.setting&&v.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",v.title="MOTIONDIALER.EDIT_HOPPER",v.hopper=angular.copy(l),v.hoppers=r,v.newHopper=!1,v.contact,v.dateTime,v.hopper||(v.hopper={},v.title="MOTIONDIALER.NEW_HOPPER",v.newHopper=!0),n.params.id&&("IvrCampaign"===g?v.hopper.CampaignId=n.params.id:"QueueCampaign"==g?v.hopper.VoiceQueueId=n.params.id:v.hopper.ContactId=n.params.id),v.addNewHopper=function(){v.errors=[],d.cmHopper.save(v.hopper).$promise.then(function(e){v.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:v.hopper.name?v.hopper.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},v.saveHopper=function(){var t,a,i,s;v.errors=[],v.hopper.UserId=v.hopper.recallme?v.hopper.UserId:null,v.hopper.OwnerId=c.getCurrentUser().id,d.cmHopper.get({id:v.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){v.hopper.dialTimezone=v.contact.dialTimezone,d.cmHopper.update({id:v.hopper.id},_.omit(v.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.voiceQueue.get({raw:!1,id:a.VoiceQueueId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme}).$promise.then(function(){d.cmContact.update({id:a.ContactId,dialTimezone:v.contact.dialTimezone})})})});var n=_.find(v.hoppers,{id:e.id});n&&_.merge(n,_.pick(e.toJSON(),_.keys(n))),o.success({title:"Hopper properly saved!",msg:v.hopper.name?v.hopper.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},v.deleteHopper=function(e){v.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:v.hopper.id}).$promise.then(function(){_.remove(v.hoppers,{id:v.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(v.hopper.name||"hopper")+" has been deleted!"}),h(v.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},v.getDateFromString=function(e){return null===e?void 0:new Date(e)},v.closeDialog=h,v.recalcTZTime=function(){if(_.isNil(v.hopper.VoiceQueueId)){var e=v.hopper.CampaignId;d.campaign.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.hopper.scheduledat=moment(v.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledat=moment(v.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}})}else{var e=v.hopper.VoiceQueueId;e&&d.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(v.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.hopper.scheduledat=moment(v.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})});else{d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.hopper.scheduledat=moment(v.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}})}},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){v.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){v.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:v.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(v.agents,{id:e.resourceId})}),t=null;if(v.hopper&&(t=_.find(v.agents,{id:Number(v.hopper.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(v.agents,{id:t.id});a.canSelect=!1,n.push(a)}v.agents=n})}else{var t=[],a=null;v.hopper&&(a=_.find(v.agents,{id:Number(v.hopper.UserId)}));for(var i=0;i<v.agents.length;i++)a&&v.agents[i].id===a.id&&(v.agents[i].canSelect=!1,t.push(v.agents[i]));v.agents=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.cmContact.get({id:v.hopper.ContactId,fields:"dialTimezone"}).$promise.then(function(e){var n;v.contact=e,_.isNil(v.hopper.VoiceQueueId)?(n=v.hopper.CampaignId)&&d.campaign.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;v.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.dateTime=moment(v.hopper.scheduledat).add(n-t,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.dateTime=moment(v.hopper.scheduledat).add(n-0,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):(n=v.hopper.VoiceQueueId)&&d.voiceQueue.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;v.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;v.dateTime=moment(v.hopper.scheduledat).add(n-t,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:v.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),v.dateTime=moment(v.hopper.scheduledat).add(n-0,"minutes").toDate(),v.hopper.scheduledat=moment(v.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions","from"],angular.module("app.motiondialer").controller("HopperdateController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_IVRCAMPAIGN",g.ivrCampaign=angular.copy(l),g.ivrCampaigns=r,g.newIvrCampaign=!1,g.ivrCampaign||(g.ivrCampaign={active:!0,type:"ivr",dialCheckDuplicateType:"always",dialCutDigit:0,limitCalls:30,dialRandomLastDigitCallerIdNumber:0,dialOriginateTimeout:30,dialGlobalMaxRetry:4,dialCongestionMaxRetry:3,dialCongestionRetryFrequency:150,dialBusyMaxRetry:3,dialBusyRetryFrequency:150,dialNoAnswerMaxRetry:3,dialNoAnswerRetryFrequency:150,dialNoSuchNumberMaxRetry:3,dialNoSuchNumberRetryFrequency:150,dialDropMaxRetry:3,dialDropRetryFrequency:150,dialAbandonedMaxRetry:3,dialAbandonedRetryFrequency:150,dialMachineMaxRetry:3,dialMachineRetryFrequency:150,dialAgentRejectMaxRetry:3,dialAgentRejectRetryFrequency:150,dialOrderByScheduledAt:"ASC",dialGlobalInterval:"07:00-22:00,*,*,*",dialAMDInitialSilence:2500,dialAMDGreeting:1500,dialAMDAfterGreetingSilence:800,dialAMDTotalAnalysisTime:5e3,dialAMDMinWordLength:100,dialAMDBetweenWordsSilence:50,dialAMDMaximumNumberOfWords:3,dialAMDSilenceThreshold:256,dialAMDMaximumWordLength:5e3},g.title="MOTIONDIALER.NEW_IVRCAMPAIGN",g.newIvrCampaign=!0),g.addNewIvrCampaign=function(){g.errors=[],d.campaign.save(g.ivrCampaign).$promise.then(function(e){g.ivrCampaigns.unshift(e.toJSON()),o.success({title:"IvrCampaign properly created",msg:g.ivrCampaign.name?g.ivrCampaign.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveIvrCampaign=function(){g.errors=[],d.campaign.update({id:g.ivrCampaign.id},g.ivrCampaign).$promise.then(function(e){var n=_.find(g.ivrCampaigns,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"IvrCampaign properly saved!",msg:g.ivrCampaign.name?g.ivrCampaign.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteIvrCampaign=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The ivrCampaign will be deleted.").ariaLabel("Delete IvrCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.campaign.delete({id:g.ivrCampaign.id}).$promise.then(function(){_.remove(g.ivrCampaigns,{id:g.ivrCampaign.id}),o.success({title:"IvrCampaign properly deleted!",msg:(g.ivrCampaign.name||"ivrCampaign")+" has been deleted!"}),v(g.ivrCampaign)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})});g.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.trunks=n})}else g.trunks=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.projects=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.projects=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.projects,{id:e.resourceId})}),t=null;if(g.ivrCampaign&&(t=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.projects,{id:t.id});a.canSelect=!1,n.push(a)}g.projects=n})}else{var t=[],a=null;g.ivrCampaign&&(a=_.find(g.projects,{id:Number(g.ivrCampaign.SquareProjectId)}));for(var i=0;i<g.projects.length;i++)a&&g.projects[i].id===a.id&&(g.projects[i].canSelect=!1,t.push(g.projects[i]));g.projects=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.ivrCampaign&&(t=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.ivrCampaign&&(a=_.find(g.interval,{id:Number(g.ivrCampaign.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","ivrCampaigns","ivrCampaign","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditIvrCampaignDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=n,d.crudPermissions=l,d.apiRoute="campaign",d.getApi="getBlackLists",d.addApi="addBlackLists",d.removeApi="removeBlackLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","ivrCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("IvrCampaignblacklistaddController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newIvrCampaign=!0,r.ivrCampaign=angular.copy(i),r.ivrCampaigns=s,r.title=o.instant("MOTIONDIALER.CLONE_IVRCAMPAIGN"),i&&i.name&&(r.title+=": "+i.name),r.cloneIvrCampaign=function(){return e.campaign.clone({id:i.id},r.ivrCampaign).$promise.then(function(e){r.ivrCampaigns.unshift(e.toJSON()),a.success({title:"IvrCampaign properly cloned",msg:r.ivrCampaign.name?r.ivrCampaign.name+" has been cloned!":""}),t.go("app.motiondialer.ivrCampaigns.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.campaign.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.campaign.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","ivrCampaign","ivrCampaigns","$translate"],angular.module("app.motiondialer").controller("IvrCampaigncloneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperBlacks=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperBlacks(m.query,u).$promise}function g(e){d.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperBlacks.rows,{id:e.id}),m.ivrCampaignHopperBlacks.count-=1,m.ivrCampaignHopperBlacks.rows.length||p(),l.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHopperBlacks={count:0,rows:[]},m.selectedIvrCampaignHopperBlacks=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperBlack #")+e.id||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperBlacks=p,m.createOrEditIvrCampaignHopperBlack=function(e,n){o.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperBlack:n,hopperBlacks:m.ivrCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperBlacks=function(){var e=angular.copy(m.selectedIvrCampaignHopperBlacks);return m.selectedIvrCampaignHopperBlacks=[],e},m.deleteIvrCampaignHopperBlack=g,m.deleteSelectedIvrCampaignHopperBlacks=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+m.selectedIvrCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperBlacks.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperBlacks=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperFinals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperFinals(m.query,u).$promise}function g(e){d.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperFinals.rows,{id:e.id}),m.ivrCampaignHopperFinals.count-=1,m.ivrCampaignHopperFinals.rows.length||p(),l.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function v(a){d.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){l.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var n,t;"Not Found"===e.data?d.cmHopper.save((n=a,t={},t.phone=n.calleridnum,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=0,t.countcongestionretry=0,t.countnoanswerretry=0,t.countglobal=0,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=n.deleted?null:n.UserId,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.priority=n.recallme?3:2,t.recallme=!!n.recallme,t)).$promise.then(function(e){var n,t;l.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&d.cmHopperHistory.save(((t={}).calleridnum=(n=a).calleridnum,t.calleridname=n.calleridname,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=n.countbusyretry,t.countcongestionretry=n.countcongestionretry,t.countnoanswerretry=n.countnoanswerretry,t.countglobal=n.countglobal,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=c.getCurrentUser().id,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),t.edited=!0,t.state=25,t.statedesc="Restored",t.campaign=n.campaign,t.campaigntype=n.VoiceQueueId?"queue":"ivr",t))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):l.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.contacts={},m.ivrCampaign={},m.ivrCampaignHopperFinals={count:0,rows:[]},m.selectedIvrCampaignHopperFinals=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperFinal #")+e.id||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperFinals=p,m.createOrEditIvrCampaignHopperFinal=function(e,n){o.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperFinal:n,hopperFinals:m.ivrCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperFinals=function(){var e=angular.copy(m.selectedIvrCampaignHopperFinals);return m.selectedIvrCampaignHopperFinals=[],e},m.deleteIvrCampaignHopperFinal=g,m.deleteSelectedIvrCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+m.selectedIvrCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperFinals.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperFinals=[]})},m.moveIvrCampaignHopperFinal=v,m.moveContactsIvrCampaignHopperFinal=function(e){d.cmHopperFinal.moveContactsIvrCampaignHopperFinal({id:m.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?l.info({title:"Restored Contacts",msg:"0"}):l.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.countContactsIvrCampaignHopperFinal=function(e){d.cmHopperFinal.countContactsIvrCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(m.contacts,e[0])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.moveConfirm=function(e,n){var t=o.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.moveSelectedIvrCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to restore the selected contacts?").htmlContent("<b> Contacts selected</b> will be restored.").ariaLabel("Restore Contacts").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperFinals.forEach(function(e){v(e)}),m.selectedIvrCampaignHopperFinals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHopperHistories=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHopperHistories(m.query,u).$promise}function g(e){d.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHopperHistories.rows,{id:e.id}),m.ivrCampaignHopperHistories.count-=1,m.ivrCampaignHopperHistories.rows.length||p(),l.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHopperHistories={count:0,rows:[]},m.selectedIvrCampaignHopperHistories=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperHistory #")+e.id||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHopperHistories=p,m.createOrEditIvrCampaignHopperHistory=function(e,n){o.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopperHistory:n,hopperHistories:m.ivrCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIvrCampaignHopperHistories=function(){var e=angular.copy(m.selectedIvrCampaignHopperHistories);return m.selectedIvrCampaignHopperHistories=[],e},m.deleteIvrCampaignHopperHistory=g,m.deleteSelectedIvrCampaignHopperHistories=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+m.selectedIvrCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHopperHistories.forEach(function(e){g(e)}),m.selectedIvrCampaignHopperHistories=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.ivrCampaignHoppers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.campaign.getHoppers(m.query,u).$promise}function g(e){d.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(m.ivrCampaignHoppers.rows,{id:e.id}),m.ivrCampaignHoppers.count-=1,m.ivrCampaignHoppers.rows.length||p(),l.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETcampaign"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.ivrCampaign={},m.ivrCampaignHoppers={count:0,rows:[]},m.selectedIvrCampaignHoppers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,scheduledat,priority",sort:"-updatedAt",limit:10,page:1},m.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.ivrCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.CampaignId=m.ivrCampaign.id,m.query.id=m.ivrCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopper #")+e.id||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIvrCampaignHoppers=p,m.createOrEditIvrCampaignHopper=function(e,n){o.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:m.ivrCampaign,hopper:n,hoppers:m.ivrCampaignHoppers.rows,license:null,setting:null,crudPermissions:m.crudPermissions,from:"IvrCampaign"}})},m.exportSelectedIvrCampaignHoppers=function(){var e=angular.copy(m.selectedIvrCampaignHoppers);return m.selectedIvrCampaignHoppers=[],e},m.deleteIvrCampaignHopper=g,m.deleteSelectedIvrCampaignHoppers=function(e){var n=o.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+m.selectedIvrCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIvrCampaignHoppers.forEach(function(e){g(e)}),m.selectedIvrCampaignHoppers=[]})},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.agents,{id:e.resourceId})});m.agents.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),m.agents=n})}else m.agents=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("IvrCampaignHoppersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_HOPPER",g.hopper=angular.copy(l),g.hoppers=r,g.newHopper=!1,g.hopper||(g.hopper={},g.title="MOTIONDIALER.NEW_HOPPER",g.newHopper=!0),n.params.id&&(g.hopper.CampaignId=n.params.id),g.addNewHopper=function(){g.errors=[],d.cmHopper.save(g.hopper).$promise.then(function(e){g.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:g.hopper.name?g.hopper.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveHopper=function(){var t,a,i,s;g.errors=[],g.hopper.UserId=g.hopper.recallme?g.hopper.UserId:null,g.hopper.OwnerId=c.getCurrentUser().id,d.cmHopper.get({id:g.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){d.cmHopper.update({id:g.hopper.id},_.omit(g.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.campaign.get({raw:!1,id:a.CampaignId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme})})});var n=_.find(g.hoppers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Hopper properly saved!",msg:g.hopper.name?g.hopper.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},g.deleteHopper=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:g.hopper.id}).$promise.then(function(){_.remove(g.hoppers,{id:g.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(g.hopper.name||"hopper")+" has been deleted!"}),v(g.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})});g.agents.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.agents=n})}else g.agents=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditHopperCampaignIdDialogController",e)}(),function(){"use strict";function e(t,a){var i=this;i.ivrCampaign={},i.init=function(n){i.ivrCampaign=n,t.cmHopper.get({limit:0,CampaignId:n.id}).$promise.then(function(e){return i.total=e.count||0,t.cmHopper.get({limit:0,CampaignId:n.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0,countnosuchnumberretry:0,countdropretry:0,countabandonedretry:0,countmachineretry:0,countagentrejectretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,t.cmHopperFinal.get({limit:0,CampaignId:n.id}).$promise}).then(function(e){i.closed=e.count||0}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["api","toasty"],angular.module("app.motiondialer").controller("IvrCampaignHopperStatisticsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.ivrCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.ivrCampaign=n,d.crudPermissions=l,d.apiRoute="campaign",d.getApi="getLists",d.addApi="addLists",d.removeApi="removeLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.ivrCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","ivrCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("IvrCampaignlistaddController",e)}(),function(){"use strict";function e(e,n,a,i,s,t,o,r){var l=this;function d(){n.hide()}function c(e,n){var t=n.id;o.enqueue(function(){return i.campaign.removeLists({id:e,ids:t}).$promise.then(function(){return i.campaign.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}l.selected=[],l.items=t||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,n){return-1<n.indexOf(e)},l.toggle=function(e,n){var t=n.indexOf(e);-1<t?n.splice(t,1):n.push(e)},l.isIndeterminate=function(){return 0!==l.selected.length&&l.selected.length!==l.items.length},l.isChecked=function(){return l.selected.length===l.items.length},l.toggleAll=function(){l.selected.length===l.items.length?l.selected=[]:(0===l.selected.length||0<l.selected.length)&&(l.selected=l.items.slice(0))},l.listSelected=function(){l.loading=!0,r(function(e,n){for(var t=0;t<l.selected.length;t+=1)c(s.id,l.selected[t]);var a;a=e,o.enqueue(function(){return a()})}).finally(function(){l.loading=!1,d()})}}e.$inject=["$scope","$mdDialog","toasty","api","ivrCampaign","listsCampaign","Sequence","$q"],angular.module("app.motiondialer").controller("IvrCampaignresetlistController",e)}(),function(){"use strict";function e(t,e,i,s,a,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.ivrCampaign=c||t.params.ivrCampaign||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,n){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,n){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:u.ivrCampaigns?u.ivrCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.resetlistdialog=function(n,t){r.campaign.getLists({id:n.id,fields:"id,name",nolimit:!0}).$promise.then(function(a){if(_.isNil(a.rows)||_.isEmpty(a.rows))l.info({title:"Campaign Without Lists"});else if(1===a.rows.length){var e=i.confirm().title("Are you sure want to reset the list "+a.rows[0].name+" ?").htmlContent("<b>"+a.rows[0].name+"</b> will be reset.").ariaLabel("Reset List").targetEvent(t).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n,t;e=u.ivrCampaign.id,n=a.rows[0],t=n.id,r.campaign.removeLists({id:e,ids:t}).$promise.then(function(){return r.campaign.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:ivrCampaign.REMOVELIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}else i.show({controller:"IvrCampaignresetlistController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/resetlist/resetlist.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!1,locals:{ivrCampaign:n,listsCampaign:a?a.rows:[]}})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.ivr_campaigns",{}):l.info({title:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.ivr_campaigns",{})}},u.alert=l.info,u.gotoIvrCampaigns=function(){t.go("app.motiondialer.ivrCampaigns",{},{reload:"app.motiondialer.ivrCampaigns"})},u.saveIvrCampaign=function(){r.campaign.update({id:u.ivrCampaign.id},u.ivrCampaign).$promise.then(function(){l.success({title:"IvrCampaign updated!",msg:u.ivrCampaign.name?u.ivrCampaign.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcampaign",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})});u.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.trunks=n})}else u.trunks=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),t=null;if(u.ivrCampaign&&(t=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.projects,{id:t.id});a.canSelect=!1,n.push(a)}u.projects=n})}else{var t=[],a=null;u.ivrCampaign&&(a=_.find(u.projects,{id:Number(u.ivrCampaign.SquareProjectId)}));for(var i=0;i<u.projects.length;i++)a&&u.projects[i].id===a.id&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),t=null;if(u.ivrCampaign&&(t=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.interval,{id:t.id});a.canSelect=!1,n.push(a)}u.interval=n})}else{var t=[],a=null;u.ivrCampaign&&(a=_.find(u.interval,{id:Number(u.ivrCampaign.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,t.push(u.interval[i]));u.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","ivrCampaign","userProfileSection"],angular.module("app.motiondialer").controller("IvrCampaignController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.ivrCampaigns=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="ivrCampaigns",f.listOrder="",f.listOrderAsc=null,f.selectedIvrCampaigns=[],f.query={fields:"createdAt,updatedAt,id,name,active,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,SquareProjectId,limitCalls,description,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,dialOrderByScheduledAt,dialGlobalInterval,dialTimezone,dialPrefix,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength",type:"ivr",sort:"-updatedAt",limit:10,page:1},f.arraydialCheckDuplicateType=_.keyBy([{option:"ALWAYS",value:"'always'"},{option:"NEVER",value:"'never'"},{option:"ONLY_IF_OPEN",value:"'onlyIfOpen'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.motiondialer.ivrCampaigns.edit",{id:e.id,ivrCampaign:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"IvrCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.listadddialog=function(e,n){i.show({controller:"IvrCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.blacklistadddialog=function(e,n){i.show({controller:"IvrCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{ivrCampaign:e,ivrCampaigns:f.ivrCampaigns?f.ivrCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("ivrCampaign")+"?").htmlContent("<b>"+(e.name||"ivrCampaign")+"</b> will be deleted.").ariaLabel("delete ivrCampaign").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.ivr_campaigns",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.ivr_campaigns",{})}},f.success=E,f.getIvrCampaigns=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.campaign.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="IvrCampaigns",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditIvrCampaign=function(e,n){i.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:n,ivrCampaigns:f.ivrCampaigns.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteIvrCampaign=y,f.exportSelectedIvrCampaigns=function(){var e=angular.copy(f.selectedIvrCampaigns);return f.selectedIvrCampaigns=[],e},f.deleteSelectedIvrCampaigns=function(e){var n=i.confirm().title("Are you sure want to delete the selected ivrCampaigns?").htmlContent("<b>"+f.selectedIvrCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete IvrCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedIvrCampaigns.forEach(function(e){y(e)}),f.selectedIvrCampaigns=[]})},f.deselectIvrCampaigns=function(){f.selectedIvrCampaigns=[]},f.selectAllIvrCampaigns=function(){f.selectedIvrCampaigns=f.ivrCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name",table:"true"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})});f.trunks.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),f.trunks=n})}else f.trunks=[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.projects=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.projects=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.projects,{id:e.resourceId})}),a=null;a=[],f.ivrCampaigns.rows.forEach(function(e){var n=_.find(f.projects,{id:Number(e.SquareProjectId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),f.projects=t})}else{var t=[],a=[];f.ivrCampaigns.rows.forEach(function(e){var n=_.find(f.projects,{id:Number(e.SquareProjectId)});a.push(n)});for(var i=0;i<f.projects.length;i++){_.some(a,{id:f.projects[i].id})&&(f.projects[i].canSelect=!1,t.push(f.projects[i]))}f.projects=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.ivrCampaign&&(t=_.find(f.interval,{id:Number(f.ivrCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.ivrCampaign&&(a=_.find(f.interval,{id:Number(f.ivrCampaign.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.ivrCampaigns=e||{count:0,rows:[]}}function y(e){m.campaign.delete({id:e.id}).$promise.then(function(){_.remove(f.ivrCampaigns.rows,{id:e.id}),f.ivrCampaigns.count-=1,f.ivrCampaigns.rows.length||f.getIvrCampaigns(),p.success({title:_.startCase("IvrCampaign")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcampaign"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcampaign",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getIvrCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","ivrCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.motiondialer").controller("IvrCampaignsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_QUEUECAMPAIGN",g.queueCampaign=angular.copy(l),g.queueCampaigns=r,g.newQueueCampaign=!1,g.queueCampaign||(g.queueCampaign={dialActive:!0,type:"outbound",dialCheckDuplicateType:"always",dialCutDigit:0,autopause:"no",ringinuse:"no",timeoutrestart:"no",setinterfacevar:"no",setqueuevar:"no",setqueueentryvar:"no",dialOrderByScheduledAt:"ASC",dialGlobalInterval:"07:00-22:00,*,*,*",dialAMDInitialSilence:2500,dialAMDGreeting:1500,dialAMDAfterGreetingSilence:800,dialAMDTotalAnalysisTime:5e3,dialAMDMinWordLength:100,dialAMDBetweenWordsSilence:50,dialAMDMaximumNumberOfWords:3,dialAMDSilenceThreshold:256,dialAMDMaximumWordLength:5e3,dialMethod:"progressive",dialPowerLevel:1,dialPredictiveOptimization:"dropRate",dialPredictiveOptimizationPercentage:3,dialPredictiveInterval:10,dialLimitQueue:0,dialRandomLastDigitCallerIdNumber:0,dialOriginateTimeout:30,dialQueueOptions:"tTxX",dialQueueTimeout:3,strategy:"rrmemory",timeout:3,retry:3,weight:1,dialGlobalMaxRetry:4,dialCongestionMaxRetry:3,dialCongestionRetryFrequency:150,dialBusyMaxRetry:3,dialBusyRetryFrequency:150,dialNoAnswerMaxRetry:3,dialNoAnswerRetryFrequency:150,dialNoSuchNumberMaxRetry:3,dialNoSuchNumberRetryFrequency:150,dialDropMaxRetry:3,dialDropRetryFrequency:150,dialAbandonedMaxRetry:3,dialAbandonedRetryFrequency:150,dialMachineMaxRetry:3,dialMachineRetryFrequency:150,dialAgentRejectMaxRetry:3,dialAgentRejectRetryFrequency:150,callAdditionalPhoneAfterMin:3,dialPredictiveIntervalMaxThreshold:20,dialPredictiveIntervalMinThreshold:10},g.title="MOTIONDIALER.NEW_QUEUECAMPAIGN",g.newQueueCampaign=!0),g.addNewQueueCampaign=function(){g.errors=[],d.voiceQueue.save(g.queueCampaign).$promise.then(function(e){g.queueCampaigns.unshift(e.toJSON()),o.success({title:"QueueCampaign properly created",msg:g.queueCampaign.name?g.queueCampaign.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveQueueCampaign=function(){g.errors=[],d.voiceQueue.update({id:g.queueCampaign.id},g.queueCampaign).$promise.then(function(e){var n=_.find(g.queueCampaigns,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"QueueCampaign properly saved!",msg:g.queueCampaign.name?g.queueCampaign.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteQueueCampaign=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The queueCampaign will be deleted.").ariaLabel("Delete QueueCampaign").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceQueue.delete({id:g.queueCampaign.id}).$promise.then(function(){_.remove(g.queueCampaigns,{id:g.queueCampaign.id}),o.success({title:"QueueCampaign properly deleted!",msg:(g.queueCampaign.name||"queueCampaign")+" has been deleted!"}),v(g.queueCampaign)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.trunks=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.trunks,{id:e.resourceId})}),t=null;if(g.queueCampaign&&(t=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.trunks,{id:t.id});a.canSelect=!1,n.push(a)}g.trunks=n})}else{var t=[],a=null;g.queueCampaign&&(a=_.find(g.trunks,{id:Number(g.queueCampaign.TrunkId)}));for(var i=0;i<g.trunks.length;i++)a&&g.trunks[i].id===a.id&&(g.trunks[i].canSelect=!1,t.push(g.trunks[i]));g.trunks=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){g.interval=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.interval,{id:e.resourceId})}),t=null;if(g.queueCampaign&&(t=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.interval,{id:t.id});a.canSelect=!1,n.push(a)}g.interval=n})}else{var t=[],a=null;g.queueCampaign&&(a=_.find(g.interval,{id:Number(g.queueCampaign.IntervalId)}));for(var i=0;i<g.interval.length;i++)a&&g.interval[i].id===a.id&&(g.interval[i].canSelect=!1,t.push(g.interval[i]));g.interval=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","queueCampaigns","queueCampaign","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditQueueCampaignDialogController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.voiceQueue.getAgents({id:c.queueCampaign.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.queueCampaign=n,c.crudPermissions=r,c.penalty=0,c.realtime=i,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.voiceQueue.removeAgents({id:c.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else{for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.voiceQueue.addAgents({id:c.queueCampaign.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("MOTIONDIALER.ALL_AGENTS"),labelSelected:s.instant("MOTIONDIALER.SELECTED_AGENTS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","queueCampaigns","realtime","$translate","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=n,d.crudPermissions=l,d.apiRoute="voiceQueue",d.getApi="getBlackLists",d.addApi="addBlackLists",d.removeApi="removeBlackLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignblacklistaddController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newQueueCampaign=!0,r.queueCampaign=angular.copy(i),r.queueCampaigns=s,r.title=o.instant("MOTIONDIALER.CLONE_QUEUECAMPAIGN"),i&&i.name&&(r.title+=": "+i.name),r.cloneQueueCampaign=function(){return e.voiceQueue.clone({id:i.id},r.queueCampaign).$promise.then(function(e){r.queueCampaigns.unshift(e.toJSON()),a.success({title:"QueueCampaign properly cloned",msg:r.queueCampaign.name?r.queueCampaign.name+" has been cloned!":""}),t.go("app.motiondialer.queueCampaigns.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","queueCampaign","queueCampaigns","$translate"],angular.module("app.motiondialer").controller("QueueCampaigncloneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperBlacks=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperBlacks(m.query,u).$promise}function g(e){d.hopperBlack.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperBlacks.rows,{id:e.id}),m.queueCampaignHopperBlacks.count-=1,m.queueCampaignHopperBlacks.rows.length||p(),l.success({title:"HopperBlack deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHopperBlacks={count:0,rows:[]},m.selectedQueueCampaignHopperBlacks=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,ContactId,phone",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperBlack?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperBlack #")+e.id||"hopperBlack")+"</b> will be deleted.").ariaLabel("delete hopperBlack").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperBlacks=p,m.createOrEditQueueCampaignHopperBlack=function(e,n){o.show({controller:"CreateOrEditHopperBlackDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperBlacks/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperBlack:n,hopperBlacks:m.queueCampaignHopperBlacks.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperBlacks=function(){var e=angular.copy(m.selectedQueueCampaignHopperBlacks);return m.selectedQueueCampaignHopperBlacks=[],e},m.deleteQueueCampaignHopperBlack=g,m.deleteSelectedQueueCampaignHopperBlacks=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperBlacks?").htmlContent("<b>"+m.selectedQueueCampaignHopperBlacks.length+" selected</b> will be deleted.").ariaLabel("delete hopperBlacks").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperBlacks.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperBlacks=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperBlacksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperFinals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperFinals(m.query,u).$promise}function g(e){d.hopperFinal.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperFinals.rows,{id:e.id}),m.queueCampaignHopperFinals.count-=1,m.queueCampaignHopperFinals.rows.length||p(),l.success({title:"HopperFinal deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function v(a){d.cmHopperFinal.checkContactHopper(a).$promise.then(function(e){l.info({title:"The contact is in the hopper",msg:"Contact ID "+e.ContactId})}).catch(function(e){var n,t;"Not Found"===e.data?d.cmHopper.save((n=a,t={},t.phone=n.calleridnum,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=0,t.countcongestionretry=0,t.countnoanswerretry=0,t.countglobal=0,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=n.deleted?null:n.UserId,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.priority=n.recallme?3:2,t.recallme=!!n.recallme,t)).$promise.then(function(e){var n,t;l.info({title:"Restored Contact",msg:"Contact ID "+e.ContactId}),e.ContactId&&d.cmHopperHistory.save(((t={}).calleridnum=(n=a).calleridnum,t.calleridname=n.calleridname,t.scheduledat=moment().format("YYYY-MM-DD HH:mm:ss"),t.countbusyretry=n.countbusyretry,t.countcongestionretry=n.countcongestionretry,t.countnoanswerretry=n.countnoanswerretry,t.countglobal=n.countglobal,t.ContactId=n.ContactId,t.ListId=n.ListId,t.UserId=c.getCurrentUser().id,t.VoiceQueueId=n.VoiceQueueId,t.CampaignId=n.CampaignId,t.editedat=moment().format("YYYY-MM-DD HH:mm:ss"),t.edited=!0,t.state=25,t.statedesc="Restored",t.campaign=n.campaign,t.campaigntype=n.VoiceQueueId?"queue":"ivr",t))}).catch(function(e){_.isNil(e.data)||"Validation error"!==e.data.message?l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()}):l.info({title:"The contact is in the hopper",msg:"Contact ID "+a.ContactId})}):l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.contacts={},m.queueCampaign={},m.queueCampaignHopperFinals={count:0,rows:[]},m.selectedQueueCampaignHopperFinals=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,countglobal,scheduledat,starttime,responsetime,endtime,disposition,secondDisposition,thirdDisposition,ListId,UserId,VoiceQueueId,CampaignId,recallme,deleted,campaign",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperFinal?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperFinal #")+e.id||"hopperFinal")+"</b> will be deleted.").ariaLabel("delete hopperFinal").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperFinals=p,m.createOrEditQueueCampaignHopperFinal=function(e,n){o.show({controller:"CreateOrEditHopperFinalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperFinals/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperFinal:n,hopperFinals:m.queueCampaignHopperFinals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperFinals=function(){var e=angular.copy(m.selectedQueueCampaignHopperFinals);return m.selectedQueueCampaignHopperFinals=[],e},m.deleteQueueCampaignHopperFinal=g,m.deleteSelectedQueueCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperFinals?").htmlContent("<b>"+m.selectedQueueCampaignHopperFinals.length+" selected</b> will be deleted.").ariaLabel("delete hopperFinals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperFinals.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperFinals=[]})},m.moveQueueCampaignHopperFinal=v,m.moveContactsQueueCampaignHopperFinal=function(e){d.cmHopperFinal.moveContactsQueueCampaignHopperFinal({id:m.query.id,state:e}).$promise.then(function(e){_.isNil(e)&&_.isNil(e[0])?l.info({title:"Restored Contacts",msg:"0"}):l.info({title:"Restored Contacts",msg:JSON.stringify(e[0].affectedRows)})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.countContactsQueueCampaignHopperFinal=function(e){d.cmHopperFinal.countContactsQueueCampaignHopperFinal({id:e}).$promise.then(function(e){_.merge(m.contacts,e[0])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},m.moveConfirm=function(e,n){var t=o.confirm().title("Are you sure want to restore the contact?").htmlContent("<b>Contact</b> will be restored.").ariaLabel("Restore Contact").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.moveSelectedQueueCampaignHopperFinals=function(e){var n=o.confirm().title("Are you sure want to restore the selected contacts?").htmlContent("<b> Contacts selected</b> will be restored.").ariaLabel("Restore Contacts").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperFinals.forEach(function(e){v(e)}),m.selectedQueueCampaignHopperFinals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperFinalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHopperHistories=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHopperHistories(m.query,u).$promise}function g(e){d.hopperHistory.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHopperHistories.rows,{id:e.id}),m.queueCampaignHopperHistories.count-=1,m.queueCampaignHopperHistories.rows.length||p(),l.success({title:"HopperHistory deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHopperHistories={count:0,rows:[]},m.selectedQueueCampaignHopperHistories=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,uniqueid,ContactId,calleridnum,calleridname,statedesc,scheduledat,starttime,responsetime,endtime",sort:"-id",limit:10,page:1},m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopperHistory?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopperHistory #")+e.id||"hopperHistory")+"</b> will be deleted.").ariaLabel("delete hopperHistory").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHopperHistories=p,m.createOrEditQueueCampaignHopperHistory=function(e,n){o.show({controller:"CreateOrEditHopperHistoryDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/hopperHistories/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopperHistory:n,hopperHistories:m.queueCampaignHopperHistories.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedQueueCampaignHopperHistories=function(){var e=angular.copy(m.selectedQueueCampaignHopperHistories);return m.selectedQueueCampaignHopperHistories=[],e},m.deleteQueueCampaignHopperHistory=g,m.deleteSelectedQueueCampaignHopperHistories=function(e){var n=o.confirm().title("Are you sure want to delete the selected hopperHistories?").htmlContent("<b>"+m.selectedQueueCampaignHopperHistories.length+" selected</b> will be deleted.").ariaLabel("delete hopperHistories").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHopperHistories.forEach(function(e){g(e)}),m.selectedQueueCampaignHopperHistories=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHopperHistoriesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.queueCampaignHoppers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceQueue.getHoppers(m.query,u).$promise}function g(e){d.cmHopper.delete({id:e.id}).$promise.then(function(){_.remove(m.queueCampaignHoppers.rows,{id:e.id}),m.queueCampaignHoppers.count-=1,m.queueCampaignHoppers.rows.length||p(),l.success({title:"Hopper deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.queueCampaign={},m.queueCampaignHoppers={count:0,rows:[]},m.selectedQueueCampaignHoppers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,ContactId,phone,countcongestionretry,countbusyretry,countnoanswerretry,countnosuchnumberretry,countdropretry,countabandonedretry,countmachineretry,countagentrejectretry,scheduledat,priority,recallme,UserId",sort:"-updatedAt",limit:10,page:1},m.arraypriority=_.keyBy([{option:"Highest",value:"'4'"},{option:"High",value:"'3'"},{option:"Medium",value:"'2'"},{option:"Low",value:"'1'"},{option:"Lowest",value:"'0'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),m.init=function(e,n){m.queueCampaign=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceQueueId=m.queueCampaign.id,m.query.id=m.queueCampaign.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the hopper?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("hopper #")+e.id||"hopper")+"</b> will be deleted.").ariaLabel("delete hopper").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getQueueCampaignHoppers=p,m.createOrEditQueueCampaignHopper=function(e,n){o.show({controller:"HopperdateController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/hopperdate/hopperdate.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:m.queueCampaign,hopper:n,hoppers:m.queueCampaignHoppers.rows,license:null,setting:null,crudPermissions:m.crudPermissions,from:"QueueCampaign"}})},m.exportSelectedQueueCampaignHoppers=function(){var e=angular.copy(m.selectedQueueCampaignHoppers);return m.selectedQueueCampaignHoppers=[],e},m.deleteQueueCampaignHopper=g,m.deleteSelectedQueueCampaignHoppers=function(e){var n=o.confirm().title("Are you sure want to delete the selected hoppers?").htmlContent("<b>"+m.selectedQueueCampaignHoppers.length+" selected</b> will be deleted.").ariaLabel("delete hoppers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedQueueCampaignHoppers.forEach(function(e){g(e)}),m.selectedQueueCampaignHoppers=[]})},c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){m.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.agents,{id:e.resourceId})}),t=null;if(m.queueCampaign&&(t=_.find(m.agents,{id:Number(m.queueCampaign.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(m.agents,{id:t.id});a.canSelect=!1,n.push(a)}m.agents=n})}else{var t=[],a=null;m.queueCampaign&&(a=_.find(m.agents,{id:Number(m.queueCampaign.UserId)}));for(var i=0;i<m.agents.length;i++)a&&m.agents[i].id===a.id&&(m.agents[i].canSelect=!1,t.push(m.agents[i]));m.agents=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.motiondialer").controller("QueueCampaignHoppersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}function h(){console.log("recalcTZTime hopper",g.hopper);var e=g.hopper.Queue.id;if(e)d.voiceQueue.get({id:e,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;if(g.hopper.dialTimezone=e.dialTimezone,n)d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),_.isNil(g.dateTime)||(g.hopper.scheduledat=moment(g.dateTime).add(t-n,"minutes").format("YYYY-MM-DD HH:mm:ss"))})});else{d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),_.isNil(g.dateTime)||(g.hopper.scheduledat=moment(g.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss"))})}});else{d.cmHopper.getTimezone({id:g.hopper.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.hopper.scheduledat=moment(g.dateTime).add(0-n,"minutes").format("YYYY-MM-DD HH:mm:ss")})}}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="MOTIONDIALER.EDIT_HOPPER",g.hopper=angular.copy(l),g.hoppers=r,g.newHopper=!1,g.recalcTZTime=h,e.$watch("vm.contact.dialTimezone",function(){h()}),g.hopper||(g.hopper={},g.title="MOTIONDIALER.NEW_HOPPER",g.newHopper=!0),n.params.id&&(g.hopper.VoiceQueueId=n.params.id),g.addNewHopper=function(){g.errors=[],d.cmHopper.save(g.hopper).$promise.then(function(e){g.hoppers.unshift(e.toJSON()),o.success({title:"Hopper properly created",msg:g.hopper.name?g.hopper.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveHopper=function(){var t,a,i,s;g.errors=[],g.hopper.UserId=g.hopper.recallme?g.hopper.UserId:null,g.hopper.OwnerId=c.getCurrentUser().id,g.hopper.dialTimezone=g.contact.dialTimezone,d.cmHopper.get({id:g.hopper.id,attributes:["scheduledat"]}).$promise.then(function(e){t=_.isNil(e)||_.isEmpty(e)?moment().format("YYYY-MM-DD HH:mm:ss"):e.scheduledat}).finally(function(){d.cmHopper.update({id:g.hopper.id},_.omit(g.hopper,["VoiceQueueId","CampaignId","ContactId","ListId"])).$promise.then(function(e){a=e,d.cmContact.get({id:a.ContactId,attributes:["firstName","lastName"]}).$promise.then(function(e){_.isNil(e)||_.isNil(e.firstName)||(i=e.firstName,_.isNil(e.lastName)||(i+=" "+e.lastName))}).catch(function(){i=void 0}).finally(function(){d.voiceQueue.get({raw:!1,id:a.VoiceQueueId,attributes:["name"]}).$promise.then(function(e){s=e.name}).catch(function(e){s=void 0}).finally(function(){d.cmHopperHistory.save({state:24,statedesc:"Edited",scheduledat:t,calleridnum:a.phone,calleridname:i,campaigntype:a.VoiceQueueId?"queue":"ivr",campaign:s,editedat:moment().format("YYYY-MM-DD HH:mm:ss"),edited:!0,ListId:a.ListId,UserId:c.getCurrentUser().id,VoiceQueueId:a.VoiceQueueId,CampaignId:a.CampaignId,ContactId:a.ContactId,callback:a.callback,callbackuniqueid:a.callbackuniqueid,countbusyretry:a.countbusyretry,countcongestionretry:a.countcongestionretry,countglobal:a.countglobal,countnoanswerretry:a.countnoanswerretry,followuptime:a.followuptime,recallme:a.recallme}).$promise.then(function(){d.cmContact.update({id:a.ContactId,dialTimezone:g.contact.dialTimezone})})})});var n=_.find(g.hoppers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Hopper properly saved!",msg:g.hopper.name?g.hopper.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})})},g.deleteHopper=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The hopper will be deleted.").ariaLabel("Delete Hopper").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cmHopper.delete({id:g.hopper.id}).$promise.then(function(){_.remove(g.hoppers,{id:g.hopper.id}),o.success({title:"Hopper properly deleted!",msg:(g.hopper.name||"hopper")+" has been deleted!"}),v(g.hopper)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cmHopper.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cmHopper.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.dateTime,g.contact,d.cmContact.get({id:g.hopper.Contact.id,fields:"dialTimezone"}).$promise.then(function(e){var n;g.contact=e,console.log("initTZTime hopper",g.hopper),_.isNil(g.hopper.Queue.id)?(n=g.hopper.Campaign.id)&&d.campaign.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;g.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;g.dateTime=moment(g.hopper.scheduledat).add(n-t,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.dateTime=moment(g.hopper.scheduledat).add(n-0,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):(n=g.hopper.Queue.id)&&d.voiceQueue.get({id:n,fields:"dialTimezone"}).$promise.then(function(e){var n=e.dialTimezone;g.hopper.dialTimezone=e.dialTimezone,n?d.cmHopper.getTimezone({id:n}).$promise.then(function(e){var t=e.utcOffset;d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;g.dateTime=moment(g.hopper.scheduledat).add(n-t,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})}):d.cmHopper.getTimezone({id:g.contact.dialTimezone}).$promise.then(function(e){var n=e.utcOffset;_.isNil(n)&&(n=0),g.dateTime=moment(g.hopper.scheduledat).add(n-0,"minutes").toDate(),g.hopper.scheduledat=moment(g.hopper.scheduledat).format("YYYY-MM-DD HH:mm:ss")})})}),g.closeDialog=v,c.hasRole("admin")?d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name",role:"agent",sort:"name",nolimit:"true"}).$promise.then(function(e){g.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.agents,{id:e.resourceId})}),t=null;if(g.hopper&&(t=_.find(g.agents,{id:Number(g.hopper.UserId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.agents,{id:t.id});a.canSelect=!1,n.push(a)}g.agents=n})}else{var t=[],a=null;g.hopper&&(a=_.find(g.agents,{id:Number(g.hopper.UserId)}));for(var i=0;i<g.agents.length;i++)a&&g.agents[i].id===a.id&&(g.agents[i].canSelect=!1,t.push(g.agents[i]));g.agents=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","hoppers","hopper","api","Auth","license","setting","crudPermissions"],angular.module("app.motiondialer").controller("CreateOrEditHopperVoiceQueueIdDialogController",e)}(),function(){"use strict";function e(t,a){var i=this;i.queueCampaign={},i.init=function(n){i.queueCampaign=n,t.cmHopper.get({limit:0,VoiceQueueId:n.id}).$promise.then(function(e){return i.total=e.count||0,t.cmHopper.get({limit:0,VoiceQueueId:n.id,active:!1,countbusyretry:0,countcongestionretry:0,countnoanswerretry:0,countnosuchnumberretry:0,countdropretry:0,countabandonedretry:0,countmachineretry:0,countagentrejectretry:0}).$promise}).then(function(e){return i.fresh=e.count||0,t.cmHopperFinal.get({limit:0,VoiceQueueId:n.id}).$promise}).then(function(e){i.closed=e.count||0}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETTAGS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["api","toasty"],angular.module("app.motiondialer").controller("QueueCampaignHopperStatisticsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(){return a(function(t,n){return a(function(n,t){return s.cmList.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return d.items=e.rows?e.rows:[],r.hasRole("admin")?e:d.section?d.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:d.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return d.allowedItems=_.map(n,function(e){return _.find(d.items,{id:r.hasRole("admin")||d.section.autoAssociation?e.id:e.resourceId})}),d.startingAllowedItems=angular.copy(d.allowedItems),d.items.forEach(function(e){var n=_.find(d.allowedItems,{id:e.id});"admin"===d.currentUser.role?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s[d.apiRoute][d.getApi]({id:d.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];d.selectedItems=_.map(n,function(e){return _.find(d.items,{id:e.id})}),d.startingSelectedItems=angular.copy(d.selectedItems),d.dualMultiselectOptions.selectedItems=d.selectedItems,d.dualMultiselectOptions.items=_.differenceBy(d.allowedItems,d.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}d.currentUser=r.getCurrentUser(),d.queueCampaign=n,d.crudPermissions=l,d.apiRoute="voiceQueue",d.getApi="getLists",d.addApi="addLists",d.removeApi="removeLists",d.items=[],d.allowedItems=[],d.selectedItems=[],d.startingAllowedItems=[],d.startingSelectedItems=[],d.pendingChanges=!1,d.loading=!1,d.dualMultiselectOptions={allowedItems:[],selectedItems:[],showSelectAndDeselectAll:!1,orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("MOTIONDIALER.ALL_LISTS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_LISTS"),transferCallback:function(e,n){var t=_.xorBy(d.startingSelectedItems,d.selectedItems,"id");d.pendingChanges=!_.isEmpty(t)}},d.onInit=function(){return r.hasRole("admin")?c().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:d.currentUser.userProfileId,name:"Lists"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return d.section=e,c()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETLISTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},d.saveLists=function(){d.loading=!0;var e=_.differenceBy(d.startingSelectedItems,d.selectedItems,"id"),n=_.differenceBy(d.selectedItems,d.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.removeApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s[d.apiRoute][d.addApi]({id:d.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){d.pendingChanges=!1,d.startingAllowedItems=angular.copy(d.allowedItems),d.startingSelectedItems=angular.copy(d.selectedItems),i.success({title:"SUCCESS",msg:"Lists association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})}).finally(function(){d.loading=!1});var t},d.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","$timeout","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignlistaddController",e)}(),function(){"use strict";function e(e,n,a,i,s,t,o,r){var l=this;function d(){n.hide()}function c(e,n){var t=n.id;o.enqueue(function(){return i.voiceQueue.removeLists({id:e,ids:t}).$promise.then(function(){return i.voiceQueue.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){a.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}l.selected=[],l.items=t||[],l.loading=!1,l.closeDialog=d,l.exists=function(e,n){return-1<n.indexOf(e)},l.toggle=function(e,n){var t=n.indexOf(e);-1<t?n.splice(t,1):n.push(e)},l.isIndeterminate=function(){return 0!==l.selected.length&&l.selected.length!==l.items.length},l.isChecked=function(){return l.selected.length===l.items.length},l.toggleAll=function(){l.selected.length===l.items.length?l.selected=[]:(0===l.selected.length||0<l.selected.length)&&(l.selected=l.items.slice(0))},l.listSelected=function(){l.loading=!0,r(function(e,n){for(var t=0;t<l.selected.length;t+=1)c(s.id,l.selected[t]);var a;a=e,o.enqueue(function(){return a()})}).finally(function(){l.loading=!1,d()})}}e.$inject=["$scope","$mdDialog","toasty","api","queueCampaign","listsCampaign","Sequence","$q"],angular.module("app.motiondialer").controller("QueueCampaignresetlistController",e)}(),function(){"use strict";function e(e,i,a,s,n,t,o,r){var l=this;function d(){return i(function(t,n){return i(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:i(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),i(function(n,t){return s.voiceQueue.getTeams({id:l.queueCampaign.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.queueCampaign=n,l.crudPermissions=r,l.penalty=0,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"penalty",labelAll:t.instant("MOTIONDIALER.ALL_TEAMS"),labelSelected:t.instant("MOTIONDIALER.SELECTED_TEAMS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+l.penalty});var t=_.xorWith(l.startingSelectedItems,l.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):i(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceWith(l.selectedItems,l.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,i(function(e,n){_.isEmpty(t)?e():s.voiceQueue.removeTeams({id:l.queueCampaign.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return a=n,i(function(e,n){if(!_.isEmpty(a)){var t=_.map(a,function(e){return{id:e.id,penalty:_.trim(e.penalty,"penalty ")}});return s.voiceQueue.addTeams({id:l.queueCampaign.id,teams:t}).$promise.then(function(){e()}).catch(function(e){n(e)})}e()});var a}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),a.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","queueCampaign","$translate","Auth","crudPermissions"],angular.module("app.motiondialer").controller("QueueCampaignteamaddController",e)}(),function(){"use strict";function e(t,e,i,s,a,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.queueCampaign=c||t.params.queueCampaign||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.listadddialog=function(e,n){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.blacklistadddialog=function(e,n){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.teamadddialog=function(e,n){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:u.queueCampaigns?u.queueCampaigns.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.resetlistdialog=function(n,t){r.voiceQueue.getLists({id:n.id,fields:"id,name",nolimit:!0}).$promise.then(function(a){if(_.isNil(a.rows)||_.isEmpty(a.rows))l.info({title:"Campaign Without Lists"});else if(1===a.rows.length){var e=i.confirm().title("Are you sure want to reset the list "+a.rows[0].name+" ?").htmlContent("<b>"+a.rows[0].name+"</b> will be reset.").ariaLabel("Reset List").targetEvent(t).ok("OK").cancel("CANCEL");i.show(e).then(function(){var e,n,t;e=u.queueCampaign.id,n=a.rows[0],t=n.id,r.voiceQueue.removeLists({id:e,ids:t}).$promise.then(function(){return r.voiceQueue.addLists({id:e,ids:t,dialCheckDuplicateType:"never"}).$promise}).then(function(){l.success({title:"Reset Succesfull",msg:"List "+n.name+" has been reset"})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:queueCampaign.REMOVELIST",msg:e.status?JSON.stringify(e.data):e.toString()})})})}else i.show({controller:"QueueCampaignresetlistController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/resetlist/resetlist.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!1,locals:{queueCampaign:n,listsCampaign:a?a.rows:[]}})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:RESETLIST",msg:e.status?JSON.stringify(e.data):e.toString()})})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.queues",{}):l.info({title:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:a.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.queues",{})}},u.alert=l.info,u.gotoQueueCampaigns=function(){t.go("app.motiondialer.queueCampaigns",{},{reload:"app.motiondialer.queueCampaigns"})},u.saveQueueCampaign=function(){r.voiceQueue.update({id:u.queueCampaign.id},u.queueCampaign).$promise.then(function(){l.success({title:"QueueCampaign updated!",msg:u.queueCampaign.name?u.queueCampaign.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MUSICONHOLDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:407}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.musiconholds,{name:u.queueCampaign.musiconhold})),t&&!_.some(n,["id",t.id])){var a=_.find(u.musiconholds,{id:t.id});a.canSelect=!1,n.push(a)}u.musiconholds=n}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true",defaultEntry:1}).$promise.then(function(e){u.musiconholds=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmusiconholds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.trunks=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.trunks,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.trunks,{id:t.id});a.canSelect=!1,n.push(a)}u.trunks=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.trunks,{id:Number(u.queueCampaign.TrunkId)}));for(var i=0;i<u.trunks.length;i++)a&&u.trunks[i].id===a.id&&(u.trunks[i].canSelect=!1,t.push(u.trunks[i]));u.trunks=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.squareProject.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1103}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.projects,{name:u.queueCampaign.dialQueueProject})),t&&!_.some(n,["id",t.id])){var a=_.find(u.projects,{id:t.id});a.canSelect=!1,n.push(a)}u.projects=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.projects,{name:u.queueCampaign.dialQueueProject}));for(var i=0;i<u.projects.length;i++)a&&u.projects[i].id===a.id&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){u.interval=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.interval,{id:e.resourceId})}),t=null;if(u.queueCampaign&&(t=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(u.interval,{id:t.id});a.canSelect=!1,n.push(a)}u.interval=n})}else{var t=[],a=null;u.queueCampaign&&(a=_.find(u.interval,{id:Number(u.queueCampaign.IntervalId)}));for(var i=0;i<u.interval.length;i++)a&&u.interval[i].id===a.id&&(u.interval[i].canSelect=!1,t.push(u.interval[i]));u.interval=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.pauses=n})}else u.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","queueCampaign","userProfileSection"],angular.module("app.motiondialer").controller("QueueCampaignController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.queueCampaigns=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="queueCampaigns",f.listOrder="",f.listOrderAsc=null,f.selectedQueueCampaigns=[],f.query={fields:"createdAt,updatedAt,id,name,dialActive,TrunkId,TrunkBackupId,type,IntervalId,dialCheckDuplicateType,dialCutDigit,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,dialOrderByScheduledAt,dialRecallMeTimeout,dialRecallInQueue,dialGlobalInterval,dialTimezone,dialAMDActive,dialAMDInitialSilence,dialAMDGreeting,dialAMDAfterGreetingSilence,dialAMDTotalAnalysisTime,dialAMDMinWordLength,dialAMDBetweenWordsSilence,dialAMDMaximumNumberOfWords,dialAMDSilenceThreshold,dialAMDMaximumWordLength,dialMethod,dialPowerLevel,dialPredictiveOptimization,dialPredictiveOptimizationPercentage,dialPredictiveInterval,dialLimitQueue,dialOriginateCallerIdName,dialOriginateCallerIdNumber,dialRandomLastDigitCallerIdNumber,dialOriginateTimeout,dialPrefix,dialQueueOptions,dialQueueTimeout,strategy,timeout,retry,wrapuptime,weight,musiconhold,dialQueueProject,dialQueueProject2,dialAgiAfterHangupAgent,dialGlobalMaxRetry,dialCongestionMaxRetry,dialCongestionRetryFrequency,dialBusyMaxRetry,dialBusyRetryFrequency,dialNoAnswerMaxRetry,dialNoAnswerRetryFrequency,dialNoSuchNumberMaxRetry,dialNoSuchNumberRetryFrequency,dialDropMaxRetry,dialDropRetryFrequency,dialAbandonedMaxRetry,dialAbandonedRetryFrequency,dialMachineMaxRetry,dialMachineRetryFrequency,dialAgentRejectMaxRetry,dialAgentRejectRetryFrequency,callAdditionalPhoneAfterMin,description,mandatoryDisposition,mandatoryDispositionPauseId,dialPredictiveIntervalMaxThreshold,dialPredictiveIntervalMinThreshold,dialPreviewAutoRecallMe",type:"outbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},f.arraydialCheckDuplicateType=_.keyBy([{option:"ALWAYS",value:"'always'"},{option:"NEVER",value:"'never'"},{option:"ONLY_IF_OPEN",value:"'onlyIfOpen'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialOrderByScheduledAt=_.keyBy([{option:"DESC",value:"'DESC'"},{option:"ASC",value:"'ASC'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialMethod=_.keyBy([{option:"Progressive",value:"'progressive'"},{option:"PowerDialing",value:"'power'"},{option:"Predictive",value:"'predictive'"},{option:"Preview",value:"'preview'"},{option:"BookedProgressive",value:"'booked'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydialPredictiveOptimization=_.keyBy([{option:"AgentBusyFactor",value:"'agentBusyFactor'"},{option:"DropRate",value:"'dropRate'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraystrategy=_.keyBy([{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Round Robin",value:"'roundrobin'",ngIf:"vm.queueCampaign.dialMethod === 'booked'"},{option:"Least Recent",value:"'leastrecent'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Fewest Calls",value:"'fewestcalls'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Random",value:"'random'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Linear",value:"'linear'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"},{option:"Weight Random",value:"'wrandom'",ngIf:"vm.queueCampaign.dialMethod !== 'booked'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.motiondialer.queueCampaigns.edit",{id:e.id,queueCampaign:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"QueueCampaigncloneController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.listadddialog=function(e,n){i.show({controller:"QueueCampaignlistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.blacklistadddialog=function(e,n){i.show({controller:"QueueCampaignblacklistaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.teamadddialog=function(e,n){i.show({controller:"QueueCampaignteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"QueueCampaignagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{queueCampaign:e,queueCampaigns:f.queueCampaigns?f.queueCampaigns.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("queueCampaign")+"?").htmlContent("<b>"+(e.name||"queueCampaign")+"</b> will be deleted.").ariaLabel("delete queueCampaign").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:1510}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.motiondialer.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.motiondialer.realtime.queues",{})}},f.success=E,f.getQueueCampaigns=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="QueueCampaigns",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditQueueCampaign=function(e,n){i.show({controller:"CreateOrEditQueueCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n,queueCampaigns:f.queueCampaigns.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteQueueCampaign=y,f.exportSelectedQueueCampaigns=function(){var e=angular.copy(f.selectedQueueCampaigns);return f.selectedQueueCampaigns=[],e},f.deleteSelectedQueueCampaigns=function(e){var n=i.confirm().title("Are you sure want to delete the selected queueCampaigns?").htmlContent("<b>"+f.selectedQueueCampaigns.length+" selected</b> will be deleted.").ariaLabel("delete QueueCampaigns").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedQueueCampaigns.forEach(function(e){y(e)}),f.selectedQueueCampaigns=[]})},f.deselectQueueCampaigns=function(){f.selectedQueueCampaigns=[]},f.selectAllQueueCampaigns=function(){f.selectedQueueCampaigns=f.queueCampaigns.rows},g.hasRole("admin")?m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TRUNKS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.trunk.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.trunks=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1011}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(f.trunks,{id:e.resourceId})}),a=null;a=[],f.queueCampaigns.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(f.trunks,{id:e.id});n.canSelect=!1,t.push(n)}}),f.trunks=t})}else{var t=[],a=[];f.queueCampaigns.rows.forEach(function(e){var n=_.find(f.trunks,{id:Number(e.TrunkId)});a.push(n)});for(var i=0;i<f.trunks.length;i++){_.some(a,{id:f.trunks[i].id})&&(f.trunks[i].canSelect=!1,t.push(f.trunks[i]))}f.trunks=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunks",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVAL",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.interval.get({fields:"id,name",sort:"name",IntervalId:"null"}).$promise.then(function(e){f.interval=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.interval,{id:e.resourceId})}),t=null;if(f.queueCampaign&&(t=_.find(f.interval,{id:Number(f.queueCampaign.IntervalId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.interval,{id:t.id});a.canSelect=!1,n.push(a)}f.interval=n})}else{var t=[],a=null;f.queueCampaign&&(a=_.find(f.interval,{id:Number(f.queueCampaign.IntervalId)}));for(var i=0;i<f.interval.length;i++)a&&f.interval[i].id===a.id&&(f.interval[i].canSelect=!1,t.push(f.interval[i]));f.interval=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.queueCampaigns=e||{count:0,rows:[]}}function y(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.queueCampaigns.rows,{id:e.id}),f.queueCampaigns.count-=1,f.queueCampaigns.rows.length||f.getQueueCampaigns(),p.success({title:_.startCase("QueueCampaign")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getQueueCampaigns())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","queueCampaigns","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.motiondialer").controller("QueueCampaignsController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){return[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",options:g.agents.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:g.queues.rows,ngValue:"name"}]}function h(){return g.refresh=!1,0===g.queues.count?f(null):(g.query.queue=1===g.queues.count?g.queues.rows[0].name:g.query.queue,void 0===g.query.queue&&(g.query.queue=_.map(g.queues.rows,"name")),_.isEmpty(g.query.queue)?f(null):(g.query.offset=(g.query.page-1)*g.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.bull.abandonedCalls:"+g.currentUser.id,JSON.stringify({query:_.omit(g.query,"queue")})),void(g.promise=o.voiceQueueReport.getVoiceQueuesReport(g.query,f).$promise)))}function f(e){g.abandonedCalls=e||{count:0,rows:[]},!1,g.refresh=!0}g.currentUser=d.getCurrentUser(),g.agents=u||[],g.dispositions=p.rows,g.abandonedCalls={count:0,rows:[]},g.showTooltip=!1,g.refresh=!0,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=d.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition",type:"outbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-updatedAt",limit:10,page:1},g.getAbandonedCalls=h,g.refreshAbandonedCalls=function(){g.showTooltip=!1,h()},g.assignTo=function(e,n){e&&o.voiceQueueReport.update({id:e.id,lastAssignedTo:n?n.name:null,assigned:!!n}).$promise.catch(function(e){console.log(e)})},g.dispose=function(t){n.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(a.body),targetEvent:t,locals:{dispositions:g.dispositions,call:t}}).then(function(e){if(e){var n={id:t.id,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null};o.voiceQueueReport.update(n).$promise.catch(function(e){console.log(e)})}})},g.onSaveVoiceQueueReport=function(e){e&&g.queuesMap&&"outbound"===queue.type&&g.queuesMap[e.queue]&&(g.showTooltip=!0)},g.onUpdateVoiceQueueReport=function(e){if(e){var n=_.findIndex(g.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(g.abandonedCalls.rows[n],e)}},c.onWithoutApply("voiceQueueReport:save",g.onSaveVoiceQueueReport),c.on("voiceQueueReport:update",g.onUpdateVoiceQueueReport),function(){var e=i.localStorage.getItem("motion2.realtime.abandoned.bull.abandonedCalls:"+g.currentUser.id);if(e)(e=JSON.parse(e))&&e.query&&(g.query=_.merge(e.query,_.omit(g.query,["sort","limit","page"])),g.query=_.omit(g.query,"filter"));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};g.query.createdAt=n}d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"outbound",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()}):o.userProfile.getResources({id:g.currentUser.userProfileId,section:"QueueCampaigns",channel:"voice",type:"outbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(e){console.error(e)}).finally(function(){g.quickFilters=v(),h()})}();var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?t(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())}),e.$on("$destroy",function(){c.removeAllListeners("voiceQueueReport:save"),c.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","userProfile","userProfileSection","Auth","socket","toasty","agents","dispositions"],angular.module("app.motiondialer").controller("AbandonedCallsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o,r,l,d,c,m){var u=this,p=["name","active","limitCalls","message","originated","IntervalId","SquareProjectId","Trunk","TrunkId","ivrAnswerCallsDay","dialQueueProject","ivrTotalCallsDays","description"];function g(){u.campaigns.rows.forEach(function(e){u.rpcCampaigns[e.id]&&_.merge(e,_.pick(u.rpcCampaigns[e.id],p))})}u.currentUser=m.getCurrentUser(),u.campaigns=o||{rows:[],count:0},u.rpcCampaigns=s?_.keyBy(s.rows?s.rows:[],"id"):{},u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.query={sort:"name",limit:10,page:1},u.success=f,u.getCampaigns=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=r.campaign.get(u.query,f).$promise:(u.query.id=u.userProfile.id,u.query.section="IvrCampaigns",u.promise=r.userProfile.getResources(u.query,f).$promise)},u.onSave=function(e){var n=_.find(u.campaigns.rows,["id",e.id]);n&&(_.merge(n,_.pick(e,p)),_.merge(u.rpcCampaigns[e.id],_.pick(e,p)))},u.$onInit=g,u.createOrEditIvrCampaign=function(e,n){a.show({controller:"CreateOrEditIvrCampaignDialogController",controllerAs:"vm",templateUrl:"app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{ivrCampaign:n,ivrCampaigns:u.campaigns.rows,license:null,setting:null,crudPermissions:u.crudPermissions}})},l.onWithoutApply("campaign:save",u.onSave),u.interval=n(function(){},999);var v=!0,h=1;function f(e){u.campaigns=e||{count:0,rows:[]},g()}e.$watch("vm.query.filter",function(e,n){v?t(function(){v=!1}):(n||(h=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=h),u.getCampaigns())}),e.$on("$destroy",function(){l.removeAllListeners("campaign:save"),u.interval&&n.cancel(u.interval)})}e.$inject=["$scope","$timeout","$mdDialog","$document","$interval","rpcCampaigns","campaigns","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("IvrCampaignsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["total","answered","sumHoldTime","sumDuration","sumBillable","outboundNoAnswerCallsDay","outboundBusyCallsDay","outboundCongestionCallsDay","outboundNoSuchCallsDay","outboundUnknownCallsDay","outboundDropCallsDayTimeout","outboundDropCallsDayCallersExit","outboundBlacklistCallsDay","outboundOriginateFailureCallsDay","outboundAnswerAgiCallsDay","outboundReCallsDay","outboundRejectCallsDay"];function u(){c.queues.rows.forEach(function(e){c.rpcQueues[e.id]&&_.merge(e,_.pick(c.rpcQueues[e.id],m))})}c.queues=a||{rows:[],count:0},c.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},c.userProfile=r,c.userProfileSection=l&&1==l.count?l.rows[0]:null,c.crudPermissions=d.parseCrudPermissions(c.userProfileSection?c.userProfileSection.crudPermissions:null),d.hasRole("admin")?c.query={type:"outbound",fields:"id,name",sort:"name",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"outbound",fields:"id,name",sort:"name",limit:10,page:1},c.success=v,c.getQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,d.hasRole("admin")?c.promise=s.voiceQueue.get(c.query,v).$promise:(c.query.id=c.userProfile.id,c.query.section="QueueCampaigns",c.promise=s.userProfile.getResources(c.query,v).$promise)},c.onSave=function(e){var n=_.find(c.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=n(function(){},999);var p=!0,g=1;function v(e){c.queues=e||{count:0,rows:[]},u()}e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&n.cancel(c.interval)})}e.$inject=["$scope","$timeout","$interval","queues","rpcQueues","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.motiondialer").controller("QueueParamsMotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.motiondialer.realtime.agents":this.selectedTab=0;break;case"app.motiondialer.realtime.queues":this.selectedTab=1;break;case"app.motiondialer.realtime.queue_calls":this.selectedTab=2;break;case"app.motiondialer.realtime.abandonedcalls":this.selectedTab=3;break;case"app.motiondialer.realtime.queue_params":this.selectedTab=4;break;case"app.motiondialer.realtime.ivr_campaigns":this.selectedTab=5;break;default:this.selectedTab=0,t.go("app.motiondialer.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.motiondialer.realtime.agents");break;case 1:t.go("app.motiondialer.realtime.queues");break;case 2:t.go("app.motiondialer.realtime.queue_calls");break;case 3:t.go("app.motiondialer.realtime.abandonedcalls");break;case 4:t.go("app.motiondialer.realtime.queue_params");break;case 5:t.go("app.motiondialer.realtime.ivr_campaigns");break;default:t.go("app.motiondialer.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.motiondialer").controller("MotionDialerRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT",g.openchannelAccount=angular.copy(l),g.openchannelAccounts=r,g.newOpenchannelAccount=!1,g.openchannelAccount||(g.openchannelAccount={waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="OPENCHANNEL.NEW_OPENCHANNELACCOUNT",g.newOpenchannelAccount=!0),n.params.id&&(g.openchannelAccount.OpenchannelAccountId=n.params.id),g.addNewOpenchannelAccount=function(){g.errors=[],d.openchannelAccount.save(g.openchannelAccount).$promise.then(function(e){g.openchannelAccounts.unshift(e.toJSON()),o.success({title:"OpenchannelAccount properly created",msg:g.openchannelAccount.name?g.openchannelAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelAccount=function(){g.errors=[],d.openchannelAccount.update({id:g.openchannelAccount.id},g.openchannelAccount).$promise.then(function(e){var n=_.find(g.openchannelAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelAccount properly saved!",msg:g.openchannelAccount.name?g.openchannelAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelAccount will be deleted.").ariaLabel("Delete OpenchannelAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.openchannelAccount.delete({id:g.openchannelAccount.id}).$promise.then(function(){_.remove(g.openchannelAccounts,{id:g.openchannelAccount.id}),o.success({title:"OpenchannelAccount properly deleted!",msg:(g.openchannelAccount.name||"openchannelAccount")+" has been deleted!"}),v(g.openchannelAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.openchannelAccount&&(t=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.openchannelAccount&&(a=_.find(g.lists,{id:Number(g.openchannelAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelAccounts","openchannelAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.openchannelAccountApps.rows.length){var t=r.openchannelAccountApps.rows[n]?r.openchannelAccountApps.rows[n]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccountApp:t,openchannelAccount:r.openchannelAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.openchannelAccountApps.rows[n]=e:r.openchannelAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.openchannelAccountApps.rows.length;t++,0){var a=r.openchannelAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.openchannelAccount.context,a.exten=r.openchannelAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.openchannelAccount.addApplications({id:r.openchannelAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.openchannelAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.openchannelAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.openchannelAccount={},r.openchannelAccountApps={count:0,rows:[]},r.selectedOpenchannelAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]},{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"OpenchannelQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"openchannelQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:801}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,defaultValue:300,required:!0,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",role:"agent",nolimit:!0},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.openchannelAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getOpenchannelAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.openchannelAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getOpenchannelAccountApps=function(){r.promise=o.openchannelAccount.getApplications(r.query,t).$promise},r.editOpenchannelAccountApp=n,r.editInterval=function(e,n){if(r.openchannelAccountApps.rows.length){var t=r.openchannelAccountApps.rows[n]?r.openchannelAccountApps.rows[n]:r.openchannelAccountApps.rows[0];i.show({controller:"EditOpenchannelAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteOpenchannelAccountApp=function(e){_.remove(r.openchannelAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedOpenchannelAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedOpenchannelAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedOpenchannelAccountApps.forEach(function(e){_.remove(r.openchannelAccountApps.rows,{id:e.id})}),r.selectedOpenchannelAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelAccount.getAgents({id:c.openchannelAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserOpenchannelAccount?"penalty "+e.UserOpenchannelAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelAccount.removeAgents({id:c.openchannelAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelAccount.addAgents({id:c.openchannelAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelAccount","openchannelAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditOpenchannelAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("openChannel")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.openchannelQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.openchannelQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:801}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="OPENCHANNEL.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveOpenchannelAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","openchannelAccountApp","openchannelAccount","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("EditOpenchannelAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"openchannelAccount",action:"getDispositions",field:"name",params:{id:m.openchannelAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.openchannelAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.openchannelAccountInteractions.rows.length;n+=1){var t=m.openchannelAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.openchannelInteraction.get(m.query,p).$promise}function v(e){d.openchannelInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.openchannelAccountInteractions.rows,{id:e.id}),m.openchannelAccountInteractions.count-=1,m.openchannelAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.from?e.contactName=e.from:e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("OPENCHANNEL.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.openchannelAccount={},m.openchannelAccountInteractions={count:0,rows:[]},m.selectedOpenchannelAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.openchannelAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.OpenchannelAccountId=m.openchannelAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.openchannelInteractionDownload=function(s,e,n){return d.openchannelInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="openchannel-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getOpenchannelAccountInteractions=g,m.createOrEditOpenchannelAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:m.openchannelAccount,interaction:n,interactions:m.openchannelAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spyopenchannelInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"openchannel",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"openchannel.openchannelAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||OpenchannelAccountId:=$eq["+m.openchannelAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedOpenchannelAccountInteractions=function(){var e=angular.copy(m.selectedOpenchannelAccountInteractions);return m.selectedOpenchannelAccountInteractions=[],e},m.deleteOpenchannelAccountInteraction=v,m.deleteSelectedOpenchannelAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedOpenchannelAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedOpenchannelAccountInteractions.forEach(function(e){v(e)}),m.selectedOpenchannelAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.openchannelAccountOpenchannelCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.openchannelAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.openchannelAccountOpenchannelCannedAnswers.rows,{id:e.id}),m.openchannelAccountOpenchannelCannedAnswers.count-=1,m.openchannelAccountOpenchannelCannedAnswers.rows.length||p(),l.success({title:"OpenchannelCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.openchannelAccount={},m.openchannelAccountOpenchannelCannedAnswers={count:0,rows:[]},m.selectedOpenchannelAccountOpenchannelCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.openchannelAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.OpenchannelAccountId=m.openchannelAccount.id,m.query.id=m.openchannelAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the openchannelCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("openchannelCannedAnswer #")+e.id||"openchannelCannedAnswer")+"</b> will be deleted.").ariaLabel("delete openchannelCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getOpenchannelAccountOpenchannelCannedAnswers=p,m.createOrEditOpenchannelAccountOpenchannelCannedAnswer=function(e,n){o.show({controller:"CreateOrEditOpenchannelCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:m.openchannelAccount,openchannelCannedAnswer:n,openchannelCannedAnswers:m.openchannelAccountOpenchannelCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedOpenchannelAccountOpenchannelCannedAnswers=function(){var e=angular.copy(m.selectedOpenchannelAccountOpenchannelCannedAnswers);return m.selectedOpenchannelAccountOpenchannelCannedAnswers=[],e},m.deleteOpenchannelAccountOpenchannelCannedAnswer=g,m.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected openchannelCannedAnswers?").htmlContent("<b>"+m.selectedOpenchannelAccountOpenchannelCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete openchannelCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedOpenchannelAccountOpenchannelCannedAnswers.forEach(function(e){g(e)}),m.selectedOpenchannelAccountOpenchannelCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountOpenchannelCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="OPENCHANNEL.EDIT_OPENCHANNELCANNEDANSWER",g.openchannelCannedAnswer=angular.copy(l),g.openchannelCannedAnswers=r,g.newOpenchannelCannedAnswer=!1,g.openchannelCannedAnswer||(g.openchannelCannedAnswer={},g.title="OPENCHANNEL.NEW_OPENCHANNELCANNEDANSWER",g.newOpenchannelCannedAnswer=!0),n.params.id&&(g.openchannelCannedAnswer.OpenchannelAccountId=n.params.id),g.addNewOpenchannelCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.openchannelCannedAnswer).$promise.then(function(e){g.openchannelCannedAnswers.unshift(e.toJSON()),o.success({title:"OpenchannelCannedAnswer properly created",msg:g.openchannelCannedAnswer.name?g.openchannelCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveOpenchannelCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.openchannelCannedAnswer.id},g.openchannelCannedAnswer).$promise.then(function(e){var n=_.find(g.openchannelCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"OpenchannelCannedAnswer properly saved!",msg:g.openchannelCannedAnswer.name?g.openchannelCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteOpenchannelCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The openchannelCannedAnswer will be deleted.").ariaLabel("Delete OpenchannelCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.openchannelCannedAnswer.id}).$promise.then(function(){_.remove(g.openchannelCannedAnswers,{id:g.openchannelCannedAnswer.id}),o.success({title:"OpenchannelCannedAnswer properly deleted!",msg:(g.openchannelCannedAnswer.name||"openchannelCannedAnswer")+" has been deleted!"}),v(g.openchannelCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","openchannelCannedAnswers","openchannelCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.openchannelAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.openchannelAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.OpenchannelAccountId=m.openchannelAccount.id,m.query.id=m.openchannelAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.openchannelAccount.id,field:"OpenchannelAccountId",route:"openchannelAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.openchannel").controller("OpenchannelAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.openchannelAccount=c||e.params.openchannelAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:p.openchannelAccounts?p.openchannelAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoOpenchannelAccounts=function(){e.go("app.openchannel.openchannelAccounts",{},{reload:"app.openchannel.openchannelAccounts"})},p.saveOpenchannelAccount=function(){r.openchannelAccount.update({id:p.openchannelAccount.id},p.openchannelAccount).$promise.then(function(){l.success({title:"OpenchannelAccount updated!",msg:p.openchannelAccount.name?p.openchannelAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.openchannelAccount&&(t=_.find(p.lists,{id:Number(p.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.openchannelAccount&&(a=_.find(p.lists,{id:Number(p.openchannelAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),r.cmContact.describe({id:p.openchannelAccount.ListId}).$promise.then(function(e){p.fields=[];e=_.values(e.toJSON());for(var n=["id","createdAt","updatedAt","deletedAt","scheduledat","ListId","CompanyId"],t=0;t<e.length;t++)_.includes(n,e[t].columnName)||p.fields.push(e[t])}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FIELDS",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","openchannelAccount","userProfile","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.openchannelAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="openchannelAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedOpenchannelAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,token,replyUri,ListId,waitForTheAssignedAgent,waitForTheAssignedQueue,mapKey,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUri,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.openchannel.openchannelAccounts.edit",{id:e.id,openchannelAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.openchannel.openchannelAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"OpenchannelAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelAccount:e,openchannelAccounts:f.openchannelAccounts?f.openchannelAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("openchannelAccount")+"?").htmlContent("<b>"+(e.name||"openchannelAccount")+"</b> will be deleted.").ariaLabel("delete openchannelAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getOpenchannelAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.openchannelAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="OpenchannelAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOpenchannelAccount=function(e,n){i.show({controller:"CreateOrEditOpenchannelAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelAccount:n,openchannelAccounts:f.openchannelAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteOpenchannelAccount=y,f.exportSelectedOpenchannelAccounts=function(){var e=angular.copy(f.selectedOpenchannelAccounts);return f.selectedOpenchannelAccounts=[],e},f.deleteSelectedOpenchannelAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected openchannelAccounts?").htmlContent("<b>"+f.selectedOpenchannelAccounts.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedOpenchannelAccounts.forEach(function(e){y(e)}),f.selectedOpenchannelAccounts=[]})},f.deselectOpenchannelAccounts=function(){f.selectedOpenchannelAccounts=[]},f.selectAllOpenchannelAccounts=function(){f.selectedOpenchannelAccounts=f.openchannelAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.openchannelAccount&&(t=_.find(f.lists,{id:Number(f.openchannelAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.openchannelAccount&&(a=_.find(f.lists,{id:Number(f.openchannelAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.openchannelAccounts=e||{count:0,rows:[]}}function y(e){m.openchannelAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.openchannelAccounts.rows,{id:e.id}),f.openchannelAccounts.count-=1,f.openchannelAccounts.rows.length||f.getOpenchannelAccounts(),p.success({title:_.startCase("OpenchannelAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEopenchannelAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getOpenchannelAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.openchannel").controller("OpenchannelAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="OPENCHANNEL.EDIT_OPENCHANNELQUEUE",r.openchannelQueue=angular.copy(n),r.openchannelQueues=e,r.newOpenchannelQueue=!1,r.openchannelQueue||(r.openchannelQueue={strategy:"beepall",timeout:10},r.title="OPENCHANNEL.NEW_OPENCHANNELQUEUE",r.newOpenchannelQueue=!0),r.addNewOpenchannelQueue=function(){r.errors=[],i.openchannelQueue.save(r.openchannelQueue).$promise.then(function(e){r.openchannelQueues.unshift(e.toJSON()),a.success({title:"OpenchannelQueue properly created",msg:r.openchannelQueue.name?r.openchannelQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveOpenchannelQueue=function(){r.errors=[],i.openchannelQueue.update({id:r.openchannelQueue.id},r.openchannelQueue).$promise.then(function(e){var n=_.find(r.openchannelQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"OpenchannelQueue properly saved!",msg:r.openchannelQueue.name?r.openchannelQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteOpenchannelQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The openchannelQueue will be deleted.").ariaLabel("Delete OpenchannelQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.openchannelQueue.delete({id:r.openchannelQueue.id}).$promise.then(function(){_.remove(r.openchannelQueues,{id:r.openchannelQueue.id}),a.success({title:"OpenchannelQueue properly deleted!",msg:(r.openchannelQueue.name||"openchannelQueue")+" has been deleted!"}),l(r.openchannelQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","openchannelQueues","openchannelQueue","api","Auth","crudPermissions"],angular.module("app.openchannel").controller("CreateOrEditOpenchannelQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelQueue.getAgents({id:c.openchannelQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserOpenchannelQueue?"penalty "+e.UserOpenchannelQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.openchannelQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.removeAgents({id:c.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.addAgents({id:c.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("OPENCHANNEL.ALL_AGENTS"),labelSelected:r.instant("OPENCHANNEL.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","openchannelQueue","openchannelQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.openchannelQueue.getTeams({id:l.openchannelQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.openchannelQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("OPENCHANNEL.ALL_TEAMS"),labelSelected:t.instant("OPENCHANNEL.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.removeTeams({id:l.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.openchannelQueue.addTeams({id:l.openchannelQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","openchannelQueue","$translate","Auth","crudPermissions"],angular.module("app.openchannel").controller("OpenchannelQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.openchannelQueue=c||e.params.openchannelQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:u.openchannelQueues?u.openchannelQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoOpenchannelQueues=function(){e.go("app.openchannel.openchannelQueues",{},{reload:"app.openchannel.openchannelQueues"})},u.saveOpenchannelQueue=function(){r.openchannelQueue.update({id:u.openchannelQueue.id},u.openchannelQueue).$promise.then(function(){l.success({title:"OpenchannelQueue updated!",msg:u.openchannelQueue.name?u.openchannelQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","openchannelQueue","userProfileSection"],angular.module("app.openchannel").controller("OpenchannelQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.openchannelQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="openchannelQueues",f.listOrder="",f.listOrderAsc=null,f.selectedOpenchannelQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"openchannel",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.openchannel.openchannelQueues.edit",{id:e.id,openchannelQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"OpenchannelQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:f.openchannelQueues?f.openchannelQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"OpenchannelQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{openchannelQueue:e,openchannelQueues:f.openchannelQueues?f.openchannelQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("openchannelQueue")+"?").htmlContent("<b>"+(e.name||"openchannelQueue")+"</b> will be deleted.").ariaLabel("delete openchannelQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:810}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.openchannel.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.openchannel.realtime.queues",{})}},f.success=E,f.getOpenchannelQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.openchannelQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="OpenchannelQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditOpenchannelQueue=function(e,n){i.show({controller:"CreateOrEditOpenchannelQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{openchannelQueue:n,openchannelQueues:f.openchannelQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteOpenchannelQueue=y,f.exportSelectedOpenchannelQueues=function(){var e=angular.copy(f.selectedOpenchannelQueues);return f.selectedOpenchannelQueues=[],e},f.deleteSelectedOpenchannelQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected openchannelQueues?").htmlContent("<b>"+f.selectedOpenchannelQueues.length+" selected</b> will be deleted.").ariaLabel("delete OpenchannelQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedOpenchannelQueues.forEach(function(e){y(e)}),f.selectedOpenchannelQueues=[]})},f.deselectOpenchannelQueues=function(){f.selectedOpenchannelQueues=[]},f.selectAllOpenchannelQueues=function(){f.selectedOpenchannelQueues=f.openchannelQueues.rows};var b=!0,A=1;function E(e){f.openchannelQueues=e||{count:0,rows:[]}}function y(e){m.openchannelQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.openchannelQueues.rows,{id:e.id}),f.openchannelQueues.count-=1,f.openchannelQueues.rows.length||f.getOpenchannelQueues(),p.success({title:_.startCase("OpenchannelQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEopenchannelQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEopenchannelQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getOpenchannelQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","openchannelQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.openchannel").controller("OpenchannelQueuesController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.openchannel.realtime.agents":this.selectedTab=0;break;case"app.openchannel.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.openchannel.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.openchannel.realtime.agents");break;case 1:t.go("app.openchannel.realtime.queues");break;default:t.go("app.openchannel.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.openchannel").controller("OpenchannelRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.currentUser=s.getCurrentUser(),o.plugin={},o.getTrustedURL=function(){return t.trustAsResourceUrl(o.plugin.adminUrl)},a.plugin.get({id:e.params.id}).$promise.then(function(e){if(e)return o.plugin=e,a.plugin.get({id:o.plugin.id}).$promise}).catch(function(e){o.plugin=void 0})}e.$inject=["$state","$scope","$sce","api","socket","Auth"],angular.module("app.plugins.plugin").controller("PluginController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o,r,l,d,c,m,u,p,g,v){var h=this,f=i.params.direction||"inbound",b=g&&1==g.count?g.rows[0].crudPermissions:null;function A(n){return h.query.offset=(h.query.page-1)*h.query.limit,e.resolve().then(function(){if(!0===n){var e=Object.assign({},_.omit(h.query,["limit","offset","page"]),{nolimit:!0});return o.realtime.getAgents(e).$promise}}).then(function(e){e&&(h.amiAgents=e)}).then(function(){var e=h.queues?h.queues.rows:[];h.agents=l.paginateAgents(h.amiAgents.rows,e,h.query)}).catch(function(e){c.error({title:s.instant("VOICE.AGENTS"),msg:e.status?JSON.stringify(e.data):e.toString()})})}function E(e){return _.find(h.amiAgents.rows,["id",e])}function y(e){var n=E(e.id);n?(Object.assign(n,e),A()):r.isAdmin()&&A(!0)}function S(){A(!0)}function T(e){var n=E(e.id);n?(Object.assign(n,e),A()):r.isAdmin()&&A(!0)}function I(){A(!0)}function O(e){var n=E(e.id);n?(Object.assign(n,_.pick(e,["queue","destconnectedlinenum","routealias"])),A()):r.isAdmin()&&A(!0)}function C(e){if("ATTENDED"!==e.transfer){var n=E(e.id);n?(delete n.queue,delete n.destconnectedlinenum,delete n.routealias,A()):r.isAdmin()&&A(!0)}}function w(e){if(0!==h.query.globalQueueFilter.length){var n=e[_.capitalize(h.channel)+"QueueId"];if(h.query.globalQueueFilter.includes(n))_.find(h.queues.rows,function(e){return e.id===n}).Agents.push({id:e.UserId}),A()}}function R(n){if(0!==h.query.globalQueueFilter.length){var t=n[_.capitalize(h.channel)+"QueueId"];if(h.query.globalQueueFilter.includes(t)){var e=_.find(h.queues.rows,function(e){return e.id===t});_.remove(e.Agents,function(e){return e.id===n.UserId}),A()}}}function x(){h.queues&&D(!0)}function N(){h.queues&&D(!0)}function D(e){if(!(h.queues&&0<h.queues.count)||e){var n={type:f,fields:"id,name",sort:"name",nolimit:!0,include:[{model:"User",alias:"Agents",fields:["id","name"],raw:!0}]},t=h.channel+"Queue";return o.getResourcesByRole(h.currentUser,t,n,null).then(function(e){h.queues=e}).catch(function(e){c.error({title:s.instant("VOICE.QUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})}}h.currentUser=r.getCurrentUser(),h.channel=i.params.channel,h.amiAgents=m,h.pauses=p,h.license=u,h.crudPermissions=r.parseCrudPermissions(b),h.utcOffset=v,h.query={channel:h.channel,globalQueueFilter:[],globalStatusFilter:null,pauseTypeFilter:null,limit:10,page:1,sort:"fullname"},h.$onInit=function(){d.on("user:remove",I),d.on("user:save",S),d.on("user:update",T),d.on("user:agentconnect",O),d.on("user:agentcomplete",C),d.on("user:ami:update",y),d.on("user:routing:update",y),d.on("user"+_.capitalize(h.channel)+"Queue:save",w),d.on("user"+_.capitalize(h.channel)+"Queue:remove",R),d.on(h.channel+"Queue:save",x),d.on(h.channel+"Queue:remove",N),A()},h.getAgents=A,h.onPaginate=function(){A()},h.onSort=function(){A()},h.logout=function(e){return o.user.logout({id:e.id,device:"realtime",agent_id:e.id,agent_name:e.name}).$promise.then(function(){c.success({title:"Agent logout",msg:e.fullname+"  properly logout"})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.LOGOUT"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.pause=function(e,n){return o.user.pause({id:e.id,type:n}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.PAUSE"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.unpause=function(e){return o.user.unpause({id:e.id}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.UNPAUSE"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.addQueue=function(e,n){a.show({controller:"AgentQueueAddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,channel:h.channel,direction:f,crudPermissions:h.crudPermissions}})},h.manageScreenRecording=function(e,n){return o.user.update({id:e.id},{screenrecording:n}).$promise.catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:s.instant("VOICE.SCREENRECORDING"),msg:e.data?JSON.stringify(e.data.message):e.toString()})})},h.getQueuesByChannel=D,h.selectAllQueues=function(){h.query.globalQueueFilter=h.queues.rows.map(function(e){return e.id})},h.clearQueuesSelection=function(){h.query.globalQueueFilter=[]},n.$on("$destroy",function(){d.removeAllListeners("user:remove"),d.removeAllListeners("user:save"),d.removeAllListeners("user:update"),d.removeAllListeners("user:agentconnect"),d.removeAllListeners("user:agentcomplete"),d.removeAllListeners("user:ami:update"),d.removeAllListeners("user:routing:update"),d.removeAllListeners("user"+_.capitalize(h.channel)+"Queue:save"),d.removeAllListeners("user"+_.capitalize(h.channel)+"Queue:remove")})}e.$inject=["$document","$mdDialog","$q","$scope","$state","$translate","api","Auth","realtimeManager","socket","toasty","agents","license","pauses","userProfileSection","utcOffset"],angular.module("app.realtime").controller("AgentsRealtimeController",e)}(),function(){"use strict";function e(e,a,n,i,s,t,o,r,l,d,c){var m=this,u=c&&1==c.count?c.rows[0].crudPermissions:null;function p(){return m.queues.rows.map(function(e){return e.name})}function g(n){if(n.type===m.voiceQueueType&&p().includes(n.queue)){var e=_.find(m.voiceQueuesChannels.rows,function(e){return e.uniqueid===n.uniqueid});e?Object.assign(e,n):(m.voiceQueuesChannels.rows.push(n),m.voiceQueuesChannels.count=m.voiceQueuesChannels.rows.length)}}function v(n){m.voiceQueuesChannels.rows=_.filter(m.voiceQueuesChannels.rows,function(e){return e.uniqueid!==n.uniqueid}),m.voiceQueuesChannels.count=m.voiceQueuesChannels.rows.length}m.currentUser=t.getCurrentUser(),m.queues=l,m.voiceQueuesChannels=d,m.voiceQueueType=n.params.direction,m.crudPermissions=t.parseCrudPermissions(u),m.query={limit:10,page:1},m.$onInit=function(){o.on("voice_queue_channel:save",g),o.on("voice_queue_channel:remove",v);var n=p(),e=m.voiceQueuesChannels.rows.filter(function(e){if(n.includes(e.queue))return!0});m.voiceQueuesChannels.rows=e,m.voiceQueuesChannels.count=e.length},m.hangup=function(e){return s.rpc.getVoiceQueuesChannelHangup({uniqueid:e}).$promise.then(function(e){r.success({title:i.instant("VOICE.CALL_HANGUP_SUCCESS"),msg:e.message||void 0})}).catch(function(e){r.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},m.getAvailableAgents=function(){m.availableAgents=null;var e={id:t.isUser()?m.currentUser.userProfileId:void 0,fields:"id,name,fullname,internal,context,online,voicePause,voiceStatus",sort:"fullname",online:!0,voicePause:!1};return s.realtime.getAgents(e).$promise.then(function(e){var n=e.rows.filter(function(e){return"idle"===e.voiceStatus});m.availableAgents=n}).catch(function(e){r.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},m.redirectToAgent=function(e,n,t){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:e,exten:n,context:t}).$promise.then(function(e){r.success({title:i.instant("VOICE.CALL_REDIRECT_SUCCESS"),msg:e.message||void 0})}).catch(function(e){r.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},m.redirectToNumber=function(e,n){var t=a.prompt().title(i.instant("VOICE.CALL_NUMBER_REDIRECT")).placeholder(i.instant("DASHBOARDS.NUMBER")).targetEvent(e).ok("Ok").cancel(i.instant("TOOLBAR.CANCEL"));return a.show(t).then(function(e){return s.rpc.getVoiceQueuesChannelRedirect({uniqueid:n,exten:e}).$promise}).then(function(e){r.success({title:i.instant("VOICE.CALL_REDIRECT_SUCCESS"),msg:e.message||void 0})}).catch(function(e){e&&r.error({title:e.status+" - "+e.statusText,msg:JSON.stringify(e.data)||e.message.join(" ")})})},e.$on("$destroy",function(){o.removeAllListeners("voice_queue_channel:save"),o.removeAllListeners("voice_queue_channel:remove")})}e.$inject=["$scope","$mdDialog","$state","$translate","api","Auth","socket","toasty","queues","voiceQueuesChannels","userProfileSection"],angular.module("app.realtime").controller("QueueCallsRealtimeController",e)}(),function(){"use strict";function e(i,s,e,n,t,a,o,r,l,d,c,m,u){var p=this,g=e(function(){},999),v=u&&1==u.count?u.rows[0].crudPermissions:null,h=t.params.direction,f="outbound"===h?"QueueCampaigns":_.startCase(p.channel)+"Queues";function b(e){var n=_.find(p.queues.rows,["id",e.id]);n&&(n=l.updateQueue(e,n))}p.currentUser=r.getCurrentUser(),p.channel=t.params.channel,p.queues=m,p.crudPermissions=r.parseCrudPermissions(v),p.headersTemplate=null,p.rowsTemplate=null,p.query={id:r.isUser()?p.currentUser.id:void 0,section:r.isUser()?f:void 0,channel:p.channel,type:h,sort:"name",limit:10,page:1},p.$onInit=function(){var e,n;d.on(p.channel+"_queue:save",b),p.headersTemplate=(e="default.html","voice"===p.channel&&(e=h+".html"),"app/main/apps/realtime/views/queues/templates/headers/"+e),p.rowsTemplate=(n="default.html","voice"===p.channel&&(n=h+".html"),"app/main/apps/realtime/views/queues/templates/rows/"+n),"voice"===p.channel&&p.queues.rows.forEach(function(e){0<e.ringing&&e.available<e.loggedIn&&(e.available+=e.ringing)})},p.getQueues=function(){return p.query.offset=(p.query.page-1)*p.query.limit,o.realtime.getQueues(p.query).$promise.then(function(e){p.queues=e}).catch(function(e){c.error({title:a.instant("DASHBOARDS.QUEUES"),msg:e.status?JSON.stringify(e.data):e.toString()})})},p.editQueue=function(e,n){var t={crudPermissions:p.crudPermissions};t[p.channel+"Queue"]=n,t[p.channel+"Queues"]=p.queues.rows;var a={controller:"CreateOrEdit"+_.startCase(p.channel)+"QueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/"+p.channel+"/views/"+p.channel+"Queues/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:t};return s.show(a)},p.addOrRemoveAgents=function(e,n){var t={realtime:"voice"===p.channel,crudPermissions:p.crudPermissions};t[p.channel+"Queue"]=n,t[p.channel+"Queues"]=p.queues.rows;var a={controller:_.startCase(p.channel)+"QueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/"+p.channel+"/views/"+p.channel+"Queues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:t};return s.show(a)},p.showPredictiveInfo=function(e,n){var t={controller:"PredictiveInfoDialogController",controllerAs:"vm",templateUrl:"app/main/apps/realtime/views/queues/predictive/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{queueCampaign:n}};return s.show(t)},n.$on("$destroy",function(){d.removeAllListeners(p.channel+"_queue:save"),g&&e.cancel(g)})}e.$inject=["$document","$mdDialog","$interval","$scope","$state","$translate","api","Auth","realtimeManager","socket","toasty","queues","userProfileSection"],angular.module("app.realtime").controller("QueuesRealtimeController",e)}(),function(){"use strict";function e(e,n){this.queueCampaign=n,this.formatTime=function(e,n){var t=moment(e);return n&&t.add(n,"minutes"),t.format("HH:mm:ss")},this.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","queueCampaign"],angular.module("app.realtime").controller("PredictiveInfoDialogController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u){var p=this;function g(e){p.cloudProviders=e||{count:0,rows:[]}}function v(e){r.cloudProvider.delete({id:e.id}).$promise.then(function(){_.remove(p.cloudProviders.rows,{id:e.id}),p.cloudProviders.count-=1,p.cloudProviders.rows.length||p.getAiTools(),d.success({title:s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcloudProvider"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcloudProvider",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}p.license=m,p.setting=u,p.currentUser=c.getCurrentUser(),p.cloudProviders=o||{count:0,rows:[]},p.selectedAiTools=[],p.query={fields:"createdAt,updatedAt,id,name,service,type,data1,data2,data3,data4,data5,data6",sort:"-updatedAt",limit:10,page:1},p.services={AmazonAWS:"AmazonAWS",MicrosoftAzure:"Microsoft Azure"},p.editdialog=function(e,n){a.show({controller:"CreateOrEditCloudProviderDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/create/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{cloudProvider:e,cloudProviders:p.cloudProviders.rows,license:p.license,setting:null,crudPermissions:p.crudPermissions}})},p.deleteconfirm=function(e,n){var t=a.confirm().title(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_TITLE")).content(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_MESSAGE",{name:e.name})).ariaLabel("delete cloud provider").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){v(e)})},p.success=g,p.getAiTools=function(){p.query.offset=(p.query.page-1)*p.query.limit,c.hasRole("admin")?p.promise=r.cloudProvider.get(p.query,g).$promise:(p.query.id=p.userProfile.id,p.query.section="AiTools",p.promise=r.userProfile.getResources(p.query,g).$promise)},p.createOrEditCloudProvider=function(e,n){a.show({controller:"CreateOrEditCloudProviderDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{cloudProvider:n,cloudProviders:p.cloudProviders.rows,license:p.license,setting:p.setting,crudPermissions:p.crudPermissions}})},p.deleteCloudProvider=v,p.exportSelectedAiTools=function(){var e=angular.copy(p.selectedAiTools);return p.selectedAiTools=[],e},p.deleteSelectedAiTools=function(e){var n=a.confirm().title(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETE_TITLE")).content(s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETE_MESSAGE",{total:p.selectedAiTools.length})).ariaLabel("delete CloudProviders").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){p.selectedAiTools.forEach(function(e){v(e)}),p.selectedAiTools=[],d.success({title:s.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDERS_DELETED_SUCCESS_TITLE")})})},p.deselectAiTools=function(){p.selectedAiTools=[]},p.selectAllAiTools=function(){p.selectedAiTools=p.cloudProviders.rows},p.authenticateToMicrosoftIdentityPlatform=function(e){return r.cloudProvider.oauth2MicrosoftAuthorize({id:e.id}).$promise.then(function(e){p.loginWindow=n.open(e.url,"_blank","width=800,height=600")})},p.updateClientSecret=function(n,e){return a.show({controller:"UpdateClientSecretController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/cloudProviders/updateSecret/updateSecret.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,resolve:{cloudProvider:["apiResolver",function(e){return e.resolve("cloudProvider@get",{fields:"id,service,data3",id:n.id})}]}})},l.on("microsoftAuthorization:success",function(e){p.currentUser.id===e.id&&(p.loginWindow.close(),d.success({msg:s.instant("SETTINGS.NOTIFICATIONS.MICROSOFT_AUTHENTICATION_SUCCESS")}))}),l.on("microsoftAuthorization:error",function(e){p.currentUser.id===e.id&&(p.loginWindow.close(),d.error({msg:s.instant("SETTINGS.NOTIFICATIONS.MICROSOFT_AUTHENTICATION_FAIL")}))}),e.$on("$destroy",function(){l.removeAllListeners("microsoftAuthorization:success"),l.removeAllListeners("microsoftAuthorization:error")});var h=!0,f=1;e.$watch("vm.query.filter",function(e,n){h?i(function(){h=!1}):(n||(f=p.query.page),e!==n&&(p.query.page=1),e||(p.query.page=f),p.getAiTools())})}e.$inject=["$scope","$window","$mdDialog","$document","$timeout","$translate","cloudProviders","api","socket","toasty","Auth","license","setting"],angular.module("app.settings").controller("CloudProvidersController",e)}(),function(){"use strict";function e(t,a,i,e,n,s,o,r){var l=this;function d(e){t.hide(e)}l.currentUser=o.getCurrentUser(),l.license=r,l.cloudProvider=angular.copy(n),l.cloudProviders=e,l.newCloudProvider=!1,l.errors=[],l.cloudProvider||(l.cloudProvider={},l.newCloudProvider=!0),l.addNewCloudProvider=function(){l.errors=[],s.cloudProvider.save(l.cloudProvider).$promise.then(function(e){l.cloudProviders.unshift(e.toJSON()),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_CREATED_SUCCESS_TITLE")}),d(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.saveCloudProvider=function(){l.errors=[],s.cloudProvider.update({id:l.cloudProvider.id},l.cloudProvider).$promise.then(function(e){var n=_.find(l.cloudProviders,{id:e.id});n&&_.merge(n,e.toJSON()),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_SAVED_SUCCESS_TITLE")}),d(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},l.deleteCloudProvider=function(e){l.errors=[];var n=t.confirm().title(a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_TITLE")).content(a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETE_MESSAGE",{name:l.cloudProvider.name})).ariaLabel("Delete Cloud Provider").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){s.cloudProvider.delete({id:l.cloudProvider.id}).$promise.then(function(){_.remove(l.cloudProviders,{id:l.cloudProvider.id}),i.success({title:a.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_DELETED_SUCCESS_TITLE")}),d(l.cloudProvider)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},l.closeDialog=d}e.$inject=["$mdDialog","$translate","toasty","cloudProviders","cloudProvider","api","Auth","license"],angular.module("app.settings").controller("CreateOrEditCloudProviderDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;function o(){e.hide()}s.cloudProvider=i,s.errors=[],s.saveSecret=function(){return s.errors=[],a.cloudProvider.update({id:i.id},{data3:s.newSecret}).$promise.then(function(){t.success({title:n.instant("SETTINGS.NOTIFICATIONS.CLOUD_PROVIDER_SECRET_UPDATE_SUCCESS_TITLE")}),o()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){s.errors=e.data.errors||[{message:e.toString(),type:"api.cloudProvider.update"}];for(var n=0;n<e.data.errors.length;n+=1)t.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cloudProvider.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},s.closeDialog=o}e.$inject=["$mdDialog","$translate","toasty","api","cloudProvider"],angular.module("app.settings").controller("UpdateClientSecretController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SETTINGS.EDIT_CUSTOMIZATION",g.customization=angular.copy(l),g.customizations=r,g.newCustomization=!1,g.customization||(g.customization={},g.title="SETTINGS.NEW_CUSTOMIZATION",g.newCustomization=!0),g.addNewCustomization=function(){g.errors=[],d.setting.save(g.customization).$promise.then(function(e){g.customizations.unshift(e.toJSON()),o.success({title:"Customization properly created",msg:g.customization.name?g.customization.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomization=function(){g.errors=[],d.setting.update({id:g.customization.id},g.customization).$promise.then(function(e){var n=_.find(g.customizations,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Customization properly saved!",msg:g.customization.name?g.customization.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomization=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The customization will be deleted.").ariaLabel("Delete Customization").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.setting.delete({id:g.customization.id}).$promise.then(function(){_.remove(g.customizations,{id:g.customization.id}),o.success({title:"Customization properly deleted!",msg:(g.customization.name||"customization")+" has been deleted!"}),v(g.customization)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customizations","customization","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditCustomizationDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.customizations=e,s.customization={},s.customizations&&s.customizations.rows&&s.customizations.rows.length&&(s.customization=s.customizations.rows[0]),s.saveCustomization=function(){s.customization.id?n.setting.update({id:s.customization.id},s.customization).$promise.then(function(){t.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):n.setting.save(s.customization).$promise.then(function(e){_.merge(s.customization,e),t.success({title:"Customization updated!",msg:s.customization.name?s.customization.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["customizations","api","toasty","license","Auth"],angular.module("app.settings").controller("CustomizationsController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg","ico"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/favicon".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationfaviconController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/logo".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationlogoController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/logo_login".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationlogologinController",e)}(),function(){"use strict";function e(e,a){var i=this;i.customization={},i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.customization.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.customization.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e){i.customization=angular.copy(e),i.ngFlowOptions.target="/api/settings/1/preferred".replace(":id",i.customization.id),i.customization.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.settings").controller("CustomizationpreferredController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SETTINGS.EDIT_GENERAL",g.general=angular.copy(l),g.generals=r,g.newGeneral=!1,g.general||(g.general={min_internal:1e3,chatTimeout:30,phoneBarAutoUpdater:!0,phoneBarAutoUpdaterUrl:"https://www.xcally.com/bar/phonebar/autoupdater.xml",splitSizeCsv:5e3,splitSizePdf:1e3,splitSizeXlsx:5e3,messagesAlignment:"alternate",phoneBarRememberMeEnabled:!0,allowedLoginAttempts:5,blockDuration:10,loginMailFrequency:10,enforcePasswordHistory:!0,passwordHistoryLimit:3},g.title="SETTINGS.NEW_GENERAL",g.newGeneral=!0),g.addNewGeneral=function(){g.errors=[],d.setting.save(g.general).$promise.then(function(e){g.generals.unshift(e.toJSON()),o.success({title:"General properly created",msg:g.general.name?g.general.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveGeneral=function(){g.errors=[],d.setting.update({id:g.general.id},g.general).$promise.then(function(e){var n=_.find(g.generals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"General properly saved!",msg:g.general.name?g.general.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteGeneral=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The general will be deleted.").ariaLabel("Delete General").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.setting.delete({id:g.general.id}).$promise.then(function(){_.remove(g.generals,{id:g.general.id}),o.success({title:"General properly deleted!",msg:(g.general.name||"general")+" has been deleted!"}),v(g.general)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.setting.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.setting.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,d.cloudProvider.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.cloudProviders=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CLOUDPROVIDERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","generals","general","api","Auth","license","setting","crudPermissions"],angular.module("app.settings").controller("CreateOrEditGeneralDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.currentUser=i.getCurrentUser(),s.license=a,s.generals=e,s.general={},s.generals&&s.generals.rows&&s.generals.rows.length&&(s.general=s.generals.rows[0]),_.isNil(s.general.privacyPolicyEmail)||(s.general.enablePrivacyPolicyEmail=!0),_.isNil(s.general.privacyPolicyName)||(s.general.enablePrivacyPolicyName=!0),_.isNil(s.general.privacyPolicyNumber)||(s.general.enablePrivacyPolicyNumber=!0),n.cloudProvider.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){s.cloudProviders=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CLOUDPROVIDERS",msg:e.data?JSON.stringify(e.data):e.toString()})}),s.saveGeneral=function(){s.general.enablePrivacyPolicyEmail||(s.general.privacyPolicyEmail=null),s.general.enablePrivacyPolicyNumber||(s.general.privacyPolicyNumber=null),s.general.enablePrivacyPolicyName||(s.general.privacyPolicyName=null),s.general.id?n.setting.update({id:s.general.id},s.general).$promise.then(function(){t.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})}):n.setting.save(s.general).$promise.then(function(e){_.merge(s.general,e),t.success({title:"General updated!",msg:s.general.name?s.general.name+" has been updated!":""})}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsetting",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.onPrivacyPolicyChange=function(e){switch(e){case"email":s.general.enablePrivacyPolicyEmail&&!s.general.privacyPolicyEmail&&(s.general.privacyPolicyEmail=0);break;case"name":s.general.enablePrivacyPolicyName&&!s.general.privacyPolicyName&&(s.general.privacyPolicyName=0);break;case"number":s.general.enablePrivacyPolicyNumber&&!s.general.privacyPolicyNumber&&(s.general.privacyPolicyNumber=0)}}}e.$inject=["generals","api","toasty","license","Auth"],angular.module("app.settings").controller("GeneralsController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l){var d=this;d.license=i||{},d.agents=0,d.users=0,d.telephones=0,d.channels=[{name:"voice",icon:"icon-phone"},{name:"chat",icon:"icon-hangouts"},{name:"mail",icon:"icon-email"},{name:"messaging",icon:"icon-message-text"},{name:"fax",icon:"icon-deskphone"},{name:"openchannel",icon:"icon-google-earth"},{name:"whatsapp",icon:"icon-whatsapp"}],d.modules=[{name:"cm",icon:"icon-account-circle"},{name:"dialer",icon:"icon-crosshairs"},{name:"jscripty",icon:"icon-console"}],d.addons=[{name:"webrtc",icon:"icon-server-plus"},{name:"jaws",icon:"icon-fish"},{name:"custom",icon:"icon-table-edit"},{name:"screenrecording",icon:"icon-video"},{name:"ai",icon:"icon-text-to-speech"}],d.sessions=[{name:"callysquare",icon:"icon-sitemap",restart:!0,label:"channels",enabled:"voice"},{name:"virtual",icon:"icon-dots-horizontal",restart:!1,label:"sessions",enabled:"chat"}],d.others=[{name:"update",icon:"icon-cloud-download"}],d.requestLicense=function(e){t.show({controller:"RequestLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/request/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i,channels:d.channels,modules:d.modules,addons:d.addons,sessions:d.sessions,others:d.others}})},d.updateLicense=function(e){t.show({controller:"UpdateLicenseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/license/update/dialog.html",parent:angular.element(n.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:i}})},d.gotoProcess=function(e){a.go("app.settings.system",{tab:1})},d.alert=s.info,d.downloadLogFile=function(){return o.license.downloadLogFile().$promise.then(function(e){var n=[e.buffer],t=new Blob(n,{type:e.type}),a=window.document.createElement("a");a.setAttribute("href",URL.createObjectURL(t)),a.setAttribute("download","license-info.log"),document.body.appendChild(a),a.click(),s.success({title:l.instant("SETTINGS.LICENSE_LOG_FILE"),msg:l.instant("SETTINGS.LICENSE_LOG_FILE_DOWNLOADED")})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DOWNLOADJSON",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.isAdmin=r.isAdmin(),o.user.get({fields:"id",role:"agent",online:!0}).$promise.then(function(e){return d.agents=e&&e.count?e.count:0,o.user.get({fields:"id",role:"user,admin"}).$promise}).then(function(e){return d.users=e&&e.count?e.count:0,o.user.get({fields:"id",role:"telephone"}).$promise}).then(function(e){d.telephones=e&&e.count?e.count:0}).catch(function(e){console.log(e)})}e.$inject=["$document","$window","$mdDialog","$state","license","toasty","api","Auth","$translate"],angular.module("app.settings.license").controller("LicenseController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(){e.hide()}m.errors=[],m.user=d.getCurrentUser(),m.license=angular.copy(t),m.channels=a,m.modules=i,m.addons=s,m.sessions=o,m.others=r,m.license.name=m.user.fullname,m.license.email=m.user.email,m.sendRequest=function(){for(var e in m.errors=[],m.table="||FIELD||OLD||NEW||\n",m.license)m.license.hasOwnProperty(e)&&!_.includes(["$promise","$resolved"],e)&&(t[e]===m.license[e]?m.table+="|"+e+"|"+(void 0!==t[e]?t[e]:"")+"|"+m.license[e]+"|\n":m.table+="|"+e+"|{color:red}"+(void 0!==t[e]?t[e]:"")+"{color}|*"+m.license[e]+"*|\n");l.jira.save({key:"MOTLICENSE",summary:"Motion License Request",description:m.table,issuetype:"License Request"}).$promise.then(function(e){n.success({title:"Request sent!",msg:c.instant("SETTINGS.LICENSE_REQUEST_SENT"),timeout:15e3}),u()}).catch(function(e){console.error(e),m.errors=[{message:c.instant("SETTINGS.JIRA_ERROR_MESSAGE"),type:"api.jira"}]})},m.closeDialog=u}e.$inject=["$mdDialog","toasty","license","channels","modules","addons","sessions","others","api","Auth","$translate"],angular.module("app.settings.license").controller("RequestLicenseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.errors=[],s.license=angular.copy(t),s.licenseKey,s.updateLicense=function(){return a.license.update({id:1,key:s.licenseKey}).$promise.then(function(e){e&&(e.demo?n.error({title:"License update failed!",msg:"Invalid license key"}):n.success({title:"License properly updated!",msg:"The license has been updated!"}))}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UPDATElicense",msg:e.data?JSON.stringify(e.data):e.toString()})})},s.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","toasty","license","api","$translate"],angular.module("app.settings.license").controller("UpdateLicenseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;function g(e){a.hide(e)}p.currentUser=c.getCurrentUser(),p.errors=[],p.setting=u,p.license=m,p.hasModulePermissions={},p.passwordPattern=p.setting&&p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.title="SETTINGS.EDIT_NETWORK",p.network=angular.copy(l),p.networks=r,p.newNetwork=!1,p.network||(p.network={type:"localnet"},p.title="SETTINGS.NEW_NETWORK",p.newNetwork=!0),p.addNewNetwork=function(){p.errors=[],d.network.save(p.network).$promise.then(function(e){p.networks.unshift(e.toJSON()),o.success({title:"Network properly created",msg:p.network.name?p.network.name+" has been created!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveNetwork=function(){p.errors=[],d.network.update({id:p.network.id},p.network).$promise.then(function(e){var n=_.find(p.networks,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Network properly saved!",msg:p.network.name?p.network.name+" has been saved!":""}),g(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteNetwork=function(e){p.errors=[];var n=a.confirm().title("Are you sure?").content("The network will be deleted.").ariaLabel("Delete Network").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.network.delete({id:p.network.id}).$promise.then(function(){_.remove(p.networks,{id:p.network.id}),o.success({title:"Network properly deleted!",msg:(p.network.name||"network")+" has been deleted!"}),g(p.network)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.network.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.network.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.getDateFromString=function(e){return null===e?void 0:new Date(e)},p.closeDialog=g}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","networks","network","api","Auth","license","setting"],angular.module("app.settings").controller("CreateOrEditNetworkDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g){var v=this;v.license=p,v.setting=g,v.currentUser=u.getCurrentUser(),v.networks=l||{count:0,rows:[]},v.table="networks",v.listOrder="",v.listOrderAsc=null,v.selectedNetworks=[],v.query={fields:"createdAt,updatedAt,id,type,value,username,password",sort:"-updatedAt",limit:10,page:1},v.arraytype=_.keyBy([{option:"LocalNET",value:"'localnet'"},{option:"ExternIP",value:"'externip'"},{option:"Turn",value:"'turn'"},{option:"Stun",value:"'stun'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),v.editdialog=function(e,n){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{network:e,networks:v.networks.rows,license:v.license,setting:null,crudPermissions:v.crudPermissions}})},v.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("network")+"?").htmlContent("<b>"+(e.name||"network")+"</b> will be deleted.").ariaLabel("delete network").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){A(e)},function(){console.log("CANCEL")})},v.success=b,v.getNetworks=function(){v.query.offset=(v.query.page-1)*v.query.limit,u.hasRole("admin")?v.promise=d.network.get(v.query,b).$promise:(v.query.id=v.userProfile.id,v.query.section="Networks",v.promise=d.userProfile.getResources(v.query,b).$promise)},v.createOrEditNetwork=function(e,n){i.show({controller:"CreateOrEditNetworkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/networks/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{network:n,networks:v.networks.rows,license:v.license,setting:v.setting,crudPermissions:v.crudPermissions}})},v.deleteNetwork=A,v.exportSelectedNetworks=function(){var e=angular.copy(v.selectedNetworks);return v.selectedNetworks=[],e},v.deleteSelectedNetworks=function(e){var n=i.confirm().title("Are you sure want to delete the selected networks?").htmlContent("<b>"+v.selectedNetworks.length+" selected</b> will be deleted.").ariaLabel("delete Networks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){v.selectedNetworks.forEach(function(e){A(e)}),v.selectedNetworks=[]})},v.deselectNetworks=function(){v.selectedNetworks=[]},v.selectAllNetworks=function(){v.selectedNetworks=v.networks.rows};var h=!0,f=1;function b(e){v.networks=e||{count:0,rows:[]}}function A(e){d.network.delete({id:e.id}).$promise.then(function(){_.remove(v.networks.rows,{id:e.id}),v.networks.count-=1,v.networks.rows.length||v.getNetworks(),m.success({title:_.startCase("Network")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){v.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEnetwork"}];for(var n=0;n<e.data.errors.length;n++)m.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else m.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEnetwork",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){h?o(function(){h=!1}):(n||(f=v.query.page),e!==n&&(v.query.page=1),e||(v.query.page=f),v.getNetworks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","networks","api","msUtils","toasty","Auth","license","setting"],angular.module("app.settings").controller("NetworksController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;l.currentUser=o.getCurrentUser(),l.license=s,l.providers=r.getEmailProviders(),l.mailAccounts=e||{rows:[],count:0},l.cloudProviders=t||{rows:[],count:0},l.mailAccount={service:!0,Smtp:{}},0<l.mailAccounts.count&&(l.mailAccount=l.mailAccounts.rows[0]),l.originalProvider=l.mailAccount.provider,l.saveSmtp=function(){var e=angular.copy(l.mailAccount);"custom"===e.provider?e.provider=null:(l.originalProvider!==e.provider&&(e.Smtp.modernAuthentication?e.Smtp.pass=null:e.Smtp.CloudProviderId=null),e.Smtp.modernAuthentication||(e.Smtp.CloudProviderId=null),e.Smtp=_.omit(e.Smtp,["host","port","secure","service"]));l.mailAccount.id?a.mailAccount.update({id:l.mailAccount.id},e).$promise.then(function(){l.originalProvider=e.provider,i.success({msg:n.instant("SETTINGS.NOTIFICATIONS.SMTP_SAVED_SUCCESS_TITLE")})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}):a.mailAccount.save(e).$promise.then(function(e){_.merge(l.mailAccount,e),i.success({msg:n.instant("SETTINGS.NOTIFICATIONS.SMTP_SAVED_SUCCESS_TITLE")})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},l.verifySmtp=function(){a.mailAccount.verifySmtp({id:l.mailAccount.id}).$promise.then(function(){i.success({msg:n.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_SUCCESS_TITLE")})}).catch(function(e){i.error({title:n.instant("MAIL.NOTIFICATIONS.SMTP_CONNECTION_FAIL_TITLE"),msg:e.data?JSON.stringify(e.data):e.toString(),timeout:1e4})})},l.onProviderChange=function(){"custom"!==l.mailAccount.provider&&(l.mailAccount.authentication=!0);"outlook365"!==l.mailAccount.provider&&(l.mailAccount.Smtp.modernAuthentication=!1)}}e.$inject=["$translate","mailAccounts","cloudProviders","api","toasty","license","Auth","msUtils"],angular.module("app.settings").controller("SmtpController",e)}(),function(){"use strict";function e(e,i,s,n,t,a,o,r){var l,d=this;d.system=t||{},d.processes=a?a.rows:[],d.processLimit=7,d.selectedTab=n.params.tab||0,d.getInfo=function(){return r.system.get().$promise.then(function(e){_.merge(d.system,e)}).catch(d.cancelInterval)},d.getProcesses=function(){return r.pm2.get().$promise.then(function(e){_.merge(d.processes,e?e.rows:[])}).catch(d.cancelInterval)},d.cancelInterval=function(e){i.cancel(l)},d.updateProcess=function(e,n,t){var a=s.confirm().title("Would you like to change the status of the process #"+n+"?").textContent("The status will be changed to: "+t.toUpperCase()).ariaLabel("Lucky day").targetEvent(e).ok("Ok").cancel("Cancel");s.show(a).then(function(){return r.pm2.update({id:n,status:t})}).then(function(){i(d.getProcesses,1e3,1)}).then(function(){o.success({title:"Process updated!",msg:"Status properly changed to: "+t})})},l=i(d.getInfo,5e3),e.$on("$destroy",function(){d.cancelInterval()})}e.$inject=["$scope","$interval","$mdDialog","$state","system","processes","toasty","api"],angular.module("app.settings.system").controller("SystemController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;s.title="SETTINGS.UPDATE",s.progress=0,s.updating=!0,s.output="Waiting...",s.success=!0,s.interval=n(function(){s.progress<90&&(s.progress+=1)},1e3),s.closeDialog=function(){e.hide()},s.reload=function(){t.location.reload()},s.stopInterval=function(){angular.isDefined(s.interval)&&(n.cancel(s.interval),s.interval=void 0);s.progress=100,s.updating=!1},i.version.fetch().$promise.then(function(e){return s.output=e.output+"...",i.version.reset().$promise}).then(function(e){return s.output=e.output+"...",i.version.pull().$promise}).then(function(e){return s.output=e.output+"...",i.version.migrations().$promise}).then(function(e){return s.output=e.output+"...",i.version.restart().$promise}).then(function(e){s.output="Waiting to restart motion...",a(function(){s.stopInterval()},3e4)}).catch(function(e){s.success=!1,s.stopInterval(),s.output=JSON.stringify(e)})}e.$inject=["$mdDialog","$interval","$window","$timeout","api"],angular.module("app.settings").controller("UpdateDialogController",e)}(),function(){"use strict";function e(t,e,a,n,i){this.version=n||{},this.updateConfirm=function(e){var n=t.confirm().title("Would you like to update your system?").htmlContent('The system request time for the update should be below 1 minute.<br><br>Do you agree the terms of this <a href="http://www.xcally.com/support/eula-xcally-license-en.pdf" target="_blank">End User License Agreement<a>?').ariaLabel("").targetEvent(e).clickOutsideToClose(!0).parent(angular.element(a.body)).ok("I agree").cancel("Disagree");t.show(n).then(function(){t.show({controller:"UpdateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/settings/views/updates/update/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!1})})}}e.$inject=["$mdDialog","$interval","$document","version","toasty"],angular.module("app.settings").controller("UpdatesController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.sms.realtime.agents":this.selectedTab=0;break;case"app.sms.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.sms.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.sms.realtime.agents");break;case 1:t.go("app.sms.realtime.queues");break;default:t.go("app.sms.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.sms").controller("SmsRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSACCOUNT",g.smsAccount=angular.copy(l),g.smsAccounts=r,g.newSmsAccount=!1,g.smsAccount||(g.smsAccount={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),type:"twilio",waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,notificationSound:!0,queueTransferTimeout:300,agentTransferTimeout:300},g.title="SMS.NEW_SMSACCOUNT",g.newSmsAccount=!0),n.params.id&&(g.smsAccount.SmsAccountId=n.params.id),g.addNewSmsAccount=function(){g.errors=[],d.smsAccount.save(g.smsAccount).$promise.then(function(e){g.smsAccounts.unshift(e.toJSON()),o.success({title:"SmsAccount properly created",msg:g.smsAccount.name?g.smsAccount.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsAccount=function(){g.errors=[],d.smsAccount.update({id:g.smsAccount.id},g.smsAccount).$promise.then(function(e){var n=_.find(g.smsAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsAccount properly saved!",msg:g.smsAccount.name?g.smsAccount.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsAccount will be deleted.").ariaLabel("Delete SmsAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.smsAccount.delete({id:g.smsAccount.id}).$promise.then(function(){_.remove(g.smsAccounts,{id:g.smsAccount.id}),o.success({title:"SmsAccount properly deleted!",msg:(g.smsAccount.name||"smsAccount")+" has been deleted!"}),v(g.smsAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.smsAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.smsAccount&&(t=_.find(g.lists,{id:Number(g.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.smsAccount&&(a=_.find(g.lists,{id:Number(g.smsAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsAccounts","smsAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.smsAccountApps.rows.length){var t=r.smsAccountApps.rows[n]?r.smsAccountApps.rows[n]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccountApp:t,smsAccount:r.smsAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.smsAccountApps.rows[n]=e:r.smsAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.smsAccountApps.rows.length;t++,0){var a=r.smsAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.smsAccount.context,a.exten=r.smsAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.smsAccount.addApplications({id:r.smsAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.smsAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.smsAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.smsAccount={},r.smsAccountApps={count:0,rows:[]},r.selectedSmsAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"SmsQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"smsQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:701}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.smsAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getSmsAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.smsAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getSmsAccountApps=function(){r.promise=o.smsAccount.getApplications(r.query,t).$promise},r.editSmsAccountApp=n,r.editInterval=function(e,n){if(r.smsAccountApps.rows.length){var t=r.smsAccountApps.rows[n]?r.smsAccountApps.rows[n]:r.smsAccountApps.rows[0];i.show({controller:"EditSmsAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteSmsAccountApp=function(e){_.remove(r.smsAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedSmsAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedSmsAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedSmsAccountApps.forEach(function(e){_.remove(r.smsAccountApps.rows,{id:e.id})}),r.selectedSmsAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.sms").controller("SmsAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsAccount.getAgents({id:c.smsAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserSmsAccount?"penalty "+e.UserSmsAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.smsAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsAccount.removeAgents({id:c.smsAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsAccount.addAgents({id:c.smsAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","smsAccount","smsAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditSmsAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("sms")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.smsQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.smsQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="SMS.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveSmsAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","smsAccountApp","smsAccount","api","Auth","crudPermissions"],angular.module("app.sms").controller("EditSmsAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"smsAccount",action:"getDispositions",field:"name",params:{id:m.smsAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.smsAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.smsAccountInteractions.rows.length;n+=1){var t=m.smsAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.smsInteraction.get(m.query,p).$promise}function v(e){d.smsInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.smsAccountInteractions.rows,{id:e.id}),m.smsAccountInteractions.count-=1,m.smsAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?(e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""),e.contactInfo=e.Contact.mobile):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.smsAccount={},m.smsAccountInteractions={count:0,rows:[]},m.selectedSmsAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.smsAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.SmsAccountId=m.smsAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.smsInteractionDownload=function(s,e,n){return d.smsInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="sms-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getSmsAccountInteractions=g,m.createOrEditSmsAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:m.smsAccount,interaction:n,interactions:m.smsAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spysmsInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"sms",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"sms.smsAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||SmsAccountId:=$eq["+m.smsAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedSmsAccountInteractions=function(){var e=angular.copy(m.selectedSmsAccountInteractions);return m.selectedSmsAccountInteractions=[],e},m.deleteSmsAccountInteraction=v,m.deleteSelectedSmsAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedSmsAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedSmsAccountInteractions.forEach(function(e){v(e)}),m.selectedSmsAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.smsAccountSmsCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.smsAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.smsAccountSmsCannedAnswers.rows,{id:e.id}),m.smsAccountSmsCannedAnswers.count-=1,m.smsAccountSmsCannedAnswers.rows.length||p(),l.success({title:"SmsCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.smsAccount={},m.smsAccountSmsCannedAnswers={count:0,rows:[]},m.selectedSmsAccountSmsCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.smsAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.SmsAccountId=m.smsAccount.id,m.query.id=m.smsAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the smsCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("smsCannedAnswer #")+e.id||"smsCannedAnswer")+"</b> will be deleted.").ariaLabel("delete smsCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getSmsAccountSmsCannedAnswers=p,m.createOrEditSmsAccountSmsCannedAnswer=function(e,n){o.show({controller:"CreateOrEditSmsCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:m.smsAccount,smsCannedAnswer:n,smsCannedAnswers:m.smsAccountSmsCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedSmsAccountSmsCannedAnswers=function(){var e=angular.copy(m.selectedSmsAccountSmsCannedAnswers);return m.selectedSmsAccountSmsCannedAnswers=[],e},m.deleteSmsAccountSmsCannedAnswer=g,m.deleteSelectedSmsAccountSmsCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected smsCannedAnswers?").htmlContent("<b>"+m.selectedSmsAccountSmsCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete smsCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedSmsAccountSmsCannedAnswers.forEach(function(e){g(e)}),m.selectedSmsAccountSmsCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.sms").controller("SmsAccountSmsCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="SMS.EDIT_SMSCANNEDANSWER",g.smsCannedAnswer=angular.copy(l),g.smsCannedAnswers=r,g.newSmsCannedAnswer=!1,g.smsCannedAnswer||(g.smsCannedAnswer={},g.title="SMS.NEW_SMSCANNEDANSWER",g.newSmsCannedAnswer=!0),n.params.id&&(g.smsCannedAnswer.SmsAccountId=n.params.id),g.addNewSmsCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.smsCannedAnswer).$promise.then(function(e){g.smsCannedAnswers.unshift(e.toJSON()),o.success({title:"SmsCannedAnswer properly created",msg:g.smsCannedAnswer.name?g.smsCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSmsCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.smsCannedAnswer.id},g.smsCannedAnswer).$promise.then(function(e){var n=_.find(g.smsCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"SmsCannedAnswer properly saved!",msg:g.smsCannedAnswer.name?g.smsCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSmsCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The smsCannedAnswer will be deleted.").ariaLabel("Delete SmsCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.smsCannedAnswer.id}).$promise.then(function(){_.remove(g.smsCannedAnswers,{id:g.smsCannedAnswer.id}),o.success({title:"SmsCannedAnswer properly deleted!",msg:(g.smsCannedAnswer.name||"smsCannedAnswer")+" has been deleted!"}),v(g.smsCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","smsCannedAnswers","smsCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.smsAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.smsAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.SmsAccountId=m.smsAccount.id,m.query.id=m.smsAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.smsAccount.id,field:"SmsAccountId",route:"smsAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.sms").controller("SmsAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.smsAccount=c||e.params.smsAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.agentadddialog=function(e,n){t.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:p.smsAccounts?p.smsAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoSmsAccounts=function(){e.go("app.sms.smsAccounts",{},{reload:"app.sms.smsAccounts"})},p.saveSmsAccount=function(){r.smsAccount.update({id:p.smsAccount.id},p.smsAccount).$promise.then(function(){l.success({title:"SmsAccount updated!",msg:p.smsAccount.name?p.smsAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.smsAccount&&(t=_.find(p.lists,{id:Number(p.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.smsAccount&&(a=_.find(p.lists,{id:Number(p.smsAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","smsAccount","userProfile","userProfileSection"],angular.module("app.sms").controller("SmsAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.smsAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="smsAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedSmsAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,token,remote,ListId,type,phone,accountSid,authId,authToken,smsMethod,username,password,baseUrl,apiKey,accountId,applicationId,senderString,deliveryReport,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,description,receiveUrl,deliveryReportUrl,notificationSound,notificationShake,notificationTemplate,queueTransfer,queueTransferTimeout,agentTransfer,agentTransferTimeout",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Skebby",value:"'skebby'"},{option:"Connectel",value:"'connectel'"},{option:"ClickSend",value:"'clicksend'"},{option:"Plivo",value:"'plivo'"},{option:"Infobip",value:"'infobip'"},{option:"Clickatell",value:"'clickatell'"},{option:"Bandwidth",value:"'bandwidth'"},{option:"CSCTelecom",value:"'csc'"},{option:"Intelepeer",value:"'intelepeer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysmsMethod=_.keyBy([{option:"Basic",value:"'SI'"},{option:"Classic",value:"'TI'"},{option:"Classic+",value:"'GP'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.sms.smsAccounts.edit",{id:e.id,smsAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.sms.smsAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"SmsAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsAccount:e,smsAccounts:f.smsAccounts?f.smsAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("smsAccount")+"?").htmlContent("<b>"+(e.name||"smsAccount")+"</b> will be deleted.").ariaLabel("delete smsAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSmsAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.smsAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SmsAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSmsAccount=function(e,n){i.show({controller:"CreateOrEditSmsAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsAccount:n,smsAccounts:f.smsAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSmsAccount=y,f.exportSelectedSmsAccounts=function(){var e=angular.copy(f.selectedSmsAccounts);return f.selectedSmsAccounts=[],e},f.deleteSelectedSmsAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected smsAccounts?").htmlContent("<b>"+f.selectedSmsAccounts.length+" selected</b> will be deleted.").ariaLabel("delete SmsAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSmsAccounts.forEach(function(e){y(e)}),f.selectedSmsAccounts=[]})},f.deselectSmsAccounts=function(){f.selectedSmsAccounts=[]},f.selectAllSmsAccounts=function(){f.selectedSmsAccounts=f.smsAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.smsAccount&&(t=_.find(f.lists,{id:Number(f.smsAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.smsAccount&&(a=_.find(f.lists,{id:Number(f.smsAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.smsAccounts=e||{count:0,rows:[]}}function y(e){m.smsAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.smsAccounts.rows,{id:e.id}),f.smsAccounts.count-=1,f.smsAccounts.rows.length||f.getSmsAccounts(),p.success({title:_.startCase("SmsAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsmsAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSmsAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.sms").controller("SmsAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="SMS.EDIT_SMSQUEUE",r.smsQueue=angular.copy(n),r.smsQueues=e,r.newSmsQueue=!1,r.smsQueue||(r.smsQueue={strategy:"beepall",timeout:10},r.title="SMS.NEW_SMSQUEUE",r.newSmsQueue=!0),r.addNewSmsQueue=function(){r.errors=[],i.smsQueue.save(r.smsQueue).$promise.then(function(e){r.smsQueues.unshift(e.toJSON()),a.success({title:"SmsQueue properly created",msg:r.smsQueue.name?r.smsQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveSmsQueue=function(){r.errors=[],i.smsQueue.update({id:r.smsQueue.id},r.smsQueue).$promise.then(function(e){var n=_.find(r.smsQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"SmsQueue properly saved!",msg:r.smsQueue.name?r.smsQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteSmsQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The smsQueue will be deleted.").ariaLabel("Delete SmsQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.smsQueue.delete({id:r.smsQueue.id}).$promise.then(function(){_.remove(r.smsQueues,{id:r.smsQueue.id}),a.success({title:"SmsQueue properly deleted!",msg:(r.smsQueue.name||"smsQueue")+" has been deleted!"}),l(r.smsQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.smsQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.smsQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","smsQueues","smsQueue","api","Auth","crudPermissions"],angular.module("app.sms").controller("CreateOrEditSmsQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsQueue.getAgents({id:c.smsQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserSmsQueue?"penalty "+e.UserSmsQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.smsQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.removeAgents({id:c.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.addAgents({id:c.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("SMS.ALL_AGENTS"),labelSelected:r.instant("SMS.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","smsQueue","smsQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.smsQueue.getTeams({id:l.smsQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.smsQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("SMS.ALL_TEAMS"),labelSelected:t.instant("SMS.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.removeTeams({id:l.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.smsQueue.addTeams({id:l.smsQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","smsQueue","$translate","Auth","crudPermissions"],angular.module("app.sms").controller("SmsQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.smsQueue=c||e.params.smsQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:u.smsQueues?u.smsQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoSmsQueues=function(){e.go("app.sms.smsQueues",{},{reload:"app.sms.smsQueues"})},u.saveSmsQueue=function(){r.smsQueue.update({id:u.smsQueue.id},u.smsQueue).$promise.then(function(){l.success({title:"SmsQueue updated!",msg:u.smsQueue.name?u.smsQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","smsQueue","userProfileSection"],angular.module("app.sms").controller("SmsQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.smsQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="smsQueues",f.listOrder="",f.listOrderAsc=null,f.selectedSmsQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"sms",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.sms.smsQueues.edit",{id:e.id,smsQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"SmsQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:f.smsQueues?f.smsQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"SmsQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{smsQueue:e,smsQueues:f.smsQueues?f.smsQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("smsQueue")+"?").htmlContent("<b>"+(e.name||"smsQueue")+"</b> will be deleted.").ariaLabel("delete smsQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:710}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.sms.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.sms.realtime.queues",{})}},f.success=E,f.getSmsQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.smsQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="SmsQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSmsQueue=function(e,n){i.show({controller:"CreateOrEditSmsQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/sms/views/smsQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{smsQueue:n,smsQueues:f.smsQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteSmsQueue=y,f.exportSelectedSmsQueues=function(){var e=angular.copy(f.selectedSmsQueues);return f.selectedSmsQueues=[],e},f.deleteSelectedSmsQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected smsQueues?").htmlContent("<b>"+f.selectedSmsQueues.length+" selected</b> will be deleted.").ariaLabel("delete SmsQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSmsQueues.forEach(function(e){y(e)}),f.selectedSmsQueues=[]})},f.deselectSmsQueues=function(){f.selectedSmsQueues=[]},f.selectAllSmsQueues=function(){f.selectedSmsQueues=f.smsQueues.rows};var b=!0,A=1;function E(e){f.smsQueues=e||{count:0,rows:[]}}function y(e){m.smsQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.smsQueues.rows,{id:e.id}),f.smsQueues.count-=1,f.smsQueues.rows.length||f.getSmsQueues(),p.success({title:_.startCase("SmsQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsmsQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsmsQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSmsQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","smsQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.sms").controller("SmsQueuesController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.agents=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,c.hasRole("admin")?g.promise=l.user.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="Agents",g.promise=l.userProfile.getResources(g.query,v).$promise)}function f(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(g.agents.rows,{id:e.id}),g.agents.count-=1,g.agents.rows.length||g.getAgents(),d.success({title:_.startCase("Agent")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=m,g.setting=u,g.currentUser=c.getCurrentUser(),g.agents=s||{count:0,rows:[]},g.userProfile=o,g.userProfileSection=r&&1==r.count?r.rows[0]:null,g.crudPermissions=c.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedAgents=[],g.query={fields:"createdAt,updatedAt,id,role,fullname,name,alias,showWebBar,email,phone,mobile,userpic,password,hotdesk,autointernal,internal,loginInPause,description,dtlscertfile,dtlsprivatekey,wssPort,voicemail,transport,host,nat,type,allow,callerid,context,callgroup,pickupgroup,chanspy,videosupport,extensionMonitor,chatCapacity,mailCapacity,smsCapacity,openchannelCapacity,faxCapacity,whatsappCapacity,phoneBarEnableSettings,phoneBarAutoAnswer,phoneBarAutoAnswerDelay,phoneBarRingInUse,phoneBarEnableRecording,phoneBarEnableDtmfTone,phoneBarDnd,phoneBarUnansweredCallBadge,phoneBarEnableJaws,phoneBarOutboundProxy,phoneBarUnconditional,phoneBarUnconditionalNumber,phoneBarRemoteControl,phoneBarRemoteControlPort,phoneBarExpires,phoneBarListenPort,permissions,allowmessenger,phoneBarPrefixRequired,passwordResetAt,disabled,blocked,phoneBarEnableScreenRecordingByAgent,phoneBarEnableAutomaticScreenRecording,privacyEnabled,downloadAttachments,downloadOmnichannelInteractions,downloadVoiceRecordings,selectRecallMeCampaign,ignorePauseForPreviewCalls,adSsoEnabled,chatAutoanswer,chatAutoanswerDelay",role:"agent",userSetting:!0,sort:"-updatedAt",limit:10,page:1},g.showWebBarOptions=[{option:"Phonebar",value:0},{option:"External",value:1},{option:"WebRTC",value:2}],g.editstate=function(e){n.go("app.staff.agents.edit",{id:e.id,agent:e,crudPermissions:g.crudPermissions})},g.teamadddialog=function(e,n){a.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:g.agents?g.agents.rows:[],crudPermissions:g.crudPermissions}})},g.deleteconfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the "+_.startCase("agent")+"?").htmlContent("<b>"+(e.name||"agent")+"</b> will be deleted.").ariaLabel("delete agent").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){f(e)})},g.success=v,g.getAgents=h,g.createOrEditAgent=function(e,n){a.show({controller:"CreateOrEditAgentDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{agent:n,agents:g.agents.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}})},g.deleteAgent=f,g.exportSelectedAgents=function(){var e=angular.copy(g.selectedAgents);return g.selectedAgents=[],e},g.deleteSelectedAgents=function(e){var n=a.confirm().title("Are you sure want to delete the selected agents?").htmlContent("<b>"+g.selectedAgents.length+" selected</b> will be deleted.").ariaLabel("delete Agents").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){g.selectedAgents.forEach(function(e){f(e)}),g.selectedAgents=[]})},g.deselectAgents=function(){g.selectedAgents=[]},g.selectAllAgents=function(){g.selectedAgents=g.agents.rows};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),g.getAgents())}),p.on("user-setting:update",h),e.$on("$destroy",function(){p.removeListener("user-setting:update",h)})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","agents","userProfile","userProfileSection","api","toasty","Auth","license","setting","socket"],angular.module("app.staff").controller("AgentsController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c){var m=this;function u(){return s.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.agent=e})}function p(e){t.hide(e)}m.currentUser=o.getCurrentUser(),m.errors=[],m.setting=l,m.license=r,m.crudPermissions=d,m.hasModulePermissions={},m.passwordPattern=m.setting&&m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.title="STAFF.EDIT_AGENT",m.agent=angular.copy(i),m.agents=n,m.newAgent=!1,m.agent||(m.agent={role:"agent",showWebBar:"0",autointernal:!0,wssPort:8089,type:"friend",context:"from-sip",phoneBarRemoteControl:!0,phoneBarRemoteControlPort:9888,allowmessenger:!0,downloadAttachments:!0,downloadOmnichannelInteractions:!0,downloadVoiceRecordings:!0},m.title="STAFF.NEW_AGENT",m.newAgent=!0),m.addNewAgent=function(){m.errors=[],s.user.save(m.agent).$promise.then(function(e){m.agents.unshift(e.toJSON()),a.success({title:"Agent properly created",msg:m.agent.name?m.agent.name+" has been created!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveAgent=function(){m.errors=[],s.user.update({id:m.agent.id},m.agent).$promise.then(function(e){var n=_.find(m.agents,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"Agent properly saved!",msg:m.agent.name?m.agent.name+" has been saved!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteAgent=function(e){m.errors=[];var n=t.confirm().title("Are you sure?").content("The agent will be deleted.").ariaLabel("Delete Agent").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){s.user.delete({id:m.agent.id}).$promise.then(function(){_.remove(m.agents,{id:m.agent.id}),a.success({title:"Agent properly deleted!",msg:(m.agent.name||"agent")+" has been deleted!"}),p(m.agent)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.closeDialog=p;var g="user-setting:update:user-"+m.agent.id;c.on(g,u),e.$on("$destroy",function(){c.removeListener(g,u)})}e.$inject=["$scope","$mdDialog","toasty","agents","agent","api","Auth","license","setting","crudPermissions","socket"],angular.module("app.staff").controller("CreateOrEditAgentDialogController",e)}(),function(){"use strict";function e(e,a){var i=this;i.agent={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.agent.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.agent.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.agent=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="api/users/"+i.agent.id+"/avatar",i.agent.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.staff").controller("Agentchange_avatarController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.agent=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.agent.id,newPassword:r.password};r.currentUser.id==r.agent.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"Agent password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.agent.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.agent.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.agentForm.password.$setValidity("oldPasswordMatch",!1):t.agentForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","agent","setting","Auth"],angular.module("app.staff").controller("AgentchangepasswordController",e)}(),function(){"use strict";function e(e,n,i,t,s){var o=this;o.agent={},o.navigation=t.getNavigation(),o.crudPermissions,o.init=function(e,n){o.agent=e,o.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1}},o.onChange=function(n,t){if((t||n).enabled){if(t)t.enabled=!0,o.agent.permissions.push(t.id);else for(var e=0;e<n.children.length;e++)n.children[e].enabled=!0,o.agent.permissions.push(n.children[e].id);n.enabled=!0,o.agent.permissions.push(n.id)}else if(t)t.enabled=!1,_.remove(o.agent.permissions,function(e){return t.id===e}),_.filter(n.children,{enabled:!1}).length===n.children.length&&(n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e}));else{n.enabled=!1,_.remove(o.agent.permissions,function(e){return n.id===e});for(var a=0;a<n.children.length;a++)n.children[a].enabled=!1,_.remove(o.agent.permissions,function(e){return n.children[a].id===e})}return i.user.update({id:o.agent.id,permissions:_.uniq(o.agent.permissions)}).$promise.then(function(){s.success({title:"agent updated!",msg:o.agent.name?o.agent.name+" has been updated!":""})}).catch(function(e){console.error(e)})}}e.$inject=["$document","$mdDialog","api","msNavigationAgentService","toasty"],angular.module("app.staff").controller("AgentPermissionsController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d[c.apiName].get({fields:"id,name,strategy,type",channel:c.channel,type:"voice"===c.channel?c.direction:void 0,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.user.getQueues({id:c.agent.id,fields:"id,name,strategy,type,penalty",nolimit:!0,type:"voice"===c.channel?c.direction:void 0,channel:c.channel}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return"voice"===c.channel&&(n.penalty=void 0!==n&&void 0!==e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"penalty 0"),n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.agent=n,c.crudPermissions=r,c.penalty=0,c.channel=t,c.direction=i,c.apiName=c.channel+"Queue",c.title=s.instant("STAFF.ADD_AGENT_TO_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"type",line3:"voice"===c.channel?"penalty":"",labelAll:s.instant("STAFF.ALL_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),labelSelected:s.instant("STAFF.SELECTED_"+("outbound"===c.direction?"QUEUE_CAMPAIGNS":c.channel.toUpperCase()+"_QUEUES")),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}},c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){var e;switch(c.channel){case"voice":switch(c.direction){case"inbound":e="VoiceQueues";break;case"outbound":e="QueueCampaigns"}break;case"chat":e="ChatQueues";break;case"mail":e="MailQueues";break;case"sms":e="SmsQueues";break;case"openchannel":e="OpenchannelQueues";break;case"fax":e="FaxQueues"}d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:e}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveQueues=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.user.removeQueues({id:c.agent.id,ids:_.map(t,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else if("voice"===c.channel){for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.user.addQueues({id:c.agent.id,ids:_.map(o,"id"),channel:c.channel,penalty:_.trim(s,"penalty ")}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}else d.user.addQueues({id:c.agent.id,ids:_.map(r,"id"),channel:c.channel}).$promise.then(function(){e()}).catch(function(e){n(e)})});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Queues association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:QUEUES_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","agent","channel","direction","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("AgentQueueAddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.user.getTeams({id:l.agent.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.agent=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("STAFF.ALL_TEAMS"),labelSelected:t.instant("STAFF.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.user.removeTeams({id:l.agent.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.user.addTeams({id:l.agent.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","agent","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("AgentteamaddController",e)}(),function(){"use strict";function e(e,n,i,s,t,a,o,r,l,d,c){var m=this;m.currentUser=l.getCurrentUser(),m.license=t,m.setting=a,m.passwordPattern=m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.location=n.protocol()+"://"+n.host(),m.agent=d||e.params.agent||{},m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=l.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.hasModulePermissions={},m.selectedTab=e.params.tab||0,m.queueaddchannel=function(e,n,t,a){i.show({controller:"AgentQueueAddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",parent:angular.element(s.body),targetEvent:t,clickOutsideToClose:!0,locals:{agent:e,agents:m.agents?m.agents.rows:[],channel:n,direction:a||"inbound",crudPermissions:m.crudPermissions}})},m.teamadddialog=function(e,n){i.show({controller:"AgentteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,agents:m.agents?m.agents.rows:[],crudPermissions:m.crudPermissions}})},m.changepassworddialog=function(e,n){i.show({controller:"AgentchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{agent:e,setting:a,agents:m.agents?m.agents.rows:[],crudPermissions:m.crudPermissions}})},m.onEnableScreenRecordingByAgentSelection=function(){["phoneBarEnableAutomaticScreenRecording"].forEach(function(e){m.agent.phoneBarEnableScreenRecordingByAgent&&(m.agent[e]=!m.agent.phoneBarEnableScreenRecordingByAgent)})},m.onEnableAutomaticScreenRecordingSelection=function(){["phoneBarEnableScreenRecordingByAgent"].forEach(function(e){m.agent.phoneBarEnableAutomaticScreenRecording&&(m.agent[e]=!m.agent.phoneBarEnableAutomaticScreenRecording)})},m.alert=r.info,m.gotoAgents=function(){e.go("app.staff.agents",{},{reload:"app.staff.agents"})},m.saveAgent=function(){m.agent=_.omit(m.agent,"userpic"),o.user.update({id:m.agent.id},m.agent).$promise.then(function(){r.success({title:"Agent updated!",msg:m.agent.name?m.agent.name+" has been updated!":""})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.refreshAgent=function(){return o.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.agent=e})},l.hasRole("admin")?o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.contexts,{id:e.resourceId})}),t=null;if(m.agent&&(t=_.find(m.contexts,{name:m.agent.context})),t&&!_.some(n,["id",t.id])){var a=_.find(m.contexts,{id:t.id});a.canSelect=!1,n.push(a)}m.contexts=n}):o.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){m.contexts=e.rows||[]})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","license","setting","api","toasty","Auth","agent","userProfileSection"],angular.module("app.staff").controller("AgentController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_TEAM",g.team=angular.copy(l),g.teams=r,g.newTeam=!1,g.team||(g.team={},g.title="STAFF.NEW_TEAM",g.newTeam=!0),g.addNewTeam=function(){g.errors=[],d.team.save(g.team).$promise.then(function(e){g.teams.unshift(e.toJSON()),o.success({title:"Team properly created",msg:g.team.name?g.team.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTeam=function(){g.errors=[],d.team.update({id:g.team.id},g.team).$promise.then(function(e){var n=_.find(g.teams,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Team properly saved!",msg:g.team.name?g.team.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTeam=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The team will be deleted.").ariaLabel("Delete Team").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.team.delete({id:g.team.id}).$promise.then(function(){_.remove(g.teams,{id:g.team.id}),o.success({title:"Team properly deleted!",msg:(g.team.name||"team")+" has been deleted!"}),v(g.team)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.team.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.team.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","teams","team","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditTeamDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.team.getAgents({id:c.team.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserTeam?"penalty "+e.UserTeam.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.team=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.team.removeAgents({id:c.team.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.team.addAgents({id:c.team.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("STAFF.ALL_AGENTS"),labelSelected:r.instant("STAFF.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","team","teams","realtime","$translate","Auth","crudPermissions"],angular.module("app.staff").controller("TeamagentaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.teams=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="teams",f.listOrder="",f.listOrderAsc=null,f.selectedTeams=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{team:e,teams:f.teams.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"TeamagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{team:e,teams:f.teams?f.teams.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("team")+"?").htmlContent("<b>"+(e.name||"team")+"</b> will be deleted.").ariaLabel("delete team").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTeams=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.team.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Teams",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTeam=function(e,n){i.show({controller:"CreateOrEditTeamDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/teams/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{team:n,teams:f.teams.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTeam=y,f.exportSelectedTeams=function(){var e=angular.copy(f.selectedTeams);return f.selectedTeams=[],e},f.deleteSelectedTeams=function(e){var n=i.confirm().title("Are you sure want to delete the selected teams?").htmlContent("<b>"+f.selectedTeams.length+" selected</b> will be deleted.").ariaLabel("delete Teams").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTeams.forEach(function(e){y(e)}),f.selectedTeams=[]})},f.deselectTeams=function(){f.selectedTeams=[]},f.selectAllTeams=function(){f.selectedTeams=f.teams.rows};var b=!0,A=1;function E(e){f.teams=e||{count:0,rows:[]}}function y(e){m.team.delete({id:e.id}).$promise.then(function(){_.remove(f.teams.rows,{id:e.id}),f.teams.count-=1,f.teams.rows.length||f.getTeams(),p.success({title:_.startCase("Team")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEteam"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEteam",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTeams())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","teams","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("TeamsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_TELEPHONE",g.telephone=angular.copy(l),g.telephones=r,g.newTelephone=!1,g.telephone||(g.telephone={role:"telephone",autointernal:!0,context:"from-sip"},g.title="STAFF.NEW_TELEPHONE",g.newTelephone=!0),g.addNewTelephone=function(){g.errors=[],d.user.save(g.telephone).$promise.then(function(e){g.telephones.unshift(e.toJSON()),o.success({title:"Telephone properly created",msg:g.telephone.name?g.telephone.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTelephone=function(){g.errors=[],d.user.update({id:g.telephone.id},g.telephone).$promise.then(function(e){var n=_.find(g.telephones,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Telephone properly saved!",msg:g.telephone.name?g.telephone.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTelephone=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The telephone will be deleted.").ariaLabel("Delete Telephone").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.user.delete({id:g.telephone.id}).$promise.then(function(){_.remove(g.telephones,{id:g.telephone.id}),o.success({title:"Telephone properly deleted!",msg:(g.telephone.name||"telephone")+" has been deleted!"}),v(g.telephone)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","telephones","telephone","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditTelephoneDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.telephone=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.telephone.id,newPassword:r.password};r.currentUser.id==r.telephone.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"Telephone password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.telephone.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.telephone.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.telephoneForm.password.$setValidity("oldPasswordMatch",!1):t.telephoneForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","telephone","setting","Auth"],angular.module("app.staff").controller("TelephonechangepasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.telephone=c||e.params.telephone||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.changepassworddialog=function(e,n){t.show({controller:"TelephonechangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{telephone:e,setting:o,telephones:u.telephones?u.telephones.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTelephones=function(){e.go("app.staff.telephones",{},{reload:"app.staff.telephones"})},u.saveTelephone=function(){r.user.update({id:u.telephone.id},u.telephone).$promise.then(function(){l.success({title:"Telephone updated!",msg:u.telephone.name?u.telephone.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.telephone&&(t=_.find(u.contexts,{name:u.telephone.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","telephone","userProfileSection"],angular.module("app.staff").controller("TelephoneController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.telephones=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="telephones",f.listOrder="",f.listOrderAsc=null,f.selectedTelephones=[],f.query={fields:"createdAt,updatedAt,id,role,fullname,name,email,password,description,autointernal,internal,voicemail,transport,nat,allow,callerid,context,callgroup,pickupgroup,videosupport,encryption,phone,mobile",role:"telephone",sort:"-updatedAt",limit:10,page:1},f.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.staff.telephones.edit",{id:e.id,telephone:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("telephone")+"?").htmlContent("<b>"+(e.name||"telephone")+"</b> will be deleted.").ariaLabel("delete telephone").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTelephones=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.user.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Telephones",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTelephone=function(e,n){i.show({controller:"CreateOrEditTelephoneDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/telephones/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{telephone:n,telephones:f.telephones.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTelephone=y,f.exportSelectedTelephones=function(){var e=angular.copy(f.selectedTelephones);return f.selectedTelephones=[],e},f.deleteSelectedTelephones=function(e){var n=i.confirm().title("Are you sure want to delete the selected telephones?").htmlContent("<b>"+f.selectedTelephones.length+" selected</b> will be deleted.").ariaLabel("delete Telephones").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTelephones.forEach(function(e){y(e)}),f.selectedTelephones=[]})},f.deselectTelephones=function(){f.selectedTelephones=[]},f.selectAllTelephones=function(){f.selectedTelephones=f.telephones.rows};var b=!0,A=1;function E(e){f.telephones=e||{count:0,rows:[]}}function y(e){m.user.delete({id:e.id}).$promise.then(function(){_.remove(f.telephones.rows,{id:e.id}),f.telephones.count-=1,f.telephones.rows.length||f.getTelephones(),p.success({title:_.startCase("Telephone")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTelephones())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","telephones","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("TelephonesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="STAFF.EDIT_USERPROFILE",g.userProfile=angular.copy(l),g.userProfiles=r,g.newUserProfile=!1,g.userProfile||(g.userProfile={crudPermissions:["r"],downloadAttachments:!0,downloadCallySquareRecordings:!0,downloadContactManagerLists:!0,downloadJscriptySessions:!0,downloadOmnichannelInteractions:!0,downloadScreenRecordings:!0,downloadVoiceRecordings:!0},g.title="STAFF.NEW_USERPROFILE",g.newUserProfile=!0),g.addNewUserProfile=function(){g.errors=[],d.userProfile.save(g.userProfile).$promise.then(function(e){var n,t;t=[],(n=e).crudPermissions.forEach(function(e){var n;switch(e){case"r":n="READ_PERMISSION";break;case"e":n="EDIT_PERMISSION";break;case"d":n="DELETE_PERMISSION"}t.push(s.instant("STAFF."+n))}),n.selectedcrudPermissions=t.join(", "),g.userProfiles.unshift(e.toJSON()),o.success({title:"UserProfile properly created",msg:g.userProfile.name?g.userProfile.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveUserProfile=function(){g.errors=[],d.userProfile.update({id:g.userProfile.id},g.userProfile).$promise.then(function(e){var n=_.find(g.userProfiles,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"UserProfile properly saved!",msg:g.userProfile.name?g.userProfile.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteUserProfile=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The userProfile will be deleted.").ariaLabel("Delete UserProfile").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.userProfile.delete({id:g.userProfile.id}).$promise.then(function(){_.remove(g.userProfiles,{id:g.userProfile.id}),o.success({title:"UserProfile properly deleted!",msg:(g.userProfile.name||"userProfile")+" has been deleted!"}),v(g.userProfile)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","userProfiles","userProfile","api","Auth","license","setting","crudPermissions"],angular.module("app.staff").controller("CreateOrEditUserProfileDialogController",e)}(),function(){"use strict";function e(n,a,i,e,t,s,o){var r=this;function l(e){n.hide(e)}r.newUserProfile=!0,r.userProfile=angular.copy(t),r.userProfiles=s,r.title=o.instant("STAFF.CLONE_USERPROFILE"),t&&t.name&&(r.title+=": "+t.name),r.cloneUserProfile=function(){return e.userProfile.clone({id:t.id},r.userProfile).$promise.then(function(e){var n,t;t=[],(n=e).crudPermissions.forEach(function(e){var n;switch(e){case"r":n="READ_PERMISSION";break;case"e":n="EDIT_PERMISSION";break;case"d":n="DELETE_PERMISSION"}t.push(o.instant("STAFF."+n))}),n.selectedcrudPermissions=t.join(", "),r.userProfiles.unshift(e.toJSON()),i.success({title:"UserProfile properly cloned",msg:r.userProfile.name?r.userProfile.name+" has been cloned!":""}),a.go("app.staff.userProfiles.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.userProfile.clone"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.userProfile.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","userProfile","userProfiles","$translate"],angular.module("app.staff").controller("UserProfilecloneController",e)}(),function(){"use strict";function e(t,o,r,l,d,e,n,c){var m=this;function u(e,n){switch(e.allResourcesEnabled="full"===n,n){case"full":return _.find(m.statusList,["tag","full"]);case"partial":return _.find(m.statusList,["tag","partial"]);case"disabled":return _.find(m.statusList,["tag","disabled"]);case"unlicensed":return _.find(m.statusList,["tag","unlicensed"]);case"unknown":default:return _.find(m.statusList,["tag","unknown"])}}function p(e){return l(function(n,t){var o,a;void 0!==e.channel&&_.includes(e.route,"Queue")?(a=e,l(function(n,t){var e=void 0!==a.channel&&"bull"===a.channel?"outbound":"inbound";return d[a.route].get({fields:"id,name,strategy,type",channel:"bull"===a.channel?"voice":a.channel,type:e,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})).then(function(e){n(e)}).catch(function(e){t(e)}):(o=e,l(function(a,n){switch(o.route){case"voiceExtension":var e;switch(o.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}break;case"interval":var t=!0;break;case"disposition":var i=!0;break;case"user":var s;switch(o.title){case"Agents":s="agent";break;case"Telephones":s="telephone";break;case"Users":s="user"}}if("Reports"===o.title){if(!o.reportType)return d.analyticDefaultReport.get({nolimit:!0}).$promise.then(function(t){d.analyticCustomReport.get({nolimit:!0}).$promise.then(function(e){var n=_.union(t.rows,e.rows);a({count:n.length,rows:n.rows})})}).catch(function(e){n(e)});switch(o.reportType){case"default":o.route="analyticDefaultReport";break;case"custom":o.route="analyticCustomReport"}}return d[o.route].get({role:s||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:t?"null":void 0,MailAccountId:i?"null":void 0,FaxAccountId:i?"null":void 0,SmsAccountId:i?"null":void 0,OpenchannelAccountId:i?"null":void 0,ChatWebsiteId:i?"null":void 0,WhatsappAccountId:i?"null":void 0,ListId:i?"null":void 0,nolimit:!0}).$promise.then(function(e){a(e)}).catch(function(e){n(e)})})).then(function(e){n(e)}).catch(function(e){t(e)})})}function g(e,n,t){var a=e&&0<e.length?e[0]:null;if(!a)return t;var i,s,o=_.find(n,["sectionId",a.id]);return o?(n=_.remove(n,["sectionId",a.id]),(i=a,s=o.id,l(function(n,t){d.userProfileResource.get({sectionId:s}).$promise.then(function(n){return p(i).then(function(e){return _.differenceBy(n.rows,e.rows,"id")})}).then(function(e){_.isEmpty(e)?n():t()}).catch(function(e){t(e)})})).then(function(){return t="full",g(e.shift(),n,t)}).catch(function(e){return l.reject(e)})):void 0}function a(a){var t="Marketplace"===a.title?"AppZone":a.title;m.license?void 0===a.permissions||a.permissions.association?void 0===a.license||m.license[a.license]?d.userProfileSection.get({userProfileId:m.userProfile.id,category:t}).$promise.then(function(e){var n=e&&e.rows&&0<e.rows.length?e.rows:[];if("Dashboards"===a.title)return _.isEmpty(n)?"disabled":n[0].autoAssociation?"full":d.userProfileResource.get({sectionId:n[0].id,resourceId:101}).$promise.then(function(e){return(e&&e.rows?e.rows[0]:null)?"full":"partial"});var t=_.filter(a.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e});return n.length!==t.length?0===n.length?"disabled":"partial":_.every(n,["autoAssociation",!0])?"full":g(_.filter(t,function(e){return void 0===e.permissions||e.permissions.association?e:void 0}),n,"partial")}).then(function(e){a.status=u(a,e)}).catch(function(e){var n=e?"unknown":"partial";a.status=u(a,n),e&&c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GETRESOURCES("+t.toUpperCase()+")",msg:e.status?JSON.stringify(e.data):e.toString()})}):a.status=u(a,"unlicensed"):d.userProfileSection.get({userProfileId:m.userProfile.id,sectionId:a.id}).$promise.then(function(e){var n=(e&&1===e.rows.length?e.rows[0]:null)?"full":"disabled";a.status=u(a,n)}):a.status=u(a,"unknown")}m.userProfile={},m.license={},m.navigation=e.getNavigation(),m.modules=m.navigation[0].children,m.statusList=[{id:0,name:"Fully Enabled",color:"green-A700-bg",info:"All resources enabled",tag:"full"},{id:1,name:"Partially Enabled",color:"orange-A700-bg",info:"Some resources enabled",tag:"partial"},{id:2,name:"Disabled",color:"grey-A400-bg",info:"No resources enabled",tag:"disabled"},{id:3,name:"Unlicensed",color:"red-A700-bg",info:"Module not included in the license",tag:"unlicensed"},{id:4,name:"Unknown",color:"grey-A700-bg",info:"Unknown status",tag:"unknown"}],m.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],m.init=function(e,n){m.userProfile=e,m.license=n},m.onChangeEnableAllResources=function(n){var e=void 0!==n.permissions&&!n.permissions.association,a="Marketplace"===n.title?"AppZone":n.title;if("Fully Enabled"!==n.status.name){var i=[];if(e)return i.push({category:a,sectionId:n.id,name:a,enabled:!0,crudPermissions:"red"}),d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){n.status=u(n,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE_NO_RESOURCES",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})});var t=o.confirm({skipHide:!0}).title("Warning").textContent(r.instant("STAFF.PERMISSIONS_WARNING_ENABLE_ALL",{sectionName:r.instant(n.translate)})).ariaLabel("Warning").ok(r.instant("STAFF.CONFIRM")).cancel(r.instant("STAFF.CANCEL"));o.show(t).then(function(){switch(a){case"Dashboards":_.map(m.dashboardSections,function(e){i.push({category:a,sectionId:e.id,name:e.title,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})});break;default:_.map(n.children,function(e){var n=!(void 0===e.permissions||!e.permissions.hidden);if(!n){var t=e.title;switch(a){case"CallySquare":t="Projects"===t?"SquareProjects":t}i.push({category:a,sectionId:e.id,name:t,enabled:!0,autoAssociation:!0,crudPermissions:_.map(m.userProfile.crudPermissions).join("")})}})}return d.userProfile.addSections({id:m.userProfile.id},i).$promise.then(function(){n.status=u(n,"full"),c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_ENABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})})}).catch(function(e){e?c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()}):n.status=u(n,n.status.tag)})}else if("Fully Enabled"===n.status.name){n.status=u(n,"disabled");var s=[];switch(a){case"Settings":case"Help":s=[n.id];break;case"Dashboards":s=_.map(m.dashboardSections,function(e){return e.id});break;default:s=_.map(n.children,function(e){return e.id})}return d.userProfile.removeSections({id:m.userProfile.id,ids:s}).$promise.then(function(){c.success({title:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_TITLE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name}),msg:r.instant("STAFF.NOTIFICATIONS.PERMISSIONS_DISABLED_ALL_SUCCESS_MESSAGE",{sectionName:r.instant(n.translate),userProfileName:m.userProfile.name})})}).catch(function(e){c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.REMOVESECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})}},m.manageResources=function(e,n){o.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!1,locals:{userProfile:m.userProfile,userProfiles:[],section:e}}).then(function(){a(e)})},m.checkSectionResources=a}e.$inject=["$document","$mdDialog","$translate","$q","api","msNavigationService","Auth","toasty"],angular.module("app.staff").controller("UserProfilePermissionsController",e)}(),function(){"use strict";function e(n,t,i,o,r,e,a,l,s,d){var c=this;function m(){var a=void 0!==c.selectedSection.pending&&c.selectedSection.pending;return i(function(t,n){r.userProfileSection.get({userProfileId:c.userProfile.id,sectionId:c.selectedSection.id}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;a||(c.selectedSection.enabled=!!n&&!!n.enabled,c.selectedSection.autoAssociation=!!n&&!!n.autoAssociation,c.selectedSection.crudPermissions=v(n?n.crudPermissions:c.userProfile.crudPermissions)),t(n)}).catch(function(e){n(e)})})}function u(){return i(function(n,t){c.loadedSection?r.userProfileResource.get({sectionId:c.loadedSection.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)}):n(null)})}function p(){return i(function(n,t){void 0!==c.selectedSection.channel&&_.includes(c.selectedSection.route,"Queue")?i(function(n,t){var e=void 0!==c.selectedSection.channel&&"bull"===c.selectedSection.channel?"outbound":"inbound";return r[c.selectedSection.route].get({fields:"id,name,strategy,type",channel:"bull"===c.selectedSection.channel?"voice":c.selectedSection.channel,type:e,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){n(e)}).catch(function(e){t(e)}):i(function(n,t){var e,a;if("voiceExtension"===c.selectedSection.route)switch(c.selectedSection.title){case"InboundRoutes":e="inbound";break;case"OutboundRoutes":e="outbound";break;case"InternalRoutes":e="internal"}if("user"===c.selectedSection.route)switch(c.selectedSection.title){case"Agents":a="agent";break;case"Telephones":a="telephone";break;case"Users":a="user"}if("interval"===c.selectedSection.route)var i=!0;if("disposition"===c.selectedSection.route)var s=!0;if("Reports"===c.selectedSection.title&&(c.selectedSection.route="default"===c.selectedSection.reportType?"analyticDefaultReport":"analyticCustomReport"),"Dashboards"!==c.selectedSection.title)return r[c.selectedSection.route].get({role:a||void 0,type:e||void 0,VoiceExtensionId:e?"null":void 0,IntervalId:i?"null":void 0,MailAccountId:s?"null":void 0,FaxAccountId:s?"null":void 0,SmsAccountId:s?"null":void 0,OpenchannelAccountId:s?"null":void 0,ChatWebsiteId:s?"null":void 0,WhatsappAccountId:s?"null":void 0,ListId:s?"null":void 0,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)});n({count:1,rows:[{id:101,name:l.instant("DASHBOARDS.GENERAL")}]})}).then(function(e){n(e)}).catch(function(e){t(e)})})}function g(){var i=void 0!==c.selectedSection.pending&&c.selectedSection.pending,s=[];return u().then(function(e){var n;return s=e&&e.rows?e.rows:[],"Reports"===c.selectedSection.title&&(c.associatedReports=c.associatedReports?c.associatedReports:s,n=c.associatedReports,s=_.filter(n,{type:"default"===c.selectedSection.reportType?"DefaultReports":"CustomReports"})),void 0===c.selectedSection.permissions||c.selectedSection.permissions.association?p():{rows:[]}}).then(function(e){c.items=e.rows?_.map(e.rows,function(e){var n,t;return"Reports"===c.selectedSection.title&&(e.fullPath=(n=e.parent,t=c.treeStructure[0].text,t=function e(n,t,a){if(!a||_.isEmpty(a.children))return n;var a=_.find(a.children,function(e){return _.includes(t,e.id)?e:void 0});return n+=a?"/"+a.text:"",e(n,t,a)}(t,n,c.treeStructure[0])).replace(" ","_")),e.isValid=!0,e}):[],i||(c.selectedSection.selectedItems=_.map(s,function(e){return _.find(c.items,{id:e.resourceId})}));var n,t=_.differenceBy(c.selectedSection.selectedItems,c.items,"id");switch(_.isEmpty(t)||(c.selectedSection.selectedItems=_.pullAllBy(c.selectedSection.selectedItems,t,"id")),c.selectedSection.title){case"Contexts":c.selectedSection.selectedItems=_.filter(c.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(s,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"MusicOnHolds":c.selectedSection.selectedItems=_.filter(c.items,function(e){return e.defaultEntry?(e.isValid=!1,e):void 0!==_.find(s,{resourceId:e.id})?(e.isValid=!0,e):void 0});break;case"Reports":var a=(n=c.allReportsSelected,_.filter(n,function(e){return _.startsWith(e.parent,"default"===c.selectedSection.reportType?"motion":"custom")}));c.selectedSection.selectedItems=b(c.selectedSection.selectedItems),c.selectedSection.selectedItems=_.unionBy(c.selectedSection.selectedItems,a,"id")}c.dualMultiselectOptions.selectedItems=c.selectedSection.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.items,c.dualMultiselectOptions.selectedItems,"id")}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+c.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})}function v(e){return e&&(c.selectedSection.allowEdit=!!_.includes(e,"e"),c.selectedSection.allowDelete=!!_.includes(e,"d")),function(){var e=["r"];if(c.selectedSection.allowEdit)e.push("e");else{var n=_.indexOf(e,["e"]);0<n&&c.selectedSection.crudPermissions.replace("e","")}if(c.selectedSection.allowDelete)e.push("d");else{var n=_.indexOf(e,["d"]);0<n&&c.selectedSection.crudPermissions.replace("d","")}return e}()}function h(e){var n=_.findIndex(c.subsections,function(e){return e.id==c.selectedSection.id});c.subsections[n].pending=e,f()}function f(){return c.pendingChanges=_.some(c.subsections,["pending",!0])}function b(e){return _.remove(e,function(e){return _.startsWith(e.parent,"default"===c.selectedSection.reportType?"motion":"custom")})}function A(){_.isEmpty(c.selectedSection.selectedItems)?c.allReportsSelected=_.remove(c.allReportsSelected,function(e){return e.type===("default"===c.selectedSection.reportType?"CustomReports":"DefaultReports")}):c.selectedSection.selectedItems.forEach(function(e){_.some(c.allReportsSelected,{id:e.id,parent:e.parent})||c.allReportsSelected.push(e)})}c.userProfile=e,c.penalty=0,c.section=angular.copy(d),c.title=l.instant("STAFF.PERMISSIONS_SECTION_TITLE",{sectionName:l.instant(c.section.translate)}),c.items=[],c.selectedItems=[],c.subsections=_.filter(c.section.children,function(e){return void 0!==e.permissions&&e.permissions.hidden?void 0:e}),c.dashboardSections=[{title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",id:100}],c.dashboardItems=[],"Dashboards"===c.section.title&&(c.dashboardItems=c.subsections,c.subsections=c.dashboardSections),c.selectedSection=null,c.loadedSection=null,c.allReportsSelected=[],c.closeDialog=function(e){if(c.pendingChanges){var n=t.confirm({skipHide:!0}).title("Warning").textContent(l.instant("STAFF.PERMISSIONS_WARNING_CLOSE")).ariaLabel("Warning").targetEvent(e).ok(l.instant("STAFF.CLOSE")).cancel(l.instant("STAFF.CANCEL"));t.show(n).then(function(){t.hide()})}else t.hide()},c.onChangeSection=function(){return m().then(function(e){if(c.loadedSection=e,"Reports"===c.selectedSection.title)return i(function(n,t){r.analyticTreeReport.get({}).$promise.then(function(e){c.treeReports=e.rows||[],n(c.treeReports)}).catch(function(e){t(e)})}).then(function(){if(!c.selectedSection.reportType)return u().then(function(e){c.allReportsSelected=e?_.map(e.rows,function(e){return{id:e.resourceId,name:e.name,type:e.type}}):[]})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREE_REPORT_STRUCTURE",msg:e.data?JSON.stringify(e.data):e.toString()})});g()}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET"+c.selectedSection.title.toUpperCase(),msg:e.status?JSON.stringify(e.data):e.toString()})})},c.onChangeVisibility=function(){c.selectedSection.enabled=!c.selectedSection.enabled,h(!0)},c.onChangeAutoAssociation=function(){if(!c.selectedSection.autoAssociation){for(var e=[],n=0;n<c.dualMultiselectOptions.items.length;n++)e.push(c.dualMultiselectOptions.items[n]),c.dualMultiselectOptions.selectedItems.push(c.dualMultiselectOptions.items[n]);c.dualMultiselectOptions.items=[],c.dualMultiselectOptions.transferCallback(e,!1)}h(!0)},c.onChangeReportType=function(){c.treeStructure="default"===c.selectedSection.reportType?c.treeReports[0]?angular.fromJson(c.treeReports[0].tree):[]:c.treeReports[1]?angular.fromJson(c.treeReports[1].tree):[],c.selectedSection.selectedItems&&(c.allReportsSelected=b(c.allReportsSelected),A());g()},c.setPermission=function(e){"edit"===e?c.selectedSection.allowEdit=!c.selectedSection.allowEdit:"delete"===e&&(c.selectedSection.allowDelete=!c.selectedSection.allowDelete);c.selectedSection.crudPermissions=v(),h(!0)},c.saveSection=function(){var a="Marketplace"===c.section.title?"AppZone":c.section.title,e=_(c.subsections).filter({pending:!0}).map(function(e){var n="CallySquare"===a&&"Projects"===e.title?"SquareProjects":e.title,t="Reports"===n?c.allReportsSelected:e.selectedItems;return"Integrations"===a&&(e.autoAssociation=!0),{category:a,sectionId:e.id,name:n,enabled:e.enabled,autoAssociation:e.autoAssociation,crudPermissions:_.map(e.crudPermissions).join(""),Resources:_.map(t,function(e){return{name:e.name,resourceId:e.id,type:function(e,n){if("Reports"!==e)return e;{if(n.parent){var t=_.startsWith(n.parent,"motion")?"Default":"Custom";return t+e}return n.type}}(n,e)}})}}).value();return r.userProfile.addSections({id:c.userProfile.id},e).$promise.then(function(){c.subsections.forEach(function(e){e.pending=void 0}),c.associatedReports=null,f(),"Reports"!==c.selectedSection.title||c.selectedSection.reportType||n.userProfileForm.$setPristine(),o.success({title:l.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_TITLE",{sectionName:l.instant(a.translate)}),msg:l.instant("STAFF.NOTIFICATIONS.PERMISSIONS_SAVED_SUCCESS_MESSAGE")})}).then(function(){return m().then(function(e){c.loadedSection=e})}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:USERPROFILE.ADDSECTIONS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",line4:"fullPath",labelAll:l.instant("STAFF.PERMISSIONS_ALL_RESOURCES"),labelSelected:l.instant("STAFF.PERMISSIONS_SELECTED_RESOURCES"),transferCallback:function(e,n){h(!0),n?(c.selectedSection.selectedItems=_.pullAllBy(c.selectedSection.selectedItems,e,"id"),c.selectedSection.autoAssociation=!1):c.selectedSection.selectedItems=_.unionBy(c.selectedSection.selectedItems,e,"id"),"Reports"===c.selectedSection.title&&A()}}}e.$inject=["$scope","$mdDialog","$q","toasty","api","userProfile","userProfiles","$translate","Auth","section"],angular.module("app.staff").controller("UserProfilepermissionsmanageController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.userProfile=c||e.params.userProfile||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.permissionsmanagedialog=function(e,n){t.show({controller:"UserProfilepermissionsmanageController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.clonedialog=function(e,n){t.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:u.userProfiles?u.userProfiles.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoUserProfiles=function(){e.go("app.staff.userProfiles",{},{reload:"app.staff.userProfiles"})},u.saveUserProfile=function(){r.userProfile.update({id:u.userProfile.id},u.userProfile).$promise.then(function(){l.success({title:"UserProfile updated!",msg:u.userProfile.name?u.userProfile.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuserProfile",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","userProfile","userProfileSection"],angular.module("app.staff").controller("UserProfileController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.userProfiles=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="userProfiles",f.listOrder="",f.listOrderAsc=null,f.selectedUserProfiles=[],f.query={fields:"createdAt,updatedAt,id,name,description,crudPermissions,privacyEnabled,downloadAttachments,downloadCallySquareRecordings,downloadContactManagerLists,downloadJscriptySessions,downloadOmnichannelInteractions,downloadScreenRecordings,downloadVoiceRecordings",sort:"-updatedAt",limit:10,page:1},f.arraycrudPermissions=_.keyBy([{option:"Read_permission",value:"'r'",disabled:!0},{option:"Edit_permission",value:"'e'"},{option:"Delete_permission",value:"'d'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.userProfiles&&0<f.userProfiles.count&&f.userProfiles.rows.forEach(function(e){var n=[];e.crudPermissions.forEach(function(e){n.push(f.arraycrudPermissions[e].option)});var t=[];n.forEach(function(e){t.push(r.instant("STAFF."+e.toUpperCase()))}),e.selectedcrudPermissions=t.join(", ")}),f.editstate=function(e,n){t.go("app.staff.userProfiles.edit",{id:e.id,userProfile:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"UserProfilecloneController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{userProfile:e,userProfiles:f.userProfiles?f.userProfiles.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("userProfile")+"?").htmlContent("<b>"+(e.name||"userProfile")+"</b> will be deleted.").ariaLabel("delete userProfile").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getUserProfiles=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.userProfile.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="UserProfiles",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditUserProfile=function(e,n){i.show({controller:"CreateOrEditUserProfileDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/userProfiles/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{userProfile:n,userProfiles:f.userProfiles.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteUserProfile=y,f.exportSelectedUserProfiles=function(){var e=angular.copy(f.selectedUserProfiles);return f.selectedUserProfiles=[],e},f.deleteSelectedUserProfiles=function(e){var n=i.confirm().title("Are you sure want to delete the selected userProfiles?").htmlContent("<b>"+f.selectedUserProfiles.length+" selected</b> will be deleted.").ariaLabel("delete UserProfiles").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedUserProfiles.forEach(function(e){y(e)}),f.selectedUserProfiles=[]})},f.deselectUserProfiles=function(){f.selectedUserProfiles=[]},f.selectAllUserProfiles=function(){f.selectedUserProfiles=f.userProfiles.rows};var b=!0,A=1;function E(e){f.userProfiles=e||{count:0,rows:[]}}function y(e){m.userProfile.delete({id:e.id}).$promise.then(function(){_.remove(f.userProfiles.rows,{id:e.id}),f.userProfiles.count-=1,f.userProfiles.rows.length||f.getUserProfiles(),p.success({title:_.startCase("UserProfile")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuserProfile"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuserProfile",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getUserProfiles())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","userProfiles","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.staff").controller("UserProfilesController",e)}(),function(){"use strict";function e(e,t,a,n,i,s,o,r,l,d,c){var m=this;function u(){return s.user.get({id:m.agent.id,userSetting:!0}).$promise.then(function(e){m.user=e})}function p(e){t.hide(e)}m.currentUser=o.getCurrentUser(),m.errors=[],m.setting=l,m.license=r,m.crudPermissions=d,m.hasModulePermissions={},m.passwordPattern=m.setting&&m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.title="STAFF.EDIT_USER",m.user=angular.copy(i),m.users=n,m.newUser=!1,m.user||(m.user={role:"user",autointernal:!0,context:"from-sip"},m.title="STAFF.NEW_USER",m.newUser=!0),m.addNewUser=function(){m.errors=[],s.user.save(m.user).$promise.then(function(e){m.users.unshift(e.toJSON()),a.success({title:"User properly created",msg:m.user.name?m.user.name+" has been created!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveUser=function(){m.errors=[],s.user.update({id:m.user.id},m.user).$promise.then(function(e){var n=_.find(m.users,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"User properly saved!",msg:m.user.name?m.user.name+" has been saved!":""}),p(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteUser=function(e){if(o.getCurrentUser().id===m.user.id)return a.error({title:"User not deleted!",msg:"You can't remove yourself"});m.errors=[];var n=t.confirm().title("Are you sure?").content("The user will be deleted.").ariaLabel("Delete User").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){s.user.delete({id:m.user.id}).$promise.then(function(){_.remove(m.users,{id:m.user.id}),a.success({title:"User properly deleted!",msg:(m.user.name||"user")+" has been deleted!"}),p(m.user)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.user.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},m.getDateFromString=function(e){return null===e?void 0:new Date(e)},m.closeDialog=p,s.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.userProfiles=e.rows||[]}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var g="user-setting:update:user-"+m.user.id;c.on(g,u),e.$on("$destroy",function(){c.removeListener(g,u)})}e.$inject=["$scope","$mdDialog","toasty","users","user","api","Auth","license","setting","crudPermissions","socket"],angular.module("app.staff").controller("CreateOrEditUserDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i){var s=this;function o(){e.hide()}s.currentUser=i.getCurrentUser(),s.errors=[],s.user=a,s.generateApiKey=function(){s.errors=[],t.user.createApiKey({id:s.user.id}).$promise.then(function(e){s.user.apiKey=e.api_key||"N/A",n.success({title:"User API key updated!"}),o()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.createApiKey",msg:e.data?JSON.stringify(e.data.message):e.toString()}),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.createApiKey"}]})},s.removeApiKey=function(){s.errors=[],t.user.removeApiKey({id:s.user.id}).$promise.then(function(){s.user.apiKey="N/A",n.success({title:"User API key removed!"}),o()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.removeApiKey",msg:e.data?JSON.stringify(e.data.message):e.toString()}),s.errors=e.data.errors||[{message:e.toString(),type:"api.user.removeApiKey"}]})},s.closeDialog=o}e.$inject=["$mdDialog","toasty","api","user","Auth"],angular.module("app.staff").controller("UserapikeymanagerController",e)}(),function(){"use strict";function e(e,a){var i=this;i.user={},i.crudPermissions,i.ngFlowOptions={singleFile:!0,maxChunkRetries:1,chunkSize:8388608,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0},i.ngFlow={flow:{}},i.dropping=!1,i.fileAdded=function(e){var n=["png","jpg"];if(!_.includes(n,e.getExtension()))return a.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(8388608<e.size)return a.error({title:"File too big",msg:"The max allowed size is 8MB"}),!1;var t={id:e.uniqueIdentifier,file:e,type:"uploading"};return i.user.images.unshift(t),!0},i.upload=function(){i.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},i.ngFlow.flow.upload()},i.fileSuccess=function(a,e){angular.forEach(i.user.images,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result},n.type="image"}})},i.init=function(e,n){i.user=angular.copy(e),i.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},i.ngFlowOptions.target="api/users/"+i.user.id+"/avatar",i.user.images=[]}}e.$inject=["$cookies","toasty"],angular.module("app.staff").controller("Userchange_avatarController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.currentUser=o.getCurrentUser(),r.errors=[],r.setting=s,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.user=i,r.password="",r.oldPassword="",r.savePassword=function(){r.errors=[];var e={id:r.user.id,newPassword:r.password};r.currentUser.id==r.user.id&&(e.oldPassword=r.oldPassword);a.user.changePassword(e).$promise.then(function(){n.success({title:"User password properly updated!"}),l()}).catch(function(e){n.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.user.save",msg:e.data?JSON.stringify(e.data.message):e.toString()}),r.errors=e.data.errors||[{message:e.toString(),type:"api.user.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.userForm.password.$setValidity("oldPasswordMatch",!1):t.userForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","toasty","api","user","setting","Auth"],angular.module("app.staff").controller("UserchangepasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;m.currentUser=l.getCurrentUser(),m.license=i,m.setting=s,m.passwordPattern=m.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",m.location=n.protocol()+"://"+n.host(),m.user=d||e.params.user||{},m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=l.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.hasModulePermissions={},m.selectedTab=e.params.tab||0,m.apikeymanagerdialog=function(e,n){t.show({controller:"UserapikeymanagerController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{user:e,users:m.users?m.users.rows:[],crudPermissions:m.crudPermissions}})},m.changepassworddialog=function(e,n){t.show({controller:"UserchangepasswordController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/edit/changepassword/changepassword.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{user:e,setting:s,users:m.users?m.users.rows:[],crudPermissions:m.crudPermissions}})},m.alert=r.info,m.gotoUsers=function(){e.go("app.staff.users",{},{reload:"app.staff.users"})},m.saveUser=function(){m.user=_.omit(m.user,"userpic"),o.user.update({id:m.user.id},m.user).$promise.then(function(){r.success({title:"User updated!",msg:m.user.name?m.user.name+" has been updated!":""})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETuser",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.refreshUser=function(){return o.user.get({id:m.user.id,userSetting:!0}).$promise.then(function(e){m.user=e})},o.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.contexts=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){m.userProfiles=e.rows||[]}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})}),o.user.getApiKey({id:m.user.id}).$promise.then(function(e){m.user.apiKey=e.api_key?e.api_key:"N/A"}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_APIKEY",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","license","setting","api","toasty","Auth","user","userProfileSection"],angular.module("app.staff").controller("UserController",e)}(),function(){"use strict";function e(e,t,a,i,s,n,o,r,l,d,c,m,u,p){var g=this;g.license=m,g.setting=u,g.currentUser=c.getCurrentUser(),g.users=n||{count:0,rows:[]},g.userProfile=o,g.userProfileSection=r&&1==r.count?r.rows[0]:null,g.crudPermissions=c.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.table="users",g.listOrder="",g.listOrderAsc=null,g.selectedUsers=[],g.query={fields:"createdAt,updatedAt,role,userProfileId,id,fullname,name,email,phone,mobile,userpic,password,description,autointernal,internal,transport,nat,allow,context,callgroup,pickupgroup,passwordResetAt,apiKey,videosupport,disabled,blocked,adSsoEnabled",role:"admin,user",userSetting:!0,sort:"-updatedAt",limit:10,page:1},g.arrayrole=_.keyBy([{option:"Admin",value:"'admin'"},{option:"User",value:"'user'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),g.editstate=function(e,n){t.go("app.staff.users.edit",{id:e.id,user:e,crudPermissions:g.crudPermissions})},g.deleteconfirm=function(e,n){var t=a.confirm().title("Are you sure want to delete the "+_.startCase("user")+"?").htmlContent("<b>"+(e.name||"user")+"</b> will be deleted.").ariaLabel("delete user").targetEvent(n).ok("OK").cancel("CANCEL");a.show(t).then(function(){A(e)},function(){console.log("CANCEL")})},g.success=f,g.getUsers=b,g.createOrEditUser=function(e,n){a.show({controller:"CreateOrEditUserDialogController",controllerAs:"vm",templateUrl:"app/main/apps/staff/views/users/create/dialog.html",parent:angular.element(i.body),targetEvent:e,clickOutsideToClose:!0,locals:{user:n,users:g.users.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}})},g.deleteUser=A,g.exportSelectedUsers=function(){var e=angular.copy(g.selectedUsers);return g.selectedUsers=[],e},g.deleteSelectedUsers=function(e){var n=a.confirm().title("Are you sure want to delete the selected users?").htmlContent("<b>"+g.selectedUsers.length+" selected</b> will be deleted.").ariaLabel("delete Users").targetEvent(e).ok("OK").cancel("CANCEL");a.show(n).then(function(){g.selectedUsers.forEach(function(e){A(e)}),g.selectedUsers=[]})},g.deselectUsers=function(){g.selectedUsers=[]},g.selectAllUsers=function(){g.selectedUsers=g.users.rows},l.userProfile.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.userProfiles=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERPROFILES",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=!0,h=1;function f(e){g.users=e||{count:0,rows:[]}}function b(){g.query.offset=(g.query.page-1)*g.query.limit,c.hasRole("admin")?g.promise=l.user.get(g.query,f).$promise:(g.query.id=g.userProfile.id,g.query.section="Users",g.promise=l.userProfile.getResources(g.query,f).$promise)}function A(e){l.user.delete({id:e.id}).$promise.then(function(){_.remove(g.users.rows,{id:e.id}),g.users.count-=1,g.users.rows.length||g.getUsers(),d.success({title:_.startCase("User")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEuser"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEuser",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){v?s(function(){v=!1}):(n||(h=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=h),g.getUsers())}),p.on("user-setting:update",b),e.$on("$destroy",function(){p.removeListener("user-setting:update",b)})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","users","userProfile","userProfileSection","api","toasty","Auth","license","setting","socket"],angular.module("app.staff").controller("UsersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.cannedAnswers=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="cannedAnswers",f.listOrder="",f.listOrderAsc=null,f.selectedCannedAnswers=[],f.query={fields:"createdAt,updatedAt,id,key,value,description",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{cannedAnswer:e,cannedAnswers:f.cannedAnswers.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("cannedAnswer")+"?").htmlContent("<b>"+(e.name||"cannedAnswer")+"</b> will be deleted.").ariaLabel("delete cannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCannedAnswers=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.cannedAnswer.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="CannedAnswers",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCannedAnswer=function(e,n){i.show({controller:"CreateOrEditCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/cannedAnswers/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{cannedAnswer:n,cannedAnswers:f.cannedAnswers.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCannedAnswer=y,f.exportSelectedCannedAnswers=function(){var e=angular.copy(f.selectedCannedAnswers);return f.selectedCannedAnswers=[],e},f.deleteSelectedCannedAnswers=function(e){var n=i.confirm().title("Are you sure want to delete the selected cannedAnswers?").htmlContent("<b>"+f.selectedCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete CannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCannedAnswers.forEach(function(e){y(e)}),f.selectedCannedAnswers=[]})},f.deselectCannedAnswers=function(){f.selectedCannedAnswers=[]},f.selectAllCannedAnswers=function(){f.selectedCannedAnswers=f.cannedAnswers.rows};var b=!0,A=1;function E(e){f.cannedAnswers=e||{count:0,rows:[]}}function y(e){m.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(f.cannedAnswers.rows,{id:e.id}),f.cannedAnswers.count-=1,f.cannedAnswers.rows.length||f.getCannedAnswers(),p.success({title:_.startCase("CannedAnswer")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcannedAnswer"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcannedAnswer",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCannedAnswers())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","cannedAnswers","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("CannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CANNEDANSWER",g.cannedAnswer=angular.copy(l),g.cannedAnswers=r,g.newCannedAnswer=!1,g.cannedAnswer||(g.cannedAnswer={},g.title="TOOLS.NEW_CANNEDANSWER",g.newCannedAnswer=!0),g.addNewCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.cannedAnswer).$promise.then(function(e){g.cannedAnswers.unshift(e.toJSON()),o.success({title:"CannedAnswer properly created",msg:g.cannedAnswer.name?g.cannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.cannedAnswer.id},g.cannedAnswer).$promise.then(function(e){var n=_.find(g.cannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CannedAnswer properly saved!",msg:g.cannedAnswer.name?g.cannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The cannedAnswer will be deleted.").ariaLabel("Delete CannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.cannedAnswer.id}).$promise.then(function(){_.remove(g.cannedAnswers,{id:g.cannedAnswer.id}),o.success({title:"CannedAnswer properly deleted!",msg:(g.cannedAnswer.name||"cannedAnswer")+" has been deleted!"}),v(g.cannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","cannedAnswers","cannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.contact_item_types=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="contact_item_types",f.listOrder="",f.listOrderAsc=null,f.selectedContactItemType=[],f.query={fields:"createdAt,updatedAt,id,name,OrderBy,rgbBackgroundColor",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditContactItemTypeDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/contact_item_types/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{contactItemType:e,contact_item_types:f.contact_item_types.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("contactItemType")+"?").htmlContent("<b>"+(e.name||"contactItemType")+"</b> will be deleted.").ariaLabel("delete contactItemType").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getContactItemType=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.contactItemType.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ContactItemType",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditContactItemType=function(e,n){i.show({controller:"CreateOrEditContactItemTypeDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/contact_item_types/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{contactItemType:n,contact_item_types:f.contact_item_types.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteContactItemType=y,f.exportSelectedContactItemType=function(){var e=angular.copy(f.selectedContactItemType);return f.selectedContactItemType=[],e},f.deleteSelectedContactItemType=function(e){var n=i.confirm().title("Are you sure want to delete the selected contact_item_types?").htmlContent("<b>"+f.selectedContactItemType.length+" selected</b> will be deleted.").ariaLabel("delete ContactItemTypes").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedContactItemType.forEach(function(e){y(e)}),f.selectedContactItemType=[]})},f.deselectContactItemType=function(){f.selectedContactItemType=[]},f.selectAllContactItemType=function(){f.selectedContactItemType=f.contact_item_types.rows};var b=!0,A=1;function E(e){f.contact_item_types=e||{count:0,rows:[]}}function y(e){m.contactItemType.delete({id:e.id}).$promise.then(function(){_.remove(f.contact_item_types.rows,{id:e.id}),f.contact_item_types.count-=1,f.contact_item_types.rows.length||f.getContactItemType(),p.success({title:_.startCase("ContactItemType")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEcontactItemType"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEcontactItemType",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getContactItemType())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contact_item_types","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("ContactItemTypesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CONTACTITEMTYPE",g.contactItemType=angular.copy(l),g.contact_item_types=r,g.newContactItemType=!1,g.contactItemType||(g.contactItemType={rgbBackgroundColor:"#2196f3"},g.title="TOOLS.NEW_CONTACTITEMTYPE",g.newContactItemType=!0),g.addNewContactItemType=function(){g.errors=[],d.contactItemType.save(g.contactItemType).$promise.then(function(e){g.contact_item_types.unshift(e.toJSON()),o.success({title:"ContactItemType properly created",msg:g.contactItemType.name?g.contactItemType.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveContactItemType=function(){g.errors=[],isNaN(g.contactItemType.OrderBy)?alert(s.instant("TOOLS.ORDER_BY_NUMERIC")):d.contactItemType.update({id:g.contactItemType.id},g.contactItemType).$promise.then(function(e){var n=_.find(g.contact_item_types,{id:e.id});n&&_.merge(n,_.pick(e.toJSON(),_.keys(n))),o.success({title:"ContactItemType properly saved!",msg:g.contactItemType.name?g.contactItemType.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteContactItemType=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The contactItemType will be deleted.").ariaLabel("Delete ContactItemType").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.contactItemType.delete({id:g.contactItemType.id}).$promise.then(function(){_.remove(g.contact_item_types,{id:g.contactItemType.id}),o.success({title:"ContactItemType properly deleted!",msg:(g.contactItemType.name||"contactItemType")+" has been deleted!"}),v(g.contactItemType)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.contactItemType.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.contactItemType.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","contact_item_types","contactItemType","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditContactItemTypeDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_CUSTOMDASHBOARD",g.customDashboard=angular.copy(l),g.customDashboards=r,g.newCustomDashboard=!1,g.customDashboard||(g.customDashboard={},g.title="TOOLS.NEW_CUSTOMDASHBOARD",g.newCustomDashboard=!0),g.addNewCustomDashboard=function(){g.errors=[],d.dashboard.save(g.customDashboard).$promise.then(function(e){g.customDashboards.unshift(e.toJSON()),o.success({title:"CustomDashboard properly created",msg:g.customDashboard.name?g.customDashboard.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveCustomDashboard=function(){g.errors=[],d.dashboard.update({id:g.customDashboard.id},g.customDashboard).$promise.then(function(e){var n=_.find(g.customDashboards,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"CustomDashboard properly saved!",msg:g.customDashboard.name?g.customDashboard.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteCustomDashboard=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The customDashboard will be deleted.").ariaLabel("Delete CustomDashboard").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.dashboard.delete({id:g.customDashboard.id}).$promise.then(function(){_.remove(g.customDashboards,{id:g.customDashboard.id}),o.success({title:"CustomDashboard properly deleted!",msg:(g.customDashboard.name||"customDashboard")+" has been deleted!"}),v(g.customDashboard)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","customDashboards","customDashboard","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditCustomDashboardDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.customDashboards=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="customDashboards",f.listOrder="",f.listOrderAsc=null,f.selectedCustomDashboards=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editstate=function(e,n){t.go("app.tools.customDashboards.edit",{id:e.id,customDashboard:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:f.customDashboards?f.customDashboards.rows:[],crudPermissions:f.crudPermissions}})},f.gotodashboardgoto=function(e,n){t.go("app.dashboards.custom",{id:e.id})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("customDashboard")+"?").htmlContent("<b>"+(e.name||"customDashboard")+"</b> will be deleted.").ariaLabel("delete customDashboard").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getCustomDashboards=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.dashboard.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="CustomDashboards",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditCustomDashboard=function(e,n){i.show({controller:"CreateOrEditCustomDashboardDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{customDashboard:n,customDashboards:f.customDashboards.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteCustomDashboard=y,f.exportSelectedCustomDashboards=function(){var e=angular.copy(f.selectedCustomDashboards);return f.selectedCustomDashboards=[],e},f.deleteSelectedCustomDashboards=function(e){var n=i.confirm().title("Are you sure want to delete the selected customDashboards?").htmlContent("<b>"+f.selectedCustomDashboards.length+" selected</b> will be deleted.").ariaLabel("delete CustomDashboards").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedCustomDashboards.forEach(function(e){y(e)}),f.selectedCustomDashboards=[]})},f.deselectCustomDashboards=function(){f.selectedCustomDashboards=[]},f.selectAllCustomDashboards=function(){f.selectedCustomDashboards=f.customDashboards.rows};var b=!0,A=1;function E(e){f.customDashboards=e||{count:0,rows:[]}}function y(e){m.dashboard.delete({id:e.id}).$promise.then(function(){_.remove(f.customDashboards.rows,{id:e.id}),f.customDashboards.count-=1,f.customDashboards.rows.length||f.getCustomDashboards(),p.success({title:_.startCase("CustomDashboard")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdashboard"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdashboard",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getCustomDashboards())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","customDashboards","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("CustomDashboardsController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newCustomDashboard=!0,r.customDashboard=angular.copy(i),r.customDashboards=s,r.title=o.instant("TOOLS.CLONE_CUSTOMDASHBOARD"),i&&i.name&&(r.title+=": "+i.name),r.cloneCustomDashboard=function(){return e.dashboard.clone({id:i.id,includeAll:!0},r.customDashboard).$promise.then(function(e){r.customDashboards.unshift(e.toJSON()),a.success({title:"CustomDashboard properly cloned",msg:r.customDashboard.name?r.customDashboard.name+" has been cloned!":""}),t.go("app.tools.customDashboards.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.dashboard.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboard.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","customDashboard","customDashboards","$translate"],angular.module("app.tools").controller("CustomDashboardcloneController",e)}(),function(){"use strict";function e(t,a,i,s,o){var r=this;r.customDashboard={};var l=[];function d(e,n,t){return o.dashboardItem.update(t).$promise.catch(function(e){console.error(e)})}r.init=function(e,n){return r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.customDashboard=e,r.customDashboard.draggable={enabled:!0,handle:".draggable",stop:d},r.customDashboard.resizable={enabled:!0,handle:".resizable",stop:d},r.customDashboard.widgets=[],r.customDashboard.crudPermissions=r.crudPermissions,l.push(i(function(e){e(r.voiceQueues=o.rpc.getVoiceQueues({fields:"id,name"}))})),l.push(i(function(n){o.chatWebsite.get({fields:"id,name"}).$promise.then(function(e){r.chatWebsites=e||{count:0,rows:[]},n(r.chatWebsites)})})),l.push(i(function(n){o.faxAccount.get({fields:"id,name"}).$promise.then(function(e){r.faxAccounts=e||{count:0,rows:[]},n(r.faxAccounts)})})),l.push(i(function(n){o.mailAccount.get({fields:"id,name"}).$promise.then(function(e){r.mailAccounts=e||{count:0,rows:[]},n(r.mailAccounts)})})),l.push(i(function(n){o.openchannelAccount.get({fields:"id,name"}).$promise.then(function(e){r.openchannelAccounts=e||{count:0,rows:[]},n(r.openchannelAccounts)})})),l.push(i(function(n){o.whatsappAccount.get({fields:"id,name"}).$promise.then(function(e){r.whatsappAccounts=e||{count:0,rows:[]},n(r.whatsappAccounts)})})),l.push(i(function(n){o.smsAccount.get({fields:"id,name"}).$promise.then(function(e){r.smsAccounts=e||{count:0,rows:[]},n(r.smsAccounts)})})),i.all(l).then(function(){return o.dashboard.getItems({id:e.id}).$promise.then(function(e){if(e&&e.count&&e.rows)for(var n=0;n<e.rows.length;n+=1)e.rows[n].voiceQueues=r.voiceQueues,e.rows[n].voiceQueuesSelected=_.map(r.voiceQueues.rows,"id"),e.rows[n].smsAccounts=r.smsAccounts,e.rows[n].smsAccountsSelected=_.map(r.smsAccounts.rows,"id"),e.rows[n].faxAccounts=r.faxAccounts,e.rows[n].faxAccountsSelected=_.map(r.faxAccounts.rows,"id"),e.rows[n].mailAccounts=r.mailAccounts,e.rows[n].mailAccountsSelected=_.map(r.mailAccounts.rows,"id"),e.rows[n].openchannelAccounts=r.openchannelAccounts,e.rows[n].openchannelAccountsSelected=_.map(r.openchannelAccounts.rows,"id"),e.rows[n].chatWebsites=r.chatWebsites,e.rows[n].chatWebsitesSelected=_.map(r.chatWebsites.rows,"id"),e.rows[n].whatsappAccounts=r.whatsappAccounts,e.rows[n].whatsappAccountsSelected=_.map(r.whatsappAccounts.rows,"id"),e.rows[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+e.rows[n].type+"/ms-widget-engine."+e.rows[n].type+".html",r.customDashboard.widgets.push(e.rows[n])}).catch(function(e){console.error(e)})})},r.createOrEditWidget=function(e){if(e&&e.attrs)for(var n=0;n<e.attrs.length;n+=1)"attrReport"===e.attrs[n].name&&(e.reportType=e.attrs[n].type),e[e.attrs[n].name]=e.attrs[n].value;t.show({controller:"CreateOrEditDashboardItemDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",parent:angular.element(a.body),clickOutsideToClose:!0,locals:{dashboarditem:e,dashboard:r.customDashboard.widgets,license:null,setting:null,crudPermissions:r.crudPermissions}}).then(function(e){if(e)for(var n=0;n<r.customDashboard.widgets.length;n+=1)r.customDashboard.widgets[n].id===e.id&&(r.customDashboard.widgets[n].attrs=e.attrs,r.customDashboard.widgets[n].voiceQueues=r.voiceQueues,r.customDashboard.widgets[n].voiceQueuesSelected=_.map(r.voiceQueues.rows,"id"),r.customDashboard.widgets[n].smsAccounts=r.smsAccounts,r.customDashboard.widgets[n].smsAccountsSelected=_.map(r.smsAccounts.rows,"id"),r.customDashboard.widgets[n].faxAccounts=r.faxAccounts,r.customDashboard.widgets[n].faxAccountsSelected=_.map(r.faxAccounts.rows,"id"),r.customDashboard.widgets[n].mailAccounts=r.mailAccounts,r.customDashboard.widgets[n].mailAccountsSelected=_.map(r.mailAccounts.rows,"id"),r.customDashboard.widgets[n].openchannelAccounts=r.openchannelAccounts,r.customDashboard.widgets[n].openchannelAccountsSelected=_.map(r.openchannelAccounts.rows,"id"),r.customDashboard.widgets[n].chatWebsites=r.chatWebsites,r.customDashboard.widgets[n].chatWebsitesSelected=_.map(r.chatWebsites.rows,"id"),r.customDashboard.widgets[n].whatsappAccounts=r.whatsappAccounts,r.customDashboard.widgets[n].whatsappAccountsSelected=_.map(r.whatsappAccounts.rows,"id"),r.customDashboard.widgets[n].templateUrl="app/core/directives/ms-widget-engine/ms-widget-engine-"+r.customDashboard.widgets[n].type+"/ms-widget-engine."+r.customDashboard.widgets[n].type+".html")})},r.deleteWidget=function(n){var e=t.confirm().title("Would you like to delete "+n.title+"?").textContent("").ariaLabel("Delete Widget").ok("YES").cancel("NO");t.show(e).then(function(){return o.dashboardItem.delete({id:n.id}).$promise.then(function(e){_.remove(r.customDashboard.widgets,{id:n.id}),s.success({title:"Widget deleted!",msg:n.name?n.name+" has been deleted!":"Widget has been deleted!"})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETE.customDashboard"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdashboard",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()});console.error(e)})})}}e.$inject=["$mdDialog","$document","$q","toasty","api"],angular.module("app.tools").controller("CustomDashboardItemsController",e)}(),function(){"use strict";function e(n,e,t,a,o,i,s,r,l,d,c,m,u,p){var g=this;g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_DASHBOARDITEM",g.dashboarditem=angular.copy(l),g.dashboard=r,g.newDashboardItem=!1,g.selectedReport=[],g.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},g.dashboarditem?"web-report"==g.dashboarditem.type&&(g.apiName="custom"===g.dashboarditem.reportType?"analyticCustomReport":"analyticDefaultReport",d[g.apiName].get({fields:"id,name,parent"}).$promise.then(function(e){g.currentReport=_.find(e.rows,{id:g.dashboarditem.attrReport}),g.dashboarditem.report=g.currentReport.name,g.query.parent=g.currentReport.parent})):(g.dashboarditem={type:"counter",attrChannel:"voice",titleFontSize:12,attrUrl:"https://",attrHourFormat:"HH:mm:ss",attrTimezone:"0.00",attrMetric:"total",attrSerie1:"total",attrSerie2:"null",attrSerie3:"null",attrRefresh:10,attrFontSize:20,foreground:"#2196f3",background:"#ffffff"},g.title="TOOLS.NEW_DASHBOARDITEM",g.newDashboardItem=!0),g.addNewDashboardItem=function(){g.errors=[],d.dashboard.addItem({id:e.params.id},g.dashboarditem).$promise.then(function(e){g.dashboard.unshift(e.toJSON()),s.success({title:"DashboardItem properly created",msg:g.dashboarditem.name?g.dashboarditem.name+" has been created!":""}),I(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.save"}];for(var n=0;n<e.data.errors.length;n+=1)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveDashboardItem=function(){g.errors=[],d.dashboardItem.update({id:g.dashboarditem.id},g.dashboarditem).$promise.then(function(e){var n=_.find(g.dashboard,{id:e.id});n&&_.merge(n,e.toJSON()),s.success({title:"DashboardItem properly saved!",msg:g.dashboarditem.name?g.dashboarditem.name+" has been saved!":""}),I(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.update"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteDashboardItem=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The dashboarditem will be deleted.").ariaLabel("Delete DashboardItem").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.dashboardItem.delete({id:g.dashboarditem.id}).$promise.then(function(){_.remove(g.dashboard,{id:g.dashboarditem.id}),s.success({title:"DashboardItem properly deleted!",msg:(g.dashboarditem.name||"dashboarditem")+" has been deleted!"}),I(g.dashboarditem)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.dashboardItem.delete"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.dashboardItem.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.getReports=S,g.selectReport=function(){if(g.dashboarditem.report=g.selectedReport[0].name,g.dashboarditem.attrReport=g.selectedReport[0].id,g.dashboarditem.reportType=g.currentNode.custom?"custom":"default",!g.newDashboardItem){var e={name:"attrReport",type:g.dashboarditem.reportType,value:g.selectedReport[0].id};g.dashboarditem.attrs.splice(_.findIndex(g.dashboarditem.attrs,1,e))}n.dashboarditemForm.report.$setDirty(),a.hide()},g.closeReportDialog=function(){a.hide()},g.onTypeChange=function(){["web-report","iframe","clock","custom"].includes(g.dashboarditem.type)&&(g.dashboarditem.attrEmailAccounts=null,g.dashboarditem.attrFaxAccounts=null,g.dashboarditem.attrSmsAccounts=null,g.dashboarditem.attrOpenchannelAccounts=null,g.dashboarditem.attrWhatsappAccounts=null,g.dashboarditem.attrChatWebsites=null)},g.searchReport=function(){g.treeDefaultData=g.treeReports[0]?angular.fromJson(g.treeReports[0].tree):[],g.treeCustomData=g.treeReports[1]?angular.fromJson(g.treeReports[1].tree):[],g.treeConfig=(n={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},"admin"!==g.currentUser.role?d.userProfileSection.get({fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:g.currentUser.userProfileId,sectionId:1203}).$promise.then(function(e){return g.userProfileSection=e&&1==e.count?e.rows[0]:null,n}).catch(function(e){s.error({title:"ERROR",msg:e.message})}):n),g.treeDefaultEvents=f(!1),g.treeCustomEvents=f(!0),a.show({controller:function(){return g},controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/partialViews/reports/treeReports.html",autoWrap:!0,skipHide:!0});var n},g.closeDialog=I,d.analyticTreeReport.get({}).$promise.then(function(e){g.treeReports=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})});var v=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],h=null;function f(e){return e?{loaded:E,select_node:b}:{loaded:y,select_node:A}}function b(e,n){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=n.node.id,S()}function A(e,n){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=n.node.id,S()}function E(){if(!g.newDashboardItem&&"analyticCustomReport"===g.apiName){var e=g.treeCustomInstance.jstree(!0).get_node(g.query.parent);b(0,{node:e,selected:e.id})}}function y(){if(!g.newDashboardItem&&"analyticDefaultReport"===g.apiName){var e=g.treeDefaultInstance.jstree(!0).get_node(g.query.parent);A(0,{node:e,selected:e.id})}}function S(){if(g.query.offset=(g.query.page-1)*g.query.limit,g.apiName)if("admin"===g.currentUser.role)g.promise=d[g.apiName].get(g.query,T).$promise;else{if(!g.userProfileSection)return T(null);if(g.userProfileSection.autoAssociation)g.promise=d[g.apiName].get(g.query,T).$promise;else{var a=[];g.promise=d[g.apiName].get(g.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:g.userProfileSection.id,type:"analyticDefaultReport"===g.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),T({count:t.length,rows:t})}return T(null)}):T(null)}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_REPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}}function T(e){g.reports=e||{count:0,rows:[]},g.newDashboardItem||g.selectedReport.push(_.find(g.reports.rows,{id:g.currentReport.id}))}function I(e){a.hide(e)}c.hasRole("admin")?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){g.voiceQueues=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){h=e.rows||[]}).then(function(){for(var e=[],n=0;n<v.length;n++)e.push(d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:v[n].id}).$promise);return o.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<v.length;a++){var i=_.find(n,["sectionId",v[a].id]);if(i)if(i.autoAssociation){var s=[];h.forEach(function(e){e.type===v[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise)}return o.all(t)}).then(function(e){var n=[],t=null;g.dashboarditem&&(t=_.find(h,{id:Number(g.dashboarditem.attrVoiceQueues)}));for(var a=0;a<e.length;a++){(e[a].rows||[]).forEach(function(e){n.push(e)})}t&&!_.some(n,["resourceId",t.id])&&h.forEach(function(e){e.id===t.id&&(e.canSelect=!1,n.push(e))}),g.voiceQueues=n}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueues",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.mailAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.mailAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.mailAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.mailAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.mailAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.mailAccount,{id:Number(g.dashboarditem.attrEmailAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.mailAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.mailAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.mailAccount,{id:Number(g.dashboarditem.attrEmailAccounts)}));for(var i=0;i<g.mailAccount.length;i++)a&&g.mailAccount[i].id===a.id&&(g.mailAccount[i].canSelect=!1,t.push(g.mailAccount[i]));g.mailAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.faxAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.faxAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_FAXACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.faxAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.faxAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:902}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.faxAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.faxAccount,{id:Number(g.dashboarditem.attrFaxAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.faxAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.faxAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.faxAccount,{id:Number(g.dashboarditem.attrFaxAccounts)}));for(var i=0;i<g.faxAccount.length;i++)a&&g.faxAccount[i].id===a.id&&(g.faxAccount[i].canSelect=!1,t.push(g.faxAccount[i]));g.faxAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETfaxAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.smsAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.smsAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SMSACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.smsAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.smsAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:702}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.smsAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.smsAccount,{id:Number(g.dashboarditem.attrSmsAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.smsAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.smsAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.smsAccount,{id:Number(g.dashboarditem.attrSmsAccounts)}));for(var i=0;i<g.smsAccount.length;i++)a&&g.smsAccount[i].id===a.id&&(g.smsAccount[i].canSelect=!1,t.push(g.smsAccount[i]));g.smsAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsmsAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.openchannelAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.openchannelAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OPENCHANNELACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.openchannelAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.openchannelAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:802}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.openchannelAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.openchannelAccount,{id:Number(g.dashboarditem.attrOpenchannelAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.openchannelAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.openchannelAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.openchannelAccount,{id:Number(g.dashboarditem.attrOpenchannelAccounts)}));for(var i=0;i<g.openchannelAccount.length;i++)a&&g.openchannelAccount[i].id===a.id&&(g.openchannelAccount[i].canSelect=!1,t.push(g.openchannelAccount[i]));g.openchannelAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETopenchannelAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.whatsappAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.whatsappAccount=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_WHATSAPPACCOUNT",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.whatsappAccount.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.whatsappAccount=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:2102}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.whatsappAccount,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.whatsappAccount,{id:Number(g.dashboarditem.attrWhatsappAccounts)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.whatsappAccount,{id:t.id});a.canSelect=!1,n.push(a)}g.whatsappAccount=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.whatsappAccount,{id:Number(g.dashboarditem.attrWhatsappAccounts)}));for(var i=0;i<g.whatsappAccount.length;i++)a&&g.whatsappAccount[i].id===a.id&&(g.whatsappAccount[i].canSelect=!1,t.push(g.whatsappAccount[i]));g.whatsappAccount=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.chatWebsite.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.chatWebsite=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CHATWEBSITE",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.chatWebsite.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.chatWebsite=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:502}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.chatWebsite,{id:e.resourceId})}),t=null;if(g.dashboarditem&&(t=_.find(g.chatWebsite,{id:Number(g.dashboarditem.attrChatWebsites)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.chatWebsite,{id:t.id});a.canSelect=!1,n.push(a)}g.chatWebsite=n})}else{var t=[],a=null;g.dashboarditem&&(a=_.find(g.chatWebsite,{id:Number(g.dashboarditem.attrChatWebsites)}));for(var i=0;i<g.chatWebsite.length;i++)a&&g.chatWebsite[i].id===a.id&&(g.chatWebsite[i].canSelect=!1,t.push(g.chatWebsite[i]));g.chatWebsite=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETchatWebsite",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","dashboard","dashboarditem","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditDashboardItemDialogController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.customDashboard=c||t.params.customDashboard||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.clonedialog=function(e,n){a.show({controller:"CustomDashboardcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/customDashboards/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{customDashboard:e,customDashboards:u.customDashboards?u.customDashboards.rows:[],crudPermissions:u.crudPermissions}})},u.gotogoto=function(e,n){t.go("app.dashboards.custom",{id:e.id})},u.alert=l.info,u.gotoCustomDashboards=function(){t.go("app.tools.customDashboards",{},{reload:"app.tools.customDashboards"})},u.saveCustomDashboard=function(){r.dashboard.update({id:u.customDashboard.id},u.customDashboard).$promise.then(function(){l.success({title:"CustomDashboard updated!",msg:u.customDashboard.name?u.customDashboard.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETdashboard",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","customDashboard","userProfileSection"],angular.module("app.tools").controller("CustomDashboardController",e)}(),function(){"use strict";function e(a,i,o,r,e,l,d,n,t,s,c){var m=this;if(m.currentUser=n.getCurrentUser(),m.disposition=angular.copy(e),m.setting=c,m.license=s,m.crudPermissions=t,m.newDisposition=!1,m.errors=[],m.disposition||(m.disposition={level:"first"},m.newDisposition=!0),l){var u=l.field;m.disposition[u]=l.id}function p(){return o(function(t,n){d.disposition.get({fields:"id,name,level,ParentId",sort:"id",nolimit:"true"}).$promise.then(function(e){var n=e.rows||[];return t(n)}).catch(function(e){n(e)})})}function g(e){"first"===e.level?m.firstLevelDisposition=e:(m.anySecondLevelDisposition=!0,m.secondLevelDisposition=e,m.firstLevelDisposition=_.find(m.dispositions,["id",m.secondLevelDisposition.ParentId]),m.firstLevelDisposition||p().then(function(){m.firstLevelDisposition=_.find(m.allDispositions,["id",m.secondLevelDisposition.ParentId]),m.firstLevelDisposition.canSelect=!1,m.dispositions.push(m.firstLevelDisposition)}))}function v(e){a.hide(e)}m.onInit=function(){var e={fields:"id,name,level,ParentId",id:l?l.id:void 0,section:"user"===m.currentUser.role?"Dispositions":void 0,MailAccountId:l?void 0:"null",FaxAccountId:l?void 0:"null",SmsAccountId:l?void 0:"null",OpenchannelAccountId:l?void 0:"null",ChatWebsiteId:l?void 0:"null",WhatsappAccountId:l?void 0:"null",ListId:l?void 0:"null",sort:"id",nolimit:"true"},n="get",t="disposition";l?(n="getDispositions",t=l.route):"user"===m.currentUser.role&&(n="getResources",t="userProfile",e.id=m.currentUser.userProfileId);(a=t,i=n,s=e,o(function(t,n){d[a][i](s).$promise.then(function(e){var n=e.rows||[];return t(n)}).catch(function(e){n(e)})})).then(function(e){m.dispositions=angular.copy(e),m.newDisposition||function(){if("first"===m.disposition.level)return;if(m.parentDisposition=_.find(m.dispositions,["id",m.disposition.ParentId]),!m.parentDisposition)return p().then(function(e){m.allDispositions=e;for(var n=0;n<m.allDispositions.length;n++){var t=m.allDispositions[n];if(t.id===m.disposition.ParentId){g(t),t.canSelect=!1,m.dispositions.push(t);break}}});g(m.parentDisposition)}()}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:["api",t,n].join(":"),msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})});var a,i,s},m.onFirstLevelSelection=function(){m.secondLevelDisposition=void 0,m.anySecondLevelDisposition=_.some(m.dispositions,function(e){return e.ParentId===m.firstLevelDisposition.id&&e.id!=m.disposition.id})},m.addNewDisposition=function(){m.errors=[],m.secondLevelDisposition?(m.disposition.ParentId=m.secondLevelDisposition.id,m.disposition.level="third"):m.firstLevelDisposition&&(m.disposition.ParentId=m.firstLevelDisposition.id,m.disposition.level="second");d.disposition.save(m.disposition).$promise.then(function(e){m.dispositions.unshift(e.toJSON()),r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_CREATED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.save"}];for(var n=0;n<e.data.errors.length;n+=1)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.saveDisposition=function(){m.errors=[],m.secondLevelDisposition?(m.disposition.ParentId=m.secondLevelDisposition.id,m.disposition.level="third"):m.firstLevelDisposition&&(m.disposition.ParentId=m.firstLevelDisposition.id,m.disposition.level="second");d.disposition.update({id:m.disposition.id},m.disposition).$promise.then(function(e){var n=_.find(m.dispositions,{id:e.id});n&&_.merge(n,e.toJSON()),r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_SAVED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.update"}];for(var n=0;n<e.data.errors.length;n++)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.deleteDisposition=function(e){m.errors=[];var n=_.some(m.dispositions,["ParentId",m.disposition.id]),t=a.confirm({skipHide:!0}).title(i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(i.instant("TOOLS.NOTIFICATIONS."+(n?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:m.disposition.name})).ariaLabel("Delete disposition").ok(i.instant("TOOLS.DELETE")).cancel(i.instant("TOOLS.CANCEL")).targetEvent(e);a.show(t).then(function(){d.disposition.delete({id:m.disposition.id}).$promise.then(function(){r.success({title:i.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")}),v(!0)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"api.disposition.delete"}];for(var n=0;n<e.data.errors.length;n++)r.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.disposition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},m.clearSelection=function(e){"first"===e?(m.firstLevelDisposition=void 0,m.secondLevelDisposition=void 0,m.anySecondLevelDisposition=!1):m.secondLevelDisposition=void 0},m.closeDialog=v}e.$inject=["$mdDialog","$translate","$q","toasty","disposition","model","api","Auth","crudPermissions","license","setting"],angular.module("app.tools").controller("CreateOrEditDispositionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v){var h=this;function f(e){h.dispositions=e||{count:0,rows:[]}}function b(){h.query.offset=(h.query.page-1)*h.query.limit,p.isAdmin()?h.promise=m.disposition.get(h.query,f).$promise:(h.query.id=h.userProfile.id,h.query.section="Dispositions",h.promise=m.userProfile.getResources(h.query,f).$promise)}function A(e){m.disposition.delete({id:e.id}).$promise.then(function(){b(),u.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){h.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)u.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else u.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}h.license=g,h.setting=v,h.currentUser=p.getCurrentUser(),h.dispositions=l||{count:0,rows:[]},h.userProfile=d,h.userProfileSection=c&&1==c.count?c.rows[0]:null,h.crudPermissions=p.parseCrudPermissions(h.userProfileSection?h.userProfileSection.crudPermissions:null),h.selectedDispositions=[],h.levels={first:"1st",second:"2nd",third:"3rd"},h.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",MailAccountId:"null",FaxAccountId:"null",SmsAccountId:"null",OpenchannelAccountId:"null",ChatWebsiteId:"null",WhatsappAccountId:"null",ListId:"null",limit:10,page:1},h.deleteconfirm=function(e,n){var t=_.some(h.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){A(e)})},h.success=f,h.getDispositions=b,h.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:null,license:h.license,setting:h.setting,crudPermissions:h.crudPermissions}}).then(function(e){!0===e&&b()})},h.deleteDisposition=A,h.exportSelectedDispositions=function(){var e=angular.copy(h.selectedDispositions);return h.selectedDispositions=[],e},h.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:h.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){h.selectedDispositions.forEach(function(e){A(e)}),h.selectedDispositions=[]})},h.deselectDispositions=function(){h.selectedDispositions=[]},h.selectAllDispositions=function(){h.selectedDispositions=h.dispositions.rows};var E=!0,y=1;e.$watch("vm.query.filter",function(e,n){E?o(function(){E=!1}):(n||(y=h.query.page),e!==n&&(h.query.page=1),e||(h.query.page=y),b())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","dispositions","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.tools").controller("DispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_INTERVAL",g.interval=angular.copy(l),g.intervals=r,g.newInterval=!1,g.interval||(g.interval={},g.title="TOOLS.NEW_INTERVAL",g.newInterval=!0),g.addNewInterval=function(){g.errors=[],d.interval.save(g.interval).$promise.then(function(e){g.intervals.unshift(e.toJSON()),o.success({title:"Interval properly created",msg:g.interval.name?g.interval.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInterval=function(){g.errors=[],d.interval.update({id:g.interval.id},g.interval).$promise.then(function(e){var n=_.find(g.intervals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Interval properly saved!",msg:g.interval.name?g.interval.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInterval=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.interval.delete({id:g.interval.id}).$promise.then(function(){_.remove(g.intervals,{id:g.interval.id}),o.success({title:"Interval properly deleted!",msg:(g.interval.name||"interval")+" has been deleted!"}),v(g.interval)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","intervals","interval","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditAppintervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.intervalIntervals=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.interval.getIntervals(m.query,u).$promise}function g(e){d.interval.delete({id:e.id}).$promise.then(function(){_.remove(m.intervalIntervals.rows,{id:e.id}),m.intervalIntervals.count-=1,m.intervalIntervals.rows.length||p(),l.success({title:"Interval deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETinterval"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.interval={},m.intervalIntervals={count:0,rows:[]},m.selectedIntervalIntervals=[],m.crudPermissions,m.sortableTable={animation:100,onSort:function(e){d.interval.addIntervals({id:m.interval.id},e.models).$promise.then(function(e){m.intervalIntervals.rows=e}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:SORTABLETABLE",msg:e.data?JSON.stringify(e.data):e.toString()})})}},m.query={fields:"createdAt,updatedAt,id,name,interval",nolimit:"true",limit:10,page:1},m.init=function(e,n){m.interval=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.sortableTable.disabled=!m.crudPermissions.canEdit,m.query.id=m.interval.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interval?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interval #")+e.id||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getIntervalIntervals=p,m.createOrEditIntervalInterval=function(e,n){o.show({controller:"EditAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:m.interval,interval:n,intervals:m.intervalIntervals.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedIntervalIntervals=function(){var e=angular.copy(m.selectedIntervalIntervals);return m.selectedIntervalIntervals=[],e},m.deleteIntervalInterval=g,m.deleteSelectedIntervalIntervals=function(e){var n=o.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+m.selectedIntervalIntervals.length+" selected</b> will be deleted.").ariaLabel("delete intervals").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedIntervalIntervals.forEach(function(e){g(e)}),m.selectedIntervalIntervals=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("IntervalIntervalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_INTERVAL",g.interval=angular.copy(l),g.intervals=r,g.newInterval=!1,g.interval||(g.interval={},g.title="TOOLS.NEW_INTERVAL",g.newInterval=!0),g.addNewInterval=function(){g.errors=[],d.interval.save(g.interval).$promise.then(function(e){g.intervals.unshift(e.toJSON()),o.success({title:"Interval properly created",msg:g.interval.name?g.interval.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveInterval=function(){g.errors=[],d.interval.update({id:g.interval.id},g.interval).$promise.then(function(e){var n=_.find(g.intervals,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Interval properly saved!",msg:g.interval.name?g.interval.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteInterval=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The interval will be deleted.").ariaLabel("Delete Interval").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.interval.delete({id:g.interval.id}).$promise.then(function(){_.remove(g.intervals,{id:g.interval.id}),o.success({title:"Interval properly deleted!",msg:(g.interval.name||"interval")+" has been deleted!"}),v(g.interval)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.interval.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.interval.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","intervals","interval","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.interval=c||e.params.interval||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoIntervals=function(){e.go("app.tools.intervals",{},{reload:"app.tools.intervals"})},u.saveInterval=function(){r.interval.update({id:u.interval.id},u.interval).$promise.then(function(){l.success({title:"Interval updated!",msg:u.interval.name?u.interval.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETinterval",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","interval","userProfileSection"],angular.module("app.tools").controller("IntervalController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.intervals=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="intervals",f.listOrder="",f.listOrderAsc=null,f.selectedIntervals=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",IntervalId:"null",limit:10,page:1},f.editstate=function(e,n){t.go("app.tools.intervals.edit",{id:e.id,interval:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("interval")+"?").htmlContent("<b>"+(e.name||"interval")+"</b> will be deleted.").ariaLabel("delete interval").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getIntervals=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.interval.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Intervals",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditInterval=function(e,n){i.show({controller:"CreateOrEditIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/intervals/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:n,intervals:f.intervals.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteInterval=y,f.exportSelectedIntervals=function(){var e=angular.copy(f.selectedIntervals);return f.selectedIntervals=[],e},f.deleteSelectedIntervals=function(e){var n=i.confirm().title("Are you sure want to delete the selected intervals?").htmlContent("<b>"+f.selectedIntervals.length+" selected</b> will be deleted.").ariaLabel("delete Intervals").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedIntervals.forEach(function(e){y(e)}),f.selectedIntervals=[]})},f.deselectIntervals=function(){f.selectedIntervals=[]},f.selectAllIntervals=function(){f.selectedIntervals=f.intervals.rows};var b=!0,A=1;function E(e){f.intervals=e||{count:0,rows:[]}}function y(e){m.interval.delete({id:e.id}).$promise.then(function(){_.remove(f.intervals.rows,{id:e.id}),f.intervals.count-=1,f.intervals.rows.length||f.getIntervals(),p.success({title:_.startCase("Interval")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEinterval"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEinterval",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getIntervals())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","intervals","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("IntervalsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_PAUSE",g.pause=angular.copy(l),g.pauses=r,g.newPause=!1,g.pause||(g.pause={},g.title="TOOLS.NEW_PAUSE",g.newPause=!0),g.addNewPause=function(){g.errors=[],d.pause.save(g.pause).$promise.then(function(e){g.pauses.unshift(e.toJSON()),o.success({title:"Pause properly created",msg:g.pause.name?g.pause.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savePause=function(){g.errors=[],d.pause.update({id:g.pause.id},g.pause).$promise.then(function(e){var n=_.find(g.pauses,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Pause properly saved!",msg:g.pause.name?g.pause.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletePause=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The pause will be deleted.").ariaLabel("Delete Pause").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.pause.delete({id:g.pause.id}).$promise.then(function(){_.remove(g.pauses,{id:g.pause.id}),o.success({title:"Pause properly deleted!",msg:(g.pause.name||"pause")+" has been deleted!"}),v(g.pause)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.pause.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.pause.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","pauses","pause","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditPauseDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.pauses=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="pauses",f.listOrder="",f.listOrderAsc=null,f.selectedPauses=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{pause:e,pauses:f.pauses.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("pause")+"?").htmlContent("<b>"+(e.name||"pause")+"</b> will be deleted.").ariaLabel("delete pause").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getPauses=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.pause.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Pauses",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditPause=function(e,n){i.show({controller:"CreateOrEditPauseDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/pauses/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{pause:n,pauses:f.pauses.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletePause=y,f.exportSelectedPauses=function(){var e=angular.copy(f.selectedPauses);return f.selectedPauses=[],e},f.deleteSelectedPauses=function(e){var n=i.confirm().title("Are you sure want to delete the selected pauses?").htmlContent("<b>"+f.selectedPauses.length+" selected</b> will be deleted.").ariaLabel("delete Pauses").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedPauses.forEach(function(e){y(e)}),f.selectedPauses=[]})},f.deselectPauses=function(){f.selectedPauses=[]},f.selectAllPauses=function(){f.selectedPauses=f.pauses.rows};var b=!0,A=1;function E(e){f.pauses=e||{count:0,rows:[]}}function y(e){m.pause.delete({id:e.id}).$promise.then(function(){_.remove(f.pauses.rows,{id:e.id}),f.pauses.count-=1,f.pauses.rows.length||f.getPauses(),p.success({title:_.startCase("Pause")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEpause"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEpause",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getPauses())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","pauses","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("PausesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;if(g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_SCHEDULE",g.schedule=angular.copy(l),g.schedules=r,g.newSchedule=!1,g.selectedReport=[],g.query={fields:"createdAt,updatedAt,id,name,description,table,parent,conditions,joins",limit:10,page:1,sort:"-updatedAt"},g.schedule){g.apiName=g.schedule.DefaultReportId?"analyticDefaultReport":"analyticCustomReport";var v=g.schedule.DefaultReportId?g.schedule.DefaultReportId:g.schedule.CustomReportId;d[g.apiName].get({fields:"id,name,parent"}).$promise.then(function(e){g.currentReport=_.find(e.rows,{id:v}),g.schedule.report=g.currentReport.name,g.query.parent=g.currentReport.parent})}else g.schedule={output:"xlsx",active:!0,startAt:new Date,endAt:new Date(Date.now()+2592e6),cron:"0 0 * * *",subtractNumber:1,subtractUnit:"days",sendMail:!1,sendIfEmpty:!0},g.title="TOOLS.NEW_SCHEDULE",g.newSchedule=!0;function h(e){return e?{loaded:A,select_node:f}:{loaded:E,select_node:b}}function f(e,n){g.treeDefaultInstance.jstree(!0).deselect_all(),g.treeDefaultInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!0,g.currentPath=g.treeCustomInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticCustomReport",g.query.parent=n.node.id,y()}function b(e,n){g.treeCustomInstance.jstree(!0).deselect_all(),g.treeCustomInstance.jstree(!0).close_all(),g.currentNode=n.node,g.currentNode.custom=!1,g.currentPath=g.treeDefaultInstance.jstree(!0).get_path(g.currentNode).join("/ "),g.apiName="analyticDefaultReport",g.query.parent=n.node.id,y()}function A(){if(!g.newSchedule&&"analyticCustomReport"===g.apiName){var e=g.treeCustomInstance.jstree(!0).get_node(g.query.parent);f(0,{node:e,selected:e.id})}}function E(){if(!g.newSchedule&&"analyticDefaultReport"===g.apiName){var e=g.treeDefaultInstance.jstree(!0).get_node(g.query.parent);b(0,{node:e,selected:e.id})}}function y(){if(g.query.offset=(g.query.page-1)*g.query.limit,g.apiName)if("admin"===g.currentUser.role)g.promise=d[g.apiName].get(g.query,S).$promise;else{if(!g.userProfileSection)return S(null);if(g.userProfileSection.autoAssociation)g.promise=d[g.apiName].get(g.query,S).$promise;else{var a=[];g.promise=d[g.apiName].get(g.query).$promise.then(function(e){return 0<(a=e&&e.rows?e.rows:[]).length?d.userProfileResource.get({sectionId:g.userProfileSection.id,type:"analyticDefaultReport"===g.apiName?"DefaultReports":"CustomReports"}).$promise.then(function(e){var n=e&&e.rows?e.rows:[];if(0<n.length){var t=[];return a.forEach(function(e){_.find(n,["resourceId",e.id])&&t.push(e)}),S({count:t.length,rows:t})}return S(null)}):S(null)}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_REPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}}function S(e){g.reports=e||{count:0,rows:[]},g.newSchedule||g.selectedReport.push(_.find(g.reports.rows,{id:g.currentReport.id}))}function T(e){a.hide(e)}g.addNewSchedule=function(){g.errors=[],d.schedule.save(g.schedule).$promise.then(function(e){g.schedules.unshift(e.toJSON()),o.success({title:"Schedule properly created",msg:g.schedule.name?g.schedule.name+" has been created!":""}),T(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSchedule=function(){g.errors=[],d.schedule.update({id:g.schedule.id},g.schedule).$promise.then(function(e){var n=_.find(g.schedules,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Schedule properly saved!",msg:g.schedule.name?g.schedule.name+" has been saved!":""}),T(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSchedule=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The schedule will be deleted.").ariaLabel("Delete Schedule").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.schedule.delete({id:g.schedule.id}).$promise.then(function(){_.remove(g.schedules,{id:g.schedule.id}),o.success({title:"Schedule properly deleted!",msg:(g.schedule.name||"schedule")+" has been deleted!"}),T(g.schedule)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.schedule.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.schedule.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.getReports=y,g.selectReport=function(){g.schedule.report=g.selectedReport[0].name,g.currentNode.custom?(g.schedule.CustomReportId=g.selectedReport[0].id,delete g.schedule.DefaultReportId):(g.schedule.DefaultReportId=g.selectedReport[0].id,delete g.schedule.CustomReportId);e.scheduleForm.report.$setDirty(),a.hide()},g.closeReportDialog=function(){a.hide()},g.searchReport=function(){g.treeDefaultData=g.treeReports[0]?angular.fromJson(g.treeReports[0].tree):[],g.treeCustomData=g.treeReports[1]?angular.fromJson(g.treeReports[1].tree):[],g.treeConfig=(n={core:{multiple:!1,animation:!0,error:function(e){console.error("treeCtrl: error from js tree - "+angular.toJson(e))},check_callback:!0,worker:!0},version:1,plugins:["wholerow"]},"admin"!==g.currentUser.role?d.userProfileSection.get({fields:"id,name,enabled,includeAll,autoAssociation,crudPermissions",userProfileId:g.currentUser.userProfileId,sectionId:1203}).$promise.then(function(e){return g.userProfileSection=e&&1==e.count?e.rows[0]:null,n}).catch(function(e){o.error({title:"ERROR",msg:e.message})}):n),g.treeDefaultEvents=h(!1),g.treeCustomEvents=h(!0),a.show({controller:function(){return g},controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/partialViews/reports/treeReports.html",autoWrap:!0,skipHide:!0});var n},g.closeDialog=T,d.analyticTreeReport.get({}).$promise.then(function(e){g.treeReports=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.mailAccounts=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.mailAccounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.mailAccounts,{id:e.resourceId})}),t=null;if(g.schedule&&(t=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.mailAccounts,{id:t.id});a.canSelect=!1,n.push(a)}g.mailAccounts=n})}else{var t=[],a=null;g.schedule&&(a=_.find(g.mailAccounts,{id:Number(g.schedule.MailAccountId)}));for(var i=0;i<g.mailAccounts.length;i++)a&&g.mailAccounts[i].id===a.id&&(g.mailAccounts[i].canSelect=!1,t.push(g.mailAccounts[i]));g.mailAccounts=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","schedules","schedule","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditScheduleDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.schedules=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="schedules",f.listOrder="",f.listOrderAsc=null,f.selectedScheduler=[],f.query={fields:"createdAt,updatedAt,id,name,CustomReportId,DefaultReportId,output,active,startAt,endAt,cron,subtractNumber,subtractUnit,sendMail,MailAccountId,email,cc,bcc,sendIfEmpty,description",sort:"-updatedAt",limit:10,page:1},f.arrayoutput=_.keyBy([{option:"CSV",value:"'csv'"},{option:"PDF",value:"'pdf'"},{option:"Excel",value:"'xlsx'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysubtractUnit=_.keyBy([{option:"Minutes",value:"'minutes'"},{option:"Hours",value:"'hours'"},{option:"Days",value:"'days'"},{option:"Weeks",value:"'weeks'"},{option:"Months",value:"'months'"},{option:"Quarters",value:"'quarters'"},{option:"Years",value:"'years'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{schedule:e,schedules:f.schedules.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.runconfirm=function(e,n){var t=i.confirm().title("Are you sure want to run the schedule?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be run.").ariaLabel("delete schedule").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){return m.schedule.run({id:e.id}).$promise},function(){console.log("CANCEL")})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("schedule")+"?").htmlContent("<b>"+(e.name||"schedule")+"</b> will be deleted.").ariaLabel("delete schedule").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getScheduler=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.schedule.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Scheduler",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSchedule=function(e,n){i.show({controller:"CreateOrEditScheduleDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/schedules/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{schedule:n,schedules:f.schedules.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSchedule=y,f.exportSelectedScheduler=function(){var e=angular.copy(f.selectedScheduler);return f.selectedScheduler=[],e},f.deleteSelectedScheduler=function(e){var n=i.confirm().title("Are you sure want to delete the selected schedules?").htmlContent("<b>"+f.selectedScheduler.length+" selected</b> will be deleted.").ariaLabel("delete Schedules").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedScheduler.forEach(function(e){y(e)}),f.selectedScheduler=[]})},f.deselectScheduler=function(){f.selectedScheduler=[]},f.selectAllScheduler=function(){f.selectedScheduler=f.schedules.rows},m.analyticTreeReport.get({}).$promise.then(function(e){f.treeReports=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TREEREPORTS",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.mailAccounts=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MAILACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.mailAccount.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.mailAccounts=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:602}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.mailAccounts,{id:e.resourceId})}),t=null;if(f.schedule&&(t=_.find(f.mailAccounts,{id:Number(f.schedule.MailAccountId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.mailAccounts,{id:t.id});a.canSelect=!1,n.push(a)}f.mailAccounts=n})}else{var t=[],a=null;f.schedule&&(a=_.find(f.mailAccounts,{id:Number(f.schedule.MailAccountId)}));for(var i=0;i<f.mailAccounts.length;i++)a&&f.mailAccounts[i].id===a.id&&(f.mailAccounts[i].canSelect=!1,t.push(f.mailAccounts[i]));f.mailAccounts=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmailAccounts",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.schedules=e||{count:0,rows:[]}}function y(e){m.schedule.delete({id:e.id}).$promise.then(function(){_.remove(f.schedules.rows,{id:e.id}),f.schedules.count-=1,f.schedules.rows.length||f.getScheduler(),p.success({title:_.startCase("Schedule")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEschedule"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEschedule",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getScheduler())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","schedules","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("SchedulesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_SOUND",g.sound=angular.copy(l),g.sounds=r,g.newSound=!1,g.sound||(g.sound={},g.title="TOOLS.NEW_SOUND",g.newSound=!0),g.addNewSound=function(){g.errors=[],d.sound.save(g.sound).$promise.then(function(e){g.sounds.unshift(e.toJSON()),o.success({title:"Sound properly created",msg:g.sound.name?g.sound.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveSound=function(){g.errors=[],d.sound.update({id:g.sound.id},g.sound).$promise.then(function(e){var n=_.find(g.sounds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Sound properly saved!",msg:g.sound.name?g.sound.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteSound=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The sound will be deleted.").ariaLabel("Delete Sound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.sound.delete({id:g.sound.id}).$promise.then(function(){_.remove(g.sounds,{id:g.sound.id}),o.success({title:"Sound properly deleted!",msg:(g.sound.name||"sound")+" has been deleted!"}),v(g.sound)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.sound.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","sounds","sound","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.sounds=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="sounds",f.listOrder="",f.listOrderAsc=null,f.selectedSounds=[],f.query={fields:"createdAt,updatedAt,id,save_name,converted_format,name,audio,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{sound:e,sounds:f.sounds.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.downloadfile2=function(s,e){return m.sound.download({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.converted_format?s.save_name+"."+s.converted_format:s.save_name;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.sound.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("sound")+"?").htmlContent("<b>"+(e.name||"sound")+"</b> will be deleted.").ariaLabel("delete sound").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getSounds=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.sound.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Sounds",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditSound=function(e,n){i.show({controller:"CreateOrEditSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sound:n,sounds:f.sounds.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteSound=y,f.exportSelectedSounds=function(){var e=angular.copy(f.selectedSounds);return f.selectedSounds=[],e},f.deleteSelectedSounds=function(e){var n=i.confirm().title("Are you sure want to delete the selected sounds?").htmlContent("<b>"+f.selectedSounds.length+" selected</b> will be deleted.").ariaLabel("delete Sounds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedSounds.forEach(function(e){y(e)}),f.selectedSounds=[]})},f.deselectSounds=function(){f.selectedSounds=[]},f.selectAllSounds=function(){f.selectedSounds=f.sounds.rows},f.uploadSound=function(e){i.show({controller:"UploadSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/sounds/upload/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{sounds:f.sounds.rows}})};var b=!0,A=1;function E(e){f.sounds=e||{count:0,rows:[]}}function y(e){m.sound.delete({id:e.id}).$promise.then(function(){_.remove(f.sounds.rows,{id:e.id}),f.sounds.count-=1,f.sounds.rows.length||f.getSounds(),p.success({title:_.startCase("Sound")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEsound"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEsound",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getSounds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","sounds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("SoundsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this,r=15,l=1024*r*1024;o.currentUser=s.getCurrentUser(),o.errors=[],o.title="TOOLS.UPLOAD_SOUND",o.sounds=a,o.uploadSounds=[],o.uploadState="none",o.sound={},o.ngFlowOptions={maxChunkRetries:1,chunkSize:l,simultaneousUploads:1,testChunks:!1,progressCallbacksInterval:1e3,allowDuplicateUploads:!0,target:"api/sounds"},o.ngFlow={flow:{}},o.dropping=!1,o.fileAdded=function(e){var n=["wav","mp3","gsm"];if(!_.includes(n,e.getExtension()))return t.error({title:"Invalid extension: "+e.getExtension(),msg:"Supported extension: "+n.join()}),!1;if(e.size>l)return t.error({title:"File too big",msg:"The max allowed size is "+r+"MB"}),!1;return o.sound={id:e.uniqueIdentifier,file:e},o.uploadSounds.unshift(o.sound),!0},o.upload=function(){o.uploadState="uploading",o.ngFlow.flow.opts.headers={"X-Requested-With":"XMLHttpRequest",Authorization:"Bearer "+e.get("motion.token")},o.ngFlow.flow.opts.query={role:o.currentUser.role,userProfileId:o.currentUser.userProfileId},o.ngFlow.flow.upload()},o.fileSuccess=function(a,e){o.sounds.unshift(JSON.parse(e)),angular.forEach(o.uploadSounds,function(n,e){if(n.id===a.uniqueIdentifier){var t=new FileReader;t.readAsDataURL(n.file.file),t.onload=function(e){n.url=e.target.result}}})},o.uploadError=function(e,n){o.ngFlow.flow.cancel(),t.error({title:"Upload error",msg:"Cannot upload the sound"}),o.uploadState="failed"},o.uploadComplete=function(){"failed"!==o.uploadState&&(o.uploadState="completed",t.success({title:"Upload completed",msg:o.sound.file.name+" uploaded successfully"}))},o.closeDialog=function(){n.hide()}}e.$inject=["$cookies","$mdDialog","toasty","sounds","api","Auth"],angular.module("app.tools").controller("UploadSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TAG",g.tag=angular.copy(l),g.tags=r,g.newTag=!1,g.tag||(g.tag={},g.title="TOOLS.NEW_TAG",g.newTag=!0),g.addNewTag=function(){g.errors=[],d.tag.save(g.tag).$promise.then(function(e){g.tags.unshift(e.toJSON()),o.success({title:"Tag properly created",msg:g.tag.name?g.tag.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTag=function(){g.errors=[],d.tag.update({id:g.tag.id},g.tag).$promise.then(function(e){var n=_.find(g.tags,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Tag properly saved!",msg:g.tag.name?g.tag.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTag=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The tag will be deleted.").ariaLabel("Delete Tag").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.tag.delete({id:g.tag.id}).$promise.then(function(){_.remove(g.tags,{id:g.tag.id}),o.success({title:"Tag properly deleted!",msg:(g.tag.name||"tag")+" has been deleted!"}),v(g.tag)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.tag.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.tag.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","tags","tag","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTagDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.tags=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="tags",f.listOrder="",f.listOrderAsc=null,f.selectedTags=[],f.query={fields:"createdAt,updatedAt,id,name,description,color",sort:"name,-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{tag:e,tags:f.tags.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("tag")+"?").htmlContent("<b>"+(e.name||"tag")+"</b> will be deleted.").ariaLabel("delete tag").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTags=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.tag.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Tags",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTag=function(e,n){i.show({controller:"CreateOrEditTagDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/tags/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{tag:n,tags:f.tags.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTag=y,f.exportSelectedTags=function(){var e=angular.copy(f.selectedTags);return f.selectedTags=[],e},f.deleteSelectedTags=function(e){var n=i.confirm().title("Are you sure want to delete the selected tags?").htmlContent("<b>"+f.selectedTags.length+" selected</b> will be deleted.").ariaLabel("delete Tags").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTags.forEach(function(e){y(e)}),f.selectedTags=[]})},f.deselectTags=function(){f.selectedTags=[]},f.selectAllTags=function(){f.selectedTags=f.tags.rows};var b=!0,A=1;function E(e){f.tags=e||{count:0,rows:[]}}function y(e){m.tag.delete({id:e.id}).$promise.then(function(){_.remove(f.tags.rows,{id:e.id}),f.tags.count-=1,f.tags.rows.length||f.getTags(),p.success({title:_.startCase("Tag")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtag"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtag",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTags())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","tags","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TagsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TEMPLATE",g.template=angular.copy(l),g.templates=r,g.newTemplate=!1,g.template||(g.template={},g.title="TOOLS.NEW_TEMPLATE",g.newTemplate=!0),g.addNewTemplate=function(){g.errors=[],d.template.save(g.template).$promise.then(function(e){g.templates.unshift(e.toJSON()),o.success({title:"Template properly created",msg:g.template.name?g.template.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTemplate=function(){g.errors=[],d.template.update({id:g.template.id},g.template).$promise.then(function(e){var n=_.find(g.templates,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Template properly saved!",msg:g.template.name?g.template.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTemplate=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The template will be deleted.").ariaLabel("Delete Template").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.template.delete({id:g.template.id}).$promise.then(function(){_.remove(g.templates,{id:g.template.id}),o.success({title:"Template properly deleted!",msg:(g.template.name||"template")+" has been deleted!"}),v(g.template)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.template.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.template.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","templates","template","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTemplateDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.templates=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="templates",f.listOrder="",f.listOrderAsc=null,f.selectedTemplates=[],f.query={fields:"createdAt,updatedAt,id,name,html,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{template:e,templates:f.templates.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("template")+"?").htmlContent("<b>"+(e.name||"template")+"</b> will be deleted.").ariaLabel("delete template").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTemplates=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.template.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Templates",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTemplate=function(e,n){i.show({controller:"CreateOrEditTemplateDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/templates/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{template:n,templates:f.templates.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTemplate=y,f.exportSelectedTemplates=function(){var e=angular.copy(f.selectedTemplates);return f.selectedTemplates=[],e},f.deleteSelectedTemplates=function(e){var n=i.confirm().title("Are you sure want to delete the selected templates?").htmlContent("<b>"+f.selectedTemplates.length+" selected</b> will be deleted.").ariaLabel("delete Templates").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTemplates.forEach(function(e){y(e)}),f.selectedTemplates=[]})},f.deselectTemplates=function(){f.selectedTemplates=[]},f.selectAllTemplates=function(){f.selectedTemplates=f.templates.rows};var b=!0,A=1;function E(e){f.templates=e||{count:0,rows:[]}}function y(e){m.template.delete({id:e.id}).$promise.then(function(){_.remove(f.templates.rows,{id:e.id}),f.templates.count-=1,f.templates.rows.length||f.getTemplates(),p.success({title:_.startCase("Template")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtemplate"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtemplate",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTemplates())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","templates","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TemplatesController",e)}(),function(){"use strict";function e(t,a,i,e,n,s,o,r,l,d){var c=this;function m(e){t.hide(e)}c.currentUser=o.getCurrentUser(),c.trigger=angular.copy(n),c.triggers=angular.copy(e),c.setting=l,c.license=r,c.crudPermissions=d,c.newTrigger=!1,c.errors=[],c.trigger||(c.trigger={channel:"voice"},c.newTrigger=!0),c.addNewTrigger=function(){c.errors=[],s.trigger.save(c.trigger).$promise.then(function(e){c.triggers.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_CREATED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.saveTrigger=function(){c.errors=[],s.trigger.update({id:c.trigger.id},c.trigger).$promise.then(function(){c.triggers=_.map(c.triggers,function(e){return e.id===c.trigger.id?c.trigger:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_SAVED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.deleteTrigger=function(e){c.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_MESSAGE",{name:c.trigger.name})).ariaLabel("Delete trigger").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){s.trigger.delete({id:c.trigger.id}).$promise.then(function(){c.triggers=_.filter(c.triggers,function(e){return e.id!==c.trigger.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETED_SUCCESS_TITLE")}),m(c.triggers)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){c.errors=e.data.errors||[{message:e.toString(),type:"api.trigger.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trigger.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},c.closeDialog=m}e.$inject=["$mdDialog","$translate","toasty","triggers","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTriggerDialogController",e)}(),function(){"use strict";function e(e,a,n,i,t,s,o,r){var l=this;function d(){_.some(l.triggerActions.rows,["action","contactManager"])&&(l.lists||(r.isAdmin()?o.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.lists=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.lists=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.lists,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var n=_.find(l.lists,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.lists,{id:e.id});n.canSelect=!1,t.push(n)}}),l.lists=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if("contactManager"===e.action){var n=_.find(l.lists,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<l.lists.length;i++)_.some(a,{id:l.lists[i].id})&&(l.lists[i].canSelect=!1,t.push(l.lists[i]));l.lists=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(l.triggerActions.rows,["action","integration"])&&_(l.triggerActions.rows).map(function(e){return"integration"===e.action?e.data1:void 0}).compact().uniq().value().forEach(function(e){var n=e+"Accounts";if(!l[n]){var t="int"+_.startCase(e)+"Account";o[t.replace(/\s+/g,"")].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l[n]=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+n.toUpperCase()+"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}}),_.some(l.triggerActions.rows,function(e){return _.includes(["motionbar","browser"],e.action)})&&(l.templates||(r.isAdmin()?o.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l.templates=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){l.templates=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.templates,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(l.templates,{id:Number(e.data2)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.templates,{id:e.id});n.canSelect=!1,t.push(n)}}),l.templates=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(l.templates,{id:Number(e.data2)});a.push(n)}});for(var i=0;i<l.templates.length;i++)_.some(a,{id:l.templates[i].id})&&(l.templates[i].canSelect=!1,t.push(l.templates[i]));l.templates=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(l.triggerActions.rows,["action","jscripty"])&&(l.projects||(r.isAdmin()?o.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.projects=e.rows||[]}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):o.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.projects=e.rows||[]}).then(function(){return o.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return o.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(l.projects,{id:e.resourceId})}),a=null;a=[],l.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var n=_.find(l.projects,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(l.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),l.projects=t})}else{var t=[],a=[];l.triggerActions.rows.forEach(function(e){if("jscripty"===e.action){var n=_.find(l.projects,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<l.projects.length;i++)_.some(a,{id:l.projects[i].id})&&(l.projects[i].canSelect=!1,t.push(l.projects[i]));l.projects=t}}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})})))}function c(e){l.triggerActions=e||{count:0,rows:[]},d()}function m(){l.query.offset=(l.query.page-1)*l.query.limit,l.promise=o.trigger.getActions(l.query,c).$promise}function u(e,n){o.action.delete({id:e.id}).$promise.then(function(){m(),n&&s.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){l.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)s.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}l.currentUser=r.getCurrentUser(),l.trigger={},l.triggerActions={count:0,rows:[]},l.selectedTriggerActions=[],l.query={fields:"id,action,contact,data1,data2,data3,data4,data5,data6,data7,createdAt,updatedAt",limit:10,page:1},l.integrationTypes={zendesk:"Zendesk",salesforce:"Salesforce",sugarcrm:"SugarCRM",freshdesk:"Freshdesk",desk:"Desk",zoho:"Zoho",vtiger:"vTiger",dynamics365:"Dynamics365",servicenow:"ServiceNow",freshsales:"Freshsales"},l.motionBarOptions={0:"Popup",1:"CTI URL",2:"Windows App"},l.onInit=function(e,n){l.trigger=e,l.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},l.query.ActionId=l.trigger.id,l.query.id=l.trigger.id,m()},l.success=c,l.getTriggerActions=m,l.createOrEditTriggerAction=function(e,n){i.show({controller:"CreateOrEditActionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/actions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:l.trigger,action:n,actions:l.triggerActions.rows,license:null,setting:null,crudPermissions:l.crudPermissions}}).then(function(e){e&&(l.triggerActions={count:e.length,rows:e},d())})},l.exportSelectedTriggerActions=function(){var e=angular.copy(l.selectedTriggerActions);return l.selectedTriggerActions=[],e},l.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETE_TITLE")).ariaLabel("Delete action").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){u(e,!0)})},l.deleteSelectedTriggerActions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETE_MESSAGE",{total:l.selectedTriggerActions.length})).ariaLabel("Delete actions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){l.selectedTriggerActions.forEach(function(e){u(e)}),l.selectedTriggerActions=[],s.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerActionsController",e)}(),function(){"use strict";function e(n,t,a,i,e,s,o,r,l,d,c,m){var u=this;function p(){return new Promise(function(n,t){l.hasSectionsPermissions([1301,1302,1303,1304,1305,1306,1307,1308,1309,1310]).then(function(e){u.hasSectionPermissions=_.merge(u.hasSectionPermissions,e),n(u.hasSectionPermissions)}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SECTIONS_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()}),t()})})}function g(){r.cmList.getCustomFields({id:u.action.data1,ListId:u.action.data1}).$promise.then(function(e){u.listFields=_.filter(e.rows,["type","text"]),u.listFields.forEach(function(e){e.columnName="cf_"+e.id})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LIST_CUSTOM_FIELDS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function v(){l.isAdmin()?r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.templates=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.template.get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.templates=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1009}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.templates,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(u.templates,{id:Number(e.data2)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.templates,{id:e.id});n.canSelect=!1,t.push(n)}}),u.templates=t})}else{var t=[],a=[];u.actions.forEach(function(e){if(_.includes(["motionbar","browser"],e.action)){var n=_.find(u.templates,{id:Number(e.data2)});a.push(n)}});for(var i=0;i<u.templates.length;i++){_.some(a,{id:u.templates[i].id})&&(u.templates[i].canSelect=!1,t.push(u.templates[i]))}u.templates=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEMPLATES",msg:e.data?JSON.stringify(e.data):e.toString()})})}function h(){switch(u.action.action){case"contactManager":u.lists||(l.isAdmin()?r.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.lists=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.lists,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if("contactManager"===e.action){var n=_.find(u.lists,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.lists,{id:e.id});n.canSelect=!1,t.push(n)}}),u.lists=t})}else{var t=[],a=[];u.actions.forEach(function(e){if("contactManager"===e.action){var n=_.find(u.lists,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<u.lists.length;i++)_.some(a,{id:u.lists[i].id})&&(u.lists[i].canSelect=!1,t.push(u.lists[i]));u.lists=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})})),u.contactFields||r.cmContact.describe({}).$promise.then(function(e){u.contactFields=[],u.customFields=[];for(var n=_.values(e.toJSON()),t=0;t<n.length;t++)_.includes(u.allowedStandardFields,n[t].columnName)?u.contactFields.push(n[t]):_.startsWith(n[t].columnName,"cf_")&&"text"===n[t].custom.type&&u.customFields.push(n[t])}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DESCRIBE_CM_CONTACT",msg:e.data?JSON.stringify(e.data):e.toString()})}),u.action.data3=u.action.data3?u.action.data3.split(","):["phone"],"1"!==u.action.data2||u.action.data4||(u.action.data4="phone");break;case"jscripty":u.projects||(l.isAdmin()?r.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.projects=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PROJECTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.jscriptyProject.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.projects=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1701}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.projects,{id:e.resourceId})}),a=null;a=[],u.actions.forEach(function(e){if("jscripty"===e.action){var n=_.find(u.projects,{id:Number(e.data1)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.projects,{id:e.id});n.canSelect=!1,t.push(n)}}),u.projects=t})}else{var t=[],a=[];u.actions.forEach(function(e){if("jscripty"===e.action){var n=_.find(u.projects,{id:Number(e.data1)});a.push(n)}});for(var i=0;i<u.projects.length;i++)_.some(a,{id:u.projects[i].id})&&(u.projects[i].canSelect=!1,t.push(u.projects[i]));u.projects=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETprojects",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"urlForward":u.action.data5||(u.action.data5=5)}}function f(){u.editAccount||(u.action.data2=void 0,u.action.data3=void 0),u.action.isIntegrationDisabled=!u.newAction&&!function(){switch(u.action.data1){case"zendesk":return u.hasSectionPermissions[1301];case"salesforce":return u.hasSectionPermissions[1302];case"sugarcrm":return u.hasSectionPermissions[1305];case"freshdesk":return u.hasSectionPermissions[1303];case"desk":return u.hasSectionPermissions[1306];case"zoho":return u.hasSectionPermissions[1307];case"vtiger":return u.hasSectionPermissions[1308];case"dynamics365":return u.hasSectionPermissions[1309];case"servicenow":return u.hasSectionPermissions[1310];case"freshsales":return u.hasSectionPermissions[1304]}}();var e="int"+_.capitalize(u.action.data1)+"Account";r[e].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u.accounts=e.rows||[],u.editAccount=!1}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.action.data1.toUpperCase()+"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function b(){u.action.data3=u.action.data3?u.action.data3:void 0;var e="int"+_.capitalize(u.action.data1)+"Configuration";r[e].get({fields:"id,name,AccountId",sort:"id",nolimit:"true"}).$promise.then(function(e){u.configurations=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.action.data1.toUpperCase()+"CONFIGURATIONS",msg:e.data?JSON.stringify(e.data):e.toString()})})}function A(){var e=angular.copy(u.action);return _.isArray(e.data3)&&(e.data3=u.action.data3.join(",")),e}function E(e){t.hide(e)}u.currentUser=l.getCurrentUser(),void 0!==s&&"urlForward"===s.action&&s.data5&&(s.data5=parseInt(s.data5)),u.action=angular.copy(s),u.actions=angular.copy(e),u.setting=c,u.license=d,u.crudPermissions=m,u.newAction=!1,u.errors=[],u.trigger=angular.copy(o),u.action?function(){switch(u.editAccount=!0,u.action.action){case"integration":return new Promise(function(e){e(p())}).then(function(){return u.editAccount||(u.action.data2=void 0,u.action.data3=void 0,h()),f()}).then(function(){return b()});case"motionbar":case"browser":v()}u.editAccount=!1}():(u.action={},u.newAction=!0),u.action.ActionId=n.params.id||void 0,u.allowedStandardFields=["phone","mobile","fax"],u.addNewAction=function(){u.errors=[];var e=A();r.trigger.addAction({id:n.params.id},e).$promise.then(function(e){u.actions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_CREATED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},u.saveAction=function(){u.errors=[];var n=A();r.action.update({id:n.id},n).$promise.then(function(){u.actions=_.map(u.actions,function(e){return e.id===n.id?n:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_SAVED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},u.deleteAction=function(e){u.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETE_TITLE")).ariaLabel("Delete action").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){r.action.delete({id:u.action.id}).$promise.then(function(){u.actions=_.filter(u.actions,function(e){return e.id!==u.action.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.ACTION_DELETED_SUCCESS_TITLE")}),E(u.actions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"api.action.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.action.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},u.onActionInit=function(){l.hasModulePermissions("Integrations").then(function(e){u.hasIntegrationsPermissions=e}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MODULE_PERMISSIONS",msg:e.data?JSON.stringify(e.data):e.toString()})}),u.action.action&&h()},u.onIntegrationInit=p,u.onSearchFieldsInit=function(){u.newAction||g()},u.onActionSelection=function(){u.newAction&&(u.action.data1=void 0,u.action.data2=void 0,u.action.data3=void 0,u.action.data4=void 0,u.action.data5="urlForward"===u.action.action?5:void 0,h())},u.onIntegrationSelection=f,u.onListSelection=function(){g()},u.onTypeSelection=function(){"0"!==u.action.data1||u.templates?(u.action.data2=void 0,u.action.data4="1"===u.action.data1?0:void 0):v()},u.onAutocreateSelection=function(){"0"===u.action.data2&&(u.action.data4=void 0);u.action.data4||"1"!==u.action.data2||(u.action.data4="phone")},u.onIntegrationAccountSelection=b,u.closeDialog=E,u.onActionLocationChange=function(){u.editAccount||(u.action.data5=void 0,u.action.data6=void 0)}}e.$inject=["$state","$mdDialog","$translate","toasty","actions","action","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditActionDialogController",e)}(),function(){"use strict";function e(e,l,a,n,i,t,d,c,m){var u=this;function s(){var o,r;"voice"===u.trigger.channel?(_.some(u.allConditions.rows,["field","queue"])&&(u.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,m.isAdmin()?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u.queues=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(c.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];u.allConditions.rows.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),u.queues=t}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.allConditions.rows,["field","routeId"])&&(u.outboundRoutes||(m.isAdmin()?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.outboundRoutes,{id:e.resourceId})}),a=null;a=[],u.triggerAllConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),u.outboundRoutes=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<u.outboundRoutes.length;i++)_.some(a,{id:u.outboundRoutes[i].id})&&(u.outboundRoutes[i].canSelect=!1,t.push(u.outboundRoutes[i]));u.outboundRoutes=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.allConditions.rows,["field","agent"])&&(u.agents||(m.isAdmin()?c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.agents,{id:e.resourceId})}),a=null;a=[],u.triggerAllConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),u.agents=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}});for(var i=0;i<u.agents.length;i++)_.some(a,{id:u.agents[i].id})&&(u.agents[i].canSelect=!1,t.push(u.agents[i]));u.agents=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))):("mail"===u.trigger.channel&&c.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.mailSubstatuses=e.rows||[]}).catch(function(){d.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})}),function(){var e,s=u.trigger.channel+("chat"===u.trigger.channel?"Websites":"Accounts"),n=u.trigger.channel+("chat"===u.trigger.channel?"Website":"Account");switch(u.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}m.isAdmin()?c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u[s],{id:e.resourceId})}),a=null;a=[],u.allConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u[s],{id:e.id});n.canSelect=!1,t.push(n)}}),u[s]=t})}else{var t=[],a=[];u.allConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}});for(var i=0;i<u[s].length;i++)_.some(a,{id:u[s][i].id})&&(u[s][i].canSelect=!1,t.push(u[s][i]));u[s]=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}())}function o(e){u.allConditions=e||{count:0,rows:[]},s()}function r(){u.query.offset=(u.query.page-1)*u.query.limit,u.promise=c.trigger.getAllConditions(u.query,o).$promise}function p(e,n){c.condition.delete({id:e.id}).$promise.then(function(){r(),n&&d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}u.currentUser=m.getCurrentUser(),u.trigger={},u.allConditions={count:0,rows:[]},u.selectedAllConditions=[],u.query={fields:"id,field,operator,value,createdAt,updatedAt",limit:10,page:1},u.fields={queue:"Queue",lastevent:"Call_Status",routeId:"OutboundRoute",agent:"Agent",account:"Account",interaction:"Interaction",message:"Message",mailSubstatus:"Mail_Substatus",offlineMessage:"Offline_Message"},u.callStatuses={abandoned:"Abandon",timeout:"Timeout",complete:"Hangup",rejected:"Reject",called:"Ring",connect:"Answer",nosuchnumber:"NoSuchNumber",busy:"Busy",noanswer:"NoAnswer",congestion:"Congestion",agentreject:"AgentReject",amd:"AMD"},u.messageStatuses={in:"Incoming",out:"Outgoing",accept:"Accepted",reject:"Rejected"},u.onInit=function(e,n){u.trigger=e,u.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},u.query.TriggerAllId=u.trigger.id,u.query.id=u.trigger.id,r()},u.success=o,u.getAllConditions=r,u.createOrEditAllCondition=function(e,n){i.show({controller:"CreateOrEditAllConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/allconditions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:u.trigger,allCondition:n,allConditions:u.allConditions.rows,license:null,setting:null,crudPermissions:u.crudPermissions}}).then(function(e){e&&(u.allConditions={count:e.length,rows:e},s())})},u.exportSelectedAllConditions=function(){var e=angular.copy(u.selectedAllConditions);return u.selectedAllConditions=[],e},u.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){p(e,!0)})},u.deleteSelectedAllConditions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_MESSAGE",{total:u.selectedAllConditions.length})).ariaLabel("Delete conditions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){u.selectedAllConditions.forEach(function(e){p(e)}),u.selectedAllConditions=[],d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAllConditionsController",e)}(),function(){"use strict";function e(e,t,l,a,i,n,s,o,d,c,r,m,u){var p=this;function g(){switch(p.allCondition.field){case"queue":p.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,c.isAdmin()?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){p.queues=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];p.allConditions.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),p.queues=t}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"routeId":p.outboundRoutes||(c.isAdmin()?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.outboundRoutes,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),p.outboundRoutes=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.outboundRoutes.length;i++)_.some(a,{id:p.outboundRoutes[i].id})&&(p.outboundRoutes[i].canSelect=!1,t.push(p.outboundRoutes[i]));p.outboundRoutes=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"agent":p.agents||(c.isAdmin()?d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.agents,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),p.agents=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}});for(var i=0;i<p.agents.length;i++)_.some(a,{id:p.agents[i].id})&&(p.agents[i].canSelect=!1,t.push(p.agents[i]));p.agents=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"account":!function(){var e,n=p.trigger.channel+("chat"===p.trigger.channel?"Website":"Account");switch(p.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}c.isAdmin()?d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.accounts,{id:e.resourceId})}),a=null;a=[],p.allConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.accounts,{id:e.id});n.canSelect=!1,t.push(n)}}),p.accounts=t})}else{var t=[],a=[];p.allConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.accounts.length;i++)_.some(a,{id:p.accounts[i].id})&&(p.accounts[i].canSelect=!1,t.push(p.accounts[i]));p.accounts=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}();break;case"mailSubstatus":d.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){p.mailSubstatuses=e.rows||[]}).catch(function(){i.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})})}var o,r}function v(e){t.hide(e)}p.currentUser=c.getCurrentUser(),p.allCondition=angular.copy(s),p.allConditions=angular.copy(n),p.setting=m,p.license=r,p.crudPermissions=u,p.hasModulePermissions={},p.newAllCondition=!1,p.errors=[],p.trigger=angular.copy(o),p.allCondition?g():(p.allCondition={operator:"equals"},p.newAllCondition=!0),p.allCondition.TriggerAllId=e.params.id||void 0,p.callStatuses=[{name:"Abandon",value:"abandoned"},{name:"Timeout",value:"timeout"},{name:"Hangup",value:"complete"},{name:"Reject",value:"rejected"},{name:"Ring",value:"called"},{name:"Answer",value:"connect"},{name:"NoSuchNumber",value:"nosuchnumber"},{name:"Busy",value:"busy"},{name:"NoAnswer",value:"noanswer"},{name:"Congestion",value:"congestion"},{name:"AgentReject",value:"agentreject"},{name:"AMD",value:"amd"}],p.onFieldSelection=function(){p.allCondition.value=void 0,g()},p.addNewAllCondition=function(){p.errors=[],d.trigger.addAllCondition({id:e.params.id},p.allCondition).$promise.then(function(e){p.allConditions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_CREATED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveAllCondition=function(){p.errors=[],d.condition.update({id:p.allCondition.id},p.allCondition).$promise.then(function(){p.allConditions=_.map(p.allConditions,function(e){return e.id===p.allCondition.id?p.allCondition:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_SAVED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteAllCondition=function(e){p.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){d.condition.delete({id:p.allCondition.id}).$promise.then(function(){p.allConditions=_.filter(p.allConditions,function(e){return e.id!==p.allCondition.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")}),v(p.allConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.closeDialog=v}e.$inject=["$state","$mdDialog","$q","$translate","toasty","allConditions","allCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAllConditionDialogController",e)}(),function(){"use strict";function e(e,l,a,n,i,t,d,c,m){var u=this;function s(){var o,r;"voice"===u.trigger.channel?(_.some(u.anyConditions.rows,["field","queue"])&&(u.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,m.isAdmin()?c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){u.queues=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(c.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),u.queues=t}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.anyConditions.rows,["field","routeId"])&&(u.outboundRoutes||(m.isAdmin()?c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){u.outboundRoutes=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.outboundRoutes,{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),u.outboundRoutes=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("routeId"===e.field){var n=_.find(u.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<u.outboundRoutes.length;i++)_.some(a,{id:u.outboundRoutes[i].id})&&(u.outboundRoutes[i].canSelect=!1,t.push(u.outboundRoutes[i]));u.outboundRoutes=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}))),_.some(u.anyConditions.rows,["field","agent"])&&(u.agents||(m.isAdmin()?c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){u.agents=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u.agents,{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),u.agents=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("agent"===e.field){var n=_.find(u.agents,{name:e.value});a.push(n)}});for(var i=0;i<u.agents.length;i++)_.some(a,{id:u.agents[i].id})&&(u.agents[i].canSelect=!1,t.push(u.agents[i]));u.agents=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})})))):("mail"===u.trigger.channel&&c.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.mailSubstatuses=e.rows||[]}).catch(function(){d.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})}),function(){var e,s=u.trigger.channel+("chat"===u.trigger.channel?"Websites":"Accounts"),n=u.trigger.channel+("chat"===u.trigger.channel?"Website":"Account");switch(u.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}m.isAdmin()?c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):c[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){u[s]=e.rows||[]}).then(function(){return c.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return c.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(u[s],{id:e.resourceId})}),a=null;a=[],u.anyConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(u[s],{id:e.id});n.canSelect=!1,t.push(n)}}),u[s]=t})}else{var t=[],a=[];u.anyConditions.rows.forEach(function(e){if("account"===e.field){var n=_.find(u[s],{id:Number(e.value)});a.push(n)}});for(var i=0;i<u[s].length;i++)_.some(a,{id:u[s][i].id})&&(u[s][i].canSelect=!1,t.push(u[s][i]));u[s]=t}}).catch(function(e){d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+u.trigger.channel.toUpperCase()+u.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}())}function o(e){u.anyConditions=e||{count:0,rows:[]},s()}function r(){u.query.offset=(u.query.page-1)*u.query.limit,u.promise=c.trigger.getAnyConditions(u.query,o).$promise}function p(e,n){c.condition.delete({id:e.id}).$promise.then(function(){r(),n&&d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){u.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETtrigger"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}u.currentUser=m.getCurrentUser(),u.trigger={},u.anyConditions={count:0,rows:[]},u.selectedAnyConditions=[],u.query={fields:"id,field,operator,value,createdAt,updatedAt",limit:10,page:1},u.fields={queue:"Queue",lastevent:"Call_Status",routeId:"OutboundRoute",agent:"Agent",account:"Account",interaction:"Interaction",message:"Message",mailSubstatus:"Mail_Substatus",offlineMessage:"Offline_Message"},u.callStatuses={abandoned:"Abandon",timeout:"Timeout",complete:"Hangup",rejected:"Reject",called:"Ring",connect:"Answer",nosuchnumber:"NoSuchNumber",busy:"Busy",noanswer:"NoAnswer",congestion:"Congestion",agentreject:"AgentReject",amd:"AMD"},u.messageStatuses={in:"Incoming",out:"Outgoing",accept:"Accepted",reject:"Rejected"},u.onInit=function(e,n){u.trigger=e,u.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},u.query.TriggerAnyId=u.trigger.id,u.query.id=u.trigger.id,r()},u.success=o,u.getAnyConditions=r,u.createOrEditAnyCondition=function(e,n){i.show({controller:"CreateOrEditAnyConditionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/edit/anyconditions/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:u.trigger,anyCondition:n,anyConditions:u.anyConditions.rows,license:null,setting:null,crudPermissions:u.crudPermissions}}).then(function(e){e&&(u.anyConditions={count:e.length,rows:e},s())})},u.exportSelectedAnyConditions=function(){var e=angular.copy(u.selectedAnyConditions);return u.selectedAnyConditions=[],e},u.deleteConfirm=function(e,n){var t=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").targetEvent(n).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(t).then(function(){p(e,!0)})},u.deleteAnyCondition=p,u.deleteSelectedAnyConditions=function(e){var n=i.confirm().title(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_TITLE")).content(a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETE_MESSAGE",{total:u.selectedAnyConditions.length})).ariaLabel("Delete conditions").targetEvent(e).ok("OK").cancel(a.instant("TOOLS.CANCEL"));i.show(n).then(function(){u.selectedAnyConditions.forEach(function(e){p(e)}),u.selectedAnyConditions=[],d.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITIONS_DELETED_SUCCESS_TITLE")})})}}e.$inject=["$scope","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.tools").controller("TriggerAnyConditionsController",e)}(),function(){"use strict";function e(e,t,l,a,i,n,s,o,d,c,r,m,u){var p=this;function g(){switch(p.anyCondition.field){case"queue":p.queues||(o=[{id:401,type:"inbound"},{id:1501,type:"outbound"}],r=null,c.isAdmin()?d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){p.queues=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VOICEQUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){r=e.rows||[]}).then(function(){for(var e=[],n=0;n<o.length;n++)e.push(d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:o[n].id}).$promise);return l.all(e)}).then(function(e){for(var n=_.map(e,function(e){return e&&e.rows?e.rows[0]:null}),t=[],a=0;a<o.length;a++){var i=_.find(n,["sectionId",o[a].id]);if(i)if(i.autoAssociation){var s=[];r.forEach(function(e){e.type===o[a].type&&s.push(e)}),t.push({rows:s,count:s.length})}else t.push(d.userProfileResource.get({sectionId:i.id}).$promise.then(function(e){return{count:e.count,rows:_.map(e.rows,function(e){return e.id=e.resourceId,delete e.resourceId,e})}}))}return l.all(t)}).then(function(e){var t=[],a=[];p.anyConditions.forEach(function(e){if("queue"===e.field){var n=_.find(r,{name:e.value});a.push(n)}});for(var n=0;n<e.length;n++)(e[n].rows||[]).forEach(function(e){t.push(e)});_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(r,{id:e.id});n.canSelect=!1,t.push(n)}}),p.queues=t}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"routeId":p.outboundRoutes||(c.isAdmin()?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){p.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.outboundRoutes,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.outboundRoutes,{id:e.id});n.canSelect=!1,t.push(n)}}),p.outboundRoutes=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("routeId"===e.field){var n=_.find(p.outboundRoutes,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.outboundRoutes.length;i++)_.some(a,{id:p.outboundRoutes[i].id})&&(p.outboundRoutes[i].canSelect=!1,t.push(p.outboundRoutes[i]));p.outboundRoutes=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"agent":p.agents||(c.isAdmin()?d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.user.get({fields:"id,name,fullname",sort:"name",role:"agent",nolimit:"true"}).$promise.then(function(e){p.agents=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.agents,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.agents,{id:e.id});n.canSelect=!1,t.push(n)}}),p.agents=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("agent"===e.field){var n=_.find(p.agents,{name:e.value});a.push(n)}});for(var i=0;i<p.agents.length;i++)_.some(a,{id:p.agents[i].id})&&(p.agents[i].canSelect=!1,t.push(p.agents[i]));p.agents=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}));break;case"account":!function(){var e,n=p.trigger.channel+("chat"===p.trigger.channel?"Website":"Account");switch(p.trigger.channel){case"chat":e=502;break;case"fax":e=902;break;case"mail":e=602;break;case"openchannel":e=802;break;case"sms":e=702;break;case"whatsapp":e=2102}c.isAdmin()?d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d[n].get({fields:"id,name",sort:"id",nolimit:"true"}).$promise.then(function(e){p.accounts=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:e}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var t=_.map(e.rows,function(e){return _.find(p.accounts,{id:e.resourceId})}),a=null;a=[],p.anyConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}}),_.isEmpty(a)||a.forEach(function(e){if(!_.some(t,["id",e.id])){var n=_.find(p.accounts,{id:e.id});n.canSelect=!1,t.push(n)}}),p.accounts=t})}else{var t=[],a=[];p.anyConditions.forEach(function(e){if("account"===e.field){var n=_.find(p.accounts,{id:Number(e.value)});a.push(n)}});for(var i=0;i<p.accounts.length;i++)_.some(a,{id:p.accounts[i].id})&&(p.accounts[i].canSelect=!1,t.push(p.accounts[i]));p.accounts=t}}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_"+p.trigger.channel.toUpperCase()+p.trigger.channel=="chat"?"WEBSITES":"ACCOUNTS",msg:e.data?JSON.stringify(e.data):e.toString()})})}();break;case"mailSubstatus":d.mailSubstatus.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){p.mailSubstatuses=e.rows||[]}).catch(function(){i.error({title:a.instant("MAIL.SUBSTATUSES"),msg:a.instant("MAIL.NOTIFICATIONS.SUBSTATUSES_GET_ERROR")})})}var o,r}function v(e){t.hide(e)}p.currentUser=c.getCurrentUser(),p.anyCondition=angular.copy(s),p.anyConditions=angular.copy(n),p.setting=m,p.license=r,p.crudPermissions=u,p.hasModulePermissions={},p.newAnyCondition=!1,p.errors=[],p.trigger=angular.copy(o),p.anyCondition?g():(p.anyCondition={operator:"equals"},p.newAnyCondition=!0),p.anyCondition.TriggerAnyId=e.params.id||void 0,p.callStatuses=[{name:"Abandon",value:"abandoned"},{name:"Timeout",value:"timeout"},{name:"Hangup",value:"complete"},{name:"Reject",value:"rejected"},{name:"Ring",value:"called"},{name:"Answer",value:"connect"},{name:"NoSuchNumber",value:"nosuchnumber"},{name:"Busy",value:"busy"},{name:"NoAnswer",value:"noanswer"},{name:"Congestion",value:"congestion"},{name:"AgentReject",value:"agentreject"},{name:"AMD",value:"amd"}],p.onFieldSelection=function(){p.anyCondition.value=void 0,g()},p.addNewAnyCondition=function(){p.errors=[],d.trigger.addAnyCondition({id:e.params.id},p.anyCondition).$promise.then(function(e){p.anyConditions.unshift(e.toJSON()),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_CREATED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.saveAnyCondition=function(){p.errors=[],d.condition.update({id:p.anyCondition.id},p.anyCondition).$promise.then(function(){p.anyConditions=_.map(p.anyConditions,function(e){return e.id===p.anyCondition.id?p.anyCondition:e}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_SAVED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},p.deleteAnyCondition=function(e){p.errors=[];var n=t.confirm({skipHide:!0}).title(a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETE_TITLE")).ariaLabel("Delete condition").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){d.condition.delete({id:p.anyCondition.id}).$promise.then(function(){p.anyConditions=_.filter(p.anyConditions,function(e){return e.id!==p.allCondition.id}),i.success({title:a.instant("TOOLS.NOTIFICATIONS.CONDITION_DELETED_SUCCESS_TITLE")}),v(p.anyConditions)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){p.errors=e.data.errors||[{message:e.toString(),type:"api.condition.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.condition.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},p.closeDialog=v}e.$inject=["$state","$mdDialog","$q","$translate","toasty","anyConditions","anyCondition","trigger","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditAnyConditionDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;d.currentUser=o.getCurrentUser(),d.license=t,d.setting=a,d.trigger=r||e.params.trigger||{},d.selectedTab=e.params.tab||0,e.params.crudPermissions?d.crudPermissions=e.params.crudPermissions:(d.userProfileSection=l&&1==l.count?l.rows[0]:null,d.crudPermissions=o.parseCrudPermissions(d.userProfileSection?d.userProfileSection.crudPermissions:null)),d.gotoTriggers=function(){e.go("app.tools.triggers",{},{reload:"app.tools.triggers"})},d.saveTrigger=function(){i.trigger.update({id:d.trigger.id},d.trigger).$promise.then(function(){s.success({title:n.instant("TOOLS.NOTIFICATIONS.TRIGGER_SAVED_SUCCESS_TITLE")})}).catch(function(e){s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrigger",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$translate","license","setting","api","toasty","Auth","trigger","userProfileSection"],angular.module("app.tools").controller("TriggerController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){n.go("app.tools.triggers.edit",{id:e.id,trigger:e,crudPermissions:g.crudPermissions})}function h(e){g.triggers=e||{count:0,rows:[]}}function f(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.trigger.get(g.query,h).$promise:(g.query.id=g.userProfile.id,g.query.section="Triggers",g.promise=d.userProfile.getResources(g.query,h).$promise)}function b(e,n){d.trigger.delete({id:e.id}).$promise.then(function(){f(),n&&c.success({title:s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrigger"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrigger",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.triggers=o||{count:0,rows:[]},g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedTriggers=[],g.query={fields:"id,name,channel,status,description,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},g.goToEditState=v,g.createOrEditTrigger=function(e,n){if(g.crudPermissions.readOnly||g.crudPermissions.canDelete&&!g.crudPermissions.canEdit)return void v(n);a.show({controller:"CreateOrEditTriggerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/triggers/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{trigger:n,triggers:g.triggers.rows,license:g.license,setting:g.setting,crudPermissions:g.crudPermissions}}).then(function(e){e&&(g.triggers={count:e.length,rows:e})})},g.success=h,g.getTriggers=f,g.deleteconfirm=function(e,n){var t=a.confirm().title(s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_TITLE")).content(s.instant("TOOLS.NOTIFICATIONS.TRIGGER_DELETE_MESSAGE",{name:e.name})).ariaLabel("Delete trigger").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){b(e,!0)})},g.exportSelectedTriggers=function(){var e=angular.copy(g.selectedTriggers);return g.selectedTriggers=[],e},g.deleteSelectedTriggers=function(e){var n=a.confirm().title(s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETE_TITLE")).content(s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETE_MESSAGE",{total:g.selectedTriggers.length})).ariaLabel("Delete triggers").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedTriggers.forEach(function(e){b(e)}),g.selectedTriggers=[],c.success({title:s.instant("TOOLS.NOTIFICATIONS.TRIGGERS_DELETED_SUCCESS_TITLE")})})},g.deselectTriggers=function(){g.selectedTriggers=[]},g.selectAllTriggers=function(){g.selectedTriggers=g.triggers.rows};var A=!0,E=1;e.$watch("vm.query.filter",function(e,n){A?i(function(){A=!1}):(n||(E=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=E),f())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","triggers","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.tools").controller("TriggersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_TRUNK",g.trunk=angular.copy(l),g.trunks=r,g.newTrunk=!1,g.trunk||(g.trunk={active:!0,type:"friend",dtmfmode:"rfc2833",qualify:"yes",t38pt_udptl:"no"},g.title="TOOLS.NEW_TRUNK",g.newTrunk=!0),g.addNewTrunk=function(){g.errors=[],d.trunk.save(g.trunk).$promise.then(function(e){g.trunks.unshift(e.toJSON()),o.success({title:"Trunk properly created",msg:g.trunk.name?g.trunk.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveTrunk=function(){g.errors=[],d.trunk.update({id:g.trunk.id},g.trunk).$promise.then(function(e){var n=_.find(g.trunks,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Trunk properly saved!",msg:g.trunk.name?g.trunk.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteTrunk=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The trunk will be deleted.").ariaLabel("Delete Trunk").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.trunk.delete({id:g.trunk.id}).$promise.then(function(){_.remove(g.trunks,{id:g.trunk.id}),o.success({title:"Trunk properly deleted!",msg:(g.trunk.name||"trunk")+" has been deleted!"}),v(g.trunk)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","trunks","trunk","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditTrunkDialogController",e)}(),function(){"use strict";function e(n,t,a,e,i,s,o){var r=this;function l(e){n.hide(e)}r.newTrunk=!0,r.trunk=angular.copy(i),r.trunks=s,r.title=o.instant("TOOLS.CLONE_TRUNK"),i&&i.name&&(r.title+=": "+i.name),r.cloneTrunk=function(){return e.trunk.clone({id:i.id},r.trunk).$promise.then(function(e){r.trunks.unshift(e.toJSON()),a.success({title:"Trunk properly cloned",msg:r.trunk.name?r.trunk.name+" has been cloned!":""}),t.go("app.tools.trunks.edit",{id:e.id}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.trunk.clone"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.trunk.clone",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.closeDialog=l}e.$inject=["$mdDialog","$state","toasty","api","trunk","trunks","$translate"],angular.module("app.tools").controller("TrunkcloneController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.trunk=c||t.params.trunk||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.trunks",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.trunks",{})}},u.clonedialog=function(e,n){a.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{trunk:e,trunks:u.trunks?u.trunks.rows:[],crudPermissions:u.crudPermissions}})},u.alert=l.info,u.gotoTrunks=function(){t.go("app.tools.trunks",{},{reload:"app.tools.trunks"})},u.saveTrunk=function(){r.trunk.update({id:u.trunk.id},u.trunk).$promise.then(function(){l.success({title:"Trunk updated!",msg:u.trunk.name?u.trunk.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtrunk",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.trunk&&(t=_.find(u.contexts,{name:u.trunk.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","trunk","userProfileSection"],angular.module("app.tools").controller("TrunkController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.trunks=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="trunks",f.listOrder="",f.listOrderAsc=null,f.selectedTrunks=[],f.query={fields:"createdAt,updatedAt,id,name,active,host,secret,defaultuser,context,callerid,type,dtmfmode,nat,qualify,allow,insecure,call_limit,registry,description,directmedia,callcounter,fromdomain,fromuser,outboundproxy,usereqphone,trustrpid,sendrpid,encryption,port,transport,t38pt_udptl,videosupport,otherFields",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Friend",value:"'friend'"},{option:"User",value:"'user'"},{option:"Peer",value:"'peer'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydtmfmode=_.keyBy([{option:"rfc2833",value:"'rfc2833'"},{option:"info",value:"'info'"},{option:"shortinfo",value:"'shortinfo'"},{option:"inband",value:"'inband'"},{option:"auto",value:"'auto'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraynat=_.keyBy([{option:"force_rport",value:"'force_rport'"},{option:"comedia",value:"'comedia'"},{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"never",value:"'never'"},{option:"route",value:"'route'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayqualify=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayallow=_.keyBy([{option:"ulaw",value:"'ulaw'"},{option:"alaw",value:"'alaw'"},{option:"gsm",value:"'gsm'"},{option:"g723",value:"'g723'"},{option:"g726",value:"'g726'"},{option:"g722",value:"'g722'"},{option:"g729",value:"'g729'"},{option:"ilbc",value:"'ilbc'"},{option:"opus",value:"'opus'"},{option:"h264",value:"'h264'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayinsecure=_.keyBy([{option:"port",value:"'port'"},{option:"invite",value:"'invite'"},{option:"very",value:"'very'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydirectmedia=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"nonat",value:"'nonat'"},{option:"update",value:"'update'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraycallcounter=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayusereqphone=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytrustrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysendrpid=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"},{option:"pai",value:"'pai'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayencryption=_.keyBy([{option:"yes",value:"'yes'"},{option:"no",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytransport=_.keyBy([{option:"udp",value:"'udp'"},{option:"tcp",value:"'tcp'"},{option:"ws",value:"'ws'"},{option:"wss",value:"'wss'"},{option:"tls",value:"'tls'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayvideosupport=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Always",value:"'always'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.tools.trunks.edit",{id:e.id,trunk:e,crudPermissions:f.crudPermissions})},f.clonedialog=function(e,n){i.show({controller:"TrunkcloneController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/edit/clone/clone.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{trunk:e,trunks:f.trunks?f.trunks.rows:[],crudPermissions:f.crudPermissions}})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.trunks",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.trunks",{})}},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("trunk")+"?").htmlContent("<b>"+(e.name||"trunk")+"</b> will be deleted.").ariaLabel("delete trunk").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getTrunks=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.trunk.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Trunks",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditTrunk=function(e,n){i.show({controller:"CreateOrEditTrunkDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/trunks/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{trunk:n,trunks:f.trunks.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteTrunk=y,f.exportSelectedTrunks=function(){var e=angular.copy(f.selectedTrunks);return f.selectedTrunks=[],e},f.deleteSelectedTrunks=function(e){var n=i.confirm().title("Are you sure want to delete the selected trunks?").htmlContent("<b>"+f.selectedTrunks.length+" selected</b> will be deleted.").ariaLabel("delete Trunks").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedTrunks.forEach(function(e){y(e)}),f.selectedTrunks=[]})},f.deselectTrunks=function(){f.selectedTrunks=[]},f.selectAllTrunks=function(){f.selectedTrunks=f.trunks.rows};var b=!0,A=1;function E(e){f.trunks=e||{count:0,rows:[]}}function y(e){m.trunk.delete({id:e.id}).$promise.then(function(){_.remove(f.trunks.rows,{id:e.id}),f.trunks.count-=1,f.trunks.rows.length||f.getTrunks(),p.success({title:_.startCase("Trunk")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEtrunk"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEtrunk",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getTrunks())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","trunks","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("TrunksController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="TOOLS.EDIT_VARIABLE",g.variable=angular.copy(l),g.variables=r,g.newVariable=!1,g.variable||(g.variable={},g.title="TOOLS.NEW_VARIABLE",g.newVariable=!0),g.addNewVariable=function(){g.errors=[],d.variable.save(g.variable).$promise.then(function(e){g.variables.unshift(e.toJSON()),o.success({title:"Variable properly created",msg:g.variable.name?g.variable.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVariable=function(){g.errors=[],d.variable.update({id:g.variable.id},g.variable).$promise.then(function(e){var n=_.find(g.variables,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Variable properly saved!",msg:g.variable.name?g.variable.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVariable=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The variable will be deleted.").ariaLabel("Delete Variable").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.variable.delete({id:g.variable.id}).$promise.then(function(){_.remove(g.variables,{id:g.variable.id}),o.success({title:"Variable properly deleted!",msg:(g.variable.name||"variable")+" has been deleted!"}),v(g.variable)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.variable.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.variable.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","variables","variable","api","Auth","license","setting","crudPermissions"],angular.module("app.tools").controller("CreateOrEditVariableDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.variables=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="variables",f.listOrder="",f.listOrderAsc=null,f.selectedVariables=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{variable:e,variables:f.variables.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("variable")+"?").htmlContent("<b>"+(e.name||"variable")+"</b> will be deleted.").ariaLabel("delete variable").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVariables=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.variable.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Variables",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVariable=function(e,n){i.show({controller:"CreateOrEditVariableDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/variables/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{variable:n,variables:f.variables.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVariable=y,f.exportSelectedVariables=function(){var e=angular.copy(f.selectedVariables);return f.selectedVariables=[],e},f.deleteSelectedVariables=function(e){var n=i.confirm().title("Are you sure want to delete the selected variables?").htmlContent("<b>"+f.selectedVariables.length+" selected</b> will be deleted.").ariaLabel("delete Variables").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVariables.forEach(function(e){y(e)}),f.selectedVariables=[]})},f.deselectVariables=function(){f.selectedVariables=[]},f.selectAllVariables=function(){f.selectedVariables=f.variables.rows};var b=!0,A=1;function E(e){f.variables=e||{count:0,rows:[]}}function y(e){m.variable.delete({id:e.id}).$promise.then(function(){_.remove(f.variables.rows,{id:e.id}),f.variables.count-=1,f.variables.rows.length||f.getVariables(),p.success({title:_.startCase("Variable")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvariable"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvariable",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVariables())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","variables","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.tools").controller("VariablesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VIDEO.EDIT_SCREENRECORDING",g.screenRecording=angular.copy(l),g.screenRecordings=r,g.newscreenRecording=!1,g.screenRecording||(g.screenRecording={},g.title="VIDEO.NEW_SCREENRECORDING",g.newscreenRecording=!0),g.addNewscreenRecording=function(){g.errors=[],d.screenRecording.save(g.screenRecording).$promise.then(function(e){g.screenRecordings.unshift(e.toJSON()),o.success({title:"screenRecording properly created",msg:g.screenRecording.name?g.screenRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savescreenRecording=function(){g.errors=[],d.screenRecording.update({id:g.screenRecording.id},g.screenRecording).$promise.then(function(e){var n=_.find(g.screenRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"screenRecording properly saved!",msg:g.screenRecording.name?g.screenRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletescreenRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The screenRecording will be deleted.").ariaLabel("Delete screenRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.screenRecording.delete({id:g.screenRecording.id}).$promise.then(function(){_.remove(g.screenRecordings,{id:g.screenRecording.id}),o.success({title:"screenRecording properly deleted!",msg:(g.screenRecording.name||"screenRecording")+" has been deleted!"}),v(g.screenRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.screenRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,d.user.get({fields:"id,name,fullname",sort:"name",nolimit:"true"}).$promise.then(function(e){g.users=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","screenRecordings","screenRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.video").controller("CreateOrEditscreenRecordingDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c,m=this;if(m.loading=!1,m.recording=Object.assign({},i),m.route="screenRecording",m.element=l,m.actionOptions=Object.assign({},s),m.path=r,m.label=o,m.app="video",m.model="screenRecording",console.log("TCL: vm.path",m.path),console.log("TCL: vm.recording[vm.path]",m.recording[m.path]),m.filename=-1<m.recording[m.path].indexOf("/")?m.recording[m.path].substring(m.recording[m.path].lastIndexOf("/")+1):-1<m.recording[m.path].indexOf("\\")?m.recording[m.path].substring(m.recording[m.path].lastIndexOf("\\")+1):m.recording[m.path],m.format=!1,_.isNil(m.recording.format)&&(m.recording.format=m.filename.slice(m.filename.lastIndexOf("."))),(".wav"===m.recording.format&&"audio"===m.element||".mp4"===m.recording.format&&"video"===m.element)&&(m.format=!0),m.found=!0,m.format&&(c=d.defer(),a.screenRecording.download({id:m.recording.id,path:String(m.path)}).$promise.then(function(e){m.format=!0,m.found=!0,c.resolve()}).catch(function(e){console.log("err"),m.format=!1,m.found=!1,c.resolve()}),c.promise),!_.isNil(s.properties)&&s.properties){if(m.properties=Object.assign({},i),Object.keys(i).forEach(function(e){String(e[0].toUpperCase())===String(e[0])&&delete m.properties[e]}),m.propertiesDefault={},!_.isNil(s.propertiesList)&&0<s.propertiesList.length){m.propertiesDefault=Object.assign({},i);var u=s.propertiesList,p=Object.keys(i),g=!0;p.forEach(function(n){g=!0,u.forEach(function(e){String(n)===String(e)&&(g=!1)}),g&&delete m.propertiesDefault[n]}),m.properties=m.propertiesDefault}if(!_.isNil(s.extraData)&&0<s.extraData.length){m.propertiesExtra={};for(var v=s.extraData,h=0;h<v.length;h++)for(var f=v[h].values,b=v[h].model,A=0;A<f.length;A++)m.propertiesExtra[f[A].text]=i[b][f[A].key];m.properties=Object.assign({},m.propertiesDefault,m.propertiesExtra)}}m.closeDialog=function(){n.hide()}}e.$inject=["$scope","$mdDialog","toasty","api","recording","actionOptions","label","varPath","elementTag","$q"],angular.module("app.video").controller("screenRecordingplayController",e)}(),function(){"use strict";function e(e,n,t,a,r,l,i,o,s,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.screenRecordings=s||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="screenRecordings",f.listOrder="",f.listOrderAsc=null,f.selectedScreenRecordings=[],f.query={fields:"createdAt,updatedAt,id,interactionid,channel,format,value,rating,UserId,duration,startedAt,closedAt",createdAt:"@msUtils.firstLastDayMonth()",includeAll:"true",sort:"-updatedAt",limit:10,page:1},f.query.createdAt=u.firstLastDayMonth(),f.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE_RANGE"}],f.playrecording=function(e,n,t,a,i){var s={route:"screenRecording",name:"screenRecordings",model:"screenRecording",singular:"screenRecording"},a=String(a),o=String(t);console.log("TCL:  path",String(t)),r.show({controller:"screenRecordingplayController",controllerAs:"vm",templateUrl:"app/main/apps/video/views/screenRecordings/partialViews/play.html",parent:angular.element(l.body),targetEvent:n,clickOutsideToClose:!0,locals:{recording:e,recordings:f.screenRecordings.rows,license:f.license,setting:null,item:s,actionOptions:{upperTitle:!1,lowerTitle:!0,properties:!0,propertiesIcon:"icon-video",propertiesList:["format","interactionid","duration","startedAt","closedAt","createdAt"],extraData:[{model:"User",values:[{key:"name",text:"agentname"}]}]},label:a,varPath:o,elementTag:String(i)}})},f.downloadfile2=function(e,n){var t=!1,a=_.isNil(e.format)?e.value.substring(e.value.lastIndexOf(".")):e.format;t=".mp4"===a;var s=-1<e.value.lastIndexOf("/")?e.value.substring(e.value.lastIndexOf("/")+1):-1<e.value.lastIndexOf("\\")?e.value.substring(e.value.lastIndexOf("\\")+1):e.value;return m.screenRecording.download({id:e.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:o.instant("VIDEO.CANT_DOWNLOAD_THIS_FILE"),msg:o.instant("VIDEO.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:o.instant("VIDEO.CANT_DOWNLOAD_THIS_FILE"),msg:o.instant("VIDEO.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.screenRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},f.deleteconfirm=function(e,n){var t=r.confirm().title("Are you sure want to delete the "+_.startCase("screenRecording")+"?").htmlContent("<b>"+(e.name||"screenRecording")+"</b> will be deleted.").ariaLabel("delete screenRecording").targetEvent(n).ok("OK").cancel("CANCEL");r.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getScreenRecordings=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.screenRecording.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ScreenRecordings",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditscreenRecording=function(e,n){r.show({controller:"CreateOrEditscreenRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/video/views/screenRecordings/create/dialog.html",parent:angular.element(l.body),targetEvent:e,clickOutsideToClose:!0,locals:{screenRecording:n,screenRecordings:f.screenRecordings.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletescreenRecording=y,f.exportSelectedScreenRecordings=function(){var e=angular.copy(f.selectedScreenRecordings);return f.selectedScreenRecordings=[],e},f.deleteSelectedScreenRecordings=function(e){var n=r.confirm().title("Are you sure want to delete the selected screenRecordings?").htmlContent("<b>"+f.selectedScreenRecordings.length+" selected</b> will be deleted.").ariaLabel("delete screenRecordings").targetEvent(e).ok("OK").cancel("CANCEL");r.show(n).then(function(){f.selectedScreenRecordings.forEach(function(e){y(e)}),f.selectedScreenRecordings=[]})},f.deselectScreenRecordings=function(){f.selectedScreenRecordings=[]},f.selectAllScreenRecordings=function(){f.selectedScreenRecordings=f.screenRecordings.rows},f.convertDuration=function(e){var n=Math.floor(e/1e3%60),t=Math.floor(e/6e4%60),a=Math.floor(e/36e5%24),i=a<10?"0"+String(a):String(a),s=t<10?"0"+String(t):String(t),o=n<10?"0"+String(n):String(n);return i+":"+s+":"+o},m.user.get({fields:"id,name,fullname",sort:"name",nolimit:"true"}).$promise.then(function(e){f.users=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_USERS",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.screenRecordings=e||{count:0,rows:[]}}function y(e){m.screenRecording.delete({id:e.id}).$promise.then(function(){_.remove(f.screenRecordings.rows,{id:e.id}),f.screenRecordings.count-=1,f.screenRecordings.rows.length||f.getScreenRecordings(),p.success({title:_.startCase("screenRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEscreenRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEscreenRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getScreenRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","screenRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.video").controller("ScreenRecordingsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l){var d=this;function c(e){return _.isEmpty(e)||isNaN(e)?e:parseInt(e,10)}function m(e){switch(e){case"sound":if(!d.application.appdata)return;return[{key:"save_name",value:d.application.appdata.split("/").pop()}];case"squareProject":if(!d.application.project)return;return[{key:"name",value:d.application.project.split(",")[1]}];case"tag":if(!d.application.tag)return;return[{key:"name",value:d.application.tag}];case"trunk":if(!d.application.trunk)return;return[{key:"name",value:d.application.trunk}];case"user":if(!d.application.user&&!d.application.users)return;return d.application.user?[{key:"name",value:d.application.user.split("/")[1]}]:_.map(d.application.users,function(e){return{key:"name",value:e.split("/")[1]}});case"variable":if(!d.application.name)return;return[{key:"name",value:d.application.name}];case"voiceContext":if(!d.application.context)return;return[{key:"name",value:d.application.context}];case"voiceMail":if(!d.application.voiceMail)return;return[{key:"mailbox",value:d.application.voiceMail.split("@")[0]}];case"voiceQueue":if(!d.application.queue)return;return[{key:"name",value:d.application.queue}]}}function u(){o.getResourcesByRole(d.currentUser,"trunk",{fields:"id,name",sort:"name",nolimit:"true"},m("trunk")).then(function(e){d.trunks=e}).catch(function(){s.error({title:i.instant("TOOLS.TRUNKS"),msg:i.instant("VOICE.NOTIFICATIONS.TRUNKS_GET_ERROR")})})}function p(){o.getResourcesByRole(d.currentUser,"sound",{fields:"id,name,save_name",sort:"name",nolimit:"true"},m("sound")).then(function(e){d.sounds=e}).catch(function(){s.error({title:i.instant("TOOLS.SOUNDS"),msg:i.instant("VOICE.NOTIFICATIONS.SOUNDS_GET_ERROR")})})}function g(){var e={fields:"id,name,role",sort:"name",nolimit:"true"},n=m("user"),t=[o.getResourcesByRole(d.currentUser,"user",_.merge(e,{role:"agent"}),n,"Agents"),o.getResourcesByRole(d.currentUser,"user",_.merge(e,{role:"telephone"}),n,"Telephones")];a.all(t).then(function(e){var n=_(e).flatMap(function(e){return e.rows}).orderBy([function(e){return e.name.toLowerCase()}]).value();d.users={rows:n,count:n.length}}).catch(function(){s.error({title:i.instant("STAFF.USERS"),msg:i.instant("VOICE.NOTIFICATIONS.USERS_GET_ERROR")})})}function v(){(d.application.appdata||"custom"===d.application.appType)&&e.hide(d.application),e.hide()}d.currentUser=r.getCurrentUser(),d.application=angular.copy(n),d.crudPermissions=l,d.errors=[],d.init=function(){d.application.appdata&&function(){var e=[];switch(d.application.appType){case"agi":d.application.project=d.application.appdata;break;case"dial":e=d.application.appdata.split(","),d.application.tech=c(e[0]),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"externalDial":e=d.application.appdata.split(","),d.application.trunk=e[0].split("/")[1],d.application.phone=e[0].split("/")[2],d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"goTo":e=d.application.appdata.split(","),d.application.context=c(e[0]),d.application.extension=c(e[1]),d.application.priority=c(e[2]);break;case"internalDial":e=d.application.appdata.split(","),d.application.user=c(e[0]),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"outboundDial":e=d.application.appdata.split(","),d.application.trunk=e[0].split("/")[1],d.application.phone=e[0].split("/")[2],d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]),d.application.prefix=d.application.phone?d.application.phone.split("$")[0]:void 0,d.application.callerId=d.application.callerID?"CALLERID(all)="+d.application.callerID:void 0;break;case"playback":e=d.application.appdata.split(","),d.application.appdata=c(e[0]),d.application.options=c(e[1]);break;case"queue":e=d.application.appdata.split(","),d.application.queue=c(e[0]),d.application.options=c(e[1]),d.application.URL=c(e[2]),d.application.sound=c(e[3]),d.application.timeout=c(e[4]),d.application.agi=c(e[5]),d.application.macro=c(e[6]),d.application.gosub=c(e[7]),d.application.rule=c(e[8]),d.application.position=c(e[9]);break;case"ringGroup":e=d.application.appdata.split(","),d.application.users=e[0].split("&"),d.application.timeout=c(e[1]),d.application.options=c(e[2]),d.application.url=c(e[3]);break;case"set":e=d.application.appdata.split("="),d.application.name=e[0],d.application.value=e[1];break;case"voicemail":e=d.application.appdata.split(","),d.application.voiceMail=c(e[0]),d.application.options=c(e[1])}}();switch(d.application.appType){case"agi":o.getResourcesByRole(d.currentUser,"squareProject",{fields:"id,name",sort:"name",nolimit:"true"},m("squareProject")).then(function(e){d.projects=e}).catch(function(){s.error({title:i.instant("CALLYSQUARE.CALLYSQUARE")+" "+i.instant("CALLYSQUARE.PROJECTS"),msg:i.instant("VOICE.NOTIFICATIONS.CALLYSQUARE_PROJECTS_GET_ERROR")})});break;case"externalDial":u();break;case"goTo":o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:"true"},m("voiceContext")).then(function(e){d.contexts=e}).catch(function(){s.error({title:i.instant("VOICE.CONTEXTS"),msg:i.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});break;case"internalDial":g();break;case"outboundDial":o.getResourcesByRole(d.currentUser,"tag",{fields:"id,name",sort:"name",nolimit:"true"},m("tag")).then(function(e){d.tags=e}).catch(function(){s.error({title:i.instant("TOOLS.TAGS"),msg:i.instant("VOICE.NOTIFICATIONS.TAGS_GET_ERROR")})}),u();break;case"playback":p();break;case"queue":p(),o.getResourcesByRole(d.currentUser,"voiceQueue",{type:"inbound",fields:"id,name,type",sort:"name",nolimit:"true"},m("voiceQueue")).then(function(e){d.queues=e}).catch(function(){s.error({title:i.instant("VOICE.VOICEQUEUES"),msg:i.instant("VOICE.NOTIFICATIONS.QUEUES_GET_ERROR")})});break;case"ringGroup":g();break;case"set":o.getResourcesByRole(d.currentUser,"variable",{fields:"id,name",sort:"name",nolimit:"true"},m("variable")).then(function(e){d.variables=e}).catch(function(){s.error({title:i.instant("TOOLS.VARIABLES"),msg:i.instant("VOICE.NOTIFICATIONS.VARIABLES_GET_ERROR")})});break;case"voicemail":o.getResourcesByRole(d.currentUser,"voiceMail",{fields:"id,mailbox",sort:"mailbox",nolimit:"true"},m("voiceMail")).then(function(e){d.voiceMails=e}).catch(function(){s.error({title:i.instant("VOICE.VOICEMAILS"),msg:i.instant("VOICE.NOTIFICATIONS.VOICEMAILS_GET_ERROR")})})}},d.saveRoutingApp=function(){d.errors=[],function(){var e=[];switch(d.application.appType){case"agi":d.application.appdata=d.application.project;break;case"dial":e[0]=d.application.tech,e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"externalDial":e[0]=["SIP",d.application.trunk,d.application.phone].join("/"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"goTo":e[0]=d.application.context,e[1]=d.application.extension,e[2]=d.application.priority,d.application.appdata=e.join(",");break;case"internalDial":e[0]=d.application.user,e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"outboundDial":d.application.phone=t.cutdigits?(d.application.prefix||"")+"${EXTEN:"+t.cutdigits+"}":(d.application.prefix||"")+"${EXTEN}","none"===t.recordingFormat?d.application.options=d.application.options.replace("U(xcally-mixmonitor-context)",""):d.application.options.indexOf("U(xcally-mixmonitor-context)")<0&&(d.application.options+="U(xcally-mixmonitor-context)"),e[0]=["SIP",d.application.trunk,d.application.phone].join("/"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"playback":e[0]=d.application.appdata,e[1]=d.application.options,d.application.appdata=e.join(",");break;case"queue":e[0]=d.application.queue,e[1]=d.application.options,e[2]=d.application.URL,e[3]=d.application.sound,e[4]=d.application.timeout,e[5]=d.application.agi,e[6]=d.application.macro,e[7]=d.application.gosub,e[8]=d.application.rule,e[9]=d.application.position,d.application.appdata=e.join(",");break;case"ringGroup":e[0]=d.application.users.join("&"),e[1]=d.application.timeout,e[2]=d.application.options,e[3]=d.application.url,d.application.appdata=e.join(",");break;case"set":e[0]=d.application.name,e[1]=d.application.value,d.application.appdata=e.join("=");break;case"voicemail":e[0]=d.application.voiceMail,e[1]=d.application.options,d.application.appdata=e.join(",")}}(),v()},d.closeDialog=v}e.$inject=["$mdDialog","$q","$translate","toasty","application","route","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditRoutingAppDialogController",e)}(),function(){"use strict";function e(n,t,e,a,i,s,o,r,l){var d=this;function c(){var e=[{key:"name",value:d.interval.IntervalId}];s.getResourcesByRole(d.currentUser,"interval",{fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0},e).then(function(e){d.intervals=e}).catch(function(){i.error({title:t.instant("TOOLS.INTERVALS"),msg:t.instant("VOICE.NOTIFICATIONS.INTERVALS_GET_ERROR")})})}function m(e){n.hide(e)}d.currentUser=o.getCurrentUser(),d.interval=angular.copy(e),d.intervals=a||{rows:[],count:0},d.types=["always","custom","list"],d.crudPermissions=r,d.errors=[],d.daysOfWeek=l.getDaysOfWeek(),d.monthNumber=l.getMonthNumber(),d.monthName=l.getMonthName(),d.daysOfMonth=l.getDaysOfMonth(),d.initialize=function(){if("*,*,*,*"===d.interval.interval)return d.type=d.interval.IntervalId&&d.interval.application?"list":"always",void("list"===d.type&&c());d.type="custom";var e=d.interval.interval.split(","),n=e[0],t=e[1],a=e[2],i=e[3];if("*"!==n){var s,o=n.split("-")[0],r=n.split("-")[1];(s=new Date).setHours(Number(o.split(":")[0])),s.setMinutes(Number(o.split(":")[1])),d.timeRangeFrom=s,(s=new Date).setHours(Number(r.split(":")[0])),s.setMinutes(Number(r.split(":")[1])),d.timeRangeTo=s}"*"!==t&&(d.dayOfWeekFrom=t.split("-")[0],d.dayOfWeekTo=t.split("-")[1]);"*"!==a&&(d.monthDayFrom=a.split("-")[0],d.monthDayTo=a.split("-")[1]);"*"!==i&&(d.monthFrom=i.split("-")[0],d.monthTo=i.split("-")[1])},d.onTypeChange=function(){"list"===d.type&&0===d.intervals.count&&c()},d.saveInterval=function(){d.errors=[],d.interval.interval=function(){if(["always","list"].includes(d.type))return"*,*,*,*";var e=[];if("*"!==d.timeRangeFrom&&d.timeRangeFrom&&d.timeRangeTo){var n=(d.timeRangeFrom.getHours()<10?"0":"")+d.timeRangeFrom.getHours()+":"+(d.timeRangeFrom.getMinutes()<10?"0":"")+d.timeRangeFrom.getMinutes(),t=(d.timeRangeTo.getHours()<10?"0":"")+d.timeRangeTo.getHours()+":"+(d.timeRangeTo.getMinutes()<10?"0":"")+d.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return d.dayOfWeekFrom?d.dayOfWeekTo?e.push(d.dayOfWeekFrom+"-"+d.dayOfWeekTo):e.push(d.dayOfWeekFrom):e.push("*"),d.monthDayFrom?d.monthDayTo?e.push(d.monthDayFrom+"-"+d.monthDayTo):e.push(d.monthDayFrom):e.push("*"),d.monthFrom?d.monthTo?e.push(d.monthFrom+"-"+d.monthTo):e.push(d.monthFrom):e.push("*"),e.join()}(),"list"!==d.type&&(d.interval.IntervalId=null);m(d.interval)},d.closeDialog=m}e.$inject=["$mdDialog","$translate","interval","intervals","toasty","api","Auth","crudPermissions","IndexFactory"],angular.module("app.voice").controller("EditRoutingIntervalDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.chanSpies=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="chanSpies",f.listOrder="",f.listOrderAsc=null,f.selectedChanSpies=[],f.query={fields:"createdAt,updatedAt,id,name,prefix,options,auth,password,record,recordingFormat,description",sort:"-updatedAt",limit:10,page:1},f.arrayoptions=_.keyBy([{option:"b: Only spy on channels involved in a bridged call.",value:"'b'"},{option:"B: Instead of whispering on a single channel barge in on both channels involved in the call.",value:"'B'"},{option:"E: Exit when the spied-on channel hangs up.",value:"'E'"},{option:"o: Only listen to audio coming from this channel.",value:"'o'"},{option:"q: Don't play a beep when beginning to spy on a channel, or speak the selected channel name.",value:"'q'"},{option:"s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.",value:"'s'"},{option:"S: Stop when no more channels are left to spy on.",value:"'S'"},{option:"w: Enable whisper mode, so the spying channel can talk to the spied-on channel.",value:"'w'"},{option:"W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.",value:"'W'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayrecordingFormat=_.keyBy([{option:"wav",value:"'wav'"},{option:"gsm",value:"'gsm'"},{option:"wav49",value:"'WAV'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editdialog=function(e,n){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{chanSpy:e,chanSpies:f.chanSpies.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("chanSpy")+"?").htmlContent("<b>"+(e.name||"chanSpy")+"</b> will be deleted.").ariaLabel("delete chanSpy").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getChanSpies=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceChanSpy.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="ChanSpies",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditchanSpy=function(e,n){i.show({controller:"CreateOrEditchanSpyDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/chanSpies/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{chanSpy:n,chanSpies:f.chanSpies.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletechanSpy=y,f.exportSelectedChanSpies=function(){var e=angular.copy(f.selectedChanSpies);return f.selectedChanSpies=[],e},f.deleteSelectedChanSpies=function(e){var n=i.confirm().title("Are you sure want to delete the selected chanSpies?").htmlContent("<b>"+f.selectedChanSpies.length+" selected</b> will be deleted.").ariaLabel("delete chanSpys").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedChanSpies.forEach(function(e){y(e)}),f.selectedChanSpies=[]})},f.deselectChanSpies=function(){f.selectedChanSpies=[]},f.selectAllChanSpies=function(){f.selectedChanSpies=f.chanSpies.rows};var b=!0,A=1;function E(e){f.chanSpies=e||{count:0,rows:[]}}function y(e){m.voiceChanSpy.delete({id:e.id}).$promise.then(function(){_.remove(f.chanSpies.rows,{id:e.id}),f.chanSpies.count-=1,f.chanSpies.rows.length||f.getChanSpies(),p.success({title:_.startCase("chanSpy")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceChanSpy"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceChanSpy",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getChanSpies())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","chanSpies","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("ChanSpiesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_CHANSPY",g.chanSpy=angular.copy(l),g.chanSpies=r,g.newchanSpy=!1,g.chanSpy||(g.chanSpy={recordingFormat:"wav"},g.title="VOICE.NEW_CHANSPY",g.newchanSpy=!0),g.addNewchanSpy=function(){g.errors=[],d.voiceChanSpy.save(g.chanSpy).$promise.then(function(e){g.chanSpies.unshift(e.toJSON()),o.success({title:"chanSpy properly created",msg:g.chanSpy.name?g.chanSpy.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savechanSpy=function(){g.errors=[],d.voiceChanSpy.update({id:g.chanSpy.id},g.chanSpy).$promise.then(function(e){var n=_.find(g.chanSpies,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"chanSpy properly saved!",msg:g.chanSpy.name?g.chanSpy.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletechanSpy=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The chanSpy will be deleted.").ariaLabel("Delete chanSpy").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceChanSpy.delete({id:g.chanSpy.id}).$promise.then(function(){_.remove(g.chanSpies,{id:g.chanSpy.id}),o.success({title:"chanSpy properly deleted!",msg:(g.chanSpy.name||"chanSpy")+" has been deleted!"}),v(g.chanSpy)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceChanSpy.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceChanSpy.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","chanSpies","chanSpy","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditchanSpyDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.contexts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="contexts",f.listOrder="",f.listOrderAsc=null,f.selectedContexts=[],f.query={fields:"createdAt,updatedAt,id,name,description",sort:"-updatedAt",defaultEntry:"false",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{context:e,contexts:f.contexts.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("context")+"?").htmlContent("<b>"+(e.name||"context")+"</b> will be deleted.").ariaLabel("delete context").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getContexts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceContext.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Contexts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditContext=function(e,n){i.show({controller:"CreateOrEditContextDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/contexts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{context:n,contexts:f.contexts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteContext=y,f.exportSelectedContexts=function(){var e=angular.copy(f.selectedContexts);return f.selectedContexts=[],e},f.deleteSelectedContexts=function(e){var n=i.confirm().title("Are you sure want to delete the selected contexts?").htmlContent("<b>"+f.selectedContexts.length+" selected</b> will be deleted.").ariaLabel("delete Contexts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedContexts.forEach(function(e){y(e)}),f.selectedContexts=[]})},f.deselectContexts=function(){f.selectedContexts=[]},f.selectAllContexts=function(){f.selectedContexts=f.contexts.rows};var b=!0,A=1;function E(e){f.contexts=e||{count:0,rows:[]}}function y(e){m.voiceContext.delete({id:e.id}).$promise.then(function(){_.remove(f.contexts.rows,{id:e.id}),f.contexts.count-=1,f.contexts.rows.length||f.getContexts(),p.success({title:_.startCase("Context")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceContext"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceContext",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getContexts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","contexts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("ContextsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_CONTEXT",g.context=angular.copy(l),g.contexts=r,g.newContext=!1,g.context||(g.context={},g.title="VOICE.NEW_CONTEXT",g.newContext=!0),g.addNewContext=function(){g.errors=[],d.voiceContext.save(g.context).$promise.then(function(e){g.contexts.unshift(e.toJSON()),o.success({title:"Context properly created",msg:g.context.name?g.context.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveContext=function(){g.errors=[],d.voiceContext.update({id:g.context.id},g.context).$promise.then(function(e){var n=_.find(g.contexts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Context properly saved!",msg:g.context.name?g.context.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteContext=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The context will be deleted.").ariaLabel("Delete Context").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceContext.delete({id:g.context.id}).$promise.then(function(){_.remove(g.contexts,{id:g.context.id}),o.success({title:"Context properly deleted!",msg:(g.context.name||"context")+" has been deleted!"}),v(g.context)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceContext.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceContext.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","contexts","context","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditContextDialogController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.inboundRoute=angular.copy(s),d.inboundRoutes=n,d.newInboundRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.inboundRoute||(d.inboundRoute={appdata:"Inbound Call",type:"inbound",context:"from-voip-provider"},d.newInboundRoute=!0);e=[{key:"name",value:d.inboundRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newInboundRoute)return;var e={sort:"priority",VoiceExtensionId:d.inboundRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewInboundRoute=function(){d.errors=[],o.voiceExtension.save(d.inboundRoute).$promise.then(function(e){c(e.id).then(function(){d.inboundRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveInboundRoute=function(){d.errors=[],o.voiceExtension.update({id:d.inboundRoute.id},d.inboundRoute).$promise.then(function(e){var n=_.find(d.inboundRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.inboundRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteInboundRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.inboundRoute.exten})).ariaLabel("Delete inbound route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.inboundRoute.id}).$promise.then(function(){_.remove(d.inboundRoutes,{id:d.inboundRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.inboundRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","inboundRoutes","inboundRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInboundRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.inboundRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.inboundRoute=l||e.params.inboundRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.inboundRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"AGI",appAlias:"CallySquare",appType:"agi",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"Dial",appType:"dial",context:"from-sip",type:"Inbound",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Inbound",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Inbound",interval:"*,*,*,*",options:"xX"},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Inbound",interval:"*,*,*,*",options:"xX"},{app:"Playback",appType:"playback",context:"from-sip",type:"Inbound",interval:"*,*,*,*",answer:!0},{app:"Queue",appType:"queue",context:"from-sip",type:"Inbound",options:"xX",appdata:",xX,,,300,,,,,",interval:"*,*,*,*",answer:!0},{app:"Set",appType:"set",context:"from-sip",type:"Inbound",separator:"=",interval:"*,*,*,*"},{app:"Voicemail",appType:"voicemail",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"goto",appType:"goTo",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:"hangup",appType:"hangup",context:"from-sip",type:"Inbound",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Inbound",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.inboundRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoInboundRoutes=function(){e.go("app.voice.inboundRoutes",{},{reload:"app.voice.inboundRoutes"})},m.saveInboundRoute=function(){o.voiceExtension.update({id:m.inboundRoute.id},m.inboundRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.inboundRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","inboundRoute","contexts","userProfileSection"],angular.module("app.voice").controller("InboundRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.inboundRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="InboundRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.inboundRoutes.rows,{id:e.id}),g.inboundRoutes.count-=1,g.inboundRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.inboundRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedInboundRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"inbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.inboundRoutes.edit",{id:e.id,inboundRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditInboundRoute=function(e,n){a.show({controller:"CreateOrEditInboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/inboundRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{inboundRoute:n,inboundRoutes:g.inboundRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getInboundRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedInboundRoutes=function(){var e=angular.copy(g.selectedInboundRoutes);return g.selectedInboundRoutes=[],e},g.deleteSelectedInboundRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedInboundRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedInboundRoutes.forEach(function(e){f(e)}),g.selectedInboundRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","inboundRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("InboundRoutesController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.internalRoute=angular.copy(s),d.internalRoutes=n,d.newInternalRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.internalRoute||(d.internalRoute={appdata:"Internal Call",type:"internal",context:"from-sip"},d.newInternalRoute=!0);e=[{key:"name",value:d.internalRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newInternalRoute)return;var e={sort:"priority",VoiceExtensionId:d.internalRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewInternalRoute=function(){d.errors=[],o.voiceExtension.save(d.internalRoute).$promise.then(function(e){c(e.id).then(function(){d.internalRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveInternalRoute=function(){d.errors=[],o.voiceExtension.update({id:d.internalRoute.id},d.internalRoute).$promise.then(function(e){var n=_.find(d.internalRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.internalRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteInternalRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.internalRoute.exten})).ariaLabel("Delete internal route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.internalRoute.id}).$promise.then(function(){_.remove(d.internalRoutes,{id:d.internalRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.internalRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","internalRoutes","internalRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditInternalRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.internalRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.internalRoute=l||e.params.internalRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.internalRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"AGI",appAlias:"CallySquare",appType:"agi",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"Dial",appType:"dial",context:"from-sip",type:"Internal",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"internalDial",context:"from-sip",type:"Internal",options:"xX",interval:"*,*,*,*"},{app:"Dial",appType:"externalDial",context:"from-sip",type:"Internal",interval:"*,*,*,*",options:"xX"},{app:"Dial",appType:"ringGroup",context:"from-sip",type:"Internal",interval:"*,*,*,*",options:"xX"},{app:"Playback",appType:"playback",context:"from-sip",type:"Internal",interval:"*,*,*,*",answer:!0},{app:"Queue",appType:"queue",context:"from-sip",type:"Internal",options:"xX",appdata:",xX,,,300,,,,,",interval:"*,*,*,*",answer:!0},{app:"Set",appType:"set",context:"from-sip",type:"Internal",separator:"=",interval:"*,*,*,*"},{app:"Voicemail",appType:"voicemail",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"goto",appType:"goTo",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:"hangup",appType:"hangup",context:"from-sip",type:"Internal",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Internal",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.internalRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoInternalRoutes=function(){e.go("app.voice.internalRoutes",{},{reload:"app.voice.internalRoutes"})},m.saveInternalRoute=function(){o.voiceExtension.update({id:m.internalRoute.id},m.internalRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.internalRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","internalRoute","contexts","userProfileSection"],angular.module("app.voice").controller("InternalRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.internalRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="InternalRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.internalRoutes.rows,{id:e.id}),g.internalRoutes.count-=1,g.internalRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.internalRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedInternalRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"internal",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.internalRoutes.edit",{id:e.id,internalRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditInternalRoute=function(e,n){a.show({controller:"CreateOrEditInternalRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/internalRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{internalRoute:n,internalRoutes:g.internalRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getInternalRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedInternalRoutes=function(){var e=angular.copy(g.selectedInternalRoutes);return g.selectedInternalRoutes=[],e},g.deleteSelectedInternalRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedInternalRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedInternalRoutes.forEach(function(e){f(e)}),g.selectedInternalRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","internalRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("InternalRoutesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_MUSICONHOLD",g.musiconhold=angular.copy(l),g.musiconholds=r,g.newMusicOnHold=!1,g.musiconhold||(g.musiconhold={mode:"files"},g.title="VOICE.NEW_MUSICONHOLD",g.newMusicOnHold=!0),g.addNewMusicOnHold=function(){g.errors=[],d.voiceMusicOnHold.save(g.musiconhold).$promise.then(function(e){g.musiconholds.unshift(e.toJSON()),o.success({title:"MusicOnHold properly created",msg:g.musiconhold.name?g.musiconhold.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMusicOnHold=function(){g.errors=[],d.voiceMusicOnHold.update({id:g.musiconhold.id},g.musiconhold).$promise.then(function(e){var n=_.find(g.musiconholds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MusicOnHold properly saved!",msg:g.musiconhold.name?g.musiconhold.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMusicOnHold=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The musiconhold will be deleted.").ariaLabel("Delete MusicOnHold").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMusicOnHold.delete({id:g.musiconhold.id}).$promise.then(function(){_.remove(g.musiconholds,{id:g.musiconhold.id}),o.success({title:"MusicOnHold properly deleted!",msg:(g.musiconhold.name||"musiconhold")+" has been deleted!"}),v(g.musiconhold)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","musiconholds","musiconhold","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditMusicOnHoldDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.musiconholdMohSounds=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceMusicOnHold.getSounds(m.query,u).$promise}function g(e){d.voiceMusicOnHold.removeSound({id:t.params.id,id2:e.id}).$promise.then(function(){_.remove(m.musiconholdMohSounds.rows,{id:e.id}),m.musiconholdMohSounds.count-=1,m.musiconholdMohSounds.rows.length||p(),l.success({title:"MohSound deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMusicOnHold"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.musiconhold={},m.musiconholdMohSounds={count:0,rows:[]},m.selectedMusicOnHoldMohSounds=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,save_name,converted_format,audio",limit:10,page:1},m.init=function(e,n){m.musiconhold=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.VoiceMusicOnHoldId=m.musiconhold.id,m.query.id=m.musiconhold.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the mohSound?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("mohSound #")+e.id||"mohSound")+"</b> will be deleted.").ariaLabel("delete mohSound").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.voiceMusicOnHoldDownload=function(s,e,n){return d.sound.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="mohSound"+s.id,a=new Blob(n,{type:e.type});t=s.converted_format?s.save_name+"."+s.converted_format:s.save_name;var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=u,m.getMusicOnHoldMohSounds=p,m.createOrEditMusicOnHoldMohSound=function(e,n){o.show({controller:"CreateOrEditMohSoundDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:m.musiconhold,mohSound:n,mohSounds:m.musiconholdMohSounds.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedMusicOnHoldMohSounds=function(){var e=angular.copy(m.selectedMusicOnHoldMohSounds);return m.selectedMusicOnHoldMohSounds=[],e},m.deleteMusicOnHoldMohSound=g,m.deleteSelectedMusicOnHoldMohSounds=function(e){var n=o.confirm().title("Are you sure want to delete the selected mohSounds?").htmlContent("<b>"+m.selectedMusicOnHoldMohSounds.length+" selected</b> will be deleted.").ariaLabel("delete mohSounds").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedMusicOnHoldMohSounds.forEach(function(e){g(e)}),m.selectedMusicOnHoldMohSounds=[]})},c.hasRole("admin")?d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){m.sounds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){m.sounds=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:m.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(m.sounds,{id:e.resourceId})}),t=null;if(m.musiconhold&&(t=_.find(m.sounds,{id:Number(m.musiconhold.id)})),t&&!_.some(n,["id",t.id])){var a=_.find(m.sounds,{id:t.id});a.canSelect=!1,n.push(a)}m.sounds=n})}else{var t=[],a=null;m.musiconhold&&(a=_.find(m.sounds,{id:Number(m.musiconhold.id)}));for(var i=0;i<m.sounds.length;i++)a&&m.sounds[i].id===a.id&&(m.sounds[i].canSelect=!1,t.push(m.sounds[i]));m.sounds=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("MusicOnHoldMohSoundsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_MOHSOUND",g.mohSound=angular.copy(l),g.mohSounds=r,g.newMohSound=!1,g.mohSound||(g.mohSound={},g.title="VOICE.NEW_MOHSOUND",g.newMohSound=!0),n.params.id&&(g.mohSound.VoiceMusicOnHoldId=n.params.id),g.addNewMohSound=function(){g.errors=[],d.voiceMusicOnHold.addSound({id:n.params.id},g.mohSound).$promise.then(function(e){g.mohSounds.unshift(e.toJSON()),o.success({title:"MohSound properly created",msg:g.mohSound.name?g.mohSound.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveMohSound=function(){g.errors=[],d.voiceMusicOnHold.update({id:g.mohSound.id},g.mohSound).$promise.then(function(e){var n=_.find(g.mohSounds,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"MohSound properly saved!",msg:g.mohSound.name?g.mohSound.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteMohSound=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The mohSound will be deleted.").ariaLabel("Delete MohSound").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMusicOnHold.delete({id:g.mohSound.id}).$promise.then(function(){_.remove(g.mohSounds,{id:g.mohSound.id}),o.success({title:"MohSound properly deleted!",msg:(g.mohSound.name||"mohSound")+" has been deleted!"}),v(g.mohSound)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMusicOnHold.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMusicOnHold.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.sounds=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.sound.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){g.sounds=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.sounds,{id:e.resourceId})}),t=null;if(g.mohSound&&(t=_.find(g.sounds,{id:Number(g.mohSound.id)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.sounds,{id:t.id});a.canSelect=!1,n.push(a)}g.sounds=n})}else{var t=[],a=null;g.mohSound&&(a=_.find(g.sounds,{id:Number(g.mohSound.id)}));for(var i=0;i<g.sounds.length;i++)a&&g.sounds[i].id===a.id&&(g.sounds[i].canSelect=!1,t.push(g.sounds[i]));g.sounds=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","mohSounds","mohSound","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditMohSoundDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.musiconhold=c||e.params.musiconhold||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoMusicOnHolds=function(){e.go("app.voice.musiconholds",{},{reload:"app.voice.musiconholds"})},u.saveMusicOnHold=function(){r.voiceMusicOnHold.update({id:u.musiconhold.id},u.musiconhold).$promise.then(function(){l.success({title:"MusicOnHold updated!",msg:u.musiconhold.name?u.musiconhold.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","musiconhold","userProfileSection"],angular.module("app.voice").controller("MusicOnHoldController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.musiconholds=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="musiconholds",f.listOrder="",f.listOrderAsc=null,f.selectedMusicOnHolds=[],f.query={fields:"createdAt,updatedAt,id,name,mode,directory,application,format,sort",defaultEntry:"false",limit:10,page:1},f.arraymode=_.keyBy([{option:"Files",value:"'files'"},{option:"Custom",value:"'custom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysort=_.keyBy([{option:"Random",value:"'random'"},{option:"Alphabetical",value:"'alpha'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.musiconholds.edit",{id:e.id,musiconhold:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("musiconhold")+"?").htmlContent("<b>"+(e.name||"musiconhold")+"</b> will be deleted.").ariaLabel("delete musiconhold").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getMusicOnHolds=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceMusicOnHold.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="MusicOnHolds",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditMusicOnHold=function(e,n){i.show({controller:"CreateOrEditMusicOnHoldDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/musiconholds/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{musiconhold:n,musiconholds:f.musiconholds.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteMusicOnHold=y,f.exportSelectedMusicOnHolds=function(){var e=angular.copy(f.selectedMusicOnHolds);return f.selectedMusicOnHolds=[],e},f.deleteSelectedMusicOnHolds=function(e){var n=i.confirm().title("Are you sure want to delete the selected musiconholds?").htmlContent("<b>"+f.selectedMusicOnHolds.length+" selected</b> will be deleted.").ariaLabel("delete MusicOnHolds").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedMusicOnHolds.forEach(function(e){y(e)}),f.selectedMusicOnHolds=[]})},f.deselectMusicOnHolds=function(){f.selectedMusicOnHolds=[]},f.selectAllMusicOnHolds=function(){f.selectedMusicOnHolds=f.musiconholds.rows};var b=!0,A=1;function E(e){f.musiconholds=e||{count:0,rows:[]}}function y(e){m.voiceMusicOnHold.delete({id:e.id}).$promise.then(function(){_.remove(f.musiconholds.rows,{id:e.id}),f.musiconholds.count-=1,f.musiconholds.rows.length||f.getMusicOnHolds(),p.success({title:_.startCase("MusicOnHold")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMusicOnHold"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceMusicOnHold",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getMusicOnHolds())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","musiconholds","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("MusicOnHoldsController",e)}(),function(){"use strict";function e(t,e,a,i,n,s,o,r,l){var d=this;function c(t){return e(function(e,n){o.voiceExtension.addApplications({id:t},d.applications?d.applications.rows:[]).$promise.then(function(){e()}).catch(function(e){n(e)})})}function m(e){t.hide(e)}d.currentUser=r.getCurrentUser(),d.crudPermissions=l,d.outboundRoute=angular.copy(s),d.outboundRoutes=n,d.newOutboundRoute=!1,d.hasModulePermissions={},d.errors=[],d.initialize=function(){d.outboundRoute||(d.outboundRoute={appdata:"Outbound Call",type:"outbound",context:"from-sip",recordingFormat:"none"},d.newOutboundRoute=!0);e=[{key:"name",value:d.outboundRoute.context}],o.getResourcesByRole(d.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){d.contexts=e}).catch(function(){i.error({title:a.instant("VOICE.CONTEXTS"),msg:a.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},d.getRouting=function(){if(d.newOutboundRoute)return;var e={sort:"priority",VoiceExtensionId:d.outboundRoute.id,isApp:!0,nolimit:!0};o.voiceExtension.get(e).$promise.then(function(e){d.applications=e||{count:0,rows:[]}})},d.addNewOutboundRoute=function(){d.errors=[],o.voiceExtension.save(d.outboundRoute).$promise.then(function(e){c(e.id).then(function(){d.outboundRoutes.unshift(e.toJSON()),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_CREATED_SUCCESS_TITLE")}),m(e)})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.save"}];for(var n=0;n<e.data.errors.length;n+=1)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.saveOutboundRoute=function(){d.errors=[],o.voiceExtension.update({id:d.outboundRoute.id},d.outboundRoute).$promise.then(function(e){var n=_.find(d.outboundRoutes,{id:e.id});if(n&&_.merge(n,e.toJSON()),d.applications)return c(d.outboundRoute.id)}).then(function(){i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")}),m(s)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.update"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.deleteOutboundRoute=function(e){d.errors=[];var n=t.confirm().title(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:d.outboundRoute.exten})).ariaLabel("Delete outbound route").ok(a.instant("TOOLS.DELETE")).cancel(a.instant("TOOLS.CANCEL")).targetEvent(e);t.show(n).then(function(){o.voiceExtension.delete({id:d.outboundRoute.id}).$promise.then(function(){_.remove(d.outboundRoutes,{id:d.outboundRoute.id}),i.success({title:a.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")}),m(d.outboundRoute)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){d.errors=e.data.errors||[{message:e.toString(),type:"api.voiceExtension.delete"}];for(var n=0;n<e.data.errors.length;n++)i.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceExtension.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})})},d.closeDialog=m}e.$inject=["$mdDialog","$q","$translate","toasty","outboundRoutes","outboundRoute","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditOutboundRouteDialogController",e)}(),function(){"use strict";function e(e,i,a,n,s,o,r,t,l,d,c){var m=this;function u(e,n){1===m.applications.rows.length&&1===n&&(n=0);var t=m.applications.rows[n];i.show({controller:"EditRoutingAppDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/dialog.html",parent:angular.element(a.body),targetEvent:e,locals:{application:t,route:m.outboundRoute,crudPermissions:m.crudPermissions}}).then(function(e){e?(m.applications.rows[n].appdata===e.appdata&&"custom"!==e.appType||p(),m.applications.rows[n]=e):t.id||m.applications.rows.splice(n,1)}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}function p(){m.pendingChanges=!0}m.currentUser=t.getCurrentUser(),m.outboundRoute=l||e.params.outboundRoute||{},m.contexts=d,m.userProfileSection=c&&1==c.count?c.rows[0]:null,m.crudPermissions=t.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={sort:"priority",VoiceExtensionId:m.outboundRoute.id,isApp:!0,nolimit:!0},m.apps=[{app:"Dial",appType:"outboundDial",context:"from-sip",type:"Outbound",options:"xX",interval:"*,*,*,*"},{app:null,appType:"custom",type:"Outbound",interval:"*,*,*,*"}],m.sortableAppsOptions={group:{name:"apps",pull:"clone",put:!1},animation:100,sort:!1},m.sortableRoutingOptions={group:{name:"apps",put:!0},animation:100,disabled:!m.crudPermissions.canEdit,onAdd:function(e){u(e,e.newIndex)},onUpdate:function(){p()}},m.selectedApplications=[],m.onInit=function(){if(t.isAdmin())return;e=[{key:"name",value:m.outboundRoute.context}],o.getResourcesByRole(m.currentUser,"voiceContext",{fields:"id,name",sort:"name",nolimit:!0},e).then(function(e){m.contexts=e}).catch(function(){r.error({title:s.instant("VOICE.CONTEXTS"),msg:s.instant("VOICE.NOTIFICATIONS.VOICE_CONTEXTS_GET_ERROR")})});var e},m.onActionsTabSelection=function(){m.applications||o.voiceExtension.get(m.query).$promise.then(function(e){m.applications=e||{count:0,rows:[]}})},m.gotoOutboundRoutes=function(){e.go("app.voice.outboundRoutes",{},{reload:"app.voice.outboundRoutes"})},m.saveOutboundRoute=function(){o.voiceExtension.update({id:m.outboundRoute.id},m.outboundRoute).$promise.then(function(){n(function(n,t){if(!m.applications)return n();o.voiceExtension.addApplications({id:m.outboundRoute.id},m.applications.rows).$promise.then(function(e){m.applications.rows=e.rows,n()}).catch(function(e){t(e)})}).then(function(){m.pendingChanges=!1,r.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_SAVED_SUCCESS_TITLE")})})}).catch(function(e){r.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceExtension",msg:e.data?JSON.stringify(e.data):e.toString()})})},m.editApplication=u,m.editInterval=function(e,n){var t=m.applications.rows[n];i.show({controller:"EditRoutingIntervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/routing/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:void 0,crudPermissions:m.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,p())})},m.deleteApplication=function(e,n,t){var a=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATION_DELETE_MESSAGE",{name:e.app})).ariaLabel("Delete application").targetEvent(t).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(a).then(function(){m.applications.rows.splice(n,1),p()})},m.deleteSelectedApplications=function(e){var n=i.confirm().title(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.ROUTING_APPLICATIONS_DELETE_MESSAGE",{total:m.selectedApplications.length})).ariaLabel("Delete applications").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedApplications.forEach(function(e){_.remove(m.applications.rows,{id:e.id})}),m.selectedApplications=[],p()})}}e.$inject=["$state","$mdDialog","$document","$q","$translate","api","toasty","Auth","outboundRoute","contexts","userProfileSection"],angular.module("app.voice").controller("OutboundRouteController",e)}(),function(){"use strict";function e(e,n,a,t,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){g.outboundRoutes=e||{count:0,rows:[]}}function h(){g.query.offset=(g.query.page-1)*g.query.limit,m.isAdmin()?g.promise=d.voiceExtension.get(g.query,v).$promise:(g.query.id=g.userProfile.id,g.query.section="OutboundRoutes",g.promise=d.userProfile.getResources(g.query,v).$promise)}function f(e){d.voiceExtension.delete({id:e.id}).$promise.then(function(){_.remove(g.outboundRoutes.rows,{id:e.id}),g.outboundRoutes.count-=1,g.outboundRoutes.rows.length||h(),c.success({title:s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceExtension"}];for(var n=0;n<e.data.errors.length;n++)c.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else c.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceExtension",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}g.license=u,g.setting=p,g.currentUser=m.getCurrentUser(),g.outboundRoutes=o,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=m.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.selectedOutboundRoutes=[],g.query={fields:"id,appdata,type,exten,context,description,alias,createdAt,updatedAt",type:"outbound",sort:"-updatedAt",VoiceExtensionId:"null",limit:10,page:1},g.editRoute=function(e){n.go("app.voice.outboundRoutes.edit",{id:e.id,outboundRoute:e,crudPermissions:g.crudPermissions})},g.createOrEditOutboundRoute=function(e,n){a.show({controller:"CreateOrEditOutboundRouteDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/outboundRoutes/create/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{outboundRoute:n,outboundRoutes:g.outboundRoutes.rows,crudPermissions:g.crudPermissions}})},g.success=v,g.getOutboundRoutes=h,g.deleteConfirm=function(e,n){var t=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSION_DELETE_MESSAGE",{name:e.exten})).ariaLabel("Delete extension").targetEvent(n).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(t).then(function(){f(e)})},g.exportSelectedOutboundRoutes=function(){var e=angular.copy(g.selectedOutboundRoutes);return g.selectedOutboundRoutes=[],e},g.deleteSelectedOutboundRoutes=function(e){var n=a.confirm().title(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_TITLE")).content(s.instant("VOICE.NOTIFICATIONS.EXTENSIONS_DELETE_MESSAGE",{total:g.selectedOutboundRoutes.length})).ariaLabel("Delete extensions").targetEvent(e).ok("OK").cancel(s.instant("TOOLS.CANCEL"));a.show(n).then(function(){g.selectedOutboundRoutes.forEach(function(e){f(e)}),g.selectedOutboundRoutes=[]})};var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?i(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())})}e.$inject=["$scope","$state","$mdDialog","$document","$timeout","$translate","outboundRoutes","userProfile","userProfileSection","api","toasty","Auth","license","setting"],angular.module("app.voice").controller("OutboundRoutesController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){return[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Agent",key:"lastAssignedTo",type:"select",label:"DASHBOARDS.SELECT_AGENT",options:g.agents.rows,customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}],ngValue:"name"},{name:"Campaign",key:"queue",type:"multiselect",label:"DASHBOARDS.SELECT_CAMPAIGN",options:g.queues.rows,ngValue:"name"}]}function h(){return g.refresh=!1,0===g.queues.count?f(null):(g.query.queue=1===g.queues.count?g.queues.rows[0].name:g.query.queue,void 0===g.query.queue&&(g.query.queue=_.map(g.queues.rows,"name")),_.isEmpty(g.query.queue)?f(null):(g.query.offset=(g.query.page-1)*g.query.limit,i.localStorage.setItem("motion2.realtime.abandoned.voice.abandonedCalls:"+g.currentUser.id,JSON.stringify({query:_.omit(g.query,"queue")})),void(g.promise=o.voiceQueueReport.getVoiceQueuesReport(g.query,f).$promise)))}function f(e){g.abandonedCalls=e||{count:0,rows:[]},g.refresh=!0}g.currentUser=d.getCurrentUser(),g.agents=u||[],g.dispositions=p.rows,g.abandonedCalls={count:0,rows:[]},g.showTooltip=!1,g.refresh=!0,g.userProfile=r,g.userProfileSection=l&&1==l.count?l.rows[0]:null,g.crudPermissions=d.parseCrudPermissions(g.userProfileSection?g.userProfileSection.crudPermissions:null),g.query={fields:"id,type,calleridnum,calleridname,queue,queuecallerabandonAt,queuecallerexitAt,queuecallerexitreason,assigned,lastAssignedTo,updatedAt,disposition,secondDisposition,thirdDisposition,note",type:"inbound",queuecallerexitreason:"TIMEOUT,ABANDONED",sort:"-createdAt",limit:10,page:1},g.getAbandonedCalls=h,g.refreshAbandonedCalls=function(){g.showTooltip=!1,h()},g.assignTo=function(e,n){e&&o.voiceQueueReport.update({id:e.id,lastAssignedTo:n?n.name:null,assigned:!!n}).$promise.catch(function(){})},g.dispose=function(t){n.show({controller:"DisposeAbandonedCallDialogController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",parent:angular.element(a.body),targetEvent:t,locals:{dispositions:g.dispositions,call:t}}).then(function(e){if(e){var n={id:t.id,disposition:e.firstLevel||null,secondDisposition:e.secondLevel||null,thirdDisposition:e.thirdLevel||null,note:e.note||null};o.voiceQueueReport.update(n).$promise.catch(function(){})}})},g.onSaveVoiceQueueReport=function(e){e&&g.queuesMap&&"inbound"===g.query.type&&g.queuesMap[e.queue]&&(g.showTooltip=!0)},g.onUpdateVoiceQueueReport=function(e){if(e){var n=_.findIndex(g.abandonedCalls.rows,["id",e.id]);0<=n&&_.merge(g.abandonedCalls.rows[n],e)}},c.onWithoutApply("voiceQueueReport:save",g.onSaveVoiceQueueReport),c.on("voiceQueueReport:update",g.onUpdateVoiceQueueReport),function(){var e=i.localStorage.getItem("motion2.realtime.abandoned.voice.abandonedCalls:"+g.currentUser.id);if(e)(e=JSON.parse(e))&&e.query&&(g.query=_.merge(e.query,_.omit(g.query,["sort","limit","page"])),g.query=_.omit(g.query,"filter"));else{var n={$gte:moment().startOf("month").utcOffset(0,!0).format(),$lte:moment().endOf("month").utcOffset(0,!0).format()};g.query.createdAt=n}d.hasRole("admin")?o.user.getQueues({id:d.getCurrentUser().id,fields:"id,name",channel:"voice",type:"inbound",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(){}).finally(function(){g.quickFilters=v(),h()}):o.userProfile.getResources({id:g.currentUser.userProfileId,section:"VoiceQueues",channel:"voice",type:"inbound",sort:"-updatedAt",nolimit:!0}).$promise.then(function(e){g.queues=e||{count:0,rows:[]},g.queuesMap=_.mapValues(_.keyBy(g.queues.rows,"name"),"name")}).catch(function(){}).finally(function(){g.quickFilters=v(),h()})}();var b=!0,A=1;e.$watch("vm.query.filter",function(e,n){b?t(function(){b=!1}):(n||(A=g.query.page),e!==n&&(g.query.page=1),e||(g.query.page=A),h())}),e.$on("$destroy",function(){c.removeAllListeners("voiceQueueReport:save"),c.removeAllListeners("voiceQueueReport:update")})}e.$inject=["$scope","$timeout","$mdDialog","$document","$window","$translate","api","userProfile","userProfileSection","Auth","socket","toasty","agents","dispositions"],angular.module("app.voice").controller("AbandonedCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s){var o=this;o.calls=i||{rows:[],count:0},o.query={limit:10,page:1},o.channelStatus=s.OUTGOING_CALL_STATUS_STYLES,o.onSave=function(e){var n=_.find(o.calls.rows,{channel:e.channel});e.channelstatedesc=e.dialstatus?"up":"ring",n?_.merge(n,e):e.channel&&o.calls.rows.push(e)},o.onRemove=function(e){var n=_.findIndex(o.calls.rows,{channel:e.channel});0<=n&&(o.calls.rows[n].status="hangup");t(function(){o.calls.rows.splice(n,1)},5e3)},a.on("voice_outbound_channel:save",o.onSave),a.on("voice_outbound_channel:remove",o.onRemove),e.$on("$destroy",function(){a.removeAllListeners("voice_outbound_channel:save"),a.removeAllListeners("voice_outbound_channel:remove")})}e.$inject=["$scope","$timeout","api","socket","rpcCalls","realtimeManager"],angular.module("app.voice").controller("OutboundCallsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d){var c=this,m=["total","answered","unmanaged","abandoned","sumHoldTime","sumDuration","sumBillable"];function u(){c.queues.rows.forEach(function(e){c.rpcQueues[e.id]&&_.merge(e,_.pick(c.rpcQueues[e.id],m))})}c.queues=a||{rows:[],count:0},c.rpcQueues=i?_.keyBy(i.rows?i.rows:[],"id"):{},c.userProfile=r,c.userProfileSection=l&&1==l.count?l.rows[0]:null,c.crudPermissions=d.parseCrudPermissions(c.userProfileSection?c.userProfileSection.crudPermissions:null),d.hasRole("admin")?c.query={type:"inbound",fields:"id,name",sort:"name",limit:10,page:1}:c.query={id:d.getCurrentUser().id,channel:"voice",type:"inbound",fields:"id,name",sort:"name",limit:10,page:1},c.success=v,c.getQueues=function(){c.query.offset=(c.query.page-1)*c.query.limit,d.hasRole("admin")?c.promise=s.voiceQueue.get(c.query,v).$promise:(c.query.id=c.userProfile.id,c.query.section="VoiceQueues",c.promise=s.userProfile.getResources(c.query,v).$promise)},c.onSave=function(e){var n=_.find(c.queues.rows,["id",e.id]);n&&_.merge(n,_.pick(e,m))},c.$onInit=u,o.onWithoutApply("voice_queue:save",c.onSave),c.interval=n(function(){},999);var p=!0,g=1;function v(e){c.queues=e||{count:0,rows:[]},u()}e.$watch("vm.query.filter",function(e,n){p?t(function(){p=!1}):(n||(g=c.query.page),e!==n&&(c.query.page=1),e||(c.query.page=g),c.getQueues())}),e.$on("$destroy",function(){o.removeAllListeners("voice_queue:save"),c.interval&&n.cancel(c.interval)})}e.$inject=["$scope","$timeout","$interval","queues","rpcQueues","api","socket","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("QueueParamsVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n){var a=this;switch(a.selectedTab=0,t.current.name){case"app.voice.realtime.agents":a.selectedTab=0;break;case"app.voice.realtime.telephones":a.selectedTab=1;break;case"app.voice.realtime.trunks":a.selectedTab=2;break;case"app.voice.realtime.queues":a.selectedTab=3;break;case"app.voice.realtime.queue_calls":a.selectedTab=4;break;case"app.voice.realtime.abandonedcalls":a.selectedTab=5;break;case"app.voice.realtime.queue_params":a.selectedTab=6;break;case"app.voice.realtime.outbound_calls":a.selectedTab=7;break;default:a.selectedTab=0,t.go("app.voice.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.voice.realtime.agents");break;case 1:t.go("app.voice.realtime.telephones");break;case 2:t.go("app.voice.realtime.trunks");break;case 3:t.go("app.voice.realtime.queues");break;case 4:t.go("app.voice.realtime.queue_calls");break;case 5:t.go("app.voice.realtime.abandonedcalls");break;case 6:t.go("app.voice.realtime.queue_params");break;case 7:t.go("app.voice.realtime.outbound_calls");break;default:t.go("app.voice.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.voice").controller("VoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c){var m=this,u=["fullname","internal","state","status"];function p(){_.forIn(m.telephones,function(e,n){m.rpcTelephones[n]&&_.merge(e,_.pick(m.rpcTelephones[n],u))})}m.count=a.count,m.telephones=a?a.rows:{},m.rpcTelephones=i?i.rows:{},m.userProfile=l,m.userProfileSection=d&&1==d.count?d.rows[0]:null,m.crudPermissions=c.parseCrudPermissions(m.userProfileSection?m.userProfileSection.crudPermissions:null),m.query={fields:"id,fullname,internal",role:"telephone",sort:"fullname",limit:10,page:1},m.statusClass=r.STATUS_STYLES,m.stateClass=r.STATES_STYLES,m.success=h,m.$onInit=p,m.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},m.getTelephones=function(){m.query.offset=(m.query.page-1)*m.query.limit,c.hasRole("admin")?m.promise=s.user.get(m.query,h).$promise:(m.query.id=m.userProfile.id,m.query.section="Telephones",m.promise=s.userProfile.getResources(m.query,h).$promise)},m.onSave=function(e){m.telephones[e.id]&&_.merge(m.telephones[e.id],_.pick(e,u))},o.on("telephone:save",m.onSave);var g=!0,v=1;function h(e){m.telephones=e?e.rows:{},p()}e.$watch("vm.query.filter",function(e,n){g?t(function(){g=!1}):(n||(v=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=v),m.getTelephones())}),e.$on("$destroy",function(){o.removeAllListeners("telephone:save")})}e.$inject=["$scope","$timeout","$mdDialog","telephones","rpcTelephones","api","socket","realtimeManager","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TelephonesVoiceRealtimeController",e)}(),function(){"use strict";function e(e,t,n,a,i,s,o,r,l,d,c,m){var u=this,p=["status","stateRegistry","registry","host","port","internal","state","status"];function g(){for(var e,n=0;n<u.trunks.length;n+=1)0<=(e=_.findIndex(u.rpcTrunks,["id",u.trunks[n].id]))&&_.merge(u.trunks[n],_.pick(u.rpcTrunks[e],p))}function v(e,n,t){0<=n&&_.merge(e[n],_.pick(t,p))}u.currentUser=m.getCurrentUser(),u.count=a.count,u.trunks=a?a.rows:[],u.rpcTrunks=i&&i.rows?i.rows:[],u.query={fields:"id,name",active:!0,sort:"name",limit:10,page:1},u.statusClass=r.STATUS_STYLES,u.stateClass=r.STATES_STYLES,u.userProfile=d,u.userProfileSection=c&&1==c.count?c.rows[0]:null,u.crudPermissions=m.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.success=b,u.$onInit=g,u.showInfo=function(e){n.show(n.alert().clickOutsideToClose(!0).title("Legend").htmlContent("<div>TODO legend status + state</div>").ok("Ok").targetEvent(e))},u.getTrunks=function(){u.query.offset=(u.query.page-1)*u.query.limit,m.hasRole("admin")?u.promise=s.trunk.get(u.query,b).$promise:(u.query.id=u.userProfile.id,u.query.section="Trunks",u.promise=s.userProfile.getResources(u.query,b).$promise)},u.goToTrunk=function(e,n){l.go("app.tools.trunks.edit",{id:n.id})},u.onSave=function(e){var n=_.findIndex(u.trunks,["id",e.id]),t=_.findIndex(u.rpcTrunks,["id",e.id]);v(u.trunks,n,e),v(u.rpcTrunks,t,e)},o.on("trunk:save",u.onSave);var h=!0,f=1;function b(e){u.count=e.count,u.trunks=e&&e.rows?e.rows:[],g()}e.$watch("vm.query.filter",function(e,n){h?t(function(){h=!1}):(n||(f=u.query.page),e!==n&&(u.query.page=1),e||(u.query.page=f),u.getTrunks())}),e.$on("$destroy",function(){o.removeAllListeners("trunk:save")})}e.$inject=["$scope","$timeout","$mdDialog","trunks","rpcTrunks","api","socket","realtimeManager","$state","userProfile","userProfileSection","Auth"],angular.module("app.voice").controller("TrunksVoiceRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEMAIL",g.voicemail=angular.copy(l),g.voicemails=r,g.newVoicemail=!1,g.voicemail||(g.voicemail={attach:"no"},g.title="VOICE.NEW_VOICEMAIL",g.newVoicemail=!0),g.addNewVoicemail=function(){g.errors=[],d.voiceMail.save(g.voicemail).$promise.then(function(e){g.voicemails.unshift(e.toJSON()),o.success({title:"Voicemail properly created",msg:g.voicemail.name?g.voicemail.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoicemail=function(){g.errors=[],d.voiceMail.update({id:g.voicemail.id},g.voicemail).$promise.then(function(e){var n=_.find(g.voicemails,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"Voicemail properly saved!",msg:g.voicemail.name?g.voicemail.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoicemail=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voicemail will be deleted.").ariaLabel("Delete Voicemail").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceMail.delete({id:g.voicemail.id}).$promise.then(function(){_.remove(g.voicemails,{id:g.voicemail.id}),o.success({title:"Voicemail properly deleted!",msg:(g.voicemail.name||"voicemail")+" has been deleted!"}),v(g.voicemail)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceMail.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voicemails","voicemail","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoicemailDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.voicemailMessages=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.voiceMail.getMessages(m.query,u).$promise}function g(e){d.voiceMailMessage.delete({id:e.id}).$promise.then(function(){_.remove(m.voicemailMessages.rows,{id:e.id}),m.voicemailMessages.count-=1,m.voicemailMessages.rows.length||p(),l.success({title:"Message deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETvoiceMail"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.voicemail={},m.voicemailMessages={count:0,rows:[]},m.selectedVoicemailMessages=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,callerid,duration,audio,stamp,msg_id",sort:"-stamp",limit:10,page:1},m.init=function(e,n){m.voicemail=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.id=m.voicemail.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the message?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("message #")+e.id||"message")+"</b> will be deleted.").ariaLabel("delete message").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.voiceMailMessageDownload=function(s,e,n){return d.voiceMailMessage.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="message"+s.id,a=new Blob(n,{type:e.type});t=s.msg_id+".wav";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceMail.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=u,m.getVoicemailMessages=p,m.createOrEditVoicemailMessage=function(e,n){o.show({controller:"CreateOrEditMessageDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/edit/messages/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:m.voicemail,message:n,messages:m.voicemailMessages.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedVoicemailMessages=function(){var e=angular.copy(m.selectedVoicemailMessages);return m.selectedVoicemailMessages=[],e},m.deleteVoicemailMessage=g,m.deleteSelectedVoicemailMessages=function(e){var n=o.confirm().title("Are you sure want to delete the selected messages?").htmlContent("<b>"+m.selectedVoicemailMessages.length+" selected</b> will be deleted.").ariaLabel("delete messages").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedVoicemailMessages.forEach(function(e){g(e)}),m.selectedVoicemailMessages=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.voice").controller("VoicemailMessagesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.voicemail=c||e.params.voicemail||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.alert=l.info,u.gotoVoicemails=function(){e.go("app.voice.voicemails",{},{reload:"app.voice.voicemails"})},u.saveVoicemail=function(){r.voiceMail.update({id:u.voicemail.id},u.voicemail).$promise.then(function(){l.success({title:"Voicemail updated!",msg:u.voicemail.name?u.voicemail.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceMail",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_CONTEXTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceContext.get({fields:"id,name",sort:"name"}).$promise.then(function(e){u.contexts=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:405}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.contexts,{id:e.resourceId})}),t=null;if(u.voicemail&&(t=_.find(u.contexts,{name:u.voicemail.context})),t&&!_.some(n,["id",t.id])){var a=_.find(u.contexts,{id:t.id});a.canSelect=!1,n.push(a)}u.contexts=n}):r.voiceContext.get({fields:"id,name",sort:"name",defaultEntry:1}).$promise.then(function(e){u.contexts=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETcontexts",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voicemail","userProfileSection"],angular.module("app.voice").controller("VoicemailController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voicemails=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voicemails",f.listOrder="",f.listOrderAsc=null,f.selectedVoicemails=[],f.query={fields:"createdAt,updatedAt,id,customer_id,fullname,email,password,mailbox,context,tz,attach,envelope,delete,emailbody,emailsubject,maxsecs,maxmsg",sort:"-updatedAt",limit:10,page:1},f.arrayattach=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayenvelope=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraydelete=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.voicemails.edit",{id:e.id,voicemail:e,crudPermissions:f.crudPermissions})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voicemail")+"?").htmlContent("<b>"+(e.name||"voicemail")+"</b> will be deleted.").ariaLabel("delete voicemail").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVoicemails=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceMail.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="Voicemails",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVoicemail=function(e,n){i.show({controller:"CreateOrEditVoicemailDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicemails/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicemail:n,voicemails:f.voicemails.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteVoicemail=y,f.exportSelectedVoicemails=function(){var e=angular.copy(f.selectedVoicemails);return f.selectedVoicemails=[],e},f.deleteSelectedVoicemails=function(e){var n=i.confirm().title("Are you sure want to delete the selected voicemails?").htmlContent("<b>"+f.selectedVoicemails.length+" selected</b> will be deleted.").ariaLabel("delete Voicemails").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoicemails.forEach(function(e){y(e)}),f.selectedVoicemails=[]})},f.deselectVoicemails=function(){f.selectedVoicemails=[]},f.selectAllVoicemails=function(){f.selectedVoicemails=f.voicemails.rows};var b=!0,A=1;function E(e){f.voicemails=e||{count:0,rows:[]}}function y(e){m.voiceMail.delete({id:e.id}).$promise.then(function(){_.remove(f.voicemails.rows,{id:e.id}),f.voicemails.count-=1,f.voicemails.rows.length||f.getVoicemails(),p.success({title:_.startCase("Voicemail")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceMail"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceMail",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoicemails())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicemails","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoicemailsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICEPREFIX",g.voicePrefix=angular.copy(l),g.voicePrefixes=r,g.newvoicePrefix=!1,g.voicePrefix||(g.voicePrefix={},g.title="VOICE.NEW_VOICEPREFIX",g.newvoicePrefix=!0),g.addNewvoicePrefix=function(){g.errors=[],d.voicePrefix.save(g.voicePrefix).$promise.then(function(e){g.voicePrefixes.unshift(e.toJSON()),o.success({title:"voicePrefix properly created",msg:g.voicePrefix.name?g.voicePrefix.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.savevoicePrefix=function(){g.errors=[],d.voicePrefix.update({id:g.voicePrefix.id},g.voicePrefix).$promise.then(function(e){var n=_.find(g.voicePrefixes,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"voicePrefix properly saved!",msg:g.voicePrefix.name?g.voicePrefix.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deletevoicePrefix=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voicePrefix will be deleted.").ariaLabel("Delete voicePrefix").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voicePrefix.delete({id:g.voicePrefix.id}).$promise.then(function(){_.remove(g.voicePrefixes,{id:g.voicePrefix.id}),o.success({title:"voicePrefix properly deleted!",msg:(g.voicePrefix.name||"voicePrefix")+" has been deleted!"}),v(g.voicePrefix)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voicePrefix.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voicePrefix.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v,c.hasRole("admin")?d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){g.outboundRoutes=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){g.outboundRoutes=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.outboundRoutes,{id:e.resourceId})}),t=null;if(g.voicePrefix&&(t=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.outboundRoutes,{id:t.id});a.canSelect=!1,n.push(a)}g.outboundRoutes=n})}else{var t=[],a=null;g.voicePrefix&&(a=_.find(g.outboundRoutes,{id:Number(g.voicePrefix.VoiceExtensionId)}));for(var i=0;i<g.outboundRoutes.length;i++)a&&g.outboundRoutes[i].id===a.id&&(g.outboundRoutes[i].canSelect=!1,t.push(g.outboundRoutes[i]));g.outboundRoutes=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voicePrefixes","voicePrefix","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditvoicePrefixDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.voicePrefix.getAgents({id:c.voicePrefix.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UservoicePrefix?"penalty "+e.UservoicePrefix.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.voicePrefix=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.removeAgents({id:c.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.addAgents({id:c.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("VOICE.ALL_AGENTS"),labelSelected:r.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","voicePrefix","voicePrefixes","realtime","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("voicePrefixagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.voicePrefix.getTeams({id:l.voicePrefix.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.voicePrefix=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("VOICE.ALL_TEAMS"),labelSelected:t.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.removeTeams({id:l.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.voicePrefix.addTeams({id:l.voicePrefix.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","voicePrefix","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("voicePrefixteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voicePrefixes=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voicePrefixes",f.listOrder="",f.listOrderAsc=null,f.selectedVoicePrefixes=[],f.query={fields:"createdAt,updatedAt,id,name,VoiceExtensionId,callerIdAll,description",sort:"-updatedAt",limit:10,page:1},f.editdialog=function(e,n){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes.rows,license:f.license,setting:null,crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"voicePrefixagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes?f.voicePrefixes.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.teamadddialog=function(e,n){i.show({controller:"voicePrefixteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voicePrefix:e,voicePrefixes:f.voicePrefixes?f.voicePrefixes.rows:[],crudPermissions:f.crudPermissions}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voicePrefix")+"?").htmlContent("<b>"+(e.name||"voicePrefix")+"</b> will be deleted.").ariaLabel("delete voicePrefix").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getVoicePrefixes=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voicePrefix.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VoicePrefixes",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditvoicePrefix=function(e,n){i.show({controller:"CreateOrEditvoicePrefixDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voicePrefixes/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voicePrefix:n,voicePrefixes:f.voicePrefixes.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deletevoicePrefix=y,f.exportSelectedVoicePrefixes=function(){var e=angular.copy(f.selectedVoicePrefixes);return f.selectedVoicePrefixes=[],e},f.deleteSelectedVoicePrefixes=function(e){var n=i.confirm().title("Are you sure want to delete the selected voicePrefixes?").htmlContent("<b>"+f.selectedVoicePrefixes.length+" selected</b> will be deleted.").ariaLabel("delete voicePrefixs").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoicePrefixes.forEach(function(e){y(e)}),f.selectedVoicePrefixes=[]})},f.deselectVoicePrefixes=function(){f.selectedVoicePrefixes=[]},f.selectAllVoicePrefixes=function(){f.selectedVoicePrefixes=f.voicePrefixes.rows},g.hasRole("admin")?m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){f.outboundRoutes=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_OUTBOUNDROUTES",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.voiceExtension.get({fields:"id,exten",type:"outbound",VoiceExtensionId:"null",nolimit:"true"}).$promise.then(function(e){f.outboundRoutes=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:403}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.outboundRoutes,{id:e.resourceId})}),t=null;if(f.voicePrefix&&(t=_.find(f.outboundRoutes,{id:Number(f.voicePrefix.VoiceExtensionId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.outboundRoutes,{id:t.id});a.canSelect=!1,n.push(a)}f.outboundRoutes=n})}else{var t=[],a=null;f.voicePrefix&&(a=_.find(f.outboundRoutes,{id:Number(f.voicePrefix.VoiceExtensionId)}));for(var i=0;i<f.outboundRoutes.length;i++)a&&f.outboundRoutes[i].id===a.id&&(f.outboundRoutes[i].canSelect=!1,t.push(f.outboundRoutes[i]));f.outboundRoutes=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GEToutboundRoutes",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.voicePrefixes=e||{count:0,rows:[]}}function y(e){m.voicePrefix.delete({id:e.id}).$promise.then(function(){_.remove(f.voicePrefixes.rows,{id:e.id}),f.voicePrefixes.count-=1,f.voicePrefixes.rows.length||f.getVoicePrefixes(),p.success({title:_.startCase("voicePrefix")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoicePrefix"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoicePrefix",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoicePrefixes())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voicePrefixes","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoicePrefixesController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="VOICE.EDIT_VOICEQUEUE",r.voiceQueue=angular.copy(n),r.voiceQueues=e,r.newVoiceQueue=!1,r.voiceQueue||(r.voiceQueue={type:"inbound",strategy:"ringall",timeout:15,retry:2,random_periodic_announce:"no",announce_holdtime:"no",announce_position:"no",reportholdtime:"no",autopause:"no",ringinuse:"no",timeoutrestart:"no",setinterfacevar:"no",setqueuevar:"no",setqueueentryvar:"no"},r.title="VOICE.NEW_VOICEQUEUE",r.newVoiceQueue=!0),r.addNewVoiceQueue=function(){r.errors=[],i.voiceQueue.save(r.voiceQueue).$promise.then(function(e){r.voiceQueues.unshift(e.toJSON()),a.success({title:"VoiceQueue properly created",msg:r.voiceQueue.name?r.voiceQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveVoiceQueue=function(){r.errors=[],i.voiceQueue.update({id:r.voiceQueue.id},r.voiceQueue).$promise.then(function(e){var n=_.find(r.voiceQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"VoiceQueue properly saved!",msg:r.voiceQueue.name?r.voiceQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteVoiceQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The voiceQueue will be deleted.").ariaLabel("Delete VoiceQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.voiceQueue.delete({id:r.voiceQueue.id}).$promise.then(function(){_.remove(r.voiceQueues,{id:r.voiceQueue.id}),a.success({title:"VoiceQueue properly deleted!",msg:(r.voiceQueue.name||"voiceQueue")+" has been deleted!"}),l(r.voiceQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.voiceQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","voiceQueues","voiceQueue","api","Auth","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceQueueDialogController",e)}(),function(){"use strict";function e(e,l,a,d,n,t,i,s,o,r){var c=this;function m(){return l(function(t,n){return l(function(n,t){return d.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],o.hasRole("admin")?e:c.section?c.section.autoAssociation?e:l(function(n,t){return d.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:o.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),l(function(n,t){return d.voiceQueue.getAgents({id:c.voiceQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserVoiceQueue?"penalty "+e.UserVoiceQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=o.getCurrentUser(),c.voiceQueue=n,c.crudPermissions=r,c.penalty=0,c.realtime=i,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return o.hasRole("admin")?m().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):l(function(t,n){d.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceWith(c.selectedItems,c.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,l(function(e,n){_.isEmpty(t)?e():d.voiceQueue.removeAgents({id:c.voiceQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return r=n,l(function(e,n){if(_.isEmpty(r))e();else{for(var t=[],a=_.groupBy(r,"penalty"),i=0;i<Object.keys(a).length;i++){var s=Object.keys(a)[i],o=_.filter(r,["penalty",s]);t.push(d.voiceQueue.addAgents({id:c.voiceQueue.id,ids:_.map(o,"id"),penalty:_.trim(s,"penalty "),realtime:c.realtime||!1}).$promise)}l.all(t).then(function(){e()}).catch(function(e){n(e)})}});var r}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),a.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"penalty",labelAll:s.instant("VOICE.ALL_AGENTS"),labelSelected:s.instant("VOICE.SELECTED_AGENTS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+c.penalty});var t=_.xorWith(c.startingSelectedItems,c.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","voiceQueue","voiceQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("VoiceQueueagentaddController",e)}(),function(){"use strict";function e(e,i,a,s,n,t,o,r){var l=this;function d(){return i(function(t,n){return i(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:i(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),i(function(n,t){return s.voiceQueue.getTeams({id:l.voiceQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.voiceQueue=n,l.crudPermissions=r,l.penalty=0,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"penalty",labelAll:t.instant("VOICE.ALL_TEAMS"),labelSelected:t.instant("VOICE.SELECTED_TEAMS"),transferCallback:function(e,n){n?e.forEach(function(e){e.penalty=void 0}):e.forEach(function(e){e.penalty="penalty "+l.penalty});var t=_.xorWith(l.startingSelectedItems,l.selectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):i(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceWith(l.selectedItems,l.startingSelectedItems,function(e,n){return e.id===n.id&&e.penalty===n.penalty});return(t=e,i(function(e,n){_.isEmpty(t)?e():s.voiceQueue.removeTeams({id:l.voiceQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return a=n,i(function(e,n){if(!_.isEmpty(a)){var t=_.map(a,function(e){return{id:e.id,penalty:_.trim(e.penalty,"penalty ")}});return s.voiceQueue.addTeams({id:l.voiceQueue.id,teams:t}).$promise.then(function(){e()}).catch(function(e){n(e)})}e()});var a}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),a.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","voiceQueue","$translate","Auth","crudPermissions"],angular.module("app.voice").controller("VoiceQueueteamaddController",e)}(),function(){"use strict";function e(t,e,a,i,s,n,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=n,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=e.protocol()+"://"+e.host(),u.voiceQueue=c||t.params.voiceQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=t.params.tab||0,u.teamadddialog=function(e,n){a.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){a.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(i.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:u.voiceQueues?u.voiceQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.gotogoto=function(e,n){{if(!d.hasRole("admin"))return r.userProfileSection.get({userProfileId:d.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.queues",{}):l.info({title:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:s.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.queues",{})}},u.alert=l.info,u.gotoVoiceQueues=function(){t.go("app.voice.voiceQueues",{},{reload:"app.voice.voiceQueues"})},u.saveVoiceQueue=function(){r.voiceQueue.update({id:u.voiceQueue.id},u.voiceQueue).$promise.then(function(){l.success({title:"VoiceQueue updated!",msg:u.voiceQueue.name?u.voiceQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_MUSICONHOLDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true"}).$promise.then(function(e){u.musiconholds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:407}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;return n?n.autoAssociation?void 0:r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.musiconholds,{id:e.resourceId})}),t=null;if(u.voiceQueue&&(t=_.find(u.musiconholds,{name:u.voiceQueue.musiconhold})),t&&!_.some(n,["id",t.id])){var a=_.find(u.musiconholds,{id:t.id});a.canSelect=!1,n.push(a)}u.musiconholds=n}):r.voiceMusicOnHold.get({fields:"id,name",nolimit:"true",defaultEntry:1}).$promise.then(function(e){u.musiconholds=e.rows||[]})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETmusiconholds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.sound.get({fields:"id,name,save_name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.sounds=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_SOUNDS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.sound.get({fields:"id,name,save_name",sort:"name",nolimit:"true"}).$promise.then(function(e){u.sounds=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1007}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.sounds,{id:e.resourceId})});u.sounds.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.sounds=n})}else u.sounds=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETsounds",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){u.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:u.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(u.pauses,{id:e.resourceId})});u.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),u.pauses=n})}else u.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voiceQueue","userProfileSection"],angular.module("app.voice").controller("VoiceQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.voiceQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="voiceQueues",f.listOrder="",f.listOrderAsc=null,f.selectedVoiceQueues=[],f.query={fields:"createdAt,updatedAt,id,name,type,strategy,timeout,maxlen,retry,wrapuptime,weight,joinempty,leavewhenempty,musiconhold,announce,description,periodic_announce,queue_reporthold,queue_youarenext,queue_thereare,queue_callswaiting,queue_holdtime,queue_minutes,queue_minute,queue_seconds,queue_thankyou,announce_frequency,min_announce_frequency,periodic_announce_frequency,random_periodic_announce,announce_holdtime,announce_position,announce_position_limit,reportholdtime,acw,acwTimeout,autopause,ringinuse,memberdelay,timeoutrestart,monitor_format,context,setinterfacevar,setqueuevar,setqueueentryvar,servicelevel,mandatoryDisposition,mandatoryDispositionPauseId",type:"inbound",sort:"-updatedAt",channel:"voice",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Ringall",value:"'ringall'"},{option:"Round Robin Memory",value:"'rrmemory'"},{option:"Least Recent",value:"'leastrecent'"},{option:"Fewest Calls",value:"'fewestcalls'"},{option:"Random",value:"'random'"},{option:"Linear",value:"'linear'"},{option:"Weight Random",value:"'wrandom'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayjoinempty=_.keyBy([{option:"no",value:"'no'",disabled:"vm.voiceQueue.joinempty.length === 1  && vm.voiceQueue.joinempty[0] === 'no'"},{option:"yes",value:"'yes'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'yes'"},{option:"strict",value:"'strict'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'strict'"},{option:"loose",value:"'loose'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'loose'"},{option:"paused",value:"'paused'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'paused'"},{option:"penalty",value:"'penalty'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'penalty'"},{option:"inuse",value:"'inuse'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'inuse'"},{option:"ringing",value:"'ringing'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'ringing'"},{option:"unavailable",value:"'unavailable'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'unavailable'"},{option:"invalid",value:"'invalid'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'invalid'"},{option:"unknown",value:"'unknown'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'unknown'"},{option:"wrapup",value:"'wrapup'",disabled:"vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === 'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayleavewhenempty=_.keyBy([{option:"no",value:"'no'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'no'"},{option:"yes",value:"'yes'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'yes'"},{option:"strict",value:"'strict'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'strict'"},{option:"loose",value:"'loose'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'loose'"},{option:"paused",value:"'paused'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'paused'"},{option:"penalty",value:"'penalty'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'penalty'"},{option:"inuse",value:"'inuse'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'inuse'"},{option:"ringing",value:"'ringing'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'ringing'"},{option:"unavailable",value:"'unavailable'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'unavailable'"},{option:"invalid",value:"'invalid'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'invalid'"},{option:"unknown",value:"'unknown'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'unknown'"},{option:"wrapup",value:"'wrapup'",disabled:"vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === 'wrapup'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayrandom_periodic_announce=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayannounce_holdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Once",value:"'once'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayannounce_position=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"},{option:"Limit",value:"'limit'"},{option:"More",value:"'more'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayreportholdtime=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayautopause=_.keyBy([{option:"Yes",value:"'all'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arrayringinuse=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraytimeoutrestart=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraymonitor_format=_.keyBy([{option:"Inactive",value:"''"},{option:"wav",value:"'wav'"},{option:"wav49",value:"'wav49'"},{option:"gsm",value:"'gsm'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetinterfacevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueuevar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.arraysetqueueentryvar=_.keyBy([{option:"Yes",value:"'yes'"},{option:"No",value:"'no'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.voice.voiceQueues.edit",{id:e.id,voiceQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"VoiceQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:f.voiceQueues?f.voiceQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"VoiceQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{voiceQueue:e,voiceQueues:f.voiceQueues?f.voiceQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voiceQueue")+"?").htmlContent("<b>"+(e.name||"voiceQueue")+"</b> will be deleted.").ariaLabel("delete voiceQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:411}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.voice.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.voice.realtime.queues",{})}},f.success=E,f.getVoiceQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.voiceQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="VoiceQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditVoiceQueue=function(e,n){i.show({controller:"CreateOrEditVoiceQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceQueue:n,voiceQueues:f.voiceQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteVoiceQueue=y,f.exportSelectedVoiceQueues=function(){var e=angular.copy(f.selectedVoiceQueues);return f.selectedVoiceQueues=[],e},f.deleteSelectedVoiceQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected voiceQueues?").htmlContent("<b>"+f.selectedVoiceQueues.length+" selected</b> will be deleted.").ariaLabel("delete VoiceQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedVoiceQueues.forEach(function(e){y(e)}),f.selectedVoiceQueues=[]})},f.deselectVoiceQueues=function(){f.selectedVoiceQueues=[]},f.selectAllVoiceQueues=function(){f.selectedVoiceQueues=f.voiceQueues.rows};var b=!0,A=1;function E(e){f.voiceQueues=e||{count:0,rows:[]}}function y(e){m.voiceQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.voiceQueues.rows,{id:e.id}),f.voiceQueues.count-=1,f.voiceQueues.rows.length||f.getVoiceQueues(),p.success({title:_.startCase("VoiceQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getVoiceQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.voice").controller("VoiceQueuesController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="VOICE.EDIT_VOICERECORDING",g.voiceRecording=angular.copy(l),g.voiceRecordings=r,g.newVoiceRecording=!1,g.voiceRecording||(g.voiceRecording={},g.title="VOICE.NEW_VOICERECORDING",g.newVoiceRecording=!0),g.addNewVoiceRecording=function(){g.errors=[],d.voiceRecording.save(g.voiceRecording).$promise.then(function(e){g.voiceRecordings.unshift(e.toJSON()),o.success({title:"VoiceRecording properly created",msg:g.voiceRecording.name?g.voiceRecording.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveVoiceRecording=function(){g.errors=[],d.voiceRecording.update({id:g.voiceRecording.id},g.voiceRecording).$promise.then(function(e){var n=_.find(g.voiceRecordings,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"VoiceRecording properly saved!",msg:g.voiceRecording.name?g.voiceRecording.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteVoiceRecording=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The voiceRecording will be deleted.").ariaLabel("Delete VoiceRecording").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.voiceRecording.delete({id:g.voiceRecording.id}).$promise.then(function(){_.remove(g.voiceRecordings,{id:g.voiceRecording.id}),o.success({title:"VoiceRecording properly deleted!",msg:(g.voiceRecording.name||"voiceRecording")+" has been deleted!"}),v(g.voiceRecording)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.voiceRecording.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","voiceRecordings","voiceRecording","api","Auth","license","setting","crudPermissions"],angular.module("app.voice").controller("CreateOrEditVoiceRecordingDialogController",e)}(),function(){"use strict";function e(e,n){var t=this;t.voiceRecording={},t.init=function(e){t.voiceRecording=e}}e.$inject=["api","toasty"],angular.module("app.voice").controller("VoiceRecordingSentimentStatisticsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.voiceRecording=c||e.params.voiceRecording||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.alert=l.info,p.gotoVoiceRecordings=function(){e.go("app.voice.voiceRecordings",{},{reload:"app.voice.voiceRecordings"})},p.saveVoiceRecording=function(){r.voiceRecording.update({id:p.voiceRecording.id},p.voiceRecording).$promise.then(function(){l.success({title:"VoiceRecording updated!",msg:p.voiceRecording.name?p.voiceRecording.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvoiceRecording",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","voiceRecording","userProfile","userProfileSection"],angular.module("app.voice").controller("VoiceRecordingController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,l,r,d,c,m,u,p,g,v,h,f){var b=this;function A(n,e){return m.voiceRecording.runTranscribe({id:n.id,runSentiment:!1}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING"),msg:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING")+" succeded!"}),n.transcribeStatus=e.transcribeStatus}).catch(function(e){p.error({title:l.instant("VOICE.RUNTRANSCRIBE_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}function E(n,e){return m.voiceRecording.runTranscribe({id:n.id,runSentiment:!0}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING"),msg:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING")+" succeded!"}),n.transcribeStatus=e.transcribeStatus}).catch(function(e){p.error({title:l.instant("VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}function y(e,n){return m.voiceRecording.runTranscribe({id:e.id,runSentiment:!0}).$promise.then(function(e){p.success({title:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING"),msg:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING")+" succeded!"})}).catch(function(e){p.error({title:l.instant("VOICE.RUNSENTIMENT_VOICERECORDING"),msg:e.data?e.data.message?e.data.message:JSON.stringify(e.data):e.toString()})})}b.license=v,b.setting=h,b.currentUser=g.getCurrentUser(),b.voiceRecordings=r||{count:0,rows:[]},b.userProfile=d,b.userProfileSection=c&&1==c.count?c.rows[0]:null,b.crudPermissions=g.parseCrudPermissions(b.userProfileSection?b.userProfileSection.crudPermissions:null),b.table="voiceRecordings",b.listOrder="",b.listOrderAsc=null,b.selectedVoiceRecordings=[],b.query={fields:"createdAt,updatedAt,id,format,value,type,uniqueid,calleridnum,exten,connectedlinenum,queue,membername,rating,audio,userDisposition,userSecondDisposition,userThirdDisposition,transcribeStatus,fileText,failureReason,sentiment,sPositive,sNegative,sNeutral,sMixed",sort:"-createdAt",createdAt:"@msUtils.firstLastDayMonth()",limit:10,page:1},b.query.createdAt=u.firstLastDayMonth(),b.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE_RANGE"}],b.editstate=function(e,n){t.go("app.voice.voiceRecordings.edit",{id:e.id,voiceRecording:e,crudPermissions:b.crudPermissions})},b.runtranscriberuntranscribesentiment=A,b.runtranscribesentimentruntranscribesentiment=E,b.runsentimentruntranscribesentiment=y,b.downloadtranscribefile2=function(s,e){var t=!1,n=_.isNil(s.format)?s.value.substring(s.value.lastIndexOf(".")):s.format;t=".mp4"===n;-1<s.value.lastIndexOf("/")?s.value.substring(s.value.lastIndexOf("/")+1):-1<s.value.lastIndexOf("\\")?s.value.substring(s.value.lastIndexOf("\\")+1):s.value;return m.voiceRecording.downloadTranscribe({id:s.id}).$promise.then(function(e){var n=[e.buffer],t="download",a=new Blob(n,{type:e.type});t=s.uniqueid+".txt";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.downloadfile2=function(r,e){var t=!1,n=_.isNil(r.format)?r.value.substring(r.value.lastIndexOf(".")):r.format;t=".mp4"===n;-1<r.value.lastIndexOf("/")?r.value.substring(r.value.lastIndexOf("/")+1):-1<r.value.lastIndexOf("\\")?r.value.substring(r.value.lastIndexOf("\\")+1):r.value;return m.voiceRecording.download({id:r.id}).$promise.then(function(e){var n,t,a=[e.buffer],i="download",s=new Blob(a,{type:e.type});n=r.value,t=-1<n.lastIndexOf("/")?n.substring(n.lastIndexOf("/")+1):-1<n.lastIndexOf("\\")?n.substring(n.lastIndexOf("\\")+1):n,i=(t=t.substring(0,t.lastIndexOf(".")))+r.format;var o=window.document.createElement("a");o.setAttribute("href",URL.createObjectURL(s)),o.setAttribute("download",i),document.body.appendChild(o),o.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else"404"===String(e.status)&&!1===t?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.WRONG_EXTENSION")}):"404"===String(e.status)?p.info({title:l.instant("VOICE.CANT_DOWNLOAD_THIS_FILE"),msg:l.instant("VOICE.FILE_NOT_FOUND")}):p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.voiceRecording.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},b.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("voiceRecording")+"?").htmlContent("<b>"+(e.name||"voiceRecording")+"</b> will be deleted.").ariaLabel("delete voiceRecording").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){O(e)},function(){console.log("CANCEL")})},b.success=I,b.getVoiceRecordings=function(){b.query.offset=(b.query.page-1)*b.query.limit,g.hasRole("admin")?b.promise=m.voiceRecording.get(b.query,I).$promise:(b.query.id=b.userProfile.id,b.query.section="VoiceRecordings",b.promise=m.userProfile.getResources(b.query,I).$promise)},b.createOrEditVoiceRecording=function(e,n){i.show({controller:"CreateOrEditVoiceRecordingDialogController",controllerAs:"vm",templateUrl:"app/main/apps/voice/views/voiceRecordings/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{voiceRecording:n,voiceRecordings:b.voiceRecordings.rows,license:b.license,setting:b.setting,crudPermissions:b.crudPermissions}})},b.deleteVoiceRecording=O,b.exportSelectedVoiceRecordings=function(){var e=angular.copy(b.selectedVoiceRecordings);b.selectedVoiceRecordings=[],b.userProfile.privacyEnabled&&_.forEach(e,function(e){e.calleridnum=f.mask(e.calleridnum),e.exten=f.mask(e.exten),e.connectedlinenum=f.mask(e.connectedlinenum),e.membername=f.mask(e.membername)});return e},b.deleteSelectedVoiceRecordings=function(e){var n=i.confirm().title("Are you sure want to delete the selected voiceRecordings?").htmlContent("<b>"+b.selectedVoiceRecordings.length+" selected</b> will be deleted.").ariaLabel("delete VoiceRecordings").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){b.selectedVoiceRecordings.forEach(function(e){O(e)}),b.selectedVoiceRecordings=[]})},b.deselectVoiceRecordings=function(){b.selectedVoiceRecordings=[]},b.selectAllVoiceRecordings=function(){b.selectedVoiceRecordings=b.voiceRecordings.rows},b.runtranscribeSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){A(e,n)}),b.selectedVoiceRecordings=[]},b.runtranscribesentimentSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){E(e,n)}),b.selectedVoiceRecordings=[]},b.runsentimentSelectedVoiceRecordings=function(n){b.selectedVoiceRecordings.forEach(function(e){y(e,n)}),b.selectedVoiceRecordings=[]};var S=!0,T=1;function I(e){b.voiceRecordings=e||{count:0,rows:[]}}function O(e){m.voiceRecording.delete({id:e.id}).$promise.then(function(){_.remove(b.voiceRecordings.rows,{id:e.id}),b.voiceRecordings.count-=1,b.voiceRecordings.rows.length||b.getVoiceRecordings(),p.success({title:_.startCase("VoiceRecording")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){b.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEvoiceRecording"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEvoiceRecording",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){S?o(function(){S=!1}):(n||(T=b.query.page),e!==n&&(b.query.page=1),e||(b.query.page=T),b.getVoiceRecordings())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","voiceRecordings","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting","privacyManager"],angular.module("app.voice").controller("VoiceRecordingsController",e)}(),function(){"use strict";function e(e,t,n){switch(this.selectedTab=0,t.current.name){case"app.whatsapp.realtime.agents":this.selectedTab=0;break;case"app.whatsapp.realtime.queues":this.selectedTab=1;break;default:this.selectedTab=0,t.go("app.whatsapp.realtime.agents")}e.$watch("vm.selectedTab",function(e,n){if(e!==n)switch(e){case 0:t.go("app.whatsapp.realtime.agents");break;case 1:t.go("app.whatsapp.realtime.queues");break;default:t.go("app.whatsapp.realtime.agents")}})}e.$inject=["$scope","$state","socket"],angular.module("app.whatsapp").controller("WhatsappRealtimeController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(){"twilio"===g.whatsappAccount.type&&(g.whatsappAccount.baseUrl=null)}function h(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPACCOUNT",g.whatsappAccount=angular.copy(l),g.whatsappAccounts=r,g.newWhatsappAccount=!1,g.whatsappAccount||(g.whatsappAccount={remote:t.protocol()+"://"+t.host()+(t.port()?":"+t.port():""),type:"twilio",notificationSound:!0,queueTransferTimeout:300,waitForTheAssignedAgent:10,waitForTheAssignedQueue:10,agentTransferTimeout:300},g.title="WHATSAPP.NEW_WHATSAPPACCOUNT",g.newWhatsappAccount=!0),n.params.id&&(g.whatsappAccount.WhatsappAccountId=n.params.id),g.addNewWhatsappAccount=function(){g.errors=[],v(),d.whatsappAccount.save(g.whatsappAccount).$promise.then(function(e){g.whatsappAccounts.unshift(e.toJSON()),o.success({title:"WhatsappAccount properly created",msg:g.whatsappAccount.name?g.whatsappAccount.name+" has been created!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappAccount=function(){g.errors=[],v(),d.whatsappAccount.update({id:g.whatsappAccount.id},g.whatsappAccount).$promise.then(function(e){var n=_.find(g.whatsappAccounts,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappAccount properly saved!",msg:g.whatsappAccount.name?g.whatsappAccount.name+" has been saved!":""}),h(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappAccount=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappAccount will be deleted.").ariaLabel("Delete WhatsappAccount").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.whatsappAccount.delete({id:g.whatsappAccount.id}).$promise.then(function(){_.remove(g.whatsappAccounts,{id:g.whatsappAccount.id}),o.success({title:"WhatsappAccount properly deleted!",msg:(g.whatsappAccount.name||"whatsappAccount")+" has been deleted!"}),h(g.whatsappAccount)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappAccount.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=h,c.hasRole("admin")?d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){g.lists=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.lists,{id:e.resourceId})}),t=null;if(g.whatsappAccount&&(t=_.find(g.lists,{id:Number(g.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(g.lists,{id:t.id});a.canSelect=!1,n.push(a)}g.lists=n})}else{var t=[],a=null;g.whatsappAccount&&(a=_.find(g.lists,{id:Number(g.whatsappAccount.ListId)}));for(var i=0;i<g.lists.length;i++)a&&g.lists[i].id===a.id&&(g.lists[i].canSelect=!1,t.push(g.lists[i]));g.lists=t}}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),c.hasRole("admin")?d.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){g.pauses=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):d.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){g.pauses=e.rows||[]}).then(function(){return d.userProfileSection.get({userProfileId:g.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return d.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(g.pauses,{id:e.resourceId})});g.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),g.pauses=n})}else g.pauses=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappAccounts","whatsappAccount","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappAccountDialogController",e)}(),function(){"use strict";function e(o,i,a,s,e){var r=this;function n(e,n){if(r.whatsappAccountApps.rows.length){var t=r.whatsappAccountApps.rows[n]?r.whatsappAccountApps.rows[n]:r.whatsappAccountApps.rows[0];i.show({controller:"EditWhatsappAccountApp"+(t.appType||t.app).toLowerCase()+"DialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/"+(t.appType||t.app).toLowerCase()+"/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccountApp:t,whatsappAccount:r.whatsappAccount,crudPermissions:r.crudPermissions}}).then(function(e){e&&(e.id?r.whatsappAccountApps.rows[n]=e:r.whatsappAccountApps.rows.splice(n,0,e),l())}).catch(function(e){e&&s.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:EDITMODALSHOW",msg:e.data?JSON.stringify(e.data):e.toString()})})}}function l(){for(var e=1,n=[],t=0;t<r.whatsappAccountApps.rows.length;t++,0){var a=r.whatsappAccountApps.rows[t],i=[],s=[];a.intervals="*,*,*,*"!==a.interval?[a.interval]:a.IntervalId?_.map(_.filter(r.intervals.rows,{IntervalId:a.IntervalId}),"interval"):[],a.context=r.whatsappAccount.context,a.exten=r.whatsappAccount.exten,a.type&&(a.type=a.type.toLowerCase()),a.priority=i.length?_.last(i).priority+1:e,e=(s.length?_.last(s).priority:a.priority)+1,n=_.concat(n,i,[a],s)}o.whatsappAccount.addApplications({id:r.whatsappAccount.id},_.sortBy(n,"priority")).$promise.then(function(e){r.whatsappAccountApps.rows=e.rows}).catch(function(e){console.error(e)})}function t(e){r.whatsappAccountApps=e||{count:0,rows:[]}}r.currentUser=e.getCurrentUser(),r.whatsappAccount={},r.whatsappAccountApps={count:0,rows:[]},r.selectedWhatsappAccountApps=[],r.crudPermissions,r.query={sort:"priority"},r.apps=_.reject(_.sortBy([{app:"Interval",appType:"interval",types:["always","custom","list"],fields:[],isApp:!1},{app:"noop",appType:"noop",type:"noop",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,fields:[{title:"Value",name:"value",type:"text",param:0}]},{app:"system",appType:"system",type:"system",icon:"icon-apps",interval:"*,*,*,*",required:!0,isApp:!0,extraApi:[{name:"variables",field:{name:"variable",key:"name"},route:"variable",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1012}}],fields:[{title:"Command",name:"command",type:"text",required:!0,param:0},{title:"Variable",name:"variable",type:"apiselect",values:"variables",value:"variable.name",option:"variable.name",defaultValues:[{value:"''",option:"None"}],defaultValue:"''",param:1}]},{app:"gotop",appType:"gotop",type:"goto",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Priority",name:"priority",type:"number",required:!0,min:0,param:0}]},{app:"gotoif",appType:"gotoif",type:"gotoif",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Condition",name:"condition",type:"text",required:!0,param:0},{title:"truepriority",name:"truepriority",type:"number",min:1,required:!0,param:1},{title:"falsepriority",name:"falsepriority",type:"number",min:1,required:!0,param:2}]},{app:"queue",appType:"queue",foreignKey:"WhatsappQueueId",type:"queue",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"queues",field:{name:"queue",key:"name"},route:"whatsappQueue",filters:{fields:"id,name,type",sort:"name",nolimit:!0},permissions:{section:2102}}],fields:[{title:"Queue",name:"queue",type:"apiselect",values:"queues",value:"queue.name",option:"queue.name",defaultValue:300,required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:300,param:1}]},{app:"agent",appType:"agent",type:"agent",foreignKey:"UserId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"agents",field:{name:"agent",key:"name"},route:"user",filters:{fields:"id,name",sort:"name",nolimit:!0,role:"agent"},permissions:{section:202}}],fields:[{title:"Agent",name:"agent",type:"apiselect",values:"agents",value:"agent.name",option:"agent.name",required:!0,param:0},{title:"Timeout",name:"timeout",type:"number",max:2147483,min:0,required:!0,defaultValue:30,param:1}]},{app:"autoreply",appType:"autoreply",type:"autoreply",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"times",name:"times",type:"select",defaultValue:"1",values:[{option:"One Time",value:"2"},{option:"Always",value:"0"},{option:"First Message",value:"1"}],required:!0,param:0},{title:"Text",name:"text",type:"textarea",required:!0,param:1}]},{app:"close",appType:"close",type:"close",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Disposition",name:"disposition",type:"text",required:!0,param:0}]},{app:"tag",appType:"tag",type:"tag",foreignKey:"TagId",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,extraApi:[{name:"tags",field:{name:"tag",key:"name"},route:"tag",filters:{fields:"id,name",sort:"name",nolimit:!0},permissions:{section:1008}}],fields:[{title:"Tag",name:"tag",type:"apiselect",values:"tags",value:"tag.name",option:"tag.name",required:!0,param:0}]},{app:"dialogflow",appType:"dialogflow",type:"dialogflow",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"Key",name:"key",type:"text",required:!0,param:0},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{option:"Danish",value:"'da'"},{option:"English",value:"'en'"},{option:"German",value:"'de'"},{option:"Italian",value:"'it'"},{option:"Spanish",value:"'es'"},{option:"French",value:"'fr'"},{option:"Indonesian",value:"'id'"},{option:"Japanese",value:"'ja'"},{option:"Korean (South Korea)",value:"'ko'"},{option:"Dutch",value:"'nl'"},{option:"Norwegian",value:"'no'"},{option:"Portuguese (European)",value:"'pt'"},{option:"Portuguese (Nrazilian)",value:"'pt-br'"},{option:"Russian",value:"'ru'"},{option:"Swedish",value:"'sv'"},{option:"Thai",value:"'th'"},{option:"Ukrainian",value:"'uk'"},{option:"Chinese (Simplified)",value:"'zh-CN'"},{option:"Chinese (Hong Kong)",value:"'zh-HK'"},{option:"Chinese (Traditional)",value:"'zh-TW'"}],required:!0,param:1},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:2,help:!0}]},{app:"dialogflowV2",appType:"dialogflowv2",type:"dialogflowv2",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"ProjectID",name:"projectId",type:"text",required:!0,param:0},{title:"ClientEmail",name:"clientEmail",type:"text",required:!0,param:1},{title:"PrivateKey",name:"privateKey",type:"textarea",required:!0,param:2},{title:"language",name:"language",type:"select",defaultValue:"'en'",values:[{value:"'zh-HK'",option:"Chinese (Cantonese)"},{value:"'zh-CN'",option:"Chinese (Simplified)"},{value:"'zh-TW'",option:"Chinese (Traditional)"},{value:"'da'",option:"Danish"},{value:"'nl'",option:"Dutch"},{value:"'en'",option:"English"},{value:"'en-AU'",option:"English (Australia)"},{value:"'en-CA'",option:"English (Canada)"},{value:"'en-GB'",option:"English (Great Britain)"},{value:"'en-IN'",option:"English (India)"},{value:"'en-US'",option:"English (US)"},{value:"'fr'",option:"French"},{value:"'fr-CA'",option:"French (Canada)"},{value:"'fr-FR'",option:"'France (France)"},{value:"'de'",option:"German"},{value:"'hi'",option:"Hindi"},{value:"'id'",option:"Indonesian"},{value:"'it'",option:"Italian"},{value:"'ja'",option:"Japanese"},{value:"'ko'",option:"Korean"},{value:"'no'",option:"Norwegian"},{value:"'pl'",option:"Polish"},{value:"'pt-BR'",option:"Portuguese (Brazil)"},{value:"'pt-PT'",option:"Portuguese (Portugal)"},{value:"'ru'",option:"Russian"},{value:"'es'",option:"Spanish"},{value:"'es-419'",option:"Spanish (Latin America)"},{value:"'es-ES'",option:"Spanish (Spain)"},{value:"'sw'",option:"Swedish"},{value:"'th'",option:"Thai"},{value:"'tr'",option:"Turkish"},{value:"'uk'",option:"Ukrainian"}],required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,param:4,help:!0}]},{app:"amazonlex",appType:"amazonlex",type:"amazonlex",icon:"icon-apps",interval:"*,*,*,*",isApp:!0,fields:[{title:"accesskeyid",name:"accesskeyid",type:"text",required:!0,param:0},{title:"secretaccesskey",name:"secretaccesskey",type:"text",required:!0,param:1},{title:"lexregion",name:"lexregion",type:"select",defaultValue:"'us-east-1'",values:[{option:"US East (N. Virginia)",value:"'us-east-1'"},{option:"US West (Oregon)",value:"'us-west-2'"},{option:"EU (Ireland)",value:"'eu-west-1'"},{option:"Asia Pacific (Sydney)",value:"'ap-southeast-2'"}],required:!0,param:2},{title:"botname",name:"botname",type:"text",required:!0,param:3},{title:"welcomemessage",name:"welcomemessage",type:"textarea",maxlength:255,required:!1,param:4,help:!0}]}],["app"]),{isApp:!1}),r.list={group:{name:"opt1",pull:"clone"},animation:100,sort:!1},r.applications={group:{name:"opt2",put:"opt1"},animation:100,onAdd:function(e){n(e,e.newIndex)},onSort:function(e){l()}},r.init=function(e,n){r.whatsappAccount=e,r.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},r.applications.disabled=!r.crudPermissions.canEdit,r.query.id=e.id,r.query.isApp=!0,r.query.nolimit=!0,r.getWhatsappAccountApps(),r.getIntervals()},r.deleteConfirm=function(e,n,t){var a=i.confirm().title("Are you sure want to delete the application?").htmlContent("<b>"+e.app+"</b> will be deleted.").ariaLabel("delete application").targetEvent(t).ok("OK").cancel("CANCEL");i.show(a).then(function(){r.whatsappAccountApps.rows.splice(n,1),l()},function(){console.log("CANCEL")})},r.getWhatsappAccountApps=function(){r.promise=o.whatsappAccount.getApplications(r.query,t).$promise},r.editWhatsappAccountApp=n,r.editInterval=function(e,n){if(r.whatsappAccountApps.rows.length){var t=r.whatsappAccountApps.rows[n]?r.whatsappAccountApps.rows[n]:r.whatsappAccountApps.rows[0];i.show({controller:"EditWhatsappAccountAppintervalDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/interval/dialog.html",parent:angular.element(a.body),targetEvent:e,clickOutsideToClose:!0,locals:{interval:{interval:t.interval,IntervalId:t.IntervalId,application:!0},intervals:[],crudPermissions:r.crudPermissions}}).then(function(e){e&&(t.interval=e.interval||"*,*,*,*",t.IntervalId=e.IntervalId||null,l())})}},r.deleteWhatsappAccountApp=function(e){_.remove(r.whatsappAccountApps.rows,{id:e.id}),l(),s.success({title:"App deleted!",msg:e.app?e.app+" has been deleted!":""})},r.deleteSelectedWhatsappAccountApps=function(e){var n=i.confirm().title("Are you sure want to delete the selected applications?").htmlContent("<b>"+r.selectedWhatsappAccountApps.length+" selected</b> will be deleted.").ariaLabel("delete applications").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){r.selectedWhatsappAccountApps.forEach(function(e){_.remove(r.whatsappAccountApps.rows,{id:e.id})}),r.selectedWhatsappAccountApps=[],l()})},r.rewriteRouting=l,r.getIntervals=function(){return o.interval.get({fields:"id,interval,IntervalId"}).$promise.then(function(e){r.intervals=e}).catch(function(e){console.error(e)})}}e.$inject=["api","$mdDialog","$document","toasty","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountActionsController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappAccount.getAgents({id:c.whatsappAccount.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserWhatsappAccount?"penalty "+e.UserWhatsappAccount.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.whatsappAccount=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappAccount.removeAgents({id:c.whatsappAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappAccount.addAgents({id:c.whatsappAccount.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("WHATSAPP.ALL_AGENTS"),labelSelected:r.instant("WHATSAPP.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","whatsappAccount","whatsappAccounts","realtime","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappAccountagentaddController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.agent=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.agent.appdata)switch(l.agent.appType?l.agent.appType.toLowerCase():l.agent.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.agent.appdata.split(",");l.agent.key=d[0],l.agent.language=d[1],l.agent.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.agent.appdata.split(",");l.agent.projectId=d[0],l.agent.clientEmail=d[1],l.agent.privateKey=d[2],l.agent.language=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.agent.appdata.split(",");l.agent.accesskeyid=d[0],l.agent.secretaccesskey=d[1],l.agent.lexregion=d[2],l.agent.botname=d[3],l.agent.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.agent.appdata.split(",");l.agent.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.agent.text=d.slice(1,d.length).join(",");break;case"message":l.agent.text=l.agent.appdata;break;case"set":l.agent.name=l.agent.appdata.split("=")[0],l.agent.value=l.agent.appdata.split("=")[1];break;case"agi":l.agent.project=l.agent.appdata;break;default:var c=l.agent.appdata.split(",");l.agent.agent=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.agent.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.agent.timeout=30;function m(e){n.hide(e)}l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outbounddial"===l.agent.appType.toLowerCase()&&(l.agent.prefix=l.agent.phone?l.agent.phone.split("$")[0]:void 0,l.agent.callerId=l.agent.callerID?"CALLERID(all)="+l.agent.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.agent.type&&"outbound"===l.agent.type.toLowerCase()&&"outboundDial"===l.agent.appType&&(l.agent.phone=i.cutdigits?(l.agent.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.agent.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.agent.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.agent.options+="U(xcally-mixmonitor-context)"):l.agent.options=l.agent.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.agents,{name:l.agent.agent});n&&(l.agent.UserId=n.id);if(l.agent.appType&&"custom"===l.agent.appType);else switch((l.agent.app||l.agent.appType).toLowerCase()){case"set":l.agent.appdata=l.agent.name+"="+l.agent.value;break;case"custom":break;default:e[0]=l.agent.agent,e[1]=l.agent.timeout,l.agent.appdata=e.join(",")}m(l.agent)},l.closeDialog=m,o.hasRole("admin")?s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.user.get({fields:"id,name",sort:"name",nolimit:"true",role:"agent"}).$promise.then(function(e){l.agents=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:202}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.agents,{id:e.resourceId})}),t=null;if(l.agent&&(t=_.find(l.agents,{name:l.agent.agent})),t&&!_.some(n,["id",t.id])){var a=_.find(l.agents,{id:t.id});a.canSelect=!1,n.push(a)}l.agents=n})}else{var t=[],a=null;l.agent&&(a=_.find(l.agents,{name:l.agent.agent}));for(var i=0;i<l.agents.length;i++)a&&l.agents[i].id===a.id&&(l.agents[i].canSelect=!1,t.push(l.agents[i]));l.agents=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETagents",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppagentDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.amazonlex=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.amazonlex.appdata)switch(l.amazonlex.appType?l.amazonlex.appType.toLowerCase():l.amazonlex.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.amazonlex.appdata.split(",");l.amazonlex.key=d[0],l.amazonlex.language=d[1],l.amazonlex.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.amazonlex.appdata.split(",");l.amazonlex.projectId=d[0],l.amazonlex.clientEmail=d[1],l.amazonlex.privateKey=d[2],l.amazonlex.language=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=d[0],l.amazonlex.secretaccesskey=d[1],l.amazonlex.lexregion=d[2],l.amazonlex.botname=d[3],l.amazonlex.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.amazonlex.appdata.split(",");l.amazonlex.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.amazonlex.text=d.slice(1,d.length).join(",");break;case"message":l.amazonlex.text=l.amazonlex.appdata;break;case"set":l.amazonlex.name=l.amazonlex.appdata.split("=")[0],l.amazonlex.value=l.amazonlex.appdata.split("=")[1];break;case"agi":l.amazonlex.project=l.amazonlex.appdata;break;default:var c=l.amazonlex.appdata.split(",");l.amazonlex.accesskeyid=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.amazonlex.secretaccesskey=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.amazonlex.lexregion=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.amazonlex.botname=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.amazonlex.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.amazonlex.lexregion="us-east-1";function m(e){n.hide(e)}l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outbounddial"===l.amazonlex.appType.toLowerCase()&&(l.amazonlex.prefix=l.amazonlex.phone?l.amazonlex.phone.split("$")[0]:void 0,l.amazonlex.callerId=l.amazonlex.callerID?"CALLERID(all)="+l.amazonlex.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.amazonlex.type&&"outbound"===l.amazonlex.type.toLowerCase()&&"outboundDial"===l.amazonlex.appType&&(l.amazonlex.phone=i.cutdigits?(l.amazonlex.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.amazonlex.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.amazonlex.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.amazonlex.options+="U(xcally-mixmonitor-context)"):l.amazonlex.options=l.amazonlex.options.replace("U(xcally-mixmonitor-context)",""));if(l.amazonlex.appType&&"custom"===l.amazonlex.appType);else switch((l.amazonlex.app||l.amazonlex.appType).toLowerCase()){case"set":l.amazonlex.appdata=l.amazonlex.name+"="+l.amazonlex.value;break;case"custom":break;default:e[0]=l.amazonlex.accesskeyid,e[1]=l.amazonlex.secretaccesskey,e[2]=l.amazonlex.lexregion,e[3]=l.amazonlex.botname,e[4]=l.amazonlex.welcomemessage,l.amazonlex.appdata=e.join(",")}m(l.amazonlex)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppamazonlexDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.autoreply=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.autoreply.appdata)switch(l.autoreply.appType?l.autoreply.appType.toLowerCase():l.autoreply.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.autoreply.appdata.split(",");l.autoreply.key=d[0],l.autoreply.language=d[1],l.autoreply.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.autoreply.appdata.split(",");l.autoreply.projectId=d[0],l.autoreply.clientEmail=d[1],l.autoreply.privateKey=d[2],l.autoreply.language=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.autoreply.appdata.split(",");l.autoreply.accesskeyid=d[0],l.autoreply.secretaccesskey=d[1],l.autoreply.lexregion=d[2],l.autoreply.botname=d[3],l.autoreply.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.autoreply.appdata.split(",");l.autoreply.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.autoreply.text=d.slice(1,d.length).join(",");break;case"message":l.autoreply.text=l.autoreply.appdata;break;case"set":l.autoreply.name=l.autoreply.appdata.split("=")[0],l.autoreply.value=l.autoreply.appdata.split("=")[1];break;case"agi":l.autoreply.project=l.autoreply.appdata;break;default:var c=l.autoreply.appdata.split(",");l.autoreply.times=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.autoreply.text=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.autoreply.times=1;function m(e){n.hide(e)}l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outbounddial"===l.autoreply.appType.toLowerCase()&&(l.autoreply.prefix=l.autoreply.phone?l.autoreply.phone.split("$")[0]:void 0,l.autoreply.callerId=l.autoreply.callerID?"CALLERID(all)="+l.autoreply.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.autoreply.type&&"outbound"===l.autoreply.type.toLowerCase()&&"outboundDial"===l.autoreply.appType&&(l.autoreply.phone=i.cutdigits?(l.autoreply.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.autoreply.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.autoreply.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.autoreply.options+="U(xcally-mixmonitor-context)"):l.autoreply.options=l.autoreply.options.replace("U(xcally-mixmonitor-context)",""));if(l.autoreply.appType&&"custom"===l.autoreply.appType);else switch((l.autoreply.app||l.autoreply.appType).toLowerCase()){case"set":l.autoreply.appdata=l.autoreply.name+"="+l.autoreply.value;break;case"custom":break;default:e[0]=l.autoreply.times,e[1]=l.autoreply.text,l.autoreply.appdata=e.join(",")}m(l.autoreply)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppautoreplyDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.close=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.close.appdata)switch(l.close.appType?l.close.appType.toLowerCase():l.close.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.close.appdata.split(",");l.close.key=d[0],l.close.language=d[1],l.close.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.close.appdata.split(",");l.close.projectId=d[0],l.close.clientEmail=d[1],l.close.privateKey=d[2],l.close.language=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.close.appdata.split(",");l.close.accesskeyid=d[0],l.close.secretaccesskey=d[1],l.close.lexregion=d[2],l.close.botname=d[3],l.close.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.close.appdata.split(",");l.close.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.close.text=d.slice(1,d.length).join(",");break;case"message":l.close.text=l.close.appdata;break;case"set":l.close.name=l.close.appdata.split("=")[0],l.close.value=l.close.appdata.split("=")[1];break;case"agi":l.close.project=l.close.appdata;break;default:var c=l.close.appdata.split(",");l.close.disposition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outbounddial"===l.close.appType.toLowerCase()&&(l.close.prefix=l.close.phone?l.close.phone.split("$")[0]:void 0,l.close.callerId=l.close.callerID?"CALLERID(all)="+l.close.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.close.type&&"outbound"===l.close.type.toLowerCase()&&"outboundDial"===l.close.appType&&(l.close.phone=i.cutdigits?(l.close.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.close.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.close.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.close.options+="U(xcally-mixmonitor-context)"):l.close.options=l.close.options.replace("U(xcally-mixmonitor-context)",""));if(l.close.appType&&"custom"===l.close.appType);else switch((l.close.app||l.close.appType).toLowerCase()){case"set":l.close.appdata=l.close.name+"="+l.close.value;break;case"custom":break;default:e[0]=l.close.disposition,l.close.appdata=e.join(",")}m(l.close)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppcloseDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflow=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflow.appdata)switch(l.dialogflow.appType?l.dialogflow.appType.toLowerCase():l.dialogflow.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflow.appdata.split(",");l.dialogflow.key=d[0],l.dialogflow.language=d[1],l.dialogflow.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflow.appdata.split(",");l.dialogflow.projectId=d[0],l.dialogflow.clientEmail=d[1],l.dialogflow.privateKey=d[2],l.dialogflow.language=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflow.appdata.split(",");l.dialogflow.accesskeyid=d[0],l.dialogflow.secretaccesskey=d[1],l.dialogflow.lexregion=d[2],l.dialogflow.botname=d[3],l.dialogflow.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflow.appdata.split(",");l.dialogflow.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflow.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflow.text=l.dialogflow.appdata;break;case"set":l.dialogflow.name=l.dialogflow.appdata.split("=")[0],l.dialogflow.value=l.dialogflow.appdata.split("=")[1];break;case"agi":l.dialogflow.project=l.dialogflow.appdata;break;default:var c=l.dialogflow.appdata.split(",");l.dialogflow.key=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflow.language=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflow.welcomemessage=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}else l.dialogflow.language="en";function m(e){n.hide(e)}l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outbounddial"===l.dialogflow.appType.toLowerCase()&&(l.dialogflow.prefix=l.dialogflow.phone?l.dialogflow.phone.split("$")[0]:void 0,l.dialogflow.callerId=l.dialogflow.callerID?"CALLERID(all)="+l.dialogflow.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.dialogflow.type&&"outbound"===l.dialogflow.type.toLowerCase()&&"outboundDial"===l.dialogflow.appType&&(l.dialogflow.phone=i.cutdigits?(l.dialogflow.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflow.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflow.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflow.options+="U(xcally-mixmonitor-context)"):l.dialogflow.options=l.dialogflow.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflow.appType&&"custom"===l.dialogflow.appType);else switch((l.dialogflow.app||l.dialogflow.appType).toLowerCase()){case"set":l.dialogflow.appdata=l.dialogflow.name+"="+l.dialogflow.value;break;case"custom":break;default:e[0]=l.dialogflow.key,e[1]=l.dialogflow.language,e[2]=l.dialogflow.welcomemessage,l.dialogflow.appdata=e.join(",")}m(l.dialogflow)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppdialogflowDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.dialogflowv2=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.dialogflowv2.appdata)switch(l.dialogflowv2.appType?l.dialogflowv2.appType.toLowerCase():l.dialogflowv2.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.key=d[0],l.dialogflowv2.language=d[1],l.dialogflowv2.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=d[0],l.dialogflowv2.clientEmail=d[1],l.dialogflowv2.privateKey=d[2],l.dialogflowv2.language=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.accesskeyid=d[0],l.dialogflowv2.secretaccesskey=d[1],l.dialogflowv2.lexregion=d[2],l.dialogflowv2.botname=d[3],l.dialogflowv2.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.dialogflowv2.appdata.split(",");l.dialogflowv2.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.dialogflowv2.text=d.slice(1,d.length).join(",");break;case"message":l.dialogflowv2.text=l.dialogflowv2.appdata;break;case"set":l.dialogflowv2.name=l.dialogflowv2.appdata.split("=")[0],l.dialogflowv2.value=l.dialogflowv2.appdata.split("=")[1];break;case"agi":l.dialogflowv2.project=l.dialogflowv2.appdata;break;default:var c=l.dialogflowv2.appdata.split(",");l.dialogflowv2.projectId=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.dialogflowv2.clientEmail=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.dialogflowv2.privateKey=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10),l.dialogflowv2.language=_.isEmpty(c[3])?c[3]:isNaN(c[3])?c[3]:parseInt(c[3],10),l.dialogflowv2.welcomemessage=_.isEmpty(c[4])?c[4]:isNaN(c[4])?c[4]:parseInt(c[4],10)}else l.dialogflowv2.language="en";function m(e){n.hide(e)}l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outbounddial"===l.dialogflowv2.appType.toLowerCase()&&(l.dialogflowv2.prefix=l.dialogflowv2.phone?l.dialogflowv2.phone.split("$")[0]:void 0,l.dialogflowv2.callerId=l.dialogflowv2.callerID?"CALLERID(all)="+l.dialogflowv2.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.dialogflowv2.type&&"outbound"===l.dialogflowv2.type.toLowerCase()&&"outboundDial"===l.dialogflowv2.appType&&(l.dialogflowv2.phone=i.cutdigits?(l.dialogflowv2.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.dialogflowv2.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.dialogflowv2.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.dialogflowv2.options+="U(xcally-mixmonitor-context)"):l.dialogflowv2.options=l.dialogflowv2.options.replace("U(xcally-mixmonitor-context)",""));if(l.dialogflowv2.appType&&"custom"===l.dialogflowv2.appType);else switch((l.dialogflowv2.app||l.dialogflowv2.appType).toLowerCase()){case"set":l.dialogflowv2.appdata=l.dialogflowv2.name+"="+l.dialogflowv2.value;break;case"custom":break;default:e[0]=l.dialogflowv2.projectId,e[1]=l.dialogflowv2.clientEmail,e[2]=l.dialogflowv2.privateKey,e[3]=l.dialogflowv2.language,e[4]=l.dialogflowv2.welcomemessage,l.dialogflowv2.appdata=e.join(",")}m(l.dialogflowv2)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppdialogflowv2DialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotoif=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotoif.appdata)switch(l.gotoif.appType?l.gotoif.appType.toLowerCase():l.gotoif.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotoif.appdata.split(",");l.gotoif.key=d[0],l.gotoif.language=d[1],l.gotoif.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotoif.appdata.split(",");l.gotoif.projectId=d[0],l.gotoif.clientEmail=d[1],l.gotoif.privateKey=d[2],l.gotoif.language=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotoif.appdata.split(",");l.gotoif.accesskeyid=d[0],l.gotoif.secretaccesskey=d[1],l.gotoif.lexregion=d[2],l.gotoif.botname=d[3],l.gotoif.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotoif.appdata.split(",");l.gotoif.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotoif.text=d.slice(1,d.length).join(",");break;case"message":l.gotoif.text=l.gotoif.appdata;break;case"set":l.gotoif.name=l.gotoif.appdata.split("=")[0],l.gotoif.value=l.gotoif.appdata.split("=")[1];break;case"agi":l.gotoif.project=l.gotoif.appdata;break;default:var c=l.gotoif.appdata.split(",");l.gotoif.condition=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.gotoif.truepriority=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10),l.gotoif.falsepriority=_.isEmpty(c[2])?c[2]:isNaN(c[2])?c[2]:parseInt(c[2],10)}function m(e){n.hide(e)}l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outbounddial"===l.gotoif.appType.toLowerCase()&&(l.gotoif.prefix=l.gotoif.phone?l.gotoif.phone.split("$")[0]:void 0,l.gotoif.callerId=l.gotoif.callerID?"CALLERID(all)="+l.gotoif.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.gotoif.type&&"outbound"===l.gotoif.type.toLowerCase()&&"outboundDial"===l.gotoif.appType&&(l.gotoif.phone=i.cutdigits?(l.gotoif.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotoif.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotoif.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotoif.options+="U(xcally-mixmonitor-context)"):l.gotoif.options=l.gotoif.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotoif.appType&&"custom"===l.gotoif.appType);else switch((l.gotoif.app||l.gotoif.appType).toLowerCase()){case"set":l.gotoif.appdata=l.gotoif.name+"="+l.gotoif.value;break;case"custom":break;default:e[0]=l.gotoif.condition,e[1]=l.gotoif.truepriority,e[2]=l.gotoif.falsepriority,l.gotoif.appdata=e.join(",")}m(l.gotoif)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppgotoifDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.gotop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.gotop.appdata)switch(l.gotop.appType?l.gotop.appType.toLowerCase():l.gotop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.gotop.appdata.split(",");l.gotop.key=d[0],l.gotop.language=d[1],l.gotop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.gotop.appdata.split(",");l.gotop.projectId=d[0],l.gotop.clientEmail=d[1],l.gotop.privateKey=d[2],l.gotop.language=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.gotop.appdata.split(",");l.gotop.accesskeyid=d[0],l.gotop.secretaccesskey=d[1],l.gotop.lexregion=d[2],l.gotop.botname=d[3],l.gotop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.gotop.appdata.split(",");l.gotop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.gotop.text=d.slice(1,d.length).join(",");break;case"message":l.gotop.text=l.gotop.appdata;break;case"set":l.gotop.name=l.gotop.appdata.split("=")[0],l.gotop.value=l.gotop.appdata.split("=")[1];break;case"agi":l.gotop.project=l.gotop.appdata;break;default:var c=l.gotop.appdata.split(",");l.gotop.priority=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outbounddial"===l.gotop.appType.toLowerCase()&&(l.gotop.prefix=l.gotop.phone?l.gotop.phone.split("$")[0]:void 0,l.gotop.callerId=l.gotop.callerID?"CALLERID(all)="+l.gotop.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.gotop.type&&"outbound"===l.gotop.type.toLowerCase()&&"outboundDial"===l.gotop.appType&&(l.gotop.phone=i.cutdigits?(l.gotop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.gotop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.gotop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.gotop.options+="U(xcally-mixmonitor-context)"):l.gotop.options=l.gotop.options.replace("U(xcally-mixmonitor-context)",""));if(l.gotop.appType&&"custom"===l.gotop.appType);else switch((l.gotop.app||l.gotop.appType).toLowerCase()){case"set":l.gotop.appdata=l.gotop.name+"="+l.gotop.value;break;case"custom":break;default:e[0]=l.gotop.priority,l.gotop.appdata=e.join(",")}m(l.gotop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppgotopDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;if(c.currentUser=l.getCurrentUser(),c.errors=[],c.title="TOOLS.EDIT_INTERVAL",c.interval=angular.copy(i),c.intervals=s,c.newInterval=!1,c.types=["always","custom","list"],c.crudPermissions=d,c.daysOfWeek=a.getDaysOfWeek(),c.monthNumber=a.getMonthNumber(),c.monthName=a.getMonthName(),c.daysOfMonth=a.getDaysOfMonth(),c.interval)if("*,*,*,*"!==c.interval.interval){c.type="custom";var m=c.interval.interval.split(","),u=m[0],p=m[1],g=m[2],v=m[3];if("*"!==u){var h,f=u.split("-")[0],b=u.split("-")[1];(h=new Date).setHours(Number(f.split(":")[0])),h.setMinutes(Number(f.split(":")[1])),c.timeRangeFrom=h,(h=new Date).setHours(Number(b.split(":")[0])),h.setMinutes(Number(b.split(":")[1])),c.timeRangeTo=h}"*"!==p&&(c.dayOfWeekFrom=p.split("-")[0],c.dayOfWeekTo=p.split("-")[1]),"*"!==g&&(c.monthDayFrom=g.split("-")[0],c.monthDayTo=g.split("-")[1]),"*"!==v&&(c.monthFrom=v.split("-")[0],c.monthTo=v.split("-")[1])}else c.type="always";else c.interval={interval:"*,*,*,*"},c.type="always",c.title="TOOLS.NEW_INTERVAL",c.newInterval=!0;function A(){switch(c.type){case"always":case"list":return"*,*,*,*";case"custom":var e=[];if("*"!==c.timeRangeFrom&&c.timeRangeFrom&&c.timeRangeTo){var n=(c.timeRangeFrom.getHours()<10?"0":"")+c.timeRangeFrom.getHours()+":"+(c.timeRangeFrom.getMinutes()<10?"0":"")+c.timeRangeFrom.getMinutes(),t=(c.timeRangeTo.getHours()<10?"0":"")+c.timeRangeTo.getHours()+":"+(c.timeRangeTo.getMinutes()<10?"0":"")+c.timeRangeTo.getMinutes();e.push(n+"-"+t)}else e.push("*");return c.dayOfWeekFrom?c.dayOfWeekTo?e.push(c.dayOfWeekFrom+"-"+c.dayOfWeekTo):e.push(c.dayOfWeekFrom):e.push("*"),c.monthDayFrom?c.monthDayTo?e.push(c.monthDayFrom+"-"+c.monthDayTo):e.push(c.monthDayFrom):e.push("*"),c.monthFrom?c.monthTo?e.push(c.monthFrom+"-"+c.monthTo):e.push(c.monthFrom):e.push("*"),e.join()}}function E(e){n.hide(e)}e.params.id&&!c.interval.application&&(c.interval.IntervalId=e.params.id),c.interval.IntervalId&&c.interval.application&&(c.type="list"),c.addNewInterval=function(){c.errors=[],c.interval.interval=A(),r.interval.save(c.interval).$promise.then(function(e){c.intervals.push(e),o.success({title:"Interval properly created",msg:c.interval.name?c.interval.name+" has been created!":""}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.save"}]})},c.saveInterval=function(){c.errors=[],c.interval.interval=A(),c.interval.application?("list"!==c.type&&(c.interval.IntervalId=null),E(c.interval)):r.interval.update({id:c.interval.id},c.interval).$promise.then(function(e){var n=_.find(c.intervals,{id:e.id});n&&_.merge(n,e),o.success({title:"Interval properly saved!",msg:"Interval has been saved!"}),E()}).catch(function(e){console.error(e),c.errors=e.data.errors||[{message:e.toString(),type:"api.interval.update"}]})},c.closeDialog=E,c.interval.application&&(l.hasRole("admin")?r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.interval.get({fields:"id,name,interval,IntervalId",IntervalId:"null",nolimit:!0}).$promise.then(function(e){c.intervals=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:c.currentUser.userProfileId,sectionId:1004}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=e&&e.rows?e.rows:[],t=[],a=null;c.interval&&(a=_.find(c.intervals,{name:c.interval.IntervalId})),a&&!_.some(n,["resourceId",a.id])&&c.intervals.forEach(function(e){e.id===a.id&&(e.canSelect=!1,t.push(e))}),c.intervals=t})}else c.intervals=[]}).catch(function(e){o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_INTERVALS",msg:e.data?JSON.stringify(e.data):e.toString()})}))}e.$inject=["$state","$mdDialog","$mdToast","IndexFactory","interval","intervals","toasty","api","Auth","crudPermissions"],angular.module("app.voice").controller("EditWhatsappAccountAppintervalDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.noop=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.noop.appdata)switch(l.noop.appType?l.noop.appType.toLowerCase():l.noop.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.noop.appdata.split(",");l.noop.key=d[0],l.noop.language=d[1],l.noop.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.noop.appdata.split(",");l.noop.projectId=d[0],l.noop.clientEmail=d[1],l.noop.privateKey=d[2],l.noop.language=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.noop.appdata.split(",");l.noop.accesskeyid=d[0],l.noop.secretaccesskey=d[1],l.noop.lexregion=d[2],l.noop.botname=d[3],l.noop.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.noop.appdata.split(",");l.noop.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.noop.text=d.slice(1,d.length).join(",");break;case"message":l.noop.text=l.noop.appdata;break;case"set":l.noop.name=l.noop.appdata.split("=")[0],l.noop.value=l.noop.appdata.split("=")[1];break;case"agi":l.noop.project=l.noop.appdata;break;default:var c=l.noop.appdata.split(",");l.noop.value=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outbounddial"===l.noop.appType.toLowerCase()&&(l.noop.prefix=l.noop.phone?l.noop.phone.split("$")[0]:void 0,l.noop.callerId=l.noop.callerID?"CALLERID(all)="+l.noop.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.noop.type&&"outbound"===l.noop.type.toLowerCase()&&"outboundDial"===l.noop.appType&&(l.noop.phone=i.cutdigits?(l.noop.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.noop.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.noop.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.noop.options+="U(xcally-mixmonitor-context)"):l.noop.options=l.noop.options.replace("U(xcally-mixmonitor-context)",""));if(l.noop.appType&&"custom"===l.noop.appType);else switch((l.noop.app||l.noop.appType).toLowerCase()){case"set":l.noop.appdata=l.noop.name+"="+l.noop.value;break;case"custom":break;default:e[0]=l.noop.value,l.noop.appdata=e.join(",")}m(l.noop)},l.closeDialog=m}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppnoopDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.queue=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.queue.appdata)switch(l.queue.appType?l.queue.appType.toLowerCase():l.queue.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.queue.appdata.split(",");l.queue.key=d[0],l.queue.language=d[1],l.queue.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.queue.appdata.split(",");l.queue.projectId=d[0],l.queue.clientEmail=d[1],l.queue.privateKey=d[2],l.queue.language=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.queue.appdata.split(",");l.queue.accesskeyid=d[0],l.queue.secretaccesskey=d[1],l.queue.lexregion=d[2],l.queue.botname=d[3],l.queue.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.queue.appdata.split(",");l.queue.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.queue.text=d.slice(1,d.length).join(",");break;case"message":l.queue.text=l.queue.appdata;break;case"set":l.queue.name=l.queue.appdata.split("=")[0],l.queue.value=l.queue.appdata.split("=")[1];break;case"agi":l.queue.project=l.queue.appdata;break;default:var c=l.queue.appdata.split(",");l.queue.queue=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.queue.timeout=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.queue.queue=300,l.queue.timeout=300;function m(e){n.hide(e)}l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outbounddial"===l.queue.appType.toLowerCase()&&(l.queue.prefix=l.queue.phone?l.queue.phone.split("$")[0]:void 0,l.queue.callerId=l.queue.callerID?"CALLERID(all)="+l.queue.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.queue.type&&"outbound"===l.queue.type.toLowerCase()&&"outboundDial"===l.queue.appType&&(l.queue.phone=i.cutdigits?(l.queue.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.queue.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.queue.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.queue.options+="U(xcally-mixmonitor-context)"):l.queue.options=l.queue.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.queues,{name:l.queue.queue});n&&(l.queue[_.capitalize("whatsapp")+"QueueId"]=n.id);if(l.queue.appType&&"custom"===l.queue.appType);else switch((l.queue.app||l.queue.appType).toLowerCase()){case"set":l.queue.appdata=l.queue.name+"="+l.queue.value;break;case"custom":break;default:e[0]=l.queue.queue,e[1]=l.queue.timeout,l.queue.appdata=e.join(",")}m(l.queue)},l.closeDialog=m,o.hasRole("admin")?s.whatsappQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_QUEUES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.whatsappQueue.get({fields:"id,name,type",sort:"name",nolimit:"true"}).$promise.then(function(e){l.queues=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:2102}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.queues,{id:e.resourceId})}),t=null;if(l.queue&&(t=_.find(l.queues,{name:l.queue.queue})),t&&!_.some(n,["id",t.id])){var a=_.find(l.queues,{id:t.id});a.canSelect=!1,n.push(a)}l.queues=n})}else{var t=[],a=null;l.queue&&(a=_.find(l.queues,{name:l.queue.queue}));for(var i=0;i<l.queues.length;i++)a&&l.queues[i].id===a.id&&(l.queues[i].canSelect=!1,t.push(l.queues[i]));l.queues=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETqueues",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppqueueDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.system=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.system.appdata)switch(l.system.appType?l.system.appType.toLowerCase():l.system.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.system.appdata.split(",");l.system.key=d[0],l.system.language=d[1],l.system.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.system.appdata.split(",");l.system.projectId=d[0],l.system.clientEmail=d[1],l.system.privateKey=d[2],l.system.language=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.system.appdata.split(",");l.system.accesskeyid=d[0],l.system.secretaccesskey=d[1],l.system.lexregion=d[2],l.system.botname=d[3],l.system.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.system.appdata.split(",");l.system.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.system.text=d.slice(1,d.length).join(",");break;case"message":l.system.text=l.system.appdata;break;case"set":l.system.name=l.system.appdata.split("=")[0],l.system.value=l.system.appdata.split("=")[1];break;case"agi":l.system.project=l.system.appdata;break;default:var c=l.system.appdata.split(",");l.system.command=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10),l.system.variable=_.isEmpty(c[1])?c[1]:isNaN(c[1])?c[1]:parseInt(c[1],10)}else l.system.variable="";function m(e){n.hide(e)}l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outbounddial"===l.system.appType.toLowerCase()&&(l.system.prefix=l.system.phone?l.system.phone.split("$")[0]:void 0,l.system.callerId=l.system.callerID?"CALLERID(all)="+l.system.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.system.type&&"outbound"===l.system.type.toLowerCase()&&"outboundDial"===l.system.appType&&(l.system.phone=i.cutdigits?(l.system.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.system.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.system.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.system.options+="U(xcally-mixmonitor-context)"):l.system.options=l.system.options.replace("U(xcally-mixmonitor-context)",""));if(l.system.appType&&"custom"===l.system.appType);else switch((l.system.app||l.system.appType).toLowerCase()){case"set":l.system.appdata=l.system.name+"="+l.system.value;break;case"custom":break;default:e[0]=l.system.command,e[1]=l.system.variable,l.system.appdata=e.join(",")}m(l.system)},l.closeDialog=m,o.hasRole("admin")?s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_VARIABLES",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.variable.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.variables=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1012}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.variables,{id:e.resourceId})}),t=null;if(l.system&&(t=_.find(l.variables,{name:l.system.variable})),t&&!_.some(n,["id",t.id])){var a=_.find(l.variables,{id:t.id});a.canSelect=!1,n.push(a)}l.variables=n})}else{var t=[],a=null;l.system&&(a=_.find(l.variables,{name:l.system.variable}));for(var i=0;i<l.variables.length;i++)a&&l.variables[i].id===a.id&&(l.variables[i].canSelect=!1,t.push(l.variables[i]));l.variables=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETvariables",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountAppsystemDialogController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r){var l=this;if(l.currentUser=o.getCurrentUser(),l.errors=[],l.title="WHATSAPP.EDIT_"+(a.appType||a.app).toUpperCase(),l.tag=angular.copy(a),l.crudPermissions=r,l.hasModulePermissions={},l.tag.appdata)switch(l.tag.appType?l.tag.appType.toLowerCase():l.tag.app.toLowerCase()){case"custom":break;case"dialogflow":var d=l.tag.appdata.split(",");l.tag.key=d[0],l.tag.language=d[1],l.tag.welcomemessage=d.slice(2,d.length).join(",");break;case"dialogflowv2":d=l.tag.appdata.split(",");l.tag.projectId=d[0],l.tag.clientEmail=d[1],l.tag.privateKey=d[2],l.tag.language=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"amazonlex":d=l.tag.appdata.split(",");l.tag.accesskeyid=d[0],l.tag.secretaccesskey=d[1],l.tag.lexregion=d[2],l.tag.botname=d[3],l.tag.welcomemessage=d.slice(4,d.length).join(",");break;case"autoreply":d=l.tag.appdata.split(",");l.tag.times=isNaN(d[0])?d[0]:parseInt(d[0],10),l.tag.text=d.slice(1,d.length).join(",");break;case"message":l.tag.text=l.tag.appdata;break;case"set":l.tag.name=l.tag.appdata.split("=")[0],l.tag.value=l.tag.appdata.split("=")[1];break;case"agi":l.tag.project=l.tag.appdata;break;default:var c=l.tag.appdata.split(",");l.tag.tag=_.isEmpty(c[0])?c[0]:isNaN(c[0])?c[0]:parseInt(c[0],10)}function m(e){n.hide(e)}l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outbounddial"===l.tag.appType.toLowerCase()&&(l.tag.prefix=l.tag.phone?l.tag.phone.split("$")[0]:void 0,l.tag.callerId=l.tag.callerID?"CALLERID(all)="+l.tag.callerID:void 0),l.saveWhatsappAccountApp=function(){l.errors=[];var e=[];l.tag.type&&"outbound"===l.tag.type.toLowerCase()&&"outboundDial"===l.tag.appType&&(l.tag.phone=i.cutdigits?(l.tag.prefix||"")+"${EXTEN:"+i.cutdigits+"}":(l.tag.prefix||"")+"${EXTEN}","none"!==i.recordingFormat?l.tag.options.indexOf("U(xcally-mixmonitor-context)")<0&&(l.tag.options+="U(xcally-mixmonitor-context)"):l.tag.options=l.tag.options.replace("U(xcally-mixmonitor-context)",""));var n=_.find(l.tags,{name:l.tag.tag});n&&(l.tag.TagId=n.id);if(l.tag.appType&&"custom"===l.tag.appType);else switch((l.tag.app||l.tag.appType).toLowerCase()){case"set":l.tag.appdata=l.tag.name+"="+l.tag.value;break;case"custom":break;default:e[0]=l.tag.tag,l.tag.appdata=e.join(",")}m(l.tag)},l.closeDialog=m,o.hasRole("admin")?s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TAGS",msg:e.data?JSON.stringify(e.data):e.toString()})}):s.tag.get({fields:"id,name",sort:"name",nolimit:"true"}).$promise.then(function(e){l.tags=e.rows||[]}).then(function(){return s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,sectionId:1008}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return s.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(l.tags,{id:e.resourceId})}),t=null;if(l.tag&&(t=_.find(l.tags,{name:l.tag.tag})),t&&!_.some(n,["id",t.id])){var a=_.find(l.tags,{id:t.id});a.canSelect=!1,n.push(a)}l.tags=n})}else{var t=[],a=null;l.tag&&(a=_.find(l.tags,{name:l.tag.tag}));for(var i=0;i<l.tags.length;i++)a&&l.tags[i].id===a.id&&(l.tags[i].canSelect=!1,t.push(l.tags[i]));l.tags=t}}).catch(function(e){t.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETtags",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$mdDialog","$q","toasty","whatsappAccountApp","whatsappAccount","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("EditWhatsappAccountApptagDialogController",e)}(),function(){"use strict";function e(e,a,n,t,i,s,o,r,l,d,c){var m=this;function u(e){var n=[{model:"disposition",action:"get",field:"name",params:{field:"name,level",level:e,MailAccountId:"null",SmsAccountId:"null",ChatWebsiteId:"null",OpenchannelAccountId:"null",WhatsappAccountId:"null",FaxAccountId:"null",ListId:"null",nolimit:!0}}],t=[{model:"whatsappAccount",action:"getDispositions",field:"name",params:{id:m.whatsappAccount.id,field:"name,level",level:e,nolimit:!0}}];return _.concat(t,n)}function p(e){m.whatsappAccountInteractions=e||{count:0,rows:[]};for(var n=0;n<m.whatsappAccountInteractions.rows.length;n+=1){var t=m.whatsappAccountInteractions.rows[n];h(t),t.Owner.name=f(t)}}function g(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.whatsappInteraction.get(m.query,p).$promise}function v(e){d.whatsappInteraction.delete({id:e.id}).$promise.then(function(){_.remove(m.whatsappAccountInteractions.rows,{id:e.id}),m.whatsappAccountInteractions.count-=1,m.whatsappAccountInteractions.rows.length||g(),l.success({title:"Interaction deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}function h(e){e.Contact?e.contactName=(e.Contact.firstName||"")+" "+(e.Contact.lastName||""):e.contactName=i.instant("DASHBOARDS.UNKNOWN")}function f(e){return e.UserId?e.UserId===m.currentUser.id?i.instant("DASHBOARDS.ME"):e.Owner.fullname+" <"+e.Owner.internal+">":i.instant("DASHBOARDS.NOT_ASSIGNED")}m.currentUser=c.getCurrentUser(),m.whatsappAccount={},m.whatsappAccountInteractions={count:0,rows:[]},m.selectedWhatsappAccountInteractions=[],m.crudPermissions,m.query={read:"null",closed:"null",sort:"-createdAt",includeAll:"true",limit:10,page:1},m.init=function(e,n,t){m.whatsappAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.WhatsappAccountId=m.whatsappAccount.id,m.advancedSearch={fields:[{name:"Id",column:"id",type:"number"},{name:"Contact",column:"Contact",type:"autocomplete",options:{searchFields:["firstName","lastName","email"],route:{model:"cmContact",action:"get",params:{fields:"id,firstName,lastName,email",Contact:"@autocomplete",nolimit:!0}},extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Subject",column:"subject",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Body",column:"body",type:"text",options:{excludedOperators:["$eq","$ne"]}},{name:"Status",column:"closed",type:"select",values:[{id:0,translate:"DASHBOARDS.OPENED"},{id:1,translate:"DASHBOARDS.CLOSED"}],options:{excludedOperators:["$ne"]}},{name:"Agent",column:"User",type:"autocomplete",options:{table:"i",route:{model:"user",action:"get",params:{role:"agent",fields:"id,name,fullname",nolimit:!0}},searchFields:["fullname","name"],extraOperators:["$substring"],excludedOperators:["$ne"]}},{name:"Tags",column:"Tag",type:"multiselect",options:{route:{model:"tag",action:"get",params:{nolimit:!0}},excludedOperators:["$notIn"]}},{name:"Start Date",column:"createdAt",type:"date",options:{excludedOperators:["$ne"]}},{name:"Read",column:"unreadMessages",type:"select",values:[{id:1,translate:"DASHBOARDS.READ"},{id:0,translate:"DASHBOARDS.UNREAD"}],options:{excludedOperators:["$ne"]}},{name:"Disposition",column:"disposition",type:"multiselect",options:{routes:u("first")}},{name:"Second Disposition",column:"secondDisposition",type:"multiselect",options:{routes:u("second")}},{name:"Third Disposition",column:"thirdDisposition",type:"multiselect",options:{routes:u("third")}}]},d.tag.get({sort:"name"}).$promise.then(function(e){m.tags=e||{count:0,rows:[]}}).then(function(){m.quickFilters=[{name:"Start Date",key:"createdAt",type:"date",label:"DASHBOARDS.SELECT_DATE"},{name:"Messages",key:"read",type:"select",label:"DASHBOARDS.SELECT_READ_UNREAD",customOptions:[{value:0,translate:"DASHBOARDS.UNREAD"},{value:1,translate:"DASHBOARDS.READ"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Status",key:"closed",type:"select",label:"DASHBOARDS.SELECT_STATUS",customOptions:[{value:0,translate:"DASHBOARDS.OPENED"},{value:1,translate:"DASHBOARDS.CLOSED"},{value:null,translate:"DASHBOARDS.ALL"}]},{name:"Agent",key:"UserId",type:"select",label:"DASHBOARDS.SELECT_AGENT",customOptions:[{value:"null",translate:"DASHBOARDS.NOT_ASSIGNED"},{value:void 0,translate:"DASHBOARDS.ALL"}]},{name:"Tag",key:"tag",type:"multiselect",label:"DASHBOARDS.SELECT_TAG",options:m.tags.rows,placeholder:"DASHBOARDS.TAGS"}]})},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the interaction?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("interaction #")+e.id||"interaction")+"</b> will be deleted.").ariaLabel("delete interaction").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){v(e)},function(){console.log("CANCEL")})},m.whatsappInteractionDownload=function(s,e,n){return d.whatsappInteraction.download({id:s.id,exists:!0,attachments:n}).$promise.then(function(e){var n=[e.buffer],t="interaction"+s.id,a=new Blob(n,{type:e.type});t="whatsapp-interaction"+s.id+".zip";var i=window.document.createElement("a");i.setAttribute("href",URL.createObjectURL(a)),i.setAttribute("download",t),document.body.appendChild(i),i.click()}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappAccount.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.success=p,m.getWhatsappAccountInteractions=g,m.createOrEditWhatsappAccountInteraction=function(e,n){o.show({controller:"CreateOrEditInteractionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/interactions/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:m.whatsappAccount,interaction:n,interactions:m.whatsappAccountInteractions.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.spywhatsappInteraction=function(e,t){o.show({controller:"AgentGeneralInteractionController",controllerAs:"vm",templateUrl:"app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,onShowing:function(e,n){e.vm.init({id:1,channel:"whatsapp",interaction:t,spy:!0},a.$parent.vm.setting)}})},m.openAdvancedSearch=function(){o.show({controller:"AdvancedSearchController",controllerAs:"vm",templateUrl:"app/core/dialogs/advanced-search/dialog.html",parent:angular.element(r.body),clickOutsideToClose:!1,locals:{fields:m.advancedSearch.fields,color:void 0,storagePath:"whatsapp.whatsappAccounts"},fullscreen:!0}).then(function(e){if(m.isSearchBarVisible=!(e.value||!m.query.filter),e.apply){var n="";n+="||WhatsappAccountId:=$eq["+m.whatsappAccount.id+"]",m.query.search=e.value?e.value+=n:e.value,g()}}).catch(function(e){l.error({title:"ERROR",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},m.exportSelectedWhatsappAccountInteractions=function(){var e=angular.copy(m.selectedWhatsappAccountInteractions);return m.selectedWhatsappAccountInteractions=[],e},m.deleteWhatsappAccountInteraction=v,m.deleteSelectedWhatsappAccountInteractions=function(e){var n=o.confirm().title("Are you sure want to delete the selected interactions?").htmlContent("<b>"+m.selectedWhatsappAccountInteractions.length+" selected</b> will be deleted.").ariaLabel("delete interactions").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedWhatsappAccountInteractions.forEach(function(e){v(e)}),m.selectedWhatsappAccountInteractions=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountInteractionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u){var p=this;p.currentUser=d.getCurrentUser(),p.license=s,p.setting=o,p.passwordPattern=p.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",p.location=n.protocol()+"://"+n.host(),p.whatsappAccount=c||e.params.whatsappAccount||{},p.userProfile=m,p.userProfileSection=u&&1==u.count?u.rows[0]:null,p.crudPermissions=d.parseCrudPermissions(p.userProfileSection?p.userProfileSection.crudPermissions:null),p.hasModulePermissions={},p.selectedTab=e.params.tab||0,p.baseUrl=[{name:"US Production",url:"https://us1.whatsapp.api.sinch.com"},{name:"EU Production",url:"https://eu1.whatsapp.api.sinch.com"}],p.agentadddialog=function(e,n){t.show({controller:"WhatsappAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappAccount:e,whatsappAccounts:p.whatsappAccounts?p.whatsappAccounts.rows:[],crudPermissions:p.crudPermissions,realtime:!1}})},p.alert=l.info,p.gotoWhatsappAccounts=function(){e.go("app.whatsapp.whatsappAccounts",{},{reload:"app.whatsapp.whatsappAccounts"})},p.saveWhatsappAccount=function(){"twilio"===p.whatsappAccount.type&&(p.whatsappAccount.baseUrl=null);r.whatsappAccount.update({id:p.whatsappAccount.id},p.whatsappAccount).$promise.then(function(){l.success({title:"WhatsappAccount updated!",msg:p.whatsappAccount.name?p.whatsappAccount.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data):e.toString()})})},d.hasRole("admin")?r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){p.lists=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.lists,{id:e.resourceId})}),t=null;if(p.whatsappAccount&&(t=_.find(p.lists,{id:Number(p.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(p.lists,{id:t.id});a.canSelect=!1,n.push(a)}p.lists=n})}else{var t=[],a=null;p.whatsappAccount&&(a=_.find(p.lists,{id:Number(p.whatsappAccount.ListId)}));for(var i=0;i<p.lists.length;i++)a&&p.lists[i].id===a.id&&(p.lists[i].canSelect=!1,t.push(p.lists[i]));p.lists=t}}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),d.hasRole("admin")?r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):r.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){p.pauses=e.rows||[]}).then(function(){return r.userProfileSection.get({userProfileId:p.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return r.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(p.pauses,{id:e.resourceId})});p.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),p.pauses=n})}else p.pauses=[]}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})})}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","whatsappAccount","userProfile","userProfileSection"],angular.module("app.whatsapp").controller("WhatsappAccountController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.whatsappAccountWhatsappCannedAnswers=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=d.whatsappAccount.getAnswers(m.query,u).$promise}function g(e){d.cannedAnswer.delete({id:e.id}).$promise.then(function(){_.remove(m.whatsappAccountWhatsappCannedAnswers.rows,{id:e.id}),m.whatsappAccountWhatsappCannedAnswers.count-=1,m.whatsappAccountWhatsappCannedAnswers.rows.length||p(),l.success({title:"WhatsappCannedAnswer deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:GETwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)l.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.whatsappAccount={},m.whatsappAccountWhatsappCannedAnswers={count:0,rows:[]},m.selectedWhatsappAccountWhatsappCannedAnswers=[],m.crudPermissions,m.query={fields:"createdAt,updatedAt,id,key,value,description",limit:10,page:1},m.init=function(e,n,t){m.whatsappAccount=e,m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.userProfile=t,m.query.WhatsappAccountId=m.whatsappAccount.id,m.query.id=m.whatsappAccount.id,p()},m.deleteConfirm=function(e,n){var t=o.confirm().title("Are you sure want to delete the whatsappCannedAnswer?").htmlContent("<b>"+(e.name||e.id&&_.upperFirst("whatsappCannedAnswer #")+e.id||"whatsappCannedAnswer")+"</b> will be deleted.").ariaLabel("delete whatsappCannedAnswer").targetEvent(n).ok("OK").cancel("CANCEL");o.show(t).then(function(){g(e)},function(){console.log("CANCEL")})},m.success=u,m.getWhatsappAccountWhatsappCannedAnswers=p,m.createOrEditWhatsappAccountWhatsappCannedAnswer=function(e,n){o.show({controller:"CreateOrEditWhatsappCannedAnswerDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/whatsappCannedAnswers/dialog.html",parent:angular.element(r.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:m.whatsappAccount,whatsappCannedAnswer:n,whatsappCannedAnswers:m.whatsappAccountWhatsappCannedAnswers.rows,license:null,setting:null,crudPermissions:m.crudPermissions}})},m.exportSelectedWhatsappAccountWhatsappCannedAnswers=function(){var e=angular.copy(m.selectedWhatsappAccountWhatsappCannedAnswers);return m.selectedWhatsappAccountWhatsappCannedAnswers=[],e},m.deleteWhatsappAccountWhatsappCannedAnswer=g,m.deleteSelectedWhatsappAccountWhatsappCannedAnswers=function(e){var n=o.confirm().title("Are you sure want to delete the selected whatsappCannedAnswers?").htmlContent("<b>"+m.selectedWhatsappAccountWhatsappCannedAnswers.length+" selected</b> will be deleted.").ariaLabel("delete whatsappCannedAnswers").targetEvent(e).ok("OK").cancel("CANCEL");o.show(n).then(function(){m.selectedWhatsappAccountWhatsappCannedAnswers.forEach(function(e){g(e)}),m.selectedWhatsappAccountWhatsappCannedAnswers=[]})}}e.$inject=["$cookies","$scope","$state","$q","$translate","$timeout","$mdDialog","$document","toasty","api","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountWhatsappCannedAnswersController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p){var g=this;function v(e){a.hide(e)}g.currentUser=c.getCurrentUser(),g.errors=[],g.setting=u,g.license=m,g.crudPermissions=p,g.hasModulePermissions={},g.passwordPattern=g.setting&&g.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",g.title="WHATSAPP.EDIT_WHATSAPPCANNEDANSWER",g.whatsappCannedAnswer=angular.copy(l),g.whatsappCannedAnswers=r,g.newWhatsappCannedAnswer=!1,g.whatsappCannedAnswer||(g.whatsappCannedAnswer={},g.title="WHATSAPP.NEW_WHATSAPPCANNEDANSWER",g.newWhatsappCannedAnswer=!0),n.params.id&&(g.whatsappCannedAnswer.WhatsappAccountId=n.params.id),g.addNewWhatsappCannedAnswer=function(){g.errors=[],d.cannedAnswer.save(g.whatsappCannedAnswer).$promise.then(function(e){g.whatsappCannedAnswers.unshift(e.toJSON()),o.success({title:"WhatsappCannedAnswer properly created",msg:g.whatsappCannedAnswer.name?g.whatsappCannedAnswer.name+" has been created!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.save"}];for(var n=0;n<e.data.errors.length;n+=1)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.saveWhatsappCannedAnswer=function(){g.errors=[],d.cannedAnswer.update({id:g.whatsappCannedAnswer.id},g.whatsappCannedAnswer).$promise.then(function(e){var n=_.find(g.whatsappCannedAnswers,{id:e.id});n&&_.merge(n,e.toJSON()),o.success({title:"WhatsappCannedAnswer properly saved!",msg:g.whatsappCannedAnswer.name?g.whatsappCannedAnswer.name+" has been saved!":""}),v(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.update"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},g.deleteWhatsappCannedAnswer=function(e){g.errors=[];var n=a.confirm().title("Are you sure?").content("The whatsappCannedAnswer will be deleted.").ariaLabel("Delete WhatsappCannedAnswer").ok("Delete").cancel("Cancel").targetEvent(e);a.show(n).then(function(){d.cannedAnswer.delete({id:g.whatsappCannedAnswer.id}).$promise.then(function(){_.remove(g.whatsappCannedAnswers,{id:g.whatsappCannedAnswer.id}),o.success({title:"WhatsappCannedAnswer properly deleted!",msg:(g.whatsappCannedAnswer.name||"whatsappCannedAnswer")+" has been deleted!"}),v(g.whatsappCannedAnswer)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){g.errors=e.data.errors||[{message:e.toString(),type:"api.cannedAnswer.delete"}];for(var n=0;n<e.data.errors.length;n++)o.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else o.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.cannedAnswer.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},g.getDateFromString=function(e){return null===e?void 0:new Date(e)},g.closeDialog=v}e.$inject=["$scope","$state","$location","$mdDialog","$q","$translate","toasty","whatsappCannedAnswers","whatsappCannedAnswer","api","Auth","license","setting","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappCannedAnswerDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c){var m=this;function u(e){m.dispositions=e||{count:0,rows:[]}}function p(){m.query.offset=(m.query.page-1)*m.query.limit,m.promise=l.whatsappAccount.getDispositions(m.query,u).$promise}function g(e){l.disposition.delete({id:e.id}).$promise.then(function(){p(),d.success({title:r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETED_SUCCESS_TITLE")})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){m.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEdisposition"}];for(var n=0;n<e.data.errors.length;n++)d.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEdisposition",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}m.currentUser=c.getCurrentUser(),m.dispositions={count:0,rows:[]},m.selectedDispositions=[],m.crudPermissions,m.levels={first:"1st",second:"2nd",third:"3rd"},m.query={fields:"id,level,name,description,ParentId,createdAt,updatedAt",sort:"-updatedAt",limit:10,page:1},m.init=function(e,n){m.whatsappAccount=e||{},m.crudPermissions=void 0!==n?n:{readOnly:!0,canEdit:!1,canDelete:!1},m.query.WhatsappAccountId=m.whatsappAccount.id,m.query.id=m.whatsappAccount.id,p()},m.deleteConfirm=function(e,n){var t=_.some(m.dispositions.rows,["ParentId",e.id]),a=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITION_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS."+(t?"DISPOSITION_DELETE_MESSAGE_CHILDREN":"DISPOSITION_DELETE_MESSAGE"),{name:e.name})).ariaLabel("Delete disposition").targetEvent(n).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(a).then(function(){g(e)})},m.success=u,m.getDispositions=p,m.createOrEditDisposition=function(e,n){i.show({controller:"CreateOrEditDispositionDialogController",controllerAs:"vm",templateUrl:"app/main/apps/tools/views/dispositions/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{disposition:n,model:{id:m.whatsappAccount.id,field:"WhatsappAccountId",route:"whatsappAccount"},license:null,setting:null,crudPermissions:m.crudPermissions}}).then(function(e){e&&p()})},m.deleteDisposition=g,m.exportSelectedDispositions=function(){var e=angular.copy(m.selectedDispositions);return m.selectedDispositions=[],e},m.deleteSelectedDispositions=function(e){var n=i.confirm().title(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_TITLE")).content(r.instant("TOOLS.NOTIFICATIONS.DISPOSITIONS_DELETE_MESSAGE",{total:m.selectedDispositions.length})).ariaLabel("Delete dispositions").targetEvent(e).ok("OK").cancel(r.instant("TOOLS.CANCEL"));i.show(n).then(function(){m.selectedDispositions.forEach(function(e){g(e)}),m.selectedDispositions=[]})},m.deselectDispositions=function(){m.selectedDispositions=[]},m.selectAllDispositions=function(){m.selectedDispositions=m.dispositions.rows};var v=!0,h=1;e.$watch("vm_dc.query.filter",function(e,n){v?o(function(){v=!1}):(n||(h=m.query.page),e!==n&&(m.query.page=1),e||(m.query.page=h),p())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","api","toasty","Auth"],angular.module("app.whatsapp").controller("WhatsappAccountDispositionsController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.whatsappAccounts=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="whatsappAccounts",f.listOrder="",f.listOrderAsc=null,f.selectedWhatsappAccounts=[],f.query={fields:"createdAt,updatedAt,id,name,key,ListId,remote,token,type,accountSid,authToken,phone,receiveUrl,deliveryReportUrl,notificationShake,notificationSound,notificationTemplate,queueTransfer,queueTransferTimeout,waitForTheAssignedAgent,waitForTheAssignedQueue,mandatoryDisposition,mandatoryDispositionPauseId,agentTransfer,agentTransferTimeout,description,baseUrl",sort:"-updatedAt",limit:10,page:1},f.arraytype=_.keyBy([{option:"Twilio",value:"'twilio'"},{option:"Sinch",value:"'sinch'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.whatsapp.whatsappAccounts.edit",{id:e.id,whatsappAccount:e,crudPermissions:f.crudPermissions})},f.interactionsgoto=function(e,n){t.go("app.whatsapp.whatsappAccounts.edit",{id:e.id,tab:5})},f.agentadddialog=function(e,n){i.show({controller:"WhatsappAccountagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappAccount:e,whatsappAccounts:f.whatsappAccounts?f.whatsappAccounts.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("whatsappAccount")+"?").htmlContent("<b>"+(e.name||"whatsappAccount")+"</b> will be deleted.").ariaLabel("delete whatsappAccount").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.success=E,f.getWhatsappAccounts=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.whatsappAccount.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="WhatsappAccounts",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditWhatsappAccount=function(e,n){i.show({controller:"CreateOrEditWhatsappAccountDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappAccounts/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappAccount:n,whatsappAccounts:f.whatsappAccounts.rows,license:f.license,setting:f.setting,crudPermissions:f.crudPermissions}})},f.deleteWhatsappAccount=y,f.exportSelectedWhatsappAccounts=function(){var e=angular.copy(f.selectedWhatsappAccounts);return f.selectedWhatsappAccounts=[],e},f.deleteSelectedWhatsappAccounts=function(e){var n=i.confirm().title("Are you sure want to delete the selected whatsappAccounts?").htmlContent("<b>"+f.selectedWhatsappAccounts.length+" selected</b> will be deleted.").ariaLabel("delete WhatsappAccounts").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedWhatsappAccounts.forEach(function(e){y(e)}),f.selectedWhatsappAccounts=[]})},f.deselectWhatsappAccounts=function(){f.selectedWhatsappAccounts=[]},f.selectAllWhatsappAccounts=function(){f.selectedWhatsappAccounts=f.whatsappAccounts.rows},g.hasRole("admin")?m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_LISTS",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.cmList.get({fields:"id,name",sort:"name"}).$promise.then(function(e){f.lists=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:301}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.lists,{id:e.resourceId})}),t=null;if(f.whatsappAccount&&(t=_.find(f.lists,{id:Number(f.whatsappAccount.ListId)})),t&&!_.some(n,["id",t.id])){var a=_.find(f.lists,{id:t.id});a.canSelect=!1,n.push(a)}f.lists=n})}else{var t=[],a=null;f.whatsappAccount&&(a=_.find(f.lists,{id:Number(f.whatsappAccount.ListId)}));for(var i=0;i<f.lists.length;i++)a&&f.lists[i].id===a.id&&(f.lists[i].canSelect=!1,t.push(f.lists[i]));f.lists=t}}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETlists",msg:e.data?JSON.stringify(e.data):e.toString()})}),g.hasRole("admin")?m.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){f.pauses=e.rows||[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_PAUSES",msg:e.data?JSON.stringify(e.data):e.toString()})}):m.pause.get({fields:"name,id",sort:"name",nolimit:"true"}).$promise.then(function(e){f.pauses=e.rows||[]}).then(function(){return m.userProfileSection.get({userProfileId:f.currentUser.userProfileId,sectionId:1005}).$promise}).then(function(e){var n=e&&e.rows?e.rows[0]:null;if(n){if(!n.autoAssociation)return m.userProfileResource.get({sectionId:n.id}).$promise.then(function(e){var n=_.map(e.rows,function(e){return _.find(f.pauses,{id:e.resourceId})});f.pauses.forEach(function(e){_.some(n,["id",e.id])||(e.canSelect=!1),n.push(e)}),f.pauses=n})}else f.pauses=[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETpauses",msg:e.data?JSON.stringify(e.data):e.toString()})});var b=!0,A=1;function E(e){f.whatsappAccounts=e||{count:0,rows:[]}}function y(e){m.whatsappAccount.delete({id:e.id}).$promise.then(function(){_.remove(f.whatsappAccounts.rows,{id:e.id}),f.whatsappAccounts.count-=1,f.whatsappAccounts.rows.length||f.getWhatsappAccounts(),p.success({title:_.startCase("WhatsappAccount")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEwhatsappAccount"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEwhatsappAccount",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getWhatsappAccounts())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","whatsappAccounts","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.whatsapp").controller("WhatsappAccountsController",e)}(),function(){"use strict";function e(t,a,e,n,i,s,o){var r=this;function l(e){t.hide(e)}r.currentUser=s.getCurrentUser(),r.errors=[],r.crudPermissions=o,r.hasModulePermissions={},r.title="WHATSAPP.EDIT_WHATSAPPQUEUE",r.whatsappQueue=angular.copy(n),r.whatsappQueues=e,r.newWhatsappQueue=!1,r.whatsappQueue||(r.whatsappQueue={strategy:"beepall",timeout:10},r.title="WHATSAPP.NEW_WHATSAPPQUEUE",r.newWhatsappQueue=!0),r.addNewWhatsappQueue=function(){r.errors=[],i.whatsappQueue.save(r.whatsappQueue).$promise.then(function(e){r.whatsappQueues.unshift(e.toJSON()),a.success({title:"WhatsappQueue properly created",msg:r.whatsappQueue.name?r.whatsappQueue.name+" has been created!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.save"}];for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.save",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.saveWhatsappQueue=function(){r.errors=[],i.whatsappQueue.update({id:r.whatsappQueue.id},r.whatsappQueue).$promise.then(function(e){var n=_.find(r.whatsappQueues,{id:e.id});n&&_.merge(n,e.toJSON()),a.success({title:"WhatsappQueue properly saved!",msg:r.whatsappQueue.name?r.whatsappQueue.name+" has been saved!":""}),l(e)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.update"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.deleteWhatsappQueue=function(e){r.errors=[];var n=t.confirm().title("Are you sure?").content("The whatsappQueue will be deleted.").ariaLabel("Delete WhatsappQueue").ok("Delete").cancel("Cancel").targetEvent(e);t.show(n).then(function(){i.whatsappQueue.delete({id:r.whatsappQueue.id}).$promise.then(function(){_.remove(r.whatsappQueues,{id:r.whatsappQueue.id}),a.success({title:"WhatsappQueue properly deleted!",msg:(r.whatsappQueue.name||"whatsappQueue")+" has been deleted!"}),l(r.whatsappQueue)}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){r.errors=e.data.errors||[{message:e.toString(),type:"api.whatsappQueue.delete"}];for(var n=0;n<e.data.errors.length;n++)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.whatsappQueue.delete",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})},function(){})},r.closeDialog=l}e.$inject=["$mdDialog","toasty","whatsappQueues","whatsappQueue","api","Auth","crudPermissions"],angular.module("app.whatsapp").controller("CreateOrEditWhatsappQueueDialogController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r,l,d){var c=this;function m(){return a(function(t,n){return a(function(n,t){return s.user.get({fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return c.items=e.rows?e.rows:[],l.hasRole("admin")?e:c.section?c.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:c.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return c.allowedItems=_.map(n,function(e){return _.find(c.items,{id:l.hasRole("admin")||c.section.autoAssociation?e.id:e.resourceId})}),c.startingAllowedItems=angular.copy(c.allowedItems),c.items.forEach(function(e){var n=_.find(c.allowedItems,{id:e.id});l.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappQueue.getAgents({id:c.whatsappQueue.id,fields:"id,name,internal,fullname",nolimit:!0,role:"agent"}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];c.selectedItems=_.map(n,function(e){var n=_.find(c.items,{id:e.id});return n.penalty=e.UserWhatsappQueue?"penalty "+e.UserWhatsappQueue.penalty:"",n.internal=e.hasOwnProperty("internal")?"<"+e.internal+">":"",n}),c.startingSelectedItems=angular.copy(c.selectedItems),c.dualMultiselectOptions.selectedItems=c.selectedItems,c.dualMultiselectOptions.items=_.differenceBy(c.allowedItems,c.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}c.currentUser=l.getCurrentUser(),c.whatsappQueue=n,c.crudPermissions=d,c.realtime=o,c.items=[],c.allowedItems=[],c.selectedItems=[],c.startingAllowedItems=[],c.startingSelectedItems=[],c.pendingChanges=!1,c.onInit=function(){return l.hasRole("admin")?m().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:c.currentUser.userProfileId,name:"Agents"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return c.section=e,m()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_AGENTS",msg:e.status?JSON.stringify(e.data):e.toString()})})},c.saveAgents=function(){var e=_.differenceBy(c.startingSelectedItems,c.selectedItems,"id"),n=_.differenceBy(c.selectedItems,c.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.removeAgents({id:c.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.addAgents({id:c.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){c.pendingChanges=!1,c.startingAllowedItems=angular.copy(c.allowedItems),c.startingSelectedItems=angular.copy(c.selectedItems),i.success({title:"SUCCESS",msg:"Agents association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},c.closeDialog=function(){e.hide()},c.dualMultiselectOptions={items:[],selectedItems:[],orderBy:"name",line1:"fullname",line2:["name","internal"],line3:"",labelAll:r.instant("WHATSAPP.ALL_AGENTS"),labelSelected:r.instant("WHATSAPP.SELECTED_AGENTS"),transferCallback:function(e,n){var t=_.xorBy(c.startingSelectedItems,c.selectedItems,"id");c.pendingChanges=!_.isEmpty(t)}}}e.$inject=["$mdDialog","$q","toasty","api","whatsappQueue","whatsappQueues","realtime","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappQueueagentaddController",e)}(),function(){"use strict";function e(e,a,i,s,n,t,o,r){var l=this;function d(){return a(function(t,n){return a(function(n,t){return s.team.get({fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}).then(function(e){return l.items=e.rows?e.rows:[],o.hasRole("admin")?e:l.section?l.section.autoAssociation?e:a(function(n,t){return s.userProfileResource.get({sectionId:l.section.id,nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})}):null}).then(function(e){var n=e&&e.rows?e.rows:[];return l.allowedItems=_.map(n,function(e){return _.find(l.items,{id:o.hasRole("admin")||l.section.autoAssociation?e.id:e.resourceId})}),l.items.forEach(function(e){var n=_.find(l.allowedItems,{id:e.id});o.hasRole("admin")?e.isValid=!0:e.isValid=void 0!==n}),a(function(n,t){return s.whatsappQueue.getTeams({id:l.whatsappQueue.id,fields:"id,name",nolimit:!0}).$promise.then(function(e){n(e)}).catch(function(e){t(e)})})}).then(function(e){var n=e&&e.rows?e.rows:[];l.selectedItems=_.map(n,function(e){var n=_.find(l.items,{id:e.id});return n.penalty=e.TeamVoiceQueue?"penalty "+e.TeamVoiceQueue.penalty:"",n}),l.startingSelectedItems=angular.copy(l.selectedItems),l.dualMultiselectOptions.selectedItems=l.selectedItems,l.dualMultiselectOptions.items=_.differenceBy(l.allowedItems,l.dualMultiselectOptions.selectedItems,"id"),t()}).catch(function(e){n(e)})})}l.currentUser=o.getCurrentUser(),l.whatsappQueue=n,l.crudPermissions=r,l.items=[],l.allowedItems=[],l.selectedItems=[],l.startingAllowedItems=[],l.startingSelectedItems=[],l.pendingChanges=!1,l.dualMultiselectOptions={allowedItems:[],selectedItems:[],orderBy:"name",line1:"name",line2:"",line3:"",labelAll:t.instant("WHATSAPP.ALL_TEAMS"),labelSelected:t.instant("WHATSAPP.SELECTED_TEAMS"),transferCallback:function(e,n){var t=_.xorBy(l.startingSelectedItems,l.selectedItems,"id");l.pendingChanges=!_.isEmpty(t)}},l.onInit=function(){return o.hasRole("admin")?d().catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})}):a(function(t,n){s.userProfileSection.get({userProfileId:l.currentUser.userProfileId,name:"Teams"}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;t(n)}).catch(function(e){n(e)})}).then(function(e){return l.section=e,d()}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GET_TEAMS",msg:e.status?JSON.stringify(e.data):e.toString()})})},l.saveTeams=function(){var e=_.differenceBy(l.startingSelectedItems,l.selectedItems,"id"),n=_.differenceBy(l.selectedItems,l.startingSelectedItems,"id");return(t=e,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.removeTeams({id:l.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})})).then(function(){return t=n,a(function(e,n){_.isEmpty(t)?e():s.whatsappQueue.addTeams({id:l.whatsappQueue.id,ids:_.map(t,"id")}).$promise.then(function(){e()}).catch(function(e){n(e)})});var t}).then(function(){l.pendingChanges=!1,l.startingAllowedItems=angular.copy(l.allowedItems),l.startingSelectedItems=angular.copy(l.selectedItems),i.success({title:"SUCCESS",msg:"Teams association has been updated!"})}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:LISTS_ASSOCIATION",msg:e.status?JSON.stringify(e.data):e.toString()})});var t},l.closeDialog=function(){e.hide()}}e.$inject=["$mdDialog","$q","toasty","api","whatsappQueue","$translate","Auth","crudPermissions"],angular.module("app.whatsapp").controller("WhatsappQueueteamaddController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m){var u=this;u.currentUser=d.getCurrentUser(),u.license=s,u.setting=o,u.passwordPattern=u.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",u.location=n.protocol()+"://"+n.host(),u.whatsappQueue=c||e.params.whatsappQueue||{},u.userProfileSection=m&&1==m.count?m.rows[0]:null,u.crudPermissions=d.parseCrudPermissions(u.userProfileSection?u.userProfileSection.crudPermissions:null),u.hasModulePermissions={},u.selectedTab=e.params.tab||0,u.teamadddialog=function(e,n){t.show({controller:"WhatsappQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:u.whatsappQueues?u.whatsappQueues.rows:[],crudPermissions:u.crudPermissions}})},u.agentadddialog=function(e,n){t.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(a.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:u.whatsappQueues?u.whatsappQueues.rows:[],crudPermissions:u.crudPermissions,realtime:!1}})},u.alert=l.info,u.gotoWhatsappQueues=function(){e.go("app.whatsapp.whatsappQueues",{},{reload:"app.whatsapp.whatsappQueues"})},u.saveWhatsappQueue=function(){r.whatsappQueue.update({id:u.whatsappQueue.id},u.whatsappQueue).$promise.then(function(){l.success({title:"WhatsappQueue updated!",msg:u.whatsappQueue.name?u.whatsappQueue.name+" has been updated!":""})}).catch(function(e){l.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETwhatsappQueue",msg:e.data?JSON.stringify(e.data):e.toString()})})}}e.$inject=["$state","$location","$mdDialog","$document","$translate","license","setting","api","toasty","Auth","whatsappQueue","userProfileSection"],angular.module("app.whatsapp").controller("WhatsappQueueController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h){var f=this;f.license=v,f.setting=h,f.currentUser=g.getCurrentUser(),f.whatsappQueues=l||{count:0,rows:[]},f.userProfile=d,f.userProfileSection=c&&1==c.count?c.rows[0]:null,f.crudPermissions=g.parseCrudPermissions(f.userProfileSection?f.userProfileSection.crudPermissions:null),f.table="whatsappQueues",f.listOrder="",f.listOrderAsc=null,f.selectedWhatsappQueues=[],f.query={fields:"createdAt,updatedAt,id,name,strategy,timeout,description",sort:"-updatedAt",channel:"whatsapp",limit:10,page:1},f.arraystrategy=_.keyBy([{option:"Beepall",value:"'beepall'"},{option:"RR Memory",value:"'rrmemory'"}],function(e){return _.replace(e.value,new RegExp("'","g"),"")}),f.editstate=function(e,n){t.go("app.whatsapp.whatsappQueues.edit",{id:e.id,whatsappQueue:e,crudPermissions:f.crudPermissions})},f.teamadddialog=function(e,n){i.show({controller:"WhatsappQueueteamaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:f.whatsappQueues?f.whatsappQueues.rows:[],crudPermissions:f.crudPermissions}})},f.agentadddialog=function(e,n){i.show({controller:"WhatsappQueueagentaddController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",parent:angular.element(s.body),targetEvent:n,clickOutsideToClose:!0,locals:{whatsappQueue:e,whatsappQueues:f.whatsappQueues?f.whatsappQueues.rows:[],crudPermissions:f.crudPermissions,realtime:!1}})},f.deleteconfirm=function(e,n){var t=i.confirm().title("Are you sure want to delete the "+_.startCase("whatsappQueue")+"?").htmlContent("<b>"+(e.name||"whatsappQueue")+"</b> will be deleted.").ariaLabel("delete whatsappQueue").targetEvent(n).ok("OK").cancel("CANCEL");i.show(t).then(function(){y(e)},function(){console.log("CANCEL")})},f.gotorealtimegoto=function(e,n){{if(!g.hasRole("admin"))return m.userProfileSection.get({userProfileId:g.getCurrentUser().userProfileId,sectionId:2110}).$promise.then(function(e){var n=e&&e.rows?e.rows[0]:null;n&&n.enabled?t.go("app.whatsapp.realtime.queues",{}):p.info({title:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_TITLE"),msg:r.instant("STAFF.PERMISSIONS_UNAUTHORIZED_REDIRECT_MESSAGE")})}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"USERPROFILE:GET_SECTION",msg:e.status?JSON.stringify(e.data):e.toString()})});t.go("app.whatsapp.realtime.queues",{})}},f.success=E,f.getWhatsappQueues=function(){f.query.offset=(f.query.page-1)*f.query.limit,g.hasRole("admin")?f.promise=m.whatsappQueue.get(f.query,E).$promise:(f.query.id=f.userProfile.id,f.query.section="WhatsappQueues",f.promise=m.userProfile.getResources(f.query,E).$promise)},f.createOrEditWhatsappQueue=function(e,n){i.show({controller:"CreateOrEditWhatsappQueueDialogController",controllerAs:"vm",templateUrl:"app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",parent:angular.element(s.body),targetEvent:e,clickOutsideToClose:!0,locals:{whatsappQueue:n,whatsappQueues:f.whatsappQueues.rows,crudPermissions:f.crudPermissions}})},f.deleteWhatsappQueue=y,f.exportSelectedWhatsappQueues=function(){var e=angular.copy(f.selectedWhatsappQueues);return f.selectedWhatsappQueues=[],e},f.deleteSelectedWhatsappQueues=function(e){var n=i.confirm().title("Are you sure want to delete the selected whatsappQueues?").htmlContent("<b>"+f.selectedWhatsappQueues.length+" selected</b> will be deleted.").ariaLabel("delete WhatsappQueues").targetEvent(e).ok("OK").cancel("CANCEL");i.show(n).then(function(){f.selectedWhatsappQueues.forEach(function(e){y(e)}),f.selectedWhatsappQueues=[]})},f.deselectWhatsappQueues=function(){f.selectedWhatsappQueues=[]},f.selectAllWhatsappQueues=function(){f.selectedWhatsappQueues=f.whatsappQueues.rows};var b=!0,A=1;function E(e){f.whatsappQueues=e||{count:0,rows:[]}}function y(e){m.whatsappQueue.delete({id:e.id}).$promise.then(function(){_.remove(f.whatsappQueues.rows,{id:e.id}),f.whatsappQueues.count-=1,f.whatsappQueues.rows.length||f.getWhatsappQueues(),p.success({title:_.startCase("WhatsappQueue")+" deleted!",msg:e.name?e.name+" has been deleted!":""})}).catch(function(e){if(e.data&&e.data.errors&&e.data.errors.length){f.errors=e.data.errors||[{message:e.toString(),type:"SYSTEM:DELETEwhatsappQueue"}];for(var n=0;n<e.data.errors.length;n++)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:DELETEwhatsappQueue",msg:e.data?JSON.stringify(e.data.message):e.message||e.toString()})})}e.$watch("vm.query.filter",function(e,n){b?o(function(){b=!1}):(n||(A=f.query.page),e!==n&&(f.query.page=1),e||(f.query.page=A),f.getWhatsappQueues())})}e.$inject=["$scope","$window","$state","$mdSidenav","$mdDialog","$document","$timeout","$translate","whatsappQueues","userProfile","userProfileSection","api","msUtils","toasty","Auth","license","setting"],angular.module("app.whatsapp").controller("WhatsappQueuesController",e)}(),function(){"use strict";function e(n,t,e,a,o,i,s,r,l,d,c,m,u){var p=this;function g(e,n){return{id:e,title:n.name||"NONAME",state:"app.dashboards.custom",stateParams:n,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(e)&&!r.hasRole("admin")}}}function v(e,n){return{id:e,title:n.name||"NONAME",state:"app.plugins.plugin",stateParams:n,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(e)&&!r.hasRole("admin")}}}function h(e,n){var t={user:_.pick(r.getCurrentUser(),["id","name","fullname","email","role","internal","interface"])};n.agentUrl=Mustache.render(n.agentUrl,t),i.saveItem("apps.home.plugin_"+e,{id:e,title:n.name,translate:n.name,state:"plugin_"+n.id,stateParams:n,view:"plugin",icon:n.icon,weight:12,hidden:function(){return!r.hasPermission(e)}})}function f(e){return _.map(e.children,function(e){return e.id})}s.clear(),p.isAgent=function(){return r.getCurrentUser()&&r.hasRole("agent")},o.saveItem("apps",{title:"APPS",group:!0,weight:1,hidden:function(){return r.hasRole("agent")}}),d.version.get().$promise.then(function(e){p.version=e&&e.current?e.current:"UNKNOWN"}).catch(function(){p.version="UNKNOWN"}).finally(function(){o.saveItem("version",{title:"VERSION "+p.version,group:!0,weight:2,hidden:function(){return r.hasRole("agent")}})}),r.isLoggedIn()&&(null===m.userSettings&&m.getUserSettingForUser(),l.gray&&s.warning({msg:e.instant("DASHBOARDS.LICENSE_EXPIRE_REMAINING_DAYS"),showClose:!0,timeout:!1}),d.dashboard.get().$promise.then(function(e){for(var n=0,t=0;t<e.rows.length;t+=1)n=99999+e.rows[t].id,o.saveItem("apps.dashboards.custom_"+n,g(n,e.rows[t]))}),d.plugin.get({active:!0}).$promise.then(function(e){var n=0;if(e.count){var t=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"agentOnly"!=e.sidebar});if(0<t.length){o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",permissions:{hidden:!0},weight:17,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}});for(var a=0;a<t.length;a+=1)n=88888+t[a].id,o.saveItem("apps.plugins.plugin_"+n,v(n,t[a]));o.sort()}var i=_.filter(e.rows,function(e){return"never"!=e.sidebar&&"adminOnly"!=e.sidebar});if(0<i.length)for(var s=0;s<i.length;s+=1)h(n=88888+i[s].id,i[s])}})),l.custom&&!c.defaultPageTitle&&c.pageTitle&&angular.element("#pageTitle").html(c.pageTitle),o.saveItem("apps.dashboards",{id:100,title:"Dashboards",translate:"DASHBOARDS.DASHBOARDS",icon:"icon-tile-four",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.dashboards.general",{id:101,title:"General",route:"",translate:"DASHBOARDS.GENERAL",state:"app.dashboards.general",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(101)&&!r.hasRole("admin")}}),o.saveItem("apps.staff",{id:200,title:"Staff",translate:"STAFF.STAFF",icon:"icon-account-multiple",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.staff.users",{id:201,title:"Users",route:"user",translate:"STAFF.USERS",state:"app.staff.users",permissions:{hidden:!0},weight:1,hidden:function(){return r.hasRole("agent")||r.hasRole("user")||!r.hasPermission(201)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.agents",{id:202,title:"Agents",route:"user",translate:"STAFF.AGENTS",state:"app.staff.agents",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(202)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.telephones",{id:203,title:"Telephones",route:"user",translate:"STAFF.TELEPHONES",state:"app.staff.telephones",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(203)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.teams",{id:204,title:"Teams",route:"team",translate:"STAFF.TEAMS",state:"app.staff.teams",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(204)&&!r.hasRole("admin")}}),o.saveItem("apps.staff.userProfiles",{id:205,title:"UserProfiles",route:"userProfile",translate:"STAFF.USERPROFILES",state:"app.staff.userProfiles",permissions:{hidden:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(205)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager",{id:300,title:"ContactManager",translate:"CONTACTMANAGER.CONTACTMANAGER",icon:"icon-account-circle",license:"cm",weight:4,hidden:function(){return!l.cm||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.lists",{id:301,title:"Lists",route:"cmList",translate:"CONTACTMANAGER.LISTS",state:"app.contactmanager.lists",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(301)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.companies",{id:302,title:"Companies",route:"cmCompany",translate:"CONTACTMANAGER.COMPANIES",state:"app.contactmanager.companies",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(302)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.globalCustomFields",{id:304,title:"GlobalCustomFields",route:"cmCustomField",translate:"CONTACTMANAGER.GLOBALCUSTOMFIELDS",state:"app.contactmanager.globalCustomFields",permissions:{association:!1},weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(304)&&!r.hasRole("admin")}}),o.saveItem("apps.contactmanager.contacts",{id:303,title:"Contacts",route:"",translate:"CONTACTMANAGER.CONTACTS",state:"app.contactmanager.contacts",permissions:{association:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(303)&&!r.hasRole("admin")}}),o.saveItem("apps.voice",{id:400,title:"Voice",translate:"VOICE.VOICE",icon:"icon-phone",license:"voice",weight:5,hidden:function(){return!l.voice||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voiceQueues",{id:401,title:"VoiceQueues",route:"voiceQueue",channel:"voice",translate:"VOICE.VOICEQUEUES",state:"app.voice.voiceQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(401)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.contexts",{id:405,title:"Contexts",route:"voiceContext",translate:"VOICE.CONTEXTS",state:"app.voice.contexts",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(405)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voicemails",{id:406,title:"Voicemails",route:"voiceMail",translate:"VOICE.VOICEMAILS",state:"app.voice.voicemails",weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(406)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.musiconholds",{id:407,title:"MusicOnHolds",route:"voiceMusicOnHold",translate:"VOICE.MUSICONHOLDS",state:"app.voice.musiconholds",weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(407)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voiceRecordings",{id:408,title:"VoiceRecordings",route:"voiceRecording",translate:"VOICE.VOICERECORDINGS",state:"app.voice.voiceRecordings",permissions:{association:!1,loading:!0},weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(408)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.chanSpies",{id:409,title:"ChanSpies",route:"voiceChanSpy",translate:"VOICE.CHANSPIES",state:"app.voice.chanSpies",weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(409)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.voicePrefixes",{id:410,title:"VoicePrefixes",route:"voicePrefix",translate:"VOICE.VOICEPREFIXES",state:"app.voice.voicePrefixes",weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(410)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.inboundRoutes",{id:402,title:"InboundRoutes",route:"voiceExtension",translate:"VOICE.INBOUNDROUTES",state:"app.voice.inboundRoutes",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(402)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.outboundRoutes",{id:403,title:"OutboundRoutes",route:"voiceExtension",translate:"VOICE.OUTBOUNDROUTES",state:"app.voice.outboundRoutes",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(403)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.internalRoutes",{id:404,title:"InternalRoutes",route:"voiceExtension",translate:"VOICE.INTERNALROUTES",state:"app.voice.internalRoutes",weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(404)&&!r.hasRole("admin")}}),o.saveItem("apps.voice.realtime",{id:411,title:"Realtime",route:"",translate:"VOICE.REALTIME",state:"app.voice.realtime",permissions:{association:!1,crud:!1},weight:11,hidden:function(){return r.hasRole("agent")||!r.hasPermission(411)&&!r.hasRole("admin")}}),o.saveItem("apps.chat",{id:500,title:"Chat",translate:"CHAT.CHAT",icon:"icon-hangouts",license:"chat",weight:6,hidden:function(){return!l.chat||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.chat.chatQueues",{id:501,title:"ChatQueues",route:"chatQueue",channel:"chat",translate:"CHAT.CHATQUEUES",state:"app.chat.chatQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(501)&&!r.hasRole("admin")}}),o.saveItem("apps.chat.chatWebsites",{id:502,title:"ChatWebsites",route:"chatWebsite",channel:"chat",translate:"CHAT.CHATWEBSITES",state:"app.chat.chatWebsites",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(502)&&!r.hasRole("admin")}}),o.saveItem("apps.chat.realtime",{id:510,title:"Realtime",route:"",translate:"CHAT.REALTIME",state:"app.chat.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(510)&&!r.hasRole("admin")}}),o.saveItem("apps.mail",{id:600,title:"Mail",translate:"MAIL.MAIL",icon:"icon-email",license:"mail",weight:7,hidden:function(){return!l.mail||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailQueues",{id:601,title:"MailQueues",route:"mailQueue",channel:"mail",translate:"MAIL.MAILQUEUES",state:"app.mail.mailQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(601)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailAccounts",{id:602,title:"MailAccounts",route:"mailAccount",channel:"mail",translate:"MAIL.MAILACCOUNTS",state:"app.mail.mailAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(602)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.mailSubtatuses",{id:603,title:"MailSubstatuses",route:"mailSubstatus",channel:"mail",translate:"MAIL.MAILSUBSTATUSES",state:"app.mail.mailSubtatuses",permissions:{association:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(603)&&!r.hasRole("admin")}}),o.saveItem("apps.mail.realtime",{id:610,title:"Realtime",route:"",translate:"MAIL.REALTIME",state:"app.mail.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(610)&&!r.hasRole("admin")}}),o.saveItem("apps.sms",{id:700,title:"Sms",translate:"SMS.SMS",icon:"icon-message-text",license:"messaging",weight:8,hidden:function(){return!l.messaging||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.sms.smsQueues",{id:701,title:"SmsQueues",route:"smsQueue",channel:"sms",translate:"SMS.SMSQUEUES",state:"app.sms.smsQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(701)&&!r.hasRole("admin")}}),o.saveItem("apps.sms.smsAccounts",{id:702,title:"SmsAccounts",route:"smsAccount",channel:"sms",translate:"SMS.SMSACCOUNTS",state:"app.sms.smsAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(702)&&!r.hasRole("admin")}}),o.saveItem("apps.sms.realtime",{id:710,title:"Realtime",route:"",translate:"SMS.REALTIME",state:"app.sms.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(710)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel",{id:800,title:"Openchannel",translate:"OPENCHANNEL.OPENCHANNEL",icon:"icon-google-earth",license:"openchannel",weight:9,hidden:function(){return!l.openchannel||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.openchannelQueues",{id:801,title:"OpenchannelQueues",route:"openchannelQueue",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELQUEUES",state:"app.openchannel.openchannelQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(801)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.openchannelAccounts",{id:802,title:"OpenchannelAccounts",route:"openchannelAccount",channel:"openChannel",translate:"OPENCHANNEL.OPENCHANNELACCOUNTS",state:"app.openchannel.openchannelAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(802)&&!r.hasRole("admin")}}),o.saveItem("apps.openchannel.realtime",{id:810,title:"Realtime",route:"",translate:"OPENCHANNEL.REALTIME",state:"app.openchannel.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(810)&&!r.hasRole("admin")}}),o.saveItem("apps.fax",{id:900,title:"Fax",translate:"FAX.FAX",icon:"icon-deskphone",license:"fax",weight:10,hidden:function(){return!l.fax||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.fax.faxQueues",{id:901,title:"FaxQueues",route:"faxQueue",channel:"fax",translate:"FAX.FAXQUEUES",state:"app.fax.faxQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(901)&&!r.hasRole("admin")}}),o.saveItem("apps.fax.faxAccounts",{id:902,title:"FaxAccounts",route:"faxAccount",channel:"fax",translate:"FAX.FAXACCOUNTS",state:"app.fax.faxAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(902)&&!r.hasRole("admin")}}),o.saveItem("apps.fax.realtime",{id:910,title:"Realtime",route:"",translate:"FAX.REALTIME",state:"app.fax.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(910)&&!r.hasRole("admin")}}),o.saveItem("apps.tools",{id:1e3,title:"Tools",translate:"TOOLS.TOOLS",icon:"icon-auto-fix",weight:15,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.tools.cannedAnswers",{id:1001,title:"CannedAnswers",route:"cannedAnswer",translate:"TOOLS.CANNEDANSWERS",state:"app.tools.cannedAnswers",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1001)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.customDashboards",{id:1003,title:"CustomDashboards",route:"dashboard",translate:"TOOLS.CUSTOMDASHBOARDS",state:"app.tools.customDashboards",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1003)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.intervals",{id:1004,title:"Intervals",route:"interval",translate:"TOOLS.INTERVALS",state:"app.tools.intervals",weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1004)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.pauses",{id:1005,title:"Pauses",route:"pause",translate:"TOOLS.PAUSES",state:"app.tools.pauses",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1005)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.schedules",{id:1006,title:"Scheduler",route:"schedule",translate:"TOOLS.SCHEDULER",state:"app.tools.schedules",weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1006)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.sounds",{id:1007,title:"Sounds",route:"sound",translate:"TOOLS.SOUNDS",state:"app.tools.sounds",weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1007)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.tags",{id:1008,title:"Tags",route:"tag",translate:"TOOLS.TAGS",state:"app.tools.tags",weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1008)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.templates",{id:1009,title:"Templates",route:"template",translate:"TOOLS.TEMPLATES",state:"app.tools.templates",weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1009)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.trunks",{id:1011,title:"Trunks",route:"trunk",translate:"TOOLS.TRUNKS",state:"app.tools.trunks",weight:11,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1011)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.variables",{id:1012,title:"Variables",route:"variable",translate:"TOOLS.VARIABLES",state:"app.tools.variables",weight:12,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1012)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.contact_item_types",{id:1013,title:"ContactItemType",route:"contactItemType",translate:"TOOLS.CONTACTITEMTYPE",state:"app.tools.contact_item_types",weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1013)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.dispositions",{id:1002,title:"Dispositions",route:"disposition",translate:"TOOLS.DISPOSITIONS",state:"app.tools.dispositions",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1002)&&!r.hasRole("admin")}}),o.saveItem("apps.tools.triggers",{id:1010,title:"Triggers",route:"trigger",translate:"TOOLS.TRIGGERS",state:"app.tools.triggers",weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1010)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare",{id:1100,title:"CallySquare",translate:"CALLYSQUARE.CALLYSQUARE",icon:"icon-sitemap",license:"voice",weight:13,hidden:function(){return!l.voice||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.odbcs",{id:1101,title:"ODBC",route:"squareOdbc",translate:"CALLYSQUARE.ODBC",state:"app.callysquare.odbcs",weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1101)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.squareRecordings",{id:1102,title:"SquareRecordings",route:"squareRecording",translate:"CALLYSQUARE.SQUARERECORDINGS",state:"app.callysquare.squareRecordings",permissions:{association:!1,loading:!0},weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1102)&&!r.hasRole("admin")}}),o.saveItem("apps.callysquare.projects",{id:1103,title:"Projects",route:"squareProject",translate:"CALLYSQUARE.PROJECTS",state:"app.callysquare.projects",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1103)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics",{id:1200,title:"Analytics",translate:"ANALYTICS.ANALYTICS",icon:"icon-chart-line",weight:16,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.metrics",{id:1201,title:"Metrics",route:"analyticMetric",translate:"ANALYTICS.METRICS",state:"app.analytics.metrics",weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1201)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.extractedReports",{id:1202,title:"ExtractedReports",route:"analyticExtractedReport",translate:"ANALYTICS.EXTRACTEDREPORTS",state:"app.analytics.extractedReports",permissions:{association:!1,loading:!0},weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1202)&&!r.hasRole("admin")}}),o.saveItem("apps.analytics.reports",{id:1203,title:"Reports",route:"",translate:"ANALYTICS.REPORTS",state:"app.analytics.reports",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1203)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations",{id:1300,title:"Integrations",translate:"INTEGRATIONS.INTEGRATIONS",icon:"icon-heart",weight:17,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.zendeskAccounts",{id:1301,title:"ZendeskAccounts",route:"intZendeskAccount",translate:"INTEGRATIONS.ZENDESKACCOUNTS",state:"app.integrations.zendeskAccounts",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1301)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.salesforceAccounts",{id:1302,title:"SalesforceAccounts",route:"intSalesforceAccount",translate:"INTEGRATIONS.SALESFORCEACCOUNTS",state:"app.integrations.salesforceAccounts",permissions:{association:!1,loading:!0},weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1302)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.freshdeskAccounts",{id:1303,title:"FreshdeskAccounts",route:"intFreshdeskAccount",translate:"INTEGRATIONS.FRESHDESKACCOUNTS",state:"app.integrations.freshdeskAccounts",permissions:{association:!1,loading:!0},weight:3,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1303)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.sugarcrmAccounts",{id:1305,title:"SugarcrmAccounts",route:"intSugarcrmAccount",translate:"INTEGRATIONS.SUGARCRMACCOUNTS",state:"app.integrations.sugarcrmAccounts",permissions:{association:!1,loading:!0},weight:4,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1305)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.deskAccounts",{id:1306,title:"DeskAccounts",route:"intDeskAccount",translate:"INTEGRATIONS.DESKACCOUNTS",state:"app.integrations.deskAccounts",permissions:{association:!1,loading:!0},weight:5,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1306)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.zohoAccounts",{id:1307,title:"ZohoAccounts",route:"intZohoAccount",translate:"INTEGRATIONS.ZOHOACCOUNTS",state:"app.integrations.zohoAccounts",permissions:{association:!1,loading:!0},weight:6,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1307)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.vtigerAccounts",{id:1308,title:"VtigerAccounts",route:"intVtigerAccount",translate:"INTEGRATIONS.VTIGERACCOUNTS",state:"app.integrations.vtigerAccounts",permissions:{association:!1,loading:!0},weight:7,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1308)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.dynamics365Accounts",{id:1309,title:"Dynamics365Accounts",route:"intDynamics365Account",translate:"INTEGRATIONS.DYNAMICS365ACCOUNTS",state:"app.integrations.dynamics365Accounts",permissions:{association:!1,loading:!0},weight:8,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1309)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.servicenowAccounts",{id:1310,title:"ServicenowAccounts",route:"intServicenowAccount",translate:"INTEGRATIONS.SERVICENOWACCOUNTS",state:"app.integrations.servicenowAccounts",permissions:{association:!1,loading:!0},weight:9,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1310)&&!r.hasRole("admin")}}),o.saveItem("apps.integrations.freshsalesAccounts",{id:1304,title:"FreshsalesAccounts",route:"intFreshsalesAccount",translate:"INTEGRATIONS.FRESHSALESACCOUNTS",state:"app.integrations.freshsalesAccounts",permissions:{association:!1,loading:!0},weight:10,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1304)&&!r.hasRole("admin")}}),o.saveItem("apps.settings",{id:1400,title:"Settings",translate:"SETTINGS.SETTINGS",icon:"icon-cog",permissions:{hidden:!0},weight:20,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")||r.hasRole("admin")&&!r.getCurrentUser().settingsEnabled}}),o.saveItem("apps.settings.generals",{id:1401,title:"General",route:"setting",translate:"SETTINGS.GENERAL",state:"app.settings.generals",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.smtps",{id:1402,title:"Smtp",route:"mailAccount",translate:"SETTINGS.SMTP",state:"app.settings.smtps",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.networks",{id:1403,title:"Networks",route:"network",translate:"SETTINGS.NETWORKS",state:"app.settings.networks",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.customizations",{id:1407,title:"Customizations",route:"setting",translate:"SETTINGS.CUSTOMIZATIONS",state:"app.settings.customizations",weight:1,hidden:function(){return!l.custom||r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.cloudProviders",{id:1408,title:"AiTools",route:"cloudProvider",translate:"SETTINGS.CLOUD_PROVIDERS",state:"app.settings.cloudProviders",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.updates",{id:1404,title:"Updates",route:"",translate:"SETTINGS.UPDATES",state:"app.settings.updates",weight:1,hidden:function(){return!l.update||r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.license",{id:1405,title:"License",route:"",translate:"SETTINGS.LICENSE",state:"app.settings.license",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.settings.system",{id:1406,title:"System",route:"",translate:"SETTINGS.SYSTEM",state:"app.settings.system",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1400)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer",{id:1500,title:"MotionDialer",translate:"MOTIONDIALER.MOTIONDIALER",icon:"icon-fire",license:"dialer",weight:5,hidden:function(){return!l.dialer||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.queueCampaigns",{id:1501,title:"QueueCampaigns",route:"voiceQueue",channel:"bull",translate:"MOTIONDIALER.QUEUECAMPAIGNS",state:"app.motiondialer.queueCampaigns",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1501)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.ivrCampaigns",{id:1502,title:"IvrCampaigns",route:"campaign",translate:"MOTIONDIALER.IVRCAMPAIGNS",state:"app.motiondialer.ivrCampaigns",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1502)&&!r.hasRole("admin")}}),o.saveItem("apps.motiondialer.realtime",{id:1510,title:"Realtime",route:"",translate:"MOTIONDIALER.REALTIME",state:"app.motiondialer.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1510)&&!r.hasRole("admin")}}),o.saveItem("apps.help",{id:1600,title:"Help",translate:"HELP.HELP",icon:"icon-help",permissions:{association:!1},weight:21,hidden:function(){return!c.viewHelpSection||r.hasRole("agent")||!r.hasPermission(1600)&&!r.hasRole("admin")}}),o.saveItem("apps.help.about",{id:1601,title:"About",route:"",translate:"HELP.ABOUT",state:"app.help.about",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1600)&&!r.hasRole("admin")}}),o.saveItem("apps.jscripty",{id:1700,title:"jscripty",translate:"JSCRIPTY.JSCRIPTY",icon:"icon-script",license:"jscripty",weight:14,hidden:function(){return!l.jscripty||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.jscripty.projects",{id:1701,title:"Projects",route:"jscriptyProject",translate:"JSCRIPTY.PROJECTS",state:"app.jscripty.projects",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1701)&&!r.hasRole("admin")}}),o.saveItem("apps.marketplace",{id:1800,title:"Marketplace",translate:"MARKETPLACE.MARKETPLACE",icon:"icon-cart",weight:18,hidden:function(){return r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.marketplace.plugins",{id:1801,title:"Plugins",route:"plugin",translate:"MARKETPLACE.PLUGINS",state:"app.marketplace.plugins",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1801)&&!r.hasRole("admin")}}),o.saveItem("apps.video",{id:2e3,title:"Video",translate:"VIDEO.VIDEO",icon:"icon-video",license:"screenrecording",weight:12,hidden:function(){return!l.screenrecording||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.video.screenRecordings",{id:2001,title:"ScreenRecordings",route:"screenRecording",translate:"VIDEO.SCREENRECORDINGS",state:"app.video.screenRecordings",permissions:{association:!1,loading:!0},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2001)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp",{id:2100,title:"Whatsapp",translate:"WHATSAPP.WHATSAPP",icon:"icon-whatsapp",license:"whatsapp",weight:11,hidden:function(){return!l.whatsapp||r.hasRole("agent")||!r.hasChildrenPermissions(f(this))&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.whatsappQueues",{id:2101,title:"WhatsappQueues",route:"whatsappQueue",channel:"whatsapp",translate:"WHATSAPP.WHATSAPPQUEUES",state:"app.whatsapp.whatsappQueues",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2101)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.whatsappAccounts",{id:2102,title:"WhatsappAccounts",route:"whatsappAccount",channel:"whatsapp",translate:"WHATSAPP.WHATSAPPACCOUNTS",state:"app.whatsapp.whatsappAccounts",weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2102)&&!r.hasRole("admin")}}),o.saveItem("apps.whatsapp.realtime",{id:2110,title:"Realtime",route:"",translate:"WHATSAPP.REALTIME",state:"app.whatsapp.realtime",permissions:{association:!1,crud:!1},weight:1,hidden:function(){return r.hasRole("agent")||!r.hasPermission(2110)&&!r.hasRole("admin")}}),o.sort(),i.saveItem("apps",{title:"APPS",group:!0,weight:1}),i.saveItem("apps.home",{id:100,title:"Home",translate:"DASHBOARDS.HOME",icon:"icon-home",weight:1}),i.saveItem("apps.home.dashboard",{id:101,title:"Dashboard",translate:"DASHBOARDS.DASHBOARD",state:"dashboard",view:"dashboard",icon:"icon-tile-four",iconClass:"cyan-500-fg",weight:1,hidden:function(){return!r.hasPermission(101)}}),i.saveItem("apps.home.agentPresence",{id:115,title:"AgentPresence",translate:"DASHBOARDS.AGENT_PRESENCE",state:"agentPresence",view:"agentPresence",icon:"icon-webcam",iconClass:"xenialab-violet-light-fg",weight:2,hidden:function(){return!r.hasPermission(115)}}),i.saveItem("apps.home.contacts",{id:102,title:"Contacts",translate:"DASHBOARDS.CONTACTS",state:"contacts",view:"contacts",icon:"icon-account-circle",iconClass:"red-fg",weight:3,hidden:function(){return!l.cm||!r.hasPermission(102)}}),i.saveItem("apps.home.mycontacts",{id:103,title:"Contacts",translate:"DASHBOARDS.MYCONTACTS",state:"mycontacts",view:"mycontacts",icon:"icon-account-multiple",iconClass:"red-fg",weight:4,hidden:function(){return!l.cm||!r.hasPermission(103)}}),i.saveItem("apps.home.scheduled",{id:113,title:"Scheduled Calls",translate:"DASHBOARDS.SCHEDULED_CALLS",state:"scheduled",view:"scheduled",icon:"icon-calendar-clock",iconClass:"blue-grey-fg",weight:5,hidden:function(){return!l.dialer||!r.hasPermission(113)}}),i.saveItem("apps.home.voice",{id:110,title:"Voice",translate:"DASHBOARDS.VOICE",state:"voice",view:"voice",icon:"icon-phone",iconClass:"blue-A700-fg",weight:6,hidden:function(){return!l.voice||!r.hasPermission(110)}}),i.saveItem("apps.home.abandoned",{id:111,title:"Abandoned",translate:"DASHBOARDS.ABANDONED",state:"abandoned",view:"abandoned",icon:"icon-phone-missed",iconClass:"blue-fg",weight:7,hidden:function(){return!l.voice||!r.hasPermission(111)}}),i.saveItem("apps.home.recordings",{id:104,title:"Recordings",translate:"DASHBOARDS.RECORDINGS",state:"recordings",view:"recordings",icon:"icon-audiobook",iconClass:"indigo-A100-fg",weight:8,hidden:function(){return!l.voice||!r.hasPermission(104)}}),i.saveItem("apps.home.chat",{id:105,title:"Chat",translate:"DASHBOARDS.CHAT",state:"chat",view:"chat",icon:"icon-hangouts",iconClass:"green-A700-fg",weight:9,hidden:function(){return!l.chat||!r.hasPermission(105)}}),i.saveItem("apps.home.mail",{id:106,title:"Mail",translate:"DASHBOARDS.MAIL",state:"mail",view:"mail",icon:"icon-email",iconClass:"teal-fg",weight:10,hidden:function(){return!l.mail||!r.hasPermission(106)}}),i.saveItem("apps.home.sms",{id:107,title:"Sms",translate:"DASHBOARDS.SMS",state:"sms",view:"sms",icon:"icon-message-text",iconClass:"orange-fg",weight:11,hidden:function(){return!l.messaging||!r.hasPermission(107)}}),i.saveItem("apps.home.openchannel",{id:108,title:"Openchannel",translate:"DASHBOARDS.OPENCHANNEL",state:"openchannel",view:"openchannel",icon:"icon-google-earth",iconClass:"amber-fg",weight:12,hidden:function(){return!l.openchannel||!r.hasPermission(108)}}),i.saveItem("apps.home.fax",{id:109,title:"Fax",translate:"DASHBOARDS.FAX",state:"fax",view:"fax",icon:"icon-deskphone",iconClass:"blue-grey-A200-fg",weight:13,hidden:function(){return!l.fax||!r.hasPermission(109)}}),i.saveItem("apps.home.whatsapp",{id:114,title:"Whatsapp",translate:"DASHBOARDS.WHATSAPP",state:"whatsapp",view:"whatsapp",icon:"icon-whatsapp",iconClass:"lime-A700-fg",weight:14,hidden:function(){return!l.whatsapp||!r.hasPermission(114)}}),n.$on("$viewContentAnimationEnded",function(e){e.targetScope.$id===n.$id&&t.$broadcast("msSplashScreen::remove")}),n.$on("socket:connect",function(){t.toastySocketLost&&(s.clear(t.toastySocketLost),t.toastySocketLost=void 0)}),n.$on("socket:disconnect",function(){t.toastySocketLost||s.warning({title:e.instant("TOOLBAR.WARNING"),msg:e.instant("DASHBOARDS.LOST_CONNECTION"),timeout:!1,onAdd:function(){t.toastySocketLost=this.id}})}),n.$on("client-side-logging:enabled",function(){"admin"!==r.getCurrentUser().role&&s.info({title:e.instant("STAFF.CLIENT_LOGS"),msg:e.instant("STAFF.CLIENT_LOGS_ENABLED_MSG")})}),n.$on("client-side-logging:disabled",function(){"admin"!==r.getCurrentUser().role&&s.info({title:e.instant("STAFF.CLIENT_LOGS"),msg:e.instant("STAFF.CLIENT_LOGS_DISABLED_MSG")})}),a.onbeforeunload=function(){r.isTelephone()||u.flush()}}e.$inject=["$scope","$rootScope","$translate","$window","msNavigationService","msNavigationAgentService","toasty","Auth","license","api","setting","UserSettingService","ClientSideLoggingService"],angular.module("motion").controller("MainController",e)}(),function(){"use strict";function e(e,n,t,a,o,r){var i=this;function s(e){if(e&&e.id){var n=99999+e.id;o.saveItem("apps.dashboards.custom_"+n,{id:n,title:e.name||"NONAME",state:"app.dashboards.custom",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(n)&&!r.hasRole("admin")}})}}function l(e){if(e&&e.id&&"never"!=e.sidebar)if(e.active){if("always"==e.sidebar||"adminOnly"==e.sidebar){o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return r.hasRole("agent")||!r.hasPermission(1900)&&!r.hasRole("admin")}});var n=88888+e.id;o.saveItem("apps.plugins.plugin_"+n,{id:n,title:e.name||"NONAME",state:"app.plugins.plugin",stateParams:e,weight:2,hidden:function(){return r.hasRole("agent")||!r.hasPermission(n)&&!r.hasRole("admin")}}),o.sort()}}else{n=88888+e.id;t=1900,a=n,i=o.getNavigation(),(s=_.find(i[0].children,{id:t}))&&_.some(s.children,{id:a})&&("always"==e.sidebar||"adminOnly"==e.sidebar)&&(o.deleteItem("apps.plugins.plugin_"+n),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}var t,a,i,s}function d(e){var n=o.getNavigation(),t=_.find(n[0].children,{id:e});return!!(t&&0<t.children.length)}i.bodyEl=angular.element("body"),i.setting=t,i.$onInit=function(){i.folded="true"===n.get("motion.folded")||!1},i.toggleMsNavigationFolded=function(){i.folded=!i.folded,n.put("motion.folded",i.folded)},i.getLogo=function(){return i.setting.defaultHeaderWhiteLabel?"xCALLY Motion":i.setting.headerWhiteLabel},a.on("dashboard:save",s),a.on("dashboard:update",s),a.on("dashboard:remove",function(e){if(e&&e.id){var n=99999+e.id;o.deleteItem("apps.dashboards.custom_"+n)}}),a.on("plugin:save",l),a.on("plugin:update",l),a.on("plugin:remove",function(e){if(e&&e.id&&"never"!=e.sidebar){var n=88888+e.id;"always"!=e.sidebar&&"adminOnly"!=e.sidebar||(o.deleteItem("apps.plugins.plugin_"+n),d(1900)||o.saveItem("apps.plugins",{id:1900,title:"Plugins",translate:"PLUGINS.PLUGINS",icon:"icon-apps",weight:17,hidden:function(){return!0}}))}}),e.$on("$stateChangeSuccess",function(){i.bodyEl.removeClass("ms-navigation-horizontal-mobile-menu-active")})}e.$inject=["$scope","$cookies","setting","socket","msNavigationService","Auth"],angular.module("app.navigation").controller("NavigationController",e)}(),function(){"use strict";function e(e,a,i,n,t,s,o,r){var l=this;function d(t){o.isSupported()?o.requestPermission().then(function(){var e,n;n={autoClose:!0,duration:10,showOnPageHidden:!0,icon:"api/users/"+(e=t).FromId+"/avatar",body:e.body||"",focusOnclick:!0,closeOnClick:!0},o.show(a.instant("QUICKPANEL.NEW_INTERNAL_MESSAGE"),n)},function(e){console.error("Please enable browser notifications!",e)}):console.error("Browser notifications are not supported by the browser. Normal notifications will be used.")}l.date=moment().format(),l.currentUser=n.getCurrentUser(),l.license=r,l.unreadTotalMessages=0,l.unreadTotalGroupMessages=0,l.userIsNotPhonebar=function(){return"admin"===l.currentUser.role||"user"===l.currentUser.role||"agent"===l.currentUser.role&&0!==l.currentUser.showWebBar},l.onMessageSave=function(e){e.ToId===l.currentUser.id&&e.FromId!==l.currentUser.id&&!e.read&&e.ChatGroupId&&(l.unreadTotalGroupMessages++,d(e));e.ToId!==l.currentUser.id||e.ChatGroupId||(l.unreadTotalMessages+=1,d(e))},l.onMessageUpdate=function(e){e.ToId===l.currentUser.id&&e.read&&0<l.unreadTotalMessages&&!e.ChatGroupId&&(l.unreadTotalMessages-=1);e.ToId==l.currentUser.id&&e.FromId!==l.currentUser.id&&e.ChatGroupId&&e.read&&0<l.unreadTotalGroupMessages&&l.unreadTotalGroupMessages--},t.on("chatInternalMessage:save",l.onMessageSave),t.on("chatInternalMessage:update",l.onMessageUpdate),s.chatInternalMessage.get({fields:"FromId",ToId:l.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){return e&&e.count&&(l.unreadTotalMessages=e.count),s.user.getGroups({id:l.currentUser.id}).$promise}).then(function(e){for(var n=[],t=e.rows,a=0;a<t.length;a++)n.push(s.chatGroup.getUnread({id:t[a].id}).$promise);return i.all(n)}).then(function(e){for(var n=0;n<e.length;n++)l.unreadTotalGroupMessages+=e[n].count}).catch(function(e){console.error(e)}),e.$on("$destroy",function(){t.removeAllListeners("chatInternalMessage:save"),t.removeAllListeners("chatInternalMessage:update")})}e.$inject=["$scope","$translate","$q","Auth","socket","api","desktopNotification","license"],angular.module("app.quick-panel").controller("QuickPanelController",e)}(),function(){"use strict";function e(n,e,t,a,i,s,o,r,l,d,c){var m=this;function u(){if(!m.hasMoreMessages||m.isLoading)return t.resolve();m.user.messages.length;return function(){m.isLoading=!0;var e={sort:"-createdAt",FromId:m.currentUser.id+","+m.user.id,ToId:m.currentUser.id+","+m.user.id,ChatGroupId:"null",limit:50,offset:m.user.messages.length};return r.chatInternalMessage.get(e).$promise.then(function(e){m.user.messages=m.user.messages.concat(e.rows),m.hasMoreMessages=e.count>m.user.messages.length;for(var n=0;n<m.user.messages.length;n+=1)!1===m.user.messages[n].read&&m.user.messages[n].ToId===m.currentUser.id&&r.chatInternalMessage.update({id:m.user.messages[n].id,read:!0})}).finally(function(){m.isLoading=!1})}()}function p(e){var n=angular.element("#chat-dialog");s(function(){n.animate({scrollTop:0},e)},0)}function g(e){return _.isNil(e)?"":e.replace(/[^\w.+#*\-]+/g,"")}function v(e){return n.get(e).success(function(){c.success({title:"Successful call",msg:"Call properly handled!"})}).error(function(){c.error({title:"PhoneBar API Error",msg:o.instant("CONTACTMANAGER.ERRORS.PHONEBAR_API")})})}m.currentUser=l.getCurrentUser(),m.user=void 0,m.users={count:0,rows:[]},m.standardDate=moment(0).format("YYYY-MM-DD HH:mm:ss"),m.unreadMessages={},m.replyMessage="",m.disabled=!1,m.defaultAvatar="assets/images/avatars/profile.png",m.init=function(e){m.license=e,t.all([r.chatInternalMessage.get({fields:"FromId",ToId:m.currentUser.id,read:!1,nolimit:!0,ChatGroupId:"null"}).$promise.then(function(e){m.unreadMessages=_.countBy(e.rows,"FromId")}).catch(function(e){throw e}),r.chatInternalMessage.getUsers().$promise.then(function(e){m.users=e}).catch(function(e){throw e})]).catch(function(e){c.error({msg:e.data?e.data.message:e.message||e})})},m.reply=function(){if(m.disabled=!0,""===m.replyMessage)return void(m.disabled=!1);var e={FromId:m.currentUser.id,ToId:m.user.id,body:m.replyMessage,read:!1};m.replyMessage="",r.chatInternalMessage.save(e).$promise.then(function(e){m.user.messages.unshift(e),m.user.lastMessageAt=e.createdAt,m.user.lastMessage=e}).finally(function(){p(400),m.disabled=!1})},m.webcall=function(e){a.$broadcast("webrtc::call",{target:g(e)})},m.call=function(e){return v("http://127.0.0.1:"+(m.user.phoneBarRemoteControlPort||"9888")+"/api/originate/"+g(e))},m.transfer=function(e){return v("http://127.0.0.1:"+(m.user.phoneBarRemoteControlPort||"9888")+"/api/transfer?number="+g(e))},m.beepPlayer=null,m.openChat=function(e){return m.user=angular.copy(e),m.isMessengerAllowed=!1,"agent"!==m.user.role||m.user.allowmessenger?(p(0),m.isMessengerAllowed=!0,m.hasMoreMessages=!0,u()):void c.warning({title:o.instant("QUICKPANEL.WARNING"),msg:o.instant("QUICKPANEL.MESSENGER_DISABLED")})},m.closeChat=function(){m.user=void 0,m.hasMoreMessages=!0},m.scrollToTopOfChat=p,d.on("chatInternalMessage:save",function(e){m.beepPlayer=document.getElementById("beep-player"),e.ToId===m.currentUser.id&&e.ToId!==e.FromId&&m.currentUser.messengerSoundNotification&&m.beepPlayer.play().catch(function(e){console.log(e.message)});if(e.ToId===m.currentUser.id&&!e.ChatGroupId){m.user&&m.user.id===e.FromId?(m.user.messages.unshift(e),p(0),r.chatInternalMessage.update({id:e.id,read:!0})):m.unreadMessages[e.FromId]=m.unreadMessages[e.FromId]?m.unreadMessages[e.FromId]+1:1;var n=_.find(m.users.rows,{id:e.FromId});n&&(n.lastMessageAt=e.createdAt,n.lastMessage=e)}}),d.on("chatInternalMessage:update",function(e){if((e.FromId===m.currentUser.id||e.ToId===m.currentUser.id)&&!e.ChatGroupId){if(m.user){var n=_.find(m.user.messages,{id:e.id});n&&_.merge(n,e)}var t=_.find(m.users.rows,{id:m.currentUser.id===e.FromId?e.ToId:e.FromId});t&&t.lastMessage&&_.merge(t.lastMessage,e),e.ToId===m.currentUser.id&&e.read&&0<m.unreadMessages[e.FromId]&&(m.unreadMessages[e.FromId]-=1)}}),d.on("user:update",function(e){var n=_.find(m.users.rows,{id:e.id});n&&(_.isNil(e.online)||n.online===e.online||(n.online=e.online),_.isNil(e.allowmessenger)||n.allowmessenger===e.allowmessenger||(n.allowmessenger=e.allowmessenger))}),e("quick-panel").onClose(function(){m.user=void 0}),m.loadMoreMessages=u,m.timelineOptions={scrollEl:"#chat-dialog"},i.$on("$destroy",function(){d.removeAllListeners("chatInternalMessage:save"),d.removeAllListeners("chatInternalMessage:update"),d.removeAllListeners("user:update")})}e.$inject=["$http","$mdSidenav","$q","$rootScope","$scope","$timeout","$translate","api","Auth","socket","toasty"],angular.module("app.quick-panel").controller("ChatInternalController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l){var d=this;function c(e){a.hide(e)}d.errors=[],d.title="QUICKPANEL.EDIT_CHATGROUP",d.group=angular.copy(r),d.currentUser=o.getCurrentUser(),d.members=l,d.newChatGroup=!0,d.group||(d.group={write:!0,members:[]},d.title="QUICKPANEL.NEW_CHATGROUP"),d.saveChatGroup=function(){var t;return d.errors=[],s.chatGroup.save({name:d.group.name,write:d.group.write}).$promise.then(function(e){var n=_.map(d.group.members,"id");return n.unshift(d.currentUser.id),t=e,s.chatGroup.addMembers({id:t.id,ids:n}).$promise}).then(function(){i.success({title:"Group properly saved!",msg:t.name+" has been saved!"}),c(t)}).catch(function(e){i.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatQueue.update",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},d.closeDialog=c,d.querySearch=function(e){return e?d.members.rows.filter((n=e,t=angular.lowercase(n),function(e){var n=e.name.toLowerCase();return-1!=n.indexOf(t)})):[];var n,t}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","Auth","group","members"],angular.module("app.quick-panel").controller("CreateOrEditChatGroupDialogController",e)}(),function(){"use strict";function e(e,t,a,s,n,o,i,r,l,d){var c=this;function m(){delete c.group}function u(e){var n=angular.element("#chat-group-dialog");a(function(){n.animate({scrollTop:n[0].scrollHeight},e)},0)}c.currentUser=i.getCurrentUser(),c.unreadGroupMessages={},c.groups={},c.participants,c.group,c.init=function(e){return c.license=e,r.user.getGroups({id:c.currentUser.id}).$promise.then(function(e){for(var n=0,t=[];n<e.rows.length;n++)e.rows[n].unreadGroupMessages=0,c.groups[e.rows[n].id]=e.rows[n],t.push(r.chatGroup.getUnread({id:e.rows[n].id}).$promise);return o.all(t)}).then(function(e){for(var n=0;n<e.length;n++)c.groups[e[n].id].unreadGroupMessages+=e[n].count}).catch(function(e){console.error(e)})},c.back=m,c.addGroup=function(e,n){s.show({controller:"CreateOrEditChatGroupDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/create/dialog.html",parent:angular.element(t.body),targetEvent:n,clickOutsideToClose:!0,locals:{group:e,me:c.currentUser,license:null,setting:null},resolve:{members:function(){return i.hasRole("admin")?r.user.get({role:"agent"}).$promise:r.userProfile.getResources({id:i.getCurrentUser().userProfileId,section:"Agents",role:"agent"}).$promise}}}).then(function(e){e&&(c.groups[e.id]=e)}).catch(function(e){e&&console.error(e.message)})},c.deleteGroup=function(e,n){var t=s.confirm().title("Are you sure want to delete the selected group?").htmlContent("Group <b>"+e.name+"</b> will be deleted.").ariaLabel("delete Group").targetEvent(n).ok("OK").cancel("CANCEL");s.show(t).then(function(){return r.chatGroup.delete({id:e.id}).$promise}).then(function(){delete c.groups[e.id],d.success({title:"Group properly deleted!",msg:e.name+" has been deleted!"})}).catch(function(e){e&&d.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.chatGroup.delete",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},c.groupsToArray=function(){return _.values(c.groups)},c.showMessageInfo=function(e,i){s.show({controller:"ShowMessageInfoDialogController",controllerAs:"vm",templateUrl:"app/quick-panel/tabs/groups/info/dialog.html",parent:angular.element(t.body),targetEvent:e,clickOutsideToClose:!0,locals:{message:i},resolve:{data:function(){var a={messages:[]};return r.chatInternalMessage.get({ChatInternalMessageId:i.id}).$promise.then(function(e){var n=[];a.messages=e.rows,a.messages.unshift(i);for(var t=0;t<a.messages.length;t++)n.push(r.user.get({id:a.messages[t].ToId,fields:"id,name,fullname,userpic"}).$promise);return o.all(n)}).then(function(e){return a.users=e,a}).catch(function(e){e&&console.error(e)})}}}).then(function(){}).catch(function(e){e&&console.error(e.message)})},c.toggleChat=function(n){c.group={id:n.id,write:n.write,messages:{}},r.chatGroup.getMembers({id:n.id,fields:"id,name,fullname"}).$promise.then(function(e){return c.group.membersByKeys=_.keyBy(e.rows,"id"),c.group.members=_.differenceBy(e.rows,[{id:c.currentUser.id}],"id"),c.participants=_.map(c.group.members,"fullname").join(", "),r.chatGroup.getMessages({id:n.id,nolimit:!0}).$promise}).then(function(e){for(var n,t=0,a=[];t<e.count;t++)e.rows[t].ToId===c.currentUser.id&&(n=e.rows[t],c.group.messages[n.id]=n,e.rows[t].ToId!=c.currentUser.id||e.rows[t].FromId===c.currentUser.id||n.read||a.push(r.chatInternalMessage.update({id:n.id,read:!0})));return o.all(a)}).then(function(){u(400)}).catch(function(e){console.error(e.message)})},c.reply=function(){if(!c.replyMessage)return;var t={id:c.group.id,FromId:c.currentUser.id,ToId:c.currentUser.id,body:c.replyMessage,read:!0},a=[];c.replyMessage="",r.chatGroup.addMessage(t).$promise.then(function(e){t.read=!1,t.ChatInternalMessageId=e.id;for(var n=0;n<c.group.members.length;n++)c.group.members[n].id!==c.currentUser.id&&(t.ToId=c.group.members[n].id,a.push(r.chatGroup.addMessage(angular.copy(t)).$promise));return o.all(a)}).catch(function(e){console.log(e)})},l.on("chatInternalMessage:save",function(n){if(!c.group&&n.ToId===c.currentUser.id&&n.FromId!==c.currentUser.id&&!n.read&&n.ChatGroupId){var e=c.groups[n.ChatGroupId];if(!e)return r.chatGroup.get({id:n.ChatGroupId}).$promise.then(function(e){e.unreadGroupMessages=1,c.groups[e.id]=e});e.unreadGroupMessages||(e.unreadGroupMessages=0),e.unreadGroupMessages++}c.group&&n.ChatGroupId===c.group.id&&n.ToId===c.currentUser.id&&r.chatInternalMessage.update({id:n.id,read:!0}).$promise.then(function(){var e;e=n,c.group.messages[e.id]=e,u(400)})}),l.on("chatInternalMessage:update",function(e){e.ToId==c.currentUser.id&&e.FromId!==c.currentUser.id&&e.ChatGroupId&&e.read&&(0<c.groups[e.ChatGroupId].unreadGroupMessages&&c.groups[e.ChatGroupId].unreadGroupMessages--,c.group.messages[e.id]&&(c.group.messages[e.id].read=!0))}),l.on("chatGroup:remove",function(e){c.groups[e.id]&&delete c.groups[e.id]}),n("quick-panel").onClose(m),e.$on("$destroy",function(){l.removeAllListeners("chatInternalMessage:save"),l.removeAllListeners("chatInternalMessage:update"),l.removeAllListeners("chatGroup:remove")})}e.$inject=["$scope","$document","$timeout","$mdDialog","$mdSidenav","$q","Auth","api","socket","toasty"],angular.module("app.quick-panel").controller("ChatGroupController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r){this.data=r,this.title="QUICKPANEL.INFO",this.closeDialog=function(){a.hide()}}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","Auth","data"],angular.module("app.quick-panel").controller("ShowMessageInfoDialogController",e)}(),function(){"use strict";function e(e,n,t,a,i,s){var o=this;o.form={token:s.token},o.setting={},o.resetPassword=function(){return i.auth.reset(o.form).$promise.then(function(){n.success({title:t.instant("RESETPASSWORD.PASSWORD_RESET"),msg:t.instant("RESETPASSWORD.PASSWORD_RESET_MESSAGE")}),a.go("app.login")}).catch(function(e){e&&n.error({title:t.instant("RESETPASSWORD.PASSWORD_RESET_ERROR"),msg:e.data?e.data.message||e.message||e:e.message||e})})},o.onInit=function(){e.isLoggedIn()&&a.go("app.dashboards.general");return i.setting.gdpr({id:1}).$promise.then(function(e){o.setting=e,o.passwordPattern=o.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:""}).catch(function(e){e&&n.error({title:"Error",msg:e.data?e.data.message||e.message||e:e.message||e})})}}e.$inject=["Auth","toasty","$translate","$state","api","$stateParams"],angular.module("app.reset").controller("ResetPasswordController",e)}(),function(){"use strict";function e(e,n,t,a,i,s,o,r,l,d){var c=this;function m(){u()}function u(){s.user.get({id:c.user.id}).$promise.then(function(e){c.user.permissions=e.permissions,c.items=[{font_icon:"icon-hangouts",class:"green-700-fg",label:"chat",title:"TOOLBAR.CHAT",value:"chat",permission:r.chat&&(p(105)||e.chatAutoanswer),enabled:e.chatAutoanswer,delay:e.chatAutoanswerDelay},{font_icon:"icon-email",class:"teal-fg",label:"email",title:"TOOLBAR.EMAIL",value:"email",permission:r.mail&&(p(106)||e.emailAutoanswer),enabled:e.emailAutoanswer,delay:e.emailAutoanswerDelay},{font_icon:"icon-message-text",class:"orange-fg",label:"sms",title:"TOOLBAR.SMS",value:"sms",permission:r.messaging&&(p(107)||e.smsAutoanswer),enabled:e.smsAutoanswer,delay:e.smsAutoanswerDelay},{font_icon:"icon-google-earth",class:"amber-fg",label:"openchannel",title:"TOOLBAR.OPENCHANNEL",value:"openchannel",permission:r.openchannel&&(p(108)||e.openchannelAutoanswer),enabled:e.openchannelAutoanswer,delay:e.openchannelAutoanswerDelay},{font_icon:"icon-deskphone",class:"grey-A200-fg",label:"fax",title:"TOOLBAR.FAX",value:"fax",permission:r.fax&&(p(109)||e.faxAutoanswer),enabled:e.faxAutoanswer,delay:e.faxAutoanswerDelay},{font_icon:"icon-whatsapp",class:"lime-A700-fg",label:"whatsapp",title:"TOOLBAR.WHATSAPP",value:"whatsapp",permission:r.whatsapp&&(p(114)||e.whatsappAutoanswer),enabled:e.whatsappAutoanswer,delay:e.whatsappAutoanswerDelay}]})}function p(e){return _.includes(c.user.permissions,e)}c.items=[],c.closeDialog=function(){a.hide()},c.user=d.getCurrentUser(),u(),o.connect(),o.on("userNotification:recalc:"+c.user.id,m)}e.$inject=["$scope","$state","$location","$mdDialog","toasty","api","socket","license","user","Auth"],angular.module("app.toolbar").controller("AutoAnswerNotificationsDialogController",e)}(),function(){"use strict";function e(t,e,n,a,i,s,o){var r=this;function l(){e.hide()}r.errors=[],r.user=i,r.setting=s,r.reset=o,r.passwordPattern=r.setting.securePassword?/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/:"",r.savePassword=function(){r.errors=[],a.user.changePassword({id:r.user.id},{oldPassword:r.oldPassword,newPassword:r.password}).$promise.then(function(){n.show(n.simple().textContent("Your password properly updated").position("top right").hideDelay(5e3)),l()}).catch(function(e){console.error(e),r.errors=e.data.errors&&e.data.errors.length?e.data.errors:[{message:e.data.message||"Authorization error",type:"api.user.changePassword"}]})},r.closeDialog=l,t.$watch("vm.password",function(e,n){_.isNil(r.oldPassword)||(e===r.oldPassword?t.changePasswordForm.password.$setValidity("oldPasswordMatch",!1):t.changePasswordForm.password.$setValidity("oldPasswordMatch",!0))})}e.$inject=["$scope","$mdDialog","$mdToast","api","user","setting","reset"],angular.module("app.toolbar").controller("ChangePasswordController",e)}(),function(){"use strict";function e(e,t,a,i,n,s,o){var r=this;function l(e,n){var t={id:e.id};n?t.recallmeNotifiedDate=null:r.isRecallNotification?t.recallmeNotifiedDate=null:e.recallme||(t.UserId=null),i.cmHopper.update(t)}function d(e){var n=!1;_.isNil(e)||(n=e),l(r.preview,n),t.hide()}function c(e){return i.cmContact.getAdditionalPhones({id:e}).$promise.then(function(e){var n=_.map(e,"item"),t=_.map(e,"description");r.additionalItemTypes=_.map(e,"ItemTypeId");var a=_.map(e,"ItemType.rgbBackgroundColor"),i=_.map(e,"ItemType.name");r.additionalItems=[];for(var s=0;s<n.length;s++)r.additionalItems.push({phone:n[s],type:i[s],color:a[s],description:t[s]})})}r.customFieldsMap=s&&s.rows?_.mapValues(_.keyBy(s.rows,function(e){return"cf_"+e.id}),"name"):{},r.errors=[],r.hopperIds=[],r.additionalItems=[],r.preview=n,r.isRecallNotification=o,r.originated=!1,r.disable=!1,r.disableGetContact=!1,r.hopperIds.push(r.preview.id),r.originatePreview=function(){r.originated=!0,r.disable=!0,_.isEmpty(r.preview)?(a.error({title:"Message",msg:"Contact not available"}),r.disable=!1,r.hopperIds=[],d(!0)):i.rpc.getVoiceQueuesPreview({id:r.preview.id}).$promise.then(function(){d(!0)}).catch(function(e){a.error({title:"Message",msg:e.data}),d(!0)}).finally(function(){r.disable=!1,r.hopperIds=[]})},r.closeDialog=d,r.nextContact=function(){return r.disableGetContact=!0,i.cmHopper.getPreview({hopperIds:r.hopperIds,direction:"next"}).$promise.then(function(e){r.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(r.hopperIds=[],t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e,r.hopperIds.push(r.preview.id))}).catch(function(e){if(r.disableGetContact=!1,r.hopperIds=[],404===e.status)r.getFirstAvailableContact();else if(e.data&&e.data.errors&&e.data.errors.length){t.hide();for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else t.hide(),a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})},r.previousContact=function(){if(r.disableGetContact=!0,1<r.hopperIds.length){var e=_.without(r.hopperIds,r.preview.id);return i.cmHopper.getPreview({hopperIds:e,direction:"prev"}).$promise.then(function(e){r.disableGetContact=!1,_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(r.hopperIds=[],t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),_.remove(r.hopperIds,function(e){return e==r.preview.id}),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e)}).catch(function(e){if(404===e.status)r.hopperIds=[r.preview.id],a.info({title:"PREVIEW",msg:"PREVIOUS CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){r.hopperIds=[],t.hide();for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else r.hopperIds=[],t.hide(),a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})})}},r.getFirstAvailableContact=function(){return r.disableGetContact=!0,a.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE. REWINDING THE LIST"}),i.cmHopper.getPreview({hopperIds:[r.preview.id],direction:"next"}).$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?(t.hide(),a.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"})):(c(e.Contact.id),r.originated||i.cmHopper.update({id:r.preview.id,UserId:null}),r.preview=e,r.hopperIds.push(r.preview.id))}).catch(function(e){if(t.hide(),404===e.status)a.info({title:"PREVIEW",msg:"CONTACTS NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length)for(var n=0;n<e.data.errors.length;n+=1)a.error({title:e.data.errors[n].type,msg:e.data.errors[n].message});else a.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api preview",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){r.disableGetContact=!1})},r.isCustomField=function(e){return _.startsWith(e,"cf_")},r.isHiddenField=function(e){return _.includes(["Company","CompanyId","ListId","UserId","createdAt","deletedAt","id","dialTimezone","utcOffset","AdditionalPhones","additionalPhones","priority","scheduledat","tags","updatedAt","facebook","twitter","skype","wechat","teams","viber","line","telegram"],e)},r.isNil=function(e){return _.isNil(e)},_.isNil(r.preview)||c(r.preview.Contact.id),e.$on("$destroy",function(){r.originated||l(r.preview,!1)})}e.$inject=["$scope","$mdDialog","toasty","api","preview","customFields","isRecallNotification"],angular.module("app.toolbar").controller("PreviewDialogController",e).directive("customChip",function(){return{restrict:"A",scope:!1,link:function(e,n,t){n.parent().parent().css("background",e.$chip.color)}}})}(),function(){"use strict";function e(n,t,s,a,o,e,i,r,l,d,c,m,u,p,g,v,h,f,b,A,E,y,S){var T,I=this;I.voiceQueues=[],I.polling=!0,t.global={search:""},I.pauses=[],I.license=b,I.currentUser=v.getCurrentUser(),I.unreadTotalMessages=0,I.unreadTotalGroupMessages=0,I.contacts=0,"agent"===I.currentUser.role&&(T=E(function(){_.some(I.voiceQueues,{dialMethod:"preview",dialActive:!0})&&I.license.dialer&&I.polling?(I.polling=!1,f.cmHopper.getOpenContacts().$promise.then(function(e){e&&_.isNumber(e.contacts)&&(I.contacts=e.contacts)}).finally(function(){I.polling=!0})):I.contacts=0},14999)),I.setting=A,I.bodyEl=angular.element("body"),I.conf={realm:"asterisk",host:e.host(),protocol:e.protocol(),soundPlayerId:"local-audio",remotePlayerId:"remote-audio",ua:"Motion WebRTC Bar 0.2.0",license:I.license.webrtc,phoneBarExpires:I.currentUser.phoneBarExpires,phoneBarPrefixRequired:I.currentUser.phoneBarPrefixRequired,wssPort:I.currentUser.wssPort},I.webRTCSessions=[],I.autoanswerIconColor="green-700-fg",I.userStatusOptions=[{title:"Online",icon:"icon-checkbox-marked-circle",color:"#4CAF50"},{title:"Away",icon:"icon-clock",color:"#FFC107"},{title:"Do not Disturb",icon:"icon-minus-circle",color:"#F44336"},{title:"Invisible",icon:"icon-checkbox-blank-circle-outline",color:"#BDBDBD"},{title:"Offline",icon:"icon-checkbox-blank-circle-outline",color:"#616161"}],I.languages={ar:{title:"Arabic",translation:"TOOLBAR.ARABIC",code:"ar",flag:"ar"},bs:{title:"Bosnian",translation:"TOOLBAR.BOSNIAN",code:"bs",flag:"bs"},cs:{title:"Czech",translation:"TOOLBAR.CZECH",code:"cs",flag:"cs"},da:{title:"Danish",translation:"TOOLBAR.DANISH",code:"da",flag:"da"},de:{title:"German",translation:"TOOLBAR.GERMAN",code:"de",flag:"de"},en:{title:"English",translation:"TOOLBAR.ENGLISH",code:"en",flag:"us"},es:{title:"Spanish",translation:"TOOLBAR.SPANISH",code:"es",flag:"es"},et:{title:"Estonian",translation:"TOOLBAR.ESTONIAN",code:"et",flag:"et"},fa:{title:"Persian",translation:"TOOLBAR.PERSIAN",code:"fa",flag:"fa"},fi:{title:"Finnish",translation:"TOOLBAR.FINNISH",code:"fi",flag:"fi"},fr:{title:"French",translation:"TOOLBAR.FRENCH",code:"fr",flag:"fr"},he:{title:"Hebrew",translation:"TOOLBAR.HEBREW",code:"he",flag:"he"},hi:{title:"Hindi",translation:"TOOLBAR.HINDI",code:"hi",flag:"hi"},hu:{title:"Hungarian",translation:"TOOLBAR.HUNGARIAN",code:"hu",flag:"hu"},id:{title:"Indonesian",translation:"TOOLBAR.INDONESIAN",code:"id",flag:"id"},it:{title:"Italian",translation:"TOOLBAR.ITALIAN",code:"it",flag:"it"},ja:{title:"Japanese",translation:"TOOLBAR.JAPANESE",code:"ja",flag:"ja"},ko:{title:"Korean",translation:"TOOLBAR.KOREAN",code:"ko",flag:"ko"},lv:{title:"Latvian",translation:"TOOLBAR.LATVIAN",code:"lv",flag:"lv"},nl:{title:"Dutch",translation:"TOOLBAR.DUTCH",code:"nl",flag:"nl"},no:{title:"Norwegian",translation:"TOOLBAR.NORWEGIAN",code:"no",flag:"no"},pl:{title:"Polish",translation:"TOOLBAR.POLISH",code:"pl",flag:"pl"},"pt-BR":{title:"Brazilian",translation:"TOOLBAR.BRAZILIAN",code:"pt-BR",flag:"pt-BR"},"pt-PT":{title:"Portuguese",translation:"TOOLBAR.PORTUGUESE",code:"pt-PT",flag:"pt-PT"},ru:{title:"Russian",translation:"TOOLBAR.RUSSIAN",code:"ru",flag:"ru"},sv:{title:"Swedish",translation:"TOOLBAR.SWEDISH",code:"sv",flag:"sv"},tr:{title:"Turkish",translation:"TOOLBAR.TURKISH",code:"tr",flag:"tr"},"zh-CN":{title:"ChineseSimplified",translation:"TOOLBAR.CHINESESIMPLIFIED",code:"zh-CN",flag:"zh-CN"},"zh-TW":{title:"ChineseTraditional",translation:"TOOLBAR.CHINESETRADITIONAL",code:"zh-TW",flag:"zh-TW"}},I.isWebRTCBarRegistered=!1;var O=["ar","fa","he"],C=S.getLogger("toolbar");function w(n){n.queuecallerleaveAt?I.waitingQueueCalls=_.filter(I.waitingQueueCalls,function(e){return e!==n.uniqueid}):I.waitingQueueCalls.push(n.uniqueid)}function R(e){w(e)}function x(e){"inbound"===e.type&&w(e)}function N(){h.connect(),h.on("user:update",H),h.on("user:called",V),h.on("chatInternalMessage:save",F),h.on("chatInternalMessage:update",$),h.on("userVoiceQueue:save",k),h.on("voiceQueue:save",L),h.on("userVoiceQueue:remove",k),h.on("voiceQueue:remove",L),h.on("voiceQueue:update",L),h.on("user:forcelogout",B),h.on("userNotification:send",Q),h.on("userNotification:recalc:"+I.user.id,j),h.onWithoutApply("voice_queue_channel:save",x),h.onWithoutApply("voice_queue_channel:remove",R)}function D(){h.disconnect("logout")}function P(){var e={id:v.getCurrentUser().id,fields:"id,name,type,dialMethod,dialActive",channel:"voice",nolimit:!0};return f.user.getQueues(e).$promise.then(function(e){I.voiceQueues=e.rows})}function L(){P()}function k(e){_.toInteger(e.UserId)===v.getCurrentUser().id&&P()}function M(e,n,t){n||(n=!1),t||(t={type:"click",target:"button.preview-button"}),c.show({controller:"PreviewDialogController",controllerAs:"vm",templateUrl:"app/toolbar/preview/dialog.html",parent:angular.element(m.body),targetEvent:t,clickOutsideToClose:!0,locals:{preview:e,currentUser:I.currentUser,isRecallNotification:n},resolve:{customFields:["apiResolver",function(e){return e.resolve("cmCustomField@get",{nolimit:!0})}]}})}function U(){return I.license.chat&&(I.hasPermission(105)||I.currentUser.chatAutoanswer)||I.license.mail&&I.hasPermission(106)||I.currentUser.emailAutoanswer||I.license.messaging&&I.hasPermission(107)||I.currentUser.smsAutoanswer||I.license.openchannel&&I.hasPermission(108)||I.currentUser.openchannelAutoanswer||I.license.fax&&I.hasPermission(109)||I.currentUser.faxAutoanswer||I.license.whatsapp&&(I.hasPermission(114)||I.currentUser.whatsappAutoanswer)}function F(e){e.ToId!==I.currentUser.id||e.ChatGroupId||(I.unreadTotalMessages+=1),e.ToId===I.currentUser.id&&e.FromId!==I.currentUser.id&&!e.read&&e.ChatGroupId&&I.unreadTotalGroupMessages++}function $(e){e.ToId===I.currentUser.id&&e.read&&0<I.unreadTotalMessages&&!e.ChatGroupId&&(I.unreadTotalMessages-=1),e.ToId===I.currentUser.id&&e.read&&e.ChatGroupId&&0<I.unreadTotalGroupMessages&&I.unreadTotalGroupMessages--}function q(e){return D(),s.resolve().then(function(){if(!v.isTelephone())return S.flush()}).then(function(){return v.logout(e)}).then(function(){return t.$broadcast("webrtc::logout"),a.go("app.login")}).catch(function(e){C.error(e)})}function G(e,n){c.show({controller:"ChangePasswordController",controllerAs:"vm",templateUrl:"app/toolbar/changepassword/changepassword.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!n,escapeToClose:!n,locals:{user:I.user,setting:A,reset:n}})}function H(e){if(e.id===I.user.id)if("agent"===e.role&&_.isBoolean(e.online)&&!e.online)if(0!==I.user.showWebBar){var n;D();var t=c.confirm({title:r.instant("TOOLBAR.WARNING")+"!",htmlContent:"<span>"+r.instant("TOOLBAR.SOMEONE_LOGGED_YOU_OUT")+"</span><br><span>"+r.instant("TOOLBAR.SESSION_TIMEOUT")+"</span>",ariaLabel:r.instant("TOOLBAR.WARNING")+"!",ok:r.instant("TOOLBAR.STAY_LOGGED"),cancel:r.instant("TOOLBAR.LOGOUT"),onComplete:function(){n=setTimeout(function(){c.cancel()},6e4)}});c.show(t).then(function(){return clearTimeout(n),v.queueLogin().then(function(){N(),_.merge(I.user,e),v.setCurrentUser(I.user)})}).catch(function(){clearTimeout(n),q(!0)})}else q(!0);else _.merge(I.user,e),v.setCurrentUser(I.user)}function V(e){if(I.isWebRTCBarRegistered&&2===I.currentUser.showWebBar&&"agent"===I.currentUser.role){var n=I.currentUser.privacyEnabled?y.mask(e.calleridnum):e.calleridnum;p.info({title:"WebRTC Popup",msg:"<div>            <span>Call from: "+n+"</span><br>            <span>Queue: "+e.queue+"</span><br>            <span>Extra: "+(e.variables.extravar?e.variables.extravar:"Not defined")+"</span><br>            </div>",showClose:!0,timeout:1e4,html:!0})}}function B(e){if(C.debug("onForceLogout -> data",e),e.user.id===I.user.id&&0!==I.user.showWebBar)return D(),s.resolve().then(function(){if(!v.isTelephone())return S.flush()}).then(function(){return v.logout(!0)}).then(function(){t.$broadcast("webrtc::logout"),c.show(c.alert().parent(angular.element(m.body)).clickOutsideToClose(!1).escapeToClose(!1).title(r.instant("TOOLBAR.WARNING")).textContent(r.instant("TOOLBAR.USER_FORCE_LOGOUT",{ip:e.ip})).ok("OK")).then(function(){return a.go("app.login")})}).catch(function(e){C.error(e)})}function Q(e){var n=e;if(I.currentUser.id===n.recipient){var t=r.instant("TOOLBAR.NOTIFICATION_TITLE",{sender:n.sender}),a=n.description?r.instant("TOOLBAR.NOTIFICATION_TITLE_RECIPIENT",{recipient:n.description}):null;p.wait({title:a?t+" "+a:t,msg:n.content,clickToClose:!1,timeout:!1,sound:n.beep,html:!0})}}function W(){I.autoanswerIconColor=U()?"green-700-fg":"gray-700-fg"}function j(e){e&&e.permissions&&(I.currentUser.permissions=e.permissions,W())}I.toggleSidenav=function(e){i(e).toggle()},I.logout=q,I.changeLanguage=function(e){if(!I.languages.hasOwnProperty(e.code)){return void l.show({template:'<md-toast id="language-message" layout="column" layout-align="center start"><div class="md-toast-content">Motion supports multiple translations through angular-translate module, but currently we do not support the selected language. If you want to help us, send us a message.</div></md-toast>',hideDelay:7e3,position:"top right",parent:"#content"})}I.selectedLanguage=e,u.put("motion.language",e.code),r.use(e.code),"app.callysquare.projects.edit"===a.current.name&&d.location.reload();0<=O.indexOf(e.code)?p.info({title:r.instant("TOOLBAR.CHANGE_LANGUAGE_TITLE"),msg:r.instant("TOOLBAR.CHANGE_LANGUAGE_MESSAGE")}):n.$parent.$parent.vm.direction="ltr"},I.setUserStatus=function(e){I.userStatus=e},I.toggleHorizontalMobileMenu=function(){I.bodyEl.toggleClass("ms-navigation-horizontal-mobile-menu-active")},I.toggleMsNavigationFolded=function(){g.toggleFolded()},I.search=function(n){for(var e=[],t=g.getFlatNavigation(),a=s.defer(),i=0;i<t.length;i++)t[i].uisref&&e.push(t[i]);n&&(e=e.filter(function(e){if(-1<angular.lowercase(e.title).search(angular.lowercase(n)))return!0}));return o(function(){a.resolve(e)},1e3),a.promise},I.searchResultClick=function(e){e.uisref&&(e.stateParams?a.go(e.state,e.stateParams):a.go(e.state))},I.openSettings=function(){t.$broadcast("webrtc::settings")},I.changePassword=G,I.isAgent=function(){return v.getCurrentUser()&&v.hasRole("agent")},I.pause=function(e){var n=e||"DEFAULT PAUSE";_.some(I.webRTCSessions,["confirmed",!0])&&(n="#"+n);return f.user.pause({id:I.user.id,type:n}).$promise.catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:PAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})})},I.unpause=function(){return f.user.unpause({id:I.user.id}).$promise.catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:UNPAUSEUSER",msg:e.status?JSON.stringify(e.data):e.toString()})})},I.preview=function(n){return I.disable=!0,f.cmHopper.getPreview().$promise.then(function(e){_.isNil(e)||_.isNil(e.Queue)||!e.Queue.dialActive?p.info({title:"PREVIEW",msg:"CAMPAIGN NOT ACTIVE"}):M(e,!1,n)}).catch(function(e){if(404===e.status)p.info({title:"PREVIEW",msg:"CONTACT NOT AVAILABLE"});else if(e.data&&e.data.errors&&e.data.errors.length){I.errors=e.data.errors||[{message:e.toString(),type:"api.openchannelMessage.accept"}];for(var n=0;n<e.data.errors.length;n+=1)p.error({title:e.data.errors[n].type,msg:e.data.errors[n].message})}else p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"api.openchannelMessage.accept",msg:e.data?JSON.stringify(e.data.message):e.toString()})}).finally(function(){I.disable=!1})},I.autoAnswerNotificationsDialog=function(e){U()?c.show({controller:"AutoAnswerNotificationsDialogController",controllerAs:"vm",templateUrl:"app/toolbar/autoanswers/dialog.html",parent:angular.element(m.body),targetEvent:e,clickOutsideToClose:!0,locals:{license:I.license,user:I.currentUser}}):alert(r.instant("TOOLBAR.NO_AUTOANSWER_CONFIGURED"))},I.getLogo=function(){return I.setting.defaultHeaderWhiteLabel?"xCALLY Motion":I.setting.headerWhiteLabel},I.userIsNotPhonebar=function(){return"admin"===I.currentUser.role||"user"===I.currentUser.role||"agent"===I.currentUser.role&&0!==I.currentUser.showWebBar},I.hasPermission=function(e){return _.includes(I.currentUser.permissions,e)},I.waitingQueueCalls=[],function(){I.user=v.getCurrentUser(),P().then(function(){return f.rpc.getVoiceQueuesChannels().$promise}).then(function(e){e.rows.forEach(function(n){if("inbound"===n.type&&!n.queuecallerleaveAt){var e=_.find(I.voiceQueues,function(e){return e.name===n.queue});e&&I.waitingQueueCalls.push(n.uniqueid)}})}),I.conf.ha1=I.user.md5secret,I.conf.id=I.user.id,I.conf.name=I.user.name,I.conf.fullname=I.user.fullname,I.conf.internal=I.user.internal,I.conf.recording=I.user.phoneBarEnableRecording,I.conf.autoAnswer=I.user.phoneBarAutoAnswer,I.conf.enableSettings=I.user.phoneBarEnableSettings,I.conf.enableDtmfTone=I.user.phoneBarEnableDtmfTone,I.conf.autoAnswerDelay=I.user.phoneBarAutoAnswerDelay,I.userStatus=I.userStatusOptions[0];var e=u.get("motion.language");e&&I.languages.hasOwnProperty(e)?I.selectedLanguage=I.languages[e]:I.selectedLanguage=I.languages[r.preferredLanguage()];if(f.pause.get({fields:"name",nolimit:!0}).$promise.then(function(e){I.pauses=e.rows?e.rows:[]}).catch(function(e){p.error({title:e.status?"API:"+e.status+" - "+e.statusText:"SYSTEM:GETPAUSES",msg:e.status?JSON.stringify(e.data):e.toString()})}),"LOCAL_LOGIN"==v.getAuthenticationType()&&I.setting.securePassword)if(I.user.passwordResetAt){var n=moment(I.user.passwordResetAt).add(I.setting.passwordExpiresDays||90,"day");moment().isAfter(n)?G(null,!0):moment().add(15,"day").isAfter(n)&&p.warning({title:r.instant("TOOLBAR.WARNING")+"!",msg:r.instant("TOOLBAR.PASSWORD_EXPIRE_REMAINING_DAYS")+": "+Math.ceil(n.diff(moment(),"days",!0)),timeout:2e4})}else G(null,!0);W()}(),N(),I.openPreviewDialog=M,f.chatInternalMessage.get({fields:"FromId",ToId:I.currentUser.id,read:!1,nolimit:!0}).$promise.then(function(e){I.unreadTotalMessages=e.rows.length}),n.$on("$destroy",function(){h.removeAllListeners("user:called"),h.removeAllListeners("user:update"),h.removeAllListeners("chatInternalMessage:save"),h.removeAllListeners("chatInternalMessage:update"),h.removeAllListeners("userVoiceQueue:save"),h.removeAllListeners("voiceQueue:save"),h.removeAllListeners("userVoiceQueue:remove"),h.removeAllListeners("voiceQueue:remove"),h.removeAllListeners("voiceQueue:update"),h.removeAllListeners("user:forcelogout"),h.removeAllListeners("userNotification:send"),h.removeAllListeners("userNotification:recalc:"+I.user.id),T&&(E.cancel(T),T=null)})}e.$inject=["$scope","$rootScope","$q","$state","$timeout","$location","$mdSidenav","$translate","$mdToast","$window","$mdDialog","$document","$cookies","toasty","msNavigationService","Auth","socket","api","license","setting","$interval","privacyManager","ClientSideLoggingService"],angular.module("app.toolbar").controller("ToolbarController",e)}(),function(){"use strict";function e(a,i,t,s,e){var n={updateUserSettingById:function(e,n){if("number"==typeof e)return i.userSetting.update({id:e},n).$promise;throw new Error("User setting id is missing")}},o=!1,r=a.getCurrentUser(),l=r?r.userSetting:null,d=function(e){var n="user-setting:update:user-"+e;t.$on("local:user-updated",c),s.on(n,c)};function c(){return o?e(function(e){e(l)}):(o=!0,function(e){var n=a.getCurrentUser(),t=null;t="admin"===n.role&&"number"==typeof e?i.user.get({id:e,userSetting:!0}).$promise:i.user.whoami({userSetting:!0}).$promise;return t.then(function(e){return a.setCurrentUser(e),e.userSetting})}().then(function(e){l=e,t.$emit("local:user-setting-updated",l)}).finally(function(){o=!1}))}return r&&d(r.id),t.$on("local:user-login",d),t.$on("local:user-logout",function(e){var n="user-setting:update:user-"+e;s.removeListener(n,c),l=null}),n}e.$inject=["Auth","api","$rootScope","socket","$q"],angular.module("app.user-setting").service("UserSettingService",e)}();var urlParams=function(e){var n=new Object,t=e.lastIndexOf("?");if(0<t)for(var a=e.substring(t+1).split("&"),i=0;i<a.length;i++)0<(t=a[i].indexOf("="))&&(n[a[i].substring(0,t)]=a[i].substring(t+1));return n}(window.location.href),t0=new Date,MAX_REQUEST_SIZE=10485760,MAX_WIDTH=12e3,MAX_HEIGHT=12e3,EXPORT_URL="http://exp.draw.io/ImageExport2/export",SHARE_HOST="http://localhost:3000",SAVE_URL="api/square/projects/",VARIABLE_URL="/api/variables",STENCIL_PATH="/assets/plugins/square/stencils",SHAPES_PATH="/assets/plugins/square/shapes",IMAGE_PATH="/assets/plugins/square/images",STYLE_PATH="/assets/plugins/square/styles",CSS_PATH="/assets/plugins/square/styles",OPEN_FORM="api/square/projects/open",TEMPLATE_PATH="/assets/plugins/square/templates",RESOURCES_PATH="/assets/plugins/square/resources",RESOURCE_BASE=RESOURCES_PATH+"/grapheditor",CRUD_PERMISSIONS={readOnly:!1,canEdit:!1,canDelete:!1},tapAndHoldStartsConnection=!0,showConnectorImg=!0,mxLoadResources=!1,mxLanguages=["it","fr","ko","es","sv","ru","de","ja","zh-CN","zh-TW","nl","fi","da","pt-BR","pt-PT","no","hi","tr","fa"],mxLanguage="en",match=document.cookie.match(new RegExp("(^| )motion.language=([^;]+)"));match&&mxLanguages.includes(match[2])&&(mxLanguage=match[2]);var mxBasePath="assets/plugins/mxgraph",mxClient={VERSION:"2.0.0.0",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&navigator.userAgent.indexOf("MSIE")<0,IS_OP:0<=navigator.userAgent.indexOf("Opera/"),IS_OT:navigator.userAgent.indexOf("Presto/2.4.")<0&&navigator.userAgent.indexOf("Presto/2.3.")<0&&navigator.userAgent.indexOf("Presto/2.2.")<0&&navigator.userAgent.indexOf("Presto/2.1.")<0&&navigator.userAgent.indexOf("Presto/2.0.")<0&&navigator.userAgent.indexOf("Presto/1.")<0,IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&navigator.userAgent.indexOf("Chrome/")<0,IS_GC:0<=navigator.userAgent.indexOf("Chrome/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&navigator.userAgent.indexOf("Firefox/1.")<0&&navigator.userAgent.indexOf("Firefox/2.")<0||0<=navigator.userAgent.indexOf("Iceweasel/")&&navigator.userAgent.indexOf("Iceweasel/1.")<0&&navigator.userAgent.indexOf("Iceweasel/2.")<0||0<=navigator.userAgent.indexOf("SeaMonkey/")&&navigator.userAgent.indexOf("SeaMonkey/1.")<0||0<=navigator.userAgent.indexOf("Iceape/")&&navigator.userAgent.indexOf("Iceape/1.")<0,IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||0<=navigator.userAgent.indexOf("Epiphany/")||0<=navigator.userAgent.indexOf("AppleWebKit/")||0<=navigator.userAgent.indexOf("Gecko/")||0<=navigator.userAgent.indexOf("Opera/"),NO_FO:0<=navigator.userAgent.indexOf("Firefox/1.")||0<=navigator.userAgent.indexOf("Iceweasel/1.")||0<=navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/1.")||0<=navigator.userAgent.indexOf("Camino/1.")||0<=navigator.userAgent.indexOf("Epiphany/2.")||0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("MSIE")||0<=navigator.userAgent.indexOf("Mozilla/2."),IS_VML:"MICROSOFT INTERNET EXPLORER"==navigator.appName.toUpperCase(),IS_MAC:0<navigator.userAgent.toUpperCase().indexOf("MACINTOSH"),IS_TOUCH:0<navigator.userAgent.toUpperCase().indexOf("IPAD")||0<navigator.userAgent.toUpperCase().indexOf("IPOD")||0<navigator.userAgent.toUpperCase().indexOf("IPHONE")||0<navigator.userAgent.toUpperCase().indexOf("ANDROID"),IS_LOCAL:document.location.href.indexOf("http://")<0&&document.location.href.indexOf("https://")<0,isBrowserSupported:function(){return mxClient.IS_VML||mxClient.IS_SVG},link:function(e,n,t){if(t=t||document,mxClient.IS_IE6)t.write('<link rel="'+e+'" href="'+n+'" charset="ISO-8859-1" type="text/css"/>');else{var a=t.createElement("link");a.setAttribute("rel",e),a.setAttribute("href",n),a.setAttribute("charset","ISO-8859-1"),a.setAttribute("type","text/css"),t.getElementsByTagName("head")[0].appendChild(a)}},include:function(e){document.write('<script src="'+e+'"><\/script>')},dispose:function(){for(var e=0;e<mxEvent.objects.length;e++)null!=mxEvent.objects[e].mxListenerList&&mxEvent.removeAllListeners(mxEvent.objects[e])}};if(mxClient.IS_OP&&mxClient.IS_OT?mxClient.CSS_PREFIX="O":mxClient.IS_SF||mxClient.IS_GC?mxClient.CSS_PREFIX="Webkit":mxClient.IS_MT?mxClient.CSS_PREFIX="Moz":mxClient.IS_IE&&9<=document.documentMode&&(mxClient.CSS_PREFIX="ms"),void 0===mxLoadResources&&(mxLoadResources=!0),"undefined"==typeof mxResourceExtension&&(mxResourceExtension=".txt"),"undefined"==typeof mxLoadStylesheets&&(mxLoadStylesheets=!0),void 0!==mxBasePath&&0<mxBasePath.length?("/"==mxBasePath.substring(mxBasePath.length-1)&&(mxBasePath=mxBasePath.substring(0,mxBasePath.length-1)),mxClient.basePath=mxBasePath):mxClient.basePath=".","undefined"!=typeof mxImageBasePath&&0<mxImageBasePath.length?("/"==mxImageBasePath.substring(mxImageBasePath.length-1)&&(mxImageBasePath=mxImageBasePath.substring(0,mxImageBasePath.length-1)),mxClient.imageBasePath=mxImageBasePath):mxClient.imageBasePath=mxClient.basePath+"/images",mxClient.language=void 0!==mxLanguage?mxLanguage:mxClient.IS_IE?navigator.userLanguage:navigator.language,mxClient.defaultLanguage="undefined"!=typeof mxDefaultLanguage?mxDefaultLanguage:"en",mxLoadStylesheets&&mxClient.link("stylesheet",mxClient.basePath+"/css/common.css"),void 0!==mxLanguages&&(mxClient.languages=mxLanguages),mxClient.IS_IE){if(9<=document.documentMode)mxClient.IS_VML=!1,mxClient.IS_SVG=!0;else{8==document.documentMode?(document.namespaces.add(mxClient.VML_PREFIX,"urn:schemas-microsoft-com:vml","#default#VML"),document.namespaces.add(mxClient.OFFICE_PREFIX,"urn:schemas-microsoft-com:office:office","#default#VML")):(document.namespaces.add(mxClient.VML_PREFIX,"urn:schemas-microsoft-com:vml"),document.namespaces.add(mxClient.OFFICE_PREFIX,"urn:schemas-microsoft-com:office:office"));var ss=document.createStyleSheet();ss.cssText="v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}",mxLoadStylesheets&&mxClient.link("stylesheet",mxClient.basePath+"/css/explorer.css")}window.attachEvent("onunload",mxClient.dispose)}var mxLog={consoleName:"Console",TRACE:!1,DEBUG:!0,WARN:!0,buffer:"",init:function(){if(null==mxLog.window&&null!=document.body){var e=mxLog.consoleName+" - mxGraph "+mxClient.VERSION,n=document.createElement("table");n.setAttribute("width","100%"),n.setAttribute("height","100%");var t=document.createElement("tbody"),a=document.createElement("tr"),i=document.createElement("td");if(i.style.verticalAlign="top",mxLog.textarea=document.createElement("textarea"),mxLog.textarea.setAttribute("readOnly","true"),mxLog.textarea.style.height="100%",mxLog.textarea.style.resize="none",mxLog.textarea.value=mxLog.buffer,mxLog.textarea.style.width=mxClient.IS_NS&&"BackCompat"!=document.compatMode?"99%":"100%",i.appendChild(mxLog.textarea),a.appendChild(i),t.appendChild(a),a=document.createElement("tr"),mxLog.td=document.createElement("td"),mxLog.td.style.verticalAlign="top",mxLog.td.setAttribute("height","30px"),a.appendChild(mxLog.td),t.appendChild(a),n.appendChild(t),mxLog.addButton("Info",function(e){mxLog.info()}),mxLog.addButton("DOM",function(e){e=mxUtils.getInnerHtml(document.body),mxLog.debug(e)}),mxLog.addButton("Trace",function(e){mxLog.TRACE=!mxLog.TRACE,mxLog.TRACE?mxLog.debug("Tracing enabled"):mxLog.debug("Tracing disabled")}),mxLog.addButton("Copy",function(e){try{mxUtils.copy(mxLog.textarea.value)}catch(e){mxUtils.alert(e)}}),mxLog.addButton("Show",function(e){try{mxUtils.popup(mxLog.textarea.value)}catch(e){mxUtils.alert(e)}}),mxLog.addButton("Clear",function(e){mxLog.textarea.value=""}),a=t=0,a="number"==typeof window.innerWidth?(t=window.innerHeight,window.innerWidth):(t=document.documentElement.clientHeight||document.body.clientHeight,document.body.clientWidth),mxLog.window=new mxWindow(e,n,Math.max(0,a-320),Math.max(0,t-210),300,160),mxLog.window.setMaximizable(!0),mxLog.window.setScrollable(!1),mxLog.window.setResizable(!0),mxLog.window.setClosable(!0),mxLog.window.destroyOnClose=!1,(mxClient.IS_NS||mxClient.IS_IE)&&!mxClient.IS_GC&&!mxClient.IS_SF&&"BackCompat"!=document.compatMode){var s=mxLog.window.getElement();e=function(e,n){mxLog.textarea.style.height=Math.max(0,s.offsetHeight-70)+"px"};mxLog.window.addListener(mxEvent.RESIZE_END,e),mxLog.window.addListener(mxEvent.MAXIMIZE,e),mxLog.window.addListener(mxEvent.NORMALIZE,e),mxLog.textarea.style.height="92px"}}},info:function(){mxLog.writeln(mxUtils.toString(navigator))},addButton:function(e,n){var t=document.createElement("button");mxUtils.write(t,e),mxEvent.addListener(t,"click",n),mxLog.td.appendChild(t)},isVisible:function(){return null!=mxLog.window&&mxLog.window.isVisible()},show:function(){mxLog.setVisible(!0)},setVisible:function(e){null==mxLog.window&&mxLog.init(),null!=mxLog.window&&mxLog.window.setVisible(e)},enter:function(e){if(mxLog.TRACE)return mxLog.writeln("Entering "+e),(new Date).getTime()},leave:function(e,n){if(mxLog.TRACE){var t=0!=n?" ("+((new Date).getTime()-n)+" ms)":"";mxLog.writeln("Leaving "+e+t)}},debug:function(){mxLog.DEBUG&&mxLog.writeln.apply(this,arguments)},warn:function(){mxLog.WARN&&mxLog.writeln.apply(this,arguments)},write:function(){for(var e="",n=0;n<arguments.length;n++)e+=arguments[n],n<arguments.length-1&&(e+=" ");null!=mxLog.textarea?(mxLog.textarea.value+=e,0<=navigator.userAgent.indexOf("Presto/2.5")&&(mxLog.textarea.style.visibility="hidden",mxLog.textarea.style.visibility="visible"),mxLog.textarea.scrollTop=mxLog.textarea.scrollHeight):mxLog.buffer+=e},writeln:function(){for(var e="",n=0;n<arguments.length;n++)e+=arguments[n],n<arguments.length-1&&(e+=" ");mxLog.write(e+"\n")}},mxObjectIdentity={FIELD_NAME:"mxObjectId",counter:0,get:function(e){if("object"==typeof e&&null==e[mxObjectIdentity.FIELD_NAME]){var n=mxUtils.getFunctionName(e.constructor);e[mxObjectIdentity.FIELD_NAME]=n+"#"+mxObjectIdentity.counter++}return e[mxObjectIdentity.FIELD_NAME]},clear:function(e){"object"==typeof e&&delete e[mxObjectIdentity.FIELD_NAME]}};function mxDictionary(){this.clear()}mxDictionary.prototype.map=null,mxDictionary.prototype.clear=function(){this.map={}},mxDictionary.prototype.get=function(e){return e=mxObjectIdentity.get(e),this.map[e]},mxDictionary.prototype.put=function(e,n){var t=mxObjectIdentity.get(e),a=this.map[t];return this.map[t]=n,a},mxDictionary.prototype.remove=function(e){e=mxObjectIdentity.get(e);var n=this.map[e];return delete this.map[e],n},mxDictionary.prototype.getKeys=function(){var e,n=[];for(e in this.map)n.push(e);return n},mxDictionary.prototype.getValues=function(){var e,n=[];for(e in this.map)n.push(this.map[e]);return n},mxDictionary.prototype.visit=function(e){for(var n in this.map)e(n,this.map[n])};var mxResources={resources:[],extension:mxResourceExtension,resourcesEncoded:!1,loadDefaultBundle:!0,loadSpecialBundle:!0,isLanguageSupported:function(e){return null==mxClient.languages||0<=mxUtils.indexOf(mxClient.languages,e)},getDefaultBundle:function(e,n){return mxResources.loadDefaultBundle||!mxResources.isLanguageSupported(n)?e+mxResources.extension:null},getSpecialBundle:function(e,n){if(null==mxClient.languages||!this.isLanguageSupported(n)){var t=n.indexOf("-");0<t&&(n=n.substring(0,t))}return mxResources.loadSpecialBundle&&mxResources.isLanguageSupported(n)&&n!=mxClient.defaultLanguage?e+"_"+n+mxResources.extension:null},add:function(e,n){if((n=null!=n?n:mxClient.language)!=mxConstants.NONE){var t=mxResources.getDefaultBundle(e,n);if(null!=t)try{var a=mxUtils.load(t);a.isReady()&&mxResources.parse(a.getText())}catch(e){}if(null!=(t=mxResources.getSpecialBundle(e,n)))try{(a=mxUtils.load(t)).isReady()&&mxResources.parse(a.getText())}catch(e){}}},parse:function(e){if(null!=e){e=e.split("\n");for(var n=0;n<e.length;n++)if("#"!=e[n].charAt(0)){var t=e[n].indexOf("=");if(0<t){var a=e[n].substring(0,t),i=e[n].length;13==e[n].charCodeAt(i-1)&&i--,t=e[n].substring(t+1,i),this.resourcesEncoded?(t=t.replace(/\\(?=u[a-fA-F\d]{4})/g,"%"),mxResources.resources[a]=unescape(t)):mxResources.resources[a]=t}}}},get:function(e,n,t){if(null==(e=mxResources.resources[e])&&(e=t),null!=e&&null!=n){t=[];for(var a=null,i=0;i<e.length;i++){var s=e.charAt(i);"{"==s?a="":null!=a&&"}"==s?(0<=(a=parseInt(a)-1)&&a<n.length&&t.push(n[a]),a=null):null!=a?a+=s:t.push(s)}e=t.join("")}return e}};function mxPoint(e,n){this.x=null!=e?e:0,this.y=null!=n?n:0}function mxRectangle(e,n,t,a){mxPoint.call(this,e,n),this.width=null!=t?t:0,this.height=null!=a?a:0}mxPoint.prototype.x=null,mxPoint.prototype.y=null,mxPoint.prototype.equals=function(e){return e.x==this.x&&e.y==this.y},mxPoint.prototype.clone=function(){return mxUtils.clone(this)},mxRectangle.prototype=new mxPoint,mxRectangle.prototype.constructor=mxRectangle,mxRectangle.prototype.width=null,mxRectangle.prototype.height=null,mxRectangle.prototype.setRect=function(e,n,t,a){this.x=e,this.y=n,this.width=t,this.height=a},mxRectangle.prototype.getCenterX=function(){return this.x+this.width/2},mxRectangle.prototype.getCenterY=function(){return this.y+this.height/2},mxRectangle.prototype.add=function(e){if(null!=e){var n=Math.min(this.x,e.x),t=Math.min(this.y,e.y),a=Math.max(this.x+this.width,e.x+e.width);e=Math.max(this.y+this.height,e.y+e.height),this.x=n,this.y=t,this.width=a-n,this.height=e-t}},mxRectangle.prototype.grow=function(e){this.x-=e,this.y-=e,this.width+=2*e,this.height+=2*e},mxRectangle.prototype.getPoint=function(){return new mxPoint(this.x,this.y)},mxRectangle.prototype.equals=function(e){return e.x==this.x&&e.y==this.y&&e.width==this.width&&e.height==this.height};var mxEffects={animateChanges:function(l,d,c){var m=0,u=function(){for(var e=!1,n=0;n<d.length;n++){var t=d[n];if(t instanceof mxGeometryChange||t instanceof mxTerminalChange||t instanceof mxValueChange||t instanceof mxChildChange||t instanceof mxStyleChange){var a=l.getView().getState(t.cell||t.child,!1);if(null!=a)if(e=!0,t.constructor!=mxGeometryChange||l.model.isEdge(t.cell))mxUtils.setOpacity(a.shape.node,100*m/10);else{var i=l.getView().scale,s=(t.geometry.x-t.previous.x)*i,o=(t.geometry.y-t.previous.y)*i,r=(t.geometry.width-t.previous.width)*i;i=(t.geometry.height-t.previous.height)*i;0==m?(a.x-=s,a.y-=o,a.width-=r,a.height-=i):(a.x+=s/10,a.y+=o/10,a.width+=r/10,a.height+=i/10),l.cellRenderer.redraw(a),mxEffects.cascadeOpacity(l,t.cell,100*m/10)}}}m<10&&e?(m++,window.setTimeout(u,p)):null!=c&&c()},p=30;u()},cascadeOpacity:function(e,n,t){for(var a=e.model.getChildCount(n),i=0;i<a;i++){var s=e.model.getChildAt(n,i),o=e.getView().getState(s);null!=o&&(mxUtils.setOpacity(o.shape.node,t),mxEffects.cascadeOpacity(e,s,t))}if(null!=(n=e.model.getEdges(n)))for(i=0;i<n.length;i++)null!=(a=e.getView().getState(n[i]))&&mxUtils.setOpacity(a.shape.node,t)},fadeOut:function(e,n,t,a,i,s){a=a||40,i=i||30;var o=n||100;if(mxUtils.setOpacity(e,o),s||null==s){var r=function(){o=Math.max(o-a,0),mxUtils.setOpacity(e,o),0<o?window.setTimeout(r,i):(e.style.visibility="hidden",t&&e.parentNode&&e.parentNode.removeChild(e))};window.setTimeout(r,i)}else e.style.visibility="hidden",t&&e.parentNode&&e.parentNode.removeChild(e)}},mxUtils={errorResource:"none"!=mxClient.language?"error":"",closeResource:"none"!=mxClient.language?"close":"",errorImage:mxClient.imageBasePath+"/error.gif",removeCursors:function(e){if(null!=e.style&&(e.style.cursor=""),null!=(e=e.childNodes))for(var n=e.length,t=0;t<n;t+=1)mxUtils.removeCursors(e[t])},getCurrentStyle:mxClient.IS_IE?function(e){return null!=e?e.currentStyle:null}:function(e){return null!=e?window.getComputedStyle(e,""):null},hasScrollbars:function(e){return null!=(e=mxUtils.getCurrentStyle(e))&&("scroll"==e.overflow||"auto"==e.overflow)},bind:function(e,n){return function(){return n.apply(e,arguments)}},eval:function(a){var b=null;if(0<=a.indexOf("function"))try{eval("var _mxJavaScriptExpression="+a),b=_mxJavaScriptExpression,_mxJavaScriptExpression=null}catch(e){mxLog.warn(e.message+" while evaluating "+a)}else try{b=eval(a)}catch(e){mxLog.warn(e.message+" while evaluating "+a)}return b},findNode:function(e,n,t){var a=e.getAttribute(n);if(null!=a&&a==t)return e;for(e=e.firstChild;null!=e;){if(null!=(a=mxUtils.findNode(e,n,t)))return a;e=e.nextSibling}return null},findNodeByAttribute:9<=document.documentMode?function(e,n,t){var a=null;if(null!=e)if(e.nodeType==mxConstants.NODETYPE_ELEMENT&&e.getAttribute(n)==t)a=e;else for(e=e.firstChild;null!=e&&null==a;)a=mxUtils.findNodeByAttribute(e,n,t),e=e.nextSibling;return a}:mxClient.IS_IE?function(e,n,t){return null==e?null:e.ownerDocument.selectSingleNode("//*[@"+n+"='"+t+"']")}:function(e,n,t){return null==e?null:e.ownerDocument.evaluate("//*[@"+n+"='"+t+"']",e.ownerDocument,null,XPathResult.ANY_TYPE,null).iterateNext()},getFunctionName:function(e){var n=null;if(null!=e)if(null!=e.name)n=e.name;else{for(e=e.toString(),n=9;" "==e.charAt(n);)n++;var t=e.indexOf("(",n);n=e.substring(n,t)}return n},indexOf:function(e,n){if(null!=e&&null!=n)for(var t=0;t<e.length;t++)if(e[t]==n)return t;return-1},remove:function(e,n){var t=null;if("object"==typeof n)for(var a=mxUtils.indexOf(n,e);0<=a;)n.splice(a,1),t=e,a=mxUtils.indexOf(n,e);for(var i in n)n[i]==e&&(delete n[i],t=e);return t},isNode:function(e,n,t,a){return!(null==e||isNaN(e.nodeType)||null!=n&&e.nodeName.toLowerCase()!=n.toLowerCase())&&(null==t||e.getAttribute(t)==a)},getChildNodes:function(e,n){n=n||mxConstants.NODETYPE_ELEMENT;for(var t=[],a=e.firstChild;null!=a;)a.nodeType==n&&t.push(a),a=a.nextSibling;return t},createXmlDocument:function(){var e=null;return document.implementation&&document.implementation.createDocument?e=document.implementation.createDocument("","",null):window.ActiveXObject&&(e=new ActiveXObject("Microsoft.XMLDOM")),e},parseXml:mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?function(e){var n=mxUtils.createXmlDocument();return n.async="false",n.loadXML(e),n}:function(e){return(new DOMParser).parseFromString(e,"text/xml")},clearSelection:document.selection?function(){document.selection.empty()}:window.getSelection?function(){window.getSelection().removeAllRanges()}:void 0,getPrettyXml:function(e,n,t){var a=[];if(null!=e)if(n=n||"  ",t=t||"",e.nodeType==mxConstants.NODETYPE_TEXT)a.push(e.nodeValue);else{a.push(t+"<"+e.nodeName);var i=e.attributes;if(null!=i)for(var s=0;s<i.length;s++){var o=mxUtils.htmlEntities(i[s].nodeValue);a.push(" "+i[s].nodeName+'="'+o+'"')}if(null!=(i=e.firstChild)){for(a.push(">\n");null!=i;)a.push(mxUtils.getPrettyXml(i,n,t+n)),i=i.nextSibling;a.push(t+"</"+e.nodeName+">\n")}else a.push("/>\n")}return a.join("")},removeWhitespace:function(e,n){for(var t=n?e.previousSibling:e.nextSibling;null!=t&&t.nodeType==mxConstants.NODETYPE_TEXT;){var a=n?t.previousSibling:t.nextSibling,i=mxUtils.getTextContent(t);0==mxUtils.trim(i).length&&t.parentNode.removeChild(t),t=a}},htmlEntities:function(e,n){return e=(e=(e=(e=(e=(e||"").replace(/&/g,"&amp;")).replace(/"/g,"&quot;")).replace(/\'/g,"&#39;")).replace(/</g,"&lt;")).replace(/>/g,"&gt;"),(null==n||n)&&(e=e.replace(/\n/g,"&#xa;")),e},isVml:function(e){return null!=e&&"urn:schemas-microsoft-com:vml"==e.tagUrn},getXml:function(e,n){var t="";return null!=e&&(t=null==(t=e.xml)?e.innerHTML?e.innerHTML:(new XMLSerializer).serializeToString(e):t.replace(/\r\n\t[\t]*/g,"").replace(/>\r\n/g,">").replace(/\r\n/g,"\n")),t.replace(/\n/g,n||"&#xa;")},getTextContent:function(e){var n="";return null!=e&&(null!=e.firstChild&&(e=e.firstChild),n=e.nodeValue||""),n},getInnerHtml:mxClient.IS_IE?function(e){return null!=e?e.innerHTML:""}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},getOuterHtml:mxClient.IS_IE?function(e){if(null==e)return"";if(null!=e.outerHTML)return e.outerHTML;var n=[];n.push("<"+e.nodeName);var t=e.attributes;if(null!=t)for(var a=0;a<t.length;a++){var i=t[a].nodeValue;null!=i&&0<i.length&&(n.push(" "),n.push(t[a].nodeName),n.push('="'),n.push(i),n.push('"'))}return 0==e.innerHTML.length?n.push("/>"):(n.push(">"),n.push(e.innerHTML),n.push("</"+e.nodeName+">")),n.join("")}:function(e){return null!=e?(new XMLSerializer).serializeToString(e):""},write:function(e,n){var t=e.ownerDocument.createTextNode(n);return null!=e&&e.appendChild(t),t},writeln:function(e,n){var t=e.ownerDocument.createTextNode(n);return null!=e&&(e.appendChild(t),e.appendChild(document.createElement("br"))),t},br:function(e,n){n=n||1;for(var t=null,a=0;a<n;a++)null!=e&&(t=e.ownerDocument.createElement("br"),e.appendChild(t));return t},button:function(e,n,t){return t=(t=null!=t?t:document).createElement("button"),mxUtils.write(t,e),mxEvent.addListener(t,"click",function(e){n(e)}),t},para:function(e,n){var t=document.createElement("p");return mxUtils.write(t,n),null!=e&&e.appendChild(t),t},addTransparentBackgroundFilter:function(e){e.style.filter+="progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+mxClient.imageBasePath+"/transparent.gif', sizingMethod='scale')"},linkAction:function(e,n,t,a,i){return mxUtils.link(e,n,function(){t.execute(a)},i)},linkInvoke:function(e,n,t,a,i,s){return mxUtils.link(e,n,function(){t[a](i)},s)},link:function(e,n,t,a){var i=document.createElement("span");return i.style.color="blue",i.style.textDecoration="underline",i.style.cursor="pointer",null!=a&&(i.style.paddingLeft=a+"px"),mxEvent.addListener(i,"click",t),mxUtils.write(i,n),null!=e&&e.appendChild(i),i},fit:function(e){var n=parseInt(e.offsetLeft),t=parseInt(e.offsetWidth),a=document.body,i=document.documentElement,s=(a.scrollLeft||i.scrollLeft)+(a.clientWidth||i.clientWidth);s<n+t&&(e.style.left=Math.max(a.scrollLeft||i.scrollLeft,s-t)+"px"),n=parseInt(e.offsetTop),t=parseInt(e.offsetHeight),(s=(a.scrollTop||i.scrollTop)+Math.max(a.clientHeight||0,i.clientHeight))<n+t&&(e.style.top=Math.max(a.scrollTop||i.scrollTop,s-t)+"px")},open:function(e){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return mxUtils.alert("Permission to read file denied."),""}var n=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);return n.initWithPath(e),n.exists()?((e=Components.classes["@mozilla.org/network/file-input-stream;1"].createInstance(Components.interfaces.nsIFileInputStream)).init(n,1,4,null),(n=Components.classes["@mozilla.org/scriptableinputstream;1"].createInstance(Components.interfaces.nsIScriptableInputStream)).init(e),n.read(n.available())):(mxUtils.alert("File not found."),"")}return e=(n=new ActiveXObject("Scripting.FileSystemObject").OpenTextFile(e,1)).readAll(),n.close(),e},save:function(e,n){if(mxClient.IS_NS){try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect")}catch(e){return void mxUtils.alert("Permission to write file denied.")}var t=Components.classes["@mozilla.org/file/local;1"].createInstance(Components.interfaces.nsILocalFile);t.initWithPath(e),t.exists()||t.create(0,420);var a=Components.classes["@mozilla.org/network/file-output-stream;1"].createInstance(Components.interfaces.nsIFileOutputStream);a.init(t,34,4,null),a.write(n,n.length),a.flush(),a.close()}else(t=new ActiveXObject("Scripting.FileSystemObject").CreateTextFile(e,!0)).Write(n),t.Close()},saveAs:function(e){var n=document.createElement("iframe");n.setAttribute("src",""),n.style.visibility="hidden",document.body.appendChild(n);try{if(mxClient.IS_NS){var t=n.contentDocument;t.open(),t.write(e),t.close();try{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"),n.focus(),saveDocument(t)}catch(e){mxUtils.alert("Permission to save document denied.")}}else(t=n.contentWindow.document).write(e),t.execCommand("SaveAs",!1,document.location)}finally{document.body.removeChild(n)}},copy:function(e){if(window.clipboardData)window.clipboardData.setData("Text",e);else{netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");var n=Components.classes["@mozilla.org/widget/clipboard;1"].createInstance(Components.interfaces.nsIClipboard);if(n){var t=Components.classes["@mozilla.org/widget/transferable;1"].createInstance(Components.interfaces.nsITransferable);if(t){t.addDataFlavor("text/unicode");var a=Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);a.data=e,t.setTransferData("text/unicode",a,2*e.length),n.setData(t,null,Components.interfaces.nsIClipboard.kGlobalClipboard)}}}},load:function(e){return(e=new mxXmlRequest(e,null,"GET",!1)).send(),e},get:function(e,n,t){return new mxXmlRequest(e,null,"GET").send(n,t)},post:function(e,n,t,a){return new mxXmlRequest(e,n).send(t,a)},submit:function(e,n,t,a){return new mxXmlRequest(e,n).simulate(t,a)},loadInto:function(e,n,t){mxClient.IS_IE?n.onreadystatechange=function(){4==n.readyState&&t()}:n.addEventListener("load",t,!1),n.load(e)},getValue:function(e,n,t){return null==(e=null!=e?e[n]:null)&&(e=t),e},getNumber:function(e,n,t){return null==(e=null!=e?e[n]:null)&&(e=t||0),Number(e)},getColor:function(e,n,t){return null==(e=null!=e?e[n]:null)?e=t:e==mxConstants.NONE&&(e=null),e},clone:function(e,n,t){t=null!=t&&t;var a=null;if(null!=e&&"function"==typeof e.constructor){var i;a=new e.constructor;for(i in e)i!=mxObjectIdentity.FIELD_NAME&&(null==n||mxUtils.indexOf(n,i)<0)&&(a[i]=t||"object"!=typeof e[i]?e[i]:mxUtils.clone(e[i]))}return a},equalPoints:function(e,n){if(null==e&&null!=n||null!=e&&null==n||null!=e&&null!=n&&e.length!=n.length)return!1;if(null!=e&&null!=n)for(var t=0;t<e.length;t++)if(e[t]==n[t]||null!=e[t]&&!e[t].equals(n[t]))return!1;return!0},equalEntries:function(e,n){if(null==e&&null!=n||null!=e&&null==n||null!=e&&null!=n&&e.length!=n.length)return!1;if(null!=e&&null!=n)for(var t in e)if(e[t]!=n[t])return!1;return!0},extend:function(e,n){var t=function(){};t.prototype=n.prototype,e.prototype=new t,e.prototype.constructor=e},toString:function(e){var n,t="";for(n in e)try{if(null==e[n])t+=n+" = [null]\n";else if("function"==typeof e[n])t+=n+" => [Function]\n";else if("object"==typeof e[n])t=t+(n+" => [")+mxUtils.getFunctionName(e[n].constructor)+"]\n";else t+=n+" = "+e[n]+"\n"}catch(e){t+=n+"="+e.message}return t},toRadians:function(e){return Math.PI*e/180},arcToCurves:function(e,n,t,a,i,s,o,r,l){if(r-=e,l-=n,0===t||0===a)return h;t=Math.abs(t),a=Math.abs(a);var d=-r/2,c=-l/2,m=Math.cos(i*Math.PI/180);i=m*d+(h=Math.sin(i*Math.PI/180))*c;d=-1*h*d+m*c;r=m*(c=(s=1<(v=(c=i*i)/(g=t*t)+(p=d*d)/(A=a*a))?(t*=Math.sqrt(v),a*=Math.sqrt(v),0):(v=1,s===o&&(v=-1),v*Math.sqrt((g*A-g*p-A*c)/(g*p+A*c))))*t*d/a)-h*(p=-1*s*a*i/t)+r/2,l=h*c+m*p+l/2,s=0<=(g=Math.atan2((d-p)/a,(i-c)/t)-Math.atan2(0,1))?g:2*Math.PI+g,i=0<=(g=Math.atan2((-d-p)/a,(-i-c)/t)-Math.atan2((d-p)/a,(i-c)/t))?g:2*Math.PI+g,0==o&&0<i?i-=2*Math.PI:0!=o&&i<0&&(i+=2*Math.PI),o=2*i/Math.PI,i/=o=Math.ceil(o<0?-1*o:o),d=8/3*Math.sin(i/4)*Math.sin(i/4)/Math.sin(i/2),c=m*t,m*=a,t*=h,a*=h;for(var u=Math.cos(s),p=-d*(c*(b=Math.sin(s))+a*u),g=-d*(t*b-m*u),v=A=0,h=[],f=0;f<o;++f){s+=i;var b,A=c*(u=Math.cos(s))-a*(b=Math.sin(s))+r,E=(v=t*u+m*b+l,-d*(c*b+a*u));u=-d*(t*b-m*u);h[b=6*f]=Number(p+e),h[b+1]=Number(g+n),h[b+2]=Number(A-E+e),h[b+3]=Number(v-u+n),h[b+4]=Number(A+e),h[b+5]=Number(v+n),p=A+E,g=v+u}return h},getBoundingBox:function(e,n){var t=null;if(null!=e&&null!=n&&0!=n){var a=mxUtils.toRadians(n),i=(t=Math.cos(a),Math.sin(a)),s=new mxPoint(e.x+e.width/2,e.y+e.height/2),o=new mxPoint(e.x,e.y),r=new mxPoint((a=new mxPoint(e.x+e.width,e.y)).x,e.y+e.height),l=new mxPoint(e.x,r.y);o=mxUtils.getRotatedPoint(o,t,i,s),a=mxUtils.getRotatedPoint(a,t,i,s),r=mxUtils.getRotatedPoint(r,t,i,s),l=mxUtils.getRotatedPoint(l,t,i,s);(t=new mxRectangle(o.x,o.y,0,0)).add(new mxRectangle(a.x,a.y,0,0)),t.add(new mxRectangle(r.x,r.y,0,0)),t.add(new mxRectangle(l.x,l.y,0,0))}return t},getRotatedPoint:function(e,n,t,a){a=null!=a?a:new mxPoint;var i=e.x-a.x;return new mxPoint(i*n-(e=e.y-a.y)*t+a.x,e*n+i*t+a.y)},getPortConstraints:function(e,n,t,a){return null==(e=mxUtils.getValue(e.style,mxConstants.STYLE_PORT_CONSTRAINT,null))?a:(a=e.toString(),e=mxConstants.DIRECTION_MASK_NONE,0<=a.indexOf(mxConstants.DIRECTION_NORTH)&&(e|=mxConstants.DIRECTION_MASK_NORTH),0<=a.indexOf(mxConstants.DIRECTION_WEST)&&(e|=mxConstants.DIRECTION_MASK_WEST),0<=a.indexOf(mxConstants.DIRECTION_SOUTH)&&(e|=mxConstants.DIRECTION_MASK_SOUTH),0<=a.indexOf(mxConstants.DIRECTION_EAST)&&(e|=mxConstants.DIRECTION_MASK_EAST),e)},reversePortConstraints:function(e){return(e&mxConstants.DIRECTION_MASK_WEST)<<3|(e&mxConstants.DIRECTION_MASK_NORTH)<<1|(e&mxConstants.DIRECTION_MASK_SOUTH)>>1|(e&mxConstants.DIRECTION_MASK_EAST)>>3},findNearestSegment:function(e,n,t){var a=-1;if(0<e.absolutePoints.length)for(var i=e.absolutePoints[0],s=null,o=1;o<e.absolutePoints.length;o++){var r=e.absolutePoints[o];i=mxUtils.ptSegDistSq(i.x,i.y,r.x,r.y,n,t);(null==s||i<s)&&(s=i,a=o-1),i=r}return a},rectangleIntersectsSegment:function(e,n,t){var a=e.y,i=e.x,s=a+e.height,o=i+e.width;e=n.x;var r=t.x;if(n.x>t.x&&(e=t.x,r=n.x),o<r&&(r=o),e<i&&(e=i),r<e)return!1;i=n.y,o=t.y;var l=t.x-n.x;return 1e-7<Math.abs(l)&&(i=(t=(t.y-n.y)/l)*e+(n=n.y-t*n.x),o=t*r+n),o<i&&(n=o,o=i,i=n),s<o&&(o=s),i<a&&(i=a),!(o<i)},contains:function(e,n,t){return e.x<=n&&e.x+e.width>=n&&e.y<=t&&e.y+e.height>=t},intersects:function(e,n){var t=e.width,a=e.height,i=n.width,s=n.height;if(i<=0||s<=0||t<=0||a<=0)return!1;var o=e.x,r=e.y,l=n.x,d=n.y;s+=d,t+=o,a+=r;return((i=i+l)<l||o<i)&&(s<d||r<s)&&(t<o||l<t)&&(a<r||d<a)},intersectsHotspot:function(e,n,t,a,i,s){if(i=null!=i?i:0,s=null!=s?s:0,0<(a=null!=a?a:1)){var o=e.getCenterX(),r=e.getCenterY(),l=e.width,d=e.height,c=mxUtils.getValue(e.style,mxConstants.STYLE_STARTSIZE)*e.view.scale;return 0<c&&(mxUtils.getValue(e.style,mxConstants.STYLE_HORIZONTAL,!0)?(r=e.y+c/2,d=c):(o=e.x+c/2,l=c)),l=Math.max(i,l*a),d=Math.max(i,d*a),0<s&&(l=Math.min(l,s),d=Math.min(d,s)),a=new mxRectangle(o-l/2,r-d/2,l,d),0!=(o=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))&&(i=Math.cos(-o),s=Math.sin(-o),o=new mxPoint(e.getCenterX(),e.getCenterY()),n=(e=mxUtils.getRotatedPoint(new mxPoint(n,t),i,s,o)).x,t=e.y),mxUtils.contains(a,n,t)}return!0},getOffset:function(e,n){var t=0,a=0;if(null!=n&&n){var i=document.body,s=document.documentElement;t=t+(i.scrollLeft||s.scrollLeft),a=a+(i.scrollTop||s.scrollTop)}for(;e.offsetParent;)t+=e.offsetLeft,a+=e.offsetTop,e=e.offsetParent;return new mxPoint(t,a)},getScrollOrigin:function(e){for(var n=document.body,t=document.documentElement,a=new mxPoint(n.scrollLeft||t.scrollLeft,n.scrollTop||t.scrollTop);null!=e&&e!=n&&e!=t;)!isNaN(e.scrollLeft)&&!isNaN(e.scrollTop)&&(a.x+=e.scrollLeft,a.y+=e.scrollTop),e=e.parentNode;return a},convertPoint:function(e,n,t){var a=mxUtils.getScrollOrigin(e);return(e=mxUtils.getOffset(e)).x-=a.x,e.y-=a.y,new mxPoint(n-e.x,t-e.y)},ltrim:function(e,n){return e.replace(RegExp("^["+(n||"\\s")+"]+","g"),"")},rtrim:function(e,n){return e.replace(RegExp("["+(n||"\\s")+"]+$","g"),"")},trim:function(e,n){return mxUtils.ltrim(mxUtils.rtrim(e,n),n)},isNumeric:function(e){return null!=e&&(null==e.length||0<e.length&&e.indexOf("0x")<0&&e.indexOf("0X")<0)&&!isNaN(e)},mod:function(e,n){return(e%n+n)%n},intersection:function(e,n,t,a,i,s,o,r){var l=(r-s)*(t-e)-(o-i)*(a-n);return o=((o-i)*(n-s)-(r-s)*(e-i))/l,i=((t-e)*(n-s)-(a-n)*(e-i))/l,0<=o&&o<=1&&0<=i&&i<=1?new mxPoint(e+o*(t-e),n+o*(a-n)):null},ptSegDistSq:function(e,n,t,a,i,s){return t=(i-=e)*(t-=e)+(s-=n)*(a-=n)<=0?0:(e=(i=t-i)*t+(s=a-s)*a)<=0?0:e*e/(t*t+a*a),(i=i*i+s*s-t)<0&&(i=0),i},relativeCcw:function(e,n,t,a,i,s){return 0==(e=(i-=e)*(a-=n)-(s-=n)*(t-=e))&&(0<(e=i*t+s*a)&&((e=(i-t)*t+(s-a)*a)<0&&(e=0))),e<0?-1:0<e?1:0},animateChanges:function(e,n){mxEffects.animateChanges.apply(this,arguments)},cascadeOpacity:function(e,n,t){mxEffects.cascadeOpacity.apply(this,arguments)},fadeOut:function(e,n,t,a,i,s){mxEffects.fadeOut.apply(this,arguments)},setOpacity:function(e,n){mxUtils.isVml(e)?e.style.filter=100<=n?null:"alpha(opacity="+n/5+")":mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?e.style.filter=100<=n?null:"alpha(opacity="+n+")":e.style.opacity=n/100},createImage:function(e){var n=null;return mxClient.IS_IE6&&"CSS1Compat"!=document.compatMode?((n=document.createElement(mxClient.VML_PREFIX+":image")).setAttribute("src",e),n.style.borderStyle="none"):((n=document.createElement("img")).setAttribute("src",e),n.setAttribute("border","0")),n},sortCells:function(e,i){i=null==i||i;var s=new mxDictionary;return e.sort(function(e,n){var t=s.get(e);null==t&&(t=mxCellPath.create(e).split(mxCellPath.PATH_SEPARATOR),s.put(e,t));var a=s.get(n);return null==a&&(a=mxCellPath.create(n).split(mxCellPath.PATH_SEPARATOR),s.put(n,a)),0==(t=mxCellPath.compare(t,a))?0:0<t==i?1:-1}),e},getStylename:function(e){return null!=e&&(e=e.split(";")[0]).indexOf("=")<0?e:""},getStylenames:function(e){var n=[];if(null!=e){e=e.split(";");for(var t=0;t<e.length;t++)e[t].indexOf("=")<0&&n.push(e[t])}return n},indexOfStylename:function(e,n){if(null!=e&&null!=n)for(var t=e.split(";"),a=0,i=0;i<t.length;i++){if(t[i]==n)return a;a+=t[i].length+1}return-1},addStylename:function(e,n){return mxUtils.indexOfStylename(e,n)<0&&(null==e?e="":0<e.length&&";"!=e.charAt(e.length-1)&&(e+=";"),e+=n),e},removeStylename:function(e,n){var t=[];if(null!=e)for(var a=e.split(";"),i=0;i<a.length;i++)a[i]!=n&&t.push(a[i]);return t.join(";")},removeAllStylenames:function(e){var n=[];if(null!=e){e=e.split(";");for(var t=0;t<e.length;t++)0<=e[t].indexOf("=")&&n.push(e[t])}return n.join(";")},setCellStyles:function(e,n,t,a){if(null!=n&&0<n.length){e.beginUpdate();try{for(var i=0;i<n.length;i++)if(null!=n[i]){var s=mxUtils.setStyle(e.getStyle(n[i]),t,a);e.setStyle(n[i],s)}}finally{e.endUpdate()}}},setStyle:function(e,n,t){var a=null!=t&&(void 0===t.length||0<t.length);if(null==e||0==e.length)a&&(e=n+"="+t);else{var i=e.indexOf(n+"=");i<0?a&&(a=";"==e.charAt(e.length-1)?"":";",e=e+a+n+"="+t):(n=a?n+"="+t:"",t=e.indexOf(";",i),a||t++,e=e.substring(0,i)+n+(i<t?e.substring(t):""))}return e},setCellStyleFlags:function(e,n,t,a,i){if(null!=n&&0<n.length){e.beginUpdate();try{for(var s=0;s<n.length;s++)if(null!=n[s]){var o=mxUtils.setStyleFlag(e.getStyle(n[s]),t,a,i);e.setStyle(n[s],o)}}finally{e.endUpdate()}}},setStyleFlag:function(e,n,t,a){if(null==e||0==e.length)e=a||null==a?n+"="+t:n+"=0";else{var i=e.indexOf(n+"=");if(i<0)i=";"==e.charAt(e.length-1)?"":";",e=a||null==a?e+i+n+"="+t:e+i+n+"=0";else{var s=e.indexOf(";",i),o="";o=s<0?e.substring(i+n.length+1):e.substring(i+n.length+1,s),o=null==a?parseInt(o)^t:a?parseInt(o)|t:parseInt(o)&~t;e=e.substring(0,i)+n+"="+o+(0<=s?e.substring(s):"")}}return e},getAlignmentAsPoint:function(e,n){var t=0,a=0;return e==mxConstants.ALIGN_CENTER?t=-.5:e==mxConstants.ALIGN_RIGHT&&(t=-1),n==mxConstants.ALIGN_MIDDLE?a=-.5:n==mxConstants.ALIGN_BOTTOM&&(a=-1),new mxPoint(t,a)},getSizeForString:function(e,n,t){n=null!=n?n:mxConstants.DEFAULT_FONTSIZE,t=null!=t?t:mxConstants.DEFAULT_FONTFAMILY;var a=document.createElement("div");return a.style.fontFamily=t,a.style.fontSize=Math.round(n)+"px",a.style.lineHeight=Math.round(n*mxConstants.LINE_HEIGHT)+"px",a.style.position="absolute",a.style.whiteSpace="nowrap",a.style.visibility="hidden",a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.innerHTML=e,document.body.appendChild(a),e=new mxRectangle(0,0,a.offsetWidth,a.offsetHeight),document.body.removeChild(a),e},getViewXml:function(e,n,t,a,i){a=null!=a?a:0,i=null!=i?i:0,n=null!=n?n:1,null==t&&(t=[e.getModel().getRoot()]);var s=e.getView(),o=null,r=s.isEventsEnabled();s.setEventsEnabled(!1);var l=s.drawPane,d=s.overlayPane;e.dialect==mxConstants.DIALECT_SVG?(s.drawPane=document.createElementNS(mxConstants.NS_SVG,"g"),s.canvas.appendChild(s.drawPane),s.overlayPane=document.createElementNS(mxConstants.NS_SVG,"g")):(s.drawPane=s.drawPane.cloneNode(!1),s.canvas.appendChild(s.drawPane),s.overlayPane=s.overlayPane.cloneNode(!1)),s.canvas.appendChild(s.overlayPane);var c=s.getTranslate();s.translate=new mxPoint(a,i),n=new mxTemporaryCellStates(e.getView(),n,t);try{o=(new mxCodec).encode(e.getView())}finally{n.destroy(),s.translate=c,s.canvas.removeChild(s.drawPane),s.canvas.removeChild(s.overlayPane),s.drawPane=l,s.overlayPane=d,s.setEventsEnabled(r)}return o},getScaleForPageCount:function(e,n,t,a){if(e<1)return 1;a=null!=a?a:0;var i=(t=null!=t?t:mxConstants.PAGE_FORMAT_A4_PORTRAIT).width-2*a;t=t.height-2*a,a=n.getGraphBounds().clone(),n=n.getView().getScale(),a.width/=n,a.height/=n,t=(n=a.width)/a.height/(i/t),a=Math.sqrt(e);var s=Math.sqrt(t);if(t=a*s,a/=s,t<1&&e<a){var o=a/e;a=e,t/=o}for(a<1&&e<t&&(o=t/e,t=e,a/=o),o=Math.ceil(t)*Math.ceil(a),s=0;e<o;){o=Math.floor(t)/t;var r=Math.floor(a)/a;if(1==o&&(o=Math.floor(t-1)/t),1==r&&(r=Math.floor(a-1)/a),t*=o=r<o?o:r,a*=o,o=Math.ceil(t)*Math.ceil(a),10<++s)break}return i*t/n*.99999},show:function(e,n,t,a){if(t=null!=t?t:0,a=null!=a?a:0,null==n?n=window.open().document:n.open(),t=-(i=e.getGraphBounds()).x+t,a=-i.y+a,mxClient.IS_IE){for(var i="<html><head>",s=document.getElementsByTagName("base"),o=0;o<s.length;o++)i+=s[o].outerHTML;for(i+="<style>",o=0;o<document.styleSheets.length;o++)try{i+=document.styleSheets(o).cssText}catch(e){}i+="</style></head>",i+="<body>",i+=e.container.innerHTML,i+="</body>",i+="<html>",n.writeln(i),n.close(),null!=(e=n.body.getElementsByTagName("DIV")[0])&&(e.style.position="absolute",e.style.left=t+"px",e.style.top=a+"px")}else{for(n.writeln("<html"),n.writeln("<head>"),s=document.getElementsByTagName("base"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("link"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(s=document.getElementsByTagName("style"),o=0;o<s.length;o++)n.writeln(mxUtils.getOuterHtml(s[o]));for(n.writeln("</head>"),n.writeln("</html>"),n.close(),null==n.body&&n.documentElement.appendChild(n.createElement("body")),n.body.style.overflow="auto",e=e.container.firstChild;null!=e;)o=e.cloneNode(!0),n.body.appendChild(o),e=e.nextSibling;null!=(e=n.getElementsByTagName("g")[0])&&(e.setAttribute("transform","translate("+t+","+a+")"),(t=e.ownerSVGElement).setAttribute("width",i.width+Math.max(i.x,0)+3),t.setAttribute("height",i.height+Math.max(i.y,0)+3))}return mxUtils.removeCursors(n.body),n},printScreen:function(e){var n=window.open();mxUtils.show(e,n.document),e=function(){n.focus(),n.print(),n.close()},mxClient.IS_GC?n.setTimeout(e,500):e()},popup:function(e,n){if(n){var t=document.createElement("div");t.style.overflow="scroll",t.style.width="636px",t.style.height="460px";var a=document.createElement("pre");a.innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),t.appendChild(a),(t=new mxWindow("Popup Window",t,document.body.clientWidth/2-320,(document.body.clientHeight||document.documentElement.clientHeight)/2-240,640,480,!1,!0)).setClosable(!0),t.setVisible(!0)}else mxClient.IS_NS?((t=window.open()).document.writeln("<pre>"+mxUtils.htmlEntities(e)+"</pre"),t.document.close()):((a=(t=window.open()).document.createElement("pre")).innerHTML=mxUtils.htmlEntities(e,!1).replace(/\n/g,"<br>").replace(/ /g,"&nbsp;"),t.document.body.appendChild(a))},alert:function(e){alert(e)},prompt:function(e,n){return prompt(e,n)},confirm:function(e){return confirm(e)},error:function(e,n,t,a){var i=document.createElement("div");i.style.padding="20px";var s=document.createElement("img");s.setAttribute("src",a||mxUtils.errorImage),s.setAttribute("valign","bottom"),s.style.verticalAlign="middle",i.appendChild(s),i.appendChild(document.createTextNode(" ")),i.appendChild(document.createTextNode(" ")),i.appendChild(document.createTextNode(" ")),mxUtils.write(i,e),e=document.body.clientWidth,a=document.body.clientHeight||document.documentElement.clientHeight;var o=new mxWindow(mxResources.get(mxUtils.errorResource)||mxUtils.errorResource,i,(e-n)/2,a/4,n,null,!1,!0);return t&&(mxUtils.br(i),n=document.createElement("p"),t=document.createElement("button"),mxClient.IS_IE?t.style.cssText="float:right":t.setAttribute("style","float:right"),mxEvent.addListener(t,"click",function(e){o.destroy()}),mxUtils.write(t,mxResources.get(mxUtils.closeResource)||mxUtils.closeResource),n.appendChild(t),i.appendChild(n),mxUtils.br(i),o.setClosable(!0)),o.setVisible(!0),o},makeDraggable:function(e,n,t,i,a,s,o,r,l,d){return(e=new mxDragSource(e,t)).dragOffset=new mxPoint(null!=a?a:0,null!=s?s:mxConstants.TOOLTIP_VERTICAL_OFFSET),e.autoscroll=o,e.setGuidesEnabled(!1),null!=l&&(e.highlightDropTargets=l),null!=d&&(e.getDropTarget=d),e.getGraphForEvent=function(e){return"function"==typeof n?n(e):n},null!=i&&(e.createDragElement=function(){return i.cloneNode(!0)},r&&(e.createPreviewElement=function(e){var n=i.cloneNode(!0),t=parseInt(n.style.width),a=parseInt(n.style.height);return n.style.width=Math.round(t*e.view.scale)+"px",n.style.height=Math.round(a*e.view.scale)+"px",n})),e}},mxConstants={DEFAULT_HOTSPOT:.3,MIN_HOTSPOT_SIZE:8,MAX_HOTSPOT_SIZE:0,RENDERING_HINT_EXACT:"exact",RENDERING_HINT_FASTER:"faster",RENDERING_HINT_FASTEST:"fastest",DIALECT_SVG:"svg",DIALECT_VML:"vml",DIALECT_MIXEDHTML:"mixedHtml",DIALECT_PREFERHTML:"preferHtml",DIALECT_STRICTHTML:"strictHtml",NS_SVG:"http://www.w3.org/2000/svg",NS_XHTML:"http://www.w3.org/1999/xhtml",NS_XLINK:"http://www.w3.org/1999/xlink",SHADOWCOLOR:"gray",SHADOW_OFFSET_X:2,SHADOW_OFFSET_Y:3,SHADOW_OPACITY:1,NODETYPE_ELEMENT:1,NODETYPE_ATTRIBUTE:2,NODETYPE_TEXT:3,NODETYPE_CDATA:4,NODETYPE_ENTITY_REFERENCE:5,NODETYPE_ENTITY:6,NODETYPE_PROCESSING_INSTRUCTION:7,NODETYPE_COMMENT:8,NODETYPE_DOCUMENT:9,NODETYPE_DOCUMENTTYPE:10,NODETYPE_DOCUMENT_FRAGMENT:11,NODETYPE_NOTATION:12,TOOLTIP_VERTICAL_OFFSET:16,DEFAULT_VALID_COLOR:"#00FF00",DEFAULT_INVALID_COLOR:"#FF0000",HIGHLIGHT_STROKEWIDTH:3,CURSOR_MOVABLE_VERTEX:"move",CURSOR_MOVABLE_EDGE:"move",CURSOR_LABEL_HANDLE:"default",CURSOR_BEND_HANDLE:"pointer",CURSOR_CONNECT:"pointer",HIGHLIGHT_COLOR:"#00FF00",CONNECT_TARGET_COLOR:"#0000FF",INVALID_CONNECT_TARGET_COLOR:"#FF0000",DROP_TARGET_COLOR:"#0000FF",VALID_COLOR:"#00FF00",INVALID_COLOR:"#FF0000",EDGE_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_COLOR:"#00FF00",VERTEX_SELECTION_STROKEWIDTH:1,EDGE_SELECTION_STROKEWIDTH:1,VERTEX_SELECTION_DASHED:!0,EDGE_SELECTION_DASHED:!0,GUIDE_COLOR:"#FF0000",GUIDE_STROKEWIDTH:1,OUTLINE_COLOR:"#0099FF",OUTLINE_STROKEWIDTH:mxClient.IS_IE?2:3,HANDLE_SIZE:7,LABEL_HANDLE_SIZE:4,HANDLE_FILLCOLOR:"#00FF00",HANDLE_STROKECOLOR:"black",LABEL_HANDLE_FILLCOLOR:"yellow",CONNECT_HANDLE_FILLCOLOR:"#0000FF",LOCKED_HANDLE_FILLCOLOR:"#FF0000",OUTLINE_HANDLE_FILLCOLOR:"#00FFFF",OUTLINE_HANDLE_STROKECOLOR:"#0033FF",DEFAULT_FONTFAMILY:"Arial,Helvetica",DEFAULT_FONTSIZE:11,LINE_HEIGHT:1.2,DEFAULT_FONTSTYLE:0,DEFAULT_STARTSIZE:40,DEFAULT_MARKERSIZE:6,DEFAULT_IMAGESIZE:24,ENTITY_SEGMENT:30,RECTANGLE_ROUNDING_FACTOR:.15,LINE_ARCSIZE:20,ARROW_SPACING:10,ARROW_WIDTH:30,ARROW_SIZE:30,PAGE_FORMAT_A4_PORTRAIT:new mxRectangle(0,0,826,1169),PAGE_FORMAT_A4_LANDSCAPE:new mxRectangle(0,0,1169,826),PAGE_FORMAT_LETTER_PORTRAIT:new mxRectangle(0,0,850,1100),PAGE_FORMAT_LETTER_LANDSCAPE:new mxRectangle(0,0,1100,850),NONE:"none",STYLE_PERIMETER:"perimeter",STYLE_SOURCE_PORT:"sourcePort",STYLE_TARGET_PORT:"targetPort",STYLE_PORT_CONSTRAINT:"portConstraint",STYLE_OPACITY:"opacity",STYLE_TEXT_OPACITY:"textOpacity",STYLE_OVERFLOW:"overflow",STYLE_ORTHOGONAL:"orthogonal",STYLE_EXIT_X:"exitX",STYLE_EXIT_Y:"exitY",STYLE_EXIT_PERIMETER:"exitPerimeter",STYLE_ENTRY_X:"entryX",STYLE_ENTRY_Y:"entryY",STYLE_ENTRY_PERIMETER:"entryPerimeter",STYLE_WHITE_SPACE:"whiteSpace",STYLE_ROTATION:"rotation",STYLE_FILLCOLOR:"fillColor",STYLE_SWIMLANE_FILLCOLOR:"swimlaneFillColor",STYLE_GRADIENTCOLOR:"gradientColor",STYLE_GRADIENT_DIRECTION:"gradientDirection",STYLE_STROKECOLOR:"strokeColor",STYLE_SEPARATORCOLOR:"separatorColor",STYLE_STROKEWIDTH:"strokeWidth",STYLE_ALIGN:"align",STYLE_VERTICAL_ALIGN:"verticalAlign",STYLE_LABEL_POSITION:"labelPosition",STYLE_VERTICAL_LABEL_POSITION:"verticalLabelPosition",STYLE_IMAGE_ASPECT:"imageAspect",STYLE_IMAGE_ALIGN:"imageAlign",STYLE_IMAGE_VERTICAL_ALIGN:"imageVerticalAlign",STYLE_GLASS:"glass",STYLE_IMAGE:"image",STYLE_IMAGE_WIDTH:"imageWidth",STYLE_IMAGE_HEIGHT:"imageHeight",STYLE_IMAGE_BACKGROUND:"imageBackground",STYLE_IMAGE_BORDER:"imageBorder",STYLE_FLIPH:"flipH",STYLE_FLIPV:"flipV",STYLE_NOLABEL:"noLabel",STYLE_NOEDGESTYLE:"noEdgeStyle",STYLE_LABEL_BACKGROUNDCOLOR:"labelBackgroundColor",STYLE_LABEL_BORDERCOLOR:"labelBorderColor",STYLE_LABEL_PADDING:"labelPadding",STYLE_INDICATOR_SHAPE:"indicatorShape",STYLE_INDICATOR_IMAGE:"indicatorImage",STYLE_INDICATOR_COLOR:"indicatorColor",STYLE_INDICATOR_STROKECOLOR:"indicatorStrokeColor",STYLE_INDICATOR_GRADIENTCOLOR:"indicatorGradientColor",STYLE_INDICATOR_SPACING:"indicatorSpacing",STYLE_INDICATOR_WIDTH:"indicatorWidth",STYLE_INDICATOR_HEIGHT:"indicatorHeight",STYLE_INDICATOR_DIRECTION:"indicatorDirection",STYLE_SHADOW:"shadow",STYLE_SEGMENT:"segment",STYLE_ENDARROW:"endArrow",STYLE_STARTARROW:"startArrow",STYLE_ENDSIZE:"endSize",STYLE_STARTSIZE:"startSize",STYLE_SWIMLANE_LINE:"swimlaneLine",STYLE_ENDFILL:"endFill",STYLE_STARTFILL:"startFill",STYLE_DASHED:"dashed",STYLE_DASH_PATTERN:"dashPattern",STYLE_ROUNDED:"rounded",STYLE_CURVED:"curved",STYLE_ARCSIZE:"arcSize",STYLE_SMOOTH:"smooth",STYLE_SOURCE_PERIMETER_SPACING:"sourcePerimeterSpacing",STYLE_TARGET_PERIMETER_SPACING:"targetPerimeterSpacing",STYLE_PERIMETER_SPACING:"perimeterSpacing",STYLE_SPACING:"spacing",STYLE_SPACING_TOP:"spacingTop",STYLE_SPACING_LEFT:"spacingLeft",STYLE_SPACING_BOTTOM:"spacingBottom",STYLE_SPACING_RIGHT:"spacingRight",STYLE_HORIZONTAL:"horizontal",STYLE_DIRECTION:"direction",STYLE_ELBOW:"elbow",STYLE_FONTCOLOR:"fontColor",STYLE_FONTFAMILY:"fontFamily",STYLE_FONTSIZE:"fontSize",STYLE_FONTSTYLE:"fontStyle",STYLE_AUTOSIZE:"autosize",STYLE_FOLDABLE:"foldable",STYLE_EDITABLE:"editable",STYLE_BENDABLE:"bendable",STYLE_MOVABLE:"movable",STYLE_RESIZABLE:"resizable",STYLE_CLONEABLE:"cloneable",STYLE_DELETABLE:"deletable",STYLE_SHAPE:"shape",STYLE_EDGE:"edgeStyle",STYLE_LOOP:"loopStyle",STYLE_ROUTING_CENTER_X:"routingCenterX",STYLE_ROUTING_CENTER_Y:"routingCenterY",FONT_BOLD:1,FONT_ITALIC:2,FONT_UNDERLINE:4,FONT_SHADOW:8,SHAPE_RECTANGLE:"rectangle",SHAPE_ELLIPSE:"ellipse",SHAPE_DOUBLE_ELLIPSE:"doubleEllipse",SHAPE_RHOMBUS:"rhombus",SHAPE_LINE:"line",SHAPE_IMAGE:"image",SHAPE_ARROW:"arrow",SHAPE_LABEL:"label",SHAPE_CYLINDER:"cylinder",SHAPE_SWIMLANE:"swimlane",SHAPE_CONNECTOR:"connector",SHAPE_ACTOR:"actor",SHAPE_CLOUD:"cloud",SHAPE_TRIANGLE:"triangle",SHAPE_HEXAGON:"hexagon",ARROW_CLASSIC:"classic",ARROW_BLOCK:"block",ARROW_OPEN:"open",ARROW_OVAL:"oval",ARROW_DIAMOND:"diamond",ARROW_DIAMOND_THIN:"diamondThin",ALIGN_LEFT:"left",ALIGN_CENTER:"center",ALIGN_RIGHT:"right",ALIGN_TOP:"top",ALIGN_MIDDLE:"middle",ALIGN_BOTTOM:"bottom",DIRECTION_NORTH:"north",DIRECTION_SOUTH:"south",DIRECTION_EAST:"east",DIRECTION_WEST:"west",DIRECTION_MASK_NONE:0,DIRECTION_MASK_WEST:1,DIRECTION_MASK_NORTH:2,DIRECTION_MASK_SOUTH:4,DIRECTION_MASK_EAST:8,DIRECTION_MASK_ALL:15,ELBOW_VERTICAL:"vertical",ELBOW_HORIZONTAL:"horizontal",EDGESTYLE_ELBOW:"elbowEdgeStyle",EDGESTYLE_ENTITY_RELATION:"entityRelationEdgeStyle",EDGESTYLE_LOOP:"loopEdgeStyle",EDGESTYLE_SIDETOSIDE:"sideToSideEdgeStyle",EDGESTYLE_TOPTOBOTTOM:"topToBottomEdgeStyle",EDGESTYLE_ORTHOGONAL:"orthogonalEdgeStyle",EDGESTYLE_SEGMENT:"segmentEdgeStyle",PERIMETER_ELLIPSE:"ellipsePerimeter",PERIMETER_RECTANGLE:"rectanglePerimeter",PERIMETER_RHOMBUS:"rhombusPerimeter",PERIMETER_TRIANGLE:"trianglePerimeter"};function mxEventObject(e){this.name=e,this.properties=[];for(var n=1;n<arguments.length;n+=2)null!=arguments[n+1]&&(this.properties[arguments[n]]=arguments[n+1])}function mxMouseEvent(e,n){this.evt=e,this.state=n}function mxEventSource(e){this.setEventSource(e)}mxEventObject.prototype.name=null,mxEventObject.prototype.properties=null,mxEventObject.prototype.consumed=!1,mxEventObject.prototype.getName=function(){return this.name},mxEventObject.prototype.getProperties=function(){return this.properties},mxEventObject.prototype.getProperty=function(e){return this.properties[e]},mxEventObject.prototype.isConsumed=function(){return this.consumed},mxEventObject.prototype.consume=function(){this.consumed=!0},mxMouseEvent.prototype.consumed=!1,mxMouseEvent.prototype.evt=null,mxMouseEvent.prototype.graphX=null,mxMouseEvent.prototype.graphY=null,mxMouseEvent.prototype.state=null,mxMouseEvent.prototype.getEvent=function(){return this.evt},mxMouseEvent.prototype.getSource=function(){return mxEvent.getSource(this.evt)},mxMouseEvent.prototype.isSource=function(e){if(null!=e)for(var n=this.getSource();null!=n;){if(n==e.node)return!0;n=n.parentNode}return!1},mxMouseEvent.prototype.getX=function(){return mxEvent.getClientX(this.getEvent())},mxMouseEvent.prototype.getY=function(){return mxEvent.getClientY(this.getEvent())},mxMouseEvent.prototype.getGraphX=function(){return this.graphX},mxMouseEvent.prototype.getGraphY=function(){return this.graphY},mxMouseEvent.prototype.getState=function(){return this.state},mxMouseEvent.prototype.getCell=function(){var e=this.getState();return null!=e?e.cell:null},mxMouseEvent.prototype.isPopupTrigger=function(){return mxEvent.isPopupTrigger(this.getEvent())},mxMouseEvent.prototype.isConsumed=function(){return this.consumed},mxMouseEvent.prototype.consume=function(e){(null==e||e)&&this.evt.preventDefault&&this.evt.preventDefault(),this.evt.returnValue=!1,this.consumed=!0},mxEventSource.prototype.eventListeners=null,mxEventSource.prototype.eventsEnabled=!0,mxEventSource.prototype.eventSource=null,mxEventSource.prototype.isEventsEnabled=function(){return this.eventsEnabled},mxEventSource.prototype.setEventsEnabled=function(e){this.eventsEnabled=e},mxEventSource.prototype.getEventSource=function(){return this.eventSource},mxEventSource.prototype.setEventSource=function(e){this.eventSource=e},mxEventSource.prototype.addListener=function(e,n){null==this.eventListeners&&(this.eventListeners=[]),this.eventListeners.push(e),this.eventListeners.push(n)},mxEventSource.prototype.removeListener=function(e){if(null!=this.eventListeners)for(var n=0;n<this.eventListeners.length;)this.eventListeners[n+1]==e?this.eventListeners.splice(n,2):n+=2},mxEventSource.prototype.fireEvent=function(e,n){if(null!=this.eventListeners&&this.isEventsEnabled()){null==e&&(e=new mxEventObject),null==n&&(n=this.getEventSource()),null==n&&(n=this);for(var t=[n,e],a=0;a<this.eventListeners.length;a+=2){var i=this.eventListeners[a];(null==i||i==e.getName())&&this.eventListeners[a+1].apply(this,t)}}};var mxEvent={objects:[],addListener:function(){var a=function(e,n,t){null==e.mxListenerList&&(e.mxListenerList=[],mxEvent.objects.push(e)),e.mxListenerList.push({name:n,f:t})};return window.addEventListener?function(e,n,t){e.addEventListener(n,t,!1),a(e,n,t)}:function(e,n,t){e.attachEvent("on"+n,t),a(e,n,t)}}(),removeListener:function(){var a=function(e,n,t){if(null!=e.mxListenerList){n=e.mxListenerList.length;for(var a=0;a<n;a++)if(e.mxListenerList[a].f==t){e.mxListenerList.splice(a,1);break}0==e.mxListenerList.length&&(e.mxListenerList=null)}};return window.removeEventListener?function(e,n,t){e.removeEventListener(n,t,!1),a(e,n,t)}:function(e,n,t){e.detachEvent("on"+n,t),a(e,n,t)}}(),removeAllListeners:function(e){var n=e.mxListenerList;if(null!=n)for(;0<n.length;){var t=n[0];mxEvent.removeListener(e,t.name,t.f)}},addGestureListeners:function(e,n,t,a){null!=n&&mxEvent.addListener(e,"mousedown",n),null!=t&&mxEvent.addListener(e,"mousemove",t),null!=a&&mxEvent.addListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=n&&mxEvent.addListener(e,"touchstart",n),null!=t&&mxEvent.addListener(e,"touchmove",t),null!=a&&mxEvent.addListener(e,"touchend",a))},removeGestureListeners:function(e,n,t,a){null!=n&&mxEvent.removeListener(e,"mousedown",n),null!=t&&mxEvent.removeListener(e,"mousemove",t),null!=a&&mxEvent.removeListener(e,"mouseup",a),mxClient.IS_TOUCH&&(null!=n&&mxEvent.removeListener(e,"touchstart",n),null!=t&&mxEvent.removeListener(e,"touchmove",t),null!=a&&mxEvent.removeListener(e,"touchend",a))},redirectMouseEvents:function(e,t,n,a,i,s,o){var r=function(e){return"function"==typeof n?n(e):n};mxEvent.addGestureListeners(e,function(e){null!=a?a(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,r(e)))},function(e){null!=i?i(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,r(e)))},function(e){null!=s?s(e):mxEvent.isConsumed(e)||t.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,r(e)))}),mxEvent.addListener(e,"dblclick",function(e){if(null!=o)o(e);else if(!mxEvent.isConsumed(e)){var n=r(e);t.dblClick(e,null!=n?n.cell:null)}})},release:function(e){if(null!=e&&(mxEvent.removeAllListeners(e),null!=(e=e.childNodes)))for(var n=e.length,t=0;t<n;t+=1)mxEvent.release(e[t])},addMouseWheelListener:function(t){if(null!=t){var e=function(e){null==e&&(e=window.event);var n=0;0!=(n=!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC?e.wheelDelta/120:-e.detail/2)&&t(e,0<n)};mxClient.IS_NS?mxEvent.addListener(window,mxClient.IS_SF||mxClient.IS_GC?"mousewheel":"DOMMouseScroll",e):mxEvent.addListener(document,"mousewheel",e)}},disableContextMenu:mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?function(e){mxEvent.addListener(e,"contextmenu",function(){return!1})}:function(e){e.setAttribute("oncontextmenu","return false;")},getSource:function(e){return null!=e.srcElement?e.srcElement:e.target},isConsumed:function(e){return null!=e.isConsumed&&e.isConsumed},isLeftMouseButton:function(e){return e.button==(mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?1:0)},isRightMouseButton:function(e){return 2==e.button},isPopupTrigger:function(e){return mxEvent.isRightMouseButton(e)||mxEvent.isShiftDown(e)&&!mxEvent.isControlDown(e)},isShiftDown:function(e){return null!=e&&e.shiftKey},isAltDown:function(e){return null!=e&&e.altKey},isControlDown:function(e){return null!=e&&e.ctrlKey},isMetaDown:function(e){return null!=e&&e.metaKey},getMainEvent:function(e){return"touchstart"!=e.type&&"touchmove"!=e.type||null==e.touches||null==e.touches[0]?"touchend"==e.type&&null!=e.changedTouches&&null!=e.changedTouches[0]&&(e=e.changedTouches[0]):e=e.touches[0],e},getClientX:function(e){return mxEvent.getMainEvent(e).clientX},getClientY:function(e){return mxEvent.getMainEvent(e).clientY},consume:function(e,n,t){t=null==t||t,(null==n||n)&&(e.preventDefault?(t&&e.stopPropagation(),e.preventDefault()):t&&(e.cancelBubble=!0)),e.isConsumed=!0,e.returnValue=!1},LABEL_HANDLE:-1,ROTATION_HANDLE:-2,MOUSE_DOWN:"mouseDown",MOUSE_MOVE:"mouseMove",MOUSE_UP:"mouseUp",ACTIVATE:"activate",RESIZE_START:"resizeStart",RESIZE:"resize",RESIZE_END:"resizeEnd",MOVE_START:"moveStart",MOVE:"move",MOVE_END:"moveEnd",PAN_START:"panStart",PAN:"pan",PAN_END:"panEnd",MINIMIZE:"minimize",NORMALIZE:"normalize",MAXIMIZE:"maximize",HIDE:"hide",SHOW:"show",CLOSE:"close",DESTROY:"destroy",REFRESH:"refresh",SIZE:"size",SELECT:"select",FIRED:"fired",GET:"get",RECEIVE:"receive",CONNECT:"connect",DISCONNECT:"disconnect",SUSPEND:"suspend",RESUME:"resume",MARK:"mark",SESSION:"session",ROOT:"root",POST:"post",OPEN:"open",SAVE:"save",BEFORE_ADD_VERTEX:"beforeAddVertex",ADD_VERTEX:"addVertex",AFTER_ADD_VERTEX:"afterAddVertex",DONE:"done",EXECUTE:"execute",EXECUTED:"executed",BEGIN_UPDATE:"beginUpdate",START_EDIT:"startEdit",END_UPDATE:"endUpdate",END_EDIT:"endEdit",BEFORE_UNDO:"beforeUndo",UNDO:"undo",REDO:"redo",CHANGE:"change",NOTIFY:"notify",LAYOUT_CELLS:"layoutCells",CLICK:"click",SCALE:"scale",TRANSLATE:"translate",SCALE_AND_TRANSLATE:"scaleAndTranslate",UP:"up",DOWN:"down",ADD:"add",REMOVE:"remove",CLEAR:"clear",ADD_CELLS:"addCells",CELLS_ADDED:"cellsAdded",MOVE_CELLS:"moveCells",CELLS_MOVED:"cellsMoved",RESIZE_CELLS:"resizeCells",CELLS_RESIZED:"cellsResized",TOGGLE_CELLS:"toggleCells",CELLS_TOGGLED:"cellsToggled",ORDER_CELLS:"orderCells",CELLS_ORDERED:"cellsOrdered",REMOVE_CELLS:"removeCells",CELLS_REMOVED:"cellsRemoved",GROUP_CELLS:"groupCells",UNGROUP_CELLS:"ungroupCells",REMOVE_CELLS_FROM_PARENT:"removeCellsFromParent",FOLD_CELLS:"foldCells",CELLS_FOLDED:"cellsFolded",ALIGN_CELLS:"alignCells",LABEL_CHANGED:"labelChanged",CONNECT_CELL:"connectCell",CELL_CONNECTED:"cellConnected",SPLIT_EDGE:"splitEdge",FLIP_EDGE:"flipEdge",START_EDITING:"startEditing",ADD_OVERLAY:"addOverlay",REMOVE_OVERLAY:"removeOverlay",UPDATE_CELL_SIZE:"updateCellSize",ESCAPE:"escape",CLICK:"click",DOUBLE_CLICK:"doubleClick",START:"start",RESET:"reset"};function mxXmlRequest(e,n,t,a,i,s){this.url=e,this.params=n,this.method=t||"POST",this.async=null==a||a,this.username=i,this.password=s}mxXmlRequest.prototype.url=null,mxXmlRequest.prototype.params=null,mxXmlRequest.prototype.method=null,mxXmlRequest.prototype.async=null,mxXmlRequest.prototype.binary=!1,mxXmlRequest.prototype.username=null,mxXmlRequest.prototype.password=null,mxXmlRequest.prototype.request=null,mxXmlRequest.prototype.isBinary=function(){return this.binary},mxXmlRequest.prototype.setBinary=function(e){this.binary=e},mxXmlRequest.prototype.getText=function(){return this.request.responseText},mxXmlRequest.prototype.isReady=function(){return 4==this.request.readyState},mxXmlRequest.prototype.getDocumentElement=function(){var e=this.getXml();return null!=e?e.documentElement:null},mxXmlRequest.prototype.getXml=function(){var e=this.request.responseXML;return(9<=document.documentMode||null==e||null==e.documentElement)&&(e=mxUtils.parseXml(this.request.responseText)),e},mxXmlRequest.prototype.getText=function(){return this.request.responseText},mxXmlRequest.prototype.getStatus=function(){return this.request.status},mxXmlRequest.prototype.create=window.XMLHttpRequest?function(){var e=new XMLHttpRequest;return this.isBinary()&&e.overrideMimeType&&e.overrideMimeType("text/plain; charset=x-user-defined"),e}:"undefined"!=typeof ActiveXObject?function(){return new ActiveXObject("Microsoft.XMLHTTP")}:void 0,mxXmlRequest.prototype.send=function(e,n){this.request=this.create(),null!=this.request&&(null!=e&&(this.request.onreadystatechange=mxUtils.bind(this,function(){this.isReady()&&(e(this),this.onreadystatechaange=null)})),this.request.open(this.method,this.url,this.async,this.username,this.password),this.setRequestHeaders(this.request,this.params),this.request.send(this.params))},mxXmlRequest.prototype.setRequestHeaders=function(e,n){null!=n&&e.setRequestHeader("Content-Type","application/x-www-form-urlencoded")},mxXmlRequest.prototype.simulate=function(e,n){var t=null;(e=e||document)==document&&(t=window.onbeforeunload,window.onbeforeunload=null);var a=e.createElement("form");a.setAttribute("method",this.method),a.setAttribute("action",this.url),null!=n&&a.setAttribute("target",n),a.style.display="none",a.style.visibility="hidden";for(var i=0<this.params.indexOf("&")?this.params.split("&"):this.params.split(),s=0;s<i.length;s++){if(0<(o=i[s].indexOf("="))){var o,r=i[s].substring(0,o),l=i[s].substring(o+1);(o=e.createElement("textarea")).setAttribute("name",r),l=l.replace(/\n/g,"&#xa;"),r=e.createTextNode(l),o.appendChild(r),a.appendChild(o)}}e.body.appendChild(a),a.submit(),e.body.removeChild(a),null!=t&&(window.onbeforeunload=t)};var mxClipboard={STEPSIZE:10,insertCount:1,cells:null,isEmpty:function(){return null==mxClipboard.cells},cut:function(e,n){return n=mxClipboard.copy(e,n),mxClipboard.insertCount=0,mxClipboard.removeCells(e,n),n},removeCells:function(e,n){e.removeCells(n)},copy:function(e,n){n=n||e.getSelectionCells();var t=e.getExportableCells(n);return mxClipboard.insertCount=1,mxClipboard.cells=e.cloneCells(t),t},paste:function(e){if(null!=mxClipboard.cells){var n=e.getImportableCells(mxClipboard.cells),t=mxClipboard.insertCount*mxClipboard.STEPSIZE,a=e.getDefaultParent();n=e.importCells(n,t,t,a);mxClipboard.insertCount++,e.setSelectionCells(n)}}};function mxWindow(e,n,t,a,i,s,o,r,l,d){null!=n&&(o=null==o||o,this.content=n,this.init(t,a,i,s,d),this.installMaximizeHandler(),this.installMinimizeHandler(),this.installCloseHandler(),this.setMinimizable(o),this.setTitle(e),(null==r||r)&&this.installMoveHandler(),null!=l&&null!=l.parentNode?l.parentNode.replaceChild(this.div,l):document.body.appendChild(this.div))}function mxForm(e){this.table=document.createElement("table"),this.table.className=e,this.body=document.createElement("tbody"),this.table.appendChild(this.body)}function mxImage(e,n,t){this.src=e,this.width=n,this.height=t}function mxDivResizer(e,n){if("div"==e.nodeName.toLowerCase()){null==n&&(n=window),this.div=e;var t=mxUtils.getCurrentStyle(e);null!=t&&(this.resizeWidth="auto"==t.width,this.resizeHeight="auto"==t.height),mxEvent.addListener(n,"resize",mxUtils.bind(this,function(e){this.handlingResize||(this.handlingResize=!0,this.resize(),this.handlingResize=!1)})),this.resize()}}function mxDragSource(e,n){this.element=e,this.dropHandler=n,mxEvent.addGestureListeners(e,mxUtils.bind(this,this.mouseDown))}function mxToolbar(e){this.container=e}function mxSession(n,e,t,a){this.model=n,this.urlInit=e,this.urlPoll=t,this.urlNotify=a,null!=n&&(this.codec=new mxCodec,this.codec.lookup=function(e){return n.getCell(e)}),n.addListener(mxEvent.NOTIFY,mxUtils.bind(this,function(e,n){var t=n.getProperty("edit");(null!=t&&this.debug||this.connected&&!this.suspended)&&this.notify("<edit>"+this.encodeChanges(t.changes,t.undone)+"</edit>")}))}function mxUndoableEdit(e,n){this.source=e,this.changes=[],this.significant=null==n||n}function mxUndoManager(e){this.size=null!=e?e:100,this.clear()}mxWindow.prototype=new mxEventSource,mxWindow.prototype.constructor=mxWindow,mxWindow.prototype.closeImage=mxClient.imageBasePath+"/close.gif",mxWindow.prototype.minimizeImage=mxClient.imageBasePath+"/minimize.gif",mxWindow.prototype.normalizeImage=mxClient.imageBasePath+"/normalize.gif",mxWindow.prototype.maximizeImage=mxClient.imageBasePath+"/maximize.gif",mxWindow.prototype.resizeImage=mxClient.imageBasePath+"/resize.gif",mxWindow.prototype.visible=!1,mxWindow.prototype.content=!1,mxWindow.prototype.minimumSize=new mxRectangle(0,0,50,40),mxWindow.prototype.title=!1,mxWindow.prototype.content=!1,mxWindow.prototype.destroyOnClose=!0,mxWindow.prototype.init=function(e,n,t,a,i){i=null!=i?i:"mxWindow",this.div=document.createElement("div"),this.div.className=i,this.div.style.left=e+"px",this.div.style.top=n+"px",this.table=document.createElement("table"),this.table.className=i,null!=t&&(mxClient.IS_IE||(this.div.style.width=t+"px"),this.table.style.width=t+"px"),null!=a&&(mxClient.IS_IE||(this.div.style.height=a+"px"),this.table.style.height=a+"px"),e=document.createElement("tbody"),n=document.createElement("tr"),this.title=document.createElement("td"),this.title.className=i+"Title",n.appendChild(this.title),e.appendChild(n),n=document.createElement("tr"),this.td=document.createElement("td"),this.td.className=i+"Pane",this.contentWrapper=document.createElement("div"),this.contentWrapper.className=i+"Pane",this.contentWrapper.style.width="100%",this.contentWrapper.appendChild(this.content),(mxClient.IS_IE||"DIV"!=this.content.nodeName.toUpperCase())&&(this.contentWrapper.style.height="100%"),this.td.appendChild(this.contentWrapper),n.appendChild(this.td),e.appendChild(n),this.table.appendChild(e),this.div.appendChild(this.table),i=mxUtils.bind(this,function(e){this.activate()}),mxEvent.addListener(this.title,"mousedown",i),mxEvent.addListener(this.table,"mousedown",i),mxClient.IS_TOUCH&&(mxEvent.addListener(this.title,"touchstart",i),mxEvent.addListener(this.table,"touchstart",i)),this.hide()},mxWindow.prototype.setTitle=function(e){for(var n=this.title.firstChild;null!=n;){var t=n.nextSibling;n.nodeType==mxConstants.NODETYPE_TEXT&&n.parentNode.removeChild(n),n=t}mxUtils.write(this.title,e||"")},mxWindow.prototype.setScrollable=function(e){navigator.userAgent.indexOf("Presto/2.5")<0&&(this.contentWrapper.style.overflow=e?"auto":"hidden")},mxWindow.prototype.activate=function(){if(mxWindow.activeWindow!=this){var e=null!=(e=mxUtils.getCurrentStyle(this.getElement()))?e.zIndex:3;if(mxWindow.activeWindow){var n=mxWindow.activeWindow.getElement();null!=n&&null!=n.style&&(n.style.zIndex=e)}n=mxWindow.activeWindow,this.getElement().style.zIndex=parseInt(e)+1,(mxWindow.activeWindow=this).fireEvent(new mxEventObject(mxEvent.ACTIVATE,"previousWindow",n))}},mxWindow.prototype.getElement=function(){return this.div},mxWindow.prototype.fit=function(){mxUtils.fit(this.div)},mxWindow.prototype.isResizable=function(){return null!=this.resize&&"none"!=this.resize.style.display},mxWindow.prototype.setResizable=function(e){e?null==this.resize?(this.resize=document.createElement("img"),this.resize.style.position="absolute",this.resize.style.bottom="2px",this.resize.style.right="2px",this.resize.setAttribute("src",mxClient.imageBasePath+"/resize.gif"),this.resize.style.cursor="nw-resize",mxEvent.addGestureListeners(this.resize,mxUtils.bind(this,function(e){this.activate();var a=mxEvent.getClientX(e),i=mxEvent.getClientY(e),s=this.div.offsetWidth,o=this.div.offsetHeight,n=mxUtils.bind(this,function(e){var n=mxEvent.getClientX(e)-a,t=mxEvent.getClientY(e)-i;this.setSize(s+n,o+t),this.fireEvent(new mxEventObject(mxEvent.RESIZE,"event",e)),mxEvent.consume(e)}),t=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.RESIZE_START,"event",e)),mxEvent.consume(e)}),null,null),this.div.appendChild(this.resize)):this.resize.style.display="inline":null!=this.resize&&(this.resize.style.display="none")},mxWindow.prototype.setSize=function(e,n){e=Math.max(this.minimumSize.width,e),n=Math.max(this.minimumSize.height,n),mxClient.IS_IE||(this.div.style.width=e+"px",this.div.style.height=n+"px"),this.table.style.width=e+"px",this.table.style.height=n+"px",mxClient.IS_IE||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px")},mxWindow.prototype.setMinimizable=function(e){this.minimize.style.display=e?"":"none"},mxWindow.prototype.getMinimumSize=function(){return new mxRectangle(0,0,0,this.title.offsetHeight)},mxWindow.prototype.installMinimizeHandler=function(){this.minimize=document.createElement("img"),this.minimize.setAttribute("src",this.minimizeImage),this.minimize.setAttribute("align","right"),this.minimize.setAttribute("title","Minimize"),this.minimize.style.cursor="pointer",this.minimize.style.marginRight="1px",this.minimize.style.display="none",this.title.appendChild(this.minimize);var t=!1,a=null,i=null,e=mxUtils.bind(this,function(e){if(this.activate(),t)t=!1,this.minimize.setAttribute("src",this.minimizeImage),this.minimize.setAttribute("title","Minimize"),this.contentWrapper.style.display="",this.maximize.style.display=a,mxClient.IS_IE||(this.div.style.height=i),this.table.style.height=i,null!=this.resize&&(this.resize.style.visibility=""),this.fireEvent(new mxEventObject(mxEvent.NORMALIZE,"event",e));else{t=!0,this.minimize.setAttribute("src",this.normalizeImage),this.minimize.setAttribute("title","Normalize"),this.contentWrapper.style.display="none",a=this.maximize.style.display,this.maximize.style.display="none",i=this.table.style.height;var n=this.getMinimumSize();0<n.height&&(mxClient.IS_IE||(this.div.style.height=n.height+"px"),this.table.style.height=n.height+"px"),0<n.width&&(mxClient.IS_IE||(this.div.style.width=n.width+"px"),this.table.style.width=n.width+"px"),null!=this.resize&&(this.resize.style.visibility="hidden"),this.fireEvent(new mxEventObject(mxEvent.MINIMIZE,"event",e))}mxEvent.consume(e)});mxEvent.addListener(this.minimize,"mousedown",e),mxClient.IS_TOUCH&&mxEvent.addListener(this.minimize,"touchstart",e)},mxWindow.prototype.setMaximizable=function(e){this.maximize.style.display=e?"":"none"},mxWindow.prototype.installMaximizeHandler=function(){this.maximize=document.createElement("img"),this.maximize.setAttribute("src",this.maximizeImage),this.maximize.setAttribute("align","right"),this.maximize.setAttribute("title","Maximize"),this.maximize.style.cursor="default",this.maximize.style.marginLeft="1px",this.maximize.style.cursor="pointer",this.maximize.style.display="none",this.title.appendChild(this.maximize);var t=!1,a=null,i=null,s=null,o=null,e=mxUtils.bind(this,function(e){if(this.activate(),"none"!=this.maximize.style.display){if(t)t=!1,this.maximize.setAttribute("src",this.maximizeImage),this.maximize.setAttribute("title","Maximize"),this.contentWrapper.style.display="",this.minimize.style.visibility="",this.div.style.left=a+"px",this.div.style.top=i+"px",mxClient.IS_IE||(this.div.style.height=s,this.div.style.width=o,"auto"!=(n=mxUtils.getCurrentStyle(this.contentWrapper)).overflow&&null==this.resize)||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px"),this.table.style.height=s,this.table.style.width=o,null!=this.resize&&(this.resize.style.visibility=""),this.fireEvent(new mxEventObject(mxEvent.NORMALIZE,"event",e));else{if(t=!0,this.maximize.setAttribute("src",this.normalizeImage),this.maximize.setAttribute("title","Normalize"),this.contentWrapper.style.display="",this.minimize.style.visibility="hidden",a=parseInt(this.div.style.left),i=parseInt(this.div.style.top),s=this.table.style.height,o=this.table.style.width,this.div.style.left="0px",this.div.style.top="0px",mxClient.IS_IE||(this.div.style.height=document.body.clientHeight-2+"px",this.div.style.width=document.body.clientWidth-2+"px"),this.table.style.width=document.body.clientWidth-2+"px",this.table.style.height=document.body.clientHeight-2+"px",null!=this.resize&&(this.resize.style.visibility="hidden"),!mxClient.IS_IE){var n=mxUtils.getCurrentStyle(this.contentWrapper);"auto"!=n.overflow&&null==this.resize||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px")}this.fireEvent(new mxEventObject(mxEvent.MAXIMIZE,"event",e))}mxEvent.consume(e)}});mxEvent.addGestureListeners(this.maximize,e),mxEvent.addListener(this.title,"dblclick",e)},mxWindow.prototype.installMoveHandler=function(){this.title.style.cursor="move",mxEvent.addGestureListeners(this.title,mxUtils.bind(this,function(e){var a=mxEvent.getClientX(e),i=mxEvent.getClientY(e),s=this.getX(),o=this.getY(),n=mxUtils.bind(this,function(e){var n=mxEvent.getClientX(e)-a,t=mxEvent.getClientY(e)-i;this.setLocation(s+n,o+t),this.fireEvent(new mxEventObject(mxEvent.MOVE,"event",e)),mxEvent.consume(e)}),t=mxUtils.bind(this,function(e){mxEvent.removeGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.MOVE_END,"event",e)),mxEvent.consume(e)});mxEvent.addGestureListeners(document,null,n,t),this.fireEvent(new mxEventObject(mxEvent.MOVE_START,"event",e)),mxEvent.consume(e)}))},mxWindow.prototype.setLocation=function(e,n){this.div.style.left=e+"px",this.div.style.top=n+"px"},mxWindow.prototype.getX=function(){return parseInt(this.div.style.left)},mxWindow.prototype.getY=function(){return parseInt(this.div.style.top)},mxWindow.prototype.installCloseHandler=function(){this.closeImg=document.createElement("img"),this.closeImg.setAttribute("src",this.closeImage),this.closeImg.setAttribute("align","right"),this.closeImg.setAttribute("title","Close"),this.closeImg.style.marginLeft="2px",this.closeImg.style.cursor="pointer",this.closeImg.style.display="none",this.title.insertBefore(this.closeImg,this.title.firstChild),mxEvent.addGestureListeners(this.closeImg,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.CLOSE,"event",e)),this.destroyOnClose?this.destroy():this.setVisible(!1),mxEvent.consume(e)}))},mxWindow.prototype.setImage=function(e){this.image=document.createElement("img"),this.image.setAttribute("src",e),this.image.setAttribute("align","left"),this.image.style.marginRight="4px",this.image.style.marginLeft="0px",this.image.style.marginTop="-2px",this.title.insertBefore(this.image,this.title.firstChild)},mxWindow.prototype.setClosable=function(e){this.closeImg.style.display=e?"":"none"},mxWindow.prototype.isVisible=function(){return null!=this.div&&"hidden"!=this.div.style.visibility},mxWindow.prototype.setVisible=function(e){null!=this.div&&this.isVisible()!=e&&(e?this.show():this.hide())},mxWindow.prototype.show=function(){this.div.style.visibility="",this.activate();var e=mxUtils.getCurrentStyle(this.contentWrapper);mxClient.IS_IE||"auto"!=e.overflow&&null==this.resize||(this.contentWrapper.style.height=this.div.offsetHeight-this.title.offsetHeight-2+"px"),this.fireEvent(new mxEventObject(mxEvent.SHOW))},mxWindow.prototype.hide=function(){this.div.style.visibility="hidden",this.fireEvent(new mxEventObject(mxEvent.HIDE))},mxWindow.prototype.destroy=function(){this.fireEvent(new mxEventObject(mxEvent.DESTROY)),null!=this.div&&(mxEvent.release(this.div),this.div.parentNode.removeChild(this.div),this.div=null),this.contentWrapper=this.content=this.title=null},mxForm.prototype.table=null,mxForm.prototype.body=!1,mxForm.prototype.getTable=function(){return this.table},mxForm.prototype.addButtons=function(e,n){var t=document.createElement("tr"),a=document.createElement("td");t.appendChild(a);a=document.createElement("td");var i=document.createElement("button");mxUtils.write(i,mxResources.get("ok")||"OK"),a.appendChild(i),mxEvent.addListener(i,"click",function(){e()}),i=document.createElement("button"),mxUtils.write(i,mxResources.get("cancel")||"Cancel"),a.appendChild(i),mxEvent.addListener(i,"click",function(){n()}),t.appendChild(a),this.body.appendChild(t)},mxForm.prototype.addText=function(e,n){var t=document.createElement("input");return t.setAttribute("type","text"),t.value=n,this.addField(e,t)},mxForm.prototype.addCheckbox=function(e,n){var t=document.createElement("input");return t.setAttribute("type","checkbox"),this.addField(e,t),n&&(t.checked=!0),t},mxForm.prototype.addTextarea=function(e,n,t){var a=document.createElement("textarea");return mxClient.IS_NS&&t--,a.setAttribute("rows",t||2),a.value=n,this.addField(e,a)},mxForm.prototype.addCombo=function(e,n,t){var a=document.createElement("select");return null!=t&&a.setAttribute("size",t),n&&a.setAttribute("multiple","true"),this.addField(e,a)},mxForm.prototype.addOption=function(e,n,t,a){var i=document.createElement("option");mxUtils.writeln(i,n),i.setAttribute("value",t),a&&i.setAttribute("selected",a),e.appendChild(i)},mxForm.prototype.addField=function(e,n){var t=document.createElement("tr"),a=document.createElement("td");return mxUtils.write(a,e),t.appendChild(a),(a=document.createElement("td")).appendChild(n),t.appendChild(a),this.body.appendChild(t),n},mxImage.prototype.src=null,mxImage.prototype.width=null,mxImage.prototype.height=null,mxDivResizer.prototype.resizeWidth=!0,mxDivResizer.prototype.resizeHeight=!0,mxDivResizer.prototype.handlingResize=!1,mxDivResizer.prototype.resize=function(){var e=this.getDocumentWidth(),n=this.getDocumentHeight(),t=parseInt(this.div.style.left),a=parseInt(this.div.style.right),i=parseInt(this.div.style.top),s=parseInt(this.div.style.bottom);this.resizeWidth&&!isNaN(t)&&!isNaN(a)&&0<=t&&0<=a&&0<e-a-t&&(this.div.style.width=e-a-t+"px"),this.resizeHeight&&!isNaN(i)&&!isNaN(s)&&0<=i&&0<=s&&0<n-i-s&&(this.div.style.height=n-i-s+"px")},mxDivResizer.prototype.getDocumentWidth=function(){return document.body.clientWidth},mxDivResizer.prototype.getDocumentHeight=function(){return document.body.clientHeight},mxDragSource.prototype.element=null,mxDragSource.prototype.dropHandler=null,mxDragSource.prototype.dragOffset=null,mxDragSource.prototype.dragElement=null,mxDragSource.prototype.previewElement=null,mxDragSource.prototype.enabled=!0,mxDragSource.prototype.currentGraph=null,mxDragSource.prototype.currentDropTarget=null,mxDragSource.prototype.currentPoint=null,mxDragSource.prototype.currentGuide=null,mxDragSource.prototype.currentHighlight=null,mxDragSource.prototype.autoscroll=!0,mxDragSource.prototype.guidesEnabled=!0,mxDragSource.prototype.gridEnabled=!0,mxDragSource.prototype.highlightDropTargets=!0,mxDragSource.prototype.dragElementZIndex=100,mxDragSource.prototype.dragElementOpacity=70,mxDragSource.prototype.isEnabled=function(){return this.enabled},mxDragSource.prototype.setEnabled=function(e){this.enabled=e},mxDragSource.prototype.isGuidesEnabled=function(){return this.guidesEnabled},mxDragSource.prototype.setGuidesEnabled=function(e){this.guidesEnabled=e},mxDragSource.prototype.isGridEnabled=function(){return this.gridEnabled},mxDragSource.prototype.setGridEnabled=function(e){this.gridEnabled=e},mxDragSource.prototype.getGraphForEvent=function(e){return null},mxDragSource.prototype.getDropTarget=function(e,n,t){return e.getCellAt(n,t)},mxDragSource.prototype.createDragElement=function(e){return this.element.cloneNode(!0)},mxDragSource.prototype.createPreviewElement=function(e){return null},mxDragSource.prototype.mouseDown=function(e){this.enabled&&!mxEvent.isConsumed(e)&&null==this.mouseMoveHandler&&(this.startDrag(e),this.mouseMoveHandler=mxUtils.bind(this,this.mouseMove),this.mouseUpHandler=mxUtils.bind(this,this.mouseUp),mxEvent.addGestureListeners(document,null,this.mouseMoveHandler,this.mouseUpHandler),mxEvent.consume(e,!0,!1))},mxDragSource.prototype.startDrag=function(e){this.dragElement=this.createDragElement(e),this.dragElement.style.position="absolute",this.dragElement.style.zIndex=this.dragElementZIndex,mxUtils.setOpacity(this.dragElement,this.dragElementOpacity)},mxDragSource.prototype.stopDrag=function(e){null!=this.dragElement&&(null!=this.dragElement.parentNode&&this.dragElement.parentNode.removeChild(this.dragElement),this.dragElement=null)},mxDragSource.prototype.graphContainsEvent=function(e,n){var t=mxEvent.getClientX(n),a=mxEvent.getClientY(n),i=mxUtils.getOffset(e.container),s=mxUtils.getScrollOrigin();return t>=i.x-s.x&&a>=i.y-s.y&&t<=i.x-s.x+e.container.offsetWidth&&a<=i.y-s.y+e.container.offsetHeight},mxDragSource.prototype.mouseMove=function(e){if(null!=(n=this.getGraphForEvent(e))&&!this.graphContainsEvent(n,e)&&(n=null),n!=this.currentGraph&&(null!=this.currentGraph&&this.dragExit(this.currentGraph),this.currentGraph=n,null!=this.currentGraph&&this.dragEnter(this.currentGraph)),null!=this.currentGraph&&this.dragOver(this.currentGraph,e),null==this.dragElement||null!=this.previewElement&&"visible"==this.previewElement.style.visibility)null!=this.dragElement&&(this.dragElement.style.visibility="hidden");else{var n=mxEvent.getClientX(e),t=mxEvent.getClientY(e);null==this.dragElement.parentNode&&document.body.appendChild(this.dragElement),this.dragElement.style.visibility="visible",null!=this.dragOffset&&(n+=this.dragOffset.x,t+=this.dragOffset.y),n+=document.body.scrollLeft||document.documentElement.scrollLeft,t+=document.body.scrollTop||document.documentElement.scrollTop,this.dragElement.style.left=n+"px",this.dragElement.style.top=t+"px"}mxEvent.consume(e)},mxDragSource.prototype.mouseUp=function(e){if(null!=this.currentGraph){if(null!=this.currentPoint&&(null==this.previewElement||"hidden"!=this.previewElement.style.visibility)){var n=this.currentGraph.view.scale,t=this.currentGraph.view.translate;this.drop(this.currentGraph,e,this.currentDropTarget,this.currentPoint.x/n-t.x,this.currentPoint.y/n-t.y)}this.dragExit(this.currentGraph)}this.stopDrag(e),mxEvent.removeGestureListeners(document,null,this.mouseMoveHandler,this.mouseUpHandler),this.currentGraph=this.mouseUpHandler=this.mouseMoveHandler=null,mxEvent.consume(e)},mxDragSource.prototype.dragEnter=function(e){e.isMouseDown=!0,this.previewElement=this.createPreviewElement(e),this.isGuidesEnabled()&&null!=this.previewElement&&(this.currentGuide=new mxGuide(e,e.graphHandler.getGuideStates())),this.highlightDropTargets&&(this.currentHighlight=new mxCellHighlight(e,mxConstants.DROP_TARGET_COLOR))},mxDragSource.prototype.dragExit=function(e){this.currentPoint=this.currentDropTarget=null,e.isMouseDown=!1,null!=this.previewElement&&(null!=this.previewElement.parentNode&&this.previewElement.parentNode.removeChild(this.previewElement),this.previewElement=null),null!=this.currentGuide&&(this.currentGuide.destroy(),this.currentGuide=null),null!=this.currentHighlight&&(this.currentHighlight.destroy(),this.currentHighlight=null)},mxDragSource.prototype.dragOver=function(e,n){var t=mxUtils.getOffset(e.container),a=mxUtils.getScrollOrigin(e.container),i=mxEvent.getClientX(n)-t.x+a.x;t=mxEvent.getClientY(n)-t.y+a.y;if(e.autoScroll&&(null==this.autoscroll||this.autoscroll)&&e.scrollPointToVisible(i,t,e.autoExtend),null!=this.currentHighlight&&e.isDropEnabled()&&(this.currentDropTarget=this.getDropTarget(e,i,t),a=e.getView().getState(this.currentDropTarget),this.currentHighlight.highlight(a)),null!=this.previewElement){null==this.previewElement.parentNode&&(e.container.appendChild(this.previewElement),this.previewElement.style.zIndex="3",this.previewElement.style.position="absolute");a=this.isGridEnabled()&&e.isGridEnabledEvent(n);var s=!0;if(null!=this.currentGuide&&this.currentGuide.isEnabledForEvent(n))s=new mxRectangle(0,0,s=parseInt(this.previewElement.style.width),o=parseInt(this.previewElement.style.height)),t=new mxPoint(i,t),t=this.currentGuide.move(s,t,a),s=!1,i=t.x,t=t.y;else if(a){a=e.view.scale;var o=e.view.translate,r=e.gridSize/2;i=(e.snap(i/a-o.x-r)+o.x)*a,t=(e.snap(t/a-o.y-r)+o.y)*a}null!=this.currentGuide&&s&&this.currentGuide.hide(),null!=this.previewOffset&&(i+=this.previewOffset.x,t+=this.previewOffset.y),this.previewElement.style.left=Math.round(i)+"px",this.previewElement.style.top=Math.round(t)+"px",this.previewElement.style.visibility="visible"}this.currentPoint=new mxPoint(i,t)},mxDragSource.prototype.drop=function(e,n,t,a,i){this.dropHandler(e,n,t,a,i),e.container.focus()},mxToolbar.prototype=new mxEventSource,mxToolbar.prototype.constructor=mxToolbar,mxToolbar.prototype.container=null,mxToolbar.prototype.enabled=!0,mxToolbar.prototype.noReset=!1,mxToolbar.prototype.updateDefaultMode=!0,mxToolbar.prototype.addItem=function(e,n,t,a,i,s){var o=document.createElement(null!=n?"img":"button"),r=i||(null!=s?"mxToolbarMode":"mxToolbarItem");return o.className=r,o.setAttribute("src",n),null!=e&&(null!=n?o.setAttribute("title",e):mxUtils.write(o,e)),this.container.appendChild(o),null!=t&&(mxEvent.addListener(o,"click",t),mxClient.IS_TOUCH&&mxEvent.addListener(o,"touchend",t)),e=mxUtils.bind(this,function(e){null!=a?o.setAttribute("src",n):o.style.backgroundColor=""}),mxEvent.addGestureListeners(o,mxUtils.bind(this,function(e){if(null!=a?o.setAttribute("src",a):o.style.backgroundColor="gray",null!=s){null==this.menu&&(this.menu=new mxPopupMenu,this.menu.init());var n=this.currentImg;this.menu.isMenuShowing()&&this.menu.hideMenu(),n!=o&&(this.currentImg=o,this.menu.factoryMethod=s,n=new mxPoint(o.offsetLeft,o.offsetTop+o.offsetHeight),this.menu.popup(n.x,n.y,null,e),this.menu.isMenuShowing()&&(o.className=r+"Selected",this.menu.hideMenu=function(){mxPopupMenu.prototype.hideMenu.apply(this),o.className=r,this.currentImg=null}))}}),null,e),mxEvent.addListener(o,"mouseout",e),o},mxToolbar.prototype.addCombo=function(e){var n=document.createElement("div");n.style.display="inline",n.className="mxToolbarComboContainer";var t=document.createElement("select");return t.className=e||"mxToolbarCombo",n.appendChild(t),this.container.appendChild(n),t},mxToolbar.prototype.addActionCombo=function(e,n){var t=document.createElement("select");return t.className=n||"mxToolbarCombo",this.addOption(t,e,null),mxEvent.addListener(t,"change",function(e){var n=t.options[t.selectedIndex];t.selectedIndex=0,null!=n.funct&&n.funct(e)}),this.container.appendChild(t),t},mxToolbar.prototype.addOption=function(e,n,t){var a=document.createElement("option");return mxUtils.writeln(a,n),"function"==typeof t?a.funct=t:a.setAttribute("value",t),e.appendChild(a),a},mxToolbar.prototype.addSwitchMode=function(e,n,t,a,i){var s=document.createElement("img");return s.initialClassName=i||"mxToolbarMode",s.className=s.initialClassName,s.setAttribute("src",n),s.altIcon=a,null!=e&&s.setAttribute("title",e),mxEvent.addListener(s,"click",mxUtils.bind(this,function(e){null!=(e=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",e)):this.selectedMode.className=this.selectedMode.initialClassName,this.updateDefaultMode&&(this.defaultMode=s),null!=(e=(this.selectedMode=s).altIcon)?(s.altIcon=s.getAttribute("src"),s.setAttribute("src",e)):s.className=s.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT)),t()})),this.container.appendChild(s),null==this.defaultMode&&(this.defaultMode=s,this.selectMode(s),t()),s},mxToolbar.prototype.addMode=function(e,n,t,a,i,s){s=null==s||s;var o=document.createElement(null!=n?"img":"button");return o.initialClassName=i||"mxToolbarMode",o.className=o.initialClassName,o.setAttribute("src",n),o.altIcon=a,null!=e&&o.setAttribute("title",e),this.enabled&&s&&(mxEvent.addListener(o,"click",mxUtils.bind(this,function(e){this.selectMode(o,t),this.noReset=!1})),mxEvent.addListener(o,"dblclick",mxUtils.bind(this,function(e){this.selectMode(o,t),this.noReset=!0})),null==this.defaultMode&&(this.defaultMode=o,this.defaultFunction=t,this.selectMode(o,t))),this.container.appendChild(o),o},mxToolbar.prototype.selectMode=function(e,n){if(this.selectedMode!=e){if(null!=this.selectedMode){var t=this.selectedMode.altIcon;null!=t?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",t)):this.selectedMode.className=this.selectedMode.initialClassName}this.selectedMode=e,null!=(t=this.selectedMode.altIcon)?(this.selectedMode.altIcon=this.selectedMode.getAttribute("src"),this.selectedMode.setAttribute("src",t)):this.selectedMode.className=this.selectedMode.initialClassName+"Selected",this.fireEvent(new mxEventObject(mxEvent.SELECT,"function",n))}},mxToolbar.prototype.resetMode=function(e){(e||!this.noReset)&&this.selectedMode!=this.defaultMode&&this.selectMode(this.defaultMode,this.defaultFunction)},mxToolbar.prototype.addSeparator=function(e){return this.addItem(null,e,null)},mxToolbar.prototype.addBreak=function(){mxUtils.br(this.container)},mxToolbar.prototype.addLine=function(){var e=document.createElement("hr");e.style.marginRight="6px",e.setAttribute("size","1"),this.container.appendChild(e)},mxToolbar.prototype.destroy=function(){mxEvent.release(this.container),this.selectedMode=this.defaultFunction=this.defaultMode=this.container=null,null!=this.menu&&this.menu.destroy()},mxSession.prototype=new mxEventSource,mxSession.prototype.constructor=mxSession,mxSession.prototype.model=null,mxSession.prototype.urlInit=null,mxSession.prototype.urlPoll=null,mxSession.prototype.urlNotify=null,mxSession.prototype.codec=null,mxSession.prototype.linefeed="&#xa;",mxSession.prototype.escapePostData=!0,mxSession.prototype.significantRemoteChanges=!0,mxSession.prototype.sent=0,mxSession.prototype.received=0,mxSession.prototype.debug=!1,mxSession.prototype.connected=!1,mxSession.prototype.suspended=!1,mxSession.prototype.polling=!1,mxSession.prototype.start=function(){this.debug?(this.connected=!0,this.fireEvent(new mxEventObject(mxEvent.CONNECT))):this.connected||this.get(this.urlInit,mxUtils.bind(this,function(e){this.connected=!0,this.fireEvent(new mxEventObject(mxEvent.CONNECT)),this.poll()}))},mxSession.prototype.suspend=function(){this.connected&&!this.suspended&&(this.suspended=!0,this.fireEvent(new mxEventObject(mxEvent.SUSPEND)))},mxSession.prototype.resume=function(e,n,t){this.connected&&this.suspended&&(this.suspended=!1,this.fireEvent(new mxEventObject(mxEvent.RESUME)),this.polling||this.poll())},mxSession.prototype.stop=function(e){this.connected&&(this.connected=!1),this.fireEvent(new mxEventObject(mxEvent.DISCONNECT,"reason",e))},mxSession.prototype.poll=function(){this.connected&&!this.suspended&&null!=this.urlPoll?(this.polling=!0,this.get(this.urlPoll,mxUtils.bind(this,function(){this.poll()}))):this.polling=!1},mxSession.prototype.notify=function(e,n,t){null!=e&&0<e.length&&(null!=this.urlNotify&&(this.debug?(mxLog.show(),mxLog.debug("mxSession.notify: "+this.urlNotify+" xml="+e)):(e="<message><delta>"+e+"</delta></message>",this.escapePostData&&(e=encodeURIComponent(e)),mxUtils.post(this.urlNotify,"xml="+e,n,t))),this.sent+=e.length,this.fireEvent(new mxEventObject(mxEvent.NOTIFY,"url",this.urlNotify,"xml",e)))},mxSession.prototype.get=function(t,a,n){if(void 0!==mxUtils){var i=mxUtils.bind(this,function(e){null!=n?n(e):this.stop(e)});mxUtils.get(t,mxUtils.bind(this,function(e){if(void 0!==mxUtils)if(e.isReady()&&404!=e.getStatus()){if(this.received+=e.getText().length,this.fireEvent(new mxEventObject(mxEvent.GET,"url",t,"request",e)),this.isValidResponse(e)){if(0<e.getText().length){var n=e.getDocumentElement();null==n?i("Invalid response: "+e.getText()):this.receive(n)}null!=a&&a(e)}}else i("Response not ready")}),function(e){i("Transmission error")})}},mxSession.prototype.isValidResponse=function(e){return e.getText().indexOf("<?php")<0},mxSession.prototype.encodeChanges=function(e,n){for(var t="",a=n?-1:1,i=n?e.length-1:0;0<=i&&i<e.length;i+=a){var s=this.codec.encode(e[i]);t=t+mxUtils.getXml(s,this.linefeed)}return t},mxSession.prototype.receive=function(e){if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){var n=e.getAttribute("namespace");for(null!=n&&(this.model.prefix=n+"-"),n=e.firstChild;null!=n;){var t=n.nodeName.toLowerCase();"state"==t?this.processState(n):"delta"==t&&this.processDelta(n),n=n.nextSibling}this.fireEvent(new mxEventObject(mxEvent.RECEIVE,"node",e))}},mxSession.prototype.processState=function(e){new mxCodec(e.ownerDocument).decode(e.firstChild,this.model)},mxSession.prototype.processDelta=function(e){for(e=e.firstChild;null!=e;)"edit"==e.nodeName&&this.processEdit(e),e=e.nextSibling},mxSession.prototype.processEdit=function(e){if(0<(e=this.decodeChanges(e)).length){var n=this.createUndoableEdit(e);this.model.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",n,"changes",e)),this.model.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",n)),this.fireEvent(new mxEventObject(mxEvent.FIRED,"edit",n))}},mxSession.prototype.createUndoableEdit=function(e){var n=new mxUndoableEdit(this.model,this.significantRemoteChanges);return n.changes=e,n.notify=function(){n.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",n,"changes",n.changes)),n.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",n,"changes",n.changes))},n},mxSession.prototype.decodeChanges=function(e){this.codec.document=e.ownerDocument;var n=[];for(e=e.firstChild;null!=e;){var t=this.decodeChange(e);null!=t&&n.push(t),e=e.nextSibling}return n},mxSession.prototype.decodeChange=function(e){var n=null;return e.nodeType==mxConstants.NODETYPE_ELEMENT&&(null!=(n="mxRootChange"==e.nodeName?new mxCodec(e.ownerDocument).decode(e):this.codec.decode(e))&&(n.model=this.model,n.execute(),"mxChildChange"==e.nodeName&&null==n.parent&&this.cellRemoved(n.child))),n},mxSession.prototype.cellRemoved=function(e,n){this.codec.putObject(e.getId(),e);for(var t=this.model.getChildCount(e),a=0;a<t;a++)this.cellRemoved(this.model.getChildAt(e,a))},mxUndoableEdit.prototype.source=null,mxUndoableEdit.prototype.changes=null,mxUndoableEdit.prototype.significant=null,mxUndoableEdit.prototype.undone=!1,mxUndoableEdit.prototype.redone=!1,mxUndoableEdit.prototype.isEmpty=function(){return 0==this.changes.length},mxUndoableEdit.prototype.isSignificant=function(){return this.significant},mxUndoableEdit.prototype.add=function(e){this.changes.push(e)},mxUndoableEdit.prototype.notify=function(){},mxUndoableEdit.prototype.die=function(){},mxUndoableEdit.prototype.undo=function(){if(!this.undone){this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));for(var e=this.changes.length-1;0<=e;e--){var n=this.changes[e];null!=n.execute?n.execute():null!=n.undo&&n.undo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",n))}this.undone=!0,this.redone=!1,this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT))}this.notify()},mxUndoableEdit.prototype.redo=function(){if(!this.redone){this.source.fireEvent(new mxEventObject(mxEvent.START_EDIT));for(var e=this.changes.length,n=0;n<e;n++){var t=this.changes[n];null!=t.execute?t.execute():null!=t.redo&&t.redo(),this.source.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",t))}this.undone=!1,this.redone=!0,this.source.fireEvent(new mxEventObject(mxEvent.END_EDIT))}this.notify()},mxUndoManager.prototype=new mxEventSource,mxUndoManager.prototype.constructor=mxUndoManager,mxUndoManager.prototype.size=null,mxUndoManager.prototype.history=null,mxUndoManager.prototype.indexOfNextAdd=0,mxUndoManager.prototype.isEmpty=function(){return 0==this.history.length},mxUndoManager.prototype.clear=function(){this.history=[],this.indexOfNextAdd=0,this.fireEvent(new mxEventObject(mxEvent.CLEAR))},mxUndoManager.prototype.canUndo=function(){return 0<this.indexOfNextAdd},mxUndoManager.prototype.undo=function(){for(;0<this.indexOfNextAdd;){var e=this.history[--this.indexOfNextAdd];if(e.undo(),e.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",e));break}}},mxUndoManager.prototype.canRedo=function(){return this.indexOfNextAdd<this.history.length},mxUndoManager.prototype.redo=function(){for(var e=this.history.length;this.indexOfNextAdd<e;){var n=this.history[this.indexOfNextAdd++];if(n.redo(),n.isSignificant()){this.fireEvent(new mxEventObject(mxEvent.REDO,"edit",n));break}}},mxUndoManager.prototype.undoableEditHappened=function(e){this.trim(),0<this.size&&this.size==this.history.length&&this.history.shift(),this.history.push(e),this.indexOfNextAdd=this.history.length,this.fireEvent(new mxEventObject(mxEvent.ADD,"edit",e))},mxUndoManager.prototype.trim=function(){if(this.history.length>this.indexOfNextAdd)for(var e=this.history.splice(this.indexOfNextAdd,this.history.length-this.indexOfNextAdd),n=0;n<e.length;n++)e[n].die()};var mxUrlConverter=function(e){var t=!0,a=null,i=null;return{isEnabled:function(){return t},setEnabled:function(e){t=e},getBaseUrl:function(){return a},setBaseUrl:function(e){a=e},getBaseDomain:function(){return a},setBaseDomain:function(e){a=e},isRelativeUrl:function(e){return"http://"!=e.substring(0,7)&&"https://"!=e.substring(0,8)&&"data:image"!=e.substring(0,10)},convert:function(e){if(t&&this.isRelativeUrl(e)){if(null==a){i=location.protocol+"//"+location.host;var n=(a=i+location.pathname).lastIndexOf("/");0<n&&(a=a.substring(0,n+1))}e="/"==e.charAt(0)?i+e:a+e}return e}}};function mxPanningManager(s){this.thread=null,this.active=!1,this.dy=this.dx=this.t0y=this.t0x=this.tdy=this.tdx=0,this.scrollbars=!1,this.scrollTop=this.scrollLeft=0,this.mouseListener={mouseDown:function(e,n){},mouseMove:function(e,n){},mouseUp:mxUtils.bind(this,function(e,n){this.active&&this.stop()})},s.addMouseListener(this.mouseListener),mxEvent.addListener(document,"mouseup",mxUtils.bind(this,function(){this.active&&this.stop()}));var o=mxUtils.bind(this,function(){return this.scrollbars=mxUtils.hasScrollbars(s.container),this.scrollLeft=s.container.scrollLeft,this.scrollTop=s.container.scrollTop,window.setInterval(mxUtils.bind(this,function(){if(this.tdx-=this.dx,this.tdy-=this.dy,this.scrollbars){var e=-s.container.scrollLeft-Math.ceil(this.dx),n=-s.container.scrollTop-Math.ceil(this.dy);s.panGraph(e,n),s.panDx=this.scrollLeft-s.container.scrollLeft,s.panDy=this.scrollTop-s.container.scrollTop,s.fireEvent(new mxEventObject(mxEvent.PAN))}else s.panGraph(this.getDx(),this.getDy())}),this.delay)});this.isActive=function(){return active},this.getDx=function(){return Math.round(this.tdx)},this.getDy=function(){return Math.round(this.tdy)},this.start=function(){this.t0x=s.view.translate.x,this.t0y=s.view.translate.y,this.active=!0},this.panTo=function(e,n,t,a){this.active||this.start(),this.scrollLeft=s.container.scrollLeft,this.scrollTop=s.container.scrollTop,a=null!=a?a:0;var i=s.container;this.dx=e+(null!=t?t:0)-i.scrollLeft-i.clientWidth,this.dx<0&&Math.abs(this.dx)<this.border?this.dx=this.border+this.dx:this.dx=this.handleMouseOut?Math.max(this.dx,0):0,0==this.dx&&(this.dx=e-i.scrollLeft,this.dx=0<this.dx&&this.dx<this.border?this.dx-this.border:this.handleMouseOut?Math.min(0,this.dx):0),this.dy=n+a-i.scrollTop-i.clientHeight,this.dy<0&&Math.abs(this.dy)<this.border?this.dy=this.border+this.dy:this.dy=this.handleMouseOut?Math.max(this.dy,0):0,0==this.dy&&(this.dy=n-i.scrollTop,this.dy=0<this.dy&&this.dy<this.border?this.dy-this.border:this.handleMouseOut?Math.min(0,this.dy):0),0!=this.dx||0!=this.dy?(this.dx*=this.damper,this.dy*=this.damper,null==this.thread&&(this.thread=o())):null!=this.thread&&(window.clearInterval(this.thread),this.thread=null)},this.stop=function(){if(this.active)if(this.active=!1,null!=this.thread&&(window.clearInterval(this.thread),this.thread=null),this.tdy=this.tdx=0,this.scrollbars)s.panDx=0,s.panDy=0,s.fireEvent(new mxEventObject(mxEvent.PAN));else{var e=s.panDx,n=s.panDy;0==e&&0==n||(s.panGraph(0,0),s.view.setTranslate(this.t0x+e/s.view.scale,this.t0y+n/s.view.scale))}},this.destroy=function(){s.removeMouseListener(this.mouseListener)}}function mxPopupMenu(e){null!=(this.factoryMethod=e)&&this.init()}function mxAutoSaveManager(e){this.changeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.graphModelChanged(n.getProperty("edit").changes)}),this.setGraph(e)}function mxAnimation(e){this.delay=null!=e?e:20}function mxMorphing(e,n,t,a){mxAnimation.call(this,a),this.graph=e,this.steps=null!=n?n:6,this.ease=null!=t?t:1.5}function mxImageBundle(e){this.images=[],this.alt=null!=e&&e}function mxImageExport(){}function mxAbstractCanvas2D(){this.converter=this.createUrlConverter(),this.reset()}function mxXmlCanvas2D(e){mxAbstractCanvas2D.call(this),this.root=e,this.writeDefaults()}function mxSvgCanvas2D(e,n){mxAbstractCanvas2D.call(this),this.root=e,this.gradients=[],this.defs=null,this.styleEnabled=null!=n&&n;var t=null;if(e.ownerDocument!=document)for(t=e;null!=t&&"svg"!=t.nodeName;)t=t.parentNode;null!=t&&(0<t.getElementsByTagName("defs").length&&(this.defs=t.getElementsByTagName("defs")[0]),null==this.defs&&(this.defs=this.createElement("defs"),null!=t.firstChild?t.insertBefore(this.defs,t.firstChild):t.appendChild(this.defs)),this.styleEnabled&&this.defs.appendChild(this.createStyle()))}mxPanningManager.prototype.damper=1/6,mxPanningManager.prototype.delay=10,mxPanningManager.prototype.handleMouseOut=!0,mxPanningManager.prototype.border=0,mxPopupMenu.prototype=new mxEventSource,mxPopupMenu.prototype.constructor=mxPopupMenu,mxPopupMenu.prototype.submenuImage=mxClient.imageBasePath+"/submenu.gif",mxPopupMenu.prototype.zIndex=10006,mxPopupMenu.prototype.factoryMethod=null,mxPopupMenu.prototype.useLeftButtonForPopup=!1,mxPopupMenu.prototype.enabled=!0,mxPopupMenu.prototype.itemCount=0,mxPopupMenu.prototype.autoExpand=!1,mxPopupMenu.prototype.smartSeparators=!1,mxPopupMenu.prototype.labels=!0,mxPopupMenu.prototype.init=function(){this.table=document.createElement("table"),this.table.className="mxPopupMenu",this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.div=document.createElement("div"),this.div.className="mxPopupMenu",this.div.style.display="inline",this.div.style.zIndex=this.zIndex,this.div.appendChild(this.table),mxEvent.disableContextMenu(this.div)},mxPopupMenu.prototype.isEnabled=function(){return this.enabled},mxPopupMenu.prototype.setEnabled=function(e){this.enabled=e},mxPopupMenu.prototype.isPopupTrigger=function(e){return e.isPopupTrigger()||this.useLeftButtonForPopup&&mxEvent.isLeftMouseButton(e.getEvent())},mxPopupMenu.prototype.addItem=function(e,n,t,a,i,s){a=a||this,this.itemCount++,a.willAddSeparator&&(a.containsItems&&this.addSeparator(a,!0),a.willAddSeparator=!1),a.containsItems=!0;var o=document.createElement("tr");o.className="mxPopupMenuItem";var r=document.createElement("td");return r.className="mxPopupMenuIcon",null!=n?((i=document.createElement("img")).src=n,r.appendChild(i)):null!=i&&((n=document.createElement("div")).className=i,r.appendChild(n)),o.appendChild(r),this.labels&&((r=document.createElement("td")).className="mxPopupMenuItem"+(null==s||s?"":" disabled"),mxUtils.write(r,e),r.align="left",o.appendChild(r),(e=document.createElement("td")).className="mxPopupMenuItem"+(null==s||s?"":" disabled"),e.style.paddingRight="6px",e.style.textAlign="right",o.appendChild(e),null==a.div&&this.createSubmenu(a)),a.tbody.appendChild(o),(null==s||s)&&(mxEvent.addGestureListeners(o,mxUtils.bind(this,function(e){this.eventReceiver=o,a.activeRow!=o&&a.activeRow!=a&&(null!=a.activeRow&&null!=a.activeRow.div.parentNode&&this.hideSubmenu(a),null!=o.div&&(this.showSubmenu(a,o),a.activeRow=o)),mxEvent.consume(e)}),mxUtils.bind(this,function(e){a.activeRow!=o&&a.activeRow!=a&&(null!=a.activeRow&&null!=a.activeRow.div.parentNode&&this.hideSubmenu(a),this.autoExpand&&null!=o.div&&(this.showSubmenu(a,o),a.activeRow=o)),o.className="mxPopupMenuItemHover"}),mxUtils.bind(this,function(e){this.eventReceiver==o&&(a.activeRow!=o&&this.hideMenu(),null!=t&&t(e)),this.eventReceiver=null,mxEvent.consume(e)})),mxEvent.addListener(o,"mouseout",mxUtils.bind(this,function(e){o.className="mxPopupMenuItem"}))),o},mxPopupMenu.prototype.createSubmenu=function(e){e.table=document.createElement("table"),e.table.className="mxPopupMenu",e.tbody=document.createElement("tbody"),e.table.appendChild(e.tbody),e.div=document.createElement("div"),e.div.className="mxPopupMenu",e.div.style.position="absolute",e.div.style.display="inline",e.div.style.zIndex=this.zIndex,e.div.appendChild(e.table);var n=document.createElement("img");n.setAttribute("src",this.submenuImage),td=e.firstChild.nextSibling.nextSibling,td.appendChild(n)},mxPopupMenu.prototype.showSubmenu=function(e,n){if(null!=n.div){n.div.style.left=e.div.offsetLeft+n.offsetLeft+n.offsetWidth-1+"px",n.div.style.top=e.div.offsetTop+n.offsetTop+"px",document.body.appendChild(n.div);var t=parseInt(n.div.offsetLeft),a=parseInt(n.div.offsetWidth),i=document.body,s=document.documentElement;t+a>(i.scrollLeft||s.scrollLeft)+(i.clientWidth||s.clientWidth)&&(n.div.style.left=e.div.offsetLeft-a+(mxClient.IS_IE?6:-6)+"px"),mxUtils.fit(n.div)}},mxPopupMenu.prototype.addSeparator=function(e,n){if(e=e||this,this.smartSeparators&&!n)e.willAddSeparator=!0;else if(null!=e.tbody){e.willAddSeparator=!1;var t=document.createElement("tr"),a=document.createElement("td");a.className="mxPopupMenuIcon",a.style.padding="0 0 0 0px",t.appendChild(a),(a=document.createElement("td")).style.padding="0 0 0 0px",a.setAttribute("colSpan","2");var i=document.createElement("hr");i.setAttribute("size","1"),a.appendChild(i),t.appendChild(a),e.tbody.appendChild(t)}},mxPopupMenu.prototype.popup=function(e,n,t,a){if(null!=this.div&&null!=this.tbody&&null!=this.factoryMethod){for(this.div.style.left=e+"px",this.div.style.top=n+"px";null!=this.tbody.firstChild;)mxEvent.release(this.tbody.firstChild),this.tbody.removeChild(this.tbody.firstChild);this.itemCount=0,this.factoryMethod(this,t,a),0<this.itemCount&&(this.showMenu(),this.fireEvent(new mxEventObject(mxEvent.SHOW)))}},mxPopupMenu.prototype.isMenuShowing=function(){return null!=this.div&&this.div.parentNode==document.body},mxPopupMenu.prototype.showMenu=function(){9<=document.documentMode&&(this.div.style.filter="none"),document.body.appendChild(this.div),mxUtils.fit(this.div)},mxPopupMenu.prototype.hideMenu=function(){null!=this.div&&(null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.hideSubmenu(this),this.containsItems=!1)},mxPopupMenu.prototype.hideSubmenu=function(e){null!=e.activeRow&&(this.hideSubmenu(e.activeRow),null!=e.activeRow.div.parentNode&&e.activeRow.div.parentNode.removeChild(e.activeRow.div),e.activeRow=null)},mxPopupMenu.prototype.destroy=function(){null!=this.div&&(mxEvent.release(this.div),null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.div=null)},mxAutoSaveManager.prototype=new mxEventSource,mxAutoSaveManager.prototype.constructor=mxAutoSaveManager,mxAutoSaveManager.prototype.graph=null,mxAutoSaveManager.prototype.autoSaveDelay=10,mxAutoSaveManager.prototype.autoSaveThrottle=2,mxAutoSaveManager.prototype.autoSaveThreshold=5,mxAutoSaveManager.prototype.ignoredChanges=0,mxAutoSaveManager.prototype.lastSnapshot=0,mxAutoSaveManager.prototype.enabled=!0,mxAutoSaveManager.prototype.changeHandler=null,mxAutoSaveManager.prototype.isEnabled=function(){return this.enabled},mxAutoSaveManager.prototype.setEnabled=function(e){this.enabled=e},mxAutoSaveManager.prototype.setGraph=function(e){null!=this.graph&&this.graph.getModel().removeListener(this.changeHandler),this.graph=e,null!=this.graph&&this.graph.getModel().addListener(mxEvent.CHANGE,this.changeHandler)},mxAutoSaveManager.prototype.save=function(){},mxAutoSaveManager.prototype.graphModelChanged=function(e){(e=((new Date).getTime()-this.lastSnapshot)/1e3)>this.autoSaveDelay||this.ignoredChanges>=this.autoSaveThreshold&&e>this.autoSaveThrottle?(this.save(),this.reset()):this.ignoredChanges++},mxAutoSaveManager.prototype.reset=function(){this.lastSnapshot=(new Date).getTime(),this.ignoredChanges=0},mxAutoSaveManager.prototype.destroy=function(){this.setGraph(null)},mxAnimation.prototype=new mxEventSource,mxAnimation.prototype.constructor=mxAnimation,mxAnimation.prototype.delay=null,mxAnimation.prototype.thread=null,mxAnimation.prototype.startAnimation=function(){null==this.thread&&(this.thread=window.setInterval(mxUtils.bind(this,this.updateAnimation),this.delay))},mxAnimation.prototype.updateAnimation=function(){this.fireEvent(new mxEventObject(mxEvent.EXECUTE))},mxAnimation.prototype.stopAnimation=function(){null!=this.thread&&(window.clearInterval(this.thread),this.thread=null,this.fireEvent(new mxEventObject(mxEvent.DONE)))},mxMorphing.prototype=new mxAnimation,mxMorphing.prototype.constructor=mxMorphing,mxMorphing.prototype.graph=null,mxMorphing.prototype.steps=null,mxMorphing.prototype.step=0,mxMorphing.prototype.ease=null,mxMorphing.prototype.cells=null,mxMorphing.prototype.updateAnimation=function(){var e=new mxCellStatePreview(this.graph);if(null!=this.cells)for(var n=0;n<this.cells.length;n++)this.animateCell(cells[n],e,!1);else this.animateCell(this.graph.getModel().getRoot(),e,!0);this.show(e),(e.isEmpty()||this.step++>=this.steps)&&this.stopAnimation()},mxMorphing.prototype.show=function(e){e.show()},mxMorphing.prototype.animateCell=function(e,n,t){var a=this.graph.getView().getState(e),i=null;if(null!=a&&(i=this.getDelta(a),this.graph.getModel().isVertex(e)&&(0!=i.x||0!=i.y))){var s=this.graph.view.getTranslate(),o=this.graph.view.getScale();i.x+=s.x*o,i.y+=s.y*o,n.moveState(a,-i.x/this.ease,-i.y/this.ease)}if(t&&!this.stopRecursion(a,i))for(a=this.graph.getModel().getChildCount(e),i=0;i<a;i++)this.animateCell(this.graph.getModel().getChildAt(e,i),n,t)},mxMorphing.prototype.stopRecursion=function(e,n){return null!=n&&(0!=n.x||0!=n.y)},mxMorphing.prototype.getDelta=function(e){var n=this.getOriginForCell(e.cell),t=this.graph.getView().getTranslate(),a=this.graph.getView().getScale();return e=new mxPoint(e.x/a-t.x,e.y/a-t.y),new mxPoint((n.x-e.x)*a,(n.y-e.y)*a)},mxMorphing.prototype.getOriginForCell=function(e){var n=null;return null!=e&&(n=this.getOriginForCell(this.graph.getModel().getParent(e)),null!=(e=this.graph.getCellGeometry(e))&&(n.x+=e.x,n.y+=e.y)),null==n&&(n=new mxPoint(-(n=this.graph.view.getTranslate()).x,-n.y)),n},mxImageBundle.prototype.images=null,mxImageBundle.prototype.images=null,mxImageBundle.prototype.putImage=function(e,n,t){this.images[e]={value:n,fallback:t}},mxImageBundle.prototype.getImage=function(e){var n=null;return null!=e&&(null!=(e=this.images[e])&&(n=this.alt?e.fallback:e.value)),n},mxImageExport.prototype.includeOverlays=!1,mxImageExport.prototype.drawState=function(e,n){null!=e&&(this.visitStatesRecursive(e,n,this.drawCellState),this.includeOverlays&&this.visitStatesRecursive(e,n,this.drawOverlays))},mxImageExport.prototype.visitStatesRecursive=function(e,n,t){if(null!=e){t(e,n);for(var a=e.view.graph,i=a.model.getChildCount(e.cell),s=0;s<i;s++){var o=a.view.getState(a.model.getChildAt(e.cell,s));this.visitStatesRecursive(o,n,t)}}},mxImageExport.prototype.drawCellState=function(e,n){e.shape instanceof mxShape&&(n.save(),e.shape.paint(n),n.restore()),null!=e.text&&(n.save(),e.text.paint(n),n.restore())},mxImageExport.prototype.drawOverlays=function(e,t){null!=e.overlays&&e.overlays.visit(function(e,n){n instanceof mxShape&&n.paint(t)})},mxAbstractCanvas2D.prototype.state=null,mxAbstractCanvas2D.prototype.states=null,mxAbstractCanvas2D.prototype.path=null,mxAbstractCanvas2D.prototype.rotateHtml=!0,mxAbstractCanvas2D.prototype.lastX=0,mxAbstractCanvas2D.prototype.lastY=0,mxAbstractCanvas2D.prototype.moveOp="M",mxAbstractCanvas2D.prototype.lineOp="L",mxAbstractCanvas2D.prototype.quadOp="Q",mxAbstractCanvas2D.prototype.curveOp="C",mxAbstractCanvas2D.prototype.closeOp="Z",mxAbstractCanvas2D.prototype.pointerEvents=!1,mxAbstractCanvas2D.prototype.createUrlConverter=function(){return new mxUrlConverter},mxAbstractCanvas2D.prototype.reset=function(){this.state=this.createState(),this.states=[]},mxAbstractCanvas2D.prototype.createState=function(){return{dx:0,dy:0,scale:1,alpha:1,fillColor:null,fillAlpha:1,gradientColor:null,gradientAlpha:1,gradientDirection:null,strokeColor:null,strokeWidth:1,dashed:!1,dashPattern:"3 3",lineCap:"flat",lineJoin:"miter",miterLimit:10,fontColor:"#000000",fontBackgroundColor:null,fontBorderColor:null,fontSize:mxConstants.DEFAULT_FONTSIZE,fontFamily:mxConstants.DEFAULT_FONTFAMILY,fontStyle:0,shadow:!1,shadowColor:mxConstants.SHADOWCOLOR,shadowAlpha:mxConstants.SHADOW_OPACITY,shadowDx:mxConstants.SHADOW_OFFSET_X,shadowDy:mxConstants.SHADOW_OFFSET_Y,rotation:0,rotationCx:0,rotationCy:0}},mxAbstractCanvas2D.prototype.format=function(e){return Math.round(parseFloat(e))},mxAbstractCanvas2D.prototype.addOp=function(){if(null!=this.path&&(this.path.push(arguments[0]),2<arguments.length))for(var e=this.state,n=2;n<arguments.length;n+=2)this.lastX=arguments[n-1],this.lastY=arguments[n],this.path.push(this.format((this.lastX+e.dx)*e.scale)),this.path.push(this.format((this.lastY+e.dy)*e.scale))},mxAbstractCanvas2D.prototype.rotatePoint=function(e,n,t,a,i){return t*=Math.PI/180,mxUtils.getRotatedPoint(new mxPoint(e,n),Math.cos(t),Math.sin(t),new mxPoint(a,i))},mxAbstractCanvas2D.prototype.save=function(){this.states.push(this.state),this.state=mxUtils.clone(this.state)},mxAbstractCanvas2D.prototype.restore=function(){this.state=this.states.pop()},mxAbstractCanvas2D.prototype.scale=function(e){this.state.scale*=e,this.state.strokeWidth*=e},mxAbstractCanvas2D.prototype.translate=function(e,n){this.state.dx+=e,this.state.dy+=n},mxAbstractCanvas2D.prototype.setAlpha=function(e){this.state.alpha=e},mxAbstractCanvas2D.prototype.setFillColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fillColor=e,this.state.gradientColor=null},mxAbstractCanvas2D.prototype.setGradient=function(e,n,t,a,i,s,o,r,l){(t=this.state).fillColor=e,t.fillAlpha=null!=r?r:1,t.gradientColor=n,t.gradientAlpha=null!=l?l:1,t.gradientDirection=o},mxAbstractCanvas2D.prototype.setStrokeColor=function(e){e==mxConstants.NONE&&(e=null),this.state.strokeColor=e},mxAbstractCanvas2D.prototype.setStrokeWidth=function(e){this.state.strokeWidth=e},mxAbstractCanvas2D.prototype.setDashed=function(e){this.state.dashed=e},mxAbstractCanvas2D.prototype.setDashPattern=function(e){this.state.dashPattern=e},mxAbstractCanvas2D.prototype.setLineCap=function(e){this.state.lineCap=e},mxAbstractCanvas2D.prototype.setLineJoin=function(e){this.state.lineJoin=e},mxAbstractCanvas2D.prototype.setMiterLimit=function(e){this.state.miterLimit=e},mxAbstractCanvas2D.prototype.setFontColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontColor=e},mxAbstractCanvas2D.prototype.setFontBackgroundColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontBackgroundColor=e},mxAbstractCanvas2D.prototype.setFontBorderColor=function(e){e==mxConstants.NONE&&(e=null),this.state.fontBorderColor=e},mxAbstractCanvas2D.prototype.setFontSize=function(e){this.state.fontSize=e},mxAbstractCanvas2D.prototype.setFontFamily=function(e){this.state.fontFamily=e},mxAbstractCanvas2D.prototype.setFontStyle=function(e){null==e&&(e=0),this.state.fontStyle=e},mxAbstractCanvas2D.prototype.setShadow=function(e){this.state.shadow=e},mxAbstractCanvas2D.prototype.setShadowColor=function(e){e==mxConstants.NONE&&(e=null),this.state.shadowColor=e},mxAbstractCanvas2D.prototype.setShadowAlpha=function(e){this.state.shadowAlpha=e},mxAbstractCanvas2D.prototype.setShadowOffset=function(e,n){this.state.shadowDx=e,this.state.shadowDy=n},mxAbstractCanvas2D.prototype.begin=function(){this.lastY=this.lastX=0,this.path=[]},mxAbstractCanvas2D.prototype.moveTo=function(e,n){this.addOp(this.moveOp,e,n)},mxAbstractCanvas2D.prototype.lineTo=function(e,n){this.addOp(this.lineOp,e,n)},mxAbstractCanvas2D.prototype.quadTo=function(e,n,t,a){this.addOp(this.quadOp,e,n,t,a)},mxAbstractCanvas2D.prototype.curveTo=function(e,n,t,a,i,s){this.addOp(this.curveOp,e,n,t,a,i,s)},mxAbstractCanvas2D.prototype.arcTo=function(e,n,t,a,i,s,o){for(e=mxUtils.arcToCurves(this.lastX,this.lastY,e,n,t,a,i,s,o),n=0;n<e.length;n+=6)this.curveTo(e[n],e[n+1],e[n+2],e[n+3],e[n+4],e[n+5])},mxAbstractCanvas2D.prototype.close=function(e,n,t,a,i,s){this.addOp(this.closeOp)},mxAbstractCanvas2D.prototype.end=function(){},mxUtils.extend(mxXmlCanvas2D,mxAbstractCanvas2D),mxXmlCanvas2D.prototype.textEnabled=!0,mxXmlCanvas2D.prototype.compressed=!0,mxXmlCanvas2D.prototype.writeDefaults=function(){var e;(e=this.createElement("fontfamily")).setAttribute("family",mxConstants.DEFAULT_FONTFAMILY),this.root.appendChild(e),(e=this.createElement("fontsize")).setAttribute("size",mxConstants.DEFAULT_FONTSIZE),this.root.appendChild(e),(e=this.createElement("shadowcolor")).setAttribute("color",mxConstants.SHADOWCOLOR),this.root.appendChild(e),(e=this.createElement("shadowalpha")).setAttribute("alpha",mxConstants.SHADOW_OPACITY),this.root.appendChild(e),(e=this.createElement("shadowoffset")).setAttribute("dx",mxConstants.SHADOW_OFFSET_X),e.setAttribute("dy",mxConstants.SHADOW_OFFSET_Y),this.root.appendChild(e)},mxXmlCanvas2D.prototype.format=function(e){return parseFloat(parseFloat(e).toFixed(2))},mxXmlCanvas2D.prototype.createElement=function(e){return this.root.ownerDocument.createElement(e)},mxXmlCanvas2D.prototype.save=function(){this.compressed&&mxAbstractCanvas2D.prototype.save.apply(this,arguments),this.root.appendChild(this.createElement("save"))},mxXmlCanvas2D.prototype.restore=function(){this.compressed&&mxAbstractCanvas2D.prototype.restore.apply(this,arguments),this.root.appendChild(this.createElement("restore"))},mxXmlCanvas2D.prototype.scale=function(e){if(this.compressed){if(this.state.scale==e)return;mxAbstractCanvas2D.prototype.setAlpha.apply(this,arguments)}var n=this.createElement("scale");n.setAttribute("scale",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.translate=function(e,n){var t=this.createElement("translate");t.setAttribute("dx",this.format(e)),t.setAttribute("dy",this.format(n)),this.root.appendChild(t)},mxXmlCanvas2D.prototype.rotate=function(e,n,t,a,i){var s=this.createElement("rotate");(0!=e||n||t)&&(s.setAttribute("theta",this.format(e)),s.setAttribute("flipH",n?"1":"0"),s.setAttribute("flipV",t?"1":"0"),s.setAttribute("cx",this.format(a)),s.setAttribute("cy",this.format(i)),this.root.appendChild(s))},mxXmlCanvas2D.prototype.setAlpha=function(e){if(this.compressed){if(this.state.alpha==e)return;mxAbstractCanvas2D.prototype.setAlpha.apply(this,arguments)}var n=this.createElement("alpha");n.setAttribute("alpha",this.format(e)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setFillColor=function(e){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fillColor==e)return;mxAbstractCanvas2D.prototype.setFillColor.apply(this,arguments)}var n=this.createElement("fillcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setGradient=function(e,n,t,a,i,s,o,r,l){if(null!=e&&null!=n){mxAbstractCanvas2D.prototype.setGradient.apply(this,arguments);var d=this.createElement("gradient");d.setAttribute("c1",e),d.setAttribute("c2",n),d.setAttribute("x",this.format(t)),d.setAttribute("y",this.format(a)),d.setAttribute("w",this.format(i)),d.setAttribute("h",this.format(s)),null!=o&&d.setAttribute("direction",o),null!=r&&d.setAttribute("alpha1",r),null!=l&&d.setAttribute("alpha2",l),this.root.appendChild(d)}},mxXmlCanvas2D.prototype.setStrokeColor=function(e){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.strokeColor==e)return;mxAbstractCanvas2D.prototype.setStrokeColor.apply(this,arguments)}var n=this.createElement("strokecolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setStrokeWidth=function(e){if(this.compressed){if(this.state.strokeWidth==e)return;mxAbstractCanvas2D.prototype.setStrokeWidth.apply(this,arguments)}var n=this.createElement("strokewidth");n.setAttribute("width",this.format(e)),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setDashed=function(e){if(this.compressed){if(this.state.dashed==e)return;mxAbstractCanvas2D.prototype.setDashed.apply(this,arguments)}var n=this.createElement("dashed");n.setAttribute("dashed",e?"1":"0"),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setDashPattern=function(e){if(this.compressed){if(this.state.dashPattern==e)return;mxAbstractCanvas2D.prototype.setDashPattern.apply(this,arguments)}var n=this.createElement("dashpattern");n.setAttribute("pattern",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setLineCap=function(e){if(this.compressed){if(this.state.lineCap==e)return;mxAbstractCanvas2D.prototype.setLineCap.apply(this,arguments)}var n=this.createElement("linecap");n.setAttribute("cap",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setLineJoin=function(e){if(this.compressed){if(this.state.lineJoin==e)return;mxAbstractCanvas2D.prototype.setLineJoin.apply(this,arguments)}var n=this.createElement("linejoin");n.setAttribute("join",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setMiterLimit=function(e){if(this.compressed){if(this.state.miterLimit==e)return;mxAbstractCanvas2D.prototype.setMiterLimit.apply(this,arguments)}var n=this.createElement("miterlimit");n.setAttribute("limit",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setFontColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontColor==e)return;mxAbstractCanvas2D.prototype.setFontColor.apply(this,arguments)}var n=this.createElement("fontcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontBackgroundColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontBackgroundColor==e)return;mxAbstractCanvas2D.prototype.setFontBackgroundColor.apply(this,arguments)}var n=this.createElement("fontbackgroundcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontBorderColor=function(e){if(this.textEnabled){if(e==mxConstants.NONE&&(e=null),this.compressed){if(this.state.fontBorderColor==e)return;mxAbstractCanvas2D.prototype.setFontBorderColor.apply(this,arguments)}var n=this.createElement("fontbordercolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontSize=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontSize==e)return;mxAbstractCanvas2D.prototype.setFontSize.apply(this,arguments)}var n=this.createElement("fontsize");n.setAttribute("size",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontFamily=function(e){if(this.textEnabled){if(this.compressed){if(this.state.fontFamily==e)return;mxAbstractCanvas2D.prototype.setFontFamily.apply(this,arguments)}var n=this.createElement("fontfamily");n.setAttribute("family",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setFontStyle=function(e){if(this.textEnabled){if(null==e&&(e=0),this.compressed){if(this.state.fontStyle==e)return;mxAbstractCanvas2D.prototype.setFontStyle.apply(this,arguments)}var n=this.createElement("fontstyle");n.setAttribute("style",e),this.root.appendChild(n)}},mxXmlCanvas2D.prototype.setShadow=function(e){if(this.compressed){if(this.state.shadow==e)return;mxAbstractCanvas2D.prototype.setShadow.apply(this,arguments)}var n=this.createElement("shadow");n.setAttribute("enabled",e?"1":"0"),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowColor=function(e){if(this.compressed){if(e==mxConstants.NONE&&(e=null),this.state.shadowColor==e)return;mxAbstractCanvas2D.prototype.setShadowColor.apply(this,arguments)}var n=this.createElement("shadowcolor");n.setAttribute("color",null!=e?e:mxConstants.NONE),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowAlpha=function(e){if(this.compressed){if(this.state.shadowAlpha==e)return;mxAbstractCanvas2D.prototype.setShadowAlpha.apply(this,arguments)}var n=this.createElement("shadowalpha");n.setAttribute("alpha",e),this.root.appendChild(n)},mxXmlCanvas2D.prototype.setShadowOffset=function(e,n){if(this.compressed){if(this.state.shadowDx==e&&this.state.shadowDy==n)return;mxAbstractCanvas2D.prototype.setShadowOffset.apply(this,arguments)}var t=this.createElement("shadowoffset");t.setAttribute("dx",e),t.setAttribute("dy",n),this.root.appendChild(t)},mxXmlCanvas2D.prototype.rect=function(e,n,t,a){var i=this.createElement("rect");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(n)),i.setAttribute("w",this.format(t)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){var o=this.createElement("roundrect");o.setAttribute("x",this.format(e)),o.setAttribute("y",this.format(n)),o.setAttribute("w",this.format(t)),o.setAttribute("h",this.format(a)),o.setAttribute("dx",this.format(i)),o.setAttribute("dy",this.format(s)),this.root.appendChild(o)},mxXmlCanvas2D.prototype.ellipse=function(e,n,t,a){var i=this.createElement("ellipse");i.setAttribute("x",this.format(e)),i.setAttribute("y",this.format(n)),i.setAttribute("w",this.format(t)),i.setAttribute("h",this.format(a)),this.root.appendChild(i)},mxXmlCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){i=this.converter.convert(i);var l=this.createElement("image");l.setAttribute("x",this.format(e)),l.setAttribute("y",this.format(n)),l.setAttribute("w",this.format(t)),l.setAttribute("h",this.format(a)),l.setAttribute("src",i),l.setAttribute("aspect",s?"1":"0"),l.setAttribute("flipH",o?"1":"0"),l.setAttribute("flipV",r?"1":"0"),this.root.appendChild(l)},mxXmlCanvas2D.prototype.begin=function(){this.root.appendChild(this.createElement("begin")),this.lastY=this.lastX=0},mxXmlCanvas2D.prototype.moveTo=function(e,n){var t=this.createElement("move");t.setAttribute("x",this.format(e)),t.setAttribute("y",this.format(n)),this.root.appendChild(t),this.lastX=e,this.lastY=n},mxXmlCanvas2D.prototype.lineTo=function(e,n){var t=this.createElement("line");t.setAttribute("x",this.format(e)),t.setAttribute("y",this.format(n)),this.root.appendChild(t),this.lastX=e,this.lastY=n},mxXmlCanvas2D.prototype.quadTo=function(e,n,t,a){var i=this.createElement("quad");i.setAttribute("x1",this.format(e)),i.setAttribute("y1",this.format(n)),i.setAttribute("x2",this.format(t)),i.setAttribute("y2",this.format(a)),this.root.appendChild(i),this.lastX=t,this.lastY=a},mxXmlCanvas2D.prototype.curveTo=function(e,n,t,a,i,s){var o=this.createElement("curve");o.setAttribute("x1",this.format(e)),o.setAttribute("y1",this.format(n)),o.setAttribute("x2",this.format(t)),o.setAttribute("y2",this.format(a)),o.setAttribute("x3",this.format(i)),o.setAttribute("y3",this.format(s)),this.root.appendChild(o),this.lastX=i,this.lastY=s},mxXmlCanvas2D.prototype.close=function(){this.root.appendChild(this.createElement("close"))},mxXmlCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){mxUtils.isNode(i)&&(i=mxUtils.getOuterHtml(i));var u=this.createElement("text");u.setAttribute("x",this.format(e)),u.setAttribute("y",this.format(n)),u.setAttribute("w",this.format(t)),u.setAttribute("h",this.format(a)),u.setAttribute("str",i),null!=s&&u.setAttribute("align",s),null!=o&&u.setAttribute("valign",o),u.setAttribute("wrap",r?"1":"0"),null==l&&(l=""),u.setAttribute("format",l),null!=d&&u.setAttribute("fill",d?"1":"0"),null!=c&&u.setAttribute("clip",c?"1":"0"),null!=m&&u.setAttribute("rotation",m),this.root.appendChild(u)}},mxXmlCanvas2D.prototype.stroke=function(){this.root.appendChild(this.createElement("stroke"))},mxXmlCanvas2D.prototype.fill=function(){this.root.appendChild(this.createElement("fill"))},mxXmlCanvas2D.prototype.fillAndStroke=function(){this.root.appendChild(this.createElement("fillstroke"))},mxUtils.extend(mxSvgCanvas2D,mxAbstractCanvas2D),mxSvgCanvas2D.prototype.node=null,mxSvgCanvas2D.prototype.matchHtmlAlignment=!0,mxSvgCanvas2D.prototype.textEnabled=!0,mxSvgCanvas2D.prototype.foEnabled=!0,mxSvgCanvas2D.prototype.strokeTolerance=0,mxSvgCanvas2D.prototype.refCount=0,mxSvgCanvas2D.prototype.blockImagePointerEvents=!1,mxSvgCanvas2D.prototype.reset=function(){mxAbstractCanvas2D.prototype.reset.apply(this,arguments),this.gradients=[]},mxSvgCanvas2D.prototype.createStyle=function(e){return(e=this.createElement("style")).setAttribute("type","text/css"),mxUtils.write(e,"svg{font-family:"+mxConstants.DEFAULT_FONTFAMILY+";font-size:"+mxConstants.DEFAULT_FONTSIZE+";fill:none;stroke-miterlimit:10}"),e},mxSvgCanvas2D.prototype.createElement=function(e,n){if(null!=this.root.ownerDocument.createElementNS)return this.root.ownerDocument.createElementNS(n||mxConstants.NS_SVG,e);var t=this.root.ownerDocument.createElement(e);return null!=n&&t.setAttribute("xmlns",n),t},mxSvgCanvas2D.prototype.createGradientId=function(e,n,t,a,i){return"#"==e.charAt(0)&&(e=e.substring(1)),"#"==n.charAt(0)&&(n=n.substring(1)),e=e.toLowerCase()+"-"+t,n=n.toLowerCase()+"-"+a,(t=null)==i||i==mxConstants.DIRECTION_SOUTH?t="s":i==mxConstants.DIRECTION_EAST?t="e":(a=e,e=n,n=a,i==mxConstants.DIRECTION_NORTH?t="s":i==mxConstants.DIRECTION_WEST&&(t="e")),"mx-gradient-"+e+"-"+n+"-"+t},mxSvgCanvas2D.prototype.getSvgGradient=function(e,n,t,a,i){var s=this.createGradientId(e,n,t,a,i),o=this.gradients[s];if(null==o){var r=this.root.ownerSVGElement,l=0,d=s+"-"+l;if(null!=r)for(o=r.ownerDocument.getElementById(d);null!=o&&o.ownerSVGElement!=r;)d=s+"-"+l++,o=r.ownerDocument.getElementById(d);else d="id"+ ++this.refCount;null==o&&((o=this.createSvgGradient(e,n,t,a,i)).setAttribute("id",d),null!=this.defs?this.defs.appendChild(o):r.appendChild(o)),this.gradients[s]=o}return o.getAttribute("id")},mxSvgCanvas2D.prototype.createSvgGradient=function(e,n,t,a,i){var s=this.createElement("linearGradient");return s.setAttribute("x1","0%"),s.setAttribute("y1","0%"),s.setAttribute("x2","0%"),s.setAttribute("y2","0%"),null==i||i==mxConstants.DIRECTION_SOUTH?s.setAttribute("y2","100%"):i==mxConstants.DIRECTION_EAST?s.setAttribute("x2","100%"):i==mxConstants.DIRECTION_NORTH?s.setAttribute("y1","100%"):i==mxConstants.DIRECTION_WEST&&s.setAttribute("x1","100%"),t=t<1?";stop-opacity:"+t:"",(i=this.createElement("stop")).setAttribute("offset","0%"),i.setAttribute("style","stop-color:"+e+t),s.appendChild(i),t=a<1?";stop-opacity:"+a:"",(i=this.createElement("stop")).setAttribute("offset","100%"),i.setAttribute("style","stop-color:"+n+t),s.appendChild(i),s},mxSvgCanvas2D.prototype.addNode=function(e,n){var t=this.node,a=this.state;if(null!=t){if("path"==t.nodeName){if(!(null!=this.path&&0<this.path.length))return;t.setAttribute("d",this.path.join(" "))}e&&null!=a.fillColor?this.updateFill():this.styleEnabled||("ellipse"!=t.nodeName||!mxClient.IS_NS||mxClient.IS_GC||mxClient.IS_SF?t.setAttribute("fill","none"):t.setAttribute("fill","transparent"),e=!1),n&&null!=a.strokeColor?this.updateStroke():this.styleEnabled||t.setAttribute("stroke","none"),null!=a.transform&&0<a.transform.length&&t.setAttribute("transform",a.transform),a.shadow&&this.root.appendChild(this.createShadow(t)),0<this.strokeTolerance&&!e&&this.root.appendChild(this.createTolerance(t)),this.pointerEvents&&("path"!=t.nodeName||this.path[this.path.length-1]==this.closeOp)&&t.setAttribute("pointer-events","all"),this.root.appendChild(t)}},mxSvgCanvas2D.prototype.updateFill=function(){var e=this.state;e.alpha<1&&this.node.setAttribute("fill-opacity",e.alpha),null!=e.fillColor&&(null!=e.gradientColor?(e=this.getSvgGradient(e.fillColor,e.gradientColor,e.fillAlpha,e.gradientAlpha,e.gradientDirection),this.node.setAttribute("fill","url(#"+e+")")):this.node.setAttribute("fill",e.fillColor.toLowerCase()))},mxSvgCanvas2D.prototype.updateStroke=function(){var e=this.state;this.node.setAttribute("stroke",e.strokeColor.toLowerCase()),e.alpha<1&&this.node.setAttribute("stroke-opacity",e.alpha);var n=Math.max(1,this.format(e.strokeWidth*e.scale));1!=n&&this.node.setAttribute("stroke-width",n),"path"==this.node.nodeName&&this.updateStrokeAttributes(),e.dashed&&this.node.setAttribute("stroke-dasharray",this.createDashPattern(n))},mxSvgCanvas2D.prototype.updateStrokeAttributes=function(){var e=this.state;if(null!=e.lineJoin&&"miter"!=e.lineJoin&&this.node.setAttribute("stroke-linejoin",e.lineJoin),null!=e.lineCap){var n=e.lineCap;"flat"==n&&(n="butt"),"butt"!=n&&this.node.setAttribute("stroke-linecap",n)}null!=e.miterLimit&&(!this.styleEnabled||10!=e.miterLimit)&&this.node.setAttribute("stroke-miterlimit",e.miterLimit)},mxSvgCanvas2D.prototype.createDashPattern=function(e){var n=this.state.dashPattern.split(" "),t=[];if(0<n.length)for(var a=0;a<n.length;a++)t[a]=Number(n[a])*e;return t.join(" ")},mxSvgCanvas2D.prototype.createTolerance=function(e){e=e.cloneNode(!0);var n=parseFloat(e.getAttribute("stroke-width")||1)+this.strokeTolerance;return e.setAttribute("pointer-events","stroke"),e.setAttribute("visibility","hidden"),e.removeAttribute("stroke-dasharray"),e.setAttribute("stroke-width",n),e.setAttribute("fill","none"),e.setAttribute("stroke",mxClient.IS_OP?"none":"white"),e},mxSvgCanvas2D.prototype.createShadow=function(e){e=e.cloneNode(!0);var n=this.state;return"none"!=e.getAttribute("fill")&&e.setAttribute("fill",n.shadowColor),"none"!=e.getAttribute("stroke")&&e.setAttribute("stroke",n.shadowColor),e.setAttribute("transform","translate("+this.format(n.shadowDx*n.scale)+","+this.format(n.shadowDy*n.scale)+")"+(n.transform||"")),e.setAttribute("opacity",n.shadowAlpha),e},mxSvgCanvas2D.prototype.rotate=function(e,n,t,a,i){if(0!=e||n||t){var s=this.state;if(a+=s.dx,i+=s.dy,a*=s.scale,i*=s.scale,s.transform=s.transform||"",n&&t)e+=180;else if(n^t){var o=n?a:0,r=n?-1:1,l=t?i:0,d=t?-1:1;s.transform+="translate("+this.format(o)+","+this.format(l)+")scale("+this.format(r)+","+this.format(d)+")translate("+this.format(-o)+","+this.format(-l)+")"}(n?!t:t)&&(e*=-1),0!=e&&(s.transform+="rotate("+this.format(e)+","+this.format(a)+","+this.format(i)+")"),s.rotation+=e,s.rotationCx=a,s.rotationCy=i}},mxSvgCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=this.createElement("path")},mxSvgCanvas2D.prototype.rect=function(e,n,t,a){var i=this.state,s=this.createElement("rect");s.setAttribute("x",this.format((e+i.dx)*i.scale)),s.setAttribute("y",this.format((n+i.dy)*i.scale)),s.setAttribute("width",this.format(t*i.scale)),s.setAttribute("height",this.format(a*i.scale)),this.node=s},mxSvgCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){this.rect(e,n,t,a),0<i&&this.node.setAttribute("rx",this.format(i*this.state.scale)),0<s&&this.node.setAttribute("ry",this.format(s*this.state.scale))},mxSvgCanvas2D.prototype.ellipse=function(e,n,t,a){var i=this.state,s=this.createElement("ellipse");s.setAttribute("cx",Math.round((e+t/2+i.dx)*i.scale)),s.setAttribute("cy",Math.round((n+a/2+i.dy)*i.scale)),s.setAttribute("rx",t/2*i.scale),s.setAttribute("ry",a/2*i.scale),this.node=s},mxSvgCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){i=this.converter.convert(i),s=null==s||s,o=null!=o&&o,r=null!=r&&r;var l=this.state;e+=l.dx,n+=l.dy;var d=this.createElement("image");if(d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(n*l.scale)),d.setAttribute("width",this.format(t*l.scale)),d.setAttribute("height",this.format(a*l.scale)),null==d.setAttributeNS?d.setAttribute("xlink:href",i):d.setAttributeNS(mxConstants.NS_XLINK,"href",i),s||d.setAttribute("preserveAspectRatio","none"),l.alpha<1&&d.setAttribute("opacity",l.alpha),i=this.state.transform||"",o||r){var c=s=1,m=0,u=0;o&&(s=-1,m=-t-2*e),r&&(c=-1,u=-a-2*n),i+="scale("+s+","+c+")translate("+m+","+u+")"}0<i.length&&d.setAttribute("transform",i),this.root.appendChild(d),this.blockImagePointerEvents&&(d.setAttribute("style","pointer-events:none"),(d=this.createElement("rect")).setAttribute("visibility","hidden"),d.setAttribute("pointer-events","fill"),d.setAttribute("x",this.format(e*l.scale)),d.setAttribute("y",this.format(n*l.scale)),d.setAttribute("width",this.format(t*l.scale)),d.setAttribute("height",this.format(a*l.scale)),this.root.appendChild(d))},mxSvgCanvas2D.prototype.createDiv=function(e,n,t,a,i){return t=this.state,a="display:inline-block;font-size:"+Math.round(t.fontSize)+"px;font-family:"+t.fontFamily+";color:"+t.fontColor+";line-height:"+Math.round(t.fontSize*mxConstants.LINE_HEIGHT)+"px;"+a,(t.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(a+="font-weight:bold;"),(t.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(a+="font-style:italic;"),(t.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(a+="font-decoration:underline;"),n==mxConstants.ALIGN_CENTER?a+="text-align:center;":n==mxConstants.ALIGN_RIGHT&&(a+="text-align:right;"),n="",null!=t.fontBackgroundColor&&(n+="background-color:"+t.fontBackgroundColor+";"),null!=t.fontBorderColor&&(n+="border:1px solid "+t.fontBorderColor+";"),mxUtils.isNode(e)||((t=document.createElement("textarea")).innerHTML=e.replace(/&lt;/g,"&amp;lt;").replace(/&gt;/g,"&amp;gt;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),e=t.value,i?a+=n:0<n.length&&(e='<div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;'+n+'">'+e+"</div>")),!mxClient.IS_IE&&document.createElementNS?((i=document.createElementNS("http://www.w3.org/1999/xhtml","div")).setAttribute("style",a),mxUtils.isNode(e)?this.root.ownerDocument!=document?i.appendChild(e.cloneNode(!0)):i.appendChild(e):i.innerHTML=e,i):(mxUtils.isNode(e)&&this.root.ownerDocument!=document&&(e=e.outerHTML),e=e.replace(/<br>/g,"<br />").replace(/<hr>/g,"<hr />"),mxUtils.parseXml('<div xmlns="http://www.w3.org/1999/xhtml" style="'+a+'">'+e+"</div>").documentElement)},mxSvgCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){m=null!=m?m:0;var u=this.state;if(e+=u.dx,n+=u.dy,this.foEnabled&&"html"==l){var p="vertical-align:top;";if(c?(p+="overflow:hidden;",0<a&&(p+="max-height:"+Math.round(a)+"px;"),0<t&&(p+="width:"+Math.round(t)+"px;")):d&&(p+="width:"+Math.round(t)+"px;",0<a&&(p+="max-height:"+Math.round(a)+"px;")),r?(!c&&0<t&&(p+="width:"+Math.round(t)+"px;"),p+="white-space:normal;"):p+="white-space:nowrap;",r=this.createElement("g"),u.alpha<1&&r.setAttribute("opacity",u.alpha),(l=this.createElement("foreignObject")).setAttribute("pointer-events","all"),null!=(p=this.createDiv(i,s,o,p,d))){r.appendChild(l),this.root.appendChild(r);var g=0;if(mxClient.IS_IE&&!mxClient.IS_SVG){var v=document.createElement("div");v.style.cssText=p.getAttribute("style"),v.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",v.style.visibility="hidden",v.innerHTML=mxUtils.isNode(i)?i.outerHTML:i,document.body.appendChild(v),g=v.offsetWidth,a=mxClient.IS_QUIRKS&&0<a&&c?Math.min(a,v.offsetHeight+2):v.offsetHeight,v.parentNode.removeChild(v),l.appendChild(p)}else this.root.ownerDocument!=document?(p.style.visibility="hidden",document.body.appendChild(p),g=p.offsetWidth,a=p.offsetHeight,l.appendChild(p),p.style.visibility=""):(l.appendChild(p),g=p.offsetWidth,a=p.offsetHeight);t=d?Math.max(t,g):g,u.alpha<1&&r.setAttribute("opacity",u.alpha),d=i=0,s==mxConstants.ALIGN_CENTER?i-=t/2:s==mxConstants.ALIGN_RIGHT&&(i-=t),e+=i,o==mxConstants.ALIGN_MIDDLE?d-=a/2:o==mxConstants.ALIGN_BOTTOM&&(d-=a),n+=d,s=1!=u.scale?"scale("+u.scale+")":"",0!=u.rotation&&this.rotateHtml?(s+="rotate("+u.rotation+","+t/2+","+a/2+")",e=(n=this.rotatePoint((e+t/2)*u.scale,(n+a/2)*u.scale,u.rotation,u.rotationCx,u.rotationCy)).x-t*u.scale/2,n=n.y-a*u.scale/2):(e*=u.scale,n*=u.scale),0!=m&&(s+="rotate("+m+","+-i+","+-d+")"),r.setAttribute("transform","translate("+Math.round(e)+","+Math.round(n)+")"+s),l.setAttribute("width",Math.round(Math.max(1,t))),l.setAttribute("height",Math.round(Math.max(1,a)))}}else this.plainText(e,n,t,a,i,s,o,r,d,c,m)}},mxSvgCanvas2D.prototype.createClip=function(e,n,t,a){for(var i="mx-clip-"+(e=Math.round(e))+"-"+(n=Math.round(n))+"-"+(t=Math.round(t))+"-"+(a=Math.round(a)),s=0,o=i+"-"+s;null!=document.getElementById(o);)o=i+"-"+ ++s;return clip=this.createElement("clipPath"),clip.setAttribute("id",o),(i=this.createElement("rect")).setAttribute("x",e),i.setAttribute("y",n),i.setAttribute("width",t),i.setAttribute("height",a),clip.appendChild(i),clip},mxSvgCanvas2D.prototype.plainText=function(e,n,t,a,i,s,o,r,l,d,c){c=null!=c?c:0,r=this.state;var m=Math.round(r.fontSize),u=this.createElement("g"),p=r.transform||"";if(0!=c&&(p+="rotate("+c+","+this.format(e*r.scale)+","+this.format(n*r.scale)+")"),d&&0<t&&0<a){var g=e;c=n,s==mxConstants.ALIGN_CENTER?g-=t/2:s==mxConstants.ALIGN_RIGHT&&(g-=t),o==mxConstants.ALIGN_MIDDLE?c-=a/2:o==mxConstants.ALIGN_BOTTOM&&(c-=a),c=this.createClip(g*r.scale-2,c*r.scale-2,t*r.scale+4,a*r.scale+4),null!=this.defs?this.defs.appendChild(c):this.root.appendChild(c),u.setAttribute("clip-path","url(#"+c.getAttribute("id")+")")}this.updateFont(u,s),"start"!=(c=s==mxConstants.ALIGN_RIGHT?"end":s==mxConstants.ALIGN_CENTER?"middle":"start")&&u.setAttribute("text-anchor",c),(!this.styleEnabled||m!=mxConstants.DEFAULT_FONTSIZE)&&u.setAttribute("font-size",Math.round(m*r.scale)+"px"),0<p.length&&u.setAttribute("transform",p),r.alpha<1&&u.setAttribute("opacity",r.alpha);p=i.split("\n"),g=Math.round(m*mxConstants.LINE_HEIGHT);var v=m+(p.length-1)*g;for(c=n+m-1,o==mxConstants.ALIGN_MIDDLE?c-=(a=(this.matchHtmlAlignment&&d&&0<a?Math.min(v,a):v)/2)+1:o==mxConstants.ALIGN_BOTTOM&&(c-=(a=this.matchHtmlAlignment&&d&&0<a?Math.min(v,a):v)+2),a=0;a<p.length;a++)0<p[a].length&&0<mxUtils.trim(p[a]).length&&((d=this.createElement("text")).setAttribute("x",this.format(e*r.scale)),d.setAttribute("y",this.format(c*r.scale)),mxUtils.write(d,p[a]),u.appendChild(d)),c+=g;this.root.appendChild(u),this.addTextBackground(u,i,e,n,t,v,s,o,l)},mxSvgCanvas2D.prototype.updateFont=function(e){var n=this.state;e.setAttribute("fill",n.fontColor),(!this.styleEnabled||n.fontFamily!=mxConstants.DEFAULT_FONTFAMILY)&&e.setAttribute("font-family",n.fontFamily),(n.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&e.setAttribute("font-weight","bold"),(n.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&e.setAttribute("font-style","italic"),(n.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&e.setAttribute("text-decoration","underline")},mxSvgCanvas2D.prototype.addTextBackground=function(e,n,t,a,i,s,o,r,l){var d=this.state;if(null!=d.fontBackgroundColor||null!=d.fontBorderColor){var c=null;null!=(c=l?(o==mxConstants.ALIGN_CENTER?t-=i/2:o==mxConstants.ALIGN_RIGHT&&(t-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((t+1)*d.scale,a*d.scale,(i-2)*d.scale,(s+2)*d.scale)):null!=e.getBBox&&this.root.ownerDocument==document?(c=e.getBBox(),n=mxClient.IS_IE&&mxClient.IS_SVG,new mxRectangle(c.x,c.y+(n?0:1),c.width,c.height+(n?1:0))):((c=document.createElement("div")).style.lineHeight=Math.round(d.fontSize*mxConstants.LINE_HEIGHT)+"px",c.style.fontSize=Math.round(d.fontSize)+"px",c.style.fontFamily=d.fontFamily,c.style.whiteSpace="nowrap",c.style.position="absolute",c.style.visibility="hidden",c.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",c.style.zoom="1",(d.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(c.style.fontWeight="bold"),(d.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(c.style.fontStyle="italic"),n=mxUtils.htmlEntities(n,!1),c.innerHTML=n.replace(/\n/g,"<br/>"),document.body.appendChild(c),i=c.offsetWidth,s=c.offsetHeight,c.parentNode.removeChild(c),o==mxConstants.ALIGN_CENTER?t-=i/2:o==mxConstants.ALIGN_RIGHT&&(t-=i),r==mxConstants.ALIGN_MIDDLE?a-=s/2:r==mxConstants.ALIGN_BOTTOM&&(a-=s),new mxRectangle((t+1)*d.scale,(a+2)*d.scale,i*d.scale,(s+1)*d.scale)))&&((n=this.createElement("rect")).setAttribute("fill",d.fontBackgroundColor||"none"),n.setAttribute("stroke",d.fontBorderColor||"none"),n.setAttribute("x",Math.floor(c.x-1)),n.setAttribute("y",Math.floor(c.y-1)),n.setAttribute("width",Math.ceil(c.width+2)),n.setAttribute("height",Math.ceil(c.height)),d=null!=d.fontBorderColor?Math.max(1,this.format(d.scale)):0,n.setAttribute("stroke-width",d),this.root.ownerDocument==document&&1==mxUtils.mod(d,2)&&n.setAttribute("transform","translate(0.5, 0.5)"),e.insertBefore(n,e.firstChild))}},mxSvgCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxSvgCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxSvgCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)};var mxVmlCanvas2D=function(e){mxAbstractCanvas2D.call(this),this.root=e};function mxGuide(e,n){this.graph=e,this.setStates(n)}function mxStencil(e){this.desc=e,this.parseDescription(),this.parseConstraints()}function mxShape(e){this.stencil=e,this.strokewidth=1,this.rotation=0,this.opacity=100,this.flipV=this.flipH=!1}mxUtils.extend(mxVmlCanvas2D,mxAbstractCanvas2D),mxVmlCanvas2D.prototype.node=null,mxVmlCanvas2D.prototype.textEnabled=!0,mxVmlCanvas2D.prototype.moveOp="m",mxVmlCanvas2D.prototype.lineOp="l",mxVmlCanvas2D.prototype.curveOp="c",mxVmlCanvas2D.prototype.closeOp="x",mxVmlCanvas2D.prototype.rotatedHtmlBackground="",mxVmlCanvas2D.prototype.vmlScale=1,mxVmlCanvas2D.prototype.addNode=function(e,n){var t=this.node,a=this.state;if(null!=t){if("shape"==t.nodeName){if(!(null!=this.path&&0<this.path.length))return;t.path=this.path.join(" ")+" e",t.style.width=this.root.style.width,t.style.height=this.root.style.height,t.coordsize=parseInt(t.style.width)+" "+parseInt(t.style.height)}t.strokeweight=this.format(Math.max(1,a.strokeWidth*a.scale/this.vmlScale))+"px",a.shadow&&this.root.appendChild(this.createShadow(t,e&&null!=a.fillColor,n&&null!=a.strokeColor)),n&&null!=a.strokeColor?(t.stroked="true",t.strokecolor=a.strokeColor):t.stroked="false",t.appendChild(this.createStroke()),e&&null!=a.fillColor?t.appendChild(this.createFill()):!this.pointerEvents||"shape"==t.nodeName&&this.path[this.path.length-1]!=this.closeOp?t.filled="false":t.appendChild(this.createTransparentFill()),this.root.appendChild(t)}},mxVmlCanvas2D.prototype.createTransparentFill=function(){var e=document.createElement(mxClient.VML_PREFIX+":fill");return e.src=mxClient.imageBasePath+"/transparent.gif",e.type="tile",e},mxVmlCanvas2D.prototype.createFill=function(){var e=this.state,n=document.createElement(mxClient.VML_PREFIX+":fill");if(n.color=e.fillColor,null!=e.gradientColor){n.type="gradient",n.method="none",n.color2=e.gradientColor;var t=180-e.rotation;t=e.gradientDirection==mxConstants.DIRECTION_WEST?t-(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_EAST?t+(90+("x"==this.root.style.flip?180:0)):e.gradientDirection==mxConstants.DIRECTION_NORTH?t-(180+("y"==this.root.style.flip?-180:0)):t+("y"==this.root.style.flip?-180:0);"x"!=this.root.style.flip&&"y"!=this.root.style.flip||(t*=-1),n.angle=mxUtils.mod(t,360),n.opacity=100*e.alpha*e.fillAlpha+"%",n.setAttribute(mxClient.OFFICE_PREFIX+":opacity2",100*e.alpha*e.gradientAlpha+"%")}else e.alpha<1&&(n.opacity=100*e.alpha+"%");return n},mxVmlCanvas2D.prototype.createStroke=function(){var e=this.state,n=document.createElement(mxClient.VML_PREFIX+":stroke");return n.endcap=e.lineCap||"flat",n.joinstyle=e.lineJoin||"miter",n.miterlimit=e.miterLimit||"10",e.alpha<1&&(n.opacity=100*e.alpha+"%"),e.dashed&&(n.dashstyle=this.getVmlDashStyle()),n},mxVmlCanvas2D.prototype.getVmlDashStyle=function(){var e="dash";if(null!=this.state.dashPattern){var n=this.state.dashPattern.split(" ");0<n.length&&1==n[0]&&(e="0 2")}return e},mxVmlCanvas2D.prototype.createShadow=function(e,n,t){var a=this.state,i=-a.rotation*(Math.PI/180),s=Math.cos(i),o=(i=Math.sin(i),a.shadowDx*a.scale),r=a.shadowDy*a.scale;"x"==this.root.style.flip?o*=-1:"y"==this.root.style.flip&&(r*=-1);var l=e.cloneNode(!0);return l.style.marginLeft=Math.round(o*s-r*i)+"px",l.style.marginTop=Math.round(o*i+r*s)+"px",8==document.documentMode&&(l.strokeweight=e.strokeweight,"shape"==e.nodeName&&(l.path=this.path.join(" ")+" e",l.style.width=this.root.style.width,l.style.height=this.root.style.height,l.coordsize=parseInt(e.style.width)+" "+parseInt(e.style.height))),t?(l.strokecolor=a.shadowColor,l.appendChild(this.createShadowStroke())):l.stroked="false",n?l.appendChild(this.createShadowFill()):l.filled="false",l},mxVmlCanvas2D.prototype.createShadowFill=function(){var e=document.createElement(mxClient.VML_PREFIX+":fill");return e.color=this.state.shadowColor,e.opacity=100*this.state.alpha*this.state.shadowAlpha+"%",e},mxVmlCanvas2D.prototype.createShadowStroke=function(){var e=this.createStroke();return e.opacity=100*this.state.alpha*this.state.shadowAlpha+"%",e},mxVmlCanvas2D.prototype.rotate=function(e,n,t,a,i){n&&t?e+=180:n?this.root.style.flip="x":t&&(this.root.style.flip="y"),(n?!t:t)&&(e*=-1),this.root.style.rotation=e,this.state.rotation+=e,this.state.rotationCx=a,this.state.rotationCy=i},mxVmlCanvas2D.prototype.begin=function(){mxAbstractCanvas2D.prototype.begin.apply(this,arguments),this.node=document.createElement(mxClient.VML_PREFIX+":shape"),this.node.style.position="absolute"},mxVmlCanvas2D.prototype.quadTo=function(e,n,t,a){var i=this.state,s=(this.lastX+i.dx)*i.scale,o=(this.lastY+i.dy)*i.scale;e=(e+i.dx)*i.scale;o+=2/3*((n=(n+i.dy)*i.scale)-o);var r=(t=(t+i.dx)*i.scale)+2/3*(e-t);n=(a=(a+i.dy)*i.scale)+2/3*(n-a),this.path.push("c "+this.format(s+2/3*(e-s))+" "+this.format(o)+" "+this.format(r)+" "+this.format(n)+" "+this.format(t)+" "+this.format(a)),this.lastX=t/i.scale-i.dx,this.lastY=a/i.scale-i.dy},mxVmlCanvas2D.prototype.createRect=function(e,n,t,a,i){var s=this.state;return(e=document.createElement(e)).style.position="absolute",e.style.left=this.format((n+s.dx)*s.scale)+"px",e.style.top=this.format((t+s.dy)*s.scale)+"px",e.style.width=this.format(a*s.scale)+"px",e.style.height=this.format(i*s.scale)+"px",e},mxVmlCanvas2D.prototype.rect=function(e,n,t,a){this.node=this.createRect(mxClient.VML_PREFIX+":rect",e,n,t,a)},mxVmlCanvas2D.prototype.roundrect=function(e,n,t,a,i,s){this.node=this.createRect(mxClient.VML_PREFIX+":roundrect",e,n,t,a),this.node.setAttribute("arcsize",Math.max(100*i/t,100*s/a)+"%")},mxVmlCanvas2D.prototype.ellipse=function(e,n,t,a){this.node=this.createRect(mxClient.VML_PREFIX+":oval",e,n,t,a)},mxVmlCanvas2D.prototype.image=function(e,n,t,a,i,s,o,r){var l=null;s?((l=this.createRect(mxClient.VML_PREFIX+":rect",e,n,t,a)).stroked="false",(e=document.createElement(mxClient.VML_PREFIX+":fill")).aspect=s?"atmost":"ignore",e.rotate="true",e.type="frame",e.src=i,l.appendChild(e)):(l=this.createRect(mxClient.VML_PREFIX+":image",e,n,t,a)).src=i,o&&r?l.style.rotation="180":o?l.style.flip="x":r&&(l.style.flip="y"),this.state.alpha<1&&(l.style.filter+="alpha(opacity="+100*this.state.alpha+")"),this.root.appendChild(l)},mxVmlCanvas2D.prototype.createDiv=function(e,n,t,a){t=document.createElement("div");var i=this.state,s="";return null!=i.fontBackgroundColor&&(s+="background-color:"+i.fontBackgroundColor+";"),null!=i.fontBorderColor&&(s+="border:1px solid "+i.fontBorderColor+";"),mxUtils.isNode(e)?t.appendChild(e):0<s.length&&!a?((a=document.createElement("div")).style.cssText=s,a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",a.innerHTML=e,t.appendChild(a)):(t.style.cssText=s,t.innerHTML=e),(e=t.style).fontSize=Math.round(i.fontSize/this.vmlScale)+"px",e.fontFamily=i.fontFamily,e.color=i.fontColor,e.verticalAlign="top",e.textAlign=n||"left",e.lineHeight=Math.round(i.fontSize*mxConstants.LINE_HEIGHT/this.vmlScale)+"px",(i.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(e.fontWeight="bold"),(i.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(e.fontStyle="italic"),(i.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(e.fontDecoration="underline"),t},mxVmlCanvas2D.prototype.text=function(e,n,t,a,i,s,o,r,l,d,c,m){if(this.textEnabled&&null!=i){var u=this.state;if("html"==l){null!=u.rotation&&(e=(n=this.rotatePoint(e,n,u.rotation,u.rotationCx,u.rotationCy)).x,n=n.y),8==document.documentMode?(e+=u.dx,n+=u.dy):(e*=u.scale,n*=u.scale),(l=8==document.documentMode?document.createElement(mxClient.VML_PREFIX+":group"):document.createElement("div")).style.position="absolute",l.style.display="inline",l.style.left=this.format(e)+"px",l.style.top=this.format(n)+"px",l.style.zoom=u.scale;var p=document.createElement("div");p.style.position="relative",p.style.display="inline";var g=(v=mxUtils.getAlignmentAsPoint(s,o)).x,v=v.y;if(i=this.createDiv(i,s,o,d),s=document.createElement("div"),r?(!c&&0<t&&(i.style.width=Math.round(t)+"px"),i.style.whiteSpace="normal"):i.style.whiteSpace="nowrap",r=u.rotation+(m||0),this.rotateHtml&&0!=r?(s.style.display="inline",s.style.zoom="1",s.appendChild(i),8==document.documentMode&&"DIV"!=this.root.nodeName?(p.appendChild(s),l.appendChild(p)):l.appendChild(s)):8==document.documentMode?(p.appendChild(i),l.appendChild(p)):(i.style.display="inline",l.appendChild(i)),"DIV"!=this.root.nodeName?((m=document.createElement(mxClient.VML_PREFIX+":rect")).stroked="false",m.filled="false",m.appendChild(l),this.root.appendChild(m)):this.root.appendChild(l),c?(i.style.overflow="hidden",0<t&&(i.style.width=Math.round(t)+"px"),0<a&&8==document.documentMode&&(i.style.maxHeight=Math.round(a)+"px")):d&&(i.style.width=t+"px",0<a&&(i.style.maxHeight=Math.round(a)+"px")),this.rotateHtml&&0!=r){t=r*(Math.PI/180),r=parseFloat(parseFloat(Math.cos(t)).toFixed(8)),m=parseFloat(parseFloat(Math.sin(-t)).toFixed(8)),(t%=2*Math.PI)<0&&(t+=2*Math.PI),(t%=Math.PI)>Math.PI/2&&(t=Math.PI-t),o=Math.cos(t);var h=Math.sin(t);8==document.documentMode&&(i.style.display="inline-block",s.style.display="inline-block",p.style.display="inline-block"),i.style.visibility="hidden",document.body.appendChild(i),t=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&(c||d)&&a<p&&(p=a,i.style.height=p+"px"),c=((a=p)-a*o+t*-h)/2-m*t*(g+.5)+r*a*(v+.5),d=(t-t*o+a*-h)/2+r*t*(g+.5)+m*a*(v+.5),"group"==l.nodeName&&"DIV"==this.root.nodeName?((g=document.createElement("div")).style.display="inline-block",g.style.position="absolute",g.style.left=this.format(e+(d-t/2)*u.scale)+"px",g.style.top=this.format(n+(c-a/2)*u.scale)+"px",l.parentNode.appendChild(g),g.appendChild(l)):(u=8==document.documentMode?1:u.scale,l.style.left=this.format(e+(d-t/2)*u)+"px",l.style.top=this.format(n+(c-a/2)*u)+"px"),s.style.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+r+", M12="+m+", M21="+-m+", M22="+r+", sizingMethod='auto expand')",s.style.backgroundColor=this.rotatedHtmlBackground,this.state.alpha<1&&(s.style.filter+="alpha(opacity="+100*this.state.alpha+")"),i.style.visibility="",s.appendChild(i)}else 8!=document.documentMode?(i.style.verticalAlign="top",this.state.alpha<1&&(l.style.filter="alpha(opacity="+100*this.state.alpha+")"),u=i.parentNode,i.style.visibility="hidden",document.body.appendChild(i),t=i.offsetWidth,p=i.offsetHeight,mxClient.IS_QUIRKS&&c&&a<p&&(p=a,i.style.height=p+"px"),a=p,i.style.visibility="",u.appendChild(i),l.style.left=this.format(e+t*g*this.state.scale)+"px",l.style.top=this.format(n+a*v*this.state.scale)+"px"):(this.state.alpha<1&&(i.style.filter="alpha(opacity="+100*this.state.alpha+")"),p.style.left=100*g+"%",p.style.top=100*v+"%")}else this.plainText(e,n,t,a,mxUtils.htmlEntities(i,!1),s,o,r,l,d,c,m)}},mxVmlCanvas2D.prototype.plainText=function(e,n,t,a,i,s,o,r,l,d,c,m){e=(e+(a=this.state).dx)*a.scale,n=(n+a.dy)*a.scale,(t=document.createElement(mxClient.VML_PREFIX+":shape")).style.width="1px",t.style.height="1px",t.stroked="false",(d=document.createElement(mxClient.VML_PREFIX+":fill")).color=a.fontColor,d.opacity=100*a.alpha+"%",t.appendChild(d),(d=document.createElement(mxClient.VML_PREFIX+":path")).textpathok="true",d.v="m "+this.format(0)+" "+this.format(0)+" l "+this.format(1)+" "+this.format(0),t.appendChild(d),(d=document.createElement(mxClient.VML_PREFIX+":textpath")).style.cssText="v-text-align:"+s,d.style.align=s,d.style.fontFamily=a.fontFamily,d.string=i,d.on="true",s=Math.round(a.fontSize*a.scale/this.vmlScale),d.style.fontSize=s+"px",(a.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&(d.style.fontWeight="bold"),(a.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&(d.style.fontStyle="italic"),(a.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&(d.style.textDecoration="underline"),a=s+((i=i.split("\n")).length-1)*s*mxConstants.LINE_HEIGHT,s=i=0,o==mxConstants.ALIGN_BOTTOM?s=-a/2:o!=mxConstants.ALIGN_MIDDLE&&(s=a/2),null!=m&&(o=(t.style.rotation=m)*(Math.PI/180),i=Math.sin(o)*s,s*=Math.cos(o)),t.appendChild(d),t.style.left=this.format(e-i)+"px",t.style.top=this.format(n+s)+"px",this.root.appendChild(t)},mxVmlCanvas2D.prototype.stroke=function(){this.addNode(!1,!0)},mxVmlCanvas2D.prototype.fill=function(){this.addNode(!0,!1)},mxVmlCanvas2D.prototype.fillAndStroke=function(){this.addNode(!0,!0)},mxGuide.prototype.graph=null,mxGuide.prototype.states=null,mxGuide.prototype.horizontal=!0,mxGuide.prototype.vertical=!0,mxGuide.prototype.guideX=null,mxGuide.prototype.guideY=null,mxGuide.prototype.setStates=function(e){this.states=e},mxGuide.prototype.isEnabledForEvent=function(e){return!0},mxGuide.prototype.getGuideTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxGuide.prototype.createGuideShape=function(e){return(e=new mxPolyline([],mxConstants.GUIDE_COLOR,mxConstants.GUIDE_STROKEWIDTH)).isDashed=!0,e},mxGuide.prototype.move=function(a,e,n){if(null!=this.states&&(this.horizontal||this.vertical)&&null!=a&&null!=e){var t=this.graph.getView().translate,i=this.graph.getView().scale,s=e.x,o=e.y,r=!1,l=!1,d=f=this.getGuideTolerance(),c=f;(f=a.clone()).x+=e.x,f.y+=e.y;var m=f.x,u=f.x+f.width,p=f.getCenterX(),g=f.y,v=f.y+f.height,h=f.getCenterY();e=function(e){e+=this.graph.panDx;var n=!1;if(Math.abs(e-p)<d?(s=e-a.getCenterX(),d=Math.abs(e-p),n=!0):Math.abs(e-m)<d?(s=e-a.x,d=Math.abs(e-m),n=!0):Math.abs(e-u)<d&&(s=e-a.x-a.width,d=Math.abs(e-u),n=!0),n){null==this.guideX&&(this.guideX=this.createGuideShape(!0),this.guideX.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.guideX.pointerEvents=!1,this.guideX.init(this.graph.getView().getOverlayPane()));var t=this.graph.container;e-=this.graph.panDx,this.guideX.points=[new mxPoint(e,-this.graph.panDy),new mxPoint(e,t.scrollHeight-3-this.graph.panDy)]}r=r||n};for(var f=function(e){e+=this.graph.panDy;var n=!1;if(Math.abs(e-h)<c?(o=e-a.getCenterY(),c=Math.abs(e-h),n=!0):Math.abs(e-g)<c?(o=e-a.y,c=Math.abs(e-g),n=!0):Math.abs(e-v)<c&&(o=e-a.y-a.height,c=Math.abs(e-v),n=!0),n){null==this.guideY&&(this.guideY=this.createGuideShape(!1),this.guideY.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.guideY.pointerEvents=!1,this.guideY.init(this.graph.getView().getOverlayPane()));var t=this.graph.container;e-=this.graph.panDy,this.guideY.points=[new mxPoint(-this.graph.panDx,e),new mxPoint(t.scrollWidth-3-this.graph.panDx,e)]}l=l||n},b=0;b<this.states.length;b++){var A=this.states[b];null!=A&&(this.horizontal&&(e.call(this,A.getCenterX()),e.call(this,A.x),e.call(this,A.x+A.width)),this.vertical&&(f.call(this,A.getCenterY()),f.call(this,A.y),f.call(this,A.y+A.height)))}r||null==this.guideX?null!=this.guideX&&(this.guideX.node.style.visibility="visible",this.guideX.redraw()):this.guideX.node.style.visibility="hidden",l||null==this.guideY?null!=this.guideY&&(this.guideY.node.style.visibility="visible",this.guideY.redraw()):this.guideY.node.style.visibility="hidden",n&&(r||(n=a.x-(this.graph.snap(a.x/i-t.x)+t.x)*i,s=this.graph.snap(s/i)*i-n),l||(t=a.y-(this.graph.snap(a.y/i-t.y)+t.y)*i,o=this.graph.snap(o/i)*i-t)),e=new mxPoint(s,o)}return e},mxGuide.prototype.hide=function(){null!=this.guideX&&(this.guideX.node.style.visibility="hidden"),null!=this.guideY&&(this.guideY.node.style.visibility="hidden")},mxGuide.prototype.destroy=function(){null!=this.guideX&&(this.guideX.destroy(),this.guideX=null),null!=this.guideY&&(this.guideY.destroy(),this.guideY=null)},mxStencil.defaultLocalized=!1,mxStencil.prototype.desc=null,mxStencil.prototype.constraints=null,mxStencil.prototype.aspect=null,mxStencil.prototype.w0=null,mxStencil.prototype.h0=null,mxStencil.prototype.bgNode=null,mxStencil.prototype.fgNode=null,mxStencil.prototype.strokewidth=null,mxStencil.prototype.parseDescription=function(){this.fgNode=this.desc.getElementsByTagName("foreground")[0],this.bgNode=this.desc.getElementsByTagName("background")[0],this.w0=Number(this.desc.getAttribute("w")||100),this.h0=Number(this.desc.getAttribute("h")||100);var e=this.desc.getAttribute("aspect");this.aspect=null!=e?e:"variable",e=this.desc.getAttribute("strokewidth"),this.strokewidth=null!=e?e:"1"},mxStencil.prototype.parseConstraints=function(){var e=this.desc.getElementsByTagName("connections")[0];if(null!=e&&(null!=(e=mxUtils.getChildNodes(e))&&0<e.length)){this.constraints=[];for(var n=0;n<e.length;n++)this.constraints.push(this.parseConstraint(e[n]))}},mxStencil.prototype.parseConstraint=function(e){var n=Number(e.getAttribute("x")),t=Number(e.getAttribute("y"));return e="1"==e.getAttribute("perimeter"),new mxConnectionConstraint(new mxPoint(n,t),e)},mxStencil.prototype.evaluateTextAttribute=function(e,n,t){return n=this.evaluateAttribute(e,n,t),e=e.getAttribute("localized"),(mxStencil.defaultLocalized&&null==e||"1"==e)&&(n=mxResources.get(n)),n},mxStencil.prototype.evaluateAttribute=function(e,n,t){return null==(n=e.getAttribute(n))&&(null!=(e=mxUtils.getTextContent(e))&&("function"==typeof(e=mxUtils.eval(e))&&(n=e(t)))),n},mxStencil.prototype.drawShape=function(e,n,t,a,i,s){this.drawChildren(e,n,t,a,i,s,this.bgNode,!1),this.drawChildren(e,n,t,a,i,s,this.fgNode,!0)},mxStencil.prototype.drawChildren=function(e,n,t,a,i,s,o,r){if(null!=o){var l=mxUtils.getValue(n.style,mxConstants.STYLE_DIRECTION,null);for(t=this.computeAspect(n.style,t,a,i,s,l),a=Math.min(t.width,t.height),a="inherit"==this.strokewidth?Number(mxUtils.getNumber(n.style,mxConstants.STYLE_STROKEWIDTH,1)):Number(this.strokewidth)*a,e.setStrokeWidth(a),o=o.firstChild;null!=o;)o.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,n,o,t,r),o=o.nextSibling}},mxStencil.prototype.computeAspect=function(e,n,t,a,i,s){e=n,n=a/this.w0;var o=i/this.h0;if(s="north"==s||"south"==s){o=a/this.h0,n=i/this.w0;var r=(a-i)/2;e+=r,t-=r}return"fixed"==this.aspect&&(n=o=Math.min(n,o),s?(e+=(i-this.w0*n)/2,t+=(a-this.h0*o)/2):(e+=(a-this.w0*n)/2,t+=(i-this.h0*o)/2)),new mxRectangle(e,t,n,o)},mxStencil.prototype.drawNode=function(e,n,t,a,i){var s=t.nodeName,o=a.x,r=a.y,l=a.width,d=a.height,c=Math.min(l,d);if("save"==s)e.save();else if("restore"==s)e.restore();else if("path"==s)for(e.begin(),t=t.firstChild;null!=t;)t.nodeType==mxConstants.NODETYPE_ELEMENT&&this.drawNode(e,n,t,a,i),t=t.nextSibling;else if("close"==s)e.close();else if("move"==s)e.moveTo(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("line"==s)e.lineTo(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("quad"==s)e.quadTo(o+Number(t.getAttribute("x1"))*l,r+Number(t.getAttribute("y1"))*d,o+Number(t.getAttribute("x2"))*l,r+Number(t.getAttribute("y2"))*d);else if("curve"==s)e.curveTo(o+Number(t.getAttribute("x1"))*l,r+Number(t.getAttribute("y1"))*d,o+Number(t.getAttribute("x2"))*l,r+Number(t.getAttribute("y2"))*d,o+Number(t.getAttribute("x3"))*l,r+Number(t.getAttribute("y3"))*d);else if("arc"==s)e.arcTo(Number(t.getAttribute("rx"))*l,Number(t.getAttribute("ry"))*d,Number(t.getAttribute("x-axis-rotation")),Number(t.getAttribute("large-arc-flag")),Number(t.getAttribute("sweep-flag")),o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d);else if("rect"==s)e.rect(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d);else if("roundrect"==s)0==(n=t.getAttribute("arcsize"))&&(n=100*mxConstants.RECTANGLE_ROUNDING_FACTOR),c=Number(t.getAttribute("w"))*l,a=Number(t.getAttribute("h"))*d,n=Number(n)/100,n=Math.min(c*n,a*n),e.roundrect(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,c,a,n,n);else if("ellipse"==s)e.ellipse(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d);else if("image"==s)n=this.evaluateAttribute(t,"src",n),e.image(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,Number(t.getAttribute("w"))*l,Number(t.getAttribute("h"))*d,n,!1,"1"==t.getAttribute("flipH"),"1"==t.getAttribute("flipV"));else if("text"==s){if(c=this.evaluateTextAttribute(t,"str",n),a="1"==t.getAttribute("vertical")?-90:0,"0"==t.getAttribute("align-shape")){var m=n.rotation,u=1==mxUtils.getValue(n.style,mxConstants.STYLE_FLIPH,0);n=1==mxUtils.getValue(n.style,mxConstants.STYLE_FLIPV,0),a=u&&n?a-m:u||n?a+m:a-m}a-=t.getAttribute("rotation"),e.text(o+Number(t.getAttribute("x"))*l,r+Number(t.getAttribute("y"))*d,0,0,c,t.getAttribute("align")||"left",t.getAttribute("valign")||"top",!1,"",!1,!1,a)}else if("include-shape"==s)null!=(m=mxStencilRegistry.getStencil(t.getAttribute("name")))&&(o+=Number(t.getAttribute("x"))*l,r+=Number(t.getAttribute("y"))*d,c=Number(t.getAttribute("w"))*l,a=Number(t.getAttribute("h"))*d,m.drawShape(e,n,o,r,c,a));else if("fillstroke"==s)e.fillAndStroke();else if("fill"==s)e.fill();else if("stroke"==s)e.stroke();else if("strokewidth"==s)e.setStrokeWidth(Number(t.getAttribute("width"))*c);else if("dashed"==s)e.setDashed("1"==t.getAttribute("dashed"));else if("dashpattern"==s){if(null!=(t=t.getAttribute("pattern"))){for(t=t.split(" "),l=[],d=0;d<t.length;d++)0<t[d].length&&l.push(Number(t[d])*c);t=l.join(" "),e.setDashPattern(t)}}else"strokecolor"==s?e.setStrokeColor(t.getAttribute("color")):"linecap"==s?e.setLineCap(t.getAttribute("cap")):"linejoin"==s?e.setLineJoin(t.getAttribute("join")):"miterlimit"==s?e.setMiterLimit(Number(t.getAttribute("limit"))):"fillcolor"==s?e.setFillColor(t.getAttribute("color")):"alpha"==s?e.setAlpha(t.getAttribute("alpha")):"fontcolor"==s?e.setFontColor(t.getAttribute("color")):"fontstyle"==s?e.setFontStyle(t.getAttribute("style")):"fontfamily"==s?e.setFontFamily(t.getAttribute("family")):"fontsize"==s&&e.setFontSize(Number(t.getAttribute("size"))*c);i&&("fillstroke"==s||"fill"==s||"stroke"==s)&&e.setShadow(!1)},mxShape.prototype.dialect=null,mxShape.prototype.scale=1,mxShape.prototype.bounds=null,mxShape.prototype.points=null,mxShape.prototype.node=null,mxShape.prototype.style=null,mxShape.prototype.style=null,mxShape.prototype.boundingBox=null,mxShape.prototype.stencil=null,mxShape.prototype.svgStrokeTolerance=6,mxShape.prototype.pointerEvents=!0,mxShape.prototype.stencilPointerEvents=!1,mxShape.prototype.vmlScale=1,mxShape.prototype.init=function(e){null==this.node&&(this.node=this.create(e),null!=e&&e.appendChild(this.node))},mxShape.prototype.isParseVml=function(){return!0},mxShape.prototype.isHtmlAllowed=function(){return!1},mxShape.prototype.getSvgScreenOffset=function(){return 1==mxUtils.mod(Math.max(1,Math.round(this.strokewidth*this.scale)),2)?.5:0},mxShape.prototype.create=function(e){return null!=e.ownerSVGElement?this.createSvg(e):8==document.documentMode||this.dialect==mxConstants.DIALECT_SVG||this.dialect!=mxConstants.DIALECT_VML&&this.isHtmlAllowed()?this.createHtml(e):this.createVml(e)},mxShape.prototype.createSvg=function(){return document.createElementNS(mxConstants.NS_SVG,"g")},mxShape.prototype.createVml=function(){var e=document.createElement(mxClient.VML_PREFIX+":group");return e.style.position="absolute",e},mxShape.prototype.createHtml=function(){var e=document.createElement("div");return e.style.position="absolute",e},mxShape.prototype.reconfigure=function(){this.redraw()},mxShape.prototype.redraw=function(){this.updateBoundsFromPoints(),this.checkBounds()?(this.node.style.visibility="","DIV"==this.node.nodeName&&this.isHtmlAllowed()?this.redrawHtmlShape():this.redrawShape(),this.updateBoundingBox()):(this.node.style.visibility="hidden",this.boundingBox=null)},mxShape.prototype.updateBoundsFromPoints=function(){var e=this.points;if(null!=e&&0<e.length&&null!=e[0]){this.bounds=new mxRectangle(Number(e[0].x),Number(e[0].y),1,1);for(var n=1;n<this.points.length;n++)null!=e[n]&&this.bounds.add(new mxRectangle(Number(e[n].x),Number(e[n].y),1,1))}},mxShape.prototype.checkBounds=function(){return null!=this.bounds&&!isNaN(this.bounds.x)&&!isNaN(this.bounds.y)&&!isNaN(this.bounds.width)&&!isNaN(this.bounds.height)&&0<this.bounds.width&&0<this.bounds.height},mxShape.prototype.createVmlGroup=function(){var e=document.createElement(mxClient.VML_PREFIX+":group");return e.style.position="absolute",e.style.width=this.node.style.width,e.style.height=this.node.style.height,e},mxShape.prototype.redrawShape=function(){var e=this.createCanvas();for(e.pointerEvents=this.pointerEvents;this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);this.paint(e),this.node!=e.root&&this.node.insertAdjacentHTML("beforeend",e.root.outerHTML),"DIV"==this.node.nodeName&&8==document.documentMode&&(this.node.style.filter="",(null==this.stencil||!this.stencilPointerEvents)&&mxUtils.addTransparentBackgroundFilter(this.node)),this.destroyCanvas(e)},mxShape.prototype.createCanvas=function(){var e=null,n=null;if(null!=this.node.ownerSVGElement)(e=new mxSvgCanvas2D(this.node,!1)).strokeTolerance=this.svgStrokeTolerance,e.blockImagePointerEvents=mxClient.IS_NS&&!mxClient.IS_SF&&!mxClient.IS_GC,0!=(n=this.getSvgScreenOffset())?this.node.setAttribute("transform","translate("+n+","+n+")"):this.node.removeAttribute("transform");else{this.updateVmlContainer();var t=Math.max(1,Math.round(this.bounds.width)),a=Math.max(1,Math.round(this.bounds.height));n=8==document.documentMode&&this.isParseVml()?this.createVmlGroup():this.node,e=new mxVmlCanvas2D(n,!1);""!=n.tagUrn&&(n.coordsize=t*this.vmlScale+","+a*this.vmlScale,e.scale(this.vmlScale),e.vmlScale=this.vmlScale),n=this.scale,e.translate(-Math.round(this.bounds.x/n),-Math.round(this.bounds.y/n))}return e},mxShape.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px";var e=Math.max(1,Math.round(this.bounds.width)),n=Math.max(1,Math.round(this.bounds.height));this.node.style.width=e+"px",this.node.style.height=n+"px",this.node.style.overflow="visible"},mxShape.prototype.destroyCanvas=function(e){if(e instanceof mxSvgCanvas2D){for(var n in e.gradients){var t=e.gradients[n];t.mxRefCount=(t.mxRefCount||0)+1}this.releaseSvgGradients(this.oldGradients),this.oldGradients=e.gradients}},mxShape.prototype.paint=function(e){var n=this.scale,t=this.bounds.x/n,a=this.bounds.y/n,i=this.bounds.width/n,s=this.bounds.height/n;if(this.isPaintBoundsInverted()){t=t+(o=(i-s)/2),a=a-o;var o=i;i=s,s=o}if(this.updateTransform(e,t,a,i,s),this.configureCanvas(e,t,a,i,s),null!=this.stencil)this.paintStencilShape(e,t,a,i,s);else if(e.setStrokeWidth(this.strokewidth),null!=this.points){for(t=[],a=0;a<this.points.length;a++)t.push(new mxPoint(this.points[a].x/n,this.points[a].y/n));this.paintEdgeShape(e,t)}else this.paintVertexShape(e,t,a,i,s)},mxShape.prototype.configureCanvas=function(e,n,t,a,i){var s=null;null!=this.style&&(s=this.style.dashPattern),e.setAlpha(this.opacity/100),null!=this.isShadow&&e.setShadow(this.isShadow),null!=this.isDashed&&e.setDashed(this.isDashed),null!=s&&e.setDashPattern(s),null!=this.gradient?(n=this.getGradientBounds(e,n,t,a,i),e.setGradient(this.fill,this.gradient,n.x,n.y,n.width,n.height,this.gradientDirection)):e.setFillColor(this.fill),e.setStrokeColor(this.stroke)},mxShape.prototype.getGradientBounds=function(e,n,t,a,i){return new mxRectangle(n,t,a,i)},mxShape.prototype.updateTransform=function(e,n,t,a,i){e.scale(this.scale),e.rotate(this.getShapeRotation(),this.flipH,this.flipV,n+a/2,t+i/2)},mxShape.prototype.paintStencilShape=function(e,n,t,a,i){this.stencilPointerEvents&&(this.dialect==mxConstants.DIALECT_SVG?this.addTransparentBackgroundRectangle(this.node,n,t,a,i):8!=document.documentMode&&this.setTransparentBackgroundImage(this.node)),this.stencil.drawShape(e,this,n,t,a,i)},mxShape.prototype.paintVertexShape=function(e,n,t,a,i){this.paintBackground(e,n,t,a,i),e.setShadow(!1),this.paintForeground(e,n,t,a,i)},mxShape.prototype.paintBackground=function(e,n,t,a,i){},mxShape.prototype.paintForeground=function(e,n,t,a,i){},mxShape.prototype.paintEdgeShape=function(e,n){},mxShape.prototype.getArcSize=function(e,n){var t=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;return Math.min(e*t,n*t)},mxShape.prototype.paintGlassEffect=function(e,n,t,a,i,s){var o=Math.ceil(this.strokewidth/2);e.setGradient("#ffffff","#ffffff",n,t,a,.6*i,"south",.9,.1),e.begin(),s+=2*o,this.isRounded?(e.moveTo(n-o+s,t-o),e.quadTo(n-o,t-o,n-o,t-o+s),e.lineTo(n-o,t+.4*i),e.quadTo(n+.5*a,t+.7*i,n+a+o,t+.4*i),e.lineTo(n+a+o,t-o+s),e.quadTo(n+a+o,t-o,n+a+o-s,t-o)):(e.moveTo(n-o,t-o),e.lineTo(n-o,t+.4*i),e.quadTo(n+.5*a,t+.7*i,n+a+o,t+.4*i),e.lineTo(n+a+o,t-o)),e.close(),e.fill()},mxShape.prototype.apply=function(e){this.state=e,this.style=e.style,null!=this.style&&(this.fill=mxUtils.getValue(this.style,mxConstants.STYLE_FILLCOLOR,this.fill),this.gradient=mxUtils.getValue(this.style,mxConstants.STYLE_GRADIENTCOLOR,this.gradient),this.gradientDirection=mxUtils.getValue(this.style,mxConstants.STYLE_GRADIENT_DIRECTION,this.gradientDirection),this.opacity=mxUtils.getValue(this.style,mxConstants.STYLE_OPACITY,this.opacity),this.stroke=mxUtils.getValue(this.style,mxConstants.STYLE_STROKECOLOR,this.stroke),this.strokewidth=mxUtils.getNumber(this.style,mxConstants.STYLE_STROKEWIDTH,this.strokewidth),this.spacing=mxUtils.getValue(this.style,mxConstants.STYLE_SPACING,this.spacing),this.startSize=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,this.startSize),this.endSize=mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,this.endSize),this.startArrow=mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,this.startArrow),this.endArrow=mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,this.endArrow),this.rotation=mxUtils.getValue(this.style,mxConstants.STYLE_ROTATION,this.rotation),this.direction=mxUtils.getValue(this.style,mxConstants.STYLE_DIRECTION,this.direction),this.flipH=1==mxUtils.getValue(this.style,mxConstants.STYLE_FLIPH,0),this.flipV=1==mxUtils.getValue(this.style,mxConstants.STYLE_FLIPV,0),null!=this.stencil&&(this.flipH=1==mxUtils.getValue(this.style,"stencilFlipH",0)||this.flipH,this.flipV=1==mxUtils.getValue(this.style,"stencilFlipV",0)||this.flipV),"north"!=this.direction&&"south"!=this.direction||(e=this.flipH,this.flipH=this.flipV,this.flipV=e),this.isShadow=1==mxUtils.getValue(this.style,mxConstants.STYLE_SHADOW,this.isShadow),this.isDashed=1==mxUtils.getValue(this.style,mxConstants.STYLE_DASHED,this.isDashed),this.isRounded=1==mxUtils.getValue(this.style,mxConstants.STYLE_ROUNDED,this.isRounded),this.glass=1==mxUtils.getValue(this.style,mxConstants.STYLE_GLASS,this.glass),"none"==this.fill&&(this.fill=null),"none"==this.gradient&&(this.gradient=null),"none"==this.stroke&&(this.stroke=null))},mxShape.prototype.setCursor=function(e){null==e&&(e=""),this.cursor=e,null!=this.node&&(this.node.style.cursor=e)},mxShape.prototype.getCursor=function(){return this.cursor},mxShape.prototype.updateBoundingBox=function(){if(null!=this.bounds){var e=this.createBoundingBox();if(null!=e){this.augmentBoundingBox(e);var n=this.getShapeRotation();0!=n&&(e=mxUtils.getBoundingBox(e,n)),e.x=Math.floor(e.x),e.y=Math.floor(e.y),e.width=Math.ceil(e.width),e.height=Math.ceil(e.height)}this.boundingBox=e}},mxShape.prototype.createBoundingBox=function(){var e=this.bounds.clone();if(this.isPaintBoundsInverted()){var n=(e.width-e.height)/2;e.x+=n,e.y-=n,n=e.width,e.width=e.height,e.height=n}return e},mxShape.prototype.augmentBoundingBox=function(e){this.isShadow&&(e.width+=Math.ceil(mxConstants.SHADOW_OFFSET_X*this.scale),e.height+=Math.ceil(mxConstants.SHADOW_OFFSET_Y*this.scale));var n=Math.ceil(this.strokewidth*this.scale);e.grow(Math.ceil(n/2))},mxShape.prototype.isPaintBoundsInverted=function(){return null==this.stencil&&("north"==this.direction||"south"==this.direction)},mxShape.prototype.getRotation=function(){return null!=this.rotation?this.rotation:0},mxShape.prototype.getTextRotation=function(){var e=this.getRotation();return 1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)&&(e+=mxText.prototype.verticalTextRotation),e},mxShape.prototype.getShapeRotation=function(){var e=this.getRotation();return null!=this.direction&&("north"==this.direction?e+=270:"west"==this.direction?e+=180:"south"==this.direction&&(e+=90)),e},mxShape.prototype.addTransparentBackgroundRectangle=function(e,n,t,a,i){(e=document.createElementNS(mxConstants.NS_SVG,"rect")).setAttribute("x",n),e.setAttribute("y",t),e.setAttribute("width",a),e.setAttribute("height",i),e.setAttribute("fill","none"),e.setAttribute("stroke","none"),e.setAttribute("pointer-events","all"),this.node.appendChild(e)},mxShape.prototype.setTransparentBackgroundImage=function(e){e.style.backgroundImage="url('"+mxClient.imageBasePath+"/transparent.gif')"},mxShape.prototype.releaseSvgGradients=function(e){if(null!=e)for(var n in e){var t=e[n];t.mxRefCount=(t.mxRefCount||0)-1,0==t.mxRefCount&&null!=t.parentNode&&t.parentNode.removeChild(t)}},mxShape.prototype.destroy=function(){null!=this.node&&(mxEvent.release(this.node),null!=this.node.parentNode&&this.node.parentNode.removeChild(this.node),this.node=null),this.releaseSvgGradients(this.oldGradients),this.oldGradients=null};var mxStencilRegistry={stencils:[],addStencil:function(e,n){mxStencilRegistry.stencils[e]=n},getStencil:function(e){return mxStencilRegistry.stencils[e]}},mxMarker={markers:[],addMarker:function(e,n){mxMarker.markers[e]=n},createMarker:function(e,n,t,a,i,s,o,r,l,d){var c=mxMarker.markers[t];return null!=c?c(e,n,t,a,i,s,o,r,l,d):null}};function mxActor(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxCloud(e,n,t,a){mxActor.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxRectangleShape(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxEllipse(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxDoubleEllipse(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxRhombus(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxPolyline(e,n,t){mxShape.call(this),this.points=e,this.stroke=n,this.strokewidth=null!=t?t:1}function mxArrow(e,n,t,a,i,s,o){mxShape.call(this),this.points=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1,this.arrowWidth=null!=i?i:mxConstants.ARROW_WIDTH,this.spacing=null!=s?s:mxConstants.ARROW_SPACING,this.endSize=null!=o?o:mxConstants.ARROW_SIZE}function mxText(e,n,t,a,i,s,o,r,l,d,c,m,u,p,g,v,h,f,b,A){mxShape.call(this),this.value=e,this.bounds=n,this.color=null!=i?i:"black",this.align=null!=t?t:"",this.valign=null!=a?a:"",this.family=null!=s?s:mxConstants.DEFAULT_FONTFAMILY,this.size=null!=o?o:mxConstants.DEFAULT_FONTSIZE,this.fontStyle=null!=r?r:mxConstants.DEFAULT_FONTSTYLE,this.spacing=parseInt(l||2),this.spacingTop=this.spacing+parseInt(d||0),this.spacingRight=this.spacing+parseInt(c||0),this.spacingBottom=this.spacing+parseInt(m||0),this.spacingLeft=this.spacing+parseInt(u||0),this.horizontal=null==p||p,this.background=g,this.border=v,this.wrap=null!=h&&h,this.clipped=null!=f&&f,this.overflow=null!=b?b:"visible",this.labelPadding=null!=A?A:0,this.rotation=0}function mxTriangle(){mxActor.call(this)}function mxHexagon(){mxActor.call(this)}function mxLine(e,n,t){mxShape.call(this),this.bounds=e,this.stroke=n,this.strokewidth=null!=t?t:1}function mxImageShape(e,n,t,a,i){mxShape.call(this),this.bounds=e,this.image=n,this.fill=t,this.stroke=a,this.strokewidth=null!=i?i:1,this.shadow=!1}function mxLabel(e,n,t,a){mxRectangleShape.call(this,e,n,t,a)}function mxCylinder(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxConnector(e,n,t){mxPolyline.call(this,e,n,t)}function mxSwimlane(e,n,t,a){mxShape.call(this),this.bounds=e,this.fill=n,this.stroke=t,this.strokewidth=null!=a?a:1}function mxGraphLayout(e){this.graph=e}function mxStackLayout(e,n,t,a,i,s){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.spacing=null!=t?t:0,this.x0=null!=a?a:0,this.y0=null!=i?i:0,this.border=null!=s?s:0}function mxPartitionLayout(e,n,t,a){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.spacing=t||0,this.border=a||0}function mxCompactTreeLayout(e,n,t){mxGraphLayout.call(this,e),this.horizontal=null==n||n,this.invert=null!=t&&t}function WeightedCellSorter(e,n){this.cell=e,this.weightedValue=n}function mxFastOrganicLayout(e){mxGraphLayout.call(this,e)}function mxCircleLayout(e,n){mxGraphLayout.call(this,e),this.radius=null!=n?n:100}function mxParallelEdgeLayout(e){mxGraphLayout.call(this,e)}function mxCompositeLayout(e,n,t){mxGraphLayout.call(this,e),this.layouts=n,this.master=t}function mxEdgeLabelLayout(e,n){mxGraphLayout.call(this,e)}function mxGraphAbstractHierarchyCell(){this.x=[],this.y=[],this.temp=[]}function mxGraphHierarchyNode(e){mxGraphAbstractHierarchyCell.apply(this,arguments),this.cell=e}function mxGraphHierarchyEdge(e){mxGraphAbstractHierarchyCell.apply(this,arguments),this.edges=e}function mxGraphHierarchyModel(e,n,t,a,i){for(e.getGraph(),this.tightenToSource=i,this.roots=t,this.parent=a,this.vertexMapper={},this.edgeMapper={},this.maxRank=0,t=[],null==n&&(n=this.graph.getChildVertices(a)),this.maxRank=this.SOURCESCANSTARTRANK,this.createInternalCells(e,n,t),a=0;a<n.length;a++){i=t[a].connectsAsSource;for(var s=0;s<i.length;s++){var o=i[s];if(null!=(r=o.edges)&&0<r.length){var r=r[0],l=e.getVisibleTerminal(r,!1);l=mxCellPath.create(l),l=this.vertexMapper[l];t[a]==l&&(l=e.getVisibleTerminal(r,!0),l=mxCellPath.create(l),l=this.vertexMapper[l]),null!=l&&t[a]!=l&&(0==(o.target=l).connectsAsTarget.length&&(l.connectsAsTarget=[]),mxUtils.indexOf(l.connectsAsTarget,o)<0&&l.connectsAsTarget.push(o))}}t[a].temp[0]=1}}function mxHierarchicalLayoutStage(){}function mxMedianHybridCrossingReduction(e){this.layout=e}function MedianCellSorter(){}function mxMinimumCycleRemover(e){this.layout=e}function mxCoordinateAssignment(e,n,t,a,i,s){this.layout=e,this.intraCellSpacing=n,this.interRankCellSpacing=t,this.orientation=a,this.initialX=i,this.parallelEdgeSpacing=s}!function(){function e(e,n,t,a,i,s,o,r,l,d){n=1.118*i*l,r=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=n,c.y-=r,o=t!=mxConstants.ARROW_CLASSIC?1:.75,a.x+=-i*o-n,a.y+=-s*o-r,function(){e.begin(),e.moveTo(c.x,c.y),e.lineTo(c.x-i-s/2,c.y-s+i/2),t==mxConstants.ARROW_CLASSIC&&e.lineTo(c.x-3*i/4,c.y-3*s/4),e.lineTo(c.x+s/2-i,c.y-s-i/2),e.close(),d?e.fillAndStroke():e.stroke()}}function n(e,n,t,a,i,s,o,r,l,d){r=t==mxConstants.ARROW_DIAMOND?.7071:.9862,n=i*l*r,r*=s*l,i*=o+l,s*=o+l;var c=a.clone();c.x-=n,c.y-=r,a.x+=-i-n,a.y+=-s-r;var m=t==mxConstants.ARROW_DIAMOND?2:3.4;return function(){e.begin(),e.moveTo(c.x,c.y),e.lineTo(c.x-i/2-s/m,c.y+i/m-s/2),e.lineTo(c.x-i,c.y-s),e.lineTo(c.x-i/2+s/m,c.y-s/2-i/m),e.close(),d?e.fillAndStroke():e.stroke()}}mxMarker.addMarker("classic",e),mxMarker.addMarker("block",e),mxMarker.addMarker("open",function(e,n,t,a,i,s,o,r,l,d){n=1.118*i*l,t=1.118*s*l,i*=o+l,s*=o+l;var c=a.clone();return c.x-=n,c.y-=t,a.x+=2*-n,a.y+=2*-t,function(){e.begin(),e.moveTo(c.x-i-s/2,c.y-s+i/2),e.lineTo(c.x,c.y),e.lineTo(c.x+s/2-i,c.y-s-i/2),e.stroke()}}),mxMarker.addMarker("oval",function(e,n,t,a,i,s,o,r,l,d){var c=o/2,m=a.clone();return a.x-=i*c,a.y-=s*c,function(){e.ellipse(m.x-c,m.y-c,o,o),d?e.fillAndStroke():e.stroke()}}),mxMarker.addMarker("diamond",n),mxMarker.addMarker("diamondThin",n)}(),mxUtils.extend(mxActor,mxShape),mxActor.prototype.paintVertexShape=function(e,n,t,a,i){e.translate(n,t),e.begin(),this.redrawPath(e,n,t,a,i),e.fillAndStroke()},mxActor.prototype.redrawPath=function(e,n,t,a,i){n=a/3,e.moveTo(0,i),e.curveTo(0,3*i/5,0,2*i/5,a/2,2*i/5),e.curveTo(a/2-n,2*i/5,a/2-n,0,a/2,0),e.curveTo(a/2+n,0,a/2+n,2*i/5,a/2,2*i/5),e.curveTo(a,2*i/5,a,3*i/5,a,i),e.close()},mxUtils.extend(mxCloud,mxActor),mxCloud.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(.25*a,.25*i),e.curveTo(.05*a,.25*i,0,.5*i,.16*a,.55*i),e.curveTo(0,.66*i,.18*a,.9*i,.31*a,.8*i),e.curveTo(.4*a,i,.7*a,i,.8*a,.8*i),e.curveTo(a,.8*i,a,.6*i,.875*a,.5*i),e.curveTo(a,.3*i,.8*a,.1*i,.625*a,.2*i),e.curveTo(.5*a,.05*i,.3*a,.05*i,.25*a,.25*i),e.close()},mxUtils.extend(mxRectangleShape,mxShape),mxRectangleShape.prototype.isHtmlAllowed=function(){return!this.isRounded&&!this.glass&&0==this.rotation},mxRectangleShape.prototype.paintBackground=function(e,n,t,a,i){if(this.isRounded){var s=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100;s=Math.min(a*s,i*s);e.roundrect(n,t,a,i,s,s)}else e.rect(n,t,a,i);e.fillAndStroke()},mxRectangleShape.prototype.paintForeground=function(e,n,t,a,i){this.glass&&this.paintGlassEffect(e,n,t,a,i,this.getArcSize(a+this.strokewidth,i+this.strokewidth))},mxRectangleShape.prototype.redrawHtmlShape=function(){this.updateHtmlBounds(this.node),this.updateHtmlFilters(this.node),this.updateHtmlColors(this.node)},mxRectangleShape.prototype.updateHtmlBounds=function(e){var n=9<=document.documentMode?0:Math.ceil(this.strokewidth*this.scale);e.style.borderWidth=Math.max(1,n)+"px",e.style.overflow="hidden",e.style.left=Math.round(this.bounds.x-n/2)+"px",e.style.top=Math.round(this.bounds.y-n/2)+"px","CSS1Compat"==document.compatMode&&(n=-n),e.style.width=Math.round(Math.max(0,this.bounds.width+n))+"px",e.style.height=Math.round(Math.max(0,this.bounds.height+n))+"px"},mxRectangleShape.prototype.updateHtmlColors=function(e){var n=this.stroke;null!=n&&n!=mxConstants.NONE?(e.style.borderColor=n,this.isDashed?e.style.borderStyle="dashed":0<this.strokewidth&&(e.style.borderStyle="solid"),e.style.borderWidth=Math.max(1,Math.ceil(this.strokewidth*this.scale))+"px"):e.style.borderWidth="0px",null!=(n=this.fill)&&n!=mxConstants.NONE?(e.style.backgroundColor=n,e.style.backgroundImage="none"):this.pointerEvents?e.style.backgroundColor="transparent":8==document.documentMode?mxUtils.addTransparentBackgroundFilter(e):this.setTransparentBackgroundImage(e)},mxRectangleShape.prototype.updateHtmlFilters=function(e){var n="";if(this.opacity<100&&(n+="alpha(opacity="+this.opacity+")"),this.isShadow&&(n+="progid:DXImageTransform.Microsoft.dropShadow (OffX='"+Math.round(mxConstants.SHADOW_OFFSET_X*this.scale)+"', OffY='"+Math.round(mxConstants.SHADOW_OFFSET_Y*this.scale)+"', Color='"+mxConstants.SHADOWCOLOR+"')"),this.gradient){var t=this.fill,a=this.gradient,i="0",s={east:0,south:1,west:2,north:3},o=null!=this.direction?s[this.direction]:0;null!=this.gradientDirection&&(o=mxUtils.mod(o+s[this.gradientDirection]-1,4)),1==o?(i="1",s=t,t=a,a=s):2==o?(s=t,t=a,a=s):3==o&&(i="1"),n+="progid:DXImageTransform.Microsoft.gradient(startColorStr='"+t+"', endColorStr='"+a+"', gradientType='"+i+"')"}e.style.filter=n},mxUtils.extend(mxEllipse,mxShape),mxEllipse.prototype.paintVertexShape=function(e,n,t,a,i){e.ellipse(n,t,a,i),e.fillAndStroke()},mxUtils.extend(mxDoubleEllipse,mxShape),mxDoubleEllipse.prototype.vmlScale=10,mxDoubleEllipse.prototype.paintBackground=function(e,n,t,a,i){e.ellipse(n,t,a,i),e.fillAndStroke()},mxDoubleEllipse.prototype.paintForeground=function(e,n,t,a,i){var s=Math.min(4,Math.min(a/5,i/5));i-=2*s,0<(a-=2*s)&&0<i&&e.ellipse(n+s,t+s,a,i),e.stroke()},mxUtils.extend(mxRhombus,mxShape),mxRhombus.prototype.paintVertexShape=function(e,n,t,a,i){var s=a/2,o=i/2;e.begin(),e.moveTo(n+s,t),e.lineTo(n+a,t+o),e.lineTo(n+s,t+i),e.lineTo(n,t+o),e.close(),e.fillAndStroke()},mxUtils.extend(mxPolyline,mxShape),mxPolyline.prototype.getRotation=function(){return 0},mxPolyline.prototype.paintEdgeShape=function(e,n){this.paintLine(e,n,this.isRounded)},mxPolyline.prototype.paintLine=function(e,n,t){var a=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,i=n[0],s=n[n.length-1];e.begin(),e.moveTo(i.x,i.y);for(var o=1;o<n.length-1;o++){var r=n[o],l=i.x-r.x;i=i.y-r.y;if(t&&o<n.length-1&&(0!=l||0!=i)){var d=Math.sqrt(l*l+i*i);l=l*Math.min(a,d/2)/d,i=i*Math.min(a,d/2)/d;e.lineTo(r.x+l,r.y+i),l=(i=n[o+1]).x-r.x,i=i.y-r.y,d=Math.max(1,Math.sqrt(l*l+i*i)),l=l*Math.min(a,d/2)/d,i=i*Math.min(a,d/2)/d,l=r.x+l,i=r.y+i,e.quadTo(r.x,r.y,l,i),r=new mxPoint(l,i)}else e.lineTo(r.x,r.y);i=r}e.lineTo(s.x,s.y),e.stroke()},mxUtils.extend(mxArrow,mxShape),mxArrow.prototype.paintEdgeShape=function(e,n){var t=mxConstants.ARROW_SPACING,a=mxConstants.ARROW_WIDTH,i=mxConstants.ARROW_SIZE,s=n[0],o=n[n.length-1],r=o.x-s.x,l=o.y-s.y,d=(c=Math.sqrt(r*r+l*l))-2*t-i,c=(r=r/c,a*(l=l/c)/3),m=(a=-a*r/3,(i=s.x-c/2+t*r)+c),u=(s=s.y-a/2+t*l)+a,p=m+d*r,g=p+c,v=(d=u+d*l)+a,h=g-3*c,f=v-3*a;e.begin(),e.moveTo(i,s),e.lineTo(m,u),e.lineTo(p,d),e.lineTo(g,v),e.lineTo(o.x-t*r,o.y-t*l),e.lineTo(h,f),e.lineTo(h+c,f+a),e.close(),e.fillAndStroke()},mxUtils.extend(mxText,mxShape),mxText.prototype.baseSpacingTop=0,mxText.prototype.baseSpacingBottom=0,mxText.prototype.baseSpacingLeft=0,mxText.prototype.baseSpacingRight=0,mxText.prototype.replaceLinefeeds=!0,mxText.prototype.verticalTextRotation=-90,mxText.prototype.ignoreClippedStringSize=!0,mxText.prototype.ignoreStringSize=!1,mxText.prototype.isParseVml=function(){return!1},mxText.prototype.isHtmlAllowed=function(){return 8!=document.documentMode},mxText.prototype.getSvgScreenOffset=function(){return 0},mxText.prototype.checkBounds=function(){return!(null==this.bounds||isNaN(this.bounds.x)||isNaN(this.bounds.y)||isNaN(this.bounds.width)||isNaN(this.bounds.height))},mxText.prototype.updateBoundingBox=function(){var e=this.node;8==document.documentMode&&null!=e.firstChild&&(null!=(e=e.firstChild).firstChild&&(e=e.firstChild)),this.boundingBox=this.bounds.clone();var n=this.getTextRotation();if(this.ignoreStringSize||null==e||"fill"==this.overflow||this.clipped&&this.ignoreClippedStringSize)this.boundingBox.x+=this.margin.x*this.boundingBox.width,this.boundingBox.y+=this.margin.y*this.boundingBox.height;else{var t=null,a=null;if(null!=e.ownerSVGElement)if(null!=e.firstChild&&null!=e.firstChild.firstChild&&"foreignObject"==e.firstChild.firstChild.nodeName)e=e.firstChild.firstChild,t=this.wrap?this.bounds.width:parseInt(e.getAttribute("width"))*this.scale,a=parseInt(e.getAttribute("height"))*this.scale;else{if(0==(n=e.getBBox()).width&&0==n.height)return;this.boundingBox=new mxRectangle(n.x,n.y,n.width,n.height),n=0}else a=this.state.view.textDiv,a=null!=this.offsetWidth&&null!=this.offsetHeight?(t=this.wrap?this.bounds.width:this.offsetWidth*this.scale,this.offsetHeight*this.scale):null!=a?(this.updateFont(a),this.updateSize(a),mxUtils.isNode(this.value)?a.innerHTML=this.value.outerHTML:(t=this.replaceLinefeeds?this.value.replace(/\n/g,"<br/>"):this.value,a.innerHTML=t),t=this.wrap?this.bounds.width:a.offsetWidth*this.scale,a.offsetHeight*this.scale):(t=this.wrap?this.bounds.width:e.offsetWidth*this.scale,e.offsetHeight*this.scale);null!=t&&null!=a&&(this.boundingBox=new mxRectangle(this.bounds.x+this.margin.x*t,this.bounds.y+this.margin.y*a,t,a))}null!=this.boundingBox&&(0!=n&&(n=mxUtils.getBoundingBox(this.boundingBox,n),this.boundingBox.x=n.x,this.boundingBox.y=n.y,mxClient.IS_QUIRKS||(this.boundingBox.width=n.width,this.boundingBox.height=n.height)),this.boundingBox.x=Math.floor(this.boundingBox.x),this.boundingBox.y=Math.floor(this.boundingBox.y),this.boundingBox.width=Math.ceil(this.boundingBox.width),this.boundingBox.height=Math.ceil(this.boundingBox.height))},mxText.prototype.getShapeRotation=function(){return 0},mxText.prototype.getTextRotation=function(){return null!=this.state&&null!=this.state.shape?this.state.shape.getTextRotation():0},mxText.prototype.isPaintBoundsInverted=function(){return!this.horizontal&&null!=this.state&&this.state.view.graph.model.isVertex(this.state.cell)},mxText.prototype.configureCanvas=function(e,n,t,a,i){mxShape.prototype.configureCanvas.apply(this,arguments),e.setFontColor(this.color),e.setFontBackgroundColor(this.background),e.setFontBorderColor(this.border),e.setFontFamily(this.family),e.setFontSize(this.size),e.setFontStyle(this.fontStyle)},mxText.prototype.updateVmlContainer=function(){this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width="1px",this.node.style.height="1px",this.node.style.overflow="visible"},mxText.prototype.paint=function(e){var n=this.scale,t=this.bounds.x/n,a=this.bounds.y/n,i=this.bounds.width/n;n=this.bounds.height/n;this.updateTransform(e,t,a,i,n),this.configureCanvas(e,t,a,i,n);var s=mxUtils.isNode(this.value)||this.dialect==mxConstants.DIALECT_STRICTHTML,o=s||e instanceof mxVmlCanvas2D?"html":"",r=this.value;!s&&"html"==o&&(r=mxUtils.htmlEntities(r,!1)),r=!mxUtils.isNode(this.value)&&this.replaceLinefeeds&&"html"==o?r.replace(/\n/g,"<br/>"):r,e.text(t,a,i,n,r,this.align,this.valign,this.wrap,o,"fill"==this.overflow,this.clipped,this.getTextRotation())},mxText.prototype.redrawHtmlShape=function(){var e=this.node.style;e.opacity=this.opacity<1?this.opacity:"",e.overflow="",e.width="",e.height="",this.updateFont(this.node),this.updateSize(this.node),this.updateValue(),this.offsetHeight=this.offsetWidth=null,null!=mxClient.CSS_PREFIX?this.updateHtmlTransform():this.updateHtmlFilter()},mxText.prototype.updateHtmlTransform=function(){var e=this.getTextRotation(),n=this.node.style,t=this.margin.x,a=this.margin.y;0!=e?(n[mxClient.CSS_PREFIX+"TransformOrigin"]=100*-t+"% "+100*-a+"%",n[mxClient.CSS_PREFIX+"Transform"]="translate("+100*t+"%,"+100*a+"%)scale("+this.scale+") rotate("+e+"deg)"):(n[mxClient.CSS_PREFIX+"TransformOrigin"]="0% 0%",n[mxClient.CSS_PREFIX+"Transform"]="scale("+this.scale+")translate("+100*t+"%,"+100*a+"%)"),n.left=Math.round(this.bounds.x)+"px",n.top=Math.round(this.bounds.y)+"px"},mxText.prototype.updateHtmlFilter=function(){var e=this.node.style,n=this.margin.x,t=this.margin.y,a=this.scale;e.filter="";var i=0,s=0;if(null!=(r=null!=this.state?this.state.view.textDiv:null)){if(r.style.overflow="",r.style.height="",r.style.width="",this.updateFont(r),this.updateSize(r),mxUtils.isNode(this.value))r.innerHTML=this.value.outerHTML;else{var o=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(o=mxUtils.htmlEntities(o,!1)),o=this.replaceLinefeeds?o.replace(/\n/g,"<br/>"):o,r.innerHTML=o}i=r.offsetWidth+2,s=r.offsetHeight+2}else i=this.node.offsetWidth,s=this.node.offsetHeight+1;this.offsetWidth=i,this.offsetHeight=s,r=this.bounds.width/a,o=this.bounds.height/a,mxClient.IS_QUIRKS&&(this.clipped||"fill"==this.overflow)&&0<o?(o=Math.min(o,s),e.height=Math.round(o+1)+"px"):o=s,"fill"!=this.overflow&&(mxClient.IS_QUIRKS&&(this.clipped||this.wrap)&&0<r?(r=Math.min(r,i),e.width=Math.round(r)+"px"):r=i);o*=a;var r=r*a,l=(i=this.getTextRotation()*(Math.PI/180),s=parseFloat(parseFloat(Math.cos(i)).toFixed(8)),parseFloat(parseFloat(Math.sin(-i)).toFixed(8)));(i=i%(2*Math.PI))<0&&(i+=2*Math.PI),(i%=Math.PI)>Math.PI/2&&(i=Math.PI-i);var d=Math.cos(i),c=Math.sin(-i),m=(o-o*d+r*c)/2+l*(n=r*-(n+.5))-s*(t=o*-(t+.5));0!=i&&(e.filter="progid:DXImageTransform.Microsoft.Matrix(M11="+s+", M12="+l+", M21="+-l+", M22="+s+", sizingMethod='auto expand')"),e.zoom=a,e.left=Math.round(this.bounds.x+((r-r*d+o*c)/2-s*n-l*t)-r/2)+"px",e.top=Math.round(this.bounds.y+m-o/2)+"px"},mxText.prototype.updateValue=function(){if(mxUtils.isNode(this.value))this.node.innerHTML="",this.node.appendChild(this.value);else{var e=this.value;this.dialect!=mxConstants.DIALECT_STRICTHTML&&(e=mxUtils.htmlEntities(e,!1));e=this.replaceLinefeeds?e.replace(/\n/g,"<br/>"):e;var n=null!=this.background&&this.background!=mxConstants.NONE?this.background:null,t=null!=this.border&&this.border!=mxConstants.NONE?this.border:null;if(null!=n||null!=t)if("fill"==this.overflow)null!=n&&(this.node.style.backgroundColor=n),null!=t&&(this.node.style.border="1px solid "+t);else{var a="";null!=n&&(a+="background-color:"+n+";"),null!=t&&(a+="border:1px solid "+t+";"),e='<div style="zoom:1;'+a+"display:inline-block;_display:inline;padding-bottom:1px;padding-right:1px;line-height:"+this.node.style.lineHeight+'">'+e+"</div>",this.node.style.lineHeight=""}this.node.innerHTML=e}},mxText.prototype.updateFont=function(e){(e=e.style).lineHeight=Math.round(this.size*mxConstants.LINE_HEIGHT)+"px",e.fontSize=Math.round(this.size)+"px",e.fontFamily=this.family,e.verticalAlign="top",e.color=this.color,e.fontWeight=(this.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD?"bold":"",e.fontStyle=(this.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC?"italic":"",e.fontDecoration=(this.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE?"underline":"",e.textAlign=this.align==mxConstants.ALIGN_CENTER?"center":this.align==mxConstants.ALIGN_RIGHT?"right":"left"},mxText.prototype.updateSize=function(e){var n=Math.round(this.bounds.width/this.scale),t=Math.round(this.bounds.height/this.scale);e=e.style,this.clipped?(e.overflow="hidden",0<t&&(e.maxHeight=t+"px"),0<n&&(e.width=n+"px")):"fill"==this.overflow&&(e.width=n+"px",0<t&&(e.maxHeight=t+"px")),this.wrap?(!this.clipped&&0<n&&(e.width=n+"px"),e.whiteSpace="normal"):e.whiteSpace="nowrap"},mxText.prototype.updateMargin=function(){this.margin=mxUtils.getAlignmentAsPoint(this.align,this.valign)},mxText.prototype.getSpacing=function(){return new mxPoint(this.align==mxConstants.ALIGN_CENTER?(this.spacingLeft-this.spacingRight)/2:this.align==mxConstants.ALIGN_RIGHT?-this.spacingRight-this.baseSpacingRight:this.spacingLeft+this.baseSpacingLeft,this.valign==mxConstants.ALIGN_MIDDLE?(this.spacingTop-this.spacingBottom)/2:this.valign==mxConstants.ALIGN_BOTTOM?-this.spacingBottom-this.baseSpacingBottom:this.spacingTop+this.baseSpacingTop)},mxUtils.extend(mxTriangle,mxActor),mxTriangle.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(0,0),e.lineTo(a,.5*i),e.lineTo(0,i),e.close()},mxUtils.extend(mxHexagon,mxActor),mxHexagon.prototype.redrawPath=function(e,n,t,a,i){e.moveTo(.25*a,0),e.lineTo(.75*a,0),e.lineTo(a,.5*i),e.lineTo(.75*a,i),e.lineTo(.25*a,i),e.lineTo(0,.5*i),e.close()},mxUtils.extend(mxLine,mxShape),mxLine.prototype.paintVertexShape=function(e,n,t,a,i){t+=i/2,e.begin(),e.moveTo(n,t),e.lineTo(n+a,t),e.stroke()},mxUtils.extend(mxImageShape,mxRectangleShape),mxImageShape.prototype.preserveImageAspect=!0,mxImageShape.prototype.getSvgScreenOffset=function(){return mxClient.IS_IE?0:.5},mxImageShape.prototype.apply=function(e){mxShape.prototype.apply.apply(this,arguments),this.gradient=this.stroke=this.fill=null,null!=this.style&&(this.fill=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BACKGROUND),this.stroke=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BORDER),this.preserveImageAspect=1==mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_ASPECT,1),this.flipH=this.flipH||1==mxUtils.getValue(this.style,"imageFlipH",0),this.flipV=this.flipV||1==mxUtils.getValue(this.style,"imageFlipV",0))},mxImageShape.prototype.isHtmlAllowed=function(){return!this.preserveImageAspect},mxImageShape.prototype.createHtml=function(){var e=document.createElement("div");return e.style.position="absolute",e},mxImageShape.prototype.paintVertexShape=function(e,n,t,a,i){if(null!=this.image){var s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BACKGROUND,null),o=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_BORDER,null);null==s&&null==o||(e.setFillColor(s),e.setStrokeColor(o),e.rect(n,t,a,i),e.fillAndStroke()),e.image(n,t,a,i,this.image,this.preserveImageAspect,!1,!1)}else mxRectangleShape.prototype.paintBackground.apply(this,arguments)},mxImageShape.prototype.redrawHtmlShape=function(){if(this.node.style.left=Math.round(this.bounds.x)+"px",this.node.style.top=Math.round(this.bounds.y)+"px",this.node.style.width=Math.max(0,Math.round(this.bounds.width))+"px",this.node.style.height=Math.max(0,Math.round(this.bounds.height))+"px",this.node.style.backgroundColor=this.fill||"",this.node.style.borderColor=this.stroke||"",this.node.innerHTML="",null!=this.image){var e=document.createElement(mxClient.IS_IE6||null==mxClient.CSS_PREFIX&&0!=this.rotation?mxClient.VML_PREFIX+":image":"img");e.style.position="absolute",e.src=this.image;var n=this.opacity<100?"alpha(opacity="+this.opacity+")":"";this.node.style.filter=n,this.flipH&&this.flipV?n+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2)":this.flipH?n+="progid:DXImageTransform.Microsoft.BasicImage(mirror=1)":this.flipV&&(n+="progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)"),e.style.filter!=n&&(e.style.filter=n),"image"==e.nodeName?e.style.rotation=this.rotation:e.style[mxClient.CSS_PREFIX+"Transform"]="rotate("+this.rotation+"deg)",e.style.width=this.node.style.width,e.style.height=this.node.style.height,this.node.style.backgroundImage="",this.node.appendChild(e)}else this.setTransparentBackgroundImage(this.node)},mxUtils.extend(mxLabel,mxRectangleShape),mxLabel.prototype.imageSize=mxConstants.DEFAULT_IMAGESIZE,mxLabel.prototype.spacing=2,mxLabel.prototype.indicatorSize=10,mxLabel.prototype.indicatorSpacing=2,mxLabel.prototype.init=function(e){mxShape.prototype.init.apply(this,arguments),null!=this.indicatorColor&&null!=this.indicatorShape&&(this.indicator=new this.indicatorShape,this.indicator.dialect=this.dialect,this.indicator.bounds=this.bounds,this.indicator.fill=this.indicatorColor,this.indicator.stroke=this.indicatorColor,this.indicator.gradient=this.indicatorGradientColor,this.indicator.direction=this.indicatorDirection,this.indicator.init(this.node))},mxLabel.prototype.redraw=function(){null!=this.indicator&&(this.indicator.fill=this.indicatorColor,this.indicator.stroke=this.indicatorColor,this.indicator.gradient=this.indicatorGradientColor,this.indicator.direction=this.indicatorDirection),mxShape.prototype.redraw.apply(this,arguments)},mxLabel.prototype.isHtmlAllowed=function(){return mxRectangleShape.prototype.isHtmlAllowed.apply(this,arguments)&&null==this.indicatorColor&&null==this.indicatorShape},mxLabel.prototype.paintForeground=function(e,n,t,a,i){this.paintImage(e,n,t,a,i),this.paintIndicator(e,n,t,a,i),mxRectangleShape.prototype.paintForeground.apply(this,arguments)},mxLabel.prototype.paintImage=function(e,n,t,a,i){null!=this.image&&(n=this.getImageBounds(n,t,a,i),e.image(n.x,n.y,n.width,n.height,this.image,!1,!1,!1))},mxLabel.prototype.getImageBounds=function(e,n,t,a){var i=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),o=mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_WIDTH,mxConstants.DEFAULT_IMAGESIZE),r=mxUtils.getNumber(this.style,mxConstants.STYLE_IMAGE_HEIGHT,mxConstants.DEFAULT_IMAGESIZE),l=mxUtils.getNumber(this.style,mxConstants.STYLE_SPACING,this.spacing)+5;return new mxRectangle(e=i==mxConstants.ALIGN_CENTER?e+(t-o)/2:i==mxConstants.ALIGN_RIGHT?e+(t-o-l):e+l,n=s==mxConstants.ALIGN_TOP?n+l:s==mxConstants.ALIGN_BOTTOM?n+(a-r-l):n+(a-r)/2,o,r)},mxLabel.prototype.paintIndicator=function(e,n,t,a,i){null!=this.indicator?(this.indicator.bounds=this.getIndicatorBounds(n,t,a,i),this.indicator.paint(e)):null!=this.indicatorImage&&(n=this.getIndicatorBounds(n,t,a,i),e.image(n.x,n.y,n.width,n.height,this.indicatorImage,!1,!1,!1))},mxLabel.prototype.getIndicatorBounds=function(e,n,t,a){var i=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_ALIGN,mxConstants.ALIGN_LEFT),s=mxUtils.getValue(this.style,mxConstants.STYLE_IMAGE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),o=mxUtils.getNumber(this.style,mxConstants.STYLE_INDICATOR_WIDTH,this.indicatorSize),r=mxUtils.getNumber(this.style,mxConstants.STYLE_INDICATOR_HEIGHT,this.indicatorSize),l=this.spacing+5;return new mxRectangle(e=i==mxConstants.ALIGN_RIGHT?e+(t-o-l):i==mxConstants.ALIGN_CENTER?e+(t-o)/2:e+l,n=s==mxConstants.ALIGN_BOTTOM?n+(a-r-l):s==mxConstants.ALIGN_TOP?n+l:n+(a-r)/2,o,r)},mxLabel.prototype.redrawHtmlShape=function(){for(mxRectangleShape.prototype.redrawHtmlShape.apply(this,arguments);this.node.hasChildNodes();)this.node.removeChild(this.node.lastChild);if(null!=this.image){var e=document.createElement("img");e.style.position="relative",e.setAttribute("border","0");var n=this.getImageBounds(this.bounds.x,this.bounds.y,this.bounds.width,this.bounds.height);n.x-=this.bounds.x,n.y-=this.bounds.y,e.style.left=Math.round(n.x)+"px",e.style.top=Math.round(n.y)+"px",e.style.width=Math.round(n.width)+"px",e.style.height=Math.round(n.height)+"px",e.src=this.image,this.node.appendChild(e)}},mxUtils.extend(mxCylinder,mxShape),mxCylinder.prototype.maxHeight=40,mxCylinder.prototype.svgStrokeTolerance=0,mxCylinder.prototype.paintVertexShape=function(e,n,t,a,i){e.translate(n,t),e.begin(),this.redrawPath(e,n,t,a,i,!1),e.fillAndStroke(),e.setShadow(!1),e.begin(),this.redrawPath(e,n,t,a,i,!0),e.stroke()},mxCylinder.prototype.redrawPath=function(e,n,t,a,i,s){n=Math.min(this.maxHeight,Math.round(i/5)),(s&&null!=this.fill||!s&&null==this.fill)&&(e.moveTo(0,n),e.curveTo(0,2*n,a,2*n,a,n),s||(e.stroke(),e.begin())),s||(e.moveTo(0,n),e.curveTo(0,-n/3,a,-n/3,a,n),e.lineTo(a,i-n),e.curveTo(a,i+n/3,0,i+n/3,0,i-n),e.close())},mxUtils.extend(mxConnector,mxPolyline),mxConnector.prototype.paintEdgeShape=function(e,n){var t=this.createMarker(e,n,!0),a=this.createMarker(e,n,!1);null==this.style||1!=this.style[mxConstants.STYLE_CURVED]?this.paintLine(e,n,this.isRounded):this.paintCurvedLine(e,n),e.setFillColor(this.stroke),e.setShadow(!1),e.setDashed(!1),null!=t&&t(),null!=a&&a()},mxConnector.prototype.paintCurvedLine=function(e,n){e.begin();var t=n[0],a=n.length;for(e.moveTo(t.x,t.y),t=1;t<a-2;t++){var i=n[t],s=n[t+1];e.quadTo(i.x,i.y,(i.x+s.x)/2,(i.y+s.y)/2)}i=n[a-2],s=n[a-1],e.quadTo(i.x,i.y,s.x,s.y),e.stroke()},mxConnector.prototype.createMarker=function(e,n,t){var a=n.length,i=t?n[1]:n[a-2],s=(a=(n=t?n[0]:n[a-1]).x-i.x,n.y-i.y),o=(i=a/(o=Math.max(1,Math.sqrt(a*a+s*s))),a=s/o,s=mxUtils.getNumber(this.style,t?mxConstants.STYLE_STARTSIZE:mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE),mxUtils.getValue(this.style,t?mxConstants.STYLE_STARTARROW:mxConstants.STYLE_ENDARROW));return mxMarker.createMarker(e,this,o,n,i,a,s,t,this.strokewidth,0!=this.style[t?mxConstants.STYLE_STARTFILL:mxConstants.STYLE_ENDFILL])},mxConnector.prototype.augmentBoundingBox=function(e){mxShape.prototype.augmentBoundingBox.apply(this,arguments);var n=0;mxUtils.getValue(this.style,mxConstants.STYLE_STARTARROW,mxConstants.NONE)!=mxConstants.NONE&&(n=mxUtils.getNumber(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_MARKERSIZE)+1),mxUtils.getValue(this.style,mxConstants.STYLE_ENDARROW,mxConstants.NONE)!=mxConstants.NONE&&(n=Math.max(n,mxUtils.getNumber(this.style,mxConstants.STYLE_ENDSIZE,mxConstants.DEFAULT_MARKERSIZE))+1),e.grow(Math.ceil(n*this.scale))},mxUtils.extend(mxSwimlane,mxShape),mxSwimlane.prototype.imageSize=16,mxSwimlane.prototype.getGradientBounds=function(e,n,t,a,i){return new mxRectangle(n,t,a,Math.min(i,mxUtils.getValue(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)))},mxSwimlane.prototype.getRotation=function(){var e=mxShape.prototype.getRotation.apply(this,arguments);return 1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)&&(e+=mxText.prototype.verticalTextRotation),e},mxSwimlane.prototype.getTextRotation=function(){return this.getRotation()},mxSwimlane.prototype.isPaintBoundsInverted=function(){return mxShape.prototype.isPaintBoundsInverted.apply(this,arguments)||1!=mxUtils.getValue(this.style,mxConstants.STYLE_HORIZONTAL,1)},mxSwimlane.prototype.getArcSize=function(e,n,t){return 3*t*(mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100)},mxSwimlane.prototype.paintVertexShape=function(e,n,t,a,i){var s=Math.min(i,mxUtils.getValue(this.style,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),o=mxUtils.getValue(this.style,mxConstants.STYLE_SWIMLANE_FILLCOLOR,mxConstants.NONE),r=1==mxUtils.getValue(this.style,mxConstants.STYLE_SWIMLANE_LINE,1),l=0;e.translate(n,t),this.isRounded?(l=this.getArcSize(a,i,s),this.paintRoundedSwimlane(e,n,t,a,i,s,l,o,r)):this.paintSwimlane(e,n,t,a,i,s,o,r),o=mxUtils.getValue(this.style,mxConstants.STYLE_SEPARATORCOLOR,mxConstants.NONE),this.paintSeparator(e,a,s,i,o),null!=this.image&&(i=this.getImageBounds(n,s,a,i),e.image(i.x-n,i.y-t,i.width,i.height,this.image,!1,!1,!1)),this.glass&&(e.setShadow(!1),this.paintGlassEffect(e,0,0,a,s,l))},mxSwimlane.prototype.paintSwimlane=function(e,n,t,a,i,s,o,r){o!=mxConstants.NONE&&(e.save(),e.setFillColor(o),e.rect(0,0,a,i),e.fillAndStroke(),e.restore(),e.setShadow(!1)),e.begin(),e.moveTo(0,s),e.lineTo(0,0),e.lineTo(a,0),e.lineTo(a,s),r&&e.close(),e.fillAndStroke(),s<i&&o==mxConstants.NONE&&(e.pointerEvents=!1,e.begin(),e.moveTo(0,s),e.lineTo(0,i),e.lineTo(a,i),e.lineTo(a,s),e.stroke())},mxSwimlane.prototype.paintRoundedSwimlane=function(e,n,t,a,i,s,o,r,l){r!=mxConstants.NONE&&(e.save(),e.setFillColor(r),e.roundrect(0,0,a,i,o,o),e.fillAndStroke(),e.restore(),e.setShadow(!1)),e.begin(),e.moveTo(a,s),e.lineTo(a,o),e.quadTo(a,0,a-Math.min(a/2,o),0),e.lineTo(Math.min(a/2,o),0),e.quadTo(0,0,0,o),e.lineTo(0,s),l&&e.close(),e.fillAndStroke(),s<i&&r==mxConstants.NONE&&(e.pointerEvents=!1,e.begin(),e.moveTo(0,s),e.lineTo(0,i-o),e.quadTo(0,i,Math.min(a/2,o),i),e.lineTo(a-Math.min(a/2,o),i),e.quadTo(a,i,a,i-o),e.lineTo(a,s),e.stroke())},mxSwimlane.prototype.paintSeparator=function(e,n,t,a,i){i!=mxConstants.NONE&&(e.setStrokeColor(i),e.setDashed(!0),e.begin(),e.moveTo(n,t),e.lineTo(n,a),e.stroke(),e.setDashed(!1))},mxSwimlane.prototype.getImageBounds=function(e,n,t,a){return new mxRectangle(e+t-this.imageSize,n,this.imageSize,this.imageSize)},mxGraphLayout.prototype.graph=null,mxGraphLayout.prototype.useBoundingBox=!0,mxGraphLayout.prototype.parent=null,mxGraphLayout.prototype.moveCell=function(e,n,t){},mxGraphLayout.prototype.execute=function(e){},mxGraphLayout.prototype.getGraph=function(){return this.graph},mxGraphLayout.prototype.getConstraint=function(e,n,t,a){return null!=(n=null!=(t=this.graph.view.getState(n))?t.style:this.graph.getCellStyle(n))?n[e]:null},mxGraphLayout.traverse=function(e,n,t,a,i){if(null!=t&&null!=e){n=null==n||n,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=t(i[s]=e,a))||a)&&0<(a=this.graph.model.getEdgeCount(e)))for(s=0;s<a;s++){var o=this.graph.model.getEdgeAt(e,s),r=this.graph.model.getTerminal(o,!0)==e;n&&!r||(r=this.graph.view.getVisibleTerminal(o,!r),this.traverse(r,n,t,o,i))}}},mxGraphLayout.prototype.isVertexMovable=function(e){return this.graph.isCellMovable(e)},mxGraphLayout.prototype.isVertexIgnored=function(e){return!this.graph.getModel().isVertex(e)||!this.graph.isCellVisible(e)},mxGraphLayout.prototype.isEdgeIgnored=function(e){var n=this.graph.getModel();return!n.isEdge(e)||!this.graph.isCellVisible(e)||null==n.getTerminal(e,!0)||null==n.getTerminal(e,!1)},mxGraphLayout.prototype.setEdgeStyleEnabled=function(e,n){this.graph.setCellStyles(mxConstants.STYLE_NOEDGESTYLE,n?"0":"1",[e])},mxGraphLayout.prototype.setOrthogonalEdge=function(e,n){this.graph.setCellStyles(mxConstants.STYLE_ORTHOGONAL,n?"1":"0",[e])},mxGraphLayout.prototype.getParentOffset=function(e){var n=new mxPoint;if(null!=e&&e!=this.parent){var t=this.graph.getModel();if(t.isAncestor(this.parent,e))for(var a=t.getGeometry(e);e!=this.parent;)n.x+=a.x,n.y+=a.y,e=t.getParent(e),a=t.getGeometry(e)}return n},mxGraphLayout.prototype.setEdgePoints=function(e,n){if(null!=e){var t=this.graph.model,a=t.getGeometry(e);if(null==a?(a=new mxGeometry).setRelative(!0):a=a.clone(),null!=this.parent&&null!=n)for(var i=t.getParent(e),s=(i=this.getParentOffset(i),0);s<n.length;s++)n[s].x-=i.x,n[s].y-=i.y;a.points=n,t.setGeometry(e,a)}},mxGraphLayout.prototype.setVertexLocation=function(e,n,t){var a=this.graph.getModel(),i=a.getGeometry(e),s=null;if(null!=i){if(s=new mxRectangle(n,t,i.width,i.height),this.useBoundingBox){var o=this.graph.getView().getState(e);if(null!=o&&null!=o.text&&null!=o.text.boundingBox){var r=this.graph.getView().scale,l=o.text.boundingBox;o.text.boundingBox.x<o.x&&(n+=(o.x-l.x)/r,s.width=l.width),o.text.boundingBox.y<o.y&&(t+=(o.y-l.y)/r,s.height=l.height)}}null!=this.parent&&(null!=(o=a.getParent(e))&&o!=this.parent&&(n-=(o=this.getParentOffset(o)).x,t-=o.y)),i.x==n&&i.y==t||((i=i.clone()).x=n,i.y=t,a.setGeometry(e,i))}return s},mxGraphLayout.prototype.getVertexBounds=function(e){var n=this.graph.getModel().getGeometry(e);if(this.useBoundingBox&&(null!=(r=this.graph.getView().getState(e))&&null!=r.text&&null!=r.text.boundingBox)){var t=this.graph.getView().scale,a=r.text.boundingBox,i=Math.max(r.x-a.x,0)/t,s=Math.max(r.y-a.y,0)/t,o=Math.max(a.x+a.width-(r.x+r.width),0)/t,r=Math.max(a.y+a.height-(r.y+r.height),0)/t;n=new mxRectangle(n.x-i,n.y-s,n.width+i+o,n.height+s+r)}return null!=this.parent&&(e=this.graph.getModel().getParent(e),n=n.clone(),null!=e&&e!=this.parent&&(e=this.getParentOffset(e),n.x+=e.x,n.y+=e.y)),new mxRectangle(n.x,n.y,n.width,n.height)},mxGraphLayout.prototype.arrangeGroups=function(e,n){this.graph.getModel().beginUpdate();try{for(var t=e.length-1;0<=t;t--){var a=e[t],i=this.graph.getChildVertices(a),s=this.graph.getBoundingBoxFromGeometry(i),o=this.graph.getCellGeometry(a),r=0,l=0;if(this.graph.isSwimlane(a)){var d=this.graph.getStartSize(a);r=d.width,l=d.height}null!=s&&null!=o&&((o=o.clone()).x=o.x+s.x-n-r,o.y=o.y+s.y-n-l,o.width=s.width+2*n+r,o.height=s.height+2*n+l,this.graph.getModel().setGeometry(a,o),this.graph.moveCells(i,n+r-s.x,n+l-s.y))}}finally{this.graph.getModel().endUpdate()}},mxStackLayout.prototype=new mxGraphLayout,mxStackLayout.prototype.constructor=mxStackLayout,mxStackLayout.prototype.horizontal=null,mxStackLayout.prototype.spacing=null,mxStackLayout.prototype.x0=null,mxStackLayout.prototype.y0=null,mxStackLayout.prototype.border=0,mxStackLayout.prototype.keepFirstLocation=!1,mxStackLayout.prototype.fill=!1,mxStackLayout.prototype.resizeParent=!1,mxStackLayout.prototype.resizeLast=!1,mxStackLayout.prototype.wrap=null,mxStackLayout.prototype.isHorizontal=function(){return this.horizontal},mxStackLayout.prototype.moveCell=function(e,n,t){var a=this.graph.getModel(),i=a.getParent(e),s=this.isHorizontal();if(null!=e&&null!=i){var o=0,r=0,l=a.getChildCount(i);for(n=s?n:t,null!=(o=this.graph.getView().getState(i))&&(n-=s?o.x:o.y),o=0;o<l;o++)if((t=a.getChildAt(i,o))!=e&&null!=(t=a.getGeometry(t))){if(t=s?t.x+t.width/2:t.y+t.height/2,r<n&&n<t)break;r=t}s=i.getIndex(e),s=Math.max(0,o-(s<o?1:0)),a.add(i,e,s)}},mxStackLayout.prototype.getParentSize=function(e){var n=this.graph.getModel(),t=n.getGeometry(e);return null!=this.graph.container&&(null==t&&n.isLayer(e)||e==this.graph.getView().currentRoot)&&(t=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),t},mxStackLayout.prototype.execute=function(e){if(null!=e){var n=this.isHorizontal(),t=this.graph.getModel(),a=this.getParentSize(e),i=0;null!=a&&(i=n?a.height:a.width);i=i-(2*this.spacing+2*this.border);var s=this.x0+this.border,o=this.y0+this.border;if(this.graph.isSwimlane(e)){var r=this.graph.getCellStyle(e),l=mxUtils.getValue(r,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE);n==(r=mxUtils.getValue(r,mxConstants.STYLE_HORIZONTAL,!0))&&(i-=l),n?o+=l:s+=l}t.beginUpdate();try{l=0,r=null;for(var d=t.getChildCount(e),c=0;c<d;c++){var m=t.getChildAt(e,c);if(!this.isVertexIgnored(m)&&this.isVertexMovable(m)){var u=t.getGeometry(m);null!=u&&(u=u.clone(),null!=this.wrap&&null!=r&&(n&&r.x+r.width+u.width+2*this.spacing>this.wrap||!n&&r.y+r.height+u.height+2*this.spacing>this.wrap)&&(r=null,n?o+=l+this.spacing:s+=l+this.spacing,l=0),l=Math.max(l,n?u.height:u.width),null!=r?n?u.x=r.x+r.width+this.spacing:u.y=r.y+r.height+this.spacing:this.keepFirstLocation||(n?u.x=s:u.y=o),n?u.y=o:u.x=s,this.fill&&0<i&&(n?u.height=i:u.width=i),t.setGeometry(m,u),r=u)}}this.resizeParent&&null!=a&&null!=r&&!this.graph.isCellCollapsed(e)?(a=a.clone(),n?a.width=r.x+r.width+this.spacing:a.height=r.y+r.height+this.spacing,t.setGeometry(e,a)):this.resizeLast&&null!=a&&null!=r&&(n?r.width=a.width-r.x-this.spacing:r.height=a.height-r.y-this.spacing)}finally{t.endUpdate()}}},mxPartitionLayout.prototype=new mxGraphLayout,mxPartitionLayout.prototype.constructor=mxPartitionLayout,mxPartitionLayout.prototype.horizontal=null,mxPartitionLayout.prototype.spacing=null,mxPartitionLayout.prototype.border=null,mxPartitionLayout.prototype.resizeVertices=!0,mxPartitionLayout.prototype.isHorizontal=function(){return this.horizontal},mxPartitionLayout.prototype.moveCell=function(e,n,t){var a=(t=this.graph.getModel()).getParent(e);if(null!=e&&null!=a){var i=0,s=0,o=t.getChildCount(a);for(i=0;i<o;i++){var r=t.getChildAt(a,i);if(null!=(r=this.getVertexBounds(r))){if(r=r.x+r.width/2,s<n&&n<r)break;s=r}}n=a.getIndex(e),n=Math.max(0,i-(n<i?1:0)),t.add(a,e,n)}},mxPartitionLayout.prototype.execute=function(e){var n=this.isHorizontal(),t=this.graph.getModel(),a=t.getGeometry(e);if(null!=this.graph.container&&(null==a&&t.isLayer(e)||e==this.graph.getView().currentRoot)&&(a=new mxRectangle(0,0,this.graph.container.offsetWidth-1,this.graph.container.offsetHeight-1)),null!=a){for(var i=[],s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o);!this.isVertexIgnored(r)&&this.isVertexMovable(r)&&i.push(r)}if(0<(s=i.length)){var l=this.border,d=this.border,c=(c=n?a.height:a.width)-2*this.border;if(e=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle,c-=n?e.height:e.width,l+=e.width,d+=e.height,e=this.border+(s-1)*this.spacing,0<(a=n?(a.width-l-e)/s:(a.height-d-e)/s)){t.beginUpdate();try{for(o=0;o<s;o++){r=i[o];var m=t.getGeometry(r);null!=m&&((m=m.clone()).x=l,m.y=d,n?(this.resizeVertices&&(m.width=a,m.height=c),l+=a+this.spacing):(this.resizeVertices&&(m.height=a,m.width=c),d+=a+this.spacing),t.setGeometry(r,m))}}finally{t.endUpdate()}}}}},mxCompactTreeLayout.prototype=new mxGraphLayout,mxCompactTreeLayout.prototype.constructor=mxCompactTreeLayout,mxCompactTreeLayout.prototype.horizontal=null,mxCompactTreeLayout.prototype.invert=null,mxCompactTreeLayout.prototype.resizeParent=!0,mxCompactTreeLayout.prototype.groupPadding=10,mxCompactTreeLayout.prototype.parentsChanged=null,mxCompactTreeLayout.prototype.moveTree=!1,mxCompactTreeLayout.prototype.levelDistance=10,mxCompactTreeLayout.prototype.nodeDistance=20,mxCompactTreeLayout.prototype.resetEdges=!0,mxCompactTreeLayout.prototype.prefHozEdgeSep=5,mxCompactTreeLayout.prototype.prefVertEdgeOff=4,mxCompactTreeLayout.prototype.minEdgeJetty=8,mxCompactTreeLayout.prototype.channelBuffer=4,mxCompactTreeLayout.prototype.edgeRouting=!0,mxCompactTreeLayout.prototype.isVertexIgnored=function(e){return mxGraphLayout.prototype.isVertexIgnored.apply(this,arguments)||0==this.graph.getConnections(e).length},mxCompactTreeLayout.prototype.isHorizontal=function(){return this.horizontal},mxCompactTreeLayout.prototype.execute=function(e,n){this.parent=e;var t=this.graph.getModel();if(null==n)if(0<this.graph.getEdges(e,t.getParent(e),this.invert,!this.invert,!1).length)n=e;else{if(0<(o=this.graph.findTreeRoots(e,!0,this.invert)).length)for(var a=0;a<o.length;a++)if(!this.isVertexIgnored(o[a])&&0<this.graph.getEdges(o[a],null,this.invert,!this.invert,!1).length){n=o[a];break}}if(null!=n){this.parentsChanged=this.resizeParent?{}:null,t.beginUpdate();try{var i=this.dfs(n,e);if(null!=i){this.layout(i);var s=this.graph.gridSize,o=s;if(!this.moveTree){var r=this.getVertexBounds(n);null!=r&&(s=r.x,o=r.y)}if((r=null)!=(r=this.isHorizontal()?this.horizontalLayout(i,s,o):this.verticalLayout(i,null,s,o))){var l=a=0;r.x<0&&(a=Math.abs(s-r.x)),r.y<0&&(l=Math.abs(o-r.y)),(0!=a||0!=l)&&this.moveNode(i,a,l),this.resizeParent&&this.adjustParents(),this.edgeRouting&&this.localEdgeProcessing(i)}}}finally{t.endUpdate()}}},mxCompactTreeLayout.prototype.moveNode=function(e,n,t){for(e.x+=n,e.y+=t,this.apply(e),e=e.child;null!=e;)this.moveNode(e,n,t),e=e.next},mxCompactTreeLayout.prototype.dfs=function(e,n,t){t=null!=t?t:[];var a=mxCellPath.create(e),i=null;if(null!=e&&null==t[a]&&!this.isVertexIgnored(e)){t[a]=e;i=this.createNode(e),a=this.graph.getModel();var s=null;e=this.graph.getEdges(e,n,this.invert,!this.invert,!1,!0);for(var o=this.graph.getView(),r=0;r<e.length;r++){var l=e[r];if(!this.isEdgeIgnored(l)){this.resetEdges&&this.setEdgePoints(l,null),this.edgeRouting&&(this.setEdgeStyleEnabled(l,!1),this.setEdgePoints(l,null));var d;l=null!=(d=o.getState(l))?d.getVisibleTerminal(this.invert):o.getVisibleTerminal(l,this.invert);null!=(d=this.dfs(l,n,t))&&null!=a.getGeometry(l)&&(null==s?i.child=d:s.next=d,s=d)}}}return i},mxCompactTreeLayout.prototype.layout=function(e){if(null!=e){for(var n=e.child;null!=n;)this.layout(n),n=n.next;null!=e.child?this.attachParent(e,this.join(e)):this.layoutLeaf(e)}},mxCompactTreeLayout.prototype.horizontalLayout=function(e,n,t,a){if(e.x+=n+e.offsetX,e.y+=t+e.offsetY,a=this.apply(e,a),null!=(n=e.child)){a=this.horizontalLayout(n,e.x,e.y,a),t=e.y+n.offsetY;for(var i=n.next;null!=i;)a=this.horizontalLayout(i,e.x+n.offsetX,t,a),t+=i.offsetY,i=i.next}return a},mxCompactTreeLayout.prototype.verticalLayout=function(e,n,t,a,i){if(e.x+=t+e.offsetY,e.y+=a+e.offsetX,i=this.apply(e,i),null!=(n=e.child))for(i=this.verticalLayout(n,e,e.x,e.y,i),t=e.x+n.offsetY,a=n.next;null!=a;)i=this.verticalLayout(a,e,t,e.y+n.offsetX,i),t+=a.offsetY,a=a.next;return i},mxCompactTreeLayout.prototype.attachParent=function(e,n){var t=this.nodeDistance+this.levelDistance,a=(n-e.width)/2-this.nodeDistance,i=a+e.width+2*this.nodeDistance-n;e.child.offsetX=t+e.height,e.child.offsetY=i,e.contour.upperHead=this.createLine(e.height,0,this.createLine(t,i,e.contour.upperHead)),e.contour.lowerHead=this.createLine(e.height,0,this.createLine(t,a,e.contour.lowerHead))},mxCompactTreeLayout.prototype.layoutLeaf=function(e){var n=2*this.nodeDistance;e.contour.upperTail=this.createLine(e.height+n,0),e.contour.upperHead=e.contour.upperTail,e.contour.lowerTail=this.createLine(0,-e.width-n),e.contour.lowerHead=this.createLine(e.height+n,0,e.contour.lowerTail)},mxCompactTreeLayout.prototype.join=function(e){var n=2*this.nodeDistance,t=e.child;e.contour=t.contour;var a=t.width+n,i=a;for(t=t.next;null!=t;){var s=this.merge(e.contour,t.contour);t.offsetY=s+a,t.offsetX=0,i+=s+(a=t.width+n),t=t.next}return i},mxCompactTreeLayout.prototype.merge=function(e,n){for(var t=0,a=0,i=0,s=e.lowerHead,o=n.upperHead;null!=o&&null!=s;){var r=this.offset(t,a,o.dx,o.dy,s.dx,s.dy);a=a+r,i=i+r;t+o.dx<=s.dx?(t+=o.dx,a+=o.dy,o=o.next):(t-=s.dx,a-=s.dy,s=s.next)}return null!=o?(t=this.bridge(e.upperTail,0,0,o,t,a),e.upperTail=null!=t.next?n.upperTail:t,e.lowerTail=n.lowerTail):null==(t=this.bridge(n.lowerTail,t,a,s,0,0)).next&&(e.lowerTail=t),e.lowerHead=n.lowerHead,i},mxCompactTreeLayout.prototype.offset=function(e,n,t,a,i,s){var o;return i<=e||e+t<=0?0:0<(o=0<i*a-t*s?e<0?e*a/t-n:0<e?e*s/i-n:-n:i<e+t?s-(n+(i-e)*a/t):e+t<i?(t+e)*s/i-(n+a):s-(n+a))?o:0},mxCompactTreeLayout.prototype.bridge=function(e,n,t,a,i,s){return n=i+a.dx-n,i=i=0,0==a.dx?i=a.dy:(i=n*a.dy,i/=a.dx),n=this.createLine(n,i,a.next),e.next=this.createLine(0,s+a.dy-i-t,n),n},mxCompactTreeLayout.prototype.createNode=function(e){var n={};return n.cell=e,n.x=0,n.y=0,n.width=0,n.height=0,null!=(e=this.getVertexBounds(e))&&(this.isHorizontal()?(n.width=e.height,n.height=e.width):(n.width=e.width,n.height=e.height)),n.offsetX=0,n.offsetY=0,n.contour={},n},mxCompactTreeLayout.prototype.apply=function(e,n){var t=this.graph.getModel(),a=e.cell,i=t.getGeometry(a);return null!=a&&null!=i&&(this.isVertexMovable(a)&&(i=this.setVertexLocation(a,e.x,e.y),this.resizeParent&&(t=t.getParent(a),a=mxCellPath.create(t),null==this.parentsChanged[a]&&(this.parentsChanged[a]=t))),n=null==n?new mxRectangle(i.x,i.y,i.width,i.height):new mxRectangle(Math.min(n.x,i.x),Math.min(n.y,i.y),Math.max(n.x+n.width,i.x+i.width),Math.max(n.y+n.height,i.y+i.height))),n},mxCompactTreeLayout.prototype.createLine=function(e,n,t){var a={};return a.dx=e,a.dy=n,a.next=t,a},mxCompactTreeLayout.prototype.adjustParents=function(){var e,n=[];for(e in this.parentsChanged)n.push(this.parentsChanged[e]);this.arrangeGroups(mxUtils.sortCells(n,!0),this.groupPadding)},mxCompactTreeLayout.prototype.localEdgeProcessing=function(e){for(this.processNodeOutgoing(e),e=e.child;null!=e;)this.localEdgeProcessing(e),e=e.next},mxCompactTreeLayout.prototype.processNodeOutgoing=function(e){for(var n=e.child,t=e.cell,a=0,i=[];null!=n;){a++;var s=n.x;this.horizontal&&(s=n.y),i.push(new WeightedCellSorter(n,s)),n=n.next}i.sort(WeightedCellSorter.prototype.compare),(s=e.width)>(o=(a+1)*this.prefHozEdgeSep)+2*this.prefHozEdgeSep&&(s-=2*this.prefHozEdgeSep),n=(e=s/a)/2,s>o+2*this.prefHozEdgeSep&&(n+=this.prefHozEdgeSep);s=this.minEdgeJetty-this.prefVertEdgeOff;for(var o=0,r=this.getVertexBounds(t),l=0;l<i.length;l++){for(var d=i[l].cell.cell,c=this.getVertexBounds(d),m=(d=this.graph.getEdgesBetween(t,d,!1),[]),u=0,p=0,g=0;g<d.length;g++)this.horizontal?(u=r.x+r.width,p=r.y+n,m.push(new mxPoint(u,p)),u=r.x+r.width+s,m.push(new mxPoint(u,p)),p=c.y+c.height/2):(u=r.x+n,p=r.y+r.height,m.push(new mxPoint(u,p)),p=r.y+r.height+s,m.push(new mxPoint(u,p)),u=c.x+c.width/2),m.push(new mxPoint(u,p)),this.setEdgePoints(d[g],m);l<a/2?s+=this.prefVertEdgeOff:a/2<l&&(s-=this.prefVertEdgeOff),n+=e,o=Math.max(o,s)}},WeightedCellSorter.prototype.weightedValue=0,WeightedCellSorter.prototype.nudge=!1,WeightedCellSorter.prototype.visited=!1,WeightedCellSorter.prototype.rankIndex=null,WeightedCellSorter.prototype.cell=null,WeightedCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.weightedValue>e.weightedValue?1:n.weightedValue<e.weightedValue?-1:n.nudge?1:-1:0},mxFastOrganicLayout.prototype=new mxGraphLayout,mxFastOrganicLayout.prototype.constructor=mxFastOrganicLayout,mxFastOrganicLayout.prototype.useInputOrigin=!0,mxFastOrganicLayout.prototype.resetEdges=!0,mxFastOrganicLayout.prototype.disableEdgeStyle=!0,mxFastOrganicLayout.prototype.forceConstant=50,mxFastOrganicLayout.prototype.forceConstantSquared=0,mxFastOrganicLayout.prototype.minDistanceLimit=2,mxFastOrganicLayout.prototype.maxDistanceLimit=500,mxFastOrganicLayout.prototype.minDistanceLimitSquared=4,mxFastOrganicLayout.prototype.initialTemp=200,mxFastOrganicLayout.prototype.temperature=0,mxFastOrganicLayout.prototype.maxIterations=0,mxFastOrganicLayout.prototype.iteration=0,mxFastOrganicLayout.prototype.allowedToRun=!0,mxFastOrganicLayout.prototype.isVertexIgnored=function(e){return mxGraphLayout.prototype.isVertexIgnored.apply(this,arguments)||0==this.graph.getConnections(e).length},mxFastOrganicLayout.prototype.execute=function(e){var n=this.graph.getModel();this.vertexArray=[];for(var t=this.graph.getChildVertices(e),a=0;a<t.length;a++)this.isVertexIgnored(t[a])||this.vertexArray.push(t[a]);var i=this.useInputOrigin?this.graph.view.getBounds(this.vertexArray):null,s=this.vertexArray.length;for(this.indices=[],this.dispX=[],this.dispY=[],this.cellLocation=[],this.isMoveable=[],this.neighbours=[],this.radius=[],this.radiusSquared=[],this.forceConstant<.001&&(this.forceConstant=.001),this.forceConstantSquared=this.forceConstant*this.forceConstant,a=0;a<this.vertexArray.length;a++){var o=this.vertexArray[a];this.cellLocation[a]=[];var r=mxCellPath.create(o);this.indices[r]=a;var l=this.getVertexBounds(o),d=l.width,c=l.height,m=l.x,u=l.y;this.cellLocation[a][0]=m+d/2,this.cellLocation[a][1]=u+c/2,this.radius[a]=Math.min(d,c),this.radiusSquared[a]=this.radius[a]*this.radius[a]}n.beginUpdate();try{for(a=0;a<s;a++){this.dispX[a]=0,this.dispY[a]=0,this.isMoveable[a]=this.isVertexMovable(this.vertexArray[a]);var p=this.graph.getConnections(this.vertexArray[a],e);t=this.graph.getOpposites(p,this.vertexArray[a]);for(this.neighbours[a]=[],d=0;d<t.length;d++){this.resetEdges&&this.graph.resetEdge(p[d]),this.disableEdgeStyle&&this.setEdgeStyleEnabled(p[d],!1);r=mxCellPath.create(t[d]);var g=this.indices[r];this.neighbours[a][d]=null!=g?g:a}}for(this.temperature=this.initialTemp,0==this.maxIterations&&(this.maxIterations=20*Math.sqrt(s)),this.iteration=0;this.iteration<this.maxIterations;this.iteration++){if(!this.allowedToRun)return;this.calcRepulsion(),this.calcAttraction(),this.calcPositions(),this.reduceTemperature()}for(e=t=null,a=0;a<this.vertexArray.length;a++)o=this.vertexArray[a],this.isVertexMovable(o)&&(null!=(l=this.getVertexBounds(o))&&(this.cellLocation[a][0]-=l.width/2,this.cellLocation[a][1]-=l.height/2,m=this.graph.snap(this.cellLocation[a][0]),u=this.graph.snap(this.cellLocation[a][1]),this.setVertexLocation(o,m,u),t=null==t?m:Math.min(t,m),e=null==e?u:Math.min(e,u)));a=1-(t||0),o=1-(e||0),null!=i&&(a+=i.x,o+=i.y),this.graph.moveCells(this.vertexArray,a,o)}finally{n.endUpdate()}},mxFastOrganicLayout.prototype.calcPositions=function(){for(var e=0;e<this.vertexArray.length;e++)if(this.isMoveable[e]){(t=Math.sqrt(this.dispX[e]*this.dispX[e]+this.dispY[e]*this.dispY[e]))<.001&&(t=.001);var n=this.dispX[e]/t*Math.min(t,this.temperature),t=this.dispY[e]/t*Math.min(t,this.temperature);this.dispX[e]=0,this.dispY[e]=0,this.cellLocation[e][0]+=n,this.cellLocation[e][1]+=t}},mxFastOrganicLayout.prototype.calcAttraction=function(){for(var e=0;e<this.vertexArray.length;e++)for(var n=0;n<this.neighbours[e].length;n++){var t=this.neighbours[e][n];if(e!=t&&this.isMoveable[e]&&this.isMoveable[t]){(a=(s=this.cellLocation[e][0]-this.cellLocation[t][0])*s+(o=this.cellLocation[e][1]-this.cellLocation[t][1])*o-this.radiusSquared[e]-this.radiusSquared[t])<this.minDistanceLimitSquared&&(a=this.minDistanceLimitSquared);var a,i=Math.sqrt(a),s=s/i*(a=a/this.forceConstant),o=o/i*a;this.dispX[e]-=s,this.dispY[e]-=o,this.dispX[t]+=s,this.dispY[t]+=o}}},mxFastOrganicLayout.prototype.calcRepulsion=function(){for(var e=this.vertexArray.length,n=0;n<e;n++)for(var t=n;t<e;t++){if(!this.allowedToRun)return;if(t!=n&&this.isMoveable[n]&&this.isMoveable[t]){var a=this.cellLocation[n][0]-this.cellLocation[t][0],i=this.cellLocation[n][1]-this.cellLocation[t][1];0==a&&(a=.01+Math.random()),0==i&&(i=.01+Math.random());var s=Math.sqrt(a*a+i*i),o=s-this.radius[n]-this.radius[t];o>this.maxDistanceLimit||(o<this.minDistanceLimit&&(o=this.minDistanceLimit),a=a/s*(o=this.forceConstantSquared/o),i=i/s*o,this.dispX[n]+=a,this.dispY[n]+=i,this.dispX[t]-=a,this.dispY[t]-=i)}}},mxFastOrganicLayout.prototype.reduceTemperature=function(){this.temperature=this.initialTemp*(1-this.iteration/this.maxIterations)},mxCircleLayout.prototype=new mxGraphLayout,mxCircleLayout.prototype.constructor=mxCircleLayout,mxCircleLayout.prototype.radius=null,mxCircleLayout.prototype.moveCircle=!1,mxCircleLayout.prototype.x0=0,mxCircleLayout.prototype.y0=0,mxCircleLayout.prototype.resetEdges=!0,mxCircleLayout.prototype.disableEdgeStyle=!0,mxCircleLayout.prototype.execute=function(e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0,a=null,i=null,s=[],o=n.getChildCount(e),r=0;r<o;r++){var l=n.getChildAt(e,r);if(this.isVertexIgnored(l))this.isEdgeIgnored(l)||(this.resetEdges&&this.graph.resetEdge(l),this.disableEdgeStyle&&this.setEdgeStyleEnabled(l,!1));else{s.push(l);var d=this.getVertexBounds(l);a=null==a?d.y:Math.min(a,d.y),i=null==i?d.x:Math.min(i,d.x),t=Math.max(t,Math.max(d.width,d.height))}}var c=this.getRadius(s.length,t);this.moveCircle&&(i=this.x0,a=this.y0),this.circle(s,c,i,a)}finally{n.endUpdate()}},mxCircleLayout.prototype.getRadius=function(e,n){return Math.max(e*n/Math.PI,this.radius)},mxCircleLayout.prototype.circle=function(e,n,t,a){for(var i=e.length,s=2*Math.PI/i,o=0;o<i;o++)this.isVertexMovable(e[o])&&this.setVertexLocation(e[o],t+n+n*Math.sin(o*s),a+n+n*Math.cos(o*s))},mxParallelEdgeLayout.prototype=new mxGraphLayout,mxParallelEdgeLayout.prototype.constructor=mxParallelEdgeLayout,mxParallelEdgeLayout.prototype.spacing=20,mxParallelEdgeLayout.prototype.execute=function(e){e=this.findParallels(e),this.graph.model.beginUpdate();try{for(var n in e){var t=e[n];1<t.length&&this.layout(t)}}finally{this.graph.model.endUpdate()}},mxParallelEdgeLayout.prototype.findParallels=function(e){for(var n=this.graph.getModel(),t=[],a=n.getChildCount(e),i=0;i<a;i++){var s=n.getChildAt(e,i);if(!this.isEdgeIgnored(s)){var o=this.getEdgeId(s);null!=o&&(null==t[o]&&(t[o]=[]),t[o].push(s))}}return t},mxParallelEdgeLayout.prototype.getEdgeId=function(e){var n=this.graph.getView(),t=n.getState(e),a=null!=t?t.getVisibleTerminal(!0):n.getVisibleTerminal(e,!0);return e=null!=t?t.getVisibleTerminal(!1):n.getVisibleTerminal(e,!1),null!=a&&null!=e?(a=mxCellPath.create(a),(e=mxCellPath.create(e))<a?e+"-"+a:a+"-"+e):null},mxParallelEdgeLayout.prototype.layout=function(e){var n=e[0];if((o=(t=this.graph.getModel()).getGeometry(t.getTerminal(n,!0)))==(s=t.getGeometry(t.getTerminal(n,!1)))){n=o.x+o.width+this.spacing;for(var t=o.y+o.height/2,a=0;a<e.length;a++)this.route(e[a],n,t),n+=this.spacing}else if(null!=o&&null!=s){n=o.x+o.width/2,t=o.y+o.height/2,a=s.x+s.width/2-n;var i=s.y+s.height/2-t,s=Math.sqrt(a*a+i*i),o=i*this.spacing/s;for(s=a*this.spacing/s,n=n+a/2+o*(e.length-1)/2,t=t+i/2-s*(e.length-1)/2,a=0;a<e.length;a++)this.route(e[a],n,t),n-=o,t+=s}},mxParallelEdgeLayout.prototype.route=function(e,n,t){this.graph.isCellMovable(e)&&this.setEdgePoints(e,[new mxPoint(n,t)])},mxCompositeLayout.prototype=new mxGraphLayout,mxCompositeLayout.prototype.constructor=mxCompositeLayout,mxCompositeLayout.prototype.layouts=null,mxCompositeLayout.prototype.master=null,mxCompositeLayout.prototype.moveCell=function(e,n,t){null!=this.master?this.master.move.apply(this.master,arguments):this.layouts[0].move.apply(this.layouts[0],arguments)},mxCompositeLayout.prototype.execute=function(e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0;t<this.layouts.length;t++)this.layouts[t].execute.apply(this.layouts[t],arguments)}finally{n.endUpdate()}},mxEdgeLabelLayout.prototype=new mxGraphLayout,mxEdgeLabelLayout.prototype.constructor=mxEdgeLabelLayout,mxEdgeLabelLayout.prototype.execute=function(e){for(var n=this.graph.view,t=this.graph.getModel(),a=[],i=[],s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o),l=n.getState(r);null!=l&&(this.isVertexIgnored(r)?this.isEdgeIgnored(r)||a.push(l):i.push(l))}this.placeLabels(i,a)},mxEdgeLabelLayout.prototype.placeLabels=function(e,n){var t=this.graph.getModel();t.beginUpdate();try{for(var a=0;a<n.length;a++){var i=n[a];if(null!=i&&null!=i.text&&null!=i.text.boundingBox)for(var s=0;s<e.length;s++){var o=e[s];null!=o&&this.avoid(i,o)}}}finally{t.endUpdate()}},mxEdgeLabelLayout.prototype.avoid=function(e,n){var t=this.graph.getModel(),a=e.text.boundingBox;if(mxUtils.intersects(a,n)){var i=-a.y-a.height+n.y,s=-a.y+n.y+n.height;i=Math.abs(i)<Math.abs(s)?i:s,s=-a.x-a.width+n.x,a=-a.x+n.x+n.width,a=Math.abs(s)<Math.abs(a)?s:a;Math.abs(a)<Math.abs(i)?i=0:a=0,null!=(s=t.getGeometry(e.cell))&&(null!=(s=s.clone()).offset?(s.offset.x+=a,s.offset.y+=i):s.offset=new mxPoint(a,i),t.setGeometry(e.cell,s))}},mxGraphAbstractHierarchyCell.prototype.maxRank=-1,mxGraphAbstractHierarchyCell.prototype.minRank=-1,mxGraphAbstractHierarchyCell.prototype.x=null,mxGraphAbstractHierarchyCell.prototype.y=null,mxGraphAbstractHierarchyCell.prototype.width=0,mxGraphAbstractHierarchyCell.prototype.height=0,mxGraphAbstractHierarchyCell.prototype.nextLayerConnectedCells=null,mxGraphAbstractHierarchyCell.prototype.previousLayerConnectedCells=null,mxGraphAbstractHierarchyCell.prototype.temp=null,mxGraphAbstractHierarchyCell.prototype.getNextLayerConnectedCells=function(e){return null},mxGraphAbstractHierarchyCell.prototype.getPreviousLayerConnectedCells=function(e){return null},mxGraphAbstractHierarchyCell.prototype.isEdge=function(){return!1},mxGraphAbstractHierarchyCell.prototype.isVertex=function(){return!1},mxGraphAbstractHierarchyCell.prototype.getGeneralPurposeVariable=function(e){return null},mxGraphAbstractHierarchyCell.prototype.setGeneralPurposeVariable=function(e,n){return null},mxGraphAbstractHierarchyCell.prototype.setX=function(e,n){this.isVertex()?this.x[0]=n:this.isEdge()&&(this.x[e-this.minRank-1]=n)},mxGraphAbstractHierarchyCell.prototype.getX=function(e){return this.isVertex()?this.x[0]:this.isEdge()?this.x[e-this.minRank-1]:0},mxGraphAbstractHierarchyCell.prototype.setY=function(e,n){this.isVertex()?this.y[0]=n:this.isEdge()&&(this.y[e-this.minRank-1]=n)},mxGraphHierarchyNode.prototype=new mxGraphAbstractHierarchyCell,mxGraphHierarchyNode.prototype.constructor=mxGraphHierarchyNode,mxGraphHierarchyNode.prototype.cell=null,mxGraphHierarchyNode.prototype.connectsAsTarget=[],mxGraphHierarchyNode.prototype.connectsAsSource=[],mxGraphHierarchyNode.prototype.hashCode=!1,mxGraphHierarchyNode.prototype.getRankValue=function(e){return this.maxRank},mxGraphHierarchyNode.prototype.getNextLayerConnectedCells=function(e){if(null==this.nextLayerConnectedCells){this.nextLayerConnectedCells=[],this.nextLayerConnectedCells[0]=[];for(var n=0;n<this.connectsAsTarget.length;n++){var t=this.connectsAsTarget[n];-1==t.maxRank||t.maxRank==e+1?this.nextLayerConnectedCells[0].push(t.source):this.nextLayerConnectedCells[0].push(t)}}return this.nextLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[],this.previousLayerConnectedCells[0]=[];for(var n=0;n<this.connectsAsSource.length;n++){var t=this.connectsAsSource[n];-1==t.minRank||t.minRank==e-1?this.previousLayerConnectedCells[0].push(t.target):this.previousLayerConnectedCells[0].push(t)}}return this.previousLayerConnectedCells[0]},mxGraphHierarchyNode.prototype.isVertex=function(){return!0},mxGraphHierarchyNode.prototype.getGeneralPurposeVariable=function(e){return this.temp[0]},mxGraphHierarchyNode.prototype.setGeneralPurposeVariable=function(e,n){this.temp[0]=n},mxGraphHierarchyNode.prototype.isAncestor=function(e){if(null!=e&&null!=this.hashCode&&null!=e.hashCode&&this.hashCode.length<e.hashCode.length){if(this.hashCode==e.hashCode)return!0;if(null==this.hashCode||null==this.hashCode)return!1;for(var n=0;n<this.hashCode.length;n++)if(this.hashCode[n]!=e.hashCode[n])return!1;return!0}return!1},mxGraphHierarchyNode.prototype.getCoreCell=function(){return this.cell},mxGraphHierarchyEdge.prototype=new mxGraphAbstractHierarchyCell,mxGraphHierarchyEdge.prototype.constructor=mxGraphHierarchyEdge,mxGraphHierarchyEdge.prototype.edges=null,mxGraphHierarchyEdge.prototype.source=null,mxGraphHierarchyEdge.prototype.target=null,mxGraphHierarchyEdge.prototype.isReversed=!1,mxGraphHierarchyEdge.prototype.invert=function(e){e=this.source,this.source=this.target,this.target=e,this.isReversed=!this.isReversed},mxGraphHierarchyEdge.prototype.getNextLayerConnectedCells=function(e){if(null==this.nextLayerConnectedCells){this.nextLayerConnectedCells=[];for(var n=0;n<this.temp.length;n++)this.nextLayerConnectedCells[n]=[],n==this.temp.length-1?this.nextLayerConnectedCells[n].push(this.source):this.nextLayerConnectedCells[n].push(this)}return this.nextLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.getPreviousLayerConnectedCells=function(e){if(null==this.previousLayerConnectedCells){this.previousLayerConnectedCells=[];for(var n=0;n<this.temp.length;n++)this.previousLayerConnectedCells[n]=[],0==n?this.previousLayerConnectedCells[n].push(this.target):this.previousLayerConnectedCells[n].push(this)}return this.previousLayerConnectedCells[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.isEdge=function(){return!0},mxGraphHierarchyEdge.prototype.getGeneralPurposeVariable=function(e){return this.temp[e-this.minRank-1]},mxGraphHierarchyEdge.prototype.setGeneralPurposeVariable=function(e,n){this.temp[e-this.minRank-1]=n},mxGraphHierarchyEdge.prototype.getCoreCell=function(){return null!=this.edges&&0<this.edges.length?this.edges[0]:null},mxGraphHierarchyModel.prototype.maxRank=null,mxGraphHierarchyModel.prototype.vertexMapper=null,mxGraphHierarchyModel.prototype.edgeMapper=null,mxGraphHierarchyModel.prototype.ranks=null,mxGraphHierarchyModel.prototype.roots=null,mxGraphHierarchyModel.prototype.parent=null,mxGraphHierarchyModel.prototype.dfsCount=0,mxGraphHierarchyModel.prototype.SOURCESCANSTARTRANK=1e8,mxGraphHierarchyModel.prototype.tightenToSource=!1,mxGraphHierarchyModel.prototype.createInternalCells=function(e,n,t){for(var a=e.getGraph(),i=0;i<n.length;i++){t[i]=new mxGraphHierarchyNode(n[i]);var s=mxCellPath.create(n[i]);this.vertexMapper[s]=t[i],s=e.getEdges(n[i]),t[i].connectsAsSource=[];for(var o=0;o<s.length;o++){if((d=e.getVisibleTerminal(s[o],!1))!=n[i]&&d!=n[i]&&e.graph.model.isVertex(d)&&!e.isVertexIgnored(d)){var r=e.getEdgesBetween(n[i],d,!1),l=e.getEdgesBetween(n[i],d,!0),d=mxCellPath.create(r[0]);if(null!=r&&0<r.length&&null==this.edgeMapper[d]&&2*l.length>=r.length){l=new mxGraphHierarchyEdge(r);for(var c=0;c<r.length;c++){var m=r[c];d=mxCellPath.create(m);this.edgeMapper[d]=l,a.resetEdge(m),e.disableEdgeStyle&&(e.setEdgeStyleEnabled(m,!1),e.setOrthogonalEdge(m,!0))}l.source=t[i],mxUtils.indexOf(t[i].connectsAsSource,l)<0&&t[i].connectsAsSource.push(l)}}}t[i].temp[0]=0}},mxGraphHierarchyModel.prototype.initialRank=function(){var e=[];if(null!=this.roots)for(var n=0;n<this.roots.length;n++){var t=mxCellPath.create(this.roots[n]);null!=(t=this.vertexMapper[t])&&e.push(t)}for(var a in this.vertexMapper)(t=this.vertexMapper[a]).temp[0]=-1;for(var i=e.slice();0<e.length;){var s,o;s=(t=e[0]).connectsAsTarget,o=t.connectsAsSource;var r=!0,l=this.SOURCESCANSTARTRANK;for(n=0;n<s.length;n++){var d=s[n];if(5270620!=d.temp[0]){r=!1;break}d=d.source,l=Math.min(l,d.temp[0]-1)}if(r){if(t.temp[0]=l,this.maxRank=Math.min(this.maxRank,l),null!=o)for(n=0;n<o.length;n++)(d=o[n]).temp[0]=5270620,-1==(d=d.target).temp[0]&&(e.push(d),d.temp[0]=-2);e.shift()}else if(n=e.shift(),e.push(t),n==t&&1==e.length)break}for(a in this.vertexMapper)(t=this.vertexMapper[a]).temp[0]-=this.maxRank;for(n=0;n<i.length;n++)for(e=0,s=(t=i[n]).connectsAsSource,a=0;a<s.length;a++)d=(d=s[a]).target,t.temp[0]=Math.max(e,d.temp[0]+1),e=t.temp[0];this.maxRank=this.SOURCESCANSTARTRANK-this.maxRank},mxGraphHierarchyModel.prototype.fixRanks=function(){var s=[];this.ranks=[];for(var e=0;e<this.maxRank+1;e++)s[e]=[],this.ranks[e]=s[e];var n=null;if(null!=this.roots){var t=this.roots;for(n=[],e=0;e<t.length;e++){var a=mxCellPath.create(t[e]);n[e]=this.vertexMapper[a]}}this.visit(function(e,n,t,a,i){if(0==i&&n.maxRank<0&&n.minRank<0&&(s[n.temp[0]].push(n),n.maxRank=n.temp[0],n.minRank=n.temp[0],n.temp[0]=s[n.maxRank].length-1),null!=e&&null!=t&&1<e.maxRank-n.maxRank)for(t.maxRank=e.maxRank,t.minRank=n.maxRank,t.temp=[],t.x=[],t.y=[],e=t.minRank+1;e<t.maxRank;e++)s[e].push(t),t.setGeneralPurposeVariable(e,s[e].length-1)},n,!1,null)},mxGraphHierarchyModel.prototype.visit=function(e,n,t,a){if(null!=n){for(var i=0;i<n.length;i++){var s=n[i];null!=s&&(null==a&&(a={}),t?(s.hashCode=[],s.hashCode[0]=this.dfsCount,s.hashCode[1]=i,this.extendedDfs(null,s,null,e,a,s.hashCode,i,0)):this.dfs(null,s,null,e,a,0))}this.dfsCount++}},mxGraphHierarchyModel.prototype.dfs=function(e,n,t,a,i,s){if(null!=n){var o=mxCellPath.create(n.cell);if(null==i[o])for(a(e,i[o]=n,t,s,0),e=n.connectsAsSource.slice(),t=0;t<e.length;t++)o=e[t],this.dfs(n,o.target,o,a,i,s+1);else a(e,n,t,s,1)}},mxGraphHierarchyModel.prototype.extendedDfs=function(e,n,t,a,i,s,o,r){if(null!=n)if(null==e||null!=n.hashCode&&n.hashCode[0]==e.hashCode[0]||(s=e.hashCode.length+1,n.hashCode=e.hashCode.slice(),n.hashCode[s-1]=o),null==i[o=mxCellPath.create(n.cell)])for(a(e,i[o]=n,t,r,0),e=n.connectsAsSource.slice(),t=0;t<e.length;t++)o=e[t],this.extendedDfs(n,o.target,o,a,i,n.hashCode,t,r+1);else a(e,n,t,r,1)},mxHierarchicalLayoutStage.prototype.execute=function(e){},mxMedianHybridCrossingReduction.prototype=new mxHierarchicalLayoutStage,mxMedianHybridCrossingReduction.prototype.constructor=mxMedianHybridCrossingReduction,mxMedianHybridCrossingReduction.prototype.layout=null,mxMedianHybridCrossingReduction.prototype.maxIterations=24,mxMedianHybridCrossingReduction.prototype.nestedBestRanks=null,mxMedianHybridCrossingReduction.prototype.currentBestCrossings=0,mxMedianHybridCrossingReduction.prototype.iterationsWithoutImprovement=0,mxMedianHybridCrossingReduction.prototype.maxNoImprovementIterations=2,mxMedianHybridCrossingReduction.prototype.execute=function(e){e=this.layout.getModel(),this.nestedBestRanks=[];for(var n=0;n<e.ranks.length;n++)this.nestedBestRanks[n]=e.ranks[n].slice();var t=0,a=this.calculateCrossings(e);for(n=0;n<this.maxIterations&&t<this.maxNoImprovementIterations;n++){this.weightedMedian(n,e),this.transpose(n,e);var i=this.calculateCrossings(e);if(i<a)for(a=i,i=t=0;i<this.nestedBestRanks.length;i++)for(var s=e.ranks[i],o=0;o<s.length;o++){var r=s[o];this.nestedBestRanks[i][r.getGeneralPurposeVariable(i)]=r}else for(t++,i=0;i<this.nestedBestRanks.length;i++)for(s=e.ranks[i],o=0;o<s.length;o++)(r=s[o]).setGeneralPurposeVariable(i,o);if(0==a)break}for(t=[],a=[],n=0;n<e.maxRank+1;n++)a[n]=[],t[n]=a[n];for(n=0;n<this.nestedBestRanks.length;n++)for(i=0;i<this.nestedBestRanks[n].length;i++)a[n].push(this.nestedBestRanks[n][i]);e.ranks=t},mxMedianHybridCrossingReduction.prototype.calculateCrossings=function(e){for(var n=e.ranks.length,t=0,a=1;a<n;a++)t+=this.calculateRankCrossing(a,e);return t},mxMedianHybridCrossingReduction.prototype.calculateRankCrossing=function(e,n){for(var t=0,a=n.ranks[e],i=a.length,s=n.ranks[e-1].length,o=[],r=0;r<i;r++)o[r]=[];for(r=0;r<a.length;r++)for(var l=(c=a[r]).getGeneralPurposeVariable(e),d=c.getPreviousLayerConnectedCells(e),c=0;c<d.length;c++){var m=d[c].getGeneralPurposeVariable(e-1);o[l][m]=201207}for(r=0;r<i;r++)for(c=0;c<s;c++)if(201207==o[r][c]){for(a=r+1;a<i;a++)for(l=0;l<c;l++)201207==o[a][l]&&t++;for(a=0;a<r;a++)for(l=c+1;l<s;l++)201207==o[a][l]&&t++}return t/2},mxMedianHybridCrossingReduction.prototype.transpose=function(e,n){for(var t=!0,a=0;t&&a++<10;)for(var i=1==e%2&&1==a%2,s=(t=!1,0);s<n.ranks.length;s++){for(var o=n.ranks[s],r=[],l=0;l<o.length;l++){(b=(f=o[l]).getGeneralPurposeVariable(s))<0&&(b=l),r[b]=f}var d=b=f=null,c=null,m=null,u=null,p=null,g=null,v=null,h=null;for(l=0;l<o.length-1;l++){if(0==l){for(var f=(v=r[l]).getNextLayerConnectedCells(s),b=v.getPreviousLayerConnectedCells(s),A=(m=[],u=[],0);A<f.length;A++)m[A]=f[A].getGeneralPurposeVariable(s+1);for(A=0;A<b.length;A++)u[A]=b[A].getGeneralPurposeVariable(s-1)}else f=d,b=c,m=p,u=g,v=h;for(d=(h=r[l+1]).getNextLayerConnectedCells(s),c=h.getPreviousLayerConnectedCells(s),p=[],g=[],A=0;A<d.length;A++)p[A]=d[A].getGeneralPurposeVariable(s+1);for(A=0;A<c.length;A++)g[A]=c[A].getGeneralPurposeVariable(s-1);var E=0,y=0;for(A=0;A<m.length;A++)for(var S=0;S<p.length;S++)m[A]>p[S]&&E++,m[A]<p[S]&&y++;for(A=0;A<u.length;A++)for(S=0;S<g.length;S++)u[A]>g[S]&&E++,u[A]<g[S]&&y++;(y<E||y==E&&i)&&(d=v.getGeneralPurposeVariable(s),v.setGeneralPurposeVariable(s,h.getGeneralPurposeVariable(s)),h.setGeneralPurposeVariable(s,d),d=f,c=b,p=m,g=u,h=v,i||(t=!0))}}},mxMedianHybridCrossingReduction.prototype.weightedMedian=function(e,n){var t=0==e%2;if(t)for(var a=n.maxRank-1;0<=a;a--)this.medianRank(a,t);else for(a=1;a<n.maxRank;a++)this.medianRank(a,t)},mxMedianHybridCrossingReduction.prototype.medianRank=function(e,n){for(var t=this.nestedBestRanks[e].length,a=[],i=[],s=0;s<t;s++){var o,r,l=this.nestedBestRanks[e][s],d=new MedianCellSorter;d.cell=l,r=n?e+1:e-1,null!=(o=n?l.getNextLayerConnectedCells(e):l.getPreviousLayerConnectedCells(e))&&0!=o.length?(d.medianValue=this.medianValue(o,r),a.push(d)):i[l.getGeneralPurposeVariable(e)]=!0}for(a.sort(MedianCellSorter.prototype.compare),s=0;s<t;s++)null==i[s]&&(l=a.shift().cell).setGeneralPurposeVariable(e,s)},mxMedianHybridCrossingReduction.prototype.medianValue=function(e,n){for(var t=[],a=0,i=0;i<e.length;i++){var s=e[i];t[a++]=s.getGeneralPurposeVariable(n)}return t.sort(function(e,n){return e-n}),1==a%2?t[Math.floor(a/2)]:2==a?(t[0]+t[1])/2:(s=t[(i=a/2)-1]-t[0],a=t[a-1]-t[i],(t[i-1]*a+t[i]*s)/(s+a))},MedianCellSorter.prototype.medianValue=0,MedianCellSorter.prototype.cell=!1,MedianCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.medianValue>e.medianValue?-1:n.medianValue<e.medianValue?1:0:0},mxMinimumCycleRemover.prototype=new mxHierarchicalLayoutStage,mxMinimumCycleRemover.prototype.constructor=mxMinimumCycleRemover,mxMinimumCycleRemover.prototype.layout=null,mxMinimumCycleRemover.prototype.execute=function(e){var n=this.layout.getModel(),s={},o=mxUtils.clone(n.vertexMapper,null,!0),t=null;if(null!=n.roots){var a=n.roots;t=[];for(e=0;e<a.length;e++){var i=mxCellPath.create(a[e]);t[e]=n.vertexMapper[i]}}if(n.visit(function(e,n,t,a,i){n.isAncestor(e)&&(t.invert(),mxUtils.remove(t,e.connectsAsSource),e.connectsAsTarget.push(t),mxUtils.remove(t,n.connectsAsTarget),n.connectsAsSource.push(t)),e=mxCellPath.create(n.cell),s[e]=n,delete o[e]},t,!0,null),t=null,0<o.lenth&&(t=mxUtils.clone(o,null,!0)),e=mxUtils.clone(s,null,!0),n.visit(function(e,n,t,a,i){n.isAncestor(e)&&(t.invert(),mxUtils.remove(t,e.connectsAsSource),n.connectsAsSource.push(t),e.connectsAsTarget.push(t),mxUtils.remove(t,n.connectsAsTarget)),e=mxCellPath.create(n.cell),s[e]=n,delete o[e]},o,!0,e),a=this.layout.getGraph(),null!=t&&0<t.length)for(n=n.roots,e=0;e<t.length;e++)i=t[e].cell,0==a.getIncomingEdges(i).length&&n.push(i)};var mxHierarchicalEdgeStyle={ORTHOGONAL:1,POLYLINE:2,STRAIGHT:3,CURVE:4};function WeightedCellSorter(e,n){this.cell=e,this.weightedValue=n}function mxHierarchicalLayout(e,n,t){mxGraphLayout.call(this,e),this.orientation=null!=n?n:mxConstants.DIRECTION_NORTH,this.deterministic=null==t||t}function mxGraphModel(e){this.currentEdit=this.createUndoableEdit(),null!=e?this.setRoot(e):this.clear()}function mxRootChange(e,n){this.model=e,this.previous=this.root=n}function mxChildChange(e,n,t,a){this.model=e,this.previous=this.parent=n,this.child=t,this.previousIndex=this.index=a}function mxTerminalChange(e,n,t,a){this.model=e,this.cell=n,this.previous=this.terminal=t,this.source=a}function mxValueChange(e,n,t){this.model=e,this.cell=n,this.previous=this.value=t}function mxStyleChange(e,n,t){this.model=e,this.cell=n,this.previous=this.style=t}function mxGeometryChange(e,n,t){this.model=e,this.cell=n,this.previous=this.geometry=t}function mxCollapseChange(e,n,t){this.model=e,this.cell=n,this.previous=this.collapsed=t}function mxVisibleChange(e,n,t){this.model=e,this.cell=n,this.previous=this.visible=t}function mxCellAttributeChange(e,n,t){this.cell=e,this.attribute=n,this.previous=this.value=t}function mxCell(e,n,t){this.value=e,this.setGeometry(n),this.setStyle(t),null!=this.onInit&&this.onInit()}function mxGeometry(e,n,t,a){mxRectangle.call(this,e,n,t,a)}mxCoordinateAssignment.prototype=new mxHierarchicalLayoutStage,mxCoordinateAssignment.prototype.constructor=mxCoordinateAssignment,mxCoordinateAssignment.prototype.layout=null,mxCoordinateAssignment.prototype.intraCellSpacing=30,mxCoordinateAssignment.prototype.interRankCellSpacing=100,mxCoordinateAssignment.prototype.parallelEdgeSpacing=10,mxCoordinateAssignment.prototype.maxIterations=8,mxCoordinateAssignment.prototype.prefHozEdgeSep=5,mxCoordinateAssignment.prototype.prefVertEdgeOff=2,mxCoordinateAssignment.prototype.minEdgeJetty=12,mxCoordinateAssignment.prototype.channelBuffer=4,mxCoordinateAssignment.prototype.jettyPositions=null,mxCoordinateAssignment.prototype.orientation=mxConstants.DIRECTION_NORTH,mxCoordinateAssignment.prototype.initialX=null,mxCoordinateAssignment.prototype.limitX=null,mxCoordinateAssignment.prototype.currentXDelta=null,mxCoordinateAssignment.prototype.widestRank=null,mxCoordinateAssignment.prototype.rankTopY=null,mxCoordinateAssignment.prototype.rankBottomY=null,mxCoordinateAssignment.prototype.widestRankValue=null,mxCoordinateAssignment.prototype.rankWidths=null,mxCoordinateAssignment.prototype.rankY=null,mxCoordinateAssignment.prototype.fineTuning=!0,mxCoordinateAssignment.prototype.edgeStyle=mxHierarchicalEdgeStyle.POLYLINE,mxCoordinateAssignment.prototype.nextLayerConnectedCache=null,mxCoordinateAssignment.prototype.previousLayerConnectedCache=null,mxCoordinateAssignment.prototype.groupPadding=10,mxCoordinateAssignment.prototype.printStatus=function(){var e=this.layout.getModel();mxLog.show(),mxLog.writeln("======Coord assignment debug=======");for(var n=0;n<e.ranks.length;n++){mxLog.write("Rank ",n," : ");for(var t=e.ranks[n],a=0;a<t.length;a++)mxLog.write(t[a].getGeneralPurposeVariable(n),"  ");mxLog.writeln()}mxLog.writeln("====================================")},mxCoordinateAssignment.prototype.execute=function(e){this.jettyPositions=[],e=this.layout.getModel(),this.currentXDelta=0,this.initialCoords(this.layout.getGraph(),e),this.fineTuning&&this.minNode(e);var n=1e8;if(this.fineTuning)for(var t=0;t<this.maxIterations;t++){if(0!=t&&(this.medianPos(t,e),this.minNode(e)),this.currentXDelta<n){for(var a=0;a<e.ranks.length;a++)for(var i=e.ranks[a],s=0;s<i.length;s++){var o=i[s];o.setX(a,o.getGeneralPurposeVariable(a))}n=this.currentXDelta}else for(a=0;a<e.ranks.length;a++)for(i=e.ranks[a],s=0;s<i.length;s++)(o=i[s]).setGeneralPurposeVariable(a,o.getX(a));this.minPath(this.layout.getGraph(),e),this.currentXDelta=0}this.setCellLocations(this.layout.getGraph(),e)},mxCoordinateAssignment.prototype.minNode=function(e){for(var n=[],t=[],a=[],i=0;i<=e.maxRank;i++){a[i]=e.ranks[i];for(var s=0;s<a[i].length;s++){var o=a[i][s];(r=new WeightedCellSorter(o,i)).rankIndex=s,r.visited=!0,n.push(r),t[o=mxCellPath.create(o.getCoreCell())]=r}}for(e=10*n.length,s=0;0<n.length&&s<=e;){i=(r=n.shift()).cell;var r,l=r.weightedValue,d=parseInt(r.rankIndex),c=(o=i.getNextLayerConnectedCells(l),i.getPreviousLayerConnectedCells(l)),m=o.length,u=c.length,p=this.medianXValue(o,l+1),g=this.medianXValue(c,l-1),v=m+u,h=i.getGeneralPurposeVariable(l),f=h;if(0<v&&(f=(p*m+g*u)/v),m=!1,f<h-1?0==d?(i.setGeneralPurposeVariable(l,f),m=!0):(h=(h=(d=a[l][d-1]).getGeneralPurposeVariable(l))+d.width/2+this.intraCellSpacing+i.width/2)<f?(i.setGeneralPurposeVariable(l,f),m=!0):h<i.getGeneralPurposeVariable(l)-1&&(i.setGeneralPurposeVariable(l,h),m=!0):h+1<f&&(d==a[l].length-1?(i.setGeneralPurposeVariable(l,f),m=!0):f<(h=(h=(d=a[l][d+1]).getGeneralPurposeVariable(l))-d.width/2-this.intraCellSpacing-i.width/2)?(i.setGeneralPurposeVariable(l,f),m=!0):h>i.getGeneralPurposeVariable(l)+1&&(i.setGeneralPurposeVariable(l,h),m=!0)),m){for(i=0;i<o.length;i++)l=o[i],null!=(l=t[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,n.push(l));for(i=0;i<c.length;i++)l=c[i],null!=(l=t[l=mxCellPath.create(l.getCoreCell())])&&0==l.visited&&(l.visited=!0,n.push(l))}r.visited=!1,s++}},mxCoordinateAssignment.prototype.medianPos=function(e,n){if(0==e%2)for(var t=n.maxRank;0<t;t--)this.rankMedianPosition(t-1,n,t);else for(t=0;t<n.maxRank-1;t++)this.rankMedianPosition(t+1,n,t)},mxCoordinateAssignment.prototype.rankMedianPosition=function(e,n,t){n=n.ranks[e];for(var a=[],i=[],s=0;s<n.length;s++){var o=n[s];a[s]=new WeightedCellSorter,a[s].cell=o,a[s].rankIndex=s;var r=mxCellPath.create(o.getCoreCell());i[r]=a[s];var l=null;l=t<e?o.getPreviousLayerConnectedCells(e):o.getNextLayerConnectedCells(e);a[s].weightedValue=this.calculatedWeightedValue(o,l)}for(a.sort(WeightedCellSorter.prototype.compare),s=0;s<a.length;s++){r=0,o=a[s].cell,r=0,null!=(l=t<e?o.getPreviousLayerConnectedCells(e).slice():o.getNextLayerConnectedCells(e).slice())&&(r=0<(r=l.length)?this.medianXValue(l,t):o.getGeneralPurposeVariable(e));for(var d=0,c=(l=-1e8,a[s].rankIndex-1);0<=c;){var m;if(null!=(m=i[m=mxCellPath.create(n[c].getCoreCell())])){var u=m.cell;m.visited?(l=u.getGeneralPurposeVariable(e)+u.width/2+this.intraCellSpacing+d+o.width/2,c=-1):(d+=u.width+this.intraCellSpacing,c--)}}for(d=0,u=1e8,c=a[s].rankIndex+1;c<a.length;)if(null!=(m=i[m=mxCellPath.create(n[c].getCoreCell())])){var p=m.cell;m.visited?(u=p.getGeneralPurposeVariable(e)-p.width/2-this.intraCellSpacing-d-o.width/2,c=a.length):(d+=p.width+this.intraCellSpacing,c++)}l<=r&&r<=u?o.setGeneralPurposeVariable(e,r):r<l?(o.setGeneralPurposeVariable(e,l),this.currentXDelta+=l-r):u<r&&(o.setGeneralPurposeVariable(e,u),this.currentXDelta+=r-u),a[s].visited=!0}},mxCoordinateAssignment.prototype.calculatedWeightedValue=function(e,n){for(var t=0,a=0;a<n.length;a++){var i=n[a];e.isVertex()&&i.isVertex()?t++:t=e.isEdge()&&i.isEdge()?t+8:t+2}return t},mxCoordinateAssignment.prototype.medianXValue=function(e,n){if(0==e.length)return 0;for(var t=[],a=0;a<e.length;a++)t[a]=e[a].getGeneralPurposeVariable(n);return t.sort(function(e,n){return e-n}),1==e.length%2?t[Math.floor(e.length/2)]:(t[(a=e.length/2)-1]+t[a])/2},mxCoordinateAssignment.prototype.initialCoords=function(e,n){this.calculateWidestRank(e,n);for(var t=this.widestRank;0<=t;t--)t<n.maxRank&&this.rankCoordinates(t,e,n);for(t=this.widestRank+1;t<=n.maxRank;t++)0<t&&this.rankCoordinates(t,e,n)},mxCoordinateAssignment.prototype.rankCoordinates=function(e,n,t){n=t.ranks[e],t=0;for(var a=this.initialX+(this.widestRankValue-this.rankWidths[e])/2,i=!1,s=0;s<n.length;s++){var o=n[s];if(o.isVertex()){var r=this.layout.getVertexBounds(o.cell);null!=r?this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(o.width=r.width,o.height=r.height):(o.width=r.height,o.height=r.width):i=!0,t=Math.max(t,o.height)}else o.isEdge()&&(r=1,null!=o.edges?r=o.edges.length:mxLog.warn("edge.edges is null"),o.width=(r-1)*this.parallelEdgeSpacing);a+=o.width/2,o.setX(e,a),o.setGeneralPurposeVariable(e,a),a+=o.width/2,a+=this.intraCellSpacing}1==i&&mxLog.warn("At least one cell has no bounds")},mxCoordinateAssignment.prototype.calculateWidestRank=function(e,n){var t=-this.interRankCellSpacing,a=0;this.rankWidths=[],this.rankY=[];for(var i=n.maxRank;0<=i;i--){for(var s=0,o=n.ranks[i],r=this.initialX,l=!1,d=0;d<o.length;d++){var c=o[d];if(c.isVertex()){var m=this.layout.getVertexBounds(c.cell);null!=m?this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(c.width=m.width,c.height=m.height):(c.width=m.height,c.height=m.width):l=!0,s=Math.max(s,c.height)}else c.isEdge()&&(m=1,null!=c.edges?m=c.edges.length:mxLog.warn("edge.edges is null"),c.width=(m-1)*this.parallelEdgeSpacing);r+=c.width/2,c.setX(i,r),c.setGeneralPurposeVariable(i,r),r+=c.width/2,(r+=this.intraCellSpacing)>this.widestRankValue&&(this.widestRankValue=r,this.widestRank=i),this.rankWidths[i]=r}for(1==l&&mxLog.warn("At least one cell has no bounds"),this.rankY[i]=t,r=s/2+a/2+this.interRankCellSpacing,a=s,t=this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_WEST?t+r:t-r,d=0;d<o.length;d++)o[d].setY(i,t)}},mxCoordinateAssignment.prototype.minPath=function(e,n){var t,a=n.edgeMapper;for(t in a){var i=a[t];if(!(i.maxRank-i.minRank-1<1)){for(var s=i.getGeneralPurposeVariable(i.minRank+1),o=!0,r=0,l=i.minRank+2;l<i.maxRank;l++){s!=(d=i.getGeneralPurposeVariable(l))?(o=!1,s=d):r++}if(!o){o=s=0;var d=[],c=[],m=i.getGeneralPurposeVariable(i.minRank+1);for(l=i.minRank+1;l<i.maxRank-1;l++){var u=i.getX(l+1);m==u?(d[l-i.minRank-1]=m,s++):this.repositionValid(n,i,l+1,m)?(d[l-i.minRank-1]=m,s++):m=d[l-i.minRank-1]=u}for(m=i.getX(l),l=i.maxRank-1;l>i.minRank+1;l--)m==(u=i.getX(l-1))?(c[l-i.minRank-2]=m,o++):this.repositionValid(n,i,l-1,m)?(c[l-i.minRank-2]=m,o++):(c[l-i.minRank-2]=i.getX(l-1),m=u);if(r<o||r<s)if(s<=o)for(l=i.maxRank-2;l>i.minRank;l--)i.setX(l,c[l-i.minRank-1]);else if(o<s)for(l=i.minRank+2;l<i.maxRank;l++)i.setX(l,d[l-i.minRank-2])}}}},mxCoordinateAssignment.prototype.repositionValid=function(e,n,t,a){e=e.ranks[t];for(var i=-1,s=0;s<e.length;s++)if(n==e[s]){i=s;break}if(i<0)return!1;if(a<(s=n.getGeneralPurposeVariable(t))){if(0==i)return!0;if(!((t=(t=(e=e[i-1]).getGeneralPurposeVariable(t))+e.width/2+this.intraCellSpacing+n.width/2)<=a))return!1}else if(s<a){if(i==e.length-1)return!0;if(!(a<=(t=(t=(e=e[i+1]).getGeneralPurposeVariable(t))-e.width/2-this.intraCellSpacing-n.width/2)))return!1}return!0},mxCoordinateAssignment.prototype.setCellLocations=function(e,n){this.rankTopY=[],this.rankBottomY=[];for(var t=0;t<n.ranks.length;t++)this.rankTopY[t]=Number.MAX_VALUE,this.rankBottomY[t]=0;t=null,this.layout.resizeParent&&(t={});var a,i=n.edgeMapper,s=n.vertexMapper;for(a in s){var o=s[a];if(this.setVertexLocation(o),this.layout.resizeParent){o=e.model.getParent(o.cell);var r=mxCellPath.create(o);null==t[r]&&(t[r]=o)}}for(a in this.layout.resizeParent&&null!=t&&this.adjustParents(t),(this.edgeStyle==mxHierarchicalEdgeStyle.ORTHOGONAL||this.edgeStyle==mxHierarchicalEdgeStyle.POLYLINE||this.edgeStyle==mxHierarchicalEdgeStyle.CURVE)&&this.localEdgeProcessing(n),i)this.setEdgePosition(i[a])},mxCoordinateAssignment.prototype.adjustParents=function(e){var n,t=[];for(n in e)t.push(e[n]);this.layout.arrangeGroups(mxUtils.sortCells(t,!0),this.groupPadding)},mxCoordinateAssignment.prototype.localEdgeProcessing=function(e){for(var n=0;n<e.ranks.length;n++)for(var t=e.ranks[n],a=0;a<t.length;a++){var i=t[a];if(i.isVertex())for(var s=i.getPreviousLayerConnectedCells(n),o=n-1,r=0;r<2;r++){if(-1<o&&o<e.ranks.length&&null!=s&&0<s.length){for(var l=[],d=0;d<s.length;d++){var c=new WeightedCellSorter(s[d],s[d].getX(o));l.push(c)}l.sort(WeightedCellSorter.prototype.compare);var m=(c=i.x[0]-i.width/2)+i.width,u=s=0;for(o=[],d=0;d<l.length;d++){var p,g=l[d].cell;if(g.isVertex()){p=0==r?i.connectsAsSource:i.connectsAsTarget;for(var v=0;v<p.length;v++)p[v].source!=g&&p[v].target!=g||(s+=p[v].edges.length,u++,o.push(p[v]))}else s+=g.edges.length,u++,o.push(g)}for(i.width>(s+1)*this.prefHozEdgeSep+2*this.prefHozEdgeSep&&(c+=this.prefHozEdgeSep,m-=this.prefHozEdgeSep),c+=(l=(m-c)/s)/2,m=this.minEdgeJetty-this.prefVertEdgeOff,d=u=0;d<o.length;d++){for(g=o[d].edges.length,v=mxCellPath.create(o[d].edges[0]),null==(p=this.jettyPositions[v])&&(p=[],this.jettyPositions[v]=p),d<s/2?m+=this.prefVertEdgeOff:s/2<d&&(m-=this.prefVertEdgeOff),v=0;v<g;v++)p[4*v+2*r]=c,c+=l,p[4*v+2*r+1]=m;u=Math.max(u,m)}}s=i.getNextLayerConnectedCells(n),o=n+1}}},mxCoordinateAssignment.prototype.setEdgePosition=function(e){var n=0;if(101207!=e.temp[0]){var t=e.maxRank,a=e.minRank;t==a&&(t=e.source.maxRank,a=e.target.minRank);for(var i=0,s=mxCellPath.create(e.edges[0]),o=(s=this.jettyPositions[s],e.isReversed?e.target.cell:e.source.cell),r=this.layout.graph,l=0;l<e.edges.length;l++){var d=e.edges[l],c=this.layout.getVisibleTerminal(d,!0),m=r.model.getTerminal(d,!0),u=[],p=e.isReversed;if(c!=o&&(p=!p),null!=s){var g=p?2:0,v=p?this.rankTopY[a]:this.rankBottomY[t],h=s[4*i+1+g];p&&(h=-h),v+=h,g=s[4*i+g],m=r.model.getTerminal(d,!0),this.layout.isPort(m)&&r.model.getParent(m)==c&&(g=null!=(g=r.view.getState(m))?g.x:c.geometry.x+e.source.width*m.geometry.x),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(u.push(new mxPoint(g,v)),this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(g,v+h))):(u.push(new mxPoint(v,g)),this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(v+h,g)))}for(g=e.x.length-1,v=h=-1,c=e.maxRank-1,p&&(g=0,h=e.x.length,v=1,c=e.minRank+1);e.maxRank!=e.minRank&&g!=h;g+=v){m=e.x[g]+n;var f=(this.rankTopY[c]+this.rankBottomY[c+1])/2,b=(this.rankTopY[c-1]+this.rankBottomY[c])/2;if(p){var A=f;f=b,b=A}this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(u.push(new mxPoint(m,f)),u.push(new mxPoint(m,b))):(u.push(new mxPoint(f,m)),u.push(new mxPoint(b,m))),this.limitX=Math.max(this.limitX,m),c+=v}null!=s&&(g=p?2:0,v=p?this.rankBottomY[t]:this.rankTopY[a],h=s[4*i+3-g],p&&(h=-h),v-=h,g=s[4*i+2-g],p=r.model.getTerminal(d,!1),c=this.layout.getVisibleTerminal(d,!1),this.layout.isPort(p)&&r.model.getParent(p)==c&&(g=null!=(g=r.view.getState(p))?g.x:c.geometry.x+e.target.width*p.geometry.x),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?(this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(g,v-h)),u.push(new mxPoint(g,v))):(this.edgeStyle==mxHierarchicalEdgeStyle.CURVE&&u.push(new mxPoint(v-h,g)),u.push(new mxPoint(v,g)))),e.isReversed&&this.processReversedEdge(e,d),this.layout.setEdgePoints(d,u),n=0==n?this.parallelEdgeSpacing:0<n?-n:-n+this.parallelEdgeSpacing,i++}e.temp[0]=101207}},mxCoordinateAssignment.prototype.setVertexLocation=function(e){var n=e.cell,t=e.x[0]-e.width/2,a=e.y[0]-e.height/2;this.rankTopY[e.minRank]=Math.min(this.rankTopY[e.minRank],a),this.rankBottomY[e.minRank]=Math.max(this.rankBottomY[e.minRank],a+e.height),this.orientation==mxConstants.DIRECTION_NORTH||this.orientation==mxConstants.DIRECTION_SOUTH?this.layout.setVertexLocation(n,t,a):this.layout.setVertexLocation(n,a,t),this.limitX=Math.max(this.limitX,t+e.width)},mxCoordinateAssignment.prototype.processReversedEdge=function(e,n){},WeightedCellSorter.prototype.weightedValue=0,WeightedCellSorter.prototype.nudge=!1,WeightedCellSorter.prototype.visited=!1,WeightedCellSorter.prototype.rankIndex=null,WeightedCellSorter.prototype.cell=null,WeightedCellSorter.prototype.compare=function(e,n){return null!=e&&null!=n?n.weightedValue>e.weightedValue?-1:n.weightedValue<e.weightedValue?1:n.nudge?-1:1:0},mxHierarchicalLayout.prototype=new mxGraphLayout,mxHierarchicalLayout.prototype.constructor=mxHierarchicalLayout,mxHierarchicalLayout.prototype.roots=null,mxHierarchicalLayout.prototype.resizeParent=!1,mxHierarchicalLayout.prototype.moveParent=!1,mxHierarchicalLayout.prototype.parentBorder=0,mxHierarchicalLayout.prototype.intraCellSpacing=30,mxHierarchicalLayout.prototype.interRankCellSpacing=100,mxHierarchicalLayout.prototype.interHierarchySpacing=60,mxHierarchicalLayout.prototype.parallelEdgeSpacing=10,mxHierarchicalLayout.prototype.orientation=mxConstants.DIRECTION_NORTH,mxHierarchicalLayout.prototype.fineTuning=!0,mxHierarchicalLayout.prototype.tightenToSource=!0,mxHierarchicalLayout.prototype.disableEdgeStyle=!0,mxHierarchicalLayout.prototype.traverseAncestors=!0,mxHierarchicalLayout.prototype.model=null,mxHierarchicalLayout.prototype.edgesCache=null,mxHierarchicalLayout.prototype.getModel=function(){return this.model},mxHierarchicalLayout.prototype.execute=function(e,n){this.parent=e;var t=this.graph.model;if(this.edgesCache={},null!=n||null!=e){if(null!=n&&null!=e){for(var a=[],i=0;i<n.length;i++)t.isAncestor(e,n[i])&&a.push(n[i]);this.roots=a}else this.roots=n;t.beginUpdate();try{this.run(e),this.resizeParent&&!this.graph.isCellCollapsed(e)&&this.graph.updateGroupBounds([e],this.parentBorder,this.moveParent)}finally{t.endUpdate()}}},mxHierarchicalLayout.prototype.findRoots=function(e,n){var t=[];if(null!=e&&null!=n){var a,i=this.graph.model,s=null,o=-1e5;for(a in n){var r=n[a];if(i.isVertex(r)&&this.graph.isCellVisible(r)){for(var l=this.getEdges(r),d=0,c=0,m=0;m<l.length;m++)this.getVisibleTerminal(l[m],!0)==r?d++:c++;0==c&&0<d&&t.push(r),o<(l=d-c)&&(o=l,s=r)}}0==t.length&&null!=s&&t.push(s)}return t},mxHierarchicalLayout.prototype.getEdges=function(e){var n=mxCellPath.create(e);if(null!=this.edgesCache[n])return this.edgesCache[n];for(var t=this.graph.model,a=[],i=this.graph.isCellCollapsed(e),s=t.getChildCount(e),o=0;o<s;o++){var r=t.getChildAt(e,o);this.isPort(r)?a=a.concat(t.getEdges(r,!0,!0)):!i&&this.graph.isCellVisible(r)||(a=a.concat(t.getEdges(r,!0,!0)))}for(a=a.concat(t.getEdges(e,!0,!0)),t=[],o=0;o<a.length;o++)((i=this.getVisibleTerminal(a[o],!0))==(s=this.getVisibleTerminal(a[o],!1))||i!=s&&(s==e&&(null==this.parent||this.graph.isValidAncestor(i,this.parent,this.traverseAncestors))||i==e&&(null==this.parent||this.graph.isValidAncestor(s,this.parent,this.traverseAncestors))))&&t.push(a[o]);return this.edgesCache[n]=t},mxHierarchicalLayout.prototype.getVisibleTerminal=function(e,n){var t=null!=(t=this.graph.view.getState(e))?t.getVisibleTerminal(n):this.graph.view.getVisibleTerminal(e,n);return this.isPort(t)&&(t=this.graph.model.getParent(t)),t},mxHierarchicalLayout.prototype.run=function(e){var n=[],t=[];if(null==this.roots&&null!=e){var a={};this.filterDescendants(e,a),this.roots=[];var i,s=!0;for(i in a)if(null!=a[i]){s=!1;break}for(;!s;){var o=this.findRoots(e,a);for(s=0;s<o.length;s++){var r=[];n.push(r),this.traverse(o[s],!0,null,t,r,n,a)}for(s=0;s<o.length;s++)this.roots.push(o[s]);for(i in s=!0,a)if(null!=a[i]){s=!1;break}}}else for(s=0;s<roots.length;s++)r=[],n.push(r),traverse(roots.get(s),!0,null,t,r,n,null);for(s=t=0;s<n.length;s++){for(i in a=[],r=n[s])a.push(r[i]);this.model=new mxGraphHierarchyModel(this,a,this.roots,e,this.tightenToSource),this.cycleStage(e),this.layeringStage(),this.crossingStage(e),t=this.placementStage(t,e)}},mxHierarchicalLayout.prototype.filterDescendants=function(e,n){var t=this.graph.model;if(t.isVertex(e)&&e!=this.parent&&this.graph.isCellVisible(e)&&(n[mxCellPath.create(e)]=e),this.traverseAncestors||e==this.parent&&this.graph.isCellVisible(e))for(var a=t.getChildCount(e),i=0;i<a;i++){var s=t.getChildAt(e,i);this.isPort(s)||this.filterDescendants(s,n)}},mxHierarchicalLayout.prototype.isPort=function(e){return!!e.geometry.relative},mxHierarchicalLayout.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;for(var a=this.getEdges(e),i=[],s=0;s<a.length;s++){var o=this.getVisibleTerminal(a[s],!0),r=this.getVisibleTerminal(a[s],!1);(o==e&&r==n||!t&&o==n&&r==e)&&i.push(a[s])}return i},mxHierarchicalLayout.prototype.traverse=function(e,n,t,a,i,s,o){if(null!=e&&null!=a){var r=mxCellPath.create(e);if(null!=a[r]||null!=o&&null==o[r]){if(null==i[r])for(t=0;t<s.length;t++)if(null!=(e=s[t])[r]){for(l in i)e[l]=i[l];return s.pop(),e}}else{null==i[r]&&(i[r]=e),null==a[r]&&(a[r]=e),delete o[r];var l=this.getEdges(e);for(t=0;t<l.length;t++)r=this.getVisibleTerminal(l[t],!0)==e,(!n||r)&&(r=this.getVisibleTerminal(l[t],!r),i=this.traverse(r,n,l[t],a,i,s,o))}}return i},mxHierarchicalLayout.prototype.cycleStage=function(e){new mxMinimumCycleRemover(this).execute(e)},mxHierarchicalLayout.prototype.layeringStage=function(){this.model.initialRank(),this.model.fixRanks()},mxHierarchicalLayout.prototype.crossingStage=function(e){new mxMedianHybridCrossingReduction(this).execute(e)},mxHierarchicalLayout.prototype.placementStage=function(e,n){var t=new mxCoordinateAssignment(this,this.intraCellSpacing,this.interRankCellSpacing,this.orientation,e,this.parallelEdgeSpacing);return t.fineTuning=this.fineTuning,t.execute(n),t.limitX+this.interHierarchySpacing},mxGraphModel.prototype=new mxEventSource,mxGraphModel.prototype.constructor=mxGraphModel,mxGraphModel.prototype.root=null,mxGraphModel.prototype.cells=null,mxGraphModel.prototype.maintainEdgeParent=!0,mxGraphModel.prototype.createIds=!0,mxGraphModel.prototype.prefix="",mxGraphModel.prototype.postfix="",mxGraphModel.prototype.nextId=0,mxGraphModel.prototype.currentEdit=null,mxGraphModel.prototype.updateLevel=0,mxGraphModel.prototype.endingUpdate=!1,mxGraphModel.prototype.clear=function(){this.setRoot(this.createRoot())},mxGraphModel.prototype.isCreateIds=function(){return this.createIds},mxGraphModel.prototype.setCreateIds=function(e){this.createIds=e},mxGraphModel.prototype.createRoot=function(){var e=new mxCell;return e.insert(new mxCell),e},mxGraphModel.prototype.getCell=function(e){return null!=this.cells?this.cells[e]:null},mxGraphModel.prototype.filterCells=function(e,n){var t=null;if(null!=e){t=[];for(var a=0;a<e.length;a++)n(e[a])&&t.push(e[a])}return t},mxGraphModel.prototype.getDescendants=function(e){return this.filterDescendants(null,e)},mxGraphModel.prototype.filterDescendants=function(e,n){var t=[];n=n||this.getRoot(),(null==e||e(n))&&t.push(n);for(var a=this.getChildCount(n),i=0;i<a;i++){var s=this.getChildAt(n,i);t=t.concat(this.filterDescendants(e,s))}return t},mxGraphModel.prototype.getRoot=function(e){var n=e||this.root;if(null!=e)for(;null!=e;)n=e,e=this.getParent(e);return n},mxGraphModel.prototype.setRoot=function(e){return this.execute(new mxRootChange(this,e)),e},mxGraphModel.prototype.rootChanged=function(e){var n=this.root;return this.root=e,this.nextId=0,this.cells=null,this.cellAdded(e),n},mxGraphModel.prototype.isRoot=function(e){return null!=e&&this.root==e},mxGraphModel.prototype.isLayer=function(e){return this.isRoot(this.getParent(e))},mxGraphModel.prototype.isAncestor=function(e,n){for(;null!=n&&n!=e;)n=this.getParent(n);return n==e},mxGraphModel.prototype.contains=function(e){return this.isAncestor(this.root,e)},mxGraphModel.prototype.getParent=function(e){return null!=e?e.getParent():null},mxGraphModel.prototype.add=function(e,n,t){if(n!=e&&null!=e&&null!=n){null==t&&(t=this.getChildCount(e));var a=e!=this.getParent(n);this.execute(new mxChildChange(this,e,n,t)),this.maintainEdgeParent&&a&&this.updateEdgeParents(n)}return n},mxGraphModel.prototype.cellAdded=function(e){if(null!=e){if(null==e.getId()&&this.createIds&&e.setId(this.createId(e)),null!=e.getId())if((n=this.getCell(e.getId()))!=e){for(;null!=n;)e.setId(this.createId(e)),n=this.getCell(e.getId());null==this.cells&&(this.cells={}),this.cells[e.getId()]=e}mxUtils.isNumeric(e.getId())&&(this.nextId=Math.max(this.nextId,e.getId()));for(var n=this.getChildCount(e),t=0;t<n;t++)this.cellAdded(this.getChildAt(e,t))}},mxGraphModel.prototype.createId=function(e){return e=this.nextId,this.nextId++,this.prefix+e+this.postfix},mxGraphModel.prototype.updateEdgeParents=function(e,n){n=n||this.getRoot(e);for(var t=this.getChildCount(e),a=0;a<t;a++){var i=this.getChildAt(e,a);this.updateEdgeParents(i,n)}for(i=this.getEdgeCount(e),t=[],a=0;a<i;a++)t.push(this.getEdgeAt(e,a));for(a=0;a<t.length;a++)i=t[a],this.isAncestor(n,i)&&this.updateEdgeParent(i,n)},mxGraphModel.prototype.updateEdgeParent=function(e,n){for(var t=this.getTerminal(e,!0),a=this.getTerminal(e,!1),i=null;null!=t&&!this.isEdge(t)&&null!=t.geometry&&t.geometry.relative;)t=this.getParent(t);for(;null!=a&&!this.isEdge(a)&&null!=a.geometry&&a.geometry.relative;)a=this.getParent(a);if(this.isAncestor(n,t)&&this.isAncestor(n,a)&&(null!=(i=t==a?this.getParent(t):this.getNearestCommonAncestor(t,a))&&(this.getParent(i)!=this.root||this.isAncestor(i,e))&&this.getParent(e)!=i)){if(null!=(t=this.getGeometry(e))){var s=this.getOrigin(this.getParent(e)),o=this.getOrigin(i);a=o.x-s.x,s=o.y-s.y;(t=t.clone()).translate(-a,-s),this.setGeometry(e,t)}this.add(i,e,this.getChildCount(i))}},mxGraphModel.prototype.getOrigin=function(e){var n=null;return null!=e?(n=this.getOrigin(this.getParent(e)),this.isEdge(e)||null!=(e=this.getGeometry(e))&&(n.x+=e.x,n.y+=e.y)):n=new mxPoint,n},mxGraphModel.prototype.getNearestCommonAncestor=function(e,n){if(null!=e&&null!=n&&(null!=(s=mxCellPath.create(n))&&0<s.length)){var t=e,a=mxCellPath.create(t);if(s.length<a.length){t=n;var i=a,s=(a=s,i)}for(;null!=t;){if(i=this.getParent(t),0==s.indexOf(a+mxCellPath.PATH_SEPARATOR)&&null!=i)return t;a=mxCellPath.getParentPath(a),t=i}}return null},mxGraphModel.prototype.remove=function(e){return e==this.root?this.setRoot(null):null!=this.getParent(e)&&this.execute(new mxChildChange(this,null,e)),e},mxGraphModel.prototype.cellRemoved=function(e){if(null!=e&&null!=this.cells){for(var n=this.getChildCount(e)-1;0<=n;n--)this.cellRemoved(this.getChildAt(e,n));null!=this.cells&&null!=e.getId()&&delete this.cells[e.getId()]}},mxGraphModel.prototype.parentForCellChanged=function(e,n,t){var a=this.getParent(e);return null!=n?(n!=a||a.getIndex(e)!=t)&&n.insert(e,t):null!=a&&(t=a.getIndex(e),a.remove(t)),this.contains(a)||null==n?null==n&&this.cellRemoved(e):this.cellAdded(e),a},mxGraphModel.prototype.getChildCount=function(e){return null!=e?e.getChildCount():0},mxGraphModel.prototype.getChildAt=function(e,n){return null!=e?e.getChildAt(n):null},mxGraphModel.prototype.getChildren=function(e){return null!=e?e.children:null},mxGraphModel.prototype.getChildVertices=function(e){return this.getChildCells(e,!0,!1)},mxGraphModel.prototype.getChildEdges=function(e){return this.getChildCells(e,!1,!0)},mxGraphModel.prototype.getChildCells=function(e,n,t){n=null!=n&&n,t=null!=t&&t;for(var a=this.getChildCount(e),i=[],s=0;s<a;s++){var o=this.getChildAt(e,s);(!t&&!n||t&&this.isEdge(o)||n&&this.isVertex(o))&&i.push(o)}return i},mxGraphModel.prototype.getTerminal=function(e,n){return null!=e?e.getTerminal(n):null},mxGraphModel.prototype.setTerminal=function(e,n,t){var a=n!=this.getTerminal(e,t);return this.execute(new mxTerminalChange(this,e,n,t)),this.maintainEdgeParent&&a&&this.updateEdgeParent(e,this.getRoot()),n},mxGraphModel.prototype.setTerminals=function(e,n,t){this.beginUpdate();try{this.setTerminal(e,n,!0),this.setTerminal(e,t,!1)}finally{this.endUpdate()}},mxGraphModel.prototype.terminalForCellChanged=function(e,n,t){var a=this.getTerminal(e,t);return null!=n?n.insertEdge(e,t):null!=a&&a.removeEdge(e,t),a},mxGraphModel.prototype.getEdgeCount=function(e){return null!=e?e.getEdgeCount():0},mxGraphModel.prototype.getEdgeAt=function(e,n){return null!=e?e.getEdgeAt(n):null},mxGraphModel.prototype.getDirectedEdgeCount=function(e,n,t){for(var a=0,i=this.getEdgeCount(e),s=0;s<i;s++){var o=this.getEdgeAt(e,s);o!=t&&this.getTerminal(o,n)==e&&a++}return a},mxGraphModel.prototype.getConnections=function(e){return this.getEdges(e,!0,!0,!1)},mxGraphModel.prototype.getIncomingEdges=function(e){return this.getEdges(e,!0,!1,!1)},mxGraphModel.prototype.getOutgoingEdges=function(e){return this.getEdges(e,!1,!0,!1)},mxGraphModel.prototype.getEdges=function(e,n,t,a){n=null==n||n,t=null==t||t,a=null==a||a;for(var i=this.getEdgeCount(e),s=[],o=0;o<i;o++){var r=this.getEdgeAt(e,o),l=this.getTerminal(r,!0),d=this.getTerminal(r,!1);(a&&l==d||l!=d&&(n&&d==e||t&&l==e))&&s.push(r)}return s},mxGraphModel.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;var a=this.getEdgeCount(e),i=this.getEdgeCount(n),s=e,o=a;for(i<a&&(o=i,s=n),a=[],i=0;i<o;i++){var r=this.getEdgeAt(s,i),l=this.getTerminal(r,!0),d=this.getTerminal(r,!1);(l==e&&d==n||!t&&(d==e&&l==n))&&a.push(r)}return a},mxGraphModel.prototype.getOpposites=function(e,n,t,a){t=null==t||t,a=null==a||a;var i=[];if(null!=e)for(var s=0;s<e.length;s++){var o=this.getTerminal(e[s],!0),r=this.getTerminal(e[s],!1);o==n&&null!=r&&r!=n&&a?i.push(r):r==n&&null!=o&&o!=n&&t&&i.push(o)}return i},mxGraphModel.prototype.getTopmostCells=function(e){for(var n=[],t=0;t<e.length;t++){for(var a=e[t],i=!0,s=this.getParent(a);null!=s;){if(0<=mxUtils.indexOf(e,s)){i=!1;break}s=this.getParent(s)}i&&n.push(a)}return n},mxGraphModel.prototype.isVertex=function(e){return null!=e&&e.isVertex()},mxGraphModel.prototype.isEdge=function(e){return null!=e&&e.isEdge()},mxGraphModel.prototype.isConnectable=function(e){return null!=e&&e.isConnectable()},mxGraphModel.prototype.getValue=function(e){return null!=e?e.getValue():null},mxGraphModel.prototype.setValue=function(e,n){return this.execute(new mxValueChange(this,e,n)),n},mxGraphModel.prototype.valueForCellChanged=function(e,n){return e.valueChanged(n)},mxGraphModel.prototype.getGeometry=function(e,n){return null!=e?e.getGeometry():null},mxGraphModel.prototype.setGeometry=function(e,n){return n!=this.getGeometry(e)&&this.execute(new mxGeometryChange(this,e,n)),n},mxGraphModel.prototype.geometryForCellChanged=function(e,n){var t=this.getGeometry(e);return e.setGeometry(n),t},mxGraphModel.prototype.getStyle=function(e){return null!=e?e.getStyle():null},mxGraphModel.prototype.setStyle=function(e,n){return n!=this.getStyle(e)&&this.execute(new mxStyleChange(this,e,n)),n},mxGraphModel.prototype.styleForCellChanged=function(e,n){var t=this.getStyle(e);return e.setStyle(n),t},mxGraphModel.prototype.isCollapsed=function(e){return null!=e&&e.isCollapsed()},mxGraphModel.prototype.setCollapsed=function(e,n){return n!=this.isCollapsed(e)&&this.execute(new mxCollapseChange(this,e,n)),n},mxGraphModel.prototype.collapsedStateForCellChanged=function(e,n){var t=this.isCollapsed(e);return e.setCollapsed(n),t},mxGraphModel.prototype.isVisible=function(e){return null!=e&&e.isVisible()},mxGraphModel.prototype.setVisible=function(e,n){return n!=this.isVisible(e)&&this.execute(new mxVisibleChange(this,e,n)),n},mxGraphModel.prototype.visibleStateForCellChanged=function(e,n){var t=this.isVisible(e);return e.setVisible(n),t},mxGraphModel.prototype.execute=function(e){e.execute(),this.beginUpdate(),this.currentEdit.add(e),this.fireEvent(new mxEventObject(mxEvent.EXECUTE,"change",e)),this.fireEvent(new mxEventObject(mxEvent.EXECUTED,"change",e)),this.endUpdate()},mxGraphModel.prototype.beginUpdate=function(){this.updateLevel++,this.fireEvent(new mxEventObject(mxEvent.BEGIN_UPDATE)),1==this.updateLevel&&this.fireEvent(new mxEventObject(mxEvent.START_EDIT))},mxGraphModel.prototype.endUpdate=function(){if(this.updateLevel--,0==this.updateLevel&&this.fireEvent(new mxEventObject(mxEvent.END_EDIT)),!this.endingUpdate){this.endingUpdate=0==this.updateLevel,this.fireEvent(new mxEventObject(mxEvent.END_UPDATE,"edit",this.currentEdit));try{if(this.endingUpdate&&!this.currentEdit.isEmpty()){this.fireEvent(new mxEventObject(mxEvent.BEFORE_UNDO,"edit",this.currentEdit));var e=this.currentEdit;this.currentEdit=this.createUndoableEdit(),e.notify(),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",e))}}finally{this.endingUpdate=!1}}},mxGraphModel.prototype.createUndoableEdit=function(){var e=new mxUndoableEdit(this,!0);return e.notify=function(){e.source.fireEvent(new mxEventObject(mxEvent.CHANGE,"edit",e,"changes",e.changes)),e.source.fireEvent(new mxEventObject(mxEvent.NOTIFY,"edit",e,"changes",e.changes))},e},mxGraphModel.prototype.mergeChildren=function(e,n,t){t=null==t||t,this.beginUpdate();try{var a={};for(var i in this.mergeChildrenImpl(e,n,t,a),a){var s=a[i],o=this.getTerminal(s,!0);null!=o&&(o=a[mxCellPath.create(o)],this.setTerminal(s,o,!0)),null!=(o=this.getTerminal(s,!1))&&(o=a[mxCellPath.create(o)],this.setTerminal(s,o,!1))}}finally{this.endUpdate()}},mxGraphModel.prototype.mergeChildrenImpl=function(e,n,t,a){this.beginUpdate();try{for(var i=e.getChildCount(),s=0;s<i;s++){var o=e.getChildAt(s);if("function"==typeof o.getId){var r=o.getId(),l=null==r||this.isEdge(o)&&t?null:this.getCell(r);if(null==l){var d=o.clone();d.setId(r),d.setTerminal(o.getTerminal(!0),!0),d.setTerminal(o.getTerminal(!1),!1),l=n.insert(d),this.cellAdded(l)}a[mxCellPath.create(o)]=l,this.mergeChildrenImpl(o,l,t,a)}}}finally{this.endUpdate()}},mxGraphModel.prototype.getParents=function(e){var n=[];if(null!=e)for(var t={},a=0;a<e.length;a++){var i=this.getParent(e[a]);if(null!=i){var s=mxCellPath.create(i);null==t[s]&&(t[s]=i,n.push(i))}}return n},mxGraphModel.prototype.cloneCell=function(e){return null!=e?this.cloneCells([e],!0)[0]:null},mxGraphModel.prototype.cloneCells=function(e,n){for(var t={},a=[],i=0;i<e.length;i++)null!=e[i]?a.push(this.cloneCellImpl(e[i],t,n)):a.push(null);for(i=0;i<a.length;i++)null!=a[i]&&this.restoreClone(a[i],e[i],t);return a},mxGraphModel.prototype.cloneCellImpl=function(e,n,t){var a=this.cellCloned(e);if(n[mxObjectIdentity.get(e)]=a,t){t=this.getChildCount(e);for(var i=0;i<t;i++){var s=this.cloneCellImpl(this.getChildAt(e,i),n,!0);a.insert(s)}}return a},mxGraphModel.prototype.cellCloned=function(e){return e.clone()},mxGraphModel.prototype.restoreClone=function(e,n,t){null!=(a=this.getTerminal(n,!0))&&(null!=(a=t[mxObjectIdentity.get(a)])&&a.insertEdge(e,!0)),null!=(a=this.getTerminal(n,!1))&&(null!=(a=t[mxObjectIdentity.get(a)])&&a.insertEdge(e,!1));for(var a=this.getChildCount(e),i=0;i<a;i++)this.restoreClone(this.getChildAt(e,i),this.getChildAt(n,i),t)},mxRootChange.prototype.execute=function(){this.root=this.previous,this.previous=this.model.rootChanged(this.previous)},mxChildChange.prototype.execute=function(){var e=this.model.getParent(this.child),n=null!=e?e.getIndex(this.child):0;null==this.previous&&this.connect(this.child,!1),e=this.model.parentForCellChanged(this.child,this.previous,this.previousIndex),null!=this.previous&&this.connect(this.child,!0),this.parent=this.previous,this.previous=e,this.index=this.previousIndex,this.previousIndex=n},mxChildChange.prototype.connect=function(e,n){n=null==n||n;var t=e.getTerminal(!0),a=e.getTerminal(!1);for(null!=t&&(n?this.model.terminalForCellChanged(e,t,!0):this.model.terminalForCellChanged(e,null,!0)),null!=a&&(n?this.model.terminalForCellChanged(e,a,!1):this.model.terminalForCellChanged(e,null,!1)),e.setTerminal(t,!0),e.setTerminal(a,!1),t=this.model.getChildCount(e),a=0;a<t;a++)this.connect(this.model.getChildAt(e,a),n)},mxTerminalChange.prototype.execute=function(){this.terminal=this.previous,this.previous=this.model.terminalForCellChanged(this.cell,this.previous,this.source)},mxValueChange.prototype.execute=function(){this.value=this.previous,this.previous=this.model.valueForCellChanged(this.cell,this.previous)},mxStyleChange.prototype.execute=function(){this.style=this.previous,this.previous=this.model.styleForCellChanged(this.cell,this.previous)},mxGeometryChange.prototype.execute=function(){this.geometry=this.previous,this.previous=this.model.geometryForCellChanged(this.cell,this.previous)},mxCollapseChange.prototype.execute=function(){this.collapsed=this.previous,this.previous=this.model.collapsedStateForCellChanged(this.cell,this.previous)},mxVisibleChange.prototype.execute=function(){this.visible=this.previous,this.previous=this.model.visibleStateForCellChanged(this.cell,this.previous)},mxCellAttributeChange.prototype.execute=function(){var e=this.cell.getAttribute(this.attribute);null==this.previous?this.cell.value.removeAttribute(this.attribute):this.cell.setAttribute(this.attribute,this.previous),this.previous=e},mxCell.prototype.id=null,mxCell.prototype.value=null,mxCell.prototype.geometry=null,mxCell.prototype.style=null,mxCell.prototype.vertex=!1,mxCell.prototype.edge=!1,mxCell.prototype.connectable=!0,mxCell.prototype.visible=!0,mxCell.prototype.collapsed=!1,mxCell.prototype.parent=null,mxCell.prototype.source=null,mxCell.prototype.target=null,mxCell.prototype.children=null,mxCell.prototype.edges=null,mxCell.prototype.mxTransient="id value parent source target children edges".split(" "),mxCell.prototype.getId=function(){return this.id},mxCell.prototype.setId=function(e){this.id=e},mxCell.prototype.getValue=function(){return this.value},mxCell.prototype.setValue=function(e){this.value=e},mxCell.prototype.valueChanged=function(e){var n=this.getValue();return this.setValue(e),n},mxCell.prototype.getGeometry=function(){return this.geometry},mxCell.prototype.setGeometry=function(e){this.geometry=e},mxCell.prototype.getStyle=function(){return this.style},mxCell.prototype.setStyle=function(e){this.style=e},mxCell.prototype.isVertex=function(){return this.vertex},mxCell.prototype.setVertex=function(e){this.vertex=e},mxCell.prototype.isEdge=function(){return this.edge},mxCell.prototype.setEdge=function(e){this.edge=e},mxCell.prototype.isConnectable=function(){return this.connectable},mxCell.prototype.setConnectable=function(e){this.connectable=e},mxCell.prototype.isVisible=function(){return this.visible},mxCell.prototype.setVisible=function(e){this.visible=e},mxCell.prototype.isCollapsed=function(){return this.collapsed},mxCell.prototype.setCollapsed=function(e){this.collapsed=e},mxCell.prototype.getParent=function(){return this.parent},mxCell.prototype.setParent=function(e){this.parent=e},mxCell.prototype.getTerminal=function(e){return e?this.source:this.target},mxCell.prototype.setTerminal=function(e,n){return n?this.source=e:this.target=e,e},mxCell.prototype.getChildCount=function(){return null==this.children?0:this.children.length},mxCell.prototype.getIndex=function(e){return mxUtils.indexOf(this.children,e)},mxCell.prototype.getChildAt=function(e){return null==this.children?null:this.children[e]},mxCell.prototype.insert=function(e,n){return null!=e&&(null==n&&(n=this.getChildCount(),e.getParent()==this&&n--),e.removeFromParent(),e.setParent(this),null==this.children?(this.children=[],this.children.push(e)):this.children.splice(n,0,e)),e},mxCell.prototype.remove=function(e){var n=null;return null!=this.children&&0<=e&&(null!=(n=this.getChildAt(e))&&(this.children.splice(e,1),n.setParent(null))),n},mxCell.prototype.removeFromParent=function(){if(null!=this.parent){var e=this.parent.getIndex(this);this.parent.remove(e)}},mxCell.prototype.getEdgeCount=function(){return null==this.edges?0:this.edges.length},mxCell.prototype.getEdgeIndex=function(e){return mxUtils.indexOf(this.edges,e)},mxCell.prototype.getEdgeAt=function(e){return null==this.edges?null:this.edges[e]},mxCell.prototype.insertEdge=function(e,n){return null!=e&&(e.removeFromTerminal(n),e.setTerminal(this,n),null==this.edges||e.getTerminal(!n)!=this||mxUtils.indexOf(this.edges,e)<0)&&(null==this.edges&&(this.edges=[]),this.edges.push(e)),e},mxCell.prototype.removeEdge=function(e,n){if(null!=e){if(e.getTerminal(!n)!=this&&null!=this.edges){var t=this.getEdgeIndex(e);0<=t&&this.edges.splice(t,1)}e.setTerminal(null,n)}return e},mxCell.prototype.removeFromTerminal=function(e){var n=this.getTerminal(e);null!=n&&n.removeEdge(this,e)},mxCell.prototype.getAttribute=function(e,n){var t=this.getValue();return(null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT?t.getAttribute(e):null)||n},mxCell.prototype.setAttribute=function(e,n){var t=this.getValue();null!=t&&t.nodeType==mxConstants.NODETYPE_ELEMENT&&t.setAttribute(e,n)},mxCell.prototype.clone=function(){var e=mxUtils.clone(this,this.mxTransient);return e.setValue(this.cloneValue()),e},mxCell.prototype.cloneValue=function(){var e=this.getValue();return null!=e&&("function"==typeof e.clone?e=e.clone():isNaN(e.nodeType)||(e=e.cloneNode(!0))),e},mxGeometry.prototype=new mxRectangle,mxGeometry.prototype.constructor=mxGeometry,mxGeometry.prototype.TRANSLATE_CONTROL_POINTS=!0,mxGeometry.prototype.alternateBounds=null,mxGeometry.prototype.sourcePoint=null,mxGeometry.prototype.targetPoint=null,mxGeometry.prototype.points=null,mxGeometry.prototype.offset=null,mxGeometry.prototype.relative=!1,mxGeometry.prototype.swap=function(){if(null!=this.alternateBounds){var e=new mxRectangle(this.x,this.y,this.width,this.height);this.x=this.alternateBounds.x,this.y=this.alternateBounds.y,this.width=this.alternateBounds.width,this.height=this.alternateBounds.height,this.alternateBounds=e}},mxGeometry.prototype.getTerminalPoint=function(e){return e?this.sourcePoint:this.targetPoint},mxGeometry.prototype.setTerminalPoint=function(e,n){return n?this.sourcePoint=e:this.targetPoint=e,e},mxGeometry.prototype.translate=function(e,n){if(this.clone(),this.relative||(this.x+=e,this.y+=n),null!=this.sourcePoint&&(this.sourcePoint.x+=e,this.sourcePoint.y+=n),null!=this.targetPoint&&(this.targetPoint.x+=e,this.targetPoint.y+=n),this.TRANSLATE_CONTROL_POINTS&&null!=this.points)for(var t=this.points.length,a=0;a<t;a++){var i=this.points[a];null!=i&&(i.x+=e,i.y+=n)}};var mxCellPath={PATH_SEPARATOR:".",create:function(e){var n="";if(null!=e)for(var t=e.getParent();null!=t;)n=t.getIndex(e)+mxCellPath.PATH_SEPARATOR+n,t=(e=t).getParent();return 1<(e=n.length)&&(n=n.substring(0,e-1)),n},getParentPath:function(e){if(null!=e){var n=e.lastIndexOf(mxCellPath.PATH_SEPARATOR);if(0<=n)return e.substring(0,n);if(0<e.length)return""}return null},resolve:function(e,n){var t=e;if(null!=n)for(var a=n.split(mxCellPath.PATH_SEPARATOR),i=0;i<a.length;i++)t=t.getChildAt(parseInt(a[i]));return t},compare:function(e,n){for(var t=Math.min(e.length,n.length),a=0,i=0;i<t;i++)if(e[i]!=n[i]){a=0==e[i].length||0==n[i].length?e[i]==n[i]?0:e[i]>n[i]?1:-1:(t=parseInt(e[i]))==(i=parseInt(n[i]))?0:i<t?1:-1;break}return 0==a&&((t=e.length)!=(i=n.length)&&(a=i<t?1:-1)),a}},mxPerimeter={RectanglePerimeter:function(e,n,t,a){n=e.getCenterX();var i=e.getCenterY(),s=Math.atan2(t.y-i,t.x-n),o=new mxPoint(0,0),r=Math.PI,l=Math.PI/2-s,d=Math.atan2(e.height,e.width);return s<-r+d||r-d<s?(o.x=e.x,o.y=i-e.width*Math.tan(s)/2):s<-d?(o.y=e.y,o.x=n-e.height*Math.tan(l)/2):s<d?(o.x=e.x+e.width,o.y=i+e.width*Math.tan(s)/2):(o.y=e.y+e.height,o.x=n+e.height*Math.tan(l)/2),a&&(t.x>=e.x&&t.x<=e.x+e.width?o.x=t.x:t.y>=e.y&&t.y<=e.y+e.height&&(o.y=t.y),t.x<e.x?o.x=e.x:t.x>e.x+e.width&&(o.x=e.x+e.width),t.y<e.y?o.y=e.y:t.y>e.y+e.height&&(o.y=e.y+e.height)),o},EllipsePerimeter:function(e,n,t,a){var i=e.x,s=e.y,o=e.width/2,r=e.height/2,l=i+o,d=s+r;n=t.x,t=t.y;var c=parseInt(n-l),m=parseInt(t-d);if(0==c&&0!=m)return new mxPoint(l,d+r*m/Math.abs(m));if(0==c&&0==m)return new mxPoint(n,t);if(a){if(s<=t&&t<=s+e.height)return e=t-d,e=Math.sqrt(o*o*(1-e*e/(r*r)))||0,n<=i&&(e=-e),new mxPoint(l+e,t);if(i<=n&&n<=i+e.width)return e=n-l,e=Math.sqrt(r*r*(1-e*e/(o*o)))||0,t<=s&&(e=-e),new mxPoint(n,d+e)}return d-=(i=m/c)*l,l=i*(o=(-(e=-2*l*(s=o*o*i*i+r*r))+(r=Math.sqrt(e*e-4*s*(o*o*i*i*l*l+r*r*l*l-o*o*r*r))))/(2*s))+d,d=i*(r=(-e-r)/(2*s))+d,i=Math.sqrt(Math.pow(o-n,2)+Math.pow(l-t,2)),n=Math.sqrt(Math.pow(r-n,2)+Math.pow(d-t,2)),s=t=0,s=i<n?(t=o,l):(t=r,d),new mxPoint(t,s)},RhombusPerimeter:function(e,n,t,a){n=e.x;var i=e.y,s=e.width,o=n+s/2,r=i+(e=e.height)/2,l=t.x;if(t=t.y,o==l)return new mxPoint(o,t<r?i:i+e);if(r==t)return new mxPoint(l<o?n:n+s,r);var d=o,c=r;return a&&(n<=l&&l<=n+s?d=l:i<=t&&t<=i+e&&(c=t)),l<o?t<r?mxUtils.intersection(l,t,d,c,o,i,n,r):mxUtils.intersection(l,t,d,c,o,i+e,n,r):t<r?mxUtils.intersection(l,t,d,c,o,i,n+s,r):mxUtils.intersection(l,t,d,c,o,i+e,n+s,r)},TrianglePerimeter:function(e,n,t,a){var i=(n=null!=n?n.style[mxConstants.STYLE_DIRECTION]:null)==mxConstants.DIRECTION_NORTH||n==mxConstants.DIRECTION_SOUTH,s=e.x,o=e.y,r=e.width,l=s+r/2,d=o+(e=e.height)/2,c=new mxPoint(s,o),m=new mxPoint(s+r,d),u=new mxPoint(s,o+e);n==mxConstants.DIRECTION_NORTH?(c=u,m=new mxPoint(l,o),u=new mxPoint(s+r,o+e)):n==mxConstants.DIRECTION_SOUTH?(m=new mxPoint(l,o+e),u=new mxPoint(s+r,o)):n==mxConstants.DIRECTION_WEST&&(c=new mxPoint(s+r,o),m=new mxPoint(s,d),u=new mxPoint(s+r,o+e));var p=t.x-l,g=t.y-d,v=(p=i?Math.atan2(p,g):Math.atan2(g,p),i?Math.atan2(r,e):Math.atan2(e,r));g=!1,g=n==mxConstants.DIRECTION_NORTH||n==mxConstants.DIRECTION_WEST?-v<p&&p<v:p<-Math.PI+v||p>Math.PI-v,v=null;return null==(v=g?a&&(i&&t.x>=c.x&&t.x<=u.x||!i&&t.y>=c.y&&t.y<=u.y)?i?new mxPoint(t.x,c.y):new mxPoint(c.x,t.y):n==mxConstants.DIRECTION_NORTH?new mxPoint(s+r/2+e*Math.tan(p)/2,o+e):n==mxConstants.DIRECTION_SOUTH?new mxPoint(s+r/2-e*Math.tan(p)/2,o):n==mxConstants.DIRECTION_WEST?new mxPoint(s+r,o+e/2+r*Math.tan(p)/2):new mxPoint(s,o+e/2-r*Math.tan(p)/2):(a&&(a=new mxPoint(l,d),t.y>=o&&t.y<=o+e?(a.x=i?l:n==mxConstants.DIRECTION_WEST?s+r:s,a.y=t.y):t.x>=s&&t.x<=s+r&&(a.x=t.x,a.y=i?n==mxConstants.DIRECTION_NORTH?o+e:o:d),l=a.x,d=a.y),i&&t.x<=s+r/2||!i&&t.y<=o+e/2?mxUtils.intersection(t.x,t.y,l,d,c.x,c.y,m.x,m.y):mxUtils.intersection(t.x,t.y,l,d,m.x,m.y,u.x,u.y)))&&(v=new mxPoint(l,d)),v}};function mxPrintPreview(e,n,t,a,i,s,o,r,l){this.graph=e,this.scale=null!=n?n:1/e.pageScale,this.border=null!=a?a:0,this.pageFormat=null!=t?t:e.pageFormat,this.title=null!=r?r:"Printer-friendly version",this.x0=null!=i?i:0,this.y0=null!=s?s:0,this.borderColor=o,this.pageSelector=null==l||l}function mxStylesheet(){this.styles={},this.putDefaultVertexStyle(this.createDefaultVertexStyle()),this.putDefaultEdgeStyle(this.createDefaultEdgeStyle())}function mxCellState(e,n,t){this.view=e,this.cell=n,this.style=t,this.origin=new mxPoint,this.absoluteOffset=new mxPoint}function mxGraphSelectionModel(e){this.graph=e,this.cells=[]}function mxSelectionChange(e,n,t){this.selectionModel=e,this.added=null!=n?n.slice():null,this.removed=null!=t?t.slice():null}function mxCellEditor(e){this.graph=e}function mxCellRenderer(){}mxPrintPreview.prototype.graph=null,mxPrintPreview.prototype.pageFormat=null,mxPrintPreview.prototype.scale=null,mxPrintPreview.prototype.border=0,mxPrintPreview.prototype.x0=0,mxPrintPreview.prototype.y0=0,mxPrintPreview.prototype.autoOrigin=!0,mxPrintPreview.prototype.printOverlays=!1,mxPrintPreview.prototype.borderColor=null,mxPrintPreview.prototype.title=null,mxPrintPreview.prototype.pageSelector=null,mxPrintPreview.prototype.wnd=null,mxPrintPreview.prototype.pageCount=0,mxPrintPreview.prototype.getWindow=function(){return this.wnd},mxPrintPreview.prototype.getDoctype=function(){var e="";return 8==document.documentMode&&(e='<meta http-equiv="X-UA-Compatible" content="IE=8">'),e},mxPrintPreview.prototype.open=function(e){var n=this.graph.cellRenderer.initializeOverlay,t=null;try{if(this.printOverlays&&(this.graph.cellRenderer.initializeOverlay=function(e,n){n.init(e.view.getDrawPane())}),null==this.wnd){this.wnd=window.open();var a=this.wnd.document,i=this.getDoctype();null!=i&&0<i.length&&a.writeln(i),a.writeln("<html>"),a.writeln("<head>"),this.writeHead(a,e),a.writeln("</head>"),a.writeln('<body class="mxPage">'),mxClient.link("stylesheet",mxClient.basePath+"/css/common.css",a),mxClient.IS_VML&&(a.namespaces.add("v","urn:schemas-microsoft-com:vml"),a.namespaces.add("o","urn:schemas-microsoft-com:office:office"),a.createStyleSheet().cssText="v\\:*{behavior:url(#default#VML)}o\\:*{behavior:url(#default#VML)}",mxClient.link("stylesheet",mxClient.basePath+"/css/explorer.css",a));var s=this.graph.getGraphBounds().clone(),o=this.graph.getView().getScale(),r=o/this.scale,l=this.graph.getView().getTranslate();this.autoOrigin||(this.x0=-l.x*this.scale,this.y0=-l.y*this.scale,s.width+=s.x,s.height+=s.y,s.x=0,this.border=s.y=0),s.width/=r,s.height/=r;var d=this.pageFormat.width-2*this.border,c=this.pageFormat.height-2*this.border,m=Math.max(1,Math.ceil((s.width+this.x0)/d)),u=Math.max(1,Math.ceil((s.height+this.y0)/c));this.pageCount=m*u;var p=mxUtils.bind(this,function(){if(this.pageSelector&&(1<u||1<m)){var e=this.createPageSelector(u,m);if(a.body.appendChild(e),mxClient.IS_IE){e.style.position="absolute";var n=function(){e.style.top=a.body.scrollTop+10+"px"};mxEvent.addListener(this.wnd,"scroll",function(e){n()}),mxEvent.addListener(this.wnd,"resize",function(e){n()})}}});if(e=function(e,n){if(null!=this.borderColor&&(e.style.borderColor=this.borderColor,e.style.borderStyle="solid",e.style.borderWidth="1px"),e.style.background="white",n&&(e.style.pageBreakAfter="always"),mxClient.IS_IE?(a.writeln(e.outerHTML),e.parentNode.removeChild(e)):(e.parentNode.removeChild(e),a.body.appendChild(e)),n){var t=a.createElement("hr");t.className="mxPageBreak",a.body.appendChild(t)}},null!=(f=this.getCoverPages(this.pageFormat.width,this.pageFormat.height)))for(var g=0;g<f.length;g++)e(f[g],!0);var v=this.getAppendices(this.pageFormat.width,this.pageFormat.height);for(g=0;g<u;g++)for(var h=g*c/this.scale-this.y0/this.scale+(s.y-l.y*o)/o,f=0;f<m;f++){if(null==this.wnd)return null;var b=f*d/this.scale-this.x0/this.scale+(s.x-l.x*o)/o,A=g*m+f+1;(t=this.renderPage(this.pageFormat.width,this.pageFormat.height,mxUtils.bind(this,function(e){this.addGraphFragment(-b,-h,this.scale,A,e)}))).setAttribute("id","mxPage-"+A),e(t,null!=v||g<u-1||f<m-1)}if(null!=v)for(g=0;g<v.length;g++)e(v[g],g<v.length);a.writeln("</body>"),a.writeln("</html>"),a.close(),p(),mxEvent.release(a.body)}this.wnd.focus()}catch(e){null!=t&&null!=t.parentNode&&t.parentNode.removeChild(t)}finally{this.graph.cellRenderer.initializeOverlay=n}return this.wnd},mxPrintPreview.prototype.writeHead=function(e,n){null!=this.title&&e.writeln("<title>"+this.title+"</title>"),e.writeln('<style type="text/css">'),e.writeln("@media print {"),e.writeln("  table.mxPageSelector { display: none; }"),e.writeln("  hr.mxPageBreak { display: none; }"),e.writeln("}"),e.writeln("@media screen {"),e.writeln("  table.mxPageSelector { position: fixed; right: 10px; top: 10px;font-family: Arial; font-size:10pt; border: solid 1px darkgray;background: white; border-collapse:collapse; }"),e.writeln("  table.mxPageSelector td { border: solid 1px gray; padding:4px; }"),e.writeln("  body.mxPage { background: gray; }"),e.writeln("}"),null!=n&&e.writeln(n),e.writeln("</style>")},mxPrintPreview.prototype.createPageSelector=function(e,n){var t=this.wnd.document,a=t.createElement("table");a.className="mxPageSelector",a.setAttribute("border","0");for(var i=t.createElement("tbody"),s=0;s<e;s++){for(var o=t.createElement("tr"),r=0;r<n;r++){var l=s*n+r+1,d=t.createElement("td");if(!mxClient.IS_NS||mxClient.IS_SF||mxClient.IS_GC){var c=t.createElement("a");c.setAttribute("href","#mxPage-"+l),mxUtils.write(c,l,t),d.appendChild(c)}else mxUtils.write(d,l,t);o.appendChild(d)}i.appendChild(o)}return a.appendChild(i),a},mxPrintPreview.prototype.renderPage=function(e,n,t){var a=document.createElement("div");try{a.style.width=e+"px",a.style.height=n+"px",a.style.overflow="hidden",a.style.pageBreakInside="avoid",a.style.position="relative";var i=document.createElement("div");i.style.top=this.border+"px",i.style.left=this.border+"px",i.style.width=e-2*this.border+"px",i.style.height=n-2*this.border+"px",i.style.overflow="hidden",this.graph.dialect==mxConstants.DIALECT_VML&&(i.style.position="absolute"),a.appendChild(i),document.body.appendChild(a),t(i)}catch(e){throw a.parentNode.removeChild(a),e}return a},mxPrintPreview.prototype.addGraphFragment=function(e,n,t,a,i){a=this.graph.getView();var s=this.graph.container;this.graph.container=i;var o=a.getCanvas(),r=a.getBackgroundPane(),l=a.getDrawPane(),d=a.getOverlayPane();this.graph.dialect==mxConstants.DIALECT_SVG?a.createSvg():this.graph.dialect==mxConstants.DIALECT_VML?a.createVml():a.createHtml();var c=a.isEventsEnabled();a.setEventsEnabled(!1);var m=this.graph.isEnabled();this.graph.setEnabled(!1);var u=a.getTranslate();a.translate=new mxPoint(e,n),e=null;try{var p=[this.graph.getModel().getRoot()];e=new mxTemporaryCellStates(a,t,p)}finally{if(mxClient.IS_IE)a.overlayPane.innerHTML="";else for(t=i.firstChild;null!=t;)p=t.nextSibling,"svg"==(n=t.nodeName.toLowerCase())?(t.setAttribute("width",parseInt(i.style.width)),t.setAttribute("height",parseInt(i.style.height))):"default"!=t.style.cursor&&"table"!=n&&t.parentNode.removeChild(t),t=p;a.overlayPane.parentNode.removeChild(a.overlayPane),this.graph.setEnabled(m),this.graph.container=s,a.canvas=o,a.backgroundPane=r,a.drawPane=l,a.overlayPane=d,a.translate=u,e.destroy(),a.setEventsEnabled(c)}},mxPrintPreview.prototype.getCoverPages=function(){return null},mxPrintPreview.prototype.getAppendices=function(){return null},mxPrintPreview.prototype.print=function(){var e=this.open();null!=e&&e.print()},mxPrintPreview.prototype.close=function(){null!=this.wnd&&(this.wnd.close(),this.wnd=null)},mxStylesheet.prototype.createDefaultVertexStyle=function(){var e={};return e[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_RECTANGLE,e[mxConstants.STYLE_PERIMETER]=mxPerimeter.RectanglePerimeter,e[mxConstants.STYLE_VERTICAL_ALIGN]=mxConstants.ALIGN_MIDDLE,e[mxConstants.STYLE_ALIGN]=mxConstants.ALIGN_CENTER,e[mxConstants.STYLE_FILLCOLOR]="#C3D9FF",e[mxConstants.STYLE_STROKECOLOR]="#6482B9",e[mxConstants.STYLE_FONTCOLOR]="#774400",e},mxStylesheet.prototype.createDefaultEdgeStyle=function(){var e={};return e[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_CONNECTOR,e[mxConstants.STYLE_ENDARROW]=mxConstants.ARROW_CLASSIC,e[mxConstants.STYLE_VERTICAL_ALIGN]=mxConstants.ALIGN_MIDDLE,e[mxConstants.STYLE_ALIGN]=mxConstants.ALIGN_CENTER,e[mxConstants.STYLE_STROKECOLOR]="#6482B9",e[mxConstants.STYLE_FONTCOLOR]="#446299",e},mxStylesheet.prototype.putDefaultVertexStyle=function(e){this.putCellStyle("defaultVertex",e)},mxStylesheet.prototype.putDefaultEdgeStyle=function(e){this.putCellStyle("defaultEdge",e)},mxStylesheet.prototype.getDefaultVertexStyle=function(){return this.styles.defaultVertex},mxStylesheet.prototype.getDefaultEdgeStyle=function(){return this.styles.defaultEdge},mxStylesheet.prototype.putCellStyle=function(e,n){this.styles[e]=n},mxStylesheet.prototype.getCellStyle=function(e,n){var t=n;if(null!=e&&0<e.length)for(var a=e.split(";"),i=(t=null!=t&&";"!=e.charAt(0)?mxUtils.clone(t):{},0);i<a.length;i++){var s=(o=a[i]).indexOf("=");if(0<=s){var o,r=o.substring(0,s);(o=o.substring(s+1))==mxConstants.NONE?delete t[r]:mxUtils.isNumeric(o)?t[r]=parseFloat(o):t[r]=o}else if(null!=(o=this.styles[o]))for(r in o)t[r]=o[r]}return t},mxCellState.prototype=new mxRectangle,mxCellState.prototype.constructor=mxCellState,mxCellState.prototype.view=null,mxCellState.prototype.cell=null,mxCellState.prototype.style=null,mxCellState.prototype.invalid=!0,mxCellState.prototype.invalidOrder=!1,mxCellState.prototype.orderChanged=!1,mxCellState.prototype.origin=null,mxCellState.prototype.absolutePoints=null,mxCellState.prototype.absoluteOffset=null,mxCellState.prototype.visibleSourceState=null,mxCellState.prototype.visibleTargetState=null,mxCellState.prototype.terminalDistance=0,mxCellState.prototype.length=0,mxCellState.prototype.segments=null,mxCellState.prototype.shape=null,mxCellState.prototype.text=null,mxCellState.prototype.getPerimeterBounds=function(e,n){if(e=e||0,n=null!=n?n:new mxRectangle(this.x,this.y,this.width,this.height),null!=this.shape&&null!=this.shape.stencil){var t=this.shape.stencil.computeAspect(this.style,n.x,n.y,n.width,n.height);n.x=t.x,n.y=t.y,n.width=this.shape.stencil.w0*t.width,n.height=this.shape.stencil.h0*t.height}return 0!=e&&n.grow(e),n},mxCellState.prototype.setAbsoluteTerminalPoint=function(e,n){n?(null==this.absolutePoints&&(this.absolutePoints=[]),0==this.absolutePoints.length?this.absolutePoints.push(e):this.absolutePoints[0]=e):null==this.absolutePoints?(this.absolutePoints=[],this.absolutePoints.push(null),this.absolutePoints.push(e)):1==this.absolutePoints.length?this.absolutePoints.push(e):this.absolutePoints[this.absolutePoints.length-1]=e},mxCellState.prototype.setCursor=function(e){null!=this.shape&&this.shape.setCursor(e),null!=this.text&&this.text.setCursor(e)},mxCellState.prototype.getVisibleTerminal=function(e){return null!=(e=this.getVisibleTerminalState(e))?e.cell:null},mxCellState.prototype.getVisibleTerminalState=function(e){return e?this.visibleSourceState:this.visibleTargetState},mxCellState.prototype.setVisibleTerminalState=function(e,n){n?this.visibleSourceState=e:this.visibleTargetState=e},mxCellState.prototype.destroy=function(){this.view.graph.cellRenderer.destroy(this)},mxCellState.prototype.clone=function(){var e=new mxCellState(this.view,this.cell,this.style);if(null!=this.absolutePoints){e.absolutePoints=[];for(var n=0;n<this.absolutePoints.length;n++)e.absolutePoints[n]=this.absolutePoints[n].clone()}return null!=this.origin&&(e.origin=this.origin.clone()),null!=this.absoluteOffset&&(e.absoluteOffset=this.absoluteOffset.clone()),null!=this.boundingBox&&(e.boundingBox=this.boundingBox.clone()),e.terminalDistance=this.terminalDistance,e.segments=this.segments,e.length=this.length,e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e},mxGraphSelectionModel.prototype=new mxEventSource,mxGraphSelectionModel.prototype.constructor=mxGraphSelectionModel,mxGraphSelectionModel.prototype.doneResource="none"!=mxClient.language?"done":"",mxGraphSelectionModel.prototype.updatingSelectionResource="none"!=mxClient.language?"updatingSelection":"",mxGraphSelectionModel.prototype.graph=null,mxGraphSelectionModel.prototype.singleSelection=!1,mxGraphSelectionModel.prototype.isSingleSelection=function(){return this.singleSelection},mxGraphSelectionModel.prototype.setSingleSelection=function(e){this.singleSelection=e},mxGraphSelectionModel.prototype.isSelected=function(e){return null!=e&&0<=mxUtils.indexOf(this.cells,e)},mxGraphSelectionModel.prototype.isEmpty=function(){return 0==this.cells.length},mxGraphSelectionModel.prototype.clear=function(){this.changeSelection(null,this.cells)},mxGraphSelectionModel.prototype.setCell=function(e){null!=e&&this.setCells([e])},mxGraphSelectionModel.prototype.setCells=function(e){if(null!=e){this.singleSelection&&(e=[this.getFirstSelectableCell(e)]);for(var n=[],t=0;t<e.length;t++)this.graph.isCellSelectable(e[t])&&n.push(e[t]);this.changeSelection(n,this.cells)}},mxGraphSelectionModel.prototype.getFirstSelectableCell=function(e){if(null!=e)for(var n=0;n<e.length;n++)if(this.graph.isCellSelectable(e[n]))return e[n];return null},mxGraphSelectionModel.prototype.addCell=function(e){null!=e&&this.addCells([e])},mxGraphSelectionModel.prototype.addCells=function(e){if(null!=e){var n=null;this.singleSelection&&(n=this.cells,e=[this.getFirstSelectableCell(e)]);for(var t=[],a=0;a<e.length;a++)!this.isSelected(e[a])&&this.graph.isCellSelectable(e[a])&&t.push(e[a]);this.changeSelection(t,n)}},mxGraphSelectionModel.prototype.removeCell=function(e){null!=e&&this.removeCells([e])},mxGraphSelectionModel.prototype.removeCells=function(e){if(null!=e){for(var n=[],t=0;t<e.length;t++)this.isSelected(e[t])&&n.push(e[t]);this.changeSelection(null,n)}},mxGraphSelectionModel.prototype.changeSelection=function(e,n){if(null!=e&&0<e.length&&null!=e[0]||null!=n&&0<n.length&&null!=n[0]){var t=new mxSelectionChange(this,e,n);t.execute();var a=new mxUndoableEdit(this,!1);a.add(t),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",a))}},mxGraphSelectionModel.prototype.cellAdded=function(e){null!=e&&!this.isSelected(e)&&this.cells.push(e)},mxGraphSelectionModel.prototype.cellRemoved=function(e){null!=e&&(0<=(e=mxUtils.indexOf(this.cells,e))&&this.cells.splice(e,1))},mxSelectionChange.prototype.execute=function(){var e=mxLog.enter("mxSelectionChange.execute");if(window.status=mxResources.get(this.selectionModel.updatingSelectionResource)||this.selectionModel.updatingSelectionResource,null!=this.removed)for(var n=0;n<this.removed.length;n++)this.selectionModel.cellRemoved(this.removed[n]);if(null!=this.added)for(n=0;n<this.added.length;n++)this.selectionModel.cellAdded(this.added[n]);n=this.added,this.added=this.removed,this.removed=n,window.status=mxResources.get(this.selectionModel.doneResource)||this.selectionModel.doneResource,mxLog.leave("mxSelectionChange.execute",e),this.selectionModel.fireEvent(new mxEventObject(mxEvent.CHANGE,"added",this.added,"removed",this.removed))},mxCellEditor.prototype.graph=null,mxCellEditor.prototype.textarea=null,mxCellEditor.prototype.editingCell=null,mxCellEditor.prototype.trigger=null,mxCellEditor.prototype.modified=!1,mxCellEditor.prototype.autoSize=!0,mxCellEditor.prototype.emptyLabelText="",mxCellEditor.prototype.textNode="",mxCellEditor.prototype.init=function(){this.textarea=document.createElement("textarea"),this.textarea.className="mxCellEditor",this.textarea.style.position="absolute",this.textarea.style.overflow="visible",this.textarea.setAttribute("cols","20"),this.textarea.setAttribute("rows","4"),mxClient.IS_NS&&(this.textarea.style.resize="none"),mxEvent.addListener(this.textarea,"blur",mxUtils.bind(this,function(e){this.focusLost()})),mxEvent.addListener(this.textarea,"keydown",mxUtils.bind(this,function(e){mxEvent.isConsumed(e)||(113==e.keyCode||this.graph.isEnterStopsCellEditing()&&13==e.keyCode&&!mxEvent.isControlDown(e)&&!mxEvent.isShiftDown(e)?(this.graph.stopEditing(!1),mxEvent.consume(e)):27==e.keyCode?(this.graph.stopEditing(!0),mxEvent.consume(e)):(this.clearOnChange&&(this.clearOnChange=!1,this.textarea.value=""),this.setModified(!0)))})),mxEvent.addListener(this.textarea,"keypress",mxUtils.bind(this,function(e){this.autoSize&&!mxEvent.isConsumed(e)&&setTimeout(mxUtils.bind(this,function(){this.resize()}),0)}))},mxCellEditor.prototype.resize=function(){if(null!=this.textDiv){var e=this.graph.getView().getState(this.editingCell),n=this.graph.isLabelClipped(e.cell),t=this.graph.isWrapping(e.cell);if(this.graph.getModel().isEdge(e.cell))this.bounds.x=e.absoluteOffset.x,this.bounds.y=e.absoluteOffset.y,this.bounds.width=0,this.bounds.height=0;else if(null!=this.bounds){this.bounds.x=e.x,this.bounds.y=e.y,this.bounds.width=e.width,this.bounds.height=e.height,(a=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?this.bounds.x-=e.width:a==mxConstants.ALIGN_RIGHT&&(this.bounds.x+=e.width),(a=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?this.bounds.y-=e.height:a==mxConstants.ALIGN_BOTTOM&&(this.bounds.y+=e.height)}"\n"!=(a=this.textarea.value).charAt(a.length-1)&&""!=a||(a+="&nbsp;"),a=mxUtils.htmlEntities(a,!1),t?(this.textDiv.style.whiteSpace="normal",this.textDiv.style.width=this.bounds.width+"px"):a=a.replace(/ /g,"&nbsp;"),a=a.replace(/\n/g,"<br/>"),this.textDiv.innerHTML=a;var a=this.textDiv.offsetWidth+30,i=this.textDiv.offsetHeight+16;a=Math.max(a,40),i=Math.max(i,20);n&&(a=Math.min(this.bounds.width-4,a),i=Math.min(this.bounds.height,i));var s=null!=e.text?e.text.margin:null;null==s&&(s=mxUtils.getValue(e.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER),e=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE),s=mxUtils.getAlignmentAsPoint(s,e)),null!=s&&(!n&&t||(this.textarea.style.left=Math.max(0,Math.round(this.bounds.x-s.x*this.bounds.width+s.x*a)-3)+"px"),this.textarea.style.top=Math.max(0,Math.round(this.bounds.y-s.y*this.bounds.height+s.y*i)+4)+"px"),!n&&t||(this.textarea.style.width=a+"px"),this.textarea.style.height=i+"px"}},mxCellEditor.prototype.isModified=function(){return this.modified},mxCellEditor.prototype.setModified=function(e){this.modified=e},mxCellEditor.prototype.focusLost=function(){this.stopEditing(!this.graph.isInvokesStopCellEditing())},mxCellEditor.prototype.startEditing=function(e,n){null==this.textarea&&this.init(),this.stopEditing(!0);var t=this.graph.getView().getState(e);if(null!=t){this.editingCell=e,this.trigger=n,(this.textNode=null)!=t.text&&this.isHideLabel(t)&&(this.textNode=t.text.node,this.textNode.style.visibility="hidden");var a=this.graph.getView().scale,i=(a=mxUtils.getValue(t.style,mxConstants.STYLE_FONTSIZE,mxConstants.DEFAULT_FONTSIZE)*a,mxUtils.getValue(t.style,mxConstants.STYLE_FONTFAMILY,mxConstants.DEFAULT_FONTFAMILY)),s=mxUtils.getValue(t.style,mxConstants.STYLE_FONTCOLOR,"black"),o=mxUtils.getValue(t.style,mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT),r=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD,l=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC,d=(mxUtils.getValue(t.style,mxConstants.STYLE_FONTSTYLE,0)&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE;this.textarea.style.fontSize=Math.round(a)+"px",this.textarea.style.lineHeight=Math.round(a*mxConstants.LINE_HEIGHT)+"px",this.textarea.style.fontFamily=i,this.textarea.style.textAlign=o,this.textarea.style.color=s,this.textarea.style.fontWeight=r?"bold":"normal",this.textarea.style.fontStyle=l?"italic":"",this.textarea.style.textDecoration=d?"underline":"",this.textarea.style.overflow="auto",this.textarea.style.outline="none",this.bounds=a=this.getEditorBounds(t),this.textarea.style.left=a.x+"px",this.textarea.style.top=a.y+"px",this.textarea.style.width=a.width+"px",this.textarea.style.height=a.height+"px",this.textarea.style.zIndex=5,null==(t=this.getInitialValue(t,n))||0==t.length?(t=this.getEmptyLabelText(),this.clearOnChange=!0):this.clearOnChange=!1,this.setModified(!1),this.textarea.value=t,this.graph.container.appendChild(this.textarea),"none"!=this.textarea.style.display&&(this.autoSize&&(this.textDiv=this.createTextDiv(),document.body.appendChild(this.textDiv),this.resize()),this.textarea.focus(),this.textarea.select())}},mxCellEditor.prototype.createTextDiv=function(){var e=document.createElement("div"),n=e.style;return n.position="absolute",n.whiteSpace="nowrap",n.visibility="hidden",n.display=mxClient.IS_QUIRKS?"inline":"inline-block",n.zoom="1",n.verticalAlign="top",n.lineHeight=this.textarea.style.lineHeight,n.fontSize=this.textarea.style.fontSize,n.fontFamily=this.textarea.style.fontFamily,n.fontWeight=this.textarea.style.fontWeight,n.textAlign=this.textarea.style.textAlign,n.fontStyle=this.textarea.style.fontStyle,n.textDecoration=this.textarea.style.textDecoration,e},mxCellEditor.prototype.stopEditing=function(e){null!=this.editingCell&&(null!=this.textNode&&(this.textNode.style.visibility="visible",this.textNode=null),!e&&this.isModified()&&this.graph.labelChanged(this.editingCell,this.getCurrentValue(),this.trigger),null!=this.textDiv&&(document.body.removeChild(this.textDiv),this.textDiv=null),this.bounds=this.trigger=this.editingCell=null,this.textarea.blur(),this.textarea.parentNode.removeChild(this.textarea))},mxCellEditor.prototype.getInitialValue=function(e,n){return this.graph.getEditingValue(e.cell,n)},mxCellEditor.prototype.getCurrentValue=function(){return this.textarea.value.replace(/\r/g,"")},mxCellEditor.prototype.isHideLabel=function(e){return!0},mxCellEditor.prototype.getMinimumSize=function(e){var n=this.graph.getView().scale;return new mxRectangle(0,0,null==e.text?30:e.text.size*n+20,"left"==this.textarea.style.textAlign?120:40)},mxCellEditor.prototype.getEditorBounds=function(e){var n=this.graph.getModel().isEdge(e.cell),t=this.graph.getView().scale,a=(i=this.getMinimumSize(e)).width,i=i.height,s=parseInt(e.style[mxConstants.STYLE_SPACING]||2)*t,o=parseInt(e.style[mxConstants.STYLE_SPACING_TOP]||0)*t+s,r=parseInt(e.style[mxConstants.STYLE_SPACING_RIGHT]||0)*t+s,l=parseInt(e.style[mxConstants.STYLE_SPACING_BOTTOM]||0)*t+s;t=parseInt(e.style[mxConstants.STYLE_SPACING_LEFT]||0)*t+s,r=new mxRectangle(e.x,e.y,Math.max(a,e.width-t-r),Math.max(i,e.height-o-l));return n?(r.x=e.absoluteOffset.x,r.y=e.absoluteOffset.y,null!=e.text&&null!=e.text.boundingBox&&(0<e.text.boundingBox.x&&(r.x=e.text.boundingBox.x),0<e.text.boundingBox.y&&(r.y=e.text.boundingBox.y))):null!=e.text&&null!=e.text.boundingBox&&(r.x=Math.min(r.x,e.text.boundingBox.x),r.y=Math.min(r.y,e.text.boundingBox.y)),r.x+=t,r.y+=o,null!=e.text&&null!=e.text.boundingBox&&(n?(r.width=Math.max(a,e.text.boundingBox.width),r.height=Math.max(i,e.text.boundingBox.height)):(r.width=Math.max(r.width,e.text.boundingBox.width),r.height=Math.max(r.height,e.text.boundingBox.height))),this.graph.getModel().isVertex(e.cell)&&((n=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER))==mxConstants.ALIGN_LEFT?r.x-=e.width:n==mxConstants.ALIGN_RIGHT&&(r.x+=e.width),(n=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?r.y-=e.height:n==mxConstants.ALIGN_BOTTOM&&(r.y+=e.height)),r},mxCellEditor.prototype.getEmptyLabelText=function(e){return this.emptyLabelText},mxCellEditor.prototype.getEditingCell=function(){return this.editingCell},mxCellEditor.prototype.destroy=function(){null!=this.textarea&&(mxEvent.release(this.textarea),null!=this.textarea.parentNode&&this.textarea.parentNode.removeChild(this.textarea),this.textarea=null)},mxCellRenderer.prototype.defaultEdgeShape=mxConnector,mxCellRenderer.prototype.defaultVertexShape=mxRectangleShape,mxCellRenderer.prototype.defaultTextShape=mxText,mxCellRenderer.prototype.legacyControlPosition=!0,mxCellRenderer.prototype.defaultShapes={},mxCellRenderer.registerShape=function(e,n){mxCellRenderer.prototype.defaultShapes[e]=n},mxCellRenderer.registerShape(mxConstants.SHAPE_RECTANGLE,mxRectangleShape),mxCellRenderer.registerShape(mxConstants.SHAPE_ELLIPSE,mxEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_RHOMBUS,mxRhombus),mxCellRenderer.registerShape(mxConstants.SHAPE_CYLINDER,mxCylinder),mxCellRenderer.registerShape(mxConstants.SHAPE_CONNECTOR,mxConnector),mxCellRenderer.registerShape(mxConstants.SHAPE_ACTOR,mxActor),mxCellRenderer.registerShape(mxConstants.SHAPE_TRIANGLE,mxTriangle),mxCellRenderer.registerShape(mxConstants.SHAPE_HEXAGON,mxHexagon),mxCellRenderer.registerShape(mxConstants.SHAPE_CLOUD,mxCloud),mxCellRenderer.registerShape(mxConstants.SHAPE_LINE,mxLine),mxCellRenderer.registerShape(mxConstants.SHAPE_ARROW,mxArrow),mxCellRenderer.registerShape(mxConstants.SHAPE_DOUBLE_ELLIPSE,mxDoubleEllipse),mxCellRenderer.registerShape(mxConstants.SHAPE_SWIMLANE,mxSwimlane),mxCellRenderer.registerShape(mxConstants.SHAPE_IMAGE,mxImageShape),mxCellRenderer.registerShape(mxConstants.SHAPE_LABEL,mxLabel),mxCellRenderer.prototype.initialize=function(e,n){var t=e.view.graph.getModel();null!=e.view.graph.container&&null==e.shape&&e.cell!=e.view.currentRoot&&(t.isVertex(e.cell)||t.isEdge(e.cell))&&(this.createShape(e),null==e.shape||null!=n&&!n||(this.initializeShape(e),e.view.graph.ordered||t.isEdge(e.cell)?e.invalidOrder=!0:e.view.graph.keepEdgesInForeground&&null!=this.firstEdge&&(this.firstEdge.parentNode==e.shape.node.parentNode?this.insertState(e,this.firstEdge):this.firstEdge=null),e.shape.scale=e.view.scale,this.createCellOverlays(e),this.installListeners(e)))},mxCellRenderer.prototype.initializeShape=function(e){e.shape.init(e.view.getDrawPane())},mxCellRenderer.prototype.getPreviousStateInContainer=function(e,n){for(var t=null,a=e.view.graph,i=a.getModel(),s=e.cell,o=i.getParent(s);null!=o&&null==t;)t=this.findPreviousStateInContainer(a,o,s,n),s=o,o=i.getParent(s);return t},mxCellRenderer.prototype.findPreviousStateInContainer=function(e,n,t,a){var i=null,s=e.getModel();for(t=null!=t?n.getIndex(t)-1:s.getChildCount(n)-1;0<=t&&null==i;t--)i=this.findPreviousStateInContainer(e,s.getChildAt(n,t),null,a);return null!=i||(null==(i=e.view.getState(n))||null!=i.shape&&null!=i.shape.node&&i.shape.node.parentNode==a)||(i=null),i},mxCellRenderer.prototype.order=function(e){var n=e.shape.node.parentNode,t=this.getPreviousStateInContainer(e,n),a=n.firstChild;null!=t&&(a=t.shape.node,null!=t.text&&null!=t.text.node&&t.text.node.parentNode==n&&(a=t.text.node),a=a.nextSibling),this.insertState(e,a)},mxCellRenderer.prototype.orderEdge=function(e){var n=(t=e.view).graph.getModel();if(t.graph.keepEdgesInForeground)null!=this.firstEdge&&null!=this.firstEdge.parentNode&&this.firstEdge.parentNode==e.shape.node.parentNode||(this.firstEdge=e.shape.node);else if(t.graph.keepEdgesInBackground){var t,a=e.shape.node,i=a.parentNode;n=n.getParent(e.cell);null!=(i=null!=(t=t.getState(n))&&null!=t.shape&&null!=t.shape.node?t.shape.node.nextSibling:i.firstChild)&&i!=a&&this.insertState(e,i)}},mxCellRenderer.prototype.insertState=function(e,n){e.shape.node.parentNode.insertBefore(e.shape.node,n),null!=e.text&&null!=e.text.node&&e.text.node.parentNode==e.shape.node.parentNode&&e.shape.node.parentNode.insertBefore(e.text.node,e.shape.node.nextSibling)},mxCellRenderer.prototype.createShape=function(e){if(null!=e.style){var n=mxStencilRegistry.getStencil(e.style[mxConstants.STYLE_SHAPE]);null!=n?e.shape=new mxShape(n):(n=this.getShapeConstructor(e),e.shape=new n),e.shape.points=e.absolutePoints,e.shape.bounds=new mxRectangle(e.x,e.y,e.width,e.height),e.shape.dialect=e.view.graph.dialect,this.configureShape(e)}},mxCellRenderer.prototype.getShape=function(e){return null!=e?mxCellRenderer.prototype.defaultShapes[e]:null},mxCellRenderer.prototype.getShapeConstructor=function(e){var n=this.getShape(e.style[mxConstants.STYLE_SHAPE]);return null==n&&(n=e.view.graph.getModel().isEdge(e.cell)?this.defaultEdgeShape:this.defaultVertexShape),n},mxCellRenderer.prototype.configureShape=function(e){e.shape.apply(e),e.shape.image=e.view.graph.getImage(e),e.shape.indicatorShape=this.getShape(e.view.graph.getIndicatorShape(e)),e.shape.indicatorColor=e.view.graph.getIndicatorColor(e),e.shape.indicatorGradientColor=e.view.graph.getIndicatorGradientColor(e),e.shape.indicatorDirection=e.style[mxConstants.STYLE_INDICATOR_DIRECTION],e.shape.indicatorImage=e.view.graph.getIndicatorImage(e),this.postConfigureShape(e)},mxCellRenderer.prototype.postConfigureShape=function(e){null!=e.shape&&(this.resolveColor(e,"indicatorColor",mxConstants.STYLE_FILLCOLOR),this.resolveColor(e,"indicatorGradientColor",mxConstants.STYLE_GRADIENTCOLOR),this.resolveColor(e,"fill",mxConstants.STYLE_FILLCOLOR),this.resolveColor(e,"stroke",mxConstants.STYLE_STROKECOLOR),this.resolveColor(e,"gradient",mxConstants.STYLE_GRADIENTCOLOR))},mxCellRenderer.prototype.resolveColor=function(e,n,t){var a=e.shape[n],i=e.view.graph,s=null;"inherit"==a?s=i.model.getParent(e.cell):"swimlane"==a?(s=null!=i.model.getTerminal(e.cell,!1)?i.model.getTerminal(e.cell,!1):e.cell,s=i.getSwimlane(s),t=i.swimlaneIndicatorColorAttribute):"indicated"==a&&(e.shape[n]=e.shape.indicatorColor),null!=s&&(a=i.getView().getState(s),(e.shape[n]=null)!=a&&(e.shape[n]=null!=a.shape&&"indicatorColor"!=n?a.shape[n]:a.style[t]))},mxCellRenderer.prototype.getLabelValue=function(e){return e.view.graph.getLabel(e.cell)},mxCellRenderer.prototype.createLabel=function(t,e){var a=t.view.graph;if(a.getModel().isEdge(t.cell),0<t.style[mxConstants.STYLE_FONTSIZE]||null==t.style[mxConstants.STYLE_FONTSIZE]){var n=a.isHtmlLabel(t.cell)||null!=e&&mxUtils.isNode(e);t.text=new this.defaultTextShape(e,new mxRectangle,t.style[mxConstants.STYLE_ALIGN]||mxConstants.ALIGN_CENTER,a.getVerticalAlign(t),t.style[mxConstants.STYLE_FONTCOLOR],t.style[mxConstants.STYLE_FONTFAMILY],t.style[mxConstants.STYLE_FONTSIZE],t.style[mxConstants.STYLE_FONTSTYLE],t.style[mxConstants.STYLE_SPACING],t.style[mxConstants.STYLE_SPACING_TOP],t.style[mxConstants.STYLE_SPACING_RIGHT],t.style[mxConstants.STYLE_SPACING_BOTTOM],t.style[mxConstants.STYLE_SPACING_LEFT],t.style[mxConstants.STYLE_HORIZONTAL],t.style[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR],t.style[mxConstants.STYLE_LABEL_BORDERCOLOR],a.isWrapping(t.cell)&&a.isHtmlLabel(t.cell),a.isLabelClipped(t.cell),t.style[mxConstants.STYLE_OVERFLOW],t.style[mxConstants.STYLE_LABEL_PADDING]),t.text.opacity=mxUtils.getValue(t.style,mxConstants.STYLE_TEXT_OPACITY,100),t.text.dialect=n?mxConstants.DIALECT_STRICTHTML:t.view.graph.dialect,t.text.state=t,this.initializeLabel(t);var i=!1,s=function(e){var n=t;return(mxClient.IS_TOUCH||i)&&(n=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,n,e),n=a.view.getState(a.getCellAt(e.x,e.y))),n};mxEvent.addGestureListeners(t.text.node,mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,t)),i=a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName)}),mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,s(e)))}),mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,s(e))),i=!1)})),mxEvent.addListener(t.text.node,"dblclick",mxUtils.bind(this,function(e){this.isLabelEvent(t,e)&&(a.dblClick(e,t.cell),mxEvent.consume(e))}))}},mxCellRenderer.prototype.initializeLabel=function(e){var n=e.view.graph;e.text.dialect!=mxConstants.DIALECT_SVG&&(mxClient.IS_SVG&&mxClient.NO_FO?e.text.init(n.container):mxUtils.isVml(e.view.getDrawPane())&&(null!=e.shape.label?e.text.init(e.shape.label):e.text.init(e.shape.node))),null==e.text.node&&(e.text.init(e.view.getDrawPane()),null!=e.shape&&null!=e.text&&e.shape.node.parentNode.insertBefore(e.text.node,e.shape.node.nextSibling))},mxCellRenderer.prototype.createCellOverlays=function(e){var n=e.view.graph.getCellOverlays(e.cell),t=null;if(null!=n){t=new mxDictionary;for(var a=0;a<n.length;a++){var i=null!=e.overlays?e.overlays.remove(n[a]):null;null==i&&((i=new mxImageShape(new mxRectangle,n[a].image.src)).dialect=e.view.graph.dialect,i.preserveImageAspect=!1,i.overlay=n[a],this.initializeOverlay(e,i),this.installCellOverlayListeners(e,n[a],i),null!=n[a].cursor&&(i.node.style.cursor=n[a].cursor)),t.put(n[a],i)}}null!=e.overlays&&e.overlays.visit(function(e,n){n.destroy()}),e.overlays=t},mxCellRenderer.prototype.initializeOverlay=function(e,n){n.init(e.view.getOverlayPane())},mxCellRenderer.prototype.installCellOverlayListeners=function(n,t,e){var a=n.view.graph;mxEvent.addListener(e.node,"click",function(e){a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),t.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",n.cell))}),mxEvent.addGestureListeners(e.node,function(e){mxEvent.consume(e)},function(e){a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,n))}),mxClient.IS_TOUCH&&mxEvent.addListener(e.node,"touchend",function(e){t.fireEvent(new mxEventObject(mxEvent.CLICK,"event",e,"cell",n.cell))})},mxCellRenderer.prototype.createControl=function(t){var a=t.view.graph,e=a.getFoldingImage(t);if(a.foldingEnabled&&null!=e){if(null==t.control){var n=new mxRectangle(0,0,e.width,e.height);t.control=new mxImageShape(n,e.src),t.control.preserveImageAspect=!1,t.control.dialect=a.dialect,this.initControl(t,t.control,!0,function(e){if(a.isEnabled()){var n=!a.isCellCollapsed(t.cell);a.foldCells(n,!1,[t.cell]),mxEvent.consume(e)}})}}else null!=t.control&&(t.control.destroy(),t.control=null)},mxCellRenderer.prototype.initControl=function(n,e,t,a){var i=n.view.graph;return i.isHtmlLabel(n.cell)&&mxClient.NO_FO&&i.dialect==mxConstants.DIALECT_SVG?(e.dialect=mxConstants.DIALECT_PREFERHTML,e.init(i.container),e.node.style.zIndex=1):e.init(n.view.getOverlayPane()),e=e.innerNode||e.node,a&&(i.isEnabled()&&(e.style.cursor="pointer"),mxEvent.addListener(e,"click",a)),t&&mxEvent.addGestureListeners(e,function(e){i.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,n)),mxEvent.consume(e)},function(e){i.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,n))}),e},mxCellRenderer.prototype.isShapeEvent=function(e,n){return!0},mxCellRenderer.prototype.isLabelEvent=function(e,n){return!0},mxCellRenderer.prototype.installListeners=function(t){var a=t.view.graph,n=function(e){var n=t;return(a.dialect!=mxConstants.DIALECT_SVG&&"IMG"==mxEvent.getSource(e).nodeName||mxClient.IS_TOUCH)&&(n=mxEvent.getClientX(e),e=mxEvent.getClientY(e),e=mxUtils.convertPoint(a.container,n,e),n=a.view.getState(a.getCellAt(e.x,e.y))),n},i=!1;mxEvent.addListener(t.shape.node,"gesturestart",mxUtils.bind(this,function(e){a.lastTouchTime=0,i=!0,mxEvent.consume(e)})),mxEvent.addGestureListeners(t.shape.node,mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:t)):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:n(e))):i&&mxEvent.consume(e)}),mxUtils.bind(this,function(e){this.isShapeEvent(t,e)&&!i?a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:n(e))):i&&mxEvent.consume(e)}));var s=mxClient.IS_TOUCH?"gestureend":"dblclick";mxEvent.addListener(t.shape.node,s,mxUtils.bind(this,function(e){i=!1,"gestureend"==s?(a.lastTouchTime=0,a.gestureEnabled&&(a.handleGesture(t,e),mxEvent.consume(e))):this.isShapeEvent(t,e)&&(a.dblClick(e,null!=t.shape&&mxEvent.getSource(e)==t.shape.content?null:t.cell),mxEvent.consume(e))}))},mxCellRenderer.prototype.redrawLabel=function(e,n){var t=this.getLabelValue(e);if(null==e.text&&null!=t&&(mxUtils.isNode(t)||0<t.length)?this.createLabel(e,t):null==e.text||null!=t&&0!=t.length||(e.text.destroy(),e.text=null),null!=e.text){var a=(i=e.view.graph).isWrapping(e.cell),i=i.isLabelClipped(e.cell),s=this.getLabelBounds(e);!n&&e.text.value==t&&e.text.isWrapping==a&&e.text.isClipping==i&&e.text.scale==e.view.scale&&e.text.bounds.equals(s)||(e.text.value=t,e.text.bounds=s,e.text.scale=this.getTextScale(e),e.text.isWrapping=a,e.text.isClipping=i,e.text.redraw())}},mxCellRenderer.prototype.getTextScale=function(e){return e.view.scale},mxCellRenderer.prototype.getLabelBounds=function(e){var n=e.view.graph,t=e.view.scale,a=n.getModel().isEdge(e.cell),i=new mxRectangle(e.absoluteOffset.x,e.absoluteOffset.y);return e.text.updateMargin(),a?(a=e.text.getSpacing(),i.x+=a.x*t,i.y+=a.y*t,null!=(n=n.getCellGeometry(e.cell))&&(i.width=Math.max(0,e.text.margin.x*n.width*t-e.text.spacingLeft*t-e.text.spacingRight*t),i.height=Math.max(0,e.text.margin.y*n.height*t-e.text.spacingTop*t-e.text.spacingBottom*t))):(e.text.isPaintBoundsInverted()&&(a=i.x,i.x=i.y,i.y=a),i.x+=e.x,i.y+=e.y,i.width=Math.max(1,e.width),i.height=Math.max(1,e.height),n.isSwimlane(e.cell)&&(0<(n=n.getStartSize(e.cell)).width?(a=Math.min(i.width,n.width*t),e.shape.flipH&&(i.x+=i.width-a),i.width=a):0<n.height&&(a=Math.min(i.height,n.height*t),e.shape.flipV&&(i.y+=i.height-a),i.height=a)),this.rotateLabelBounds(e,i)),i},mxCellRenderer.prototype.rotateLabelBounds=function(e,n){if(e.text.isPaintBoundsInverted()){var t=(e.width-e.height)/2;n.x+=t,n.y-=t,t=n.width,n.width=n.height,n.height=t}if(n.x-=e.text.margin.x*n.width,n.y-=e.text.margin.y*n.height,"fill"!=e.style[mxConstants.STYLE_OVERFLOW]){t=e.view.scale;var a=e.text.getSpacing();n.x+=a.x*t,n.y+=a.y*t,n.width=Math.max(0,n.width-e.text.spacingLeft*t-e.text.spacingRight*t),n.height=Math.max(0,n.height-e.text.spacingTop*t-e.text.spacingBottom*t)}var i=e.text.getTextRotation();0!=i&&null!=e&&e.view.graph.model.isVertex(e.cell)&&(t=e.getCenterX(),a=e.getCenterY(),n.x!=t||n.y!=a)&&(i*=Math.PI/180,pt=mxUtils.getRotatedPoint(new mxPoint(n.x,n.y),Math.cos(i),Math.sin(i),new mxPoint(t,a)),n.x=pt.x,n.y=pt.y)},mxCellRenderer.prototype.redrawCellOverlays=function(s,o){if(this.createCellOverlays(s),null!=s.overlays){var r=mxUtils.mod(mxUtils.getValue(s.style,mxConstants.STYLE_ROTATION,0),90),e=mxUtils.toRadians(r),l=Math.cos(e),d=Math.sin(e);s.overlays.visit(function(e,n){var t=n.overlay.getBounds(s);if(!s.view.graph.getModel().isEdge(s.cell)&&null!=s.shape&&0!=r){var a=t.getCenterX(),i=t.getCenterY();a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),l,d,new mxPoint(s.getCenterX(),s.getCenterY()))).x,i=i.y;t.x=Math.round(a-t.width/2),t.y=Math.round(i-t.height/2)}!o&&null!=n.bounds&&n.scale==s.view.scale&&n.bounds.equals(t)||(n.bounds=t,n.scale=s.view.scale,n.redraw())})}},mxCellRenderer.prototype.redrawControl=function(e,n){if(null!=e.control){var t=this.getControlBounds(e),a=this.legacyControlPosition?mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0):e.shape.getTextRotation(),i=e.view.scale;!n&&e.control.scale==i&&e.control.bounds.equals(t)&&e.control.rotation==a||(e.control.rotation=a,e.control.bounds=t,e.control.scale=i,e.control.redraw())}},mxCellRenderer.prototype.getControlBounds=function(e){if(null==e.control)return null;var n=e.control.scale,t=e.control.bounds.width/n,a=(n=e.control.bounds.height/n,e.view.scale),i=e.getCenterX(),s=e.getCenterY();if(!e.view.graph.getModel().isEdge(e.cell)&&(i=e.x+t*a,s=e.y+n*a,null!=e.shape)){var o=e.shape.getShapeRotation();if(this.legacyControlPosition)o=mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0);else if(e.shape.isPaintBoundsInverted()){var r=(e.width-e.height)/2;i=i+r,s=s-r}0!=o&&(r=mxUtils.toRadians(o),o=Math.cos(r),r=Math.sin(r),i=(s=mxUtils.getRotatedPoint(new mxPoint(i,s),o,r,new mxPoint(e.getCenterX(),e.getCenterY()))).x,s=s.y)}return e.view.graph.getModel().isEdge(e.cell),new mxRectangle(Math.round(i-t/2*a),Math.round(s-n/2*a),Math.round(t*a),Math.round(n*a))},mxCellRenderer.prototype.redraw=function(e,n,t){if(null!=e.shape){var a=!1;e.view.graph.getModel().isEdge(e.cell),reconfigure=null!=n&&n,this.createControl(e),(e.orderChanged||e.invalidOrder)&&(e.view.graph.ordered?this.order(e):this.orderEdge(e)),!e.orderChanged&&mxUtils.equalEntries(e.shape.style,e.style)||(this.configureShape(e),n=!0),delete e.invalidOrder,delete e.orderChanged,!n&&null!=e.shape.bounds&&e.shape.scale==e.view.scale&&e.shape.bounds.equals(e)&&mxUtils.equalPoints(e.shape.points,e.absolutePoints)||(a=!0,e.shape.points=null!=e.absolutePoints?e.absolutePoints.slice():null,e.shape.bounds=new mxRectangle(e.x,e.y,e.width,e.height),e.shape.scale=e.view.scale,null==t||t?e.shape.redraw():e.shape.updateBoundingBox()),(null==t||t)&&(this.redrawLabel(e,a),this.redrawCellOverlays(e,a),this.redrawControl(e,a))}},mxCellRenderer.prototype.destroy=function(e){null!=e.shape&&(null!=e.text&&(e.text.destroy(),e.text=null),null!=e.overlays&&(e.overlays.visit(function(e,n){n.destroy()}),e.overlays=null),null!=e.control&&(e.control.destroy(),e.control=null),e.shape.destroy(),e.shape=null)};var mxEdgeStyle={EntityRelation:function(e,n,t,a,i){var s=e.view,o=s.graph;a=mxUtils.getValue(e.style,mxConstants.STYLE_SEGMENT,mxConstants.ENTITY_SEGMENT)*s.scale;var r=(d=e.absolutePoints)[0],l=d[d.length-1],d=!1;if(null!=r)(n=new mxCellState).x=r.x,n.y=r.y;else{if(null==n)return;var c=mxUtils.getPortConstraints(n,e,!0,mxConstants.DIRECTION_MASK_NONE);c!=mxConstants.DIRECTION_MASK_NONE?d=c==mxConstants.DIRECTION_MASK_WEST:(r=o.getCellGeometry(n.cell)).relative?d=r.x<=.5:null!=t&&(d=t.x+t.width<n.x)}r=!0,null!=l?((t=new mxCellState).x=l.x,t.y=l.y):null!=t&&((c=mxUtils.getPortConstraints(t,e,!1,mxConstants.DIRECTION_MASK_NONE))!=mxConstants.DIRECTION_MASK_NONE?r=c==mxConstants.DIRECTION_MASK_WEST:(e=o.getCellGeometry(t.cell)).relative?r=e.x<=.5:null!=n&&(r=n.x+n.width<t.x)),null!=n&&null!=t&&(e=d?n.x:n.x+n.width,n=s.getRoutingCenterY(n),o=r?t.x:t.x+t.width,t=s.getRoutingCenterY(t),s=new mxPoint(e+(d?-a:a),n),l=new mxPoint(o+(r?-a:a),t),d==r?(a=d?Math.min(e,o)-a:Math.max(e,o)+a,i.push(new mxPoint(a,n)),i.push(new mxPoint(a,t))):(s.x<l.x==d?(a=n+(t-n)/2,i.push(s),i.push(new mxPoint(s.x,a)),i.push(new mxPoint(l.x,a))):i.push(s),i.push(l)))},Loop:function(e,n,t,a,i){if(null!=n){var s=(t=e.view).graph;null!=(a=null!=a&&0<a.length?a[0]:null)&&(a=t.transformControlPoint(e,a),mxUtils.contains(n,a.x,a.y)&&(a=null));var o=0,r=0,l=0,d=0;s=mxUtils.getValue(e.style,mxConstants.STYLE_SEGMENT,s.gridSize)*t.scale;(e=mxUtils.getValue(e.style,mxConstants.STYLE_DIRECTION,mxConstants.DIRECTION_WEST))==mxConstants.DIRECTION_NORTH||e==mxConstants.DIRECTION_SOUTH?(o=t.getRoutingCenterX(n),r=s):(l=t.getRoutingCenterY(n),d=s),null==a||a.x<n.x||a.x>n.x+n.width?null!=a?(o=a.x,d=Math.max(Math.abs(l-a.y),d)):e==mxConstants.DIRECTION_NORTH?l=n.y-2*r:e==mxConstants.DIRECTION_SOUTH?l=n.y+n.height+2*r:o=e==mxConstants.DIRECTION_EAST?n.x-2*d:n.x+n.width+2*d:null!=a&&(o=t.getRoutingCenterX(n),r=Math.max(Math.abs(o-a.x),d),l=a.y,d=0),i.push(new mxPoint(o-r,l-d)),i.push(new mxPoint(o+r,l+d))}},ElbowConnector:function(e,n,t,a,i){var s=null!=a&&0<a.length?a[0]:null,o=!1,r=!1;if(null!=n&&null!=t)if(null!=s){var l=Math.min(n.x,t.x),d=Math.max(n.x+n.width,t.x+t.width),c=(r=Math.min(n.y,t.y),Math.max(n.y+n.height,t.y+t.height));o=(s=e.view.transformControlPoint(e,s)).y<r||s.y>c,r=s.x<l||s.x>d}else(o=(l=Math.max(n.x,t.x))==(d=Math.min(n.x+n.width,t.x+t.width)))||(r=(r=Math.max(n.y,t.y))==(c=Math.min(n.y+n.height,t.y+t.height)));r||!o&&e.style[mxConstants.STYLE_ELBOW]!=mxConstants.ELBOW_VERTICAL?mxEdgeStyle.SideToSide(e,n,t,a,i):mxEdgeStyle.TopToBottom(e,n,t,a,i)},SideToSide:function(e,n,t,a,i){var s=e.view;a=null!=a&&0<a.length?a[0]:null;var o=(r=e.absolutePoints)[0],r=r[r.length-1];null!=a&&(a=s.transformControlPoint(e,a)),null!=o&&((n=new mxCellState).x=o.x,n.y=o.y),null!=r&&((t=new mxCellState).x=r.x,t.y=r.y),null!=n&&null!=t&&(e=Math.max(n.x,t.x),o=Math.min(n.x+n.width,t.x+t.width),e=null!=a?a.x:o+(e-o)/2,o=s.getRoutingCenterY(n),s=s.getRoutingCenterY(t),null!=a&&(a.y>=n.y&&a.y<=n.y+n.height&&(o=a.y),a.y>=t.y&&a.y<=t.y+t.height&&(s=a.y)),!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),!mxUtils.contains(t,e,s)&&!mxUtils.contains(n,e,s)&&i.push(new mxPoint(e,s)),1==i.length&&(null!=a?!mxUtils.contains(t,e,a.y)&&!mxUtils.contains(n,e,a.y)&&i.push(new mxPoint(e,a.y)):(s=Math.max(n.y,t.y),n=Math.min(n.y+n.height,t.y+t.height),i.push(new mxPoint(e,s+(n-s)/2)))))},TopToBottom:function(e,n,t,a,i){var s=e.view;a=null!=a&&0<a.length?a[0]:null;var o=(r=e.absolutePoints)[0],r=r[r.length-1];null!=a&&(a=s.transformControlPoint(e,a)),null!=o&&((n=new mxCellState).x=o.x,n.y=o.y),null!=r&&((t=new mxCellState).x=r.x,t.y=r.y),null!=n&&null!=t&&(o=Math.max(n.y,t.y),r=Math.min(n.y+n.height,t.y+t.height),e=s.getRoutingCenterX(n),null!=a&&a.x>=n.x&&a.x<=n.x+n.width&&(e=a.x),o=null!=a?a.y:r+(o-r)/2,!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),e=null!=a&&a.x>=t.x&&a.x<=t.x+t.width?a.x:s.getRoutingCenterX(t),!mxUtils.contains(t,e,o)&&!mxUtils.contains(n,e,o)&&i.push(new mxPoint(e,o)),1==i.length&&(null!=a&&1==i.length?!mxUtils.contains(t,a.x,o)&&!mxUtils.contains(n,a.x,o)&&i.push(new mxPoint(a.x,o)):(s=Math.max(n.x,t.x),n=Math.min(n.x+n.width,t.x+t.width),i.push(new mxPoint(s+(n-s)/2,o)))))},SegmentConnector:function(e,n,t,a,i){var s=e.absolutePoints,o=!0,r=null,l=s[0];null==l&&null!=n?l=new mxPoint(e.view.getRoutingCenterX(n),e.view.getRoutingCenterY(n)):null!=l&&(l=l.clone());var d=s.length-1;if(null!=a&&0<a.length){r=e.view.transformControlPoint(e,a[0]);for(var c=n,m=s[0],u=!1,p=!1,g=(u=r,a.length),v=0;v<2;v++){var h=null!=m&&m.x==u.x,f=null!=m&&m.y==u.y,b=null!=c&&u.y>=c.y&&u.y<=c.y+c.height;c=null!=c&&u.x>=c.x&&u.x<=c.x+c.width,u=f||null==m&&b,p=h||null==m&&c;if(null!=m&&!f&&!h&&(b||c)){o=!b;break}if(p||u){o=u,1==v&&(o=0==a.length%2?u:p);break}c=t,m=s[d],u=e.view.transformControlPoint(e,a[g-1])}for(o&&(null!=s[0]&&s[0].y!=r.y||null==s[0]&&null!=n&&(r.y<n.y||r.y>n.y+n.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[0]&&s[0].x!=r.x||null==s[0]&&null!=n&&(r.x<n.x||r.x>n.x+n.width))&&i.push(new mxPoint(r.x,l.y)),o?l.y=r.y:l.x=r.x,v=0;v<a.length;v++)o=!o,r=e.view.transformControlPoint(e,a[v]),o?l.y=r.y:l.x=r.x,i.push(l.clone())}else r=l,o=!0;if(null==(l=s[d])&&null!=t&&(l=new mxPoint(e.view.getRoutingCenterX(t),e.view.getRoutingCenterY(t))),o&&(null!=s[d]&&s[d].y!=r.y||null==s[d]&&null!=t&&(r.y<t.y||r.y>t.y+t.height))?i.push(new mxPoint(l.x,r.y)):!o&&(null!=s[d]&&s[d].x!=r.x||null==s[d]&&null!=t&&(r.x<t.x||r.x>t.x+t.width))&&i.push(new mxPoint(r.x,l.y)),null==s[0]&&null!=n)for(;1<i.length&&mxUtils.contains(n,i[1].x,i[1].y);)i=i.splice(1,1);if(null==s[d]&&null!=t)for(;1<i.length&&mxUtils.contains(t,i[i.length-1].x,i[i.length-1].y);)i=i.splice(i.length-1,1)},orthBuffer:10,dirVectors:[[-1,0],[0,-1],[1,0],[0,1],[-1,0],[0,-1],[1,0]],wayPoints1:[[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]],routePatterns:[[[513,2308,2081,2562],[513,1090,514,2184,2114,2561],[513,1090,514,2564,2184,2562],[513,2308,2561,1090,514,2568,2308]],[[514,1057,513,2308,2081,2562],[514,2184,2114,2561],[514,2184,2562,1057,513,2564,2184],[514,1057,513,2568,2308,2561]],[[1090,514,1057,513,2308,2081,2562],[2114,2561],[1090,2562,1057,513,2564,2184],[1090,514,1057,513,2308,2561,2568]],[[2081,2562],[1057,513,1090,514,2184,2114,2561],[1057,513,1090,514,2184,2562,2564],[1057,2561,1090,514,2568,2308]]],inlineRoutePatterns:[[null,[2114,2568],null,null],[null,[514,2081,2114,2568],null,null],[null,[2114,2561],null,null],[[2081,2562],[1057,2114,2568],[2184,2562],null]],vertexSeperations:[],limits:[[0,0,0,0,0,0,0,0,0],[0,0,0,0,0,0,0,0,0]],LEFT_MASK:32,TOP_MASK:64,RIGHT_MASK:128,BOTTOM_MASK:256,LEFT:1,TOP:2,RIGHT:4,BOTTOM:8,SIDE_MASK:480,CENTER_MASK:512,SOURCE_MASK:1024,TARGET_MASK:2048,VERTEX_MASK:3072,OrthConnector:function(e,n,t,a,i){var s=e.view.graph,o=null!=n&&s.getModel().isEdge(n.cell);s=null!=t&&s.getModel().isEdge(t.cell);if(null!=a&&0<a.length||o||s)mxEdgeStyle.SegmentConnector(e,n,t,a,i);else{var r=(a=e.absolutePoints)[0],l=a[a.length-1];a=null!=n?n.x:r.x;o=null!=n?n.y:r.y;var d=null!=n?n.width:1,c=null!=n?n.height:1,m=null!=t?t.x:l.x,u=null!=t?t.y:l.y,p=null!=t?t.width:1,g=null!=t?t.height:1,v=(s=e.view.scale*mxEdgeStyle.orthBuffer,[mxConstants.DIRECTION_MASK_ALL,mxConstants.DIRECTION_MASK_ALL]);for(null!=n&&(v[0]=mxUtils.getPortConstraints(n,e,!0,mxConstants.DIRECTION_MASK_ALL)),null!=t&&(v[1]=mxUtils.getPortConstraints(t,e,!1,mxConstants.DIRECTION_MASK_ALL)),e=[0,0],a=[[a,o,d,c],[m,u,p,g]],d=0;d<2;d++)mxEdgeStyle.limits[d][1]=a[d][0]-s,mxEdgeStyle.limits[d][2]=a[d][1]-s,mxEdgeStyle.limits[d][4]=a[d][0]+a[d][2]+s,mxEdgeStyle.limits[d][8]=a[d][1]+a[d][3]+s;for(d=a[0][0]+a[0][2]/2-(a[1][0]+a[1][2]/2),c=a[0][1]+a[0][3]/2-(a[1][1]+a[1][3]/2),d<(o=0)?o=c<0?2:1:c<=0&&(o=3,0==d&&(o=2)),(c=null)!=n&&(c=r),n=[[.5,.5],[.5,.5]],d=0;d<2;d++)null!=c&&(n[d][0]=(c.x-a[d][0])/a[d][2],n[d][0]<.01?e[d]=mxConstants.DIRECTION_MASK_WEST:.99<n[d][0]&&(e[d]=mxConstants.DIRECTION_MASK_EAST),n[d][1]=(c.y-a[d][1])/a[d][3],n[d][1]<.01?e[d]=mxConstants.DIRECTION_MASK_NORTH:.99<n[d][1]&&(e[d]=mxConstants.DIRECTION_MASK_SOUTH)),(c=null)!=t&&(c=l);for(d=a[0][1]-(a[1][1]+a[1][3]),c=a[0][0]-(a[1][0]+a[1][2]),m=a[1][1]-(a[0][1]+a[0][3]),u=a[1][0]-(a[0][0]+a[0][2]),mxEdgeStyle.vertexSeperations[1]=Math.max(c-2*s,0),mxEdgeStyle.vertexSeperations[2]=Math.max(d-2*s,0),mxEdgeStyle.vertexSeperations[4]=Math.max(m-2*s,0),mxEdgeStyle.vertexSeperations[3]=Math.max(u-2*s,0),t=[],l=[],(r=[])[0]=u<=c?mxConstants.DIRECTION_MASK_WEST:mxConstants.DIRECTION_MASK_EAST,l[0]=m<=d?mxConstants.DIRECTION_MASK_NORTH:mxConstants.DIRECTION_MASK_SOUTH,r[1]=mxUtils.reversePortConstraints(r[0]),l[1]=mxUtils.reversePortConstraints(l[0]),c=u<=c?c:u,m=m<=d?d:m,p=!(u=[[0,0],[0,0]]),d=0;d<2;d++)0==e[d]&&(0==(r[d]&v[d])&&(r[d]=mxUtils.reversePortConstraints(r[d])),0==(l[d]&v[d])&&(l[d]=mxUtils.reversePortConstraints(l[d])),u[d][0]=l[d],u[d][1]=r[d]);for(2*s<m&&2*s<c&&(0<(r[0]&v[0])&&0<(l[1]&v[1])?(u[0][0]=r[0],u[0][1]=l[0],u[1][0]=l[1],u[1][1]=r[1],p=!0):0<(l[0]&v[0])&&0<(r[1]&v[1])&&(u[0][0]=l[0],u[0][1]=r[0],u[1][0]=r[1],u[1][1]=l[1],p=!0)),2*s<m&&!p&&(u[0][0]=l[0],u[0][1]=r[0],u[1][0]=l[1],u[1][1]=r[1],p=!0),2*s<c&&!p&&(u[0][0]=r[0],u[0][1]=l[0],u[1][0]=r[1],u[1][1]=l[1]),d=0;d<2;d++)0==e[d]&&(0==(u[d][0]&v[d])&&(u[d][0]=u[d][1]),t[d]=u[d][0]&v[d],t[d]|=(u[d][1]&v[d])<<8,t[d]|=(u[1-d][d]&v[d])<<16,t[d]|=(u[1-d][1-d]&v[d])<<24,0==(15&t[d])&&(t[d]<<=8),0==(3840&t[d])&&(t[d]=15&t[d]|t[d]>>8),0==(983040&t[d])&&(t[d]=65535&t[d]|(251658240&t[d])>>8),e[d]=15&t[d],v[d]==mxConstants.DIRECTION_MASK_WEST||v[d]==mxConstants.DIRECTION_MASK_NORTH||v[d]==mxConstants.DIRECTION_MASK_EAST||v[d]==mxConstants.DIRECTION_MASK_SOUTH)&&(e[d]=v[d]);switch(d=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0],v=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(d-=o)<1&&(d+=4),(v-=o)<1&&(v+=4),v=mxEdgeStyle.routePatterns[d-1][v-1],mxEdgeStyle.wayPoints1[0][0]=a[0][0],mxEdgeStyle.wayPoints1[0][1]=a[0][1],e[0]){case mxConstants.DIRECTION_MASK_WEST:mxEdgeStyle.wayPoints1[0][0]-=s,mxEdgeStyle.wayPoints1[0][1]+=n[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_SOUTH:mxEdgeStyle.wayPoints1[0][0]+=n[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]+=a[0][3]+s;break;case mxConstants.DIRECTION_MASK_EAST:mxEdgeStyle.wayPoints1[0][0]+=a[0][2]+s,mxEdgeStyle.wayPoints1[0][1]+=n[0][1]*a[0][3];break;case mxConstants.DIRECTION_MASK_NORTH:mxEdgeStyle.wayPoints1[0][0]+=n[0][0]*a[0][2],mxEdgeStyle.wayPoints1[0][1]-=s}for(r=t=(s=0)<(e[0]&(mxConstants.DIRECTION_MASK_EAST|mxConstants.DIRECTION_MASK_WEST))?0:1,d=l=0;d<v.length;d++){g=(l=15&v[d])==mxConstants.DIRECTION_MASK_EAST?3:l,4<(g+=o)&&(g-=4),c=mxEdgeStyle.dirVectors[g-1],(l=0<g%2?0:1)!=t&&(s++,mxEdgeStyle.wayPoints1[s][0]=mxEdgeStyle.wayPoints1[s-1][0],mxEdgeStyle.wayPoints1[s][1]=mxEdgeStyle.wayPoints1[s-1][1]);var h=0<(v[d]&mxEdgeStyle.TARGET_MASK);p=0<(v[d]&mxEdgeStyle.SOURCE_MASK);15<(m=(m=(v[d]&mxEdgeStyle.SIDE_MASK)>>5)<<o)&&(m>>=4),u=0<(v[d]&mxEdgeStyle.CENTER_MASK),(p||h)&&m<9?(g=0,p=p?0:1,g=u&&0==l?a[p][0]+n[p][0]*a[p][2]:u?a[p][1]+n[p][1]*a[p][3]:mxEdgeStyle.limits[p][m],0==l?0<(m=(g-mxEdgeStyle.wayPoints1[s][0])*c[0])&&(mxEdgeStyle.wayPoints1[s][0]+=c[0]*m):0<(m=(g-mxEdgeStyle.wayPoints1[s][1])*c[1])&&(mxEdgeStyle.wayPoints1[s][1]+=c[1]*m)):u&&(mxEdgeStyle.wayPoints1[s][0]+=c[0]*Math.abs(mxEdgeStyle.vertexSeperations[g]/2),mxEdgeStyle.wayPoints1[s][1]+=c[1]*Math.abs(mxEdgeStyle.vertexSeperations[g]/2)),0<s&&mxEdgeStyle.wayPoints1[s][l]==mxEdgeStyle.wayPoints1[s-1][l]?s--:t=l}for(d=0;d<=s&&(d!=s||((0<(e[1]&(mxConstants.DIRECTION_MASK_EAST|mxConstants.DIRECTION_MASK_WEST))?0:1)==r?0:1)==(s+1)%2);d++)i.push(new mxPoint(mxEdgeStyle.wayPoints1[d][0],mxEdgeStyle.wayPoints1[d][1]))}},getRoutePattern:function(e,n,t,a){var i=e[0]==mxConstants.DIRECTION_MASK_EAST?3:e[0];return e=e[1]==mxConstants.DIRECTION_MASK_EAST?3:e[1],(i-=n)<1&&(i+=4),(e-=n)<1&&(e+=4),n=routePatterns[i-1][e-1],0!=t&&0!=a||null!=inlineRoutePatterns[i-1][e-1]&&(n=inlineRoutePatterns[i-1][e-1]),n}},mxStyleRegistry={values:[],putValue:function(e,n){mxStyleRegistry.values[e]=n},getValue:function(e){return mxStyleRegistry.values[e]},getName:function(e){for(var n in mxStyleRegistry.values)if(mxStyleRegistry.values[n]==e)return n;return null}};function mxGraphView(e){this.graph=e,this.translate=new mxPoint,this.graphBounds=new mxRectangle,this.states=new mxDictionary}function mxCurrentRootChange(e,n){if(this.view=e,this.previous=this.root=n,this.isUp=null==n,!this.isUp)for(var t=this.view.currentRoot,a=this.view.graph.getModel();null!=t;){if(t==n){this.isUp=!0;break}t=a.getParent(t)}}function mxGraph(e,n,t,a){this.mouseListeners=null,this.renderHint=t,this.dialect=mxClient.IS_SVG?mxConstants.DIALECT_SVG:t==mxConstants.RENDERING_HINT_EXACT&&mxClient.IS_VML?mxConstants.DIALECT_VML:t==mxConstants.RENDERING_HINT_FASTEST?mxConstants.DIALECT_STRICTHTML:t==mxConstants.RENDERING_HINT_FASTER?mxConstants.DIALECT_PREFERHTML:mxConstants.DIALECT_MIXEDHTML,this.model=null!=n?n:new mxGraphModel,this.multiplicities=[],this.imageBundles=[],this.cellRenderer=this.createCellRenderer(),this.setSelectionModel(this.createSelectionModel()),this.setStylesheet(null!=a?a:this.createStylesheet()),this.view=this.createGraphView(),this.graphModelChangeListener=mxUtils.bind(this,function(e,n){this.graphModelChanged(n.getProperty("edit").changes)}),this.model.addListener(mxEvent.CHANGE,this.graphModelChangeListener),this.createHandlers(),null!=e&&this.init(e),this.view.revalidate()}function mxCellOverlay(e,n,t,a,i,s){this.image=e,this.tooltip=n,this.align=null!=t?t:this.align,this.verticalAlign=null!=a?a:this.verticalAlign,this.offset=null!=i?i:new mxPoint,this.cursor=null!=s?s:"help"}function mxOutline(e,n){this.source=e,null!=n&&this.init(n)}function mxMultiplicity(e,n,t,a,i,s,o,r,l,d){this.source=e,this.type=n,this.attr=t,this.value=a,this.min=null!=i?i:0,this.max=null!=s?s:"n",this.validNeighbors=o,this.countError=mxResources.get(r)||r,this.typeError=mxResources.get(l)||l,this.validNeighborsAllowed=null==d||d}function mxLayoutManager(e){this.undoHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.beforeUndo(n.getProperty("edit"))}),this.moveHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsMoved(n.getProperty("cells"),n.getProperty("event"))}),this.setGraph(e)}function mxSpaceManager(e,n,t,a){this.resizeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.foldHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.shiftRightwards=null==n||n,this.shiftDownwards=null==t||t,this.extendParents=null==a||a,this.setGraph(e)}function mxSwimlaneManager(e,n,t,a){this.horizontal=null==n||n,this.addEnabled=null==t||t,this.resizeEnabled=null==a||a,this.addHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.isAddEnabled()&&this.cellsAdded(n.getProperty("cells"))}),this.resizeHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.isResizeEnabled()&&this.cellsResized(n.getProperty("cells"))}),this.setGraph(e)}function mxTemporaryCellStates(e,n,t){if(this.view=e,n=null!=n?n:1,this.oldBounds=e.getGraphBounds(),this.oldStates=e.getStates(),this.oldScale=e.getScale(),e.setStates(new mxDictionary),e.setScale(n),null!=t){n=e.createState(new mxCell);for(var a=0;a<t.length;a++)e.validateBounds(n,t[a]);var i=null;for(a=0;a<t.length;a++){var s=e.validatePoints(n,t[a]);null==i?i=s:i.add(s)}null==i&&(i=new mxRectangle),e.setGraphBounds(i)}}function mxCellStatePreview(e){this.graph=e,this.deltas={}}function mxConnectionConstraint(e,n){this.point=e,this.perimeter=null==n||n}function mxGraphHandler(e){this.graph=e,this.graph.addMouseListener(this),this.panHandler=mxUtils.bind(this,function(){this.updatePreviewShape()}),this.graph.addListener(mxEvent.PAN,this.panHandler)}function mxPanningHandler(e,n){null!=e&&(this.graph=e,this.factoryMethod=n,this.graph.addMouseListener(this),this.init())}function mxCellMarker(e,n,t,a){mxEventSource.call(this),null!=e&&(this.graph=e,this.validColor=null!=n?n:mxConstants.DEFAULT_VALID_COLOR,this.invalidColor=null!=n?t:mxConstants.DEFAULT_INVALID_COLOR,this.hotspot=null!=a?a:mxConstants.DEFAULT_HOTSPOT,this.highlight=new mxCellHighlight(e))}function mxSelectionCellsHandler(e){mxEventSource.call(this),this.graph=e,this.handlers=new mxDictionary,this.graph.addMouseListener(this),this.refreshHandler=mxUtils.bind(this,function(e,n){this.isEnabled()&&this.refresh()}),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,this.refreshHandler),this.graph.getModel().addListener(mxEvent.CHANGE,this.refreshHandler),this.graph.getView().addListener(mxEvent.SCALE,this.refreshHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.refreshHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.refreshHandler),this.graph.getView().addListener(mxEvent.DOWN,this.refreshHandler),this.graph.getView().addListener(mxEvent.UP,this.refreshHandler)}function mxConnectionHandler(e,n){mxEventSource.call(this),null!=e&&(this.graph=e,this.factoryMethod=n,this.init())}function mxConstraintHandler(e){this.graph=e}function mxRubberband(e){null!=e&&(this.graph=e,this.graph.addMouseListener(this),this.panHandler=mxUtils.bind(this,function(){this.repaint()}),this.graph.addListener(mxEvent.PAN,this.panHandler),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}function mxVertexHandler(e){null!=e&&(this.state=e,this.init())}function mxEdgeHandler(e){null!=e&&(this.state=e,this.init())}function mxElbowEdgeHandler(e){mxEdgeHandler.call(this,e)}function mxEdgeSegmentHandler(e){mxEdgeHandler.call(this,e)}function mxKeyHandler(e,n){null!=e&&(this.graph=e,this.target=n||document.documentElement,this.normalKeys=[],this.shiftKeys=[],this.controlKeys=[],this.controlShiftKeys=[],mxEvent.addListener(this.target,"keydown",mxUtils.bind(this,function(e){this.keyDown(e)})),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}function mxTooltipHandler(e,n){null!=e&&(this.graph=e,this.delay=n||500,this.graph.addMouseListener(this))}function mxCellTracker(e,n,t){mxCellMarker.call(this,e,n),this.graph.addMouseListener(this),null!=t&&(this.getCell=t),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()}))}function mxCellHighlight(e,n,t,a){null!=e&&(this.graph=e,this.highlightColor=null!=n?n:mxConstants.DEFAULT_VALID_COLOR,this.strokeWidth=null!=t?t:mxConstants.HIGHLIGHT_STROKEWIDTH,this.dashed=null!=a&&a,this.repaintHandler=mxUtils.bind(this,function(){this.repaint()}),this.graph.getView().addListener(mxEvent.SCALE,this.repaintHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.repaintHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.repaintHandler),this.graph.getModel().addListener(mxEvent.CHANGE,this.repaintHandler),this.resetHandler=mxUtils.bind(this,function(){this.hide()}),this.graph.getView().addListener(mxEvent.DOWN,this.resetHandler),this.graph.getView().addListener(mxEvent.UP,this.resetHandler))}function mxDefaultKeyHandler(n){if(null!=n){this.editor=n,this.handler=new mxKeyHandler(n.graph);var t=this.handler.escape;this.handler.escape=function(e){t.apply(this,arguments),n.hideProperties(),n.fireEvent(new mxEventObject(mxEvent.ESCAPE,"event",e))}}}function mxDefaultPopupMenu(e){this.config=e}function mxDefaultToolbar(e,n){this.editor=n,null!=e&&null!=n&&this.init(e)}function mxEditor(e){this.actions=[],this.addActions(),null!=document.body&&(this.cycleAttributeValues=[],this.popupHandler=new mxDefaultPopupMenu,this.undoManager=new mxUndoManager,this.graph=this.createGraph(),this.toolbar=this.createToolbar(),this.keyHandler=new mxDefaultKeyHandler(this),this.configure(e),this.graph.swimlaneIndicatorColorAttribute=this.cycleAttributeName,!mxClient.IS_LOCAL&&null!=this.urlInit&&(this.session=this.createSession()),null!=this.onInit&&this.onInit(),mxClient.IS_IE&&mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})))}mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ELBOW,mxEdgeStyle.ElbowConnector),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ENTITY_RELATION,mxEdgeStyle.EntityRelation),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_LOOP,mxEdgeStyle.Loop),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_SIDETOSIDE,mxEdgeStyle.SideToSide),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_TOPTOBOTTOM,mxEdgeStyle.TopToBottom),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_ORTHOGONAL,mxEdgeStyle.OrthConnector),mxStyleRegistry.putValue(mxConstants.EDGESTYLE_SEGMENT,mxEdgeStyle.SegmentConnector),mxStyleRegistry.putValue(mxConstants.PERIMETER_ELLIPSE,mxPerimeter.EllipsePerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_RECTANGLE,mxPerimeter.RectanglePerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_RHOMBUS,mxPerimeter.RhombusPerimeter),mxStyleRegistry.putValue(mxConstants.PERIMETER_TRIANGLE,mxPerimeter.TrianglePerimeter),mxGraphView.prototype=new mxEventSource,mxGraphView.prototype.constructor=mxGraphView,mxGraphView.prototype.EMPTY_POINT=new mxPoint,mxGraphView.prototype.doneResource="none"!=mxClient.language?"done":"",mxGraphView.prototype.updatingDocumentResource="none"!=mxClient.language?"updatingDocument":"",mxGraphView.prototype.allowEval=!1,mxGraphView.prototype.captureDocumentGesture=!0,mxGraphView.prototype.optimizeVmlReflows=!0,mxGraphView.prototype.rendering=!0,mxGraphView.prototype.graph=null,mxGraphView.prototype.currentRoot=null,mxGraphView.prototype.graphBounds=null,mxGraphView.prototype.scale=1,mxGraphView.prototype.translate=null,mxGraphView.prototype.updateStyle=!1,mxGraphView.prototype.getGraphBounds=function(){return this.graphBounds},mxGraphView.prototype.setGraphBounds=function(e){this.graphBounds=e},mxGraphView.prototype.getBounds=function(e){var n=null;if(null!=e&&0<e.length)for(var t=this.graph.getModel(),a=0;a<e.length;a++)if(t.isVertex(e[a])||t.isEdge(e[a])){var i=this.getState(e[a]);null!=i&&(null==n?n=new mxRectangle(i.x,i.y,i.width,i.height):n.add(i))}return n},mxGraphView.prototype.setCurrentRoot=function(e){if(this.currentRoot!=e){var n=new mxCurrentRootChange(this,e);n.execute();var t=new mxUndoableEdit(this,!1);t.add(n),this.fireEvent(new mxEventObject(mxEvent.UNDO,"edit",t)),this.graph.sizeDidChange()}return e},mxGraphView.prototype.scaleAndTranslate=function(e,n,t){var a=this.scale,i=new mxPoint(this.translate.x,this.translate.y);this.scale==e&&this.translate.x==n&&this.translate.y==t||(this.scale=e,this.translate.x=n,this.translate.y=t,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE_AND_TRANSLATE,"scale",e,"previousScale",a,"translate",this.translate,"previousTranslate",i))},mxGraphView.prototype.getScale=function(){return this.scale},mxGraphView.prototype.setScale=function(e){var n=this.scale;this.scale!=e&&(this.scale=e,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.SCALE,"scale",e,"previousScale",n))},mxGraphView.prototype.getTranslate=function(){return this.translate},mxGraphView.prototype.setTranslate=function(e,n){var t=new mxPoint(this.translate.x,this.translate.y);this.translate.x==e&&this.translate.y==n||(this.translate.x=e,this.translate.y=n,this.isEventsEnabled()&&(this.revalidate(),this.graph.sizeDidChange())),this.fireEvent(new mxEventObject(mxEvent.TRANSLATE,"translate",this.translate,"previousTranslate",t))},mxGraphView.prototype.refresh=function(){null!=this.currentRoot&&this.clear(),this.revalidate()},mxGraphView.prototype.revalidate=function(){this.invalidate(),this.validate()},mxGraphView.prototype.clear=function(e,n,t){var a=this.graph.getModel();if(e=e||a.getRoot(),n=null!=n&&n,t=null==t||t,this.removeState(e),t&&(n||e!=this.currentRoot)){t=a.getChildCount(e);for(var i=0;i<t;i++)this.clear(a.getChildAt(e,i),n)}else this.invalidate(e)},mxGraphView.prototype.invalidate=function(e,n,t,a){var i=this.graph.getModel();if(e=e||i.getRoot(),n=null==n||n,t=null==t||t,a=null!=a&&a,null!=(o=this.getState(e))&&(o.invalid=!0,a&&(o.orderChanged=!0)),n)for(var s=i.getChildCount(e),o=0;o<s;o++){var r=i.getChildAt(e,o);this.invalidate(r,n,t,a)}if(t)for(a=i.getEdgeCount(e),o=0;o<a;o++)this.invalidate(i.getEdgeAt(e,o),n,t)},mxGraphView.prototype.validate=function(e){var n=mxLog.enter("mxGraphView.validate");window.status=mxResources.get(this.updatingDocumentResource)||this.updatingDocumentResource;var t=null;if(this.optimizeVmlReflows&&null!=this.canvas&&null==this.textDiv&&(8==document.documentMode||mxClient.IS_QUIRKS)){t=this.canvas.style.display,this.canvas.style.display="none";var a=document.createElement("div");a.style.position="absolute",a.style.whiteSpace="nowrap",a.style.visibility="hidden",a.style.display=mxClient.IS_QUIRKS?"inline":"inline-block",a.style.zoom="1",document.body.appendChild(a),this.textDiv=a}e=e||(null!=this.currentRoot?this.currentRoot:this.graph.getModel().getRoot()),this.validateBounds(null,e),null==(e=this.validatePoints(null,e))&&(e=new mxRectangle),this.setGraphBounds(e),this.validateBackground(),null!=t&&(this.canvas.style.display=t,document.body.removeChild(this.textDiv),this.textDiv=null),window.status=mxResources.get(this.doneResource)||this.doneResource,mxLog.leave("mxGraphView.validate",n)},mxGraphView.prototype.createBackgroundPageShape=function(e){return new mxRectangleShape(e,"white","black")},mxGraphView.prototype.validateBackground=function(){var e=this.graph.getBackgroundImage();if(null!=e){if(null==this.backgroundImage||this.backgroundImage.image!=e.src){null!=this.backgroundImage&&this.backgroundImage.destroy();var n=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(n,e.src),this.backgroundImage.dialect=this.graph.dialect,this.backgroundImage.init(this.backgroundPane),this.backgroundImage.redraw()}this.redrawBackgroundImage(this.backgroundImage,e)}else null!=this.backgroundImage&&(this.backgroundImage.destroy(),this.backgroundImage=null);this.graph.pageVisible?(n=this.getBackgroundPageBounds(),null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(n),this.backgroundPageShape.scale=this.scale,this.backgroundPageShape.isShadow=!0,this.backgroundPageShape.dialect=this.graph.dialect,this.backgroundPageShape.init(this.backgroundPane),this.backgroundPageShape.redraw(),mxEvent.addListener(this.backgroundPageShape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e)})),mxEvent.addGestureListeners(this.backgroundPageShape.node,mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){null!=this.graph.tooltipHandler&&this.graph.tooltipHandler.isHideOnHover()&&this.graph.tooltipHandler.hide(),this.graph.isMouseDown&&!mxEvent.isConsumed(e)&&this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}))):(this.backgroundPageShape.scale=this.scale,this.backgroundPageShape.bounds=n,this.backgroundPageShape.redraw())):null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.graph.pageFormat,n=this.scale*this.graph.pageScale;return new mxRectangle(this.scale*this.translate.x,this.scale*this.translate.y,e.width*n,e.height*n)},mxGraphView.prototype.redrawBackgroundImage=function(e,n){e.scale=this.scale,e.bounds.x=this.scale*this.translate.x,e.bounds.y=this.scale*this.translate.y,e.bounds.width=this.scale*n.width,e.bounds.height=this.scale*n.height,e.redraw()},mxGraphView.prototype.validateBounds=function(e,n){var t=this.graph.getModel(),a=this.getState(n,!0);if(null!=a&&a.invalid){if(this.graph.isCellVisible(n)){if(n!=this.currentRoot&&null!=e)if(a.absoluteOffset.x=0,a.absoluteOffset.y=0,a.origin.x=e.origin.x,a.origin.y=e.origin.y,null!=(s=this.graph.getCellGeometry(n))){if(!t.isEdge(n)){var i=s.offset||this.EMPTY_POINT;s.relative?(a.origin.x+=s.x*e.width/this.scale+i.x,a.origin.y+=s.y*e.height/this.scale+i.y):(a.absoluteOffset.x=this.scale*i.x,a.absoluteOffset.y=this.scale*i.y,a.origin.x+=s.x,a.origin.y+=s.y)}if(a.x=this.scale*(this.translate.x+a.origin.x),a.y=this.scale*(this.translate.y+a.origin.y),a.width=this.scale*s.width,a.height=this.scale*s.height,t.isVertex(n)){if(s.relative&&0!=(i=mxUtils.toRadians(e.style[mxConstants.STYLE_ROTATION]||"0"))){var s=Math.cos(i),o=(i=Math.sin(i),new mxPoint(a.getCenterX(),a.getCenterY())),r=new mxPoint(e.getCenterX(),e.getCenterY());s=mxUtils.getRotatedPoint(o,s,i,r);a.x=s.x-a.width/2,a.y=s.y-a.height/2}this.updateVertexLabelOffset(a)}}}else this.removeState(n);null!=(i=this.graph.getChildOffsetForCell(n))&&(a.origin.x+=i.x,a.origin.y+=i.y)}if(null!=a&&(!this.graph.isCellCollapsed(n)||n==this.currentRoot))for(s=t.getChildCount(n),i=0;i<s;i++)o=t.getChildAt(n,i),this.validateBounds(a,o)},mxGraphView.prototype.updateVertexLabelOffset=function(e){var n=mxUtils.getValue(e.style,mxConstants.STYLE_LABEL_POSITION,mxConstants.ALIGN_CENTER);n==mxConstants.ALIGN_LEFT?e.absoluteOffset.x-=e.width:n==mxConstants.ALIGN_RIGHT&&(e.absoluteOffset.x+=e.width),(n=mxUtils.getValue(e.style,mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.ALIGN_MIDDLE))==mxConstants.ALIGN_TOP?e.absoluteOffset.y-=e.height:n==mxConstants.ALIGN_BOTTOM&&(e.absoluteOffset.y+=e.height)},mxGraphView.prototype.validatePoints=function(e,n){var t=this.graph.getModel(),a=this.getState(n),i=null;if(null!=a){if(a.invalid){var s=this.graph.getCellGeometry(n);if(null!=s&&t.isEdge(n)){var o=this.getState(this.getVisibleTerminal(n,!0));if(a.setVisibleTerminalState(o,!0),null!=o&&t.isEdge(o.cell)&&!t.isAncestor(o.cell,n)){var r=this.getState(t.getParent(o.cell));this.validatePoints(r,o.cell)}var l=this.getState(this.getVisibleTerminal(n,!1));a.setVisibleTerminalState(l,!1),null!=l&&t.isEdge(l.cell)&&!t.isAncestor(l.cell,n)&&(r=this.getState(t.getParent(l.cell)),this.validatePoints(r,l.cell)),this.updateFixedTerminalPoints(a,o,l),this.updatePoints(a,s.points,o,l),this.updateFloatingTerminalPoints(a,o,l),this.updateEdgeBounds(a),this.updateEdgeLabelOffset(a)}else null!=s&&s.relative&&null!=e&&t.isEdge(e.cell)&&(null!=(s=this.getPoint(e,s))&&(a.x=s.x,a.y=s.y,s.x=s.x/this.scale-this.translate.x,s.y=s.y/this.scale-this.translate.y,a.origin=s,this.childMoved(e,a)));a.invalid=!1,n!=this.currentRoot&&this.graph.cellRenderer.redraw(a,!1,this.isRendering())}(t.isEdge(n)||t.isVertex(n))&&(null!=a.shape&&null!=a.shape.boundingBox&&(i=a.shape.boundingBox.clone()),null!=a.text&&!this.graph.isLabelClipped(a.cell)&&null!=a.text.boundingBox&&(null!=i?i.add(a.text.boundingBox):i=a.text.boundingBox.clone()))}if(null!=a&&(!this.graph.isCellCollapsed(n)||n==this.currentRoot))for(s=t.getChildCount(n),o=0;o<s;o++)r=t.getChildAt(n,o),null!=(r=this.validatePoints(a,r))&&(null==i?i=r:i.add(r));return i},mxGraphView.prototype.childMoved=function(e,n){var t=n.cell;if(!this.graph.isCellCollapsed(t)||t==this.currentRoot)for(var a=this.graph.getModel(),i=a.getChildCount(t),s=0;s<i;s++)this.validateBounds(n,a.getChildAt(t,s))},mxGraphView.prototype.updateFixedTerminalPoints=function(e,n,t){this.updateFixedTerminalPoint(e,n,!0,this.graph.getConnectionConstraint(e,n,!0)),this.updateFixedTerminalPoint(e,t,!1,this.graph.getConnectionConstraint(e,t,!1))},mxGraphView.prototype.updateFixedTerminalPoint=function(e,n,t,a){var i=null;if(null!=a&&(i=this.graph.getConnectionPoint(n,a)),null==i&&null==n){n=this.scale,a=this.translate;var s=e.origin;null!=(i=this.graph.getCellGeometry(e.cell).getTerminalPoint(t))&&(i=new mxPoint(n*(a.x+i.x+s.x),n*(a.y+i.y+s.y)))}e.setAbsoluteTerminalPoint(i,t)},mxGraphView.prototype.updatePoints=function(e,n,t,a){if(null!=e){var i=[];i.push(e.absolutePoints[0]);var s=this.getEdgeStyle(e,n,t,a);if(null!=s)s(e,t=this.getTerminalPort(e,t,!0),a=this.getTerminalPort(e,a,!1),n,i);else if(null!=n)for(s=0;s<n.length;s++)null!=n[s]&&(a=mxUtils.clone(n[s]),i.push(this.transformControlPoint(e,a)));n=e.absolutePoints,i.push(n[n.length-1]),e.absolutePoints=i}},mxGraphView.prototype.transformControlPoint=function(e,n){var t=e.origin;return new mxPoint(this.scale*(n.x+this.translate.x+t.x),this.scale*(n.y+this.translate.y+t.y))},mxGraphView.prototype.getEdgeStyle=function(e,n,t,a){return"string"==typeof(e=null!=t&&t==a?mxUtils.getValue(e.style,mxConstants.STYLE_LOOP,this.graph.defaultLoopStyle):mxUtils.getValue(e.style,mxConstants.STYLE_NOEDGESTYLE,!1)?null:e.style[mxConstants.STYLE_EDGE])&&(null==(n=mxStyleRegistry.getValue(e))&&this.isAllowEval()&&(n=mxUtils.eval(e)),e=n),"function"==typeof e?e:null},mxGraphView.prototype.updateFloatingTerminalPoints=function(e,n,t){var a=e.absolutePoints,i=a[0];null==a[a.length-1]&&null!=t&&this.updateFloatingTerminalPoint(e,t,n,!1),null==i&&null!=n&&this.updateFloatingTerminalPoint(e,n,t,!0)},mxGraphView.prototype.updateFloatingTerminalPoint=function(e,n,t,a){n=this.getTerminalPort(e,n,a);var i=this.getNextPoint(e,t,a),s=this.graph.isOrthogonal(e);t=mxUtils.toRadians(Number(n.style[mxConstants.STYLE_ROTATION]||"0"));var o=new mxPoint(n.getCenterX(),n.getCenterY());if(0!=t){var r=Math.cos(-t),l=Math.sin(-t);i=mxUtils.getRotatedPoint(i,r,l,o)}r=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0),r+=parseFloat(e.style[a?mxConstants.STYLE_SOURCE_PERIMETER_SPACING:mxConstants.STYLE_TARGET_PERIMETER_SPACING]||0),n=this.getPerimeterPoint(n,i,0==t&&s,r),0!=t&&(r=Math.cos(t),l=Math.sin(t),n=mxUtils.getRotatedPoint(n,r,l,o)),e.setAbsoluteTerminalPoint(n,a)},mxGraphView.prototype.getTerminalPort=function(e,n,t){return null!=(e=mxUtils.getValue(e.style,t?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT))&&(null!=(e=this.getState(this.graph.getModel().getCell(e)))&&(n=e)),n},mxGraphView.prototype.getPerimeterPoint=function(e,n,t,a){var i=null;if(null!=e){var s=this.getPerimeterFunction(e);null!=s&&null!=n&&(0<(a=this.getPerimeterBounds(e,a)).width||0<a.height)&&(i=s(a,e,n,t)),null==i&&(i=this.getPoint(e))}return i},mxGraphView.prototype.getRoutingCenterX=function(e){var n=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_X])||0;return e.getCenterX()+n*e.width},mxGraphView.prototype.getRoutingCenterY=function(e){var n=null!=e.style&&parseFloat(e.style[mxConstants.STYLE_ROUTING_CENTER_Y])||0;return e.getCenterY()+n*e.height},mxGraphView.prototype.getPerimeterBounds=function(e,n){return n=null!=n?n:0,null!=e&&(n+=parseFloat(e.style[mxConstants.STYLE_PERIMETER_SPACING]||0)),e.getPerimeterBounds(n*this.scale)},mxGraphView.prototype.getPerimeterFunction=function(e){if("string"==typeof(e=e.style[mxConstants.STYLE_PERIMETER])){var n=mxStyleRegistry.getValue(e);null==n&&this.isAllowEval()&&(n=mxUtils.eval(e)),e=n}return"function"==typeof e?e:null},mxGraphView.prototype.getNextPoint=function(e,n,t){var a=null;return null!=(e=e.absolutePoints)&&(t||2<e.length||null==n)&&(a=e.length,a=e[t?Math.min(1,a-1):Math.max(0,a-2)]),null==a&&null!=n&&(a=new mxPoint(n.getCenterX(),n.getCenterY())),a},mxGraphView.prototype.getVisibleTerminal=function(e,n){for(var t=this.graph.getModel(),a=t.getTerminal(e,n),i=a;null!=a&&a!=this.currentRoot;)this.graph.isCellVisible(i)&&!this.graph.isCellCollapsed(a)||(i=a),a=t.getParent(a);return t.getParent(i)==t.getRoot()&&(i=null),i},mxGraphView.prototype.updateEdgeBounds=function(e){var n=e.absolutePoints;if(e.length=0,null!=n&&0<n.length){var t=n[0],a=n[n.length-1];if(null==t||null==a)e.cell!=this.currentRoot&&this.clear(e.cell,!0);else{if(t.x!=a.x||t.y!=a.y){var i=a.x-t.x,s=a.y-t.y;e.terminalDistance=Math.sqrt(i*i+s*s)}else e.terminalDistance=0;a=0;var o=[];if(null!=(s=t)){t=s.x;for(var r=s.y,l=t,d=r,c=1;c<n.length;c++){var m=n[c];null!=m&&(i=s.x-m.x,s=s.y-m.y,i=Math.sqrt(i*i+s*s),o.push(i),a+=i,s=m,t=Math.min(s.x,t),r=Math.min(s.y,r),l=Math.max(s.x,l),d=Math.max(s.y,d))}e.length=a,e.segments=o,e.x=t,e.y=r,e.width=Math.max(1,l-t),e.height=Math.max(1,d-r)}}}},mxGraphView.prototype.getPoint=function(e,n){var t=e.getCenterX(),a=e.getCenterY();if(null==e.segments||null!=n&&!n.relative)null!=n&&(null!=(d=n.offset)&&(t+=d.x,a+=d.y));else{for(var i=e.absolutePoints.length,s=(.5+(null!=n?n.x/2:0))*e.length,o=e.segments[0],r=0,l=1;r+o<s&&l<i-1;)r+=o,o=e.segments[l++];if(i=0==o?0:(s-r)/o,s=e.absolutePoints[l-1],l=e.absolutePoints[l],null!=s&&null!=l){if(r=t=a=0,null!=n){a=n.y;var d=n.offset;null!=d&&(t=d.x,r=d.y)}d=l.x-s.x,l=l.y-s.y,t=s.x+d*i+((0==o?0:l/o)*a+t)*this.scale,a=s.y+l*i-((0==o?0:d/o)*a-r)*this.scale}}return new mxPoint(t,a)},mxGraphView.prototype.getRelativePoint=function(e,n,t){if(null!=(i=this.graph.getModel().getGeometry(e.cell))){var a=e.absolutePoints.length;if(i.relative&&1<a){for(var i=e.length,s=e.segments,o=e.absolutePoints[0],r=e.absolutePoints[1],l=mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t),d=0,c=0,m=0,u=2;u<a;u++)c+=s[u-2],r=e.absolutePoints[u],(o=mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t))<=l&&(l=o,d=u-1,m=c),o=r;return a=s[d],o=e.absolutePoints[d],l=(r=e.absolutePoints[d+1]).x,s=r.y,s=(l=(e=o.x-l)-(l=n-l))*e+(s=(d=o.y-s)-(s=t-s))*d,a<(e=Math.sqrt(s<=0?0:s*s/(e*e+d*d)))&&(e=a),a=Math.sqrt(mxUtils.ptSegDistSq(o.x,o.y,r.x,r.y,n,t)),-1==mxUtils.relativeCcw(o.x,o.y,r.x,r.y,n,t)&&(a=-a),new mxPoint((i/2-m-e)/i*-2,a/this.scale)}}return new mxPoint},mxGraphView.prototype.updateEdgeLabelOffset=function(e){var n=e.absolutePoints;if(e.absoluteOffset.x=e.getCenterX(),e.absoluteOffset.y=e.getCenterY(),null!=n&&0<n.length&&null!=e.segments)if((i=this.graph.getCellGeometry(e.cell)).relative){null!=(t=this.getPoint(e,i))&&(e.absoluteOffset=t)}else{var t=n[0],a=n[n.length-1];if(null!=t&&null!=a){n=a.x-t.x;var i,s=a.y-t.y,o=a=0;null!=(i=i.offset)&&(a=i.x,o=i.y),i=t.y+s/2+o*this.scale,e.absoluteOffset.x=t.x+n/2+a*this.scale,e.absoluteOffset.y=i}}},mxGraphView.prototype.getState=function(e,n){n=n||!1;var t=null;return null!=e&&(t=this.states.get(e),this.graph.isCellVisible(e)&&(null==t&&n&&this.graph.isCellVisible(e)?(t=this.createState(e),this.states.put(e,t)):n&&null!=t&&this.updateStyle&&(t.style=this.graph.getCellStyle(e)))),t},mxGraphView.prototype.isRendering=function(){return this.rendering},mxGraphView.prototype.setRendering=function(e){this.rendering=e},mxGraphView.prototype.isAllowEval=function(){return this.allowEval},mxGraphView.prototype.setAllowEval=function(e){this.allowEval=e},mxGraphView.prototype.getStates=function(){return this.states},mxGraphView.prototype.setStates=function(e){this.states=e},mxGraphView.prototype.getCellStates=function(e){if(null==e)return this.states;for(var n=[],t=0;t<e.length;t++){var a=this.getState(e[t]);null!=a&&n.push(a)}return n},mxGraphView.prototype.removeState=function(e){var n=null;return null!=e&&(null!=(n=this.states.remove(e))&&(this.graph.cellRenderer.destroy(n),n.destroy())),n},mxGraphView.prototype.createState=function(e){var n=this.graph.getCellStyle(e);return e=new mxCellState(this,e,n),this.graph.cellRenderer.initialize(e,this.isRendering()),e},mxGraphView.prototype.getCanvas=function(){return this.canvas},mxGraphView.prototype.getBackgroundPane=function(){return this.backgroundPane},mxGraphView.prototype.getDrawPane=function(){return this.drawPane},mxGraphView.prototype.getOverlayPane=function(){return this.overlayPane},mxGraphView.prototype.isContainerEvent=function(e){return(e=mxEvent.getSource(e))==this.graph.container||e.parentNode==this.backgroundPane||null!=e.parentNode&&e.parentNode.parentNode==this.backgroundPane||e==this.canvas.parentNode||e==this.canvas||e==this.backgroundPane||e==this.drawPane||e==this.overlayPane},mxGraphView.prototype.isScrollEvent=function(e){var n=mxUtils.getOffset(this.graph.container);e=new mxPoint(e.clientX-n.x,e.clientY-n.y);n=this.graph.container.offsetWidth;var t=this.graph.container.clientWidth;return t<n&&e.x>t+2&&e.x<=n||(n=this.graph.container.offsetHeight,(t=this.graph.container.clientHeight)<n&&e.y>t+2&&e.y<=n)},mxGraphView.prototype.init=function(){this.installListeners();var e=this.graph;e.dialect==mxConstants.DIALECT_SVG?this.createSvg():e.dialect==mxConstants.DIALECT_VML?this.createVml():this.createHtml()},mxGraphView.prototype.installListeners=function(){var a=this.graph,i=a.container;if(null!=i){mxEvent.addGestureListeners(i,mxUtils.bind(this,function(e){mxClient.IS_TOUCH&&a.isEditing()&&a.stopEditing(!a.isInvokesStopCellEditing()),this.isContainerEvent(e)&&(!mxClient.IS_IE&&!mxClient.IS_GC&&!mxClient.IS_OP&&!mxClient.IS_SF||!this.isScrollEvent(e))&&a.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.isContainerEvent(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.isContainerEvent(e)&&a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))})),mxEvent.addListener(i,"dblclick",mxUtils.bind(this,function(e){a.dblClick(e)}));a.addMouseListener({mouseDown:function(e,n){a.panningHandler.hideMenu()},mouseMove:function(){},mouseUp:function(){}}),this.moveHandler=mxUtils.bind(this,function(e){var n,t;null!=a.tooltipHandler&&a.tooltipHandler.isHideOnHover()&&a.tooltipHandler.hide(),this.captureDocumentGesture&&a.isMouseDown&&!mxEvent.isConsumed(e)&&a.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,(n=e,t=null,mxClient.IS_TOUCH&&(t=mxEvent.getClientX(n),n=mxEvent.getClientY(n),n=mxUtils.convertPoint(i,t,n),t=a.view.getState(a.getCellAt(n.x,n.y))),t)))}),this.endHandler=mxUtils.bind(this,function(e){this.captureDocumentGesture&&a.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}),mxEvent.addGestureListeners(document,null,this.moveHandler,this.endHandler)}},mxGraphView.prototype.createHtml=function(){var e=this.graph.container;null!=e&&(this.canvas=this.createHtmlPane("100%","100%"),this.backgroundPane=this.createHtmlPane("1px","1px"),this.drawPane=this.createHtmlPane("1px","1px"),this.overlayPane=this.createHtmlPane("1px","1px"),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas),mxClient.IS_QUIRKS&&(e=mxUtils.bind(this,function(e){e=this.getGraphBounds(),this.updateHtmlCanvasSize(e.x+e.width+this.graph.border,e.y+e.height+this.graph.border)}),mxEvent.addListener(window,"resize",e)))},mxGraphView.prototype.updateHtmlCanvasSize=function(e,n){if(null!=this.graph.container){var t=this.graph.container.offsetHeight;this.canvas.style.width=this.graph.container.offsetWidth<e?e+"px":"100%",this.canvas.style.height=t<n?n+"px":"100%"}},mxGraphView.prototype.createHtmlPane=function(e,n){var t=document.createElement("DIV");return null!=e&&null!=n?(t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=e,t.style.height=n):t.style.position="relative",t},mxGraphView.prototype.createVml=function(){var e=this.graph.container;if(null!=e){var n=e.offsetWidth,t=e.offsetHeight;this.canvas=this.createVmlPane(n,t),this.backgroundPane=this.createVmlPane(n,t),this.drawPane=this.createVmlPane(n,t),this.overlayPane=this.createVmlPane(n,t),this.canvas.appendChild(this.backgroundPane),this.canvas.appendChild(this.drawPane),this.canvas.appendChild(this.overlayPane),e.appendChild(this.canvas)}},mxGraphView.prototype.createVmlPane=function(e,n){var t=document.createElement(mxClient.VML_PREFIX+":group");return t.style.position="absolute",t.style.left="0px",t.style.top="0px",t.style.width=e+"px",t.style.height=n+"px",t.setAttribute("coordsize",e+","+n),t.setAttribute("coordorigin","0,0"),t},mxGraphView.prototype.createSvg=function(){var e=this.graph.container;this.canvas=document.createElementNS(mxConstants.NS_SVG,"g"),this.backgroundPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.backgroundPane),this.drawPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.drawPane),this.overlayPane=document.createElementNS(mxConstants.NS_SVG,"g"),this.canvas.appendChild(this.overlayPane);var n=document.createElementNS(mxConstants.NS_SVG,"svg");n.style.width="100%",n.style.height="100%",n.style.display="block",n.appendChild(this.canvas),null!=e&&(e.appendChild(n),"static"==mxUtils.getCurrentStyle(e).position&&(e.style.position="relative"))},mxGraphView.prototype.destroy=function(){var e=null!=this.canvas?this.canvas.ownerSVGElement:null;null==e&&(e=this.canvas),null!=e&&null!=e.parentNode&&(this.clear(this.currentRoot,!0),mxEvent.removeGestureListeners(document,null,this.moveHandler,this.endHandler),mxEvent.release(this.graph.container),e.parentNode.removeChild(e),this.overlayPane=this.drawPane=this.backgroundPane=this.canvas=this.endHandler=this.moveHandler=null)},mxCurrentRootChange.prototype.execute=function(){var e=this.view.currentRoot;this.view.currentRoot=this.previous,this.previous=e,null!=(e=this.view.graph.getTranslateForRoot(this.view.currentRoot))&&(this.view.translate=new mxPoint(-e.x,-e.y)),this.view.fireEvent(new mxEventObject(this.isUp?mxEvent.UP:mxEvent.DOWN,"root",this.view.currentRoot,"previous",this.previous)),this.isUp?(this.view.clear(this.view.currentRoot,!0),this.view.validate()):this.view.refresh(),this.isUp=!this.isUp},mxLoadResources&&mxResources.add(mxClient.basePath+"/resources/graph"),mxGraph.prototype=new mxEventSource,mxGraph.prototype.constructor=mxGraph,mxGraph.prototype.EMPTY_ARRAY=[],mxGraph.prototype.mouseListeners=null,mxGraph.prototype.isMouseDown=!1,mxGraph.prototype.model=null,mxGraph.prototype.view=null,mxGraph.prototype.stylesheet=null,mxGraph.prototype.selectionModel=null,mxGraph.prototype.cellEditor=null,mxGraph.prototype.cellRenderer=null,mxGraph.prototype.multiplicities=null,mxGraph.prototype.renderHint=null,mxGraph.prototype.dialect=null,mxGraph.prototype.gridSize=10,mxGraph.prototype.gridEnabled=!0,mxGraph.prototype.portsEnabled=!0,mxGraph.prototype.doubleTapEnabled=!0,mxGraph.prototype.doubleTapTimeout=700,mxGraph.prototype.doubleTapTolerance=25,mxGraph.prototype.lastTouchY=0,mxGraph.prototype.lastTouchY=0,mxGraph.prototype.lastTouchTime=0,mxGraph.prototype.gestureEnabled=!0,mxGraph.prototype.tolerance=4,mxGraph.prototype.defaultOverlap=.5,mxGraph.prototype.defaultParent=null,mxGraph.prototype.alternateEdgeStyle=null,mxGraph.prototype.backgroundImage=null,mxGraph.prototype.pageVisible=!1,mxGraph.prototype.pageBreaksVisible=!1,mxGraph.prototype.pageBreakColor="gray",mxGraph.prototype.pageBreakDashed=!0,mxGraph.prototype.minPageBreakDist=20,mxGraph.prototype.preferPageSize=!1,mxGraph.prototype.pageFormat=mxConstants.PAGE_FORMAT_A4_PORTRAIT,mxGraph.prototype.pageScale=1.5,mxGraph.prototype.enabled=!0,mxGraph.prototype.escapeEnabled=!0,mxGraph.prototype.invokesStopCellEditing=!0,mxGraph.prototype.enterStopsCellEditing=!1,mxGraph.prototype.useScrollbarsForPanning=!0,mxGraph.prototype.exportEnabled=!0,mxGraph.prototype.importEnabled=!0,mxGraph.prototype.cellsLocked=!1,mxGraph.prototype.cellsCloneable=!0,mxGraph.prototype.foldingEnabled=!0,mxGraph.prototype.cellsEditable=!0,mxGraph.prototype.cellsDeletable=!0,mxGraph.prototype.cellsMovable=!0,mxGraph.prototype.edgeLabelsMovable=!0,mxGraph.prototype.vertexLabelsMovable=!1,mxGraph.prototype.dropEnabled=!1,mxGraph.prototype.splitEnabled=!0,mxGraph.prototype.cellsResizable=!0,mxGraph.prototype.cellsBendable=!0,mxGraph.prototype.cellsSelectable=!0,mxGraph.prototype.cellsDisconnectable=!0,mxGraph.prototype.autoSizeCells=!1,mxGraph.prototype.autoScroll=!0,mxGraph.prototype.timerAutoScroll=!1,mxGraph.prototype.allowAutoPanning=!1,mxGraph.prototype.ignoreScrollbars=!1,mxGraph.prototype.autoExtend=!0,mxGraph.prototype.maximumGraphBounds=null,mxGraph.prototype.minimumGraphSize=null,mxGraph.prototype.minimumContainerSize=null,mxGraph.prototype.maximumContainerSize=null,mxGraph.prototype.resizeContainer=!1,mxGraph.prototype.border=0,mxGraph.prototype.ordered=!0,mxGraph.prototype.keepEdgesInForeground=!1,mxGraph.prototype.keepEdgesInBackground=!0,mxGraph.prototype.allowNegativeCoordinates=!0,mxGraph.prototype.constrainChildren=!0,mxGraph.prototype.extendParents=!0,mxGraph.prototype.extendParentsOnAdd=!0,mxGraph.prototype.collapseToPreferredSize=!0,mxGraph.prototype.zoomFactor=1.2,mxGraph.prototype.keepSelectionVisibleOnZoom=!1,mxGraph.prototype.centerZoom=!0,mxGraph.prototype.resetViewOnRootChange=!0,mxGraph.prototype.resetEdgesOnResize=!1,mxGraph.prototype.resetEdgesOnMove=!1,mxGraph.prototype.resetEdgesOnConnect=!0,mxGraph.prototype.allowLoops=!1,mxGraph.prototype.defaultLoopStyle=mxEdgeStyle.Loop,mxGraph.prototype.multigraph=!0,mxGraph.prototype.connectableEdges=!1,mxGraph.prototype.allowDanglingEdges=!0,mxGraph.prototype.cloneInvalidEdges=!1,mxGraph.prototype.disconnectOnMove=!0,mxGraph.prototype.labelsVisible=!0,mxGraph.prototype.htmlLabels=!1,mxGraph.prototype.swimlaneSelectionEnabled=!0,mxGraph.prototype.swimlaneNesting=!0,mxGraph.prototype.swimlaneIndicatorColorAttribute=mxConstants.STYLE_FILLCOLOR,mxGraph.prototype.imageBundles=null,mxGraph.prototype.minFitScale=.1,mxGraph.prototype.maxFitScale=8,mxGraph.prototype.panDx=0,mxGraph.prototype.panDy=0,mxGraph.prototype.collapsedImage=new mxImage(mxClient.imageBasePath+"/collapsed.gif",9,9),mxGraph.prototype.expandedImage=new mxImage(mxClient.imageBasePath+"/expanded.gif",9,9),mxGraph.prototype.warningImage=new mxImage("/assets/plugins/mxgraph/images/warning.gif",16,16),mxGraph.prototype.alreadyConnectedResource="none"!=mxClient.language?"alreadyConnected":"",mxGraph.prototype.containsValidationErrorsResource="none"!=mxClient.language?"containsValidationErrors":"",mxGraph.prototype.collapseExpandResource="none"!=mxClient.language?"collapse-expand":"",mxGraph.prototype.init=function(e){this.container=e,this.cellEditor=this.createCellEditor(),this.view.init(),this.sizeDidChange(),mxClient.IS_IE&&(mxEvent.addListener(window,"unload",mxUtils.bind(this,function(){this.destroy()})),mxEvent.addListener(e,"selectstart",mxUtils.bind(this,function(){return this.isEditing()}))),8==document.documentMode&&e.insertAdjacentHTML("beforeend",'<v:group style="DISPLAY: none;"></v:group>')},mxGraph.prototype.createHandlers=function(e){this.tooltipHandler=new mxTooltipHandler(this),this.tooltipHandler.setEnabled(!1),this.panningHandler=new mxPanningHandler(this),this.panningHandler.panningEnabled=!1,this.selectionCellsHandler=new mxSelectionCellsHandler(this),this.connectionHandler=new mxConnectionHandler(this),this.connectionHandler.setEnabled(!1),this.graphHandler=new mxGraphHandler(this)},mxGraph.prototype.createSelectionModel=function(){return new mxGraphSelectionModel(this)},mxGraph.prototype.createStylesheet=function(){return new mxStylesheet},mxGraph.prototype.createGraphView=function(){return new mxGraphView(this)},mxGraph.prototype.createCellRenderer=function(){return new mxCellRenderer},mxGraph.prototype.createCellEditor=function(){return new mxCellEditor(this)},mxGraph.prototype.getModel=function(){return this.model},mxGraph.prototype.getView=function(){return this.view},mxGraph.prototype.getStylesheet=function(){return this.stylesheet},mxGraph.prototype.setStylesheet=function(e){this.stylesheet=e},mxGraph.prototype.getSelectionModel=function(){return this.selectionModel},mxGraph.prototype.setSelectionModel=function(e){this.selectionModel=e},mxGraph.prototype.getSelectionCellsForChanges=function(e){for(var n=[],t=0;t<e.length;t++){var a=e[t];if(a.constructor!=mxRootChange){var i=null;a instanceof mxChildChange&&null==a.previous?i=a.child:null!=a.cell&&a.cell instanceof mxCell&&(i=a.cell),null!=i&&mxUtils.indexOf(n,i)<0&&n.push(i)}}return this.getModel().getTopmostCells(n)},mxGraph.prototype.graphModelChanged=function(e){for(var n=0;n<e.length;n++)this.processChange(e[n]);this.removeSelectionCells(this.getRemovedCellsForChanges(e)),this.view.validate(),this.sizeDidChange()},mxGraph.prototype.getRemovedCellsForChanges=function(e){for(var n=[],t=0;t<e.length;t++){var a=e[t];if(a instanceof mxRootChange)break;a instanceof mxChildChange?null!=a.previous&&null==a.parent&&(n=n.concat(this.model.getDescendants(a.child))):a instanceof mxVisibleChange&&(n=n.concat(this.model.getDescendants(a.cell)))}return n},mxGraph.prototype.processChange=function(e){if(e instanceof mxRootChange)this.clearSelection(),this.removeStateForCell(e.previous),this.resetViewOnRootChange&&(this.view.scale=1,this.view.translate.x=0,this.view.translate.y=0),this.fireEvent(new mxEventObject(mxEvent.ROOT));else if(e instanceof mxChildChange){var n=this.model.getParent(e.child);null!=n?this.view.invalidate(e.child,!0,!1,null!=e.previous):(this.removeStateForCell(e.child),this.view.currentRoot==e.child&&this.home()),n!=e.previous&&(null!=n&&this.view.invalidate(n,!1,!1),null!=e.previous&&this.view.invalidate(e.previous,!1,!1))}else e instanceof mxTerminalChange||e instanceof mxGeometryChange?this.view.invalidate(e.cell):e instanceof mxValueChange?this.view.invalidate(e.cell,!1,!1):e instanceof mxStyleChange?(this.view.invalidate(e.cell,!0,!0,!1),this.view.removeState(e.cell)):null!=e.cell&&e.cell instanceof mxCell&&this.removeStateForCell(e.cell)},mxGraph.prototype.removeStateForCell=function(e){for(var n=this.model.getChildCount(e),t=0;t<n;t++)this.removeStateForCell(this.model.getChildAt(e,t));this.view.removeState(e)},mxGraph.prototype.addCellOverlay=function(e,n){null==e.overlays&&(e.overlays=[]),e.overlays.push(n);var t=this.view.getState(e);return null!=t&&this.cellRenderer.redraw(t),this.fireEvent(new mxEventObject(mxEvent.ADD_OVERLAY,"cell",e,"overlay",n)),n},mxGraph.prototype.getCellOverlays=function(e){return e.overlays},mxGraph.prototype.removeCellOverlay=function(e,n){if(null==n)this.removeCellOverlays(e);else{var t=mxUtils.indexOf(e.overlays,n);0<=t?(e.overlays.splice(t,1),0==e.overlays.length&&(e.overlays=null),null!=(t=this.view.getState(e))&&this.cellRenderer.redraw(t),this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",n))):n=null}return n},mxGraph.prototype.removeCellOverlays=function(e){var n=e.overlays;if(null!=n){e.overlays=null;var t=this.view.getState(e);for(null!=t&&this.cellRenderer.redraw(t),t=0;t<n.length;t++)this.fireEvent(new mxEventObject(mxEvent.REMOVE_OVERLAY,"cell",e,"overlay",n[t]))}return n},mxGraph.prototype.clearCellOverlays=function(e){e=null!=e?e:this.model.getRoot(),this.removeCellOverlays(e);for(var n=this.model.getChildCount(e),t=0;t<n;t++){var a=this.model.getChildAt(e,t);this.clearCellOverlays(a)}},mxGraph.prototype.setCellWarning=function(t,e,n,a){return null!=e&&0<e.length?(e=new mxCellOverlay(n=null!=n?n:this.warningImage,"<font color=red>"+e+"</font>"),a&&e.addListener(mxEvent.CLICK,mxUtils.bind(this,function(e,n){this.isEnabled()&&this.setSelectionCell(t)})),this.addCellOverlay(t,e)):(this.removeCellOverlays(t),null)},mxGraph.prototype.startEditing=function(e){this.startEditingAtCell(null,e)},mxGraph.prototype.startEditingAtCell=function(e,n){null==e&&(null!=(e=this.getSelectionCell())&&!this.isCellEditable(e)&&(e=null)),null!=e&&(this.fireEvent(new mxEventObject(mxEvent.START_EDITING,"cell",e,"event",n)),this.cellEditor.startEditing(e,n))},mxGraph.prototype.getEditingValue=function(e,n){return this.convertValueToString(e)},mxGraph.prototype.stopEditing=function(e){this.cellEditor.stopEditing(e)},mxGraph.prototype.labelChanged=function(e,n,t){this.model.beginUpdate();try{this.cellLabelChanged(e,n,this.isAutoSizeCell(e)),this.fireEvent(new mxEventObject(mxEvent.LABEL_CHANGED,"cell",e,"value",n,"event",t))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellLabelChanged=function(e,n,t){this.model.beginUpdate();try{this.model.setValue(e,n),t&&this.cellSizeUpdated(e,!1)}finally{this.model.endUpdate()}},mxGraph.prototype.escape=function(e){this.stopEditing(!0),this.connectionHandler.reset(),this.graphHandler.reset(),e=this.getSelectionCells();for(var n=0;n<e.length;n++){var t=this.view.getState(e[n]);null!=t&&null!=t.handler&&t.handler.reset()}},mxGraph.prototype.click=function(e){var n=e.getEvent(),t=e.getCell(),a=new mxEventObject(mxEvent.CLICK,"event",n,"cell",t);e.isConsumed()&&a.consume(),this.fireEvent(a),this.isEnabled()&&!mxEvent.isConsumed(n)&&!a.isConsumed()&&(null!=t?this.selectCellForEvent(t,n):(t=null,this.isSwimlaneSelectionEnabled()&&(t=this.getSwimlaneAt(e.getGraphX(),e.getGraphY())),null!=t?this.selectCellForEvent(t,n):this.isToggleEvent(n)||this.clearSelection()))},mxGraph.prototype.dblClick=function(e,n){var t=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",n);this.fireEvent(t),this.isEnabled()&&!mxEvent.isConsumed(e)&&!t.isConsumed()&&null!=n&&this.isCellEditable(n)&&this.startEditingAtCell(n,e)},mxGraph.prototype.scrollPointToVisible=function(e,n,t,a){if(this.timerAutoScroll||!this.ignoreScrollbars&&!mxUtils.hasScrollbars(this.container))this.allowAutoPanning&&!this.panningHandler.active&&(null==this.panningManager&&(this.panningManager=this.createPanningManager()),this.panningManager.panTo(e+this.panDx,n+this.panDy));else{var i=this.container;if(a=null!=a?a:20,e>=i.scrollLeft&&n>=i.scrollTop&&e<=i.scrollLeft+i.clientWidth&&n<=i.scrollTop+i.clientHeight){var s=i.scrollLeft+i.clientWidth-e;if(s<a){if(e=i.scrollLeft,i.scrollLeft+=a-s,t&&e==i.scrollLeft){if(this.dialect==mxConstants.DIALECT_SVG){e=this.view.getDrawPane().ownerSVGElement;var o=this.container.scrollWidth+a-s}else o=Math.max(i.clientWidth,i.scrollWidth)+a-s,e=this.view.getCanvas();e.style.width=o+"px",i.scrollLeft+=a-s}}else(s=e-i.scrollLeft)<a&&(i.scrollLeft-=a-s);(s=i.scrollTop+i.clientHeight-n)<a?(e=i.scrollTop,i.scrollTop+=a-s,e==i.scrollTop&&t&&(this.dialect==mxConstants.DIALECT_SVG?(e=this.view.getDrawPane().ownerSVGElement,n=this.container.scrollHeight+a-s):(n=Math.max(i.clientHeight,i.scrollHeight)+a-s,e=this.view.getCanvas()),e.style.height=n+"px",i.scrollTop+=a-s)):(s=n-i.scrollTop)<a&&(i.scrollTop-=a-s)}}},mxGraph.prototype.createPanningManager=function(){return new mxPanningManager(this)},mxGraph.prototype.getBorderSizes=function(){function e(e){var n=0;n="thin"==e?2:"medium"==e?4:"thick"==e?6:parseInt(e);return isNaN(n)&&(n=0),n}var n=mxUtils.getCurrentStyle(this.container),t=new mxRectangle;return t.x=e(n.borderLeftWidth)+parseInt(n.paddingLeft||0),t.y=e(n.borderTopWidth)+parseInt(n.paddingTop||0),t.width=e(n.borderRightWidth)+parseInt(n.paddingRight||0),t.height=e(n.borderBottomWidth)+parseInt(n.paddingBottom||0),t},mxGraph.prototype.getPreferredPageSize=function(e,n,t){e=this.view.scale;var a=this.view.translate,i=this.pageFormat,s=e*this.pageScale;i=new mxRectangle(0,0,i.width*s,i.height*s);return n=this.pageBreaksVisible?Math.ceil(n/i.width):1,t=this.pageBreaksVisible?Math.ceil(t/i.height):1,new mxRectangle(0,0,n*i.width+2+a.x/e,t*i.height+2+a.y/e)},mxGraph.prototype.sizeDidChange=function(){var e=this.getGraphBounds();if(null!=this.container){var n=this.getBorder(),t=Math.max(0,e.x+e.width+1+n);n=Math.max(0,e.y+e.height+1+n);if(null!=this.minimumContainerSize&&(t=Math.max(t,this.minimumContainerSize.width),n=Math.max(n,this.minimumContainerSize.height)),this.resizeContainer&&this.doResizeContainer(t,n),this.preferPageSize||!mxClient.IS_IE&&this.pageVisible){var a=this.getPreferredPageSize(e,t,n);null!=a&&(t=a.width,n=a.height)}null!=this.minimumGraphSize&&(t=Math.max(t,this.minimumGraphSize.width*this.view.scale),n=Math.max(n,this.minimumGraphSize.height*this.view.scale)),t=Math.ceil(t-1),n=Math.ceil(n-1),this.dialect==mxConstants.DIALECT_SVG?((a=this.view.getDrawPane().ownerSVGElement).style.minWidth=Math.max(1,t)+"px",a.style.minHeight=Math.max(1,n)+"px",a.style.width="100%",a.style.height="100%"):mxClient.IS_QUIRKS?this.view.updateHtmlCanvasSize(Math.max(1,t),Math.max(1,n)):(this.view.canvas.style.minWidth=Math.max(1,t)+"px",this.view.canvas.style.minHeight=Math.max(1,n)+"px"),this.updatePageBreaks(this.pageBreaksVisible,t-1,n-1)}this.fireEvent(new mxEventObject(mxEvent.SIZE,"bounds",e))},mxGraph.prototype.doResizeContainer=function(e,n){if(mxClient.IS_IE)if(mxClient.IS_QUIRKS){var t=this.getBorderSizes();e+=Math.max(2,t.x+t.width+1),n+=Math.max(2,t.y+t.height+1)}else 9<=document.documentMode?(e+=3,n+=5):(e+=1,n+=1);else n+=1;null!=this.maximumContainerSize&&(e=Math.min(this.maximumContainerSize.width,e),n=Math.min(this.maximumContainerSize.height,n)),this.container.style.width=Math.ceil(e)+"px",this.container.style.height=Math.ceil(n)+"px"},mxGraph.prototype.updatePageBreaks=function(e,n,t){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale;i=new mxRectangle(a*i.x,a*i.y,s.width*o,s.height*o);if(e=e&&Math.min(i.width,i.height)>this.minPageBreakDist,i.x=mxUtils.mod(i.x,i.width),i.y=mxUtils.mod(i.y,i.height),s=e?Math.ceil((n-i.x)/i.width):0,e=e?Math.ceil((t-i.y)/i.height):0,null==this.horizontalPageBreaks&&0<s&&(this.horizontalPageBreaks=[]),null!=this.horizontalPageBreaks){for(o=0;o<=s;o++){var r=[new mxPoint(i.x+o*i.width,1),new mxPoint(i.x+o*i.width,t)];null!=this.horizontalPageBreaks[o]?(this.horizontalPageBreaks[o].scale=1,this.horizontalPageBreaks[o].points=r,this.horizontalPageBreaks[o].redraw()):((r=new mxPolyline(r,this.pageBreakColor,this.scale)).dialect=this.dialect,r.isDashed=this.pageBreakDashed,r.scale=a,r.init(this.view.backgroundPane),r.redraw(),this.horizontalPageBreaks[o]=r)}for(o=s;o<this.horizontalPageBreaks.length;o++)this.horizontalPageBreaks[o].destroy();this.horizontalPageBreaks.splice(s,this.horizontalPageBreaks.length-s)}if(null==this.verticalPageBreaks&&0<e&&(this.verticalPageBreaks=[]),null!=this.verticalPageBreaks){for(o=0;o<=e;o++)r=[new mxPoint(1,i.y+o*i.height),new mxPoint(n,i.y+o*i.height)],null!=this.verticalPageBreaks[o]?(this.verticalPageBreaks[o].scale=1,this.verticalPageBreaks[o].points=r,this.verticalPageBreaks[o].redraw()):((r=new mxPolyline(r,this.pageBreakColor,a)).dialect=this.dialect,r.isDashed=this.pageBreakDashed,r.scale=a,r.init(this.view.backgroundPane),r.redraw(),this.verticalPageBreaks[o]=r);for(o=e;o<this.verticalPageBreaks.length;o++)this.verticalPageBreaks[o].destroy();this.verticalPageBreaks.splice(e,this.verticalPageBreaks.length-e)}},mxGraph.prototype.getCellStyle=function(e){var n=this.model.getStyle(e),t=null;t=this.model.isEdge(e)?this.stylesheet.getDefaultEdgeStyle():this.stylesheet.getDefaultVertexStyle();return null!=n&&(t=this.postProcessCellStyle(this.stylesheet.getCellStyle(n,t))),null==t&&(t=mxGraph.prototype.EMPTY_ARRAY),t},mxGraph.prototype.postProcessCellStyle=function(e){if(null!=e){var n=e[mxConstants.STYLE_IMAGE],t=this.getImageFromBundles(n);null!=t?e[mxConstants.STYLE_IMAGE]=t:t=n,null!=t&&"data:image/"==t.substring(0,11)&&(0<(n=t.indexOf(","))&&(t=t.substring(0,n)+";base64,"+t.substring(n+1)),e[mxConstants.STYLE_IMAGE]=t)}return e},mxGraph.prototype.setCellStyle=function(e,n){if(null!=(n=n||this.getSelectionCells())){this.model.beginUpdate();try{for(var t=0;t<n.length;t++)this.model.setStyle(n[t],e)}finally{this.model.endUpdate()}}},mxGraph.prototype.toggleCellStyle=function(e,n,t){t=t||this.getSelectionCell(),this.toggleCellStyles(e,n,[t])},mxGraph.prototype.toggleCellStyles=function(e,n,t){var a;(n=null!=n&&n,null!=(t=t||this.getSelectionCells())&&0<t.length)&&(null!=(a=null!=(a=this.view.getState(t[0]))?a.style:this.getCellStyle(t[0]))&&(n=mxUtils.getValue(a,e,n)?0:1,this.setCellStyles(e,n,t)))},mxGraph.prototype.setCellStyles=function(e,n,t){t=t||this.getSelectionCells(),mxUtils.setCellStyles(this.model,t,e,n)},mxGraph.prototype.toggleCellStyleFlags=function(e,n,t){this.setCellStyleFlags(e,n,null,t)},mxGraph.prototype.setCellStyleFlags=function(e,n,t,a){if(null!=(a=a||this.getSelectionCells())&&0<a.length){var i;if(null==t)null!=(i=null!=(i=this.view.getState(a[0]))?i.style:this.getCellStyle(a[0]))&&(t=(parseInt(i[e]||0)&n)!=n);mxUtils.setCellStyleFlags(this.model,a,e,n,t)}},mxGraph.prototype.alignCells=function(e,n,t){if(null==n&&(n=this.getSelectionCells()),null!=n&&1<n.length){if(null==t)for(var a=0;a<n.length;a++){var i=this.getCellGeometry(n[a]);if(null!=i&&!this.model.isEdge(n[a]))if(null==t){if(e==mxConstants.ALIGN_CENTER){t=i.x+i.width/2;break}if(e==mxConstants.ALIGN_RIGHT)t=i.x+i.width;else if(e==mxConstants.ALIGN_TOP)t=i.y;else{if(e==mxConstants.ALIGN_MIDDLE){t=i.y+i.height/2;break}t=e==mxConstants.ALIGN_BOTTOM?i.y+i.height:i.x}}else t=e==mxConstants.ALIGN_RIGHT?Math.max(t,i.x+i.width):e==mxConstants.ALIGN_TOP?Math.min(t,i.y):e==mxConstants.ALIGN_BOTTOM?Math.max(t,i.y+i.height):Math.min(t,i.x)}if(null!=t){this.model.beginUpdate();try{for(a=0;a<n.length;a++)null!=(i=this.getCellGeometry(n[a]))&&!this.model.isEdge(n[a])&&(i=i.clone(),e==mxConstants.ALIGN_CENTER?i.x=t-i.width/2:e==mxConstants.ALIGN_RIGHT?i.x=t-i.width:e==mxConstants.ALIGN_TOP?i.y=t:e==mxConstants.ALIGN_MIDDLE?i.y=t-i.height/2:e==mxConstants.ALIGN_BOTTOM?i.y=t-i.height:i.x=t,this.model.setGeometry(n[a],i));this.fireEvent(new mxEventObject(mxEvent.ALIGN_CELLS,"align",e,"cells",n))}finally{this.model.endUpdate()}}}return n},mxGraph.prototype.flipEdge=function(e){if(null!=e&&null!=this.alternateEdgeStyle){this.model.beginUpdate();try{var n=this.model.getStyle(e);null==n||0==n.length?this.model.setStyle(e,this.alternateEdgeStyle):this.model.setStyle(e,null),this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.FLIP_EDGE,"edge",e))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.addImageBundle=function(e){this.imageBundles.push(e)},mxGraph.prototype.removeImageBundle=function(e){for(var n=[],t=0;t<this.imageBundles.length;t++)this.imageBundles[t]!=e&&n.push(this.imageBundles[t]);this.imageBundles=n},mxGraph.prototype.getImageFromBundles=function(e){if(null!=e)for(var n=0;n<this.imageBundles.length;n++){var t=this.imageBundles[n].getImage(e);if(null!=t)return t}return null},mxGraph.prototype.orderCells=function(e,n){null==n&&(n=mxUtils.sortCells(this.getSelectionCells(),!0)),this.model.beginUpdate();try{this.cellsOrdered(n,e),this.fireEvent(new mxEventObject(mxEvent.ORDER_CELLS,"back",e,"cells",n))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsOrdered=function(e,n){if(null!=e){this.model.beginUpdate();try{for(var t=0;t<e.length;t++){var a=this.model.getParent(e[t]);n?this.model.add(a,e[t],t):this.model.add(a,e[t],this.model.getChildCount(a)-1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ORDERED,"back",n,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.groupCells=function(e,n,t){null==t&&(t=mxUtils.sortCells(this.getSelectionCells(),!0)),t=this.getCellsForGroup(t),null==e&&(e=this.createGroupCell(t));var a=this.getBoundsForGroup(e,t,n);if(0<t.length&&null!=a){var i=this.model.getParent(e);null==i&&(i=this.model.getParent(t[0])),this.model.beginUpdate();try{null==this.getCellGeometry(e)&&this.model.setGeometry(e,new mxGeometry);var s=this.model.getChildCount(i);this.cellsAdded([e],i,s,null,null,!1),s=this.model.getChildCount(e),this.cellsAdded(t,e,s,null,null,!1,!1),this.cellsMoved(t,-a.x,-a.y,!1,!0),this.cellsResized([e],[a]),this.fireEvent(new mxEventObject(mxEvent.GROUP_CELLS,"group",e,"border",n,"cells",t))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.getCellsForGroup=function(e){var n=[];if(null!=e&&0<e.length){var t=this.model.getParent(e[0]);n.push(e[0]);for(var a=1;a<e.length;a++)this.model.getParent(e[a])==t&&n.push(e[a])}return n},mxGraph.prototype.getBoundsForGroup=function(e,n,t){return null!=(n=this.getBoundingBoxFromGeometry(n))&&(this.isSwimlane(e)&&(e=this.getStartSize(e),n.x-=e.width,n.y-=e.height,n.width+=e.width,n.height+=e.height),n.x-=t,n.y-=t,n.width+=2*t,n.height+=2*t),n},mxGraph.prototype.createGroupCell=function(e){return(e=new mxCell("")).setVertex(!0),e.setConnectable(!1),e},mxGraph.prototype.ungroupCells=function(e){var n=[];if(null==e){e=this.getSelectionCells();for(var t=[],a=0;a<e.length;a++)0<this.model.getChildCount(e[a])&&t.push(e[a]);e=t}if(null!=e&&0<e.length){this.model.beginUpdate();try{for(a=0;a<e.length;a++){if(null!=(i=this.model.getChildren(e[a]))&&0<i.length){var i=i.slice(),s=this.model.getParent(e[a]),o=this.model.getChildCount(s);this.cellsAdded(i,s,o,null,null,!0),n=n.concat(i)}}this.cellsRemoved(this.addAllEdges(e)),this.fireEvent(new mxEventObject(mxEvent.UNGROUP_CELLS,"cells",e))}finally{this.model.endUpdate()}}return n},mxGraph.prototype.removeCellsFromParent=function(e){null==e&&(e=this.getSelectionCells()),this.model.beginUpdate();try{var n=this.getDefaultParent(),t=this.model.getChildCount(n);this.cellsAdded(e,n,t,null,null,!0),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS_FROM_PARENT,"cells",e))}finally{this.model.endUpdate()}return e},mxGraph.prototype.updateGroupBounds=function(e,n,t){null==e&&(e=this.getSelectionCells()),n=null!=n?n:0,t=null!=t&&t,this.model.beginUpdate();try{for(var a=0;a<e.length;a++){if(null!=(r=this.getCellGeometry(e[a]))){var i=this.getChildCells(e[a]);if(null!=i&&0<i.length){var s=this.getBoundingBoxFromGeometry(i);if(0<s.width&&0<s.height){var o=this.isSwimlane(e[a])?this.getStartSize(e[a]):new mxRectangle,r=r.clone();t&&(r.x+=s.x-o.width-n,r.y+=s.y-o.height-n),r.width=s.width+o.width+2*n,r.height=s.height+o.height+2*n,this.model.setGeometry(e[a],r),this.moveCells(i,-s.x+o.width+n,-s.y+o.height+n)}}}}}finally{this.model.endUpdate()}return e},mxGraph.prototype.cloneCells=function(e,n){n=null==n||n;var t=null;if(null!=e){for(var a={},i=(t=[],0);i<e.length;i++){a[s=mxCellPath.create(e[i])]=e[i],t.push(e[i])}if(0<t.length){var s=this.view.scale,o=this.view.translate;for(t=this.model.cloneCells(e,!0),i=0;i<e.length;i++)if(!n&&this.model.isEdge(t[i])&&null!=this.getEdgeValidationError(t[i],this.model.getTerminal(t[i],!0),this.model.getTerminal(t[i],!1)))t[i]=null;else{var r=this.model.getGeometry(t[i]);if(null!=r){var l=this.view.getState(e[i]),d=this.view.getState(this.model.getParent(e[i]));if(null!=l&&null!=d){var c=d.origin.x;d=d.origin.y;if(this.model.isEdge(t[i])){l=l.absolutePoints;for(var m=this.model.getTerminal(e[i],!0),u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);for(null==m&&r.setTerminalPoint(new mxPoint(l[0].x/s-o.x,l[0].y/s-o.y),!0),m=this.model.getTerminal(e[i],!1),u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);if(null==m&&(m=l.length-1,r.setTerminalPoint(new mxPoint(l[m].x/s-o.x,l[m].y/s-o.y),!1)),null!=(r=r.points))for(l=0;l<r.length;l++)r[l].x+=c,r[l].y+=d}else r.x+=c,r.y+=d}}}}else t=[]}return t},mxGraph.prototype.insertVertex=function(e,n,t,a,i,s,o,r,l){return n=this.createVertex(e,n,t,a,i,s,o,r,l),this.addCell(n,e)},mxGraph.prototype.createVertex=function(e,n,t,a,i,s,o,r,l){return(e=new mxGeometry(a,i,s,o)).relative=null!=l&&l,(t=new mxCell(t,e,r)).setId(n),t.setVertex(!0),t.setConnectable(!0),t},mxGraph.prototype.insertEdge=function(e,n,t,a,i,s){return n=this.createEdge(e,n,t,a,i,s),this.addEdge(n,e,a,i)},mxGraph.prototype.createEdge=function(e,n,t,a,i,s){return(e=new mxCell(t,new mxGeometry,s)).setId(n),e.setEdge(!0),e.geometry.relative=!0,e},mxGraph.prototype.addEdge=function(e,n,t,a,i){return this.addCell(e,n,i,t,a)},mxGraph.prototype.addCell=function(e,n,t,a,i){return this.addCells([e],n,t,a,i)[0]},mxGraph.prototype.addCells=function(e,n,t,a,i){null==n&&(n=this.getDefaultParent()),null==t&&(t=this.model.getChildCount(n)),this.model.beginUpdate();try{this.cellsAdded(e,n,t,a,i,!1,!0),this.fireEvent(new mxEventObject(mxEvent.ADD_CELLS,"cells",e,"parent",n,"index",t,"source",a,"target",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsAdded=function(e,n,t,a,i,s,o){if(null!=e&&null!=n&&null!=t){this.model.beginUpdate();try{for(var r=null!=(d=s?this.view.getState(n):null)?d.origin:null,l=new mxPoint(0,0),d=0;d<e.length;d++)if(null==e[d])t--;else{var c=this.model.getParent(e[d]);if(null!=r&&e[d]!=n&&n!=c){var m=this.view.getState(c),u=null!=m?m.origin:l;if(null!=(p=this.model.getGeometry(e[d]))){var p,g=u.x-r.x,v=u.y-r.y;(p=p.clone()).translate(g,v),!p.relative&&this.model.isVertex(e[d])&&!this.isAllowNegativeCoordinates()&&(p.x=Math.max(0,p.x),p.y=Math.max(0,p.y)),this.model.setGeometry(e[d],p)}}n==c&&t+d>this.model.getChildCount(n)&&t--,this.model.add(n,e[d],t+d),this.isExtendParentsOnAdd()&&this.isExtendParent(e[d])&&this.extendParent(e[d]),(null==o||o)&&this.constrainChild(e[d]),null!=a&&this.cellConnected(e[d],a,!0),null!=i&&this.cellConnected(e[d],i,!1)}this.fireEvent(new mxEventObject(mxEvent.CELLS_ADDED,"cells",e,"parent",n,"index",t,"source",a,"target",i,"absolute",s))}finally{this.model.endUpdate()}}},mxGraph.prototype.removeCells=function(e,n){n=null==n||n,null==e&&(e=this.getDeletableCells(this.getSelectionCells())),n&&(e=this.getDeletableCells(this.addAllEdges(e))),this.model.beginUpdate();try{this.cellsRemoved(e),this.fireEvent(new mxEventObject(mxEvent.REMOVE_CELLS,"cells",e,"includeEdges",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsRemoved=function(e){if(null!=e&&0<e.length){var n=this.view.scale,t=this.view.translate;this.model.beginUpdate();try{for(var a={},i=0;i<e.length;i++){var s=mxCellPath.create(e[i]);a[s]=e[i]}for(i=0;i<e.length;i++){for(var o=this.getConnections(e[i]),r=0;r<o.length;r++)if(null==a[s=mxCellPath.create(o[r])]){if(null!=(d=this.model.getGeometry(o[r]))){var l=this.view.getState(o[r]);if(null!=l){var d=d.clone(),c=l.getVisibleTerminal(!0)==e[i],m=l.absolutePoints,u=c?0:m.length-1;d.setTerminalPoint(new mxPoint(m[u].x/n-t.x,m[u].y/n-t.y),c),this.model.setTerminal(o[r],null,c),this.model.setGeometry(o[r],d)}}}this.model.remove(e[i])}this.fireEvent(new mxEventObject(mxEvent.CELLS_REMOVED,"cells",e))}finally{this.model.endUpdate()}}},mxGraph.prototype.splitEdge=function(e,n,t,a,i){a=a||0,i=i||0,null==t&&(t=this.cloneCells([e])[0]);var s=this.model.getParent(e),o=this.model.getTerminal(e,!0);this.model.beginUpdate();try{this.cellsMoved(n,a,i,!1,!1),this.cellsAdded(n,s,this.model.getChildCount(s),null,null,!0),this.cellsAdded([t],s,this.model.getChildCount(s),o,n[0],!1),this.cellConnected(e,n[0],!0),this.fireEvent(new mxEventObject(mxEvent.SPLIT_EDGE,"edge",e,"cells",n,"newEdge",t,"dx",a,"dy",i))}finally{this.model.endUpdate()}return t},mxGraph.prototype.toggleCells=function(e,n,t){null==n&&(n=this.getSelectionCells()),t&&(n=this.addAllEdges(n)),this.model.beginUpdate();try{this.cellsToggled(n,e),this.fireEvent(new mxEventObject(mxEvent.TOGGLE_CELLS,"show",e,"cells",n,"includeEdges",t))}finally{this.model.endUpdate()}return n},mxGraph.prototype.cellsToggled=function(e,n){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var t=0;t<e.length;t++)this.model.setVisible(e[t],n)}finally{this.model.endUpdate()}}},mxGraph.prototype.foldCells=function(e,n,t,a){n=null!=n&&n,null==t&&(t=this.getFoldableCells(this.getSelectionCells(),e)),this.stopEditing(!1),this.model.beginUpdate();try{this.cellsFolded(t,e,n,a),this.fireEvent(new mxEventObject(mxEvent.FOLD_CELLS,"collapse",e,"recurse",n,"cells",t))}finally{this.model.endUpdate()}return t},mxGraph.prototype.cellsFolded=function(e,n,t,a){if(null!=e&&0<e.length){this.model.beginUpdate();try{for(var i=0;i<e.length;i++)if((!a||this.isCellFoldable(e[i],n))&&n!=this.isCellCollapsed(e[i])&&(this.model.setCollapsed(e[i],n),this.swapBounds(e[i],n),this.isExtendParent(e[i])&&this.extendParent(e[i]),t)){var s=this.model.getChildren(e[i]);this.foldCells(s,n,t)}this.fireEvent(new mxEventObject(mxEvent.CELLS_FOLDED,"cells",e,"collapse",n,"recurse",t))}finally{this.model.endUpdate()}}},mxGraph.prototype.swapBounds=function(e,n){if(null!=e){var t=this.model.getGeometry(e);null!=t&&(t=t.clone(),this.updateAlternateBounds(e,t,n),t.swap(),this.model.setGeometry(e,t))}},mxGraph.prototype.updateAlternateBounds=function(e,n,t){if(null!=e&&null!=n){if(t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e),null==n.alternateBounds){var a=n;this.collapseToPreferredSize&&(null!=(e=this.getPreferredSizeForCell(e))&&(a=e,0<(e=mxUtils.getValue(t,mxConstants.STYLE_STARTSIZE))&&(a.height=Math.max(a.height,e)))),n.alternateBounds=new mxRectangle(0,0,a.width,a.height)}if(null!=n.alternateBounds){n.alternateBounds.x=n.x,n.alternateBounds.y=n.y;var i=mxUtils.toRadians(t[mxConstants.STYLE_ROTATION]||"0");0!=i&&(e=n.alternateBounds.getCenterX()-n.getCenterX(),t=n.alternateBounds.getCenterY()-n.getCenterY(),a=Math.cos(i),i=Math.sin(i),n.alternateBounds.x+=a*e-i*t-e,n.alternateBounds.y+=i*e+a*t-t)}}},mxGraph.prototype.addAllEdges=function(e){var n=e.slice();return n.concat(this.getAllEdges(e))},mxGraph.prototype.getAllEdges=function(e){var n=[];if(null!=e)for(var t=0;t<e.length;t++){for(var a=this.model.getEdgeCount(e[t]),i=0;i<a;i++)n.push(this.model.getEdgeAt(e[t],i));a=this.model.getChildren(e[t]),n=n.concat(this.getAllEdges(a))}return n},mxGraph.prototype.updateCellSize=function(e,n){n=null!=n&&n,this.model.beginUpdate();try{this.cellSizeUpdated(e,n),this.fireEvent(new mxEventObject(mxEvent.UPDATE_CELL_SIZE,"cell",e,"ignoreChildren",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellSizeUpdated=function(e,n){if(null!=e){this.model.beginUpdate();try{var t=this.getPreferredSizeForCell(e),a=this.model.getGeometry(e);if(null!=t&&null!=a){var i=this.isCellCollapsed(e);a=a.clone();if(this.isSwimlane(e)){var s=this.view.getState(e),o=null!=s?s.style:this.getCellStyle(e),r=this.model.getStyle(e);null==r&&(r=""),mxUtils.getValue(o,mxConstants.STYLE_HORIZONTAL,!0)?(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,t.height+8),i&&(a.height=t.height+8),a.width=t.width):(r=mxUtils.setStyle(r,mxConstants.STYLE_STARTSIZE,t.width+8),i&&(a.width=t.width+8),a.height=t.height),this.model.setStyle(e,r)}else a.width=t.width,a.height=t.height;if(!n&&!i){var l=this.view.getBounds(this.model.getChildren(e));if(null!=l){var d=this.view.translate,c=this.view.scale,m=(l.y+l.height)/c-a.y-d.y;a.width=Math.max(a.width,(l.x+l.width)/c-a.x-d.x),a.height=Math.max(a.height,m)}}this.cellsResized([e],[a])}}finally{this.model.endUpdate()}}},mxGraph.prototype.getPreferredSizeForCell=function(e){var n=null;if(null!=e){var t=this.view.getState(e),a=null!=t?t.style:this.getCellStyle(e);if(null!=a&&!this.model.isEdge(e)){var i=a[mxConstants.STYLE_FONTSIZE]||mxConstants.DEFAULT_FONTSIZE,s=0;n=0;null==this.getImage(t)&&null==a[mxConstants.STYLE_IMAGE]||a[mxConstants.STYLE_SHAPE]!=mxConstants.SHAPE_LABEL||(a[mxConstants.STYLE_VERTICAL_ALIGN]==mxConstants.ALIGN_MIDDLE&&(s+=parseFloat(a[mxConstants.STYLE_IMAGE_WIDTH])||mxLabel.prototype.imageSize),a[mxConstants.STYLE_ALIGN]!=mxConstants.ALIGN_CENTER&&(n+=parseFloat(a[mxConstants.STYLE_IMAGE_HEIGHT])||mxLabel.prototype.imageSize)),s+=2*(a[mxConstants.STYLE_SPACING]||0),s+=a[mxConstants.STYLE_SPACING_LEFT]||0,s+=a[mxConstants.STYLE_SPACING_RIGHT]||0,n+=2*(a[mxConstants.STYLE_SPACING]||0),n+=a[mxConstants.STYLE_SPACING_TOP]||0,n+=a[mxConstants.STYLE_SPACING_BOTTOM]||0,null!=(t=this.getFoldingImage(t))&&(s+=t.width+8),n=null!=(t=this.getLabel(e))&&0<t.length?(this.isHtmlLabel(e)||(t=t.replace(/\n/g,"<br>")),e=(i=mxUtils.getSizeForString(t,i,a[mxConstants.STYLE_FONTFAMILY])).width+s,n=i.height+n,mxUtils.getValue(a,mxConstants.STYLE_HORIZONTAL,!0)||(a=n,n=e,e=a),this.gridEnabled&&(e=this.snap(e+this.gridSize/2),n=this.snap(n+this.gridSize/2)),new mxRectangle(0,0,e,n)):new mxRectangle(0,0,a=4*this.gridSize,a)}}return n},mxGraph.prototype.handleGesture=function(e,n){if(.2<Math.abs(1-n.scale)){var t=this.view.scale,a=this.view.translate,i=e.width*n.scale,s=e.height*n.scale,o=e.y-(s-e.height)/2;t=new mxRectangle(this.snap((e.x-(i-e.width)/2)/t)-a.x,this.snap(o/t)-a.y,this.snap(i/t),this.snap(s/t));this.resizeCell(e.cell,t)}},mxGraph.prototype.resizeCell=function(e,n){return this.resizeCells([e],[n])[0]},mxGraph.prototype.resizeCells=function(e,n){this.model.beginUpdate();try{this.cellsResized(e,n),this.fireEvent(new mxEventObject(mxEvent.RESIZE_CELLS,"cells",e,"bounds",n))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellsResized=function(e,n){if(null!=e&&null!=n&&e.length==n.length){this.model.beginUpdate();try{for(var t=0;t<e.length;t++){var a=n[t],i=this.model.getGeometry(e[t]);if(null!=i&&(i.x!=a.x||i.y!=a.y||i.width!=a.width||i.height!=a.height)){if((i=i.clone()).relative){var s=i.offset;null!=s&&(s.x+=a.x-i.x,s.y+=a.y-i.y)}else i.x=a.x,i.y=a.y;i.width=a.width,i.height=a.height,!i.relative&&this.model.isVertex(e[t])&&!this.isAllowNegativeCoordinates()&&(i.x=Math.max(0,i.x),i.y=Math.max(0,i.y)),this.model.setGeometry(e[t],i),this.isExtendParent(e[t])&&this.extendParent(e[t])}}this.resetEdgesOnResize&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_RESIZED,"cells",e,"bounds",n))}finally{this.model.endUpdate()}}},mxGraph.prototype.extendParent=function(e){if(null!=e){var n=this.model.getParent(e),t=this.model.getGeometry(n);null!=n&&null!=t&&!this.isCellCollapsed(n)&&(null!=(e=this.model.getGeometry(e))&&(t.width<e.x+e.width||t.height<e.y+e.height))&&((t=t.clone()).width=Math.max(t.width,e.x+e.width),t.height=Math.max(t.height,e.y+e.height),this.cellsResized([n],[t]))}},mxGraph.prototype.importCells=function(e,n,t,a,i){return this.moveCells(e,n,t,!0,a,i)},mxGraph.prototype.moveCells=function(e,n,t,a,i,s){if(n=null!=n?n:0,t=null!=t?t:0,a=null!=a&&a,null!=e&&(0!=n||0!=t||a||null!=i)){this.model.beginUpdate();try{a&&(e=this.cloneCells(e,this.isCloneInvalidEdges()),null==i&&(i=this.getDefaultParent()));var o=this.isAllowNegativeCoordinates();if(null!=i&&this.setAllowNegativeCoordinates(!0),this.cellsMoved(e,n,t,!a&&this.isDisconnectOnMove()&&this.isAllowDanglingEdges(),null==i),this.setAllowNegativeCoordinates(o),null!=i){var r=this.model.getChildCount(i);this.cellsAdded(e,i,r,null,null,!0)}this.fireEvent(new mxEventObject(mxEvent.MOVE_CELLS,"cells",e,"dx",n,"dy",t,"clone",a,"target",i,"event",s))}finally{this.model.endUpdate()}}return e},mxGraph.prototype.cellsMoved=function(e,n,t,a,i){if(null!=e&&(0!=n||0!=t)){this.model.beginUpdate();try{a&&this.disconnectGraph(e);for(var s=0;s<e.length;s++)this.translateCell(e[s],n,t),i&&this.constrainChild(e[s]);this.resetEdgesOnMove&&this.resetEdges(e),this.fireEvent(new mxEventObject(mxEvent.CELLS_MOVED,"cells",e,"dx",t,"dy",t,"disconnect",a))}finally{this.model.endUpdate()}}},mxGraph.prototype.translateCell=function(e,n,t){var a=this.model.getGeometry(e);null!=a&&((a=a.clone()).translate(n,t),!a.relative&&this.model.isVertex(e)&&!this.isAllowNegativeCoordinates()&&(a.x=Math.max(0,a.x),a.y=Math.max(0,a.y)),a.relative&&!this.model.isEdge(e)&&(null==a.offset?a.offset=new mxPoint(n,t):(a.offset.x+=n,a.offset.y+=t)),this.model.setGeometry(e,a))},mxGraph.prototype.getCellContainmentArea=function(e){if(null!=e&&!this.model.isEdge(e)){var n=this.model.getParent(e);if(n==this.getDefaultParent()||n==this.getCurrentRoot())return this.getMaximumGraphBounds();if(null!=n&&n!=this.getDefaultParent())if(null!=(i=this.model.getGeometry(n))){var t=e=0,a=i.width,i=i.height;return this.isSwimlane(n)&&(e=(n=this.getStartSize(n)).width,a-=n.width,t=n.height,i-=n.height),new mxRectangle(e,t,a,i)}}return null},mxGraph.prototype.getMaximumGraphBounds=function(){return this.maximumGraphBounds},mxGraph.prototype.constrainChild=function(e){if(null!=e){var n=this.model.getGeometry(e),t=this.isConstrainChild(e)?this.getCellContainmentArea(e):this.getMaximumGraphBounds();null!=n&&null!=t&&!n.relative&&(n.x<t.x||n.y<t.y||t.width<n.x+n.width||t.height<n.y+n.height)&&(e=this.getOverlap(e),0<t.width&&(n.x=Math.min(n.x,t.x+t.width-(1-e)*n.width)),0<t.height&&(n.y=Math.min(n.y,t.y+t.height-(1-e)*n.height)),n.x=Math.max(n.x,t.x-n.width*e),n.y=Math.max(n.y,t.y-n.height*e))}},mxGraph.prototype.resetEdges=function(e){if(null!=e){for(var n={},t=0;t<e.length;t++){var a=mxCellPath.create(e[t]);n[a]=e[t]}this.model.beginUpdate();try{for(t=0;t<e.length;t++){var i=this.model.getEdges(e[t]);if(null!=i)for(a=0;a<i.length;a++){var s=this.view.getState(i[a]),o=null!=s?s.getVisibleTerminal(!0):this.view.getVisibleTerminal(i[a],!0),r=null!=s?s.getVisibleTerminal(!1):this.view.getVisibleTerminal(i[a],!1),l=mxCellPath.create(o),d=mxCellPath.create(r);(null==n[l]||null==n[d])&&this.resetEdge(i[a])}this.resetEdges(this.model.getChildren(e[t]))}}finally{this.model.endUpdate()}}},mxGraph.prototype.resetEdge=function(e){var n=this.model.getGeometry(e);return null!=n&&null!=n.points&&0<n.points.length&&((n=n.clone()).points=[],this.model.setGeometry(e,n)),e},mxGraph.prototype.getAllConnectionConstraints=function(e,n){return null!=e&&null!=e.shape&&null!=e.shape.stencil?e.shape.stencil.constraints:null},mxGraph.prototype.getConnectionConstraint=function(e,n,t){n=null;var a=e.style[t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X];if(null!=a){var i=e.style[t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y];null!=i&&(n=new mxPoint(parseFloat(a),parseFloat(i)))}return a=!1,null!=n&&(a=mxUtils.getValue(e.style,t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,!0)),new mxConnectionConstraint(n,a)},mxGraph.prototype.setConnectionConstraint=function(e,n,t,a){if(null!=a){this.model.beginUpdate();try{null==a||null==a.point?(this.setCellStyles(t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,null,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,null,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e])):null!=a.point&&(this.setCellStyles(t?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,a.point.x,[e]),this.setCellStyles(t?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,a.point.y,[e]),a.perimeter?this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,null,[e]):this.setCellStyles(t?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,"0",[e]))}finally{this.model.endUpdate()}}},mxGraph.prototype.getConnectionPoint=function(e,n){var t=null;if(null!=e){var a=this.view.getPerimeterBounds(e),i=new mxPoint(a.getCenterX(),a.getCenterY()),s=e.style[mxConstants.STYLE_DIRECTION],o=0;if(null!=s&&("north"==s?o+=270:"west"==s?o+=180:"south"==s&&(o+=90),"north"==s||"south"==s)){a.x+=a.width/2-a.height/2,a.y+=a.height/2-a.width/2;var r=a.width;a.width=a.height,a.height=r}if(null!=n.point){var l=t=1,d=0,c=0;if(this.getModel().isVertex(e.cell)){var m=e.style[mxConstants.STYLE_FLIPH],u=e.style[mxConstants.STYLE_FLIPV];null!=e.shape.stencil&&(m=1==mxUtils.getValue(e.style,"stencilFlipH",0)||m,u=1==mxUtils.getValue(e.style,"stencilFlipV",0)||u),"north"!=s&&"south"!=s||(r=m,m=u,u=r),m&&(t=-1,d=-a.width),u&&(l=-1,c=-a.height)}t=new mxPoint(a.x+n.point.x*a.width*t-d,a.y+n.point.y*a.height*l-c)}s=e.style[mxConstants.STYLE_ROTATION]||0,n.perimeter?(0!=o&&null!=t&&(r=a=0,90==o?r=1:180==o?a=-1:270==s&&(r=-1),t=mxUtils.getRotatedPoint(t,a,r,i)),null!=t&&n.perimeter&&(t=this.view.getPerimeterPoint(e,t,!1))):s+=o,0!=s&&null!=t&&(o=mxUtils.toRadians(s),a=Math.cos(o),r=Math.sin(o),t=mxUtils.getRotatedPoint(t,a,r,i))}return t},mxGraph.prototype.connectCell=function(e,n,t,a){this.model.beginUpdate();try{var i=this.model.getTerminal(e,t);this.cellConnected(e,n,t,a),this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL,"edge",e,"terminal",n,"source",t,"previous",i))}finally{this.model.endUpdate()}return e},mxGraph.prototype.cellConnected=function(e,n,t,a){if(null!=e){this.model.beginUpdate();try{var i=this.model.getTerminal(e,t);this.setConnectionConstraint(e,n,t,a),this.isPortsEnabled()&&(a=null,this.isPort(n)&&(a=n.getId(),n=this.getTerminalForPort(n,t)),this.setCellStyles(t?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT,a,[e])),this.model.setTerminal(e,n,t),this.resetEdgesOnConnect&&this.resetEdge(e),this.fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED,"edge",e,"terminal",n,"source",t,"previous",i))}finally{this.model.endUpdate()}}},mxGraph.prototype.disconnectGraph=function(e){if(null!=e){this.model.beginUpdate();try{for(var n=this.view.scale,t=this.view.translate,a={},i=0;i<e.length;i++){a[mxCellPath.create(e[i])]=e[i]}for(i=0;i<e.length;i++)if(this.model.isEdge(e[i])){if(null!=(r=this.model.getGeometry(e[i]))){var s=this.view.getState(e[i]),o=this.view.getState(this.model.getParent(e[i]));if(null!=s&&null!=o){var r=r.clone(),l=-o.origin.x,d=-o.origin.y,c=s.absolutePoints,m=this.model.getTerminal(e[i],!0);if(null!=m&&this.isCellDisconnectable(e[i],m,!0)){for(var u=mxCellPath.create(m);null!=m&&null==a[u];)m=this.model.getParent(m),u=mxCellPath.create(m);null==m&&(r.setTerminalPoint(new mxPoint(c[0].x/n-t.x+l,c[0].y/n-t.y+d),!0),this.model.setTerminal(e[i],null,!0))}var p=this.model.getTerminal(e[i],!1);if(null!=p&&this.isCellDisconnectable(e[i],p,!1)){for(var g=mxCellPath.create(p);null!=p&&null==a[g];)p=this.model.getParent(p),g=mxCellPath.create(p);if(null==p){var v=c.length-1;r.setTerminalPoint(new mxPoint(c[v].x/n-t.x+l,c[v].y/n-t.y+d),!1),this.model.setTerminal(e[i],null,!1)}}this.model.setGeometry(e[i],r)}}}}finally{this.model.endUpdate()}}},mxGraph.prototype.getCurrentRoot=function(){return this.view.currentRoot},mxGraph.prototype.getTranslateForRoot=function(e){return null},mxGraph.prototype.isPort=function(e){return!1},mxGraph.prototype.getTerminalForPort=function(e,n){return this.model.getParent(e)},mxGraph.prototype.getChildOffsetForCell=function(e){return null},mxGraph.prototype.enterGroup=function(e){null!=(e=e||this.getSelectionCell())&&this.isValidRoot(e)&&(this.view.setCurrentRoot(e),this.clearSelection())},mxGraph.prototype.exitGroup=function(){var e=this.model.getRoot(),n=this.getCurrentRoot();if(null!=n){for(var t=this.model.getParent(n);t!=e&&!this.isValidRoot(t)&&this.model.getParent(t)!=e;)t=this.model.getParent(t);t==e||this.model.getParent(t)==e?this.view.setCurrentRoot(null):this.view.setCurrentRoot(t),null!=this.view.getState(n)&&this.setSelectionCell(n)}},mxGraph.prototype.home=function(){var e=this.getCurrentRoot();null!=e&&(this.view.setCurrentRoot(null),null!=this.view.getState(e)&&this.setSelectionCell(e))},mxGraph.prototype.isValidRoot=function(e){return null!=e},mxGraph.prototype.getGraphBounds=function(){return this.view.getGraphBounds()},mxGraph.prototype.getCellBounds=function(e,n,t){var a=[e];if(n&&(a=a.concat(this.model.getEdges(e))),a=this.view.getBounds(a),t){t=this.model.getChildCount(e);for(var i=0;i<t;i++){var s=this.getCellBounds(this.model.getChildAt(e,i),n,!0);null!=a?a.add(s):a=s}}return a},mxGraph.prototype.getBoundingBoxFromGeometry=function(e,n){n=null!=n&&n;var t=null;if(null!=e)for(var a=0;a<e.length;a++)if(n||this.model.isVertex(e[a])){var i=this.getCellGeometry(e[a]);if(null!=i){var s=i.points;if(null!=s&&0<s.length){for(var o=new mxRectangle(s[0].x,s[0].y,0,0),r=function(e){null!=e&&o.add(new mxRectangle(e.x,e.y,0,0))},l=1;l<s.length;l++)r(s[l]);r(i.getTerminalPoint(!0)),r(i.getTerminalPoint(!1))}null==t?t=new mxRectangle(i.x,i.y,i.width,i.height):t.add(i)}}return t},mxGraph.prototype.refresh=function(e){this.view.clear(e,null==e),this.view.validate(),this.sizeDidChange(),this.fireEvent(new mxEventObject(mxEvent.REFRESH))},mxGraph.prototype.snap=function(e){return this.gridEnabled&&(e=Math.round(e/this.gridSize)*this.gridSize),e},mxGraph.prototype.panGraph=function(e,n){if(this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container))this.container.scrollLeft=-e,this.container.scrollTop=-n;else{var t=this.view.getCanvas();if(this.dialect==mxConstants.DIALECT_SVG)if(0==e&&0==n){if(mxClient.IS_IE?t.setAttribute("transform","translate("+e+","+n+")"):t.removeAttribute("transform"),null!=this.shiftPreview1){for(var a=this.shiftPreview1.firstChild;null!=a;){var i=a.nextSibling;this.container.appendChild(a),a=i}for(this.shiftPreview1.parentNode.removeChild(this.shiftPreview1),this.shiftPreview1=null,this.container.appendChild(t.parentNode),a=this.shiftPreview2.firstChild;null!=a;)i=a.nextSibling,this.container.appendChild(a),a=i;this.shiftPreview2.parentNode.removeChild(this.shiftPreview2),this.shiftPreview2=null}}else{if(t.setAttribute("transform","translate("+e+","+n+")"),null==this.shiftPreview1){this.shiftPreview1=document.createElement("div"),this.shiftPreview1.style.position="absolute",this.shiftPreview1.style.overflow="visible",this.shiftPreview2=document.createElement("div"),this.shiftPreview2.style.position="absolute",this.shiftPreview2.style.overflow="visible";var s=this.shiftPreview1;for(a=this.container.firstChild;null!=a;)i=a.nextSibling,a!=t.parentNode?s.appendChild(a):s=this.shiftPreview2,a=i;this.container.insertBefore(this.shiftPreview1,t.parentNode),this.container.appendChild(this.shiftPreview2)}this.shiftPreview1.style.left=e+"px",this.shiftPreview1.style.top=n+"px",this.shiftPreview2.style.left=e+"px",this.shiftPreview2.style.top=n+"px"}else t.style.left=e+"px",t.style.top=n+"px";this.panDx=e,this.panDy=n,this.fireEvent(new mxEventObject(mxEvent.PAN))}},mxGraph.prototype.zoomIn=function(){this.zoom(this.zoomFactor)},mxGraph.prototype.zoomOut=function(){this.zoom(1/this.zoomFactor)},mxGraph.prototype.zoomActual=function(){1==this.view.scale?this.view.setTranslate(0,0):(this.view.translate.x=0,this.view.translate.y=0,this.view.setScale(1))},mxGraph.prototype.zoomTo=function(e,n){this.zoom(e/this.view.scale,n)},mxGraph.prototype.zoom=function(e,n){n=null!=n?n:this.centerZoom;var t=this.view.scale*e,a=this.view.getState(this.getSelectionCell());if(this.keepSelectionVisibleOnZoom&&null!=a)a=new mxRectangle(a.x*e,a.y*e,a.width*e,a.height*e),this.view.scale=t,this.scrollRectToVisible(a)||(this.view.revalidate(),this.view.setScale(t));else if(n&&!mxUtils.hasScrollbars(this.container)){a=this.container.offsetWidth;var i=this.container.offsetHeight;if(1<e){var s=(e-1)/(2*t);a=a*-s,i=i*-s}else a*=s=(1/e-1)/(2*this.view.scale),i*=s;this.view.scaleAndTranslate(t,this.view.translate.x+a,this.view.translate.y+i)}else this.view.setScale(t),mxUtils.hasScrollbars(this.container)&&(i=a=0,n&&(a=this.container.offsetWidth*(e-1)/2,i=this.container.offsetHeight*(e-1)/2),this.container.scrollLeft=Math.round(this.container.scrollLeft*e+a),this.container.scrollTop=Math.round(this.container.scrollTop*e+i))},mxGraph.prototype.zoomToRect=function(e){var n=this.container.clientWidth/e.width/(this.container.clientHeight/e.height);e.x=Math.max(0,e.x),e.y=Math.max(0,e.y);var t=Math.min(this.container.scrollWidth,e.x+e.width),a=Math.min(this.container.scrollHeight,e.y+e.height);e.width=t-e.x,e.height=a-e.y,n<1?(t=((n=e.height/n)-e.height)/2,e.height=n,n=Math.min(e.y,t),e.y-=n,a=Math.min(this.container.scrollHeight,e.y+e.height),e.height=a-e.y):(t=((n*=e.width)-e.width)/2,e.width=n,n=Math.min(e.x,t),e.x-=n,t=Math.min(this.container.scrollWidth,e.x+e.width),e.width=t-e.x),n=this.container.clientWidth/e.width,t=this.view.scale*n,mxUtils.hasScrollbars(this.container)?(this.view.setScale(t),this.container.scrollLeft=Math.round(e.x*n),this.container.scrollTop=Math.round(e.y*n)):this.view.scaleAndTranslate(t,this.view.translate.x-e.x/this.view.scale,this.view.translate.y-e.y/this.view.scale)},mxGraph.prototype.fit=function(e,n){if(null!=this.container){e=null!=e?e:0,n=null!=n&&n;var t=this.container.clientWidth,a=this.container.clientHeight,i=this.view.getGraphBounds();n&&null!=i.x&&null!=i.y&&(i.width+=i.x,i.height+=i.y,i.x=0,i.y=0);var s=this.view.scale,o=i.width/s,r=i.height/s;null!=this.backgroundImage&&(o=Math.max(o,this.backgroundImage.width-i.x/s),r=Math.max(r,this.backgroundImage.height-i.y/s));var l=n?e:2*e;t=Math.floor(100*Math.min(t/(o+l),a/(r+l)))/100;null!=this.minFitScale&&(t=Math.max(t,this.minFitScale)),null!=this.maxFitScale&&(t=Math.min(t,this.maxFitScale)),n?this.view.scale!=t&&this.view.setScale(t):mxUtils.hasScrollbars(this.container)?(this.view.setScale(t),null!=i.x&&(this.container.scrollLeft=Math.round(i.x/s)*t-e-Math.max(0,(this.container.clientWidth-o*t)/2)),null!=i.y&&(this.container.scrollTop=Math.round(i.y/s)*t-e-Math.max(0,(this.container.clientHeight-r*t)/2))):this.view.scaleAndTranslate(t,null!=i.x?Math.floor(this.view.translate.x-i.x/s+e+1):e,null!=i.y?Math.floor(this.view.translate.y-i.y/s+e+1):e)}return this.view.scale},mxGraph.prototype.scrollCellToVisible=function(e,n){var t=-this.view.translate.x,a=-this.view.translate.y,i=this.view.getState(e);null!=i&&(t=new mxRectangle(t+i.x,a+i.y,i.width,i.height),n&&null!=this.container&&(a=this.container.clientWidth,i=this.container.clientHeight,t.x=t.getCenterX()-a/2,t.width=a,t.y=t.getCenterY()-i/2,t.height=i),this.scrollRectToVisible(t)&&this.view.setTranslate(this.view.translate.x,this.view.translate.y))},mxGraph.prototype.scrollRectToVisible=function(e){var n=!1;if(null!=e){var t=this.container.offsetWidth,a=this.container.offsetHeight,i=Math.min(t,e.width),s=Math.min(a,e.height);if(mxUtils.hasScrollbars(this.container)){t=this.container,e.x+=this.view.translate.x,e.y+=this.view.translate.y;var o=t.scrollLeft-e.x;a=Math.max(o-t.scrollLeft,0);0<o?t.scrollLeft-=o+2:0<(o=e.x+i-t.scrollLeft-t.clientWidth)&&(t.scrollLeft+=o+2),i=t.scrollTop-e.y,o=Math.max(0,i-t.scrollTop),0<i?t.scrollTop-=i+2:0<(i=e.y+s-t.scrollTop-t.clientHeight)&&(t.scrollTop+=i+2),!this.useScrollbarsForPanning&&(0!=a||0!=o)&&this.view.setTranslate(a,o)}else{o=-this.view.translate.x;var r=-this.view.translate.y,l=this.view.scale;e.x+i>o+t&&(this.view.translate.x-=(e.x+i-t-o)/l,n=!0),e.y+s>r+a&&(this.view.translate.y-=(e.y+s-a-r)/l,n=!0),e.x<o&&(this.view.translate.x+=(o-e.x)/l,n=!0),e.y<r&&(this.view.translate.y+=(r-e.y)/l,n=!0),n&&(this.view.refresh(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.refresh())}}return n},mxGraph.prototype.getCellGeometry=function(e){return this.model.getGeometry(e)},mxGraph.prototype.isCellVisible=function(e){return this.model.isVisible(e)},mxGraph.prototype.isCellCollapsed=function(e){return this.model.isCollapsed(e)},mxGraph.prototype.isCellConnectable=function(e){return this.model.isConnectable(e)},mxGraph.prototype.isOrthogonal=function(e){var n=e.style[mxConstants.STYLE_ORTHOGONAL];return null!=n?n:(e=this.view.getEdgeStyle(e))==mxEdgeStyle.SegmentConnector||e==mxEdgeStyle.ElbowConnector||e==mxEdgeStyle.SideToSide||e==mxEdgeStyle.TopToBottom||e==mxEdgeStyle.EntityRelation||e==mxEdgeStyle.OrthConnector},mxGraph.prototype.isLoop=function(e){var n=e.getVisibleTerminalState(!0);return e=e.getVisibleTerminalState(!1),null!=n&&n==e},mxGraph.prototype.isCloneEvent=function(e){return mxEvent.isControlDown(e)},mxGraph.prototype.isToggleEvent=function(e){return mxClient.IS_MAC?mxEvent.isMetaDown(e):mxEvent.isControlDown(e)},mxGraph.prototype.isGridEnabledEvent=function(e){return null!=e&&!mxEvent.isAltDown(e)},mxGraph.prototype.isConstrainedEvent=function(e){return mxEvent.isShiftDown(e)},mxGraph.prototype.isForceMarqueeEvent=function(e){return mxEvent.isAltDown(e)},mxGraph.prototype.validationAlert=function(e){mxUtils.alert(e)},mxGraph.prototype.isEdgeValid=function(e,n,t){return null==this.getEdgeValidationError(e,n,t)},mxGraph.prototype.getEdgeValidationError=function(e,n,t){if(null!=e&&!this.isAllowDanglingEdges()&&(null==n||null==t))return"";if(null!=e&&null==this.model.getTerminal(e,!0)&&null==this.model.getTerminal(e,!1))return null;if(!this.allowLoops&&n==t&&null!=n||!this.isValidConnection(n,t))return"";if(null==n||null==t)return this.allowDanglingEdges?null:"";var a="";this.multigraph||(1<(i=this.model.getEdgesBetween(n,t,!0)).length||1==i.length&&i[0]!=e)&&(a+=(mxResources.get(this.alreadyConnectedResource)||this.alreadyConnectedResource)+"\n");var i=this.model.getDirectedEdgeCount(n,!0,e),s=this.model.getDirectedEdgeCount(t,!1,e);if(null!=this.multiplicities)for(var o=0;o<this.multiplicities.length;o++){var r=this.multiplicities[o].check(this,e,n,t,i,s);null!=r&&(a+=r)}return null!=(r=this.validateEdge(e,n,t))&&(a+=r),0<a.length?a:null},mxGraph.prototype.validateEdge=function(e,n,t){return null},mxGraph.prototype.validateGraph=function(e,n){e=null!=e?e:this.model.getRoot(),n=null!=n?n:{};for(var t=!0,a=this.model.getChildCount(e),i=0;i<a;i++){var s=this.model.getChildAt(e,i),o=n;this.isValidRoot(s)&&(o={}),null!=(o=this.validateGraph(s,o))?this.setCellWarning(s,o.replace(/\n/g,"<br>")):this.setCellWarning(s,null),t=t&&null==o}return a="",this.isCellCollapsed(e)&&!t&&(a+=(mxResources.get(this.containsValidationErrorsResource)||this.containsValidationErrorsResource)+"\n"),a=this.model.isEdge(e)?a+(this.getEdgeValidationError(e,this.model.getTerminal(e,!0),this.model.getTerminal(e,!1))||""):a+(this.getCellValidationError(e)||""),null!=(i=this.validateCell(e,n))&&(a+=i),null==this.model.getParent(e)&&this.view.validate(),0<a.length||!t?a:null},mxGraph.prototype.getCellValidationError=function(e){var n=this.model.getDirectedEdgeCount(e,!0),t=this.model.getDirectedEdgeCount(e,!1);e=this.model.getValue(e);var a="";if(null!=this.multiplicities)for(var i=0;i<this.multiplicities.length;i++){var s=this.multiplicities[i];s.source&&mxUtils.isNode(e,s.type,s.attr,s.value)&&(0==s.max&&0<n||1==s.min&&0==n||1==s.max&&1<n)?a+=s.countError+"\n":!s.source&&mxUtils.isNode(e,s.type,s.attr,s.value)&&(0==s.max&&0<t||1==s.min&&0==t||1==s.max&&1<t)&&(a+=s.countError+"\n")}return 0<a.length?a:null},mxGraph.prototype.validateCell=function(e,n){return null},mxGraph.prototype.getBackgroundImage=function(){return this.backgroundImage},mxGraph.prototype.setBackgroundImage=function(e){this.backgroundImage=e},mxGraph.prototype.getFoldingImage=function(e){if(null!=e&&this.foldingEnabled&&!this.getModel().isEdge(e.cell)){var n=this.isCellCollapsed(e.cell);if(this.isCellFoldable(e.cell,!n))return n?this.collapsedImage:this.expandedImage}return null},mxGraph.prototype.convertValueToString=function(e){if(null!=(e=this.model.getValue(e))){if(mxUtils.isNode(e))return e.nodeName;if("function"==typeof e.toString)return e.toString()}return""},mxGraph.prototype.getLabel=function(e){var n="";if(this.labelsVisible&&null!=e){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);mxUtils.getValue(t,mxConstants.STYLE_NOLABEL,!1)||(n=this.convertValueToString(e))}return n},mxGraph.prototype.isHtmlLabel=function(e){return this.isHtmlLabels()},mxGraph.prototype.isHtmlLabels=function(){return this.htmlLabels},mxGraph.prototype.setHtmlLabels=function(e){this.htmlLabels=e},mxGraph.prototype.isWrapping=function(e){var n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&"wrap"==e[mxConstants.STYLE_WHITE_SPACE]},mxGraph.prototype.isLabelClipped=function(e){var n=this.view.getState(e);return null!=(e=null!=n?n.style:this.getCellStyle(e))&&"hidden"==e[mxConstants.STYLE_OVERFLOW]},mxGraph.prototype.getTooltip=function(e,t,n,a){var i=null;return null!=e&&(null==e.control||t!=e.control.node&&t.parentNode!=e.control.node||(i=this.collapseExpandResource,i=mxResources.get(i)||i),null==i&&null!=e.overlays&&e.overlays.visit(function(e,n){null!=i||t!=n.node&&t.parentNode!=n.node||(i=n.overlay.toString())}),null==i&&(null!=(n=this.selectionCellsHandler.getHandler(e.cell))&&"function"==typeof n.getTooltipForNode&&(i=n.getTooltipForNode(t))),null==i&&(i=this.getTooltipForCell(e.cell))),i},mxGraph.prototype.getTooltipForCell=function(e){return null!=e&&null!=e.getTooltip?e.getTooltip():this.convertValueToString(e)},mxGraph.prototype.getCursorForCell=function(e){return null},mxGraph.prototype.getStartSize=function(e){var n=new mxRectangle,t=this.view.getState(e);return null!=(e=null!=t?t.style:this.getCellStyle(e))&&(t=parseInt(mxUtils.getValue(e,mxConstants.STYLE_STARTSIZE,mxConstants.DEFAULT_STARTSIZE)),mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,!0)?n.height=t:n.width=t),n},mxGraph.prototype.getImage=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_IMAGE]:null},mxGraph.prototype.getVerticalAlign=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_VERTICAL_ALIGN]||mxConstants.ALIGN_MIDDLE:null},mxGraph.prototype.getIndicatorColor=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_COLOR]:null},mxGraph.prototype.getIndicatorGradientColor=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_GRADIENTCOLOR]:null},mxGraph.prototype.getIndicatorShape=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_SHAPE]:null},mxGraph.prototype.getIndicatorImage=function(e){return null!=e&&null!=e.style?e.style[mxConstants.STYLE_INDICATOR_IMAGE]:null},mxGraph.prototype.getBorder=function(){return this.border},mxGraph.prototype.setBorder=function(e){this.border=e},mxGraph.prototype.isSwimlane=function(e){var n;if(null!=e&&this.model.getParent(e)!=this.model.getRoot()&&(null!=(n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e))&&!this.model.isEdge(e)))return n[mxConstants.STYLE_SHAPE]==mxConstants.SHAPE_SWIMLANE;return!1},mxGraph.prototype.isResizeContainer=function(){return this.resizeContainer},mxGraph.prototype.setResizeContainer=function(e){this.resizeContainer=e},mxGraph.prototype.isEnabled=function(){return this.enabled},mxGraph.prototype.setEnabled=function(e){this.enabled=e},mxGraph.prototype.isEscapeEnabled=function(){return this.escapeEnabled},mxGraph.prototype.setEscapeEnabled=function(e){this.escapeEnabled=e},mxGraph.prototype.isInvokesStopCellEditing=function(){return this.invokesStopCellEditing},mxGraph.prototype.setInvokesStopCellEditing=function(e){this.invokesStopCellEditing=e},mxGraph.prototype.isEnterStopsCellEditing=function(){return this.enterStopsCellEditing},mxGraph.prototype.setEnterStopsCellEditing=function(e){this.enterStopsCellEditing=e},mxGraph.prototype.isCellLocked=function(e){var n=this.model.getGeometry(e);return this.isCellsLocked()||null!=n&&this.model.isVertex(e)&&n.relative},mxGraph.prototype.isCellsLocked=function(){return this.cellsLocked},mxGraph.prototype.setCellsLocked=function(e){this.cellsLocked=e},mxGraph.prototype.getCloneableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellCloneable(e)}))},mxGraph.prototype.isCellCloneable=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isCellsCloneable()&&0!=e[mxConstants.STYLE_CLONEABLE]},mxGraph.prototype.isCellsCloneable=function(){return this.cellsCloneable},mxGraph.prototype.setCellsCloneable=function(e){this.cellsCloneable=e},mxGraph.prototype.getExportableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.canExportCell(e)}))},mxGraph.prototype.canExportCell=function(e){return this.exportEnabled},mxGraph.prototype.getImportableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.canImportCell(e)}))},mxGraph.prototype.canImportCell=function(e){return this.importEnabled},mxGraph.prototype.isCellSelectable=function(e){return this.isCellsSelectable()},mxGraph.prototype.isCellsSelectable=function(){return this.cellsSelectable},mxGraph.prototype.setCellsSelectable=function(e){this.cellsSelectable=e},mxGraph.prototype.getDeletableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellDeletable(e)}))},mxGraph.prototype.isCellDeletable=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isCellsDeletable()&&0!=e[mxConstants.STYLE_DELETABLE]},mxGraph.prototype.isCellsDeletable=function(){return this.cellsDeletable},mxGraph.prototype.setCellsDeletable=function(e){this.cellsDeletable=e},mxGraph.prototype.isLabelMovable=function(e){return!this.isCellLocked(e)&&(this.model.isEdge(e)&&this.edgeLabelsMovable||this.model.isVertex(e)&&this.vertexLabelsMovable)},mxGraph.prototype.getMovableCells=function(e){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellMovable(e)}))},mxGraph.prototype.isCellMovable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsMovable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_MOVABLE]},mxGraph.prototype.isCellsMovable=function(){return this.cellsMovable},mxGraph.prototype.setCellsMovable=function(e){this.cellsMovable=e},mxGraph.prototype.isGridEnabled=function(){return this.gridEnabled},mxGraph.prototype.setGridEnabled=function(e){this.gridEnabled=e},mxGraph.prototype.isPortsEnabled=function(){return this.portsEnabled},mxGraph.prototype.setPortsEnabled=function(e){this.portsEnabled=e},mxGraph.prototype.getGridSize=function(){return this.gridSize},mxGraph.prototype.setGridSize=function(e){this.gridSize=e},mxGraph.prototype.getTolerance=function(){return this.tolerance},mxGraph.prototype.setTolerance=function(e){this.tolerance=e},mxGraph.prototype.isVertexLabelsMovable=function(){return this.vertexLabelsMovable},mxGraph.prototype.setVertexLabelsMovable=function(e){this.vertexLabelsMovable=e},mxGraph.prototype.isEdgeLabelsMovable=function(){return this.edgeLabelsMovable},mxGraph.prototype.setEdgeLabelsMovable=function(e){this.edgeLabelsMovable=e},mxGraph.prototype.isSwimlaneNesting=function(){return this.swimlaneNesting},mxGraph.prototype.setSwimlaneNesting=function(e){this.swimlaneNesting=e},mxGraph.prototype.isSwimlaneSelectionEnabled=function(){return this.swimlaneSelectionEnabled},mxGraph.prototype.setSwimlaneSelectionEnabled=function(e){this.swimlaneSelectionEnabled=e},mxGraph.prototype.isMultigraph=function(){return this.multigraph},mxGraph.prototype.setMultigraph=function(e){this.multigraph=e},mxGraph.prototype.isAllowLoops=function(){return this.allowLoops},mxGraph.prototype.setAllowDanglingEdges=function(e){this.allowDanglingEdges=e},mxGraph.prototype.isAllowDanglingEdges=function(){return this.allowDanglingEdges},mxGraph.prototype.setConnectableEdges=function(e){this.connectableEdges=e},mxGraph.prototype.isConnectableEdges=function(){return this.connectableEdges},mxGraph.prototype.setCloneInvalidEdges=function(e){this.cloneInvalidEdges=e},mxGraph.prototype.isCloneInvalidEdges=function(){return this.cloneInvalidEdges},mxGraph.prototype.setAllowLoops=function(e){this.allowLoops=e},mxGraph.prototype.isDisconnectOnMove=function(){return this.disconnectOnMove},mxGraph.prototype.setDisconnectOnMove=function(e){this.disconnectOnMove=e},mxGraph.prototype.isDropEnabled=function(){return this.dropEnabled},mxGraph.prototype.setDropEnabled=function(e){this.dropEnabled=e},mxGraph.prototype.isSplitEnabled=function(){return this.splitEnabled},mxGraph.prototype.setSplitEnabled=function(e){this.splitEnabled=e},mxGraph.prototype.isCellResizable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsResizable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_RESIZABLE]},mxGraph.prototype.isCellsResizable=function(){return this.cellsResizable},mxGraph.prototype.setCellsResizable=function(e){this.cellsResizable=e},mxGraph.prototype.isTerminalPointMovable=function(e,n){return!0},mxGraph.prototype.isCellBendable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsBendable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_BENDABLE]},mxGraph.prototype.isCellsBendable=function(){return this.cellsBendable},mxGraph.prototype.setCellsBendable=function(e){this.cellsBendable=e},mxGraph.prototype.isCellEditable=function(e){var n=null!=(n=this.view.getState(e))?n.style:this.getCellStyle(e);return this.isCellsEditable()&&!this.isCellLocked(e)&&0!=n[mxConstants.STYLE_EDITABLE]},mxGraph.prototype.isCellsEditable=function(){return this.cellsEditable},mxGraph.prototype.setCellsEditable=function(e){this.cellsEditable=e},mxGraph.prototype.isCellDisconnectable=function(e,n,t){return this.isCellsDisconnectable()&&!this.isCellLocked(e)},mxGraph.prototype.isCellsDisconnectable=function(){return this.cellsDisconnectable},mxGraph.prototype.setCellsDisconnectable=function(e){this.cellsDisconnectable=e},mxGraph.prototype.isValidSource=function(e){return null==e&&this.allowDanglingEdges||null!=e&&(!this.model.isEdge(e)||this.connectableEdges)&&this.isCellConnectable(e)},mxGraph.prototype.isValidTarget=function(e){return this.isValidSource(e)},mxGraph.prototype.isValidConnection=function(e,n){return this.isValidSource(e)&&this.isValidTarget(n)},mxGraph.prototype.setConnectable=function(e){this.connectionHandler.setEnabled(e)},mxGraph.prototype.isConnectable=function(e){return this.connectionHandler.isEnabled()},mxGraph.prototype.setTooltips=function(e){this.tooltipHandler.setEnabled(e)},mxGraph.prototype.setPanning=function(e){this.panningHandler.panningEnabled=e},mxGraph.prototype.isEditing=function(e){if(null==this.cellEditor)return!1;var n=this.cellEditor.getEditingCell();return null==e?null!=n:e==n},mxGraph.prototype.isAutoSizeCell=function(e){var n=this.view.getState(e);return e=null!=n?n.style:this.getCellStyle(e),this.isAutoSizeCells()||1==e[mxConstants.STYLE_AUTOSIZE]},mxGraph.prototype.isAutoSizeCells=function(){return this.autoSizeCells},mxGraph.prototype.setAutoSizeCells=function(e){this.autoSizeCells=e},mxGraph.prototype.isExtendParent=function(e){return!this.getModel().isEdge(e)&&this.isExtendParents()},mxGraph.prototype.isExtendParents=function(){return this.extendParents},mxGraph.prototype.setExtendParents=function(e){this.extendParents=e},mxGraph.prototype.isExtendParentsOnAdd=function(){return this.extendParentsOnAdd},mxGraph.prototype.setExtendParentsOnAdd=function(e){this.extendParentsOnAdd=e},mxGraph.prototype.isConstrainChild=function(e){return this.isConstrainChildren()&&!this.getModel().isEdge(this.getModel().getParent(e))},mxGraph.prototype.isConstrainChildren=function(){return this.constrainChildren},mxGraph.prototype.setConstrainChildren=function(e){this.constrainChildren=e},mxGraph.prototype.isAllowNegativeCoordinates=function(){return this.allowNegativeCoordinates},mxGraph.prototype.setAllowNegativeCoordinates=function(e){this.allowNegativeCoordinates=e},mxGraph.prototype.getOverlap=function(e){return this.isAllowOverlapParent(e)?this.defaultOverlap:0},mxGraph.prototype.isAllowOverlapParent=function(e){return!1},mxGraph.prototype.getFoldableCells=function(e,n){return this.model.filterCells(e,mxUtils.bind(this,function(e){return this.isCellFoldable(e,n)}))},mxGraph.prototype.isCellFoldable=function(e,n){var t=null!=(t=this.view.getState(e))?t.style:this.getCellStyle(e);return 0<this.model.getChildCount(e)&&0!=t[mxConstants.STYLE_FOLDABLE]},mxGraph.prototype.isValidDropTarget=function(e,n,t){return null!=e&&(this.isSplitEnabled()&&this.isSplitTarget(e,n,t)||!this.model.isEdge(e)&&(this.isSwimlane(e)||0<this.model.getChildCount(e)&&!this.isCellCollapsed(e)))},mxGraph.prototype.isSplitTarget=function(e,n,t){return!(!this.model.isEdge(e)||null==n||1!=n.length||!this.isCellConnectable(n[0])||null!=this.getEdgeValidationError(e,this.model.getTerminal(e,!0),n[0]))&&(t=this.model.getTerminal(e,!0),e=this.model.getTerminal(e,!1),!this.model.isAncestor(n[0],t)&&!this.model.isAncestor(n[0],e))},mxGraph.prototype.getDropTarget=function(e,n,t){if(!this.isSwimlaneNesting())for(var a=0;a<e.length;a++)if(this.isSwimlane(e[a]))return null;if((a=mxUtils.convertPoint(this.container,mxEvent.getClientX(n),mxEvent.getClientY(n))).x-=this.panDx,a.y-=this.panDy,a=this.getSwimlaneAt(a.x,a.y),null==t)t=a;else if(null!=a){for(var i=this.model.getParent(a);null!=i&&this.isSwimlane(i)&&i!=t;)i=this.model.getParent(i);i==t&&(t=a)}for(;null!=t&&!this.isValidDropTarget(t,e,n)&&!this.model.isLayer(t);)t=this.model.getParent(t);return!this.model.isLayer(t)&&mxUtils.indexOf(e,t)<0?t:null},mxGraph.prototype.getDefaultParent=function(){var e=this.defaultParent;return null==e&&(null==(e=this.getCurrentRoot())&&(e=this.model.getRoot(),e=this.model.getChildAt(e,0))),e},mxGraph.prototype.setDefaultParent=function(e){this.defaultParent=e},mxGraph.prototype.getSwimlane=function(e){for(;null!=e&&!this.isSwimlane(e);)e=this.model.getParent(e);return e},mxGraph.prototype.getSwimlaneAt=function(e,n,t){if(null!=(t=t||this.getDefaultParent()))for(var a=this.model.getChildCount(t),i=0;i<a;i++){var s=this.model.getChildAt(t,i),o=this.getSwimlaneAt(e,n,s);if(null!=o)return o;if(this.isSwimlane(s)&&(o=this.view.getState(s),this.intersects(o,e,n)))return s}return null},mxGraph.prototype.getCellAt=function(e,n,t,a,i){if(a=null==a||a,i=null==i||i,null!=(t=null!=t?t:this.getDefaultParent()))for(var s=this.model.getChildCount(t)-1;0<=s;s--){var o=this.model.getChildAt(t,s),r=this.getCellAt(e,n,o,a,i);if(null!=r)return r;if(this.isCellVisible(o)&&(i&&this.model.isEdge(o)||a&&this.model.isVertex(o))&&(r=this.view.getState(o),this.intersects(r,e,n)))return o}return null},mxGraph.prototype.intersects=function(e,n,t){if(null!=e){var a=e.absolutePoints;if(null!=a){e=this.tolerance*this.tolerance;for(var i=a[0],s=1;s<a.length;s++){var o=a[s];if(mxUtils.ptSegDistSq(i.x,i.y,o.x,o.y,n,t)<=e)return!0;i=o}}else if(0!=(i=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))&&(a=Math.cos(-i),i=Math.sin(-i),s=new mxPoint(e.getCenterX(),e.getCenterY()),n=(i=mxUtils.getRotatedPoint(new mxPoint(n,t),a,i,s)).x,t=i.y),mxUtils.contains(e,n,t))return!0}return!1},mxGraph.prototype.hitsSwimlaneContent=function(e,n,t){var a=this.getView().getState(e);if(e=this.getStartSize(e),null!=a){var i=this.getView().getScale();if(n-=a.x,t-=a.y,0<e.width&&0<n&&n>e.width*i||0<e.height&&0<t&&t>e.height*i)return!0}return!1},mxGraph.prototype.getChildVertices=function(e){return this.getChildCells(e,!0,!1)},mxGraph.prototype.getChildEdges=function(e){return this.getChildCells(e,!1,!0)},mxGraph.prototype.getChildCells=function(e,n,t){for(e=null!=e?e:this.getDefaultParent(),e=this.model.getChildCells(e,null!=n&&n,null!=t&&t),n=[],t=0;t<e.length;t++)this.isCellVisible(e[t])&&n.push(e[t]);return n},mxGraph.prototype.getConnections=function(e,n){return this.getEdges(e,n,!0,!0,!1)},mxGraph.prototype.getIncomingEdges=function(e,n){return this.getEdges(e,n,!0,!1,!1)},mxGraph.prototype.getOutgoingEdges=function(e,n){return this.getEdges(e,n,!1,!0,!1)},mxGraph.prototype.getEdges=function(e,n,t,a,i,s){t=null==t||t,a=null==a||a,i=null==i||i,s=null!=s&&s;for(var o=[],r=this.isCellCollapsed(e),l=this.model.getChildCount(e),d=0;d<l;d++){var c=this.model.getChildAt(e,d);!r&&this.isCellVisible(c)||(o=o.concat(this.model.getEdges(c,t,a)))}for(o=o.concat(this.model.getEdges(e,t,a)),r=[],d=0;d<o.length;d++)l=null!=(c=this.view.getState(o[d]))?c.getVisibleTerminal(!0):this.view.getVisibleTerminal(o[d],!0),c=null!=c?c.getVisibleTerminal(!1):this.view.getVisibleTerminal(o[d],!1),(i&&l==c||l!=c&&(t&&c==e&&(null==n||this.isValidAncestor(l,n,s))||a&&l==e&&(null==n||this.isValidAncestor(c,n,s))))&&r.push(o[d]);return r},mxGraph.prototype.isValidAncestor=function(e,n,t){return t?this.model.isAncestor(n,e):this.model.getParent(e)==n},mxGraph.prototype.getOpposites=function(e,n,t,a){t=null==t||t,a=null==a||a;var i=[],s={};if(null!=e)for(var o=0;o<e.length;o++){var r=null!=(l=this.view.getState(e[o]))?l.getVisibleTerminal(!0):this.view.getVisibleTerminal(e[o],!0),l=null!=l?l.getVisibleTerminal(!1):this.view.getVisibleTerminal(e[o],!1);if(r==n&&null!=l&&l!=n&&a){var d=mxCellPath.create(l);null==s[d]&&(s[d]=l,i.push(l))}else l==n&&null!=r&&r!=n&&t&&(null==s[d=mxCellPath.create(r)]&&(s[d]=r,i.push(r)))}return i},mxGraph.prototype.getEdgesBetween=function(e,n,t){t=null!=t&&t;for(var a=this.getEdges(e),i=[],s=0;s<a.length;s++){var o=null!=(r=this.view.getState(a[s]))?r.getVisibleTerminal(!0):this.view.getVisibleTerminal(a[s],!0),r=null!=r?r.getVisibleTerminal(!1):this.view.getVisibleTerminal(a[s],!1);(o==e&&r==n||!t&&o==n&&r==e)&&i.push(a[s])}return i},mxGraph.prototype.getPointForEvent=function(e,n){var t=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a=this.view.scale,i=this.view.translate,s=0!=n?this.gridSize/2:0;return t.x=this.snap(t.x/a-i.x-s),t.y=this.snap(t.y/a-i.y-s),t},mxGraph.prototype.getCells=function(e,n,t,a,i,s){if(s=null!=s?s:[],0<t||0<a){var o=e+t,r=n+a;if(null!=(i=i||this.getDefaultParent()))for(var l=this.model.getChildCount(i),d=0;d<l;d++){var c=this.model.getChildAt(i,d),m=this.view.getState(c);if(this.isCellVisible(c)&&null!=m){var u=m;0!=(m=mxUtils.getValue(m.style,mxConstants.STYLE_ROTATION)||0)&&(u=mxUtils.getBoundingBox(u,m)),u.x>=e&&u.y+u.height<=r&&u.y>=n&&u.x+u.width<=o?s.push(c):this.getCells(e,n,t,a,c,s)}}}return s},mxGraph.prototype.getCellsBeyond=function(e,n,t,a,i){var s=[];if((a||i)&&(null==t&&(t=this.getDefaultParent()),null!=t))for(var o=this.model.getChildCount(t),r=0;r<o;r++){var l=this.model.getChildAt(t,r),d=this.view.getState(l);this.isCellVisible(l)&&null!=d&&(!a||d.x>=e)&&(!i||d.y>=n)&&s.push(l)}return s},mxGraph.prototype.findTreeRoots=function(e,n,t){n=null!=n&&n,t=null!=t&&t;var a=[];if(null!=e){for(var i=this.getModel(),s=i.getChildCount(e),o=null,r=0,l=0;l<s;l++){var d=i.getChildAt(e,l);if(this.model.isVertex(d)&&this.isCellVisible(d)){for(var c=this.getConnections(d,n?e:null),m=0,u=0,p=0;p<c.length;p++)this.view.getVisibleTerminal(c[p],!0)==d?m++:u++;(t&&0==m&&0<u||!t&&0==u&&0<m)&&a.push(d),r<(c=t?u-m:m-u)&&(r=c,o=d)}}0==a.length&&null!=o&&a.push(o)}return a},mxGraph.prototype.traverse=function(e,n,t,a,i){if(null!=t&&null!=e){n=null==n||n,i=i||[];var s=mxCellPath.create(e);if(null==i[s]&&(null==(a=t(i[s]=e,a))||a)&&0<(a=this.model.getEdgeCount(e)))for(s=0;s<a;s++){var o=this.model.getEdgeAt(e,s),r=this.model.getTerminal(o,!0)==e;n&&!r||(r=this.model.getTerminal(o,!r),this.traverse(r,n,t,o,i))}}},mxGraph.prototype.isCellSelected=function(e){return this.getSelectionModel().isSelected(e)},mxGraph.prototype.isSelectionEmpty=function(){return this.getSelectionModel().isEmpty()},mxGraph.prototype.clearSelection=function(){return this.getSelectionModel().clear()},mxGraph.prototype.getSelectionCount=function(){return this.getSelectionModel().cells.length},mxGraph.prototype.getSelectionCell=function(){return this.getSelectionModel().cells[0]},mxGraph.prototype.getSelectionCells=function(){return this.getSelectionModel().cells.slice()},mxGraph.prototype.setSelectionCell=function(e){this.getSelectionModel().setCell(e)},mxGraph.prototype.setSelectionCells=function(e){this.getSelectionModel().setCells(e)},mxGraph.prototype.addSelectionCell=function(e){this.getSelectionModel().addCell(e)},mxGraph.prototype.addSelectionCells=function(e){this.getSelectionModel().addCells(e)},mxGraph.prototype.removeSelectionCell=function(e){this.getSelectionModel().removeCell(e)},mxGraph.prototype.removeSelectionCells=function(e){this.getSelectionModel().removeCells(e)},mxGraph.prototype.selectRegion=function(e,n){var t=this.getCells(e.x,e.y,e.width,e.height);return this.selectCellsForEvent(t,n),t},mxGraph.prototype.selectNextCell=function(){this.selectCell(!0)},mxGraph.prototype.selectPreviousCell=function(){this.selectCell()},mxGraph.prototype.selectParentCell=function(){this.selectCell(!1,!0)},mxGraph.prototype.selectChildCell=function(){this.selectCell(!1,!1,!0)},mxGraph.prototype.selectCell=function(e,n,t){var a=0<(i=this.selectionModel).cells.length?i.cells[0]:null;1<i.cells.length&&i.clear();var i=null!=a?this.model.getParent(a):this.getDefaultParent(),s=this.model.getChildCount(i);null==a&&0<s?(e=this.model.getChildAt(i,0),this.setSelectionCell(e)):null!=a&&!n||null==this.view.getState(i)||null==this.model.getGeometry(i)?null!=a&&t?0<this.model.getChildCount(a)&&(e=this.model.getChildAt(a,0),this.setSelectionCell(e)):0<s&&(n=i.getIndex(a),e=e?(n++,this.model.getChildAt(i,n%s)):(n--,this.model.getChildAt(i,n<0?s-1:n)),this.setSelectionCell(e)):this.getCurrentRoot()!=i&&this.setSelectionCell(i)},mxGraph.prototype.selectAll=function(e){e=e||this.getDefaultParent(),null!=(e=this.model.getChildren(e))&&this.setSelectionCells(e)},mxGraph.prototype.selectVertices=function(e){this.selectCells(!0,!1,e)},mxGraph.prototype.selectEdges=function(e){this.selectCells(!1,!0,e)},mxGraph.prototype.selectCells=function(n,t,e){e=e||this.getDefaultParent();var a=mxUtils.bind(this,function(e){return null!=this.view.getState(e)&&0==this.model.getChildCount(e)&&(this.model.isVertex(e)&&n||this.model.isEdge(e)&&t)});e=this.model.filterDescendants(a,e),this.setSelectionCells(e)},mxGraph.prototype.selectCellForEvent=function(e,n){var t=this.isCellSelected(e);this.isToggleEvent(n)?t?this.removeSelectionCell(e):this.addSelectionCell(e):(!t||1!=this.getSelectionCount())&&this.setSelectionCell(e)},mxGraph.prototype.selectCellsForEvent=function(e,n){this.isToggleEvent(n)?this.addSelectionCells(e):this.setSelectionCells(e)},mxGraph.prototype.createHandler=function(e){var n=null;return null!=e&&(n=this.model.isEdge(e.cell)?(n=this.view.getEdgeStyle(e),this.isLoop(e)||n==mxEdgeStyle.ElbowConnector||n==mxEdgeStyle.SideToSide||n==mxEdgeStyle.TopToBottom?new mxElbowEdgeHandler(e):n==mxEdgeStyle.SegmentConnector||n==mxEdgeStyle.OrthConnector?new mxEdgeSegmentHandler(e):new mxEdgeHandler(e)):new mxVertexHandler(e)),n},mxGraph.prototype.addMouseListener=function(e){null==this.mouseListeners&&(this.mouseListeners=[]),this.mouseListeners.push(e)},mxGraph.prototype.removeMouseListener=function(e){if(null!=this.mouseListeners)for(var n=0;n<this.mouseListeners.length;n++)if(this.mouseListeners[n]==e){this.mouseListeners.splice(n,1);break}},mxGraph.prototype.updateMouseEvent=function(e){if(null==e.graphX||null==e.graphY){var n=mxUtils.convertPoint(this.container,e.getX(),e.getY());e.graphX=n.x-this.panDx,e.graphY=n.y-this.panDy}},mxGraph.prototype.fireMouseEvent=function(e,n,t){if(null==t&&(t=this),this.updateMouseEvent(n),e==mxEvent.MOUSE_DOWN&&(this.isMouseDown=!0),mxClient.IS_TOUCH&&this.doubleTapEnabled&&e==mxEvent.MOUSE_DOWN){var a=(new Date).getTime();a-this.lastTouchTime<this.doubleTapTimeout&&Math.abs(this.lastTouchX-n.getX())<this.doubleTapTolerance&&Math.abs(this.lastTouchY-n.getY())<this.doubleTapTolerance?(this.lastTouchTime=0,this.dblClick(n.getEvent(),n.getCell()),n.getEvent().cancelBubble=!0):(this.lastTouchX=n.getX(),this.lastTouchY=n.getY(),this.lastTouchTime=a)}if(a=2!=n.getEvent().detail,mxClient.IS_IE&&"CSS1Compat"==document.compatMode&&((null!=this.lastMouseX&&Math.abs(this.lastMouseX-n.getX())>this.doubleTapTolerance||null!=this.lastMouseY&&Math.abs(this.lastMouseY-n.getY())>this.doubleTapTolerance)&&(a=!0),e==mxEvent.MOUSE_UP&&(this.lastMouseX=n.getX(),this.lastMouseY=n.getY())),(e!=mxEvent.MOUSE_UP||this.isMouseDown)&&a){if(e==mxEvent.MOUSE_UP&&(this.isMouseDown=!1),!this.isEditing()&&(mxClient.IS_OP||mxClient.IS_SF||mxClient.IS_GC||mxClient.IS_IE&&mxClient.IS_SVG||n.getEvent().target!=this.container)){if(e==mxEvent.MOUSE_MOVE&&this.isMouseDown&&this.autoScroll&&this.scrollPointToVisible(n.getGraphX(),n.getGraphY(),this.autoExtend),null!=this.mouseListeners)for(t=[t,n],n.getEvent().returnValue=!0,a=0;a<this.mouseListeners.length;a++){var i=this.mouseListeners[a];e==mxEvent.MOUSE_DOWN?i.mouseDown.apply(i,t):e==mxEvent.MOUSE_MOVE?i.mouseMove.apply(i,t):e==mxEvent.MOUSE_UP&&i.mouseUp.apply(i,t)}e==mxEvent.MOUSE_UP&&this.click(n)}}else e==mxEvent.MOUSE_UP&&(this.isMouseDown=!1)},mxGraph.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tooltipHandler&&this.tooltipHandler.destroy(),null!=this.selectionCellsHandler&&this.selectionCellsHandler.destroy(),null!=this.panningHandler&&this.panningHandler.destroy(),null!=this.connectionHandler&&this.connectionHandler.destroy(),null!=this.graphHandler&&this.graphHandler.destroy(),null!=this.cellEditor&&this.cellEditor.destroy(),null!=this.view&&this.view.destroy(),null!=this.model&&null!=this.graphModelChangeListener&&(this.model.removeListener(this.graphModelChangeListener),this.graphModelChangeListener=null),this.container=null)},mxCellOverlay.prototype=new mxEventSource,mxCellOverlay.prototype.constructor=mxCellOverlay,mxCellOverlay.prototype.image=null,mxCellOverlay.prototype.tooltip=null,mxCellOverlay.prototype.align=mxConstants.ALIGN_RIGHT,mxCellOverlay.prototype.verticalAlign=mxConstants.ALIGN_BOTTOM,mxCellOverlay.prototype.offset=null,mxCellOverlay.prototype.cursor=null,mxCellOverlay.prototype.defaultOverlap=.5,mxCellOverlay.prototype.getBounds=function(e){var n=e.view.graph.getModel().isEdge(e.cell),t=e.view.scale,a=null,i=this.image.width,s=this.image.height;return n?a=1==(n=e.absolutePoints).length%2?n[Math.floor(n.length/2)]:(e=n[(a=n.length/2)-1],n=n[a],new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2)):((a=new mxPoint).x=this.align==mxConstants.ALIGN_LEFT?e.x:this.align==mxConstants.ALIGN_CENTER?e.x+e.width/2:e.x+e.width,a.y=this.verticalAlign==mxConstants.ALIGN_TOP?e.y:this.verticalAlign==mxConstants.ALIGN_MIDDLE?e.y+e.height/2:e.y+e.height),new mxRectangle(Math.round(a.x-(i*this.defaultOverlap-this.offset.x)*t),Math.round(a.y-(s*this.defaultOverlap-this.offset.y)*t),i*t,s*t)},mxCellOverlay.prototype.toString=function(){return this.tooltip},mxOutline.prototype.source=null,mxOutline.prototype.outline=null,mxOutline.prototype.graphRenderHint=mxConstants.RENDERING_HINT_FASTER,mxOutline.prototype.enabled=!0,mxOutline.prototype.showViewport=!0,mxOutline.prototype.border=10,mxOutline.prototype.sizerSize=8,mxOutline.prototype.updateOnPan=!1,mxOutline.prototype.sizerImage=null,mxOutline.prototype.suspended=!1,mxOutline.prototype.init=function(e){this.outline=new mxGraph(e,this.source.getModel(),this.graphRenderHint,this.source.getStylesheet()),this.outline.foldingEnabled=!1,this.outline.autoScroll=!1;var n=this.outline.graphModelChanged;this.outline.graphModelChanged=mxUtils.bind(this,function(e){!this.suspended&&null!=this.outline&&n.apply(this.outline,arguments)}),mxClient.IS_SVG&&((e=this.outline.getView().getCanvas().parentNode).setAttribute("shape-rendering","optimizeSpeed"),e.setAttribute("image-rendering","optimizeSpeed")),this.outline.labelsVisible=!1,this.outline.setEnabled(!1),this.updateHandler=mxUtils.bind(this,function(e,n){!this.suspended&&!this.active&&this.update()}),this.source.getModel().addListener(mxEvent.CHANGE,this.updateHandler),this.outline.addMouseListener(this),(e=this.source.getView()).addListener(mxEvent.SCALE,this.updateHandler),e.addListener(mxEvent.TRANSLATE,this.updateHandler),e.addListener(mxEvent.SCALE_AND_TRANSLATE,this.updateHandler),e.addListener(mxEvent.DOWN,this.updateHandler),e.addListener(mxEvent.UP,this.updateHandler),mxEvent.addListener(this.source.container,"scroll",this.updateHandler),this.panHandler=mxUtils.bind(this,function(e){this.updateOnPan&&this.updateHandler.apply(this,arguments)}),this.source.addListener(mxEvent.PAN,this.panHandler),this.refreshHandler=mxUtils.bind(this,function(e){this.outline.setStylesheet(this.source.getStylesheet()),this.outline.refresh()}),this.source.addListener(mxEvent.REFRESH,this.refreshHandler),this.bounds=new mxRectangle(0,0,0,0),this.selectionBorder=new mxRectangleShape(this.bounds,null,mxConstants.OUTLINE_COLOR,mxConstants.OUTLINE_STROKEWIDTH),this.selectionBorder.dialect=this.outline.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.init(this.outline.getView().getOverlayPane()),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.outline),this.selectionBorder.node.style.background="",this.sizer=this.createSizer(),this.sizer.init(this.outline.getView().getOverlayPane()),this.enabled&&(this.sizer.node.style.cursor="pointer"),mxEvent.addListener(this.sizer.node,mxClient.IS_TOUCH?"touchstart":"mousedown",mxUtils.bind(this,function(e){this.outline.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))})),this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display,this.selectionBorder.node.style.cursor="move",this.update(!1)},mxOutline.prototype.isEnabled=function(){return this.enabled},mxOutline.prototype.setEnabled=function(e){this.enabled=e},mxOutline.prototype.setZoomEnabled=function(e){this.sizer.node.style.visibility=e?"visible":"hidden"},mxOutline.prototype.refresh=function(){this.update(!0)},mxOutline.prototype.createSizer=function(){var e=null!=this.sizerImage?new mxImageShape(new mxRectangle(0,0,this.sizerImage.width,this.sizerImage.height),this.sizerImage.src):new mxRectangleShape(new mxRectangle(0,0,this.sizerSize,this.sizerSize),mxConstants.OUTLINE_HANDLE_FILLCOLOR,mxConstants.OUTLINE_HANDLE_STROKECOLOR);return e.dialect=this.outline.dialect,e},mxOutline.prototype.getSourceContainerSize=function(){return new mxRectangle(0,0,this.source.container.scrollWidth,this.source.container.scrollHeight)},mxOutline.prototype.getOutlineOffset=function(e){return null},mxOutline.prototype.update=function(e){if(null!=this.source){var n=this.source.view.scale,t=new mxRectangle((t=this.source.getGraphBounds()).x/n+this.source.panDx,t.y/n+this.source.panDy,t.width/n,t.height/n),a=new mxRectangle(0,0,this.source.container.clientWidth/n,this.source.container.clientHeight/n);(s=t.clone()).add(a);var i=this.getSourceContainerSize(),s=(a=Math.max(i.width/n,s.width),n=Math.max(i.height/n,s.height),Math.max(0,this.outline.container.clientWidth-this.border));i=Math.max(0,this.outline.container.clientHeight-this.border);if(0<(s=Math.min(s/a,i/n))){this.outline.getView().scale!=s&&(this.outline.getView().scale=s,e=!0),(a=this.outline.getView()).currentRoot!=this.source.getView().currentRoot&&a.setCurrentRoot(this.source.getView().currentRoot);i=(n=this.source.view.translate).x+this.source.panDx;var o=n.y+this.source.panDy;null!=(s=this.getOutlineOffset(s))&&(i+=s.x,o+=s.y),t.x<0&&(i-=t.x),t.y<0&&(o-=t.y),a.translate.x==i&&a.translate.y==o||(a.translate.x=i,a.translate.y=o,e=!0);t=a.translate,i=(s=this.source.getView().scale)/a.scale,o=1/a.scale;var r=this.source.container;this.bounds=new mxRectangle((t.x-n.x-this.source.panDx)/o,(t.y-n.y-this.source.panDy)/o,r.clientWidth/i,r.clientHeight/i),this.bounds.x+=this.source.container.scrollLeft*a.scale/s,this.bounds.y+=this.source.container.scrollTop*a.scale/s,(t=this.selectionBorder.bounds).x==this.bounds.x&&t.y==this.bounds.y&&t.width==this.bounds.width&&t.height==this.bounds.height||(this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()),t=this.sizer.bounds,a=new mxRectangle(this.bounds.x+this.bounds.width-t.width/2,this.bounds.y+this.bounds.height-t.height/2,t.width,t.height),t.x==a.x&&t.y==a.y&&t.width==a.width&&t.height==a.height||(this.sizer.bounds=a,"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw()),e&&this.outline.view.revalidate()}}},mxOutline.prototype.mouseDown=function(e,n){this.enabled&&this.showViewport&&(this.zoom=n.isSource(this.sizer),this.startX=n.getX(),this.startY=n.getY(),this.active=!0,this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)?(this.dx0=this.source.container.scrollLeft,this.dy0=this.source.container.scrollTop):this.dy0=this.dx0=0),n.consume()},mxOutline.prototype.mouseMove=function(e,n){if(this.active){this.selectionBorder.node.style.display=this.showViewport?"":"none",this.sizer.node.style.display=this.selectionBorder.node.style.display;var t=n.getX()-this.startX,a=n.getY()-this.startY,i=null;if(this.zoom)a=t/((i=this.source.container).clientWidth/i.clientHeight),i=new mxRectangle(this.bounds.x,this.bounds.y,Math.max(1,this.bounds.width+t),Math.max(1,this.bounds.height+a)),this.selectionBorder.bounds=i,this.selectionBorder.redraw();else{var s=this.outline.getView().scale;i=new mxRectangle(this.bounds.x+t,this.bounds.y+a,this.bounds.width,this.bounds.height);this.selectionBorder.bounds=i,this.selectionBorder.redraw(),t=t/s*this.source.getView().scale,a=a/s*this.source.getView().scale,this.source.panGraph(-t-this.dx0,-a-this.dy0)}t=this.sizer.bounds,this.sizer.bounds=new mxRectangle(i.x+i.width-t.width/2,i.y+i.height-t.height/2,t.width,t.height),"hidden"!=this.sizer.node.style.visibility&&this.sizer.redraw(),n.consume()}},mxOutline.prototype.mouseUp=function(e,n){if(this.active){var t=n.getX()-this.startX,a=n.getY()-this.startY;if(0<Math.abs(t)||0<Math.abs(a)){if(this.zoom){a=this.selectionBorder.bounds.width;var i=this.source.getView().scale;this.source.zoomTo(i-t*i/a,!1)}else this.source.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.source.container)||(this.source.panGraph(0,0),t/=this.outline.getView().scale,a/=this.outline.getView().scale,i=this.source.getView().translate,this.source.getView().setTranslate(i.x-t,i.y-a));this.update(),n.consume()}this.index=null,this.active=!1}},mxOutline.prototype.destroy=function(){null!=this.source&&(this.source.removeListener(this.panHandler),this.source.removeListener(this.refreshHandler),this.source.getModel().removeListener(this.updateHandler),this.source.getView().removeListener(this.updateHandler),mxEvent.addListener(this.source.container,"scroll",this.updateHandler),this.source=null),null!=this.outline&&(this.outline.removeMouseListener(this),this.outline.destroy(),this.outline=null),null!=this.selectionBorder&&(this.selectionBorder.destroy(),this.selectionBorder=null),null!=this.sizer&&(this.sizer.destroy(),this.sizer=null)},mxMultiplicity.prototype.type=null,mxMultiplicity.prototype.attr=null,mxMultiplicity.prototype.value=null,mxMultiplicity.prototype.source=null,mxMultiplicity.prototype.min=null,mxMultiplicity.prototype.max=null,mxMultiplicity.prototype.validNeighbors=null,mxMultiplicity.prototype.validNeighborsAllowed=!0,mxMultiplicity.prototype.countError=null,mxMultiplicity.prototype.typeError=null,mxMultiplicity.prototype.check=function(e,n,t,a,i,s){var o="";return(this.source&&this.checkTerminal(e,t,n)||!this.source&&this.checkTerminal(e,a,n))&&(null!=this.countError&&(this.source&&(0==this.max||i>=this.max)||!this.source&&(0==this.max||s>=this.max))&&(o+=this.countError+"\n"),null!=this.validNeighbors&&null!=this.typeError&&0<this.validNeighbors.length&&(this.checkNeighbors(e,n,t,a)||(o+=this.typeError+"\n"))),0<o.length?o:null},mxMultiplicity.prototype.checkNeighbors=function(e,n,t,a){n=e.model.getValue(t),a=e.model.getValue(a),t=!this.validNeighborsAllowed;for(var i=this.validNeighbors,s=0;s<i.length;s++){if(this.source&&this.checkType(e,a,i[s])){t=this.validNeighborsAllowed;break}if(!this.source&&this.checkType(e,n,i[s])){t=this.validNeighborsAllowed;break}}return t},mxMultiplicity.prototype.checkTerminal=function(e,n,t){return n=e.model.getValue(n),this.checkType(e,n,this.type,this.attr,this.value)},mxMultiplicity.prototype.checkType=function(e,n,t,a,i){return null!=n&&(isNaN(n.nodeType)?n==t:mxUtils.isNode(n,t,a,i))},mxLayoutManager.prototype=new mxEventSource,mxLayoutManager.prototype.constructor=mxLayoutManager,mxLayoutManager.prototype.graph=null,mxLayoutManager.prototype.bubbling=!0,mxLayoutManager.prototype.enabled=!0,mxLayoutManager.prototype.updateHandler=null,mxLayoutManager.prototype.moveHandler=null,mxLayoutManager.prototype.isEnabled=function(){return this.enabled},mxLayoutManager.prototype.setEnabled=function(e){this.enabled=e},mxLayoutManager.prototype.isBubbling=function(){return this.bubbling},mxLayoutManager.prototype.setBubbling=function(e){this.bubbling=e},mxLayoutManager.prototype.getGraph=function(){return this.graph},mxLayoutManager.prototype.setGraph=function(e){if(null!=this.graph){var n=this.graph.getModel();n.removeListener(this.undoHandler),this.graph.removeListener(this.moveHandler)}this.graph=e,null!=this.graph&&((n=this.graph.getModel()).addListener(mxEvent.BEFORE_UNDO,this.undoHandler),this.graph.addListener(mxEvent.MOVE_CELLS,this.moveHandler))},mxLayoutManager.prototype.getLayout=function(e){return null},mxLayoutManager.prototype.beforeUndo=function(e){e=this.getCellsForChanges(e.changes);var n=this.getGraph().getModel();if(this.isBubbling())for(var t=n.getParents(e);0<t.length;)e=e.concat(t),t=n.getParents(t);this.layoutCells(mxUtils.sortCells(e,!1))},mxLayoutManager.prototype.cellsMoved=function(e,n){if(null!=e&&null!=n)for(var t=mxUtils.convertPoint(this.getGraph().container,mxEvent.getClientX(n),mxEvent.getClientY(n)),a=this.getGraph().getModel(),i=0;i<e.length;i++){var s=this.getLayout(a.getParent(e[i]));null!=s&&s.moveCell(e[i],t.x,t.y)}},mxLayoutManager.prototype.getCellsForChanges=function(e){for(var n=[],t={},a=0;a<e.length;a++){if((i=e[a])instanceof mxRootChange)return[];for(var i=this.getCellsForChange(i),s=0;s<i.length;s++)if(null!=i[s]){var o=mxCellPath.create(i[s]);null==t[o]&&(t[o]=i[s],n.push(i[s]))}}return n},mxLayoutManager.prototype.getCellsForChange=function(e){var n=this.getGraph().getModel();return e instanceof mxChildChange?[e.child,e.previous,n.getParent(e.child)]:e instanceof mxTerminalChange||e instanceof mxGeometryChange?[e.cell,n.getParent(e.cell)]:[]},mxLayoutManager.prototype.layoutCells=function(e){if(0<e.length){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=null,a=0;a<e.length;a++)e[a]!=n.getRoot()&&e[a]!=t&&(t=e[a],this.executeLayout(this.getLayout(t),t));this.fireEvent(new mxEventObject(mxEvent.LAYOUT_CELLS,"cells",e))}finally{n.endUpdate()}}},mxLayoutManager.prototype.executeLayout=function(e,n){null!=e&&null!=n&&e.execute(n)},mxLayoutManager.prototype.destroy=function(){this.setGraph(null)},mxSpaceManager.prototype=new mxEventSource,mxSpaceManager.prototype.constructor=mxSpaceManager,mxSpaceManager.prototype.graph=null,mxSpaceManager.prototype.enabled=!0,mxSpaceManager.prototype.shiftRightwards=!0,mxSpaceManager.prototype.shiftDownwards=!0,mxSpaceManager.prototype.extendParents=!0,mxSpaceManager.prototype.resizeHandler=null,mxSpaceManager.prototype.foldHandler=null,mxSpaceManager.prototype.isCellIgnored=function(e){return!this.getGraph().getModel().isVertex(e)},mxSpaceManager.prototype.isCellShiftable=function(e){return this.getGraph().getModel().isVertex(e)&&this.getGraph().isCellMovable(e)},mxSpaceManager.prototype.isEnabled=function(){return this.enabled},mxSpaceManager.prototype.setEnabled=function(e){this.enabled=e},mxSpaceManager.prototype.isShiftRightwards=function(){return this.shiftRightwards},mxSpaceManager.prototype.setShiftRightwards=function(e){this.shiftRightwards=e},mxSpaceManager.prototype.isShiftDownwards=function(){return this.shiftDownwards},mxSpaceManager.prototype.setShiftDownwards=function(e){this.shiftDownwards=e},mxSpaceManager.prototype.isExtendParents=function(){return this.extendParents},mxSpaceManager.prototype.setExtendParents=function(e){this.extendParents=e},mxSpaceManager.prototype.getGraph=function(){return this.graph},mxSpaceManager.prototype.setGraph=function(e){null!=this.graph&&(this.graph.removeListener(this.resizeHandler),this.graph.removeListener(this.foldHandler)),this.graph=e,null!=this.graph&&(this.graph.addListener(mxEvent.RESIZE_CELLS,this.resizeHandler),this.graph.addListener(mxEvent.FOLD_CELLS,this.foldHandler))},mxSpaceManager.prototype.cellsResized=function(e){if(null!=e){var n=this.graph.getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)if(!this.isCellIgnored(e[t])){this.cellResized(e[t]);break}}finally{n.endUpdate()}}},mxSpaceManager.prototype.cellResized=function(e){var n=this.getGraph(),t=n.getView(),a=n.getModel(),i=t.getState(e),s=t.getState(a.getParent(e));if(null!=i&&null!=s){var o=this.getCellsToShift(i),r=a.getGeometry(e);if(null!=o&&null!=r){var l=t.translate,d=t.scale,c=(t=i.x-s.origin.x-l.x*d,s=i.y-s.origin.y-l.y*d,l=i.x+i.width,i.y+i.height),m=i.width-r.width*d+t-r.x*d,u=i.height-r.height*d+s-r.y*d,p=1-r.width*d/i.width;i=1-r.height*d/i.height;a.beginUpdate();try{for(r=0;r<o.length;r++)o[r]!=e&&this.isCellShiftable(o[r])&&this.shiftCell(o[r],m,u,t,s,l,c,p,i,this.isExtendParents()&&n.isExtendParent(o[r]))}finally{a.endUpdate()}}}},mxSpaceManager.prototype.shiftCell=function(e,n,t,a,i,s,o,r,l,d){var c=(a=this.getGraph()).getView().getState(e);if(null!=c){var m=a.getModel();if(null!=(p=m.getGeometry(e))){m.beginUpdate();try{if(this.isShiftRightwards())if(c.x>=s)(p=p.clone()).translate(-n,0);else{var u=Math.max(0,c.x-x0);(p=p.clone()).translate(-r*u,0)}if(this.isShiftDownwards())if(c.y>=o)(p=p.clone()).translate(0,-t);else{var p,g=Math.max(0,c.y-i);(p=p.clone()).translate(0,-l*g)}p!=m.getGeometry(e)&&(m.setGeometry(e,p),d&&a.extendParent(e))}finally{m.endUpdate()}}}},mxSpaceManager.prototype.getCellsToShift=function(e){var n=this.getGraph(),t=n.getModel().getParent(e.cell),a=this.isShiftDownwards(),i=this.isShiftRightwards();return n.getCellsBeyond(e.x+(a?0:e.width),e.y+(a&&i?0:e.height),t,i,a)},mxSpaceManager.prototype.destroy=function(){this.setGraph(null)},mxSwimlaneManager.prototype=new mxEventSource,mxSwimlaneManager.prototype.constructor=mxSwimlaneManager,mxSwimlaneManager.prototype.graph=null,mxSwimlaneManager.prototype.enabled=!0,mxSwimlaneManager.prototype.horizontal=!0,mxSwimlaneManager.prototype.addEnabled=!0,mxSwimlaneManager.prototype.resizeEnabled=!0,mxSwimlaneManager.prototype.addHandler=null,mxSwimlaneManager.prototype.resizeHandler=null,mxSwimlaneManager.prototype.isEnabled=function(){return this.enabled},mxSwimlaneManager.prototype.setEnabled=function(e){this.enabled=e},mxSwimlaneManager.prototype.isHorizontal=function(){return this.horizontal},mxSwimlaneManager.prototype.setHorizontal=function(e){this.horizontal=e},mxSwimlaneManager.prototype.isAddEnabled=function(){return this.addEnabled},mxSwimlaneManager.prototype.setAddEnabled=function(e){this.addEnabled=e},mxSwimlaneManager.prototype.isResizeEnabled=function(){return this.resizeEnabled},mxSwimlaneManager.prototype.setResizeEnabled=function(e){this.resizeEnabled=e},mxSwimlaneManager.prototype.getGraph=function(){return this.graph},mxSwimlaneManager.prototype.setGraph=function(e){null!=this.graph&&(this.graph.removeListener(this.addHandler),this.graph.removeListener(this.resizeHandler)),this.graph=e,null!=this.graph&&(this.graph.addListener(mxEvent.ADD_CELLS,this.addHandler),this.graph.addListener(mxEvent.CELLS_RESIZED,this.resizeHandler))},mxSwimlaneManager.prototype.isSwimlaneIgnored=function(e){return!this.getGraph().isSwimlane(e)},mxSwimlaneManager.prototype.isCellHorizontal=function(e){if(this.graph.isSwimlane(e)){var n=this.graph.view.getState(e);return e=null!=n?n.style:this.graph.getCellStyle(e),1==mxUtils.getValue(e,mxConstants.STYLE_HORIZONTAL,1)}return!this.isHorizontal()},mxSwimlaneManager.prototype.cellsAdded=function(e){if(null!=e){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)this.isSwimlaneIgnored(e[t])||this.swimlaneAdded(e[t])}finally{n.endUpdate()}}},mxSwimlaneManager.prototype.swimlaneAdded=function(e){for(var n=this.getGraph().getModel(),t=n.getParent(e),a=n.getChildCount(t),i=null,s=0;s<a;s++){var o=n.getChildAt(t,s);if(o!=e&&!this.isSwimlaneIgnored(o)&&null!=(i=n.getGeometry(o)))break}null!=i&&this.resizeSwimlane(e,i.width,i.height)},mxSwimlaneManager.prototype.cellsResized=function(e){if(null!=e){var n=this.getGraph().getModel();n.beginUpdate();try{for(var t=0;t<e.length;t++)if(!this.isSwimlaneIgnored(e[t])){var a=n.getGeometry(e[t]);if(null!=a){for(var i=new mxRectangle(0,0,a.width,a.height),s=o=e[t];null!=s;){var o=s,r=(s=n.getParent(s),this.graph.isSwimlane(s)?this.graph.getStartSize(s):new mxRectangle);i.width+=r.width,i.height+=r.height}this.resizeSwimlane(o,i.width,i.height)}}}finally{n.endUpdate()}}},mxSwimlaneManager.prototype.resizeSwimlane=function(e,n,t){var a=this.getGraph().getModel();a.beginUpdate();try{if(!this.isSwimlaneIgnored(e))if(null!=(r=a.getGeometry(e))){var i=this.isCellHorizontal(e);(i&&r.height!=t||!i&&r.width!=n)&&(r=r.clone(),i?r.height=t:r.width=n,a.setGeometry(e,r))}var s=this.graph.isSwimlane(e)?this.graph.getStartSize(e):new mxRectangle;n-=s.width,t-=s.height;for(var o=a.getChildCount(e),r=0;r<o;r++){var l=a.getChildAt(e,r);this.resizeSwimlane(l,n,t)}}finally{a.endUpdate()}},mxSwimlaneManager.prototype.destroy=function(){this.setGraph(null)},mxTemporaryCellStates.prototype.view=null,mxTemporaryCellStates.prototype.oldStates=null,mxTemporaryCellStates.prototype.oldBounds=null,mxTemporaryCellStates.prototype.oldScale=null,mxTemporaryCellStates.prototype.destroy=function(){this.view.setScale(this.oldScale),this.view.setStates(this.oldStates),this.view.setGraphBounds(this.oldBounds)},mxCellStatePreview.prototype.graph=null,mxCellStatePreview.prototype.deltas=null,mxCellStatePreview.prototype.count=0,mxCellStatePreview.prototype.isEmpty=function(){return 0==this.count},mxCellStatePreview.prototype.moveState=function(e,n,t,a,i){a=null==a||a,i=null==i||i;var s=mxCellPath.create(e.cell),o=this.deltas[s];return null==o?(o=new mxPoint(n,t),this.deltas[s]=o,this.count++):a?(o.X+=n,o.Y+=t):(o.X=n,o.Y=t),i&&this.addEdges(e),o},mxCellStatePreview.prototype.show=function(e){var n,t=this.graph.getModel(),a=t.getRoot();for(n in this.deltas){var i=mxCellPath.resolve(a,n),s=this.graph.view.getState(i),o=this.deltas[n];i=this.graph.view.getState(t.getParent(i));this.translateState(i,s,o.x,o.y)}for(n in this.deltas)i=mxCellPath.resolve(a,n),s=this.graph.view.getState(i),o=this.deltas[n],i=this.graph.view.getState(t.getParent(i)),this.revalidateState(i,s,o.x,o.y,e)},mxCellStatePreview.prototype.translateState=function(e,n,t,a){if(null!=n){var i=this.graph.getModel();if(i.isVertex(n.cell)){n.invalid=!0,this.graph.view.validateBounds(e,n.cell),e=i.getGeometry(n.cell);var s=mxCellPath.create(n.cell);0==t&&0==a||null==e||e.relative&&null==this.deltas[s]||(n.x+=t,n.y+=a)}for(e=i.getChildCount(n.cell),s=0;s<e;s++)this.translateState(n,this.graph.view.getState(i.getChildAt(n.cell,s)),t,a)}},mxCellStatePreview.prototype.revalidateState=function(e,n,t,a,i){if(null!=n){n.invalid=!0,this.graph.view.validatePoints(e,n.cell);var s=mxCellPath.create(n.cell),o=this.graph.getModel(),r=this.graph.getCellGeometry(n.cell);for(0==t&&0==a||null==r||!r.relative||!o.isVertex(n.cell)||null!=e&&!o.isVertex(e.cell)&&null==this.deltas[s]||(n.x+=t,n.y+=a,this.graph.cellRenderer.redraw(n)),null!=i&&i(n),e=o.getChildCount(n.cell),s=0;s<e;s++)this.revalidateState(n,this.graph.view.getState(o.getChildAt(n.cell,s)),t,a,i)}},mxCellStatePreview.prototype.addEdges=function(e){for(var n=this.graph.getModel(),t=n.getEdgeCount(e.cell),a=0;a<t;a++){var i=this.graph.view.getState(n.getEdgeAt(e.cell,a));null!=i&&this.moveState(i,0,0)}},mxConnectionConstraint.prototype.point=null,mxConnectionConstraint.prototype.perimeter=null,mxGraphHandler.prototype.graph=null,mxGraphHandler.prototype.maxCells=mxClient.IS_IE?20:50,mxGraphHandler.prototype.enabled=!0,mxGraphHandler.prototype.highlightEnabled=!0,mxGraphHandler.prototype.cloneEnabled=!0,mxGraphHandler.prototype.moveEnabled=!0,mxGraphHandler.prototype.guidesEnabled=!1,mxGraphHandler.prototype.guide=null,mxGraphHandler.prototype.currentDx=null,mxGraphHandler.prototype.currentDy=null,mxGraphHandler.prototype.updateCursor=!0,mxGraphHandler.prototype.selectEnabled=!0,mxGraphHandler.prototype.removeCellsFromParent=!0,mxGraphHandler.prototype.connectOnDrop=!1,mxGraphHandler.prototype.scrollOnMove=!0,mxGraphHandler.prototype.minimumSize=6,mxGraphHandler.prototype.previewColor="black",mxGraphHandler.prototype.htmlPreview=!1,mxGraphHandler.prototype.shape=null,mxGraphHandler.prototype.scaleGrid=!1,mxGraphHandler.prototype.rotationEnabled=!0,mxGraphHandler.prototype.isEnabled=function(){return this.enabled},mxGraphHandler.prototype.setEnabled=function(e){this.enabled=e},mxGraphHandler.prototype.isCloneEnabled=function(){return this.cloneEnabled},mxGraphHandler.prototype.setCloneEnabled=function(e){this.cloneEnabled=e},mxGraphHandler.prototype.isMoveEnabled=function(){return this.moveEnabled},mxGraphHandler.prototype.setMoveEnabled=function(e){this.moveEnabled=e},mxGraphHandler.prototype.isSelectEnabled=function(){return this.selectEnabled},mxGraphHandler.prototype.setSelectEnabled=function(e){this.selectEnabled=e},mxGraphHandler.prototype.isRemoveCellsFromParent=function(){return this.removeCellsFromParent},mxGraphHandler.prototype.setRemoveCellsFromParent=function(e){this.removeCellsFromParent=e},mxGraphHandler.prototype.getInitialCellForEvent=function(e){return e.getCell()},mxGraphHandler.prototype.isDelayedSelection=function(e){return this.graph.isCellSelected(e)},mxGraphHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&null!=n.getState()){var t=this.getInitialCellForEvent(n);if(this.cell=null,this.delayedSelection=this.isDelayedSelection(t),this.isSelectEnabled()&&!this.delayedSelection&&this.graph.selectCellForEvent(t,n.getEvent()),this.isMoveEnabled()){var a=this.graph.model,i=a.getGeometry(t);this.graph.isCellMovable(t)&&(!a.isEdge(t)||1<this.graph.getSelectionCount()||null!=i.points&&0<i.points.length||null==a.getTerminal(t,!0)||null==a.getTerminal(t,!1)||this.graph.allowDanglingEdges||this.graph.isCloneEvent(n.getEvent())&&this.graph.isCellsCloneable())&&this.start(t,n.getX(),n.getY()),this.cellWasClicked=!0,!mxClient.IS_SF&&!mxClient.IS_GC||"SELECT"!=n.getSource().nodeName?n.consume():mxClient.IS_SF&&"SELECT"==n.getSource().nodeName&&(this.cellWasClicked=!1,this.first=null)}}},mxGraphHandler.prototype.getGuideStates=function(){var e=this.graph.getDefaultParent(),n=this.graph.getModel(),t=mxUtils.bind(this,function(e){return null!=this.graph.view.getState(e)&&n.isVertex(e)&&null!=n.getGeometry(e)&&!n.getGeometry(e).relative});return this.graph.view.getCellStates(n.filterDescendants(t,e))},mxGraphHandler.prototype.getCells=function(e){return!this.delayedSelection&&this.graph.isCellMovable(e)?[e]:this.graph.getMovableCells(this.graph.getSelectionCells())},mxGraphHandler.prototype.getPreviewBounds=function(e){return null!=(e=this.getBoundingBox(e))&&(e.grow(-1,-1),e.width<this.minimumSize&&(e.x-=(this.minimumSize-e.width)/2,e.width=this.minimumSize),e.height<this.minimumSize&&(e.y-=(this.minimumSize-e.height)/2,e.height=this.minimumSize)),e},mxGraphHandler.prototype.getBoundingBox=function(e){var n=null;if(null!=e&&0<e.length)for(var t=this.graph.getModel(),a=0;a<e.length;a++)if(t.isVertex(e[a])||t.isEdge(e[a])){var i=this.graph.view.getState(e[a]);if(null!=i){var s=i;t.isVertex(e[a])&&null!=i.shape&&null!=i.shape.boundingBox&&(s=i.shape.boundingBox),null==n?n=new mxRectangle(s.x,s.y,s.width,s.height):n.add(s)}}return n},mxGraphHandler.prototype.createPreviewShape=function(e){return(e=new mxRectangleShape(e,null,this.previewColor)).isDashed=!0,this.htmlPreview?(e.dialect=mxConstants.DIALECT_STRICTHTML,e.init(this.graph.container)):(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),e.pointerEvents=!1),e},mxGraphHandler.prototype.start=function(e,n,t){this.cell=e,this.first=mxUtils.convertPoint(this.graph.container,n,t),this.cells=this.getCells(this.cell),this.bounds=this.graph.getView().getBounds(this.cells),this.pBounds=this.getPreviewBounds(this.cells),this.guidesEnabled&&(this.guide=new mxGuide(this.graph,this.getGuideStates()))},mxGraphHandler.prototype.useGuidesForEvent=function(e){return null==this.guide||this.guide.isEnabledForEvent(e.getEvent())},mxGraphHandler.prototype.snap=function(e){var n=this.scaleGrid?this.graph.view.scale:1;return e.x=this.graph.snap(e.x/n)*n,e.y=this.graph.snap(e.y/n)*n,e},mxGraphHandler.prototype.mouseMove=function(e,n){var t=this.graph;if(!n.isConsumed()&&t.isMouseDown&&null!=this.cell&&null!=this.first&&null!=this.bounds){var a=(s=mxUtils.convertPoint(t.container,n.getX(),n.getY())).x-this.first.x,i=s.y-this.first.y,s=t.tolerance;if(null!=this.shape||Math.abs(a)>s||Math.abs(i)>s){null==this.highlight&&(this.highlight=new mxCellHighlight(this.graph,mxConstants.DROP_TARGET_COLOR,3)),null==this.shape&&(this.shape=this.createPreviewShape(this.bounds));var o=t.isGridEnabledEvent(n.getEvent());s=!0;if(null!=this.guide&&this.useGuidesForEvent(n))s=!1,a=(i=this.guide.move(this.bounds,new mxPoint(a,i),o)).x,i=i.y;else if(o){var r=t.getView().translate,l=t.getView().scale;o=this.bounds.x-(t.snap(this.bounds.x/l-r.x)+r.x)*l,r=this.bounds.y-(t.snap(this.bounds.y/l-r.y)+r.y)*l,a=(i=this.snap(new mxPoint(a,i))).x-o,i=i.y-r}for(null!=this.guide&&s&&this.guide.hide(),t.isConstrainedEvent(n.getEvent())&&(Math.abs(a)>Math.abs(i)?i=0:a=0),this.currentDx=a,this.currentDy=i,this.updatePreviewShape(),s=null,i=n.getCell(),t.isDropEnabled()&&this.highlightEnabled&&(s=t.getDropTarget(this.cells,n.getEvent(),i)),o=s,r=t.getModel();null!=o&&o!=this.cells[0];)o=r.getParent(o);l=t.isCloneEvent(n.getEvent())&&t.isCellsCloneable()&&this.isCloneEnabled();var d=!1;null==(a=t.getView().getState(s))||null!=o||r.getParent(this.cell)==s&&!l?(this.target=null,this.connectOnDrop&&null!=i&&1==this.cells.length&&t.getModel().isVertex(i)&&t.isCellConnectable(i)&&(null!=(a=t.getView().getState(i))&&(t=null==t.getEdgeValidationError(null,this.cell,i)?mxConstants.VALID_COLOR:mxConstants.INVALID_CONNECT_TARGET_COLOR,this.setHighlightColor(t),d=!0))):(this.target!=s&&(this.target=s,this.setHighlightColor(mxConstants.DROP_TARGET_COLOR)),d=!0),null!=a&&d?this.highlight.highlight(a):this.highlight.hide()}n.consume(),mxEvent.consume(n.getEvent())}else!this.isMoveEnabled()&&!this.isCloneEnabled()||!this.updateCursor||n.isConsumed()||null==n.getState()||t.isMouseDown||(null==(a=t.getCursorForCell(n.getCell()))&&t.isEnabled()&&t.isCellMovable(n.getCell())&&(a=t.getModel().isEdge(n.getCell())?mxConstants.CURSOR_MOVABLE_EDGE:mxConstants.CURSOR_MOVABLE_VERTEX),n.getState().setCursor(a),n.consume())},mxGraphHandler.prototype.updatePreviewShape=function(){null!=this.shape&&(this.shape.bounds=new mxRectangle(Math.round(this.pBounds.x+this.currentDx-this.graph.panDx),Math.round(this.pBounds.y+this.currentDy-this.graph.panDy),this.pBounds.width,this.pBounds.height),this.shape.redraw())},mxGraphHandler.prototype.setHighlightColor=function(e){null!=this.highlight&&this.highlight.setHighlightColor(e)},mxGraphHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()){var t=this.graph;if(null!=this.cell&&null!=this.first&&null!=this.shape&&null!=this.currentDx&&null!=this.currentDy){var a=t.getView().scale,i=t.isCloneEvent(n.getEvent())&&t.isCellsCloneable()&&this.isCloneEnabled(),s=this.currentDx/a,o=(a=this.currentDy/a,n.getCell());this.connectOnDrop&&null==this.target&&null!=o&&t.getModel().isVertex(o)&&t.isCellConnectable(o)&&t.isEdgeValid(null,this.cell,o)?t.connectionHandler.connect(this.cell,o,n.getEvent()):(o=this.target,t.isSplitEnabled()&&t.isSplitTarget(o,this.cells,n.getEvent())?t.splitEdge(o,this.cells,null,s,a):this.moveCells(this.cells,s,a,i,this.target,n.getEvent()))}else this.isSelectEnabled()&&this.delayedSelection&&null!=this.cell&&this.selectDelayed(n)}this.cellWasClicked&&n.consume(),this.reset()},mxGraphHandler.prototype.selectDelayed=function(e){this.graph.selectCellForEvent(this.cell,e.getEvent())},mxGraphHandler.prototype.reset=function(){this.destroyShapes(),this.delayedSelection=this.cellWasClicked=!1,this.target=this.cell=this.first=this.guides=this.currentDy=this.currentDx=null},mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(e,n,t){if(this.graph.getModel().isVertex(e)){if(e=this.graph.getView().getState(e),t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(t),mxEvent.getClientY(t)),0!=(a=mxUtils.toRadians(mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION)||0))){n=Math.cos(-a);var a=Math.sin(-a),i=new mxPoint(e.getCenterX(),e.getCenterY());t=mxUtils.getRotatedPoint(t,n,a,i)}return null!=e&&!mxUtils.contains(e,t.x,t.y)}return!1},mxGraphHandler.prototype.moveCells=function(e,n,t,a,i,s){a&&(e=this.graph.getCloneableCells(e)),null==i&&this.isRemoveCellsFromParent()&&this.shouldRemoveCellsFromParent(this.graph.getModel().getParent(this.cell),e,s)&&(i=this.graph.getDefaultParent()),e=this.graph.moveCells(e,n-this.graph.panDx/this.graph.view.scale,t-this.graph.panDy/this.graph.view.scale,a,i,s),this.isSelectEnabled()&&this.scrollOnMove&&this.graph.scrollCellToVisible(e[0]),a&&this.graph.setSelectionCells(e)},mxGraphHandler.prototype.destroyShapes=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.guide&&(this.guide.destroy(),this.guide=null),null!=this.highlight&&(this.highlight.destroy(),this.highlight=null)},mxGraphHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),this.graph.removeListener(this.panHandler),this.destroyShapes()},mxPanningHandler.prototype=new mxPopupMenu,mxPanningHandler.prototype.constructor=mxPanningHandler,mxPanningHandler.prototype.graph=null,mxPanningHandler.prototype.triggerX=null,mxPanningHandler.prototype.triggerY=null,mxPanningHandler.prototype.usePopupTrigger=!0,mxPanningHandler.prototype.useLeftButtonForPanning=!1,mxPanningHandler.prototype.selectOnPopup=!0,mxPanningHandler.prototype.clearSelectionOnBackground=!0,mxPanningHandler.prototype.ignoreCell=!1,mxPanningHandler.prototype.previewEnabled=!0,mxPanningHandler.prototype.useGrid=!1,mxPanningHandler.prototype.panningEnabled=!0,mxPanningHandler.prototype.isPanningEnabled=function(){return this.panningEnabled},mxPanningHandler.prototype.setPanningEnabled=function(e){this.panningEnabled=e},mxPanningHandler.prototype.init=function(){mxPopupMenu.prototype.init.apply(this),mxEvent.addListener(this.div,mxClient.IS_TOUCH?"touchmove":"mousemove",mxUtils.bind(this,function(e){this.graph.tooltipHandler.hide()}))},mxPanningHandler.prototype.isPanningTrigger=function(e){var n=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())&&mxEvent.isLeftMouseButton(n)||mxEvent.isControlDown(n)&&mxEvent.isShiftDown(n)||this.usePopupTrigger&&mxEvent.isPopupTrigger(n)},mxPanningHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()){this.hideMenu(),this.dx0=-this.graph.container.scrollLeft,this.dy0=-this.graph.container.scrollTop;var t=mxUtils.convertPoint(this.graph.container,n.getX(),n.getY());this.triggerX=t.x,this.triggerY=t.y,this.popupTrigger=this.isPopupTrigger(n),this.panningTrigger=this.isPanningEnabled()&&this.isPanningTrigger(n),this.startX=n.getX(),this.startY=n.getY(),this.panningTrigger&&this.consumePanningTrigger(n)}},mxPanningHandler.prototype.consumePanningTrigger=function(e){e.consume()},mxPanningHandler.prototype.mouseMove=function(e,n){var t=n.getX()-this.startX,a=n.getY()-this.startY;if(this.active)this.previewEnabled&&(this.useGrid&&(t=this.graph.snap(t),a=this.graph.snap(a)),this.graph.panGraph(t+this.dx0,a+this.dy0)),this.fireEvent(new mxEventObject(mxEvent.PAN,"event",n)),n.consume();else if(this.panningTrigger){var i=this.active;this.active=Math.abs(t)>this.graph.tolerance||Math.abs(a)>this.graph.tolerance,!i&&this.active&&this.fireEvent(new mxEventObject(mxEvent.PAN_START,"event",n))}},mxPanningHandler.prototype.mouseUp=function(e,n){var t=Math.abs(n.getX()-this.startX),a=Math.abs(n.getY()-this.startY);if(this.active){if(!this.graph.useScrollbarsForPanning||!mxUtils.hasScrollbars(this.graph.container)){t=n.getX()-this.startX,a=n.getY()-this.startY,this.useGrid&&(t=this.graph.snap(t),a=this.graph.snap(a));var i=this.graph.getView().scale,s=this.graph.getView().translate;this.graph.panGraph(0,0),this.panGraph(s.x+t/i,s.y+a/i)}this.active=!1,this.fireEvent(new mxEventObject(mxEvent.PAN_END,"event",n)),n.consume()}else this.popupTrigger&&t<this.graph.tolerance&&a<this.graph.tolerance&&(t=this.getCellForPopupEvent(n),this.graph.isEnabled()&&this.selectOnPopup&&null!=t&&!this.graph.isCellSelected(t)?this.graph.setSelectionCell(t):this.clearSelectionOnBackground&&null==t&&this.graph.clearSelection(),this.graph.tooltipHandler.hide(),a=mxUtils.getScrollOrigin(),a=new mxPoint(n.getX()+a.x,n.getY()+a.y),this.popup(a.x+1,a.y+1,t,n.getEvent()),n.consume());this.popupTrigger=this.panningTrigger=!1},mxPanningHandler.prototype.getCellForPopupEvent=function(e){return e.getCell()},mxPanningHandler.prototype.panGraph=function(e,n){this.graph.getView().setTranslate(e,n)},mxPanningHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),mxPopupMenu.prototype.destroy.apply(this)},mxUtils.extend(mxCellMarker,mxEventSource),mxCellMarker.prototype.graph=null,mxCellMarker.prototype.enabled=!0,mxCellMarker.prototype.hotspot=mxConstants.DEFAULT_HOTSPOT,mxCellMarker.prototype.hotspotEnabled=!1,mxCellMarker.prototype.validColor=null,mxCellMarker.prototype.invalidColor=null,mxCellMarker.prototype.currentColor=null,mxCellMarker.prototype.validState=null,mxCellMarker.prototype.markedState=null,mxCellMarker.prototype.setEnabled=function(e){this.enabled=e},mxCellMarker.prototype.isEnabled=function(){return this.enabled},mxCellMarker.prototype.setHotspot=function(e){this.hotspot=e},mxCellMarker.prototype.getHotspot=function(){return this.hotspot},mxCellMarker.prototype.setHotspotEnabled=function(e){this.hotspotEnabled=e},mxCellMarker.prototype.isHotspotEnabled=function(){return this.hotspotEnabled},mxCellMarker.prototype.hasValidState=function(){return null!=this.validState},mxCellMarker.prototype.getValidState=function(){return this.validState},mxCellMarker.prototype.getMarkedState=function(){return this.markedState},mxCellMarker.prototype.reset=function(){(this.validState=null)!=this.markedState&&(this.markedState=null,this.unmark())},mxCellMarker.prototype.process=function(e){var n=null;if(this.isEnabled()){var t=null!=(n=this.getState(e))&&this.isValidState(n);e=this.getMarkerColor(e.getEvent(),n,t),this.validState=t?n:null,n==this.markedState&&e==this.currentColor||(this.currentColor=e,null!=n&&null!=this.currentColor?(this.markedState=n,this.mark()):null!=this.markedState&&(this.markedState=null,this.unmark()))}return n},mxCellMarker.prototype.markCell=function(e,n){var t=this.graph.getView().getState(e);null!=t&&(this.currentColor=null!=n?n:this.validColor,this.markedState=t,this.mark())},mxCellMarker.prototype.mark=function(){this.highlight.setHighlightColor(this.currentColor),this.highlight.highlight(this.markedState),this.fireEvent(new mxEventObject(mxEvent.MARK,"state",this.markedState))},mxCellMarker.prototype.unmark=function(){this.mark()},mxCellMarker.prototype.isValidState=function(e){return!0},mxCellMarker.prototype.getMarkerColor=function(e,n,t){return t?this.validColor:this.invalidColor},mxCellMarker.prototype.getState=function(e){var n=this.graph.getView();return cell=this.getCell(e),null!=(n=this.getStateToMark(n.getState(cell)))&&this.intersects(n,e)?n:null},mxCellMarker.prototype.getCell=function(e){return e.getCell()},mxCellMarker.prototype.getStateToMark=function(e){return e},mxCellMarker.prototype.intersects=function(e,n){return!this.hotspotEnabled||mxUtils.intersectsHotspot(e,n.getGraphX(),n.getGraphY(),this.hotspot,mxConstants.MIN_HOTSPOT_SIZE,mxConstants.MAX_HOTSPOT_SIZE)},mxCellMarker.prototype.destroy=function(){this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),this.highlight.destroy()},mxUtils.extend(mxSelectionCellsHandler,mxEventSource),mxSelectionCellsHandler.prototype.graph=null,mxSelectionCellsHandler.prototype.enabled=!0,mxSelectionCellsHandler.prototype.refreshHandler=null,mxSelectionCellsHandler.prototype.maxHandlers=100,mxSelectionCellsHandler.prototype.handlers=null,mxSelectionCellsHandler.prototype.isEnabled=function(){return this.enabled},mxSelectionCellsHandler.prototype.setEnabled=function(e){this.enabled=e},mxSelectionCellsHandler.prototype.getHandler=function(e){return this.handlers.get(e)},mxSelectionCellsHandler.prototype.reset=function(){this.handlers.visit(function(e,n){n.reset.apply(n)})},mxSelectionCellsHandler.prototype.refresh=function(){var e=this.handlers;this.handlers=new mxDictionary;for(var n=this.graph.getSelectionCells(),t=0;t<n.length;t++){var a=this.graph.view.getState(n[t]);if(null!=a){var i=e.remove(n[t]);null!=i&&(i.state!=a?(i.destroy(),i=null):i.redraw()),null==i&&(i=this.graph.createHandler(a),this.fireEvent(new mxEventObject(mxEvent.ADD,"state",a))),null!=i&&this.handlers.put(n[t],i)}}e.visit(mxUtils.bind(this,function(e,n){this.fireEvent(new mxEventObject(mxEvent.REMOVE,"state",n.state)),n.destroy()}))},mxSelectionCellsHandler.prototype.mouseDown=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseDown.apply(n,t)})}},mxSelectionCellsHandler.prototype.mouseMove=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseMove.apply(n,t)})}},mxSelectionCellsHandler.prototype.mouseUp=function(e,n){if(this.graph.isEnabled()&&this.isEnabled()){var t=[e,n];this.handlers.visit(function(e,n){n.mouseUp.apply(n,t)})}},mxSelectionCellsHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.refreshHandler&&(this.graph.getSelectionModel().removeListener(this.refreshHandler),this.graph.getModel().removeListener(this.refreshHandler),this.graph.getView().removeListener(this.refreshHandler),this.refreshHandler=null)},mxUtils.extend(mxConnectionHandler,mxEventSource),mxConnectionHandler.prototype.graph=null,mxConnectionHandler.prototype.factoryMethod=!0,mxConnectionHandler.prototype.moveIconFront=!1,mxConnectionHandler.prototype.moveIconBack=!1,mxConnectionHandler.prototype.connectImage=null,mxConnectionHandler.prototype.targetConnectImage=!1,mxConnectionHandler.prototype.enabled=!0,mxConnectionHandler.prototype.select=!0,mxConnectionHandler.prototype.createTarget=!1;mxConnectionHandler.prototype.marker=null,mxConnectionHandler.prototype.constraintHandler=null,mxConnectionHandler.prototype.error=null,mxConnectionHandler.prototype.waypointsEnabled=!1,mxConnectionHandler.prototype.tapAndHoldEnabled=!0,mxConnectionHandler.prototype.tapAndHoldDelay=500,mxConnectionHandler.prototype.tapAndHoldInProgress=!1,mxConnectionHandler.prototype.tapAndHoldValid=!1,mxConnectionHandler.prototype.tapAndHoldTolerance=4,mxConnectionHandler.prototype.initialTouchX=0,mxConnectionHandler.prototype.initialTouchY=0,mxConnectionHandler.prototype.ignoreMouseDown=!1,mxConnectionHandler.prototype.first=null,mxConnectionHandler.prototype.connectIconOffset=new mxPoint(0,mxConstants.TOOLTIP_VERTICAL_OFFSET),mxConnectionHandler.prototype.edgeState=null,mxConnectionHandler.prototype.changeHandler=null,mxConnectionHandler.prototype.drillHandler=null,mxConnectionHandler.prototype.mouseDownCounter=0,mxConnectionHandler.prototype.movePreviewAway=mxClient.IS_VML,mxConnectionHandler.prototype.isEnabled=function(){return this.enabled},mxConnectionHandler.prototype.setEnabled=function(e){this.enabled=e},mxConnectionHandler.prototype.isCreateTarget=function(){return this.createTarget},mxConnectionHandler.prototype.setCreateTarget=function(e){this.createTarget=e},mxConnectionHandler.prototype.createShape=function(){var e=new mxPolyline([],mxConstants.INVALID_COLOR);if(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),e.svgStrokeTolerance=0,e.pointerEvents=!1,e.isDashed=!0,this.graph.dialect==mxConstants.DIALECT_SVG)e.node.setAttribute("pointer-events","none");else{var n=mxUtils.bind(this,function(e){return e=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),this.graph.view.getState(this.graph.getCellAt(e.x,e.y))});mxEvent.redirectMouseEvents(e.node,this.graph,n)}return e},mxConnectionHandler.prototype.init=function(){this.graph.addMouseListener(this),this.marker=this.createMarker(),this.constraintHandler=new mxConstraintHandler(this.graph),this.changeHandler=mxUtils.bind(this,function(e){null!=this.iconState&&(this.iconState=this.graph.getView().getState(this.iconState.cell)),null!=this.iconState?this.redrawIcons(this.icons,this.iconState):(this.destroyIcons(this.icons),this.previous=null),this.constraintHandler.reset()}),this.graph.getModel().addListener(mxEvent.CHANGE,this.changeHandler),this.graph.getView().addListener(mxEvent.SCALE,this.changeHandler),this.graph.getView().addListener(mxEvent.TRANSLATE,this.changeHandler),this.graph.getView().addListener(mxEvent.SCALE_AND_TRANSLATE,this.changeHandler),this.drillHandler=mxUtils.bind(this,function(e){this.destroyIcons(this.icons)}),this.graph.addListener(mxEvent.START_EDITING,this.drillHandler),this.graph.getView().addListener(mxEvent.DOWN,this.drillHandler),this.graph.getView().addListener(mxEvent.UP,this.drillHandler)},mxConnectionHandler.prototype.isConnectableCell=function(e){return!0},mxConnectionHandler.prototype.createMarker=function(){var a=new mxCellMarker(this.graph);return a.hotspotEnabled=!0,a.getCell=mxUtils.bind(this,function(e,n){return n=mxCellMarker.prototype.getCell.apply(a,arguments),this.error=null,this.isConnectableCell(n)?(null!=n?this.isConnecting()?null!=this.previous&&(this.error=this.validateConnection(this.previous.cell,n),null!=this.error&&0==this.error.length&&(n=null,this.isCreateTarget()&&(this.error=null))):this.isValidSource(n)||(n=null):this.isConnecting()&&!this.isCreateTarget()&&!this.graph.allowDanglingEdges&&(this.error=""),n):null}),a.isValidState=mxUtils.bind(this,function(e){return this.isConnecting()?null==this.error:mxCellMarker.prototype.isValidState.apply(a,arguments)}),a.getMarkerColor=mxUtils.bind(this,function(e,n,t){return null==this.connectImage||this.isConnecting()?mxCellMarker.prototype.getMarkerColor.apply(a,arguments):null}),a.intersects=mxUtils.bind(this,function(e,n){return!(null==this.connectImage&&!this.isConnecting())||mxCellMarker.prototype.intersects.apply(a,arguments)}),a},mxConnectionHandler.prototype.start=function(e,n,t,a){this.previous=e,this.first=new mxPoint(n,t),this.edgeState=null!=a?a:this.createEdgeState(null),this.marker.currentColor=this.marker.validColor,this.marker.markedState=e,this.marker.mark(),this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous))},mxConnectionHandler.prototype.isConnecting=function(){return null!=this.first&&null!=this.shape},mxConnectionHandler.prototype.isValidSource=function(e){return this.graph.isValidSource(e)},mxConnectionHandler.prototype.isValidTarget=function(e){return!0},mxConnectionHandler.prototype.validateConnection=function(e,n){return this.isValidTarget(n)?this.graph.getEdgeValidationError(null,e,n):""},mxConnectionHandler.prototype.getConnectImage=function(e){return this.connectImage},mxConnectionHandler.prototype.isMoveIconToFrontForState=function(e){return null!=e.text&&e.text.node.parentNode==this.graph.container||this.moveIconFront},mxConnectionHandler.prototype.createIcons=function(e){if(null==(i=this.getConnectImage(e))||null==e)return null;this.iconState=e;var n=[],t=new mxImageShape(new mxRectangle(0,0,i.width,i.height),i.src,null,null,0);t.preserveImageAspect=!1,this.isMoveIconToFrontForState(e)?(t.dialect=mxConstants.DIALECT_STRICTHTML,t.init(this.graph.container)):(t.dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,t.init(this.graph.getView().getOverlayPane()),this.moveIconBack&&null!=t.node.previousSibling&&t.node.parentNode.insertBefore(t.node,t.node.parentNode.firstChild)),t.node.style.cursor=mxConstants.CURSOR_CONNECT;var a=mxUtils.bind(this,function(){return null!=this.currentState?this.currentState:e}),i=mxUtils.bind(this,function(e){mxEvent.isConsumed(e)||(this.icon=t,this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,a())))});return mxEvent.redirectMouseEvents(t.node,this.graph,a,i),n.push(t),this.redrawIcons(n,this.iconState),n},mxConnectionHandler.prototype.redrawIcons=function(e,n){if(null!=e&&null!=e[0]&&null!=n){var t=this.getIconPosition(e[0],n);e[0].bounds.x=t.x,e[0].bounds.y=t.y,e[0].redraw()}},mxConnectionHandler.prototype.getIconPosition=function(e,n){var t=this.graph.getView().scale,a=n.getCenterX(),i=n.getCenterY();if(this.graph.isSwimlane(n.cell)){a=0!=(s=this.graph.getStartSize(n.cell)).width?n.x+s.width*t/2:a,i=0!=s.height?n.y+s.height*t/2:i;if(0!=(s=mxUtils.toRadians(mxUtils.getValue(n.style,mxConstants.STYLE_ROTATION)||0))){t=Math.cos(s);var s=Math.sin(s),o=new mxPoint(n.getCenterX(),n.getCenterY());a=(i=mxUtils.getRotatedPoint(new mxPoint(a,i),t,s,o)).x,i=i.y}}return new mxPoint(a-e.bounds.width/2,i-e.bounds.height/2)},mxConnectionHandler.prototype.destroyIcons=function(e){if(null!=e){this.iconState=null;for(var n=0;n<e.length;n++)e[n].destroy()}},mxConnectionHandler.prototype.isStartEvent=function(e){return!this.graph.isForceMarqueeEvent(e.getEvent())&&(null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint||null!=this.previous&&null==this.error&&(null==this.icons||null!=this.icons&&null!=this.icon))},mxConnectionHandler.prototype.mouseDown=function(e,n){if(this.mouseDownCounter++,this.isEnabled()&&this.graph.isEnabled()&&!n.isConsumed()&&!this.isConnecting()&&this.isStartEvent(n)){if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint?(this.sourceConstraint=this.constraintHandler.currentConstraint,this.previous=this.constraintHandler.currentFocus,this.first=this.constraintHandler.currentPoint.clone()):this.first=new mxPoint(n.getGraphX(),n.getGraphY()),this.edgeState=this.createEdgeState(n),this.mouseDownCounter=1,this.waypointsEnabled&&null==this.shape&&(this.waypoints=null,this.shape=this.createShape()),null==this.previous&&null!=this.edgeState){var t=this.graph.getPointForEvent(n.getEvent());this.edgeState.cell.geometry.setTerminalPoint(t,!0)}this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)),n.consume()}else if(mxClient.IS_TOUCH&&this.tapAndHoldEnabled&&!this.tapAndHoldInProgress&&this.isEnabled()&&this.graph.isEnabled()&&!this.isConnecting()){this.tapAndHoldInProgress=!0,this.initialTouchX=n.getX(),this.initialTouchY=n.getY();var a=this.graph.view.getState(this.marker.getCell(n));this.tapAndHoldThread&&window.clearTimeout(this.tapAndHoldThread),this.tapAndHoldThread=window.setTimeout(mxUtils.bind(this,function(){this.tapAndHoldValid&&this.tapAndHold(n,a),this.tapAndHoldValid=this.tapAndHoldInProgress=!1}),this.tapAndHoldDelay),this.tapAndHoldValid=!0}this.selectedIcon=this.icon,this.icon=null},mxConnectionHandler.prototype.tapAndHold=function(e,n){null!=n&&(this.marker.currentColor=this.marker.validColor,this.marker.markedState=n,this.marker.mark(),this.first=new mxPoint(e.getGraphX(),e.getGraphY()),this.edgeState=this.createEdgeState(e),this.previous=n,this.fireEvent(new mxEventObject(mxEvent.START,"state",this.previous)))},mxConnectionHandler.prototype.isImmediateConnectSource=function(e){return!this.graph.isCellMovable(e.cell)},mxConnectionHandler.prototype.createEdgeState=function(e){return null},mxConnectionHandler.prototype.updateCurrentState=function(e){var n=this.marker.process(e);this.constraintHandler.update(e,null==this.first),this.currentState=n},mxConnectionHandler.prototype.convertWaypoint=function(e){var n=this.graph.getView().getScale(),t=this.graph.getView().getTranslate();e.x=e.x/n-t.x,e.y=e.y/n-t.y},mxConnectionHandler.prototype.mouseMove=function(e,n){if(this.tapAndHoldValid&&(this.tapAndHoldValid=Math.abs(this.initialTouchX-n.getX())<this.tapAndHoldTolerance&&Math.abs(this.initialTouchY-n.getY())<this.tapAndHoldTolerance),n.isConsumed()||!this.ignoreMouseDown&&null==this.first&&this.graph.isMouseDown)this.constraintHandler.reset();else{if(!this.isEnabled()&&null!=this.currentState&&(this.destroyIcons(this.icons),this.currentState=null),(null!=this.first||this.isEnabled()&&this.graph.isEnabled())&&this.updateCurrentState(n),null!=this.first){var t=this.graph.getView().scale,a=null,i=t=new mxPoint(this.graph.snap(n.getGraphX()/t)*t,this.graph.snap(n.getGraphY()/t)*t);null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentPoint&&(a=this.constraintHandler.currentConstraint,i=this.constraintHandler.currentPoint.clone());var s=this.first;if(null!=this.selectedIcon){var o=this.selectedIcon.bounds.width,r=this.selectedIcon.bounds.height;null!=this.currentState&&this.targetConnectImage?(o=this.getIconPosition(this.selectedIcon,this.currentState),this.selectedIcon.bounds.x=o.x,this.selectedIcon.bounds.y=o.y):(o=new mxRectangle(n.getGraphX()+this.connectIconOffset.x,n.getGraphY()+this.connectIconOffset.y,o,r),this.selectedIcon.bounds=o),this.selectedIcon.redraw()}if(null!=this.edgeState){if(this.edgeState.absolutePoints=[null,null!=this.currentState?null:i],this.graph.view.updateFixedTerminalPoint(this.edgeState,this.previous,!0,this.sourceConstraint),null!=this.currentState&&(null==a&&(a=this.graph.getConnectionConstraint(this.edgeState,this.previous,!1)),this.edgeState.setAbsoluteTerminalPoint(null,!1),this.graph.view.updateFixedTerminalPoint(this.edgeState,this.currentState,!1,a)),(s=null)!=this.waypoints)for(s=[],i=0;i<this.waypoints.length;i++)a=this.waypoints[i].clone(),this.convertWaypoint(a),s[i]=a;this.graph.view.updatePoints(this.edgeState,s,this.previous,this.currentState),this.graph.view.updateFloatingTerminalPoints(this.edgeState,this.previous,this.currentState),i=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-1],s=this.edgeState.absolutePoints[0]}else null!=this.currentState&&null==this.constraintHandler.currentConstraint&&(null!=(o=this.getTargetPerimeterPoint(this.currentState,n))&&(i=o)),null==this.sourceConstraint&&null!=this.previous&&(null!=(o=this.getSourcePerimeterPoint(this.previous,null!=this.waypoints&&0<this.waypoints.length?this.waypoints[0]:i,n))&&(s=o));if(null==this.currentState&&this.movePreviewAway){if(o=s,null!=this.edgeState&&2<this.edgeState.absolutePoints.length&&(null!=(a=this.edgeState.absolutePoints[this.edgeState.absolutePoints.length-2])&&(o=a)),a=i.x-o.x,o=i.y-o.y,0==(r=Math.sqrt(a*a+o*o)))return;i.x-=4*a/r,i.y-=4*o/r}null==this.shape&&(a=Math.abs(t.x-this.first.x),o=Math.abs(t.y-this.first.y),a>this.graph.tolerance||o>this.graph.tolerance)&&(this.shape=this.createShape(),this.updateCurrentState(n)),null!=this.shape&&(null!=this.edgeState?this.shape.points=this.edgeState.absolutePoints:(t=[s],null!=this.waypoints&&(t=t.concat(this.waypoints)),t.push(i),this.shape.points=t),this.drawPreview()),mxEvent.consume(n.getEvent()),n.consume()}else this.isEnabled()&&this.graph.isEnabled()?this.previous!=this.currentState&&null==this.edgeState?(this.destroyIcons(this.icons),(this.icons=null)!=this.currentState&&null==this.error&&(this.icons=this.createIcons(this.currentState),null==this.icons&&(this.currentState.setCursor(mxConstants.CURSOR_CONNECT),n.consume())),this.previous=this.currentState):this.previous==this.currentState&&null!=this.currentState&&null==this.icons&&!this.graph.isMouseDown&&n.consume():this.constraintHandler.reset();if(null!=this.constraintHandler.currentConstraint&&this.marker.reset(),!this.graph.isMouseDown&&null!=this.currentState&&null!=this.icons){for(t=!1,s=n.getSource(),i=0;i<this.icons.length&&!t;i++)t=s==this.icons[i].node||s.parentNode==this.icons[i].node;t||this.updateIcons(this.currentState,this.icons,n)}}},mxConnectionHandler.prototype.getTargetPerimeterPoint=function(e,n){var t=null,a=(i=e.view).getPerimeterFunction(e);if(null!=a){var i,s=null!=this.waypoints&&0<this.waypoints.length?this.waypoints[this.waypoints.length-1]:new mxPoint(this.previous.getCenterX(),this.previous.getCenterY());null!=(i=a(i.getPerimeterBounds(e),this.edgeState,s,!1))&&(t=i)}else t=new mxPoint(e.getCenterX(),e.getCenterY());return t},mxConnectionHandler.prototype.getSourcePerimeterPoint=function(e,n,t){t=null;var a=e.view,i=a.getPerimeterFunction(e),s=new mxPoint(e.getCenterX(),e.getCenterY());if(null!=i){var o=mxUtils.getValue(e.style,mxConstants.STYLE_ROTATION,0),r=-o*(Math.PI/180);0!=o&&(n=mxUtils.getRotatedPoint(new mxPoint(n.x,n.y),Math.cos(r),Math.sin(r),s)),null!=(e=i(a.getPerimeterBounds(e),e,n,!1))&&(0!=o&&(e=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),Math.cos(-r),Math.sin(-r),s)),t=e)}else t=s;return t},mxConnectionHandler.prototype.updateIcons=function(e,n,t){},mxConnectionHandler.prototype.isStopEvent=function(e){return null!=e.getState()},mxConnectionHandler.prototype.addWaypointForEvent=function(e){var n=mxUtils.convertPoint(this.graph.container,e.getX(),e.getY()),t=Math.abs(n.x-this.first.x);n=Math.abs(n.y-this.first.y);(null!=this.waypoints||1<this.mouseDownCounter&&(t>this.graph.tolerance||n>this.graph.tolerance))&&(null==this.waypoints&&(this.waypoints=[]),t=this.graph.view.scale,n=new mxPoint(this.graph.snap(e.getGraphX()/t)*t,this.graph.snap(e.getGraphY()/t)*t),this.waypoints.push(n))},mxConnectionHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()&&this.isConnecting()){if(this.waypointsEnabled&&!this.isStopEvent(n))return this.addWaypointForEvent(n),void n.consume();if(null==this.error){var t=null!=this.previous?this.previous.cell:null,a=null;null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(a=this.constraintHandler.currentFocus.cell),null==a&&this.marker.hasValidState()&&(a=this.marker.validState.cell),this.connect(t,a,n.getEvent(),n.getCell())}else null!=this.previous&&null!=this.marker.validState&&this.previous.cell==this.marker.validState.cell&&this.graph.selectCellForEvent(this.marker.source,evt),0<this.error.length&&this.graph.validationAlert(this.error);this.destroyIcons(this.icons),n.consume()}null!=this.first&&this.reset(),this.tapAndHoldValid=this.tapAndHoldInProgress=!1},mxConnectionHandler.prototype.reset=function(){null!=this.shape&&(this.shape.destroy(),this.shape=null),this.destroyIcons(this.icons),this.icons=null,this.marker.reset(),this.constraintHandler.reset(),this.sourceConstraint=this.error=this.previous=this.edgeState=this.selectedIcon=null,this.mouseDownCounter=0,this.icon=this.first=null,this.fireEvent(new mxEventObject(mxEvent.RESET))},mxConnectionHandler.prototype.drawPreview=function(){var e=null==this.error;this.shape.strokewidth=this.getEdgeWidth(e),e=this.getEdgeColor(e),this.shape.stroke=e,this.shape.redraw()},mxConnectionHandler.prototype.getEdgeColor=function(e){return e?mxConstants.VALID_COLOR:mxConstants.INVALID_COLOR},mxConnectionHandler.prototype.getEdgeWidth=function(e){return e?3:1},mxConnectionHandler.prototype.connect=function(e,n,t,a){if(null!=n||this.isCreateTarget()||this.graph.allowDanglingEdges){var i=this.graph.getModel(),s=null;i.beginUpdate();try{if(null!=e&&null==n&&this.isCreateTarget()&&null!=(n=this.createTargetVertex(t,e))){if(null!=(a=this.graph.getDropTarget([n],t,a))&&this.graph.getModel().isEdge(a))a=this.graph.getDefaultParent();else{var o=this.graph.getView().getState(a);if(null!=o){var r=i.getGeometry(n);r.x-=o.origin.x,r.y-=o.origin.y}}this.graph.addCell(n,a)}var l=this.graph.getDefaultParent();if(null!=e&&null!=n&&i.getParent(e)==i.getParent(n)&&i.getParent(i.getParent(e))!=i.getRoot()&&(l=i.getParent(e),null!=e.geometry&&e.geometry.relative&&null!=n.geometry&&n.geometry.relative&&(l=i.getParent(l))),r=o=null,null!=this.edgeState&&(o=this.edgeState.cell.value,r=this.edgeState.cell.style),null!=(s=this.insertEdge(l,null,o,e,n,r))){this.graph.setConnectionConstraint(s,e,!0,this.sourceConstraint),this.graph.setConnectionConstraint(s,n,!1,this.constraintHandler.currentConstraint),null!=this.edgeState&&i.setGeometry(s,this.edgeState.cell.geometry);var d=i.getGeometry(s);if(null==d&&((d=new mxGeometry).relative=!0,i.setGeometry(s,d)),null!=this.waypoints&&0<this.waypoints.length){var c=this.graph.view.scale,m=this.graph.view.translate;for(d.points=[],e=0;e<this.waypoints.length;e++){var u=this.waypoints[e];d.points.push(new mxPoint(u.x/c-m.x,u.y/c-m.y))}}null==n&&((u=this.graph.getPointForEvent(t,!1)).x-=this.graph.panDx/this.graph.view.scale,u.y-=this.graph.panDy/this.graph.view.scale,d.setTerminalPoint(u,!1)),this.fireEvent(new mxEventObject(mxEvent.CONNECT,"cell",s,"event",t,"target",a))}}catch(e){mxLog.show(),mxLog.debug(e.message)}finally{i.endUpdate()}this.select&&this.selectCells(s,n)}},mxConnectionHandler.prototype.selectCells=function(e,n){this.graph.setSelectionCell(e)},mxConnectionHandler.prototype.insertEdge=function(e,n,t,a,i,s){return null==this.factoryMethod?this.graph.insertEdge(e,n,t,a,i,s):(n=this.createEdge(t,a,i,s),this.graph.addEdge(n,e,a,i))},mxConnectionHandler.prototype.createTargetVertex=function(e,n){for(var t=this.graph.getCellGeometry(n);null!=t&&t.relative;)n=this.graph.getModel().getParent(n),t=this.graph.getCellGeometry(n);var a=this.graph.cloneCells([n])[0];if(null!=(t=this.graph.getModel().getGeometry(a))){var i=this.graph.getPointForEvent(e);if(t.x=this.graph.snap(i.x-t.width/2)-this.graph.panDx/this.graph.view.scale,t.y=this.graph.snap(i.y-t.height/2)-this.graph.panDy/this.graph.view.scale,null!=this.first){var s=this.graph.view.getState(n);if(null!=s){var o=this.getAlignmentTolerance();Math.abs(this.graph.snap(this.first.x)-this.graph.snap(i.x))<=o?t.x=s.x:Math.abs(this.graph.snap(this.first.y)-this.graph.snap(i.y))<=o&&(t.y=s.y)}}}return a},mxConnectionHandler.prototype.getAlignmentTolerance=function(){return this.graph.isGridEnabled()?this.graph.gridSize:this.graph.tolerance},mxConnectionHandler.prototype.createEdge=function(e,n,t,a){var i=null;return null!=this.factoryMethod&&(i=this.factoryMethod(n,t,a)),null==i&&((i=new mxCell(e||"")).setEdge(!0),i.setStyle(a),(e=new mxGeometry).relative=!0,i.setGeometry(e)),i},mxConnectionHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getView().removeListener(this.changeHandler),this.changeHandler=null),null!=this.drillHandler&&(this.graph.removeListener(this.drillHandler),this.graph.getView().removeListener(this.drillHandler),this.drillHandler=null)},mxConstraintHandler.prototype.pointImage=new mxImage(mxClient.imageBasePath+"/point.gif",5,5),mxConstraintHandler.prototype.graph=null,mxConstraintHandler.prototype.enabled=!0,mxConstraintHandler.prototype.highlightColor=mxConstants.DEFAULT_VALID_COLOR,mxConstraintHandler.prototype.isEnabled=function(){return this.enabled},mxConstraintHandler.prototype.setEnabled=function(e){this.enabled=e},mxConstraintHandler.prototype.reset=function(){if(null!=this.focusIcons){for(var e=0;e<this.focusIcons.length;e++)this.focusIcons[e].destroy();this.focusIcons=null}null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null),this.focusPoints=this.currentFocus=this.currentPoint=this.currentFocusArea=this.currentConstraint=null},mxConstraintHandler.prototype.getTolerance=function(){return this.graph.getTolerance()},mxConstraintHandler.prototype.getImageForConstraint=function(e,n,t){return this.pointImage},mxConstraintHandler.prototype.isEventIgnored=function(e,n){return!1},mxConstraintHandler.prototype.update=function(e,n){if(this.isEnabled()&&!this.isEventIgnored(e)){var t=this.getTolerance(),a=new mxRectangle(e.getGraphX()-t,e.getGraphY()-t,2*t,2*t),i=null!=e.getCell()&&this.graph.isCellConnectable(e.getCell());if((null==this.currentFocusArea||!mxUtils.intersects(this.currentFocusArea,a)||null!=e.getState()&&null!=this.currentFocus&&i)&&(this.currentFocusArea=null,e.getState()!=this.currentFocus))if(this.currentFocus=null,this.constraints=null!=e.getState()&&i?this.graph.getAllConnectionConstraints(e.getState(),n):null,null!=this.constraints){if(this.currentFocus=e.getState(),this.currentFocusArea=new mxRectangle(e.getState().x,e.getState().y,e.getState().width,e.getState().height),null!=this.focusIcons){for(i=0;i<this.focusIcons.length;i++)this.focusIcons[i].destroy();this.focusPoints=this.focusIcons=null}for(this.focusIcons=[],this.focusPoints=[],i=0;i<this.constraints.length;i++){var s,o=this.graph.getConnectionPoint(e.getState(),this.constraints[i]),r=(s=this.getImageForConstraint(e.getState(),this.constraints[i],o)).src;(s=new mxImageShape(s=new mxRectangle(o.x-s.width/2,o.y-s.height/2,s.width,s.height),r)).dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,s.preserveImageAspect=!1,s.init(this.graph.getView().getOverlayPane()),null!=s.node.previousSibling&&s.node.parentNode.insertBefore(s.node,s.node.parentNode.firstChild),r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),s.redraw(),mxEvent.redirectMouseEvents(s.node,this.graph,r),this.currentFocusArea.add(s.bounds),this.focusIcons.push(s),this.focusPoints.push(o)}this.currentFocusArea.grow(t)}else if(null!=this.focusIcons){for(null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null),i=0;i<this.focusIcons.length;i++)this.focusIcons[i].destroy();this.focusPoints=this.focusIcons=null}if(this.currentPoint=this.currentConstraint=null,null!=this.focusIcons&&null!=this.constraints&&(null==e.getState()||this.currentFocus==e.getState()))for(i=0;i<this.focusIcons.length;i++)if(mxUtils.intersects(this.focusIcons[i].bounds,a)){this.currentConstraint=this.constraints[i],this.currentPoint=this.focusPoints[i],(t=this.focusIcons[i].bounds.clone()).grow(mxClient.IS_IE?3:2),mxClient.IS_IE&&(t.width-=1,t.height-=1),null==this.focusHighlight?((t=new mxRectangleShape(t,null,this.highlightColor,3)).dialect=this.graph.dialect==mxConstants.DIALECT_SVG?mxConstants.DIALECT_SVG:mxConstants.DIALECT_VML,t.init(this.graph.getView().getOverlayPane()),this.focusHighlight=t,r=mxUtils.bind(this,function(){return null!=this.currentFocus?this.currentFocus:e.getState()}),mxEvent.redirectMouseEvents(t.node,this.graph,r)):(this.focusHighlight.bounds=t,this.focusHighlight.redraw());break}null==this.currentConstraint&&null!=this.focusHighlight&&(this.focusHighlight.destroy(),this.focusHighlight=null)}},mxConstraintHandler.prototype.destroy=function(){this.reset()},mxRubberband.prototype.defaultOpacity=20,mxRubberband.prototype.enabled=!0,mxRubberband.prototype.div=null,mxRubberband.prototype.sharedDiv=null,mxRubberband.prototype.currentX=0,mxRubberband.prototype.currentY=0,mxRubberband.prototype.isEnabled=function(){return this.enabled},mxRubberband.prototype.setEnabled=function(e){this.enabled=e},mxRubberband.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.isEnabled()&&this.graph.isEnabled()&&(this.graph.isForceMarqueeEvent(n.getEvent())||null==n.getState())){var t=mxUtils.getOffset(this.graph.container),a=mxUtils.getScrollOrigin(this.graph.container);if(a.x-=t.x,a.y-=t.y,this.start(n.getX()+a.x,n.getY()+a.y),mxClient.IS_NS&&!mxClient.IS_SF&&!mxClient.IS_GC){var i=this.graph.container,s=function(e){e=new mxMouseEvent(e);var n=mxUtils.convertPoint(i,e.getX(),e.getY());return e.graphX=n.x,e.graphY=n.y,e};this.dragHandler=mxUtils.bind(this,function(e){this.mouseMove(this.graph,s(e))}),this.dropHandler=mxUtils.bind(this,function(e){this.mouseUp(this.graph,s(e))}),mxEvent.addListener(document,"mousemove",this.dragHandler),mxEvent.addListener(document,"mouseup",this.dropHandler)}n.consume(!1)}},mxRubberband.prototype.start=function(e,n){this.first=new mxPoint(e,n)},mxRubberband.prototype.mouseMove=function(e,n){if(!n.isConsumed()&&null!=this.first){var t=mxUtils.getScrollOrigin(this.graph.container),a=mxUtils.getOffset(this.graph.container);t.x-=a.x,t.y-=a.y;a=n.getX()+t.x,t=n.getY()+t.y;var i=this.first.x-a,s=this.first.y-t,o=this.graph.tolerance;(null!=this.div||Math.abs(i)>o||Math.abs(s)>o)&&(null==this.div&&(this.div=this.createShape()),mxUtils.clearSelection(),this.update(a,t),n.consume())}},mxRubberband.prototype.createShape=function(){return null==this.sharedDiv&&(this.sharedDiv=document.createElement("div"),this.sharedDiv.className="mxRubberband",mxUtils.setOpacity(this.sharedDiv,this.defaultOpacity)),this.graph.container.appendChild(this.sharedDiv),this.sharedDiv},mxRubberband.prototype.mouseUp=function(e,n){var t=null!=this.div;this.reset(),t&&(t=new mxRectangle(this.x,this.y,this.width,this.height),this.graph.selectRegion(t,n.getEvent()),n.consume())},mxRubberband.prototype.reset=function(){null!=this.div&&this.div.parentNode.removeChild(this.div),null!=this.dragHandler&&(mxEvent.removeListener(document,"mousemove",this.dragHandler),this.dragHandler=null),null!=this.dropHandler&&(mxEvent.removeListener(document,"mouseup",this.dropHandler),this.dropHandler=null),this.currentY=this.currentX=0,this.div=this.first=null},mxRubberband.prototype.update=function(e,n){this.currentX=e,this.currentY=n,this.repaint()},mxRubberband.prototype.repaint=function(){if(null!=this.div){var e=this.currentX-this.graph.panDx,n=this.currentY-this.graph.panDy;this.x=Math.min(this.first.x,e),this.y=Math.min(this.first.y,n),this.width=Math.max(this.first.x,e)-this.x,this.height=Math.max(this.first.y,n)-this.y,e=mxClient.IS_VML?this.graph.panDy:0,this.div.style.left=this.x+(mxClient.IS_VML?this.graph.panDx:0)+"px",this.div.style.top=this.y+e+"px",this.div.style.width=Math.max(1,this.width)+"px",this.div.style.height=Math.max(1,this.height)+"px"}},mxRubberband.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),this.graph.removeListener(this.panHandler),this.reset(),null!=this.sharedDiv&&(this.sharedDiv=null))},mxVertexHandler.prototype.graph=null,mxVertexHandler.prototype.state=null,mxVertexHandler.prototype.singleSizer=!1,mxVertexHandler.prototype.index=null,mxVertexHandler.prototype.allowHandleBoundsCheck=!0,mxVertexHandler.prototype.handleImage=null,mxVertexHandler.prototype.tolerance=0,mxVertexHandler.prototype.rotationEnabled=!1,mxVertexHandler.prototype.rotationRaster=!0,mxVertexHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.selectionBorder=this.createSelectionShape(this.bounds),this.selectionBorder.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.selectionBorder.pointerEvents=!1,this.selectionBorder.init(this.graph.getView().getOverlayPane()),this.graph.isCellMovable(this.state.cell)&&(this.selectionBorder.node.style.cursor=mxConstants.CURSOR_MOVABLE_VERTEX),mxEvent.redirectMouseEvents(this.selectionBorder.node,this.graph,this.state),mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells){var e=this.graph.isCellResizable(this.state.cell);if(this.sizers=[],e||this.graph.isLabelMovable(this.state.cell)&&2<=this.state.width&&2<=this.state.height){var n=0;e&&(this.singleSizer||(this.sizers.push(this.createSizer("nw-resize",n++)),this.sizers.push(this.createSizer("n-resize",n++)),this.sizers.push(this.createSizer("ne-resize",n++)),this.sizers.push(this.createSizer("w-resize",n++)),this.sizers.push(this.createSizer("e-resize",n++)),this.sizers.push(this.createSizer("sw-resize",n++)),this.sizers.push(this.createSizer("s-resize",n++))),this.sizers.push(this.createSizer("se-resize",n++))),null!=(e=this.graph.model.getGeometry(this.state.cell))&&!e.relative&&!this.graph.isSwimlane(this.state.cell)&&this.graph.isLabelMovable(this.state.cell)&&(this.labelShape=this.createSizer(mxConstants.CURSOR_LABEL_HANDLE,mxEvent.LABEL_HANDLE,mxConstants.LABEL_HANDLE_SIZE,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}else this.graph.isCellMovable(this.state.cell)&&!this.graph.isCellResizable(this.state.cell)&&this.state.width<2&&this.state.height<2&&(this.labelShape=this.createSizer(mxConstants.CURSOR_MOVABLE_VERTEX,null,null,mxConstants.LABEL_HANDLE_FILLCOLOR),this.sizers.push(this.labelShape))}this.rotationEnabled&&(mxGraphHandler.prototype.maxCells<=0||this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells)&&(this.rotationShape=this.createSizer("pointer",mxEvent.ROTATION_HANDLE,mxConstants.HANDLE_SIZE+3,mxConstants.HANDLE_FILLCOLOR),this.sizers.push(this.rotationShape)),this.redraw()},mxVertexHandler.prototype.getSelectionBounds=function(e){return new mxRectangle(Math.round(e.x),Math.round(e.y),Math.round(e.width),Math.round(e.height))},mxVertexHandler.prototype.createSelectionShape=function(e){return(e=new mxRectangleShape(e,null,this.getSelectionColor())).strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxVertexHandler.prototype.getSelectionColor=function(){return mxConstants.VERTEX_SELECTION_COLOR},mxVertexHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.VERTEX_SELECTION_STROKEWIDTH},mxVertexHandler.prototype.isSelectionDashed=function(){return mxConstants.VERTEX_SELECTION_DASHED},mxVertexHandler.prototype.createSizer=function(e,n,t,a){return t=new mxRectangle(0,0,t=t||mxConstants.HANDLE_SIZE,t),(a=this.createSizerShape(t,n,a)).isHtmlAllowed()&&null!=this.state.text&&this.state.text.node.parentNode==this.graph.container?(a.bounds.height-=1,a.bounds.width-=1,a.dialect=mxConstants.DIALECT_STRICTHTML,a.init(this.graph.container)):(a.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,a.init(this.graph.getView().getOverlayPane())),mxEvent.redirectMouseEvents(a.node,this.graph,this.state),this.graph.isEnabled()&&(a.node.style.cursor=e),this.isSizerVisible(n)||(a.node.style.visibility="hidden"),a},mxVertexHandler.prototype.isSizerVisible=function(e){return!0},mxVertexHandler.prototype.createSizerShape=function(e,n,t){return null!=this.handleImage?(e.width=this.handleImage.width,e.height=this.handleImage.height,new mxImageShape(e,this.handleImage.src)):n==mxEvent.ROTATION_HANDLE?new mxEllipse(e,t||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR):new mxRectangleShape(e,t||mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)},mxVertexHandler.prototype.moveSizerTo=function(e,n,t){null!=e&&(e.bounds.x=Math.round(n-e.bounds.width/2),e.bounds.y=Math.round(t-e.bounds.height/2),e.redraw())},mxVertexHandler.prototype.getHandleForEvent=function(e){if(e.isSource(this.rotationShape))return mxEvent.ROTATION_HANDLE;if(e.isSource(this.labelShape))return mxEvent.LABEL_HANDLE;if(null!=this.sizers)for(var n=this.tolerance,t=(n=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<n)?new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n):null,0);t<this.sizers.length;t++)if(e.isSource(this.sizers[t])||null!=n&&mxUtils.intersects(this.sizers[t].bounds,n))return t;return null},mxVertexHandler.prototype.mouseDown=function(e,n){if(!n.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&(0<this.tolerance||n.getState()==this.state)){var t=this.getHandleForEvent(n);null!=t&&(this.start(n.getX(),n.getY(),t),n.consume())}},mxVertexHandler.prototype.start=function(e,n,t){e=mxUtils.convertPoint(this.graph.container,e,n),this.startX=e.x,this.startY=e.y,this.index=t,this.selectionBorder.node.style.display=t==mxEvent.ROTATION_HANDLE?"inline":"none",this.preview=this.createSelectionShape(this.bounds),mxClient.IS_SVG&&0!=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")||null==this.state.text||this.state.text.node.parentNode!=this.graph.container?(this.preview.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,this.preview.init(this.graph.view.getOverlayPane())):(this.preview.dialect=mxConstants.DIALECT_STRICTHTML,this.preview.init(this.graph.container))},mxVertexHandler.prototype.mouseMove=function(e,n){if(n.isConsumed()||null==this.index)null!=this.getHandleForEvent(n)&&n.consume(!1);else{var t=new mxPoint(n.getGraphX(),n.getGraphY()),a=this.graph.isGridEnabledEvent(n.getEvent()),i=this.graph.getView().scale;if(this.index==mxEvent.LABEL_HANDLE)a&&(t.x=this.graph.snap(t.x/i)*i,t.y=this.graph.snap(t.y/i)*i),this.moveSizerTo(this.sizers[this.sizers.length-1],t.x,t.y);else if(this.index==mxEvent.ROTATION_HANDLE){var s=this.state.x+this.state.width/2-t.x,o=this.state.y+this.state.height/2-t.y;this.currentAlpha=0!=s?180*Math.atan(o/s)/Math.PI+90:o<0?180:0,0<s&&(this.currentAlpha-=180),this.rotationRaster&&(s=t.x-this.state.getCenterX(),o=t.y-this.state.getCenterY(),s=Math.abs(Math.sqrt(s*s+o*o)-this.state.height/2-20),s=Math.max(1,5*Math.min(3,Math.max(0,Math.round(80/Math.abs(s))))),this.currentAlpha=Math.round(this.currentAlpha/s)*s),this.selectionBorder.rotation=this.currentAlpha,this.selectionBorder.redraw()}else{var r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),l=Math.cos(-r),d=Math.sin(-r),c=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),m=(s=t.x-this.startX,o=t.y-this.startY,t=this.graph.view.translate,d*s+l*o);s=l*s-d*o;this.bounds=this.union(this.selectionBounds,s,m,this.index,a,i,t),l=Math.cos(r),c=(d=Math.sin(r))*(s=(o=new mxPoint(this.bounds.getCenterX(),this.bounds.getCenterY())).x-c.x)+l*(o=o.y-c.y)-o,this.bounds.x+=l*s-d*o-s,this.bounds.y+=c,this.drawPreview()}n.consume()}},mxVertexHandler.prototype.mouseUp=function(e,n){if(!n.isConsumed()&&null!=this.index&&null!=this.state){var t=new mxPoint(n.getGraphX(),n.getGraphY());this.graph.getModel().beginUpdate();try{if(this.index==mxEvent.ROTATION_HANDLE)null!=this.currentAlpha&&this.rotateCell(this.state.cell,this.currentAlpha-(this.state.style[mxConstants.STYLE_ROTATION]||0));else{var a=this.graph.isGridEnabledEvent(n.getEvent()),i=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),s=Math.cos(-i),o=Math.sin(-i),r=(t=o*(r=t.x-this.startX)+s*(l=t.y-this.startY),s*r-o*l),l=t,d=this.graph.view.scale;this.resizeCell(this.state.cell,r/d,l/d,this.index,a)}}finally{this.graph.getModel().endUpdate()}this.reset(),n.consume()}},mxVertexHandler.prototype.rotateCell=function(e,n){var t=this.graph.getModel();if(t.isVertex(e)){if(null!=(s=e==this.state?this.state:this.graph.view.getState(e))&&this.graph.setCellStyles(mxConstants.STYLE_ROTATION,(s.style[mxConstants.STYLE_ROTATION]||0)+n,[e]),this.state.cell!=e&&(null!=(s=this.graph.getCellGeometry(e))&&!s.relative))if(0!=n){var a=this.graph.getModel().getParent(e),i=this.graph.getCellGeometry(a);if(!s.relative&&null!=i){var s,o=mxUtils.toRadians(n),r=(a=Math.cos(o),o=Math.sin(o),new mxPoint(s.getCenterX(),s.getCenterY()));i=new mxPoint(i.width/2,i.height/2),a=mxUtils.getRotatedPoint(r,a,o,i);(s=s.clone()).x=a.x-s.width/2,s.y=a.y-s.height/2,t.setGeometry(e,s)}}else(s=s.clone()).x+=dx,s.y+=dy,t.setGeometry(e,s);for(s=t.getChildCount(e),a=0;a<s;a++)this.rotateCell(t.getChildAt(e,a),n)}},mxVertexHandler.prototype.reset=function(){this.index=this.currentAlpha=null,null!=this.preview&&(this.preview.destroy(),this.preview=null),null!=this.selectionBorder&&(this.selectionBorder.node.style.display="inline",this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.selectionBounds.x,this.selectionBounds.y,this.selectionBounds.width,this.selectionBounds.height),this.drawPreview())},mxVertexHandler.prototype.resizeCell=function(e,n,t,a,i){var s=this.graph.model.getGeometry(e);if(null!=s)if(a==mxEvent.LABEL_HANDLE)a=this.graph.view.scale,n=(this.labelShape.bounds.getCenterX()-this.startX)/a,t=(this.labelShape.bounds.getCenterY()-this.startY)/a,null==(s=s.clone()).offset?s.offset=new mxPoint(n,t):(s.offset.x+=n,s.offset.y+=t),this.graph.model.setGeometry(e,s);else{if(a=this.union(s,n,t,a,i,1,new mxPoint(0,0)),0!=(r=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"))){n=a.getCenterX()-s.getCenterX(),t=a.getCenterY()-s.getCenterY(),i=Math.cos(r);var o=Math.sin(r),r=i*n-o*t-n;n=o*n+i*t-t,t=a.x-s.x;var l=a.y-s.y,d=i*t-o*l;i=o*t+i*l,a.x+=r,a.y+=n,this.graph.isCellCollapsed(e)||0==r&&0==n||(t=s.x-a.x+d,l=s.y-a.y+i,this.moveChildren(e,t,l))}this.graph.resizeCell(e,a)}},mxVertexHandler.prototype.moveChildren=function(e,n,t){for(var a=this.graph.getModel(),i=a.getChildCount(e),s=0;s<i;s++){var o=a.getChildAt(e,s);if(a.isVertex(o)){var r=this.graph.getCellGeometry(o);null!=r&&!r.relative&&((r=r.clone()).x+=n,r.y+=t,a.setGeometry(o,r))}}},mxVertexHandler.prototype.union=function(e,n,t,a,i,s,o){if(this.singleSizer){o=e.x+e.width+n;var r=e.y+e.height+t;return i&&(o=this.graph.snap(o/s)*s,r=this.graph.snap(r/s)*s),(s=new mxRectangle(e.x,e.y,0,0)).add(new mxRectangle(o,r,0,0)),s}var l=(r=e.x-o.x*s)+e.width,d=e.y-o.y*s;return e=d+e.height,4<a?(e+=t,i&&(e=this.graph.snap(e/s)*s)):a<3&&(d+=t,i&&(d=this.graph.snap(d/s)*s)),0==a||3==a||5==a?(r+=n,i&&(r=this.graph.snap(r/s)*s)):2!=a&&4!=a&&7!=a||(l+=n,i&&(l=this.graph.snap(l/s)*s)),e-=d,(i=l-r)<0&&(r+=i,i=Math.abs(i)),e<0&&(d+=e,e=Math.abs(e)),new mxRectangle(r+o.x*s,d+o.y*s,i,e)},mxVertexHandler.prototype.redraw=function(){this.selectionBounds=this.getSelectionBounds(this.state),this.bounds=new mxRectangle(this.state.x,this.state.y,this.state.width,this.state.height);var e=this.state;if(null!=this.sizers){var n=e.x+e.width,t=e.y+e.height;if(this.singleSizer)this.moveSizerTo(this.sizers[0],n,t);else{var a=e.x+e.width/2,i=e.y+e.height/2;if(1<this.sizers.length){var s=mxUtils.toRadians(e.style[mxConstants.STYLE_ROTATION]||"0"),o=Math.cos(s),r=(s=Math.sin(s),new mxPoint(e.getCenterX(),e.getCenterY())),l=mxUtils.getRotatedPoint(new mxPoint(e.x,e.y),o,s,r);this.moveSizerTo(this.sizers[0],l.x,l.y),l.x=a,l.y=e.y,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[1],l.x,l.y),l.x=n,l.y=e.y,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[2],l.x,l.y),l.x=e.x,l.y=i,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[3],l.x,l.y),l.x=n,l.y=i,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[4],l.x,l.y),l.x=e.x,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[5],l.x,l.y),l.x=a,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[6],l.x,l.y),l.x=n,l.y=t,l=mxUtils.getRotatedPoint(l,o,s,r),this.moveSizerTo(this.sizers[7],l.x,l.y),this.moveSizerTo(this.sizers[8],a+e.absoluteOffset.x,i+e.absoluteOffset.y)}else 2<=this.state.width&&2<=this.state.height?this.moveSizerTo(this.sizers[0],a+e.absoluteOffset.x,i+e.absoluteOffset.y):this.moveSizerTo(this.sizers[0],e.x,e.y)}}null!=this.rotationShape&&(s=mxUtils.toRadians(this.state.style[mxConstants.STYLE_ROTATION]||"0"),o=Math.cos(s),s=Math.sin(s),r=new mxPoint(this.state.getCenterX(),this.state.getCenterY()),l=mxUtils.getRotatedPoint(new mxPoint(e.x+e.width/2,e.y-16),o,s,r),this.moveSizerTo(this.rotationShape,l.x,l.y)),this.selectionBorder.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.drawPreview()},mxVertexHandler.prototype.drawPreview=function(){null!=this.preview&&(this.preview.bounds=this.bounds,this.preview.node.parentNode==this.graph.container&&(this.preview.bounds.width=Math.max(0,this.preview.bounds.width-1),this.preview.bounds.height=Math.max(0,this.preview.bounds.height-1)),this.preview.rotation=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0"),this.preview.redraw()),this.selectionBorder.bounds=this.bounds,this.selectionBorder.redraw()},mxVertexHandler.prototype.destroy=function(){if(null!=this.preview&&(this.preview.destroy(),this.preview=null),this.selectionBorder.destroy(),this.labelShape=this.selectionBorder=null,null!=this.sizers)for(var e=0;e<this.sizers.length;e++)this.sizers[e].destroy(),this.sizers[e]=null},mxEdgeHandler.prototype.graph=null,mxEdgeHandler.prototype.state=null,mxEdgeHandler.prototype.marker=null,mxEdgeHandler.prototype.constraintHandler=null,mxEdgeHandler.prototype.error=null,mxEdgeHandler.prototype.shape=null,mxEdgeHandler.prototype.bends=null,mxEdgeHandler.prototype.labelShape=null,mxEdgeHandler.prototype.cloneEnabled=!0,mxEdgeHandler.prototype.addEnabled=!1,mxEdgeHandler.prototype.removeEnabled=!1,mxEdgeHandler.prototype.preferHtml=!1,mxEdgeHandler.prototype.allowHandleBoundsCheck=!0,mxEdgeHandler.prototype.snapToTerminals=!1,mxEdgeHandler.prototype.handleImage=null,mxEdgeHandler.prototype.tolerance=0,mxEdgeHandler.prototype.init=function(){if(this.graph=this.state.view.graph,this.marker=this.createMarker(),this.constraintHandler=new mxConstraintHandler(this.graph),this.points=[],this.abspoints=this.getSelectionPoints(this.state),this.shape=this.createSelectionShape(this.abspoints),this.shape.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,this.shape.init(this.graph.getView().getOverlayPane()),this.shape.svgStrokeTolerance=0,this.shape.node.style.cursor=mxConstants.CURSOR_MOVABLE_EDGE,mxEvent.addListener(this.shape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e,this.state.cell)})),mxEvent.addGestureListeners(this.shape.node,mxUtils.bind(this,function(e){this.addEnabled&&this.isAddPointEvent(e)?this.addPoint(this.state,e):this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e,this.state))}),mxUtils.bind(this,function(e){var n=this.state.cell;if(null!=this.index){var t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));n=this.graph.getCellAt(t.x,t.y);this.graph.isSwimlane(n)&&this.graph.hitsSwimlaneContent(n,t.x,t.y)&&(n=null)}this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e,this.graph.getView().getState(n)))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e,this.state))})),this.preferHtml=null!=this.state.text&&this.state.text.node.parentNode==this.graph.container,!this.preferHtml){var e=this.state.getVisibleTerminalState(!0);null!=e&&(this.preferHtml=null!=e.text&&e.text.node.parentNode==this.graph.container),this.preferHtml||null!=(e=this.state.getVisibleTerminalState(!1))&&(this.preferHtml=null!=e.text&&e.text.node.parentNode==this.graph.container)}(this.graph.getSelectionCount()<mxGraphHandler.prototype.maxCells||mxGraphHandler.prototype.maxCells<=0)&&(this.bends=this.createBends()),this.label=new mxPoint(this.state.absoluteOffset.x,this.state.absoluteOffset.y),this.labelShape=new mxRectangleShape(new mxRectangle,mxConstants.LABEL_HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR),this.labelShape.pointerEvents=!1,this.initBend(this.labelShape),this.labelShape.node.style.cursor=mxConstants.CURSOR_LABEL_HANDLE,mxEvent.redirectMouseEvents(this.labelShape.node,this.graph,this.state),this.redraw()},mxEdgeHandler.prototype.isAddPointEvent=function(e){return mxEvent.isShiftDown(e)},mxEdgeHandler.prototype.isRemovePointEvent=function(e){return mxEvent.isShiftDown(e)},mxEdgeHandler.prototype.getSelectionPoints=function(e){return e.absolutePoints},mxEdgeHandler.prototype.createSelectionShape=function(e){return(e=new mxPolyline(e,this.getSelectionColor())).strokewidth=this.getSelectionStrokeWidth(),e.isDashed=this.isSelectionDashed(),e},mxEdgeHandler.prototype.getSelectionColor=function(){return mxConstants.EDGE_SELECTION_COLOR},mxEdgeHandler.prototype.getSelectionStrokeWidth=function(){return mxConstants.EDGE_SELECTION_STROKEWIDTH},mxEdgeHandler.prototype.isSelectionDashed=function(){return mxConstants.EDGE_SELECTION_DASHED},mxEdgeHandler.prototype.isConnectableCell=function(e){return!0},mxEdgeHandler.prototype.createMarker=function(){var e=new mxCellMarker(this.graph),a=this;return e.getCell=function(e){var n=mxCellMarker.prototype.getCell.apply(this,arguments);if(!a.isConnectableCell(n))return null;var t=a.graph.getModel();return(n==a.state.cell||null!=n&&!a.graph.connectableEdges&&t.isEdge(n))&&(n=null),n},e.isValidState=function(e){var n=a.graph.getModel();n=null!=(n=a.graph.view.getTerminalPort(e,a.graph.view.getState(n.getTerminal(a.state.cell,!a.isSource)),!a.isSource))?n.cell:null;return a.error=a.validateConnection(a.isSource?e.cell:n,a.isSource?n:e.cell),null==a.error},e},mxEdgeHandler.prototype.validateConnection=function(e,n){return this.graph.getEdgeValidationError(this.state.cell,e,n)},mxEdgeHandler.prototype.createBends=function(){for(var e=this.state.cell,n=[],t=0;t<this.abspoints.length;t++)if(this.isHandleVisible(t)){var a=t==this.abspoints.length-1;if((a=0==t||a)||this.graph.isCellBendable(e)){var i=this.createHandleShape(t);if(this.initBend(i),mxClient.IS_TOUCH&&i.node.setAttribute("pointer-events","none"),this.isHandleEnabled(t))if(mxClient.IS_TOUCH){var s=mxUtils.bind(this,function(e){return e=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),this.graph.view.getState(this.graph.getCellAt(e.x,e.y))});mxEvent.redirectMouseEvents(i.node,this.graph,s)}else i.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(i.node,this.graph,this.state);n.push(i),a||(this.points.push(new mxPoint(0,0)),i.node.style.visibility="hidden")}}return n},mxEdgeHandler.prototype.isHandleEnabled=function(e){return!0},mxEdgeHandler.prototype.isHandleVisible=function(e){return!0},mxEdgeHandler.prototype.createHandleShape=function(e){return null!=this.handleImage?new mxImageShape(new mxRectangle(0,0,this.handleImage.width,this.handleImage.height),this.handleImage.src):(e=mxConstants.HANDLE_SIZE,this.preferHtml&&(e-=1),new mxRectangleShape(new mxRectangle(0,0,e,e),mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR))},mxEdgeHandler.prototype.initBend=function(e){this.preferHtml?(e.dialect=mxConstants.DIALECT_STRICTHTML,e.init(this.graph.container)):(e.dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_MIXEDHTML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()))},mxEdgeHandler.prototype.getHandleForEvent=function(e){if(null!=this.bends)for(var n=this.tolerance,t=(n=this.allowHandleBoundsCheck&&(mxClient.IS_IE||0<n)?new mxRectangle(e.getGraphX()-n,e.getGraphY()-n,2*n,2*n):null,0);t<this.bends.length;t++)if((e.isSource(this.bends[t])||null!=n&&mxUtils.intersects(this.bends[t].bounds,n))&&"hidden"!=this.bends[t].node.style.visibility)return t;return!(e.isSource(this.labelShape)&&"hidden"!=this.labelShape.node.style.visibility||e.isSource(this.state.text))||(mxClient.IS_SF||mxClient.IS_GC)&&"SELECT"==e.getSource().nodeName?null:mxEvent.LABEL_HANDLE},mxEdgeHandler.prototype.mouseDown=function(e,n){var t=null;null!=(t=this.getHandleForEvent(n))&&!n.isConsumed()&&this.graph.isEnabled()&&!this.graph.isForceMarqueeEvent(n.getEvent())&&(this.removeEnabled&&this.isRemovePointEvent(n.getEvent())?this.removePoint(this.state,t):(t!=mxEvent.LABEL_HANDLE||this.graph.isLabelMovable(n.getCell()))&&this.start(n.getX(),n.getY(),t),n.consume())},mxEdgeHandler.prototype.start=function(e,n,t){this.startX=e,this.startY=n,this.isSource=null!=this.bends&&0==t,this.isTarget=null!=this.bends&&t==this.bends.length-1,this.isLabel=t==mxEvent.LABEL_HANDLE,this.isSource||this.isTarget?(e=this.state.cell,(null==(n=this.graph.model.getTerminal(e,this.isSource))&&this.graph.isTerminalPointMovable(e,this.isSource)||null!=n&&this.graph.isCellDisconnectable(e,n,this.isSource))&&(this.index=t)):this.index=t},mxEdgeHandler.prototype.clonePreviewState=function(e,n){return this.state.clone()},mxEdgeHandler.prototype.getSnapToTerminalTolerance=function(){return this.graph.gridSize*this.graph.view.scale/2},mxEdgeHandler.prototype.getPointForEvent=function(e){var t=new mxPoint(e.getGraphX(),e.getGraphY()),a=this.getSnapToTerminalTolerance(),n=this.graph.getView(),i=!1,s=!1;if(this.snapToTerminals&&0<a){var o=function(e){if(null!=e){var n=e.x;Math.abs(t.x-n)<a&&(t.x=n,i=!0),e=e.y,Math.abs(t.y-e)<a&&(t.y=e,s=!0)}},r=function(e){null!=e&&o.call(this,new mxPoint(n.getRoutingCenterX(e),n.getRoutingCenterY(e)))};if(r.call(this,this.state.getVisibleTerminalState(!0)),r.call(this,this.state.getVisibleTerminalState(!1)),null!=this.abspoints)for(r=0;r<this.abspoints;r++)r!=this.index&&o.call(this,this.abspoints[r])}return this.graph.isGridEnabledEvent(e.getEvent())&&(e=n.scale,r=n.translate,i||(t.x=(this.graph.snap(t.x/e-r.x)+r.x)*e),s||(t.y=(this.graph.snap(t.y/e-r.y)+r.y)*e)),t},mxEdgeHandler.prototype.getPreviewTerminalState=function(e){this.constraintHandler.update(e,this.isSource),this.marker.process(e),e=this.marker.getValidState();var n=null;return null!=this.constraintHandler.currentFocus&&null!=this.constraintHandler.currentConstraint&&this.marker.reset(),null!=e?n=e:null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(n=this.constraintHandler.currentFocus),n},mxEdgeHandler.prototype.getPreviewPoints=function(e){var n=null!=(n=this.graph.getCellGeometry(this.state.cell)).points?n.points.slice():null;return this.isSource||this.isTarget?this.graph.resetEdgesOnConnect&&(n=null):(this.convertPoint(e,!1),null==n?n=[e]:n[this.index-1]=e),n},mxEdgeHandler.prototype.updatePreviewState=function(e,n,t){var a=this.isSource?t:this.state.getVisibleTerminalState(!0),i=this.isTarget?t:this.state.getVisibleTerminalState(!1),s=this.graph.getConnectionConstraint(e,a,!0),o=this.graph.getConnectionConstraint(e,i,!1),r=this.constraintHandler.currentConstraint;null==r&&(r=new mxConnectionConstraint),this.isSource?s=r:this.isTarget&&(o=r),(!this.isSource||null!=a)&&e.view.updateFixedTerminalPoint(e,a,!0,s),(!this.isTarget||null!=i)&&e.view.updateFixedTerminalPoint(e,i,!1,o),(this.isSource||this.isTarget)&&null==t&&(e.setAbsoluteTerminalPoint(n,this.isSource),null==this.marker.getMarkedState()&&(this.error=this.graph.allowDanglingEdges?null:"")),e.view.updatePoints(e,this.points,a,i),e.view.updateFloatingTerminalPoints(e,a,i)},mxEdgeHandler.prototype.mouseMove=function(e,n){if(null!=this.index&&null!=this.marker){var t=this.getPointForEvent(n);if(this.isLabel)this.label.x=t.x,this.label.y=t.y;else{this.points=this.getPreviewPoints(t);var a=this.isSource||this.isTarget?this.getPreviewTerminalState(n):null,i=this.clonePreviewState(t,null!=a?a.cell:null);this.updatePreviewState(i,t,a),this.setPreviewColor(null==this.error?this.marker.validColor:this.marker.invalidColor),this.abspoints=i.absolutePoints,this.active=!0}this.drawPreview(),mxEvent.consume(n.getEvent()),n.consume()}else mxClient.IS_IE&&null!=this.getHandleForEvent(n)&&n.consume(!1)},mxEdgeHandler.prototype.mouseUp=function(e,n){if(null!=this.index&&null!=this.marker){var t=this.state.cell;if(n.getX()!=this.startX||n.getY()!=this.startY)if(null!=this.error)0<this.error.length&&this.graph.validationAlert(this.error);else if(this.isLabel)this.moveLabel(this.state,this.label.x,this.label.y);else if(this.isSource||this.isTarget){var a=null;if(null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus&&(a=this.constraintHandler.currentFocus.cell),null==a&&this.marker.hasValidState()&&(a=this.marker.validState.cell),null!=a)t=this.connect(t,a,this.isSource,this.graph.isCloneEvent(n.getEvent())&&this.cloneEnabled&&this.graph.isCellsCloneable(),n);else if(this.graph.isAllowDanglingEdges()){(a=this.abspoints[this.isSource?0:this.abspoints.length-1]).x=a.x/this.graph.view.scale-this.graph.view.translate.x,a.y=a.y/this.graph.view.scale-this.graph.view.translate.y;var i=this.graph.getView().getState(this.graph.getModel().getParent(t));null!=i&&(a.x-=i.origin.x,a.y-=i.origin.y),a.x-=this.graph.panDx/this.graph.view.scale,a.y-=this.graph.panDy/this.graph.view.scale,this.changeTerminalPoint(t,a,this.isSource)}}else this.active?this.changePoints(t,this.points):(this.graph.getView().invalidate(this.state.cell),this.graph.getView().revalidate(this.state.cell));null!=this.marker&&(this.reset(),t!=this.state.cell&&this.graph.setSelectionCell(t)),n.consume()}},mxEdgeHandler.prototype.reset=function(){this.points=this.label=this.index=this.error=null,this.isTarget=this.isSource=this.isLabel=this.active=!1,this.marker.reset(),this.constraintHandler.reset(),this.setPreviewColor(mxConstants.EDGE_SELECTION_COLOR),this.redraw()},mxEdgeHandler.prototype.setPreviewColor=function(e){null!=this.shape&&(this.shape.stroke=e)},mxEdgeHandler.prototype.convertPoint=function(e,n){var t=this.graph.getView().getScale(),a=this.graph.getView().getTranslate();return n&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/t-a.x),e.y=Math.round(e.y/t-a.y),null!=(t=this.graph.getView().getState(this.graph.getModel().getParent(this.state.cell)))&&(e.x-=t.origin.x,e.y-=t.origin.y),e},mxEdgeHandler.prototype.moveLabel=function(e,n,t){var a=this.graph.getModel();if(null!=(i=a.getGeometry(e.cell))){var i=i.clone(),s=this.graph.getView().getRelativePoint(e,n,t);i.x=s.x,i.y=s.y;var o=this.graph.getView().scale;i.offset=new mxPoint(0,0),s=this.graph.view.getPoint(e,i),i.offset=new mxPoint((n-s.x)/o,(t-s.y)/o),a.setGeometry(e.cell,i)}},mxEdgeHandler.prototype.connect=function(e,n,t,a,i){var s=(i=this.graph.getModel()).getParent(e);i.beginUpdate();try{if(a){var o=e.clone();i.add(s,o,i.getChildCount(s));var r=i.getTerminal(e,!t);this.graph.connectCell(o,r,!t),e=o}var l=this.constraintHandler.currentConstraint;null==l&&(l=new mxConnectionConstraint),this.graph.connectCell(e,n,t,l)}finally{i.endUpdate()}return e},mxEdgeHandler.prototype.changeTerminalPoint=function(e,n,t){var a=this.graph.getModel(),i=a.getGeometry(e);if(null!=i){a.beginUpdate();try{(i=i.clone()).setTerminalPoint(n,t),a.setGeometry(e,i),this.graph.connectCell(e,null,t,new mxConnectionConstraint)}finally{a.endUpdate()}}},mxEdgeHandler.prototype.changePoints=function(e,n){var t=this.graph.getModel(),a=t.getGeometry(e);null!=a&&((a=a.clone()).points=n,t.setGeometry(e,a))},mxEdgeHandler.prototype.addPoint=function(e,n){var t=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(n),mxEvent.getClientY(n)),a=this.graph.isGridEnabledEvent(n);this.convertPoint(t,a),this.addPointAt(e,t.x,t.y),mxEvent.consume(n)},mxEdgeHandler.prototype.addPointAt=function(e,n,t){var a=this.graph.getCellGeometry(e.cell);if(n=new mxPoint(n,t),null!=a){a=a.clone(),t=this.graph.view.translate;var i=this.graph.view.scale;t=mxUtils.findNearestSegment(e,(n.x+t.x)*i,(n.y+t.y)*i),null==a.points?a.points=[n]:a.points.splice(t,0,n),this.graph.getModel().setGeometry(e.cell,a),this.destroy(),this.init()}},mxEdgeHandler.prototype.removePoint=function(e,n){if(0<n&&n<this.abspoints.length-1){var t=this.graph.getCellGeometry(this.state.cell);null!=t&&null!=t.points&&((t=t.clone()).points.splice(n-1,1),this.graph.getModel().setGeometry(e.cell,t),this.destroy(),this.init())}},mxEdgeHandler.prototype.getHandleFillColor=function(e){e=0==e;var n=this.state.cell,t=this.graph.getModel().getTerminal(n,e),a=mxConstants.HANDLE_FILLCOLOR;return null!=t&&!this.graph.isCellDisconnectable(n,t,e)||null==t&&!this.graph.isTerminalPointMovable(n,e)?a=mxConstants.LOCKED_HANDLE_FILLCOLOR:null!=t&&this.graph.isCellDisconnectable(n,t,e)&&(a=mxConstants.CONNECT_HANDLE_FILLCOLOR),a},mxEdgeHandler.prototype.redraw=function(){this.abspoints=this.state.absolutePoints.slice();var e=this.state.cell,n=mxConstants.LABEL_HANDLE_SIZE;if(this.label=new mxPoint(this.state.absoluteOffset.x,this.state.absoluteOffset.y),this.labelShape.bounds=new mxRectangle(Math.round(this.label.x-n/2),Math.round(this.label.y-n/2),n,n),this.labelShape.redraw(),null!=(n=this.graph.getLabel(e))&&0<n.length&&this.graph.isLabelMovable(e)?this.labelShape.node.style.visibility="visible":this.labelShape.node.style.visibility="hidden",null!=this.bends&&0<this.bends.length){var t=this.abspoints.length-1,a=(e=this.abspoints[0],this.abspoints[0].y);n=this.bends[0].bounds;this.bends[0].bounds=new mxRectangle(Math.round(this.abspoints[0].x-n.width/2),Math.round(a-n.height/2),n.width,n.height),this.bends[0].fill=this.getHandleFillColor(0),this.bends[0].redraw();a=this.abspoints[t];var i=this.abspoints[t].x,s=(t=this.abspoints[t].y,this.bends.length-1);n=this.bends[s].bounds;this.bends[s].bounds=new mxRectangle(Math.round(i-n.width/2),Math.round(t-n.height/2),n.width,n.height),this.bends[s].fill=this.getHandleFillColor(s),this.bends[s].redraw(),this.redrawInnerBends(e,a)}this.drawPreview()},mxEdgeHandler.prototype.redrawInnerBends=function(e,n){var t=this.graph.getModel().getGeometry(this.state.cell).points;if(null!=t){null==this.points&&(this.points=[]);for(var a=1;a<this.bends.length-1;a++)if(null!=this.bends[a])if(null!=this.abspoints[a]){var i=this.abspoints[a].x,s=this.abspoints[a].y,o=this.bends[a].bounds;this.bends[a].node.style.visibility="visible",this.bends[a].bounds=new mxRectangle(Math.round(i-o.width/2),Math.round(s-o.height/2),o.width,o.height),this.bends[a].redraw(),this.points[a-1]=t[a-1]}else this.bends[a].destroy(),this.bends[a]=null}},mxEdgeHandler.prototype.drawPreview=function(){if(this.isLabel){var e=mxConstants.LABEL_HANDLE_SIZE;e=new mxRectangle(Math.round(this.label.x-e/2),Math.round(this.label.y-e/2),e,e);this.labelShape.bounds=e,this.labelShape.redraw()}else this.shape.points=this.abspoints,this.shape.redraw()},mxEdgeHandler.prototype.destroy=function(){if(null!=this.marker&&(this.marker.destroy(),this.marker=null),null!=this.shape&&(this.shape.destroy(),this.shape=null),null!=this.labelShape&&(this.labelShape.destroy(),this.labelShape=null),null!=this.constraintHandler&&(this.constraintHandler.destroy(),this.constraintHandler=null),null!=this.bends)for(var e=0;e<this.bends.length;e++)null!=this.bends[e]&&(this.bends[e].destroy(),this.bends[e]=null)},mxUtils.extend(mxElbowEdgeHandler,mxEdgeHandler),mxElbowEdgeHandler.prototype=new mxEdgeHandler,mxElbowEdgeHandler.prototype.constructor=mxElbowEdgeHandler,mxElbowEdgeHandler.prototype.flipEnabled=!0,mxElbowEdgeHandler.prototype.doubleClickOrientationResource="none"!=mxClient.language?"doubleClickOrientation":"",mxElbowEdgeHandler.prototype.createBends=function(){var e=[],n=this.createHandleShape(0);return this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e.push(this.createVirtualBend()),this.points.push(new mxPoint(0,0)),n=this.createHandleShape(2),this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e},mxElbowEdgeHandler.prototype.createVirtualBend=function(){var e=this.createHandleShape();this.initBend(e);var n=this.getCursorForBend();return e.node.style.cursor=n,n=mxUtils.bind(this,function(e){!mxEvent.isConsumed(e)&&this.flipEnabled&&(this.graph.flipEdge(this.state.cell,e),mxEvent.consume(e))}),mxEvent.redirectMouseEvents(e.node,this.graph,this.state,null,null,null,n),this.graph.isCellBendable(this.state.cell)||(e.node.style.display="none"),e},mxElbowEdgeHandler.prototype.getCursorForBend=function(){return this.state.style[mxConstants.STYLE_EDGE]==mxEdgeStyle.TopToBottom||this.state.style[mxConstants.STYLE_EDGE]==mxConstants.EDGESTYLE_TOPTOBOTTOM||(this.state.style[mxConstants.STYLE_EDGE]==mxEdgeStyle.ElbowConnector||this.state.style[mxConstants.STYLE_EDGE]==mxConstants.EDGESTYLE_ELBOW)&&this.state.style[mxConstants.STYLE_ELBOW]==mxConstants.ELBOW_VERTICAL?"row-resize":"col-resize"},mxElbowEdgeHandler.prototype.getTooltipForNode=function(e){var n=null;return null==this.bends||null==this.bends[1]||e!=this.bends[1].node&&e.parentNode!=this.bends[1].node||(n=this.doubleClickOrientationResource,n=mxResources.get(n)||n),n},mxElbowEdgeHandler.prototype.convertPoint=function(e,n){var t=this.graph.getView().getScale(),a=this.graph.getView().getTranslate(),i=this.state.origin;n&&(e.x=this.graph.snap(e.x),e.y=this.graph.snap(e.y)),e.x=Math.round(e.x/t-a.x-i.x),e.y=Math.round(e.y/t-a.y-i.y)},mxElbowEdgeHandler.prototype.redrawInnerBends=function(e,n){var t=null==(t=null!=(t=this.graph.getModel().getGeometry(this.state.cell).points)?t[0]:null)?new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2):new mxPoint(this.graph.getView().scale*(t.x+this.graph.getView().translate.x+this.state.origin.x),this.graph.getView().scale*(t.y+this.graph.getView().translate.y+this.state.origin.y)),a=(i=this.bends[1].bounds).width,i=i.height;null==this.handleImage&&(i=a=mxConstants.HANDLE_SIZE);var s=new mxRectangle(Math.round(t.x-a/2),Math.round(t.y-i/2),a,i);null==this.handleImage&&"hidden"!=this.labelShape.node.style.visibility&&mxUtils.intersects(s,this.labelShape.bounds)&&(a+=3,i+=3,s=new mxRectangle(Math.round(t.x-a/2),Math.round(t.y-i/2),a,i)),this.bends[1].bounds=s,this.bends[1].redraw()},mxUtils.extend(mxEdgeSegmentHandler,mxEdgeHandler),mxEdgeSegmentHandler.prototype=new mxElbowEdgeHandler,mxEdgeSegmentHandler.prototype.constructor=mxEdgeSegmentHandler,mxEdgeSegmentHandler.prototype.getPreviewPoints=function(e){if(this.isSource||this.isTarget)return mxElbowEdgeHandler.prototype.getPreviewPoints.apply(this,arguments);this.convertPoint(e,!1);var n=this.state.absolutePoints,t=n[0].clone();this.convertPoint(t,!1);for(var a=[],i=1;i<n.length;i++){var s=n[i].clone();this.convertPoint(s,!1),i==this.index&&(t.x==s.x?(t.x=e.x,s.x=e.x):(t.y=e.y,s.y=e.y)),i<n.length-1&&a.push(s),t=s}if(1==a.length){if(t=this.state.view,i=this.state.getVisibleTerminalState(!0),null!=(s=this.state.getVisibleTerminalState(!1))&null!=i){var o=this.state.origin.x,r=this.state.origin.y;mxUtils.contains(s,a[0].x+o,a[0].y+r)?n[1].y==n[2].y?a[0].y=t.getRoutingCenterY(i)-r:a[0].x=t.getRoutingCenterX(i)-o:mxUtils.contains(i,a[0].x+o,a[0].y+r)&&(n[1].y==n[0].y?a[0].y=t.getRoutingCenterY(s)-r:a[0].x=t.getRoutingCenterX(s)-o)}}else 0==a.length&&(a=[e]);return a},mxEdgeSegmentHandler.prototype.createBends=function(){var e=[],n=this.createHandleShape(0);this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none");var t=this.state.absolutePoints;if(this.graph.isCellBendable(this.state.cell)){null==this.points&&(this.points=[]);for(var a=0;a<t.length-1;a++)n=this.createVirtualBend(),e.push(n),n.node.style.cursor=0==t[a].x-t[a+1].x?"col-resize":"row-resize",this.points.push(new mxPoint(0,0)),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none")}return n=this.createHandleShape(t.length),this.initBend(n),n.node.style.cursor=mxConstants.CURSOR_BEND_HANDLE,mxEvent.redirectMouseEvents(n.node,this.graph,this.state),e.push(n),mxClient.IS_TOUCH&&n.node.setAttribute("pointer-events","none"),e},mxEdgeSegmentHandler.prototype.redraw=function(){this.refresh(),mxEdgeHandler.prototype.redraw.apply(this,arguments)},mxEdgeSegmentHandler.prototype.refresh=function(){if(null!=this.bends){for(var e=0;e<this.bends.length;e++)null!=this.bends[e]&&(this.bends[e].destroy(),this.bends[e]=null);this.bends=this.createBends()}},mxEdgeSegmentHandler.prototype.redrawInnerBends=function(e,n){if(this.graph.isCellBendable(this.state.cell)){var t=mxConstants.HANDLE_SIZE,a=this.state.absolutePoints;if(null!=a&&1<a.length)for(var i=0;i<this.state.absolutePoints.length-1;i++)if(null!=this.bends[i+1]){e=a[i],n=a[i+1];var s=new mxPoint(e.x+(n.x-e.x)/2,e.y+(n.y-e.y)/2);this.bends[i+1].bounds=new mxRectangle(Math.round(s.x-t/2),Math.round(s.y-t/2),t,t),this.bends[i+1].redraw()}}},mxEdgeSegmentHandler.prototype.changePoints=function(e,n){n=[];var t=this.abspoints;if(1<t.length)for(var a=t[0],i=t[1],s=2;s<t.length;s++){var o=t[s];Math.round(a.x)==Math.round(i.x)&&Math.round(i.x)==Math.round(o.x)||Math.round(a.y)==Math.round(i.y)&&Math.round(i.y)==Math.round(o.y)||(i=(a=i).clone(),this.convertPoint(i,!1),n.push(i)),i=o}mxElbowEdgeHandler.prototype.changePoints.apply(this,arguments)},mxKeyHandler.prototype.graph=null,mxKeyHandler.prototype.target=null,mxKeyHandler.prototype.normalKeys=null,mxKeyHandler.prototype.shiftKeys=null,mxKeyHandler.prototype.controlKeys=null,mxKeyHandler.prototype.controlShiftKeys=null,mxKeyHandler.prototype.enabled=!0,mxKeyHandler.prototype.isEnabled=function(){return this.enabled},mxKeyHandler.prototype.setEnabled=function(e){this.enabled=e},mxKeyHandler.prototype.bindKey=function(e,n){this.normalKeys[e]=n},mxKeyHandler.prototype.bindShiftKey=function(e,n){this.shiftKeys[e]=n},mxKeyHandler.prototype.bindControlKey=function(e,n){this.controlKeys[e]=n},mxKeyHandler.prototype.bindControlShiftKey=function(e,n){this.controlShiftKeys[e]=n},mxKeyHandler.prototype.isControlDown=function(e){return mxEvent.isControlDown(e)},mxKeyHandler.prototype.getFunction=function(e){return null!=e?this.isControlDown(e)?mxEvent.isShiftDown(e)?this.controlShiftKeys[e.keyCode]:this.controlKeys[e.keyCode]:mxEvent.isShiftDown(e)?this.shiftKeys[e.keyCode]:this.normalKeys[e.keyCode]:null},mxKeyHandler.prototype.isGraphEvent=function(e){if((e=mxEvent.getSource(e))==this.target||e.parentNode==this.target||null!=this.graph.cellEditor&&e==this.graph.cellEditor.textarea)return!0;for(;null!=e;){if(e==this.graph.container)return!0;e=e.parentNode}return!1},mxKeyHandler.prototype.keyDown=function(e){if(this.graph.isEnabled()&&!mxEvent.isConsumed(e)&&this.isGraphEvent(e)&&this.isEnabled())if(27==e.keyCode)this.escape(e);else if(!this.graph.isEditing()){var n=this.getFunction(e);null!=n&&(n(e),mxEvent.consume(e))}},mxKeyHandler.prototype.escape=function(e){this.graph.isEscapeEnabled()&&this.graph.escape(e)},mxKeyHandler.prototype.destroy=function(){this.target=null},mxTooltipHandler.prototype.zIndex=10005,mxTooltipHandler.prototype.graph=null,mxTooltipHandler.prototype.delay=null,mxTooltipHandler.prototype.hideOnHover=!1,mxTooltipHandler.prototype.enabled=!0,mxTooltipHandler.prototype.isEnabled=function(){return this.enabled},mxTooltipHandler.prototype.setEnabled=function(e){this.enabled=e},mxTooltipHandler.prototype.isHideOnHover=function(){return this.hideOnHover},mxTooltipHandler.prototype.setHideOnHover=function(e){this.hideOnHover=e},mxTooltipHandler.prototype.init=function(){null!=document.body&&(this.div=document.createElement("div"),this.div.className="mxTooltip",this.div.style.visibility="hidden",this.div.style.zIndex=this.zIndex,document.body.appendChild(this.div),mxEvent.addListener(this.div,"mousedown",mxUtils.bind(this,function(e){this.hideTooltip()})))},mxTooltipHandler.prototype.mouseDown=function(e,n){this.reset(n,!1),this.hideTooltip()},mxTooltipHandler.prototype.mouseMove=function(e,n){n.getX()==this.lastX&&n.getY()==this.lastY||(this.reset(n,!0),(this.isHideOnHover()||n.getState()!=this.state||n.getSource()!=this.node&&(!this.stateSource||null!=n.getState()&&this.stateSource==(n.isSource(n.getState().shape)||!n.isSource(n.getState().text))))&&this.hideTooltip()),this.lastX=n.getX(),this.lastY=n.getY()},mxTooltipHandler.prototype.mouseUp=function(e,n){this.reset(n,!0),this.hideTooltip()},mxTooltipHandler.prototype.resetTimer=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null)},mxTooltipHandler.prototype.reset=function(e,n){if(this.resetTimer(),n&&this.isEnabled()&&null!=e.getState()&&(null==this.div||"hidden"==this.div.style.visibility)){var t=e.getState(),a=e.getSource(),i=e.getX(),s=e.getY(),o=e.isSource(t.shape)||e.isSource(t.text);this.thread=window.setTimeout(mxUtils.bind(this,function(){if(!this.graph.isEditing()&&!this.graph.panningHandler.isMenuShowing()){var e=this.graph.getTooltip(t,a,i,s);this.show(e,i,s),this.state=t,this.node=a,this.stateSource=o}}),this.delay)}},mxTooltipHandler.prototype.hide=function(){this.resetTimer(),this.hideTooltip()},mxTooltipHandler.prototype.hideTooltip=function(){null!=this.div&&(this.div.style.visibility="hidden")},mxTooltipHandler.prototype.show=function(e,n,t){if(null!=e&&0<e.length){null==this.div&&this.init();var a=mxUtils.getScrollOrigin();this.div.style.left=n+a.x+"px",this.div.style.top=t+mxConstants.TOOLTIP_VERTICAL_OFFSET+a.y+"px",mxUtils.isNode(e)?(this.div.innerHTML="",this.div.appendChild(e)):this.div.innerHTML=e.replace(/\n/g,"<br>"),this.div.style.visibility="",mxUtils.fit(this.div)}},mxTooltipHandler.prototype.destroy=function(){this.graph.removeMouseListener(this),mxEvent.release(this.div),null!=this.div&&null!=this.div.parentNode&&this.div.parentNode.removeChild(this.div),this.div=null},mxUtils.extend(mxCellTracker,mxCellMarker),mxCellTracker.prototype.mouseDown=function(e,n){},mxCellTracker.prototype.mouseMove=function(e,n){this.isEnabled()&&this.process(n)},mxCellTracker.prototype.mouseUp=function(e,n){this.reset()},mxCellTracker.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,this.graph.removeMouseListener(this),mxCellMarker.prototype.destroy.apply(this))},mxCellHighlight.prototype.keepOnTop=!1,mxCellHighlight.prototype.graph=!0,mxCellHighlight.prototype.state=null,mxCellHighlight.prototype.spacing=2,mxCellHighlight.prototype.resetHandler=null,mxCellHighlight.prototype.setHighlightColor=function(e){this.highlightColor=e,null!=this.shape&&(this.shape.stroke=e)},mxCellHighlight.prototype.drawHighlight=function(){this.shape=this.createShape(),this.repaint(),!this.keepOnTop&&this.shape.node.parentNode.firstChild!=this.shape.node&&this.shape.node.parentNode.insertBefore(this.shape.node,this.shape.node.parentNode.firstChild)},mxCellHighlight.prototype.createShape=function(){var e=null;return(e=this.graph.model.isEdge(this.state.cell)?new mxPolyline(this.state.absolutePoints,this.highlightColor,this.strokeWidth):new mxRectangleShape(new mxRectangle,null,this.highlightColor,this.strokeWidth)).dialect=this.graph.dialect!=mxConstants.DIALECT_SVG?mxConstants.DIALECT_VML:mxConstants.DIALECT_SVG,e.init(this.graph.getView().getOverlayPane()),mxEvent.redirectMouseEvents(e.node,this.graph,this.state),e.svgStrokeTolerance=0,e.pointerEvents=!1,e.isDashed=this.dashed,e},mxCellHighlight.prototype.repaint=function(){if(null!=this.state&&null!=this.shape){var e=0;this.graph.model.isEdge(this.state.cell)?this.shape.points=this.state.absolutePoints:(this.shape.bounds=new mxRectangle(this.state.x-this.spacing,this.state.y-this.spacing,this.state.width+2*this.spacing,this.state.height+2*this.spacing),e=Number(this.state.style[mxConstants.STYLE_ROTATION]||"0")),null!=this.state.shape&&this.shape.setCursor(this.state.shape.getCursor()),0!=e&&(this.shape.rotation=e),this.shape.redraw()}},mxCellHighlight.prototype.hide=function(){this.highlight(null)},mxCellHighlight.prototype.highlight=function(e){this.state!=e&&(null!=this.shape&&(this.shape.destroy(),this.shape=null),this.state=e,null!=this.state&&this.drawHighlight())},mxCellHighlight.prototype.destroy=function(){this.graph.getView().removeListener(this.repaintHandler),this.graph.getModel().removeListener(this.repaintHandler),this.graph.getView().removeListener(this.resetHandler),this.graph.getModel().removeListener(this.resetHandler),null!=this.shape&&(this.shape.destroy(),this.shape=null)},mxDefaultKeyHandler.prototype.editor=null,mxDefaultKeyHandler.prototype.handler=null,mxDefaultKeyHandler.prototype.bindAction=function(e,n,t){var a=mxUtils.bind(this,function(){this.editor.execute(n)});t?this.handler.bindControlKey(e,a):this.handler.bindKey(e,a)},mxDefaultKeyHandler.prototype.destroy=function(){this.handler.destroy(),this.handler=null},mxDefaultPopupMenu.prototype.imageBasePath=null,mxDefaultPopupMenu.prototype.config=null,mxDefaultPopupMenu.prototype.createMenu=function(e,n,t,a){if(null!=this.config){var i=this.createConditions(e,t,a);this.addItems(e,n,t,a,i,this.config.firstChild,null)}},mxDefaultPopupMenu.prototype.addItems=function(e,n,t,a,i,s,o){for(var r=!1;null!=s;){if("add"==s.nodeName){if(null==(l=s.getAttribute("if"))||i[l]){var l=s.getAttribute("as"),d=(l=mxResources.get(l)||l,mxUtils.eval(mxUtils.getTextContent(s))),c=s.getAttribute("action"),m=s.getAttribute("icon"),u=s.getAttribute("iconCls");r&&(n.addSeparator(o),r=!1),null!=m&&this.imageBasePath&&(m=this.imageBasePath+m),l=this.addAction(n,e,l,m,d,c,t,o,u),this.addItems(e,n,t,a,i,s.firstChild,l)}}else"separator"==s.nodeName&&(r=!0);s=s.nextSibling}},mxDefaultPopupMenu.prototype.addAction=function(e,n,t,a,i,s,o,r,l){return e.addItem(t,a,function(e){"function"==typeof i&&i.call(n,n,o,e),null!=s&&n.execute(s,o,e)},r,l)},mxDefaultPopupMenu.prototype.createConditions=function(e,n,t){var a=e.graph.getModel(),i=a.getChildCount(n),s=[];for(s.nocell=null==n,s.ncells=1<e.graph.getSelectionCount(),s.notRoot=a.getRoot()!=a.getParent(e.graph.getDefaultParent()),s.cell=null!=n,a=null!=n&&1==e.graph.getSelectionCount(),s.nonEmpty=a&&0<i,s.expandable=a&&e.graph.isCellFoldable(n,!1),s.collapsable=a&&e.graph.isCellFoldable(n,!0),s.validRoot=a&&e.graph.isValidRoot(n),s.emptyValidRoot=s.validRoot&&0==i,s.swimlane=a&&e.graph.isSwimlane(n),i=this.config.getElementsByTagName("condition"),a=0;a<i.length;a++){var o=mxUtils.eval(mxUtils.getTextContent(i[a])),r=i[a].getAttribute("name");null!=r&&"function"==typeof o&&(s[r]=o(e,n,t))}return s},mxDefaultToolbar.prototype.editor=null,mxDefaultToolbar.prototype.toolbar=null,mxDefaultToolbar.prototype.resetHandler=null,mxDefaultToolbar.prototype.spacing=4,mxDefaultToolbar.prototype.connectOnDrop=!1,mxDefaultToolbar.prototype.init=function(e){null!=e&&(this.toolbar=new mxToolbar(e),this.toolbar.addListener(mxEvent.SELECT,mxUtils.bind(this,function(e,n){var t=n.getProperty("function");this.editor.insertFunction=null!=t?mxUtils.bind(this,function(){t.apply(this,arguments),this.toolbar.resetMode()}):null})),this.resetHandler=mxUtils.bind(this,function(){null!=this.toolbar&&this.toolbar.resetMode(!0)}),this.editor.graph.addListener(mxEvent.DOUBLE_CLICK,this.resetHandler),this.editor.addListener(mxEvent.ESCAPE,this.resetHandler))},mxDefaultToolbar.prototype.addItem=function(e,n,t,a){var i=mxUtils.bind(this,function(){null!=t&&0<t.length&&this.editor.execute(t)});return this.toolbar.addItem(e,n,i,a)},mxDefaultToolbar.prototype.addSeparator=function(e){e=e||mxClient.imageBasePath+"/separator.gif",this.toolbar.addSeparator(e)},mxDefaultToolbar.prototype.addCombo=function(){return this.toolbar.addCombo()},mxDefaultToolbar.prototype.addActionCombo=function(e){return this.toolbar.addActionCombo(e)},mxDefaultToolbar.prototype.addActionOption=function(e,n,t){var a=mxUtils.bind(this,function(){this.editor.execute(t)});this.addOption(e,n,a)},mxDefaultToolbar.prototype.addOption=function(e,n,t){return this.toolbar.addOption(e,n,t)},mxDefaultToolbar.prototype.addMode=function(e,n,t,a,i){var s=mxUtils.bind(this,function(){this.editor.setMode(t),null!=i&&i(this.editor)});return this.toolbar.addSwitchMode(e,n,s,a)},mxDefaultToolbar.prototype.addPrototype=function(e,n,t,a,i,s){var o=function(){return"function"==typeof t?t():null!=t?t.clone():null},r=mxUtils.bind(this,function(e,n){"function"==typeof i?i(this.editor,o(),e,n):this.drop(o(),e,n),this.toolbar.resetMode(),mxEvent.consume(e)});return e=this.toolbar.addMode(e,n,r,a,null,s),this.installDropHandler(e,function(e,n,t){r(n,t)}),e},mxDefaultToolbar.prototype.drop=function(e,n,t){var a=this.editor.graph,i=a.getModel();if(null!=t&&!i.isEdge(t)&&this.connectOnDrop&&a.isCellConnectable(t))this.connect(e,n,t);else{for(;null!=t&&!a.isValidDropTarget(t,[e],n);)t=i.getParent(t);this.insert(e,n,t)}},mxDefaultToolbar.prototype.insert=function(e,n,t){var a=this.editor.graph;if(a.canImportCell(e)){var i=mxEvent.getClientX(n),s=mxEvent.getClientY(n);i=mxUtils.convertPoint(a.container,i,s);return a.isSplitEnabled()&&a.isSplitTarget(t,[e],n)?a.splitEdge(t,[e],null,i.x,i.y):this.editor.addVertex(t,e,i.x,i.y)}return null},mxDefaultToolbar.prototype.connect=function(e,n,t){var a=(n=this.editor.graph).getModel();if(null!=t&&n.isCellConnectable(e)&&n.isEdgeValid(null,t,e)){var i=null;a.beginUpdate();try{var s=a.getGeometry(t),o=a.getGeometry(e).clone();o.x=s.x+(s.width-o.width)/2,o.y=s.y+(s.height-o.height)/2;var r=this.spacing*n.gridSize,l=20*a.getDirectedEdgeCount(t,!0);this.editor.horizontalFlow?o.x+=(o.width+s.width)/2+r+l:o.y+=(o.height+s.height)/2+r+l,e.setGeometry(o);var d=a.getParent(t);if(n.addCell(e,d),n.constrainChild(e),i=this.editor.createEdge(t,e),null==a.getGeometry(i)){var c=new mxGeometry;c.relative=!0,a.setGeometry(i,c)}n.addEdge(i,d,t,e)}finally{a.endUpdate()}n.setSelectionCells([e,i]),n.scrollCellToVisible(e)}},mxDefaultToolbar.prototype.installDropHandler=function(n,t){var a=document.createElement("img");a.setAttribute("src",n.getAttribute("src"));var i=mxUtils.bind(this,function(e){a.style.width=2*n.offsetWidth+"px",a.style.height=2*n.offsetHeight+"px",mxUtils.makeDraggable(n,this.editor.graph,t,a),mxEvent.removeListener(a,"load",i)});mxClient.IS_IE?i():mxEvent.addListener(a,"load",i)},mxDefaultToolbar.prototype.destroy=function(){null!=this.resetHandler&&(this.editor.graph.removeListener("dblclick",this.resetHandler),this.editor.removeListener("escape",this.resetHandler),this.resetHandler=null),null!=this.toolbar&&(this.toolbar.destroy(),this.toolbar=null)},mxLoadResources&&mxResources.add(mxClient.basePath+"/resources/editor"),mxEditor.prototype=new mxEventSource,mxEditor.prototype.constructor=mxEditor,mxEditor.prototype.askZoomResource="none"!=mxClient.language?"askZoom":"",mxEditor.prototype.lastSavedResource="none"!=mxClient.language?"lastSaved":"",mxEditor.prototype.currentFileResource="none"!=mxClient.language?"currentFile":"",mxEditor.prototype.propertiesResource="none"!=mxClient.language?"properties":"",mxEditor.prototype.tasksResource="none"!=mxClient.language?"tasks":"",mxEditor.prototype.helpResource="none"!=mxClient.language?"help":"",mxEditor.prototype.outlineResource="none"!=mxClient.language?"outline":"",mxEditor.prototype.outline=null,mxEditor.prototype.graph=null,mxEditor.prototype.graphRenderHint=null,mxEditor.prototype.toolbar=null,mxEditor.prototype.session=null,mxEditor.prototype.status=null,mxEditor.prototype.popupHandler=null,mxEditor.prototype.undoManager=null,mxEditor.prototype.keyHandler=null,mxEditor.prototype.actions=null,mxEditor.prototype.dblClickAction="edit",mxEditor.prototype.swimlaneRequired=!1,mxEditor.prototype.disableContextMenu=!0,mxEditor.prototype.insertFunction=null,mxEditor.prototype.forcedInserting=!1,mxEditor.prototype.templates=null,mxEditor.prototype.defaultEdge=null,mxEditor.prototype.defaultEdgeStyle=null,mxEditor.prototype.defaultGroup=null,mxEditor.prototype.groupBorderSize=null,mxEditor.prototype.filename=null,mxEditor.prototype.linefeed="&#xa;",mxEditor.prototype.postParameterName="xml",mxEditor.prototype.escapePostData=!0,mxEditor.prototype.urlPost=null,mxEditor.prototype.urlImage=null,mxEditor.prototype.urlInit=null,mxEditor.prototype.urlNotify=null,mxEditor.prototype.urlPoll=null,mxEditor.prototype.horizontalFlow=!1,mxEditor.prototype.layoutDiagram=!1,mxEditor.prototype.swimlaneSpacing=0,mxEditor.prototype.maintainSwimlanes=!1,mxEditor.prototype.layoutSwimlanes=!1,mxEditor.prototype.cycleAttributeValues=null,mxEditor.prototype.cycleAttributeIndex=0,mxEditor.prototype.cycleAttributeName="fillColor",mxEditor.prototype.tasks=null,mxEditor.prototype.tasksWindowImage=null,mxEditor.prototype.tasksTop=20,mxEditor.prototype.help=null,mxEditor.prototype.helpWindowImage=null,mxEditor.prototype.urlHelp=null,mxEditor.prototype.helpWidth=300,mxEditor.prototype.helpHeight=260,mxEditor.prototype.propertiesWidth=240,mxEditor.prototype.propertiesHeight=null,mxEditor.prototype.movePropertiesDialog=!1,mxEditor.prototype.validating=!1,mxEditor.prototype.modified=!1,mxEditor.prototype.isModified=function(){return this.modified},mxEditor.prototype.setModified=function(e){this.modified=e},mxEditor.prototype.addActions=function(){this.addAction("save",function(e){e.save()}),this.addAction("print",function(e){new mxPrintPreview(e.graph,1).open()}),this.addAction("show",function(e){mxUtils.show(e.graph,null,10,10)}),this.addAction("exportImage",function(e){var n=e.getUrlImage();if(null==n||mxClient.IS_LOCAL)e.execute("show");else{var t=mxUtils.getViewXml(e.graph,1);t=mxUtils.getXml(t,"\n");mxUtils.submit(n,e.postParameterName+"="+encodeURIComponent(t),document,"_blank")}}),this.addAction("refresh",function(e){e.graph.refresh()}),this.addAction("cut",function(e){e.graph.isEnabled()&&mxClipboard.cut(e.graph)}),this.addAction("copy",function(e){e.graph.isEnabled()&&mxClipboard.copy(e.graph)}),this.addAction("paste",function(e){e.graph.isEnabled()&&mxClipboard.paste(e.graph)}),this.addAction("delete",function(e){e.graph.isEnabled()&&e.graph.removeCells()}),this.addAction("group",function(e){e.graph.isEnabled()&&e.graph.setSelectionCell(e.groupCells())}),this.addAction("ungroup",function(e){e.graph.isEnabled()&&e.graph.setSelectionCells(e.graph.ungroupCells())}),this.addAction("removeFromParent",function(e){e.graph.isEnabled()&&e.graph.removeCellsFromParent()}),this.addAction("undo",function(e){e.graph.isEnabled()&&e.undo()}),this.addAction("redo",function(e){e.graph.isEnabled()&&e.redo()}),this.addAction("zoomIn",function(e){e.graph.zoomIn()}),this.addAction("zoomOut",function(e){e.graph.zoomOut()}),this.addAction("actualSize",function(e){e.graph.zoomActual()}),this.addAction("fit",function(e){e.graph.fit()}),this.addAction("showProperties",function(e,n){e.showProperties(n)}),this.addAction("selectAll",function(e){e.graph.isEnabled()&&e.graph.selectAll()}),this.addAction("selectNone",function(e){e.graph.isEnabled()&&e.graph.clearSelection()}),this.addAction("selectVertices",function(e){e.graph.isEnabled()&&e.graph.selectVertices()}),this.addAction("selectEdges",function(e){e.graph.isEnabled()&&e.graph.selectEdges()}),this.addAction("edit",function(e,n){e.graph.isEnabled()&&e.graph.isCellEditable(n)&&e.graph.startEditingAtCell(n)}),this.addAction("toBack",function(e,n){e.graph.isEnabled()&&e.graph.orderCells(!0)}),this.addAction("toFront",function(e,n){e.graph.isEnabled()&&e.graph.orderCells(!1)}),this.addAction("enterGroup",function(e,n){e.graph.enterGroup(n)}),this.addAction("exitGroup",function(e){e.graph.exitGroup()}),this.addAction("home",function(e){e.graph.home()}),this.addAction("selectPrevious",function(e){e.graph.isEnabled()&&e.graph.selectPreviousCell()}),this.addAction("selectNext",function(e){e.graph.isEnabled()&&e.graph.selectNextCell()}),this.addAction("selectParent",function(e){e.graph.isEnabled()&&e.graph.selectParentCell()}),this.addAction("selectChild",function(e){e.graph.isEnabled()&&e.graph.selectChildCell()}),this.addAction("collapse",function(e){e.graph.isEnabled()&&e.graph.foldCells(!0)}),this.addAction("collapseAll",function(e){if(e.graph.isEnabled()){var n=e.graph.getChildVertices();e.graph.foldCells(!0,!1,n)}}),this.addAction("expand",function(e){e.graph.isEnabled()&&e.graph.foldCells(!1)}),this.addAction("expandAll",function(e){if(e.graph.isEnabled()){var n=e.graph.getChildVertices();e.graph.foldCells(!1,!1,n)}}),this.addAction("bold",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_BOLD)}),this.addAction("italic",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_ITALIC)}),this.addAction("underline",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_UNDERLINE)}),this.addAction("shadow",function(e){e.graph.isEnabled()&&e.graph.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,mxConstants.FONT_SHADOW)}),this.addAction("alignCellsLeft",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_LEFT)}),this.addAction("alignCellsCenter",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_CENTER)}),this.addAction("alignCellsRight",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_RIGHT)}),this.addAction("alignCellsTop",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_TOP)}),this.addAction("alignCellsMiddle",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_MIDDLE)}),this.addAction("alignCellsBottom",function(e){e.graph.isEnabled()&&e.graph.alignCells(mxConstants.ALIGN_BOTTOM)}),this.addAction("alignFontLeft",function(e){e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_LEFT)}),this.addAction("alignFontCenter",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_CENTER)}),this.addAction("alignFontRight",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_ALIGN,mxConstants.ALIGN_RIGHT)}),this.addAction("alignFontTop",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_TOP)}),this.addAction("alignFontMiddle",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_MIDDLE)}),this.addAction("alignFontBottom",function(e){e.graph.isEnabled()&&e.graph.setCellStyles(mxConstants.STYLE_VERTICAL_ALIGN,mxConstants.ALIGN_BOTTOM)}),this.addAction("zoom",function(e){var n=100*e.graph.getView().scale;n=parseFloat(mxUtils.prompt(mxResources.get(e.askZoomResource)||e.askZoomResource,n))/100;isNaN(n)||e.graph.getView().setScale(n)}),this.addAction("toggleTasks",function(e){null!=e.tasks?e.tasks.setVisible(!e.tasks.isVisible()):e.showTasks()}),this.addAction("toggleHelp",function(e){null!=e.help?e.help.setVisible(!e.help.isVisible()):e.showHelp()}),this.addAction("toggleOutline",function(e){null==e.outline?e.showOutline():e.outline.setVisible(!e.outline.isVisible())}),this.addAction("toggleConsole",function(e){mxLog.setVisible(!mxLog.isVisible())})},mxEditor.prototype.createSession=function(){var e=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.SESSION,"session",e))});return this.connect(this.urlInit,this.urlPoll,this.urlNotify,e)},mxEditor.prototype.configure=function(e){null!=e&&(new mxCodec(e.ownerDocument).decode(e,this),this.resetHistory())},mxEditor.prototype.resetFirstTime=function(){document.cookie="mxgraph=seen; expires=Fri, 27 Jul 2001 02:47:11 UTC; path=/"},mxEditor.prototype.resetHistory=function(){this.lastSnapshot=(new Date).getTime(),this.undoManager.clear(),this.ignoredChanges=0,this.setModified(!1)},mxEditor.prototype.addAction=function(e,n){this.actions[e]=n},mxEditor.prototype.execute=function(n,e,t){var a=this.actions[n];if(null!=a)try{var i=arguments;i[0]=this,a.apply(this,i)}catch(e){throw mxUtils.error("Cannot execute "+n+": "+e.message,280,!0),e}else mxUtils.error("Cannot find action "+n,280,!0)},mxEditor.prototype.addTemplate=function(e,n){this.templates[e]=n},mxEditor.prototype.getTemplate=function(e){return this.templates[e]},mxEditor.prototype.createGraph=function(){var e=new mxGraph(null,null,this.graphRenderHint);return e.setTooltips(!0),e.setPanning(!0),this.installDblClickHandler(e),this.installUndoHandler(e),this.installDrillHandler(e),this.installChangeHandler(e),this.installInsertHandler(e),e.panningHandler.factoryMethod=mxUtils.bind(this,function(e,n,t){return this.createPopupMenu(e,n,t)}),e.connectionHandler.factoryMethod=mxUtils.bind(this,function(e,n){return this.createEdge(e,n)}),this.createSwimlaneManager(e),this.createLayoutManager(e),e},mxEditor.prototype.createSwimlaneManager=function(e){return(e=new mxSwimlaneManager(e,!1)).isHorizontal=mxUtils.bind(this,function(){return this.horizontalFlow}),e.isEnabled=mxUtils.bind(this,function(){return this.maintainSwimlanes}),e},mxEditor.prototype.createLayoutManager=function(a){var e=new mxLayoutManager(a),i=this;return e.getLayout=function(e){var n=null,t=i.graph.getModel();return null!=t.getParent(e)&&(i.layoutSwimlanes&&a.isSwimlane(e)?(null==i.swimlaneLayout&&(i.swimlaneLayout=i.createSwimlaneLayout()),n=i.swimlaneLayout):i.layoutDiagram&&(a.isValidRoot(e)||null==t.getParent(t.getParent(e)))&&(null==i.diagramLayout&&(i.diagramLayout=i.createDiagramLayout()),n=i.diagramLayout)),n},e},mxEditor.prototype.setGraphContainer=function(e){null==this.graph.container&&(this.graph.init(e),this.rubberband=new mxRubberband(this.graph),this.disableContextMenu&&mxEvent.disableContextMenu(e),mxClient.IS_QUIRKS&&new mxDivResizer(e))},mxEditor.prototype.installDblClickHandler=function(a){a.addListener(mxEvent.DOUBLE_CLICK,mxUtils.bind(this,function(e,n){var t=n.getProperty("cell");null!=t&&a.isEnabled()&&null!=this.dblClickAction&&(this.execute(this.dblClickAction,t),n.consume())}))},mxEditor.prototype.installUndoHandler=function(a){var e=mxUtils.bind(this,function(e,n){var t=n.getProperty("edit");this.undoManager.undoableEditHappened(t)});a.getModel().addListener(mxEvent.UNDO,e),a.getView().addListener(mxEvent.UNDO,e),e=function(e,n){var t=n.getProperty("edit").changes;a.setSelectionCells(a.getSelectionCellsForChanges(t))},this.undoManager.addListener(mxEvent.UNDO,e),this.undoManager.addListener(mxEvent.REDO,e)},mxEditor.prototype.installDrillHandler=function(e){var n=mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.ROOT))});e.getView().addListener(mxEvent.DOWN,n),e.getView().addListener(mxEvent.UP,n)},mxEditor.prototype.installChangeHandler=function(s){var e=mxUtils.bind(this,function(e,n){this.setModified(!0),1==this.validating&&s.validateGraph();for(var t=n.getProperty("edit").changes,a=0;a<t.length;a++){var i=t[a];if(i instanceof mxRootChange||i instanceof mxValueChange&&i.cell==this.graph.model.root||i instanceof mxCellAttributeChange&&i.cell==this.graph.model.root){this.fireEvent(new mxEventObject(mxEvent.ROOT));break}}});s.getModel().addListener(mxEvent.CHANGE,e)},mxEditor.prototype.installInsertHandler=function(e){var t=this;e.addMouseListener({mouseDown:function(e,n){null==t.insertFunction||n.isPopupTrigger()||!t.forcedInserting&&null!=n.getState()||(t.graph.clearSelection(),t.insertFunction(n.getEvent(),n.getCell()),this.isActive=!0,n.consume())},mouseMove:function(e,n){this.isActive&&n.consume()},mouseUp:function(e,n){this.isActive&&(this.isActive=!1,n.consume())}})},mxEditor.prototype.createDiagramLayout=function(){var e=this.graph.gridSize,n=new mxStackLayout(this.graph,!this.horizontalFlow,this.swimlaneSpacing,2*e,2*e);return n.isVertexIgnored=function(e){return!n.graph.isSwimlane(e)},n},mxEditor.prototype.createSwimlaneLayout=function(){return new mxCompactTreeLayout(this.graph,this.horizontalFlow)},mxEditor.prototype.createToolbar=function(){return new mxDefaultToolbar(null,this)},mxEditor.prototype.setToolbarContainer=function(e){this.toolbar.init(e),mxClient.IS_QUIRKS&&new mxDivResizer(e)},mxEditor.prototype.setStatusContainer=function(e){null==this.status&&(this.status=e,this.addListener(mxEvent.SAVE,mxUtils.bind(this,function(){var e=(new Date).toLocaleString();this.setStatus((mxResources.get(this.lastSavedResource)||this.lastSavedResource)+": "+e)})),this.addListener(mxEvent.OPEN,mxUtils.bind(this,function(){this.setStatus((mxResources.get(this.currentFileResource)||this.currentFileResource)+": "+this.filename)})),mxClient.IS_QUIRKS&&new mxDivResizer(e))},mxEditor.prototype.setStatus=function(e){null!=this.status&&null!=e&&(this.status.innerHTML=e)},mxEditor.prototype.setTitleContainer=function(n){this.addListener(mxEvent.ROOT,mxUtils.bind(this,function(e){n.innerHTML=this.getTitle()})),mxClient.IS_QUIRKS&&new mxDivResizer(n)},mxEditor.prototype.treeLayout=function(e,n){null!=e&&new mxCompactTreeLayout(this.graph,n).execute(e)},mxEditor.prototype.getTitle=function(){for(var e="",n=this.graph,t=n.getCurrentRoot();null!=t&&null!=n.getModel().getParent(n.getModel().getParent(t));)n.isValidRoot(t)&&(e=" > "+n.convertValueToString(t)+e),t=n.getModel().getParent(t);return this.getRootTitle()+e},mxEditor.prototype.getRootTitle=function(){var e=this.graph.getModel().getRoot();return this.graph.convertValueToString(e)},mxEditor.prototype.undo=function(){this.undoManager.undo()},mxEditor.prototype.redo=function(){this.undoManager.redo()},mxEditor.prototype.groupCells=function(){var e=null!=this.groupBorderSize?this.groupBorderSize:this.graph.gridSize;return this.graph.groupCells(this.createGroup(),e)},mxEditor.prototype.createGroup=function(){return this.graph.getModel().cloneCell(this.defaultGroup)},mxEditor.prototype.open=function(e){if(null!=e){var n=mxUtils.load(e).getXml();this.readGraphModel(n.documentElement),this.filename=e,this.fireEvent(new mxEventObject(mxEvent.OPEN,"filename",e))}},mxEditor.prototype.readGraphModel=function(e){new mxCodec(e.ownerDocument).decode(e,this.graph.getModel()),this.resetHistory()},mxEditor.prototype.save=function(e,n){if(null!=(e=e||this.getUrlPost())&&0<e.length){var t=this.writeGraphModel(n);this.postDiagram(e,t),this.setModified(!1)}this.fireEvent(new mxEventObject(mxEvent.SAVE,"url",e))},mxEditor.prototype.postDiagram=function(n,t){this.escapePostData&&(t=encodeURIComponent(t)),mxUtils.post(n,this.postParameterName+"="+t,mxUtils.bind(this,function(e){this.fireEvent(new mxEventObject(mxEvent.POST,"request",e,"url",n,"data",t))}))},mxEditor.prototype.writeGraphModel=function(e){e=null!=e?e:this.linefeed;var n=(new mxCodec).encode(this.graph.getModel());return mxUtils.getXml(n,e)},mxEditor.prototype.getUrlPost=function(){return this.urlPost},mxEditor.prototype.getUrlImage=function(){return this.urlImage},mxEditor.prototype.connect=function(e,n,t,a){var i=null;return mxClient.IS_LOCAL||((i=new mxSession(this.graph.getModel(),e,n,t)).addListener(mxEvent.RECEIVE,mxUtils.bind(this,function(e,n){null!=n.getProperty("node").getAttribute("namespace")&&this.resetHistory()})),i.addListener(mxEvent.DISCONNECT,a),i.addListener(mxEvent.CONNECT,a),i.addListener(mxEvent.NOTIFY,a),i.addListener(mxEvent.GET,a),i.start()),i},mxEditor.prototype.swapStyles=function(e,n){var t=this.graph.getStylesheet().styles[n];this.graph.getView().getStylesheet().putCellStyle(n,this.graph.getStylesheet().styles[e]),this.graph.getStylesheet().putCellStyle(e,t),this.graph.refresh()},mxEditor.prototype.showProperties=function(e){if(null==(e=e||this.graph.getSelectionCell())&&(null==(e=this.graph.getCurrentRoot())&&(e=this.graph.getModel().getRoot())),null!=e){this.graph.stopEditing(!0);var n=(t=mxUtils.getOffset(this.graph.container)).x+10,t=t.y;if(null==this.properties||this.movePropertiesDialog){var a=this.graph.getCellBounds(e);null!=a&&(n+=a.x+Math.min(200,a.width),t+=a.y)}else n=this.properties.getX(),t=this.properties.getY();this.hideProperties(),null!=(e=this.createProperties(e))&&(this.properties=new mxWindow(mxResources.get(this.propertiesResource)||this.propertiesResource,e,n,t,this.propertiesWidth,this.propertiesHeight,!1),this.properties.setVisible(!0))}},mxEditor.prototype.isPropertiesVisible=function(){return null!=this.properties},mxEditor.prototype.createProperties=function(t){var a=this.graph.getModel(),e=a.getValue(t);if(mxUtils.isNode(e)){var n=new mxForm("properties");n.addText("ID",t.getId()).setAttribute("readonly","true");var i=null,s=null,o=null,r=null,l=null;a.isVertex(t)&&(null!=(i=a.getGeometry(t))&&(s=n.addText("top",i.y),o=n.addText("left",i.x),r=n.addText("width",i.width),l=n.addText("height",i.height)));var d=a.getStyle(t),c=n.addText("Style",d||""),m=e.attributes,u=[];for(e=0;e<m.length;e++)u[e]=n.addTextarea(m[e].nodeName,m[e].nodeValue,"label"==m[e].nodeName?4:2);return e=mxUtils.bind(this,function(){this.hideProperties(),a.beginUpdate();try{null!=i&&((i=i.clone()).x=parseFloat(o.value),i.y=parseFloat(s.value),i.width=parseFloat(r.value),i.height=parseFloat(l.value),a.setGeometry(t,i)),0<c.value.length?a.setStyle(t,c.value):a.setStyle(t,null);for(var e=0;e<m.length;e++){var n=new mxCellAttributeChange(t,m[e].nodeName,u[e].value);a.execute(n)}this.graph.isAutoSizeCell(t)&&this.graph.updateCellSize(t)}finally{a.endUpdate()}}),d=mxUtils.bind(this,function(){this.hideProperties()}),n.addButtons(e,d),n.table}return null},mxEditor.prototype.hideProperties=function(){null!=this.properties&&(this.properties.destroy(),this.properties=null)},mxEditor.prototype.showTasks=function(){if(null==this.tasks){var n=document.createElement("div");n.style.padding="4px",n.style.paddingLeft="20px";var e=document.body.clientWidth;(e=new mxWindow(mxResources.get(this.tasksResource)||this.tasksResource,n,e-220,this.tasksTop,200)).setClosable(!0),e.destroyOnClose=!1;var t=mxUtils.bind(this,function(e){mxEvent.release(n),n.innerHTML="",this.createTasks(n)});this.graph.getModel().addListener(mxEvent.CHANGE,t),this.graph.getSelectionModel().addListener(mxEvent.CHANGE,t),this.graph.addListener(mxEvent.ROOT,t),null!=this.tasksWindowImage&&e.setImage(this.tasksWindowImage),this.tasks=e,this.createTasks(n)}this.tasks.setVisible(!0)},mxEditor.prototype.refreshTasks=function(e){null!=this.tasks&&(e=this.tasks.content,mxEvent.release(e),e.innerHTML="",this.createTasks(e))},mxEditor.prototype.createTasks=function(e){},mxEditor.prototype.showHelp=function(e){if(null==this.help){var n=document.createElement("iframe");n.setAttribute("src",mxResources.get("urlHelp")||this.urlHelp),n.setAttribute("height","100%"),n.setAttribute("width","100%"),n.setAttribute("frameBorder","0"),n.style.backgroundColor="white",e=document.body.clientWidth;var t=document.body.clientHeight||document.documentElement.clientHeight,a=new mxWindow(mxResources.get(this.helpResource)||this.helpResource,n,(e-this.helpWidth)/2,(t-this.helpHeight)/3,this.helpWidth,this.helpHeight);a.setMaximizable(!0),a.setClosable(!0),a.destroyOnClose=!1,a.setResizable(!0),null!=this.helpWindowImage&&a.setImage(this.helpWindowImage),mxClient.IS_NS&&(e=function(e){n.setAttribute("height",a.div.offsetHeight-26+"px")},a.addListener(mxEvent.RESIZE_END,e),a.addListener(mxEvent.MAXIMIZE,e),a.addListener(mxEvent.NORMALIZE,e),a.addListener(mxEvent.SHOW,e)),this.help=a}this.help.setVisible(!0)},mxEditor.prototype.showOutline=function(){if(null==this.outline){var e=document.createElement("div");e.style.overflow="hidden",e.style.width="100%",e.style.height="100%",e.style.background="white",e.style.cursor="move";var n=new mxWindow(mxResources.get(this.outlineResource)||this.outlineResource,e,600,480,200,200,!1),t=new mxOutline(this.graph,e);n.setClosable(!0),n.setResizable(!0),n.destroyOnClose=!1,n.addListener(mxEvent.RESIZE_END,function(){t.update()}),this.outline=n,this.outline.outline=t}this.outline.setVisible(!0),this.outline.outline.update(!0)},mxEditor.prototype.setMode=function(e){"select"==e?(this.graph.panningHandler.useLeftButtonForPanning=!1,this.graph.setConnectable(!1)):"connect"==e?(this.graph.panningHandler.useLeftButtonForPanning=!1,this.graph.setConnectable(!0)):"pan"==e&&(this.graph.panningHandler.useLeftButtonForPanning=!0,this.graph.setConnectable(!1))},mxEditor.prototype.createPopupMenu=function(e,n,t){this.popupHandler.createMenu(this,e,n,t)},mxEditor.prototype.createEdge=function(e,n){var t=null;if(null!=this.defaultEdge)t=this.graph.getModel().cloneCell(this.defaultEdge);else{(t=new mxCell("")).setEdge(!0);var a=new mxGeometry;a.relative=!0,t.setGeometry(a)}return null!=(a=this.getEdgeStyle())&&t.setStyle(a),t},mxEditor.prototype.getEdgeStyle=function(){return this.defaultEdgeStyle},mxEditor.prototype.consumeCycleAttribute=function(e){return null!=this.cycleAttributeValues&&0<this.cycleAttributeValues.length&&this.graph.isSwimlane(e)?this.cycleAttributeValues[this.cycleAttributeIndex++%this.cycleAttributeValues.length]:null},mxEditor.prototype.cycleAttribute=function(e){if(null!=this.cycleAttributeName){var n=this.consumeCycleAttribute(e);null!=n&&e.setStyle(e.getStyle()+";"+this.cycleAttributeName+"="+n)}},mxEditor.prototype.addVertex=function(e,n,t,a){for(var i=this.graph.getModel();null!=e&&!this.graph.isValidDropTarget(e);)e=i.getParent(e);e=null!=e?e:this.graph.getSwimlaneAt(t,a);var s=this.graph.getView().scale,o=i.getGeometry(n),r=i.getGeometry(e);if(this.graph.isSwimlane(n)&&!this.graph.swimlaneNesting)e=null;else{if(null==e&&this.swimlaneRequired)return null;if(null!=e&&null!=r){var l=this.graph.getView().getState(e);if(null!=l){if(t-=l.origin.x*s,a-=l.origin.y*s,this.graph.isConstrainedMoving){r=o.width;var d=o.height,c=l.x+l.width;c<t+r&&(t-=t+r-c),(c=l.y+l.height)<a+d&&(a-=a+d-c)}}else null!=r&&(t-=r.x*s,a-=r.y*s)}}(o=o.clone()).x=this.graph.snap(t/s-this.graph.getView().translate.x-this.graph.gridSize/2),o.y=this.graph.snap(a/s-this.graph.getView().translate.y-this.graph.gridSize/2),n.setGeometry(o),null==e&&(e=this.graph.getDefaultParent()),this.cycleAttribute(n),this.fireEvent(new mxEventObject(mxEvent.BEFORE_ADD_VERTEX,"vertex",n,"parent",e)),i.beginUpdate();try{null!=(n=this.graph.addCell(n,e))&&(this.graph.constrainChild(n),this.fireEvent(new mxEventObject(mxEvent.ADD_VERTEX,"vertex",n)))}finally{i.endUpdate()}return null!=n&&(this.graph.setSelectionCell(n),this.graph.scrollCellToVisible(n),this.fireEvent(new mxEventObject(mxEvent.AFTER_ADD_VERTEX,"vertex",n))),n},mxEditor.prototype.destroy=function(){this.destroyed||(this.destroyed=!0,null!=this.tasks&&this.tasks.destroy(),null!=this.outline&&this.outline.destroy(),null!=this.properties&&this.properties.destroy(),null!=this.keyHandler&&this.keyHandler.destroy(),null!=this.rubberband&&this.rubberband.destroy(),null!=this.toolbar&&this.toolbar.destroy(),null!=this.graph&&this.graph.destroy(),this.templates=this.status=null)};var mxCodecRegistry={codecs:[],aliases:[],register:function(e){if(null!=e){var n=e.getName();mxCodecRegistry.codecs[n]=e;var t=mxUtils.getFunctionName(e.template.constructor);t!=n&&mxCodecRegistry.addAlias(t,n)}return e},addAlias:function(e,n){mxCodecRegistry.aliases[e]=n},getCodec:function(e){var n=null;if(null!=e){n=mxUtils.getFunctionName(e);var t=mxCodecRegistry.aliases[n];if(null!=t&&(n=t),null==(n=mxCodecRegistry.codecs[n]))try{n=new mxObjectCodec(new e),mxCodecRegistry.register(n)}catch(e){}}return n}};function mxCodec(e){this.document=e||mxUtils.createXmlDocument(),this.objects=[]}function mxObjectCodec(e,n,t,a){for(var i in this.template=e,this.exclude=null!=n?n:[],this.idrefs=null!=t?t:[],this.mapping=null!=a?a:[],this.reverse={},this.mapping)this.reverse[this.mapping[i]]=i}mxCodec.prototype.document=null,mxCodec.prototype.objects=null,mxCodec.prototype.encodeDefaults=!1,mxCodec.prototype.putObject=function(e,n){return this.objects[e]=n},mxCodec.prototype.getObject=function(e){var n=null;return null!=e&&(null==(n=this.objects[e])&&(null==(n=this.lookup(e))&&(null!=(e=this.getElementById(e))&&(n=this.decode(e))))),n},mxCodec.prototype.lookup=function(e){return null},mxCodec.prototype.getElementById=function(e,n){return mxUtils.findNodeByAttribute(this.document.documentElement,null!=n?n:"id",e)},mxCodec.prototype.getId=function(e){var n=null;return null!=e&&(null==(n=this.reference(e))&&e instanceof mxCell&&(null==(n=e.getId())&&(0==(n=mxCellPath.create(e)).length&&(n="root")))),n},mxCodec.prototype.reference=function(e){return null},mxCodec.prototype.encode=function(e){var n=null;if(null!=e&&null!=e.constructor){var t=mxCodecRegistry.getCodec(e.constructor);null!=t?n=t.encode(this,e):mxUtils.isNode(e)?n=mxClient.IS_IE?e.cloneNode(!0):this.document.importNode(e,!0):mxLog.warn("mxCodec.encode: No codec for "+mxUtils.getFunctionName(e.constructor))}return n},mxCodec.prototype.decode=function(a,b){var c=null;if(null!=a&&a.nodeType==mxConstants.NODETYPE_ELEMENT){var d=null;try{d=eval(a.nodeName)}catch(e){}try{var f=mxCodecRegistry.getCodec(d);null!=f?c=f.decode(this,a,b):(c=a.cloneNode(!0),c.removeAttribute("as"))}catch(e){mxLog.debug("Cannot decode "+a.nodeName+": "+e.message)}}return c},mxCodec.prototype.encodeCell=function(e,n,t){if(n.appendChild(this.encode(e)),null==t||t){t=e.getChildCount();for(var a=0;a<t;a++)this.encodeCell(e.getChildAt(a),n)}},mxCodec.prototype.isCellCodec=function(e){return null!=e&&"function"==typeof e.isCellCodec&&e.isCellCodec()},mxCodec.prototype.decodeCell=function(e,n){n=null==n||n;var t=null;if(null!=e&&e.nodeType==mxConstants.NODETYPE_ELEMENT){if(t=mxCodecRegistry.getCodec(e.nodeName),!this.isCellCodec(t))for(var a=e.firstChild;null!=a&&!this.isCellCodec(t);)t=mxCodecRegistry.getCodec(a.nodeName),a=a.nextSibling;this.isCellCodec(t)||(t=mxCodecRegistry.getCodec(mxCell)),t=t.decode(this,e),n&&this.insertIntoGraph(t)}return t},mxCodec.prototype.insertIntoGraph=function(e){var n=e.parent,t=e.getTerminal(!0),a=e.getTerminal(!1);e.setTerminal(null,!1),e.setTerminal(null,!0),(e.parent=null)!=n&&n.insert(e),null!=t&&t.insertEdge(e,!0),null!=a&&a.insertEdge(e,!1)},mxCodec.prototype.setAttribute=function(e,n,t){null!=n&&null!=t&&e.setAttribute(n,t)},mxObjectCodec.prototype.template=null,mxObjectCodec.prototype.exclude=null,mxObjectCodec.prototype.idrefs=null,mxObjectCodec.prototype.mapping=null,mxObjectCodec.prototype.reverse=null,mxObjectCodec.prototype.getName=function(){return mxUtils.getFunctionName(this.template.constructor)},mxObjectCodec.prototype.cloneTemplate=function(){return new this.template.constructor},mxObjectCodec.prototype.getFieldName=function(e){if(null!=e){var n=this.reverse[e];null!=n&&(e=n)}return e},mxObjectCodec.prototype.getAttributeName=function(e){if(null!=e){var n=this.mapping[e];null!=n&&(e=n)}return e},mxObjectCodec.prototype.isExcluded=function(e,n,t,a){return n==mxObjectIdentity.FIELD_NAME||0<=mxUtils.indexOf(this.exclude,n)},mxObjectCodec.prototype.isReference=function(e,n,t,a){return 0<=mxUtils.indexOf(this.idrefs,n)},mxObjectCodec.prototype.encode=function(e,n){var t=e.document.createElement(this.getName());return n=this.beforeEncode(e,n,t),this.encodeObject(e,n,t),this.afterEncode(e,n,t)},mxObjectCodec.prototype.encodeObject=function(e,n,t){for(var a in e.setAttribute(t,"id",e.getId(n)),n){var i=a,s=n[i];null!=s&&!this.isExcluded(n,i,s,!0)&&(mxUtils.isNumeric(i)&&(i=null),this.encodeValue(e,n,i,s,t))}},mxObjectCodec.prototype.encodeValue=function(e,n,t,a,i){if(null!=a){if(this.isReference(n,t,a,!0)){var s=e.getId(a);if(null==s)return void mxLog.warn("mxObjectCodec.encode: No ID for "+this.getName()+"."+t+"="+a);a=s}s=this.template[t],(null==t||e.encodeDefaults||s!=a)&&(t=this.getAttributeName(t),this.writeAttribute(e,n,t,a,i))}},mxObjectCodec.prototype.writeAttribute=function(e,n,t,a,i){"object"!=typeof a?this.writePrimitiveAttribute(e,n,t,a,i):this.writeComplexAttribute(e,n,t,a,i)},mxObjectCodec.prototype.writePrimitiveAttribute=function(e,n,t,a,i){a=this.convertValueToXml(a),null==t?(n=e.document.createElement("add"),"function"==typeof a?n.appendChild(e.document.createTextNode(a)):e.setAttribute(n,"value",a),i.appendChild(n)):"function"!=typeof a&&e.setAttribute(i,t,a)},mxObjectCodec.prototype.writeComplexAttribute=function(e,n,t,a,i){null!=(e=e.encode(a))?(null!=t&&e.setAttribute("as",t),i.appendChild(e)):mxLog.warn("mxObjectCodec.encode: No node for "+this.getName()+"."+t+": "+a)},mxObjectCodec.prototype.convertValueToXml=function(e){return void 0!==e.length||1!=e&&0!=e||(e=1==e?"1":"0"),e},mxObjectCodec.prototype.convertValueFromXml=function(e){return mxUtils.isNumeric(e)&&(e=parseFloat(e)),e},mxObjectCodec.prototype.beforeEncode=function(e,n,t){return n},mxObjectCodec.prototype.afterEncode=function(e,n,t){return t},mxObjectCodec.prototype.decode=function(e,n,t){var a=n.getAttribute("id"),i=e.objects[a];return null==i&&(i=t||this.cloneTemplate(),null!=a&&e.putObject(a,i)),n=this.beforeDecode(e,n,i),this.decodeNode(e,n,i),this.afterDecode(e,n,i)},mxObjectCodec.prototype.decodeNode=function(e,n,t){null!=n&&(this.decodeAttributes(e,n,t),this.decodeChildren(e,n,t))},mxObjectCodec.prototype.decodeAttributes=function(e,n,t){if(null!=(n=n.attributes))for(var a=0;a<n.length;a++)this.decodeAttribute(e,n[a],t)},mxObjectCodec.prototype.decodeAttribute=function(e,n,t){var a=n.nodeName;if("as"!=a&&"id"!=a){n="value"==a?n.nodeValue:this.convertValueFromXml(n.nodeValue);var i=this.getFieldName(a);if(this.isReference(t,i,n,!1)){if(null==(e=e.getObject(n)))return void mxLog.warn("mxObjectCodec.decode: No object for "+this.getName()+"."+a+"="+n);n=e}this.isExcluded(t,a,n,!1)||(t[a]=n)}},mxObjectCodec.prototype.decodeChildren=function(e,n,t){for(n=n.firstChild;null!=n;){var a=n.nextSibling;n.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,n,t)&&this.decodeChild(e,n,t),n=a}},mxObjectCodec.prototype.decodeChild=function(e,n,t){var a=this.getFieldName(n.getAttribute("as"));if(null==a||!this.isExcluded(t,a,n,!1)){var i=this.getFieldTemplate(t,a,n),s=null;"add"==n.nodeName?null==(s=n.getAttribute("value"))&&(s=mxUtils.eval(mxUtils.getTextContent(n))):s=e.decode(n,i),this.addObjectValue(t,a,s,i)}},mxObjectCodec.prototype.getFieldTemplate=function(e,n,t){return(e=e[n])instanceof Array&&0<e.length&&(e=null),e},mxObjectCodec.prototype.addObjectValue=function(e,n,t,a){null!=t&&t!=a&&(null!=n&&0<n.length?e[n]=t:e.push(t))},mxObjectCodec.prototype.processInclude=function(e,n,t){if("include"!=n.nodeName)return!1;if(null!=(n=n.getAttribute("name")))try{var a=mxUtils.load(n).getDocumentElement();null!=a&&e.decode(a,t)}catch(e){}return!0},mxObjectCodec.prototype.beforeDecode=function(e,n,t){return n},mxObjectCodec.prototype.afterDecode=function(e,n,t){return t},mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxCell,["children","edges","overlays","mxTransient"],["parent","source","target"]);return e.isCellCodec=function(){return!0},e.isExcluded=function(e,n,t,a){return mxObjectCodec.prototype.isExcluded.apply(this,arguments)||a&&"value"==n&&t.nodeType==mxConstants.NODETYPE_ELEMENT},e.afterEncode=function(e,n,t){if(null!=n.value&&n.value.nodeType==mxConstants.NODETYPE_ELEMENT){var a=t;(t=mxClient.IS_IE?n.value.cloneNode(!0):e.document.importNode(n.value,!0)).appendChild(a),e=a.getAttribute("id"),t.setAttribute("id",e),a.removeAttribute("id")}return t},e.beforeDecode=function(e,n,t){var a=n,i=this.getName();if(n.nodeName!=i?(null!=(a=n.getElementsByTagName(i)[0])&&a.parentNode==n?(mxUtils.removeWhitespace(a,!0),mxUtils.removeWhitespace(a,!1),a.parentNode.removeChild(a)):a=null,t.value=n.cloneNode(!0),null!=(n=t.value.getAttribute("id"))&&(t.setId(n),t.value.removeAttribute("id"))):t.setId(n.getAttribute("id")),null!=a)for(n=0;n<this.idrefs.length;n++){i=this.idrefs[n];var s=a.getAttribute(i);if(null!=s){a.removeAttribute(i);var o=e.objects[s]||e.lookup(s);null==o&&(null!=(s=e.getElementById(s))&&(o=(mxCodecRegistry.codecs[s.nodeName]||this).decode(e,s))),t[i]=o}}return a},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphModel);return e.encodeObject=function(e,n,t){var a=e.document.createElement("root");e.encodeCell(n.getRoot(),a),t.appendChild(a)},e.decodeChild=function(e,n,t){"root"==n.nodeName?this.decodeRoot(e,n,t):mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeRoot=function(e,n,t){var a=null;for(n=n.firstChild;null!=n;){var i=e.decodeCell(n);null!=i&&null==i.getParent()&&(a=i),n=n.nextSibling}null!=a&&t.setRoot(a)},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxRootChange,["model","previous","root"]);return e.afterEncode=function(e,n,t){return e.encodeCell(n.root,t),t},e.beforeDecode=function(e,n,t){if(null!=n.firstChild&&n.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(n=n.cloneNode(!0)).firstChild;for(t.root=e.decodeCell(a,!1),t=a.nextSibling,a.parentNode.removeChild(a),a=t;null!=a;)t=a.nextSibling,e.decodeCell(a),a.parentNode.removeChild(a),a=t}return n},e.afterDecode=function(e,n,t){return t.previous=t.root,t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxChildChange,["model","child","previousIndex"],["parent","previous"]);return e.isReference=function(e,n,t,a){return!("child"!=n||null==e.previous&&a)||0<=mxUtils.indexOf(this.idrefs,n)},e.afterEncode=function(e,n,t){return this.isReference(n,"child",n.child,!0)?t.setAttribute("child",e.getId(n.child)):e.encodeCell(n.child,t),t},e.beforeDecode=function(e,n,t){if(null!=n.firstChild&&n.firstChild.nodeType==mxConstants.NODETYPE_ELEMENT){var a=(n=n.cloneNode(!0)).firstChild;for(t.child=e.decodeCell(a,!1),t=a.nextSibling,a.parentNode.removeChild(a),a=t;null!=a;){if(t=a.nextSibling,a.nodeType==mxConstants.NODETYPE_ELEMENT){var i=a.getAttribute("id");null==e.lookup(i)&&e.decodeCell(a)}a.parentNode.removeChild(a),a=t}}else a=n.getAttribute("child"),t.child=e.getObject(a);return n},e.afterDecode=function(e,n,t){return t.child.parent=t.previous,t.previous=t.parent,t.previousIndex=t.index,t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxTerminalChange,["model","previous"],["cell","terminal"]);return e.afterDecode=function(e,n,t){return t.previous=t.terminal,t},e}());var mxGenericChangeCodec=function(e,a){var n=new mxObjectCodec(e,["model","previous"],["cell"]);return n.afterDecode=function(e,n,t){return mxUtils.isNode(t.cell)&&(t.cell=e.decodeCell(t.cell,!1)),t.previous=t[a],t},n};mxCodecRegistry.register(mxGenericChangeCodec(new mxValueChange,"value")),mxCodecRegistry.register(mxGenericChangeCodec(new mxStyleChange,"style")),mxCodecRegistry.register(mxGenericChangeCodec(new mxGeometryChange,"geometry")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCollapseChange,"collapsed")),mxCodecRegistry.register(mxGenericChangeCodec(new mxVisibleChange,"visible")),mxCodecRegistry.register(mxGenericChangeCodec(new mxCellAttributeChange,"value")),mxCodecRegistry.register(new mxObjectCodec(new mxGraph,"graphListeners eventListeners view container cellRenderer editor selection".split(" "))),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxGraphView);return e.encode=function(e,n){return this.encodeCell(e,n,n.graph.getModel().getRoot())},e.encodeCell=function(e,n,t){var a=n.graph.getModel(),i=n.getState(t),s=a.getParent(t);if(null==s||null!=i){var o=a.getChildCount(t),r=n.graph.getCellGeometry(t),l=null;if(s==a.getRoot()?l="layer":null==s?l="graph":a.isEdge(t)?l="edge":0<o&&null!=r?l="group":a.isVertex(t)&&(l="vertex"),null!=l){var d=e.document.createElement(l);if(null!=n.graph.getLabel(t)&&(d.setAttribute("label",n.graph.getLabel(t)),n.graph.isHtmlLabel(t)&&d.setAttribute("html",!0)),null==s){var c=n.getGraphBounds();null!=c&&(d.setAttribute("x",Math.round(c.x)),d.setAttribute("y",Math.round(c.y)),d.setAttribute("width",Math.round(c.width)),d.setAttribute("height",Math.round(c.height))),d.setAttribute("scale",n.scale)}else if(null!=i&&null!=r){for(c in i.style)"function"==typeof(s=i.style[c])&&"object"==typeof s&&(s=mxStyleRegistry.getName(s)),null!=s&&"function"!=typeof s&&"object"!=typeof s&&d.setAttribute(c,s);if(null!=(s=i.absolutePoints)&&0<s.length){for(r=Math.round(s[0].x)+","+Math.round(s[0].y),c=1;c<s.length;c++)r+=" "+Math.round(s[c].x)+","+Math.round(s[c].y);d.setAttribute("points",r)}else d.setAttribute("x",Math.round(i.x)),d.setAttribute("y",Math.round(i.y)),d.setAttribute("width",Math.round(i.width)),d.setAttribute("height",Math.round(i.height));null!=(c=i.absoluteOffset)&&(0!=c.x&&d.setAttribute("dx",Math.round(c.x)),0!=c.y&&d.setAttribute("dy",Math.round(c.y)))}for(c=0;c<o;c++)null!=(i=this.encodeCell(e,n,a.getChildAt(t,c)))&&d.appendChild(i)}}return d},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxStylesheet);return e.encode=function(e,n){var t,a=e.document.createElement(this.getName());for(t in n.styles){var i=n.styles[t],s=e.document.createElement("add");if(null!=t){for(var o in s.setAttribute("as",t),i){var r=this.getStringValue(o,i[o]);if(null!=r){var l=e.document.createElement("add");l.setAttribute("value",r),l.setAttribute("as",o),s.appendChild(l)}}0<s.childNodes.length&&a.appendChild(s)}}return a},e.getStringValue=function(e,n){var t=typeof n;return"function"==t?n=mxStyleRegistry.getName(style[j]):"object"==t&&(n=null),n},e.decode=function(e,n,t){t=t||new this.template.constructor;var a=n.getAttribute("id");for(null!=a&&(e.objects[a]=t),n=n.firstChild;null!=n;){if(!this.processInclude(e,n,t)&&"add"==n.nodeName&&null!=(a=n.getAttribute("as"))){var i=n.getAttribute("extend"),s=null!=i?mxUtils.clone(t.styles[i]):null;for(null==s&&(null!=i&&mxLog.warn("mxStylesheetCodec.decode: stylesheet "+i+" not found to extend"),s={}),i=n.firstChild;null!=i;){if(i.nodeType==mxConstants.NODETYPE_ELEMENT){var o=i.getAttribute("as");if("add"==i.nodeName){var r=mxUtils.getTextContent(i),l=null;null!=r&&0<r.length?l=mxUtils.eval(r):(l=i.getAttribute("value"),mxUtils.isNumeric(l)&&(l=parseFloat(l))),null!=l&&(s[o]=l)}else"remove"==i.nodeName&&delete s[o]}i=i.nextSibling}t.putCellStyle(a,s)}n=n.nextSibling}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultKeyHandler);return e.encode=function(e,n){return null},e.decode=function(e,n,t){if(null!=t)for(n=n.firstChild;null!=n;){if(!this.processInclude(e,n,t)&&"add"==n.nodeName){var a=n.getAttribute("as"),i=n.getAttribute("action"),s=n.getAttribute("control");t.bindAction(a,i,s)}n=n.nextSibling}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultToolbar);return e.encode=function(e,n){return null},e.decode=function(e,n,t){if(null!=t){var a=t.editor;for(n=n.firstChild;null!=n;){if(n.nodeType==mxConstants.NODETYPE_ELEMENT&&!this.processInclude(e,n,t))if("separator"==n.nodeName)t.addSeparator();else if("br"==n.nodeName)t.toolbar.addBreak();else if("hr"==n.nodeName)t.toolbar.addLine();else if("add"==n.nodeName){var i=n.getAttribute("as"),s=(i=mxResources.get(i)||i,n.getAttribute("icon")),o=n.getAttribute("pressedIcon"),r=n.getAttribute("action"),l=n.getAttribute("mode"),d=n.getAttribute("template"),c="0"!=n.getAttribute("toggle"),m=mxUtils.getTextContent(n),u=null;if(null!=r)u=t.addItem(i,s,r,o);else if(null!=l){var p=mxUtils.eval(m);u=t.addMode(i,s,l,o,p)}else if(null!=d||null!=m&&0<m.length)u=a.templates[d],d=n.getAttribute("style"),null!=u&&null!=d&&(u=u.clone()).setStyle(d),(d=null)!=m&&0<m.length&&(d=mxUtils.eval(m)),u=t.addPrototype(i,s,u,o,d,c);else if(0<(o=mxUtils.getChildNodes(n)).length)if(null==s)for(d=t.addActionCombo(i),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?t.addOption(d,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),c=c.getAttribute("action"),t.addActionOption(d,s,c));else{var g=null,v=t.addPrototype(i,s,function(){if(null==(e=a.templates[g.value]))return mxLog.warn("Template "+e+" not found"),null;var e=e.clone(),n=g.options[g.selectedIndex].cellStyle;return null!=n&&e.setStyle(n),e},null,null,c);g=t.addCombo();for(mxEvent.addListener(g,"change",function(){t.toolbar.selectMode(v,function(e){return e=mxUtils.convertPoint(a.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e)),a.addVertex(null,p(),e.x,e.y)}),t.toolbar.noReset=!1}),i=0;i<o.length;i++)"separator"==(c=o[i]).nodeName?t.addOption(g,"---"):"add"==c.nodeName&&(s=c.getAttribute("as"),m=c.getAttribute("template"),t.addOption(g,s,m||d).cellStyle=c.getAttribute("style"))}null!=u&&(null!=(d=n.getAttribute("id"))&&0<d.length&&u.setAttribute("id",d))}n=n.nextSibling}}return t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxDefaultPopupMenu);return e.encode=function(e,n){return null},e.decode=function(e,n,t){var a=n.getElementsByTagName("include")[0];return null!=a?this.processInclude(e,a,t):null!=t&&(t.config=n),t},e}()),mxCodecRegistry.register(function(){var e=new mxObjectCodec(new mxEditor,"modified lastSnapshot ignoredChanges undoManager graphContainer toolbarContainer".split(" "));return e.afterDecode=function(e,n,t){return null!=(e=n.getAttribute("defaultEdge"))&&(n.removeAttribute("defaultEdge"),t.defaultEdge=t.templates[e]),null!=(e=n.getAttribute("defaultGroup"))&&(n.removeAttribute("defaultGroup"),t.defaultGroup=t.templates[e]),t},e.decodeChild=function(e,n,t){if("Array"==n.nodeName){if("templates"==n.getAttribute("as"))return void this.decodeTemplates(e,n,t)}else if("ui"==n.nodeName)return void this.decodeUi(e,n,t);mxObjectCodec.prototype.decodeChild.apply(this,arguments)},e.decodeUi=function(e,n,t){for(e=n.firstChild;null!=e;){if("add"==e.nodeName){n=e.getAttribute("as");var a=e.getAttribute("element"),i=e.getAttribute("style"),s=null;if(null!=a)null!=(s=document.getElementById(a))&&null!=i&&(s.style.cssText+=";"+i);else{a=parseInt(e.getAttribute("x"));var o=parseInt(e.getAttribute("y")),r=e.getAttribute("width"),l=e.getAttribute("height");(s=document.createElement("div")).style.cssText=i,new mxWindow(mxResources.get(n)||n,s,a,o,r,l,!1,!0).setVisible(!0)}"graph"==n?t.setGraphContainer(s):"toolbar"==n?t.setToolbarContainer(s):"title"==n?t.setTitleContainer(s):"status"==n?t.setStatusContainer(s):"map"==n&&t.setMapContainer(s)}else"resource"==e.nodeName?mxResources.add(e.getAttribute("basename")):"stylesheet"==e.nodeName&&mxClient.link("stylesheet",e.getAttribute("name"));e=e.nextSibling}},e.decodeTemplates=function(e,n,t){null==t.templates&&(t.templates=[]),n=mxUtils.getChildNodes(n);for(var a=0;a<n.length;a++){for(var i=n[a].getAttribute("as"),s=n[a].firstChild;null!=s&&1!=s.nodeType;)s=s.nextSibling;null!=s&&(t.templates[i]=e.decodeCell(s))}},e}()),EditorUi=function(e,n,t){this.projectDesignController=e,this.editor=n||new Editor,this.container=t||document.body;var a=n.graph,i=this;CRUD_PERMISSIONS=this.projectDesignController.crudPermissions;var s=mxUtils.bind(this,function(e){return null==e&&(e=window.event),!!this.isEditingEnabled()&&a.isEditing()});this.container.style.overflow="hidden",(new Image).src=mxPopupMenu.prototype.submenuImage,null!=mxConnectionHandler.prototype.connectImage&&((new Image).src=mxConnectionHandler.prototype.connectImage.src),this.actions=new Actions(this),this.menus=new Menus(this),this.createDivs(),this.refresh(),this.createUi(),this.container==document.body&&(this.menubarContainer.onselectstart=s,this.menubarContainer.onmousedown=s,this.toolbarContainer.onselectstart=s,this.toolbarContainer.onmousedown=s,this.diagramContainer.onselectstart=s,this.diagramContainer.onmousedown=s,this.sidebarContainer.onselectstart=s,this.sidebarContainer.onmousedown=s,this.footerContainer.onselectstart=s,this.footerContainer.onmousedown=s),mxClient.IS_IE&&(void 0===document.documentMode||document.documentMode<9)?(mxEvent.addListener(this.diagramContainer,"contextmenu",s),mxEvent.addListener(this.sidebarContainer,"contextmenu",s)):(this.diagramContainer.oncontextmenu=s,this.sidebarContainer.oncontextmenu=s),a.init(this.diagramContainer),a.refresh(),a.setEnabled(this.isEditingEnabled()),a.container.setAttribute("tabindex","0"),a.container.style.cursor="default",a.container.style.backgroundImage="url("+n.gridImage+")",a.container.style.backgroundPosition="-1px -1px",a.container.focus();var o=a.fireMouseEvent;a.fireMouseEvent=function(e,n,t){e==mxEvent.MOUSE_DOWN&&this.container.focus(),o.apply(this,arguments)},this.createMultiplicities(a.multiplicities,["start","finally","end"],[[1,1],[1,1],[0,0]],[[0,0],[0,0],[1,"n"]]),this.createMultiplicities(a.multiplicities,["answer","hangup","dial","ext_dial","queue","voicemail","callback"],[[1,1],[0,0],[0,1],[0,1],[0,1],[1,1],[0,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["login","pause","unpause","logout"],[[1,2],[1,2],[1,2],[1,2]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["set","math"],[[1,1],[1,1]],[[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["background","playback","menu","saydigits","saynumber","sayphonetic","google_cloud_tts","tts","ispeechtts","awspolly","getdigits","getsecretdigits","lumenvoxtts","sestektts","mrcpsynth"],[[1,"n"],[1,1],[1,"n"],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,"n"],[1,"n"],[1,1],[1,1],[1,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["record"],[[1,1]],[[1,"n"]]),this.createMultiplicities(a.multiplicities,["database","ispeechasr","sendSMS","sendMail","sendFax","googleasr","lumenvoxasr","tildeasr","dialogflow","dialogflowV2","awslex","sesteknda","sestekasr","restapi","mrcprecog"],[[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1],[1,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["gotoc","gotoif","gotoiftime","vswitch"],[[0,0],[1,2],[1,2],[1,"n"]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["queuelog","goal"],[[1,1],[1,1]],[[1,"n"],[1,"n"]]),this.createMultiplicities(a.multiplicities,["noop","system","agi","subproject","custom_app"],[[1,1],[1,1],[0,1],[0,1],[0,1]],[[1,"n"],[1,"n"],[1,"n"],[1,"n"],[1,"n"]]),a.dblClick=function(e,t){var n=new mxEventObject(mxEvent.DOUBLE_CLICK,"event",e,"cell",t);this.fireEvent(n),mxEvent.isConsumed(e)||n.isConsumed()||(this.getModel().isEdge(t)?0<=["background","gotoif","gotoiftime","menu","getdigits","getsecretdigits","vswitch","login","pause","unpause","logout"].indexOf(t.source.value.tagName)&&this.startEditingAtCell(t):this.getModel().isVertex(t)&&i.projectDesignController.openDialog(t.getValue(),function(e){for(var n=0;n<e.length;n+=1)t.setAttribute(e[n].name,e[n].value);a.refresh(t)}),n.consume())},a.panningHandler.autoExpand=!0,a.panningHandler.factoryMethod=mxUtils.bind(this,function(e,n,t){this.isEditingEnabled()&&this.menus.createPopupMenu(e,n,t)}),n.outline.init(this.outlineContainer),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){a.panningHandler.hideMenu()})),mxClient.IS_TOUCH&&(mxEvent.addListener(a.container,"gesturechange",mxUtils.bind(this,function(e){a.view.getDrawPane().setAttribute("transform","scale("+e.scale+")"),a.view.getOverlayPane().style.visibility="hidden"})),mxEvent.addListener(a.container,"gestureend",mxUtils.bind(this,function(e){a.view.getDrawPane().removeAttribute("transform"),a.zoomToCenter=!0,a.zoom(e.scale),a.view.getOverlayPane().style.visibility="visible"})));var r=this.isEditingEnabled()?this.createKeyHandler(n):null;this.getKeyHandler=function(){return r},mxEvent.addListener(window,"resize",mxUtils.bind(this,function(){this.refresh(),a.sizeDidChange(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()})),this.init(),this.open(),this.refresh()},EditorUi.prototype.splitSize=mxClient.IS_TOUCH?16:8,EditorUi.prototype.menubarHeight=33,EditorUi.prototype.toolbarHeight=36,EditorUi.prototype.footerHeight=0,EditorUi.prototype.hsplitPosition=204,EditorUi.prototype.vsplitPosition=190,EditorUi.prototype.init=function(){this.addUndoListener(),this.addSelectionListener();var e=this.actions.get("paste"),n=function(){e.setEnabled(!mxClipboard.isEmpty())},t=mxClipboard.cut;mxClipboard.cut=function(){t.apply(this,arguments),n()};var a=mxClipboard.copy;mxClipboard.copy=function(){a.apply(this,arguments),n()}},EditorUi.prototype.isEditingEnabled=function(){return!!CRUD_PERMISSIONS.canEdit},EditorUi.prototype.exportXML=function(e){var n=window.document.createElement("a");n.href="data:attachment/text;charset=utf-8,"+encodeURIComponent(e),n.download=this.editor.filename+".xml",n.target="_self",n.click()},EditorUi.prototype.open=function(){try{null!=window.opener&&null!=window.opener.openFile&&window.opener.openFile.setConsumer(mxUtils.bind(this,function(e,n){try{var t=mxUtils.parseXml(e);this.editor.setGraphXml(t.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=n&&(this.editor.filename=n)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}}))}catch(e){}},EditorUi.prototype.openString=function(e,n,t){try{var a=mxUtils.parseXml(e);this.editor.setGraphXml(a.documentElement),this.editor.modified=!1,this.editor.undoManager.clear(),null!=n&&(this.editor.filename=n),null!=t&&(this.editor.data=t)}catch(e){mxUtils.alert(mxResources.get("invalidOrMissingFile")+": "+e.message)}},EditorUi.prototype.validate=function(e,n){for(var t=this.editor.graph,a=(e=null!=e?e:t.model.getRoot(),n=null!=n?n:{},!0),i=t.model.getChildCount(e),s=0;s<i;s++){var o=t.model.getChildAt(e,s),r=n;t.isValidRoot(o)&&(r={}),null!=(r=this.validate(o,r))?t.setCellWarning(o,r.replace(/\n/g,"<br>")):t.setCellWarning(o,null),a=a&&null==r}if(i="",t.model.isVertex(e))switch(e.value.nodeName){case"start":i=this.validateBlock("start")?"":"Only one Start block is allowed\n";break;case"finally":i=this.validateBlock("finally")?"":"Only one Finally block is allowed\n";break;case"playback":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n";break;case"answer":i=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"menu":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("digit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("response")?"":mxResources.get("invalidTimeout")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"getdigits":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n",i+=0<e.value.getAttribute("mindigit")?"":mxResources.get("wrongMinDigit")+"\n",i+=0<e.value.getAttribute("maxdigit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"getsecretdigits":i=0<e.value.getAttribute("file_id")?"":mxResources.get("noAudioSelected")+"\n",i+=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n",i+=0<e.value.getAttribute("mindigit")?"":mxResources.get("wrongMinDigit")+"\n",i+=0<e.value.getAttribute("maxdigit")?"":mxResources.get("wrongMaxDigit")+"\n",i+=0<=e.value.getAttribute("hiddendigitsnum")?"":mxResources.get("wrongHiddenDigitsnum")+"\n",i+=0<=e.value.getAttribute("retry")?"":mxResources.get("invalidRetry")+"\n";break;case"vswitch":i=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n";break;case"database":i=0<e.value.getAttribute("odbc_id")?"":mxResources.get("noDatabaseSelected")+"\n",i+=""!==e.value.getAttribute("query")?"":mxResources.get("missingQuery")+"\n";break;case"set":case"math":i=0<e.value.getAttribute("variable_id")?"":mxResources.get("noVariableSelected")+"\n";break;case"gotoc":i=""!==e.value.getAttribute("context")?"":mxResources.get("noContextSelected")+"\n",i+=""!==e.value.getAttribute("extension")?"":mxResources.get("noExtensionSelected")+"\n",i+=1<=e.value.getAttribute("priority")?"":mxResources.get("invalidPriority")+"\n";break;case"system":case"agi":i=""!==e.value.getAttribute("command")?"":mxResources.get("noCommandSelected")+"\n";break;case"gotoif":i=""!==e.value.getAttribute("condition")?"":mxResources.get("noConditionSelected")+"\n";break;case"saydigits":i=""!==e.value.getAttribute("digits")?"":mxResources.get("noDigitsSelected")+"\n";break;case"saynumber":i=""!==e.value.getAttribute("number")?"":mxResources.get("noNumberSelected")+"\n";break;case"sayphonetic":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"record":i=""!==e.value.getAttribute("file")?"":mxResources.get("noFileSelected")+"\n",i+=-1<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"goal":i=""!==e.value.getAttribute("goalname")?"":mxResources.get("noGoalSelected")+"\n";break;case"ext_dial":i=""!==e.value.getAttribute("trunk_name")?"":mxResources.get("noTrunkSelected")+"\n",i+=""!==e.value.getAttribute("phone")?"":mxResources.get("noIdentifierSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"dial":i=0<e.value.getAttribute("sip_id")?"":mxResources.get("noIdentifierSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"queue":i="-1"!==e.value.getAttribute("queue_id")?"":mxResources.get("noQueueSelected")+"\n",i+=0<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"callback":i="-1"!==e.value.getAttribute("list_id")?"":mxResources.get("noListSelected")+"\n",i+=""!==e.value.getAttribute("name")?"":mxResources.get("noFirstNameSelected")+"\n",i+=""!==e.value.getAttribute("phone")?"":mxResources.get("noPhoneSelected")+"\n",i+=""!==e.value.getAttribute("delay")?"":mxResources.get("invalidDelay")+"\n";break;case"gotoiftime":i=0<e.value.getAttribute("interval_id")?"":mxResources.get("noIntervalSelected")+"\n";break;case"voicemail":i=""!==e.value.getAttribute("mailbox")?"":mxResources.get("noBoxNumberSelected")+"\n";break;case"subproject":i=0<e.value.getAttribute("project_id")?"":mxResources.get("noProjectSelected")+"\n";break;case"sendSMS":i=0<e.value.getAttribute("sms_account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n",i+=""!==e.value.getAttribute("sms_text")?"":mxResources.get("noTextSelected")+"\n";break;case"sendMail":i=0<e.value.getAttribute("account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n";break;case"sendFax":i=0<e.value.getAttribute("account_id")?"":mxResources.get("noAccountSelected")+"\n",i+=""!==e.value.getAttribute("to")?"":mxResources.get("noRecipientSelected")+"\n",i+=""!==e.value.getAttribute("attachment_path")?"":mxResources.get("noAttachmentSelected")+"\n";break;case"google_cloud_tts":i=""!==e.value.getAttribute("apiKey")?"":mxResources.get("noApiKeySelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"tts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"awspolly":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("aws_access_key_id")?"":mxResources.get("noAccessKeySelected")+"\n",i+=""!==e.value.getAttribute("aws_secret_access_key")?"":mxResources.get("noSecretAccessKeySelected")+"\n";break;case"awslex":i=""!==e.value.getAttribute("aws_bot_name")?"":mxResources.get("noNameSelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("aws_access_key_id")?"":mxResources.get("noAccessKeySelected")+"\n",i+=""!==e.value.getAttribute("aws_secret_access_key")?"":mxResources.get("noSecretAccessKeySelected")+"\n";break;case"ispeechtts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=-10<=e.value.getAttribute("speed")&&e.value.getAttribute("speed")<=10?"":mxResources.get("invalidSpeed")+"\n";break;case"lumenvoxtts":case"sestektts":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"lumenvoxasr":case"sestekasr":i=""!==e.value.getAttribute("grammar")?"":mxResources.get("noGrammarSelected")+"\n";break;case"ispeechasr":case"googleasr":i=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=-1<=e.value.getAttribute("timeout")?"":mxResources.get("invalidTimeout")+"\n";break;case"tildeasr":i=""!==e.value.getAttribute("appid")?"":mxResources.get("noAppIdInserted")+"\n",i+=""!==e.value.getAttribute("appsecret")?"":mxResources.get("noAppSecretInserted")+"\n",i+=""!==e.value.getAttribute("uri")?"":mxResources.get("noUrlInserted")+"\n";break;case"custom_app":i=""!==e.value.getAttribute("application")?"":mxResources.get("noApplicationSelected")+"\n";break;case"login":case"pause":case"unpause":case"logout":i=""!==e.value.getAttribute("findBy")?"":mxResources.get("noFindBySelected")+"\n";break;case"sesteknda":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("ndauth_url")?"":mxResources.get("noUrlInserted")+"\n",i+=""!==e.value.getAttribute("ndassistant_url")?"":mxResources.get("noUrlInserted")+"\n",i+=""!==e.value.getAttribute("username")?"":mxResources.get("noUsernameSelected")+"\n",i+=""!==e.value.getAttribute("password")?"":mxResources.get("noPasswordSelected")+"\n";break;case"restapi":i=""!==e.value.getAttribute("url")?"":mxResources.get("noUrlSelected")+"\n",i+=""!==e.value.getAttribute("method")?"":mxResources.get("noMethodSelected")+"\n";case"mrcpsynth":i=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n";break;case"mrcprecog":i=""!==e.value.getAttribute("grammar")?"":mxResources.get("noGrammarSelected")+"\n";break;case"dialogflow":i=""!==e.value.getAttribute("key")?"":mxResources.get("noKeySelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n",i+=""!==e.value.getAttribute("dialogflow_language")?"":mxResources.get("noDialogflowLanguageSelected")+"\n";break;case"dialogflowV2":i=""!==e.value.getAttribute("dialogflowV2_project_id")?"":mxResources.get("noDialogflowProjectSelected")+"\n",i+=""!==e.value.getAttribute("client_email")?"":mxResources.get("noClientEmailSelected")+"\n",i+=""!==e.value.getAttribute("private_key")?"":mxResources.get("noPrivateKeySelected")+"\n",i+=""!==e.value.getAttribute("dialogflowV2_language")?"":mxResources.get("noDialogflowLanguageSelected")+"\n",i+=""!==e.value.getAttribute("text")?"":mxResources.get("noTextSelected")+"\n"}if(t.model.isEdge(e))switch(t.model.getCell(e.source.getId()).value.nodeName){case"background":case"menu":if(void 0!==e.getValue()){var l=/^[0-9]+$|^[-]{1}$|^[i]{1}$|^[t]{1}$|^[*]{1}$|^[#]{1}$/;String(e.getValue()).split(",").forEach(function(e){i+=l.test(e)?"":mxResources.get("numberOrAll")+"\n"})}else i=i+mxResources.get("numberOrAll")+"\n";break;case"getsecretdigits":case"getdigits":if(void 0!==e.getValue())i+=(l=/^(x|i|-)$/).test(String(e.getValue()))?"":mxResources.get("numberOrInvalidOrDefault")+"\n";else i=i+mxResources.get("numberOrInvalidOrDefault")+"\n";break;case"gotoif":case"gotoiftime":if(void 0!==e.getValue())i+=(l=/^(true){1}$|^(false){1}$/).test(String(e.getValue()))?"":mxResources.get("trueOrFalse")+"\n";else i=i+mxResources.get("trueOrFalse")+"\n";break;case"login":case"pause":case"unpause":case"logout":if(void 0!==e.getValue())i+=(l=/^(success){1}$|^(failure){1}$/).test(String(e.getValue()))?"":mxResources.get("successOrFailure")+"\n";else i=i+mxResources.get("successOrFailure")+"\n"}return t.isCellCollapsed(e)&&!a&&(i+=(mxResources.get(t.containsValidationErrorsResource)||t.containsValidationErrorsResource)+"\n"),i=t.model.isEdge(e)?i+(t.getEdgeValidationError(e,t.model.getTerminal(e,!0),t.model.getTerminal(e,!1))||""):i+(t.getCellValidationError(e)||""),null!=(s=t.validateCell(e,n))&&(i+=s),null==t.model.getParent(e)&&t.view.validate(),0<i.length||!a?i:null},EditorUi.prototype.validateBlock=function(n){var t=this.editor.graph,e=t.getDefaultParent(),a=0;return e.children.forEach(function(e){t.model.isVertex(e)&&e.value.nodeName==n&&a++}),!(1<a)},EditorUi.prototype.getUrl=function(e){var n=null!=e?e:window.location.pathname,t=0<n.indexOf("?")?1:0;for(var a in urlParams)n+=0==t?"?":"&",n+=a+"="+urlParams[a],t++;return n},EditorUi.prototype.addUndoListener=function(){var e=this.actions.get("undo"),n=this.actions.get("redo"),t=this.editor.undoManager,a=function(){e.setEnabled(t.canUndo()),n.setEnabled(t.canRedo())};t.addListener(mxEvent.ADD,a),t.addListener(mxEvent.UNDO,a),t.addListener(mxEvent.REDO,a),t.addListener(mxEvent.CLEAR,a),a()},EditorUi.prototype.addSelectionListener=function(){var e=mxUtils.bind(this,function(){var e=this.editor.graph,n=!e.isSelectionEmpty(),t=!1,a=!1,i=e.getSelectionCells();if(null!=i)for(var s=0;s<i.length;s++){var o=i[s];if(e.getModel().isEdge(o)&&(a=!0),e.getModel().isVertex(o)&&(t=!0),a&&t)break}var r=["cut","copy","delete","duplicate","bold","italic","style","underline","toFront","toBack","dashed","rounded","shadow","tilt","autosize"];for(s=0;s<r.length;s++)this.actions.get(r[s]).setEnabled(n);this.actions.get("curved").setEnabled(a),this.actions.get("rotation").setEnabled(t),this.actions.get("wordWrap").setEnabled(t),this.actions.get("group").setEnabled(1<e.getSelectionCount()),this.actions.get("ungroup").setEnabled(1==e.getSelectionCount()&&0<e.getModel().getChildCount(e.getSelectionCell()));var l=t&&1==e.getSelectionCount();this.actions.get("removeFromGroup").setEnabled(l&&e.getModel().isVertex(e.getModel().getParent(e.getSelectionCell())));var d=["fontFamily","fontSize","alignment","position","text","format","arrange","linewidth","spacing"];for(s=0;s<d.length;s++)this.menus.get(d[s]).setEnabled(n);d=["line","lineend","linestart"];for(s=0;s<d.length;s++)this.menus.get(d[s]).setEnabled(a);this.actions.get("setAsDefaultEdge").setEnabled(a),this.menus.get("align").setEnabled(1<e.getSelectionCount()),this.menus.get("direction").setEnabled(t||a&&e.isLoop(e.view.getState(e.getSelectionCell()))),this.menus.get("navigation").setEnabled(e.foldingEnabled&&(null!=e.view.currentRoot||1==e.getSelectionCount()&&e.isValidRoot(e.getSelectionCell()))),this.actions.get("home").setEnabled(null!=e.view.currentRoot),this.actions.get("exitGroup").setEnabled(null!=e.view.currentRoot);var c=1==e.getSelectionCount()&&e.isValidRoot(e.getSelectionCell());this.actions.get("enterGroup").setEnabled(c),this.actions.get("expand").setEnabled(c),this.actions.get("collapse").setEnabled(c),this.actions.get("editLink").setEnabled(1==e.getSelectionCount()),this.actions.get("openLink").setEnabled(1==e.getSelectionCount()&&null!=e.getLinkForCell(e.getSelectionCell()))});this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},EditorUi.prototype.refresh=function(){var e=mxClient.IS_IE&&(null==document.documentMode||5==document.documentMode),n=this.container.clientWidth+390,t=this.container.clientHeight+190;this.container==document.body&&(n=document.body.clientWidth||document.documentElement.clientWidth,t=e&&document.body.clientHeight||document.documentElement.clientHeight);var a=Math.max(0,Math.min(this.hsplitPosition,n-this.splitSize-20)),i=Math.max(0,Math.min(this.vsplitPosition,t-this.menubarHeight-this.toolbarHeight-this.splitSize-1));this.menubarContainer.style.height=this.menubarHeight+"px",this.toolbarContainer.style.top=this.menubarHeight+"px",this.toolbarContainer.style.height=this.toolbarHeight+"px";var s=this.menubarHeight+this.toolbarHeight;if(mxClient.IS_QUIRKS||(s+=1),this.sidebarContainer.style.top=s+"px",this.sidebarContainer.style.width=a+"px",this.outlineContainer.style.width=a+"px",this.outlineContainer.style.height=i+"px",this.diagramContainer.style.left=this.isEditingEnabled()?a+this.splitSize+"px":"0px",this.diagramContainer.style.top=this.sidebarContainer.style.top,this.hsplit.style.top=this.sidebarContainer.style.top,this.hsplit.style.bottom=this.outlineContainer.style.bottom,this.hsplit.style.left=a+"px",this.vsplit.style.width=this.sidebarContainer.style.width,this.vsplit.style.bottom=i+this.footerHeight+"px",e){this.menubarContainer.style.width=n+"px",this.toolbarContainer.style.width=this.menubarContainer.style.width;var o=t-i-this.splitSize-this.menubarHeight-this.toolbarHeight;this.sidebarContainer.style.height=o+"px",this.diagramContainer.style.width=n-a-this.splitSize+"px";var r=t-this.menubarHeight-this.toolbarHeight;this.diagramContainer.style.height=r+"px",this.hsplit.style.height=r+"px"}else this.sidebarContainer.style.bottom=i+this.splitSize+"px",this.diagramContainer.style.bottom=this.outlineContainer.style.bottom},EditorUi.prototype.createDivs=function(){this.menubarContainer=this.createDiv("geMenubarContainer"),this.toolbarContainer=this.createDiv("geToolbarContainer"),this.sidebarContainer=this.createDiv("geSidebarContainer"),this.outlineContainer=this.createDiv("geOutlineContainer"),this.diagramContainer=this.createDiv("geDiagramContainer"),this.footerContainer=this.createDiv("geFooterContainer"),this.hsplit=this.createDiv("geHsplit"),this.vsplit=this.createDiv("geVsplit"),this.menubarContainer.style.top="0px",this.menubarContainer.style.left="0px",this.menubarContainer.style.right="0px",this.toolbarContainer.style.left="0px",this.toolbarContainer.style.right="0px",this.sidebarContainer.style.left="0px",this.outlineContainer.style.bottom="0px",this.outlineContainer.style.left="0px",this.diagramContainer.style.overflow="scroll",this.diagramContainer.style.right="0px",this.footerContainer.style.left="0px",this.footerContainer.style.right="0px",this.footerContainer.style.bottom="0px",this.vsplit.style.left="0px",this.vsplit.style.height=this.splitSize+"px",this.hsplit.style.width=this.splitSize+"px"},EditorUi.prototype.createUi=function(){this.menubar=this.menus.createMenubar(this.createDiv("geMenubar")),this.menubarContainer.appendChild(this.menubar.container),this.toolbar=this.createToolbar(this.createDiv("geToolbar")),this.toolbarContainer.appendChild(this.toolbar.container),this.sidebar=this.createSidebar(this.sidebarContainer),this.footerContainer.appendChild(this.createFooter()),this.statusContainer=this.createStatusContainer(),this.editor.addListener("statusChanged",mxUtils.bind(this,function(){this.setStatusText(this.editor.getStatus())})),this.setStatusText(this.editor.getStatus()),this.menubar.container.appendChild(this.statusContainer),this.isEditingEnabled()&&(this.container.appendChild(this.sidebarContainer),this.container.appendChild(this.hsplit),this.container.appendChild(this.vsplit)),this.container.appendChild(this.diagramContainer),this.container.appendChild(this.menubarContainer),this.container.appendChild(this.toolbarContainer),this.container.appendChild(this.outlineContainer),this.container.appendChild(this.footerContainer),this.addSplitHandler(this.hsplit,!0,0,mxUtils.bind(this,function(e){this.hsplitPosition=e,this.refresh(),this.editor.graph.sizeDidChange(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()})),this.addSplitHandler(this.vsplit,!1,this.footerHeight,mxUtils.bind(this,function(e){this.vsplitPosition=e,this.refresh(),this.editor.outline.update(!1),this.editor.outline.outline.sizeDidChange()}))},EditorUi.prototype.createStatusContainer=function(){var e=document.createElement("a");return e.className="geItem geStatus",e},EditorUi.prototype.createStatusContainer=function(){var e=document.createElement("a");return e.className="geItem geStatus",e},EditorUi.prototype.setStatusText=function(e){this.statusContainer.innerHTML=e},EditorUi.prototype.createToolbar=function(e){return new Toolbar(this,e)},EditorUi.prototype.createSidebar=function(e){return new Sidebar(this,e)},EditorUi.prototype.createFooter=function(){return this.createDiv("geFooter")},EditorUi.prototype.createDiv=function(e){var n=document.createElement("div");return n.className=e,n},EditorUi.prototype.createHeader=function(e){return document.createElement(e)},EditorUi.prototype.createForm=function(e){var n=document.createElement("form");return n.className=e,n},EditorUi.prototype.addSplitHandler=function(n,t,a,i){var s=null,o=null;function r(e){if(null!=s){var n=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e));i(Math.max(0,o+(t?n.x-s.x:s.y-n.y)-a)),mxEvent.consume(e)}}function e(e){r(e),o=s=null}mxEvent.addGestureListeners(n,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e)),o=parseInt(t?n.style.left:n.style.bottom),mxEvent.consume(e)}),mxEvent.addListener(document,"mousemove",r),mxEvent.addListener(document,"touchmove",r),mxEvent.addListener(document,"mouseup",e),mxEvent.addListener(document,"touchend",e)},EditorUi.prototype.executeLayout=function(e,n,t){var a=this.editor.graph,i=a.getSelectionCell();n=null!=this.animate?this.animate:n,a.getModel().beginUpdate();try{e.execute(a.getDefaultParent(),i)}catch(e){throw e}finally{if(n&&navigator.userAgent.indexOf("Camino")<0){var s=new mxMorphing(a);s.addListener(mxEvent.DONE,mxUtils.bind(this,function(){a.getModel().endUpdate()})),s.startAnimation()}else a.getModel().endUpdate()}},EditorUi.prototype.createKeyHandler=function(e){var a=this.editor.graph,o=new mxKeyHandler(a);function n(e){if(!a.isSelectionEmpty()){var n=0,t=0;37==e?n=-1:38==e?t=-1:39==e?n=1:40==e&&(t=1),a.moveCells(a.getSelectionCells(),n,t),a.scrollCellToVisible(a.getSelectionCell())}}o.isControlDown=function(e){return mxEvent.isControlDown(e)||mxClient.IS_MAC&&e.metaKey};var t=mxUtils.bind(this,function(e,n,t,a){var i=this.actions.get(t);if(null!=i){var s=function(){i.enabled&&i.funct()};n?a?o.bindControlShiftKey(e,s):o.bindControlKey(e,s):a?o.bindShiftKey(e,s):o.bindKey(e,s)}});return o.enter=function(){},o.bindKey(8,function(){a.foldCells(!0)}),o.bindKey(13,function(){a.foldCells(!1)}),o.bindKey(33,function(){a.exitGroup()}),o.bindKey(34,function(){a.enterGroup()}),o.bindKey(36,function(){a.home()}),o.bindKey(35,function(){a.refresh()}),o.bindKey(37,function(){n(37)}),o.bindKey(38,function(){n(38)}),o.bindKey(39,function(){n(39)}),o.bindKey(40,function(){n(40)}),o.bindKey(113,function(){a.startEditingAtCell()}),t(46,!1,"delete"),t(82,!0,"tilt"),t(83,!0,"save"),t(83,!0,"saveAs",!0),t(107,!1,"zoomIn"),t(109,!1,"zoomOut"),t(65,!0,"selectAll"),t(86,!0,"selectVertices",!0),t(69,!0,"selectEdges",!0),t(69,!0,"export"),t(66,!0,"toBack"),t(70,!0,"toFront"),t(68,!0,"duplicate"),t(90,!0,"undo"),t(89,!0,"redo"),t(88,!0,"cut"),t(67,!0,"copy"),t(81,!0,"connect"),t(86,!0,"paste"),t(71,!0,"group"),t(71,!0,"grid",!0),t(85,!0,"ungroup"),t(112,!1,"about"),t(80,!0,"publish",!0),o},EditorUi.prototype.createMultiplicities=function(e,n,t,a){for(var i=0;i<n.length;i++)e.push(new mxMultiplicity(!0,n[i],null,null,t[i][0],t[i][1],null,mxResources.get(n[i])+mxResources.get("musthave")+t[i][0]+mxResources.get("outgoingedge"),null)),e.push(new mxMultiplicity(!1,n[i],null,null,a[i][0],a[i][1],null,mxResources.get(n[i])+mxResources.get("musthave")+a[i][0]+mxResources.get("incomingedge"),null))};var useLocalStorage=(mxClient.IS_TOUCH||"local"==urlParams.storage)&&"undefined"!=typeof localStorage,fileSupport=null!=window.File&&null!=window.FileReader&&null!=window.FileList,touchStyle=mxClient.IS_TOUCH||"1"==urlParams.touch,counter=0;try{for(var op=window;null!=op.opener&&!isNaN(op.opener.counter);)op=op.opener;null!=op&&(op.counter++,counter=op.counter)}catch(e){}function Sidebar(e,n){this.editorUi=e,this.container=n,this.palettes=new Object,this.taglist=new Object,this.showTooltips=!0,this.graph=new Graph(document.createElement("div"),null,null,this.editorUi.editor.graph.getStylesheet()),this.graph.resetViewOnRootChange=!1,this.graph.foldingEnabled=!1,this.graph.setConnectable(!1),this.graph.autoScroll=!1,this.graph.setTooltips(!1),this.graph.setEnabled(!1),this.graph.container.style.visibility="hidden",this.graph.container.style.position="absolute",this.graph.container.style.overflow="hidden",this.graph.container.style.height="1px",this.graph.container.style.width="1px",mxClient.IS_IE||mxClient.IS_IE11||(this.graph.container.style.display="none"),document.body.appendChild(this.graph.container),this.pointerUpHandler=mxUtils.bind(this,function(){this.showTooltips=!0}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerup":"mouseup",this.pointerUpHandler),this.pointerDownHandler=mxUtils.bind(this,function(){this.showTooltips=!1,this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerdown":"mousedown",this.pointerDownHandler),this.pointerMoveHandler=mxUtils.bind(this,function(e){for(var n=mxEvent.getSource(e);null!=n;){if(n==this.currentElt)return;n=n.parentNode}this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointermove":"mousemove",this.pointerMoveHandler),this.pointerOutHandler=mxUtils.bind(this,function(e){null==e.toElement&&null==e.relatedTarget&&this.hideTooltip()}),mxEvent.addListener(document,mxClient.IS_POINTER?"pointerout":"mouseout",this.pointerOutHandler),mxEvent.addListener(n,"scroll",mxUtils.bind(this,function(){this.showTooltips=!0})),this.init(),mxClient.IS_SVG||((new Image).src=IMAGE_PATH+"/tooltip.png")}function Actions(e){this.editorUi=e,this.actions=new Object,this.init()}function Action(e,n,t,a,i){mxEventSource.call(this),this.label=e,this.funct=n,this.enabled=null==t||t,this.iconCls=a,this.shortcut=i}function Menubar(e,n){this.editorUi=e,this.container=n,mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function Menu(e,n){mxEventSource.call(this),this.funct=e,this.enabled=null==n||n}function Toolbar(e,n){this.editorUi=e,this.container=n,this.init(),mxEvent.addGestureListeners(document,mxUtils.bind(this,function(e){this.hideMenu()}))}function createCheckbox(e){var n=document.createElement("input");return n.setAttribute("type","checkbox"),e&&n.setAttribute("checked",!0),n}function createDropdownFromApi(e,t,a,i,n,s,o,r){var l=new XMLHttpRequest;l.open("GET",e,!1),l.setRequestHeader("Authorization","Bearer "+n.editor.data.token),l.send(null);var d=[];200===l.status&&(d=JSON.parse(l.response));var c=document.createElement("select"),m=document.createElement("option");return m.text="-- None --",m.value="-1",c.appendChild(m),d.rows.forEach(function(n){r&&n[a]==r||((m=document.createElement("option")).text=n[a],s&&o?(m.value=o,s.forEach(function(e){m.value=m.value.replace("%"+e+"%",n[e])}),m.selected=m.value==t):(m.value=n[i],m.selected=n[i]==t),c.appendChild(m))}),c.className="form-control select2",c}function createDropdownWithOptgroupFromApi(e,n,t,a,i,s){var o=new XMLHttpRequest;o.open("GET",e,!1),o.setRequestHeader("Authorization","Bearer "+i.editor.data.token),o.send(null);var r=[];200===o.status&&(r=JSON.parse(o.response));var l=document.createElement("select"),d=document.createElement("option");d.text="-- None --",d.value="-1",l.appendChild(d);var c=_.groupBy(r.rows,s);for(var m in c)if(c.hasOwnProperty(m)){var u=document.createElement("optgroup");u.label=_.capitalize(m),c[m].forEach(function(e){(d=document.createElement("option")).text=e[t],d.value=e[a],d.selected=e[a]==n,u.appendChild(d)}),l.appendChild(u)}return l.className="form-control select2",l}function createGroupedDropdownFromApi(e,n,t,a,i,s){var o=new XMLHttpRequest;o.open("GET",e,!1),o.setRequestHeader("Authorization","Bearer "+i.editor.data.token),o.send(null);var r=[];200===o.status&&(r=JSON.parse(o.response));var l=document.createElement("select"),d=document.createElement("option");return d.text="-- None --",d.value="0",l.appendChild(d),r.rows.forEach(function(e){(d=document.createElement("option")).className="select-group-father",d.text=e[t].toUpperCase(),d.value=e[a],d.selected=e[a]==n,l.appendChild(d),e[s].forEach(function(e){(d=document.createElement("option")).className="select-group-son",d.text="-"+_.capitalize(e[t]),d.value=e[a],d.selected=e[a]==n,l.appendChild(d)})}),l.className="form-control select2",l}function createDropdownFromArray(e,n){var t=document.createElement("select");for(var a in e){var i=document.createElement("option");i.text=e[a],i.value=a,(0<n||""!=n)&&(i.selected=n===a),t.appendChild(i)}return t.className="form-control select2",t}function createDropdownFromTigerDialList(e){var n=document.createElement("select"),t=[],a=new XMLHttpRequest;try{if(a.open("POST","/api/rest/list/list",!1),a.send(JSON.stringify({page:1,size:6e5})),200===a.status){var i=JSON.parse(a.response);if(0<i.status){var s=i.response.RMI.rows;for(var o in s)t[s[o].id]=s[o].name}}}catch(e){console.log(e)}for(var r in t){var l=document.createElement("option");l.text=t[r],l.value=r,(0<e||""!=e)&&(l.selected=e===r),n.appendChild(l)}return n.className="form-control select2",n}function Dialog(e,n,t,a,i,s,o){var r=0;mxClient.IS_IE&&9!=document.documentMode&&(r=60),t+=r,a+=r;Math.max(0,Math.round((document.body.scrollWidth-t)/2)),Math.max(0,Math.round((Math.max(document.body.scrollHeight,document.documentElement.scrollHeight)-a)/3));var l=e.createDiv("geDialog");l.className="modal fade in center",l.style.display="block",l.style.paddingRight="12px";var d=e.createDiv("geModalDialog");d.className="modal-dialog",d.appendChild(n),l.appendChild(d),null==this.bg&&(this.bg=e.createDiv("background"),this.bg.className="modal-backdrop fade in",mxClient.IS_QUIRKS&&new mxDivResizer(this.bg)),i&&document.body.appendChild(this.bg),document.body.appendChild(l),this.onDialogClose=o,this.container=l}function ImportDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("import")+" XML");var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("row"),l=t.createDiv("col-md-12"),d=document.createElement("textarea");d.style.width="100%",d.style.height="374px";var c=document.createElement("input");c.type="file",c.setAttribute("accept","text/xml"),c.addEventListener("change",function(e){var n=e.target.files[0];if(console.log(n),n)if("text/xml"===n.type){var t=new FileReader;t.onload=function(e){var n=e.target.result;mxUtils.write(d,n)},t.readAsText(n)}else alert("Failed to load format file");else alert("Failed to load file")},!1),l.appendChild(c),l.appendChild(d),r.appendChild(l),a.appendChild(r);var m=mxUtils.button(mxResources.get("import"),mxUtils.bind(this,function(e){var n=mxUtils.parseXml(d.value);t.editor.setGraphXml(n.documentElement),t.hideDialog()}));m.className="btn blue";var u=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});u.className="btn default",i.appendChild(m),i.appendChild(u),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function AboutDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("about")+" Cally Square");var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=document.createElement("img");r.style.border="0px",r.setAttribute("width","176"),r.setAttribute("width","151"),r.setAttribute("src",IMAGE_PATH+"/logo.png"),a.appendChild(r),mxUtils.br(a),mxUtils.write(a,"Powered by Xenialab "+mxClient.VERSION),mxUtils.br(a);var l=document.createElement("a");l.setAttribute("href","http://www.callysquare.com/"),l.setAttribute("target","_blank"),mxUtils.write(l,"www.callysquare.com"),a.appendChild(l),mxUtils.br(a),mxUtils.br(a);var d=mxUtils.button(mxResources.get("close"),function(){e.hideDialog()});d.className="btn default",i.appendChild(d),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function SaveDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("saveAs"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_copy"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("save"),function(){e.saveAs(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function NewDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("new"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.editor.getOrCreateFilename(),l=e.createDiv("row"),d=e.createDiv("col-md-4"),c=e.createDiv("col-md-8"),m=document.createElement("label");m.className="control-label pull-right",mxUtils.write(m,mxResources.get("name")),d.appendChild(m);var u=document.createElement("input");u.setAttribute("value",r+"_new"),u.setAttribute("id","_name"),u.className="form-control",c.appendChild(u),l.appendChild(d),l.appendChild(c),a.appendChild(l);var p=mxUtils.button(mxResources.get("new"),function(){e.new(u.value),e.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function DescriptionDialog(e){console.log(e.editor.data);var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("description"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("form-horizontal form-row-seperated"),l="description",d=e.editor.data.description||"",c=e.createDiv("form-group"),m=document.createElement("label");m.className="col-sm-4 control-label",mxUtils.write(m,mxResources.get(l)),c.appendChild(m);var u=document.createElement("input");u.setAttribute("value",d),u.className="form-control",u.setAttribute("id","_description");var p=e.createDiv("col-sm-8");p.appendChild(u),c.appendChild(p),r.appendChild(c),a.appendChild(r);var g=mxUtils.button(mxResources.get("update"),function(){e.description(u.value),e.hideDialog()});g.className="btn blue";var v=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});v.className="btn default",i.appendChild(g),i.appendChild(v),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function VariableDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("variable"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("form-horizontal form-row-seperated"),l="name",d="_"+l,c="variable name",m=e.createDiv("form-group"),u=document.createElement("label");u.className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var p=document.createElement("input");p.setAttribute("value",c),p.className="form-control",p.setAttribute("id",d);var g=e.createDiv("col-sm-8");g.appendChild(p),m.appendChild(g),r.appendChild(m),d="_"+(l="description"),c="variable description",m=e.createDiv("form-group last"),(u=document.createElement("label")).className="col-sm-4 control-label",mxUtils.write(u,mxResources.get(l)),m.appendChild(u);var v=document.createElement("input");v.setAttribute("value",c),v.className="form-control",v.setAttribute("id",d),(g=e.createDiv("col-sm-8")).appendChild(v),m.appendChild(g),r.appendChild(m),a.appendChild(r);var h=mxUtils.button(mxResources.get("new"),function(){e.variable(p.value,v.value),e.hideDialog()});h.className="btn blue";var f=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});f.className="btn default",i.appendChild(h),i.appendChild(f),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function OpenDialog(e){var n=e.createDiv("modal-content"),t=e.createDiv("modal-header"),a=e.createDiv("modal-body"),i=e.createDiv("modal-footer"),s=e.createHeader("h4");mxUtils.write(s,mxResources.get("open"));var o=mxUtils.button("",function(){e.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=e.createDiv("row"),l=e.createDiv("col-md-4"),d=e.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=new XMLHttpRequest;m.open("GET","/api/square/projects",!1),m.setRequestHeader("Authorization","Bearer "+e.editor.data.token),m.send(null);var u=[];200===m.status&&(u=JSON.parse(m.response));for(var p=document.createElement("select"),g=0;g<u.length;g++){var v=document.createElement("option");v.text=u[g].name,v.value=u[g].id,p.appendChild(v)}p.className="form-control",d.appendChild(p),r.appendChild(l),r.appendChild(d),a.appendChild(r);var h=mxUtils.button(mxResources.get("open"),function(){console.log(p),console.log(p.value),window.open("square/project/"+p.value,"_blank"),e.hideDialog()});h.className="btn blue";var f=mxUtils.button(mxResources.get("cancel"),function(){e.hideDialog()});f.className="btn default",i.appendChild(h),i.appendChild(f),n.appendChild(t),n.appendChild(a),n.appendChild(i),this.container=n}function RenameDialog(t){var e=t.createDiv("modal-content"),n=t.createDiv("modal-header"),a=t.createDiv("modal-body"),i=t.createDiv("modal-footer"),s=t.createHeader("h4");mxUtils.write(s,mxResources.get("rename"));var o=mxUtils.button("",function(){t.hideDialog()});o.className="close",n.appendChild(o),n.appendChild(s);var r=t.createDiv("row"),l=t.createDiv("col-md-4"),d=t.createDiv("col-md-8"),c=document.createElement("label");c.className="control-label pull-right",mxUtils.write(c,mxResources.get("name")),l.appendChild(c);var m=t.editor.filename,u=document.createElement("input");u.setAttribute("value",m),u.className="form-control",d.appendChild(u),r.appendChild(l),r.appendChild(d),a.appendChild(r);var p=mxUtils.button(mxResources.get("save"),function(){var n=new XMLHttpRequest;n.open("PUT",SAVE_URL+t.editor.data.id,!0),n.setRequestHeader("Content-Type","application/x-www-form-urlencoded"),n.setRequestHeader("Authorization","Bearer "+t.editor.data.token),n.send("name="+u.value),n.onload=function(e){200===n.status?(t.editor.setStatus("Project successfully renamed"),t.editor.filename=u.value):(console.log(n.response),t.editor.setStatus(JSON.parse(n.response).errors[0].message))},n.onerror=function(e){mxUtils.alert(n.statusText)},t.hideDialog()});p.className="btn blue";var g=mxUtils.button(mxResources.get("cancel"),function(){t.hideDialog()});g.className="btn default",i.appendChild(p),i.appendChild(g),e.appendChild(n),e.appendChild(a),e.appendChild(i),this.container=e}function EditFileDialog(n){var e=n.createDiv("modal-content"),t=n.createDiv("modal-header"),a=n.createDiv("modal-body"),i=n.createDiv("modal-footer"),s=n.createHeader("h4");mxUtils.write(s,mxResources.get("edit"));var o=mxUtils.button("",function(){n.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=n.createDiv("row"),l=n.createDiv("col-md-12"),d=document.createElement("textarea");if(d.style.width="100%",d.style.height="374px",d.value=mxUtils.getPrettyXml(n.editor.getGraphXml()),fileSupport){d.addEventListener("dragover",function(e){e.stopPropagation(),e.preventDefault()},!1),d.addEventListener("drop",function(e){if(e.stopPropagation(),e.preventDefault(),0<e.dataTransfer.files.length){var n=e.dataTransfer.files[0],t=new FileReader;t.onload=function(e){d.value=e.target.result},t.readAsText(n)}},!1)}l.appendChild(d),r.appendChild(l),a.appendChild(r);var c=mxUtils.button(mxResources.get("save"),function(){var e=mxUtils.parseXml(d.value);n.editor.setGraphXml(e.documentElement),n.hideDialog()});c.className="btn blue";var m=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});m.className="btn default",i.appendChild(c),i.appendChild(m),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function ExportDialog(n){var e=n.createDiv("modal-content"),t=n.createDiv("modal-header"),a=n.createDiv("modal-body form"),i=n.createDiv("modal-footer"),s=n.createHeader("h4");mxUtils.write(s,mxResources.get("export")+" XML");var o=mxUtils.button("",function(){n.hideDialog()});o.className="close",t.appendChild(o),t.appendChild(s);var r=n.createDiv("form-horizontal form-row-seperated"),l=n.createDiv("form-group last"),d=document.createElement("label");d.className="col-sm-4 control-label",mxUtils.write(d,mxResources.get("filename"));var c=document.createElement("input");c.setAttribute("value",n.editor.getOrCreateFilename()),c.className="form-control";var m=n.createDiv("col-sm-8");m.appendChild(c),l.appendChild(d),l.appendChild(m),r.appendChild(l),a.appendChild(r);var u=mxUtils.button(mxResources.get("export"),mxUtils.bind(this,function(e){n.save(!1);encodeURIComponent(mxUtils.getXml(n.editor.getGraphXml()));new mxXmlRequest(SAVE_URL+n.editor.data.id+"/download","filename="+c.value,"GET").simulate(document,"_blank"),n.hideDialog()}));u.className="btn blue";var p=mxUtils.button(mxResources.get("cancel"),function(){n.hideDialog()});p.className="btn default",i.appendChild(u),i.appendChild(p),e.appendChild(t),e.appendChild(a),e.appendChild(i),this.container=e}function GeneralDialog(i,s){console.log("general");var o=i.editor.graph,e=i.createDiv("md-dialog"),n=i.createDiv("md-toolbar"),t=i.createDiv("md-dialog-content"),a=i.createDiv("md-dialog-actions"),r=i.createHeader("h4");mxUtils.write(r,mxResources.get("edit")+" "+mxResources.get(s.value.nodeName));var l=mxUtils.button("",function(){i.hideDialog()});l.className="close",n.appendChild(l),n.appendChild(r);for(var d=s.value.attributes.length,c=i.createDiv("form-horizontal form-row-seperated"),m=0;m<d;m++){var u,p=s.value.attributes[m].name,g="_"+p,v=s.value.attributes[m].value,h=i.createDiv(m==d-1?"form-group last":"form-group"),f=document.createElement("label");switch(f.className="col-sm-4 control-label",mxUtils.write(f,mxResources.get(p)),h.appendChild(f),p){case"sip_id":u=createDropdownWithOptgroupFromApi("/api/users/all",v,"fullname","id",i,"role");break;case"queue_id":u=createDropdownFromApi("/api/voice/queues",v,"name","name",i);break;case"trunk_name":u=createDropdownFromApi("/api/trunks",v,"name","name",i);break;case"variable_id":u=createDropdownFromApi("/api/variables",v,"name","id",i);break;case"account_id":u="sendMail"==s.value.nodeName?createDropdownFromApi("/api/mail/servers/out",v,"username","id",i):createDropdownFromApi("/api/sms/accounts",v,"name","id",i);break;case"template_id":u=createDropdownFromApi("/api/templates",v,"name","id",i);break;case"context":u=createDropdownFromApi("/api/voice/contexts",v,"name","name",i);break;case"mailbox":u=createDropdownFromApi("/api/voice/voicemails",v,"mailbox","id",i,["mailbox","context"],"%mailbox%@%context%");break;case"model":u=createDropdownFromArray(ISPEECHASRMODEL,v);break;case"ispeech_asr_language":u=createDropdownFromArray(ISPEECHASRLANG,v);break;case"beep":u=createDropdownFromArray(ISPEECHBEEP,v);break;case"hiddendigitspos":u=createDropdownFromArray(SECRETDIGITSPOS,v);break;case"ispeech_tts_language":u=createDropdownFromArray(ISPEECHLANG,v);break;case"google_tts_language":u=createDropdownFromArray(GOOGLETTSLANG,v);break;case"intKey":u=createDropdownFromArray(ASRINTKEYS,v);break;case"recordingFormat":u=createDropdownFromArray(RECORDINGFORMAT,v);break;case"answer":u=createDropdownFromArray(BOOLSELECT,v);break;case"list_id":u=createDropdownFromTigerDialList(v);break;case"interval_id":u=createGroupedDropdownFromApi("/api/intervals",v,"name","id",i,"SubIntervals");break;case"project_id":u=createDropdownFromApi("/api/square/projects",v,"name","id",i,null,null,i.editor.getOrCreateFilename());break;case"odbc_id":u=createDropdownFromApi("/api/square/odbc",v,"name","id",i);break;case"file_id":u=createDropdownFromApi("/api/sounds",v,"display_name","id",i);break;case"timeout":case"digit":case"mindigit":case"maxdigit":case"response":case"retry":case"speed":(u=document.createElement("input")).setAttribute("type","number"),u.setAttribute("min",0),u.setAttribute("max",1e3),u.setAttribute("value",v),u.className="form-control";break;case"text":case"key":case"query":case"condition":case"command":case"body":(u=document.createElement("textarea")).innerHTML=v,u.className="form-control";break;case"sms_text":(u=document.createElement("textarea")).innerHTML=v,u.className="form-control",u.setAttribute("maxlength","160");break;default:(u=document.createElement("input")).setAttribute("value",v),u.className="form-control"}u.setAttribute("id",g);var b=i.createDiv("col-sm-8");if(b.appendChild(u),mxResources.get("help_"+p)){var A=i.createDiv("p");A.className="help-block",mxUtils.write(A,mxResources.get("help_"+p)),b.appendChild(A)}h.appendChild(b),c.appendChild(h)}t.appendChild(c);var E=mxUtils.button(mxResources.get("save"),mxUtils.bind(this,function(e){for(var n=0;n<s.value.attributes.length;n++){var t="_"+s.value.attributes[n].name,a=s.value.attributes[n].name;s.setAttribute(a,document.getElementById(t).value)}o.refresh(s),i.hideDialog()}));E.className="btn blue";var y=mxUtils.button(mxResources.get("cancel"),function(){i.hideDialog()});y.className="btn default",a.appendChild(E),a.appendChild(y),e.appendChild(n),e.appendChild(t),e.appendChild(a),this.container=e}Editor=function(){mxEventSource.call(this),this.init(),this.initStencilRegistry(),this.graph=new Graph,this.outline=new mxOutline(this.graph),this.outline.updateOnPan=!0,this.undoManager=this.createUndoManager(),this.status="",this.filename=null,this.getOrCreateFilename=function(){return this.filename||mxResources.get("drawing",[counter])+".xml"},this.getFilename=function(){return this.filename},this.setStatus=function(e){this.status=e,this.fireEvent(new mxEventObject("statusChanged"))},this.getStatus=function(){return this.status},this.modified=!1,this.graphChangeListener=function(){this.modified=!0},this.graph.getModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(){this.graphChangeListener.apply(this,arguments)})),window.onbeforeunload=mxUtils.bind(this,function(){if(this.modified)return mxResources.get("allChangesLost")}),this.graph.resetViewOnRootChange=!1,this.graph.scrollbars=!0,this.graph.background=null},mxUtils.extend(Editor,mxEventSource),Editor.prototype.gridImage=IMAGE_PATH+"/grid.gif",Editor.prototype.transparentImage=IMAGE_PATH+"/transparent.gif",Editor.prototype.setGraphXml=function(e){var n=new mxCodec(e.ownerDocument);if("mxGraphModel"==e.nodeName){this.graph.view.scale=Number(e.getAttribute("scale")||1),this.graph.gridEnabled="0"!=e.getAttribute("grid"),this.graph.graphHandler.guidesEnabled="0"!=e.getAttribute("guides"),this.graph.setTooltips("0"!=e.getAttribute("tooltips")),this.graph.setConnectable("0"!=e.getAttribute("connect")),this.graph.foldingEnabled="0"!=e.getAttribute("fold"),this.graph.scrollbars="0"!=e.getAttribute("scrollbars"),this.graph.scrollbars||(this.graph.container.scrollLeft=0,this.graph.container.scrollTop=0,this.graph.view.translate.x=Number(e.getAttribute("dx")||0),this.graph.view.translate.y=Number(e.getAttribute("dy")||0)),this.graph.pageVisible="1"==e.getAttribute("page"),this.graph.pageBreaksVisible=this.graph.pageVisible,this.graph.preferPageSize=this.graph.pageBreaksVisible;var t=e.getAttribute("pageScale");this.graph.pageScale=null!=t?t:1.5;var a=e.getAttribute("pageWidth"),i=e.getAttribute("pageHeight");null!=a&&null!=i&&(this.graph.pageFormat=new mxRectangle(0,0,parseFloat(a),parseFloat(i)),this.outline.outline.pageFormat=this.graph.pageFormat);var s=e.getAttribute("background");null!=s&&0<s.length&&(this.graph.background=s),n.decode(e,this.graph.getModel()),this.updateGraphComponents()}},Editor.prototype.getGraphXml=function(){var e=new mxCodec(mxUtils.createXmlDocument()).encode(this.graph.getModel());return 0==this.graph.view.translate.x&&0==this.graph.view.translate.y||(e.setAttribute("dx",Math.round(100*this.graph.view.translate.x)/100),e.setAttribute("dy",Math.round(100*this.graph.view.translate.y)/100)),1!=this.graph.view.scale&&e.setAttribute("scale",Math.round(1e3*this.graph.view.scale)/1e3),e.setAttribute("grid",this.graph.isGridEnabled()?"1":"0"),e.setAttribute("guides",this.graph.graphHandler.guidesEnabled?"1":"0"),e.setAttribute("guides",this.graph.graphHandler.guidesEnabled?"1":"0"),e.setAttribute("tooltips",this.graph.tooltipHandler.isEnabled()?"1":"0"),e.setAttribute("connect",this.graph.connectionHandler.isEnabled()?"1":"0"),e.setAttribute("fold",this.graph.foldingEnabled?"1":"0"),e.setAttribute("page",this.graph.pageVisible?"1":"0"),e.setAttribute("pageScale",this.graph.pageScale),e.setAttribute("pageWidth",this.graph.pageFormat.width),e.setAttribute("pageHeight",this.graph.pageFormat.height),this.graph.scrollbars||e.setAttribute("scrollbars","0"),null!=this.graph.background&&e.setAttribute("background",this.graph.background),e},Editor.prototype.updateGraphComponents=function(){var e=this.graph,n=this.outline;if(null!=e.container&&null!=n.outline.container){null!=e.background?"none"==e.background?e.container.style.backgroundColor="transparent":(null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.fill=e.background,e.view.backgroundPageShape.reconfigure()),e.container.style.backgroundColor=e.background):e.container.style.backgroundColor="",e.pageVisible?(e.container.style.backgroundColor="#ebebeb",e.container.style.borderStyle="solid",e.container.style.borderColor="#e5e5e5",e.container.style.borderTopWidth="1px",e.container.style.borderLeftWidth="1px",e.container.style.borderRightWidth="0px",e.container.style.borderBottomWidth="0px"):e.container.style.border="",n.outline.container.style.backgroundColor=e.container.style.backgroundColor,n.outline.pageVisible==e.pageVisible&&n.outline.pageScale==e.pageScale||(n.outline.pageScale=e.pageScale,n.outline.pageVisible=e.pageVisible,n.outline.view.validate()),e.scrollbars&&"hidden"==e.container.style.overflow&&!touchStyle?e.container.style.overflow="auto":e.scrollbars&&!touchStyle||(e.container.style.overflow="hidden");var t=mxClient.IS_IE&&9<=document.documentMode?"url("+this.transparentImage+")":"none";e.container.style.backgroundImage=!e.pageVisible&&e.isGridEnabled()?"url("+this.gridImage+")":t,null!=e.view.backgroundPageShape&&(e.view.backgroundPageShape.node.style.backgroundImage=this.graph.isGridEnabled()?"url("+this.gridImage+")":"none")}},Editor.prototype.init=function(){mxClient.IS_IE6&&mxClient.link("stylesheet",CSS_PATH+"/grapheditor-ie6.css"),mxResources.loadDefaultBundle=!1,mxResources.add(RESOURCE_BASE),mxConstants.DEFAULT_HOTSPOT=.3;var e=mxConnectionHandler.prototype.createMarker;mxConnectionHandler.prototype.createMarker=function(){var t=e.apply(this,arguments);return t.intersects=mxUtils.bind(this,function(e,n){return!!this.isConnecting()||mxCellMarker.prototype.intersects.apply(t,arguments)}),t},mxConstants.SHADOWCOLOR="#d0d0d0",mxConstants.HANDLE_FILLCOLOR="#99ccff",mxConstants.HANDLE_STROKECOLOR="#0088cf",mxConstants.VERTEX_SELECTION_COLOR="#00a8ff",mxConstants.OUTLINE_COLOR="#00a8ff",mxConstants.OUTLINE_HANDLE_FILLCOLOR="#99ccff",mxConstants.OUTLINE_HANDLE_STROKECOLOR="#00a8ff",mxConstants.CONNECT_HANDLE_FILLCOLOR="#cee7ff",mxConstants.EDGE_SELECTION_COLOR="#00a8ff",mxConstants.DEFAULT_VALID_COLOR="#00a8ff",mxConstants.LABEL_HANDLE_FILLCOLOR="#cee7ff",mxConstants.GUIDE_COLOR="#0088cf",mxGraph.prototype.pageBreakColor="#c0c0c0",mxGraph.prototype.pageScale=1,mxRubberband.prototype.defaultOpacity=30,mxGraphView.prototype.createBackgroundPageShape=function(e){return new mxRectangleShape(e,this.graph.background||"white","#cacaca")},mxGraphView.prototype.getBackgroundPageBounds=function(){var e=this.getGraphBounds(),n=0<e.width?e.x/this.scale-this.translate.x:0,t=0<e.height?e.y/this.scale-this.translate.y:0,a=e.width/this.scale,i=e.height/this.scale,s=this.graph.pageFormat,o=this.graph.pageScale,r=s.width*o,l=s.height*o,d=Math.floor(Math.min(0,n)/r),c=Math.floor(Math.min(0,t)/l),m=Math.ceil(Math.max(1,n+a)/r)-d,u=Math.ceil(Math.max(1,t+i)/l)-c;return new mxRectangle(this.scale*(this.translate.x+d*r),this.scale*(this.translate.y+c*l),this.scale*m*r,this.scale*u*l)};var t=mxGraph.prototype.panGraph;mxGraph.prototype.panGraph=function(e,n){t.apply(this,arguments),this.dialect==mxConstants.DIALECT_SVG||null==this.view.backgroundPageShape||this.useScrollbarsForPanning&&mxUtils.hasScrollbars(this.container)||(this.view.backgroundPageShape.node.style.marginLeft=e+"px",this.view.backgroundPageShape.node.style.marginTop=n+"px")};var a=this;mxGraphView.prototype.validateBackground=function(){var e=this.graph.getBackgroundImage();if(null!=e){if(null==this.backgroundImage||this.backgroundImage.image!=e.src){null!=this.backgroundImage&&this.backgroundImage.destroy();var n=new mxRectangle(0,0,1,1);this.backgroundImage=new mxImageShape(n,e.src),this.backgroundImage.dialect=this.graph.dialect,this.backgroundImage.init(this.backgroundPane),this.backgroundImage.redraw()}this.redrawBackgroundImage(this.backgroundImage,e)}else null!=this.backgroundImage&&(this.backgroundImage.destroy(),this.backgroundImage=null);if(this.graph.pageVisible){n=this.getBackgroundPageBounds();null==this.backgroundPageShape?(this.backgroundPageShape=this.createBackgroundPageShape(n),this.backgroundPageShape.scale=1,this.backgroundPageShape.isShadow=!0,this.backgroundPageShape.dialect=mxConstants.DIALECT_STRICTHTML,this.backgroundPageShape.init(this.graph.container),this.graph.container.firstChild.style.position="absolute",this.graph.container.insertBefore(this.backgroundPageShape.node,this.graph.container.firstChild),this.backgroundPageShape.redraw(),this.backgroundPageShape.node.className="geBackgroundPage",this.backgroundPageShape.node.style.backgroundPosition="-1px -1px",mxEvent.addListener(this.backgroundPageShape.node,"dblclick",mxUtils.bind(this,function(e){this.graph.dblClick(e)})),mxEvent.addGestureListeners(this.backgroundPageShape.node,mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_DOWN,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){null!=this.graph.tooltipHandler&&this.graph.tooltipHandler.isHideOnHover()&&this.graph.tooltipHandler.hide(),this.graph.isMouseDown&&!mxEvent.isConsumed(e)&&this.graph.fireMouseEvent(mxEvent.MOUSE_MOVE,new mxMouseEvent(e))}),mxUtils.bind(this,function(e){this.graph.fireMouseEvent(mxEvent.MOUSE_UP,new mxMouseEvent(e))}))):(this.backgroundPageShape.scale=1,this.backgroundPageShape.bounds=n,this.backgroundPageShape.redraw()),this.backgroundPageShape.node.style.backgroundImage=this.graph.isGridEnabled()?"url("+a.gridImage+")":"none"}else null!=this.backgroundPageShape&&(this.backgroundPageShape.destroy(),this.backgroundPageShape=null)},mxGraph.prototype.updatePageBreaks=function(e,n,t){var a=this.view.scale,i=this.view.translate,s=this.pageFormat,o=a*this.pageScale,r=this.view.getBackgroundPageBounds();n=r.width,t=r.height;var l=new mxRectangle(a*i.x,a*i.y,s.width*o,s.height*o),d=(e=e&&Math.min(l.width,l.height)>this.minPageBreakDist)?Math.ceil(n/l.width)-1:0,c=e?Math.ceil(t/l.height)-1:0,m=r.x+n,u=r.y+t;if(null==this.horizontalPageBreaks&&0<d&&(this.horizontalPageBreaks=[]),null!=this.horizontalPageBreaks){for(var p=0;p<=d;p++){var g=[new mxPoint(r.x+(p+1)*l.width,r.y),new mxPoint(r.x+(p+1)*l.width,u)];if(null!=this.horizontalPageBreaks[p])this.horizontalPageBreaks[p].scale=1,this.horizontalPageBreaks[p].points=g,this.horizontalPageBreaks[p].redraw();else(v=new mxPolyline(g,this.pageBreakColor,this.scale)).dialect=this.dialect,v.isDashed=this.pageBreakDashed,v.addPipe=!1,v.scale=a,v.init(this.view.backgroundPane),v.redraw(),this.horizontalPageBreaks[p]=v}for(p=d;p<this.horizontalPageBreaks.length;p++)this.horizontalPageBreaks[p].destroy();this.horizontalPageBreaks.splice(d,this.horizontalPageBreaks.length-d)}if(null==this.verticalPageBreaks&&0<c&&(this.verticalPageBreaks=[]),null!=this.verticalPageBreaks){for(p=0;p<=c;p++){var v;g=[new mxPoint(r.x,r.y+(p+1)*l.height),new mxPoint(m,r.y+(p+1)*l.height)];if(null!=this.verticalPageBreaks[p])this.verticalPageBreaks[p].scale=1,this.verticalPageBreaks[p].points=g,this.verticalPageBreaks[p].redraw();else(v=new mxPolyline(g,this.pageBreakColor,a)).dialect=this.dialect,v.isDashed=this.pageBreakDashed,v.addPipe=!1,v.scale=a,v.init(this.view.backgroundPane),v.redraw(),this.verticalPageBreaks[p]=v}for(p=c;p<this.verticalPageBreaks.length;p++)this.verticalPageBreaks[p].destroy();this.verticalPageBreaks.splice(c,this.verticalPageBreaks.length-c)}},mxEdgeHandler.prototype.snapToTerminals=!0,mxGraphHandler.prototype.guidesEnabled=!0;var s=mxGraphHandler.prototype.shouldRemoveCellsFromParent;mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(e,n,t){for(var a=0;a<n.length;a++)if(this.graph.getModel().isVertex(n[a])){var i=this.graph.getCellGeometry(n[a]);if(null!=i&&i.relative)return!1}return s.apply(this,arguments)},mxGuide.prototype.isEnabledForEvent=function(e){return!mxEvent.isAltDown(e)};var r=mxPopupMenu.prototype.addItem;mxPopupMenu.prototype.addItem=function(e,n,t,a,i,s){var o=r.apply(this,arguments);return null==s||s||mxEvent.addListener(o,"mousedown",function(e){mxEvent.consume(e)}),o};var o=mxGraphHandler.prototype.getInitialCellForEvent;mxGraphHandler.prototype.getInitialCellForEvent=function(e){var n=this.graph.getModel(),t=n.getParent(this.graph.getSelectionCell()),a=o.apply(this,arguments),i=n.getParent(a);if(null==t||t!=a&&t!=i)for(;!this.graph.isCellSelected(a)&&!this.graph.isCellSelected(i)&&n.isVertex(i)&&!this.graph.isValidRoot(i);)a=i,i=this.graph.getModel().getParent(a);return a};var l=mxGraphHandler.prototype.isDelayedSelection;mxGraphHandler.prototype.isDelayedSelection=function(e){var n=l.apply(this,arguments),t=this.graph.getModel(),a=t.getParent(this.graph.getSelectionCell()),i=t.getParent(e);return(null==a||a!=e&&a!=i)&&(this.graph.isCellSelected(e)||!t.isVertex(i)||this.graph.isValidRoot(i)||(n=!0)),n},mxGraphHandler.prototype.selectDelayed=function(e){var n=e.getCell();null==n&&(n=this.cell);for(var t=this.graph.getModel(),a=t.getParent(n);this.graph.isCellSelected(n)&&t.isVertex(a)&&!this.graph.isValidRoot(a);)n=a,a=t.getParent(n);this.graph.selectCellForEvent(n,e.getEvent())},mxPanningHandler.prototype.getCellForPopupEvent=function(e){for(var n=e.getCell(),t=this.graph.getModel(),a=t.getParent(n);t.isVertex(a)&&!this.graph.isValidRoot(a);)this.graph.isCellSelected(a)&&(n=a),a=t.getParent(a);return n}},Editor.prototype.createUndoManager=function(){var s=this.graph,t=new mxUndoManager,e=function(e,n){t.undoableEditHappened(n.getProperty("edit"))};s.getModel().addListener(mxEvent.UNDO,e),s.getView().addListener(mxEvent.UNDO,e);var n=function(e,n){for(var t=s.getSelectionCellsForChanges(n.getProperty("edit").changes),a=[],i=1;i<t.length;i++)null!=s.view.getState(t[i])&&a.push(t[i]);s.setSelectionCells(a)};return t.addListener(mxEvent.UNDO,n),t.addListener(mxEvent.REDO,n),t},Editor.prototype.initStencilRegistry=function(){mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/general.xml")},mxStencilRegistry.libraries={},mxStencilRegistry.packages=[],mxStencilRegistry.getStencil=function(e){var n=mxStencilRegistry.stencils[e];if(null==n){var t=mxStencilRegistry.getBasenameForStencil(e);if(null!=t){var a=mxStencilRegistry.libraries[t];if(null!=a){if(null==mxStencilRegistry.packages[t]){mxStencilRegistry.packages[t]=1;for(var i=0;i<a.length;i++){var s=a[i];if(".xml"==s.toLowerCase().substring(s.length-4,s.length))mxStencilRegistry.loadStencilSet(s,null);else if(".js"==s.toLowerCase().substring(s.length-3,s.length)){var o=mxUtils.load(s);null!=o&&eval.call(window,o.getText())}}}}else mxStencilRegistry.loadStencilSet(STENCIL_PATH+"/"+t+".xml",null);n=mxStencilRegistry.stencils[e]}}return n},mxStencilRegistry.getBasenameForStencil=function(e){var n=e.split("."),t=null;if(0<n.length&&"mxgraph"==n[0]){t=n[1];for(var a=2;a<n.length-1;a++)t+="/"+n[a]}return t},mxStencilRegistry.loadStencilSet=function(e,n,t){t=null!=t&&t;var a=mxStencilRegistry.packages[e];if(t||null==a){var i=!1;null==a&&(a=mxUtils.load(e).getXml(),mxStencilRegistry.packages[e]=a,i=!0),mxStencilRegistry.parseStencilSet(a,n,i)}},mxStencilRegistry.parseStencilSet=function(e,n,t){t=null==t||t;var a=e.documentElement,i=a.firstChild,s="",o=a.getAttribute("name");for(null!=o&&(s=o+".");null!=i;){if(i.nodeType==mxConstants.NODETYPE_ELEMENT&&null!=(o=i.getAttribute("name"))){s=s.toLowerCase();var r=o.replace(/ /g,"_");if(t&&mxStencilRegistry.addStencil(s+r.toLowerCase(),new mxStencil(i)),null!=n){var l=i.getAttribute("w"),d=i.getAttribute("h");n(s,r,o,l=null==l?80:parseInt(l,10),d=null==d?80:parseInt(d,10))}}i=i.nextSibling}},OpenFile=function(e){this.producer=null,this.consumer=null,this.done=e},OpenFile.prototype.setConsumer=function(e){this.consumer=e,this.execute()},OpenFile.prototype.setData=function(e,n){this.data=e,this.filename=n,this.execute()},OpenFile.prototype.error=function(e){this.cancel(),mxUtils.alert(e)},OpenFile.prototype.execute=function(){null!=this.consumer&&null!=this.data&&(this.consumer(this.data,this.filename),this.cancel())},OpenFile.prototype.cancel=function(){null!=this.done&&this.done()},Sidebar.prototype.init=function(){var e=STENCIL_PATH;this.addSearchPalette(!0),this.addImagePalette("entry",mxResources.get("entry"),e+"/entry/","_128x128.png",["start","finally","end"],[mxResources.get("start"),mxResources.get("finally"),mxResources.get("end")]),this.addImagePalette("call_management",mxResources.get("call_management"),e+"/call_management/","_128x128.png",["answer","hangup","dial","ext_dial","queue","voicemail","callback"],[mxResources.get("answer"),mxResources.get("hangup"),mxResources.get("dial"),mxResources.get("ext_dial"),mxResources.get("queue"),mxResources.get("voicemail"),mxResources.get("callback")]),this.addImagePalette("agent_management",mxResources.get("agent_management"),e+"/agent_management/","_128x128.png",["login","pause","unpause","logout"],[mxResources.get("login"),mxResources.get("pause"),mxResources.get("unpause"),mxResources.get("logout")]),this.addImagePalette("variable",mxResources.get("variable"),e+"/variable/","_128x128.png",["set","math"],[mxResources.get("set"),mxResources.get("math")]),this.addImagePalette("playback",mxResources.get("playback"),e+"/playback/","_128x128.png",["playback","menu","saydigits","saynumber","sayphonetic","getdigits","getsecretdigits"],[mxResources.get("playback"),mxResources.get("menu"),mxResources.get("saydigits"),mxResources.get("saynumber"),mxResources.get("sayphonetic"),mxResources.get("getdigits"),mxResources.get("getsecretdigits")]),this.addImagePalette("recording",mxResources.get("recording"),e+"/recording/","_128x128.png",["record"],[mxResources.get("record")]),this.addImagePalette("tts","TTS",e+"/tts/","_128x128.png",["google_cloud_tts","tts","ispeechtts","awspolly","lumenvoxtts","sestektts","mrcpsynth"],["Google Cloud TTS","GoogleTTS","ISpeechTTS","AWSPolly","LumenvoxTTS","SestekTTS","MRCPSynth"]),this.addImagePalette("asr","ASR",e+"/asr/","_128x128.png",["googleasr","ispeechasr","lumenvoxasr","tildeasr","sestekasr","mrcprecog"],["GoogleASR","ISpeechASR","LumenvoxASR","TildeASR","SestekASR","MRCPRecog"]),this.addImagePalette("integrationServer",mxResources.get("integrationServer"),e+"/integration_server/","_128x128.png",["database","sendMail","sendSMS","dialogflow","dialogflowV2","awslex","sesteknda","restapi"],[mxResources.get("database"),mxResources.get("sendMail"),mxResources.get("sendSMS"),"Dialogflow","DialogflowV2","AWSLex","SestekNDA","RestAPI"]),this.addImagePalette("callflow",mxResources.get("callflow"),e+"/callflow/","_128x128.png",["gotoc","gotoif","gotoiftime","vswitch"],[mxResources.get("gotoc"),mxResources.get("gotoif"),mxResources.get("gotoiftime"),mxResources.get("vswitch")]),this.addImagePalette("stats",mxResources.get("stats"),e+"/stats/","_128x128.png",["goal"],[mxResources.get("goal")]),this.addImagePalette("general",mxResources.get("general"),e+"/general/","_128x128.png",["noop","system","agi","subproject","custom_app"],[mxResources.get("noop"),mxResources.get("system"),mxResources.get("agi"),mxResources.get("subproject"),mxResources.get("custom_app")])},Sidebar.prototype.collapsedImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQANAIABAJmZmf///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDozNUQyRTJFNjZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDozNUQyRTJFNzZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjFERjc3MEUxNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFERjc3MEUyNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAA0ADQAAAhSMj6lrwAjcC1GyahV+dcZJgeIIFgA7":IMAGE_PATH+"/collapsed.gif",Sidebar.prototype.expandedImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQANAIABAJmZmf///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IE1hY2ludG9zaCIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDoxREY3NzBERjZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDoxREY3NzBFMDZGNUYxMUU1QjZEOThCNDYxMDQ2MzNCQiI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOjFERjc3MERENkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOjFERjc3MERFNkY1RjExRTVCNkQ5OEI0NjEwNDYzM0JCIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+Af/+/fz7+vn49/b19PPy8fDv7u3s6+rp6Ofm5eTj4uHg397d3Nva2djX1tXU09LR0M/OzczLysnIx8bFxMPCwcC/vr28u7q5uLe2tbSzsrGwr66trKuqqainpqWko6KhoJ+enZybmpmYl5aVlJOSkZCPjo2Mi4qJiIeGhYSDgoGAf359fHt6eXh3dnV0c3JxcG9ubWxramloZ2ZlZGNiYWBfXl1cW1pZWFdWVVRTUlFQT05NTEtKSUhHRkVEQ0JBQD8+PTw7Ojk4NzY1NDMyMTAvLi0sKyopKCcmJSQjIiEgHx4dHBsaGRgXFhUUExIREA8ODQwLCgkIBwYFBAMCAQAAIfkEAQAAAQAsAAAAAA0ADQAAAhGMj6nL3QAjVHIu6azbvPtWAAA7":IMAGE_PATH+"/expanded.gif",Sidebar.prototype.tooltipImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAbCAMAAAB7jU7LAAAACVBMVEX///+ZmZn///9Y2COLAAAAA3RSTlP//wDXyg1BAAAAOElEQVR42mXQMQ4AMAgDsWv//+iutcJmIQSk+9dJpVKpVCqVSqVSqZTdncWzF8/NeP7FkxWenPEDOnUBiL3jWx0AAAAASUVORK5CYII=":IMAGE_PATH+"/tooltip.png",Sidebar.prototype.searchImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAMCAYAAABWdVznAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1MAAA6mAAADqYAAAXb5JfxUYAAAEaSURBVHjabNGxS5VxFIfxz71XaWuQUJCG/gCHhgTD9VpEETg4aMOlQRp0EoezObgcd220KQiXmpretTAHQRBdojlQEJyukPdt+b1ywfvAGc7wnHP4nlZd1yKijQW8xzNc4Su+ZOYfQ3T6/f4YNvEJYzjELXp4VVXVz263+7cR2niBxAFeZ2YPi3iHR/gYERPDwhpOsd6sz8x/mfkNG3iOlWFhFj8y89J9KvzGXER0GuEaD42mgwHqUtoljbcRsTBCeINpfM/MgZLKPpaxFxGbOCqDXmILN7hoJrTKH+axhxmcYRxP0MIDnOBDZv5q1XUNIuJxifJp+UNV7t7BFM6xeic0RMQ4Bpl5W/ol7GISx/eEUUTECrbx+f8A8xhiZht9zsgAAAAASUVORK5CYII=":IMAGE_PATH+"/search.png",Sidebar.prototype.enableTooltips=!0,Sidebar.prototype.tooltipBorder=16,Sidebar.prototype.tooltipDelay=300,Sidebar.prototype.dropTargetDelay=200,Sidebar.prototype.thumbWidth=36,Sidebar.prototype.thumbHeight=36,Sidebar.prototype.thumbPadding=5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2,Sidebar.prototype.sidebarTitleSize=9,Sidebar.prototype.sidebarTitles=!1,Sidebar.prototype.tooltipTitles=!0,Sidebar.prototype.maxTooltipWidth=400,Sidebar.prototype.maxTooltipHeight=400,Sidebar.prototype.addStencilsToIndex=!0,Sidebar.prototype.defaultImageWidth=80,Sidebar.prototype.defaultImageHeight=80,Sidebar.prototype.getOffset=function(e){return{left:(e=e.getBoundingClientRect()).left+window.scrollX,top:e.top+window.scrollY}},Sidebar.prototype.showTooltip=function(c,m,u,p,g,v){if(this.enableTooltips&&this.showTooltips&&this.currentElt!=c){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null);var e=mxUtils.bind(this,function(){null==this.tooltip&&(this.tooltip=document.createElement("div"),this.tooltip.className="geSidebarTooltip",this.tooltip.style.zIndex=mxPopupMenu.prototype.zIndex-1,document.body.appendChild(this.tooltip),this.graph2=new Graph(this.tooltip,null,null,this.editorUi.editor.graph.getStylesheet()),this.graph2.resetViewOnRootChange=!1,this.graph2.foldingEnabled=!1,this.graph2.gridEnabled=!1,this.graph2.autoScroll=!1,this.graph2.setTooltips(!1),this.graph2.setConnectable(!1),this.graph2.setEnabled(!1),mxClient.IS_SVG||(this.graph2.view.canvas.style.position="relative"),this.tooltipImage=mxUtils.createImage(this.tooltipImage),this.tooltipImage.className="geSidebarTooltipImage",this.tooltipImage.style.zIndex=mxPopupMenu.prototype.zIndex-1,this.tooltipImage.style.position="absolute",this.tooltipImage.style.width="14px",this.tooltipImage.style.height="27px",document.body.appendChild(this.tooltipImage)),this.graph2.model.clear(),this.graph2.view.setTranslate(this.tooltipBorder,this.tooltipBorder),u>this.maxTooltipWidth||p>this.maxTooltipHeight?this.graph2.view.scale=Math.round(100*Math.min(this.maxTooltipWidth/u,this.maxTooltipHeight/p))/100:this.graph2.view.scale=1,this.tooltip.style.display="block",this.graph2.labelsVisible=null==v||v,this.graph2.addCells(m);var e=this.graph2.getGraphBounds(),n=e.width+2*this.tooltipBorder+4,t=e.height+2*this.tooltipBorder;if(mxClient.IS_QUIRKS?(t+=4,this.tooltip.style.overflow="hidden"):this.tooltip.style.overflow="visible",this.tooltipImage.style.visibility="visible",this.tooltip.style.width=n+"px",this.tooltipTitles&&null!=g&&0<g.length){null==this.tooltipTitle?(this.tooltipTitle=document.createElement("div"),this.tooltipTitle.style.borderTop="1px solid gray",this.tooltipTitle.style.textAlign="center",this.tooltipTitle.style.width="100%",this.tooltipTitle.style.overflow="hidden",mxClient.IS_SVG||(this.tooltipTitle.style.position="absolute"),this.tooltipTitle.style.paddingTop="6px",this.tooltip.appendChild(this.tooltipTitle)):this.tooltipTitle.innerHTML="",this.tooltipTitle.style.display="",mxUtils.write(this.tooltipTitle,g);var a=this.tooltipTitle.offsetHeight+10;t+=a,mxClient.IS_SVG?this.tooltipTitle.style.marginTop=2-a+"px":(t-=6,this.tooltipTitle.style.top=t-a+"px")}else null!=this.tooltipTitle&&null!=this.tooltipTitle.parentNode&&(this.tooltipTitle.style.display="none");this.tooltip.style.height=t+"px";var i=-Math.round(e.x-this.tooltipBorder),s=-Math.round(e.y-this.tooltipBorder),o=document.body,r=document.documentElement,l=(o.clientHeight||r.clientHeight,document.getElementById("vertical-navigation").offsetWidth+this.container.clientWidth),d=Math.max(0,this.getOffset(c).top-this.container.scrollTop-t/2+16);mxClient.IS_SVG?0!=i||0!=s?this.graph2.view.canvas.setAttribute("transform","translate("+i+","+s+")"):this.graph2.view.canvas.removeAttribute("transform"):(this.graph2.view.drawPane.style.left=i+"px",this.graph2.view.drawPane.style.top=s+"px"),this.tooltip.style.position="absolute",this.tooltip.style.left=l+"px",this.tooltip.style.top=d+"px",this.tooltipImage.style.left=l-13+"px",this.tooltipImage.style.top=d+t/2-13+"px"});null!=this.tooltip&&"none"!=this.tooltip.style.display?e():this.thread=window.setTimeout(e,this.tooltipDelay),this.currentElt=c}},Sidebar.prototype.hideTooltip=function(){null!=this.thread&&(window.clearTimeout(this.thread),this.thread=null),null!=this.tooltip&&(this.tooltip.style.display="none",this.tooltipImage.style.visibility="hidden",this.currentElt=null)},Sidebar.prototype.addEntry=function(e,n){if(null!=this.taglist&&null!=e&&0<e.length)for(var t=e.toLowerCase().replace(/[\/\,\(\)]/g," ").split(" "),a=0;a<t.length;a++)if(t[a]=t[a].replace(/\.*\d*$/,""),1<t[a].length){var i=this.taglist[t[a]];null==i&&(i={entries:[],dict:new mxDictionary},this.taglist[t[a]]=i),null==i.dict.get(n)&&(i.dict.put(n,n),i.entries.push(n))}return n},Sidebar.prototype.searchEntries=function(e,n,t,a,i){if(null!=this.taglist&&null!=e){for(var s=e.toLowerCase().split(" "),o=new mxDictionary,r=(t+1)*n,l=[],d=0,c=0;c<s.length;c++)if(0<s[c].length){var m=this.taglist[s[c]],u=new mxDictionary;if(null!=m){var p=m.entries;l=[];for(var g=0;g<p.length;g++){m=p[g];if(0==d==(null==o.get(m))&&(u.put(m,m),l.push(m),c==s.length-1&&l.length==r))return void a(l.slice(t*n,r),r,!0)}}else l=[];o=u,d++}var v=l.length;a(l.slice(t*n,(t+1)*n),v,!1)}else a([])},Sidebar.prototype.filterTags=function(e){if(null==e)return null;for(var n=e.split(" "),t=[],a={},i=0;i<n.length;i++)null==a[n[i]]&&(a[n[i]]="1",t.push(n[i]));return t.join(" ")},Sidebar.prototype.cloneCell=function(e,n){var t=e.clone();return null!=n&&(t.value=n),t},Sidebar.prototype.addSearchPalette=function(e){var n=document.createElement("div");n.style.visibility="hidden",this.container.appendChild(n);var r=document.createElement("div");r.className="geSidebar",r.style.boxSizing="border-box",r.style.overflow="hidden",r.style.width="100%",r.style.padding="8px",r.style.paddingTop="14px",r.style.paddingBottom="0px",e||(r.style.display="none");var t=document.createElement("div");t.style.whiteSpace="nowrap",t.style.textOverflow="clip",t.style.paddingBottom="8px",t.style.cursor="default";var a=document.createElement("input");a.setAttribute("placeholder",mxResources.get("searchShapes")),a.setAttribute("type","text"),a.style.fontSize="12px",a.style.overflow="hidden",a.style.boxSizing="border-box",a.style.border="solid 1px #d5d5d5",a.style.borderRadius="4px",a.style.width="100%",a.style.outline="none",a.style.padding="6px",t.appendChild(a);var i,s=document.createElement("img");s.setAttribute("src",Sidebar.prototype.searchImage),s.setAttribute("title",mxResources.get("search")),s.style.position="relative",s.style.left="-18px",mxClient.IS_QUIRKS?(a.style.height="28px",s.style.top="-4px"):s.style.top="2px",s.style.background="url('"+this.editorUi.editor.transparentImage+"')",t.appendChild(s),r.appendChild(t);var l=document.createElement("center"),d=mxUtils.button(mxResources.get("moreResults"),function(){i()});d.style.display="none",d.style.lineHeight="normal",d.style.marginTop="4px",d.style.marginBottom="8px",l.style.paddingTop="4px",l.style.paddingBottom="8px",l.appendChild(d),r.appendChild(l);var c="",m=!1,u=!1,p=0,g=new Object,v=12,h=mxUtils.bind(this,function(){m=!1,this.currentSearch=null;for(var e=r.firstChild;null!=e;){var n=e.nextSibling;e!=t&&e!=l&&e.parentNode.removeChild(e),e=n}});i=mxUtils.bind(this,function(){if(v=4*Math.max(1,Math.floor(this.container.clientWidth/(this.thumbWidth+10))),this.hideTooltip(),""!=a.value){if(null!=l.parentNode&&(c!=a.value&&(h(),c=a.value,g=new Object,u=!1,p=0),!m&&!u)){d.setAttribute("disabled","true"),d.style.display="",d.style.cursor="wait",d.innerHTML=mxResources.get("loading")+"...",m=!0;var o=new Object;this.currentSearch=o,this.searchEntries(c,v,p,mxUtils.bind(this,function(e,n,t){if(this.currentSearch==o){e=null!=e?e:[],m=!1,p++,l.parentNode.removeChild(l);for(var a=0;a<e.length;a++){var i=e[a]();null==g[i.innerHTML]&&(g[i.innerHTML]="1",r.appendChild(e[a]()))}if(t?(d.removeAttribute("disabled"),d.innerHTML=mxResources.get("moreResults")):(d.innerHTML=mxResources.get("reset"),d.style.display="none",u=!0),d.style.cursor="",0==e.length&&1==p){var s=document.createElement("div");s.className="geTitle",s.style.backgroundColor="transparent",s.style.borderColor="transparent",s.style.color="gray",s.style.padding="0px",s.style.margin="0px 8px 0px 8px",s.style.paddingTop="6px",s.style.textAlign="center",s.style.cursor="default",mxUtils.write(s,mxResources.get("noResultsFor",[c])),r.appendChild(s)}r.appendChild(l)}}),mxUtils.bind(this,function(){d.style.cursor=""}))}}else h(),a.value="",c="",g=new Object,d.style.display="none",u=!1,a.focus()}),mxEvent.addListener(a,"keydown",mxUtils.bind(this,function(e){13==e.keyCode&&i()})),mxEvent.addListener(a,"focus",function(){a.style.paddingRight="",s.style.display="none"}),mxEvent.addListener(a,"blur",function(){a.style.paddingRight="20px",s.style.display=""}),a.style.paddingRight="20px",mxEvent.addListener(a,"keyup",mxUtils.bind(this,function(e){""==a.value?(u=!0,d.style.display="none"):a.value!=c?(d.style.display="none",u=!1):m||(d.style.display=u?"none":"")})),mxEvent.addListener(a,"mousedown",function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0}),mxEvent.addListener(a,"selectstart",function(e){e.stopPropagation&&e.stopPropagation(),e.cancelBubble=!0});var o=document.createElement("div");o.appendChild(r),this.container.appendChild(o),this.palettes.search=[n,o]},Sidebar.prototype.createTitle=function(e){var n=document.createElement("a");return n.setAttribute("href","javascript:void(0);"),n.setAttribute("title",mxResources.get("sidebarTooltip")),n.className="geTitle",mxUtils.write(n,e),n},Sidebar.prototype.createThumb=function(e,n,t,a,i,s,o,r,l){this.graph.labelsVisible=null==s||s;var d=mxClient.NO_FO;mxClient.NO_FO=Editor.prototype.originalNoForeignObject,this.graph.view.scaleAndTranslate(1,0,0),this.graph.addCells(e);var c=this.graph.getGraphBounds(),m=Math.floor(100*Math.min((n-2*this.thumbBorder)/c.width,(t-2*this.thumbBorder)/c.height))/100;this.graph.view.scaleAndTranslate(m,Math.floor((n-c.width*m)/2/m-c.x),Math.floor((t-c.height*m)/2/m-c.y));var u=null;if(this.graph.dialect!=mxConstants.DIALECT_SVG||mxClient.NO_FO?(u=this.graph.container.cloneNode(!1)).innerHTML=this.graph.container.innerHTML:u=this.graph.view.getCanvas().ownerSVGElement.cloneNode(!0),this.graph.getModel().clear(),mxClient.NO_FO=d,mxClient.IS_IE6&&(a.style.backgroundImage="url("+this.editorUi.editor.transparentImage+")"),u.style.position="relative",u.style.overflow="hidden",u.style.cursor="move",u.style.left=this.thumbBorder+"px",u.style.top=this.thumbBorder+"px",u.style.width=n+"px",u.style.height=t+"px",u.style.visibility="",u.style.minWidth="",u.style.minHeight="",a.appendChild(u),this.sidebarTitles&&null!=i&&0!=o){var p=mxClient.IS_QUIRKS?2*this.thumbPadding+2:0;a.style.height=this.thumbHeight+p+this.sidebarTitleSize+8+"px";var g=document.createElement("div");g.style.fontSize=this.sidebarTitleSize+"px",g.style.color="#303030",g.style.textAlign="center",g.style.whiteSpace="nowrap",mxClient.IS_IE&&(g.style.height=this.sidebarTitleSize+12+"px"),g.style.paddingTop="4px",mxUtils.write(g,i),a.appendChild(g)}return c},Sidebar.prototype.createItem=function(n,t,a,e,i,s,o){var r=document.createElement("a");r.setAttribute("href","javascript:void(0);"),r.className="geItem",r.style.overflow="hidden";var l=mxClient.IS_QUIRKS?8+2*this.thumbPadding:2*this.thumbBorder;r.style.width=this.thumbWidth+l+"px",r.style.height=this.thumbHeight+l+"px",r.style.padding=this.thumbPadding+"px",mxEvent.addListener(r,"click",function(e){mxEvent.consume(e)}),this.createThumb(n,this.thumbWidth,this.thumbHeight,r,t,a,e,i,s);var d=new mxRectangle(0,0,i,s);if(1<n.length||n[0].vertex){var c=this.createDragSource(r,this.createDropHandler(n,!0,o,d),this.createDragPreview(i,s),n,d);this.addClickHandler(r,c,n),c.isGuidesEnabled=mxUtils.bind(this,function(){return this.editorUi.editor.graph.graphHandler.guidesEnabled})}else if(null!=n[0]&&n[0].edge){c=this.createDragSource(r,this.createDropHandler(n,!1,o,d),this.createDragPreview(i,s),n,d);this.addClickHandler(r,c,n)}return mxClient.IS_IOS||mxEvent.addGestureListeners(r,null,mxUtils.bind(this,function(e){this.showTooltip(r,n,d.width,d.height,t,a)})),r},Sidebar.prototype.createDropHandler=function(g,v,h,f){return h=null==h||h,mxUtils.bind(this,function(e,n,t,a,i){if(e.isEnabled()){if(0<(g=e.getImportableCells(g)).length){e.stopEditing();var s=null!=t&&e.isValidDropTarget(t,g,n),o=null;if(null==t||s||(t=null),!e.isCellLocked(t||e.getDefaultParent())){e.model.beginUpdate();try{if(a=Math.round(a),i=Math.round(i),v&&e.isSplitTarget(t,g,n)){var r=e.cloneCells(g);e.splitEdge(t,r,null,a-f.width/2,i-f.height/2),o=r}else 0<g.length&&(o=e.importCells(g,a,i,t));if(null!=e.layoutManager){var l=e.layoutManager.getLayout(t);if(null!=l)for(var d=e.view.scale,c=e.view.translate,m=(a+c.x)*d,u=(i+c.y)*d,p=0;p<o.length;p++)l.moveCell(o[p],m,u)}h&&e.fireEvent(new mxEventObject("cellsInserted","cells",o))}finally{e.model.endUpdate()}null!=o&&0<o.length&&(e.scrollCellToVisible(o[0]),e.setSelectionCells(o))}}mxEvent.consume(n)}})},Sidebar.prototype.createDragPreview=function(e,n){var t=document.createElement("div");return t.style.border="1px dashed black",t.style.width=e+"px",t.style.height=n+"px",t},Sidebar.prototype.createDragSource=function(e,n,t){var a=mxUtils.makeDraggable(e,this.editorUi.editor.graph,n,t,0,0,this.editorUi.editor.graph.autoscroll,!0,!0);return a.getDropTarget=function(e,n,t){var a=mxDragSource.prototype.getDropTarget.apply(this,arguments);return e.isValidRoot(a)||(a=null),a},a},Sidebar.prototype.addClickHandler=function(e,a){var i=this.editorUi.editor.graph,s=null;mxEvent.addGestureListeners(e,function(e){s=new mxPoint(mxEvent.getClientX(e),mxEvent.getClientY(e))});var o=a.mouseUp;a.mouseUp=function(e){if(!mxEvent.isPopupTrigger(e)&&null==this.currentGraph&&null!=s){var n=i.tolerance;if(Math.abs(s.x-mxEvent.getClientX(e))<=n&&Math.abs(s.y-mxEvent.getClientY(e))<=n){var t=i.getGridSize();a.drop(i,e,null,t,t)}}o.apply(this,arguments),s=null}},Sidebar.prototype.createVertexTemplateEntry=function(e,n,t,a,i,s,o,r){return r=null!=r&&0<r.length?r:i.toLowerCase(),this.addEntry(r,mxUtils.bind(this,function(){return this.createVertexTemplate(e,n,t,a,i,s,o)}))},Sidebar.prototype.createXmlDocument=function(e,n,t,a){var i=mxUtils.createXmlDocument().createElement(e);return i.setAttribute("label",n),t.forEach(function(e,n){i.setAttribute(e,a[n]?a[n]:"")}),i},Sidebar.prototype.createVertexTemplate=function(e,n,t,a,i,s,o,r){var l=[],d=[];switch(a){case"answer":l=["timeout"],d=["0"];break;case"start":l=["answer"],d=["yes"];break;case"googleasr":l=["key","google_asr_language","timeout","intKey","beep"],d=["","it-IT","10","#","BEEP"];break;case"tildeasr":l=["uri","appid","appsecret","timeout","intKey","beep"],d=["wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE","","","10","#","BEEP"];break;case"ispeechasr":l=["key","model","ispeech_asr_language","timeout","intKey","beep"],d=["","","it-IT","10","#","BEEP"];break;case"playback":l=["file_id","opts"],d=["0"];break;case"background":l=["file_id","response","digit"],d=["0","5","1"];break;case"menu":l=["file_id","response","digit","retry","variable_id"],d=["0","5","1","1","0"];break;case"getdigits":l=["file_id","response","mindigit","maxdigit","retry","variable_id"],d=["0","5","1","10","1","0"];break;case"getsecretdigits":l=["file_id","response","mindigit","maxdigit","retry","hiddendigitsnum","hiddendigitspos","variable_id"],d=["0","5","1","10","1","0","first","0"];break;case"custom_app":l=["application","options"],d=["",""];break;case"set":l=["variable_id","variable_value"],d=["0",""];break;case"database":l=["odbc_id","query","variable_id"],d=["0","",""];break;case"noop":l=["output"],d=[];break;case"gotoc":l=["context","extension","priority"],d=["","","1"];break;case"system":l=["variable_id","command"],d=[];break;case"agi":l=["command","args"],d=[];break;case"gotoif":l=["condition"],d=[];break;case"gotoiftime":l=["interval_id"],d=["0"];break;case"vswitch":l=["variable_id"],d=["0"];break;case"saydigits":l=["digits","escape_digits"],d=["","#"];break;case"saynumber":l=["number","escape_digits"],d=["","#"];break;case"sayphonetic":l=["text","escape_digits"],d=["","#"];break;case"record":l=["file","recordingFormat","timeout","escape_digits"],d=["","wav","-1","#"];break;case"dial":l=["sip_id","timeout","opts","url"],d=["0","60"];break;case"ext_dial":l=["phone","trunk_name","timeout","opts","url"],d=["","","60"];break;case"google_cloud_tts":l=["apiKey","google_cloud_tts_text_type","text","languageCode","ssmlGender"],d=["","text","","en-US","FEMALE"];break;case"tts":l=["text","google_tts_language"],d=["","it"];break;case"ispeechtts":l=["text","key","ispeech_tts_language","speed","intKey"],d=["","","euritalianfemale","0","#"];break;case"lumenvoxtts":case"sestektts":l=["text","options"],d=["",""];break;case"lumenvoxasr":l=["grammar","options"],d=["",""];break;case"sestekasr":l=["grammar","options"],d=["/usr/local/unimrcp/data/grammar.xml",""];break;case"awspolly":l=["aws_access_key_id","aws_secret_access_key","aws_polly_region","aws_polly_voice","text","aws_text_type"],d=["","","eu-west-1","Amy","","text"];break;case"awslex":l=["aws_access_key_id","aws_secret_access_key","aws_lex_region","aws_bot_name","text"],d=["","","eu-west-1","",""];break;case"queue":l=["queue_id","opts","url","file_id","timeout","agi","macro","gosub","position"],d=["-1","xX","","","300"];break;case"voicemail":l=["mailbox","options"],d=["",""];break;case"subproject":l=["project_id"],d=["0"];break;case"math":l=["operation","variable_id"],d=["","0"];break;case"queuelog":l=["queuename","agent","queue_event","data1","data2","data3","data4","data5"],d=[];break;case"goal":l=["goalname"],d=[];break;case"callback":l=["name","lastName","phone","dialTimezone","list_id","delay","callback_priority"],d=["{CALLERID(name)}","","{CALLERID(num)}","","-1","5","2"];break;case"sendSMS":l=["sms_account_id","to","sms_text"],d=["0"];break;case"sendMail":l=["account_id","to","cc","bcc","subject","text"],d=["0"];break;case"sendFax":l=["account_id","to","choose_attachment","attachment_name","attachment_type","attachment_path"],d=["0"];break;case"login":case"unpause":case"logout":l=["findBy"],d=["internal"];break;case"pause":l=["findBy","pause_id"],d=["internal",""];break;case"dialogflow":l=["key","text","dialogflow_language"],d=["","","it"];break;case"sesteknda":l=["ndauth_url","username","password","ndassistant_url","text","project","ndagenerate_audio","custom_action","custom_action_data","ndaactivity_type"],d=["","","","","","",1,"","","message"];break;case"restapi":l=["url","method","timeout","computedVariables","rawHeaders","rawBody","variable_id"],d=["","GET","5","","","",""];break;case"mrcpsynth":l=["text","options"],d=["",""];break;case"mrcprecog":l=["grammar","options"],d=["",""];break;case"dialogflowV2":l=["dialogflowV2_project_id","client_email","private_key","dialogflowV2_language","text"],d=["","","","en",""];break;default:l=[],d=[]}var c=[new mxCell(this.createXmlDocument(a,i,l,d),new mxGeometry(0,0,n,t),e)];return c[0].vertex=!0,this.createVertexTemplateFromCells(c,n,t,i,s,o,r)},Sidebar.prototype.createVertexTemplateFromCells=function(e,n,t,a,i,s,o){return this.createItem(e,a,i,s,n,t,o)},Sidebar.prototype.createEdgeTemplate=function(e,n,t,a,i,s,o){var r=new mxCell(null!=a?a:"",new mxGeometry(0,0,n,t),e);return r.geometry.setTerminalPoint(new mxPoint(0,t),!0),r.geometry.setTerminalPoint(new mxPoint(n,0),!1),r.geometry.relative=!0,r.edge=!0,this.createEdgeTemplateFromCells([r],n,t,i,s,o)},Sidebar.prototype.createEdgeTemplateFromCells=function(e,n,t,a,i,s){return this.createItem(e,a,i,!0,n,t,s)},Sidebar.prototype.addPaletteFunctions=function(e,n,t,a){this.addPalette(e,n,t,mxUtils.bind(this,function(e){for(var n=0;n<a.length;n++)e.appendChild(a[n](e))}))},Sidebar.prototype.addPalette=function(e,n,t,a){var i=this.createTitle(n);this.container.appendChild(i);var s=document.createElement("div");s.className="geSidebar",mxClient.IS_POINTER&&(s.style.touchAction="none"),mxEvent.addListener(s,"mousemove",mxUtils.bind(this,function(e){mxEvent.getSource(e)==s?s.setAttribute("title",mxResources.get("sidebarTooltip")):s.removeAttribute("title")})),t?(a(s),a=null):s.style.display="none",this.addFoldingHandler(i,s,a);var o=document.createElement("div");return o.appendChild(s),this.container.appendChild(o),null!=e&&(this.palettes[e]=[i,o]),s},Sidebar.prototype.addFoldingHandler=function(t,a,i){var s=!1;(!mxClient.IS_IE||8<=document.documentMode)&&(t.style.backgroundImage="none"==a.style.display?"url('"+this.collapsedImage+"')":"url('"+this.expandedImage+"')"),t.style.backgroundRepeat="no-repeat",t.style.backgroundPosition="0% 50%",mxEvent.addListener(t,"click",mxUtils.bind(this,function(e){if("none"==a.style.display){if(s)a.style.display="block";else if(s=!0,null!=i){t.style.cursor="wait";var n=t.innerHTML;t.innerHTML=mxResources.get("loading")+"...",window.setTimeout(function(){var e=mxClient.NO_FO;mxClient.NO_FO=Editor.prototype.originalNoForeignObject,i(a),mxClient.NO_FO=e,a.style.display="block",t.style.cursor="",t.innerHTML=n},0)}else a.style.display="block";t.style.backgroundImage="url('"+this.expandedImage+"')"}else t.style.backgroundImage="url('"+this.collapsedImage+"')",a.style.display="none";mxEvent.consume(e)}))},Sidebar.prototype.addImagePalette=function(e,n,s,o,r,t,a){for(var l=[],d=0;d<r.length;d++)mxUtils.bind(this,function(e,n,t){if(null==t){var a=e.lastIndexOf("/"),i=e.lastIndexOf(".");t=e.substring(0<=a?a+1:0,0<=i?i:e.length).replace(/[-_]/g," ")}l.push(this.createVertexTemplateEntry("image;html=1;image="+s+e+o,this.defaultImageWidth,this.defaultImageHeight,r[d],n,!1,!0,this.filterTags(t)))})(r[d],null!=t?t[d]:null,null!=a?a[r[d]]:null);this.addPaletteFunctions(e,n,!1,l)},"undefined"!=typeof html4&&(html4.ATTRIBS["a::target"]=0),mxConstants.SHADOW_OPACITY=.25,mxConstants.SHADOWCOLOR="#000000",mxConstants.VML_SHADOWCOLOR="#d0d0d0",mxGraph.prototype.pageBreakColor="#c0c0c0",mxGraph.prototype.pageScale=1,function(){try{if(null!=navigator&&null!=navigator.language){var e=navigator.language.toLowerCase();mxGraph.prototype.pageFormat="en-us"===e||"en-ca"===e||"es-mx"===e?mxConstants.PAGE_FORMAT_LETTER_PORTRAIT:mxConstants.PAGE_FORMAT_A4_PORTRAIT}}catch(e){}}(),mxText.prototype.baseSpacingTop=5,mxText.prototype.baseSpacingBottom=1,mxGraphModel.prototype.ignoreRelativeEdgeParent=!1,mxGraphView.prototype.gridImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhCgAKAJEAAAAAAP///8zMzP///yH5BAEAAAMALAAAAAAKAAoAAAIJ1I6py+0Po2wFADs=":IMAGE_PATH+"/grid.gif",mxGraphView.prototype.gridSteps=4,mxGraphView.prototype.minGridSize=4,mxGraphView.prototype.gridColor="#e0e0e0",mxSvgCanvas2D.prototype.foAltText="[Not supported by viewer]",Graph=function(e,n,t,a){mxGraph.call(this,e,n,t,a),this.setConnectable(!0),this.setDropEnabled(!1),this.setPanning(!0),this.setTooltips(!mxClient.IS_TOUCH),this.setAllowLoops(!1),this.setMultigraph(!1),this.allowAutoPanning=!0,this.resetEdgesOnConnect=!1,this.constrainChildren=!1,this.connectionHandler.targetConnectImage=!0,this.setAllowDanglingEdges(!1),this.connectionHandler.setCreateTarget(!1),this.connectionHandler.isValidSource=function(){return mxConnectionHandler.prototype.isValidSource.apply(this,arguments)&&"2"!=urlParams.connect},this.alternateEdgeStyle="vertical",null==a&&this.loadStylesheet();var i=new mxRubberband(this);this.getRubberband=function(){return i},this.panningHandler.addListener(mxEvent.PAN_START,mxUtils.bind(this,function(){this.container.style.cursor="pointer"})),this.panningHandler.addListener(mxEvent.PAN_END,mxUtils.bind(this,function(){this.container.style.cursor="default"})),this.isHtmlLabel=function(e){var n=this.view.getState(e),t=null!=n?n.style:this.getCellStyle(e);return"1"==t.html||"wrap"==t.whiteSpace},this.cellRenderer.getLabelValue=function(e){var n=mxCellRenderer.prototype.getLabelValue.apply(this,arguments);return"wrap"==e.style.whiteSpace&&1!=e.style.html&&(n=mxUtils.htmlEntities(n,!1)),n},this.isCellLocked=function(e){return!1},this.connectionHandler.tapAndHoldTolerance=16;var s=this.connectionHandler.tapAndHold;this.connectionHandler.tapAndHold=function(e,n){null==n?this.graph.panningHandler.active||(i.start(e.getGraphX(),e.getGraphY()),this.graph.panningHandler.panningTrigger=!1):tapAndHoldStartsConnection?s.apply(this,arguments):this.graph.isCellSelected(n.cell)&&1<this.graph.getSelectionCount()&&this.graph.removeSelectionCell(n.cell)},touchStyle&&this.initTouch()},mxUtils.extend(Graph,mxGraph),Graph.prototype.minFitScale=null,Graph.prototype.maxFitScale=null,Graph.prototype.loadStylesheet=function(){var e=mxUtils.load(STYLE_PATH+"/default.xml").getDocumentElement();new mxCodec(e.ownerDocument).decode(e,this.getStylesheet())},Graph.prototype.flipEdge=function(e){if(null!=e){var n=this.view.getState(e),t=null!=n?n.style:this.getCellStyle(e);if(null!=t){var a=mxUtils.getValue(t,mxConstants.STYLE_ELBOW,mxConstants.ELBOW_HORIZONTAL)==mxConstants.ELBOW_HORIZONTAL?mxConstants.ELBOW_VERTICAL:mxConstants.ELBOW_HORIZONTAL;this.setCellStyles(mxConstants.STYLE_ELBOW,a,[e])}}},Graph.prototype.setDefaultEdge=function(e){if(null!=e&&this.getModel().isEdge(e)){var n=this.getModel().cloneCells([e])[0];null!=n.geometry&&(n.geometry.points=null);var t=n.getStyle();t=mxUtils.setStyle(t,mxConstants.STYLE_ENTRY_X,null),t=mxUtils.setStyle(t,mxConstants.STYLE_ENTRY_Y,null),t=mxUtils.setStyle(t,mxConstants.STYLE_EXIT_X,null),t=mxUtils.setStyle(t,mxConstants.STYLE_EXIT_Y,null),n.setStyle(t),this.connectionHandler.createEdgeState=function(e){return this.graph.view.createState(n)},this.connectionHandler.factoryMethod=function(){return this.graph.cloneCells([n])[0]}}},Graph.prototype.isCellFoldable=function(e){return this.foldingEnabled&&this.isSwimlane(e)},Graph.prototype.isValidRoot=function(e){return this.isSwimlane(e)},Graph.prototype.createGroupCell=function(){var e=mxGraph.prototype.createGroupCell.apply(this,arguments);return e.setStyle("group"),e},Graph.prototype.getTooltipForCell=function(e){var n="";return this.getModel().isVertex(e)?n+=mxResources.get("description_"+e.value.nodeName)||"":this.getModel().isEdge(e)&&(n=mxGraph.prototype.getTooltipForCell.apply(this,arguments)),n},Graph.prototype.convertValueToString=function(e){return null!=e.value&&"object"==typeof e.value?e.value.getAttribute("label"):mxGraph.prototype.convertValueToString.apply(this,arguments)},Graph.prototype.cellLabelChanged=function(e,n,t){if(null!=e.value&&"object"==typeof e.value){var a=e.value.cloneNode(!0);a.setAttribute("label",n),n=a}mxGraph.prototype.cellLabelChanged.apply(this,arguments)},Graph.prototype.setLinkForCell=function(e,n){var t=null;null!=e.value&&"object"==typeof e.value?t=e.value.cloneNode(!0):(t=mxUtils.createXmlDocument().createElement("UserObject")).setAttribute("label",e.value);null!=n&&0<n.length?t.setAttribute("link",n):t.removeAttribute("link"),this.model.setValue(e,t)},Graph.prototype.getLinkForCell=function(e){return null!=e.value&&"object"==typeof e.value?e.value.getAttribute("link"):null},Graph.prototype.initTouch=function(){this.connectionHandler.marker.isEnabled=function(){return null!=this.graph.connectionHandler.first},this.addListener(mxEvent.START_EDITING,function(e,n){this.panningHandler.hideMenu()});var s=!1,o=null;this.updateMouseEvent=function(e){if(mxGraph.prototype.updateMouseEvent.apply(this,arguments),null==e.getState()){var n=this.getCellAt(e.graphX,e.graphY);this.getModel().isEdge(n)&&(e.state=this.view.getState(n),null!=e.state&&null!=e.state.shape&&(this.container.style.cursor=e.state.shape.node.style.cursor))}null==e.getState()&&(this.container.style.cursor="default")},this.fireMouseEvent=function(e,n,t){if(e==mxEvent.MOUSE_DOWN)this.panningHandler.isMenuShowing()?(s=!1,o=null):(o=n.getCell(),s=null!=o?this.isCellSelected(o):this.isSelectionEmpty());else if(e==mxEvent.MOUSE_UP){if(s&&!this.isEditing()){if(!this.panningHandler.isMenuShowing()){var a=mxEvent.getClientX(n.getEvent()),i=mxEvent.getClientY(n.getEvent());this.panningHandler.popup(a+16,i,o,n.getEvent())}return s=!1,o=null,void n.consume()}s=!1,o=null}mxGraph.prototype.fireMouseEvent.apply(this,arguments),e==mxEvent.MOUSE_MOVE&&n.isConsumed()&&(s=!1,o=null)}},function(){if(mxVertexHandler.prototype.rotationEnabled=!0,mxText.prototype.baseSpacingTop=5,mxText.prototype.baseSpacingBottom=1,touchStyle){mxConstants.HANDLE_SIZE=16,mxConstants.LABEL_HANDLE_SIZE=7,mxClient.IS_TOUCH&&(mxVertexHandler.prototype.tolerance=4,mxEdgeHandler.prototype.tolerance=6,Graph.prototype.tolerance=14,Graph.prototype.gridSize=20,mxPanningHandler.prototype.selectOnPopup=!1,mxPanningHandler.prototype.useLeftButtonForPanning=!0,mxPanningHandler.prototype.isPanningTrigger=function(e){var n=e.getEvent();return this.useLeftButtonForPanning&&(this.ignoreCell||null==e.getState())||mxEvent.isControlDown(n)&&mxEvent.isShiftDown(n)||this.usePopupTrigger&&mxEvent.isPopupTrigger(n)});var t=mxGraphHandler.prototype.mouseDown;mxGraphHandler.prototype.mouseDown=function(e,n){t.apply(this,arguments),this.graph.isCellSelected(n.getCell())&&1<this.graph.getSelectionCount()&&(this.delayedSelection=!1)},Graph.prototype.createHandlers=function(e){this.tooltipHandler=new mxTooltipHandler(this),this.tooltipHandler.setEnabled(!1),this.selectionCellsHandler=new mxSelectionCellsHandler(this),this.panningHandler=new mxPanningHandler(this),this.panningHandler.panningEnabled=!1,this.connectionHandler=new mxConnectionHandler(this),this.connectionHandler.setEnabled(!1),this.graphHandler=new mxGraphHandler(this)},mxConnectionHandler.prototype.selectCells=function(e,n){touchStyle&&null!=n?this.graph.setSelectionCell(n):this.graph.setSelectionCell(e)};var a=mxGraph.prototype.dblClick;Graph.prototype.dblClick=function(e,n){if(null==n){var t=mxUtils.convertPoint(this.container,mxEvent.getClientX(e),mxEvent.getClientY(e));n=this.getCellAt(t.x,t.y)}a.call(this,e,n)};var e=new mxImage(IMAGE_PATH+"/touch-handle.png",16,16);mxVertexHandler.prototype.handleImage=e,mxEdgeHandler.prototype.handleImage=e,mxOutline.prototype.sizerImage=e,(new Image).src=e.src;var n=IMAGE_PATH+"/touch-connector.png",i=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){i.apply(this,arguments),showConnectorImg&&this.graph.connectionHandler.isEnabled()&&this.graph.isCellConnectable(this.state.cell)&&!this.graph.isValidRoot(this.state.cell)&&1==this.graph.getSelectionCount()&&(this.connectorImg=mxUtils.createImage(n),this.connectorImg.style.cursor="pointer",this.connectorImg.style.width="29px",this.connectorImg.style.height="29px",this.connectorImg.style.position="absolute",mxClient.IS_TOUCH||(this.connectorImg.setAttribute("title",mxResources.get("connect")),mxEvent.redirectMouseEvents(this.connectorImg,this.graph,this.state)),this.connectorImg.style.padding="2px",mxEvent.addGestureListeners(this.connectorImg,mxUtils.bind(this,function(e){this.graph.panningHandler.hideMenu();var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,n.x,n.y),this.graph.isMouseDown=!0,mxEvent.consume(e)})),this.graph.container.appendChild(this.connectorImg)),this.redrawTools()};var s=mxVertexHandler.prototype.redraw;mxVertexHandler.prototype.redraw=function(){s.apply(this),this.redrawTools()},mxVertexHandler.prototype.redrawTools=function(){null!=this.state&&null!=this.connectorImg&&(mxVertexHandler.prototype.singleSizer?(this.connectorImg.style.left=this.state.x+this.state.width-this.connectorImg.offsetWidth/2+"px",this.connectorImg.style.top=this.state.y-this.connectorImg.offsetHeight/2+"px"):(this.connectorImg.style.left=this.state.x+this.state.width+mxConstants.HANDLE_SIZE/2+4+"px",this.connectorImg.style.top=this.state.y+(this.state.height-this.connectorImg.offsetHeight)/2+"px"))};var o=mxVertexHandler.prototype.destroy;mxVertexHandler.prototype.destroy=function(e,n){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)},(new Image).src=n}else{var r=new mxImage(IMAGE_PATH+"/connector.png",15,15);if(mxConnectionHandler.prototype.connectImage=r,(new Image).src=r.src,"2"==urlParams.connect){r=new mxImage(IMAGE_PATH+"/connector.png",15,15),i=mxVertexHandler.prototype.init;mxVertexHandler.prototype.init=function(){i.apply(this,arguments),showConnectorImg&&this.graph.connectionHandler.isEnabled()&&this.graph.isCellConnectable(this.state.cell)&&!this.graph.isValidRoot(this.state.cell)&&1==this.graph.getSelectionCount()&&(mxClient.IS_IE&&!mxClient.IS_SVG?(this.connectorImg=document.createElement("div"),this.connectorImg.style.backgroundImage="url("+r.src+")",this.connectorImg.style.backgroundPosition="center",this.connectorImg.style.backgroundRepeat="no-repeat",this.connectorImg.style.width=r.width+4+"px",this.connectorImg.style.height=r.height+4+"px",this.connectorImg.style.display=mxClient.IS_QUIRKS?"inline":"inline-block"):(this.connectorImg=mxUtils.createImage(r.src),this.connectorImg.style.width=r.width+"px",this.connectorImg.style.height=r.height+"px"),this.connectorImg.style.cursor="pointer",this.connectorImg.style.position="absolute",this.connectorImg.setAttribute("title",mxResources.get("connect")),mxEvent.redirectMouseEvents(this.connectorImg,this.graph,this.state),this.connectorImg.style.padding="2px",mxEvent.addListener(this.connectorImg,"mousedown",mxUtils.bind(this,function(e){this.graph.panningHandler.hideMenu();var n=mxUtils.convertPoint(this.graph.container,mxEvent.getClientX(e),mxEvent.getClientY(e));this.graph.connectionHandler.start(this.state,n.x,n.y),this.graph.isMouseDown=!0,mxEvent.consume(e)})),this.graph.container.appendChild(this.connectorImg)),this.redrawTools()};s=mxVertexHandler.prototype.redraw;mxVertexHandler.prototype.redraw=function(){s.apply(this),this.redrawTools()},mxVertexHandler.prototype.redrawTools=function(){null!=this.state&&null!=this.connectorImg&&(mxVertexHandler.prototype.singleSizer?(this.connectorImg.style.left=this.state.x+this.state.width-this.connectorImg.offsetWidth/2+"px",this.connectorImg.style.top=this.state.y-this.connectorImg.offsetHeight/2+"px"):(this.connectorImg.style.left=this.state.x+this.state.width+mxConstants.HANDLE_SIZE/2+2+"px",this.connectorImg.style.top=this.state.y+(this.state.height-this.connectorImg.offsetHeight)/2+"px"))};o=mxVertexHandler.prototype.destroy;mxVertexHandler.prototype.destroy=function(e,n){o.apply(this,arguments),null!=this.connectorImg&&(this.connectorImg.parentNode.removeChild(this.connectorImg),this.connectorImg=null)}}}}(),Actions.prototype.init=function(){var n=this.editorUi,l=n.editor,d=l.graph;this.addAction("new",function(){n.projectDesignController.newProject()},CRUD_PERMISSIONS.canEdit),this.addAction("open",function(){n.projectDesignController.openProject()},CRUD_PERMISSIONS.canEdit),this.addAction("save",function(){n.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml())),n.editor.modified=!1},CRUD_PERMISSIONS.canEdit,null,"Ctrl+S"),this.addAction("saveAs",function(){n.projectDesignController.saveProjectAs(mxUtils.getPrettyXml(l.getGraphXml()))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+S"),this.addAction("publish",function(){n.editor.setStatus(""),null===n.validate()?(n.projectDesignController.saveOrPublishProject(mxUtils.getPrettyXml(l.getGraphXml()),!0),n.editor.modified=!1):(n.editor.setStatus("...Error publishing! Please check the project and try again!"),setTimeout(function(){n.editor.setStatus("")},3e3))},CRUD_PERMISSIONS.canEdit,null,"Ctrl+Shift+P"),this.addAction("variable",function(){n.projectDesignController.newVariable()},CRUD_PERMISSIONS.canEdit),this.addAction("import",function(){n.projectDesignController.importXML(function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("export",function(){n.exportXML(mxUtils.getPrettyXml(l.getGraphXml()))},null,null,"Ctrl+E"),this.addAction("editFile",function(){n.projectDesignController.editXML(mxUtils.getPrettyXml(l.getGraphXml()),function(e){l.setGraphXml(mxUtils.parseXml(e).documentElement)})},CRUD_PERMISSIONS.canEdit),this.addAction("print",function(){mxUtils.printScreen(d)},null,"sprite-print","Ctrl+P"),this.addAction("preview",function(){mxUtils.show(d,null,10,10)}),this.addAction("undo",function(){l.undoManager.undo()},null,"sprite-undo","Ctrl+Z"),this.addAction("redo",function(){l.undoManager.redo()},null,"sprite-redo","Ctrl+Y"),this.addAction("cut",function(){mxClipboard.cut(d)},null,"sprite-cut","Ctrl+X"),this.addAction("copy",function(){mxClipboard.copy(d)},null,"sprite-copy","Ctrl+C"),this.addAction("paste",function(){mxClipboard.paste(d)},!1,"sprite-paste","Ctrl+V"),this.addAction("delete",function(){d.removeCells()},null,null,"Delete"),this.addAction("duplicate",function(){var e=d.gridSize;d.setSelectionCells(d.moveCells(d.getSelectionCells(),e,e,!0))},null,null,"Ctrl+D"),this.addAction("selectVertices",function(){d.selectVertices()},null,null,"Ctrl+Shift+V"),this.addAction("selectEdges",function(){d.selectEdges()},null,null,"Ctrl+Shift+E"),this.addAction("selectAll",function(){d.selectAll()},null,null,"Ctrl+A"),this.addAction("home",function(){d.home()},null,null,"Home"),this.addAction("exitGroup",function(){d.exitGroup()},null,null,"Page Up"),this.addAction("enterGroup",function(){d.enterGroup()},null,null,"Page Down"),this.addAction("expand",function(){d.foldCells(!1)},null,null,"Enter"),this.addAction("collapse",function(){d.foldCells(!0)},null,null,"Backspace"),this.addAction("toFront",function(){d.orderCells(!1)},null,null,"Ctrl+F"),this.addAction("toBack",function(){d.orderCells(!0)},null,null,"Ctrl+B"),this.addAction("group",function(){d.setSelectionCell(d.groupCells(null,0))},null,null,"Ctrl+G"),this.addAction("ungroup",function(){d.setSelectionCells(d.ungroupCells())},null,null,"Ctrl+U"),this.addAction("removeFromGroup",function(){d.removeCellsFromParent()}),this.addAction("editLink",function(){var e=d.getSelectionCell(),n=d.getLinkForCell(e);null==n&&(n=""),null!=(n=mxUtils.prompt(mxResources.get("enterValue"),n))&&d.setLinkForCell(e,n)}),this.addAction("openLink",function(){var e=d.getSelectionCell(),n=d.getLinkForCell(e);null!=n&&window.open(n)}),this.addAction("autosize",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var n=0;n<e.length;n++){var t=e[n];d.getModel().getChildCount(t)?d.updateGroupBounds([t],20):d.updateCellSize(t)}}finally{d.getModel().endUpdate()}}}),this.addAction("wordWrap",function(){var e=d.getView().getState(d.getSelectionCell()),n="wrap";null!=e&&"wrap"==e.style[mxConstants.STYLE_WHITE_SPACE]&&(n=null),d.setCellStyles(mxConstants.STYLE_WHITE_SPACE,n)}),this.addAction("rotation",function(){var e="0",n=d.getView().getState(d.getSelectionCell());null!=n&&(e=n.style[mxConstants.STYLE_ROTATION]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("rotation")+" 0-360)",e))&&d.setCellStyles(mxConstants.STYLE_ROTATION,e)}),this.addAction("tilt",function(){var e=d.getSelectionCells();if(null!=e){d.getModel().beginUpdate();try{for(var n=0;n<e.length;n++){var t=e[n];if(d.getModel().isVertex(t)&&0==d.getModel().getChildCount(t)){var a=d.getCellGeometry(t);if(null!=a){(a=a.clone()).x+=a.width/2-a.height/2,a.y+=a.height/2-a.width/2;var i=a.width;a.width=a.height,a.height=i,d.getModel().setGeometry(t,a);var s=d.view.getState(t);if(null!=s){var o=s.style[mxConstants.STYLE_DIRECTION]||"east";"east"==o?o="south":"south"==o?o="west":"west"==o?o="north":"north"==o&&(o="east"),d.setCellStyles(mxConstants.STYLE_DIRECTION,o,[t])}}}}}finally{d.getModel().endUpdate()}}},null,null,"Ctrl+R"),this.addAction("actualSize",function(){d.zoomTo(1)}),this.addAction("zoomIn",function(){d.zoomIn()},null,null,"Add"),this.addAction("zoomOut",function(){d.zoomOut()},null,null,"Subtract"),this.addAction("fitWindow",function(){d.fit()}),this.addAction("fitPage",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,n=d.pageScale,t=d.container.clientWidth-20,a=d.container.clientHeight-20,i=Math.floor(100*Math.min(t/e.width/n,a/e.height/n))/100;d.zoomTo(i),d.container.scrollLeft=Math.round(d.view.translate.x*i-Math.max(10,(d.container.clientWidth-e.width*n*i)/2)),d.container.scrollTop=Math.round(d.view.translate.y*i-Math.max(10,(d.container.clientHeight-e.height*n*i)/2))})),this.addAction("fitPageWidth",mxUtils.bind(this,function(){d.pageVisible||this.get("pageView").funct();var e=d.pageFormat,n=d.pageScale,t=d.container.clientWidth-20,a=Math.floor(100*t/e.width/n)/100;d.zoomTo(a),d.container.scrollLeft=Math.round(d.view.translate.x*a-Math.max(10,(d.container.clientWidth-e.width*n*a)/2)),d.container.scrollTop=Math.round(d.view.translate.y*a-Math.max(10,(d.container.clientHeight-e.height*n*a)/2))})),this.put("customZoom",new Action(mxResources.get("custom"),function(){var e=mxUtils.prompt(mxResources.get("enterValue")+" (%)",parseInt(100*d.getView().getScale()));null!=e&&0<e.length&&!isNaN(parseInt(e))&&d.zoomTo(parseInt(e)/100)}));var e=null;(e=this.addAction("grid",function(){d.setGridEnabled(!d.isGridEnabled()),l.updateGraphComponents()},null,null,"Ctrl+Shift+G")).setToggleAction(!0),e.setSelectedCallback(function(){return d.isGridEnabled()}),(e=this.addAction("guides",function(){d.graphHandler.guidesEnabled=!d.graphHandler.guidesEnabled})).setToggleAction(!0),e.setSelectedCallback(function(){return d.graphHandler.guidesEnabled}),(e=this.addAction("tooltips",function(){d.tooltipHandler.setEnabled(!d.tooltipHandler.isEnabled())})).setToggleAction(!0),e.setSelectedCallback(function(){return d.tooltipHandler.isEnabled()}),(e=this.addAction("navigation",function(){d.foldingEnabled=!d.foldingEnabled,d.view.revalidate()})).setToggleAction(!0),e.setSelectedCallback(function(){return d.foldingEnabled}),(e=this.addAction("scrollbars",function(){if(d.scrollbars=!d.scrollbars,l.updateGraphComponents(),d.scrollbars){var e=d.view.translate.x,n=d.view.translate.y;d.view.translate.x=0,d.view.translate.y=0,d.sizeDidChange(),d.container.scrollLeft-=Math.round(e*d.view.scale),d.container.scrollTop-=Math.round(n*d.view.scale)}else{var t=d.view.translate;d.view.setTranslate(t.x-d.container.scrollLeft/d.view.scale,t.y-d.container.scrollTop/d.view.scale),d.container.scrollLeft=0,d.container.scrollTop=0,d.sizeDidChange()}},!mxClient.IS_TOUCH)).setToggleAction(!0),e.setSelectedCallback(function(){return"auto"==d.container.style.overflow}),(e=this.addAction("pageView",mxUtils.bind(this,function(){d.pageVisible=!d.pageVisible,d.pageBreaksVisible=d.pageVisible,d.preferPageSize=d.pageBreaksVisible,d.view.validate(),d.sizeDidChange(),l.updateGraphComponents(),l.outline.update(),mxUtils.hasScrollbars(d.container)&&(d.pageVisible?(d.container.scrollLeft-=20,d.container.scrollTop-=20):(d.container.scrollLeft+=20,d.container.scrollTop+=20))}))).setToggleAction(!0),e.setSelectedCallback(function(){return d.pageVisible}),(e=this.addAction("connect",function(){d.setConnectable(!d.connectionHandler.isEnabled())},null,null,"Ctrl+Q")).setToggleAction(!0),e.setSelectedCallback(function(){return d.connectionHandler.isEnabled()}),(e=this.addAction("copyConnect",function(){d.connectionHandler.setCreateTarget(!d.connectionHandler.isCreateTarget())})).setToggleAction(!0),e.setSelectedCallback(function(){return d.connectionHandler.isCreateTarget()}),this.addAction("help",function(){window.open("https://wiki.xcallymotion.com/display/XMV/Cally+Square")}),this.put("about",new Action(mxResources.get("about")+" Cally Square",function(){window.open("http://callysquare.com/")},null,null,null));var t=mxUtils.bind(this,function(e,n){this.addAction(e,function(){d.toggleCellStyleFlags(mxConstants.STYLE_FONTSTYLE,n)})});t("bold",mxConstants.FONT_BOLD),t("italic",mxConstants.FONT_ITALIC),t("underline",mxConstants.FONT_UNDERLINE),this.addAction("shadow",function(){d.toggleCellStyles(mxConstants.STYLE_SHADOW)}),this.addAction("dashed",function(){d.toggleCellStyles(mxConstants.STYLE_DASHED)}),this.addAction("rounded",function(){d.toggleCellStyles(mxConstants.STYLE_ROUNDED)}),this.addAction("curved",function(){d.toggleCellStyles(mxConstants.STYLE_CURVED)}),this.addAction("style",function(){var e=d.getSelectionCells();if(null!=e&&0<e.length){var n=d.getModel(),t=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("style")+")",n.getStyle(e[0])||"");null!=t&&d.setCellStyle(t,e)}}),this.addAction("setAsDefaultEdge",function(){d.setDefaultEdge(d.getSelectionCell())}),this.addAction("addWaypoint",function(){var e=d.getSelectionCell();if(null!=e&&d.getModel().isEdge(e)){var n=l.graph.selectionCellsHandler.getHandler(e);if(n instanceof mxEdgeHandler){var t=d.view.translate,a=d.view.scale,i=t.x,s=t.y,o=d.getModel().getParent(e),r=d.getCellGeometry(o);d.getModel().isVertex(o)&&null!=r&&(i+=r.x,s+=r.y),n.addPointAt(n.state,d.panningHandler.triggerX/a-i,d.panningHandler.triggerY/a-s)}}}),this.addAction("removeWaypoint",function(){var e=n.actions.get("removeWaypoint");null!=e.handler&&e.handler.removePoint(e.handler.state,e.index)}),this.addAction("image",function(){var e="",n=d.getView().getState(d.getSelectionCell());if(null!=n&&(e=n.style[mxConstants.STYLE_IMAGE]||e),null!=(e=mxUtils.prompt(mxResources.get("enterValue")+" ("+mxResources.get("url")+")",e))&&0<e.length){var t=new Image;t.onload=function(){!function(e,n,t){var a=null,i=d.getSelectionCells();d.getModel().beginUpdate();try{if(0==i.length){var s=d.getGridSize();a=i=[d.insertVertex(d.getDefaultParent(),null,"",s,s,n,t)]}if(d.setCellStyles(mxConstants.STYLE_IMAGE,e,i),d.setCellStyles(mxConstants.STYLE_SHAPE,"image",i),1==d.getSelectionCount()&&null!=n&&null!=t){var o=i[0],r=d.getModel().getGeometry(o);null!=r&&((r=r.clone()).width=n,r.height=t,d.getModel().setGeometry(o,r))}}finally{d.getModel().endUpdate()}null!=a&&(d.setSelectionCells(a),d.scrollCellToVisible(a[0]))}(e,t.width,t.height)},t.onerror=function(){mxUtils.alert(mxResources.get("fileNotFound"))},t.src=e}})},Actions.prototype.addAction=function(e,n,t,a,i){return this.put(e,new Action(mxResources.get(e),n,t,a,i))},Actions.prototype.put=function(e,n){return this.actions[e]=n},Actions.prototype.get=function(e){return this.actions[e]},mxUtils.extend(Action,mxEventSource),Action.prototype.setEnabled=function(e){this.enabled!=e&&(this.enabled=e,this.fireEvent(new mxEventObject("stateChanged")))},Action.prototype.setToggleAction=function(e){this.toggleAction=e},Action.prototype.setSelectedCallback=function(e){this.selectedCallback=e},Action.prototype.isSelected=function(){return this.selectedCallback()},Menus=function(e){this.editorUi=e,this.menus=new Object,this.init(),(new Image).src=IMAGE_PATH+"/checkmark.gif"},Menus.prototype.init=function(){var i=this.editorUi.editor.graph;this.put("fontFamily",new Menu(mxUtils.bind(this,function(e,n){for(var t=["Helvetica","Verdana","Times New Roman","Garamond","Comic Sans MS","Courier New","Georgia","Lucida Console","Tahoma"],a=0;a<t.length;a++){this.styleChange(e,t[a],[mxConstants.STYLE_FONTFAMILY],[t[a]],null,n).firstChild.nextSibling.style.fontFamily=t[a]}e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"",mxConstants.DEFAULT_FONTFAMILY,mxConstants.STYLE_FONTFAMILY,n)}))),this.put("fontSize",new Menu(mxUtils.bind(this,function(e,n){for(var t=[6,8,9,10,11,12,14,18,24,36,48,72],a=0;a<t.length;a++)this.styleChange(e,t[a],[mxConstants.STYLE_FONTSIZE],[t[a]],null,n);e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"(pt)","12",mxConstants.STYLE_FONTSIZE,n)}))),this.put("linewidth",new Menu(mxUtils.bind(this,function(e,n){for(var t=[1,2,3,4,8,12,16,24],a=0;a<t.length;a++)this.styleChange(e,t[a]+"px",[mxConstants.STYLE_STROKEWIDTH],[t[a]],null,n);e.addSeparator(n),this.promptChange(e,mxResources.get("custom"),"(px)","1",mxConstants.STYLE_STROKEWIDTH,n)}))),this.put("line",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("straight"),[mxConstants.STYLE_EDGE],[null],null,n),this.styleChange(e,mxResources.get("entityRelation"),[mxConstants.STYLE_EDGE],["entityRelationEdgeStyle"],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("horizontal"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","horizontal"],null,n),this.styleChange(e,mxResources.get("vertical"),[mxConstants.STYLE_EDGE,mxConstants.STYLE_ELBOW],["elbowEdgeStyle","vertical"],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("manual"),[mxConstants.STYLE_EDGE],["segmentEdgeStyle"],null,n),this.styleChange(e,mxResources.get("automatic"),[mxConstants.STYLE_EDGE],["orthogonalEdgeStyle"],null,n)}))),this.put("lineend",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_CLASSIC],null,n),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OPEN],null,n),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_BLOCK],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_OVAL],null,n),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND],null,n),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_ENDARROW],[mxConstants.ARROW_DIAMOND_THIN],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_ENDARROW],[mxConstants.NONE],null,n),e.addSeparator(n),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("endFill",!0)},n,null,!0),e.addSeparator(n),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_ENDSIZE,n)}))),this.put("linestart",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("classic"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_CLASSIC],null,n),this.styleChange(e,mxResources.get("openArrow"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OPEN],null,n),this.styleChange(e,mxResources.get("block"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_BLOCK],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("oval"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_OVAL],null,n),this.styleChange(e,mxResources.get("diamond"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND],null,n),this.styleChange(e,mxResources.get("diamondThin"),[mxConstants.STYLE_STARTARROW],[mxConstants.ARROW_DIAMOND_THIN],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("none"),[mxConstants.STYLE_STARTARROW],[mxConstants.NONE],null,n),e.addSeparator(n),e.addItem(mxResources.get("transparent"),null,function(){i.toggleCellStyles("startFill",!0)},n,null,!0),e.addSeparator(n),this.promptChange(e,mxResources.get("size"),"(px)",mxConstants.DEFAULT_MARKERSIZE,mxConstants.STYLE_STARTSIZE,n)}))),this.put("spacing",new Menu(mxUtils.bind(this,function(e,n){var t=this.editorUi.actions.get("shadow").enabled,a=this.get("line").enabled;(t||e.showDisabled)&&(this.promptChange(e,mxResources.get("top"),"(px)","0",mxConstants.STYLE_SPACING_TOP,n,t),this.promptChange(e,mxResources.get("right"),"(px)","0",mxConstants.STYLE_SPACING_RIGHT,n,t),this.promptChange(e,mxResources.get("bottom"),"(px)","0",mxConstants.STYLE_SPACING_BOTTOM,n,t),this.promptChange(e,mxResources.get("left"),"(px)","0",mxConstants.STYLE_SPACING_LEFT,n,t),e.addSeparator(n),this.promptChange(e,mxResources.get("global"),"(px)","0",mxConstants.STYLE_SPACING,n,t),this.promptChange(e,mxResources.get("perimeter"),"(px)","0",mxConstants.STYLE_PERIMETER_SPACING,n,t)),(a||e.showDisabled)&&(e.addSeparator(n),this.promptChange(e,mxResources.get("sourceSpacing"),"(px)","0",mxConstants.STYLE_SOURCE_PERIMETER_SPACING,n,a),this.promptChange(e,mxResources.get("targetSpacing"),"(px)","0",mxConstants.STYLE_TARGET_PERIMETER_SPACING,n,a))}))),this.put("format",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItem(e,"style",n)}))),this.put("text",new Menu(mxUtils.bind(this,function(e,n){var t=this.get("text").enabled;e.addSeparator(n),this.addSubmenu("fontFamily",e,n),this.addSubmenu("fontSize",e,n),this.addMenuItems(e,["-","bold","italic","underline","-"],n),this.addSubmenu("alignment",e,n),this.addMenuItem(e,"wordWrap",n),e.addSeparator(n),this.promptChange(e,mxResources.get("textOpacity"),"(%)","100",mxConstants.STYLE_TEXT_OPACITY,n,t),e.addItem(mxResources.get("hide"),null,function(){i.toggleCellStyles(mxConstants.STYLE_NOLABEL,!1)},n,null,t)}))),this.put("alignment",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("leftAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT],null,n),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER],null,n),this.styleChange(e,mxResources.get("rightAlign"),[mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("topAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP],null,n),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE],null,n),this.styleChange(e,mxResources.get("bottomAlign"),[mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM],null,n),e.addSeparator(n),this.addSubmenu("position",e,n),this.addSubmenu("spacing",e,n),e.addSeparator(n);var t=this.get("text").enabled;e.addItem(mxResources.get("vertical"),null,function(){i.toggleCellStyles(mxConstants.STYLE_HORIZONTAL,!0)},n,null,t)}))),this.put("position",new Menu(mxUtils.bind(this,function(e,n){this.styleChange(e,mxResources.get("left"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_LEFT,mxConstants.ALIGN_RIGHT],null,n),this.styleChange(e,mxResources.get("center"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_CENTER,mxConstants.ALIGN_CENTER],null,n),this.styleChange(e,mxResources.get("right"),[mxConstants.STYLE_LABEL_POSITION,mxConstants.STYLE_ALIGN],[mxConstants.ALIGN_RIGHT,mxConstants.ALIGN_LEFT],null,n),e.addSeparator(n),this.styleChange(e,mxResources.get("top"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_TOP,mxConstants.ALIGN_BOTTOM],null,n),this.styleChange(e,mxResources.get("middle"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_MIDDLE,mxConstants.ALIGN_MIDDLE],null,n),this.styleChange(e,mxResources.get("bottom"),[mxConstants.STYLE_VERTICAL_LABEL_POSITION,mxConstants.STYLE_VERTICAL_ALIGN],[mxConstants.ALIGN_BOTTOM,mxConstants.ALIGN_TOP],null,n)}))),this.put("direction",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("flipH"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPH,!1)},n),e.addItem(mxResources.get("flipV"),null,function(){i.toggleCellStyles(mxConstants.STYLE_FLIPV,!1)},n),this.addMenuItems(e,["-","tilt","rotation"],n)}))),this.put("align",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("leftAlign"),null,function(){i.alignCells(mxConstants.ALIGN_LEFT)},n),e.addItem(mxResources.get("center"),null,function(){i.alignCells(mxConstants.ALIGN_CENTER)},n),e.addItem(mxResources.get("rightAlign"),null,function(){i.alignCells(mxConstants.ALIGN_RIGHT)},n),e.addSeparator(n),e.addItem(mxResources.get("topAlign"),null,function(){i.alignCells(mxConstants.ALIGN_TOP)},n),e.addItem(mxResources.get("middle"),null,function(){i.alignCells(mxConstants.ALIGN_MIDDLE)},n),e.addItem(mxResources.get("bottomAlign"),null,function(){i.alignCells(mxConstants.ALIGN_BOTTOM)},n)}))),this.put("layout",new Menu(mxUtils.bind(this,function(e,n){e.addItem(mxResources.get("horizontalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_WEST);this.editorUi.executeLayout(e,!0,!0)}),n),e.addItem(mxResources.get("verticalFlow"),null,mxUtils.bind(this,function(){var e=new mxHierarchicalLayout(i,mxConstants.DIRECTION_NORTH);this.editorUi.executeLayout(e,!0,!0)}),n)}))),this.put("navigation",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["home","-","exitGroup","enterGroup","-","expand","collapse"],n)}))),this.put("arrange",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["toFront","toBack","-"],n),this.addSubmenu("layout",e,n),e.addSeparator(n),this.addMenuItems(e,["-","group","ungroup","removeFromGroup"],n)}))),this.put("view",new Menu(mxUtils.bind(this,function(n,t){this.addMenuItems(n,["actualSize"],t),n.addSeparator();for(var e=[.25,.5,.75,1,2,4],a=0;a<e.length;a++)!function(e){n.addItem(100*e+"%",null,function(){i.zoomTo(e)},t)}(e[a]);this.addMenuItems(n,["-","zoomIn","zoomOut","-","fitWindow","customZoom","-","fitPage","fitPageWidth"],t)}))),this.put("file",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["new","open","-","save","saveAs","publish","-","variable","-","import","export","-","editFile","description","-","print"],n)}))),this.put("edit",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["undo","redo","-","cut","copy","paste","delete","-","duplicate","-","selectVertices","selectEdges","selectAll"])}))),this.put("help",new Menu(mxUtils.bind(this,function(e,n){this.addMenuItems(e,["help","-","about"])})))},Menus.prototype.put=function(e,n){this.menus[e]=n},Menus.prototype.get=function(e){return this.menus[e]},Menus.prototype.addSubmenu=function(e,n,t){var a=this.get(e).enabled;if(n.showDisabled||a){var i=n.addItem(mxResources.get(e),null,null,t,null,a);this.addMenu(e,n,i)}},Menus.prototype.addMenu=function(e,n,t){var a=this.get(e);null!=a&&(n.showDisabled||a.enabled)&&this.get(e).execute(n,t)},Menus.prototype.styleChange=function(e,n,t,a,i,s){return e.addItem(n,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph;e.getModel().beginUpdate();try{for(var n=0;n<t.length;n++)e.setCellStyles(t[n],a[n])}finally{e.getModel().endUpdate()}}),s,i)},Menus.prototype.promptChange=function(e,n,a,i,s,t,o){return e.addItem(n,null,mxUtils.bind(this,function(){var e=this.editorUi.editor.graph,n=i,t=e.getView().getState(e.getSelectionCell());null!=t&&(n=t.style[s]||n),null!=(n=mxUtils.prompt(mxResources.get("enterValue")+(0<a.length?" "+a:""),n))&&0<n.length&&e.setCellStyles(s,n)}),t,null,o)},Menus.prototype.addMenuItem=function(e,n,t){var a=this.editorUi.actions.get(n);if(null==a||!e.showDisabled&&!a.enabled)return null;var i=e.addItem(a.label,null,a.funct,t,null,a.enabled);return a.toggleAction&&a.isSelected()&&this.addCheckmark(i),this.addShortcut(i,a),i},Menus.prototype.addShortcut=function(e,n){if(null!=n.shortcut){var t=e.firstChild.nextSibling.nextSibling,a=document.createElement("span");a.style.color="gray",mxUtils.write(a,n.shortcut),t.appendChild(a)}},Menus.prototype.addCheckmark=function(e){var n=e.firstChild.nextSibling;n.style.backgroundImage="url("+IMAGE_PATH+"/checkmark.gif)",n.style.backgroundRepeat="no-repeat",n.style.backgroundPosition="2px 50%"},Menus.prototype.addMenuItems=function(e,n,t){for(var a=0;a<n.length;a++)"-"==n[a]?e.addSeparator(t):this.addMenuItem(e,n[a],t)},Menus.prototype.createPopupMenu=function(e,n,t){var a=this.editorUi.editor.graph;if(e.smartSeparators=!0,a.isSelectionEmpty()?this.addMenuItems(e,["undo","redo","-","paste","-"]):(this.addMenuItems(e,["delete","-","cut","copy","-","duplicate"]),1==a.getSelectionCount()&&a.getModel().isEdge(a.getSelectionCell())&&this.addMenuItems(e,["setAsDefaultEdge"]),e.addSeparator()),0<a.getSelectionCount()){if(this.addMenuItems(e,["toFront","toBack","-"]),a.getModel().isEdge(a.getSelectionCell())){var i=!1;if(null!=(n=a.getSelectionCell())&&a.getModel().isEdge(n)){var s=a.selectionCellsHandler.getHandler(n);if(s instanceof mxEdgeHandler&&null!=s.bends&&2<s.bends.length){var o=s.getHandleForEvent(new mxMouseEvent(t)),r=this.editorUi.actions.get("removeWaypoint");r.handler=s,i=0<(r.index=o)&&o<s.bends.length}}this.addMenuItems(e,["-",i?"removeWaypoint":"addWaypoint"])}else 1<a.getSelectionCount()&&(e.addSeparator(),this.addMenuItems(e,["group"]));if(e.addSeparator(),1==a.getSelectionCount())null!=a.getLinkForCell(a.getSelectionCell())&&this.addMenuItems(e,["openLink"])}else this.addMenuItems(e,["-","selectVertices","selectEdges","-","selectAll"])},Menus.prototype.createMenubar=function(e){var n=new Menubar(this.editorUi,e),t=[];t=CRUD_PERMISSIONS.canEdit?["file","edit","view","format","text","arrange","help"]:["file","view","help"];for(var a=0;a<t.length;a++)n.addMenu(mxResources.get(t[a]),this.get(t[a]).funct);return n},Menubar.prototype.hideMenu=function(){null!=this.currentMenu&&this.currentMenu.hideMenu()},Menubar.prototype.addMenu=function(e,n){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.className="geItem",mxUtils.write(t,e),this.addMenuHandler(t,n),this.container.appendChild(t),t},Menubar.prototype.getOffset=function(e){return{left:(e=e.getBoundingClientRect()).left+window.scrollX,top:e.top+window.scrollY}},Menubar.prototype.addMenuHandler=function(i,s){if(null!=s){var o=!0,n=mxUtils.bind(this,function(e){if(o&&null==i.enabled||i.enabled){this.editorUi.editor.graph.panningHandler.hideMenu();var n=new mxPopupMenu(s);n.div.className+=" geMenubarMenu",n.smartSeparators=!0,n.showDisabled=!0,n.autoExpand=!0,n.hideMenu=mxUtils.bind(this,function(){mxPopupMenu.prototype.hideMenu.apply(n,arguments),n.destroy(),this.currentMenu=null,this.currentElt=null});var t=this.getOffset(i).left,a=this.getOffset(i).top+i.offsetHeight;n.popup(t,a,null,e),this.currentMenu=n,this.currentElt=i}o=!0,mxEvent.consume(e)});mxEvent.addListener(i,"mousemove",mxUtils.bind(this,function(e){null!=this.currentMenu&&this.currentElt!=i&&(this.hideMenu(),n(e))})),mxEvent.addListener(i,"mousedown",mxUtils.bind(this,function(){o=this.currentElt!=i})),mxEvent.addListener(i,"click",n)}},mxUtils.extend(Menu,mxEventSource),Menu.prototype.setEnabled=function(e){this.enabled!=e&&(this.enabled=e,this.fireEvent(new mxEventObject("stateChanged")))},Menu.prototype.execute=function(e,n){this.funct(e,n)},Toolbar.prototype.init=function(){CRUD_PERMISSIONS.canEdit?this.addItems(["save","publish","-","print","undo","redo","-","copy","cut","paste","delete","-","duplicate","-","actualSize","zoomIn","zoomOut","-"]):this.addItems(["print","actualSize","zoomIn","zoomOut","-"])},Toolbar.prototype.hideMenu=function(){null!=this.currentMenu&&(this.currentMenu.hideMenu(),this.currentMenu.destroy(),this.currentMenu=null)},Toolbar.prototype.addMenu=function(e,n,t,a){var i=this.editorUi.menus.get(a),s=this.addMenuFunction(e,n,t,i.funct);return i.addListener("stateChanged",function(){s.setEnabled(i.enabled)}),s},Toolbar.prototype.addMenuFunction=function(e,n,t,a){var i=t?this.createLabel(e):this.createButton(e);return this.initElement(i,n),this.addMenuHandler(i,t,a),this.container.appendChild(i),i},Toolbar.prototype.addSeparator=function(){var e=document.createElement("div");return e.className="geSeparator",this.container.appendChild(e),e},Toolbar.prototype.addItems=function(e){for(var n=0;n<e.length;n++){var t=e[n];"-"==t?this.addSeparator():this.addItem("geSprite-"+t.toLowerCase(),t)}},Toolbar.prototype.addItem=function(e,n){var t=this.editorUi.actions.get(n),a=null;return null!=t&&((a=this.addButton(e,t.label,t.funct)).setEnabled(t.enabled),t.addListener("stateChanged",function(){a.setEnabled(t.enabled)})),a},Toolbar.prototype.addButton=function(e,n,t){var a=this.createButton(e);return this.initElement(a,n),this.addClickHandler(a,t),this.container.appendChild(a),a},Toolbar.prototype.addSelectionHandler=function(t){var a=this.editorUi.editor.graph,e=function(){for(var e=!a.isSelectionEmpty(),n=0;n<t.length;n++)t[n].setEnabled(e)};a.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.addEdgeSelectionHandler=function(a){var i=this.editorUi.editor.graph,e=function(){var e=!1;if(!i.isSelectionEmpty())for(var n=i.getSelectionCells(),t=0;t<n.length;t++)if(i.getModel().isEdge(n[t])){e=!0;break}for(t=0;t<a.length;t++)a[t].setEnabled(e)};i.getSelectionModel().addListener(mxEvent.CHANGE,e),e()},Toolbar.prototype.initElement=function(e,n){e.setAttribute("tabindex","0"),null!=n&&e.setAttribute("title",n),this.addEnabledState(e)},Toolbar.prototype.addEnabledState=function(n){var t=n.className;n.setEnabled=function(e){n.enabled=e,n.className=e?t:t+" geDisabled"},n.setEnabled(!0)},Toolbar.prototype.addClickHandler=function(n,t){null!=t&&mxEvent.addListener(n,"click",function(e){n.enabled&&t(e),mxEvent.consume(e)})},Toolbar.prototype.createButton=function(e){var n=document.createElement("a");n.setAttribute("href","javascript:void(0);"),n.className="geButton";var t=document.createElement("div");return t.className="geSprite "+e,n.appendChild(t),n},Toolbar.prototype.createLabel=function(e,n){var t=document.createElement("a");return t.setAttribute("href","javascript:void(0);"),t.className="geLabel",mxUtils.write(t,e),t},Toolbar.prototype.addMenuHandler=function(n,t,a,i){if(null!=a){var s=this.editorUi.editor.graph,o=null;mxEvent.addListener(n,"click",mxUtils.bind(this,function(e){(null==n.enabled||n.enabled)&&(s.panningHandler.hideMenu(),(o=new mxPopupMenu(a)).div.className+=" geToolbarMenu",o.showDisabled=i,o.labels=t,o.autoExpand=!0,o.popup(n.offsetLeft,n.offsetTop+n.offsetHeight+34,null,e),this.currentMenu=o),mxEvent.consume(e)}))}},Dialog.prototype.close=function(){null!=this.onDialogClose&&(this.onDialogClose(),this.onDialogClose=null),this.container.parentNode.removeChild(this.container),this.bg.parentNode.removeChild(this.bg)},angular.module("motion").run(["$templateCache",function(e){"use strict";e.put("app/auth/services/hotdesk/dialog.html",'<md-dialog aria-label="Telephone">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="LOGIN.TELEPHONES">Telephones</span>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-select ng-model="vm.name" placeholder="Select a telephone">\n        <md-option value="{{telephone.name}}" ng-repeat="telephone in vm.telephones.rows">{{telephone.fullname}}</md-option>\n      </md-select>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.closeDialog(vm.name)" class="send-button md-accent md-raised" aria-label="call" ng-disabled="!vm.name">\n        <span translate="LOGIN.SELECT">SELECT</span>\n      </md-button>\n      \x3c!-- <md-button ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="cancel">\n                <span translate="LOGIN.CANCEL">Cancel</span>\n            </md-button> --\x3e\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/dialogs/advanced-search/dialog.html",'<md-dialog class="advanced-search-dialog" aria-label="Advanced search" flex="70" ng-init="vm.onInit()">\n  <form ng-cloak>\n    <md-toolbar class="advanced-search-dialog-header" ng-class="{{ \'vm.toolbarColor\' }} + \'-bg\'">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="DASHBOARDS.ADVANCED_SEARCH"></span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.minimize()">\n            <md-icon class="no-margin" md-font-icon="icon-window-minimize" aria-label="Minimize dialog"></md-icon>\n          </md-button>\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.close()">\n            <md-icon class="no-margin" md-font-icon="icon-window-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <ms-advanced-search options="vm.searchOptions" clear-filter="vm.clearConditions()"></ms-advanced-search>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button class="md-primary md-raised" aria-label="Clear" ng-disabled="vm.searchOptions.conditions.length === 0" translate="DASHBOARDS.CLEAR" translate-attr-aria-label="DASHBOARDS.CLEAR" ng-click="vm.clearConditions()"></md-button>\n      <md-button class="md-primary md-accent md-raised" aria-label="Apply" ng-disabled="vm.searchOptions.conditions.length === 0" translate="DASHBOARDS.APPLY" translate-attr-aria-label="DASHBOARDS.APPLY" ng-click="vm.applyFilter()"></md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/directives/ms-advanced-search/ms-advanced-search.html",'<div layout="column" class="advanced-search-container" flex>\n  <div layout-margin>\n    <md-radio-group ng-model="vm.options.matchType" class="md-primary" layout="row">\n      <md-radio-button value="$and" class="md-primary">{{ \'DASHBOARDS.MEET_ALL_CONDITIONS\' | translate }}\n      </md-radio-button>\n      <md-radio-button value="$or">{{ \'DASHBOARDS.MEET_ANY_CONDITIONS\' | translate }}</md-radio-button>\n    </md-radio-group>\n  </div>\n\n  \x3c!-- ACTIVE CONDITIONS --\x3e\n  <div layout="row" ng-if="vm.options.conditions.length > 0" class="advanced-search-conditions">\n    <md-list>\n      <md-list-item>\n        <md-chips ng-model="vm.options.conditions" class="advanced-search-chips" readonly="true" md-removable="true" md-on-remove="vm.removeCondition()">\n          <md-chip-template ms-chip-color="{{ $chip.style }}">\n            <md-menu md-offset="50 0" ng-class="{\'no-click\': vm.pendingCondition}">\n              <span>\n                <p class="filter-text">{{ $chip.name }}</p>\n                <em ng-show="$chip.operator" class="text-lowercase">{{ $chip.operator }}</em>\n                <strong>{{ $chip.displayValue }}</strong>\n                <em ng-show="$chip.displayEndValue" class="text-lowercase">{{ \'DASHBOARDS.AND\' | translate }}</em>\n                <strong>{{ $chip.displayEndValue }}</strong>\n              </span>\n              <md-menu-content width=2 class="md-dense">\n                <md-menu-item ng-hide="$chip.disabled">\n                  <md-button ng-click="vm.editCondition($chip)">Edit\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.setConditionStatus($chip)">\n                    {{ $chip.disabled ? \'Enable\' : \'Disable\' }}\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </md-chip-template>\n          <button type="button" md-chip-remove class="md-primary remove-filter">\n            <md-icon md-font-icon="icon-cancel" aria-label="Remove Filter"></md-icon>\n          </button>\n        </md-chips>\n      </md-list-item>\n    </md-list>\n  </div>\n\n  \x3c!-- FILTERS --\x3e\n  <div layout="row">\n    <div layout="row" class="advanced-search-bar" layout-margin flex>\n      \x3c!-- FIELD --\x3e\n      <md-input-container flex="35">\n        <md-icon md-font-icon="icon-filter-variant"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.selectedField" ng-change="vm.onFieldChange()" placeholder="{{ \'DASHBOARDS.SELECT_FIELD\' | translate }}" aria-label="Field">\n          <md-option ng-value="field" ng-repeat="field in vm.options.fields">{{ field.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- OPERATOR --\x3e\n      <md-input-container flex="30">\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.selectedOperator" ng-change="vm.onOperatorChange(oldValue)" ng-focus="oldValue=vm.selectedOperator" md-selected-text="vm.selectedOperator ? (\'DASHBOARDS.\' + vm.selectedOperator.translate | translate) : (\'DASHBOARDS.SELECT_OPERATOR\' | translate)" ng-disabled="!vm.selectedField" aria-label="Operator">\n          <md-option ng-value="operator" ng-repeat="operator in vm.availableOperators" ng-selected="vm.autoSelectOperator">\n            <div layout="row" class="operators-list">\n              <span class="operator-symbol">\n                {{ operator.symbol }}\n              </span>\n              <span>\n                {{ \'DASHBOARDS.\' + operator.translate | translate }}\n              </span>\n            </div>\n          </md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TEXT INPUT --\x3e\n      <md-input-container ng-if="!vm.selectedField.type || vm.selectedField.type === \'text\'" class="no-errors" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <input type="text" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}">\n      </md-input-container>\n      \x3c!-- NUMERIC INPUT --\x3e\n      <div ng-if="vm.selectedField.type === \'number\'" flex layout="row" layout-margin class="no-margin">\n        <md-input-container class="no-errors" flex>\n          <md-icon md-font-icon="icon-numeric"></md-icon>\n          <input type="number" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" min="0" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ vm.selectedOperator.type === \'$between\' ? \'DASHBOARDS.STARTING_VALUE\' : \'DASHBOARDS.VALUE\' | translate }}">\n        </md-input-container>\n        <md-input-container class="no-errors" ng-if="vm.selectedOperator.type === \'$between\'" ng-class="{\'md-input-invalid\': !vm.isValidRange}" flex>\n          <md-icon md-font-icon=" icon-numeric">\n          </md-icon>\n          <input class="md-input" type="number" aria-label="Value" ng-model="vm.endRangeValue" ng-change="vm.checkRange()" ng-disabled="!vm.value" min="vm.value" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.ENDING_VALUE\' | translate }}">\n          <div ng-if="!vm.isValidRange" class="md-input-message-animation md-input-messages-animation">\n            {{ (\'DASHBOARDS.VALUE_RANGE_CHECK\' | translate) + \' \' + vm.value }}\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- SELECT --\x3e\n      <md-input-container ng-if="vm.selectedField.type === \'select\'" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" ng-model="vm.value" md-on-open="vm.getValues()" ng-change="vm.onValueChange()" ng-model-options="{trackBy: \'$value.id\'}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}" aria-label="Value">\n          <md-option ng-value="item" ng-repeat="item in vm.selectedField.values">{{item.name}}\n          </md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- MULTISELECT --\x3e\n      <md-input-container ng-if="vm.selectedField.type === \'multiselect\'" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-select class="font-size-12" multiple ng-model="vm.value" md-on-open="vm.getValues()" ng-change="vm.onValueChange()" ng-model-options="{trackBy: \'$value.id\'}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}" aria-label="Value">\n          <md-option ng-value="item" ng-repeat="item in vm.selectedField.values">{{item.name}}\n          </md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- DATE INPUT --\x3e\n      <div ng-if="vm.selectedField.type === \'date\'" flex layout="row">\n        <mdp-date-picker mdp-open-on-click ng-model="vm.value" ng-change="vm.onValueChange()" mdp-max-date="vm.maxDateRange" mdp-placeholder="{{ vm.selectedOperator.type === \'$between\' ? \'DASHBOARDS.STARTING_DATE\' : \'DASHBOARDS.VALUE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n        </mdp-date-picker>\n        <mdp-date-picker mdp-open-on-click ng-if="vm.selectedOperator.type === \'$between\'" ng-change="vm.checkRange()" ng-model="vm.endRangeValue" mdp-min-date="vm.minDateRange" mdp-disabled="!vm.value" mdp-placeholder="{{ \'DASHBOARDS.ENDING_DATE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n        </mdp-date-picker>\n      </div>\n      \x3c!-- AUTOCOMPLETE --\x3e\n      <div layout="row" layout-align="start start" ng-if="vm.selectedField.type === \'autocomplete\' && vm.selectedOperator.type != \'$substring\'" class=" autocomplete-input" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <md-autocomplete md-selected-item="vm.value" md-selected-item-change="vm.onValueChange()" md-items="item in vm.getValues()" md-search-text="vm.searchText" md-item-text="item.displayValue" md-min-length="4" md-no-cache="true" md-floating-label="{{ \'DASHBOARDS.VALUE\' | translate }}" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" flex>\n          <md-item-template>\n            <span md-highlight-text="vm.searchText" md-highlight-flags="i">{{item.displayValue}}</span>\n          </md-item-template>\n        </md-autocomplete>\n      </div>\n      <md-input-container ng-if="vm.selectedField.type === \'autocomplete\' && vm.selectedOperator.type === \'$substring\'" class="no-errors" flex>\n        <md-icon md-font-icon="icon-format-text"></md-icon>\n        <input type="text" aria-label="Value" ng-model="vm.value" ng-change="vm.onValueChange()" ng-disabled="!vm.selectedField" ng-keydown="$event.keyCode == 13 && vm.isValidCondition && vm.handleKeyboardAction()" placeholder="{{ \'DASHBOARDS.VALUE\' | translate }}">\n      </md-input-container>\n    </div>\n    <md-button class="md-fab md-mini md-primary mt-20" ng-if="!vm.pendingCondition" ng-disabled="!vm.isValidCondition" aria-label="Add filter" ng-click="vm.addCondition()" translate-attr-aria-label="DASHBOARDS.ADD">\n      <md-icon md-font-icon="icon-plus"></md-icon>\n    </md-button>\n    <md-button class="md-fab md-mini mt-20" ng-if="vm.pendingCondition" ng-disabled="!vm.isValidCondition" aria-label="Update filter" ng-click="vm.updateCondition()" translate-attr-aria-label="DASHBOARDS.UPDATE">\n      <md-icon md-font-icon="icon-check"></md-icon>\n    </md-button>\n    <md-button class="md-fab md-mini md-primary mt-20" ng-if="vm.pendingCondition" aria-label="Cancel filter update" ng-click="vm.cancelUpdateCondition()" translate-attr-aria-label="DASHBOARDS.CANCEL">\n      <md-icon md-font-icon="icon-close"></md-icon>\n    </md-button>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-1/template-1.html",'<div class="template-1">\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="content pv-24 ph-16">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="text pt-16" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-10/template-10.html",'<div class="template-10 p-16">\n  <div class="pb-16" layout="row" layout-align="space-between center">\n    <div class="info">\n      <div class="title secondary-text" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h2" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n\n    <div class="media ml-16">\n      <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n    </div>\n  </div>\n\n  <div class="text">\n    {{card.text}}\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-2/template-2.html",'<div class="template-2">\n  <div class="header p-16" layout="row" layout-align="start center">\n    <div ng-if="card.avatar">\n      <img class="avatar mr-16" ng-src="{{card.avatar.src}}" alt="{{card.avatar.alt}}">\n    </div>\n\n    <div class="info">\n      <div class="title" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="text p-16" ng-if="card.text">\n    {{card.text}}\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-3/template-3.html",'<div class="template-3 p-16 teal-bg white-fg" layout="row" layout-align="space-between">\n  <div layout="column" layout-align="space-between">\n    <div class="info">\n      <div class="title h1" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h3 secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n    </div>\n\n    <div class="cta">\n      <md-button class="m-0">{{card.cta}}</md-button>\n    </div>\n  </div>\n\n  <div class="media pl-16">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-4/template-4.html",'<div class="template-4">\n  <div class="info white-fg ph-16 pv-24">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="text" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-5/template-5.html",'<div class="template-5 p-16" layout="row" layout-align="space-between start">\n  <div class="info">\n    <div class="title secondary-text" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="event h2" ng-if="card.event">\n      {{card.event}}\n    </div>\n  </div>\n\n  <div class="media ml-16">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-6/template-6.html",'<div class="template-6">\n  <div class="content pv-24 ph-16">\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="title h2" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="text pt-8" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-7/template-7.html",'<div class="template-7" layout="row" layout-align="space-between">\n  <div class="info" layout="column" layout-align="space-between" layout-fill flex>\n    <div class="p-16">\n      <div class="title h1" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle h4 secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n\n      <div class="text h4 pt-8" ng-if="card.text">\n        {{card.text}}\n      </div>\n    </div>\n\n    <div>\n      <md-divider></md-divider>\n      <div class="p-8" layout="row">\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n        <md-icon md-font-icon="icon-star-outline" class="mh-5"></md-icon>\n      </div>\n    </div>\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-8/template-8.html",'<div class="template-8">\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="content pv-24 ph-16">\n    <div class="title h1" ng-if="card.title">\n      {{card.title}}\n    </div>\n\n    <div class="subtitle secondary-text" ng-if="card.subtitle">\n      {{card.subtitle}}\n    </div>\n\n    <div class="buttons pt-16">\n      <md-button class="m-0">{{card.button1}}</md-button>\n      <md-button class="m-0 md-accent">{{card.button2}}</md-button>\n    </div>\n\n    <div class="text pt-16" ng-if="card.text">\n      {{card.text}}\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-card/templates/template-9/template-9.html",'<div class="template-9">\n  <div class="header p-16" layout="row" layout-align="start center">\n    <div ng-if="card.avatar">\n      <img class="avatar mr-16" ng-src="{{card.avatar.src}}" alt="{{card.avatar.alt}}">\n    </div>\n\n    <div class="info">\n      <div class="title" ng-if="card.title">\n        {{card.title}}\n      </div>\n\n      <div class="subtitle secondary-text" ng-if="card.subtitle">\n        {{card.subtitle}}\n      </div>\n\n    </div>\n  </div>\n\n  <div class="text ph-16 pb-16" ng-if="card.text">\n    {{card.text}}\n  </div>\n\n  <div class="media">\n    <img class="image" ng-src="{{card.media.image.src}}" alt="{{card.media.image.alt}}" ng-show="card.media.image">\n  </div>\n\n  <div class="buttons m-8">\n    <md-button class="md-icon-button mr-16" aria-label="Favorite">\n      <md-icon md-font-icon="icon-heart-outline" class="s24"></md-icon>\n    </md-button>\n    <md-button class="md-icon-button" aria-label="Share">\n      <md-icon md-font-icon="icon-share" class="s24"></md-icon>\n    </md-button>\n  </div>\n\n</div>'),e.put("app/core/directives/ms-click-to-call/ms-click-to-call.html",'<section ng-if="type !== \'button\'">\n  <span ng-if="!showMenu()" privacy="{{ privacy }}" ng-cloak>{{target}}</span>\n  <md-menu ng-if="showMenu()">\n    <a aria-label="Target" ng-click="$mdOpenMenu($event)">\n      <span ng-if="prefix" privacy="{{ privacy }}" ng-cloak>{{prefix}}-</span>\n      <span privacy="{{ privacy }}" ng-cloak>{{target}}</span>\n    </a>\n    <md-menu-content width="2">\n      <md-menu-item>\n        <md-button ng-click="call(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.CALL_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n      <md-menu-item>\n        <md-button ng-click="transfer(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n    </md-menu-content>\n  </md-menu>\n</section>\n<section ng-if="type === \'button\'">\n  <md-button ng-if="!showMenu()" ng-disabled="true" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW CALL" aria-label="NEW CALL">\n    <md-icon md-font-icon="icon-phone"></md-icon>\n  </md-button>\n  <md-menu ng-if="showMenu()">\n    <md-button class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW CALL" ng-click="$mdOpenMenu($event)" aria-label="NEW CALL">\n      <md-icon md-font-icon="icon-phone"></md-icon>\n    </md-button>\n    <md-menu-content width="2">\n      <md-menu-item>\n        <md-button ng-click="call(prefix ? prefix + target : target)">\n          {{\'DASHBOARDS.CALL_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n      <md-menu-item>\n        <md-button ng-click="transfer(target)">\n          {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} (<span privacy="{{ privacy }}" ng-cloak>{{prefix ? prefix + \'-\' + target : target}}</span>)\n        </md-button>\n      </md-menu-item>\n    </md-menu-content>\n  </md-menu>\n</section>'),e.put("app/core/directives/ms-client-side-logging/ms-client-side-logging-icon.html",'<md-icon ng-style="vm.styleColor" md-font-icon="{{ vm.styleIcon }}">\n  <md-tooltip class="client-side-logging-tooltip">\n    <span ng-bind-html="vm.tooltipHTML"></span>\n  </md-tooltip>\n</md-icon>'),e.put("app/core/directives/ms-client-side-logging/ms-client-side-logging.html",'<md-content layout="column">\n  <form name="clientSideLoggingSettingsForm">\n    <div flex layout="column" layout-align="stretch center">\n      <div ng-if="vm.user.userSetting.clientSideLoggingEnabled" class="md-amber-500-bg p-10" layout="row" layout-align="start center">\n        <span class="no-margin font-size-14 line-height-30" translate="STAFF.CLIENT_LOGS_ALL_ENABLED_WARNING" flex></span>\n      </div>\n      <md-input-container>\n        <md-switch ng-model="vm.user.userSetting.clientSideLoggingEnabled" aria-label="Manage client side logging" ng-change="vm.onEnabledSwitchChange()">\n          {{ vm.user.userSetting.clientSideLoggingEnabled ? \'STAFF.CLIENT_LOGS_ENABLED\' : \'STAFF.CLIENT_LOGS_DISABLED\' | translate }}\n        </md-switch>\n      </md-input-container>\n      <h2 ng-if="vm.user.userSetting.clientSideLoggingEnabled" class="md-subhead mt-0">{{ vm.clientSideLoggingEnabledSince }}</h2>\n    </div>\n    <div layout="column" layout-align="stretch center">\n      <md-input-container ng-if="vm.user.userSetting.clientSideLoggingEnabled">\n        <label>{{ \'STAFF.CLIENT_LOGS_LOGLEVEL_SELECT\' | translate }}</label>\n        <md-select ng-if="vm.user.userSetting.clientSideLoggingEnabled" ng-model="vm.user.userSetting.clientSideLoggingLevel" placeholder="Debugging level" ng-change="vm.onLogLevelSelectionChange()" flex="30">\n          <md-option ng-value="loggingLevel" ng-repeat="loggingLevel in vm.availableClientSideLoggingLevels">\n            <md-icon ng-style="vm.computeStyleForLoggingLevel(loggingLevel)" md-font-icon="{{ loggingLevel === \'info\' ? \'icon-checkbox-blank-circle-outline\' : \'icon-checkbox-blank-circle\' }}"></md-icon>\n            {{ loggingLevel }}\n          </md-option>\n        </md-select>\n      </md-input-container>\n    </div>\n  </form>\n</md-content>'),e.put("app/core/directives/ms-dual-multiselect/ms-dual-multiselect.html",'<div ng-cloak layout-gt-sm="row" layout="column">\n  <div flex-gt-sm="50" flex="45">\n    <md-input-container class="md-icon-float md-block margin-0">\n      <md-icon md-font-icon="icon-magnify" aria-label="swap"></md-icon>\n      <input ng-model="query" type="text" placeholder="{{ \'STAFF.PERMISSIONS_PLACEHOLDER_SEARCH\' | translate }}">\n    </md-input-container>\n    <md-content class="border h-300">\n      <md-list class="md-dense no-padding" layout-fill layout-align="center center">\n        <md-list-item class="md-3-line" ng-class="{\'read-only-mode\': vm.readOnly || vm.addDisabled}" ng-disabled="vm.readOnly || vm.addDisabled" ng-repeat="item in availableItems = (vm.options.items | filter: query) | orderBy: vm.options.orderBy" ng-click="vm.canTransfer(item, vm.options, false)">\n          <div class="md-list-item-text" layout="column">\n            <h3 ng-if="vm.options.line1">{{vm.getLine(item, vm.options.line1)}}</h3>\n            <h4 ng-if="vm.options.line2">{{vm.getLine(item, vm.options.line2)}}</h4>\n            <p ng-if="vm.options.line3">{{vm.getLine(item, vm.options.line3)}}</p>\n            <p class="ms-dual-multiselect-line-xs" ng-if="vm.options.line4">{{vm.getLine(item, vm.options.line4)}}\n            </p>\n          </div>\n          <md-icon ng-hide="vm.readOnly && !vm.addDisabled" ng-class="{\'add-disabled\': vm.addDisabled}" md-font-icon="icon-arrow-right-bold" aria-label="swap">\n          </md-icon>\n          <md-divider></md-divider>\n        </md-list-item>\n      </md-list>\n    </md-content>\n    <div class="margin-10" layout="row">\n      <span class="h4" flex>{{vm.options.labelAll || \'All Items\'}} ({{availableItems.length}})</span>\n      <md-icon ng-hide="vm.options.showSelectAndDeselectAll === false || vm.readOnly" ng-class="{\'add-disabled\': vm.addDisabled}" ng-disabled="vm.addDisabled" md-font-icon="icon-chevron-double-right" aria-label="swap" ng-click="vm.transfer(vm.options.items, vm.options.selectedItems, -1, false)"></md-icon>\n    </div>\n  </div>\n\n  <div flex="10" layout="row" layout-align="center center">\n    <md-icon md-font-icon="icon-swap-horizontal" aria-label="swap"></md-icon>\n  </div>\n\n  <div flex-gt-sm="50" flex="45">\n    <md-input-container class="md-icon-float md-block margin-0">\n      <md-icon md-font-icon="icon-magnify" aria-label="swap"></md-icon>\n      <input ng-model="selectedQuery" type="text" placeholder="{{ \'STAFF.PERMISSIONS_PLACEHOLDER_SEARCH\' | translate }}">\n    </md-input-container>\n    <md-content class="border h-300">\n      <md-list class="md-dense no-padding" layout-fill layout-align="center center">\n        <md-list-item class="md-3-line" ng-class="{\'read-only-mode\': vm.readOnly || !item.isValid}" ng-disabled="vm.readOnly" ng-repeat="item in associatedItems = (vm.options.selectedItems | filter: selectedQuery) | orderBy: vm.options.orderBy" ng-click="vm.canTransfer(item, vm.options, true)">\n          <md-icon ng-class="{\'hidden\': vm.readOnly || !item.isValid}" md-font-icon="icon-arrow-left-bold" aria-label="swap"></md-icon>\n          <div class="md-list-item-text" layout="column">\n            <h3 ng-if="vm.options.line1">{{vm.getLine(item, vm.options.line1)}}</h3>\n            <h4 ng-if="vm.options.line2">{{vm.getLine(item, vm.options.line2)}}</h4>\n            <p ng-if="vm.options.line3">{{vm.getLine(item, vm.options.line3)}}</p>\n            <p class="ms-dual-multiselect-line-xs" ng-if="vm.options.line4">{{vm.getLine(item, vm.options.line4)}}\n            </p>\n          </div>\n          <md-divider></md-divider>\n        </md-list-item>\n      </md-list>\n    </md-content>\n    <div class="margin-10" layout="row">\n      <md-icon ng-hide="vm.options.showSelectAndDeselectAll === false || vm.readOnly" md-font-icon="icon-chevron-double-left" aria-label="swap" ng-click="vm.transfer(vm.options.selectedItems, vm.options.items, -1, true)"></md-icon>\n      <span class="h4 text-right" flex>{{vm.options.labelSelected || \'Selected Items\'}}\n        ({{associatedItems.length}})</span>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-font-family/ms-font-family.html",'<md-select ng-model="ngModel" class="no-margin">\n  <md-option ng-repeat="font in fonts" ng-value="font.value"><span ng-style="{\'font-family\': font.value}">{{font.option}}</span>\n  </md-option>\n</md-select>'),e.put("app/core/directives/ms-info-bar/ms-info-bar.html",'<div id="ms-info-bar" layout="row" layout-align="start center" flex>\n  <div id="ms-info-bar-message" ng-transclude flex></div>\n  <md-button id="ms-info-bar-close" class="md-icon-button" aria-label="Close" ng-click="removeInfoBar()">\n    <md-icon md-font-icon="icon-close s20"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-material-color-picker/ms-material-color-picker.html",'<md-menu md-position-mode="target-right target">\n\n  <div ng-click="$mdOpenMenu($event)">\n    <ms-color-picker-button>\n      <md-button aria-label="Row Color" md-menu-origin ng-click="$mdOpenMenu($event)" ng-class="vm.selectedColor.class">\n\n        <span ng-show="vm.selectedColor.palette">\n          {{vm.selectedColor.palette}} {{vm.selectedColor.hue}}\n        </span>\n        <span ng-show="!vm.selectedColor.palette">\n          Select Color\n        </span>\n      </md-button>\n    </ms-color-picker-button>\n  </div>\n\n  <md-menu-content class="ms-material-color-picker-menu-content" layout-column>\n\n    <header ng-class="vm.selectedColor.class || \'md-accent-bg\'" class="md-whiteframe-4dp" layout="row" layout-align="space-between center">\n      <md-button md-prevent-menu-close ng-click="vm.activateHueSelection(false,false)" class="md-icon-button" ng-class="{\'hidden\':!vm.selectedPalette}" aria-label="Palette">\n        <md-icon md-font-icon="icon-arrow-left" class="s20"></md-icon>\n      </md-button>\n\n      <span ng-if="vm.selectedColor.palette">\n        {{vm.selectedColor.palette}} {{vm.selectedColor.hue}}\n      </span>\n\n      <span ng-if="!vm.selectedColor.palette">\n        Select Color\n      </span>\n\n      <md-button class="remove-color-button md-icon-button" ng-click="vm.removeColor()" aria-label="Remove Color">\n        <md-icon md-font-icon="icon-delete" class="s20"></md-icon>\n      </md-button>\n    </header>\n\n    <div class="colors">\n      <div ng-show="!vm.selectedPalette" layout="row" layout-wrap>\n        <div class="color" ng-class="\'md-\'+palette+\'-500-bg\'" ng-repeat="(palette, hues) in vm.palettes" ng-click="vm.activateHueSelection(palette,hues)" layout="row" layout-align="start end" md-prevent-menu-close md-ink-ripple>\n          <span class="label">\n            {{palette}}\n          </span>\n        </div>\n      </div>\n\n      <div ng-show="vm.selectedPalette" layout="row" layout-wrap>\n        <div class="color" ng-class="\'md-\'+vm.selectedPalette+\'-\'+hue+\'-bg\'" ng-repeat="(hue, values) in vm.selectedHues" ng-click="vm.selectColor(vm.selectedPalette,hue)" layout="row" layout-align="start end" md-ink-ripple>\n          <span class="label">\n            {{hue}}\n          </span>\n          <i ng-if="vm.selectedPalette == vm.selectedColor.palette && hue == vm.selectedColor.hue" class="s16 icon-check">\n          </i>\n        </div>\n      </div>\n\n    </div>\n\n  </md-menu-content>\n</md-menu>'),e.put("app/core/directives/ms-navigation/templates/horizontal.html",'<div class="navigation-toggle" hide-gt-sm>\n  <md-button class="md-icon-button" ng-click="vm.toggleHorizontalMobileMenu()" aria-label="Toggle Mobile Navigation">\n    <md-icon md-font-icon="icon-menu"></md-icon>\n  </md-button>\n</div>\n\n<ul class="horizontal">\n  <li ng-repeat="node in vm.navigation" ms-navigation-horizontal-node="node" ng-class="{\'has-children\': vm.hasChildren}" ng-include="\'navigation-horizontal-nested.html\'"></li>\n</ul>\n\n\x3c!-- Nested horizontal navigation template --\x3e\n<script type="text/ng-template" id="navigation-horizontal-nested.html">\n\n  <div ms-navigation-horizontal-item layout="row" ng-if="!vm.isHidden()">\n\n        <div class="ms-navigation-horizontal-button" ng-if="!node.uisref && node.title"\n             ng-class="{\'active md-accent-bg md-accent-fg\': vm.isActive}">\n            <i class="icon s18 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg" style="background: {{node.badge.color}}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s18 arrow" ng-if="vm.hasChildren"></i>\n        </div>\n\n        <a class="ms-navigation-horizontal-button" ui-sref="{{node.uisref}}" ui-sref-active="active md-accent-bg"\n           ng-class="{\'active md-accent-bg md-accent-fg\': vm.isActive}"\n           ng-if="node.uisref && node.title">\n            <i class="icon s18 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg" style="background: {{node.badge.color}}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s18 arrow" ng-if="vm.hasChildren"></i>\n        </a>\n\n    </div>\n\n    <ul ng-if="vm.hasChildren && !vm.isHidden()">\n        <li ng-repeat="node in node.children" ms-navigation-horizontal-node="node"\n            ng-class="{\'has-children\': vm.hasChildren}"\n            ng-include="\'navigation-horizontal-nested.html\'"></li>\n    </ul>\n\n<\/script>\n\x3c!-- / Nested navigation template --\x3e'),e.put("app/core/directives/ms-navigation/templates/vertical.html",'<ul>\n  <li ng-repeat="node in vm.navigation" ms-navigation-node="node" ng-class="{\'collapsed\': vm.collapsed, \'has-children\': vm.hasChildren}" ng-include="\'navigation-nested.html\'"></li>\n</ul>\n\n\x3c!-- Nested navigation template --\x3e\n<script type="text/ng-template" id="navigation-nested.html">\n\n  <div id="{{ node.id }}" ms-navigation-item layout="row" ng-if="!vm.isHidden()">\n\n        <div class="ms-navigation-button" ng-if="!node.uisref && node.title">\n            <i class="icon s16 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg margin-right-20" ng-style="{\'background\': node.badge.color}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s16 arrow" ng-if="vm.collapsable && vm.hasChildren"></i>\n        </div>\n\n        <a class="ms-navigation-button" ui-sref="{{node.uisref}}" ui-sref-active="active md-accent-bg" ng-if="node.uisref && node.title">\n            <i class="icon s16 {{node.icon}}" ng-if="node.icon"></i>\n            <span class="title" translate="{{node.translate}}" flex>{{node.title}}</span>\n            <span class="badge white-fg margin-right-20" ng-style="{\'background\': node.badge.color}" ng-if="node.badge">{{node.badge.content}}</span>\n            <i class="icon-chevron-right s16 arrow" ng-if="vm.collapsable && vm.hasChildren"></i>\n        </a>\n\n    </div>\n\n    <ul ng-if="vm.hasChildren && !vm.isHidden()">\n        <li ng-repeat="node in node.children" ms-navigation-node="node"\n            ng-class="{\'collapsed\': vm.collapsed, \'has-children\': vm.hasChildren}"\n            ng-include="\'navigation-nested.html\'"></li>\n    </ul>\n\n<\/script>\n\x3c!-- / Nested navigation template --\x3e'),e.put("assets/ms-phonebar/ms-phonebar-dialpad.html",'\x3c!-- Dialpad --\x3e\n<md-content ng-if="vm_pb.showDialpad" class="num-pad" layout="column">\n  <section layout="row" layout-align="start center">\n    <span><img class="num-pad-logo" layout-padding src="/api/settings/1/logo" alt="logo" /></span>\n    <span class="md-subhead">Dialpad</span>\n    <div layout="row" layout-align="end center" flex>\n      <md-button class="md-icon-button" ng-click="vm_pb.closeDialpad()">\n        <md-icon md-font-icon="icon-close"></md-icon>\n      </md-button>\n    </div>\n  </section>\n  <md-divider></md-divider>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 1, l: []}, {n: 2, l: [\'a\', \'b\', \'c\']}, {n: 3, l: [\'d\', \'e\', \'f\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 4, l: [\'g\', \'h\', \'i\']}, {n: 5, l: [\'j\', \'k\', \'l\']}, {n: 6, l: [\'m\', \'n\', \'o\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: 7, l: [\'p\', \'q\', \'r\', \'s\']}, {n: 8, l: [\'t\', \'u\', \'v\']}, {n: 9, l: [\'w\', \'x\', \'y\', \'z\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n  </section>\n  <section layout="row">\n    <div class="span4" ng-repeat="item in ::[{n: \'*\', l: []}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num" layout="column" layout-align="center center">\n        <div class="txt" layout="column" layout-align="center center">\n          {{item.n}}\n        </div>\n      </div>\n    </div>\n    <div class="span4" ng-repeat="item in ::[{n: 0, l: [\'+\']}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num">\n        <div class="txt">\n          {{item.n}} <span class="small">\n            <p>\n              <span ng-repeat="l in ::item.l">{{l | uppercase}}</span>\n            </p>\n          </span>\n        </div>\n      </div>\n    </div>\n    <div class="span4" ng-repeat="item in ::[{n: \'#\', l: []}]" ng-click="vm_pb.type(item.n, true)">\n      <div class="num" layout="column" layout-align="center center">\n        <div class="txt" layout="column" layout-align="center center">\n          {{item.n}}\n        </div>\n      </div>\n    </div>\n  </section>\n</md-content>\n\x3c!-- Dialpad --\x3e\n\n\x3c!-- Input&Media Area --\x3e\n<div layout="row" layout-align="start center">\n  <div layout="row" layout-align="center center">\n    \x3c!-- START Ringing Tone--\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Ringing" ng-click="vm_pb.conf.ringingMute = !vm_pb.conf.ringingMute; vm_pb.initDevice(\'ringing\', true)" ng-disabled="!vm_pb.registered">\n      <md-icon md-font-icon="{{vm_pb.conf.ringingMute ? \'icon-bell-off\' : \'icon-bell-ring\'}}" class="icon s14" ng-class="vm_pb.conf.ringingMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.RINGING">Ringing</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Ringing Tone --\x3e\n\n    \x3c!-- START Speaker --\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Speaker" ng-click="vm_pb.conf.speakerMute = !vm_pb.conf.speakerMute; vm_pb.initDevice(\'speaker\', true)" ng-disabled="!vm_pb.registered">\n      <md-icon md-font-icon="{{vm_pb.conf.speakerMute ? \'icon-volume-off\' : \'icon-volume\'}}" class="icon s14" ng-class="vm_pb.conf.speakerMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.SPEAKER">Speaker</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Speaker --\x3e\n\n    \x3c!-- START Microphone --\x3e\n    <md-button ng-disabled="(!vm_pb.registered || vm_pb.sessions.length==0)?true:false" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Microphone" ng-click="vm_pb.conf.microphoneMute = !vm_pb.conf.microphoneMute; vm_pb.initDevice(\'microphone\', true)">\n      <md-icon md-font-icon="{{vm_pb.conf.microphoneMute ? \'icon-microphone-off\' : \'icon-microphone\'}}" class="icon s14" ng-class="vm_pb.conf.microphoneMute ? \'red-fg\' : \'grey-fg\'">\n        <md-tooltip><span translate="TOOLBAR.MICROPHONE">Microphone</span></md-tooltip>\n      </md-icon>\n    </md-button>\n    \x3c!-- END Microphone --\x3e\n\n    \x3c!-- START Registered --\x3e\n    <span>\n      <span class="quantity-indicator md-red-500-bg" ng-class="vm_pb.registered ? \'md-green-500-bg\' : \'md-red-500-bg\'"></span>\n      <md-tooltip><span>{{vm_pb.conf.license ? (vm_pb.registered ? \'TOOLBAR.REGISTERED\' : \'TOOLBAR.NOT_REGISTERED\') : \'TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD\' | translate}}\n          <timer ng-if="vm_pb.registered"></timer>\n        </span>\n      </md-tooltip>\n    </span>\n    \x3c!-- END Registered --\x3e\n  </div>\n  <div layout="column" layout-align="center start">\n    <div layout="row" layout-align="start center">\n      \x3c!-- START Target --\x3e\n      <angucomplete-alt id="ms-target-wrap" pause="10" local-data="vm_pb.calls" search-fields="target" title-field="target" minlength="0" input-class="input-number" disable-input="!vm_pb.registered" match-class="highlight" template-url="assets/ms-phonebar/ms-phonebar-input.html" input-changed="vm_pb.targetChanged" selected-object="vm_pb.targetSelected" clear-selected="true" ng-keypress="vm_pb.typeWrapper($event)" focus-first="true" disable-autocomplete="vm_pb.currentUser.privacyEnabled"></angucomplete-alt>\n      \x3c!-- END Target --\x3e\n\n      \x3c!-- Auto Answer --\x3e\n      <div ng-if="vm_pb.conf.autoAnswer" class="red-fg" style="padding-left: 10px;">\n        <span class="font-size-20">A<span class="font-size-16">A</span></span>\n      </div>\n      \x3c!-- Auto Answer --\x3e\n\n      <md-button class="md-fab md-mini white-bg width-30 height-30" aria-label="Dialpad" ng-click="vm_pb.toggleDialpad()" ng-disabled="!vm_pb.registered">\n        <md-icon md-font-icon="icon-apps" class="icon grey-fg s16"></md-icon>\n      </md-button>\n      <md-button ng-if="vm_pb.target" class="md-fab md-mini white-bg width-25 height-25" aria-label="Call" style="margin-left: 0px;" ng-click="vm_pb.call()">\n        <md-icon md-font-icon="icon-phone" class="icon green-fg s12"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>\n\x3c!-- Input&Media Area --\x3e\n\n\x3c!-- START 3WC --\x3e\n<md-button ng-if="vm_pb.canGoInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="3Way" ng-click="vm_pb.start3WayConf();  $event.stopPropagation();">\n  <md-icon md-font-icon="icon-account-multiple-plus" class="icon orange-fg s14"></md-icon>\n  <md-tooltip><span translate="TOOLBAR.CONFERENCE">Conference</span></md-tooltip>\n</md-button>\n\x3c!-- END 3Way --\x3e\n\n\n<div class="toolbar-separator"></div>\n\n\x3c!-- Sessions Area --\x3e\n<div class="sessions" layout="row" layout-align="start center" flex>\n  <div layout="row" layout-align="center center" ng-if="!vm_pb.conf.license">\n    <md-icon md-font-icon="icon-account-alert" class="icon s36 red-fg"></md-icon>\n    <span layout-margin translate="TOOLBAR.WEBRTC_LICENSE_NOT_ENABELD"></span>\n  </div>\n\n  <div id="{{\'div_session_\'+session.id.substr(0,32)}}" ng-repeat="session in vm_pb.sessions" class="session" layout="row" ng-click="(vm_pb.sessions.length > 1) && vm_pb.selectSession(session)">\n    <md-button ng-if="vm_pb.conf.recording && session.confirmed" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Record" ng-click="vm_pb.record(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-radiobox-marked" class="icon s14" ng-class="session.monitor ? \'red-fg\' : \'grey-fg\'"></md-icon>\n    </md-button>\n    <div layout="column" layout-align="center start">\n      <span class="session-info">\n        <span ng-if="session.user == session.name" privacy ng-cloak>{{session.user}}</span>\n        <span ng-if="session.user != session.name" privacy ng-cloak>{{session.name}}</span> <span ng-if="session.user != session.name" privacy ng-cloak>{{session.user}}</span>\n      </span>\n      <span class="session-info" layout="row" layout="start center">\n        <timer></timer>\n      </span>\n    </div>\n\n    \x3c!-- START Answer --\x3e\n    <md-button ng-if="session.incoming && !session.confirmed" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Anser" ng-click="vm_pb.answer(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone" class="icon green-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Answer --\x3e\n\n    \x3c!-- START Hangup --\x3e\n    <md-button class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Terminate" ng-click="vm_pb.terminate(session); $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-hangup" class="icon red-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Hangup --\x3e\n\n    \x3c!-- START Hold/Unhold --\x3e\n    <md-button ng-if="session.confirmed && !vm_pb.isInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Hold" ng-click="(session.localHold ? vm_pb.unhold(session) : vm_pb.hold(session)); $event.stopPropagation();">\n      <md-icon md-font-icon="{{session.localHold ? \'icon-play\' : \'icon-pause\'}}" class="icon grey-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Hold/Unhold --\x3e\n\n    \x3c!-- START Transfer --\x3e\n    <md-button ng-if="session.confirmed && !session.localHold && vm_pb.sessions.length == 1 && !vm_pb.isInConference" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Refer" ng-click="vm_pb.refer(session);  $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END transfer --\x3e\n\n    \x3c!-- START Attended Transfer --\x3e\n    <md-button ng-if="session.confirmed && !session.localHold && vm_pb.sessions.length>1" class="md-fab md-mini white-bg width-25 height-25 margin-5" aria-label="Refer Attended" ng-click="vm_pb.referAttended(session);  $event.stopPropagation();">\n      <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s12"></md-icon>\n    </md-button>\n    \x3c!-- END Attended Transfer --\x3e\n  </div>\n</div>\n\x3c!-- Sessions Area --\x3e'),e.put("assets/ms-phonebar/ms-phonebar-input.html",'<div class="angucomplete-holder" ng-class="{\'angucomplete-dropdown-visible\': showDropdown}">\n  <input id="ms-target" ng-model="searchStr" ng-disabled="disableInput" type="text" placeholder="{{placeholder}}" ng-focus="onFocusHandler()" class="{{inputClass}}" ng-focus="resetHideResults()" ng-blur="hideResults($event)" autocapitalize="off" autocorrect="off" autocomplete="off" ng-change="inputChangeHandler(searchStr)" />\n  <div class="angucomplete-dropdown" ng-show="showDropdown && !(!searching && (!results || results.length == 0))">\n    <div class="angucomplete-row" ng-repeat="result in results" ng-click="selectResult(result)" ng-mouseenter="hoverRow($index)" ng-class="{\'angucomplete-selected-row\': $index == currentIndex}">\n      <div layout="row" layout-align="start center">\n        <md-icon md-font-icon="{{result.originalObject.inbound ? \'icon-arrow-bottom-left\' : \'icon-arrow-top-right\'}}" class="icon no-margin s22"></md-icon>\n        <span style="margin-left: 8px;">({{result.originalObject.time}}) - <span class="angucomplete-title" ng-if="matchClass" ng-bind-html="result.title" privacy ng-cloak></span></span>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("assets/ms-phonebar/ms-phonebar.html",'<div layout="row" layout-align="start center" flex>\n  \x3c!-- Audio stream --\x3e\n  <audio id="local-audio" autoplay hidden=true></audio>\n  <audio id="remote-audio" autoplay hidden=true></audio>\n  \x3c!-- Audio stream --\x3e\n\n  \x3c!-- WebRtc PhoneBar --\x3e\n  <div class="phonebar-container" ng-include="\'assets/ms-phonebar/ms-phonebar-dialpad.html\'" layout="row" layout-align="start center" flex></div>\n  \x3c!-- WebRtc PhoneBar --\x3e\n</div>'),e.put("assets/ms-phonebar/prefix/dialog.html",'<md-dialog aria-label="Prefix">\n  <form ng-cloak ng-keypress="vm.keyPress($event)">\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.PREFIXES">Prefixes</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog(-1)">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-radio-group ng-model="vm.prefix">\n        <md-radio-button ng-repeat="prefix in vm.prefixes.rows" value="{{prefix.prefix}}" class="md-primary">{{prefix.name}}</md-radio-button>\n        <md-radio-button ng-if="!vm.required" ng-value="null" class="md-primary">no prefix</md-radio-button>\n      </md-radio-group>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.call()" class="send-button md-accent md-raised" aria-label="call" md-autofocus ng-disabled="!vm.prefix && vm.required">\n        <span translate="TOOLBAR.CALL">CALL</span>\n      </md-button>\n      <md-button ng-click="vm.closeDialog(-1)" class="send-button md-accent md-raised" aria-label="cancel">\n        <span translate="TOOLBAR.CANCEL">Cancel</span>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("assets/ms-phonebar/record/dialog.html",'<md-dialog aria-label="Recording" ng-init="vm.onInit()">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.RECORDING">Recording</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding">\n            <md-icon class="no-margin" md-font-icon="icon-plus" aria-label="Add" ng-click="vm.addRecording()"></md-icon>\n          </md-button>\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog()">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-table-container>\n      <table md-table layout-padding>\n        <thead md-head>\n          <tr md-row>\n            <th md-column><span translate="TOOLBAR.FILENAME">File name</span></th>\n            <th md-column><span translate="TOOLBAR.STATUS">Status</span></th>\n            <th md-column><span translate="TOOLBAR.ACTIONS">Actions</span></th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm.session.monitors.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="TOOLBAR.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="monitor in vm.session.monitors">\n            <td md-cell>{{monitor.filename}}</td>\n            <td md-cell class="no-padding">\n              <md-icon md-font-icon="icon-radiobox-marked" class="icon s16" ng-class="(monitor.status == \'rec\') ? \'red-fg ms-blink\' : \'grey-fg\'"></md-icon>\n            </td>\n            <td md-cell class="no-padding">\n              <md-button class="md-fab md-mini white-bg width-35 height-35 margin-5" aria-label="Record" ng-click="(monitor.status == \'rec\') ? vm.stop(monitor) : vm.start(monitor)">\n'+"                <md-icon md-font-icon=\"{{monitor.status == 'rec' ? 'icon-stop' : 'icon-play'}}\" class=\"icon s16\" ng-class=\"monitor.status == 'rec' ? 'grey-fg' : 'red-fg'\"></md-icon>\n              </md-button>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n  </form>\n</md-dialog>"),e.put("assets/ms-phonebar/referAttended/dialog.html",'<md-dialog aria-label="Transfer">\n  <form ng-cloak>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div flex>\n          <span class="title" translate="TOOLBAR.ATTENDED_TRANSFER">Transfer</span>\n        </div>\n        <div layout="row" layout-align="end center">\n          <md-button class="md-icon-button no-margin no-padding" ng-click="vm.closeDialog()">\n            <md-icon class="no-margin" md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <label translate="TOOLBAR.TARGET">Target</label>\n      <md-input-container class="md-block">\n        <md-select ng-model="vm.target">\n          <md-option ng-repeat="session in vm.sessions" ng-value="session.user">\n            {{ session.name }}\n          </md-option>\n        </md-select>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row">\n      <md-button ng-click="vm.transfer()" class="send-button md-accent md-raised" aria-label="transfer" ng-disabled="!vm.target && !vm.sessionId">\n        <span translate="TOOLBAR.TRANSFER">TRANSFER</span>\n      </md-button>\n      <md-button ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="cancel">\n        <span translate="TOOLBAR.CANCEL">Cancel</span>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("assets/ms-phonebar/settings/settings.html",'<md-dialog class="md-phonebar-dialog" aria-label="{{vm.name}}">\n  <form name="settingsForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="TOOLBAR.SETTINGS">Settings</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content class="no-padding">\n      <md-tabs md-no-pagination md-stretch-tabs="always">\n        <md-tab label="{{ \'TOOLBAR.PROFILE\' | translate}}">\n          <md-content layout-padding layout="column">\n            <span><span translate="TOOLBAR.FULLNAME">Fullname</span>: {{vm.conf.fullname}}</span>\n            <span><span translate="TOOLBAR.NAME">Name</span>: {{vm.conf.name}}</span>\n            <span><span translate="TOOLBAR.INTERNAL">Internal</span>: {{vm.conf.internal}}</span>\n            <span><span translate="TOOLBAR.BROWSER">Browser</span>: {{vm.conf.browserName}} {{vm.conf.browserVersion}}</span>\n            <span><span translate="TOOLBAR.OS">OS</span>: {{vm.conf.osName}} {{vm.conf.osVersion}}</span>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.SERVICES\' | translate}}">\n          <md-content layout-padding>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.conf.autoAnswer" aria-label="Auto Answer">\n                <span translate="TOOLBAR.AUTOANSWER">Auto Answer</span>\n                <span>{{ vm.conf.autoAnswerDelay }} [s]</span>\n              </md-switch>\n              <md-switch ng-model="vm.messengerSoundNotification" aria-label="EnableMessengerSoundNotification">\n                <span translate="TOOLBAR.MESSENGERSOUNDNOTIFICATION">MessengerSoundNotification</span>\n              </md-switch>              \n            </md-input-container>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.AUDIO\' | translate}}">\n          <md-content layout-padding>\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audiooutput\' }).length">\n                <label translate="TOOLBAR.RINGINGDEVICE">Ringing Device</label>\n                <md-select name="ringingDevice" ng-model="vm.conf.ringingId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audiooutput\' }">{{ device.label || (\'Speaker \' + ($index + 1)) }}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'ringingDevice\'].$error" ng-show="settingsForm[\'ringingDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div layout="row" layout-align="space-between center">\n                <md-switch ng-model="vm.conf.ringingMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n\n                <md-slider-container flex="80">\n                  <md-slider flex step="0.1" min="0" max="1" ng-model="vm.conf.ringingVolume" aria-label="volume"></md-slider>\n                </md-slider-container>\n              </div>\n            </div>\n\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audiooutput\' }).length">\n                <label translate="TOOLBAR.SPEAKERDEVICE">Speaker Device</label>\n                <md-select name="speakerDevice" ng-model="vm.conf.speakerId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audiooutput\' }">{{ device.label || (\'Speaker \' + ($index + 1)) }}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'speakerDevice\'].$error" ng-show="settingsForm[\'speakerDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div layout="row" layout-align="space-between cetner">\n                <md-switch ng-model="vm.conf.speakerMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n\n                <md-slider-container flex="80">\n                  <md-slider flex step="0.1" min="0" max="1" ng-model="vm.conf.speakerVolume" aria-label="volume"></md-slider>\n                </md-slider-container>\n              </div>\n            </div>\n\n            <div class="border brad-5" layout-margin>\n              <md-input-container class="md-block" ng-if="(vm.devices | filter: { kind: \'audioinput\' }).length">\n                <label translate="TOOLBAR.MICROPHONEDEVICE">Microphone Device</label>\n                <md-select name="microphoneDevice" ng-model="vm.conf.microphoneId" required>\n                  <md-option ng-value="device.deviceId" ng-repeat="device in vm.devices | filter: { kind: \'audioinput\' }">{{ device.label || (\'Microphone \' + ($index + 1))}}</md-option>\n                </md-select>\n                <div ng-messages="settingsForm[\'microphoneDevice\'].$error" ng-show="settingsForm[\'microphoneDevice\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n              <div layout="row" layout-align="space-between center">\n                <md-switch ng-disabled="vm.activeSessions.length==0" ng-model="vm.conf.microphoneMute" aria-label="Mute">\n                  Mute\n                </md-switch>\n              </div>\n            </div>\n          </md-content>\n        </md-tab>\n        <md-tab label="{{ \'TOOLBAR.REQUIREMENTS\' | translate}}">\n          <md-content layout-padding>\n            <md-list>\n              <md-list-item>\n                <h3 translate="TOOLBAR.LICENSE">License</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.license ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.license ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.BROWSER_COMPATIBILITY">Browser Compatibility</h3>\n                <md-icon class="md-secondary" ng-class="vm.isCompatibleBrowser() ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.isCompatibleBrowser() ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.HTTPS">HTTPS</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.protocol === \'https\' ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.protocol === \'https\' ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.WEBRTCSUPPORT">WebRTC Support</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.isWebRTCSupported ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.isWebRTCSupported ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.MICROPHONE">Microphone</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.hasMicrophone ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.hasMicrophone ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n              <md-list-item>\n                <h3 translate="TOOLBAR.SPEAKER">Speaker</h3>\n                <md-icon class="md-secondary" ng-class="vm.conf.hasSpeakers ? \'green-fg\' : \'red-fg\'" md-font-icon="{{vm.conf.hasSpeakers ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n              </md-list-item>\n            </md-list>\n          </md-content>\n        </md-tab>\n      </md-tabs>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveSettings()" class="send-button md-accent md-raised" ng-disabled="settingsForm.$invalid || settingsForm.$pristine" aria-label="SAVE" translate="TOOLBAR.SAVE" translate-attr-aria-label="TOOLBAR.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/core/directives/ms-quick-filter/ms-quick-filter.html",'<div ng-cloak layout="row" class="quick-filter-container" flex>\n  <div ng-repeat="filter in vm.filters" ng-if="filter.ngIf ? $eval(\'vm.query.\' + filter.ngIf) : true" layout="column" class="padding-horizontal-16">\n    <span class="font-size-10" translate="{{ filter.label }}" />\n    <md-select ng-if="filter.type === \'select\'" class="font-size-12 no-margin" ng-model="vm.query[filter.key]" ng-change="vm.search()" aria-label="Filter {{ filter.name }}">\n      <md-option ng-repeat="option in filter.options" ng-value="filter.ngValue ? option[filter.ngValue] : option.id">\n        {{ option.name }}</md-option>\n      <md-option ng-repeat="option in filter.customOptions" ng-value="option.value" translate="{{ option.translate }}">\n      </md-option>\n    </md-select>\n\n    <md-select ng-if="filter.type === \'multiselect\'" multiple class="font-size-12 no-margin" ng-init="vm.onMultiselectInit(filter)" ng-model="vm.query[filter.key]" ng-disabled="filter.options.length === 0" ng-change="vm.onMultiselectSelection(filter, isOpen)" md-selected-text="vm.placeholders[filter.key]" aria-label="Filter {{ filter.name }}" md-on-open="isOpen = true" md-on-close="isOpen = false">\n      <md-option ng-repeat="option in filter.options" ng-value="filter.ngValue ? option[filter.ngValue] : option.id" ng-disabled="filter.clearAll === false && vm.query[filter.key].length === 1 && vm.query[filter.key][0] === (filter.ngValue ? option[filter.ngValue] : option.id)">\n        {{ option.name }}</md-option>\n      <md-button ng-if="vm.query[filter.key].length &lt; filter.options.length" ng-click="vm.selectAll(filter)" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.SELECT_ALL\' | translate}}</md-button>\n      <md-button ng-if="vm.query[filter.key].length === filter.options.length" ng-click="vm.clearSelection(filter)" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.CLEAR\' | translate}}</md-button>\n    </md-select>\n\n    <div ng-if="filter.type === \'date\'" layout="row" layout-align="center center">\n      <md-date-range ng-init="vm.onDateRangeInit(filter)" localization-map="vm.localizationMap" ng-model="vm.pickerModels[filter.key]" auto-confirm="true" show-template="true" md-on-select="vm.onDateRangeSelection(filter)" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}">\n      </md-date-range>\n      <md-button ng-if="vm.pickerModels[filter.key].dateStart" ng-click="vm.clearDate(filter)" class="md-icon-button no-margin no-padding width-20 height-20" aria-label="Clear date filter">\n        <md-icon md-font-icon="icon-close" class="quick-filter-date-clear-button s16"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-search-bar/ms-search-bar.html",'<div flex layout="row" layout-align="start center">\n  <label>\n    <md-button class="ms-search-bar-expander md-icon-button" aria-label="Expand Search Bar" ng-click="vm.expandBar()" ng-if="!vm.resultsLoading || !vm.expanded" ng-class="{\'ms-search-button-expanded\': vm.expanded }">\n      <md-icon id="ms-search-bar-icon" md-font-icon="icon-magnify" class="s24" ng-class="{\'{{ vm.iconColor }}\': vm.iconColor && !vm.expanded }"></md-icon>\n    </md-button>\n    <div class="ms-search-bar-loader" layout="row" layout-align="center center" ng-if="vm.resultsLoading && vm.expanded">\n      <md-progress-circular class="md-accent" md-diameter="32" md-mode="indeterminate"></md-progress-circular>\n    </div>\n  </label>\n  <input ng-if="vm.expanded" focus-on="vm.expanded" type="text" placeholder="{{ \'TOOLBAR.SEARCH\' | translate }}" flex ng-model="vm.query.filter" ng-model-options="vm.queryOptions" ng-blur="vm.blurCollapse()" ng-keydown="vm.onKeyDown($event)" />\n  <md-button class="ms-search-bar-collapser md-icon-button" ng-click="vm.collapseBar(true)" aria-label="Collapse Search Bar">\n    <md-icon md-font-icon="icon-close" class="icon s24"></md-icon>\n  </md-button>\n  <div class="ms-search-bar-results" ng-if="vm.results">\n    <div class="no-results" ng-if="vm.results.length === 0">{{ \'DASHBOARDS.NO_RESULTS_AVAILABLE\' | translate }}</div>\n    <div class="result" ng-repeat="result in vm.results" ng-click="vm.handleResultClick(result)" ng-mouseenter="vm.handleMouseEnter($index)" ng-mousedown="vm.absorbEvent($event)" ng-class="{\'selected\': $index == vm.selectedResultIndex}" md-ink-ripple>\n      <div layout="row" layout-align="start center">\n        <div class="icon-container" layout="row" layout-align="center center">\n          <i ng-if="result.icon" class="icon {{ result.icon }}"></i>\n          <div ng-if="!result.icon" class="square md-accent-bg"></div>\n        </div>\n        <div>\n          <div class="title">{{ result.title }}</div>\n          <div class="description" ng-if="result.description">{{ result.description }}</div>\n        </div>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/core/directives/ms-shortcuts/ms-shortcuts.html",'<div class="shortcuts-container" layout="row" layout-align="space-between center" flex ng-class="{\'mobile-bar-active\': MsShortcuts.mobileBarActive}">\n\n  <div class="flex-noshrink" layout="row" layout-align="start center" flex>\n    <div class="shortcuts hide show-gt-xs" layout="row" layout-align="start center" ng-if="MsShortcuts.shortcuts.length > 0" ng-sortable="MsShortcuts.sortableOptions">\n      <div ng-repeat="shortcut in MsShortcuts.shortcuts" layout="row" layout-align="center center">\n        <md-button class="md-icon-button shortcut" aria-label="{{shortcut.title}}" ui-sref="{{shortcut.uisref}}">\n          <md-icon ng-if="shortcut.icon" md-font-icon="{{shortcut.icon}}" class="icon s24"></md-icon>\n          <div ng-if="!shortcut.icon" class="first-letter">{{shortcut.title.charAt(0)}}</div>\n          <md-tooltip md-direction="bottom">{{shortcut.title}}</md-tooltip>\n        </md-button>\n      </div>\n    </div>\n\n    \x3c!-- <md-menu md-offset="8 56" class="shortcut-menu hide show-gt-xs">\n            <md-button class="md-icon-button add-shortcut-button" aria-label="Add shortcut"\n                       ng-click="$mdOpenMenu($event)">\n                <md-icon md-menu-origin md-font-icon="icon-star" class="icon amber-600-fg s24"></md-icon>\n                <md-tooltip md-direction="bottom">Click to add/remove shortcut</md-tooltip>\n            </md-button>\n\n            <md-menu-content>\n                <div id="ms-shortcut-add-menu">\n                    <div class="shortcut-search" layout="row" layout-align="start center">\n                        <div class="search-icon" layout="row" layout-align="center center"\n                             ng-if="!MsShortcuts.resultsLoading">\n                            <md-icon md-menu-align-target md-font-icon="icon-magnify" class="icon s24"></md-icon>\n                        </div>\n                        <div class="shortcut-loader" layout="row" layout-align="center center"\n                             ng-if="MsShortcuts.resultsLoading">\n                            <md-progress-circular class="md-accent" md-diameter="20" md-mode="indeterminate">\n                            </md-progress-circular>\n                        </div>\n\n                        <input type="text" placeholder="Search" flex\n                               ng-model="MsShortcuts.query"\n                               ng-model-options="MsShortcuts.queryOptions"\n                               ng-keydown="MsShortcuts.handleKeydown($event)">\n                    </div>\n\n                    <div class="results" ng-if="MsShortcuts.results" >\n                        <div class="no-results" ng-if="MsShortcuts.results.length === 0">No Results!</div>\n\n                        <div class="result" ng-repeat="result in MsShortcuts.results"\n                             ng-click="MsShortcuts.handleResultClick(result)"\n                             ng-mouseenter="MsShortcuts.handleMouseenter($index)"\n                             ng-mousedown="MsShortcuts.absorbEvent($event)"\n                             ng-class="{\'selected\': $index == MsShortcuts.selectedResultIndex}"\n                             md-prevent-menu-close="md-prevent-menu-close"\n                             md-ink-ripple>\n                            <div layout="row" layout-align="start space-between">\n                                <div layout="row" layout-align="start center" flex>\n                                    <div class="icon icon-container" layout="row" layout-align="center center">\n                                        <i ng-if="result.icon" class="{{result.icon}}"></i>\n                                        <div ng-if="!result.icon" class="square md-accent-bg"></div>\n                                    </div>\n                                    <div>\n                                        <div class="title">{{result.title}}</div>\n                                    </div>\n                                </div>\n                                <md-icon md-font-icon="icon-pin" class="icon s18"\n                                         ng-class="{\'fade-text\': !result.hasShortcut}"></md-icon>\n                            </div>\n                        </div>\n                    </div>\n                </div>\n            </md-menu-content>\n        </md-menu> --\x3e\n  </div>\n\n  <md-button class="md-icon-button toggle-mobile-menu hide-gt-xs" aria-label="Add shortcut" ng-click="MsShortcuts.toggleMobileBar()">\n    <md-icon md-menu-origin md-font-icon="icon-star" class="icon amber-600-fg s24" ng-hide="MsShortcuts.mobileBarActive"></md-icon>\n    <md-icon md-menu-origin md-font-icon="icon-close" class="icon s24" ng-hide="!MsShortcuts.mobileBarActive"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-stepper/templates/horizontal/horizontal.html",'<div class="ms-stepper-horizontal">\n  <div class="ms-stepper-navigation-wrapper">\n    <div class="ms-stepper-navigation" layout="row" layout-align="center center">\n      <md-button class="ms-stepper-navigation-item" ng-class="{\'current\': MsStepper.isStepCurrent(step.stepNumber), \'valid\': MsStepper.isStepValid(step.stepNumber), \'disabled\': MsStepper.isStepDisabled(step.stepNumber), \'optional\': MsStepper.isStepOptional(step.stepNumber)}" ng-click="MsStepper.gotoStep(step.stepNumber)" ng-disabled="MsStepper.isStepDisabled(step.stepNumber)" ng-repeat="step in MsStepper.steps | filter:MsStepper.filterHiddenStep" layout="row" layout-align="start center">\n\n        <div class="step md-accent-bg" layout="row" layout-align="center center">\n          <span ng-if="!MsStepper.isStepValid(step.stepNumber) || MsStepper.isStepOptional(step.stepNumber)">\n            {{$index + 1}}\n          </span>\n          <span ng-if="MsStepper.isStepValid(step.stepNumber) && !MsStepper.isStepOptional(step.stepNumber)">\n            <i class="icon icon-check s18"></i>\n          </span>\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="title" translate="{{step.stepTitleTranslate}}">{{step.stepTitle}}</div>\n          <div class="subtitle" ng-if="MsStepper.isStepOptional(step.stepNumber)">Optional</div>\n        </div>\n      </md-button>\n    </div>\n  </div>\n\n  <div class="ms-stepper-steps" ng-transclude></div>\n\n  <div class="ms-stepper-controls" layout="row" layout-align="center center">\n    <md-button class="md-accent md-raised" ng-disabled="MsStepper.isFirstStep()" ng-click="MsStepper.gotoPreviousStep()">\n      Back\n    </md-button>\n\n    <div class="ms-stepper-dots">\n      <span ng-repeat="step in MsStepper.steps" ng-hide="MsStepper.isStepHidden(step.stepNumber)" ng-class="{\'selected md-accent-bg\':MsStepper.currentStepNumber === $index + 1}">\n      </span>\n    </div>\n\n    <md-button class="md-accent md-raised" ng-if="!MsStepper.isLastStep()" ng-disabled="!MsStepper.isStepValid(MsStepper.currentStepNumber)" ng-click="MsStepper.gotoNextStep()">\n      Next\n    </md-button>\n\n    <md-button type="submit" class="md-accent md-raised" ng-click="MsStepper.resetForm()" ng-if="MsStepper.isLastStep()" ng-disabled="!MsStepper.isFormValid()">\n      Submit\n    </md-button>\n  </div>\n</div>'),e.put("app/core/directives/ms-stepper/templates/vertical/step/vertical-step.html",'<md-button class="ms-stepper-navigation-item" ng-class="{\'current\': MsStepper.isStepCurrent(stepInfo.stepNumber), \'valid\': MsStepper.isStepValid(stepInfo.stepNumber), \'disabled\': MsStepper.isStepDisabled(stepInfo.stepNumber), \'optional\': MsStepper.isStepOptional(stepInfo.stepNumber)}" ng-click="MsStepper.gotoStep(stepInfo.stepNumber)" ng-disabled="MsStepper.isStepDisabled(stepInfo.stepNumber)" ng-hide="MsStepper.isStepHidden(stepInfo.stepNumber)" aria-label="Stepper navigation button" layout="row" layout-align="start center">\n\n  <div class="step" layout="row" layout-align="center center">\n    <span ng-if="!MsStepper.isStepValid(stepInfo.stepNumber) || MsStepper.isStepOptional(stepInfo.stepNumber)">\n      <i class="icon icon-checkbox-blank-circle-outline s18 md-accent-fg"></i>\n    </span>\n    <span ng-if="MsStepper.isStepValid(stepInfo.stepNumber) && !MsStepper.isStepOptional(stepInfo.stepNumber)">\n      <i class="icon icon-check-circle s18 md-accent-fg"></i>\n    </span>\n  </div>\n\n  <div layout="column" layout-align="start start">\n    <div class="title" ng-if="stepInfo.stepTitleTranslate">{{stepInfo.stepTitleTranslate | translate }}</div>\n    <div class="title" ng-if="!stepInfo.stepTitleTranslate">{{stepInfo.stepTitle}}</div>\n    <div class="subtitle" ng-if="MsStepper.isStepOptional(stepInfo.stepNumber)">Optional</div>\n  </div>\n</md-button>\n\n<div class="ms-stepper-step-content" ng-transclude></div>\n\n<div class="ms-stepper-controls" layout="row" layout-align="start center" ng-show="MsStepper.isStepCurrent(stepInfo.stepNumber)">\n  <md-button class="md-accent md-raised" ng-disabled="MsStepper.isFirstStep()" ng-click="MsStepper.gotoPreviousStep()">\n    Back\n  </md-button>\n\n  <md-button class="md-accent md-raised" ng-if="!MsStepper.isLastStep()" ng-disabled="!MsStepper.isStepValid(MsStepper.currentStepNumber)" ng-click="MsStepper.gotoNextStep()">\n    Next\n  </md-button>\n\n  <md-button type="submit" class="md-accent md-raised" ng-click="MsStepper.resetForm()" ng-if="MsStepper.isLastStep()" ng-disabled="!MsStepper.isFormValid()">\n    Submit\n  </md-button>\n</div>'),e.put("app/core/directives/ms-stepper/templates/vertical/vertical.html",'<div class="ms-stepper-vertical">\n  <div class="ms-stepper-vertical-line"></div>\n  <div class="ms-stepper-steps" ng-transclude></div>\n</div>'),e.put("app/core/directives/ms-tab-scroll/ms-tab-scroll.html",'<div layout="row">\n  <md-button class="md-icon-button md-mini width-25 no-margin scroll-arrow" ng-click="vm.onTabScroll(\'left\')" ng-if="vm.canScroll(\'left\') == true">\n    <md-icon md-font-icon="icon-chevron-left" class="icon s26"></md-icon>\n  </md-button>\n  <div id="bar-container" layout="row" class="bar-container">\n    <div ng-transclude id="tab-container" layout="row" layout-align="start center" class="scroll-container">\n    </div>\n  </div>\n  <md-button class="md-icon-button md-mini width-25 no-margin scroll-arrow" ng-click="vm.onTabScroll(\'right\')" ng-if="vm.canScroll(\'right\') == true">\n    <md-icon md-font-icon="icon-chevron-right" class="icon s26"></md-icon>\n  </md-button>\n</div>'),e.put("app/core/directives/ms-timezone/ms-timezone.html",'<md-select ng-model="ngModel" class="no-margin" ng-change="ngChange()">\n  <md-option ng-value="null">NONE</md-option>\n  <md-option ng-repeat="t in timezone | orderBy:\'utcOffset\'" value="{{t.name}}">{{t.name}} ({{t.offsetStr}})</md-option>\n</md-select>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-counter/ms-widget-engine.counter.html",'<div class="pt-8 pb-2" layout="column" layout-align="center center" layout-fill ng-controller="MsWidgetEngineCounterController as vm">\n  <div ng-class="\'font-size-\' + (vm.fontSize * 2)" ng-style="{\'color\': widget.foreground}">\n    {{ vm.getCount(widget) }}\n  </div>\n  <div ng-class="\'font-size-\' + vm.fontSize" ng-style="{\'color\': widget.foreground}">{{ \'TOOLS.\' +  vm.label | uppercase | translate }}<span ng-if="vm.filtered">*</span></div>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-multibar-chart/ms-widget-engine.multibar-chart.html",'<div ng-controller="MsWidgetEngineMultibarChartController as vm" ng-init="vm.getMultiBarChart(widget)" layout="column" layout-fill>\n\n  <span ng-show="false">{{ vm.getMultiBarChart(widget)}}</span>\n\n  <canvas style="overflow:scroll" id="bar" class="chart-horizontal-bar" chart-data="vm.multiBarChart.data" chart-options="vm.multiBarChart.options" chart-series="vm.multiBarChart.series" chart-labels="vm.multiBarChart.labels">\n  </canvas>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-pie-chart/ms-widget-engine.pie-chart.html",'<div ng-controller="MsWidgetEnginePieChartController as vm" ng-init="vm.getPieChart(widget)" layout="column" layout-fill>\n\n  <span ng-show="false">{{ vm.getPieChart(widget)}}</span>\n\n  <canvas style="overflow:scroll" id="pie" class="chart-pie" chart-data="vm.pieChart.data" chart-labels="vm.pieChart.labels" chart-options="vm.pieChart.options">\n  </canvas>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine-web-report/ms-widget-engine.web-report.html",'<div ng-controller="MsWidgetEngineWebReportController as vm" ng-init="vm.onInit(widget)">\n  <dl ng-if="vm.error">\n    <dt class="text-bold">Query Error</dt>\n    <dd>{{vm.error.sql}}</dd>\n    <dt>Message</dt>\n    <dd>{{vm.error.msg}}</dd>\n  </dl>\n  <md-toolbar class="md-table-toolbar md-default">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{vm.title}}</span>\n      <div flex></div>\n      <md-button class="md-icon-button" ng-click="vm.onInit(widget)" aria-label="refresh">\n        <md-icon md-font-icon="icon-refresh"></md-icon>\n      </md-button>\n      <span ng-if="vm.refresh && vm.countDown" class="md-subhead blue-fg">{{vm.countDown}}</span>\n    </div>\n  </md-toolbar>\n  <md-table-container ng-if="!vm.error">\n    <table md-table md-progress="vm.promise">\n      <thead md-head>\n        <tr md-row>\n          <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-repeat="row in vm.results.rows">\n          <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n        </tr>\n        <tr md-row ng-if="!vm.results.rows.length">\n          <td md-cell colspan="{{vm.columns.length}}">\n            <div layout="row" layout-align="center center">\n              <span>No Data</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.results.count}}" md-on-paginate="vm.getResults" md-page-select></md-table-pagination>\n</div>'),e.put("app/core/directives/ms-widget-engine/ms-widget-engine.html",'<div gridster="vm.config">\n  <ul>\n    <li gridster-item="widget" ng-repeat="widget in vm.config.widgets">\n      <md-card layout-fill>\n        <md-toolbar class="height-40" ng-style="{\'background-color\': widget.background, \'color\': widget.foreground }">\n          <div class="md-toolbar-tools height-40 no-margin" layout="row" layout-align="start center">\n            <a ng-href="{{widget.link ? widget.link : \'javascript:void(0)\'}}" ng-style="{\'color\': widget.foreground, \'font-size\': (widget.titleFontSize || 12) }" class="text-truncate" flex>\n              {{ widget.title || \'No Title\' }}\n            </a>\n            <md-button ng-if="!vm.config.preview && !vm.config.crudPermissions.readOnly" class="draggable md-icon-button width-30 no-margin no-padding" aria-label="Move">\n              <md-tooltip><span translate="TOOLS.MOVE_WIDGET">Move</span></md-tooltip>\n              <md-icon md-font-icon="icon-cursor-move" class="s20" ng-style="{\'color\': widget.foreground}"></md-icon>\n            </md-button>\n            <md-menu ng-if="!vm.config.preview">\n              <md-button ng-click="$mdOpenMenu($event)" class="md-icon-button width-30 no-margin no-padding" aria-label="More">\n                <md-icon md-font-icon="icon-dots-vertical" class="s20" ng-style="{\'color\': widget.foreground}"></md-icon>\n              </md-button>\n              <md-menu-content>\n                <md-menu-item ng-if="vm.config.crudPermissions.canEdit === true">\n                  <md-button ng-click="vm.onEdit({widget: widget})" translate="TOOLS.EDIT_WIDGET">Edit\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.config.crudPermissions.canDelete === true">\n                  <md-button ng-click="vm.onDelete({widget: widget})" translate="TOOLS.DELETE_WIDGET">\n                    Delete</md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n\n          </div>\n        </md-toolbar>\n        <md-card-content class="resizable" layout="column" layout-align="center center" flex style="height: 60px !important; min-height: 60px !important" ng-style="{\'background-color\': widget.background, \'color\': widget.foreground}">\n          <div ng-switch="widget.type" layout-fill>\n            <iframe ng-switch-when="iframe|custom" ng-switch-when-separator="|" ng-src="{{vm.getTrustedURL(widget.attrs[0].value)}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n            <ds-widget-clock ng-class="\'font-size-\' + (widget.attrs[2].value || 12)" ng-switch-when="clock" digital-format="widget.attrs[0].value" gmt-offset="widget.attrs[1].value" data-show-digital show-gmt-info></ds-widget-clock>\n            <div ng-switch-default layout-fill>\n              <div ng-include="widget.templateUrl" layout-fill></div>\n            </div>\n          </div>\n        </md-card-content>\n      </md-card>\n    </li>\n  </ul>\n</div>'),e.put("app/core/layouts/content-only.html",'<div id="layout-content-only" class="template-layout" layout="column" flex>\n  <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n</div>'),e.put("app/core/layouts/content-with-toolbar.html",'<div id="layout-content-with-toolbar" class="template-layout" layout="column" flex>\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n  <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n</div>'),e.put("app/core/layouts/horizontal-navigation.html",'<div id="layout-horizontal-navigation" class="template-layout" layout="column" flex>\n\n  <div id="toolbar-navigation-container" class="md-whiteframe-1dp" layout="column" layout-align="space-between start">\n    <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n    <div id="horizontal-navigation" ui-view="navigation" layout="row" layout-align="start end" flex></div>\n  </div>\n\n  <div id="content-container" flex layout="column">\n    <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n  </div>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n\n</div>'),e.put("app/core/layouts/vertical-navigation-fullwidth-toolbar-2.html",'<div id="layout-vertical-navigation-fullwidth-toolbar-2" class="template-layout" layout="column" flex>\n\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp md-accent" ui-view="toolbar"></md-toolbar>\n\n  <div id="main-container" layout="row" flex>\n    <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation"></md-sidenav>\n\n    <div id="content-container" flex layout="column">\n      <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n    </div>\n\n    <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n  </div>\n\n\n</div>'),e.put("app/core/layouts/vertical-navigation-fullwidth-toolbar.html",'<div id="layout-vertical-navigation-fullwidth-toolbar" class="template-layout" layout="column" flex>\n\n  <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp md-accent" ui-view="toolbar"></md-toolbar>\n\n  <div id="main-container" layout="row" flex>\n    <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation"></md-sidenav>\n\n    <div id="content-container" flex layout="column">\n      <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n    </div>\n\n    <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n  </div>\n\n\n</div>'),e.put("app/core/layouts/vertical-navigation.html",'<div id="header" ui-view="header"></div>\n\n<div id="layout-vertical-navigation" class="template-layout" layout="row" flex>\n\n  <md-sidenav id="vertical-navigation" class="md-primary-bg" md-is-locked-open="$mdMedia(\'gt-sm\')" md-component-id="navigation" ui-view="navigation" ng-if="!vm.isAgent()"></md-sidenav>\n\n  <div id="content-container" flex layout="column">\n    <md-toolbar id="toolbar" class="md-menu-toolbar md-whiteframe-1dp" ui-view="toolbar"></md-toolbar>\n\n    <md-content id="content" class="md-hue-2" ui-view="content" flex></md-content>\n  </div>\n\n  <md-sidenav id="quick-panel" class="md-sidenav-right md-whiteframe-4dp" md-component-id="quick-panel" ui-view="quickPanel"></md-sidenav>\n\n</div>\n\n<div id="footer" ui-view="footer"></div>'),e.put("app/core/theme-options/theme-options.html",'<div class="ms-theme-options-button md-primary-bg" ng-click="toggleOptionsSidenav()">\n  <md-icon md-font-icon="icon-cog" class="white-text"></md-icon>\n</div>\n\n<md-sidenav md-component-id="motion-theme-options" class="md-sidenav-right">\n\n  <div class="ms-theme-options-list" layout="column">\n    <div class="theme-option layout-options">\n      <div class="option-title">Layout Style:</div>\n      <md-radio-group layout="row" layout-align="start start" layout-wrap ng-model="vm.layoutStyle" ng-change="vm.updateLayoutStyle()">\n        <md-radio-button ng-repeat="layoutStyle in vm.layoutStyles" ng-value="layoutStyle.value">\n          <div layout="column" layout-align="center center">\n            <img ng-src="{{layoutStyle.figure}}">\n            <span class="text-center font-size-12 mt-8">{{layoutStyle.label}}</span>\n          </div>\n        </md-radio-button>\n      </md-radio-group>\n    </div>\n\n    <md-divider></md-divider>\n\n    <div class="theme-option">\n      <div class="option-title">Layout Mode:</div>\n      <md-radio-group layout="row" layout-align="start center" ng-model="vm.layoutMode" ng-change="vm.updateLayoutMode()">\n        <md-radio-button ng-repeat="layoutMode in vm.layoutModes" ng-value="layoutMode.value">\n          {{layoutMode.label}}\n        </md-radio-button>\n      </md-radio-group>\n    </div>\n\n    <md-divider></md-divider>\n\n    <div class="theme-option color-palettes">\n      <div class="option-title">Color Palette:</div>\n      <div layout="row" layout-align="start start" layout-wrap>\n        <md-button ng-repeat="(themeName, theme) in vm.themes.list" class="md-raised theme-button" layout="row" layout-align="center center" aria-label="{{themeName}}" ng-click="vm.setActiveTheme(themeName)" ng-style="{\'background-color\': theme.primary.color,\'border-color\': theme.accent.color,\'color\': theme.primary.contrast1}" ng-class="{active: vm.getActiveTheme().name === themeName}">\n          <md-icon ng-style="{\'color\': theme.primary.contrast1}" md-font-icon="icon-palette" class="icon s32"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n</md-sidenav>'),e.put("app/errors/404/error-404.html",'<div id="error-404" layout="column" layout-align="center center">\n  <div class="content" layout="column" layout-align="center center">\n    <div class="error-code" translate="ERROR404.CODE">404</div>\n\n    <div class="message" translate="ERROR404.MESSAGE">Sorry but we couldn’t find the page you are looking for</div>\n    <ms-search-bar on-search="vm.search(query)" on-result-click="vm.searchResultClick(item)" debounce="300">Search for anything</ms-search-bar>\n\n    \x3c!-- <div class="search md-whiteframe-1dp" layout="row" layout-align="start center">\n            <md-icon md-font-icon="icon-magnify" class="icon s24"></md-icon>\n            <input ng-model="vm.search" type="text" placeholder="Search for anything" translate translate-attr-placeholder="ERROR404.SEARCH" flex>\n        </div> --\x3e\n\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR404.GO_BACK">Go back to dashboard</a>\n  </div>\n</div>'),e.put("app/errors/500/error-500.html",'<div id="error-500" layout="column" layout-align="center center">\n  <div ng-if="!vm.send" class="content" layout="column" layout-align="center center">\n    <div class="error-code" translate="ERROR500.CODE">500</div>\n    <div class="message" translate="ERROR500.MESSAGE">Well, you broke the internet!</div>\n    <div class="sub-message" translate="ERROR500.SUBMESSAGE">Just kidding, looks like we have an internal issue, please try again in couple minutes\n    </div>\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR500.GO_BACK">Go back to dashboard</a>\n    <md-button class="md-raised md-warn" ng-click="vm.sendReport()" translate="ERROR500.REPORT">Report this problem</md-button>\n  </div>\n  <pre ng-if="!vm.send">\n  {{vm.error}}\n  </pre>\n  <div ng-if="vm.send" class="content" layout="column" layout-align="center center">\n    <div class="error-code">#{{vm.code}}</div>\n    <div class="message" translate="ERROR500.JIRA_MESSAGE">Your request has been received and will be processed shortly.</div>\n    <div class="sub-message" translate="ERROR500.JIRA_SUBMESSAGE">Sorry for the inconvenience. If you have any questions or concerns, please do not hesitate to contact us.</div>\n    <a class="md-button md-raised md-primary back-link" href="/" translate="ERROR500.GO_BACK">Go back to dashboard</a>\n  </div>\n</div>'),e.put("app/footer/layouts/vertical-navigation/footer.html",'<div layout="row" layout-align="start center">\n  <ms-info-bar ng-if="!vm.cookieAlertHide" on-close="vm.cookieAlertOnClose()" class="grey-100-bg">\n    <div layout="row" layout-align="start center">\n      <span translate="FOOTER.COOKIE_LAW" flex class="text-center grey-600-fg"></span>\n    </div>\n  </ms-info-bar>\n</div>'),e.put("app/forgot/forgot.html",'<div id="forgot-password" class="flex-scrollable" layout="column" ng-init="vm.onInit()">\n  <div id="forgot-password-form-wrapper" layout="column" layout-align="center center">\n    <div id="forgot-password-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n\n      <div class="title" translate="FORGOTPASSWORD.TITLE">Recover your password</div>\n\n      <form name="forgotPasswordForm" novalidate>\n        <md-input-container class="md-block" md-no-float>\n          <input type="email" name="email" ng-model="vm.form.email" placeholder="Email address" translate translate-attr-placeholder="FORGOTPASSWORD.EMAIL_ADRESS" ng-pattern="/^.+@.+\\..+$/" required>\n          <div ng-messages="forgotPasswordForm.email.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="FORGOTPASSWORD.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="FORGOTPASSWORD.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-button type="button" ng-click="vm.forgotPassword()" class="md-raised md-accent submit-button" aria-label="RESET MY PASSWORD" ng-disabled="forgotPasswordForm.$invalid || forgotPasswordForm.$pristine" translate="FORGOTPASSWORD.SEND_RESET_LINK" translate-attr-aria-label="FORGOTPASSWORD.SEND_RESET_LINK">\n          SEND RESET LINK\n        </md-button>\n      </form>\n\n      <div class="login" layout="row" layout-align="center center">\n        <a class="link" ui-sref="app.login" translate="FORGOTPASSWORD.GO_BACK">Go back to login</a>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/header/layouts/vertical-navigation/header.html",'\x3c!-- <div layout="row" layout-align="start center">\n    <ms-info-bar ng-if="vm.currentUser.role == \'admin\' && !vm.newsAlertHide" on-close="vm.newsAlertOnClose()" class="green-600-bg white-fg">\n        <div layout="row" layout-align="start center">\n            <md-icon md-font-icon="icon-message-text-outline" class="icon margin-right-10 s20"></md-icon>\n            <div flex hide-xs translate="HEADER.NEWS"></div>\n        </div>\n    </ms-info-bar>\n</div> --\x3e'),e.put("app/login/login.html",'<div id="login" class="flex-scrollable" layout="column">\n  <div id="login-form-wrapper" layout="column" layout-align="center center">\n    <div id="login-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n      \x3c!-- <img src="assets/images/logos/login.png" alt="motion_logo_login" /> --\x3e\n\n      <div class="md-subhead padding-top-45" translate="LOGIN.TITLE">Log in to your account</div>\n\n      <form name="loginForm" novalidate ng-if="!vm.progressLogin">\n        <md-input-container class="md-block" md-no-float>\n          <input type="input" name="name" ng-model="vm.form.name" autofocus aria-label="username" translate translate-attr-placeholder="LOGIN.USERNAME" required>\n          <div ng-messages="loginForm.name.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="LOGIN.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="password" ng-model="vm.form.password" aria-label="password" translate translate-attr-placeholder="LOGIN.PASSWORD" required>\n          <div ng-messages="loginForm.password.$error" role="alert" multiple>\n            <div ng-message="required">\n              <span translate="LOGIN.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <div class="remember-forgot-password" layout="row" layout-xs="column" layout-align="end center">\n          \x3c!-- <md-checkbox class="remember-me" ng-model="data.cb1" aria-label="Remember Me">\n                        <span translate="LOGIN.REMEMBER_ME">Remember Me</span>\n                    </md-checkbox> --\x3e\n          <a ui-sref="app.forgot" class="forgot-password md-accent-color" style="cursor:pointer;" translate="LOGIN.FORGOT_PASSWORD">Forgot Password?</a>\n        </div>\n\n        <b layout="row" layout-align="center center" class="md-padding" ng-if="vm.message">\n          <font color="red">{{vm.message}}</font>\n        </b>\n        <md-button type="submit" ng-click="vm.login()" class="md-raised md-accent submit-button" aria-label="LOGIN" translate="LOGIN.LOG_IN" translate-attr-aria-label="LOGIN.LOG_IN">\n          LOG IN\n        </md-button>\n      </form>\n\n      <md-progress-circular ng-if="vm.progressLogin" md-diameter="96"></md-progress-circular>\n\n      <div ng-if="vm.googleSsoEnabled || vm.adSsoEnabled" class="separator">\n        <span class="text" translate="LOGIN.OR">OR</span>\n      </div>\n\n      <md-button ng-if="vm.googleSsoEnabled" ng-click="vm.loginOauth(\'google\')" class="md-raised google">\n        <div layout="row" layout-align="center center">\n          <span>\n            <md-icon md-font-icon="fab fa-google" class="s16"></md-icon>\n            <span translate="LOGIN.WITH_GOOGLE">Log in with Google</span>\n          </span>\n        </div>\n      </md-button>\n\n      <md-button ng-if="vm.adSsoEnabled" ng-click="vm.loginAD()" class="md-raised ad">\n        <div layout="row" layout-align="center center">\n          <span>\n            <md-icon md-font-icon="fas fa-ad" class="s16"></md-icon>\n            <span style="text-transform: none" translate="LOGIN.WITH_AD">Log in with Active Directory</span>\n          </span>\n        </div>\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/analytics/views/extractedReports/create/dialog.html",'<md-dialog class="extractedReport-dialog" aria-label="New ExtractedReport">\n  <form name="extractedReportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.REPORTNAME">ReportName</label>\n        <input type="" name="name" ng-model="vm.extractedReport.name" ng-required="true" autofocus>\n\n        <div ng-messages="extractedReportForm[\'name\'].$error" ng-show="extractedReportForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.REPORTNAME_REQUIRED">ReportName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="" name="basename" ng-model="vm.extractedReport.basename" ng-required="true">\n\n        <div ng-messages="extractedReportForm[\'basename\'].$error" ng-show="extractedReportForm[\'basename\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newExtractedReport" ng-click="vm.saveExtractedReport()" class="send-button md-accent md-raised" ng-disabled="extractedReportForm.$invalid || extractedReportForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newExtractedReport" ng-click="vm.addNewExtractedReport()" class="send-button md-accent md-raised" ng-disabled="extractedReportForm.$invalid" aria-label="ADD" translate="ANALYTICS.ADD_EXTRACTEDREPORT" translate-attr-aria-label="ANALYTICS.ADD_EXTRACTEDREPORT">\n          ADD EXTRACTEDREPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newExtractedReport" ng-click="vm.deleteExtractedReport($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/extractedReports/extractedReports.html",'<div id="extractedReports" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.EXTRACTEDREPORTS">ExtractedReports</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedExtractedReports.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedExtractedReports =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-extractedReports-count">\n          <span>{{vm.selectedExtractedReports.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllExtractedReports()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectExtractedReports()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedExtractedReports" csv-label="true" filename="extractedReports.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedExtractedReports($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- EXTRACTEDREPORT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedExtractedReports" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getExtractedReports">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'ANALYTICS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'ANALYTICS.REPORTNAME\' | translate }}</th>\n                <th md-column md-order-by="basename">{{ \'ANALYTICS.NAME\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'ANALYTICS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="startDate">{{ \'ANALYTICS.DATE_RANGE_FROM\' | translate }}</th>\n                <th md-column md-order-by="endDate">{{ \'ANALYTICS.DATE_RANGE_TO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'ANALYTICS.GENERATED_AT\' | translate }}</th>\n                <th md-column md-order-by="status">{{ \'ANALYTICS.STATUS\' | translate }}</th>\n                <th md-column md-order-by="output">{{ \'ANALYTICS.OUTPUT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.extractedReports.rows.length">\n                <td md-cell colspan="10">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="extractedReport" md-select-id="id" ng-repeat="extractedReport in vm.extractedReports.rows">\n                <td md-cell ng-if="extractedReport.userpic"><img class="avatar" alt="{{extractedReport.name}}" ng-src="api/users/{{extractedReport.id}}/avatar" /></td>\n                <td md-cell ng-if="!extractedReport.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{extractedReport.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="id ">{{extractedReport.id}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="name ">{{extractedReport.name}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="basename ">{{extractedReport.basename}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="type ">{{extractedReport.type}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="startDate ">{{extractedReport.startDate | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="endDate ">{{extractedReport.endDate | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="createdAt ">{{extractedReport.createdAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="status ">{{extractedReport.status}}</td>\n                <td ng-click="vm.createOrEditExtractedReport($event, extractedReport)" md-cell class="output ">{{extractedReport.output}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(extractedReport, $event    )" translate="ANALYTICS.EDIT_EXTRACTEDREPORT">\n                          Edit ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="extractedReport.status == \'Completed\'">\n\n                        <md-button ng-click="vm.downloadfile2(extractedReport, $event  , \'analytics/extracted_reports\'   )" translate="ANALYTICS.DOWNLOAD_EXTRACTEDREPORT">\n                          Download ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(extractedReport, $event    )" translate="ANALYTICS.DELETE_EXTRACTEDREPORT">\n                          Delete ExtractedReport\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.extractedReports.count}}" md-on-paginate="vm.getExtractedReports" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / EXTRACTEDREPORT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/metrics/create/dialog.html",'<md-dialog class="metric-dialog" aria-label="New Metric">\n  <form name="metricForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.metric.name" ng-required="true" autofocus>\n\n        <div ng-messages="metricForm[\'name\'].$error" ng-show="metricForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.TABLE">Table</label>\n        <md-select name="table" ng-model="vm.metric.table" required>\n          <md-option ng-value="\'report_agent\'">Agent Report</md-option>\n          <md-option ng-value="\'report_call\'">Call Report</md-option>\n          <md-option ng-value="\'cdr\'">CDR</md-option>\n          <md-option ng-value="\'chat_websites\'">Chat Website</md-option>\n          <md-option ng-value="\'chat_interactions\'">Chat Interaction</md-option>\n          <md-option ng-value="\'chat_messages\'">Chat Messages</md-option>\n          <md-option ng-value="\'chat_offline_messages\'">Chat Offline Messages</md-option>\n          <md-option ng-value="\'chat_queues\'">Chat Queues</md-option>\n          <md-option ng-value="\'report_chat_queue\'">Chat Report Queue</md-option>\n          <md-option ng-value="\'report_chat_transfer\'">Chat Report Transfer</md-option>\n          <md-option ng-value="\'cm_companies\'">Companies</md-option>\n          <md-option ng-value="\'report_call_transfer\'">Call transfer report</md-option>\n          <md-option ng-value="\'cm_contacts\'">Contacts</md-option>\n          <md-option ng-value="\'report_square\'">CSquare Report</md-option>\n          <md-option ng-value="\'report_square_details\'">CSquare Details Report</md-option>\n          <md-option ng-value="\'report_dial\'">Dial Report</md-option>\n          <md-option ng-value="\'cm_hopper\'">Dialer Hopper Processing</md-option>\n          <md-option ng-value="\'cm_hopper_history\'">Dialer Hopper Logs</md-option>\n          <md-option ng-value="\'cm_hopper_final\'">Dialer Hopper Final</md-option>\n          <md-option ng-value="\'mail_accounts\'">Email Account</md-option>\n          <md-option ng-value="\'mail_interactions\'">Email Interaction</md-option>\n          <md-option ng-value="\'mail_messages\'">Email Messages</md-option>\n          <md-option ng-value="\'mail_queues\'">Email Queues</md-option>\n          <md-option ng-value="\'report_mail_queue\'">Email Report Queue</md-option>\n          <md-option ng-value="\'report_mail_transfer\'">Email Report Transfer</md-option>\n          <md-option ng-value="\'fax_accounts\'">Fax Account</md-option>\n          <md-option ng-value="\'fax_interactions\'">Fax Interaction</md-option>\n          <md-option ng-value="\'fax_messages\'">Fax Messages</md-option>\n          <md-option ng-value="\'fax_queues\'">Fax Queues</md-option>\n          <md-option ng-value="\'report_fax_queue\'">Fax Report Queue</md-option>\n          <md-option ng-value="\'report_fax_transfer\'">Fax Report Transfer</md-option>\n          <md-option ng-value="\'report_jscripty_sessions\'">Jscripty Sessions</md-option>\n          <md-option ng-value="\'report_jscripty_questions\'">Jscripty Questions</md-option>\n          <md-option ng-value="\'report_jscripty_answers\'">Jscripty Answers</md-option>\n          <md-option ng-value="\'cm_lists\'">Lists</md-option>\n          <md-option ng-value="\'report_member\'">Member Report</md-option>\n          <md-option ng-value="\'openchannel_accounts\'">Openchannel Account</md-option>\n          <md-option ng-value="\'openchannel_interactions\'">Openchannel Interaction</md-option>\n          <md-option ng-value="\'openchannel_messages\'">Openchannel Messages</md-option>\n          <md-option ng-value="\'openchannel_queues\'">Openchannel Queues</md-option>\n          <md-option ng-value="\'report_openchannel_queue\'">Openchannel Report Queue</md-option>\n          <md-option ng-value="\'report_openchannel_transfer\'">Openchannel Report Transfer</md-option>\n          <md-option ng-value="\'report_queue\'">Queue Report</md-option>\n          <md-option ng-value="\'sms_accounts\'">SMS Account</md-option>\n          <md-option ng-value="\'sms_interactions\'">SMS Interaction</md-option>\n          <md-option ng-value="\'sms_messages\'">SMS Messages</md-option>\n          <md-option ng-value="\'sms_queues\'">SMS Queues</md-option>\n          <md-option ng-value="\'report_sms_queue\'">SMS Report Queue</md-option>\n          <md-option ng-value="\'report_sms_transfer\'">SMS Report Transfer</md-option>\n          <md-option ng-value="\'users\'">Users</md-option>\n          <md-option ng-value="\'voice_recordings\'">Voice Recordings</md-option>\n          <md-option ng-value="\'whatsapp_accounts\'">Whatsapp Account</md-option>\n          <md-option ng-value="\'whatsapp_interactions\'">Whatsapp Interaction</md-option>\n          <md-option ng-value="\'whatsapp_messages\'">Whatsapp Messages</md-option>\n          <md-option ng-value="\'whatsapp_queues\'">Whatsapp Queues</md-option>\n          <md-option ng-value="\'report_whatsapp_queue\'">Whatsapp Report Queue</md-option>\n          <md-option ng-value="\'report_whatsapp_transfer\'">Whatsapp Report Transfer</md-option>\n        </md-select>\n        <div ng-messages="metricForm[\'table\'].$error" ng-show="metricForm[\'table\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TABLE_REQUIRED">Table field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.METRIC">Metric</label>\n        <input type="text" name="metric" ng-model="vm.metric.metric" ng-required="true">\n\n        <div ng-messages="metricForm[\'metric\'].$error" ng-show="metricForm[\'metric\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.metric.description">\n\n        <div ng-messages="metricForm[\'description\'].$error" ng-show="metricForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMetric" ng-click="vm.saveMetric()" class="send-button md-accent md-raised" ng-disabled="metricForm.$invalid || metricForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMetric" ng-click="vm.addNewMetric()" class="send-button md-accent md-raised" ng-disabled="metricForm.$invalid" aria-label="ADD" translate="ANALYTICS.ADD_METRIC" translate-attr-aria-label="ANALYTICS.ADD_METRIC">\n          ADD METRIC\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMetric" ng-click="vm.deleteMetric($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/metrics/metrics.html",'<div id="metrics" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.METRICS">Metrics</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMetrics.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMetrics =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-metrics-count">\n          <span>{{vm.selectedMetrics.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMetrics()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMetrics()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMetrics" csv-label="true" filename="metrics.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMetrics($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- METRIC TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMetrics" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMetrics">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'ANALYTICS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'ANALYTICS.NAME\' | translate }}</th>\n                <th md-column md-order-by="table">{{ \'ANALYTICS.TABLE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'ANALYTICS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.metrics.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="metric" md-select-id="id" ng-repeat="metric in vm.metrics.rows">\n                <td md-cell ng-if="metric.userpic"><img class="avatar" alt="{{metric.name}}" ng-src="api/users/{{metric.id}}/avatar" /></td>\n                <td md-cell ng-if="!metric.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{metric.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="id ">{{metric.id}}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="name ">{{metric.name}}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="table ">{{ vm.arraytable[metric.table].option }}</td>\n                <td ng-click="vm.createOrEditMetric($event, metric)" md-cell class="description ">{{metric.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(metric, $event    )" translate="ANALYTICS.EDIT_METRIC">\n                          Edit Metric\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(metric, $event    )" translate="ANALYTICS.DELETE_METRIC">\n                          Delete Metric\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.metrics.count}}" md-on-paginate="vm.getMetrics" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / METRIC TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD METRIC BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-metric-button" ng-click="vm.createOrEditMetric($event)" aria-label="add metric" translate translate-attr-aria-label="ANALYTICS.ADD_METRIC">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD METRIC BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/reports/copy/dialog.html",'<md-dialog class="report-dialog" aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.COPY_REPORT">Copy Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input name="name" ng-model="vm.report.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label translate="ANALYTICS.SELECT_NODE">Select Node</label>\n        <div js-tree="vm.treeCustomConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.copyReport()" class="send-button md-accent md-raised" ng-disabled="!vm.currentNode" aria-label="COPY" translate="ANALYTICS.COPY_REPORT" translate-attr-aria-label="ANALYTICS.COPY_REPORT">\n          COPY REPORT\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/create/dialog.html",'<md-dialog class="report-dialog" aria-label="New Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.report.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newReport">\n        <label translate="ANALYTICS.TABLE">Table</label>\n        <md-select ng-model="vm.report.table" required>\n          <md-option ng-repeat="table in vm.tables | orderBy:\'name\'" ng-value="table.name">{{table.name}}</md-option>\n        </md-select>\n        <div ng-messages="reportForm.table.$error" ng-show="reportForm.table.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TABLE_REQUIRED">Table field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.report.description">\n        <div ng-messages="reportForm.description.$error" ng-show="reportForm.description.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-autocomplete ng-if="vm.newReport" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-items="table in vm.tables | filter:vm.searchText" md-item-text="table.name" md-min-length="0" md-selected-item-change="vm.selectedTableChange(table)" placeholder="Select the table to Join">\n        <md-item-template>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{table.name}}</span>\n        </md-item-template>\n        <md-not-found>\n          No states matching "{{vm.searchText}}" were found.\n        </md-not-found>\n      </md-autocomplete>\n\n      <md-card ng-if="vm.newReport" md-theme="default" md-theme-watch ng-repeat="table in vm.joinTables">\n        <md-card-title>\n          <md-card-title-text layout="row">\n            <div layout="row" flex="50">\n              <span class="md-subhead">{{table.name}}</span>\n            </div>\n            <div layout="row" layout-align="end center" flex>\n              <md-button class="md-icon-button" ng-click="vm.removeJoin($index)">\n                <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n              </md-button>\n            </div>\n          </md-card-title-text>\n        </md-card-title>\n        <md-card-content>\n          <md-select ng-model="table.parentKey" placeholder="Select the parent key" ng-init="table.parentFields = []; vm.getFields(table, \'parentFields\', vm.report.table)" required>\n            <md-option ng-repeat="field in table.parentFields" ng-value="field">{{field}}</md-option>\n          </md-select>\n          <md-select ng-model="table.foreignKey" placeholder="Select the foreign key" ng-init="table.foreignFields = []; vm.getFields(table, \'foreignFields\', table.name)" required>\n            <md-option ng-repeat="field in table.foreignFields" ng-value="field">{{field}}</md-option>\n          </md-select>\n          <md-select ng-model="table.type" placeholder="Select join type" required>\n            <md-option ng-repeat="join in vm.joinTypes" ng-value="join.key">{{join.value}}</md-option>\n          </md-select>\n        </md-card-content>\n      </md-card>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newReport" ng-click="vm.saveReport()" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid || reportForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newReport" ng-click="vm.addNewReport()" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid || reportForm.$pristine" aria-label="ADD" translate="ANALYTICS.ADD_REPORT" translate-attr-aria-label="ANALYTICS.ADD_REPORT">\n          ADD REPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newReport" ng-click="vm.deleteReport($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/edit/condition/group.html",'<md-card class="padding-horizontal-15 padding-top-15">\n  <div layout="row" ng-if="vm_rc.crudPermissions.canEdit">\n    <md-input-container class="md-block" flex>\n      <label translate="ANALYTICS.OPERATOR">Operator</label>\n      <md-select ng-model="group.operator" required>\n        <md-option value="AND">AND</md-option>\n        <md-option value="OR">OR</md-option>\n      </md-select>\n      <div ng-messages="conditionsForm.operator.$error" ng-show="conditionsForm.operator.$touched" role="alert">\n        <div ng-message="required">\n          <span translate="ANALYTICS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n        </div>\n      </div>\n    </md-input-container>\n    <md-input-container class="md-block">\n      <md-button class="md-raised md-accent" ng-click="vm_rc.addCondition(group.rules)">\n        <md-icon md-font-icon="icon-plus"></md-icon> {{\'ANALYTICS.CONDITION\' | translate}}\n      </md-button>\n    </md-input-container>\n    <md-input-container class="md-block">\n      <md-button class="md-raised md-accent" ng-click="vm_rc.addGroup(group.rules)">\n        <md-icon md-font-icon="icon-plus"></md-icon> {{\'ANALYTICS.GROUP\' | translate}}\n      </md-button>\n    </md-input-container>\n    <div flex></div>\n    <md-input-container class="md-block" ng-if="parent">\n      <md-button class="md-raised md-warn" ng-click="vm_rc.deleteConfirm(parent, $index, $event)">\n        <md-icon md-font-icon="icon-delete"></md-icon> {{\'ANALYTICS.GROUP\' | translate}}\n      </md-button>\n    </md-input-container>\n  </div>\n  <div layout="column" ng-repeat="rule in group.rules">\n    <div layout="row" ng-if="!rule.group">\n      <md-input-container class="md-block" flex>\n        <label translate="ANALYTICS.COLUMN">COLUMN</label>\n        <md-select name="field" ng-model="rule.field" ng-disabled="!vm_rc.crudPermissions.canEdit" required>\n          <md-optgroup label="{{vm_rc.report.table}}">\n            <md-option ng-repeat="column in vm_rc.columns" value="{{vm_rc.report.table}}.{{column}}">{{column}}</md-option>\n          </md-optgroup>\n          <md-optgroup ng-if="vm_rc.report.joins" ng-repeat="join in vm_rc.report.joins" label="{{join.foreignTable}}">\n            <md-option ng-repeat="field in join.foreignTableFields" value="{{join.foreignTable}}.{{field}}">{{field}}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="conditionsForm.field.$error" ng-show="conditionsForm.field.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.COLUMN_REQUIRED">Column field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" flex>\n        <label translate="ANALYTICS.CONDITION">CONDITION</label>\n        <md-select name="condition" ng-model="rule.condition" ng-disabled="!vm_rc.crudPermissions.canEdit" required>\n          <md-option ng-repeat="condition in vm_rc.conditions" ng-value="condition">{{condition}}</md-option>\n        </md-select>\n        <div ng-messages="conditionsForm.condition.$error" ng-show="conditionsForm.condition.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm_rc.isValueByCondition(rule.condition)" class="md-block" flex>\n        <label translate="ANALYTICS.VALUE">VALUE</label>\n        <input type="text" name="value" ng-model="rule.value" ng-disabled="!vm_rc.crudPermissions.canEdit" required md-autofocus>\n        <div ng-messages="conditionsForm.value.$error" ng-show="conditionsForm.value.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm_rc.crudPermissions.canEdit" flex>\n        <md-button class="md-fab md-mini md-warn" aria-label="Delete row" ng-click="vm_rc.deleteConfirm(group.rules, $index, $event)">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </md-input-container>\n    </div>\n    <div ng-if="rule.group" ng-include="\'app/main/apps/analytics/views/reports/edit/condition/group.html\'" ng-init="parent=group.rules;index=$index;group=rule.group"></div>\n  </div>\n</md-card>'),e.put("app/main/apps/analytics/views/reports/edit/field/dialog.html",'<md-dialog class="reportField-dialog" aria-label="New Report Field">\n  <form name="reportFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{vm.title}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <pre></pre>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.reportField.type" ng-change="vm.reportField.field = undefined" required>\n          <md-option value="column">Select a column</md-option>\n          <md-option value="metric">Select an existing metric</md-option>\n          <md-option value="custom">Write a custom metric</md-option>\n        </md-select>\n        <div ng-messages="reportForm.type.$error" ng-show="reportForm.type.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-switch on="vm.reportField.type">\n        <md-input-container class="md-block" ng-switch-when="column">\n          <label translate="ANALYTICS.COLUMN">Column Name</label>\n          <md-select name="column" ng-model="vm.reportField.field" required>\n            <md-optgroup label="{{vm.report.table}}">\n              <md-option ng-repeat="column in vm.columns" value="{{vm.report.table}}.{{column}}">{{column}}</md-option>\n              \x3c!-- <md-option ng-repeat="column in vm.columns" ng-value="">{{column}}</md-option> --\x3e\n            </md-optgroup>\n            <md-optgroup ng-if="vm.report.joins" ng-repeat="join in vm.report.joins" label="{{join.foreignTable}}">\n              <md-option ng-repeat="field in join.foreignTableFields" value="{{join.foreignTable}}.{{field}}">{{field}}</md-option>\n            </md-optgroup>\n          </md-select>\n          <div ng-messages="reportForm.column.$error" ng-show="reportForm.column.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.COLUMN_REQUIRED">Column field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" ng-switch-when="metric">\n          <label translate="ANALYTICS.METRIC_NAME">Metric Name</label>\n          <md-select name="metric" ng-model="vm.reportField.MetricId" required>\n            <md-option ng-repeat="metric in vm.metrics" ng-value="metric.id">{{metric.name}}</md-option>\n          </md-select>\n          <div ng-messages="reportForm.metric.$error" ng-show="reportForm.metric.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" ng-switch-when="custom">\n          <label translate="ANALYTICS.CUSTOM_METRIC">Custom Metric</label>\n          <input type="text" name="field" ng-model="vm.reportField.field" required md-autofocus>\n          <div ng-messages="reportFieldForm.field.$error" ng-show="reportFieldForm.field.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="ANALYTICS.ERRORS.CUSTOM_METRIC_REQUIRED">Custom Metric field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.reportField.alias" ng-required="vm.reportField.type === \'custom\' || vm.reportField.type === \'metric\'">\n        <div ng-messages="reportFieldForm.alias.$error" ng-show="reportFieldForm.alias.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.reportField.type !== \'metric\'">\n        <label translate="ANALYTICS.FUNCTION">Function</label>\n        <md-select name="function" ng-model="vm.reportField.function">\n          <md-option ng-value="null">No Function</md-option>\n          <md-option ng-repeat="function in vm.sqlUtil.getFunctions" ng-value="function.value">{{function.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.reportField.type !== \'metric\'">\n        <label translate="ANALYTICS.FORMAT">Format</label>\n        <md-select name="format" ng-model="vm.reportField.format">\n          <md-option ng-value="null">No Format</md-option>\n          <md-option ng-repeat="format in vm.sqlUtil.getFormats" ng-value="format.value">{{format.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.GROUP_BY">Group By</label>\n        <md-select name="groupBy" ng-model="vm.reportField.groupBy">\n          <md-option ng-repeat="gb in vm.sqlUtil.getGroupBy" ng-value="gb.value">{{gb.value ? \'Yes\' : \'No\'}}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.ORDER_BY">Order By</label>\n        <md-select name="orderBy" ng-model="vm.reportField.orderBy">\n          <md-option ng-value="null">No Order</md-option>\n          <md-option ng-repeat="ob in vm.sqlUtil.getOrderBy" ng-value="ob.value">{{ob.value}}</md-option>\n        </md-select>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newReportField" ng-click="vm.saveReportField()" class="send-button md-accent md-raised" ng-disabled="reportFieldForm.$invalid || reportFieldForm.$pristine" aria-label="SAVE" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newReportField" ng-click="vm.addNewReportField()" class="send-button md-accent md-raised" ng-disabled="reportFieldForm.$invalid || reportFieldForm.$pristine" aria-label="ADD" translate="ANALYTICS.ADD_REPORTFIELD" translate-attr-aria-label="ANALYTICS.ADD_REPORTFIELD">\n          ADD REPORT FIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newReportField" ng-click="vm.deleteReportField($event)" aria-label="DELETE" translate translate-attr-aria-label="ANALYTICS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/edit/view.html",'<div id="analytics-report" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-reports-button md-icon-button" aria-label="Go to reports" ng-click="vm.gotoReports()" translate translate-attr-aria-label="ANALYTICS.GO_TO_ANALYTICSQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="report-image" hide-xs>\n          <img ng-src="assets/images/business/reports.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.report.id}} {{vm.report.name}}\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="ANALYTICS.CREATED_AT"></span> <span>{{vm.report.createdAt | date:\'medium\'}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span>{{vm.report.description}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveReport()" ng-disabled="generalForm.$pristine && conditionsForm.$pristine" class="send-button md-accent md-raised" translate="ANALYTICS.SAVE" translate-attr-aria-label="ANALYTICS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="ANALYTICS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="ANALYTICS.NAME">Name</label>\n                <input type="text" name="name" ng-disabled="!vm.crudPermissions.canEdit" ng-model="vm.report.name" required md-autofocus>\n                <div ng-messages="generalForm.name.$error" ng-show="generalForm.name.$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="ANALYTICS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-disabled="!vm.crudPermissions.canEdit" ng-model="vm.report.description">\n                <div ng-messages="generalForm.description.$error" ng-show="generalForm.description.$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="ANALYTICS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.FIELDS">FIELDS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container fields md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ReportFieldsController as vm_rf" ng-init="vm_rf.init(vm.report, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_rf.selectedReportFields.length">\n                <div class="md-toolbar-tools">\n                  <div layout="row" layout-align="start center">\n                    <div layout="column" layout-align="start start">\n                      <div class="md-subhead" translate="ANALYTICS.FIELDS">\n                        <span translate="ANALYTICS.FIELDS">FIELDS</span>\n                      </div>\n                      <div class="h4">\n                        <span translate="ANALYTICS.TABLE">TABLE</span> <span class="text-bold">{{vm.report.table}}</span>\n                      </div>\n                      <div class="h4" ng-if="vm.report.joins && vm.report.joins.length && vm.isArray(vm.report.joins)">\n                        <span>Join</span> <span class="text-bold">{{ vm.mapArray(vm.report.joins, \'foreignTable\') }}</span>\n                      </div>\n                    </div>\n                  </div>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm_rf.query.filter = query" on-collapse="vm_rf.query.filter = undefined" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-if="vm_rf.crudPermissions.canEdit" ng-click="vm_rf.createOrEditReportField($event)" aria-label="add field" translate translate-attr-label="ANALYTICS.ADD_FIELD">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_rf.selectedReportFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_rf.selectedReportFields.length}} {{vm_rf.selectedReportFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_rf.deleteSelectedReportFields($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table md-row-select="vm_rf.crudPermissions.canDelete" multiple ng-model="vm_rf.selectedReportFields" md-progress="vm_rf.promise">\n                  <thead md-head md-order="vm_rf.query.sort" md-on-reorder="vm_rf.getReportFields">\n                    <tr md-row>\n                      <th md-column width="10px" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-icon md-font-icon="icon-drag-vertical"></md-icon>\n                      </th>\n                      <th md-column>Type</th>\n                      <th md-column>Column or Metric</th>\n                      <th md-column>Alias</th>\n                      <th md-column>Function</th>\n                      <th md-column>Format</th>\n                      <th md-column>Group By</th>\n                      <th md-column>Order By</th>\n                      <th md-column width="10px" ng-if="vm_rf.crudPermissions.canEdit"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body ng-sortable="vm_rf.sortableTable">\n                    <tr md-row md-select="reportField" md-select-id="id" ng-repeat="reportField in vm_rf.reportFields.rows">\n                      <td md-cell class="handle" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-icon md-font-icon="icon-drag-vertical" class="s16"></md-icon>\n                      </td>\n                      <td md-cell>\n                        <div ng-if="reportField.MetricId && !reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-shape-plus s16"></div>\n                        <div ng-if="!reportField.MetricId && reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-pencil-box-outline s16"></div>\n                        <div ng-if="!reportField.MetricId && !reportField.custom" ng-click="vm_rf.createOrEditReportField($event, reportField)" class="icon icon-view-column s16"></div>\n                      </td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)">{{reportField.MetricId ? vm_rf.getMetricName(reportField.MetricId) : reportField.field}}</td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)">{{reportField.alias}}</td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.function">{{reportField.function}}</span><span ng-if="!reportField.function">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.format">{{reportField.format}}</span><span ng-if="!reportField.format">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.groupBy">YES</span><span ng-if="!reportField.groupBy">--</span></td>\n                      <td md-cell ng-click="vm_rf.createOrEditReportField($event, reportField)"><span class="text-boxed blue-bg white-fg" ng-if="reportField.orderBy">{{reportField.orderBy}}</span><span ng-if="!reportField.orderBy">--</span></td>\n                      <td md-cell class="actions" ng-if="vm_rf.crudPermissions.canEdit">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_rf.createOrEditReportField($event, reportField)" translate="ANALYTICS.EDIT_REPORTFIELD">\n                                Edit Field\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                              <md-button ng-click="vm_rf.deleteConfirm(reportField, $event)" translate="ANALYTICS.DELETE_REPORTFIELD">\n                                Delete Field\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="ANALYTICS.CONDITIONS">CONDITIONS</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container conditions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ReportConditionsController as vm_rc" ng-init="vm_rc.init(vm.report, vm.crudPermissions)">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text" translate="ANALYTICS.CONDITION">CONDITION</div>\n              </div>\n              <form name="conditionsForm" novalidate>\n                <div ng-if="vm_rc.report.condition.group" ng-include="\'app/main/apps/analytics/views/reports/edit/condition/group.html\'" ng-init="group=vm_rc.report.condition.group"></div>\n              </form>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab md-on-select="vm.previewReport()">\n        <md-tab-label>\n          <span translate="ANALYTICS.PREVIEW">PREVIEW</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container result md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n              <div ng-if="!vm.error" class="h2 secondary-text" translate="ANALYTICS.LIMITED_RESULT">LIMITED RESULT</div>\n            </div>\n            <dl ng-if="vm.error">\n              <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n              <dd>{{vm.error.sql}}</dd>\n              <dt translate="ANALYTICS.MESSAGE">Message</dt>\n              <dd>{{vm.error.msg}}</dd>\n            </dl>\n            <md-table-container ng-if="!vm.error">\n              <table md-table>\n                <thead md-head>\n                  <tr md-row>\n                    <th ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n                  </tr>\n                </thead>\n                <tbody md-body>\n                  <tr md-row ng-repeat="row in vm.rows">\n                    <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n                  </tr>\n                  <tr md-row ng-if="!vm.rows.length">\n                    <td md-cell colspan="{{vm.columns.length}}"><span translate="ANALYTICS.NO_DATA">NO DATA</span></td>\n                  </tr>\n                </tbody>\n              </table>\n            </md-table-container>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab md-on-select="vm.queryReport()">\n        <md-tab-label>\n          <span>Query</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="report-detail-form-container result md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n              <div ng-if="!vm.error" class="h2 secondary-text">SQL</div>\n            </div>\n            <dl ng-if="vm.error">\n              <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n              <dd>{{vm.error.sql}}</dd>\n              <dt translate="ANALYTICS.MESSAGE">Message</dt>\n              <dd>{{vm.error.msg}}</dd>\n            </dl>\n            <div ng-if="!vm.error">\n              {{vm.queryResult}}\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/analytics/views/reports/preview/dialog.html",'<md-dialog aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.PREVIEW_REPORT">Preview Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n          <div ng-if="!vm.error" class="h2 secondary-text" translate="ANALYTICS.LIMITED_RESULT">LIMITED RESULT</div>\n        </div>\n        <dl ng-if="vm.error">\n          <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n          <dd>{{vm.error.sql}}</dd>\n          <dt translate="ANALYTICS.MESSAGE">Message</dt>\n          <dd>{{vm.error.msg}}</dd>\n        </dl>\n        <md-table-container ng-if="!vm.error">\n          <table md-table md-progress="vm.promise">\n            <thead md-head>\n              <tr md-row>\n                <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-repeat="row in vm.rows">\n                <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n              </tr>\n              <tr md-row ng-if="!vm.rows.length">\n                <td md-cell colspan="{{vm.columns.length}}"><span translate="ANALYTICS.NO_DATA">NO DATA</span></td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div flex></div>\n      <md-button type="submit" ng-click="vm.closeDialog()" class="md-raised" aria-label="CLOSE" translate="ANALYTICS.CLOSE" translate-attr-aria-label="ANALYTICS.CLOSE">\n        CLOSE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/reports.html",'<div id="reports" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-chart-line" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="ANALYTICS.REPORTS">Reports</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedReports.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedReports =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="ANALYTICS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-reports-count">\n          <span>{{vm.selectedReports.length}}</span>\n          <span translate="ANALYTICS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="ANALYTICS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllReports()" translate="ANALYTICS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectReports()" translate="ANALYTICS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedReports" csv-label="true" filename="reports.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete && vm.currentNode.custom" class="md-icon-button" ng-click="vm.deleteSelectedReports($event)" aria-label="delete selected" translate translate-attr-label="ANALYTICS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div layout="column" flex="30">\n      <md-card class="padding-top-5 padding-horizontal-10 padding-bottom-0">\n        \x3c!-- SEARCH --\x3e\n        <div layout="row" layout-align="start center">\n          <label for="searchFolder" class="m-0">\n            <md-icon md-font-icon="icon-magnify"></md-icon>\n          </label>\n          <md-input-container md-no-float class="margin-horizontal-0 margin-bottom-0 margin-top-10" flex>\n            <input id="searchFolder" placeholder="Search folder" type="text" ng-model="vm.search" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="ANALYTICS.SEARCH_FOR_FOLDER">\n          </md-input-container>\n        </div>\n        \x3c!-- / SEARCH --\x3e\n      </md-card>\n      <md-card class="padding-10 scrollable">\n        <div js-tree="vm.treeDefaultConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n      </md-card>\n      <md-card class="padding-10 scrollable">\n        <div js-tree="vm.treeCustomConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n      </md-card>\n    </div>\n    <md-card flex="70">\n      <md-toolbar class="md-table-toolbar md-default">\n        <div class="md-toolbar-tools">\n          <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n          <p ng-if="vm.currentPath">\n            <span class="text-boxed">{{vm.currentPath}}</span>\n          </p>\n          <div flex></div>\n          <ms-search-bar on-search="vm.getReports()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300"></ms-search-bar>\n          <div flow-init flow-file-added="vm.importReport($file, $event, $flow)">\n            <md-button ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom" class="md-icon-button" aria-label="import report" translate translate-attr-label="ANALYTICS.IMPORT_REPORT" flow-btn>\n              <md-icon md-font-icon="icon-upload"></md-icon>\n            </md-button>\n          </div>\n          <md-button ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom" class="md-icon-button" ng-click="vm.createOrEditReport($event)" aria-label="add report" translate translate-attr-label="ANALYTICS.ADD_REPORT">\n            <md-icon md-font-icon="icon-plus"></md-icon>\n          </md-button>\n        </div>\n      </md-toolbar>\n      <md-table-container>\n        <table md-table md-row-select multiple ng-model="vm.selectedReports" md-progress="vm.promise">\n          <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n            <tr md-row>\n              <th md-column md-order-by="id" width="10px">{{ \'ANALYTICS.ID\' | translate }}</th>\n              <th md-column md-order-by="name">{{ \'ANALYTICS.NAME\' | translate }}</th>\n              <th md-column md-order-by="description">{{ \'ANALYTICS.DESCRIPTION\' | translate }}</th>\n              <th md-column md-order-by="createdAt">{{ \'ANALYTICS.CREATED_AT\' | translate }}</th>\n              <th md-column width="10px"></th>\n            </tr>\n          </thead>\n          <tbody md-body>\n            <tr md-row ng-hide="vm.reports.rows.length">\n              <td md-cell colspan="5">\n                <div layout="row" layout-align="center center">\n                  <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                </div>\n              </td>\n            </tr>\n            <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="id">{{report.id}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="name">{{report.name}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="description">{{report.description}}</td>\n              <td ng-click="!vm.crudPermissions.canEdit ? vm.currentNode.custom && vm.editstate(report, $event) : vm.currentNode.custom && vm.createOrEditReport($event, report)" md-cell class="createdAt">{{report.createdAt | date:\'medium\'}}</td>\n              <td md-cell class="actions">\n                <md-menu>\n                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="ANALYTICS.MORE" ng-click="$mdOpenMenu($event)">\n                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                  </md-button>\n\n                  <md-menu-content width="3">\n                    <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                      <md-button ng-click="vm.copydialog(report, $event)" translate="ANALYTICS.COPY_REPORT">\n                        Copy Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.previewdialog(report, $event)" translate="ANALYTICS.PREVIEW_REPORT">\n                        Preview Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.rundialog(report, $event)" translate="ANALYTICS.RUN_REPORT">\n                        Run Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item>\n                      <md-button ng-click="vm.downloadfile(report, $event)" translate="ANALYTICS.DOWNLOAD_JSON_REPORT">\n                        Download Json Report\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-divider ng-if="vm.crudPermissions.canEdit && vm.crudPermissions.canDelete && vm.currentNode.custom">\n                    </md-menu-divider>\n                    <md-menu-item ng-if="vm.crudPermissions.canEdit && vm.currentNode.custom">\n                      <md-button ng-click="vm.editstate(report, $event)" translate="ANALYTICS.EDIT_REPORT">\n                        Edit Report\n                      </md-button>\n                    </md-menu-item>\n\n                    <md-menu-item ng-if="vm.crudPermissions.canDelete && vm.currentNode.custom">\n                      <md-button ng-click="vm.deleteconfirm(report, $event)" translate="ANALYTICS.DELETE_REPORT">\n                        Delete Report\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </md-table-container>\n\n      <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.reports.count}}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n    </md-card>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/analytics/views/reports/run/dialog.html",'<md-dialog class="report-dialog" aria-label="Run Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.RUN_REPORT">Run Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.NAME">Name</label>\n        <input name="name" ng-model="vm.export.name" required md-autofocus>\n        <div ng-messages="reportForm.name.$error" ng-show="reportForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="ANALYTICS.FORMAT">FORMAT</label>\n        <md-select name="format" ng-model="vm.export.output" required>\n          <md-option value="csv">CSV</md-option>\n          <md-option value="xlsx">Excel (XLSX)</md-option>\n          <md-option value="pdf">PDF</md-option>\n          <md-option value="web">Web</md-option>\n        </md-select>\n        <div ng-messages="reportForm.format.$error" ng-show="reportForm.format.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="ANALYTICS.ERRORS.FORMAT_REQUIRED">Format field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div layout="row">\n        <div class="md-block" flex>\n          <mdp-date-picker mdp-open-on-click required name="dateRangeFrom" mdp-placeholder="Date Range From" mdp-format="YYYY-MM-DD" mdp-max-date="vm.dateRangeTo" ng-model="vm.export.startDate">\n            <div ng-messages="reportForm.dateRangeFrom.$error" ng-show="reportForm.dateRangeFrom.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_REQUIRED">Date Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_INVALID">Date Range From field is invalid</span>\n              </div>\n              <div ng-message="maxDate">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_MAX_INVALID">Date Range From Max field is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n        <div class="md-block" flex>\n          <mdp-date-picker mdp-open-on-click required name="dateRangeTo" mdp-placeholder="Date Range To" mdp-format="YYYY-MM-DD" mdp-min-date="vm.dateRangeFrom" ng-model="vm.export.endDate">\n            <div ng-messages="reportForm.dateRangeTo.$error" ng-show="reportForm.dateRangeTo.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_TO_REQUIRED">Date Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_TO_INVALID">Date Range From field is invalid</span>\n              </div>\n              <div ng-message="minDate">\n                <span translate="ANALYTICS.ERRORS.DATE_RANGE_FROM_MIN_INVALID">Date Range From Min field is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n      </div>\n      <div layout="row">\n        <div class="md-block" flex>\n          <mdp-time-picker required name="timeRangeFrom" mdp-placeholder="Time Range From" mdp-format="HH:mm:ss" mdp-auto-switch="true" mdp-max-date="vm.dateRangeTo" ng-model="vm.export.startTime">\n            <div ng-messages="reportForm.timeRangeFrom.$error" ng-show="reportForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_FROM_REQUIRED">Time Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex>\n          <mdp-time-picker required name="timeRangeTo" mdp-placeholder="Time Range To" mdp-format="HH:mm:ss" mdp-auto-switch="true" mdp-min-date="vm.dateRangeFrom" ng-model="vm.export.endTime">\n            <div ng-messages="reportForm.timeRangeTo.$error" ng-show="reportForm.timeRangeTo.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range From field is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="ANALYTICS.ERRORS.TIME_RANGE_TO_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.runReport($event)" class="send-button md-accent md-raised" ng-disabled="reportForm.$invalid" aria-label="RUN" translate="ANALYTICS.RUN_REPORT" translate-attr-aria-label="ANALYTICS.RUN_REPORT">\n          RUN REPORT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.refreshDate()" aria-label="REFRESH" translate translate-attr-aria-label="ANALYTICS.REFRESH">\n          <md-icon md-font-icon="icon-refresh"></md-icon>\n          <md-tooltip><span translate="ANALYTICS.REFRESH">REFRESH</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/analytics/views/reports/run/web/dialog.html",'<md-dialog class="web-dialog" aria-label="Show Report">\n  <form name="reportForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="ANALYTICS.WEB_REPORT">Web Report</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div ng-if="vm.error" class="h2 secondary-text" translate="ANALYTICS.ERROR">ERROR</div>\n        </div>\n        <dl ng-if="vm.error">\n          <dt class="text-bold" translate="ANALYTICS.QUERY_ERROR">Query Error</dt>\n          <dd>{{vm.error.sql}}</dd>\n          <dt translate="ANALYTICS.MESSAGE">Message</dt>\n          <dd>{{vm.error.msg}}</dd>\n        </dl>\n        <md-table-container ng-if="!vm.error">\n          <table md-table md-progress="vm.promise">\n            <thead md-head>\n              <tr md-row>\n                <th md-column ng-repeat="column in vm.columns">{{column.alias || column.field}}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-repeat="row in vm.results.rows">\n                <td md-cell ng-repeat="(key, value) in row">{{ vm.valueReplacer(key, value) }}</td>\n              </tr>\n              <tr md-row ng-if="!vm.results.rows.length">\n                <td md-cell colspan="{{vm.columns.length}}">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_DATA">NO DATA</span>\n                  </div>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'ANALYTICS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'ANALYTICS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'ANALYTICS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.results.count}}" md-on-paginate="vm.getResults" md-page-select></md-table-pagination>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div flex></div>\n      <md-button type="submit" ng-click="vm.closeDialog()" class="md-raised" aria-label="CLOSE" translate="ANALYTICS.CLOSE" translate-attr-aria-label="ANALYTICS.CLOSE">\n        CLOSE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/odbcs/create/dialog.html",'<md-dialog class="odbc-dialog" aria-label="New Odbc">\n  <form name="odbcForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.odbc.name" ng-required="true" autofocus>\n\n        <div ng-messages="odbcForm[\'name\'].$error" ng-show="odbcForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DSN">DSN</label>\n        <input type="text" name="dsn" ng-model="vm.odbc.dsn" ng-required="true">\n\n        <div class="hint"><span translate="CALLYSQUARE.HELP.DSN"></span></div>\n        <div ng-messages="odbcForm[\'dsn\'].$error" ng-show="odbcForm[\'dsn\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DSN_REQUIRED">DSN field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.odbc.description">\n\n        <div ng-messages="odbcForm[\'description\'].$error" ng-show="odbcForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOdbc" ng-click="vm.saveOdbc()" class="send-button md-accent md-raised" ng-disabled="odbcForm.$invalid || odbcForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOdbc" ng-click="vm.addNewOdbc()" class="send-button md-accent md-raised" ng-disabled="odbcForm.$invalid" aria-label="ADD" translate="CALLYSQUARE.ADD_ODBC" translate-attr-aria-label="CALLYSQUARE.ADD_ODBC">\n          ADD ODBC\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOdbc" ng-click="vm.deleteOdbc($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/odbcs/odbcs.html",'<div id="odbcs" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-sitemap" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.ODBC">ODBC</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedODBC.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedODBC =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-odbcs-count">\n          <span>{{vm.selectedODBC.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllODBC()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectODBC()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedODBC" csv-label="true" filename="odbcs.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedODBC($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ODBC TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedODBC" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getODBC">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CALLYSQUARE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CALLYSQUARE.NAME\' | translate }}</th>\n                <th md-column md-order-by="dsn">{{ \'CALLYSQUARE.DSN\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CALLYSQUARE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.odbcs.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="odbc" md-select-id="id" ng-repeat="odbc in vm.odbcs.rows">\n                <td md-cell ng-if="odbc.userpic"><img class="avatar" alt="{{odbc.name}}" ng-src="api/users/{{odbc.id}}/avatar" /></td>\n                <td md-cell ng-if="!odbc.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{odbc.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="id ">{{odbc.id}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="name ">{{odbc.name}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="dsn ">{{odbc.dsn}}</td>\n                <td ng-click="vm.createOrEditOdbc($event, odbc)" md-cell class="description ">{{odbc.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(odbc, $event    )" translate="CALLYSQUARE.EDIT_ODBC">\n                          Edit Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestOdbc(odbc, $event    )" translate="CALLYSQUARE.TEST_ODBC">\n                          Test Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(odbc, $event    )" translate="CALLYSQUARE.DELETE_ODBC">\n                          Delete Odbc\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.odbcs.count}}" md-on-paginate="vm.getODBC" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ODBC TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ODBC BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-odbc-button" ng-click="vm.createOrEditOdbc($event)" aria-label="add odbc" translate translate-attr-aria-label="CALLYSQUARE.ADD_ODBC">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ODBC BUTTON --\x3e\n</div>'),e.put("app/main/apps/callysquare/views/projects/create/dialog.html",'<md-dialog class="project-dialog" aria-label="New Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{vm.title | translate}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input name="name" ng-model="vm.project.name" required md-autofocus ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-disabled="!vm.newProject">\n        <div ng-messages="projectForm.name.$error" ng-show="projectForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input name="description" ng-model="vm.project.description">\n        <div ng-messages="projectForm.description.$error" ng-show="projectForm.description.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.openFromEditor" class="md-block">\n        \x3c!-- Added to check if I\'m opening the dialog directly from the square editor --\x3e\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newProject" ng-click="vm.saveProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newProject" ng-click="vm.addNewProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="ADD" translate="CALLYSQUARE.ADD_PROJECT" translate-attr-aria-label="CALLYSQUARE.ADD_PROJECT">\n          ADD PROJECT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newProject" ng-click="vm.deleteProject($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/dialog/dialog.html",'<md-dialog class="project-dialog" aria-label="New dialog" ng-init="vm.onInit()">\n  <form name="dialogForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.EDIT"></span> <span translate="CALLYSQUARE.{{vm.cellName | uppercase}}"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block" ng-repeat="attribute in vm.attributes" ng-switch="attribute.name">\n        <label translate="CALLYSQUARE.{{attribute.name | uppercase}}">{{attribute.name | ucfirst }}</label>\n\n        \x3c!--  START SELECT INPUT --\x3e\n        <md-select name="{{attribute.name}}" ng-model="attribute.value" ng-disabled="!vm.crudPermissions.canEdit" ng-switch-when-separator="|" ng-switch-when="answer|trunk_name|trunk_id|queue_id|file_id|variable_id|google_cloud_tts_text_type|google_tts_language|ispeech_tts_language|ispeech_asr_language|google_asr_language|hiddendigitspos|odbc_id|project_id|beep|account_id|interval_id|template_id|list_id|recordingFormat|callback_priority|aws_polly_voice|aws_polly_region|aws_lex_region|sms_account_id|findBy|pause_id|aws_text_type|dialogflow_language|ndagenerate_audio|ndaactivity_type|languageCode|ssmlGender|method|dialogflowV2_language" ng-required="attribute.required">\n          <md-option ng-if="attribute.defaultValue" ng-value="\'\'"> - None - </md-option>\n          <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          <md-option ng-if="!vm.values[attribute.name].length" value="-1">No {{attribute.name}} available!</md-option>\n        </md-select>\n        \x3c!--  END SELECT INPUT --\x3e\n\n        \x3c!--  START SELECT INPUT --\x3e\n        <md-select name="{{attribute.name}}" ng-model="attribute.value" ng-disabled="!vm.crudPermissions.canEdit" ng-switch-when-separator="|" ng-switch-when="sip_id" ng-required="attribute.required">\n          <md-optgroup label="{{\'CALLYSQUARE.AGENTS\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'agent\'" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{\'CALLYSQUARE.TELEPHONES\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'telephone\'" ng-disabled="v.canSelect === false">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{\'CALLYSQUARE.USERS\' | translate}}">\n            <md-option value="{{v.value}}" ng-repeat="v in vm.values[attribute.name]" ng-if="v.group === \'admin\' || v.group === \'user\'">{{v.option}}</md-option>\n          </md-optgroup>\n          <md-option ng-if="!vm.values[attribute.name].length" value="-1">No {{attribute.name}} available!</md-option>\n        </md-select>\n        \x3c!--  END SELECT INPUT --\x3e\n\n        \x3c!--  START NUMBER INPUT --\x3e\n        <div ng-switch-when="timeout">\n          <div ng-switch="vm.cellName">\n            <input ng-switch-when-separator="|" ng-switch-when="answer|ext_dial|dial|queue" type="number" step="any" name="{{attribute.name}}" min="0" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-when-separator="|" ng-switch-when="record|ispeechasr|googleasr" type="number" step="any" name="{{attribute.name}}" min="-1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-when-separator="|" ng-switch-when="restapi" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n            <input ng-switch-default type="number" step="any" name="{{attribute.name}}" min="0" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n          </div>\n        </div>\n        <input ng-switch-when-separator="|" ng-switch-when="speed" type="number" step="any" name="{{attribute.name}}" min="-10" max="-10" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        <input ng-switch-when-separator="|" ng-switch-when="maxdigit|mindigit|digit" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        <input ng-switch-when-separator="|" ng-switch-when="retry|response|hiddendigitsnum|priority" type="number" step="any" name="{{attribute.name}}" min="1" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit" string-to-number>\n        \x3c!--  END NUMBER INPUT --\x3e\n\n        \x3c!--  START TEXTAREA INPUT --\x3e\n        <textarea name="{{attribute.name}}" ng-model="attribute.value" ng-switch-when-separator="|" ng-switch-when="query|sms_text|condition|text|custom_action_data|headers|body|rawHeaders|rawBody|private_key" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit"></textarea>\n        \x3c!--  END TEXTAREA INPUT --\x3e\n\n        \x3c!-- START URL INPUT --\x3e\n        <input ng-switch-when-separator="|" ng-switch-when="ndauth_url|ndassistant_url|url" type="url" name="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required">\n        \x3c!-- END URL INPUT --\x3e\n\n        \x3c!--  START TEXT INPUT --\x3e\n        <input ng-switch-default name="{{attribute.name}}" ng-model="attribute.value" ng-required="attribute.required" ng-disabled="!vm.crudPermissions.canEdit">\n        <div class=\'hint\' ng-if="attribute.name === \'text\' && vm.cellName === \'tts\' ">\n          <span translate="CALLYSQUARE.HELP.MAX_TEXT_TTS" class="ng-scope">Max 250 chars are supported</span>\n        </div>\n        \x3c!--  END TEXT INPUT--\x3e\n\n        <div class="hint" ng-if="attribute.help">\n          <span translate="CALLYSQUARE.HELP.{{attribute.name | uppercase}}"></span>\n        </div>\n        <div ng-messages="dialogForm[attribute.name].$error" ng-show="dialogForm[attribute.name].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.FIELD_REQUIRED">The field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="vm.crudPermissions.canEdit">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="dialogForm.$invalid || dialogForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/edit/edit.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="editForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.EDIT_XML"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label>XML</label>\n        <textarea name="preproduction" ng-model="vm.project.preproduction"></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="editForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/import/import.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.IMPORT_XML"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="xml-uploader" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-file-added="vm.fileAdded($file)" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="CALLYSQUARE.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="CALLYSQUARE.DROP_TO_UPLOAD_MESSAGE">You can also drop files here to upload. Only XML - Max. 5MB</span>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog()" class="send-button md-accent md-raised" ng-disabled="importForm.$invalid" aria-label="CLOSE" translate="CALLYSQUARE.CLOSE" translate-attr-aria-label="CALLYSQUARE.CLOSE">\n          CLOSE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/info/info.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="descriptionFrom" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.UPDATE_INFO"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.DESCRIPTION">Description</label>\n        <input name="description" ng-model="vm.project.description" md-autofocus>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NOTES">Description</label>\n        <textarea name="notes" ng-model="vm.project.notes"></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.save()" class="send-button md-accent md-raised" ng-disabled="descriptionFrom.$invalid" aria-label="SAVE" translate="CALLYSQUARE.UPDATE_INFO" translate-attr-aria-label="CALLYSQUARE.UPDATE">\n          UPDATE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/open/open.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="openForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.OPEN_PROJECT"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.PROJECT">Project</label>\n        <md-select name="id" ng-model="vm.id" required>\n          <md-option value="{{p.id}}" ng-repeat="p in vm.projects">{{p.name}}</md-option>\n        </md-select>\n        <div ng-messages="openForm.id.$error" ng-show="openForm.id.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.PROJECT_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.closeDialog(true)" class="send-button md-accent md-raised" ng-disabled="openForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.OPEN_PROJECT" translate-attr-aria-label="CALLYSQUARE.OPEN">\n          OPEN\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/saveAs/saveAs.html",'<md-dialog class="project-dialog" aria-label="New dialog">\n  <form name="newForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title"><span translate="CALLYSQUARE.COPY_PROJECT"></span></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.NAME">Name</label>\n        <input name="name" ng-model="vm.project.name" required md-autofocus>\n        <div ng-messages="newForm.name.$error" ng-show="newForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.newWindow" aria-label="{{\'CALLYSQUARE.OPEN_NEW_WINDOW\' | translate }}"><span translate="CALLYSQUARE.OPEN_NEW_WINDOW"></span></md-switch>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.save()" class="send-button md-accent md-raised" ng-disabled="newForm.$invalid" aria-label="SAVE" translate="CALLYSQUARE.COPY_PROJECT" translate-attr-aria-label="CALLYSQUARE.COPY">\n          COPY\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/projects/edit/view.html",'<div id="callysquare-project" class="page-layout simple tabbed" layout="column" ng-init="vm.onInit()">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-projects-button md-icon-button" aria-label="Go to projects" ng-click="vm.gotoProjects()" translate translate-attr-aria-label="CALLYSQUARE.GO_TO_PROJECTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="project-image" hide-xs>\n          <img ng-src="assets/images/business/cprojects.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.project.id}} {{vm.project.name}}\n          </div>\n          <div class="subtitle secondary-text text-truncate">\n            <span ng-if="vm.project.description">{{vm.project.description}} - </span><span translate="CALLYSQUARE.CREATED_AT"></span> <span>{{vm.project.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-if="vm.crudPermissions.canEdit" ng-click="vm.updateInfo($event)" class="md-fab md-yellow-700-bg md-icon-button" aria-label="edit">\n        <md-icon md-font-icon="icon-tooltip-edit"></md-icon>\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <md-content class="callysquare-content">\n\n    <div id="geEditor" class="geEditor"></div>\n\n  </md-content>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/callysquare/views/projects/projects.html",'<div id="projects" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-vector-square" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.PROJECTS">Projects</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    \x3c!-- SEARCH --\x3e\n    <div class="search-input-wrapper" layout="row" layout-align="start center">\n      <label for="search">\n        <md-icon md-font-icon="icon-magnify"></md-icon>\n      </label>\n      <md-input-container md-no-float class="m-0">\n        <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n      </md-input-container>\n    </div>\n    \x3c!-- / SEARCH --\x3e\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedProjects.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedProjects =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-projects-count">\n          <span>{{vm.selectedProjects.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllProjects()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectProjects()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedProjects" csv-label="true" filename="projects.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedProjects($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      \x3c!-- PROJECT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedProjects" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getProjects">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'CALLYSQUARE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CALLYSQUARE.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CALLYSQUARE.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="notes">{{ \'CALLYSQUARE.NOTES\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.projects.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="project" md-select-id="id" ng-repeat="project in vm.projects.rows">\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="id ">{{project.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="name ">{{project.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="description ">{{project.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="notes ">{{project.notes}}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(project, ev)" translate="CALLYSQUARE.EDIT_PROJECT">\n                          Edit Project\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(project, ev)" translate="CALLYSQUARE.DELETE_PROJECT">\n                          Delete Project\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.projects.count}}" md-on-paginate="vm.getProjects" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PROJECT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PROJECT BUTTON --\x3e\n  <md-button class="md-fab md-accent md-icon-button" id="add-project-button" ng-if="vm.crudPermissions.canEdit" ng-click="vm.createOrEditProject($event)" aria-label="add project" translate translate-attr-aria-label="CALLYSQUARE.ADD_PROJECT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PROJECT BUTTON --\x3e\n\n</div>'),e.put("app/main/apps/callysquare/views/squareRecordings/create/dialog.html",'<md-dialog class="squareRecording-dialog" aria-label="New SquareRecording">\n  <form name="squareRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CALLYSQUARE.FILENAME">Filename</label>\n        <input type="" name="filename" ng-model="vm.squareRecording.filename" ng-required="true" autofocus>\n\n        <div ng-messages="squareRecordingForm[\'filename\'].$error" ng-show="squareRecordingForm[\'filename\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CALLYSQUARE.ERRORS.FILENAME_REQUIRED">Filename field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSquareRecording" ng-click="vm.saveSquareRecording()" class="send-button md-accent md-raised" ng-disabled="squareRecordingForm.$invalid || squareRecordingForm.$pristine" aria-label="SAVE" translate="CALLYSQUARE.SAVE" translate-attr-aria-label="CALLYSQUARE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSquareRecording" ng-click="vm.addNewSquareRecording()" class="send-button md-accent md-raised" ng-disabled="squareRecordingForm.$invalid" aria-label="ADD" translate="CALLYSQUARE.ADD_SQUARERECORDING" translate-attr-aria-label="CALLYSQUARE.ADD_SQUARERECORDING">\n          ADD SQUARERECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSquareRecording" ng-click="vm.deleteSquareRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="CALLYSQUARE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CALLYSQUARE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/callysquare/views/squareRecordings/squareRecordings.html",'<div id="squareRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-sitemap" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CALLYSQUARE.SQUARERECORDINGS">SquareRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CALLYSQUARE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSquareRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSquareRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CALLYSQUARE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-squareRecordings-count">\n          <span>{{vm.selectedSquareRecordings.length}}</span>\n          <span translate="CALLYSQUARE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CALLYSQUARE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSquareRecordings()" translate="CALLYSQUARE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSquareRecordings()" translate="CALLYSQUARE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSquareRecordings" csv-label="true" filename="squareRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSquareRecordings($event)" aria-label="delete selected" translate translate-attr-label="CALLYSQUARE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SQUARERECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSquareRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSquareRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="filename">{{ \'CALLYSQUARE.FILENAME\' | translate }}</th>\n                <th md-column md-order-by="projectName">{{ \'CALLYSQUARE.PROJECT\' | translate }}</th>\n                <th md-column md-order-by="uniqueid">{{ \'CALLYSQUARE.UNIQUEID\' | translate }}</th>\n                <th md-column md-order-by="callerid">{{ \'CALLYSQUARE.PHONE\' | translate }}</th>\n                <th md-column md-order-by="extension">{{ \'CALLYSQUARE.EXTEN\' | translate }}</th>\n                <th md-column>{{ \'CALLYSQUARE.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'CALLYSQUARE.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.squareRecordings.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CALLYSQUARE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="squareRecording" md-select-id="id" ng-repeat="squareRecording in vm.squareRecordings.rows">\n                <td md-cell ng-if="squareRecording.userpic"><img class="avatar" alt="{{squareRecording.name}}" ng-src="api/users/{{squareRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!squareRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{squareRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="filename ">{{squareRecording.filename}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="projectName ">{{squareRecording.projectName}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="uniqueid ">{{squareRecording.uniqueid}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="callerid ">{{squareRecording.callerid}}</td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="extension ">{{squareRecording.extension}}</td>\n                <td md-cell class="audio " ng-switch="squareRecording.format">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording ng-switch-when=".wav" id="squareRecording.id" model="\'squareRecording\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                  <span ng-switch-when=".gsm|.WAV" ng-switch-when-separator="|">\n                    <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n                  </span>\n                </td>\n                <td ng-click="vm.createOrEditSquareRecording($event, squareRecording)" md-cell class="createdAt ">{{squareRecording.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CALLYSQUARE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadCallySquareRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(squareRecording, $event  , \'square/recordings\'   )" translate="CALLYSQUARE.DOWNLOAD_SQUARERECORDING">\n                          Download SquareRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(squareRecording, $event    )" translate="CALLYSQUARE.DELETE_SQUARERECORDING">\n                          Delete SquareRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CALLYSQUARE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CALLYSQUARE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CALLYSQUARE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.squareRecordings.count}}" md-on-paginate="vm.getSquareRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SQUARERECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatQueues/chatQueues.html",'<div id="chatQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-hangouts" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CHAT.CHATQUEUES">ChatQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CHAT.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChatQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChatQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CHAT.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chatQueues-count">\n          <span>{{vm.selectedChatQueues.length}}</span>\n          <span translate="CHAT.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CHAT.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChatQueues()" translate="CHAT.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChatQueues()" translate="CHAT.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChatQueues" csv-label="true" filename="chatQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChatQueues($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHATQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChatQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'CHAT.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chatQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chatQueue" md-select-id="id" ng-repeat="chatQueue in vm.chatQueues.rows">\n                <td md-cell ng-if="chatQueue.userpic"><img class="avatar" alt="{{chatQueue.name}}" ng-src="api/users/{{chatQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!chatQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chatQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="id ">{{chatQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="name ">{{chatQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatQueue, ev) : vm.createOrEditChatQueue($event, chatQueue)" md-cell class="strategy ">{{ vm.arraystrategy[chatQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(chatQueue, $event    )" translate="CHAT.EDIT_CHATQUEUE">\n                          Edit ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(chatQueue, $event    )" translate="CHAT.TEAMADD_CHATQUEUE">\n                          teamadd ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(chatQueue, $event    )" translate="CHAT.AGENTADD_CHATQUEUE">\n                          agentadd ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chatQueue, $event    )" translate="CHAT.DELETE_CHATQUEUE">\n                          Delete ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(chatQueue, $event    )" translate="CHAT.GOTOREALTIME_CHATQUEUE">\n                          goToRealtime ChatQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatQueues.count}}" md-on-paginate="vm.getChatQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHATQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHATQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chatQueue-button" ng-click="vm.createOrEditChatQueue($event)" aria-label="add chatQueue" translate translate-attr-aria-label="CHAT.ADD_CHATQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHATQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatQueues/create/dialog.html",'<md-dialog class="chatQueue-dialog" aria-label="New ChatQueue">\n  <form name="chatQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chatQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newChatQueue">\n\n        <div class="hint"><span translate="CHAT.HELP.NAME"></span></div>\n        <div ng-messages="chatQueueForm[\'name\'].$error" ng-show="chatQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="CHAT.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.chatQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="chatQueueForm[\'strategy\'].$error" ng-show="chatQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.chatQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="chatQueueForm[\'timeout\'].$error" ng-show="chatQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatQueue.description">\n\n        <div ng-messages="chatQueueForm[\'description\'].$error" ng-show="chatQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatQueue" ng-click="vm.saveChatQueue()" class="send-button md-accent md-raised" ng-disabled="chatQueueForm.$invalid || chatQueueForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatQueue" ng-click="vm.addNewChatQueue()" class="send-button md-accent md-raised" ng-disabled="chatQueueForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATQUEUE" translate-attr-aria-label="CHAT.ADD_CHATQUEUE">\n          ADD CHATQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatQueue" ng-click="vm.deleteChatQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/agentadd/agentadd.html",'<md-dialog class="chatQueue-dialog" aria-label="chatQueue" ng-init="vm.onInit()">\n  <form name="chatQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.AGENTADD_CHATQUEUE">Add Agent to chatQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/teamadd/teamadd.html",'<md-dialog class="chatQueue-dialog" aria-label="chatQueue" ng-init="vm.onInit()">\n  <form name="chatQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatQueues/edit/view.html",'<div id="chat-chatQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-chatQueues-button md-icon-button" aria-label="Go to chatQueues" ng-click="vm.gotoChatQueues()" translate translate-attr-aria-label="CHAT.GO_TO_CHATQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="chatQueue-image" hide-xs>\n          <img ng-src="assets/images/business/chatQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.chatQueue.id}}\n            <span ng-if="vm.chatQueue.name">{{vm.chatQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CHAT.CREATED_AT"></span> <span>{{vm.chatQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.chatQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="CHAT.TEAMADD_CHATQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.chatQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CHAT.AGENTADD_CHATQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveChatQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.chatQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="CHAT.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="CHAT.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.chatQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.chatQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.chatQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/chat/views/chatWebsites/chatWebsites.html",'<div id="chatWebsites" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-hangouts" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CHAT.CHATWEBSITES">ChatWebsites</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CHAT.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChatWebsites.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChatWebsites =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CHAT.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chatWebsites-count">\n          <span>{{vm.selectedChatWebsites.length}}</span>\n          <span translate="CHAT.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CHAT.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChatWebsites()" translate="CHAT.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChatWebsites()" translate="CHAT.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChatWebsites" csv-label="true" filename="chatWebsites.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChatWebsites($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHATWEBSITE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChatWebsites" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatWebsites">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'CHAT.KEY\' | translate }}</th>\n                <th md-column md-order-by="address">{{ \'CHAT.MOTIONADDRESS\' | translate }}</th>\n                <th md-column md-order-by="remote">{{ \'CHAT.MOTIONPROXY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chatWebsites.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chatWebsite" md-select-id="id" ng-repeat="chatWebsite in vm.chatWebsites.rows">\n                <td md-cell ng-if="chatWebsite.userpic"><img class="avatar" alt="{{chatWebsite.name}}" ng-src="api/users/{{chatWebsite.id}}/avatar" /></td>\n                <td md-cell ng-if="!chatWebsite.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chatWebsite.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="id ">{{chatWebsite.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="name ">{{chatWebsite.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="key ">{{chatWebsite.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="address ">{{chatWebsite.address}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="remote ">{{chatWebsite.remote}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chatWebsite, ev) : vm.createOrEditChatWebsite($event, chatWebsite)" md-cell class="description ">{{chatWebsite.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(chatWebsite, $event    )" translate="CHAT.EDIT_CHATWEBSITE">\n                          Edit ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(chatWebsite, $event    )" translate="CHAT.INTERACTIONS_CHATWEBSITE">\n                          Interactions ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.offlinemessagesgoto(chatWebsite, $event    )" translate="CHAT.OFFLINEMESSAGES_CHATWEBSITE">\n                          OfflineMessages ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(chatWebsite, $event    )" translate="CHAT.AGENTADD_CHATWEBSITE">\n                          AgentAdd ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chatWebsite, $event    )" translate="CHAT.DELETE_CHATWEBSITE">\n                          Delete ChatWebsite\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatWebsites.count}}" md-on-paginate="vm.getChatWebsites" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHATWEBSITE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHATWEBSITE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chatWebsite-button" ng-click="vm.createOrEditChatWebsite($event)" aria-label="add chatWebsite" translate translate-attr-aria-label="CHAT.ADD_CHATWEBSITE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHATWEBSITE BUTTON --\x3e\n</div>'),e.put("app/main/apps/chat/views/chatWebsites/create/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chatWebsite.name" ng-required="true" autofocus ng-disabled="!vm.newChatWebsite">\n\n        <div ng-messages="chatWebsiteForm[\'name\'].$error" ng-show="chatWebsiteForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.chatWebsite.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="chatWebsiteForm[\'key\'].$error" ng-show="chatWebsiteForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONADDRESS">MotionAddress</label>\n        <input type="url" name="address" ng-model="vm.chatWebsite.address" md-maxlength="255" ng-required="true">\n\n        <div ng-messages="chatWebsiteForm[\'address\'].$error" ng-show="chatWebsiteForm[\'address\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_REQUIRED">MotionAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_MUST_VALID_URL">MotionAddress must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.MOTIONADDRESS_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionAddress must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.chatWebsite.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="CHAT.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="chatWebsiteForm[\'remote\'].$error" ng-show="chatWebsiteForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.chatWebsite.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="CHAT.HELP.LIST"></span></div>\n        <div ng-messages="chatWebsiteForm[\'ListId\'].$error" ng-show="chatWebsiteForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.chatWebsite.IntervalId">\n          <md-option ng-value="null">Always</md-option>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteForm[\'IntervalId\'].$error" ng-show="chatWebsiteForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatWebsite.description">\n\n        <div ng-messages="chatWebsiteForm[\'description\'].$error" ng-show="chatWebsiteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatWebsite" ng-click="vm.saveChatWebsite()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteForm.$invalid || chatWebsiteForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatWebsite" ng-click="vm.addNewChatWebsite()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATWEBSITE" translate-attr-aria-label="CHAT.ADD_CHATWEBSITE">\n          ADD CHATWEBSITE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatWebsite" ng-click="vm.deleteChatWebsite($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/agentadd/agentadd.html",'<md-dialog class="chatWebsite-dialog" aria-label="chatWebsite" ng-init="vm.onInit()">\n  <form name="chatWebsiteForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CHAT.AGENTADD_CHATWEBSITE">Add Agent to chatWebsite</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/agent/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'agent\'].$error" ng-show="chatWebsiteFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'timeout\'].$error" ng-show="chatWebsiteFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/amazonlex/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'accesskeyid\'].$error" ng-show="chatWebsiteFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'secretaccesskey\'].$error" ng-show="chatWebsiteFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'lexregion\'].$error" ng-show="chatWebsiteFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'botname\'].$error" ng-show="chatWebsiteFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/autoreply/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'times\'].$error" ng-show="chatWebsiteFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="chatWebsiteFormApp[\'text\'].$error" ng-show="chatWebsiteFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/close/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'disposition\'].$error" ng-show="chatWebsiteFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/dialogflow/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'key\'].$error" ng-show="chatWebsiteFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'language\'].$error" ng-show="chatWebsiteFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'projectId\'].$error" ng-show="chatWebsiteFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'clientEmail\'].$error" ng-show="chatWebsiteFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="chatWebsiteFormApp[\'privateKey\'].$error" ng-show="chatWebsiteFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'language\'].$error" ng-show="chatWebsiteFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="CHAT.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="chatWebsiteFormApp[\'welcomemessage\'].$error" ng-show="chatWebsiteFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="CHAT.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/gotoif/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'condition\'].$error" ng-show="chatWebsiteFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'truepriority\'].$error" ng-show="chatWebsiteFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'falsepriority\'].$error" ng-show="chatWebsiteFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/gotop/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'priority\'].$error" ng-show="chatWebsiteFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/noop/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'value\'].$error" ng-show="chatWebsiteFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/queue/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'queue\'].$error" ng-show="chatWebsiteFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'timeout\'].$error" ng-show="chatWebsiteFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/system/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'command\'].$error" ng-show="chatWebsiteFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'variable\'].$error" ng-show="chatWebsiteFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/tag/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="chatWebsiteFormApp[\'tag\'].$error" ng-show="chatWebsiteFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/apps/tvox/dialog.html",'<md-dialog class="chatWebsite-dialog" aria-label="New ChatWebsite">\n  <form name="chatWebsiteFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.SERVICEID">serviceid</label>\n        <input type="text" name="serviceid" ng-model="vm.tvox.serviceid" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'serviceid\'].$error" ng-show="chatWebsiteFormApp[\'serviceid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SERVICEID_REQUIRED">serviceid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.CHANNELID">channelid</label>\n        <input type="text" name="channelid" ng-model="vm.tvox.channelid" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'channelid\'].$error" ng-show="chatWebsiteFormApp[\'channelid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.CHANNELID_REQUIRED">channelid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXURL">tvoxurl</label>\n        <input type="text" name="tvoxurl" ng-model="vm.tvox.tvoxurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXURL_REQUIRED">tvoxurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXLOGINURL">tvoxloginurl</label>\n        <input type="text" name="tvoxloginurl" ng-model="vm.tvox.tvoxloginurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxloginurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxloginurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXLOGINURL_REQUIRED">tvoxloginurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXSESSIONURL">tvoxsessionurl</label>\n        <input type="text" name="tvoxsessionurl" ng-model="vm.tvox.tvoxsessionurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxsessionurl\'].$error" ng-show="chatWebsiteFormApp[\'tvoxsessionurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXSESSIONURL_REQUIRED">tvoxsessionurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXUSERNAME">tvoxusername</label>\n        <input type="text" name="tvoxusername" ng-model="vm.tvox.tvoxusername" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'tvoxusername\'].$error" ng-show="chatWebsiteFormApp[\'tvoxusername\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TVOXUSERNAME_REQUIRED">tvoxusername field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TVOXPASSWD">tvoxpasswd</label>\n        <input type="password" name="tvoxpasswd" ng-model="vm.tvox.tvoxpasswd" placeholder="Password" translate translate-attr-placeholder="CHAT.PASSWORD">\n        <div ng-messages="chatWebsiteFormApp[\'tvoxpasswd\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="CHAT.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURLONRING">motionurlonring</label>\n        <input type="text" name="motionurlonring" ng-model="vm.tvox.motionurlonring" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurlonring\'].$error" ng-show="chatWebsiteFormApp[\'motionurlonring\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURLONRING_REQUIRED">motionurlonring field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURLONANSWER">motionurlonanswer</label>\n        <input type="text" name="motionurlonanswer" ng-model="vm.tvox.motionurlonanswer" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurlonanswer\'].$error" ng-show="chatWebsiteFormApp[\'motionurlonanswer\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURLONANSWER_REQUIRED">motionurlonanswer field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONTITLE">motiontitle</label>\n        <input type="text" name="motiontitle" ng-model="vm.tvox.motiontitle" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motiontitle\'].$error" ng-show="chatWebsiteFormApp[\'motiontitle\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONTITLE_REQUIRED">motiontitle field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.MOTIONURL">motionurl</label>\n        <input type="text" name="motionurl" ng-model="vm.tvox.motionurl" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="chatWebsiteFormApp[\'motionurl\'].$error" ng-show="chatWebsiteFormApp[\'motionurl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.MOTIONURL_REQUIRED">motionurl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveChatWebsiteApp()" class="send-button md-accent md-raised" ng-disabled="chatWebsiteFormApp.$invalid || chatWebsiteFormApp.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/chatCannedAnswers/dialog.html",'<md-dialog class="chatCannedAnswer-dialog" aria-label="New ChatCannedAnswer">\n  <form name="chatCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.chatCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="chatCannedAnswerForm[\'key\'].$error" ng-show="chatCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.chatCannedAnswer.value" required></textarea>\n\n        <div ng-messages="chatCannedAnswerForm[\'value\'].$error" ng-show="chatCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chatCannedAnswer.description">\n\n        <div ng-messages="chatCannedAnswerForm[\'description\'].$error" ng-show="chatCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatCannedAnswer" ng-click="vm.saveChatCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="chatCannedAnswerForm.$invalid || chatCannedAnswerForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatCannedAnswer" ng-click="vm.addNewChatCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="chatCannedAnswerForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATCANNEDANSWER" translate-attr-aria-label="CHAT.ADD_CHATCANNEDANSWER">\n          ADD CHATCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatCannedAnswer" ng-click="vm.deleteChatCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/offlineMessages/dialog.html",'<md-dialog class="offlineMessage-dialog" aria-label="New OfflineMessage">\n  <md-toolbar class="md-accent md-hue-2">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ vm.title | translate }}</span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-content flex layout-padding>\n    <pre ng-if="vm.isHtml">{{vm.message.body}}</pre>\n    <div ng-if="!vm.isHtml" ng-bind-html-unsafe="vm.message.body"></div>\n\n    <span ng-repeat="attachment in vm.attachments">\n      <md-button class="md-icon-button no-margin no-padding" ng-click="vm.download(attachment)">\n        <md-icon class="no-margin material-icons" aria-label="Attachment">attach_file</md-icon>\n      </md-button>\n      <span>{{attachment.name}}</span><br />\n    </span>\n  </md-content>\n\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/proactive/dialog.html",'<md-dialog class="chatProactiveAction-dialog" aria-label="New ChatProactiveAction">\n  <form name="chatProactiveActionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CHAT.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.chatProactiveAction.name" ng-required="true" autofocus>\n\n        <div ng-messages="chatProactiveActionForm[\'name\'].$error" ng-show="chatProactiveActionForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CHAT.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.chatProactiveAction.type">\n\n          <md-option ng-value="\'mouseOver\'"> {{ \'CHAT.MOUSEOVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'timeout\'"> {{ \'CHAT.TIMEOUT\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="chatProactiveActionForm[\'type\'].$error" ng-show="chatProactiveActionForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.chatProactiveAction.type === \'mouseOver\'" class="md-block">\n        <label translate="CHAT.SELECTOR">Selector</label>\n        <input type="" name="selector" ng-model="vm.chatProactiveAction.selector" ng-required="true">\n\n        <div ng-messages="chatProactiveActionForm[\'selector\'].$error" ng-show="chatProactiveActionForm[\'selector\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.SELECTOR_REQUIRED">Selector field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.chatProactiveAction.type === \'timeout\'" class="md-block">\n        <label translate="CHAT.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.chatProactiveAction.timeout" min="1" ng-required="true">\n\n        <div ng-messages="chatProactiveActionForm[\'timeout\'].$error" ng-show="chatProactiveActionForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="CHAT.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newChatProactiveAction" ng-click="vm.saveChatProactiveAction()" class="send-button md-accent md-raised" ng-disabled="chatProactiveActionForm.$invalid || chatProactiveActionForm.$pristine" aria-label="SAVE" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newChatProactiveAction" ng-click="vm.addNewChatProactiveAction()" class="send-button md-accent md-raised" ng-disabled="chatProactiveActionForm.$invalid" aria-label="ADD" translate="CHAT.ADD_CHATPROACTIVEACTION" translate-attr-aria-label="CHAT.ADD_CHATPROACTIVEACTION">\n          ADD CHATPROACTIVEACTION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newChatProactiveAction" ng-click="vm.deleteChatProactiveAction($event)" aria-label="DELETE" translate translate-attr-aria-label="CHAT.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CHAT.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/chat/views/chatWebsites/edit/view.html",'<div id="chat-chatWebsite" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-chatWebsites-button md-icon-button" aria-label="Go to chatWebsites" ng-click="vm.gotoChatWebsites()" translate translate-attr-aria-label="CHAT.GO_TO_CHATWEBSITES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="chatWebsite-image" hide-xs>\n          <img ng-src="assets/images/business/chatWebsites.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.chatWebsite.id}}\n            <span ng-if="vm.chatWebsite.name">{{vm.chatWebsite.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CHAT.CREATED_AT"></span> <span>{{vm.chatWebsite.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.chatWebsite, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CHAT.AGENTADD_CHATWEBSITE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveChatWebsite()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (scriptForm.$invalid) || (intervalForm.$invalid) || (dispositionForm.$invalid) || (appearanceForm.$invalid) || (onlinestatusForm.$invalid) || (offlinestatusForm.$invalid) || (closingformForm.$invalid) || (unmanagedstatusForm.$invalid) || (interactionForm.$invalid) || (whitelabelForm.$invalid) || (logoForm.$invalid) || (agentAvatarForm.$invalid) || (customerAvatarForm.$invalid) || (systemAvatarForm.$invalid) || (chatFormOnlineForm.$invalid) || (chatFormOfflineForm.$invalid) || (proactiveForm.$invalid) || (chatDispositionsForm.$invalid) || (chatCannedAnswersForm.$invalid) || (vidaooForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid) || (offlineMessagesForm.$invalid)" translate="CHAT.SAVE" translate-attr-aria-label="CHAT.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.chatWebsite.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.chatWebsite.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MOTIONADDRESS">MotionAddress</label>\n                <input type="url" name="address" ng-model="vm.chatWebsite.address" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'address\'].$error" ng-show="generalForm[\'address\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_REQUIRED">MotionAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_MUST_VALID_URL">MotionAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.MOTIONADDRESS_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionAddress must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.chatWebsite.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.fidelity" class="md-block">\n                <label translate="CHAT.TIMEOUT">Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.chatWebsite.timeout" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.chatWebsite.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.chatWebsite.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.chatWebsite.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="CHAT.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.chatWebsite.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.queueTransfer == true" class="md-block">\n                <label translate="CHAT.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.chatWebsite.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.agentTransfer == true" class="md-block">\n                <label translate="CHAT.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.chatWebsite.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container script md-background-bg md-whiteframe-1dp">\n            <form name="scriptForm" flex="100" novalidate>\n              <div ng-controller="ChatWebsiteScriptController as vm_ac" ng-init="vm_ac.init(vm.chatWebsite)" class="content" md-background-bg>\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text" translate="CHAT.SCRIPT">SCRIPT</div>\n                </div>\n\n\n                <md-input-container class="md-block">\n                  <label translate="CHAT.TOKEN">Token</label>\n                  <input type="text" name="token" ng-model="vm_ac.chatWebsite.token" autofocus ng-disabled="true">\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="CHAT.MOTIONPROXY">MotionProxy</label>\n                  <input type="url" name="remote" ng-model="vm_ac.chatWebsite.remote" required>\n                  <div class="hint"><span translate="CHAT.HELP.MOTIONPROXY"></span></div>\n                  <div ng-messages="scriptForm[\'remote\'].$error" ng-show="scriptForm[\'remote\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="CHAT.ERRORS.MOTIONPROXY_REQUIRED">Motion Proxy field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="CHAT.ERRORS.MOTIONPROXY_MUST_VALID_URL">Motion Proxy must be a valid url e.g.: http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="CHAT.WEBSITESCRIPT">WebsiteScript</label>\n                  <div>\n                    <pre style="font-size: 13px;">\n                    {{vm_ac.start}} {{vm_ac.script}} {{vm_ac.end}}\n                    </pre>\n                  </div>\n                  <div class="hint"><span translate="CHAT.HELP.COPYSCRIPTTOCLIPBOARD"></span></div>\n                </md-input-container>\n\n              </div>\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container interval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.INTERVAL">INTERVAL</div>\n            </div>\n            <form name="intervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.chatWebsite.IntervalId" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Always</md-option>\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="intervalForm[\'IntervalId\'].$error" ng-show="intervalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.TIMEZONE">Timezone</label>\n                <ms-timezone name="timezone" ng-model="vm.chatWebsite.timezone" ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="CHAT.HELP.TIMEZONE"></span></div>\n                <div ng-messages="intervalForm[\'timezone\'].$error" ng-show="intervalForm[timezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.mandatoryDisposition" class="md-block">\n                <label translate="CHAT.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.chatWebsite.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.SNIPPET">SNIPPET</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container appearance md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.APPEARANCE">APPEARANCE</div>\n            </div>\n            <form name="appearanceForm" novalidate>\n              <div flex md-color-picker ng-model="vm.chatWebsite.color" label="{{\'CHAT.MAINCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.color_button" label="{{\'CHAT.BUTTONCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.textColor" label="{{\'CHAT.TEXTCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.textButtonColor" label="{{\'CHAT.TEXT_BUTTON_COLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <div flex md-color-picker ng-model="vm.chatWebsite.backgroundColor" label="{{\'CHAT.BACKGROUNDCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FONTSIZE">fontSize</label>\n                <input type="number" name="fontSize" ng-model="vm.chatWebsite.fontSize" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'fontSize\'].$error" ng-show="appearanceForm[\'fontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FONTSIZE_REQUIRED">fontSize field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.FONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">fontSize must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADERSHAPE">headershape</label>\n                <md-select name="header_shape" ng-model="vm.chatWebsite.header_shape" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'rounded\'"> {{ \'CHAT.ROUNDED\' | translate }} </md-option>\n\n                  <md-option ng-value="\'squared\'"> {{ \'CHAT.SQUARED\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'header_shape\'].$error" ng-show="appearanceForm[\'header_shape\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADERSHAPE_REQUIRED">headershape field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.showAgentAvatar" aria-label="ShowAgentAvatar" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.SHOWAGENTAVATAR">ShowAgentAvatar</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.showCustomerAvatar" aria-label="showCustomerAvatar" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.SHOWCUSTOMERAVATAR">showCustomerAvatar</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SNIPPETSWIPEOUT">snippetSwipeOut</label>\n                <md-select name="alignment" ng-model="vm.chatWebsite.alignment" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'bottom_right\'"> {{ \'CHAT.BOTTOM_RIGHT\' | translate }} </md-option>\n\n                  <md-option ng-value="\'right\'"> {{ \'CHAT.RIGHT\' | translate }} </md-option>\n\n                  <md-option ng-value="\'left\'"> {{ \'CHAT.LEFT\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'alignment\'].$error" ng-show="appearanceForm[\'alignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SNIPPETSWIPEOUT_REQUIRED">snippetSwipeOut field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.alignment !== \'bottom_right\'" class="md-block">\n                <label translate="CHAT.VERTICALPOSITION">verticalPosition</label>\n                <input type="number" name="verticalAlignment" ng-model="vm.chatWebsite.verticalAlignment" min="0" max="100" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="CHAT.HELP.VERTICALPOSITION"></span></div>\n                <div ng-messages="appearanceForm[\'verticalAlignment\'].$error" ng-show="appearanceForm[\'verticalAlignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_REQUIRED">verticalPosition field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">verticalPosition must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.VERTICALPOSITION_MUST_BE_LESS_THAN_OR_EQUAL_TO">verticalPosition must be a valid greater or equal than</span> <span>100</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MESSAGESALIGNMENT">messagesAlignment</label>\n                <md-select name="messagesAlignment" ng-model="vm.chatWebsite.messagesAlignment" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'alternate\'"> {{ \'CHAT.ALTERNATE\' | translate }} </md-option>\n\n                  <md-option ng-value="\'centered\'"> {{ \'CHAT.CENTERED\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="appearanceForm[\'messagesAlignment\'].$error" ng-show="appearanceForm[\'messagesAlignment\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MESSAGESALIGNMENT_REQUIRED">messagesAlignment field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.DEFAULTTITLE">defaultTitle</label>\n                <input type="text" name="defaultTitle" ng-model="vm.chatWebsite.defaultTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'defaultTitle\'].$error" ng-show="appearanceForm[\'defaultTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.DEFAULTTITLE_REQUIRED">defaultTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.DEFAULTTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>defaultTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.LABELTEXT">labelText</label>\n                <input type="text" name="labelText" ng-model="vm.chatWebsite.labelText" md-maxlength="6" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="appearanceForm[\'labelText\'].$error" ng-show="appearanceForm[\'labelText\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.LABELTEXT_REQUIRED">labelText field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.LABELTEXT_MAX_LENGTH" translate-values=\'{max: 6}\'>labelText\n                      must have a maximum length equal to 6</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container onlinestatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.ONLINESTATUS">ONLINESTATUS</div>\n            </div>\n            <form name="onlinestatusForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADER_ONLINE">header_online</label>\n                <input type="text" name="header_online" ng-model="vm.chatWebsite.header_online" md-maxlength="255" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="onlinestatusForm[\'header_online\'].$error" ng-show="onlinestatusForm[\'header_online\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADER_ONLINE_REQUIRED">header_online field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.HEADER_ONLINE_MAX_LENGTH" translate-values=\'{max: 255}\'>header_online must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.START_CHAT_BUTTON">start_chat_button</label>\n                <input type="text" name="start_chat_button" ng-model="vm.chatWebsite.start_chat_button" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="onlinestatusForm[\'start_chat_button\'].$error" ng-show="onlinestatusForm[\'start_chat_button\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.START_CHAT_BUTTON_REQUIRED">start_chat_button field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.START_CHAT_BUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>start_chat_button must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container offlinestatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.OFFLINESTATUS">OFFLINESTATUS</div>\n            </div>\n            <form name="offlinestatusForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.hideWhenOffline" aria-label="hideWhenOffline" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.HIDEWHENOFFLINE">hideWhenOffline</span></md-switch>\n                <div class="hint"><span translate="CHAT.HELP.HIDEWHENOFFLINE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.HEADER_OFFLINE">header_offline</label>\n                <input type="text" name="header_offline" ng-model="vm.chatWebsite.header_offline" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'header_offline\'].$error" ng-show="offlinestatusForm[\'header_offline\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.HEADER_OFFLINE_REQUIRED">header_offline field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.HEADER_OFFLINE_MAX_LENGTH" translate-values=\'{max: 255}\'>header_offline must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINE_CHAT_BUTTON">offline_chat_button</label>\n                <input type="text" name="offline_chat_button" ng-model="vm.chatWebsite.offline_chat_button" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offline_chat_button\'].$error" ng-show="offlinestatusForm[\'offline_chat_button\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINE_CHAT_BUTTON_REQUIRED">offline_chat_button field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINE_CHAT_BUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>offline_chat_button must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINEMESSAGESUBJECT">offlineMessageSubject</label>\n                <input type="text" name="offlineMessageSubject" ng-model="vm.chatWebsite.offlineMessageSubject" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offlineMessageSubject\'].$error" ng-show="offlinestatusForm[\'offlineMessageSubject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGESUBJECT_REQUIRED">offlineMessageSubject field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGESUBJECT_MAX_LENGTH" translate-values=\'{max: 255}\'>offlineMessageSubject must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.OFFLINEMESSAGEBODY">offlineMessageBody</label>\n                <input type="text" name="offlineMessageBody" ng-model="vm.chatWebsite.offlineMessageBody" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="offlinestatusForm[\'offlineMessageBody\'].$error" ng-show="offlinestatusForm[\'offlineMessageBody\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGEBODY_REQUIRED">offlineMessageBody field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.OFFLINEMESSAGEBODY_MAX_LENGTH" translate-values=\'{max: 255}\'>offlineMessageBody must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container closingform md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.CLOSINGFORM">CLOSINGFORM</div>\n            </div>\n            <form name="closingformForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGMESSAGE">closingMessage</label>\n                <textarea name="closingMessage" ng-model="vm.chatWebsite.closingMessage" md-maxlength="255" required autofocus></textarea>\n\n                <div ng-messages="closingformForm[\'closingMessage\'].$error" ng-show="closingformForm[\'closingMessage\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGE_REQUIRED">closingMessage field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>closingMessage must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SKIPMESSAGEBUTTON">skipMessageButton</label>\n                <input type="text" name="skipMessageButton" ng-model="vm.chatWebsite.skipMessageButton" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'skipMessageButton\'].$error" ng-show="closingformForm[\'skipMessageButton\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SKIPMESSAGEBUTTON_REQUIRED">skipMessageButton field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SKIPMESSAGEBUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>skipMessageButton must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableRating" aria-label="enableRating" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLERATING">enableRating</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableRating" class="md-block">\n                <label translate="CHAT.RATINGTYPE">ratingType</label>\n                <md-select name="ratingType" ng-model="vm.chatWebsite.ratingType" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'star\'">Star</md-option>\n                  <md-option ng-value="\'thumb\'">Thumb</md-option>\n                </md-select>\n                <div ng-messages="closingformForm[\'ratingType\'].$error" ng-show="closingformForm[\'ratingType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.RATINGTYPE_REQUIRED">ratingType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableRating && vm.chatWebsite.ratingType === \'star\'" class="md-block">\n                <label translate="CHAT.RATINGSTARSNUMBER">ratingStarsNumber</label>\n                <input type="number" name="ratingStarsNumber" ng-model="vm.chatWebsite.ratingStarsNumber" min="2" max="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'ratingStarsNumber\'].$error" ng-show="closingformForm[\'ratingStarsNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_REQUIRED">ratingStarsNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ratingStarsNumber must be a valid greater or equal than</span> <span>2</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.RATINGSTARSNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">ratingStarsNumber must be a valid greater or equal than</span> <span>5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableFeedback" aria-label="enableFeedback" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLEFEEDBACK">enableFeedback</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableFeedback" class="md-block">\n                <label translate="CHAT.FEEDBACKTITLE">feedbackTitle</label>\n                <input type="text" name="feedbackTitle" ng-model="vm.chatWebsite.feedbackTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'feedbackTitle\'].$error" ng-show="closingformForm[\'feedbackTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FEEDBACKTITLE_REQUIRED">feedbackTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FEEDBACKTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>feedbackTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.forwardTranscript" aria-label="forwardTranscript" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.FORWARDTRANSCRIPT">forwardTranscript</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.forwardTranscript" class="md-block">\n                <label translate="CHAT.FORWARDTRANSCRIPTMESSAGE">forwardTranscriptMessage</label>\n                <input type="text" name="forwardTranscriptMessage" ng-model="vm.chatWebsite.forwardTranscriptMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'forwardTranscriptMessage\'].$error" ng-show="closingformForm[\'forwardTranscriptMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORWARDTRANSCRIPTMESSAGE_REQUIRED">forwardTranscriptMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORWARDTRANSCRIPTMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>forwardTranscriptMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGMESSAGEBUTTON">closingMessageButton</label>\n                <input type="text" name="closingMessageButton" ng-model="vm.chatWebsite.closingMessageButton" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="closingformForm[\'closingMessageButton\'].$error" ng-show="closingformForm[\'closingMessageButton\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGEBUTTON_REQUIRED">closingMessageButton field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGMESSAGEBUTTON_MAX_LENGTH" translate-values=\'{max: 255}\'>closingMessageButton must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container unmanagedstatus md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.UNMANAGEDSTATUS">UNMANAGEDSTATUS</div>\n            </div>\n            <form name="unmanagedstatusForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.autoclose" aria-label="autoclose" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.AUTOCLOSE">autoclose</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableUnmanagedNote" aria-label="enableUnmanagedNote" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLEUNMANAGEDNOTE">enableUnmanagedNote</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.UNMANAGEDMESSAGE">unmanagedMessage</label>\n                <input type="text" name="unmanagedMessage" ng-model="vm.chatWebsite.unmanagedMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'unmanagedMessage\'].$error" ng-show="unmanagedstatusForm[\'unmanagedMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.UNMANAGEDMESSAGE_REQUIRED">unmanagedMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.UNMANAGEDMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>unmanagedMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SKIPUNMANAGED">skipUnmanaged</label>\n                <input type="text" name="skipUnmanaged" ng-model="vm.chatWebsite.skipUnmanaged" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'skipUnmanaged\'].$error" ng-show="unmanagedstatusForm[\'skipUnmanaged\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SKIPUNMANAGED_REQUIRED">skipUnmanaged field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SKIPUNMANAGED_MAX_LENGTH" translate-values=\'{max: 255}\'>skipUnmanaged must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableUnmanagedNote" class="md-block">\n                <label translate="CHAT.SENDUNMANAGED">sendUnmanaged</label>\n                <input type="text" name="sendUnmanaged" ng-model="vm.chatWebsite.sendUnmanaged" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'sendUnmanaged\'].$error" ng-show="unmanagedstatusForm[\'sendUnmanaged\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SENDUNMANAGED_REQUIRED">sendUnmanaged field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SENDUNMANAGED_MAX_LENGTH" translate-values=\'{max: 255}\'>sendUnmanaged must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.enableUnmanagedNote" class="md-block">\n                <label translate="CHAT.NOTETITLE">noteTitle</label>\n                <input type="text" name="noteTitle" ng-model="vm.chatWebsite.noteTitle" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="unmanagedstatusForm[\'noteTitle\'].$error" ng-show="unmanagedstatusForm[\'noteTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.NOTETITLE_REQUIRED">noteTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.NOTETITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>noteTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="chatWebsite-detail-form-container interaction md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.INTERACTION">INTERACTION</div>\n            </div>\n            <form name="interactionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CHAT.AGENTIDENTIFIER">agentIdentifier</label>\n                <md-select name="agentIdentifier" ng-model="vm.chatWebsite.agentIdentifier" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'website_alias\'"> {{ \'CHAT.WEBSITEALIAS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'agent_alias\'"> {{ \'CHAT.AGENTALIAS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'agent_fullname\'"> {{ \'CHAT.AGENTFULLNAME\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="CHAT.HELP.AGENTIDENTIFIER"></span></div>\n                <div ng-messages="interactionForm[\'agentIdentifier\'].$error" ng-show="interactionForm[\'agentIdentifier\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.AGENTIDENTIFIER_REQUIRED">agentIdentifier field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CUSTOMERALIAS">customerAlias</label>\n                <input type="text" name="customerAlias" ng-model="vm.chatWebsite.customerAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'customerAlias\'].$error" ng-show="interactionForm[\'customerAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CUSTOMERALIAS_REQUIRED">customerAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CUSTOMERALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>customerAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.MESSAGEFONTSIZE">messageFontSize</label>\n                <input type="number" name="messageFontSize" ng-model="vm.chatWebsite.messageFontSize" min="0" max="20" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'messageFontSize\'].$error" ng-show="interactionForm[\'messageFontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_REQUIRED">messageFontSize field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">messageFontSize must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="CHAT.ERRORS.MESSAGEFONTSIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">messageFontSize must be a valid greater or equal than</span> <span>20</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.agentIdentifier === \'website_alias\'" class="md-block">\n                <label translate="CHAT.WEBSITEALIAS">WebsiteAlias</label>\n                <input type="text" name="agentAlias" ng-model="vm.chatWebsite.agentAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="CHAT.HELP.WEBSITEALIAS"></span></div>\n                <div ng-messages="interactionForm[\'agentAlias\'].$error" ng-show="interactionForm[\'agentAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WEBSITEALIAS_REQUIRED">WebsiteAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WEBSITEALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>WebsiteAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.CLOSINGQUESTION">closingQuestion</label>\n                <input type="text" name="closingQuestion" ng-model="vm.chatWebsite.closingQuestion" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'closingQuestion\'].$error" ng-show="interactionForm[\'closingQuestion\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.CLOSINGQUESTION_REQUIRED">closingQuestion field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.CLOSINGQUESTION_MAX_LENGTH" translate-values=\'{max: 255}\'>closingQuestion must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FORMSUBMITSUCCESSMESSAGE">formSubmitSuccessMessage</label>\n                <input type="text" name="formSubmitSuccessMessage" ng-model="vm.chatWebsite.formSubmitSuccessMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'formSubmitSuccessMessage\'].$error" ng-show="interactionForm[\'formSubmitSuccessMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORMSUBMITSUCCESSMESSAGE_REQUIRED">formSubmitSuccessMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORMSUBMITSUCCESSMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>formSubmitSuccessMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.FORMSUBMITFAILUREMESSAGE">formSubmitFailureMessage</label>\n                <input type="text" name="formSubmitFailureMessage" ng-model="vm.chatWebsite.formSubmitFailureMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'formSubmitFailureMessage\'].$error" ng-show="interactionForm[\'formSubmitFailureMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.FORMSUBMITFAILUREMESSAGE_REQUIRED">formSubmitFailureMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.FORMSUBMITFAILUREMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>formSubmitFailureMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerWriting" aria-label="enableCustomerWriting" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERWRITING">enableCustomerWriting</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.enableCustomerWriting" class="md-block">\n                <label translate="CHAT.WAITINGTITLE">waitingTitle</label>\n                <input type="text" name="waitingTitle" ng-model="vm.chatWebsite.waitingTitle" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'waitingTitle\'].$error" ng-show="interactionForm[\'waitingTitle\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITINGTITLE_REQUIRED">waitingTitle field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WAITINGTITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>waitingTitle must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.enableCustomerWriting" class="md-block">\n                <label translate="CHAT.WAITINGMESSAGE">waitingMessage</label>\n                <textarea name="waitingMessage" ng-model="vm.chatWebsite.waitingMessage" md-maxlength="255" required></textarea>\n\n                <div ng-messages="interactionForm[\'waitingMessage\'].$error" ng-show="interactionForm[\'waitingMessage\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WAITINGMESSAGE_REQUIRED">waitingMessage field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WAITINGMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>waitingMessage must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.PLACEHOLDERMESSAGE">placeholderMessage</label>\n                <input type="text" name="placeholderMessage" ng-model="vm.chatWebsite.placeholderMessage" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'placeholderMessage\'].$error" ng-show="interactionForm[\'placeholderMessage\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.PLACEHOLDERMESSAGE_REQUIRED">placeholderMessage field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.PLACEHOLDERMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>placeholderMessage must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.download_transcript" aria-label="downloadTranscript" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.DOWNLOADTRANSCRIPT">downloadTranscript</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerAttachment" aria-label="enableCustomerAttachment" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERATTACHMENT">enableCustomerAttachment</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableSendButton" aria-label="enableSendButton" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLESENDBUTTON">enableSendButton</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.enableCustomerCheckmarks" aria-label="enableCustomerCheckmarks" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.ENABLECUSTOMERCHECKMARKS">enableCustomerCheckmarks</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.SYSTEMALIAS">systemAlias</label>\n                <input type="text" name="systemAlias" ng-model="vm.chatWebsite.systemAlias" md-maxlength="255" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="interactionForm[\'systemAlias\'].$error" ng-show="interactionForm[\'systemAlias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.SYSTEMALIAS_REQUIRED">systemAlias field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.SYSTEMALIAS_MAX_LENGTH" translate-values=\'{max: 255}\'>systemAlias must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.license.custom" class="chatWebsite-detail-form-container whitelabel md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.WHITELABEL">WHITELABEL</div>\n            </div>\n            <form name="whitelabelForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.defaultWhiteLabel" aria-label="default" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.DEFAULT">default</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="!vm.chatWebsite.defaultWhiteLabel" class="md-block">\n                <label translate="CHAT.WHITELABEL">whiteLabel</label>\n                <textarea name="whiteLabel" ng-model="vm.chatWebsite.whiteLabel" md-maxlength="255" required></textarea>\n\n                <div ng-messages="whitelabelForm[\'whiteLabel\'].$error" ng-show="whitelabelForm[\'whiteLabel\'].$touched" role="alert">\n\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.WHITELABEL_REQUIRED">whiteLabel field is required</span>\n                  </div>\n\n\n                  <div ng-message="md-maxlength">\n                    <span translate="CHAT.ERRORS.WHITELABEL_MAX_LENGTH" translate-values=\'{max: 255}\'>whiteLabel must have a maximum length equal to 255</span>\n                  </div>\n\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.license.custom" class="chatWebsite-detail-form-container logo md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.LOGO">LOGO</div>\n            </div>\n            <div ng-controller="ChatWebsitelogoController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="logoimage in vm_ca.chatWebsite.images" ng-switch="logoimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{logoimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="logoimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{logoimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container agentavatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.AGENTAVATAR">AGENTAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsiteagentAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="agentAvatarimage in vm_ca.chatWebsite.images" ng-switch="agentAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{agentAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="agentAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{agentAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container customeravatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.CUSTOMERAVATAR">CUSTOMERAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsitecustomerAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="customerAvatarimage in vm_ca.chatWebsite.images" ng-switch="customerAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{customerAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="customerAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{customerAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n          <div class="chatWebsite-detail-form-container systemavatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.SYSTEMAVATAR">SYSTEMAVATAR</div>\n            </div>\n            <div ng-controller="ChatWebsitesystemAvatarController as vm_ca" ng-init="vm_ca.init(vm.chatWebsite, vm.crudPermissions)" class="chatWebsite-detail-form-container md-background-bg md-whiteframe-1dp">\n\n              <div id="chatWebsite-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="systemAvatarimage in vm_ca.chatWebsite.images" ng-switch="systemAvatarimage.type">\n                    <div class="chatWebsite-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{systemAvatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="systemAvatarimage.file">\n                    </div>\n\n                    <div class="chatWebsite-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{systemAvatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ONLINE">ONLINE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatformonline md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteonlineFormController as vm_fonc" ng-init="vm_fonc.init(vm.chatWebsite)" class="content" md-background-bg layout="column">\n              <div flex>\n                \x3c!-- START Buttons --\x3e\n                <md-button aria-label="comment" class="md-fab md-mini" ng-click="vm_fonc.add(button.type)" ng-repeat="button in vm_fonc.buttons">\n                  <md-tooltip md-direction="top">{{button.name}}</md-tooltip>\n                  <md-icon md-font-icon="{{button.icon}}"></md-icon>\n                </md-button>\n                \x3c!-- END Buttons --\x3e\n              </div>\n\n              <div layout="row" flex>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.BUILDER">BUILDER</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content>\n\n                      <form name="onlineForm" novalidate>\n\n                        \x3c!-- START MapKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.onlineForm.items.length">\n                          <label translate="CHAT.HELP.MAPKEY">MapKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.mapKey">\n                            <md-option ng-value="null">None</md-option>\n\n                            <md-optgroup label="standard">\n                              <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n\n                            <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                              <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END MapKey --\x3e\n\n                        \x3c!-- START FromKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.onlineForm.items.length">\n                          <label translate="CHAT.HELP.FROMKEY">FromKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.onlineForm.fromKey" md-selected-text="vm_fonc.chatWebsite.onlineForm.fromKey != null ? vm_fonc.chatWebsite.onlineForm.items[vm_fonc.chatWebsite.onlineForm.fromKey].props.title : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.onlineForm.items" ng-if="item.props.title" ng-value="$index">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END FromKey --\x3e\n\n                        \x3c!-- START EXPANSION PANELS --\x3e\n                        <md-expansion-panel ng-repeat="item in vm_fonc.chatWebsite.onlineForm.items track by $index" md-component-id="{{\'onlinePanel\' + $index}}">\n                          <md-expansion-panel-collapsed md-no-sticky="true">\n                            <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                            </md-button>\n                            <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                            </md-button>\n\n                            <div class="md-title">{{item.props.title || item.type}}</div>\n\n                            <div flex></div>\n                            <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                              <md-icon md-font-icon="icon-chevron-down"></md-icon>\n                            </md-button>\n                          </md-expansion-panel-collapsed>\n\n                          <md-expansion-panel-expanded>\n                            <md-expansion-panel-header>\n                              <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                              </md-button>\n\n                              <div class="md-title">{{item.props.title || item.type}}</div>\n\n                              <div flex></div>\n\n                              <md-button class="md-icon-button md-warn" aria-label="Remove" ng-click="vm_fonc.remove($index)">\n                                <md-icon md-font-icon="icon-delete"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                                <md-icon md-font-icon="icon-chevron-up"></md-icon>\n                              </md-button>\n                            </md-expansion-panel-header>\n\n                            <md-expansion-panel-content>\n                              <form-item type="{{item.type}}" item="item" index="$index"></form-item>\n\n                              <md-input-container class="md-block">\n                                <label translate="CHAT.VARIABLE">Variable</label>\n                                <md-select ng-model="item.variable">\n                                  <md-option ng-value="null">None</md-option>\n                                  <md-option ng-repeat="variable in vm_fonc.variables" ng-value="variable.name">{{ variable.name }}</md-option>\n                                </md-select>\n                              </md-input-container>\n\n                              <md-input-container class="md-block">\n                                <label translate="CHAT.CM_FIELD">Contact Manager Field</label>\n                                <md-select ng-model="item.cmField">\n                                  <md-option ng-value="null">None</md-option>\n\n                                  <md-optgroup label="standard">\n                                    <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n\n                                  <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                                    <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n                                </md-select>\n                              </md-input-container>\n                            </md-expansion-panel-content>\n\n                          </md-expansion-panel-expanded>\n                        </md-expansion-panel>\n                        \x3c!-- END EXPANSION PANELS --\x3e\n                      </form>\n                    </md-card-content>\n                  </md-card>\n                </div>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.PREVIEW">PREVIEW</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content flex>\n                      <form-view form="vm_fonc.chatWebsite.onlineForm" flex="100"></form-view>\n                    </md-card-content>\n                  </md-card>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.OFFLINE">OFFLINE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatformoffline md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteofflineFormController as vm_fonc" ng-init="vm_fonc.init(vm.chatWebsite)" class="content" md-background-bg layout="column">\n              <div flex>\n                \x3c!-- START Buttons --\x3e\n                <md-button aria-label="comment" class="md-fab md-mini" ng-click="vm_fonc.add(button.type)" ng-repeat="button in vm_fonc.buttons">\n                  <md-tooltip md-direction="top">{{button.name}}</md-tooltip>\n                  <md-icon md-font-icon="{{button.icon}}"></md-icon>\n                </md-button>\n                \x3c!-- END Buttons --\x3e\n              </div>\n\n              <div layout="row" flex>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.BUILDER">BUILDER</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content>\n\n                      <form name="offlineForm" novalidate>\n                        <md-input-container class="md-block">\n                          <md-switch ng-model="vm_fonc.chatWebsite.forwardOffline" aria-label="forwardOffline"><span translate="CHAT.FORWARD_OFFLINE">forwardOffline</span></md-switch>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.forwardOffline">\n                          <label translate="CHAT.FORWARD_OFFLINE_ADDRESS">FORWARD OFFLINE ADDRESS</label>\n                          <input type="text" name="forwardOfflineAddress" ng-model="vm_fonc.chatWebsite.forwardOfflineAddress">\n                          <div class="hint"><span translate="CHAT.HELP.FORWARD_OFFLINE"></span></div>\n                          <div ng-messages="offlineForm[\'forwardOfflineAddress\'].$error" ng-show="offlineForm[\'forwardOfflineAddress\'].$touched" role="alert">\n                            <div ng-message="email">\n                              <span translate="CHAT.ERRORS.EMAIL_MUST_BE_VALID">forwardOffline must be a valid e-mail address</span>\n                            </div>\n                          </div>\n                        </md-input-container>\n\n                        <md-input-container class="md-block">\n                          <md-switch ng-model="vm_fonc.chatWebsite.openNewInteraction" aria-label="openNewInteraction">\n                            <span translate="CHAT.OPEN_NEW_INTERACTION">openNewInteraction</span>\n                          </md-switch>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.openNewInteraction">\n                          <label translate="CHAT.EMAIL_ACCOUNT">Email account</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.MailAccountId" required>\n                            <md-option ng-repeat="account in vm_fonc.email_accounts" ng-value="account.id">{{ account.name }}</md-option>\n                          </md-select>\n                          <div ng-messages="offlineForm[\'MailAccountId\'].$error" ng-show="offlineForm[\'MailAccountId\'].$touched" role="alert">\n                            <div ng-message="required">\n                              <span translate="CHAT.ERRORS.EMAIL_ACCOUNT_REQUIRED">Email account field is required</span>\n                            </div>\n                          </div>\n                        </md-input-container>\n\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.openNewInteraction && vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.SUBJECT">Subject</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.subjectOffline" md-selected-text="vm_fonc.chatWebsite.subjectOffline != null ? vm_fonc.chatWebsite.subjectOffline : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items" ng-if="item.props.title" ng-value="item.props.title">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n\n                        \x3c!-- START MapKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.HELP.MAPKEY">MapKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.mapKeyOffline">\n                            <md-option ng-value="null">None</md-option>\n\n                            <md-optgroup label="standard">\n                              <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n\n                            <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                              <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                            </md-optgroup>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END MapKey --\x3e\n\n                        \x3c!-- START FromKey --\x3e\n                        <md-input-container class="md-block" ng-if="vm_fonc.chatWebsite.offlineForm.items.length">\n                          <label translate="CHAT.HELP.FROMKEY">FromKey</label>\n                          <md-select ng-model="vm_fonc.chatWebsite.offlineForm.fromKey" md-selected-text="vm_fonc.chatWebsite.offlineForm.fromKey != null ? vm_fonc.chatWebsite.offlineForm.items[vm_fonc.chatWebsite.offlineForm.fromKey].props.title : \'None\'">\n                            <md-option ng-value="null">None</md-option>\n                            <md-option ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items" ng-if="item.props.title" ng-value="$index">{{ item.props.title }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                        \x3c!-- END FromKey --\x3e\n\n                        \x3c!-- START EXPANSION PANELS --\x3e\n                        <md-expansion-panel ng-repeat="item in vm_fonc.chatWebsite.offlineForm.items track by $index" md-component-id="{{\'offlinePanel\' + $index}}">\n                          <md-expansion-panel-collapsed md-no-sticky="true">\n                            <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                            </md-button>\n                            <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index); $event.stopPropagation()">\n                              <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                            </md-button>\n\n                            <div class="md-title">{{item.props.title || item.type}}</div>\n\n                            <div flex></div>\n                            <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                              <md-icon md-font-icon="icon-chevron-down"></md-icon>\n                            </md-button>\n                          </md-expansion-panel-collapsed>\n\n                          <md-expansion-panel-expanded>\n                            <md-expansion-panel-header>\n                              <md-button class="md-icon-button" aria-label="Down" ng-click="vm_fonc.down(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-down-bold-circle-outline"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Up" ng-click="vm_fonc.up(item, $index)">\n                                <md-icon md-font-icon="icon-arrow-up-bold-circle-outline"></md-icon>\n                              </md-button>\n\n                              <div class="md-title">{{item.props.title || item.type}}</div>\n\n                              <div flex></div>\n\n                              <md-button class="md-icon-button md-warn" aria-label="Remove" ng-click="vm_fonc.remove($index)">\n                                <md-icon md-font-icon="icon-delete"></md-icon>\n                              </md-button>\n                              <md-button class="md-icon-button" aria-label="Collapse" ng-click="$panel.collapse()">\n                                <md-icon md-font-icon="icon-chevron-up"></md-icon>\n                              </md-button>\n                            </md-expansion-panel-header>\n\n                            <md-expansion-panel-content>\n                              <form-item type="{{item.type}}" item="item" index="$index"></form-item>\n\n\n                              <md-input-container class="md-block" ng-if="item.type != \'upload\'">\n                                <label translate="CHAT.CM_FIELD">Contact Manager Field</label>\n                                <md-select ng-model="item.cmField">\n                                  <md-option ng-value="null">None</md-option>\n\n                                  <md-optgroup label="standard">\n                                    <md-option ng-repeat="field in vm_fonc.fields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n\n                                  <md-optgroup label="custom" ng-if="vm_fonc.customFields.length">\n                                    <md-option ng-repeat="field in vm_fonc.customFields" ng-value="field.key">{{ field.value }}</md-option>\n                                  </md-optgroup>\n                                </md-select>\n                              </md-input-container>\n                            </md-expansion-panel-content>\n\n                          </md-expansion-panel-expanded>\n                        </md-expansion-panel>\n                        \x3c!-- END EXPANSION PANELS --\x3e\n                      </form>\n                    </md-card-content>\n                  </md-card>\n                </div>\n                <div flex="50">\n                  <md-card>\n                    <md-card-title>\n                      <md-card-title-text>\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="CHAT.PREVIEW">PREVIEW</div>\n                        </div>\n                      </md-card-title-text>\n                    </md-card-title>\n                    <md-card-content flex>\n                      <form-view form="vm_fonc.chatWebsite.offlineForm" flex="100"></form-view>\n                    </md-card-content>\n                  </md-card>\n                </div>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.PROACTIVEACTIONS">PROACTIVEACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container proactive md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteProactiveActionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteProactiveActions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.PROACTIVEACTIONS">ProactiveActions</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteProactiveActions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event)" aria-label="add chatProactiveAction" translate translate-attr-label="CHAT.ADD_CHATPROACTIVEACTION">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteProactiveActions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteProactiveActions.length}} {{vm_dc.selectedChatWebsiteProactiveActions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteProactiveActions" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteProactiveActions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteProactiveActions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteProactiveActions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="name">\n                        {{ \'CHAT.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="type">\n                        {{ \'CHAT.TYPE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="selector">\n                        {{ \'CHAT.SELECTOR\' | translate }}\n                      </th>\n                      <th md-column md-order-by="timeout">\n                        {{ \'CHAT.TIMEOUT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="chatProactiveAction" md-select-id="id" ng-repeat="chatProactiveAction in vm_dc.chatWebsiteProactiveActions.rows">\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.name}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{ \'CHAT.\' + vm_dc.arraytype[chatProactiveAction.type].option | uppercase | translate }}\n                      </td>\n\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.selector}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{chatProactiveAction.timeout}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" md-cell>\n                        {{ chatProactiveAction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditChatWebsiteChatProactiveAction($event, chatProactiveAction)" translate="CHAT.EDIT_CHATPROACTIVEACTION">\n                                Edit ChatProactiveAction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(chatProactiveAction, $event)" translate="CHAT.DELETE_CHATPROACTIVEACTION">\n                                Delete ChatProactiveAction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteProactiveActions.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_CHATPROACTIVEACTION_AVAILABLE">No chatproactiveaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteProactiveActions.count}}" md-on-paginate="vm_dc.getChatWebsiteProactiveActions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="ChatWebsiteDispositionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="chatWebsite-detail-form-container chatdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="CHAT.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add chat dispositions" translate translate-attr-label="CHAT.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="chatWebsites.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'CHAT.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'CHAT.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'CHAT.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="CHAT.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container chatcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteChatCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteChatCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.CHATCANNEDANSWERS">ChatCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteChatCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event)" aria-label="add chatCannedAnswer" translate translate-attr-label="CHAT.ADD_CHATCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteChatCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteChatCannedAnswers.length}} {{vm_dc.selectedChatWebsiteChatCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteChatCannedAnswers" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteChatCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteChatCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteChatCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'CHAT.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'CHAT.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'CHAT.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="chatCannedAnswer" md-select-id="id" ng-repeat="chatCannedAnswer in vm_dc.chatWebsiteChatCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{chatCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" md-cell>\n                        {{ chatCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditChatWebsiteChatCannedAnswer($event, chatCannedAnswer)" translate="CHAT.EDIT_CHATCANNEDANSWER">\n                                Edit ChatCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(chatCannedAnswer, $event)" translate="CHAT.DELETE_CHATCANNEDANSWER">\n                                Delete ChatCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteChatCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_CHATCANNEDANSWER_AVAILABLE">No chatcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteChatCannedAnswers.count}}" md-on-paginate="vm_dc.getChatWebsiteChatCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.VIDEO">VIDEO</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container vidaoo md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CHAT.VIDAOO">VIDAOO</div>\n            </div>\n            <form name="vidaooForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.chatWebsite.vidaooEscalation" aria-label="vidaooEscalation" ng-disabled="!vm.crudPermissions.canEdit"><span translate="CHAT.VIDAOOESCALATION">vidaooEscalation</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOAPIKEY">vidaooApiKey</label>\n                <input type="text" name="vidaooApiKey" ng-model="vm.chatWebsite.vidaooApiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooApiKey\'].$error" ng-show="vidaooForm[\'vidaooApiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOOAPIKEY_REQUIRED">vidaooApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOTOPIC">vidaooTopic</label>\n                <input type="text" name="vidaooTopic" ng-model="vm.chatWebsite.vidaooTopic" value="Generated by XCALLY Motion" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooTopic\'].$error" ng-show="vidaooForm[\'vidaooTopic\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOOTOPIC_REQUIRED">vidaooTopic field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOONOTE">vidaooNote</label>\n                <input type="text" name="vidaooNote" ng-model="vm.chatWebsite.vidaooNote" value="Meeting generated for interaction #{{interaction.id}} by {{agent.name}}" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="vidaooForm[\'vidaooNote\'].$error" ng-show="vidaooForm[\'vidaooNote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CHAT.ERRORS.VIDAOONOTE_REQUIRED">vidaooNote field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.chatWebsite.vidaooEscalation == true" class="md-block">\n                <label translate="CHAT.VIDAOOMETADATA">vidaooMetadata</label>\n                <textarea name="vidaooMetadata" ng-model="vm.chatWebsite.vidaooMetadata"></textarea>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteActionsController as vm_ac" ng-init="vm_ac.init(vm.chatWebsite, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="CHAT.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedChatWebsiteApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedChatWebsiteApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedChatWebsiteApps.length}} {{vm_ac.selectedChatWebsiteApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedChatWebsiteApps($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedChatWebsiteApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.chatWebsiteApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editChatWebsiteApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editChatWebsiteApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.chatWebsiteApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteInteractionsController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getChatWebsiteInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getChatWebsiteInteractions()" aria-label="refresh Interactions" translate translate-attr-label="CHAT.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteInteractions.length}} {{vm_dc.selectedChatWebsiteInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteInteractions" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteInteractions($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'CHAT.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'CHAT.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'CHAT.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'CHAT.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'CHAT.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.chatWebsiteInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'CHAT.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'CHAT.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spychatInteraction($event, interaction)" translate="CHAT.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event, true)" translate="CHAT.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.chatInteractionDownload(interaction, $event)" translate="CHAT.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="CHAT.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteInteractions.count}}" md-on-paginate="vm_dc.getChatWebsiteInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.OFFLINEMESSAGES">OFFLINEMESSAGES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="chatWebsite-detail-form-container offlinemessages md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ChatWebsiteOfflineMessagesController as vm_dc" ng-init="vm_dc.init(vm.chatWebsite, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedChatWebsiteOfflineMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CHAT.OFFLINEMESSAGES">OfflineMessages</span>\n                  <ms-search-bar on-search="vm_dc.getChatWebsiteOfflineMessages()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedChatWebsiteOfflineMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedChatWebsiteOfflineMessages.length}} {{vm_dc.selectedChatWebsiteOfflineMessages.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedChatWebsiteOfflineMessages" csv-label="true" filename="chatWebsites.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedChatWebsiteOfflineMessages($event)" aria-label="delete selected" translate translate-attr-label="CHAT.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedChatWebsiteOfflineMessages" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getChatWebsiteOfflineMessages">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CHAT.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column>\n                        {{ \'CHAT.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'CHAT.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="offlineMessage" md-select-id="id" ng-repeat="offlineMessage in vm_dc.chatWebsiteOfflineMessages.rows">\n                      <td md-cell>\n                        {{offlineMessage.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="offlineMessage.Attachments.length > 0">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{offlineMessage.Contact.firstName}}\n                      </td>\n                      <td md-cell>\n                        {{ offlineMessage.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CHAT.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.showOfflineMessageChatWebsiteOfflineMessage($event, offlineMessage)" translate="CHAT.SHOW_OFFLINEMESSAGE">\n                                SHOW OfflineMessage\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(offlineMessage, $event)" translate="CHAT.DELETE_OFFLINEMESSAGE">\n                                Delete OfflineMessage\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.chatWebsiteOfflineMessages.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CHAT.NO_OFFLINEMESSAGE_AVAILABLE">No offlinemessage available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CHAT.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CHAT.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CHAT.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.chatWebsiteOfflineMessages.count}}" md-on-paginate="vm_dc.getChatWebsiteOfflineMessages" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/chat/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CHAT.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/companies/companies.html",'<div id="companies" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.COMPANIES">Companies</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCompanies.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCompanies =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-companies-count">\n          <span>{{vm.selectedCompanies.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCompanies()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCompanies()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCompanies" csv-label="true" filename="companies.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCompanies($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- COMPANY TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCompanies" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCompanies">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.companies.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="company" md-select-id="id" ng-repeat="company in vm.companies.rows">\n                <td md-cell ng-if="company.userpic"><img class="avatar" alt="{{company.name}}" ng-src="api/users/{{company.id}}/avatar" /></td>\n                <td md-cell ng-if="!company.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{company.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="id ">{{company.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="name ">{{company.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(company, ev) : vm.createOrEditCompany($event, company)" md-cell class="description ">{{company.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(company, $event    )" translate="CONTACTMANAGER.EDIT_COMPANY">\n                          Edit Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotocontactsgoto(company, $event    )" translate="CONTACTMANAGER.GOTOCONTACTS_COMPANY">\n                          goToContacts Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(company, $event    )" translate="CONTACTMANAGER.DELETE_COMPANY">\n                          Delete Company\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.companies.count}}" md-on-paginate="vm.getCompanies" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / COMPANY TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD COMPANY BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-company-button" ng-click="vm.createOrEditCompany($event)" aria-label="add company" translate translate-attr-aria-label="CONTACTMANAGER.ADD_COMPANY">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD COMPANY BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/companies/create/dialog.html",'<md-dialog class="company-dialog" aria-label="New Company">\n  <form name="companyForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.company.name" ng-required="true" autofocus>\n\n        <div ng-messages="companyForm[\'name\'].$error" ng-show="companyForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.PHONE">Phone</label>\n        <input type="text" name="phone" ng-model="vm.company.phone">\n\n        <div ng-messages="companyForm[\'phone\'].$error" ng-show="companyForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.VAT">Vat</label>\n        <input type="text" name="vat" ng-model="vm.company.vat">\n\n        <div ng-messages="companyForm[\'vat\'].$error" ng-show="companyForm[\'vat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.VAT_REQUIRED">Vat field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FAX">Fax</label>\n        <input type="text" name="fax" ng-model="vm.company.fax">\n\n        <div ng-messages="companyForm[\'fax\'].$error" ng-show="companyForm[\'fax\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.FAX_REQUIRED">Fax field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.COMPANYID">CompanyId</label>\n        <input type="text" name="companyId" ng-model="vm.company.companyId">\n\n        <div ng-messages="companyForm[\'companyId\'].$error" ng-show="companyForm[\'companyId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.COMPANYID_REQUIRED">CompanyId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <input type="text" name="type" ng-model="vm.company.type">\n\n        <div ng-messages="companyForm[\'type\'].$error" ng-show="companyForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.WEBSITE">Website</label>\n        <input type="text" name="website" ng-model="vm.company.website" md-maxlength="255">\n\n        <div ng-messages="companyForm[\'website\'].$error" ng-show="companyForm[\'website\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.WEBSITE_REQUIRED">Website field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="CONTACTMANAGER.ERRORS.WEBSITE_MAX_LENGTH" translate-values=\'{max: 255}\'>Website must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL_DOMAIN">Email_Domain</label>\n        <input type="text" name="emailDomain" ng-model="vm.company.emailDomain">\n\n        <div ng-messages="companyForm[\'emailDomain\'].$error" ng-show="companyForm[\'emailDomain\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_DOMAIN_REQUIRED">Email_Domain field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.company.email">\n\n        <div ng-messages="companyForm[\'email\'].$error" ng-show="companyForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.company.description">\n\n        <div ng-messages="companyForm[\'description\'].$error" ng-show="companyForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCompany" ng-click="vm.saveCompany()" class="send-button md-accent md-raised" ng-disabled="companyForm.$invalid || companyForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCompany" ng-click="vm.addNewCompany()" class="send-button md-accent md-raised" ng-disabled="companyForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_COMPANY" translate-attr-aria-label="CONTACTMANAGER.ADD_COMPANY">\n          ADD COMPANY\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCompany" ng-click="vm.deleteCompany($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/companies/edit/view.html",'<div id="contactmanager-company" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-companies-button md-icon-button" aria-label="Go to companies" ng-click="vm.gotoCompanies()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_COMPANIES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="company-image" hide-xs>\n          <img ng-src="assets/images/business/companies.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.company.id}}\n            <span ng-if="vm.company.name">{{vm.company.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.company.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.company, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="CONTACTMANAGER.GOTO_COMPANY"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveCompany()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (addressForm.$invalid) || (shipmentAddressForm.$invalid)" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.GENERAL">GENERAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.company.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.company.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.VAT">Vat</label>\n                <input type="text" name="vat" ng-model="vm.company.vat" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'vat\'].$error" ng-show="generalForm[\'vat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.VAT_REQUIRED">Vat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.FAX">Fax</label>\n                <input type="text" name="fax" ng-model="vm.company.fax" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'fax\'].$error" ng-show="generalForm[\'fax\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.FAX_REQUIRED">Fax field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COMPANYID">CompanyId</label>\n                <input type="text" name="companyId" ng-model="vm.company.companyId" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'companyId\'].$error" ng-show="generalForm[\'companyId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COMPANYID_REQUIRED">CompanyId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.TYPE">Type</label>\n                <input type="text" name="type" ng-model="vm.company.type" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.WEBSITE">Website</label>\n                <input type="text" name="website" ng-model="vm.company.website" md-maxlength="255" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'website\'].$error" ng-show="generalForm[\'website\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.WEBSITE_REQUIRED">Website field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="CONTACTMANAGER.ERRORS.WEBSITE_MAX_LENGTH" translate-values=\'{max: 255}\'>Website must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.EMAIL_DOMAIN">Email_Domain</label>\n                <input type="text" name="emailDomain" ng-model="vm.company.emailDomain" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'emailDomain\'].$error" ng-show="generalForm[\'emailDomain\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_DOMAIN_REQUIRED">Email_Domain field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.company.email" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.company.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.ADDRESS">ADDRESS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container address md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.ADDRESS">ADDRESS</div>\n            </div>\n            <form name="addressForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.STREET">Street</label>\n                <input type="text" name="street" ng-model="vm.company.street" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'street\'].$error" ng-show="addressForm[\'street\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.STREET_REQUIRED">Street field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.POSTAL_CODE">Postal_Code</label>\n                <input type="text" name="postalCode" ng-model="vm.company.postalCode" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'postalCode\'].$error" ng-show="addressForm[\'postalCode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.POSTAL_CODE_REQUIRED">Postal_Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.CITY">City</label>\n                <input type="text" name="city" ng-model="vm.company.city" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'city\'].$error" ng-show="addressForm[\'city\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.CITY_REQUIRED">City field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                <input type="text" name="country" ng-model="vm.company.country" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="addressForm[\'country\'].$error" ng-show="addressForm[\'country\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COUNTRY_REQUIRED">Country field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.SHIPMENTADDRESS">SHIPMENTADDRESS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="company-detail-form-container shipmentaddress md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.SHIPMENTADDRESS">SHIPMENTADDRESS</div>\n            </div>\n            <form name="shipmentAddressForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.STREET">Street</label>\n                <input type="text" name="sStreet" ng-model="vm.company.sStreet" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sStreet\'].$error" ng-show="shipmentAddressForm[\'sStreet\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.STREET_REQUIRED">Street field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.POSTAL_CODE">Postal_Code</label>\n                <input type="text" name="sPostalCode" ng-model="vm.company.sPostalCode" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sPostalCode\'].$error" ng-show="shipmentAddressForm[\'sPostalCode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.POSTAL_CODE_REQUIRED">Postal_Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.CITY">City</label>\n                <input type="text" name="sCity" ng-model="vm.company.sCity" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sCity\'].$error" ng-show="shipmentAddressForm[\'sCity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.CITY_REQUIRED">City field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                <input type="text" name="sCountry" ng-model="vm.company.sCountry" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="shipmentAddressForm[\'sCountry\'].$error" ng-show="shipmentAddressForm[\'sCountry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.COUNTRY_REQUIRED">Country field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/contacts.html",'<div id="contacts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.CONTACTS">Contacts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    \x3c!-- SEARCH --\x3e\n    <div class="search-input-wrapper" layout="row" layout-align="start center">\n      <label for="search">\n        <md-icon md-font-icon="icon-magnify"></md-icon>\n      </label>\n      <md-input-container md-no-float class="m-0">\n        <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n      </md-input-container>\n    </div>\n    \x3c!-- / SEARCH --\x3e\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContacts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedContacts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-contacts-count">\n          <span>{{vm.selectedContacts.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContacts()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContacts()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContacts" csv-label="true" filename="contacts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedContacts($event)" aria-label="delete selected" translate translate-attr-label="CONTACTS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      <div layout="row">\n        <div class="column" flex="20">\n          <md-card>\n            <md-card-content>\n              <button layout-align="center center" md-mini-fab ng-click="vm.selectedList = null; vm.selectedCompany = null; vm.selectedTags = []">\n                <md-icon md-font-icon="icon-refresh"></md-icon>{{ \'CONTACTMANAGER.ALL_CONTACTS\' | translate }}\n              </button>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_LIST">Select a list</label>\n                <md-select placeholder="Select a list" ng-model="vm.selectedList" ng-disabled="vm.lists.count === 0">\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.ALL">All</em></md-option>\n                  <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_COMPANY">Select a company</label>\n                <md-select placeholder="Select a company" flex="100" ng-model="vm.selectedCompany" ng-disabled="vm.companies.count === 0">\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.ALL">All</em></md-option>\n                  <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="CONTACTMANAGER.SELECT_TAGS">Select one or more tags</label>\n                <md-select multiple placeholder="Select one or more tags" flex="100" ng-model="vm.query.tag" ng-change="vm.getContacts()">\n                  <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows">{{tag.name}}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n        </div>\n\n        \x3c!-- USER TABLE --\x3e\n        <md-card flex="80">\n          <md-table-container ng-init="vm.getAssignedCompanies()">\n            <table md-table md-row-select multiple ng-model="vm.selectedContacts" md-progress="vm.promise">\n              <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n                <tr md-row>\n                  <th md-column md-order-by="id">ID</th>\n                  <th md-column md-order-by="firstName">{{\'CONTACTMANAGER.FULLNAME\' | translate}}</th>\n                  <th md-column md-order-by="phone">{{\'CONTACTMANAGER.PHONE\' | translate}}</th>\n                  <th md-column md-order-by="email">{{\'CONTACTMANAGER.EMAIL\' | translate}}</th>\n                  <th md-column md-order-by="createdAt">{{\'CONTACTMANAGER.CREATED_AT\' | translate}}</th>\n                  <th md-column md-order-by="ListId">{{\'CONTACTMANAGER.LIST\' | translate}}</th>\n                  <th md-column md-order-by="CompanyId">{{\'CONTACTMANAGER.COMPANY\' | translate}}</th>\n                  <th md-column md-order-by="tags">{{\'CONTACTMANAGER.TAGS\' | translate}}</th>\n                  <th md-column width="10px"></th>\n                </tr>\n              </thead>\n              <tbody md-body>\n                <tr md-row ng-hide="vm.contacts.rows.length">\n                  <td md-cell colspan="8">\n                    <div layout="row" layout-align="center center">\n                      <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                  </td>\n                </tr>\n                <tr md-row md-select="contact" md-select-id="id" ng-repeat="contact in vm.contacts.rows">\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="id">{{contact.id}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="firstName" privacy ng-cloak>{{contact.firstName}} {{contact.lastName}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="phone" privacy ng-cloak>{{contact.phone}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="email" privacy ng-cloak>{{contact.email}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="createdAt">{{contact.createdAt | date:\'medium\'}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="list">{{vm.listsMap[contact.ListId]}}</td>\n                  <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editdialog(contact, ev) : vm.createOrEditContact($event, contact)" md-cell class="company">{{vm.companiesMap[contact.CompanyId]}}</td>\n                  <td md-cell class="tag">\n                    <div ng-if="contact.Tags.length">\n                      <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                        <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                        <span class="text-truncate">{{contact.Tags[0].name}}</span>\n                      </div>\n                      <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                        <md-tooltip md-direction="left" layout="row">\n                          <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                        </md-tooltip>\n                        <md-icon md-font-icon="icon-tag"></md-icon>\n                      </div>\n                    </div>\n                  </td>\n                  <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.editdialog(contact, ev)" translate="CONTACTMANAGER.EDIT_CONTACT">\n                            Edit Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.mergeContact(ev, contact)" translate="CONTACTMANAGER.MERGE_CONTACT">\n                            Merge Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.duplicateContact(ev, contact)" translate="CONTACTMANAGER.DUPLICATE_CONTACT">\n                            Duplicate Contact\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-divider ng-if="vm.crudPermissions.canEdit && vm.crudPermissions.canDelete">\n                        </md-menu-divider>\n                        <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                          <md-button ng-click="vm.deleteconfirm(contact, ev)" translate="CONTACTMANAGER.DELETE_CONTACT">\n                            Delete Contact\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n\n          <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n        </md-card>\n        \x3c!-- / USER TABLE --\x3e\n      </div>\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USER BUTTON --\x3e\n  <md-fab-speed-dial id="add-contact-button" ng-if="vm.crudPermissions.canEdit" ng-hide="vm.options.hidden" md-direction="up" md-open="vm.options.isOpen" class="md-scale md-fab" ng-class="{ \'md-hover-full\': vm.options.hover }" ng-mouseenter="vm.options.isOpen=true" ng-mouseleave="vm.options.isOpen=false">\n    <md-fab-trigger>\n      <md-button aria-label="menu" class="md-fab md-accent">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </md-fab-trigger>\n    <md-fab-actions>\n      <md-button class="md-fab md-mini md-primary" flow-btn flow-init="vm.ngFlowOptions" flow-files-submitted="$flow.upload()" flow-file-success="vm.importContactsUpdates($file, $message, $flow)" flow-file-added="vm.fileAdded($file)" aria-label="Select File" translate translate-attr-aria-label="CONTACTMANAGER.UPDATES_EXISTING_CONTACTS">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.UPDATE_EXISTING_CONTACTS\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-upload"></md-icon>\n      </md-button>\n      <md-button class="md-fab md-mini md-warn" flow-btn flow-init="vm.ngFlowOptions" flow-files-submitted="$flow.upload()" flow-file-success="vm.importContacts($file, $message, $flow)" flow-file-added="vm.fileAdded($file)" aria-label="Select File" translate translate-attr-aria-label="CONTACTMANAGER.IMPORT_CONTACTS">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.IMPORT_CONTACTS\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-upload"></md-icon>\n      </md-button>\n      <md-button class="md-fab md-mini md-accent" ng-click="vm.createOrEditContact($event)" aria-label="add contact" translate translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n        <md-tooltip md-direction="left" md-visible="tooltipVisible" md-autohide="false">\n          {{\'CONTACTMANAGER.ADD_CONTACT\' | translate}}\n        </md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </md-fab-actions>\n  </md-fab-speed-dial>\n  \x3c!-- / ADD USER BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/create/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="New Contact">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FIRSTNAME">First name</label>\n        <input name="firstName" ng-model="vm.contact.firstName" required md-autofocus privacy="!vm.crudPermissions.canEdit" ng-cloak>\n\n        <div ng-messages="contactForm.firstName.$error" ng-show="contactForm.firstName.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED">First name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LASTNAME">Last name</label>\n        <input name="lastName" ng-model="vm.contact.lastName" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.PHONE">Phone</label>\n        <input name="phone" ng-model="vm.contact.phone" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.EMAIL">Email</label>\n        <input name="email" type="email" ng-model="vm.contact.email" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.MOBILE">Mobile</label>\n        <input name="mobile" ng-model="vm.contact.mobile" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.FAX">Fax</label>\n        <input name="fax" ng-model="vm.contact.fax" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LIST">List</label>\n        <md-select name="list" ng-model="vm.contact.ListId" ng-disabled="vm.contact.id && vm.contact.ListId" ng-change="vm.getCustomFields(vm.contact.ListId)" required>\n          <md-optgroup label="Lists">\n            <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="contactForm.list.$error" ng-show="contactForm.list.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" flex-gt-sm="">\n        <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n          <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n            {{ $chip.phone }}\n          </md-chip-template>\n        </md-chips>\n      </md-input-container>\n      <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="100">\n        <div class="pb-16" layout="column" layout-align="start center">\n          <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n        </div>\n        <form flex name="additionalPhonesForm" novalidate>\n          <div ng-repeat="additionalPhone in vm.additionalItems">\n            <div layout="row" flex="1">\n              <md-input-container class="md-block" flex="50">\n                <label>{{$index}} - {{additionalPhone.phone}}</label>\n                <md-select ng-model="vm.additionalItemTypes[$index]" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                  <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-block" flex="50">\n                <input ng-model="additionalPhone.description" ng-cloak>\n              </md-input-container>\n            </div>\n          </div>\n        </form>\n      </div>\n\n      <md-input-container>\n        <label translate="CONTACTMANAGER.TIMEZONE">Timezone</label>\n        <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone"></ms-timezone>\n      </md-input-container>\n\n      <div ng-repeat="customField in vm.customFields.rows" class="md-block" ng-switch="customField.type">\n        <div ng-switch-when="datetime">\n          <label>{{customField.alias}}</label>\n          <div>\n            \x3c!-- ng-model="customField.value" --\x3e\n            <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]"></mdp-date-picker>\n            <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n            </mdp-time-picker>\n          </div>\n        </div>\n\n        <div ng-switch-when="select">\n          <label>{{customField.alias}}</label>\n          <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n            <md-option ng-repeat="value in customField.values" ng-value="value.value">{{value.value}}</md-option>\n            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n          </md-select>\n        </div>\n\n        <div ng-switch-when="switch">\n          <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n            {{customField.alias}}\n          </md-switch>\n        </div>\n\n        <md-input-container ng-switch-default>\n          <label>{{customField.alias}}</label>\n          <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.COMPANY">Company</label>\n        <md-select name="company" ng-model="vm.contact.CompanyId">\n          <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows" ng-hide="!vm.contact.CompanyId && company.canSelect === false" ng-disabled="company.canSelect === false">\n            {{company.name}}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <div ng-if="!vm.allFields" layout="row" layout-align="center center">\n        <md-button class="md-accent" ng-click="vm.allFields = true" translate="CONTACTMANAGER.SHOW_ALL_FIELDS">Show All\n          Fields</md-button>\n      </div>\n\n      <md-input-container class="md-block" ng-if="vm.allFields" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\n        <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>\n        <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth">\n        </mdp-date-picker>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n        <input type="text" name="country" ng-model="vm.contact.country">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.CITY">City</label>\n        <input type="text" name="city" ng-model="vm.contact.city">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.STREET">Street</label>\n        <input type="text" name="street" ng-model="vm.contact.street">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.POSTAL_CODE">Postal Code</label>\n        <input type="text" name="postalCode" ng-model="vm.contact.postalCode">\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.allFields">\n        <label translate="CONTACTMANAGER.NOTES">Notes</label>\n        <input type="text" name="description" ng-model="vm.contact.description">\n      </md-input-container>\n\n      <div ng-if="vm.allFields" layout="row" layout-align="center center">\n        <md-button class="md-accent" ng-click="vm.allFields = false" translate="CONTACTMANAGER.FEWER_FIELDS">Fewer\n          Fields</md-button>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newContact" ng-click="vm.saveContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid || contactForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newContact" ng-click="vm.addNewContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid || contactForm.$pristine" aria-label="ADD" translate="CONTACTMANAGER.ADD_CONTACT" translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n          ADD CONTACT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContact" ng-click="vm.deleteContact($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/duplicate/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="{{ \'CONTACTMANAGER.DUPLICATE_CONTACT\' | translate }}">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.LIST">List</label>\n        <md-select name="list" ng-model="vm.contact.ListId">\n          <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n        </md-select>\n\n        <div ng-messages="contactForm.list.$error" ng-show="contactForm.list.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.addNewContact()" class="send-button md-accent md-raised" ng-disabled="contactForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_CONTACT" translate-attr-aria-label="CONTACTMANAGER.ADD_CONTACT">\n          ADD CONTACT\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div flex class="md-block">\n        <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n          <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="CONTACTMANAGER.ERRORS.DATE_REQUIRED">Date is required</span>\n            </div>\n            <div ng-message="format">\n              <span translate="CONTACTMANAGER.ERRORS.DATE_INVALID">Date is invalid</span>\n            </div>\n          </div>\n        </mdp-date-picker>\n      </div>\n\n      <div flex class="md-block">\n        <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n          <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="CONTACTMANAGER.ERRORS.TIME_REQUIRED">Time is required</span>\n            </div>\n            <div ng-message="format">\n              <span translate="CONTACTMANAGER.ERRORS.TIME_INVALID">Time is invalid</span>\n            </div>\n          </div>\n        </mdp-time-picker>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-if="!vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_HOPPER" translate-attr-aria-label="CONTACTMANAGER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="!vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/edit/view.html",'<div id="cm-contact" class="page-layout simple tabbed" layout="column" ng-init="vm.onInit()">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-contacts-button md-icon-button" aria-label="Go to contacts" ng-click="vm.gotoContacts()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_CONTACTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="contact-image" hide-xs>\n          <img ng-src="assets/images/business/contacts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.contact.id}} {{vm.contact.firstName}} {{vm.contact.lastName}}\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.contact.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-if="vm.contact.role && vm.contact.role !== \'admin\'" ng-controller="ContactQueueAddButtonController as vm_contact_qa" ng-cloak>\n      <md-fab-speed-dial ng-hide="vm_contact_qa.hidden" md-direction="left" md-open="vm_contact_qa.isOpen" class="md-scale md-fab" ng-class="{ \'md-hover-full\': vm_contact_qa.hover }" ng-mouseenter="vm_contact_qa.isOpen=true" ng-mouseleave="vm_contact_qa.isOpen=false">\n        <md-fab-trigger>\n          <md-button aria-label="menu" class="md-fab md-primary md-icon-button">\n            <md-tooltip md-direction="top" md-visible="tooltipVisible">Channels</md-tooltip>\n            <md-icon md-font-icon="icon-eye" aria-label="channels"></md-icon>\n          </md-button>\n        </md-fab-trigger>\n        <md-fab-actions>\n          <div ng-repeat="channel in vm_contact_qa.channels">\n            <md-button aria-label="{{channel.name}}" class="md-fab md-raised md-icon-button md-mini" ng-click="vm_contact_qa.openDialog($event, vm.contact, channel)">\n              <md-tooltip md-direction="{{channel.direction}}" md-visible="tooltipVisible" md-autohide="false">\n                {{channel.name}}\n              </md-tooltip>\n              <md-icon md-font-icon="{{channel.icon}}" aria-label="{{channel.name}}"></md-icon>\n            </md-button>\n          </div>\n        </md-fab-actions>\n      </md-fab-speed-dial>\n    </div>\n\n    <div ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.duplicateContact($event)" class="md-fab md-warn md-icon-button" aria-label="DUPLICATE">\n        <md-icon md-font-icon="icon-file-multiple"></md-icon>\n      </md-button>\n      <md-button type="submit" ng-click="vm.saveContact()" class="send-button md-accent md-raised" ng-disabled="detailForm.$pristine && customFieldsForm.$pristine && socialForm.$pristine && additionalPhonesForm.$pristine" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.DETAIL">DETAIL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div layout="column" flex="70">\n              <md-card class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.PERSONAL_INFO">PERSONAL_INFO\n                  </div>\n                </div>\n                <form name="detailForm" novalidate>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- fistName --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.FIRSTNAME">First Name</label>\n                      <md-icon md-font-icon="icon-account" class="firstname"></md-icon>\n                      <input type="text" name="firstName" ng-model="vm.contact.firstName" class="text-truncate" required ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                      <div ng-messages="detailForm.firstName.$error" ng-show="detailForm.firstName.$touched" role="alert">\n                        <div ng-message="required">\n                          <span translate="CONTACTMANAGER.ERRORS.FIRSTNAME_REQUIRED">First name field is required</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- lastName --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.LASTNAME">Last Name</label>\n                      <input type="text" name="lastName" ng-model="vm.contact.lastName" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- phone --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.PHONE">Phone</label>\n                      <md-icon md-font-icon="icon-phone"></md-icon>\n                      <input type="text" name="phone" ng-model="vm.contact.phone" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- mobile --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.MOBILE">Mobile</label>\n                      <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n                      <input type="text" name="mobile" ng-model="vm.contact.mobile" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    \x3c!-- email --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.EMAIL">Email</label>\n                      <md-icon md-font-icon="icon-email" class="email"></md-icon>\n                      <input type="email" name="email" ng-model="vm.contact.email" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                      <div ng-messages="detailForm.firstName.$error" ng-show="detailForm.firstName.$touched" role="alert">\n                        <div ng-message="email">\n                          <span translate="CONTACTMANAGER.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail\n                            address</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div flex="5"></div>\n                    \x3c!-- fax --\x3e\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.FAX">Fax</label>\n                      <md-icon md-font-icon="icon-deskphone"></md-icon>\n                      <input type="text" name="fax" ng-model="vm.contact.fax" ng-disabled="!vm.crudPermissions.canEdit" privacy="!vm.crudPermissions.canEdit" ng-cloak>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.TIMEZONE">Timezone</label>\n                      <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.ADDITIONAL_PHONES">Additional Phones</label>\n                      <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n                        <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n                          {{ $chip.phone }}\n                        </md-chip-template>\n                      </md-chips>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="" ng-init="vm.contact.dateOfBirth = vm.getDateFromString(vm.contact.dateOfBirth)">\n                      <label translate="CONTACTMANAGER.DATE_OF_BIRTH">Date of Birth</label>\n                      <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth" mdp-disabled="!vm.crudPermissions.canEdit"></mdp-date-picker>\n                    </md-input-container>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container ng-if="vm.companies.rows.length" class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.COMPANY">Company</label>\n                      <md-icon md-font-icon="icon-domain"></md-icon>\n                      <md-select name="company" ng-model="vm.contact.CompanyId" ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-optgroup label="Companies">\n                          <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows" ng-disabled="company.canSelect === false">{{company.name}}</md-option>\n                          <md-option ng-value=" null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                        </md-optgroup>\n                      </md-select>\n                      <md-icon class="pointer" ng-show="vm.contact.CompanyId" md-font-icon="icon-information-outline" ng-click="vm.editCompany($event, vm.contact.CompanyId)"></md-icon>\n                    </md-input-container>\n                    <section ng-if="!vm.companies.rows.length" flex-gt-sm="">\n                      <md-icon md-font-icon="icon-briefcase"></md-icon>\n                      <label translate="CONTACTMANAGER.NO_COMPANIES">No Companies</label>\n                    </section>\n                  </div>\n\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container ng-if="vm.tags.rows.length" class="md-block" flex-gt-sm="">\n                      <label translate="CONTACTMANAGER.TAGS">Tags</label>\n                      <md-icon md-font-icon="icon-tag"></md-icon>\n                      <md-select ng-model="vm.Tags" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-optgroup label="Tags">\n                          <md-option ng-value="tag.id" ng-repeat="tag in vm.tags.rows" ng-disabled="tag.canSelect === false">{{tag.name}}</md-option>\n                        </md-optgroup>\n                      </md-select>\n                    </md-input-container>\n                    <section ng-if="!vm.tags.rows.length" flex-gt-sm="">\n                      <md-icon md-font-icon="icon-tag"></md-icon>\n                      <label translate="CONTACTMANAGER.NO_TAG">No Tags</label>\n                      <md-button class="md-accent" translate="CONTACTMANAGER.ADD_TAG">Add Tag</md-button>\n                    </section>\n                  </div>\n\n                  <div ng-if="!vm.allFields" layout="row" layout-align="center center">\n                    <md-button class="md-accent" ng-click="vm.allFields = true" translate="CONTACTMANAGER.SHOW_ALL_FIELDS">Show All Fields</md-button>\n                  </div>\n\n                  <div ng-if="vm.allFields">\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      \x3c!-- country --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.COUNTRY">Country</label>\n                        <md-icon md-font-icon="icon-home" class="country"></md-icon>\n                        <input type="text" name="country" ng-model="vm.contact.country" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                      <div flex="5"></div>\n                      \x3c!-- city --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.CITY">City</label>\n                        <input type="text" name="city" ng-model="vm.contact.city" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                    </div>\n\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      <div flex="5"></div>\n                      \x3c!-- street --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.STREET">Street</label>\n                        <input type="text" name="street" ng-model="vm.contact.street" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                      <div flex="5"></div>\n                      \x3c!-- postalCode --\x3e\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate="CONTACTMANAGER.POSTALCODE">Postal Code</label>\n                        <input type="text" name="postalCode" ng-model="vm.contact.postalCode" ng-disabled="!vm.crudPermissions.canEdit">\n                      </md-input-container>\n                    </div>\n\n                    <div layout-gt-sm="row" class="layout-gt-sm-row">\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label translate translate-attr-placeholder="CONTACTMANAGER.NOTES">Notes</label>\n                        <md-icon md-font-icon="icon-note"></md-icon>\n                        <textarea ng-model="vm.contact.description" type="text" max-rows="4" ng-disabled="!vm.crudPermissions.canEdit"></textarea>\n                      </md-input-container>\n                    </div>\n\n                    <div layout="row" layout-align="center center">\n                      <md-button class="md-accent" ng-click="vm.allFields = false" translate="CONTACTMANAGER.FEWER_FIELDS">Fewer Fields\n                      </md-button>\n                    </div>\n\n                  </div>\n                </form>\n              </md-card>\n              <md-card class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n                <div class="pb-16" layout="row" layout-align="start center">\n                  <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.SOCIAL">Social</div>\n                </div>\n                <form name="socialForm" novalidate>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Facebook</label>\n                      <md-icon md-font-icon="icon-facebook" class="facebook"></md-icon>\n                      <input type="text" name="facebook" ng-model="vm.contact.facebook" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Twitter</label>\n                      <md-icon md-font-icon="icon-twitter" class="twitter"></md-icon>\n                      <input type="text" name="twitter" ng-model="vm.contact.twitter" class="text-truncate" ng-disabled="!vm.crudPermissions.canEdit">\n                    </md-input-container>\n                  </div>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Line</label>\n                      <md-icon md-font-icon="fab fa-line"></md-icon>\n                      <input type="text" name="line" ng-model="vm.contact.line" class="text-truncate">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Viber</label>\n                      <md-icon md-font-icon="fab fa-viber"></md-icon>\n                      <input type="text" name="viber" ng-model="vm.contact.viber" class="text-truncate">\n                    </md-input-container>\n                  </div>\n                  <div layout-gt-sm="row" class="layout-gt-sm-row">\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>WeChat</label>\n                      <md-icon md-font-icon="fab fa-weixin"></md-icon>\n                      <input type="text" name="wechat" ng-model="vm.contact.wechat" class="text-truncate">\n                    </md-input-container>\n                    <div flex="5"></div>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label>Telegram</label>\n                      <md-icon md-font-icon="icon-telegram"></md-icon>\n                      <input type="text" name="telegram" ng-model="vm.contact.telegram" class="text-truncate">\n                    </md-input-container>\n                  </div>\n                </form>\n              </md-card>\n            </div>\n\n            <div flex></div>\n\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.CUSTOM_FIELDS">CUSTOM FIELDS\n                </div>\n              </div>\n              <form name="customFieldsForm" novalidate>\n                <md-input-container class="md-block">\n                  <label translate translate-attr-placeholder="CONTACTMANAGER.LIST">List</label>\n                  <md-select name="list" ng-model="vm.contact.ListId" md-on-close="vm.onSelectList($event)" ng-disabled="vm.contact.ListId">\n                    <md-optgroup label="Lists">\n                      <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">#{{list.id}} - {{list.name}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                    </md-optgroup>\n                  </md-select>\n                </md-input-container>\n                <div ng-repeat="customField in vm.customFields.rows" ng-switch="customField.type">\n                  <md-input-container class="md-block" ng-switch-when="datetime">\n                    <label>{{customField.alias}}</label>\n                    <div ng-init="vm.contact[\'cf_\' + customField.id] = vm.getDateFromString(vm.contact[\'cf_\' + customField.id])">\n                      <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]"></mdp-date-picker>\n                      <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-time-picker>\n                    </div>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="select">\n                    <label>{{customField.alias}}</label>\n                    <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required" ng-disabled="!vm.crudPermissions.canEdit">\n                      <md-option ng-repeat="value in customField.values" ng-value="value.value">{{value.value}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                    </md-select>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="switch">\n                    <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n                      {{customField.alias}}\n                    </md-switch>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-default>\n                    <label>{{customField.alias}}</label>\n                    <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required" ng-disabled="!vm.crudPermissions.canEdit">\n                  </md-input-container>\n                </div>\n              </form>\n            </div>\n\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n              <div class="pb-16" layout="row" layout-align="start center">\n                <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n              </div>\n              <form name="additionalPhonesForm" novalidate>\n                <div ng-repeat="additionalPhone in vm.additionalItems">\n                  <div layout="row">\n                    <md-button class="md-icon-button" ng-show="!$first" ng-click="vm.moveUp($index)">\n                      <md-tooltip>{{\'CONTACTMANAGER.MOVE_UP\' | translate}}</md-tooltip>\n                      <md-icon md-font-icon="icon-arrow-up"></md-icon>\n                    </md-button>\n                    <md-button class="md-icon-button md-primary" ng-show="!$last" ng-click="vm.moveDown($index)">\n                      <md-tooltip>{{\'CONTACTMANAGER.MOVE_DOWN\' | translate}}</md-tooltip>\n                      <md-icon md-font-icon="icon-arrow-down"></md-icon>\n                    </md-button>\n                  </div>\n                  <div layout="column" style="margin-bottom:5px;border-bottom: 1px solid gray;">\n                    <md-input-container class="md-block">\n                      <label>{{$index}} - {{additionalPhone.phone}}</label>\n                      <md-select ng-model="additionalPhone.ItemTypeId" ng-disabled="!vm.crudPermissions.canEdit">\n                        <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                        <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                      </md-select>\n                    </md-input-container>\n                    <md-input-container class="md-block">\n                      <input ng-model="additionalPhone.description" ng-cloak>\n                    </md-input-container>\n                  </div>\n                </div>\n              </form>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab ng-if="vm.license.dialer">\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.MOTION_BULL">MOTION BULL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.HOPPER">Hopper</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryHopper.filter = query;" on-collapse="vm.queryHopper.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getHoppers()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryHopper.sort" md-on-reorder="vm.getHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                      <th md-column md-order-by="phone">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | translate }}</th>\n                      <th md-column md-order-by="priority">{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n                      <th md-column md-order-by="recallme">{{ \'CONTACTMANAGER.RECALLME\' | translate }}</th>\n                      <th md-column md-order-by="VoiceQueueId">{{ \'CONTACTMANAGER.VOICEQUEUEID\' | translate }}</th>\n                      <th md-column md-order-by="CampaignId">{{ \'CONTACTMANAGER.CAMPAIGNID\' | translate }}</th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.hoppers.count">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, hopper) in vm.hoppers.rows">\n                      <td md-cell>{{hopper.id}}</td>\n                      <td md-cell privacy ng-cloak>{{hopper.phone}}</td>\n                      <td md-cell>{{hopper.scheduledat | date:\'medium\'}}</td>\n                      <td md-cell>{{ vm.arraypriority[hopper.priority].option }}</td>\n                      <td md-cell class="recallme ">\n                        <md-icon md-colors="{color: {{hopper.recallme ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{hopper.recallme? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell>{{hopper.VoiceQueueId}}</td>\n                      <td md-cell>{{hopper.CampaignId}}</td>\n                      <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="2">\n                            <md-menu-item>\n                              <md-button ng-if="vm.crudPermissions.canEdit && hopper.VoiceQueueId" ng-click="vm.editHopper($event, hopper)" translate="CONTACTMANAGER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                              <md-button ng-if="vm.crudPermissions.canEdit && hopper.CampaignId" ng-click="vm.createOrEditIvrCampaignHopper($event, hopper)" translate="CONTACTMANAGER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item>\n                              <md-button ng-click="vm.crudPermissions.canDelete && vm.deleteconfirm(hopper, $event)" translate="CONTACTMANAGER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHopper.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHopper.page" md-total="{{vm.hoppers.count}}" md-on-paginate="vm.getHoppers" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.FINAL">Final</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryFinal.filter = query;" on-collapse="vm.queryFinal.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getFinals()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryFinal.sort" md-on-reorder="vm.getFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">{{ \'CONTACTMANAGER.UNIQUEID\' | translate }}</th>\n                      <th md-column md-order-by="calleridnum">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="state">{{ \'CONTACTMANAGER.STATE\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="disposition">{{ \'CONTACTMANAGER.DISPOSITION\' | translate }}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.finals.count">\n                      <td md-cell colspan="5">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, final) in vm.finals.rows">\n                      <td md-cell>{{final.uniqueid}}</td>\n                      <td md-cell privacy ng-cloak>{{final.calleridnum}}</td>\n                      <td md-cell>{{final.statedesc}}</td>\n                      <td md-cell>{{final.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{final.disposition}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryFinal.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryFinal.page" md-total="{{vm.finals.count}}" md-on-paginate="vm.getFinals" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.HISTORY">History</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryHistory.filter = query;" on-collapse="vm.queryHistory.filter = undefined;" debounce="300"></ms-search-bar>\n                  <md-button class="md-icon-button" ng-click="vm.getHistories()" aria-label="reload" translate translate-attr-label="CONTACTMANAGER.RELOAD">\n                    <md-tooltip>{{\'CONTACTMANAGER.RELOAD\' | translate}}</md-tooltip>\n                    <md-icon md-font-icon="icon-reload"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- HOPPER TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryHistory.sort" md-on-reorder="vm.getHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">{{ \'CONTACTMANAGER.UNIQUEID\' | translate }}</th>\n                      <th md-column md-order-by="calleridnum">{{ \'CONTACTMANAGER.PHONE\' | translate }}</th>\n                      <th md-column md-order-by="state">{{ \'CONTACTMANAGER.STATE\' | translate }}</th>\n                      <th md-column md-order-by="scheduledat">{{ \'CONTACTMANAGER.SCHEDULEDAT\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="endtime">{{ \'CONTACTMANAGER.ENDTIME\' | translate }}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.histories.count">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, history) in vm.histories.rows">\n                      <td md-cell>{{history.uniqueid}}</td>\n                      <td md-cell privacy ng-cloak>{{history.calleridnum}}</td>\n                      <td md-cell>{{history.statedesc}}</td>\n                      <td md-cell>{{history.scheduledat | date:\'medium\'}}</td>\n                      <td md-cell>{{history.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{history.endtime | date:\'medium\'}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHistory.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHistory.page" md-total="{{vm.histories.count}}" md-on-paginate="vm.getHistories" md-page-select></md-table-pagination>\n              \x3c!-- / HOPPER TABLE --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab ng-if="vm.license.jscripty">\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.JSCRIPTY">JSCRIPTY</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div layout="row">\n            <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.SESSIONS">Sessions</span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.queryJscriptySession.filter = query;" on-collapse="vm.queryJscriptySession.filter = undefined;" debounce="300"></ms-search-bar>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- SESSION TABLE --\x3e\n              <md-table-container>\n                <table md-table multiple md-progress="vm.promise">\n                  <thead md-head md-order="vm.queryJscriptySession.sort" md-on-reorder="vm.getJscriptySessions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                      <th md-column md-order-by="starttime">{{ \'CONTACTMANAGER.STARTTIME\' | translate }}</th>\n                      <th md-column md-order-by="endtime">{{ \'CONTACTMANAGER.ENDTIME\' | translate }}</th>\n                      <th md-column md-order-by="agent">{{ \'CONTACTMANAGER.AGENT\' | translate }}</th>\n                      <th md-column md-order-by="project">{{ \'CONTACTMANAGER.PROJECT\' | translate }}</th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-hide="vm.jscriptySessions.count">\n                      <td md-cell colspan="6">\n                        <div layout="row" layout-align="center center">\n                          <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                        </div>\n                      </td>\n                    </tr>\n                    <tr md-row ng-repeat="(id, session) in vm.jscriptySessions.rows">\n                      <td md-cell>{{session.id}}</td>\n                      <td md-cell>{{session.starttime | date:\'medium\'}}</td>\n                      <td md-cell>{{session.endtime | date:\'medium\'}}</td>\n                      <td md-cell>{{session.membername}}</td>\n                      <td md-cell>{{session.projectname}}</td>\n                      <td md-cell class="actions"></td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.queryHopper.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queryHopper.page" md-total="{{vm.hoppers.count}}" md-on-paginate="vm.getHoppers" md-page-select></md-table-pagination>\n              \x3c!-- / SESSION TABLE --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.CUSTOMER_JOURNEY">CUSTOMER JOURNEY</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <md-content class="md-padding" id="journey-content">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n            </div>\n          </md-content>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/contacts/import/import.html",'<md-dialog class="import-dialog" aria-label="Import contact">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="CONTACTMANAGER.IMPORT_CONTACTS">Import Contacts</span>\n        <md-button ng-if="vm.result.finish || !vm.processing" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear ng-disabled="!vm.processing || vm.result.finish" md-mode="indeterminate" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div>\n        <md-content ng-show="!vm.processing">\n          <div class="form-title" translate="CONTACTMANAGER.CONTACTMANAGER">CONTACT MANAGER</div>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="contactField in vm.contactFields">\n            <label>{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</label>\n            <md-select name="{{contactField.key}}" ng-model="vm.binding[contactField.key]" placeholder="{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}" ng-required="contactField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="contactField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.LIST">List</label>\n            <md-select name="list" ng-model="vm.ListId" placeholder="Select a list" ng-change="vm.onChangeList()" required>\n              <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="customField in vm.customFields.rows">\n            <label>{{customField.alias}}</label>\n            <md-select ng-model="vm.binding[\'cf_\' + customField.id]" placeholder="{{customField.alias}}" ng-required="customField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="customField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.COMPANY">Company</label>\n            <md-select name="company" ng-model="vm.CompanyId" placeholder="Select a company">\n              <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n              <md-option ng-value="null">\n                <em translate="CONTACTMANAGER.NONE">None</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <md-select ng-model="vm.duplicates" placeholder="{{ \'CONTACTMANAGER.CHECK_DUPLICATES\' | translate}}" multiple>\n              <md-option ng-value="contactField.key" ng-repeat="contactField in vm.contactFields">{{ \'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <div ng-if="vm.license.dialer">\n            <div class="form-title" translate="CONTACTMANAGER.MOTIONDIALER">MOTION BULL</div>\n\n            <md-input-container class="md-icon-float md-block" ng-repeat="motionBullField in vm.motionBullFields">\n              <label>{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}</label>\n              <md-select name="{{motionBullField.key}}" ng-model="vm.binding[motionBullField.key]" placeholder="{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}" ng-required="motionBullField.required">\n                <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                <md-option ng-value="null" ng-hide="contactField.required">\n                  <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n                </md-option>\n              </md-select>\n            </md-input-container>\n            <div class="form-title" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n            <div layout="row" ng-repeat="additionalPhone in vm.contactItemTypes" flex>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select name="{{additionalPhone.key}}" ng-model="vm.binding[additionalPhone.key]" placeholder="{{additionalPhone.key}}" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select name="{{additionalPhone.key+\'_description\'}}" ng-model="vm.binding[additionalPhone.key+\'_description\']" placeholder="{{additionalPhone.key}} description" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n            </div>\n          </div>\n\n        </md-content>\n\n        <div class="error-list" ng-if="vm.result.finish">\n          <div class="info" layout="row" layout-align="space-between center">\n            <div>\n              <div class="message">{{\'CONTACTMANAGER.UPLOAD_COMPLETED\' | translate | uppercase}} ({{vm.result.elapsed}}s)</div>\n            </div>\n            <md-button class="md-icon-button">\n              <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n            </md-button>\n          </div>\n        </div>\n\n        <div layout="row" ng-if="vm.processing">\n          \x3c!-- WIDGET PROCESSING --\x3e\n          <ms-widget ng-if="!vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.rows"></span>\n                </div>\n                <div ng-if="vm.processing" class="font-weight-500 secondary-text">Please wait, we are processing your contacts...</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET PROCESSING --\x3e\n          \x3c!-- WIDGET SUCCESS --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 green-fg">\n                  <span ng-bind="vm.result.affectedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.SUCCESS">Success</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET SUCCESS --\x3e\n\n          \x3c!-- WIDGET FAILURE --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 red-fg">\n                  <span ng-bind="vm.result.failedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.FAILURE">Failure</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET FAILURE --\x3e\n\n          \x3c!-- WIDGET DUPLICATES --\x3e\n          <ms-widget ng-if="vm.result.duplicatedRows && vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.duplicatedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.DUPLICATES">Duplicates</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET DUPLICATES --\x3e\n        </div>\n\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row">\n        <md-button ng-if="!vm.processing" ng-disabled="importForm.$invalid || importForm.$pristine" ng-click="vm.uploadCsv()" class="md-accent md-raised" aria-label="UPLOAD" translate="CONTACTMANAGER.UPLOAD" translate-attr-aria-label="CONTACTMANAGER.IMPORT">\n          IMPORT\n        </md-button>\n        <md-button ng-if="vm.processing && !vm.result.finish && !vm.stopping" ng-click="vm.stopUpload()" class="md-accent md-raised" aria-label="Stop Upload" translate="CONTACTMANAGER.STOP" translate-attr-aria-label="CONTACTMANAGER.STOP">\n          STOP\n        </md-button>\n        <md-button ng-if="vm.result.finish && vm.result.errors.length" ng-csv="vm.getArrayErrors()" csv-header="vm.getHeaderErrors()" class="md-accent md-raised" aria-label="Export Errors" filename="contacts_import_errors.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon> {{\'CONTACTMANAGER.EXPORT_ERRORS\' | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/import/importUpdates.html",'<md-dialog class="import-dialog" aria-label="Import contact">\n  <form name="importForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="CONTACTMANAGER.UPDATE_EXISTING_CONTACTS">Update Existing Contacts</span>\n        <md-button ng-if="vm.result.finish || !vm.processing" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear ng-disabled="!vm.processing || vm.result.finish" md-mode="indeterminate" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div>\n        <md-content ng-show="!vm.processing">\n          <div class="form-title" translate="CONTACTMANAGER.CONTACTMANAGER">CONTACT MANAGER</div>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="contactField in vm.contactFields">\n            <label>{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</label>\n            <md-select name="{{contactField.key}}" ng-model="vm.binding[contactField.key]" placeholder="{{\'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}" ng-required="contactField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="contactField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.LIST">List</label>\n            <md-select name="list" ng-model="vm.ListId" placeholder="Select a list" ng-change="vm.onChangeList()" required>\n              <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">{{list.name}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block" ng-repeat="customField in vm.customFields.rows">\n            <label>{{customField.alias}}</label>\n            <md-select ng-model="vm.binding[\'cf_\' + customField.id]" placeholder="{{customField.alias}}" ng-required="customField.required">\n              <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n              <md-option ng-value="null" ng-hide="customField.required">\n                <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <label translate="CONTACTMANAGER.COMPANY">Company</label>\n            <md-select name="company" ng-model="vm.CompanyId" placeholder="Select a company">\n              <md-option ng-value="company.id" ng-repeat="company in vm.companies.rows">{{company.name}}</md-option>\n              <md-option ng-value="null">\n                <em translate="CONTACTMANAGER.NONE">None</em>\n              </md-option>\n            </md-select>\n          </md-input-container>\n\n          <md-input-container class="md-icon-float md-block">\n            <md-select ng-model="vm.duplicates" placeholder="{{ \'CONTACTMANAGER.CHECK_DUPLICATES\' | translate}}" multiple>\n              <md-option ng-value="contactField.key" ng-repeat="contactField in vm.contactFields">{{ \'CONTACTMANAGER.\' + contactField.key | uppercase | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n\n          <div ng-if="vm.license.dialer">\n            <div class="form-title" translate="CONTACTMANAGER.MOTIONDIALER">MOTION BULL</div>\n\n            <md-input-container class="md-icon-float md-block" ng-repeat="motionBullField in vm.motionBullFields">\n              <label>{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}</label>\n              <md-select name="{{motionBullField.key}}" ng-model="vm.binding[motionBullField.key]" placeholder="{{\'CONTACTMANAGER.\' + motionBullField.key | uppercase | translate}}" ng-required="motionBullField.required">\n                <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                <md-option ng-value="null" ng-hide="contactField.required">\n                  <em>{{ \'CONTACTMANAGER.NONE\' | translate }}</em>\n                </md-option>\n              </md-select>\n            </md-input-container>\n            <div class="form-title" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n            <div layout="row" ng-repeat="additionalPhone in vm.contactItemTypes" flex>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select multiple="true" name="{{additionalPhone.key}}" ng-model="vm.binding[additionalPhone.key]" placeholder="{{additionalPhone.key}}" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n              <md-input-container class="md-icon-float md-block" flex="50">\n                <md-select multiple="true" name="{{additionalPhone.key+\'_description\'}}" ng-model="vm.binding[additionalPhone.key+\'_description\']" placeholder="{{additionalPhone.key}} description" ng-required="additionalPhone.required">\n                  <md-option ng-value="field" ng-repeat="field in vm.fields">{{ field }}</md-option>\n                  </md-option>\n                </md-select>\n              </md-input-container>\n            </div>\n          </div>\n\n        </md-content>\n\n        <div class="error-list" ng-if="vm.result.finish">\n          <div class="info" layout="row" layout-align="space-between center">\n            <div>\n              <div class="message">{{\'CONTACTMANAGER.UPLOAD_COMPLETED\' | translate | uppercase}} ({{vm.result.elapsed}}s)</div>\n            </div>\n            <md-button class="md-icon-button">\n              <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n            </md-button>\n          </div>\n        </div>\n\n        <div layout="row" ng-if="vm.processing">\n          \x3c!-- WIDGET PROCESSING --\x3e\n          <ms-widget ng-if="!vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.rows"></span>\n                </div>\n                <div ng-if="vm.processing" class="font-weight-500 secondary-text">Please wait, we are processing your contacts...</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET PROCESSING --\x3e\n          \x3c!-- WIDGET SUCCESS --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 green-fg">\n                  <span ng-bind="vm.result.affectedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.SUCCESS">Success</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET SUCCESS --\x3e\n\n          \x3c!-- WIDGET FAILURE --\x3e\n          <ms-widget ng-if="vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 red-fg">\n                  <span ng-bind="vm.result.failedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.FAILURE">Failure</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET FAILURE --\x3e\n\n          \x3c!-- WIDGET DUPLICATES --\x3e\n          <ms-widget ng-if="vm.result.duplicatedRows && vm.result.finish" class="h-140" flex>\n            \x3c!-- Front --\x3e\n            <ms-widget-front class="p-16 white-bg">\n              <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                <div class="md-display-1 pb-8 orange-fg">\n                  <span ng-bind="vm.result.duplicatedRows"></span>\n                </div>\n                <div class="font-weight-500 secondary-text" translate="CONTACTMANAGER.DUPLICATES">Duplicates</div>\n              </div>\n            </ms-widget-front>\n            \x3c!-- / Front --\x3e\n          </ms-widget>\n          \x3c!-- / WIDGET DUPLICATES --\x3e\n        </div>\n\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row">\n        <md-button ng-if="!vm.processing" ng-disabled="importForm.$invalid || importForm.$pristine" ng-click="vm.uploadCsv()" class="md-accent md-raised" aria-label="UPLOAD" translate="CONTACTMANAGER.UPLOAD" translate-attr-aria-label="CONTACTMANAGER.IMPORT">\n          IMPORT\n        </md-button>\n        <md-button ng-if="vm.processing && !vm.result.finish && !vm.stopping" ng-click="vm.stopUpload()" class="md-accent md-raised" aria-label="Stop Upload" translate="CONTACTMANAGER.STOP" translate-attr-aria-label="CONTACTMANAGER.STOP">\n          STOP\n        </md-button>\n        <md-button ng-if="vm.result.finish && vm.result.errors.length" ng-csv="vm.getArrayErrors()" csv-header="vm.getHeaderErrors()" class="md-accent md-raised" aria-label="Export Errors" filename="contacts_import_errors.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon> {{\'CONTACTMANAGER.EXPORT_ERRORS\' | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/contacts/merge/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="Merge Contact">\n  <form name="contactForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block" flex-gt-sm>\n        <label>Filter</label>\n        <input ng-model="vm.searchTerm" name="searchTerm" ng-model-options="{ debounce: 300 }" ng-change="vm.change()">\n      </md-input-container>\n\n      <md-list flex>\n        <md-subheader class="md-no-sticky" ng-hide="vm.contacts.length"><em>Filter doesn\'t match any contact</em></md-subheader>\n        <md-list-item class="md-3-line" ng-repeat="contact in vm.contacts | filter:{ id: \'!\' + vm.contact.id}" ng-click="vm.showConfirm($event, vm.contact, contact)">\n          <img ng-src="assets/images/avatars/profile.png" class="md-avatar" alt="{{contact.who}}" />\n          <div class="md-list-item-text" layout="column">\n            <h3>#{{ contact.id }} - {{ contact.firstName }} {{ contact.lastName }}</h3>\n            <h4>{{ contact.email }}</h4>\n            <p>{{ contact.phone }}</p>\n          </div>\n        </md-list-item>\n      </md-list>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/globalCustomFields/create/dialog.html",'<md-dialog class="globalCustomField-dialog" aria-label="New GlobalCustomField">\n  <form name="globalCustomFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.ALIAS">Alias</label>\n        <input type="" name="alias" ng-model="vm.globalCustomField.alias" ng-required="true" autofocus>\n\n        <div ng-messages="globalCustomFieldForm[\'alias\'].$error" ng-show="globalCustomFieldForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.globalCustomField.type" required ng-disabled="!vm.newGlobalCustomField">\n          <md-option ng-value="\'text\'">Text</md-option>\n          <md-option ng-value="\'select\'">Select</md-option>\n          <md-option ng-value="\'number\'">Number</md-option>\n          <md-option ng-value="\'switch\'">Switch</md-option>\n          <md-option ng-value="\'datetime\'">Datetime</md-option>\n        </md-select>\n        <div ng-messages="globalCustomFieldForm[\'type\'].$error" ng-show="globalCustomFieldForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.globalCustomField.type == \'select\'" class="md-block">\n        <md-list>\n          <md-list-item layout-margin>\n            <md-button class="md-fab md-mini md-secondary" ng-click="vm.addItem(vm.globalCustomField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip>\n              <md-icon md-font-icon="icon-plus" aria-label="alert error"></md-icon>\n            </md-button>\n            <md-button ng-if="vm.globalCustomField.values.length" class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItems(vm.globalCustomField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE_ALL">Delete All</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list ng-sortable="vm.sortable">\n          <md-list-item ng-repeat="item in vm.globalCustomField.values" style="border: 1px solid #ccc!important; border-radius: 7px;" layout-margin>\n            <div>\n              <md-icon class="s24" style="cursor:move" md-font-icon="icon-drag" aria-label="drag"></md-icon>\n              <input type="text" ng-model="item.value" flex>\n            </div>\n            <md-button class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItem(vm.globalCustomField.values, $index);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list>\n          <md-list-item ng-if="!vm.globalCustomField.values.length" layout="row" layout-align="center center">\n            <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS">No Available Items</em>\n          </md-list-item>\n        </md-list>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.globalCustomField.required" aria-label="Required"><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.globalCustomField.type == \'text\'" class="md-block">\n        <md-switch ng-model="vm.globalCustomField.clickToAction" aria-label="ClickToAction"><span translate="CONTACTMANAGER.CLICKTOACTION">ClickToAction</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.globalCustomField.clickToAction" class="md-block">\n        <label translate="CONTACTMANAGER.ACTIONTYPE">ActionType</label>\n        <md-select name="actionType" ng-model="vm.globalCustomField.actionType">\n          <md-option ng-value="\'voice\'">Voice</md-option>\n        </md-select>\n        <div ng-messages="globalCustomFieldForm[\'actionType\'].$error" ng-show="globalCustomFieldForm[\'actionType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED">ActionType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newGlobalCustomField" ng-click="vm.saveGlobalCustomField()" class="send-button md-accent md-raised" ng-disabled="globalCustomFieldForm.$invalid || globalCustomFieldForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newGlobalCustomField" ng-click="vm.addNewGlobalCustomField()" class="send-button md-accent md-raised" ng-disabled="globalCustomFieldForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD" translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD">\n          ADD GLOBALCUSTOMFIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newGlobalCustomField" ng-click="vm.deleteGlobalCustomField($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/globalCustomFields/globalCustomFields.html",'<div id="globalCustomFields" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.GLOBALCUSTOMFIELDS">GlobalCustomFields</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedGlobalCustomFields.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedGlobalCustomFields =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-globalCustomFields-count">\n          <span>{{vm.selectedGlobalCustomFields.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllGlobalCustomFields()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectGlobalCustomFields()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedGlobalCustomFields" csv-label="true" filename="globalCustomFields.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedGlobalCustomFields($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- GLOBALCUSTOMFIELD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedGlobalCustomFields" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getGlobalCustomFields">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="alias">{{ \'CONTACTMANAGER.ALIAS\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'CONTACTMANAGER.TYPE\' | translate }}</th>\n                <th md-column md-order-by="required">{{ \'CONTACTMANAGER.REQUIRED\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.globalCustomFields.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="globalCustomField" md-select-id="id" ng-repeat="globalCustomField in vm.globalCustomFields.rows">\n                <td md-cell ng-if="globalCustomField.userpic"><img class="avatar" alt="{{globalCustomField.name}}" ng-src="api/users/{{globalCustomField.id}}/avatar" /></td>\n                <td md-cell ng-if="!globalCustomField.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{globalCustomField.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="id ">{{globalCustomField.id}}</td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="alias ">{{globalCustomField.alias}}</td>\n                <td ng-click="vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="type ">{{ vm.arraytype[globalCustomField.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(globalCustomField, ev) : vm.createOrEditGlobalCustomField($event, globalCustomField)" md-cell class="required ">\n                  <md-icon md-colors="{color: {{globalCustomField.required ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{globalCustomField.required ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(globalCustomField, $event    )" translate="CONTACTMANAGER.EDIT_GLOBALCUSTOMFIELD">\n                          Edit GlobalCustomField\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(globalCustomField, $event    )" translate="CONTACTMANAGER.DELETE_GLOBALCUSTOMFIELD">\n                          Delete GlobalCustomField\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.globalCustomFields.count}}" md-on-paginate="vm.getGlobalCustomFields" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / GLOBALCUSTOMFIELD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD GLOBALCUSTOMFIELD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-globalCustomField-button" ng-click="vm.createOrEditGlobalCustomField($event)" aria-label="add globalCustomField" translate translate-attr-aria-label="CONTACTMANAGER.ADD_GLOBALCUSTOMFIELD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD GLOBALCUSTOMFIELD BUTTON --\x3e\n</div>'),e.put("app/main/apps/contactmanager/views/lists/create/dialog.html",'<md-dialog class="list-dialog" aria-label="New List">\n  <form name="listForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.list.name" ng-required="true" autofocus>\n\n        <div ng-messages="listForm[\'name\'].$error" ng-show="listForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.list.description">\n\n        <div ng-messages="listForm[\'description\'].$error" ng-show="listForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newList" ng-click="vm.saveList()" class="send-button md-accent md-raised" ng-disabled="listForm.$invalid || listForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newList" ng-click="vm.addNewList()" class="send-button md-accent md-raised" ng-disabled="listForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_LIST" translate-attr-aria-label="CONTACTMANAGER.ADD_LIST">\n          ADD LIST\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newList" ng-click="vm.deleteList($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/agentadd/agentadd.html",'<md-dialog class="list-dialog" aria-label="list" ng-init="vm.onInit()">\n  <form name="listForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="CONTACTMANAGER.AGENTADD_LIST">Add Agent to list</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/customFields/dialog.html",'<md-dialog class="customField-dialog" aria-label="New CustomField">\n  <form name="customFieldForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.ALIAS">Alias</label>\n        <input type="" name="alias" ng-model="vm.customField.alias" ng-required="true" autofocus>\n\n        <div ng-messages="customFieldForm[\'alias\'].$error" ng-show="customFieldForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="CONTACTMANAGER.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.customField.type" required ng-disabled="!vm.newCustomField">\n          <md-option ng-value="\'text\'">Text</md-option>\n          <md-option ng-value="\'select\'">Select</md-option>\n          <md-option ng-value="\'number\'">Number</md-option>\n          <md-option ng-value="\'switch\'">Switch</md-option>\n          <md-option ng-value="\'datetime\'">Datetime</md-option>\n        </md-select>\n        <div ng-messages="customFieldForm[\'type\'].$error" ng-show="customFieldForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.customField.type == \'select\'" class="md-block">\n        <md-list>\n          <md-list-item layout-margin>\n            <md-button class="md-fab md-mini md-secondary" ng-click="vm.addItem(vm.customField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.ADD">ADD</span></md-tooltip>\n              <md-icon md-font-icon="icon-plus" aria-label="alert error"></md-icon>\n            </md-button>\n            <md-button ng-if="vm.customField.values.length" class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItems(vm.customField.values);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE_ALL">Delete All</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list ng-sortable="vm.sortable">\n          <md-list-item ng-repeat="item in vm.customField.values" style="border: 1px solid #ccc!important; border-radius: 7px;" layout-margin>\n            <div>\n              <md-icon class="s24" style="cursor:move" md-font-icon="icon-drag" aria-label="drag"></md-icon>\n              <input type="text" ng-model="item.value" flex>\n            </div>\n            <md-button class="md-fab md-mini md-warn md-secondary" ng-click="vm.removeItem(vm.customField.values, $index);">\n              <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n              <md-icon md-font-icon="icon-delete" aria-label="alert error"></md-icon>\n            </md-button>\n          </md-list-item>\n        </md-list>\n        <md-list>\n          <md-list-item ng-if="!vm.customField.values.length" layout="row" layout-align="center center">\n            <em translate="CONTACTMANAGER.NO_AVAILABLE_ITEMS">No Available Items</em>\n          </md-list-item>\n        </md-list>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customField.required" aria-label="Required"><span translate="CONTACTMANAGER.REQUIRED">Required</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.customField.type == \'text\'" class="md-block">\n        <md-switch ng-model="vm.customField.clickToAction" aria-label="clickToAction"><span translate="CONTACTMANAGER.CLICKTOACTION">clickToAction</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.customField.clickToAction" class="md-block">\n        <label translate="CONTACTMANAGER.ACTIONTYPE">actionType</label>\n        <md-select name="actionType" ng-model="vm.customField.actionType">\n          <md-option ng-value="\'voice\'">Voice</md-option>\n        </md-select>\n        <div ng-messages="customFieldForm[\'actionType\'].$error" ng-show="customFieldForm[\'actionType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="CONTACTMANAGER.ERRORS.ACTIONTYPE_REQUIRED">actionType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomField" ng-click="vm.saveCustomField()" class="send-button md-accent md-raised" ng-disabled="customFieldForm.$invalid || customFieldForm.$pristine" aria-label="SAVE" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomField" ng-click="vm.addNewCustomField()" class="send-button md-accent md-raised" ng-disabled="customFieldForm.$invalid" aria-label="ADD" translate="CONTACTMANAGER.ADD_CUSTOMFIELD" translate-attr-aria-label="CONTACTMANAGER.ADD_CUSTOMFIELD">\n          ADD CUSTOMFIELD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomField" ng-click="vm.deleteCustomField($event)" aria-label="DELETE" translate translate-attr-aria-label="CONTACTMANAGER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="CONTACTMANAGER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/contactmanager/views/lists/edit/view.html",'<div id="contactmanager-list" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-lists-button md-icon-button" aria-label="Go to lists" ng-click="vm.gotoLists()" translate translate-attr-aria-label="CONTACTMANAGER.GO_TO_LISTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="list-image" hide-xs>\n          <img ng-src="assets/images/business/lists.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.list.id}}\n            <span ng-if="vm.list.name">{{vm.list.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="CONTACTMANAGER.CREATED_AT"></span> <span>{{vm.list.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.list, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="CONTACTMANAGER.GOTO_LIST"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.list, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="CONTACTMANAGER.AGENTADD_LIST"></span></md-tooltip>\n        <md-icon md-font-icon="icon-eye"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveList()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (customFieldsForm.$invalid) || (voiceDispositionsForm.$invalid)" translate="CONTACTMANAGER.SAVE" translate-attr-aria-label="CONTACTMANAGER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="list-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="CONTACTMANAGER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.list.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.list.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CONTACTMANAGER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.list.dialPrefix" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialPrefix\'].$error" ng-show="generalForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="CONTACTMANAGER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.CUSTOMFIELDS">CUSTOMFIELDS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="list-detail-form-container customfields md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ListCustomFieldsController as vm_dc" ng-init="vm_dc.init(vm.list, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedListCustomFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="CONTACTMANAGER.CUSTOMFIELDS">CustomFields</span>\n                  <ms-search-bar on-search="vm_dc.getListCustomFields()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditListCustomField($event)" aria-label="add customField" translate translate-attr-label="CONTACTMANAGER.ADD_CUSTOMFIELD">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedListCustomFields.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedListCustomFields.length}} {{vm_dc.selectedListCustomFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedListCustomFields" csv-label="true" filename="lists.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedListCustomFields($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedListCustomFields" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getListCustomFields">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'CONTACTMANAGER.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="alias">\n                        {{ \'CONTACTMANAGER.ALIAS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="type">\n                        {{ \'CONTACTMANAGER.TYPE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="required">\n                        {{ \'CONTACTMANAGER.REQUIRED\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="customField" md-select-id="id" ng-repeat="customField in vm_dc.listCustomFields.rows">\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{customField.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{customField.alias}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell>\n                        {{ vm_dc.arraytype[customField.type].option }} </td>\n\n                      <td ng-click="vm_dc.createOrEditListCustomField($event, customField)" md-cell class="required ">\n                        <md-icon md-colors="{color: {{customField.required ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{customField.required? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditListCustomField($event, customField)" translate="CONTACTMANAGER.EDIT_CUSTOMFIELD">\n                                Edit CustomField\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(customField, $event)" translate="CONTACTMANAGER.DELETE_CUSTOMFIELD">\n                                Delete CustomField\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.listCustomFields.rows.length">\n                      <td md-cell colspan="9">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="CONTACTMANAGER.NO_CUSTOMFIELD_AVAILABLE">No customfield available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.listCustomFields.count}}" md-on-paginate="vm_dc.getListCustomFields" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="CONTACTMANAGER.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="ListDispositionsController as vm_dc" ng-init="vm_dc.init(vm.list, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="list-detail-form-container voicedispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedListDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="CONTACTMANAGER.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add contactmanager dispositions" translate translate-attr-label="CONTACTMANAGER.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="lists.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/contactmanager/views/lists/lists.html",'<div id="lists" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-circle" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="CONTACTMANAGER.LISTS">Lists</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="CONTACTMANAGER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedLists.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedLists =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="CONTACTMANAGER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-lists-count">\n          <span>{{vm.selectedLists.length}}</span>\n          <span translate="CONTACTMANAGER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="CONTACTMANAGER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllLists()" translate="CONTACTMANAGER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectLists()" translate="CONTACTMANAGER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedLists" csv-label="true" filename="lists.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedLists($event)" aria-label="delete selected" translate translate-attr-label="CONTACTMANAGER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- LIST TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedLists" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getLists">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'CONTACTMANAGER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'CONTACTMANAGER.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'CONTACTMANAGER.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.lists.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="CONTACTMANAGER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="list" md-select-id="id" ng-repeat="list in vm.lists.rows">\n                <td md-cell ng-if="list.userpic"><img class="avatar" alt="{{list.name}}" ng-src="api/users/{{list.id}}/avatar" /></td>\n                <td md-cell ng-if="!list.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{list.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="id ">{{list.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="name ">{{list.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(list, ev) : vm.createOrEditList($event, list)" md-cell class="description ">{{list.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="CONTACTMANAGER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(list, $event    )" translate="CONTACTMANAGER.EDIT_LIST">\n                          Edit List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotocontactsgoto(list, $event    )" translate="CONTACTMANAGER.GOTOCONTACTS_LIST">\n                          goToContacts List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadContactManagerLists">\n\n                        <md-button ng-click="vm.exportcsvcontactsexport(list, $event    )" translate="CONTACTMANAGER.EXPORTCSVCONTACTS_LIST">\n                          exportCsvContacts List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(list, $event    )" translate="CONTACTMANAGER.AGENTADD_LIST">\n                          AgentAdd List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(list, $event    )" translate="CONTACTMANAGER.DELETE_LIST">\n                          Delete List\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'CONTACTMANAGER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'CONTACTMANAGER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'CONTACTMANAGER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.lists.count}}" md-on-paginate="vm.getLists" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / LIST TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD LIST BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-list-button" ng-click="vm.createOrEditList($event)" aria-label="add list" translate translate-attr-aria-label="CONTACTMANAGER.ADD_LIST">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD LIST BUTTON --\x3e\n</div>'),e.put("app/main/apps/dashboards/views/custom/custom.html",'<div ng-if="!vm.customDashboard">\n  <p>Custom Dashboard not available...</p>\n</div>\n<div id="dashboard-custom" ng-if="vm.customDashboard" ng-cloak layout-fill>\n  <md-content>\n    <md-toolbar class="md-default md-accent filter-header">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead">{{vm.customDashboard.name}}</span>\n        <div flex></div>\n        <md-button ng-click="vm.setFilter($event)">\n          <md-tooltip md-direction="top"><span translate="DASHBOARDS.FILTERS"></span></md-tooltip>\n          <md-icon md-font-icon="icon-filter" ng-class=""></md-icon>\n        </md-button>\n        <md-button ng-if="vm.crudPermissions.canEdit" class="md-icon-button" ng-click="vm.goToEdit()" aria-label="goToEdit">\n          <md-tooltip md-direction="top"><span translate="DASHBOARDS.EDIT"></span></md-tooltip>\n          <md-icon md-font-icon="icon-table-edit"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <ms-widget-engine config="vm.customDashboard"></ms-widget-engine>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/custom/filter/dialog.html",'<md-dialog class="cm-contact-dialog" aria-label="Set Filter">\n  <form name="FilterForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content style="padding:30px;">\n      <div layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-phone"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_VOICE_QUEUES">Filter Voice Queues</span>\n          </div>\n          <md-select placeholder="Select one or more queues" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'voice\')" ng-model="vm.parent.voiceQueuesSelected" multiple aria-label="voiceQueues">\n            <md-option ng-value="voiceQueue.id" ng-repeat="voiceQueue in vm.parent.voiceQueues.rows">{{\n                            voiceQueue.name }}\n            </md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-hangouts"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_CHAT_WEBSITES">Filter Chat\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'chat\')" ng-model="vm.parent.chatWebsitesSelected" multiple aria-label="chatWebsite">\n            <md-option ng-value="chatWebsite.id" ng-repeat="chatWebsite in vm.parent.chatWebsites.rows">{{\n                            chatWebsite.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-message-text"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_SMS_ACCOUNTS">Filter Sms Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'sms\')" ng-model="vm.parent.smsAccountsSelected" multiple aria-label="smsAccount">\n            <md-option ng-value="smsAccount.id" ng-repeat="smsAccount in vm.parent.smsAccounts.rows">{{\n                            smsAccount.name }}</md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-deskphone"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_FAX_ACCOUNTS">Filter Fax Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'fax\')" ng-model="vm.parent.faxAccountsSelected" multiple aria-label="faxAccount">\n            <md-option ng-value="faxAccount.id" ng-repeat="faxAccount in vm.parent.faxAccounts.rows">{{\n                            faxAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-email"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_MAIL_ACCOUNTS">Filter Mail\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'mail\')" ng-model="vm.parent.mailAccountsSelected" multiple aria-label="mailAccount">\n            <md-option ng-value="mailAccount.id" ng-repeat="mailAccount in vm.parent.mailAccounts.rows">{{\n                            mailAccount.name }}</md-option>\n          </md-select>\n        </div>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-google-earth"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_OPENCHANNEL_ACCOUNTS">Filter Openchannel\n              Websites</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'openchannel\')" ng-model="vm.parent.openchannelAccountsSelected" multiple aria-label="openchannelAccount">\n            <md-option ng-value="openchannelAccount.id" ng-repeat="openchannelAccount in vm.parent.openchannelAccounts.rows">{{\n                            openchannelAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n      <div class="margin-top-30" layout="row" flex layout-align="space-between" layout-fill>\n        <div layout="column">\n          <div>\n            <i class="icon s16 icon-whatsapp"></i>\n            <span class="font-size-12" translate="DASHBOARDS.FILTER_WHATSAPP_ACCOUNTS">Filter Whatsapp\n              Accounts</span>\n          </div>\n          <md-select placeholder="Select one or more interaction" class="font-size-12 no-margin w-200" md-on-close="vm.parent.onChangeFilter(\'whatsapp\')" ng-model="vm.parent.whatsappAccountsSelected" multiple aria-label="whatsappAccount">\n            <md-option ng-value="whatsappAccount.id" ng-repeat="whatsappAccount in vm.parent.whatsappAccounts.rows">\n              {{whatsappAccount.name }}</md-option>\n          </md-select>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.confirm()" class="send-button md-accent md-raised" aria-label="CONFIRM" translate="DASHBOARDS.CONFIRM" translate-attr-aria-label="DASHBOARDS.CONFIRM">\n          CONFIRM\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/agent.general.html",'<div id="agent-general" layout="column">\n  <div layout="row" layout-align="start center" class="md-primary-bg">\n    <md-button class="md-raised no-margin width-50" style="border-radius: 0px" ng-class="{\'md-primary\': !vm.isActiveTab(0)}" ng-click="vm.onClickTab(0)" aria-label="home">\n      <md-tooltip md-direction="bottom" md-delay="500">Home</md-tooltip>\n      <md-icon md-font-icon="icon-home" class="icon"></md-icon>\n    </md-button>\n\n    <ms-tab-scroll style="overflow: hidden;">\n      <div layout="column" ng-repeat="(key, tab) in vm.tabs | orderByDate " ng-click="vm.onClickTab(tab.id)" ng-class="{\'grey-50-bg\': vm.isActiveTab(tab.id)}">\n        <div style="height: 34px" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="{{tab.icon}}" class="icon s16 margin-horizontal-5" ng-class="tab.color + \'-fg\'">\n          </md-icon>\n          <span class="text-truncate font-size-12" ng-class="vm.isActiveTab(tab.id) ? \'black-fg\' : \'grey-300-fg\'">\n            {{tab.title}}\n            <span ng-if="tab.badges" class="badge md-white-fg md-red-bg">{{tab.badges}}</span></span>\n          <md-button class="md-icon-button md-mini no-margin" ng-class="vm.isActiveTab(tab.id) ? \'md-primary\' : \'grey-300-fg\'" aria-label="close" ng-click="vm.closeTab(tab); $event.stopPropagation()">\n            <md-icon md-font-icon="icon-close-circle-outline" class="icon s16"></md-icon>\n          </md-button>\n        </div>\n        <div style="height: 2px" ng-class="vm.isActiveTab(tab.id) ? tab.color + \'-bg\' : \'\'"></div>\n      </div>\n    </ms-tab-scroll>\n  </div>\n  \x3c!-- home --\x3e\n  <div layout="row" class="agent-content overflow-hidden" ng-if="vm.isActiveTab(0)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.html\'" ng-controller="AgentGeneralHomeController as vm_home" ng-init="vm_home.init(vm.license, vm.setting)"></div>\n  \x3c!-- other tabs --\x3e\n  <div ng-if="tab.id !== 0 && vm.isActiveTab(tab.id)" ng-repeat="(key, tab) in vm.tabs | orderByDate " ng-switch="tab.type" flex layout="column">\n    <div ng-switch-when="contact" ng-class="{{tab.type}}" flex layout="column">\n      <div class="agent-content" flex layout="column" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/contact/agent.general.contact.html\'" ng-controller="AgentGeneralContactController as vm" ng-init="vm.init(tab,$parent.vm.license)"></div>\n    </div>\n    <div ng-switch-when="popup" ng-class="{{tab.type}}" flex layout="column">\n      <div flex layout="column" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/popup/agent.general.popup.html\'" ng-controller="AgentGeneralPopupController as vm" ng-init="vm.init(tab)"></div>\n    </div>\n    <div ng-switch-when="jscripty" ng-class="{{tab.type}}" flex layout="column">\n      <div class="agent-content" ng-if="vm.isActiveTab(tab.id)" ng-include="\'app/main/apps/dashboards/views/general/agent/jscripty/agent.general.jscripty.html\'" ng-controller="AgentGeneralJscriptyController as vm" ng-init="vm.init(tab)"></div>\n    </div>\n    <div ng-switch-when="bot" ng-class="{{tab.type}}" flex layout="column">\n      <div id="interaction-app" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/bot/agent.general.bot.html\'" ng-controller="AgentGeneralBotController as vm" ng-init="vm.init(tab, $parent.vm.setting)"></div>\n    </div>\n    <div ng-switch-when="interaction" ng-class="{{tab.type}}" flex layout="column">\n      <div id="interaction-app" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html\'" ng-controller="AgentGeneralInteractionController as vm" ng-init="vm.init(tab, $parent.vm.setting)">\n      </div>\n    </div>\n    <div ng-switch-when="iframe" ng-class="{{tab.type}}" flex layout="column">\n      <div id="iframe" flex layout="column" ng-if="vm.isActiveTab(tab.id)" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/iframe/agent.general.iframe.html\'" ng-controller="AgentGeneralIframeController as vm" ng-init="vm.init(tab, $parent.vm.setting)">\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/bot/agent.general.bot.html",'\x3c!-- CONTENT CARD --\x3e\n<md-content class="content-card" layout="row" layout-fill>\n\n  <div ng-if="!vm.showInteraction" class="start-point" flex layout="column" layout-align="center center">\n    <div class="big-circle md-whiteframe-4dp">\n      <md-icon class="s128 md-accent pink-fg" md-font-icon="fas fa-robot"></md-icon>\n    </div>\n    <span class="app-title" translate="DASHBOARDS.WAITING">Waiting</span>\n    <span class="hide show-gt-md secondary-text" translate="DASHBOARDS.LOADING_INTERACTION">We are loading the\n      interaction...</span>\n  </div>\n\n  <div ng-if="vm.showInteraction" flex layout="row">\n    <md-card flex="100" class="interaction">\n      \x3c!-- TOOLBAR --\x3e\n      <md-toolbar class="interaction-toolbar">\n        <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="fas fa-robot" class="s20 pink-fg"></md-icon>\n          <div class="padding-left-10" layout="column" layout-align="center start" flex>\n            <div class="font-size-14" layout="row" layout-align="start center" layout-fill>\n              <span>#{{vm.tab.data.uniqueid}} - {{vm.tab.title}}</span>\n            </div>\n          </div>\n          <div layout="row" layout-align="end center">\n\n          </div>\n        </div>\n      </md-toolbar>\n      \x3c!-- / TOOLBAR --\x3e\n\n      \x3c!-- CONTENT --\x3e\n      <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex layout-wrap>\n        <div class="interaction-messages">\n          \x3c!-- MESSAGES --\x3e\n          <div layout="row" ng-repeat="message in vm.messages.rows" class="md-padding message-row" ng-class="vm.getMessagesAlignment(message)">\n            <img ng-if="message.direction ===\'in\'" src="assets/images/avatars/customer.png" class="avatar" />\n            <img ng-if="message.direction ===\'out\'" class="avatar" src="assets/images/avatars/robot.png">\n\n            <div class="bubble" ng-switch="message.direction">\n              <div>\n                <div ng-switch-when="in" class="time secondary-text">\n                  {{vm.tab.title}} - {{message.createdAt | date: \'medium\'}}\n                </div>\n                <div ng-switch-when="out" class="time secondary-text" layout="row" layout-align="end center">\n                  <div layout-padding>\n                    System - {{message.createdAt | date: \'medium\'}}\n                  </div>\n                  <div>\n                    <md-icon class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n                  </div>\n                </div>\n              </div>\n              <div ng-bind-html="message.body | embed:vm.emojiOptions" class="message" layout="row" layout-align="end center"></div>\n            </div>\n          </div>\n          \x3c!-- / MESSAGES --\x3e\n        </div>\n      </md-content>\n      \x3c!-- / CONTENT --\x3e\n    </md-card>\n  </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/contact/agent.general.contact.html",'<md-tabs md-selected="vm.currentTab" md-dynamic-height>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.DETAIL">Detail</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content>\n        <div layout="row" class="pr-10">\n          <div layout="row" flex="75" class="flex-scrollable only-x">\n            <md-card ng-repeat="call in vm.tab.calls track by call.uniqueid" class="call-info-card">\n              <md-progress-linear md-mode="indeterminate" ng-if="vm.checkingCallStatus"></md-progress-linear>\n              <md-card-header layout="row" layout-align="space-between">\n                <span ng-if="call.answertime" class="text-boxed indigo-100-bg ml-0">\n                  <timer start-time="call.answertime"></timer>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.ELAPSED_ANSWERED\' | translate }}\n                  </md-tooltip>\n                </span>\n                <span ng-if="call.disposedAt" class="text-boxed amber-200-bg">\n                  <timer start-time="call.disposedAt"></timer>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.ELAPSED_DISPOSED\' | translate }}\n                  </md-tooltip>\n                </span>\n                <md-button class="md-icon-button no-margin reload-button" ng-click="vm.checkCallStatus(call)" ng-disabled="vm.checkingCallStatus">\n                  <md-icon md-font-icon="icon-reload" class="s22"></md-icon>\n                  <md-tooltip md-direction="bottom">\n                    {{ \'DASHBOARDS.RELOAD\' | translate }}\n                  </md-tooltip>\n                </md-button>\n              </md-card-header>\n              <md-divider></md-divider>\n              <md-card-content>\n                <div layout="column" layout-align="space-between start" class="word-break-all mr-16">\n                  <div layout="row" layout-align="start center">\n                    <md-icon md-font-icon="{{ call.routeId ? \'icon-phone-outgoing\' : \'icon-phone-incoming\'}}" class="s20 mr-5">\n                    </md-icon>\n                    <span class="h2" privacy ng-cloak>{{ call.routeId ? call.destcalleridnum : call.calleridnum }}</span>\n                  </div>\n\n                  <div class="subtitle h4 secondary-text" ng-if="call.calleridname && call.calleridname != \'<unknown>\' && !call.routeId">\n                    <md-icon md-font-icon="icon-account" class="s20"></md-icon>\n                    Name: <span privacy ng-cloak>{{ call.calleridname }}</span>\n                    <div ng-if="(vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum}).length>0">\n                      <span ng-style="{\'color\':(vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].color} ">\n                        {{ (vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].description }} -\n                        {{ (vm.additionalItems | filter : {\'phone\':call.routeId ? call.destcalleridnum : call.calleridnum})[0].type }}\n                      </span>\n                    </div>\n                  </div>\n\n                  <div class="text h4 pt-8" ng-if="call.queue">\n                    <md-icon md-font-icon="icon-stackoverflow" class="s20"></md-icon>\n                    Queue: {{call.queue}}\n                  </div>\n                  <div class="text h4 pt-8" ng-if="call.variables.extravar">\n                    <md-icon md-font-icon="icon-minus" class="s20"></md-icon>\n                    Extra: {{call.variables.extravar}}\n                  </div>\n                </div>\n                <div layout="row" layout-align="center end" class="mt-8">\n                  <md-button ng-if="call.disposedAt" type="submit" ng-click="vm.disposeCall($event, call)" class="send-button md-accent md-raised mr-0 mv-0">\n                    {{ \'DASHBOARDS.DISPOSE\' | translate}}\n                  </md-button>\n                </div>\n              </md-card-content>\n            </md-card>\n          </div>\n          <div flex="25" layout="row" layout-md="column" layout-sm="column" layout-align="end center" layout-align-md="center center">\n            <md-button type="submit" ng-click="vm.mergeContact($event)" class="send-button md-raised md-accent ng-scope" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="merge">\n              <md-tooltip md-direction="top"><span translate="DASHBOARDS.MERGE"></span></md-tooltip>\n              <md-icon md-font-icon="icon-source-fork"></md-icon>\n            </md-button>\n            <md-button type="submit" ng-click="vm.duplicateContact($event)" class="send-button md-raised md-accent ng-scope" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="duplicate">\n              <md-tooltip md-direction="top"><span translate="DASHBOARDS.DUPLICATE"></span></md-tooltip>\n              <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n            </md-button>\n            <md-button type="submit" ng-click="vm.addNewContact($event)" class="send-button md-accent md-raised" ng-if="vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="add">\n              {{ \'DASHBOARDS.ADD\'| translate }}\n            </md-button>\n            <md-button type="submit" ng-click="vm.saveContact($event)" class="send-button md-accent md-raised" ng-if="!vm.newContact" ng-disabled="vm.detailForm.$invalid || vm.customFieldsForm.$invalid || vm.socialForm.$invalid" aria-label="save">\n              {{ \'DASHBOARDS.SAVE\' | translate }}\n            </md-button>\n          </div>\n        </div>\n        <div layout="row">\n          <div layout="column" flex="75">\n            <md-card layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.PERSONAL_INFO">\n                PERSONAL_INFO</div>\n              <div class="subtitle secondary-text">\n                <span translate="CONTACTMANAGER.CREATED_AT"></span>\n                <span>{{vm.contact.createdAt | date:\'medium\'}}</span>\n              </div>\n\n              <form name="vm.detailForm" novalidate>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.FIRSTNAME">First Name</label>\n                      <md-icon md-font-icon="icon-account" class="firstname"></md-icon>\n                      <input type="text" name="firstName" ng-model="vm.contact.firstName" class="text-truncate" required privacy ng-cloak>\n                      <div ng-messages="vm.detailForm.firstName.$error" ng-show="vm.detailForm.firstName.$touched" role="alert">\n                        <div ng-message="required">\n                          <span translate="DASHBOARDS.ERRORS.FIRSTNAME_REQUIRED">First name\n                            field is required</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.jscripty" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="JSCRIPTY PROJECTS" ng-click="$mdOpenMenu($event); vm.getJscriptyProjects();" aria-label="jscripty">\n                          <md-icon md-font-icon="icon-script"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingJscriptyProjects">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingJscriptyProjects && vm.jscriptyProjects.count > 0" ng-repeat="project in vm.jscriptyProjects.rows">\n                            <md-button ng-click="vm.addJscriptyTab(project, $event)">\n                              <md-icon md-font-icon="icon-script"></md-icon>\n                              {{project.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingJscriptyProjects && (!vm.jscriptyProjects || vm.jscriptyProjects.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_JSCRIPTY_PROJECTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-script"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.LASTNAME">Last Name</label>\n                    <input type="text" name="lastName" ng-model="vm.contact.lastName" class="text-truncate" privacy ng-cloak>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.PHONE">Phone</label>\n                      <md-icon md-font-icon="icon-phone"></md-icon>\n                      <input type="text" name="phone" ng-model="vm.contact.phone" class="text-truncate" privacy ng-cloak>\n                      <div class="hint"><span ng-show="!vm.user.phoneBarRemoteControl || !vm.contact.phone" translate="CONTACTMANAGER.HELP.PHONEBAR_API"></span></div>\n                    </md-input-container>\n                    <div>\n                      \x3c!-- click to call directive --\x3e\n                      <ms-click-to-call target="vm.contact.phone" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                      \x3c!--  / click to call directive --\x3e\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.MOBILE">Mobile</label>\n                      <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n                      <input type="text" name="mobile" ng-model="vm.contact.mobile" class="text-truncate" privacy ng-cloak>\n                      <div class="hint"><span ng-show="!vm.user.phoneBarRemoteControl || !vm.contact.mobile" translate="CONTACTMANAGER.HELP.PHONEBAR_API"></span></div>\n                    </md-input-container>\n                    <div>\n                      \x3c!-- click to call directive --\x3e\n                      <ms-click-to-call target="vm.contact.mobile" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                      \x3c!--  / click to call directive --\x3e\n                    </div>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.messaging || !vm.hasPermission(107) || !vm.contact.mobile" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW SMS" ng-click="$mdOpenMenu($event); vm.getAccounts(\'sms\')" aria-label="sms">\n                          <md-icon md-font-icon="icon-message-text"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.smsAccounts.count > 0" ng-repeat="account in vm.smsAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Sms\', account, vm.contact.mobile)">\n                              <md-icon md-font-icon="icon-message-text"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.smsAccounts || vm.smsAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_SMS_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-message-text"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.whatsapp || !vm.hasPermission(114) || !vm.contact.mobile" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW WHATSAPP" ng-click="$mdOpenMenu($event); vm.getAccounts(\'whatsapp\')" aria-label="whatsapp">\n                          <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.whatsappAccounts.count > 0" ng-repeat="account in vm.whatsappAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Whatsapp\', account, vm.contact.mobile)">\n                              <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.whatsappAccounts || vm.whatsappAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_WHATSAPP_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-whatsapp"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.EMAIL">Email</label>\n                      <md-icon md-font-icon="icon-email" class="email"></md-icon>\n                      <input type="email" name="email" ng-model="vm.contact.email" class="text-truncate" privacy ng-cloak>\n                      <div ng-messages="vm.detailForm.firstName.$error" ng-show="vm.detailForm.firstName.$touched" role="alert">\n                        <div ng-message="email">\n                          <span translate="DASHBOARDS.ERRORS.EMAIL_MUST_VALID">Email must be a\n                            valid e-mail address</span>\n                        </div>\n                      </div>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.mail || !vm.hasPermission(106) || !vm.contact.email" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW EMAIL" ng-click="$mdOpenMenu($event); vm.getAccounts(\'mail\')" aria-label="email">\n                          <md-icon md-font-icon="icon-email"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.mailAccounts.count > 0" ng-repeat="account in vm.mailAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Mail\', account, vm.contact.email)">\n                              <md-icon md-font-icon="icon-email"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.mailAccounts || vm.mailAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_MAIL_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-email"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                  <div flex="5"></div>\n                  <div layout="row" flex>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="DASHBOARDS.FAX">Fax</label>\n                      <md-icon md-font-icon="icon-deskphone"></md-icon>\n                      <input type="text" name="fax" ng-model="vm.contact.fax" privacy ng-cloak>\n                    </md-input-container>\n                    <div>\n                      <md-menu ng-if="!vm.newContact">\n                        <md-button ng-disabled="!vm.license.fax || !vm.hasPermission(109) || !vm.contact.fax" class="md-icon-button md-raised md-accent ng-scope md-ink-ripple" title="NEW FAX" ng-click="$mdOpenMenu($event); vm.getAccounts(\'fax\')" aria-label="fax">\n                          <md-icon md-font-icon="icon-deskphone"></md-icon>\n                        </md-button>\n                        <md-menu-content>\n                          <md-menu-item ng-if="vm.loadingAccounts">\n                            <md-progress-circular class="md-accent margin-auto" md-diameter="32" md-mode="indeterminate">\n                            </md-progress-circular>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && vm.faxAccounts.count > 0" ng-repeat="account in vm.faxAccounts.rows">\n                            <md-button ng-click="vm.composeInteraction($event, \'Fax\', account, vm.contact.fax)">\n                              <md-icon md-font-icon="icon-deskphone"></md-icon>\n                              {{account.name}}\n                            </md-button>\n                          </md-menu-item>\n                          <md-menu-item ng-if="!vm.loadingAccounts && (!vm.faxAccounts || vm.faxAccounts.count === 0)">\n                            <md-button disabled translate="DASHBOARDS.NO_FAX_ACCOUNTS_AVAILABLE">\n                              <md-icon md-font-icon="icon-deskphone"></md-icon>\n                            </md-button>\n                          </md-menu-item>\n                        </md-menu-content>\n                      </md-menu>\n                    </div>\n                  </div>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <md-chips ng-model="vm.additionalItems" md-transform-chip="vm.newPhone($chip)" placeholder="Phone numbers">\n                      <md-chip-template custom-chip alt="{{$chip.type}}" title="{{$chip.type}}">\n                        {{ $chip.phone }}\n                      </md-chip-template>\n                    </md-chips>\n                  </md-input-container>\n                  <div class="contact-detail-form-container personal_info md-background-bg md-whiteframe-1dp" flex="25">\n                    <div class="pb-16" layout="row" layout-align="start center">\n                      <div class="h2 secondary-text text-truncate" translate="CONTACTMANAGER.ADDITIONAL_PHONES">ADDITIONAL_PHONES</div>\n                    </div>\n                    <form name="additionalPhonesForm" novalidate>\n                      <div ng-repeat="additionalPhone in vm.additionalItems" layout="column">\n                        <md-input-container class="md-block">\n                          <label>{{$index}} - {{additionalPhone.phone}}</label>\n                          <md-select ng-model="vm.additionalItemTypes[$index]">\n                            <md-option ng-repeat="value in vm.contactItemTypes" ng-value="value.id">{{value.name}}</md-option>\n                            <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em></md-option>\n                          </md-select>\n                        </md-input-container>\n                        <md-input-container class="md-block">\n                          <input ng-model="additionalPhone.description" ng-cloak>\n                        </md-input-container>\n                      </div>\n                    </form>\n                  </div>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.DATE_OF_BIRTH">Date of Birth</label>\n                    <mdp-date-picker mdp-open-on-click mdp-format="YYYY-MM-DD" name="dateOfBirth" ng-model="vm.contact.dateOfBirth"></mdp-date-picker>\n                  </md-input-container>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n                    <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.COMPANY">Company</label>\n                    <md-icon md-font-icon="icon-domain" class="email"></md-icon>\n                    <md-select name="company" ng-model="vm.contact.CompanyId">\n                      <md-option ng-value="company.id" ng-repeat="company in vm.tab.companies.rows">{{company.name}}\n                      </md-option>\n                      <md-option ng-value="null"><em translate="DASHBOARDS.NONE">None</em>\n                      </md-option>\n                    </md-select>\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.TAG">TAG</label>\n                    <md-icon md-font-icon="icon-tag"></md-icon>\n                    <md-select ng-model="vm.tab.Tags" multiple>\n                      <md-option ng-value="tag.id" ng-repeat="tag in vm.tab.tags.rows">\n                        {{tag.name}}</md-option>\n                    </md-select>\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.COUNTRY">Country</label>\n                    <md-icon md-font-icon="icon-home" class="country"></md-icon>\n                    <input type="text" name="country" ng-model="vm.contact.country" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.CITY">City</label>\n                    <input type="text" name="city" ng-model="vm.contact.city">\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.STREET">Street</label>\n                    <input type="text" name="street" ng-model="vm.contact.street">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate="DASHBOARDS.POSTALCODE">Postal Code</label>\n                    <input type="text" name="postalCode" ng-model="vm.contact.postalCode">\n                  </md-input-container>\n                </div>\n\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label translate translate-attr-placeholder="DASHBOARDS.NOTES">Notes</label>\n                    <md-icon md-font-icon="icon-note"></md-icon>\n                    <textarea ng-model="vm.contact.description" type="text" max-rows="4"></textarea>\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n            <md-card layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.SOCIAL">Social</div>\n              <form name="vm.socialForm" novalidate>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Facebook</label>\n                    <md-icon md-font-icon="icon-facebook" class="facebook"></md-icon>\n                    <input type="text" name="facebook" ng-model="vm.contact.facebook" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Twitter</label>\n                    <md-icon md-font-icon="icon-twitter" class="twitter"></md-icon>\n                    <input type="text" name="twitter" ng-model="vm.contact.twitter" class="text-truncate">\n                  </md-input-container>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Line</label>\n                    <md-icon md-font-icon="fab fa-line"></md-icon>\n                    <input type="text" name="line" ng-model="vm.contact.line" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Viber</label>\n                    <md-icon md-font-icon="fab fa-viber"></md-icon>\n                    <input type="text" name="viber" ng-model="vm.contact.viber" class="text-truncate">\n                  </md-input-container>\n                </div>\n                <div layout-gt-sm="row" class="layout-gt-sm-row">\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>WeChat</label>\n                    <md-icon md-font-icon="fab fa-weixin"></md-icon>\n                    <input type="text" name="wechat" ng-model="vm.contact.wechat" class="text-truncate">\n                  </md-input-container>\n                  <div flex="5"></div>\n                  <md-input-container class="md-block" flex-gt-sm="">\n                    <label>Telegram</label>\n                    <md-icon md-font-icon="icon-telegram"></md-icon>\n                    <input type="text" name="telegram" ng-model="vm.contact.telegram" class="text-truncate">\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n          </div>\n          <div flex="25" layout="column" layout-padding>\n            <md-card flex="100" layout-padding>\n              <div class="h2 secondary-text text-truncate" translate="DASHBOARDS.CUSTOM_FIELDS">CUSTOM\n                FIELDS</div>\n              <form name="vm.customFieldsForm" novalidate>\n\n                \x3c!-- START INPUT LIST --\x3e\n                <md-input-container class="md-block">\n                  <label translate translate-attr-placeholder="DASHBOARDS.LIST">List</label>\n                  <md-select name="list" ng-disabled="!vm.newContact" ng-model="vm.contact.ListId" ng-change="vm.getCustomFields(vm.contact.ListId)" required>\n                    <md-optgroup label="Lists">\n                      <md-option ng-value="list.id" ng-repeat="list in vm.lists.rows">#{{list.id}} - {{list.name}}\n                      </md-option>\n                    </md-optgroup>\n                  </md-select>\n                </md-input-container>\n                \x3c!-- END INPUT LIST --\x3e\n\n                <div ng-repeat="customField in vm.tab.customFields.rows" ng-switch="customField.type">\n                  <md-input-container class="md-block" ng-switch-when="datetime">\n                    <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                    <div ng-init="vm.contact[\'cf_\' + customField.id] = vm.getDateFromString(vm.contact[\'cf_\' + customField.id])">\n                      <mdp-date-picker mdp-open-on-click ng-required="customField.required" mdp-format="YYYY-MM-DD" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-date-picker>\n                      <mdp-time-picker mdp-open-on-click mdp-placeholder="Time" ng-required="customField.required" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.contact[\'cf_\' + customField.id]">\n                      </mdp-time-picker>\n                    </div>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="select">\n                    <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                    <md-select ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n                      <md-option ng-repeat="value in customField.values" ng-value="value.value">\n                        {{value.value}}</md-option>\n                      <md-option ng-value="null"><em translate="CONTACTMANAGER.NONE">None</em>\n                      </md-option>\n                    </md-select>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-when="switch">\n                    <md-switch aria-label="{{customField.alias}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-true-value="1" ng-false-value="0">\n                      {{customField.alias}}<span ng-if="customField.required">*</span>\n                    </md-switch>\n                  </md-input-container>\n\n                  <md-input-container class="md-block" ng-switch-default>\n                    <div layout-gt-sm="row" class="layout-gt-sm-row"></div>\n                    <div layout="row" flex>\n                      <md-input-container class="md-block" flex-gt-sm="">\n                        <label>{{customField.alias}}<span ng-if="customField.required">*</span></label>\n                        <input type="{{customField.type}}" ng-model="vm.contact[\'cf_\' + customField.id]" ng-required="customField.required">\n                      </md-input-container>\n                      <ms-click-to-call ng-if="customField.clickToAction && customField.actionType === \'voice\'" target="vm.contact[\'cf_\' + customField.id]" prefix="vm.list ? vm.list.dialPrefix : null" license="vm.license" type="\'button\'"></ms-click-to-call>\n                    </div>\n                  </md-input-container>\n                </div>\n              </form>\n            </md-card>\n          </div>\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CUSTOMER_JOURNEY">Customer Journey</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding" id="journey-content">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n</md-tabs>'),e.put("app/main/apps/dashboards/views/general/agent/contact/dispose/dialog.html",'<md-dialog class="agent-dialog" aria-label="agent dispose">\n  <form name="disposition" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" ng-if="!vm.call.mandatoryDisposition">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div ng-if="!vm.isReschedule">\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n          <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n          <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n            <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n            <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition" ng-change="vm.onDispositionChange(\'third\')">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.NOTE">Note</label>\n          <textarea ng-model="vm.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n        </md-input-container>\n        <md-input-container class="md-block" ng-if="vm.availableCalls === 1">\n          <md-switch ng-model="vm.autoClose" aria-label="Auto Close">\n            <span translate="DASHBOARDS.AUTOCLOSE">Automatically close contact tab after disposal</span>\n          </md-switch>\n        </md-input-container>\n      </div>\n      <div ng-if="vm.isReschedule">\n        <div layout="row">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="date" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-change="vm.recalcTZTime()" mdp-min-date="vm.hopper.minDate" ng-model="vm.hopper.dateTime">\n              <div ng-messages="disposition.date.$error" ng-show="disposition.date.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="DASHBOARDS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="DASHBOARDS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="time" mdp-placeholder="Time" ng-change="vm.recalcTZTime()" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.dateTime">\n              <div ng-messages="disposition.time.$error" ng-show="disposition.time.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="DASHBOARDS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="DASHBOARDS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </div>\n        <div layout="row">\n          <div flex class="md-block">\n            <md-input-container class="md-block" flex-gt-sm="">\n              <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n              <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n            </md-input-container>\n          </div>\n          <div flex class="md-block">\n            <md-input-container class="md-block">\n              <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n              <input type="text" readonly value="{{vm.hopper.scheduledAt}}">\n            </md-input-container>\n          </div>\n        </div>\n        <div ng-if="(!vm.dialer || (vm.dialer && vm.recallme && vm.user.selectRecallMeCampaign)) && vm.queueCampaigns.rows.length > 0" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.CAMPAIGN">Campaign</label>\n            <md-select name="queueCampaign" ng-model="vm.queueCampaign" required>\n              <md-option ng-value="queueCampaign" ng-repeat="queueCampaign in vm.queueCampaigns.rows">\n                <md-icon md-font-icon="icon-checkbox-blank-circle" ng-class="{\'green-fg\': queueCampaign.dialActive}" aria-label="Status">\n                </md-icon>\n                {{ queueCampaign.name }}\n              </md-option>\n            </md-select>\n            <div ng-messages="disposition.queueCampaign.$error" ng-show="disposition.queueCampaign.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.CAMPAIGN_REQUIRED">Campaign field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-if="!vm.isReschedule" layout="row">\n      <md-button ng-disabled="disposition.$invalid || disposition.$pristine" class="send-button md-raised md-accent" ng-click="vm.saveDisposition()" ms-dialog-spinner>\n        {{(vm.selectedDisposition.name ? \'DASHBOARDS.DISPOSE\' : \'DASHBOARDS.SAVE\') | translate}}\n      </md-button>\n      <md-button class="send-button md-raised md-primary" translate="DASHBOARDS.RESCHEDULE" ng-click="vm.saveDisposition(\'reschedule\')">\n        Reschedule\n      </md-button>\n      <md-button class="send-button md-accent md-raised" translate="DASHBOARDS.RECALLME" ng-click="vm.saveDisposition(\'recallme\')">\n        Recall Me\n      </md-button>\n      <span flex></span>\n      <md-button ng-if="vm.hasBlackLists" class="md-raised md-warn" translate="DASHBOARDS.BLACKLIST" ng-click="vm.saveDisposition(\'blacklist\')">\n        Blacklist\n      </md-button>\n    </md-dialog-actions>\n    <md-dialog-actions ng-if="vm.isReschedule" layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveReschedule()" class="send-button md-accent md-raised" ng-disabled="disposition.$invalid || disposition.$pristine || vm.disable" aria-label="SAVE" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/contact/reschedule/dialog.html",'<md-dialog class="agent-dialog" aria-label="New Agent">\n  <form name="dateTime" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex class="md-block">\n          <mdp-date-picker mdp-open-on-click required name="date" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" mdp-min-date="vm.hopper.minDate" ng-model="vm.hopper.dateTime">\n            <div ng-messages="dateTime.date.$error" ng-show="dateTime.date.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.DATE_REQUIRED">Date is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="DASHBOARDS.ERRORS.DATE_INVALID">Date is invalid</span>\n              </div>\n            </div>\n          </mdp-date-picker>\n        </div>\n\n        <div flex class="md-block">\n          <mdp-time-picker mdp-open-on-click required name="time" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.dateTime">\n            <div ng-messages="dateTime.time.$error" ng-show="dateTime.time.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="DASHBOARDS.ERRORS.TIME_REQUIRED">Time is required</span>\n              </div>\n              <div ng-message="format">\n                <span translate="DASHBOARDS.ERRORS.TIME_INVALID">Time is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-disabled="vm.disable" ng-click="vm.saveDialog()" class="send-button md-accent md-raised" ng-disabled="dateTime.$invalid || dateTime.$pristine" aria-label="SAVE" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/contact/selection/dialog.html",'<md-dialog ng-init="vm.onInit()" class="contact-trigger-dialog" aria-label="Select contact" ng-cloak>\n  <md-toolbar class="red-bg">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ \'DASHBOARDS.SELECT_CONTACT\' | translate }}</span>\n    </div>\n  </md-toolbar>\n  <md-dialog-content class="h-400 pv-16">\n    <div layout="row" class="p-10">\n      <span class="font-size-16">{{ \'DASHBOARDS.MULTIPLE_CONTACTS_FOUND\' | translate }}<strong>&nbsp;{{ vm.callNumber }}</strong>.</span>\n      <span class="font-size-16">&nbsp;{{ \'DASHBOARDS.WHICH_ONE_TO_USE\' | translate }}</span>\n    </div>\n    <md-grid-list md-cols-xs="1" md-cols="2" md-row-height="fit" ng-class="vm.paginatedContacts[vm.page - 1].length > 2 ? \'two-rows-layout\' : \'one-row-layout\'" flex>\n      <md-grid-tile ng-repeat="contact in vm.paginatedContacts[vm.page - 1]" md-rowspan="1">\n        <md-card layout="column" class="contact-info" no-padding no-margin ng-click="vm.selectedContact = contact;" ng-class="{ \'light-blue-50-bg\' : vm.selectedContact && vm.selectedContact.id === contact.id }" flex>\n          <md-card-title class="pt-16">\n            <md-card-title-text layout-align="center start">\n              <span class="font-size-16 text-bold">#{{ contact.id }} -\n                <span privacy ng-cloak>{{ contact.firstName }} {{ contact.lastName }}</span>\n              </span>\n              <em class="font-size-12">{{ \'DASHBOARDS.LAST_UPDATED\' | translate }}: {{ contact.updatedAt }}</em>\n              <span class="font-size-12">{{ \'DASHBOARDS.LIST\' | translate }}: {{ vm.lists[contact.ListId] }}</span>\n            </md-card-title-text>\n            <md-button class="md-icon-button no-margin" aria-label="Selected">\n              <md-icon md-font-icon="{{ vm.selectedContact && vm.selectedContact.id === contact.id ? \'icon-checkbox-marked-circle\' : \'icon-checkbox-blank-circle-outline\' }}" ng-class="{ \'green-fg\': vm.selectedContact && vm.selectedContact.id === contact.id }"></md-icon>\n            </md-button>\n          </md-card-title>\n          <md-divider></md-divider>\n          <md-card-content layout="row" layout-align="center start" class="p-10">\n            <span class="font-size-16">{{ \'DASHBOARDS.MATCHING_FIELD\' | translate }}:\n              <strong privacy ng-cloak>{{ contact.matchingField }}</strong>\n            </span>\n          </md-card-content>\n        </md-card>\n      </md-grid-tile>\n    </md-grid-list>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <div ng-if="vm.paginatedContacts.length > 1" layout="row" layout-align="center center" flex>\n      <md-button ng-click="vm.page = vm.page - 1;" class="md-icon-button no-margin" ng-class="{ \'hidden\': vm.page <= 1 }" aria-label="Previous page">\n        <md-icon md-font-icon="icon-chevron-double-left"></md-icon>\n      </md-button>\n      <span>{{ \'DASHBOARDS.PAGE\' | translate }} {{ vm.page }} {{ \'DASHBOARDS.OF\' | translate }}\n        {{ vm.paginatedContacts.length }}</span>\n      <md-button ng-click="vm.page = vm.page + 1;" class="md-icon-button no-margin" ng-class="{ \'hidden\': !vm.paginatedContacts[vm.page] }" aria-label="Next page">\n        <md-icon md-font-icon="icon-chevron-double-right"></md-icon>\n      </md-button>\n    </div>\n    <md-button ng-click="vm.selectContact()" class="select-button md-accent md-raised" ng-disabled="!vm.selectedContact" aria-label="Select" translate="DASHBOARDS.SELECT" translate-attr-aria-label="DASHBOARDS.SELECT">\n      SELECT\n    </md-button>\n  </md-dialog-actions>\n</md-dialog>vc'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/agent.general.abandoned.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-selected="vm.selectedTab" md-dynamic-height md-border-bottom>\n      <md-tab ng-if="vm_home.hasPermission(110)" label="{{\'DASHBOARDS.VOICE\' | translate}}">\n        <md-content ng-if="vm.selectedTab === 0" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html\'" ng-controller="AgentHomeAbandonedVoiceController as vm_voice">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="{{\'DASHBOARDS.MOTION_BULL\' | translate}}">\n        <md-content ng-if="vm.selectedTab === 1" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/bull/agent.general.abandoned.bull.html\'" ng-controller="AgentHomeAbandonedBullController as vm_bull">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/bull/agent.general.abandoned.bull.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header blue-bg" ng-class="{\'h-128\' : vm_bull.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n      <ms-search-bar on-search="vm_bull.getAbandonedCalls()" query="vm_bull.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm_bull.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm_bull.quickFilters" query="vm_bull.query" search="vm_bull.getAbandonedCalls()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm_bull.refresh && vm_bull.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip ng-if="vm_bull.showTooltip" md-visible="vm_bull.showTooltip">\n          {{\'DASHBOARDS.CLICKRELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm_bull.promise">\n      <thead md-head md-order="vm_bull.query.sort" md-on-reorder="vm_bull.getAbandonedCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n          <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n          <th md-column md-order-by="queuecallerexitAt">{{\'DASHBOARDS.QUEUECALLEREXITAT\' | translate}}</th>\n          <th md-column md-order-by="queuecallerexitreason">{{\'DASHBOARDS.QUEUECALLEREXITREASON\' | translate}}\n          </th>\n          <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="secondDisposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="thirdDisposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.RESERVED\' | translate}}</th>\n          <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm_bull.abandonedCalls.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="abandonedCall in vm_bull.abandonedCalls.rows">\n          <td md-cell class="id">{{abandonedCall.id}}</td>\n          <td md-cell class="firstName" privacy ng-cloak>{{abandonedCall.calleridname}}</td>\n          <td md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="abandonedCall.calleridnum" license="vm_home.license" disabled="abandonedCall.lastAssignedTo !== vm_bull.currentUser.name">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="list">{{vm_bull.queuesMap[abandonedCall.queue]}}</td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : (abandonedCall.queuecallerexitAt | formatdate) }}\n          </td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerexitAt ? (abandonedCall.queuecallerexitAt | formatdate) : undefined }}\n          </td>\n          <td md-cell class="list">{{abandonedCall.queuecallerexitreason}}</td>\n          <td md-cell class="list">{{ abandonedCall.disposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.secondDisposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.thirdDisposition }}</td>\n          <td md-cell class="actions">\n            <md-switch no-margin ng-if="abandonedCall.lastAssignedTo === vm_bull.currentUser.name || !abandonedCall.lastAssignedTo" ng-disabled="vm_bull.disable[abandonedCall.id]" ng-model="abandonedCall.assigned" aria-label="reserved" ng-change="vm_bull.reserved(abandonedCall)">\n            </md-switch>\n          </td>\n          <td md-cell class="list">{{abandonedCall.lastAssignedTo}}</td>\n          <td md-cell class="actions">\n            <md-menu ng-if="abandonedCall.lastAssignedTo === vm_bull.currentUser.name">\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="1">\n                <md-menu-item>\n                  <md-button ng-click="vm_bull.dispose(abandonedCall)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm_bull.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_bull.query.page" md-total="{{vm_bull.abandonedCalls.count}}" md-on-paginate="vm_bull.getAbandonedCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/dispose/dialog.html",'<md-dialog class="agent-dialog" aria-label="agent dispose">\n  <form name="disposition" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n          <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\',false)" required>\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n          <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n            <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\',false)">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n          <md-input-container class="md-block" flex>\n            <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n            <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition" ng-change="vm.onDispositionChange(\'third\',false)">\n              <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true">\n                {{ disposition.name }}</md-option>\n            </md-select>\n          </md-input-container>\n          <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n            <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n            </md-icon>\n          </md-button>\n        </div>\n        <md-input-container class="md-block">\n          <label translate="DASHBOARDS.NOTE">Note</label>\n          <textarea ng-model="vm.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n        </md-input-container>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button ng-disabled="disposition.$invalid || disposition.$pristine" class="send-button md-raised md-accent" ng-click="vm.saveDisposition()">\n'+"          {{(vm.selectedDisposition.name ? 'DASHBOARDS.DISPOSE' : 'DASHBOARDS.SAVE') | translate}}\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>"),e.put("app/main/apps/dashboards/views/general/agent/home/abandoned/voice/agent.general.abandoned.voice.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header blue-bg" ng-class="{\'h-128\' : vm_voice.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n      <ms-search-bar on-search="vm_voice.getAbandonedCalls()" query="vm_voice.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm_voice.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm_voice.quickFilters" query="vm_voice.query" search="vm_voice.getAbandonedCalls()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm_voice.refresh && vm_voice.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip ng-if="vm_voice.showTooltip" md-visible="vm_voice.showTooltip">\n          {{\'DASHBOARDS.CLICKRELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm_voice.promise">\n      <thead md-head md-order="vm_voice.query.sort" md-on-reorder="vm_voice.getAbandonedCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n          <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n          <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="secondDisposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column md-order-by="thirdDisposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.RESERVED\' | translate}}</th>\n          <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm_voice.abandonedCalls.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="abandonedCall in vm_voice.abandonedCalls.rows">\n          <td md-cell class="id">{{abandonedCall.id}}</td>\n          <td md-cell class="firstName" privacy ng-cloak>{{abandonedCall.calleridname}}</td>\n          <td md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="abandonedCall.calleridnum" license="vm_home.license" disabled="abandonedCall.lastAssignedTo !== vm_voice.currentUser.name">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="list">{{vm_voice.queuesMap[abandonedCall.queue]}}</td>\n          <td md-cell class="list">\n            {{abandonedCall.queuecallerabandonAt ? (abandonedCall.queuecallerabandonAt | formatdate) : (abandonedCall.queuecallerexitAt | formatdate) }}\n          </td>\n          <td md-cell class="list">{{ abandonedCall.disposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.secondDisposition }}</td>\n          <td md-cell class="list">{{ abandonedCall.thirdDisposition }}</td>\n          <td md-cell class="actions">\n            <md-switch no-margin ng-if="abandonedCall.lastAssignedTo === vm_voice.currentUser.name || !abandonedCall.lastAssignedTo" ng-disabled="vm_voice.disable[abandonedCall.id]" ng-model="abandonedCall.assigned" aria-label="reserved" ng-change="vm_voice.reserved(abandonedCall)">\n            </md-switch>\n          </td>\n          <td md-cell class="list">{{abandonedCall.lastAssignedTo}}</td>\n          <td md-cell class="actions">\n            <md-menu ng-if="abandonedCall.lastAssignedTo === vm_voice.currentUser.name">\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="1">\n                <md-menu-item>\n                  <md-button ng-click="vm_voice.dispose(abandonedCall)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm_voice.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_voice.query.page" md-total="{{vm_voice.abandonedCalls.count}}" md-on-paginate="vm_voice.getAbandonedCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/agent.general.home.html",'<div layout="column" layout-align="start center" class="agent-general-home-navbar md-primary-bg width-50">\n  <div ng-repeat="node in vm_home.navigation">\n    <div ng-repeat="home in node.children">\n      <md-button ng-repeat="button in home.children  | orderBy:\'weight\'" ng-if="!button.hidden()" class="md-raised width-50 height-50 no-margin" style="border-radius: 0px" aria-label="{{button.state}}" ng-click="vm_home.changeSidebarTab(button)" ng-class="{\'md-primary\': vm_home.sidebar != button.state}">\n        <md-tooltip md-direction="right" md-delay="500"><span translate="{{button.translate}}"></span>\n        </md-tooltip>\n        <md-icon md-font-icon="{{button.icon}}" ng-class="button.iconClass"></md-icon>\n      </md-button>\n    </div>\n  </div>\n</div>\n<div class="agent-general-home-sections" layout="column" flex>\n  <div layout="column" flex>\n    <div ng-switch="vm_home.sidebar" style="overflow-y: auto; overflow-x: hidden" flex>\n      <div ng-switch-when="agentPresence" class="home-agent-presence">\n        <div ng-if="vm_home.hasPermission(115)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/agent.general.presence.html\'" ng-controller="AgentHomePresenceController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(115)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="contacts" class="home-contacts">\n        <div ng-if="vm_home.hasPermission(102) && vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/contacts/agent.general.contacts.html\'" ng-controller="AgentHomeContactsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(102) || !vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="mycontacts" class="home-mycontacts">\n        <div ng-if="vm_home.hasPermission(103) && vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/mycontacts/agent.general.mycontacts.html\'" ng-controller="AgentHomeMyContactsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(103) || !vm_home.license.cm" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="scheduled" class="home-scheduled">\n        <div ng-if="vm_home.hasPermission(113) && vm_home.license.dialer" ng-include="\'app/main/apps/dashboards/views/general/agent/home/scheduled/agent.general.scheduled.html\'" ng-controller="AgentHomeScheduledCallsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(113) || !vm_home.license.dialer" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="voice" class="home-voice">\n        <div ng-if="vm_home.hasPermission(110) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/voice/agent.general.voice.html\'" ng-controller="AgentHomeVoiceController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(110) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="abandoned" class="home-abandoned">\n        <div ng-if="vm_home.hasPermission(111) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/abandoned/agent.general.abandoned.html\'" ng-controller="AgentHomeAbandonedController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(111) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="recordings" class="home-recordings">\n        <div ng-if="vm_home.hasPermission(104) && vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/recordings/agent.general.recordings.html\'" ng-controller="AgentHomeRecordingsController as vm"></div>\n        <div ng-if="!vm_home.hasPermission(104) || !vm_home.license.voice" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="chat" class="home-chat">\n        <div ng-if="vm_home.hasPermission(105) && vm_home.license.chat" ng-include="\'app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html\'" ng-controller="AgentHomeChatController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(105) || !vm_home.license.chat" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="mail" class="home-mail">\n        <div ng-if="vm_home.hasPermission(106) && vm_home.license.mail" ng-include="\'app/main/apps/dashboards/views/general/agent/home/mail/agent.general.mail.html\'" ng-controller="AgentHomeMailController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(106) || !vm_home.license.mail" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="sms" class="home-sms">\n        <div ng-if="vm_home.hasPermission(107) && vm_home.license.messaging" ng-include="\'app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html\'" ng-controller="AgentHomeSmsController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(107) || !vm_home.license.messaging" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="openchannel" class="home-openchannel">\n        <div ng-if="vm_home.hasPermission(108) && vm_home.license.openchannel" ng-include="\'app/main/apps/dashboards/views/general/agent/home/openchannel/agent.general.openchannel.html\'" ng-controller="AgentHomeOpenchannelController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(108) || !vm_home.license.openchannel" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="fax" class="home-fax">\n        <div ng-if="vm_home.hasPermission(109) && vm_home.license.fax" ng-include="\'app/main/apps/dashboards/views/general/agent/home/fax/agent.general.fax.html\'" ng-controller="AgentHomeFaxController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(109) || !vm_home.license.fax" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="whatsapp" class="home-whatsapp">\n        <div ng-if="vm_home.hasPermission(114) && vm_home.license.whatsapp" ng-include="\'app/main/apps/dashboards/views/general/agent/home/whatsapp/agent.general.whatsapp.html\'" ng-controller="AgentHomeWhatsappController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting)">\n        </div>\n        <div ng-if="!vm_home.hasPermission(114) || !vm_home.license.whatsapp" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="plugin" class="home-plugin" layout-fill>\n        <div ng-if="vm_home.hasPermission(vm_home.pluginId)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/plugins/agent.general.plugins.html\'" ng-controller="AgentHomePluginsController as vm" ng-init="vm.onInit(vm_home.license, vm_home.setting, vm_home.plugin)" layout-fill></div>\n        <div ng-if="!vm_home.hasPermission(vm_home.pluginId)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n      <div ng-switch-default class="home-default">\n        <div ng-if="vm_home.hasPermission(101)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/agent.general.dashboard.html\'" ng-controller=" AgentHomeDashboardController  as vm"></div>\n        <div ng-if="!vm_home.hasPermission(101)" ng-include="\'app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html\'">\n        </div>\n      </div>\n    </div>\n  </div>\n  <div ng-if="(vm_home.draftManager.drafts | json) != \'{}\'" layout="column" class="draft-manager-bar">\n    <ms-tab-scroll>\n      <div layout="column" ng-repeat="(key, draft) in vm_home.draftManager.drafts" class="grey-50-bg" ng-click="vm_home.draftManager.open(draft.id)">\n        <div class="draft-manager-tab" layout="row" layout-align="space-between center">\n          <md-icon md-font-icon="icon-pencil" class="icon s16 margin-horizontal-5 black-fg"></md-icon>\n          <span class="text-truncate font-size-12 black-fg">{{draft.title}}</span>\n          <md-button class="md-icon-button md-mini no-margin md-primary" aria-label="close" ng-click="vm_home.draftManager.remove(draft.id)">\n            <md-icon md-font-icon="icon-close-circle-outline" class="icon s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </ms-tab-scroll>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/agent.general.home.permissions.html",'<md-content layout="row" layout-align="space-around center" flex layout-padding layout-wrap>\n  <div layout="column" layout-align="space-around center" flex="50">\n    <span class="font-size-40 text-center">{{ \'DASHBOARDS.WELCOME_TO_MOTION\' | translate }}!</span>\n    <span class="font-size-30 text-center" translate="DASHBOARDS.WELCOME_MESSAGE">Use the left sidebar to navigate through available sections.</span>\n  </div>\n\n  <div layout="column" flex="50">\n    <img src="assets/images/avatars/permissions.png" alt="permissions">\n  </div>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/home/chat/agent.general.chat.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.CHAT_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getChatInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getChatInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getChatInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChatInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.WEBSITE\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.chatInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.chatInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showChatInteraction($event, interaction)" md-cell class="chatAccount">\n            {{ vm.getChatWebsiteLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showChatInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Chat\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadChatInteraction($event, interaction, true)" translate="CHAT.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadChatInteraction($event, interaction)" translate="CHAT.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chatInteractions.count}}" md-on-paginate="vm.getChatInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/contacts/agent.general.contacts.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.CONTACTS">Contacts</span>\n      <ms-search-bar on-search="vm.getContacts()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getContacts()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" ng-click="vm.refreshContacts($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button ng-if="vm.lists.rows && vm.lists.rows.length" class="md-icon-button create-new" ng-click="vm.openContact()" aria-label="Add contact" translate translate-attr-label="DASHBOARDS.ADD_CONTACT">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="firstName">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="mobile">{{\'DASHBOARDS.MOBILE\' | translate}}</th>\n          <th md-column md-order-by="fax">{{\'DASHBOARDS.FAX\' | translate}}</th>\n          <th md-column md-order-by="email">{{\'DASHBOARDS.EMAIL\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.CREATEDAT\' | translate}}</th>\n          <th md-column md-order-by="ListId">{{\'DASHBOARDS.LIST\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.contacts.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="contact in vm.contacts.rows">\n          <td ng-click="vm.openContact(contact.id)" md-cell class="id">{{contact.id}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="firstName" privacy ng-cloak>{{contact.firstName}}\n            {{contact.lastName}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.phone" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="mobile">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.mobile" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="fax" privacy ng-cloak>{{contact.fax}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="email" privacy ng-cloak>{{contact.email}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="createdAt">{{contact.createdAt | formatdate}}</td>\n          <td ng-click="vm.openContact(contact.id)" md-cell class="list">{{vm.listsMap[contact.ListId].name}}\n          <td md-cell class="tag">\n            <div ng-if="contact.Tags.length">\n              <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                <span class="text-truncate">{{contact.Tags[0].name}}</span>\n              </div>\n              <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag"></md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.openContact(contact.id)" translate="DASHBOARDS.EDIT">\n                    Edit Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.mergeContact($event, contact)" translate="DASHBOARDS.MERGE">\n                    Merge Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.duplicateContact($event, contact)" translate="DASHBOARDS.DUPLICATE">\n                    Duplicate Contact\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/agent.general.dashboard.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-dynamic-height md-border-bottom>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.voice" label="{{\'DASHBOARDS.VOICE\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/voice/agent.general.dashboard.voice.html\'" ng-controller="AgentHomeDashboardVoiceController as vm_voice" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(110) && vm_home.license.dialer" label="{{\'DASHBOARDS.MOTION_BULL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/bull/agent.general.dashboard.bull.html\'" ng-controller="AgentHomeDashboardBullController as vm_bull" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(105) && vm_home.license.chat" label="{{\'DASHBOARDS.CHAT\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/chat/agent.general.dashboard.chat.html\'" ng-controller="AgentHomeDashboardMultiChannelChatController as vm_chat" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(106) && vm_home.license.mail" label="{{\'DASHBOARDS.MAIL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/mail/agent.general.dashboard.mail.html\'" ng-controller="AgentHomeDashboardMultiChannelMailController as vm_mail" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(107) && vm_home.license.messaging" label="{{\'DASHBOARDS.SMS\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/sms/agent.general.dashboard.sms.html\'" ng-controller="AgentHomeDashboardMultiChannelSmsController as vm_sms" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(108) && vm_home.license.openchannel" label="{{\'DASHBOARDS.OPENCHANNEL\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/openchannel/agent.general.dashboard.openchannel.html\'" ng-controller="AgentHomeDashboardMultiChannelOpenchannelController as vm_openchannel" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(109) && vm_home.license.fax" label="{{\'DASHBOARDS.FAX\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/fax/agent.general.dashboard.fax.html\'" ng-controller="AgentHomeDashboardMultiChannelFaxController as vm_fax" class="md-padding">\n        </md-content>\n      </md-tab>\n      <md-tab ng-if="vm_home.hasPermission(114) && vm_home.license.whatsapp" label="{{\'DASHBOARDS.WHATSAPP\' | translate}}">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/dashboard/whatsapp/agent.general.dashboard.whatsapp.html\'" ng-controller="AgentHomeDashboardMultiChannelWhatsappController as vm_whatsapp" class="md-padding">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/bull/agent.general.dashboard.bull.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header red-900-bg">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_bull.promise">\n        <thead md-head md-order="vm_bull.query.sort" md-on-reorder="vm_bull.getVoiceQueues">\n          <tr md-row>\n            <th md-column>{{ \'VOICE.NAME\' | translate }}</th>\n            <th md-column>{{ \'VOICE.TYPE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n            <th ng-if="voiceQueue.type === \'outbound\'" md-column>{{ \'VOICE.ACTIVE\' | translate }}</th>\n            \x3c!-- <th md-column md-order-by="active">{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_bull.getSize(vm_bull.voiceQueues)">\n            <td md-cell colspan="4">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, voiceQueue) in vm_bull.voiceQueues">\n            <td md-cell class="name">{{voiceQueue.name}}</td>\n            <td ng-if="voiceQueue.type === \'outbound\'" md-cell class="waiting">{{voiceQueue.dialMethod}}</td>\n            <td md-cell class="waiting">{{voiceQueue.waiting || 0}}</td>\n            <td md-cell ng-if="voiceQueue.type === \'outbound\'" class="dialActive ">\n              <md-icon md-colors="{color: {{voiceQueue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{voiceQueue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_bull.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_bull.query.page" md-total="{{vm_bull.voiceQueuesTotal}}" md-on-paginate="vm_bull.getVoiceQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header red-900-bg">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n            <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_bull.getSize(vm_bull.rpcVoiceQueuesChannels)">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, channel) in vm_bull.rpcVoiceQueuesChannels | limitObjectFromTo: vm_bull.queryChannels.limit:(vm_bull.queryChannels.page - 1) * vm_bull.queryChannels.limit">\n            <td md-cell>{{channel.exten}}</td>\n            <td md-cell>{{channel.queue}}</td>\n            <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_bull.queryChannels.limit" md-page="vm_bull.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_bull.getSize(vm_bull.rpcVoiceQueuesChannels)}}" md-page-select>\n    </md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/chat/agent.general.dashboard.chat.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_chat.getColorByChannel(\'chat\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_chat.promise">\n        <thead md-head md-order="vm_chat.query.sort" md-on-reorder="vm_chat.getChatQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_chat.getSize(vm_chat.chatQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_chat.chatQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_chat.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_chat.query.page" md-total="{{vm_chat.chatQueuesTotal}}" md-on-paginate="vm_chat.getChatQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_chat.getColorByChannel(\'chat\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_chat.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_chat.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_chat.queryChannels.limit" md-page="vm_chat.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_chat.paginatedInteractions.length}}" md-on-paginate="vm_chat.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/fax/agent.general.dashboard.fax.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_fax.getColorByChannel(\'fax\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_fax.promise">\n        <thead md-head md-order="vm_fax.query.sort" md-on-reorder="vm_fax.getFaxQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_fax.getSize(vm_fax.faxQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_fax.faxQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_fax.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_fax.query.page" md-total="{{vm_fax.faxQueuesTotal}}" md-on-paginate="vm_fax.getFaxQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_fax.getColorByChannel(\'fax\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_fax.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_fax.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_fax.queryChannels.limit" md-page="vm_fax.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_fax.paginatedInteractions.length}}" md-on-paginate="vm_fax.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/mail/agent.general.dashboard.mail.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_mail.getColorByChannel(\'mail\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_mail.promise">\n        <thead md-head md-order="vm_mail.query.sort" md-on-reorder="vm_mail.getMailQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_mail.getSize(vm_mail.mailQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_mail.mailQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_mail.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_mail.query.page" md-total="{{vm_mail.mailQueuesTotal}}" md-on-paginate="vm_mail.getMailQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_mail.getColorByChannel(\'mail\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_mail.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_mail.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_mail.queryChannels.limit" md-page="vm_mail.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_mail.paginatedInteractions.length}}" md-on-paginate="vm_mail.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/openchannel/agent.general.dashboard.openchannel.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_openchannel.getColorByChannel(\'openchannel\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_openchannel.promise">\n        <thead md-head md-order="vm_openchannel.query.sort" md-on-reorder="vm_openchannel.getOpenchannelQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_openchannel.getSize(vm_openchannel.openchannelQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_openchannel.openchannelQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_openchannel.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_openchannel.query.page" md-total="{{vm_openchannel.openchannelQueuesTotal}}" md-on-paginate="vm_openchannel.getOpenchannelQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_openchannel.getColorByChannel(\'openchannel\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_openchannel.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_openchannel.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_openchannel.queryChannels.limit" md-page="vm_openchannel.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_openchannel.paginatedInteractions.length}}" md-on-paginate="vm_openchannel.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/sms/agent.general.dashboard.sms.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_sms.getColorByChannel(\'sms\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_sms.promise">\n        <thead md-head md-order="vm_sms.query.sort" md-on-reorder="vm_sms.getSmsQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_sms.getSize(vm_sms.smsQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_sms.smsQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_sms.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_sms.query.page" md-total="{{vm_sms.smsQueuesTotal}}" md-on-paginate="vm_sms.getSmsQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_sms.getColorByChannel(\'sms\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_sms.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_sms.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_sms.queryChannels.limit" md-page="vm_sms.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_sms.paginatedInteractions.length}}" md-on-paginate="vm_sms.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/voice/agent.general.dashboard.voice.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg ">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="VOICE.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_voice.promise">\n        <thead md-head md-order="vm_voice.query.sort" md-on-reorder="vm_voice.getVoiceQueues">\n          <tr md-row>\n            <th md-column>{{ \'VOICE.NAME\' | translate }}</th>\n            <th md-column>{{ \'VOICE.WAITING\' | translate }}</th>\n            <th ng-if="voiceQueue.type === \'outbound\'" md-column>{{ \'VOICE.ACTIVE\' | translate }}</th>\n            \x3c!-- <th md-column md-order-by="active">{{ \'VOICE.ACTIVE\' | translate }}</th> --\x3e\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_voice.getSize(vm_voice.voiceQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, voiceQueue) in vm_voice.voiceQueues">\n            <td md-cell class="name">{{voiceQueue.name}}</td>\n            <td ng-if="voiceQueue.type === \'outbound\'" md-cell class="waiting">{{voiceQueue.dialMethod}}</td>\n            <td md-cell class="waiting">{{voiceQueue.waiting || 0}}</td>\n            <td md-cell ng-if="voiceQueue.type === \'outbound\'" class="dialActive ">\n              <md-icon md-colors="{color: {{voiceQueue.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{voiceQueue.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n            </td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_voice.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_voice.query.page" md-total="{{vm_voice.voiceQueuesTotal}}" md-on-paginate="vm_voice.getVoiceQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg ">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n            <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n            <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_voice.getSize(vm_voice.rpcVoiceQueuesChannels)">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, channel) in vm_voice.rpcVoiceQueuesChannels | limitObjectFromTo: vm_voice.queryChannels.limit:(vm_voice.queryChannels.page - 1) * vm_voice.queryChannels.limit">\n            <td md-cell>{{channel.exten}}</td>\n            <td md-cell>{{channel.queue}}</td>\n            <td md-cell privacy ng-cloak>{{channel.calleridnum}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_voice.queryChannels.limit" md-page="vm_voice.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_voice.getSize(vm_voice.rpcVoiceQueuesChannels)}}" md-page-select>\n    </md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/dashboard/whatsapp/agent.general.dashboard.whatsapp.html",'<div layout="row" ng-cloak>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_whatsapp.getColorByChannel(\'whatsapp\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.QUEUES">Queues</span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table md-progress="vm_whatsapp.promise">\n        <thead md-head md-order="vm_whatsapp.query.sort" md-on-reorder="vm_whatsapp.getWhatsappQueues">\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.NAME\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.WAITING\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_whatsapp.getSize(vm_whatsapp.whatsappQueues)">\n            <td md-cell colspan="2">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, queue) in vm_whatsapp.whatsappQueues">\n            <td md-cell class="name">{{queue.name}}</td>\n            <td md-cell class="waiting">{{queue.waiting || 0}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_whatsapp.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_whatsapp.query.page" md-total="{{vm_whatsapp.whatsappQueuesTotal}}" md-on-paginate="vm_whatsapp.getWhatsappQueues" md-page-select></md-table-pagination>\n  </md-card>\n  <md-card flex="50">\n    <md-toolbar class="md-table-toolbar md-default table-header" ng-class="vm_whatsapp.getColorByChannel(\'whatsapp\')">\n      <div class="md-toolbar-tools">\n        <span class="md-subhead" translate="DASHBOARDS.CHANNEL_WAITING_TEXT"></span>\n        <div flex></div>\n      </div>\n    </md-toolbar>\n    <md-table-container>\n      <table md-table>\n        <thead md-head>\n          <tr md-row>\n            <th md-column>{{ \'DASHBOARDS.ACCOUNT\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_QUEUE\' | translate }}</th>\n            <th md-column>{{ \'DASHBOARDS.CHANNEL_FROM\' | translate }}</th>\n          </tr>\n        </thead>\n        <tbody md-body>\n          <tr md-row ng-hide="vm_whatsapp.paginatedInteractions.length">\n            <td md-cell colspan="3">\n              <div layout="row" layout-align="center center">\n                <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n              </div>\n            </td>\n          </tr>\n          <tr md-row ng-repeat="(key, interaction) in vm_whatsapp.interactions">\n            <td md-cell>{{interaction.account}}</td>\n            <td md-cell>{{interaction.queue}}</td>\n            <td md-cell>{{interaction.from}}</td>\n          </tr>\n        </tbody>\n      </table>\n    </md-table-container>\n\n    <md-table-pagination md-limit="vm_whatsapp.queryChannels.limit" md-page="vm_whatsapp.queryChannels.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{vm_whatsapp.paginatedInteractions.length}}" md-on-paginate="vm_whatsapp.paginate" md-page-select></md-table-pagination>\n  </md-card>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/fax/agent.general.fax.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.FAX_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getFaxInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getFaxInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getFaxInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.faxAccounts.rows && vm.faxAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="faxAccount in vm.faxAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeFaxInteraction($event, faxAccount)">\n              {{ faxAccount.name }} ({{ faxAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.faxInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.faxInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showFaxInteraction($event, interaction)" md-cell class="faxAccount">\n            {{ vm.getFaxAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showFaxInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Fax\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadFaxInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Fax\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxInteractions.count}}" md-on-paginate="vm.getFaxInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/mail/agent.general.mail.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.MAIL_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getMailInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getMailInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getMailInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.mailAccounts.rows && vm.mailAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="mailAccount in vm.mailAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeMailInteraction($event, mailAccount)">\n              {{ mailAccount.name }} ({{ mailAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="subject">{{\'DASHBOARDS.SUBJECT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.mailInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.mailInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div ng-if="vm.setting.enableEmailPreview && interaction.lastMsgText" class="tooltip-preview" ng-mouseleave="vm.resetTooltipPosition($event)" ng-mouseenter="vm.adjustTooltipPosition($event)">\n              <span class="text-truncate font-size-12 subject-text">{{ interaction.subject }}</span>\n              <md-card class="tooltip-preview-text">\n                <md-card-content><span class="email-preview-message">{{ interaction.lastMsgText }}</span>\n                </md-card-content>\n              </md-card>\n            </div>\n            <span ng-if="!interaction.lastMsgText || !vm.setting.enableEmailPreview"><span class="text-truncate font-size-12 subject-text">{{ interaction.subject }}</span></span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showMailInteraction($event, interaction)" md-cell class="mailAccount">\n            {{ vm.getMailAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showMailInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Mail\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadMailInteraction($event, interaction, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadMailInteraction($event, interaction)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailInteractions.count}}" md-on-paginate="vm.getMailInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/mycontacts/agent.general.mycontacts.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.MYCONTACTS">My Contacts</span>\n      <ms-search-bar on-search="vm.getContacts()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getContacts()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" ng-click="vm.refreshContacts($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button ng-if="vm.lists.rows && vm.lists.rows.length" class="md-icon-button create-new" ng-click="vm.openContact($event)" aria-label="Add contact" translate translate-attr-label="DASHBOARDS.ADD_CONTACT">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContacts">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="firstName">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n          <th md-column md-order-by="mobile">{{\'DASHBOARDS.MOBILE\' | translate}}</th>\n          <th md-column md-order-by="fax">{{\'DASHBOARDS.FAX\' | translate}}</th>\n          <th md-column md-order-by="email">{{\'DASHBOARDS.EMAIL\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.CREATEDAT\' | translate}}</th>\n          <th md-column md-order-by="ListId">{{\'DASHBOARDS.LIST\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.contacts.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="contact in vm.contacts.rows">\n          <td ng-click="vm.openContact($event, contact)" md-cell class="id">{{contact.id}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="firstName" privacy ng-cloak>\n            {{contact.firstName}} {{contact.lastName}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="phone">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.phone" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="mobile">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="contact.mobile" prefix="vm.listsMap[contact.ListId].dialPrefix" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="fax" privacy ng-cloak>\n            {{contact.fax}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="email" privacy ng-cloak>{{contact.email}}\n          </td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="createdAt">{{contact.createdAt |\n            formatdate}}</td>\n          <td ng-click="vm.openContact($event, contact)" md-cell class="list">\n            {{vm.listsMap[contact.ListId].name}}</td>\n          <td md-cell class="tag">\n            <div ng-if="contact.Tags.length">\n              <div ng-if="contact.Tags.length == 1" layout="column" layout-align="center center">\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': contact.Tags[0].color }"></md-icon>\n                <span class="text-truncate">{{contact.Tags[0].name}}</span>\n              </div>\n              <div ng-if="contact.Tags.length > 1" layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in contact.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag"></md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.openContact($event, contact)" translate="DASHBOARDS.EDIT">\n                    Edit Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.mergeContact($event, contact)" translate="DASHBOARDS.MERGE">\n                    Merge Contact\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.duplicateContact($event, contact)" translate="DASHBOARDS.DUPLICATE">\n                    Duplicate Contact\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contacts.count}}" md-on-paginate="vm.getContacts" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/openchannel/agent.general.openchannel.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.OPENCHANNEL_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getOpenchannelInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getOpenchannelInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getOpenchannelInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.openchannelAccounts.rows && vm.openchannelAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeOpenchannelInteraction($event, openchannelAccount)" ng-disabled="!openchannelAccount.replyUri">\n              {{ openchannelAccount.name }} ({{ openchannelAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.openchannelInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.openchannelInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showOpenchannelInteraction($event, interaction)" md-cell class="openchannelAccount">\n            {{ vm.getOpenchannelAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showOpenchannelInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Openchannel\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions && vm.user.downloadAttachments">\n                  <md-button ng-click="vm.downloadOpenchannelInteraction($event, interaction, true)" translate="OPENCHANNEL.DOWNLOAD_WITH_ATTACHMENTS">\n                    Download with attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadOpenchannelInteraction($event, interaction)" translate="OPENCHANNEL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                    Download without attachments\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelInteractions.count}}" md-on-paginate="vm.getOpenchannelInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/plugins/agent.general.plugins.html",'<div id="plugin" ng-if="vm.plugin" ng-cloak layout-fill>\n  <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/agent.general.presence.html",'<div ng-cloak>\n  <md-content>\n    <md-tabs md-selected="vm.selectedTab" md-dynamic-height md-border-bottom>\n      <md-tab label="{{\'DASHBOARDS.AGENTS\' | translate}}" md-on-select="vm.onAgentsTabSelection()">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.agents.html\'">\n        </md-content>\n      </md-tab>\n      <md-tab label="{{\'DASHBOARDS.QUEUES\' | translate}}" md-on-select="vm.onQueuesTabSelection()">\n        <md-content ng-include="\'app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.queues.html\'">\n        </md-content>\n      </md-tab>\n    </md-tabs>\n  </md-content>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.agents.html",'<md-card ngCloak>\n  <md-toolbar class="md-table-toolbar md-default table-header xenialab-violet-light-bg" ng-class="{\'h-128\' : vm.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.AGENTS"></span>\n      <ms-search-bar on-search="vm.getAgents()" query="vm.agentsQuery" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.agentsQuery" search="vm.getAgents()"></ms-quick-filter>\n      <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getAgents()">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.agentsQuery.sort" md-on-reorder="vm.getAgents">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'DASHBOARDS.NAME\' | translate}}</th>\n          <th md-column md-order-by="internal">{{\'VOICE.INTERNAL\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column class="no-padding width-70"></th>\n          <th md-column class="width-70"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.agents.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="agent in vm.agents.rows">\n          <td md-cell>{{agent.id}}</td>\n          <td md-cell>{{agent.name}}</td>\n          <td md-cell>{{agent.internal}}</td>\n          <td md-cell>\n            <div layout="row">\n              <div layout="column" layout-align="center center">\n                <span class="text-boxed width-120 text-center md-background-bg bl bt padding-5" ng-class="{\'online\':\'lime-300-bg\',\'offline\':\'red-A200-bg\',\'pause\':\'amber-200-bg\',\'busy\':\'indigo-100-bg\'}[agent.status]">\n                  {{ \'VOICE.\' + (agent.status | uppercase) | translate | uppercase }}</span>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="no-padding width-70">\n            <md-button ng-if="agent.status !== \'offline\' && agent.status !== \'unavailable\'" ng-click="vm.originateCall(agent.name)" class="md-fab md-mini md-raised" aria-label="Dial">\n              <md-icon md-font-icon="icon-phone" class="icon green-fg s20">\n                <md-tooltip><span translate="VOICE.DIAL"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n          <td md-cell class="width-70">\n            <md-button ng-if="agent.status !== \'offline\' && agent.status !== \'unavailable\'" ng-click="vm.transferCall(agent.name)" class="md-fab md-mini md-raised" aria-label="Transfer">\n              <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s20">\n                <md-tooltip><span translate="DASHBOARDS.TRANSFER"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.agentsQuery.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.agentsQuery.page" md-total="{{vm.agents.count}}" md-on-paginate="vm.getAgents" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/presence/views/agent.general.presence.queues.html",'<md-card ngCloak>\n  <md-toolbar class="md-table-toolbar md-default table-header xenialab-violet-light-bg" ng-class="{\'h-128\' : vm.isSearchBarVisible === true}">\n    <div class="md-toolbar-tools" layout="row" layout-align="center center">\n      <span class="md-subhead" translate="DASHBOARDS.QUEUES"></span>\n      <ms-search-bar on-search="vm.getVoiceQueues()" query="vm.queuesQuery" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible"></ms-search-bar>\n      <div flex></div>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.queuesQuery.sort" md-on-reorder="vm.getVoiceQueues">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'DASHBOARDS.NAME\' | translate}}</th>\n          <th md-column md-order-by="name">{{\'VOICE.CALLS\' | translate}}</th>\n          <th md-column class="no-padding width-70"></th>\n          <th md-column class="width-70"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceQueues.rows.length">\n          <td md-cell colspan="12">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="queue in vm.voiceQueues.rows">\n          <td md-cell>{{queue.id}}</td>\n          <td md-cell>{{queue.name}}</td>\n          <td md-cell>{{queue.calls.length || 0}}</td>\n          <td md-cell class="no-padding width-70">\n            <md-button ng-click="vm.originateCall(queue.name)" class="md-fab md-mini md-raised" aria-label="Dial">\n              <md-icon md-font-icon="icon-phone" class="icon green-fg s20">\n                <md-tooltip><span translate="VOICE.DIAL"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n          <td md-cell class="width-70">\n            <md-button ng-click="vm.transferCall(queue.name)" class="md-fab md-mini md-raised" aria-label="Transfer">\n              <md-icon md-font-icon="icon-phone-forward" class="icon purple-fg s20">\n                <md-tooltip><span translate="DASHBOARDS.TRANSFER"></span></md-tooltip>\n              </md-icon>\n            </md-button>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.queuesQuery.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.queuesQuery.page" md-total="{{vm.voiceQueues.count}}" md-on-paginate="vm.getVoiceQueues" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/recordings/agent.general.recordings.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header indigo-A100-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="VOICE.RECORDINGS">Recordings</span>\n      <ms-search-bar on-search="vm.getVoiceRecordings()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceRecordings()">\n      </ms-quick-filter>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceRecordings">\n        <tr md-row>\n          <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n          <th md-column md-order-by="uniqueid">{{ \'VOICE.UNIQUEID\' | translate }}</th>\n          <th md-column md-order-by="calleridnum">{{ \'VOICE.CALLER\' | translate }}</th>\n          <th md-column md-order-by="exten">{{ \'VOICE.CALLED\' | translate }}</th>\n          <th md-column md-order-by="connectedlinenum">{{ \'VOICE.CONNECTED\' | translate }}</th>\n          <th md-column md-order-by="queue">{{ \'VOICE.QUEUE\' | translate }}</th>\n          <th md-column md-order-by="rating">{{ \'VOICE.RATING\' | translate }}</th>\n          <th md-column>{{ \'VOICE.AUDIO\' | translate }}</th>\n          <th md-column md-order-by="createdAt">{{ \'VOICE.DATE\' | translate }}</th>\n          <th md-column width="10px" ng-if="vm.currentUser.downloadVoiceRecordings"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n          <td md-cell colspan="{{ vm.currentUser.downloadVoiceRecordings ? 10 : 9}}">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="voiceRecording in vm.voiceRecordings.rows">\n          <td md-cell class="type">{{voiceRecording.type}}</td>\n          <td md-cell class="uniqueid">{{voiceRecording.uniqueid}}</td>\n          <td md-cell class="calleridnum">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.calleridnum" license="vm_home.license">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="exten">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.exten" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="connectedlinenum">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceRecording.connectedlinenum" license="vm_home.license">\n            </ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="queue">{{voiceRecording.queue}}</td>\n          <td md-cell class="rating">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-show="voiceRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:voiceRecording.rating"></md-icon><span ng-hide="voiceRecording.rating" translate="VOICE.NO_RATING">No rating</span>\n          </td>\n          <td md-cell class="audio" ng-switch="voiceRecording.format">\n            \x3c!-- audio recording directive --\x3e\n            <ms-recording ng-switch-when=".wav" id="voiceRecording.id"></ms-recording>\n            \x3c!-- / audio recording directive --\x3e\n            <span ng-switch-when=".gsm">\n              <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n            </span>\n          </td>\n          <td md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n          <td md-cell class="actions" ng-if="vm.currentUser.downloadVoiceRecordings">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.downloadfile(voiceRecording, $event)" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                    Download VoiceRecording\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\'">\n                  <md-button ng-click="vm.downloadtranscribe(voiceRecording, $event)" translate="VOICE.DOWNLOADTRANSCRIBE_VOICERECORDING">\n                    Download Transcribe\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceRecordings.count}}" md-on-paginate="vm.getVoiceRecordings" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/scheduled/agent.general.scheduled.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header blue-grey-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getScheduledCalls()">\n      </ms-quick-filter>\n      <md-button class="md-icon-button reload-list" ng-click="vm.getScheduledCalls()" aria-label="Refresh scheduled calls" translate translate-attr-label="MOTIONDIALER.REFRESH_SCHEDULED_CALLS">\n        <md-icon md-font-icon="icon-reload"></md-icon>\n        <md-tooltip>{{\'MOTIONDIALER.REFRESH_SCHEDULED_CALLS\' | translate}}</md-tooltip>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScheduledCalls">\n        <tr md-row>\n          <th md-column>{{\'MOTIONDIALER.FULLNAME\' | translate}}</th>\n          <th md-column md-order-by="phone">{{ \'MOTIONDIALER.PHONE\' | translate }}</th>\n          <th md-column md-order-by="scheduledat">{{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}</th>\n          <th md-column>{{ \'MOTIONDIALER.PRIORITY\' | translate }}</th>\n          <th md-column md-order-by="recallme">{{ \'MOTIONDIALER.RECALLME\' | translate }}</th>\n          <th md-column>{{ \'MOTIONDIALER.CAMPAIGN\' | translate }}</th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.scheduledCalls.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="scheduledCall in vm.scheduledCalls.rows">\n          <td md-cell privacy ng-cloak>{{scheduledCall.Contact.firstName}} {{scheduledCall.Contact.lastName}}</td>\n          <td md-cell>\n            <ms-click-to-call target="scheduledCall.phone" license="vm_home.license"></ms-click-to-call>\n          </td>\n          <td md-colors="{color: {{ vm.isDateBeforeToday(scheduledCall.scheduledat) ? \'\\\'red\\\'\' : \'\\\'green\\\'\' }}}" md-cell>{{ scheduledCall.scheduledat | date:\'medium\' }}</td>\n          <td md-cell>{{ vm.priorities[scheduledCall.priority] }}</td>\n          <td md-cell>\n            <md-icon md-colors="{color: {{ scheduledCall.recallme && scheduledCall.UserId == vm.currentUser.id ? \'\\\'green\\\'\' : \'\\\'grey\\\'\' }}}" md-font-icon="{{ scheduledCall.recallme  && scheduledCall.UserId == vm.currentUser.id ? \'icon-check\' : \'icon-close\' }}">\n            </md-icon>\n          </td>\n          <td md-cell>\n            <md-icon md-colors="{color: {{ scheduledCall.Queue.dialActive? \'\\\'green\\\'\' : \'\\\'red\\\'\' }}}" md-font-icon="icon-checkbox-blank-circle"></md-icon> {{scheduledCall.Queue.name}}\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.createOrEditQueueCampaignHopper($event, scheduledCall)" translate="MOTIONDIALER.EDIT_HOPPER">\n                    Edit Hopper\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.deleteConfirm(scheduledCall, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                    Delete Hopper\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.scheduledCalls.count}}" md-on-paginate="vm.getScheduledCalls" md-page-select>\n  </md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/sms/agent.general.sms.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.SMS_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getSmsInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getSmsInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getSmsInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.smsAccounts.rows && vm.smsAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="smsAccount in vm.smsAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeSmsInteraction($event, smsAccount)">\n              {{ smsAccount.name }} ({{ smsAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.smsInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.smsInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showSmsInteraction($event, interaction)" md-cell class="smsAccount">\n            {{ vm.getSmsAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showSmsInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Sms\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadSmsInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Sms\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsInteractions.count}}" md-on-paginate="vm.getSmsInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/voice/agent.general.voice.html",'<md-card ng-init="vm.onInit()">\n  <md-toolbar class="md-table-toolbar md-default table-header blue-A700-bg" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="VOICE.CALLS">Calls</span>\n      <ms-search-bar on-search="vm.getVoiceCalls()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceCalls()">\n      </ms-quick-filter>\n    </div>\n  </md-toolbar>\n  <md-table-container>\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceCalls">\n        <tr md-row>\n          <th md-column md-order-by="id">{{\'VOICE.ID\' | translate}}</th>\n          <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n          <th md-column md-order-by="source">{{ \'VOICE.SOURCE\' | translate }}</th>\n          <th md-column md-order-by="destination">{{ \'VOICE.DESTINATION\' | translate }}</th>\n          <th md-column md-order-by="starttime">{{ \'VOICE.STARTEDAT\' | translate }}</th>\n          <th md-column md-order-by="endtime">{{ \'VOICE.ENDEDAT\' | translate }}</th>\n          <th md-column md-order-by="userDisposition">{{ \'VOICE.DISPOSITION\' | translate }}</th>\n          <th md-column md-order-by="userSecondDisposition">{{ \'VOICE.SECOND_LEVEL_DISPOSITION\' | translate }}</th>\n          <th md-column md-order-by="userThirdDisposition">{{ \'VOICE.THIRD_LEVEL_DISPOSITION\' | translate }}</th>\n          <th md-column>{{ \'VOICE.NOTE\' | translate }}</th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.voiceCalls.rows.length">\n          <td md-cell colspan="10">\n            <div layout="row" layout-align="center center">\n              <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="voiceCall in vm.voiceCalls.rows" ng-click="vm.showDetails(voiceCall, $event)">\n          <td md-cell class="type">{{voiceCall.id}}</td>\n          <td md-cell class="type">{{ \'VOICE.\' + voiceCall.type.toUpperCase() | translate}}</td>\n          <td md-cell class="source">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceCall.source" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="destination">\n            \x3c!-- click to call directive --\x3e\n            <ms-click-to-call target="voiceCall.destination" license="vm_home.license"></ms-click-to-call>\n            \x3c!--  / click to call directive --\x3e\n          </td>\n          <td md-cell class="starttime">{{voiceCall.starttime | date:\'medium\' }}</td>\n          <td md-cell class="endtime">{{voiceCall.endtime | date:\'medium\' }}</td>\n          <td md-cell class="disposition">{{ voiceCall.userDisposition}}</td>\n          <td md-cell class="disposition">{{ voiceCall.userSecondDisposition}}</td>\n          <td md-cell class="disposition">{{ voiceCall.userThirdDisposition}}</td>\n          <td md-cell class="note">\n            <md-icon ng-if="voiceCall.note" md-font-icon="icon-clipboard-outline"></md-icon>\n          </td>\n          <td md-cell class="actions">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n\n              <md-menu-content width="3">\n                <md-menu-item>\n                  <md-button ng-click="vm.showDetails(voiceCall, $event)" translate="VOICE.DETAILS">\n                    Show Details\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceCalls.count}}" md-on-paginate="vm.getVoiceCalls" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/home/voice/details/dialog.html",'<md-dialog class="details-dialog" aria-label="details">\n  <md-toolbar class="md-background-bg">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span ng-if="!vm.interaction.closed" class="title" translate="VOICE.DETAILS"></span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <md-list flex>\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.UNIQUEID">Uniqueid</p>\n          <h4>{{vm.call.uniqueid}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.TYPE">Type</p>\n          <h4>{{vm.call.type ? vm.call.type : \'no type\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.SOURCE">Source</p>\n          <h4 privacy ng-cloak>{{vm.call.source ? vm.call.source : \'unknown\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DESTINATION">Destination</p>\n          <h4 privacy ng-cloak>{{vm.call.destination ? vm.call.destination : \'unknown\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.STARTEDAT">Started At</p>\n          <h4>{{vm.call.starttime | date:\'medium\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.ANSWEREDAT">Answered At</p>\n          <h4>{{vm.call.answertime ? (vm.call.answertime | date:\'medium\') : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.ENDEDAT">Ended At</p>\n          <h4>{{vm.call.endtime ? (vm.call.endtime | date:\'medium\') : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DURATION">Duration</p>\n          <h4>{{vm.call.duration ? vm.call.duration : \'--\'}}s</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.BILLABLESECONDS">Billable Seconds</p>\n          <h4>{{vm.call.billableseconds ? vm.call.billableseconds : \'--\'}}s</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.DISPOSITION">Disposition</p>\n          <h4>{{vm.call.userDisposition ? vm.call.userDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n          <h4>{{vm.call.userSecondDisposition ? vm.call.userSecondDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n          <h4>{{vm.call.userThirdDisposition ? vm.call.userThirdDisposition : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n\n      <md-list-item class="md-2-line">\n        <div class="md-list-item-text">\n          <p translate="VOICE.NOTE">Note</p>\n          <h4>{{vm.call.note ? vm.call.note : \'--\'}}</h4>\n        </div>\n      </md-list-item>\n    </md-list>\n  </md-dialog-content>\n\n  <md-dialog-actions layout="row" layout-align="space-between center">\n    <md-button type="button" ng-click="vm.closeDialog()" class="send-button md-accent md-raised" aria-label="DISPOSE" translate="VOICE.CLOSE" translate-attr-aria-label="VOICE.DISPOSE">\n      CLOSE\n    </md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/home/whatsapp/agent.general.whatsapp.html",'<md-card ng-cloak>\n  <md-toolbar class="md-table-toolbar md-default table-header" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" ng-disabled="vm.searchInProgress">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="DASHBOARDS.WHATSAPP_INTERACTIONS">Interactions</span>\n      <ms-search-bar on-search="vm.getWhatsappInteractions()" query="vm.query" debounce="300" direction="down" icon-color="white-fg" display-on="vm.isSearchBarVisible" ng-disabled="vm.query.search" min-chars="5">\n      </ms-search-bar>\n      <div flex></div>\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getWhatsappInteractions()" ng-disabled="vm.query.search"></ms-quick-filter>\n      <div layout="row">\n        <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini white-bg\': vm.query.search }" aria-label="Advanced search" translate translate-attr-aria-label="DASHBOARDS.ADVANCED_SEARCH" ng-click="vm.openAdvancedSearch()">\n          <md-icon md-font-icon="{{ vm.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'{{ vm.sectionColor }}-fg blink\': vm.query.search }"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.ADVANCED_SEARCH\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button reload-list" aria-label="Reload" translate translate-attr-aria-label="DASHBOARDS.RELOAD" ng-click="vm.getWhatsappInteractions()">\n          <md-icon md-font-icon="icon-reload"></md-icon>\n          <md-tooltip>{{\'DASHBOARDS.RELOAD\' | translate}}</md-tooltip>\n        </md-button>\n      </div>\n      <md-menu ng-if="vm.whatsappAccounts.rows && vm.whatsappAccounts.rows.length">\n        <md-button class="md-icon-button create-new" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n          <md-icon md-font-icon="icon-plus"></md-icon>\n        </md-button>\n        <md-menu-content width="3">\n          <md-menu-item ng-repeat="whatsappAccount in vm.whatsappAccounts.rows">\n            <md-button aria-label="compose" ng-click="vm.composeWhatsappInteraction($event, whatsappAccount)">\n              {{ whatsappAccount.name }} ({{ whatsappAccount.key }})</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </div>\n  </md-toolbar>\n  <md-table-container class="interactions-list">\n    <table md-table md-progress="vm.promise">\n      <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappInteractions">\n        <tr md-row>\n          <th class="id-header" md-column md-order-by="id">\n            {{\'DASHBOARDS.ID\' | translate}}</th>\n          <th md-column class="no-padding width-5">\n            <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n          </th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column class="no-padding width-5"></th>\n          <th md-column md-order-by="contactName">{{\'DASHBOARDS.CONTACT\' | translate}}</th>\n          <th md-column md-order-by="createdAt">{{\'DASHBOARDS.STARTEDAT\' | translate}}</th>\n          <th md-column md-order-by="lastMsgAt">{{\'DASHBOARDS.LAST_MESSAGE\' | translate}}</th>\n          <th md-column md-order-by="closed">{{\'DASHBOARDS.STATUS\' | translate}}</th>\n          <th md-column>{{\'DASHBOARDS.AGENT\' | translate}}</th>\n          <th md-column>\n            {{\'DASHBOARDS.ACCOUNT\' | translate}}\n          </th>\n          <th md-column>{{\'DASHBOARDS.TAGS\' | translate}}</th>\n          <th md-column></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row ng-hide="vm.whatsappInteractions.rows.length">\n          <td md-cell colspan="13">\n            <div layout="row" layout-align="center center">\n              <span translate="DASHBOARDS.NO_AVAILABLE_INTERACTION">No Available\n                Interaction</span>\n            </div>\n          </td>\n        </tr>\n        <tr md-row ng-repeat="interaction in vm.whatsappInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="id">\n            <div layout="row" layout-align="start center">\n              <span class="font-size-10">{{interaction.id}}</span>\n            </div>\n          </td>\n          <td md-cell>\n            <div ng-if="!interaction.closed && interaction.Users.length">\n              <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n              <md-tooltip>\n                <span ng-repeat="u in interaction.Users">{{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : u.fullname | translate }}<span ng-if="!$last">, </span></span>\n              </md-tooltip>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="!interaction.closed && interaction.unreadMessages > 0" layout="row" layout-align="start center">\n              <span class="badge white-fg" ng-class="{{ \'vm.sectionColor\' }} + \'-bg\'" layout-margin>{{interaction.unreadMessages}}</span>\n            </div>\n          </td>\n          <td md-cell class="width-5 no-padding">\n            <div ng-if="interaction.attach" layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            </div>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <div layout="column" layout-align="start start">\n              <span class="font-size-12 text-truncate contact-text" ng-class="{\'no-margin-bottom\' : interaction.contactInfo}" layout-margin privacy ng-cloak>{{ interaction.contactName }}</span>\n              <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text no-margin-top" layout-margin privacy ng-cloak>{{ interaction.contactInfo }}</span>\n            </div>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <span class="font-size-10 text-truncate">{{interaction.createdAt | formatdate }}</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <div layout="row" ng-if="interaction.lastMsgAt">\n              <span>\n                <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}">\n                </md-icon>\n              </span>\n              <div layout="column" layout-align="center center">\n                <span class="font-size-10 text-truncate">{{interaction.lastMsgAt | formatdate }}</span>\n              </div>\n            </div>\n            <span ng-if="!interaction.lastMsgAt">No messages</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell>\n            <span ng-if="interaction.closed" class="red-fg font-size-12">{{ \'DASHBOARDS.CLOSED\' | translate}} <span ng-if="interaction.disposition">-\n                {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}</span></span>\n            <md-tooltip class="multiline" ng-if="interaction.closed">\n              <div layout="column">\n                <div layout="column">\n                  <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                </div>\n                <div ng-if="interaction.disposition" layout="column">\n                  <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.disposition }}</span>\n                </div>\n                <div ng-if="interaction.secondDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                </div>\n                <div ng-if="interaction.thirdDisposition" layout="column">\n                  <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                  <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                </div>\n              </div>\n            </md-tooltip>\n            <span ng-if="!interaction.closed" class="green-fg font-size-12"><span translate="DASHBOARDS.OPENED"></span><span ng-if="interaction.substatus"> -\n                {{interaction.substatus}}</span></span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="user">\n            <span class="font-size-12 text-truncate width-80">{{ vm.getAgentLabel(interaction) }}</span>\n          </td>\n          <td ng-click="vm.showWhatsappInteraction($event, interaction)" md-cell class="whatsappAccount">\n            {{ vm.getWhatsappAccountLabel(interaction) }}\n          </td>\n          <td md-cell>\n            <div ng-if="interaction.Tags.length">\n              <div layout="column" layout-align="center center">\n                <md-tooltip md-direction="left" layout="row">\n                  <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">,\n                    </span></span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                </md-icon>\n              </div>\n            </div>\n          </td>\n          <td md-cell class="actions actions-padding">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="2">\n                <md-menu-item>\n                  <md-button ng-click="vm.showWhatsappInteraction($event, interaction)" translate="DASHBOARDS.SHOW">\n                    Show Whatsapp\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm.user.downloadOmnichannelInteractions">\n                  <md-button ng-click="vm.downloadWhatsappInteraction($event, interaction)" translate="DASHBOARDS.DOWNLOAD">\n                    Download Whatsapp\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="!interaction.closed">\n                  <md-button ng-click="vm.disposeInteraction($event, interaction)" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n                    Close and Dispose\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{\'DASHBOARDS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'DASHBOARDS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'DASHBOARDS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappInteractions.count}}" md-on-paginate="vm.getWhatsappInteractions" md-page-select></md-table-pagination>\n</md-card>'),e.put("app/main/apps/dashboards/views/general/agent/iframe/agent.general.iframe.html",'<md-content layout="row" layout-fill>\n\n  <div flex layout="row">\n\n    <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="width: 100%; height: 100%; border:0px;"></iframe>\n\n  </div>\n\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.dialog.html",'<md-dialog id="agent-general-dialog" aria-label="Spy Dialog">\n  <div id="interaction-app" class="agent-content" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html\'"></div>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/agent.general.interaction.html",'\x3c!-- CONTENT CARD --\x3e\n<md-content class="content-card" layout="row" layout-fill>\n\n  <div ng-if="!vm.showInteraction" class="start-point" flex layout="column" layout-align="center center" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.loading.html\'"></div>\n\n  <div ng-if="vm.showInteraction" flex layout="row">\n\n    <md-card flex="75" class="interaction">\n\n      <md-content class="interaction-agents" layout="row" layout-align="start center" ng-if="!vm.interaction.closed && vm.interaction.Users.length">\n        <strong layout-margin translate="DASHBOARDS.CURRENTLY_IN_USE_BY">Currently in use by </strong>\n\n        <div ng-repeat="u in vm.interaction.Users">\n          <img class="avatar-small" ng-src="api/users/{{u.id}}/avatar">\n          <md-tooltip> {{ (u.id == vm.user.id) ? \'DASHBOARDS.ME\' : vm.usersMap[u.id] | translate }}\n          </md-tooltip>\n        </div>\n      </md-content>\n\n      \x3c!-- TOOLBAR --\x3e\n      <md-toolbar class="interaction-toolbar" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.html\'">\n      </md-toolbar>\n      \x3c!-- / TOOLBAR --\x3e\n\n      \x3c!-- CONTENT --\x3e\n      <md-content id="interaction-content" name="{{\'interaction-content-\' + vm.tab.id}}" flex layout-wrap>\n        <div class="interaction-messages" ng-switch="vm.tab.channel">\n          <div ng-switch-when="mail">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html\'">\n            </div>\n          </div>\n          <div ng-switch-default>\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.html\'">\n            </div>\n          </div>\n        </div>\n      </md-content>\n      \x3c!-- / CONTENT --\x3e\n\n      \x3c!-- FOOTER --\x3e\n      <div ng-if="\n            !vm.interaction.closed && ( vm.tab.channel == \'chat\' \n            || (vm.tab.channel == \'openchannel\' && vm.account.replyUri) \n            || (vm.tab.channel == \'sms\' && !vm.tab.spy) \n            || (vm.tab.channel == \'whatsapp\' && !vm.tab.spy) )\n             && (vm.user.role !== \'admin\' && vm.user.role !== \'user\')" class="interaction-footer flex-noshrink" layout="row" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html\'">\n      </div>\n      \x3c!-- / FOOTER--\x3e\n    </md-card>\n\n    <md-card layout="column" flex class="info" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.html\'">\n    </md-card>\n  </div>\n</md-content>\n\x3c!-- / CONTENT CARD --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/chat/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="CHAT.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="CHAT.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="CHAT.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="CHAT.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="CHAT.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'CHAT.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'CHAT.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.ChatAccountId" md-font-icon="icon-earth" aria-label="alert chat" class="s16"></md-icon>\n          <md-icon ng-if="item.ChatAccountId" md-font-icon="icon-message-text" aria-label="alert chat" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n\n        <md-not-found>\n          <span translate="CHAT.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/fax/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="FAX.SEND">SEND</span>\n          </md-button>\n          <md-button ng-disabled="vm.message.attachments.length === 1" class="md-fab md-mini md-white-bg" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-init="vm.ngFlowOptions" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)">\n            <md-icon md-font-icon="icon-paperclip" class="red-fg"></md-icon>\n          </md-button>\n        </div>\n        <span class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="FAX.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block to">\n        <label translate="FAX.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete ng-hide="vm.message.to.length === 1" md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.fax" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" ng-if="composeForm.$dirty">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n          <div ng-message="md-max-chips">You reached the maximum amount of chips</div>\n        </div>\n      </md-input-container>\n      <div class="attachment-list" ng-if="vm.message.attachments.length" layout="row" layout-wrap>\n        <div class="attachment" layout="row" layout-align="space-between center" ng-repeat="attachment in vm.message.attachments">\n          <div>\n            <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            <span class="filename">{{attachment.name}}</span>\n            <span class="size">({{attachment.size | byteFmt: 0}})</span>\n          </div>\n          <md-button class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="FAX.DELETE_ATTACHMENT">\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/mail/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message" ng-class="{\'mail-no-secret\': !vm.secret}" ng-cloak>\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar ng-class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <div ng-if="!vm.secret" class="md-button md-raised blue-bg no-padding">\n            <button class="white-fg margin-horizontal-10" aria-label="Send message" ng-disabled="!vm.verifySmtp" ng-click="vm.send($event, false, null)">\n              <span>{{ \'MAIL.SEND\' | translate | uppercase }}</span>\n            </button>\n            <span class="white-fg secondary-text vertical-divider"></span>\n            <md-menu>\n              <button ng-disabled="!vm.verifySmtp" class="white-fg margin-left-0" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-menu-down" class="icon s24"></md-icon>\n              </button>\n              <md-menu-content width="2">\n                <md-menu-item ng-if="vm.subStatuses.rows.length">\n                  <md-menu>\n                    <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="MAIL.SEND_AS">\n                      Send as\n                    </md-button>\n                    <md-menu-content>\n                      <md-menu-item ng-repeat="subStatus in vm.subStatuses.rows">\n                        <md-button ng-click="vm.send($event, false, subStatus.name)">\n                          {{subStatus.name}}\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </md-menu-item>\n                <md-menu-item>\n                  <md-button ng-click="vm.send($event, true, null)" translate="MAIL.SEND_AND_CLOSE">\n                    Send and Close\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </div>\n          <md-button ng-if="!vm.secret" class=" md-button md-raised blue-bg white-fg margin-horizontal-10" aria-label="Save draft" ng-click="vm.saveDraft()">\n            <span>{{ (vm.isDraft ? \'DASHBOARDS.UPDATE_DRAFT\' : \'DASHBOARDS.SAVE_AS_DRAFT\') | translate | uppercase }}</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="MAIL.ADD_NOTE">Add note</span>\n          </md-button>\n          <md-button ng-disabled="!vm.verifySmtp" class="md-fab md-mini md-white-bg" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload($files)" flow-init="vm.ngFlowOptions" flow-file-success="vm.fileSuccess($file, $message)" flow-file-added="vm.fileAdded($file)">\n            <md-icon md-font-icon="icon-paperclip" class="red-fg"></md-icon>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="MAIL.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to" ng-class="{\'hidden-cc\': vm.hiddenCC, \'hidden-bcc\': vm.hiddenBCC}">\n        <label translate="MAIL.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.to)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n        <div class="cc-bcc" layout="row" layout-align="start center">\n          <div class="show-cc" ng-show="vm.hiddenCC" ng-click="vm.hiddenCC = false">CC</div>\n          <div class="show-bcc" ng-show="vm.hiddenBCC" ng-click="vm.hiddenBCC = false">BCC</div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block" ng-hide="vm.hiddenCC">\n        <label translate="MAIL.CC">Cc</label>\n        <md-chips name="cc" ng-model="vm.message.cc" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.cc)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchCc" md-items="contact in vm.contactSearch(vm.searchCc)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block" ng-hide="vm.hiddenBCC">\n        <label translate="MAIL.BCC">Bcc</label>\n        <md-chips name="bcc" ng-model="vm.message.bcc" ng-keypress="vm.keyPress($event)" md-transform-chip="vm.transformContact($chip, vm.message.bcc)" md-separator-keys="vm.separatorKeys" md-require-match="false" required>\n          <md-autocomplete md-search-text="vm.searchBcc" md-items="contact in vm.contactSearch(vm.searchBcc)" md-item-text="contact.email" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n      </md-input-container>\n      <md-input-container ng-if="!vm.secret" class="md-block no-margin">\n        <label translate="MAIL.SUBJECT">Subject</label>\n        <input ng-model="vm.message.subject" type="text" ng-keypress="vm.keyPress($event)">\n      </md-input-container>\n      <div class="attachment-list" ng-if="vm.message.attachments.length" layout="row" layout-wrap>\n        <div class="attachment" layout="row" layout-align="space-between center" ng-repeat="attachment in vm.message.attachments">\n          <div>\n            <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n            <span class="filename">{{attachment.name}}</span>\n            <span class="size" ng-if="attachment.size">({{attachment.size | byteFmt: 0}})</span>\n          </div>\n          <md-button ng-click="vm.removeAttachment(attachment)" class="md-icon-button" aria-label="Delete attachment" translate translate-attr-aria-label="MAIL.DELETE_ATTACHMENT">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="padding-top-5">\n        <textarea ckeditor="vm.ckeditor" id="html-area" ng-model="vm.message.body" md-select-on-focus="" ready="vm.onReadyEditor()"></textarea>\n      </div>\n      <md-switch ng-if="!vm.message.showLastMessage && !vm.secret" ng-model="vm.message.showLastMessage" ng-change="vm.loadLastMessage()" aria-label="load last message"><span translate="MAIL.SHOW_ORIGINAL_MESSAGE">Show original message</span></md-switch>\n      <md-autocomplete ng-if="!vm.secret" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'MAIL.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin" ng-keypress="vm.keyPress($event)">\n        <md-item-template>\n          <md-icon ng-if="!item.MailAccountId" md-font-icon="icon-earth" aria-label="alert email" class="s16">\n          </md-icon>\n          <md-icon ng-if="item.MailAccountId" md-font-icon="icon-email" aria-label="alert email" class="s16 teal-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{ item.key }} -\n            {{ item.value | htmlToPlaintext }}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="MAIL.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/openchannel/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="OPENCHANNEL.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="OPENCHANNEL.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="OPENCHANNEL.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="OPENCHANNEL.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mapkey" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'OPENCHANNEL.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'OPENCHANNEL.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.OpenchannelAccountId" md-font-icon="icon-earth" aria-label="alert openchannel" class="s16"></md-icon>\n          <md-icon ng-if="item.OpenchannelAccountId" md-font-icon="icon-message-text" aria-label="alert openchannel" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="OPENCHANNEL.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/sms/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="SMS.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="SMS.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="SMS.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="SMS.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'SMS.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'SMS.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.SmsAccountId" md-font-icon="icon-earth" aria-label="alert sms" class="s16"></md-icon>\n          <md-icon ng-if="item.SmsAccountId" md-font-icon="icon-message-text" aria-label="alert sms" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="SMS.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/compose/whatsapp/dialog.html",'<md-dialog class="compose-dialog" aria-label="New Message">\n  <form class="md-inline-form" name="composeForm" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <div layout="row">\n          <md-button ng-if="!vm.secret" ng-click="vm.send()" class="md-raised md-blue-bg white-fg" aria-label="Send message">\n            <span translate="WHATSAPP.SEND">SEND</span>\n          </md-button>\n          <md-button ng-if="vm.secret" ng-click="vm.addNote()" class="md-raised md-blue-bg white-fg" aria-label="Add note">\n            <span translate="WHATSAPP.ADD_NOTE">Add note</span>\n          </md-button>\n        </div>\n        <span ng-if="!vm.secret" class="title">{{vm.message.from}}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" aria-label="Close dialog" tranlate translate-aria-label="WHATSAPP.CLOSE_DIALOG">\n          <md-icon md-font-icon="icon-close"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.secret" class="md-block to">\n        <label translate="WHATSAPP.TO">To</label>\n        <md-chips name="to" ng-model="vm.message.to" md-transform-chip="vm.transformContact($chip)" md-separator-keys="vm.separatorKeys" md-require-match="false" md-max-chips="1" required>\n          <md-autocomplete md-search-text="vm.searchTo" md-items="contact in vm.contactSearch(vm.searchTo)" md-item-text="contact.mobile" md-min-length="3">\n            <md-item-template>\n              <span>{{ vm.getContact(contact) }}</span>\n            </md-item-template>\n          </md-autocomplete>\n        </md-chips>\n        <div ng-messages="composeForm.to.$error" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TO_REQUIRED">To field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-emoji-area on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.message.body" placeholder="\'WHATSAPP.INSERT_MESSAGE_HERE\'" picker-position="\'bottom\'"></ms-emoji-area>\n      <md-autocomplete ng-if="!vm.secret" class="padding-top-5" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" md-floating-label="{{ \'WHATSAPP.CANNED_ANSWER_SEARCH\' | translate}}" class="input-show-hide no-container-margin">\n        <md-item-template>\n          <md-icon ng-if="!item.WhatsappAccountId" md-font-icon="icon-earth" aria-label="alert whatsapp" class="s16">\n          </md-icon>\n          <md-icon ng-if="item.WhatsappAccountId" md-font-icon="icon-message-text" aria-label="alert whatsapp" class="s16 orange-fg"></md-icon>\n          <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n        </md-item-template>\n        <md-not-found>\n          <span translate="WHATSAPP.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n        </md-not-found>\n      </md-autocomplete>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/dispose/dialog.html",'<md-dialog class="disposition-dialog" aria-label="disposition" ng-init="vm.onInit()">\n  <form name="dispositionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span ng-if="!vm.interaction.closed" class="title" translate="DASHBOARDS.DISPOSE"></span>\n        <span ng-if="vm.interaction.closed" class="title" translate="DASHBOARDS.INFO"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()" ng-if="!vm.mandatoryDisposition">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.DISPOSITION">Disposition</label>\n        <md-select name="disposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onDispositionChange(\'first\')" required>\n          <md-option ng-value="null" ng-if="!vm.mandatoryDisposition">NONE</md-option>\n          <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' } : true">\n            {{ disposition.name }}</md-option>\n        </md-select>\n        <div ng-messages="dispositionForm.disposition.$error" ng-show="dispositionForm.disposition.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n          <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition" ng-change="vm.onDispositionChange(\'second\')">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id } : true">\n              {{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearDispositionSelection(\'second\')" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear second level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div ng-if="vm.secondLevelDisposition && vm.anyThirdLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</label>\n          <md-select name="thirdLevelDisposition" ng-model="vm.thirdLevelDisposition">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'third\', ParentId: vm.secondLevelDisposition.id } : true" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.thirdLevelDisposition" ng-click="vm.clearDispositionSelection(\'third\')" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear third level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.NOTE">Note</label>\n        <textarea ng-model="vm.interaction.note" md-maxlength="255" max-rows="5" autofocus></textarea>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveDisposition()" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && (vm.firstLevelDisposition || vm.secondLevelDisposition || vm.thirdLevelDisposition)" aria-label="CLOSE_AND_DISPOSE" translate="DASHBOARDS.CLOSE_AND_DISPOSE" translate-attr-aria-label="DASHBOARDS.CLOSE_AND_DISPOSE">\n          CLOSE AND DISPOSE\n        </md-button>\n        <md-button type="submit" ng-click="vm.saveDisposition(false)" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="!vm.interaction.closed && !vm.firstLevelDisposition" ng-disabled="vm.mandatoryDisposition" aria-label="CLOSE_WITHOUT_DISPOSE" translate="DASHBOARDS.CLOSE_WITHOUT_DISPOSE" translate-attr-aria-label="DASHBOARDS.CLOSE_WITHOUT_DISPOSE">\n          CLOSE WITHOUT DISPOSE\n        </md-button>\n        <md-button type="submit" ng-click="vm.saveDisposition()" ms-dialog-spinner class="send-button md-accent md-raised" ng-if="vm.interaction.closed" ng-disabled="vm.mandatoryDisposition && !vm.firstLevelDisposition" aria-label="DISPOSE" translate="DASHBOARDS.DISPOSE" translate-attr-aria-label="DASHBOARDS.DISPOSE">\n          DISPOSE\n        </md-button>\n        <div ng-if="vm.mandatoryDisposition">\n          <md-icon md-font-icon="icon-information-outline" aria-label="Mandatory Disposition"></md-icon>\n          <span class="no-margin font-size-12 line-height-30" translate="DASHBOARDS.HELP.MANDATORY_DISPOSITION_ENABLED"></span>\n        </div>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/tag/dialog.html",'<md-dialog class="tag-dialog" aria-label="tag">\n  <form name="tagForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.TAGS"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <md-chips ng-model="vm.interaction.Tags" md-autocomplete-snap md-require-match="vm.autocompleteRequireMatch">\n          <md-autocomplete ng-blur="vm.searchText = \'\'" md-min-length="0" md-selected-item-change="vm.selectedItemChange" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-items="item in vm.tags.rows | filter:{ name: vm.searchText }" md-item-text="item.name" placeholder="Search for a tag">\n            <span md-highlight-text="vm.searchText">{{item.name}}</span>\n          </md-autocomplete>\n          <md-chip-template>\n            <span>\n              <strong>{{$chip.name}}</strong>\n            </span>\n          </md-chip-template>\n        </md-chips>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveTag(false)" ng-disabled="tagForm.$pristine" class="send-button md-accent md-raised" aria-label="TAG" translate="DASHBOARDS.SAVE" translate-attr-aria-label="DASHBOARDS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/transfer/dialog.html",'<md-dialog class="disposition-dialog" aria-label="disposition">\n  <form name="transferForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="DASHBOARDS.TRANSFER"></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(false)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="DASHBOARDS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.transfer.type">\n          <md-option ng-value="\'queue\'" ng-if="vm.account.queueTransfer">Queue</md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.account.agentTransfer">Agent</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.transfer.type === \'queue\'">\n        <label translate="DASHBOARDS.QUEUES">Queues</label>\n        <md-select name="queue" ng-model="vm.transfer.id" required>\n          <md-option ng-value="queue.id" ng-repeat="queue in vm.queues.rows">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="transferForm.queue.$error" ng-show="transferForm.queue.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.transfer.type === \'agent\'">\n        <label translate="DASHBOARDS.AGENTS">Agents</label>\n        <md-select name="agent" ng-model="vm.transfer.id" required>\n          <md-option ng-value="agent.id" ng-repeat="agent in vm.agents.rows">{{\n            agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="transferForm.agent.$error" ng-show="transferForm.agent.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="DASHBOARDS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.onTransfer(true)" ng-disabled="transferForm.$pristine" class="send-button md-accent md-raised" aria-label="DASHBOARDS.TRANSFER" translate="DASHBOARDS.TRANSFER" translate-attr-aria-label="DASHBOARDS.TRANSFER">\n          TRANSFER\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.footer.html",'\x3c!-- REPLY FORM --\x3e\n<div ng-show="vm.showFooter" layout="column" layout-align="center center" flex>\n  <div layout="row" layout-align="center center" style="flex-grow: 1; align-self: stretch" flex>\n    \x3c!-- msEmojyArea directive --\x3e\n    <ms-emoji-area ng-if="vm.tab.channel != \'fax\'" on-reply="vm.reply(event, body)" ctrl-methods="vm.ctrlMethods" ng-model="vm.tab.areaText" placeholder="vm.tab.channel.toUpperCase() + \'.INSERT_MESSAGE_HERE\'"></ms-emoji-area>\n    \x3c!-- / msEmojyArea directive --\x3e\n\n    <div layout="row" layout-align="end center">\n      <md-button ng-if="vm.tab.channel != \'fax\'" style="margin:1px;" class="md-icon-button md-mini" ng-click="vm.changeDisplayCannedAnswerInputValue()" aria-label="Search canned answer" translate translate-attr-aria-label="DASHBOARDS.SEND_MESSAGE">\n        <md-icon md-font-icon="icon-auto-fix" class="green-fg"></md-icon>\n      </md-button>\n\n      <md-button ng-if="vm.tab.channel == \'openchannel\' || vm.tab.channel == \'chat\' || vm.tab.channel == \'fax\'" style="margin:1px;" class="md-icon-button md-warn md-mini" aria-label="attachment" translate-attr-aria-label="DASHBOARDS.ATTACHMENT" flow-btn flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-init="vm.ngFlowOptions" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)">\n        <md-icon md-font-icon="icon-paperclip"></md-icon>\n      </md-button>\n    </div>\n  </div>\n\n  <md-autocomplete ng-hide="!vm.displayCannedAnswerInput" md-selected-item="vm.selectedItem" md-search-text="vm.searchText" md-selected-item-change="vm.selectedItemChange(item)" md-items="item in vm.searchTextChange(vm.searchText)" md-item-text="item.value" md-min-length="1" placeholder="{{ \'DASHBOARDS.CANNED_ANSWER_SEARCH\' | translate}}" class="cannedarea input-show-hide">\n    <md-item-template>\n      <md-icon ng-if="!item[vm.tab.channel === \'chat\' ? \'ChatWebsiteId\' : _.capitalize(vm.tab.channel) + \'AccountId\']" md-font-icon="icon-earth" aria-label="alert channel" class="s16"></md-icon>\n      <md-icon ng-if="item[vm.tab.channel === \'chat\' ? \'ChatWebsiteId\' : _.capitalize(vm.tab.channel) + \'AccountId\']" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" aria-label="alert channel" class="s16" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n      <span md-highlight-text="vm.searchText" md-highlight-flags="^i">{{item.key}} - {{item.value}}</span>\n    </md-item-template>\n\n    <md-not-found>\n      <span translate="DASHBOARDS.CANNED_ANSWER_NOT_FOUND">No canned answers were found</span>\n    </md-not-found>\n  </md-autocomplete>\n</div>\n\x3c!-- / REPLY FORM --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line" ng-if="item.browserName">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.BROWSER_NAME">Browser Name</p>\n      <h4>{{ item.browserName }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.osName">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.OS_NAME">OS Name</p>\n      <h4>{{ item.osName }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.deviceModel">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DEVICE_MODEL">Device Model</p>\n      <h4>{{ item.deviceModel }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.referer">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.REFERER">Referer</p>\n      <h4>{{ item.referer }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.customerIp">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CUSTOMER_IP">Originating IP Address</p>\n      <h4>{{ item.customerIp }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.customerPort">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CUSTOMER_PORT">Originating TCP Port</p>\n      <h4>{{ item.customerPort }}</h4>\n    </div>\n  </md-list-item>\n  <md-divider ng-if="item.closed && item.ratingValue != null || item.ratingMessage"></md-divider>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.ratingValue != null">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.RATING">Rating</p>\n      <md-icon md-font-icon="icon-star" style="color:red" ng-show="!item.ratingType || item.ratingType == \'star\'" ng-repeat="ratingValue in [1,2,3,4,5] | limitTo:item.ratingValue"></md-icon>\n      <md-icon md-font-icon="icon-thumb-up" style="color:green" ng-show="item.ratingType && item.ratingType == \'thumb\' && item.ratingValue == 1"></md-icon>\n      <md-icon md-font-icon="icon-thumb-down" style="color:red" ng-show="item.ratingType && item.ratingType == \'thumb\' && item.ratingValue == 0"></md-icon>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.ratingMessage">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.FEEDBACK">Feedback</p>\n      <h4 style="overflow-wrap: break-word; white-space: normal">{{ item.ratingMessage }}</h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.html",'<md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CONTACT">Contact</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding">\n        <form name="contactForm" class="md-inline-form" novalidate>\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-account"></md-icon>\n            <label translate="DASHBOARDS.NAME">Name</label>\n            <input type="text" name="firstName" ng-model="vm.contact.firstName" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-email"></md-icon>\n            <label translate="DASHBOARDS.EMAIL">Email</label>\n            <input type="email" name="email" ng-model="vm.contact.email" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n            <label translate="DASHBOARDS.PHONE">Phone</label>\n            <input type="text" name="phone" ng-model="vm.contact.phone" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-cellphone-iphone"></md-icon>\n            <label translate="DASHBOARDS.MOBILE">Mobile</label>\n            <input type="text" name="mobile" ng-model="vm.contact.mobile" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-icon md-font-icon="icon-deskphone"></md-icon>\n            <label translate="DASHBOARDS.FAX">Fax</label>\n            <input type="text" name="fax" ng-model="vm.contact.fax" disabled privacy ng-cloak>\n          </md-input-container>\n\n          <div ng-if="!vm.tab.spy" layout="row" layout-align="center center">\n            <md-button class="md-raised md-accent" ng-click="vm.openContact(ev)" translate="DASHBOARDS.MORE">\n              More\n            </md-button>\n          </div>\n        </form>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.INTERACTION">Interaction</span>\n    </md-tab-label>\n    <md-tab-body>\n      <div layout="column" layout-align="space-between center" class="md-padding">\n        <md-icon class="s42" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n        <span ng-if="vm.interaction.closed" class="md-background-bg red-fg font-size-14">#{{vm.interaction.id}} - <span translate="DASHBOARDS.CLOSED"></span></span>\n        <span ng-if="!vm.interaction.closed" class="md-background-bg green-fg font-size-14">#{{vm.interaction.id}} -\n          <span translate="DASHBOARDS.OPENED"></span></span>\n        <span ng-if="!vm.interaction.closed && vm.interaction.substatus" class="md-background-bg green-fg font-size-14">{{vm.interaction.substatus}}</span>\n      </div>\n      <md-divider></md-divider>\n      <md-list flex>\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.WEBSITE" ng-if="vm.tab.channel == \'chat\'">Website</p>\n            <p translate="DASHBOARDS.ACCOUNT" ng-if="vm.tab.channel != \'chat\'">Account</p>\n            <h4>{{vm.account.name}}</h4>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.AGENT">Agent</p>\n            <h4>{{vm.agent.fullname || vm.usersMap[vm.interaction.UserId]}}</h4>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.externalUrl">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.EXTERNAL_URL">External URL</p>\n            <a href="{{vm.interaction.externalUrl}}" target="_blank">\n              <h4>{{vm.interaction.externalUrl}}</h4>\n            </a>\n          </div>\n        </md-list-item>\n\n        <md-list-item class="md-2-line">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.CREATED_AT">Created At</p>\n            <h4>{{vm.interaction.createdAt | date: \'medium\'}}</h4>\n          </div>\n        </md-list-item>\n\n        <div ng-switch="vm.tab.channel">\n          <div ng-switch-when="chat">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'">\n            </div>\n          </div>\n          <div ng-switch-when="mail">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'">\n            </div>\n          </div>\n          <div ng-switch-when="openchannel">\n            <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.openchannel.html\'">\n            </div>\n          </div>\n        </div>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.Tags.length">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.TAGS">Tags</p>\n            <div class="tags padding-bottom-5" layout="row" layout-align="start center" layout-wrap>\n              <div class="tag margin-right-5 margin-top-5 margin-bottom-5" layout="row" layout-align="center center" ng-repeat="tag in vm.interaction.Tags">\n                <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n                <div class="tag-label">{{tag.name}}</div>\n              </div>\n            </div>\n          </div>\n        </md-list-item>\n\n        <md-divider ng-if="vm.interaction.closed"></md-divider>\n\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.CLOSED_AT">Closed At</p>\n            <h4>{{vm.interaction.closedAt | date: \'medium\'}}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.disposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.DISPOSITION">Disposition</p>\n            <h4>{{ vm.interaction.disposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.secondDisposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n            <h4>{{ vm.interaction.secondDisposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-2-line" ng-if="vm.interaction.closed && vm.interaction.thirdDisposition">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n            <h4>{{ vm.interaction.thirdDisposition }}</h4>\n          </div>\n        </md-list-item>\n        <md-list-item class="md-3-line md-long-text" ng-if="vm.interaction.closed && vm.interaction.note">\n          <div class="md-list-item-text">\n            <p translate="DASHBOARDS.NOTE">NOTE</p>\n            <h4 style="overflow-wrap: break-word; white-space: normal">{{ vm.interaction.note }}</h4>\n          </div>\n        </md-list-item>\n      </md-list>\n    </md-tab-body>\n  </md-tab>\n  <md-tab>\n    <md-tab-label>\n      <span translate="DASHBOARDS.CUSTOMER_JOURNEY">Journey</span>\n    </md-tab-label>\n    <md-tab-body>\n      <md-content class="md-padding">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html\'">\n        </div>\n      </md-content>\n    </md-tab-body>\n  </md-tab>\n</md-tabs>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html",'<md-divider></md-divider>\n<md-list flex>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.AGENT">Agent</p>\n      <h4>{{ vm.agent.fullname || vm.usersMap[item.UserId] || \'DASHBOARDS.NOT_ASSIGNED\' | translate }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.externalUrl">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.EXTERNAL_URL">External URL</p>\n      <a href="{{ item.externalUrl }}" target="_blank">\n        <h4>{{ item.externalUrl }}</h4>\n      </a>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CREATED_AT">Created At</p>\n      <h4>{{ item.createdAt | date: \'medium\' }}</h4>\n    </div>\n  </md-list-item>\n  <div ng-if="item.channel === \'chat\'">\n    <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.chat.html\'">\n    </div>\n  </div>\n  <div ng-if="item.channel === \'mail\'">\n    <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html\'">\n    </div>\n  </div>\n  <md-divider ng-if="item.closed"></md-divider>\n  <md-list-item class="md-2-line" ng-if="item.closed">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CLOSED_AT">Closed At</p>\n      <h4>{{ item.closedAt | date: \'medium\' }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.disposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DISPOSITION">Disposition</p>\n      <h4>{{ item.disposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.secondDisposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</p>\n      <h4>{{ item.secondDisposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-2-line" ng-if="item.closed && item.thirdDisposition">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.THIRD_LEVEL_DISPOSITION">Third Level Disposition</p>\n      <h4>{{ item.thirdDisposition }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item class="md-3-line md-long-text" ng-if="item.closed && item.note">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.NOTE">NOTE</p>\n      <h4 style="overflow-wrap: break-word; white-space: normal">{{ item.note }}</h4>\n    </div>\n  </md-list-item>\n  <md-list-item ng-if="item.Tags.length">\n    <p class="padding-horizontal-15 grey-fg">Tags</p>\n    <div class="tags padding-bottom-5" layout="row" layout-align="start center" layout-wrap>\n      <div class="tag margin-right-5 margin-top-5 margin-bottom-5" layout="row" layout-align="center center" ng-repeat="tag in item.Tags">\n        <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n        <div class="tag-label">{{ tag.name }}</div>\n      </div>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.html",'<div layout-margin layout="row" layout-align="center center">\n  <ms-quick-filter filters="vm.quickFilters" query="vm.journeyOptions" search="vm.getCustomerJourney()">\n  </ms-quick-filter>\n</div>\n\n<md-content id="journey-content" flex layout-wrap>\n  <div ng-if="vm.journeyIsLoading" layout="row" layout-align="center center">\n    <md-progress-circular class="md-accent" md-diameter="48" md-mode="indeterminate"></md-progress-circular>\n  </div>\n  <div id="timeline" layout="column" ng-if="vm.journey && vm.journey.length && !vm.journeyIsLoading" ms-timeline="vm.journeyTimelineOptions" ms-timeline-load-more="vm.loadMoreJourney()">\n    \x3c!-- TIMELINE ITEM --\x3e\n    <div class="ms-timeline-item" layout-align="center center" ng-repeat="item in vm.journey">\n      <div class="timeline-card">\n        <md-card class="channel" ng-class="{\'md-grey-200-bg\': item.id == vm.interaction.id}">\n          <div layout="row" layout-align="space-between center">\n            <div class="header p-6" layout="row" layout-align="start center" ng-cloak>\n              <md-button class="md-fab md-mini no-click" aria-label="icon-channel" ng-class="{{ \'item.style.color\' }} + \'-bg\'">\n                <md-icon md-font-icon="{{ item.style.icon }}"></md-icon>\n              </md-button>\n              <div class="info" layout="column" ng-init="item.showMore = false">\n                <span class="font-size-12 text-truncate" ng-if="item.destination">\n                  #{{item.id}} - <span privacy ng-cloak>{{ item.destination }}</span>\n                </span>\n                <span class="font-size-12 text-truncate" ng-if="!item.destination">\n                  #{{item.id}} - {{ item.Account.key }}\n                </span>\n                <span class="font-size-10">{{item.createdAt | date: \'medium\'}}</span>\n                <span>\n                  <a class="toggle-details md-accent-color" ng-click="item.showMore = !item.showMore" translate="{{ item.showMore ? \'DASHBOARDS.HIDE_DETAILS\' : \'DASHBOARDS.SHOW_DETAILS\' }}">\n                  </a>\n                </span>\n              </div>\n            </div>\n            <span>\n              <img ng-if="item.UserId" class="avatar" ng-src="api/users/{{item.UserId}}/avatar">\n              <md-tooltip md-direction="left">{{item.Owner.fullname || item.User.fullname}}</md-tooltip>\n            </span>\n          </div>\n          <div ng-if="item.showMore">\n            <div ng-if="item.channel !== \'voice\'" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.all.html\'">\n            </div>\n            <div ng-if="item.channel === \'voice\'" ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html\'">\n            </div>\n          </div>\n          <md-divider></md-divider>\n          <div ng-if="item.id != vm.interaction.id" layout="row" layout-align="space-around center">\n            <div ng-if="item.closed && item.channel !== \'voice\'" class="text-truncate text-boxed-light">\n              <span class="red-fg" title="{{ \'DASHBOARDS.STATUS\' | translate}} : {{ \'DASHBOARDS.CLOSED\' | translate }} {{ item.dispositionsValues }}">\n                {{ \'DASHBOARDS.STATUS\' | translate}} : {{ \'DASHBOARDS.CLOSED\' | translate}} {{ item.dispositionsValues\n                }}\n              </span>\n            </div>\n            <span class="text-boxed md-background-bg green-fg" ng-if="!item.closed && item.channel !== \'voice\'" title="{{ \'DASHBOARDS.STATUS\' | translate}}: {{ \'DASHBOARDS.OPENED\' | translate}}">\n              {{ \'DASHBOARDS.STATUS\' | translate}}:\n              {{ \'DASHBOARDS.OPENED\' | translate}}\n              <span ng-if="item.substatus"> - {{ item.substatus }}</span>\n            </span>\n            <span ng-if="item.channel === \'voice\'" class="text-boxed md-background-bg red-fg" title="{{ item.userDisposition ? (\'DASHBOARDS.DISPOSITION\' | translate) + \':\' : \'\'}} {{ item.userDisposition ?\n                item.userDisposition : (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }}">\n              {{ item.userDisposition ? (\'DASHBOARDS.DISPOSITION\' | translate) + \':\' : \'\'}} {{ item.userDisposition ?\n              item.userDisposition : (\'DASHBOARDS.NO_DISPOSITION_SET\' | translate) }}\n            </span>\n            <span ng-if="item.channel === \'voice\' && item.userSecondDisposition" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}: {{ item.userSecondDisposition }}">\n              {{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:\n              {{ item.userSecondDisposition }}\n            </span>\n            <span ng-if="item.channel === \'voice\' && item.userThirdDisposition" class="text-boxed md-background-bg red-fg" title="{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}: {{ item.userThirdDisposition }}">\n              {{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:\n              {{ item.userThirdDisposition }}\n            </span>\n            <div flex></div>\n            <md-button ng-if="!vm.tab.spy && vm.user.role === \'agent\' && item.canOpen && item.channel !== \'voice\'" class="md-icon-button" aria-label="go" ng-click="vm.openInteraction(item)">\n              <md-icon md-font-icon="icon-open-in-new" class="s20"></md-icon>\n            </md-button>\n          </div>\n        </md-card>\n      </div>\n    </div>\n\n    <div ng-if="vm.canLoadMoreJourney" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row keep-on-top">\n      <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-click="vm.loadMoreJourney()" translate="DASHBOARDS.MORE">\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / TIMELINE ITEM --\x3e\n</md-content>\n\n<div ng-if="!vm.journey || vm.journey.length === 0" layout="row" layout-align="center center">\n  <em translate="DASHBOARDS.NO_DATA_AVAILABLE">No data available</em>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.journey.voice.html",'<md-divider></md-divider>\n\n<md-list flex>\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.TYPE">Type</p>\n      <h4>{{ item.type ? item.type : \'no type\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SOURCE">Source</p>\n      <h4 privacy ng-cloak>{{ item.source ? item.source : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DESTINATION">Destination</p>\n      <h4 privacy ng-cloak>{{ item.destination ? item.destination : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.UNIQUEID">Uniqueid</p>\n      <h4>{{ item.uniqueid ? item.uniqueid : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.CALLERID">Caller Id</p>\n      <h4 privacy ng-cloak>{{ item.callerid ? item.callerid : (\'DASHBOARDS.UNKNOWN\' | translate) }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.STARTEDAT">Started At</p>\n      <h4>{{ item.starttime | date:\'medium\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.END_AT">End At</p>\n      <h4>{{ item.endtime | date:\'medium\' }}</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.DURATION">Duration</p>\n      <h4>{{ item.duration ? item.duration : \'--\' }}s</h4>\n    </div>\n  </md-list-item>\n\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.NOTE">Note</p>\n      <h4>{{ item.note ? item.note : \'--\' }}</h4>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.mail.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line" ng-if="item.subject">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.SUBJECT">Subject</p>\n      <h4>{{ item.subject }}</h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.info.openchannel.html",'<div ng-init="item = item || vm.interaction">\n  <md-list-item class="md-2-line">\n    <div class="md-list-item-text">\n      <p translate="DASHBOARDS.VISIBILITY">Visibility</p>\n      <h4 translate="{{ item.threadId ? \'DASHBOARDS.PUBLIC\' : \'DASHBOARDS.PRIVATE\'}}"></h4>\n    </div>\n  </md-list-item>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.html",'\x3c!-- MESSAGES --\x3e\n<div layout="row" ng-repeat="message in vm.messages.rows" class="md-padding message-row" ng-class="vm.getMessagesAlignment(message)">\n  <img ng-if="message.direction ===\'in\'" src="assets/images/avatars/customer.png" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && message.UserId && !message.secret" ng-src="api/users/{{message.UserId}}/avatar" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && message.UserId && message.secret" ng-src="api/users/{{message.UserId}}/avatar" class="avatar" />\n  <img ng-if="message.direction ===\'out\' && !message.UserId" class="avatar" src="assets/images/avatars/robot.png">\n  <md-button ng-if="vm.tab.channel === \'fax\'" class="md-fab md-mini no-margin" aria-label="Download" ng-click="vm.downloadMessage(message)">\n    <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n  </md-button>\n\n  <div class="bubble" ng-class="{\'md-yellow-200-bg\': message.secret}" ng-switch="message.direction">\n    <div ng-if="message.secret">\n      <div class="time secondary-text" layout="row" layout-align="end center">\n        <div layout-padding>\n          <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n          <span> - {{message.createdAt | date: \'medium\'}}</span>\n        </div>\n        <div ng-if="message.id">\n          <md-icon class="s18" md-font-icon="icon-lock"></md-icon>\n        </div>\n      </div>\n    </div>\n    <div ng-if="!message.secret">\n      <div ng-switch-when="in" class="time secondary-text" ng-click="message.Contact && vm.openContact(ev, message.Contact)">\n        <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n        <span> - {{message.createdAt | date: \'medium\'}}</span>\n      </div>\n      <div ng-switch-when="out" class="time secondary-text" layout="row" layout-align="end center">\n        <div layout-padding>\n          <span privacy ng-cloak>{{ vm.getLabelByMessage(message) }}</span>\n          <span> - {{message.createdAt | date: \'medium\'}}</span>\n        </div>\n        <div ng-if="message.id && vm.tab.channel !== \'fax\'">\n          <md-icon ng-if="!message.read" class="s18" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read" class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n        </div>\n        <div ng-if="message.id && vm.tab.channel === \'fax\'">\n          <md-icon ng-if="!message.read && !(message.failMessage )" class="s18" md-font-icon="icon-check"></md-icon>\n          <md-icon ng-if="message.read" class="s18" md-font-icon="icon-check-all md-accent"></md-icon>\n          <span ng-if="!message.read && message.failMessage" class="s18 red-900-fg"> {{ message.failMessage }}</span>\n          <md-icon ng-if="!message.read && message.failMessage" class="s18 red-900-fg" md-font-icon="icon-close md-accent"></md-icon>\n        </div>\n      </div>\n    </div>\n    <div ng-if="message.AttachmentId" layout="row" layout-align="end center">\n      <md-button ng-if="vm.downloadPermissions.attachments" class="md-raised md-accent" ng-click="vm.getAttachment({id: message.AttachmentId, name: vm.htmlToPlaintext(message.body)})">\n        <span>{{vm.htmlToPlaintext(message.body)}}</span>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </md-button>\n      <div ng-if="!vm.downloadPermissions.attachments" class="disabled-button">\n        <span>{{vm.htmlToPlaintext(message.body)}}</span>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </div>\n    </div>\n    <div ng-if="!message.AttachmentId" class="message" layout="row" layout-align="end center">\n      <span ng-bind-html="message.body | embed: vm.embedOptions"></span>\n    </div>\n  </div>\n</div>\n\x3c!-- / MESSAGES --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.interaction.mail.html",'<div ms-timeline="vm.interactionTimelineOptions" ms-timeline-load-more="vm.loadNextPage()">\n  <div ng-repeat="message in vm.messages.rows track by message.id" ng-init="vm.selectedMailShowSystemMessage[message.id] = false">\n    <md-card ng-if="message.secret" class="md-padding md-yellow-100-bg" layout="column">\n      <div layout="row" layout-align="start center">\n        <img class="avatar" ng-src="api/users/{{message.UserId}}/avatar">\n        <div layout="column">\n          <span class="grey-fg">{{vm.agent.fullname || vm.usersMap[message.UserId]}}</span>\n          <span class="grey-fg">{{message.createdAt | date:\'medium\'}}</span>\n        </div>\n      </div>\n      <div layout="row" layout-align="center center" layout-fill ng-if="message.attach && vm.downloadPermissions.attachments">\n        <div flex>\n          <md-divider></md-divider>\n        </div>\n        <md-menu>\n          <md-button aria-label="attachments" class="md-icon-button" ng-click="vm.getAttachments(message); $mdOpenMenu($event);">\n            <md-tooltip md-direction="bottom"><span translate="MAIL.ATTACHMENTS">Attachments</span>\n            </md-tooltip>\n            <div layout="row" layout-align="start center">\n              <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon>\n              <span>{{message.attach}}</span>\n            </div>\n          </md-button>\n          <md-menu-content width="4">\n            <div layout="column" layout-align="center center" ng-if="!message.attachments">\n              <md-progress-circular md-mode="indeterminate"></md-progress-circular>\n              <span translate="MAIL.ATTACHMENTS">Attachments</span>\n            </div>\n            <md-menu-item ng-if="message.attachments" ng-repeat="attachment in message.attachments">\n              <md-button ng-click="vm.getAttachment(attachment)">\n                {{ attachment.name || (\'attachment-\' + $index) }}</md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n        <div flex>\n          <md-divider></md-divider>\n        </div>\n      </div>\n      <div class="padding-top-5" ng-bind-html-unsafe="message.body"></div>\n    </md-card>\n    <div ng-if="!message.secret">\n      <div layout="row" layout-align="center center" ng-if="message.direction == \'out\' && !message.UserId && !vm.selectedMailShowSystemMessage[message.id]">\n        <md-button class="md-raised blue-grey-300-bg white-fg" ng-click="vm.selectedMailShowSystemMessage[message.id] = !vm.selectedMailShowSystemMessage[message.id]">\n          [{{message.createdAt | date: \'medium\'}}] {{ \'MAIL.SHOW_AUTOREPLY\' | translate }}</md-button>\n      </div>\n      <md-card layout="column" class="md-padding message-row" ng-if="message.direction == \'in\' || (message.direction == \'out\' && (message.UserId || vm.selectedMailShowSystemMessage[message.id]))">\n        <md-content class="mail-content">\n          <div class="info" layout="row" layout-align="space-between start">\n            <div layout="column" layout-align="start start">\n              <div layout="row" layout-align="start start">\n                <div layout="column" layout-align="start start">\n                  <div class="name" ng-click="message.Contact && vm.openContact(ev, message.Contact)">\n                    <strong privacy ng-cloak>{{message.from}}</strong>\n                    <md-icon ng-if="message.attach" md-font-icon="icon-paperclip" class="s16">\n                    </md-icon>\n                  </div>\n                  <div class="name">\n                    <div>{{message.subject}}</div>\n                  </div>\n                  <div class="name" layout="row" layout-align="start center"><span translate="MAIL.TO">To</span>: <span class="padding-left-5 subject text-truncate" privacy ng-cloak>{{ message.originTo || message.to\n                      }}</span>\n                  </div>\n                  <div class="name padding-top-10" layout="row" layout-align="start center" ng-if="message.direction == \'in\' && message.originCc && message.originCc.indexOf(vm.account.email) >= 0">\n                    <em><span class="blue-grey" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are\n                        registered as a</span> <span class="blue-grey">CC</span></em>\n                  </div>\n                  <div class="name padding-top-10" layout="row" layout-align="start center" ng-if="message.direction == \'in\' && message.bcc && message.bcc.indexOf(vm.account.email) >= 0">\n                    <em><span class="red-fg" translate="MAIL.YOU_ARE_REGISTERED_AS_A">You are\n                        registered as a</span> <span class="red-fg">BCC</span></em>\n                  </div>\n                </div>\n              </div>\n\n              <a class="toggle-details md-accent-color" ng-hide="vm.selectedMailShowDetails[message.id]" ng-click="vm.selectedMailShowDetails[message.id] = !vm.selectedMailShowDetails[message.id]" translate="MAIL.SHOW_DETAILS">\n                Show Details\n              </a>\n              <a class="toggle-details md-accent-color" ng-show="vm.selectedMailShowDetails[message.id]" ng-click="vm.selectedMailShowDetails[message.id] = !vm.selectedMailShowDetails[message.id]" translate="MAIL.HIDE_DETAILS">\n                Hide Details\n              </a>\n              <div ng-show="vm.selectedMailShowDetails[message.id]" class="details" layout="row" layout-align="start start">\n                <div layout="column">\n                  <span class="title" translate="MAIL.DATE">Date:</span>\n                  <span class="title" translate="MAIL.FROM">From:</span>\n                  <span class="title" translate="MAIL.TO">To:</span>\n                  \x3c!-- NOTE: Start retrocompatibility with replyCc 2.0.66 --\x3e\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'in\' && message.originCc">Cc:</span>\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc">Cc:</span>\n                  <span class="title" translate="MAIL.CC" ng-if="message.direction === \'out\' && message.cc">Cc:</span>\n                  \x3c!-- End retrocompatibility --\x3e\n                  <span class="title" translate="MAIL.BCC" ng-if="message.bcc">Bcc:</span>\n                  <span class="title" translate="MAIL.ACCEPTED" ng-if="message.UserId && message.direction ===\'in\'">Accepted:</span>\n                </div>\n\n                <div layout="column">\n                  <span class="detail">{{message.createdAt | date:\'medium\'}}</span>\n                  <span class="detail" privacy ng-cloak>{{message.from}}</span>\n                  <span class="detail" privacy ng-cloak>{{message.originTo || message.to}}</span>\n                  \x3c!-- NOTE: Start retrocompatibility with replyCc 2.0.66 --\x3e\n                  <span class="detail" ng-if="message.direction === \'in\' && message.originCc" privacy ng-cloak>{{\n                    message.originCc }}</span>\n                  <span class="detail" ng-if="message.direction === \'in\' && !message.originCc && !message.originTo && message.cc" privacy ng-cloak>{{ message.cc }}</span>\n                  <span class="detail" ng-if="message.direction === \'out\' && message.cc" privacy ng-cloak>{{ message.cc\n                    }}</span>\n                  \x3c!-- End retrocompatibility --\x3e\n                  <span class="detail" ng-if="message.bcc" privacy ng-cloak>{{message.bcc}}</span>\n                  <span class="detail" ng-if="message.UserId && message.direction ===\'in\'">{{vm.usersMap[message.UserId]}}</span>\n                </div>\n              </div>\n            </div>\n\n            <div layout="row" layout-align="center center">\n              <div layout="column" layout-align="center end" class="md-padding">\n                <span class="grey-fg" ng-if="message.direction ===\'in\'" privacy>{{message.from.indexOf(vm.contact.email)\n                  >= 0 ? vm.contact.firstName + \' \' + vm.contact.lastName : \'*\' + message.from}}</span>\n                <span class="grey-fg" ng-if="message.direction ===\'out\' && message.UserId">{{vm.agent.fullname ||\n                  vm.usersMap[message.UserId]}}</span>\n                <span class="grey-fg" ng-if="message.direction ===\'out\' && !message.UserId">System</span>\n                <span class="grey-fg">{{message.createdAt | date:\'medium\'}}</span>\n              </div>\n              <img ng-if="message.direction ===\'in\'" ng-src="assets/images/avatars/customer.png" class="avatar" alt="customer" />\n              <img ng-if="message.direction ===\'out\' && message.UserId" class="avatar" ng-src="api/users/{{message.UserId}}/avatar">\n              <img ng-if="message.direction ===\'out\' && !message.UserId" class="avatar" src="assets/images/avatars/robot.png">\n            </div>\n          </div>\n\n          <div layout="row" layout-align="center center" layout-fill>\n            <div flex>\n              <md-divider></md-divider>\n            </div>\n            <div>\n              <div class="interaction-reply-button-container">\n                <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DRAFT">Draft</span>\n                </md-tooltip>\n                <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="draft" ng-disabled="!vm.draft" ng-click="vm.openDraft(message.id)">\n                  <md-icon md-font-icon="icon-pencil-box" class="icon s24"></md-icon>\n                </md-button>\n              </div>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeMailInteraction(\'reply\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY">Reply</span></md-tooltip>\n                <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="replyAll" ng-click="vm.composeMailInteraction(\'replyAll\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY_ALL">Reply All</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-reply-all" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="forward" ng-click="vm.composeMailInteraction(\'forward\', message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.FORWARD">Forward</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-forward" class="icon s24"></md-icon>\n              </md-button>\n              <md-button ng-if="!message.attach && vm.downloadPermissions.interactions" class="md-icon-button" aria-label="forward" ng-click="vm.downloadMessage(message)">\n                <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span>\n                </md-tooltip>\n                <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n              </md-button>\n              <md-menu ng-if="message.attach && vm.downloadPermissions.interactions" class="no-margin" md-position-mode="target-right target">\n                <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="download">\n                  <md-tooltip md-direction="bottom"><span translate="MAIL.DOWNLOAD">Download</span>\n                  </md-tooltip>\n                  <md-icon md-font-icon="icon-download"></md-icon>\n                </md-button>\n                <md-menu-content width="2">\n                  <md-menu-item ng-if="vm.downloadPermissions.attachments">\n                    <md-button ng-click="vm.downloadMessage(message, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                      Download with attachments\n                    </md-button>\n                  </md-menu-item>\n                  <md-menu-item>\n                    <md-button ng-click="vm.downloadMessage(message)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                      Download without attachments\n                    </md-button>\n                  </md-menu-item>\n                </md-menu-content>\n              </md-menu>\n              <md-menu ng-if="message.attach && vm.downloadPermissions.attachments">\n                <md-button aria-label="attachments" class="md-icon-button" ng-click="vm.getAttachments(message); $mdOpenMenu($event);">\n                  <md-tooltip md-direction="bottom"><span translate="MAIL.ATTACHMENTS">Attachments</span></md-tooltip>\n                  <div layout="row" layout-align="start center">\n                    <md-icon md-font-icon="icon-paperclip" class="icon s24"></md-icon>\n                    <span>{{message.attach}}</span>\n                  </div>\n                </md-button>\n                <md-menu-content width="4">\n                  <div layout="column" layout-align="center center" ng-if="!message.attachments">\n                    <md-progress-circular md-mode="indeterminate"></md-progress-circular>\n                    <span translate="MAIL.ATTACHMENTS">Attachments</span>\n                  </div>\n                  <md-menu-item ng-if="message.attachments" ng-repeat="attachment in message.attachments">\n                    <md-button ng-click="vm.getAttachment(attachment)">\n                      {{ attachment.name || (\'attachment-\' + $index) }}</md-button>\n                  </md-menu-item>\n                </md-menu-content>\n              </md-menu>\n            </div>\n            <div flex>\n              <md-divider></md-divider>\n            </div>\n          </div>\n\n          <md-content ng-bind-html-unsafe="message.body"></md-content>\n        </md-content>\n      </md-card>\n    </div>\n    <div ng-hide="!(vm.BTNLoadMore > 0)" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row">\n      <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-disabled="!(vm.BTNLoadMore > 0)" ng-click="vm.loadNextPage()" translate="DASHBOARDS.MORE">\n      </md-button>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.loading.html",'<div class="big-circle md-whiteframe-4dp">\n  <md-icon class="s128 md-accent" md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n</div>\n<span class="app-title" translate="DASHBOARDS.WAITING">Waiting</span>\n<span class="hide show-gt-md secondary-text" translate="DASHBOARDS.LOADING_INTERACTION">We are loading the\n  interaction...</span>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.chat.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeChatInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="CHAT.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.fax.html",'<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeFaxInteraction(\'new\')">\n  <md-tooltip md-direction="bottom"><span translate="FAX.REPLY">Reply</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.html",'<div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n  <md-icon md-font-icon="{{vm.getIconByChannel(vm.tab.channel)}}" class="s20" ng-class="vm.getColorByChannel(vm.tab.channel) + \'-fg\'"></md-icon>\n  <div class="padding-left-10" layout="column" layout-align="center start" flex>\n    <div class="font-size-14" layout="row" layout-align="start center" layout-fill>\n      <span>#{{vm.interaction.id}} - {{vm.account.key}}</span>\n      <div layout="row" layout-align="center center" class="p-8">\n        <md-icon ng-if="vm.tab.channel === \'openchannel\' && vm.interaction.threadId" md-font-icon="fas fa-users" class="s16">\n          <md-tooltip><span translate="DASHBOARDS.PUBLIC_INTERACTION">The interaction is public</span></md-tooltip>\n        </md-icon>\n        <md-icon ng-if="vm.interaction.attach" md-font-icon="icon-paperclip" class="s16"></md-icon>\n      </div>\n      <span class="red-fg padding-left-25" ng-if="vm.interaction.closed" translate="DASHBOARDS.CLOSED">CLOSED</span>\n      <span class="green-fg padding-left-25" ng-if="!vm.interaction.closed"><span translate="DASHBOARDS.OPENED">OPENED</span><span ng-if="vm.interaction.substatus"> -\n          {{vm.interaction.substatus}}</span></span>\n      <div layout="row" layout-align="center center" class="blue-grey-300-fg padding-left-40" ng-if="!vm.interaction.closed">\n        <timer start-time="vm.interaction.createdAt"></timer>\n        <md-icon md-font-icon="icon-timelapse" class="s16 padding-left-5"></md-icon>\n      </div>\n    </div>\n    <div class="tags" layout="row" layout-align="start center" ng-if="vm.interaction.Tags.length" ng-class="{\'padding-top-5\': vm.interaction.Tags.length}">\n      <div class="tag margin-right-5" layout="row" layout-align="center center" ng-repeat="tag in vm.interaction.Tags">\n        <div class="tag-color" ng-style="{\'background\': tag.color}"></div>\n        <div class="tag-label">{{tag.name}}</div>\n      </div>\n    </div>\n  </div>\n  <div layout="row" layout-align="end center">\n    <div ng-switch="vm.tab.channel">\n      <div ng-switch-when="mail">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.mail.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="fax">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.fax.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="sms">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.sms.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="whatsapp">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.whatsapp.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="chat">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.chat.html\'">\n        </div>\n      </div>\n      <div ng-switch-when="openchannel">\n        <div ng-include="\'app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.openchannel.html\'">\n        </div>\n      </div>\n    </div>\n    <md-menu ng-if="[\'fax\', \'sms\', \'whatsapp\'].indexOf(vm.tab.channel) < 0 && vm.downloadPermissions.interactions" class="no-margin" md-position-mode="target-right target">\n      <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="download">\n        <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n        <md-icon md-font-icon="icon-download"></md-icon>\n      </md-button>\n      <md-menu-content width="2">\n        <md-menu-item ng-if="vm.downloadPermissions.attachments">\n          <md-button ng-click="vm.downloadInteraction(vm.interaction, true)" translate="DASHBOARDS.DOWNLOAD_WITH_ATTACHMENTS">\n            Download with attachments\n          </md-button>\n        </md-menu-item>\n        <md-menu-item>\n          <md-button ng-click="vm.downloadInteraction(vm.interaction)" translate="DASHBOARDS.DOWNLOAD_WITHOUT_ATTACHMENTS">\n            Download without attachments\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n    <md-menu class="no-margin" ng-if="!vm.interaction.disposition" md-position-mode="target-right target">\n      <md-button class="md-icon-button" ng-click="$mdOpenMenu()" aria-label="more">\n        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n      </md-button>\n\n      <md-menu-content width="2">\n\n        <md-menu-item ng-if="vm.tab.channel === \'chat\' && !vm.interaction.closed && !vm.tab.spy && vm.account.vidaooEscalation && vm.account.vidaooApiKey">\n          <md-button ng-click="vm.createVidaooSession(vm.interaction)" translate="DASHBOARDS.VIDAOOSESSION">\n            Start Video Call\n          </md-button>\n        </md-menu-item>\n\n        <md-menu-item>\n          <md-button ng-click="vm.tagInteraction()" translate="DASHBOARDS.TAG">\n            Tag\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="vm.account.queueTransfer || vm.account.agentTransfer">\n          <md-button ng-click="vm.transferLastMessage()" translate="DASHBOARDS.TRANSFER">\n            Transfer\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.interaction.closed && vm.tab.channel == \'mail\' && (vm.subStatuses.rows.length || vm.interaction.substatus != null)">\n          <md-menu>\n            <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.SET_AS">\n              Set as\n            </md-button>\n            <md-menu-content>\n              <md-menu-item ng-if="vm.interaction.substatus != null">\n                <md-button ng-click="vm.setAs(null)" translate="DASHBOARDS.NONE">\n                  None\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-repeat="subStatus in vm.subStatuses.rows">\n                <md-button ng-click="vm.setAs(subStatus.name)">\n                  {{subStatus.name}}\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.interaction.closed && vm.tab.channel == \'mail\' && vm.account.markAsUnread">\n          <md-button ng-click="vm.markAsUnread()" translate="DASHBOARDS.MARK_AS_UNREAD">\n            Unread\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.tab.spy && !vm.interaction.closed">\n          <md-button ng-click="vm.disposeInteraction()" translate="DASHBOARDS.CLOSE_AND_DISPOSE">\n            Close and Dispose\n          </md-button>\n        </md-menu-item>\n        <md-menu-item ng-if="!vm.tab.spy && vm.interaction.closed && !vm.interaction.disposition">\n          <md-button ng-click="vm.disposeInteraction(ev)" translate="DASHBOARDS.DISPOSE">\n            Dispose\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.mail.html",'<div class="interaction-reply-button-container">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DRAFT">Draft</span></md-tooltip>\n  <md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="draft" ng-disabled="!vm.draft" ng-click="vm.openDraft()">\n    <md-icon ng-cloak md-font-icon="icon-pencil-box" class="icon s24" ng-class="vm.draft ? \'red-500-fg\' : \'grey-fg\'"></md-icon>\n  </md-button>\n</div>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="reply" ng-click="vm.composeMailInteraction(\'reply\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY">Reply</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply" class="icon s24"></md-icon>\n</md-button>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="replyAll" ng-click="vm.composeMailInteraction(\'replyAll\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.REPLY_ALL">Reply All</span></md-tooltip>\n  <md-icon md-font-icon="icon-reply-all" class="icon s24"></md-icon>\n</md-button>\n<md-button ng-if="!vm.interaction.closed && !vm.tab.spy" class="md-icon-button" aria-label="forward" ng-click="vm.composeMailInteraction(\'forward\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.FORWARD">Forward</span></md-tooltip>\n  <md-icon md-font-icon="icon-forward" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeMailInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="MAIL.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.openchannel.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeOpenchannelInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="OPENCHANNEL.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.sms.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeSmsInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="SMS.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/interaction/views/agent.general.toolbar.whatsapp.html",'<md-button class="md-icon-button" aria-label="note" ng-click="vm.composeWhatsappInteraction(\'note\', vm.interaction)">\n  <md-tooltip md-direction="bottom"><span translate="WHATSAPP.NOTE">Note</span></md-tooltip>\n  <md-icon md-font-icon="icon-note-outline" class="icon s24"></md-icon>\n</md-button>\n<md-button class="md-icon-button" aria-label="Download" ng-click="vm.downloadInteraction(vm.interaction)" ng-if="vm.downloadPermissions.interactions">\n  <md-tooltip md-direction="bottom"><span translate="DASHBOARDS.DOWNLOAD">Download</span></md-tooltip>\n  <md-icon md-font-icon="icon-download" class="icon s24"></md-icon>\n</md-button>'),e.put("app/main/apps/dashboards/views/general/agent/jscripty/agent.general.jscripty.html",'<md-content class="md-padding" layout="column" layout-align="center center">\n  <div layout="row" layout-align="center center">\n    <span ng-if="!vm.tab.saved" class="text-boxed md-green-bg">\n      <timer start-time="vm.starttime"></timer>\n    </span>\n    <span ng-if="vm.contact" class="text-boxed md-gray-bg font-weight-900">{{vm.contact.firstName}} {{vm.contact.lastName}} {{vm.contact.phone}}</span>\n    <md-button ng-if="vm.showResetButton" ng-click="vm.resetViewer()" md-no-ink class="md-raised md-accent orange-bg">\n      <md-icon md-font-icon="icon-rotate-left" class="icon s16"></md-icon> {{\'JSCRIPTY.RESET_SESSION\' | translate}}\n    </md-button>\n    <md-button ng-if="vm.contact" ng-click="vm.openContact($event, vm.contact)" md-no-ink class="md-raised md-accent" translate="JSCRIPTY.OPEN_CONTACT"></md-button>\n    <md-button ng-if="vm.showIncompleteSubmitButton" ng-click="vm.onSubmit($event, true)" md-no-ink class="md-raised md-accent green-bg" translate="JSCRIPTY.SUBMIT"></md-button>\n  </div>\n  <h1 ng-if="!vm.project.formData"><span translate="JSCRIPTY.PROJECT_NOT_AVAILABLE">Project is not available. Please contact the administrator</span></h1>\n  <mw-form-viewer ng-if="vm.project.formData" form-data="vm.project.formData" response-data="vm.project.responseData" on-submit="vm.onSubmit($event)" template-data="call" api="vm.formViewer"></mw-form-viewer>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/agent/notification/dialog.html",'\x3c!-- <md-toast> --\x3e\n<div class="md-padding" layout="column" layout-align="center center">\n  <span class="md-title">#{{vm.notification.id}} {{vm.notification.title}}</span>\n  <span class="md-subhead" ng-if="vm.notification.queue">{{vm.notification.queue}}</span>\n  <div class="padding-top-5" layout="row">\n    <md-button class="md-raised md-accent" ng-click="vm.accept($event)" translate="DASHBOARDS.ACCEPT">\n      ACCEPT\n    </md-button>\n    <md-button class="md-raised md-warn" ng-click="vm.reject($event)" translate="DASHBOARDS.REJECT">\n      REJECT\n    </md-button>\n  </div>\n</div>\n\x3c!-- </md-toast> --\x3e'),e.put("app/main/apps/dashboards/views/general/agent/popup/agent.general.popup.html",'<md-content class="md-padding" flex>\n  <div ng-if="vm.html" ng-bind-html="vm.html"></div>\n  <h1 ng-if="!vm.html">Template is empty. Please contact the administrator</h1>\n</md-content>'),e.put("app/main/apps/dashboards/views/general/user/chat/user.general.chat.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-hangouts" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.abandoned || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDONED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_MANAGED_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_MANAGED_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_MANAGED_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ABANDONED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.ABANDONED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDONED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/dialer/user.general.dialer.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_MOTION_BULL_STATS">Today Motion Bull STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timelapse"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{(vm.inbound.talking || 0) + (vm.inbound.pTalking || 0)}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TALKING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TALKING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TALKING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-missed"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.outboundDropCallsDayCallersExit || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-outgoing"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.outboundDropCallsDayTimeout || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.DROPPED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.DROPPED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.DROPPED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.originated || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ORIGINATED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.ORIGINATED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ORIGINATED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_TALK_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundanswerRate || 0 |number : 1}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundAbandonRate || 0}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDON_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDON_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.outboundDropRate }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.DROP_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.DROP_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.DROP_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET OUTBOUND --\x3e\n\n\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_IVR_CAMPAIGNS_STATS">Today IVR campaigns stats</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.ivr.originated || 0}}/{{vm.ivr.limitCalls || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.ORIGINATED\' | translate | uppercase}}/{{\'DASHBOARDS.LIMITED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.LIMITED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ORIGINATEDLIMITED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET IVR --\x3e'),e.put("app/main/apps/dashboards/views/general/user/fax/user.general.fax.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-deskphone" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/mail/user.general.mail.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-email" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/openchannel/user.general.openchannel.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-google-earth" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/sms/user.general.sms.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-message-text" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/user.general.html",'<div id="dashboard-general" ng-init="vm.onInit()" class="page-layout simple right-sidenav" layout="row">\n  \x3c!-- CENTER --\x3e\n  <div class="center" flex>\n    \x3c!-- CONTENT --\x3e\n    <div class="content">\n      <md-tabs ng-if="vm.hasDashboardPermissions" md-selected="vm.selectedTab" md-dynamic-height>\n        <md-tab ng-if="vm.license.voice" label="{{\'DASHBOARDS.VOICE\' | translate}}" ui-sref="app.dashboards.general.voice">\n          <div ui-view="voice"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.dialer" label="{{\'DASHBOARDS.MOTIONDIALER\' | translate}}" ui-sref="app.dashboards.general.dialer">\n          <div ui-view="dialer"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.chat" label="{{\'DASHBOARDS.CHAT\' | translate}}" ui-sref="app.dashboards.general.chat">\n          <div ui-view="chat"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.mail" label="{{\'DASHBOARDS.MAIL\' | translate}}" ui-sref="app.dashboards.general.mail">\n          <div ui-view="mail"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.messaging" label="{{\'DASHBOARDS.SMS\' | translate}}" ui-sref="app.dashboards.general.sms">\n          <div ui-view="sms"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.openchannel" label="{{\'DASHBOARDS.OPENCHANNEL\' | translate}}" ui-sref="app.dashboards.general.openchannel">\n          <div ui-view="openchannel"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.fax" label="{{\'DASHBOARDS.FAX\' | translate}}" ui-sref="app.dashboards.general.fax">\n          <div ui-view="fax"></div>\n        </md-tab>\n        <md-tab ng-if="vm.license.whatsapp" label="{{\'DASHBOARDS.WHATSAPP\' | translate}}" ui-sref="app.dashboards.general.whatsapp">\n          <div ui-view="whatsapp"></div>\n        </md-tab>\n      </md-tabs>\n    </div>\n    \x3c!-- END CONTENT --\x3e\n\n    <md-content ng-if="!vm.hasDashboardPermissions" layout="row" layout-align="space-around center" flex layout-padding layout-wrap>\n      <div layout="column" layout-align="space-around center" flex="50">\n        <span class="font-size-40 text-center">{{ \'DASHBOARDS.WELCOME_TO_MOTION\' | translate }}!</span>\n        <span class="font-size-30 text-center" translate="DASHBOARDS.WELCOME_MESSAGE">Use the left sidebar to\n          navigate through available sections.</span>\n      </div>\n\n      <div layout="column" flex="50">\n        <img src="assets/images/avatars/permissions.png" alt="permissions">\n      </div>\n    </md-content>\n  </div>\n</div>'),e.put("app/main/apps/dashboards/views/general/user/voice/user.general.voice.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-incoming" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INBOUND_STATS">Today Inbound STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timelapse"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TALKING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TALKING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TALKING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-missed"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-52 line-height-72">\n            {{vm.inbound.abandoned || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDONED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDONED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ABANDONED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-incoming"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-timer-sand"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-in-talk"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgTalkTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_AVG_TALK_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_AVG_TALK_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_ABANDON_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_ABANDON_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.ABANDON_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-dots"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.VOICE_UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.VOICE_UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.VOICE_UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e\n\n\x3c!-- WIDGET OUTBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-phone-outgoing" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_OUTBOUND_STATS">Today Outbound STATS</div>\n  </div>\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone-outgoing"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.outbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.outbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OUTBOUND_ANSWERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.OUTBOUND_ANSWERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OUTBOUND_ANSWERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-clock"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-42 line-height-72">\n            {{vm.outbound.sumDuration || 0 | secToTime | date:\'HH:mm:ss\'}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOT_DURATION\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.TOT_DURATION_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOT_DURATION\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-division"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{vm.outbound.total ? ((vm.outbound.sumDuration / vm.outbound.total) | number: 0) : 0 | secToTime | date:\'HH:mm:ss\'}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_DURATION\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_DURATION_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_DURATION\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-button style="cursor:auto" class="md-icon-button" aria-label="more">\n            <md-icon md-font-icon="icon-percent"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-42 line-height-72">\n            {{vm.outbound.total ? (vm.outbound.answered / vm.outbound.total * 100) : 0 | number: 1}}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OUTBOUND_ANSWER_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.OUTBOUND_ANSWER_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OUTBOUND_ANSWER_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET OUTBOUND --\x3e'),e.put("app/main/apps/dashboards/views/general/user/whatsapp/user.general.whatsapp.html",'\x3c!-- WIDGET INBOUND --\x3e\n<div class="dashboard-container md-background-bg md-whiteframe-1dp">\n  <div class="pb-16" layout="row" layout-align="start center">\n    <md-icon md-font-icon="icon-whatsapp" class="m-0 mr-16"></md-icon>\n    <div class="h2 secondary-text" translate="DASHBOARDS.TODAY_INTERACTIONS_STATS">Today Interactions STATS</div>\n  </div>\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-52 line-height-72">\n            {{vm.inbound.waiting || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.WAITING\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.WAITING_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.WAITING\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n    \x3c!-- WIDGET 3 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="orange-fg font-size-52 line-height-72">\n            {{vm.inbound.talking || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.OPENED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 orange-fg secondary-text text-truncate">{{\'DASHBOARDS.OPENED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.OPENED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 3 --\x3e\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-52 line-height-72">\n            {{vm.inbound.answered || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.unmanaged || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-green-fg font-size-52 line-height-72">\n            {{vm.inbound.total || 0}}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.TOTAL_OFFERED\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-green-fg secondary-text text-truncate">{{\'DASHBOARDS.TOTAL_OFFERED_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.TOTAL_OFFERED\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n\n  \x3c!-- WIDGET GROUP --\x3e\n  <div class="widget-group" layout="row" flex="100" layout-wrap>\n    \x3c!-- WIDGET 1 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="50">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="light-blue-fg font-size-42 line-height-72">\n            {{ vm.inbound.avgHoldTime || \'00:00:00\' }}\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.AVG_HOLD_TIME\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 light-blue-fg secondary-text text-truncate">{{\'DASHBOARDS.AVG_HOLD_TIME_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.AVG_HOLD_TIME\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 1 --\x3e\n\n\n    \x3c!-- WIDGET 2 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="ph-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="red-fg font-size-42 line-height-72">\n            {{ vm.inbound.answerRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.MANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 red-fg secondary-text text-truncate">{{\'DASHBOARDS.MANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.MANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 2 --\x3e\n\n    \x3c!-- WIDGET 4 --\x3e\n    <ms-widget flippable="true" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n      \x3c!-- Front --\x3e\n      <ms-widget-front class="grey-50-bg">\n        <div class="pl-16 pr-8 pv-16 h-55" layout="row" layout-align="space-between center">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="more">\n            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n        </div>\n\n        <div class="pt-8 pb-32" layout="column" layout-align="center center">\n          <div class="blue-grey-fg font-size-42 line-height-72">\n            {{ vm.inbound.abandonRate || 0 }}%\n          </div>\n          <div class="h3 secondary-text font-weight-500">{{\'DASHBOARDS.UNMANAGED_RATE\' | translate | uppercase}}</div>\n        </div>\n\n        <div class="p-16 grey-200-bg text-center border-top" layout-align="start center">\n          <span class="h6 blue-grey-fg secondary-text text-truncate">{{\'DASHBOARDS.UNMANAGED_RATE_TEXT\' | translate | uppercase}}</span>\n        </div>\n      </ms-widget-front>\n      \x3c!-- / Front --\x3e\n\n      \x3c!-- Back --\x3e\n      <ms-widget-back class="p-16 grey-50-bg">\n        <div class="flip-to-front">\n          <md-button class="md-icon-button" ng-click="flipWidget()" aria-label="Flip widget">\n            <md-icon md-font-icon="icon-close" class="s16"></md-icon>\n          </md-button>\n        </div>\n\n        <div>\n          {{\'DASHBOARDS.HELP.UNMANAGED_RATE\' | translate}}\n        </div>\n      </ms-widget-back>\n      \x3c!-- / Back --\x3e\n\n    </ms-widget>\n    \x3c!-- / WIDGET 4 --\x3e\n\n\n  </div>\n  \x3c!-- / WIDGET GROUP --\x3e\n</div>\n\x3c!-- / WIDGET INBOUND --\x3e'),e.put("app/main/apps/fax/views/faxAccounts/create/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.faxAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="faxAccountForm[\'name\'].$error" ng-show="faxAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.faxAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="faxAccountForm[\'key\'].$error" ng-show="faxAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="FAX.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TRUNK">trunk</label>\n        <md-select name="TrunkId" ng-model="vm.faxAccount.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountForm[\'TrunkId\'].$error" ng-show="faxAccountForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TRUNK_REQUIRED">trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.LOCALSTATIONID">localstationid</label>\n        <input type="text" name="localstationid" ng-model="vm.faxAccount.localstationid" ng-required="true">\n\n        <div class="hint"><span translate="FAX.HELP.LOCALSTATIONID"></span></div>\n        <div ng-messages="faxAccountForm[\'localstationid\'].$error" ng-show="faxAccountForm[\'localstationid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.LOCALSTATIONID_REQUIRED">localstationid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.faxAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountForm[\'ListId\'].$error" ng-show="faxAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.faxAccount.description">\n\n        <div ng-messages="faxAccountForm[\'description\'].$error" ng-show="faxAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFaxAccount" ng-click="vm.saveFaxAccount()" class="send-button md-accent md-raised" ng-disabled="faxAccountForm.$invalid || faxAccountForm.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFaxAccount" ng-click="vm.addNewFaxAccount()" class="send-button md-accent md-raised" ng-disabled="faxAccountForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXACCOUNT" translate-attr-aria-label="FAX.ADD_FAXACCOUNT">\n          ADD FAXACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxAccount" ng-click="vm.deleteFaxAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="FAX.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="FAX.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/agentadd/agentadd.html",'<md-dialog class="faxAccount-dialog" aria-label="faxAccount" ng-init="vm.onInit()">\n  <form name="faxAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.AGENTADD_FAXACCOUNT">Add Agent to faxAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/agent/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'agent\'].$error" ng-show="faxAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'timeout\'].$error" ng-show="faxAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/close/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'disposition\'].$error" ng-show="faxAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'condition\'].$error" ng-show="faxAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'truepriority\'].$error" ng-show="faxAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'falsepriority\'].$error" ng-show="faxAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'priority\'].$error" ng-show="faxAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/noop/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'value\'].$error" ng-show="faxAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/queue/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'queue\'].$error" ng-show="faxAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'timeout\'].$error" ng-show="faxAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/system/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="faxAccountFormApp[\'command\'].$error" ng-show="faxAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'variable\'].$error" ng-show="faxAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/apps/tag/dialog.html",'<md-dialog class="faxAccount-dialog" aria-label="New FaxAccount">\n  <form name="faxAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="faxAccountFormApp[\'tag\'].$error" ng-show="faxAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveFaxAccountApp()" class="send-button md-accent md-raised" ng-disabled="faxAccountFormApp.$invalid || faxAccountFormApp.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxAccounts/edit/view.html",'<div id="fax-faxAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-faxAccounts-button md-icon-button" aria-label="Go to faxAccounts" ng-click="vm.gotoFaxAccounts()" translate translate-attr-aria-label="FAX.GO_TO_FAXACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="faxAccount-image" hide-xs>\n          <img ng-src="assets/images/business/faxAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.faxAccount.id}}\n            <span ng-if="vm.faxAccount.name">{{vm.faxAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="FAX.CREATED_AT"></span> <span>{{vm.faxAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.faxAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="FAX.GOTO_FAXACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.faxAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="FAX.AGENTADD_FAXACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFaxAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (advancedForm.$invalid) || (dispositionForm.$invalid) || (faxDispositionsForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.faxAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.faxAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="FAX.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.HEADERINFO">headerinfo</label>\n                <input type="text" name="headerinfo" ng-model="vm.faxAccount.headerinfo" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.HEADERINFO"></span></div>\n                <div ng-messages="generalForm[\'headerinfo\'].$error" ng-show="generalForm[\'headerinfo\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.HEADERINFO_REQUIRED">headerinfo field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.TRUNK">trunk</label>\n                <md-select name="TrunkId" ng-model="vm.faxAccount.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.TRUNK_REQUIRED">trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.LOCALSTATIONID">localstationid</label>\n                <input type="text" name="localstationid" ng-model="vm.faxAccount.localstationid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.LOCALSTATIONID"></span></div>\n                <div ng-messages="generalForm[\'localstationid\'].$error" ng-show="generalForm[\'localstationid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.LOCALSTATIONID_REQUIRED">localstationid field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.faxAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.faxAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.faxAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="FAX.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.faxAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="FAX.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.faxAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.queueTransfer == true" class="md-block">\n                <label translate="FAX.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.faxAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.agentTransfer == true" class="md-block">\n                <label translate="FAX.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.faxAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.ECM">ECM</label>\n                <md-select name="ecm" ng-model="vm.faxAccount.ecm" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.ECM"></span></div>\n                <div ng-messages="advancedForm[\'ecm\'].$error" ng-show="advancedForm[\'ecm\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.ECM_REQUIRED">ECM field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MINRATE">minrate</label>\n                <md-select name="minrate" ng-model="vm.faxAccount.minrate" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'2400\'">2400</md-option>\n                  <md-option ng-value="\'4800\'">4800</md-option>\n                  <md-option ng-value="\'7200\'">7200</md-option>\n                  <md-option ng-value="\'9600\'">9600</md-option>\n                  <md-option ng-value="\'12000\'">12000</md-option>\n                  <md-option ng-value="\'14400\'">14400</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MINRATE"></span></div>\n                <div ng-messages="advancedForm[\'minrate\'].$error" ng-show="advancedForm[\'minrate\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MINRATE_REQUIRED">minrate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MAXRATE">maxrate</label>\n                <md-select name="maxrate" ng-model="vm.faxAccount.maxrate" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'2400\'">2400</md-option>\n                  <md-option ng-value="\'4800\'">4800</md-option>\n                  <md-option ng-value="\'7200\'">7200</md-option>\n                  <md-option ng-value="\'9600\'">9600</md-option>\n                  <md-option ng-value="\'12000\'">12000</md-option>\n                  <md-option ng-value="\'14400\'">14400</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MAXRATE"></span></div>\n                <div ng-messages="advancedForm[\'maxrate\'].$error" ng-show="advancedForm[\'maxrate\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MAXRATE_REQUIRED">maxrate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.MODEM">modem</label>\n                <input type="text" name="modem" ng-model="vm.faxAccount.modem" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.MODEM"></span></div>\n                <div ng-messages="advancedForm[\'modem\'].$error" ng-show="advancedForm[\'modem\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MODEM_REQUIRED">modem field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.GATEWAY">gateway</label>\n                <input type="text" name="gateway" ng-model="vm.faxAccount.gateway" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.GATEWAY"></span></div>\n                <div ng-messages="advancedForm[\'gateway\'].$error" ng-show="advancedForm[\'gateway\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.GATEWAY_REQUIRED">gateway field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.FAXDETECT">faxdetect</label>\n                <input type="text" name="faxdetect" ng-model="vm.faxAccount.faxdetect" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.FAXDETECT"></span></div>\n                <div ng-messages="advancedForm[\'faxdetect\'].$error" ng-show="advancedForm[\'faxdetect\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.FAXDETECT_REQUIRED">faxdetect field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.T38TIMEOUT">t38timeout</label>\n                <input type="number" name="t38timeout" ng-model="vm.faxAccount.t38timeout" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="FAX.HELP.T38TIMEOUT"></span></div>\n                <div ng-messages="advancedForm[\'t38timeout\'].$error" ng-show="advancedForm[\'t38timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.T38TIMEOUT_REQUIRED">t38timeout field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.SIP">SIP</label>\n                <md-select name="tech" ng-model="vm.faxAccount.tech" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'SIP\'">SIP</md-option>\n                  <md-option ng-value="\'IAX\'">IAX</md-option>\n                  <md-option ng-value="\'DADHI\'">DADHI</md-option>\n                  <md-option ng-value="\'KHOMP\'">KHOMP</md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'tech\'].$error" ng-show="advancedForm[\'tech\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.SIP_REQUIRED">SIP field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="faxAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.faxAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="FAX.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.faxAccount.mandatoryDisposition" class="md-block">\n                <label translate="FAX.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.faxAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="FAX.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="FaxAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="faxAccount-detail-form-container faxdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="FAX.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add fax dispositions" translate translate-attr-label="FAX.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="faxAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'FAX.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="FaxAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.faxAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="FAX.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedFaxAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedFaxAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedFaxAccountApps.length}} {{vm_ac.selectedFaxAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedFaxAccountApps($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedFaxAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.faxAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editFaxAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editFaxAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.faxAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="FaxAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.faxAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedFaxAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="FAX.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getFaxAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getFaxAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getFaxAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="FAX.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedFaxAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedFaxAccountInteractions.length}} {{vm_dc.selectedFaxAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedFaxAccountInteractions" csv-label="true" filename="faxAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedFaxAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedFaxAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getFaxAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'FAX.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'FAX.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'FAX.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'FAX.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'FAX.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'FAX.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'FAX.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.faxAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'FAX.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'FAX.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spyfaxInteraction($event, interaction)" translate="FAX.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.faxInteractionDownload(interaction, $event)" translate="FAX.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="FAX.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.faxAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="FAX.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.faxAccountInteractions.count}}" md-on-paginate="vm_dc.getFaxAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/fax/views/faxAccounts/faxAccounts.html",'<div id="faxAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-deskphone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="FAX.FAXACCOUNTS">FaxAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="FAX.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFaxAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFaxAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="FAX.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-faxAccounts-count">\n          <span>{{vm.selectedFaxAccounts.length}}</span>\n          <span translate="FAX.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="FAX.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFaxAccounts()" translate="FAX.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFaxAccounts()" translate="FAX.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFaxAccounts" csv-label="true" filename="faxAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFaxAccounts($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FAXACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFaxAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'FAX.KEY\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'FAX.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="localstationid">{{ \'FAX.LOCALSTATIONID\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'FAX.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.faxAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="faxAccount" md-select-id="id" ng-repeat="faxAccount in vm.faxAccounts.rows">\n                <td md-cell ng-if="faxAccount.userpic"><img class="avatar" alt="{{faxAccount.name}}" ng-src="api/users/{{faxAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!faxAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{faxAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="id ">{{faxAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="name ">{{faxAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="key ">{{faxAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':faxAccount.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="localstationid ">{{faxAccount.localstationid}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxAccount, ev) : vm.createOrEditFaxAccount($event, faxAccount)" md-cell class="description ">{{faxAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(faxAccount, $event    )" translate="FAX.EDIT_FAXACCOUNT">\n                          Edit FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(faxAccount, $event    )" translate="FAX.INTERACTIONS_FAXACCOUNT">\n                          Interactions FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(faxAccount, $event    )" translate="FAX.GOTOREALTIME_FAXACCOUNT">\n                          goToRealtime FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(faxAccount, $event    )" translate="FAX.AGENTADD_FAXACCOUNT">\n                          AgentAdd FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(faxAccount, $event    )" translate="FAX.DELETE_FAXACCOUNT">\n                          Delete FaxAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxAccounts.count}}" md-on-paginate="vm.getFaxAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FAXACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FAXACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-faxAccount-button" ng-click="vm.createOrEditFaxAccount($event)" aria-label="add faxAccount" translate translate-attr-aria-label="FAX.ADD_FAXACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FAXACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/fax/views/faxQueues/create/dialog.html",'<md-dialog class="faxQueue-dialog" aria-label="New FaxQueue">\n  <form name="faxQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="FAX.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.faxQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newFaxQueue">\n\n        <div class="hint"><span translate="FAX.HELP.NAME"></span></div>\n        <div ng-messages="faxQueueForm[\'name\'].$error" ng-show="faxQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="FAX.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.faxQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="faxQueueForm[\'strategy\'].$error" ng-show="faxQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.faxQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="faxQueueForm[\'timeout\'].$error" ng-show="faxQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="FAX.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.faxQueue.description">\n\n        <div ng-messages="faxQueueForm[\'description\'].$error" ng-show="faxQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFaxQueue" ng-click="vm.saveFaxQueue()" class="send-button md-accent md-raised" ng-disabled="faxQueueForm.$invalid || faxQueueForm.$pristine" aria-label="SAVE" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFaxQueue" ng-click="vm.addNewFaxQueue()" class="send-button md-accent md-raised" ng-disabled="faxQueueForm.$invalid" aria-label="ADD" translate="FAX.ADD_FAXQUEUE" translate-attr-aria-label="FAX.ADD_FAXQUEUE">\n          ADD FAXQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFaxQueue" ng-click="vm.deleteFaxQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="FAX.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="FAX.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/agentadd/agentadd.html",'<md-dialog class="faxQueue-dialog" aria-label="faxQueue" ng-init="vm.onInit()">\n  <form name="faxQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.AGENTADD_FAXQUEUE">Add Agent to faxQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/teamadd/teamadd.html",'<md-dialog class="faxQueue-dialog" aria-label="faxQueue" ng-init="vm.onInit()">\n  <form name="faxQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="FAX.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/fax/views/faxQueues/edit/view.html",'<div id="fax-faxQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-faxQueues-button md-icon-button" aria-label="Go to faxQueues" ng-click="vm.gotoFaxQueues()" translate translate-attr-aria-label="FAX.GO_TO_FAXQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="faxQueue-image" hide-xs>\n          <img ng-src="assets/images/business/faxQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.faxQueue.id}}\n            <span ng-if="vm.faxQueue.name">{{vm.faxQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="FAX.CREATED_AT"></span> <span>{{vm.faxQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.faxQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="FAX.TEAMADD_FAXQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.faxQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="FAX.AGENTADD_FAXQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFaxQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="FAX.SAVE" translate-attr-aria-label="FAX.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="faxQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="FAX.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="FAX.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.faxQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="FAX.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="FAX.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.faxQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.faxQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="FAX.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="FAX.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.faxQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="FAX.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/fax/views/faxQueues/faxQueues.html",'<div id="faxQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-deskphone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="FAX.FAXQUEUES">FaxQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="FAX.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFaxQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFaxQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="FAX.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-faxQueues-count">\n          <span>{{vm.selectedFaxQueues.length}}</span>\n          <span translate="FAX.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="FAX.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFaxQueues()" translate="FAX.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFaxQueues()" translate="FAX.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFaxQueues" csv-label="true" filename="faxQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFaxQueues($event)" aria-label="delete selected" translate translate-attr-label="FAX.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FAXQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFaxQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'FAX.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'FAX.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.faxQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="faxQueue" md-select-id="id" ng-repeat="faxQueue in vm.faxQueues.rows">\n                <td md-cell ng-if="faxQueue.userpic"><img class="avatar" alt="{{faxQueue.name}}" ng-src="api/users/{{faxQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!faxQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{faxQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="id ">{{faxQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="name ">{{faxQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(faxQueue, ev) : vm.createOrEditFaxQueue($event, faxQueue)" md-cell class="strategy ">{{ vm.arraystrategy[faxQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="FAX.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(faxQueue, $event    )" translate="FAX.EDIT_FAXQUEUE">\n                          Edit FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(faxQueue, $event    )" translate="FAX.TEAMADD_FAXQUEUE">\n                          teamadd FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(faxQueue, $event    )" translate="FAX.AGENTADD_FAXQUEUE">\n                          agentadd FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(faxQueue, $event    )" translate="FAX.DELETE_FAXQUEUE">\n                          Delete FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(faxQueue, $event    )" translate="FAX.GOTOREALTIME_FAXQUEUE">\n                          goToRealtime FaxQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxQueues.count}}" md-on-paginate="vm.getFaxQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FAXQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FAXQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-faxQueue-button" ng-click="vm.createOrEditFaxQueue($event)" aria-label="add faxQueue" translate translate-attr-aria-label="FAX.ADD_FAXQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FAXQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/fax/views/realtime/accounts/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.ACCOUNTS">Accounts</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.vm.getFaxAccounts()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- ACCOUNTS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFaxAccounts">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate}}</th>\n        <th md-column>{{\'FAX.KEY\' | translate}}</th>\n        <th md-column>{{\'FAX.TOTAL\' | translate}}</th>\n        <th md-column>{{\'FAX.IN\' | translate}}</th>\n        <th md-column>{{\'FAX.OUT\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.faxAccounts.count > 0">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="account" md-select-id="id" ng-repeat="account in vm.faxAccounts.rows">\n        <td md-cell>{{account.name}}</td>\n        <td md-cell>{{account.key}}</td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(account.in || 0) + (account.out || 0)}}</span>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-down-bold blue-fg"></md-icon>\n            </span>\n            <span class="md-capture blue-fg">{{account.in || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.in">{{account.lastIn ?  (account.lastIn | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-up-bold green-fg"></md-icon>\n            </span>\n            <span class="md-capture green-fg">{{account.out || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.out">{{account.lastOut ?  (account.lastOut | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-button ng-click="vm.goToFaxAccount($event, account)" translate="FAX.EDIT_ACCOUNT">\n                  Edit Account\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.faxAccounts.count}}" md-on-paginate="vm.getFaxAccounts" md-page-select></md-table-pagination>\n\x3c!-- / ACCOUNTS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/fax/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.TRUNKS">Trunks</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="FAX.ACCOUNTS">Accounts</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/fax/views/realtime/trunks/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="FAX.TRUNKS">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTrunks()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- TRUNKS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'FAX.NAME\' | translate }}</th>\n        <th md-column>{{ \'FAX.TRUNK_STATUS\' | translate }}</th>\n        <th md-column>{{ \'FAX.REGISTRY\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.trunks">\n        <td md-cell colspan="3">\n          <div layout="row" layout-align="center center">\n            <span translate="FAX.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, trunk) in vm.trunks">\n        <td md-cell>{{trunk.name}}</td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[trunk.status.toLowerCase()]">\n            <md-tooltip>{{\'FAX.\' + trunk.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.status === \'registered\'" class="text-boxed">{{trunk.address}}</span>\n        </td>\n        <td md-cell>\n          <i ng-if="trunk.registry" ng-class="(trunk.stateRegistry.toLowerCase() === \'registered\') ? \'green-300-fg icon-checkbox-marked-circle\' : \'red-300-fg icon-close-circle\'">\n            <md-tooltip>{{\'FAX.\' + trunk.stateRegistry | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.registry && trunk.host && trunk.port" class="text-boxed">{{trunk.host}}:{{trunk.port}}</span>\n          <span ng-if="!trunk.registry" translate="FAX.NO_REGISTRY">\n            No Registry\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item>\n                <md-button ng-click="vm.goToTrunk($event, trunk)" translate="FAX.EDIT_TRUNK">\n                  Edit Trunk\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'FAX.PAGE\' | translate}}:\', rowsPerPage: \'{{\'FAX.ROWSPERPAGE\' | translate}}:\', of: \'{{\'FAX.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n\x3c!-- / TRUNKS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/help/views/about/about.html",'<div id="maintenance" class="flex-scrollable" layout="column">\n  <div id="maintenance-form-wrapper" layout="column" layout-align="center center">\n    <div id="maintenance-form" class="md-whiteframe-8dp">\n      <div>\n        <img src="/api/settings/1/logo_login" alt="logo_login" />\n      </div>\n\n      <br>\n\n      <div>\n        <div class="info-line">\n          <div class="title">Useful pages</div>\n        </div>\n        <section layout="row" flex layout-sm="column" layout-align="center center" layout-wrap>\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button grey-bg" href="https://wiki.xcallymotion.com/display/XMV" target="_blank">\n              <md-icon md-font-icon="icon-wikipedia"></md-icon>\n            </a>\n            <div class="info"><a href="https://wiki.xcallymotion.com/display/XMV" target="_blank">Wiki</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button md-accent" href="/apidoc" target="_blank">\n              <md-icon md-font-icon="icon-apple-mobileme"></md-icon>\n            </a>\n            <div class="info"><a href="/apidoc" target="_blank">Motion API</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button orange-bg" href="http://www.xcally.com/bar/phonebar/Setup.msi" target="_blank">\n              <md-icon md-font-icon="icon-headphones"></md-icon>\n            </a>\n            <div class="info"><a href="https://www.xcally.com/bar/phonebar/Setup.msi" target="_blank">Phonebar Download</a></div>\n          </div>\n\n          <div layout="column" flex="25" layout-align="center center">\n            <a class="md-fab md-mini md-button green-bg" href="/demo" target="_blank">\n              <md-icon md-font-icon="icon-console"></md-icon>\n            </a>\n            <div class="info"><a href="/demo" target="_blank">Playground</a></div>\n          </div>\n\n        </section>\n\n        <br>\n\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="title">Follow us on</div>\n        </div>\n        <section ng-if="!vm.license.custom" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n          <a class="md-fab md-mini md-button blue-900-bg" href="https://www.facebook.com/xcallymotion" target="_blank">\n            <md-icon md-font-icon="icon-facebook"></md-icon>\n          </a>\n\n          <a class="md-fab md-mini md-button" href="https://twitter.com/xcallymotion" target="_blank">\n            <md-icon md-font-icon="icon-twitter"></md-icon>\n          </a>\n          <a class="md-fab md-mini md-button md-warn" href="https://plus.google.com/+Xcally" target="_blank">\n            <md-icon md-font-icon="icon-google-plus"></md-icon>\n          </a>\n          <a class="md-fab md-mini md-button light-blue-800-bg" href="https://www.linkedin.com/company/xcally" target="_blank">\n            <md-icon md-font-icon="icon-linkedin"></md-icon>\n          </a>\n        </section>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="title" translate="HELP.CONTACT_US">Contact Us</div>\n        </div>\n        <div class="info-line" ng-if="!vm.license.custom">\n          <div class="info"><a href="mailto:support@xcally.com" target="_top">support@xcally.com</a></div>\n        </div>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info">xCALLY Motion <u>{{vm.info.current}}</u> | <a href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.info.current}}" target="_blank">Changelog</a></div>\n\n        <br>\n\n        <div class="info" ng-if="!vm.license.custom">xCALLY© 2016 - 2018 | Powered by Xenialab | <a href="http://www.xcally.com/support/eula-xcally-license-en.pdf" target="_blank">EULA</a></div>\n\n        <br ng-if="!vm.license.custom">\n\n        <div class="info" ng-if="!vm.license.custom"><a href="https://www.xenialab.com/" target="_blank">www.xenialab.com</a> | <a href="https://www.xcallymotion.com/" target="_blank">www.xcallymotion.com</a></div>\n      </div>\n    </div>\n  </div>\n</div>'),e.put("app/main/apps/integrations/views/deskAccounts/create/dialog.html",'<md-dialog class="deskAccount-dialog" aria-label="New DeskAccount">\n  <form name="deskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.deskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="deskAccountForm[\'name\'].$error" ng-show="deskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.deskAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskAccountForm[\'type\'].$error" ng-show="deskAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.deskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="deskAccountForm[\'remoteUri\'].$error" ng-show="deskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n        <md-select name="authType" ng-model="vm.deskAccount.authType" required>\n          <md-option ng-value="\'basic\'">Basic</md-option>\n        </md-select>\n        <div ng-messages="deskAccountForm[\'authType\'].$error" ng-show="deskAccountForm[\'authType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.deskAccount.authType == \'basic\'" class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.deskAccount.username" ng-required="true">\n\n        <div ng-messages="deskAccountForm[\'username\'].$error" ng-show="deskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.deskAccount.authType == \'basic\'">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.deskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="deskAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.deskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="deskAccountForm[\'serverUrl\'].$error" ng-show="deskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.deskAccount.description">\n\n        <div ng-messages="deskAccountForm[\'description\'].$error" ng-show="deskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDeskAccount" ng-click="vm.saveDeskAccount()" class="send-button md-accent md-raised" ng-disabled="deskAccountForm.$invalid || deskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDeskAccount" ng-click="vm.addNewDeskAccount()" class="send-button md-accent md-raised" ng-disabled="deskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_DESKACCOUNT">\n          ADD DESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDeskAccount" ng-click="vm.deleteDeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/deskAccounts/deskAccounts.html",'<div id="deskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.DESKACCOUNTS">DeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedDeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-deskAccounts-count">\n          <span>{{vm.selectedDeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDeskAccounts" csv-label="true" filename="deskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- DESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedDeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.deskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="deskAccount" md-select-id="id" ng-repeat="deskAccount in vm.deskAccounts.rows">\n                <td md-cell ng-if="deskAccount.userpic"><img class="avatar" alt="{{deskAccount.name}}" ng-src="api/users/{{deskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!deskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{deskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="id ">{{deskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="name ">{{deskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="remoteUri ">{{deskAccount.remoteUri}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(deskAccount, ev) : vm.createOrEditDeskAccount($event, deskAccount)" md-cell class="username ">{{deskAccount.username}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(deskAccount, $event    )" translate="INTEGRATIONS.EDIT_DESKACCOUNT">\n                          Edit DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(deskAccount, $event    )" translate="INTEGRATIONS.TEST_DESKACCOUNT">\n                          Test DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(deskAccount, $event    )" translate="INTEGRATIONS.DELETE_DESKACCOUNT">\n                          Delete DeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.deskAccounts.count}}" md-on-paginate="vm.getDeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / DESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD DESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-deskAccount-button" ng-click="vm.createOrEditDeskAccount($event)" aria-label="add deskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_DESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/configurations/dialog.html",'<md-dialog class="deskConfiguration-dialog" aria-label="New DeskConfiguration">\n  <form name="deskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.deskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="deskConfigurationForm[\'name\'].$error" ng-show="deskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.deskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskConfigurationForm[\'channel\'].$error" ng-show="deskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.deskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="deskConfigurationForm[\'type\'].$error" ng-show="deskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDeskConfiguration" ng-click="vm.saveDeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="deskConfigurationForm.$invalid || deskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDeskConfiguration" ng-click="vm.addNewDeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="deskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_DESKCONFIGURATION">\n          ADD DESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDeskConfiguration" ng-click="vm.deleteDeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/item/dialog.html",'<md-dialog class="deskAccount-item-dialog" aria-label="New Item">\n  <form name="deskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="deskAccountItemForm.content.$error" ng-show="deskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="deskAccountItemForm.key.$error" ng-show="deskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="deskAccountItemForm.keyType.$error" ng-show="deskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="deskAccountItemForm.keyContent.$error" ng-show="deskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="deskAccountItemForm.variableName.$error" ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="deskAccountItemForm.customField.$error" ng-show="deskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="deskAccountItemForm.$invalid || deskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="deskAccountItemForm.$invalid || deskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="deskAccountItemForm.option.$error" ng-show="deskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="deskAccountItemForm.content.$error" ng-show="deskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="deskAccountItemForm.variableName.$error" ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="deskAccountItemForm.type.$error" ng-show="deskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="deskAccountItemForm.content.$error"\n          ng-show="deskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="deskAccountItemForm.variableName.$error"\n          ng-show="deskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/deskAccounts/edit/view.html",'<div id="integrations-deskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-deskAccounts-button md-icon-button" aria-label="Go to deskAccounts" ng-click="vm.gotoDeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_DESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="deskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/deskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.deskAccount.id}}\n            <span ng-if="vm.deskAccount.name">{{vm.deskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.deskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveDeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="deskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.deskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.deskAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.deskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n                <md-select name="authType" ng-model="vm.deskAccount.authType" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'basic\'">Basic</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'authType\'].$error" ng-show="generalForm[\'authType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.deskAccount.authType == \'basic\'" class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.deskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.deskAccount.authType == \'basic\'">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.deskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.deskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.deskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="deskAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="DeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.deskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDeskConfiguration($event)" class="md-icon-button" aria-label="create deskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="deskConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedDeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getDeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ deskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteDeskConfiguration($event, deskConfiguration)" translate="INTEGRATIONS.DELETE_DESKCONFIGURATION">\n                            Delete DeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/create/dialog.html",'<md-dialog class="dynamics365Account-dialog" aria-label="New Dynamics365Account">\n  <form name="dynamics365AccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.dynamics365Account.name" ng-required="true" autofocus>\n\n        <div ng-messages="dynamics365AccountForm[\'name\'].$error" ng-show="dynamics365AccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.dynamics365Account.modernAuthentication">\n          <span translate="INTEGRATIONS.MODERN_AUTHENTICATION">Modern Authentication</span>\n        </md-switch>\n        \x3c!-- <div class="hint"><span translate="INTEGRATIONS.HELP.MODERN_AUTHENTICATION"></span></div> --\x3e\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="true">\n\n        <div ng-messages="dynamics365AccountForm[\'username\'].$error" ng-show="dynamics365AccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div ng-if="vm.dynamics365Account.modernAuthentication == false">\n\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.PASSWORD">Password</label>\n          <input type="password" name="password" ng-model="vm.dynamics365Account.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" ng-required="true">\n          <div ng-messages="dynamics365AccountForm[\'password\'].$error" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.URI">Uri</label>\n          <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.remoteUri" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'remoteUri\'].$error" ng-show="dynamics365AccountForm[\'remoteUri\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n            </div>\n            <div ng-message="url">\n              <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.TENANTID">TenantId</label>\n          <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'tenantId\'].$error" ng-show="dynamics365AccountForm[\'tenantId\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.TENANTID_REQUIRED">TenantId field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n          <input type="text" name="clientId" ng-model="vm.dynamics365Account.clientId" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'clientId\'].$error" ng-show="dynamics365AccountForm[\'clientId\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n          <input type="text" name="clientSecret" ng-model="vm.dynamics365Account.clientSecret" ng-required="true">\n\n          <div ng-messages="dynamics365AccountForm[\'clientSecret\'].$error" ng-show="dynamics365AccountForm[\'clientSecret\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n          <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" value="LOCALIP" ng-required="true">\n\n          <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n          <div ng-messages="dynamics365AccountForm[\'serverUrl\'].$error" ng-show="dynamics365AccountForm[\'serverUrl\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n            </div>\n            <div ng-message="url">\n              <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n            </div>\n          </div>\n        </md-input-container>\n\n      </div>\n\n      <div ng-if="vm.dynamics365Account.modernAuthentication == true">\n        <md-input-container class="md-block">\n          <label translate="INTEGRATIONS.CLOUD_PROVIDER">Cloud Provider</label>\n          <md-select ng-model="vm.dynamics365Account.CloudProviderId" placeholder="Cloud Provider connection" ng-required="true">\n            <md-option value="{{provider.id}}" ng-repeat="provider in vm.cloudProviders">{{provider.name}}</md-option>\n          </md-select>\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.dynamics365Account.description">\n\n        <div ng-messages="dynamics365AccountForm[\'description\'].$error" ng-show="dynamics365AccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDynamics365Account" ng-click="vm.saveDynamics365Account()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountForm.$invalid || dynamics365AccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDynamics365Account" ng-click="vm.addNewDynamics365Account()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT">\n          ADD DYNAMICS365ACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDynamics365Account" ng-click="vm.deleteDynamics365Account($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/dynamics365Accounts.html",'<div id="dynamics365Accounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.DYNAMICS365ACCOUNTS">Dynamics365Accounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDynamics365Accounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedDynamics365Accounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-dynamics365Accounts-count">\n          <span>{{vm.selectedDynamics365Accounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDynamics365Accounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDynamics365Accounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDynamics365Accounts" csv-label="true" filename="dynamics365Accounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDynamics365Accounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- DYNAMICS365ACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedDynamics365Accounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDynamics365Accounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="modernAuthentication">{{ \'INTEGRATIONS.MODERN_AUTHENTICATION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.dynamics365Accounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="dynamics365Account" md-select-id="id" ng-repeat="dynamics365Account in vm.dynamics365Accounts.rows">\n                <td md-cell ng-if="dynamics365Account.userpic"><img class="avatar" alt="{{dynamics365Account.name}}" ng-src="api/users/{{dynamics365Account.id}}/avatar" /></td>\n                <td md-cell ng-if="!dynamics365Account.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{dynamics365Account.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="id ">{{dynamics365Account.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="name ">{{dynamics365Account.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(dynamics365Account, ev) : vm.createOrEditDynamics365Account($event, dynamics365Account)" md-cell class="modernAuthentication ">\n                  <md-icon md-colors="{color: {{dynamics365Account.modernAuthentication ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{dynamics365Account.modernAuthentication ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(dynamics365Account, $event    )" translate="INTEGRATIONS.EDIT_DYNAMICS365ACCOUNT">\n                          Edit Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(dynamics365Account, $event    )" translate="INTEGRATIONS.TEST_DYNAMICS365ACCOUNT">\n                          Test Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.crudPermissions === 0 || vm.currentUser.role === \'admin\'">\n\n                        <md-button ng-click="vm.deleteconfirm(dynamics365Account, $event    )" translate="INTEGRATIONS.DELETE_DYNAMICS365ACCOUNT">\n                          Delete Dynamics365Account\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.dynamics365Accounts.count}}" md-on-paginate="vm.getDynamics365Accounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / DYNAMICS365ACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD DYNAMICS365ACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-dynamics365Account-button" ng-click="vm.createOrEditDynamics365Account($event)" aria-label="add dynamics365Account" translate translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365ACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DYNAMICS365ACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/configurations/dialog.html",'<md-dialog class="dynamics365Configuration-dialog" aria-label="New Dynamics365Configuration">\n  <form name="dynamics365ConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.dynamics365Configuration.name" ng-required="true" autofocus>\n\n        <div ng-messages="dynamics365ConfigurationForm[\'name\'].$error" ng-show="dynamics365ConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.dynamics365Configuration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'channel\'].$error" ng-show="dynamics365ConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.dynamics365Configuration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'type\'].$error" ng-show="dynamics365ConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TICKETTYPE">TicketType</label>\n        <md-select name="ticketType" ng-model="vm.dynamics365Configuration.ticketType" required>\n\n          <md-option ng-value="\'incident\'"> {{ \'INTEGRATIONS.CASE\' | translate }} </md-option>\n\n          <md-option ng-value="\'phonecall\'"> {{ \'INTEGRATIONS.PHONECALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dynamics365ConfigurationForm[\'ticketType\'].$error" ng-show="dynamics365ConfigurationForm[\'ticketType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TICKETTYPE_REQUIRED">TicketType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDynamics365Configuration" ng-click="vm.saveDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="dynamics365ConfigurationForm.$invalid || dynamics365ConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDynamics365Configuration" ng-click="vm.addNewDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="dynamics365ConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_DYNAMICS365CONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_DYNAMICS365CONFIGURATION">\n          ADD DYNAMICS365CONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDynamics365Configuration" ng-click="vm.deleteDynamics365Configuration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/item/dialog.html",'<md-dialog class="dynamics365Account-item-dialog" aria-label="New Item">\n  <form name="dynamics365AccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="dynamics365AccountItemForm.content.$error" ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="dynamics365AccountItemForm.key.$error" ng-show="dynamics365AccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.keyType.$error" ng-show="dynamics365AccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="dynamics365AccountItemForm.keyContent.$error" ng-show="dynamics365AccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.variableName.$error" ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="dynamics365AccountItemForm.customField.$error" ng-show="dynamics365AccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountItemForm.$invalid || dynamics365AccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="dynamics365AccountItemForm.$invalid || dynamics365AccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="dynamics365AccountItemForm.option.$error" ng-show="dynamics365AccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="dynamics365AccountItemForm.content.$error" ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="dynamics365AccountItemForm.variableName.$error" ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="dynamics365AccountItemForm.type.$error" ng-show="dynamics365AccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="dynamics365AccountItemForm.content.$error"\n          ng-show="dynamics365AccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="dynamics365AccountItemForm.variableName.$error"\n          ng-show="dynamics365AccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/dynamics365Accounts/edit/view.html",'<div id="integrations-dynamics365Account" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-dynamics365Accounts-button md-icon-button" aria-label="Go to dynamics365Accounts" ng-click="vm.gotoDynamics365Accounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_DYNAMICS365ACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="dynamics365Account-image" hide-xs>\n          <img ng-src="assets/images/business/dynamics365Accounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.dynamics365Account.id}}\n            <span ng-if="vm.dynamics365Account.name">{{vm.dynamics365Account.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.dynamics365Account.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveDynamics365Account()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="dynamics365Account-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.dynamics365Account.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.dynamics365Account.modernAuthentication">\n                  <span translate="INTEGRATIONS.MODERN_AUTHENTICATION">Modern Authentication</span>\n                </md-switch>\n                \x3c!-- <div class="hint"><span translate="INTEGRATIONS.HELP.MODERN_AUTHENTICATION"></span></div> --\x3e\n              </md-input-container>\n\n              <div ng-if="vm.dynamics365Account.modernAuthentication == true">\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLOUD_PROVIDER">Cloud Provider</label>\n                  <md-select ng-model="vm.dynamics365Account.CloudProviderId" placeholder="Cloud Provider connection" ng-required="true">\n                    <md-option value="{{provider.id}}" ng-repeat="provider in vm.cloudProviders.rows">{{provider.name}}</md-option>\n                  </md-select>\n                </md-input-container>\n              </div>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.dynamics365Account.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <div ng-if="vm.dynamics365Account.modernAuthentication == false">\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                  <input type="password" name="password" ng-model="vm.dynamics365Account.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" ng-required="vm.dynamics365Account.modernAuthentication == false">\n                  <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                    </div>\n                    <div ng-message="pattern">\n                      <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.URI">Uri</label>\n                  <input type="url" name="remoteUri" ng-model="vm.dynamics365Account.remoteUri" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.TENANTID">TenantId</label>\n                  <input type="text" name="tenantId" ng-model="vm.dynamics365Account.tenantId" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'tenantId\'].$error" ng-show="generalForm[\'tenantId\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.TENANTID_REQUIRED">TenantId field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                  <input type="text" name="clientId" ng-model="vm.dynamics365Account.clientId" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                  <input type="text" name="clientSecret" ng-model="vm.dynamics365Account.clientSecret" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                    </div>\n                  </div>\n                </md-input-container>\n                <md-input-container class="md-block">\n                  <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                  <input type="url" name="serverUrl" ng-model="vm.dynamics365Account.serverUrl" value="LOCALIP" ng-required="vm.dynamics365Account.modernAuthentication == false" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                  <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                    <div ng-message="required">\n                      <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                    </div>\n                    <div ng-message="url">\n                      <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                    </div>\n                  </div>\n                </md-input-container>\n\n              </div>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.dynamics365Account.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="dynamics365Account-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="Dynamics365AccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.dynamics365Account, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDynamics365Configuration($event)" class="md-icon-button" aria-label="create dynamics365Configuration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="dynamics365Configuration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedDynamics365Configuration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getDynamics365Configuration($index)">\n                    <span class="text-truncate" flex="80">{{ dynamics365Configuration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteDynamics365Configuration($event, dynamics365Configuration)" translate="INTEGRATIONS.DELETE_DYNAMICS365CONFIGURATION">\n                            Delete Dynamics365Configuration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">ADVANCED</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div class="dynamics365Account-detail-form-container general md-background-bg">\n                        <div class="pb-16" layout="row" layout-align="start center">\n                          <div class="h2 secondary-text" translate="INTEGRATIONS.ADVANCED">ADVANCED</div>\n                        </div>\n                        <form name="vm_cc.advancedForm" novalidate>\n                          <md-input-container class="md-block">\n                            <label translate="INTEGRATIONS.MODULECREATE">Module Create</label>\n                            <md-select name="type" ng-model="vm_cc.dynamics365Configuration.moduleCreate" required>\n                              <md-option ng-value="\'contact\'">{{\'INTEGRATIONS.DYNAMIC365CONTACT\' | translate}}</md-option>\n                              <md-option ng-value="\'nothing\'">{{\'INTEGRATIONS.DYNAMIC365NOTHING\' | translate}}</md-option>\n                            </md-select>\n                            <div ng-messages="vm_cc.advancedForm[\'moduleCreate\'].$error" ng-show="vm_cc.advancedForm[\'moduleCreate\'].$touched" role="alert">\n                              <div ng-message="required">\n                                <span translate="INTEGRATIONS.ERRORS.MODULECREATE_REQUIRED">Type field is required</span>\n                              </div>\n                            </div>\n                          </md-input-container>\n\n\n                          <md-input-container class="md-block">\n                            <md-switch ng-model="vm_cc.dynamics365Configuration.openNewTab">\n                              <span translate="INTEGRATIONS.OPENNEWTAB">Open new tab</span>\n                            </md-switch>\n                          </md-input-container>\n\n\n                          <md-input-container class="md-block">\n                            <label translate="INTEGRATIONS.ADDITIONALSEARCHCONTACT">Additional search contact</label>\n                            <input type="" name="additionalSearchContact" ng-model="vm_cc.dynamics365Configuration.additionalSearchContact" autofocus>\n                          </md-input-container>\n                          <div layout="row" layout-align="end center">\n                            <md-button type="submit" ng-click="vm_cc.saveDynamics365Configuration()" class="send-button md-accent md-raised" ng-disabled="vm_cc.advancedForm.$invalid || vm_cc.advancedForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n                              SAVE\n                            </md-button>\n                          </div>\n                        </form>\n                      </div>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditDynamics365Configuration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n          </div>\n\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/create/dialog.html",'<md-dialog class="freshdeskAccount-dialog" aria-label="New FreshdeskAccount">\n  <form name="freshdeskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.freshdeskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshdeskAccountForm[\'name\'].$error" ng-show="freshdeskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.freshdeskAccount.username" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'username\'].$error" ng-show="freshdeskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.freshdeskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'remoteUri\'].$error" ng-show="freshdeskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.freshdeskAccount.apiKey" ng-required="true">\n\n        <div ng-messages="freshdeskAccountForm[\'apiKey\'].$error" ng-show="freshdeskAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.freshdeskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="freshdeskAccountForm[\'serverUrl\'].$error" ng-show="freshdeskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.freshdeskAccount.description">\n\n        <div ng-messages="freshdeskAccountForm[\'description\'].$error" ng-show="freshdeskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshdeskAccount" ng-click="vm.saveFreshdeskAccount()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountForm.$invalid || freshdeskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshdeskAccount" ng-click="vm.addNewFreshdeskAccount()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHDESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKACCOUNT">\n          ADD FRESHDESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshdeskAccount" ng-click="vm.deleteFreshdeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/configurations/dialog.html",'<md-dialog class="freshdeskConfiguration-dialog" aria-label="New FreshdeskConfiguration">\n  <form name="freshdeskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.freshdeskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshdeskConfigurationForm[\'name\'].$error" ng-show="freshdeskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.freshdeskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshdeskConfigurationForm[\'channel\'].$error" ng-show="freshdeskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.freshdeskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshdeskConfigurationForm[\'type\'].$error" ng-show="freshdeskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshdeskConfiguration" ng-click="vm.saveFreshdeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshdeskConfigurationForm.$invalid || freshdeskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshdeskConfiguration" ng-click="vm.addNewFreshdeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshdeskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHDESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKCONFIGURATION">\n          ADD FRESHDESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshdeskConfiguration" ng-click="vm.deleteFreshdeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/item/dialog.html",'<md-dialog class="freshdeskAccount-item-dialog" aria-label="New Item">\n  <form name="freshdeskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="freshdeskAccountItemForm.content.$error" ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="freshdeskAccountItemForm.key.$error" ng-show="freshdeskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.keyType.$error" ng-show="freshdeskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="freshdeskAccountItemForm.keyContent.$error" ng-show="freshdeskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.variableName.$error" ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="freshdeskAccountItemForm.customField.$error" ng-show="freshdeskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountItemForm.$invalid || freshdeskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="freshdeskAccountItemForm.$invalid || freshdeskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="freshdeskAccountItemForm.option.$error" ng-show="freshdeskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="freshdeskAccountItemForm.content.$error" ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="freshdeskAccountItemForm.variableName.$error" ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="freshdeskAccountItemForm.type.$error" ng-show="freshdeskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="freshdeskAccountItemForm.content.$error"\n          ng-show="freshdeskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="freshdeskAccountItemForm.variableName.$error"\n          ng-show="freshdeskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/edit/view.html",'<div id="integrations-freshdeskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-freshdeskAccounts-button md-icon-button" aria-label="Go to freshdeskAccounts" ng-click="vm.gotoFreshdeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_FRESHDESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="freshdeskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/freshdeskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.freshdeskAccount.id}}\n            <span ng-if="vm.freshdeskAccount.name">{{vm.freshdeskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.freshdeskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFreshdeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshdeskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.freshdeskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.freshdeskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.freshdeskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.freshdeskAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.freshdeskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.freshdeskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshdeskAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="FreshdeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.freshdeskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshdeskConfiguration($event)" class="md-icon-button" aria-label="create freshdeskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="freshdeskConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedFreshdeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getFreshdeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ freshdeskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteFreshdeskConfiguration($event, freshdeskConfiguration)" translate="INTEGRATIONS.DELETE_FRESHDESKCONFIGURATION">\n                            Delete FreshdeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshdeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshdeskAccounts/freshdeskAccounts.html",'<div id="freshdeskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.FRESHDESKACCOUNTS">FreshdeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFreshdeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFreshdeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-freshdeskAccounts-count">\n          <span>{{vm.selectedFreshdeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFreshdeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFreshdeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFreshdeskAccounts" csv-label="true" filename="freshdeskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFreshdeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FRESHDESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFreshdeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFreshdeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.freshdeskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="freshdeskAccount" md-select-id="id" ng-repeat="freshdeskAccount in vm.freshdeskAccounts.rows">\n                <td md-cell ng-if="freshdeskAccount.userpic"><img class="avatar" alt="{{freshdeskAccount.name}}" ng-src="api/users/{{freshdeskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!freshdeskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{freshdeskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="id ">{{freshdeskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="name ">{{freshdeskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="username ">{{freshdeskAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshdeskAccount, ev) : vm.createOrEditFreshdeskAccount($event, freshdeskAccount)" md-cell class="remoteUri ">{{freshdeskAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(freshdeskAccount, $event    )" translate="INTEGRATIONS.EDIT_FRESHDESKACCOUNT">\n                          Edit FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(freshdeskAccount, $event    )" translate="INTEGRATIONS.TEST_FRESHDESKACCOUNT">\n                          Test FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(freshdeskAccount, $event    )" translate="INTEGRATIONS.DELETE_FRESHDESKACCOUNT">\n                          Delete FreshdeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.freshdeskAccounts.count}}" md-on-paginate="vm.getFreshdeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FRESHDESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FRESHDESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-freshdeskAccount-button" ng-click="vm.createOrEditFreshdeskAccount($event)" aria-label="add freshdeskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_FRESHDESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FRESHDESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/create/dialog.html",'<md-dialog class="freshsalesAccount-dialog" aria-label="New FreshsalesAccount">\n  <form name="freshsalesAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.freshsalesAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshsalesAccountForm[\'name\'].$error" ng-show="freshsalesAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.freshsalesAccount.username" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'username\'].$error" ng-show="freshsalesAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.freshsalesAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'remoteUri\'].$error" ng-show="freshsalesAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.freshsalesAccount.apiKey" ng-required="true">\n\n        <div ng-messages="freshsalesAccountForm[\'apiKey\'].$error" ng-show="freshsalesAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.freshsalesAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="freshsalesAccountForm[\'serverUrl\'].$error" ng-show="freshsalesAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.freshsalesAccount.description">\n\n        <div ng-messages="freshsalesAccountForm[\'description\'].$error" ng-show="freshsalesAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshsalesAccount" ng-click="vm.saveFreshsalesAccount()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountForm.$invalid || freshsalesAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshsalesAccount" ng-click="vm.addNewFreshsalesAccount()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHSALESACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESACCOUNT">\n          ADD FRESHSALESACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshsalesAccount" ng-click="vm.deleteFreshsalesAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/configurations/dialog.html",'<md-dialog class="freshsalesConfiguration-dialog" aria-label="New FreshsalesConfiguration">\n  <form name="freshsalesConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.freshsalesConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="freshsalesConfigurationForm[\'name\'].$error" ng-show="freshsalesConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.freshsalesConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshsalesConfigurationForm[\'channel\'].$error" ng-show="freshsalesConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.freshsalesConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="freshsalesConfigurationForm[\'type\'].$error" ng-show="freshsalesConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newFreshsalesConfiguration" ng-click="vm.saveFreshsalesConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshsalesConfigurationForm.$invalid || freshsalesConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newFreshsalesConfiguration" ng-click="vm.addNewFreshsalesConfiguration()" class="send-button md-accent md-raised" ng-disabled="freshsalesConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_FRESHSALESCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESCONFIGURATION">\n          ADD FRESHSALESCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newFreshsalesConfiguration" ng-click="vm.deleteFreshsalesConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/item/dialog.html",'<md-dialog class="freshsalesAccount-item-dialog" aria-label="New Item">\n  <form name="freshsalesAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="freshsalesAccountItemForm.content.$error" ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="freshsalesAccountItemForm.key.$error" ng-show="freshsalesAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.keyType.$error" ng-show="freshsalesAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="freshsalesAccountItemForm.keyContent.$error" ng-show="freshsalesAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.variableName.$error" ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="freshsalesAccountItemForm.customField.$error" ng-show="freshsalesAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountItemForm.$invalid || freshsalesAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="freshsalesAccountItemForm.$invalid || freshsalesAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="freshsalesAccountItemForm.option.$error" ng-show="freshsalesAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="freshsalesAccountItemForm.content.$error" ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="freshsalesAccountItemForm.variableName.$error" ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="freshsalesAccountItemForm.type.$error" ng-show="freshsalesAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="freshsalesAccountItemForm.content.$error"\n          ng-show="freshsalesAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="freshsalesAccountItemForm.variableName.$error"\n          ng-show="freshsalesAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/edit/view.html",'<div id="integrations-freshsalesAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-freshsalesAccounts-button md-icon-button" aria-label="Go to freshsalesAccounts" ng-click="vm.gotoFreshsalesAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_FRESHSALESACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="freshsalesAccount-image" hide-xs>\n          <img ng-src="assets/images/business/freshsalesAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.freshsalesAccount.id}}\n            <span ng-if="vm.freshsalesAccount.name">{{vm.freshsalesAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.freshsalesAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveFreshsalesAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshsalesAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.freshsalesAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.freshsalesAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.freshsalesAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.freshsalesAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.freshsalesAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.freshsalesAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="freshsalesAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="FreshsalesAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.freshsalesAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshsalesConfiguration($event)" class="md-icon-button" aria-label="create freshsalesConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="freshsalesConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedFreshsalesConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getFreshsalesConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ freshsalesConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteFreshsalesConfiguration($event, freshsalesConfiguration)" translate="INTEGRATIONS.DELETE_FRESHSALESCONFIGURATION">\n                            Delete FreshsalesConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditFreshsalesConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/freshsalesAccounts/freshsalesAccounts.html",'<div id="freshsalesAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.FRESHSALESACCOUNTS">FreshsalesAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedFreshsalesAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedFreshsalesAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-freshsalesAccounts-count">\n          <span>{{vm.selectedFreshsalesAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllFreshsalesAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectFreshsalesAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedFreshsalesAccounts" csv-label="true" filename="freshsalesAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedFreshsalesAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- FRESHSALESACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedFreshsalesAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getFreshsalesAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.freshsalesAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="freshsalesAccount" md-select-id="id" ng-repeat="freshsalesAccount in vm.freshsalesAccounts.rows">\n                <td md-cell ng-if="freshsalesAccount.userpic"><img class="avatar" alt="{{freshsalesAccount.name}}" ng-src="api/users/{{freshsalesAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!freshsalesAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{freshsalesAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="id ">{{freshsalesAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="name ">{{freshsalesAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="username ">{{freshsalesAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(freshsalesAccount, ev) : vm.createOrEditFreshsalesAccount($event, freshsalesAccount)" md-cell class="remoteUri ">{{freshsalesAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(freshsalesAccount, $event    )" translate="INTEGRATIONS.EDIT_FRESHSALESACCOUNT">\n                          Edit FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(freshsalesAccount, $event    )" translate="INTEGRATIONS.TEST_FRESHSALESACCOUNT">\n                          Test FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(freshsalesAccount, $event    )" translate="INTEGRATIONS.DELETE_FRESHSALESACCOUNT">\n                          Delete FreshsalesAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.freshsalesAccounts.count}}" md-on-paginate="vm.getFreshsalesAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / FRESHSALESACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD FRESHSALESACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-freshsalesAccount-button" ng-click="vm.createOrEditFreshsalesAccount($event)" aria-label="add freshsalesAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_FRESHSALESACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD FRESHSALESACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/salesforceAccounts/create/dialog.html",'<md-dialog class="salesforceAccount-dialog" aria-label="New SalesforceAccount">\n  <form name="salesforceAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.salesforceAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="salesforceAccountForm[\'name\'].$error" ng-show="salesforceAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.salesforceAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceAccountForm[\'type\'].$error" ng-show="salesforceAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.salesforceAccount.username" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'username\'].$error" ng-show="salesforceAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.salesforceAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'remoteUri\'].$error" ng-show="salesforceAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.salesforceAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="salesforceAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n        <input type="text" name="clientId" ng-model="vm.salesforceAccount.clientId" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'clientId\'].$error" ng-show="salesforceAccountForm[\'clientId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n        <input type="text" name="clientSecret" ng-model="vm.salesforceAccount.clientSecret" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'clientSecret\'].$error" ng-show="salesforceAccountForm[\'clientSecret\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.SECURITYTOKEN">SecurityToken</label>\n        <input type="text" name="securityToken" ng-model="vm.salesforceAccount.securityToken" ng-required="true">\n\n        <div ng-messages="salesforceAccountForm[\'securityToken\'].$error" ng-show="salesforceAccountForm[\'securityToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.SECURITYTOKEN_REQUIRED">SecurityToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.salesforceAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="salesforceAccountForm[\'serverUrl\'].$error" ng-show="salesforceAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.salesforceAccount.description">\n\n        <div ng-messages="salesforceAccountForm[\'description\'].$error" ng-show="salesforceAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSalesforceAccount" ng-click="vm.saveSalesforceAccount()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountForm.$invalid || salesforceAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSalesforceAccount" ng-click="vm.addNewSalesforceAccount()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SALESFORCEACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCEACCOUNT">\n          ADD SALESFORCEACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSalesforceAccount" ng-click="vm.deleteSalesforceAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/configurations/dialog.html",'<md-dialog class="salesforceConfiguration-dialog" aria-label="New SalesforceConfiguration">\n  <form name="salesforceConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.salesforceConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="salesforceConfigurationForm[\'name\'].$error" ng-show="salesforceConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.salesforceConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'channel\'].$error" ng-show="salesforceConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.salesforceConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'type\'].$error" ng-show="salesforceConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TICKETTYPE">TicketType</label>\n        <md-select name="ticketType" ng-model="vm.salesforceConfiguration.ticketType" required>\n\n          <md-option ng-value="\'Task\'"> {{ \'INTEGRATIONS.TASK\' | translate }} </md-option>\n\n          <md-option ng-value="\'Case\'"> {{ \'INTEGRATIONS.CASE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="salesforceConfigurationForm[\'ticketType\'].$error" ng-show="salesforceConfigurationForm[\'ticketType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TICKETTYPE_REQUIRED">TicketType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSalesforceConfiguration" ng-click="vm.saveSalesforceConfiguration()" class="send-button md-accent md-raised" ng-disabled="salesforceConfigurationForm.$invalid || salesforceConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSalesforceConfiguration" ng-click="vm.addNewSalesforceConfiguration()" class="send-button md-accent md-raised" ng-disabled="salesforceConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SALESFORCECONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCECONFIGURATION">\n          ADD SALESFORCECONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSalesforceConfiguration" ng-click="vm.deleteSalesforceConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/item/dialog.html",'<md-dialog class="salesforceAccount-item-dialog" aria-label="New Item">\n  <form name="salesforceAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="salesforceAccountItemForm.content.$error" ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="salesforceAccountItemForm.key.$error" ng-show="salesforceAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.keyType.$error" ng-show="salesforceAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="salesforceAccountItemForm.keyContent.$error" ng-show="salesforceAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.variableName.$error" ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="salesforceAccountItemForm.customField.$error" ng-show="salesforceAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountItemForm.$invalid || salesforceAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="salesforceAccountItemForm.$invalid || salesforceAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="salesforceAccountItemForm.option.$error" ng-show="salesforceAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="salesforceAccountItemForm.content.$error" ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="salesforceAccountItemForm.variableName.$error" ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="salesforceAccountItemForm.type.$error" ng-show="salesforceAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="salesforceAccountItemForm.content.$error"\n          ng-show="salesforceAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="salesforceAccountItemForm.variableName.$error"\n          ng-show="salesforceAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/salesforceAccounts/edit/view.html",'<div id="integrations-salesforceAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-salesforceAccounts-button md-icon-button" aria-label="Go to salesforceAccounts" ng-click="vm.gotoSalesforceAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SALESFORCEACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="salesforceAccount-image" hide-xs>\n          <img ng-src="assets/images/business/salesforceAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.salesforceAccount.id}}\n            <span ng-if="vm.salesforceAccount.name">{{vm.salesforceAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.salesforceAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSalesforceAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="salesforceAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.salesforceAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.salesforceAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.salesforceAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.salesforceAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.salesforceAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                <input type="text" name="clientId" ng-model="vm.salesforceAccount.clientId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                <input type="text" name="clientSecret" ng-model="vm.salesforceAccount.clientSecret" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.SECURITYTOKEN">SecurityToken</label>\n                <input type="text" name="securityToken" ng-model="vm.salesforceAccount.securityToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'securityToken\'].$error" ng-show="generalForm[\'securityToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.SECURITYTOKEN_REQUIRED">SecurityToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.salesforceAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.salesforceAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="salesforceAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="SalesforceAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.salesforceAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSalesforceConfiguration($event)" class="md-icon-button" aria-label="create salesforceConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="salesforceConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedSalesforceConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getSalesforceConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ salesforceConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteSalesforceConfiguration($event, salesforceConfiguration)" translate="INTEGRATIONS.DELETE_SALESFORCECONFIGURATION">\n                            Delete SalesforceConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">\n                        ADVANCED\n                      </span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_SEARCH"></label>\n                        <md-select ng-model="vm_cc.salesforceConfiguration.moduleSearch" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'account_contact_lead\', value: \'Account & Contact & Lead\'}, {key: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}, {key: \'account\', value: \'Account\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_CREATE"></label>\n                        <md-select ng-model="vm_cc.salesforceConfiguration.moduleCreate" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'nothing\', value: \'Nothing\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}, {key: \'account\', value: \'Account\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isLead">\n                        <label translate="INTEGRATIONS.LEADID"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.leadId" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.LEADID"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isAccountSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHACCOUNT"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchAccount" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHACCOUNT"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isContactSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHCONTACT"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchContact" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHCONTACT"></span></div>\n                      </div>\n\n                      <div layout-margin ng-if="vm_cc.salesforceConfiguration.isLeadSearch">\n                        <label translate="INTEGRATIONS.ADDITIONALSEARCHLEAD"></label>\n                        <md-input-container class="md-block">\n                          <input ng-model="vm_cc.salesforceConfiguration.additionalSearchLead" type="text">\n                        </md-input-container>\n                        <div class="hint"><span translate="INTEGRATIONS.HELP.ADDITIONALSEARCHLEAD"></span></div>\n                      </div>\n\n                      <md-button type="submit" ng-click="vm_cc.saveSalesforceConfiguration()" ng-disabled="!vm_cc.crudPermissions.canEdit" class="send-button md-accent md-raised" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n                        SAVE\n                      </md-button>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSalesforceConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/salesforceAccounts/salesforceAccounts.html",'<div id="salesforceAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SALESFORCEACCOUNTS">SalesforceAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSalesforceAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSalesforceAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-salesforceAccounts-count">\n          <span>{{vm.selectedSalesforceAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSalesforceAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSalesforceAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSalesforceAccounts" csv-label="true" filename="salesforceAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSalesforceAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SALESFORCEACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSalesforceAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSalesforceAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.salesforceAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="salesforceAccount" md-select-id="id" ng-repeat="salesforceAccount in vm.salesforceAccounts.rows">\n                <td md-cell ng-if="salesforceAccount.userpic"><img class="avatar" alt="{{salesforceAccount.name}}" ng-src="api/users/{{salesforceAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!salesforceAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{salesforceAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="id ">{{salesforceAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="name ">{{salesforceAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="username ">{{salesforceAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(salesforceAccount, ev) : vm.createOrEditSalesforceAccount($event, salesforceAccount)" md-cell class="remoteUri ">{{salesforceAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(salesforceAccount, $event    )" translate="INTEGRATIONS.EDIT_SALESFORCEACCOUNT">\n                          Edit SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(salesforceAccount, $event    )" translate="INTEGRATIONS.TEST_SALESFORCEACCOUNT">\n                          Test SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(salesforceAccount, $event    )" translate="INTEGRATIONS.DELETE_SALESFORCEACCOUNT">\n                          Delete SalesforceAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.salesforceAccounts.count}}" md-on-paginate="vm.getSalesforceAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SALESFORCEACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SALESFORCEACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-salesforceAccount-button" ng-click="vm.createOrEditSalesforceAccount($event)" aria-label="add salesforceAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SALESFORCEACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SALESFORCEACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/servicenowAccounts/create/dialog.html",'<md-dialog class="servicenowAccount-dialog" aria-label="New ServicenowAccount">\n  <form name="servicenowAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.servicenowAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="servicenowAccountForm[\'name\'].$error" ng-show="servicenowAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.servicenowAccount.username" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'username\'].$error" ng-show="servicenowAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.servicenowAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="servicenowAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.servicenowAccount.email" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'email\'].$error" ng-show="servicenowAccountForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="INTEGRATIONS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <input type="url" name="remoteUri" ng-model="vm.servicenowAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="servicenowAccountForm[\'remoteUri\'].$error" ng-show="servicenowAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.servicenowAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="servicenowAccountForm[\'serverUrl\'].$error" ng-show="servicenowAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.servicenowAccount.description">\n\n        <div ng-messages="servicenowAccountForm[\'description\'].$error" ng-show="servicenowAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newServicenowAccount" ng-click="vm.saveServicenowAccount()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountForm.$invalid || servicenowAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newServicenowAccount" ng-click="vm.addNewServicenowAccount()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SERVICENOWACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWACCOUNT">\n          ADD SERVICENOWACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newServicenowAccount" ng-click="vm.deleteServicenowAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/configurations/dialog.html",'<md-dialog class="servicenowConfiguration-dialog" aria-label="New ServicenowConfiguration">\n  <form name="servicenowConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.servicenowConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="servicenowConfigurationForm[\'name\'].$error" ng-show="servicenowConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.servicenowConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="servicenowConfigurationForm[\'channel\'].$error" ng-show="servicenowConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.servicenowConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="servicenowConfigurationForm[\'type\'].$error" ng-show="servicenowConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newServicenowConfiguration" ng-click="vm.saveServicenowConfiguration()" class="send-button md-accent md-raised" ng-disabled="servicenowConfigurationForm.$invalid || servicenowConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newServicenowConfiguration" ng-click="vm.addNewServicenowConfiguration()" class="send-button md-accent md-raised" ng-disabled="servicenowConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SERVICENOWCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWCONFIGURATION">\n          ADD SERVICENOWCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newServicenowConfiguration" ng-click="vm.deleteServicenowConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/item/dialog.html",'<md-dialog class="servicenowAccount-item-dialog" aria-label="New Item">\n  <form name="servicenowAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="servicenowAccountItemForm.content.$error" ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="servicenowAccountItemForm.key.$error" ng-show="servicenowAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.keyType.$error" ng-show="servicenowAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="servicenowAccountItemForm.keyContent.$error" ng-show="servicenowAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.variableName.$error" ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="servicenowAccountItemForm.customField.$error" ng-show="servicenowAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountItemForm.$invalid || servicenowAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="servicenowAccountItemForm.$invalid || servicenowAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="servicenowAccountItemForm.option.$error" ng-show="servicenowAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="servicenowAccountItemForm.content.$error" ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="servicenowAccountItemForm.variableName.$error" ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="servicenowAccountItemForm.type.$error" ng-show="servicenowAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="servicenowAccountItemForm.content.$error"\n          ng-show="servicenowAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="servicenowAccountItemForm.variableName.$error"\n          ng-show="servicenowAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/servicenowAccounts/edit/view.html",'<div id="integrations-servicenowAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-servicenowAccounts-button md-icon-button" aria-label="Go to servicenowAccounts" ng-click="vm.gotoServicenowAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SERVICENOWACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="servicenowAccount-image" hide-xs>\n          <img ng-src="assets/images/business/servicenowAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.servicenowAccount.id}}\n            <span ng-if="vm.servicenowAccount.name">{{vm.servicenowAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.servicenowAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveServicenowAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="servicenowAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.servicenowAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.servicenowAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.servicenowAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.servicenowAccount.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="INTEGRATIONS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <input type="url" name="remoteUri" ng-model="vm.servicenowAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.servicenowAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.servicenowAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="servicenowAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ServicenowAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.servicenowAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditServicenowConfiguration($event)" class="md-icon-button" aria-label="create servicenowConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="servicenowConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedServicenowConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getServicenowConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ servicenowConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteServicenowConfiguration($event, servicenowConfiguration)" translate="INTEGRATIONS.DELETE_SERVICENOWCONFIGURATION">\n                            Delete ServicenowConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditServicenowConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/servicenowAccounts/servicenowAccounts.html",'<div id="servicenowAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SERVICENOWACCOUNTS">ServicenowAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedServicenowAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedServicenowAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-servicenowAccounts-count">\n          <span>{{vm.selectedServicenowAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllServicenowAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectServicenowAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedServicenowAccounts" csv-label="true" filename="servicenowAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedServicenowAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SERVICENOWACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedServicenowAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getServicenowAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'INTEGRATIONS.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.servicenowAccounts.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="servicenowAccount" md-select-id="id" ng-repeat="servicenowAccount in vm.servicenowAccounts.rows">\n                <td md-cell ng-if="servicenowAccount.userpic"><img class="avatar" alt="{{servicenowAccount.name}}" ng-src="api/users/{{servicenowAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!servicenowAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{servicenowAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="id ">{{servicenowAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="name ">{{servicenowAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="username ">{{servicenowAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="email ">{{servicenowAccount.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(servicenowAccount, ev) : vm.createOrEditServicenowAccount($event, servicenowAccount)" md-cell class="remoteUri ">{{servicenowAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(servicenowAccount, $event    )" translate="INTEGRATIONS.EDIT_SERVICENOWACCOUNT">\n                          Edit ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(servicenowAccount, $event    )" translate="INTEGRATIONS.TEST_SERVICENOWACCOUNT">\n                          Test ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.crudPermissions === 0 || vm.currentUser.role === \'admin\'">\n\n                        <md-button ng-click="vm.deleteconfirm(servicenowAccount, $event    )" translate="INTEGRATIONS.DELETE_SERVICENOWACCOUNT">\n                          Delete ServicenowAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.servicenowAccounts.count}}" md-on-paginate="vm.getServicenowAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SERVICENOWACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SERVICENOWACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-servicenowAccount-button" ng-click="vm.createOrEditServicenowAccount($event)" aria-label="add servicenowAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SERVICENOWACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SERVICENOWACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/create/dialog.html",'<md-dialog class="sugarcrmAccount-dialog" aria-label="New SugarcrmAccount">\n  <form name="sugarcrmAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.sugarcrmAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="sugarcrmAccountForm[\'name\'].$error" ng-show="sugarcrmAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.sugarcrmAccount.username" ng-required="true">\n\n        <div ng-messages="sugarcrmAccountForm[\'username\'].$error" ng-show="sugarcrmAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.sugarcrmAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="sugarcrmAccountForm[\'remoteUri\'].$error" ng-show="sugarcrmAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.sugarcrmAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="sugarcrmAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.sugarcrmAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="sugarcrmAccountForm[\'serverUrl\'].$error" ng-show="sugarcrmAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.sugarcrmAccount.description">\n\n        <div ng-messages="sugarcrmAccountForm[\'description\'].$error" ng-show="sugarcrmAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSugarcrmAccount" ng-click="vm.saveSugarcrmAccount()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountForm.$invalid || sugarcrmAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSugarcrmAccount" ng-click="vm.addNewSugarcrmAccount()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SUGARCRMACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMACCOUNT">\n          ADD SUGARCRMACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSugarcrmAccount" ng-click="vm.deleteSugarcrmAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/configurations/dialog.html",'<md-dialog class="sugarcrmConfiguration-dialog" aria-label="New SugarcrmConfiguration">\n  <form name="sugarcrmConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.sugarcrmConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="sugarcrmConfigurationForm[\'name\'].$error" ng-show="sugarcrmConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.sugarcrmConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="sugarcrmConfigurationForm[\'channel\'].$error" ng-show="sugarcrmConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.sugarcrmConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="sugarcrmConfigurationForm[\'type\'].$error" ng-show="sugarcrmConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSugarcrmConfiguration" ng-click="vm.saveSugarcrmConfiguration()" class="send-button md-accent md-raised" ng-disabled="sugarcrmConfigurationForm.$invalid || sugarcrmConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSugarcrmConfiguration" ng-click="vm.addNewSugarcrmConfiguration()" class="send-button md-accent md-raised" ng-disabled="sugarcrmConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_SUGARCRMCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMCONFIGURATION">\n          ADD SUGARCRMCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSugarcrmConfiguration" ng-click="vm.deleteSugarcrmConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/item/dialog.html",'<md-dialog class="sugarcrmAccount-item-dialog" aria-label="New Item">\n  <form name="sugarcrmAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="sugarcrmAccountItemForm.key.$error" ng-show="sugarcrmAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.keyType.$error" ng-show="sugarcrmAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="sugarcrmAccountItemForm.keyContent.$error" ng-show="sugarcrmAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="sugarcrmAccountItemForm.customField.$error" ng-show="sugarcrmAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="sugarcrmAccountItemForm.$invalid || sugarcrmAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="sugarcrmAccountItemForm.option.$error" ng-show="sugarcrmAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="sugarcrmAccountItemForm.content.$error" ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="sugarcrmAccountItemForm.variableName.$error" ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="sugarcrmAccountItemForm.type.$error" ng-show="sugarcrmAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="sugarcrmAccountItemForm.content.$error"\n          ng-show="sugarcrmAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="sugarcrmAccountItemForm.variableName.$error"\n          ng-show="sugarcrmAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/edit/view.html",'<div id="integrations-sugarcrmAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-sugarcrmAccounts-button md-icon-button" aria-label="Go to sugarcrmAccounts" ng-click="vm.gotoSugarcrmAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_SUGARCRMACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="sugarcrmAccount-image" hide-xs>\n          <img ng-src="assets/images/business/sugarcrmAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.sugarcrmAccount.id}}\n            <span ng-if="vm.sugarcrmAccount.name">{{vm.sugarcrmAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.sugarcrmAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSugarcrmAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="sugarcrmAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.sugarcrmAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.sugarcrmAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.sugarcrmAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.sugarcrmAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.sugarcrmAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.sugarcrmAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="sugarcrmAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="SugarcrmAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.sugarcrmAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSugarcrmConfiguration($event)" class="md-icon-button" aria-label="create sugarcrmConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="sugarcrmConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedSugarcrmConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getSugarcrmConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ sugarcrmConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteSugarcrmConfiguration($event, sugarcrmConfiguration)" translate="INTEGRATIONS.DELETE_SUGARCRMCONFIGURATION">\n                            Delete SugarcrmConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditSugarcrmConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/sugarcrmAccounts/sugarcrmAccounts.html",'<div id="sugarcrmAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.SUGARCRMACCOUNTS">SugarcrmAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSugarcrmAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSugarcrmAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-sugarcrmAccounts-count">\n          <span>{{vm.selectedSugarcrmAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSugarcrmAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSugarcrmAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSugarcrmAccounts" csv-label="true" filename="sugarcrmAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSugarcrmAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SUGARCRMACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSugarcrmAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSugarcrmAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.sugarcrmAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="sugarcrmAccount" md-select-id="id" ng-repeat="sugarcrmAccount in vm.sugarcrmAccounts.rows">\n                <td md-cell ng-if="sugarcrmAccount.userpic"><img class="avatar" alt="{{sugarcrmAccount.name}}" ng-src="api/users/{{sugarcrmAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!sugarcrmAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{sugarcrmAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="id ">{{sugarcrmAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="name ">{{sugarcrmAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="username ">{{sugarcrmAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(sugarcrmAccount, ev) : vm.createOrEditSugarcrmAccount($event, sugarcrmAccount)" md-cell class="remoteUri ">{{sugarcrmAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(sugarcrmAccount, $event    )" translate="INTEGRATIONS.EDIT_SUGARCRMACCOUNT">\n                          Edit SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(sugarcrmAccount, $event    )" translate="INTEGRATIONS.TEST_SUGARCRMACCOUNT">\n                          Test SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(sugarcrmAccount, $event    )" translate="INTEGRATIONS.DELETE_SUGARCRMACCOUNT">\n                          Delete SugarcrmAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.sugarcrmAccounts.count}}" md-on-paginate="vm.getSugarcrmAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SUGARCRMACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SUGARCRMACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-sugarcrmAccount-button" ng-click="vm.createOrEditSugarcrmAccount($event)" aria-label="add sugarcrmAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_SUGARCRMACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SUGARCRMACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/vtigerAccounts/create/dialog.html",'<md-dialog class="vtigerAccount-dialog" aria-label="New VtigerAccount">\n  <form name="vtigerAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.vtigerAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="vtigerAccountForm[\'name\'].$error" ng-show="vtigerAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.vtigerAccount.description">\n\n        <div ng-messages="vtigerAccountForm[\'description\'].$error" ng-show="vtigerAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.VTIGER_USER_NAME">vTiger_User_Name</label>\n        <input type="text" name="username" ng-model="vm.vtigerAccount.username" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'username\'].$error" ng-show="vtigerAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.VTIGER_USER_NAME_REQUIRED">vTiger_User_Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.ACCESS_KEY">Access_Key</label>\n        <input type="text" name="accessKey" ng-model="vm.vtigerAccount.accessKey" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'accessKey\'].$error" ng-show="vtigerAccountForm[\'accessKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.ACCESS_KEY_REQUIRED">Access_Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <input type="url" name="remoteUri" ng-model="vm.vtigerAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="vtigerAccountForm[\'remoteUri\'].$error" ng-show="vtigerAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.vtigerAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="vtigerAccountForm[\'serverUrl\'].$error" ng-show="vtigerAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVtigerAccount" ng-click="vm.saveVtigerAccount()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountForm.$invalid || vtigerAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVtigerAccount" ng-click="vm.addNewVtigerAccount()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_VTIGERACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERACCOUNT">\n          ADD VTIGERACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVtigerAccount" ng-click="vm.deleteVtigerAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/configurations/dialog.html",'<md-dialog class="vtigerConfiguration-dialog" aria-label="New VtigerConfiguration">\n  <form name="vtigerConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.vtigerConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="vtigerConfigurationForm[\'name\'].$error" ng-show="vtigerConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.vtigerConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="vtigerConfigurationForm[\'channel\'].$error" ng-show="vtigerConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.vtigerConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="vtigerConfigurationForm[\'type\'].$error" ng-show="vtigerConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVtigerConfiguration" ng-click="vm.saveVtigerConfiguration()" class="send-button md-accent md-raised" ng-disabled="vtigerConfigurationForm.$invalid || vtigerConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVtigerConfiguration" ng-click="vm.addNewVtigerConfiguration()" class="send-button md-accent md-raised" ng-disabled="vtigerConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_VTIGERCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERCONFIGURATION">\n          ADD VTIGERCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVtigerConfiguration" ng-click="vm.deleteVtigerConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/item/dialog.html",'<md-dialog class="vtigerAccount-item-dialog" aria-label="New Item">\n  <form name="vtigerAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="vtigerAccountItemForm.key.$error" ng-show="vtigerAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.keyType.$error" ng-show="vtigerAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="vtigerAccountItemForm.keyContent.$error" ng-show="vtigerAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="vtigerAccountItemForm.customField.$error" ng-show="vtigerAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="vtigerAccountItemForm.$invalid || vtigerAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="vtigerAccountItemForm.option.$error" ng-show="vtigerAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="vtigerAccountItemForm.content.$error" ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="vtigerAccountItemForm.variableName.$error" ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="vtigerAccountItemForm.type.$error" ng-show="vtigerAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="vtigerAccountItemForm.content.$error"\n          ng-show="vtigerAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="vtigerAccountItemForm.variableName.$error"\n          ng-show="vtigerAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/vtigerAccounts/edit/view.html",'<div id="integrations-vtigerAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-vtigerAccounts-button md-icon-button" aria-label="Go to vtigerAccounts" ng-click="vm.gotoVtigerAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_VTIGERACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="vtigerAccount-image" hide-xs>\n          <img ng-src="assets/images/business/vtigerAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.vtigerAccount.id}}\n            <span ng-if="vm.vtigerAccount.name">{{vm.vtigerAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.vtigerAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVtigerAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="vtigerAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.vtigerAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.vtigerAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.VTIGER_USER_NAME">vTiger_User_Name</label>\n                <input type="text" name="username" ng-model="vm.vtigerAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.VTIGER_USER_NAME_REQUIRED">vTiger_User_Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.ACCESS_KEY">Access_Key</label>\n                <input type="text" name="accessKey" ng-model="vm.vtigerAccount.accessKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accessKey\'].$error" ng-show="generalForm[\'accessKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.ACCESS_KEY_REQUIRED">Access_Key field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <input type="url" name="remoteUri" ng-model="vm.vtigerAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_MUST_VALID_URL">Host must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.vtigerAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="vtigerAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="VtigerAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.vtigerAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditVtigerConfiguration($event)" class="md-icon-button" aria-label="create vtigerConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="vtigerConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedVtigerConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getVtigerConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ vtigerConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteVtigerConfiguration($event, vtigerConfiguration)" translate="INTEGRATIONS.DELETE_VTIGERCONFIGURATION">\n                            Delete VtigerConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditVtigerConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/vtigerAccounts/vtigerAccounts.html",'<div id="vtigerAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.VTIGERACCOUNTS">VtigerAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVtigerAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVtigerAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-vtigerAccounts-count">\n          <span>{{vm.selectedVtigerAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVtigerAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVtigerAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVtigerAccounts" csv-label="true" filename="vtigerAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVtigerAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VTIGERACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVtigerAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVtigerAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.VTIGER_USER_NAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.vtigerAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="vtigerAccount" md-select-id="id" ng-repeat="vtigerAccount in vm.vtigerAccounts.rows">\n                <td md-cell ng-if="vtigerAccount.userpic"><img class="avatar" alt="{{vtigerAccount.name}}" ng-src="api/users/{{vtigerAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!vtigerAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{vtigerAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="id ">{{vtigerAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="name ">{{vtigerAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="username ">{{vtigerAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(vtigerAccount, ev) : vm.createOrEditVtigerAccount($event, vtigerAccount)" md-cell class="remoteUri ">{{vtigerAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(vtigerAccount, $event    )" translate="INTEGRATIONS.EDIT_VTIGERACCOUNT">\n                          Edit VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(vtigerAccount, $event    )" translate="INTEGRATIONS.TEST_VTIGERACCOUNT">\n                          Test VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(vtigerAccount, $event    )" translate="INTEGRATIONS.DELETE_VTIGERACCOUNT">\n                          Delete VtigerAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.vtigerAccounts.count}}" md-on-paginate="vm.getVtigerAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VTIGERACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VTIGERACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-vtigerAccount-button" ng-click="vm.createOrEditVtigerAccount($event)" aria-label="add vtigerAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_VTIGERACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VTIGERACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/zendeskAccounts/create/dialog.html",'<md-dialog class="zendeskAccount-dialog" aria-label="New ZendeskAccount">\n  <form name="zendeskAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.zendeskAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="zendeskAccountForm[\'name\'].$error" ng-show="zendeskAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zendeskAccount.type" required>\n\n          <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n          <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskAccountForm[\'type\'].$error" ng-show="zendeskAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.zendeskAccount.username" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'username\'].$error" ng-show="zendeskAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.URI">Uri</label>\n        <input type="url" name="remoteUri" ng-model="vm.zendeskAccount.remoteUri" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'remoteUri\'].$error" ng-show="zendeskAccountForm[\'remoteUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n        <md-select name="authType" ng-model="vm.zendeskAccount.authType" required>\n          <md-option ng-value="\'password\'">Password</md-option>\n          <md-option ng-value="\'token\'">Token</md-option>\n        </md-select>\n        <div ng-messages="zendeskAccountForm[\'authType\'].$error" ng-show="zendeskAccountForm[\'authType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.zendeskAccount.authType == \'password\'">\n        <label translate="INTEGRATIONS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.zendeskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n        <div ng-messages="zendeskAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.zendeskAccount.authType == \'token\'" class="md-block">\n        <label translate="INTEGRATIONS.TOKEN">Token</label>\n        <input type="text" name="token" ng-model="vm.zendeskAccount.token" ng-required="true">\n\n        <div ng-messages="zendeskAccountForm[\'token\'].$error" ng-show="zendeskAccountForm[\'token\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TOKEN_REQUIRED">Token field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.zendeskAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="zendeskAccountForm[\'serverUrl\'].$error" ng-show="zendeskAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.zendeskAccount.description">\n\n        <div ng-messages="zendeskAccountForm[\'description\'].$error" ng-show="zendeskAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZendeskAccount" ng-click="vm.saveZendeskAccount()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountForm.$invalid || zendeskAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZendeskAccount" ng-click="vm.addNewZendeskAccount()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZENDESKACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKACCOUNT">\n          ADD ZENDESKACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZendeskAccount" ng-click="vm.deleteZendeskAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/item/dialog.html",'<md-dialog class="zendeskAccount-item-dialog" aria-label="New Item">\n  <form name="zendeskAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="zendeskAccountItemForm.content.$error" ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="zendeskAccountItemForm.key.$error" ng-show="zendeskAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.keyType.$error" ng-show="zendeskAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="zendeskAccountItemForm.keyContent.$error" ng-show="zendeskAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.variableName.$error" ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="zendeskAccountItemForm.customField.$error" ng-show="zendeskAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountItemForm.$invalid || zendeskAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="zendeskAccountItemForm.$invalid || zendeskAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="zendeskAccountItemForm.option.$error" ng-show="zendeskAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="zendeskAccountItemForm.content.$error" ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="zendeskAccountItemForm.variableName.$error" ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="zendeskAccountItemForm.type.$error" ng-show="zendeskAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="zendeskAccountItemForm.content.$error"\n          ng-show="zendeskAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="zendeskAccountItemForm.variableName.$error"\n          ng-show="zendeskAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/view.html",'<div id="integrations-zendeskAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-zendeskAccounts-button md-icon-button" aria-label="Go to zendeskAccounts" ng-click="vm.gotoZendeskAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_ZENDESKACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="zendeskAccount-image" hide-xs>\n          <img ng-src="assets/images/business/zendeskAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.zendeskAccount.id}}\n            <span ng-if="vm.zendeskAccount.name">{{vm.zendeskAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.zendeskAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveZendeskAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (zendeskConfigurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zendeskAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.zendeskAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.zendeskAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'integrationTab\'"> {{ \'INTEGRATIONS.INTEGRATION_TAB\' | translate }} </md-option>\n\n                  <md-option ng-value="\'newTab\'"> {{ \'INTEGRATIONS.NEW_TAB\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.zendeskAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.URI">Uri</label>\n                <input type="url" name="remoteUri" ng-model="vm.zendeskAccount.remoteUri" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'remoteUri\'].$error" ng-show="generalForm[\'remoteUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.URI_REQUIRED">Uri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.URI_MUST_VALID_URL">Uri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.AUTHTYPE">AuthType</label>\n                <md-select name="authType" ng-model="vm.zendeskAccount.authType" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'password\'">Password</md-option>\n                  <md-option ng-value="\'token\'">Token</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'authType\'].$error" ng-show="generalForm[\'authType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.AUTHTYPE_REQUIRED">AuthType field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.zendeskAccount.authType == \'password\'">\n                <label translate="INTEGRATIONS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.zendeskAccount.password" placeholder="Password" translate translate-attr-placeholder="INTEGRATIONS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="INTEGRATIONS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.zendeskAccount.authType == \'token\'" class="md-block">\n                <label translate="INTEGRATIONS.TOKEN">Token</label>\n                <input type="text" name="token" ng-model="vm.zendeskAccount.token" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'token\'].$error" ng-show="generalForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.TOKEN_REQUIRED">Token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.zendeskAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.zendeskAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zendeskAccount-detail-form-container zendeskconfigurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.ZENDESKCONFIGURATIONS">ZENDESKCONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ZendeskAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.zendeskAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZendeskConfiguration($event)" class="md-icon-button" aria-label="create zendeskConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="zendeskConfiguration in vm_cc.zendeskConfigurations" class="border-top" md-colors="{background: (vm_cc.selectedZendeskConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getZendeskConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ zendeskConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteZendeskConfiguration($event, zendeskConfiguration)" translate="INTEGRATIONS.DELETE_ZENDESKCONFIGURATION">\n                            Delete ZendeskConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.zendeskConfigurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.TAGS">TAGS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-table-container class="md-whiteframe-1dp padding-20">\n                        <md-input-container class="md-block">\n                          <label translate="INTEGRATIONS.TAGS">Tags</label>\n                          <md-select ng-model="vm_cc.selectedTags" ng-change="vm_cc.selectTagsChanged($event)" multiple>\n                            <md-option ng-value="tag.id" ng-repeat="tag in vm_cc.tags">{{ tag.name }}</md-option>\n                          </md-select>\n                        </md-input-container>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.zendeskConfigurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZendeskConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/zendeskAccounts/edit/zendeskConfigurations/dialog.html",'<md-dialog class="zendeskConfiguration-dialog" aria-label="New ZendeskConfiguration">\n  <form name="zendeskConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.zendeskConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="zendeskConfigurationForm[\'name\'].$error" ng-show="zendeskConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.zendeskConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskConfigurationForm[\'channel\'].$error" ng-show="zendeskConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zendeskConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zendeskConfigurationForm[\'type\'].$error" ng-show="zendeskConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZendeskConfiguration" ng-click="vm.saveZendeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="zendeskConfigurationForm.$invalid || zendeskConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZendeskConfiguration" ng-click="vm.addNewZendeskConfiguration()" class="send-button md-accent md-raised" ng-disabled="zendeskConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZENDESKCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKCONFIGURATION">\n          ADD ZENDESKCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZendeskConfiguration" ng-click="vm.deleteZendeskConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zendeskAccounts/zendeskAccounts.html",'<div id="zendeskAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.ZENDESKACCOUNTS">ZendeskAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedZendeskAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedZendeskAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-zendeskAccounts-count">\n          <span>{{vm.selectedZendeskAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllZendeskAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectZendeskAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedZendeskAccounts" csv-label="true" filename="zendeskAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedZendeskAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ZENDESKACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedZendeskAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getZendeskAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="username">{{ \'INTEGRATIONS.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="remoteUri">{{ \'INTEGRATIONS.URI\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.zendeskAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="zendeskAccount" md-select-id="id" ng-repeat="zendeskAccount in vm.zendeskAccounts.rows">\n                <td md-cell ng-if="zendeskAccount.userpic"><img class="avatar" alt="{{zendeskAccount.name}}" ng-src="api/users/{{zendeskAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!zendeskAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{zendeskAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="id ">{{zendeskAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="name ">{{zendeskAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="username ">{{zendeskAccount.username}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zendeskAccount, ev) : vm.createOrEditZendeskAccount($event, zendeskAccount)" md-cell class="remoteUri ">{{zendeskAccount.remoteUri}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(zendeskAccount, $event    )" translate="INTEGRATIONS.EDIT_ZENDESKACCOUNT">\n                          Edit ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(zendeskAccount, $event    )" translate="INTEGRATIONS.TEST_ZENDESKACCOUNT">\n                          Test ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(zendeskAccount, $event    )" translate="INTEGRATIONS.DELETE_ZENDESKACCOUNT">\n                          Delete ZendeskAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.zendeskAccounts.count}}" md-on-paginate="vm.getZendeskAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ZENDESKACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ZENDESKACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-zendeskAccount-button" ng-click="vm.createOrEditZendeskAccount($event)" aria-label="add zendeskAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_ZENDESKACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ZENDESKACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/integrations/views/zohoAccounts/create/dialog.html",'<md-dialog class="zohoAccount-dialog" aria-label="New ZohoAccount">\n  <form name="zohoAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.zohoAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="zohoAccountForm[\'name\'].$error" ng-show="zohoAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.HOST">Host</label>\n        <md-select name="host" ng-model="vm.zohoAccount.host" required>\n          <md-option ng-value="\'zoho.com\'">zoho.com</md-option>\n          <md-option ng-value="\'zoho.eu\'">zoho.eu</md-option>\n        </md-select>\n        <div ng-messages="zohoAccountForm[\'host\'].$error" ng-show="zohoAccountForm[\'host\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.ZONE">Zone</label>\n        <md-select name="zone" ng-model="vm.zohoAccount.zone" required>\n          <md-option ng-value="\'US\'">US</md-option>\n          <md-option ng-value="\'AU\'">AU</md-option>\n          <md-option ng-value="\'EU\'">EU</md-option>\n          <md-option ng-value="\'IN\'">IN</md-option>\n          <md-option ng-value="\'CN\'">CN</md-option>\n        </md-select>\n        <div class="hint"><span translate="INTEGRATIONS.HELP.ZONE"></span></div>\n        <div ng-messages="zohoAccountForm[\'zone\'].$error" ng-show="zohoAccountForm[\'zone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.ZONE_REQUIRED">Zone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n        <input type="text" name="clientId" ng-model="vm.zohoAccount.clientId" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTID"></span></div>\n        <div ng-messages="zohoAccountForm[\'clientId\'].$error" ng-show="zohoAccountForm[\'clientId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n        <input type="text" name="clientSecret" ng-model="vm.zohoAccount.clientSecret" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTSECRET"></span></div>\n        <div ng-messages="zohoAccountForm[\'clientSecret\'].$error" ng-show="zohoAccountForm[\'clientSecret\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CODE">Code</label>\n        <input type="text" name="code" ng-model="vm.zohoAccount.code" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.CODE"></span></div>\n        <div ng-messages="zohoAccountForm[\'code\'].$error" ng-show="zohoAccountForm[\'code\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CODE_REQUIRED">Code field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n        <input type="url" name="serverUrl" ng-model="vm.zohoAccount.serverUrl" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n        <div ng-messages="zohoAccountForm[\'serverUrl\'].$error" ng-show="zohoAccountForm[\'serverUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.zohoAccount.description">\n\n        <div ng-messages="zohoAccountForm[\'description\'].$error" ng-show="zohoAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZohoAccount" ng-click="vm.saveZohoAccount()" class="send-button md-accent md-raised" ng-disabled="zohoAccountForm.$invalid || zohoAccountForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZohoAccount" ng-click="vm.addNewZohoAccount()" class="send-button md-accent md-raised" ng-disabled="zohoAccountForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZOHOACCOUNT" translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOACCOUNT">\n          ADD ZOHOACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZohoAccount" ng-click="vm.deleteZohoAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/configurations/dialog.html",'<md-dialog class="zohoConfiguration-dialog" aria-label="New ZohoConfiguration">\n  <form name="zohoConfigurationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.zohoConfiguration.name" ng-required="true" autofocus>\n\n        <div ng-messages="zohoConfigurationForm[\'name\'].$error" ng-show="zohoConfigurationForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.zohoConfiguration.channel" required>\n\n          <md-option ng-value="\'voice\'"> {{ \'INTEGRATIONS.VOICE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zohoConfigurationForm[\'channel\'].$error" ng-show="zohoConfigurationForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.zohoConfiguration.type" required>\n\n          <md-option ng-value="\'inbound\'"> {{ \'INTEGRATIONS.INBOUND_IN_QUEUE\' | translate }} </md-option>\n\n          <md-option ng-value="\'outbound\'"> {{ \'INTEGRATIONS.OUTBOUND_CALL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="zohoConfigurationForm[\'type\'].$error" ng-show="zohoConfigurationForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newZohoConfiguration" ng-click="vm.saveZohoConfiguration()" class="send-button md-accent md-raised" ng-disabled="zohoConfigurationForm.$invalid || zohoConfigurationForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newZohoConfiguration" ng-click="vm.addNewZohoConfiguration()" class="send-button md-accent md-raised" ng-disabled="zohoConfigurationForm.$invalid" aria-label="ADD" translate="INTEGRATIONS.ADD_ZOHOCONFIGURATION" translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOCONFIGURATION">\n          ADD ZOHOCONFIGURATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newZohoConfiguration" ng-click="vm.deleteZohoConfiguration($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/item/dialog.html",'<md-dialog class="zohoAccount-item-dialog" aria-label="New Item">\n  <form name="zohoAccountItemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div ng-switch="vm.type">\n        <div ng-switch-when="subject">\n          \x3c!-- SUBJECT SECTION --\x3e\n          <div ng-include="\'/subject.html\'"></div>\n          \x3c!-- / SUBJECT SECTION --\x3e\n        </div>\n        <div ng-switch-when="description">\n          \x3c!-- DESCRIPTION SECTION --\x3e\n          <md-input-container class="md-block">\n            <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n              <md-option value="string">String</md-option>\n              <md-option value="keyValue">Key Value</md-option>\n            </md-select>\n            <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                  required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n            <label translate="INTEGRATIONS.CONTENT">Content</label>\n            <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n            <div ng-messages="zohoAccountItemForm.content.$error" ng-show="zohoAccountItemForm.content.$touched" role="alert">\n              <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field\n                  is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <div ng-if="vm.item.type == \'keyValue\'">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.KEY">Key</label>\n              <input type="text" name="key" ng-model="vm.item.key" required md-autofocus>\n              <div ng-messages="zohoAccountItemForm.key.$error" ng-show="zohoAccountItemForm.key.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.KEY_REQUIRED">Key field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.TYPE">Type</label>\n              <md-select name="keyType" ng-model="vm.item.keyType" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.keyType.$error" ng-show="zohoAccountItemForm.keyType.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'string\'">\n              <label translate="INTEGRATIONS.CONTENT">Content</label>\n              <input type="text" name="keyContent" ng-model="vm.item.keyContent" required md-autofocus>\n              <div ng-messages="zohoAccountItemForm.keyContent.$error" ng-show="zohoAccountItemForm.keyContent.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content\n                    field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'variable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n                <md-optgroup label="Voice: Queue">\n                  <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n                  </md-option>\n                </md-optgroup>\n                <md-optgroup label="Voice: Outbound">\n                  <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}</md-option>\n                </md-optgroup>\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.variableName.$error" ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable\n                    name field is required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container class="md-block" ng-if="vm.item.keyType == \'customVariable\'">\n              <label translate="INTEGRATIONS.VALUE">Value</label>\n              <md-select ng-model="vm.item.VariableId" required>\n                <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}\n                </md-option>\n              </md-select>\n            </md-input-container>\n          </div>\n          \x3c!-- / DESCRIPTION SECTION --\x3e\n        </div>\n        <div ng-switch-when="field">\n          \x3c!-- FIELD SECTION --\x3e\n          <div ng-if="vm.accountConnected">\n            <md-input-container class="md-block">\n              <label translate="INTEGRATIONS.FIELD">FIELD</label>\n              \x3c!-- ITEM TYPE DEFAULT VALUE is STRING --\x3e\n              <md-select name="customField" ng-model="vm.customField" required ng-change="vm.item.type = \'string\'">\n\n                <md-optgroup label="Standard">\n                  <md-option ng-value="standard" ng-repeat="standard in vm.fields | filter: {custom: false} ">{{standard.name}}\n                  </md-option>\n                </md-optgroup>\n\n                <md-optgroup label="Custom">\n                  <md-option ng-value="custom" ng-repeat="custom in vm.fields | filter: {custom: true} ">{{custom.name}}\n                  </md-option>\n                </md-optgroup>\n\n              </md-select>\n              <div ng-messages="zohoAccountItemForm.customField.$error" ng-show="zohoAccountItemForm.customField.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="INTEGRATIONS.ERRORS.FIELD_REQUIRED">Field is\n                    required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            \x3c!-- FIELDS --\x3e\n            <div ng-if="vm.customField" ng-include="\'/fields.html\'"></div>\n            \x3c!-- FIELDS --\x3e\n\n          </div>\n          <div ng-if="!vm.accountConnected">\n            <p>Account is not connected. Please check your configurations!</p>\n          </div>\n          \x3c!-- / FIELD SECTION --\x3e\n        </div>\n        <div ng-switch-default>\n          <p>No Item</p>\n        </div>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newItem" ng-click="vm.saveItem()" class="send-button md-accent md-raised" ng-disabled="zohoAccountItemForm.$invalid || zohoAccountItemForm.$pristine" aria-label="SAVE" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newItem" ng-click="vm.addNewItem()" class="send-button md-accent md-raised" ng-disabled="zohoAccountItemForm.$invalid || zohoAccountItemForm.$pristine" aria-label="ADD" translate="INTEGRATIONS.ADD" translate-attr-aria-label="INTEGRATIONS.ADD">\n          ADD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newItem" ng-click="vm.deleteItem($event)" aria-label="DELETE" translate translate-attr-aria-label="INTEGRATIONS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="INTEGRATIONS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>\n\n<script type="text/ng-template" id="/fields.html">\n\n  \x3c!-- type --\x3e\n  <md-input-container class="md-block">\n\n    <label translate="INTEGRATIONS.TYPE">Type</label>\n    <md-select name="type" ng-model="vm.item.type" required>\n      <md-option value="string">String</md-option>\n      <md-option value="variable">Variable</md-option>\n      <md-option value="customVariable">Custom Variable</md-option>\n      <md-option ng-if="vm.customField.options.length" value="picklist">Picklist</md-option>\n    </md-select>\n    <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  \x3c!--/ type --\x3e\n\n  \x3c!-- value --\x3e\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'picklist\'">\n    \x3c!-- options --\x3e\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <md-select name="option" ng-model="vm.item.content" required>\n      <md-option ng-value="option.value" ng-repeat="option in vm.customField.options">{{option.name}}</md-option>\n    </md-select>\n\n    <div ng-messages="zohoAccountItemForm.option.$error" ng-show="zohoAccountItemForm.option.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n    <label translate="INTEGRATIONS.CONTENT">Content</label>\n\n    <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n\n    <div ng-messages="zohoAccountItemForm.content.$error" ng-show="zohoAccountItemForm.content.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()" required>\n      <md-optgroup label="Voice: Queue">\n        <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n        </md-option>\n      </md-optgroup>\n      <md-optgroup label="Voice: Outbound">\n        <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n        </md-option>\n      </md-optgroup>\n    </md-select>\n    <div ng-messages="zohoAccountItemForm.variableName.$error" ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n      <div ng-message="required">\n        <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n          required</span>\n      </div>\n    </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n    <label translate="INTEGRATIONS.VALUE">Value</label>\n    <md-select ng-model="vm.item.VariableId" required>\n      <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n    </md-select>\n  </md-input-container>\n\n  \x3c!--/ value --\x3e\n\n<\/script>\n\n<script type="text/ng-template" id="/subject.html">\n  <md-input-container class="md-block">\n        <label translate="INTEGRATIONS.TYPE">Type</label>\n            <md-select name="type" ng-model="vm.item.type" required>\n                <md-option value="string">String</md-option>\n                <md-option value="variable">Variable</md-option>\n                <md-option value="customVariable">Custom Variable</md-option>\n            </md-select>\n        <div ng-messages="zohoAccountItemForm.type.$error" ng-show="zohoAccountItemForm.type.$touched" role="alert">\n            <div ng-message="required">\n                <span translate="INTEGRATIONS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n             </div>\n        </div>\n  </md-input-container>\n  \n  <md-input-container class="md-block" ng-if="vm.item.type == \'string\'">\n      <label translate="INTEGRATIONS.CONTENT">Content</label>\n      <input type="text" name="content" ng-model="vm.item.content" required md-autofocus>\n      <div ng-messages="zohoAccountItemForm.content.$error"\n          ng-show="zohoAccountItemForm.content.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.CONTENT_REQUIRED">Content field is required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'variable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select name="variableName" ng-model="vm.item.variableName" md-selected-text="vm.getSelectedVariable()"\n          required>\n          <md-optgroup label="Voice: Queue">\n              <md-option ng-value="agentColumn" ng-repeat="agentColumn in vm.voiceAgentReportColumns">{{agentColumn}}\n              </md-option>\n          </md-optgroup>\n          <md-optgroup label="Voice: Outbound">\n              <md-option ng-value="dialColumn" ng-repeat="dialColumn in vm.voiceDialReportColumns">{{dialColumn}}\n              </md-option>\n          </md-optgroup>\n      </md-select>\n      <div ng-messages="zohoAccountItemForm.variableName.$error"\n          ng-show="zohoAccountItemForm.variableName.$touched" role="alert">\n          <div ng-message="required">\n              <span translate="INTEGRATIONS.ERRORS.VARIABLENAME_REQUIRED">Variable name field is\n                  required</span>\n          </div>\n      </div>\n  </md-input-container>\n\n  <md-input-container class="md-block" ng-if="vm.item.type == \'customVariable\'">\n      <label translate="INTEGRATIONS.VALUE">Value</label>\n      <md-select ng-model="vm.item.VariableId" required>\n          <md-option ng-value="variable.id" ng-repeat="variable in vm.variables">{{variable.name}}</md-option>\n      </md-select>\n  </md-input-container>\n  <\/script>'),e.put("app/main/apps/integrations/views/zohoAccounts/edit/view.html",'<div id="integrations-zohoAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-zohoAccounts-button md-icon-button" aria-label="Go to zohoAccounts" ng-click="vm.gotoZohoAccounts()" translate translate-attr-aria-label="INTEGRATIONS.GO_TO_ZOHOACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="zohoAccount-image" hide-xs>\n          <img ng-src="assets/images/business/zohoAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.zohoAccount.id}}\n            <span ng-if="vm.zohoAccount.name">{{vm.zohoAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="INTEGRATIONS.CREATED_AT"></span> <span>{{vm.zohoAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveZohoAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (configurationsForm.$invalid)" translate="INTEGRATIONS.SAVE" translate-attr-aria-label="INTEGRATIONS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zohoAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.zohoAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.HOST">Host</label>\n                <md-select name="host" ng-model="vm.zohoAccount.host" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'zoho.com\'">zoho.com</md-option>\n                  <md-option ng-value="\'zoho.eu\'">zoho.eu</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.ZONE">Zone</label>\n                <md-select name="zone" ng-model="vm.zohoAccount.zone" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'US\'">US</md-option>\n                  <md-option ng-value="\'AU\'">AU</md-option>\n                  <md-option ng-value="\'EU\'">EU</md-option>\n                  <md-option ng-value="\'IN\'">IN</md-option>\n                  <md-option ng-value="\'CN\'">CN</md-option>\n                </md-select>\n                <div class="hint"><span translate="INTEGRATIONS.HELP.ZONE"></span></div>\n                <div ng-messages="generalForm[\'zone\'].$error" ng-show="generalForm[\'zone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.ZONE_REQUIRED">Zone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTID">ClientId</label>\n                <input type="text" name="clientId" ng-model="vm.zohoAccount.clientId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTID"></span></div>\n                <div ng-messages="generalForm[\'clientId\'].$error" ng-show="generalForm[\'clientId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTID_REQUIRED">ClientId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CLIENTSECRET">ClientSecret</label>\n                <input type="text" name="clientSecret" ng-model="vm.zohoAccount.clientSecret" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CLIENTSECRET"></span></div>\n                <div ng-messages="generalForm[\'clientSecret\'].$error" ng-show="generalForm[\'clientSecret\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CLIENTSECRET_REQUIRED">ClientSecret field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.CODE">Code</label>\n                <input type="text" name="code" ng-model="vm.zohoAccount.code" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.CODE"></span></div>\n                <div ng-messages="generalForm[\'code\'].$error" ng-show="generalForm[\'code\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.CODE_REQUIRED">Code field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.REFRESHTOKEN">RefreshToken</label>\n                <input type="text" name="refreshToken" ng-model="vm.zohoAccount.refreshToken" disabled>\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.REFRESHTOKEN"></span></div>\n                <div ng-messages="generalForm[\'refreshToken\'].$error" ng-show="generalForm[\'refreshToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.REFRESHTOKEN_REQUIRED">RefreshToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.MOTIONPROXYADDRESS">MotionProxyAddress</label>\n                <input type="url" name="serverUrl" ng-model="vm.zohoAccount.serverUrl" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="INTEGRATIONS.HELP.MOTIONPROXYADDRESS"></span></div>\n                <div ng-messages="generalForm[\'serverUrl\'].$error" ng-show="generalForm[\'serverUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_REQUIRED">MotionProxyAddress field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="INTEGRATIONS.ERRORS.MOTIONPROXYADDRESS_MUST_VALID_URL">MotionProxyAddress must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="INTEGRATIONS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.zohoAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="INTEGRATIONS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="zohoAccount-detail-form-container configurations md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="INTEGRATIONS.CONFIGURATIONS">CONFIGURATIONS</div>\n            </div>\n            <div ng-controller="ZohoAccountConfigurationsController as vm_cc" ng-init="vm_cc.init(vm.zohoAccount, vm.crudPermissions)" layout="row">\n              <md-card class="md-whiteframe-1dp" flex="30">\n                <div layout="row" layout-align="center center">\n                  <md-subheader flex="75" class="md-no-sticky">{{ \'INTEGRATIONS.CONFIGURATIONS\' | translate }}</md-subheader>\n                  <md-button flex="25" ng-if="vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZohoConfiguration($event)" class="md-icon-button" aria-label="create zohoConfiguration">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n                <md-list>\n                  <md-list-item layout="row" layout-align="center center" ng-repeat="zohoConfiguration in vm_cc.configurations" class="border-top" md-colors="{background: (vm_cc.selectedZohoConfiguration == $index ? \'accent\' : \'grey-A100\')}" ng-click="vm_cc.getZohoConfiguration($index)">\n                    <span class="text-truncate" flex="80">{{ zohoConfiguration.name }}</span>\n                    <md-menu ng-if="vm_cc.crudPermissions.canDelete">\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                          <md-button ng-click="vm_cc.deleteZohoConfiguration($event, zohoConfiguration)" translate="INTEGRATIONS.DELETE_ZOHOCONFIGURATION">\n                            Delete ZohoConfiguration\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </md-list-item>\n                </md-list>\n              </md-card>\n              <div flex></div>\n              <md-card class="md-whiteframe-1dp" flex="65">\n                <md-tabs ng-if="vm_cc.configurations.length" md-dynamic-height>\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.SUBJECTS">SUBJECTS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.subject = query" on-collapse="vm_cc.query.subject = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditSubject($event)" aria-label="add subject" translate translate-attr-label="INTEGRATIONS.ADD_SUBJECT">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedSubjects.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedSubjects.length}} {{vm_cc.selectedSubjects.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedSubjects($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedSubjects">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="subject" md-select-id="id" ng-repeat="subject in vm_cc.subjects | filter: vm_cc.query.subject">\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="id ">{{subject.id}}</td>\n                              <td ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell class="type ">\n                                <span ng-if="subject.FieldId">{{subject.nameField || subject.idField}}</span>\n                                <span ng-if="!subject.FieldId">{{subject.type}}</span>\n                              </td>\n                              <td ng-switch="subject.type" ng-click="vm_cc.createOrEditSubject($event, subject)" md-cell>\n                                <span ng-switch-when="string">{{subject.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{subject.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{subject.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{subject.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[subject.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{subject.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditSubject($event, subject)" translate="INTEGRATIONS.EDIT_SUBJECT">\n                                        Edit Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteSubjectConfirm($event, subject)" translate="INTEGRATIONS.DELETE_SUBJECT">\n                                        Delete Subject\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.DESCRIPTIONS">DESCRIPTIONS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.description = query" on-collapse="vm_cc.query.description = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditDescription($event)" aria-label="add description" translate translate-attr-label="INTEGRATIONS.ADD_DESCRIPTION">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedDescriptions.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedDescriptions.length}} {{vm_cc.selectedDescriptions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedDescriptions($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedDescriptions">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="description" md-select-id="id" ng-repeat="description in vm_cc.descriptions | filter: vm_cc.query.description">\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="id ">{{description.id}}</td>\n                              <td ng-click="vm_cc.createOrEditDescription($event, description)" md-cell class="type ">\n                                <span ng-if="description.FieldId">{{description.nameField || description.idField}}</span>\n                                <span ng-if="!description.FieldId">{{description.type}}</span>\n                              </td>\n                              <td ng-switch="description.type" ng-click="vm_cc.createOrEditDescription($event, description)" md-cell>\n                                <span ng-switch-when="string">{{description.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{description.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{description.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{description.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[description.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{description.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditDescription($event, description)" translate="INTEGRATIONS.EDIT_DESCRIPTION">\n                                        Edit Description\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteDescriptionConfirm($event, description)" translate="INTEGRATIONS.DELETE_DESCRIPTION">\n                                        Delete Description\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.FIELDS">FIELDS</span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <md-toolbar class="md-table-toolbar md-default no-padding" ng-hide="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <div flex></div>\n                          <ms-search-bar on-search="vm_cc.query.field = query" on-collapse="vm_cc.query.field = undefined" debounce="300"></ms-search-bar>\n                          <md-button ng-if="vm_cc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_cc.createOrEditField($event)" aria-label="add field" translate translate-attr-label="INTEGRATIONS.ADD_FIELD">\n                            <md-icon md-font-icon="icon-plus"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_cc.selectedFields.length">\n                        <div class="md-toolbar-tools">\n                          <span class="md-subhead">{{vm_cc.selectedFields.length}} {{vm_cc.selectedFields.length > 1 ? \'items\' : \'item\'}} selected</span>\n                          <div flex></div>\n                          <md-button ng-if="vm_cc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_cc.deleteSelectedFields($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n                            <md-icon md-font-icon="icon-delete"></md-icon>\n                          </md-button>\n                        </div>\n                      </md-toolbar>\n                      <md-table-container class="md-whiteframe-1dp padding-horizontal">\n                        <table md-table md-row-select multiple ng-model="vm_cc.selectedFields">\n                          <thead md-head>\n                            <tr md-row>\n                              <th md-column>{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.TYPE\' | translate }}</th>\n                              <th md-column>{{ \'INTEGRATIONS.CONTENT\' | translate }}</th>\n                              <th md-column width="10px"></th>\n                            </tr>\n                          </thead>\n                          <tbody md-body>\n                            <tr md-row md-select="field" md-select-id="id" ng-repeat="field in vm_cc.fields | filter: vm_cc.query.field">\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="id ">{{field.id}}</td>\n                              <td ng-click="vm_cc.createOrEditField($event, field)" md-cell class="type ">\n                                <span ng-if="field.FieldId">{{field.nameField || field.idField}}</span>\n                                <span ng-if="!field.FieldId">{{field.type}}</span>\n                              </td>\n                              <td ng-switch="field.type" ng-click="vm_cc.createOrEditField($event, field)" md-cell>\n                                <span ng-switch-when="string">{{field.content}}</span>\n                                <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                <span ng-switch-when="keyValue">\n                                  {{field.key}}\n                                  <span ng-switch="description.keyType">\n                                    <span ng-switch-when="string">{{field.keyContent}}</span>\n                                    <span ng-switch-when="variable" class="text-boxed">{{field.variableName}}</span>\n                                    <span ng-switch-when="customVariable" class="text-boxed">{{ vm_cc.variablesById[field.VariableId].name }}</span>\n                                  </span>\n                                </span>\n                                <span ng-switch-default>{{field.content}}</span>\n                              </td>\n                              <td md-cell class="actions" ng-if="!vm_cc.crudPermissions.readOnly">\n                                <md-menu>\n                                  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                                    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                                  </md-button>\n\n                                  <md-menu-content width="3">\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canEdit">\n                                      <md-button ng-click="vm_cc.createOrEditField($event, field)" translate="INTEGRATIONS.EDIT_FIELD">\n                                        Edit Field\n                                      </md-button>\n                                    </md-menu-item>\n                                    <md-menu-item ng-if="vm_cc.crudPermissions.canDelete">\n                                      <md-button ng-click="vm_cc.deleteFieldConfirm($event, field)" translate="INTEGRATIONS.DELETE_FIELD">\n                                        Delete Field\n                                      </md-button>\n                                    </md-menu-item>\n                                  </md-menu-content>\n                                </md-menu>\n                              </td>\n                            </tr>\n                          </tbody>\n                        </table>\n                      </md-table-container>\n                    </md-tab-body>\n                  </md-tab>\n\n                  <md-tab>\n                    <md-tab-label>\n                      <span translate="INTEGRATIONS.ADVANCED">\n                        ADVANCED\n                      </span>\n                    </md-tab-label>\n                    <md-tab-body>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_SEARCH"></label>\n                        <md-select ng-model="vm_cc.zohoConfiguration.moduleSearch" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'contact_lead\', value: \'Contact & Lead\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                      <div layout-margin>\n                        <label translate="INTEGRATIONS.MODULE_CREATE"></label>\n                        <md-select ng-model="vm_cc.zohoConfiguration.moduleCreate" ng-change="vm_cc.selectChangedAdvanced()" ng-disabled="!vm_cc.crudPermissions.canEdit">\n                          <md-option ng-value="option.key" ng-repeat="option in [{key: \'nothing\', value: \'Nothing\'}, {key: \'contact\', value: \'Contact\'}, {key: \'lead\', value: \'Lead\'}]">\n                            {{ option.value }}</md-option>\n                        </md-select>\n                      </div>\n                    </md-tab-body>\n                  </md-tab>\n\n\n                </md-tabs>\n                <div class="padding-20" ng-if="!vm_cc.configurations.length && vm_cc.crudPermissions.canEdit" ng-click="vm_cc.createOrEditZohoConfiguration($event)" layout="row" layout-sm="column" layout-align="center center" layout-wrap>\n                  <div class="padding-20 md-whiteframe-3dp md-accent-bg" layout="column" layout-align="center center">\n                    <md-button class="md-icon-button">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                    <span aria-label="add configuration" translate translate-attr-label="INTEGRATIONS.ADD_CONFIGURATION">ADD CONFIGURATION</span>\n                  </div>\n                </div>\n              </md-card>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/integrations/views/zohoAccounts/zohoAccounts.html",'<div id="zohoAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-heart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="INTEGRATIONS.ZOHOACCOUNTS">ZohoAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="INTEGRATIONS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedZohoAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedZohoAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="INTEGRATIONS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-zohoAccounts-count">\n          <span>{{vm.selectedZohoAccounts.length}}</span>\n          <span translate="INTEGRATIONS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="INTEGRATIONS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllZohoAccounts()" translate="INTEGRATIONS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectZohoAccounts()" translate="INTEGRATIONS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedZohoAccounts" csv-label="true" filename="zohoAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedZohoAccounts($event)" aria-label="delete selected" translate translate-attr-label="INTEGRATIONS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- ZOHOACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedZohoAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getZohoAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'INTEGRATIONS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'INTEGRATIONS.NAME\' | translate }}</th>\n                <th md-column md-order-by="host">{{ \'INTEGRATIONS.HOST\' | translate }}</th>\n                <th md-column md-order-by="zone">{{ \'INTEGRATIONS.ZONE\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.zohoAccounts.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="INTEGRATIONS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="zohoAccount" md-select-id="id" ng-repeat="zohoAccount in vm.zohoAccounts.rows">\n                <td md-cell ng-if="zohoAccount.userpic"><img class="avatar" alt="{{zohoAccount.name}}" ng-src="api/users/{{zohoAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!zohoAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{zohoAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="id ">{{zohoAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="name ">{{zohoAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="host ">{{ vm.arrayhost[zohoAccount.host].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(zohoAccount, ev) : vm.createOrEditZohoAccount($event, zohoAccount)" md-cell class="zone ">{{ vm.arrayzone[zohoAccount.zone].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="INTEGRATIONS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(zohoAccount, $event    )" translate="INTEGRATIONS.EDIT_ZOHOACCOUNT">\n                          Edit ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.testtestintegrationaccount(zohoAccount, $event    )" translate="INTEGRATIONS.TEST_ZOHOACCOUNT">\n                          Test ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(zohoAccount, $event    )" translate="INTEGRATIONS.DELETE_ZOHOACCOUNT">\n                          Delete ZohoAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'INTEGRATIONS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'INTEGRATIONS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'INTEGRATIONS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.zohoAccounts.count}}" md-on-paginate="vm.getZohoAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / ZOHOACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD ZOHOACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-zohoAccount-button" ng-click="vm.createOrEditZohoAccount($event)" aria-label="add zohoAccount" translate translate-attr-aria-label="INTEGRATIONS.ADD_ZOHOACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD ZOHOACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/jscripty/views/projects/create/dialog.html",'<md-dialog class="project-dialog" aria-label="New Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newProject">\n\n        <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n        <div ng-messages="projectForm[\'name\'].$error" ng-show="projectForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.project.description">\n\n        <div ng-messages="projectForm[\'description\'].$error" ng-show="projectForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newProject" ng-click="vm.saveProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid || projectForm.$pristine" aria-label="SAVE" translate="JSCRIPTY.SAVE" translate-attr-aria-label="JSCRIPTY.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newProject" ng-click="vm.addNewProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid" aria-label="ADD" translate="JSCRIPTY.ADD_PROJECT" translate-attr-aria-label="JSCRIPTY.ADD_PROJECT">\n          ADD PROJECT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newProject" ng-click="vm.deleteProject($event)" aria-label="DELETE" translate translate-attr-aria-label="JSCRIPTY.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="JSCRIPTY.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/clone/clone.html",'<md-dialog class="project-dialog" aria-label="Clone Project">\n  <form name="projectForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="JSCRIPTY.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newProject">\n\n        <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n        <div ng-messages="projectForm[\'name\'].$error" ng-show="projectForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneProject()" class="send-button md-accent md-raised" ng-disabled="projectForm.$invalid" aria-label="CLONE" translate="JSCRIPTY.CLONE_PROJECT" translate-attr-aria-label="JSCRIPTY.CLONE_PROJECT">\n        CLONE PROJECT\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/sessions/dialog.html",'<md-dialog class="session-dialog" aria-label="New Session">\n  <form name="sessionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <md-list>\n        <md-subheader class="md-no-sticky">\n          <div class="margin-bottom-5"><span translate="JSCRIPTY.ANSWERS">Answers</span></div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.STARTTIME" class="ng-scope font-weight-700">Start Time</span>: <span class="ng-binding">{{vm.session.starttime | date:\'medium\'}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.MEMBERNAME" class="ng-scope font-weight-700">Member Name</span>: <span class="ng-binding">{{vm.session.membername}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.PROJECT" class="ng-scope font-weight-700">Project</span>: <span class="ng-binding">{{vm.project.name}}</span>\n          </div>\n        </md-subheader>\n        <md-list-item ng-if="vm.questions.rows.length" class="md-2-line contact-item" ng-repeat="question in vm.questions.rows">\n          <div class="md-list-item-text compact">\n            <h3>{{$index+1}}. {{question.question}}</h3>\n            <p>{{question.answer}}</p>\n          </div>\n          <md-divider ng-if="!$last"></md-divider>\n        </md-list-item>\n        <md-list-item ng-if="!vm.questions.rows.length" class="md-2-line contact-item">\n          <div class="md-list-item-text compact">\n            <h3><span class="text-boxed-light" translate="JSCRIPTY.NO_RESULTS_AVAILABLE">No results available</span></h3>\n          </div>\n        </md-list-item>\n      </md-list>\n\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/main/apps/jscripty/views/projects/edit/view.html",'<div id="jscripty-project" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-projects-button md-icon-button" aria-label="Go to projects" ng-click="vm.gotoProjects()" translate translate-attr-aria-label="JSCRIPTY.GO_TO_PROJECTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="project-image" hide-xs>\n          <img ng-src="assets/images/business/projects.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.project.id}}\n            <span ng-if="vm.project.name">{{vm.project.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="JSCRIPTY.CREATED_AT"></span> <span>{{vm.project.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.project, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="JSCRIPTY.CLONE_PROJECT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveProject()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (builderForm.$invalid) || (previewForm.$invalid) || (sessionsForm.$invalid) || (answersForm.$invalid)" translate="JSCRIPTY.SAVE" translate-attr-aria-label="JSCRIPTY.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="JSCRIPTY.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="JSCRIPTY.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.project.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="JSCRIPTY.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="JSCRIPTY.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="JSCRIPTY.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.project.enableUncompleteSave" aria-label="EnableUncompleteSave" ng-disabled="!vm.crudPermissions.canEdit"><span translate="JSCRIPTY.ENABLEUNCOMPLETESAVE">EnableUncompleteSave</span></md-switch>\n                <div class="hint"><span translate="JSCRIPTY.HELP.ENABLEUNCOMPLETESAVE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.project.sendUnpauseOnSubmit" aria-label="SendUnpauseOnSubmit" ng-disabled="!vm.crudPermissions.canEdit"><span translate="JSCRIPTY.SENDUNPAUSEONSUBMIT">SendUnpauseOnSubmit</span></md-switch>\n                <div class="hint"><span translate="JSCRIPTY.HELP.SENDUNPAUSEONSUBMIT"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="JSCRIPTY.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.project.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="JSCRIPTY.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.BUILDER">BUILDER</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container builder md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectBuilderController as vm_bc" ng-init="vm_bc.init(vm.project)">\n              <mw-form-builder ng-if="vm_bc.project.formData" form-data="vm_bc.project.formData" options="vm_bc.optionsBuilder" read-only="false"></mw-form-builder>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.PREVIEW">PREVIEW</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container preview md-background-bg md-whiteframe-1dp">\n            <div layout="column" layout-align="center" ng-controller="ProjectViewerController as vm_vc" ng-init="vm_vc.init(vm.project)">\n              <div layout="row" layout-align="center">\n                <md-button class="md-raised md-accent" aria-label="Reset" ng-click="vm_vc.resetViewer()">\n                  Reset\n                </md-button>\n              </div>\n              <mw-form-viewer ng-if="vm_vc.project.formData" form-data="vm_vc.project.formData" response-data="vm_vc.responseData" on-submit="vm_vc.onSubmit($event)" api="vm_vc.formViewer"></mw-form-viewer>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.SESSIONS">SESSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container sessions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectSessionsController as vm_dc" ng-init="vm_dc.init(vm.project, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedProjectSessions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="JSCRIPTY.SESSIONS">Sessions</span>\n                  <ms-search-bar on-search="vm_dc.getProjectSessions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedProjectSessions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedProjectSessions.length}} {{vm_dc.selectedProjectSessions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedProjectSessions" csv-label="true" filename="projects.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedProjectSessions($event)" aria-label="delete selected" translate translate-attr-label="JSCRIPTY.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedProjectSessions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getProjectSessions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'JSCRIPTY.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'JSCRIPTY.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'JSCRIPTY.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="membername">\n                        {{ \'JSCRIPTY.MEMBERNAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'JSCRIPTY.CALLERIDNUM\' | translate }}\n                      </th>\n                      <th md-column md-order-by="completed">\n                        {{ \'JSCRIPTY.COMPLETE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="session" md-select-id="id" ng-repeat="session in vm_dc.projectSessions.rows">\n                      <td md-cell>\n                        {{session.id}}\n                      </td>\n                      <td md-cell>\n                        {{ session.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ session.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{session.membername}}\n                      </td>\n                      <td md-cell>\n                        {{session.calleridnum}}\n                      </td>\n                      <td md-cell class="completed ">\n                        <md-icon md-colors="{color: {{session.completed ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{session.completed? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="JSCRIPTY.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.showQuestionsProjectSession($event, session)" translate="JSCRIPTY.SHOW_QUESTIONS_SESSION">\n                                Results Session\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(session, $event)" translate="JSCRIPTY.DELETE_SESSION">\n                                Delete Session\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.projectSessions.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="JSCRIPTY.NO_SESSION_AVAILABLE">No session available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'JSCRIPTY.PAGE\' | translate}}:\', rowsPerPage: \'{{\'JSCRIPTY.ROWSPERPAGE\' | translate}}:\', of: \'{{\'JSCRIPTY.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.projectSessions.count}}" md-on-paginate="vm_dc.getProjectSessions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="JSCRIPTY.ANSWERS">ANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="project-detail-form-container answers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="ProjectAnswersController as vm_an" ng-init="vm_an.init(vm.project, vm.userProfile)">\n              <div class="pb-16" layout="row">\n                <div class="h2 secondary-text" translate="JSCRIPTY.ANSWERS" flex>Answers</div>\n                <div layout="row" layout-align="space-between center" flex>\n                  <md-date-range localization-map="vm_an.localizationMap" ng-model="vm_an.pickerModel" auto-confirm="true" show-template="true" md-on-select="vm_an.getAnswers()" placeholder="{{ \'DASHBOARDS.ALL\' | translate }}"></md-date-range>\n                  <md-button type="button" ng-if="vm_an.currentUser.role === \'admin\' || vm_an.userProfile.downloadJscriptySessions" ng-disabled="!vm_an.answers" ng-click="vm_an.getSummary($event)" class="md-accent md-raised md-button ng-scope md-default-theme md-ink-ripple md-green-500-bg md-icon-button" title="{{\'JSCRIPTY.EXPORT_TO_CSV\' | translate}}">\n                    <md-icon md-font-icon="icon-file-excel" class="md-default-theme md-font material-icons icon-file-excel"></md-icon>\n                  </md-button>\n                </div>\n              </div>\n              <div layout="row">\n                <md-card class="md-whiteframe-1dp" ng-if="vm_an.answers && vm_an.hasIdAnswers" flex>\n                  <md-list>\n                    <md-list-item class="md-2-line contact-item" ng-repeat="(key, question) in vm_an.answers">\n                      <div class="md-list-item-text compact" layout-padding>\n                        <h3>{{question.question}}</h3>\n                        <md-table-container>\n                          <table md-table>\n                            <thead md-head>\n                              <tr md-row>\n                                <th md-column></th>\n                                <th md-column>#</th>\n                                <th md-column>%</th>\n                              </tr>\n                            </thead>\n                            <tbody md-body>\n                              <tr md-row ng-repeat="(key, value) in question.answers">\n                                <td md-cell>{{key}}</td>\n                                <td md-cell width="20px">{{value}}</td>\n                                <td md-cell width="20px">{{value*100/question.sum | number:1}}</td>\n                              </tr>\n                              <tr md-row>\n                                <td md-cell><b>{{\'JSCRIPTY.TOTAL\' | translate}}</b></td>\n                                <td md-cell width="20px"><b>{{question.sum}}</b></td>\n                                <td md-cell width="20px"><b>100</b></td>\n                              </tr>\n                            </tbody>\n                          </table>\n                        </md-table-container>\n                      </div>\n                      <md-divider ng-if="!$last"></md-divider>\n                    </md-list-item>\n                  </md-list>\n                </md-card>\n                <span ng-if="!vm_an.answers || !vm_an.hasIdAnswers" class="text-boxed-light" translate="JSCRIPTY.NO_ANSWERS_AVAILABLE">No answers available</span>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/jscripty/views/projects/projects.html",'<div id="projects" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-script" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="JSCRIPTY.PROJECTS">Projects</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="JSCRIPTY.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedProjects.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedProjects =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="JSCRIPTY.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-projects-count">\n          <span>{{vm.selectedProjects.length}}</span>\n          <span translate="JSCRIPTY.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="JSCRIPTY.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllProjects()" translate="JSCRIPTY.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectProjects()" translate="JSCRIPTY.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedProjects" csv-label="true" filename="projects.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedProjects($event)" aria-label="delete selected" translate translate-attr-label="JSCRIPTY.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- PROJECT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedProjects" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getProjects">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'JSCRIPTY.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'JSCRIPTY.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'JSCRIPTY.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'JSCRIPTY.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.projects.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="JSCRIPTY.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="project" md-select-id="id" ng-repeat="project in vm.projects.rows">\n                <td md-cell ng-if="project.userpic"><img class="avatar" alt="{{project.name}}" ng-src="api/users/{{project.id}}/avatar" /></td>\n                <td md-cell ng-if="!project.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{project.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="id ">{{project.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="name ">{{project.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="description ">{{project.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(project, ev) : vm.createOrEditProject($event, project)" md-cell class="createdAt ">{{project.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="JSCRIPTY.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(project, $event    )" translate="JSCRIPTY.EDIT_PROJECT">\n                          Edit Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(project, $event    )" translate="JSCRIPTY.CLONE_PROJECT">\n                          clone Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.sessionsgoto(project, $event    )" translate="JSCRIPTY.SESSIONS_PROJECT">\n                          Sessions Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(project, $event    )" translate="JSCRIPTY.DELETE_PROJECT">\n                          Delete Project\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'JSCRIPTY.PAGE\' | translate}}:\', rowsPerPage: \'{{\'JSCRIPTY.ROWSPERPAGE\' | translate}}:\', of: \'{{\'JSCRIPTY.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.projects.count}}" md-on-paginate="vm.getProjects" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PROJECT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PROJECT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-project-button" ng-click="vm.createOrEditProject($event)" aria-label="add project" translate translate-attr-aria-label="JSCRIPTY.ADD_PROJECT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PROJECT BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/mailAccounts/create/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newMailAccount ? \'MAIL.NEW_MAILACCOUNT\' : \'MAIL.EDIT_MAILACCOUNT\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus>\n\n        <div ng-messages="mailAccountForm[\'name\'].$error" ng-show="mailAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.mailAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="mailAccountForm[\'key\'].$error" ng-show="mailAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="MAIL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.EMAIL_ADDRESS">Email Address</label>\n        <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true">\n\n        <div ng-messages="mailAccountForm[\'email\'].$error" ng-show="mailAccountForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.EMAIL_ADDRESS_REQUIRED">Email Address field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="MAIL.ERRORS.EMAIL_ADDRESS_MUST_VALID">Email Address must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.mailAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountForm[\'ListId\'].$error" ng-show="mailAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.mailAccount.active" aria-label="Active"><span translate="MAIL.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.newMailAccount" class="md-block">\n        <label translate="MAIL.SERVICE">Service</label>\n        <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" required>\n          <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountForm[\'provider\'].$error" ng-show="mailAccountForm[\'provider\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.SERVICE_REQUIRED">Service field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'">\n        <div layout="row">\n          <md-input-container class="md-block mr-20 mb-0" flex>\n            <label translate="MAIL.IMAP_HOST">IMAP_Host</label>\n            <input type="text" name="Imap.host" ng-model="vm.mailAccount.Imap.host" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Imap.host\'].$error" ng-show="mailAccountForm[\'Imap.host\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.IMAP_HOST_REQUIRED">IMAP_Host field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block mb-0">\n            <label translate="MAIL.IMAP_PORT">IMAP Port</label>\n            <input type="number" name="Imap.port" ng-model="vm.mailAccount.Imap.port" value="465" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Imap.port\'].$error" ng-show="mailAccountForm[\'Imap.port\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.IMAP_PORT_REQUIRED">IMAP Port field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n\n      <div ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'">\n        <div layout="row">\n          <md-input-container class="md-block mr-20 mb-0" flex>\n            <label translate="MAIL.SMTP_HOST">SMTP Host</label>\n            <input type="text" name="Smtp.host" ng-model="vm.mailAccount.Smtp.host" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Smtp.host\'].$error" ng-show="mailAccountForm[\'Smtp.host\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.SMTP_HOST_REQUIRED">SMTP Host field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block mb-0">\n            <label translate="MAIL.SMTP_PORT">SMTP Port</label>\n            <input type="number" name="Smtp.port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true">\n            <div ng-messages="mailAccountForm[\'Smtp.port\'].$error" ng-show="mailAccountForm[\'Smtp.port\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="MAIL.ERRORS.SMTP_PORT_REQUIRED">SMTP Port field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n        </div>\n      </div>\n\n      <md-input-container ng-if="vm.newMailAccount && vm.mailAccount.provider === \'custom\'" class="md-block pt-0">\n        <md-switch ng-model="vm.mailAccount.authentication" aria-label="Authentication"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.newMailAccount && vm.mailAccount.provider === \'outlook365\'" class="md-block">\n        <md-switch ng-model="vm.mailAccount.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n      </md-input-container>\n\n      <div ng-if="vm.newMailAccount && vm.mailAccount.authentication && vm.mailAccount.provider">\n        <md-input-container class="md-block">\n          <label translate="MAIL.USERNAME">Username</label>\n          <input type="text" name="username" ng-model="vm.mailAccount.username" ng-required="true">\n          <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n          <div ng-messages="mailAccountForm[\'username\'].$error" ng-show="mailAccountForm[\'username\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.mailAccount.modernAuthentication" class="md-block">\n          <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n          <md-select name="cloudProvider" ng-model="vm.mailAccount.CloudProviderId" required>\n            <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n          </md-select>\n          <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n          <div ng-messages="mailAccountForm[\'cloudProvider\'].$error" ng-show="mailAccountForm[\'cloudProvider\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="!vm.mailAccount.modernAuthentication" class="md-block">\n          <label translate="MAIL.PASSWORD">Password</label>\n          <input type="password" name="password" ng-model="vm.mailAccount.password" translate-attr-placeholder="MAIL.PASSWORD" required>\n          <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n          <div ng-messages="mailAccountForm[\'password\'].$error" role="alert">\n            <div ng-message="required">\n              <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailAccount.description">\n        <div ng-messages="mailAccountForm[\'description\'].$error" ng-show="mailAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailAccount" ng-click="vm.saveMailAccount()" class="send-button md-accent md-raised" ng-disabled="mailAccountForm.$invalid || mailAccountForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailAccount" ng-click="vm.addNewMailAccount()" class="send-button md-accent md-raised" ng-disabled="mailAccountForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILACCOUNT" translate-attr-aria-label="MAIL.ADD_MAILACCOUNT">\n          ADD MAIL ACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailAccount" ng-click="vm.deleteMailAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/agentadd/agentadd.html",'<md-dialog class="mailAccount-dialog" aria-label="mailAccount" ng-init="vm.onInit()">\n  <form name="mailAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.AGENTADD_MAILACCOUNT">Add Agent to mailAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/agent/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'agent\'].$error" ng-show="mailAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'timeout\'].$error" ng-show="mailAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'times\'].$error" ng-show="mailAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.REPLY_TYPE">Reply_Type</label>\n        <md-select name="replyType" ng-model="vm.autoreply.replyType" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="0">Reply</md-option>\n          <md-option ng-value="1">Reply All</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'replyType\'].$error" ng-show="mailAccountFormApp[\'replyType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.REPLY_TYPE_REQUIRED">Reply_Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="MAIL.TEXT">Text</label>\n        <textarea aria-label="Text text" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.autoreply.text"></textarea>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/close/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'disposition\'].$error" ng-show="mailAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'condition\'].$error" ng-show="mailAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'truepriority\'].$error" ng-show="mailAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'falsepriority\'].$error" ng-show="mailAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'priority\'].$error" ng-show="mailAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/noop/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'value\'].$error" ng-show="mailAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/queue/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'queue\'].$error" ng-show="mailAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'timeout\'].$error" ng-show="mailAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/system/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="mailAccountFormApp[\'command\'].$error" ng-show="mailAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'variable\'].$error" ng-show="mailAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/apps/tag/dialog.html",'<md-dialog class="mailAccount-dialog" aria-label="New MailAccount">\n  <form name="mailAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="mailAccountFormApp[\'tag\'].$error" ng-show="mailAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveMailAccountApp()" class="send-button md-accent md-raised" ng-disabled="mailAccountFormApp.$invalid || mailAccountFormApp.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/mailCannedAnswers/dialog.html",'<md-dialog class="mailCannedAnswer-dialog" aria-label="New MailCannedAnswer">\n  <form name="mailCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.mailCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="mailCannedAnswerForm[\'key\'].$error" ng-show="mailCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="MAIL.VALUE">Value</label>\n        <textarea aria-label="Value value" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailCannedAnswer.value"></textarea>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailCannedAnswer.description">\n\n        <div ng-messages="mailCannedAnswerForm[\'description\'].$error" ng-show="mailCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailCannedAnswer" ng-click="vm.saveMailCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="mailCannedAnswerForm.$invalid || mailCannedAnswerForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailCannedAnswer" ng-click="vm.addNewMailCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="mailCannedAnswerForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILCANNEDANSWER" translate-attr-aria-label="MAIL.ADD_MAILCANNEDANSWER">\n          ADD MAILCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailCannedAnswer" ng-click="vm.deleteMailCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailAccounts/edit/view.html",'<div id="mail-mailAccount" class="page-layout simple tabbed" layout="column">\n\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-mailAccounts-button md-icon-button" aria-label="Go to mailAccounts" ng-click="vm.goToMailAccounts()" translate translate-attr-aria-label="MAIL.GO_TO_MAILACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="mailAccount-image" hide-xs>\n          <img ng-src="assets/images/business/mailAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.mailAccount.id}}\n            <span ng-if="vm.mailAccount.name">{{vm.mailAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MAIL.CREATED_AT"></span> <span>{{vm.mailAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.goToRealtime()" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MAIL.GOTO_MAILACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.addAgent(vm.mailAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MAIL.AGENTADD_MAILACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMailAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (credentialsForm.$invalid) || (templateForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (imapForm.$invalid) || (smtpForm.$invalid) || (dispositionForm.$invalid) || (mailDispositionsForm.$invalid) || (mailCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.mailAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="MAIL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SERVICE">Service</label>\n                <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" class="mb-20" required>\n                  <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'provider\'].$error" ng-show="generalForm[\'provider\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.EMAIL_ADDRESS">Email_Address</label>\n                <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.EMAIL_ADDRESS_REQUIRED">Email_Address field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="MAIL.ERRORS.EMAIL_ADDRESS_MUST_VALID">Email_Address must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.mailAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.active" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.markAsUnread" aria-label="mark_as_unread" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.MARK_AS_UNREAD">mark_as_unread</span></md-switch>\n                <div class="hint"><span translate="MAIL.HELP.MARK_AS_UNREAD"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.mailAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.mailAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="MAIL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.mailAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider !== \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.AUTHENTICATION">Authentication</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.CREDENTIALS">Credentials</div>\n            </div>\n            <form name="credentialsForm" novalidate>\n              <md-input-container ng-if="vm.mailAccount.provider === \'outlook365\'" class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.mailAccount.Imap.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="credentialsForm[\'username\'].$error" ng-show="credentialsForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Imap.modernAuthentication" class="md-block">\n                <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n                <md-select name="cloudProvider" ng-model="vm.mailAccount.Imap.CloudProviderId" required>\n                  <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n                <div ng-messages="credentialsForm[\'cloudProvider\'].$error" ng-show="credentialsForm[\'cloudProvider\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.mailAccount.Imap.modernAuthentication" class="md-block">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.mailAccount.Imap.password" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="credentialsForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container imap md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.IMAP">IMAP</div>\n            </div>\n            <form name="imapForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.tls" aria-label="ssl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SSL">ssl</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.MAILBOX">Mailbox</label>\n                <input type="text" name="Imap.mailbox" ng-model="vm.mailAccount.Imap.mailbox" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.mailbox\'].$error" ng-show="imapForm[\'Imap.mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MAILBOX_REQUIRED">mailbox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.CONNTIMEOUT">Connection Timeout</label>\n                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.connTimeout\'].$error" ng-show="imapForm[\'Imap.connTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_REQUIRED">Connection Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Connection Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AUTHTIMEOUT">Authorization Timeout</label>\n                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" value="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.authTimeout\'].$error" ng-show="imapForm[\'Imap.authTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_REQUIRED">Authorizazion Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Authorizazion Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider === \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.IMAP">IMAP</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container imap md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.IMAP">IMAP</div>\n            </div>\n            <form name="imapForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.IMAP_HOST">IMAP_Host</label>\n                <input type="text" name="Imap.host" ng-model="vm.mailAccount.Imap.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.host\'].$error" ng-show="imapForm[\'Imap.host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.IMAP_HOST_REQUIRED">IMAP_Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.IMAP_PORT">IMAP_Port</label>\n                <input type="number" name="Imap.port" ng-model="vm.mailAccount.Imap.port" value="465" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.port\'].$error" ng-show="imapForm[\'Imap.port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.IMAP_PORT_REQUIRED">IMAP_Port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.tls" aria-label="ssl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SSL">ssl</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Imap.authentication" aria-label="Authentication" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Imap.authentication" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="Imap.user" ng-model="vm.mailAccount.Imap.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="imapForm[\'Imap.user\'].$error" ng-show="imapForm[\'Imap.user\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.mailAccount.Imap.authentication">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="Imap.password" ng-model="vm.mailAccount.Imap.password" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="imapForm[\'Imap.password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.MAILBOX">Mailbox</label>\n                <input type="text" name="Imap.mailbox" ng-model="vm.mailAccount.Imap.mailbox" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.mailbox\'].$error" ng-show="imapForm[\'Imap.mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MAILBOX_REQUIRED">mailbox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.CONNTIMEOUT">Connection Timeout</label>\n                <input type="number" name="Imap.connTimeout" ng-model="vm.mailAccount.Imap.connTimeout" min="1" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.connTimeout\'].$error" ng-show="imapForm[\'Imap.connTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_REQUIRED">Connection Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.CONNTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Connection Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AUTHTIMEOUT">Authorization Timeout</label>\n                <input type="number" name="Imap.authTimeout" ng-model="vm.mailAccount.Imap.authTimeout" min="1" value="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="imapForm[\'Imap.authTimeout\'].$error" ng-show="imapForm[\'Imap.authTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_REQUIRED">Authorization Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AUTHTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Authorization Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.mailAccount.provider === \'custom\'">\n        <md-tab-label>\n          <span translate="MAIL.SMTP">SMTP</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container smtp md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.SMTP">SMTP</div>\n            </div>\n            <form name="smtpForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SMTP_HOST">SMTP_Host</label>\n                <input type="text" name="Smtp.host" ng-model="vm.mailAccount.Smtp.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="smtpForm[\'Smtp.host\'].$error" ng-show="smtpForm[\'Smtp.host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.SMTP_HOST_REQUIRED">SMTP_Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.SMTP_PORT">SMTP_Port</label>\n                <input type="number" name="Smtp.port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="smtpForm[\'Smtp.port\'].$error" ng-show="smtpForm[\'Smtp.port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.SMTP_PORT_REQUIRED">SMTP_Port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Smtp.secure" aria-label="Secure" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.SECURE">Secure</span></md-switch>\n                <div class="hint"><span translate="MAIL.HELP.SECURE"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.Smtp.authentication" aria-label="Authentication" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AUTHENTICATION">Authentication</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.Smtp.authentication" class="md-block">\n                <label translate="MAIL.USERNAME">Username</label>\n                <input type="text" name="Smtp.user" ng-model="vm.mailAccount.Smtp.user" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MAIL.HELP.USERNAME"></span></div>\n                <div ng-messages="smtpForm[\'Smtp.user\'].$error" ng-show="smtpForm[\'Smtp.user\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.mailAccount.Smtp.authentication">\n                <label translate="MAIL.PASSWORD">Password</label>\n                <input type="password" name="Smtp.pass" ng-model="vm.mailAccount.Smtp.pass" placeholder="Password" translate translate-attr-placeholder="MAIL.PASSWORD" required>\n                <div class="hint"><span translate="MAIL.HELP.PASSWORD"></span></div>\n                <div ng-messages="smtpForm[\'Smtp.pass\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container template md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.TEMPLATE">TEMPLATE</div>\n            </div>\n            <form name="templateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.FONT_FAMILY">Font_Family</label>\n                <ms-font-family name="fontFamily" ng-model="vm.mailAccount.fontFamily" required></ms-font-family>\n                <div class="hint"><span translate="MAIL.HELP.FONT_FAMILY"></span></div>\n                <div ng-messages="templateForm[\'fontFamily\'].$error" ng-show="templateForm[fontFamily].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FONT_FAMILY_REQUIRED">Font_Family field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.FONT_SIZE">Font_Size</label>\n                <input type="number" name="fontSize" ng-model="vm.mailAccount.fontSize" min="8" max="72" value="13" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MAIL.HELP.FONT_SIZE"></span></div>\n                <div ng-messages="templateForm[\'fontSize\'].$error" ng-show="templateForm[\'fontSize\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_REQUIRED">Font_Size field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Font_Size must be a valid greater or equal than</span> <span>8</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.FONT_SIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">Font_Size must be a valid greater or equal than</span> <span>72</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="MAIL.TEMPLATE">Template</label>\n                <textarea aria-label="Template template" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailAccount.template"></textarea>\n              </div>\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="MAIL.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.mailAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.queueTransfer == true" class="md-block">\n                <label translate="MAIL.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.mailAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.agentTransfer == true" class="md-block">\n                <label translate="MAIL.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.mailAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n\n          <div class="mailAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.mailAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MAIL.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.mailAccount.mandatoryDisposition" class="md-block">\n                <label translate="MAIL.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.mailAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MAIL.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="MailAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="mailAccount-detail-form-container maildispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="MAIL.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add mail dispositions" translate translate-attr-label="MAIL.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="mailAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container mailcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountMailCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountMailCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MAIL.MAILCANNEDANSWERS">MailCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getMailAccountMailCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event)" aria-label="add mailCannedAnswer" translate translate-attr-label="MAIL.ADD_MAILCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMailAccountMailCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMailAccountMailCannedAnswers.length}} {{vm_dc.selectedMailAccountMailCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountMailCannedAnswers" csv-label="true" filename="mailAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMailAccountMailCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMailAccountMailCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountMailCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'MAIL.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'MAIL.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'MAIL.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'MAIL.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'MAIL.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="mailCannedAnswer" md-select-id="id" ng-repeat="mailCannedAnswer in vm_dc.mailAccountMailCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>{{mailCannedAnswer.value | htmlToPlaintext }}</td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{mailCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" md-cell>\n                        {{ mailCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditMailAccountMailCannedAnswer($event, mailCannedAnswer)" translate="MAIL.EDIT_MAILCANNEDANSWER">\n                                Edit MailCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(mailCannedAnswer, $event)" translate="MAIL.DELETE_MAILCANNEDANSWER">\n                                Delete MailCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.mailAccountMailCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MAIL.NO_MAILCANNEDANSWER_AVAILABLE">No mailcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.mailAccountMailCannedAnswers.count}}" md-on-paginate="vm_dc.getMailAccountMailCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.mailAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="MAIL.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedMailAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedMailAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedMailAccountApps.length}} {{vm_ac.selectedMailAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedMailAccountApps($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedMailAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.mailAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editMailAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editMailAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.mailAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MailAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.mailAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMailAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MAIL.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getMailAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getMailAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getMailAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="MAIL.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMailAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMailAccountInteractions.length}} {{vm_dc.selectedMailAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMailAccountInteractions" csv-label="true" filename="mailAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMailAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMailAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMailAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'MAIL.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'MAIL.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="subject">\n                        {{ \'MAIL.SUBJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'MAIL.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'MAIL.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'MAIL.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'MAIL.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'MAIL.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.mailAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <div class="width-300">\n                          <span class="text-truncate font-size-12">\n                            {{interaction.subject}}\n                          </span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'MAIL.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'MAIL.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spymailInteraction($event, interaction)" translate="MAIL.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.mailInteractionDownload(interaction, $event, true)" translate="MAIL.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.mailInteractionDownload(interaction, $event)" translate="MAIL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="MAIL.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.mailAccountInteractions.rows.length">\n                      <td md-cell colspan="13">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MAIL.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.mailAccountInteractions.count}}" md-on-paginate="vm_dc.getMailAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n</div>'),e.put("app/main/apps/mail/views/mailAccounts/mailAccounts.html",'<div id="mailAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILACCOUNTS">MailAccounts</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n\n  <div ng-show="vm.selectedMailAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailAccounts-count">\n          <span>{{vm.selectedMailAccounts.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailAccounts()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailAccounts()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailAccounts" csv-label="true" filename="mailAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailAccounts($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailAccounts">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="provider">{{ \'MAIL.SERVICE\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'MAIL.KEY\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'MAIL.EMAIL_ADDRESS\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MAIL.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailAccount" md-select-id="id" ng-repeat="mailAccount in vm.mailAccounts.rows" ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailAccount, ev) : vm.createOrEditMailAccount($event, mailAccount)">\n                <td md-cell class="id">{{mailAccount.id}}</td>\n                <td md-cell class="name">{{mailAccount.name}}</td>\n                <td md-cell class="provider">{{ mailAccount.provider ? (mailAccount.provider | startcase) : (\'MAIL.CUSTOM\' | translate) }}</td>\n                <td md-cell class="key">{{mailAccount.key}}</td>\n                <td md-cell class="email">{{mailAccount.email}}</td>\n                <td md-cell class="active">\n                  <md-icon md-colors="{color: {{mailAccount.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{mailAccount.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td md-cell class="description ">{{mailAccount.description}}</td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(mailAccount, $event)" translate="MAIL.EDIT_MAILACCOUNT">\n                          Edit Email Account\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.verifySMTP(mailAccount, $event)" translate="MAIL.VERIFYSMTP_MAILACCOUNT">\n                          Verify SMTP\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.goToInteractions(mailAccount, $event)" translate="MAIL.INTERACTIONS_MAILACCOUNT">\n                          Go To Interactions\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.goToRealtime()" translate="MAIL.GOTOREALTIME_MAILACCOUNT">\n                          Go To Realtime\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item>\n                        <md-button ng-click="vm.addAgent(mailAccount, $event)" translate="MAIL.AGENTADD_MAILACCOUNT">\n                          Add Agent To Email Account\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(mailAccount, $event)" translate="MAIL.DELETE_MAILACCOUNT">\n                          Delete Email Account\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailAccounts.count}}" md-on-paginate="vm.getMailAccounts" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailAccount-button" ng-click="vm.createOrEditMailAccount($event)" aria-label="add mailAccount" translate translate-attr-aria-label="MAIL.ADD_MAILACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n\n</div>'),e.put("app/main/apps/mail/views/mailQueues/create/dialog.html",'<md-dialog class="mailQueue-dialog" aria-label="New MailQueue">\n  <form name="mailQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newMailQueue">\n\n        <div class="hint"><span translate="MAIL.HELP.NAME"></span></div>\n        <div ng-messages="mailQueueForm[\'name\'].$error" ng-show="mailQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MAIL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.mailQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="mailQueueForm[\'strategy\'].$error" ng-show="mailQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.mailQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="mailQueueForm[\'timeout\'].$error" ng-show="mailQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailQueue.description">\n\n        <div ng-messages="mailQueueForm[\'description\'].$error" ng-show="mailQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailQueue" ng-click="vm.saveMailQueue()" class="send-button md-accent md-raised" ng-disabled="mailQueueForm.$invalid || mailQueueForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailQueue" ng-click="vm.addNewMailQueue()" class="send-button md-accent md-raised" ng-disabled="mailQueueForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILQUEUE" translate-attr-aria-label="MAIL.ADD_MAILQUEUE">\n          ADD MAILQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailQueue" ng-click="vm.deleteMailQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/agentadd/agentadd.html",'<md-dialog class="mailQueue-dialog" aria-label="mailQueue" ng-init="vm.onInit()">\n  <form name="mailQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.AGENTADD_MAILQUEUE">Add Agent to mailQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/teamadd/teamadd.html",'<md-dialog class="mailQueue-dialog" aria-label="mailQueue" ng-init="vm.onInit()">\n  <form name="mailQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MAIL.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailQueues/edit/view.html",'<div id="mail-mailQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-mailQueues-button md-icon-button" aria-label="Go to mailQueues" ng-click="vm.gotoMailQueues()" translate translate-attr-aria-label="MAIL.GO_TO_MAILQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="mailQueue-image" hide-xs>\n          <img ng-src="assets/images/business/mailQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.mailQueue.id}}\n            <span ng-if="vm.mailQueue.name">{{vm.mailQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MAIL.CREATED_AT"></span> <span>{{vm.mailQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.mailQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="MAIL.TEAMADD_MAILQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.mailQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MAIL.AGENTADD_MAILQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMailQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="mailQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MAIL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MAIL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.mailQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MAIL.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MAIL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.mailQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.mailQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MAIL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MAIL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.mailQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/mail/views/mailQueues/mailQueues.html",'<div id="mailQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILQUEUES">MailQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMailQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailQueues-count">\n          <span>{{vm.selectedMailQueues.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailQueues()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailQueues()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailQueues" csv-label="true" filename="mailQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailQueues($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MAILQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'MAIL.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailQueue" md-select-id="id" ng-repeat="mailQueue in vm.mailQueues.rows">\n                <td md-cell ng-if="mailQueue.userpic"><img class="avatar" alt="{{mailQueue.name}}" ng-src="api/users/{{mailQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!mailQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="id ">{{mailQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="name ">{{mailQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(mailQueue, ev) : vm.createOrEditMailQueue($event, mailQueue)" md-cell class="strategy ">{{ vm.arraystrategy[mailQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(mailQueue, $event    )" translate="MAIL.EDIT_MAILQUEUE">\n                          Edit MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(mailQueue, $event    )" translate="MAIL.TEAMADD_MAILQUEUE">\n                          teamadd MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(mailQueue, $event    )" translate="MAIL.AGENTADD_MAILQUEUE">\n                          agentadd MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(mailQueue, $event    )" translate="MAIL.DELETE_MAILQUEUE">\n                          Delete MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(mailQueue, $event    )" translate="MAIL.GOTOREALTIME_MAILQUEUE">\n                          goToRealtime MailQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailQueues.count}}" md-on-paginate="vm.getMailQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MAILQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MAILQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailQueue-button" ng-click="vm.createOrEditMailQueue($event)" aria-label="add mailQueue" translate translate-attr-aria-label="MAIL.ADD_MAILQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MAILQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/mailSubtatuses/create/dialog.html",'<md-dialog class="mailSubstatus-dialog" aria-label="New MailSubstatus">\n  <form name="mailSubstatusForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MAIL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.mailSubstatus.name" ng-required="true" autofocus>\n\n        <div ng-messages="mailSubstatusForm[\'name\'].$error" ng-show="mailSubstatusForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MAIL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.mailSubstatus.description">\n\n        <div ng-messages="mailSubstatusForm[\'description\'].$error" ng-show="mailSubstatusForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MAIL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMailSubstatus" ng-click="vm.saveMailSubstatus()" class="send-button md-accent md-raised" ng-disabled="mailSubstatusForm.$invalid || mailSubstatusForm.$pristine" aria-label="SAVE" translate="MAIL.SAVE" translate-attr-aria-label="MAIL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMailSubstatus" ng-click="vm.addNewMailSubstatus()" class="send-button md-accent md-raised" ng-disabled="mailSubstatusForm.$invalid" aria-label="ADD" translate="MAIL.ADD_MAILSUBSTATUS" translate-attr-aria-label="MAIL.ADD_MAILSUBSTATUS">\n          ADD MAILSUBSTATUS\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMailSubstatus" ng-click="vm.deleteMailSubstatus($event)" aria-label="DELETE" translate translate-attr-aria-label="MAIL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MAIL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/mail/views/mailSubtatuses/mailSubtatuses.html",'<div id="mailSubtatuses" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-email" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MAIL.MAILSUBSTATUSES">MailSubstatuses</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MAIL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMailSubstatuses.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMailSubstatuses =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MAIL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-mailSubtatuses-count">\n          <span>{{vm.selectedMailSubstatuses.length}}</span>\n          <span translate="MAIL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MAIL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMailSubstatuses()" translate="MAIL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMailSubstatuses()" translate="MAIL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMailSubstatuses" csv-label="true" filename="mailSubtatuses.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMailSubstatuses($event)" aria-label="delete selected" translate translate-attr-label="MAIL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MAILSUBSTATUS TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMailSubstatuses" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailSubstatuses">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MAIL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MAIL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.mailSubtatuses.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="mailSubstatus" md-select-id="id" ng-repeat="mailSubstatus in vm.mailSubtatuses.rows">\n                <td md-cell ng-if="mailSubstatus.userpic"><img class="avatar" alt="{{mailSubstatus.name}}" ng-src="api/users/{{mailSubstatus.id}}/avatar" /></td>\n                <td md-cell ng-if="!mailSubstatus.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{mailSubstatus.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="id ">{{mailSubstatus.id}}</td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="name ">{{mailSubstatus.name}}</td>\n                <td ng-click="vm.createOrEditMailSubstatus($event, mailSubstatus)" md-cell class="description ">{{mailSubstatus.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MAIL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(mailSubstatus, $event    )" translate="MAIL.EDIT_MAILSUBSTATUS">\n                          Edit MailSubstatus\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(mailSubstatus, $event    )" translate="MAIL.DELETE_MAILSUBSTATUS">\n                          Delete MailSubstatus\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailSubtatuses.count}}" md-on-paginate="vm.getMailSubstatuses" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MAILSUBSTATUS TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MAILSUBSTATUS BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-mailSubstatus-button" ng-click="vm.createOrEditMailSubstatus($event)" aria-label="add mailSubstatus" translate translate-attr-aria-label="MAIL.ADD_MAILSUBSTATUS">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MAILSUBSTATUS BUTTON --\x3e\n</div>'),e.put("app/main/apps/mail/views/realtime/accounts/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MAIL.ACCOUNTS">Accounts</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getMailAccounts()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- ACCOUNTS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMailAccounts">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'MAIL.NAME\' | translate}}</th>\n        <th md-column>{{\'MAIL.KEY\' | translate}}</th>\n        <th md-column>{{\'MAIL.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MAIL.IN\' | translate}}</th>\n        <th md-column>{{\'MAIL.OUT\' | translate}}</th>\n        <th md-column>{{\'MAIL.IMAP_STATUS\' | translate}}</th>\n        <th md-column>{{\'MAIL.SMTP_STATUS\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.mailAccounts.count > 0">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="MAIL.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="account" md-select-id="id" ng-repeat="account in vm.mailAccounts.rows">\n        <td md-cell>{{account.name}}</td>\n        <td md-cell>{{account.key}}</td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(account.in || 0) + (account.out || 0)}}</span>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-down-bold blue-fg"></md-icon>\n            </span>\n            <span class="md-capture blue-fg">{{account.in || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.in">{{account.lastIn ?  (account.lastIn | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row">\n            <span>\n              <md-icon md-font-icon="icon-arrow-up-bold green-fg"></md-icon>\n            </span>\n            <span class="md-capture green-fg">{{account.out || 0}}</span>\n            <span class="text-boxed" ng-if="mailAccount.out">{{account.lastOut ?  (account.lastOut | date: \'shortTime\') : \'\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row" layout-align="start center">\n            <div layout="column" layout-align="center center">\n              <md-button class="md-icon-button" aria-label="Status">\n                <md-tooltip>{{account.Imap.messageStatus}}</md-tooltip>\n                <div ng-switch="account.Imap.status">\n                  <md-icon ng-switch-when="error" md-font-icon="icon-alert yellow-fg"></md-icon>\n                  <md-icon ng-switch-when="disabled" md-font-icon="icon-close grey-fg"></md-icon>\n                  <md-icon ng-switch-default md-font-icon="icon-checkbox-marked-circle-outline green-fg"></md-icon>\n                </div>\n              </md-button>\n              <span class="md-caption grey-fg">{{ (\'MAIL.\' + account.Imap.status.toUpperCase()) | translate}}</span>\n            </div>\n            <span class="text-boxed" ng-if="account.active && (account.Imap.lastSync && account.Imap.lastSync != \'\')">{{account.Imap.lastSync | date: \'shortTime\'}}</span>\n          </div>\n        </td>\n        <td md-cell>\n          <div layout="row" layout-align="start center" ng-if="account.Smtp.status">\n            <div layout="column" layout-align="center center">\n              <md-button class="md-icon-button" aria-label="Status">\n                <md-tooltip>{{account.Smtp.messageStatus}}</md-tooltip>\n                <md-icon md-font-icon="{{ account.Smtp.status == \'error\' ? \'icon-alert yellow-fg\' : \'icon-checkbox-marked-circle-outline green-fg\'}}"></md-icon>\n              </md-button>\n              <span class="md-caption grey-fg">{{ (\'MAIL.\' + account.Smtp.status.toUpperCase()) | translate}}</span>\n            </div>\n            <span class="text-boxed">{{account.Smtp.lastSync | date: \'shortTime\'}}</span>\n          </div>\n          <span class="md-caption grey-fg" ng-if="!account.Smtp.status">{{ \'MAIL.NEVER_VERIFIED\' | translate }}</span>\n        </td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-button ng-click="vm.goToMailAccount($event, account)" translate="MAIL.EDIT_ACCOUNT">\n                  Edit Account\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.verifySmtp($event, account)" translate="MAIL.VERIFY_SMTP">\n                  Verify Smtp\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MAIL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MAIL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MAIL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.mailAccounts.count}}" md-on-paginate="vm.getMailAccounts" md-page-select></md-table-pagination>\n\x3c!-- / ACCOUNTS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/mail/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MAIL.ACCOUNTS">Accounts</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/marketplace/views/plugins/create/dialog.html",'<md-dialog class="plugin-dialog" aria-label="New Plugin">\n  <form name="pluginForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.plugin.name" ng-required="true" autofocus>\n\n        <div ng-messages="pluginForm[\'name\'].$error" ng-show="pluginForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.TYPE">Type</label>\n        <input type="text" name="type" ng-model="vm.plugin.type" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'type\'].$error" ng-show="pluginForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.plugin.active" aria-label="Active" ng-disabled="!vm.newPlugin"><span translate="MARKETPLACE.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.plugin.description">\n\n        <div ng-messages="pluginForm[\'description\'].$error" ng-show="pluginForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.ICON">Icon</label>\n        <input type="text" name="icon" ng-model="vm.plugin.icon" ng-required="true">\n\n        <div ng-messages="pluginForm[\'icon\'].$error" ng-show="pluginForm[\'icon\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.ICON_REQUIRED">Icon field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.SIDEBAR">Sidebar</label>\n        <md-select name="sidebar" ng-model="vm.plugin.sidebar" required>\n          <md-option ng-value="\'always\'">Always</md-option>\n          <md-option ng-value="\'adminOnly\'">Admin Only</md-option>\n          <md-option ng-value="\'agentOnly\'">Agent Only</md-option>\n          <md-option ng-value="\'never\'">Never</md-option>\n        </md-select>\n        <div ng-messages="pluginForm[\'sidebar\'].$error" ng-show="pluginForm[\'sidebar\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SIDEBAR_REQUIRED">Sidebar field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'adminOnly\'" class="md-block">\n        <label translate="MARKETPLACE.ADMINURL">AdminUrl</label>\n        <input type="text" name="adminUrl" ng-model="vm.plugin.adminUrl">\n\n        <div ng-messages="pluginForm[\'adminUrl\'].$error" ng-show="pluginForm[\'adminUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.ADMINURL_REQUIRED">AdminUrl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'agentOnly\'" class="md-block">\n        <label translate="MARKETPLACE.AGENTURL">AgentUrl</label>\n        <input type="text" name="agentUrl" ng-model="vm.plugin.agentUrl">\n\n        <div ng-messages="pluginForm[\'agentUrl\'].$error" ng-show="pluginForm[\'agentUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.AGENTURL_REQUIRED">AgentUrl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n        <label translate="MARKETPLACE.SCRIPTNAME">ScriptName</label>\n        <input type="text" name="scriptName" ng-model="vm.plugin.scriptName" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'scriptName\'].$error" ng-show="pluginForm[\'scriptName\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SCRIPTNAME_REQUIRED">ScriptName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n        <label translate="MARKETPLACE.SCRIPTPATH">ScriptPath</label>\n        <input type="text" name="scriptPath" ng-model="vm.plugin.scriptPath" ng-required="true">\n\n        <div ng-messages="pluginForm[\'scriptPath\'].$error" ng-show="pluginForm[\'scriptPath\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.SCRIPTPATH_REQUIRED">ScriptPath field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MARKETPLACE.VERSION">Version</label>\n        <input type="text" name="version" ng-model="vm.plugin.version" ng-disabled="!vm.newPlugin">\n\n        <div ng-messages="pluginForm[\'version\'].$error" ng-show="pluginForm[\'version\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MARKETPLACE.ERRORS.VERSION_REQUIRED">Version field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newPlugin" ng-click="vm.savePlugin()" class="send-button md-accent md-raised" ng-disabled="pluginForm.$invalid || pluginForm.$pristine" aria-label="SAVE" translate="MARKETPLACE.SAVE" translate-attr-aria-label="MARKETPLACE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newPlugin" ng-click="vm.addNewPlugin()" class="send-button md-accent md-raised" ng-disabled="pluginForm.$invalid" aria-label="ADD" translate="MARKETPLACE.ADD_PLUGIN" translate-attr-aria-label="MARKETPLACE.ADD_PLUGIN">\n          ADD PLUGIN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newPlugin" ng-click="vm.deletePlugin($event)" aria-label="DELETE" translate translate-attr-aria-label="MARKETPLACE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MARKETPLACE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/marketplace/views/plugins/edit/view.html",'<div id="marketplace-plugin" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-plugins-button md-icon-button" aria-label="Go to plugins" ng-click="vm.gotoPlugins()" translate translate-attr-aria-label="MARKETPLACE.GO_TO_PLUGINS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="plugin-image" hide-xs>\n          <img ng-src="assets/images/business/plugins.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.plugin.id}}\n            <span ng-if="vm.plugin.name">{{vm.plugin.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MARKETPLACE.CREATED_AT"></span> <span>{{vm.plugin.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.savePlugin()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="MARKETPLACE.SAVE" translate-attr-aria-label="MARKETPLACE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MARKETPLACE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="plugin-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MARKETPLACE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.plugin.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.TYPE">Type</label>\n                <input type="text" name="type" ng-model="vm.plugin.type" disabled>\n\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.plugin.active" aria-label="Active" ng-disabled="true"><span translate="MARKETPLACE.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.plugin.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.ICON">Icon</label>\n                <input type="text" name="icon" ng-model="vm.plugin.icon" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'icon\'].$error" ng-show="generalForm[\'icon\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.ICON_REQUIRED">Icon field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.SIDEBAR">Sidebar</label>\n                <md-select name="sidebar" ng-model="vm.plugin.sidebar" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'always\'">Always</md-option>\n                  <md-option ng-value="\'adminOnly\'">Admin Only</md-option>\n                  <md-option ng-value="\'agentOnly\'">Agent Only</md-option>\n                  <md-option ng-value="\'never\'">Never</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'sidebar\'].$error" ng-show="generalForm[\'sidebar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SIDEBAR_REQUIRED">Sidebar field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'adminOnly\'" class="md-block">\n                <label translate="MARKETPLACE.ADMINURL">AdminUrl</label>\n                <input type="text" name="adminUrl" ng-model="vm.plugin.adminUrl" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'adminUrl\'].$error" ng-show="generalForm[\'adminUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.ADMINURL_REQUIRED">AdminUrl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.sidebar === \'always\' || vm.plugin.sidebar === \'agentOnly\'" class="md-block">\n                <label translate="MARKETPLACE.AGENTURL">AgentUrl</label>\n                <input type="text" name="agentUrl" ng-model="vm.plugin.agentUrl" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'agentUrl\'].$error" ng-show="generalForm[\'agentUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.AGENTURL_REQUIRED">AgentUrl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n                <label translate="MARKETPLACE.SCRIPTNAME">ScriptName</label>\n                <input type="text" name="scriptName" ng-model="vm.plugin.scriptName" disabled>\n\n                <div ng-messages="generalForm[\'scriptName\'].$error" ng-show="generalForm[\'scriptName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SCRIPTNAME_REQUIRED">ScriptName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.plugin.type === \'script\'" class="md-block">\n                <label translate="MARKETPLACE.SCRIPTPATH">ScriptPath</label>\n                <input type="text" name="scriptPath" ng-model="vm.plugin.scriptPath" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'scriptPath\'].$error" ng-show="generalForm[\'scriptPath\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.SCRIPTPATH_REQUIRED">ScriptPath field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MARKETPLACE.VERSION">Version</label>\n                <input type="text" name="version" ng-model="vm.plugin.version" disabled>\n\n                <div ng-messages="generalForm[\'version\'].$error" ng-show="generalForm[\'version\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MARKETPLACE.ERRORS.VERSION_REQUIRED">Version field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/marketplace/views/plugins/plugins.html",'<div id="plugins" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cart" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MARKETPLACE.PLUGINS">Plugins</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MARKETPLACE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedPlugins.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedPlugins =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MARKETPLACE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-plugins-count">\n          <span>{{vm.selectedPlugins.length}}</span>\n          <span translate="MARKETPLACE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MARKETPLACE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllPlugins()" translate="MARKETPLACE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectPlugins()" translate="MARKETPLACE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedPlugins" csv-label="true" filename="plugins.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedPlugins($event)" aria-label="delete selected" translate translate-attr-label="MARKETPLACE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div ng-if="vm.installing">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="MARKETPLACE.INSTALLING">Installing</span>\n            <md-progress-linear md-mode="indeterminate" class="md-accent padding-20"></md-progress-linear>\n          </div>\n        </md-card>\n      </div>\n\n      \x3c!-- PLUGIN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedPlugins" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getPlugins">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="name">{{ \'MARKETPLACE.NAME\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'MARKETPLACE.TYPE\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MARKETPLACE.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'MARKETPLACE.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="version">{{ \'MARKETPLACE.VERSION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.plugins.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MARKETPLACE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="plugin" md-select-id="id" ng-repeat="plugin in vm.plugins.rows">\n                <td md-cell ng-if="plugin.userpic"><img class="avatar" alt="{{plugin.name}}" ng-src="api/users/{{plugin.id}}/avatar" /></td>\n                <td md-cell ng-if="!plugin.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{plugin.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="name ">{{plugin.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="type ">{{plugin.type}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{plugin.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{plugin.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="description ">{{plugin.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(plugin, ev) : vm.createOrEditPlugin($event, plugin)" md-cell class="version ">{{plugin.version}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MARKETPLACE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && !plugin.active">\n\n                        <md-button ng-click="vm.installplugin(plugin, $event    )" translate="MARKETPLACE.INSTALL_PLUGIN">\n                          Install Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(plugin, $event    )" translate="MARKETPLACE.EDIT_PLUGIN">\n                          Edit Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n\n                        <md-button ng-click="vm.stopplugin(plugin, $event    )" translate="MARKETPLACE.STOP_PLUGIN">\n                          Stop Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active && plugin.type == \'script\'">\n\n                        <md-button ng-click="vm.restartplugin(plugin, $event    )" translate="MARKETPLACE.RESTART_PLUGIN">\n                          Restart Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.downloadfile2(plugin, $event  , \'plugins\'   )" translate="MARKETPLACE.DOWNLOAD_PLUGIN">\n                          Download Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit && plugin.active">\n\n                        <md-button ng-click="vm.uninstallplugin(plugin, $event    )" translate="MARKETPLACE.UNINSTALL_PLUGIN">\n                          Uninstall Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(plugin, $event    )" translate="MARKETPLACE.DELETE_PLUGIN">\n                          Delete Plugin\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MARKETPLACE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MARKETPLACE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MARKETPLACE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.plugins.count}}" md-on-paginate="vm.getPlugins" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PLUGIN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- UPLOAD PLUGIN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="upload-plugin-button" ng-click="vm.uploadPlugin($event)" aria-label="upload plugin" translate translate-attr-aria-label="MARKETPLACE.UPLOAD_PLUGIN">\n    <md-icon md-font-icon="icon-upload"></md-icon>\n  </md-button>\n  \x3c!-- / UPLOAD PLUGIN BUTTON --\x3e\n</div>'),e.put("app/main/apps/marketplace/views/plugins/upload/dialog.html",'<md-dialog class="upload-dialog" aria-label="Upload ">\n  <form name="uploadForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="plugin-uploader" ng-hide="vm.uploadState == \'uploading\'" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)" flow-error="vm.uploadError($file, $message)" flow-complete="vm.uploadComplete()" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="MARKETPLACE.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="MARKETPLACE.DROP_TO_UPLOAD_MESSAGE">You can also drop your file here to upload.</span>\n        </div>\n      </div>\n\n      <div layout="column" layout-align="space-between center" ng-show="vm.uploadState == \'uploading\'">\n        <div>\n          <span translate="MARKETPLACE.UPLOADING">Uploading</span>\n          <span>{{vm.plugin.file.name}}</span>\n        </div>\n        <md-progress-linear md-mode="indeterminate"></md-progress-linear>\n      </div>\n\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center"></div>\n      <div layout="row">\n        <md-button ng-click="vm.closeDialog()" ng-hide="vm.uploadState == \'uploading\'" class="md-accent md-raised" aria-label="FINISH" translate="MARKETPLACE.FINISH" translate-attr-aria-label="MARKETPLACE.FINISH">\n          FINISH\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/hopperdate/hopperdate.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" ng-change="vm.recalcTZTime()" mdp-format="YYYY-MM-DD" ng-model="vm.dateTime">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" ng-change="vm.recalcTZTime()" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.dateTime">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n\n        </md-content>\n      </div>\n      <md-input-container class="md-block">\n        <div layout="row">\n          <div flex class="md-block">\n            <md-input-container class="md-block" flex-gt-sm="">\n              <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n              <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" ng-change="vm.recalcTZTime()" autofocus>\n            </md-input-container>\n          </div>\n          <div flex class="md-block">\n            <md-input-container class="md-block">\n              <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n              <input type="text" readonly value="{{vm.hopper.scheduledat}}">\n            </md-input-container>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.hopper.recallme" aria-label="RecallAgent"><span translate="MOTIONDIALER.RECALLAGENT">RecallAgent</span></md-switch>\n\n      </md-input-container>\n      <md-input-container ng-if="vm.hopper.recallme" class="md-block">\n        <label translate="MOTIONDIALER.AGENT">Agent</label>\n        <md-select name="UserId" ng-model="vm.hopper.UserId" required>\n          <md-option ng-value="UserId.id" ng-repeat="UserId in vm.agents" ng-disabled="UserId.canSelect === false">{{ UserId.name }}</md-option>\n        </md-select>\n        <div ng-messages="hopperForm[\'UserId\'].$error" ng-show="hopperForm[\'UserId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/create/dialog.html",'<md-dialog class="ivrCampaign-dialog" aria-label="New IvrCampaign">\n  <form name="ivrCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newIvrCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="ivrCampaignForm[\'name\'].$error" ng-show="ivrCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.ivrCampaign.active" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n        <md-select name="TrunkId" ng-model="vm.ivrCampaign.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'TrunkId\'].$error" ng-show="ivrCampaignForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.ivrCampaign.IntervalId" required>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'IntervalId\'].$error" ng-show="ivrCampaignForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n        <md-select name="dialCheckDuplicateType" ng-model="vm.ivrCampaign.dialCheckDuplicateType" required>\n\n          <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n          <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'dialCheckDuplicateType\'].$error" ng-show="ivrCampaignForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n        <md-select name="SquareProjectId" ng-model="vm.ivrCampaign.SquareProjectId" required>\n          <md-option ng-value="SquareProjectId.id" ng-repeat="SquareProjectId in vm.projects" ng-disabled="SquareProjectId.canSelect === false">{{ SquareProjectId.name }}</md-option>\n        </md-select>\n        <div ng-messages="ivrCampaignForm[\'SquareProjectId\'].$error" ng-show="ivrCampaignForm[\'SquareProjectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CONCURRENTCALLS">ConcurrentCalls</label>\n        <input type="number" name="limitCalls" ng-model="vm.ivrCampaign.limitCalls" min="1" max="200" value="30" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.CONCURRENTCALLS"></span></div>\n        <div ng-messages="ivrCampaignForm[\'limitCalls\'].$error" ng-show="ivrCampaignForm[\'limitCalls\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_REQUIRED">ConcurrentCalls field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>200</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.ivrCampaign.description">\n\n        <div ng-messages="ivrCampaignForm[\'description\'].$error" ng-show="ivrCampaignForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newIvrCampaign" ng-click="vm.saveIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid || ivrCampaignForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newIvrCampaign" ng-click="vm.addNewIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_IVRCAMPAIGN" translate-attr-aria-label="MOTIONDIALER.ADD_IVRCAMPAIGN">\n          ADD IVRCAMPAIGN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newIvrCampaign" ng-click="vm.deleteIvrCampaign($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/blacklistadd/blacklistadd.html",'<md-dialog class="ivrCampaign-dialog" aria-label="ivrCampaign" ng-init="vm.onInit()">\n  <form name="ivrCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">Add List in IVRCAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/clone/clone.html",'<md-dialog class="ivrCampaign-dialog" aria-label="Clone IvrCampaign">\n  <form name="ivrCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newIvrCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="ivrCampaignForm[\'name\'].$error" ng-show="ivrCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneIvrCampaign()" class="send-button md-accent md-raised" ng-disabled="ivrCampaignForm.$invalid" aria-label="CLONE" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN" translate-attr-aria-label="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n        CLONE IVRCAMPAIGN\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.hopper.scheduledat" ng-init="vm.hopper.scheduledat = vm.getDateFromString(vm.hopper.scheduledat)">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/listadd/listadd.html",'<md-dialog class="ivrCampaign-dialog" aria-label="ivrCampaign" ng-init="vm.onInit()">\n  <form name="ivrCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">Add List in IVRCAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/resetlist/resetlist.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.RESETLIST ">Reset List</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-wrap flex>\n        <div flex-xs flex="50">\n          <md-checkbox aria-label="Select All" ng-checked="vm.isChecked()" md-indeterminate="vm.isIndeterminate()" ng-click="vm.toggleAll()">\n            <span ng-if="vm.isChecked()" translate="MOTIONDIALER.UNSELECTALL"></span>\n            <span ng-if="!vm.isChecked()" translate="MOTIONDIALER.SELECTALL"></span>\n          </md-checkbox>\n        </div>\n        <div flex-xs flex="50">\n        </div>\n        <div flex="{{vm.items.length > 10 ? 50 : 100 }}" ng-repeat="item in vm.items">\n          <md-checkbox ng-checked="vm.exists(item, vm.selected)" ng-click="vm.toggle(item, vm.selected)">\n            {{ item.name | limitTo:40 }}\n          </md-checkbox>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-hide="vm.loading" layout="row" layout-align="end center">\n      <div>\n      </div>\n      <md-button type="submit" ng-click="vm.listSelected()" class="send-button md-accent md-raised" ng-disabled="vm.loading" aria-label="RESET" translate="MOTIONDIALER.RESET" translate-attr-aria-label="MOTIONDIALER.RESET">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/edit/view.html",'<div id="motiondialer-ivrCampaign" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-ivrCampaigns-button md-icon-button" aria-label="Go to ivrCampaigns" ng-click="vm.gotoIvrCampaigns()" translate translate-attr-aria-label="MOTIONDIALER.GO_TO_IVRCAMPAIGNS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="ivrCampaign-image" hide-xs>\n          <img ng-src="assets/images/business/ivrCampaigns.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.ivrCampaign.id}}\n            <span ng-if="vm.ivrCampaign.name">{{vm.ivrCampaign.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MOTIONDIALER.CREATED_AT"></span> <span>{{vm.ivrCampaign.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.ivrCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="MOTIONDIALER.CLONE_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.listadddialog(vm.ivrCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="listadd">\n        <md-tooltip><span translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-format-list-numbers"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.blacklistadddialog(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="blacklistadd">\n        <md-tooltip><span translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-block-helper"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.resetlistdialog(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="resetlist">\n        <md-tooltip><span translate="MOTIONDIALER.RESETLIST_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-restore"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.ivrCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MOTIONDIALER.GOTO_IVRCAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveIvrCampaign()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (campaignForm.$invalid) || (originateForm.$invalid) || (globalForm.$invalid) || (congestionForm.$invalid) || (busyForm.$invalid) || (noanswerForm.$invalid) || (nosuchnumberForm.$invalid) || (dropForm.$invalid) || (abandonedForm.$invalid) || (machineForm.$invalid) || (agentrejectForm.$invalid) || (advancedForm.$invalid) || (globalintervalForm.$invalid) || (timezoneForm.$invalid) || (amdForm.$invalid) || (hopperStatisticsForm.$invalid) || (hoppersForm.$invalid) || (hopperHistoriesForm.$invalid) || (hopperFinalsForm.$invalid) || (hopperBlacksForm.$invalid)" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.ivrCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.ivrCampaign.active" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n                <md-select name="TrunkId" ng-model="vm.ivrCampaign.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BACKUPTRUNK">BackupTrunk</label>\n                <md-select name="TrunkBackupId" ng-model="vm.ivrCampaign.TrunkBackupId" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="TrunkBackupId.id" ng-repeat="TrunkBackupId in vm.trunks" ng-disabled="TrunkBackupId.canSelect === false">{{ TrunkBackupId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkBackupId\'].$error" ng-show="generalForm[\'TrunkBackupId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BACKUPTRUNK_REQUIRED">BackupTrunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.ivrCampaign.IntervalId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'IntervalId\'].$error" ng-show="generalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n                <md-select name="dialCheckDuplicateType" ng-model="vm.ivrCampaign.dialCheckDuplicateType" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n                  <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'dialCheckDuplicateType\'].$error" ng-show="generalForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CUTDIGIT">CutDigit</label>\n                <input type="number" name="dialCutDigit" ng-model="vm.ivrCampaign.dialCutDigit" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialCutDigit\'].$error" ng-show="generalForm[\'dialCutDigit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_REQUIRED">CutDigit field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.ivrCampaign.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container campaign md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</div>\n            </div>\n            <form name="campaignForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n                <md-select name="SquareProjectId" ng-model="vm.ivrCampaign.SquareProjectId" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="SquareProjectId.id" ng-repeat="SquareProjectId in vm.projects" ng-disabled="SquareProjectId.canSelect === false">{{ SquareProjectId.name }}</md-option>\n                </md-select>\n                <div ng-messages="campaignForm[\'SquareProjectId\'].$error" ng-show="campaignForm[\'SquareProjectId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONCURRENTCALLS">ConcurrentCalls</label>\n                <input type="number" name="limitCalls" ng-model="vm.ivrCampaign.limitCalls" min="1" max="200" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONCURRENTCALLS"></span></div>\n                <div ng-messages="campaignForm[\'limitCalls\'].$error" ng-show="campaignForm[\'limitCalls\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_REQUIRED">ConcurrentCalls field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">ConcurrentCalls must be a valid greater or equal than</span> <span>200</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container originate md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ORIGINATE">ORIGINATE</div>\n            </div>\n            <form name="originateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNAME">OriginateCallerIdName</label>\n                <input type="text" name="dialOriginateCallerIdName" ng-model="vm.ivrCampaign.dialOriginateCallerIdName" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNAME"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdName\'].$error" ng-show="originateForm[\'dialOriginateCallerIdName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNAME_REQUIRED">OriginateCallerIdName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNUMBER">OriginateCallerIdNumber</label>\n                <input type="text" name="dialOriginateCallerIdNumber" ng-model="vm.ivrCampaign.dialOriginateCallerIdNumber" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdNumber\'].$error" ng-show="originateForm[\'dialOriginateCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNUMBER_REQUIRED">OriginateCallerIdNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RANDOMLASTDIGITCALLERIDNUMBER">RandomLastDigitCallerIdNumber</label>\n                <input type="number" name="dialRandomLastDigitCallerIdNumber" ng-model="vm.ivrCampaign.dialRandomLastDigitCallerIdNumber" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RANDOMLASTDIGITCALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$error" ng-show="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_REQUIRED">RandomLastDigitCallerIdNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATETIMEOUT">OriginateTimeout</label>\n                <input type="number" name="dialOriginateTimeout" ng-model="vm.ivrCampaign.dialOriginateTimeout" min="1" max="999" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATETIMEOUT"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateTimeout\'].$error" ng-show="originateForm[\'dialOriginateTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_REQUIRED">OriginateTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.ivrCampaign.dialPrefix" ng-pattern="/^\\d+$/" value="" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREFIX"></span></div>\n                <div ng-messages="originateForm[\'dialPrefix\'].$error" ng-show="originateForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_MUST_VALID_PATTERN" translate-values="{ regex: \'/^\\d+$/\' }">Prefix must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.RETRYANDFREQUENCY">RETRYANDFREQUENCY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container global md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBAL">GLOBAL</div>\n            </div>\n            <form name="globalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALMAXRETRY">GlobalMaxRetry</label>\n                <input type="number" name="dialGlobalMaxRetry" ng-model="vm.ivrCampaign.dialGlobalMaxRetry" min="1" max="999" value="4" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALMAXRETRY"></span></div>\n                <div ng-messages="globalForm[\'dialGlobalMaxRetry\'].$error" ng-show="globalForm[\'dialGlobalMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_REQUIRED">GlobalMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container congestion md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CONGESTION">CONGESTION</div>\n            </div>\n            <form name="congestionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONMAXRETRY">CongestionMaxRetry</label>\n                <input type="number" name="dialCongestionMaxRetry" ng-model="vm.ivrCampaign.dialCongestionMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONMAXRETRY"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionMaxRetry\'].$error" ng-show="congestionForm[\'dialCongestionMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_REQUIRED">CongestionMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONRETRYTIME">CongestionRetryTime</label>\n                <input type="number" name="dialCongestionRetryFrequency" ng-model="vm.ivrCampaign.dialCongestionRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONRETRYTIME"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionRetryFrequency\'].$error" ng-show="congestionForm[\'dialCongestionRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_REQUIRED">CongestionRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container busy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.BUSY">BUSY</div>\n            </div>\n            <form name="busyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYMAXRETRY">BusyMaxRetry</label>\n                <input type="number" name="dialBusyMaxRetry" ng-model="vm.ivrCampaign.dialBusyMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYMAXRETRY"></span></div>\n                <div ng-messages="busyForm[\'dialBusyMaxRetry\'].$error" ng-show="busyForm[\'dialBusyMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_REQUIRED">BusyMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYRETRYTIME">BusyRetryTime</label>\n                <input type="number" name="dialBusyRetryFrequency" ng-model="vm.ivrCampaign.dialBusyRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYRETRYTIME"></span></div>\n                <div ng-messages="busyForm[\'dialBusyRetryFrequency\'].$error" ng-show="busyForm[\'dialBusyRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_REQUIRED">BusyRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container noanswer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOANSWER">NOANSWER</div>\n            </div>\n            <form name="noanswerForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERMAXRETRY">NoAnswerMaxRetry</label>\n                <input type="number" name="dialNoAnswerMaxRetry" ng-model="vm.ivrCampaign.dialNoAnswerMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERMAXRETRY"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerMaxRetry\'].$error" ng-show="noanswerForm[\'dialNoAnswerMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_REQUIRED">NoAnswerMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERRETRYTIME">NoAnswerRetryTime</label>\n                <input type="number" name="dialNoAnswerRetryFrequency" ng-model="vm.ivrCampaign.dialNoAnswerRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERRETRYTIME"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerRetryFrequency\'].$error" ng-show="noanswerForm[\'dialNoAnswerRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_REQUIRED">NoAnswerRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container nosuchnumber md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOSUCHNUMBER">NOSUCHNUMBER</div>\n            </div>\n            <form name="nosuchnumberForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERMAXRETRY">NoSuchNumberMaxRetry</label>\n                <input type="number" name="dialNoSuchNumberMaxRetry" ng-model="vm.ivrCampaign.dialNoSuchNumberMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERMAXRETRY"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_REQUIRED">NoSuchNumberMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERRETRYTIME">NoSuchNumberRetryTime</label>\n                <input type="number" name="dialNoSuchNumberRetryFrequency" ng-model="vm.ivrCampaign.dialNoSuchNumberRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERRETRYTIME"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_REQUIRED">NoSuchNumberRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container drop md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.DROP">DROP</div>\n            </div>\n            <form name="dropForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPMAXRETRY">DropMaxRetry</label>\n                <input type="number" name="dialDropMaxRetry" ng-model="vm.ivrCampaign.dialDropMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPMAXRETRY"></span></div>\n                <div ng-messages="dropForm[\'dialDropMaxRetry\'].$error" ng-show="dropForm[\'dialDropMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_REQUIRED">DropMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPRETRYTIME">DropRetryTime</label>\n                <input type="number" name="dialDropRetryFrequency" ng-model="vm.ivrCampaign.dialDropRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPRETRYTIME"></span></div>\n                <div ng-messages="dropForm[\'dialDropRetryFrequency\'].$error" ng-show="dropForm[\'dialDropRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_REQUIRED">DropRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container abandoned md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ABANDONED">ABANDONED</div>\n            </div>\n            <form name="abandonedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDMAXRETRY">AbandonedMaxRetry</label>\n                <input type="number" name="dialAbandonedMaxRetry" ng-model="vm.ivrCampaign.dialAbandonedMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDMAXRETRY"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedMaxRetry\'].$error" ng-show="abandonedForm[\'dialAbandonedMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_REQUIRED">AbandonedMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDRETRYTIME">AbandonedRetryTime</label>\n                <input type="number" name="dialAbandonedRetryFrequency" ng-model="vm.ivrCampaign.dialAbandonedRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDRETRYTIME"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedRetryFrequency\'].$error" ng-show="abandonedForm[\'dialAbandonedRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_REQUIRED">AbandonedRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container machine md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.MACHINE">MACHINE</div>\n            </div>\n            <form name="machineForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINEMAXRETRY">MachineMaxRetry</label>\n                <input type="number" name="dialMachineMaxRetry" ng-model="vm.ivrCampaign.dialMachineMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINEMAXRETRY"></span></div>\n                <div ng-messages="machineForm[\'dialMachineMaxRetry\'].$error" ng-show="machineForm[\'dialMachineMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_REQUIRED">MachineMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINERETRYTIME">MachineRetryTime</label>\n                <input type="number" name="dialMachineRetryFrequency" ng-model="vm.ivrCampaign.dialMachineRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINERETRYTIME"></span></div>\n                <div ng-messages="machineForm[\'dialMachineRetryFrequency\'].$error" ng-show="machineForm[\'dialMachineRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_REQUIRED">MachineRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container agentreject md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AGENTREJECT">AGENTREJECT</div>\n            </div>\n            <form name="agentrejectForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTMAXRETRY">AgentRejectMaxRetry</label>\n                <input type="number" name="dialAgentRejectMaxRetry" ng-model="vm.ivrCampaign.dialAgentRejectMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTMAXRETRY"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectMaxRetry\'].$error" ng-show="agentrejectForm[\'dialAgentRejectMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_REQUIRED">AgentRejectMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTRETRYTIME">AgentRejectRetryTime</label>\n                <input type="number" name="dialAgentRejectRetryFrequency" ng-model="vm.ivrCampaign.dialAgentRejectRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTRETRYTIME"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$error" ng-show="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_REQUIRED">AgentRejectRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.ivrCampaign.dialOrderByScheduledAt" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container globalinterval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBALINTERVAL">GLOBALINTERVAL</div>\n            </div>\n            <form name="globalintervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALINTERVAL">GlobalInterval</label>\n                <input type="text" name="dialGlobalInterval" ng-model="vm.ivrCampaign.dialGlobalInterval" value="07:00-22:00,*,*,*" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALINTERVAL"></span></div>\n                <div ng-messages="globalintervalForm[\'dialGlobalInterval\'].$error" ng-show="globalintervalForm[\'dialGlobalInterval\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALINTERVAL_REQUIRED">GlobalInterval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container timezone md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.TIMEZONE">TIMEZONE</div>\n            </div>\n            <form name="timezoneForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEZONE">Timezone</label>\n                <ms-timezone name="dialTimezone" ng-model="vm.ivrCampaign.dialTimezone" autofocus ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span></div>\n                <div ng-messages="timezoneForm[\'dialTimezone\'].$error" ng-show="timezoneForm[dialTimezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="ivrCampaign-detail-form-container amd md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AMD">AMD</div>\n            </div>\n            <form name="amdForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.ivrCampaign.dialAMDActive" aria-label="AMDActive" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AMDACTIVE">AMDActive</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDACTIVE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDINITIALSILENCE">AMDInitialSilence</label>\n                <input type="number" name="dialAMDInitialSilence" ng-model="vm.ivrCampaign.dialAMDInitialSilence" min="0" value="2500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDINITIALSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDInitialSilence\'].$error" ng-show="amdForm[\'dialAMDInitialSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_REQUIRED">AMDInitialSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDInitialSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDGREETING">AMDGreeting</label>\n                <input type="number" name="dialAMDGreeting" ng-model="vm.ivrCampaign.dialAMDGreeting" min="0" value="1500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDGREETING"></span></div>\n                <div ng-messages="amdForm[\'dialAMDGreeting\'].$error" ng-show="amdForm[\'dialAMDGreeting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_REQUIRED">AMDGreeting field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDGreeting must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDAFTERGREETINGSILENCE">AMDAfterGreetingSilence</label>\n                <input type="number" name="dialAMDAfterGreetingSilence" ng-model="vm.ivrCampaign.dialAMDAfterGreetingSilence" min="0" value="800" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDAFTERGREETINGSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDAfterGreetingSilence\'].$error" ng-show="amdForm[\'dialAMDAfterGreetingSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_REQUIRED">AMDAfterGreetingSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDAfterGreetingSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDTOTALANALYSISTIME">AMDTotalAnalysisTime</label>\n                <input type="number" name="dialAMDTotalAnalysisTime" ng-model="vm.ivrCampaign.dialAMDTotalAnalysisTime" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDTOTALANALYSISTIME"></span></div>\n                <div ng-messages="amdForm[\'dialAMDTotalAnalysisTime\'].$error" ng-show="amdForm[\'dialAMDTotalAnalysisTime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_REQUIRED">AMDTotalAnalysisTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDTotalAnalysisTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMINWORDLENGTH">AMDMinWordLength</label>\n                <input type="number" name="dialAMDMinWordLength" ng-model="vm.ivrCampaign.dialAMDMinWordLength" min="0" value="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMINWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMinWordLength\'].$error" ng-show="amdForm[\'dialAMDMinWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_REQUIRED">AMDMinWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMinWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDBETWEENWORDSSILENCE">AMDBetweenWordsSilence</label>\n                <input type="number" name="dialAMDBetweenWordsSilence" ng-model="vm.ivrCampaign.dialAMDBetweenWordsSilence" min="0" value="50" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDBETWEENWORDSSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDBetweenWordsSilence\'].$error" ng-show="amdForm[\'dialAMDBetweenWordsSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_REQUIRED">AMDBetweenWordsSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDBetweenWordsSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMNUMBEROFWORDS">AMDMaximumNumberOfWords</label>\n                <input type="number" name="dialAMDMaximumNumberOfWords" ng-model="vm.ivrCampaign.dialAMDMaximumNumberOfWords" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMNUMBEROFWORDS"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumNumberOfWords\'].$error" ng-show="amdForm[\'dialAMDMaximumNumberOfWords\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_REQUIRED">AMDMaximumNumberOfWords field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumNumberOfWords must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDSILENCETHRESHOLD">AMDSilenceThreshold</label>\n                <input type="number" name="dialAMDSilenceThreshold" ng-model="vm.ivrCampaign.dialAMDSilenceThreshold" min="0" max="32767" value="256" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDSILENCETHRESHOLD"></span></div>\n                <div ng-messages="amdForm[\'dialAMDSilenceThreshold\'].$error" ng-show="amdForm[\'dialAMDSilenceThreshold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_REQUIRED">AMDSilenceThreshold field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_LESS_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>32767</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.ivrCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMWORDLENGTH">AMDMaximumWordLength</label>\n                <input type="number" name="dialAMDMaximumWordLength" ng-model="vm.ivrCampaign.dialAMDMaximumWordLength" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumWordLength\'].$error" ng-show="amdForm[\'dialAMDMaximumWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_REQUIRED">AMDMaximumWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HOPPERS">HOPPERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperstatistics md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperStatisticsController as vm_hs" ng-init="vm_hs.init(vm.ivrCampaign)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERWIDGET">Hoppers</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_hs.init(vm.ivrCampaign)" aria-label="refresh Hopper" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{(vm_hs.total || 0) + (vm_hs.closed || 0)}}</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.TOTAL\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.fresh || 0}} ({{vm_hs.total ? ((((vm_hs.fresh || 0) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.FRESH\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.total ? (vm_hs.total - (vm_hs.fresh || 0)) : 0}} ({{vm_hs.total ? ((((vm_hs.total - (vm_hs.fresh || 0)) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.OPEN\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.closed ? (vm_hs.closed || 0) : 0}} ({{vm_hs.closed ? ((((vm_hs.closed) * 100)/(vm_hs.closed + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.CLOSED\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n\n          </div>\n          <div class="ivrCampaign-detail-form-container hoppers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHoppersController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERS">Hoppers</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHoppers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHoppers()" aria-label="refresh Hoppers" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHoppers.length}} {{vm_dc.selectedIvrCampaignHoppers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHoppers" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedIvrCampaignHoppers($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHoppers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="priority">\n                        {{ \'MOTIONDIALER.PRIORITY\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopper" md-select-id="id" ng-repeat="hopper in vm_dc.ivrCampaignHoppers.rows">\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.ContactId}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell privacy ng-cloak>\n                        {{hopper.phone}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countcongestionretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countbusyretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnoanswerretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnosuchnumberretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countdropretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countabandonedretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countmachineretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countagentrejectretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{ hopper.scheduledat | formatdate }}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" md-cell>\n                        {{ vm_dc.arraypriority[hopper.priority].option }} </td>\n\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditIvrCampaignHopper($event, hopper)" translate="MOTIONDIALER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(hopper, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHoppers.rows.length">\n                      <td md-cell colspan="15">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHoppers.count}}" md-on-paginate="vm_dc.getIvrCampaignHoppers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HISTORY">HISTORY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperhistories md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperHistoriesController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERHISTORIES">HopperHistories</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperHistories()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHopperHistories()" aria-label="refresh HopperHistories" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERHISTORIES">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperHistories.length}} {{vm_dc.selectedIvrCampaignHopperHistories.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperHistories" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperHistories" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperHistory" md-select-id="id" ng-repeat="hopperHistory in vm_dc.ivrCampaignHopperHistories.rows">\n                      <td md-cell>\n                        {{hopperHistory.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.scheduledat | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.endtime | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperHistories.rows.length">\n                      <td md-cell colspan="11">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperHistories.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperHistories" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.FINAL">FINAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperfinals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperFinalsController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERFINALS">HopperFinals</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperFinals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getIvrCampaignHopperFinals()" aria-label="refresh HopperFinals" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERFINALS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                  <td md-cell class="actions">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="vm_dc.countContactsIvrCampaignHopperFinal(vm_dc.query.id); $mdOpenMenu($event);">\n                        <md-icon md-font-icon="icon-backup-restore"></md-icon>\n                        <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(3)">\n                            <span translate="MOTIONDIALER.NOANSWER ">NoAnswer</span>\n                            <span class="badge">({{vm_dc.contacts.noAnswerContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(5)">\n                            <span translate="MOTIONDIALER.BUSY ">Busy</span>\n                            <span class="badge">({{vm_dc.contacts.busyContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(8)">\n                            <span translate="MOTIONDIALER.CONGESTION ">Congestion</span>\n                            <span class="badge">({{vm_dc.contacts.congestionContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(10)">\n                            <span translate="MOTIONDIALER.DROPPED ">Drop</span>\n                            <span class="badge">({{vm_dc.contacts.dropContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(11)">\n                            <span translate="MOTIONDIALER.ABANDONED ">Abandoned</span>\n                            <span class="badge">({{vm_dc.contacts.abandonedContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(22)">\n                            <span translate="MOTIONDIALER.RECALLFAILEDTIMEOUT">Recall</span>\n                            <span class="badge">({{vm_dc.contacts.reCallContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(0)">\n                            <span translate="MOTIONDIALER.NO_SUCH_NUMBER">NoSuchNumber</span>\n                            <span class="badge">({{vm_dc.contacts.noSuchContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                          <md-button ng-click="vm_dc.moveContactsIvrCampaignHopperFinal(19)">\n                            <span translate="MOTIONDIALER.ANSWERING_MACHINE">AnsweringMachine</span>\n                            <span class="badge">({{vm_dc.contacts.answeringMachine}})</span>\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperFinals.length}} {{vm_dc.selectedIvrCampaignHopperFinals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperFinals" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.moveSelectedIvrCampaignHopperFinals($event)" aria-label="move selected" translate translate-attr-label="MOTIONDIALER.MOVE_SELECTED">\n                    <md-icon md-font-icon="icon-restore"></md-icon>\n                    <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperFinals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="disposition">\n                        {{ \'MOTIONDIALER.DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperFinal" md-select-id="id" ng-repeat="hopperFinal in vm_dc.ivrCampaignHopperFinals.rows">\n                      <td md-cell>\n                        {{hopperFinal.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countcongestionretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countbusyretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnoanswerretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnosuchnumberretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countdropretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countabandonedretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countmachineretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countagentrejectretry}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.disposition}}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.moveConfirm(hopperFinal, $event)" translate="MOTIONDIALER.MOVE_HOPPERFINAL">\n                                Move HopperFinal\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperFinals.rows.length">\n                      <td md-cell colspan="28">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperFinals.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperFinals" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.BLACKLIST">BLACKLIST</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="ivrCampaign-detail-form-container hopperblacks md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IvrCampaignHopperBlacksController as vm_dc" ng-init="vm_dc.init(vm.ivrCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIvrCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERBLACKS">HopperBlacks</span>\n                  <ms-search-bar on-search="vm_dc.getIvrCampaignHopperBlacks()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIvrCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIvrCampaignHopperBlacks.length}} {{vm_dc.selectedIvrCampaignHopperBlacks.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIvrCampaignHopperBlacks" csv-label="true" filename="ivrCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIvrCampaignHopperBlacks" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIvrCampaignHopperBlacks">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperBlack" md-select-id="id" ng-repeat="hopperBlack in vm_dc.ivrCampaignHopperBlacks.rows">\n                      <td md-cell>\n                        {{hopperBlack.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperBlack.phone}}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.ivrCampaignHopperBlacks.rows.length">\n                      <td md-cell colspan="4">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.ivrCampaignHopperBlacks.count}}" md-on-paginate="vm_dc.getIvrCampaignHopperBlacks" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/motiondialer/views/ivrCampaigns/ivrCampaigns.html",'<div id="ivrCampaigns" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-fire" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MOTIONDIALER.IVRCAMPAIGNS">IvrCampaigns</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MOTIONDIALER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedIvrCampaigns.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedIvrCampaigns =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MOTIONDIALER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-ivrCampaigns-count">\n          <span>{{vm.selectedIvrCampaigns.length}}</span>\n          <span translate="MOTIONDIALER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MOTIONDIALER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllIvrCampaigns()" translate="MOTIONDIALER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectIvrCampaigns()" translate="MOTIONDIALER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedIvrCampaigns" csv-label="true" filename="ivrCampaigns.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedIvrCampaigns($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- IVRCAMPAIGN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedIvrCampaigns" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getIvrCampaigns">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MOTIONDIALER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="SquareProjectId">{{ \'MOTIONDIALER.CALLYSQUAREPROJECT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.ivrCampaigns.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="ivrCampaign" md-select-id="id" ng-repeat="ivrCampaign in vm.ivrCampaigns.rows">\n                <td md-cell ng-if="ivrCampaign.userpic"><img class="avatar" alt="{{ivrCampaign.name}}" ng-src="api/users/{{ivrCampaign.id}}/avatar" /></td>\n                <td md-cell ng-if="!ivrCampaign.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{ivrCampaign.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="id ">{{ivrCampaign.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="name ">{{ivrCampaign.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{ivrCampaign.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{ivrCampaign.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':ivrCampaign.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(ivrCampaign, ev) : vm.createOrEditIvrCampaign($event, ivrCampaign)" md-cell class="SquareProjectId ">{{ (vm.projects | filter : {\'id\':ivrCampaign.SquareProjectId} : true)[0].name }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(ivrCampaign, $event    )" translate="MOTIONDIALER.EDIT_IVRCAMPAIGN">\n                          Edit IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(ivrCampaign, $event    )" translate="MOTIONDIALER.CLONE_IVRCAMPAIGN">\n                          clone IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.listadddialog(ivrCampaign, $event    )" translate="MOTIONDIALER.LISTADD_IVRCAMPAIGN">\n                          listadd IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.blacklistadddialog(ivrCampaign, $event    )" translate="MOTIONDIALER.BLACKLISTADD_IVRCAMPAIGN">\n                          blacklistadd IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(ivrCampaign, $event    )" translate="MOTIONDIALER.DELETE_IVRCAMPAIGN">\n                          Delete IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(ivrCampaign, $event    )" translate="MOTIONDIALER.GOTOREALTIME_IVRCAMPAIGN">\n                          goToRealtime IvrCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.ivrCampaigns.count}}" md-on-paginate="vm.getIvrCampaigns" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / IVRCAMPAIGN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD IVRCAMPAIGN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-ivrCampaign-button" ng-click="vm.createOrEditIvrCampaign($event)" aria-label="add ivrCampaign" translate translate-attr-aria-label="MOTIONDIALER.ADD_IVRCAMPAIGN">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD IVRCAMPAIGN BUTTON --\x3e\n</div>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/create/dialog.html",'<md-dialog class="queueCampaign-dialog" aria-label="New QueueCampaign">\n  <form name="queueCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newQueueCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="queueCampaignForm[\'name\'].$error" ng-show="queueCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n        <md-select name="TrunkId" ng-model="vm.queueCampaign.TrunkId" required>\n          <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'TrunkId\'].$error" ng-show="queueCampaignForm[\'TrunkId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n        <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n        <md-select name="IntervalId" ng-model="vm.queueCampaign.IntervalId" required>\n          <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'IntervalId\'].$error" ng-show="queueCampaignForm[\'IntervalId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n        <md-select name="dialCheckDuplicateType" ng-model="vm.queueCampaign.dialCheckDuplicateType" required>\n\n          <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n          <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n          <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="queueCampaignForm[\'dialCheckDuplicateType\'].$error" ng-show="queueCampaignForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.METHOD">Method</label>\n        <md-select name="dialMethod" ng-model="vm.queueCampaign.dialMethod" required>\n          <md-option ng-value="\'progressive\'">Progressive</md-option>\n          <md-option ng-value="\'power\'">PowerDialing</md-option>\n          <md-option ng-value="\'predictive\'">Predictive</md-option>\n          <md-option ng-value="\'preview\'">Preview</md-option>\n          <md-option ng-value="\'booked\'">BookedProgressive</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.METHOD"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialMethod\'].$error" ng-show="queueCampaignForm[\'dialMethod\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.METHOD_REQUIRED">Method field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'power\'" class="md-block">\n        <span translate="MOTIONDIALER.POWERLEVEL">PowerLevel</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.POWERLEVEL"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPowerLevel" min="1" max="10" step="0.1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <label translate="MOTIONDIALER.PREDICTIVEOPTIMIZATION">PredictiveOptimization</label>\n        <md-select name="dialPredictiveOptimization" ng-model="vm.queueCampaign.dialPredictiveOptimization">\n\n          <md-option ng-value="\'agentBusyFactor\'"> {{ \'MOTIONDIALER.AGENTBUSYFACTOR\' | translate }} </md-option>\n\n          <md-option ng-value="\'dropRate\'"> {{ \'MOTIONDIALER.DROPRATE\' | translate }} </md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATION"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialPredictiveOptimization\'].$error" ng-show="queueCampaignForm[\'dialPredictiveOptimization\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PREDICTIVEOPTIMIZATION_REQUIRED">PredictiveOptimization field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <span translate="MOTIONDIALER.PREDICTIVEOPTIMIZATIONPERCENTAGE">PredictiveOptimizationPercentage</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATIONPERCENTAGE"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveOptimizationPercentage" min="1" max="95" step="0.1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n        <span translate="MOTIONDIALER.PREDICTIVEINTERVAL">PredictiveInterval</span>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEINTERVAL"></span></div>\n        <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveInterval" min="5" max="30" step="1" class="md-accent"></md-slider>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n        <label translate="MOTIONDIALER.MAXCONCURRENTCALLS">MaxConcurrentCalls</label>\n        <input type="number" name="dialLimitQueue" ng-model="vm.queueCampaign.dialLimitQueue" min="0" max="9999" value="0" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.MAXCONCURRENTCALLS"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialLimitQueue\'].$error" ng-show="queueCampaignForm[\'dialLimitQueue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_REQUIRED">MaxConcurrentCalls field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>9999</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n        <label translate="MOTIONDIALER.QUEUETIMEOUT">QueueTimeout</label>\n        <input type="number" name="dialQueueTimeout" ng-model="vm.queueCampaign.dialQueueTimeout" min="1" max="999" value="3" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.QUEUETIMEOUT"></span></div>\n        <div ng-messages="queueCampaignForm[\'dialQueueTimeout\'].$error" ng-show="queueCampaignForm[\'dialQueueTimeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_REQUIRED">QueueTimeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>999</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.AGENTTIMEOUT">AgentTimeout</label>\n        <input type="number" name="timeout" ng-model="vm.queueCampaign.timeout" min="0" value="3" ng-required="true">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTTIMEOUT"></span></div>\n        <div ng-messages="queueCampaignForm[\'timeout\'].$error" ng-show="queueCampaignForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_REQUIRED">AgentTimeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentTimeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.queueCampaign.description">\n\n        <div ng-messages="queueCampaignForm[\'description\'].$error" ng-show="queueCampaignForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newQueueCampaign" ng-click="vm.saveQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid || queueCampaignForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newQueueCampaign" ng-click="vm.addNewQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_QUEUECAMPAIGN" translate-attr-aria-label="MOTIONDIALER.ADD_QUEUECAMPAIGN">\n          ADD QUEUECAMPAIGN\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newQueueCampaign" ng-click="vm.deleteQueueCampaign($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/agentadd/agentadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">Add Agent to queueCampaign</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="MOTIONDIALER.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/blacklistadd/blacklistadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">Add List in QUEUECAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/clone/clone.html",'<md-dialog class="queueCampaign-dialog" aria-label="Clone QueueCampaign">\n  <form name="queueCampaignForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newQueueCampaign">\n\n        <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n        <div ng-messages="queueCampaignForm[\'name\'].$error" ng-show="queueCampaignForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneQueueCampaign()" class="send-button md-accent md-raised" ng-disabled="queueCampaignForm.$invalid" aria-label="CLONE" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN" translate-attr-aria-label="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n        CLONE QUEUECAMPAIGN\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/hoppers/dialog.html",'<md-dialog class="hopper-dialog" aria-label="New Hopper">\n  <form name="hopperForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div class="md-block">\n        <label translate="MOTIONDIALER.SCHEDULEDAT">ScheduledAt</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click name="scheduledatDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.dateTime" ng-change="vm.recalcTZTime()">\n              <div ng-messages="hopperForm.dateRangeFrom.$error" ng-show="hopperForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click name="scheduledatTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.dateTime" ng-change="vm.recalcTZTime()">\n              <div ng-messages="hopperForm.timeRangeFrom.$error" ng-show="hopperForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="MOTIONDIALER.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div layout="row">\n        <div flex class="md-block">\n          <md-input-container class="md-block" flex-gt-sm="">\n            <label translate="DASHBOARDS.DIAL_TIMEZONE">Dial Timezone</label>\n            <ms-timezone name="dialTimezone" ng-model="vm.contact.dialTimezone" autofocus>\n          </md-input-container>\n        </div>\n        <div flex class="md-block">\n          <md-input-container class="md-block">\n            <label translate="DASHBOARDS.SYSTEM_TIME">System time</label>\n            <input type="text" readonly value="{{vm.hopper.scheduledat}}">\n          </md-input-container>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="MOTIONDIALER.PRIORITY">Priority</label>\n        <md-select name="priority" ng-model="vm.hopper.priority">\n          <md-option ng-value="\'4\'">Highest</md-option>\n          <md-option ng-value="\'3\'">High</md-option>\n          <md-option ng-value="\'2\'">Medium</md-option>\n          <md-option ng-value="\'1\'">Low</md-option>\n          <md-option ng-value="\'0\'">Lowest</md-option>\n        </md-select>\n        <div class="hint"><span translate="MOTIONDIALER.HELP.PRIORITY"></span></div>\n        <div ng-messages="hopperForm[\'priority\'].$error" ng-show="hopperForm[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.hopper.recallme" aria-label="RecallAgent"><span translate="MOTIONDIALER.RECALLAGENT">RecallAgent</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.hopper.recallme" class="md-block">\n        <label translate="MOTIONDIALER.AGENT">Agent</label>\n        <md-select name="UserId" ng-model="vm.hopper.UserId" required>\n          <md-option ng-value="UserId.id" ng-repeat="UserId in vm.agents" ng-disabled="UserId.canSelect === false">{{ UserId.name }}</md-option>\n        </md-select>\n        <div ng-messages="hopperForm[\'UserId\'].$error" ng-show="hopperForm[\'UserId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="MOTIONDIALER.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newHopper" ng-click="vm.saveHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid || hopperForm.$pristine" aria-label="SAVE" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newHopper" ng-click="vm.addNewHopper()" class="send-button md-accent md-raised" ng-disabled="hopperForm.$invalid" aria-label="ADD" translate="MOTIONDIALER.ADD_HOPPER" translate-attr-aria-label="MOTIONDIALER.ADD_HOPPER">\n          ADD HOPPER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newHopper" ng-click="vm.deleteHopper($event)" aria-label="DELETE" translate translate-attr-aria-label="MOTIONDIALER.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="MOTIONDIALER.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/listadd/listadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">Add List in QUEUECAMPAIGN</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect ng-hide="vm.loading" options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n      <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n        <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveLists()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/resetlist/resetlist.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.RESETLIST ">Reset List</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-wrap flex>\n        <div flex-xs flex="50">\n          <md-checkbox aria-label="Select All" ng-checked="vm.isChecked()" md-indeterminate="vm.isIndeterminate()" ng-click="vm.toggleAll()">\n            <span ng-if="vm.isChecked()" translate="MOTIONDIALER.UNSELECTALL"></span>\n            <span ng-if="!vm.isChecked()" translate="MOTIONDIALER.SELECTALL"></span>\n          </md-checkbox>\n        </div>\n        <div flex-xs flex="50">\n        </div>\n        <div flex="{{vm.items.length > 10 ? 50 : 100 }}" ng-repeat="item in vm.items">\n          <md-checkbox ng-checked="vm.exists(item, vm.selected)" ng-click="vm.toggle(item, vm.selected)">\n            {{ item.name | limitTo:40 }}\n          </md-checkbox>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions ng-hide="vm.loading" layout="row" layout-align="end center">\n      <div>\n      </div>\n      <md-button type="submit" ng-click="vm.listSelected()" class="send-button md-accent md-raised" ng-disabled="vm.loading" aria-label="RESET" translate="MOTIONDIALER.RESET" translate-attr-aria-label="MOTIONDIALER.RESET">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/teamadd/teamadd.html",'<md-dialog class="queueCampaign-dialog" aria-label="queueCampaign" ng-init="vm.onInit()">\n  <form name="queueCampaignForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="MOTIONDIALER.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="MOTIONDIALER.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="queueCampaignForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/edit/view.html",'<div id="motiondialer-queueCampaign" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-queueCampaigns-button md-icon-button" aria-label="Go to queueCampaigns" ng-click="vm.gotoQueueCampaigns()" translate translate-attr-aria-label="MOTIONDIALER.GO_TO_QUEUECAMPAIGNS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="queueCampaign-image" hide-xs>\n          <img ng-src="assets/images/business/queueCampaigns.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.queueCampaign.id}}\n            <span ng-if="vm.queueCampaign.name">{{vm.queueCampaign.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="MOTIONDIALER.CREATED_AT"></span> <span>{{vm.queueCampaign.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.queueCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.listadddialog(vm.queueCampaign, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="listadd">\n        <md-tooltip><span translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-format-list-numbers"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.blacklistadddialog(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="blacklistadd">\n        <md-tooltip><span translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-block-helper"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.queueCampaign, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.queueCampaign, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.resetlistdialog(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="resetlist">\n        <md-tooltip><span translate="MOTIONDIALER.RESETLIST_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-restore"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.queueCampaign, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="MOTIONDIALER.GOTO_QUEUECAMPAIGN"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveQueueCampaign()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (campaignForm.$invalid) || (queueForm.$invalid) || (originateForm.$invalid) || (globalForm.$invalid) || (congestionForm.$invalid) || (busyForm.$invalid) || (noanswerForm.$invalid) || (nosuchnumberForm.$invalid) || (dropForm.$invalid) || (abandonedForm.$invalid) || (machineForm.$invalid) || (agentrejectForm.$invalid) || (additionalphonesForm.$invalid) || (advancedForm.$invalid) || (advancedpreviewForm.$invalid) || (thresholdsForm.$invalid) || (recallmeForm.$invalid) || (globalintervalForm.$invalid) || (timezoneForm.$invalid) || (amdForm.$invalid) || (hopperStatisticsForm.$invalid) || (hoppersForm.$invalid) || (hopperHistoriesForm.$invalid) || (hopperFinalsForm.$invalid) || (hopperBlacksForm.$invalid)" translate="MOTIONDIALER.SAVE" translate-attr-aria-label="MOTIONDIALER.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.queueCampaign.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialActive" aria-label="Active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.ACTIVE">Active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TRUNK">Trunk</label>\n                <md-select name="TrunkId" ng-model="vm.queueCampaign.TrunkId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="TrunkId.id" ng-repeat="TrunkId in vm.trunks" ng-disabled="TrunkId.canSelect === false">{{ TrunkId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkId\'].$error" ng-show="generalForm[\'TrunkId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BACKUPTRUNK">BackupTrunk</label>\n                <md-select name="TrunkBackupId" ng-model="vm.queueCampaign.TrunkBackupId" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="TrunkBackupId.id" ng-repeat="TrunkBackupId in vm.trunks" ng-disabled="TrunkBackupId.canSelect === false">{{ TrunkBackupId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'TrunkBackupId\'].$error" ng-show="generalForm[\'TrunkBackupId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BACKUPTRUNK_REQUIRED">BackupTrunk field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n                <label translate="MOTIONDIALER.INTERVAL">Interval</label>\n                <md-select name="IntervalId" ng-model="vm.queueCampaign.IntervalId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="IntervalId.id" ng-repeat="IntervalId in vm.interval" ng-disabled="IntervalId.canSelect === false">{{ IntervalId.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'IntervalId\'].$error" ng-show="generalForm[\'IntervalId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.INTERVAL_REQUIRED">Interval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CHECKDUPLICATE">CheckDuplicate</label>\n                <md-select name="dialCheckDuplicateType" ng-model="vm.queueCampaign.dialCheckDuplicateType" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'always\'"> {{ \'MOTIONDIALER.ALWAYS\' | translate }} </md-option>\n\n                  <md-option ng-value="\'never\'"> {{ \'MOTIONDIALER.NEVER\' | translate }} </md-option>\n\n                  <md-option ng-value="\'onlyIfOpen\'"> {{ \'MOTIONDIALER.ONLY_IF_OPEN\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'dialCheckDuplicateType\'].$error" ng-show="generalForm[\'dialCheckDuplicateType\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CHECKDUPLICATE_REQUIRED">CheckDuplicate field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CUTDIGIT">CutDigit</label>\n                <input type="number" name="dialCutDigit" ng-model="vm.queueCampaign.dialCutDigit" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'dialCutDigit\'].$error" ng-show="generalForm[\'dialCutDigit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_REQUIRED">CutDigit field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CUTDIGIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">CutDigit must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.queueCampaign.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container campaign md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CAMPAIGN">CAMPAIGN</div>\n            </div>\n            <form name="campaignForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.METHOD">Method</label>\n                <md-select name="dialMethod" ng-model="vm.queueCampaign.dialMethod" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'progressive\'">Progressive</md-option>\n                  <md-option ng-value="\'power\'">PowerDialing</md-option>\n                  <md-option ng-value="\'predictive\'">Predictive</md-option>\n                  <md-option ng-value="\'preview\'">Preview</md-option>\n                  <md-option ng-value="\'booked\'">BookedProgressive</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.METHOD"></span></div>\n                <div ng-messages="campaignForm[\'dialMethod\'].$error" ng-show="campaignForm[\'dialMethod\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.METHOD_REQUIRED">Method field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'power\'" class="md-block">\n                <span translate="MOTIONDIALER.POWERLEVEL">PowerLevel</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.POWERLEVEL"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPowerLevel" min="1" max="10" step="0.1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <label translate="MOTIONDIALER.PREDICTIVEOPTIMIZATION">PredictiveOptimization</label>\n                <md-select name="dialPredictiveOptimization" ng-model="vm.queueCampaign.dialPredictiveOptimization" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'agentBusyFactor\'"> {{ \'MOTIONDIALER.AGENTBUSYFACTOR\' | translate }} </md-option>\n\n                  <md-option ng-value="\'dropRate\'"> {{ \'MOTIONDIALER.DROPRATE\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATION"></span></div>\n                <div ng-messages="campaignForm[\'dialPredictiveOptimization\'].$error" ng-show="campaignForm[\'dialPredictiveOptimization\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREDICTIVEOPTIMIZATION_REQUIRED">PredictiveOptimization field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEOPTIMIZATIONPERCENTAGE">PredictiveOptimizationPercentage</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEOPTIMIZATIONPERCENTAGE"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveOptimizationPercentage" min="1" max="95" step="0.1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEINTERVAL">PredictiveInterval</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEINTERVAL"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveInterval" min="5" max="30" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="md-block">\n                <label translate="MOTIONDIALER.MAXCONCURRENTCALLS">MaxConcurrentCalls</label>\n                <input type="number" name="dialLimitQueue" ng-model="vm.queueCampaign.dialLimitQueue" min="0" max="9999" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MAXCONCURRENTCALLS"></span></div>\n                <div ng-messages="campaignForm[\'dialLimitQueue\'].$error" ng-show="campaignForm[\'dialLimitQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_REQUIRED">MaxConcurrentCalls field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MAXCONCURRENTCALLS_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxConcurrentCalls must be a valid greater or equal than</span> <span>9999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTTIMEOUT">AgentTimeout</label>\n                <input type="number" name="timeout" ng-model="vm.queueCampaign.timeout" min="0" value="3" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTTIMEOUT"></span></div>\n                <div ng-messages="campaignForm[\'timeout\'].$error" ng-show="campaignForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_REQUIRED">AgentTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentTimeout must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container queue md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.QUEUE">QUEUE</div>\n            </div>\n            <form name="queueForm" novalidate>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.QUEUEOPTIONS">QueueOptions</label>\n                <input type="text" name="dialQueueOptions" ng-model="vm.queueCampaign.dialQueueOptions" value="tTxX" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="queueForm[\'dialQueueOptions\'].$error" ng-show="queueForm[\'dialQueueOptions\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUEOPTIONS_REQUIRED">QueueOptions field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.QUEUETIMEOUT">QueueTimeout</label>\n                <input type="number" name="dialQueueTimeout" ng-model="vm.queueCampaign.dialQueueTimeout" min="1" max="999" value="3" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.QUEUETIMEOUT"></span></div>\n                <div ng-messages="queueForm[\'dialQueueTimeout\'].$error" ng-show="queueForm[\'dialQueueTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_REQUIRED">QueueTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.QUEUETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">QueueTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'booked\' || vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.queueCampaign.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n                  <md-option ng-value="\'roundrobin\'" ng-if="vm.queueCampaign.dialMethod === \'booked\'">Round Robin</md-option>\n                  <md-option ng-value="\'leastrecent\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Least Recent</md-option>\n                  <md-option ng-value="\'fewestcalls\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Fewest Calls</md-option>\n                  <md-option ng-value="\'random\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Random</md-option>\n                  <md-option ng-value="\'linear\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Linear</md-option>\n                  <md-option ng-value="\'wrandom\'" ng-if="vm.queueCampaign.dialMethod !== \'booked\'">Weight Random</md-option>\n                </md-select>\n                <div ng-messages="queueForm[\'strategy\'].$error" ng-show="queueForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.RETRY">Retry</label>\n                <input type="number" name="retry" ng-model="vm.queueCampaign.retry" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RETRY"></span></div>\n                <div ng-messages="queueForm[\'retry\'].$error" ng-show="queueForm[\'retry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RETRY_REQUIRED">Retry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Retry must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.WRAPUPTIME">WrapupTime</label>\n                <input type="number" name="wrapuptime" ng-model="vm.queueCampaign.wrapuptime" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.WRAPUPTIME"></span></div>\n                <div ng-messages="queueForm[\'wrapuptime\'].$error" ng-show="queueForm[\'wrapuptime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.WRAPUPTIME_REQUIRED">WrapupTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.WRAPUPTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WrapupTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.WEIGHT">Weight</label>\n                <input type="number" name="weight" ng-model="vm.queueCampaign.weight" min="0" value="1" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.WEIGHT"></span></div>\n                <div ng-messages="queueForm[\'weight\'].$error" ng-show="queueForm[\'weight\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.WEIGHT_REQUIRED">Weight field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.WEIGHT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Weight must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.MUSICONHOLD">MusicOnHold</label>\n                <md-select name="musiconhold" ng-model="vm.queueCampaign.musiconhold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="musiconhold.name" ng-repeat="musiconhold in vm.musiconholds" ng-disabled="musiconhold.canSelect === false">{{ musiconhold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MUSICONHOLD"></span></div>\n                <div ng-messages="queueForm[\'musiconhold\'].$error" ng-show="queueForm[\'musiconhold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MUSICONHOLD_REQUIRED">MusicOnHold field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT">CallySquareProject</label>\n                <md-select name="dialQueueProject" ng-model="vm.queueCampaign.dialQueueProject" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject.name" ng-repeat="dialQueueProject in vm.projects" ng-disabled="dialQueueProject.canSelect === false">{{ dialQueueProject.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECT"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject\'].$error" ng-show="queueForm[\'dialQueueProject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT_REQUIRED">CallySquareProject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECT2">CallySquareProject2</label>\n                <md-select name="dialQueueProject2" ng-model="vm.queueCampaign.dialQueueProject2" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject2.name" ng-repeat="dialQueueProject2 in vm.projects" ng-disabled="dialQueueProject2.canSelect === false">{{ dialQueueProject2.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECT2"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject2\'].$error" ng-show="queueForm[\'dialQueueProject2\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECT2_REQUIRED">CallySquareProject2 field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECTPREVIEW">CallySquareProjectPreview</label>\n                <md-select name="dialQueueProject" ng-model="vm.queueCampaign.dialQueueProject" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject.name" ng-repeat="dialQueueProject in vm.projects" ng-disabled="dialQueueProject.canSelect === false">{{ dialQueueProject.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECTPREVIEW"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject\'].$error" ng-show="queueForm[\'dialQueueProject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECTPREVIEW_REQUIRED">CallySquareProjectPreview field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="md-block">\n                <label translate="MOTIONDIALER.CALLYSQUAREPROJECTPREVIEW2">CallySquareProjectPreview2</label>\n                <md-select name="dialQueueProject2" ng-model="vm.queueCampaign.dialQueueProject2" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">None</md-option>\n                  <md-option ng-value="dialQueueProject2.name" ng-repeat="dialQueueProject2 in vm.projects" ng-disabled="dialQueueProject2.canSelect === false">{{ dialQueueProject2.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CALLYSQUAREPROJECTPREVIEW2"></span></div>\n                <div ng-messages="queueForm[\'dialQueueProject2\'].$error" ng-show="queueForm[\'dialQueueProject2\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLYSQUAREPROJECTPREVIEW2_REQUIRED">CallySquareProjectPreview2 field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialQueueProject2 && (vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\')" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialAgiAfterHangupAgent" aria-label="RunIfHangupAgent" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.RUNIFHANGUPAGENT">RunIfHangupAgent</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RUNIFHANGUPAGENT"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container originate md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ORIGINATE">ORIGINATE</div>\n            </div>\n            <form name="originateForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNAME">OriginateCallerIdName</label>\n                <input type="text" name="dialOriginateCallerIdName" ng-model="vm.queueCampaign.dialOriginateCallerIdName" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNAME"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdName\'].$error" ng-show="originateForm[\'dialOriginateCallerIdName\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNAME_REQUIRED">OriginateCallerIdName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATECALLERIDNUMBER">OriginateCallerIdNumber</label>\n                <input type="text" name="dialOriginateCallerIdNumber" ng-model="vm.queueCampaign.dialOriginateCallerIdNumber" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATECALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateCallerIdNumber\'].$error" ng-show="originateForm[\'dialOriginateCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATECALLERIDNUMBER_REQUIRED">OriginateCallerIdNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RANDOMLASTDIGITCALLERIDNUMBER">RandomLastDigitCallerIdNumber</label>\n                <input type="number" name="dialRandomLastDigitCallerIdNumber" ng-model="vm.queueCampaign.dialRandomLastDigitCallerIdNumber" min="0" max="15" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RANDOMLASTDIGITCALLERIDNUMBER"></span></div>\n                <div ng-messages="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$error" ng-show="originateForm[\'dialRandomLastDigitCallerIdNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_REQUIRED">RandomLastDigitCallerIdNumber field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.RANDOMLASTDIGITCALLERIDNUMBER_MUST_BE_LESS_THAN_OR_EQUAL_TO">RandomLastDigitCallerIdNumber must be a valid greater or equal than</span> <span>15</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ORIGINATETIMEOUT">OriginateTimeout</label>\n                <input type="number" name="dialOriginateTimeout" ng-model="vm.queueCampaign.dialOriginateTimeout" min="1" max="999" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ORIGINATETIMEOUT"></span></div>\n                <div ng-messages="originateForm[\'dialOriginateTimeout\'].$error" ng-show="originateForm[\'dialOriginateTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_REQUIRED">OriginateTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ORIGINATETIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">OriginateTimeout must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.PREFIX">Prefix</label>\n                <input type="text" name="dialPrefix" ng-model="vm.queueCampaign.dialPrefix" ng-pattern="/^\\d+$/" value="" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREFIX"></span></div>\n                <div ng-messages="originateForm[\'dialPrefix\'].$error" ng-show="originateForm[\'dialPrefix\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="MOTIONDIALER.ERRORS.PREFIX_MUST_VALID_PATTERN" translate-values="{ regex: \'/^\\d+$/\' }">Prefix must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.RETRYANDFREQUENCY">RETRYANDFREQUENCY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container global md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBAL">GLOBAL</div>\n            </div>\n            <form name="globalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALMAXRETRY">GlobalMaxRetry</label>\n                <input type="number" name="dialGlobalMaxRetry" ng-model="vm.queueCampaign.dialGlobalMaxRetry" min="1" max="999" value="4" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALMAXRETRY"></span></div>\n                <div ng-messages="globalForm[\'dialGlobalMaxRetry\'].$error" ng-show="globalForm[\'dialGlobalMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_REQUIRED">GlobalMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">GlobalMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container congestion md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.CONGESTION">CONGESTION</div>\n            </div>\n            <form name="congestionForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONMAXRETRY">CongestionMaxRetry</label>\n                <input type="number" name="dialCongestionMaxRetry" ng-model="vm.queueCampaign.dialCongestionMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONMAXRETRY"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionMaxRetry\'].$error" ng-show="congestionForm[\'dialCongestionMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_REQUIRED">CongestionMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONGESTIONRETRYTIME">CongestionRetryTime</label>\n                <input type="number" name="dialCongestionRetryFrequency" ng-model="vm.queueCampaign.dialCongestionRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONGESTIONRETRYTIME"></span></div>\n                <div ng-messages="congestionForm[\'dialCongestionRetryFrequency\'].$error" ng-show="congestionForm[\'dialCongestionRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_REQUIRED">CongestionRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CONGESTIONRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">CongestionRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container busy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.BUSY">BUSY</div>\n            </div>\n            <form name="busyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYMAXRETRY">BusyMaxRetry</label>\n                <input type="number" name="dialBusyMaxRetry" ng-model="vm.queueCampaign.dialBusyMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYMAXRETRY"></span></div>\n                <div ng-messages="busyForm[\'dialBusyMaxRetry\'].$error" ng-show="busyForm[\'dialBusyMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_REQUIRED">BusyMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.BUSYRETRYTIME">BusyRetryTime</label>\n                <input type="number" name="dialBusyRetryFrequency" ng-model="vm.queueCampaign.dialBusyRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.BUSYRETRYTIME"></span></div>\n                <div ng-messages="busyForm[\'dialBusyRetryFrequency\'].$error" ng-show="busyForm[\'dialBusyRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_REQUIRED">BusyRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.BUSYRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">BusyRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container noanswer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOANSWER">NOANSWER</div>\n            </div>\n            <form name="noanswerForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERMAXRETRY">NoAnswerMaxRetry</label>\n                <input type="number" name="dialNoAnswerMaxRetry" ng-model="vm.queueCampaign.dialNoAnswerMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERMAXRETRY"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerMaxRetry\'].$error" ng-show="noanswerForm[\'dialNoAnswerMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_REQUIRED">NoAnswerMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOANSWERRETRYTIME">NoAnswerRetryTime</label>\n                <input type="number" name="dialNoAnswerRetryFrequency" ng-model="vm.queueCampaign.dialNoAnswerRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOANSWERRETRYTIME"></span></div>\n                <div ng-messages="noanswerForm[\'dialNoAnswerRetryFrequency\'].$error" ng-show="noanswerForm[\'dialNoAnswerRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_REQUIRED">NoAnswerRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOANSWERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoAnswerRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container nosuchnumber md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.NOSUCHNUMBER">NOSUCHNUMBER</div>\n            </div>\n            <form name="nosuchnumberForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERMAXRETRY">NoSuchNumberMaxRetry</label>\n                <input type="number" name="dialNoSuchNumberMaxRetry" ng-model="vm.queueCampaign.dialNoSuchNumberMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERMAXRETRY"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_REQUIRED">NoSuchNumberMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.NOSUCHNUMBERRETRYTIME">NoSuchNumberRetryTime</label>\n                <input type="number" name="dialNoSuchNumberRetryFrequency" ng-model="vm.queueCampaign.dialNoSuchNumberRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.NOSUCHNUMBERRETRYTIME"></span></div>\n                <div ng-messages="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$error" ng-show="nosuchnumberForm[\'dialNoSuchNumberRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_REQUIRED">NoSuchNumberRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.NOSUCHNUMBERRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">NoSuchNumberRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container drop md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.DROP">DROP</div>\n            </div>\n            <form name="dropForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPMAXRETRY">DropMaxRetry</label>\n                <input type="number" name="dialDropMaxRetry" ng-model="vm.queueCampaign.dialDropMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPMAXRETRY"></span></div>\n                <div ng-messages="dropForm[\'dialDropMaxRetry\'].$error" ng-show="dropForm[\'dialDropMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_REQUIRED">DropMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DROPRETRYTIME">DropRetryTime</label>\n                <input type="number" name="dialDropRetryFrequency" ng-model="vm.queueCampaign.dialDropRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DROPRETRYTIME"></span></div>\n                <div ng-messages="dropForm[\'dialDropRetryFrequency\'].$error" ng-show="dropForm[\'dialDropRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_REQUIRED">DropRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.DROPRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">DropRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container abandoned md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ABANDONED">ABANDONED</div>\n            </div>\n            <form name="abandonedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDMAXRETRY">AbandonedMaxRetry</label>\n                <input type="number" name="dialAbandonedMaxRetry" ng-model="vm.queueCampaign.dialAbandonedMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDMAXRETRY"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedMaxRetry\'].$error" ng-show="abandonedForm[\'dialAbandonedMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_REQUIRED">AbandonedMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.ABANDONEDRETRYTIME">AbandonedRetryTime</label>\n                <input type="number" name="dialAbandonedRetryFrequency" ng-model="vm.queueCampaign.dialAbandonedRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.ABANDONEDRETRYTIME"></span></div>\n                <div ng-messages="abandonedForm[\'dialAbandonedRetryFrequency\'].$error" ng-show="abandonedForm[\'dialAbandonedRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_REQUIRED">AbandonedRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.ABANDONEDRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AbandonedRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container machine md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.MACHINE">MACHINE</div>\n            </div>\n            <form name="machineForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINEMAXRETRY">MachineMaxRetry</label>\n                <input type="number" name="dialMachineMaxRetry" ng-model="vm.queueCampaign.dialMachineMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINEMAXRETRY"></span></div>\n                <div ng-messages="machineForm[\'dialMachineMaxRetry\'].$error" ng-show="machineForm[\'dialMachineMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_REQUIRED">MachineMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINEMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MACHINERETRYTIME">MachineRetryTime</label>\n                <input type="number" name="dialMachineRetryFrequency" ng-model="vm.queueCampaign.dialMachineRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MACHINERETRYTIME"></span></div>\n                <div ng-messages="machineForm[\'dialMachineRetryFrequency\'].$error" ng-show="machineForm[\'dialMachineRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_REQUIRED">MachineRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.MACHINERETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">MachineRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container agentreject md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AGENTREJECT">AGENTREJECT</div>\n            </div>\n            <form name="agentrejectForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTMAXRETRY">AgentRejectMaxRetry</label>\n                <input type="number" name="dialAgentRejectMaxRetry" ng-model="vm.queueCampaign.dialAgentRejectMaxRetry" min="1" max="999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTMAXRETRY"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectMaxRetry\'].$error" ng-show="agentrejectForm[\'dialAgentRejectMaxRetry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_REQUIRED">AgentRejectMaxRetry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTMAXRETRY_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectMaxRetry must be a valid greater or equal than</span> <span>999</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AGENTREJECTRETRYTIME">AgentRejectRetryTime</label>\n                <input type="number" name="dialAgentRejectRetryFrequency" ng-model="vm.queueCampaign.dialAgentRejectRetryFrequency" min="1" max="99999" value="150" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AGENTREJECTRETRYTIME"></span></div>\n                <div ng-messages="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$error" ng-show="agentrejectForm[\'dialAgentRejectRetryFrequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_REQUIRED">AgentRejectRetryTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AGENTREJECTRETRYTIME_MUST_BE_LESS_THAN_OR_EQUAL_TO">AgentRejectRetryTime must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container additionalphones md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADDITIONALPHONES">ADDITIONALPHONES</div>\n            </div>\n            <form name="additionalphonesForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CALLADDITIONALPHONEAFTERMIN">CallAdditionalPhoneAfterMin</label>\n                <input type="number" name="callAdditionalPhoneAfterMin" ng-model="vm.queueCampaign.callAdditionalPhoneAfterMin" min="1" max="99999" value="3" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="additionalphonesForm[\'callAdditionalPhoneAfterMin\'].$error" ng-show="additionalphonesForm[\'callAdditionalPhoneAfterMin\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_REQUIRED">CallAdditionalPhoneAfterMin field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CallAdditionalPhoneAfterMin must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.CALLADDITIONALPHONEAFTERMIN_MUST_BE_LESS_THAN_OR_EQUAL_TO">CallAdditionalPhoneAfterMin must be a valid greater or equal than</span> <span>99999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="queueCampaign-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.acw" class="md-block">\n                <label translate="MOTIONDIALER.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.queueCampaign.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedForm[\'acwTimeout\'].$error" ng-show="advancedForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.AUTOPAUSE">AutoPause</label>\n                <md-select name="autopause" ng-model="vm.queueCampaign.autopause" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'all\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AUTOPAUSE"></span></div>\n                <div ng-messages="advancedForm[\'autopause\'].$error" ng-show="advancedForm[\'autopause\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AUTOPAUSE_REQUIRED">AutoPause field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.RINGINUSE">RingInUse</label>\n                <md-select name="ringinuse" ng-model="vm.queueCampaign.ringinuse" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.RINGINUSE"></span></div>\n                <div ng-messages="advancedForm[\'ringinuse\'].$error" ng-show="advancedForm[\'ringinuse\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.RINGINUSE_REQUIRED">RingInUse field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MEMBERDELAY">MemberDelay</label>\n                <input type="number" name="memberdelay" ng-model="vm.queueCampaign.memberdelay" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MEMBERDELAY"></span></div>\n                <div ng-messages="advancedForm[\'memberdelay\'].$error" ng-show="advancedForm[\'memberdelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MEMBERDELAY_REQUIRED">MemberDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.MEMBERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MemberDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEOUTRESTART">TimeoutRestart</label>\n                <md-select name="timeoutrestart" ng-model="vm.queueCampaign.timeoutrestart" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEOUTRESTART"></span></div>\n                <div ng-messages="advancedForm[\'timeoutrestart\'].$error" ng-show="advancedForm[\'timeoutrestart\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEOUTRESTART_REQUIRED">TimeoutRestart field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.queueCampaign.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedForm[\'monitor_format\'].$error" ng-show="advancedForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.CONTEXT">Context</label>\n                <input type="text" name="context" ng-model="vm.queueCampaign.context" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.CONTEXT"></span></div>\n                <div ng-messages="advancedForm[\'context\'].$error" ng-show="advancedForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETINTERFACEVARIABLES">SetInterfaceVariables</label>\n                <md-select name="setinterfacevar" ng-model="vm.queueCampaign.setinterfacevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETINTERFACEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setinterfacevar\'].$error" ng-show="advancedForm[\'setinterfacevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETINTERFACEVARIABLES_REQUIRED">SetInterfaceVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETQUEUEVARIABLES">SetQueueVariables</label>\n                <md-select name="setqueuevar" ng-model="vm.queueCampaign.setqueuevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETQUEUEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueuevar\'].$error" ng-show="advancedForm[\'setqueuevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETQUEUEVARIABLES_REQUIRED">SetQueueVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.SETQUEUEENTRYVARIABLES">SetQueueEntryVariables</label>\n                <md-select name="setqueueentryvar" ng-model="vm.queueCampaign.setqueueentryvar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'MOTIONDIALER.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'MOTIONDIALER.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.SETQUEUEENTRYVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueueentryvar\'].$error" ng-show="advancedForm[\'setqueueentryvar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.SETQUEUEENTRYVARIABLES_REQUIRED">SetQueueEntryVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.queueCampaign.dialOrderByScheduledAt" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.mandatoryDisposition" class="md-block">\n                <label translate="MOTIONDIALER.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.queueCampaign.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'preview\' || vm.queueCampaign.dialMethod === \'booked\'" class="queueCampaign-detail-form-container advancedpreview md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.ADVANCEDPREVIEW">ADVANCEDPREVIEW</div>\n            </div>\n            <form name="advancedpreviewForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.acw" class="md-block">\n                <label translate="MOTIONDIALER.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.queueCampaign.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedpreviewForm[\'acwTimeout\'].$error" ng-show="advancedpreviewForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.queueCampaign.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedpreviewForm[\'monitor_format\'].$error" ng-show="advancedpreviewForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALORDERBYSCHEDULEDAT">DialOrderByScheduledAt</label>\n                <md-select name="dialOrderByScheduledAt" ng-model="vm.queueCampaign.dialOrderByScheduledAt" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'DESC\'"> {{ \'MOTIONDIALER.DESC\' | translate }} </md-option>\n\n                  <md-option ng-value="\'ASC\'"> {{ \'MOTIONDIALER.ASC\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALORDERBYSCHEDULEDAT"></span></div>\n                <div ng-messages="advancedpreviewForm[\'dialOrderByScheduledAt\'].$error" ng-show="advancedpreviewForm[\'dialOrderByScheduledAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALORDERBYSCHEDULEDAT_REQUIRED">DialOrderByScheduledAt field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.mandatoryDisposition" class="md-block">\n                <label translate="MOTIONDIALER.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.queueCampaign.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedpreviewForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedpreviewForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'predictive\'" class="queueCampaign-detail-form-container thresholds md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.THRESHOLDS">THRESHOLDS</div>\n            </div>\n            <form name="thresholdsForm" novalidate>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEMAXTHRESHOLD">PredictiveMaxThreshold</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEMAXTHRESHOLD"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveIntervalMaxThreshold" min="1" max="100" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'predictive\'" class="md-block">\n                <span translate="MOTIONDIALER.PREDICTIVEMINTHRESHOLD">PredictiveMinThreshold</span>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREDICTIVEMINTHRESHOLD"></span></div>\n                <md-slider md-discrete flex ng-model="vm.queueCampaign.dialPredictiveIntervalMinThreshold" min="1" max="100" step="1" class="md-accent"></md-slider>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="queueCampaign-detail-form-container recallme md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.RECALLME">RECALLME</div>\n            </div>\n            <form name="recallmeForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.DIALRECALLMETIMEOUT">DialRecallMeTimeout</label>\n                <input type="number" name="dialRecallMeTimeout" ng-model="vm.queueCampaign.dialRecallMeTimeout" min="1" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALRECALLMETIMEOUT"></span></div>\n                <div ng-messages="recallmeForm[\'dialRecallMeTimeout\'].$error" ng-show="recallmeForm[\'dialRecallMeTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.DIALRECALLMETIMEOUT_REQUIRED">DialRecallMeTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.DIALRECALLMETIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">DialRecallMeTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialRecallInQueue" aria-label="DialRecallInQueue" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.DIALRECALLINQUEUE">DialRecallInQueue</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.DIALRECALLINQUEUE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'preview\'" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialPreviewAutoRecallMe" aria-label="Preview_Auto_Recall_Me" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.PREVIEW_AUTO_RECALL_ME">Preview_Auto_Recall_Me</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREVIEW_AUTO_RECALL_ME"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialMethod == \'preview\'" class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialPreviewRecallmeReminder" aria-label="Preview_Recall_Me_Reminder" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.PREVIEW_RECALL_ME_REMINDER">Preview_Recall_Me_Reminder</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.PREVIEW_RECALL_ME_REMINDER"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="queueCampaign-detail-form-container globalinterval md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.GLOBALINTERVAL">GLOBALINTERVAL</div>\n            </div>\n            <form name="globalintervalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.GLOBALINTERVAL">GlobalInterval</label>\n                <input type="text" name="dialGlobalInterval" ng-model="vm.queueCampaign.dialGlobalInterval" value="07:00-22:00,*,*,*" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.GLOBALINTERVAL"></span></div>\n                <div ng-messages="globalintervalForm[\'dialGlobalInterval\'].$error" ng-show="globalintervalForm[\'dialGlobalInterval\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.GLOBALINTERVAL_REQUIRED">GlobalInterval field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod != \'preview\'" class="queueCampaign-detail-form-container timezone md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.TIMEZONE">TIMEZONE</div>\n            </div>\n            <form name="timezoneForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="MOTIONDIALER.TIMEZONE">Timezone</label>\n                <ms-timezone name="dialTimezone" ng-model="vm.queueCampaign.dialTimezone" autofocus ng-disabled="!vm.crudPermissions.canEdit"></ms-timezone>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.TIMEZONE"></span></div>\n                <div ng-messages="timezoneForm[\'dialTimezone\'].$error" ng-show="timezoneForm[dialTimezone].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div ng-if="vm.queueCampaign.dialMethod === \'progressive\' || vm.queueCampaign.dialMethod === \'predictive\' || vm.queueCampaign.dialMethod === \'power\'" class="queueCampaign-detail-form-container amd md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="MOTIONDIALER.AMD">AMD</div>\n            </div>\n            <form name="amdForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.queueCampaign.dialAMDActive" aria-label="AMDActive" ng-disabled="!vm.crudPermissions.canEdit"><span translate="MOTIONDIALER.AMDACTIVE">AMDActive</span></md-switch>\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDACTIVE"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDINITIALSILENCE">AMDInitialSilence</label>\n                <input type="number" name="dialAMDInitialSilence" ng-model="vm.queueCampaign.dialAMDInitialSilence" min="0" value="2500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDINITIALSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDInitialSilence\'].$error" ng-show="amdForm[\'dialAMDInitialSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_REQUIRED">AMDInitialSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDINITIALSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDInitialSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDGREETING">AMDGreeting</label>\n                <input type="number" name="dialAMDGreeting" ng-model="vm.queueCampaign.dialAMDGreeting" min="0" value="1500" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDGREETING"></span></div>\n                <div ng-messages="amdForm[\'dialAMDGreeting\'].$error" ng-show="amdForm[\'dialAMDGreeting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_REQUIRED">AMDGreeting field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDGREETING_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDGreeting must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDAFTERGREETINGSILENCE">AMDAfterGreetingSilence</label>\n                <input type="number" name="dialAMDAfterGreetingSilence" ng-model="vm.queueCampaign.dialAMDAfterGreetingSilence" min="0" value="800" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDAFTERGREETINGSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDAfterGreetingSilence\'].$error" ng-show="amdForm[\'dialAMDAfterGreetingSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_REQUIRED">AMDAfterGreetingSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDAFTERGREETINGSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDAfterGreetingSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDTOTALANALYSISTIME">AMDTotalAnalysisTime</label>\n                <input type="number" name="dialAMDTotalAnalysisTime" ng-model="vm.queueCampaign.dialAMDTotalAnalysisTime" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDTOTALANALYSISTIME"></span></div>\n                <div ng-messages="amdForm[\'dialAMDTotalAnalysisTime\'].$error" ng-show="amdForm[\'dialAMDTotalAnalysisTime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_REQUIRED">AMDTotalAnalysisTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDTOTALANALYSISTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDTotalAnalysisTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMINWORDLENGTH">AMDMinWordLength</label>\n                <input type="number" name="dialAMDMinWordLength" ng-model="vm.queueCampaign.dialAMDMinWordLength" min="0" value="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMINWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMinWordLength\'].$error" ng-show="amdForm[\'dialAMDMinWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_REQUIRED">AMDMinWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMINWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMinWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDBETWEENWORDSSILENCE">AMDBetweenWordsSilence</label>\n                <input type="number" name="dialAMDBetweenWordsSilence" ng-model="vm.queueCampaign.dialAMDBetweenWordsSilence" min="0" value="50" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDBETWEENWORDSSILENCE"></span></div>\n                <div ng-messages="amdForm[\'dialAMDBetweenWordsSilence\'].$error" ng-show="amdForm[\'dialAMDBetweenWordsSilence\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_REQUIRED">AMDBetweenWordsSilence field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDBETWEENWORDSSILENCE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDBetweenWordsSilence must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMNUMBEROFWORDS">AMDMaximumNumberOfWords</label>\n                <input type="number" name="dialAMDMaximumNumberOfWords" ng-model="vm.queueCampaign.dialAMDMaximumNumberOfWords" min="0" value="3" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMNUMBEROFWORDS"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumNumberOfWords\'].$error" ng-show="amdForm[\'dialAMDMaximumNumberOfWords\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_REQUIRED">AMDMaximumNumberOfWords field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMNUMBEROFWORDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumNumberOfWords must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDSILENCETHRESHOLD">AMDSilenceThreshold</label>\n                <input type="number" name="dialAMDSilenceThreshold" ng-model="vm.queueCampaign.dialAMDSilenceThreshold" min="0" max="32767" value="256" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDSILENCETHRESHOLD"></span></div>\n                <div ng-messages="amdForm[\'dialAMDSilenceThreshold\'].$error" ng-show="amdForm[\'dialAMDSilenceThreshold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_REQUIRED">AMDSilenceThreshold field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="MOTIONDIALER.ERRORS.AMDSILENCETHRESHOLD_MUST_BE_LESS_THAN_OR_EQUAL_TO">AMDSilenceThreshold must be a valid greater or equal than</span> <span>32767</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.queueCampaign.dialAMDActive" class="md-block">\n                <label translate="MOTIONDIALER.AMDMAXIMUMWORDLENGTH">AMDMaximumWordLength</label>\n                <input type="number" name="dialAMDMaximumWordLength" ng-model="vm.queueCampaign.dialAMDMaximumWordLength" min="0" value="5000" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="MOTIONDIALER.HELP.AMDMAXIMUMWORDLENGTH"></span></div>\n                <div ng-messages="amdForm[\'dialAMDMaximumWordLength\'].$error" ng-show="amdForm[\'dialAMDMaximumWordLength\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_REQUIRED">AMDMaximumWordLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="MOTIONDIALER.ERRORS.AMDMAXIMUMWORDLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AMDMaximumWordLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HOPPERS">HOPPERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperstatistics md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperStatisticsController as vm_hs" ng-init="vm_hs.init(vm.queueCampaign)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERWIDGET">Hoppers</span>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_hs.init(vm.queueCampaign)" aria-label="refresh Hopper" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{(vm_hs.total || 0) + (vm_hs.closed || 0)}}</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.TOTAL\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.fresh || 0}} ({{vm_hs.total ? ((((vm_hs.fresh || 0) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.FRESH\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.total ? (vm_hs.total - (vm_hs.fresh || 0)) : 0}} ({{vm_hs.total ? ((((vm_hs.total - (vm_hs.fresh || 0)) * 100)/((vm_hs.closed || 0) + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.OPEN\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="25">\n\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">{{vm_hs.closed ? (vm_hs.closed || 0) : 0}} ({{vm_hs.closed ? ((((vm_hs.closed) * 100)/(vm_hs.closed + (vm_hs.total || 0))) | number: 2) : 0}}%)</div>\n                      <div class="font-weight-500 secondary-text">{{ \'MOTIONDIALER.CLOSED\' | translate }}</div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n\n          </div>\n          <div class="queueCampaign-detail-form-container hoppers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHoppersController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERS">Hoppers</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHoppers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHoppers()" aria-label="refresh Hoppers" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHoppers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHoppers.length}} {{vm_dc.selectedQueueCampaignHoppers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHoppers" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedQueueCampaignHoppers($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHoppers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHoppers">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="priority">\n                        {{ \'MOTIONDIALER.PRIORITY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="recallme">\n                        {{ \'MOTIONDIALER.RECALLAGENT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopper" md-select-id="id" ng-repeat="hopper in vm_dc.queueCampaignHoppers.rows">\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.ContactId}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell privacy ng-cloak>\n                        {{hopper.phone}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countcongestionretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countbusyretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnoanswerretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countnosuchnumberretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countdropretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countabandonedretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countmachineretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{hopper.countagentrejectretry}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{ hopper.scheduledat | formatdate }}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell>\n                        {{ vm_dc.arraypriority[hopper.priority].option }} </td>\n\n                      <td ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" md-cell class="recallme ">\n                        <md-icon md-colors="{color: {{hopper.recallme ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{hopper.recallme? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditQueueCampaignHopper($event, hopper)" translate="MOTIONDIALER.EDIT_HOPPER">\n                                Edit Hopper\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(hopper, $event)" translate="MOTIONDIALER.DELETE_HOPPER">\n                                Delete Hopper\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHoppers.rows.length">\n                      <td md-cell colspan="17">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPER_AVAILABLE">No hopper available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHoppers.count}}" md-on-paginate="vm_dc.getQueueCampaignHoppers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.HISTORY">HISTORY</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperhistories md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperHistoriesController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERHISTORIES">HopperHistories</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperHistories()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHopperHistories()" aria-label="refresh HopperHistories" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERHISTORIES">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperHistories.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperHistories.length}} {{vm_dc.selectedQueueCampaignHopperHistories.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperHistories" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperHistories" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperHistories">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="scheduledat">\n                        {{ \'MOTIONDIALER.SCHEDULEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperHistory" md-select-id="id" ng-repeat="hopperHistory in vm_dc.queueCampaignHopperHistories.rows">\n                      <td md-cell>\n                        {{hopperHistory.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperHistory.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperHistory.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.scheduledat | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperHistory.endtime | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperHistories.rows.length">\n                      <td md-cell colspan="11">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERHISTORY_AVAILABLE">No hopperhistory available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperHistories.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperHistories" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.FINAL">FINAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperfinals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperFinalsController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERFINALS">HopperFinals</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperFinals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getQueueCampaignHopperFinals()" aria-label="refresh HopperFinals" translate translate-attr-label="MOTIONDIALER.REFRESH_HOPPERFINALS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                  <td md-cell class="actions">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="vm_dc.countContactsQueueCampaignHopperFinal(vm_dc.query.id); $mdOpenMenu($event);">\n                        <md-icon md-font-icon="icon-backup-restore"></md-icon>\n                        <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                      </md-button>\n                      <md-menu-content width="3">\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(3)">\n                            <span translate="MOTIONDIALER.NOANSWER ">NoAnswer</span>\n                            <span class="badge">({{vm_dc.contacts.noAnswerContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(5)">\n                            <span translate="MOTIONDIALER.BUSY ">Busy</span>\n                            <span class="badge">({{vm_dc.contacts.busyContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(8)">\n                            <span translate="MOTIONDIALER.CONGESTION ">Congestion</span>\n                            <span class="badge">({{vm_dc.contacts.congestionContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(10)">\n                            <span translate="MOTIONDIALER.DROPPED ">Drop</span>\n                            <span class="badge">({{vm_dc.contacts.dropContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(11)">\n                            <span translate="MOTIONDIALER.ABANDONED ">Abandoned</span>\n                            <span class="badge">({{vm_dc.contacts.abandonedContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(22)">\n                            <span translate="MOTIONDIALER.RECALLFAILEDTIMEOUT">Recall</span>\n                            <span class="badge">({{vm_dc.contacts.reCallContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(0)">\n                            <span translate="MOTIONDIALER.NO_SUCH_NUMBER">NoSuchNumber</span>\n                            <span class="badge">({{vm_dc.contacts.noSuchContacts}})</span>\n                          </md-button>\n                        </md-menu-item>\n                        <md-menu-item>\n                          <md-button ng-click="vm_dc.moveContactsQueueCampaignHopperFinal(19)">\n                            <span translate="MOTIONDIALER.ANSWERING_MACHINE">AnsweringMachine</span>\n                            <span class="badge">({{vm_dc.contacts.answeringMachine}})</span>\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperFinals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperFinals.length}} {{vm_dc.selectedQueueCampaignHopperFinals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperFinals" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.moveSelectedQueueCampaignHopperFinals($event)" aria-label="move selected" translate translate-attr-label="MOTIONDIALER.MOVE_SELECTED">\n                    <md-icon md-font-icon="icon-restore"></md-icon>\n                    <md-tooltip><span translate="MOTIONDIALER.RESTORECONTACTS"></span></md-tooltip>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperFinals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperFinals">\n                    <tr md-row>\n                      <th md-column md-order-by="uniqueid">\n                        {{ \'MOTIONDIALER.UNIQUEID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridnum">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="calleridname">\n                        {{ \'MOTIONDIALER.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="statedesc">\n                        {{ \'MOTIONDIALER.STATUS\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countcongestionretry">\n                        {{ \'MOTIONDIALER.CONGESTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countbusyretry">\n                        {{ \'MOTIONDIALER.BUSY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnoanswerretry">\n                        {{ \'MOTIONDIALER.NOANSWER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countnosuchnumberretry">\n                        {{ \'MOTIONDIALER.NOSUCHNUMBER\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countdropretry">\n                        {{ \'MOTIONDIALER.DROP\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countabandonedretry">\n                        {{ \'MOTIONDIALER.ABANDONED\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countmachineretry">\n                        {{ \'MOTIONDIALER.MACHINE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="countagentrejectretry">\n                        {{ \'MOTIONDIALER.AGENTREJECT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="starttime">\n                        {{ \'MOTIONDIALER.STARTTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="endtime">\n                        {{ \'MOTIONDIALER.ENDTIME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="disposition">\n                        {{ \'MOTIONDIALER.DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="secondDisposition">\n                        {{ \'MOTIONDIALER.SECOND_LEVEL_DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="thirdDisposition">\n                        {{ \'MOTIONDIALER.THIRD_LEVEL_DISPOSITION\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperFinal" md-select-id="id" ng-repeat="hopperFinal in vm_dc.queueCampaignHopperFinals.rows">\n                      <td md-cell>\n                        {{hopperFinal.uniqueid}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridnum}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperFinal.calleridname}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.statedesc}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countcongestionretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countbusyretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnoanswerretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countnosuchnumberretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countdropretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countabandonedretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countmachineretry}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.countagentrejectretry}}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.starttime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{ hopperFinal.endtime | formatdate }}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.disposition}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.secondDisposition}}\n                      </td>\n                      <td md-cell>\n                        {{hopperFinal.thirdDisposition}}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.moveConfirm(hopperFinal, $event)" translate="MOTIONDIALER.MOVE_HOPPERFINAL">\n                                Move HopperFinal\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperFinals.rows.length">\n                      <td md-cell colspan="30">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERFINAL_AVAILABLE">No hopperfinal available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperFinals.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperFinals" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.BLACKLIST">BLACKLIST</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="queueCampaign-detail-form-container hopperblacks md-background-bg md-whiteframe-1dp">\n            <div ng-controller="QueueCampaignHopperBlacksController as vm_dc" ng-init="vm_dc.init(vm.queueCampaign, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedQueueCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="MOTIONDIALER.HOPPERBLACKS">HopperBlacks</span>\n                  <ms-search-bar on-search="vm_dc.getQueueCampaignHopperBlacks()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedQueueCampaignHopperBlacks.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedQueueCampaignHopperBlacks.length}} {{vm_dc.selectedQueueCampaignHopperBlacks.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedQueueCampaignHopperBlacks" csv-label="true" filename="queueCampaigns.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedQueueCampaignHopperBlacks" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getQueueCampaignHopperBlacks">\n                    <tr md-row>\n                      <th md-column md-order-by="ContactId">\n                        {{ \'MOTIONDIALER.CONTACTID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="phone">\n                        {{ \'MOTIONDIALER.PHONE\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="hopperBlack" md-select-id="id" ng-repeat="hopperBlack in vm_dc.queueCampaignHopperBlacks.rows">\n                      <td md-cell>\n                        {{hopperBlack.ContactId}}\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        {{hopperBlack.phone}}\n                      </td>\n                      <td md-cell class="actions">\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.queueCampaignHopperBlacks.rows.length">\n                      <td md-cell colspan="4">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="MOTIONDIALER.NO_HOPPERBLACK_AVAILABLE">No hopperblack available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.queueCampaignHopperBlacks.count}}" md-on-paginate="vm_dc.getQueueCampaignHopperBlacks" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/motiondialer/views/queueCampaigns/queueCampaigns.html",'<div id="queueCampaigns" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-fire" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="MOTIONDIALER.QUEUECAMPAIGNS">QueueCampaigns</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="MOTIONDIALER.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedQueueCampaigns.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedQueueCampaigns =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="MOTIONDIALER.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-queueCampaigns-count">\n          <span>{{vm.selectedQueueCampaigns.length}}</span>\n          <span translate="MOTIONDIALER.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="MOTIONDIALER.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllQueueCampaigns()" translate="MOTIONDIALER.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectQueueCampaigns()" translate="MOTIONDIALER.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedQueueCampaigns" csv-label="true" filename="queueCampaigns.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedQueueCampaigns($event)" aria-label="delete selected" translate translate-attr-label="MOTIONDIALER.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- QUEUECAMPAIGN TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedQueueCampaigns" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueueCampaigns">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'MOTIONDIALER.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'MOTIONDIALER.NAME\' | translate }}</th>\n                <th md-column md-order-by="dialActive">{{ \'MOTIONDIALER.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="TrunkId">{{ \'MOTIONDIALER.TRUNK\' | translate }}</th>\n                <th md-column md-order-by="dialMethod">{{ \'MOTIONDIALER.METHOD\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'MOTIONDIALER.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.queueCampaigns.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="queueCampaign" md-select-id="id" ng-repeat="queueCampaign in vm.queueCampaigns.rows">\n                <td md-cell ng-if="queueCampaign.userpic"><img class="avatar" alt="{{queueCampaign.name}}" ng-src="api/users/{{queueCampaign.id}}/avatar" /></td>\n                <td md-cell ng-if="!queueCampaign.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{queueCampaign.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="id ">{{queueCampaign.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="name ">{{queueCampaign.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="dialActive ">\n                  <md-icon md-colors="{color: {{queueCampaign.dialActive ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{queueCampaign.dialActive ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="TrunkId ">{{ (vm.trunks | filter : {\'id\':queueCampaign.TrunkId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="dialMethod ">{{ vm.arraydialMethod[queueCampaign.dialMethod].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(queueCampaign, ev) : vm.createOrEditQueueCampaign($event, queueCampaign)" md-cell class="strategy ">{{ vm.arraystrategy[queueCampaign.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(queueCampaign, $event    )" translate="MOTIONDIALER.EDIT_QUEUECAMPAIGN">\n                          Edit QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(queueCampaign, $event    )" translate="MOTIONDIALER.CLONE_QUEUECAMPAIGN">\n                          clone QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.listadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.LISTADD_QUEUECAMPAIGN">\n                          listadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.blacklistadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.BLACKLISTADD_QUEUECAMPAIGN">\n                          blacklistadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.TEAMADD_QUEUECAMPAIGN">\n                          teamadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(queueCampaign, $event    )" translate="MOTIONDIALER.AGENTADD_QUEUECAMPAIGN">\n                          agentadd QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(queueCampaign, $event    )" translate="MOTIONDIALER.DELETE_QUEUECAMPAIGN">\n                          Delete QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(queueCampaign, $event    )" translate="MOTIONDIALER.GOTOREALTIME_QUEUECAMPAIGN">\n                          goToRealtime QueueCampaign\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queueCampaigns.count}}" md-on-paginate="vm.getQueueCampaigns" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / QUEUECAMPAIGN TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD QUEUECAMPAIGN BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-queueCampaign-button" ng-click="vm.createOrEditQueueCampaign($event)" aria-label="add queueCampaign" translate translate-attr-aria-label="MOTIONDIALER.ADD_QUEUECAMPAIGN">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD QUEUECAMPAIGN BUTTON --\x3e\n</div>'),e.put("app/main/apps/motiondialer/views/realtime/abandonedcalls/view.html",'<md-toolbar class="md-table-toolbar md-default table-header">\n  <div class="md-toolbar-tools" layout="row" layout-align="center center">\n    <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n    <ms-search-bar on-search="vm.getAbandonedCalls()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300">\n    </ms-search-bar>\n    <div flex></div>\n\n    <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getAbandonedCalls()"></ms-quick-filter>\n\n    <md-button class="md-icon-button" ng-click="vm.refresh && vm.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n      <md-icon md-font-icon="icon-reload"></md-icon>\n      <md-tooltip ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | translate}}\n      </md-tooltip>\n    </md-button>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAbandonedCalls">\n      <tr md-row>\n        <th md-column md-order-by="id">ID</th>\n        <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n        <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n        <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n        <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n        <th md-column md-order-by="queuecallerexitAt">{{\'DASHBOARDS.QUEUECALLEREXITAT\' | translate}}</th>\n        <th md-column md-order-by="queuecallerexitreason">{{\'DASHBOARDS.QUEUECALLEREXITREASON\' | translate}}</th>\n        <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.abandonedCalls.rows.length">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.abandonedCalls.rows">\n        <td md-cell class="id">{{call.id}}</td>\n        <td md-cell class="firstName" privacy ng-cloak>{{call.calleridname}}</td>\n        <td md-cell class="list" privacy ng-cloak>{{call.calleridnum}}</td>\n        <td md-cell class="list">{{vm.queuesMap[call.queue]}}</td>\n        <td md-cell class="list">\n          {{call.queuecallerabandonAt ? (call.queuecallerabandonAt | formatdate) : (call.queuecallerexitAt | formatdate) }}\n        </td>\n        <td md-cell class="list">{{call.queuecallerexitAt ? (call.queuecallerexitAt | formatdate) : undefined }}\n        </td>\n        <td md-cell class="list">{{call.queuecallerexitreason}}</td>\n        <td md-cell class="list">{{call.lastAssignedTo}}</td>\n        <td md-cell class="list">{{ call.disposition }}</td>\n        <td md-cell class="list">{{ call.secondDisposition }}</td>\n        <td md-cell class="list">{{ call.thirdDisposition }}</td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-menu>\n                  <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.ASSIGNTO">\n                    Assigned\n                    to</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="call.lastAssignedTo">\n                      <md-button ng-click="vm.assignTo(call)"><em translate="DASHBOARDS.NONE">Not Assigned</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.agents.rows.length" ng-repeat="agent in vm.agents.rows">\n                      <md-button ng-click="vm.assignTo(call,agent)">{{agent.name}}</md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.dispose(call)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">\n                  Dispose\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.abandonedCalls.count}}" md-on-paginate="vm.getAbandonedCalls" md-page-select></md-table-pagination>'),e.put("app/main/apps/motiondialer/views/realtime/ivr_campaigns/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.IVR_CAMPAIGNS">Ivr Campaigns</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getCampaigns()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCampaigns">\n      <tr md-row>\n        <th md-column md-order-by="name" class="bl">{{\'MOTIONDIALER.NAME\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL_MANAGED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.LIMITED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.ORIGINATED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.MESSAGE\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.CALLYSQUAREPROJECT\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TRUNK\' | translate }}</th>\n        <th md-column>{{\'MOTIONDIALER.ACTIVE\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.campaigns.rows.length > 0">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="campaign in vm.campaigns.rows">\n        <td md-cell>\n          <span>{{campaign.name}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.ivrTotalCallsDays || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.ivrAnswerCallsDay || 0}} ({{(campaign.ivrTotalCallsDays) ? (campaign.ivrAnswerCallsDay || 0) * 100/(campaign.ivrTotalCallsDays ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.limitCalls || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.originated || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.message ? (\'MOTIONDIALER.\'+campaign.message | translate) : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{campaign.dialQueueProject || \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{campaign.Trunk ? campaign.Trunk.name : \'--\'}}</span>\n        </td>\n        <td md-cell>\n          <md-icon md-colors="{color: {{campaign.active ? \'\\\'green\\\'\' : \'\\\'red\\\'\'}}}" md-font-icon="{{campaign.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="MOTIONDIALER.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="3">\n              <md-menu-item>\n                <md-button ng-click="vm.createOrEditIvrCampaign($event, campaign)" translate="MOTIONDIALER.EDIT_CAMPAIGN">\n                  Edit Campaign\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.campaigns.count}}" md-on-paginate="vm.getCampaigns" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/queue_params/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_PARAMETERS">Params</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{\'MOTIONDIALER.NAME\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.TOTAL_OFFERED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.MANAGED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.ABANDONED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.DROPPED\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.AVG_HOLD_TIME\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.AVG_DURATION\' | translate}}</th>\n        <th md-column>{{\'MOTIONDIALER.AVG_BILLABLE\' | translate}}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.rows.length > 0">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="queue in vm.queues.rows">\n        <td md-cell>\n          <span>{{queue.name}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{(queue.answered + queue.outboundNoAnswerCallsDay + queue.outboundBusyCallsDay + queue.outboundCongestionCallsDay + queue.outboundNoSuchCallsDay + queue.outboundUnknownCallsDay + queue.outboundDropCallsDayTimeout + queue.outboundDropCallsDayCallersExit + queue.outboundBlacklistCallsDay + queue.outboundOriginateFailureCallsDay + queue.outboundAnswerAgiCallsDay + queue.outboundReCallsDay + queue.outboundRejectCallsDay )|| 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-20 grey-fg">{{queue.total || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered || 0}} ({{(queue.answered) ? (100 - (((queue.outboundDropCallsDayTimeout || 0) * 100/(queue.total)) | number:1 ) - (((queue.outboundDropCallsDayCallersExit || 0) * 100/(queue.total )) | number:1 )  ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.outboundDropCallsDayCallersExit || 0}} ({{(queue.outboundDropCallsDayCallersExit) ? (queue.outboundDropCallsDayCallersExit || 0) * 100/(queue.total ) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.outboundDropCallsDayTimeout || 0}} ({{(queue.outboundDropCallsDayTimeout) ? (queue.outboundDropCallsDayTimeout || 0) * 100/(queue.total) : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? (queue.sumHoldTime / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? (queue.sumDuration / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered ? ((queue.sumBillable || 0) / queue.answered) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/motiondialer/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUE_CALLS">Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.ABANDONEDCALLS">Abandoned Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.QUEUE_PARAMS">Queue Parameters</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="MOTIONDIALER.IVR_CAMPAIGNS">Ivr Campaigns</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/create/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.openchannelAccount.name" ng-required="true" autofocus ng-disabled="!vm.newOpenchannelAccount">\n\n        <div ng-messages="openchannelAccountForm[\'name\'].$error" ng-show="openchannelAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.openchannelAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="openchannelAccountForm[\'key\'].$error" ng-show="openchannelAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.REPLYURI">replyUri</label>\n        <input type="url" name="replyUri" ng-model="vm.openchannelAccount.replyUri">\n\n        <div class="hint"><span translate="OPENCHANNEL.HELP.REPLYURI"></span></div>\n        <div ng-messages="openchannelAccountForm[\'replyUri\'].$error" ng-show="openchannelAccountForm[\'replyUri\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.REPLYURI_REQUIRED">replyUri field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="OPENCHANNEL.ERRORS.REPLYURI_MUST_VALID_URL">replyUri must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.openchannelAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.LIST"></span></div>\n        <div ng-messages="openchannelAccountForm[\'ListId\'].$error" ng-show="openchannelAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelAccount.description">\n\n        <div ng-messages="openchannelAccountForm[\'description\'].$error" ng-show="openchannelAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelAccount" ng-click="vm.saveOpenchannelAccount()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountForm.$invalid || openchannelAccountForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelAccount" ng-click="vm.addNewOpenchannelAccount()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELACCOUNT" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELACCOUNT">\n          ADD OPENCHANNELACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelAccount" ng-click="vm.deleteOpenchannelAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/agentadd/agentadd.html",'<md-dialog class="openchannelAccount-dialog" aria-label="openchannelAccount" ng-init="vm.onInit()">\n  <form name="openchannelAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">Add Agent to openchannelAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/agent/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'agent\'].$error" ng-show="openchannelAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'timeout\'].$error" ng-show="openchannelAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'accesskeyid\'].$error" ng-show="openchannelAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'secretaccesskey\'].$error" ng-show="openchannelAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'lexregion\'].$error" ng-show="openchannelAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'botname\'].$error" ng-show="openchannelAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'times\'].$error" ng-show="openchannelAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="openchannelAccountFormApp[\'text\'].$error" ng-show="openchannelAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/close/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'disposition\'].$error" ng-show="openchannelAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'key\'].$error" ng-show="openchannelAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'language\'].$error" ng-show="openchannelAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'projectId\'].$error" ng-show="openchannelAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'clientEmail\'].$error" ng-show="openchannelAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="openchannelAccountFormApp[\'privateKey\'].$error" ng-show="openchannelAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'language\'].$error" ng-show="openchannelAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="OPENCHANNEL.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="openchannelAccountFormApp[\'welcomemessage\'].$error" ng-show="openchannelAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="OPENCHANNEL.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'condition\'].$error" ng-show="openchannelAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'truepriority\'].$error" ng-show="openchannelAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'falsepriority\'].$error" ng-show="openchannelAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'priority\'].$error" ng-show="openchannelAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/noop/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'value\'].$error" ng-show="openchannelAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/queue/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'queue\'].$error" ng-show="openchannelAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'timeout\'].$error" ng-show="openchannelAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/system/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="openchannelAccountFormApp[\'command\'].$error" ng-show="openchannelAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'variable\'].$error" ng-show="openchannelAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/apps/tag/dialog.html",'<md-dialog class="openchannelAccount-dialog" aria-label="New OpenchannelAccount">\n  <form name="openchannelAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="openchannelAccountFormApp[\'tag\'].$error" ng-show="openchannelAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveOpenchannelAccountApp()" class="send-button md-accent md-raised" ng-disabled="openchannelAccountFormApp.$invalid || openchannelAccountFormApp.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/openchannelCannedAnswers/dialog.html",'<md-dialog class="openchannelCannedAnswer-dialog" aria-label="New OpenchannelCannedAnswer">\n  <form name="openchannelCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.openchannelCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="openchannelCannedAnswerForm[\'key\'].$error" ng-show="openchannelCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.openchannelCannedAnswer.value" required></textarea>\n\n        <div ng-messages="openchannelCannedAnswerForm[\'value\'].$error" ng-show="openchannelCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelCannedAnswer.description">\n\n        <div ng-messages="openchannelCannedAnswerForm[\'description\'].$error" ng-show="openchannelCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelCannedAnswer" ng-click="vm.saveOpenchannelCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="openchannelCannedAnswerForm.$invalid || openchannelCannedAnswerForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelCannedAnswer" ng-click="vm.addNewOpenchannelCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="openchannelCannedAnswerForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER">\n          ADD OPENCHANNELCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelCannedAnswer" ng-click="vm.deleteOpenchannelCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/edit/view.html",'<div id="openchannel-openchannelAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-openchannelAccounts-button md-icon-button" aria-label="Go to openchannelAccounts" ng-click="vm.gotoOpenchannelAccounts()" translate translate-attr-aria-label="OPENCHANNEL.GO_TO_OPENCHANNELACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="openchannelAccount-image" hide-xs>\n          <img ng-src="assets/images/business/openchannelAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.openchannelAccount.id}}\n            <span ng-if="vm.openchannelAccount.name">{{vm.openchannelAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="OPENCHANNEL.CREATED_AT"></span> <span>{{vm.openchannelAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.openchannelAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOpenchannelAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (openchannelDispositionsForm.$invalid) || (openchannelCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.openchannelAccount.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.openchannelAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="OPENCHANNEL.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.REPLYURI">replyUri</label>\n                <input type="url" name="replyUri" ng-model="vm.openchannelAccount.replyUri" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.REPLYURI"></span></div>\n                <div ng-messages="generalForm[\'replyUri\'].$error" ng-show="generalForm[\'replyUri\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.REPLYURI_REQUIRED">replyUri field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="OPENCHANNEL.ERRORS.REPLYURI_MUST_VALID_URL">replyUri must be a valid url http://www.xcally.com</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.openchannelAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.openchannelAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.openchannelAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.MAPKEY">MapKey</label>\n                <md-select name="mapKey" ng-model="vm.openchannelAccount.mapKey" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">None</md-option>\n                  <md-optgroup label="standard">\n                    <md-option ng-value="mapKey.columnName" ng-repeat="mapKey in vm.fields" ng-if="!mapKey.columnName.toString().startsWith(\'cf_\')" ng-disabled="mapKey.canSelect === false">{{ mapKey.displayName }}</md-option>\n                  </md-optgroup>\n                  <md-optgroup label="custom">\n                    <md-option ng-value="mapKey.columnName" ng-repeat="mapKey in vm.fields" ng-if="mapKey.columnName.toString().startsWith(\'cf_\')" ng-disabled="mapKey.canSelect === false">{{ mapKey.displayName }}</md-option>\n                  </md-optgroup>\n                </md-select>\n                <div ng-messages="generalForm[\'mapKey\'].$error" ng-show="generalForm[\'mapKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.MAPKEY_REQUIRED">MapKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.openchannelAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.RECEIVEURI">receiveUri</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUri" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUri" name="receiveUri" ng-value="vm.location + \'/api/openchannel/accounts/\' + vm.openchannelAccount.id + \'/notify\'" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.RECEIVEURI"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="OPENCHANNEL.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.openchannelAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.queueTransfer == true" class="md-block">\n                <label translate="OPENCHANNEL.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.openchannelAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.agentTransfer == true" class="md-block">\n                <label translate="OPENCHANNEL.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.openchannelAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.openchannelAccount.token" autofocus disabled>\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.TOKEN"></span></div>\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="openchannelAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.openchannelAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="OPENCHANNEL.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.openchannelAccount.mandatoryDisposition" class="md-block">\n                <label translate="OPENCHANNEL.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.openchannelAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="OPENCHANNEL.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="OpenchannelAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="openchannelAccount-detail-form-container openchanneldispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="OPENCHANNEL.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add openchannel dispositions" translate translate-attr-label="OPENCHANNEL.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="openchannelAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container openchannelcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountOpenchannelCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="OPENCHANNEL.OPENCHANNELCANNEDANSWERS">OpenchannelCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event)" aria-label="add openchannelCannedAnswer" translate translate-attr-label="OPENCHANNEL.ADD_OPENCHANNELCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length}} {{vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountOpenchannelCannedAnswers" csv-label="true" filename="openchannelAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedOpenchannelAccountOpenchannelCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedOpenchannelAccountOpenchannelCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'OPENCHANNEL.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'OPENCHANNEL.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'OPENCHANNEL.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'OPENCHANNEL.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'OPENCHANNEL.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="openchannelCannedAnswer" md-select-id="id" ng-repeat="openchannelCannedAnswer in vm_dc.openchannelAccountOpenchannelCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{openchannelCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" md-cell>\n                        {{ openchannelCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditOpenchannelAccountOpenchannelCannedAnswer($event, openchannelCannedAnswer)" translate="OPENCHANNEL.EDIT_OPENCHANNELCANNEDANSWER">\n                                Edit OpenchannelCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(openchannelCannedAnswer, $event)" translate="OPENCHANNEL.DELETE_OPENCHANNELCANNEDANSWER">\n                                Delete OpenchannelCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.openchannelAccountOpenchannelCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="OPENCHANNEL.NO_OPENCHANNELCANNEDANSWER_AVAILABLE">No openchannelcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.openchannelAccountOpenchannelCannedAnswers.count}}" md-on-paginate="vm_dc.getOpenchannelAccountOpenchannelCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.openchannelAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="OPENCHANNEL.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedOpenchannelAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedOpenchannelAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedOpenchannelAccountApps.length}} {{vm_ac.selectedOpenchannelAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedOpenchannelAccountApps($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedOpenchannelAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.openchannelAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editOpenchannelAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editOpenchannelAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.openchannelAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="OpenchannelAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.openchannelAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedOpenchannelAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="OPENCHANNEL.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getOpenchannelAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getOpenchannelAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getOpenchannelAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="OPENCHANNEL.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedOpenchannelAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedOpenchannelAccountInteractions.length}} {{vm_dc.selectedOpenchannelAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedOpenchannelAccountInteractions" csv-label="true" filename="openchannelAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedOpenchannelAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedOpenchannelAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getOpenchannelAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'OPENCHANNEL.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'OPENCHANNEL.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'OPENCHANNEL.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'OPENCHANNEL.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'OPENCHANNEL.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'OPENCHANNEL.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'OPENCHANNEL.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.openchannelAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'OPENCHANNEL.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'OPENCHANNEL.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spyopenchannelInteraction($event, interaction)" translate="OPENCHANNEL.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || (vm_dc.userProfile.downloadOmnichannelInteractions && vm_dc.userProfile.downloadAttachments)">\n                              <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event, true)" translate="OPENCHANNEL.DOWNLOAD_WITH_ATTACHMENTS">\n                                Download with attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.openchannelInteractionDownload(interaction, $event)" translate="OPENCHANNEL.DOWNLOAD_WITHOUT_ATTACHMENTS">\n                                Download without attachments\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="OPENCHANNEL.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.openchannelAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="OPENCHANNEL.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.openchannelAccountInteractions.count}}" md-on-paginate="vm_dc.getOpenchannelAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/openchannel/views/openchannelAccounts/openchannelAccounts.html",'<div id="openchannelAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-google-earth" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="OPENCHANNEL.OPENCHANNELACCOUNTS">OpenchannelAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="OPENCHANNEL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedOpenchannelAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedOpenchannelAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="OPENCHANNEL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-openchannelAccounts-count">\n          <span>{{vm.selectedOpenchannelAccounts.length}}</span>\n          <span translate="OPENCHANNEL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="OPENCHANNEL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllOpenchannelAccounts()" translate="OPENCHANNEL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectOpenchannelAccounts()" translate="OPENCHANNEL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOpenchannelAccounts" csv-label="true" filename="openchannelAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOpenchannelAccounts($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- OPENCHANNELACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOpenchannelAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'OPENCHANNEL.KEY\' | translate }}</th>\n                <th md-column md-order-by="replyUri">{{ \'OPENCHANNEL.REPLYURI\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'OPENCHANNEL.LIST\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'OPENCHANNEL.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.openchannelAccounts.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="openchannelAccount" md-select-id="id" ng-repeat="openchannelAccount in vm.openchannelAccounts.rows">\n                <td md-cell ng-if="openchannelAccount.userpic"><img class="avatar" alt="{{openchannelAccount.name}}" ng-src="api/users/{{openchannelAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!openchannelAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{openchannelAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="id ">{{openchannelAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="name ">{{openchannelAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="key ">{{openchannelAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="replyUri ">{{openchannelAccount.replyUri}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':openchannelAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelAccount, ev) : vm.createOrEditOpenchannelAccount($event, openchannelAccount)" md-cell class="description ">{{openchannelAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(openchannelAccount, $event    )" translate="OPENCHANNEL.EDIT_OPENCHANNELACCOUNT">\n                          Edit OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(openchannelAccount, $event    )" translate="OPENCHANNEL.INTERACTIONS_OPENCHANNELACCOUNT">\n                          Interactions OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(openchannelAccount, $event    )" translate="OPENCHANNEL.AGENTADD_OPENCHANNELACCOUNT">\n                          AgentAdd OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(openchannelAccount, $event    )" translate="OPENCHANNEL.DELETE_OPENCHANNELACCOUNT">\n                          Delete OpenchannelAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelAccounts.count}}" md-on-paginate="vm.getOpenchannelAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / OPENCHANNELACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD OPENCHANNELACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-openchannelAccount-button" ng-click="vm.createOrEditOpenchannelAccount($event)" aria-label="add openchannelAccount" translate translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD OPENCHANNELACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/openchannelQueues/create/dialog.html",'<md-dialog class="openchannelQueue-dialog" aria-label="New OpenchannelQueue">\n  <form name="openchannelQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.openchannelQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newOpenchannelQueue">\n\n        <div class="hint"><span translate="OPENCHANNEL.HELP.NAME"></span></div>\n        <div ng-messages="openchannelQueueForm[\'name\'].$error" ng-show="openchannelQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="OPENCHANNEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.openchannelQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="openchannelQueueForm[\'strategy\'].$error" ng-show="openchannelQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.openchannelQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="openchannelQueueForm[\'timeout\'].$error" ng-show="openchannelQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.openchannelQueue.description">\n\n        <div ng-messages="openchannelQueueForm[\'description\'].$error" ng-show="openchannelQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOpenchannelQueue" ng-click="vm.saveOpenchannelQueue()" class="send-button md-accent md-raised" ng-disabled="openchannelQueueForm.$invalid || openchannelQueueForm.$pristine" aria-label="SAVE" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOpenchannelQueue" ng-click="vm.addNewOpenchannelQueue()" class="send-button md-accent md-raised" ng-disabled="openchannelQueueForm.$invalid" aria-label="ADD" translate="OPENCHANNEL.ADD_OPENCHANNELQUEUE" translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELQUEUE">\n          ADD OPENCHANNELQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOpenchannelQueue" ng-click="vm.deleteOpenchannelQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="OPENCHANNEL.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="OPENCHANNEL.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/agentadd/agentadd.html",'<md-dialog class="openchannelQueue-dialog" aria-label="openchannelQueue" ng-init="vm.onInit()">\n  <form name="openchannelQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">Add Agent to openchannelQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/teamadd/teamadd.html",'<md-dialog class="openchannelQueue-dialog" aria-label="openchannelQueue" ng-init="vm.onInit()">\n  <form name="openchannelQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="OPENCHANNEL.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/openchannel/views/openchannelQueues/edit/view.html",'<div id="openchannel-openchannelQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-openchannelQueues-button md-icon-button" aria-label="Go to openchannelQueues" ng-click="vm.gotoOpenchannelQueues()" translate translate-attr-aria-label="OPENCHANNEL.GO_TO_OPENCHANNELQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="openchannelQueue-image" hide-xs>\n          <img ng-src="assets/images/business/openchannelQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.openchannelQueue.id}}\n            <span ng-if="vm.openchannelQueue.name">{{vm.openchannelQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="OPENCHANNEL.CREATED_AT"></span> <span>{{vm.openchannelQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.openchannelQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.openchannelQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOpenchannelQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="OPENCHANNEL.SAVE" translate-attr-aria-label="OPENCHANNEL.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="openchannelQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="OPENCHANNEL.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.openchannelQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="OPENCHANNEL.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="OPENCHANNEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.openchannelQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.openchannelQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="OPENCHANNEL.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="OPENCHANNEL.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.openchannelQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="OPENCHANNEL.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/openchannel/views/openchannelQueues/openchannelQueues.html",'<div id="openchannelQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-google-earth" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="OPENCHANNEL.OPENCHANNELQUEUES">OpenchannelQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="OPENCHANNEL.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedOpenchannelQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedOpenchannelQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="OPENCHANNEL.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-openchannelQueues-count">\n          <span>{{vm.selectedOpenchannelQueues.length}}</span>\n          <span translate="OPENCHANNEL.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="OPENCHANNEL.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllOpenchannelQueues()" translate="OPENCHANNEL.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectOpenchannelQueues()" translate="OPENCHANNEL.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOpenchannelQueues" csv-label="true" filename="openchannelQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOpenchannelQueues($event)" aria-label="delete selected" translate translate-attr-label="OPENCHANNEL.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- OPENCHANNELQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOpenchannelQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOpenchannelQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'OPENCHANNEL.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'OPENCHANNEL.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'OPENCHANNEL.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.openchannelQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="OPENCHANNEL.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="openchannelQueue" md-select-id="id" ng-repeat="openchannelQueue in vm.openchannelQueues.rows">\n                <td md-cell ng-if="openchannelQueue.userpic"><img class="avatar" alt="{{openchannelQueue.name}}" ng-src="api/users/{{openchannelQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!openchannelQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{openchannelQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="id ">{{openchannelQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="name ">{{openchannelQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(openchannelQueue, ev) : vm.createOrEditOpenchannelQueue($event, openchannelQueue)" md-cell class="strategy ">{{ vm.arraystrategy[openchannelQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="OPENCHANNEL.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(openchannelQueue, $event    )" translate="OPENCHANNEL.EDIT_OPENCHANNELQUEUE">\n                          Edit OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(openchannelQueue, $event    )" translate="OPENCHANNEL.TEAMADD_OPENCHANNELQUEUE">\n                          teamadd OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(openchannelQueue, $event    )" translate="OPENCHANNEL.AGENTADD_OPENCHANNELQUEUE">\n                          agentadd OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(openchannelQueue, $event    )" translate="OPENCHANNEL.DELETE_OPENCHANNELQUEUE">\n                          Delete OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(openchannelQueue, $event    )" translate="OPENCHANNEL.GOTOREALTIME_OPENCHANNELQUEUE">\n                          goToRealtime OpenchannelQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'OPENCHANNEL.PAGE\' | translate}}:\', rowsPerPage: \'{{\'OPENCHANNEL.ROWSPERPAGE\' | translate}}:\', of: \'{{\'OPENCHANNEL.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.openchannelQueues.count}}" md-on-paginate="vm.getOpenchannelQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / OPENCHANNELQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD OPENCHANNELQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-openchannelQueue-button" ng-click="vm.createOrEditOpenchannelQueue($event)" aria-label="add openchannelQueue" translate translate-attr-aria-label="OPENCHANNEL.ADD_OPENCHANNELQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD OPENCHANNELQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/openchannel/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="OPENCHANNEL.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/plugins/views/plugin/plugin.html",'<div ng-if="!vm.plugin">\n  <p>Plugin not available...</p>\n</div>\n<div id="plugin" ng-if="vm.plugin" ng-cloak layout-fill>\n  <iframe ng-src="{{vm.getTrustedURL()}}" frameborder=0 style="border:0px; width:100%; height:100%;"></iframe>\n</div>'),e.put("app/main/apps/realtime/views/agents/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools quick-filter-container">\n    <span class="md-subhead" translate="VOICE.AGENTS">Agents</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getAgents()" query="vm.query" debounce="300"></ms-search-bar>\n    <md-select ng-model="vm.query.globalStatusFilter" class="md-caption" ng-change="vm.query.pauseTypeFilter = null; vm.getAgents()" aria-label="Status filter">\n      <md-option ng-value="null">{{ \'VOICE.ALL\' | translate }}</md-option>\n      <md-option value="pause">{{ \'VOICE.PAUSE\' | translate }}</md-option>\n      <md-option value="*pause">{{ \'VOICE.PARTIALPAUSE\' | translate }}</md-option>\n      <md-option value="busy">{{ \'VOICE.BUSY\' | translate }}</md-option>\n      <md-option value="idle">{{ \'VOICE.IDLE\' | translate }}</md-option>\n    </md-select>\n    <md-select ng-if="vm.query.globalStatusFilter === \'pause\' || vm.query.globalStatusFilter === \'*pause\'" ng-model="vm.query.pauseTypeFilter" class="md-caption ml-16" ng-change="vm.getAgents()">\n      <md-option ng-value="null">{{ \'VOICE.ALL\' | translate }}</md-option>\n      <md-option value="DEFAULT PAUSE">{{ \'VOICE.DEFAULT_PAUSE\' | translate | uppercase }}</md-option>\n      <md-option value="ACW">ACW</md-option>\n      <md-option value="LOGININPAUSE">{{ \'STAFF.LOGININPAUSE\' | translate | uppercase }}</md-option>\n      <md-option value="Auto-Pause">{{ \'VOICE.AUTOPAUSE\' | translate | uppercase }}</md-option>\n      <md-option ng-value="pause.name" ng-repeat="pause in vm.pauses.rows">{{pause.name}}</md-option>\n    </md-select>\n    <md-select ng-model="vm.query.globalQueueFilter" multiple class="md-caption margin-left-10 mw-150" placeholder="{{ \'DASHBOARDS.SELECT_QUEUE\' | translate }}" md-on-open="vm.getQueuesByChannel()" md-on-close="vm.getAgents()">\n      <md-button ng-click="vm.selectAllQueues()" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.SELECT_ALL\' | translate}}</md-button>\n      <md-option ng-value="queue.id" ng-repeat="queue in vm.queues.rows">{{\n        queue.name }}</md-option>\n      <md-button ng-click="vm.clearQueuesSelection()" md-no-ink class="md-primary" layout-fill>\n        {{\'DASHBOARDS.CLEAR\' | translate}}</md-button>\n    </md-select>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.getAgents">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.onSort">\n      <tr md-row>\n        <th class="bv text-center" colspan="5">{{ \'VOICE.AGENT\' | translate }}</th>\n        <th class="bv bl text-center" colspan="2">{{ \'VOICE.VOICE\' | translate }}</th>\n        <th ng-if="vm.license.chat" class="bv bl text-center" colspan="2">{{ \'CHAT.CHAT\' | translate }}</th>\n        <th ng-if="vm.license.mail" class="bv bl text-center" colspan="2">{{ \'MAIL.MAIL\' | translate }}</th>\n        <th ng-if="vm.license.messaging" class="bv bl text-center" colspan="2">{{ \'SMS.SMS\' | translate }}</th>\n        <th ng-if="vm.license.openchannel" class="bv bl text-center" colspan="2">\n          {{ \'OPENCHANNEL.OPENCHANNEL\' | translate }}</th>\n        <th ng-if="vm.license.fax" class="bv bl text-center" colspan="2">{{ \'FAX.FAX\' | translate }}</th>\n        <th ng-if="vm.license.whatsapp" class="bv bl text-center" colspan="2">\n          {{ \'WHATSAPP.WHATSAPP\' | translate }}</th>\n        <th width="10px" class="bt bl" rowspan="2"></th>\n      </tr>\n      <tr md-row>\n        <th class="bl" colspan="2" md-column md-order-by="fullname">\n          {{ \'VOICE.NAME\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="globalStatus">\n          {{ \'VOICE.STATUS\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="lastLoginAt">\n          {{ \'VOICE.LOGIN_TIME\' | translate }}</th>\n        <th class="bl custom-column" md-column md-order-by="lastPauseAt">\n          {{ \'VOICE.PAUSE_TIME\' | translate }}</th>\n        <th class="bl custom-column">{{ \'VOICE.STATUS\' | translate }}</th>\n        <th class="bl custom-column">Info</th>\n        <th ng-if="vm.license.chat" class="bl text-center">{{ \'CHAT.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.chat" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'CHAT.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.mail" class="bl text-center">{{ \'MAIL.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.mail" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'MAIL.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.messaging" class="bl text-center">{{ \'SMS.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.messaging" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'SMS.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.openchannel" class="bl text-center">{{ \'OPENCHANNEL.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.openchannel" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'OPENCHANNEL.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.fax" class="bl text-center">{{ \'FAX.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.fax" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'FAX.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n        <th ng-if="vm.license.whatsapp" class="bl text-center">{{ \'WHATSAPP.STATUS\' | translate }}</th>\n        <th ng-if="vm.license.whatsapp" class="text-center">\n          <md-icon md-font-icon="icon-battery-standard">\n            <md-tooltip>{{ \'WHATSAPP.CAPACITY\' | translate }}</md-tooltip>\n          </md-icon>\n        </th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.agents.count > 0">\n        <td md-cell colspan="19">\n          <div layout="row" layout-align="center center">\n            <span>{{ \'VOICE.NO_AGENT_ONLINE\' | translate }}</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-select="agent" md-select-id="id" ng-repeat="agent in vm.agents.rows">\n        <td class="bt padding-5">\n          <div layout="row" layout-align="start center">\n            <img class="avatar" ng-src="{{agent.userpic && \'api/users/\'+ agent.id +\'/avatar\' || \'assets/images/avatars/profile.png\'}}">\n            <div layout="column">\n              <span>{{agent.fullname}}</span>\n              <span>{{agent.internal}}</span>\n            </div>\n          </div>\n        </td>\n        <td class="bt padding-5">\n          <div layout="row" layout-align="start center" ng-if="vm.license.screenrecording && (agent.phoneBarEnableScreenRecordingByAgent || agent.phoneBarEnableAutomaticScreenRecording)">\n            <div class="column">\n              <span>\n                <md-icon md-font-icon="icon-camcorder-box" ng-class="agent.screenrecording ? \'green-fg\' : \'grey-fg\'" aria-hidden="true">\n                  <md-tooltip>\n                    {{ agent.screenrecording ? \'VOICE.TOOLTIP_SCREENRECORDING_ON\' : \'VOICE.TOOLTIP_SCREENRECORDING_OFF\'\n                    | translate }}\n                  </md-tooltip>\n                </md-icon>\n              </span>\n            </div>\n          </div>\n        </td>\n        <td class="bt text-center">\n'+"          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','busy':'indigo-100-bg','*pause':'amber-50-bg','pause':'amber-200-bg'}[agent.globalStatus]\">\n            <span ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">{{ 'VOICE.PAUSE' | translate | uppercase }} (</span>{{\n              ['pause', '*pause'].includes(agent.globalStatus) ? \n                ((agent.globalStatusDisplayValue === 'DEFAULT PAUSE' ? ('VOICE.DEFAULT_PAUSE' | translate) : agent.globalStatusDisplayValue) | uppercase) : \n                ('VOICE.' + (agent.globalStatusDisplayValue | uppercase) | translate | uppercase) }}<span ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">)</span>\n          </span>\n        </td>\n        <td class=\"bt custom-column\">\n          <timer start-time=\"agent.lastLoginAt\" utc-offset=\"vm.utcOffset\"></timer>\n        </td>\n        <td class=\"bt custom-column\">\n          <timer ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\" start-time=\"agent.lastPauseAt\" utc-offset=\"vm.utcOffset\"></timer>\n        </td>\n        <td class=\"bt bl text-center\">\n          <span ng-if=\"!agent.onhold\" class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','talking':'indigo-100-bg','ringing':'orange-400-bg','pause':'amber-200-bg'}[agent.voiceStatus]\">\n            {{ 'VOICE.' + (agent.voiceStatus | uppercase) | translate | uppercase }}</span>\n          <span ng-if=\"agent.onhold\" class=\"text-boxed md-background-bg bl bt padding-5 orange-400-bg\">\n            {{ 'VOICE.ONHOLD' | translate | uppercase }}</span>\n        </td>\n        <td class=\"bt bl\">\n          <div layout=\"column\" ng-if=\"agent.voiceStatus === 'talking' || agent.voiceStatus === 'ringing'\">\n            <span ng-if=\"agent.queue\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">{{\n              agent.queue }}</span>\n            <span ng-if=\"agent.destconnectedlinenum\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\" privacy ng-cloak>{{\n              agent.destconnectedlinenum }}</span>\n            <span ng-if=\"agent.routealias\" class=\"padding-5\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">{{\n              agent.routealias }}</span>\n            <span class=\"padding-5\" ng-if=\"agent.queue || agent.destconnectedlinenum\">\n              <timer start-time=\"agent.voiceStatusTime\" utc-offset=\"vm.utcOffset\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.voiceStatus]\">\n              </timer>\n            </span>\n          </div>\n        </td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.chat\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.chatStatus]\">\n            {{ 'VOICE.' + (agent.chatStatus | uppercase) | translate | uppercase }}</span>\n        </td>\n        <td md-number class=\"bt text-center font-size-20\" ng-if=\"vm.license.chat\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.chatStatus]\">\n          {{ agent.chatCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.mail\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.mailStatus]\">\n            {{ 'VOICE.' + (agent.mailStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.mail\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.mailStatus]\">\n          {{ agent.mailCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.messaging\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.smsStatus]\">\n            {{ 'VOICE.' + (agent.smsStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.messaging\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.smsStatus]\">\n          {{ agent.smsCurrentCapacity }}</td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.openchannel\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.openchannelStatus]\">\n            {{ 'VOICE.' + (agent.openchannelStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.openchannel\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.openchannelStatus]\">\n          {{ agent.openchannelCurrentCapacity }}</td>\n        <td class=\"bt bl text-center\" ng-if=\"vm.license.fax\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.faxStatus]\">\n            {{ 'VOICE.' + (agent.faxStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.fax\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.faxStatus]\">\n          {{ agent.faxCurrentCapacity }}</td>\n        <td class=\"bl bt text-center\" ng-if=\"vm.license.whatsapp\">\n          <span class=\"text-boxed md-background-bg bl bt padding-5\" ng-class=\"{'idle':'lime-300-bg','maxcapacity':'red-A200-bg','working':'indigo-100-bg','pause':'amber-200-bg'}[agent.whatsappStatus]\">\n            {{ 'VOICE.' + (agent.whatsappStatus | uppercase) | translate | uppercase }}\n          </span>\n        </td>\n        <td class=\"bt padding-5 text-center font-size-20\" ng-if=\"vm.license.whatsapp\" ng-class=\"{'idle':'dark-lime-fg','maxcapacity':'dark-red-fg','working':'iron-fg','pause':'light-brown-fg'}[agent.whatsappStatus]\">\n          {{ agent.whatsappCurrentCapacity }}</td>\n        <td class=\"bl bt padding-5 text-center\" ng-if=\"vm.crudPermissions.canEdit\">\n          <md-menu>\n            <md-button class=\"md-icon-button\" aria-label=\"More\" translate translate-attr-aria-label=\"STAFF.MORE\" ng-click=\"$mdOpenMenu($event)\">\n              <md-icon md-font-icon=\"icon-dots-vertical\"></md-icon>\n            </md-button>\n            <md-menu-content width=\"4\">\n              <md-menu-item>\n                <md-button ng-click=\"vm.logout(agent, $event)\" translate=\"VOICE.LOGOUT\">\n                  Logout\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click=\"vm.addQueue(agent, $event)\" translate=\"{{ vm.channel.toUpperCase() + '.AGENTADD_QUEUE' }}\">\n                  Add Agent In Queue\n                </md-button>\n              </md-menu-item>\n              <md-menu-item ng-if=\"vm.license.screenrecording && agent.phoneBarEnableScreenRecordingByAgent\">\n                <md-menu>\n                  <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"VOICE.SCREENRECORDING\">Manage Screen Recording\n                  </md-button>\n                  <md-menu-content>\n                    <md-menu-item>\n                      <md-button ng-click=\"vm.manageScreenRecording(agent, !agent.screenrecording)\" translate=\"{{ agent.screenrecording ? 'VOICE.STOP_SCREENRECORDING' : 'VOICE.START_SCREENRECORDING' }}\" aria-label=\"Screen Recording\">\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu>\n                  <md-button ng-click=\"$mdMenu.open()\" class=\"text-capitalize\" translate=\"VOICE.PAUSE\">Pause</md-button>\n                  <md-menu-content>\n                    <md-menu-item>\n                      <md-button ng-disabled=\"agent.voicePause && 'DEFAULT PAUSE' === agent.pauseType\" ng-click=\"vm.pause(agent)\">\n                        <em translate=\"VOICE.DEFAULT_PAUSE\">Default Pause</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if=\"vm.pauses.rows.length\" ng-repeat=\"pause in vm.pauses.rows\">\n                      <md-button ng-disabled=\"agent.voicePause && pause.name === agent.pauseType\" ng-click=\"vm.pause(agent, pause.name)\">{{pause.name}}\n                      </md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item ng-if=\"['pause', '*pause'].includes(agent.globalStatus)\">\n                <md-button ng-click=\"vm.unpause(agent)\" translate=\"VOICE.UNPAUSE\">\n                  Unpause\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label=\"{page: '{{'VOICE.PAGE' | translate}}:', rowsPerPage: '{{'VOICE.ROWSPERPAGE' | translate}}:', of: '{{'VOICE.OF' | translate}}'}\" md-limit=\"vm.query.limit\" md-limit-options=\"[10, 15, 20, 50, 100, 250]\" md-page=\"vm.query.page\" md-total=\"{{vm.agents.count}}\" md-on-paginate=\"vm.onPaginate\" md-page-select></md-table-pagination>"),e.put("app/main/apps/realtime/views/queue-calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.QUEUE_CALLS">Queue Calls</span>\n  </div>\n</md-toolbar>\n\x3c!-- QUEUES TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'VOICE.DID\' | translate }}</th>\n        <th ng-if="vm.voiceQueueType === \'inbound\'" md-column>{{ \'VOICE.ALIAS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.QUEUE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.CALLER\' | translate }}</th>\n        <th md-column>{{ \'VOICE.AGENT\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DURATION\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.voiceQueuesChannels.count > 0">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="channel in vm.voiceQueuesChannels.rows | limitObjectFromTo: vm.query.limit:(vm.query.page - 1) * vm.query.limit">\n        <td md-cell>\n          <md-icon ng-if="channel.queuecallerleaveAt" md-font-icon="icon-phone-in-talk green-fg"></md-icon>\n          <md-icon ng-if="!channel.queuecallerleaveAt" md-font-icon="icon-phone-incoming md-accent"></md-icon>\n        </td>\n        <td md-cell>{{channel.exten}}</td>\n        <td ng-if="vm.voiceQueueType === \'inbound\'" md-cell>{{channel.routealias}}</td>\n        <td md-cell>{{channel.queue}}</td>\n        <td md-cell privacy ng-cloak>\n          <span ng-if="vm.voiceQueueType === \'inbound\'">{{channel.calleridname}}, </span>\n          <span>{{channel.calleridnum}}</span>\n        </td>\n        <td md-cell>\n          <span ng-if="channel.queuecallerleaveAt">\n            {{channel.connectedlinename}}, {{channel.connectedlinenum}}\n            <span class="text-boxed">\n              <timer start-time="channel.queuecallerleaveAt"></timer>\n            </span>\n          </span>\n          <span ng-if="!channel.queuecallerleaveAt" class="text-boxed">\n            {{ \'VOICE.WAITING_FOR_AGENT\' | translate }}\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell>\n          <span class="text-boxed">\n            <timer start-time="channel.queuecallerjoinAt"></timer>\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item>\n                <md-button ng-click="vm.hangup(channel.uniqueid)" translate="VOICE.HANGUP">\n                  Hangup\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.redirectToNumber($event, channel.uniqueid)" translate="VOICE.REDIRECT_TO_NUMBER">\n                  Number\n                </md-button>\n              </md-menu-item>\n              <md-menu-item>\n                <md-menu class="no-margin">\n                  <md-button ng-mouseenter="vm.getAvailableAgents()" translate="VOICE.REDIRECT_TO_AGENT">\n                    Redirect to Agent</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="!vm.availableAgents">\n                      <md-progress-circular class="md-accent auto-margin" md-diameter="32" md-mode="indeterminate">\n                      </md-progress-circular>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length > 0" ng-repeat="agent in vm.availableAgents">\n                      <md-button ng-click="vm.redirectToAgent(channel.uniqueid, agent.name, agent.context)">\n                        {{agent.name}}</md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.availableAgents.length === 0">\n                      <span>{{ \'VOICE.NO_AGENT_AVAILABLE\' | translate }}</span>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-page="vm.query.page" md-limit-options="[10, 15, 20, 50, 100, 250]" md-total="{{ vm.voiceQueuesChannels.count }}" md-page-select></md-table-pagination>\n\x3c!-- / QUEUES TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/realtime/views/queues/predictive/dialog.html",'<md-dialog class="predictive-dialog" aria-label="New predictive">\n  <md-toolbar class="md-accent md-hue-2">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n      <span class="title">{{ vm.queueCampaign.name }} {{ \'DASHBOARDS.INFO\' | translate }}</span>\n      <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-dialog-content class="text-center">\n    <ds-widget-clock data-show-digital></ds-widget-clock>\n    <div ng-if="!vm.queueCampaign.startProgressive && !vm.queueCampaign.startPredictive">\n      <div class="md-title"><span translate="MOTIONDIALER.PREDICTIVE_IS_NOT_RUNNING">Predictive is not running</span></div>\n    </div>\n\n    <div ng-if="vm.queueCampaign.startProgressive && !vm.queueCampaign.startPredictive" class="m-10">\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-headline"><span translate="MOTIONDIALER.DATA_COLLECTION_IN_PROGRESSIVE">Data collection in progressive</span></div>\n          <div class="md-subhead">({{vm.queueCampaign.dialPredictiveInterval}} minutes)</div>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.STARTTIME">Start Time</span></div>\n          <div class="md-headline">{{ vm.formatTime(vm.queueCampaign.startProgressive) }}</div>\n        </div>\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.ENDTIME">End Time</span></div>\n          <div class="md-headline">\n            {{ vm.formatTime(vm.queueCampaign.startProgressive, vm.queueCampaign.dialPredictiveInterval) }}\n          </div>\n        </div>\n      </div>\n      <div>\n        <span class="text-boxed blue-bg white-fg">\n          {{vm.queueCampaign.message ? (\'MOTIONDIALER.\' + vm.queueCampaign.message | translate) : \'--\'}}\n        </span>\n      </div>\n    </div>\n    <div ng-if="vm.queueCampaign.startPredictive" class="m-10">\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-headline"><span translate="MOTIONDIALER.PREDICTIVE_IS_RUNNING">Predictive is runnning</span></div>\n          <div class="md-subhead">({{vm.queueCampaign.dialPredictiveInterval}} minutes)</div>\n        </div>\n      </div>\n\n      <div layout="row">\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.STARTTIME">Start Time</span></div>\n          <div class="md-headline">{{ vm.formatTime(vm.queueCampaign.startPredictive) }}</div>\n        </div>\n        <div flex="" class="column">\n          <div class="md-subhead"><span translate="MOTIONDIALER.ENDTIME">End Time</span></div>\n          <div class="md-headline">\n            {{ vm.formatTime(vm.queueCampaign.startPredictive, vm.queueCampaign.dialPredictiveInterval) }}\n          </div>\n        </div>\n      </div>\n      <div>\n        <span class="text-boxed blue-bg white-fg">\n          {{vm.queueCampaign.message ? (\'MOTIONDIALER.\' + vm.queueCampaign.message | translate) : \'--\'}}\n        </span>\n      </div>\n      <div class="row">\n        <md-card>\n          <md-toolbar class="md-table-toolbar md-default">\n            <div class="md-toolbar-tools">\n              <span class="md-subhead">Predictive - {{ \'MOTIONDIALER.PREVIOUS_INTERVAL\' | translate }}</span>\n            </div>\n          </md-toolbar>\n          <md-table-container>\n            <table md-table>\n              <tbody md-body>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.TOTAL_CALLS">Total Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.predictiveIntervalTotalCalls }}</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.ANSWERED_CALLS">Total Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.predictiveIntervalAnsweredCalls }}</td>\n                </tr>\n                \x3c!-- Temporaneamente non mostrate perchè contengono anche i dati dell\'intervallo corrente --\x3e\n                \x3c!-- <tr md-row>\n                      <td md-cell>Dropped Calls Timeout</td>\n                      <td md-cell>{{ vm.queueCampaign.predictiveIntervalDroppedCallsTimeout }}</td>\n                    </tr>\n                    <tr md-row>\n                      <td md-cell>Dropped Calls Caller Exit</td>\n                      <td md-cell>{{ vm.queueCampaign.predictiveIntervalDroppedCallsCallersExit }}\n                      </td>\n                    </tr> --\x3e\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AVG_HOLD_TIME">AVG Hold Time</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.predictiveIntervalAvgHoldtime | number:0 }}s</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AVG_TALK_TIME">AVG Talk Time</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.predictiveIntervalAvgTalktime | number:0 }}s</td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n        </md-card>\n        <md-card>\n          <md-toolbar class="md-table-toolbar md-default">\n            <div class="md-toolbar-tools">\n              <span class="md-subhead">ErlangB - {{ \'MOTIONDIALER.CURRENT_INTERVAL\' | translate }}</span>\n            </div>\n          </md-toolbar>\n          <md-table-container>\n            <table md-table>\n              <tbody md-body>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.SCHEDULED_CALLS">Scheduled Calls</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangCalls }}</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.ONE_CALL_EVERY">One call every</span></td>\n                  <td md-cell>~ {{ vm.queueCampaign.erlangCallToSecond | number:0 }}s</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.DROPRATE">Drop Rate</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangAbandonmentRate * 100 | number:2 }}%</td>\n                </tr>\n                <tr md-row>\n                  <td md-cell><span translate="MOTIONDIALER.AGENTBUSYFACTOR">Agent Busy Factor</span></td>\n                  <td md-cell>{{ vm.queueCampaign.erlangBusyFactor * 100 | number:2 }}%</td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n        </md-card>\n      </div>\n    </div>\n  </md-dialog-content>\n</md-dialog>'),e.put("app/main/apps/realtime/views/queues/templates/actions.html",'<md-menu>\n  <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n    <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n  </md-button>\n  <md-menu-content width="3">\n    <md-menu-item>\n      <md-button ng-click="vm.editQueue($event, queue)" translate="{{ (vm.channel | uppercase) + \'.EDIT_QUEUE\' }}">\n        Edit Queue\n      </md-button>\n    </md-menu-item>\n    <md-menu-item ng-if="queue.dialMethod === \'predictive\'">\n      <md-button ng-click="vm.showPredictiveInfo($event, queue)" translate="MOTIONDIALER.SHOW_PREDICTIVE_QUEUE_CAMPAIGN_INFO">\n        Show Predictive Info\n      </md-button>\n    </md-menu-item>\n    <md-menu-item>\n      <md-button ng-click="vm.addOrRemoveAgents($event, queue)" translate="{{ (vm.channel | uppercase) + \'.AGENTSADD_QUEUE\' }}">\n        Add Agents to queue\n      </md-button>\n    </md-menu-item>\n  </md-menu-content>\n</md-menu>'),e.put("app/main/apps/realtime/views/queues/templates/headers/default.html","<tr md-row>\n  <th md-column md-order-by=\"name\">{{ (vm.channel | uppercase) + '.NAME' | translate }}</th>\n  <th md-column>{{ (vm.channel | uppercase) + '.LOGGED_IN' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.AVAILABLE' | translate }}</th>\n  <th md-column>{{ (vm.channel | uppercase) + '.PAUSED' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.WAITING_INTERACTIONS' | translate }}</th>\n  <th md-column width=\"10px\"></th>\n</tr>"),e.put("app/main/apps/realtime/views/queues/templates/headers/inbound.html","<tr md-row>\n  <th md-column md-order-by=\"name\">{{ 'VOICE.NAME' | translate }}</th>\n  <th md-column>{{ 'VOICE.LOGGED_IN' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.AVAILABLE' | translate }}</th>\n  <th md-column>{{ 'VOICE.PAUSED' | translate }}</th>\n  <th md-column>{{ 'VOICE.TALKING' | translate }}</th>\n  <th md-column>{{ 'VOICE.BUSY' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.WAITING_CALLS' | translate }}</th>\n  <th md-column width=\"10px\"></th>\n</tr>"),e.put("app/main/apps/realtime/views/queues/templates/headers/outbound.html","<tr md-row>\n  <th md-column md-order-by=\"name\">{{ 'MOTIONDIALER.NAME' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.LOGGED_IN' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.AVAILABLE' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.PAUSED' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.TALKING' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.BUSY' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.WAITING_CALLS' | translate }}</th>\n  <th md-column>{{ 'DASHBOARDS.ORIGINATED_TEXT' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.MESSAGE' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.METHOD' | translate }}</th>\n  <th md-column>{{ 'MOTIONDIALER.TRUNK' | translate }}</th>\n  <th md-column md-order-by=\"dialActive\">{{ 'MOTIONDIALER.ACTIVE' | translate }}</th>\n  <th md-column width=\"10px\"></th>\n</tr>"),e.put("app/main/apps/realtime/views/queues/templates/rows/default.html",'<tr md-row ng-hide="vm.queues.count > 0">\n  <td md-cell colspan="6">\n    <div layout="row" layout-align="center center">\n      <span translate="DASHBOARDS.NO_AVAILABLE_INFO">No Available Info</span>\n    </div>\n  </td>\n</tr>\n<tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n  <td md-cell>{{ queue.name }}</td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.loggedIn }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n  </td>\n\n  <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit" ng-include="\'app/main/apps/realtime/views/queues/templates/actions.html\'"></td>\n</tr>'),e.put("app/main/apps/realtime/views/queues/templates/rows/inbound.html",'<tr md-row ng-hide="vm.queues.count > 0">\n  <td md-cell colspan="8">\n    <div layout="row" layout-align="center center">\n      <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n    </div>\n  </td>\n</tr>\n<tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n  <td md-cell>{{ queue.name }}</td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.loggedInDb }} ({{ queue.loggedIn }})</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.talking }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.inUse - queue.talking }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n  </td>\n\n  <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit" ng-include="\'app/main/apps/realtime/views/queues/templates/actions.html\'"></td>\n</tr>'),e.put("app/main/apps/realtime/views/queues/templates/rows/outbound.html",'<tr md-row ng-hide="vm.queues.count > 0">\n  <td md-cell colspan="13">\n    <div layout="row" layout-align="center center">\n      <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n    </div>\n  </td>\n</tr>\n<tr md-row md-select="queue" md-select-id="id" ng-repeat="queue in vm.queues.rows">\n  <td md-cell>{{ queue.name }}</td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.loggedInDb }} ({{ queue.loggedIn }})</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.available }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.paused }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.talking + queue.pTalking }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.inUse - queue.talking - queue.pTalking }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.waiting }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.originated }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-16 grey-fg">{{ queue.message ? (\'MOTIONDIALER.\' + queue.message | translate) : (queue.statusMessage ? (\'MOTIONDIALER.\' + queue.statusMessage | translate) : \'--\')}}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-18 grey-fg">{{ queue.dialMethod || 0 }}</span>\n  </td>\n  <td md-cell>\n    <span class="font-size-16 grey-fg">{{ queue.Trunk ? queue.Trunk.name : \'--\' }}</span>\n  </td>\n  <td md-cell>\n'+"    <md-icon md-colors=\"{color: {{queue.dialActive ? '\\'green\\'' : '\\'red\\''}}}\" md-font-icon=\"{{queue.dialActive ? 'icon-check' : 'icon-close'}}\"></md-icon>\n  </td>\n\n  <td md-cell class=\"actions\" ng-if=\"vm.crudPermissions.canEdit\" ng-include=\"'app/main/apps/realtime/views/queues/templates/actions.html'\"></td>\n</tr>"),e.put("app/main/apps/realtime/views/queues/view.html",'<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="{{ (vm.channel | uppercase) + \'.QUEUES\' }}">Queues</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues" ng-include="vm.headersTemplate">\n    </thead>\n    <tbody md-body ng-include="vm.rowsTemplate"></tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{ \'DASHBOARDS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'DASHBOARDS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'DASHBOARDS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>'),e.put("app/main/apps/settings/views/cloudProviders/cloudProviders.html",'<div id="cloudProviders" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.CLOUD_PROVIDERS">Cloud Providers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SETTINGS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedAiTools.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedAiTools =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SETTINGS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-cloudProviders-count">\n          <span>{{vm.selectedAiTools.length}}</span>\n          <span translate="SETTINGS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SETTINGS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllAiTools()" translate="SETTINGS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectAiTools()" translate="SETTINGS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedAiTools" csv-label="true" filename="cloudProviders.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-click="vm.deleteSelectedAiTools($event)" aria-label="delete selected" translate translate-attr-label="SETTINGS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CLOUDPROVIDER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedAiTools" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAiTools">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SETTINGS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SETTINGS.NAME\' | translate }}</th>\n                <th md-column md-order-by="service">{{ \'SETTINGS.SERVICE\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.cloudProviders.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SETTINGS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="cloudProvider" md-select-id="id" ng-repeat="cloudProvider in vm.cloudProviders.rows">\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="id">{{cloudProvider.id}}</td>\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="name">{{cloudProvider.name}}</td>\n                <td ng-click="vm.createOrEditCloudProvider($event, cloudProvider)" md-cell class="service">{{ vm.services[cloudProvider.service] }}</td>\n\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SETTINGS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="cloudProvider.service === \'MicrosoftAzure\'">\n                        <md-button ng-click="vm.authenticateToMicrosoftIdentityPlatform(cloudProvider)" translate="SETTINGS.AUTHENTICATE">\n                          Authenticate\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item ng-if="cloudProvider.service === \'MicrosoftAzure\'">\n                        <md-button ng-click="vm.updateClientSecret(cloudProvider, $event)" translate="SETTINGS.UPDATE_CLIENT_SECRET">\n                          Update Client Secret\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item>\n                        <md-button ng-click="vm.editdialog(cloudProvider, $event)" translate="SETTINGS.EDIT_CLOUDPROVIDER">\n                          Edit CloudProvider\n                        </md-button>\n                      </md-menu-item>\n\n                      <md-menu-item>\n                        <md-button ng-click="vm.deleteconfirm(cloudProvider, $event)" translate="SETTINGS.DELETE_CLOUDPROVIDER">\n                          Delete CloudProvider\n                        </md-button>\n                      </md-menu-item>\n\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SETTINGS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SETTINGS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SETTINGS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.cloudProviders.count}}" md-on-paginate="vm.getAiTools" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CLOUDPROVIDER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CLOUDPROVIDER BUTTON --\x3e\n  <md-button class="md-fab md-accent" id="add-cloudProvider-button" ng-click="vm.createOrEditCloudProvider($event)" aria-label="add cloudProvider" translate translate-attr-aria-label="SETTINGS.ADD_CLOUDPROVIDER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CLOUDPROVIDER BUTTON --\x3e\n</div>'),e.put("app/main/apps/settings/views/cloudProviders/create/dialog.html",'<md-dialog class="cloudProvider-dialog" aria-label="New CloudProvider">\n  <form name="cloudProviderForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (vm.newCloudProvider ? \'SETTINGS.NEW_CLOUDPROVIDER\' : \'SETTINGS.EDIT_CLOUDPROVIDER\') | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.cloudProvider.name" ng-required="true" autofocus>\n\n        <div ng-messages="cloudProviderForm[\'name\'].$error" ng-show="cloudProviderForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.SERVICE">Service</label>\n        <md-select name="service" ng-model="vm.cloudProvider.service" required ng-disabled="!vm.newCloudProvider">\n          <md-option ng-if="vm.license.ai" ng-value="\'AmazonAWS\'">AmazonAWS</md-option>\n          <md-option ng-value="\'MicrosoftAzure\'">Microsoft Azure</md-option>\n        </md-select>\n        <div ng-messages="cloudProviderForm[\'service\'].$error" ng-show="cloudProviderForm[\'service\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.SERVICE_REQUIRED">Service field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.cloudProvider.service == \'MicrosoftAzure\'" class="md-block">\n        <label translate="SETTINGS.TYPE">Type</label>\n        <md-select name="service" ng-model="vm.cloudProvider.type" required ng-disabled="!vm.newCloudProvider">\n          <md-option ng-value="\'Outlook365\'">Outlook365</md-option>\n          <md-option ng-value="\'Dynamics365\'">Dynamics365</md-option>\n        </md-select>\n        <div ng-messages="cloudProviderForm[\'type\'].$error" ng-show="cloudProviderForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.cloudProvider.service == \'AmazonAWS\'" class="md-block">\n        <label translate="SETTINGS.ACCESSKEY">AccessKey</label>\n        <input type="text" name="data2" ng-model="vm.cloudProvider.data2" ng-required="true">\n\n        <div ng-messages="cloudProviderForm[\'data2\'].$error" ng-show="cloudProviderForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ACCESSKEY_REQUIRED">AccessKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.cloudProvider.service == \'AmazonAWS\'" class="md-block">\n        <label translate="SETTINGS.SECRETACCESSKEY">SecretAccesskey</label>\n        <input type="text" name="data1" ng-model="vm.cloudProvider.data1" ng-required="true">\n\n        <div ng-messages="cloudProviderForm[\'data1\'].$error" ng-show="cloudProviderForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.SECRETACCESSKEY_REQUIRED">SecretAccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div ng-if="vm.cloudProvider.service == \'MicrosoftAzure\'">\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.APPLICATION_ID">Application Id</label>\n          <input type="text" name="data1" ng-model="vm.cloudProvider.data1" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data1\'].$error" ng-show="cloudProviderForm[\'data1\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.TENANT_ID">Tenant Id</label>\n          <input type="text" name="data2" ng-model="vm.cloudProvider.data2" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data2\'].$error" ng-show="cloudProviderForm[\'data2\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container ng-if="vm.newCloudProvider" class="md-block">\n          <label translate="SETTINGS.CLIENT_SECRET">Client Secret</label>\n          <input type="password" name="data3" ng-model="vm.cloudProvider.data3" ng-required="true">\n          <div class="hint"><span translate="SETTINGS.HELP.CLIENT_SECRET"></span></div>\n\n          <div ng-messages="cloudProviderForm[\'data3\'].$error" ng-show="cloudProviderForm[\'data3\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block">\n          <label translate="SETTINGS.REDIRECT_URI">Redirect Uri</label>\n          <input type="url" name="data4" ng-model="vm.cloudProvider.data4" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data4\'].$error" ng-show="cloudProviderForm[\'data4\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n            <div ng-message="url">\n              <span translate="SETTINGS.ERRORS.WRONG_FORMAT"></span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container ng-if="vm.cloudProvider.type == \'Dynamics365\'" class="md-block">\n          <label translate="SETTINGS.REMOTE_URI">Remote Uri</label>\n          <input type="url" name="data7" ng-model="vm.cloudProvider.data7" ng-required="true">\n\n          <div ng-messages="cloudProviderForm[\'data7\'].$error" ng-show="cloudProviderForm[\'data7\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.FIELD_REQUIRED"></span>\n            </div>\n            <div ng-message="url">\n              <span translate="SETTINGS.ERRORS.WRONG_FORMAT"></span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newCloudProvider" ng-click="vm.saveCloudProvider()" class="send-button md-accent md-raised" ng-disabled="cloudProviderForm.$invalid || cloudProviderForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newCloudProvider" ng-click="vm.addNewCloudProvider()" class="send-button md-accent md-raised" ng-disabled="cloudProviderForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_CLOUDPROVIDER" translate-attr-aria-label="SETTINGS.ADD_CLOUDPROVIDER">\n          ADD CLOUDPROVIDER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.deleteCloudProvider($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/cloudProviders/updateSecret/updateSecret.html",'<md-dialog class="cloudProvider-dialog" aria-label="update client secret">\n  <form name="updateSecretForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'SETTINGS.UPDATE_CLIENT_SECRET\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.user.id">\n        <label translate="SETTINGS.CLIENT_SECRET">Current Client Secret</label>\n        <input type="text" name="currentSecret" ng-model="vm.cloudProvider.data3" disabled>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NEW_CLIENT_SECRET">New Client Secret</label>\n        <input type="password" name="secret" ng-model="vm.newSecret" required>\n        <div ng-messages="updateSecretForm.secret.$error" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">New Client Secret field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.saveSecret()" class="send-button md-accent md-raised" ng-disabled="updateSecretForm.$invalid || updateSecretForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/customizations/create/dialog.html",'<md-dialog class="customization-dialog" aria-label="New Customization">\n  <form name="customizationForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultLogo" aria-label="Default_Logo"><span translate="SETTINGS.DEFAULT_LOGO">Default_Logo</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultLoginLogo" aria-label="Default_Login_Logo"><span translate="SETTINGS.DEFAULT_LOGIN_LOGO">Default_Login_Logo</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultFavicon" aria-label="Default_Favicon"><span translate="SETTINGS.DEFAULT_FAVICON">Default_Favicon</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultHeaderWhiteLabel" aria-label="Default_Header_WhiteLabel"><span translate="SETTINGS.DEFAULT_HEADER_WHITELABEL">Default_Header_WhiteLabel</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.customization.defaultHeaderWhiteLabel" class="md-block">\n        <label translate="SETTINGS.HEADER_WHITELABEL">Header_WhiteLabel</label>\n        <input type="text" name="headerWhiteLabel" ng-model="vm.customization.headerWhiteLabel" ng-required="true">\n\n        <div ng-messages="customizationForm[\'headerWhiteLabel\'].$error" ng-show="customizationForm[\'headerWhiteLabel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.HEADER_WHITELABEL_REQUIRED">Header_WhiteLabel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.customization.defaultPageTitle" aria-label="Default_Page_Title"><span translate="SETTINGS.DEFAULT_PAGE_TITLE">Default_Page_Title</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.customization.defaultPageTitle" class="md-block">\n        <label translate="SETTINGS.PAGE_TITLE">Page_Title</label>\n        <input type="text" name="pageTitle" ng-model="vm.customization.pageTitle" ng-required="true">\n\n        <div ng-messages="customizationForm[\'pageTitle\'].$error" ng-show="customizationForm[\'pageTitle\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PAGE_TITLE_REQUIRED">Page_Title field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.license.preferred" class="md-block">\n        <md-switch ng-model="vm.customization.defaultPreferred" aria-label="Default_Preferred"><span translate="SETTINGS.DEFAULT_PREFERRED">Default_Preferred</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomization" ng-click="vm.saveCustomization()" class="send-button md-accent md-raised" ng-disabled="customizationForm.$invalid || customizationForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomization" ng-click="vm.addNewCustomization()" class="send-button md-accent md-raised" ng-disabled="customizationForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_CUSTOMIZATION" translate-attr-aria-label="SETTINGS.ADD_CUSTOMIZATION">\n          ADD CUSTOMIZATION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomization" ng-click="vm.deleteCustomization($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/customizations/customizations.html",'<div id="customizations" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.CUSTOMIZATIONS">Customizations</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveCustomization()" ng-disabled="(customizationsForm.$pristine && logoForm.$pristine && logologinForm.$pristine && preferredForm.$pristine && faviconForm.$pristine) || (customizationsForm.$invalid || logoForm.$invalid || logologinForm.$invalid || preferredForm.$invalid || faviconForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div class="customization-detail-form-container customizations md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.CUSTOMIZATIONS">CUSTOMIZATIONS</div>\n        </div>\n        <form name="customizationsForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultLogo" aria-label="Default_Logo"><span translate="SETTINGS.DEFAULT_LOGO">Default_Logo</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultLoginLogo" aria-label="Default_Login_Logo"><span translate="SETTINGS.DEFAULT_LOGIN_LOGO">Default_Login_Logo</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultFavicon" aria-label="Default_Favicon"><span translate="SETTINGS.DEFAULT_FAVICON">Default_Favicon</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultHeaderWhiteLabel" aria-label="Default_Header_WhiteLabel"><span translate="SETTINGS.DEFAULT_HEADER_WHITELABEL">Default_Header_WhiteLabel</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="!vm.customization.defaultHeaderWhiteLabel" class="md-block">\n            <label translate="SETTINGS.HEADER_WHITELABEL">Header_WhiteLabel</label>\n            <input type="text" name="headerWhiteLabel" ng-model="vm.customization.headerWhiteLabel" ng-required="true">\n\n            <div ng-messages="customizationsForm[\'headerWhiteLabel\'].$error" ng-show="customizationsForm[\'headerWhiteLabel\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.HEADER_WHITELABEL_REQUIRED">Header_WhiteLabel field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.customization.defaultPageTitle" aria-label="Default_Page_Title"><span translate="SETTINGS.DEFAULT_PAGE_TITLE">Default_Page_Title</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="!vm.customization.defaultPageTitle" class="md-block">\n            <label translate="SETTINGS.PAGE_TITLE">Page_Title</label>\n            <input type="text" name="pageTitle" ng-model="vm.customization.pageTitle" ng-required="true">\n\n            <div ng-messages="customizationsForm[\'pageTitle\'].$error" ng-show="customizationsForm[\'pageTitle\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PAGE_TITLE_REQUIRED">Page_Title field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.license.preferred" class="md-block">\n            <md-switch ng-model="vm.customization.defaultPreferred" aria-label="Default_Preferred"><span translate="SETTINGS.DEFAULT_PREFERRED">Default_Preferred</span></md-switch>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="!vm.customization.defaultLogo" class="customization-detail-form-container logo md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.LOGO">LOGO</div>\n        </div>\n        <div ng-controller="CustomizationlogoController as vm_cl" ng-init="vm_cl.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cl.ngFlowOptions" flow-name="vm_cl.ngFlow.flow" flow-files-submitted="vm_cl.upload()" flow-file-added="vm_cl.fileAdded($file)" flow-file-success="vm_cl.fileSuccess($file, $message)" flow-complete="vm_cl.uploadComplete()" flow-drop flow-drag-enter="vm_cl.dropping=true" flow-drag-leave="vm_cl.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="logoimage in vm_cl.customization.images" ng-switch="logoimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{logoimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="logoimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{logoimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultLoginLogo" class="customization-detail-form-container logologin md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.LOGOLOGIN">LOGOLOGIN</div>\n        </div>\n        <div ng-controller="CustomizationlogologinController as vm_cll" ng-init="vm_cll.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cll.ngFlowOptions" flow-name="vm_cll.ngFlow.flow" flow-files-submitted="vm_cll.upload()" flow-file-added="vm_cll.fileAdded($file)" flow-file-success="vm_cll.fileSuccess($file, $message)" flow-complete="vm_cll.uploadComplete()" flow-drop flow-drag-enter="vm_cll.dropping=true" flow-drag-leave="vm_cll.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="logologinimage in vm_cll.customization.images" ng-switch="logologinimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{logologinimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="logologinimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{logologinimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultPreferred && vm.license.preferred" class="customization-detail-form-container preferred md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.PREFERRED">PREFERRED</div>\n        </div>\n        <div ng-controller="CustomizationpreferredController as vm_cp" ng-init="vm_cp.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cp.ngFlowOptions" flow-name="vm_cp.ngFlow.flow" flow-files-submitted="vm_cp.upload()" flow-file-added="vm_cp.fileAdded($file)" flow-file-success="vm_cp.fileSuccess($file, $message)" flow-complete="vm_cp.uploadComplete()" flow-drop flow-drag-enter="vm_cp.dropping=true" flow-drag-leave="vm_cp.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="preferredimage in vm_cp.customization.images" ng-switch="preferredimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{preferredimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="preferredimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{preferredimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n      <div ng-if="!vm.customization.defaultFavicon" class="customization-detail-form-container favicon md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.FAVICON">FAVICON</div>\n        </div>\n        <div ng-controller="CustomizationfaviconController as vm_cf" ng-init="vm_cf.init(vm.customization)" class="customization-detail-form-container md-background-bg md-whiteframe-1dp">\n\n          <div id="customization-image-uploader" flow-init="vm_cf.ngFlowOptions" flow-name="vm_cf.ngFlow.flow" flow-files-submitted="vm_cf.upload()" flow-file-added="vm_cf.fileAdded($file)" flow-file-success="vm_cf.fileSuccess($file, $message)" flow-complete="vm_cf.uploadComplete()" flow-drop flow-drag-enter="vm_cf.dropping=true" flow-drag-leave="vm_cf.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n            <div class="drop-text hint-text" layout="row" layout-align="center center">\n              <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n            </div>\n\n            <div class="upload-button" layout="column" layout-align="center center">\n              <md-button class="md-accent md-raised" flow-btn>\n                Upload\n              </md-button>\n              <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG, ICO - Max. 8MB</span>\n            </div>\n\n            <div layout="row" layout-align="start start" layout-wrap>\n              <div ng-repeat="faviconimage in vm_cf.customization.images" ng-switch="faviconimage.type">\n                <div class="customization-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                  <div class="overlay" layout="column" layout-align="center center">\n                    <md-progress-linear md-mode="determinate" value="{{faviconimage.file.progress() * 100}}">\n                    </md-progress-linear>\n                  </div>\n                  <img class="media" flow-img="faviconimage.file">\n                </div>\n\n                <div class="customization-image" ng-switch-when="image" layout="row" layout-align="center center">\n                  <img class="media" ng-src="{{faviconimage.url}}">\n                </div>\n              </div>\n            </div>\n          </div>\n        </div>\n\n      </div>\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/settings/views/generals/create/dialog.html",'<md-dialog class="general-dialog" aria-label="New General">\n  <form name="generalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newGeneral" ng-click="vm.saveGeneral()" class="send-button md-accent md-raised" ng-disabled="generalForm.$invalid || generalForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newGeneral" ng-click="vm.addNewGeneral()" class="send-button md-accent md-raised" ng-disabled="generalForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_GENERAL" translate-attr-aria-label="SETTINGS.ADD_GENERAL">\n          ADD GENERAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newGeneral" ng-click="vm.deleteGeneral($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/generals/generals.html",'<div id="generals" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.GENERAL">General</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div>\n      <md-button type="submit" ng-click="vm.saveGeneral()" ng-disabled="(globalForm.$pristine && motionbarForm.$pristine && reportForm.$pristine && agentOmniDesktopInterfaceForm.$pristine && screenRecordingForm.$pristine && securityForm.$pristine && imapGeneralSettingsForm.$pristine && SSOForm.$pristine && aiToolsForm.$pristine) || (globalForm.$invalid || motionbarForm.$invalid || reportForm.$invalid || agentOmniDesktopInterfaceForm.$invalid || screenRecordingForm.$invalid || securityForm.$invalid || imapGeneralSettingsForm.$invalid || SSOForm.$invalid || aiToolsForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      <div class="general-detail-form-container global md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.GLOBAL">GLOBAL</div>\n        </div>\n        <form name="globalForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MIN_INTERNAL">Min_Internal</label>\n            <input type="number" name="min_internal" ng-model="vm.general.min_internal" min="0" value="1000" ng-required="true" autofocus>\n\n            <div ng-messages="globalForm[\'min_internal\'].$error" ng-show="globalForm[\'min_internal\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MIN_INTERNAL_REQUIRED">Min_Internal field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.MIN_INTERNAL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Min_Internal must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.CHATTIMEOUT">chatTimeout</label>\n            <input type="number" name="chatTimeout" ng-model="vm.general.chatTimeout" min="0" value="30" ng-required="true">\n\n            <div ng-messages="globalForm[\'chatTimeout\'].$error" ng-show="globalForm[\'chatTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.CHATTIMEOUT_REQUIRED">chatTimeout field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.CHATTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">chatTimeout must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.rtlSupport" aria-label="RtlSupport"><span translate="SETTINGS.RTLSUPPORT">RtlSupport</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.RTLSUPPORT"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.stopRecordingOnTransfer" aria-label="Stop_Recording_On_Voice_Call_Transfer"><span translate="SETTINGS.STOP_RECORDING_ON_VOICE_CALL_TRANSFER">Stop_Recording_On_Voice_Call_Transfer</span></md-switch>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div class="general-detail-form-container motionbar md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.MOTIONBAR">MOTIONBAR</div>\n        </div>\n        <form name="motionbarForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.phoneBarAutoUpdater" aria-label="MotionbarAutoUpdater"><span translate="SETTINGS.MOTIONBARAUTOUPDATER">MotionbarAutoUpdater</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.phoneBarAutoUpdater" class="md-block">\n            <label translate="SETTINGS.MOTIONBARAUTOUPDATERURL">MotionbarAutoUpdaterUrl</label>\n            <input type="url" name="phoneBarAutoUpdaterUrl" ng-model="vm.general.phoneBarAutoUpdaterUrl" value="https://www.xcally.com/bar/phonebar/autoupdater.xml" ng-required="vm.general.phoneBarAutoUpdater">\n\n            <div ng-messages="motionbarForm[\'phoneBarAutoUpdaterUrl\'].$error" ng-show="motionbarForm[\'phoneBarAutoUpdaterUrl\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MOTIONBARAUTOUPDATERURL_REQUIRED">MotionbarAutoUpdaterUrl field is required</span>\n              </div>\n              <div ng-message="url">\n                <span translate="SETTINGS.ERRORS.MOTIONBARAUTOUPDATERURL_MUST_VALID_URL">MotionbarAutoUpdaterUrl must be a valid url http://www.xcally.com</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.phoneBarRememberMeEnabled" aria-label="MotionbarRememberMe"><span translate="SETTINGS.MOTIONBARREMEMBERME">MotionbarRememberMe</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.MOTIONBARREMEMBERME"></span></div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container report md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.REPORT">REPORT</div>\n        </div>\n        <form name="reportForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.split" aria-label="Split"><span translate="SETTINGS.SPLIT">Split</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZECSV">SplitSizeCsv</label>\n            <input type="number" name="splitSizeCsv" ng-model="vm.general.splitSizeCsv" value="5000">\n\n            <div ng-messages="reportForm[\'splitSizeCsv\'].$error" ng-show="reportForm[\'splitSizeCsv\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZECSV_REQUIRED">SplitSizeCsv field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZEPDF">SplitSizePdf</label>\n            <input type="number" name="splitSizePdf" ng-model="vm.general.splitSizePdf" value="1000">\n\n            <div ng-messages="reportForm[\'splitSizePdf\'].$error" ng-show="reportForm[\'splitSizePdf\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZEPDF_REQUIRED">SplitSizePdf field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.split" class="md-block">\n            <label translate="SETTINGS.SPLITSIZEXLSX">SplitSizeXlsx</label>\n            <input type="number" name="splitSizeXlsx" ng-model="vm.general.splitSizeXlsx" value="5000">\n\n            <div ng-messages="reportForm[\'splitSizeXlsx\'].$error" ng-show="reportForm[\'splitSizeXlsx\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SPLITSIZEXLSX_REQUIRED">SplitSizeXlsx field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container agentomnidesktopinterface md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.AGENTOMNIDESKTOPINTERFACE">AGENTOMNIDESKTOPINTERFACE</div>\n        </div>\n        <form name="agentOmniDesktopInterfaceForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.enableEmailPreview" aria-label="EnableEmailPreview"><span translate="SETTINGS.ENABLEEMAILPREVIEW">EnableEmailPreview</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.searchOnEnterKey" aria-label="Search_On_Enter_Key"><span translate="SETTINGS.SEARCH_ON_ENTER_KEY">Search_On_Enter_Key</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.SEARCH_ON_ENTER_KEY"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MESSAGESALIGNMENT">messagesAlignment</label>\n            <md-select name="messagesAlignment" ng-model="vm.general.messagesAlignment">\n              <md-option ng-value="\'alternate\'">Alternate</md-option>\n              <md-option ng-value="\'left\'">Left</md-option>\n              <md-option ng-value="\'right\'">Right</md-option>\n            </md-select>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'messagesAlignment\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'messagesAlignment\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MESSAGESALIGNMENT_REQUIRED">messagesAlignment field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.CHAT_INTERACTIONS_RELOAD_TIMEOUT">Chat_Interactions_Reload_Timeout</label>\n            <input type="number" name="chatInteractionsReloadTimeout" ng-model="vm.general.chatInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'chatInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'chatInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.CHAT_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Chat_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.MAIL_INTERACTIONS_RELOAD_TIMEOUT">Mail_Interactions_Reload_Timeout</label>\n            <input type="number" name="mailInteractionsReloadTimeout" ng-model="vm.general.mailInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'mailInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'mailInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.MAIL_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Mail_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.OPENCHANNEL_INTERACTIONS_RELOAD_TIMEOUT">Openchannel_Interactions_Reload_Timeout</label>\n            <input type="number" name="openchannelInteractionsReloadTimeout" ng-model="vm.general.openchannelInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'openchannelInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'openchannelInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.OPENCHANNEL_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Openchannel_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.SMS_INTERACTIONS_RELOAD_TIMEOUT">Sms_Interactions_Reload_Timeout</label>\n            <input type="number" name="smsInteractionsReloadTimeout" ng-model="vm.general.smsInteractionsReloadTimeout">\n\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'smsInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'smsInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.SMS_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Sms_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.WHATSAPP_INTERACTIONS_RELOAD_TIMEOUT">Whatsapp_Interactions_Reload_Timeout</label>\n            <input type="number" name="whatsappInteractionsReloadTimeout" ng-model="vm.general.whatsappInteractionsReloadTimeout">\n            <div class="hint"><span translate="SETTINGS.HELP.INTERACTIONS_RELOAD_TIMEOUT"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'whatsappInteractionsReloadTimeout\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'whatsappInteractionsReloadTimeout\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.WHATSAPP_INTERACTIONS_RELOAD_TIMEOUT_REQUIRED">Whatsapp_Interactions_Reload_Timeout field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.PREVIEW_RECALLME_REMINDER_INTERVAL">Preview_Recallme_Reminder_Interval</label>\n            <input type="number" name="previewRecallmeReminderInterval" ng-model="vm.general.previewRecallmeReminderInterval" min="1">\n            <div class="hint"><span translate="SETTINGS.HELP.PREVIEW_RECALLME_REMINDER_INTERVAL"></span></div>\n            <div ng-messages="agentOmniDesktopInterfaceForm[\'previewRecallmeReminderInterval\'].$error" ng-show="agentOmniDesktopInterfaceForm[\'previewRecallmeReminderInterval\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PREVIEW_RECALLME_REMINDER_INTERVAL_REQUIRED">Preview_Recallme_Reminder_Interval field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PREVIEW_RECALLME_REMINDER_INTERVAL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Preview_Recallme_Reminder_Interval must be a valid greater or equal than</span> <span>1</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LIMIT_TABS">limitTabs</label>\n            <input type="number" name="limitTabs" ng-model="vm.general.limitTabs" min="0" value="20">\n            <div class="hint"><span translate="SETTINGS.HELP.LIMIT_TABS"></span></div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container filters md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.FILTERS">FILTERS</div>\n        </div>\n        <form name="filtersForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.filterFullName" aria-label="fullName"><span translate="SETTINGS.FILTER_FULLNAME">Full Name</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.FILTER_FULLNAME"></span></div>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div ng-if="vm.license.screenrecording" class="general-detail-form-container screenrecording md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SCREENRECORDING">SCREENRECORDING</div>\n        </div>\n        <form name="screenRecordingForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.DEFAULTSCREENRECORDINGPATH">defaultScreenRecordingPath</label>\n            <input type="text" name="defaultScreenRecordingPath" ng-model="vm.general.defaultScreenRecordingPath" autofocus>\n\n            <div class="hint"><span translate="SETTINGS.HELP.DEFAULTSCREENRECORDINGPATH"></span></div>\n            <div ng-messages="screenRecordingForm[\'defaultScreenRecordingPath\'].$error" ng-show="screenRecordingForm[\'defaultScreenRecordingPath\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.DEFAULTSCREENRECORDINGPATH_REQUIRED">defaultScreenRecordingPath field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container security md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SECURITY">SECURITY</div>\n        </div>\n        <form name="securityForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.securePassword" aria-label="Security_Suite"><span translate="SETTINGS.SECURITY_SUITE">Security_Suite</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.SECURITY_SUITE"></span></div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.callRecordingEncryption" aria-label="Call_Recording_Encryption"><span translate="SETTINGS.CALL_RECORDING_ENCRYPTION">Call_Recording_Encryption</span></md-switch>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.ALLOWEDLOGINATTEMPTS">allowedLoginAttempts</label>\n            <input type="number" name="allowedLoginAttempts" ng-model="vm.general.allowedLoginAttempts" value="5" ng-required="true">\n\n            <div ng-messages="securityForm[\'allowedLoginAttempts\'].$error" ng-show="securityForm[\'allowedLoginAttempts\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.ALLOWEDLOGINATTEMPTS_REQUIRED">allowedLoginAttempts field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.BLOCKDURATION">blockDuration</label>\n            <input type="number" name="blockDuration" ng-model="vm.general.blockDuration" value="10" ng-required="true">\n\n            <div ng-messages="securityForm[\'blockDuration\'].$error" ng-show="securityForm[\'blockDuration\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.BLOCKDURATION_REQUIRED">blockDuration field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.enforcePasswordHistory" aria-label="Enforce_Password_History"><span translate="SETTINGS.ENFORCE_PASSWORD_HISTORY">Enforce_Password_History</span></md-switch>\n            <div class="hint"><span translate="SETTINGS.HELP.ENFORCE_PASSWORD_HISTORY"></span></div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enforcePasswordHistory" class="md-block">\n            <label translate="SETTINGS.PASSWORD_HISTORY_LIMIT">Password_History_Limit</label>\n            <input type="number" name="passwordHistoryLimit" ng-model="vm.general.passwordHistoryLimit" min="2" max="5" value="3">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PASSWORD_HISTORY_LIMIT"></span></div>\n            <div ng-messages="securityForm[\'passwordHistoryLimit\'].$error" ng-show="securityForm[\'passwordHistoryLimit\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_REQUIRED">Password_History_Limit field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Password_History_Limit must be a valid greater or equal than</span> <span>2</span>\n              </div>\n              <div ng-message="max">\n                <span translate="SETTINGS.ERRORS.PASSWORD_HISTORY_LIMIT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Password_History_Limit must be a valid greater or equal than</span> <span>5</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'email\')" ng-model="vm.general.enablePrivacyPolicyEmail" aria-label="Privacy_Policy_Email"><span translate="SETTINGS.PRIVACY_POLICY_EMAIL">Privacy_Policy_Email</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyEmail" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyEmail" ng-model="vm.general.privacyPolicyEmail" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyEmail\'].$error" ng-show="securityForm[\'privacyPolicyEmail\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_EMAIL_REQUIRED">Privacy_Policy_Email field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_EMAIL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Email must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'name\')" ng-model="vm.general.enablePrivacyPolicyName" aria-label="Privacy_Policy_Name"><span translate="SETTINGS.PRIVACY_POLICY_NAME">Privacy_Policy_Name</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyName" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyName" ng-model="vm.general.privacyPolicyName" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyName\'].$error" ng-show="securityForm[\'privacyPolicyName\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NAME_REQUIRED">Privacy_Policy_Name field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NAME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Name must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block no-margin-bottom">\n            <md-switch ng-change="vm.onPrivacyPolicyChange(\'number\')" ng-model="vm.general.enablePrivacyPolicyNumber" aria-label="Privacy_Policy_Number"><span translate="SETTINGS.PRIVACY_POLICY_NUMBER">Privacy_Policy_Number</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.enablePrivacyPolicyNumber" class="md-block no-margin-top">\n\n            <input type="number" name="privacyPolicyNumber" ng-model="vm.general.privacyPolicyNumber" min="0" value="0" ng-required="true">\n\n            <div class="hint"><span translate="SETTINGS.HELP.PRIVACY_POLICY"></span></div>\n            <div ng-messages="securityForm[\'privacyPolicyNumber\'].$error" ng-show="securityForm[\'privacyPolicyNumber\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NUMBER_REQUIRED">Privacy_Policy_Number field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.PRIVACY_POLICY_NUMBER_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Privacy_Policy_Number must be a valid greater or equal than</span> <span>0</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.disabledCookie" aria-label="Disabled_Cookie"><span translate="SETTINGS.DISABLED_COOKIE">Disabled_Cookie</span></md-switch>\n          </md-input-container>\n        </form>\n      </div>\n\n      <div class="general-detail-form-container imapgeneralsettings md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.IMAPGENERALSETTINGS">IMAPGENERALSETTINGS</div>\n        </div>\n        <form name="imapGeneralSettingsForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LOGINMAILFREQUENCY">loginMailFrequency</label>\n            <input type="number" name="loginMailFrequency" ng-model="vm.general.loginMailFrequency" min="10" value="10" ng-required="true" autofocus>\n\n            <div class="hint"><span translate="SETTINGS.HELP.LOGINMAILFREQUENCY"></span></div>\n            <div ng-messages="imapGeneralSettingsForm[\'loginMailFrequency\'].$error" ng-show="imapGeneralSettingsForm[\'loginMailFrequency\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.LOGINMAILFREQUENCY_REQUIRED">loginMailFrequency field is required</span>\n              </div>\n              <div ng-message="min">\n                <span translate="SETTINGS.ERRORS.LOGINMAILFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">loginMailFrequency must be a valid greater or equal than</span> <span>10</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div class="general-detail-form-container sso md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.SSO">SSO</div>\n        </div>\n        <form name="SSOForm" novalidate>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.googleSsoEnabled" aria-label="Google_SSO_enabled"><span translate="SETTINGS.GOOGLE_SSO_ENABLED">Google_SSO_enabled</span></md-switch>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.adSsoEnabled" aria-label="AD_SSO_enabled"><span translate="SETTINGS.AD_SSO_ENABLED">AD_SSO_enabled</span></md-switch>\n          </md-input-container>\n\n        </form>\n      </div>\n\n      <div ng-if="vm.license.ai" class="general-detail-form-container aitools md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.AITOOLS">AITOOLS</div>\n        </div>\n        <form name="aiToolsForm" novalidate>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.LANGUAGE">Language</label>\n            <md-select name="language" ng-model="vm.general.language" autofocus required>\n              <md-option ng-value="\'en-US\'">US English</md-option>\n              <md-option ng-value="\'en-AU\'">Australian English</md-option>\n              <md-option ng-value="\'en-GB\'">British English</md-option>\n              <md-option ng-value="\'en-AB\'">Scottish English</md-option>\n              <md-option ng-value="\'en-WL\'">Welsh English</md-option>\n              <md-option ng-value="\'en-IE\'">English (Ireland)</md-option>\n              <md-option ng-value="\'en-IN\'">Indian English</md-option>\n              <md-option ng-value="\'hi-IN\'">Hindi (India)</md-option>\n              <md-option ng-value="\'fr-CA\'">Canadian French</md-option>\n              <md-option ng-value="\'fr-FR\'">French</md-option>\n              <md-option ng-value="\'de-DE\'">German</md-option>\n              <md-option ng-value="\'de-CH\'">German (Switzerland)</md-option>\n              <md-option ng-value="\'it-IT\'">Italian</md-option>\n              <md-option ng-value="\'es-ES\'">Spanish</md-option>\n              <md-option ng-value="\'es-Us\'">US Spanish</md-option>\n              <md-option ng-value="\'pt-BR\'">Brazilian Portuguese</md-option>\n              <md-option ng-value="\'pt-PT\'">Portuguese(Portugal)</md-option>\n              <md-option ng-value="\'ar-SA\'">Modern Standard Arabic</md-option>\n              <md-option ng-value="\'ar-AE\'">Arabic</md-option>\n              <md-option ng-value="\'zh-CN\'">Chinese Mandarin - Mainland</md-option>\n              <md-option ng-value="\'ja-JP\'">Japanese (Japan)</md-option>\n              <md-option ng-value="\'ko-KR\'">Korean (Korea)</md-option>\n              <md-option ng-value="\'he-IL\'">Hebrew (Israel) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ms-MY\'">Malay (Malaysia) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'fa-IR\'">Farsi (Iran) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ru-RU\'">Russian (Russia) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'te-IN\'">Telugu(India) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'ta-IN\'">Tamil - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'nl-NL\'">Dutch - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'tr-TR\'">Turkish (Turkey) - This language is not available for the Sentiment Analysis</md-option>\n              <md-option ng-value="\'id-ID\'">Indonesian(Indonesia) - This language is not available for the Sentiment Analysis</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'language\'].$error" ng-show="aiToolsForm[\'language\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.LANGUAGE_REQUIRED">Language field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.BUCKET">Bucket</label>\n            <input type="text" name="bucket" ng-model="vm.general.bucket" ng-required="true">\n\n            <div ng-messages="aiToolsForm[\'bucket\'].$error" ng-show="aiToolsForm[\'bucket\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.BUCKET_REQUIRED">Bucket field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container class="md-block">\n            <md-switch ng-model="vm.general.transcribe" aria-label="Transcribe"><span translate="SETTINGS.TRANSCRIBE">Transcribe</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.transcribe == true" class="md-block">\n            <label translate="SETTINGS.TRANSCRIBEREGION">TranscribeRegion</label>\n            <md-select name="transcribeRegion" ng-model="vm.general.transcribeRegion" required>\n              <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n              <md-option ng-value="\'us-east-2\'">US East (Ohio)</md-option>\n              <md-option ng-value="\'us-east-2\'">US West (N. California)</md-option>\n              <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n              <md-option ng-value="\'ap-south-1\'">Asia Pacific (Mumbai)</md-option>\n              <md-option ng-value="\'ap-east-1\'">Asia Pacific (Hong Kong)</md-option>\n              <md-option ng-value="\'ap-northeast-2\'">Asia Pacific (Seoul)</md-option>\n              <md-option ng-value="\'ap-southeast-1\'">Asia Pacific (Singapore)</md-option>\n              <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n              <md-option ng-value="\'ap-northeast-1\'">Asia Pacific (Tokyo)</md-option>\n              <md-option ng-value="\'ca-central-1\'">Canada (Central)</md-option>\n              <md-option ng-value="\'eu-central-1\'">Europe (Frankfurt)</md-option>\n              <md-option ng-value="\'eu-west-1\'">Europe (Ireland)</md-option>\n              <md-option ng-value="\'eu-west-2\'">Europe (London)</md-option>\n              <md-option ng-value="\'eu-west-3\'">Europe (Paris)</md-option>\n              <md-option ng-value="\'me-south-1\'">Middle East (Bahrain)</md-option>\n              <md-option ng-value="\'sa-east-1\'">South America (São Paulo)</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'transcribeRegion\'].$error" ng-show="aiToolsForm[\'transcribeRegion\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.TRANSCRIBEREGION_REQUIRED">TranscribeRegion field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if="vm.general.transcribe == true" class="md-block">\n            <label translate="SETTINGS.TRANSCRIBEACCOUNT">TranscribeAccount</label>\n            <md-select name="transcribeAccountId" ng-model="vm.general.transcribeAccountId" required>\n              <md-option ng-value="transcribeAccountId.id" ng-repeat="transcribeAccountId in vm.cloudProviders" ng-disabled="transcribeAccountId.canSelect === false">{{ transcribeAccountId.name }}</md-option>\n            </md-select>\n            <div ng-messages="aiToolsForm[\'transcribeAccountId\'].$error" ng-show="aiToolsForm[\'transcribeAccountId\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.TRANSCRIBEACCOUNT_REQUIRED">TranscribeAccount field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n'+"          <md-input-container ng-if=\"vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <md-switch ng-model=\"vm.general.sentiment\" aria-label=\"SentimentAnalysis\"><span translate=\"SETTINGS.SENTIMENTANALYSIS\">SentimentAnalysis</span></md-switch>\n          </md-input-container>\n          <md-input-container ng-if=\"vm.general.sentiment == true && vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <label translate=\"SETTINGS.SENTIMENTREGION\">SentimentRegion</label>\n            <md-select name=\"sentimentRegion\" ng-model=\"vm.general.sentimentRegion\" required>\n              <md-option ng-value=\"'us-east-1'\">US East (N. Virginia)</md-option>\n              <md-option ng-value=\"'us-east-2'\">US East (Ohio)</md-option>\n              <md-option ng-value=\"'us-west-2'\">US West (Oregon)</md-option>\n              <md-option ng-value=\"'ap-south-1'\">Asia Pacific (Mumbai)</md-option>\n              <md-option ng-value=\"'ap-northeast-2'\">Asia Pacific (Seoul)</md-option>\n              <md-option ng-value=\"'ap-southeast-1'\">Asia Pacific (Singapore)</md-option>\n              <md-option ng-value=\"'ap-southeast-2'\">Asia Pacific (Sydney)</md-option>\n              <md-option ng-value=\"'ap-northeast-1'\">Asia Pacific (Tokyo)</md-option>\n              <md-option ng-value=\"'ca-central-1'\">Canada (Central)</md-option>\n              <md-option ng-value=\"'eu-central-1'\">Europe (Frankfurt)</md-option>\n              <md-option ng-value=\"'eu-west-1'\">Europe (Ireland)</md-option>\n              <md-option ng-value=\"'eu-west-2'\">Europe (London)</md-option>\n            </md-select>\n            <div ng-messages=\"aiToolsForm['sentimentRegion'].$error\" ng-show=\"aiToolsForm['sentimentRegion'].$touched\" role=\"alert\">\n              <div ng-message=\"required\">\n                <span translate=\"SETTINGS.ERRORS.SENTIMENTREGION_REQUIRED\">SentimentRegion field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n          <md-input-container ng-if=\"vm.general.sentiment == true && vm.general.transcribe == true && vm.general.language != 'he-IL' && vm.general.language != 'ms-MY' && vm.general.language != 'fa-IR' && vm.general.language != 'ru-RU' && vm.general.language != 'te-IN' && vm.general.language != 'ta-IN' && vm.general.language != 'nl-NL' && vm.general.language != 'tr-TR' && vm.general.language != 'id-ID'\" class=\"md-block\">\n            <label translate=\"SETTINGS.SENTIMENTACCOUNT\">SentimentAccount</label>\n            <md-select name=\"sentimentAccountId\" ng-model=\"vm.general.sentimentAccountId\" required>\n              <md-option ng-value=\"sentimentAccountId.id\" ng-repeat=\"sentimentAccountId in vm.cloudProviders\" ng-disabled=\"sentimentAccountId.canSelect === false\">{{ sentimentAccountId.name }}</md-option>\n            </md-select>\n            <div ng-messages=\"aiToolsForm['sentimentAccountId'].$error\" ng-show=\"aiToolsForm['sentimentAccountId'].$touched\" role=\"alert\">\n              <div ng-message=\"required\">\n                <span translate=\"SETTINGS.ERRORS.SENTIMENTACCOUNT_REQUIRED\">SentimentAccount field is required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n        </form>\n      </div>\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>"),e.put("app/main/apps/settings/views/license/license.html",'<div id="license" class="page-layout simple fullwidth doc-page">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.LICENSE">LICENSE</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    \x3c!-- <div>\n                <md-button type="submit" ng-click="vm.requestLicense()" class="send-button md-raised" translate="SETTINGS.REQUEST_LICENSE" translate-attr-aria-label="SETTINGS.REQUEST_LICENSE">\n                    REQUEST LICENSE\n                </md-button>\n            </div> --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      \x3c!-- LICENSE CARD --\x3e\n      <div layout="row" flex>\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="row" layout-align="center">\n            <div flex layout="row" layout-align="start center">\n              <div ng-if="!vm.license.custom">\n                <a href="https://www.xcally.com/plans.html" target="_blank" class="md-button md-fab green-A700-bg" aria-label="Eat cake">\n                  <md-tooltip><span translate="SETTINGS.PRICES">Prices</span></md-tooltip>\n                  <md-icon md-font-icon="icon-coin"></md-icon>\n                </a>\n              </div>\n            </div>\n            <div flex>\n              <div ng-switch="vm.license.months" class="text-center">\n                <span ng-switch-when="1" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.MONTH_TO_MONTH">MONTH TO MONTH</span></span>\n                <span ng-switch-when="12" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.ANNUALLY">ANNUALLY</span></span>\n                <span ng-switch-when="1200" class="md-title md-accent-fg text-bold">{{ \'SETTINGS.PLAN\' | translate }}: <span translate="SETTINGS.PERPETUAL">PERPETUAL</span></span>\n              </div>\n            </div>\n            <div flex layout="row" layout-align="end center">\n              <div>\n                <md-button type="submit" ng-click="vm.updateLicense()" class="md-button md-fab md-accent">\n                  <md-tooltip><span translate="SETTINGS.UPDATE_LICENSE">License</span></md-tooltip>\n                  <md-icon md-font-icon="icon-pencil"></md-icon>\n                </md-button>\n                <md-button type="submit" ng-if="vm.isAdmin" ng-click="vm.downloadLogFile()" class="md-button md-fab md-accent">\n                  <md-tooltip><span translate="SETTINGS.DOWNLOAD_LICENSE_LOG_FILE">Download license log file</span></md-tooltip>\n                  <md-icon md-font-icon="icon-download"></md-icon>\n                </md-button>\n              </div>\n            </div>\n          </div>\n\n          <span ng-if="!vm.license.demo && !vm.license.gray && vm.license.months != 36" class="md-subhead md-warn-fg text-center">{{ \'SETTINGS.EXPIRATION_DATE\' | translate }}: {{vm.license.expiration | date: \'longDate\'}}</span>\n          <span class="text-center padding-bottom-10"> {{ vm.license.machineUuid !== vm.license.uuid ? \'SETTINGS.OLD_TOKEN\' : \'SETTINGS.TOKEN\' | translate }}: <span ngclipboard data-clipboard-target="#licenseUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});" id="licenseUuid" class="hover-token text-italic text-bold">{{vm.license.uuid}}</span>\n            \x3c!--<md-button class="md-button md-fab md-accent" ngclipboard data-clipboard-target="#licenseUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n            <md-tooltip><span translate="SETTINGS.COPY_LICENSE">Copy</span></md-tooltip>\n            <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n          </md-button>--\x3e\n          </span>\n\n          <div layout="column">\n            <span ng-if="vm.license.grayReason == \'changed\'" class="blink md-subhead md-warn-fg text-center">{{ \'SETTINGS.NEW_TOKEN_DETECTED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.NEW_TOKEN\' | translate }}: <span id="licenseMachineUuid" ngclipboard data-clipboard-target="#licenseMachineUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});" class="hover-token text-italic text-bold">{{vm.license.machineUuid}}</span>\n              \x3c!--<md-button class="md-button md-fab md-accent" ngclipboard data-clipboard-target="#licenseMachineUuid" ngclipboard-success="vm.alert({title: \'clipboard\',  msg: \'Token copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                <md-tooltip><span translate="SETTINGS.COPY_LICENSE">Copy</span></md-tooltip>                \n                <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n              </md-button>--\x3e\n            </span>\n            <span ng-if="vm.license.gray" class="blink md-subhead md-warn-fg text-center">{{ \'SETTINGS.EXPIRATION_GRAY_PERIOD\' | translate }}: {{vm.license.deadline | date: \'longDate\'}}</span>\n            <span ng-if="vm.license.gray" class="text-center padding-bottom-10 text-italic text-bold"> {{\'SETTINGS.EXPIRATION_REASON\' | translate }} </span>\n            <span ng-if="vm.license.grayReason == \'disabled\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_REASON_MESSAGE_DISABLED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_REASON_MESSAGE_CHANGED\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10"> {{\'SETTINGS.EXPIRATION_CHANGED_ADVISE\' | translate }}</span>\n            <span ng-if="vm.license.grayReason == \'changed\'" class="text-center padding-bottom-10">{{ \'SETTINGS.SEND_EMAIL_TO\' | translate }}: <a href="mailto:license@xcally.com?subject=New%20token%20detected&body=Hi xCALLY, New Token: {{vm.license.machineUuid}}, Old token: {{vm.license.uuid}}">license@xcally.com</a>.</span>\n            <span ng-if="vm.license.grayReason == \'disabled\'" class="text-center padding-bottom-10">{{ \'SETTINGS.SEND_EMAIL_TO\' | translate }}: <a href="mailto:license@xcally.com?subject=License%20disabled&body=Hi xCALLY, My Token: {{vm.license.machineUuid}}">license@xcally.com</a>.</span>\n          </div>\n\n          <div ng-if="vm.license.demo" layout="column">\n            <span class="md-subhead md-warn-fg text-center">{{ \'SETTINGS.TRIAL_VERSION\' | translate }}</span>\n            <span class="md-subhead md-warn-fg text-center"><a href="https://www.xcally.com/en/index.html#pricing-table2-h" target="_blank">{{ \'SETTINGS.PRICES\' | translate}}</a></span>\n          </div>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.STAFF\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-account" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.users || 0 }} <span ng-class="{\'red-fg\': vm.license.users <= vm.users && vm.license.users > 0}">({{vm.license.users >= vm.users ? vm.users : vm.license.users}})</span></h3>\n                <p translate="SETTINGS.USERS">Users</p>\n              </div>\n            </md-list-item>\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-headphones" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.agents || 0 }} <span ng-class="{\'red-fg\': (vm.license.agents <= vm.agents && vm.license.agents > 0) }">({{vm.license.agents >= vm.agents ? vm.agents : vm.license.agents}})</span></h3>\n                <p translate="SETTINGS.AGENTS">Agents</p>\n              </div>\n            </md-list-item>\n            <md-list-item class="md-2-line" flex="33">\n              <md-icon md-font-icon="icon-phone" class="md-avatar-icon"></md-icon>\n              <div class="md-list-item-text">\n                <h3>{{ vm.license.telephones || 0 }} <span ng-class="{\'red-fg\': vm.license.telephones <= vm.telephones && vm.license.telephones > 0}">({{vm.license.telephones >= vm.telephones ? vm.telephones : vm.license.telephones}})</span></h3>\n                <p translate="SETTINGS.TELEPHONES">Telephones</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.CHANNELS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3:3">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item flex="33" class="md-2-line" ng-repeat="channel in vm.channels | limitTo:3:6">\n              <md-icon md-font-icon="{{channel.icon}}" class="md-avatar-icon" ng-class="vm.license[channel.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{channel.name | uppercase}}"></h3>\n                <p ng-class="vm.license[channel.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[channel.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.MODULES\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="module in vm.modules" flex="33">\n              <md-icon md-font-icon="{{module.icon}}" class="md-avatar-icon" ng-class="vm.license[module.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{module.name | uppercase}}"></h3>\n                <p ng-class="vm.license[module.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[module.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.SESSIONS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <div ng-repeat="session in vm.sessions" flex="33">\n              <md-list-item class="md-2-line">\n                <md-icon md-font-icon="{{session.icon}}" class="md-avatar-icon" ng-class="vm.license[session.enabled] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n                <div class="md-list-item-text">\n                  <div layout="row" layout="start center">\n                    <h3 translate="SETTINGS.{{session.name | uppercase}}"></h3>\n                    <button ng-if="session.restart" ng-click="vm.gotoProcess($event)" class="md-mini" aria-label="restart">\n                      <md-tooltip>Restart</md-tooltip>\n                      <md-icon md-font-icon="icon-reload"></md-icon>\n                    </button>\n                  </div>\n                  <p ng-if="vm.license[session.name] && vm.license[session.enabled]" class="green-A700-fg">{{vm.license[session.name]}} {{ \'SETTINGS.\' + session.label | uppercase | translate }}</p>\n                  <p ng-if="!vm.license[session.name] && vm.license[session.enabled]" class="green-A700-fg">UNLIMITED {{ \'SETTINGS.\' + session.label | uppercase | translate }}</p>\n                  <p ng-if="!vm.license[session.enabled]" class="red-A700-fg">{{ \'SETTINGS.DISABLED\' | translate }}</p>\n                </div>\n              </md-list-item>\n\n            </div>\n          </md-list>\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.ADDONS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="addon in vm.addons | limitTo:3" flex="33">\n              <md-icon md-font-icon="{{addon.icon}}" class="md-avatar-icon" ng-class="vm.license[addon.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{addon.name | uppercase}}"></h3>\n                <p ng-class="vm.license[addon.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[addon.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="addon in vm.addons | limitTo:3:3" flex="33">\n              <md-icon md-font-icon="{{addon.icon}}" class="md-avatar-icon" ng-class="vm.license[addon.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{addon.name | uppercase}}"></h3>\n                <p ng-class="vm.license[addon.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[addon.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n\n\n          <md-subheader class="md-no-sticky">{{ \'SETTINGS.OTHERS\' | translate }}</md-subheader>\n          <md-divider></md-divider>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="other in vm.others | limitTo:3" flex="33">\n              <md-icon md-font-icon="{{other.icon}}" class="md-avatar-icon" ng-class="vm.license[other.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{other.name | uppercase}}"></h3>\n                <p ng-class="vm.license[other.name] ? \'green-A700-fg\' : \'red-A700-fg\'">{{ \'SETTINGS.\' + (vm.license[other.name] ? \'ENABLED\' : \'DISABLED\') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n          <md-list layout="row">\n            <md-list-item class="md-2-line" ng-repeat="other in vm.others | limitTo:3:3" flex="33">\n              <md-icon md-font-icon="{{other.icon}}" class="md-avatar-icon" ng-class="vm.license[other.name] ? \'green-A700-bg\' : \'red-A700-bg\'"></md-icon>\n              <div class="md-list-item-text">\n                <h3 translate="SETTINGS.{{other.name | uppercase}}"></h3>\n'+"                <p ng-class=\"vm.license[other.name] ? 'green-A700-fg' : 'red-A700-fg'\">{{ 'SETTINGS.' + (vm.license[other.name] ? 'ENABLED' : 'DISABLED') | translate }}</p>\n              </div>\n            </md-list-item>\n          </md-list>\n        </md-card>\n      </div>\n      \x3c!-- / LICENSE CARD --\x3e\n\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>"),e.put("app/main/apps/settings/views/license/request/dialog.html",'<md-dialog class="request-dialog" aria-label="Send Request">\n  <form name="requestForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="SETTINGS.REQUEST_LICENSE">Request License</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.license.name" required>\n        <div ng-messages="requestForm.name.$error" ng-show="requestForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.NAME_REQUIRED">Address field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.license.email" required>\n        <div ng-messages="requestForm.email.$error" ng-show="requestForm.email.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="SETTINGS.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.PLAN">Plan</label>\n        <md-select name="plan" ng-model="vm.license.months" required>\n          <md-option ng-value="1"><span translate="SETTINGS.MONTH_TO_MONTH">MONTH TO MONTH</span></md-option>\n          <md-option ng-value="12"><span translate="SETTINGS.ANNUALLY">ANNUALLY</span></md-option>\n          <md-option ng-value="1200"><span translate="SETTINGS.PERPETUAL">PERPETUAL</span></md-option>\n        </md-select>\n        <div ng-messages="requestForm.plan.$error" ng-show="requestForm.plan.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PLAN_REQUIRED">Plan field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.STAFF\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.USERS">Users</label>\n          <input type="number" name="users" ng-model="vm.license.users" required>\n          <div ng-messages="requestForm.users.$error" ng-show="requestForm.users.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.USERS_REQUIRED">Users field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.AGENTS">Agents</label>\n          <input type="number" name="agents" ng-model="vm.license.agents" required>\n          <div ng-messages="requestForm.agents.$error" ng-show="requestForm.agents.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.AGENTS_REQUIRED">Agents field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container class="md-block" flex>\n          <label translate="SETTINGS.TELEPHONES">Telephones</label>\n          <input type="number" name="telephones" ng-model="vm.license.telephones" required>\n          <div ng-messages="requestForm.telephones.$error" ng-show="requestForm.telephones.$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.TELEPHONES_REQUIRED">Telephones field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.CHANNELS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[channel.name]" aria-label="{{channel.name}}" ng-repeat="channel in vm.channels | limitTo:3"><span translate="SETTINGS.{{channel.name | uppercase}}"></span></md-switch>\n        <md-switch ng-model="vm.license[channel.name]" aria-label="{{channel.name}}" ng-repeat="channel in vm.channels | limitTo:3:3"><span translate="SETTINGS.{{channel.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.MODULES\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[module.name]" aria-label="{{module.name}}" ng-repeat="module in vm.modules"><span translate="SETTINGS.{{module.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.SESSIONS\' | translate }}</md-subheader>\n      <div layout="row">\n        <md-input-container ng-repeat="session in vm.sessions" class="md-block" flex="50">\n          <label>{{ \'SETTINGS.\' + session.name | uppercase | translate }} ({{ \'SETTINGS.\' + session.label | uppercase | translate }})</label>\n          <input type="number" name="{{session.name}}" ng-model="vm.license[session.name]" required>\n          <div class="hint"><span>0={{ \'SETTINGS.UNLIMITED_CHANNELS\' | translate }}</span></div>\n          <div ng-messages="requestForm[session.name].$error" ng-show="requestForm[session.name].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="SETTINGS.ERRORS.CHANNEL_REQUIRED">Mandatory field</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.ADDONS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[addon.name]" aria-label="{{module.name}}" ng-repeat="addon in vm.addons"><span translate="SETTINGS.{{addon.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-subheader class="md-no-sticky">{{ \'SETTINGS.OTHERS\' | translate }}</md-subheader>\n      <div layout="row" layout-align="space-between center">\n        <md-switch ng-model="vm.license[other.name]" aria-label="{{other.name}}" ng-repeat="other in vm.others"><span translate="SETTINGS.{{other.name | uppercase}}"></span></md-switch>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.DESCRIPTION">Description</label>\n        <textarea name="description" ng-model="vm.license.description"></textarea>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.sendRequest()" class="send-button md-accent md-raised" ng-disabled="requestForm.$invalid || requestForm.$pristine" aria-label="SEND" translate="SETTINGS.SEND" translate-attr-aria-label="SETTINGS.SEND">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/license/update/dialog.html",'<md-dialog class="update-dialog" aria-label="Update License">\n  <form name="updateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title" translate="SETTINGS.UPDATE_LICENSE">Update License</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-content layout="row">\n        <span class="md-title" translate="SETTINGS.UPDATE_LICENSE_MANUALLY">Do you want to update your license manually?</span>\n      </md-content>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.ENTER_LICENSE">Enter your license</label>\n        <textarea name="key" ng-model="vm.licenseKey" required></textarea>\n        <div ng-messages="updateForm.name.$error" ng-show="updateForm.key.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.LICENSE_REQUIRED">License key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.updateLicense()" class="send-button md-accent md-raised" ng-disabled="updateForm.$invalid || updateForm.$pristine" aria-label="UPDATE" translate="SETTINGS.UPDATE" translate-attr-aria-label="SETTINGS.UPDATE">\n          UPDATE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/networks/create/dialog.html",'<md-dialog class="network-dialog" aria-label="New Network">\n  <form name="networkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SETTINGS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.network.type" autofocus required>\n          <md-option ng-value="\'localnet\'">LocalNET</md-option>\n          <md-option ng-value="\'externip\'">ExternIP</md-option>\n          <md-option ng-value="\'turn\'">Turn</md-option>\n          <md-option ng-value="\'stun\'">Stun</md-option>\n        </md-select>\n        <div ng-messages="networkForm[\'type\'].$error" ng-show="networkForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'localnet\'" class="md-block">\n        <label translate="SETTINGS.LOCALNETADDRESS">localNetAddress</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/" ng-required="true">\n\n        <div class="hint"><span translate="SETTINGS.HELP.LOCALNETADDRESS"></span></div>\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.LOCALNETADDRESS_REQUIRED">localNetAddress field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SETTINGS.ERRORS.LOCALNETADDRESS_MUST_VALID_PATTERN" translate-values="{ regex: \'/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])/(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/\' }">localNetAddress must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'externip\'" class="md-block">\n        <label translate="SETTINGS.ADDRESS">Address</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-pattern="/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/" ng-required="true">\n\n        <div class="hint"><span translate="SETTINGS.HELP.ADDRESS"></span></div>\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ADDRESS_REQUIRED">Address field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SETTINGS.ERRORS.ADDRESS_MUST_VALID_PATTERN" translate-values="{ regex: \'/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/\' }">Address must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\' || vm.network.type == \'stun\'" class="md-block">\n        <label translate="SETTINGS.ADDRESS">Address</label>\n        <input type="text" name="value" ng-model="vm.network.value" ng-required="true">\n\n        <div ng-messages="networkForm[\'value\'].$error" ng-show="networkForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.ADDRESS_REQUIRED">Address field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\'" class="md-block">\n        <label translate="SETTINGS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.network.username" ng-required="vm.network.type == \'turn\'">\n\n        <div class="hint"><span translate="SETTINGS.HELP.USERNAME"></span></div>\n        <div ng-messages="networkForm[\'username\'].$error" ng-show="networkForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.network.type == \'turn\'" class="md-block">\n        <label translate="SETTINGS.PASSWORD">Password</label>\n        <input type="text" name="password" ng-model="vm.network.password" ng-required="vm.network.type == \'turn\'">\n\n        <div class="hint"><span translate="SETTINGS.HELP.PASSWORD"></span></div>\n        <div ng-messages="networkForm[\'password\'].$error" ng-show="networkForm[\'password\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SETTINGS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newNetwork" ng-click="vm.saveNetwork()" class="send-button md-accent md-raised" ng-disabled="networkForm.$invalid || networkForm.$pristine" aria-label="SAVE" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newNetwork" ng-click="vm.addNewNetwork()" class="send-button md-accent md-raised" ng-disabled="networkForm.$invalid" aria-label="ADD" translate="SETTINGS.ADD_NETWORK" translate-attr-aria-label="SETTINGS.ADD_NETWORK">\n          ADD NETWORK\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-click="vm.deleteNetwork($event)" aria-label="DELETE" translate translate-attr-aria-label="SETTINGS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SETTINGS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/networks/networks.html",'<div id="networks" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.NETWORKS">Networks</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SETTINGS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedNetworks.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedNetworks =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SETTINGS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-networks-count">\n          <span>{{vm.selectedNetworks.length}}</span>\n          <span translate="SETTINGS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SETTINGS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllNetworks()" translate="SETTINGS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectNetworks()" translate="SETTINGS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedNetworks" csv-label="true" filename="networks.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-click="vm.deleteSelectedNetworks($event)" aria-label="delete selected" translate translate-attr-label="SETTINGS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- NETWORK TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedNetworks" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getNetworks">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SETTINGS.ID\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'SETTINGS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="value">{{ \'SETTINGS.ADDRESS\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'SETTINGS.CREATED_AT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.networks.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SETTINGS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="network" md-select-id="id" ng-repeat="network in vm.networks.rows">\n                <td md-cell ng-if="network.userpic"><img class="avatar" alt="{{network.name}}" ng-src="api/users/{{network.id}}/avatar" /></td>\n                <td md-cell ng-if="!network.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{network.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="id ">{{network.id}}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="type ">{{ vm.arraytype[network.type].option }}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="value ">{{network.value}}</td>\n                <td ng-click="vm.createOrEditNetwork($event, network)" md-cell class="createdAt ">{{network.createdAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SETTINGS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.editdialog(network, $event    )" translate="SETTINGS.EDIT_NETWORK">\n                          Edit Network\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.deleteconfirm(network, $event    )" translate="SETTINGS.DELETE_NETWORK">\n                          Delete Network\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SETTINGS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SETTINGS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SETTINGS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.networks.count}}" md-on-paginate="vm.getNetworks" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / NETWORK TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD NETWORK BUTTON --\x3e\n  <md-button class="md-fab md-accent" id="add-network-button" ng-click="vm.createOrEditNetwork($event)" aria-label="add network" translate translate-attr-aria-label="SETTINGS.ADD_NETWORK">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD NETWORK BUTTON --\x3e\n</div>'),e.put("app/main/apps/settings/views/smtps/smtps.html",'<div id="smtps" class="page-layout simple left-sidenav inner-sidenav">\n\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.SMTP">Smtp</span>\n      </div>\n    </div>\n\n    <div>\n      <md-button type="submit" ng-click="vm.verifySmtp()" ng-disabled="!vm.mailAccount.id" class="send-button md-accent md-raised" translate="SETTINGS.VERIFY" translate-attr-aria-label="SETTINGS.VERIFY">\n        VERIFY\n      </md-button>\n      <md-button type="submit" ng-click="vm.saveSmtp()" ng-disabled="(generalForm.$pristine) || (generalForm.$invalid)" class="send-button md-accent md-raised" translate="SETTINGS.SAVE" translate-attr-aria-label="SETTINGS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    <div class="main scrollable">\n      <div class="smtp-detail-form-container general md-background-bg md-whiteframe-1dp">\n        <div class="pb-16" layout="row" layout-align="start center">\n          <div class="h2 secondary-text" translate="SETTINGS.GENERAL">GENERAL</div>\n        </div>\n        <form name="generalForm" novalidate>\n\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.ACCOUNTNAME">Name</label>\n            <input type="text" name="name" ng-model="vm.mailAccount.name" ng-required="true" autofocus>\n            <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Name field required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block">\n            <label translate="SETTINGS.DESCRIPTION">Description</label>\n            <input type="" name="description" ng-model="vm.mailAccount.description">\n          </md-input-container>\n\n          <md-input-container class="md-block mt-0">\n            <label translate="SETTINGS.EMAILADDRESS">Email Address</label>\n            <input type="email" name="email" ng-model="vm.mailAccount.email" ng-required="true">\n            <div class="hint"><span translate="SETTINGS.HELP.EMAILADDRESS"></span></div>\n            <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Email Address field required</span>\n              </div>\n              <div ng-message="email">\n                <span translate="SETTINGS.ERRORS.WRONG_FORMAT">Email Address must be a valid e-mail address</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <md-input-container class="md-block mt-30">\n            <label translate="SETTINGS.SMTP_SERVICE">Service</label>\n            <md-select name="provider" ng-model="vm.mailAccount.provider" ng-change="vm.onProviderChange()" required>\n              <md-option ng-value="provider.value" ng-repeat="provider in vm.providers">{{ provider.name }}</md-option>\n            </md-select>\n            <div ng-messages="generalForm[\'provider\'].$error" ng-show="generalForm[\'provider\'].$touched" role="alert">\n              <div ng-message="required">\n                <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Service field required</span>\n              </div>\n            </div>\n          </md-input-container>\n\n          <div ng-if="vm.mailAccount.provider === \'custom\'">\n            <md-input-container class="md-block mt-30">\n              <label translate="SETTINGS.SMTP_HOST">Host</label>\n              <input type="text" name="host" ng-model="vm.mailAccount.Smtp.host" ng-required="true">\n              <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Host field required</span>\n                </div>\n              </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <label translate="SETTINGS.SMTP_PORT">Port</label>\n              <input type="number" name="port" ng-model="vm.mailAccount.Smtp.port" value="465" ng-required="true">\n              <div ng-messages="generalForm[\'port\'].$error" ng-show="generalForm[\'port\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Port field required</span>\n                </div>\n              </div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.secure" aria-label="SMTP Secure"><span translate="SETTINGS.SMTP_SECURE">Secure</span></md-switch>\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_SECURE"></span></div>\n            </md-input-container>\n            <md-input-container class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.authentication" aria-label="SMTP Authentication"><span translate="SETTINGS.SMTP_AUTHENTICATION">Authentication</span></md-switch>\n            </md-input-container>\n          </div>\n\n          <div ng-if="vm.mailAccount.Smtp.authentication || (vm.mailAccount.provider && vm.mailAccount.provider !== \'custom\')">\n            <md-input-container ng-if="vm.mailAccount.provider === \'outlook365\'" class="md-block">\n              <md-switch ng-model="vm.mailAccount.Smtp.modernAuthentication" aria-label="Modern Authentication" class="no-margin-bottom"><span translate="MAIL.MODERN_AUTHENTICATION">Modern Authentication</span></md-switch>\n            </md-input-container>\n\n            <md-input-container class="md-block">\n              <label translate="SETTINGS.SMTP_USERNAME">Username</label>\n              <input type="text" name="username" ng-model="vm.mailAccount.Smtp.user" ng-required="true">\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_USERNAME"></span></div>\n              <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Username field required</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container ng-if="vm.mailAccount.Smtp.modernAuthentication" class="md-block">\n              <label translate="MAIL.CLOUD_PROVIDER">Cloud Provider</label>\n              <md-select name="cloudProvider" ng-model="vm.mailAccount.Smtp.CloudProviderId" required>\n                <md-option ng-value="cloudProvider.id" ng-repeat="cloudProvider in vm.cloudProviders.rows">{{ cloudProvider.name }}</md-option>\n              </md-select>\n              <div class="hint"><span translate="MAIL.HELP.CLOUD_PROVIDER"></span></div>\n              <div ng-messages="generalForm[\'cloudProvider\'].$error" ng-show="generalForm[\'cloudProvider\'].$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="MAIL.ERRORS.FIELD_REQUIRED">Mandatory field</span>\n                </div>\n              </div>\n            </md-input-container>\n\n            <md-input-container ng-if="!vm.mailAccount.Smtp.modernAuthentication" class="md-block">\n              <label translate="SETTINGS.SMTP_PASSWORD">Password</label>\n              <input type="password" name="password" ng-model="vm.mailAccount.Smtp.pass" placeholder="Password" translate translate-attr-placeholder="SETTINGS.PASSWORD" required>\n              <div class="hint"><span translate="SETTINGS.HELP.SMTP_PASSWORD"></span></div>\n              <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                <div ng-message="required">\n                  <span translate="SETTINGS.ERRORS.FIELD_REQUIRED">Password field required</span>\n                </div>\n              </div>\n            </md-input-container>\n          </div>\n        </form>\n      </div>\n    </div>\n\n  </div>\n</div>'),e.put("app/main/apps/settings/views/system/system.html",'<div id="system" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.SYSTEM">SYSTEM</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" md-border-bottom flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SETTINGS.GENERAL">GENERAL</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="system-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget flex="50" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg">\n                    <div class="h3">OS</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{vm.system.system.manufacturer}} {{vm.system.system.model}}</div>\n                        <div class="h4">{{vm.system.cpu.manufacturer}} {{vm.system.cpu.brand}} - {{vm.system.cpu.speed}} GHz - {{vm.system.cpu.cores}} Cores</div>\n                        <div class="h4">{{vm.system.os.distro}} - {{vm.system.os.release}} - Kernel: {{vm.system.os.kernel}}</div>\n                        <div class="h4">Node.js: {{vm.system.node}}</div>\n                        <div class="h4">Host: {{vm.system.os.hostname}} - Uptime: {{vm.system.time.uptime / 60 | number:0}} m</div>\n                        <div class="h4">TimeZone: {{vm.system.time.timezone}} ({{vm.system.time.timezoneName}})</div>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n              <ms-widget flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-1">\n                    <div class="h3">CPU</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.AVG_LOAD">AVG Load</span>\n                          <span class="h3 secondary-text font-weight-500">{{vm.system.currentLoad.avgload * 100 | number:0}}%</span>\n                        </div>\n                        <md-progress-linear class="red" md-mode="determinate" value="{{vm.system.currentLoad.avgload * 100 | number:0}}"></md-progress-linear>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n              <ms-widget flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">MEM</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.TOTAL\' | translate}}: {{vm.system.mem.total / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.FREE\' | translate}}: {{vm.system.mem.available / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.USED\' | translate}}: {{vm.system.mem.active / 1024 / 1024 / 1024 | number:0}} GB</div>\n                      </div>\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.USED">Used</span>\n                          <span class="h3 secondary-text font-weight-500">{{(vm.system.mem.active / vm.system.mem.total) * 100 | number : 0}}%</span>\n                        </div>\n                        <md-progress-linear class="md-warn" md-mode="determinate" value="{{(vm.system.mem.active / vm.system.mem.total) * 100 | number : 0 }}"></md-progress-linear>\n\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget ng-repeat="disk in vm.system.fsSize" flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">DISK {{$index + 1}}</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.FILE_SYSTEM\' | translate}}: {{disk.fs}}</div>\n                        <div class="h4">{{\'SETTINGS.MOUNT_POINT\' | translate}}: "{{disk.mount}}"</div>\n                        <div class="h4">{{\'SETTINGS.TOTAL\' | translate}}: {{disk.size / 1024 / 1024 / 1024 | number:0}} GB</div>\n                        <div class="h4">{{\'SETTINGS.USED\' | translate}}: {{disk.used / 1024 / 1024 / 1024 | number:0}} GB</div>\n                      </div>\n                      <div class="p-16 pb-32">\n                        <div class="pb-8" layout="row" layout-align="space-between start">\n                          <span class="h3" translate="SETTINGS.USED">Used</span>\n                          <span class="h4 secondary-text font-weight-500">{{disk.use | number:0}}%</span>\n                        </div>\n                        <md-progress-linear class="red" md-mode="determinate" value="{{disk.use | number:0}}"></md-progress-linear>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row" layout-xs="column" layout-wrap>\n              <ms-widget ng-repeat="net in vm.system.net" flex="25" flex-xs="100">\n                \x3c!-- Front --\x3e\n                <ms-widget-front class="white-bg">\n                  <div class="ph-16 pt-16 pb-8 md-accent-bg md-hue-3">\n                    <div class="h3">NET {{$index + 1}}</div>\n                  </div>\n\n                  <div layout="row" layout-align="start center" layout-wrap>\n                    <div flex="100" flex-gt-md="100">\n                      <div class="p-16 pb-32">\n                        <div class="h4">{{\'SETTINGS.INTERFACE\' | translate}}: {{net.iface}}</div>\n                        <div class="h4">IPv4: {{net.ip4}}</div>\n                        <div class="h4">IPv6: {{net.ip6}}</div>\n                        <div class="h4">MAC: {{net.mac}}</div>\n                      </div>\n                    </div>\n                  </div>\n                </ms-widget-front>\n                \x3c!-- / Front --\x3e\n              </ms-widget>\n            </md-card>\n\n            <md-card class="md-whiteframe-1dp padding-20" layout="row">\n              <div flex>\n                <md-toolbar class="md-table-toolbar md-default">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="SETTINGS.TOP_N_PROCESSES" translate-values="{value: vm.processLimit}"></span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm.searchTerm1 = query" on-collapse="vm.searchTerm1 = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table>\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column>pid</th>\n                        <th md-column>{{\'SETTINGS.NAME\' | translate}}</th>\n                        <th md-column>{{\'SETTINGS.STATE\' | translate}}</th>\n                        <th md-column>pmem</th>\n                        <th md-column>pcpu</th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-repeat="process in vm.system.processes.list | limitTo: vm.processLimit | filter: vm.searchTerm1 | orderBy:\'-pcpu\'">\n                        <td md-cell>{{process.pid}}</td>\n                        <td md-cell>{{process.command}}</td>\n                        <td md-cell>\n                          <span class="text-boxed white-fg" ng-class="{\n                          \'green-600-bg\': process.state == \'running\',\n                          \'yellow-600-bg\': process.state == \'sleeping\',\n                          \'red-600-bg\': process.state == \'blocked\'}">{{process.state | uppercase}}</span>\n                        </td>\n                        <td md-cell>{{process.pmem}}%</td>\n                        <td md-cell>{{process.pcpu}}%</td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n              </div>\n            </md-card>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SETTINGS.PROCESSES">PROCESSES</span>\n        </md-tab-label>\n\n        <md-tab-body>\n          <div class="system-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <md-card class="md-whiteframe-1dp padding-20" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SETTINGS.MOTION_PROCESS_MANAGEMENT"></span>\n                  <div flex></div>\n                  <ms-search-bar on-search="vm.searchTerm2 = query" on-collapse="vm.searchTerm2 = undefined" debounce="300"></ms-search-bar>\n                  <md-button ng-click="vm.getProcesses()" class="md-icon-button" aria-label="Reload">\n                    <md-icon md-font-icon="icon-reload" class="s24"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table>\n                  <thead md-head>\n                    <tr md-row>\n                      <th md-column>id</th>\n                      <th md-column>pid</th>\n                      <th md-column>{{\'SETTINGS.NAME\' | translate}}</th>\n                      <th md-column>{{\'SETTINGS.STATE\' | translate}}</th>\n                      <th md-column>MEM</th>\n                      <th md-column>CPU</th>\n                      <th md-column width="20px">Actions</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row ng-repeat="process in vm.processes | filter: vm.searchTerm2 | orderBy:\'-monit.cpu\'">\n                      <td md-cell>{{process.pm_id}}</td>\n                      <td md-cell>{{process.pid}}</td>\n                      <td md-cell>{{process.name == \'agi\' ? \'agi (Cally Square IVR)\' : process.name}}</td>\n                      <td md-cell>\n                        <span class="text-boxed white-fg" ng-class="{\'green-600-bg\': process.pm2_env.status == \'online\', \'red-600-bg\': process.pm2_env.status == \'stopped\'}">{{process.pm2_env.status | uppercase}}</span>\n                      </td>\n                      <td md-cell>{{process.monit.memory / 1024 / 1024 | number:0}} MB</td>\n                      <td md-cell>{{process.monit.cpu}}%</td>\n                      <td md-cell>\n                        <md-button ng-if="process.pm2_env.status !== \'online\'" ng-click="vm.updateProcess($event, process.pm_id, \'online\')" class="md-icon-button" aria-label="Play">\n                          <md-icon md-font-icon="icon-play" class="s24"></md-icon>\n                        </md-button>\n                        <md-button ng-if="process.pm2_env.status === \'online\'" ng-click="vm.updateProcess($event, process.pm_id, \'stopped\')" class="md-icon-button" aria-label="Stop">\n                          <md-icon md-font-icon="icon-stop" class="s24"></md-icon>\n                        </md-button>\n                      </td>\n                    </tr>\n                  </tbody>\n                  <tfoot md-foot>\n                    <tr md-row>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                      <td md-cell>{{ (vm.processes | map: \'monit.memory\' | sum) / 1024 / 1024 | number:0 }} MB</td>\n                      <td md-cell></td>\n                      <td md-cell></td>\n                    </tr>\n                  </tfoot>\n                </table>\n              </md-table-container>\n            </md-card>\n            <md-card class="md-whiteframe-1dp padding-20" flex>\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SETTINGS.USEFUL_COMMANDS"></span>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-table-container>\n                <table md-table>\n                  <thead md-head>\n                    <tr md-row>\n                      <th md-column width="30%">{{\'SETTINGS.COMMAND\' | translate}}</th>\n                      <th md-column>{{\'SETTINGS.DESCRIPTION\' | translate}}</th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr>\n                      <td md-cell class="no-border">pm2 list</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_LIST\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 start &lt;id | name&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_START\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 stop &lt;id | name | all&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_STOP\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 restart &lt;id | name&gt;</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_RESTART\' | translate}}</td>\n                    </tr>\n                    <tr>\n                      <td md-cell class="no-border">pm2 logs [id | name]</td>\n                      <td md-cell class="no-border">{{ \'SETTINGS.PM2_LOGS\' | translate}}</td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </md-card>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/settings/views/updates/update/dialog.html",'<md-dialog aria-label="Update">\n  <form name="updateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n      </div>\n    </md-toolbar>\n\n    <div md-background-bg layout="row" layout-align="start start">\n      <md-progress-linear md-mode="determinate" value="{{vm.progress}}" class="md-warn"></md-progress-linear>\n    </div>\n\n    <md-dialog-content>\n      <div layout="row" layout-align="center center">\n        <div ng-if="vm.updating" layout="column" layout-align="center center">\n          <span class="text-center md-title">Grab a quick coffee and</span>\n          <span class="text-center md-title">get back here as soon as completed!</span>\n          <span class="text-center md-title">{{vm.output}}</span>\n        </div>\n        <div ng-if="!vm.updating">\n          <div ng-if="vm.success" layout="column" layout-align="center center">\n            <span class="text-center md-title">Update Completed! Thank you for your time.</span>\n            <span class="text-center md-title">In order to complete the update,</span>\n            <span class="text-center md-title">please click on reload button</span>\n          </div>\n          <div ng-if="!vm.success" layout="column" layout-align="center center">\n            <span class="text-center md-title">Update Error!</span>\n            <span class="text-center md-title">Please contact your administrator!</span>\n            <span class="text-center md-title">{{vm.output}}</span>\n          </div>\n        </div>\n        <img src="assets/images/business/users.jpg" alt="" width="128" height="128" />\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions ng-if="!vm.updating" layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.reload()" class="send-button md-warm md-raised" aria-label="RELOAD" translate="SETTINGS.RELOAD" translate-attr-aria-label="SETTINGS.RELOAD">\n          RELOAD\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/settings/views/updates/updates.html",'<div id="updates" class="page-layout simple fullwidth doc-page">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-cog" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SETTINGS.UPDATES">UPDATES</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n      \x3c!-- UPDATE CARD --\x3e\n      <div layout="row" ng-if="!vm.updating">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="SETTINGS.CURRENT_VERSION">CURRENT VERSION</span>\n\n            <span class="md-display-3 padding-20">{{vm.version.current}}</span>\n\n            <md-button href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.version.current}}" target="_blank" class="md-accent" title="CHANGELOG" aria-label="CHANGELOG" translate="SETTINGS.CHANGELOG" translate-attr-aria-label="SETTINGS.CHANGELOG">\n              CHANGELOG\n            </md-button>\n          </div>\n        </md-card>\n        <md-card class="md-whiteframe-20dp padding-20" flex ng-if="vm.version.current != vm.version.latest">\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-warn-fg padding-20 text-bold" translate="SETTINGS.NEW_VERSION">NEW VERSION</span>\n\n            <span class="md-display-3 padding-20">{{vm.version.latest}}</span>\n\n            <md-button href="https://wiki.xcallymotion.com/display/XMV/Motion+GUI#MotionGUI-Version{{vm.version.latest}}" target="_blank" class="md-accent" title="CHANGELOG" aria-label="CHANGELOG" translate="SETTINGS.CHANGELOG" translate-attr-aria-label="SETTINGS.CHANGELOG">\n              CHANGELOG\n            </md-button>\n            <md-button ng-click="vm.updateConfirm($event)" class="md-raised md-warn" aria-label="CHANGELOG" translate="SETTINGS.UPDATE" translate-attr-aria-label="SETTINGS.UPDATE">UPDATE</md-button>\n          </div>\n        </md-card>\n        <md-card class="md-whiteframe-1dp padding-20" flex ng-if="vm.version.current == vm.version.latest">\n          <div layout="column" layout-align="center center">\n\n            <span class="md-title md-warn-fg padding-20 text-bold" translate="SETTINGS.REMOTE_VERSION">REMOTE VERSION</span>\n\n            <span class="md-subhead padding-20" translate="SETTINGS.NO_NEW_VERSION_AVAILABLE">NO NEW VERSION AVAILABLE</span>\n          </div>\n        </md-card>\n      </div>\n      \x3c!-- / UPDATE CARD --\x3e\n\n      <div ng-if="vm.updating">\n        <md-card class="md-whiteframe-1dp padding-20" flex>\n          <div layout="column" layout-align="center center">\n            <span class="md-title md-accent-fg padding-20 text-bold" translate="SETTINGS.UPDATING">...</span>\n            <md-progress-linear md-mode="determinate" class="md-accent padding-20" value="{{vm.progress}}"></md-progress-linear>\n            <span class="md-display-1 padding-5 text-center">Grab a quick coffee and</span>\n            <span class="md-display-1 padding-5 text-center">get back here as soon as completed</span>\n            <img src="assets/images/business/users.jpg" alt="" width="40%" height="40%" />\n          </div>\n        </md-card>\n      </div>\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/sms/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/sms/views/smsAccounts/create/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.smsAccount.name" ng-required="true" autofocus ng-disabled="!vm.newSmsAccount">\n\n        <div ng-messages="smsAccountForm[\'name\'].$error" ng-show="smsAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.smsAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'key\'].$error" ng-show="smsAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.smsAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="SMS.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="smsAccountForm[\'remote\'].$error" ng-show="smsAccountForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="SMS.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.smsAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="SMS.HELP.LIST"></span></div>\n        <div ng-messages="smsAccountForm[\'ListId\'].$error" ng-show="smsAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.smsAccount.type" required>\n          <md-option ng-value="\'twilio\'">Twilio</md-option>\n          <md-option ng-value="\'skebby\'">Skebby</md-option>\n          <md-option ng-value="\'connectel\'">Connectel</md-option>\n          <md-option ng-value="\'clicksend\'">ClickSend</md-option>\n          <md-option ng-value="\'plivo\'">Plivo</md-option>\n          <md-option ng-value="\'infobip\'">Infobip</md-option>\n          <md-option ng-value="\'clickatell\'">Clickatell</md-option>\n          <md-option ng-value="\'bandwidth\'">Bandwidth</md-option>\n          <md-option ng-value="\'csc\'">CSCTelecom</md-option>\n          <md-option ng-value="\'intelepeer\'">Intelepeer</md-option>\n        </md-select>\n        <div ng-messages="smsAccountForm[\'type\'].$error" ng-show="smsAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.PHONE">Phone</label>\n        <input type="text" name="phone" ng-model="vm.smsAccount.phone" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'phone\'].$error" ng-show="smsAccountForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'twilio\'" class="md-block">\n        <label translate="SMS.ACCOUNTSID">AccountSID</label>\n        <input type="text" name="accountSid" ng-model="vm.smsAccount.accountSid" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'accountSid\'].$error" ng-show="smsAccountForm[\'accountSid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'plivo\'" class="md-block">\n        <label translate="SMS.AUTHID">AuthID</label>\n        <input type="text" name="authId" ng-model="vm.smsAccount.authId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'authId\'].$error" ng-show="smsAccountForm[\'authId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AUTHID_REQUIRED">AuthID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'twilio\' || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'plivo\'" class="md-block">\n        <label translate="SMS.AUTHTOKEN">AuthToken</label>\n        <input type="text" name="authToken" ng-model="vm.smsAccount.authToken" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'authToken\'].$error" ng-show="smsAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'skebby\'" class="md-block">\n        <label translate="SMS.METHOD">Method</label>\n        <md-select name="smsMethod" ng-model="vm.smsAccount.smsMethod" required>\n          <md-option ng-value="\'SI\'">Basic</md-option>\n          <md-option ng-value="\'TI\'">Classic</md-option>\n          <md-option ng-value="\'GP\'">Classic+</md-option>\n        </md-select>\n        <div ng-messages="smsAccountForm[\'smsMethod\'].$error" ng-show="smsAccountForm[\'smsMethod\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.METHOD_REQUIRED">Method field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.USERNAME">Username</label>\n        <input type="text" name="username" ng-model="vm.smsAccount.username" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'username\'].$error" ng-show="smsAccountForm[\'username\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'">\n        <label translate="SMS.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.smsAccount.password" placeholder="Password" translate translate-attr-placeholder="SMS.PASSWORD" required>\n        <div ng-messages="smsAccountForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SMS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'csc\'" class="md-block">\n        <label translate="SMS.BASEURL">BaseURL</label>\n        <input type="text" name="baseUrl" ng-model="vm.smsAccount.baseUrl" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'baseUrl\'].$error" ng-show="smsAccountForm[\'baseUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.BASEURL_REQUIRED">BaseURL field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n        <label translate="SMS.APIKEY">ApiKey</label>\n        <input type="text" name="apiKey" ng-model="vm.smsAccount.apiKey" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'apiKey\'].$error" ng-show="smsAccountForm[\'apiKey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.ACCOUNTID">AccountId</label>\n        <input type="text" name="accountId" ng-model="vm.smsAccount.accountId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'accountId\'].$error" ng-show="smsAccountForm[\'accountId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCOUNTID_REQUIRED">AccountId field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n        <label translate="SMS.APPLICATIONID">ApplicationID</label>\n        <input type="text" name="applicationId" ng-model="vm.smsAccount.applicationId" ng-required="true">\n\n        <div ng-messages="smsAccountForm[\'applicationId\'].$error" ng-show="smsAccountForm[\'applicationId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.APPLICATIONID_REQUIRED">ApplicationID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsAccount.description">\n\n        <div ng-messages="smsAccountForm[\'description\'].$error" ng-show="smsAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsAccount" ng-click="vm.saveSmsAccount()" class="send-button md-accent md-raised" ng-disabled="smsAccountForm.$invalid || smsAccountForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsAccount" ng-click="vm.addNewSmsAccount()" class="send-button md-accent md-raised" ng-disabled="smsAccountForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSACCOUNT" translate-attr-aria-label="SMS.ADD_SMSACCOUNT">\n          ADD SMSACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsAccount" ng-click="vm.deleteSmsAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/agentadd/agentadd.html",'<md-dialog class="smsAccount-dialog" aria-label="smsAccount" ng-init="vm.onInit()">\n  <form name="smsAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.AGENTADD_SMSACCOUNT">Add Agent to smsAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/agent/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'agent\'].$error" ng-show="smsAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'timeout\'].$error" ng-show="smsAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'accesskeyid\'].$error" ng-show="smsAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'secretaccesskey\'].$error" ng-show="smsAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'lexregion\'].$error" ng-show="smsAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'botname\'].$error" ng-show="smsAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'times\'].$error" ng-show="smsAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="smsAccountFormApp[\'text\'].$error" ng-show="smsAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/close/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'disposition\'].$error" ng-show="smsAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'key\'].$error" ng-show="smsAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'language\'].$error" ng-show="smsAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'projectId\'].$error" ng-show="smsAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'clientEmail\'].$error" ng-show="smsAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="smsAccountFormApp[\'privateKey\'].$error" ng-show="smsAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'language\'].$error" ng-show="smsAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="SMS.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="smsAccountFormApp[\'welcomemessage\'].$error" ng-show="smsAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="SMS.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'condition\'].$error" ng-show="smsAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'truepriority\'].$error" ng-show="smsAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'falsepriority\'].$error" ng-show="smsAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'priority\'].$error" ng-show="smsAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/noop/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'value\'].$error" ng-show="smsAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/queue/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'queue\'].$error" ng-show="smsAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'timeout\'].$error" ng-show="smsAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/system/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="smsAccountFormApp[\'command\'].$error" ng-show="smsAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'variable\'].$error" ng-show="smsAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/apps/tag/dialog.html",'<md-dialog class="smsAccount-dialog" aria-label="New SmsAccount">\n  <form name="smsAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="smsAccountFormApp[\'tag\'].$error" ng-show="smsAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveSmsAccountApp()" class="send-button md-accent md-raised" ng-disabled="smsAccountFormApp.$invalid || smsAccountFormApp.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/smsCannedAnswers/dialog.html",'<md-dialog class="smsCannedAnswer-dialog" aria-label="New SmsCannedAnswer">\n  <form name="smsCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.smsCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="smsCannedAnswerForm[\'key\'].$error" ng-show="smsCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.smsCannedAnswer.value" required></textarea>\n\n        <div ng-messages="smsCannedAnswerForm[\'value\'].$error" ng-show="smsCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsCannedAnswer.description">\n\n        <div ng-messages="smsCannedAnswerForm[\'description\'].$error" ng-show="smsCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsCannedAnswer" ng-click="vm.saveSmsCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="smsCannedAnswerForm.$invalid || smsCannedAnswerForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsCannedAnswer" ng-click="vm.addNewSmsCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="smsCannedAnswerForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSCANNEDANSWER" translate-attr-aria-label="SMS.ADD_SMSCANNEDANSWER">\n          ADD SMSCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsCannedAnswer" ng-click="vm.deleteSmsCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsAccounts/edit/view.html",'<div id="sms-smsAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-smsAccounts-button md-icon-button" aria-label="Go to smsAccounts" ng-click="vm.gotoSmsAccounts()" translate translate-attr-aria-label="SMS.GO_TO_SMSACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="smsAccount-image" hide-xs>\n          <img ng-src="assets/images/business/smsAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.smsAccount.id}}\n            <span ng-if="vm.smsAccount.name">{{vm.smsAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="SMS.CREATED_AT"></span> <span>{{vm.smsAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.smsAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="SMS.AGENTADD_SMSACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSmsAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (smsDispositionsForm.$invalid) || (smsCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.smsAccount.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.smsAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.smsAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="SMS.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.smsAccount.type" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'twilio\'">Twilio</md-option>\n                  <md-option ng-value="\'skebby\'">Skebby</md-option>\n                  <md-option ng-value="\'connectel\'">Connectel</md-option>\n                  <md-option ng-value="\'clicksend\'">ClickSend</md-option>\n                  <md-option ng-value="\'plivo\'">Plivo</md-option>\n                  <md-option ng-value="\'infobip\'">Infobip</md-option>\n                  <md-option ng-value="\'clickatell\'">Clickatell</md-option>\n                  <md-option ng-value="\'bandwidth\'">Bandwidth</md-option>\n                  <md-option ng-value="\'csc\'">CSCTelecom</md-option>\n                  <md-option ng-value="\'intelepeer\'">Intelepeer</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.smsAccount.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'twilio\'" class="md-block">\n                <label translate="SMS.ACCOUNTSID">AccountSID</label>\n                <input type="text" name="accountSid" ng-model="vm.smsAccount.accountSid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accountSid\'].$error" ng-show="generalForm[\'accountSid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'plivo\'" class="md-block">\n                <label translate="SMS.AUTHID">AuthID</label>\n                <input type="text" name="authId" ng-model="vm.smsAccount.authId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authId\'].$error" ng-show="generalForm[\'authId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AUTHID_REQUIRED">AuthID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'twilio\' || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'plivo\'" class="md-block">\n                <label translate="SMS.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.smsAccount.authToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authToken\'].$error" ng-show="generalForm[\'authToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'skebby\'" class="md-block">\n                <label translate="SMS.METHOD">Method</label>\n                <md-select name="smsMethod" ng-model="vm.smsAccount.smsMethod" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'SI\'">Basic</md-option>\n                  <md-option ng-value="\'TI\'">Classic</md-option>\n                  <md-option ng-value="\'GP\'">Classic+</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'smsMethod\'].$error" ng-show="generalForm[\'smsMethod\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.METHOD_REQUIRED">Method field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.USERNAME">Username</label>\n                <input type="text" name="username" ng-model="vm.smsAccount.username" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'username\'].$error" ng-show="generalForm[\'username\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block" ng-if="vm.smsAccount.type == \'skebby\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'bandwidth\'">\n                <label translate="SMS.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.smsAccount.password" placeholder="Password" translate translate-attr-placeholder="SMS.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'csc\'" class="md-block">\n                <label translate="SMS.BASEURL">BaseURL</label>\n                <input type="text" name="baseUrl" ng-model="vm.smsAccount.baseUrl" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'baseUrl\'].$error" ng-show="generalForm[\'baseUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.BASEURL_REQUIRED">BaseURL field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n                <label translate="SMS.APIKEY">ApiKey</label>\n                <input type="text" name="apiKey" ng-model="vm.smsAccount.apiKey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'apiKey\'].$error" ng-show="generalForm[\'apiKey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.APIKEY_REQUIRED">ApiKey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.ACCOUNTID">AccountId</label>\n                <input type="text" name="accountId" ng-model="vm.smsAccount.accountId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'accountId\'].$error" ng-show="generalForm[\'accountId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.ACCOUNTID_REQUIRED">AccountId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.APPLICATIONID">ApplicationID</label>\n                <input type="text" name="applicationId" ng-model="vm.smsAccount.applicationId" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'applicationId\'].$error" ng-show="generalForm[\'applicationId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.APPLICATIONID_REQUIRED">ApplicationID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'plivo\'|| vm.smsAccount.type == \'csc\'|| vm.smsAccount.type == \'infobip\' || vm.smsAccount.type == \'intelepeer\'" class="md-block">\n                <label translate="SMS.SENDERSTRING">SenderString</label>\n                <input type="text" name="senderString" ng-model="vm.smsAccount.senderString" md-maxlength="11" ng-pattern="/^[A-Za-z0-9\\.\\s]*$/i" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'senderString\'].$error" ng-show="generalForm[\'senderString\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.SENDERSTRING_REQUIRED">SenderString field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.SENDERSTRING_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\s]*$/i\' }">SenderString must be valid pattern </span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.SENDERSTRING_MAX_LENGTH" translate-values=\'{max: 11}\'>SenderString must have a maximum length equal to 11</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="(vm.smsAccount.type == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\'" class="md-block">\n                <md-switch ng-model="vm.smsAccount.deliveryReport" aria-label="deliveryReport" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.DELIVERYREPORT">deliveryReport</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.smsAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.smsAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.smsAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.RECEIVEURL">receiveUrl</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUrl" name="receiveUrl" ng-value="vm.smsAccount.remote + \'/api/sms/accounts/\' + vm.smsAccount.id + \'/notify?token=\' + vm.smsAccount.token" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="SMS.HELP.RECEIVEURL"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="( ((vm.smsAccount.type == \'skebby\' && vm.smsAccount.smsMethod == \'GP\') || vm.smsAccount.type == \'connectel\' || vm.smsAccount.type == \'clicksend\' || vm.smsAccount.type == \'csc\' || vm.smsAccount.type == \'clickatell\') && vm.smsAccount.deliveryReport) || vm.smsAccount.type == \'bandwidth\'" class="md-block">\n                <label translate="SMS.DELIVERYREPORTURL">deliveryReportUrl</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-deliveryReportUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-deliveryReportUrl" name="deliveryReportUrl" ng-value="vm.smsAccount.remote + \'/api/sms/accounts/\' + vm.smsAccount.id + \'/status?token=\' + vm.smsAccount.token + (vm.smsAccount.type == \'csc\' ? \'&message-id={message-id}&state={state}\' : \'\')" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="SMS.HELP.DELIVERYREPORTURL"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="SMS.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.smsAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.queueTransfer == true" class="md-block">\n                <label translate="SMS.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.smsAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.agentTransfer == true" class="md-block">\n                <label translate="SMS.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.smsAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.smsAccount.token" autofocus disabled>\n\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.MOTIONPROXY">MotionProxy</label>\n                <input type="url" name="remote" ng-model="vm.smsAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="SMS.HELP.MOTIONPROXY"></span></div>\n                <div ng-messages="proxyForm[\'remote\'].$error" ng-show="proxyForm[\'remote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="SMS.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="smsAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.smsAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="SMS.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.smsAccount.mandatoryDisposition" class="md-block">\n                <label translate="SMS.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.smsAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="SMS.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="SmsAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="smsAccount-detail-form-container smsdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="SMS.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add sms dispositions" translate translate-attr-label="SMS.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="smsAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container smscannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountSmsCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountSmsCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SMS.SMSCANNEDANSWERS">SmsCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getSmsAccountSmsCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event)" aria-label="add smsCannedAnswer" translate translate-attr-label="SMS.ADD_SMSCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedSmsAccountSmsCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedSmsAccountSmsCannedAnswers.length}} {{vm_dc.selectedSmsAccountSmsCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountSmsCannedAnswers" csv-label="true" filename="smsAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedSmsAccountSmsCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedSmsAccountSmsCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountSmsCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'SMS.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'SMS.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'SMS.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'SMS.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'SMS.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="smsCannedAnswer" md-select-id="id" ng-repeat="smsCannedAnswer in vm_dc.smsAccountSmsCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{smsCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" md-cell>\n                        {{ smsCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditSmsAccountSmsCannedAnswer($event, smsCannedAnswer)" translate="SMS.EDIT_SMSCANNEDANSWER">\n                                Edit SmsCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(smsCannedAnswer, $event)" translate="SMS.DELETE_SMSCANNEDANSWER">\n                                Delete SmsCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.smsAccountSmsCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="SMS.NO_SMSCANNEDANSWER_AVAILABLE">No smscannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.smsAccountSmsCannedAnswers.count}}" md-on-paginate="vm_dc.getSmsAccountSmsCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.smsAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="SMS.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedSmsAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedSmsAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedSmsAccountApps.length}} {{vm_ac.selectedSmsAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedSmsAccountApps($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedSmsAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.smsAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editSmsAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editSmsAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.smsAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="SmsAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.smsAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedSmsAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="SMS.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getSmsAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getSmsAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getSmsAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="SMS.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedSmsAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedSmsAccountInteractions.length}} {{vm_dc.selectedSmsAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedSmsAccountInteractions" csv-label="true" filename="smsAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedSmsAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedSmsAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getSmsAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'SMS.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'SMS.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'SMS.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'SMS.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'SMS.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'SMS.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'SMS.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.smsAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'SMS.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'SMS.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spysmsInteraction($event, interaction)" translate="SMS.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.smsInteractionDownload(interaction, $event)" translate="SMS.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="SMS.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.smsAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="SMS.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.smsAccountInteractions.count}}" md-on-paginate="vm_dc.getSmsAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/sms/views/smsAccounts/smsAccounts.html",'<div id="smsAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-message-text" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SMS.SMSACCOUNTS">SmsAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SMS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSmsAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSmsAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SMS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-smsAccounts-count">\n          <span>{{vm.selectedSmsAccounts.length}}</span>\n          <span translate="SMS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SMS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSmsAccounts()" translate="SMS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSmsAccounts()" translate="SMS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSmsAccounts" csv-label="true" filename="smsAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSmsAccounts($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SMSACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSmsAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'SMS.KEY\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'SMS.LIST\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'SMS.TYPE\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'SMS.PHONE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'SMS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.smsAccounts.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="smsAccount" md-select-id="id" ng-repeat="smsAccount in vm.smsAccounts.rows">\n                <td md-cell ng-if="smsAccount.userpic"><img class="avatar" alt="{{smsAccount.name}}" ng-src="api/users/{{smsAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!smsAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{smsAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="id ">{{smsAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="name ">{{smsAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="key ">{{smsAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':smsAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="type ">{{ vm.arraytype[smsAccount.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="phone ">{{smsAccount.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsAccount, ev) : vm.createOrEditSmsAccount($event, smsAccount)" md-cell class="description ">{{smsAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(smsAccount, $event    )" translate="SMS.EDIT_SMSACCOUNT">\n                          Edit SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(smsAccount, $event    )" translate="SMS.INTERACTIONS_SMSACCOUNT">\n                          Interactions SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(smsAccount, $event    )" translate="SMS.AGENTADD_SMSACCOUNT">\n                          AgentAdd SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(smsAccount, $event    )" translate="SMS.DELETE_SMSACCOUNT">\n                          Delete SmsAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsAccounts.count}}" md-on-paginate="vm.getSmsAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SMSACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SMSACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-smsAccount-button" ng-click="vm.createOrEditSmsAccount($event)" aria-label="add smsAccount" translate translate-attr-aria-label="SMS.ADD_SMSACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SMSACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/sms/views/smsQueues/create/dialog.html",'<md-dialog class="smsQueue-dialog" aria-label="New SmsQueue">\n  <form name="smsQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="SMS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.smsQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newSmsQueue">\n\n        <div class="hint"><span translate="SMS.HELP.NAME"></span></div>\n        <div ng-messages="smsQueueForm[\'name\'].$error" ng-show="smsQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="SMS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.smsQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="smsQueueForm[\'strategy\'].$error" ng-show="smsQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.smsQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="smsQueueForm[\'timeout\'].$error" ng-show="smsQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="SMS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.smsQueue.description">\n\n        <div ng-messages="smsQueueForm[\'description\'].$error" ng-show="smsQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSmsQueue" ng-click="vm.saveSmsQueue()" class="send-button md-accent md-raised" ng-disabled="smsQueueForm.$invalid || smsQueueForm.$pristine" aria-label="SAVE" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSmsQueue" ng-click="vm.addNewSmsQueue()" class="send-button md-accent md-raised" ng-disabled="smsQueueForm.$invalid" aria-label="ADD" translate="SMS.ADD_SMSQUEUE" translate-attr-aria-label="SMS.ADD_SMSQUEUE">\n          ADD SMSQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSmsQueue" ng-click="vm.deleteSmsQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="SMS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="SMS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/agentadd/agentadd.html",'<md-dialog class="smsQueue-dialog" aria-label="smsQueue" ng-init="vm.onInit()">\n  <form name="smsQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.AGENTADD_SMSQUEUE">Add Agent to smsQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/teamadd/teamadd.html",'<md-dialog class="smsQueue-dialog" aria-label="smsQueue" ng-init="vm.onInit()">\n  <form name="smsQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="SMS.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/sms/views/smsQueues/edit/view.html",'<div id="sms-smsQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-smsQueues-button md-icon-button" aria-label="Go to smsQueues" ng-click="vm.gotoSmsQueues()" translate translate-attr-aria-label="SMS.GO_TO_SMSQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="smsQueue-image" hide-xs>\n          <img ng-src="assets/images/business/smsQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.smsQueue.id}}\n            <span ng-if="vm.smsQueue.name">{{vm.smsQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="SMS.CREATED_AT"></span> <span>{{vm.smsQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.smsQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="SMS.TEAMADD_SMSQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.smsQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="SMS.AGENTADD_SMSQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveSmsQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="SMS.SAVE" translate-attr-aria-label="SMS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="SMS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="smsQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="SMS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="SMS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.smsQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="SMS.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="SMS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.smsQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.smsQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="SMS.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="SMS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.smsQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="SMS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/sms/views/smsQueues/smsQueues.html",'<div id="smsQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-message-text" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="SMS.SMSQUEUES">SmsQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="SMS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSmsQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSmsQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="SMS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-smsQueues-count">\n          <span>{{vm.selectedSmsQueues.length}}</span>\n          <span translate="SMS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="SMS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSmsQueues()" translate="SMS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSmsQueues()" translate="SMS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSmsQueues" csv-label="true" filename="smsQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSmsQueues($event)" aria-label="delete selected" translate translate-attr-label="SMS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SMSQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSmsQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSmsQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'SMS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'SMS.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'SMS.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.smsQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="SMS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="smsQueue" md-select-id="id" ng-repeat="smsQueue in vm.smsQueues.rows">\n                <td md-cell ng-if="smsQueue.userpic"><img class="avatar" alt="{{smsQueue.name}}" ng-src="api/users/{{smsQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!smsQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{smsQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="id ">{{smsQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="name ">{{smsQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(smsQueue, ev) : vm.createOrEditSmsQueue($event, smsQueue)" md-cell class="strategy ">{{ vm.arraystrategy[smsQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="SMS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(smsQueue, $event    )" translate="SMS.EDIT_SMSQUEUE">\n                          Edit SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(smsQueue, $event    )" translate="SMS.TEAMADD_SMSQUEUE">\n                          teamadd SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(smsQueue, $event    )" translate="SMS.AGENTADD_SMSQUEUE">\n                          agentadd SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(smsQueue, $event    )" translate="SMS.DELETE_SMSQUEUE">\n                          Delete SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(smsQueue, $event    )" translate="SMS.GOTOREALTIME_SMSQUEUE">\n                          goToRealtime SmsQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'SMS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'SMS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'SMS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.smsQueues.count}}" md-on-paginate="vm.getSmsQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SMSQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SMSQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-smsQueue-button" ng-click="vm.createOrEditSmsQueue($event)" aria-label="add smsQueue" translate translate-attr-aria-label="SMS.ADD_SMSQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SMSQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/agents/agents.html",'<div id="agents" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.AGENTS">Agents</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedAgents.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedAgents =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-agents-count">\n          <span>{{vm.selectedAgents.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllAgents()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectAgents()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedAgents" csv-label="true" filename="agents.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedAgents($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- AGENT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedAgents" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAgents">\n              <tr md-row>\n                <th md-column width="20px"></th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="showWebBar">{{ \'STAFF.SHOWWEBCONTROL\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'STAFF.PHONE\' | translate }}</th>\n                <th md-column md-order-by="mobile">{{ \'STAFF.MOBILE\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column md-order-by="disabled">{{ \'STAFF.DISABLED\' | translate }}</th>\n                <th md-column md-order-by="blocked">{{ \'STAFF.BLOCKED\' | translate }}</th>\n                <th md-column>{{ \'STAFF.CLIENT_LOGS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.agents.rows.length">\n                <td md-cell colspan="10">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="agent" md-select-id="id" ng-repeat="agent in vm.agents.rows">\n                <td md-cell ng-if="agent.userpic"><img class="avatar" alt="{{agent.name}}" ng-src="api/users/{{agent.id}}/avatar" /></td>\n                <td md-cell ng-if="!agent.userpic"><img class="avatar" alt="{{agent.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="fullname font-weight-600">{{agent.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="name">{{agent.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="showWebBar">{{ agent.showWebBar | getOptionByValue: vm.showWebBarOptions }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="email">{{agent.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="phone">{{agent.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="mobile">{{agent.mobile}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="internal">{{agent.internal}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="disabled">\n                  <md-icon md-colors="{color: {{agent.disabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{agent.disabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="blocked">\n                  <md-icon md-colors="{color: {{agent.blocked ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{agent.blocked ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(agent, ev) : vm.createOrEditAgent($event, agent)" md-cell class="client-side-logging">\n                  <ms-client-side-logging-icon user="agent"></ms-client-side-logging-icon>\n                </td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(agent, $event    )" translate="STAFF.EDIT_AGENT">\n                          Edit Agent\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item>\n                        <md-button ng-click="vm.teamadddialog(agent, $event    )" translate="STAFF.TEAMADD_AGENT">\n                          teamadd Agent\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(agent, $event    )" translate="STAFF.DELETE_AGENT">\n                          Delete Agent\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.agents.count}}" md-on-paginate="vm.getAgents" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / AGENT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD AGENT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-agent-button" ng-click="vm.createOrEditAgent($event)" aria-label="add agent" translate translate-attr-aria-label="STAFF.ADD_AGENT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD AGENT BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/agents/create/dialog.html",'<md-dialog class="agent-dialog" aria-label="New Agent">\n  <form name="agentForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container ng-if="!vm.setting.filterFullName" class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-required="true" autofocus>\n        <div ng-messages="agentForm[\'fullname\'].$error" ng-show="agentForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.setting.filterFullName" class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-pattern="/^[A-Za-z0-9\\ \\_\\-]+$/i" ng-required="true" autofocus>\n        <div class="hint"><span translate="STAFF.HELP.FILTERFULLNAME"></span></div>\n        <div ng-messages="agentForm[\'fullname\'].$error" ng-show="agentForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.FULLNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\ \\_\\-]+$/i\' }">Fullname must be valid pattern</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.agent.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newAgent">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="agentForm[\'name\'].$error" ng-show="agentForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.agent.alias">\n\n        <div ng-messages="agentForm[\'alias\'].$error" ng-show="agentForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.SHOWWEBCONTROL">ShowWebControl</label>\n        <md-select name="showWebBar" ng-model="vm.agent.showWebBar">\n          <md-option ng-value="0">Phonebar</md-option>\n          <md-option ng-value="1">External</md-option>\n          <md-option ng-value="2">WebRTC</md-option>\n        </md-select>\n        <div ng-messages="agentForm[\'showWebBar\'].$error" ng-show="agentForm[\'showWebBar\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.SHOWWEBCONTROL_REQUIRED">ShowWebControl field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.agent.email" ng-required="true">\n\n        <div ng-messages="agentForm[\'email\'].$error" ng-show="agentForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newAgent">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.agent.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="agentForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newAgent  && (vm.newAgent)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="agentForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newAgent" class="md-block">\n        <md-switch ng-model="vm.agent.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.agent.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.agent.internal" ng-required="true" ng-disabled="!vm.newAgent">\n\n        <div ng-messages="agentForm[\'internal\'].$error" ng-show="agentForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.agent.description">\n\n        <div ng-messages="agentForm[\'description\'].$error" ng-show="agentForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newAgent" class="md-block">\n        <md-switch ng-model="vm.agent.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.agent.userSetting">\n        <ms-client-side-logging user="vm.agent"></ms-client-side-logging>\n      </md-input-container>\n      <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n        <md-switch ng-model="vm.agent.phoneBarRemoteControl" aria-label="RemoteControl"><span translate="STAFF.REMOTECONTROL">RemoteControl</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.agent.phoneBarRemoteControl && vm.agent.showWebBar == 0" class="md-block">\n        <label translate="STAFF.REMOTECONTROLPORT">RemoteControlPort</label>\n        <input type="number" name="phoneBarRemoteControlPort" ng-model="vm.agent.phoneBarRemoteControlPort" value="9888" ng-required="true">\n\n        <div ng-messages="agentForm[\'phoneBarRemoteControlPort\'].$error" ng-show="agentForm[\'phoneBarRemoteControlPort\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.REMOTECONTROLPORT_REQUIRED">RemoteControlPort field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newUser" class="md-block">\n        <md-switch ng-model="vm.agent.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAgent" ng-click="vm.saveAgent()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid || agentForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAgent" ng-click="vm.addNewAgent()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid" aria-label="ADD" translate="STAFF.ADD_AGENT" translate-attr-aria-label="STAFF.ADD_AGENT">\n          ADD AGENT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAgent" ng-click="vm.deleteAgent($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/changepassword/changepassword.html",'<md-dialog class="agent-dialog" aria-label="{{vm.name}}">\n  <form name="agentForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.agent.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="agentForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="agentForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="agentForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="agentForm.$invalid || agentForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/queueadd/queueadd.html",'<md-dialog class="agent-dialog" aria-label="agent" ng-init="vm.onInit()">\n  <form name="agentForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2>{{vm.title}}</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin" ng-if="vm.agent.role === \'agent\' && vm.channel === \'voice\'">\n        <label translate="STAFF.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="agentForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" add-disabled="vm.channel === \'voice\' && vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveQueues()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/teamadd/teamadd.html",'<md-dialog class="agent-dialog" aria-label="agent" ng-init="vm.onInit()">\n  <form name="agentForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="STAFF.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/agents/edit/view.html",'<div id="staff-agent" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-agents-button md-icon-button" aria-label="Go to agents" ng-click="vm.gotoAgents()" translate translate-attr-aria-label="STAFF.GO_TO_AGENTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="agent-image" hide-xs>\n          <img ng-src="assets/images/business/agents.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.agent.id}}\n            <span ng-if="vm.agent.name">{{vm.agent.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.agent.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-cloak>\n      <md-fab-speed-dial md-direction="left" class="md-scale md-fab">\n        <md-fab-trigger>\n          <md-button aria-label="menu" class="md-fab md-primary md-icon-button">\n            <md-tooltip md-direction="top" md-visible="false"><span translate="STAFF.CHANNELS">Channels</span></md-tooltip>\n            <md-icon md-font-icon="icon-stackoverflow" aria-label="queueadd"></md-icon>\n          </md-button>\n        </md-fab-trigger>\n        <md-fab-actions>\n          <md-button aria-label="voice" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'voice\', $event, \'inbound\')">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="VOICE.VOICE">Voice</span></md-tooltip>\n            <md-icon md-font-icon="icon-phone" aria-label="voice"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.dialer" aria-label="motion bull" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'voice\', $event, \'outbound\')">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="MOTIONDIALER.MOTIONDIALER">Motion Bull</span></md-tooltip>\n            <md-icon md-font-icon="icon-fire" aria-label="motion bull"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.chat" aria-label="chat" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'chat\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="CHAT.CHAT">Chat</span></md-tooltip>\n            <md-icon md-font-icon="icon-hangouts" aria-label="chat"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.mail" aria-label="mail" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'mail\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="MAIL.MAIL">Email</span></md-tooltip>\n            <md-icon md-font-icon="icon-email" aria-label="mail"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.messaging" aria-label="sms" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'sms\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="SMS.SMS">Sms</span></md-tooltip>\n            <md-icon md-font-icon="icon-message-text" aria-label="sms"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.openchannel" aria-label="openchannel" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'openchannel\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="OPENCHANNEL.OPENCHANNEL">Openchannel</span></md-tooltip>\n            <md-icon md-font-icon="icon-google-earth" aria-label="openchannel"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.fax" aria-label="fax" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'fax\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="FAX.FAX">Fax</span></md-tooltip>\n            <md-icon md-font-icon="icon-deskphone" aria-label="fax"></md-icon>\n          </md-button>\n          <md-button ng-if="vm.license.whatsapp" aria-label="whatsapp" class="md-fab md-raised md-icon-button md-mini" ng-click="vm.queueaddchannel(vm.agent, \'whatsapp\', $event)">\n            <md-tooltip md-direction="bottom" md-visible="false"><span translate="WHATSAPP.WHATSAPP">whatsapp</span></md-tooltip>\n            <md-icon md-font-icon="icon-whatsapp" aria-label="whatsapp"></md-icon>\n          </md-button>\n        </md-fab-actions>\n      </md-fab-speed-dial>\n    </div>\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.agent, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="STAFF.TEAMADD_AGENT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.agent, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_AGENT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveAgent()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(personal_infoForm.$invalid) || (security_suiteForm.$invalid) || (change_avatarForm.$invalid) || (generalForm.$invalid) || (capacityForm.$invalid) || (settingsForm.$invalid) || (remote_controlForm.$invalid) || (sipForm.$invalid) || (callforwardingForm.$invalid) || (settings_webrtcForm.$invalid) || (sip_webrtcForm.$invalid) || (general_permissionsForm.$invalid) || (download_permissionsForm.$invalid) || (permissionsForm.$invalid) || (autoAnswerForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERSONAL_INFO">PERSONAL_INFO</div>\n            </div>\n            <form name="personal_infoForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.FULLNAME">Fullname</label>\n                <input type="text" name="fullname" ng-model="vm.agent.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'fullname\'].$error" ng-show="personal_infoForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.agent.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="personal_infoForm[\'name\'].$error" ng-show="personal_infoForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.agent.alias" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'alias\'].$error" ng-show="personal_infoForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SHOWWEBCONTROL">ShowWebControl</label>\n                <md-select name="showWebBar" ng-model="vm.agent.showWebBar" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="0">Phonebar</md-option>\n                  <md-option ng-value="1">External</md-option>\n                  <md-option ng-value="2">WebRTC</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'showWebBar\'].$error" ng-show="personal_infoForm[\'showWebBar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SHOWWEBCONTROL_REQUIRED">ShowWebControl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.agent.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'email\'].$error" ng-show="personal_infoForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.agent.phone" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'phone\'].$error" ng-show="personal_infoForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.agent.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'mobile\'].$error" ng-show="personal_infoForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 1" class="md-block">\n                <md-switch ng-model="vm.agent.hotdesk" aria-label="Hotdesk" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.HOTDESK">Hotdesk</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.loginInPause" aria-label="LoginInPause" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.LOGININPAUSE">LoginInPause</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.agent.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'description\'].$error" ng-show="personal_infoForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container security_suite md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SECURITY_SUITE">SECURITY_SUITE</div>\n            </div>\n            <form name="security_suiteForm" novalidate>\n              <md-input-container ng-if="vm.agent.passwordResetAt != null" class="md-block">\n                <label translate="STAFF.LAST_PASSWORD_RESET_AT">Last_Password_Reset_At</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.agent.passwordResetAt" autofocus disabled>\n                <div class="hint"><span translate="STAFF.HELP.LAST_PASSWORD_RESET_AT"></span></div>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.LAST_PASSWORD_RESET_AT_REQUIRED">Last_Password_Reset_At field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.passwordResetAt == null" class="md-block">\n                <label translate="STAFF.NO_PASSWORD_CHANGE">No_Password_Change</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.agent.passwordResetAt" disabled>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NO_PASSWORD_CHANGE_REQUIRED">No_Password_Change field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.disabled" aria-label="Disabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DISABLED">Disabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.DISABLED"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.disabled == 0" class="md-block">\n                <md-switch ng-model="vm.agent.blocked" aria-label="Blocked" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.BLOCKED">Blocked</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.BLOCKED"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.privacyEnabled" aria-label="Mask_Sensitive_Data" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTHENTICATION">AUTHENTICATION</div>\n            </div>\n            <form name="authenticationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.adSsoEnabled" aria-label="AD_SSO_Enabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AD_SSO_ENABLED">AD_SSO_Enabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.AD_SSO_ENABLED"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container change_avatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CHANGE_AVATAR">CHANGE_AVATAR</div>\n            </div>\n            <div ng-controller="Agentchange_avatarController as vm_ca" ng-init="vm_ca.init(vm.agent, vm.crudPermissions)" class="agent-detail-form-container md-background-bg md-whiteframe-1dp">\n              <div id="agent-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="change_avatarimage in vm_ca.agent.images" ng-switch="change_avatarimage.type">\n                    <div class="agent-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{change_avatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="change_avatarimage.file">\n                    </div>\n                    <div class="agent-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{change_avatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.agent.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.agent.internal" ng-required="true" autofocus disabled>\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar != 2" class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.agent.transport" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'" ng-if="vm.agent.showWebBar == 1">ws</md-option>\n                  <md-option ng-value="\'wss\'" ng-if="vm.agent.showWebBar == 1">wss</md-option>\n                  <md-option ng-value="\'tls\'" ng-if="vm.agent.showWebBar == 1">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TRANSPORT"></span></div>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.HOST">Host</label>\n                <input type="text" name="host" ng-model="vm.agent.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.HOST"></span></div>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.HOST_REQUIRED">Host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.agent.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.agent.type" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'friend\'">Friend</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                  <md-option ng-value="\'peer\'">Peer</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TYPE"></span></div>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.agent.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="!vm.setting.filterFullName" class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input ng-readonly="vm.setting.filterFullName" type="text" name="callerid" ng-model="vm.agent.callerid" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.setting.filterFullName" class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input type="text" name="callerid" ng-model="vm.agent.callerid" ng-pattern="/^[A-Za-z0-9\\ \\_\\-\\<\\>\\x22]+$/i" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.CALLERID_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\ \\_\\-\\<\\>\\x22]+$/i\' }">CallerId must be valid pattern</span>\n                  </div>\n                </div>\n               \n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.agent.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.agent.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.agent.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.chanspy" aria-label="chanSpy" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CHANSPY">chanSpy</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.agent.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MONITOREXTENSION">MonitorExtension</label>\n                <md-select name="extensionMonitor" ng-model="vm.agent.extensionMonitor" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'WAV\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'extensionMonitor\'].$error" ng-show="generalForm[\'extensionMonitor\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MONITOREXTENSION_REQUIRED">MonitorExtension field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.OTHER_CHANNELS">OTHER_CHANNELS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container capacity md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CAPACITY">CAPACITY</div>\n            </div>\n            <form name="capacityForm" novalidate>\n              <md-input-container ng-if="vm.license.chat" class="md-block">\n                <label translate="STAFF.CHATCAPACITY">ChatCapacity</label>\n                <input type="number" name="chatCapacity" ng-model="vm.agent.chatCapacity" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CHATCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'chatCapacity\'].$error" ng-show="capacityForm[\'chatCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CHATCAPACITY_REQUIRED">ChatCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.CHATCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ChatCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.mail" class="md-block">\n                <label translate="STAFF.MAILCAPACITY">MailCapacity</label>\n                <input type="number" name="mailCapacity" ng-model="vm.agent.mailCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.MAILCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'mailCapacity\'].$error" ng-show="capacityForm[\'mailCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MAILCAPACITY_REQUIRED">MailCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.MAILCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MailCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.messaging" class="md-block">\n                <label translate="STAFF.SMSCAPACITY">SMSCapacity</label>\n                <input type="number" name="smsCapacity" ng-model="vm.agent.smsCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SMSCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'smsCapacity\'].$error" ng-show="capacityForm[\'smsCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SMSCAPACITY_REQUIRED">SMSCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.SMSCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">SMSCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.openchannel" class="md-block">\n                <label translate="STAFF.OPENCHANNELCAPACITY">OpenchannelCapacity</label>\n                <input type="number" name="openchannelCapacity" ng-model="vm.agent.openchannelCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.OPENCHANNELCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'openchannelCapacity\'].$error" ng-show="capacityForm[\'openchannelCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.OPENCHANNELCAPACITY_REQUIRED">OpenchannelCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.OPENCHANNELCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">OpenchannelCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.fax" class="md-block">\n                <label translate="STAFF.FAXCAPACITY">FaxCapacity</label>\n                <input type="number" name="faxCapacity" ng-model="vm.agent.faxCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.FAXCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'faxCapacity\'].$error" ng-show="capacityForm[\'faxCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FAXCAPACITY_REQUIRED">FaxCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.FAXCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">FaxCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.whatsapp" class="md-block">\n                <label translate="STAFF.WHATSAPPCAPACITY">WhatsappCapacity</label>\n                <input type="number" name="whatsappCapacity" ng-model="vm.agent.whatsappCapacity" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.WHATSAPPCAPACITY"></span></div>\n                <div ng-messages="capacityForm[\'whatsappCapacity\'].$error" ng-show="capacityForm[\'whatsappCapacity\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.WHATSAPPCAPACITY_REQUIRED">WhatsappCapacity field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.WHATSAPPCAPACITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WhatsappCapacity must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container auto_answer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTO_ANSWER">AUTO_ANSWER</div>\n            </div>\n            <form name="autoAnswerForm" novalidate>\n              <md-input-container ng-if="vm.license.chat" class="md-block">\n                <md-switch ng-model="vm.agent.chatAutoanswer" aria-label="chatAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.CHAT_AUTOANSWER">ChatAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.chatAutoanswer" class="md-block">\n                  <label translate="STAFF.CHAT_AUTOANSWERDELAY">ChatAutoAnswerDelay</label>\n                  <input type="number" name="chatAutoAnswerDelay" ng-model="vm.agent.chatAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.mail" class="md-block">\n                <md-switch ng-model="vm.agent.emailAutoanswer" aria-label="emailAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.EMAIL_AUTOANSWER">EmailAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.emailAutoanswer" class="md-block">\n                  <label translate="STAFF.EMAIL_AUTOANSWERDELAY">EmailAutoAnswerDelay</label>\n                  <input type="number" name="emailAutoAnswerDelay" ng-model="vm.agent.emailAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.messaging" class="md-block">\n                <md-switch ng-model="vm.agent.smsAutoanswer" aria-label="smsAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.SMS_AUTOANSWER">SmsAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.smsAutoanswer" class="md-block">\n                  <label translate="STAFF.SMS_AUTOANSWERDELAY">SmsAutoAnswerDelay</label>\n                  <input type="number" name="smsAutoAnswerDelay" ng-model="vm.agent.smsAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.openchannel" class="md-block">\n                <md-switch ng-model="vm.agent.openchannelAutoanswer" aria-label="openchannelAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.OPENCHANNEL_AUTOANSWER">openchannelAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.openchannelAutoanswer" class="md-block">\n                  <label translate="STAFF.OPENCHANNEL_AUTOANSWERDELAY">openchannelAutoAnswerDelay</label>\n                  <input type="number" name="openchannelAutoAnswerDelay" ng-model="vm.agent.openchannelAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.fax" class="md-block">\n                <md-switch ng-model="vm.agent.faxAutoanswer" aria-label="faxAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.FAX_AUTOANSWER">faxAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.faxAutoanswer" class="md-block">\n                  <label translate="STAFF.FAX_AUTOANSWERDELAY">faxAutoAnswerDelay</label>\n                  <input type="number" name="faxAutoAnswerDelay" ng-model="vm.agent.faxAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n              <md-input-container ng-if="vm.license.whatsapp" class="md-block">\n                <md-switch ng-model="vm.agent.whatsappAutoanswer" aria-label="whatsappAutoanswer" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.WHATSAPP_AUTOANSWER">whatsappAutoAnswer</span>\n                </md-switch>\n                <md-input-container ng-if="vm.agent.whatsappAutoanswer" class="md-block">\n                  <label translate="STAFF.WHATSAPP_AUTOANSWERDELAY">whatsappAutoAnswerDelay</label>\n                  <input type="number" name="whatsappAutoAnswerDelay" ng-model="vm.agent.whatsappAutoanswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                </md-input-container>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.agent.showWebBar == 0">\n        <md-tab-label>\n          <span translate="STAFF.MOTIONBAR">MOTIONBAR</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container settings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SETTINGS">SETTINGS</div>\n            </div>\n            <form name="settingsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableSettings" aria-label="EnableSettings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESETTINGS">EnableSettings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarAutoAnswer" aria-label="AutoAnswer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AUTOANSWER">AutoAnswer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarAutoAnswer" class="md-block">\n                <label translate="STAFF.AUTOANSWERDELAY">AutoAnswerDelay</label>\n                <input type="number" name="phoneBarAutoAnswerDelay" ng-model="vm.agent.phoneBarAutoAnswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="settingsForm[\'phoneBarAutoAnswerDelay\'].$error" ng-show="settingsForm[\'phoneBarAutoAnswerDelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_REQUIRED">AutoAnswerDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AutoAnswerDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarRingInUse" aria-label="RingInUse" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.RINGINUSE">RingInUse</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableRecording" aria-label="EnableRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLERECORDING">EnableRecording</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableDtmfTone" aria-label="EnableDtmfTone" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEDTMFTONE">EnableDtmfTone</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarDnd" aria-label="Dnd" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DND">Dnd</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarUnansweredCallBadge" aria-label="UnansweredCallBadge" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.UNANSWEREDCALLBADGE">UnansweredCallBadge</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableJaws" aria-label="EnableJawsIntegration" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEJAWSINTEGRATION">EnableJawsIntegration</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0 && vm.license.screenrecording" class="md-block">\n                <md-switch ng-change="vm.onEnableScreenRecordingByAgentSelection()" ng-model="vm.agent.phoneBarEnableScreenRecordingByAgent" aria-label="EnableScreenRecordingByAgent" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESCREENRECORDINGBYAGENT">EnableScreenRecordingByAgent</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.showWebBar == 0 && vm.license.screenrecording" class="md-block">\n                <md-switch ng-change="vm.onEnableAutomaticScreenRecordingSelection()" ng-model="vm.agent.phoneBarEnableAutomaticScreenRecording" aria-label="EnableAutomaticScreenRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEAUTOMATICSCREENRECORDING">EnableAutomaticScreenRecording</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.ENABLEAUTOMATICSCREENRECORDING"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container remote_control md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.REMOTE_CONTROL">REMOTE_CONTROL</div>\n            </div>\n            <form name="remote_controlForm" novalidate>\n              <md-input-container ng-if="vm.agent.showWebBar == 0" class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarRemoteControl" aria-label="RemoteControl" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.REMOTECONTROL">RemoteControl</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarRemoteControl && vm.agent.showWebBar == 0" class="md-block">\n                <label translate="STAFF.REMOTECONTROLPORT">RemoteControlPort</label>\n                <input type="number" name="phoneBarRemoteControlPort" ng-model="vm.agent.phoneBarRemoteControlPort" value="9888" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="remote_controlForm[\'phoneBarRemoteControlPort\'].$error" ng-show="remote_controlForm[\'phoneBarRemoteControlPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.REMOTECONTROLPORT_REQUIRED">RemoteControlPort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container sip md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SIP">SIP</div>\n            </div>\n            <form name="sipForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPEXPIRES">SipExpires</label>\n                <input type="number" name="phoneBarExpires" ng-model="vm.agent.phoneBarExpires" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPEXPIRES"></span></div>\n                <div ng-messages="sipForm[\'phoneBarExpires\'].$error" ng-show="sipForm[\'phoneBarExpires\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPEXPIRES_REQUIRED">SipExpires field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPPORT">SipPort</label>\n                <input type="number" name="phoneBarListenPort" ng-model="vm.agent.phoneBarListenPort" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPPORT"></span></div>\n                <div ng-messages="sipForm[\'phoneBarListenPort\'].$error" ng-show="sipForm[\'phoneBarListenPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPPORT_REQUIRED">SipPort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container callforwarding md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CALLFORWARDING">CALLFORWARDING</div>\n            </div>\n            <form name="callforwardingForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarUnconditional" aria-label="Unconditional" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.UNCONDITIONAL">Unconditional</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarUnconditional" class="md-block">\n                <label translate="STAFF.UNCONDITIONALNUMBER">UnconditionalNumber</label>\n                <input type="text" name="phoneBarUnconditionalNumber" ng-model="vm.agent.phoneBarUnconditionalNumber" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="callforwardingForm[\'phoneBarUnconditionalNumber\'].$error" ng-show="callforwardingForm[\'phoneBarUnconditionalNumber\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.UNCONDITIONALNUMBER_REQUIRED">UnconditionalNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.agent.showWebBar == 2">\n        <md-tab-label>\n          <span translate="STAFF.WEBRTC">WEBRTC</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container settings_webrtc md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SETTINGS_WEBRTC">SETTINGS_WEBRTC</div>\n            </div>\n            <form name="settings_webrtcForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DTLSCERTFILE">dtlscertfile</label>\n                <input type="text" name="dtlscertfile" ng-model="vm.agent.dtlscertfile" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.DTLSCERTFILE"></span></div>\n                <div ng-messages="settings_webrtcForm[\'dtlscertfile\'].$error" ng-show="settings_webrtcForm[\'dtlscertfile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DTLSCERTFILE_REQUIRED">dtlscertfile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DTLSPRIVATEKEY">dtlsprivatekey</label>\n                <input type="text" name="dtlsprivatekey" ng-model="vm.agent.dtlsprivatekey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.DTLSPRIVATEKEY"></span></div>\n                <div ng-messages="settings_webrtcForm[\'dtlsprivatekey\'].$error" ng-show="settings_webrtcForm[\'dtlsprivatekey\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DTLSPRIVATEKEY_REQUIRED">dtlsprivatekey field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.WSS_PORT">WSS_Port</label>\n                <input type="number" name="wssPort" ng-model="vm.agent.wssPort" min="0" value="8089" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.WSS_PORT"></span></div>\n                <div ng-messages="settings_webrtcForm[\'wssPort\'].$error" ng-show="settings_webrtcForm[\'wssPort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.WSS_PORT_REQUIRED">WSS_Port field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.WSS_PORT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WSS_Port must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableSettings" aria-label="EnableSettings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLESETTINGS">EnableSettings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarAutoAnswer" aria-label="AutoAnswer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AUTOANSWER">AutoAnswer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.agent.phoneBarAutoAnswer" class="md-block">\n                <label translate="STAFF.AUTOANSWERDELAY">AutoAnswerDelay</label>\n                <input type="number" name="phoneBarAutoAnswerDelay" ng-model="vm.agent.phoneBarAutoAnswerDelay" min="0" value="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="settings_webrtcForm[\'phoneBarAutoAnswerDelay\'].$error" ng-show="settings_webrtcForm[\'phoneBarAutoAnswerDelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_REQUIRED">AutoAnswerDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="STAFF.ERRORS.AUTOANSWERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AutoAnswerDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableRecording" aria-label="EnableRecording" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLERECORDING">EnableRecording</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarEnableDtmfTone" aria-label="EnableDtmfTone" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEDTMFTONE">EnableDtmfTone</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.phoneBarDnd" aria-label="Dnd" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DND">Dnd</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.ignorePauseForPreviewCalls" aria-label="Ignore agent break status for preview calls" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.IGNORE_AGENT_BREAK_STATUS_FOR_PREVIEW_CALLS">Ignore agent break status for preview calls</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container sip_webrtc md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SIP_WEBRTC">SIP_WEBRTC</div>\n            </div>\n            <form name="sip_webrtcForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.SIPEXPIRES">SipExpires</label>\n                <input type="number" name="phoneBarExpires" ng-model="vm.agent.phoneBarExpires" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.SIPEXPIRES"></span></div>\n                <div ng-messages="sip_webrtcForm[\'phoneBarExpires\'].$error" ng-show="sip_webrtcForm[\'phoneBarExpires\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.SIPEXPIRES_REQUIRED">SipExpires field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.PERMISSIONS">PERMISSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container general_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL_PERMISSIONS">GENERAL_PERMISSIONS</div>\n            </div>\n            <form name="general_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.allowmessenger" aria-label="EnableMessenger" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ENABLEMESSENGER">EnableMessenger</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.messengerSoundNotification" aria-label="EnableMessengerSoundNotification" \n                ng-if="vm.agent.allowmessenger">\n                  <span translate="STAFF.MESSENGERSOUNDNOTIFICATION">MessengerSoundNotification</span></md-switch>\n            </md-input-container>\n            <md-input-container class="md-block">                \n                <md-switch ng-model="vm.agent.phoneBarPrefixRequired" aria-label="PrefixRequired" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.PREFIXREQUIRED">PrefixRequired</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.selectRecallMeCampaign" aria-label="Select_RecallMe_Campaign" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.SELECT_RECALLME_CAMPAIGN">Select_RecallMe_Campaign</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container download_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.DOWNLOAD_PERMISSIONS">DOWNLOAD_PERMISSIONS</div>\n            </div>\n            <form name="download_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadAttachments" aria-label="Attachments" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ATTACHMENTS">Attachments</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadOmnichannelInteractions" aria-label="Omnichannel_Interactions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.OMNICHANNEL_INTERACTIONS">Omnichannel_Interactions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.agent.downloadVoiceRecordings" aria-label="Voice_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.VOICE_RECORDINGS">Voice_Recordings</span></md-switch>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="agent-detail-form-container permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERMISSIONS">PERMISSIONS</div>\n            </div>\n            <div ng-controller="AgentPermissionsController as vm_pc" ng-init="vm_pc.init(vm.agent, vm.crudPermissions)" class="agent-detail-form-container">\n              <md-list ng-repeat="father in vm_pc.navigation[0].children" ng-include="\'permission-nested.html\'" ng-if="vm_pc.agent.role !== \'admin\' && !father.hidden()"></md-list>\n              \x3c!-- Nested navigation template --\x3e\n              <script type="text/ng-template" id="permission-nested.html">\n                <md-list-item>\n        <md-icon md-font-icon="{{father.icon}}"></md-icon>\n        <p translate="{{father.translate}}">{{ father.title }}</p>\n        <md-switch class="md-secondary" ng-model="father.enabled" ng-change="vm_pc.onChange(father)" ng-init="father.enabled = vm_pc.agent.permissions.includes(father.id)" \n                  ng-disabled="!vm_pc.crudPermissions.canEdit"></md-switch>\n      </md-list-item>\n      <md-divider></md-divider>\n      <md-list>\n        <md-list-item ng-repeat="child in father.children" ng-if="child.id !== 201">\n          <md-icon ng-if="child.icon" md-font-icon="{{child.icon}}"></md-icon>\n          <p translate="{{child.translate}}">{{ child.title }}</p>\n          <md-switch ng-model="child.enabled" ng-change="vm_pc.onChange(father, child)" ng-init="child.enabled = vm_pc.agent.permissions.includes(child.id)"\n                    ng-disabled="!vm_pc.crudPermissions.canEdit"></md-switch>\n          </md-list-item>\n      </md-list>\n  <\/script>\n              \x3c!-- / Nested navigation template --\x3e\n              <span ng-if="vm_pc.agent.role === \'admin\'" class="md-headline" translate="STAFF.ALL_MODULES_AVAILABLE">All modules are already available.</span>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.CLIENT_LOGS">CLIENT-SIDE LOGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="agent-detail-form-container client_logs md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CLIENT_LOGS">\n                CLIENT-SIDE LOGS\n              </div>\n            </div>\n            <ms-client-side-logging user="vm.agent" on-user-update="vm.refreshAgent()"></ms-client-side-logging>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/staff/views/teams/create/dialog.html",'<md-dialog class="team-dialog" aria-label="New Team">\n  <form name="teamForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.team.name" ng-required="true" autofocus>\n\n        <div ng-messages="teamForm[\'name\'].$error" ng-show="teamForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.team.description">\n\n        <div ng-messages="teamForm[\'description\'].$error" ng-show="teamForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTeam" ng-click="vm.saveTeam()" class="send-button md-accent md-raised" ng-disabled="teamForm.$invalid || teamForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTeam" ng-click="vm.addNewTeam()" class="send-button md-accent md-raised" ng-disabled="teamForm.$invalid" aria-label="ADD" translate="STAFF.ADD_TEAM" translate-attr-aria-label="STAFF.ADD_TEAM">\n          ADD TEAM\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTeam" ng-click="vm.deleteTeam($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/teams/edit/agentadd/agentadd.html",'<md-dialog class="team-dialog" aria-label="team" ng-init="vm.onInit()">\n  <form name="teamForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="STAFF.AGENTADD_TEAM">Add Agent to team</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/teams/teams.html",'<div id="teams" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.TEAMS">Teams</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTeams.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTeams =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-teams-count">\n          <span>{{vm.selectedTeams.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTeams()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTeams()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTeams" csv-label="true" filename="teams.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTeams($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TEAM TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTeams" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTeams">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'STAFF.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'STAFF.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.teams.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="team" md-select-id="id" ng-repeat="team in vm.teams.rows">\n                <td md-cell ng-if="team.userpic"><img class="avatar" alt="{{team.name}}" ng-src="api/users/{{team.id}}/avatar" /></td>\n                <td md-cell ng-if="!team.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{team.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="id ">{{team.id}}</td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="name ">{{team.name}}</td>\n                <td ng-click="vm.createOrEditTeam($event, team)" md-cell class="description ">{{team.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(team, $event    )" translate="STAFF.EDIT_TEAM">\n                          Edit Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(team, $event    )" translate="STAFF.AGENTADD_TEAM">\n                          AgentAdd Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(team, $event    )" translate="STAFF.DELETE_TEAM">\n                          Delete Team\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.teams.count}}" md-on-paginate="vm.getTeams" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TEAM TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TEAM BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-team-button" ng-click="vm.createOrEditTeam($event)" aria-label="add team" translate translate-attr-aria-label="STAFF.ADD_TEAM">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TEAM BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/telephones/create/dialog.html",'<md-dialog class="telephone-dialog" aria-label="New Telephone">\n  <form name="telephoneForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ACCOUNTNAME">Accountname</label>\n        <input type="text" name="fullname" ng-model="vm.telephone.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="telephoneForm[\'fullname\'].$error" ng-show="telephoneForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ACCOUNTNAME_REQUIRED">Accountname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.telephone.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newTelephone">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="telephoneForm[\'name\'].$error" ng-show="telephoneForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.telephone.email" ng-required="true">\n\n        <div ng-messages="telephoneForm[\'email\'].$error" ng-show="telephoneForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newTelephone">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.telephone.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="telephoneForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.newTelephone  && (vm.newTelephone)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="telephoneForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.telephone.description">\n\n        <div ng-messages="telephoneForm[\'description\'].$error" ng-show="telephoneForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newTelephone" class="md-block">\n        <md-switch ng-model="vm.telephone.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.telephone.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.telephone.internal" ng-required="true" ng-disabled="!vm.newTelephone">\n\n        <div ng-messages="telephoneForm[\'internal\'].$error" ng-show="telephoneForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newTelephone" class="md-block">\n        <md-switch ng-model="vm.telephone.voicemail" aria-label="Voicemail"><span translate="STAFF.VOICEMAIL">Voicemail</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTelephone" ng-click="vm.saveTelephone()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid || telephoneForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTelephone" ng-click="vm.addNewTelephone()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid" aria-label="ADD" translate="STAFF.ADD_TELEPHONE" translate-attr-aria-label="STAFF.ADD_TELEPHONE">\n          ADD TELEPHONE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTelephone" ng-click="vm.deleteTelephone($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/telephones/edit/changepassword/changepassword.html",'<md-dialog class="telephone-dialog" aria-label="{{vm.name}}">\n  <form name="telephoneForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.telephone.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="telephoneForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="telephoneForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="telephoneForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="telephoneForm.$invalid || telephoneForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/telephones/edit/view.html",'<div id="staff-telephone" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-telephones-button md-icon-button" aria-label="Go to telephones" ng-click="vm.gotoTelephones()" translate translate-attr-aria-label="STAFF.GO_TO_TELEPHONES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="telephone-image" hide-xs>\n          <img ng-src="assets/images/business/telephones.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.telephone.id}}\n            <span ng-if="vm.telephone.name">{{vm.telephone.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.telephone.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.telephone, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_TELEPHONE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTelephone()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(accountForm.$invalid) || (generalForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="telephone-detail-form-container account md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.ACCOUNT">ACCOUNT</div>\n            </div>\n            <form name="accountForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ACCOUNTNAME">Accountname</label>\n                <input type="text" name="fullname" ng-model="vm.telephone.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'fullname\'].$error" ng-show="accountForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ACCOUNTNAME_REQUIRED">Accountname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.telephone.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="accountForm[\'name\'].$error" ng-show="accountForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.telephone.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'email\'].$error" ng-show="accountForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.telephone.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'description\'].$error" ng-show="accountForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.telephone.phone" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'phone\'].$error" ng-show="accountForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.telephone.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="accountForm[\'mobile\'].$error" ng-show="accountForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="telephone-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.telephone.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.telephone.internal" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.telephone.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.TRANSPORT"></span></div>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.telephone.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.telephone.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLERID">CallerId</label>\n                <input type="text" name="callerid" ng-model="vm.telephone.callerid" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLERID_REQUIRED">CallerId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.telephone.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.telephone.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.telephone.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.telephone.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ENCRYPTION">Encryption</label>\n                <md-select name="encryption" ng-model="vm.telephone.encryption" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ENCRYPTION"></span></div>\n                <div ng-messages="generalForm[\'encryption\'].$error" ng-show="generalForm[\'encryption\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ENCRYPTION_REQUIRED">Encryption field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/staff/views/telephones/telephones.html",'<div id="telephones" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.TELEPHONES">Telephones</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTelephones.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTelephones =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-telephones-count">\n          <span>{{vm.selectedTelephones.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTelephones()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTelephones()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTelephones" csv-label="true" filename="telephones.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTelephones($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TELEPHONE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTelephones" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTelephones">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.ACCOUNTNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.telephones.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="telephone" md-select-id="id" ng-repeat="telephone in vm.telephones.rows">\n                <td md-cell ng-if="telephone.userpic"><img class="avatar" alt="{{telephone.name}}" ng-src="api/users/{{telephone.id}}/avatar" /></td>\n                <td md-cell ng-if="!telephone.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{telephone.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="fullname font-weight-600">{{telephone.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="name ">{{telephone.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="email ">{{telephone.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(telephone, ev) : vm.createOrEditTelephone($event, telephone)" md-cell class="internal ">{{telephone.internal}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(telephone, $event    )" translate="STAFF.EDIT_TELEPHONE">\n                          Edit Telephone\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(telephone, $event    )" translate="STAFF.DELETE_TELEPHONE">\n                          Delete Telephone\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.telephones.count}}" md-on-paginate="vm.getTelephones" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TELEPHONE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TELEPHONE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-telephone-button" ng-click="vm.createOrEditTelephone($event)" aria-label="add telephone" translate translate-attr-aria-label="STAFF.ADD_TELEPHONE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TELEPHONE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/userProfiles/create/dialog.html",'<md-dialog class="userProfile-dialog" aria-label="New UserProfile">\n  <form name="userProfileForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus ng-disabled="!vm.newUserProfile">\n\n        <div ng-messages="userProfileForm[\'name\'].$error" ng-show="userProfileForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.userProfile.description">\n\n        <div ng-messages="userProfileForm[\'description\'].$error" ng-show="userProfileForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n        <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required>\n\n          <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="userProfileForm[\'crudPermissions\'].$error" ng-show="userProfileForm[\'crudPermissions\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n        <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newUserProfile" ng-click="vm.saveUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid || userProfileForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newUserProfile" ng-click="vm.addNewUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid" aria-label="ADD" translate="STAFF.ADD_USERPROFILE" translate-attr-aria-label="STAFF.ADD_USERPROFILE">\n          ADD USERPROFILE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newUserProfile" ng-click="vm.deleteUserProfile($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/clone/clone.html",'<md-dialog class="userProfile-dialog" aria-label="Clone UserProfile">\n  <form name="userProfileForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus ng-disabled="!vm.newUserProfile">\n\n        <div ng-messages="userProfileForm[\'name\'].$error" ng-show="userProfileForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.userProfile.description">\n\n        <div ng-messages="userProfileForm[\'description\'].$error" ng-show="userProfileForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n        <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required>\n\n          <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n          <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="userProfileForm[\'crudPermissions\'].$error" ng-show="userProfileForm[\'crudPermissions\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n        <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneUserProfile()" class="send-button md-accent md-raised" ng-disabled="userProfileForm.$invalid" aria-label="CLONE" translate="STAFF.CLONE_USERPROFILE" translate-attr-aria-label="STAFF.CLONE_USERPROFILE">\n        CLONE USERPROFILE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/permissionsmanage/permissionsmanage.html",'<md-dialog class="userProfile-dialog" aria-label="userProfile">\n  <form name="userProfileForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2>{{vm.title}}</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog($event)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div layout="column" class="padding-bottom-10">\n        <div layout="row" class="padding-bottom-10">\n          <md-input-container flex class="no-margin">\n            <label translate="STAFF.SECTIONS">Sections</label>\n            <md-select name="sections" ng-model="vm.selectedSection" placeholder="{{\'STAFF.PERMISSIONS_SELECT_SECTION\' | translate}}" ng-change="vm.onChangeSection()" required>\n              <md-option ng-value="subsection" ng-repeat="subsection in vm.subsections" ng-selected="{{vm.subsections.length === 1 ? \'true\' : \'false\'}}">{{subsection.translate | translate}}</md-option>\n            </md-select>\n          </md-input-container>\n          <div layout="row" ng-show="vm.selectedSection" class="margin-left-10">\n            <md-button ng-switch="vm.selectedSection.enabled" class="md-icon-button md-fab md-mini size-8 padding-10" ng-class="vm.selectedSection.enabled ? \'blue-500-bg\' : \'grey-A400-bg\'" ng-click="vm.onChangeVisibility()" aria-label="Visibility">\n              <md-icon ng-switch-when="true" md-font-icon="icon-eye" aria-label="Visible section">\n                <md-tooltip>{{\'STAFF.PERMISSIONS_SECTION_HIDE\' | translate}}</md-tooltip>\n              </md-icon>\n              <md-icon ng-switch-when="false" md-font-icon="icon-eye-off" aria-label="Hidden section">\n                <md-tooltip>{{\'STAFF.PERMISSIONS_SECTION_SHOW\' | translate}}</md-tooltip>\n              </md-icon>\n            </md-button>\n            <div>\n              <md-button class="md-icon-button md-fab md-mini size-8 green-A700-bg no-margin" ng-disabled="true">\n                <md-icon md-font-icon="icon-monitor" class="md-background-fg" aria-label="Read permission">\n                  <md-tooltip>{{\'STAFF.READ_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n              <md-button class="md-icon-button md-fab md-mini size-8 no-margin" ng-class="vm.selectedSection.allowEdit ? \'green-A700-bg\' : \'grey-A400-bg\'" ng-click="vm.setPermission(\'edit\')">\n                <md-icon md-font-icon="icon-pencil" aria-label="Edit permission">\n                  <md-tooltip>{{\'STAFF.EDIT_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n              <md-button class="md-icon-button md-fab md-mini size-8 no-margin" ng-class="vm.selectedSection.allowDelete ? \'green-A700-bg\' : \'grey-A400-bg\'" ng-click="vm.setPermission(\'delete\')">\n                <md-icon md-font-icon="icon-delete" aria-label="Delete permission">\n                  <md-tooltip>{{\'STAFF.DELETE_PERMISSION\' | translate}}</md-tooltip>\n                </md-icon>\n              </md-button>\n            </div>\n          </div>\n        </div>\n        <div layout="row" ng-show="vm.selectedSection" class="margin-left-10" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association">\n          <md-switch ng-model="vm.selectedSection.autoAssociation" class="no-margin padding-right-10" aria-label="Auto association" ng-change="vm.onChangeAutoAssociation()">\n          </md-switch>\n          <p class="no-margin font-size-12 line-height-30">{{\'STAFF.PERMISSIONS_AUTO_ASSOCIATION_INFO\' | translate}}</p>\n        </div>\n        <div layout="row" ng-show="vm.selectedSection && vm.selectedSection.title === \'Reports\' && !vm.selectedSection.autoAssociation" class="margin-bottom-10 margin-top-30" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association">\n          <md-input-container flex class="no-margin">\n            <label translate="STAFF.REPORT_TYPE">Report Type</label>\n            <md-select name="type" ng-model="vm.selectedSection.reportType" placeholder="{{\'STAFF.PERMISSIONS_SELECT_REPORT_TYPE\' | translate}}" ng-change="vm.onChangeReportType()" required>\n              <md-option ng-value="\'default\'">Default</md-option>\n              <md-option ng-value="\'custom\'">Custom</md-option>\n            </md-select>\n          </md-input-container>\n        </div>\n        <div ng-show="vm.selectedSection && vm.selectedSection.title === \'Dashboards\'" class="user-profile-section-help margin-bottom-10 margin-top-20">\n          <md-icon md-font-icon="icon-help" aria-label="Dashboards help"></md-icon>\n          <span class="no-margin font-size-12 line-height-30" translate="STAFF.HELP.CUSTOM_DASHBOARDS_PERMISSIONS"></span>\n        </div>\n      </div>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" ng-if="!vm.selectedSection.permissions || vm.selectedSection.permissions.association" ng-hide="vm.selectedSection.autoAssociation"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center">\n      <div>\n        <md-icon md-font-icon="icon-information-outline" aria-label="Delete permission"></md-icon>\n        <span class="no-margin font-size-12 line-height-30" translate="STAFF.HELP.SAVE_PERMISSIONS"></span>\n      </div>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveSection()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/userProfiles/edit/view.html",'<div id="staff-userProfile" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-userProfiles-button md-icon-button" aria-label="Go to userProfiles" ng-click="vm.gotoUserProfiles()" translate translate-attr-aria-label="STAFF.GO_TO_USERPROFILES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="userProfile-image" hide-xs>\n          <img ng-src="assets/images/business/userProfiles.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.userProfile.id}}\n            <span ng-if="vm.userProfile.name">{{vm.userProfile.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.userProfile.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.userProfile, $event)" class="md-fab md-amber-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="STAFF.CLONE_USERPROFILE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveUserProfile()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (modulesForm.$invalid) || (download_permissionsForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.userProfile.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.userProfile.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CRUDPERMISSIONS">CrudPermissions</label>\n                <md-select name="crudPermissions" ng-model="vm.userProfile.crudPermissions" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'r\'" disabled> {{ \'STAFF.READ_PERMISSION\' | translate }} </md-option>\n\n                  <md-option ng-value="\'e\'"> {{ \'STAFF.EDIT_PERMISSION\' | translate }} </md-option>\n\n                  <md-option ng-value="\'d\'"> {{ \'STAFF.DELETE_PERMISSION\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'crudPermissions\'].$error" ng-show="generalForm[\'crudPermissions\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CRUDPERMISSIONS_REQUIRED">CrudPermissions field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.privacyEnabled" aria-label="Mask_Sensitive_Data" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.MASK_SENSITIVE_DATA">Mask_Sensitive_Data</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MASK_SENSITIVE_DATA"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.PERMISSIONS">PERMISSIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container modules md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.MODULES">MODULES</div>\n            </div>\n            <div ng-controller="UserProfilePermissionsController as vm_pc" ng-init="vm_pc.init(vm.userProfile, vm.license)" class="userProfile-detail-form-container">\n              <md-grid-list flex md-cols-gt-xs="2" md-cols-gt-sm="2" md-cols-gt-md="4" md-cols-gt-lg="6" md-row-height-gt-xs="2:1" md-row-height-gt-sm="3:1" md-row-height-gt-md="3:1" gt-xs-gutter="4px" gt-sm-gutter="4px" gt-md-gutter="16px" gt-lg-gutter="16px">\n                <md-grid-tile ng-repeat="father in vm_pc.modules" ng-if="vm_pc.userProfile.role !== \'admin\' && !father.permissions.hidden" md-colspan="2">\n                  <md-card flex-xs flex-gt-xs="90" layout="column" no-padding no-margin>\n                    <md-card-header>\n                      <md-card-avatar>\n                        <md-icon class="md-avatar-icon auto-size" md-font-icon="{{father.icon}}" ng-class="{ true: father.status.color }[true]">\n                          <md-tooltip>{{ father.status.info }}</md-tooltip>\n                        </md-icon>\n                      </md-card-avatar>\n                      <md-card-header-text layout-align="center start">\n                        <span class="md-title" translate="{{father.translate}}">{{ father.title }}</span>\n                      </md-card-header-text>\n                      <md-card-actions class="no-margin" layout="row" ng-init="vm_pc.checkSectionResources(father)" ng-if="father.status.tag != \'unlicensed\'">\n                        <md-switch class="auto-height no-margin" ng-model="father.allResourcesEnabled" ng-change="vm_pc.onChangeEnableAllResources(father)" aria-label="Enable all"></md-switch>\n                        <md-button class="md-mini auto-width" aria-label="Manage" ng-click="vm_pc.manageResources(father)" ng-hide="father.permissions && !father.permissions.association">\n                          <md-tooltip>{{\'STAFF.PERMISSIONS_MANAGE\' | translate}}\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-cog"></md-icon>\n                        </md-button>\n                      </md-card-actions>\n                      <md-card-header-text ng-if="father.status.tag === \'unlicensed\'" layout-align="center end">\n                        <span class="md-subhead red-A700-fg">{{ father.status.name }}</span>\n                      </md-card-header-text>\n                    </md-card-header>\n                  </md-card>\n                </md-grid-tile>\n              </md-grid-list>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.DOWNLOADS">DOWNLOADS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="userProfile-detail-form-container download_permissions md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.DOWNLOAD_PERMISSIONS">DOWNLOAD_PERMISSIONS</div>\n            </div>\n            <form name="download_permissionsForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadAttachments" aria-label="Attachments" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.ATTACHMENTS">Attachments</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadCallySquareRecordings" aria-label="CallySquare_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CALLYSQUARE_RECORDINGS">CallySquare_Recordings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadContactManagerLists" aria-label="Contact_Manager_Lists" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.CONTACT_MANAGER_LISTS">Contact_Manager_Lists</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadJscriptySessions" aria-label="Jscripty_Sessions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.JSCRIPTY_SESSIONS">Jscripty_Sessions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadOmnichannelInteractions" aria-label="Omnichannel_Interactions" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.OMNICHANNEL_INTERACTIONS">Omnichannel_Interactions</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadScreenRecordings" aria-label="Screen_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.SCREEN_RECORDINGS">Screen_Recordings</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.userProfile.downloadVoiceRecordings" aria-label="Voice_Recordings" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.VOICE_RECORDINGS">Voice_Recordings</span></md-switch>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/staff/views/userProfiles/userProfiles.html",'<div id="userProfiles" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.USERPROFILES">UserProfiles</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedUserProfiles.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedUserProfiles =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-userProfiles-count">\n          <span>{{vm.selectedUserProfiles.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllUserProfiles()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectUserProfiles()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedUserProfiles" csv-label="true" filename="userProfiles.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedUserProfiles($event)" aria-label="delete selected" translate translate-attr-label="STAFF.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- USERPROFILE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedUserProfiles" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getUserProfiles">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'STAFF.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'STAFF.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="crudPermissions">{{ \'STAFF.CRUDPERMISSIONS\' | translate }}</th>\n                <th md-column md-order-by="privacyEnabled">{{ \'STAFF.MASK_SENSITIVE_DATA\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.userProfiles.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="userProfile" md-select-id="id" ng-repeat="userProfile in vm.userProfiles.rows">\n                <td md-cell ng-if="userProfile.userpic"><img class="avatar" alt="{{userProfile.name}}" ng-src="api/users/{{userProfile.id}}/avatar" /></td>\n                <td md-cell ng-if="!userProfile.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{userProfile.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="id ">{{userProfile.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="name ">{{userProfile.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="description ">{{userProfile.description}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="crudPermissions ">{{userProfile.selectedcrudPermissions}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(userProfile, ev) : vm.createOrEditUserProfile($event, userProfile)" md-cell class="privacyEnabled ">\n                  <md-icon md-colors="{color: {{userProfile.privacyEnabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{userProfile.privacyEnabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(userProfile, $event    )" translate="STAFF.EDIT_USERPROFILE">\n                          Edit UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(userProfile, $event    )" translate="STAFF.CLONE_USERPROFILE">\n                          clone UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' && user.id !== vm.currentUser.id">\n\n                        <md-button ng-click="vm.deleteconfirm(userProfile, $event    )" translate="STAFF.DELETE_USERPROFILE">\n                          Delete UserProfile\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.userProfiles.count}}" md-on-paginate="vm.getUserProfiles" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / USERPROFILE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USERPROFILE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-userProfile-button" ng-click="vm.createOrEditUserProfile($event)" aria-label="add userProfile" translate translate-attr-aria-label="STAFF.ADD_USERPROFILE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD USERPROFILE BUTTON --\x3e\n</div>'),e.put("app/main/apps/staff/views/users/create/dialog.html",'<md-dialog class="user-dialog" aria-label="New User">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="STAFF.ROLE">Role</label>\n        <md-select name="role" ng-model="vm.user.role" autofocus required ng-disabled="!vm.newUser">\n          <md-option ng-value="\'admin\'">Admin</md-option>\n          <md-option ng-value="\'user\'">User</md-option>\n        </md-select>\n        <div ng-messages="userForm[\'role\'].$error" ng-show="userForm[\'role\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.ROLE_REQUIRED">Role field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.user.role === \'user\'" class="md-block">\n        <label translate="STAFF.USERPROFILE">UserProfile</label>\n        <md-select name="userProfileId" ng-model="vm.user.userProfileId" required>\n          <md-option ng-value="userProfileId.id" ng-repeat="userProfileId in vm.userProfiles" ng-disabled="userProfileId.canSelect === false">{{ userProfileId.name }}</md-option>\n        </md-select>\n        <div ng-messages="userForm[\'userProfileId\'].$error" ng-show="userForm[\'userProfileId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERPROFILE_REQUIRED">UserProfile field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.FULLNAME">Fullname</label>\n        <input type="text" name="fullname" ng-model="vm.user.fullname" ng-required="true">\n\n        <div ng-messages="userForm[\'fullname\'].$error" ng-show="userForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.USERNAME">Username</label>\n        <input type="text" name="name" ng-model="vm.user.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" ng-disabled="!vm.newUser">\n\n        <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n        <div ng-messages="userForm[\'name\'].$error" ng-show="userForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.user.email" ng-required="true">\n\n        <div ng-messages="userForm[\'email\'].$error" ng-show="userForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newUser">\n        <label translate="STAFF.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.user.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="STAFF.PASSWORD" required>\n        <div ng-messages="userForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.newUser  && (vm.newUser)">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="userForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.user.description">\n\n        <div ng-messages="userForm[\'description\'].$error" ng-show="userForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.newUser" class="md-block">\n        <md-switch ng-model="vm.user.autointernal" aria-label="AutoInternal"><span translate="STAFF.AUTOINTERNAL">AutoInternal</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="!vm.user.autointernal" class="md-block">\n        <label translate="STAFF.INTERNAL">Internal</label>\n        <input type="text" name="internal" ng-model="vm.user.internal" ng-required="true" ng-disabled="!vm.newUser">\n\n        <div ng-messages="userForm[\'internal\'].$error" ng-show="userForm[\'internal\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.user.userSetting">\n        <ms-client-side-logging user="vm.user"></ms-client-side-logging>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newUser" ng-click="vm.saveUser()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid || userForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newUser" ng-click="vm.addNewUser()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid" aria-label="ADD" translate="STAFF.ADD_USER" translate-attr-aria-label="STAFF.ADD_USER">\n          ADD USER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newUser" ng-click="vm.deleteUser($event)" aria-label="DELETE" translate translate-attr-aria-label="STAFF.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="STAFF.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/apikeymanager/apikeymanager.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.MANAGE_API_KEY\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-card layout-fill layout-padding>\n      <textarea class="api-key-area" ng-model="vm.user.apiKey" rows="6" disabled></textarea>\n    </md-card>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.generateApiKey()" class="send-button md-accent md-raised" aria-label="Generate" translate="{{ vm.user.apiKey === \'N/A\' ? \'STAFF.GENERATE\' : \'STAFF.REGENERATE\' }}" translate-attr-aria-label="STAFF.GENERATE">\n          Generate\n        </md-button>\n        <md-button type="submit" ng-click="vm.removeApiKey()" class="send-button md-accent md-raised" aria-label="Remove" translate="STAFF.REMOVE" translate-attr-aria-label="STAFF.DELETE">\n          Delete\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/changepassword/changepassword.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="userForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'\n                    STAFF.CHANGE_PASSWORD\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block" ng-if="vm.currentUser.id == vm.user.id">\n        <label translate="STAFF.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="STAFF.OLD_PASSWORD" required>\n        <div ng-messages="userForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" translate ng-pattern="vm.passwordPattern" translate-attr-placeholder="STAFF.NEW_PASSWORD" required>\n        <div ng-messages="userForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.PASSWORD_REQUIRED">Password field is\n              required</span>\n          </div>\n\n\n          <div ng-message="pattern">\n            <span translate="STAFF.ERRORS.SECURE_PASSWORD_PATTERN">Must contain\n              at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric\n              character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="STAFF.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n\n\n\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="STAFF.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="userForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="STAFF.ERRORS.CONFIRM_REQUIRED">Confirm field is\n              required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="STAFF.ERRORS.CONFIRM_NOT_MATCH">Your password did\n              not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="userForm.$invalid || userForm.$pristine" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/staff/views/users/edit/view.html",'<div id="staff-user" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-users-button md-icon-button" aria-label="Go to users" ng-click="vm.gotoUsers()" translate translate-attr-aria-label="STAFF.GO_TO_USERS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="user-image" hide-xs>\n          <img ng-src="assets/images/business/users.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.user.id}}\n            <span ng-if="vm.user.name">{{vm.user.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="STAFF.CREATED_AT"></span> <span>{{vm.user.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.apikeymanagerdialog(vm.user, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="apikeymanager">\n        <md-tooltip><span translate="STAFF.APIKEYMANAGER_USER"></span></md-tooltip>\n        <md-icon md-font-icon="fab fa-hubspot"></md-icon>\n      </md-button>\n    </div>\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.changepassworddialog(vm.user, $event)" class="md-fab md-warn md-icon-button" aria-label="changepassword">\n        <md-tooltip><span translate="STAFF.CHANGEPASSWORD_USER"></span></md-tooltip>\n        <md-icon md-font-icon="icon-key-variant"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveUser()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(personal_infoForm.$invalid) || (security_suiteForm.$invalid) || (change_avatarForm.$invalid) || (generalForm.$invalid)" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.ACCOUNT">ACCOUNT</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container personal_info md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.PERSONAL_INFO">PERSONAL_INFO</div>\n            </div>\n            <form name="personal_infoForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ROLE">Role</label>\n                <md-select name="role" ng-model="vm.user.role" autofocus required disabled>\n                  <md-option ng-value="\'admin\'">Admin</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'role\'].$error" ng-show="personal_infoForm[\'role\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ROLE_REQUIRED">Role field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.role === \'user\'" class="md-block">\n                <label translate="STAFF.USERPROFILE">UserProfile</label>\n                <md-select name="userProfileId" ng-model="vm.user.userProfileId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="userProfileId.id" ng-repeat="userProfileId in vm.userProfiles" ng-disabled="userProfileId.canSelect === false">{{ userProfileId.name }}</md-option>\n                </md-select>\n                <div ng-messages="personal_infoForm[\'userProfileId\'].$error" ng-show="personal_infoForm[\'userProfileId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERPROFILE_REQUIRED">UserProfile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.FULLNAME">Fullname</label>\n                <input type="text" name="fullname" ng-model="vm.user.fullname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'fullname\'].$error" ng-show="personal_infoForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.FULLNAME_REQUIRED">Fullname field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.USERNAME">Username</label>\n                <input type="text" name="name" ng-model="vm.user.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" disabled>\n                <div class="hint"><span translate="STAFF.HELP.USERNAME"></span></div>\n                <div ng-messages="personal_infoForm[\'name\'].$error" ng-show="personal_infoForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.USERNAME_REQUIRED">Username field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="STAFF.ERRORS.USERNAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Username must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.user.email" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'email\'].$error" ng-show="personal_infoForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="STAFF.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PHONE">Phone</label>\n                <input type="text" name="phone" ng-model="vm.user.phone" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'phone\'].$error" ng-show="personal_infoForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.MOBILE">Mobile</label>\n                <input type="text" name="mobile" ng-model="vm.user.mobile" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'mobile\'].$error" ng-show="personal_infoForm[\'mobile\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.MOBILE_REQUIRED">Mobile field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.user.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="personal_infoForm[\'description\'].$error" ng-show="personal_infoForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="user-detail-form-container security_suite md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.SECURITY_SUITE">SECURITY_SUITE</div>\n            </div>\n            <form name="security_suiteForm" novalidate>\n              <md-input-container ng-if="vm.user.passwordResetAt != null" class="md-block">\n                <label translate="STAFF.LAST_PASSWORD_RESET_AT">Last_Password_Reset_At</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.user.passwordResetAt" autofocus disabled>\n                <div class="hint"><span translate="STAFF.HELP.LAST_PASSWORD_RESET_AT"></span></div>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.LAST_PASSWORD_RESET_AT_REQUIRED">Last_Password_Reset_At field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.passwordResetAt == null" class="md-block">\n                <label translate="STAFF.NO_PASSWORD_CHANGE">No_Password_Change</label>\n                <input type="text" name="passwordResetAt" ng-model="vm.user.passwordResetAt" disabled>\n                <div ng-messages="security_suiteForm[\'passwordResetAt\'].$error" ng-show="security_suiteForm[\'passwordResetAt\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NO_PASSWORD_CHANGE_REQUIRED">No_Password_Change field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.APIKEY">ApiKey</label>\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-apiKey" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: \'API Key copied!\' });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-apiKey" name="apiKey" ng-model="vm.user.apiKey" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="STAFF.HELP.APIKEY"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.id != vm.currentUser.id && vm.currentUser.role == \'admin\'" class="md-block">\n                <md-switch ng-model="vm.user.disabled" aria-label="Disabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.DISABLED">Disabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.DISABLED"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.user.id != vm.currentUser.id && vm.currentUser.role == \'admin\' && vm.user.disabled == 0" class="md-block">\n                <md-switch ng-model="vm.user.blocked" aria-label="Blocked" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.BLOCKED">Blocked</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.BLOCKED"></span></div>\n              </md-input-container>\n            </form>\n          </div>\n          <div class="user-detail-form-container authentication md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.AUTHENTICATION">AUTHENTICATION</div>\n            </div>\n            <form name="authenticationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.user.adSsoEnabled" aria-label="AD_SSO_Enabled" ng-disabled="!vm.crudPermissions.canEdit"><span translate="STAFF.AD_SSO_ENABLED">AD_SSO_Enabled</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.AD_SSO_ENABLED"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="user-detail-form-container change_avatar md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CHANGE_AVATAR">CHANGE_AVATAR</div>\n            </div>\n            <div ng-controller="Userchange_avatarController as vm_ca" ng-init="vm_ca.init(vm.user, vm.crudPermissions)" class="user-detail-form-container md-background-bg md-whiteframe-1dp">\n              <div id="user-image-uploader" flow-init="vm_ca.ngFlowOptions" flow-name="vm_ca.ngFlow.flow" flow-files-submitted="vm_ca.upload()" flow-file-added="vm_ca.fileAdded($file)" flow-file-success="vm_ca.fileSuccess($file, $message)" flow-complete="vm_ca.uploadComplete()" flow-drop flow-drag-enter="vm_ca.dropping=true" flow-drag-leave="vm_ca.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n                <div class="drop-text hint-text" layout="row" layout-align="center center">\n                  <span translate="EC.DROP_TO_UPLOAD">Drop to upload</span>\n                </div>\n                <div class="upload-button" layout="column" layout-align="center center">\n                  <md-button class="md-accent md-raised" flow-btn ng-disabled="!vm_ca.crudPermissions.canEdit">\n                    Upload\n                  </md-button>\n                  <span class="secondary-text mt-8">You can also drop images here to upload. Only PNG, JPG - Max. 8MB</span>\n                </div>\n                <div layout="row" layout-align="start start" layout-wrap>\n                  <div ng-repeat="change_avatarimage in vm_ca.user.images" ng-switch="change_avatarimage.type">\n                    <div class="user-image uploading" ng-switch-when="uploading" layout="row" layout-align="center center">\n                      <div class="overlay" layout="column" layout-align="center center">\n                        <md-progress-linear md-mode="determinate" value="{{change_avatarimage.file.progress() * 100}}">\n                        </md-progress-linear>\n                      </div>\n                      <img class="media" flow-img="change_avatarimage.file">\n                    </div>\n                    <div class="user-image" ng-switch-when="image" layout="row" layout-align="center center">\n                      <img class="media" ng-src="{{change_avatarimage.url}}">\n                    </div>\n                  </div>\n                </div>\n              </div>\n            </div>\n          </div>\n          <div class="user-detail-form-container internal-chat md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.INTERNAL_MESSENGER">INTERNAL_MESSENGER</div>\n            </div>\n            <form name="internalChatForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.user.messengerSoundNotification" \n                aria-label="messengerSoundNotification" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="STAFF.MESSENGERSOUNDNOTIFICATION">MESSENGERSOUNDNOTIFICATION</span></md-switch>\n                <div class="hint"><span translate="STAFF.HELP.MESSENGERSOUNDNOTIFICATION"></span></div>\n              </md-input-container>\n            </form>\n          </div>          \n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.VOICE">VOICE</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container ng-if="!vm.user.autointernal" class="md-block">\n                <label translate="STAFF.INTERNAL">Internal</label>\n                <input type="text" name="internal" ng-model="vm.user.internal" ng-required="true" autofocus disabled>\n                <div ng-messages="generalForm[\'internal\'].$error" ng-show="generalForm[\'internal\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.INTERNAL_REQUIRED">Internal field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.user.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'transport\'].$error" ng-show="generalForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.NAT">NAT</label>\n                <md-select name="nat" ng-model="vm.user.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.NAT_REQUIRED">NAT field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.user.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="STAFF.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.user.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.CALLGROUP">Callgroup</label>\n                <input type="text" name="callgroup" ng-model="vm.user.callgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.CALLGROUP"></span></div>\n                <div ng-messages="generalForm[\'callgroup\'].$error" ng-show="generalForm[\'callgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.CALLGROUP_REQUIRED">Callgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.PICKUPGROUP">Pickupgroup</label>\n                <input type="text" name="pickupgroup" ng-model="vm.user.pickupgroup" ng-disabled="!vm.crudPermissions.canEdit">\n                <div class="hint"><span translate="STAFF.HELP.PICKUPGROUP"></span></div>\n                <div ng-messages="generalForm[\'pickupgroup\'].$error" ng-show="generalForm[\'pickupgroup\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.PICKUPGROUP_REQUIRED">Pickupgroup field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="STAFF.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.user.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'videosupport\'].$error" ng-show="generalForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="STAFF.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="STAFF.CLIENT_LOGS">CLIENT-SIDE LOGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="user-detail-form-container client_logs md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="STAFF.CLIENT_LOGS">\n                CLIENT-SIDE LOGS\n              </div>\n            </div>\n            <ms-client-side-logging user="vm.user" on-user-update="vm.refreshUser()"></ms-client-side-logging>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/staff/views/users/users.html",'<div id="users" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-account-multiple" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="STAFF.USERS">Users</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="STAFF.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedUsers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedUsers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="STAFF.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-users-count">\n          <span>{{vm.selectedUsers.length}}</span>\n          <span translate="STAFF.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="STAFF.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllUsers()" translate="STAFF.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectUsers()" translate="STAFF.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedUsers" csv-label="true" filename="users.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- USER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedUsers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getUsers">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="role">{{ \'STAFF.ROLE\' | translate }}</th>\n                <th md-column md-order-by="userProfileId">{{ \'STAFF.USERPROFILE\' | translate }}</th>\n                <th md-column md-order-by="fullname">{{ \'STAFF.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'STAFF.USERNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'STAFF.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'STAFF.PHONE\' | translate }}</th>\n                <th md-column md-order-by="mobile">{{ \'STAFF.MOBILE\' | translate }}</th>\n                <th md-column md-order-by="internal">{{ \'STAFF.INTERNAL\' | translate }}</th>\n                <th md-column md-order-by="disabled">{{ \'STAFF.DISABLED\' | translate }}</th>\n                <th md-column md-order-by="blocked">{{ \'STAFF.BLOCKED\' | translate }}</th>\n                <th md-column>{{ \'STAFF.CLIENT_LOGS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.users.rows.length">\n                <td md-cell colspan="11">\n                  <div layout="row" layout-align="center center">\n                    <span translate="STAFF.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="user" md-select-id="id" ng-repeat="user in vm.users.rows">\n                <td md-cell ng-if="user.userpic"><img class="avatar" alt="{{user.name}}" ng-src="api/users/{{user.id}}/avatar" /></td>\n                <td md-cell ng-if="!user.userpic"><img class="avatar" alt="{{user.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="role ">{{ vm.arrayrole[user.role].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="userProfileId font-weight-600">{{ (vm.userProfiles | filter : {\'id\':user.userProfileId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="fullname font-weight-600">{{user.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="name ">{{user.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="email ">{{user.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="phone ">{{user.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="mobile ">{{user.mobile}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="internal ">{{user.internal}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="disabled ">\n                  <md-icon md-colors="{color: {{user.disabled ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{user.disabled ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditUser($event, user)" md-cell class="blocked ">\n                  <md-icon md-colors="{color: {{user.blocked ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{user.blocked ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(user, ev) : vm.createOrEditAgent($event, user)" md-cell class="client-side-logging">\n                  <ms-client-side-logging-icon user="user"></ms-client-side-logging-icon>\n                </td>\n                <td md-cell class="actions">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editstate(user, $event    )" translate="STAFF.EDIT_USER">\n                          Edit User\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' && user.id !== vm.currentUser.id">\n                        <md-button ng-click="vm.deleteconfirm(user, $event    )" translate="STAFF.DELETE_USER">\n                          Delete User\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{\'STAFF.PAGE\' | translate}}:\', rowsPerPage: \'{{\'STAFF.ROWSPERPAGE\' | translate}}:\', of: \'{{\'STAFF.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.users.count}}" md-on-paginate="vm.getUsers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / USER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD USER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-user-button" ng-click="vm.createOrEditUser($event)" aria-label="add user" translate translate-attr-aria-label="STAFF.ADD_USER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD USER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/cannedAnswers/cannedAnswers.html",'<div id="cannedAnswers" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CANNEDANSWERS">CannedAnswers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCannedAnswers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCannedAnswers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-cannedAnswers-count">\n          <span>{{vm.selectedCannedAnswers.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCannedAnswers()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCannedAnswers()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCannedAnswers" csv-label="true" filename="cannedAnswers.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CANNEDANSWER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCannedAnswers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCannedAnswers">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'TOOLS.KEY\' | translate }}</th>\n                <th md-column md-order-by="value">{{ \'TOOLS.VALUE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.cannedAnswers.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="cannedAnswer" md-select-id="id" ng-repeat="cannedAnswer in vm.cannedAnswers.rows">\n                <td md-cell ng-if="cannedAnswer.userpic"><img class="avatar" alt="{{cannedAnswer.name}}" ng-src="api/users/{{cannedAnswer.id}}/avatar" /></td>\n                <td md-cell ng-if="!cannedAnswer.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{cannedAnswer.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="id ">{{cannedAnswer.id}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="key ">{{cannedAnswer.key}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="value ">{{cannedAnswer.value}}</td>\n                <td ng-click="vm.createOrEditCannedAnswer($event, cannedAnswer)" md-cell class="description ">{{cannedAnswer.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(cannedAnswer, $event    )" translate="TOOLS.EDIT_CANNEDANSWER">\n                          Edit CannedAnswer\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(cannedAnswer, $event    )" translate="TOOLS.DELETE_CANNEDANSWER">\n                          Delete CannedAnswer\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.cannedAnswers.count}}" md-on-paginate="vm.getCannedAnswers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CANNEDANSWER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CANNEDANSWER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-cannedAnswer-button" ng-click="vm.createOrEditCannedAnswer($event)" aria-label="add cannedAnswer" translate translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CANNEDANSWER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/cannedAnswers/create/dialog.html",'<md-dialog class="cannedAnswer-dialog" aria-label="New CannedAnswer">\n  <form name="cannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.cannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="cannedAnswerForm[\'key\'].$error" ng-show="cannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 255}\'>Key must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.cannedAnswer.value" required></textarea>\n\n        <div ng-messages="cannedAnswerForm[\'value\'].$error" ng-show="cannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.cannedAnswer.description">\n\n        <div ng-messages="cannedAnswerForm[\'description\'].$error" ng-show="cannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCannedAnswer" ng-click="vm.saveCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="cannedAnswerForm.$invalid || cannedAnswerForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCannedAnswer" ng-click="vm.addNewCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="cannedAnswerForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CANNEDANSWER" translate-attr-aria-label="TOOLS.ADD_CANNEDANSWER">\n          ADD CANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCannedAnswer" ng-click="vm.deleteCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/contact_item_types/contact_item_types.html",'<div id="contact_item_types" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CONTACTITEMTYPE">ContactItemType</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContactItemType.length > 0" class="selected-bar header animate-slide-down md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedContactItemType =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-contact_item_types-count">\n          <span>{{vm.selectedContactItemType.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContactItemType()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContactItemType()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContactItemType" csv-label="true" filename="contact_item_types.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedContactItemType($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable" ms-scroll>\n\n\n      \x3c!-- CONTACTITEMTYPE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedContactItemType" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContactItemType">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="OrderBy">{{ \'TOOLS.ORDER_BY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.contact_item_types.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="contactItemType" md-select-id="id" ng-repeat="contactItemType in vm.contact_item_types.rows">\n                <td md-cell ng-if="contactItemType.userpic"><img class="avatar" alt="{{contactItemType.name}}" ng-src="api/users/{{contactItemType.id}}/avatar" /></td>\n                <td md-cell ng-if="!contactItemType.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{contactItemType.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="id ">{{contactItemType.id}}</td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="name ">{{contactItemType.name}}</td>\n                <td ng-click="vm.createOrEditContactItemType($event, contactItemType)" md-cell class="OrderBy ">{{contactItemType.OrderBy}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(contactItemType, $event    )" translate="TOOLS.EDIT_CONTACTITEMTYPE">\n                          Edit ContactItemType\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(contactItemType, $event    )" translate="TOOLS.DELETE_CONTACTITEMTYPE">\n                          Delete ContactItemType\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contact_item_types.count}}" md-on-paginate="vm.getContactItemType" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CONTACTITEMTYPE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CONTACTITEMTYPE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-contactItemType-button" ng-click="vm.createOrEditContactItemType($event)" aria-label="add contactItemType" translate translate-attr-aria-label="TOOLS.ADD_CONTACTITEMTYPE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CONTACTITEMTYPE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/contact_item_types/create/dialog.html",'<md-dialog class="contactItemType-dialog" aria-label="New ContactItemType">\n  <form name="contactItemTypeForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content ms-scroll>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.contactItemType.name" ng-required="true" autofocus>\n\n        <div ng-messages="contactItemTypeForm[\'name\'].$error" ng-show="contactItemTypeForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.ORDER_BY">Order_by</label>\n        <input type="integer" name="OrderBy" ng-model="vm.contactItemType.OrderBy" ng-required="true">\n\n        <div ng-messages="contactItemTypeForm[\'OrderBy\'].$error" ng-show="contactItemTypeForm[\'OrderBy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ORDER_BY_REQUIRED">Order_by field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.contactItemType.rgbBackgroundColor" label="{{\'TOOLS.RGBBACKGROUNDCOLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newContactItemType" ng-click="vm.saveContactItemType()" class="send-button md-accent md-raised" ng-disabled="contactItemTypeForm.$invalid || contactItemTypeForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newContactItemType" ng-click="vm.addNewContactItemType()" class="send-button md-accent md-raised" ng-disabled="contactItemTypeForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CONTACTITEMTYPE" translate-attr-aria-label="TOOLS.ADD_CONTACTITEMTYPE">\n          ADD CONTACTITEMTYPE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContactItemType" ng-click="vm.deleteContactItemType($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/create/dialog.html",'<md-dialog class="customDashboard-dialog" aria-label="New CustomDashboard">\n  <form name="customDashboardForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus>\n\n        <div ng-messages="customDashboardForm[\'name\'].$error" ng-show="customDashboardForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.customDashboard.description">\n\n        <div ng-messages="customDashboardForm[\'description\'].$error" ng-show="customDashboardForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newCustomDashboard" ng-click="vm.saveCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid || customDashboardForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newCustomDashboard" ng-click="vm.addNewCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_CUSTOMDASHBOARD" translate-attr-aria-label="TOOLS.ADD_CUSTOMDASHBOARD">\n          ADD CUSTOMDASHBOARD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newCustomDashboard" ng-click="vm.deleteCustomDashboard($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/customDashboards.html",'<div id="customDashboards" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.CUSTOMDASHBOARDS">CustomDashboards</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedCustomDashboards.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedCustomDashboards =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-customDashboards-count">\n          <span>{{vm.selectedCustomDashboards.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllCustomDashboards()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectCustomDashboards()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedCustomDashboards" csv-label="true" filename="customDashboards.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedCustomDashboards($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CUSTOMDASHBOARD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedCustomDashboards" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getCustomDashboards">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.customDashboards.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="customDashboard" md-select-id="id" ng-repeat="customDashboard in vm.customDashboards.rows">\n                <td md-cell ng-if="customDashboard.userpic"><img class="avatar" alt="{{customDashboard.name}}" ng-src="api/users/{{customDashboard.id}}/avatar" /></td>\n                <td md-cell ng-if="!customDashboard.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{customDashboard.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="id ">{{customDashboard.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="name ">{{customDashboard.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(customDashboard, ev) : vm.createOrEditCustomDashboard($event, customDashboard)" md-cell class="description ">{{customDashboard.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(customDashboard, $event    )" translate="TOOLS.EDIT_CUSTOMDASHBOARD">\n                          Edit CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(customDashboard, $event    )" translate="TOOLS.CLONE_CUSTOMDASHBOARD">\n                          clone CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotodashboardgoto(customDashboard, $event    )" translate="TOOLS.GOTODASHBOARD_CUSTOMDASHBOARD">\n                          goToDashboard CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(customDashboard, $event    )" translate="TOOLS.DELETE_CUSTOMDASHBOARD">\n                          Delete CustomDashboard\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.customDashboards.count}}" md-on-paginate="vm.getCustomDashboards" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CUSTOMDASHBOARD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CUSTOMDASHBOARD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-customDashboard-button" ng-click="vm.createOrEditCustomDashboard($event)" aria-label="add customDashboard" translate translate-attr-aria-label="TOOLS.ADD_CUSTOMDASHBOARD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CUSTOMDASHBOARD BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/customDashboards/edit/clone/clone.html",'<md-dialog class="customDashboard-dialog" aria-label="Clone CustomDashboard">\n  <form name="customDashboardForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus>\n\n        <div ng-messages="customDashboardForm[\'name\'].$error" ng-show="customDashboardForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneCustomDashboard()" class="send-button md-accent md-raised" ng-disabled="customDashboardForm.$invalid" aria-label="CLONE" translate="TOOLS.CLONE_CUSTOMDASHBOARD" translate-attr-aria-label="TOOLS.CLONE_CUSTOMDASHBOARD">\n        CLONE CUSTOMDASHBOARD\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/edit/dashboard/dialog.html",'<md-dialog class="dashboarditem-dialog" aria-label="New DashboardItem">\n  <form name="dashboarditemForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.dashboarditem.type" ng-change="vm.onTypeChange()" autofocus ng-disabled="!vm.newDashboardItem">\n\n          <md-option ng-value="\'counter\'"> {{ \'TOOLS.COUNTER\' | translate }} </md-option>\n\n          <md-option ng-value="\'multibar-chart\'"> {{ \'TOOLS.MULTIBARCHART\' | translate }} </md-option>\n\n          <md-option ng-value="\'pie-chart\'"> {{ \'TOOLS.PIECHART\' | translate }} </md-option>\n\n          <md-option ng-value="\'web-report\'"> {{ \'TOOLS.WEBREPORT\' | translate }} </md-option>\n\n          <md-option ng-value="\'iframe\'"> {{ \'TOOLS.IFRAME\' | translate }} </md-option>\n\n          <md-option ng-value="\'clock\'"> {{ \'TOOLS.CLOCK\' | translate }} </md-option>\n\n          <md-option ng-value="\'custom\'"> {{ \'TOOLS.CUSTOMTYPE\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'type\'].$error" ng-show="dashboarditemForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\',\'counter\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.CHANNEL">Channel</label>\n        <md-select name="attrChannel" ng-model="vm.dashboarditem.attrChannel" required>\n\n          <md-option ng-value="\'chat\'"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n\n          <md-option ng-value="\'mail\'"> {{ \'TOOLS.EMAIL\' | translate }} </md-option>\n\n          <md-option ng-value="\'sms\'"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n\n          <md-option ng-value="\'openchannel\'"> {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n\n          <md-option ng-value="\'fax\'"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n\n          <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n\n          <md-option ng-value="\'whatsapp\'"> {{ \'TOOLS.WHATSAPP\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrChannel\'].$error" ng-show="dashboarditemForm[\'attrChannel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="![\'web-report\', \'iframe\',\'clock\', \'custom\'].includes(vm.dashboarditem.type)">\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'mail\'" class="md-block">\n          <label translate="TOOLS.FILTEREMAILACCOUNTS">FilterEmailAccounts</label>\n          <md-select name="attrEmailAccounts" ng-model="vm.dashboarditem.attrEmailAccounts" multiple>\n            <md-option ng-value="attrEmailAccounts.id" ng-repeat="attrEmailAccounts in vm.mailAccount" ng-disabled="attrEmailAccounts.canSelect === false">{{ attrEmailAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrEmailAccounts\'].$error" ng-show="dashboarditemForm[\'attrEmailAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTEREMAILACCOUNTS_REQUIRED">FilterEmailAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'fax\'" class="md-block">\n          <label translate="TOOLS.FILTERFAXACCOUNTS">FilterFaxAccounts</label>\n          <md-select name="attrFaxAccounts" ng-model="vm.dashboarditem.attrFaxAccounts" multiple>\n            <md-option ng-value="attrFaxAccounts.id" ng-repeat="attrFaxAccounts in vm.faxAccount" ng-disabled="attrFaxAccounts.canSelect === false">{{ attrFaxAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrFaxAccounts\'].$error" ng-show="dashboarditemForm[\'attrFaxAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERFAXACCOUNTS_REQUIRED">FilterFaxAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'sms\'" class="md-block">\n          <label translate="TOOLS.FILTERSMSACCOUNTS">FilterSmsAccounts</label>\n          <md-select name="attrSmsAccounts" ng-model="vm.dashboarditem.attrSmsAccounts" multiple>\n            <md-option ng-value="attrSmsAccounts.id" ng-repeat="attrSmsAccounts in vm.smsAccount" ng-disabled="attrSmsAccounts.canSelect === false">{{ attrSmsAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrSmsAccounts\'].$error" ng-show="dashboarditemForm[\'attrSmsAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERSMSACCOUNTS_REQUIRED">FilterSmsAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'openchannel\'" class="md-block">\n          <label translate="TOOLS.FILTEROPENCHANNELACCOUNTS">FilterOpenchannelAccounts</label>\n          <md-select name="attrOpenchannelAccounts" ng-model="vm.dashboarditem.attrOpenchannelAccounts" multiple>\n            <md-option ng-value="attrOpenchannelAccounts.id" ng-repeat="attrOpenchannelAccounts in vm.openchannelAccount" ng-disabled="attrOpenchannelAccounts.canSelect === false">{{ attrOpenchannelAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrOpenchannelAccounts\'].$error" ng-show="dashboarditemForm[\'attrOpenchannelAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTEROPENCHANNELACCOUNTS_REQUIRED">FilterOpenchannelAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'whatsapp\'" class="md-block">\n          <label translate="TOOLS.FILTERWHATSAPPACCOUNTS">FilterWhatsappAccounts</label>\n          <md-select name="attrWhatsappAccounts" ng-model="vm.dashboarditem.attrWhatsappAccounts" multiple>\n            <md-option ng-value="attrWhatsappAccounts.id" ng-repeat="attrWhatsappAccounts in vm.whatsappAccount" ng-disabled="attrWhatsappAccounts.canSelect === false">{{ attrWhatsappAccounts.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrWhatsappAccounts\'].$error" ng-show="dashboarditemForm[\'attrWhatsappAccounts\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERWHATSAPPACCOUNTS_REQUIRED">FilterWhatsappAccounts field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n        <md-input-container ng-if="vm.dashboarditem.attrChannel === \'chat\'" class="md-block">\n          <label translate="TOOLS.FILTERCHATWEBSITES">FilterChatWebsites</label>\n          <md-select name="attrChatWebsites" ng-model="vm.dashboarditem.attrChatWebsites" multiple>\n            <md-option ng-value="attrChatWebsites.id" ng-repeat="attrChatWebsites in vm.chatWebsite" ng-disabled="attrChatWebsites.canSelect === false">{{ attrChatWebsites.name }}</md-option>\n          </md-select>\n          <div ng-messages="dashboarditemForm[\'attrChatWebsites\'].$error" ng-show="dashboarditemForm[\'attrChatWebsites\'].$touched" role="alert">\n            <div ng-message="required">\n              <span translate="TOOLS.ERRORS.FILTERCHATWEBSITES_REQUIRED">FilterChatWebsites field is required</span>\n            </div>\n          </div>\n        </md-input-container>\n      </div>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\', \'counter\'].includes(vm.dashboarditem.type) && vm.dashboarditem.attrChannel === \'voice\'" class="md-block">\n        <label translate="TOOLS.FILTERVOICEQUEUES">FilterVoiceQueues</label>\n        <md-select name="attrVoiceQueues" ng-model="vm.dashboarditem.attrVoiceQueues" multiple>\n          <md-option ng-value="attrVoiceQueues.id" ng-repeat="attrVoiceQueues in vm.voiceQueues" ng-disabled="attrVoiceQueues.canSelect === false">{{ attrVoiceQueues.name }}</md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrVoiceQueues\'].$error" ng-show="dashboarditemForm[\'attrVoiceQueues\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FILTERVOICEQUEUES_REQUIRED">FilterVoiceQueues field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TITLE">Title</label>\n        <input type="text" name="title" ng-model="vm.dashboarditem.title" md-maxlength="255" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'title\'].$error" ng-show="dashboarditemForm[\'title\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TITLE_REQUIRED">Title field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.TITLE_MAX_LENGTH" translate-values=\'{max: 255}\'>Title must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TITLEFONTSIZE">TitleFontSize</label>\n        <input type="number" name="titleFontSize" ng-model="vm.dashboarditem.titleFontSize" value="12">\n\n        <div ng-messages="dashboarditemForm[\'titleFontSize\'].$error" ng-show="dashboarditemForm[\'titleFontSize\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TITLEFONTSIZE_REQUIRED">TitleFontSize field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'iframe\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="attrUrl" ng-model="vm.dashboarditem.attrUrl" value="https://" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrUrl\'].$error" ng-show="dashboarditemForm[\'attrUrl\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'custom\'" class="md-block">\n        <label translate="TOOLS.PATH">Path</label>\n        <input type="text" name="attrPath" ng-model="vm.dashboarditem.attrPath" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrPath\'].$error" ng-show="dashboarditemForm[\'attrPath\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PATH_REQUIRED">Path field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'clock\'" class="md-block">\n        <label translate="TOOLS.FORMAT">Format</label>\n        <input type="text" name="attrHourFormat" ng-model="vm.dashboarditem.attrHourFormat" value="HH:mm:ss" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrHourFormat\'].$error" ng-show="dashboarditemForm[\'attrHourFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FORMAT_REQUIRED">Format field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'clock\'" class="md-block">\n        <label translate="TOOLS.TIMEZONE">Timezone</label>\n        <md-select name="attrTimezone" ng-model="vm.dashboarditem.attrTimezone" required>\n          <md-option ng-value="\'-12.00\'">GMT-12.00</md-option>\n          <md-option ng-value="\'-11.00\'">GMT-11.00</md-option>\n          <md-option ng-value="\'-10.00\'">GMT-10.00</md-option>\n          <md-option ng-value="\'-9.00\'">GMT-9.00</md-option>\n          <md-option ng-value="\'-8.00\'">GMT-8.00</md-option>\n          <md-option ng-value="\'-7.00\'">GMT-7.00</md-option>\n          <md-option ng-value="\'-6.00\'">GMT-6.00</md-option>\n          <md-option ng-value="\'-5.00\'">GMT-5.00</md-option>\n          <md-option ng-value="\'-4.00\'">GMT-4.00</md-option>\n          <md-option ng-value="\'-3.30\'">GMT-3.30</md-option>\n          <md-option ng-value="\'-3.00\'">GMT-3.00</md-option>\n          <md-option ng-value="\'-2.00\'">GMT-2.00</md-option>\n          <md-option ng-value="\'-1.00\'">GMT-1.00</md-option>\n          <md-option ng-value="\'0.00\'">GMT 0.00</md-option>\n          <md-option ng-value="\'1.00\'">GMT+1.00</md-option>\n          <md-option ng-value="\'2.00\'">GMT+2.00</md-option>\n          <md-option ng-value="\'3.00\'">GMT+3.00</md-option>\n          <md-option ng-value="\'3.30\'">GMT+3.30</md-option>\n          <md-option ng-value="\'4.00\'">GMT+4.00</md-option>\n          <md-option ng-value="\'4.30\'">GMT+4.30</md-option>\n          <md-option ng-value="\'5.00\'">GMT+5.00</md-option>\n          <md-option ng-value="\'5.30\'">GMT+5.30</md-option>\n          <md-option ng-value="\'5.45\'">GMT+5.45</md-option>\n          <md-option ng-value="\'6.00\'">GMT+6.00</md-option>\n          <md-option ng-value="\'6.30\'">GMT+6.30</md-option>\n          <md-option ng-value="\'7.00\'">GMT+7.00</md-option>\n          <md-option ng-value="\'8.00\'">GMT+8.00</md-option>\n          <md-option ng-value="\'9.00\'">GMT+9.00</md-option>\n          <md-option ng-value="\'9.30\'">GMT+9.30</md-option>\n          <md-option ng-value="\'10.00\'">GMT+10.00</md-option>\n          <md-option ng-value="\'11.00\'">GMT+11.00</md-option>\n          <md-option ng-value="\'12.00\'">GMT+12.00</md-option>\n          <md-option ng-value="\'13.00\'">GMT+13.00</md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrTimezone\'].$error" ng-show="dashboarditemForm[\'attrTimezone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TIMEZONE_REQUIRED">Timezone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type === \'counter\'" class="md-block">\n        <label translate="TOOLS.METRIC">Metric</label>\n        <md-select name="attrMetric" ng-model="vm.dashboarditem.attrMetric" required>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrMetric\'].$error" ng-show="dashboarditemForm[\'attrMetric\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.METRIC_REQUIRED">Metric field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE1">Serie1</label>\n        <md-select name="attrSerie1" ng-model="vm.dashboarditem.attrSerie1" required>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie1\'].$error" ng-show="dashboarditemForm[\'attrSerie1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE1_REQUIRED">Serie1 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE2">Serie2</label>\n        <md-select name="attrSerie2" ng-model="vm.dashboarditem.attrSerie2">\n\n          <md-option ng-value="\'null\'"> {{ \'TOOLS.NONE\' | translate }} </md-option>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie2\'].$error" ng-show="dashboarditemForm[\'attrSerie2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE2_REQUIRED">Serie2 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'multibar-chart\', \'pie-chart\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.SERIE3">Serie3</label>\n        <md-select name="attrSerie3" ng-model="vm.dashboarditem.attrSerie3">\n\n          <md-option ng-value="\'null\'"> {{ \'TOOLS.NONE\' | translate }} </md-option>\n\n          <md-option ng-value="\'total\'"> {{ \'TOOLS.TOTAL\' | translate }} </md-option>\n\n          <md-option ng-value="\'abandoned\'" ng-if="vm.dashboarditem.attrChannel === \'voice\' || vm.dashboarditem.attrChannel === \'chat\'"> {{ \'TOOLS.ABANDONED\' | translate }} </md-option>\n\n          <md-option ng-value="\'waiting\'"> {{ \'TOOLS.WAITING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.TALKING\' | translate }} </md-option>\n\n          <md-option ng-value="\'talking\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.OPENED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel === \'voice\'"> {{ \'TOOLS.ANSWERED\' | translate }} </md-option>\n\n          <md-option ng-value="\'answered\'" ng-if="vm.dashboarditem.attrChannel !== \'voice\'"> {{ \'TOOLS.MANAGED\' | translate }} </md-option>\n\n          <md-option ng-value="\'unmanaged\'"> {{ \'TOOLS.UNMANAGED\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="dashboarditemForm[\'attrSerie3\'].$error" ng-show="dashboarditemForm[\'attrSerie3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SERIE3_REQUIRED">Serie3 field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'web-report\'" class="md-block">\n        <label translate="TOOLS.REPORT">Report</label>\n        <input type="search" name="report" ng-model="vm.dashboarditem.report" ng-required="true" autocomplete="off" ng-click="vm.searchReport()">\n        <md-icon md-font-icon="icon-magnify" ng-click="vm.searchReport()" aria-label="Search Report"></md-icon>\n        <div ng-messages="dashboarditemForm[\'report\'].$error" ng-show="dashboarditemForm[\'report\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REPORT_REQUIRED">Report field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.dashboarditem.type == \'web-report\'" class="md-block">\n        <label translate="TOOLS.REFRESH">Refresh</label>\n        <input type="number" name="attrRefresh" ng-model="vm.dashboarditem.attrRefresh" min="5" value="10" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrRefresh\'].$error" ng-show="dashboarditemForm[\'attrRefresh\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REFRESH_REQUIRED">Refresh field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.REFRESH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Refresh must be a valid greater or equal than</span> <span>5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="[\'counter\', \'clock\'].includes(vm.dashboarditem.type)" class="md-block">\n        <label translate="TOOLS.FONTSIZE">FontSize</label>\n        <input type="number" name="attrFontSize" ng-model="vm.dashboarditem.attrFontSize" min="12" max="40" value="20" ng-required="true">\n\n        <div ng-messages="dashboarditemForm[\'attrFontSize\'].$error" ng-show="dashboarditemForm[\'attrFontSize\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FONTSIZE_REQUIRED">FontSize field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.FONTSIZE_MUST_BE_GREATER_THAN_OR_EQUAL_TO">FontSize must be a valid greater or equal than</span> <span>12</span>\n          </div>\n          <div ng-message="max">\n            <span translate="TOOLS.ERRORS.FONTSIZE_MUST_BE_LESS_THAN_OR_EQUAL_TO">FontSize must be a valid greater or equal than</span> <span>40</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.dashboarditem.foreground" label="{{\'TOOLS.FOREGROUND\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n      <div flex md-color-picker ng-model="vm.dashboarditem.background" label="{{\'TOOLS.BACKGROUND\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LINK">link</label>\n        <input type="url" name="link" ng-model="vm.dashboarditem.link">\n\n        <div ng-messages="dashboarditemForm[\'link\'].$error" ng-show="dashboarditemForm[\'link\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LINK_REQUIRED">link field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.LINK_MUST_VALID_URL">link must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDashboardItem" ng-click="vm.saveDashboardItem()" class="send-button md-accent md-raised" ng-disabled="dashboarditemForm.$invalid || dashboarditemForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDashboardItem" ng-click="vm.addNewDashboardItem()" class="send-button md-accent md-raised" ng-disabled="dashboarditemForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_DASHBOARDITEM" translate-attr-aria-label="TOOLS.ADD_DASHBOARDITEM">\n          ADD DASHBOARDITEM\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDashboardItem" ng-click="vm.deleteDashboardItem($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/customDashboards/edit/view.html",'<div id="tools-customDashboard" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-customDashboards-button md-icon-button" aria-label="Go to customDashboards" ng-click="vm.gotoCustomDashboards()" translate translate-attr-aria-label="TOOLS.GO_TO_CUSTOMDASHBOARDS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="customDashboard-image" hide-xs>\n          <img ng-src="assets/images/business/customDashboards.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.customDashboard.id}}\n            <span ng-if="vm.customDashboard.name">{{vm.customDashboard.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.customDashboard.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.customDashboard, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="TOOLS.CLONE_CUSTOMDASHBOARD"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.customDashboard, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="TOOLS.GOTO_CUSTOMDASHBOARD"></span></md-tooltip>\n        <md-icon md-font-icon="icon-forward"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveCustomDashboard()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (dashboardForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="customDashboard-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.customDashboard.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.customDashboard.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.DASHBOARD">DASHBOARD</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="customDashboard-detail-form-container dashboard md-background-bg md-whiteframe-1dp">\n            <div ng-controller="CustomDashboardItemsController as vm_cd" ng-init="vm_cd.init(vm.customDashboard, vm.crudPermissions)" class="customDashboard-detail-form-container no-padding no-margin" layout="column">\n              <div ng-if="vm_cd.customDashboard.widgets.length">\n                <md-button class="md-fab md-mini md-accent" ng-click="vm_cd.createOrEditWidget()" ng-if="vm_cd.crudPermissions.canEdit" aria-label="add item">\n                  <md-tooltip>{{ \'TOOLS.ADD_WIDGET\' | translate }}</md-tooltip>\n                  <md-icon md-font-icon="icon-plus"></md-icon>\n                </md-button>\n                <md-content flex>\n                  <ms-widget-engine config="vm_cd.customDashboard" on-edit="vm_cd.createOrEditWidget(widget)" on-delete="vm_cd.deleteWidget(widget)"></ms-widget-engine>\n                </md-content>\n              </div>\n              <div ng-if="!vm_cd.customDashboard.widgets.length" layout="row" layout-align="center center" flex>\n                <md-button class="width-130 height-130 md-accent md-raised" ng-click="vm_cd.createOrEditWidget()" aria-label="add item" layout="column">\n                  <md-icon md-font-icon="icon-plus-circle" class="s50"></md-icon>\n                  <span layout-wrap translate="TOOLS.ADD_WIDGET"></span>\n                </md-button>\n              </div>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/customDashboards/partialViews/reports/treeReports.html",'<md-dialog class="report-selection-dialog" aria-label="Report Selection" flex="60">\n  <md-toolbar>\n    <div class="md-toolbar-tools">\n      <h2>Select Report</h2>\n      <span flex></span>\n      <md-button class="md-icon-button" ng-click="vm.closeReportDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <div class="content" md-background-bg layout="row" layout-align="start start">\n      <div layout="column" flex="30">\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n        </md-card>\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n        </md-card>\n      </div>\n      <md-card flex="70">\n        <md-toolbar class="md-table-toolbar md-default">\n          <div class="md-toolbar-tools">\n            <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n            <p ng-if="vm.currentPath">\n              <span class="text-boxed">{{vm.currentPath}}</span>\n            </p>\n          </div>\n        </md-toolbar>\n        <md-table-container>\n          <table md-table md-row-select ng-model="vm.selectedReport" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n              <tr md-row>\n                <th md-column md-order-by="id" width="10px">{{ "ANALYTICS.ID" | translate }}</th>\n                <th md-column md-order-by="name">{{ "ANALYTICS.NAME" | translate }}</th>\n                <th md-column md-order-by="description">{{ "ANALYTICS.DESCRIPTION" | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ "ANALYTICS.CREATED_AT" | translate }}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.reports.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n                <td md-cell class="id">{{ report.id }}</td>\n                <td md-cell class="name">{{ report.name }}</td>\n                <td md-cell class="description">{{ report.description }}</td>\n                <td md-cell class="createdAt">{{ report.createdAt | date: "medium" }}</td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{ \'ANALYTICS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'ANALYTICS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'ANALYTICS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10]" md-page="vm.query.page" md-total="{{ vm.reports.count }}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <span flex></span>\n    <md-button class="md-raised" ng-click="vm.closeReportDialog()">CANCEL</md-button>\n    <md-button class="md-accent md-raised" ng-click="vm.selectReport()">CONFIRM</md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/tools/views/dispositions/create/dialog.html",'<md-dialog ng-init="vm.onInit()" class="disposition-dialog" aria-label="New Disposition">\n  <form name="dispositionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newDisposition ? \'TOOLS.NEW_DISPOSITION\' : \'TOOLS.EDIT_DISPOSITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.disposition.name" md-maxlength="255" required md-autofocus>\n        <div ng-messages="dispositionForm[\'name\'].$error" ng-show="dispositionForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.NAME_MAX_LENGTH" translate-values=\'{max: 255}\'>Name must have a maximum length\n              equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.disposition.description" md-maxlength="255">\n        <div ng-messages="dispositionForm[\'description\'].$error" ng-show="dispositionForm[\'description\'].$touched" role="alert">\n          <div ng-message="md-maxlength">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_MAX_LENGTH" translate-values=\'{max: 255}\'>Description must have a\n              maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div ng-if="vm.newDisposition && vm.dispositions.length > 0 || vm.disposition.ParentId" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="TOOLS.FIRST_LEVEL_DISPOSITION">First Level Disposition</label>\n          <md-select name="firstLevelDisposition" ng-model="vm.firstLevelDisposition" ng-change="vm.onFirstLevelSelection()">\n            <md-option ng-value="disposition" ng-repeat="disposition in vm.dispositions | filter: { level: \'first\' }" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.firstLevelDisposition" ng-click="vm.clearSelection(\'first\'); dispositionForm.$setDirty();" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear first level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div ng-if="vm.firstLevelDisposition && vm.anySecondLevelDisposition" layout="row" layout-align="start center">\n        <md-input-container class="md-block" flex>\n          <label translate="TOOLS.SECOND_LEVEL_DISPOSITION">Second Level Disposition</label>\n          <md-select name="secondLevelDisposition" ng-model="vm.secondLevelDisposition">\n            <md-option ng-value="disposition" ng-if="disposition.id != vm.disposition.id" ng-repeat="disposition in vm.dispositions | filter: { level: \'second\', ParentId: vm.firstLevelDisposition.id }" ng-disabled="disposition.canSelect === false">{{ disposition.name }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-button ng-if="vm.secondLevelDisposition" ng-click="vm.clearSelection(\'second\'); dispositionForm.$setDirty();" class="md-icon-button">\n          <md-icon md-font-icon="icon-cancel" aria-label="Clear first level disposition selection">\n          </md-icon>\n        </md-button>\n      </div>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newDisposition" ng-click="vm.saveDisposition()" class="send-button md-accent md-raised" ng-disabled="dispositionForm.$invalid || dispositionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newDisposition" ng-click="vm.addNewDisposition()" class="send-button md-accent md-raised" ng-disabled="dispositionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_DISPOSITION" translate-attr-aria-label="TOOLS.ADD_DISPOSITION">\n          ADD DISPOSITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newDisposition" ng-click="vm.deleteDisposition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/dispositions/dispositions.html",'<div id="dispositions" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.DISPOSITIONS">Dispositions</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedDispositions.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedDispositions = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-dispositions-count">\n          <span>{{vm.selectedDispositions.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllDispositions()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectDispositions()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedDispositions" csv-label="true" filename="dispositions.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      <div layout="row">\n        <div class="column" flex="20">\n          <md-card>\n            <md-card-content>\n              <button layout-align="center center" md-mini-fab ng-click="vm.query.level = null; vm.getDispositions()">\n                <div layout="row" layout-align="start center">\n                  <md-icon md-font-icon="icon-refresh"></md-icon>\n                  <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                </div>\n              </button>\n            </md-card-content>\n          </md-card>\n          <md-card>\n            <md-card-content>\n              <md-input-container class="md-block" flex-gt-sm="">\n                <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm.query.level" ng-change="vm.getDispositions()">\n                  <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                  <md-option ng-value="key" ng-repeat="(key, value) in vm.levels">{{ value }}</md-option>\n                </md-select>\n              </md-input-container>\n            </md-card-content>\n          </md-card>\n        </div>\n        \x3c!-- DISPOSITION TABLE --\x3e\n        <md-card flex="80">\n          <md-table-container>\n            <table md-table md-row-select multiple ng-model="vm.selectedDispositions" md-progress="vm.promise">\n              <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getDispositions">\n                <tr md-row>\n                  <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                  <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                  <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                  <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                  <th md-column width="10px"></th>\n                </tr>\n              </thead>\n              <tbody md-body>\n                <tr md-row ng-hide="vm.dispositions.rows.length">\n                  <td md-cell colspan="5">\n                    <div layout="row" layout-align="center center">\n                      <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                    </div>\n                  </td>\n                </tr>\n                <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm.dispositions.rows">\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                  </td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                    {{ vm.levels[disposition.level] }}</td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                    {{disposition.name}}</td>\n                  <td ng-click="vm.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                    {{disposition.description}}</td>\n                  <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                    <md-menu>\n                      <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                        <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                      </md-button>\n                      <md-menu-content width="3">\n                        \x3c!-- SUBACTIONS --\x3e\n                        \x3c!-- ACTIONS --\x3e\n                        <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                          <md-button ng-click="vm.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                            Edit Disposition\n                          </md-button>\n                        </md-menu-item>\n                        \x3c!-- SUBACTIONS --\x3e\n                        \x3c!-- ACTIONS --\x3e\n                        <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                          <md-button ng-click="vm.deleteconfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                            Delete Disposition\n                          </md-button>\n                        </md-menu-item>\n                      </md-menu-content>\n                    </md-menu>\n                  </td>\n                </tr>\n              </tbody>\n            </table>\n          </md-table-container>\n          <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.dispositions.count}}" md-on-paginate="vm.getDispositions" md-page-select>\n          </md-table-pagination>\n        </md-card>\n        \x3c!-- / DISPOSITION TABLE --\x3e\n      </div>\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n  \x3c!-- ADD DISPOSITION BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-disposition-button" ng-click="vm.createOrEditDisposition($event)" aria-label="add disposition" translate translate-attr-aria-label="TOOLS.ADD_DISPOSITION">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD DISPOSITION BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/intervals/create/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.interval.name" ng-required="true" autofocus>\n\n        <div ng-messages="intervalForm[\'name\'].$error" ng-show="intervalForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.interval.description">\n\n        <div ng-messages="intervalForm[\'description\'].$error" ng-show="intervalForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInterval" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInterval" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInterval" ng-click="vm.deleteInterval($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input ng-model="vm.interval.name" type="text" name="name" placeholder="{{\'TOOLS.NAME\' | translate}}" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" md-autofocus required>\n        <div ng-messages="intervalForm.name.$error" ng-show="intervalForm.name.$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/intervals/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="" name="name" ng-model="vm.interval.name" ng-required="true" autofocus>\n\n        <div ng-messages="intervalForm[\'name\'].$error" ng-show="intervalForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInterval" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInterval" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInterval" ng-click="vm.deleteInterval($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/intervals/edit/view.html",'<div id="tools-interval" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-intervals-button md-icon-button" aria-label="Go to intervals" ng-click="vm.gotoIntervals()" translate translate-attr-aria-label="TOOLS.GO_TO_INTERVALS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="interval-image" hide-xs>\n          <img ng-src="assets/images/business/intervals.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.interval.id}}\n            <span ng-if="vm.interval.name">{{vm.interval.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.interval.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInterval()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (intervalsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="interval-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.interval.name" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.interval.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.INTERVALS">INTERVALS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="interval-detail-form-container intervals md-background-bg md-whiteframe-1dp">\n            <div ng-controller="IntervalIntervalsController as vm_dc" ng-init="vm_dc.init(vm.interval, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedIntervalIntervals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="TOOLS.INTERVALS">Intervals</span>\n                  <ms-search-bar on-search="vm_dc.getIntervalIntervals()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditIntervalInterval($event)" aria-label="add interval" translate translate-attr-label="TOOLS.ADD_INTERVAL">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedIntervalIntervals.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedIntervalIntervals.length}} {{vm_dc.selectedIntervalIntervals.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedIntervalIntervals" csv-label="true" filename="intervals.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedIntervalIntervals($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedIntervalIntervals" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getIntervalIntervals">\n                    <tr md-row>\n                      <th md-column width="10px"></th>\n                      <th md-column md-order-by="id">\n                        {{ \'TOOLS.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="name">\n                        {{ \'TOOLS.NAME\' | translate }}\n                      </th>\n                      <th md-column md-order-by="interval">\n                        {{ \'TOOLS.INTERVAL\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'TOOLS.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body ng-sortable="vm_dc.sortableTable">\n                    <tr md-row md-select="interval" md-select-id="id" ng-repeat="interval in vm_dc.intervalIntervals.rows">\n                      <td md-cell>\n                        <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.name}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{interval.interval}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" md-cell>\n                        {{ interval.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditIntervalInterval($event, interval)" translate="TOOLS.EDIT_INTERVAL">\n                                Edit Interval\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interval, $event)" translate="TOOLS.DELETE_INTERVAL">\n                                Delete Interval\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.intervalIntervals.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="TOOLS.NO_INTERVALS_AVAILABLE">No intervals available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/intervals/intervals.html",'<div id="intervals" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.INTERVALS">Intervals</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedIntervals.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedIntervals =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-intervals-count">\n          <span>{{vm.selectedIntervals.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllIntervals()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectIntervals()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedIntervals" csv-label="true" filename="intervals.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedIntervals($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- INTERVAL TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedIntervals" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getIntervals">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.intervals.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="interval" md-select-id="id" ng-repeat="interval in vm.intervals.rows">\n                <td md-cell ng-if="interval.userpic"><img class="avatar" alt="{{interval.name}}" ng-src="api/users/{{interval.id}}/avatar" /></td>\n                <td md-cell ng-if="!interval.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{interval.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="id ">{{interval.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="name ">{{interval.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(interval, ev) : vm.createOrEditInterval($event, interval)" md-cell class="description ">{{interval.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(interval, $event    )" translate="TOOLS.EDIT_INTERVAL">\n                          Edit Interval\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(interval, $event    )" translate="TOOLS.DELETE_INTERVAL">\n                          Delete Interval\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.intervals.count}}" md-on-paginate="vm.getIntervals" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / INTERVAL TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD INTERVAL BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-interval-button" ng-click="vm.createOrEditInterval($event)" aria-label="add interval" translate translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD INTERVAL BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/pauses/create/dialog.html",'<md-dialog class="pause-dialog" aria-label="New Pause">\n  <form name="pauseForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.pause.name" ng-required="true" autofocus>\n\n        <div ng-messages="pauseForm[\'name\'].$error" ng-show="pauseForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.pause.description">\n\n        <div ng-messages="pauseForm[\'description\'].$error" ng-show="pauseForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newPause" ng-click="vm.savePause()" class="send-button md-accent md-raised" ng-disabled="pauseForm.$invalid || pauseForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newPause" ng-click="vm.addNewPause()" class="send-button md-accent md-raised" ng-disabled="pauseForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_PAUSE" translate-attr-aria-label="TOOLS.ADD_PAUSE">\n          ADD PAUSE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newPause" ng-click="vm.deletePause($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/pauses/pauses.html",'<div id="pauses" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.PAUSES">Pauses</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedPauses.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedPauses =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-pauses-count">\n          <span>{{vm.selectedPauses.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllPauses()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectPauses()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedPauses" csv-label="true" filename="pauses.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedPauses($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- PAUSE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedPauses" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getPauses">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.pauses.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="pause" md-select-id="id" ng-repeat="pause in vm.pauses.rows">\n                <td md-cell ng-if="pause.userpic"><img class="avatar" alt="{{pause.name}}" ng-src="api/users/{{pause.id}}/avatar" /></td>\n                <td md-cell ng-if="!pause.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{pause.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="id ">{{pause.id}}</td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="name ">{{pause.name}}</td>\n                <td ng-click="vm.createOrEditPause($event, pause)" md-cell class="description ">{{pause.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(pause, $event    )" translate="TOOLS.EDIT_PAUSE">\n                          Edit Pause\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(pause, $event    )" translate="TOOLS.DELETE_PAUSE">\n                          Delete Pause\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.pauses.count}}" md-on-paginate="vm.getPauses" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / PAUSE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD PAUSE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-pause-button" ng-click="vm.createOrEditPause($event)" aria-label="add pause" translate translate-attr-aria-label="TOOLS.ADD_PAUSE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD PAUSE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/schedules/create/dialog.html",'<md-dialog class="schedule-dialog" aria-label="New Schedule">\n  <form name="scheduleForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.schedule.name" ng-required="true" autofocus>\n\n        <div ng-messages="scheduleForm[\'name\'].$error" ng-show="scheduleForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.REPORT">Report</label>\n        <input type="search" name="report" ng-model="vm.schedule.report" ng-required="true" autocomplete="off" ng-click="vm.searchReport()">\n        <md-icon md-font-icon="icon-magnify" ng-click="vm.searchReport()" aria-label="Search Report"></md-icon>\n        <div ng-messages="scheduleForm[\'report\'].$error" ng-show="scheduleForm[\'report\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REPORT_REQUIRED">Report field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OUTPUT">Output</label>\n        <md-select name="output" ng-model="vm.schedule.output" required>\n          <md-option ng-value="\'csv\'">CSV</md-option>\n          <md-option ng-value="\'pdf\'">PDF</md-option>\n          <md-option ng-value="\'xlsx\'">Excel</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'output\'].$error" ng-show="scheduleForm[\'output\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTPUT_REQUIRED">Output field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.schedule.active" aria-label="Active"><span translate="TOOLS.ACTIVE">Active</span></md-switch>\n      </md-input-container>\n      <div class="md-block">\n        <label translate="TOOLS.VALIDITYSTART">ValidityStart</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="startAtDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.schedule.startAt" ng-init="vm.schedule.startAt = vm.getDateFromString(vm.schedule.startAt)">\n              <div ng-messages="scheduleForm.dateRangeFrom.$error" ng-show="scheduleForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="startAtTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.schedule.startAt" ng-init="vm.schedule.startAt = vm.getDateFromString(vm.schedule.startAt)">\n              <div ng-messages="scheduleForm.timeRangeFrom.$error" ng-show="scheduleForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div class="md-block">\n        <label translate="TOOLS.VALIDITYEND">ValidityEnd</label>\n        <md-content layout="row" class="md-padding">\n          <div flex class="md-block">\n            <mdp-date-picker mdp-open-on-click required name="endAtDate" mdp-placeholder="Date" mdp-format="YYYY-MM-DD" ng-model="vm.schedule.endAt" ng-init="vm.schedule.endAt = vm.getDateFromString(vm.schedule.endAt)">\n              <div ng-messages="scheduleForm.dateRangeFrom.$error" ng-show="scheduleForm.dateRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.DATE_REQUIRED">Date is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.DATE_INVALID">Date is invalid</span>\n                </div>\n              </div>\n            </mdp-date-picker>\n          </div>\n          <div flex class="md-block">\n            <mdp-time-picker mdp-open-on-click required name="endAtTime" mdp-placeholder="Time" mdp-format="HH:mm:ss" mdp-auto-switch="true" ng-model="vm.schedule.endAt" ng-init="vm.schedule.endAt = vm.getDateFromString(vm.schedule.endAt)">\n              <div ng-messages="scheduleForm.timeRangeFrom.$error" ng-show="scheduleForm.timeRangeFrom.$touched" role="alert">\n                <div ng-message="required">\n                  <span translate="TOOLS.ERRORS.TIME_REQUIRED">Time is required</span>\n                </div>\n                <div ng-message="format">\n                  <span translate="TOOLS.ERRORS.TIME_INVALID">Time is invalid</span>\n                </div>\n              </div>\n            </mdp-time-picker>\n          </div>\n        </md-content>\n      </div>\n      <div flex class="md-block">\n        <label> {{ \'TOOLS.CRON\' | translate }} ({{vm.schedule.cron}})</label>\n        <cron-selection name="cron" ng-model="vm.schedule.cron" template="assets/angular-cron-jobs/template.html" required></cron-selection>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LAST">Last</label>\n        <input type="number" name="subtractNumber" ng-model="vm.schedule.subtractNumber" value="1" ng-required="true">\n\n        <div ng-messages="scheduleForm[\'subtractNumber\'].$error" ng-show="scheduleForm[\'subtractNumber\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LAST_REQUIRED">Last field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.LASTUNIT">LastUnit</label>\n        <md-select name="subtractUnit" ng-model="vm.schedule.subtractUnit" required>\n          <md-option ng-value="\'minutes\'">Minutes</md-option>\n          <md-option ng-value="\'hours\'">Hours</md-option>\n          <md-option ng-value="\'days\'">Days</md-option>\n          <md-option ng-value="\'weeks\'">Weeks</md-option>\n          <md-option ng-value="\'months\'">Months</md-option>\n          <md-option ng-value="\'quarters\'">Quarters</md-option>\n          <md-option ng-value="\'years\'">Years</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'subtractUnit\'].$error" ng-show="scheduleForm[\'subtractUnit\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LASTUNIT_REQUIRED">LastUnit field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.schedule.sendMail" aria-label="SendMail"><span translate="TOOLS.SENDMAIL">SendMail</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.MAILACCOUNT">MailAccount</label>\n        <md-select name="MailAccountId" ng-model="vm.schedule.MailAccountId" required>\n          <md-option ng-value="MailAccountId.id" ng-repeat="MailAccountId in vm.mailAccounts" ng-disabled="MailAccountId.canSelect === false">{{ MailAccountId.name }}</md-option>\n        </md-select>\n        <div ng-messages="scheduleForm[\'MailAccountId\'].$error" ng-show="scheduleForm[\'MailAccountId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.MAILACCOUNT_REQUIRED">MailAccount field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILADDRESS">EmailAddress</label>\n        <input type="text" name="email" ng-model="vm.schedule.email" ng-required="true">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'email\'].$error" ng-show="scheduleForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILADDRESS_REQUIRED">EmailAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILCCADDRESS">EmailCcAddress</label>\n        <input type="text" name="cc" ng-model="vm.schedule.cc">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILCCADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'cc\'].$error" ng-show="scheduleForm[\'cc\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILCCADDRESS_REQUIRED">EmailCcAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <label translate="TOOLS.EMAILBCCADDRESS">EmailBccAddress</label>\n        <input type="text" name="bcc" ng-model="vm.schedule.bcc">\n\n        <div class="hint"><span translate="TOOLS.HELP.EMAILBCCADDRESS"></span></div>\n        <div ng-messages="scheduleForm[\'bcc\'].$error" ng-show="scheduleForm[\'bcc\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EMAILBCCADDRESS_REQUIRED">EmailBccAddress field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.schedule.sendMail" class="md-block">\n        <md-switch ng-model="vm.schedule.sendIfEmpty" aria-label="SendIfEmpty"><span translate="TOOLS.SENDIFEMPTY">SendIfEmpty</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="" name="description" ng-model="vm.schedule.description">\n\n        <div ng-messages="scheduleForm[\'description\'].$error" ng-show="scheduleForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSchedule" ng-click="vm.saveSchedule()" class="send-button md-accent md-raised" ng-disabled="scheduleForm.$invalid || scheduleForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSchedule" ng-click="vm.addNewSchedule()" class="send-button md-accent md-raised" ng-disabled="scheduleForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_SCHEDULE" translate-attr-aria-label="TOOLS.ADD_SCHEDULE">\n          ADD SCHEDULE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSchedule" ng-click="vm.deleteSchedule($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/schedules/partialViews/reports/treeReports.html",'<md-dialog class="report-selection-dialog" aria-label="Report Selection" flex="60">\n  <md-toolbar>\n    <div class="md-toolbar-tools">\n      <h2>Select Report</h2>\n      <span flex></span>\n      <md-button class="md-icon-button" ng-click="vm.closeReportDialog()">\n        <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n\n  <md-dialog-content>\n    <div class="content" md-background-bg layout="row" layout-align="start start">\n      <div layout="column" flex="30">\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeDefaultEvents" ng-model="vm.treeDefaultData" tree="vm.treeDefaultInstance"></div>\n        </md-card>\n        <md-card class="padding-10 scrollable">\n          <div js-tree="vm.treeConfig" tree-events-obj="vm.treeCustomEvents" ng-model="vm.treeCustomData" tree="vm.treeCustomInstance"></div>\n        </md-card>\n      </div>\n      <md-card flex="70">\n        <md-toolbar class="md-table-toolbar md-default">\n          <div class="md-toolbar-tools">\n            <span class="h2 secondary-text">{{vm.currentNode.text}}</span>\n            <p ng-if="vm.currentPath">\n              <span class="text-boxed">{{vm.currentPath}}</span>\n            </p>\n          </div>\n        </md-toolbar>\n        <md-table-container>\n          <table md-table md-row-select ng-model="vm.selectedReport" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getReports">\n              <tr md-row>\n                <th md-column md-order-by="id" width="10px">{{ "ANALYTICS.ID" | translate }}</th>\n                <th md-column md-order-by="name">{{ "ANALYTICS.NAME" | translate }}</th>\n                <th md-column md-order-by="description">{{ "ANALYTICS.DESCRIPTION" | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ "ANALYTICS.CREATED_AT" | translate }}</th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.reports.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="ANALYTICS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="report" md-select-id="id" ng-repeat="report in vm.reports.rows">\n                <td md-cell class="id">{{ report.id }}</td>\n                <td md-cell class="name">{{ report.name }}</td>\n                <td md-cell class="description">{{ report.description }}</td>\n                <td md-cell class="createdAt">{{ report.createdAt | date: "medium" }}</td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{ \'ANALYTICS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'ANALYTICS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'ANALYTICS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10]" md-page="vm.query.page" md-total="{{ vm.reports.count }}" md-on-paginate="vm.getReports" md-page-select></md-table-pagination>\n      </md-card>\n    </div>\n  </md-dialog-content>\n  <md-dialog-actions layout="row">\n    <span flex></span>\n    <md-button class="md-raised" ng-click="vm.closeReportDialog()">CANCEL</md-button>\n    <md-button class="md-accent md-raised" ng-click="vm.selectReport()">CONFIRM</md-button>\n  </md-dialog-actions>\n</md-dialog>'),e.put("app/main/apps/tools/views/schedules/schedules.html",'<div id="schedules" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.SCHEDULER">Scheduler</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedScheduler.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedScheduler =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-schedules-count">\n          <span>{{vm.selectedScheduler.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllScheduler()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectScheduler()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedScheduler" csv-label="true" filename="schedules.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedScheduler($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SCHEDULE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedScheduler" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScheduler">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'TOOLS.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="startAt">{{ \'TOOLS.VALIDITYSTART\' | translate }}</th>\n                <th md-column md-order-by="endAt">{{ \'TOOLS.VALIDITYEND\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.schedules.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="schedule" md-select-id="id" ng-repeat="schedule in vm.schedules.rows">\n                <td md-cell ng-if="schedule.userpic"><img class="avatar" alt="{{schedule.name}}" ng-src="api/users/{{schedule.id}}/avatar" /></td>\n                <td md-cell ng-if="!schedule.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{schedule.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="id ">{{schedule.id}}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="name ">{{schedule.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(schedule, ev) : vm.createOrEditSchedule($event, schedule)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{schedule.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{schedule.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="startAt ">{{schedule.startAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="endAt ">{{schedule.endAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditSchedule($event, schedule)" md-cell class="description ">{{schedule.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(schedule, $event    )" translate="TOOLS.EDIT_SCHEDULE">\n                          Edit Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.runconfirm(schedule, $event    )" translate="TOOLS.RUN_SCHEDULE">\n                          Run Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(schedule, $event    )" translate="TOOLS.DELETE_SCHEDULE">\n                          Delete Schedule\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.schedules.count}}" md-on-paginate="vm.getScheduler" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SCHEDULE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD SCHEDULE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-schedule-button" ng-click="vm.createOrEditSchedule($event)" aria-label="add schedule" translate translate-attr-aria-label="TOOLS.ADD_SCHEDULE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD SCHEDULE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/sounds/create/dialog.html",'<md-dialog class="sound-dialog" aria-label="New Sound">\n  <form name="soundForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.sound.name" ng-required="true" autofocus>\n\n        <div ng-messages="soundForm[\'name\'].$error" ng-show="soundForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.sound.description">\n\n        <div ng-messages="soundForm[\'description\'].$error" ng-show="soundForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newSound" ng-click="vm.saveSound()" class="send-button md-accent md-raised" ng-disabled="soundForm.$invalid || soundForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newSound" ng-click="vm.addNewSound()" class="send-button md-accent md-raised" ng-disabled="soundForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_SOUND" translate-attr-aria-label="TOOLS.ADD_SOUND">\n          ADD SOUND\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newSound" ng-click="vm.deleteSound($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/sounds/sounds.html",'<div id="sounds" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.SOUNDS">Sounds</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedSounds.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedSounds =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-sounds-count">\n          <span>{{vm.selectedSounds.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllSounds()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectSounds()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedSounds" csv-label="true" filename="sounds.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedSounds($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SOUND TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedSounds" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getSounds">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="audio">{{ \'TOOLS.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.sounds.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="sound" md-select-id="id" ng-repeat="sound in vm.sounds.rows">\n                <td md-cell ng-if="sound.userpic"><img class="avatar" alt="{{sound.name}}" ng-src="api/users/{{sound.id}}/avatar" /></td>\n                <td md-cell ng-if="!sound.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{sound.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="id ">{{sound.id}}</td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="name ">{{sound.name}}</td>\n                <td md-cell class="audio ">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording id="sound.id" model="\'sound\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                </td>\n                <td ng-click="vm.createOrEditSound($event, sound)" md-cell class="description ">{{sound.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(sound, $event    )" translate="TOOLS.EDIT_SOUND">\n                          Edit Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.downloadfile2(sound, $event  , \'sounds\'   )" translate="TOOLS.DOWNLOAD_SOUND">\n                          Download Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(sound, $event    )" translate="TOOLS.DELETE_SOUND">\n                          Delete Sound\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.sounds.count}}" md-on-paginate="vm.getSounds" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SOUND TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- UPLOAD SOUND BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="upload-sound-button" ng-click="vm.uploadSound($event)" aria-label="upload sound" translate translate-attr-aria-label="TOOLS.UPLOAD_SOUND">\n    <md-icon md-font-icon="icon-upload"></md-icon>\n  </md-button>\n  \x3c!-- / UPLOAD SOUND BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/sounds/upload/dialog.html",'<md-dialog class="upload-dialog" aria-label="Upload ">\n  <form name="uploadForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div id="sound-uploader" ng-hide="vm.uploadState == \'uploading\'" flow-init="vm.ngFlowOptions" flow-name="vm.ngFlow.flow" flow-files-submitted="vm.upload()" flow-file-added="vm.fileAdded($file)" flow-file-success="vm.fileSuccess($file, $message)" flow-error="vm.uploadError($file, $message)" flow-complete="vm.uploadComplete()" flow-drop flow-drag-enter="vm.dropping=true" flow-drag-leave="vm.dropping=false" ng-class="{\'dropping\':vm.dropping}">\n\n        <div class="drop-text hint-text" layout="row" layout-align="center center">\n          <span translate="TOOLS.DROP_TO_UPLOAD">Drop to upload</span>\n        </div>\n\n        <div class="upload-button" layout="column" layout-align="center center">\n          <md-button class="md-accent md-raised" flow-btn>\n            Upload\n          </md-button>\n          <span class="secondary-text mt-8" translate="TOOLS.DROP_TO_UPLOAD_MESSAGE">You can also drop your file here to upload.</span>\n        </div>\n      </div>\n\n      <div layout="column" layout-align="space-between center" ng-show="vm.uploadState == \'uploading\'">\n        <div>\n          <span translate="TOOLS.UPLOADING">Uploading</span>\n          <span>{{vm.sound.file.name}}</span>\n        </div>\n        <md-progress-linear md-mode="indeterminate"></md-progress-linear>\n      </div>\n\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center"></div>\n      <div layout="row">\n        <md-button ng-click="vm.closeDialog()" ng-hide="vm.uploadState == \'uploading\'" class="md-accent md-raised" aria-label="FINISH" translate="TOOLS.FINISH" translate-attr-aria-label="TOOLS.FINISH">\n          FINISH\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/tags/create/dialog.html",'<md-dialog class="tag-dialog" aria-label="New Tag">\n  <form name="tagForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.tag.name" ng-required="true" autofocus>\n\n        <div ng-messages="tagForm[\'name\'].$error" ng-show="tagForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.tag.description">\n\n        <div ng-messages="tagForm[\'description\'].$error" ng-show="tagForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div flex md-color-picker ng-model="vm.tag.color" label="{{\'TOOLS.COLOR\' | translate}}" md-color-hex="true" md-color-rgb="false" md-color-hsl="false" md-color-history="false" md-color-material-palette="false" md-color-alpha-channel="false" open-on-input="true"></div>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTag" ng-click="vm.saveTag()" class="send-button md-accent md-raised" ng-disabled="tagForm.$invalid || tagForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTag" ng-click="vm.addNewTag()" class="send-button md-accent md-raised" ng-disabled="tagForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TAG" translate-attr-aria-label="TOOLS.ADD_TAG">\n          ADD TAG\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTag" ng-click="vm.deleteTag($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/tags/tags.html",'<div id="tags" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TAGS">Tags</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTags.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTags =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-tags-count">\n          <span>{{vm.selectedTags.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTags()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTags()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTags" csv-label="true" filename="tags.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTags($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TAG TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTags" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTags">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column md-order-by="color">{{ \'TOOLS.COLOR\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.tags.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="tag" md-select-id="id" ng-repeat="tag in vm.tags.rows">\n                <td md-cell ng-if="tag.userpic"><img class="avatar" alt="{{tag.name}}" ng-src="api/users/{{tag.id}}/avatar" /></td>\n                <td md-cell ng-if="!tag.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{tag.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="id ">{{tag.id}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="name ">{{tag.name}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="description ">{{tag.description}}</td>\n                <td ng-click="vm.createOrEditTag($event, tag)" md-cell class="color ">{{tag.color}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(tag, $event    )" translate="TOOLS.EDIT_TAG">\n                          Edit Tag\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(tag, $event    )" translate="TOOLS.DELETE_TAG">\n                          Delete Tag\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.tags.count}}" md-on-paginate="vm.getTags" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TAG TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TAG BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-tag-button" ng-click="vm.createOrEditTag($event)" aria-label="add tag" translate translate-attr-aria-label="TOOLS.ADD_TAG">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TAG BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/templates/create/dialog.html",'<md-dialog class="template-dialog" aria-label="New Template">\n  <form name="templateForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.template.name" ng-required="true" autofocus>\n\n        <div ng-messages="templateForm[\'name\'].$error" ng-show="templateForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="md-block">\n        <label class="md-caption grey-fg" translate="TOOLS.CONTENT">Content</label>\n        <textarea aria-label="Content html" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.template.html"></textarea>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.template.description">\n\n        <div ng-messages="templateForm[\'description\'].$error" ng-show="templateForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTemplate" ng-click="vm.saveTemplate()" class="send-button md-accent md-raised" ng-disabled="templateForm.$invalid || templateForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTemplate" ng-click="vm.addNewTemplate()" class="send-button md-accent md-raised" ng-disabled="templateForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TEMPLATE" translate-attr-aria-label="TOOLS.ADD_TEMPLATE">\n          ADD TEMPLATE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTemplate" ng-click="vm.deleteTemplate($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/templates/templates.html",'<div id="templates" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TEMPLATES">Templates</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTemplates.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTemplates =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-templates-count">\n          <span>{{vm.selectedTemplates.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTemplates()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTemplates()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTemplates" csv-label="true" filename="templates.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTemplates($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TEMPLATE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTemplates" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTemplates">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.templates.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="template" md-select-id="id" ng-repeat="template in vm.templates.rows">\n                <td md-cell ng-if="template.userpic"><img class="avatar" alt="{{template.name}}" ng-src="api/users/{{template.id}}/avatar" /></td>\n                <td md-cell ng-if="!template.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{template.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="id ">{{template.id}}</td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="name ">{{template.name}}</td>\n                <td ng-click="vm.createOrEditTemplate($event, template)" md-cell class="description ">{{template.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(template, $event    )" translate="TOOLS.EDIT_TEMPLATE">\n                          Edit Template\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(template, $event    )" translate="TOOLS.DELETE_TEMPLATE">\n                          Delete Template\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.templates.count}}" md-on-paginate="vm.getTemplates" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TEMPLATE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TEMPLATE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-template-button" ng-click="vm.createOrEditTemplate($event)" aria-label="add template" translate translate-attr-aria-label="TOOLS.ADD_TEMPLATE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TEMPLATE BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/triggers/create/dialog.html",'<md-dialog class="trigger-dialog" aria-label="New Trigger">\n  <form name="triggerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newTrigger ? \'TOOLS.NEW_TRIGGER\' : \'TOOLS.EDIT_TRIGGER\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trigger.name" required md-autofocus>\n        <div ng-messages="triggerForm[\'name\'].$error" ng-show="triggerForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.CHANNEL">Channel</label>\n        <md-select name="channel" ng-model="vm.trigger.channel" required ng-disabled="!vm.newTrigger">\n          <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n          <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel"> {{ \'TOOLS.OPENCHANNEL\' | translate }}\n          </md-option>\n          <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n          <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n          <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n          <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n          <md-option ng-value="\'whatsapp\'" ng-if="vm.license.whatsapp"> {{ \'TOOLS.WHATSAPP\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="triggerForm[\'channel\'].$error" ng-show="triggerForm[\'channel\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trigger.status" aria-label="Status"><span translate="TOOLS.STATUS">Status</span>\n        </md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.trigger.description">\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{ error.message }}</span>\n            <span class="type">({{ error.type }})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTrigger" ng-click="vm.saveTrigger()" class="send-button md-accent md-raised" ng-disabled="triggerForm.$invalid || triggerForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTrigger" ng-click="vm.addNewTrigger()" class="send-button md-accent md-raised" ng-disabled="triggerForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TRIGGER" translate-attr-aria-label="TOOLS.ADD_TRIGGER">\n          ADD TRIGGER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTrigger" ng-click="vm.deleteTrigger($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/actions/actions.html",'<div ng-controller="TriggerActionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\r\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedTriggerActions.length">\r\n    <div class="md-toolbar-tools">\r\n      <span class="md-subhead" translate="TOOLS.ACTIONS">Actions</span>\r\n      <ms-search-bar on-search="vm_dc.getTriggerActions()" query="vm_dc.query" debounce="300" direction="down">\r\n      </ms-search-bar>\r\n      <div flex></div>\r\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditTriggerAction($event)" aria-label="add action" translate translate-attr-label="TOOLS.ADD_ACTION">\r\n        <md-icon md-font-icon="icon-plus"></md-icon>\r\n      </md-button>\r\n    </div>\r\n  </md-toolbar>\r\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedTriggerActions.length">\r\n    <div class="md-toolbar-tools">\r\n      <span class="md-subhead">{{ vm_dc.selectedTriggerActions.length }}\r\n        {{ vm_dc.selectedTriggerActions.length > 1 ? \'items\' : \'item\' }} selected</span>\r\n      <div flex></div>\r\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedTriggerActions" csv-label="true" filename="triggers.csv">\r\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\r\n      </button>\r\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedTriggerActions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\r\n        <md-icon md-font-icon="icon-delete"></md-icon>\r\n      </md-button>\r\n    </div>\r\n  </md-toolbar>\r\n  <md-table-container class="font-size-12">\r\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedTriggerActions" md-progress="vm_dc.promise">\r\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getTriggerActions">\r\n        <tr md-row>\r\n          <th md-column md-order-by="id">\r\n            {{ \'TOOLS.ID\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="action">\r\n            {{ \'TOOLS.ACTION\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="data1">\r\n            {{ \'TOOLS.TYPE\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="data2">\r\n            {{ \'TOOLS.INFO\' | translate }}\r\n          </th>\r\n          <th md-column md-order-by="createdAt">\r\n            {{ \'TOOLS.CREATED_AT\' | translate }}\r\n          </th>\r\n          <th md-column width="10px"></th>\r\n        </tr>\r\n      </thead>\r\n      <tbody md-body>\r\n        <tr md-row md-select="action" md-select-id="id" ng-repeat="action in vm_dc.triggerActions.rows">\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ action.id }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ \'TOOLS.\' + (action.action | snakecase | uppercase) | translate }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\'" md-cell>\r\n            {{ action.data1 === \'1\' ? \'CTI URL\' : \'Popup\' }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>\r\n            {{ (vm_dc.lists | filter : {\'id\':(action.data1 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'contactManager\'" md-cell>\r\n            {{ action.data2 === \'1\' ? \'TOOLS.YES\' : \'TOOLS.NO\' | uppercase | translate }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>\r\n            {{ action.data1 }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data1" md-cell>\r\n            {{ action.data1 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="!action.data2" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'urlForward\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'script\' && action.data2" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'script\' && action.data1" md-cell>\r\n            {{ action.data1 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'jscripty\'" md-cell>\r\n            {{ (vm_dc.projects | filter : {\'id\':(action.data1 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\'" md-cell>\r\n            {{ vm_dc.integrationTypes[action.data1] }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zendesk\'" md-cell>\r\n            {{ (vm_dc.zendeskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'desk\'" md-cell>\r\n            {{ (vm_dc.deskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'zoho\'" md-cell>\r\n            {{ (vm_dc.zohoAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'salesforce\'" md-cell>\r\n            {{ (vm_dc.salesforceAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'sugarcrm\'" md-cell>\r\n            {{ (vm_dc.sugarcrmAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshdesk\'" md-cell>\r\n            {{ (vm_dc.freshdeskAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'vtiger\'" md-cell>\r\n            {{ (vm_dc.vtigerAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'dynamics365\'" md-cell>\r\n            {{ (vm_dc.dynamics365Accounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'servicenow\'" md-cell>\r\n            {{ (vm_dc.servicenowAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'integration\' && action.data1 == \'freshsales\'" md-cell>\r\n            {{ (vm_dc.freshsalesAccounts | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\'" md-cell>\r\n            {{ vm_dc.motionBarOptions[action.data1] }} </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'1\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'2\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'motionbar\' && action.data1 === \'0\'" md-cell>\r\n            {{ (vm_dc.templates | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 === \'0\'" md-cell>\r\n            {{ (vm_dc.templates | filter : {\'id\':(action.data2 | toInteger)} : true)[0].name }}</td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" ng-if="action.action == \'browser\' && action.data1 === \'1\'" md-cell>\r\n            {{ action.data2 }}\r\n          </td>\r\n          <td ng-click="vm_dc.createOrEditTriggerAction($event, action)" md-cell>\r\n            {{ action.createdAt | formatdate }}\r\n          </td>\r\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\r\n            <md-menu>\r\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\r\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\r\n              </md-button>\r\n              <md-menu-content width="3">\r\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\r\n                  <md-button ng-click="vm_dc.createOrEditTriggerAction($event, action)" translate="TOOLS.EDIT_ACTION">\r\n                    Edit Action\r\n                  </md-button>\r\n                </md-menu-item>\r\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\r\n                  <md-button ng-click="vm_dc.deleteConfirm(action, $event)" translate="TOOLS.DELETE_ACTION">\r\n                    Delete Action\r\n                  </md-button>\r\n                </md-menu-item>\r\n              </md-menu-content>\r\n            </md-menu>\r\n          </td>\r\n        </tr>\r\n        <tr md-row ng-if="!vm_dc.triggerActions.rows.length">\r\n          <td md-cell colspan="5">\r\n            <div layout="row" layout-align="center center">\r\n              <span class="text-boxed-light" translate="TOOLS.NO_ACTION_AVAILABLE">No action\r\n                available</span>\r\n            </div>\r\n          </td>\r\n        </tr>\r\n      </tbody>\r\n    </table>\r\n  </md-table-container>\r\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.triggerActions.count }}" md-on-paginate="vm_dc.getTriggerActions" md-page-select>\r\n  </md-table-pagination>\r\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/actions/create/dialog.html",'<md-dialog class="action-dialog" aria-label="New Action">\n  <form name="actionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAction ? \'TOOLS.NEW_ACTION\' : \'TOOLS.EDIT_ACTION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.ACTION">Action</label>\n        <md-select name="action" ng-model="vm.action.action" ng-init="vm.onActionInit()" ng-change="vm.onActionSelection()" md-autofocus required ng-disabled="!vm.newAction">\n          <md-option ng-value="\'contactManager\'" ng-if="vm.trigger.channel == \'voice\'">\n            {{ \'TOOLS.CONTACT_MANAGER\' | translate }} </md-option>\n          <md-option ng-value="\'integration\'" ng-if="vm.trigger.channel == \'voice\' && ((vm.newAction && vm.hasIntegrationsPermissions) || !vm.newAction)">\n            {{ \'TOOLS.INTEGRATIONS\' | translate }} </md-option>\n          <md-option ng-value="\'motionbar\'"> {{ \'TOOLS.MOTIONBAR\' | translate }} </md-option>\n          <md-option ng-value="\'jscripty\'"> {{ \'TOOLS.JSCRIPTY\' | translate }} </md-option>\n          <md-option ng-value="\'urlForward\'"> {{ \'TOOLS.URL_FORWARD\' | translate }} </md-option>\n          <md-option ng-value="\'browser\'"> {{ \'TOOLS.BROWSER\' | translate }} </md-option>\n          <md-option ng-value="\'bot\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.BOT\' | translate }} </md-option>\n          <md-option ng-value="\'script\'"> {{ \'TOOLS.SCRIPT\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'action\'].$error" ng-show="actionForm[\'action\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACTION_REQUIRED">Action field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'jscripty\'" class="md-block">\n        <label translate="TOOLS.PROJECT">Project</label>\n        <md-select name="data1" ng-model="vm.action.data1" required>\n          <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.projects" ng-disabled="data1.canSelect === false">\n            {{ data1.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PROJECT_REQUIRED">Project field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onTypeSelection()" required>\n          <md-option ng-value="\'0\'">Popup</md-option>\n          <md-option ng-value="\'1\'">CTI URL</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.LIST">List</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onListSelection()" required>\n          <md-option ng-value="\'\'+data1.id" ng-repeat="data1 in vm.lists" ng-disabled="data1.canSelect === false">\n            {{ data1.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.SEARCH_FIELDS">Search fields</label>\n        <md-select name="fields" ng-model="vm.action.data3" ng-init="vm.onSearchFieldsInit()" multiple required>\n          <md-optgroup label="{{ \'TOOLS.STANDARD\' | translate }}">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.contactFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.LIST\' | translate }}" ng-if="vm.listFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.listFields">\n              {{ field.name }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.GLOBALS\' | translate }}" ng-if="vm.customFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.customFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SEARCH_FIELDS_REQUIRED">Search fields field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.AUTOCREATECONTACT">Create contact automatically</label>\n        <md-select name="data2" ng-model="vm.action.data2" ng-change="vm.onAutocreateSelection()" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AUTOCREATECONTACT_REQUIRED">AutoCreateContact field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\' && vm.action.data2 === \'1\'" class="md-block">\n        <label translate="TOOLS.AUTOCREATE_FIELD">Autocreate field</label>\n        <md-select name="autocreateField" ng-model="vm.action.data4" ng-required="vm.action.data2 === \'1\'">\n          <md-optgroup label="{{ \'TOOLS.STANDARD\' | translate }}">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.contactFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.LIST\' | translate }}" ng-if="vm.listFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.listFields">\n              {{ field.name }}</md-option>\n          </md-optgroup>\n          <md-optgroup label="{{ \'TOOLS.GLOBALS\' | translate }}" ng-if="vm.customFields.length > 0">\n            <md-option ng-value="field.columnName" ng-repeat="field in vm.customFields">\n              {{ field.displayName }}</md-option>\n          </md-optgroup>\n        </md-select>\n        <div ng-messages="actionForm[\'data4\'].$error" ng-show="actionForm[\'data4\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AUTOCREATE_FIELD_REQUIRED">Autocreate field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'contactManager\'" class="md-block">\n        <label translate="TOOLS.IGNOREDIALERCONTACTID">Ignore dialer contact Id</label>\n        <md-select name="data5" ng-model="vm.action.data5" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.IGNOREDIALERCONTACTID_REQUIRED">Ignore dialer contact Id field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" required>\n          <md-option ng-value="\'GET\'">GET</md-option>\n          <md-option ng-value="\'POST\'">POST</md-option>\n          <md-option ng-value="\'PUT\'">PUT</md-option>\n          <md-option ng-value="\'DELETE\'">DELETE</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.TIMEOUT">Timeout</label>\n        <input type="number" name="data5" ng-model="vm.action.data5" min="1" max="10" ng-required="true">\n        <div class="hint"><span translate="TOOLS.HELP.TIMEOUT"></span></div>\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="TOOLS.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n              equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="TOOLS.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n              equal than</span> <span>10</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\'" class="md-block">\n        <label translate="TOOLS.HEADERS">Headers</label>\n        <textarea name="data6" ng-model="vm.action.data6"></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.HEADERS"></span></div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'urlForward\' && (vm.action.data1 == \'POST\' || vm.action.data1 == \'PUT\')" class="md-block">\n        <label translate="TOOLS.BODY">Body</label>\n        <textarea name="data7" ng-model="vm.action.data7"></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.BODY"></span></div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT_TYPE">Script_Type</label>\n        <input type="input" name="data2" ng-model="vm.action.data2">\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT_TYPE"></span></div>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_TYPE_REQUIRED">Script_Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT_INFO">Script_Info</label>\n        <input type="input" name="data1" ng-model="vm.action.data1">\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT_INFO"></span></div>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_INFO_REQUIRED">Script_Info field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'script\'" class="md-block">\n        <label translate="TOOLS.SCRIPT">Script</label>\n        <textarea name="data3" ng-model="vm.action.data3" required></textarea>\n        <div class="hint"><span translate="TOOLS.HELP.SCRIPT"></span></div>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.SCRIPT_REQUIRED">Script field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\'" class="md-block">\n        <label translate="TOOLS.INTEGRATION">Integration</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-init="vm.onIntegrationInit()" ng-change="vm.onIntegrationSelection()" required>\n          <md-option ng-value="\'desk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1306]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1306])">Desk</md-option>\n          <md-option ng-value="\'dynamics365\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1309]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1309])">Dynamics365</md-option>\n          <md-option ng-value="\'freshdesk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1303]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1303])">Freshdesk</md-option>\n          <md-option ng-value="\'freshsales\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1304]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1304])">Freshsales</md-option>\n          <md-option ng-value="\'salesforce\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1302]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1302])">Salesforce</md-option>\n          <md-option ng-value="\'servicenow\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1310]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1310])">ServiceNow</md-option>\n          <md-option ng-value="\'sugarcrm\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1305]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1305])">SugarCRM</md-option>\n          <md-option ng-value="\'vtiger\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1308]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1308])">vTiger</md-option>\n          <md-option ng-value="\'zendesk\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1301]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1301])">Zendesk</md-option>\n          <md-option ng-value="\'zoho\'" ng-if="(vm.newAction && vm.hasSectionPermissions[1307]) || !vm.newAction" ng-disabled="(!vm.newAction && !vm.hasSectionPermissions[1307])">Zoho</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.INTEGRATION_REQUIRED">Integration field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\' && vm.action.data1" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="data2" ng-model="vm.action.data2" ng-change="vm.onIntegrationAccountSelection()" ng-disabled="vm.action.isIntegrationDisabled" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.accounts">{{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'integration\'  && vm.action.data1 && vm.action.data2" class="md-block">\n        <label translate="TOOLS.CONFIGURATION">Configuration</label>\n        <md-select name="data3" ng-model="vm.action.data3" required ng-disabled="vm.action.isIntegrationDisabled">\n          <md-option ng-value="\'\'+data3.id" ng-repeat="data3 in vm.configurations | filter : { AccountId: (vm.action.data2 | toInteger) } : true">{{\n            data3.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.CONFIGURATION_REQUIRED">Configuration field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\'" class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select name="data1" ng-model="vm.action.data1" ng-change="vm.onTypeSelection()" required>\n          <md-option ng-value="\'0\'">Popup</md-option>\n          <md-option ng-value="\'1\'">CTI URL</md-option>\n          <md-option ng-value="\'2\'">Windows App</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data1\'].$error" ng-show="actionForm[\'data1\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'2\'" class="md-block">\n        <label translate="TOOLS.APPLICATION">Application</label>\n        <input type="text" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'2\'" class="md-block">\n        <label translate="TOOLS.ARGUMENTS">Arguments</label>\n        <input type="text" name="data3" ng-model="vm.action.data3">\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ARGUMENTS_REQUIRED">Arguments field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'motionbar\' && vm.action.data1 == \'0\'" class="md-block">\n        <label translate="TOOLS.TEMPLATE">Template</label>\n        <md-select name="data2" ng-model="vm.action.data2" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.templates" ng-disabled="data2.canSelect === false">\n            {{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TEMPLATE_REQUIRED">Template field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'0\'" class="md-block">\n        <label translate="TOOLS.TEMPLATE">Template</label>\n        <md-select name="data2" ng-model="vm.action.data2" required>\n          <md-option ng-value="\'\'+data2.id" ng-repeat="data2 in vm.templates" ng-disabled="data2.canSelect === false">\n            {{ data2.name }}</md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.TEMPLATE_REQUIRED">Template field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.URL">Url</label>\n        <input type="url" name="data2" ng-model="vm.action.data2" ng-required="true">\n        <div ng-messages="actionForm[\'data2\'].$error" ng-show="actionForm[\'data2\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.URL_REQUIRED">Url field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="TOOLS.ERRORS.URL_MUST_VALID_URL">Url must be a valid url http://www.xcally.com</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="(vm.action.action == \'motionbar\' || vm.action.action == \'browser\') && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.EVENTVARIABLES">EventVariables</label>\n        <md-select name="data3" ng-model="vm.action.data3" required>\n          <md-option ng-value="\'1\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n          <md-option ng-value="\'0\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n        </md-select>\n        <div class="hint"><span translate="TOOLS.HELP.EVENTVARIABLES"></span></div>\n        <div ng-messages="actionForm[\'data3\'].$error" ng-show="actionForm[\'data3\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.EVENTVARIABLES_REQUIRED">EventVariables field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data1 == \'1\'" class="md-block">\n        <label translate="TOOLS.LOCATION">Location</label>\n        <md-select name="data4" ng-model="vm.action.data4" required ng-change="vm.onActionLocationChange()">\n          <md-option ng-value="0"> {{ \'TOOLS.NEW_TAB\' | translate }} </md-option>\n          <md-option ng-value="1"> {{ \'TOOLS.NEW_WINDOW\' | translate }} </md-option>\n          <md-option ng-value="2"> {{ \'TOOLS.MOTION_TAB\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="actionForm[\'data4\'].$error" ng-show="actionForm[\'data4\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.LOCATION_REQUIRED">Location field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data4 == \'1\'" class="md-block">\n        <label translate="TOOLS.WINDOWWIDTH">WindowWidth</label>\n        <input type="text" name="data5" ng-model="vm.action.data5">\n        <div ng-messages="actionForm[\'data5\'].$error" ng-show="actionForm[\'data5\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.WINDOWWIDTH_REQUIRED">WindowWidth field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.action.action == \'browser\' && vm.action.data4 == \'1\'" class="md-block">\n        <label translate="TOOLS.WINDOWHEIGHT">WindowHeight</label>\n        <input type="text" name="data6" ng-model="vm.action.data6">\n        <div ng-messages="actionForm[\'data6\'].$error" ng-show="actionForm[\'data6\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.WINDOWHEIGHT_REQUIRED">WindowHeight field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAction" ng-click="vm.saveAction()" class="send-button md-accent md-raised" ng-disabled="actionForm.$invalid || actionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAction" ng-click="vm.addNewAction()" class="send-button md-accent md-raised" ng-disabled="actionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ACTION" translate-attr-aria-label="TOOLS.ADD_ACTION">\n          ADD ACTION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAction" ng-click="vm.deleteAction($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/allconditions/allconditions.html",'<div ng-controller="TriggerAllConditionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedAllConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="TOOLS.ALLCONDITIONS">All Conditions</span>\n      <ms-search-bar on-search="vm_dc.getAllConditions()" query="vm_dc.query" debounce="300" direction="down">\n      </ms-search-bar>\n      <div flex></div>\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditAllCondition($event)" aria-label="add allCondition" translate translate-attr-label="TOOLS.ADD_ALLCONDITION">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedAllConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{ vm_dc.selectedAllConditions.length }}\n        {{ vm_dc.selectedAllConditions.length > 1 ? \'items\' : \'item\' }} selected</span>\n      <div flex></div>\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedAllConditions" csv-label="true" filename="triggers.csv">\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\n      </button>\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedAllConditions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n        <md-icon md-font-icon="icon-delete"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container class="font-size-12">\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedAllConditions" md-progress="vm_dc.promise">\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getAllConditions">\n        <tr md-row>\n          <th md-column md-order-by="id">\n            {{ \'TOOLS.ID\' | translate }}\n          </th>\n          <th md-column md-order-by="field">\n            {{ \'TOOLS.FIELD\' | translate }}\n          </th>\n          <th md-column md-order-by="operator">\n            {{ \'TOOLS.OPERATOR\' | translate }}\n          </th>\n          <th md-column md-order-by="value">\n            {{ \'TOOLS.VALUE\' | translate }}\n          </th>\n          <th md-column md-order-by="createdAt">\n            {{ \'TOOLS.CREATED_AT\' | translate }}\n          </th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row md-select="allCondition" md-select-id="id" ng-repeat="allCondition in vm_dc.allConditions.rows">\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ allCondition.id }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ \'TOOLS.\' + vm_dc.fields[allCondition.field] | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ \'TOOLS.\' + allCondition.operator | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="!allCondition.value" md-cell>\n            {{ allCondition.value }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.chatWebsites | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.mailAccounts | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'sms\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.smsAccounts | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'whatsapp\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.whatsappAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'fax\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.faxAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'openchannel\' && allCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.openchannelAccounts | filter : {\'id\': (allCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'queue\'" md-cell>\n            {{ (vm_dc.queues | filter : {\'name\':allCondition.value} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'routeId\'" md-cell>\n            {{ (vm_dc.outboundRoutes | filter : {\'id\':(allCondition.value | toInteger)} : true)[0].exten }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'agent\'" md-cell>\n            {{ (vm_dc.agents | filter : {\'name\':allCondition.value} : true)[0].fullname }}</td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'voice\' && allCondition.field == \'lastevent\'" md-cell>\n            {{ vm_dc.callStatuses[allCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'interaction\'" md-cell>\n            {{ allCondition.value | capitalize }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel != \'voice\' && allCondition.field == \'message\'" md-cell>\n            {{ vm_dc.messageStatuses[allCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'mail\' && allCondition.field == \'mailSubstatus\'" md-cell>\n            {{ allCondition.value === \'null\' ? (\'TOOLS.NONE\' | translate) : (vm_dc.mailSubstatuses | filter : {\'name\': allCondition.value } : true)[0].name }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" ng-if="vm.trigger.channel == \'chat\' && allCondition.field == \'offlineMessage\'" md-cell>\n            {{allCondition.value}} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" md-cell>\n            {{ allCondition.createdAt | formatdate }}\n          </td>\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="3">\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                  <md-button ng-click="vm_dc.createOrEditAllCondition($event, allCondition)" translate="TOOLS.EDIT_ALLCONDITION">\n                    Edit AllCondition\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                  <md-button ng-click="vm_dc.deleteConfirm(allCondition, $event)" translate="TOOLS.DELETE_ALLCONDITION">\n                    Delete AllCondition\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n        <tr md-row ng-if="!vm_dc.allConditions.rows.length">\n          <td md-cell colspan="5">\n            <div layout="row" layout-align="center center">\n              <span class="text-boxed-light" translate="TOOLS.NO_ALLCONDITION_AVAILABLE">No condition\n                available</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.allConditions.count }}" md-on-paginate="vm_dc.getAllConditions" md-page-select>\n  </md-table-pagination>\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/allconditions/create/dialog.html",'<md-dialog class="allCondition-dialog" aria-label="New AllCondition">\n  <form name="allConditionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAllCondition ? \'TOOLS.NEW_ALLCONDITION\' : \'TOOLS.EDIT_ALLCONDITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.FIELD">Field</label>\n        <md-select name="field" ng-model="vm.allCondition.field" ng-change="vm.onFieldSelection()" md-autofocus required>\n          <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.AGENT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'">\n            {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n          <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'mailSubstatus\'" ng-if="vm.trigger.channel == \'mail\'"> {{ \'TOOLS.MAIL_SUBSTATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'offlineMessage\'" ng-if="vm.trigger.channel == \'chat\'"> {{ \'TOOLS.OFFLINE_MESSAGE\' | translate }}\n          </md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'field\'].$error" ng-show="allConditionForm[\'field\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FIELD_REQUIRED">Field field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OPERATOR">Operator</label>\n        <md-select name="operator" ng-model="vm.allCondition.operator" required>\n          <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n          <md-option ng-value="\'not_equals\'"> {{ \'TOOLS.NOT_EQUALS\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'operator\'].$error" ng-show="allConditionForm[\'operator\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'account\'" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.accounts" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'queue\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.QUEUE">Queue</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.queues" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'routeId\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">\n            {{ value.exten }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'agent\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.AGENT">Agent</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.agents" ng-disabled="value.canSelect === false">\n            {{ value.fullname }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'lastevent\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="status.value" ng-repeat="status in vm.callStatuses">\n            {{ status.name }}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'mailSubstatus\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="mailSubstatus.name" ng-repeat="mailSubstatus in vm.mailSubstatuses">\n            {{ mailSubstatus.name }}</md-option>\n          <md-option ng-value="\'null\'">{{\'TOOLS.NONE\' | translate}}</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'interaction\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'opened\'">Opened</md-option>\n          <md-option ng-value="\'closed\'">Closed</md-option>\n          <md-option ng-if="vm.trigger.channel==\'mail\'" ng-value="\'substatus\'">SubStatus</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'message\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'in\'">Incoming</md-option>\n          <md-option ng-value="\'out\'">Outgoing</md-option>\n          <md-option ng-value="\'accept\'">Accepted</md-option>\n          <md-option ng-value="\'reject\'">Rejected</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.allCondition.field == \'offlineMessage\' && vm.trigger.channel == \'chat\'" class="md-block">\n        <label translate="TOOLS.CHAT">Chat</label>\n        <md-select name="value" ng-model="vm.allCondition.value" required>\n          <md-option ng-value="\'created\'">Created</md-option>\n        </md-select>\n        <div ng-messages="allConditionForm[\'value\'].$error" ng-show="allConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAllCondition" ng-click="vm.saveAllCondition()" class="send-button md-accent md-raised" ng-disabled="allConditionForm.$invalid || allConditionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAllCondition" ng-click="vm.addNewAllCondition()" class="send-button md-accent md-raised" ng-disabled="allConditionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ALLCONDITION" translate-attr-aria-label="TOOLS.ADD_ALLCONDITION">\n          ADD ALLCONDITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAllCondition" ng-click="vm.deleteAllCondition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/anyconditions/anyconditions.html",'<div ng-controller="TriggerAnyConditionsController as vm_dc" ng-init="vm_dc.onInit(vm.trigger, vm.crudPermissions)">\n  <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedAnyConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead" translate="TOOLS.ANYCONDITIONS">AnyConditions</span>\n      <ms-search-bar on-search="vm_dc.getAnyConditions()" query="vm_dc.query" debounce="300" direction="down"></ms-search-bar>\n      <div flex></div>\n      <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditAnyCondition($event)" aria-label="add anyCondition" translate translate-attr-label="TOOLS.ADD_ANYCONDITION">\n        <md-icon md-font-icon="icon-plus"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedAnyConditions.length">\n    <div class="md-toolbar-tools">\n      <span class="md-subhead">{{ vm_dc.selectedAnyConditions.length }}\n        {{ vm_dc.selectedAnyConditions.length > 1 ? \'items\' : \'item\' }} selected</span>\n      <div flex></div>\n      <button class="md-icon-button" ng-csv="vm_dc.exportSelectedAnyConditions" csv-label="true" filename="triggers.csv">\n        <md-icon md-font-icon="icon-file-excel"></md-icon>\n      </button>\n      <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedAnyConditions($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n        <md-icon md-font-icon="icon-delete"></md-icon>\n      </md-button>\n    </div>\n  </md-toolbar>\n  <md-table-container class="font-size-12">\n    <table md-table md-row-select multiple ng-model="vm_dc.selectedAnyConditions" md-progress="vm_dc.promise">\n      <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getAnyConditions">\n        <tr md-row>\n          <th md-column md-order-by="id">\n            {{ \'TOOLS.ID\' | translate }}\n          </th>\n          <th md-column md-order-by="field">\n            {{ \'TOOLS.FIELD\' | translate }}\n          </th>\n          <th md-column md-order-by="operator">\n            {{ \'TOOLS.OPERATOR\' | translate }}\n          </th>\n          <th md-column md-order-by="value">\n            {{ \'TOOLS.VALUE\' | translate }}\n          </th>\n          <th md-column md-order-by="createdAt">\n            {{ \'TOOLS.CREATED_AT\' | translate }}\n          </th>\n          <th md-column width="10px"></th>\n        </tr>\n      </thead>\n      <tbody md-body>\n        <tr md-row md-select="anyCondition" md-select-id="id" ng-repeat="anyCondition in vm_dc.anyConditions.rows">\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ anyCondition.id}}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ \'TOOLS.\' + vm_dc.fields[anyCondition.field] | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ \'TOOLS.\' + anyCondition.operator | uppercase | translate }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="!anyCondition.value" md-cell>\n            {{ anyCondition.value }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.chatWebsites | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.mailAccounts | filter : {\'id\':(anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'sms\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.smsAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, allCondition)" ng-if="vm.trigger.channel == \'whatsapp\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.whatsappAccounts | filter : {\'id\':(anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'fax\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.faxAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'openchannel\' && anyCondition.field == \'account\'" md-cell>\n            {{ (vm_dc.openchannelAccounts | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'queue\'" md-cell>\n            {{ (vm_dc.queues | filter : {\'name\':anyCondition.value} : true)[0].name }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'routeId\'" md-cell>\n            {{ (vm_dc.outboundRoutes | filter : {\'id\': (anyCondition.value | toInteger)} : true)[0].exten }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'agent\'" md-cell>\n            {{ (vm_dc.agents | filter : {\'name\':anyCondition.value} : true)[0].fullname }}</td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'voice\' && anyCondition.field == \'lastevent\'" md-cell>\n            {{ vm_dc.callStatuses[anyCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'interaction\'" md-cell>\n            {{ anyCondition.value | capitalize }} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel != \'voice\' && anyCondition.field == \'message\'" md-cell>\n            {{ vm_dc.messageStatuses[anyCondition.value] }} </td>\n          <td ng-click="vm_dc.createOrEditAllCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'mail\' && anyCondition.field == \'mailSubstatus\'" md-cell>\n            {{ anyCondition.value === \'null\' ? (\'TOOLS.NONE\' | translate) : (vm_dc.mailSubstatuses | filter : {\'name\': anyCondition.value } : true)[0].name }}\n          </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" ng-if="vm.trigger.channel == \'chat\' && anyCondition.field == \'offlineMessage\'" md-cell>\n            {{anyCondition.value}} </td>\n          <td ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" md-cell>\n            {{ anyCondition.createdAt | formatdate }}\n          </td>\n          <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n            <md-menu>\n              <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n              </md-button>\n              <md-menu-content width="3">\n                <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                  <md-button ng-click="vm_dc.createOrEditAnyCondition($event, anyCondition)" translate="TOOLS.EDIT_ANYCONDITION">\n                    Edit AnyCondition\n                  </md-button>\n                </md-menu-item>\n                <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                  <md-button ng-click="vm_dc.deleteConfirm(anyCondition, $event)" translate="TOOLS.DELETE_ANYCONDITION">\n                    Delete AnyCondition\n                  </md-button>\n                </md-menu-item>\n              </md-menu-content>\n            </md-menu>\n          </td>\n        </tr>\n        <tr md-row ng-if="!vm_dc.anyConditions.rows.length">\n          <td md-cell colspan="5">\n            <div layout="row" layout-align="center center">\n              <span class="text-boxed-light" translate="TOOLS.NO_ANYCONDITION_AVAILABLE">No anycondition\n                available</span>\n            </div>\n          </td>\n        </tr>\n      </tbody>\n    </table>\n  </md-table-container>\n  <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{ vm_dc.anyConditions.count }}" md-on-paginate="vm_dc.getAnyConditions" md-page-select>\n  </md-table-pagination>\n</div>'),e.put("app/main/apps/tools/views/triggers/edit/anyconditions/create/dialog.html",'<md-dialog class="anyCondition-dialog" aria-label="New AnyCondition">\n  <form name="anyConditionForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newAnyCondition ? \'TOOLS.NEW_ANYCONDITION\' : \'TOOLS.EDIT_ANYCONDITION\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.FIELD">Field</label>\n        <md-select name="field" ng-model="vm.anyCondition.field" ng-change="vm.onFieldSelection()" md-autofocus required>\n          <md-option ng-value="\'queue\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.QUEUE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'lastevent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.CALL_STATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'routeId\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.OUTBOUNDROUTE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'agent\'" ng-if="vm.trigger.channel == \'voice\'"> {{ \'TOOLS.AGENT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'account\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.ACCOUNT\' | translate }}\n          </md-option>\n          <md-option ng-value="\'interaction\'" ng-if="vm.trigger.channel != \'voice\'">\n            {{ \'TOOLS.INTERACTION\' | translate }} </md-option>\n          <md-option ng-value="\'message\'" ng-if="vm.trigger.channel != \'voice\'"> {{ \'TOOLS.MESSAGE\' | translate }}\n          </md-option>\n          <md-option ng-value="\'mailSubstatus\'" ng-if="vm.trigger.channel == \'mail\'"> {{ \'TOOLS.MAIL_SUBSTATUS\' | translate }}\n          </md-option>\n          <md-option ng-value="\'offlineMessage\'" ng-if="vm.trigger.channel == \'chat\'"> {{ \'TOOLS.OFFLINE_MESSAGE\' | translate }}\n          </md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'field\'].$error" ng-show="anyConditionForm[\'field\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.FIELD_REQUIRED">Field field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.OPERATOR">Operator</label>\n        <md-select name="operator" ng-model="vm.anyCondition.operator" required>\n          <md-option ng-value="\'equals\'"> {{ \'TOOLS.EQUALS\' | translate }} </md-option>\n          <md-option ng-value="\'not_equals\'"> {{ \'TOOLS.NOT_EQUALS\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'operator\'].$error" ng-show="anyConditionForm[\'operator\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OPERATOR_REQUIRED">Operator field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'account\'" class="md-block">\n        <label translate="TOOLS.ACCOUNT">Account</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.accounts" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.ACCOUNT_REQUIRED">Account field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'queue\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.QUEUE">Queue</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.queues" ng-disabled="value.canSelect === false">\n            {{ value.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'routeId\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.id.toString()" ng-repeat="value in vm.outboundRoutes" ng-disabled="value.canSelect === false">\n            {{ value.exten }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'agent\' && vm.trigger.channel == \'voice\'" class="md-block">\n        <label translate="TOOLS.AGENT">Agent</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="value.name" ng-repeat="value in vm.agents" ng-disabled="value.canSelect === false">\n            {{ value.fullname }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'lastevent\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="status.value" ng-repeat="status in vm.callStatuses">\n            {{ status.name }}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'mailSubstatus\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="mailSubstatus.name" ng-repeat="mailSubstatus in vm.mailSubstatuses">\n            {{ mailSubstatus.name }}</md-option>\n          <md-option ng-value="\'null\'">{{\'TOOLS.NONE\' | translate}}</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'interaction\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'opened\'">Opened</md-option>\n          <md-option ng-value="\'closed\'">Closed</md-option>\n          <md-option ng-if="vm.trigger.channel==\'mail\'" ng-value="\'substatus\'">SubStatus</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'message\' && vm.trigger.channel != \'voice\'" class="md-block">\n        <label translate="TOOLS.VALUE">Value</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'in\'">Incoming</md-option>\n          <md-option ng-value="\'out\'">Outgoing</md-option>\n          <md-option ng-value="\'accept\'">Accepted</md-option>\n          <md-option ng-value="\'reject\'">Rejected</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.anyCondition.field == \'offlineMessage\' && vm.trigger.channel == \'chat\'" class="md-block">\n        <label translate="TOOLS.CHAT">Chat</label>\n        <md-select name="value" ng-model="vm.anyCondition.value" required>\n          <md-option ng-value="\'created\'">Created</md-option>\n        </md-select>\n        <div ng-messages="anyConditionForm[\'value\'].$error" ng-show="anyConditionForm[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newAnyCondition" ng-click="vm.saveAnyCondition()" class="send-button md-accent md-raised" ng-disabled="anyConditionForm.$invalid || anyConditionForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newAnyCondition" ng-click="vm.addNewAnyCondition()" class="send-button md-accent md-raised" ng-disabled="anyConditionForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_ANYCONDITION" translate-attr-aria-label="TOOLS.ADD_ANYCONDITION">\n          ADD ANYCONDITION\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newAnyCondition" ng-click="vm.deleteAnyCondition($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/triggers/edit/view.html",'<div id="tools-trigger" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-triggers-button md-icon-button" aria-label="Go to triggers" ng-click="vm.gotoTriggers()" translate translate-attr-aria-label="TOOLS.GO_TO_TRIGGERS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="trigger-image" hide-xs>\n          <img ng-src="assets/images/business/triggers.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">#{{ vm.trigger.id }}\n            <span ng-if="vm.trigger.name">{{ vm.trigger.name }}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{ vm.trigger.createdAt | date:\'medium\' }}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTrigger()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (allconditionsForm.$invalid) || (anyconditionsForm.$invalid) || (actionsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trigger-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.trigger.name" required autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CHANNEL">Channel</label>\n                <md-select name="channel" ng-model="vm.trigger.channel" required disabled>\n                  <md-option ng-value="\'voice\'"> {{ \'TOOLS.VOICE\' | translate }} </md-option>\n                  <md-option ng-value="\'openchannel\'" ng-if="vm.license.openchannel">\n                    {{ \'TOOLS.OPENCHANNEL\' | translate }} </md-option>\n                  <md-option ng-value="\'chat\'" ng-if="vm.license.chat"> {{ \'TOOLS.CHAT\' | translate }} </md-option>\n                  <md-option ng-value="\'mail\'" ng-if="vm.license.mail"> {{ \'TOOLS.MAIL\' | translate }} </md-option>\n                  <md-option ng-value="\'sms\'" ng-if="vm.license.messaging"> {{ \'TOOLS.SMS\' | translate }} </md-option>\n                  <md-option ng-value="\'fax\'" ng-if="vm.license.fax"> {{ \'TOOLS.FAX\' | translate }} </md-option>\n                  <md-option ng-value="\'whatsapp\'" ng-if="vm.license.whatsapp"> {{ \'TOOLS.WHATSAPP\' | translate }}\n                  </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'channel\'].$error" ng-show="generalForm[\'channel\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CHANNEL_REQUIRED">Channel field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.trigger.status" aria-label="Status" ng-disabled="!vm.crudPermissions.canEdit">\n                  <span translate="TOOLS.STATUS">Status</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.trigger.description" ng-disabled="!vm.crudPermissions.canEdit">\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.CONDITIONS&ACTIONS">CONDITIONS&ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trigger-detail-form-container allconditions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/allconditions/allconditions.html\'">\n          </div>\n          <div class="trigger-detail-form-container anyconditions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/anyconditions/anyconditions.html\'">\n          </div>\n          <div class="trigger-detail-form-container actions md-background-bg md-whiteframe-1dp" ng-include="\'app/main/apps/tools/views/triggers/edit/actions/actions.html\'">\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/tools/views/triggers/triggers.html",'<div id="triggers" class="page-layout simple left-sidenav inner-sidenav">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TRIGGERS">Triggers</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTriggers.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedTriggers =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-triggers-count">\n          <span>{{ vm.selectedTriggers.length }}</span>\n          <span translate="TOOLS.SELECTED">Selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTriggers()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTriggers()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTriggers" csv-label="true" filename="triggers.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTriggers($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n      \x3c!-- TRIGGER TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTriggers" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTriggers">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="channel">{{ \'TOOLS.CHANNEL\' | translate }}</th>\n                <th md-column md-order-by="status">{{ \'TOOLS.STATUS\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.triggers.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="trigger" md-select-id="id" ng-repeat="trigger in vm.triggers.rows">\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="id ">{{ trigger.id }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="name ">{{ trigger.name }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="channel ">\n                  {{ \'TOOLS.\' + trigger.channel | uppercase | translate }}</td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="status ">\n                  <md-icon md-colors="{color: {{ trigger.status ? \'\\\'green\\\'\' : \'\\\'grey\\\'\' }}}" md-font-icon="{{ trigger.status ? \'icon-check\' : \'icon-close\' }}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditTrigger($event, trigger)" md-cell class="description ">\n                  {{ trigger.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.goToEditState(trigger)" translate="TOOLS.EDIT_TRIGGER">\n                          Edit Trigger\n                        </md-button>\n                      </md-menu-item>\n                      \x3c!-- SUBACTIONS --\x3e\n                      \x3c!-- ACTIONS --\x3e\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteconfirm(trigger, $event)" translate="TOOLS.DELETE_TRIGGER">\n                          Delete Trigger\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'TOOLS.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'TOOLS.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'TOOLS.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.triggers.count }}" md-on-paginate="vm.getTriggers" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TRIGGER TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n  </div>\n  \x3c!-- / CONTENT --\x3e\n  \x3c!-- ADD TRIGGER BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-trigger-button" ng-click="vm.createOrEditTrigger($event)" aria-label="add trigger" translate translate-attr-aria-label="TOOLS.ADD_TRIGGER">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TRIGGER BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/trunks/create/dialog.html",'<md-dialog class="trunk-dialog" aria-label="New Trunk">\n  <form name="trunkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newTrunk">\n\n        <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n        <div ng-messages="trunkForm[\'name\'].$error" ng-show="trunkForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trunk.active" aria-label="active"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.HOST">host</label>\n        <input type="text" name="host" ng-model="vm.trunk.host" ng-required="true">\n\n        <div class="hint"><span translate="TOOLS.HELP.HOST"></span></div>\n        <div ng-messages="trunkForm[\'host\'].$error" ng-show="trunkForm[\'host\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.HOST_REQUIRED">host field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.SECRET">secret</label>\n        <input type="password" name="secret" ng-model="vm.trunk.secret" placeholder="Password" translate translate-attr-placeholder="TOOLS.PASSWORD">\n        <div class="hint"><span translate="TOOLS.HELP.SECRET"></span></div>\n        <div ng-messages="trunkForm[\'secret\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DEFAULTUSER">defaultuser</label>\n        <input type="text" name="defaultuser" ng-model="vm.trunk.defaultuser">\n\n        <div class="hint"><span translate="TOOLS.HELP.DEFAULTUSER"></span></div>\n        <div ng-messages="trunkForm[\'defaultuser\'].$error" ng-show="trunkForm[\'defaultuser\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DEFAULTUSER_REQUIRED">defaultuser field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.REGISTRY">registry</label>\n        <input type="text" name="registry" ng-model="vm.trunk.registry">\n\n        <div class="hint"><span translate="TOOLS.HELP.REGISTRY"></span></div>\n        <div ng-messages="trunkForm[\'registry\'].$error" ng-show="trunkForm[\'registry\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.REGISTRY_REQUIRED">registry field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.trunk.description">\n\n        <div ng-messages="trunkForm[\'description\'].$error" ng-show="trunkForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newTrunk" ng-click="vm.saveTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid || trunkForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newTrunk" ng-click="vm.addNewTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_TRUNK" translate-attr-aria-label="TOOLS.ADD_TRUNK">\n          ADD TRUNK\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newTrunk" ng-click="vm.deleteTrunk($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/trunks/edit/clone/clone.html",'<md-dialog class="trunk-dialog" aria-label="Clone Trunk">\n  <form name="trunkForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newTrunk">\n\n        <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n        <div ng-messages="trunkForm[\'name\'].$error" ng-show="trunkForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.trunk.active" aria-label="active"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <md-button type="submit" ng-click="vm.cloneTrunk()" class="send-button md-accent md-raised" ng-disabled="trunkForm.$invalid" aria-label="CLONE" translate="TOOLS.CLONE_TRUNK" translate-attr-aria-label="TOOLS.CLONE_TRUNK">\n        CLONE TRUNK\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/trunks/edit/view.html",'<div id="tools-trunk" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-trunks-button md-icon-button" aria-label="Go to trunks" ng-click="vm.gotoTrunks()" translate translate-attr-aria-label="TOOLS.GO_TO_TRUNKS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="trunk-image" hide-xs>\n          <img ng-src="assets/images/business/trunks.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.trunk.id}}\n            <span ng-if="vm.trunk.name">{{vm.trunk.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="TOOLS.CREATED_AT"></span> <span>{{vm.trunk.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.trunk, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="TOOLS.GOTO_TRUNK"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak ng-if="vm.crudPermissions.canEdit">\n      <md-button ng-click="vm.clonedialog(vm.trunk, $event)" class="md-fab md-green-500-bg md-icon-button" aria-label="clone">\n        <md-tooltip><span translate="TOOLS.CLONE_TRUNK"></span></md-tooltip>\n        <md-icon md-font-icon="icon-content-duplicate"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveTrunk()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (advancedForm.$invalid) || (otherFieldsForm.$invalid)" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.trunk.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="TOOLS.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="TOOLS.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.trunk.active" aria-label="active" ng-disabled="!vm.crudPermissions.canEdit"><span translate="TOOLS.ACTIVE">active</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.HOST">host</label>\n                <input type="text" name="host" ng-model="vm.trunk.host" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.HOST"></span></div>\n                <div ng-messages="generalForm[\'host\'].$error" ng-show="generalForm[\'host\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.HOST_REQUIRED">host field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.SECRET">secret</label>\n                <input type="password" name="secret" ng-model="vm.trunk.secret" placeholder="Password" translate translate-attr-placeholder="TOOLS.PASSWORD">\n                <div class="hint"><span translate="TOOLS.HELP.SECRET"></span></div>\n                <div ng-messages="generalForm[\'secret\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="TOOLS.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DEFAULTUSER">defaultuser</label>\n                <input type="text" name="defaultuser" ng-model="vm.trunk.defaultuser" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.DEFAULTUSER"></span></div>\n                <div ng-messages="generalForm[\'defaultuser\'].$error" ng-show="generalForm[\'defaultuser\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DEFAULTUSER_REQUIRED">defaultuser field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CONTEXT">context</label>\n                <md-select name="context" ng-model="vm.trunk.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.CONTEXT"></span></div>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CONTEXT_REQUIRED">context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALLERID">callerid</label>\n                <input type="text" name="callerid" ng-model="vm.trunk.callerid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.CALLERID"></span></div>\n                <div ng-messages="generalForm[\'callerid\'].$error" ng-show="generalForm[\'callerid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALLERID_REQUIRED">callerid field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TYPE">Type</label>\n                <md-select name="type" ng-model="vm.trunk.type" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'friend\'">Friend</md-option>\n                  <md-option ng-value="\'user\'">User</md-option>\n                  <md-option ng-value="\'peer\'">Peer</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TYPE"></span></div>\n                <div ng-messages="generalForm[\'type\'].$error" ng-show="generalForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DTMFMODE">dtmfmode</label>\n                <md-select name="dtmfmode" ng-model="vm.trunk.dtmfmode" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'rfc2833\'">rfc2833</md-option>\n                  <md-option ng-value="\'info\'">info</md-option>\n                  <md-option ng-value="\'shortinfo\'">shortinfo</md-option>\n                  <md-option ng-value="\'inband\'">inband</md-option>\n                  <md-option ng-value="\'auto\'">auto</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.DTMFMODE"></span></div>\n                <div ng-messages="generalForm[\'dtmfmode\'].$error" ng-show="generalForm[\'dtmfmode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DTMFMODE_REQUIRED">dtmfmode field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.NAT">nat</label>\n                <md-select name="nat" ng-model="vm.trunk.nat" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'force_rport\'">force_rport</md-option>\n                  <md-option ng-value="\'comedia\'">comedia</md-option>\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'never\'">never</md-option>\n                  <md-option ng-value="\'route\'">route</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.NAT"></span></div>\n                <div ng-messages="generalForm[\'nat\'].$error" ng-show="generalForm[\'nat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.NAT_REQUIRED">nat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.QUALIFY">qualify</label>\n                <md-select name="qualify" ng-model="vm.trunk.qualify" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.QUALIFY"></span></div>\n                <div ng-messages="generalForm[\'qualify\'].$error" ng-show="generalForm[\'qualify\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.QUALIFY_REQUIRED">qualify field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ALLOWCODECS">AllowCodecs</label>\n                <md-select name="allow" ng-model="vm.trunk.allow" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ulaw\'">ulaw</md-option>\n                  <md-option ng-value="\'alaw\'">alaw</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                  <md-option ng-value="\'g723\'">g723</md-option>\n                  <md-option ng-value="\'g726\'">g726</md-option>\n                  <md-option ng-value="\'g722\'">g722</md-option>\n                  <md-option ng-value="\'g729\'">g729</md-option>\n                  <md-option ng-value="\'ilbc\'">ilbc</md-option>\n                  <md-option ng-value="\'opus\'">opus</md-option>\n                  <md-option ng-value="\'h264\'">h264</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ALLOWCODECS"></span></div>\n                <div ng-messages="generalForm[\'allow\'].$error" ng-show="generalForm[\'allow\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ALLOWCODECS_REQUIRED">AllowCodecs field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.INSECURE">insecure</label>\n                <md-select name="insecure" ng-model="vm.trunk.insecure" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'port\'">port</md-option>\n                  <md-option ng-value="\'invite\'">invite</md-option>\n                  <md-option ng-value="\'very\'">very</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.INSECURE"></span></div>\n                <div ng-messages="generalForm[\'insecure\'].$error" ng-show="generalForm[\'insecure\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.INSECURE_REQUIRED">insecure field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALL_LIMIT">call_limit</label>\n                <input type="number" name="call_limit" ng-model="vm.trunk.call_limit" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.CALL_LIMIT"></span></div>\n                <div ng-messages="generalForm[\'call_limit\'].$error" ng-show="generalForm[\'call_limit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALL_LIMIT_REQUIRED">call_limit field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.trunk.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.REGISTRY">registry</label>\n                <input type="text" name="registry" ng-model="vm.trunk.registry" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.REGISTRY"></span></div>\n                <div ng-messages="advancedForm[\'registry\'].$error" ng-show="advancedForm[\'registry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.REGISTRY_REQUIRED">registry field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.DIRECTMEDIA">directmedia</label>\n                <md-select name="directmedia" ng-model="vm.trunk.directmedia" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">yes</md-option>\n                  <md-option ng-value="\'no\'">no</md-option>\n                  <md-option ng-value="\'nonat\'">nonat</md-option>\n                  <md-option ng-value="\'update\'">update</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.DIRECTMEDIA"></span></div>\n                <div ng-messages="advancedForm[\'directmedia\'].$error" ng-show="advancedForm[\'directmedia\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.DIRECTMEDIA_REQUIRED">directmedia field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.CALLCOUNTER">callcounter</label>\n                <md-select name="callcounter" ng-model="vm.trunk.callcounter" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.CALLCOUNTER"></span></div>\n                <div ng-messages="advancedForm[\'callcounter\'].$error" ng-show="advancedForm[\'callcounter\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.CALLCOUNTER_REQUIRED">callcounter field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.FROMDOMAIN">fromdomain</label>\n                <input type="text" name="fromdomain" ng-model="vm.trunk.fromdomain" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.FROMDOMAIN"></span></div>\n                <div ng-messages="advancedForm[\'fromdomain\'].$error" ng-show="advancedForm[\'fromdomain\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.FROMDOMAIN_REQUIRED">fromdomain field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.FROMUSER">fromuser</label>\n                <input type="text" name="fromuser" ng-model="vm.trunk.fromuser" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.FROMUSER"></span></div>\n                <div ng-messages="advancedForm[\'fromuser\'].$error" ng-show="advancedForm[\'fromuser\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.FROMUSER_REQUIRED">fromuser field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.OUTBOUNDPROXY">outboundproxy</label>\n                <input type="text" name="outboundproxy" ng-model="vm.trunk.outboundproxy" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.OUTBOUNDPROXY"></span></div>\n                <div ng-messages="advancedForm[\'outboundproxy\'].$error" ng-show="advancedForm[\'outboundproxy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.OUTBOUNDPROXY_REQUIRED">outboundproxy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ADD_PHONE_TO_URI">Add_phone_to_URI</label>\n                <md-select name="usereqphone" ng-model="vm.trunk.usereqphone" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ADD_PHONE_TO_URI"></span></div>\n                <div ng-messages="advancedForm[\'usereqphone\'].$error" ng-show="advancedForm[\'usereqphone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ADD_PHONE_TO_URI_REQUIRED">Add_phone_to_URI field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TRUST_REMOTE_PARTY_ID">Trust_Remote_Party_ID</label>\n                <md-select name="trustrpid" ng-model="vm.trunk.trustrpid" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TRUST_REMOTE_PARTY_ID"></span></div>\n                <div ng-messages="advancedForm[\'trustrpid\'].$error" ng-show="advancedForm[\'trustrpid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TRUST_REMOTE_PARTY_ID_REQUIRED">Trust_Remote_Party_ID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.SEND_REMOTE_PARTY_ID_HEADER">Send_Remote_Party_ID_header</label>\n                <md-select name="sendrpid" ng-model="vm.trunk.sendrpid" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n\n                  <md-option ng-value="\'pai\'"> {{ \'TOOLS.PAI\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.SEND_REMOTE_PARTY_ID_HEADER"></span></div>\n                <div ng-messages="advancedForm[\'sendrpid\'].$error" ng-show="advancedForm[\'sendrpid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.SEND_REMOTE_PARTY_ID_HEADER_REQUIRED">Send_Remote_Party_ID_header field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.ENCRYPTION">encryption</label>\n                <md-select name="encryption" ng-model="vm.trunk.encryption" required ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'TOOLS.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'TOOLS.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.ENCRYPTION"></span></div>\n                <div ng-messages="advancedForm[\'encryption\'].$error" ng-show="advancedForm[\'encryption\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.ENCRYPTION_REQUIRED">encryption field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.PORT">port</label>\n                <input type="number" name="port" ng-model="vm.trunk.port" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.PORT"></span></div>\n                <div ng-messages="advancedForm[\'port\'].$error" ng-show="advancedForm[\'port\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.PORT_REQUIRED">port field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.TRANSPORT">Transport</label>\n                <md-select name="transport" ng-model="vm.trunk.transport" multiple required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'udp\'">udp</md-option>\n                  <md-option ng-value="\'tcp\'">tcp</md-option>\n                  <md-option ng-value="\'ws\'">ws</md-option>\n                  <md-option ng-value="\'wss\'">wss</md-option>\n                  <md-option ng-value="\'tls\'">tls</md-option>\n                </md-select>\n                <div class="hint"><span translate="TOOLS.HELP.TRANSPORT"></span></div>\n                <div ng-messages="advancedForm[\'transport\'].$error" ng-show="advancedForm[\'transport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.TRANSPORT_REQUIRED">Transport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.T38PT_UDPTL">t38pt_udptl</label>\n                <input type="string" name="t38pt_udptl" ng-model="vm.trunk.t38pt_udptl" value="no" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="TOOLS.HELP.T38PT_UDPTL"></span></div>\n                <div ng-messages="advancedForm[\'t38pt_udptl\'].$error" ng-show="advancedForm[\'t38pt_udptl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.T38PT_UDPTL_REQUIRED">t38pt_udptl field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.VIDEOSUPPORT">Videosupport</label>\n                <md-select name="videosupport" ng-model="vm.trunk.videosupport" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'always\'">Always</md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'videosupport\'].$error" ng-show="advancedForm[\'videosupport\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLS.ERRORS.VIDEOSUPPORT_REQUIRED">Videosupport field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="TOOLS.OTHERFIELDS">OTHERFIELDS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="trunk-detail-form-container otherfields md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="TOOLS.OTHERFIELDS">OTHERFIELDS</div>\n            </div>\n            <form name="otherFieldsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="TOOLS.OTHERFIELDS">otherFields</label>\n                <textarea name="otherFields" ng-model="vm.trunk.otherFields" autofocus></textarea>\n                <div class="hint"><span translate="TOOLS.HELP.OTHERFIELDS"></span></div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/tools/views/trunks/trunks.html",'<div id="trunks" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.TRUNKS">Trunks</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedTrunks.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedTrunks =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-trunks-count">\n          <span>{{vm.selectedTrunks.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllTrunks()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectTrunks()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedTrunks" csv-label="true" filename="trunks.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedTrunks($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- TRUNK TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedTrunks" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="active">{{ \'TOOLS.ACTIVE\' | translate }}</th>\n                <th md-column md-order-by="host">{{ \'TOOLS.HOST\' | translate }}</th>\n                <th md-column md-order-by="registry">{{ \'TOOLS.REGISTRY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.trunks.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="trunk" md-select-id="id" ng-repeat="trunk in vm.trunks.rows">\n                <td md-cell ng-if="trunk.userpic"><img class="avatar" alt="{{trunk.name}}" ng-src="api/users/{{trunk.id}}/avatar" /></td>\n                <td md-cell ng-if="!trunk.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{trunk.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="id ">{{trunk.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="name ">{{trunk.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="active ">\n                  <md-icon md-colors="{color: {{trunk.active ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{trunk.active ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="host ">{{trunk.host}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="registry ">{{trunk.registry}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(trunk, ev) : vm.createOrEditTrunk($event, trunk)" md-cell class="description ">{{trunk.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(trunk, $event    )" translate="TOOLS.EDIT_TRUNK">\n                          Edit Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.clonedialog(trunk, $event    )" translate="TOOLS.CLONE_TRUNK">\n                          clone Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(trunk, $event    )" translate="TOOLS.GOTOREALTIME_TRUNK">\n                          goToRealtime Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(trunk, $event    )" translate="TOOLS.DELETE_TRUNK">\n                          Delete Trunk\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.trunks.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / TRUNK TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD TRUNK BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-trunk-button" ng-click="vm.createOrEditTrunk($event)" aria-label="add trunk" translate translate-attr-aria-label="TOOLS.ADD_TRUNK">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD TRUNK BUTTON --\x3e\n</div>'),e.put("app/main/apps/tools/views/variables/create/dialog.html",'<md-dialog class="variable-dialog" aria-label="New Variable">\n  <form name="variableForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.variable.name" ng-required="true" autofocus>\n\n        <div ng-messages="variableForm[\'name\'].$error" ng-show="variableForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.variable.description">\n\n        <div ng-messages="variableForm[\'description\'].$error" ng-show="variableForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLS.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVariable" ng-click="vm.saveVariable()" class="send-button md-accent md-raised" ng-disabled="variableForm.$invalid || variableForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVariable" ng-click="vm.addNewVariable()" class="send-button md-accent md-raised" ng-disabled="variableForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_VARIABLE" translate-attr-aria-label="TOOLS.ADD_VARIABLE">\n          ADD VARIABLE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVariable" ng-click="vm.deleteVariable($event)" aria-label="DELETE" translate translate-attr-aria-label="TOOLS.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="TOOLS.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/tools/views/variables/variables.html",'<div id="variables" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-auto-fix" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="TOOLS.VARIABLES">Variables</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="TOOLS.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVariables.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVariables =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="TOOLS.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-variables-count">\n          <span>{{vm.selectedVariables.length}}</span>\n          <span translate="TOOLS.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="TOOLS.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVariables()" translate="TOOLS.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVariables()" translate="TOOLS.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVariables" csv-label="true" filename="variables.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVariables($event)" aria-label="delete selected" translate translate-attr-label="TOOLS.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VARIABLE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVariables" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVariables">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'TOOLS.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'TOOLS.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'TOOLS.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.variables.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="TOOLS.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="variable" md-select-id="id" ng-repeat="variable in vm.variables.rows">\n                <td md-cell ng-if="variable.userpic"><img class="avatar" alt="{{variable.name}}" ng-src="api/users/{{variable.id}}/avatar" /></td>\n                <td md-cell ng-if="!variable.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{variable.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="id ">{{variable.id}}</td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="name ">{{variable.name}}</td>\n                <td ng-click="vm.createOrEditVariable($event, variable)" md-cell class="description ">{{variable.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="TOOLS.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(variable, $event    )" translate="TOOLS.EDIT_VARIABLE">\n                          Edit Variable\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(variable, $event    )" translate="TOOLS.DELETE_VARIABLE">\n                          Delete Variable\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'TOOLS.PAGE\' | translate}}:\', rowsPerPage: \'{{\'TOOLS.ROWSPERPAGE\' | translate}}:\', of: \'{{\'TOOLS.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.variables.count}}" md-on-paginate="vm.getVariables" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VARIABLE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VARIABLE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-variable-button" ng-click="vm.createOrEditVariable($event)" aria-label="add variable" translate translate-attr-aria-label="TOOLS.ADD_VARIABLE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VARIABLE BUTTON --\x3e\n</div>'),e.put("app/main/apps/video/views/screenRecordings/create/dialog.html",'<md-dialog class="screenRecording-dialog" aria-label="New screenRecording">\n  <form name="screenRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VIDEO.RATING">Rating</label>\n        <md-select name="rating" ng-model="vm.screenRecording.rating" autofocus ng-disabled="!vm.newscreenRecording && !vm.crudPermissions.canEdit">\n          <md-option ng-value="null">{{\'VIDEO.NO_RATING\' | translate}}</md-option>\n          <md-option value="1">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n          </md-option>\n          <md-option value="2">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n          </md-option>\n          <md-option value="3">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n          </md-option>\n          <md-option value="4">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n          </md-option>\n          <md-option value="5">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n          </md-option>\n        </md-select>\n        <div ng-messages="screenRecordingForm[\'rating\'].$error" ng-show="screenRecordingForm[rating].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VIDEO.ERRORS.RATING_REQUIRED">Rating field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newscreenRecording" ng-click="vm.savescreenRecording()" class="send-button md-accent md-raised" ng-disabled="screenRecordingForm.$invalid || screenRecordingForm.$pristine" aria-label="SAVE" translate="VIDEO.SAVE" translate-attr-aria-label="VIDEO.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newscreenRecording" ng-click="vm.addNewscreenRecording()" class="send-button md-accent md-raised" ng-disabled="screenRecordingForm.$invalid" aria-label="ADD" translate="VIDEO.ADD_SCREENRECORDING" translate-attr-aria-label="VIDEO.ADD_SCREENRECORDING">\n          ADD SCREENRECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newscreenRecording" ng-click="vm.deletescreenRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="VIDEO.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VIDEO.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/video/views/screenRecordings/partialViews/play.html",'<md-dialog class="play-dialog" aria-label="play">\n  <form name="playForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="{{ vm.app.toUpperCase() }}.{{  vm.label.toUpperCase() }}">Play Recording</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-disabled="vm.loading" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-hide="vm.loading">\n      <div layout="row" layout-sm flex>\n        \x3c!-- VIRTUAL field --\x3e\n        <md-card>\n\n          <md-card-title ng-if="vm.actionOptions.upperTitle">\n            <md-card-title-text>\n              <span class="md-headline">{{ vm.filename }}</span>\n              <span class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.UPDATEDAT"></span>: {{ vm.recording.updatedAt}}</span>\n            </md-card-title-text>\n          </md-card-title>\n\n          \x3c!-- video recording directive --\x3e\n          <ms-dialog-recording ng-if="vm.format" id="vm.recording.id" title="vm.filename" element="vm.element" model="vm.route" path="vm.path" class="md-card-image"></ms-dialog-recording>\n          \x3c!-- / video recording directive --\x3e\n\n          <span ng-if="!vm.format">\n            <em ng-if="vm.found">{{ vm.app.toUpperCase() + \'.CANT_PLAY_THIS_FILE\' | translate }}</em>\n            <em ng-if="!vm.found">{{ vm.app.toUpperCase() + \'.FILE_NOT_FOUND\' | translate }}</em>\n          </span>\n\n          <md-card-title ng-if="vm.actionOptions.lowerTitle">\n            <md-card-title-text>\n              <span class="md-headline">{{ vm.filename }}</span>\n              <span class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.UPDATEDAT"></span>:{{ vm.recording.updatedAt}}</span>\n              <span ng-if="vm.actionOptions.properties" class="md-subhead"><span translate="{{ vm.app.toUpperCase() }}.PROPERTIES"></span>:</span>\n            </md-card-title-text>\n          </md-card-title>\n\n          <md-card-content ng-if="vm.actionOptions.properties">\n            <md-list>\n              <md-list-item class="md-2-line" ng-repeat="(key,value) in vm.properties" ng-click="null" ng-if="key != \'value\' && key != \'updatedAt\' && key != \'queue\'">\n\n                <md-icon ng-if="vm.icon" class="md-avatar-icon" md-font-icon="vm.actionOptions.propertiesIcon" class="s24"></md-icon>\n\n                <div class="md-list-item-text" layout="column">\n                  <p><b><span translate="{{ vm.app.toUpperCase() }}.{{ key.toUpperCase() }}"></span></b></p>\n                  <p>{{ value }}\n                    <p>\n                </div>\n              </md-list-item>\n            </md-list>\n          </md-card-content>\n\n\n        </md-card>\n      </div>\n    </md-dialog-content>\n    <div ng-hide="!vm.loading" layout-fill style="min-height: 397px;" layout="row" layout-sm="column" layout-align="center center">\n      <md-progress-circular class="md-primary md-hue-1" md-diameter="96"></md-progress-circular>\n    </div>\n  </form>\n</md-dialog>'),e.put("app/main/apps/video/views/screenRecordings/screenRecordings.html",'<div id="screenRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-video" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VIDEO.SCREENRECORDINGS">ScreenRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VIDEO.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getScreenRecordings()"></ms-quick-filter>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedScreenRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedScreenRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VIDEO.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-screenRecordings-count">\n          <span>{{vm.selectedScreenRecordings.length}}</span>\n          <span translate="VIDEO.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VIDEO.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllScreenRecordings()" translate="VIDEO.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectScreenRecordings()" translate="VIDEO.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedScreenRecordings" csv-label="true" filename="screenRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedScreenRecordings($event)" aria-label="delete selected" translate translate-attr-label="VIDEO.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- SCREENRECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedScreenRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getScreenRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VIDEO.ID\' | translate }}</th>\n                <th md-column md-order-by="rating">{{ \'VIDEO.RATING\' | translate }}</th>\n                <th md-column md-order-by="UserId">{{ \'VIDEO.AGENT\' | translate }}</th>\n                <th md-column md-order-by="duration">{{ \'VIDEO.DURATION\' | translate }}</th>\n                <th md-column md-order-by="startedAt">{{ \'VIDEO.RECORDSTARTTIME\' | translate }}</th>\n                <th md-column md-order-by="closedAt">{{ \'VIDEO.RECORDENDTIME\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.screenRecordings.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VIDEO.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="screenRecording" md-select-id="id" ng-repeat="screenRecording in vm.screenRecordings.rows">\n                <td md-cell ng-if="screenRecording.userpic"><img class="avatar" alt="{{screenRecording.name}}" ng-src="api/users/{{screenRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!screenRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{screenRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="id ">{{screenRecording.id}}</td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="rating ">\n                  <md-icon md-font-icon="icon-star" style="color:red" ng-show="screenRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:screenRecording.rating"></md-icon><span ng-hide="screenRecording.rating" translate="VIDEO.NO_RATING">No rating</span>\n                </td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="UserId ">{{ (vm.users | filter : {\'id\':screenRecording.UserId} : true)[0].fullname }}</td>\n                <td md-cell><span ng-bind="vm.convertDuration(screenRecording.duration)"></span></td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="startedAt ">{{screenRecording.startedAt | date:\'medium\' }}</td>\n                <td ng-click="vm.createOrEditscreenRecording($event, screenRecording)" md-cell class="closedAt ">{{screenRecording.closedAt | date:\'medium\' }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VIDEO.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.playrecording(screenRecording, $event  , \'value\'  , \'play_screenrecording\'  , \'video\' )" translate="VIDEO.PLAY_SCREENRECORDING">\n                          play screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadScreenRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(screenRecording, $event  , \'screen/recordings\'   )" translate="VIDEO.DOWNLOAD_SCREENRECORDING">\n                          Download screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(screenRecording, $event    )" translate="VIDEO.DELETE_SCREENRECORDING">\n                          Delete screenRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VIDEO.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VIDEO.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VIDEO.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.screenRecordings.count}}" md-on-paginate="vm.getScreenRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / SCREENRECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/routing/dialog.html",'<md-dialog ng-init="vm.init()" class="voice-routing-dialog" aria-label="New routing application">\n  <form name="routingAppForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'VOICE.EDIT_\' + vm.application.appType | uppercase | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content ng-switch="vm.application.appType">\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <div ng-switch-when="agi">\n        <div ng-include="\'app/main/apps/voice/routing/views/agi.html\'"></div>\n      </div>\n      <div ng-switch-when="custom">\n        <div ng-include="\'app/main/apps/voice/routing/views/custom.html\'"></div>\n      </div>\n      <div ng-switch-when="dial">\n        <div ng-include="\'app/main/apps/voice/routing/views/dial.html\'"></div>\n      </div>\n      <div ng-switch-when="externalDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/externalDial.html\'"></div>\n      </div>\n      <div ng-switch-when="goTo">\n        <div ng-include="\'app/main/apps/voice/routing/views/goTo.html\'"></div>\n      </div>\n      <div ng-switch-when="hangup">\n        <div ng-include="\'app/main/apps/voice/routing/views/hangup.html\'"></div>\n      </div>\n      <div ng-switch-when="internalDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/internalDial.html\'"></div>\n      </div>\n      <div ng-switch-when="outboundDial">\n        <div ng-include="\'app/main/apps/voice/routing/views/outboundDial.html\'"></div>\n      </div>\n      <div ng-switch-when="playback">\n        <div ng-include="\'app/main/apps/voice/routing/views/playback.html\'"></div>\n      </div>\n      <div ng-switch-when="queue">\n        <div ng-include="\'app/main/apps/voice/routing/views/queue.html\'"></div>\n      </div>\n      <div ng-switch-when="ringGroup">\n        <div ng-include="\'app/main/apps/voice/routing/views/ringGroup.html\'"></div>\n      </div>\n      <div ng-switch-when="set">\n        <div ng-include="\'app/main/apps/voice/routing/views/set.html\'"></div>\n      </div>\n      <div ng-switch-when="voicemail">\n        <div ng-include="\'app/main/apps/voice/routing/views/voicemail.html\'"></div>\n      </div>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveRoutingApp()" class="send-button md-accent md-raised" ng-disabled="routingAppForm.$invalid || routingAppForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/routing/interval/dialog.html",'<md-dialog ng-init="vm.initialize()" class="interval-dialog" aria-label="Edit Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ \'TOOLS.EDIT_INTERVAL\' | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.crudPermissions.canEdit" ng-change="vm.onTypeChange()">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | startcase }}</md-option>\n        </md-select>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.crudPermissions.canEdit" required>\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals.rows" ng-disabled="interval.canSelect === false">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | startcase }}</span></md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | startcase }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | startcase }}</span></md-option>\n          </md-select>\n        </md-input-container>\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | startcase }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="start center">\n      <md-button type="submit" ng-if="vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/routing/views/agi.html",'<md-input-container class="md-block">\n  <label translate="VOICE.PROJECT">Project</label>\n  <md-select name="project" ng-model="vm.application.project" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'agi://127.0.0.1/square,{{project.name}}\'" ng-repeat="project in vm.projects.rows" ng-disabled="project.canSelect === false">{{ project.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'project\'].$error" ng-show="routingAppForm[\'project\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PROJECT_REQUIRED">Project field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/custom.html",'<md-input-container class="md-block">\n  <label translate="VOICE.APPLICATION_NAME">Application_Name</label>\n  <input type="text" name="app" ng-model="vm.application.app" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'app\'].$error" ng-show="routingAppForm[\'app\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.APPLICATION_NAME_REQUIRED">Application_Name field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.ARGUMENTS">Arguments</label>\n  <input type="text" name="appdata" ng-model="vm.application.appdata" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'appdata\'].$error" ng-show="routingAppForm[\'appdata\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.ARGUMENTS_REQUIRED">Arguments field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/dial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TECHNOLOGY/RESOURCE">Technology/Resource</label>\n  <input type="text" name="tech" ng-model="vm.application.tech" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'tech\'].$error" ng-show="routingAppForm[\'tech\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TECHNOLOGY/RESOURCE_REQUIRED">Technology/Resource field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/externalDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TRUNK">Trunk</label>\n  <md-select name="trunk" ng-model="vm.application.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks.rows" ng-disabled="trunk.canSelect === false">{{\n      trunk.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'trunk\'].$error" ng-show="routingAppForm[\'trunk\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PHONE">Phone</label>\n  <input type="text" name="phone" ng-model="vm.application.phone" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'phone\'].$error" ng-show="routingAppForm[\'phone\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PHONE_REQUIRED">Phone field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/goTo.html",'<md-input-container class="md-block">\n  <label translate="VOICE.CONTEXT">Context</label>\n  <md-select name="context" ng-model="vm.application.context" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{\n      context.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'context\'].$error" ng-show="routingAppForm[\'context\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.EXTENSION">Extension</label>\n  <input type="text" name="extension" ng-model="vm.application.extension" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'extension\'].$error" ng-show="routingAppForm[\'extension\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.EXTENSION_REQUIRED">Extension field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PRIORITY">Priority</label>\n  <input type="text" name="priority" ng-model="vm.application.priority" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'priority\'].$error" ng-show="routingAppForm[\'priority\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/hangup.html","<md-input-container class=\"md-block\">\n  <label translate=\"VOICE.HANGUP_CAUSE\">Hangup_Cause</label>\n  <md-select name=\"appdata\" ng-model=\"vm.application.appdata\" autofocus required ng-disabled=\"!vm.crudPermissions.canEdit\">\n    <md-option ng-value=\"'1'\"> {{ 'VOICE.HANGUPCAUSE_1' | translate }} </md-option>\n    <md-option ng-value=\"'16'\"> {{ 'VOICE.HANGUPCAUSE_16' | translate }} </md-option>\n    <md-option ng-value=\"'17'\"> {{ 'VOICE.HANGUPCAUSE_17' | translate }} </md-option>\n    <md-option ng-value=\"'18'\"> {{ 'VOICE.HANGUPCAUSE_18' | translate }} </md-option>\n    <md-option ng-value=\"'21'\"> {{ 'VOICE.HANGUPCAUSE_21' | translate }} </md-option>\n    <md-option ng-value=\"'22'\"> {{ 'VOICE.HANGUPCAUSE_22' | translate }} </md-option>\n    <md-option ng-value=\"'27'\"> {{ 'VOICE.HANGUPCAUSE_27' | translate }} </md-option>\n    <md-option ng-value=\"'38'\"> {{ 'VOICE.HANGUPCAUSE_38' | translate }} </md-option>\n    <md-option ng-value=\"'41'\"> {{ 'VOICE.HANGUPCAUSE_41' | translate }} </md-option>\n  </md-select>\n  <div ng-messages=\"routingAppForm['appdata'].$error\" ng-show=\"routingAppForm['appdata'].$touched\" role=\"alert\">\n    <div ng-message=\"required\">\n      <span translate=\"VOICE.ERRORS.HANGUP_CAUSE_REQUIRED\">Hangup_Cause field is required</span>\n    </div>\n  </div>\n</md-input-container>"),e.put("app/main/apps/voice/routing/views/internalDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.USER">User</label>\n  <md-select name="user" ng-model="vm.application.user" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users.rows" ng-disabled="user.canSelect === false">\n      {{ user.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'user\'].$error" ng-show="routingAppForm[\'user\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.USER_REQUIRED">User field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/outboundDial.html",'<md-input-container class="md-block">\n  <label translate="VOICE.TRUNK">Trunk</label>\n  <md-select name="trunk" ng-model="vm.application.trunk" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="trunk.name" ng-repeat="trunk in vm.trunks.rows" ng-disabled="trunk.canSelect === false">{{\n      trunk.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'trunk\'].$error" ng-show="routingAppForm[\'trunk\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TRUNK_REQUIRED">Trunk field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.CALLER_ID">Caller_ID</label>\n  <input type="text" name="callerID" ng-model="vm.application.callerID" ng-disabled="!vm.crudPermissions.canEdit">\n  <div class="hint"><span translate="VOICE.HELP.CALLER_ID"></span></div>\n  <div ng-messages="routingAppForm[\'callerID\'].$error" ng-show="routingAppForm[\'callerID\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.CALLER_ID_REQUIRED">Caller_ID field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.PREFIX">Prefix</label>\n  <input type="text" name="prefix" ng-model="vm.application.prefix" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'prefix\'].$error" ng-show="routingAppForm[\'prefix\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TAGS">Tags</label>\n  <md-select name="tag" ng-model="vm.application.tag" ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'--\'">None</md-option>\n    <md-option ng-value="tag.name" ng-repeat="tag in vm.tags.rows" ng-disabled="tag.canSelect === false">{{ tag.name }}\n    </md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'tag\'].$error" ng-show="routingAppForm[\'tag\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TAGS_REQUIRED">Tags field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/playback.html",'<md-input-container class="md-block">\n  <label translate="VOICE.AUDIO_FILES">Audio_Files</label>\n  <md-select name="sound" ng-model="vm.application.appdata" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}\'" ng-repeat="sound in vm.sounds.rows" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'sound\'].$error" ng-show="routingAppForm[\'sound\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.AUDIO_FILES_REQUIRED">Audio_Files field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <md-switch ng-model="vm.application.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</span></md-switch>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/queue.html",'<md-input-container class="md-block">\n  <label translate="VOICE.QUEUE">Queue</label>\n  <md-select name="queue" ng-model="vm.application.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="queue.name" ng-repeat="queue in vm.queues.rows" ng-disabled="queue.canSelect === false">{{\n      queue.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'queue\'].$error" ng-show="routingAppForm[\'queue\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="URL" ng-model="vm.application.URL" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'URL\'].$error" ng-show="routingAppForm[\'URL\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.ANNOUNCE_OVERRIDES">Announce_Overrides</label>\n  <md-select name="sound" ng-model="vm.application.sound" ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'\'">None</md-option>\n    <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/{{sound.save_name}}\'" ng-repeat="sound in vm.sounds.rows" ng-disabled="sound.canSelect === false">{{ sound.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'sound\'].$error" ng-show="routingAppForm[\'sound\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.ANNOUNCE_OVERRIDES_REQUIRED">Announce_Overrides field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.AGI">Agi</label>\n  <input type="text" name="agi" ng-model="vm.application.agi" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'agi\'].$error" ng-show="routingAppForm[\'agi\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.AGI_REQUIRED">Agi field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.MACRO">Macro</label>\n  <input type="text" name="macro" ng-model="vm.application.macro" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'macro\'].$error" ng-show="routingAppForm[\'macro\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.MACRO_REQUIRED">Macro field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.GOSUB">GoSub</label>\n  <input type="text" name="gosub" ng-model="vm.application.gosub" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'gosub\'].$error" ng-show="routingAppForm[\'gosub\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.GOSUB_REQUIRED">GoSub field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.RULE">Rule</label>\n  <input type="text" name="rule" ng-model="vm.application.rule" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'rule\'].$error" ng-show="routingAppForm[\'rule\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.RULE_REQUIRED">Rule field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.POSITION">Position</label>\n  <input type="number" name="position" ng-model="vm.application.position" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'position\'].$error" ng-show="routingAppForm[\'position\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.POSITION_REQUIRED">Position field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.POSITION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Position must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <md-switch ng-model="vm.application.answer" aria-label="Answer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.ANSWER">Answer</span></md-switch>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/ringGroup.html",'<md-input-container class="md-block">\n  <label translate="VOICE.USER">User</label>\n  <md-select name="user" ng-model="vm.application.users" autofocus multiple required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'SIP/{{user.name}}\'" ng-repeat="user in vm.users.rows" ng-disabled="user.canSelect === false">\n      {{ user.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'user\'].$error" ng-show="routingAppForm[\'user\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.USER_REQUIRED">User field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.TIMEOUT">Timeout</label>\n  <input type="number" name="timeout" ng-model="vm.application.timeout" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'timeout\'].$error" ng-show="routingAppForm[\'timeout\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n    </div>\n    <div ng-message="min">\n      <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or\n        equal than</span> <span>0</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.URL">Url</label>\n  <input type="text" name="url" ng-model="vm.application.url" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'url\'].$error" ng-show="routingAppForm[\'url\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.URL_REQUIRED">Url field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/set.html",'<md-input-container class="md-block">\n  <label translate="VOICE.VARIABLE">Variable</label>\n  <md-select name="variable" ng-model="vm.application.name" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="variable.name" ng-repeat="variable in vm.variables.rows" ng-disabled="variable.canSelect === false">{{\n      variable.name }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'variable\'].$error" ng-show="routingAppForm[\'variable\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.VALUE">Value</label>\n  <input type="text" name="value" ng-model="vm.application.value" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'value\'].$error" ng-show="routingAppForm[\'value\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.VALUE_REQUIRED">Value field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/routing/views/voicemail.html",'<md-input-container class="md-block">\n  <label translate="VOICE.MAILBOX@CONTEXT">Mailbox@Context</label>\n  <md-select name="voiceMail" ng-model="vm.application.voiceMail" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n    <md-option ng-value="\'{{voiceMail.mailbox}}@from-voicemail\'" ng-repeat="voiceMail in vm.voiceMails.rows" ng-disabled="voiceMail.canSelect === false">{{ voiceMail.mailbox }}</md-option>\n  </md-select>\n  <div ng-messages="routingAppForm[\'voiceMail\'].$error" ng-show="routingAppForm[\'voiceMail\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.MAILBOX@CONTEXT_REQUIRED">Mailbox@Context field is required</span>\n    </div>\n  </div>\n</md-input-container>\n<md-input-container class="md-block">\n  <label translate="VOICE.OPTIONS">Options</label>\n  <input type="text" name="options" ng-model="vm.application.options" ng-disabled="!vm.crudPermissions.canEdit">\n  <div ng-messages="routingAppForm[\'options\'].$error" ng-show="routingAppForm[\'options\'].$touched" role="alert">\n    <div ng-message="required">\n      <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n    </div>\n  </div>\n</md-input-container>'),e.put("app/main/apps/voice/views/chanSpies/chanSpies.html",'<div id="chanSpies" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.CHANSPIES">ChanSpies</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedChanSpies.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedChanSpies =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-chanSpies-count">\n          <span>{{vm.selectedChanSpies.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllChanSpies()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectChanSpies()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedChanSpies" csv-label="true" filename="chanSpies.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedChanSpies($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CHANSPY TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedChanSpies" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getChanSpies">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="prefix">{{ \'VOICE.PREFIX\' | translate }}</th>\n                <th md-column md-order-by="auth">{{ \'VOICE.AUTH\' | translate }}</th>\n                <th md-column md-order-by="record">{{ \'VOICE.RECORD\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.chanSpies.rows.length">\n                <td md-cell colspan="7">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="chanSpy" md-select-id="id" ng-repeat="chanSpy in vm.chanSpies.rows">\n                <td md-cell ng-if="chanSpy.userpic"><img class="avatar" alt="{{chanSpy.name}}" ng-src="api/users/{{chanSpy.id}}/avatar" /></td>\n                <td md-cell ng-if="!chanSpy.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{chanSpy.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="id ">{{chanSpy.id}}</td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="name ">{{chanSpy.name}}</td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="prefix ">{{chanSpy.prefix}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chanSpy, ev) : vm.createOrEditchanSpy($event, chanSpy)" md-cell class="auth ">\n                  <md-icon md-colors="{color: {{chanSpy.auth ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{chanSpy.auth ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(chanSpy, ev) : vm.createOrEditchanSpy($event, chanSpy)" md-cell class="record ">\n                  <md-icon md-colors="{color: {{chanSpy.record ? \'\\\'green\\\'\' : \'\\\'grey\\\'\'}}}" md-font-icon="{{chanSpy.record ? \'icon-check\' : \'icon-close\'}}"></md-icon>\n                </td>\n                <td ng-click="vm.createOrEditchanSpy($event, chanSpy)" md-cell class="description ">{{chanSpy.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(chanSpy, $event    )" translate="VOICE.EDIT_CHANSPY">\n                          Edit chanSpy\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(chanSpy, $event    )" translate="VOICE.DELETE_CHANSPY">\n                          Delete chanSpy\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.chanSpies.count}}" md-on-paginate="vm.getChanSpies" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CHANSPY TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CHANSPY BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-chanSpy-button" ng-click="vm.createOrEditchanSpy($event)" aria-label="add chanSpy" translate translate-attr-aria-label="VOICE.ADD_CHANSPY">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CHANSPY BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/chanSpies/create/dialog.html",'<md-dialog class="chanSpy-dialog" aria-label="New chanSpy">\n  <form name="chanSpyForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.chanSpy.name" ng-required="true" autofocus>\n\n        <div ng-messages="chanSpyForm[\'name\'].$error" ng-show="chanSpyForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PREFIX">Prefix</label>\n        <input type="text" name="prefix" ng-model="vm.chanSpy.prefix" ng-required="true">\n\n        <div ng-messages="chanSpyForm[\'prefix\'].$error" ng-show="chanSpyForm[\'prefix\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PREFIX_REQUIRED">Prefix field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.OPTIONS">Options</label>\n        <md-select name="options" ng-model="vm.chanSpy.options" multiple required>\n          <md-option ng-value="\'b\'">b: Only spy on channels involved in a bridged call.</md-option>\n          <md-option ng-value="\'B\'">B: Instead of whispering on a single channel barge in on both channels involved in the call.</md-option>\n          <md-option ng-value="\'E\'">E: Exit when the spied-on channel hangs up.</md-option>\n          <md-option ng-value="\'o\'">o: Only listen to audio coming from this channel.</md-option>\n          <md-option ng-value="\'q\'">q: Don\'t play a beep when beginning to spy on a channel, or speak the selected channel name.</md-option>\n          <md-option ng-value="\'s\'">s: Skip the playback of the channel type (i.e. SIP, IAX, etc) when speaking the selected channel name.</md-option>\n          <md-option ng-value="\'S\'">S: Stop when no more channels are left to spy on.</md-option>\n          <md-option ng-value="\'w\'">w: Enable whisper mode, so the spying channel can talk to the spied-on channel.</md-option>\n          <md-option ng-value="\'W\'">W: Enable private whisper mode, so the spying channel can talk to the spied-on channel but cannot listen to that channel.</md-option>\n        </md-select>\n        <div ng-messages="chanSpyForm[\'options\'].$error" ng-show="chanSpyForm[\'options\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.OPTIONS_REQUIRED">Options field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.chanSpy.auth" aria-label="Auth"><span translate="VOICE.AUTH">Auth</span></md-switch>\n      </md-input-container>\n      <md-input-container class="md-block" ng-if="vm.chanSpy.auth">\n        <label translate="VOICE.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.chanSpy.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n        <div ng-messages="chanSpyForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.chanSpy.record" aria-label="Record"><span translate="VOICE.RECORD">Record</span></md-switch>\n      </md-input-container>\n      <md-input-container ng-if="vm.chanSpy.record" class="md-block">\n        <label translate="VOICE.RECORDINGFORMAT">recordingFormat</label>\n        <md-select name="recordingFormat" ng-model="vm.chanSpy.recordingFormat" required>\n          <md-option ng-value="\'wav\'">wav</md-option>\n          <md-option ng-value="\'gsm\'">gsm</md-option>\n          <md-option ng-value="\'WAV\'">wav49</md-option>\n        </md-select>\n        <div ng-messages="chanSpyForm[\'recordingFormat\'].$error" ng-show="chanSpyForm[\'recordingFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RECORDINGFORMAT_REQUIRED">recordingFormat field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.chanSpy.description">\n\n        <div ng-messages="chanSpyForm[\'description\'].$error" ng-show="chanSpyForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newchanSpy" ng-click="vm.savechanSpy()" class="send-button md-accent md-raised" ng-disabled="chanSpyForm.$invalid || chanSpyForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newchanSpy" ng-click="vm.addNewchanSpy()" class="send-button md-accent md-raised" ng-disabled="chanSpyForm.$invalid" aria-label="ADD" translate="VOICE.ADD_CHANSPY" translate-attr-aria-label="VOICE.ADD_CHANSPY">\n          ADD CHANSPY\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newchanSpy" ng-click="vm.deletechanSpy($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/contexts/contexts.html",'<div id="contexts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.CONTEXTS">Contexts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedContexts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedContexts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-contexts-count">\n          <span>{{vm.selectedContexts.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllContexts()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectContexts()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedContexts" csv-label="true" filename="contexts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedContexts($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- CONTEXT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedContexts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getContexts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.contexts.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="context" md-select-id="id" ng-repeat="context in vm.contexts.rows">\n                <td md-cell ng-if="context.userpic"><img class="avatar" alt="{{context.name}}" ng-src="api/users/{{context.id}}/avatar" /></td>\n                <td md-cell ng-if="!context.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{context.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="id ">{{context.id}}</td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="name ">{{context.name}}</td>\n                <td ng-click="vm.createOrEditContext($event, context)" md-cell class="description ">{{context.description}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(context, $event    )" translate="VOICE.EDIT_CONTEXT">\n                          Edit Context\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(context, $event    )" translate="VOICE.DELETE_CONTEXT">\n                          Delete Context\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.contexts.count}}" md-on-paginate="vm.getContexts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / CONTEXT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD CONTEXT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-context-button" ng-click="vm.createOrEditContext($event)" aria-label="add context" translate translate-attr-aria-label="VOICE.ADD_CONTEXT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD CONTEXT BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/contexts/create/dialog.html",'<md-dialog class="context-dialog" aria-label="New Context">\n  <form name="contextForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.context.name" ng-required="true" autofocus>\n\n        <div ng-messages="contextForm[\'name\'].$error" ng-show="contextForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.context.description">\n\n        <div ng-messages="contextForm[\'description\'].$error" ng-show="contextForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newContext" ng-click="vm.saveContext()" class="send-button md-accent md-raised" ng-disabled="contextForm.$invalid || contextForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newContext" ng-click="vm.addNewContext()" class="send-button md-accent md-raised" ng-disabled="contextForm.$invalid" aria-label="ADD" translate="VOICE.ADD_CONTEXT" translate-attr-aria-label="VOICE.ADD_CONTEXT">\n          ADD CONTEXT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newContext" ng-click="vm.deleteContext($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/inboundRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="inbound-route-dialog" aria-label="New InboundRoute">\n  <form name="inboundrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newInboundRoute ? \'VOICE.NEW_INBOUNDROUTE\' : \'VOICE.EDIT_INBOUNDROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.inboundRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="inboundrouteForm[\'exten\'].$error" ng-show="inboundrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.inboundRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="inboundrouteForm[\'context\'].$error" ng-show="inboundrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.inboundRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="inboundrouteForm[\'alias\'].$error" ng-show="inboundrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.inboundRoute.description">\n        <div ng-messages="inboundrouteForm[\'description\'].$error" ng-show="inboundrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInboundRoute" ng-click="vm.saveInboundRoute()" class="send-button md-accent md-raised" ng-disabled="inboundrouteForm.$invalid || inboundrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInboundRoute" ng-click="vm.addNewInboundRoute()" class="send-button md-accent md-raised" ng-disabled="inboundrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_INBOUNDROUTE" translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n          ADD INBOUNDROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInboundRoute" ng-click="vm.deleteInboundRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/inboundRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-inbound-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-inbound-routes-button md-icon-button" aria-label="Go to inbound routes" ng-click="vm.gotoInboundRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_INBOUNDROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="inbound-route-image" hide-xs>\n          <img ng-src="assets/images/business/inboundroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.inboundRoute.id}}\n            <span ng-if="vm.inboundRoute.exten">{{vm.inboundRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.inboundRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInboundRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="inbound-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.inboundRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.inboundRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.inboundRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.inboundRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="inbound-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/inboundRoutes/inboundRoutes.html",'<div id="inbound-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.INBOUNDROUTES">InboundRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedInboundRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedInboundRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-inbound-routes-count">\n          <span>{{ vm.selectedInboundRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInboundRoutes = vm.inboundRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInboundRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedInboundRoutes" csv-label="true" filename="inbound_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedInboundRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedInboundRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getInboundRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.inboundRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.inboundRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInboundRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_INBOUNDROUTE">\n                          Edit InboundRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_INBOUNDROUTE">\n                          Delete InboundRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.inboundRoutes.count }}" md-on-paginate="vm.getInboundRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-inbound-route-button" ng-click="vm.createOrEditInboundRoute($event)" aria-label="add inbound route" translate translate-attr-aria-label="VOICE.ADD_INBOUNDROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/internalRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="internal-route-dialog" aria-label="New InternalRoute">\n  <form name="internalrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newInternalRoute ? \'VOICE.NEW_INTERNALROUTE\' : \'VOICE.EDIT_INTERNALROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.internalRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="internalrouteForm[\'exten\'].$error" ng-show="internalrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.internalRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="internalrouteForm[\'context\'].$error" ng-show="internalrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.internalRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="internalrouteForm[\'alias\'].$error" ng-show="internalrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.internalRoute.description">\n        <div ng-messages="internalrouteForm[\'description\'].$error" ng-show="internalrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newInternalRoute" ng-click="vm.saveInternalRoute()" class="send-button md-accent md-raised" ng-disabled="internalrouteForm.$invalid || internalrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newInternalRoute" ng-click="vm.addNewInternalRoute()" class="send-button md-accent md-raised" ng-disabled="internalrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_INTERNALROUTE" translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n          ADD INTERNALROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newInternalRoute" ng-click="vm.deleteInternalRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/internalRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-internal-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-internal-routes-button md-icon-button" aria-label="Go to internal routes" ng-click="vm.gotoInternalRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_INTERNALROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="internal-route-image" hide-xs>\n          <img ng-src="assets/images/business/internalroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.internalRoute.id}}\n            <span ng-if="vm.internalRoute.exten">{{vm.internalRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.internalRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveInternalRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="internal-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.internalRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.internalRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.internalRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.internalRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="internal-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/internalRoutes/internalRoutes.html",'<div id="internal-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.INTERNALROUTES">InternalRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedInternalRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedInternalRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-internal-routes-count">\n          <span>{{ vm.selectedInternalRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInternalRoutes = vm.internalRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedInternalRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedInternalRoutes" csv-label="true" filename="internal_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedInternalRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedInternalRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getInternalRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.internalRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.internalRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditInternalRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_INTERNALROUTE">\n                          Edit InternalRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_INTERNALROUTE">\n                          Delete InternalRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.internalRoutes.count }}" md-on-paginate="vm.getInternalRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-internal-route-button" ng-click="vm.createOrEditInternalRoute($event)" aria-label="add internal route" translate translate-attr-aria-label="VOICE.ADD_INTERNALROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/musiconholds/create/dialog.html",'<md-dialog class="musiconhold-dialog" aria-label="New MusicOnHold">\n  <form name="musiconholdForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.musiconhold.name" ng-required="true" autofocus ng-disabled="!vm.newMusicOnHold">\n\n        <div ng-messages="musiconholdForm[\'name\'].$error" ng-show="musiconholdForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.MODE">Mode</label>\n        <md-select name="mode" ng-model="vm.musiconhold.mode" required ng-disabled="!vm.newMusicOnHold">\n\n          <md-option ng-value="\'files\'"> {{ \'VOICE.FILES\' | translate }} </md-option>\n\n          <md-option ng-value="\'custom\'"> {{ \'VOICE.CUSTOM\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="musiconholdForm[\'mode\'].$error" ng-show="musiconholdForm[\'mode\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.MODE_REQUIRED">Mode field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n        <label translate="VOICE.DIRECTORY">Directory</label>\n        <input type="" name="directory" ng-model="vm.musiconhold.directory">\n\n        <div ng-messages="musiconholdForm[\'directory\'].$error" ng-show="musiconholdForm[\'directory\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DIRECTORY_REQUIRED">Directory field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n        <label translate="VOICE.APPLICATION">Application</label>\n        <input type="text" name="application" ng-model="vm.musiconhold.application" ng-required="true">\n\n        <div ng-messages="musiconholdForm[\'application\'].$error" ng-show="musiconholdForm[\'application\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.musiconhold.mode == \'files\'" class="md-block">\n        <label translate="VOICE.SORT">Sort</label>\n        <md-select name="sort" ng-model="vm.musiconhold.sort">\n\n          <md-option ng-value="\'random\'"> {{ \'VOICE.RANDOM\' | translate }} </md-option>\n\n          <md-option ng-value="\'alpha\'"> {{ \'VOICE.ALPHABETICAL\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="musiconholdForm[\'sort\'].$error" ng-show="musiconholdForm[\'sort\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.SORT_REQUIRED">Sort field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMusicOnHold" ng-click="vm.saveMusicOnHold()" class="send-button md-accent md-raised" ng-disabled="musiconholdForm.$invalid || musiconholdForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMusicOnHold" ng-click="vm.addNewMusicOnHold()" class="send-button md-accent md-raised" ng-disabled="musiconholdForm.$invalid" aria-label="ADD" translate="VOICE.ADD_MUSICONHOLD" translate-attr-aria-label="VOICE.ADD_MUSICONHOLD">\n          ADD MUSICONHOLD\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMusicOnHold" ng-click="vm.deleteMusicOnHold($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/musiconholds/edit/mohSounds/dialog.html",'<md-dialog class="mohSound-dialog" aria-label="New MohSound">\n  <form name="mohSoundForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.FILE">File</label>\n        <md-select name="id" ng-model="vm.mohSound.id" autofocus>\n          <md-option ng-value="id.id" ng-repeat="id in vm.sounds" ng-disabled="id.canSelect === false">{{ id.name }}</md-option>\n        </md-select>\n        <div ng-messages="mohSoundForm[\'id\'].$error" ng-show="mohSoundForm[\'id\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.FILE_REQUIRED">File field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newMohSound" ng-click="vm.saveMohSound()" class="send-button md-accent md-raised" ng-disabled="mohSoundForm.$invalid || mohSoundForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newMohSound" ng-click="vm.addNewMohSound()" class="send-button md-accent md-raised" ng-disabled="mohSoundForm.$invalid" aria-label="ADD" translate="VOICE.ADD_MOHSOUND" translate-attr-aria-label="VOICE.ADD_MOHSOUND">\n          ADD MOHSOUND\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newMohSound" ng-click="vm.deleteMohSound($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/musiconholds/edit/view.html",'<div id="voice-musiconhold" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-musiconholds-button md-icon-button" aria-label="Go to musiconholds" ng-click="vm.gotoMusicOnHolds()" translate translate-attr-aria-label="VOICE.GO_TO_MUSICONHOLDS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="musiconhold-image" hide-xs>\n          <img ng-src="assets/images/business/musiconholds.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.musiconhold.id}}\n            <span ng-if="vm.musiconhold.name">{{vm.musiconhold.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.musiconhold.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveMusicOnHold()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (mohSoundsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="musiconhold-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.musiconhold.name" ng-required="true" autofocus disabled>\n\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MODE">Mode</label>\n                <md-select name="mode" ng-model="vm.musiconhold.mode" required disabled>\n\n                  <md-option ng-value="\'files\'"> {{ \'VOICE.FILES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'custom\'"> {{ \'VOICE.CUSTOM\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'mode\'].$error" ng-show="generalForm[\'mode\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MODE_REQUIRED">Mode field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n                <label translate="VOICE.DIRECTORY">Directory</label>\n                <input type="" name="directory" ng-model="vm.musiconhold.directory" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'directory\'].$error" ng-show="generalForm[\'directory\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DIRECTORY_REQUIRED">Directory field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'custom\'" class="md-block">\n                <label translate="VOICE.APPLICATION">Application</label>\n                <input type="text" name="application" ng-model="vm.musiconhold.application" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'application\'].$error" ng-show="generalForm[\'application\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.APPLICATION_REQUIRED">Application field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.musiconhold.mode == \'files\'" class="md-block">\n                <label translate="VOICE.SORT">Sort</label>\n                <md-select name="sort" ng-model="vm.musiconhold.sort" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'random\'"> {{ \'VOICE.RANDOM\' | translate }} </md-option>\n\n                  <md-option ng-value="\'alpha\'"> {{ \'VOICE.ALPHABETICAL\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'sort\'].$error" ng-show="generalForm[\'sort\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SORT_REQUIRED">Sort field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.AUDIOFILES">AUDIOFILES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="musiconhold-detail-form-container mohsounds md-background-bg md-whiteframe-1dp">\n            <div ng-controller="MusicOnHoldMohSoundsController as vm_dc" ng-init="vm_dc.init(vm.musiconhold, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedMusicOnHoldMohSounds.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.MOHSOUNDS">MohSounds</span>\n                  <ms-search-bar on-search="vm_dc.getMusicOnHoldMohSounds()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditMusicOnHoldMohSound($event)" aria-label="add mohSound" translate translate-attr-label="VOICE.ADD_MOHSOUND">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedMusicOnHoldMohSounds.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedMusicOnHoldMohSounds.length}} {{vm_dc.selectedMusicOnHoldMohSounds.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedMusicOnHoldMohSounds" csv-label="true" filename="musiconholds.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedMusicOnHoldMohSounds($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedMusicOnHoldMohSounds" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getMusicOnHoldMohSounds">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'VOICE.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="audio">\n                        {{ \'VOICE.AUDIO\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'VOICE.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="mohSound" md-select-id="id" ng-repeat="mohSound in vm_dc.musiconholdMohSounds.rows">\n                      <td md-cell>\n                        {{mohSound.id}}\n                      </td>\n                      <td md-cell>\n                        \x3c!-- audio recording directive --\x3e\n                        <ms-recording id="mohSound.id" model="\'sound\'"></ms-recording>\n                        \x3c!-- / audio recording directive --\x3e\n                      </td>\n                      <td md-cell>\n                        {{ mohSound.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(mohSound, $event)" translate="VOICE.DELETE_MOHSOUND">\n                                Delete MohSound\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.musiconholdMohSounds.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="VOICE.NO_MOHSOUND_AVAILABLE">No mohsound available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.musiconholdMohSounds.count}}" md-on-paginate="vm_dc.getMusicOnHoldMohSounds" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/musiconholds/musiconholds.html",'<div id="musiconholds" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.MUSICONHOLDS">MusicOnHolds</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedMusicOnHolds.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedMusicOnHolds =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-musiconholds-count">\n          <span>{{vm.selectedMusicOnHolds.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllMusicOnHolds()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectMusicOnHolds()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedMusicOnHolds" csv-label="true" filename="musiconholds.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedMusicOnHolds($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- MUSICONHOLD TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedMusicOnHolds" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getMusicOnHolds">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="mode">{{ \'VOICE.MODE\' | translate }}</th>\n                <th md-column md-order-by="sort">{{ \'VOICE.SORT\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.musiconholds.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="musiconhold" md-select-id="id" ng-repeat="musiconhold in vm.musiconholds.rows">\n                <td md-cell ng-if="musiconhold.userpic"><img class="avatar" alt="{{musiconhold.name}}" ng-src="api/users/{{musiconhold.id}}/avatar" /></td>\n                <td md-cell ng-if="!musiconhold.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{musiconhold.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="id ">{{musiconhold.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="name ">{{musiconhold.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="mode ">{{ \'VOICE.\' + vm.arraymode[musiconhold.mode].option | uppercase | translate }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(musiconhold, ev) : vm.createOrEditMusicOnHold($event, musiconhold)" md-cell class="sort ">{{ \'VOICE.\' + vm.arraysort[musiconhold.sort].option | uppercase | translate }}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(musiconhold, $event    )" translate="VOICE.EDIT_MUSICONHOLD">\n                          Edit MusicOnHold\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(musiconhold, $event    )" translate="VOICE.DELETE_MUSICONHOLD">\n                          Delete MusicOnHold\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.musiconholds.count}}" md-on-paginate="vm.getMusicOnHolds" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / MUSICONHOLD TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD MUSICONHOLD BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-musiconhold-button" ng-click="vm.createOrEditMusicOnHold($event)" aria-label="add musiconhold" translate translate-attr-aria-label="VOICE.ADD_MUSICONHOLD">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD MUSICONHOLD BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/outboundRoutes/create/dialog.html",'<md-dialog ng-init="vm.initialize()" class="outbound-route-dialog" aria-label="New OutboundRoute">\n  <form name="outboundrouteForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.newOutboundRoute ? \'VOICE.NEW_OUTBOUNDROUTE\' : \'VOICE.EDIT_OUTBOUNDROUTE\' | translate\n          }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span>({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n        <input type="text" name="exten" ng-model="vm.outboundRoute.exten" ng-required="true" autofocus>\n        <div ng-messages="outboundrouteForm[\'exten\'].$error" ng-show="outboundrouteForm[\'exten\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CONTEXT">Context</label>\n        <md-select name="context" ng-model="vm.outboundRoute.context" required>\n          <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n        </md-select>\n        <div ng-messages="outboundrouteForm[\'context\'].$error" ng-show="outboundrouteForm[\'context\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.RECORDING">Recording</label>\n        <md-select name="recordingFormat" ng-model="vm.outboundRoute.recordingFormat" ng-change="vm.getRouting()" required>\n          <md-option ng-value="\'none\'">none</md-option>\n          <md-option ng-value="\'wav\'">wav</md-option>\n          <md-option ng-value="\'WAV\'">wav49</md-option>\n          <md-option ng-value="\'gsm\'">gsm</md-option>\n        </md-select>\n        <div class="hint"><span translate="VOICE.HELP.RECORDING"></span></div>\n        <div ng-messages="outboundrouteForm[\'recordingFormat\'].$error" ng-show="outboundrouteForm[\'recordingFormat\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RECORDING_REQUIRED">Recording field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CUTDIGITS">CutDigits</label>\n        <input type="number" name="cutdigits" ng-model="vm.outboundRoute.cutdigits" min="0">\n        <div ng-messages="outboundrouteForm[\'cutdigits\'].$error" ng-show="outboundrouteForm[\'cutdigits\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CUTDIGITS_REQUIRED">CutDigits field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="VOICE.ERRORS.CUTDIGITS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigits must be a valid greater\n              or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ALIAS">Alias</label>\n        <input type="text" name="alias" ng-model="vm.outboundRoute.alias" ng-change="vm.getRouting()">\n        <div ng-messages="outboundrouteForm[\'alias\'].$error" ng-show="outboundrouteForm[\'alias\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.outboundRoute.description">\n        <div ng-messages="outboundrouteForm[\'description\'].$error" ng-show="outboundrouteForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newOutboundRoute" ng-click="vm.saveOutboundRoute()" class="send-button md-accent md-raised" ng-disabled="outboundrouteForm.$invalid || outboundrouteForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newOutboundRoute" ng-click="vm.addNewOutboundRoute()" class="send-button md-accent md-raised" ng-disabled="outboundrouteForm.$invalid" aria-label="ADD" translate="VOICE.ADD_OUTBOUNDROUTE" translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n          ADD OUTBOUNDROUTE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newOutboundRoute" ng-click="vm.deleteOutboundRoute($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/outboundRoutes/edit/view.html",'<div ng-init="vm.onInit()" id="voice-outbound-route" class="page-layout simple tabbed" layout="column">\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-outbound-routes-button md-icon-button" aria-label="Go to outbound routes" ng-click="vm.gotoOutboundRoutes()" translate translate-attr-aria-label="VOICE.GO_TO_OUTBOUNDROUTES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n      <div layout="row" layout-align="start center">\n        <div class="outbound-route-image" hide-xs>\n          <img ng-src="assets/images/business/outboundroutes.jpg">\n        </div>\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.outboundRoute.id}}\n            <span ng-if="vm.outboundRoute.exten">{{vm.outboundRoute.exten}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.outboundRoute.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveOutboundRoute()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (actionsForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n  </div>\n  \x3c!-- /HEADER --\x3e\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      \x3c!-- SETTINGS TAB --\x3e\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="outbound-route-detail-form-container md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PHONENUMBER">PhoneNumber</label>\n                <input type="text" name="exten" ng-model="vm.outboundRoute.exten" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'exten\'].$error" ng-show="generalForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PHONENUMBER_REQUIRED">PhoneNumber field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <md-select name="context" ng-model="vm.outboundRoute.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts.rows" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RECORDING">Recording</label>\n                <md-select name="recordingFormat" ng-model="vm.outboundRoute.recordingFormat" ng-change="vm.onActionsTabSelection()" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'none\'">none</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'WAV\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RECORDING"></span></div>\n                <div ng-messages="generalForm[\'recordingFormat\'].$error" ng-show="generalForm[\'recordingFormat\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RECORDING_REQUIRED">Recording field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CUTDIGITS">CutDigits</label>\n                <input type="number" name="cutdigits" ng-model="vm.outboundRoute.cutdigits" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'cutdigits\'].$error" ng-show="generalForm[\'cutdigits\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CUTDIGITS_REQUIRED">CutDigits field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.CUTDIGITS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">CutDigits must be a valid\n                      greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ALIAS">Alias</label>\n                <input type="text" name="alias" ng-model="vm.outboundRoute.alias" ng-change="vm.onActionsTabSelection()" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'alias\'].$error" ng-show="generalForm[\'alias\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ALIAS_REQUIRED">Alias field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.outboundRoute.description" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /SETTINGS TAB --\x3e\n      \x3c!-- ACTIONS TAB --\x3e\n      <md-tab md-on-select="vm.onActionsTabSelection()">\n        <md-tab-label>\n          <span translate="VOICE.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="outbound-route-detail-form-container no-padding no-margin">\n            <div class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- APPLICATIONS LIST --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm.crudPermissions.canEdit">\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider class="no-margin"></md-divider>\n                <md-list ng-sortable="vm.sortableAppsOptions">\n                  <md-list-item class="handle" ng-repeat="a in vm.apps">\n                    <div layout="row">\n                      <md-icon md-font-icon="icon-apps" class="s16 mr-15"></md-icon>\n                      <p class="text-truncate" translate="VOICE.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias ||\n                        a.appType}}</p>\n                    </div>\n                  </md-list-item>\n                </md-list>\n              </div>\n              \x3c!-- /APPLICATIONS LIST --\x3e\n              <div flex></div>\n              \x3c!-- ROUTING --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm.crudPermissions.canEdit ? 75 : 100}}">\n                <div ng-if="vm.pendingChanges" class="p-10 md-amber-300-bg">\n                  <md-icon md-font-icon="icon-information-outline" aria-label="Save reminder"></md-icon>\n                  <span class="no-margin font-size-12 line-height-30" translate="VOICE.HELP.SAVE_ROUTES"></span>\n                </div>\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar query="vm.query" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm.selectedApplications.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm.selectedApplications.length}}\n                      {{vm.selectedApplications.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm.crudPermissions.canDelete" class="md-icon-button" ng-click="vm.deleteSelectedApplications($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm.selectedApplications">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm.sortableRoutingOptions">\n                      <tr md-row md-select="a" md-select-id="id" ng-repeat="a in vm.applications.rows | filter:vm.query.filter as results">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)">{{a.app.toLowerCase() ===\n                          \'agi\' ? \'Cally-Square\' : a.app | ucfirst}}<span ng-if="a.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm.editApplication($event, $index)"><span class="text-truncate actionAppData">{{a.appdata}}</span></td>\n                        <td md-cell ng-click="vm.editInterval($event, $index)">{{a.IntervalId ? \'From List\' :\n                          a.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{a.IntervalId ? \'From List\' : (a.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell ng-if="!vm.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editApplication($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                                <md-button ng-click="vm.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                                <md-button ng-click="vm.deleteApplication(a, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-class="{ \'ng-cloak\': results.length > 0 }">\n                        <td md-cell colspan="6">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No applications\n                            available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                    <tfoot md-foot>\n                      <tr md-row>\n                        <td md-cell colspan="7">\n                          <span><em translate="VOICE.LEGEND.CUSTOM_APPLICATION">(*) - Custom application.</em></span>\n                        </td>\n                      </tr>\n                    </tfoot>\n                  </table>\n                </md-table-container>\n              </div>\n              \x3c!-- /ROUTING --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      \x3c!-- /ACTIONS TAB --\x3e\n    </md-tabs>\n  </div>\n  \x3c!-- /CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/outboundRoutes/outboundRoutes.html",'<div id="outbound-routes" class="page-layout simple left-sidenav inner-sidenav">\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.OUTBOUNDROUTES">OutboundRoutes</span>\n      </div>\n    </div>\n    <div layout="row">\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n    </div>\n  </div>\n  <div ng-show="vm.selectedOutboundRoutes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n    <div class="close-button-wrapper" ng-click="vm.selectedOutboundRoutes = []">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n    <div flex layout="row" layout-align="space-between center">\n      <div>\n        <span class="selected-outbound-routes-count">\n          <span>{{ vm.selectedOutboundRoutes.length }}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectedOutboundRoutes = vm.outboundRoutes.rows" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.selectedOutboundRoutes = []" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedOutboundRoutes" csv-label="true" filename="outbound_routes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedOutboundRoutes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n    <div class="main scrollable">\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedOutboundRoutes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getOutboundRoutes">\n              <tr md-row>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.PHONENUMBER\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.outboundRoutes.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="route" md-select-id="id" ng-repeat="route in vm.outboundRoutes.rows">\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="id ">{{ route.id }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="exten ">{{ route.exten }}</td>\n                <td ng-click="!vm.crudPermissions.canEdit ? vm.editRoute(route) : vm.createOrEditOutboundRoute($event, route)" md-cell class="description ">{{ route.description }}</td>\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n                  <md-menu>\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n                    <md-menu-content width="3">\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                        <md-button ng-click="vm.editRoute(route)" translate="VOICE.EDIT_OUTBOUNDROUTE">\n                          Edit OutboundRoute\n                        </md-button>\n                      </md-menu-item>\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n                        <md-button ng-click="vm.deleteConfirm(route, $event)" translate="VOICE.DELETE_OUTBOUNDROUTE">\n                          Delete OutboundRoute\n                        </md-button>\n                      </md-menu-item>\n                    </md-menu-content>\n                  </md-menu>\n                </td>\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n        <md-table-pagination md-label="{page: \'{{ \'VOICE.PAGE\' | translate }}:\', rowsPerPage: \'{{ \'VOICE.ROWSPERPAGE\' | translate }}:\', of: \'{{ \'VOICE.OF\' | translate }}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{ vm.outboundRoutes.count }}" md-on-paginate="vm.getOutboundRoutes" md-page-select>\n        </md-table-pagination>\n      </md-card>\n    </div>\n  </div>\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-outbound-route-button" ng-click="vm.createOrEditOutboundRoute($event)" aria-label="add outbound route" translate translate-attr-aria-label="VOICE.ADD_OUTBOUNDROUTE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n</div>'),e.put("app/main/apps/voice/views/realtime/abandonedcalls/view.html",'<md-toolbar class="md-table-toolbar md-default table-header">\n  <div class="md-toolbar-tools" layout="row" layout-align="center center">\n    <span class="md-subhead" translate="DASHBOARDS.ABANDONEDQUEUECALLS">ABANDONED QUEUE CALLS</span>\n    <ms-search-bar on-search="vm.getAbandonedCalls()" query="vm.query" on-collapse="vm.query.filter = undefined" debounce="300">\n    </ms-search-bar>\n    <div flex></div>\n\n    <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getAbandonedCalls()"></ms-quick-filter>\n\n    <md-button class="md-icon-button" ng-click="vm.refresh && vm.refreshAbandonedCalls($event)" aria-label="Reload" translate translate-attr-label="DASHBOARDS.RELOAD">\n      <md-icon md-font-icon="icon-reload"></md-icon>\n      <md-tooltip ng-if="vm.showTooltip" md-visible="vm.showTooltip">{{\'DASHBOARDS.CLICKRELOAD\' | translate}}\n      </md-tooltip>\n    </md-button>\n  </div>\n</md-toolbar>\n<md-table-container>\n  <table md-table md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getAbandonedCalls">\n      <tr md-row>\n        <th md-column md-order-by="id">ID</th>\n        <th md-column md-order-by="calleridname">{{\'DASHBOARDS.FULLNAME\' | translate}}</th>\n        <th md-column md-order-by="calleridnum">{{\'DASHBOARDS.PHONE\' | translate}}</th>\n        <th md-column md-order-by="queue">{{\'DASHBOARDS.QUEUE\' | translate}}</th>\n        <th md-column md-order-by="queuecallerabandonAt">{{\'DASHBOARDS.ABANDONAT\' | translate}}</th>\n        <th md-column md-order-by="lastAssignedTo">{{\'DASHBOARDS.LASTASSIGNEDTO\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column md-order-by="disposition">{{\'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.abandonedCalls.rows.length">\n        <td md-cell colspan="12">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.abandonedCalls.rows">\n        <td md-cell class="id">{{call.id}}</td>\n        <td md-cell class="firstName" privacy ng-cloak>{{call.calleridname}}</td>\n        <td md-cell class="list" privacy ng-cloak>{{call.calleridnum}}</td>\n        <td md-cell class="list">{{vm.queuesMap[call.queue]}}</td>\n        <td md-cell class="list">\n          {{call.queuecallerabandonAt ? (call.queuecallerabandonAt | formatdate) : (call.queuecallerexitAt | formatdate) }}\n        </td>\n        <td md-cell class="list">{{call.lastAssignedTo}}</td>\n        <td md-cell class="list">{{ call.disposition }}</td>\n        <td md-cell class="list">{{ call.secondDisposition }}</td>\n        <td md-cell class="list">{{ call.thirdDisposition }}</td>\n        <td md-cell class="actions">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="DASHBOARDS.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n            <md-menu-content width="2">\n              <md-menu-item ng-if="vm.crudPermissions.canEdit">\n                <md-menu>\n                  <md-button ng-click="$mdMenu.open()" class="text-capitalize" translate="DASHBOARDS.ASSIGNTO">\n                    Assigned\n                    to</md-button>\n                  <md-menu-content>\n                    <md-menu-item ng-if="call.lastAssignedTo">\n                      <md-button ng-click="vm.assignTo(call)"><em translate="DASHBOARDS.NONE">Not Assigned</em>\n                      </md-button>\n                    </md-menu-item>\n                    <md-menu-item ng-if="vm.agents.rows.length" ng-repeat="agent in vm.agents.rows">\n                      <md-button ng-click="vm.assignTo(call,agent)">{{agent.name}}</md-button>\n                    </md-menu-item>\n                  </md-menu-content>\n                </md-menu>\n              </md-menu-item>\n              <md-menu-item>\n                <md-button ng-click="vm.dispose(call)" class="text-capitalize" translate="DASHBOARDS.DISPOSE">\n                  Dispose\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.abandonedCalls.count}}" md-on-paginate="vm.getAbandonedCalls" md-page-select></md-table-pagination>'),e.put("app/main/apps/voice/views/realtime/outbound_calls/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.OUTBOUND_CALLS">Ooutbound Calls</span>\n  </div>\n</md-toolbar>\n\n\x3c!-- OUTBOUNDS TABLE --\x3e\n<md-table-container>\n  <table md-table>\n    <thead md-head>\n      <tr md-row>\n        <th md-column width="30px"></th>\n        <th md-column>{{ \'VOICE.SOURCE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DESTINATION\' | translate }}</th>\n        <th md-column>{{ \'VOICE.ALIAS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.DURATION\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.calls.rows.length">\n        <td md-cell colspan="5">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="call in vm.calls.rows | filter: vm.query.filter | limitTo: vm.query.limit: (vm.query.page - 1) * vm.query.limit">\n        <td md-cell>\n          <i ng-class="vm.channelStatus[call.channelstatedesc.toLowerCase()]"></i>\n        </td>\n        <td md-cell privacy ng-cloak>\n          {{call.calleridname}}, {{call.calleridnum}}\n          <span class="text-boxed" ng-if="call.answered">\n            <timer ng-if="call.answertime" start-time="call.answertime"></timer>\n          </span>\n        </td>\n        <td md-cell privacy ng-cloak>{{call.exten}}</td>\n        <td md-cell>{{call.routealias}}</td>\n        <td md-cell>\n          <span class="text-boxed" ng-if="call.channelstatedesc.toLowerCase() !== \'hangup\'">\n            <timer ng-if="call.starttime" start-time="call.starttime"></timer>\n          </span>\n          <span class="text-boxed" ng-if="call.channelstatedesc.toLowerCase() === \'hangup\'" translate="VOICE.CLOSING">Closing</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.calls.count}}"></md-table-pagination>\n\x3c!-- / OUTBOUNDS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/queue_params/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="MOTIONDIALER.QUEUE_PARAMETERS">Params</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getQueues()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- QUEUE TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getQueues">\n      <tr md-row>\n        <th md-column md-order-by="name">{{\'\n                        VOICE.NAME\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.TOTAL_OFFERED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.ANSWERED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.ABANDONED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.UNMANAGED\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_HOLD_TIME\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_DURATION\' | translate}}</th>\n        <th md-column>{{\'\n                        VOICE.AVG_BILLABLE\' | translate}}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.queues.rows.length > 0">\n        <td md-cell colspan="8">\n          <div layout="row" layout-align="center center">\n            <span translate="MOTIONDIALER.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="queue in vm.queues.rows">\n        <td md-cell>\n          <span>{{queue.name}}</span>\n        </td>\n        <td md-cell>\n          \x3c!-- <span class="font-size-20 grey-fg">{{queue.total || 0}}</span> --\x3e\n          <span class="font-size-20 grey-fg">{{ (queue.answered || 0) + (queue.abandoned || 0) + (queue.unmanaged || 0) }}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered || 0}} ({{(queue.total) ? (queue.answered || 0) * 100/queue.total : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.abandoned || 0}} ({{(queue.total) ? (queue.abandoned || 0) * 100/queue.total : 0 | number:1}}%)</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.unmanaged || 0}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.total ? ((queue.sumHoldTime || 0) / queue.total) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{(queue.total ? ((queue.sumDuration || 0) / queue.total) : 0) | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n        <td md-cell>\n          <span class="font-size-16 grey-fg">{{queue.answered ? ((queue.sumBillable || 0) / queue.answered) : 0 | number: 0 | secToTime | date:\'HH:mm:ss\'}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'MOTIONDIALER.PAGE\' | translate}}:\', rowsPerPage: \'{{\'MOTIONDIALER.ROWSPERPAGE\' | translate}}:\', of: \'{{\'MOTIONDIALER.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.queues.count}}" md-on-paginate="vm.getQueues" md-page-select></md-table-pagination>\n\x3c!-- / QUEUE TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.TELEPHONES">Telephones</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.TRUNKS">Trunks</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUE_CALLS">Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ABANDONEDCALLS">Abandoned Queue Calls</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.QUEUE_PARAMS">Queue Parameters</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.OUTBOUND_CALLS">Outbound Calls</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/voice/views/realtime/telephones/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.TELEPHONES">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTelephones()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- AGENT TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTelephones">\n      <tr md-row>\n        <th md-column md-order-by="fullname">{{ \'VOICE.ACCOUNTNAME\' | translate }}</th>\n        <th md-column md-order-by="internal">{{ \'VOICE.INTERNAL\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PHONE_STATE\' | translate }}</th>\n        <th md-column>{{ \'VOICE.PHONE_STATUS\' | translate }}</th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.telephones">\n        <td md-cell colspan="4">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row md-select="telephone" md-select-id="id" ng-repeat="(id, telephone) in vm.telephones">\n        <td md-cell>{{telephone.fullname}}</td>\n        <td md-cell>{{telephone.internal}}</td>\n        <td md-cell>\n          <i ng-class="vm.stateClass[telephone.state]">\n            <md-tooltip>{{\'VOICE.\' + telephone.state | uppercase | translate}}</md-tooltip>\n          </i>\n        </td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[telephone.status]">\n            <md-tooltip>{{\'VOICE.\' + telephone.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="telephone.status === \'registered\'" class="text-boxed">{{telephone.address}}</span>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTelephones" md-page-select></md-table-pagination>\n\x3c!-- / AGENT TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/realtime/trunks/view.html",'\x3c!-- MAIN --\x3e\n<md-toolbar class="md-table-toolbar md-default">\n  <div class="md-toolbar-tools">\n    <span class="md-subhead" translate="VOICE.TRUNKS">Telephones</span>\n    <div flex></div>\n    <ms-search-bar on-search="vm.getTrunks()" query="vm.query" on-collapse="vm.query.filter = undefined;" debounce="300"></ms-search-bar>\n  </div>\n</md-toolbar>\n\n\x3c!-- TRUNKS TABLE --\x3e\n<md-table-container>\n  <table md-table multiple md-progress="vm.promise">\n    <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getTrunks">\n      <tr md-row>\n        <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n        <th md-column>{{ \'VOICE.TRUNK_STATUS\' | translate }}</th>\n        <th md-column>{{ \'VOICE.REGISTRY\' | translate }}</th>\n        <th md-column width="10px"></th>\n      </tr>\n    </thead>\n    <tbody md-body>\n      <tr md-row ng-hide="vm.trunks">\n        <td md-cell colspan="3">\n          <div layout="row" layout-align="center center">\n            <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n          </div>\n        </td>\n      </tr>\n      <tr md-row ng-repeat="(id, trunk) in vm.trunks">\n        <td md-cell>{{trunk.name}}</td>\n        <td md-cell>\n          <i ng-class="vm.statusClass[trunk.status.toLowerCase()]">\n            <md-tooltip>{{\'VOICE.\' + trunk.status | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.status === \'registered\'" class="text-boxed">{{trunk.address}}</span>\n        </td>\n        <td md-cell>\n          <i ng-if="trunk.registry" ng-class="(trunk.stateRegistry.toLowerCase() === \'registered\') ? \'green-300-fg icon-checkbox-marked-circle\' : \'red-300-fg icon-close-circle\'">\n            <md-tooltip>{{\'VOICE.\' + trunk.stateRegistry | uppercase | translate}}</md-tooltip>\n          </i>\n          <span ng-if="trunk.registry && trunk.host && trunk.port" class="text-boxed">{{trunk.host}}:{{trunk.port}}</span>\n          <span ng-if="!trunk.registry" translate="VOICE.NO_REGISTRY">\n            No Registry\n          </span>\n        </td>\n        <td md-cell class="actions" ng-if="vm.crudPermissions.canEdit">\n          <md-menu>\n            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="STAFF.MORE" ng-click="$mdOpenMenu($event)">\n              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n            </md-button>\n\n            <md-menu-content width="4">\n              <md-menu-item>\n                <md-button ng-click="vm.goToTrunk($event, trunk)" translate="VOICE.EDIT_TRUNK">\n                  Edit Trunk\n                </md-button>\n              </md-menu-item>\n            </md-menu-content>\n          </md-menu>\n        </td>\n      </tr>\n    </tbody>\n  </table>\n</md-table-container>\n\n<md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.count}}" md-on-paginate="vm.getTrunks" md-page-select></md-table-pagination>\n\x3c!-- / TRUNKS TABLE --\x3e\n\x3c!-- / MAIN --\x3e'),e.put("app/main/apps/voice/views/voicemails/create/dialog.html",'<md-dialog class="voicemail-dialog" aria-label="New Voicemail">\n  <form name="voicemailForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.FULLNAME">FullName</label>\n        <input type="text" name="fullname" ng-model="vm.voicemail.fullname" ng-required="true" autofocus>\n\n        <div ng-messages="voicemailForm[\'fullname\'].$error" ng-show="voicemailForm[\'fullname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.FULLNAME_REQUIRED">FullName field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.EMAIL">Email</label>\n        <input type="email" name="email" ng-model="vm.voicemail.email" ng-required="vm.voicemail.attach === \'yes\'">\n\n        <div ng-messages="voicemailForm[\'email\'].$error" ng-show="voicemailForm[\'email\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n          </div>\n          <div ng-message="email">\n            <span translate="VOICE.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.PASSWORD">Password</label>\n        <input type="password" name="password" ng-model="vm.voicemail.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n        <div ng-messages="voicemailForm[\'password\'].$error" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.newVoicemail ">\n        <label translate="VOICE.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n        <div ng-messages="voicemailForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="VOICE.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container class="md-block">\n        <label translate="VOICE.MAILBOX">MailBox</label>\n        <input type="text" name="mailbox" ng-model="vm.voicemail.mailbox" ng-required="true" ng-disabled="!vm.newVoicemail">\n\n        <div ng-messages="voicemailForm[\'mailbox\'].$error" ng-show="voicemailForm[\'mailbox\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.MAILBOX_REQUIRED">MailBox field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.ATTACH">Attach</label>\n        <md-select name="attach" ng-model="vm.voicemail.attach">\n\n          <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n          <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n        </md-select>\n        <div ng-messages="voicemailForm[\'attach\'].$error" ng-show="voicemailForm[\'attach\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.ATTACH_REQUIRED">Attach field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoicemail" ng-click="vm.saveVoicemail()" class="send-button md-accent md-raised" ng-disabled="voicemailForm.$invalid || voicemailForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoicemail" ng-click="vm.addNewVoicemail()" class="send-button md-accent md-raised" ng-disabled="voicemailForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEMAIL" translate-attr-aria-label="VOICE.ADD_VOICEMAIL">\n          ADD VOICEMAIL\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoicemail" ng-click="vm.deleteVoicemail($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicemails/edit/view.html",'<div id="voice-voicemail" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voicemails-button md-icon-button" aria-label="Go to voicemails" ng-click="vm.gotoVoicemails()" translate translate-attr-aria-label="VOICE.GO_TO_VOICEMAILS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voicemail-image" hide-xs>\n          <img ng-src="assets/images/business/voicemails.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voicemail.id}}\n            <span ng-if="vm.voicemail.name">{{vm.voicemail.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voicemail.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoicemail()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (advancedForm.$invalid) || (messagesForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.FULLNAME">FullName</label>\n                <input type="text" name="fullname" ng-model="vm.voicemail.fullname" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'fullname\'].$error" ng-show="generalForm[\'fullname\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.FULLNAME_REQUIRED">FullName field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAIL">Email</label>\n                <input type="email" name="email" ng-model="vm.voicemail.email" ng-required="vm.voicemail.attach === \'yes\'" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'email\'].$error" ng-show="generalForm[\'email\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAIL_REQUIRED">Email field is required</span>\n                  </div>\n                  <div ng-message="email">\n                    <span translate="VOICE.ERRORS.EMAIL_MUST_VALID">Email must be a valid e-mail address</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PASSWORD">Password</label>\n                <input type="password" name="password" ng-model="vm.voicemail.password" placeholder="Password" translate translate-attr-placeholder="VOICE.PASSWORD" required>\n                <div ng-messages="generalForm[\'password\'].$error" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="VOICE.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block" ng-if="vm.newVoicemail ">\n                <label translate="VOICE.CONFIRM_PASSWORD">Confirm Password</label>\n                <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword" required>\n                <div ng-messages="generalForm.confirmPassword.$error" role="alert" multiple>\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n                  </div>\n                  <div ng-message="passwordMatch">\n                    <span translate="VOICE.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAILBOX">MailBox</label>\n                <input type="text" name="mailbox" ng-model="vm.voicemail.mailbox" ng-required="true" disabled>\n\n                <div ng-messages="generalForm[\'mailbox\'].$error" ng-show="generalForm[\'mailbox\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAILBOX_REQUIRED">MailBox field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.VOICEMAIL_CONTEXT">Voicemail_Context</label>\n                <md-select name="context" ng-model="vm.voicemail.context" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="context.name" ng-repeat="context in vm.contexts" ng-disabled="context.canSelect === false">{{ context.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.VOICEMAIL_CONTEXT"></span></div>\n                <div ng-messages="generalForm[\'context\'].$error" ng-show="generalForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.VOICEMAIL_CONTEXT_REQUIRED">Voicemail_Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEZONE">TimeZone</label>\n                <input type="text" name="tz" ng-model="vm.voicemail.tz" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'tz\'].$error" ng-show="advancedForm[\'tz\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEZONE_REQUIRED">TimeZone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ATTACH">Attach</label>\n                <md-select name="attach" ng-model="vm.voicemail.attach" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'attach\'].$error" ng-show="advancedForm[\'attach\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ATTACH_REQUIRED">Attach field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ENVELOPE">Envelope</label>\n                <md-select name="envelope" ng-model="vm.voicemail.envelope" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'envelope\'].$error" ng-show="advancedForm[\'envelope\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ENVELOPE_REQUIRED">Envelope field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DELETE">Delete</label>\n                <md-select name="delete" ng-model="vm.voicemail.delete" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div ng-messages="advancedForm[\'delete\'].$error" ng-show="advancedForm[\'delete\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DELETE_REQUIRED">Delete field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAILBODY">EmailBody</label>\n                <input type="text" name="emailbody" ng-model="vm.voicemail.emailbody" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'emailbody\'].$error" ng-show="advancedForm[\'emailbody\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAILBODY_REQUIRED">EmailBody field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.EMAILSUBJECT">EmailSubject</label>\n                <input type="text" name="emailsubject" ng-model="vm.voicemail.emailsubject" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'emailsubject\'].$error" ng-show="advancedForm[\'emailsubject\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.EMAILSUBJECT_REQUIRED">EmailSubject field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXSECONDS">MaxSeconds</label>\n                <input type="number" name="maxsecs" ng-model="vm.voicemail.maxsecs" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'maxsecs\'].$error" ng-show="advancedForm[\'maxsecs\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXSECONDS_REQUIRED">MaxSeconds field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXSECONDS_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxSeconds must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXMESSAGES">MaxMessages</label>\n                <input type="number" name="maxmsg" ng-model="vm.voicemail.maxmsg" min="0" max="9999" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="advancedForm[\'maxmsg\'].$error" ng-show="advancedForm[\'maxmsg\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_REQUIRED">MaxMessages field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxMessages must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="VOICE.ERRORS.MAXMESSAGES_MUST_BE_LESS_THAN_OR_EQUAL_TO">MaxMessages must be a valid greater or equal than</span> <span>9999</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.MESSAGES">MESSAGES</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voicemail-detail-form-container messages md-background-bg md-whiteframe-1dp">\n            <div ng-controller="VoicemailMessagesController as vm_dc" ng-init="vm_dc.init(vm.voicemail, vm.crudPermissions)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedVoicemailMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.MESSAGES">Messages</span>\n                  <ms-search-bar on-search="vm_dc.getVoicemailMessages()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedVoicemailMessages.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedVoicemailMessages.length}} {{vm_dc.selectedVoicemailMessages.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedVoicemailMessages" csv-label="true" filename="voicemails.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedVoicemailMessages($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedVoicemailMessages" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getVoicemailMessages">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'VOICE.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="callerid">\n                        {{ \'VOICE.CALLER_ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="duration">\n                        {{ \'VOICE.DURATION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="audio">\n                        {{ \'VOICE.AUDIO\' | translate }}\n                      </th>\n                      <th md-column md-order-by="stamp">\n                        {{ \'VOICE.RECEIVED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="message" md-select-id="id" ng-repeat="message in vm_dc.voicemailMessages.rows">\n                      <td md-cell>\n                        {{message.id}}\n                      </td>\n                      <td md-cell>\n                        {{message.callerid}}\n                      </td>\n                      <td md-cell>\n                        {{message.duration}}\n                      </td>\n                      <td md-cell>\n                        \x3c!-- audio recording directive --\x3e\n                        <ms-recording id="message.id" model="\'voiceMailMessage\'"></ms-recording>\n                        \x3c!-- / audio recording directive --\x3e\n                      </td>\n                      <td md-cell>\n                        {{ message.stamp | formatdate }}\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(message, $event)" translate="VOICE.DELETE_MESSAGE">\n                                Delete Message\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.voicemailMessages.rows.length">\n                      <td md-cell colspan="8">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="VOICE.NO_MESSAGE_AVAILABLE">No message available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.voicemailMessages.count}}" md-on-paginate="vm_dc.getVoicemailMessages" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voicemails/voicemails.html",'<div id="voicemails" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEMAILS">Voicemails</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoicemails.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoicemails =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voicemails-count">\n          <span>{{vm.selectedVoicemails.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoicemails()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoicemails()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoicemails" csv-label="true" filename="voicemails.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoicemails($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEMAIL TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoicemails" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoicemails">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="fullname">{{ \'VOICE.FULLNAME\' | translate }}</th>\n                <th md-column md-order-by="email">{{ \'VOICE.EMAIL\' | translate }}</th>\n                <th md-column md-order-by="mailbox">{{ \'VOICE.MAILBOX\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voicemails.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voicemail" md-select-id="id" ng-repeat="voicemail in vm.voicemails.rows">\n                <td md-cell ng-if="voicemail.userpic"><img class="avatar" alt="{{voicemail.name}}" ng-src="api/users/{{voicemail.id}}/avatar" /></td>\n                <td md-cell ng-if="!voicemail.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voicemail.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="id ">{{voicemail.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="fullname ">{{voicemail.fullname}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="email ">{{voicemail.email}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voicemail, ev) : vm.createOrEditVoicemail($event, voicemail)" md-cell class="mailbox ">{{voicemail.mailbox}}</td>\n\n\n                <td md-cell class="actions" ng-if="!vm.crudPermissions.readOnly">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voicemail, $event    )" translate="VOICE.EDIT_VOICEMAIL">\n                          Edit Voicemail\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voicemail, $event    )" translate="VOICE.DELETE_VOICEMAIL">\n                          Delete Voicemail\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voicemails.count}}" md-on-paginate="vm.getVoicemails" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEMAIL TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEMAIL BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voicemail-button" ng-click="vm.createOrEditVoicemail($event)" aria-label="add voicemail" translate translate-attr-aria-label="VOICE.ADD_VOICEMAIL">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEMAIL BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voicePrefixes/create/dialog.html",'<md-dialog class="voicePrefix-dialog" aria-label="New voicePrefix">\n  <form name="voicePrefixForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.voicePrefix.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus>\n\n        <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n        <div ng-messages="voicePrefixForm[\'name\'].$error" ng-show="voicePrefixForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.OUTBOUNDROUTE">OutboundRoute</label>\n        <md-select name="VoiceExtensionId" ng-model="vm.voicePrefix.VoiceExtensionId" required>\n          <md-option ng-value="VoiceExtensionId.id" ng-repeat="VoiceExtensionId in vm.outboundRoutes" ng-disabled="VoiceExtensionId.canSelect === false">{{ VoiceExtensionId.exten }}</md-option>\n        </md-select>\n        <div ng-messages="voicePrefixForm[\'VoiceExtensionId\'].$error" ng-show="voicePrefixForm[\'VoiceExtensionId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.OUTBOUNDROUTE_REQUIRED">OutboundRoute field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.CALLERIDALL">CallerIdAll</label>\n        <input type="text" name="callerIdAll" ng-model="vm.voicePrefix.callerIdAll" ng-pattern="/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/">\n\n        <div class="hint"><span translate="VOICE.HELP.CALLERIDALL"></span></div>\n        <div ng-messages="voicePrefixForm[\'callerIdAll\'].$error" ng-show="voicePrefixForm[\'callerIdAll\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.CALLERIDALL_REQUIRED">CallerIdAll field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.CALLERIDALL_MUST_VALID_PATTERN" translate-values="{ regex: \'/&quot;(.*)&quot;\\s&lt;(.*?)&gt;$/\' }">CallerIdAll must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.voicePrefix.description">\n\n        <div ng-messages="voicePrefixForm[\'description\'].$error" ng-show="voicePrefixForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newvoicePrefix" ng-click="vm.savevoicePrefix()" class="send-button md-accent md-raised" ng-disabled="voicePrefixForm.$invalid || voicePrefixForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newvoicePrefix" ng-click="vm.addNewvoicePrefix()" class="send-button md-accent md-raised" ng-disabled="voicePrefixForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEPREFIX" translate-attr-aria-label="VOICE.ADD_VOICEPREFIX">\n          ADD VOICEPREFIX\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newvoicePrefix" ng-click="vm.deletevoicePrefix($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/edit/agentadd/agentadd.html",'<md-dialog class="voicePrefix-dialog" aria-label="voicePrefix" ng-init="vm.onInit()">\n  <form name="voicePrefixForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.AGENTADD_VOICEPREFIX">Add Agent to voicePrefix</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/edit/teamadd/teamadd.html",'<md-dialog class="voicePrefix-dialog" aria-label="voicePrefix" ng-init="vm.onInit()">\n  <form name="voicePrefixForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voicePrefixes/voicePrefixes.html",'<div id="voicePrefixes" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEPREFIXES">VoicePrefixes</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoicePrefixes.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoicePrefixes =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voicePrefixes-count">\n          <span>{{vm.selectedVoicePrefixes.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoicePrefixes()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoicePrefixes()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoicePrefixes" csv-label="true" filename="voicePrefixes.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoicePrefixes($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEPREFIX TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoicePrefixes" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoicePrefixes">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="VoiceExtensionId">{{ \'VOICE.OUTBOUNDROUTE\' | translate }}</th>\n                <th md-column md-order-by="callerIdAll">{{ \'VOICE.CALLERIDALL\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voicePrefixes.rows.length">\n                <td md-cell colspan="6">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voicePrefix" md-select-id="id" ng-repeat="voicePrefix in vm.voicePrefixes.rows">\n                <td md-cell ng-if="voicePrefix.userpic"><img class="avatar" alt="{{voicePrefix.name}}" ng-src="api/users/{{voicePrefix.id}}/avatar" /></td>\n                <td md-cell ng-if="!voicePrefix.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voicePrefix.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="id ">{{voicePrefix.id}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="name ">{{voicePrefix.name}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="VoiceExtensionId ">{{ (vm.outboundRoutes | filter : {\'id\':voicePrefix.VoiceExtensionId} : true)[0].exten }}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="callerIdAll ">{{voicePrefix.callerIdAll}}</td>\n                <td ng-click="vm.createOrEditvoicePrefix($event, voicePrefix)" md-cell class="description ">{{voicePrefix.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editdialog(voicePrefix, $event    )" translate="VOICE.EDIT_VOICEPREFIX">\n                          Edit voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(voicePrefix, $event    )" translate="VOICE.AGENTADD_VOICEPREFIX">\n                          AgentAdd voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(voicePrefix, $event    )" translate="VOICE.TEAMADD_VOICEPREFIX">\n                          teamadd voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voicePrefix, $event    )" translate="VOICE.DELETE_VOICEPREFIX">\n                          Delete voicePrefix\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voicePrefixes.count}}" md-on-paginate="vm.getVoicePrefixes" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEPREFIX TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEPREFIX BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voicePrefix-button" ng-click="vm.createOrEditvoicePrefix($event)" aria-label="add voicePrefix" translate translate-attr-aria-label="VOICE.ADD_VOICEPREFIX">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEPREFIX BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voiceQueues/create/dialog.html",'<md-dialog class="voiceQueue-dialog" aria-label="New VoiceQueue">\n  <form name="voiceQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.voiceQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newVoiceQueue">\n\n        <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n        <div ng-messages="voiceQueueForm[\'name\'].$error" ng-show="voiceQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.voiceQueue.strategy" required>\n          <md-option ng-value="\'ringall\'">Ringall</md-option>\n          <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n          <md-option ng-value="\'leastrecent\'">Least Recent</md-option>\n          <md-option ng-value="\'fewestcalls\'">Fewest Calls</md-option>\n          <md-option ng-value="\'random\'">Random</md-option>\n          <md-option ng-value="\'linear\'">Linear</md-option>\n          <md-option ng-value="\'wrandom\'">Weight Random</md-option>\n        </md-select>\n        <div ng-messages="voiceQueueForm[\'strategy\'].$error" ng-show="voiceQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="VOICE.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.voiceQueue.description">\n\n        <div ng-messages="voiceQueueForm[\'description\'].$error" ng-show="voiceQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoiceQueue" ng-click="vm.saveVoiceQueue()" class="send-button md-accent md-raised" ng-disabled="voiceQueueForm.$invalid || voiceQueueForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoiceQueue" ng-click="vm.addNewVoiceQueue()" class="send-button md-accent md-raised" ng-disabled="voiceQueueForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICEQUEUE" translate-attr-aria-label="VOICE.ADD_VOICEQUEUE">\n          ADD VOICEQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceQueue" ng-click="vm.deleteVoiceQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/agentadd/agentadd.html",'<md-dialog class="voiceQueue-dialog" aria-label="voiceQueue" ng-init="vm.onInit()">\n  <form name="voiceQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.AGENTADD_VOICEQUEUE">Add Agent to voiceQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="VOICE.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/teamadd/teamadd.html",'<md-dialog class="voiceQueue-dialog" aria-label="voiceQueue" ng-init="vm.onInit()">\n  <form name="voiceQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="VOICE.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <md-input-container flex class="no-margin">\n        <label translate="VOICE.PENALTY">Penalty</label>\n        <input name="penalty" type="number" ng-model="vm.penalty" min="0" placeholder="0" required onkeypress="return event.charCode >= 48 && event.charCode <= 57 && this.value.length < 3">\n        <div ng-messages="voiceQueueForm.penalty.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span>{{ \'VOICE.ERRORS.PENALTY_REQUIRED\' | translate }}</span>\n          </div>\n        </div>\n      </md-input-container>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit" add-disabled="vm.penalty === undefined"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceQueues/edit/view.html",'<div id="voice-voiceQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voiceQueues-button md-icon-button" aria-label="Go to voiceQueues" ng-click="vm.gotoVoiceQueues()" translate translate-attr-aria-label="VOICE.GO_TO_VOICEQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voiceQueue-image" hide-xs>\n          <img ng-src="assets/images/business/voiceQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voiceQueue.id}}\n            <span ng-if="vm.voiceQueue.name">{{vm.voiceQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voiceQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.voiceQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="VOICE.TEAMADD_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.voiceQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="VOICE.AGENTADD_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.gotogoto(vm.voiceQueue, $event)" class="md-fab md-warn md-icon-button" aria-label="goto">\n        <md-tooltip><span translate="VOICE.GOTO_VOICEQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-cast"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoiceQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (settingsForm.$invalid) || (announcementsForm.$invalid) || (advancedForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.voiceQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="VOICE.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="VOICE.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.voiceQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'ringall\'">Ringall</md-option>\n                  <md-option ng-value="\'rrmemory\'">Round Robin Memory</md-option>\n                  <md-option ng-value="\'leastrecent\'">Least Recent</md-option>\n                  <md-option ng-value="\'fewestcalls\'">Fewest Calls</md-option>\n                  <md-option ng-value="\'random\'">Random</md-option>\n                  <md-option ng-value="\'linear\'">Linear</md-option>\n                  <md-option ng-value="\'wrandom\'">Weight Random</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEOUT">Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.voiceQueue.timeout" min="0" value="15" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.TIMEOUT"></span></div>\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MAXLENGTH">MaxLength</label>\n                <input type="number" name="maxlen" ng-model="vm.voiceQueue.maxlen" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MAXLENGTH"></span></div>\n                <div ng-messages="generalForm[\'maxlen\'].$error" ng-show="generalForm[\'maxlen\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MAXLENGTH_REQUIRED">MaxLength field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MAXLENGTH_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MaxLength must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RETRY">Retry</label>\n                <input type="number" name="retry" ng-model="vm.voiceQueue.retry" min="0" value="2" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.RETRY"></span></div>\n                <div ng-messages="generalForm[\'retry\'].$error" ng-show="generalForm[\'retry\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RETRY_REQUIRED">Retry field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.RETRY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Retry must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WRAPUPTIME">WrapupTime</label>\n                <input type="number" name="wrapuptime" ng-model="vm.voiceQueue.wrapuptime" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.WRAPUPTIME"></span></div>\n                <div ng-messages="generalForm[\'wrapuptime\'].$error" ng-show="generalForm[\'wrapuptime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WRAPUPTIME_REQUIRED">WrapupTime field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.WRAPUPTIME_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WrapupTime must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WEIGHT">Weight</label>\n                <input type="number" name="weight" ng-model="vm.voiceQueue.weight" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.WEIGHT"></span></div>\n                <div ng-messages="generalForm[\'weight\'].$error" ng-show="generalForm[\'weight\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WEIGHT_REQUIRED">Weight field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.WEIGHT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Weight must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.JOINWHENEMPTY">JoinWhenEmpty</label>\n                <md-select name="joinempty" ng-model="vm.voiceQueue.joinempty" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'no\'" ng-disabled="vm.voiceQueue.joinempty.length === 1  && vm.voiceQueue.joinempty[0] === \'no\'">no</md-option>\n                  <md-option ng-value="\'yes\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'yes\'">yes</md-option>\n                  <md-option ng-value="\'strict\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'strict\'">strict</md-option>\n                  <md-option ng-value="\'loose\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'loose\'">loose</md-option>\n                  <md-option ng-value="\'paused\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'paused\'">paused</md-option>\n                  <md-option ng-value="\'penalty\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'penalty\'">penalty</md-option>\n                  <md-option ng-value="\'inuse\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'inuse\'">inuse</md-option>\n                  <md-option ng-value="\'ringing\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'ringing\'">ringing</md-option>\n                  <md-option ng-value="\'unavailable\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'unavailable\'">unavailable</md-option>\n                  <md-option ng-value="\'invalid\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'invalid\'">invalid</md-option>\n                  <md-option ng-value="\'unknown\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'unknown\'">unknown</md-option>\n                  <md-option ng-value="\'wrapup\'" ng-disabled="vm.voiceQueue.joinempty.length === 1 && vm.voiceQueue.joinempty[0] === \'wrapup\'">wrapup</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.JOINWHENEMPTY"></span></div>\n                <div ng-messages="generalForm[\'joinempty\'].$error" ng-show="generalForm[\'joinempty\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.JOINWHENEMPTY_REQUIRED">JoinWhenEmpty field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.LEAVEWHENEMPTY">LeaveWhenEmpty</label>\n                <md-select name="leavewhenempty" ng-model="vm.voiceQueue.leavewhenempty" multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'no\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'no\'">no</md-option>\n                  <md-option ng-value="\'yes\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'yes\'">yes</md-option>\n                  <md-option ng-value="\'strict\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'strict\'">strict</md-option>\n                  <md-option ng-value="\'loose\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'loose\'">loose</md-option>\n                  <md-option ng-value="\'paused\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'paused\'">paused</md-option>\n                  <md-option ng-value="\'penalty\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'penalty\'">penalty</md-option>\n                  <md-option ng-value="\'inuse\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'inuse\'">inuse</md-option>\n                  <md-option ng-value="\'ringing\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'ringing\'">ringing</md-option>\n                  <md-option ng-value="\'unavailable\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'unavailable\'">unavailable</md-option>\n                  <md-option ng-value="\'invalid\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'invalid\'">invalid</md-option>\n                  <md-option ng-value="\'unknown\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'unknown\'">unknown</md-option>\n                  <md-option ng-value="\'wrapup\'" ng-disabled="vm.voiceQueue.leavewhenempty.length === 1 && vm.voiceQueue.leavewhenempty[0] === \'wrapup\'">wrapup</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.LEAVEWHENEMPTY"></span></div>\n                <div ng-messages="generalForm[\'leavewhenempty\'].$error" ng-show="generalForm[\'leavewhenempty\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.LEAVEWHENEMPTY_REQUIRED">LeaveWhenEmpty field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MUSICONHOLD">MusicOnHold</label>\n                <md-select name="musiconhold" ng-model="vm.voiceQueue.musiconhold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="musiconhold.name" ng-repeat="musiconhold in vm.musiconholds" ng-disabled="musiconhold.canSelect === false">{{ musiconhold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MUSICONHOLD"></span></div>\n                <div ng-messages="generalForm[\'musiconhold\'].$error" ng-show="generalForm[\'musiconhold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MUSICONHOLD_REQUIRED">MusicOnHold field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCETOAGENT">AnnounceToAgent</label>\n                <md-select name="announce" ng-model="vm.voiceQueue.announce" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'FALSE\'">None</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + announce.save_name" ng-repeat="announce in vm.sounds" ng-disabled="announce.canSelect === false">{{ announce.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCETOAGENT"></span></div>\n                <div ng-messages="generalForm[\'announce\'].$error" ng-show="generalForm[\'announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCETOAGENT_REQUIRED">AnnounceToAgent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.voiceQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ANNOUNCEMENTS">ANNOUNCEMENTS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container settings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.SETTINGS">SETTINGS</div>\n            </div>\n            <form name="settingsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEFREQUENCY">AnnounceFrequency</label>\n                <input type="number" name="announce_frequency" ng-model="vm.voiceQueue.announce_frequency" min="0" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'announce_frequency\'].$error" ng-show="settingsForm[\'announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEFREQUENCY_REQUIRED">AnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.ANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINANNOUNCEFREQUENCY">MinAnnounceFrequency</label>\n                <input type="number" name="min_announce_frequency" ng-model="vm.voiceQueue.min_announce_frequency" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MINANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'min_announce_frequency\'].$error" ng-show="settingsForm[\'min_announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINANNOUNCEFREQUENCY_REQUIRED">MinAnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MINANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MinAnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PERIODICANNOUNCEFREQUENCY">PeriodicAnnounceFrequency</label>\n                <input type="number" name="periodic_announce_frequency" ng-model="vm.voiceQueue.periodic_announce_frequency" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.PERIODICANNOUNCEFREQUENCY"></span></div>\n                <div ng-messages="settingsForm[\'periodic_announce_frequency\'].$error" ng-show="settingsForm[\'periodic_announce_frequency\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCEFREQUENCY_REQUIRED">PeriodicAnnounceFrequency field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCEFREQUENCY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">PeriodicAnnounceFrequency must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RANDOMPERIODICANNOUNCE">RandomPeriodicAnnounce</label>\n                <md-select name="random_periodic_announce" ng-model="vm.voiceQueue.random_periodic_announce" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RANDOMPERIODICANNOUNCE"></span></div>\n                <div ng-messages="settingsForm[\'random_periodic_announce\'].$error" ng-show="settingsForm[\'random_periodic_announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RANDOMPERIODICANNOUNCE_REQUIRED">RandomPeriodicAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEHOLDTIME">AnnounceHoldtime</label>\n                <md-select name="announce_holdtime" ng-model="vm.voiceQueue.announce_holdtime" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'once\'">Once</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEHOLDTIME"></span></div>\n                <div ng-messages="settingsForm[\'announce_holdtime\'].$error" ng-show="settingsForm[\'announce_holdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEHOLDTIME_REQUIRED">AnnounceHoldtime field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCECALLERPOSITION">AnnounceCallerPosition</label>\n                <md-select name="announce_position" ng-model="vm.voiceQueue.announce_position" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'yes\'">Yes</md-option>\n                  <md-option ng-value="\'no\'">No</md-option>\n                  <md-option ng-value="\'limit\'">Limit</md-option>\n                  <md-option ng-value="\'more\'">More</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCECALLERPOSITION"></span></div>\n                <div ng-messages="settingsForm[\'announce_position\'].$error" ng-show="settingsForm[\'announce_position\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCECALLERPOSITION_REQUIRED">AnnounceCallerPosition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ANNOUNCEPOSITIONLIMIT">AnnouncePositionLimit</label>\n                <input type="number" name="announce_position_limit" ng-model="vm.voiceQueue.announce_position_limit" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.ANNOUNCEPOSITIONLIMIT"></span></div>\n                <div ng-messages="settingsForm[\'announce_position_limit\'].$error" ng-show="settingsForm[\'announce_position_limit\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ANNOUNCEPOSITIONLIMIT_REQUIRED">AnnouncePositionLimit field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.REPORTHOLDTIMEAGENT">ReportHoldtimeAgent</label>\n                <md-select name="reportholdtime" ng-model="vm.voiceQueue.reportholdtime" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.REPORTHOLDTIMEAGENT"></span></div>\n                <div ng-messages="settingsForm[\'reportholdtime\'].$error" ng-show="settingsForm[\'reportholdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.REPORTHOLDTIMEAGENT_REQUIRED">ReportHoldtimeAgent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="voiceQueue-detail-form-container announcements md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ANNOUNCEMENTS">ANNOUNCEMENTS</div>\n            </div>\n            <form name="announcementsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.PERIODICANNOUNCE">PeriodicAnnounce</label>\n                <md-select name="periodic_announce" ng-model="vm.voiceQueue.periodic_announce" autofocus multiple ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Default</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + periodic_announce.save_name" ng-repeat="periodic_announce in vm.sounds" ng-disabled="periodic_announce.canSelect === false">{{ periodic_announce.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.PERIODICANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'periodic_announce\'].$error" ng-show="announcementsForm[\'periodic_announce\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.PERIODICANNOUNCE_REQUIRED">PeriodicAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.HOLDTIMEANNOUNCE">HoldTimeAnnounce</label>\n                <md-select name="queue_reporthold" ng-model="vm.voiceQueue.queue_reporthold" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_reporthold.save_name" ng-repeat="queue_reporthold in vm.sounds" ng-disabled="queue_reporthold.canSelect === false">{{ queue_reporthold.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.HOLDTIMEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_reporthold\'].$error" ng-show="announcementsForm[\'queue_reporthold\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.HOLDTIMEANNOUNCE_REQUIRED">HoldTimeAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.YOUARENEXTANNOUNCE">YouareNextAnnounce</label>\n                <md-select name="queue_youarenext" ng-model="vm.voiceQueue.queue_youarenext" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_youarenext.save_name" ng-repeat="queue_youarenext in vm.sounds" ng-disabled="queue_youarenext.canSelect === false">{{ queue_youarenext.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.YOUARENEXTANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_youarenext\'].$error" ng-show="announcementsForm[\'queue_youarenext\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.YOUARENEXTANNOUNCE_REQUIRED">YouareNextAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THEREAREANNOUNCE">ThereareAnnounce</label>\n                <md-select name="queue_thereare" ng-model="vm.voiceQueue.queue_thereare" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_thereare.save_name" ng-repeat="queue_thereare in vm.sounds" ng-disabled="queue_thereare.canSelect === false">{{ queue_thereare.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.THEREAREANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_thereare\'].$error" ng-show="announcementsForm[\'queue_thereare\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THEREAREANNOUNCE_REQUIRED">ThereareAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.WAITINGCALLSANNOUNCE">WaitingCallsAnnounce</label>\n                <md-select name="queue_callswaiting" ng-model="vm.voiceQueue.queue_callswaiting" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_callswaiting.save_name" ng-repeat="queue_callswaiting in vm.sounds" ng-disabled="queue_callswaiting.canSelect === false">{{ queue_callswaiting.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.WAITINGCALLSANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_callswaiting\'].$error" ng-show="announcementsForm[\'queue_callswaiting\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.WAITINGCALLSANNOUNCE_REQUIRED">WaitingCallsAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.ESTIMATEDHOLDTIMEANNOUNCE">EstimatedHoldTimeAnnounce</label>\n                <md-select name="queue_holdtime" ng-model="vm.voiceQueue.queue_holdtime" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_holdtime.save_name" ng-repeat="queue_holdtime in vm.sounds" ng-disabled="queue_holdtime.canSelect === false">{{ queue_holdtime.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.ESTIMATEDHOLDTIMEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_holdtime\'].$error" ng-show="announcementsForm[\'queue_holdtime\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.ESTIMATEDHOLDTIMEANNOUNCE_REQUIRED">EstimatedHoldTimeAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINUTESANNOUNCE">MinutesAnnounce</label>\n                <md-select name="queue_minutes" ng-model="vm.voiceQueue.queue_minutes" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_minutes.save_name" ng-repeat="queue_minutes in vm.sounds" ng-disabled="queue_minutes.canSelect === false">{{ queue_minutes.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MINUTESANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_minutes\'].$error" ng-show="announcementsForm[\'queue_minutes\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINUTESANNOUNCE_REQUIRED">MinutesAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MINUTEANNOUNCE">MinuteAnnounce</label>\n                <md-select name="queue_minute" ng-model="vm.voiceQueue.queue_minute" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_minute.save_name" ng-repeat="queue_minute in vm.sounds" ng-disabled="queue_minute.canSelect === false">{{ queue_minute.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MINUTEANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_minute\'].$error" ng-show="announcementsForm[\'queue_minute\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MINUTEANNOUNCE_REQUIRED">MinuteAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SECONDSANNOUNCE">SecondsAnnounce</label>\n                <md-select name="queue_seconds" ng-model="vm.voiceQueue.queue_seconds" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_seconds.save_name" ng-repeat="queue_seconds in vm.sounds" ng-disabled="queue_seconds.canSelect === false">{{ queue_seconds.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SECONDSANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_seconds\'].$error" ng-show="announcementsForm[\'queue_seconds\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SECONDSANNOUNCE_REQUIRED">SecondsAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THANKYOUANNOUNCE">ThankYouAnnounce</label>\n                <md-select name="queue_thankyou" ng-model="vm.voiceQueue.queue_thankyou" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">Default</md-option>\n                  <md-option ng-value="\'\'">Disabled</md-option>\n                  <md-option ng-value="\'/var/opt/motion2/server/files/sounds/converted/\' + queue_thankyou.save_name" ng-repeat="queue_thankyou in vm.sounds" ng-disabled="queue_thankyou.canSelect === false">{{ queue_thankyou.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.THANKYOUANNOUNCE"></span></div>\n                <div ng-messages="announcementsForm[\'queue_thankyou\'].$error" ng-show="announcementsForm[\'queue_thankyou\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THANKYOUANNOUNCE_REQUIRED">ThankYouAnnounce field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceQueue-detail-form-container advanced md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.ADVANCED">ADVANCED</div>\n            </div>\n            <form name="advancedForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.voiceQueue.acw" aria-label="AfterCallWork" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.AFTERCALLWORK">AfterCallWork</span></md-switch>\n                <div class="hint"><span translate="VOICE.HELP.AFTERCALLWORK"></span></div>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceQueue.acw" class="md-block">\n                <label translate="VOICE.AFTERCALLWORKDURATION">AfterCallWorkDuration</label>\n                <input type="number" name="acwTimeout" ng-model="vm.voiceQueue.acwTimeout" min="0" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.AFTERCALLWORKDURATION"></span></div>\n                <div ng-messages="advancedForm[\'acwTimeout\'].$error" ng-show="advancedForm[\'acwTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AFTERCALLWORKDURATION_REQUIRED">AfterCallWorkDuration field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.AFTERCALLWORKDURATION_MUST_BE_GREATER_THAN_OR_EQUAL_TO">AfterCallWorkDuration must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.AUTOPAUSE">AutoPause</label>\n                <md-select name="autopause" ng-model="vm.voiceQueue.autopause" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'all\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.AUTOPAUSE"></span></div>\n                <div ng-messages="advancedForm[\'autopause\'].$error" ng-show="advancedForm[\'autopause\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AUTOPAUSE_REQUIRED">AutoPause field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RINGINUSE">RingInUse</label>\n                <md-select name="ringinuse" ng-model="vm.voiceQueue.ringinuse" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.RINGINUSE"></span></div>\n                <div ng-messages="advancedForm[\'ringinuse\'].$error" ng-show="advancedForm[\'ringinuse\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RINGINUSE_REQUIRED">RingInUse field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MEMBERDELAY">MemberDelay</label>\n                <input type="number" name="memberdelay" ng-model="vm.voiceQueue.memberdelay" min="0" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.MEMBERDELAY"></span></div>\n                <div ng-messages="advancedForm[\'memberdelay\'].$error" ng-show="advancedForm[\'memberdelay\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MEMBERDELAY_REQUIRED">MemberDelay field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.MEMBERDELAY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">MemberDelay must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TIMEOUTRESTART">TimeoutRestart</label>\n                <md-select name="timeoutrestart" ng-model="vm.voiceQueue.timeoutrestart" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.TIMEOUTRESTART"></span></div>\n                <div ng-messages="advancedForm[\'timeoutrestart\'].$error" ng-show="advancedForm[\'timeoutrestart\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TIMEOUTRESTART_REQUIRED">TimeoutRestart field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.MONITORFORMAT">MonitorFormat</label>\n                <md-select name="monitor_format" ng-model="vm.voiceQueue.monitor_format" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'\'">Inactive</md-option>\n                  <md-option ng-value="\'wav\'">wav</md-option>\n                  <md-option ng-value="\'wav49\'">wav49</md-option>\n                  <md-option ng-value="\'gsm\'">gsm</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MONITORFORMAT"></span></div>\n                <div ng-messages="advancedForm[\'monitor_format\'].$error" ng-show="advancedForm[\'monitor_format\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MONITORFORMAT_REQUIRED">MonitorFormat field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONTEXT">Context</label>\n                <input type="text" name="context" ng-model="vm.voiceQueue.context" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.CONTEXT"></span></div>\n                <div ng-messages="advancedForm[\'context\'].$error" ng-show="advancedForm[\'context\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONTEXT_REQUIRED">Context field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETINTERFACEVARIABLES">SetInterfaceVariables</label>\n                <md-select name="setinterfacevar" ng-model="vm.voiceQueue.setinterfacevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETINTERFACEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setinterfacevar\'].$error" ng-show="advancedForm[\'setinterfacevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETINTERFACEVARIABLES_REQUIRED">SetInterfaceVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETQUEUEVARIABLES">SetQueueVariables</label>\n                <md-select name="setqueuevar" ng-model="vm.voiceQueue.setqueuevar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETQUEUEVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueuevar\'].$error" ng-show="advancedForm[\'setqueuevar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETQUEUEVARIABLES_REQUIRED">SetQueueVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SETQUEUEENTRYVARIABLES">SetQueueEntryVariables</label>\n                <md-select name="setqueueentryvar" ng-model="vm.voiceQueue.setqueueentryvar" ng-disabled="!vm.crudPermissions.canEdit">\n\n                  <md-option ng-value="\'yes\'"> {{ \'VOICE.YES\' | translate }} </md-option>\n\n                  <md-option ng-value="\'no\'"> {{ \'VOICE.NO\' | translate }} </md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.SETQUEUEENTRYVARIABLES"></span></div>\n                <div ng-messages="advancedForm[\'setqueueentryvar\'].$error" ng-show="advancedForm[\'setqueueentryvar\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SETQUEUEENTRYVARIABLES_REQUIRED">SetQueueEntryVariables field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SERVICELEVEL">ServiceLevel</label>\n                <input type="number" name="servicelevel" ng-model="vm.voiceQueue.servicelevel" min="0" max="100" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="VOICE.HELP.SERVICELEVEL"></span></div>\n                <div ng-messages="advancedForm[\'servicelevel\'].$error" ng-show="advancedForm[\'servicelevel\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_REQUIRED">ServiceLevel field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_MUST_BE_GREATER_THAN_OR_EQUAL_TO">ServiceLevel must be a valid greater or equal than</span> <span>0</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="VOICE.ERRORS.SERVICELEVEL_MUST_BE_LESS_THAN_OR_EQUAL_TO">ServiceLevel must be a valid greater or equal than</span> <span>100</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.voiceQueue.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="VOICE.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceQueue.mandatoryDisposition" class="md-block">\n                <label translate="VOICE.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.voiceQueue.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="VOICE.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="advancedForm[\'mandatoryDispositionPauseId\'].$error" ng-show="advancedForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voiceQueues/voiceQueues.html",'<div id="voiceQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICEQUEUES">VoiceQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoiceQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoiceQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voiceQueues-count">\n          <span>{{vm.selectedVoiceQueues.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoiceQueues()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoiceQueues()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoiceQueues" csv-label="true" filename="voiceQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceQueues($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICEQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoiceQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'VOICE.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'VOICE.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'VOICE.STRATEGY\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'VOICE.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voiceQueues.rows.length">\n                <td md-cell colspan="5">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voiceQueue" md-select-id="id" ng-repeat="voiceQueue in vm.voiceQueues.rows">\n                <td md-cell ng-if="voiceQueue.userpic"><img class="avatar" alt="{{voiceQueue.name}}" ng-src="api/users/{{voiceQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!voiceQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voiceQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="id ">{{voiceQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="name ">{{voiceQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="strategy ">{{ vm.arraystrategy[voiceQueue.strategy].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceQueue, ev) : vm.createOrEditVoiceQueue($event, voiceQueue)" md-cell class="description ">{{voiceQueue.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voiceQueue, $event    )" translate="VOICE.EDIT_VOICEQUEUE">\n                          Edit VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(voiceQueue, $event    )" translate="VOICE.TEAMADD_VOICEQUEUE">\n                          teamadd VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(voiceQueue, $event    )" translate="VOICE.AGENTADD_VOICEQUEUE">\n                          agentadd VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voiceQueue, $event    )" translate="VOICE.DELETE_VOICEQUEUE">\n                          Delete VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(voiceQueue, $event    )" translate="VOICE.GOTOREALTIME_VOICEQUEUE">\n                          goToRealtime VoiceQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceQueues.count}}" md-on-paginate="vm.getVoiceQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICEQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD VOICEQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-voiceQueue-button" ng-click="vm.createOrEditVoiceQueue($event)" aria-label="add voiceQueue" translate translate-attr-aria-label="VOICE.ADD_VOICEQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD VOICEQUEUE BUTTON --\x3e\n</div>'),e.put("app/main/apps/voice/views/voiceRecordings/create/dialog.html",'<md-dialog class="voiceRecording-dialog" aria-label="New VoiceRecording">\n  <form name="voiceRecordingForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="VOICE.RATING">Rating</label>\n        <md-select name="rating" ng-model="vm.voiceRecording.rating" autofocus ng-disabled="!vm.newVoiceRecording && !vm.crudPermissions.canEdit">\n          <md-option ng-value="null">{{\'VOICE.NO_RATING\' | translate}}</md-option>\n          <md-option value="1">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n          </md-option>\n          <md-option value="2">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n          </md-option>\n          <md-option value="3">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n          </md-option>\n          <md-option value="4">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n          </md-option>\n          <md-option value="5">\n            <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n          </md-option>\n        </md-select>\n        <div ng-messages="voiceRecordingForm[\'rating\'].$error" ng-show="voiceRecordingForm[rating].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="VOICE.ERRORS.RATING_REQUIRED">Rating field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newVoiceRecording" ng-click="vm.saveVoiceRecording()" class="send-button md-accent md-raised" ng-disabled="voiceRecordingForm.$invalid || voiceRecordingForm.$pristine" aria-label="SAVE" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newVoiceRecording" ng-click="vm.addNewVoiceRecording()" class="send-button md-accent md-raised" ng-disabled="voiceRecordingForm.$invalid" aria-label="ADD" translate="VOICE.ADD_VOICERECORDING" translate-attr-aria-label="VOICE.ADD_VOICERECORDING">\n          ADD VOICERECORDING\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newVoiceRecording" ng-click="vm.deleteVoiceRecording($event)" aria-label="DELETE" translate translate-attr-aria-label="VOICE.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="VOICE.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/voice/views/voiceRecordings/edit/view.html",'<div id="voice-voiceRecording" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-voiceRecordings-button md-icon-button" aria-label="Go to voiceRecordings" ng-click="vm.gotoVoiceRecordings()" translate translate-attr-aria-label="VOICE.GO_TO_VOICERECORDINGS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="voiceRecording-image" hide-xs>\n          <img ng-src="assets/images/business/voiceRecordings.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.voiceRecording.id}}\n            <span ng-if="vm.voiceRecording.name">{{vm.voiceRecording.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="VOICE.CREATED_AT"></span> <span>{{vm.voiceRecording.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveVoiceRecording()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(voiceRecordingsForm.$invalid) || (transcriptForm.$invalid) || (sentimentAnalysisForm.$invalid)" translate="VOICE.SAVE" translate-attr-aria-label="VOICE.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="VOICE.GENERAL">GENERAL</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceRecording-detail-form-container voicerecordings md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.VOICERECORDINGS">VOICERECORDINGS</div>\n            </div>\n            <form name="voiceRecordingsForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="VOICE.TYPE">Type</label>\n                <input type="" name="type" ng-model="vm.voiceRecording.type" autofocus disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'type\'].$error" ng-show="voiceRecordingsForm[\'type\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.TYPE_REQUIRED">Type field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.UNIQUEID">UniqueId</label>\n                <input type="" name="uniqueid" ng-model="vm.voiceRecording.uniqueid" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'uniqueid\'].$error" ng-show="voiceRecordingsForm[\'uniqueid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.UNIQUEID_REQUIRED">UniqueId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CALLER">Caller</label>\n                <input type="" name="calleridnum" ng-model="vm.voiceRecording.calleridnum" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'calleridnum\'].$error" ng-show="voiceRecordingsForm[\'calleridnum\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CALLER_REQUIRED">Caller field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CALLED">Called</label>\n                <input type="" name="exten" ng-model="vm.voiceRecording.exten" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'exten\'].$error" ng-show="voiceRecordingsForm[\'exten\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CALLED_REQUIRED">Called field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.CONNECTED">Connected</label>\n                <input type="" name="connectedlinenum" ng-model="vm.voiceRecording.connectedlinenum" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'connectedlinenum\'].$error" ng-show="voiceRecordingsForm[\'connectedlinenum\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.CONNECTED_REQUIRED">Connected field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.QUEUE">Queue</label>\n                <input type="" name="queue" ng-model="vm.voiceRecording.queue" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'queue\'].$error" ng-show="voiceRecordingsForm[\'queue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.AGENT">Agent</label>\n                <input type="text" name="membername" ng-model="vm.voiceRecording.membername" privacy="vm.userProfile.privacyEnabled" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'membername\'].$error" ng-show="voiceRecordingsForm[\'membername\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.RATING">Rating</label>\n                <md-select name="rating" ng-model="vm.voiceRecording.rating" ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="null">{{\'VOICE.NO_RATING\' | translate}}</md-option>\n                  <md-option value="1">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1]"></md-icon>\n                  </md-option>\n                  <md-option value="2">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2]"></md-icon>\n                  </md-option>\n                  <md-option value="3">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3]"></md-icon>\n                  </md-option>\n                  <md-option value="4">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4]"></md-icon>\n                  </md-option>\n                  <md-option value="5">\n                    <md-icon md-font-icon="icon-star" style="color:red" ng-repeat="icon in [1,2,3,4,5]"></md-icon>\n                  </md-option>\n                </md-select>\n                <div ng-messages="voiceRecordingsForm[\'rating\'].$error" ng-show="voiceRecordingsForm[rating].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.RATING_REQUIRED">Rating field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.DISPOSITION">Disposition</label>\n                <input type="text" name="userDisposition" ng-model="vm.voiceRecording.userDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userDisposition\'].$error" ng-show="voiceRecordingsForm[\'userDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.SECOND_LEVEL_DISPOSITION">Second_Level_Disposition</label>\n                <input type="text" name="userSecondDisposition" ng-model="vm.voiceRecording.userSecondDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userSecondDisposition\'].$error" ng-show="voiceRecordingsForm[\'userSecondDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.SECOND_LEVEL_DISPOSITION_REQUIRED">Second_Level_Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="VOICE.THIRD_LEVEL_DISPOSITION">Third_Level_Disposition</label>\n                <input type="text" name="userThirdDisposition" ng-model="vm.voiceRecording.userThirdDisposition" disabled>\n\n                <div ng-messages="voiceRecordingsForm[\'userThirdDisposition\'].$error" ng-show="voiceRecordingsForm[\'userThirdDisposition\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="VOICE.ERRORS.THIRD_LEVEL_DISPOSITION_REQUIRED">Third_Level_Disposition field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab ng-if="vm.license.ai">\n        <md-tab-label>\n          <span translate="VOICE.TRANSCRIPTANALYSIS">TRANSCRIPTANALYSIS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="voiceRecording-detail-form-container transcript md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="VOICE.TRANSCRIPT">TRANSCRIPT</div>\n            </div>\n            <form name="transcriptForm" novalidate>\n              <md-input-container ng-if="vm.voiceRecording.transcribeStatus == \'COMPLETED\'" class="md-block">\n                <label translate="VOICE.TEXT">Text</label>\n                <textarea name="fileText" ng-model="vm.voiceRecording.fileText" autofocus ng-disabled="true"></textarea>\n              </md-input-container>\n              <md-input-container ng-if="vm.voiceRecording.transcribeStatus == \'FAILED\'" class="md-block">\n                <label translate="VOICE.FAILUREREASON">FailureReason</label>\n                <textarea name="failureReason" ng-model="vm.voiceRecording.failureReason" ng-disabled="true"></textarea>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="voiceRecording-detail-form-container sentimentanalysis md-background-bg md-whiteframe-1dp">\n            <div ng-controller="VoiceRecordingSentimentStatisticsController as vm_ss" ng-init="vm_ss.init(vm.voiceRecording)">\n              <md-toolbar class="md-table-toolbar md-default">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="VOICE.SENTIMENTANALYSIS" style="width: 50px;">Sentiment Analysis</span>\n                  <div flex></div>\n                </div>\n              </md-toolbar>\n\n              \x3c!-- WIDGET GROUP --\x3e\n              <div class="widget-group" layout="row" flex="100" layout-wrap>\n\n                \x3c!-- WIDGET 1 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8 sentiment" ng-class="vm_ss.voiceRecording.sentiment">\n                        {{vm_ss.voiceRecording.sentiment}}\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 1 --\x3e\n\n                \x3c!-- WIDGET 2 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sPositive || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_POSITIVE\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 2 --\x3e\n\n                \x3c!-- WIDGET 3 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sNegative || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_NEGATIVE\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 3 --\x3e\n\n                \x3c!-- WIDGET 4 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sNeutral || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_NEUTRAL\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 4 --\x3e\n\n                \x3c!-- WIDGET 5 --\x3e\n                <ms-widget class="h-140" layout="column" flex="100" flex-gt-xs="50" flex-gt-md="20">\n                  \x3c!-- Front --\x3e\n                  <ms-widget-front class="p-16 white-bg" layout="row" flex>\n                    <div class="pt-8 pb-8" layout="column" layout-align="center center" flex>\n                      <div class="md-display-1 pb-8">\n                        ({{ (vm_ss.voiceRecording.sMixed || 0) * 100 | number: 2  }}%)\n                      </div>\n                      <div class="font-weight-500 secondary-text">\n                        {{ \'VOICE.SENTIMENT_MIXED\' | translate | uppercase }}\n                      </div>\n                    </div>\n                  </ms-widget-front>\n                  \x3c!-- / Front --\x3e\n                </ms-widget>\n                \x3c!-- / WIDGET 5 --\x3e\n\n              </div>\n              \x3c!-- / WIDGET GROUP --\x3e\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/voice/views/voiceRecordings/voiceRecordings.html",'<div id="voiceRecordings" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-phone" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="VOICE.VOICERECORDINGS">VoiceRecordings</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="VOICE.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n      <ms-quick-filter filters="vm.quickFilters" query="vm.query" search="vm.getVoiceRecordings()"></ms-quick-filter>\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedVoiceRecordings.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedVoiceRecordings =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="VOICE.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-voiceRecordings-count">\n          <span>{{vm.selectedVoiceRecordings.length}}</span>\n          <span translate="VOICE.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="VOICE.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllVoiceRecordings()" translate="VOICE.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectVoiceRecordings()" translate="VOICE.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedVoiceRecordings" csv-label="true" filename="voiceRecordings.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runtranscribesentimentSelectedVoiceRecordings($event)" aria-label="transcribesentiment selected" translate translate-attr-label="VOICERECORDINGS.TRANSCRIBESENTIMENT_SELECTED">\n          <md-icon md-font-icon="icon-text-to-speech"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runtranscribeSelectedVoiceRecordings($event)" aria-label="transcribe selected" translate translate-attr-label="VOICERECORDINGS.TRANSCRIBE_SELECTED">\n          <md-icon md-font-icon="icon-format-size"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNTRANSCRIBE_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.license.ai" ng-click="vm.runsentimentSelectedVoiceRecordings($event)" aria-label="transcribe selected" translate translate-attr-label="VOICERECORDINGS.SENTIMENT_SELECTED">\n          <md-icon md-font-icon="icon-heart-outline"></md-icon>\n          <md-tooltip>{{\'VOICE.RUNSENTIMENT_VOICERECORDING\' | translate}}</md-tooltip>\n        </md-button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedVoiceRecordings($event)" aria-label="delete selected" translate translate-attr-label="VOICE.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- VOICERECORDING TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedVoiceRecordings" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getVoiceRecordings">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="type">{{ \'VOICE.TYPE\' | translate }}</th>\n                <th md-column md-order-by="uniqueid">{{ \'VOICE.UNIQUEID\' | translate }}</th>\n                <th md-column md-order-by="calleridnum">{{ \'VOICE.CALLER\' | translate }}</th>\n                <th md-column md-order-by="exten">{{ \'VOICE.CALLED\' | translate }}</th>\n                <th md-column md-order-by="connectedlinenum">{{ \'VOICE.CONNECTED\' | translate }}</th>\n                <th md-column md-order-by="queue">{{ \'VOICE.QUEUE\' | translate }}</th>\n                <th md-column md-order-by="membername">{{ \'VOICE.AGENT\' | translate }}</th>\n                <th md-column md-order-by="rating">{{ \'VOICE.RATING\' | translate }}</th>\n                <th md-column>{{ \'VOICE.AUDIO\' | translate }}</th>\n                <th md-column md-order-by="createdAt">{{ \'VOICE.DATE\' | translate }}</th>\n                <th md-column md-order-by="userDisposition">{{ \'VOICE.DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="userSecondDisposition">{{ \'VOICE.SECOND_LEVEL_DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="userThirdDisposition">{{ \'VOICE.THIRD_LEVEL_DISPOSITION\' | translate }}</th>\n                <th md-column md-order-by="transcribeStatus" ng-if="vm.license.ai">{{ \'VOICE.TRANSCRIBE\' | translate }}</th>\n                <th md-column md-order-by="sentiment" ng-if="vm.license.ai">{{ \'VOICE.SENTIMENTANALYSIS\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.voiceRecordings.rows.length">\n                <td md-cell colspan="16">\n                  <div layout="row" layout-align="center center">\n                    <span translate="VOICE.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="voiceRecording" md-select-id="id" ng-repeat="voiceRecording in vm.voiceRecordings.rows">\n                <td md-cell ng-if="voiceRecording.userpic"><img class="avatar" alt="{{voiceRecording.name}}" ng-src="api/users/{{voiceRecording.id}}/avatar" /></td>\n                <td md-cell ng-if="!voiceRecording.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{voiceRecording.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="type ">{{voiceRecording.type}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="uniqueid ">{{voiceRecording.uniqueid}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="calleridnum " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.calleridnum}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="exten " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.exten}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="connectedlinenum " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.connectedlinenum}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="queue ">{{voiceRecording.queue}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="membername " privacy="{{vm.userProfile.privacyEnabled}}" ng-cloak>{{voiceRecording.membername}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="rating ">\n                  <md-icon md-font-icon="icon-star" style="color:red" ng-show="voiceRecording.rating" ng-repeat="rating in [1,2,3,4,5] | limitTo:voiceRecording.rating"></md-icon><span ng-hide="voiceRecording.rating" translate="VOICE.NO_RATING">No rating</span>\n                </td>\n                <td md-cell class="audio " ng-switch="voiceRecording.format">\n                  \x3c!-- audio recording directive --\x3e\n                  <ms-recording ng-switch-when=".wav" id="voiceRecording.id" model="\'voiceRecording\'"></ms-recording>\n                  \x3c!-- / audio recording directive --\x3e\n                  <span ng-switch-when=".gsm|.WAV" ng-switch-when-separator="|">\n                    <em>{{ \'VOICE.CANT_PLAY_GSM_AUDIO_FILES\' | translate }}</em>\n                  </span>\n                </td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="createdAt ">{{voiceRecording.createdAt | date:\'medium\' }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userDisposition ">{{voiceRecording.userDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userSecondDisposition ">{{voiceRecording.userSecondDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="userThirdDisposition ">{{voiceRecording.userThirdDisposition}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="transcribeStatus " ng-if="vm.license.ai">{{ \'VOICE.TRANSCRIBESTATUS_\' + voiceRecording.transcribeStatus | translate}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(voiceRecording, ev) : vm.createOrEditVoiceRecording($event, voiceRecording)" md-cell class="sentiment " ng-if="vm.license.ai">{{voiceRecording.sentiment}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(voiceRecording, $event    )" translate="VOICE.EDIT_VOICERECORDING">\n                          Edit VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'NEW\' && vm.license.ai">\n\n                        <md-button ng-click="vm.runtranscriberuntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNTRANSCRIBE_VOICERECORDING">\n                          RunTranscribe VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'NEW\' && vm.license.ai">\n\n                        <md-button ng-click="vm.runtranscribesentimentruntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNTRANSCRIBESENTIMENT_VOICERECORDING">\n                          RunTranscribeSentiment VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\' && voiceRecording.sentiment == null && vm.license.ai">\n\n                        <md-button ng-click="vm.runsentimentruntranscribesentiment(voiceRecording, $event    )" translate="VOICE.RUNSENTIMENT_VOICERECORDING">\n                          RunSentiment VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="voiceRecording.transcribeStatus == \'COMPLETED\' && vm.license.ai">\n\n                        <md-button ng-click="vm.downloadtranscribefile2(voiceRecording, $event    )" translate="VOICE.DOWNLOADTRANSCRIBE_VOICERECORDING">\n                          DownloadTranscribe VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.currentUser.role === \'admin\' || vm.userProfile.downloadVoiceRecordings">\n\n                        <md-button ng-click="vm.downloadfile2(voiceRecording, $event  , \'voice/recordings\'   )" translate="VOICE.DOWNLOAD_VOICERECORDING">\n                          Download VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(voiceRecording, $event    )" translate="VOICE.DELETE_VOICERECORDING">\n                          Delete VoiceRecording\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'VOICE.PAGE\' | translate}}:\', rowsPerPage: \'{{\'VOICE.ROWSPERPAGE\' | translate}}:\', of: \'{{\'VOICE.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.voiceRecordings.count}}" md-on-paginate="vm.getVoiceRecordings" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / VOICERECORDING TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- NO ADD BUTTON BUTTON --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/realtime/realtime.html",'<div id="realtime" class="page-layout simple tabbed" layout="column" ng-cloak>\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.AGENTS">Agents</span>\n        </md-tab-label>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.QUEUES">Queues</span>\n        </md-tab-label>\n      </md-tab>\n    </md-tabs>\n\n    <md-card ui-view></md-card>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/create/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.whatsappAccount.name" ng-required="true" autofocus ng-disabled="!vm.newWhatsappAccount">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n        <div ng-messages="whatsappAccountForm[\'name\'].$error" ng-show="whatsappAccountForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">key</label>\n        <input type="text" name="key" ng-model="vm.whatsappAccount.key" md-maxlength="5" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'key\'].$error" ng-show="whatsappAccountForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">key field is required</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LIST">List</label>\n        <md-select name="ListId" ng-model="vm.whatsappAccount.ListId" required>\n          <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n        </md-select>\n        <div class="hint"><span translate="WHATSAPP.HELP.LIST"></span></div>\n        <div ng-messages="whatsappAccountForm[\'ListId\'].$error" ng-show="whatsappAccountForm[\'ListId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LIST_REQUIRED">List field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.MOTIONPROXY">MotionProxy</label>\n        <input type="url" name="remote" ng-model="vm.whatsappAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.MOTIONPROXY"></span></div>\n        <div ng-messages="whatsappAccountForm[\'remote\'].$error" ng-show="whatsappAccountForm[\'remote\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n          </div>\n          <div ng-message="url">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n          </div>\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TYPE">Type</label>\n        <md-select name="type" ng-model="vm.whatsappAccount.type">\n          <md-option ng-value="\'twilio\'">Twilio</md-option>\n          <md-option ng-value="\'sinch\'">Sinch</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountForm[\'type\'].$error" ng-show="whatsappAccountForm[\'type\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TYPE_REQUIRED">Type field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\' || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.ACCOUNTSID">AccountSID</label>\n        <input type="text" name="accountSid" ng-model="vm.whatsappAccount.accountSid" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'accountSid\'].$error" ng-show="whatsappAccountForm[\'accountSid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\' || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.AUTHTOKEN">AuthToken</label>\n        <input type="text" name="authToken" ng-model="vm.whatsappAccount.authToken" ng-required="true">\n\n        <div ng-messages="whatsappAccountForm[\'authToken\'].$error" ng-show="whatsappAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <md-input-container ng-if="vm.whatsappAccount.type == \'sinch\'" class="md-block">\n        <label translate="WHATSAPP.BASEURL">Base URL</label>\n\n        \x3c!--    <input type="text" name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" ng-required="true"> --\x3e\n\n        <md-select name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" required>\n          <md-option ng-value="\'https://us1.whatsapp.api.sinch.com\'">US Production</md-option>\n          <md-option ng-value="\'https://eu1.whatsapp.api.sinch.com\'">EU Production</md-option>\n        </md-select>\n\n        <div ng-messages="whatsappAccountForm[\'authToken\'].$error" ng-show="whatsappAccountForm[\'authToken\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PHONE">phone</label>\n        <input type="text" name="phone" ng-model="vm.whatsappAccount.phone" ng-required="true">\n        <div ng-messages="whatsappAccountForm[\'phone\'].$error" ng-show="whatsappAccountForm[\'phone\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PHONE_REQUIRED">phone field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappAccount.description">\n\n        <div ng-messages="whatsappAccountForm[\'description\'].$error" ng-show="whatsappAccountForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappAccount" ng-click="vm.saveWhatsappAccount()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountForm.$invalid || whatsappAccountForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappAccount" ng-click="vm.addNewWhatsappAccount()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPACCOUNT" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPACCOUNT">\n          ADD WHATSAPPACCOUNT\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappAccount" ng-click="vm.deleteWhatsappAccount($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/agentadd/agentadd.html",'<md-dialog class="whatsappAccount-dialog" aria-label="whatsappAccount" ng-init="vm.onInit()">\n  <form name="whatsappAccountForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT">Add Agent to whatsappAccount</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/agent/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.AGENT">Agent</label>\n        <md-select name="agent" ng-model="vm.agent.agent" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="agent.name" ng-repeat="agent in vm.agents" ng-disabled="agent.canSelect === false">{{ agent.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'agent\'].$error" ng-show="whatsappAccountFormApp[\'agent\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AGENT_REQUIRED">Agent field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.agent.timeout" min="0" max="2147483" value="30" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'timeout\'].$error" ng-show="whatsappAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/amazonlex/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.ACCESSKEYID">accesskeyid</label>\n        <input type="text" name="accesskeyid" ng-model="vm.amazonlex.accesskeyid" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'accesskeyid\'].$error" ng-show="whatsappAccountFormApp[\'accesskeyid\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.ACCESSKEYID_REQUIRED">accesskeyid field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.SECRETACCESSKEY">secretaccesskey</label>\n        <input type="text" name="secretaccesskey" ng-model="vm.amazonlex.secretaccesskey" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'secretaccesskey\'].$error" ng-show="whatsappAccountFormApp[\'secretaccesskey\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.SECRETACCESSKEY_REQUIRED">secretaccesskey field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LEXREGION">lexregion</label>\n        <md-select name="lexregion" ng-model="vm.amazonlex.lexregion" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'us-east-1\'">US East (N. Virginia)</md-option>\n          <md-option ng-value="\'us-west-2\'">US West (Oregon)</md-option>\n          <md-option ng-value="\'eu-west-1\'">EU (Ireland)</md-option>\n          <md-option ng-value="\'ap-southeast-2\'">Asia Pacific (Sydney)</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'lexregion\'].$error" ng-show="whatsappAccountFormApp[\'lexregion\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LEXREGION_REQUIRED">lexregion field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.BOTNAME">botname</label>\n        <input type="text" name="botname" ng-model="vm.amazonlex.botname" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'botname\'].$error" ng-show="whatsappAccountFormApp[\'botname\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.BOTNAME_REQUIRED">botname field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.amazonlex.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/autoreply/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMES">times</label>\n        <md-select name="times" ng-model="vm.autoreply.times" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="2">One Time</md-option>\n          <md-option ng-value="0">Always</md-option>\n          <md-option ng-value="1">First Message</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'times\'].$error" ng-show="whatsappAccountFormApp[\'times\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMES_REQUIRED">times field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TEXT">Text</label>\n        <textarea name="text" ng-model="vm.autoreply.text" required></textarea>\n\n        <div ng-messages="whatsappAccountFormApp[\'text\'].$error" ng-show="whatsappAccountFormApp[\'text\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TEXT_REQUIRED">Text field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/close/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DISPOSITION">Disposition</label>\n        <input type="text" name="disposition" ng-model="vm.close.disposition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'disposition\'].$error" ng-show="whatsappAccountFormApp[\'disposition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DISPOSITION_REQUIRED">Disposition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/dialogflow/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">Key</label>\n        <input type="text" name="key" ng-model="vm.dialogflow.key" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'key\'].$error" ng-show="whatsappAccountFormApp[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflow.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean (South Korea)</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pt\'">Portuguese (European)</md-option>\n          <md-option ng-value="\'pt-br\'">Portuguese (Nrazilian)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'sv\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-HK\'">Chinese (Hong Kong)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'language\'].$error" ng-show="whatsappAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflow.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_REQUIRED">welcomemessage field is required</span>\n          </div>\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/dialogflowv2/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PROJECTID">ProjectID</label>\n        <input type="text" name="projectId" ng-model="vm.dialogflowv2.projectId" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'projectId\'].$error" ng-show="whatsappAccountFormApp[\'projectId\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PROJECTID_REQUIRED">ProjectID field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.CLIENTEMAIL">ClientEmail</label>\n        <input type="text" name="clientEmail" ng-model="vm.dialogflowv2.clientEmail" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'clientEmail\'].$error" ng-show="whatsappAccountFormApp[\'clientEmail\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.CLIENTEMAIL_REQUIRED">ClientEmail field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PRIVATEKEY">PrivateKey</label>\n        <textarea name="privateKey" ng-model="vm.dialogflowv2.privateKey" required></textarea>\n\n        <div ng-messages="whatsappAccountFormApp[\'privateKey\'].$error" ng-show="whatsappAccountFormApp[\'privateKey\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PRIVATEKEY_REQUIRED">PrivateKey field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.LANGUAGE">language</label>\n        <md-select name="language" ng-model="vm.dialogflowv2.language" required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'zh-HK\'">Chinese (Cantonese)</md-option>\n          <md-option ng-value="\'zh-CN\'">Chinese (Simplified)</md-option>\n          <md-option ng-value="\'zh-TW\'">Chinese (Traditional)</md-option>\n          <md-option ng-value="\'da\'">Danish</md-option>\n          <md-option ng-value="\'nl\'">Dutch</md-option>\n          <md-option ng-value="\'en\'">English</md-option>\n          <md-option ng-value="\'en-AU\'">English (Australia)</md-option>\n          <md-option ng-value="\'en-CA\'">English (Canada)</md-option>\n          <md-option ng-value="\'en-GB\'">English (Great Britain)</md-option>\n          <md-option ng-value="\'en-IN\'">English (India)</md-option>\n          <md-option ng-value="\'en-US\'">English (US)</md-option>\n          <md-option ng-value="\'fr\'">French</md-option>\n          <md-option ng-value="\'fr-CA\'">French (Canada)</md-option>\n          <md-option ng-value="\'fr-FR\'">\'France (France)</md-option>\n          <md-option ng-value="\'de\'">German</md-option>\n          <md-option ng-value="\'hi\'">Hindi</md-option>\n          <md-option ng-value="\'id\'">Indonesian</md-option>\n          <md-option ng-value="\'it\'">Italian</md-option>\n          <md-option ng-value="\'ja\'">Japanese</md-option>\n          <md-option ng-value="\'ko\'">Korean</md-option>\n          <md-option ng-value="\'no\'">Norwegian</md-option>\n          <md-option ng-value="\'pl\'">Polish</md-option>\n          <md-option ng-value="\'pt-BR\'">Portuguese (Brazil)</md-option>\n          <md-option ng-value="\'pt-PT\'">Portuguese (Portugal)</md-option>\n          <md-option ng-value="\'ru\'">Russian</md-option>\n          <md-option ng-value="\'es\'">Spanish</md-option>\n          <md-option ng-value="\'es-419\'">Spanish (Latin America)</md-option>\n          <md-option ng-value="\'es-ES\'">Spanish (Spain)</md-option>\n          <md-option ng-value="\'sw\'">Swedish</md-option>\n          <md-option ng-value="\'th\'">Thai</md-option>\n          <md-option ng-value="\'tr\'">Turkish</md-option>\n          <md-option ng-value="\'uk\'">Ukrainian</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'language\'].$error" ng-show="whatsappAccountFormApp[\'language\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.LANGUAGE_REQUIRED">language field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.WELCOMEMESSAGE">welcomemessage</label>\n        <textarea name="welcomemessage" ng-model="vm.dialogflowv2.welcomemessage" md-maxlength="255"></textarea>\n        <div class="hint"><span translate="WHATSAPP.HELP.WELCOMEMESSAGE"></span></div>\n\n        <div ng-messages="whatsappAccountFormApp[\'welcomemessage\'].$error" ng-show="whatsappAccountFormApp[\'welcomemessage\'].$touched" role="alert">\n\n\n          <div ng-message="md-maxlength">\n            <span translate="WHATSAPP.ERRORS.WELCOMEMESSAGE_MAX_LENGTH" translate-values=\'{max: 255}\'>welcomemessage must have a maximum length equal to 255</span>\n          </div>\n\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/gotoif/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.CONDITION">Condition</label>\n        <input type="text" name="condition" ng-model="vm.gotoif.condition" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'condition\'].$error" ng-show="whatsappAccountFormApp[\'condition\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.CONDITION_REQUIRED">Condition field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TRUEPRIORITY">truepriority</label>\n        <input type="number" name="truepriority" ng-model="vm.gotoif.truepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'truepriority\'].$error" ng-show="whatsappAccountFormApp[\'truepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TRUEPRIORITY_REQUIRED">truepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TRUEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">truepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.FALSEPRIORITY">falsepriority</label>\n        <input type="number" name="falsepriority" ng-model="vm.gotoif.falsepriority" min="1" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'falsepriority\'].$error" ng-show="whatsappAccountFormApp[\'falsepriority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.FALSEPRIORITY_REQUIRED">falsepriority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.FALSEPRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">falsepriority must be a valid greater or equal than</span> <span>1</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/gotop/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.PRIORITY">Priority</label>\n        <input type="number" name="priority" ng-model="vm.gotop.priority" min="0" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'priority\'].$error" ng-show="whatsappAccountFormApp[\'priority\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.PRIORITY_REQUIRED">Priority field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.PRIORITY_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Priority must be a valid greater or equal than</span> <span>0</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/interval/dialog.html",'<md-dialog class="interval-dialog" aria-label="New Interval">\n  <form name="intervalForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n\n\n      <md-input-container class="md-block">\n        <label translate="TOOLS.TYPE">Type</label>\n        <md-select ng-model="vm.type" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="type" ng-repeat=\'type in vm.types\'>{{ type | ucfirst }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      <md-input-container class="md-block" ng-if="vm.type === \'list\'">\n        <label translate="TOOLS.INTERVALS">Intervals</label>\n        <md-select ng-model="vm.interval.IntervalId" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n          <md-option ng-value="interval.id" ng-repeat="interval in vm.intervals">{{ interval.name }}</md-option>\n        </md-select>\n      </md-input-container>\n\n      \x3c!-- TIMERANGE START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.TIME_RANGE">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <div class="md-block" flex>\n          <mdp-time-picker name="timeRangeFrom" mdp-placeholder="FROM" ng-model="vm.timeRangeFrom" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <div ng-messages="intervalForm.timeRangeFrom.$error" ng-show="intervalForm.timeRangeFrom.$touched" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_FROM_INVALID">Time Range From field is invalid</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n        <div class="md-block" flex ng-if="vm.timeRangeFrom">\n          <mdp-time-picker name="timeRangeTo" mdp-placeholder="TO*" ng-model="vm.timeRangeTo" mdp-format="HH:mm" mdp-auto-switch="true" mdp-disabled="!vm.newInterval && !vm.crudPermissions.canEdit" required>\n            <div ng-messages="intervalForm.timeRangeTo.$error" ng-show="intervalForm.timeRangeTo.$invalid" role="alert">\n              <div ng-message="format">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_INVALID">Time Range To field is invalid</span>\n              </div>\n              <div ng-message="required">\n                <span translate="TOOLS.ERRORS.TIME_RANGE_TO_REQUIRED">Time Range To field is required</span>\n              </div>\n            </div>\n          </mdp-time-picker>\n        </div>\n      </div>\n      \x3c!-- TIMERANGE END --\x3e\n\n      \x3c!-- DAYSOFWEEK START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.WEEK_DAYS">Week Days</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.dayOfWeekFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex class="md-block" ng-if="vm.dayOfWeekFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="dayOfWeekTo" ng-model="vm.dayOfWeekTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="day.value" ng-repeat="day in vm.daysOfWeek"><span translate="TOOLS.{{day.value | uppercase}}">{{ day.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.dayOfWeekTo.$error" ng-show="intervalForm.dayOfWeekTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- DAYSOFWEEK END --\x3e\n\n      \x3c!-- MONTHDAY START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTH_DAYS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthDayFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthDayFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthDayTo" ng-model="vm.monthDayTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month" ng-repeat="month in vm.daysOfMonth">{{ month }}</md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthDayTo.$error" ng-show="intervalForm.monthDayTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTHDAY END --\x3e\n\n      \x3c!-- MONTH START --\x3e\n      <label ng-if="vm.type === \'custom\'" translate="TOOLS.MONTHS">Time Range</label>\n      <div layout=row ng-if="vm.type === \'custom\'">\n        <md-input-container flex layout="column" class="md-block">\n          <label translate="TOOLS.FROM">From</label>\n          <md-select ng-model="vm.monthFrom" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="null"><span translate="TOOLS.ALWAYS">Always</span></md-option>\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n\n        </md-input-container>\n\n        <md-input-container flex layout="column" class="md-block" ng-if="vm.monthFrom">\n          <label translate="TOOLS.TO">To</label>\n          <md-select name="monthTo" ng-model="vm.monthTo" ng-disabled="!vm.newInterval && !vm.crudPermissions.canEdit">\n            <md-option ng-value="month.value" ng-repeat="month in vm.monthName"><span translate="TOOLS.{{month.value | uppercase}}">{{ month.value | ucfirst }}</span></md-option>\n          </md-select>\n          <div ng-messages="intervalForm.monthTo.$error" ng-show="intervalForm.monthTo.$touched" role="alert">\n          </div>\n        </md-input-container>\n      </div>\n      \x3c!-- MONTH END --\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="!vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.saveInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid || intervalForm.$pristine" aria-label="SAVE" translate="TOOLS.SAVE" translate-attr-aria-label="TOOLS.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.newInterval && vm.crudPermissions.canEdit" ng-click="vm.addNewInterval()" class="send-button md-accent md-raised" ng-disabled="intervalForm.$invalid" aria-label="ADD" translate="TOOLS.ADD_INTERVAL" translate-attr-aria-label="TOOLS.ADD_INTERVAL">\n          ADD INTERVAL\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/noop/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VALUE">Value</label>\n        <input type="text" name="value" ng-model="vm.noop.value" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'value\'].$error" ng-show="whatsappAccountFormApp[\'value\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/queue/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.QUEUE">Queue</label>\n        <md-select name="queue" ng-model="vm.queue.queue" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="queue.name" ng-repeat="queue in vm.queues" ng-disabled="queue.canSelect === false">{{ queue.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'queue\'].$error" ng-show="whatsappAccountFormApp[\'queue\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.QUEUE_REQUIRED">Queue field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TIMEOUT">Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.queue.timeout" min="0" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'timeout\'].$error" ng-show="whatsappAccountFormApp[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_REQUIRED">Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>0</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/system/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.COMMAND">Command</label>\n        <input type="text" name="command" ng-model="vm.system.command" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n        <div ng-messages="whatsappAccountFormApp[\'command\'].$error" ng-show="whatsappAccountFormApp[\'command\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.COMMAND_REQUIRED">Command field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VARIABLE">Variable</label>\n        <md-select name="variable" ng-model="vm.system.variable" ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="\'\'">None</md-option>\n          <md-option ng-value="variable.name" ng-repeat="variable in vm.variables" ng-disabled="variable.canSelect === false">{{ variable.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'variable\'].$error" ng-show="whatsappAccountFormApp[\'variable\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VARIABLE_REQUIRED">Variable field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/apps/tag/dialog.html",'<md-dialog class="whatsappAccount-dialog" aria-label="New WhatsappAccount">\n  <form name="whatsappAccountFormApp" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.TAG">Tag</label>\n        <md-select name="tag" ng-model="vm.tag.tag" autofocus required ng-disabled="!vm.crudPermissions.canEdit">\n          <md-option ng-value="tag.name" ng-repeat="tag in vm.tags" ng-disabled="tag.canSelect === false">{{ tag.name }}</md-option>\n        </md-select>\n        <div ng-messages="whatsappAccountFormApp[\'tag\'].$error" ng-show="whatsappAccountFormApp[\'tag\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.TAG_REQUIRED">Tag field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center" ng-if="vm.crudPermissions.canEdit">\n        <md-button type="submit" ng-click="vm.saveWhatsappAccountApp()" class="send-button md-accent md-raised" ng-disabled="whatsappAccountFormApp.$invalid || whatsappAccountFormApp.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/view.html",'<div id="whatsapp-whatsappAccount" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-whatsappAccounts-button md-icon-button" aria-label="Go to whatsappAccounts" ng-click="vm.gotoWhatsappAccounts()" translate translate-attr-aria-label="WHATSAPP.GO_TO_WHATSAPPACCOUNTS">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="whatsappAccount-image" hide-xs>\n          <img ng-src="assets/images/business/whatsappAccounts.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.whatsappAccount.id}}\n            <span ng-if="vm.whatsappAccount.name">{{vm.whatsappAccount.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="WHATSAPP.CREATED_AT"></span> <span>{{vm.whatsappAccount.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.whatsappAccount, $event)" class="md-fab md-warn md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveWhatsappAccount()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid) || (notificationForm.$invalid) || (transferForm.$invalid) || (proxyForm.$invalid) || (dispositionForm.$invalid) || (whatsappDispositionsForm.$invalid) || (whatsappCannedAnswersForm.$invalid) || (actionsForm.$invalid) || (interactionsForm.$invalid)" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.whatsappAccount.name" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.KEY">key</label>\n                <input type="text" name="key" ng-model="vm.whatsappAccount.key" md-maxlength="5" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'key\'].$error" ng-show="generalForm[\'key\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">key field is required</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="WHATSAPP.ERRORS.KEY_MAX_LENGTH" translate-values=\'{max: 5}\'>key must have a maximum length equal to 5</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.LIST">List</label>\n                <md-select name="ListId" ng-model="vm.whatsappAccount.ListId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="ListId.id" ng-repeat="ListId in vm.lists" ng-disabled="ListId.canSelect === false">{{ ListId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="WHATSAPP.HELP.LIST"></span></div>\n                <div ng-messages="generalForm[\'ListId\'].$error" ng-show="generalForm[\'ListId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.LIST_REQUIRED">List field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\'  || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.ACCOUNTSID">AccountSID</label>\n                <input type="text" name="accountSid" ng-model="vm.whatsappAccount.accountSid" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'accountSid\'].$error" ng-show="generalForm[\'accountSid\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.ACCOUNTSID_REQUIRED">AccountSID field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container ng-if="vm.whatsappAccount.type == \'twilio\'  || vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.AUTHTOKEN">AuthToken</label>\n                <input type="text" name="authToken" ng-model="vm.whatsappAccount.authToken" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'authToken\'].$error" ng-show="generalForm[\'authToken\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AUTHTOKEN_REQUIRED">AuthToken field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container ng-if="vm.whatsappAccount.type == \'sinch\'" class="md-block">\n                <label translate="WHATSAPP.BASEURL">BaseURL</label>\n\n                <md-select name="baseUrl" ng-model="vm.whatsappAccount.baseUrl" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryBaseUrl.url" ng-repeat="mandatoryBaseUrl in vm.baseUrl" ng-disabled="mandatoryBaseUrl.canSelect === false">{{ mandatoryBaseUrl.name }}</md-option>\n                </md-select>\n\n                <div ng-messages="generalForm[\'baseUrl\'].$error" ng-show="generalForm[\'baseUrl\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.BASEURL_REQUIRED">Base URL field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.PHONE">phone</label>\n                <input type="text" name="phone" ng-model="vm.whatsappAccount.phone" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n                <div ng-messages="generalForm[\'phone\'].$error" ng-show="generalForm[\'phone\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.PHONE_REQUIRED">phone field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.RECEIVEURL">receiveUrl</label>\n\n                <div layout="row" layout-align="center center">\n                  <button class="md-button md-fab md-mini md-primary" ngclipboard data-clipboard-target="#copytoclipboard-receiveUrl" ngclipboard-success="vm.alert({title: \'copied to clipboard\',  msg: e.text });" ngclipboard-error="vm.alert({title: \'error\', msg: \'copy to clipboard failed\'});">\n                    <md-icon md-font-icon="icon-clipboard-text"></md-icon>\n                  </button>\n                  <input class="md-input" type="text" id="copytoclipboard-receiveUrl" name="receiveUrl" ng-value="vm.whatsappAccount.remote + \'/api/whatsapp/accounts/\' + vm.whatsappAccount.id + \'/notify?token=\' + vm.whatsappAccount.token" ng-readonly="true">\n                </div>\n                <div class="hint"><span translate="WHATSAPP.HELP.RECEIVEURL"></span></div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.WAITFORTHEASSIGNEDAGENT">WaitForTheAssignedAgent</label>\n                <input type="number" name="waitForTheAssignedAgent" ng-model="vm.whatsappAccount.waitForTheAssignedAgent" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedAgent\'].$error" ng-show="generalForm[\'waitForTheAssignedAgent\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_REQUIRED">WaitForTheAssignedAgent field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.WAITFORTHEASSIGNEDAGENT_MUST_BE_LESS_THAN_OR_EQUAL_TO">WaitForTheAssignedAgent must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n              <md-input-container class="md-block">\n                <label translate="CHAT.WAIT_FOR_THE_ASSIGNED_QUEUE">Wait For The Assigned Queue</label>\n                <input type="number" name="waitForTheAssignedQueue" ng-model="vm.whatsappAccount.waitForTheAssignedQueue" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'waitForTheAssignedQueue\'].$error" ng-show="generalForm[\'waitForTheAssignedQueue\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="TOOLBAR.ERRORS.FIELD_REQUIRED">Wait For The Assigned Queue field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="TOOLBAR.ERRORS.FIELD_MUST_BE_LESS_THAN_OR_EQUAL_TO">Wait For The Assigned Queue must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n\n\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.whatsappAccount.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container notification md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.NOTIFICATION">NOTIFICATION</div>\n            </div>\n            <form name="notificationForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.notificationShake" aria-label="notificationShake" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.NOTIFICATIONSHAKE">notificationShake</span></md-switch>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.notificationSound" aria-label="notificationSound" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.NOTIFICATIONSOUND">notificationSound</span></md-switch>\n              </md-input-container>\n              <div class="md-block">\n                <label class="md-caption grey-fg" translate="WHATSAPP.NOTIFICATIONTEMPLATE">notificationTemplate</label>\n                <textarea aria-label="notificationTemplate notificationTemplate" ckeditor="{ skin: \'office2013\', language: \'en\', allowedContent: true, extraPlugins: \'font,colorbutton,autoembed,autocorrect,googlethisterm,pastebase64\', toolbarGroups: [{ name: \'styles\', groups: [\'styles\'] }, { name: \'clipboard\', groups: [\'undo\'] }, { name: \'colors\', groups: [\'colors\'] }, { name: \'basicstyles\', groups: [\'basicstyles\'] }, { name: \'paragraph\', groups: [\'list\', \'indent\', \'align\'] }, { name: \'mode\' }], autocorrect_enabled: true, disableNativeSpellChecker: false, fontSize_sizes: \'8/8pt;9/9pt;10/10pt;11/11pt;12/12pt;14/14pt;16/16pt;18/18pt;20/20pt;22/22pt;24/24pt;26/26pt;28/28pt;36/36pt;48/48pt;72/72pt\',  removePlugins: \'magicline\' }" ng-model="vm.whatsappAccount.notificationTemplate"></textarea>\n              </div>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container transfer md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.TRANSFER">TRANSFER</div>\n            </div>\n            <form name="transferForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.queueTransfer" aria-label="queueTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.QUEUETRANSFER">queueTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.queueTransfer == true" class="md-block">\n                <label translate="WHATSAPP.QUEUETRANSFERTIMEOUT">queueTransferTimeout</label>\n                <input type="number" name="queueTransferTimeout" ng-model="vm.whatsappAccount.queueTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'queueTransferTimeout\'].$error" ng-show="transferForm[\'queueTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_REQUIRED">queueTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.QUEUETRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">queueTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.agentTransfer" aria-label="agentTransfer" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.AGENTTRANSFER">agentTransfer</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.agentTransfer == true" class="md-block">\n                <label translate="WHATSAPP.AGENTTRANSFERTIMEOUT">agentTransferTimeout</label>\n                <input type="number" name="agentTransferTimeout" ng-model="vm.whatsappAccount.agentTransferTimeout" min="1" max="2147483" value="300" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="transferForm[\'agentTransferTimeout\'].$error" ng-show="transferForm[\'agentTransferTimeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_REQUIRED">agentTransferTimeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.AGENTTRANSFERTIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">agentTransferTimeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.ADVANCED">ADVANCED</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container proxy md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.PROXY">PROXY</div>\n            </div>\n            <form name="proxyForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.MOTIONPROXY">MotionProxy</label>\n                <input type="url" name="remote" ng-model="vm.whatsappAccount.remote" md-maxlength="255" value="LOCALIP" ng-required="true" autofocus ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div class="hint"><span translate="WHATSAPP.HELP.MOTIONPROXY"></span></div>\n                <div ng-messages="proxyForm[\'remote\'].$error" ng-show="proxyForm[\'remote\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_REQUIRED">MotionProxy field is required</span>\n                  </div>\n                  <div ng-message="url">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MUST_VALID_URL">MotionProxy must be a valid url http://www.xcally.com</span>\n                  </div>\n                  <div ng-message="md-maxlength">\n                    <span translate="WHATSAPP.ERRORS.MOTIONPROXY_MAX_LENGTH" translate-values=\'{max: 255}\'>MotionProxy must have a maximum length equal to 255</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.TOKEN">token</label>\n                <input type="text" name="token" ng-model="vm.whatsappAccount.token" disabled>\n\n                <div ng-messages="proxyForm[\'token\'].$error" ng-show="proxyForm[\'token\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.TOKEN_REQUIRED">token field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n          <div class="whatsappAccount-detail-form-container disposition md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.DISPOSITION">DISPOSITION</div>\n            </div>\n            <form name="dispositionForm" novalidate>\n              <md-input-container class="md-block">\n                <md-switch ng-model="vm.whatsappAccount.mandatoryDisposition" aria-label="MandatoryDisposition" ng-disabled="!vm.crudPermissions.canEdit"><span translate="WHATSAPP.MANDATORYDISPOSITION">MandatoryDisposition</span></md-switch>\n              </md-input-container>\n              <md-input-container ng-if="vm.whatsappAccount.mandatoryDisposition" class="md-block">\n                <label translate="WHATSAPP.MANDATORYDISPOSITIONPAUSEID">MandatoryDispositionPauseId</label>\n                <md-select name="mandatoryDispositionPauseId" ng-model="vm.whatsappAccount.mandatoryDispositionPauseId" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="mandatoryDispositionPauseId.id" ng-repeat="mandatoryDispositionPauseId in vm.pauses" ng-disabled="mandatoryDispositionPauseId.canSelect === false">{{ mandatoryDispositionPauseId.name }}</md-option>\n                </md-select>\n                <div class="hint"><span translate="WHATSAPP.HELP.MANDATORYDISPOSITIONPAUSEID"></span></div>\n                <div ng-messages="dispositionForm[\'mandatoryDispositionPauseId\'].$error" ng-show="dispositionForm[\'mandatoryDispositionPauseId\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.MANDATORYDISPOSITIONPAUSEID_REQUIRED">MandatoryDispositionPauseId field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.DISPOSITIONS">DISPOSITIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div ng-controller="WhatsappAccountDispositionsController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions)">\n            <div layout="row">\n              <div class="column" flex="20">\n                <md-card class="mt-0">\n                  <md-card-content>\n                    <button layout-align="center center" md-mini-fab ng-click="vm_dc.query.level = null; vm_dc.getDispositions()">\n                      <div layout="row" layout-align="start center">\n                        <md-icon md-font-icon="icon-refresh"></md-icon>\n                        <span class="ph-5">{{ \'TOOLS.ALL_DISPOSITIONS\' | translate }}</span>\n                      </div>\n                    </button>\n                  </md-card-content>\n                </md-card>\n                <md-card>\n                  <md-card-content>\n                    <md-input-container class="md-block" flex-gt-sm="">\n                      <label translate="TOOLS.SELECT_LEVEL">Select a level</label>\n                      <md-select placeholder="{{ \'TOOLS.SELECT_LEVEL\' | translate }}" ng-model="vm_dc.query.level" ng-change="vm_dc.getDispositions()">\n                        <md-option ng-value="null"><em translate="TOOLS.ALL">All</em></md-option>\n                        <md-option ng-value="key" ng-repeat="(key, value) in vm_dc.levels">{{ value }}</md-option>\n                      </md-select>\n                    </md-input-container>\n                  </md-card-content>\n                </md-card>\n              </div>\n              <div class="whatsappAccount-detail-form-container whatsappdispositions md-background-bg md-whiteframe-1dp" flex="80">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead" translate="WHATSAPP.DISPOSITIONS">Dispositions</span>\n                    <ms-search-bar on-search="vm_dc.query.filter = query" on-collapse="vm_dc.query.filter = undefined" debounce="300" direction="down"></ms-search-bar>\n                    <div flex></div>\n                    <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditDisposition($event)" aria-label="Add whatsapp dispositions" translate translate-attr-label="WHATSAPP.ADD_DISPOSITION">\n                      <md-icon md-font-icon="icon-plus"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedDispositions.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_dc.selectedDispositions.length}}\n                      {{vm_dc.selectedDispositions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <button class="md-icon-button" ng-csv="vm_dc.exportSelectedDispositions" csv-label="true" filename="whatsappAccounts.csv">\n                      <md-icon md-font-icon="icon-file-excel"></md-icon>\n                    </button>\n                    <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedDispositions($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_dc.selectedDispositions" md-progress="vm_dc.promise">\n                    <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getDispositions">\n                      <tr md-row>\n                        <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                        <th md-column md-order-by="level">{{ \'TOOLS.LEVEL\' | translate }}</th>\n                        <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                        <th md-column md-order-by="description">{{ \'WHATSAPP.DESCRIPTION\' | translate }}\n                        </th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body>\n                      <tr md-row ng-hide="vm_dc.dispositions.rows.length">\n                        <td md-cell colspan="5">\n                          <div layout="row" layout-align="center center">\n                            <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                          </div>\n                        </td>\n                      </tr>\n                      <tr md-row md-select="disposition" md-select-id="id" ng-repeat="disposition in vm_dc.dispositions.rows">\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="id ">{{disposition.id}}\n                        </td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="level ">\n                          {{ vm_dc.levels[disposition.level] }}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="name ">\n                          {{disposition.name}}</td>\n                        <td ng-click="vm_dc.createOrEditDisposition($event, disposition)" md-cell class="description ">\n                          {{disposition.description}}</td>\n                        <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n                            <md-menu-content width="3">\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                                <md-button ng-click="vm_dc.createOrEditDisposition($event, disposition)" translate="TOOLS.EDIT_DISPOSITION">\n                                  Edit Disposition\n                                </md-button>\n                              </md-menu-item>\n                              \x3c!-- SUBACTIONS --\x3e\n                              \x3c!-- ACTIONS --\x3e\n                              <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                                <md-button ng-click="vm_dc.deleteConfirm(disposition, $event)" translate="TOOLS.DELETE_DISPOSITION">\n                                  Delete Disposition\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.dispositions.count}}" md-on-paginate="vm_dc.getDispositions" md-page-select>\n                </md-table-pagination>\n              </div>\n            </div>\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.CANNEDANSWERS">CANNEDANSWERS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container whatsappcannedanswers md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountWhatsappCannedAnswersController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="WHATSAPP.WHATSAPPCANNEDANSWERS">WhatsappCannedAnswers</span>\n                  <ms-search-bar on-search="vm_dc.getWhatsappAccountWhatsappCannedAnswers()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <md-button ng-if="vm_dc.crudPermissions.canEdit" class="md-icon-button" ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event)" aria-label="add whatsappCannedAnswer" translate translate-attr-label="WHATSAPP.ADD_WHATSAPPCANNEDANSWER">\n                    <md-icon md-font-icon="icon-plus"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length}} {{vm_dc.selectedWhatsappAccountWhatsappCannedAnswers.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedWhatsappAccountWhatsappCannedAnswers" csv-label="true" filename="whatsappAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedWhatsappAccountWhatsappCannedAnswers($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedWhatsappAccountWhatsappCannedAnswers" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getWhatsappAccountWhatsappCannedAnswers">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'WHATSAPP.ID\' | translate }}\n                      </th>\n                      <th md-column md-order-by="key">\n                        {{ \'WHATSAPP.KEY\' | translate }}\n                      </th>\n                      <th md-column md-order-by="value">\n                        {{ \'WHATSAPP.VALUE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="description">\n                        {{ \'WHATSAPP.DESCRIPTION\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'WHATSAPP.CREATED_AT\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="whatsappCannedAnswer" md-select-id="id" ng-repeat="whatsappCannedAnswer in vm_dc.whatsappAccountWhatsappCannedAnswers.rows">\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.id}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.key}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.value}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{whatsappCannedAnswer.description}}\n                      </td>\n                      <td ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" md-cell>\n                        {{ whatsappCannedAnswer.createdAt | formatdate }}\n                      </td>\n                      <td md-cell class="actions" ng-if="!vm_dc.crudPermissions.readOnly">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canEdit">\n                              <md-button ng-click="vm_dc.createOrEditWhatsappAccountWhatsappCannedAnswer($event, whatsappCannedAnswer)" translate="WHATSAPP.EDIT_WHATSAPPCANNEDANSWER">\n                                Edit WhatsappCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(whatsappCannedAnswer, $event)" translate="WHATSAPP.DELETE_WHATSAPPCANNEDANSWER">\n                                Delete WhatsappCannedAnswer\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.whatsappAccountWhatsappCannedAnswers.rows.length">\n                      <td md-cell colspan="7">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="WHATSAPP.NO_WHATSAPPCANNEDANSWER_AVAILABLE">No whatsappcannedanswer available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.whatsappAccountWhatsappCannedAnswers.count}}" md-on-paginate="vm_dc.getWhatsappAccountWhatsappCannedAnswers" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.ACTIONS">ACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container actions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountActionsController as vm_ac" ng-init="vm_ac.init(vm.whatsappAccount, vm.crudPermissions)" class="content" md-background-bg layout="row" layout-align="start start">\n              \x3c!-- SIDENAV --\x3e\n              <div class="navigation-simple sidenav main-sidenav md-background-bg md-whiteframe-1dp" layout="column" flex="20" ng-if="vm_ac.crudPermissions.canEdit">\n                \x3c!-- SIDENAV CONTENT --\x3e\n                <md-list class="no-padding">\n                  <md-subheader class="md-no-sticky">\n                    <span translate="VOICE.APPLICATIONS_LIST">\n                      Applications List\n                    </span>\n                  </md-subheader>\n                </md-list>\n                <md-divider></md-divider>\n                <md-list ng-sortable="vm_ac.list">\n                  <md-list-item class="handle" ng-repeat="a in vm_ac.apps">\n                    <md-icon md-font-icon="{{a.icon}}" class="s16"></md-icon>\n                    <p class="text-truncate" translate="WHATSAPP.{{(a.appAlias || a.appType) | uppercase}}">{{a.appAlias || a.appType}}</p>\n                  </md-list-item>\n                </md-list>\n                \x3c!-- / SIDENAV CONTENT --\x3e\n              </div>\n              \x3c!-- / SIDENAV --\x3e\n              <div flex></div>\n              \x3c!-- MAIN --\x3e\n              <div class="main scrollable md-background-bg md-whiteframe-1dp" layout="column" flex="{{vm_ac.crudPermissions.canEdit ? 75 : 100}}">\n                <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_ac.selectedWhatsappAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">Drag & Drop Routing</span>\n                    <div flex></div>\n                    <ms-search-bar on-search="vm_ac.query.filter = query" on-collapse="vm_ac.query.filter = undefined" debounce="300"></ms-search-bar>\n                  </div>\n                </md-toolbar>\n                <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_ac.selectedWhatsappAccountApps.length">\n                  <div class="md-toolbar-tools">\n                    <span class="md-subhead">{{vm_ac.selectedWhatsappAccountApps.length}} {{vm_ac.selectedWhatsappAccountApps.length > 1 ? \'items\' : \'item\'}} selected</span>\n                    <div flex></div>\n                    <md-button ng-if="vm_ac.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_ac.deleteSelectedWhatsappAccountApps($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                      <md-icon md-font-icon="icon-delete"></md-icon>\n                    </md-button>\n                  </div>\n                </md-toolbar>\n\n                \x3c!-- QUEUES TABLE --\x3e\n                <md-table-container>\n                  <table md-table md-row-select multiple ng-model="vm_ac.selectedWhatsappAccountApps">\n                    <thead md-head>\n                      <tr md-row>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px">\n                          <span translate="VOICE.PRIORITY">Priority</span>\n                        </th>\n                        <th md-column>\n                          <span>Type</span>\n                        </th>\n                        <th md-column>\n                          <span>Appdata</span>\n                        </th>\n                        <th md-column>\n                          <span>Interval</span>\n                        </th>\n                        <th md-column width="10px"></th>\n                        <th md-column width="10px"></th>\n                      </tr>\n                    </thead>\n                    <tbody md-body ng-sortable="vm_ac.applications">\n                      <tr md-row md-select="app" md-select-id="id" ng-repeat="app in vm_ac.whatsappAccountApps.rows | filter: vm_ac.query.filter">\n                        <td md-cell>\n                          <md-icon md-font-icon="icon-drag-vertical" class="s16 handle"></md-icon>\n                        </td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)"><span>{{app.priority}}</span></td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)">{{app.app.toLowerCase() === \'agi\' ? \'Cally-Square\' : app.app | ucfirst}}<span ng-if="app.appType.toLowerCase() === \'custom\'">*</span></td>\n                        <td md-cell ng-click="vm_ac.editWhatsappAccountApp($event, $index)"><span class="text-truncate actionAppData">{{app.appdata}}</span></td>\n                        <td md-cell ng-click="vm_ac.editInterval($event, $index)">{{app.IntervalId ? \'From List\' : app.interval}}</td>\n                        <td md-cell>\n                          <md-button ng-click="vm_ac.editInterval($event, $index)" class="md-icon-button" aria-label="Interval">\n                            <md-icon md-font-icon="icon-timer"></md-icon>\n                            <md-tooltip>\n                              {{app.IntervalId ? \'From List\' : (app.interval === \'*,*,*,*\' ? \'Always\' : \'Custom\')}}\n                            </md-tooltip>\n                          </md-button>\n                        </td>\n                        <td md-cell class="actions" ng-if="!vm_ac.crudPermissions.readOnly">\n                          <md-menu>\n                            <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="VOICE.MORE" ng-click="$mdOpenMenu($event)">\n                              <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                            </md-button>\n\n                            <md-menu-content width="3">\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editWhatsappAccountApp($event, $index)" translate="VOICE.EDIT_APP">\n                                  Edit App\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canEdit">\n                                <md-button ng-click="vm_ac.editInterval($event, $index)" translate="VOICE.EDIT_INTERVAL">\n                                  Edit Interval\n                                </md-button>\n                              </md-menu-item>\n                              <md-menu-item ng-if="vm_ac.crudPermissions.canDelete">\n                                <md-button ng-click="vm_ac.deleteConfirm(app, $index, $event)" translate="VOICE.DELETE_APP">\n                                  Delete App\n                                </md-button>\n                              </md-menu-item>\n                            </md-menu-content>\n                          </md-menu>\n                        </td>\n                      </tr>\n                      <tr md-row ng-hide="vm_ac.whatsappAccountApps.rows.length">\n                        <td md-cell colspan="7">\n                          <span class="text-boxed-light" translate="VOICE.NO_APPS_AVAILABLE">No apps available</span>\n                        </td>\n                      </tr>\n                    </tbody>\n                  </table>\n                </md-table-container>\n                \x3c!-- / QUEUES TABLE --\x3e\n\n                \x3c!-- NO RESULTS --\x3e\n\n                \x3c!-- / NO RESULTS --\x3e\n              </div>\n              \x3c!-- / MAIN --\x3e\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.INTERACTIONS">INTERACTIONS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappAccount-detail-form-container interactions md-background-bg md-whiteframe-1dp">\n            <div ng-controller="WhatsappAccountInteractionsController as vm_dc" ng-init="vm_dc.init(vm.whatsappAccount, vm.crudPermissions, vm.userProfile)">\n              <md-toolbar class="md-table-toolbar md-default" ng-hide="vm_dc.selectedWhatsappAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead" translate="WHATSAPP.INTERACTIONS">Interactions</span>\n                  <ms-search-bar on-search="vm_dc.getWhatsappAccountInteractions()" query="vm_dc.query" display-on="vm_dc.isSearchBarVisible" ng-disabled="vm_dc.query.search" debounce="300" direction="down" min-chars="5"></ms-search-bar>\n                  <div flex></div>\n                  <ms-quick-filter filters="vm_dc.quickFilters" query="vm_dc.query" search="vm_dc.getWhatsappAccountInteractions()"></ms-quick-filter>\n                  <div layout="column">\n                    <md-button class="md-icon-button advanced-search" ng-class="{ \'md-fab md-mini md-accent-bg\': vm_dc.query.search }" aria-label="Filter" translate translate-attr-aria-label="DASHBOARDS.FILTER" ng-click="vm_dc.openAdvancedSearch()">\n                      <md-icon md-font-icon="{{ vm_dc.query.search ? \'icon-filter\' : \'icon-filter-outline\' }}" ng-class="{ \'blink\': vm_dc.query.search }"></md-icon>\n                    </md-button>\n                  </div>\n                  <md-button class="md-icon-button" ng-click="vm_dc.getWhatsappAccountInteractions()" aria-label="refresh Interactions" translate translate-attr-label="WHATSAPP.REFRESH_INTERACTIONS">\n                    <md-icon md-font-icon="icon-refresh"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-toolbar class="md-table-toolbar md-accent" ng-show="vm_dc.selectedWhatsappAccountInteractions.length">\n                <div class="md-toolbar-tools">\n                  <span class="md-subhead">{{vm_dc.selectedWhatsappAccountInteractions.length}} {{vm_dc.selectedWhatsappAccountInteractions.length > 1 ? \'items\' : \'item\'}} selected</span>\n                  <div flex></div>\n                  <button class="md-icon-button" ng-csv="vm_dc.exportSelectedWhatsappAccountInteractions" csv-label="true" filename="whatsappAccounts.csv">\n                    <md-icon md-font-icon="icon-file-excel"></md-icon>\n                  </button>\n                  <md-button ng-if="vm_dc.crudPermissions.canDelete" class="md-icon-button" ng-click="vm_dc.deleteSelectedWhatsappAccountInteractions($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n                    <md-icon md-font-icon="icon-delete"></md-icon>\n                  </md-button>\n                </div>\n              </md-toolbar>\n              <md-table-container class="font-size-12">\n                <table md-table md-row-select multiple ng-model="vm_dc.selectedWhatsappAccountInteractions" md-progress="vm_dc.promise">\n                  <thead md-head md-order="vm_dc.query.sort" md-on-reorder="vm_dc.getWhatsappAccountInteractions">\n                    <tr md-row>\n                      <th md-column md-order-by="id">\n                        {{ \'WHATSAPP.ID\' | translate }}\n                      </th>\n                      <th md-column class="no-padding">\n                        <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column class="no-padding">\n                      </th>\n                      <th md-column md-order-by="contactName">\n                        {{ \'WHATSAPP.CONTACT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="createdAt">\n                        {{ \'WHATSAPP.STARTEDAT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="lastMsgAt">\n                        {{ \'WHATSAPP.LASTMESSAGE\' | translate }}\n                      </th>\n                      <th md-column md-order-by="closed">\n                        {{ \'WHATSAPP.STATUS\' | translate }}\n                      </th>\n                      <th md-column>\n                        {{ \'WHATSAPP.AGENT\' | translate }}\n                      </th>\n                      <th md-column md-order-by="tag">\n                        {{ \'WHATSAPP.TAGS\' | translate }}\n                      </th>\n                      <th md-column width="10px"></th>\n                    </tr>\n                  </thead>\n                  <tbody md-body>\n                    <tr md-row md-select="interaction" md-select-id="id" ng-repeat="interaction in vm_dc.whatsappAccountInteractions.rows" ng-class="{\'text-bold text-italic\': interaction.unreadMessages > 0}">\n                      <td md-cell>\n                        {{interaction.id}}\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="!interaction.closed && interaction.Users.length">\n                          <md-icon md-font-icon="icon-eye" class="s16"></md-icon>\n                          <md-tooltip>\n                            <span ng-repeat="user in interaction.Users">{{ user.fullname | translate }}\n                              <span ng-if="!$last">, </span>\n                            </span>\n                          </md-tooltip>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.unreadMessages > 0" layout="row" layout-align="start center">\n                          <span class="badge white-fg md-primary-bg" layout-margin>{{ interaction.unreadMessages}}</span>\n                        </div>\n                      </td>\n                      <td md-cell class="no-padding">\n                        <div ng-if="interaction.attach">\n                          <md-icon md-font-icon="icon-paperclip" class="s16"></md-icon>\n                        </div>\n                      </td>\n                      <td md-cell privacy ng-cloak>\n                        <div layout="column" layout-align="start start">\n                          <span class="font-size-12 text-truncate contact-text" ng-class="{\'margin-bottom-0\' : interaction.contactInfo}" layout-margin>{{ interaction.contactName }}</span>\n                          <span ng-if="interaction.contactInfo" class="font-size-12 text-truncate contact-text margin-top-0" layout-margin>{{ interaction.contactInfo }}</span>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        {{ interaction.createdAt | formatdate }}\n                      </td>\n                      <td md-cell>\n                        <div layout="row">\n                          <span>\n                            <md-icon md-font-icon="{{interaction.lastMsgDirection == \'in\' ? \'icon-arrow-down-bold blue-grey-800-fg\' : \'icon-arrow-up-bold blue-grey-300-fg\'}}"></md-icon>\n                          </span>\n                          <div layout="column" layout-align="center center">\n                            <span class="text-truncate">{{ interaction.lastMsgAt | formatdate }}</span>\n                          </div>\n                        </div>\n                      </td>\n                      <td md-cell>\n                        <span ng-if="interaction.closed === 0" class="green-fg">\n                          {{ \'WHATSAPP.OPENED\' | translate }}\n                          <span ng-if="interaction.substatus">\n                            - {{ interaction.substatus }}\n                          </span>\n                        </span>\n                        <span ng-if="interaction.closed === 1" class="red-fg">\n                          {{ \'WHATSAPP.CLOSED\' | translate }}\n                          <span ng-if="interaction.disposition">\n                            - {{ interaction.thirdDisposition || interaction.secondDisposition || interaction.disposition }}\n                          </span>\n                          <md-tooltip class="multiline">\n                            <div layout="column">\n                              <div layout="column">\n                                <span>{{ \'DASHBOARDS.CLOSED_AT\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.closedAt | formatdate }}</span>\n                              </div>\n                              <div ng-if="interaction.disposition" layout="column">\n                                <span>{{ \'DASHBOARDS.DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.disposition }}</span>\n                              </div>\n                              <div ng-if="interaction.secondDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.SECOND_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.secondDisposition }}</span>\n                              </div>\n                              <div ng-if="interaction.thirdDisposition" layout="column">\n                                <span>{{ \'DASHBOARDS.THIRD_LEVEL_DISPOSITION\' | translate}}:</span>\n                                <span class="text-bold">{{ interaction.thirdDisposition }}</span>\n                              </div>\n                            </div>\n                          </md-tooltip>\n                        </span>\n                      </td>\n\n                      <td md-cell>\n                        {{interaction.Owner.name}}\n                      </td>\n                      <td md-cell>\n                        <div ng-if="interaction.Tags.length">\n                          <md-tooltip md-direction="left" layout="row">\n                            <span ng-repeat="tag in interaction.Tags">{{tag.name}}<span ng-if="!$last">, </span></span>\n                          </md-tooltip>\n                          <md-icon md-font-icon="icon-tag" ng-style="{\'color\': interaction.Tags.length == 1 && interaction.Tags[0].color }">\n                          </md-icon>\n                        </div>\n                      </td>\n                      <td md-cell class="actions">\n                        <md-menu>\n                          <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                            <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                          </md-button>\n\n                          <md-menu-content width="3">\n                            <md-menu-item>\n                              <md-button ng-click="vm_dc.spywhatsappInteraction($event, interaction)" translate="WHATSAPP.SPYINTERACTION">\n                                Spy Interaction\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.currentUser.role === \'admin\' || vm_dc.userProfile.downloadOmnichannelInteractions">\n                              <md-button class="md-primary" ng-click="vm_dc.whatsappInteractionDownload(interaction, $event)" translate="WHATSAPP.DOWNLOAD_INTERACTION">\n                                Download\n                              </md-button>\n                            </md-menu-item>\n                            <md-menu-item ng-if="vm_dc.crudPermissions.canDelete">\n                              <md-button ng-click="vm_dc.deleteConfirm(interaction, $event)" translate="WHATSAPP.DELETE_INTERACTION">\n                                Delete Interaction\n                              </md-button>\n                            </md-menu-item>\n                          </md-menu-content>\n                        </md-menu>\n                      </td>\n                    </tr>\n                    <tr md-row ng-if="!vm_dc.whatsappAccountInteractions.rows.length">\n                      <td md-cell colspan="12">\n                        <div layout="row" layout-align="center center">\n                          <span class="text-boxed-light" translate="WHATSAPP.NO_INTERACTION_AVAILABLE">No interaction available</span>\n                        </div>\n                      </td>\n                    </tr>\n                  </tbody>\n                </table>\n              </md-table-container>\n              <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm_dc.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm_dc.query.page" md-total="{{vm_dc.whatsappAccountInteractions.count}}" md-on-paginate="vm_dc.getWhatsappAccountInteractions" md-page-select></md-table-pagination>\n            </div>\n\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/edit/whatsappCannedAnswers/dialog.html",'<md-dialog class="whatsappCannedAnswer-dialog" aria-label="New WhatsappCannedAnswer">\n  <form name="whatsappCannedAnswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.KEY">Key</label>\n        <input type="" name="key" ng-model="vm.whatsappCannedAnswer.key" md-maxlength="255" ng-required="true" autofocus>\n\n        <div ng-messages="whatsappCannedAnswerForm[\'key\'].$error" ng-show="whatsappCannedAnswerForm[\'key\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.KEY_REQUIRED">Key field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.VALUE">Value</label>\n        <textarea name="value" ng-model="vm.whatsappCannedAnswer.value" required></textarea>\n\n        <div ng-messages="whatsappCannedAnswerForm[\'value\'].$error" ng-show="whatsappCannedAnswerForm[\'value\'].$touched" role="alert">\n\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.VALUE_REQUIRED">Value field is required</span>\n          </div>\n\n\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappCannedAnswer.description">\n\n        <div ng-messages="whatsappCannedAnswerForm[\'description\'].$error" ng-show="whatsappCannedAnswerForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappCannedAnswer" ng-click="vm.saveWhatsappCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="whatsappCannedAnswerForm.$invalid || whatsappCannedAnswerForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappCannedAnswer" ng-click="vm.addNewWhatsappCannedAnswer()" class="send-button md-accent md-raised" ng-disabled="whatsappCannedAnswerForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPCANNEDANSWER" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPCANNEDANSWER">\n          ADD WHATSAPPCANNEDANSWER\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappCannedAnswer" ng-click="vm.deleteWhatsappCannedAnswer($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappAccounts/whatsappAccounts.html",'<div id="whatsappAccounts" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-whatsapp" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="WHATSAPP.WHATSAPPACCOUNTS">WhatsappAccounts</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="WHATSAPP.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedWhatsappAccounts.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedWhatsappAccounts =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="WHATSAPP.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-whatsappAccounts-count">\n          <span>{{vm.selectedWhatsappAccounts.length}}</span>\n          <span translate="WHATSAPP.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="WHATSAPP.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllWhatsappAccounts()" translate="WHATSAPP.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectWhatsappAccounts()" translate="WHATSAPP.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedWhatsappAccounts" csv-label="true" filename="whatsappAccounts.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedWhatsappAccounts($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- WHATSAPPACCOUNT TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedWhatsappAccounts" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappAccounts">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                <th md-column md-order-by="key">{{ \'WHATSAPP.KEY\' | translate }}</th>\n                <th md-column md-order-by="ListId">{{ \'WHATSAPP.LIST\' | translate }}</th>\n                <th md-column md-order-by="type">{{ \'WHATSAPP.TYPE\' | translate }}</th>\n                <th md-column md-order-by="phone">{{ \'WHATSAPP.PHONE\' | translate }}</th>\n                <th md-column md-order-by="description">{{ \'WHATSAPP.DESCRIPTION\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.whatsappAccounts.rows.length">\n                <td md-cell colspan="8">\n                  <div layout="row" layout-align="center center">\n                    <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="whatsappAccount" md-select-id="id" ng-repeat="whatsappAccount in vm.whatsappAccounts.rows">\n                <td md-cell ng-if="whatsappAccount.userpic"><img class="avatar" alt="{{whatsappAccount.name}}" ng-src="api/users/{{whatsappAccount.id}}/avatar" /></td>\n                <td md-cell ng-if="!whatsappAccount.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{whatsappAccount.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="id ">{{whatsappAccount.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="name ">{{whatsappAccount.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="key ">{{whatsappAccount.key}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="ListId ">{{ (vm.lists | filter : {\'id\':whatsappAccount.ListId} : true)[0].name }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="type ">{{ vm.arraytype[whatsappAccount.type].option }}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="phone ">{{whatsappAccount.phone}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappAccount, ev) : vm.createOrEditWhatsappAccount($event, whatsappAccount)" md-cell class="description ">{{whatsappAccount.description}}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(whatsappAccount, $event    )" translate="WHATSAPP.EDIT_WHATSAPPACCOUNT">\n                          Edit WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.interactionsgoto(whatsappAccount, $event    )" translate="WHATSAPP.INTERACTIONS_WHATSAPPACCOUNT">\n                          Interactions WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(whatsappAccount, $event    )" translate="WHATSAPP.AGENTADD_WHATSAPPACCOUNT">\n                          AgentAdd WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(whatsappAccount, $event    )" translate="WHATSAPP.DELETE_WHATSAPPACCOUNT">\n                          Delete WhatsappAccount\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappAccounts.count}}" md-on-paginate="vm.getWhatsappAccounts" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / WHATSAPPACCOUNT TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD WHATSAPPACCOUNT BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-whatsappAccount-button" ng-click="vm.createOrEditWhatsappAccount($event)" aria-label="add whatsappAccount" translate translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPACCOUNT">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD WHATSAPPACCOUNT BUTTON --\x3e\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/create/dialog.html",'<md-dialog class="whatsappQueue-dialog" aria-label="New WhatsappQueue">\n  <form name="whatsappQueueForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.whatsappQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus ng-disabled="!vm.newWhatsappQueue">\n\n        <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n        <div ng-messages="whatsappQueueForm[\'name\'].$error" ng-show="whatsappQueueForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="WHATSAPP.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.STRATEGY">Strategy</label>\n        <md-select name="strategy" ng-model="vm.whatsappQueue.strategy" required>\n          <md-option ng-value="\'beepall\'">Beepall</md-option>\n          <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n        </md-select>\n        <div ng-messages="whatsappQueueForm[\'strategy\'].$error" ng-show="whatsappQueueForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.AGENT_TIMEOUT">Agent_Timeout</label>\n        <input type="number" name="timeout" ng-model="vm.whatsappQueue.timeout" min="1" max="2147483" value="10" ng-required="true">\n\n        <div ng-messages="whatsappQueueForm[\'timeout\'].$error" ng-show="whatsappQueueForm[\'timeout\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n          </div>\n          <div ng-message="min">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n          </div>\n          <div ng-message="max">\n            <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="WHATSAPP.DESCRIPTION">Description</label>\n        <input type="text" name="description" ng-model="vm.whatsappQueue.description">\n\n        <div ng-messages="whatsappQueueForm[\'description\'].$error" ng-show="whatsappQueueForm[\'description\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center" ng-if="!vm.crudPermissions.readOnly">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && !vm.newWhatsappQueue" ng-click="vm.saveWhatsappQueue()" class="send-button md-accent md-raised" ng-disabled="whatsappQueueForm.$invalid || whatsappQueueForm.$pristine" aria-label="SAVE" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n          SAVE\n        </md-button>\n\n        <md-button type="submit" ng-if="vm.crudPermissions.canEdit && vm.newWhatsappQueue" ng-click="vm.addNewWhatsappQueue()" class="send-button md-accent md-raised" ng-disabled="whatsappQueueForm.$invalid" aria-label="ADD" translate="WHATSAPP.ADD_WHATSAPPQUEUE" translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPQUEUE">\n          ADD WHATSAPPQUEUE\n        </md-button>\n      </div>\n      <div layout="row">\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete && !vm.newWhatsappQueue" ng-click="vm.deleteWhatsappQueue($event)" aria-label="DELETE" translate translate-attr-aria-label="WHATSAPP.DELETE">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n          <md-tooltip><span translate="WHATSAPP.DELETE">DELETE</span></md-tooltip>\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/agentadd/agentadd.html",'<md-dialog class="whatsappQueue-dialog" aria-label="whatsappQueue" ng-init="vm.onInit()">\n  <form name="whatsappQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE">Add Agent to whatsappQueue</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveAgents()" class="send-button md-accent md-raised" ng-disabled="!vm.pendingChanges" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/teamadd/teamadd.html",'<md-dialog class="whatsappQueue-dialog" aria-label="whatsappQueue" ng-init="vm.onInit()">\n  <form name="whatsappQueueForm" ng-cloak>\n    <md-toolbar>\n      <div class="md-toolbar-tools">\n        <h2 translate="WHATSAPP.TEAMS_ASSOCIATION">Teams Association</h2>\n        <span flex></span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <ms-dual-multiselect options="vm.dualMultiselectOptions" read-only="!vm.crudPermissions.canEdit"></ms-dual-multiselect>\n    </md-dialog-content>\n    <md-dialog-actions layout="row" layout-align="end center" ng-if="vm.crudPermissions.canEdit">\n      <span></span>\n      <md-button layout-align="end center" type="submit" ng-click="vm.saveTeams()" ng-disabled="!vm.pendingChanges" class="send-button md-accent md-raised" aria-label="SAVE" translate="STAFF.SAVE" translate-attr-aria-label="STAFF.SAVE">\n        SAVE\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/edit/view.html",'<div id="whatsapp-whatsappQueue" class="page-layout simple tabbed" layout="column">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="start center">\n    <div class="white-fg" layout="row" layout-align="start center" flex>\n      <md-button class="goto-whatsappQueues-button md-icon-button" aria-label="Go to whatsappQueues" ng-click="vm.gotoWhatsappQueues()" translate translate-attr-aria-label="WHATSAPP.GO_TO_WHATSAPPQUEUES">\n        <md-icon md-font-icon="icon-arrow-left"></md-icon>\n      </md-button>\n\n      <div layout="row" layout-align="start center">\n\n        <div class="whatsappQueue-image" hide-xs>\n          <img ng-src="assets/images/business/whatsappQueues.jpg">\n        </div>\n\n        <div layout="column" layout-align="start start">\n          <div class="h2">\n            #{{vm.whatsappQueue.id}}\n            <span ng-if="vm.whatsappQueue.name">{{vm.whatsappQueue.name}}</span>\n          </div>\n          <div class="subtitle secondary-text">\n            <span translate="WHATSAPP.CREATED_AT"></span> <span>{{vm.whatsappQueue.createdAt | date:\'medium\'}}</span>\n          </div>\n        </div>\n      </div>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.teamadddialog(vm.whatsappQueue, $event)" class="md-fab md-orange-500-bg md-icon-button" aria-label="teamadd">\n        <md-tooltip><span translate="WHATSAPP.TEAMADD_WHATSAPPQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-multiple-plus"></md-icon>\n      </md-button>\n    </div>\n\n    <div ng-cloak>\n      <md-button ng-click="vm.agentadddialog(vm.whatsappQueue, $event)" class="md-fab md-purple-500-bg md-icon-button" aria-label="agentadd">\n        <md-tooltip><span translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE"></span></md-tooltip>\n        <md-icon md-font-icon="icon-account-plus"></md-icon>\n      </md-button>\n    </div>\n    <div>\n      <md-button type="submit" ng-click="vm.saveWhatsappQueue()" ng-if="vm.crudPermissions.canEdit" class="send-button md-accent md-raised" ng-disabled="(generalForm.$invalid)" translate="WHATSAPP.SAVE" translate-attr-aria-label="WHATSAPP.SAVE">\n        SAVE\n      </md-button>\n    </div>\n\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content">\n\n    <md-tabs md-selected="vm.selectedTab" md-stretch-tabs="always" flex layout-fill md-dynamic-height>\n      <md-tab>\n        <md-tab-label>\n          <span translate="WHATSAPP.SETTINGS">SETTINGS</span>\n        </md-tab-label>\n        <md-tab-body>\n          <div class="whatsappQueue-detail-form-container general md-background-bg md-whiteframe-1dp">\n            <div class="pb-16" layout="row" layout-align="start center">\n              <div class="h2 secondary-text" translate="WHATSAPP.GENERAL">GENERAL</div>\n            </div>\n            <form name="generalForm" novalidate>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.NAME">Name</label>\n                <input type="text" name="name" ng-model="vm.whatsappQueue.name" ng-pattern="/^[A-Za-z0-9\\.\\_]+$/i" ng-required="true" autofocus disabled>\n\n                <div class="hint"><span translate="WHATSAPP.HELP.NAME"></span></div>\n                <div ng-messages="generalForm[\'name\'].$error" ng-show="generalForm[\'name\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.NAME_REQUIRED">Name field is required</span>\n                  </div>\n                  <div ng-message="pattern">\n                    <span translate="WHATSAPP.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.STRATEGY">Strategy</label>\n                <md-select name="strategy" ng-model="vm.whatsappQueue.strategy" required ng-disabled="!vm.crudPermissions.canEdit">\n                  <md-option ng-value="\'beepall\'">Beepall</md-option>\n                  <md-option ng-value="\'rrmemory\'">RR Memory</md-option>\n                </md-select>\n                <div ng-messages="generalForm[\'strategy\'].$error" ng-show="generalForm[\'strategy\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.STRATEGY_REQUIRED">Strategy field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.AGENT_TIMEOUT">Agent_Timeout</label>\n                <input type="number" name="timeout" ng-model="vm.whatsappQueue.timeout" min="1" max="2147483" value="10" ng-required="true" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'timeout\'].$error" ng-show="generalForm[\'timeout\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_REQUIRED">Agent_Timeout field is required</span>\n                  </div>\n                  <div ng-message="min">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_GREATER_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>1</span>\n                  </div>\n                  <div ng-message="max">\n                    <span translate="WHATSAPP.ERRORS.AGENT_TIMEOUT_MUST_BE_LESS_THAN_OR_EQUAL_TO">Agent_Timeout must be a valid greater or equal than</span> <span>2147483</span>\n                  </div>\n                </div>\n              </md-input-container>\n              <md-input-container class="md-block">\n                <label translate="WHATSAPP.DESCRIPTION">Description</label>\n                <input type="text" name="description" ng-model="vm.whatsappQueue.description" ng-disabled="!vm.crudPermissions.canEdit">\n\n                <div ng-messages="generalForm[\'description\'].$error" ng-show="generalForm[\'description\'].$touched" role="alert">\n                  <div ng-message="required">\n                    <span translate="WHATSAPP.ERRORS.DESCRIPTION_REQUIRED">Description field is required</span>\n                  </div>\n                </div>\n              </md-input-container>\n\n            </form>\n          </div>\n        </md-tab-body>\n      </md-tab>\n    </md-tabs>\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n</div>'),e.put("app/main/apps/whatsapp/views/whatsappQueues/whatsappQueues.html",'<div id="whatsappQueues" class="page-layout simple left-sidenav inner-sidenav">\n\n  \x3c!-- HEADER --\x3e\n  <div class="header md-accent-bg" layout="row" layout-align="space-between center">\n\n    \x3c!-- APP TITLE --\x3e\n    <div layout="row" layout-align="start center">\n      <div class="logo" layout="row" layout-align="start center">\n        <span class="logo-icon">\n          <md-icon md-font-icon="icon-whatsapp" class="s24"></md-icon>\n        </span>\n        <span class="logo-text" translate="WHATSAPP.WHATSAPPQUEUES">WhatsappQueues</span>\n      </div>\n    </div>\n    \x3c!-- / APP TITLE --\x3e\n\n    <div layout="row">\n      \x3c!-- SEARCH --\x3e\n      <div class="search-input-wrapper" layout="row" layout-align="start center">\n        <label for="search">\n          <md-icon md-font-icon="icon-magnify"></md-icon>\n        </label>\n        <md-input-container md-no-float class="m-0">\n          <input id="search" placeholder="Search for anyone" type="text" ng-model="vm.query.filter" ng-model-options="{ debounce: 1000 }" translate translate-attr-placeholder="WHATSAPP.SEARCH_FOR_ANYONE">\n        </md-input-container>\n      </div>\n      \x3c!-- / SEARCH --\x3e\n    </div>\n  </div>\n  \x3c!-- / HEADER --\x3e\n\n  \x3c!-- SELECTED BAR --\x3e\n  <div ng-show="vm.selectedWhatsappQueues.length > 0" class="selected-bar header md-accent-bg" layout="row" layout-align="start center">\n\n    <div class="close-button-wrapper" ng-click="vm.selectedWhatsappQueues =[]">\n      <md-button layout="row" layout-align="start center">\n        <md-icon md-font-icon="icon-arrow-left" class="mr-8"></md-icon>\n        <span translate="WHATSAPP.BACK">Back</span>\n      </md-button>\n    </div>\n\n    <div flex layout="row" layout-align="space-between center">\n\n      <div>\n        <span class="selected-whatsappQueues-count">\n          <span>{{vm.selectedWhatsappQueues.length}}</span>\n          <span translate="WHATSAPP.SELECTED">selected</span>\n        </span>\n\n        <md-menu class="select-menu" ng-if="!vm.currentThread">\n          <md-button class="md-icon-button" ng-click="$mdOpenMenu($event)" aria-label="multi select toggle" translate translate-attr-aria-label="WHATSAPP.MULTI_SELECT_TOGGLE">\n            <md-icon md-font-icon="icon-menu-down"></md-icon>\n          </md-button>\n          <md-menu-content width="3">\n            <md-menu-item>\n              <md-button ng-click="vm.selectAllWhatsappQueues()" translate="WHATSAPP.SELECT_ALL">\n                Select all\n              </md-button>\n            </md-menu-item>\n            <md-menu-item>\n              <md-button ng-click="vm.deselectWhatsappQueues()" translate="WHATSAPP.SELECT_NONE">\n                Select none\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n\n      <div class="multi-select-actions">\n        <button class="md-icon-button" ng-csv="vm.exportSelectedWhatsappQueues" csv-label="true" filename="whatsappQueues.csv">\n          <md-icon md-font-icon="icon-file-excel"></md-icon>\n        </button>\n        <md-button class="md-icon-button" ng-if="vm.crudPermissions.canDelete" ng-click="vm.deleteSelectedWhatsappQueues($event)" aria-label="delete selected" translate translate-attr-label="WHATSAPP.DELETE_SELECTED">\n          <md-icon md-font-icon="icon-delete"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </div>\n  \x3c!-- / SELECTED BAR --\x3e\n\n  \x3c!-- CONTENT --\x3e\n  <div class="content" md-background-bg layout="row" layout-align="start start">\n\n    \x3c!-- MAIN --\x3e\n    <div class="main scrollable">\n\n\n      \x3c!-- WHATSAPPQUEUE TABLE --\x3e\n      <md-card>\n        <md-table-container>\n          <table md-table md-row-select multiple ng-model="vm.selectedWhatsappQueues" md-progress="vm.promise">\n            <thead md-head md-order="vm.query.sort" md-on-reorder="vm.getWhatsappQueues">\n              <tr md-row>\n                <th md-column ng-if="vm.table == \'users\' || vm.table == \'agents\'" width="20px"></th>\n                <th md-column md-order-by="id">{{ \'WHATSAPP.ID\' | translate }}</th>\n                <th md-column md-order-by="name">{{ \'WHATSAPP.NAME\' | translate }}</th>\n                <th md-column md-order-by="strategy">{{ \'WHATSAPP.STRATEGY\' | translate }}</th>\n                <th md-column width="10px"></th>\n              </tr>\n            </thead>\n            <tbody md-body>\n              <tr md-row ng-hide="vm.whatsappQueues.rows.length">\n                <td md-cell colspan="4">\n                  <div layout="row" layout-align="center center">\n                    <span translate="WHATSAPP.NO_AVAILABLE_INFO">No Available Info</span>\n                  </div>\n                </td>\n              </tr>\n              <tr md-row md-select="whatsappQueue" md-select-id="id" ng-repeat="whatsappQueue in vm.whatsappQueues.rows">\n                <td md-cell ng-if="whatsappQueue.userpic"><img class="avatar" alt="{{whatsappQueue.name}}" ng-src="api/users/{{whatsappQueue.id}}/avatar" /></td>\n                <td md-cell ng-if="!whatsappQueue.userpic && (vm.table == \'users\' || vm.table == \'agents\')"><img class="avatar" alt="{{whatsappQueue.name}}" ng-src="assets/images/avatars/profile.png" /></td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="id ">{{whatsappQueue.id}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="name ">{{whatsappQueue.name}}</td>\n                <td ng-click="vm.crudPermissions.readOnly || (vm.crudPermissions.canDelete && !vm.crudPermissions.canEdit) ? vm.editstate(whatsappQueue, ev) : vm.createOrEditWhatsappQueue($event, whatsappQueue)" md-cell class="strategy ">{{ vm.arraystrategy[whatsappQueue.strategy].option }}</td>\n\n\n                <td md-cell class="actions">\n\n                  <md-menu>\n\n                    <md-button class="md-icon-button" aria-label="More" translate translate-attr-aria-label="WHATSAPP.MORE" ng-click="$mdOpenMenu($event)">\n                      <md-icon md-font-icon="icon-dots-vertical"></md-icon>\n                    </md-button>\n\n                    <md-menu-content width="3">\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canEdit">\n\n                        <md-button ng-click="vm.editstate(whatsappQueue, $event    )" translate="WHATSAPP.EDIT_WHATSAPPQUEUE">\n                          Edit WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.teamadddialog(whatsappQueue, $event    )" translate="WHATSAPP.TEAMADD_WHATSAPPQUEUE">\n                          teamadd WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.agentadddialog(whatsappQueue, $event    )" translate="WHATSAPP.AGENTADD_WHATSAPPQUEUE">\n                          agentadd WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item ng-if="vm.crudPermissions.canDelete">\n\n                        <md-button ng-click="vm.deleteconfirm(whatsappQueue, $event    )" translate="WHATSAPP.DELETE_WHATSAPPQUEUE">\n                          Delete WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                      \x3c!-- SUBACTIONS --\x3e\n\n\n                      \x3c!-- ACTIONS --\x3e\n\n                      <md-menu-item>\n\n                        <md-button ng-click="vm.gotorealtimegoto(whatsappQueue, $event    )" translate="WHATSAPP.GOTOREALTIME_WHATSAPPQUEUE">\n                          goToRealtime WhatsappQueue\n                        </md-button>\n\n                      </md-menu-item>\n\n\n\n                    </md-menu-content>\n\n                  </md-menu>\n                </td>\n\n\n              </tr>\n            </tbody>\n          </table>\n        </md-table-container>\n\n        <md-table-pagination md-label="{page: \'{{\'WHATSAPP.PAGE\' | translate}}:\', rowsPerPage: \'{{\'WHATSAPP.ROWSPERPAGE\' | translate}}:\', of: \'{{\'WHATSAPP.OF\' | translate}}\'}" md-limit="vm.query.limit" md-limit-options="[10, 15, 20, 50, 100, 250]" md-page="vm.query.page" md-total="{{vm.whatsappQueues.count}}" md-on-paginate="vm.getWhatsappQueues" md-page-select></md-table-pagination>\n      </md-card>\n      \x3c!-- / WHATSAPPQUEUE TABLE --\x3e\n      \x3c!-- NO RESULTS --\x3e\n\n      \x3c!-- / NO RESULTS --\x3e\n    </div>\n    \x3c!-- / MAIN --\x3e\n\n  </div>\n  \x3c!-- / CONTENT --\x3e\n\n  \x3c!-- ADD WHATSAPPQUEUE BUTTON --\x3e\n  <md-button ng-if="vm.crudPermissions.canEdit" class="md-fab md-accent" id="add-whatsappQueue-button" ng-click="vm.createOrEditWhatsappQueue($event)" aria-label="add whatsappQueue" translate translate-attr-aria-label="WHATSAPP.ADD_WHATSAPPQUEUE">\n    <md-icon md-font-icon="icon-plus"></md-icon>\n  </md-button>\n  \x3c!-- / ADD WHATSAPPQUEUE BUTTON --\x3e\n</div>'),e.put("app/navigation/layouts/horizontal-navigation/navigation.html",'<div layout="row" layout-align="start center">\n  <ms-navigation-horizontal></ms-navigation-horizontal>\n</div>'),e.put("app/navigation/layouts/vertical-navigation-fullwidth-toolbar-2/navigation.html",'<ms-navigation class="scrollable" folded="vm.folded"></ms-navigation>'),e.put("app/navigation/layouts/vertical-navigation/navigation.html",'<md-toolbar class="navigation-header md-whiteframe-1dp" layout="row" layout-align="space-between center">\n  <div class="logo" layout="row" layout-align="start center">\n    <span class="logo-image"><img src="/api/settings/1/logo" alt="logo" /></span>\n    \x3c!-- <span class="logo-image"><img src="assets/images/logos/whisker_32x32.png" alt="motion_whisker_32x32" /></span> --\x3e\n    <span class="logo-text text-truncate">{{vm.getLogo() | uppercase}}</span>\n  </div>\n  <md-icon class="fold-toggle s18" md-font-icon="icon-backburger" hide show-gt-sm ng-click="vm.toggleMsNavigationFolded()"></md-icon>\n</md-toolbar>\n\n<ms-navigation class="scrollable" folded="vm.folded"></ms-navigation>'),e.put("app/quick-panel/quick-panel.html",'<md-content>\n  <md-tabs md-no-pagination md-swipe-content md-stretch-tabs="always">\n    <md-tab>\n      <md-tab-label>\n        <span translate="QUICKPANEL.TODAY">TODAY</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="today-tab scrollable" ng-include="\'app/quick-panel/tabs/today/today-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n    <md-tab ng-if="vm.currentUser.allowmessenger || vm.currentUser.role !== \'agent\'" ng-include="\'app/quick-panel/tabs/chat/chat-tab.html\'" ng-controller="ChatInternalController as vm_ct" ng-init="vm_ct.init(vm.license)" md-on-deselect="vm_ct.user = undefined">\n      <md-tab-label>\n        <div ng-if="vm.unreadTotalMessages" class="md-accent-bg unread-message-count-chat">{{vm.unreadTotalMessages}}</div>\n        <span>MESSENGER</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="chat-tab scrollable" ng-include="\'app/quick-panel/tabs/chat/chat-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n    <md-tab ng-if="vm.currentUser.allowmessenger || vm.currentUser.role !== \'agent\'" ng-include="\'app/quick-panel/tabs/groups/group-tab.html\'" ng-controller="ChatGroupController as vm_cg" ng-init="vm_cg.init(vm.license)" md-on-deselect="vm_cg.group = undefined">\n      <md-tab-label>\n        <div ng-if="vm.unreadTotalGroupMessages" class="md-accent-bg unread-message-count-chat">{{vm.unreadTotalGroupMessages}}</div>\n        <span translate="QUICKPANEL.GROUPS">GROUPS</span>\n      </md-tab-label>\n      <md-tab-body>\n        <md-content class="group-tab scrollable" ng-include="\'app/quick-panel/tabs/groups/group-tab.html\'"></md-content>\n      </md-tab-body>\n    </md-tab>\n  </md-tabs>\n</md-content>'),e.put("app/quick-panel/tabs/activity/activity-tab.html",'<md-list class="friends">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.FRIENDS">Friends</span>\n  </md-subheader>\n\n  <md-list-item class="friend md-3-line" ng-repeat="friend in vm.activities.friends">\n    <img ng-src="{{friend.avatar}}" class="md-avatar" alt="{{friend.name}}" />\n\n    <div class="status {{friend.status}}"></div>\n\n    <div ng-if="contact.unread" class="md-accent-bg unread-message-count">{{contact.unread}}</div>\n\n    <div class="md-list-item-text">\n      <h3 class="message">{{friend.message}}</h3>\n      <p class="time">{{friend.time}}</p>\n    </div>\n  </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list class="servers">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.APP_SERVERS">Application Servers</span>\n  </md-subheader>\n\n  <md-list-item class="server md-3-line" ng-repeat="server in vm.activities.servers">\n    <md-icon md-font-icon="icon-checkbox-blank-circle" class="s16 status" ng-class="server.status"></md-icon>\n\n    <div class="md-list-item-text">\n      <h3>{{server.location}}</h3>\n      <p>{{server.detail}}</p>\n    </div>\n  </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list class="stats">\n  <md-subheader class="md-no-sticky">\n    <span translate="QUICKPANEL.USER_STATS">User Stats</span>\n  </md-subheader>\n\n  <md-list-item class="stat md-2-line" ng-repeat="stat in vm.activities.stats">\n    <div class="md-list-item-text">\n      <span>{{stat.title}} ({{stat.current}} / {{stat.total}})</span>\n      <md-progress-linear ng-class="stat.status" md-mode="determinate" value="{{stat.percent}}"></md-progress-linear>\n    </div>\n  </md-list-item>\n</md-list>'),e.put("app/quick-panel/tabs/chat/chat-tab.html",'<div class="main" ng-hide="vm_ct.user && vm_ct.isMessengerAllowed">\n  <audio id="beep-player" hidden src="/assets/ms-phonebar/sounds/beep.ogg"></audio>\n  <md-subheader class="md-no-sticky">\n    <div class="search" layout="row" layout-align="space-between center">\n      <md-icon md-font-icon="icon-magnify" class="icon search-icon"></md-icon>\n      <input class="search-input" ng-model="vm_ct.search.$" type="text" translate translate-attr-placeholder="QUICKPANEL.SEARCH" flex>\n      <md-select ng-model="vm_ct.search.online" class="height-50 no-padding no-margin" aria-label="Chat Tab Search">\n        <md-option ng-value="undefined" translate="DASHBOARDS.ALL">All</md-option>\n        <md-option ng-value="true">\n          <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 green-fg" translate="CHAT.ONLINE"></md-icon>Online\n        </md-option>\n        <md-option ng-value="false">\n          <md-icon md-font-icon="icon-checkbox-blank-circle" class="s12 red-fg" translate="CHAT.OFFLINE"></md-icon>Offline\n        </md-option>\n      </md-select>\n    </div>\n  </md-subheader>\n  <md-divider></md-divider>\n  <md-list class="recent">\n    <md-list-item class="contact md-3-line" ng-if="user.id !== vm_ct.currentUser.id" ng-repeat="user in vm_ct.users.rows | orderBy: \'-lastMessageAt\' | filter: vm_ct.search" ng-click="vm_ct.openChat(user)">\n      <md-divider></md-divider>\n      <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : vm_ct.defaultAvatar}}" class="md-avatar" alt="{{user.fullname}}" />\n      <div class="status" ng-class="{true: \'online\', false: \'offline\'}[user.online]"></div>\n      <div ng-if="vm_ct.unreadMessages[user.id]" class="md-accent-bg unread-message-count">\n        {{vm_ct.unreadMessages[user.id]}}</div>\n      <div class="md-list-item-text">\n        <div layout="row">\n          <h3>{{user.fullname}}</h3>\n          <md-icon ng-if="!user.allowmessenger && user.role === \'agent\'" class="s16 margin-left-5" ng-style="{\'color\': \'red\' }" md-font-icon="icon-block-helper">\n          </md-icon>\n        </div>\n        <p>{{user.name}} &#60;{{user.internal}}&#62;</p>\n        <div layout="row" layout-align="start center">\n          <md-icon ng-if="user.lastMessage.FromId === vm_ct.currentUser.id" class="s16 no-margin" ng-class="{\'md-accent\': user.lastMessage.read}" md-font-icon="{{ user.lastMessage.read ? \'icon-check-all\' : \'icon-check\' }}"></md-icon>\n          <p>{{user.lastMessage.body | limitTo:20 }}{{user.lastMessage.body.length > 20 ? \'...\' : \'\' }}</p>\n          <span flex></span>\n          <p class="last-message" ng-if="user.lastMessageAt != vm_ct.standardDate">\n            {{user.lastMessageAt | formatdate}}</p>\n        </div>\n    </md-list-item>\n</div>\n</md-list>\n</div>\n\n<div class="chat" ng-show="vm_ct.user && vm_ct.isMessengerAllowed" layout="column">\n  <md-toolbar class="md-accent">\n    <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n\n      <div layout="row" layout-align="start center">\n        <md-button class="md-icon-button" ng-click="vm_ct.closeChat()" aria-label="Back" translate translate-attr-aria-label="QUICKPANEL.BACK">\n          <md-icon md-font-icon="icon-keyboard-backspace"></md-icon>\n        </md-button>\n        <h4>\n          <span>{{vm_ct.user.fullname}}</span>\n        </h4>\n      </div>\n\n      <div layout="row" layout-align="end center">\n        <md-button ng-if="vm_ct.license.webrtc && vm_ct.currentUser.role === \'agent\' && vm_ct.currentUser.showWebBar === 2 && vm_ct.user.role === \'agent\'" class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="vm_ct.webcall(vm_ct.user.name)">\n          <md-icon md-font-icon="icon-phone"></md-icon>\n        </md-button>\n        <md-menu ng-if="vm_ct.currentUser.phoneBarRemoteControl && vm_ct.currentUser.role === \'agent\' && vm_ct.currentUser.showWebBar === 0 && vm_ct.user.role === \'agent\'">\n          <md-button class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="$mdOpenMenu($event)">\n            <md-icon md-font-icon="icon-phone"></md-icon>\n          </md-button>\n\n          <md-menu-content width="3">\n            <md-menu-item ng-disabled="!vm_ct.currentUser.phoneBarRemoteControl">\n              <md-button ng-click="vm_ct.call(vm_ct.user.name)">\n                {{\'DASHBOARDS.CALL_NUMBER\' | translate}} ({{vm_ct.user.name}})\n              </md-button>\n            </md-menu-item>\n            <md-menu-item ng-disabled="!vm_ct.currentUser.phoneBarRemoteControl">\n              <md-button ng-click="vm_ct.transfer(vm_ct.user.name)">\n                {{\'DASHBOARDS.TRANSFER_NUMBER\' | translate}} ({{vm_ct.user.name}})\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n    </div>\n\n  </md-toolbar>\n  <md-content flex layout-paddings ms-scroll id="chat-dialog">\n    <div ng-if="vm_ct.isLoading" layout="row" layout-align="center center">\n      <md-progress-circular class="md-accent" md-diameter="48" md-mode="indeterminate"></md-progress-circular>\n    </div>\n    <div ms-timeline="vm_ct.timelineOptions" ms-timeline-load-more="vm_ct.loadMoreMessages()">\n      <div layout="row" ng-repeat="message in vm_ct.user.messages" class="ms-timeline-item md-padding message-row" ng-class="message.FromId === vm_ct.currentUser.id ? \'user\' : \'contact\'">\n        <img ng-if="message.FromId === vm_ct.user.id" ng-src="{{ vm_ct.user.userpic ? \'api/users/\' + vm_ct.user.id + \'/avatar\' : vm_ct.defaultAvatar }}" class="avatar" alt="{{vm_ct.user.fullname}}" />\n        <img ng-if="message.FromId === vm_ct.currentUser.id" ng-src="{{ vm_ct.currentUser.userpic ? \'api/users/\' + vm_ct.currentUser.id + \'/avatar\' : vm_ct.defaultAvatar }}" class="avatar">\n        <div class="bubble timeline-card" flex>\n          <span class="message" ng-bind-html="message.body | embed:{linkTarget:\'_blank\',emoji:false,fontSmiley:false}"></span>\n          <div layout="row" layout-align="end center">\n            <span class="time secondary-text">{{ message.createdAt | formatdate }}</span>\n            <md-icon ng-if="message.FromId === vm_ct.currentUser.id" class="s16 margin-5" ng-class="{\'md-accent\': message.read}" md-font-icon="{{ message.read ? \'icon-check-all\' : \'icon-check\' }}"></md-icon>\n          </div>\n        </div>\n      </div>\n\n      <div ng-if="vm_ct.hasMoreMessages" layout="row" layout-align="center center" class="ng-scope layout-align-center-center layout-row">\n        <md-button class="md-raised md-accent md-button ng-scope md-default-theme md-ink-ripple" type="button" ng-click="vm_ct.loadMoreMessages()" translate="DASHBOARDS.MORE">\n        </md-button>\n      </div>\n      <div ng-if="!vm_ct.hasMoreMessages && vm_ct.user.messages.length > 20" layout="row" layout-align="end center" class="ng-scope layout-align-center-center layout-row">\n        <md-button class="md-fab md-mini" type="button" ng-click="vm_ct.scrollToTopOfChat(0)">\n          <md-icon md-font-icon="icon-arrow-up-bold"></md-icon>\n        </md-button>\n      </div>\n    </div>\n  </md-content>\n\n  <form ng-submit="vm_ct.reply()" layout="row" class="reply" layout-align="start center">\n    <textarea ng-keyup="$event.keyCode == 13 && !vm_ct.disabled? vm_ct.reply() : null" flex ng-model="vm_ct.replyMessage" placeholder="Type and hit enter to send message" translate translate-attr-placeholder="QUICKPANEL.REPLY_PLACEHOLDER" autofocus></textarea>\n    <md-button ng-disable="vm_ct.disabled" class="md-fab md-mini" type="submit" aria-label="Send message" translate translate-attr-aria-label="QUICKPANEL.SEND_MESSAGE">\n      <md-icon md-font-icon="icon-send"></md-icon>\n    </md-button>\n  </form>\n</div>'),e.put("app/quick-panel/tabs/groups/create/dialog.html",'<md-dialog class="group-dialog" aria-label="New ChatGroup">\n  <form name="groupForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(null)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      \x3c!--START Error--\x3e\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      \x3c!--END Error--\x3e\n\n      \x3c!--START NAME--\x3e\n      <md-input-container class="md-block">\n        <label translate="QUICKPANEL.NAME">Name</label>\n        <input type="text" name="name" ng-model="vm.group.name" required autofocus>\n        <div ng-messages="groupForm[\'name\'].$error" ng-show="groupForm[\'name\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="QUICKPANEL.ERRORS.NAME_REQUIRED">Name field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="QUICKPANEL.ERRORS.NAME_MUST_VALID_PATTERN" translate-values="{ regex: \'/^[A-Za-z0-9\\.\\_]+$/i\' }">Name must be valid pattern </span>\n          </div>\n        </div>\n      </md-input-container>\n      \x3c!--END NAME--\x3e\n\n      \x3c!--START Members--\x3e\n      <md-input-container class="md-block">\n        <label translate="QUICKPANEL.MEMBERS">Members</label>\n        <md-contact-chips ng-model="vm.group.members" md-contacts="vm.querySearch($query)" md-contact-name="name" md-contact-image="image" md-require-match="true" md-highlight-flags="i" placeholder="{{\'QUICKPANEL.MEMBERS\' | translate}}">\n        </md-contact-chips>\n        <div ng-messages="groupForm[\'strategy\'].$error" ng-show="groupForm[\'strategy\'].$touched" role="alert">\n          <div ng-message="required">\n            <span translate="QUICKPANEL.ERRORS.MEMBERS_REQUIRED">Members field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      \x3c!--END Members--\x3e\n\n      \x3c!--START Writing--\x3e\n      <md-input-container class="md-block">\n        <md-switch ng-model="vm.group.write" aria-label="Write">\n          {{\'QUICKPANEL.ENABLE_WRITING\' | translate}}\n        </md-switch>\n      </md-input-container>\n      \x3c!--END Writing--\x3e\n\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-if="vm.newChatGroup" ng-click="vm.saveChatGroup()" class="send-button md-accent md-raised" ng-disabled="groupForm.$invalid || groupForm.$pristine || (vm.group.members.length < 1)" aria-label="SAVE" translate="QUICKPANEL.SAVE" translate-attr-aria-label="QUICKPANEL.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/quick-panel/tabs/groups/group-tab.html",'<div class="main" ng-if="!vm_cg.group">\n  <md-subheader>\n    <div layout="row">\n      \x3c!-- START Search --\x3e\n      <div class="search" layout="row" layout-align="start center" flex>\n        <md-icon md-font-icon="icon-magnify" class="icon search-icon"></md-icon>\n        <input ng-model="vm_cg.search" type="text" translate translate-attr-placeholder="QUICKPANEL.SEARCH" flex>\n      </div>\n      \x3c!-- END Search --\x3e\n\n      \x3c!-- START New Group --\x3e\n      <md-button ng-if="vm_cg.currentUser.role !== \'agent\'" class="md-icon-button" aria-label="New" ng-click="vm_cg.addGroup(null, $event)">\n        <md-icon md-font-icon="icon-account-multiple-plus" class="icon"></md-icon>\n      </md-button>\n      \x3c!-- END New Group --\x3e\n    </div>\n  </md-subheader>\n\n  <md-divider></md-divider>\n\n  \x3c!-- START Groups --\x3e\n  <md-list class="recent no-padding">\n    \x3c!-- START Group --\x3e\n    <md-list-item class="contact" ng-repeat="group in vm_cg.groupsToArray() | filter:vm_cg.search" ng-click="vm_cg.toggleChat(group)">\n      <img src="assets/images/avatars/group.png" class="md-avatar" alt="{{group.name}}" />\n      <div ng-if="group.unreadGroupMessages" class="md-accent-bg unread-message-count">{{group.unreadGroupMessages}}</div>\n      <div class="md-list-item-text">\n        <div layout="row">\n          <h3>{{group.name}}</h3>\n        </div>\n      </div>\n\n      <md-button ng-if="vm_cg.currentUser.role !== \'agent\'" class="md-secondary md-icon-button" aria-label="Remove" ng-click="vm_cg.deleteGroup(group, $event)">\n        <md-icon md-font-icon="icon-delete" class="icon s18"></md-icon>\n      </md-button>\n\n      <md-divider ng-if="!$last"></md-divider>\n    </md-list-item>\n    <md-list-item>\n      <div ng-if="!vm_cg.groupsToArray().length" layout="row" layout-align="center center" flex>\n        <span>{{\'QUICKPANEL.NO_AVAILABLE_GROUPS\' | translate}}</span>\n      </div>\n    </md-list-item>\n    \x3c!-- END Group --\x3e\n  </md-list>\n  \x3c!-- END Groups --\x3e\n</div>\n\n<div class="chat" ng-if="vm_cg.group" layout="column">\n  <md-toolbar class="md-accent">\n    <div class="md-toolbar-tools " layout="row" layout-align="space-between center">\n      <md-button class="md-icon-button" ng-click="vm_cg.back()" aria-label="Back" translate translate-attr-aria-label="QUICKPANEL.BACK" flex="15">\n        <md-icon md-font-icon="icon-keyboard-backspace"></md-icon>\n      </md-button>\n      <h4 flex layout-align="start center" style="max-height: 100%; overflow-y:auto;">\n        <span translate="QUICKPANEL.YOU" translate-values=\'{participants: vm_cg.participants}\'></span>\n      </h4>\n\n      <div layout="row" layout-align="end center">\n        <md-button ng-if="vm_cg.license.webrtc && vm_cg.currentUser.role === \'agent\' && vm_cg.currentUser.showWebBar === 2 && vm_cg.user.role === \'agent\' && vm_cg.user.showWebBar === 2" class="md-icon-button" aria-label="Call" translate translate-attr-aria-label="QUICKPANEL.CALL" ng-click="vm_cg.webcall(vm_cg.user.name)">\n          <md-icon md-font-icon="icon-phone"></md-icon>\n        </md-button>\n      </div>\n    </div>\n\n  </md-toolbar>\n  <md-content flex layout-paddings id="chat-group-dialog">\n    <div layout="row" ng-repeat="message in vm_cg.group.messages" class="message-row" ng-class="message.FromId === vm_cg.currentUser.id ? \'user\' : \'contact\'">\n      <img ng-if="message.FromId !== vm_cg.currentUser.id" ng-src="{{\'api/users/\' + message.FromId + \'/avatar\'}}" class="avatar" alt="{{vm_cg.user.fullname}}" />\n      <img ng-if="message.FromId === vm_cg.currentUser.id" class="avatar" ng-src="{{vm_cg.currentUser.userpic ? \'api/users/\' + vm_cg.currentUser.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}">\n      <div class="bubble" flex>\n        <div ng-if="message.FromId !== vm_cg.currentUser.id">\n          <span style="font-size: 12px;">{{vm_cg.group.membersByKeys[message.FromId].fullname}}</span>\n        </div>\n        <span class="message" ng-bind-html="message.body | embed:{linkTarget:\'_blank\',emoji:false,fontSmiley:false}"></span>\n        <div layout="row" layout-align="end center">\n          <span class="time secondary-text" style="margin-top: 0px;">{{message.createdAt | formatdate }}</span>\n          <md-icon ng-if="message.FromId === vm_cg.currentUser.id" class="s16 margin-5" style="cursor: pointer;" md-font-icon="icon-information-outline" ng-click="vm_cg.showMessageInfo($event, message)"></md-icon>\n        </div>\n      </div>\n    </div>\n  </md-content>\n\n  <form ng-if="(vm_cg.currentUser.role !== \'agent\') || vm_cg.group.write" ng-submit="vm_cg.reply()" layout="row" class="reply" layout-align="start center">\n    <textarea ng-keyup="$event.keyCode == 13 ? vm_cg.reply() : null" flex ng-model="vm_cg.replyMessage" placeholder="Type and hit enter to send message" translate translate-attr-placeholder="QUICKPANEL.REPLY_PLACEHOLDER" autofocus></textarea>\n\n    <md-button class="md-fab md-mini" type="submit" aria-label="Send message" translate translate-attr-aria-label="QUICKPANEL.SEND_MESSAGE">\n      <md-icon md-font-icon="icon-send"></md-icon>\n    </md-button>\n  </form>\n</div>'),e.put("app/quick-panel/tabs/groups/info/dialog.html",'<md-dialog class="group-dialog" aria-label="New ChatGroup">\n  <form name="groupForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ vm.title | translate }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog(null)">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div ng-if="vm.data.messages[$index].FromId !== vm.data.messages[$index].ToId" ng-repeat="user in vm.data.users" layout-margin>\n        <div layout="row">\n          <div layout="row" layout-align="start center">\n            <img ng-src="{{user.userpic ? \'api/users/\' + user.id + \'/avatar\' : \'assets/images/avatars/profile.png\'}}" class="avatar" alt="{{user.fullname}}" />\n            <span>{{user.fullname}}</span>\n          </div>\n          <div layout="row" layout-align="end center" flex>\n            <md-icon class="s16 margin-5" md-font-icon="{{vm.data.messages[$index].read ? \'icon-check-all md-accent\' : \'icon-check\'}}"></md-icon>\n            <span class="time secondary-text">{{vm.data.messages[$index].updatedAt | formatdate }}</span>\n          </div>\n        </div>\n        <div>\n          <md-divider ng-if="!$last"></md-divider>\n        </div>\n      </div>\n    </md-dialog-content>\n  </form>\n</md-dialog>'),e.put("app/quick-panel/tabs/today/today-tab.html",'<md-list class="date">\n  <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.TODAY">Today</span></md-subheader>\n  <md-list-item class="md-display-1 md-2-line">\n    <div class="secondary-text">\n      <div translate="QUICKPANEL.{{ (vm.date | date:\'EEEE\').toUpperCase() }}"></div>\n      <div layout="row" layout-align="start start">\n        <span> {{vm.date | date:\'d\'}}</span>\n        <span class="md-subhead">th</span>\n        <span translate="QUICKPANEL.{{ (vm.date | date:\'MMMM\').toUpperCase() }}"></span>\n      </div>\n    </div>\n  </md-list-item>\n</md-list>\n\n\x3c!-- <md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.EVENTS">Events</span></md-subheader>\n\n    <md-list-item class="md-2-line" ng-repeat="event in vm.events" ng-click="dummyFunction()">\n        <div class="md-list-item-text">\n            <h3>{{event.title}}</h3>\n\n            <p>{{event.detail}}</p>\n        </div>\n    </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.NOTES">Notes</span></md-subheader>\n    <md-list-item class="md-2-line" ng-repeat="note in vm.notes" ng-click="dummyFunction()">\n        <div class="md-list-item-text">\n            <h3>{{note.title}}</h3>\n\n            <p>{{note.detail}}</p>\n        </div>\n    </md-list-item>\n</md-list>\n\n<md-divider></md-divider>\n\n<md-list>\n    <md-subheader class="md-no-sticky"><span translate="QUICKPANEL.QUICK_SETTINGS">Quick Settings</span></md-subheader>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.NOTIFICATIONS">Notifications</h3>\n        <md-switch class="md-secondary" ng-model="vm.settings.notify" aria-label="Notifications" translate\n                   translate-attr-aria-label="QUICKPANEL.NOTIFICATIONS"></md-switch>\n    </md-list-item>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.CLOUD_SYNC">Cloud Sync</h3>\n        <md-switch class="md-secondary" ng-model="vm.settings.cloud" aria-label="Cloud Sync" translate\n                   translate-attr-aria-label="QUICKPANEL.CLOUD_SYNC"></md-switch>\n    </md-list-item>\n\n    <md-list-item>\n        <h3 translate="QUICKPANEL.RETRO_THRUSTERS">Retro Thrusters</h3>\n        <md-switch class="md-secondary md-warn" ng-model="vm.settings.retro" aria-label="Retro Thrusters" translate\n                   translate-attr-aria-label="QUICKPANEL.RETRO_THRUSTERS"></md-switch>\n    </md-list-item>\n</md-list> --\x3e'),e.put("app/reset/reset.html",'<div id="reset-password" class="flex-scrollable" layout="column" ng-init="vm.onInit()">\n  <div id="reset-password-form-wrapper" layout="column" layout-align="center center">\n    <div id="reset-password-form" class="md-whiteframe-8dp">\n\n      <img src="/api/settings/1/logo_login" alt="logo_login" class="logo_login" />\n\n      <div class="title" translate="RESETPASSWORD.TITLE">Reset your password</div>\n\n      <form name="resetPasswordForm" novalidate>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="password" ng-model="vm.form.password" ng-pattern="vm.passwordPattern" placeholder="Password" translate translate-attr-placeholder="RESETPASSWORD.PASSWORD" required>\n          <div ng-messages="resetPasswordForm.password.$error" role="alert">\n            <div ng-message="required">\n              <span translate="RESETPASSWORD.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n            </div>\n            <div ng-message="pattern">\n              <span translate="RESETPASSWORD.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-input-container class="md-block" md-no-float>\n          <input type="password" name="passwordConfirm" ng-model="vm.form.passwordConfirm" placeholder="Password (Confirm)" match-password="password" translate translate-attr-placeholder="RESETPASSWORD.PASSWORD_CONFIRM">\n          <div ng-messages="resetPasswordForm.passwordConfirm.$error" role="alert">\n            <div ng-message="passwordMatch">\n              <span translate="TOOLBAR.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n            </div>\n          </div>\n        </md-input-container>\n\n        <md-button type="button" ng-click="vm.resetPassword()" class="md-raised md-accent submit-button" aria-label="UPDATE MY PASSWORD" ng-disabled="resetPasswordForm.$invalid || resetPasswordForm.$pristine" translate="RESETPASSWORD.UPDATE_PASSWORD" translate-attr-aria-label="RESETPASSWORD.UPDATE_PASSWORD">\n          RESET MY PASSWORD\n        </md-button>\n      </form>\n    </div>\n  </div>\n</div>'),e.put("app/toolbar/autoanswers/dialog.html",'<md-dialog class="autoanswers-dialog" aria-label="autoanswers">\n  <form name="autoanswerForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (\'TOOLBAR.AUTOANSWER_NOTIFICATIONS\' | translate)  }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content layout-padding>\n      <md-table-container>\n        <table md-table multiple>\n          <thead md-head>\n            <tr md-row>\n              <th></th>\n              <th md-column>{{ \'TOOLBAR.CHANNEL\' | translate }}</th>\n              <th md-column>{{ \'TOOLBAR.NOTIFICATIONS\' | translate }}</th>\n              <th md-column>{{ \'TOOLBAR.DELAY\' | translate }}</th>\n            </tr>\n          </thead>\n          <tbody md-body>\n            <tr md-row ng-repeat="item in vm.items" ng-if="item.permission">\n              <td>\n                <md-icon md-font-icon="{{item.font_icon}}" class="icon {{item.class}} {{item.font_icon}}" aria-label="{{item.label}}"></md-icon>\n              </td>\n              <td md-cell>\n                <div layout="row">\n                  <span translate="{{item.title}}"></span>\n                </div>\n              </td>\n              <td md-cell align="center">\n                <div layout="row" layout-align="center">\n                  <md-icon ng-if="item.enabled" md-font-icon="icon-check-circle" class="icon green-700-fg"></md-icon>\n                  <span ng-if="!item.enabled" style="color:red">X</span>\n                </div>\n              </td>\n              <td md-cell align="right">\n                <div layout="row" layout-align="end">\n                  <span ng-if="item.enabled">{{item.delay}}</span>\n                </div>\n              </td>\n            </tr>\n          </tbody>\n        </table>\n      </md-table-container>\n    </md-dialog-content>\n\n    <md-dialog-actions class="md-dialog-action-center padding-rigth-15">\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/toolbar/changepassword/changepassword.html",'<md-dialog class="user-dialog" aria-label="{{vm.name}}">\n  <form name="changePasswordForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-accent md-hue-2">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span ng-if="vm.reset" class="title" translate="TOOLBAR.RESETPASSWORD">Reset Password</span>\n        <span ng-if="!vm.reset" class="title" translate="TOOLBAR.CHANGEPASSWORD">Change Password</span>\n        <md-button ng-if="!vm.reset" class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n    <md-dialog-content>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.OLD_PASSWORD">Old Password</label>\n        <input type="password" name="oldPassword" ng-model="vm.oldPassword" placeholder="Password" translate translate-attr-placeholder="TOOLBAR.OLD_PASSWORD" required>\n        <div ng-messages="changePasswordForm.oldPassword.$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.NEW_PASSWORD">New Password</label>\n        <input type="password" name="password" ng-model="vm.password" placeholder="Password" ng-pattern="vm.passwordPattern" translate translate-attr-placeholder="TOOLBAR.NEW_PASSWORD" required>\n        <div ng-messages="changePasswordForm.password.$error" role="alert">\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_REQUIRED">Password field is required</span>\n          </div>\n          <div ng-message="pattern">\n            <span translate="TOOLBAR.ERRORS.SECURE_PASSWORD_PATTERN">Must contain at least 8 characters, with a minimum of 1 lowercase letter, 1 uppercase letter, 1 numeric character and 1 special character ~!?*@#$%^&-_=+[{]}.</span>\n          </div>\n          <div ng-message="oldPasswordMatch">\n            <span translate="TOOLBAR.ERRORS.PASSWORD_OLDPASSWORD_MATCH">New password must be different from old one</span>\n          </div>\n        </div>\n      </md-input-container>\n      <md-input-container class="md-block">\n        <label translate="TOOLBAR.CONFIRM_PASSWORD">Confirm Password</label>\n        <input type="password" match-password="password" name="confirmPassword" ng-model="confirmPassword">\n        <div ng-messages="changePasswordForm.confirmPassword.$error" role="alert" multiple>\n          <div ng-message="required">\n            <span translate="TOOLBAR.ERRORS.CONFIRM_REQUIRED">Confirm field is required</span>\n          </div>\n          <div ng-message="passwordMatch">\n            <span translate="TOOLBAR.ERRORS.CONFIRM_NOT_MATCH">Your password did not match</span>\n          </div>\n        </div>\n      </md-input-container>\n      <div class="error-list">\n        <div ng-repeat="error in vm.errors" class="error" layout="row" layout-align="space-between center">\n          <div>\n            <span class="message">{{error.message}}</span>\n            <span class="type">({{error.type}})</span>\n          </div>\n          <md-button class="md-icon-button">\n            <md-icon md-font-icon="icon-alert-box" aria-label="alert error" class="s16"></md-icon>\n          </md-button>\n        </div>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions layout="row" layout-align="space-between center">\n      <div layout="row" layout-align="start center">\n        <md-button type="submit" ng-click="vm.savePassword()" class="send-button md-accent md-raised" ng-disabled="changePasswordForm.$invalid || changePasswordForm.$pristine" aria-label="SAVE" translate="TOOLBAR.SAVE" translate-attr-aria-label="TOOLBAR.SAVE">\n          SAVE\n        </md-button>\n      </div>\n    </md-dialog-actions>\n  </form>\n</md-dialog>'),e.put("app/toolbar/layouts/vertical-navigation/toolbar.html",'<div layout="row" layout-align="start center">\n  <div layout="row" layout-align="start center" flex>\n    <md-button id="navigation-toggle" class="md-icon-button" ng-click="vm.toggleSidenav(\'navigation\')" hide-gt-sm aria-label="Toggle navigation" translate translate-attr-aria-label="TOOLBAR.TOGGLE_NAVIGATION">\n      <md-icon md-font-icon="icon-menu" class="icon"></md-icon>\n    </md-button>\n\n    <ms-shortcuts ng-if="!vm.isAgent()"></ms-shortcuts>\n\n    <div class="toolbar-separator"></div>\n\n    <div ng-if="vm.license.demo" class="blink md-padding">\n      <span class="md-warn-fg" translate="TOOLBAR.TRIAL_VERSION">Trial Version</span>\n    </div>\n\n    <div ng-if="vm.isAgent()" class="logo" layout-padding-left-8 layout="row" layout-align="start center">\n      <span class="logo-image"><img src="/api/settings/1/logo" alt="logo" /></span>\n      <span ng-show="vm.isAgent() && (vm.user.showWebBar != 2)" class="logo-text text-truncate">{{ vm.getLogo() |\n        uppercase }}</span>\n    </div>\n\n    \x3c!-- phonebar directive WebRtc type--\x3e\n    <ms-phonebar class="ms-phonebar" ng-if="vm.isAgent() && (vm.user.showWebBar == 2)" conf="vm.conf" sessions="vm.webRTCSessions" registered="vm.isWebRTCBarRegistered" flex></ms-phonebar>\n    \x3c!-- phonebar directive --\x3e\n  </div>\n\n  <div layout="row" layout-align="start center">\n\n    <md-progress-circular id="toolbar-progress" ng-if="$root.loadingProgress" class="md-accent" md-diameter="32">\n    </md-progress-circular>\n\n    \x3c!-- Pause Management --\x3e\n    <div ng-if="vm.isAgent() && (vm.user.showWebBar != 0)" layout="row" layout-align="end center">\n      <div class="toolbar-separator"></div>\n\n      <div class="border brad-5" layout="row" layout-align="center center" layout-margin>\n        <md-button ng-if="vm.user.voicePause" class="md-icon-button no-margin" ng-click="vm.unpause()">\n          <md-icon md-font-icon="icon-play-circle-outline" class="icon s24"></md-icon>\n          <md-tooltip md-direction="bottom">{{\'TOOLBAR.RESUME\' | translate}}</md-tooltip>\n        </md-button>\n\n        <md-button ng-disabled="vm.user.voicePause && \'DEFAULT PAUSE\' === vm.user.pauseType" class="md-icon-button no-margin" ng-click="vm.pause()">\n          <md-icon md-font-icon="icon-pause-circle-outline" class="icon s24"></md-icon>\n          <md-tooltip md-direction="bottom">{{\'TOOLBAR.PAUSE\' | translate}}</md-tooltip>\n        </md-button>\n\n        <md-menu>\n          <md-button aria-label="Pauses" class="md-icon-button no-margin" ng-click="$mdOpenMenu($event)">\n            <md-icon md-menu-origin md-font-icon="icon-dots-vertical"></md-icon>\n          </md-button>\n          <md-menu-content width="4">\n            <md-menu-item ng-if="!vm.pauses.length">\n              <md-button disabled="disabled">\n                <md-icon md-font-icon="icon-pause-octagon" md-menu-align-target></md-icon>\n                {{\'TOOLBAR.NO_PAUSES_AVAILABLE\' | translate}}\n              </md-button>\n            </md-menu-item>\n            <md-menu-item ng-repeat="pause in vm.pauses">\n              <md-button ng-disabled="vm.user.voicePause && pause.name === vm.user.pauseType" ng-click="vm.pause(pause.name)">\n                <md-icon md-font-icon="icon-pause-circle" md-menu-align-target></md-icon>\n                {{pause.name}}\n              </md-button>\n            </md-menu-item>\n          </md-menu-content>\n        </md-menu>\n      </div>\n    </div>\n    \x3c!-- Pause Management --\x3e\n\n    <div class="h5 padding-10" ng-if="vm.isAgent() && (vm.user.showWebBar != 0)">\n      <div layout="row" layout-align="space-between center">\n        <timer ng-if="vm.user.lastLoginAt" start-time="vm.user.lastLoginAt"></timer>\n        <md-tooltip>{{\'TOOLBAR.LOGIN_TIME\' | translate}}</md-tooltip>\n        <md-icon md-font-icon="icon-timelapse" class="icon s16"></md-icon>\n      </div>\n      <div layout="row" layout-align="center center" ng-if="vm.user.voicePause">\n        <timer start-time="vm.user.lastPauseAt"></timer>\n        <md-tooltip>{{\'TOOLBAR.PAUSE_TIME\' | translate}}</md-tooltip>\n        <md-icon md-font-icon="icon-coffee" class="icon s16"></md-icon>\n      </div>\n      <div ng-if="vm.user.voicePause">\n        <span class="blink red-fg">{{vm.user.pauseType || \'default\' | uppercase}}</span>\n      </div>\n    </div>\n\n    <div class="toolbar-separator" ng-if="vm.isAgent() && (vm.user.showWebBar != 0)"></div>\n\n    <md-menu-bar id="user-menu">\n      <md-menu md-position-mode="left bottom">\n        <md-button class="user-button" ng-click="$mdOpenMenu()" aria-label="User settings" translate translate-attr-aria-label="TOOLBAR.USER_SETTINGS">\n          <div layout="row" layout-align="space-between center">\n            <div class="avatar-wrapper">\n              <img md-menu-align-target class="avatar" src="assets/images/avatars/profile.png" ng-if="!vm.user.userpic">\n              <img md-menu-align-target class="avatar" ng-src="api/users/{{vm.user.id}}/avatar" ng-if="vm.user.userpic">\n              <md-icon md-font-icon ng-class="vm.userStatus.icon" ng-style="{\'color\': vm.userStatus.color }" class="icon status s16"></md-icon>\n            </div>\n            <div layout="column" layout-align="center center" class="padding-horizontal-5">\n              <span class="font-size-14 md-subhead">{{vm.user.fullname}}</span>\n              <span class="font-size-12 md-subhead">{{vm.user.name}} &#60;{{vm.user.internal}}&#62;</span>\n            </div>\n\n            <md-icon md-font-icon="icon-chevron-down" class="icon s16" hide-xs></md-icon>\n          </div>\n        </md-button>\n\n        <md-menu-content width="3">\n          <md-menu-item ng-if="vm.user.showWebBar == 2 && vm.user.phoneBarEnableSettings" class="md-indent">\n            <md-icon md-font-icon="icon-cog" class="icon"></md-icon>\n            <md-button ng-click="vm.openSettings($event)" ng-disabled="!vm.license.webrtc"><span translate="TOOLBAR.SETTINGS">SETTINGS</span></md-button>\n          </md-menu-item>\n\n          <md-menu-item class="md-indent">\n            <md-icon md-font-icon="icon-key-variant" class="icon"></md-icon>\n            <md-button ng-click="vm.changePassword($event)"><span translate="TOOLBAR.CHANGEPASSWORD">Change\n                Password</span></md-button>\n          </md-menu-item>\n\n          <md-menu-divider></md-menu-divider>\n\n          <md-menu-item class="md-indent">\n            <md-icon md-font-icon="icon-logout" class="icon"></md-icon>\n            <md-button ng-click="vm.logout()">Logout</md-button>\n          </md-menu-item>\n        </md-menu-content>\n      </md-menu>\n    </md-menu-bar>\n\n    <div class="toolbar-separator"></div>\n\n    <md-button ng-if="vm.user.role === \'agent\' && (vm.license.chat || vm.license.mail || vm.license.messaging || vm.license.openchannel || vm.license.fax || vm.license.whatsapp)" class="preview-button no-margin" ng-disabled="vm.disable" ng-click="vm.autoAnswerNotificationsDialog($event)" aria-label="Language" md-menu-origin md-menu-align-target>\n      <md-icon md-font-icon="icon-reply" class="icon {{ vm.autoanswerIconColor }}"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.AUTOANSWER_NOTIFICATIONS">Notifications</span></md-tooltip>\n    </md-button>\n\n    <md-button ng-if="vm.user.role === \'agent\' && vm.license.dialer" class="preview-button no-margin" ng-disabled="vm.disable" ng-click="vm.preview($event)" aria-label="Language" md-menu-origin md-menu-align-target>\n      <div ng-if="vm.contacts" class="md-accent-bg open-contact-count badge-count">{{vm.contacts > 99 ? \'99+\' : vm.contacts}}</div>\n      <md-icon md-font-icon="icon-fire" class="icon red-900-fg"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.PREVIEW">Preview</span></md-tooltip>\n    </md-button>\n    \n    \x3c!-- \n      ADD V3\n      \n      <md-button ng-if="vm.user.role === \'agent\' && vm.license.voice && vm.user.permissions.includes(110)" class="preview-button no-margin" ng-disabled="vm.disable" aria-label="Language" md-menu-origin md-menu-align-target>\n      <div ng-if="vm.waitingQueueCalls.length > 0" class="md-accent-bg queues-call-count badge-count">{{vm.waitingQueueCalls.length}}</div>\n      <md-icon md-font-icon="icon-phone-incoming blue-fg" class="icon"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.WAITINGQUEUECALLS">Waiting Queues Calls</span></md-tooltip>\n    </md-button> --\x3e\n\n    \x3c!-- \n      ADD V3\n      \n      <md-button ng-if="vm.user.role === \'agent\' && vm.license.voice && vm.user.permissions.includes(110)" class="preview-button no-margin" ng-disabled="vm.disable" aria-label="Language" md-menu-origin md-menu-align-target>\n      <div ng-if="vm.waitingQueueCalls.length > 0" class="md-accent-bg queues-call-count badge-count">{{vm.waitingQueueCalls.length}}</div>\n      <md-icon md-font-icon="icon-phone-incoming blue-fg" class="icon"></md-icon>\n      <md-tooltip><span translate="TOOLBAR.WAITINGQUEUECALLS">Waiting Queues Calls</span></md-tooltip>\n    </md-button> --\x3e\n\n    <ms-search-bar ng-if="vm.user.role !== \'agent\'" on-search="vm.search(query)" on-result-click="vm.searchResultClick(item)" debounce="300" collapse-on-blur="true"></ms-search-bar>\n\n    <md-menu id="language-menu" md-offset="0 72" md-position-mode="target-right target" layout="column" layout-align="center center">\n      <md-button class="md-icon-button no-margin" ng-click="$mdOpenMenu()" aria-label="Language" md-menu-origin md-menu-align-target>\n        <div layout="row" layout-align="center center">\n          <img class="flag" ng-src="assets/images/flags/{{vm.selectedLanguage.flag}}.png">\n        </div>\n      </md-button>\n\n      <md-menu-content width="3" id="language-menu-content">\n        <md-menu-item ng-repeat="(iso, lang) in vm.languages">\n          <md-button ng-click="vm.changeLanguage(lang)" aria-label="{{lang.title}}" translate translate-attr-aria-label="{{lang.title}}">\n            <span layout="row" layout-align="start center">\n              <img class="flag flag-24" ng-src="assets/images/flags/{{lang.flag}}.png">\n              <span>{{ lang.translation | translate | startcase }}</span>\n            </span>\n          </md-button>\n        </md-menu-item>\n      </md-menu-content>\n    </md-menu>\n\n    <div class="toolbar-separator"></div>\n\n    <md-button ng-if="vm.license.gray && vm.user.role !== \'agent\'" class="md-icon-button" ui-sref="app.settings.license" aria-label="Toggle quick panel">\n      <md-icon md-font-icon="icon-alert" class="icon md-warn blink"></md-icon>\n    </md-button>\n    <md-button ng-if="vm.license.gray && vm.user.role === \'agent\'" class="md-icon-button" aria-label="Toggle quick panel">\n      <md-icon md-font-icon="icon-alert" class="icon md-warn blink"></md-icon>\n    </md-button>\n\n    <div ng-if="vm.license.gray" class="toolbar-separator"></div>\n\n    <md-button id="quick-panel-toggle" class="md-icon-button" ng-click="vm.toggleSidenav(\'quick-panel\')" aria-label="Toggle quick panel" translate translate-attr-aria-label="TOOLBAR.TOGGLE_QUICK_PANEL">\n      <div ng-if="(vm.unreadTotalMessages + vm.unreadTotalGroupMessages)" class="md-accent-bg unread-message-count">\n        {{vm.unreadTotalMessages + vm.unreadTotalGroupMessages}}</div>\n      <md-icon md-font-icon="icon-format-list-bulleted" class="icon"></md-icon>\n    </md-button>\n  </div>\n</div>'),e.put("app/toolbar/preview/dialog.html",'<md-dialog class="preview-dialog" aria-label="preview">\n  <form name="previewForm" class="md-inline-form" novalidate>\n    <md-toolbar class="md-background-bg">\n      <div class="md-toolbar-tools" layout="row" layout-align="space-between center">\n        <span class="title">{{ (\'TOOLBAR.PREVIEW\' | translate) + (vm.preview.recallme ? \' - \' +\n          (\'CONTACTMANAGER.RECALLME\' | translate | uppercase) : \'\') }}</span>\n        <md-button class="md-icon-button" ng-click="vm.closeDialog()">\n          <md-icon md-font-icon="icon-close" aria-label="Close dialog"></md-icon>\n        </md-button>\n      </div>\n    </md-toolbar>\n\n    <md-dialog-content>\n      <div ng-if="vm.preview">\n        <div ng-if="vm.preview.recallme" layout="row" class="recall-me-info">\n          <md-icon md-font-icon="icon-information-outline" aria-label="Recall Me"></md-icon>\n          <p class="ml-5" translate="TOOLBAR.HELP.PREVIEW_RECALLME" translate-values="{ date: (vm.preview.scheduledat | date:\'short\') }" flex></p>\n        </div>\n        <div layout="row">\n          <div class="md-padding md-margin" layout="column" flex="30">\n            <md-input-container ng-if="vm.preview.Contact.id" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.ID">ID</label>\n              <input type="text" ng-model="vm.preview.Contact.id" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Queue.name" class="md-block no-margin">\n              <label translate="VOICE.QUEUE">Queue</label>\n              <input type="text" ng-model="vm.preview.Queue.name" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.List.name" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.LIST">List</label>\n              <input type="text" ng-model="vm.preview.List.name" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Contact.tags && vm.preview.Contact.tags.length" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.TAGS">Tags</label>\n              <input type="text" ng-model="vm.preview.Contact.tags" disabled="true">\n            </md-input-container>\n            <md-input-container ng-if="vm.preview.Contact.Company && vm.preview.Contact.Company.name" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.COMPANY">Company</label>\n              <input type="text" ng-model="vm.preview.Contact.Company.name" disabled="true">\n            </md-input-container>\n          </div>\n          <md-divider></md-divider>\n          <div class="md-padding md-margin" layout="column" flex="35">\n            <md-input-container ng-repeat="(key, value) in vm.preview.Contact" ng-if="!vm.isNil(value) && !vm.isCustomField(key) && !vm.isHiddenField(key)" class="md-block no-margin">\n              <label>{{ \'CONTACTMANAGER.\' + key.toUpperCase() | translate}}</label>\n              <input type="text" ng-model="value" disabled="true">\n            </md-input-container>\n\n            <md-input-container ng-if="vm.additionalItems.length>0" class="md-block no-margin">\n              <label translate="CONTACTMANAGER.ADDITIONAL_PHONES">Additional phones</label>\n              <md-chips ng-model="vm.additionalItems" placeholder="Phone numbers" readonly="true">\n                <md-chip-template custom-chip alt="{{$chip.type}} {{$chip.description}}" title="{{$chip.type}} {{$chip.description}}">\n                  {{ $chip.phone }}\n                </md-chip-template>\n              </md-chips>\n            </md-input-container>\n\n          </div>\n          <div class="md-padding md-margin" layout="column" flex="35">\n            <md-input-container ng-repeat="(key, value) in vm.preview.Contact" ng-if="!vm.isNil(value) && vm.isCustomField(key) && !vm.isHiddenField(key)" class="md-block no-margin">\n              <label>{{ vm.customFieldsMap[key] || key }}</label>\n              <input type="text" ng-model="value" disabled="true">\n            </md-input-container>\n          </div>\n        </div>\n      </div>\n      <div layout="row" ng-if="!vm.preview">\n        <span>no contacts available</span>\n      </div>\n    </md-dialog-content>\n\n    <md-dialog-actions class="md-dialog-action-center padding-rigth-15">\n      <md-button class="md-icon-button md-primary" ng-if="!vm.isRecallNotification" ng-hide="vm.hopperIds.length <= 1" ng-disabled="vm.disableGetContact" ng-click="vm.previousContact()" aria-label="PREVIOUSCONTACT" translate-attr-aria-label="TOOLS.PREVIOUSCONTACT">\n        <md-icon md-font-icon="icon-chevron-left"></md-icon>\n      </md-button>\n      <md-button class="md-fab green-bg" aria-label="CALL" translate-attr-aria-label="TOOLS.CALL" ng-disabled="vm.disable" ng-click="vm.originatePreview($event)">\n        <md-icon md-font-icon="icon-phone"></md-icon>\n      </md-button>\n      <md-button class="md-icon-button md-primary" ng-if="!vm.isRecallNotification" ng-disabled="vm.disableGetContact" ng-click="vm.nextContact()" aria-label="NEXTCONTACT" translate-attr-aria-label="TOOLS.NEXTCONTACT">\n        <md-icon md-font-icon="icon-chevron-right"></md-icon>\n      </md-button>\n    </md-dialog-actions>\n  </form>\n</md-dialog>')}]);
\ No newline at end of file
index aed3e0b..74096d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc61d=['TEXT','urlForward[body]','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]'];(function(_0x1cd899,_0x1c9258){var _0x573dd0=function(_0x48f6bd){while(--_0x48f6bd){_0x1cd899['push'](_0x1cd899['shift']());}};_0x573dd0(++_0x1c9258);}(_0xc61d,0x19a));var _0xdc61=function(_0x215764,_0x5aa588){_0x215764=_0x215764-0x0;var _0x2b192c=_0xc61d[_0x215764];return _0x2b192c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdc61('0x0')],'get':function(_0x512276){return this[_0xdc61('0x1')]('action');}},'action':{'type':Sequelize[_0xdc61('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xdc61('0x3'),_0xdc61('0x4'),_0xdc61('0x5'),_0xdc61('0x6'),_0xdc61('0x7'),'browser',_0xdc61('0x8'),_0xdc61('0x9')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0xdc61('0xa')},'data1':{'type':Sequelize[_0xdc61('0x2')](0x1000),'comment':_0xdc61('0xb')},'data2':{'type':Sequelize[_0xdc61('0x2')](0x1000),'comment':_0xdc61('0xc')},'data3':{'type':Sequelize[_0xdc61('0x2')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xdc61('0xd')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0xdc61('0x2')],'comments':_0xdc61('0xe')},'data7':{'type':Sequelize[_0xdc61('0xf')],'comments':_0xdc61('0x10')}};
\ No newline at end of file
+var _0x3d68=['browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'];(function(_0x166744,_0x1ae2e6){var _0x4068b5=function(_0x5ecc92){while(--_0x5ecc92){_0x166744['push'](_0x166744['shift']());}};_0x4068b5(++_0x1ae2e6);}(_0x3d68,0x131));var _0x83d6=function(_0x4c1ffb,_0x49063a){_0x4c1ffb=_0x4c1ffb-0x0;var _0x244f55=_0x3d68[_0x4c1ffb];return _0x244f55;};'use strict';var Sequelize=require(_0x83d6('0x0'));module[_0x83d6('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x545223){return this[_0x83d6('0x2')](_0x83d6('0x3'));}},'action':{'type':Sequelize[_0x83d6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x83d6('0x5'),_0x83d6('0x6'),_0x83d6('0x7'),_0x83d6('0x8'),_0x83d6('0x9'),_0x83d6('0xa'),_0x83d6('0xb'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x83d6('0xc')},'data1':{'type':Sequelize['STRING'](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x83d6('0x4')](0x1000),'comment':_0x83d6('0xd')},'data3':{'type':Sequelize[_0x83d6('0x4')](0x1000),'comment':_0x83d6('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x83d6('0xf')},'data5':{'type':Sequelize[_0x83d6('0x4')](0x1000),'comments':_0x83d6('0x10')},'data6':{'type':Sequelize[_0x83d6('0x4')],'comments':_0x83d6('0x11')},'data7':{'type':Sequelize[_0x83d6('0x12')],'comments':_0x83d6('0x13')}};
\ No newline at end of file
index 3171f81..e49a085 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d45=['undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','body','Action','find','catch','destroy','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x168f96,_0x3d61cd){var _0x5cb5b4=function(_0x2639db){while(--_0x2639db){_0x168f96['push'](_0x168f96['shift']());}};_0x5cb5b4(++_0x3d61cd);}(_0x5d45,0x19e));var _0x55d4=function(_0x5dd67c,_0x9c2db){_0x5dd67c=_0x5dd67c-0x0;var _0x6a2e63=_0x5d45[_0x5dd67c];return _0x6a2e63;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x55d4('0x0'));var jsonpatch=require(_0x55d4('0x1'));var rp=require(_0x55d4('0x2'));var moment=require(_0x55d4('0x3'));var BPromise=require(_0x55d4('0x4'));var Mustache=require(_0x55d4('0x5'));var util=require('util');var path=require(_0x55d4('0x6'));var sox=require('sox');var csv=require(_0x55d4('0x7'));var ejs=require(_0x55d4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x55d4('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x55d4('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x55d4('0x7'));var querystring=require(_0x55d4('0xb'));var Papa=require('papaparse');var Redis=require(_0x55d4('0xc'));var authService=require(_0x55d4('0xd'));var qs=require(_0x55d4('0xe'));var as=require(_0x55d4('0xf'));var hardwareService=require(_0x55d4('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x55d4('0x11'));var config=require(_0x55d4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x55d4('0x13'))['db'];function respondWithStatusCode(_0x31f507,_0x36d3da){_0x36d3da=_0x36d3da||0xcc;return function(_0x57a32d){if(_0x57a32d){return _0x31f507[_0x55d4('0x14')](_0x36d3da);}return _0x31f507[_0x55d4('0x15')](_0x36d3da)[_0x55d4('0x16')]();};}function respondWithResult(_0xd64674,_0x4de6e9){_0x4de6e9=_0x4de6e9||0xc8;return function(_0x2f4889){if(_0x2f4889){return _0xd64674[_0x55d4('0x15')](_0x4de6e9)[_0x55d4('0x17')](_0x2f4889);}};}function respondWithFilteredResult(_0x51d59c,_0x237db1){return function(_0x1f4e15){if(_0x1f4e15){var _0x2f6782=typeof _0x237db1[_0x55d4('0x18')]==='undefined'&&typeof _0x237db1[_0x55d4('0x19')]===_0x55d4('0x1a');var _0x413560=_0x1f4e15[_0x55d4('0x1b')];var _0x37b988=_0x2f6782?0x0:_0x237db1[_0x55d4('0x18')];var _0x1021e2=_0x2f6782?_0x1f4e15[_0x55d4('0x1b')]:_0x237db1[_0x55d4('0x18')]+_0x237db1[_0x55d4('0x19')];var _0x10d6c7;if(_0x1021e2>=_0x413560){_0x1021e2=_0x413560;_0x10d6c7=0xc8;}else{_0x10d6c7=0xce;}_0x51d59c[_0x55d4('0x15')](_0x10d6c7);return _0x51d59c[_0x55d4('0x1c')](_0x55d4('0x1d'),_0x37b988+'-'+_0x1021e2+'/'+_0x413560)[_0x55d4('0x17')](_0x1f4e15);}return null;};}function patchUpdates(_0x5ca493){return function(_0x684ea0){try{jsonpatch[_0x55d4('0x1e')](_0x684ea0,_0x5ca493,!![]);}catch(_0x407adf){return BPromise['reject'](_0x407adf);}return _0x684ea0[_0x55d4('0x1f')]();};}function saveUpdates(_0xf166e6,_0x182ae6){return function(_0x5abaff){if(_0x5abaff){return _0x5abaff[_0x55d4('0x20')](_0xf166e6)[_0x55d4('0x21')](function(_0x639c97){return _0x639c97;});}return null;};}function removeEntity(_0x1e54d1,_0x14dde7){return function(_0x32af56){if(_0x32af56){return _0x32af56['destroy']()[_0x55d4('0x21')](function(){_0x1e54d1['status'](0xcc)[_0x55d4('0x16')]();});}};}function handleEntityNotFound(_0x1736b8,_0x3a6de7){return function(_0x1a64ce){if(!_0x1a64ce){_0x1736b8['sendStatus'](0x194);}return _0x1a64ce;};}function handleError(_0x5cab8b,_0x2809c0){_0x2809c0=_0x2809c0||0x1f4;return function(_0x42f3ba){logger[_0x55d4('0x22')](_0x42f3ba[_0x55d4('0x23')]);if(_0x42f3ba[_0x55d4('0x24')]){delete _0x42f3ba[_0x55d4('0x24')];}_0x5cab8b['status'](_0x2809c0)[_0x55d4('0x25')](_0x42f3ba);};}exports[_0x55d4('0x20')]=function(_0x4a8362,_0x404314){if(_0x4a8362[_0x55d4('0x26')]['id']){delete _0x4a8362[_0x55d4('0x26')]['id'];}return db[_0x55d4('0x27')][_0x55d4('0x28')]({'where':{'id':_0x4a8362['params']['id']}})['then'](handleEntityNotFound(_0x404314,null))[_0x55d4('0x21')](saveUpdates(_0x4a8362[_0x55d4('0x26')],null))[_0x55d4('0x21')](respondWithResult(_0x404314,null))[_0x55d4('0x29')](handleError(_0x404314,null));};exports[_0x55d4('0x2a')]=function(_0x3855d8,_0x33b5d1){return db[_0x55d4('0x27')]['find']({'where':{'id':_0x3855d8[_0x55d4('0x2b')]['id']}})[_0x55d4('0x21')](handleEntityNotFound(_0x33b5d1,null))[_0x55d4('0x21')](removeEntity(_0x33b5d1,null))[_0x55d4('0x29')](handleError(_0x33b5d1,null));};
\ No newline at end of file
+var _0x4522=['sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','end','error','name','send','body','Action','find','catch','params','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x30ccd0,_0x4aa875){var _0x1a8c5f=function(_0x5b3c92){while(--_0x5b3c92){_0x30ccd0['push'](_0x30ccd0['shift']());}};_0x1a8c5f(++_0x4aa875);}(_0x4522,0x10b));var _0x2452=function(_0x1aa0ee,_0x2a61de){_0x1aa0ee=_0x1aa0ee-0x0;var _0x56af4a=_0x4522[_0x1aa0ee];return _0x56af4a;};'use strict';var emlformat=require(_0x2452('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2452('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2452('0x2'));var moment=require(_0x2452('0x3'));var BPromise=require(_0x2452('0x4'));var Mustache=require(_0x2452('0x5'));var util=require(_0x2452('0x6'));var path=require(_0x2452('0x7'));var sox=require(_0x2452('0x8'));var csv=require(_0x2452('0x9'));var ejs=require(_0x2452('0xa'));var fs=require('fs');var fs_extra=require(_0x2452('0xb'));var _=require(_0x2452('0xc'));var squel=require(_0x2452('0xd'));var crypto=require('crypto');var jsforce=require(_0x2452('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2452('0xf'));var Papa=require(_0x2452('0x10'));var Redis=require(_0x2452('0x11'));var authService=require(_0x2452('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2452('0x13'));var hardwareService=require(_0x2452('0x14'));var logger=require(_0x2452('0x15'))(_0x2452('0x16'));var utils=require(_0x2452('0x17'));var config=require(_0x2452('0x18'));var licenseUtil=require(_0x2452('0x19'));var db=require(_0x2452('0x1a'))['db'];function respondWithStatusCode(_0xeea5f6,_0x4c649b){_0x4c649b=_0x4c649b||0xcc;return function(_0x4785c7){if(_0x4785c7){return _0xeea5f6[_0x2452('0x1b')](_0x4c649b);}return _0xeea5f6[_0x2452('0x1c')](_0x4c649b)['end']();};}function respondWithResult(_0x226fba,_0x578240){_0x578240=_0x578240||0xc8;return function(_0x332998){if(_0x332998){return _0x226fba[_0x2452('0x1c')](_0x578240)[_0x2452('0x1d')](_0x332998);}};}function respondWithFilteredResult(_0xb77f9a,_0x38672d){return function(_0x3448a9){if(_0x3448a9){var _0xa2defb=typeof _0x38672d['offset']==='undefined'&&typeof _0x38672d[_0x2452('0x1e')]==='undefined';var _0x20198d=_0x3448a9[_0x2452('0x1f')];var _0x325eef=_0xa2defb?0x0:_0x38672d[_0x2452('0x20')];var _0x583daf=_0xa2defb?_0x3448a9[_0x2452('0x1f')]:_0x38672d[_0x2452('0x20')]+_0x38672d[_0x2452('0x1e')];var _0x4a7d66;if(_0x583daf>=_0x20198d){_0x583daf=_0x20198d;_0x4a7d66=0xc8;}else{_0x4a7d66=0xce;}_0xb77f9a[_0x2452('0x1c')](_0x4a7d66);return _0xb77f9a[_0x2452('0x21')](_0x2452('0x22'),_0x325eef+'-'+_0x583daf+'/'+_0x20198d)[_0x2452('0x1d')](_0x3448a9);}return null;};}function patchUpdates(_0x202101){return function(_0x587bf4){try{jsonpatch[_0x2452('0x23')](_0x587bf4,_0x202101,!![]);}catch(_0x17723e){return BPromise[_0x2452('0x24')](_0x17723e);}return _0x587bf4[_0x2452('0x25')]();};}function saveUpdates(_0x579a07,_0x527ad0){return function(_0x2ebe4d){if(_0x2ebe4d){return _0x2ebe4d[_0x2452('0x26')](_0x579a07)[_0x2452('0x27')](function(_0x5d4351){return _0x5d4351;});}return null;};}function removeEntity(_0x2f1aa7,_0x1fcb78){return function(_0x4d6f36){if(_0x4d6f36){return _0x4d6f36['destroy']()[_0x2452('0x27')](function(){_0x2f1aa7[_0x2452('0x1c')](0xcc)[_0x2452('0x28')]();});}};}function handleEntityNotFound(_0x3c717c,_0x1a0c30){return function(_0x2c0985){if(!_0x2c0985){_0x3c717c[_0x2452('0x1b')](0x194);}return _0x2c0985;};}function handleError(_0x65e96e,_0x150446){_0x150446=_0x150446||0x1f4;return function(_0x4a1fd6){logger[_0x2452('0x29')](_0x4a1fd6['stack']);if(_0x4a1fd6[_0x2452('0x2a')]){delete _0x4a1fd6[_0x2452('0x2a')];}_0x65e96e[_0x2452('0x1c')](_0x150446)[_0x2452('0x2b')](_0x4a1fd6);};}exports[_0x2452('0x26')]=function(_0x3c3858,_0x5ca54c){if(_0x3c3858[_0x2452('0x2c')]['id']){delete _0x3c3858[_0x2452('0x2c')]['id'];}return db[_0x2452('0x2d')][_0x2452('0x2e')]({'where':{'id':_0x3c3858['params']['id']}})[_0x2452('0x27')](handleEntityNotFound(_0x5ca54c,null))[_0x2452('0x27')](saveUpdates(_0x3c3858['body'],null))[_0x2452('0x27')](respondWithResult(_0x5ca54c,null))[_0x2452('0x2f')](handleError(_0x5ca54c,null));};exports['destroy']=function(_0x5aef33,_0x2d3f9f){return db[_0x2452('0x2d')]['find']({'where':{'id':_0x5aef33[_0x2452('0x30')]['id']}})[_0x2452('0x27')](handleEntityNotFound(_0x2d3f9f,null))[_0x2452('0x27')](removeEntity(_0x2d3f9f,null))[_0x2452('0x2f')](handleError(_0x2d3f9f,null));};
\ No newline at end of file
index db6e840..751ba32 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6719=['./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment'];(function(_0x78efdc,_0x3bf85e){var _0x209ef3=function(_0x54a2f3){while(--_0x54a2f3){_0x78efdc['push'](_0x78efdc['shift']());}};_0x209ef3(++_0x3bf85e);}(_0x6719,0xf6));var _0x9671=function(_0x44ceee,_0x2a5e28){_0x44ceee=_0x44ceee-0x0;var _0x1a065c=_0x6719[_0x44ceee];return _0x1a065c;};'use strict';var _=require(_0x9671('0x0'));var util=require(_0x9671('0x1'));var logger=require(_0x9671('0x2'))(_0x9671('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9671('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9671('0x5'));var config=require(_0x9671('0x6'));var attributes=require(_0x9671('0x7'));module[_0x9671('0x8')]=function(_0xcd01df,_0x5e536c){return _0xcd01df[_0x9671('0x9')]('Action',attributes,{'tableName':_0x9671('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xcbed=['../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0xe52152,_0x59567d){var _0x3da6bb=function(_0x120512){while(--_0x120512){_0xe52152['push'](_0xe52152['shift']());}};_0x3da6bb(++_0x59567d);}(_0xcbed,0x17f));var _0xdcbe=function(_0x1ce88e,_0x498806){_0x1ce88e=_0x1ce88e-0x0;var _0x1fd979=_0xcbed[_0x1ce88e];return _0x1fd979;};'use strict';var _=require(_0xdcbe('0x0'));var util=require(_0xdcbe('0x1'));var logger=require(_0xdcbe('0x2'))('api');var moment=require(_0xdcbe('0x3'));var BPromise=require(_0xdcbe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdcbe('0x5'));var rimraf=require(_0xdcbe('0x6'));var config=require(_0xdcbe('0x7'));var attributes=require(_0xdcbe('0x8'));module[_0xdcbe('0x9')]=function(_0x11ea3d,_0x1aff03){return _0x11ea3d[_0xdcbe('0xa')](_0xdcbe('0xb'),attributes,{'tableName':_0xdcbe('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3afd157..5acf547 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53ec=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','stringify','code'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x53ec,0x192));var _0xc53e=function(_0x421263,_0x18187d){_0x421263=_0x421263-0x0;var _0x34e4b5=_0x53ec[_0x421263];return _0x34e4b5;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var moment=require(_0xc53e('0x2'));var BPromise=require(_0xc53e('0x3'));var rs=require(_0xc53e('0x4'));var fs=require('fs');var Redis=require(_0xc53e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc53e('0x6'));var logger=require('../../config/logger')(_0xc53e('0x7'));var config=require(_0xc53e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc53e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41a9e8,_0x2de88b,_0x5d3b28){return new BPromise(function(_0x1616ac,_0x1ac6c0){return client[_0xc53e('0xa')](_0x41a9e8,_0x5d3b28)[_0xc53e('0xb')](function(_0xd9612){logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));logger[_0xc53e('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x2de88b,'request\x20sent',JSON[_0xc53e('0x10')](_0xd9612));if(_0xd9612['error']){if(_0xd9612['error'][_0xc53e('0x11')]===0x1f4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')]['message']);return _0x1ac6c0(_0xd9612['error'][_0xc53e('0x13')]);}logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);return _0x1616ac(_0xd9612[_0xc53e('0x12')][_0xc53e('0x13')]);}else{logger[_0xc53e('0xc')](_0xc53e('0xd'),_0x2de88b,_0xc53e('0xe'));_0x1616ac(_0xd9612['result'][_0xc53e('0x13')]);}})[_0xc53e('0x14')](function(_0x535cd4){logger[_0xc53e('0x12')](_0xc53e('0xd'),_0x2de88b,_0x535cd4);_0x1ac6c0(_0x535cd4);});});}
\ No newline at end of file
+var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','Action,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x401dab,_0x2af71e){var _0x31b40a=function(_0x10e7e4){while(--_0x10e7e4){_0x401dab['push'](_0x401dab['shift']());}};_0x31b40a(++_0x2af71e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('Action,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}
\ No newline at end of file
index 91174d9..2eff78f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1edc=['/:id','isAuthenticated','update','destroy','multer','util','connect-timeout','Router','../../components/interaction/service','./action.controller','put'];(function(_0x277c0a,_0x5e6808){var _0x294e63=function(_0x31f270){while(--_0x31f270){_0x277c0a['push'](_0x277c0a['shift']());}};_0x294e63(++_0x5e6808);}(_0x1edc,0x1a6));var _0xc1ed=function(_0x86527a,_0x2787c6){_0x86527a=_0x86527a-0x0;var _0x2f14b6=_0x1edc[_0x86527a];return _0x2f14b6;};'use strict';var multer=require(_0xc1ed('0x0'));var util=require(_0xc1ed('0x1'));var path=require('path');var timeout=require(_0xc1ed('0x2'));var express=require('express');var router=express[_0xc1ed('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc1ed('0x4'));var config=require('../../config/environment');var controller=require(_0xc1ed('0x5'));router[_0xc1ed('0x6')](_0xc1ed('0x7'),auth[_0xc1ed('0x8')](),controller[_0xc1ed('0x9')]);router['delete']('/:id',auth[_0xc1ed('0x8')](),controller[_0xc1ed('0xa')]);module['exports']=router;
\ No newline at end of file
+var _0x572e=['isAuthenticated','update','delete','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id'];(function(_0x38e297,_0x1dae38){var _0x94dff=function(_0x683c3){while(--_0x683c3){_0x38e297['push'](_0x38e297['shift']());}};_0x94dff(++_0x1dae38);}(_0x572e,0xa9));var _0xe572=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x572e[_0x543084];return _0x306a57;};'use strict';var multer=require(_0xe572('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe572('0x1'));var express=require(_0xe572('0x2'));var router=express[_0xe572('0x3')]();var fs_extra=require(_0xe572('0x4'));var auth=require(_0xe572('0x5'));var interaction=require(_0xe572('0x6'));var config=require(_0xe572('0x7'));var controller=require(_0xe572('0x8'));router[_0xe572('0x9')](_0xe572('0xa'),auth[_0xe572('0xb')](),controller[_0xe572('0xc')]);router[_0xe572('0xd')](_0xe572('0xa'),auth['isAuthenticated'](),controller[_0xe572('0xe')]);module['exports']=router;
\ No newline at end of file
index 860f285..0ecf005 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x31f0=['sequelize','STRING','TEXT'];(function(_0x57d6cd,_0x3346da){var _0xea723c=function(_0x35ba22){while(--_0x35ba22){_0x57d6cd['push'](_0x57d6cd['shift']());}};_0xea723c(++_0x3346da);}(_0x31f0,0xb7));var _0x031f=function(_0x125e0c,_0x483c68){_0x125e0c=_0x125e0c-0x0;var _0x3a21ac=_0x31f0[_0x125e0c];return _0x3a21ac;};'use strict';var Sequelize=require(_0x031f('0x0'));module['exports']={'name':{'type':Sequelize[_0x031f('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x031f('0x1')]},'table':{'type':Sequelize[_0x031f('0x1')]},'conditions':{'type':Sequelize[_0x031f('0x2')]},'joins':{'type':Sequelize[_0x031f('0x2')]}};
\ No newline at end of file
+var _0x5075=['exports','STRING','TEXT','sequelize'];(function(_0x17fea7,_0x102927){var _0x3150c3=function(_0x1d6bd0){while(--_0x1d6bd0){_0x17fea7['push'](_0x17fea7['shift']());}};_0x3150c3(++_0x102927);}(_0x5075,0x73));var _0x5507=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x5075[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'name':{'type':Sequelize[_0x5507('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5507('0x2')]},'parent':{'type':Sequelize[_0x5507('0x2')]},'table':{'type':Sequelize[_0x5507('0x2')]},'conditions':{'type':Sequelize[_0x5507('0x3')]},'joins':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 892f14c..cf94656 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02f9=['type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','create','body','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','preview','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','parentKey','conditions','Limited\x20Query:','toString','sequelize','SUM(%s)','MIN(%s)','AVG(%s)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','value','Sequelize','AnalyticMetric','table','replace','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','custom','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','savename','countTable','COUNT(*)','QueryTypes','SELECT','run','MAX(%s)','GROUP_CONCAT(%s)','debug','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','CustomReports','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02f9,0x123));var _0x902f=function(_0x5e2a72,_0x725538){_0x5e2a72=_0x5e2a72-0x0;var _0x401b4d=_0x02f9[_0x5e2a72];return _0x401b4d;};'use strict';var emlformat=require(_0x902f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x902f('0x1'));var rp=require(_0x902f('0x2'));var moment=require(_0x902f('0x3'));var BPromise=require(_0x902f('0x4'));var Mustache=require(_0x902f('0x5'));var util=require(_0x902f('0x6'));var path=require(_0x902f('0x7'));var sox=require(_0x902f('0x8'));var csv=require(_0x902f('0x9'));var ejs=require(_0x902f('0xa'));var fs=require('fs');var fs_extra=require(_0x902f('0xb'));var _=require(_0x902f('0xc'));var squel=require(_0x902f('0xd'));var crypto=require(_0x902f('0xe'));var jsforce=require(_0x902f('0xf'));var deskjs=require(_0x902f('0x10'));var toCsv=require(_0x902f('0x9'));var querystring=require(_0x902f('0x11'));var Papa=require('papaparse');var Redis=require(_0x902f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x902f('0x13'));var as=require(_0x902f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x902f('0x15'))(_0x902f('0x16'));var utils=require(_0x902f('0x17'));var config=require(_0x902f('0x18'));var licenseUtil=require(_0x902f('0x19'));var db=require('../../mysqldb')['db'];var dbH=require(_0x902f('0x1a'))[_0x902f('0x1b')];function respondWithStatusCode(_0x3a814a,_0x5f3674){_0x5f3674=_0x5f3674||0xcc;return function(_0x4c9bd3){if(_0x4c9bd3){return _0x3a814a['sendStatus'](_0x5f3674);}return _0x3a814a[_0x902f('0x1c')](_0x5f3674)['end']();};}function respondWithResult(_0x1ea973,_0x37dcff){_0x37dcff=_0x37dcff||0xc8;return function(_0x5e15b9){if(_0x5e15b9){return _0x1ea973[_0x902f('0x1c')](_0x37dcff)[_0x902f('0x1d')](_0x5e15b9);}};}function respondWithFilteredResult(_0x5c7d30,_0x1cc4e1){return function(_0x209960){if(_0x209960){var _0x3d3cfa=typeof _0x1cc4e1['offset']===_0x902f('0x1e')&&typeof _0x1cc4e1[_0x902f('0x1f')]==='undefined';var _0x370ccf=_0x209960[_0x902f('0x20')];var _0x2342c3=_0x3d3cfa?0x0:_0x1cc4e1['offset'];var _0xd79537=_0x3d3cfa?_0x209960['count']:_0x1cc4e1[_0x902f('0x21')]+_0x1cc4e1[_0x902f('0x1f')];var _0x1f5433;if(_0xd79537>=_0x370ccf){_0xd79537=_0x370ccf;_0x1f5433=0xc8;}else{_0x1f5433=0xce;}_0x5c7d30['status'](_0x1f5433);return _0x5c7d30[_0x902f('0x22')](_0x902f('0x23'),_0x2342c3+'-'+_0xd79537+'/'+_0x370ccf)['json'](_0x209960);}return null;};}function patchUpdates(_0x59d128){return function(_0x203dd4){try{jsonpatch[_0x902f('0x24')](_0x203dd4,_0x59d128,!![]);}catch(_0x25f567){return BPromise[_0x902f('0x25')](_0x25f567);}return _0x203dd4[_0x902f('0x26')]();};}function saveUpdates(_0x11c7c5,_0x54ae37){return function(_0x22299f){if(_0x22299f){return _0x22299f[_0x902f('0x27')](_0x11c7c5)[_0x902f('0x28')](function(_0x117982){return _0x117982;});}return null;};}function removeEntity(_0x3401aa,_0x4b62f2){return function(_0x2bb6f0){if(_0x2bb6f0){return _0x2bb6f0['destroy']()['then'](function(){var _0x34e389=_0x2bb6f0[_0x902f('0x29')]({'plain':!![]});var _0x279880=_0x902f('0x2a');return db[_0x902f('0x2b')]['destroy']({'where':{'type':_0x279880,'resourceId':_0x34e389['id']}})['then'](function(){return _0x2bb6f0;});})[_0x902f('0x28')](function(){_0x3401aa[_0x902f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31fdd1,_0x40d2b0){return function(_0x801aea){if(!_0x801aea){_0x31fdd1[_0x902f('0x2c')](0x194);}return _0x801aea;};}function handleError(_0x37f785,_0xea2be0){_0xea2be0=_0xea2be0||0x1f4;return function(_0x238f07){logger[_0x902f('0x2d')](_0x238f07[_0x902f('0x2e')]);if(_0x238f07[_0x902f('0x2f')]){delete _0x238f07[_0x902f('0x2f')];}_0x37f785[_0x902f('0x1c')](_0xea2be0)[_0x902f('0x30')](_0x238f07);};}exports[_0x902f('0x31')]=function(_0x1d931f,_0x324075){var _0x3e653f={},_0x81d741={},_0x422b04={'count':0x0,'rows':[]};var _0x41003f=_[_0x902f('0x32')](db['AnalyticCustomReport'][_0x902f('0x33')],function(_0x3092e4){return{'name':_0x3092e4[_0x902f('0x34')],'type':_0x3092e4[_0x902f('0x35')][_0x902f('0x36')]};});_0x81d741[_0x902f('0x37')]=_[_0x902f('0x32')](_0x41003f,'name');_0x81d741['query']=_[_0x902f('0x38')](_0x1d931f[_0x902f('0x39')]);_0x81d741[_0x902f('0x3a')]=_[_0x902f('0x3b')](_0x81d741[_0x902f('0x37')],_0x81d741[_0x902f('0x39')]);_0x3e653f[_0x902f('0x3c')]=_['intersection'](_0x81d741['model'],qs['fields'](_0x1d931f[_0x902f('0x39')][_0x902f('0x3d')]));_0x3e653f[_0x902f('0x3c')]=_0x3e653f['attributes'][_0x902f('0x3e')]?_0x3e653f[_0x902f('0x3c')]:_0x81d741[_0x902f('0x37')];if(!_0x1d931f[_0x902f('0x39')][_0x902f('0x3f')]('nolimit')){_0x3e653f[_0x902f('0x1f')]=qs['limit'](_0x1d931f[_0x902f('0x39')]['limit']);_0x3e653f[_0x902f('0x21')]=qs['offset'](_0x1d931f['query']['offset']);}_0x3e653f[_0x902f('0x40')]=qs[_0x902f('0x41')](_0x1d931f['query']['sort']);_0x3e653f[_0x902f('0x42')]=qs[_0x902f('0x3a')](_[_0x902f('0x43')](_0x1d931f[_0x902f('0x39')],_0x81d741[_0x902f('0x3a')]),_0x41003f);if(_0x1d931f['query'][_0x902f('0x44')]){_0x3e653f[_0x902f('0x42')]=_[_0x902f('0x45')](_0x3e653f['where'],{'$or':_[_0x902f('0x32')](_0x41003f,function(_0x2bc9aa){if(_0x2bc9aa[_0x902f('0x35')]!==_0x902f('0x46')){var _0xb68a4f={};_0xb68a4f[_0x2bc9aa['name']]={'$like':'%'+_0x1d931f['query'][_0x902f('0x44')]+'%'};return _0xb68a4f;}})});}_0x3e653f=_['merge']({},_0x3e653f,_0x1d931f[_0x902f('0x47')]);var _0x520c2c={'where':_0x3e653f[_0x902f('0x42')]};return db[_0x902f('0x48')][_0x902f('0x20')](_0x520c2c)['then'](function(_0x240ec2){_0x422b04[_0x902f('0x20')]=_0x240ec2;if(_0x1d931f[_0x902f('0x39')][_0x902f('0x49')]){_0x3e653f[_0x902f('0x4a')]=[{'all':!![]}];}return db[_0x902f('0x48')][_0x902f('0x4b')](_0x3e653f);})[_0x902f('0x28')](function(_0x32b9b2){_0x422b04[_0x902f('0x4c')]=_0x32b9b2;return _0x422b04;})[_0x902f('0x28')](respondWithFilteredResult(_0x324075,_0x3e653f))[_0x902f('0x4d')](handleError(_0x324075,null));};exports[_0x902f('0x4e')]=function(_0x1219f0,_0x4e01ce){var _0x444c37={'raw':![],'where':{'id':_0x1219f0[_0x902f('0x4f')]['id']}},_0x2910fd={};_0x2910fd[_0x902f('0x37')]=_[_0x902f('0x38')](db[_0x902f('0x48')]['rawAttributes']);_0x2910fd[_0x902f('0x39')]=_[_0x902f('0x38')](_0x1219f0[_0x902f('0x39')]);_0x2910fd['filters']=_[_0x902f('0x3b')](_0x2910fd['model'],_0x2910fd[_0x902f('0x39')]);_0x444c37[_0x902f('0x3c')]=_['intersection'](_0x2910fd[_0x902f('0x37')],qs[_0x902f('0x3d')](_0x1219f0['query'][_0x902f('0x3d')]));_0x444c37[_0x902f('0x3c')]=_0x444c37[_0x902f('0x3c')][_0x902f('0x3e')]?_0x444c37['attributes']:_0x2910fd[_0x902f('0x37')];if(_0x1219f0[_0x902f('0x39')][_0x902f('0x49')]){_0x444c37[_0x902f('0x4a')]=[{'all':!![]}];}_0x444c37=_[_0x902f('0x45')]({},_0x444c37,_0x1219f0[_0x902f('0x47')]);return db[_0x902f('0x48')]['find'](_0x444c37)['then'](handleEntityNotFound(_0x4e01ce,null))[_0x902f('0x28')](respondWithResult(_0x4e01ce,null))['catch'](handleError(_0x4e01ce,null));};exports[_0x902f('0x50')]=function(_0x4371d1,_0x1243f0){return db['AnalyticCustomReport']['create'](_0x4371d1[_0x902f('0x51')],{})[_0x902f('0x28')](function(_0x3c113f){var _0x5557f1=_0x4371d1['user'][_0x902f('0x29')]({'plain':!![]});if(!_0x5557f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5557f1[_0x902f('0x52')]===_0x902f('0x53')){var _0x5aacc5=_0x3c113f[_0x902f('0x29')]({'plain':!![]});var _0x978137=_0x902f('0x54');return db[_0x902f('0x55')]['find']({'where':{'name':_0x978137,'userProfileId':_0x5557f1[_0x902f('0x56')]},'raw':!![]})['then'](function(_0x1a539f){if(_0x1a539f&&_0x1a539f[_0x902f('0x57')]===0x0){return db[_0x902f('0x2b')][_0x902f('0x50')]({'name':_0x5aacc5['name'],'resourceId':_0x5aacc5['id'],'type':_0x902f('0x2a'),'sectionId':_0x1a539f['id']},{})['then'](function(){return _0x3c113f;});}else{return _0x3c113f;}})['catch'](function(_0x589ef1){logger['error'](_0x902f('0x58'),_0x589ef1);throw _0x589ef1;});}return _0x3c113f;})[_0x902f('0x28')](respondWithResult(_0x1243f0,0xc9))[_0x902f('0x4d')](handleError(_0x1243f0,null));};exports[_0x902f('0x27')]=function(_0x5df97f,_0x541bae){if(_0x5df97f['body']['id']){delete _0x5df97f[_0x902f('0x51')]['id'];}return db[_0x902f('0x48')][_0x902f('0x59')]({'where':{'id':_0x5df97f[_0x902f('0x4f')]['id']}})[_0x902f('0x28')](handleEntityNotFound(_0x541bae,null))['then'](saveUpdates(_0x5df97f[_0x902f('0x51')],null))['then'](respondWithResult(_0x541bae,null))[_0x902f('0x4d')](handleError(_0x541bae,null));};exports['destroy']=function(_0x29e58a,_0x29a554){return db['AnalyticCustomReport'][_0x902f('0x59')]({'where':{'id':_0x29e58a[_0x902f('0x4f')]['id']}})[_0x902f('0x28')](handleEntityNotFound(_0x29a554,null))[_0x902f('0x28')](removeEntity(_0x29a554,null))[_0x902f('0x4d')](handleError(_0x29a554,null));};exports[_0x902f('0x5a')]=function(_0x4c188c,_0x1a0a50){var _0x46bd02=0xa;var _0x3e0930=[_0x902f('0x5b'),_0x902f('0x5c'),_0x902f('0x5d'),_0x902f('0x5e')];var _0x56f5f7={'SUM':'SUM(%s)','COUNT':_0x902f('0x5f'),'COUNT DISTINCT':_0x902f('0x60'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x902f('0x61'),'GROUP_CONCAT DESC':_0x902f('0x62')};var _0x346e9a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x902f('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x902f('0x64')};var _0x5006ee=function(_0x240c6b){return!_[_0x902f('0x65')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x902f('0x66'),_0x902f('0x67')],_0x240c6b);};var _0x3f6176=function(_0xf60655){if(!_0xf60655||!_0xf60655[_0x902f('0x68')][_0x902f('0x3e')]){return'';}for(var _0x40d5ec='(',_0x38e7a2=0x0;_0x38e7a2<_0xf60655[_0x902f('0x68')][_0x902f('0x3e')];_0x38e7a2+=0x1){_0x38e7a2>0x0&&(_0x40d5ec+='\x20'+_0xf60655[_0x902f('0x69')]+'\x20');_0x40d5ec+=_0xf60655[_0x902f('0x68')][_0x38e7a2][_0x902f('0x6a')]?_0x3f6176(_0xf60655[_0x902f('0x68')][_0x38e7a2][_0x902f('0x6a')]):_0xf60655['rules'][_0x38e7a2][_0x902f('0x6b')]+'\x20'+_0xf60655[_0x902f('0x68')][_0x38e7a2][_0x902f('0x6c')]+(_0x5006ee(_0xf60655[_0x902f('0x68')][_0x38e7a2][_0x902f('0x6c')])?'\x20'+_0xf60655[_0x902f('0x68')][_0x38e7a2]['value']:'');}return _0x40d5ec+')';};var _0x567901={'where':{'id':_0x4c188c[_0x902f('0x4f')]['id']}},_0x3d4821,_0x1293c1,_0x1299eb,_0x5bad19,_0x4a0bce;_0x567901=_[_0x902f('0x45')]({},_0x567901,_0x4c188c[_0x902f('0x47')]);return db[_0x902f('0x48')][_0x902f('0x59')](_0x567901)[_0x902f('0x28')](function(_0x19839c){if(_0x19839c){_0x3d4821=_0x19839c;return _0x19839c[_0x902f('0x6d')]();}return null;})[_0x902f('0x28')](function(_0x28d250){if(_0x28d250){if(!_0x28d250[_0x902f('0x3e')]){throw new db['Sequelize'][(_0x902f('0x6e'))](_0x902f('0x6f'),0x193);}_0x1293c1=_0x28d250;return db['AnalyticMetric'][_0x902f('0x4b')]({'raw':!![]});}return null;})[_0x902f('0x28')](function(_0x552f5c){if(_0x552f5c){_0x1299eb=_[_0x902f('0x70')](_0x552f5c,'id');var _0x19fbce;var _0x4199f6=squel[_0x902f('0x71')]();_0x4199f6[_0x902f('0x72')](_0x3d4821['table']);for(var _0x15fa08=0x0;_0x15fa08<_0x1293c1[_0x902f('0x3e')];_0x15fa08+=0x1){_0x19fbce=_0x1293c1[_0x15fa08][_0x902f('0x73')]?_0x1299eb[_0x1293c1[_0x15fa08][_0x902f('0x73')]][_0x902f('0x74')]:_0x1293c1[_0x15fa08][_0x902f('0x6b')];_0x19fbce=_0x1293c1[_0x15fa08][_0x902f('0x75')]?_['replace'](_0x56f5f7[_0x1293c1[_0x15fa08][_0x902f('0x75')]],'%s',_0x19fbce):_0x19fbce;_0x19fbce=_0x1293c1[_0x15fa08]['format']?_['replace'](_0x346e9a[_0x1293c1[_0x15fa08][_0x902f('0x76')]],'%s',_0x19fbce):_0x19fbce;if(_0x1293c1[_0x15fa08][_0x902f('0x77')]){_0x4199f6[_0x902f('0x6a')](_0x19fbce);}_0x1293c1[_0x15fa08][_0x902f('0x78')]&&_0x4199f6[_0x902f('0x40')](_0x19fbce,_0x1293c1[_0x15fa08][_0x902f('0x78')]===_0x902f('0x79')?![]:!![]);_0x4199f6['field'](_0x19fbce,_0x1293c1[_0x15fa08][_0x902f('0x7a')]||_0x19fbce);}if(_0x3d4821[_0x902f('0x7b')]){_0x3d4821['joins']=JSON[_0x902f('0x7c')](_0x3d4821[_0x902f('0x7b')]);for(var _0x4d1eb5=0x0;_0x4d1eb5<_0x3d4821['joins'][_0x902f('0x3e')];_0x4d1eb5+=0x1){if(_0x3d4821['joins'][_0x4d1eb5]['type']&&_[_0x902f('0x65')](_0x3e0930,_0x3d4821['joins'][_0x4d1eb5][_0x902f('0x35')])&&_0x3d4821['joins'][_0x4d1eb5]['parentKey']&&_0x3d4821[_0x902f('0x7b')][_0x4d1eb5][_0x902f('0x7d')]&&_0x3d4821[_0x902f('0x7b')][_0x4d1eb5][_0x902f('0x7e')]){_0x4199f6[_0x3d4821[_0x902f('0x7b')][_0x4d1eb5][_0x902f('0x35')]](_0x3d4821['joins'][_0x4d1eb5]['foreignTable'],null,util[_0x902f('0x76')](_0x902f('0x7f'),_0x3d4821['table'],_0x3d4821[_0x902f('0x7b')][_0x4d1eb5][_0x902f('0x80')],_0x3d4821[_0x902f('0x7b')][_0x4d1eb5][_0x902f('0x7d')],_0x3d4821['joins'][_0x4d1eb5][_0x902f('0x7e')]));}}}if(_0x3d4821[_0x902f('0x81')]){_0x3d4821[_0x902f('0x81')]=JSON['parse'](_0x3d4821[_0x902f('0x81')]);_0x4199f6['where'](_0x3f6176(_0x3d4821['conditions']['group']));}_0x4a0bce=_0x4199f6['clone']();_0x4199f6[_0x902f('0x1f')](_0x46bd02);_0x4199f6['offset'](0x0);logger['debug'](_0x902f('0x82'),_0x4199f6[_0x902f('0x83')]());return dbH[_0x902f('0x84')][_0x902f('0x39')](_0x4199f6[_0x902f('0x83')](),{'type':dbH[_0x902f('0x84')]['QueryTypes']['SELECT']});}})[_0x902f('0x28')](respondWithResult(_0x1a0a50,null))[_0x902f('0x4d')](handleError(_0x1a0a50,null));};function runReport(_0xbcfc5a,_0xc3d844,_0x2b1b2f){var _0x5ed895=_0xc3d844[_0x902f('0x2f')];var _0x5658d0=0xa;var _0x27f966=[_0x902f('0x5b'),_0x902f('0x5c'),'right_join','cross_join'];var _0x47b49e={'SUM':_0x902f('0x85'),'COUNT':_0x902f('0x5f'),'COUNT DISTINCT':_0x902f('0x60'),'MAX':'MAX(%s)','MIN':_0x902f('0x86'),'AVG':_0x902f('0x87'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x902f('0x61'),'GROUP_CONCAT DESC':_0x902f('0x62')};var _0x416148={'SEC_TO_TIME':_0x902f('0x88'),'DATE':_0x902f('0x89'),'HOUR':_0x902f('0x63'),'ROUND':_0x902f('0x8a'),'UNIX_TIMESTAMP':_0x902f('0x64')};var _0x4bc902=function(_0x4edd29){return!_[_0x902f('0x65')]([_0x902f('0x8b'),_0x902f('0x8c'),_0x902f('0x66'),_0x902f('0x67')],_0x4edd29);};var _0x4ac040=function(_0x50ad48){if(!_0x50ad48||!_0x50ad48[_0x902f('0x68')][_0x902f('0x3e')]){return'';}for(var _0x5c8d82='(',_0x474a4f=0x0;_0x474a4f<_0x50ad48[_0x902f('0x68')]['length'];_0x474a4f+=0x1){_0x474a4f>0x0&&(_0x5c8d82+='\x20'+_0x50ad48[_0x902f('0x69')]+'\x20');_0x5c8d82+=_0x50ad48[_0x902f('0x68')][_0x474a4f][_0x902f('0x6a')]?_0x4ac040(_0x50ad48[_0x902f('0x68')][_0x474a4f][_0x902f('0x6a')]):_0x50ad48[_0x902f('0x68')][_0x474a4f][_0x902f('0x6b')]+'\x20'+_0x50ad48[_0x902f('0x68')][_0x474a4f]['condition']+(_0x4bc902(_0x50ad48[_0x902f('0x68')][_0x474a4f]['condition'])?'\x20'+_0x50ad48[_0x902f('0x68')][_0x474a4f][_0x902f('0x8d')]:'');}return _0x5c8d82+')';};var _0x2dd228={'where':{'id':_0xbcfc5a['id']}},_0x1fda4e,_0x5b3a3e,_0x1f9e9b,_0x4ce738,_0x523bdd;_0x2dd228=_[_0x902f('0x45')]({},_0x2dd228,_0x2b1b2f);return db[_0x902f('0x48')][_0x902f('0x59')](_0x2dd228)[_0x902f('0x28')](function(_0x4e6cb2){if(_0x4e6cb2){_0x1fda4e=_0x4e6cb2;return _0x4e6cb2['getFields']();}return null;})['then'](function(_0x6be522){if(_0x6be522){if(!_0x6be522[_0x902f('0x3e')]){throw new db[(_0x902f('0x8e'))][(_0x902f('0x6e'))](_0x902f('0x6f'),0x193);}_0x5b3a3e=_0x6be522;return db[_0x902f('0x8f')][_0x902f('0x4b')]({'raw':!![]});}return null;})[_0x902f('0x28')](function(_0x334e15){if(_0x334e15){_0x1f9e9b=_['keyBy'](_0x334e15,'id');var _0x59b649;var _0x5cc526=squel[_0x902f('0x71')]();_0x5cc526[_0x902f('0x72')](_0x1fda4e[_0x902f('0x90')]);for(var _0x5a4f0d=0x0;_0x5a4f0d<_0x5b3a3e[_0x902f('0x3e')];_0x5a4f0d+=0x1){_0x59b649=_0x5b3a3e[_0x5a4f0d][_0x902f('0x73')]?_0x1f9e9b[_0x5b3a3e[_0x5a4f0d][_0x902f('0x73')]][_0x902f('0x74')]:_0x5b3a3e[_0x5a4f0d]['field'];_0x59b649=_0x5b3a3e[_0x5a4f0d]['function']?_[_0x902f('0x91')](_0x47b49e[_0x5b3a3e[_0x5a4f0d][_0x902f('0x75')]],'%s',_0x59b649):_0x59b649;_0x59b649=_0x5b3a3e[_0x5a4f0d][_0x902f('0x76')]?_[_0x902f('0x91')](_0x416148[_0x5b3a3e[_0x5a4f0d][_0x902f('0x76')]],'%s',_0x59b649):_0x59b649;if(_0x5b3a3e[_0x5a4f0d]['groupBy']){_0x5cc526[_0x902f('0x6a')](_0x59b649);}_0x5b3a3e[_0x5a4f0d][_0x902f('0x78')]&&_0x5cc526['order'](_0x59b649,_0x5b3a3e[_0x5a4f0d][_0x902f('0x78')]===_0x902f('0x79')?![]:!![]);_0x5cc526['field'](_0x59b649,_0x5b3a3e[_0x5a4f0d][_0x902f('0x7a')]||_0x59b649);}if(_0x1fda4e['joins']){_0x1fda4e['joins']=JSON[_0x902f('0x7c')](_0x1fda4e['joins']);for(var _0x16c7ae=0x0;_0x16c7ae<_0x1fda4e[_0x902f('0x7b')]['length'];_0x16c7ae+=0x1){if(_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x35')]&&_[_0x902f('0x65')](_0x27f966,_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x35')])&&_0x1fda4e[_0x902f('0x7b')][_0x16c7ae]['parentKey']&&_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x7d')]&&_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x7e')]){_0x5cc526[_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x35')]](_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x7d')],null,util[_0x902f('0x76')]('%s.%s\x20=\x20%s.%s',_0x1fda4e['table'],_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x80')],_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x7d')],_0x1fda4e[_0x902f('0x7b')][_0x16c7ae][_0x902f('0x7e')]));}}}if(_0x1fda4e[_0x902f('0x81')]){_0x1fda4e[_0x902f('0x81')]=JSON['parse'](_0x1fda4e[_0x902f('0x81')]);_0x5cc526[_0x902f('0x42')](_0x4ac040(_0x1fda4e['conditions'][_0x902f('0x6a')]));}_0x523bdd=_0x5cc526[_0x902f('0x92')]();_0x5cc526[_0x902f('0x1f')](_0x5658d0);_0x5cc526[_0x902f('0x21')](0x0);return;}})[_0x902f('0x28')](function(){if(_0xc3d844[_0x902f('0x93')]===_0x902f('0x94')){return null;}var _0x44a381=_[_0x902f('0x45')](_0xc3d844,{'name':_0xc3d844[_0x902f('0x95')]||_0xc3d844[_0x902f('0x2f')]||_0x1fda4e[_0x902f('0x2f')],'basename':_0x5ed895,'savename':util[_0x902f('0x76')](_0x902f('0x96'),_0xc3d844['name']||_0x1fda4e[_0x902f('0x2f')],require(_0x902f('0x97'))[_0x902f('0x98')](0x4),_0xc3d844[_0x902f('0x93')]||_0x902f('0x99')),'reportId':_0x1fda4e['id'],'reportType':_0x902f('0x9a')});return db['AnalyticExtractedReport'][_0x902f('0x50')](_0x44a381,{'raw':!![]});})[_0x902f('0x28')](function(_0x1a934e){if(_0x1fda4e[_0x902f('0x90')]==='cdr'){_0x523bdd[_0x902f('0x42')](_0x1fda4e[_0x902f('0x90')]+_0x902f('0x9b'),_0xc3d844[_0x902f('0x9c')],_0xc3d844['endDate']);}else{_0x523bdd[_0x902f('0x42')](_0x1fda4e[_0x902f('0x90')]+_0x902f('0x9d'),_0xc3d844[_0x902f('0x9c')],_0xc3d844[_0x902f('0x9e')]);}if(_0x1a934e){logger[_0x902f('0x9f')](_0x902f('0xa0'),_0x523bdd[_0x902f('0x83')]());require(_0x902f('0xa1'))[_0x902f('0xa2')](path[_0x902f('0x5b')](__dirname,'../../components/export/',_0x1a934e['output']),[_0x1a934e['id'],_0x523bdd[_0x902f('0x83')](),path['join'](__dirname,'../../files/reports',_0x1a934e[_0x902f('0xa3')]),_0x5ed895]);return _0x1a934e;}else{var _0x5be7f1=squel[_0x902f('0x71')]();_0x5be7f1[_0x902f('0x72')]('('+_0x523bdd[_0x902f('0x83')]()+')',_0x902f('0xa4'));_0x5be7f1[_0x902f('0x6b')](_0x902f('0xa5'),_0x902f('0x20'));_0x523bdd[_0x902f('0x1f')](_0xc3d844[_0x902f('0x1f')]||_0x5658d0);_0x523bdd[_0x902f('0x21')](_0xc3d844[_0x902f('0x21')]||0x0);return dbH['sequelize'][_0x902f('0x39')](_0x5be7f1[_0x902f('0x83')](),{'type':dbH[_0x902f('0x84')][_0x902f('0xa6')][_0x902f('0xa7')]})['then'](function(_0x4e9c2b){if(!_0x4e9c2b[_0x902f('0x3e')]){_0x4ce738=0x0;}else{_0x4ce738=_0x4e9c2b[0x0][_0x902f('0x20')]||0x0;}return dbH['sequelize'][_0x902f('0x39')](_0x523bdd[_0x902f('0x83')](),{'type':dbH['sequelize'][_0x902f('0xa6')][_0x902f('0xa7')]});})[_0x902f('0x28')](function(_0x5485b2){return{'rows':_0x5485b2||[],'count':_0x4ce738};});}});}exports[_0x902f('0xa8')]=function(_0x2365a5,_0x16cd2e){return runReport(_0x2365a5[_0x902f('0x4f')],_0x2365a5[_0x902f('0x39')],_0x2365a5[_0x902f('0x47')])[_0x902f('0x28')](respondWithResult(_0x16cd2e,null))['catch'](handleError(_0x16cd2e,null));};exports['runReport']=runReport;exports[_0x902f('0x39')]=function(_0x1dc561,_0x5d515a){var _0x191c84=0xa;var _0x5596d2=[_0x902f('0x5b'),'left_join','right_join','cross_join'];var _0x4972b6={'SUM':_0x902f('0x85'),'COUNT':_0x902f('0x5f'),'COUNT DISTINCT':_0x902f('0x60'),'MAX':_0x902f('0xa9'),'MIN':'MIN(%s)','AVG':_0x902f('0x87'),'GROUP_CONCAT':_0x902f('0xaa'),'GROUP_CONCAT ASC':_0x902f('0x61'),'GROUP_CONCAT DESC':_0x902f('0x62')};var _0x2b3630={'SEC_TO_TIME':_0x902f('0x88'),'DATE':_0x902f('0x89'),'HOUR':_0x902f('0x63'),'ROUND':_0x902f('0x8a'),'UNIX_TIMESTAMP':_0x902f('0x64')};var _0x32dd23=function(_0x51e381){return!_['includes'](['IS\x20NULL',_0x902f('0x8c'),_0x902f('0x66'),_0x902f('0x67')],_0x51e381);};var _0x3b449e=function(_0x57a3c6){if(!_0x57a3c6||!_0x57a3c6['rules'][_0x902f('0x3e')]){return'';}for(var _0x587998='(',_0x3d5f7b=0x0;_0x3d5f7b<_0x57a3c6[_0x902f('0x68')][_0x902f('0x3e')];_0x3d5f7b+=0x1){_0x3d5f7b>0x0&&(_0x587998+='\x20'+_0x57a3c6[_0x902f('0x69')]+'\x20');_0x587998+=_0x57a3c6[_0x902f('0x68')][_0x3d5f7b]['group']?_0x3b449e(_0x57a3c6['rules'][_0x3d5f7b]['group']):_0x57a3c6['rules'][_0x3d5f7b][_0x902f('0x6b')]+'\x20'+_0x57a3c6[_0x902f('0x68')][_0x3d5f7b][_0x902f('0x6c')]+(_0x32dd23(_0x57a3c6['rules'][_0x3d5f7b][_0x902f('0x6c')])?'\x20'+_0x57a3c6[_0x902f('0x68')][_0x3d5f7b][_0x902f('0x8d')]:'');}return _0x587998+')';};var _0x1b6f0d={'where':{'id':_0x1dc561[_0x902f('0x4f')]['id']}},_0x5d5af0,_0x1b56cf,_0x5325f7,_0x5ea685,_0x343bc6;_0x1b6f0d=_[_0x902f('0x45')]({},_0x1b6f0d,_0x1dc561['options']);return db[_0x902f('0x48')][_0x902f('0x59')](_0x1b6f0d)[_0x902f('0x28')](function(_0x5a4475){if(_0x5a4475){_0x5d5af0=_0x5a4475;return _0x5a4475[_0x902f('0x6d')]();}return null;})[_0x902f('0x28')](function(_0xc06441){if(_0xc06441){if(!_0xc06441['length']){throw new db[(_0x902f('0x8e'))]['ValidationErrorItem'](_0x902f('0x6f'),0x193);}_0x1b56cf=_0xc06441;return db[_0x902f('0x8f')][_0x902f('0x4b')]({'raw':!![]});}return null;})[_0x902f('0x28')](function(_0x2d4f88){if(_0x2d4f88){_0x5325f7=_[_0x902f('0x70')](_0x2d4f88,'id');var _0xe6860c;var _0x50a01d=squel[_0x902f('0x71')]();_0x50a01d[_0x902f('0x72')](_0x5d5af0['table']);for(var _0x9e85da=0x0;_0x9e85da<_0x1b56cf[_0x902f('0x3e')];_0x9e85da+=0x1){_0xe6860c=_0x1b56cf[_0x9e85da][_0x902f('0x73')]?_0x5325f7[_0x1b56cf[_0x9e85da][_0x902f('0x73')]][_0x902f('0x74')]:_0x1b56cf[_0x9e85da][_0x902f('0x6b')];_0xe6860c=_0x1b56cf[_0x9e85da][_0x902f('0x75')]?_[_0x902f('0x91')](_0x4972b6[_0x1b56cf[_0x9e85da]['function']],'%s',_0xe6860c):_0xe6860c;_0xe6860c=_0x1b56cf[_0x9e85da][_0x902f('0x76')]?_[_0x902f('0x91')](_0x2b3630[_0x1b56cf[_0x9e85da][_0x902f('0x76')]],'%s',_0xe6860c):_0xe6860c;if(_0x1b56cf[_0x9e85da][_0x902f('0x77')]){_0x50a01d['group'](_0xe6860c);}_0x1b56cf[_0x9e85da][_0x902f('0x78')]&&_0x50a01d[_0x902f('0x40')](_0xe6860c,_0x1b56cf[_0x9e85da]['orderBy']===_0x902f('0x79')?![]:!![]);_0x50a01d['field'](_0xe6860c,_0x1b56cf[_0x9e85da][_0x902f('0x7a')]||_0xe6860c);}if(_0x5d5af0[_0x902f('0x7b')]){_0x5d5af0[_0x902f('0x7b')]=JSON[_0x902f('0x7c')](_0x5d5af0[_0x902f('0x7b')]);for(var _0x87083b=0x0;_0x87083b<_0x5d5af0[_0x902f('0x7b')][_0x902f('0x3e')];_0x87083b+=0x1){if(_0x5d5af0[_0x902f('0x7b')][_0x87083b][_0x902f('0x35')]&&_[_0x902f('0x65')](_0x5596d2,_0x5d5af0[_0x902f('0x7b')][_0x87083b]['type'])&&_0x5d5af0['joins'][_0x87083b][_0x902f('0x80')]&&_0x5d5af0[_0x902f('0x7b')][_0x87083b][_0x902f('0x7d')]&&_0x5d5af0[_0x902f('0x7b')][_0x87083b]['foreignKey']){_0x50a01d[_0x5d5af0[_0x902f('0x7b')][_0x87083b][_0x902f('0x35')]](_0x5d5af0['joins'][_0x87083b][_0x902f('0x7d')],null,util['format'](_0x902f('0x7f'),_0x5d5af0[_0x902f('0x90')],_0x5d5af0[_0x902f('0x7b')][_0x87083b][_0x902f('0x80')],_0x5d5af0[_0x902f('0x7b')][_0x87083b][_0x902f('0x7d')],_0x5d5af0[_0x902f('0x7b')][_0x87083b][_0x902f('0x7e')]));}}}if(_0x5d5af0['conditions']){_0x5d5af0[_0x902f('0x81')]=JSON[_0x902f('0x7c')](_0x5d5af0[_0x902f('0x81')]);_0x50a01d[_0x902f('0x42')](_0x3b449e(_0x5d5af0[_0x902f('0x81')][_0x902f('0x6a')]));}_0x343bc6=_0x50a01d[_0x902f('0x92')]();_0x50a01d[_0x902f('0x1f')](_0x191c84);_0x50a01d[_0x902f('0x21')](0x0);logger[_0x902f('0xab')](_0x902f('0x82'),_0x50a01d[_0x902f('0x83')]());return dbH['sequelize']['query'](_0x50a01d[_0x902f('0x83')](),{'type':dbH[_0x902f('0x84')][_0x902f('0xa6')][_0x902f('0xa7')]});}})[_0x902f('0x28')](function(){return{'sql':_0x343bc6['toString']()};})[_0x902f('0x28')](respondWithResult(_0x5d515a,null))[_0x902f('0x4d')](handleError(_0x5d515a,null));};
\ No newline at end of file
+var _0x943a=['COUNT(*)','run','alias','debug','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','CustomReports','UserProfileResource','end','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','include','show','params','keys','includeAll','merge','find','catch','user','userProfileId','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','parse','joins','includes','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','MAX(%s)','MIN(%s)','HOUR(%s)','IS\x20NOT\x20NULL','select','output','fullPath','%s-%s.%s','csv','custom','AnalyticExtractedReport','startDate','endDate','info','fork','../../components/export/','../../files/reports','savename','countTable'];(function(_0xcfa248,_0x2a7988){var _0x2b3b34=function(_0x23d8b5){while(--_0x23d8b5){_0xcfa248['push'](_0xcfa248['shift']());}};_0x2b3b34(++_0x2a7988);}(_0x943a,0xa8));var _0xa943=function(_0x514614,_0x54c16d){_0x514614=_0x514614-0x0;var _0x334409=_0x943a[_0x514614];return _0x334409;};'use strict';var emlformat=require(_0xa943('0x0'));var rimraf=require(_0xa943('0x1'));var zipdir=require(_0xa943('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa943('0x3'));var moment=require(_0xa943('0x4'));var BPromise=require(_0xa943('0x5'));var Mustache=require(_0xa943('0x6'));var util=require(_0xa943('0x7'));var path=require(_0xa943('0x8'));var sox=require('sox');var csv=require(_0xa943('0x9'));var ejs=require(_0xa943('0xa'));var fs=require('fs');var fs_extra=require(_0xa943('0xb'));var _=require(_0xa943('0xc'));var squel=require(_0xa943('0xd'));var crypto=require(_0xa943('0xe'));var jsforce=require(_0xa943('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa943('0x9'));var querystring=require(_0xa943('0x10'));var Papa=require(_0xa943('0x11'));var Redis=require(_0xa943('0x12'));var authService=require(_0xa943('0x13'));var qs=require(_0xa943('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa943('0x15'));var logger=require('../../config/logger')(_0xa943('0x16'));var utils=require(_0xa943('0x17'));var config=require(_0xa943('0x18'));var licenseUtil=require(_0xa943('0x19'));var db=require(_0xa943('0x1a'))['db'];var dbH=require(_0xa943('0x1a'))[_0xa943('0x1b')];function respondWithStatusCode(_0x3d6e11,_0x2ee2de){_0x2ee2de=_0x2ee2de||0xcc;return function(_0x55b78c){if(_0x55b78c){return _0x3d6e11[_0xa943('0x1c')](_0x2ee2de);}return _0x3d6e11[_0xa943('0x1d')](_0x2ee2de)['end']();};}function respondWithResult(_0x398886,_0x2f96fb){_0x2f96fb=_0x2f96fb||0xc8;return function(_0x167d22){if(_0x167d22){return _0x398886['status'](_0x2f96fb)[_0xa943('0x1e')](_0x167d22);}};}function respondWithFilteredResult(_0xaebd65,_0xaa7b6c){return function(_0xad9e34){if(_0xad9e34){var _0x29f244=typeof _0xaa7b6c['offset']===_0xa943('0x1f')&&typeof _0xaa7b6c[_0xa943('0x20')]===_0xa943('0x1f');var _0x15661b=_0xad9e34[_0xa943('0x21')];var _0x14211e=_0x29f244?0x0:_0xaa7b6c[_0xa943('0x22')];var _0x5c064f=_0x29f244?_0xad9e34[_0xa943('0x21')]:_0xaa7b6c[_0xa943('0x22')]+_0xaa7b6c[_0xa943('0x20')];var _0x145f7b;if(_0x5c064f>=_0x15661b){_0x5c064f=_0x15661b;_0x145f7b=0xc8;}else{_0x145f7b=0xce;}_0xaebd65['status'](_0x145f7b);return _0xaebd65[_0xa943('0x23')](_0xa943('0x24'),_0x14211e+'-'+_0x5c064f+'/'+_0x15661b)[_0xa943('0x1e')](_0xad9e34);}return null;};}function patchUpdates(_0x272413){return function(_0x1c1c19){try{jsonpatch[_0xa943('0x25')](_0x1c1c19,_0x272413,!![]);}catch(_0x21e922){return BPromise[_0xa943('0x26')](_0x21e922);}return _0x1c1c19['save']();};}function saveUpdates(_0x503b6b,_0x20a02c){return function(_0x20334e){if(_0x20334e){return _0x20334e[_0xa943('0x27')](_0x503b6b)[_0xa943('0x28')](function(_0x2349f2){return _0x2349f2;});}return null;};}function removeEntity(_0x2bfb39,_0x506b22){return function(_0x5726ed){if(_0x5726ed){return _0x5726ed[_0xa943('0x29')]()[_0xa943('0x28')](function(){var _0x1ec032=_0x5726ed[_0xa943('0x2a')]({'plain':!![]});var _0x20b9b8=_0xa943('0x2b');return db[_0xa943('0x2c')][_0xa943('0x29')]({'where':{'type':_0x20b9b8,'resourceId':_0x1ec032['id']}})['then'](function(){return _0x5726ed;});})['then'](function(){_0x2bfb39[_0xa943('0x1d')](0xcc)[_0xa943('0x2d')]();});}};}function handleEntityNotFound(_0x42a90b,_0x17636b){return function(_0x3c2ecf){if(!_0x3c2ecf){_0x42a90b[_0xa943('0x1c')](0x194);}return _0x3c2ecf;};}function handleError(_0x1d4e66,_0x537efd){_0x537efd=_0x537efd||0x1f4;return function(_0x44ae37){logger['error'](_0x44ae37[_0xa943('0x2e')]);if(_0x44ae37[_0xa943('0x2f')]){delete _0x44ae37[_0xa943('0x2f')];}_0x1d4e66[_0xa943('0x1d')](_0x537efd)[_0xa943('0x30')](_0x44ae37);};}exports[_0xa943('0x31')]=function(_0x5bcda4,_0x110c9e){var _0x47b94c={},_0x561830={},_0x371e4f={'count':0x0,'rows':[]};var _0x549862=_[_0xa943('0x32')](db[_0xa943('0x33')][_0xa943('0x34')],function(_0x58b79d){return{'name':_0x58b79d[_0xa943('0x35')],'type':_0x58b79d['type'][_0xa943('0x36')]};});_0x561830['model']=_[_0xa943('0x32')](_0x549862,_0xa943('0x2f'));_0x561830[_0xa943('0x37')]=_['keys'](_0x5bcda4[_0xa943('0x37')]);_0x561830[_0xa943('0x38')]=_[_0xa943('0x39')](_0x561830[_0xa943('0x3a')],_0x561830[_0xa943('0x37')]);_0x47b94c[_0xa943('0x3b')]=_[_0xa943('0x39')](_0x561830['model'],qs['fields'](_0x5bcda4[_0xa943('0x37')][_0xa943('0x3c')]));_0x47b94c[_0xa943('0x3b')]=_0x47b94c['attributes'][_0xa943('0x3d')]?_0x47b94c[_0xa943('0x3b')]:_0x561830['model'];if(!_0x5bcda4[_0xa943('0x37')][_0xa943('0x3e')](_0xa943('0x3f'))){_0x47b94c[_0xa943('0x20')]=qs['limit'](_0x5bcda4['query']['limit']);_0x47b94c[_0xa943('0x22')]=qs[_0xa943('0x22')](_0x5bcda4[_0xa943('0x37')][_0xa943('0x22')]);}_0x47b94c[_0xa943('0x40')]=qs[_0xa943('0x41')](_0x5bcda4[_0xa943('0x37')]['sort']);_0x47b94c[_0xa943('0x42')]=qs[_0xa943('0x38')](_[_0xa943('0x43')](_0x5bcda4['query'],_0x561830['filters']),_0x549862);if(_0x5bcda4[_0xa943('0x37')][_0xa943('0x44')]){_0x47b94c[_0xa943('0x42')]=_['merge'](_0x47b94c[_0xa943('0x42')],{'$or':_[_0xa943('0x32')](_0x549862,function(_0x4ebad5){if(_0x4ebad5[_0xa943('0x45')]!==_0xa943('0x46')){var _0x453278={};_0x453278[_0x4ebad5['name']]={'$like':'%'+_0x5bcda4[_0xa943('0x37')][_0xa943('0x44')]+'%'};return _0x453278;}})});}_0x47b94c=_['merge']({},_0x47b94c,_0x5bcda4[_0xa943('0x47')]);var _0x423682={'where':_0x47b94c['where']};return db['AnalyticCustomReport'][_0xa943('0x21')](_0x423682)[_0xa943('0x28')](function(_0x532a17){_0x371e4f[_0xa943('0x21')]=_0x532a17;if(_0x5bcda4[_0xa943('0x37')]['includeAll']){_0x47b94c[_0xa943('0x48')]=[{'all':!![]}];}return db[_0xa943('0x33')]['findAll'](_0x47b94c);})['then'](function(_0x56e6cf){_0x371e4f['rows']=_0x56e6cf;return _0x371e4f;})[_0xa943('0x28')](respondWithFilteredResult(_0x110c9e,_0x47b94c))['catch'](handleError(_0x110c9e,null));};exports[_0xa943('0x49')]=function(_0x363b35,_0x47d805){var _0x556363={'raw':![],'where':{'id':_0x363b35[_0xa943('0x4a')]['id']}},_0x1e9fb4={};_0x1e9fb4[_0xa943('0x3a')]=_[_0xa943('0x4b')](db[_0xa943('0x33')][_0xa943('0x34')]);_0x1e9fb4[_0xa943('0x37')]=_['keys'](_0x363b35[_0xa943('0x37')]);_0x1e9fb4[_0xa943('0x38')]=_[_0xa943('0x39')](_0x1e9fb4[_0xa943('0x3a')],_0x1e9fb4[_0xa943('0x37')]);_0x556363[_0xa943('0x3b')]=_[_0xa943('0x39')](_0x1e9fb4['model'],qs[_0xa943('0x3c')](_0x363b35[_0xa943('0x37')][_0xa943('0x3c')]));_0x556363['attributes']=_0x556363[_0xa943('0x3b')]['length']?_0x556363[_0xa943('0x3b')]:_0x1e9fb4[_0xa943('0x3a')];if(_0x363b35[_0xa943('0x37')][_0xa943('0x4c')]){_0x556363[_0xa943('0x48')]=[{'all':!![]}];}_0x556363=_[_0xa943('0x4d')]({},_0x556363,_0x363b35['options']);return db[_0xa943('0x33')][_0xa943('0x4e')](_0x556363)[_0xa943('0x28')](handleEntityNotFound(_0x47d805,null))[_0xa943('0x28')](respondWithResult(_0x47d805,null))[_0xa943('0x4f')](handleError(_0x47d805,null));};exports['create']=function(_0x1e4d05,_0x2e1a6e){return db[_0xa943('0x33')]['create'](_0x1e4d05['body'],{})[_0xa943('0x28')](function(_0x88939f){var _0x19baf2=_0x1e4d05[_0xa943('0x50')][_0xa943('0x2a')]({'plain':!![]});if(!_0x19baf2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x19baf2['role']===_0xa943('0x50')){var _0x28bf76=_0x88939f[_0xa943('0x2a')]({'plain':!![]});var _0x1c3afa='Reports';return db['UserProfileSection'][_0xa943('0x4e')]({'where':{'name':_0x1c3afa,'userProfileId':_0x19baf2[_0xa943('0x51')]},'raw':!![]})[_0xa943('0x28')](function(_0x2a39e5){if(_0x2a39e5&&_0x2a39e5[_0xa943('0x52')]===0x0){return db[_0xa943('0x2c')][_0xa943('0x53')]({'name':_0x28bf76[_0xa943('0x2f')],'resourceId':_0x28bf76['id'],'type':_0xa943('0x2b'),'sectionId':_0x2a39e5['id']},{})[_0xa943('0x28')](function(){return _0x88939f;});}else{return _0x88939f;}})[_0xa943('0x4f')](function(_0x431a82){logger[_0xa943('0x54')](_0xa943('0x55'),_0x431a82);throw _0x431a82;});}return _0x88939f;})['then'](respondWithResult(_0x2e1a6e,0xc9))[_0xa943('0x4f')](handleError(_0x2e1a6e,null));};exports[_0xa943('0x27')]=function(_0x4f609b,_0x23e32d){if(_0x4f609b[_0xa943('0x56')]['id']){delete _0x4f609b[_0xa943('0x56')]['id'];}return db[_0xa943('0x33')]['find']({'where':{'id':_0x4f609b[_0xa943('0x4a')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x23e32d,null))[_0xa943('0x28')](saveUpdates(_0x4f609b[_0xa943('0x56')],null))[_0xa943('0x28')](respondWithResult(_0x23e32d,null))[_0xa943('0x4f')](handleError(_0x23e32d,null));};exports[_0xa943('0x29')]=function(_0x3eb11c,_0x247f4b){return db['AnalyticCustomReport']['find']({'where':{'id':_0x3eb11c[_0xa943('0x4a')]['id']}})[_0xa943('0x28')](handleEntityNotFound(_0x247f4b,null))[_0xa943('0x28')](removeEntity(_0x247f4b,null))[_0xa943('0x4f')](handleError(_0x247f4b,null));};exports['preview']=function(_0x464bc8,_0x1500ab){var _0x2f8920=0xa;var _0x5ba7cb=[_0xa943('0x57'),_0xa943('0x58'),_0xa943('0x59'),_0xa943('0x5a')];var _0x4d409c={'SUM':_0xa943('0x5b'),'COUNT':_0xa943('0x5c'),'COUNT DISTINCT':_0xa943('0x5d'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xa943('0x5e'),'GROUP_CONCAT':_0xa943('0x5f'),'GROUP_CONCAT ASC':_0xa943('0x60'),'GROUP_CONCAT DESC':_0xa943('0x61')};var _0x1f735a={'SEC_TO_TIME':_0xa943('0x62'),'DATE':_0xa943('0x63'),'HOUR':'HOUR(%s)','ROUND':_0xa943('0x64'),'UNIX_TIMESTAMP':_0xa943('0x65')};var _0x4d0521=function(_0x39b3f1){return!_['includes']([_0xa943('0x66'),'IS\x20NOT\x20NULL',_0xa943('0x67'),'IS\x20NOT\x20EMPTY'],_0x39b3f1);};var _0x4efece=function(_0x505601){if(!_0x505601||!_0x505601[_0xa943('0x68')][_0xa943('0x3d')]){return'';}for(var _0x35c9ac='(',_0x352786=0x0;_0x352786<_0x505601['rules']['length'];_0x352786+=0x1){_0x352786>0x0&&(_0x35c9ac+='\x20'+_0x505601[_0xa943('0x69')]+'\x20');_0x35c9ac+=_0x505601[_0xa943('0x68')][_0x352786][_0xa943('0x6a')]?_0x4efece(_0x505601['rules'][_0x352786][_0xa943('0x6a')]):_0x505601[_0xa943('0x68')][_0x352786][_0xa943('0x6b')]+'\x20'+_0x505601[_0xa943('0x68')][_0x352786][_0xa943('0x6c')]+(_0x4d0521(_0x505601['rules'][_0x352786][_0xa943('0x6c')])?'\x20'+_0x505601[_0xa943('0x68')][_0x352786][_0xa943('0x6d')]:'');}return _0x35c9ac+')';};var _0x4751e3={'where':{'id':_0x464bc8[_0xa943('0x4a')]['id']}},_0x2f670f,_0x5a804c,_0x558678,_0x2b3380,_0x23f744;_0x4751e3=_[_0xa943('0x4d')]({},_0x4751e3,_0x464bc8['options']);return db[_0xa943('0x33')][_0xa943('0x4e')](_0x4751e3)[_0xa943('0x28')](function(_0x4d6c32){if(_0x4d6c32){_0x2f670f=_0x4d6c32;return _0x4d6c32[_0xa943('0x6e')]();}return null;})['then'](function(_0x7692ef){if(_0x7692ef){if(!_0x7692ef[_0xa943('0x3d')]){throw new db[(_0xa943('0x6f'))][(_0xa943('0x70'))](_0xa943('0x71'),0x193);}_0x5a804c=_0x7692ef;return db[_0xa943('0x72')][_0xa943('0x73')]({'raw':!![]});}return null;})['then'](function(_0x56237e){if(_0x56237e){_0x558678=_[_0xa943('0x74')](_0x56237e,'id');var _0x46ebf9;var _0x4b024c=squel['select']();_0x4b024c[_0xa943('0x75')](_0x2f670f[_0xa943('0x76')]);for(var _0x2fc543=0x0;_0x2fc543<_0x5a804c[_0xa943('0x3d')];_0x2fc543+=0x1){_0x46ebf9=_0x5a804c[_0x2fc543][_0xa943('0x77')]?_0x558678[_0x5a804c[_0x2fc543][_0xa943('0x77')]][_0xa943('0x78')]:_0x5a804c[_0x2fc543][_0xa943('0x6b')];_0x46ebf9=_0x5a804c[_0x2fc543][_0xa943('0x79')]?_[_0xa943('0x7a')](_0x4d409c[_0x5a804c[_0x2fc543][_0xa943('0x79')]],'%s',_0x46ebf9):_0x46ebf9;_0x46ebf9=_0x5a804c[_0x2fc543][_0xa943('0x7b')]?_[_0xa943('0x7a')](_0x1f735a[_0x5a804c[_0x2fc543][_0xa943('0x7b')]],'%s',_0x46ebf9):_0x46ebf9;if(_0x5a804c[_0x2fc543][_0xa943('0x7c')]){_0x4b024c[_0xa943('0x6a')](_0x46ebf9);}_0x5a804c[_0x2fc543][_0xa943('0x7d')]&&_0x4b024c[_0xa943('0x40')](_0x46ebf9,_0x5a804c[_0x2fc543][_0xa943('0x7d')]===_0xa943('0x7e')?![]:!![]);_0x4b024c[_0xa943('0x6b')](_0x46ebf9,_0x5a804c[_0x2fc543]['alias']||_0x46ebf9);}if(_0x2f670f['joins']){_0x2f670f['joins']=JSON[_0xa943('0x7f')](_0x2f670f[_0xa943('0x80')]);for(var _0x12710e=0x0;_0x12710e<_0x2f670f['joins'][_0xa943('0x3d')];_0x12710e+=0x1){if(_0x2f670f[_0xa943('0x80')][_0x12710e][_0xa943('0x45')]&&_[_0xa943('0x81')](_0x5ba7cb,_0x2f670f[_0xa943('0x80')][_0x12710e][_0xa943('0x45')])&&_0x2f670f[_0xa943('0x80')][_0x12710e][_0xa943('0x82')]&&_0x2f670f[_0xa943('0x80')][_0x12710e]['foreignTable']&&_0x2f670f[_0xa943('0x80')][_0x12710e][_0xa943('0x83')]){_0x4b024c[_0x2f670f[_0xa943('0x80')][_0x12710e]['type']](_0x2f670f['joins'][_0x12710e][_0xa943('0x84')],null,util[_0xa943('0x7b')](_0xa943('0x85'),_0x2f670f[_0xa943('0x76')],_0x2f670f[_0xa943('0x80')][_0x12710e]['parentKey'],_0x2f670f[_0xa943('0x80')][_0x12710e]['foreignTable'],_0x2f670f['joins'][_0x12710e][_0xa943('0x83')]));}}}if(_0x2f670f[_0xa943('0x86')]){_0x2f670f[_0xa943('0x86')]=JSON[_0xa943('0x7f')](_0x2f670f[_0xa943('0x86')]);_0x4b024c[_0xa943('0x42')](_0x4efece(_0x2f670f[_0xa943('0x86')]['group']));}_0x23f744=_0x4b024c[_0xa943('0x87')]();_0x4b024c[_0xa943('0x20')](_0x2f8920);_0x4b024c[_0xa943('0x22')](0x0);logger['debug'](_0xa943('0x88'),_0x4b024c[_0xa943('0x89')]());return dbH[_0xa943('0x8a')]['query'](_0x4b024c[_0xa943('0x89')](),{'type':dbH[_0xa943('0x8a')][_0xa943('0x8b')][_0xa943('0x8c')]});}})[_0xa943('0x28')](respondWithResult(_0x1500ab,null))[_0xa943('0x4f')](handleError(_0x1500ab,null));};function runReport(_0x25ec08,_0x3bb16b,_0x1df3ee){var _0x1cb323=_0x3bb16b[_0xa943('0x2f')];var _0xa19061=0xa;var _0x58180a=[_0xa943('0x57'),_0xa943('0x58'),'right_join',_0xa943('0x5a')];var _0x3bb3e2={'SUM':_0xa943('0x5b'),'COUNT':_0xa943('0x5c'),'COUNT DISTINCT':_0xa943('0x5d'),'MAX':_0xa943('0x8d'),'MIN':_0xa943('0x8e'),'AVG':_0xa943('0x5e'),'GROUP_CONCAT':_0xa943('0x5f'),'GROUP_CONCAT ASC':_0xa943('0x60'),'GROUP_CONCAT DESC':_0xa943('0x61')};var _0x341b29={'SEC_TO_TIME':_0xa943('0x62'),'DATE':'DATE(%s)','HOUR':_0xa943('0x8f'),'ROUND':_0xa943('0x64'),'UNIX_TIMESTAMP':_0xa943('0x65')};var _0x54f826=function(_0x3f2c5f){return!_[_0xa943('0x81')]([_0xa943('0x66'),_0xa943('0x90'),_0xa943('0x67'),'IS\x20NOT\x20EMPTY'],_0x3f2c5f);};var _0x5a3b27=function(_0xfb5c9f){if(!_0xfb5c9f||!_0xfb5c9f[_0xa943('0x68')]['length']){return'';}for(var _0x294e06='(',_0x51e6fd=0x0;_0x51e6fd<_0xfb5c9f[_0xa943('0x68')][_0xa943('0x3d')];_0x51e6fd+=0x1){_0x51e6fd>0x0&&(_0x294e06+='\x20'+_0xfb5c9f[_0xa943('0x69')]+'\x20');_0x294e06+=_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6a')]?_0x5a3b27(_0xfb5c9f['rules'][_0x51e6fd]['group']):_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6b')]+'\x20'+_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6c')]+(_0x54f826(_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6c')])?'\x20'+_0xfb5c9f[_0xa943('0x68')][_0x51e6fd][_0xa943('0x6d')]:'');}return _0x294e06+')';};var _0x3e7351={'where':{'id':_0x25ec08['id']}},_0x23569c,_0x41f439,_0xb05b10,_0x51678d,_0x144304;_0x3e7351=_[_0xa943('0x4d')]({},_0x3e7351,_0x1df3ee);return db[_0xa943('0x33')][_0xa943('0x4e')](_0x3e7351)[_0xa943('0x28')](function(_0x6ae96){if(_0x6ae96){_0x23569c=_0x6ae96;return _0x6ae96['getFields']();}return null;})['then'](function(_0x3402bd){if(_0x3402bd){if(!_0x3402bd[_0xa943('0x3d')]){throw new db['Sequelize']['ValidationErrorItem'](_0xa943('0x71'),0x193);}_0x41f439=_0x3402bd;return db[_0xa943('0x72')][_0xa943('0x73')]({'raw':!![]});}return null;})[_0xa943('0x28')](function(_0x229c25){if(_0x229c25){_0xb05b10=_[_0xa943('0x74')](_0x229c25,'id');var _0x250b94;var _0x209b5b=squel[_0xa943('0x91')]();_0x209b5b[_0xa943('0x75')](_0x23569c[_0xa943('0x76')]);for(var _0x20fa29=0x0;_0x20fa29<_0x41f439[_0xa943('0x3d')];_0x20fa29+=0x1){_0x250b94=_0x41f439[_0x20fa29][_0xa943('0x77')]?_0xb05b10[_0x41f439[_0x20fa29][_0xa943('0x77')]][_0xa943('0x78')]:_0x41f439[_0x20fa29][_0xa943('0x6b')];_0x250b94=_0x41f439[_0x20fa29]['function']?_[_0xa943('0x7a')](_0x3bb3e2[_0x41f439[_0x20fa29]['function']],'%s',_0x250b94):_0x250b94;_0x250b94=_0x41f439[_0x20fa29][_0xa943('0x7b')]?_[_0xa943('0x7a')](_0x341b29[_0x41f439[_0x20fa29][_0xa943('0x7b')]],'%s',_0x250b94):_0x250b94;if(_0x41f439[_0x20fa29][_0xa943('0x7c')]){_0x209b5b[_0xa943('0x6a')](_0x250b94);}_0x41f439[_0x20fa29][_0xa943('0x7d')]&&_0x209b5b[_0xa943('0x40')](_0x250b94,_0x41f439[_0x20fa29][_0xa943('0x7d')]===_0xa943('0x7e')?![]:!![]);_0x209b5b[_0xa943('0x6b')](_0x250b94,_0x41f439[_0x20fa29]['alias']||_0x250b94);}if(_0x23569c[_0xa943('0x80')]){_0x23569c[_0xa943('0x80')]=JSON[_0xa943('0x7f')](_0x23569c['joins']);for(var _0x7d874b=0x0;_0x7d874b<_0x23569c[_0xa943('0x80')]['length'];_0x7d874b+=0x1){if(_0x23569c['joins'][_0x7d874b][_0xa943('0x45')]&&_[_0xa943('0x81')](_0x58180a,_0x23569c[_0xa943('0x80')][_0x7d874b][_0xa943('0x45')])&&_0x23569c[_0xa943('0x80')][_0x7d874b][_0xa943('0x82')]&&_0x23569c['joins'][_0x7d874b][_0xa943('0x84')]&&_0x23569c['joins'][_0x7d874b][_0xa943('0x83')]){_0x209b5b[_0x23569c['joins'][_0x7d874b][_0xa943('0x45')]](_0x23569c['joins'][_0x7d874b][_0xa943('0x84')],null,util[_0xa943('0x7b')](_0xa943('0x85'),_0x23569c['table'],_0x23569c[_0xa943('0x80')][_0x7d874b][_0xa943('0x82')],_0x23569c['joins'][_0x7d874b][_0xa943('0x84')],_0x23569c[_0xa943('0x80')][_0x7d874b][_0xa943('0x83')]));}}}if(_0x23569c['conditions']){_0x23569c[_0xa943('0x86')]=JSON[_0xa943('0x7f')](_0x23569c[_0xa943('0x86')]);_0x209b5b['where'](_0x5a3b27(_0x23569c[_0xa943('0x86')][_0xa943('0x6a')]));}_0x144304=_0x209b5b['clone']();_0x209b5b[_0xa943('0x20')](_0xa19061);_0x209b5b[_0xa943('0x22')](0x0);return;}})[_0xa943('0x28')](function(){if(_0x3bb16b[_0xa943('0x92')]==='web'){return null;}var _0xbd6729=_[_0xa943('0x4d')](_0x3bb16b,{'name':_0x3bb16b[_0xa943('0x93')]||_0x3bb16b['name']||_0x23569c['name'],'basename':_0x1cb323,'savename':util[_0xa943('0x7b')](_0xa943('0x94'),_0x3bb16b[_0xa943('0x2f')]||_0x23569c[_0xa943('0x2f')],require('randomstring')['generate'](0x4),_0x3bb16b[_0xa943('0x92')]||_0xa943('0x95')),'reportId':_0x23569c['id'],'reportType':_0xa943('0x96')});return db[_0xa943('0x97')][_0xa943('0x53')](_0xbd6729,{'raw':!![]});})[_0xa943('0x28')](function(_0x34193a){if(_0x23569c[_0xa943('0x76')]==='cdr'){_0x144304['where'](_0x23569c[_0xa943('0x76')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x3bb16b[_0xa943('0x98')],_0x3bb16b[_0xa943('0x99')]);}else{_0x144304[_0xa943('0x42')](_0x23569c['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3bb16b['startDate'],_0x3bb16b[_0xa943('0x99')]);}if(_0x34193a){logger[_0xa943('0x9a')]('Run\x20Query:',_0x144304['toString']());require('child_process')[_0xa943('0x9b')](path[_0xa943('0x57')](__dirname,_0xa943('0x9c'),_0x34193a['output']),[_0x34193a['id'],_0x144304[_0xa943('0x89')](),path['join'](__dirname,_0xa943('0x9d'),_0x34193a[_0xa943('0x9e')]),_0x1cb323]);return _0x34193a;}else{var _0xfb8bc8=squel[_0xa943('0x91')]();_0xfb8bc8[_0xa943('0x75')]('('+_0x144304[_0xa943('0x89')]()+')',_0xa943('0x9f'));_0xfb8bc8[_0xa943('0x6b')](_0xa943('0xa0'),_0xa943('0x21'));_0x144304[_0xa943('0x20')](_0x3bb16b[_0xa943('0x20')]||_0xa19061);_0x144304[_0xa943('0x22')](_0x3bb16b[_0xa943('0x22')]||0x0);return dbH[_0xa943('0x8a')][_0xa943('0x37')](_0xfb8bc8[_0xa943('0x89')](),{'type':dbH[_0xa943('0x8a')][_0xa943('0x8b')][_0xa943('0x8c')]})[_0xa943('0x28')](function(_0x2f13cb){if(!_0x2f13cb[_0xa943('0x3d')]){_0x51678d=0x0;}else{_0x51678d=_0x2f13cb[0x0][_0xa943('0x21')]||0x0;}return dbH[_0xa943('0x8a')][_0xa943('0x37')](_0x144304[_0xa943('0x89')](),{'type':dbH['sequelize'][_0xa943('0x8b')]['SELECT']});})[_0xa943('0x28')](function(_0x2f4762){return{'rows':_0x2f4762||[],'count':_0x51678d};});}});}exports[_0xa943('0xa1')]=function(_0x203a16,_0xf54b4f){return runReport(_0x203a16[_0xa943('0x4a')],_0x203a16[_0xa943('0x37')],_0x203a16[_0xa943('0x47')])[_0xa943('0x28')](respondWithResult(_0xf54b4f,null))['catch'](handleError(_0xf54b4f,null));};exports['runReport']=runReport;exports[_0xa943('0x37')]=function(_0x3424ea,_0x49aff2){var _0x220d97=0xa;var _0xcdb0af=[_0xa943('0x57'),_0xa943('0x58'),_0xa943('0x59'),_0xa943('0x5a')];var _0x4b3436={'SUM':'SUM(%s)','COUNT':_0xa943('0x5c'),'COUNT DISTINCT':_0xa943('0x5d'),'MAX':_0xa943('0x8d'),'MIN':_0xa943('0x8e'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xa943('0x5f'),'GROUP_CONCAT ASC':_0xa943('0x60'),'GROUP_CONCAT DESC':_0xa943('0x61')};var _0x3b6eb6={'SEC_TO_TIME':_0xa943('0x62'),'DATE':_0xa943('0x63'),'HOUR':_0xa943('0x8f'),'ROUND':_0xa943('0x64'),'UNIX_TIMESTAMP':_0xa943('0x65')};var _0x31949e=function(_0x5f0f6d){return!_[_0xa943('0x81')]([_0xa943('0x66'),_0xa943('0x90'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5f0f6d);};var _0x1e685a=function(_0x1ca1ac){if(!_0x1ca1ac||!_0x1ca1ac[_0xa943('0x68')][_0xa943('0x3d')]){return'';}for(var _0x3ab24b='(',_0x435212=0x0;_0x435212<_0x1ca1ac[_0xa943('0x68')][_0xa943('0x3d')];_0x435212+=0x1){_0x435212>0x0&&(_0x3ab24b+='\x20'+_0x1ca1ac[_0xa943('0x69')]+'\x20');_0x3ab24b+=_0x1ca1ac[_0xa943('0x68')][_0x435212][_0xa943('0x6a')]?_0x1e685a(_0x1ca1ac['rules'][_0x435212][_0xa943('0x6a')]):_0x1ca1ac[_0xa943('0x68')][_0x435212][_0xa943('0x6b')]+'\x20'+_0x1ca1ac['rules'][_0x435212][_0xa943('0x6c')]+(_0x31949e(_0x1ca1ac['rules'][_0x435212]['condition'])?'\x20'+_0x1ca1ac[_0xa943('0x68')][_0x435212][_0xa943('0x6d')]:'');}return _0x3ab24b+')';};var _0x3964ed={'where':{'id':_0x3424ea['params']['id']}},_0x2a4a95,_0x4279c2,_0x59f805,_0x3f1603,_0x586189;_0x3964ed=_[_0xa943('0x4d')]({},_0x3964ed,_0x3424ea[_0xa943('0x47')]);return db[_0xa943('0x33')][_0xa943('0x4e')](_0x3964ed)[_0xa943('0x28')](function(_0x2ed98){if(_0x2ed98){_0x2a4a95=_0x2ed98;return _0x2ed98['getFields']();}return null;})[_0xa943('0x28')](function(_0x28ce01){if(_0x28ce01){if(!_0x28ce01['length']){throw new db['Sequelize'][(_0xa943('0x70'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4279c2=_0x28ce01;return db[_0xa943('0x72')]['findAll']({'raw':!![]});}return null;})[_0xa943('0x28')](function(_0x44b46a){if(_0x44b46a){_0x59f805=_[_0xa943('0x74')](_0x44b46a,'id');var _0x4bb1a4;var _0x221199=squel[_0xa943('0x91')]();_0x221199['from'](_0x2a4a95[_0xa943('0x76')]);for(var _0x397151=0x0;_0x397151<_0x4279c2[_0xa943('0x3d')];_0x397151+=0x1){_0x4bb1a4=_0x4279c2[_0x397151][_0xa943('0x77')]?_0x59f805[_0x4279c2[_0x397151][_0xa943('0x77')]]['metric']:_0x4279c2[_0x397151][_0xa943('0x6b')];_0x4bb1a4=_0x4279c2[_0x397151][_0xa943('0x79')]?_['replace'](_0x4b3436[_0x4279c2[_0x397151]['function']],'%s',_0x4bb1a4):_0x4bb1a4;_0x4bb1a4=_0x4279c2[_0x397151][_0xa943('0x7b')]?_[_0xa943('0x7a')](_0x3b6eb6[_0x4279c2[_0x397151][_0xa943('0x7b')]],'%s',_0x4bb1a4):_0x4bb1a4;if(_0x4279c2[_0x397151][_0xa943('0x7c')]){_0x221199['group'](_0x4bb1a4);}_0x4279c2[_0x397151][_0xa943('0x7d')]&&_0x221199[_0xa943('0x40')](_0x4bb1a4,_0x4279c2[_0x397151][_0xa943('0x7d')]===_0xa943('0x7e')?![]:!![]);_0x221199[_0xa943('0x6b')](_0x4bb1a4,_0x4279c2[_0x397151][_0xa943('0xa2')]||_0x4bb1a4);}if(_0x2a4a95[_0xa943('0x80')]){_0x2a4a95[_0xa943('0x80')]=JSON[_0xa943('0x7f')](_0x2a4a95['joins']);for(var _0xe3fc2=0x0;_0xe3fc2<_0x2a4a95[_0xa943('0x80')][_0xa943('0x3d')];_0xe3fc2+=0x1){if(_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x45')]&&_[_0xa943('0x81')](_0xcdb0af,_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x45')])&&_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x82')]&&_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x84')]&&_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x83')]){_0x221199[_0x2a4a95['joins'][_0xe3fc2]['type']](_0x2a4a95[_0xa943('0x80')][_0xe3fc2]['foreignTable'],null,util[_0xa943('0x7b')](_0xa943('0x85'),_0x2a4a95[_0xa943('0x76')],_0x2a4a95[_0xa943('0x80')][_0xe3fc2][_0xa943('0x82')],_0x2a4a95[_0xa943('0x80')][_0xe3fc2]['foreignTable'],_0x2a4a95['joins'][_0xe3fc2][_0xa943('0x83')]));}}}if(_0x2a4a95[_0xa943('0x86')]){_0x2a4a95['conditions']=JSON[_0xa943('0x7f')](_0x2a4a95[_0xa943('0x86')]);_0x221199[_0xa943('0x42')](_0x1e685a(_0x2a4a95[_0xa943('0x86')]['group']));}_0x586189=_0x221199[_0xa943('0x87')]();_0x221199[_0xa943('0x20')](_0x220d97);_0x221199[_0xa943('0x22')](0x0);logger[_0xa943('0xa3')](_0xa943('0x88'),_0x221199[_0xa943('0x89')]());return dbH[_0xa943('0x8a')][_0xa943('0x37')](_0x221199[_0xa943('0x89')](),{'type':dbH[_0xa943('0x8a')]['QueryTypes'][_0xa943('0x8c')]});}})['then'](function(){return{'sql':_0x586189['toString']()};})['then'](respondWithResult(_0x49aff2,null))['catch'](handleError(_0x49aff2,null));};
\ No newline at end of file
index 3ab56ff..85973f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0eac=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','lodash','util','request-promise','path'];(function(_0x903ab9,_0x40587e){var _0x269a99=function(_0x685e2e){while(--_0x685e2e){_0x903ab9['push'](_0x903ab9['shift']());}};_0x269a99(++_0x40587e);}(_0x0eac,0x7e));var _0xc0ea=function(_0x44a64f,_0x38475c){_0x44a64f=_0x44a64f-0x0;var _0x52024b=_0x0eac[_0x44a64f];return _0x52024b;};'use strict';var _=require(_0xc0ea('0x0'));var util=require(_0xc0ea('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc0ea('0x2'));var fs=require('fs');var path=require(_0xc0ea('0x3'));var rimraf=require(_0xc0ea('0x4'));var config=require(_0xc0ea('0x5'));var attributes=require(_0xc0ea('0x6'));module[_0xc0ea('0x7')]=function(_0x575d73,_0xe2824a){return _0x575d73[_0xc0ea('0x8')](_0xc0ea('0x9'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0e37=['exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','api','bluebird','request-promise','../../config/environment','./analyticCustomReport.attributes'];(function(_0x43b56c,_0x30d616){var _0x24fa06=function(_0x9fef48){while(--_0x9fef48){_0x43b56c['push'](_0x43b56c['shift']());}};_0x24fa06(++_0x30d616);}(_0x0e37,0x1bc));var _0x70e3=function(_0x149cca,_0x3bed94){_0x149cca=_0x149cca-0x0;var _0x22a5a5=_0x0e37[_0x149cca];return _0x22a5a5;};'use strict';var _=require(_0x70e3('0x0'));var util=require(_0x70e3('0x1'));var logger=require('../../config/logger')(_0x70e3('0x2'));var moment=require('moment');var BPromise=require(_0x70e3('0x3'));var rp=require(_0x70e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x70e3('0x5'));var attributes=require(_0x70e3('0x6'));module[_0x70e3('0x7')]=function(_0x4de153,_0x2ac97b){return _0x4de153[_0x70e3('0x8')](_0x70e3('0x9'),attributes,{'tableName':_0x70e3('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 85a526f..8fc3364 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa1c3=['stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','then','info','request\x20sent'];(function(_0x4bc67c,_0x26bd6a){var _0x1989d2=function(_0x2f9459){while(--_0x2f9459){_0x4bc67c['push'](_0x4bc67c['shift']());}};_0x1989d2(++_0x26bd6a);}(_0xa1c3,0x142));var _0x3a1c=function(_0xe4a690,_0x212a3a){_0xe4a690=_0xe4a690-0x0;var _0x2d934a=_0xa1c3[_0xe4a690];return _0x2d934a;};'use strict';var _=require(_0x3a1c('0x0'));var util=require(_0x3a1c('0x1'));var moment=require(_0x3a1c('0x2'));var BPromise=require(_0x3a1c('0x3'));var rs=require(_0x3a1c('0x4'));var fs=require('fs');var Redis=require(_0x3a1c('0x5'));var db=require(_0x3a1c('0x6'))['db'];var utils=require(_0x3a1c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a1c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3a1c('0x9')][_0x3a1c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50cf0b,_0x1f26a0,_0x15d533){return new BPromise(function(_0x5e513f,_0x447409){return client['request'](_0x50cf0b,_0x15d533)[_0x3a1c('0xb')](function(_0x6d945e){logger[_0x3a1c('0xc')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1f26a0,_0x3a1c('0xd'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x1f26a0,_0x3a1c('0xd'),JSON[_0x3a1c('0xe')](_0x6d945e));if(_0x6d945e[_0x3a1c('0xf')]){if(_0x6d945e['error'][_0x3a1c('0x10')]===0x1f4){logger[_0x3a1c('0xf')](_0x3a1c('0x11'),_0x1f26a0,_0x6d945e['error'][_0x3a1c('0x12')]);return _0x447409(_0x6d945e['error']['message']);}logger['error'](_0x3a1c('0x11'),_0x1f26a0,_0x6d945e['error'][_0x3a1c('0x12')]);return _0x5e513f(_0x6d945e[_0x3a1c('0xf')][_0x3a1c('0x12')]);}else{logger['info'](_0x3a1c('0x11'),_0x1f26a0,'request\x20sent');_0x5e513f(_0x6d945e[_0x3a1c('0x13')][_0x3a1c('0x12')]);}})[_0x3a1c('0x14')](function(_0x29211e){logger[_0x3a1c('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x1f26a0,_0x29211e);_0x447409(_0x29211e);});});}
\ No newline at end of file
+var _0x6966=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2fa263,_0x38401e){var _0x13f4ea=function(_0x29f2a3){while(--_0x29f2a3){_0x2fa263['push'](_0x2fa263['shift']());}};_0x13f4ea(++_0x38401e);}(_0x6966,0x16c));var _0x6696=function(_0x6778ea,_0x4f0351){_0x6778ea=_0x6778ea-0x0;var _0x3c3620=_0x6966[_0x6778ea];return _0x3c3620;};'use strict';var _=require(_0x6696('0x0'));var util=require(_0x6696('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6696('0x2'));var fs=require('fs');var Redis=require(_0x6696('0x3'));var db=require(_0x6696('0x4'))['db'];var utils=require(_0x6696('0x5'));var logger=require(_0x6696('0x6'))(_0x6696('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6696('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x549d30,_0xaeca96,_0x1d175b){return new BPromise(function(_0x21864f,_0x287b41){return client[_0x6696('0x9')](_0x549d30,_0x1d175b)[_0x6696('0xa')](function(_0x432b37){logger[_0x6696('0xb')](_0x6696('0xc'),_0xaeca96,_0x6696('0xd'));logger['debug']('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0xaeca96,_0x6696('0xd'),JSON[_0x6696('0xe')](_0x432b37));if(_0x432b37[_0x6696('0xf')]){if(_0x432b37['error'][_0x6696('0x10')]===0x1f4){logger[_0x6696('0xf')](_0x6696('0xc'),_0xaeca96,_0x432b37[_0x6696('0xf')][_0x6696('0x11')]);return _0x287b41(_0x432b37['error'][_0x6696('0x11')]);}logger[_0x6696('0xf')](_0x6696('0xc'),_0xaeca96,_0x432b37[_0x6696('0xf')]['message']);return _0x21864f(_0x432b37[_0x6696('0xf')][_0x6696('0x11')]);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0xaeca96,_0x6696('0xd'));_0x21864f(_0x432b37[_0x6696('0x12')][_0x6696('0x11')]);}})[_0x6696('0x13')](function(_0x356938){logger[_0x6696('0xf')](_0x6696('0xc'),_0xaeca96,_0x356938);_0x287b41(_0x356938);});});}
\ No newline at end of file
index 94bd24b..5ceb483 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf988=['../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','/:id/query','query','post','put','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2d553a,_0x4a0500){var _0x3da9c1=function(_0x56dec7){while(--_0x56dec7){_0x2d553a['push'](_0x2d553a['shift']());}};_0x3da9c1(++_0x4a0500);}(_0xf988,0xb9));var _0x8f98=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf988[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x8f98('0x0'));var util=require('util');var path=require(_0x8f98('0x1'));var timeout=require(_0x8f98('0x2'));var express=require(_0x8f98('0x3'));var router=express['Router']();var fs_extra=require(_0x8f98('0x4'));var auth=require(_0x8f98('0x5'));var interaction=require(_0x8f98('0x6'));var config=require(_0x8f98('0x7'));var controller=require(_0x8f98('0x8'));router[_0x8f98('0x9')]('/',auth[_0x8f98('0xa')](),controller[_0x8f98('0xb')]);router[_0x8f98('0x9')](_0x8f98('0xc'),auth[_0x8f98('0xa')](),controller[_0x8f98('0xd')]);router['get'](_0x8f98('0xe'),auth[_0x8f98('0xa')](),controller[_0x8f98('0xf')]);router[_0x8f98('0x9')](_0x8f98('0x10'),auth[_0x8f98('0xa')](),controller['run']);router['get'](_0x8f98('0x11'),auth[_0x8f98('0xa')](),controller[_0x8f98('0x12')]);router[_0x8f98('0x13')]('/',auth[_0x8f98('0xa')](),controller['create']);router[_0x8f98('0x14')]('/:id',auth[_0x8f98('0xa')](),controller[_0x8f98('0x15')]);router[_0x8f98('0x16')](_0x8f98('0xc'),auth['isAuthenticated'](),controller[_0x8f98('0x17')]);module['exports']=router;
\ No newline at end of file
+var _0x0afb=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','update','delete'];(function(_0xd85ad5,_0xf2202d){var _0x3ff8f4=function(_0x19fbe9){while(--_0x19fbe9){_0xd85ad5['push'](_0xd85ad5['shift']());}};_0x3ff8f4(++_0xf2202d);}(_0x0afb,0x161));var _0xb0af=function(_0x5665fd,_0x2c4e87){_0x5665fd=_0x5665fd-0x0;var _0x42cbf1=_0x0afb[_0x5665fd];return _0x42cbf1;};'use strict';var multer=require(_0xb0af('0x0'));var util=require(_0xb0af('0x1'));var path=require(_0xb0af('0x2'));var timeout=require(_0xb0af('0x3'));var express=require(_0xb0af('0x4'));var router=express[_0xb0af('0x5')]();var fs_extra=require(_0xb0af('0x6'));var auth=require(_0xb0af('0x7'));var interaction=require(_0xb0af('0x8'));var config=require(_0xb0af('0x9'));var controller=require(_0xb0af('0xa'));router[_0xb0af('0xb')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb0af('0xc'),auth[_0xb0af('0xd')](),controller[_0xb0af('0xe')]);router[_0xb0af('0xb')](_0xb0af('0xf'),auth[_0xb0af('0xd')](),controller[_0xb0af('0x10')]);router['get'](_0xb0af('0x11'),auth[_0xb0af('0xd')](),controller['run']);router[_0xb0af('0xb')](_0xb0af('0x12'),auth[_0xb0af('0xd')](),controller[_0xb0af('0x13')]);router[_0xb0af('0x14')]('/',auth[_0xb0af('0xd')](),controller[_0xb0af('0x15')]);router[_0xb0af('0x16')](_0xb0af('0xc'),auth[_0xb0af('0xd')](),controller[_0xb0af('0x17')]);router[_0xb0af('0x18')](_0xb0af('0xc'),auth['isAuthenticated'](),controller[_0xb0af('0x19')]);module[_0xb0af('0x1a')]=router;
\ No newline at end of file
index b52bb7d..cabf9c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x5fd1,0x155));var _0x15fd=function(_0x5ca349,_0x1abb0f){_0x5ca349=_0x5ca349-0x0;var _0xf8ee4a=_0x5fd1[_0x5ca349];return _0xf8ee4a;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}};
\ No newline at end of file
+var _0x9c5a=['exports','STRING','TEXT','sequelize'];(function(_0x4fcfb7,_0x443608){var _0x3a69f0=function(_0xef13a7){while(--_0xef13a7){_0x4fcfb7['push'](_0x4fcfb7['shift']());}};_0x3a69f0(++_0x443608);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x1fc5b,_0x59cf5f){_0x1fc5b=_0x1fc5b-0x0;var _0x24ed82=_0x9c5a[_0x1fc5b];return _0x24ed82;};'use strict';var Sequelize=require(_0xa9c5('0x0'));module[_0xa9c5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xa9c5('0x2')]},'parent':{'type':Sequelize[_0xa9c5('0x2')]},'table':{'type':Sequelize[_0xa9c5('0x2')]},'conditions':{'type':Sequelize[_0xa9c5('0x3')]},'joins':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index c196c63..dc9d92a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['Sequelize','from','foreignKey','output','web','fullPath','generate','csv','cdr','startDate','endDate','info','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','runReport','IS\x20NULL','IS\x20NOT\x20EMPTY','metric','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','get','DefaultReports','UserProfileResource','end','error','stack','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','AnalyticDefaultReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','autoAssociation','update','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','includes','IS\x20EMPTY','operator','rules','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','MetricId','field','function','replace','format','groupBy','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','join','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x2ef3,0xba));var _0x32ef=function(_0x29d617,_0x4a4ad3){_0x29d617=_0x29d617-0x0;var _0x1b7581=_0x2ef3[_0x29d617];return _0x1b7581;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];var dbH=require(_0x32ef('0x18'))['dbH'];function respondWithStatusCode(_0x3e98df,_0x1ef1ae){_0x1ef1ae=_0x1ef1ae||0xcc;return function(_0x5c3eb9){if(_0x5c3eb9){return _0x3e98df['sendStatus'](_0x1ef1ae);}return _0x3e98df[_0x32ef('0x19')](_0x1ef1ae)['end']();};}function respondWithResult(_0x326fce,_0x40a6e6){_0x40a6e6=_0x40a6e6||0xc8;return function(_0x93d492){if(_0x93d492){return _0x326fce[_0x32ef('0x19')](_0x40a6e6)['json'](_0x93d492);}};}function respondWithFilteredResult(_0x55bf0b,_0x531e30){return function(_0x13db1a){if(_0x13db1a){var _0x3950e6=typeof _0x531e30[_0x32ef('0x1a')]==='undefined'&&typeof _0x531e30['limit']===_0x32ef('0x1b');var _0x1a9476=_0x13db1a[_0x32ef('0x1c')];var _0x57863c=_0x3950e6?0x0:_0x531e30[_0x32ef('0x1a')];var _0x33e230=_0x3950e6?_0x13db1a['count']:_0x531e30[_0x32ef('0x1a')]+_0x531e30[_0x32ef('0x1d')];var _0x26aff3;if(_0x33e230>=_0x1a9476){_0x33e230=_0x1a9476;_0x26aff3=0xc8;}else{_0x26aff3=0xce;}_0x55bf0b[_0x32ef('0x19')](_0x26aff3);return _0x55bf0b[_0x32ef('0x1e')](_0x32ef('0x1f'),_0x57863c+'-'+_0x33e230+'/'+_0x1a9476)['json'](_0x13db1a);}return null;};}function patchUpdates(_0x3c5b78){return function(_0x5cc3ef){try{jsonpatch[_0x32ef('0x20')](_0x5cc3ef,_0x3c5b78,!![]);}catch(_0x3a20ca){return BPromise['reject'](_0x3a20ca);}return _0x5cc3ef[_0x32ef('0x21')]();};}function saveUpdates(_0x97780,_0x5e8898){return function(_0x55f7f2){if(_0x55f7f2){return _0x55f7f2['update'](_0x97780)[_0x32ef('0x22')](function(_0xb30fab){return _0xb30fab;});}return null;};}function removeEntity(_0x225feb,_0x478bef){return function(_0x59585f){if(_0x59585f){return _0x59585f[_0x32ef('0x23')]()['then'](function(){var _0x51a412=_0x59585f[_0x32ef('0x24')]({'plain':!![]});var _0x14d4b3=_0x32ef('0x25');return db[_0x32ef('0x26')][_0x32ef('0x23')]({'where':{'type':_0x14d4b3,'resourceId':_0x51a412['id']}})[_0x32ef('0x22')](function(){return _0x59585f;});})[_0x32ef('0x22')](function(){_0x225feb[_0x32ef('0x19')](0xcc)[_0x32ef('0x27')]();});}};}function handleEntityNotFound(_0x2f52d7,_0x1335e2){return function(_0xba4b3f){if(!_0xba4b3f){_0x2f52d7['sendStatus'](0x194);}return _0xba4b3f;};}function handleError(_0xd65fde,_0x2f5d06){_0x2f5d06=_0x2f5d06||0x1f4;return function(_0x5a04cd){logger[_0x32ef('0x28')](_0x5a04cd[_0x32ef('0x29')]);if(_0x5a04cd[_0x32ef('0x2a')]){delete _0x5a04cd[_0x32ef('0x2a')];}_0xd65fde['status'](_0x2f5d06)[_0x32ef('0x2b')](_0x5a04cd);};}exports[_0x32ef('0x2c')]=function(_0x31dbc3,_0x2ac686){var _0x1b668a={},_0x1a6ed2={},_0x1a122d={'count':0x0,'rows':[]};var _0x575f3e=_[_0x32ef('0x2d')](db['AnalyticDefaultReport'][_0x32ef('0x2e')],function(_0x2b6c6a){return{'name':_0x2b6c6a['fieldName'],'type':_0x2b6c6a[_0x32ef('0x2f')][_0x32ef('0x30')]};});_0x1a6ed2[_0x32ef('0x31')]=_[_0x32ef('0x2d')](_0x575f3e,_0x32ef('0x2a'));_0x1a6ed2['query']=_['keys'](_0x31dbc3[_0x32ef('0x32')]);_0x1a6ed2['filters']=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],_0x1a6ed2[_0x32ef('0x32')]);_0x1b668a[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x1a6ed2[_0x32ef('0x31')],qs['fields'](_0x31dbc3['query']['fields']));_0x1b668a[_0x32ef('0x34')]=_0x1b668a[_0x32ef('0x34')][_0x32ef('0x35')]?_0x1b668a['attributes']:_0x1a6ed2['model'];if(!_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x36')](_0x32ef('0x37'))){_0x1b668a['limit']=qs['limit'](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1d')]);_0x1b668a[_0x32ef('0x1a')]=qs[_0x32ef('0x1a')](_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x1a')]);}_0x1b668a[_0x32ef('0x38')]=qs[_0x32ef('0x39')](_0x31dbc3[_0x32ef('0x32')]['sort']);_0x1b668a[_0x32ef('0x3a')]=qs[_0x32ef('0x3b')](_[_0x32ef('0x3c')](_0x31dbc3['query'],_0x1a6ed2[_0x32ef('0x3b')]),_0x575f3e);if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x3d')]){_0x1b668a[_0x32ef('0x3a')]=_[_0x32ef('0x3e')](_0x1b668a[_0x32ef('0x3a')],{'$or':_[_0x32ef('0x2d')](_0x575f3e,function(_0x1cebed){if(_0x1cebed[_0x32ef('0x2f')]!==_0x32ef('0x3f')){var _0xb4db74={};_0xb4db74[_0x1cebed[_0x32ef('0x2a')]]={'$like':'%'+_0x31dbc3['query'][_0x32ef('0x3d')]+'%'};return _0xb4db74;}})});}_0x1b668a=_[_0x32ef('0x3e')]({},_0x1b668a,_0x31dbc3[_0x32ef('0x40')]);var _0x1733e3={'where':_0x1b668a[_0x32ef('0x3a')]};return db[_0x32ef('0x41')][_0x32ef('0x1c')](_0x1733e3)['then'](function(_0x538758){_0x1a122d[_0x32ef('0x1c')]=_0x538758;if(_0x31dbc3[_0x32ef('0x32')][_0x32ef('0x42')]){_0x1b668a[_0x32ef('0x43')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x32ef('0x44')](_0x1b668a);})[_0x32ef('0x22')](function(_0x5d2f06){_0x1a122d[_0x32ef('0x45')]=_0x5d2f06;return _0x1a122d;})['then'](respondWithFilteredResult(_0x2ac686,_0x1b668a))[_0x32ef('0x46')](handleError(_0x2ac686,null));};exports[_0x32ef('0x47')]=function(_0x37a497,_0x3be46d){var _0x2c2b62={'raw':!![],'where':{'id':_0x37a497[_0x32ef('0x48')]['id']}},_0x2310ae={};_0x2310ae[_0x32ef('0x31')]=_[_0x32ef('0x49')](db[_0x32ef('0x41')]['rawAttributes']);_0x2310ae[_0x32ef('0x32')]=_['keys'](_0x37a497[_0x32ef('0x32')]);_0x2310ae[_0x32ef('0x3b')]=_[_0x32ef('0x33')](_0x2310ae['model'],_0x2310ae[_0x32ef('0x32')]);_0x2c2b62[_0x32ef('0x34')]=_[_0x32ef('0x33')](_0x2310ae[_0x32ef('0x31')],qs[_0x32ef('0x4a')](_0x37a497[_0x32ef('0x32')][_0x32ef('0x4a')]));_0x2c2b62['attributes']=_0x2c2b62['attributes'][_0x32ef('0x35')]?_0x2c2b62[_0x32ef('0x34')]:_0x2310ae[_0x32ef('0x31')];if(_0x37a497[_0x32ef('0x32')][_0x32ef('0x42')]){_0x2c2b62[_0x32ef('0x43')]=[{'all':!![]}];}_0x2c2b62=_[_0x32ef('0x3e')]({},_0x2c2b62,_0x37a497[_0x32ef('0x40')]);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2c2b62)[_0x32ef('0x22')](handleEntityNotFound(_0x3be46d,null))[_0x32ef('0x22')](respondWithResult(_0x3be46d,null))[_0x32ef('0x46')](handleError(_0x3be46d,null));};exports['create']=function(_0x420f00,_0x12fbd7){return db[_0x32ef('0x41')][_0x32ef('0x4c')](_0x420f00[_0x32ef('0x4d')],{})[_0x32ef('0x22')](function(_0x278696){var _0x1acded=_0x420f00[_0x32ef('0x4e')][_0x32ef('0x24')]({'plain':!![]});if(!_0x1acded)throw new Error(_0x32ef('0x4f'));if(_0x1acded[_0x32ef('0x50')]===_0x32ef('0x4e')){var _0x326445=_0x278696[_0x32ef('0x24')]({'plain':!![]});var _0x3fb4d8=_0x32ef('0x51');return db[_0x32ef('0x52')]['find']({'where':{'name':_0x3fb4d8,'userProfileId':_0x1acded['userProfileId']},'raw':!![]})[_0x32ef('0x22')](function(_0x259c32){if(_0x259c32&&_0x259c32[_0x32ef('0x53')]===0x0){return db[_0x32ef('0x26')][_0x32ef('0x4c')]({'name':_0x326445[_0x32ef('0x2a')],'resourceId':_0x326445['id'],'type':_0x32ef('0x25'),'sectionId':_0x259c32['id']},{})[_0x32ef('0x22')](function(){return _0x278696;});}else{return _0x278696;}})[_0x32ef('0x46')](function(_0x368bf1){logger[_0x32ef('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x368bf1);throw _0x368bf1;});}return _0x278696;})[_0x32ef('0x22')](respondWithResult(_0x12fbd7,0xc9))[_0x32ef('0x46')](handleError(_0x12fbd7,null));};exports[_0x32ef('0x54')]=function(_0x3fe01f,_0x38314a){if(_0x3fe01f[_0x32ef('0x4d')]['id']){delete _0x3fe01f['body']['id'];}return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x3fe01f[_0x32ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x38314a,null))[_0x32ef('0x22')](saveUpdates(_0x3fe01f['body'],null))[_0x32ef('0x22')](respondWithResult(_0x38314a,null))[_0x32ef('0x46')](handleError(_0x38314a,null));};exports['destroy']=function(_0x206ad5,_0x59e5f9){return db[_0x32ef('0x41')][_0x32ef('0x4b')]({'where':{'id':_0x206ad5[_0x32ef('0x48')]['id']}})[_0x32ef('0x22')](handleEntityNotFound(_0x59e5f9,null))[_0x32ef('0x22')](removeEntity(_0x59e5f9,null))[_0x32ef('0x46')](handleError(_0x59e5f9,null));};exports[_0x32ef('0x55')]=function(_0x56260f,_0x56cc75){var _0xdfa103=0xa;var _0x52232a=['join',_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0x6aae59={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0xbd059e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x2ac877=function(_0x3c31d0){return!_[_0x32ef('0x63')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x3c31d0);};var _0x17f447=function(_0x5bb114){if(!_0x5bb114||!_0x5bb114['rules'][_0x32ef('0x35')]){return'';}for(var _0x208989='(',_0x10cb37=0x0;_0x10cb37<_0x5bb114['rules'][_0x32ef('0x35')];_0x10cb37+=0x1){_0x10cb37>0x0&&(_0x208989+='\x20'+_0x5bb114[_0x32ef('0x65')]+'\x20');_0x208989+=_0x5bb114[_0x32ef('0x66')][_0x10cb37]['group']?_0x17f447(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x67')]):_0x5bb114['rules'][_0x10cb37]['field']+'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')]+(_0x2ac877(_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x68')])?'\x20'+_0x5bb114[_0x32ef('0x66')][_0x10cb37][_0x32ef('0x69')]:'');}return _0x208989+')';};var _0x4c89e8={'where':{'id':_0x56260f[_0x32ef('0x48')]['id']}},_0x285330,_0x63b65,_0x25b6d6,_0x36ed97,_0x21e930;_0x4c89e8=_[_0x32ef('0x3e')]({},_0x4c89e8,_0x56260f[_0x32ef('0x40')]);return db[_0x32ef('0x41')]['find'](_0x4c89e8)[_0x32ef('0x22')](function(_0x29ff58){if(_0x29ff58){_0x285330=_0x29ff58;return _0x29ff58[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0x79ae28){if(_0x79ae28){if(!_0x79ae28['length']){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x63b65=_0x79ae28;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x526fb1){if(_0x526fb1){_0x25b6d6=_[_0x32ef('0x6e')](_0x526fb1,'id');var _0x544045;var _0x216e2f=squel[_0x32ef('0x6f')]();_0x216e2f['from'](_0x285330['table']);for(var _0x2c9f7a=0x0;_0x2c9f7a<_0x63b65[_0x32ef('0x35')];_0x2c9f7a+=0x1){_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x70')]?_0x25b6d6[_0x63b65[_0x2c9f7a]['MetricId']]['metric']:_0x63b65[_0x2c9f7a][_0x32ef('0x71')];_0x544045=_0x63b65[_0x2c9f7a][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x6aae59[_0x63b65[_0x2c9f7a][_0x32ef('0x72')]],'%s',_0x544045):_0x544045;_0x544045=_0x63b65[_0x2c9f7a]['format']?_[_0x32ef('0x73')](_0xbd059e[_0x63b65[_0x2c9f7a][_0x32ef('0x74')]],'%s',_0x544045):_0x544045;if(_0x63b65[_0x2c9f7a][_0x32ef('0x75')]){_0x216e2f[_0x32ef('0x67')](_0x544045);}_0x63b65[_0x2c9f7a][_0x32ef('0x76')]&&_0x216e2f[_0x32ef('0x38')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x216e2f[_0x32ef('0x71')](_0x544045,_0x63b65[_0x2c9f7a][_0x32ef('0x78')]||_0x544045);}if(_0x285330[_0x32ef('0x79')]){_0x285330[_0x32ef('0x79')]=JSON['parse'](_0x285330['joins']);for(var _0x3a9c97=0x0;_0x3a9c97<_0x285330[_0x32ef('0x79')]['length'];_0x3a9c97+=0x1){if(_0x285330[_0x32ef('0x79')][_0x3a9c97]['type']&&_[_0x32ef('0x63')](_0x52232a,_0x285330[_0x32ef('0x79')][_0x3a9c97][_0x32ef('0x2f')])&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7a')]&&_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')]&&_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']){_0x216e2f[_0x285330['joins'][_0x3a9c97][_0x32ef('0x2f')]](_0x285330['joins'][_0x3a9c97][_0x32ef('0x7b')],null,util['format'](_0x32ef('0x7c'),_0x285330[_0x32ef('0x7d')],_0x285330[_0x32ef('0x79')][_0x3a9c97]['parentKey'],_0x285330['joins'][_0x3a9c97]['foreignTable'],_0x285330[_0x32ef('0x79')][_0x3a9c97]['foreignKey']));}}}if(_0x285330[_0x32ef('0x7e')]){_0x285330[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x285330[_0x32ef('0x7e')]);_0x216e2f[_0x32ef('0x3a')](_0x17f447(_0x285330[_0x32ef('0x7e')]['group']));}_0x21e930=_0x216e2f[_0x32ef('0x80')]();_0x216e2f['limit'](_0xdfa103);_0x216e2f['offset'](0x0);logger[_0x32ef('0x81')]('Limited\x20Query:',_0x216e2f[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')]['query'](_0x216e2f[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')][_0x32ef('0x84')][_0x32ef('0x85')]});}})[_0x32ef('0x22')](respondWithResult(_0x56cc75,null))[_0x32ef('0x46')](handleError(_0x56cc75,null));};function runReport(_0x4b5506,_0x51736f,_0x35b10d){var _0x5e0b55=_0x51736f[_0x32ef('0x2a')];var _0x266688=0xa;var _0x114d8e=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),'cross_join'];var _0x3232ca={'SUM':_0x32ef('0x59'),'COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':_0x32ef('0x88'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x211fb1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0xfb4845=function(_0x21067e){return!_[_0x32ef('0x63')](['IS\x20NULL',_0x32ef('0x8b'),_0x32ef('0x64'),'IS\x20NOT\x20EMPTY'],_0x21067e);};var _0x35653b=function(_0x5ea727){if(!_0x5ea727||!_0x5ea727[_0x32ef('0x66')]['length']){return'';}for(var _0x43f36e='(',_0x39300f=0x0;_0x39300f<_0x5ea727[_0x32ef('0x66')][_0x32ef('0x35')];_0x39300f+=0x1){_0x39300f>0x0&&(_0x43f36e+='\x20'+_0x5ea727['operator']+'\x20');_0x43f36e+=_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x67')]?_0x35653b(_0x5ea727[_0x32ef('0x66')][_0x39300f]['group']):_0x5ea727['rules'][_0x39300f]['field']+'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')]+(_0xfb4845(_0x5ea727[_0x32ef('0x66')][_0x39300f][_0x32ef('0x68')])?'\x20'+_0x5ea727[_0x32ef('0x66')][_0x39300f]['value']:'');}return _0x43f36e+')';};var _0x2678e3={'where':{'id':_0x4b5506['id']}},_0x5b3deb,_0x471de6,_0x7b0ea5,_0xc43e1,_0x4baa7a;_0x2678e3=_[_0x32ef('0x3e')]({},_0x2678e3,_0x35b10d);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x2678e3)[_0x32ef('0x22')](function(_0x28bebb){if(_0x28bebb){_0x5b3deb=_0x28bebb;return _0x28bebb['getFields']();}return null;})[_0x32ef('0x22')](function(_0x484df0){if(_0x484df0){if(!_0x484df0[_0x32ef('0x35')]){throw new db[(_0x32ef('0x8c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x471de6=_0x484df0;return db[_0x32ef('0x6d')][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x3b9896){if(_0x3b9896){_0x7b0ea5=_['keyBy'](_0x3b9896,'id');var _0x356fd4;var _0x51ca6e=squel['select']();_0x51ca6e[_0x32ef('0x8d')](_0x5b3deb['table']);for(var _0x2237cf=0x0;_0x2237cf<_0x471de6[_0x32ef('0x35')];_0x2237cf+=0x1){_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x70')]?_0x7b0ea5[_0x471de6[_0x2237cf]['MetricId']]['metric']:_0x471de6[_0x2237cf][_0x32ef('0x71')];_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x72')]?_[_0x32ef('0x73')](_0x3232ca[_0x471de6[_0x2237cf][_0x32ef('0x72')]],'%s',_0x356fd4):_0x356fd4;_0x356fd4=_0x471de6[_0x2237cf][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x211fb1[_0x471de6[_0x2237cf][_0x32ef('0x74')]],'%s',_0x356fd4):_0x356fd4;if(_0x471de6[_0x2237cf]['groupBy']){_0x51ca6e[_0x32ef('0x67')](_0x356fd4);}_0x471de6[_0x2237cf][_0x32ef('0x76')]&&_0x51ca6e[_0x32ef('0x38')](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x76')]==='DESC'?![]:!![]);_0x51ca6e['field'](_0x356fd4,_0x471de6[_0x2237cf][_0x32ef('0x78')]||_0x356fd4);}if(_0x5b3deb['joins']){_0x5b3deb[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x5b3deb['joins']);for(var _0x5c7594=0x0;_0x5c7594<_0x5b3deb['joins'][_0x32ef('0x35')];_0x5c7594+=0x1){if(_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x2f')]&&_[_0x32ef('0x63')](_0x114d8e,_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x2f')])&&_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')]&&_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x8e')]){_0x51ca6e[_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['type']](_0x5b3deb['joins'][_0x5c7594][_0x32ef('0x7b')],null,util[_0x32ef('0x74')](_0x32ef('0x7c'),_0x5b3deb[_0x32ef('0x7d')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7a')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594][_0x32ef('0x7b')],_0x5b3deb[_0x32ef('0x79')][_0x5c7594]['foreignKey']));}}}if(_0x5b3deb[_0x32ef('0x7e')]){_0x5b3deb['conditions']=JSON[_0x32ef('0x7f')](_0x5b3deb[_0x32ef('0x7e')]);_0x51ca6e[_0x32ef('0x3a')](_0x35653b(_0x5b3deb[_0x32ef('0x7e')][_0x32ef('0x67')]));}_0x4baa7a=_0x51ca6e['clone']();_0x51ca6e[_0x32ef('0x1d')](_0x266688);_0x51ca6e[_0x32ef('0x1a')](0x0);return;}})[_0x32ef('0x22')](function(){if(_0x51736f[_0x32ef('0x8f')]===_0x32ef('0x90')){return null;}var _0x1cfdd8=_[_0x32ef('0x3e')](_0x51736f,{'name':_0x51736f[_0x32ef('0x91')]||_0x51736f[_0x32ef('0x2a')]||_0x5b3deb['name'],'basename':_0x5e0b55,'savename':util['format']('%s-%s.%s',_0x51736f[_0x32ef('0x2a')]||_0x5b3deb[_0x32ef('0x2a')],require('randomstring')[_0x32ef('0x92')](0x4),_0x51736f['output']||_0x32ef('0x93')),'reportId':_0x5b3deb['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x32ef('0x4c')](_0x1cfdd8,{'raw':!![]});})[_0x32ef('0x22')](function(_0x118d2e){if(_0x5b3deb[_0x32ef('0x7d')]===_0x32ef('0x94')){_0x4baa7a['where'](_0x5b3deb[_0x32ef('0x7d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x51736f[_0x32ef('0x95')],_0x51736f['endDate']);}else{_0x4baa7a['where'](_0x5b3deb['table']+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x51736f['startDate'],_0x51736f[_0x32ef('0x96')]);}if(_0x118d2e){logger[_0x32ef('0x97')]('Run\x20Query:',_0x4baa7a[_0x32ef('0x82')]());require(_0x32ef('0x98'))[_0x32ef('0x99')](path[_0x32ef('0x86')](__dirname,_0x32ef('0x9a'),_0x118d2e[_0x32ef('0x8f')]),[_0x118d2e['id'],_0x4baa7a['toString'](),path[_0x32ef('0x86')](__dirname,'../../files/reports',_0x118d2e[_0x32ef('0x9b')]),_0x5e0b55]);return _0x118d2e;}else{var _0x1be713=squel['select']();_0x1be713[_0x32ef('0x8d')]('('+_0x4baa7a['toString']()+')',_0x32ef('0x9c'));_0x1be713[_0x32ef('0x71')](_0x32ef('0x9d'),_0x32ef('0x1c'));_0x4baa7a['limit'](_0x51736f[_0x32ef('0x1d')]||_0x266688);_0x4baa7a[_0x32ef('0x1a')](_0x51736f[_0x32ef('0x1a')]||0x0);return dbH[_0x32ef('0x83')]['query'](_0x1be713[_0x32ef('0x82')](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]})[_0x32ef('0x22')](function(_0x28ef17){if(!_0x28ef17[_0x32ef('0x35')]){_0xc43e1=0x0;}else{_0xc43e1=_0x28ef17[0x0][_0x32ef('0x1c')]||0x0;}return dbH['sequelize'][_0x32ef('0x32')](_0x4baa7a['toString'](),{'type':dbH['sequelize'][_0x32ef('0x84')][_0x32ef('0x85')]});})[_0x32ef('0x22')](function(_0x3956e7){return{'rows':_0x3956e7||[],'count':_0xc43e1};});}});}exports['run']=function(_0x8d3b24,_0x642716){return runReport(_0x8d3b24[_0x32ef('0x48')],_0x8d3b24[_0x32ef('0x32')],_0x8d3b24['options'])['then'](respondWithResult(_0x642716,null))['catch'](handleError(_0x642716,null));};exports[_0x32ef('0x9e')]=runReport;exports[_0x32ef('0x32')]=function(_0x4454f3,_0xc92dcc){var _0x3d18b9=0xa;var _0x9233cb=[_0x32ef('0x86'),_0x32ef('0x56'),_0x32ef('0x57'),_0x32ef('0x58')];var _0xa76912={'SUM':'SUM(%s)','COUNT':_0x32ef('0x5a'),'COUNT DISTINCT':_0x32ef('0x5b'),'MAX':_0x32ef('0x5c'),'MIN':_0x32ef('0x5d'),'AVG':_0x32ef('0x5e'),'GROUP_CONCAT':_0x32ef('0x87'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x32ef('0x5f')};var _0x1526a1={'SEC_TO_TIME':_0x32ef('0x89'),'DATE':_0x32ef('0x60'),'HOUR':_0x32ef('0x61'),'ROUND':_0x32ef('0x62'),'UNIX_TIMESTAMP':_0x32ef('0x8a')};var _0x2d4d2f=function(_0x292488){return!_[_0x32ef('0x63')]([_0x32ef('0x9f'),_0x32ef('0x8b'),_0x32ef('0x64'),_0x32ef('0xa0')],_0x292488);};var _0x50b674=function(_0x379d40){if(!_0x379d40||!_0x379d40[_0x32ef('0x66')][_0x32ef('0x35')]){return'';}for(var _0x4b7a4d='(',_0x16525b=0x0;_0x16525b<_0x379d40['rules'][_0x32ef('0x35')];_0x16525b+=0x1){_0x16525b>0x0&&(_0x4b7a4d+='\x20'+_0x379d40[_0x32ef('0x65')]+'\x20');_0x4b7a4d+=_0x379d40[_0x32ef('0x66')][_0x16525b]['group']?_0x50b674(_0x379d40[_0x32ef('0x66')][_0x16525b]['group']):_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x71')]+'\x20'+_0x379d40['rules'][_0x16525b][_0x32ef('0x68')]+(_0x2d4d2f(_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x68')])?'\x20'+_0x379d40[_0x32ef('0x66')][_0x16525b][_0x32ef('0x69')]:'');}return _0x4b7a4d+')';};var _0x264075={'where':{'id':_0x4454f3[_0x32ef('0x48')]['id']}},_0x3798d1,_0x4befa9,_0x493ae9,_0x143d39,_0x497948;_0x264075=_[_0x32ef('0x3e')]({},_0x264075,_0x4454f3['options']);return db[_0x32ef('0x41')][_0x32ef('0x4b')](_0x264075)['then'](function(_0x1200c9){if(_0x1200c9){_0x3798d1=_0x1200c9;return _0x1200c9[_0x32ef('0x6a')]();}return null;})[_0x32ef('0x22')](function(_0xa5f787){if(_0xa5f787){if(!_0xa5f787[_0x32ef('0x35')]){throw new db['Sequelize'][(_0x32ef('0x6b'))](_0x32ef('0x6c'),0x193);}_0x4befa9=_0xa5f787;return db['AnalyticMetric'][_0x32ef('0x44')]({'raw':!![]});}return null;})[_0x32ef('0x22')](function(_0x55ad11){if(_0x55ad11){_0x493ae9=_[_0x32ef('0x6e')](_0x55ad11,'id');var _0x2971a8;var _0x522c22=squel[_0x32ef('0x6f')]();_0x522c22[_0x32ef('0x8d')](_0x3798d1['table']);for(var _0xb41a01=0x0;_0xb41a01<_0x4befa9[_0x32ef('0x35')];_0xb41a01+=0x1){_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x70')]?_0x493ae9[_0x4befa9[_0xb41a01][_0x32ef('0x70')]][_0x32ef('0xa1')]:_0x4befa9[_0xb41a01][_0x32ef('0x71')];_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x72')]?_['replace'](_0xa76912[_0x4befa9[_0xb41a01]['function']],'%s',_0x2971a8):_0x2971a8;_0x2971a8=_0x4befa9[_0xb41a01][_0x32ef('0x74')]?_[_0x32ef('0x73')](_0x1526a1[_0x4befa9[_0xb41a01][_0x32ef('0x74')]],'%s',_0x2971a8):_0x2971a8;if(_0x4befa9[_0xb41a01]['groupBy']){_0x522c22[_0x32ef('0x67')](_0x2971a8);}_0x4befa9[_0xb41a01][_0x32ef('0x76')]&&_0x522c22['order'](_0x2971a8,_0x4befa9[_0xb41a01][_0x32ef('0x76')]===_0x32ef('0x77')?![]:!![]);_0x522c22['field'](_0x2971a8,_0x4befa9[_0xb41a01]['alias']||_0x2971a8);}if(_0x3798d1[_0x32ef('0x79')]){_0x3798d1[_0x32ef('0x79')]=JSON[_0x32ef('0x7f')](_0x3798d1['joins']);for(var _0x5f4eab=0x0;_0x5f4eab<_0x3798d1['joins'][_0x32ef('0x35')];_0x5f4eab+=0x1){if(_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')]&&_['includes'](_0x9233cb,_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x2f')])&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['parentKey']&&_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')]&&_0x3798d1['joins'][_0x5f4eab]['foreignKey']){_0x522c22[_0x3798d1[_0x32ef('0x79')][_0x5f4eab]['type']](_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3798d1[_0x32ef('0x7d')],_0x3798d1['joins'][_0x5f4eab][_0x32ef('0x7a')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x7b')],_0x3798d1[_0x32ef('0x79')][_0x5f4eab][_0x32ef('0x8e')]));}}}if(_0x3798d1[_0x32ef('0x7e')]){_0x3798d1[_0x32ef('0x7e')]=JSON[_0x32ef('0x7f')](_0x3798d1[_0x32ef('0x7e')]);_0x522c22[_0x32ef('0x3a')](_0x50b674(_0x3798d1['conditions']['group']));}_0x497948=_0x522c22[_0x32ef('0x80')]();_0x522c22[_0x32ef('0x1d')](_0x3d18b9);_0x522c22[_0x32ef('0x1a')](0x0);logger[_0x32ef('0x81')](_0x32ef('0xa2'),_0x522c22[_0x32ef('0x82')]());return dbH[_0x32ef('0x83')][_0x32ef('0x32')](_0x522c22[_0x32ef('0x82')](),{'type':dbH[_0x32ef('0x83')]['QueryTypes'][_0x32ef('0x85')]});}})[_0x32ef('0x22')](function(){return{'sql':_0x497948[_0x32ef('0x82')]()};})[_0x32ef('0x22')](respondWithResult(_0xc92dcc,null))[_0x32ef('0x46')](handleError(_0xc92dcc,null));};
\ No newline at end of file
+var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x3cecc6,_0x517799){var _0x3804aa=function(_0x3ed176){while(--_0x3ed176){_0x3cecc6['push'](_0x3cecc6['shift']());}};_0x3804aa(++_0x517799);}(_0x4975,0x86));var _0x5497=function(_0x389011,_0x46b8d6){_0x389011=_0x389011-0x0;var _0x562a16=_0x4975[_0x389011];return _0x562a16;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));};
\ No newline at end of file
index 822f66c..4d866eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7448=['moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','../../config/logger'];(function(_0x4bc65f,_0x39ec43){var _0x44f85f=function(_0x175343){while(--_0x175343){_0x4bc65f['push'](_0x4bc65f['shift']());}};_0x44f85f(++_0x39ec43);}(_0x7448,0x1dd));var _0x8744=function(_0xe4194b,_0x4b7ab1){_0xe4194b=_0xe4194b-0x0;var _0xaae39f=_0x7448[_0xe4194b];return _0xaae39f;};'use strict';var _=require(_0x8744('0x0'));var util=require(_0x8744('0x1'));var logger=require(_0x8744('0x2'))('api');var moment=require(_0x8744('0x3'));var BPromise=require(_0x8744('0x4'));var rp=require(_0x8744('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8744('0x6'));var config=require(_0x8744('0x7'));var attributes=require(_0x8744('0x8'));module[_0x8744('0x9')]=function(_0x473c6a,_0x1f36a1){return _0x473c6a[_0x8744('0xa')](_0x8744('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd588=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x3d748b,_0x16092d){var _0x2631d6=function(_0x25dafd){while(--_0x25dafd){_0x3d748b['push'](_0x3d748b['shift']());}};_0x2631d6(++_0x16092d);}(_0xd588,0x1be));var _0x8d58=function(_0x497ee0,_0x17c87c){_0x497ee0=_0x497ee0-0x0;var _0x47c05a=_0xd588[_0x497ee0];return _0x47c05a;};'use strict';var _=require(_0x8d58('0x0'));var util=require('util');var logger=require(_0x8d58('0x1'))(_0x8d58('0x2'));var moment=require(_0x8d58('0x3'));var BPromise=require(_0x8d58('0x4'));var rp=require(_0x8d58('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d58('0x6'));var config=require(_0x8d58('0x7'));var attributes=require(_0x8d58('0x8'));module[_0x8d58('0x9')]=function(_0xb993,_0x24a437){return _0xb993[_0x8d58('0xa')](_0x8d58('0xb'),attributes,{'tableName':_0x8d58('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5ddc672..a0218ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x52e3=['AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x42b832,_0x2a7144){var _0x54d6c9=function(_0x4b9bb1){while(--_0x4b9bb1){_0x42b832['push'](_0x42b832['shift']());}};_0x54d6c9(++_0x2a7144);}(_0x52e3,0x98));var _0x352e=function(_0x399cd0,_0x1f9073){_0x399cd0=_0x399cd0-0x0;var _0x123d8f=_0x52e3[_0x399cd0];return _0x123d8f;};'use strict';var _=require(_0x352e('0x0'));var util=require(_0x352e('0x1'));var moment=require(_0x352e('0x2'));var BPromise=require(_0x352e('0x3'));var rs=require(_0x352e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x352e('0x5'))['db'];var utils=require(_0x352e('0x6'));var logger=require(_0x352e('0x7'))(_0x352e('0x8'));var config=require(_0x352e('0x9'));var jayson=require(_0x352e('0xa'));var client=jayson[_0x352e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x58335f,_0x4183e8,_0x2da786){return new BPromise(function(_0x3a9eb5,_0x187674){return client['request'](_0x58335f,_0x2da786)[_0x352e('0xc')](function(_0x53fbaf){logger[_0x352e('0xd')](_0x352e('0xe'),_0x4183e8,_0x352e('0xf'));logger['debug'](_0x352e('0x10'),_0x4183e8,_0x352e('0xf'),JSON[_0x352e('0x11')](_0x53fbaf));if(_0x53fbaf[_0x352e('0x12')]){if(_0x53fbaf[_0x352e('0x12')]['code']===0x1f4){logger[_0x352e('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4183e8,_0x53fbaf[_0x352e('0x12')][_0x352e('0x13')]);return _0x187674(_0x53fbaf[_0x352e('0x12')]['message']);}logger[_0x352e('0x12')](_0x352e('0xe'),_0x4183e8,_0x53fbaf[_0x352e('0x12')][_0x352e('0x13')]);return _0x3a9eb5(_0x53fbaf[_0x352e('0x12')]['message']);}else{logger[_0x352e('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4183e8,_0x352e('0xf'));_0x3a9eb5(_0x53fbaf['result']['message']);}})[_0x352e('0x14')](function(_0x3cbcd7){logger[_0x352e('0x12')](_0x352e('0xe'),_0x4183e8,_0x3cbcd7);_0x187674(_0x3cbcd7);});});}
\ No newline at end of file
+var _0x3bd3=['lodash','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x3bd3,0x7e));var _0x33bd=function(_0x2a5b82,_0xc61f63){_0x2a5b82=_0x2a5b82-0x0;var _0x322e1a=_0x3bd3[_0x2a5b82];return _0x322e1a;};'use strict';var _=require(_0x33bd('0x0'));var util=require(_0x33bd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x33bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x33bd('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x33bd('0x4'))(_0x33bd('0x5'));var config=require(_0x33bd('0x6'));var jayson=require(_0x33bd('0x7'));var client=jayson[_0x33bd('0x8')][_0x33bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23ee83,_0x1954c5,_0x2e3328){return new BPromise(function(_0x136eb4,_0x25d719){return client[_0x33bd('0xa')](_0x23ee83,_0x2e3328)[_0x33bd('0xb')](function(_0x29d106){logger[_0x33bd('0xc')](_0x33bd('0xd'),_0x1954c5,'request\x20sent');logger['debug'](_0x33bd('0xe'),_0x1954c5,_0x33bd('0xf'),JSON[_0x33bd('0x10')](_0x29d106));if(_0x29d106[_0x33bd('0x11')]){if(_0x29d106[_0x33bd('0x11')]['code']===0x1f4){logger[_0x33bd('0x11')](_0x33bd('0xd'),_0x1954c5,_0x29d106[_0x33bd('0x11')][_0x33bd('0x12')]);return _0x25d719(_0x29d106[_0x33bd('0x11')][_0x33bd('0x12')]);}logger[_0x33bd('0x11')](_0x33bd('0xd'),_0x1954c5,_0x29d106[_0x33bd('0x11')]['message']);return _0x136eb4(_0x29d106[_0x33bd('0x11')][_0x33bd('0x12')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x1954c5,_0x33bd('0xf'));_0x136eb4(_0x29d106[_0x33bd('0x13')][_0x33bd('0x12')]);}})[_0x33bd('0x14')](function(_0x202be5){logger[_0x33bd('0x11')](_0x33bd('0xd'),_0x1954c5,_0x202be5);_0x25d719(_0x202be5);});});}
\ No newline at end of file
index 322aa32..0e075dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ea0=['delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','query','post','create','put','update'];(function(_0x152c94,_0x1b9c39){var _0x4c46e8=function(_0xc758f1){while(--_0xc758f1){_0x152c94['push'](_0x152c94['shift']());}};_0x4c46e8(++_0x1b9c39);}(_0x2ea0,0x13b));var _0x02ea=function(_0x42701f,_0x3d2f90){_0x42701f=_0x42701f-0x0;var _0x36aafb=_0x2ea0[_0x42701f];return _0x36aafb;};'use strict';var multer=require(_0x02ea('0x0'));var util=require(_0x02ea('0x1'));var path=require(_0x02ea('0x2'));var timeout=require('connect-timeout');var express=require(_0x02ea('0x3'));var router=express[_0x02ea('0x4')]();var fs_extra=require(_0x02ea('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x02ea('0x6'));var config=require('../../config/environment');var controller=require(_0x02ea('0x7'));router[_0x02ea('0x8')]('/',auth[_0x02ea('0x9')](),controller[_0x02ea('0xa')]);router[_0x02ea('0x8')](_0x02ea('0xb'),auth[_0x02ea('0x9')](),controller[_0x02ea('0xc')]);router[_0x02ea('0x8')](_0x02ea('0xd'),auth[_0x02ea('0x9')](),controller['preview']);router[_0x02ea('0x8')](_0x02ea('0xe'),auth[_0x02ea('0x9')](),controller[_0x02ea('0xf')]);router[_0x02ea('0x8')]('/:id/query',auth[_0x02ea('0x9')](),controller[_0x02ea('0x10')]);router[_0x02ea('0x11')]('/',auth['isAuthenticated'](),controller[_0x02ea('0x12')]);router[_0x02ea('0x13')](_0x02ea('0xb'),auth[_0x02ea('0x9')](),controller[_0x02ea('0x14')]);router[_0x02ea('0x15')](_0x02ea('0xb'),auth[_0x02ea('0x9')](),controller[_0x02ea('0x16')]);module[_0x02ea('0x17')]=router;
\ No newline at end of file
+var _0xe1c1=['../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','isAuthenticated','show','preview','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','express','fs-extra'];(function(_0x50f008,_0x5abe67){var _0x5d5483=function(_0x26402a){while(--_0x26402a){_0x50f008['push'](_0x50f008['shift']());}};_0x5d5483(++_0x5abe67);}(_0xe1c1,0x14b));var _0x1e1c=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xe1c1[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x1e1c('0x0'));var util=require(_0x1e1c('0x1'));var path=require(_0x1e1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x1e1c('0x3'));var router=express['Router']();var fs_extra=require(_0x1e1c('0x4'));var auth=require(_0x1e1c('0x5'));var interaction=require(_0x1e1c('0x6'));var config=require(_0x1e1c('0x7'));var controller=require(_0x1e1c('0x8'));router[_0x1e1c('0x9')]('/',auth['isAuthenticated'](),controller[_0x1e1c('0xa')]);router[_0x1e1c('0x9')]('/:id',auth[_0x1e1c('0xb')](),controller[_0x1e1c('0xc')]);router['get']('/:id/preview',auth[_0x1e1c('0xb')](),controller[_0x1e1c('0xd')]);router[_0x1e1c('0x9')]('/:id/run',auth[_0x1e1c('0xb')](),controller['run']);router[_0x1e1c('0x9')](_0x1e1c('0xe'),auth[_0x1e1c('0xb')](),controller[_0x1e1c('0xf')]);router[_0x1e1c('0x10')]('/',auth[_0x1e1c('0xb')](),controller[_0x1e1c('0x11')]);router[_0x1e1c('0x12')](_0x1e1c('0x13'),auth[_0x1e1c('0xb')](),controller[_0x1e1c('0x14')]);router[_0x1e1c('0x15')](_0x1e1c('0x13'),auth[_0x1e1c('0xb')](),controller[_0x1e1c('0x16')]);module[_0x1e1c('0x17')]=router;
\ No newline at end of file
index a61aa6a..ff38b23 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88f0=['DATE','Loading','manual','INTEGER','UNSIGNED','moment','exports','STRING','ENUM','pdf','xlsx','csv'];(function(_0x3f5a03,_0x2a123c){var _0x226761=function(_0x218546){while(--_0x218546){_0x3f5a03['push'](_0x3f5a03['shift']());}};_0x226761(++_0x2a123c);}(_0x88f0,0x149));var _0x088f=function(_0x32146e,_0x2be230){_0x32146e=_0x32146e-0x0;var _0x375cc7=_0x88f0[_0x32146e];return _0x375cc7;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x088f('0x0'));module[_0x088f('0x1')]={'name':{'type':Sequelize[_0x088f('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x088f('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x088f('0x3')]('csv',_0x088f('0x4'),_0x088f('0x5')),'allowNull':![],'defaultValue':_0x088f('0x6')},'savename':{'type':Sequelize[_0x088f('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x088f('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x088f('0x8')},'type':{'type':Sequelize[_0x088f('0x3')](_0x088f('0x9'),'scheduled'),'allowNull':![],'defaultValue':_0x088f('0x9')},'reportId':{'type':Sequelize[_0x088f('0xa')](0xb)[_0x088f('0xb')]},'reportType':{'type':Sequelize[_0x088f('0x2')]}};
\ No newline at end of file
+var _0xa690=['manual','scheduled','INTEGER','UNSIGNED','sequelize','moment','exports','STRING','csv','pdf','xlsx','DATE','ENUM'];(function(_0xee4c5f,_0x1bf72d){var _0x5accbc=function(_0x5ca2aa){while(--_0x5ca2aa){_0xee4c5f['push'](_0xee4c5f['shift']());}};_0x5accbc(++_0x1bf72d);}(_0xa690,0x93));var _0x0a69=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0xa690[_0x4e1a49];return _0x136aae;};'use strict';var Sequelize=require(_0x0a69('0x0'));var moment=require(_0x0a69('0x1'));module[_0x0a69('0x2')]={'name':{'type':Sequelize[_0x0a69('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x0a69('0x3')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0x0a69('0x4'),_0x0a69('0x5'),_0x0a69('0x6')),'allowNull':![],'defaultValue':_0x0a69('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x0a69('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0x0a69('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x0a69('0x8')](_0x0a69('0x9'),_0x0a69('0xa')),'allowNull':![],'defaultValue':_0x0a69('0x9')},'reportId':{'type':Sequelize[_0x0a69('0xb')](0xb)[_0x0a69('0xc')]},'reportType':{'type':Sequelize[_0x0a69('0x3')]}};
\ No newline at end of file
index f57956f..67fa2fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xebc3=['send','map','rawAttributes','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','VIRTUAL','filter','merge','AnalyticExtractedReport','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','savename','output','existsSync','join','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','%s.%s','toLowerCase','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','ExtractedReports','destroy','sendStatus','error','stack','name'];(function(_0x2c61d7,_0x2bb9ed){var _0x203628=function(_0x3b5750){while(--_0x3b5750){_0x2c61d7['push'](_0x2c61d7['shift']());}};_0x203628(++_0x2bb9ed);}(_0xebc3,0x8f));var _0x3ebc=function(_0x1d5248,_0x1261c5){_0x1d5248=_0x1d5248-0x0;var _0x6c4dbc=_0xebc3[_0x1d5248];return _0x6c4dbc;};'use strict';var emlformat=require(_0x3ebc('0x0'));var rimraf=require(_0x3ebc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ebc('0x2'));var rp=require(_0x3ebc('0x3'));var moment=require(_0x3ebc('0x4'));var BPromise=require(_0x3ebc('0x5'));var Mustache=require(_0x3ebc('0x6'));var util=require(_0x3ebc('0x7'));var path=require(_0x3ebc('0x8'));var sox=require(_0x3ebc('0x9'));var csv=require(_0x3ebc('0xa'));var ejs=require(_0x3ebc('0xb'));var fs=require('fs');var fs_extra=require(_0x3ebc('0xc'));var _=require('lodash');var squel=require(_0x3ebc('0xd'));var crypto=require(_0x3ebc('0xe'));var jsforce=require(_0x3ebc('0xf'));var deskjs=require(_0x3ebc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x3ebc('0x11'));var Papa=require(_0x3ebc('0x12'));var Redis=require('ioredis');var authService=require(_0x3ebc('0x13'));var qs=require(_0x3ebc('0x14'));var as=require(_0x3ebc('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ebc('0x16'))('api');var utils=require(_0x3ebc('0x17'));var config=require(_0x3ebc('0x18'));var licenseUtil=require(_0x3ebc('0x19'));var db=require(_0x3ebc('0x1a'))['db'];function respondWithStatusCode(_0x436dab,_0x3e9f99){_0x3e9f99=_0x3e9f99||0xcc;return function(_0x4bf553){if(_0x4bf553){return _0x436dab['sendStatus'](_0x3e9f99);}return _0x436dab[_0x3ebc('0x1b')](_0x3e9f99)[_0x3ebc('0x1c')]();};}function respondWithResult(_0x39fdf3,_0x59c12c){_0x59c12c=_0x59c12c||0xc8;return function(_0x38b5ae){if(_0x38b5ae){return _0x39fdf3['status'](_0x59c12c)[_0x3ebc('0x1d')](_0x38b5ae);}};}function respondWithFilteredResult(_0x4b6894,_0x52536d){return function(_0x312ecc){if(_0x312ecc){var _0x13365a=typeof _0x52536d[_0x3ebc('0x1e')]===_0x3ebc('0x1f')&&typeof _0x52536d[_0x3ebc('0x20')]===_0x3ebc('0x1f');var _0x9b826d=_0x312ecc[_0x3ebc('0x21')];var _0xb43476=_0x13365a?0x0:_0x52536d[_0x3ebc('0x1e')];var _0x24cf35=_0x13365a?_0x312ecc[_0x3ebc('0x21')]:_0x52536d[_0x3ebc('0x1e')]+_0x52536d[_0x3ebc('0x20')];var _0x75338f;if(_0x24cf35>=_0x9b826d){_0x24cf35=_0x9b826d;_0x75338f=0xc8;}else{_0x75338f=0xce;}_0x4b6894['status'](_0x75338f);return _0x4b6894[_0x3ebc('0x22')]('Content-Range',_0xb43476+'-'+_0x24cf35+'/'+_0x9b826d)[_0x3ebc('0x1d')](_0x312ecc);}return null;};}function patchUpdates(_0x163283){return function(_0x43a18b){try{jsonpatch[_0x3ebc('0x23')](_0x43a18b,_0x163283,!![]);}catch(_0xafd019){return BPromise[_0x3ebc('0x24')](_0xafd019);}return _0x43a18b[_0x3ebc('0x25')]();};}function saveUpdates(_0xef2f33,_0x7f7d3){return function(_0x5bd35f){if(_0x5bd35f){return _0x5bd35f[_0x3ebc('0x26')](_0xef2f33)[_0x3ebc('0x27')](function(_0x3c3d6e){return _0x3c3d6e;});}return null;};}function removeEntity(_0x3799cd,_0x260a7b){return function(_0x3df2e1){if(_0x3df2e1){return _0x3df2e1['destroy']()[_0x3ebc('0x27')](function(){var _0x5b5402=_0x3df2e1[_0x3ebc('0x28')]({'plain':!![]});var _0x8478fc=_0x3ebc('0x29');return db['UserProfileResource'][_0x3ebc('0x2a')]({'where':{'type':_0x8478fc,'resourceId':_0x5b5402['id']}})['then'](function(){return _0x3df2e1;});})[_0x3ebc('0x27')](function(){_0x3799cd[_0x3ebc('0x1b')](0xcc)[_0x3ebc('0x1c')]();});}};}function handleEntityNotFound(_0x2ee6c3,_0x2eab9b){return function(_0x5c751b){if(!_0x5c751b){_0x2ee6c3[_0x3ebc('0x2b')](0x194);}return _0x5c751b;};}function handleError(_0x35f226,_0x165bc2){_0x165bc2=_0x165bc2||0x1f4;return function(_0x2974d9){logger[_0x3ebc('0x2c')](_0x2974d9[_0x3ebc('0x2d')]);if(_0x2974d9[_0x3ebc('0x2e')]){delete _0x2974d9[_0x3ebc('0x2e')];}_0x35f226[_0x3ebc('0x1b')](_0x165bc2)[_0x3ebc('0x2f')](_0x2974d9);};}exports['index']=function(_0x12c24e,_0x4e9eea){var _0x1f8e20={},_0x596ddd={},_0x4b728f={'count':0x0,'rows':[]};var _0x411f0e=_[_0x3ebc('0x30')](db['AnalyticExtractedReport'][_0x3ebc('0x31')],function(_0x1a4d34){return{'name':_0x1a4d34['fieldName'],'type':_0x1a4d34['type'][_0x3ebc('0x32')]};});_0x596ddd[_0x3ebc('0x33')]=_[_0x3ebc('0x30')](_0x411f0e,'name');_0x596ddd['query']=_[_0x3ebc('0x34')](_0x12c24e[_0x3ebc('0x35')]);_0x596ddd['filters']=_['intersection'](_0x596ddd[_0x3ebc('0x33')],_0x596ddd[_0x3ebc('0x35')]);_0x1f8e20[_0x3ebc('0x36')]=_[_0x3ebc('0x37')](_0x596ddd[_0x3ebc('0x33')],qs[_0x3ebc('0x38')](_0x12c24e['query'][_0x3ebc('0x38')]));_0x1f8e20[_0x3ebc('0x36')]=_0x1f8e20[_0x3ebc('0x36')][_0x3ebc('0x39')]?_0x1f8e20['attributes']:_0x596ddd[_0x3ebc('0x33')];if(!_0x12c24e['query'][_0x3ebc('0x3a')](_0x3ebc('0x3b'))){_0x1f8e20[_0x3ebc('0x20')]=qs[_0x3ebc('0x20')](_0x12c24e[_0x3ebc('0x35')]['limit']);_0x1f8e20[_0x3ebc('0x1e')]=qs['offset'](_0x12c24e[_0x3ebc('0x35')]['offset']);}_0x1f8e20[_0x3ebc('0x3c')]=qs['sort'](_0x12c24e[_0x3ebc('0x35')]['sort']);_0x1f8e20[_0x3ebc('0x3d')]=qs[_0x3ebc('0x3e')](_[_0x3ebc('0x3f')](_0x12c24e['query'],_0x596ddd['filters']),_0x411f0e);if(_0x12c24e['query']['filter']){_0x1f8e20[_0x3ebc('0x3d')]=_['merge'](_0x1f8e20[_0x3ebc('0x3d')],{'$or':_[_0x3ebc('0x30')](_0x411f0e,function(_0x1c9f79){if(_0x1c9f79['type']!==_0x3ebc('0x40')){var _0x267007={};_0x267007[_0x1c9f79[_0x3ebc('0x2e')]]={'$like':'%'+_0x12c24e[_0x3ebc('0x35')][_0x3ebc('0x41')]+'%'};return _0x267007;}})});}_0x1f8e20=_[_0x3ebc('0x42')]({},_0x1f8e20,_0x12c24e['options']);var _0xa457fa={'where':_0x1f8e20['where']};return db[_0x3ebc('0x43')]['count'](_0xa457fa)[_0x3ebc('0x27')](function(_0x197d92){_0x4b728f[_0x3ebc('0x21')]=_0x197d92;if(_0x12c24e['query']['includeAll']){_0x1f8e20['include']=[{'all':!![]}];}return db[_0x3ebc('0x43')][_0x3ebc('0x44')](_0x1f8e20);})[_0x3ebc('0x27')](function(_0x2b01c9){_0x4b728f['rows']=_0x2b01c9;return _0x4b728f;})[_0x3ebc('0x27')](respondWithFilteredResult(_0x4e9eea,_0x1f8e20))[_0x3ebc('0x45')](handleError(_0x4e9eea,null));};exports[_0x3ebc('0x46')]=function(_0x16374e,_0x1f5d0d){var _0x8e151={'raw':!![],'where':{'id':_0x16374e[_0x3ebc('0x47')]['id']}},_0x2a3174={};_0x2a3174[_0x3ebc('0x33')]=_[_0x3ebc('0x34')](db['AnalyticExtractedReport'][_0x3ebc('0x31')]);_0x2a3174['query']=_[_0x3ebc('0x34')](_0x16374e[_0x3ebc('0x35')]);_0x2a3174['filters']=_[_0x3ebc('0x37')](_0x2a3174[_0x3ebc('0x33')],_0x2a3174[_0x3ebc('0x35')]);_0x8e151['attributes']=_[_0x3ebc('0x37')](_0x2a3174[_0x3ebc('0x33')],qs[_0x3ebc('0x38')](_0x16374e[_0x3ebc('0x35')][_0x3ebc('0x38')]));_0x8e151[_0x3ebc('0x36')]=_0x8e151['attributes'][_0x3ebc('0x39')]?_0x8e151[_0x3ebc('0x36')]:_0x2a3174[_0x3ebc('0x33')];if(_0x16374e[_0x3ebc('0x35')]['includeAll']){_0x8e151['include']=[{'all':!![]}];}_0x8e151=_['merge']({},_0x8e151,_0x16374e[_0x3ebc('0x48')]);return db[_0x3ebc('0x43')][_0x3ebc('0x49')](_0x8e151)[_0x3ebc('0x27')](handleEntityNotFound(_0x1f5d0d,null))[_0x3ebc('0x27')](respondWithResult(_0x1f5d0d,null))[_0x3ebc('0x45')](handleError(_0x1f5d0d,null));};exports[_0x3ebc('0x4a')]=function(_0x27d132,_0x148ec3){return db['AnalyticExtractedReport'][_0x3ebc('0x4a')](_0x27d132[_0x3ebc('0x4b')],{})[_0x3ebc('0x27')](function(_0x4421cc){var _0x238b7f=_0x27d132[_0x3ebc('0x4c')][_0x3ebc('0x28')]({'plain':!![]});if(!_0x238b7f)throw new Error(_0x3ebc('0x4d'));if(_0x238b7f[_0x3ebc('0x4e')]===_0x3ebc('0x4c')){var _0x4848ba=_0x4421cc[_0x3ebc('0x28')]({'plain':!![]});var _0x58421d=_0x3ebc('0x29');return db['UserProfileSection'][_0x3ebc('0x49')]({'where':{'name':_0x58421d,'userProfileId':_0x238b7f[_0x3ebc('0x4f')]},'raw':!![]})[_0x3ebc('0x27')](function(_0x1388c4){if(_0x1388c4&&_0x1388c4[_0x3ebc('0x50')]===0x0){return db[_0x3ebc('0x51')][_0x3ebc('0x4a')]({'name':_0x4848ba[_0x3ebc('0x2e')],'resourceId':_0x4848ba['id'],'type':_0x1388c4[_0x3ebc('0x2e')],'sectionId':_0x1388c4['id']},{})[_0x3ebc('0x27')](function(){return _0x4421cc;});}else{return _0x4421cc;}})[_0x3ebc('0x45')](function(_0x561494){logger[_0x3ebc('0x2c')](_0x3ebc('0x52'),_0x561494);throw _0x561494;});}return _0x4421cc;})[_0x3ebc('0x27')](respondWithResult(_0x148ec3,0xc9))[_0x3ebc('0x45')](handleError(_0x148ec3,null));};exports[_0x3ebc('0x26')]=function(_0x145c25,_0x52ab40){if(_0x145c25[_0x3ebc('0x4b')]['id']){delete _0x145c25['body']['id'];}return db[_0x3ebc('0x43')]['find']({'where':{'id':_0x145c25[_0x3ebc('0x47')]['id']}})[_0x3ebc('0x27')](handleEntityNotFound(_0x52ab40,null))['then'](saveUpdates(_0x145c25[_0x3ebc('0x4b')],null))[_0x3ebc('0x27')](respondWithResult(_0x52ab40,null))['catch'](handleError(_0x52ab40,null));};exports[_0x3ebc('0x2a')]=function(_0x3eb1b3,_0x3af659){return db[_0x3ebc('0x43')][_0x3ebc('0x49')]({'where':{'id':_0x3eb1b3['params']['id']}})[_0x3ebc('0x27')](handleEntityNotFound(_0x3af659,null))['then'](removeEntity(_0x3af659,null))[_0x3ebc('0x45')](handleError(_0x3af659,null));};exports[_0x3ebc('0x53')]=function(_0x3059ab,_0x4a7570,_0x4d527f){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x3059ab[_0x3ebc('0x47')]['id']},'attributes':[_0x3ebc('0x2e'),_0x3ebc('0x54'),_0x3ebc('0x55'),_0x3ebc('0x56')],'raw':!![]})[_0x3ebc('0x27')](handleEntityNotFound(_0x4a7570,null))[_0x3ebc('0x27')](function(_0x147168){if(_0x147168){if(!fs[_0x3ebc('0x57')](path[_0x3ebc('0x58')](config[_0x3ebc('0x59')],_0x3ebc('0x5a'),_0x147168[_0x3ebc('0x55')]))){throw new db['Sequelize'][(_0x3ebc('0x5b'))](_0x3ebc('0x5c'));}if(_0x3059ab[_0x3ebc('0x35')]['exists']){return _0x4a7570['sendStatus'](0xc8);}return _0x4a7570[_0x3ebc('0x53')](path[_0x3ebc('0x58')](config['root'],_0x3ebc('0x5a'),_0x147168['savename']),util['format'](_0x3ebc('0x5d'),_0x147168[_0x3ebc('0x54')]||_0x147168['name'],_0x147168[_0x3ebc('0x56')][_0x3ebc('0x5e')]()));}})[_0x3ebc('0x45')](handleError(_0x4a7570,null));};
\ No newline at end of file
+var _0xd553=['server/files/reports','ValidationError','%s.%s','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','ExtractedReports','error','stack','name','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','UserProfileResource','download','savename','output','existsSync','join','root'];(function(_0x17158c,_0x58cb92){var _0x734f31=function(_0x2a7a84){while(--_0x2a7a84){_0x17158c['push'](_0x17158c['shift']());}};_0x734f31(++_0x58cb92);}(_0xd553,0xba));var _0x3d55=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0xd553[_0x459a0a];return _0x4ab46c;};'use strict';var emlformat=require(_0x3d55('0x0'));var rimraf=require(_0x3d55('0x1'));var zipdir=require(_0x3d55('0x2'));var jsonpatch=require(_0x3d55('0x3'));var rp=require('request-promise');var moment=require(_0x3d55('0x4'));var BPromise=require(_0x3d55('0x5'));var Mustache=require('mustache');var util=require(_0x3d55('0x6'));var path=require(_0x3d55('0x7'));var sox=require(_0x3d55('0x8'));var csv=require(_0x3d55('0x9'));var ejs=require(_0x3d55('0xa'));var fs=require('fs');var fs_extra=require(_0x3d55('0xb'));var _=require(_0x3d55('0xc'));var squel=require(_0x3d55('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3d55('0xe'));var toCsv=require(_0x3d55('0x9'));var querystring=require('querystring');var Papa=require(_0x3d55('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3d55('0x10'));var as=require(_0x3d55('0x11'));var hardwareService=require(_0x3d55('0x12'));var logger=require(_0x3d55('0x13'))(_0x3d55('0x14'));var utils=require(_0x3d55('0x15'));var config=require(_0x3d55('0x16'));var licenseUtil=require(_0x3d55('0x17'));var db=require(_0x3d55('0x18'))['db'];function respondWithStatusCode(_0x44dfd3,_0x2f401d){_0x2f401d=_0x2f401d||0xcc;return function(_0x5e8aad){if(_0x5e8aad){return _0x44dfd3[_0x3d55('0x19')](_0x2f401d);}return _0x44dfd3[_0x3d55('0x1a')](_0x2f401d)[_0x3d55('0x1b')]();};}function respondWithResult(_0x40f34c,_0x416fdf){_0x416fdf=_0x416fdf||0xc8;return function(_0x408b49){if(_0x408b49){return _0x40f34c[_0x3d55('0x1a')](_0x416fdf)[_0x3d55('0x1c')](_0x408b49);}};}function respondWithFilteredResult(_0x4616e2,_0xf42eec){return function(_0x1ded74){if(_0x1ded74){var _0x5ce2a0=typeof _0xf42eec[_0x3d55('0x1d')]===_0x3d55('0x1e')&&typeof _0xf42eec[_0x3d55('0x1f')]===_0x3d55('0x1e');var _0xc182b9=_0x1ded74['count'];var _0x48dfc5=_0x5ce2a0?0x0:_0xf42eec[_0x3d55('0x1d')];var _0x2b4794=_0x5ce2a0?_0x1ded74[_0x3d55('0x20')]:_0xf42eec[_0x3d55('0x1d')]+_0xf42eec[_0x3d55('0x1f')];var _0x41ff8b;if(_0x2b4794>=_0xc182b9){_0x2b4794=_0xc182b9;_0x41ff8b=0xc8;}else{_0x41ff8b=0xce;}_0x4616e2[_0x3d55('0x1a')](_0x41ff8b);return _0x4616e2[_0x3d55('0x21')](_0x3d55('0x22'),_0x48dfc5+'-'+_0x2b4794+'/'+_0xc182b9)[_0x3d55('0x1c')](_0x1ded74);}return null;};}function patchUpdates(_0x573199){return function(_0x2c4a2a){try{jsonpatch['apply'](_0x2c4a2a,_0x573199,!![]);}catch(_0x237a6c){return BPromise[_0x3d55('0x23')](_0x237a6c);}return _0x2c4a2a[_0x3d55('0x24')]();};}function saveUpdates(_0x5292f3,_0x592d78){return function(_0x5c81ba){if(_0x5c81ba){return _0x5c81ba[_0x3d55('0x25')](_0x5292f3)[_0x3d55('0x26')](function(_0x4353e5){return _0x4353e5;});}return null;};}function removeEntity(_0x449635,_0x3ab519){return function(_0x1390b3){if(_0x1390b3){return _0x1390b3[_0x3d55('0x27')]()[_0x3d55('0x26')](function(){var _0x1fc4ca=_0x1390b3['get']({'plain':!![]});var _0x397d75=_0x3d55('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x397d75,'resourceId':_0x1fc4ca['id']}})[_0x3d55('0x26')](function(){return _0x1390b3;});})[_0x3d55('0x26')](function(){_0x449635['status'](0xcc)[_0x3d55('0x1b')]();});}};}function handleEntityNotFound(_0xc5bf83,_0x3155fa){return function(_0x4d9631){if(!_0x4d9631){_0xc5bf83['sendStatus'](0x194);}return _0x4d9631;};}function handleError(_0x3e1854,_0x10f99a){_0x10f99a=_0x10f99a||0x1f4;return function(_0x550248){logger[_0x3d55('0x29')](_0x550248[_0x3d55('0x2a')]);if(_0x550248[_0x3d55('0x2b')]){delete _0x550248[_0x3d55('0x2b')];}_0x3e1854[_0x3d55('0x1a')](_0x10f99a)['send'](_0x550248);};}exports[_0x3d55('0x2c')]=function(_0xc0501a,_0x284cad){var _0x2ac56b={},_0x566fca={},_0x18714a={'count':0x0,'rows':[]};var _0x2f0853=_[_0x3d55('0x2d')](db[_0x3d55('0x2e')][_0x3d55('0x2f')],function(_0x3ebf1d){return{'name':_0x3ebf1d[_0x3d55('0x30')],'type':_0x3ebf1d[_0x3d55('0x31')]['key']};});_0x566fca[_0x3d55('0x32')]=_[_0x3d55('0x2d')](_0x2f0853,_0x3d55('0x2b'));_0x566fca[_0x3d55('0x33')]=_['keys'](_0xc0501a[_0x3d55('0x33')]);_0x566fca[_0x3d55('0x34')]=_[_0x3d55('0x35')](_0x566fca['model'],_0x566fca[_0x3d55('0x33')]);_0x2ac56b[_0x3d55('0x36')]=_['intersection'](_0x566fca[_0x3d55('0x32')],qs[_0x3d55('0x37')](_0xc0501a[_0x3d55('0x33')][_0x3d55('0x37')]));_0x2ac56b[_0x3d55('0x36')]=_0x2ac56b['attributes'][_0x3d55('0x38')]?_0x2ac56b[_0x3d55('0x36')]:_0x566fca[_0x3d55('0x32')];if(!_0xc0501a[_0x3d55('0x33')][_0x3d55('0x39')](_0x3d55('0x3a'))){_0x2ac56b[_0x3d55('0x1f')]=qs[_0x3d55('0x1f')](_0xc0501a['query'][_0x3d55('0x1f')]);_0x2ac56b[_0x3d55('0x1d')]=qs[_0x3d55('0x1d')](_0xc0501a['query'][_0x3d55('0x1d')]);}_0x2ac56b['order']=qs[_0x3d55('0x3b')](_0xc0501a[_0x3d55('0x33')][_0x3d55('0x3b')]);_0x2ac56b[_0x3d55('0x3c')]=qs[_0x3d55('0x34')](_['pick'](_0xc0501a[_0x3d55('0x33')],_0x566fca[_0x3d55('0x34')]),_0x2f0853);if(_0xc0501a['query'][_0x3d55('0x3d')]){_0x2ac56b['where']=_[_0x3d55('0x3e')](_0x2ac56b[_0x3d55('0x3c')],{'$or':_[_0x3d55('0x2d')](_0x2f0853,function(_0x258e15){if(_0x258e15['type']!==_0x3d55('0x3f')){var _0x53ff55={};_0x53ff55[_0x258e15[_0x3d55('0x2b')]]={'$like':'%'+_0xc0501a[_0x3d55('0x33')][_0x3d55('0x3d')]+'%'};return _0x53ff55;}})});}_0x2ac56b=_[_0x3d55('0x3e')]({},_0x2ac56b,_0xc0501a[_0x3d55('0x40')]);var _0x7321bf={'where':_0x2ac56b[_0x3d55('0x3c')]};return db[_0x3d55('0x2e')][_0x3d55('0x20')](_0x7321bf)[_0x3d55('0x26')](function(_0x235334){_0x18714a[_0x3d55('0x20')]=_0x235334;if(_0xc0501a[_0x3d55('0x33')][_0x3d55('0x41')]){_0x2ac56b[_0x3d55('0x42')]=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x2ac56b);})[_0x3d55('0x26')](function(_0x464d84){_0x18714a[_0x3d55('0x43')]=_0x464d84;return _0x18714a;})['then'](respondWithFilteredResult(_0x284cad,_0x2ac56b))[_0x3d55('0x44')](handleError(_0x284cad,null));};exports[_0x3d55('0x45')]=function(_0x4928f9,_0x2e7bf8){var _0x19326d={'raw':!![],'where':{'id':_0x4928f9[_0x3d55('0x46')]['id']}},_0xe21164={};_0xe21164['model']=_[_0x3d55('0x47')](db[_0x3d55('0x2e')][_0x3d55('0x2f')]);_0xe21164[_0x3d55('0x33')]=_['keys'](_0x4928f9[_0x3d55('0x33')]);_0xe21164[_0x3d55('0x34')]=_[_0x3d55('0x35')](_0xe21164[_0x3d55('0x32')],_0xe21164[_0x3d55('0x33')]);_0x19326d[_0x3d55('0x36')]=_['intersection'](_0xe21164[_0x3d55('0x32')],qs[_0x3d55('0x37')](_0x4928f9[_0x3d55('0x33')][_0x3d55('0x37')]));_0x19326d[_0x3d55('0x36')]=_0x19326d[_0x3d55('0x36')]['length']?_0x19326d[_0x3d55('0x36')]:_0xe21164[_0x3d55('0x32')];if(_0x4928f9[_0x3d55('0x33')][_0x3d55('0x41')]){_0x19326d[_0x3d55('0x42')]=[{'all':!![]}];}_0x19326d=_['merge']({},_0x19326d,_0x4928f9['options']);return db['AnalyticExtractedReport']['find'](_0x19326d)[_0x3d55('0x26')](handleEntityNotFound(_0x2e7bf8,null))[_0x3d55('0x26')](respondWithResult(_0x2e7bf8,null))['catch'](handleError(_0x2e7bf8,null));};exports[_0x3d55('0x48')]=function(_0x2f150e,_0x3dc3dd){return db['AnalyticExtractedReport'][_0x3d55('0x48')](_0x2f150e[_0x3d55('0x49')],{})[_0x3d55('0x26')](function(_0xa70b8b){var _0x19f7c6=_0x2f150e[_0x3d55('0x4a')]['get']({'plain':!![]});if(!_0x19f7c6)throw new Error(_0x3d55('0x4b'));if(_0x19f7c6[_0x3d55('0x4c')]==='user'){var _0x2b8b30=_0xa70b8b['get']({'plain':!![]});var _0x46a18c=_0x3d55('0x28');return db['UserProfileSection'][_0x3d55('0x4d')]({'where':{'name':_0x46a18c,'userProfileId':_0x19f7c6[_0x3d55('0x4e')]},'raw':!![]})[_0x3d55('0x26')](function(_0x15429e){if(_0x15429e&&_0x15429e[_0x3d55('0x4f')]===0x0){return db[_0x3d55('0x50')]['create']({'name':_0x2b8b30[_0x3d55('0x2b')],'resourceId':_0x2b8b30['id'],'type':_0x15429e[_0x3d55('0x2b')],'sectionId':_0x15429e['id']},{})[_0x3d55('0x26')](function(){return _0xa70b8b;});}else{return _0xa70b8b;}})[_0x3d55('0x44')](function(_0x42970c){logger[_0x3d55('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42970c);throw _0x42970c;});}return _0xa70b8b;})[_0x3d55('0x26')](respondWithResult(_0x3dc3dd,0xc9))[_0x3d55('0x44')](handleError(_0x3dc3dd,null));};exports['update']=function(_0xc28a25,_0x3a6832){if(_0xc28a25[_0x3d55('0x49')]['id']){delete _0xc28a25[_0x3d55('0x49')]['id'];}return db[_0x3d55('0x2e')][_0x3d55('0x4d')]({'where':{'id':_0xc28a25[_0x3d55('0x46')]['id']}})[_0x3d55('0x26')](handleEntityNotFound(_0x3a6832,null))['then'](saveUpdates(_0xc28a25[_0x3d55('0x49')],null))['then'](respondWithResult(_0x3a6832,null))[_0x3d55('0x44')](handleError(_0x3a6832,null));};exports[_0x3d55('0x27')]=function(_0x22124c,_0x3e4e0b){return db[_0x3d55('0x2e')][_0x3d55('0x4d')]({'where':{'id':_0x22124c[_0x3d55('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e4e0b,null))[_0x3d55('0x26')](removeEntity(_0x3e4e0b,null))[_0x3d55('0x44')](handleError(_0x3e4e0b,null));};exports[_0x3d55('0x51')]=function(_0x53e311,_0x62437,_0x3e538c){return db[_0x3d55('0x2e')]['find']({'where':{'id':_0x53e311['params']['id']},'attributes':[_0x3d55('0x2b'),'basename',_0x3d55('0x52'),_0x3d55('0x53')],'raw':!![]})[_0x3d55('0x26')](handleEntityNotFound(_0x62437,null))[_0x3d55('0x26')](function(_0x2daf11){if(_0x2daf11){if(!fs[_0x3d55('0x54')](path[_0x3d55('0x55')](config[_0x3d55('0x56')],_0x3d55('0x57'),_0x2daf11['savename']))){throw new db['Sequelize'][(_0x3d55('0x58'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x53e311[_0x3d55('0x33')]['exists']){return _0x62437[_0x3d55('0x19')](0xc8);}return _0x62437[_0x3d55('0x51')](path[_0x3d55('0x55')](config[_0x3d55('0x56')],_0x3d55('0x57'),_0x2daf11[_0x3d55('0x52')]),util['format'](_0x3d55('0x59'),_0x2daf11[_0x3d55('0x5a')]||_0x2daf11[_0x3d55('0x2b')],_0x2daf11[_0x3d55('0x53')]['toLowerCase']()));}})[_0x3d55('0x44')](handleError(_0x62437,null));};
\ No newline at end of file
index 12a6002..7645001 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe25=['path','./analyticExtractedReport.attributes','AnalyticExtractedReport','lodash','util','../../config/logger','api','moment'];(function(_0x28878e,_0x4615c1){var _0x5f299c=function(_0x274f5c){while(--_0x274f5c){_0x28878e['push'](_0x28878e['shift']());}};_0x5f299c(++_0x4615c1);}(_0xfe25,0x1d3));var _0x5fe2=function(_0x3bff1f,_0x25d0a4){_0x3bff1f=_0x3bff1f-0x0;var _0x841235=_0xfe25[_0x3bff1f];return _0x841235;};'use strict';var _=require(_0x5fe2('0x0'));var util=require(_0x5fe2('0x1'));var logger=require(_0x5fe2('0x2'))(_0x5fe2('0x3'));var moment=require(_0x5fe2('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5fe2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5fe2('0x6'));module['exports']=function(_0x1dfb9a,_0x4fb554){return _0x1dfb9a['define'](_0x5fe2('0x7'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8c0d=['analytics_extracted_reports','util','../../config/logger','moment','bluebird','request-promise','path','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport'];(function(_0x30bc19,_0xfcd0f1){var _0x331b0c=function(_0x3f2a16){while(--_0x3f2a16){_0x30bc19['push'](_0x30bc19['shift']());}};_0x331b0c(++_0xfcd0f1);}(_0x8c0d,0x1c4));var _0xd8c0=function(_0x2a7812,_0x1ce83a){_0x2a7812=_0x2a7812-0x0;var _0x3e1342=_0x8c0d[_0x2a7812];return _0x3e1342;};'use strict';var _=require('lodash');var util=require(_0xd8c0('0x0'));var logger=require(_0xd8c0('0x1'))('api');var moment=require(_0xd8c0('0x2'));var BPromise=require(_0xd8c0('0x3'));var rp=require(_0xd8c0('0x4'));var fs=require('fs');var path=require(_0xd8c0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd8c0('0x6'));module[_0xd8c0('0x7')]=function(_0x377140,_0x5279ab){return _0x377140[_0xd8c0('0x8')](_0xd8c0('0x9'),attributes,{'tableName':_0xd8c0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index b71976b..24c083c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x751c=['client','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4cb394,_0x1b1382){var _0x1fc243=function(_0x509bdd){while(--_0x509bdd){_0x4cb394['push'](_0x4cb394['shift']());}};_0x1fc243(++_0x1b1382);}(_0x751c,0x69));var _0xc751=function(_0x4c8d66,_0x5e32c3){_0x4c8d66=_0x4c8d66-0x0;var _0x31391c=_0x751c[_0x4c8d66];return _0x31391c;};'use strict';var _=require(_0xc751('0x0'));var util=require(_0xc751('0x1'));var moment=require(_0xc751('0x2'));var BPromise=require('bluebird');var rs=require(_0xc751('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc751('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc751('0x5'))(_0xc751('0x6'));var config=require(_0xc751('0x7'));var jayson=require(_0xc751('0x8'));var client=jayson[_0xc751('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12d079,_0x2df8c6,_0x527cf9){return new BPromise(function(_0x363b18,_0x1c6e7d){return client['request'](_0x12d079,_0x527cf9)[_0xc751('0xa')](function(_0xec967e){logger[_0xc751('0xb')](_0xc751('0xc'),_0x2df8c6,_0xc751('0xd'));logger['debug']('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x2df8c6,'request\x20sent',JSON[_0xc751('0xe')](_0xec967e));if(_0xec967e['error']){if(_0xec967e[_0xc751('0xf')]['code']===0x1f4){logger[_0xc751('0xf')](_0xc751('0xc'),_0x2df8c6,_0xec967e[_0xc751('0xf')]['message']);return _0x1c6e7d(_0xec967e[_0xc751('0xf')]['message']);}logger[_0xc751('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2df8c6,_0xec967e[_0xc751('0xf')][_0xc751('0x10')]);return _0x363b18(_0xec967e[_0xc751('0xf')][_0xc751('0x10')]);}else{logger[_0xc751('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2df8c6,_0xc751('0xd'));_0x363b18(_0xec967e[_0xc751('0x11')][_0xc751('0x10')]);}})[_0xc751('0x12')](function(_0x246d4a){logger[_0xc751('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2df8c6,_0x246d4a);_0x1c6e7d(_0x246d4a);});});}
\ No newline at end of file
+var _0xeae7=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird'];(function(_0x149943,_0x52045a){var _0x3a1612=function(_0x34c5a5){while(--_0x34c5a5){_0x149943['push'](_0x149943['shift']());}};_0x3a1612(++_0x52045a);}(_0xeae7,0x1a1));var _0x7eae=function(_0x8ae98b,_0x155f88){_0x8ae98b=_0x8ae98b-0x0;var _0xc30bd4=_0xeae7[_0x8ae98b];return _0xc30bd4;};'use strict';var _=require('lodash');var util=require(_0x7eae('0x0'));var moment=require(_0x7eae('0x1'));var BPromise=require(_0x7eae('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7eae('0x3'));var db=require(_0x7eae('0x4'))['db'];var utils=require(_0x7eae('0x5'));var logger=require(_0x7eae('0x6'))(_0x7eae('0x7'));var config=require(_0x7eae('0x8'));var jayson=require(_0x7eae('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xd01591,_0xfcbb05,_0x4acf71){return new BPromise(function(_0x3141b7,_0x50a3d9){return client[_0x7eae('0xa')](_0xd01591,_0x4acf71)[_0x7eae('0xb')](function(_0x1b6f32){logger[_0x7eae('0xc')](_0x7eae('0xd'),_0xfcbb05,_0x7eae('0xe'));logger[_0x7eae('0xf')](_0x7eae('0x10'),_0xfcbb05,_0x7eae('0xe'),JSON[_0x7eae('0x11')](_0x1b6f32));if(_0x1b6f32[_0x7eae('0x12')]){if(_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x13')]===0x1f4){logger['error'](_0x7eae('0xd'),_0xfcbb05,_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x50a3d9(_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);}logger[_0x7eae('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0xfcbb05,_0x1b6f32[_0x7eae('0x12')][_0x7eae('0x14')]);return _0x3141b7(_0x1b6f32[_0x7eae('0x12')]['message']);}else{logger['info'](_0x7eae('0xd'),_0xfcbb05,_0x7eae('0xe'));_0x3141b7(_0x1b6f32['result'][_0x7eae('0x14')]);}})['catch'](function(_0x477a8f){logger[_0x7eae('0x12')](_0x7eae('0xd'),_0xfcbb05,_0x477a8f);_0x50a3d9(_0x477a8f);});});}
\ No newline at end of file
index 4436e72..d1436c7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24f3=['util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','post','create','put','delete','destroy','multer'];(function(_0x24505d,_0x403af5){var _0x34c56e=function(_0x1fe0e3){while(--_0x1fe0e3){_0x24505d['push'](_0x24505d['shift']());}};_0x34c56e(++_0x403af5);}(_0x24f3,0x155));var _0x324f=function(_0x2d42f6,_0x45dbd4){_0x2d42f6=_0x2d42f6-0x0;var _0x57a159=_0x24f3[_0x2d42f6];return _0x57a159;};'use strict';var multer=require(_0x324f('0x0'));var util=require(_0x324f('0x1'));var path=require(_0x324f('0x2'));var timeout=require(_0x324f('0x3'));var express=require(_0x324f('0x4'));var router=express['Router']();var fs_extra=require(_0x324f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x324f('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x324f('0x7')]('/',auth[_0x324f('0x8')](),controller['index']);router[_0x324f('0x7')](_0x324f('0x9'),auth['isAuthenticated'](),controller[_0x324f('0xa')]);router['get'](_0x324f('0xb'),auth[_0x324f('0x8')](),controller[_0x324f('0xc')]);router[_0x324f('0xd')]('/',auth[_0x324f('0x8')](),controller[_0x324f('0xe')]);router[_0x324f('0xf')](_0x324f('0x9'),auth[_0x324f('0x8')](),controller['update']);router[_0x324f('0x10')](_0x324f('0x9'),auth[_0x324f('0x8')](),controller[_0x324f('0x11')]);module['exports']=router;
\ No newline at end of file
+var _0xbd0b=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download','create','update','exports'];(function(_0x418549,_0x11b13d){var _0x288826=function(_0x3c0411){while(--_0x3c0411){_0x418549['push'](_0x418549['shift']());}};_0x288826(++_0x11b13d);}(_0xbd0b,0xbb));var _0xbbd0=function(_0x36cf34,_0x335fbe){_0x36cf34=_0x36cf34-0x0;var _0x3fce54=_0xbd0b[_0x36cf34];return _0x3fce54;};'use strict';var multer=require(_0xbbd0('0x0'));var util=require(_0xbbd0('0x1'));var path=require('path');var timeout=require(_0xbbd0('0x2'));var express=require(_0xbbd0('0x3'));var router=express[_0xbbd0('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xbbd0('0x5'));var config=require(_0xbbd0('0x6'));var controller=require(_0xbbd0('0x7'));router[_0xbbd0('0x8')]('/',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xa')]);router[_0xbbd0('0x8')](_0xbbd0('0xb'),auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xc')]);router[_0xbbd0('0x8')](_0xbbd0('0xd'),auth[_0xbbd0('0x9')](),controller['download']);router['post']('/',auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xe')]);router['put'](_0xbbd0('0xb'),auth[_0xbbd0('0x9')](),controller[_0xbbd0('0xf')]);router['delete'](_0xbbd0('0xb'),auth[_0xbbd0('0x9')](),controller['destroy']);module[_0xbbd0('0x10')]=router;
\ No newline at end of file
index 7756972..08b74ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee51=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xee51,0xfa));var _0x1ee5=function(_0x9c5247,_0x187a01){_0x9c5247=_0x9c5247-0x0;var _0x1dc166=_0xee51[_0x9c5247];return _0x1dc166;};'use strict';var Sequelize=require(_0x1ee5('0x0'));module[_0x1ee5('0x1')]={'field':{'type':Sequelize[_0x1ee5('0x2')]},'alias':{'type':Sequelize[_0x1ee5('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x1ee5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x1ee5('0x4')],'defaultValue':![]}};
\ No newline at end of file
+var _0x9098=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4ee3e7,_0x1a955a){var _0x185243=function(_0x4a024d){while(--_0x4a024d){_0x4ee3e7['push'](_0x4ee3e7['shift']());}};_0x185243(++_0x1a955a);}(_0x9098,0x19a));var _0x8909=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9098[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x8909('0x0'));module[_0x8909('0x1')]={'field':{'type':Sequelize[_0x8909('0x2')]},'alias':{'type':Sequelize[_0x8909('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x8909('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8909('0x3')]},'custom':{'type':Sequelize[_0x8909('0x4')],'defaultValue':![]}};
\ No newline at end of file
index ce3918b..4765459 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x01f8=['send','index','map','AnalyticFieldReport','rawAttributes','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','show','keys','options','find','create','bulkCreate','body','update','params','destroy','bulkDestroy','ids','addFields','findOne','sequelize','CustomReportId','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','error','stack'];(function(_0x592fe4,_0xa3d75d){var _0x48b30c=function(_0x4a29da){while(--_0x4a29da){_0x592fe4['push'](_0x592fe4['shift']());}};_0x48b30c(++_0xa3d75d);}(_0x01f8,0xcc));var _0x801f=function(_0x31c8c5,_0x348d41){_0x31c8c5=_0x31c8c5-0x0;var _0x491bb4=_0x01f8[_0x31c8c5];return _0x491bb4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x801f('0x0'));var zipdir=require(_0x801f('0x1'));var jsonpatch=require(_0x801f('0x2'));var rp=require(_0x801f('0x3'));var moment=require(_0x801f('0x4'));var BPromise=require(_0x801f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x801f('0x6'));var sox=require(_0x801f('0x7'));var csv=require(_0x801f('0x8'));var ejs=require(_0x801f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x801f('0xa'));var squel=require(_0x801f('0xb'));var crypto=require(_0x801f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x801f('0xd'));var toCsv=require(_0x801f('0x8'));var querystring=require(_0x801f('0xe'));var Papa=require(_0x801f('0xf'));var Redis=require('ioredis');var authService=require(_0x801f('0x10'));var qs=require(_0x801f('0x11'));var as=require(_0x801f('0x12'));var hardwareService=require(_0x801f('0x13'));var logger=require(_0x801f('0x14'))(_0x801f('0x15'));var utils=require(_0x801f('0x16'));var config=require(_0x801f('0x17'));var licenseUtil=require(_0x801f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26e018,_0x4a6d16){_0x4a6d16=_0x4a6d16||0xcc;return function(_0x5a28b9){if(_0x5a28b9){return _0x26e018[_0x801f('0x19')](_0x4a6d16);}return _0x26e018['status'](_0x4a6d16)[_0x801f('0x1a')]();};}function respondWithResult(_0xe2e794,_0x2c2b26){_0x2c2b26=_0x2c2b26||0xc8;return function(_0x450db8){if(_0x450db8){return _0xe2e794[_0x801f('0x1b')](_0x2c2b26)[_0x801f('0x1c')](_0x450db8);}};}function respondWithFilteredResult(_0x178f96,_0x36c59c){return function(_0xa137df){if(_0xa137df){var _0x551d43=typeof _0x36c59c[_0x801f('0x1d')]===_0x801f('0x1e')&&typeof _0x36c59c[_0x801f('0x1f')]===_0x801f('0x1e');var _0x50ce97=_0xa137df[_0x801f('0x20')];var _0x3db89d=_0x551d43?0x0:_0x36c59c[_0x801f('0x1d')];var _0x51cd99=_0x551d43?_0xa137df[_0x801f('0x20')]:_0x36c59c[_0x801f('0x1d')]+_0x36c59c['limit'];var _0x5b585e;if(_0x51cd99>=_0x50ce97){_0x51cd99=_0x50ce97;_0x5b585e=0xc8;}else{_0x5b585e=0xce;}_0x178f96[_0x801f('0x1b')](_0x5b585e);return _0x178f96['set'](_0x801f('0x21'),_0x3db89d+'-'+_0x51cd99+'/'+_0x50ce97)[_0x801f('0x1c')](_0xa137df);}return null;};}function patchUpdates(_0x36f921){return function(_0x29967e){try{jsonpatch[_0x801f('0x22')](_0x29967e,_0x36f921,!![]);}catch(_0x2813fe){return BPromise[_0x801f('0x23')](_0x2813fe);}return _0x29967e['save']();};}function saveUpdates(_0x32967d,_0x5e7888){return function(_0x31907d){if(_0x31907d){return _0x31907d['update'](_0x32967d)[_0x801f('0x24')](function(_0x3f4576){return _0x3f4576;});}return null;};}function removeEntity(_0x1bfb9b,_0x52c6cd){return function(_0xb671ba){if(_0xb671ba){return _0xb671ba['destroy']()[_0x801f('0x24')](function(){_0x1bfb9b[_0x801f('0x1b')](0xcc)[_0x801f('0x1a')]();});}};}function handleEntityNotFound(_0xb348b5,_0x1116f6){return function(_0x4b43cb){if(!_0x4b43cb){_0xb348b5['sendStatus'](0x194);}return _0x4b43cb;};}function handleError(_0x5b968d,_0x48899f){_0x48899f=_0x48899f||0x1f4;return function(_0xd04eb0){logger[_0x801f('0x25')](_0xd04eb0[_0x801f('0x26')]);if(_0xd04eb0['name']){delete _0xd04eb0['name'];}_0x5b968d[_0x801f('0x1b')](_0x48899f)[_0x801f('0x27')](_0xd04eb0);};}exports[_0x801f('0x28')]=function(_0x1f9c8d,_0x1b13b6){var _0x3363e0={},_0x520ac9={},_0x1c326d={'count':0x0,'rows':[]};var _0x296f53=_[_0x801f('0x29')](db[_0x801f('0x2a')][_0x801f('0x2b')],function(_0x59eab1){return{'name':_0x59eab1['fieldName'],'type':_0x59eab1['type'][_0x801f('0x2c')]};});_0x520ac9[_0x801f('0x2d')]=_['map'](_0x296f53,_0x801f('0x2e'));_0x520ac9[_0x801f('0x2f')]=_['keys'](_0x1f9c8d[_0x801f('0x2f')]);_0x520ac9[_0x801f('0x30')]=_[_0x801f('0x31')](_0x520ac9[_0x801f('0x2d')],_0x520ac9[_0x801f('0x2f')]);_0x3363e0[_0x801f('0x32')]=_['intersection'](_0x520ac9[_0x801f('0x2d')],qs[_0x801f('0x33')](_0x1f9c8d['query'][_0x801f('0x33')]));_0x3363e0[_0x801f('0x32')]=_0x3363e0[_0x801f('0x32')][_0x801f('0x34')]?_0x3363e0[_0x801f('0x32')]:_0x520ac9[_0x801f('0x2d')];if(!_0x1f9c8d[_0x801f('0x2f')][_0x801f('0x35')]('nolimit')){_0x3363e0[_0x801f('0x1f')]=qs[_0x801f('0x1f')](_0x1f9c8d['query'][_0x801f('0x1f')]);_0x3363e0[_0x801f('0x1d')]=qs[_0x801f('0x1d')](_0x1f9c8d[_0x801f('0x2f')][_0x801f('0x1d')]);}_0x3363e0['order']=qs[_0x801f('0x36')](_0x1f9c8d[_0x801f('0x2f')][_0x801f('0x36')]);_0x3363e0[_0x801f('0x37')]=qs['filters'](_[_0x801f('0x38')](_0x1f9c8d[_0x801f('0x2f')],_0x520ac9['filters']),_0x296f53);if(_0x1f9c8d[_0x801f('0x2f')][_0x801f('0x39')]){_0x3363e0['where']=_[_0x801f('0x3a')](_0x3363e0[_0x801f('0x37')],{'$or':_[_0x801f('0x29')](_0x296f53,function(_0x2aa597){if(_0x2aa597[_0x801f('0x3b')]!==_0x801f('0x3c')){var _0x1c7da0={};_0x1c7da0[_0x2aa597['name']]={'$like':'%'+_0x1f9c8d['query'][_0x801f('0x39')]+'%'};return _0x1c7da0;}})});}_0x3363e0=_[_0x801f('0x3a')]({},_0x3363e0,_0x1f9c8d['options']);var _0x564e89={'where':_0x3363e0[_0x801f('0x37')]};return db[_0x801f('0x2a')][_0x801f('0x20')](_0x564e89)['then'](function(_0x50e3d4){_0x1c326d['count']=_0x50e3d4;if(_0x1f9c8d[_0x801f('0x2f')][_0x801f('0x3d')]){_0x3363e0['include']=[{'all':!![]}];}return db[_0x801f('0x2a')][_0x801f('0x3e')](_0x3363e0);})[_0x801f('0x24')](function(_0x11b256){_0x1c326d[_0x801f('0x3f')]=_0x11b256;return _0x1c326d;})['then'](respondWithFilteredResult(_0x1b13b6,_0x3363e0))[_0x801f('0x40')](handleError(_0x1b13b6,null));};exports[_0x801f('0x41')]=function(_0x34a21b,_0x333a16){var _0x4d1f03={'raw':![],'where':{'id':_0x34a21b['params']['id']}},_0x522b41={};_0x522b41[_0x801f('0x2d')]=_[_0x801f('0x42')](db[_0x801f('0x2a')]['rawAttributes']);_0x522b41[_0x801f('0x2f')]=_[_0x801f('0x42')](_0x34a21b[_0x801f('0x2f')]);_0x522b41[_0x801f('0x30')]=_[_0x801f('0x31')](_0x522b41['model'],_0x522b41[_0x801f('0x2f')]);_0x4d1f03[_0x801f('0x32')]=_[_0x801f('0x31')](_0x522b41[_0x801f('0x2d')],qs[_0x801f('0x33')](_0x34a21b['query']['fields']));_0x4d1f03[_0x801f('0x32')]=_0x4d1f03[_0x801f('0x32')][_0x801f('0x34')]?_0x4d1f03[_0x801f('0x32')]:_0x522b41['model'];if(_0x34a21b['query'][_0x801f('0x3d')]){_0x4d1f03['include']=[{'all':!![]}];}_0x4d1f03=_['merge']({},_0x4d1f03,_0x34a21b[_0x801f('0x43')]);return db[_0x801f('0x2a')][_0x801f('0x44')](_0x4d1f03)[_0x801f('0x24')](handleEntityNotFound(_0x333a16,null))[_0x801f('0x24')](respondWithResult(_0x333a16,null))[_0x801f('0x40')](handleError(_0x333a16,null));};exports[_0x801f('0x45')]=function(_0xf96b56,_0x46be33){return db[_0x801f('0x2a')]['create'](_0xf96b56['body'],{})['then'](respondWithResult(_0x46be33,0xc9))[_0x801f('0x40')](handleError(_0x46be33,null));};exports[_0x801f('0x46')]=function(_0x3ef5df,_0x283bdb){return db['AnalyticFieldReport'][_0x801f('0x46')](_0x3ef5df[_0x801f('0x47')],{'raw':![],'individualHooks':!![]})[_0x801f('0x24')](respondWithResult(_0x283bdb,0xc9))['catch'](handleError(_0x283bdb,null));};exports[_0x801f('0x48')]=function(_0x27b1b9,_0x9b83f3){if(_0x27b1b9['body']['id']){delete _0x27b1b9[_0x801f('0x47')]['id'];}return db[_0x801f('0x2a')][_0x801f('0x44')]({'where':{'id':_0x27b1b9[_0x801f('0x49')]['id']}})['then'](handleEntityNotFound(_0x9b83f3,null))['then'](saveUpdates(_0x27b1b9[_0x801f('0x47')],null))[_0x801f('0x24')](respondWithResult(_0x9b83f3,null))[_0x801f('0x40')](handleError(_0x9b83f3,null));};exports[_0x801f('0x4a')]=function(_0x2ff9e4,_0x5c05c8){return db['AnalyticFieldReport'][_0x801f('0x44')]({'where':{'id':_0x2ff9e4[_0x801f('0x49')]['id']}})[_0x801f('0x24')](handleEntityNotFound(_0x5c05c8,null))['then'](removeEntity(_0x5c05c8,null))[_0x801f('0x40')](handleError(_0x5c05c8,null));};exports[_0x801f('0x4b')]=function(_0xab87c5,_0x5b2fca){return db['AnalyticFieldReport'][_0x801f('0x4a')]({'where':{'id':_0xab87c5['query'][_0x801f('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x801f('0x24')](respondWithResult(_0x5b2fca,0xcc))[_0x801f('0x40')](handleError(_0x5b2fca,null));};exports[_0x801f('0x4d')]=function(_0x2ec157,_0x5befe8,_0x494314){return db['AnalyticCustomReport'][_0x801f('0x4e')]({'where':{'id':_0x2ec157['params']['id']}})[_0x801f('0x24')](handleEntityNotFound(_0x5befe8,null))[_0x801f('0x24')](function(_0x5887c7){if(_0x5887c7){return db[_0x801f('0x4f')]['transaction'](function(_0x2c44b8){return db[_0x801f('0x2a')]['destroy']({'where':{'CustomReportId':_0x2ec157[_0x801f('0x49')]['id']},'transaction':_0x2c44b8})[_0x801f('0x24')](function(_0x1e1146){var _0x2350fe=_[_0x801f('0x29')](_0x2ec157['body'],function(_0x3750b5){delete _0x3750b5['id'];_0x3750b5[_0x801f('0x50')]=_0x2ec157[_0x801f('0x49')]['id'];return _0x3750b5;});return db['AnalyticFieldReport']['bulkCreate'](_0x2350fe,{'transaction':_0x2c44b8});});})[_0x801f('0x24')](function(){return db[_0x801f('0x2a')]['findAll']({'where':{'CustomReportId':_0x2ec157[_0x801f('0x49')]['id']}});});}})['then'](respondWithResult(_0x5befe8,null))['catch'](handleError(_0x5befe8,null));};
\ No newline at end of file
+var _0x06d7=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','offset','set','apply','reject','update','destroy','error','name','send','index','map','AnalyticFieldReport','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','then','includeAll','include','findAll','rows','catch','params','rawAttributes','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir'];(function(_0x152e5d,_0x5c41ee){var _0x14aa0e=function(_0x4b9d43){while(--_0x4b9d43){_0x152e5d['push'](_0x152e5d['shift']());}};_0x14aa0e(++_0x5c41ee);}(_0x06d7,0x19c));var _0x706d=function(_0x520071,_0x449f4d){_0x520071=_0x520071-0x0;var _0x2c2ec6=_0x06d7[_0x520071];return _0x2c2ec6;};'use strict';var emlformat=require(_0x706d('0x0'));var rimraf=require(_0x706d('0x1'));var zipdir=require(_0x706d('0x2'));var jsonpatch=require(_0x706d('0x3'));var rp=require(_0x706d('0x4'));var moment=require(_0x706d('0x5'));var BPromise=require(_0x706d('0x6'));var Mustache=require(_0x706d('0x7'));var util=require(_0x706d('0x8'));var path=require('path');var sox=require(_0x706d('0x9'));var csv=require(_0x706d('0xa'));var ejs=require(_0x706d('0xb'));var fs=require('fs');var fs_extra=require(_0x706d('0xc'));var _=require(_0x706d('0xd'));var squel=require('squel');var crypto=require(_0x706d('0xe'));var jsforce=require(_0x706d('0xf'));var deskjs=require(_0x706d('0x10'));var toCsv=require(_0x706d('0xa'));var querystring=require(_0x706d('0x11'));var Papa=require(_0x706d('0x12'));var Redis=require(_0x706d('0x13'));var authService=require(_0x706d('0x14'));var qs=require(_0x706d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x706d('0x16'))('api');var utils=require(_0x706d('0x17'));var config=require(_0x706d('0x18'));var licenseUtil=require(_0x706d('0x19'));var db=require(_0x706d('0x1a'))['db'];function respondWithStatusCode(_0x370334,_0x3b2255){_0x3b2255=_0x3b2255||0xcc;return function(_0x42aadb){if(_0x42aadb){return _0x370334[_0x706d('0x1b')](_0x3b2255);}return _0x370334['status'](_0x3b2255)[_0x706d('0x1c')]();};}function respondWithResult(_0x245ddf,_0x1acceb){_0x1acceb=_0x1acceb||0xc8;return function(_0x5df650){if(_0x5df650){return _0x245ddf[_0x706d('0x1d')](_0x1acceb)['json'](_0x5df650);}};}function respondWithFilteredResult(_0x1b9ae8,_0x34aa9e){return function(_0x4194a1){if(_0x4194a1){var _0x322cf0=typeof _0x34aa9e['offset']===_0x706d('0x1e')&&typeof _0x34aa9e[_0x706d('0x1f')]===_0x706d('0x1e');var _0x23b596=_0x4194a1[_0x706d('0x20')];var _0x5c9b81=_0x322cf0?0x0:_0x34aa9e[_0x706d('0x21')];var _0x1f6d59=_0x322cf0?_0x4194a1[_0x706d('0x20')]:_0x34aa9e[_0x706d('0x21')]+_0x34aa9e[_0x706d('0x1f')];var _0x4d7c94;if(_0x1f6d59>=_0x23b596){_0x1f6d59=_0x23b596;_0x4d7c94=0xc8;}else{_0x4d7c94=0xce;}_0x1b9ae8['status'](_0x4d7c94);return _0x1b9ae8[_0x706d('0x22')]('Content-Range',_0x5c9b81+'-'+_0x1f6d59+'/'+_0x23b596)['json'](_0x4194a1);}return null;};}function patchUpdates(_0x4adc01){return function(_0x413608){try{jsonpatch[_0x706d('0x23')](_0x413608,_0x4adc01,!![]);}catch(_0x71bec7){return BPromise[_0x706d('0x24')](_0x71bec7);}return _0x413608['save']();};}function saveUpdates(_0x10b0ab,_0x1f52d0){return function(_0xeba428){if(_0xeba428){return _0xeba428[_0x706d('0x25')](_0x10b0ab)['then'](function(_0x204661){return _0x204661;});}return null;};}function removeEntity(_0x25f28a,_0x3bb8b4){return function(_0x165679){if(_0x165679){return _0x165679[_0x706d('0x26')]()['then'](function(){_0x25f28a['status'](0xcc)[_0x706d('0x1c')]();});}};}function handleEntityNotFound(_0x2f0124,_0x5362a0){return function(_0x5e2367){if(!_0x5e2367){_0x2f0124[_0x706d('0x1b')](0x194);}return _0x5e2367;};}function handleError(_0x400e11,_0x55d6c3){_0x55d6c3=_0x55d6c3||0x1f4;return function(_0xce7b19){logger[_0x706d('0x27')](_0xce7b19['stack']);if(_0xce7b19[_0x706d('0x28')]){delete _0xce7b19['name'];}_0x400e11[_0x706d('0x1d')](_0x55d6c3)[_0x706d('0x29')](_0xce7b19);};}exports[_0x706d('0x2a')]=function(_0x1ddbd2,_0x774899){var _0x321dbe={},_0x567a82={},_0x4972ba={'count':0x0,'rows':[]};var _0x558edf=_[_0x706d('0x2b')](db[_0x706d('0x2c')]['rawAttributes'],function(_0x39dcf8){return{'name':_0x39dcf8[_0x706d('0x2d')],'type':_0x39dcf8[_0x706d('0x2e')]['key']};});_0x567a82[_0x706d('0x2f')]=_['map'](_0x558edf,_0x706d('0x28'));_0x567a82[_0x706d('0x30')]=_[_0x706d('0x31')](_0x1ddbd2[_0x706d('0x30')]);_0x567a82[_0x706d('0x32')]=_[_0x706d('0x33')](_0x567a82['model'],_0x567a82[_0x706d('0x30')]);_0x321dbe[_0x706d('0x34')]=_[_0x706d('0x33')](_0x567a82['model'],qs['fields'](_0x1ddbd2['query'][_0x706d('0x35')]));_0x321dbe[_0x706d('0x34')]=_0x321dbe['attributes'][_0x706d('0x36')]?_0x321dbe[_0x706d('0x34')]:_0x567a82[_0x706d('0x2f')];if(!_0x1ddbd2[_0x706d('0x30')][_0x706d('0x37')](_0x706d('0x38'))){_0x321dbe[_0x706d('0x1f')]=qs[_0x706d('0x1f')](_0x1ddbd2['query'][_0x706d('0x1f')]);_0x321dbe['offset']=qs[_0x706d('0x21')](_0x1ddbd2['query'][_0x706d('0x21')]);}_0x321dbe['order']=qs[_0x706d('0x39')](_0x1ddbd2[_0x706d('0x30')]['sort']);_0x321dbe[_0x706d('0x3a')]=qs[_0x706d('0x32')](_[_0x706d('0x3b')](_0x1ddbd2['query'],_0x567a82[_0x706d('0x32')]),_0x558edf);if(_0x1ddbd2['query'][_0x706d('0x3c')]){_0x321dbe[_0x706d('0x3a')]=_[_0x706d('0x3d')](_0x321dbe[_0x706d('0x3a')],{'$or':_[_0x706d('0x2b')](_0x558edf,function(_0x36b860){if(_0x36b860[_0x706d('0x2e')]!=='VIRTUAL'){var _0x565bf4={};_0x565bf4[_0x36b860[_0x706d('0x28')]]={'$like':'%'+_0x1ddbd2[_0x706d('0x30')][_0x706d('0x3c')]+'%'};return _0x565bf4;}})});}_0x321dbe=_[_0x706d('0x3d')]({},_0x321dbe,_0x1ddbd2['options']);var _0x4c69c3={'where':_0x321dbe[_0x706d('0x3a')]};return db[_0x706d('0x2c')][_0x706d('0x20')](_0x4c69c3)[_0x706d('0x3e')](function(_0x4b53b6){_0x4972ba[_0x706d('0x20')]=_0x4b53b6;if(_0x1ddbd2[_0x706d('0x30')][_0x706d('0x3f')]){_0x321dbe[_0x706d('0x40')]=[{'all':!![]}];}return db[_0x706d('0x2c')][_0x706d('0x41')](_0x321dbe);})[_0x706d('0x3e')](function(_0x447abc){_0x4972ba[_0x706d('0x42')]=_0x447abc;return _0x4972ba;})['then'](respondWithFilteredResult(_0x774899,_0x321dbe))[_0x706d('0x43')](handleError(_0x774899,null));};exports['show']=function(_0x31fe14,_0xc8da00){var _0x382746={'raw':![],'where':{'id':_0x31fe14[_0x706d('0x44')]['id']}},_0x504767={};_0x504767[_0x706d('0x2f')]=_[_0x706d('0x31')](db[_0x706d('0x2c')][_0x706d('0x45')]);_0x504767[_0x706d('0x30')]=_['keys'](_0x31fe14['query']);_0x504767[_0x706d('0x32')]=_[_0x706d('0x33')](_0x504767['model'],_0x504767[_0x706d('0x30')]);_0x382746[_0x706d('0x34')]=_[_0x706d('0x33')](_0x504767[_0x706d('0x2f')],qs[_0x706d('0x35')](_0x31fe14[_0x706d('0x30')]['fields']));_0x382746[_0x706d('0x34')]=_0x382746[_0x706d('0x34')]['length']?_0x382746['attributes']:_0x504767['model'];if(_0x31fe14[_0x706d('0x30')]['includeAll']){_0x382746['include']=[{'all':!![]}];}_0x382746=_[_0x706d('0x3d')]({},_0x382746,_0x31fe14[_0x706d('0x46')]);return db[_0x706d('0x2c')][_0x706d('0x47')](_0x382746)[_0x706d('0x3e')](handleEntityNotFound(_0xc8da00,null))['then'](respondWithResult(_0xc8da00,null))['catch'](handleError(_0xc8da00,null));};exports[_0x706d('0x48')]=function(_0x52c8da,_0x841369){return db[_0x706d('0x2c')][_0x706d('0x48')](_0x52c8da[_0x706d('0x49')],{})[_0x706d('0x3e')](respondWithResult(_0x841369,0xc9))['catch'](handleError(_0x841369,null));};exports[_0x706d('0x4a')]=function(_0x1b130c,_0x53178f){return db[_0x706d('0x2c')][_0x706d('0x4a')](_0x1b130c['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x53178f,0xc9))[_0x706d('0x43')](handleError(_0x53178f,null));};exports[_0x706d('0x25')]=function(_0x8b0dca,_0xba2e77){if(_0x8b0dca[_0x706d('0x49')]['id']){delete _0x8b0dca['body']['id'];}return db[_0x706d('0x2c')][_0x706d('0x47')]({'where':{'id':_0x8b0dca[_0x706d('0x44')]['id']}})[_0x706d('0x3e')](handleEntityNotFound(_0xba2e77,null))[_0x706d('0x3e')](saveUpdates(_0x8b0dca['body'],null))['then'](respondWithResult(_0xba2e77,null))['catch'](handleError(_0xba2e77,null));};exports['destroy']=function(_0x117841,_0x339c6e){return db[_0x706d('0x2c')][_0x706d('0x47')]({'where':{'id':_0x117841[_0x706d('0x44')]['id']}})['then'](handleEntityNotFound(_0x339c6e,null))[_0x706d('0x3e')](removeEntity(_0x339c6e,null))[_0x706d('0x43')](handleError(_0x339c6e,null));};exports[_0x706d('0x4b')]=function(_0xe40444,_0x214a9){return db[_0x706d('0x2c')][_0x706d('0x26')]({'where':{'id':_0xe40444[_0x706d('0x30')][_0x706d('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0x706d('0x3e')](respondWithResult(_0x214a9,0xcc))['catch'](handleError(_0x214a9,null));};exports[_0x706d('0x4d')]=function(_0x538e64,_0x5b0531,_0x484040){return db[_0x706d('0x4e')][_0x706d('0x4f')]({'where':{'id':_0x538e64[_0x706d('0x44')]['id']}})[_0x706d('0x3e')](handleEntityNotFound(_0x5b0531,null))['then'](function(_0x90384){if(_0x90384){return db[_0x706d('0x50')][_0x706d('0x51')](function(_0x57f322){return db[_0x706d('0x2c')][_0x706d('0x26')]({'where':{'CustomReportId':_0x538e64[_0x706d('0x44')]['id']},'transaction':_0x57f322})[_0x706d('0x3e')](function(_0x11e02d){var _0x1d0af1=_[_0x706d('0x2b')](_0x538e64['body'],function(_0x373ff8){delete _0x373ff8['id'];_0x373ff8[_0x706d('0x52')]=_0x538e64['params']['id'];return _0x373ff8;});return db[_0x706d('0x2c')][_0x706d('0x4a')](_0x1d0af1,{'transaction':_0x57f322});});})['then'](function(){return db[_0x706d('0x2c')][_0x706d('0x41')]({'where':{'CustomReportId':_0x538e64[_0x706d('0x44')]['id']}});});}})[_0x706d('0x3e')](respondWithResult(_0x5b0531,null))[_0x706d('0x43')](handleError(_0x5b0531,null));};
\ No newline at end of file
index 065d5e9..52b64a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5316=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x5316,0xc3));var _0x6531=function(_0x1678c8,_0x1c32f4){_0x1678c8=_0x1678c8-0x0;var _0x387aa9=_0x5316[_0x1678c8];return _0x387aa9;};'use strict';var _=require(_0x6531('0x0'));var util=require(_0x6531('0x1'));var logger=require(_0x6531('0x2'))(_0x6531('0x3'));var moment=require(_0x6531('0x4'));var BPromise=require(_0x6531('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6531('0x6'));var rimraf=require(_0x6531('0x7'));var config=require(_0x6531('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x6531('0x9')]=function(_0x269e94,_0x5ba807){return _0x269e94[_0x6531('0xa')](_0x6531('0xb'),attributes,{'tableName':_0x6531('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf993=['exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','./analyticFieldReport.attributes'];(function(_0x4cebcc,_0x56253e){var _0x4d1669=function(_0x89e326){while(--_0x89e326){_0x4cebcc['push'](_0x4cebcc['shift']());}};_0x4d1669(++_0x56253e);}(_0xf993,0x10c));var _0x3f99=function(_0x26dfa5,_0x2ed3e9){_0x26dfa5=_0x26dfa5-0x0;var _0x408dd2=_0xf993[_0x26dfa5];return _0x408dd2;};'use strict';var _=require('lodash');var util=require(_0x3f99('0x0'));var logger=require(_0x3f99('0x1'))(_0x3f99('0x2'));var moment=require(_0x3f99('0x3'));var BPromise=require(_0x3f99('0x4'));var rp=require(_0x3f99('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3f99('0x6'));module[_0x3f99('0x7')]=function(_0x573caf,_0x54fcb5){return _0x573caf[_0x3f99('0x8')](_0x3f99('0x9'),attributes,{'tableName':_0x3f99('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 546eabc..29ed7d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3186=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticFieldReport,\x20%s,\x20%s','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2deb38,_0xe86ff8){var _0x560599=function(_0x2c8e37){while(--_0x2c8e37){_0x2deb38['push'](_0x2deb38['shift']());}};_0x560599(++_0xe86ff8);}(_0x3186,0xeb));var _0x6318=function(_0x4549ad,_0x1dafe3){_0x4549ad=_0x4549ad-0x0;var _0x5b3806=_0x3186[_0x4549ad];return _0x5b3806;};'use strict';var _=require(_0x6318('0x0'));var util=require(_0x6318('0x1'));var moment=require(_0x6318('0x2'));var BPromise=require(_0x6318('0x3'));var rs=require(_0x6318('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6318('0x5'))['db'];var utils=require(_0x6318('0x6'));var logger=require(_0x6318('0x7'))(_0x6318('0x8'));var config=require(_0x6318('0x9'));var jayson=require(_0x6318('0xa'));var client=jayson[_0x6318('0xb')][_0x6318('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2da641,_0x5470b3,_0x1fc833){return new BPromise(function(_0x53ac9e,_0x245a34){return client['request'](_0x2da641,_0x1fc833)['then'](function(_0x3e2471){logger[_0x6318('0xd')](_0x6318('0xe'),_0x5470b3,'request\x20sent');logger['debug'](_0x6318('0xf'),_0x5470b3,_0x6318('0x10'),JSON['stringify'](_0x3e2471));if(_0x3e2471[_0x6318('0x11')]){if(_0x3e2471[_0x6318('0x11')][_0x6318('0x12')]===0x1f4){logger['error'](_0x6318('0xe'),_0x5470b3,_0x3e2471[_0x6318('0x11')]['message']);return _0x245a34(_0x3e2471[_0x6318('0x11')][_0x6318('0x13')]);}logger['error'](_0x6318('0xe'),_0x5470b3,_0x3e2471[_0x6318('0x11')]['message']);return _0x53ac9e(_0x3e2471['error']['message']);}else{logger[_0x6318('0xd')](_0x6318('0xe'),_0x5470b3,_0x6318('0x10'));_0x53ac9e(_0x3e2471[_0x6318('0x14')][_0x6318('0x13')]);}})[_0x6318('0x15')](function(_0x3f8677){logger[_0x6318('0x11')](_0x6318('0xe'),_0x5470b3,_0x3f8677);_0x245a34(_0x3f8677);});});}
\ No newline at end of file
+var _0x3ca5=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x32b557,_0x41a85b){var _0x2ddffa=function(_0x2e528b){while(--_0x2e528b){_0x32b557['push'](_0x32b557['shift']());}};_0x2ddffa(++_0x41a85b);}(_0x3ca5,0x9c));var _0x53ca=function(_0xbb29da,_0x4898e0){_0xbb29da=_0xbb29da-0x0;var _0x23fc83=_0x3ca5[_0xbb29da];return _0x23fc83;};'use strict';var _=require(_0x53ca('0x0'));var util=require(_0x53ca('0x1'));var moment=require(_0x53ca('0x2'));var BPromise=require(_0x53ca('0x3'));var rs=require(_0x53ca('0x4'));var fs=require('fs');var Redis=require(_0x53ca('0x5'));var db=require(_0x53ca('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x53ca('0x7'))(_0x53ca('0x8'));var config=require(_0x53ca('0x9'));var jayson=require(_0x53ca('0xa'));var client=jayson[_0x53ca('0xb')][_0x53ca('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x574a45,_0x170afd,_0x4c6a7f){return new BPromise(function(_0x5ee470,_0x44ae94){return client[_0x53ca('0xd')](_0x574a45,_0x4c6a7f)[_0x53ca('0xe')](function(_0x31b8f5){logger['info'](_0x53ca('0xf'),_0x170afd,_0x53ca('0x10'));logger[_0x53ca('0x11')](_0x53ca('0x12'),_0x170afd,_0x53ca('0x10'),JSON[_0x53ca('0x13')](_0x31b8f5));if(_0x31b8f5['error']){if(_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x15')]===0x1f4){logger['error'](_0x53ca('0xf'),_0x170afd,_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x16')]);return _0x44ae94(_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x16')]);}logger[_0x53ca('0x14')](_0x53ca('0xf'),_0x170afd,_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x16')]);return _0x5ee470(_0x31b8f5[_0x53ca('0x14')][_0x53ca('0x16')]);}else{logger[_0x53ca('0x17')](_0x53ca('0xf'),_0x170afd,'request\x20sent');_0x5ee470(_0x31b8f5[_0x53ca('0x18')][_0x53ca('0x16')]);}})[_0x53ca('0x19')](function(_0x135866){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x170afd,_0x135866);_0x44ae94(_0x135866);});});}
\ No newline at end of file
index 1a1b87d..97b18dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x221994,_0x22fb97){var _0x16e5b0=function(_0x2fbe45){while(--_0x2fbe45){_0x221994['push'](_0x221994['shift']());}};_0x16e5b0(++_0x22fb97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
+var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x40f154,_0x22a66d){var _0x3f900a=function(_0x4cf737){while(--_0x4cf737){_0x40f154['push'](_0x40f154['shift']());}};_0x3f900a(++_0x22a66d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router;
\ No newline at end of file
index 20ff22c..7fcf788 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc9b=['sequelize','exports','STRING','TEXT'];(function(_0x5d72da,_0xb7ce32){var _0x43ebe7=function(_0x503755){while(--_0x503755){_0x5d72da['push'](_0x5d72da['shift']());}};_0x43ebe7(++_0xb7ce32);}(_0xdc9b,0x70));var _0xbdc9=function(_0x2b397f,_0x5d271c){_0x2b397f=_0x2b397f-0x0;var _0x16384a=_0xdc9b[_0x2b397f];return _0x16384a;};'use strict';var Sequelize=require(_0xbdc9('0x0'));module[_0xbdc9('0x1')]={'name':{'type':Sequelize[_0xbdc9('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xbdc9('0x2')]},'metric':{'type':Sequelize[_0xbdc9('0x3')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xd027=['STRING','TEXT','exports'];(function(_0x15b932,_0x39ba3f){var _0x28fa64=function(_0x479c8a){while(--_0x479c8a){_0x15b932['push'](_0x15b932['shift']());}};_0x28fa64(++_0x39ba3f);}(_0xd027,0x197));var _0x7d02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd027[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x7d02('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x7d02('0x1')]},'metric':{'type':Sequelize[_0x7d02('0x2')]},'description':{'type':Sequelize[_0x7d02('0x1')]}};
\ No newline at end of file
index 0a2daf6..0ff80f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x2decee,_0x455029){var _0x2f4504=function(_0x551b16){while(--_0x551b16){_0x2decee['push'](_0x2decee['shift']());}};_0x2f4504(++_0x455029);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));};
\ No newline at end of file
+var _0xe5b3=['undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json'];(function(_0x525061,_0x1e780b){var _0x4f49f9=function(_0xfcd55f){while(--_0xfcd55f){_0x525061['push'](_0x525061['shift']());}};_0x4f49f9(++_0x1e780b);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0xe5b3[_0x2ff4bd];return _0x28edc6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];function respondWithStatusCode(_0x374068,_0x20b97b){_0x20b97b=_0x20b97b||0xcc;return function(_0x3c4eb1){if(_0x3c4eb1){return _0x374068[_0x3e5b('0x19')](_0x20b97b);}return _0x374068['status'](_0x20b97b)[_0x3e5b('0x1a')]();};}function respondWithResult(_0x5f2f9c,_0x51a188){_0x51a188=_0x51a188||0xc8;return function(_0x4d71a3){if(_0x4d71a3){return _0x5f2f9c[_0x3e5b('0x1b')](_0x51a188)[_0x3e5b('0x1c')](_0x4d71a3);}};}function respondWithFilteredResult(_0x17aaa3,_0x4fb471){return function(_0x1f81a7){if(_0x1f81a7){var _0x59ddc0=typeof _0x4fb471['offset']===_0x3e5b('0x1d')&&typeof _0x4fb471[_0x3e5b('0x1e')]==='undefined';var _0x3d58a4=_0x1f81a7[_0x3e5b('0x1f')];var _0x555002=_0x59ddc0?0x0:_0x4fb471[_0x3e5b('0x20')];var _0x3365dd=_0x59ddc0?_0x1f81a7['count']:_0x4fb471['offset']+_0x4fb471[_0x3e5b('0x1e')];var _0x20806a;if(_0x3365dd>=_0x3d58a4){_0x3365dd=_0x3d58a4;_0x20806a=0xc8;}else{_0x20806a=0xce;}_0x17aaa3[_0x3e5b('0x1b')](_0x20806a);return _0x17aaa3[_0x3e5b('0x21')](_0x3e5b('0x22'),_0x555002+'-'+_0x3365dd+'/'+_0x3d58a4)[_0x3e5b('0x1c')](_0x1f81a7);}return null;};}function patchUpdates(_0x447d36){return function(_0x21fc32){try{jsonpatch[_0x3e5b('0x23')](_0x21fc32,_0x447d36,!![]);}catch(_0x3d95f3){return BPromise[_0x3e5b('0x24')](_0x3d95f3);}return _0x21fc32[_0x3e5b('0x25')]();};}function saveUpdates(_0x2d77cc,_0x402873){return function(_0x5b46d4){if(_0x5b46d4){return _0x5b46d4[_0x3e5b('0x26')](_0x2d77cc)[_0x3e5b('0x27')](function(_0x2146d4){return _0x2146d4;});}return null;};}function removeEntity(_0x150674,_0x50039b){return function(_0x1eb80f){if(_0x1eb80f){return _0x1eb80f['destroy']()[_0x3e5b('0x27')](function(){var _0x36d960=_0x1eb80f['get']({'plain':!![]});var _0x41b684=_0x3e5b('0x28');return db[_0x3e5b('0x29')][_0x3e5b('0x2a')]({'where':{'type':_0x41b684,'resourceId':_0x36d960['id']}})[_0x3e5b('0x27')](function(){return _0x1eb80f;});})[_0x3e5b('0x27')](function(){_0x150674[_0x3e5b('0x1b')](0xcc)[_0x3e5b('0x1a')]();});}};}function handleEntityNotFound(_0x4c4b89,_0x1c7278){return function(_0x505f40){if(!_0x505f40){_0x4c4b89[_0x3e5b('0x19')](0x194);}return _0x505f40;};}function handleError(_0x4fd64b,_0x101653){_0x101653=_0x101653||0x1f4;return function(_0x1f6473){logger[_0x3e5b('0x2b')](_0x1f6473[_0x3e5b('0x2c')]);if(_0x1f6473[_0x3e5b('0x2d')]){delete _0x1f6473[_0x3e5b('0x2d')];}_0x4fd64b[_0x3e5b('0x1b')](_0x101653)[_0x3e5b('0x2e')](_0x1f6473);};}exports[_0x3e5b('0x2f')]=function(_0x112dc0,_0x1e1565){var _0x489221={},_0x21bc10={},_0x1882aa={'count':0x0,'rows':[]};var _0xa8760b=_[_0x3e5b('0x30')](db[_0x3e5b('0x31')][_0x3e5b('0x32')],function(_0x345927){return{'name':_0x345927['fieldName'],'type':_0x345927[_0x3e5b('0x33')]['key']};});_0x21bc10['model']=_[_0x3e5b('0x30')](_0xa8760b,_0x3e5b('0x2d'));_0x21bc10['query']=_[_0x3e5b('0x34')](_0x112dc0[_0x3e5b('0x35')]);_0x21bc10[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],_0x21bc10[_0x3e5b('0x35')]);_0x489221[_0x3e5b('0x39')]=_[_0x3e5b('0x37')](_0x21bc10[_0x3e5b('0x38')],qs[_0x3e5b('0x3a')](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x489221['attributes']=_0x489221[_0x3e5b('0x39')][_0x3e5b('0x3b')]?_0x489221['attributes']:_0x21bc10['model'];if(!_0x112dc0[_0x3e5b('0x35')]['hasOwnProperty'](_0x3e5b('0x3c'))){_0x489221[_0x3e5b('0x1e')]=qs[_0x3e5b('0x1e')](_0x112dc0[_0x3e5b('0x35')]['limit']);_0x489221[_0x3e5b('0x20')]=qs['offset'](_0x112dc0[_0x3e5b('0x35')]['offset']);}_0x489221['order']=qs['sort'](_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x3d')]);_0x489221[_0x3e5b('0x3e')]=qs[_0x3e5b('0x36')](_[_0x3e5b('0x3f')](_0x112dc0[_0x3e5b('0x35')],_0x21bc10['filters']),_0xa8760b);if(_0x112dc0['query']['filter']){_0x489221['where']=_['merge'](_0x489221['where'],{'$or':_['map'](_0xa8760b,function(_0x182bc4){if(_0x182bc4[_0x3e5b('0x33')]!==_0x3e5b('0x40')){var _0x1aafd5={};_0x1aafd5[_0x182bc4[_0x3e5b('0x2d')]]={'$like':'%'+_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x41')]+'%'};return _0x1aafd5;}})});}_0x489221=_[_0x3e5b('0x42')]({},_0x489221,_0x112dc0[_0x3e5b('0x43')]);var _0xbbc6b={'where':_0x489221[_0x3e5b('0x3e')]};return db['AnalyticMetric'][_0x3e5b('0x1f')](_0xbbc6b)[_0x3e5b('0x27')](function(_0x1e8075){_0x1882aa[_0x3e5b('0x1f')]=_0x1e8075;if(_0x112dc0[_0x3e5b('0x35')][_0x3e5b('0x44')]){_0x489221[_0x3e5b('0x45')]=[{'all':!![]}];}return db[_0x3e5b('0x31')][_0x3e5b('0x46')](_0x489221);})[_0x3e5b('0x27')](function(_0x13c8d5){_0x1882aa['rows']=_0x13c8d5;return _0x1882aa;})['then'](respondWithFilteredResult(_0x1e1565,_0x489221))['catch'](handleError(_0x1e1565,null));};exports['show']=function(_0xa99d75,_0x21ee8a){var _0x9fc025={'raw':!![],'where':{'id':_0xa99d75[_0x3e5b('0x47')]['id']}},_0x24c416={};_0x24c416[_0x3e5b('0x38')]=_[_0x3e5b('0x34')](db[_0x3e5b('0x31')][_0x3e5b('0x32')]);_0x24c416[_0x3e5b('0x35')]=_['keys'](_0xa99d75[_0x3e5b('0x35')]);_0x24c416[_0x3e5b('0x36')]=_[_0x3e5b('0x37')](_0x24c416[_0x3e5b('0x38')],_0x24c416[_0x3e5b('0x35')]);_0x9fc025['attributes']=_['intersection'](_0x24c416['model'],qs[_0x3e5b('0x3a')](_0xa99d75[_0x3e5b('0x35')][_0x3e5b('0x3a')]));_0x9fc025['attributes']=_0x9fc025['attributes'][_0x3e5b('0x3b')]?_0x9fc025[_0x3e5b('0x39')]:_0x24c416[_0x3e5b('0x38')];if(_0xa99d75['query']['includeAll']){_0x9fc025[_0x3e5b('0x45')]=[{'all':!![]}];}_0x9fc025=_['merge']({},_0x9fc025,_0xa99d75[_0x3e5b('0x43')]);return db[_0x3e5b('0x31')][_0x3e5b('0x48')](_0x9fc025)[_0x3e5b('0x27')](handleEntityNotFound(_0x21ee8a,null))[_0x3e5b('0x27')](respondWithResult(_0x21ee8a,null))[_0x3e5b('0x49')](handleError(_0x21ee8a,null));};exports[_0x3e5b('0x4a')]=function(_0x3ea5aa,_0x339852){return db['AnalyticMetric'][_0x3e5b('0x4a')](_0x3ea5aa['body'],{})[_0x3e5b('0x27')](function(_0x2e7047){var _0x26e11e=_0x3ea5aa[_0x3e5b('0x4b')][_0x3e5b('0x4c')]({'plain':!![]});if(!_0x26e11e)throw new Error(_0x3e5b('0x4d'));if(_0x26e11e[_0x3e5b('0x4e')]===_0x3e5b('0x4b')){var _0x2b5d3d=_0x2e7047[_0x3e5b('0x4c')]({'plain':!![]});var _0xf6ca5b=_0x3e5b('0x28');return db[_0x3e5b('0x4f')]['find']({'where':{'name':_0xf6ca5b,'userProfileId':_0x26e11e[_0x3e5b('0x50')]},'raw':!![]})[_0x3e5b('0x27')](function(_0x2ca33b){if(_0x2ca33b&&_0x2ca33b[_0x3e5b('0x51')]===0x0){return db[_0x3e5b('0x29')][_0x3e5b('0x4a')]({'name':_0x2b5d3d['name'],'resourceId':_0x2b5d3d['id'],'type':_0x2ca33b[_0x3e5b('0x2d')],'sectionId':_0x2ca33b['id']},{})[_0x3e5b('0x27')](function(){return _0x2e7047;});}else{return _0x2e7047;}})[_0x3e5b('0x49')](function(_0x314d42){logger[_0x3e5b('0x2b')](_0x3e5b('0x52'),_0x314d42);throw _0x314d42;});}return _0x2e7047;})[_0x3e5b('0x27')](respondWithResult(_0x339852,0xc9))[_0x3e5b('0x49')](handleError(_0x339852,null));};exports['update']=function(_0x1e6403,_0x5e702f){if(_0x1e6403['body']['id']){delete _0x1e6403[_0x3e5b('0x53')]['id'];}return db['AnalyticMetric'][_0x3e5b('0x48')]({'where':{'id':_0x1e6403[_0x3e5b('0x47')]['id']}})[_0x3e5b('0x27')](handleEntityNotFound(_0x5e702f,null))[_0x3e5b('0x27')](saveUpdates(_0x1e6403['body'],null))['then'](respondWithResult(_0x5e702f,null))['catch'](handleError(_0x5e702f,null));};exports['destroy']=function(_0x2ab5f3,_0x999518){return db[_0x3e5b('0x31')][_0x3e5b('0x48')]({'where':{'id':_0x2ab5f3[_0x3e5b('0x47')]['id']}})['then'](handleEntityNotFound(_0x999518,null))['then'](removeEntity(_0x999518,null))[_0x3e5b('0x49')](handleError(_0x999518,null));};
\ No newline at end of file
index f88eb49..286ff8f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa46e=['api','moment','bluebird','path','../../config/environment','exports','define','analytics_metrics','lodash','util'];(function(_0x337748,_0x402b05){var _0x3bb03f=function(_0x2fcdf4){while(--_0x2fcdf4){_0x337748['push'](_0x337748['shift']());}};_0x3bb03f(++_0x402b05);}(_0xa46e,0x8a));var _0xea46=function(_0x226ad1,_0x2858e2){_0x226ad1=_0x226ad1-0x0;var _0x16b625=_0xa46e[_0x226ad1];return _0x16b625;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./analyticMetric.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('AnalyticMetric',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd072=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd072,0x132));var _0x2d07=function(_0x27e9f7,_0x260553){_0x27e9f7=_0x27e9f7-0x0;var _0x50aade=_0xd072[_0x27e9f7];return _0x50aade;};'use strict';var _=require(_0x2d07('0x0'));var util=require(_0x2d07('0x1'));var logger=require(_0x2d07('0x2'))(_0x2d07('0x3'));var moment=require(_0x2d07('0x4'));var BPromise=require(_0x2d07('0x5'));var rp=require(_0x2d07('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2d07('0x7'));var config=require(_0x2d07('0x8'));var attributes=require(_0x2d07('0x9'));module[_0x2d07('0xa')]=function(_0x34731c,_0x51aae0){return _0x34731c[_0x2d07('0xb')](_0x2d07('0xc'),attributes,{'tableName':_0x2d07('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index f099966..4b731a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe8ca=['../../config/utils','../../config/logger','jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x5c7262,_0x274118){var _0x2a55cb=function(_0x5617ac){while(--_0x5617ac){_0x5c7262['push'](_0x5c7262['shift']());}};_0x2a55cb(++_0x274118);}(_0xe8ca,0x1c6));var _0xae8c=function(_0x400bd2,_0x50b43c){_0x400bd2=_0x400bd2-0x0;var _0x223cec=_0xe8ca[_0x400bd2];return _0x223cec;};'use strict';var _=require(_0xae8c('0x0'));var util=require(_0xae8c('0x1'));var moment=require(_0xae8c('0x2'));var BPromise=require(_0xae8c('0x3'));var rs=require(_0xae8c('0x4'));var fs=require('fs');var Redis=require(_0xae8c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xae8c('0x6'));var logger=require(_0xae8c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xae8c('0x8'));var client=jayson['client'][_0xae8c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x358b4c,_0x25c3d1,_0x470ad6){return new BPromise(function(_0x983ea7,_0x2b86d1){return client[_0xae8c('0xa')](_0x358b4c,_0x470ad6)['then'](function(_0x4eb445){logger[_0xae8c('0xb')](_0xae8c('0xc'),_0x25c3d1,'request\x20sent');logger['debug'](_0xae8c('0xd'),_0x25c3d1,'request\x20sent',JSON[_0xae8c('0xe')](_0x4eb445));if(_0x4eb445['error']){if(_0x4eb445['error'][_0xae8c('0xf')]===0x1f4){logger[_0xae8c('0x10')](_0xae8c('0xc'),_0x25c3d1,_0x4eb445[_0xae8c('0x10')][_0xae8c('0x11')]);return _0x2b86d1(_0x4eb445[_0xae8c('0x10')][_0xae8c('0x11')]);}logger['error'](_0xae8c('0xc'),_0x25c3d1,_0x4eb445['error']['message']);return _0x983ea7(_0x4eb445[_0xae8c('0x10')]['message']);}else{logger[_0xae8c('0xb')](_0xae8c('0xc'),_0x25c3d1,_0xae8c('0x12'));_0x983ea7(_0x4eb445[_0xae8c('0x13')][_0xae8c('0x11')]);}})['catch'](function(_0x5a14ce){logger[_0xae8c('0x10')](_0xae8c('0xc'),_0x25c3d1,_0x5a14ce);_0x2b86d1(_0x5a14ce);});});}
\ No newline at end of file
+var _0xbdb6=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x42ef8f,_0x218273){var _0x1af3ab=function(_0x3ecdd8){while(--_0x3ecdd8){_0x42ef8f['push'](_0x42ef8f['shift']());}};_0x1af3ab(++_0x218273);}(_0xbdb6,0x188));var _0x6bdb=function(_0x378fc7,_0x5181a3){_0x378fc7=_0x378fc7-0x0;var _0x44dfec=_0xbdb6[_0x378fc7];return _0x44dfec;};'use strict';var _=require('lodash');var util=require(_0x6bdb('0x0'));var moment=require(_0x6bdb('0x1'));var BPromise=require(_0x6bdb('0x2'));var rs=require(_0x6bdb('0x3'));var fs=require('fs');var Redis=require(_0x6bdb('0x4'));var db=require(_0x6bdb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6bdb('0x6'));var config=require(_0x6bdb('0x7'));var jayson=require(_0x6bdb('0x8'));var client=jayson[_0x6bdb('0x9')][_0x6bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c3ea1,_0x43bf96,_0x11f05b){return new BPromise(function(_0x1a1b8b,_0x3d4de6){return client[_0x6bdb('0xb')](_0x4c3ea1,_0x11f05b)[_0x6bdb('0xc')](function(_0x4e9dff){logger[_0x6bdb('0xd')](_0x6bdb('0xe'),_0x43bf96,_0x6bdb('0xf'));logger[_0x6bdb('0x10')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x43bf96,_0x6bdb('0xf'),JSON[_0x6bdb('0x11')](_0x4e9dff));if(_0x4e9dff[_0x6bdb('0x12')]){if(_0x4e9dff[_0x6bdb('0x12')][_0x6bdb('0x13')]===0x1f4){logger['error'](_0x6bdb('0xe'),_0x43bf96,_0x4e9dff['error'][_0x6bdb('0x14')]);return _0x3d4de6(_0x4e9dff[_0x6bdb('0x12')][_0x6bdb('0x14')]);}logger[_0x6bdb('0x12')](_0x6bdb('0xe'),_0x43bf96,_0x4e9dff[_0x6bdb('0x12')]['message']);return _0x1a1b8b(_0x4e9dff[_0x6bdb('0x12')][_0x6bdb('0x14')]);}else{logger[_0x6bdb('0xd')](_0x6bdb('0xe'),_0x43bf96,_0x6bdb('0xf'));_0x1a1b8b(_0x4e9dff[_0x6bdb('0x15')][_0x6bdb('0x14')]);}})[_0x6bdb('0x16')](function(_0x1a389d){logger['error'](_0x6bdb('0xe'),_0x43bf96,_0x1a389d);_0x3d4de6(_0x1a389d);});});}
\ No newline at end of file
index ec71d9f..76f9f98 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa990=['create','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa990,0xc9));var _0x0a99=function(_0x52a512,_0x136b26){_0x52a512=_0x52a512-0x0;var _0x53a052=_0xa990[_0x52a512];return _0x53a052;};'use strict';var multer=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var path=require(_0x0a99('0x2'));var timeout=require(_0x0a99('0x3'));var express=require(_0x0a99('0x4'));var router=express[_0x0a99('0x5')]();var fs_extra=require(_0x0a99('0x6'));var auth=require(_0x0a99('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0a99('0x8'));router[_0x0a99('0x9')]('/',auth[_0x0a99('0xa')](),controller[_0x0a99('0xb')]);router[_0x0a99('0x9')](_0x0a99('0xc'),auth[_0x0a99('0xa')](),controller[_0x0a99('0xd')]);router[_0x0a99('0xe')]('/',auth[_0x0a99('0xa')](),controller[_0x0a99('0xf')]);router['put'](_0x0a99('0xc'),auth[_0x0a99('0xa')](),controller['update']);router['delete'](_0x0a99('0xc'),auth[_0x0a99('0xa')](),controller[_0x0a99('0x10')]);module[_0x0a99('0x11')]=router;
\ No newline at end of file
+var _0xaa48=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xaa48,0x15a));var _0x8aa4=function(_0xfd02c9,_0x503fd5){_0xfd02c9=_0xfd02c9-0x0;var _0x70126b=_0xaa48[_0xfd02c9];return _0x70126b;};'use strict';var multer=require(_0x8aa4('0x0'));var util=require(_0x8aa4('0x1'));var path=require(_0x8aa4('0x2'));var timeout=require(_0x8aa4('0x3'));var express=require(_0x8aa4('0x4'));var router=express[_0x8aa4('0x5')]();var fs_extra=require(_0x8aa4('0x6'));var auth=require(_0x8aa4('0x7'));var interaction=require(_0x8aa4('0x8'));var config=require(_0x8aa4('0x9'));var controller=require(_0x8aa4('0xa'));router[_0x8aa4('0xb')]('/',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xd')]);router[_0x8aa4('0xb')](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0xf')]);router[_0x8aa4('0x10')]('/',auth['isAuthenticated'](),controller[_0x8aa4('0x11')]);router[_0x8aa4('0x12')]('/:id',auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x13')]);router['delete'](_0x8aa4('0xe'),auth[_0x8aa4('0xc')](),controller[_0x8aa4('0x14')]);module[_0x8aa4('0x15')]=router;
\ No newline at end of file
index 64bf3e2..b49a186 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x92ed=['exports','TEXT','sequelize'];(function(_0x4038b4,_0x254f72){var _0xf3457b=function(_0x153629){while(--_0x153629){_0x4038b4['push'](_0x4038b4['shift']());}};_0xf3457b(++_0x254f72);}(_0x92ed,0xf2));var _0xd92e=function(_0x261062,_0x4145b9){_0x261062=_0x261062-0x0;var _0x38ef4f=_0x92ed[_0x261062];return _0x38ef4f;};'use strict';var Sequelize=require(_0xd92e('0x0'));module[_0xd92e('0x1')]={'tree':{'type':Sequelize[_0xd92e('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0xc68d=['exports','TEXT'];(function(_0x3dc6a6,_0x3a530f){var _0x11308f=function(_0x2029c2){while(--_0x2029c2){_0x3dc6a6['push'](_0x3dc6a6['shift']());}};_0x11308f(++_0x3a530f);}(_0xc68d,0x17a));var _0xdc68=function(_0x3a8d76,_0x3dcee9){_0x3a8d76=_0x3a8d76-0x0;var _0x3b4fbd=_0xc68d[_0x3a8d76];return _0x3b4fbd;};'use strict';var Sequelize=require('sequelize');module[_0xdc68('0x0')]={'tree':{'type':Sequelize[_0xdc68('0x1')],'allowNull':![]}};
\ No newline at end of file
index 35a4ede..dd6f5a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x26d3=['find','create','body','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','limit','order','sort','where','pick','VIRTUAL','filter','merge','options','AnalyticTreeReport','findAll','rows','catch','show','params'];(function(_0x509e62,_0x37102f){var _0x674f1f=function(_0x4e2554){while(--_0x4e2554){_0x509e62['push'](_0x509e62['shift']());}};_0x674f1f(++_0x37102f);}(_0x26d3,0x148));var _0x326d=function(_0x4c4241,_0x89a16d){_0x4c4241=_0x4c4241-0x0;var _0x4fa1b8=_0x26d3[_0x4c4241];return _0x4fa1b8;};'use strict';var emlformat=require(_0x326d('0x0'));var rimraf=require(_0x326d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x326d('0x2'));var rp=require('request-promise');var moment=require(_0x326d('0x3'));var BPromise=require(_0x326d('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x326d('0x5'));var sox=require('sox');var csv=require(_0x326d('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x326d('0x7'));var deskjs=require(_0x326d('0x8'));var toCsv=require(_0x326d('0x6'));var querystring=require(_0x326d('0x9'));var Papa=require(_0x326d('0xa'));var Redis=require('ioredis');var authService=require(_0x326d('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0x326d('0xc'));var hardwareService=require(_0x326d('0xd'));var logger=require('../../config/logger')(_0x326d('0xe'));var utils=require(_0x326d('0xf'));var config=require(_0x326d('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c2ec4,_0x28c714){_0x28c714=_0x28c714||0xcc;return function(_0x4a97c0){if(_0x4a97c0){return _0x3c2ec4[_0x326d('0x11')](_0x28c714);}return _0x3c2ec4[_0x326d('0x12')](_0x28c714)[_0x326d('0x13')]();};}function respondWithResult(_0x5c5f6d,_0x1669f8){_0x1669f8=_0x1669f8||0xc8;return function(_0x1a8c61){if(_0x1a8c61){return _0x5c5f6d[_0x326d('0x12')](_0x1669f8)['json'](_0x1a8c61);}};}function respondWithFilteredResult(_0x5bea94,_0x2b824f){return function(_0x6d9509){if(_0x6d9509){var _0x8a8e71=typeof _0x2b824f[_0x326d('0x14')]===_0x326d('0x15')&&typeof _0x2b824f['limit']===_0x326d('0x15');var _0x393534=_0x6d9509[_0x326d('0x16')];var _0x506cc6=_0x8a8e71?0x0:_0x2b824f[_0x326d('0x14')];var _0xd95cb2=_0x8a8e71?_0x6d9509[_0x326d('0x16')]:_0x2b824f[_0x326d('0x14')]+_0x2b824f['limit'];var _0x3cd279;if(_0xd95cb2>=_0x393534){_0xd95cb2=_0x393534;_0x3cd279=0xc8;}else{_0x3cd279=0xce;}_0x5bea94['status'](_0x3cd279);return _0x5bea94[_0x326d('0x17')](_0x326d('0x18'),_0x506cc6+'-'+_0xd95cb2+'/'+_0x393534)['json'](_0x6d9509);}return null;};}function patchUpdates(_0x510659){return function(_0x36eeac){try{jsonpatch[_0x326d('0x19')](_0x36eeac,_0x510659,!![]);}catch(_0x574aff){return BPromise['reject'](_0x574aff);}return _0x36eeac[_0x326d('0x1a')]();};}function saveUpdates(_0x258461,_0x197784){return function(_0x79aa2){if(_0x79aa2){return _0x79aa2[_0x326d('0x1b')](_0x258461)[_0x326d('0x1c')](function(_0x5714f){return _0x5714f;});}return null;};}function removeEntity(_0x3e10c3,_0x1d0698){return function(_0x3d9694){if(_0x3d9694){return _0x3d9694['destroy']()[_0x326d('0x1c')](function(){_0x3e10c3[_0x326d('0x12')](0xcc)[_0x326d('0x13')]();});}};}function handleEntityNotFound(_0x1ed9e6,_0x393b3c){return function(_0x196e38){if(!_0x196e38){_0x1ed9e6['sendStatus'](0x194);}return _0x196e38;};}function handleError(_0x250832,_0x5362b8){_0x5362b8=_0x5362b8||0x1f4;return function(_0x253393){logger[_0x326d('0x1d')](_0x253393[_0x326d('0x1e')]);if(_0x253393[_0x326d('0x1f')]){delete _0x253393[_0x326d('0x1f')];}_0x250832[_0x326d('0x12')](_0x5362b8)[_0x326d('0x20')](_0x253393);};}exports[_0x326d('0x21')]=function(_0x15da37,_0x140f4c){var _0x5058e9={},_0x498380={},_0x31e300={'count':0x0,'rows':[]};var _0x26758d=_[_0x326d('0x22')](db['AnalyticTreeReport'][_0x326d('0x23')],function(_0x2a84f6){return{'name':_0x2a84f6[_0x326d('0x24')],'type':_0x2a84f6[_0x326d('0x25')][_0x326d('0x26')]};});_0x498380['model']=_['map'](_0x26758d,_0x326d('0x1f'));_0x498380[_0x326d('0x27')]=_[_0x326d('0x28')](_0x15da37['query']);_0x498380[_0x326d('0x29')]=_['intersection'](_0x498380[_0x326d('0x2a')],_0x498380[_0x326d('0x27')]);_0x5058e9[_0x326d('0x2b')]=_[_0x326d('0x2c')](_0x498380[_0x326d('0x2a')],qs['fields'](_0x15da37[_0x326d('0x27')][_0x326d('0x2d')]));_0x5058e9[_0x326d('0x2b')]=_0x5058e9[_0x326d('0x2b')]['length']?_0x5058e9[_0x326d('0x2b')]:_0x498380[_0x326d('0x2a')];if(!_0x15da37['query'][_0x326d('0x2e')]('nolimit')){_0x5058e9[_0x326d('0x2f')]=qs['limit'](_0x15da37[_0x326d('0x27')]['limit']);_0x5058e9[_0x326d('0x14')]=qs[_0x326d('0x14')](_0x15da37['query'][_0x326d('0x14')]);}_0x5058e9[_0x326d('0x30')]=qs['sort'](_0x15da37[_0x326d('0x27')][_0x326d('0x31')]);_0x5058e9[_0x326d('0x32')]=qs['filters'](_[_0x326d('0x33')](_0x15da37[_0x326d('0x27')],_0x498380[_0x326d('0x29')]),_0x26758d);if(_0x15da37[_0x326d('0x27')]['filter']){_0x5058e9[_0x326d('0x32')]=_['merge'](_0x5058e9[_0x326d('0x32')],{'$or':_[_0x326d('0x22')](_0x26758d,function(_0x25bcf0){if(_0x25bcf0[_0x326d('0x25')]!==_0x326d('0x34')){var _0x23ab34={};_0x23ab34[_0x25bcf0['name']]={'$like':'%'+_0x15da37['query'][_0x326d('0x35')]+'%'};return _0x23ab34;}})});}_0x5058e9=_[_0x326d('0x36')]({},_0x5058e9,_0x15da37[_0x326d('0x37')]);var _0x48fe4c={'where':_0x5058e9['where']};return db[_0x326d('0x38')]['count'](_0x48fe4c)[_0x326d('0x1c')](function(_0x442421){_0x31e300['count']=_0x442421;if(_0x15da37[_0x326d('0x27')]['includeAll']){_0x5058e9['include']=[{'all':!![]}];}return db[_0x326d('0x38')][_0x326d('0x39')](_0x5058e9);})[_0x326d('0x1c')](function(_0x533814){_0x31e300[_0x326d('0x3a')]=_0x533814;return _0x31e300;})[_0x326d('0x1c')](respondWithFilteredResult(_0x140f4c,_0x5058e9))[_0x326d('0x3b')](handleError(_0x140f4c,null));};exports[_0x326d('0x3c')]=function(_0x3e3768,_0x560125){var _0x2d43c4={'raw':!![],'where':{'id':_0x3e3768[_0x326d('0x3d')]['id']}},_0xc02442={};_0xc02442['model']=_[_0x326d('0x28')](db[_0x326d('0x38')]['rawAttributes']);_0xc02442[_0x326d('0x27')]=_['keys'](_0x3e3768[_0x326d('0x27')]);_0xc02442['filters']=_['intersection'](_0xc02442[_0x326d('0x2a')],_0xc02442[_0x326d('0x27')]);_0x2d43c4['attributes']=_['intersection'](_0xc02442['model'],qs[_0x326d('0x2d')](_0x3e3768[_0x326d('0x27')][_0x326d('0x2d')]));_0x2d43c4['attributes']=_0x2d43c4[_0x326d('0x2b')]['length']?_0x2d43c4[_0x326d('0x2b')]:_0xc02442[_0x326d('0x2a')];if(_0x3e3768['query']['includeAll']){_0x2d43c4['include']=[{'all':!![]}];}_0x2d43c4=_[_0x326d('0x36')]({},_0x2d43c4,_0x3e3768[_0x326d('0x37')]);return db[_0x326d('0x38')][_0x326d('0x3e')](_0x2d43c4)[_0x326d('0x1c')](handleEntityNotFound(_0x560125,null))[_0x326d('0x1c')](respondWithResult(_0x560125,null))[_0x326d('0x3b')](handleError(_0x560125,null));};exports[_0x326d('0x3f')]=function(_0x4fe0e5,_0x1d02b8){return db[_0x326d('0x38')]['create'](_0x4fe0e5['body'],{})[_0x326d('0x1c')](respondWithResult(_0x1d02b8,0xc9))[_0x326d('0x3b')](handleError(_0x1d02b8,null));};exports[_0x326d('0x1b')]=function(_0x521ba8,_0x5f5a44){if(_0x521ba8[_0x326d('0x40')]['id']){delete _0x521ba8[_0x326d('0x40')]['id'];}return db[_0x326d('0x38')][_0x326d('0x3e')]({'where':{'id':_0x521ba8[_0x326d('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5f5a44,null))['then'](saveUpdates(_0x521ba8[_0x326d('0x40')],null))[_0x326d('0x1c')](respondWithResult(_0x5f5a44,null))['catch'](handleError(_0x5f5a44,null));};exports['destroy']=function(_0x10492c,_0x2fd300){return db[_0x326d('0x38')][_0x326d('0x3e')]({'where':{'id':_0x10492c[_0x326d('0x3d')]['id']}})[_0x326d('0x1c')](handleEntityNotFound(_0x2fd300,null))[_0x326d('0x1c')](removeEntity(_0x2fd300,null))[_0x326d('0x3b')](handleError(_0x2fd300,null));};
\ No newline at end of file
+var _0xc25b=['to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','model','query','keys','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','create','body','find','eml-format','fast-json-patch','moment','mustache','path','sox'];(function(_0x594221,_0x14ceb6){var _0xdf8f21=function(_0x9c521b){while(--_0x9c521b){_0x594221['push'](_0x594221['shift']());}};_0xdf8f21(++_0x14ceb6);}(_0xc25b,0x1cf));var _0xbc25=function(_0x128d53,_0x3a30a4){_0x128d53=_0x128d53-0x0;var _0x175346=_0xc25b[_0x128d53];return _0x175346;};'use strict';var emlformat=require(_0xbc25('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbc25('0x1'));var rp=require('request-promise');var moment=require(_0xbc25('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbc25('0x3'));var util=require('util');var path=require(_0xbc25('0x4'));var sox=require(_0xbc25('0x5'));var csv=require(_0xbc25('0x6'));var ejs=require(_0xbc25('0x7'));var fs=require('fs');var fs_extra=require(_0xbc25('0x8'));var _=require('lodash');var squel=require(_0xbc25('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc25('0xa'));var toCsv=require('to-csv');var querystring=require(_0xbc25('0xb'));var Papa=require(_0xbc25('0xc'));var Redis=require('ioredis');var authService=require(_0xbc25('0xd'));var qs=require(_0xbc25('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc25('0xf'))('api');var utils=require('../../config/utils');var config=require(_0xbc25('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc25('0x11'))['db'];function respondWithStatusCode(_0x128327,_0x274fe2){_0x274fe2=_0x274fe2||0xcc;return function(_0x10b416){if(_0x10b416){return _0x128327[_0xbc25('0x12')](_0x274fe2);}return _0x128327['status'](_0x274fe2)[_0xbc25('0x13')]();};}function respondWithResult(_0x53cc4e,_0x1f8e2f){_0x1f8e2f=_0x1f8e2f||0xc8;return function(_0x280479){if(_0x280479){return _0x53cc4e[_0xbc25('0x14')](_0x1f8e2f)[_0xbc25('0x15')](_0x280479);}};}function respondWithFilteredResult(_0x26ad00,_0x2172b4){return function(_0x38703d){if(_0x38703d){var _0x823904=typeof _0x2172b4[_0xbc25('0x16')]===_0xbc25('0x17')&&typeof _0x2172b4[_0xbc25('0x18')]===_0xbc25('0x17');var _0x188e5e=_0x38703d[_0xbc25('0x19')];var _0x3f087a=_0x823904?0x0:_0x2172b4['offset'];var _0x43302b=_0x823904?_0x38703d[_0xbc25('0x19')]:_0x2172b4[_0xbc25('0x16')]+_0x2172b4[_0xbc25('0x18')];var _0x26dd6a;if(_0x43302b>=_0x188e5e){_0x43302b=_0x188e5e;_0x26dd6a=0xc8;}else{_0x26dd6a=0xce;}_0x26ad00[_0xbc25('0x14')](_0x26dd6a);return _0x26ad00['set']('Content-Range',_0x3f087a+'-'+_0x43302b+'/'+_0x188e5e)[_0xbc25('0x15')](_0x38703d);}return null;};}function patchUpdates(_0x59d4fd){return function(_0x1e2c39){try{jsonpatch[_0xbc25('0x1a')](_0x1e2c39,_0x59d4fd,!![]);}catch(_0x278ce2){return BPromise['reject'](_0x278ce2);}return _0x1e2c39[_0xbc25('0x1b')]();};}function saveUpdates(_0x1bbbd9,_0x4a7421){return function(_0x4c331b){if(_0x4c331b){return _0x4c331b[_0xbc25('0x1c')](_0x1bbbd9)[_0xbc25('0x1d')](function(_0x30ed83){return _0x30ed83;});}return null;};}function removeEntity(_0x3dd8cd,_0x4e3d2a){return function(_0x3f3ba7){if(_0x3f3ba7){return _0x3f3ba7[_0xbc25('0x1e')]()[_0xbc25('0x1d')](function(){_0x3dd8cd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b37b6,_0x1a3643){return function(_0x2c95c9){if(!_0x2c95c9){_0x1b37b6['sendStatus'](0x194);}return _0x2c95c9;};}function handleError(_0x2baef7,_0x206f6b){_0x206f6b=_0x206f6b||0x1f4;return function(_0x4b97a1){logger[_0xbc25('0x1f')](_0x4b97a1[_0xbc25('0x20')]);if(_0x4b97a1['name']){delete _0x4b97a1[_0xbc25('0x21')];}_0x2baef7[_0xbc25('0x14')](_0x206f6b)[_0xbc25('0x22')](_0x4b97a1);};}exports[_0xbc25('0x23')]=function(_0x385bc7,_0x1cced9){var _0x1f9e3b={},_0x56578f={},_0x30c00c={'count':0x0,'rows':[]};var _0x14f781=_[_0xbc25('0x24')](db[_0xbc25('0x25')]['rawAttributes'],function(_0x55ad0e){return{'name':_0x55ad0e[_0xbc25('0x26')],'type':_0x55ad0e['type']['key']};});_0x56578f[_0xbc25('0x27')]=_[_0xbc25('0x24')](_0x14f781,_0xbc25('0x21'));_0x56578f[_0xbc25('0x28')]=_[_0xbc25('0x29')](_0x385bc7[_0xbc25('0x28')]);_0x56578f[_0xbc25('0x2a')]=_['intersection'](_0x56578f[_0xbc25('0x27')],_0x56578f[_0xbc25('0x28')]);_0x1f9e3b['attributes']=_['intersection'](_0x56578f[_0xbc25('0x27')],qs[_0xbc25('0x2b')](_0x385bc7['query'][_0xbc25('0x2b')]));_0x1f9e3b[_0xbc25('0x2c')]=_0x1f9e3b[_0xbc25('0x2c')][_0xbc25('0x2d')]?_0x1f9e3b[_0xbc25('0x2c')]:_0x56578f[_0xbc25('0x27')];if(!_0x385bc7[_0xbc25('0x28')][_0xbc25('0x2e')]('nolimit')){_0x1f9e3b[_0xbc25('0x18')]=qs['limit'](_0x385bc7[_0xbc25('0x28')][_0xbc25('0x18')]);_0x1f9e3b[_0xbc25('0x16')]=qs['offset'](_0x385bc7[_0xbc25('0x28')][_0xbc25('0x16')]);}_0x1f9e3b[_0xbc25('0x2f')]=qs[_0xbc25('0x30')](_0x385bc7[_0xbc25('0x28')]['sort']);_0x1f9e3b[_0xbc25('0x31')]=qs[_0xbc25('0x2a')](_[_0xbc25('0x32')](_0x385bc7[_0xbc25('0x28')],_0x56578f[_0xbc25('0x2a')]),_0x14f781);if(_0x385bc7[_0xbc25('0x28')]['filter']){_0x1f9e3b[_0xbc25('0x31')]=_[_0xbc25('0x33')](_0x1f9e3b[_0xbc25('0x31')],{'$or':_['map'](_0x14f781,function(_0x1cf150){if(_0x1cf150[_0xbc25('0x34')]!==_0xbc25('0x35')){var _0x4ff9a8={};_0x4ff9a8[_0x1cf150[_0xbc25('0x21')]]={'$like':'%'+_0x385bc7['query'][_0xbc25('0x36')]+'%'};return _0x4ff9a8;}})});}_0x1f9e3b=_[_0xbc25('0x33')]({},_0x1f9e3b,_0x385bc7[_0xbc25('0x37')]);var _0x8b564a={'where':_0x1f9e3b[_0xbc25('0x31')]};return db[_0xbc25('0x25')][_0xbc25('0x19')](_0x8b564a)[_0xbc25('0x1d')](function(_0x13e281){_0x30c00c[_0xbc25('0x19')]=_0x13e281;if(_0x385bc7[_0xbc25('0x28')]['includeAll']){_0x1f9e3b[_0xbc25('0x38')]=[{'all':!![]}];}return db['AnalyticTreeReport'][_0xbc25('0x39')](_0x1f9e3b);})[_0xbc25('0x1d')](function(_0x29cc7f){_0x30c00c['rows']=_0x29cc7f;return _0x30c00c;})[_0xbc25('0x1d')](respondWithFilteredResult(_0x1cced9,_0x1f9e3b))[_0xbc25('0x3a')](handleError(_0x1cced9,null));};exports[_0xbc25('0x3b')]=function(_0x1474d1,_0x61974c){var _0x357f73={'raw':!![],'where':{'id':_0x1474d1[_0xbc25('0x3c')]['id']}},_0x1fad45={};_0x1fad45['model']=_[_0xbc25('0x29')](db[_0xbc25('0x25')][_0xbc25('0x3d')]);_0x1fad45[_0xbc25('0x28')]=_[_0xbc25('0x29')](_0x1474d1[_0xbc25('0x28')]);_0x1fad45[_0xbc25('0x2a')]=_['intersection'](_0x1fad45['model'],_0x1fad45[_0xbc25('0x28')]);_0x357f73[_0xbc25('0x2c')]=_[_0xbc25('0x3e')](_0x1fad45[_0xbc25('0x27')],qs[_0xbc25('0x2b')](_0x1474d1[_0xbc25('0x28')][_0xbc25('0x2b')]));_0x357f73[_0xbc25('0x2c')]=_0x357f73[_0xbc25('0x2c')][_0xbc25('0x2d')]?_0x357f73[_0xbc25('0x2c')]:_0x1fad45[_0xbc25('0x27')];if(_0x1474d1[_0xbc25('0x28')][_0xbc25('0x3f')]){_0x357f73[_0xbc25('0x38')]=[{'all':!![]}];}_0x357f73=_[_0xbc25('0x33')]({},_0x357f73,_0x1474d1[_0xbc25('0x37')]);return db['AnalyticTreeReport']['find'](_0x357f73)[_0xbc25('0x1d')](handleEntityNotFound(_0x61974c,null))[_0xbc25('0x1d')](respondWithResult(_0x61974c,null))['catch'](handleError(_0x61974c,null));};exports[_0xbc25('0x40')]=function(_0x5802f9,_0x59d975){return db[_0xbc25('0x25')]['create'](_0x5802f9[_0xbc25('0x41')],{})[_0xbc25('0x1d')](respondWithResult(_0x59d975,0xc9))[_0xbc25('0x3a')](handleError(_0x59d975,null));};exports['update']=function(_0x16ee7a,_0x7b2eb8){if(_0x16ee7a[_0xbc25('0x41')]['id']){delete _0x16ee7a[_0xbc25('0x41')]['id'];}return db['AnalyticTreeReport'][_0xbc25('0x42')]({'where':{'id':_0x16ee7a[_0xbc25('0x3c')]['id']}})[_0xbc25('0x1d')](handleEntityNotFound(_0x7b2eb8,null))[_0xbc25('0x1d')](saveUpdates(_0x16ee7a[_0xbc25('0x41')],null))[_0xbc25('0x1d')](respondWithResult(_0x7b2eb8,null))['catch'](handleError(_0x7b2eb8,null));};exports[_0xbc25('0x1e')]=function(_0x5ed464,_0x4f305c){return db[_0xbc25('0x25')][_0xbc25('0x42')]({'where':{'id':_0x5ed464[_0xbc25('0x3c')]['id']}})[_0xbc25('0x1d')](handleEntityNotFound(_0x4f305c,null))['then'](removeEntity(_0x4f305c,null))[_0xbc25('0x3a')](handleError(_0x4f305c,null));};
\ No newline at end of file
index 88681d3..1b775bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x09e1=['AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','bluebird','path','rimraf','exports','define'];(function(_0x65ca71,_0x126845){var _0x5cb16e=function(_0xe1143b){while(--_0xe1143b){_0x65ca71['push'](_0x65ca71['shift']());}};_0x5cb16e(++_0x126845);}(_0x09e1,0x142));var _0x109e=function(_0x1ed261,_0x4366d1){_0x1ed261=_0x1ed261-0x0;var _0x32fb78=_0x09e1[_0x1ed261];return _0x32fb78;};'use strict';var _=require(_0x109e('0x0'));var util=require('util');var logger=require(_0x109e('0x1'))(_0x109e('0x2'));var moment=require('moment');var BPromise=require(_0x109e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x109e('0x4'));var rimraf=require(_0x109e('0x5'));var config=require('../../config/environment');var attributes=require('./analyticTreeReport.attributes');module[_0x109e('0x6')]=function(_0x2c8ba1,_0x536317){return _0x2c8ba1[_0x109e('0x7')](_0x109e('0x8'),attributes,{'tableName':_0x109e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xee63=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','define','AnalyticTreeReport'];(function(_0x482598,_0x54c1cf){var _0x4c9aae=function(_0xd8a837){while(--_0xd8a837){_0x482598['push'](_0x482598['shift']());}};_0x4c9aae(++_0x54c1cf);}(_0xee63,0xc0));var _0x3ee6=function(_0x260e4b,_0x54668d){_0x260e4b=_0x260e4b-0x0;var _0x18dfba=_0xee63[_0x260e4b];return _0x18dfba;};'use strict';var _=require(_0x3ee6('0x0'));var util=require(_0x3ee6('0x1'));var logger=require(_0x3ee6('0x2'))(_0x3ee6('0x3'));var moment=require(_0x3ee6('0x4'));var BPromise=require(_0x3ee6('0x5'));var rp=require(_0x3ee6('0x6'));var fs=require('fs');var path=require(_0x3ee6('0x7'));var rimraf=require('rimraf');var config=require(_0x3ee6('0x8'));var attributes=require(_0x3ee6('0x9'));module['exports']=function(_0x470df4,_0x4a8c6b){return _0x470df4[_0x3ee6('0xa')](_0x3ee6('0xb'),attributes,{'tableName':'analytics_report_trees','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e9d8648..efb7b03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1f77d8,_0x4174a9){var _0x2e93c0=function(_0x2ed806){while(--_0x2ed806){_0x1f77d8['push'](_0x1f77d8['shift']());}};_0x2e93c0(++_0x4174a9);}(_0xadb5,0xad));var _0x5adb=function(_0x22dbaa,_0x31f659){_0x22dbaa=_0x22dbaa-0x0;var _0x5db723=_0xadb5[_0x22dbaa];return _0x5db723;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}
\ No newline at end of file
+var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x58fc82,_0x4a717b){var _0x3993c4=function(_0x3a1312){while(--_0x3a1312){_0x58fc82['push'](_0x58fc82['shift']());}};_0x3993c4(++_0x4a717b);}(_0x5f2f,0x73));var _0xf5f2=function(_0xbb664e,_0x2fba55){_0xbb664e=_0xbb664e-0x0;var _0x5dfa63=_0x5f2f[_0xbb664e];return _0x5dfa63;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}
\ No newline at end of file
index e743bac..27a5097 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcae8=['show','post','isAuthenticated','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','/:id'];(function(_0x1f16d5,_0x534d4d){var _0x424188=function(_0x2ce863){while(--_0x2ce863){_0x1f16d5['push'](_0x1f16d5['shift']());}};_0x424188(++_0x534d4d);}(_0xcae8,0x1ca));var _0x8cae=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0xcae8[_0x1c0f41];return _0x369a9f;};'use strict';var multer=require(_0x8cae('0x0'));var util=require(_0x8cae('0x1'));var path=require(_0x8cae('0x2'));var timeout=require(_0x8cae('0x3'));var express=require(_0x8cae('0x4'));var router=express[_0x8cae('0x5')]();var fs_extra=require(_0x8cae('0x6'));var auth=require(_0x8cae('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0x8cae('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x8cae('0x8')](_0x8cae('0x9'),auth['isAuthenticated'](),controller[_0x8cae('0xa')]);router[_0x8cae('0xb')]('/',auth[_0x8cae('0xc')](),controller['create']);router[_0x8cae('0xd')](_0x8cae('0x9'),auth['isAuthenticated'](),controller[_0x8cae('0xe')]);router[_0x8cae('0xf')]('/:id',auth[_0x8cae('0xc')](),controller[_0x8cae('0x10')]);module[_0x8cae('0x11')]=router;
\ No newline at end of file
+var _0xaddc=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./analyticTreeReport.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x470f24,_0x2436a9){var _0x2c6fc8=function(_0x3ef190){while(--_0x3ef190){_0x470f24['push'](_0x470f24['shift']());}};_0x2c6fc8(++_0x2436a9);}(_0xaddc,0x10c));var _0xcadd=function(_0x183569,_0x235883){_0x183569=_0x183569-0x0;var _0x5db5fc=_0xaddc[_0x183569];return _0x5db5fc;};'use strict';var multer=require(_0xcadd('0x0'));var util=require(_0xcadd('0x1'));var path=require(_0xcadd('0x2'));var timeout=require(_0xcadd('0x3'));var express=require(_0xcadd('0x4'));var router=express['Router']();var fs_extra=require(_0xcadd('0x5'));var auth=require(_0xcadd('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xcadd('0x7'));router[_0xcadd('0x8')]('/',auth['isAuthenticated'](),controller[_0xcadd('0x9')]);router[_0xcadd('0x8')](_0xcadd('0xa'),auth[_0xcadd('0xb')](),controller[_0xcadd('0xc')]);router[_0xcadd('0xd')]('/',auth[_0xcadd('0xb')](),controller[_0xcadd('0xe')]);router['put']('/:id',auth[_0xcadd('0xb')](),controller[_0xcadd('0xf')]);router[_0xcadd('0x10')](_0xcadd('0xa'),auth[_0xcadd('0xb')](),controller[_0xcadd('0x11')]);module[_0xcadd('0x12')]=router;
\ No newline at end of file
index b56ced3..ad9d5fd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x303a=['sequelize','STRING'];(function(_0x43330e,_0x3ddaae){var _0x9fedf4=function(_0x3b0708){while(--_0x3b0708){_0x43330e['push'](_0x43330e['shift']());}};_0x9fedf4(++_0x3ddaae);}(_0x303a,0x1a0));var _0xa303=function(_0x1feb65,_0x59d59b){_0x1feb65=_0x1feb65-0x0;var _0xb2dbb3=_0x303a[_0x1feb65];return _0xb2dbb3;};'use strict';var Sequelize=require(_0xa303('0x0'));module['exports']={'name':{'type':Sequelize[_0xa303('0x1')]},'basename':{'type':Sequelize[_0xa303('0x1')]},'type':{'type':Sequelize[_0xa303('0x1')]}};
\ No newline at end of file
+var _0x8fed=['STRING'];(function(_0x5eb73e,_0x2b3e82){var _0x56cc13=function(_0x1b3a8d){while(--_0x1b3a8d){_0x5eb73e['push'](_0x5eb73e['shift']());}};_0x56cc13(++_0x2b3e82);}(_0x8fed,0xf5));var _0xd8fe=function(_0x4698cb,_0x837e73){_0x4698cb=_0x4698cb-0x0;var _0x53eec6=_0x8fed[_0x4698cb];return _0x53eec6;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xd8fe('0x0')]},'basename':{'type':Sequelize[_0xd8fe('0x0')]},'type':{'type':Sequelize[_0xd8fe('0x0')]}};
\ No newline at end of file
index 2ad205b..f3206ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc3c=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','reject','update','then','error','stack','name','index','Attachment','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','rows','catch','show','rawAttributes','includeAll','options','find','params','get','omit','createdAt','updatedAt','body','create','originalname','basename','file','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','fast-json-patch','moment','bluebird','util','sox','ejs','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util'];(function(_0x3d8bc7,_0x470565){var _0x4def56=function(_0x2df56e){while(--_0x2df56e){_0x3d8bc7['push'](_0x3d8bc7['shift']());}};_0x4def56(++_0x470565);}(_0xbc3c,0x98));var _0xcbc3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xbc3c[_0x5f0089];return _0x193892;};'use strict';var emlformat=require(_0xcbc3('0x0'));var rimraf=require(_0xcbc3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcbc3('0x2'));var rp=require('request-promise');var moment=require(_0xcbc3('0x3'));var BPromise=require(_0xcbc3('0x4'));var Mustache=require('mustache');var util=require(_0xcbc3('0x5'));var path=require('path');var sox=require(_0xcbc3('0x6'));var csv=require('to-csv');var ejs=require(_0xcbc3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcbc3('0x8'));var crypto=require(_0xcbc3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xcbc3('0xa'));var toCsv=require(_0xcbc3('0xb'));var querystring=require('querystring');var Papa=require(_0xcbc3('0xc'));var Redis=require(_0xcbc3('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcbc3('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcbc3('0xf'))(_0xcbc3('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcbc3('0x11'));var db=require(_0xcbc3('0x12'))['db'];function respondWithStatusCode(_0x49d8b2,_0x2e0118){_0x2e0118=_0x2e0118||0xcc;return function(_0x9fb136){if(_0x9fb136){return _0x49d8b2[_0xcbc3('0x13')](_0x2e0118);}return _0x49d8b2[_0xcbc3('0x14')](_0x2e0118)[_0xcbc3('0x15')]();};}function respondWithResult(_0x90972d,_0x3b6f7f){_0x3b6f7f=_0x3b6f7f||0xc8;return function(_0x25e28e){if(_0x25e28e){return _0x90972d[_0xcbc3('0x14')](_0x3b6f7f)[_0xcbc3('0x16')](_0x25e28e);}};}function respondWithFilteredResult(_0x4aca92,_0xc38085){return function(_0x1e1b96){if(_0x1e1b96){var _0x1bb527=typeof _0xc38085['offset']==='undefined'&&typeof _0xc38085[_0xcbc3('0x17')]===_0xcbc3('0x18');var _0x194eae=_0x1e1b96[_0xcbc3('0x19')];var _0x373bd0=_0x1bb527?0x0:_0xc38085[_0xcbc3('0x1a')];var _0x40abf7=_0x1bb527?_0x1e1b96[_0xcbc3('0x19')]:_0xc38085['offset']+_0xc38085[_0xcbc3('0x17')];var _0x4f3319;if(_0x40abf7>=_0x194eae){_0x40abf7=_0x194eae;_0x4f3319=0xc8;}else{_0x4f3319=0xce;}_0x4aca92[_0xcbc3('0x14')](_0x4f3319);return _0x4aca92[_0xcbc3('0x1b')](_0xcbc3('0x1c'),_0x373bd0+'-'+_0x40abf7+'/'+_0x194eae)[_0xcbc3('0x16')](_0x1e1b96);}return null;};}function patchUpdates(_0x32e5bd){return function(_0x34b5b8){try{jsonpatch['apply'](_0x34b5b8,_0x32e5bd,!![]);}catch(_0x153395){return BPromise[_0xcbc3('0x1d')](_0x153395);}return _0x34b5b8['save']();};}function saveUpdates(_0x150280,_0x47719b){return function(_0x21c1e2){if(_0x21c1e2){return _0x21c1e2[_0xcbc3('0x1e')](_0x150280)[_0xcbc3('0x1f')](function(_0x43dfa0){return _0x43dfa0;});}return null;};}function removeEntity(_0x1849b6,_0x1d80e5){return function(_0x377f4c){if(_0x377f4c){return _0x377f4c['destroy']()[_0xcbc3('0x1f')](function(){_0x1849b6[_0xcbc3('0x14')](0xcc)[_0xcbc3('0x15')]();});}};}function handleEntityNotFound(_0x197e65,_0x3aea58){return function(_0x59a992){if(!_0x59a992){_0x197e65[_0xcbc3('0x13')](0x194);}return _0x59a992;};}function handleError(_0xc27433,_0x16e217){_0x16e217=_0x16e217||0x1f4;return function(_0x447dda){logger[_0xcbc3('0x20')](_0x447dda[_0xcbc3('0x21')]);if(_0x447dda[_0xcbc3('0x22')]){delete _0x447dda[_0xcbc3('0x22')];}_0xc27433[_0xcbc3('0x14')](_0x16e217)['send'](_0x447dda);};}exports[_0xcbc3('0x23')]=function(_0x530a31,_0x2c11ad){var _0x21056d={},_0x366d48={},_0x21ae5e={'count':0x0,'rows':[]};var _0x7b5041=_['map'](db[_0xcbc3('0x24')]['rawAttributes'],function(_0x32a27f){return{'name':_0x32a27f[_0xcbc3('0x25')],'type':_0x32a27f[_0xcbc3('0x26')][_0xcbc3('0x27')]};});_0x366d48[_0xcbc3('0x28')]=_[_0xcbc3('0x29')](_0x7b5041,_0xcbc3('0x22'));_0x366d48[_0xcbc3('0x2a')]=_[_0xcbc3('0x2b')](_0x530a31['query']);_0x366d48[_0xcbc3('0x2c')]=_[_0xcbc3('0x2d')](_0x366d48[_0xcbc3('0x28')],_0x366d48['query']);_0x21056d['attributes']=_[_0xcbc3('0x2d')](_0x366d48[_0xcbc3('0x28')],qs['fields'](_0x530a31['query'][_0xcbc3('0x2e')]));_0x21056d[_0xcbc3('0x2f')]=_0x21056d[_0xcbc3('0x2f')][_0xcbc3('0x30')]?_0x21056d[_0xcbc3('0x2f')]:_0x366d48[_0xcbc3('0x28')];if(!_0x530a31[_0xcbc3('0x2a')][_0xcbc3('0x31')](_0xcbc3('0x32'))){_0x21056d['limit']=qs[_0xcbc3('0x17')](_0x530a31[_0xcbc3('0x2a')]['limit']);_0x21056d[_0xcbc3('0x1a')]=qs[_0xcbc3('0x1a')](_0x530a31['query']['offset']);}_0x21056d[_0xcbc3('0x33')]=qs[_0xcbc3('0x34')](_0x530a31[_0xcbc3('0x2a')][_0xcbc3('0x34')]);_0x21056d['where']=qs[_0xcbc3('0x2c')](_[_0xcbc3('0x35')](_0x530a31[_0xcbc3('0x2a')],_0x366d48[_0xcbc3('0x2c')]),_0x7b5041);if(_0x530a31[_0xcbc3('0x2a')][_0xcbc3('0x36')]){_0x21056d[_0xcbc3('0x37')]=_[_0xcbc3('0x38')](_0x21056d[_0xcbc3('0x37')],{'$or':_[_0xcbc3('0x29')](_0x7b5041,function(_0x336d3f){if(_0x336d3f[_0xcbc3('0x26')]!==_0xcbc3('0x39')){var _0x29fd5f={};_0x29fd5f[_0x336d3f[_0xcbc3('0x22')]]={'$like':'%'+_0x530a31['query']['filter']+'%'};return _0x29fd5f;}})});}_0x21056d=_[_0xcbc3('0x38')]({},_0x21056d,_0x530a31['options']);var _0x4e1cd7={'where':_0x21056d[_0xcbc3('0x37')]};return db[_0xcbc3('0x24')]['count'](_0x4e1cd7)[_0xcbc3('0x1f')](function(_0x535eaa){_0x21ae5e[_0xcbc3('0x19')]=_0x535eaa;if(_0x530a31[_0xcbc3('0x2a')]['includeAll']){_0x21056d[_0xcbc3('0x3a')]=[{'all':!![]}];}return db[_0xcbc3('0x24')][_0xcbc3('0x3b')](_0x21056d);})[_0xcbc3('0x1f')](function(_0x55f1f0){_0x21ae5e[_0xcbc3('0x3c')]=_0x55f1f0;return _0x21ae5e;})[_0xcbc3('0x1f')](respondWithFilteredResult(_0x2c11ad,_0x21056d))[_0xcbc3('0x3d')](handleError(_0x2c11ad,null));};exports[_0xcbc3('0x3e')]=function(_0x45c715,_0x2df4e2){var _0x24627b={'raw':!![],'where':{'id':_0x45c715['params']['id']}},_0x5a0f2e={};_0x5a0f2e[_0xcbc3('0x28')]=_[_0xcbc3('0x2b')](db[_0xcbc3('0x24')][_0xcbc3('0x3f')]);_0x5a0f2e[_0xcbc3('0x2a')]=_[_0xcbc3('0x2b')](_0x45c715['query']);_0x5a0f2e[_0xcbc3('0x2c')]=_[_0xcbc3('0x2d')](_0x5a0f2e[_0xcbc3('0x28')],_0x5a0f2e[_0xcbc3('0x2a')]);_0x24627b[_0xcbc3('0x2f')]=_['intersection'](_0x5a0f2e['model'],qs[_0xcbc3('0x2e')](_0x45c715[_0xcbc3('0x2a')][_0xcbc3('0x2e')]));_0x24627b[_0xcbc3('0x2f')]=_0x24627b[_0xcbc3('0x2f')]['length']?_0x24627b[_0xcbc3('0x2f')]:_0x5a0f2e[_0xcbc3('0x28')];if(_0x45c715[_0xcbc3('0x2a')][_0xcbc3('0x40')]){_0x24627b[_0xcbc3('0x3a')]=[{'all':!![]}];}_0x24627b=_[_0xcbc3('0x38')]({},_0x24627b,_0x45c715[_0xcbc3('0x41')]);return db['Attachment'][_0xcbc3('0x42')](_0x24627b)[_0xcbc3('0x1f')](handleEntityNotFound(_0x2df4e2,null))[_0xcbc3('0x1f')](respondWithResult(_0x2df4e2,null))[_0xcbc3('0x3d')](handleError(_0x2df4e2,null));};exports['clone']=function(_0x4ac4f8,_0x5cc85d){var _0x3a1823={'where':{'id':_0x4ac4f8[_0xcbc3('0x43')]['id']}},_0x234021={};_0x234021[_0xcbc3('0x28')]=_[_0xcbc3('0x2b')](db[_0xcbc3('0x24')][_0xcbc3('0x3f')]);_0x3a1823[_0xcbc3('0x2f')]=_[_0xcbc3('0x2d')](_0x234021[_0xcbc3('0x28')],qs[_0xcbc3('0x2e')](_0x4ac4f8['query'][_0xcbc3('0x2e')]));_0x3a1823['attributes']=_0x3a1823[_0xcbc3('0x2f')][_0xcbc3('0x30')]?_0x3a1823['attributes']:_0x234021[_0xcbc3('0x28')];if(_0x4ac4f8[_0xcbc3('0x2a')][_0xcbc3('0x40')]){_0x3a1823[_0xcbc3('0x3a')]=[{'all':!![]}];}_0x3a1823=_[_0xcbc3('0x38')]({},_0x3a1823,_0x4ac4f8[_0xcbc3('0x41')]);return db['Attachment'][_0xcbc3('0x42')](_0x3a1823)['then'](handleEntityNotFound(_0x5cc85d,null))[_0xcbc3('0x1f')](function(_0x254637){if(_0x254637){var _0x152836=_0x254637[_0xcbc3('0x44')]({'plain':!![]});_0x152836=qs[_0xcbc3('0x45')](_0x152836,['id',_0xcbc3('0x46'),_0xcbc3('0x47')]);_0x4ac4f8[_0xcbc3('0x48')]=_[_0xcbc3('0x45')](_0x4ac4f8[_0xcbc3('0x48')],['id',_0xcbc3('0x46'),_0xcbc3('0x47')]);return db[_0xcbc3('0x24')]['create'](_[_0xcbc3('0x38')](_0x152836,_0x4ac4f8[_0xcbc3('0x48')]),{'include':_0x4ac4f8[_0xcbc3('0x2a')][_0xcbc3('0x40')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5cc85d,0xc9))[_0xcbc3('0x3d')](handleError(_0x5cc85d,null));};exports[_0xcbc3('0x1e')]=function(_0x1596ce,_0xfc6433){if(_0x1596ce[_0xcbc3('0x48')]['id']){delete _0x1596ce['body']['id'];}return db[_0xcbc3('0x24')][_0xcbc3('0x42')]({'where':{'id':_0x1596ce[_0xcbc3('0x43')]['id']}})['then'](handleEntityNotFound(_0xfc6433,null))[_0xcbc3('0x1f')](saveUpdates(_0x1596ce[_0xcbc3('0x48')],null))[_0xcbc3('0x1f')](respondWithResult(_0xfc6433,null))[_0xcbc3('0x3d')](handleError(_0xfc6433,null));};exports['destroy']=function(_0x55944f,_0x214510){return db[_0xcbc3('0x24')][_0xcbc3('0x42')]({'where':{'id':_0x55944f['params']['id']}})[_0xcbc3('0x1f')](handleEntityNotFound(_0x214510,null))['then'](removeEntity(_0x214510,null))[_0xcbc3('0x3d')](handleError(_0x214510,null));};exports[_0xcbc3('0x49')]=function(_0x59e831,_0x266af2,_0x468590){_0x59e831[_0xcbc3('0x48')][_0xcbc3('0x22')]=_0x59e831['file'][_0xcbc3('0x4a')];_0x59e831[_0xcbc3('0x48')][_0xcbc3('0x4b')]=_0x59e831[_0xcbc3('0x4c')]['filename'];_0x59e831[_0xcbc3('0x48')][_0xcbc3('0x26')]=_0x59e831[_0xcbc3('0x4c')][_0xcbc3('0x4d')];return db['Attachment'][_0xcbc3('0x49')](_0x59e831['body'])[_0xcbc3('0x1f')](respondWithResult(_0x266af2,0xc9))[_0xcbc3('0x3d')](handleError(_0x266af2,null));};exports[_0xcbc3('0x4e')]=function(_0x212349,_0x43fbd9,_0x401608){return db[_0xcbc3('0x24')][_0xcbc3('0x4f')]({'where':{'id':_0x212349[_0xcbc3('0x43')]['id']},'raw':!![]})[_0xcbc3('0x1f')](handleEntityNotFound(_0x43fbd9,null))[_0xcbc3('0x1f')](function(_0x26d797){if(_0x26d797){var _0x4d1031=_0x26d797[_0xcbc3('0x50')]!==null;var _0x4593e9=path[_0xcbc3('0x51')](config[_0xcbc3('0x52')],_0xcbc3('0x53'));if(_0x4d1031){_0x4593e9=path['join'](_0x4593e9,_0xcbc3('0x54'));}var _0x4cab85=path[_0xcbc3('0x51')](_0x4593e9,_0x26d797[_0xcbc3('0x4b')]);return _0x43fbd9[_0xcbc3('0x4e')](_0x4cab85);}})[_0xcbc3('0x3d')](handleError(_0x43fbd9,null));};
\ No newline at end of file
+var _0x853c=['mimetype','download','ChatOfflineMessageId','join','root','server/files/attachments/','basename','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','findAll','catch','show','params','includeAll','include','options','Attachment','find','clone','rawAttributes','length','get','omit','body','createdAt','updatedAt','create','file','filename'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x853c,0x118));var _0xc853=function(_0x3f42d7,_0x261bc5){_0x3f42d7=_0x3f42d7-0x0;var _0x39166b=_0x853c[_0x3f42d7];return _0x39166b;};'use strict';var emlformat=require(_0xc853('0x0'));var rimraf=require(_0xc853('0x1'));var zipdir=require(_0xc853('0x2'));var jsonpatch=require(_0xc853('0x3'));var rp=require('request-promise');var moment=require(_0xc853('0x4'));var BPromise=require(_0xc853('0x5'));var Mustache=require(_0xc853('0x6'));var util=require(_0xc853('0x7'));var path=require('path');var sox=require(_0xc853('0x8'));var csv=require(_0xc853('0x9'));var ejs=require(_0xc853('0xa'));var fs=require('fs');var fs_extra=require(_0xc853('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc853('0xc'));var jsforce=require(_0xc853('0xd'));var deskjs=require(_0xc853('0xe'));var toCsv=require(_0xc853('0x9'));var querystring=require(_0xc853('0xf'));var Papa=require(_0xc853('0x10'));var Redis=require(_0xc853('0x11'));var authService=require(_0xc853('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc853('0x13'));var hardwareService=require(_0xc853('0x14'));var logger=require(_0xc853('0x15'))(_0xc853('0x16'));var utils=require(_0xc853('0x17'));var config=require(_0xc853('0x18'));var licenseUtil=require(_0xc853('0x19'));var db=require(_0xc853('0x1a'))['db'];function respondWithStatusCode(_0xce11ea,_0x3e11cd){_0x3e11cd=_0x3e11cd||0xcc;return function(_0x3c1fd8){if(_0x3c1fd8){return _0xce11ea[_0xc853('0x1b')](_0x3e11cd);}return _0xce11ea[_0xc853('0x1c')](_0x3e11cd)[_0xc853('0x1d')]();};}function respondWithResult(_0x196ae0,_0x5ddb51){_0x5ddb51=_0x5ddb51||0xc8;return function(_0x1cf0ed){if(_0x1cf0ed){return _0x196ae0[_0xc853('0x1c')](_0x5ddb51)[_0xc853('0x1e')](_0x1cf0ed);}};}function respondWithFilteredResult(_0x33bdcc,_0x355015){return function(_0xf5ca4b){if(_0xf5ca4b){var _0x38dbe0=typeof _0x355015[_0xc853('0x1f')]===_0xc853('0x20')&&typeof _0x355015[_0xc853('0x21')]===_0xc853('0x20');var _0x5ed0a4=_0xf5ca4b[_0xc853('0x22')];var _0x57156b=_0x38dbe0?0x0:_0x355015[_0xc853('0x1f')];var _0x1bc658=_0x38dbe0?_0xf5ca4b[_0xc853('0x22')]:_0x355015[_0xc853('0x1f')]+_0x355015[_0xc853('0x21')];var _0x1c1ce1;if(_0x1bc658>=_0x5ed0a4){_0x1bc658=_0x5ed0a4;_0x1c1ce1=0xc8;}else{_0x1c1ce1=0xce;}_0x33bdcc[_0xc853('0x1c')](_0x1c1ce1);return _0x33bdcc[_0xc853('0x23')]('Content-Range',_0x57156b+'-'+_0x1bc658+'/'+_0x5ed0a4)['json'](_0xf5ca4b);}return null;};}function patchUpdates(_0x59e136){return function(_0x279bcb){try{jsonpatch[_0xc853('0x24')](_0x279bcb,_0x59e136,!![]);}catch(_0x56a26c){return BPromise['reject'](_0x56a26c);}return _0x279bcb[_0xc853('0x25')]();};}function saveUpdates(_0x5ea366,_0x31945e){return function(_0x199bc5){if(_0x199bc5){return _0x199bc5[_0xc853('0x26')](_0x5ea366)[_0xc853('0x27')](function(_0x51b156){return _0x51b156;});}return null;};}function removeEntity(_0x1c2c44,_0x23473c){return function(_0x4342db){if(_0x4342db){return _0x4342db[_0xc853('0x28')]()['then'](function(){_0x1c2c44['status'](0xcc)[_0xc853('0x1d')]();});}};}function handleEntityNotFound(_0x276328,_0x5d1b9d){return function(_0x16e558){if(!_0x16e558){_0x276328[_0xc853('0x1b')](0x194);}return _0x16e558;};}function handleError(_0x5a8b7c,_0x1b7b82){_0x1b7b82=_0x1b7b82||0x1f4;return function(_0x4ca33b){logger[_0xc853('0x29')](_0x4ca33b[_0xc853('0x2a')]);if(_0x4ca33b[_0xc853('0x2b')]){delete _0x4ca33b[_0xc853('0x2b')];}_0x5a8b7c[_0xc853('0x1c')](_0x1b7b82)[_0xc853('0x2c')](_0x4ca33b);};}exports['index']=function(_0x4a58ce,_0x4beb7b){var _0x191800={},_0xdc330c={},_0x10ad6b={'count':0x0,'rows':[]};var _0x22e044=_[_0xc853('0x2d')](db['Attachment']['rawAttributes'],function(_0x308b0f){return{'name':_0x308b0f[_0xc853('0x2e')],'type':_0x308b0f['type'][_0xc853('0x2f')]};});_0xdc330c[_0xc853('0x30')]=_[_0xc853('0x2d')](_0x22e044,_0xc853('0x2b'));_0xdc330c[_0xc853('0x31')]=_[_0xc853('0x32')](_0x4a58ce['query']);_0xdc330c[_0xc853('0x33')]=_[_0xc853('0x34')](_0xdc330c[_0xc853('0x30')],_0xdc330c[_0xc853('0x31')]);_0x191800[_0xc853('0x35')]=_['intersection'](_0xdc330c[_0xc853('0x30')],qs[_0xc853('0x36')](_0x4a58ce['query'][_0xc853('0x36')]));_0x191800[_0xc853('0x35')]=_0x191800['attributes']['length']?_0x191800[_0xc853('0x35')]:_0xdc330c[_0xc853('0x30')];if(!_0x4a58ce[_0xc853('0x31')][_0xc853('0x37')](_0xc853('0x38'))){_0x191800[_0xc853('0x21')]=qs['limit'](_0x4a58ce[_0xc853('0x31')][_0xc853('0x21')]);_0x191800[_0xc853('0x1f')]=qs[_0xc853('0x1f')](_0x4a58ce['query'][_0xc853('0x1f')]);}_0x191800[_0xc853('0x39')]=qs[_0xc853('0x3a')](_0x4a58ce['query'][_0xc853('0x3a')]);_0x191800[_0xc853('0x3b')]=qs['filters'](_[_0xc853('0x3c')](_0x4a58ce[_0xc853('0x31')],_0xdc330c['filters']),_0x22e044);if(_0x4a58ce[_0xc853('0x31')][_0xc853('0x3d')]){_0x191800[_0xc853('0x3b')]=_[_0xc853('0x3e')](_0x191800['where'],{'$or':_['map'](_0x22e044,function(_0x42d829){if(_0x42d829[_0xc853('0x3f')]!=='VIRTUAL'){var _0x345cab={};_0x345cab[_0x42d829[_0xc853('0x2b')]]={'$like':'%'+_0x4a58ce['query'][_0xc853('0x3d')]+'%'};return _0x345cab;}})});}_0x191800=_[_0xc853('0x3e')]({},_0x191800,_0x4a58ce['options']);var _0x4b4b88={'where':_0x191800[_0xc853('0x3b')]};return db['Attachment'][_0xc853('0x22')](_0x4b4b88)['then'](function(_0x1f513a){_0x10ad6b[_0xc853('0x22')]=_0x1f513a;if(_0x4a58ce[_0xc853('0x31')]['includeAll']){_0x191800['include']=[{'all':!![]}];}return db['Attachment'][_0xc853('0x40')](_0x191800);})[_0xc853('0x27')](function(_0x57305d){_0x10ad6b['rows']=_0x57305d;return _0x10ad6b;})['then'](respondWithFilteredResult(_0x4beb7b,_0x191800))[_0xc853('0x41')](handleError(_0x4beb7b,null));};exports[_0xc853('0x42')]=function(_0x2ca0e1,_0x3d8e43){var _0x200572={'raw':!![],'where':{'id':_0x2ca0e1[_0xc853('0x43')]['id']}},_0x58892c={};_0x58892c['model']=_[_0xc853('0x32')](db['Attachment']['rawAttributes']);_0x58892c['query']=_['keys'](_0x2ca0e1[_0xc853('0x31')]);_0x58892c[_0xc853('0x33')]=_['intersection'](_0x58892c[_0xc853('0x30')],_0x58892c[_0xc853('0x31')]);_0x200572[_0xc853('0x35')]=_[_0xc853('0x34')](_0x58892c[_0xc853('0x30')],qs[_0xc853('0x36')](_0x2ca0e1['query']['fields']));_0x200572[_0xc853('0x35')]=_0x200572['attributes']['length']?_0x200572[_0xc853('0x35')]:_0x58892c[_0xc853('0x30')];if(_0x2ca0e1[_0xc853('0x31')][_0xc853('0x44')]){_0x200572[_0xc853('0x45')]=[{'all':!![]}];}_0x200572=_[_0xc853('0x3e')]({},_0x200572,_0x2ca0e1[_0xc853('0x46')]);return db[_0xc853('0x47')][_0xc853('0x48')](_0x200572)['then'](handleEntityNotFound(_0x3d8e43,null))[_0xc853('0x27')](respondWithResult(_0x3d8e43,null))[_0xc853('0x41')](handleError(_0x3d8e43,null));};exports[_0xc853('0x49')]=function(_0x478b58,_0xc0d64c){var _0xf6cef={'where':{'id':_0x478b58['params']['id']}},_0x245fbb={};_0x245fbb[_0xc853('0x30')]=_[_0xc853('0x32')](db[_0xc853('0x47')][_0xc853('0x4a')]);_0xf6cef[_0xc853('0x35')]=_[_0xc853('0x34')](_0x245fbb[_0xc853('0x30')],qs[_0xc853('0x36')](_0x478b58[_0xc853('0x31')][_0xc853('0x36')]));_0xf6cef[_0xc853('0x35')]=_0xf6cef[_0xc853('0x35')][_0xc853('0x4b')]?_0xf6cef['attributes']:_0x245fbb[_0xc853('0x30')];if(_0x478b58[_0xc853('0x31')]['includeAll']){_0xf6cef['include']=[{'all':!![]}];}_0xf6cef=_['merge']({},_0xf6cef,_0x478b58[_0xc853('0x46')]);return db['Attachment'][_0xc853('0x48')](_0xf6cef)[_0xc853('0x27')](handleEntityNotFound(_0xc0d64c,null))[_0xc853('0x27')](function(_0x59cd56){if(_0x59cd56){var _0x1947d0=_0x59cd56[_0xc853('0x4c')]({'plain':!![]});_0x1947d0=qs[_0xc853('0x4d')](_0x1947d0,['id','createdAt','updatedAt']);_0x478b58[_0xc853('0x4e')]=_[_0xc853('0x4d')](_0x478b58['body'],['id',_0xc853('0x4f'),_0xc853('0x50')]);return db[_0xc853('0x47')][_0xc853('0x51')](_[_0xc853('0x3e')](_0x1947d0,_0x478b58[_0xc853('0x4e')]),{'include':_0x478b58[_0xc853('0x31')][_0xc853('0x44')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0xc0d64c,0xc9))[_0xc853('0x41')](handleError(_0xc0d64c,null));};exports['update']=function(_0x47d7a2,_0x63bc37){if(_0x47d7a2[_0xc853('0x4e')]['id']){delete _0x47d7a2['body']['id'];}return db[_0xc853('0x47')][_0xc853('0x48')]({'where':{'id':_0x47d7a2[_0xc853('0x43')]['id']}})['then'](handleEntityNotFound(_0x63bc37,null))[_0xc853('0x27')](saveUpdates(_0x47d7a2['body'],null))[_0xc853('0x27')](respondWithResult(_0x63bc37,null))[_0xc853('0x41')](handleError(_0x63bc37,null));};exports['destroy']=function(_0x345a03,_0x1f8a60){return db['Attachment']['find']({'where':{'id':_0x345a03[_0xc853('0x43')]['id']}})[_0xc853('0x27')](handleEntityNotFound(_0x1f8a60,null))[_0xc853('0x27')](removeEntity(_0x1f8a60,null))['catch'](handleError(_0x1f8a60,null));};exports['create']=function(_0x3c8755,_0x5c9c96,_0xce7f1b){_0x3c8755[_0xc853('0x4e')][_0xc853('0x2b')]=_0x3c8755[_0xc853('0x52')]['originalname'];_0x3c8755[_0xc853('0x4e')]['basename']=_0x3c8755['file'][_0xc853('0x53')];_0x3c8755['body'][_0xc853('0x3f')]=_0x3c8755[_0xc853('0x52')][_0xc853('0x54')];return db[_0xc853('0x47')][_0xc853('0x51')](_0x3c8755['body'])[_0xc853('0x27')](respondWithResult(_0x5c9c96,0xc9))[_0xc853('0x41')](handleError(_0x5c9c96,null));};exports[_0xc853('0x55')]=function(_0x23f90d,_0x1d1bc7,_0x215caf){return db[_0xc853('0x47')]['findOne']({'where':{'id':_0x23f90d[_0xc853('0x43')]['id']},'raw':!![]})[_0xc853('0x27')](handleEntityNotFound(_0x1d1bc7,null))['then'](function(_0xf52084){if(_0xf52084){var _0x27903c=_0xf52084[_0xc853('0x56')]!==null;var _0x3af214=path[_0xc853('0x57')](config[_0xc853('0x58')],_0xc853('0x59'));if(_0x27903c){_0x3af214=path[_0xc853('0x57')](_0x3af214,'offline-chat/');}var _0x582d42=path[_0xc853('0x57')](_0x3af214,_0xf52084[_0xc853('0x5a')]);return _0x1d1bc7[_0xc853('0x55')](_0x582d42);}})[_0xc853('0x41')](handleError(_0x1d1bc7,null));};
\ No newline at end of file
index 63a9476..22d43ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec45=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','attachments','lodash'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0xec45,0x1a3));var _0x5ec4=function(_0x130403,_0x2c6593){_0x130403=_0x130403-0x0;var _0x74229a=_0xec45[_0x130403];return _0x74229a;};'use strict';var _=require(_0x5ec4('0x0'));var util=require(_0x5ec4('0x1'));var logger=require('../../config/logger')(_0x5ec4('0x2'));var moment=require(_0x5ec4('0x3'));var BPromise=require(_0x5ec4('0x4'));var rp=require(_0x5ec4('0x5'));var fs=require('fs');var path=require(_0x5ec4('0x6'));var rimraf=require(_0x5ec4('0x7'));var config=require(_0x5ec4('0x8'));var attributes=require(_0x5ec4('0x9'));module[_0x5ec4('0xa')]=function(_0x52820c,_0x2eab12){return _0x52820c[_0x5ec4('0xb')](_0x5ec4('0xc'),attributes,{'tableName':_0x5ec4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb044=['lodash','../../config/logger','api','request-promise','path','rimraf','define','Attachment','attachments'];(function(_0x3a968e,_0x105c4d){var _0x9c978e=function(_0x24b2d0){while(--_0x24b2d0){_0x3a968e['push'](_0x3a968e['shift']());}};_0x9c978e(++_0x105c4d);}(_0xb044,0xcf));var _0x4b04=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb044[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4b04('0x0'));var util=require('util');var logger=require(_0x4b04('0x1'))(_0x4b04('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4b04('0x3'));var fs=require('fs');var path=require(_0x4b04('0x4'));var rimraf=require(_0x4b04('0x5'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module['exports']=function(_0x2f15c2,_0x29ecd5){return _0x2f15c2[_0x4b04('0x6')](_0x4b04('0x7'),attributes,{'tableName':_0x4b04('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d64c2bf..967cab7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec56=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateAttachment','Attachment','create','body','options','raw','lodash','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1a2dfa,_0x1d9e81){var _0x451bb5=function(_0x57b81c){while(--_0x57b81c){_0x1a2dfa['push'](_0x1a2dfa['shift']());}};_0x451bb5(++_0x1d9e81);}(_0xec56,0x1bd));var _0x6ec5=function(_0x2c1fb9,_0x177d1d){_0x2c1fb9=_0x2c1fb9-0x0;var _0x6477f0=_0xec56[_0x2c1fb9];return _0x6477f0;};'use strict';var _=require(_0x6ec5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6ec5('0x1'));var rs=require(_0x6ec5('0x2'));var fs=require('fs');var Redis=require(_0x6ec5('0x3'));var db=require(_0x6ec5('0x4'))['db'];var utils=require(_0x6ec5('0x5'));var logger=require(_0x6ec5('0x6'))(_0x6ec5('0x7'));var config=require(_0x6ec5('0x8'));var jayson=require(_0x6ec5('0x9'));var client=jayson[_0x6ec5('0xa')][_0x6ec5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb683,_0x35be4e,_0x1f59cd){return new BPromise(function(_0x3dd891,_0x225d2f){return client[_0x6ec5('0xc')](_0x3bb683,_0x1f59cd)[_0x6ec5('0xd')](function(_0x3ff17c){logger['info'](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));logger[_0x6ec5('0x10')](_0x6ec5('0x11'),_0x35be4e,_0x6ec5('0xf'),JSON[_0x6ec5('0x12')](_0x3ff17c));if(_0x3ff17c[_0x6ec5('0x13')]){if(_0x3ff17c['error'][_0x6ec5('0x14')]===0x1f4){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);return _0x225d2f(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}logger[_0x6ec5('0x13')]('Attachment,\x20%s,\x20%s',_0x35be4e,_0x3ff17c[_0x6ec5('0x13')]['message']);return _0x3dd891(_0x3ff17c[_0x6ec5('0x13')][_0x6ec5('0x15')]);}else{logger[_0x6ec5('0x16')](_0x6ec5('0xe'),_0x35be4e,_0x6ec5('0xf'));_0x3dd891(_0x3ff17c['result'][_0x6ec5('0x15')]);}})[_0x6ec5('0x17')](function(_0x125ae6){logger[_0x6ec5('0x13')](_0x6ec5('0xe'),_0x35be4e,_0x125ae6);_0x225d2f(_0x125ae6);});});}exports[_0x6ec5('0x18')]=function(_0x1dbee9){var _0x4237bc=this;return new Promise(function(_0x2608c0,_0x3d5d45){return db[_0x6ec5('0x19')][_0x6ec5('0x1a')](_0x1dbee9[_0x6ec5('0x1b')],{'raw':_0x1dbee9[_0x6ec5('0x1c')]?_0x1dbee9[_0x6ec5('0x1c')][_0x6ec5('0x1d')]===undefined?!![]:![]:!![]})[_0x6ec5('0xd')](function(_0x4abd5d){logger[_0x6ec5('0x16')](_0x6ec5('0x18'),_0x1dbee9);logger[_0x6ec5('0x10')](_0x6ec5('0x18'),_0x1dbee9,JSON[_0x6ec5('0x12')](_0x4abd5d));_0x2608c0(_0x4abd5d);})[_0x6ec5('0x17')](function(_0x18243f){logger['error'](_0x6ec5('0x18'),_0x18243f[_0x6ec5('0x15')],_0x1dbee9);_0x3d5d45(_0x4237bc[_0x6ec5('0x13')](0x1f4,_0x18243f[_0x6ec5('0x15')]));});});};
\ No newline at end of file
+var _0x44a3=['create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','message','Attachment,\x20%s,\x20%s','catch','CreateAttachment','Attachment'];(function(_0x3f4f8a,_0x5057eb){var _0x28c7e8=function(_0x8eba3c){while(--_0x8eba3c){_0x3f4f8a['push'](_0x3f4f8a['shift']());}};_0x28c7e8(++_0x5057eb);}(_0x44a3,0x1a9));var _0x344a=function(_0x114bdf,_0x119ada){_0x114bdf=_0x114bdf-0x0;var _0x5658f6=_0x44a3[_0x114bdf];return _0x5658f6;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var moment=require(_0x344a('0x2'));var BPromise=require(_0x344a('0x3'));var rs=require(_0x344a('0x4'));var fs=require('fs');var Redis=require(_0x344a('0x5'));var db=require(_0x344a('0x6'))['db'];var utils=require(_0x344a('0x7'));var logger=require('../../config/logger')(_0x344a('0x8'));var config=require(_0x344a('0x9'));var jayson=require(_0x344a('0xa'));var client=jayson[_0x344a('0xb')][_0x344a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x504bd1,_0x553d97,_0x55ddca){return new BPromise(function(_0x484661,_0x475dab){return client[_0x344a('0xd')](_0x504bd1,_0x55ddca)[_0x344a('0xe')](function(_0x233ca1){logger[_0x344a('0xf')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'));logger[_0x344a('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x553d97,_0x344a('0x10'),JSON['stringify'](_0x233ca1));if(_0x233ca1[_0x344a('0x12')]){if(_0x233ca1['error'][_0x344a('0x13')]===0x1f4){logger[_0x344a('0x12')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x233ca1['error'][_0x344a('0x14')]);return _0x475dab(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}logger[_0x344a('0x12')](_0x344a('0x15'),_0x553d97,_0x233ca1[_0x344a('0x12')]['message']);return _0x484661(_0x233ca1[_0x344a('0x12')][_0x344a('0x14')]);}else{logger[_0x344a('0xf')](_0x344a('0x15'),_0x553d97,'request\x20sent');_0x484661(_0x233ca1['result'][_0x344a('0x14')]);}})[_0x344a('0x16')](function(_0x36227e){logger[_0x344a('0x12')]('Attachment,\x20%s,\x20%s',_0x553d97,_0x36227e);_0x475dab(_0x36227e);});});}exports[_0x344a('0x17')]=function(_0x277c06){var _0x49b55f=this;return new Promise(function(_0x9fe854,_0x274016){return db[_0x344a('0x18')][_0x344a('0x19')](_0x277c06[_0x344a('0x1a')],{'raw':_0x277c06[_0x344a('0x1b')]?_0x277c06[_0x344a('0x1b')][_0x344a('0x1c')]===undefined?!![]:![]:!![]})[_0x344a('0xe')](function(_0x450922){logger['info'](_0x344a('0x17'),_0x277c06);logger[_0x344a('0x11')](_0x344a('0x17'),_0x277c06,JSON[_0x344a('0x1d')](_0x450922));_0x9fe854(_0x450922);})[_0x344a('0x16')](function(_0x80ae12){logger[_0x344a('0x12')](_0x344a('0x17'),_0x80ae12[_0x344a('0x14')],_0x277c06);_0x274016(_0x49b55f[_0x344a('0x12')](0x1f4,_0x80ae12[_0x344a('0x14')]));});});};
\ No newline at end of file
index 76e1807..20eb5c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router;
\ No newline at end of file
+var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router;
\ No newline at end of file
index 505a72b..5ffb593 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x07d7=['error','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','then','add','minutes','clearBlockUser','getLicense','catch','status','send','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x31d415,_0x12a4e9){var _0x30f11e=function(_0x56058e){while(--_0x56058e){_0x31d415['push'](_0x31d415['shift']());}};_0x30f11e(++_0x12a4e9);}(_0x07d7,0x85));var _0x707d=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x07d7[_0x3b2369];return _0x5a1367;};'use strict';var passport=require(_0x707d('0x0'));var LocalStrategy=require(_0x707d('0x1'))[_0x707d('0x2')];var moment=require(_0x707d('0x3'));var ActiveDirectory=require(_0x707d('0x4'));var BPromise=require(_0x707d('0x5'));var util=require(_0x707d('0x6'));var db=require(_0x707d('0x7'))['db'];var authService=require(_0x707d('0x8'));var utils=require(_0x707d('0x9'));var config=require(_0x707d('0xa'));var logger=require(_0x707d('0xb'))(_0x707d('0xc'));function isActiveDirectoryConfigured(_0x1456bd){var _0x1bdf46=![];if(typeof _0x1456bd[_0x707d('0xd')]!=='undefined'){_0x1bdf46=_0x1456bd['activedirectory'][_0x707d('0xe')]&&_0x1456bd[_0x707d('0xd')][_0x707d('0xf')]&&_0x1456bd[_0x707d('0xd')][_0x707d('0x10')];}return _0x1bdf46;}function adAuthenticate(_0x5af425,_0x3f45f5,_0x107bc3){return new BPromise(function(_0xd87d5d,_0x596727){try{var _0x2103dc=new ActiveDirectory(_0x5af425);_0x2103dc[_0x707d('0x11')](_0x3f45f5,_0x107bc3,function(_0x3256f6,_0x4bd94b){if(_0x3256f6){logger['error']('Error\x20authenticate\x20%s:\x20%s',_0x3f45f5,util[_0x707d('0x12')](_0x3256f6,{'showHidden':![],'depth':null}));_0x596727(_0x707d('0x13'));}else if(!_0x4bd94b){logger[_0x707d('0x14')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x3f45f5);_0x596727(_0x707d('0x13'));}else{_0xd87d5d(_0x4bd94b);}});}catch(_0x52c447){_0x596727(_0x52c447);}});}function ActiveDirectoryAuthenticate(_0x1c18a6,_0x42e27f,_0x509ec8,_0x4d598e){var _0x30d583,_0x5b4700;if(!isActiveDirectoryConfigured(config)){logger[_0x707d('0x14')](_0x707d('0x15'),_0x42e27f);return _0x4d598e(null,![],{'message':_0x707d('0x13')});}return db[_0x707d('0x16')][_0x707d('0x17')]({'where':{'id':0x1},'attributes':[_0x707d('0x18'),_0x707d('0x19')],'raw':!![]})['then'](function(_0x1d3fe6){_0x30d583=_0x1d3fe6;if(!_0x30d583[_0x707d('0x18')]){logger[_0x707d('0x14')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x42e27f);throw new Error(_0x707d('0x13'));}return _0x1c18a6[_0x707d('0x17')]({'attributes':['id',_0x707d('0x1a'),_0x707d('0x1b'),_0x707d('0x1c'),_0x707d('0x1d'),_0x707d('0x1e'),_0x707d('0x1f'),_0x707d('0x20'),_0x707d('0x21')],'where':{'name':_0x42e27f,'role':{'$or':[_0x707d('0x22'),_0x707d('0x23'),_0x707d('0x24')]},'adSsoEnabled':!![]}});})[_0x707d('0x25')](function(_0xd97d6b){if(!_0xd97d6b||_0xd97d6b&&_0xd97d6b[_0x707d('0x1a')]!==_0x42e27f){throw new Error(_0x707d('0x13'));}_0x5b4700=_0xd97d6b;var _0x53a5d2=_0x5b4700[_0x707d('0x1a')]+'@'+config['activedirectory'][_0x707d('0x10')];return adAuthenticate(config[_0x707d('0xd')],_0x53a5d2,_0x509ec8);})[_0x707d('0x25')](function(_0x1a5e03){if(_0x5b4700[_0x707d('0x1e')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x30d583[_0x707d('0x19')]>0x0){if(_0x5b4700[_0x707d('0x1f')]){if(moment(_0x5b4700[_0x707d('0x20')])[_0x707d('0x26')](_0x30d583[_0x707d('0x19')],_0x707d('0x27'))>moment()){throw new Error(_0x707d('0x13'));}return utils[_0x707d('0x28')](_0x5b4700,0x0,![],null)[_0x707d('0x25')](function(){return utils[_0x707d('0x29')](_0x5b4700);})[_0x707d('0x25')](function(){return _0x4d598e(null,_0x5b4700);});}else{return utils[_0x707d('0x29')](_0x5b4700)[_0x707d('0x25')](function(){return _0x4d598e(null,_0x5b4700);});}}else{return utils[_0x707d('0x29')](_0x5b4700)[_0x707d('0x25')](function(){return _0x4d598e(null,_0x5b4700);});}})[_0x707d('0x2a')](function(_0x2102e6){return _0x4d598e(null,![],_0x2102e6);});}function handleError(_0x309ded,_0x599ba6,_0x17bb4e){return _0x309ded[_0x707d('0x2b')](_0x599ba6||0x1f4)[_0x707d('0x2c')]({'message':_0x17bb4e?_0x17bb4e['message']||_0x17bb4e:''});}exports['login']=function(_0x4e653b,_0x18c7e4,_0x10c105){passport[_0x707d('0x11')](_0x707d('0x2d'),function(_0x177524,_0x327623,_0x146658){var _0x3734be=_0x177524||_0x146658;if(_0x3734be){return handleError(_0x18c7e4,0x191,_0x3734be);}if(!_0x327623){return handleError(_0x18c7e4,0x194,{'message':_0x707d('0x2e')});}else{var _0x43ec7a={'payload':{'id':_0x327623['id'],'role':_0x327623[_0x707d('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x707d('0x2f')](_0x43ec7a)['then'](function(_0x39bb5f){_0x18c7e4[_0x707d('0x30')]({'id':_0x327623['id'],'token':_0x39bb5f,'statusCall':'','isAlreadyLogged':_0x327623[_0x707d('0x21')]});});}})(_0x4e653b,_0x18c7e4,_0x10c105);};passport[_0x707d('0x31')](_0x707d('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':_0x707d('0x1b')},function(_0x3603e9,_0x4d2051,_0x325bd9){return ActiveDirectoryAuthenticate(db[_0x707d('0x32')],_0x3603e9,_0x4d2051,_0x325bd9);}));
\ No newline at end of file
+var _0x345e=['../../config/utils','../../config/environment','../../config/logger','api','activedirectory','baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','then','blockDuration','minutes','clearBlockUser','getLicense','send','message','login','signToken','json','ad-login','passport','passport-local','Strategy','moment','bluebird','../../components/auth/service'];(function(_0x2c4a4e,_0x42e395){var _0x182441=function(_0x10037e){while(--_0x10037e){_0x2c4a4e['push'](_0x2c4a4e['shift']());}};_0x182441(++_0x42e395);}(_0x345e,0x12e));var _0xe345=function(_0x310dc2,_0x2299c4){_0x310dc2=_0x310dc2-0x0;var _0x24980f=_0x345e[_0x310dc2];return _0x24980f;};'use strict';var passport=require(_0xe345('0x0'));var LocalStrategy=require(_0xe345('0x1'))[_0xe345('0x2')];var moment=require(_0xe345('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xe345('0x4'));var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0xe345('0x5'));var utils=require(_0xe345('0x6'));var config=require(_0xe345('0x7'));var logger=require(_0xe345('0x8'))(_0xe345('0x9'));function isActiveDirectoryConfigured(_0x40494c){var _0x469ced=![];if(typeof _0x40494c['activedirectory']!=='undefined'){_0x469ced=_0x40494c[_0xe345('0xa')][_0xe345('0xb')]&&_0x40494c[_0xe345('0xa')]['url']&&_0x40494c['activedirectory'][_0xe345('0xc')];}return _0x469ced;}function adAuthenticate(_0x12ef58,_0x5b2526,_0x438411){return new BPromise(function(_0x4a59ee,_0x1871a8){try{var _0x229c2f=new ActiveDirectory(_0x12ef58);_0x229c2f[_0xe345('0xd')](_0x5b2526,_0x438411,function(_0x133269,_0x4657e0){if(_0x133269){logger[_0xe345('0xe')](_0xe345('0xf'),_0x5b2526,util['inspect'](_0x133269,{'showHidden':![],'depth':null}));_0x1871a8(_0xe345('0x10'));}else if(!_0x4657e0){logger[_0xe345('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x5b2526);_0x1871a8(_0xe345('0x10'));}else{_0x4a59ee(_0x4657e0);}});}catch(_0x284db4){_0x1871a8(_0x284db4);}});}function ActiveDirectoryAuthenticate(_0x4d9756,_0x58fa55,_0x452d8d,_0x501681){var _0x3edc88,_0x54e4bc;if(!isActiveDirectoryConfigured(config)){logger[_0xe345('0xe')](_0xe345('0x11'),_0x58fa55);return _0x501681(null,![],{'message':_0xe345('0x10')});}return db[_0xe345('0x12')][_0xe345('0x13')]({'where':{'id':0x1},'attributes':['adSsoEnabled','blockDuration'],'raw':!![]})['then'](function(_0x22256a){_0x3edc88=_0x22256a;if(!_0x3edc88[_0xe345('0x14')]){logger[_0xe345('0xe')](_0xe345('0x15'),_0x58fa55);throw new Error(_0xe345('0x10'));}return _0x4d9756['findOne']({'attributes':['id',_0xe345('0x16'),_0xe345('0x17'),_0xe345('0x18'),_0xe345('0x19'),_0xe345('0x1a'),_0xe345('0x1b'),_0xe345('0x1c'),_0xe345('0x1d')],'where':{'name':_0x58fa55,'role':{'$or':[_0xe345('0x1e'),_0xe345('0x1f'),_0xe345('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x4c41e9){if(!_0x4c41e9||_0x4c41e9&&_0x4c41e9[_0xe345('0x16')]!==_0x58fa55){throw new Error(_0xe345('0x10'));}_0x54e4bc=_0x4c41e9;var _0x4d904a=_0x54e4bc[_0xe345('0x16')]+'@'+config[_0xe345('0xa')]['domain'];return adAuthenticate(config['activedirectory'],_0x4d904a,_0x452d8d);})[_0xe345('0x21')](function(_0x16a7af){if(_0x54e4bc[_0xe345('0x1a')]){throw new Error(_0xe345('0x10'));}if(_0x3edc88[_0xe345('0x22')]>0x0){if(_0x54e4bc[_0xe345('0x1b')]){if(moment(_0x54e4bc[_0xe345('0x1c')])['add'](_0x3edc88[_0xe345('0x22')],_0xe345('0x23'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0xe345('0x24')](_0x54e4bc,0x0,![],null)[_0xe345('0x21')](function(){return utils[_0xe345('0x25')](_0x54e4bc);})[_0xe345('0x21')](function(){return _0x501681(null,_0x54e4bc);});}else{return utils['getLicense'](_0x54e4bc)[_0xe345('0x21')](function(){return _0x501681(null,_0x54e4bc);});}}else{return utils[_0xe345('0x25')](_0x54e4bc)[_0xe345('0x21')](function(){return _0x501681(null,_0x54e4bc);});}})['catch'](function(_0x4be728){return _0x501681(null,![],_0x4be728);});}function handleError(_0x378e97,_0x2097c1,_0x1ff043){return _0x378e97['status'](_0x2097c1||0x1f4)[_0xe345('0x26')]({'message':_0x1ff043?_0x1ff043[_0xe345('0x27')]||_0x1ff043:''});}exports[_0xe345('0x28')]=function(_0x2decca,_0x37f971,_0xacedc3){passport['authenticate']('ad-login',function(_0x17a953,_0x124afb,_0x5114ce){var _0x1e89da=_0x17a953||_0x5114ce;if(_0x1e89da){return handleError(_0x37f971,0x191,_0x1e89da);}if(!_0x124afb){return handleError(_0x37f971,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x401516={'payload':{'id':_0x124afb['id'],'role':_0x124afb['role']},'options':{'expiresIn':0x15180}};return authService[_0xe345('0x29')](_0x401516)[_0xe345('0x21')](function(_0x2ec58f){_0x37f971[_0xe345('0x2a')]({'id':_0x124afb['id'],'token':_0x2ec58f,'statusCall':'','isAlreadyLogged':_0x124afb['online']});});}})(_0x2decca,_0x37f971,_0xacedc3);};passport['use'](_0xe345('0x2b'),new LocalStrategy({'usernameField':_0xe345('0x16'),'passwordField':'password'},function(_0x415dc1,_0x197a15,_0x4a1b6a){return ActiveDirectoryAuthenticate(db['User'],_0x415dc1,_0x197a15,_0x4a1b6a);}));
\ No newline at end of file
index 86af8f7..444e050 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xafe8=['./authActiveDirectory.controller','login','Router'];(function(_0x54c405,_0x1d8a6a){var _0x292d10=function(_0x4ddc5c){while(--_0x4ddc5c){_0x54c405['push'](_0x54c405['shift']());}};_0x292d10(++_0x1d8a6a);}(_0xafe8,0xf2));var _0x8afe=function(_0x585d81,_0xf6d74f){_0x585d81=_0x585d81-0x0;var _0x1aca0d=_0xafe8[_0x585d81];return _0x1aca0d;};'use strict';var express=require('express');var router=express[_0x8afe('0x0')]();var controller=require(_0x8afe('0x1'));router['post']('/',controller[_0x8afe('0x2')]);module['exports']=router;
\ No newline at end of file
+var _0x48e8=['login','express','./authActiveDirectory.controller','post'];(function(_0x1f9ee0,_0x2152a2){var _0x4274b5=function(_0x4c72bd){while(--_0x4c72bd){_0x1f9ee0['push'](_0x1f9ee0['shift']());}};_0x4274b5(++_0x2152a2);}(_0x48e8,0x1b9));var _0x848e=function(_0x481d67,_0x41317c){_0x481d67=_0x481d67-0x0;var _0xbfff15=_0x48e8[_0x481d67];return _0xbfff15;};'use strict';var express=require(_0x848e('0x0'));var router=express['Router']();var controller=require(_0x848e('0x1'));router[_0x848e('0x2')]('/',controller[_0x848e('0x3')]);module['exports']=router;
\ No newline at end of file
index bd70d16..0026294 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x7a54,0x106));var _0x47a5=function(_0x5906d3,_0x4c7c96){_0x5906d3=_0x5906d3-0x0;var _0x2f6ed5=_0x7a54[_0x5906d3];return _0x2f6ed5;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});}));
\ No newline at end of file
+var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x202703,_0x192231){var _0x201855=function(_0x453148){while(--_0x453148){_0x202703['push'](_0x202703['shift']());}};_0x201855(++_0x192231);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});}));
\ No newline at end of file
index a102e6c..b951dfc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4059=['Router','./authGoogle.controller','../user/user.controller.js','get','login','/callback','callback','setTokenCookie','express','passport'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x4059,0xb2));var _0x9405=function(_0xf2645f,_0x5c3ac1){_0xf2645f=_0xf2645f-0x0;var _0x2886b6=_0x4059[_0xf2645f];return _0x2886b6;};'use strict';var express=require(_0x9405('0x0'));var passport=require(_0x9405('0x1'));var router=express[_0x9405('0x2')]();var controller=require(_0x9405('0x3'));var userController=require(_0x9405('0x4'));var authService=require('../../components/auth/service');router[_0x9405('0x5')]('/',controller[_0x9405('0x6')]);router[_0x9405('0x5')](_0x9405('0x7'),controller[_0x9405('0x8')],authService['isMiddleware'],userController[_0x9405('0x6')],authService[_0x9405('0x9')]);module['exports']=router;
\ No newline at end of file
+var _0xb218=['../../components/auth/service','get','login','/callback','callback','isMiddleware','passport','Router','./authGoogle.controller'];(function(_0x2d23e5,_0x32495a){var _0x38823a=function(_0x21809b){while(--_0x21809b){_0x2d23e5['push'](_0x2d23e5['shift']());}};_0x38823a(++_0x32495a);}(_0xb218,0x1bf));var _0x8b21=function(_0x9f833a,_0x317091){_0x9f833a=_0x9f833a-0x0;var _0x1ee10=_0xb218[_0x9f833a];return _0x1ee10;};'use strict';var express=require('express');var passport=require(_0x8b21('0x0'));var router=express[_0x8b21('0x1')]();var controller=require(_0x8b21('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x8b21('0x3'));router[_0x8b21('0x4')]('/',controller[_0x8b21('0x5')]);router[_0x8b21('0x4')](_0x8b21('0x6'),controller[_0x8b21('0x7')],authService[_0x8b21('0x8')],userController[_0x8b21('0x5')],authService['setTokenCookie']);module['exports']=router;
\ No newline at end of file
index cd2f97b..25c8f7a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ed7=['Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','SendMail','error','message','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','minutes','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordExpires','status','Password\x20reset!','use','local-login','util','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','client','http','Setting','findOne','then','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','allowedLoginAttempts','clearBlockUser','add','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider'];(function(_0x373dcb,_0x32c28b){var _0x4e31e2=function(_0x300d57){while(--_0x300d57){_0x373dcb['push'](_0x373dcb['shift']());}};_0x4e31e2(++_0x32c28b);}(_0x2ed7,0x1ab));var _0x72ed=function(_0x15da5b,_0x96611e){_0x15da5b=_0x15da5b-0x0;var _0x52fb6d=_0x2ed7[_0x15da5b];return _0x52fb6d;};'use strict';var util=require(_0x72ed('0x0'));var passport=require('passport');var LocalStrategy=require('passport-local')[_0x72ed('0x1')];var jayson=require(_0x72ed('0x2'));var _=require(_0x72ed('0x3'));var rs=require('randomstring');var moment=require(_0x72ed('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0x72ed('0x5'));var utils=require(_0x72ed('0x6'));var client=jayson[_0x72ed('0x7')][_0x72ed('0x8')]({'port':0x232b});function localAuthenticate(_0x46fdd1,_0x4170ad,_0x334750,_0x23c8e6){var _0x2400d5,_0x31fbb6;return db[_0x72ed('0x9')][_0x72ed('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x72ed('0xb')](function(_0x34a9d6){_0x2400d5=_0x34a9d6;return _0x46fdd1['findOne']({'attributes':['id',_0x72ed('0xc'),_0x72ed('0xd'),_0x72ed('0xe'),_0x72ed('0xf'),_0x72ed('0x10'),_0x72ed('0x11'),_0x72ed('0x12'),_0x72ed('0x13')],'where':{'name':_0x4170ad,'role':{'$or':['admin',_0x72ed('0x14'),_0x72ed('0x15')]}}});})[_0x72ed('0xb')](function(_0x2d97f0){if(!_0x2d97f0||_0x2d97f0&&_0x2d97f0[_0x72ed('0xc')]!==_0x4170ad){throw new Error(_0x72ed('0x16'));}else{_0x31fbb6=_0x2d97f0;return _0x31fbb6;}})[_0x72ed('0xb')](function(){_0x31fbb6['authenticate'](_0x334750,function(_0x34c16c,_0x17bffd){var _0x1f8a51=_0x31fbb6[_0x72ed('0x13')]+0x1;if(_0x34c16c){return _0x23c8e6(_0x34c16c);}else if(!_0x17bffd){if(_0x31fbb6[_0x72ed('0x10')]){return _0x23c8e6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2400d5['allowedLoginAttempts']>0x0){if(_0x31fbb6[_0x72ed('0x11')]){if(_0x2400d5[_0x72ed('0x17')]>0x0){if(moment(_0x31fbb6[_0x72ed('0x12')])['add'](_0x2400d5[_0x72ed('0x17')],'minutes')>moment()){return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});}else{return utils['clearBlockUser'](_0x31fbb6,_0x1f8a51,![],null)['then'](function(){return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});});}}else{return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});}}else{if(_0x1f8a51>=_0x2400d5[_0x72ed('0x18')]){return utils[_0x72ed('0x19')](_0x31fbb6,0x0,!![],moment())[_0x72ed('0xb')](function(){return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});});}else{return utils[_0x72ed('0x19')](_0x31fbb6,_0x1f8a51,![],null)[_0x72ed('0xb')](function(){return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});});}}}else{return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});}}else{if(_0x31fbb6[_0x72ed('0x10')]){return _0x23c8e6(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2400d5[_0x72ed('0x18')]>0x0){if(_0x31fbb6['blocked']){if(_0x2400d5[_0x72ed('0x17')]>0x0){if(moment(_0x31fbb6[_0x72ed('0x12')])[_0x72ed('0x1a')](_0x2400d5[_0x72ed('0x17')],'minutes')>moment()){return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});}else{return utils[_0x72ed('0x19')](_0x31fbb6,0x0,![],null)[_0x72ed('0xb')](function(){return utils['getLicense'](_0x31fbb6);})[_0x72ed('0xb')](function(){return _0x23c8e6(null,_0x31fbb6);});}}else{return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});}}else{return utils[_0x72ed('0x19')](_0x31fbb6,0x0,![],null)[_0x72ed('0xb')](function(){return utils[_0x72ed('0x1b')](_0x31fbb6);})[_0x72ed('0xb')](function(){return _0x23c8e6(null,_0x31fbb6);})[_0x72ed('0x1c')](function(_0x5831eb){return _0x23c8e6(null,![],_0x5831eb);});}}else{if(_0x31fbb6[_0x72ed('0x11')]){return _0x23c8e6(null,![],{'message':_0x72ed('0x16')});}else{return utils[_0x72ed('0x1b')](_0x31fbb6)[_0x72ed('0xb')](function(){return _0x23c8e6(null,_0x31fbb6);});}}}});})[_0x72ed('0x1c')](function(_0x50309d){return _0x23c8e6(null,![],_0x50309d);});}function sendServiceMail(_0xfcd1eb){return db[_0x72ed('0x1d')][_0x72ed('0x1e')]({'where':{'service':!![]},'attributes':['id',_0x72ed('0xc'),_0x72ed('0x1f')],'include':[{'model':db[_0x72ed('0x20')],'as':_0x72ed('0x21'),'include':[{'model':db[_0x72ed('0x22')],'as':_0x72ed('0x22')}]}]})[_0x72ed('0xb')](function(_0x1069ea){if(!_0x1069ea){throw new Error(_0x72ed('0x23'));}var _0xba7317=_0x1069ea['getSmtpOptions']();var _0x19bb89={'account':_0xba7317,'message':_[_0x72ed('0x24')]({'from':util[_0x72ed('0x25')]('\x22%s\x22\x20<%s>',_0x1069ea[_0x72ed('0xc')],_0x1069ea[_0x72ed('0x1f')]||_0x1069ea[_0x72ed('0x21')][_0x72ed('0x14')])},_0xfcd1eb)};return client['request'](_0x72ed('0x26'),_0x19bb89);})[_0x72ed('0xb')](function(_0x5d2b90){if(_0x5d2b90[_0x72ed('0x27')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x5d2b90[_0x72ed('0x27')][_0x72ed('0x28')]||JSON['stringify'](_0x5d2b90[_0x72ed('0x27')])));}return!![];});}function handleError(_0x3c5ea1,_0x2e6c76,_0x487dfe){return _0x3c5ea1['status'](_0x2e6c76||0x1f4)[_0x72ed('0x29')]({'message':_0x487dfe?_0x487dfe[_0x72ed('0x28')]||_0x487dfe:''});}exports[_0x72ed('0x2a')]=function(_0x498703,_0x2e40ce,_0x4130cc){passport['authenticate']('local-login',function(_0x28d467,_0x1ce65f,_0x2748f2){var _0x7c746c=_0x28d467||_0x2748f2;if(_0x7c746c){return handleError(_0x2e40ce,0x191,_0x7c746c);}if(!_0x1ce65f){return handleError(_0x2e40ce,0x194,{'message':_0x72ed('0x2b')});}else{var _0x241f4b={'payload':{'id':_0x1ce65f['id'],'role':_0x1ce65f[_0x72ed('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x72ed('0x2c')](_0x241f4b)[_0x72ed('0xb')](function(_0x247947){_0x2e40ce['json']({'id':_0x1ce65f['id'],'token':_0x247947,'statusCall':'','isAlreadyLogged':_0x1ce65f[_0x72ed('0x2d')]});});}})(_0x498703,_0x2e40ce,_0x4130cc);};exports['forgot']=function(_0x597a98,_0x47476e){if(!_0x597a98[_0x72ed('0x2e')][_0x72ed('0x1f')]){return handleError(_0x47476e,0x1f4,{'message':_0x72ed('0x2f')});}var _0x5258c6=rs['generate']();_0x597a98[_0x72ed('0x2e')][_0x72ed('0x1f')]=_0x597a98[_0x72ed('0x2e')]['email'][_0x72ed('0x30')]()[_0x72ed('0x31')]();var _0x484898;return db['Setting'][_0x72ed('0xa')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x72ed('0xb')](function(_0x5093c9){_0x484898=_0x5093c9;return db[_0x72ed('0x32')][_0x72ed('0x1e')]({'where':{'email':_0x597a98[_0x72ed('0x2e')][_0x72ed('0x1f')]}});})[_0x72ed('0xb')](function(_0x50ba8d){if(!_0x50ba8d){throw new Error(_0x72ed('0x33'));}if(_0x50ba8d[_0x72ed('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x50ba8d[_0x72ed('0x11')]){if(moment(_0x50ba8d[_0x72ed('0x12')])['add'](_0x484898['blockDuration'],_0x72ed('0x34'))>moment()){throw new Error(_0x72ed('0x35'));}else{_0x50ba8d['blocked']=![];_0x50ba8d[_0x72ed('0x12')]=null;}}_0x50ba8d[_0x72ed('0x36')]=_0x5258c6;_0x50ba8d['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x50ba8d[_0x72ed('0x37')]();})[_0x72ed('0xb')](function(){return sendServiceMail({'to':_0x597a98[_0x72ed('0x2e')][_0x72ed('0x1f')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x72ed('0x38')+_0x72ed('0x39')+_0x72ed('0x3a')+_0x597a98[_0x72ed('0x3b')]['host']+_0x72ed('0x3c')+_0x5258c6+'\x0a\x0a'+_0x72ed('0x3d')});})['then'](function(){_0x47476e['status'](0xc8)['send']({'message':_0x72ed('0x3e')});})[_0x72ed('0x1c')](function(_0x368a81){return handleError(_0x47476e,0x1f4,_0x368a81);});};exports[_0x72ed('0x3f')]=function(_0x485aca,_0x286ab7){return db[_0x72ed('0x32')]['find']({'where':{'resetPasswordToken':_0x485aca[_0x72ed('0x40')][_0x72ed('0x41')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x72ed('0xb')](function(_0x34e784){if(!_0x34e784){throw new Error(_0x72ed('0x42'));}return db[_0x72ed('0x9')]['findOne']({'attributes':['id',_0x72ed('0x43'),_0x72ed('0x44'),_0x72ed('0x45')]})['then'](function(_0x51ca2c){if(_0x51ca2c[_0x72ed('0x43')])authService['validatePasswordPattern'](_0x485aca[_0x72ed('0x2e')][_0x72ed('0xd')]);if(!_0x51ca2c['enforcePasswordHistory']||!_0x34e784[_0x72ed('0x46')])return _0x34e784;authService[_0x72ed('0x47')](_0x485aca[_0x72ed('0x2e')][_0x72ed('0xd')],_0x34e784[_0x72ed('0x46')],_0x51ca2c[_0x72ed('0x45')]);return _0x34e784;})['then'](function(){_0x34e784[_0x72ed('0xd')]=_0x485aca['body'][_0x72ed('0xd')];_0x34e784[_0x72ed('0x36')]=null;_0x34e784[_0x72ed('0x48')]=null;return _0x34e784[_0x72ed('0x37')]();});})[_0x72ed('0xb')](function(){_0x286ab7[_0x72ed('0x49')](0xc8)[_0x72ed('0x29')]({'message':_0x72ed('0x4a')});})[_0x72ed('0x1c')](function(_0x2f7c46){return handleError(_0x286ab7,0x1f4,_0x2f7c46);});};passport[_0x72ed('0x4b')](_0x72ed('0x4c'),new LocalStrategy({'usernameField':_0x72ed('0xc'),'passwordField':'password'},function(_0x22b6e4,_0x5b3a6e,_0x3be059){return localAuthenticate(db[_0x72ed('0x32')],_0x22b6e4,_0x5b3a6e,_0x3be059);}));
\ No newline at end of file
+var _0xdd13=['Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','previousPasswords','save','Password\x20reset!','passport-local','lodash','randomstring','moment','../../components/auth/service','../../config/utils','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','loginAttempts','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','disabled','add','clearBlockUser','minutes','getLicense','catch','find','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','Smtp','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','trim','toLowerCase','User','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'];(function(_0x206f38,_0x30c97e){var _0x44ac50=function(_0x4366f6){while(--_0x4366f6){_0x206f38['push'](_0x206f38['shift']());}};_0x44ac50(++_0x30c97e);}(_0xdd13,0x19c));var _0x3dd1=function(_0x482dfe,_0x483825){_0x482dfe=_0x482dfe-0x0;var _0x1d06c6=_0xdd13[_0x482dfe];return _0x1d06c6;};'use strict';var util=require('util');var passport=require('passport');var LocalStrategy=require(_0x3dd1('0x0'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x3dd1('0x1'));var rs=require(_0x3dd1('0x2'));var moment=require(_0x3dd1('0x3'));var db=require('../../mysqldb')['db'];var authService=require(_0x3dd1('0x4'));var utils=require(_0x3dd1('0x5'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0x84efd3,_0x2d219f,_0x1e41ef,_0x7a3b48){var _0x42a044,_0x2dd374;return db[_0x3dd1('0x6')][_0x3dd1('0x7')]({'where':{'id':0x1},'attributes':[_0x3dd1('0x8'),_0x3dd1('0x9')],'raw':!![]})[_0x3dd1('0xa')](function(_0x2a7525){_0x42a044=_0x2a7525;return _0x84efd3[_0x3dd1('0x7')]({'attributes':['id',_0x3dd1('0xb'),_0x3dd1('0xc'),_0x3dd1('0xd'),_0x3dd1('0xe'),'disabled',_0x3dd1('0xf'),_0x3dd1('0x10'),_0x3dd1('0x11')],'where':{'name':_0x2d219f,'role':{'$or':['admin',_0x3dd1('0x12'),_0x3dd1('0x13')]}}});})[_0x3dd1('0xa')](function(_0x509c41){if(!_0x509c41||_0x509c41&&_0x509c41[_0x3dd1('0xb')]!==_0x2d219f){throw new Error(_0x3dd1('0x14'));}else{_0x2dd374=_0x509c41;return _0x2dd374;}})['then'](function(){_0x2dd374['authenticate'](_0x1e41ef,function(_0x345cc3,_0x175d3b){var _0x3aa7ee=_0x2dd374[_0x3dd1('0x11')]+0x1;if(_0x345cc3){return _0x7a3b48(_0x345cc3);}else if(!_0x175d3b){if(_0x2dd374[_0x3dd1('0x15')]){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}else if(_0x42a044[_0x3dd1('0x8')]>0x0){if(_0x2dd374[_0x3dd1('0xf')]){if(_0x42a044['blockDuration']>0x0){if(moment(_0x2dd374[_0x3dd1('0x10')])[_0x3dd1('0x16')](_0x42a044['blockDuration'],'minutes')>moment()){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}else{return utils[_0x3dd1('0x17')](_0x2dd374,_0x3aa7ee,![],null)[_0x3dd1('0xa')](function(){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});});}}else{return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}}else{if(_0x3aa7ee>=_0x42a044[_0x3dd1('0x8')]){return utils[_0x3dd1('0x17')](_0x2dd374,0x0,!![],moment())[_0x3dd1('0xa')](function(){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});});}else{return utils[_0x3dd1('0x17')](_0x2dd374,_0x3aa7ee,![],null)[_0x3dd1('0xa')](function(){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});});}}}else{return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}}else{if(_0x2dd374[_0x3dd1('0x15')]){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}else if(_0x42a044[_0x3dd1('0x8')]>0x0){if(_0x2dd374[_0x3dd1('0xf')]){if(_0x42a044[_0x3dd1('0x9')]>0x0){if(moment(_0x2dd374[_0x3dd1('0x10')])[_0x3dd1('0x16')](_0x42a044['blockDuration'],_0x3dd1('0x18'))>moment()){return _0x7a3b48(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x3dd1('0x17')](_0x2dd374,0x0,![],null)['then'](function(){return utils[_0x3dd1('0x19')](_0x2dd374);})[_0x3dd1('0xa')](function(){return _0x7a3b48(null,_0x2dd374);});}}else{return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}}else{return utils[_0x3dd1('0x17')](_0x2dd374,0x0,![],null)[_0x3dd1('0xa')](function(){return utils[_0x3dd1('0x19')](_0x2dd374);})[_0x3dd1('0xa')](function(){return _0x7a3b48(null,_0x2dd374);})[_0x3dd1('0x1a')](function(_0x5d92d2){return _0x7a3b48(null,![],_0x5d92d2);});}}else{if(_0x2dd374['blocked']){return _0x7a3b48(null,![],{'message':_0x3dd1('0x14')});}else{return utils[_0x3dd1('0x19')](_0x2dd374)[_0x3dd1('0xa')](function(){return _0x7a3b48(null,_0x2dd374);});}}}});})[_0x3dd1('0x1a')](function(_0x946d50){return _0x7a3b48(null,![],_0x946d50);});}function sendServiceMail(_0x40271b){return db['MailAccount'][_0x3dd1('0x1b')]({'where':{'service':!![]},'attributes':['id',_0x3dd1('0xb'),_0x3dd1('0x1c')],'include':[{'model':db[_0x3dd1('0x1d')],'as':'Smtp','include':[{'model':db[_0x3dd1('0x1e')],'as':_0x3dd1('0x1e')}]}]})['then'](function(_0x5c1cd9){if(!_0x5c1cd9){throw new Error(_0x3dd1('0x1f'));}var _0x597c33=_0x5c1cd9[_0x3dd1('0x20')]();var _0x3c1580={'account':_0x597c33,'message':_[_0x3dd1('0x21')]({'from':util[_0x3dd1('0x22')]('\x22%s\x22\x20<%s>',_0x5c1cd9[_0x3dd1('0xb')],_0x5c1cd9[_0x3dd1('0x1c')]||_0x5c1cd9[_0x3dd1('0x23')][_0x3dd1('0x12')])},_0x40271b)};return client['request'](_0x3dd1('0x24'),_0x3c1580);})[_0x3dd1('0xa')](function(_0x2c707a){if(_0x2c707a[_0x3dd1('0x25')]){throw new Error(util[_0x3dd1('0x22')](_0x3dd1('0x26'),_0x2c707a[_0x3dd1('0x25')][_0x3dd1('0x27')]||JSON[_0x3dd1('0x28')](_0x2c707a[_0x3dd1('0x25')])));}return!![];});}function handleError(_0x17c92a,_0x459c65,_0x52601f){return _0x17c92a[_0x3dd1('0x29')](_0x459c65||0x1f4)[_0x3dd1('0x2a')]({'message':_0x52601f?_0x52601f[_0x3dd1('0x27')]||_0x52601f:''});}exports[_0x3dd1('0x2b')]=function(_0x479dab,_0x18e73d,_0x25deeb){passport[_0x3dd1('0x2c')](_0x3dd1('0x2d'),function(_0x3fbf26,_0x4cc300,_0x53865d){var _0x249b94=_0x3fbf26||_0x53865d;if(_0x249b94){return handleError(_0x18e73d,0x191,_0x249b94);}if(!_0x4cc300){return handleError(_0x18e73d,0x194,{'message':_0x3dd1('0x2e')});}else{var _0xc9d778={'payload':{'id':_0x4cc300['id'],'role':_0x4cc300[_0x3dd1('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0x3dd1('0x2f')](_0xc9d778)[_0x3dd1('0xa')](function(_0x210a91){_0x18e73d[_0x3dd1('0x30')]({'id':_0x4cc300['id'],'token':_0x210a91,'statusCall':'','isAlreadyLogged':_0x4cc300[_0x3dd1('0x31')]});});}})(_0x479dab,_0x18e73d,_0x25deeb);};exports[_0x3dd1('0x32')]=function(_0x466c97,_0x5900e3){if(!_0x466c97['body'][_0x3dd1('0x1c')]){return handleError(_0x5900e3,0x1f4,{'message':_0x3dd1('0x33')});}var _0x537c9e=rs[_0x3dd1('0x34')]();_0x466c97[_0x3dd1('0x35')]['email']=_0x466c97['body'][_0x3dd1('0x1c')][_0x3dd1('0x36')]()[_0x3dd1('0x37')]();var _0x555083;return db[_0x3dd1('0x6')]['findOne']({'where':{'id':0x1},'attributes':[_0x3dd1('0x8'),'blockDuration'],'raw':!![]})[_0x3dd1('0xa')](function(_0x19f538){_0x555083=_0x19f538;return db[_0x3dd1('0x38')][_0x3dd1('0x1b')]({'where':{'email':_0x466c97[_0x3dd1('0x35')][_0x3dd1('0x1c')]}});})[_0x3dd1('0xa')](function(_0x4cb4e8){if(!_0x4cb4e8){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x4cb4e8[_0x3dd1('0x15')]){throw new Error(_0x3dd1('0x39'));}if(_0x4cb4e8['blocked']){if(moment(_0x4cb4e8[_0x3dd1('0x10')])[_0x3dd1('0x16')](_0x555083['blockDuration'],_0x3dd1('0x18'))>moment()){throw new Error(_0x3dd1('0x3a'));}else{_0x4cb4e8[_0x3dd1('0xf')]=![];_0x4cb4e8['blockedAt']=null;}}_0x4cb4e8[_0x3dd1('0x3b')]=_0x537c9e;_0x4cb4e8[_0x3dd1('0x3c')]=Date[_0x3dd1('0x3d')]()+0x36ee80;return _0x4cb4e8['save']();})['then'](function(){return sendServiceMail({'to':_0x466c97[_0x3dd1('0x35')][_0x3dd1('0x1c')],'subject':_0x3dd1('0x3e'),'text':_0x3dd1('0x3f')+_0x3dd1('0x40')+'https://'+_0x466c97[_0x3dd1('0x41')]['host']+_0x3dd1('0x42')+_0x537c9e+'\x0a\x0a'+_0x3dd1('0x43')});})[_0x3dd1('0xa')](function(){_0x5900e3[_0x3dd1('0x29')](0xc8)[_0x3dd1('0x2a')]({'message':_0x3dd1('0x44')});})[_0x3dd1('0x1a')](function(_0x43d834){return handleError(_0x5900e3,0x1f4,_0x43d834);});};exports[_0x3dd1('0x45')]=function(_0x2af24d,_0x363261){return db[_0x3dd1('0x38')][_0x3dd1('0x1b')]({'where':{'resetPasswordToken':_0x2af24d[_0x3dd1('0x46')][_0x3dd1('0x47')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x3dd1('0xa')](function(_0x2c896d){if(!_0x2c896d){throw new Error(_0x3dd1('0x48'));}return db['Setting'][_0x3dd1('0x7')]({'attributes':['id',_0x3dd1('0x49'),_0x3dd1('0x4a'),_0x3dd1('0x4b')]})[_0x3dd1('0xa')](function(_0x26e8e3){if(_0x26e8e3[_0x3dd1('0x49')])authService['validatePasswordPattern'](_0x2af24d[_0x3dd1('0x35')][_0x3dd1('0xc')]);if(!_0x26e8e3[_0x3dd1('0x4a')]||!_0x2c896d['previousPasswords'])return _0x2c896d;authService[_0x3dd1('0x4c')](_0x2af24d['body']['password'],_0x2c896d[_0x3dd1('0x4d')],_0x26e8e3[_0x3dd1('0x4b')]);return _0x2c896d;})['then'](function(){_0x2c896d['password']=_0x2af24d['body'][_0x3dd1('0xc')];_0x2c896d[_0x3dd1('0x3b')]=null;_0x2c896d['resetPasswordExpires']=null;return _0x2c896d[_0x3dd1('0x4e')]();});})[_0x3dd1('0xa')](function(){_0x363261[_0x3dd1('0x29')](0xc8)['send']({'message':_0x3dd1('0x4f')});})[_0x3dd1('0x1a')](function(_0x3c95ad){return handleError(_0x363261,0x1f4,_0x3c95ad);});};passport['use'](_0x3dd1('0x2d'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x505124,_0x465585,_0x215166){return localAuthenticate(db[_0x3dd1('0x38')],_0x505124,_0x465585,_0x215166);}));
\ No newline at end of file
index 907695d..5772391 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6543=['./authLocal.controller','post','login','forgot','reset','Router'];(function(_0x24e6ce,_0x4c63ee){var _0x546c65=function(_0x4052af){while(--_0x4052af){_0x24e6ce['push'](_0x24e6ce['shift']());}};_0x546c65(++_0x4c63ee);}(_0x6543,0x1b5));var _0x3654=function(_0xb04126,_0x35f5c7){_0xb04126=_0xb04126-0x0;var _0x2a4e47=_0x6543[_0xb04126];return _0x2a4e47;};'use strict';var express=require('express');var router=express[_0x3654('0x0')]();var controller=require(_0x3654('0x1'));router[_0x3654('0x2')]('/',controller[_0x3654('0x3')]);router[_0x3654('0x2')]('/forgot',controller[_0x3654('0x4')]);router[_0x3654('0x2')]('/reset/:token',controller[_0x3654('0x5')]);module['exports']=router;
\ No newline at end of file
+var _0xc7c7=['post','/forgot','forgot','reset','express','Router','./authLocal.controller'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc7c7,0xc8));var _0x7c7c=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0xc7c7[_0x6a0266];return _0x309e00;};'use strict';var express=require(_0x7c7c('0x0'));var router=express[_0x7c7c('0x1')]();var controller=require(_0x7c7c('0x2'));router[_0x7c7c('0x3')]('/',controller['login']);router['post'](_0x7c7c('0x4'),controller[_0x7c7c('0x5')]);router[_0x7c7c('0x3')]('/reset/:token',controller[_0x7c7c('0x6')]);module['exports']=router;
\ No newline at end of file
index 2531f63..a13879d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xad3a=['STRING','sequelize'];(function(_0x47d139,_0x5a465a){var _0x123b20=function(_0x4d30bf){while(--_0x4d30bf){_0x47d139['push'](_0x47d139['shift']());}};_0x123b20(++_0x5a465a);}(_0xad3a,0xe5));var _0xaad3=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0xad3a[_0x18cd5b];return _0x5eaa52;};'use strict';var Sequelize=require(_0xaad3('0x0'));module['exports']={'name':{'type':Sequelize[_0xaad3('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xaad3('0x1')]},'description':{'type':Sequelize[_0xaad3('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}};
\ No newline at end of file
+var _0xd1f6=['INTEGER','STRING','BOOLEAN'];(function(_0x466e89,_0x237ae3){var _0x580986=function(_0x1ca46d){while(--_0x1ca46d){_0x466e89['push'](_0x466e89['shift']());}};_0x580986(++_0x237ae3);}(_0xd1f6,0xb2));var _0x6d1f=function(_0x5743ab,_0x2ef6e0){_0x5743ab=_0x5743ab-0x0;var _0x2ad0a8=_0xd1f6[_0x5743ab];return _0x2ad0a8;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6d1f('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x6d1f('0x0')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x6d1f('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x6d1f('0x2')],'defaultValue':0xa}};
\ No newline at end of file
index 47fe7a2..e70d036 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6dcf=['hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions','order','addActions','Action','getActions','findOne','rimraf','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','update','destroy','then','error','name','send','index','map','Automation','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length'];(function(_0x4a0115,_0x4a94c3){var _0x4dd66b=function(_0x16987d){while(--_0x16987d){_0x4a0115['push'](_0x4a0115['shift']());}};_0x4dd66b(++_0x4a94c3);}(_0x6dcf,0x1c1));var _0xf6dc=function(_0x22b2df,_0x59214b){_0x22b2df=_0x22b2df-0x0;var _0x3ddde7=_0x6dcf[_0x22b2df];return _0x3ddde7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf6dc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf6dc('0x1'));var moment=require('moment');var BPromise=require(_0xf6dc('0x2'));var Mustache=require(_0xf6dc('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf6dc('0x4'));var csv=require(_0xf6dc('0x5'));var ejs=require(_0xf6dc('0x6'));var fs=require('fs');var fs_extra=require(_0xf6dc('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf6dc('0x8'));var jsforce=require(_0xf6dc('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xf6dc('0x5'));var querystring=require(_0xf6dc('0xa'));var Papa=require(_0xf6dc('0xb'));var Redis=require(_0xf6dc('0xc'));var authService=require(_0xf6dc('0xd'));var qs=require(_0xf6dc('0xe'));var as=require(_0xf6dc('0xf'));var hardwareService=require(_0xf6dc('0x10'));var logger=require(_0xf6dc('0x11'))(_0xf6dc('0x12'));var utils=require(_0xf6dc('0x13'));var config=require(_0xf6dc('0x14'));var licenseUtil=require(_0xf6dc('0x15'));var db=require(_0xf6dc('0x16'))['db'];function respondWithStatusCode(_0x35f0bc,_0xcc182b){_0xcc182b=_0xcc182b||0xcc;return function(_0x36855d){if(_0x36855d){return _0x35f0bc[_0xf6dc('0x17')](_0xcc182b);}return _0x35f0bc[_0xf6dc('0x18')](_0xcc182b)[_0xf6dc('0x19')]();};}function respondWithResult(_0x1f1e79,_0x45139b){_0x45139b=_0x45139b||0xc8;return function(_0x1e0e28){if(_0x1e0e28){return _0x1f1e79[_0xf6dc('0x18')](_0x45139b)['json'](_0x1e0e28);}};}function respondWithFilteredResult(_0x5189eb,_0x4f2675){return function(_0x4fab66){if(_0x4fab66){var _0x17ce28=typeof _0x4f2675[_0xf6dc('0x1a')]==='undefined'&&typeof _0x4f2675[_0xf6dc('0x1b')]===_0xf6dc('0x1c');var _0xae8711=_0x4fab66['count'];var _0x5a9992=_0x17ce28?0x0:_0x4f2675[_0xf6dc('0x1a')];var _0x5ec2c0=_0x17ce28?_0x4fab66[_0xf6dc('0x1d')]:_0x4f2675[_0xf6dc('0x1a')]+_0x4f2675[_0xf6dc('0x1b')];var _0x55ab83;if(_0x5ec2c0>=_0xae8711){_0x5ec2c0=_0xae8711;_0x55ab83=0xc8;}else{_0x55ab83=0xce;}_0x5189eb['status'](_0x55ab83);return _0x5189eb[_0xf6dc('0x1e')](_0xf6dc('0x1f'),_0x5a9992+'-'+_0x5ec2c0+'/'+_0xae8711)[_0xf6dc('0x20')](_0x4fab66);}return null;};}function patchUpdates(_0x2667d6){return function(_0x2c8bd8){try{jsonpatch[_0xf6dc('0x21')](_0x2c8bd8,_0x2667d6,!![]);}catch(_0x3055da){return BPromise[_0xf6dc('0x22')](_0x3055da);}return _0x2c8bd8['save']();};}function saveUpdates(_0x315ac2,_0x4423e9){return function(_0x453cb4){if(_0x453cb4){return _0x453cb4[_0xf6dc('0x23')](_0x315ac2)['then'](function(_0x604840){return _0x604840;});}return null;};}function removeEntity(_0x4faab0,_0x315a8e){return function(_0x42113c){if(_0x42113c){return _0x42113c[_0xf6dc('0x24')]()[_0xf6dc('0x25')](function(){_0x4faab0[_0xf6dc('0x18')](0xcc)[_0xf6dc('0x19')]();});}};}function handleEntityNotFound(_0x278f7e,_0x2fc5f4){return function(_0x3bcb65){if(!_0x3bcb65){_0x278f7e[_0xf6dc('0x17')](0x194);}return _0x3bcb65;};}function handleError(_0x467c93,_0x1efdd8){_0x1efdd8=_0x1efdd8||0x1f4;return function(_0x4d7a07){logger[_0xf6dc('0x26')](_0x4d7a07['stack']);if(_0x4d7a07[_0xf6dc('0x27')]){delete _0x4d7a07[_0xf6dc('0x27')];}_0x467c93['status'](_0x1efdd8)[_0xf6dc('0x28')](_0x4d7a07);};}exports[_0xf6dc('0x29')]=function(_0x48546b,_0x56e27c){var _0x40800e={},_0x3fe3b0={},_0x1b1986={'count':0x0,'rows':[]};var _0x167a85=_[_0xf6dc('0x2a')](db[_0xf6dc('0x2b')][_0xf6dc('0x2c')],function(_0x287d5e){return{'name':_0x287d5e[_0xf6dc('0x2d')],'type':_0x287d5e['type'][_0xf6dc('0x2e')]};});_0x3fe3b0[_0xf6dc('0x2f')]=_[_0xf6dc('0x2a')](_0x167a85,_0xf6dc('0x27'));_0x3fe3b0[_0xf6dc('0x30')]=_[_0xf6dc('0x31')](_0x48546b[_0xf6dc('0x30')]);_0x3fe3b0[_0xf6dc('0x32')]=_[_0xf6dc('0x33')](_0x3fe3b0['model'],_0x3fe3b0[_0xf6dc('0x30')]);_0x40800e['attributes']=_[_0xf6dc('0x33')](_0x3fe3b0[_0xf6dc('0x2f')],qs[_0xf6dc('0x34')](_0x48546b[_0xf6dc('0x30')][_0xf6dc('0x34')]));_0x40800e['attributes']=_0x40800e[_0xf6dc('0x35')][_0xf6dc('0x36')]?_0x40800e[_0xf6dc('0x35')]:_0x3fe3b0[_0xf6dc('0x2f')];if(!_0x48546b[_0xf6dc('0x30')][_0xf6dc('0x37')](_0xf6dc('0x38'))){_0x40800e[_0xf6dc('0x1b')]=qs[_0xf6dc('0x1b')](_0x48546b[_0xf6dc('0x30')][_0xf6dc('0x1b')]);_0x40800e['offset']=qs[_0xf6dc('0x1a')](_0x48546b['query']['offset']);}_0x40800e['order']=qs['sort'](_0x48546b[_0xf6dc('0x30')][_0xf6dc('0x39')]);_0x40800e['where']=qs['filters'](_[_0xf6dc('0x3a')](_0x48546b['query'],_0x3fe3b0[_0xf6dc('0x32')]),_0x167a85);if(_0x48546b['query'][_0xf6dc('0x3b')]){_0x40800e[_0xf6dc('0x3c')]=_[_0xf6dc('0x3d')](_0x40800e[_0xf6dc('0x3c')],{'$or':_[_0xf6dc('0x2a')](_0x167a85,function(_0x442a07){if(_0x442a07['type']!==_0xf6dc('0x3e')){var _0x469a32={};_0x469a32[_0x442a07['name']]={'$like':'%'+_0x48546b[_0xf6dc('0x30')]['filter']+'%'};return _0x469a32;}})});}_0x40800e=_['merge']({},_0x40800e,_0x48546b[_0xf6dc('0x3f')]);var _0x436dea={'where':_0x40800e['where']};return db['Automation']['count'](_0x436dea)[_0xf6dc('0x25')](function(_0x234957){_0x1b1986['count']=_0x234957;if(_0x48546b['query'][_0xf6dc('0x40')]){_0x40800e[_0xf6dc('0x41')]=[{'all':!![]}];}return db[_0xf6dc('0x2b')][_0xf6dc('0x42')](_0x40800e);})[_0xf6dc('0x25')](function(_0x1101f1){_0x1b1986[_0xf6dc('0x43')]=_0x1101f1;return _0x1b1986;})['then'](respondWithFilteredResult(_0x56e27c,_0x40800e))[_0xf6dc('0x44')](handleError(_0x56e27c,null));};exports[_0xf6dc('0x45')]=function(_0x26f4e4,_0x2b3c21){var _0x4be893={'raw':![],'where':{'id':_0x26f4e4[_0xf6dc('0x46')]['id']}},_0x27e454={};_0x27e454['model']=_['keys'](db[_0xf6dc('0x2b')][_0xf6dc('0x2c')]);_0x27e454[_0xf6dc('0x30')]=_[_0xf6dc('0x31')](_0x26f4e4[_0xf6dc('0x30')]);_0x27e454[_0xf6dc('0x32')]=_['intersection'](_0x27e454[_0xf6dc('0x2f')],_0x27e454[_0xf6dc('0x30')]);_0x4be893[_0xf6dc('0x35')]=_[_0xf6dc('0x33')](_0x27e454['model'],qs[_0xf6dc('0x34')](_0x26f4e4[_0xf6dc('0x30')]['fields']));_0x4be893['attributes']=_0x4be893[_0xf6dc('0x35')][_0xf6dc('0x36')]?_0x4be893[_0xf6dc('0x35')]:_0x27e454['model'];if(_0x26f4e4[_0xf6dc('0x30')][_0xf6dc('0x40')]){_0x4be893[_0xf6dc('0x41')]=[{'all':!![]}];}_0x4be893=_[_0xf6dc('0x3d')]({},_0x4be893,_0x26f4e4[_0xf6dc('0x3f')]);return db[_0xf6dc('0x2b')][_0xf6dc('0x47')](_0x4be893)['then'](handleEntityNotFound(_0x2b3c21,null))[_0xf6dc('0x25')](respondWithResult(_0x2b3c21,null))[_0xf6dc('0x44')](handleError(_0x2b3c21,null));};exports[_0xf6dc('0x48')]=function(_0x11ab99,_0x4d0a08){return db[_0xf6dc('0x2b')]['create'](_0x11ab99[_0xf6dc('0x49')],{})['then'](respondWithResult(_0x4d0a08,0xc9))[_0xf6dc('0x44')](handleError(_0x4d0a08,null));};exports[_0xf6dc('0x23')]=function(_0x527071,_0x579813){if(_0x527071[_0xf6dc('0x49')]['id']){delete _0x527071[_0xf6dc('0x49')]['id'];}return db[_0xf6dc('0x2b')][_0xf6dc('0x47')]({'where':{'id':_0x527071[_0xf6dc('0x46')]['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x579813,null))[_0xf6dc('0x25')](saveUpdates(_0x527071[_0xf6dc('0x49')],null))[_0xf6dc('0x25')](respondWithResult(_0x579813,null))[_0xf6dc('0x44')](handleError(_0x579813,null));};exports[_0xf6dc('0x24')]=function(_0x36f088,_0x32e0ed){return db[_0xf6dc('0x2b')][_0xf6dc('0x47')]({'where':{'id':_0x36f088[_0xf6dc('0x46')]['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x32e0ed,null))['then'](removeEntity(_0x32e0ed,null))[_0xf6dc('0x44')](handleError(_0x32e0ed,null));};exports[_0xf6dc('0x4a')]=function(_0xdda2f7,_0x4a2b71,_0x197def){return db[_0xf6dc('0x4b')]['find']({'where':{'id':_0xdda2f7[_0xf6dc('0x46')]['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x4a2b71,null))[_0xf6dc('0x25')](function(_0x76922){if(_0x76922){return _0x76922[_0xf6dc('0x4a')](_0xdda2f7[_0xf6dc('0x49')][_0xf6dc('0x4c')],_[_0xf6dc('0x4d')](_0xdda2f7[_0xf6dc('0x49')],['ids','id'])||{});}})[_0xf6dc('0x25')](respondWithResult(_0x4a2b71,null))[_0xf6dc('0x44')](handleError(_0x4a2b71,null));};exports[_0xf6dc('0x4e')]=function(_0x37a72b,_0x150dad,_0x26bf0b){var _0x1adaed={};var _0x4b4901={};var _0x60794a;var _0xad3646;return db['Automation']['findOne']({'where':{'id':_0x37a72b[_0xf6dc('0x46')]['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x150dad,null))[_0xf6dc('0x25')](function(_0x5d84ed){if(_0x5d84ed){_0x60794a=_0x5d84ed;_0x4b4901[_0xf6dc('0x2f')]=_[_0xf6dc('0x31')](db['Condition'][_0xf6dc('0x2c')]);_0x4b4901[_0xf6dc('0x30')]=_['keys'](_0x37a72b['query']);_0x4b4901[_0xf6dc('0x32')]=_['intersection'](_0x4b4901[_0xf6dc('0x2f')],_0x4b4901[_0xf6dc('0x30')]);_0x1adaed[_0xf6dc('0x35')]=_[_0xf6dc('0x33')](_0x4b4901['model'],qs[_0xf6dc('0x34')](_0x37a72b[_0xf6dc('0x30')][_0xf6dc('0x34')]));_0x1adaed[_0xf6dc('0x35')]=_0x1adaed[_0xf6dc('0x35')][_0xf6dc('0x36')]?_0x1adaed[_0xf6dc('0x35')]:_0x4b4901['model'];_0x1adaed[_0xf6dc('0x4f')]=qs[_0xf6dc('0x39')](_0x37a72b['query'][_0xf6dc('0x39')]);_0x1adaed[_0xf6dc('0x3c')]=qs[_0xf6dc('0x32')](_['pick'](_0x37a72b[_0xf6dc('0x30')],_0x4b4901[_0xf6dc('0x32')]));if(_0x37a72b[_0xf6dc('0x30')]['filter']){_0x1adaed['where']=_[_0xf6dc('0x3d')](_0x1adaed['where'],{'$or':_[_0xf6dc('0x2a')](_0x1adaed[_0xf6dc('0x35')],function(_0x164695){var _0x271bbb={};_0x271bbb[_0x164695]={'$like':'%'+_0x37a72b['query'][_0xf6dc('0x3b')]+'%'};return _0x271bbb;})});}_0x1adaed=_['merge']({},_0x1adaed,_0x37a72b[_0xf6dc('0x3f')]);return _0x60794a[_0xf6dc('0x4e')](_0x1adaed);}})[_0xf6dc('0x25')](function(_0x46a3a6){if(_0x46a3a6){_0xad3646=_0x46a3a6[_0xf6dc('0x36')];if(!_0x37a72b[_0xf6dc('0x30')]['hasOwnProperty']('nolimit')){_0x1adaed[_0xf6dc('0x1b')]=qs[_0xf6dc('0x1b')](_0x37a72b['query'][_0xf6dc('0x1b')]);_0x1adaed[_0xf6dc('0x1a')]=qs[_0xf6dc('0x1a')](_0x37a72b['query']['offset']);}return _0x60794a['getConditions'](_0x1adaed);}})['then'](function(_0x39d648){if(_0x39d648){return _0x39d648?{'count':_0xad3646,'rows':_0x39d648}:null;}})[_0xf6dc('0x25')](respondWithResult(_0x150dad,null))[_0xf6dc('0x44')](handleError(_0x150dad,null));};exports[_0xf6dc('0x50')]=function(_0x3d0499,_0x157624,_0x3ef9df){return db[_0xf6dc('0x51')][_0xf6dc('0x47')]({'where':{'id':_0x3d0499[_0xf6dc('0x46')]['id']}})['then'](handleEntityNotFound(_0x157624,null))[_0xf6dc('0x25')](function(_0xc4aad8){if(_0xc4aad8){return _0xc4aad8[_0xf6dc('0x50')](_0x3d0499[_0xf6dc('0x49')][_0xf6dc('0x4c')],_[_0xf6dc('0x4d')](_0x3d0499[_0xf6dc('0x49')],[_0xf6dc('0x4c'),'id'])||{});}})[_0xf6dc('0x25')](respondWithResult(_0x157624,null))[_0xf6dc('0x44')](handleError(_0x157624,null));};exports[_0xf6dc('0x52')]=function(_0x2caf92,_0x770c82,_0x1ed328){var _0x2822ee={};var _0x14f987={};var _0x4edaef;var _0x2fb378;return db['Automation'][_0xf6dc('0x53')]({'where':{'id':_0x2caf92['params']['id']}})[_0xf6dc('0x25')](handleEntityNotFound(_0x770c82,null))[_0xf6dc('0x25')](function(_0x2de076){if(_0x2de076){_0x4edaef=_0x2de076;_0x14f987['model']=_['keys'](db[_0xf6dc('0x51')][_0xf6dc('0x2c')]);_0x14f987[_0xf6dc('0x30')]=_[_0xf6dc('0x31')](_0x2caf92[_0xf6dc('0x30')]);_0x14f987[_0xf6dc('0x32')]=_[_0xf6dc('0x33')](_0x14f987[_0xf6dc('0x2f')],_0x14f987['query']);_0x2822ee[_0xf6dc('0x35')]=_[_0xf6dc('0x33')](_0x14f987[_0xf6dc('0x2f')],qs[_0xf6dc('0x34')](_0x2caf92[_0xf6dc('0x30')]['fields']));_0x2822ee[_0xf6dc('0x35')]=_0x2822ee[_0xf6dc('0x35')][_0xf6dc('0x36')]?_0x2822ee[_0xf6dc('0x35')]:_0x14f987[_0xf6dc('0x2f')];_0x2822ee[_0xf6dc('0x4f')]=qs[_0xf6dc('0x39')](_0x2caf92[_0xf6dc('0x30')][_0xf6dc('0x39')]);_0x2822ee['where']=qs[_0xf6dc('0x32')](_[_0xf6dc('0x3a')](_0x2caf92['query'],_0x14f987[_0xf6dc('0x32')]));if(_0x2caf92['query'][_0xf6dc('0x3b')]){_0x2822ee[_0xf6dc('0x3c')]=_[_0xf6dc('0x3d')](_0x2822ee['where'],{'$or':_['map'](_0x2822ee[_0xf6dc('0x35')],function(_0x5cfe2c){var _0x3dc405={};_0x3dc405[_0x5cfe2c]={'$like':'%'+_0x2caf92[_0xf6dc('0x30')]['filter']+'%'};return _0x3dc405;})});}_0x2822ee=_[_0xf6dc('0x3d')]({},_0x2822ee,_0x2caf92[_0xf6dc('0x3f')]);return _0x4edaef[_0xf6dc('0x52')](_0x2822ee);}})['then'](function(_0x6219b4){if(_0x6219b4){_0x2fb378=_0x6219b4[_0xf6dc('0x36')];if(!_0x2caf92['query'][_0xf6dc('0x37')](_0xf6dc('0x38'))){_0x2822ee[_0xf6dc('0x1b')]=qs[_0xf6dc('0x1b')](_0x2caf92[_0xf6dc('0x30')][_0xf6dc('0x1b')]);_0x2822ee[_0xf6dc('0x1a')]=qs['offset'](_0x2caf92['query'][_0xf6dc('0x1a')]);}return _0x4edaef[_0xf6dc('0x52')](_0x2822ee);}})[_0xf6dc('0x25')](function(_0xc0495b){if(_0xc0495b){return _0xc0495b?{'count':_0x2fb378,'rows':_0xc0495b}:null;}})[_0xf6dc('0x25')](respondWithResult(_0x770c82,null))[_0xf6dc('0x44')](handleError(_0x770c82,null));};
\ No newline at end of file
+var _0x792e=['fs-extra','lodash','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','include','findAll','rows','catch','params','includeAll','merge','options','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','filter','Action','addActions','getActions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x428820,_0x2e771b){var _0x4b7c95=function(_0x9859a5){while(--_0x9859a5){_0x428820['push'](_0x428820['shift']());}};_0x4b7c95(++_0x2e771b);}(_0x792e,0x1dc));var _0xe792=function(_0xde62ef,_0x4e65d8){_0xde62ef=_0xde62ef-0x0;var _0x37c24e=_0x792e[_0xde62ef];return _0x37c24e;};'use strict';var emlformat=require(_0xe792('0x0'));var rimraf=require(_0xe792('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe792('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe792('0x3'));var Mustache=require(_0xe792('0x4'));var util=require(_0xe792('0x5'));var path=require(_0xe792('0x6'));var sox=require(_0xe792('0x7'));var csv=require(_0xe792('0x8'));var ejs=require(_0xe792('0x9'));var fs=require('fs');var fs_extra=require(_0xe792('0xa'));var _=require(_0xe792('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe792('0xc'));var deskjs=require(_0xe792('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe792('0xe'));var authService=require(_0xe792('0xf'));var qs=require(_0xe792('0x10'));var as=require(_0xe792('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe792('0x12'));var utils=require(_0xe792('0x13'));var config=require(_0xe792('0x14'));var licenseUtil=require(_0xe792('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fb65f,_0x1a157b){_0x1a157b=_0x1a157b||0xcc;return function(_0xbcad2b){if(_0xbcad2b){return _0x1fb65f[_0xe792('0x16')](_0x1a157b);}return _0x1fb65f[_0xe792('0x17')](_0x1a157b)[_0xe792('0x18')]();};}function respondWithResult(_0x2698d4,_0x1ff26e){_0x1ff26e=_0x1ff26e||0xc8;return function(_0x546cd6){if(_0x546cd6){return _0x2698d4[_0xe792('0x17')](_0x1ff26e)[_0xe792('0x19')](_0x546cd6);}};}function respondWithFilteredResult(_0xe74ee1,_0x2c92dc){return function(_0x1b22c){if(_0x1b22c){var _0x35655a=typeof _0x2c92dc[_0xe792('0x1a')]===_0xe792('0x1b')&&typeof _0x2c92dc[_0xe792('0x1c')]===_0xe792('0x1b');var _0x373c8d=_0x1b22c[_0xe792('0x1d')];var _0x5c67c=_0x35655a?0x0:_0x2c92dc[_0xe792('0x1a')];var _0x1acad7=_0x35655a?_0x1b22c['count']:_0x2c92dc[_0xe792('0x1a')]+_0x2c92dc[_0xe792('0x1c')];var _0x2b1dce;if(_0x1acad7>=_0x373c8d){_0x1acad7=_0x373c8d;_0x2b1dce=0xc8;}else{_0x2b1dce=0xce;}_0xe74ee1[_0xe792('0x17')](_0x2b1dce);return _0xe74ee1['set'](_0xe792('0x1e'),_0x5c67c+'-'+_0x1acad7+'/'+_0x373c8d)[_0xe792('0x19')](_0x1b22c);}return null;};}function patchUpdates(_0x3727b1){return function(_0x533a8d){try{jsonpatch['apply'](_0x533a8d,_0x3727b1,!![]);}catch(_0x43bebd){return BPromise['reject'](_0x43bebd);}return _0x533a8d[_0xe792('0x1f')]();};}function saveUpdates(_0x5efaeb,_0x4270c7){return function(_0x3dc652){if(_0x3dc652){return _0x3dc652['update'](_0x5efaeb)[_0xe792('0x20')](function(_0xa40533){return _0xa40533;});}return null;};}function removeEntity(_0x2aede1,_0xeebc0e){return function(_0x4066c7){if(_0x4066c7){return _0x4066c7[_0xe792('0x21')]()[_0xe792('0x20')](function(){_0x2aede1[_0xe792('0x17')](0xcc)[_0xe792('0x18')]();});}};}function handleEntityNotFound(_0x4393f3,_0x489ed0){return function(_0x31251f){if(!_0x31251f){_0x4393f3[_0xe792('0x16')](0x194);}return _0x31251f;};}function handleError(_0x240fe7,_0x28bd34){_0x28bd34=_0x28bd34||0x1f4;return function(_0x1877ff){logger[_0xe792('0x22')](_0x1877ff[_0xe792('0x23')]);if(_0x1877ff[_0xe792('0x24')]){delete _0x1877ff['name'];}_0x240fe7['status'](_0x28bd34)[_0xe792('0x25')](_0x1877ff);};}exports[_0xe792('0x26')]=function(_0x1782d6,_0x31409c){var _0x344a61={},_0x5be9d3={},_0x27af07={'count':0x0,'rows':[]};var _0x1a6fbf=_[_0xe792('0x27')](db[_0xe792('0x28')][_0xe792('0x29')],function(_0x2c1d3c){return{'name':_0x2c1d3c[_0xe792('0x2a')],'type':_0x2c1d3c[_0xe792('0x2b')][_0xe792('0x2c')]};});_0x5be9d3[_0xe792('0x2d')]=_[_0xe792('0x27')](_0x1a6fbf,_0xe792('0x24'));_0x5be9d3['query']=_[_0xe792('0x2e')](_0x1782d6[_0xe792('0x2f')]);_0x5be9d3[_0xe792('0x30')]=_[_0xe792('0x31')](_0x5be9d3[_0xe792('0x2d')],_0x5be9d3[_0xe792('0x2f')]);_0x344a61['attributes']=_[_0xe792('0x31')](_0x5be9d3[_0xe792('0x2d')],qs[_0xe792('0x32')](_0x1782d6[_0xe792('0x2f')][_0xe792('0x32')]));_0x344a61[_0xe792('0x33')]=_0x344a61[_0xe792('0x33')][_0xe792('0x34')]?_0x344a61[_0xe792('0x33')]:_0x5be9d3['model'];if(!_0x1782d6[_0xe792('0x2f')][_0xe792('0x35')](_0xe792('0x36'))){_0x344a61['limit']=qs[_0xe792('0x1c')](_0x1782d6[_0xe792('0x2f')][_0xe792('0x1c')]);_0x344a61[_0xe792('0x1a')]=qs[_0xe792('0x1a')](_0x1782d6[_0xe792('0x2f')][_0xe792('0x1a')]);}_0x344a61[_0xe792('0x37')]=qs[_0xe792('0x38')](_0x1782d6[_0xe792('0x2f')][_0xe792('0x38')]);_0x344a61['where']=qs[_0xe792('0x30')](_[_0xe792('0x39')](_0x1782d6[_0xe792('0x2f')],_0x5be9d3['filters']),_0x1a6fbf);if(_0x1782d6[_0xe792('0x2f')]['filter']){_0x344a61[_0xe792('0x3a')]=_['merge'](_0x344a61['where'],{'$or':_[_0xe792('0x27')](_0x1a6fbf,function(_0x260a2e){if(_0x260a2e[_0xe792('0x2b')]!==_0xe792('0x3b')){var _0x3d4cbb={};_0x3d4cbb[_0x260a2e['name']]={'$like':'%'+_0x1782d6[_0xe792('0x2f')]['filter']+'%'};return _0x3d4cbb;}})});}_0x344a61=_['merge']({},_0x344a61,_0x1782d6['options']);var _0x2e43ec={'where':_0x344a61[_0xe792('0x3a')]};return db['Automation']['count'](_0x2e43ec)[_0xe792('0x20')](function(_0x3f54ee){_0x27af07['count']=_0x3f54ee;if(_0x1782d6[_0xe792('0x2f')]['includeAll']){_0x344a61[_0xe792('0x3c')]=[{'all':!![]}];}return db[_0xe792('0x28')][_0xe792('0x3d')](_0x344a61);})[_0xe792('0x20')](function(_0x593e7b){_0x27af07[_0xe792('0x3e')]=_0x593e7b;return _0x27af07;})[_0xe792('0x20')](respondWithFilteredResult(_0x31409c,_0x344a61))[_0xe792('0x3f')](handleError(_0x31409c,null));};exports['show']=function(_0x363332,_0x33c396){var _0x2b0261={'raw':![],'where':{'id':_0x363332[_0xe792('0x40')]['id']}},_0x1ef6db={};_0x1ef6db[_0xe792('0x2d')]=_[_0xe792('0x2e')](db['Automation']['rawAttributes']);_0x1ef6db[_0xe792('0x2f')]=_[_0xe792('0x2e')](_0x363332['query']);_0x1ef6db[_0xe792('0x30')]=_[_0xe792('0x31')](_0x1ef6db[_0xe792('0x2d')],_0x1ef6db[_0xe792('0x2f')]);_0x2b0261['attributes']=_[_0xe792('0x31')](_0x1ef6db[_0xe792('0x2d')],qs[_0xe792('0x32')](_0x363332[_0xe792('0x2f')][_0xe792('0x32')]));_0x2b0261[_0xe792('0x33')]=_0x2b0261[_0xe792('0x33')][_0xe792('0x34')]?_0x2b0261[_0xe792('0x33')]:_0x1ef6db[_0xe792('0x2d')];if(_0x363332[_0xe792('0x2f')][_0xe792('0x41')]){_0x2b0261[_0xe792('0x3c')]=[{'all':!![]}];}_0x2b0261=_[_0xe792('0x42')]({},_0x2b0261,_0x363332[_0xe792('0x43')]);return db[_0xe792('0x28')][_0xe792('0x44')](_0x2b0261)[_0xe792('0x20')](handleEntityNotFound(_0x33c396,null))[_0xe792('0x20')](respondWithResult(_0x33c396,null))[_0xe792('0x3f')](handleError(_0x33c396,null));};exports['create']=function(_0x39a289,_0x3e6713){return db['Automation'][_0xe792('0x45')](_0x39a289[_0xe792('0x46')],{})[_0xe792('0x20')](respondWithResult(_0x3e6713,0xc9))[_0xe792('0x3f')](handleError(_0x3e6713,null));};exports['update']=function(_0x12cbd8,_0x3cc9ac){if(_0x12cbd8[_0xe792('0x46')]['id']){delete _0x12cbd8[_0xe792('0x46')]['id'];}return db['Automation'][_0xe792('0x44')]({'where':{'id':_0x12cbd8[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0x3cc9ac,null))[_0xe792('0x20')](saveUpdates(_0x12cbd8['body'],null))[_0xe792('0x20')](respondWithResult(_0x3cc9ac,null))[_0xe792('0x3f')](handleError(_0x3cc9ac,null));};exports['destroy']=function(_0x475aa1,_0xdce4f5){return db[_0xe792('0x28')][_0xe792('0x44')]({'where':{'id':_0x475aa1[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0xdce4f5,null))[_0xe792('0x20')](removeEntity(_0xdce4f5,null))[_0xe792('0x3f')](handleError(_0xdce4f5,null));};exports[_0xe792('0x47')]=function(_0x5761f5,_0x3f03e5,_0x3cd732){return db[_0xe792('0x48')][_0xe792('0x44')]({'where':{'id':_0x5761f5[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0x3f03e5,null))[_0xe792('0x20')](function(_0x256732){if(_0x256732){return _0x256732[_0xe792('0x47')](_0x5761f5['body'][_0xe792('0x49')],_[_0xe792('0x4a')](_0x5761f5[_0xe792('0x46')],[_0xe792('0x49'),'id'])||{});}})['then'](respondWithResult(_0x3f03e5,null))[_0xe792('0x3f')](handleError(_0x3f03e5,null));};exports[_0xe792('0x4b')]=function(_0x2979c1,_0x4b7ba7,_0x29cc1c){var _0x4271c0={};var _0x64a11={};var _0x32d134;var _0x394319;return db[_0xe792('0x28')][_0xe792('0x4c')]({'where':{'id':_0x2979c1[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0x4b7ba7,null))[_0xe792('0x20')](function(_0x21f9d5){if(_0x21f9d5){_0x32d134=_0x21f9d5;_0x64a11['model']=_[_0xe792('0x2e')](db[_0xe792('0x48')]['rawAttributes']);_0x64a11[_0xe792('0x2f')]=_[_0xe792('0x2e')](_0x2979c1['query']);_0x64a11['filters']=_[_0xe792('0x31')](_0x64a11['model'],_0x64a11[_0xe792('0x2f')]);_0x4271c0[_0xe792('0x33')]=_[_0xe792('0x31')](_0x64a11['model'],qs[_0xe792('0x32')](_0x2979c1[_0xe792('0x2f')][_0xe792('0x32')]));_0x4271c0['attributes']=_0x4271c0[_0xe792('0x33')][_0xe792('0x34')]?_0x4271c0[_0xe792('0x33')]:_0x64a11[_0xe792('0x2d')];_0x4271c0[_0xe792('0x37')]=qs['sort'](_0x2979c1[_0xe792('0x2f')]['sort']);_0x4271c0['where']=qs[_0xe792('0x30')](_[_0xe792('0x39')](_0x2979c1[_0xe792('0x2f')],_0x64a11[_0xe792('0x30')]));if(_0x2979c1[_0xe792('0x2f')][_0xe792('0x4d')]){_0x4271c0['where']=_['merge'](_0x4271c0[_0xe792('0x3a')],{'$or':_[_0xe792('0x27')](_0x4271c0['attributes'],function(_0x2cfa94){var _0x36c7a4={};_0x36c7a4[_0x2cfa94]={'$like':'%'+_0x2979c1[_0xe792('0x2f')]['filter']+'%'};return _0x36c7a4;})});}_0x4271c0=_[_0xe792('0x42')]({},_0x4271c0,_0x2979c1['options']);return _0x32d134['getConditions'](_0x4271c0);}})[_0xe792('0x20')](function(_0x5f55b0){if(_0x5f55b0){_0x394319=_0x5f55b0['length'];if(!_0x2979c1[_0xe792('0x2f')][_0xe792('0x35')](_0xe792('0x36'))){_0x4271c0[_0xe792('0x1c')]=qs[_0xe792('0x1c')](_0x2979c1[_0xe792('0x2f')][_0xe792('0x1c')]);_0x4271c0['offset']=qs[_0xe792('0x1a')](_0x2979c1[_0xe792('0x2f')]['offset']);}return _0x32d134[_0xe792('0x4b')](_0x4271c0);}})['then'](function(_0x4f426e){if(_0x4f426e){return _0x4f426e?{'count':_0x394319,'rows':_0x4f426e}:null;}})[_0xe792('0x20')](respondWithResult(_0x4b7ba7,null))[_0xe792('0x3f')](handleError(_0x4b7ba7,null));};exports['addActions']=function(_0x2cda32,_0x467fdf,_0x340ce3){return db[_0xe792('0x4e')][_0xe792('0x44')]({'where':{'id':_0x2cda32[_0xe792('0x40')]['id']}})[_0xe792('0x20')](handleEntityNotFound(_0x467fdf,null))[_0xe792('0x20')](function(_0x2105e7){if(_0x2105e7){return _0x2105e7[_0xe792('0x4f')](_0x2cda32[_0xe792('0x46')][_0xe792('0x49')],_[_0xe792('0x4a')](_0x2cda32[_0xe792('0x46')],[_0xe792('0x49'),'id'])||{});}})[_0xe792('0x20')](respondWithResult(_0x467fdf,null))[_0xe792('0x3f')](handleError(_0x467fdf,null));};exports[_0xe792('0x50')]=function(_0xcc7258,_0xdbb21f,_0xa80071){var _0x314216={};var _0x598d3d={};var _0x22a153;var _0x1cd0bc;return db[_0xe792('0x28')]['findOne']({'where':{'id':_0xcc7258['params']['id']}})['then'](handleEntityNotFound(_0xdbb21f,null))[_0xe792('0x20')](function(_0x4f677a){if(_0x4f677a){_0x22a153=_0x4f677a;_0x598d3d[_0xe792('0x2d')]=_[_0xe792('0x2e')](db[_0xe792('0x4e')][_0xe792('0x29')]);_0x598d3d[_0xe792('0x2f')]=_[_0xe792('0x2e')](_0xcc7258['query']);_0x598d3d[_0xe792('0x30')]=_[_0xe792('0x31')](_0x598d3d[_0xe792('0x2d')],_0x598d3d[_0xe792('0x2f')]);_0x314216[_0xe792('0x33')]=_[_0xe792('0x31')](_0x598d3d['model'],qs['fields'](_0xcc7258[_0xe792('0x2f')][_0xe792('0x32')]));_0x314216[_0xe792('0x33')]=_0x314216['attributes']['length']?_0x314216[_0xe792('0x33')]:_0x598d3d[_0xe792('0x2d')];_0x314216['order']=qs['sort'](_0xcc7258[_0xe792('0x2f')]['sort']);_0x314216[_0xe792('0x3a')]=qs[_0xe792('0x30')](_['pick'](_0xcc7258[_0xe792('0x2f')],_0x598d3d['filters']));if(_0xcc7258[_0xe792('0x2f')][_0xe792('0x4d')]){_0x314216[_0xe792('0x3a')]=_[_0xe792('0x42')](_0x314216[_0xe792('0x3a')],{'$or':_[_0xe792('0x27')](_0x314216['attributes'],function(_0x46a086){var _0x3cbb45={};_0x3cbb45[_0x46a086]={'$like':'%'+_0xcc7258[_0xe792('0x2f')][_0xe792('0x4d')]+'%'};return _0x3cbb45;})});}_0x314216=_[_0xe792('0x42')]({},_0x314216,_0xcc7258[_0xe792('0x43')]);return _0x22a153[_0xe792('0x50')](_0x314216);}})[_0xe792('0x20')](function(_0x36ed69){if(_0x36ed69){_0x1cd0bc=_0x36ed69[_0xe792('0x34')];if(!_0xcc7258[_0xe792('0x2f')][_0xe792('0x35')](_0xe792('0x36'))){_0x314216[_0xe792('0x1c')]=qs[_0xe792('0x1c')](_0xcc7258[_0xe792('0x2f')][_0xe792('0x1c')]);_0x314216[_0xe792('0x1a')]=qs[_0xe792('0x1a')](_0xcc7258[_0xe792('0x2f')][_0xe792('0x1a')]);}return _0x22a153[_0xe792('0x50')](_0x314216);}})[_0xe792('0x20')](function(_0x10307b){if(_0x10307b){return _0x10307b?{'count':_0x1cd0bc,'rows':_0x10307b}:null;}})['then'](respondWithResult(_0xdbb21f,null))[_0xe792('0x3f')](handleError(_0xdbb21f,null));};
\ No newline at end of file
index b630f43..e287b14 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca33=['exports','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xca33,0x1d6));var _0x3ca3=function(_0x33f22f,_0x2c68ea){_0x33f22f=_0x33f22f-0x0;var _0x225875=_0xca33[_0x33f22f];return _0x225875;};'use strict';var _=require(_0x3ca3('0x0'));var util=require(_0x3ca3('0x1'));var logger=require(_0x3ca3('0x2'))(_0x3ca3('0x3'));var moment=require(_0x3ca3('0x4'));var BPromise=require(_0x3ca3('0x5'));var rp=require(_0x3ca3('0x6'));var fs=require('fs');var path=require(_0x3ca3('0x7'));var rimraf=require(_0x3ca3('0x8'));var config=require(_0x3ca3('0x9'));var attributes=require(_0x3ca3('0xa'));module[_0x3ca3('0xb')]=function(_0x2b0d90,_0xfa4f71){return _0x2b0d90['define']('Automation',attributes,{'tableName':_0x3ca3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4e26=['exports','define','Automation','tools_automations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x3e7986,_0x4cc723){var _0x26935e=function(_0x59e8dc){while(--_0x59e8dc){_0x3e7986['push'](_0x3e7986['shift']());}};_0x26935e(++_0x4cc723);}(_0x4e26,0x15d));var _0x64e2=function(_0x47b57b,_0x391d3d){_0x47b57b=_0x47b57b-0x0;var _0x34d2af=_0x4e26[_0x47b57b];return _0x34d2af;};'use strict';var _=require(_0x64e2('0x0'));var util=require(_0x64e2('0x1'));var logger=require(_0x64e2('0x2'))(_0x64e2('0x3'));var moment=require(_0x64e2('0x4'));var BPromise=require(_0x64e2('0x5'));var rp=require(_0x64e2('0x6'));var fs=require('fs');var path=require(_0x64e2('0x7'));var rimraf=require(_0x64e2('0x8'));var config=require(_0x64e2('0x9'));var attributes=require(_0x64e2('0xa'));module[_0x64e2('0xb')]=function(_0x58d119,_0x3523e9){return _0x58d119[_0x64e2('0xc')](_0x64e2('0xd'),attributes,{'tableName':_0x64e2('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 1f9b092..a6b15dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5fb=['request','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x35bca2,_0x4ce50d){var _0x295d7a=function(_0x226e4d){while(--_0x226e4d){_0x35bca2['push'](_0x35bca2['shift']());}};_0x295d7a(++_0x4ce50d);}(_0xb5fb,0x172));var _0xbb5f=function(_0x4b0be5,_0x1ed1aa){_0x4b0be5=_0x4b0be5-0x0;var _0x4b2c39=_0xb5fb[_0x4b0be5];return _0x4b2c39;};'use strict';var _=require(_0xbb5f('0x0'));var util=require(_0xbb5f('0x1'));var moment=require(_0xbb5f('0x2'));var BPromise=require(_0xbb5f('0x3'));var rs=require(_0xbb5f('0x4'));var fs=require('fs');var Redis=require(_0xbb5f('0x5'));var db=require(_0xbb5f('0x6'))['db'];var utils=require(_0xbb5f('0x7'));var logger=require(_0xbb5f('0x8'))(_0xbb5f('0x9'));var config=require(_0xbb5f('0xa'));var jayson=require(_0xbb5f('0xb'));var client=jayson[_0xbb5f('0xc')][_0xbb5f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x487a1a,_0x597050,_0x317cd9){return new BPromise(function(_0x5e7943,_0x5b91){return client[_0xbb5f('0xe')](_0x487a1a,_0x317cd9)['then'](function(_0x4f13a9){logger[_0xbb5f('0xf')]('Automation,\x20%s,\x20%s',_0x597050,_0xbb5f('0x10'));logger[_0xbb5f('0x11')](_0xbb5f('0x12'),_0x597050,_0xbb5f('0x10'),JSON[_0xbb5f('0x13')](_0x4f13a9));if(_0x4f13a9[_0xbb5f('0x14')]){if(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x15')]===0x1f4){logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9['error'][_0xbb5f('0x17')]);return _0x5b91(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}logger['error'](_0xbb5f('0x16'),_0x597050,_0x4f13a9[_0xbb5f('0x14')]['message']);return _0x5e7943(_0x4f13a9[_0xbb5f('0x14')][_0xbb5f('0x17')]);}else{logger[_0xbb5f('0xf')](_0xbb5f('0x16'),_0x597050,'request\x20sent');_0x5e7943(_0x4f13a9['result'][_0xbb5f('0x17')]);}})['catch'](function(_0xdf4ec8){logger[_0xbb5f('0x14')]('Automation,\x20%s,\x20%s',_0x597050,_0xdf4ec8);_0x5b91(_0xdf4ec8);});});}
\ No newline at end of file
+var _0x7af9=['../../config/utils','../../config/logger','rpc','http','request','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af9,0x95));var _0x97af=function(_0x3e5e81,_0x2dbc63){_0x3e5e81=_0x3e5e81-0x0;var _0xf6a561=_0x7af9[_0x3e5e81];return _0xf6a561;};'use strict';var _=require(_0x97af('0x0'));var util=require('util');var moment=require(_0x97af('0x1'));var BPromise=require(_0x97af('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x97af('0x3'));var db=require(_0x97af('0x4'))['db'];var utils=require(_0x97af('0x5'));var logger=require(_0x97af('0x6'))(_0x97af('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x97af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x966c4e,_0x265d22,_0x70b4db){return new BPromise(function(_0x52835d,_0x2c2ee4){return client[_0x97af('0x9')](_0x966c4e,_0x70b4db)[_0x97af('0xa')](function(_0x4b866a){logger[_0x97af('0xb')]('Automation,\x20%s,\x20%s',_0x265d22,_0x97af('0xc'));logger[_0x97af('0xd')](_0x97af('0xe'),_0x265d22,_0x97af('0xc'),JSON[_0x97af('0xf')](_0x4b866a));if(_0x4b866a[_0x97af('0x10')]){if(_0x4b866a[_0x97af('0x10')][_0x97af('0x11')]===0x1f4){logger[_0x97af('0x10')](_0x97af('0x12'),_0x265d22,_0x4b866a[_0x97af('0x10')]['message']);return _0x2c2ee4(_0x4b866a[_0x97af('0x10')]['message']);}logger['error'](_0x97af('0x12'),_0x265d22,_0x4b866a[_0x97af('0x10')][_0x97af('0x13')]);return _0x52835d(_0x4b866a[_0x97af('0x10')][_0x97af('0x13')]);}else{logger[_0x97af('0xb')](_0x97af('0x12'),_0x265d22,'request\x20sent');_0x52835d(_0x4b866a[_0x97af('0x14')]['message']);}})[_0x97af('0x15')](function(_0x58d967){logger[_0x97af('0x10')]('Automation,\x20%s,\x20%s',_0x265d22,_0x58d967);_0x2c2ee4(_0x58d967);});});}
\ No newline at end of file
index 1e1ebcf..11350cb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x524a=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./automation.controller','get','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addActions','/:id','update'];(function(_0x40eda3,_0x4a5a83){var _0x305284=function(_0x181817){while(--_0x181817){_0x40eda3['push'](_0x40eda3['shift']());}};_0x305284(++_0x4a5a83);}(_0x524a,0xf5));var _0xa524=function(_0x4929ee,_0x51ca87){_0x4929ee=_0x4929ee-0x0;var _0x448020=_0x524a[_0x4929ee];return _0x448020;};'use strict';var multer=require(_0xa524('0x0'));var util=require(_0xa524('0x1'));var path=require(_0xa524('0x2'));var timeout=require(_0xa524('0x3'));var express=require('express');var router=express[_0xa524('0x4')]();var fs_extra=require(_0xa524('0x5'));var auth=require(_0xa524('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa524('0x7'));router[_0xa524('0x8')]('/',auth[_0xa524('0x9')](),controller['index']);router[_0xa524('0x8')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0xa')]);router['get'](_0xa524('0xb'),auth[_0xa524('0x9')](),controller[_0xa524('0xc')]);router[_0xa524('0x8')](_0xa524('0xd'),auth['isAuthenticated'](),controller[_0xa524('0xe')]);router[_0xa524('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa524('0xf')](_0xa524('0xb'),auth[_0xa524('0x9')](),controller['addConditions']);router['post'](_0xa524('0xd'),auth['isAuthenticated'](),controller[_0xa524('0x10')]);router['put'](_0xa524('0x11'),auth['isAuthenticated'](),controller[_0xa524('0x12')]);router[_0xa524('0x13')]('/:id',auth[_0xa524('0x9')](),controller[_0xa524('0x14')]);module[_0xa524('0x15')]=router;
\ No newline at end of file
+var _0x6dd6=['isAuthenticated','show','/:id/conditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6dd6,0xcc));var _0x66dd=function(_0x5da107,_0x10357c){_0x5da107=_0x5da107-0x0;var _0x224f15=_0x6dd6[_0x5da107];return _0x224f15;};'use strict';var multer=require('multer');var util=require(_0x66dd('0x0'));var path=require(_0x66dd('0x1'));var timeout=require(_0x66dd('0x2'));var express=require(_0x66dd('0x3'));var router=express[_0x66dd('0x4')]();var fs_extra=require(_0x66dd('0x5'));var auth=require(_0x66dd('0x6'));var interaction=require(_0x66dd('0x7'));var config=require(_0x66dd('0x8'));var controller=require('./automation.controller');router[_0x66dd('0x9')]('/',auth['isAuthenticated'](),controller[_0x66dd('0xa')]);router['get'](_0x66dd('0xb'),auth[_0x66dd('0xc')](),controller[_0x66dd('0xd')]);router[_0x66dd('0x9')](_0x66dd('0xe'),auth['isAuthenticated'](),controller['getConditions']);router[_0x66dd('0x9')](_0x66dd('0xf'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x10')]);router[_0x66dd('0x11')]('/',auth[_0x66dd('0xc')](),controller[_0x66dd('0x12')]);router[_0x66dd('0x11')](_0x66dd('0xe'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x13')]);router[_0x66dd('0x11')](_0x66dd('0xf'),auth[_0x66dd('0xc')](),controller[_0x66dd('0x14')]);router[_0x66dd('0x15')](_0x66dd('0xb'),auth['isAuthenticated'](),controller[_0x66dd('0x16')]);router[_0x66dd('0x17')]('/:id',auth[_0x66dd('0xc')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index d5415bb..84c926d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc47a=['name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','STRING','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports'];(function(_0x3f3d9c,_0xe7a271){var _0x58d8c9=function(_0x570cf4){while(--_0x570cf4){_0x3f3d9c['push'](_0x3f3d9c['shift']());}};_0x58d8c9(++_0xe7a271);}(_0xc47a,0x1ab));var _0xac47=function(_0x38d09b,_0x5532a0){_0x38d09b=_0x38d09b-0x0;var _0x2a3cc1=_0xc47a[_0x38d09b];return _0x2a3cc1;};'use strict';var Sequelize=require(_0xac47('0x0'));module[_0xac47('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xac47('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xac47('0x3')](_0xac47('0x4')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xac47('0x5')],'defaultValue':0x0,'comment':_0xac47('0x6')},'limitCalls':{'type':Sequelize[_0xac47('0x7')](0x4)[_0xac47('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xac47('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0xac47('0xa')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xac47('0x7')](0x3)[_0xac47('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xac47('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0xac47('0x7')](0x3)[_0xac47('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xac47('0x7')](0x5)[_0xac47('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xac47('0xc')},'dialBusyMaxRetry':{'type':Sequelize[_0xac47('0x7')](0x3)[_0xac47('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xac47('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0xac47('0x7')](0x5)[_0xac47('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xac47('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xac47('0x7')](0x3)[_0xac47('0x8')],'defaultValue':0x3,'comment':_0xac47('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xac47('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xac47('0x10')},'dialGlobalMaxRetry':{'type':Sequelize[_0xac47('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xac47('0x11')},'dialTimezone':{'type':Sequelize[_0xac47('0xa')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xac47('0x12')},'dialCheckDuplicateType':{'type':Sequelize[_0xac47('0x3')](_0xac47('0x13'),'never',_0xac47('0x14')),'defaultValue':_0xac47('0x13')},'dialAMDActive':{'type':Sequelize[_0xac47('0x5')],'defaultValue':0x0,'comment':_0xac47('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0xac47('0x7')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0xac47('0x7')](0x9)[_0xac47('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xac47('0x7')](0x9)[_0xac47('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xac47('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xac47('0x7')](0x9)[_0xac47('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xac47('0x17')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xac47('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xac47('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xac47('0x7')](0x9)[_0xac47('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xac47('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xac47('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xac47('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xac47('0x7')](0x5)[_0xac47('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xac47('0x1b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xac47('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xac47('0x1c')},'dialOrderByScheduledAt':{'type':Sequelize[_0xac47('0x3')](_0xac47('0x1d'),_0xac47('0x1e')),'defaultValue':_0xac47('0x1d')},'dialPrefix':{'type':Sequelize[_0xac47('0xa')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xac47('0x7')](0x3)[_0xac47('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xac47('0x7')](0x3)[_0xac47('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xac47('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xac47('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xac47('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xac47('0x20')},'dialDropMaxRetry':{'type':Sequelize[_0xac47('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xac47('0x21')},'dialDropRetryFrequency':{'type':Sequelize[_0xac47('0x7')](0x5)[_0xac47('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xac47('0x7')](0x3)[_0xac47('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xac47('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xac47('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xac47('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xac47('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xac47('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xac47('0x24')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xac47('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xac47('0x7')](0x5)[_0xac47('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xac47('0x26')}};
\ No newline at end of file
+var _0x15a1=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','name','ENUM','ivr','STRING','BOOLEAN','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','INTEGER','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting'];(function(_0x449fb0,_0xf691a2){var _0x10bb91=function(_0x86e613){while(--_0x86e613){_0x449fb0['push'](_0x449fb0['shift']());}};_0x10bb91(++_0xf691a2);}(_0x15a1,0x183));var _0x115a=function(_0x21c82b,_0x122eef){_0x21c82b=_0x21c82b-0x0;var _0x555b90=_0x15a1[_0x21c82b];return _0x555b90;};'use strict';var Sequelize=require(_0x115a('0x0'));module[_0x115a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x115a('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x115a('0x3')]('ivr'),'allowNull':![],'defaultValue':_0x115a('0x4')},'description':{'type':Sequelize[_0x115a('0x5')]},'active':{'type':Sequelize[_0x115a('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x115a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x115a('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x3,'comment':_0x115a('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x115a('0xe')},'dialTimezone':{'type':Sequelize[_0x115a('0x5')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x115a('0x5')],'defaultValue':_0x115a('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x115a('0x10'),'never',_0x115a('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x115a('0x6')],'defaultValue':0x0,'comment':_0x115a('0x12')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x115a('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x115a('0x9')](0x9)[_0x115a('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x115a('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x115a('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x115a('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x115a('0x15')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x115a('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x115a('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x115a('0x9')](0x9)[_0x115a('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x115a('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x115a('0x9')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x115a('0x9')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x115a('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x115a('0x3')](_0x115a('0x19'),_0x115a('0x1a')),'defaultValue':_0x115a('0x19')},'dialPrefix':{'type':Sequelize[_0x115a('0x5')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x115a('0x1b')},'dialCutDigit':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x115a('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0x1e')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x1f')},'dialDropRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0x115a('0x9')](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x115a('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x115a('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x115a('0x9')](0x5)[_0x115a('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x115a('0x24')}};
\ No newline at end of file
index ba3ded2..5c18272 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8093=['cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','ListId\x20=\x20?','fromQuery','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','cm_contact_has_items','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','then','get','IvrCampaigns','destroy','end','error','stack','name','send','map','Campaign','rawAttributes','fieldName','type','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','includeAll','options','omit','createdAt','updatedAt','role','userProfileId','autoAssociation','getHoppers','findOne','CmHopper','nolimit','CampaignId','rows','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from'];(function(_0x28ab72,_0x4cf975){var _0x266fe7=function(_0x2afe8d){while(--_0x2afe8d){_0x28ab72['push'](_0x28ab72['shift']());}};_0x266fe7(++_0x4cf975);}(_0x8093,0xa9));var _0x3809=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x8093[_0x2ca9d4];return _0x258956;};'use strict';var emlformat=require(_0x3809('0x0'));var rimraf=require(_0x3809('0x1'));var zipdir=require(_0x3809('0x2'));var jsonpatch=require(_0x3809('0x3'));var rp=require(_0x3809('0x4'));var moment=require(_0x3809('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3809('0x6'));var util=require(_0x3809('0x7'));var path=require(_0x3809('0x8'));var sox=require(_0x3809('0x9'));var csv=require(_0x3809('0xa'));var ejs=require(_0x3809('0xb'));var fs=require('fs');var fs_extra=require(_0x3809('0xc'));var _=require(_0x3809('0xd'));var squel=require(_0x3809('0xe'));var crypto=require(_0x3809('0xf'));var jsforce=require(_0x3809('0x10'));var deskjs=require(_0x3809('0x11'));var toCsv=require('to-csv');var querystring=require(_0x3809('0x12'));var Papa=require(_0x3809('0x13'));var Redis=require(_0x3809('0x14'));var authService=require(_0x3809('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3809('0x16'));var logger=require('../../config/logger')(_0x3809('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3809('0x18'));var db=require(_0x3809('0x19'))['db'];function respondWithStatusCode(_0x273134,_0x4e99db){_0x4e99db=_0x4e99db||0xcc;return function(_0x334061){if(_0x334061){return _0x273134[_0x3809('0x1a')](_0x4e99db);}return _0x273134[_0x3809('0x1b')](_0x4e99db)['end']();};}function respondWithResult(_0x5073ff,_0x4e5f3c){_0x4e5f3c=_0x4e5f3c||0xc8;return function(_0x2018ab){if(_0x2018ab){return _0x5073ff[_0x3809('0x1b')](_0x4e5f3c)[_0x3809('0x1c')](_0x2018ab);}};}function respondWithFilteredResult(_0x5b8ce5,_0x442f01){return function(_0x545a71){if(_0x545a71){var _0x28712d=typeof _0x442f01[_0x3809('0x1d')]===_0x3809('0x1e')&&typeof _0x442f01[_0x3809('0x1f')]===_0x3809('0x1e');var _0x15f1ce=_0x545a71['count'];var _0x5d2b34=_0x28712d?0x0:_0x442f01['offset'];var _0x5e4c12=_0x28712d?_0x545a71['count']:_0x442f01['offset']+_0x442f01['limit'];var _0x47faf9;if(_0x5e4c12>=_0x15f1ce){_0x5e4c12=_0x15f1ce;_0x47faf9=0xc8;}else{_0x47faf9=0xce;}_0x5b8ce5['status'](_0x47faf9);return _0x5b8ce5[_0x3809('0x20')]('Content-Range',_0x5d2b34+'-'+_0x5e4c12+'/'+_0x15f1ce)[_0x3809('0x1c')](_0x545a71);}return null;};}function patchUpdates(_0x18f265){return function(_0x1afc26){try{jsonpatch[_0x3809('0x21')](_0x1afc26,_0x18f265,!![]);}catch(_0x1c8847){return BPromise['reject'](_0x1c8847);}return _0x1afc26[_0x3809('0x22')]();};}function saveUpdates(_0x11efa3,_0x105d9c){return function(_0x251867){if(_0x251867){return _0x251867[_0x3809('0x23')](_0x11efa3)[_0x3809('0x24')](function(_0x12aaac){return _0x12aaac;});}return null;};}function removeEntity(_0x30e192,_0x5c79d1){return function(_0x481741){if(_0x481741){return _0x481741['destroy']()[_0x3809('0x24')](function(){var _0x31b73e=_0x481741[_0x3809('0x25')]({'plain':!![]});var _0x583cb1=_0x3809('0x26');return db['UserProfileResource'][_0x3809('0x27')]({'where':{'type':_0x583cb1,'resourceId':_0x31b73e['id']}})[_0x3809('0x24')](function(){return _0x481741;});})[_0x3809('0x24')](function(){_0x30e192[_0x3809('0x1b')](0xcc)[_0x3809('0x28')]();});}};}function handleEntityNotFound(_0x5ac584,_0x5105cd){return function(_0x470c17){if(!_0x470c17){_0x5ac584['sendStatus'](0x194);}return _0x470c17;};}function handleError(_0x127082,_0x5627aa){_0x5627aa=_0x5627aa||0x1f4;return function(_0x59770c){logger[_0x3809('0x29')](_0x59770c[_0x3809('0x2a')]);if(_0x59770c[_0x3809('0x2b')]){delete _0x59770c[_0x3809('0x2b')];}_0x127082[_0x3809('0x1b')](_0x5627aa)[_0x3809('0x2c')](_0x59770c);};}exports['index']=function(_0x17b6e3,_0x5f51f6){var _0x1fce83={},_0x3dfd37={},_0x423290={'count':0x0,'rows':[]};var _0x5ad82e=_[_0x3809('0x2d')](db[_0x3809('0x2e')][_0x3809('0x2f')],function(_0x3348a5){return{'name':_0x3348a5[_0x3809('0x30')],'type':_0x3348a5[_0x3809('0x31')]['key']};});_0x3dfd37[_0x3809('0x32')]=_[_0x3809('0x2d')](_0x5ad82e,'name');_0x3dfd37['query']=_[_0x3809('0x33')](_0x17b6e3['query']);_0x3dfd37[_0x3809('0x34')]=_[_0x3809('0x35')](_0x3dfd37['model'],_0x3dfd37[_0x3809('0x36')]);_0x1fce83['attributes']=_[_0x3809('0x35')](_0x3dfd37['model'],qs['fields'](_0x17b6e3['query'][_0x3809('0x37')]));_0x1fce83['attributes']=_0x1fce83[_0x3809('0x38')][_0x3809('0x39')]?_0x1fce83[_0x3809('0x38')]:_0x3dfd37[_0x3809('0x32')];if(!_0x17b6e3['query'][_0x3809('0x3a')]('nolimit')){_0x1fce83['limit']=qs[_0x3809('0x1f')](_0x17b6e3['query'][_0x3809('0x1f')]);_0x1fce83['offset']=qs[_0x3809('0x1d')](_0x17b6e3[_0x3809('0x36')]['offset']);}_0x1fce83['order']=qs[_0x3809('0x3b')](_0x17b6e3[_0x3809('0x36')][_0x3809('0x3b')]);_0x1fce83[_0x3809('0x3c')]=qs[_0x3809('0x34')](_[_0x3809('0x3d')](_0x17b6e3[_0x3809('0x36')],_0x3dfd37[_0x3809('0x34')]),_0x5ad82e);if(_0x17b6e3[_0x3809('0x36')][_0x3809('0x3e')]){_0x1fce83[_0x3809('0x3c')]=_[_0x3809('0x3f')](_0x1fce83[_0x3809('0x3c')],{'$or':_[_0x3809('0x2d')](_0x5ad82e,function(_0x5c160f){if(_0x5c160f[_0x3809('0x31')]!==_0x3809('0x40')){var _0x2a9211={};_0x2a9211[_0x5c160f[_0x3809('0x2b')]]={'$like':'%'+_0x17b6e3[_0x3809('0x36')]['filter']+'%'};return _0x2a9211;}})});}_0x1fce83=_['merge']({},_0x1fce83,_0x17b6e3['options']);var _0x497748={'where':_0x1fce83['where']};return db['Campaign'][_0x3809('0x41')](_0x497748)['then'](function(_0x396a40){_0x423290[_0x3809('0x41')]=_0x396a40;if(_0x17b6e3['query']['includeAll']){_0x1fce83[_0x3809('0x42')]=[{'all':!![]}];}return db[_0x3809('0x2e')][_0x3809('0x43')](_0x1fce83);})['then'](function(_0x2571d1){_0x423290['rows']=_0x2571d1;return _0x423290;})['then'](respondWithFilteredResult(_0x5f51f6,_0x1fce83))[_0x3809('0x44')](handleError(_0x5f51f6,null));};exports[_0x3809('0x45')]=function(_0xc63323,_0x1100c0){var _0x77d7be={'raw':![],'where':{'id':_0xc63323[_0x3809('0x46')]['id']}},_0x4e8f15={};_0x4e8f15[_0x3809('0x32')]=_[_0x3809('0x33')](db[_0x3809('0x2e')][_0x3809('0x2f')]);_0x4e8f15['query']=_[_0x3809('0x33')](_0xc63323[_0x3809('0x36')]);_0x4e8f15[_0x3809('0x34')]=_['intersection'](_0x4e8f15[_0x3809('0x32')],_0x4e8f15['query']);_0x77d7be[_0x3809('0x38')]=_[_0x3809('0x35')](_0x4e8f15[_0x3809('0x32')],qs[_0x3809('0x37')](_0xc63323[_0x3809('0x36')][_0x3809('0x37')]));_0x77d7be['attributes']=_0x77d7be[_0x3809('0x38')][_0x3809('0x39')]?_0x77d7be[_0x3809('0x38')]:_0x4e8f15['model'];if(_0xc63323[_0x3809('0x36')]['includeAll']){_0x77d7be['include']=[{'all':!![]}];}_0x77d7be=_['merge']({},_0x77d7be,_0xc63323['options']);return db[_0x3809('0x2e')][_0x3809('0x47')](_0x77d7be)['then'](handleEntityNotFound(_0x1100c0,null))[_0x3809('0x24')](respondWithResult(_0x1100c0,null))[_0x3809('0x44')](handleError(_0x1100c0,null));};exports[_0x3809('0x48')]=function(_0x1b5bed,_0x472244){return db[_0x3809('0x2e')]['create'](_0x1b5bed[_0x3809('0x49')],{})[_0x3809('0x24')](function(_0x676d5f){var _0x214dec=_0x1b5bed[_0x3809('0x4a')]['get']({'plain':!![]});if(!_0x214dec)throw new Error(_0x3809('0x4b'));if(_0x214dec['role']==='user'){var _0x56d894=_0x676d5f['get']({'plain':!![]});var _0x152316=_0x3809('0x26');return db[_0x3809('0x4c')][_0x3809('0x47')]({'where':{'name':_0x152316,'userProfileId':_0x214dec['userProfileId']},'raw':!![]})[_0x3809('0x24')](function(_0x8a753c){if(_0x8a753c&&_0x8a753c['autoAssociation']===0x0){return db[_0x3809('0x4d')][_0x3809('0x48')]({'name':_0x56d894[_0x3809('0x2b')],'resourceId':_0x56d894['id'],'type':_0x8a753c['name'],'sectionId':_0x8a753c['id']},{})[_0x3809('0x24')](function(){return _0x676d5f;});}else{return _0x676d5f;}})['catch'](function(_0x1fe3b1){logger[_0x3809('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1fe3b1);throw _0x1fe3b1;});}return _0x676d5f;})[_0x3809('0x24')](respondWithResult(_0x472244,0xc9))[_0x3809('0x44')](handleError(_0x472244,null));};exports['clone']=function(_0x42f363,_0x5ecb61){var _0x5b10e1={'where':{'id':_0x42f363['params']['id']}},_0xd06a29={};_0xd06a29[_0x3809('0x32')]=_[_0x3809('0x33')](db[_0x3809('0x2e')][_0x3809('0x2f')]);_0x5b10e1[_0x3809('0x38')]=_[_0x3809('0x35')](_0xd06a29['model'],qs['fields'](_0x42f363[_0x3809('0x36')][_0x3809('0x37')]));_0x5b10e1[_0x3809('0x38')]=_0x5b10e1[_0x3809('0x38')][_0x3809('0x39')]?_0x5b10e1[_0x3809('0x38')]:_0xd06a29[_0x3809('0x32')];if(_0x42f363[_0x3809('0x36')][_0x3809('0x4e')]){_0x5b10e1[_0x3809('0x42')]=[{'all':!![]}];}_0x5b10e1=_['merge']({},_0x5b10e1,_0x42f363[_0x3809('0x4f')]);return db[_0x3809('0x2e')][_0x3809('0x47')](_0x5b10e1)['then'](handleEntityNotFound(_0x5ecb61,null))['then'](function(_0x2a4d6a){if(_0x2a4d6a){var _0x2c0457=_0x2a4d6a['get']({'plain':!![]});_0x2c0457=qs[_0x3809('0x50')](_0x2c0457,['id',_0x3809('0x51'),'updatedAt']);_0x42f363[_0x3809('0x49')]=_[_0x3809('0x50')](_0x42f363[_0x3809('0x49')],['id',_0x3809('0x51'),_0x3809('0x52')]);return db['Campaign'][_0x3809('0x48')](_[_0x3809('0x3f')](_0x2c0457,_0x42f363[_0x3809('0x49')]),{'include':_0x42f363[_0x3809('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0x3809('0x24')](function(_0x48d363){var _0xc99fe3=_0x42f363['user']['get']({'plain':!![]});if(!_0xc99fe3)throw new Error(_0x3809('0x4b'));if(_0xc99fe3[_0x3809('0x53')]===_0x3809('0x4a')){var _0x305c7e=_0x48d363[_0x3809('0x25')]({'plain':!![]});var _0x300a8c=_0x3809('0x26');return db[_0x3809('0x4c')]['find']({'where':{'name':_0x300a8c,'userProfileId':_0xc99fe3[_0x3809('0x54')]},'raw':!![]})[_0x3809('0x24')](function(_0x5c486d){if(_0x5c486d&&_0x5c486d[_0x3809('0x55')]===0x0){return db[_0x3809('0x4d')][_0x3809('0x48')]({'name':_0x305c7e[_0x3809('0x2b')],'resourceId':_0x305c7e['id'],'type':_0x5c486d[_0x3809('0x2b')],'sectionId':_0x5c486d['id']},{})[_0x3809('0x24')](function(){return _0x48d363;});}else{return _0x48d363;}})[_0x3809('0x44')](function(_0x144cfa){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x144cfa);throw _0x144cfa;});}return _0x48d363;});}})[_0x3809('0x24')](respondWithResult(_0x5ecb61,0xc9))[_0x3809('0x44')](handleError(_0x5ecb61,null));};exports[_0x3809('0x23')]=function(_0x105a41,_0x2a1a9a){if(_0x105a41[_0x3809('0x49')]['id']){delete _0x105a41[_0x3809('0x49')]['id'];}return db['Campaign'][_0x3809('0x47')]({'where':{'id':_0x105a41[_0x3809('0x46')]['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x2a1a9a,null))['then'](saveUpdates(_0x105a41['body'],null))[_0x3809('0x24')](respondWithResult(_0x2a1a9a,null))['catch'](handleError(_0x2a1a9a,null));};exports[_0x3809('0x27')]=function(_0x2e1af1,_0x1547ec){return db[_0x3809('0x2e')]['find']({'where':{'id':_0x2e1af1[_0x3809('0x46')]['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x1547ec,null))['then'](removeEntity(_0x1547ec,null))['catch'](handleError(_0x1547ec,null));};exports[_0x3809('0x56')]=function(_0x5817a7,_0x44b574,_0x38b1ea){var _0x499330={'raw':!![],'where':{}};var _0x5e6d2e={};var _0x498fed={'count':0x0,'rows':[]};return db[_0x3809('0x2e')][_0x3809('0x57')]({'where':{'id':_0x5817a7['params']['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x44b574,null))[_0x3809('0x24')](function(_0x132d7d){if(_0x132d7d){_0x5e6d2e[_0x3809('0x32')]=_[_0x3809('0x33')](db[_0x3809('0x58')][_0x3809('0x2f')]);_0x5e6d2e[_0x3809('0x36')]=_[_0x3809('0x33')](_0x5817a7[_0x3809('0x36')]);_0x5e6d2e[_0x3809('0x34')]=_['intersection'](_0x5e6d2e[_0x3809('0x32')],_0x5e6d2e['query']);_0x499330[_0x3809('0x38')]=_[_0x3809('0x35')](_0x5e6d2e[_0x3809('0x32')],qs[_0x3809('0x37')](_0x5817a7[_0x3809('0x36')][_0x3809('0x37')]));_0x499330[_0x3809('0x38')]=_0x499330[_0x3809('0x38')][_0x3809('0x39')]?_0x499330[_0x3809('0x38')]:_0x5e6d2e[_0x3809('0x32')];if(!_0x5817a7[_0x3809('0x36')]['hasOwnProperty'](_0x3809('0x59'))){_0x499330['limit']=qs[_0x3809('0x1f')](_0x5817a7[_0x3809('0x36')][_0x3809('0x1f')]);_0x499330['offset']=qs[_0x3809('0x1d')](_0x5817a7['query']['offset']);}_0x499330['order']=qs[_0x3809('0x3b')](_0x5817a7['query'][_0x3809('0x3b')]);_0x499330[_0x3809('0x3c')]=qs[_0x3809('0x34')](_[_0x3809('0x3d')](_0x5817a7['query'],_0x5e6d2e['filters']));_0x499330['where'][_0x3809('0x5a')]=_0x132d7d['id'];if(_0x5817a7[_0x3809('0x36')][_0x3809('0x3e')]){_0x499330[_0x3809('0x3c')]=_[_0x3809('0x3f')](_0x499330[_0x3809('0x3c')],{'$or':_[_0x3809('0x2d')](_0x499330[_0x3809('0x38')],function(_0x1861ec){var _0x4d12d8={};_0x4d12d8[_0x1861ec]={'$like':'%'+_0x5817a7[_0x3809('0x36')][_0x3809('0x3e')]+'%'};return _0x4d12d8;})});}_0x499330=_['merge']({},_0x499330,_0x5817a7[_0x3809('0x4f')]);return db[_0x3809('0x58')][_0x3809('0x41')]({'where':_0x499330[_0x3809('0x3c')]})[_0x3809('0x24')](function(_0x37510e){_0x498fed[_0x3809('0x41')]=_0x37510e;if(_0x5817a7[_0x3809('0x36')][_0x3809('0x4e')]){_0x499330[_0x3809('0x42')]=[{'all':!![]}];}return db[_0x3809('0x58')]['findAll'](_0x499330);})[_0x3809('0x24')](function(_0x49d824){_0x498fed[_0x3809('0x5b')]=_0x49d824;return _0x498fed;});}})[_0x3809('0x24')](respondWithFilteredResult(_0x44b574,_0x499330))[_0x3809('0x44')](handleError(_0x44b574,null));};exports['getHopperHistories']=function(_0x4feef6,_0x5077d0,_0x176426){var _0x4aa95c={'raw':!![],'where':{}};var _0x3d4738={};var _0x205bd4={'count':0x0,'rows':[]};return db[_0x3809('0x2e')][_0x3809('0x57')]({'where':{'id':_0x4feef6['params']['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x5077d0,null))[_0x3809('0x24')](function(_0x373fcf){if(_0x373fcf){_0x3d4738[_0x3809('0x32')]=_[_0x3809('0x33')](db[_0x3809('0x5c')]['rawAttributes']);_0x3d4738[_0x3809('0x36')]=_[_0x3809('0x33')](_0x4feef6[_0x3809('0x36')]);_0x3d4738[_0x3809('0x34')]=_['intersection'](_0x3d4738[_0x3809('0x32')],_0x3d4738[_0x3809('0x36')]);_0x4aa95c['attributes']=_[_0x3809('0x35')](_0x3d4738[_0x3809('0x32')],qs['fields'](_0x4feef6[_0x3809('0x36')][_0x3809('0x37')]));_0x4aa95c[_0x3809('0x38')]=_0x4aa95c[_0x3809('0x38')][_0x3809('0x39')]?_0x4aa95c['attributes']:_0x3d4738[_0x3809('0x32')];if(!_0x4feef6[_0x3809('0x36')][_0x3809('0x3a')](_0x3809('0x59'))){_0x4aa95c[_0x3809('0x1f')]=qs[_0x3809('0x1f')](_0x4feef6['query'][_0x3809('0x1f')]);_0x4aa95c[_0x3809('0x1d')]=qs[_0x3809('0x1d')](_0x4feef6[_0x3809('0x36')]['offset']);}_0x4aa95c[_0x3809('0x5d')]=qs['sort'](_0x4feef6['query'][_0x3809('0x3b')]);_0x4aa95c[_0x3809('0x3c')]=qs[_0x3809('0x34')](_['pick'](_0x4feef6[_0x3809('0x36')],_0x3d4738[_0x3809('0x34')]));_0x4aa95c[_0x3809('0x3c')][_0x3809('0x5a')]=_0x373fcf['id'];if(_0x4feef6[_0x3809('0x36')][_0x3809('0x3e')]){_0x4aa95c[_0x3809('0x3c')]=_['merge'](_0x4aa95c[_0x3809('0x3c')],{'$or':_[_0x3809('0x2d')](_0x4aa95c['attributes'],function(_0x2ab82f){var _0x5d73a3={};_0x5d73a3[_0x2ab82f]={'$like':'%'+_0x4feef6['query'][_0x3809('0x3e')]+'%'};return _0x5d73a3;})});}_0x4aa95c=_['merge']({},_0x4aa95c,_0x4feef6['options']);return db[_0x3809('0x5c')][_0x3809('0x41')]({'where':_0x4aa95c[_0x3809('0x3c')]})[_0x3809('0x24')](function(_0x7494f2){_0x205bd4[_0x3809('0x41')]=_0x7494f2;if(_0x4feef6[_0x3809('0x36')]['includeAll']){_0x4aa95c[_0x3809('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3809('0x43')](_0x4aa95c);})[_0x3809('0x24')](function(_0x172834){_0x205bd4['rows']=_0x172834;return _0x205bd4;});}})[_0x3809('0x24')](respondWithFilteredResult(_0x5077d0,_0x4aa95c))['catch'](handleError(_0x5077d0,null));};exports[_0x3809('0x5e')]=function(_0x260d7e,_0x73432,_0x4e8f74){var _0x1eed05={'raw':!![],'where':{}};var _0x47845d={};var _0x2bba63={'count':0x0,'rows':[]};return db[_0x3809('0x2e')][_0x3809('0x57')]({'where':{'id':_0x260d7e[_0x3809('0x46')]['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x73432,null))['then'](function(_0x320a27){if(_0x320a27){_0x47845d[_0x3809('0x32')]=_['keys'](db[_0x3809('0x5f')][_0x3809('0x2f')]);_0x47845d[_0x3809('0x36')]=_['keys'](_0x260d7e['query']);_0x47845d['filters']=_[_0x3809('0x35')](_0x47845d[_0x3809('0x32')],_0x47845d['query']);_0x1eed05[_0x3809('0x38')]=_[_0x3809('0x35')](_0x47845d[_0x3809('0x32')],qs[_0x3809('0x37')](_0x260d7e[_0x3809('0x36')][_0x3809('0x37')]));_0x1eed05['attributes']=_0x1eed05['attributes'][_0x3809('0x39')]?_0x1eed05[_0x3809('0x38')]:_0x47845d[_0x3809('0x32')];if(!_0x260d7e['query'][_0x3809('0x3a')]('nolimit')){_0x1eed05[_0x3809('0x1f')]=qs[_0x3809('0x1f')](_0x260d7e[_0x3809('0x36')][_0x3809('0x1f')]);_0x1eed05[_0x3809('0x1d')]=qs[_0x3809('0x1d')](_0x260d7e[_0x3809('0x36')][_0x3809('0x1d')]);}_0x1eed05[_0x3809('0x5d')]=qs['sort'](_0x260d7e[_0x3809('0x36')][_0x3809('0x3b')]);_0x1eed05['where']=qs[_0x3809('0x34')](_[_0x3809('0x3d')](_0x260d7e[_0x3809('0x36')],_0x47845d[_0x3809('0x34')]));_0x1eed05[_0x3809('0x3c')][_0x3809('0x5a')]=_0x320a27['id'];if(_0x260d7e[_0x3809('0x36')][_0x3809('0x3e')]){_0x1eed05[_0x3809('0x3c')]=_[_0x3809('0x3f')](_0x1eed05[_0x3809('0x3c')],{'$or':_['map'](_0x1eed05['attributes'],function(_0xbebac1){var _0x1eba43={};_0x1eba43[_0xbebac1]={'$like':'%'+_0x260d7e[_0x3809('0x36')][_0x3809('0x3e')]+'%'};return _0x1eba43;})});}_0x1eed05=_[_0x3809('0x3f')]({},_0x1eed05,_0x260d7e[_0x3809('0x4f')]);return db[_0x3809('0x5f')][_0x3809('0x41')]({'where':_0x1eed05['where']})[_0x3809('0x24')](function(_0x94a53f){_0x2bba63[_0x3809('0x41')]=_0x94a53f;if(_0x260d7e[_0x3809('0x36')][_0x3809('0x4e')]){_0x1eed05[_0x3809('0x42')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x3809('0x43')](_0x1eed05);})[_0x3809('0x24')](function(_0x5ec4a1){_0x2bba63[_0x3809('0x5b')]=_0x5ec4a1;return _0x2bba63;});}})[_0x3809('0x24')](respondWithFilteredResult(_0x73432,_0x1eed05))['catch'](handleError(_0x73432,null));};exports[_0x3809('0x60')]=function(_0x53466a,_0x3271f1,_0x534b7c){var _0x3f49c3={'raw':!![],'where':{}};var _0x37f823={};var _0x5340dd={'count':0x0,'rows':[]};return db[_0x3809('0x2e')][_0x3809('0x57')]({'where':{'id':_0x53466a[_0x3809('0x46')]['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x3271f1,null))['then'](function(_0x517fc6){if(_0x517fc6){_0x37f823[_0x3809('0x32')]=_[_0x3809('0x33')](db[_0x3809('0x61')][_0x3809('0x2f')]);_0x37f823[_0x3809('0x36')]=_[_0x3809('0x33')](_0x53466a['query']);_0x37f823[_0x3809('0x34')]=_['intersection'](_0x37f823[_0x3809('0x32')],_0x37f823[_0x3809('0x36')]);_0x3f49c3[_0x3809('0x38')]=_[_0x3809('0x35')](_0x37f823[_0x3809('0x32')],qs['fields'](_0x53466a[_0x3809('0x36')][_0x3809('0x37')]));_0x3f49c3['attributes']=_0x3f49c3[_0x3809('0x38')][_0x3809('0x39')]?_0x3f49c3[_0x3809('0x38')]:_0x37f823[_0x3809('0x32')];if(!_0x53466a[_0x3809('0x36')][_0x3809('0x3a')]('nolimit')){_0x3f49c3[_0x3809('0x1f')]=qs[_0x3809('0x1f')](_0x53466a[_0x3809('0x36')][_0x3809('0x1f')]);_0x3f49c3[_0x3809('0x1d')]=qs[_0x3809('0x1d')](_0x53466a[_0x3809('0x36')][_0x3809('0x1d')]);}_0x3f49c3[_0x3809('0x5d')]=qs[_0x3809('0x3b')](_0x53466a['query']['sort']);_0x3f49c3[_0x3809('0x3c')]=qs[_0x3809('0x34')](_[_0x3809('0x3d')](_0x53466a[_0x3809('0x36')],_0x37f823[_0x3809('0x34')]));_0x3f49c3[_0x3809('0x3c')]['CampaignId']=_0x517fc6['id'];if(_0x53466a[_0x3809('0x36')][_0x3809('0x3e')]){_0x3f49c3[_0x3809('0x3c')]=_['merge'](_0x3f49c3[_0x3809('0x3c')],{'$or':_[_0x3809('0x2d')](_0x3f49c3['attributes'],function(_0x5a9283){var _0x49c4b7={};_0x49c4b7[_0x5a9283]={'$like':'%'+_0x53466a[_0x3809('0x36')][_0x3809('0x3e')]+'%'};return _0x49c4b7;})});}_0x3f49c3=_['merge']({},_0x3f49c3,_0x53466a['options']);return db[_0x3809('0x61')][_0x3809('0x41')]({'where':_0x3f49c3[_0x3809('0x3c')]})[_0x3809('0x24')](function(_0x562522){_0x5340dd[_0x3809('0x41')]=_0x562522;if(_0x53466a[_0x3809('0x36')][_0x3809('0x4e')]){_0x3f49c3[_0x3809('0x42')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x3f49c3);})['then'](function(_0x21ac75){_0x5340dd[_0x3809('0x5b')]=_0x21ac75;return _0x5340dd;});}})['then'](respondWithFilteredResult(_0x3271f1,_0x3f49c3))[_0x3809('0x44')](handleError(_0x3271f1,null));};exports[_0x3809('0x62')]=function(_0x1f9fdc,_0x9c4e77,_0x11d624){var _0x3ba23b={};var _0x25859a={};var _0x99f405;var _0x5e3d33;return db['Campaign'][_0x3809('0x57')]({'where':{'id':_0x1f9fdc['params']['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x9c4e77,null))['then'](function(_0x5de289){if(_0x5de289){_0x99f405=_0x5de289;_0x25859a[_0x3809('0x32')]=_['keys'](db['CmList']['rawAttributes']);_0x25859a[_0x3809('0x36')]=_[_0x3809('0x33')](_0x1f9fdc[_0x3809('0x36')]);_0x25859a[_0x3809('0x34')]=_[_0x3809('0x35')](_0x25859a[_0x3809('0x32')],_0x25859a['query']);_0x3ba23b[_0x3809('0x38')]=_[_0x3809('0x35')](_0x25859a[_0x3809('0x32')],qs[_0x3809('0x37')](_0x1f9fdc[_0x3809('0x36')][_0x3809('0x37')]));_0x3ba23b[_0x3809('0x38')]=_0x3ba23b[_0x3809('0x38')][_0x3809('0x39')]?_0x3ba23b[_0x3809('0x38')]:_0x25859a['model'];_0x3ba23b[_0x3809('0x5d')]=qs[_0x3809('0x3b')](_0x1f9fdc[_0x3809('0x36')]['sort']);_0x3ba23b[_0x3809('0x3c')]=qs[_0x3809('0x34')](_[_0x3809('0x3d')](_0x1f9fdc['query'],_0x25859a[_0x3809('0x34')]));if(_0x1f9fdc[_0x3809('0x36')][_0x3809('0x3e')]){_0x3ba23b[_0x3809('0x3c')]=_[_0x3809('0x3f')](_0x3ba23b['where'],{'$or':_[_0x3809('0x2d')](_0x3ba23b[_0x3809('0x38')],function(_0x14f2f2){var _0x2aba28={};_0x2aba28[_0x14f2f2]={'$like':'%'+_0x1f9fdc['query']['filter']+'%'};return _0x2aba28;})});}_0x3ba23b=_[_0x3809('0x3f')]({},_0x3ba23b,_0x1f9fdc[_0x3809('0x4f')]);return _0x99f405[_0x3809('0x62')](_0x3ba23b);}})[_0x3809('0x24')](function(_0x1c709a){if(_0x1c709a){_0x5e3d33=_0x1c709a[_0x3809('0x39')];if(!_0x1f9fdc[_0x3809('0x36')][_0x3809('0x3a')]('nolimit')){_0x3ba23b['limit']=qs[_0x3809('0x1f')](_0x1f9fdc['query'][_0x3809('0x1f')]);_0x3ba23b[_0x3809('0x1d')]=qs[_0x3809('0x1d')](_0x1f9fdc[_0x3809('0x36')][_0x3809('0x1d')]);}return _0x99f405[_0x3809('0x62')](_0x3ba23b);}})['then'](function(_0x302bc2){if(_0x302bc2){return _0x302bc2?{'count':_0x5e3d33,'rows':_0x302bc2}:null;}})[_0x3809('0x24')](respondWithResult(_0x9c4e77,null))[_0x3809('0x44')](handleError(_0x9c4e77,null));};exports['addLists']=function(_0x1a4391,_0x4b148c,_0x43afb5){var _0xecb717,_0x4fbe13;var _0x11fe9f=[];var _0x4750bf=moment()[_0x3809('0x63')](_0x3809('0x64'));return db['Campaign'][_0x3809('0x47')]({'where':{'id':_0x1a4391[_0x3809('0x46')]['id']}})['then'](handleEntityNotFound(_0x4b148c,null))[_0x3809('0x24')](function(_0x2f475b){if(_0x2f475b){_0x4fbe13=_0x2f475b;return _0x2f475b[_0x3809('0x65')](_0x1a4391[_0x3809('0x49')][_0x3809('0x66')],_[_0x3809('0x50')](_0x1a4391['body'],['ids','id'])||{});}return null;})[_0x3809('0x67')](function(_0x554027){var _0x1be3c0;var _0x146ee7;_0xecb717=_0x554027||[];var _0x5c0e31=[];if(_0x554027){for(var _0x4de9b2=0x0;_0x4de9b2<_0x554027[_0x3809('0x39')];_0x4de9b2+=0x1){var _0x1f05a5=_0x554027[_0x4de9b2][_0x3809('0x25')]({'plain':!![]});_0x4fbe13[_0x3809('0x68')]=_0x1a4391[_0x3809('0x49')][_0x3809('0x68')]?_0x1a4391[_0x3809('0x49')][_0x3809('0x68')]:_0x4fbe13['dialCheckDuplicateType'];switch(_0x4fbe13[_0x3809('0x68')]){case _0x3809('0x69'):_0x1be3c0=squel[_0x3809('0x6a')]()[_0x3809('0x6b')](_0x3809('0x6c'))['fromQuery']([_0x3809('0x6d'),_0x3809('0x6e'),_0x3809('0x6f'),_0x3809('0x70'),_0x3809('0x5a'),_0x3809('0x51'),'updatedAt'],squel[_0x3809('0x71')]()[_0x3809('0x72')](_0x3809('0x6d'),'phone')[_0x3809('0x72')](_0x3809('0x73'),'scheduledAt')[_0x3809('0x72')]('id',_0x3809('0x6f'))[_0x3809('0x72')](_0x1f05a5[_0x3809('0x74')][_0x3809('0x75')](),_0x3809('0x70'))['field'](_0x1a4391[_0x3809('0x46')]['id'][_0x3809('0x75')](),'CampaignId')['field']('\x27'+_0x4750bf+'\x27',_0x3809('0x51'))[_0x3809('0x72')]('\x27'+_0x4750bf+'\x27',_0x3809('0x52'))[_0x3809('0x76')](_0x3809('0x77'))[_0x3809('0x3c')](_0x3809('0x78'))[_0x3809('0x3c')]('ListId\x20=\x20?',_0x1f05a5[_0x3809('0x74')][_0x3809('0x75')]())[_0x3809('0x3c')](_0x3809('0x79'))[_0x3809('0x3c')](_0x3809('0x7a'),squel[_0x3809('0x71')]()[_0x3809('0x72')](_0x3809('0x7b'))['from']('cm_hopper_final')[_0x3809('0x3c')]('CampaignId\x20=\x20?',_0x1a4391[_0x3809('0x46')]['id'][_0x3809('0x75')]()))[_0x3809('0x3c')](_0x3809('0x7a'),squel[_0x3809('0x71')]()['field'](_0x3809('0x7c'))[_0x3809('0x76')](_0x3809('0x6c'))[_0x3809('0x3c')]('CampaignId\x20=\x20?',_0x1a4391[_0x3809('0x46')]['id']['toString']())))[_0x3809('0x75')]();break;case'onlyIfOpen':_0x1be3c0=squel[_0x3809('0x6a')]()[_0x3809('0x6b')](_0x3809('0x6c'))['fromQuery']([_0x3809('0x6d'),_0x3809('0x6e'),'ContactId',_0x3809('0x70'),_0x3809('0x5a'),'createdAt',_0x3809('0x52')],squel[_0x3809('0x71')]()[_0x3809('0x72')](_0x3809('0x6d'),'phone')[_0x3809('0x72')]('NOW()',_0x3809('0x6e'))['field']('id','ContactId')['field'](_0x1f05a5['CmListId']['toString'](),'ListId')[_0x3809('0x72')](_0x1a4391[_0x3809('0x46')]['id']['toString'](),_0x3809('0x5a'))[_0x3809('0x72')]('\x27'+_0x4750bf+'\x27',_0x3809('0x51'))[_0x3809('0x72')]('\x27'+_0x4750bf+'\x27','updatedAt')[_0x3809('0x76')]('cm_contacts')[_0x3809('0x3c')](_0x3809('0x78'))[_0x3809('0x3c')](_0x3809('0x7d'),_0x1f05a5[_0x3809('0x74')][_0x3809('0x75')]())['where'](_0x3809('0x79'))[_0x3809('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3809('0x71')]()[_0x3809('0x72')](_0x3809('0x7c'))[_0x3809('0x76')](_0x3809('0x6c'))[_0x3809('0x3c')]('CampaignId\x20=\x20?',_0x1a4391[_0x3809('0x46')]['id'][_0x3809('0x75')]())))[_0x3809('0x75')]();break;default:_0x1be3c0=squel[_0x3809('0x6a')]()[_0x3809('0x6b')](_0x3809('0x6c'))[_0x3809('0x7e')]([_0x3809('0x6d'),_0x3809('0x6e'),_0x3809('0x6f'),_0x3809('0x70'),_0x3809('0x5a'),_0x3809('0x51'),_0x3809('0x52')],squel[_0x3809('0x71')]()[_0x3809('0x72')]('phone',_0x3809('0x6d'))[_0x3809('0x72')]('NOW()',_0x3809('0x6e'))[_0x3809('0x72')]('id','ContactId')[_0x3809('0x72')](_0x1f05a5[_0x3809('0x74')][_0x3809('0x75')](),_0x3809('0x70'))[_0x3809('0x72')](_0x1a4391['params']['id'][_0x3809('0x75')](),'CampaignId')[_0x3809('0x72')]('\x27'+_0x4750bf+'\x27',_0x3809('0x51'))['field']('\x27'+_0x4750bf+'\x27',_0x3809('0x52'))[_0x3809('0x76')](_0x3809('0x77'))[_0x3809('0x3c')]('deletedAt\x20IS\x20NULL')['where'](_0x3809('0x7d'),_0x1f05a5[_0x3809('0x74')][_0x3809('0x75')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x3809('0x75')]();}_0x146ee7=squel[_0x3809('0x6a')]()[_0x3809('0x6b')](_0x3809('0x7f'))['fromQuery']([_0x3809('0x80'),_0x3809('0x6e'),'phone',_0x3809('0x81'),'createdAt',_0x3809('0x52')],squel[_0x3809('0x71')]()[_0x3809('0x72')](_0x3809('0x82'),'id')[_0x3809('0x72')](_0x3809('0x73'),_0x3809('0x6e'))['field']('ci.item',_0x3809('0x6d'))['field']('ci.OrderBY',_0x3809('0x81'))[_0x3809('0x72')]('\x27'+_0x4750bf+'\x27',_0x3809('0x51'))[_0x3809('0x72')]('\x27'+_0x4750bf+'\x27',_0x3809('0x52'))['from'](_0x3809('0x83'),'ci')['join'](_0x3809('0x6c'),'h',_0x3809('0x84'))[_0x3809('0x3c')](_0x3809('0x85'),_0x1f05a5['CmListId'][_0x3809('0x75')]())[_0x3809('0x3c')](_0x3809('0x86'),_0x1a4391[_0x3809('0x46')]['id'][_0x3809('0x75')]())[_0x3809('0x3c')](_0x3809('0x87'),_0x4750bf))['toString']();_0x5c0e31[_0x3809('0x88')](db[_0x3809('0x89')][_0x3809('0x36')](_0x1be3c0));_0x11fe9f['push'](db[_0x3809('0x89')][_0x3809('0x36')](_0x146ee7));}return BPromise[_0x3809('0x8a')](_0x5c0e31);}})[_0x3809('0x24')](function(){return BPromise['all'](_0x11fe9f);})[_0x3809('0x24')](function(){return _0xecb717;})[_0x3809('0x24')](respondWithResult(_0x4b148c,null))[_0x3809('0x44')](handleError(_0x4b148c,null));};exports['removeLists']=function(_0x45cde7,_0x2bee88,_0x273b29){return db[_0x3809('0x2e')]['find']({'where':{'id':_0x45cde7[_0x3809('0x46')]['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x2bee88,null))[_0x3809('0x24')](function(_0x4d8152){if(_0x4d8152){return _0x4d8152[_0x3809('0x8b')](_0x45cde7[_0x3809('0x36')]['ids']);}})[_0x3809('0x24')](function(_0x3aa719){if(_0x3aa719){return db[_0x3809('0x58')]['destroy']({'where':{'ListId':_0x45cde7['query'][_0x3809('0x66')],'CampaignId':_0x45cde7[_0x3809('0x46')]['id']}})[_0x3809('0x24')](function(){return _0x3aa719;});}})[_0x3809('0x24')](respondWithStatusCode(_0x2bee88,null))[_0x3809('0x44')](handleError(_0x2bee88,null));};exports[_0x3809('0x8c')]=function(_0xe53feb,_0x5d1918,_0x27633b){var _0x6ae5c={};var _0x448384={};var _0x3c1a39;var _0x263b09;return db[_0x3809('0x2e')][_0x3809('0x57')]({'where':{'id':_0xe53feb['params']['id']}})[_0x3809('0x24')](handleEntityNotFound(_0x5d1918,null))[_0x3809('0x24')](function(_0x55f1ad){if(_0x55f1ad){_0x3c1a39=_0x55f1ad;_0x448384['model']=_[_0x3809('0x33')](db[_0x3809('0x8d')]['rawAttributes']);_0x448384[_0x3809('0x36')]=_['keys'](_0xe53feb[_0x3809('0x36')]);_0x448384[_0x3809('0x34')]=_['intersection'](_0x448384[_0x3809('0x32')],_0x448384[_0x3809('0x36')]);_0x6ae5c['attributes']=_[_0x3809('0x35')](_0x448384[_0x3809('0x32')],qs[_0x3809('0x37')](_0xe53feb[_0x3809('0x36')][_0x3809('0x37')]));_0x6ae5c[_0x3809('0x38')]=_0x6ae5c['attributes'][_0x3809('0x39')]?_0x6ae5c[_0x3809('0x38')]:_0x448384['model'];_0x6ae5c[_0x3809('0x5d')]=qs[_0x3809('0x3b')](_0xe53feb[_0x3809('0x36')][_0x3809('0x3b')]);_0x6ae5c[_0x3809('0x3c')]=qs[_0x3809('0x34')](_[_0x3809('0x3d')](_0xe53feb[_0x3809('0x36')],_0x448384[_0x3809('0x34')]));if(_0xe53feb[_0x3809('0x36')][_0x3809('0x3e')]){_0x6ae5c[_0x3809('0x3c')]=_[_0x3809('0x3f')](_0x6ae5c[_0x3809('0x3c')],{'$or':_['map'](_0x6ae5c['attributes'],function(_0x160bb7){var _0x2d6644={};_0x2d6644[_0x160bb7]={'$like':'%'+_0xe53feb[_0x3809('0x36')]['filter']+'%'};return _0x2d6644;})});}_0x6ae5c=_[_0x3809('0x3f')]({},_0x6ae5c,_0xe53feb[_0x3809('0x4f')]);return _0x3c1a39['getBlackLists'](_0x6ae5c);}})[_0x3809('0x24')](function(_0x3afbcb){if(_0x3afbcb){_0x263b09=_0x3afbcb[_0x3809('0x39')];if(!_0xe53feb[_0x3809('0x36')][_0x3809('0x3a')](_0x3809('0x59'))){_0x6ae5c[_0x3809('0x1f')]=qs[_0x3809('0x1f')](_0xe53feb[_0x3809('0x36')][_0x3809('0x1f')]);_0x6ae5c[_0x3809('0x1d')]=qs[_0x3809('0x1d')](_0xe53feb['query'][_0x3809('0x1d')]);}return _0x3c1a39[_0x3809('0x8c')](_0x6ae5c);}})[_0x3809('0x24')](function(_0x4950aa){if(_0x4950aa){return _0x4950aa?{'count':_0x263b09,'rows':_0x4950aa}:null;}})['then'](respondWithResult(_0x5d1918,null))[_0x3809('0x44')](handleError(_0x5d1918,null));};exports[_0x3809('0x8e')]=function(_0x202f26,_0x469306,_0x136453){var _0x3a9870,_0x131808;var _0x2ebd3c=[];var _0xcd8de1=moment()[_0x3809('0x63')](_0x3809('0x64'));return db['Campaign'][_0x3809('0x47')]({'where':{'id':_0x202f26[_0x3809('0x46')]['id']}})['then'](handleEntityNotFound(_0x469306,null))['then'](function(_0x3d1fb9){if(_0x3d1fb9){_0x131808=_0x3d1fb9;return _0x3d1fb9[_0x3809('0x8e')](_0x202f26[_0x3809('0x49')][_0x3809('0x66')],_[_0x3809('0x50')](_0x202f26[_0x3809('0x49')],[_0x3809('0x66'),'id'])||{});}return null;})[_0x3809('0x67')](function(_0x5cf66d){var _0x538bf9;var _0x40f43d;_0x3a9870=_0x5cf66d||[];var _0xee1c92=[];if(_0x5cf66d){for(var _0x3f92d9=0x0;_0x3f92d9<_0x5cf66d[_0x3809('0x39')];_0x3f92d9+=0x1){var _0x3f5ff5=_0x5cf66d[_0x3f92d9][_0x3809('0x25')]({'plain':!![]});_0x538bf9=squel[_0x3809('0x6a')]()['into']('cm_hopper_black')[_0x3809('0x7e')]([_0x3809('0x6d'),_0x3809('0x6f'),_0x3809('0x70'),_0x3809('0x5a'),'createdAt','updatedAt'],squel[_0x3809('0x71')]()[_0x3809('0x72')]('phone',_0x3809('0x6d'))[_0x3809('0x72')]('id',_0x3809('0x6f'))[_0x3809('0x72')](_0x3f5ff5[_0x3809('0x74')][_0x3809('0x75')](),_0x3809('0x70'))[_0x3809('0x72')](_0x202f26[_0x3809('0x46')]['id'][_0x3809('0x75')](),_0x3809('0x5a'))[_0x3809('0x72')](_0x3809('0x73'),_0x3809('0x51'))[_0x3809('0x72')](_0x3809('0x73'),_0x3809('0x52'))[_0x3809('0x76')](_0x3809('0x77'))[_0x3809('0x3c')](_0x3809('0x78'))[_0x3809('0x3c')]('ListId\x20=\x20?',_0x3f5ff5[_0x3809('0x74')][_0x3809('0x75')]())['where'](_0x3809('0x79')))[_0x3809('0x75')]();_0xee1c92[_0x3809('0x88')](db[_0x3809('0x89')]['query'](_0x538bf9));}return BPromise[_0x3809('0x8a')](_0xee1c92);}})[_0x3809('0x24')](function(){return _0x3a9870;})[_0x3809('0x24')](respondWithResult(_0x469306,null))['catch'](handleError(_0x469306,null));};exports[_0x3809('0x8f')]=function(_0xd11a07,_0x171714,_0x6c9f9f){return db['Campaign']['find']({'where':{'id':_0xd11a07[_0x3809('0x46')]['id']}})['then'](handleEntityNotFound(_0x171714,null))[_0x3809('0x24')](function(_0x327631){if(_0x327631){return _0x327631[_0x3809('0x8f')](_0xd11a07[_0x3809('0x36')][_0x3809('0x66')]);}})[_0x3809('0x24')](function(_0x2257d0){if(_0x2257d0){return db[_0x3809('0x61')]['destroy']({'where':{'ListId':_0xd11a07[_0x3809('0x36')]['ids'],'CampaignId':_0xd11a07[_0x3809('0x46')]['id']}})[_0x3809('0x24')](function(){return _0x2257d0;});}})['then'](respondWithStatusCode(_0x171714,null))[_0x3809('0x44')](handleError(_0x171714,null));};
\ No newline at end of file
+var _0x5523=['sequelize','all','removeLists','getBlackLists','addBlackLists','omit','insert','cm_hopper_black','removeBlackLists','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','then','destroy','IvrCampaigns','UserProfileResource','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Campaign','include','findAll','rows','catch','params','keys','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','CmHopper','nolimit','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','ListId','select','phone','field','NOW()','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','CmListId','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','onlyIfOpen','ContactId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','scheduledAt','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push'];(function(_0x152e48,_0x25f775){var _0x30b1a4=function(_0x5dcbf3){while(--_0x5dcbf3){_0x152e48['push'](_0x152e48['shift']());}};_0x30b1a4(++_0x25f775);}(_0x5523,0x137));var _0x3552=function(_0x3bf282,_0x329ee6){_0x3bf282=_0x3bf282-0x0;var _0x1e9be4=_0x5523[_0x3bf282];return _0x1e9be4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3552('0x0'));var jsonpatch=require(_0x3552('0x1'));var rp=require(_0x3552('0x2'));var moment=require(_0x3552('0x3'));var BPromise=require(_0x3552('0x4'));var Mustache=require(_0x3552('0x5'));var util=require(_0x3552('0x6'));var path=require(_0x3552('0x7'));var sox=require(_0x3552('0x8'));var csv=require(_0x3552('0x9'));var ejs=require(_0x3552('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3552('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3552('0xc'));var toCsv=require(_0x3552('0x9'));var querystring=require(_0x3552('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3552('0xe'));var qs=require(_0x3552('0xf'));var as=require(_0x3552('0x10'));var hardwareService=require(_0x3552('0x11'));var logger=require(_0x3552('0x12'))(_0x3552('0x13'));var utils=require(_0x3552('0x14'));var config=require(_0x3552('0x15'));var licenseUtil=require(_0x3552('0x16'));var db=require(_0x3552('0x17'))['db'];function respondWithStatusCode(_0xae728b,_0x549df0){_0x549df0=_0x549df0||0xcc;return function(_0x295d0d){if(_0x295d0d){return _0xae728b[_0x3552('0x18')](_0x549df0);}return _0xae728b[_0x3552('0x19')](_0x549df0)['end']();};}function respondWithResult(_0x538549,_0x123c8e){_0x123c8e=_0x123c8e||0xc8;return function(_0x3e90fc){if(_0x3e90fc){return _0x538549[_0x3552('0x19')](_0x123c8e)[_0x3552('0x1a')](_0x3e90fc);}};}function respondWithFilteredResult(_0x50813d,_0x3b9f0a){return function(_0x268d39){if(_0x268d39){var _0x31dd12=typeof _0x3b9f0a[_0x3552('0x1b')]==='undefined'&&typeof _0x3b9f0a[_0x3552('0x1c')]===_0x3552('0x1d');var _0xcc111c=_0x268d39['count'];var _0x2375c9=_0x31dd12?0x0:_0x3b9f0a[_0x3552('0x1b')];var _0x586e1f=_0x31dd12?_0x268d39[_0x3552('0x1e')]:_0x3b9f0a[_0x3552('0x1b')]+_0x3b9f0a[_0x3552('0x1c')];var _0x42fe33;if(_0x586e1f>=_0xcc111c){_0x586e1f=_0xcc111c;_0x42fe33=0xc8;}else{_0x42fe33=0xce;}_0x50813d['status'](_0x42fe33);return _0x50813d[_0x3552('0x1f')](_0x3552('0x20'),_0x2375c9+'-'+_0x586e1f+'/'+_0xcc111c)['json'](_0x268d39);}return null;};}function patchUpdates(_0x26984c){return function(_0x443bab){try{jsonpatch[_0x3552('0x21')](_0x443bab,_0x26984c,!![]);}catch(_0x404b40){return BPromise[_0x3552('0x22')](_0x404b40);}return _0x443bab['save']();};}function saveUpdates(_0x2fe62c,_0x4ea201){return function(_0x42a3d3){if(_0x42a3d3){return _0x42a3d3['update'](_0x2fe62c)[_0x3552('0x23')](function(_0x3ddfb3){return _0x3ddfb3;});}return null;};}function removeEntity(_0x5355e4,_0x1f80b5){return function(_0x534c68){if(_0x534c68){return _0x534c68[_0x3552('0x24')]()['then'](function(){var _0x1972b7=_0x534c68['get']({'plain':!![]});var _0x11c23f=_0x3552('0x25');return db[_0x3552('0x26')][_0x3552('0x24')]({'where':{'type':_0x11c23f,'resourceId':_0x1972b7['id']}})[_0x3552('0x23')](function(){return _0x534c68;});})[_0x3552('0x23')](function(){_0x5355e4[_0x3552('0x19')](0xcc)[_0x3552('0x27')]();});}};}function handleEntityNotFound(_0x5028e1,_0x5d93f6){return function(_0x7d75aa){if(!_0x7d75aa){_0x5028e1['sendStatus'](0x194);}return _0x7d75aa;};}function handleError(_0x29dc07,_0x43d239){_0x43d239=_0x43d239||0x1f4;return function(_0x914ffc){logger[_0x3552('0x28')](_0x914ffc[_0x3552('0x29')]);if(_0x914ffc['name']){delete _0x914ffc[_0x3552('0x2a')];}_0x29dc07[_0x3552('0x19')](_0x43d239)[_0x3552('0x2b')](_0x914ffc);};}exports[_0x3552('0x2c')]=function(_0x212185,_0x52220d){var _0x32b45f={},_0x144d92={},_0x4bbe07={'count':0x0,'rows':[]};var _0xa8952e=_['map'](db['Campaign'][_0x3552('0x2d')],function(_0xe41ad6){return{'name':_0xe41ad6[_0x3552('0x2e')],'type':_0xe41ad6[_0x3552('0x2f')][_0x3552('0x30')]};});_0x144d92[_0x3552('0x31')]=_[_0x3552('0x32')](_0xa8952e,_0x3552('0x2a'));_0x144d92['query']=_['keys'](_0x212185['query']);_0x144d92[_0x3552('0x33')]=_[_0x3552('0x34')](_0x144d92['model'],_0x144d92['query']);_0x32b45f[_0x3552('0x35')]=_[_0x3552('0x34')](_0x144d92[_0x3552('0x31')],qs[_0x3552('0x36')](_0x212185[_0x3552('0x37')][_0x3552('0x36')]));_0x32b45f[_0x3552('0x35')]=_0x32b45f['attributes'][_0x3552('0x38')]?_0x32b45f[_0x3552('0x35')]:_0x144d92[_0x3552('0x31')];if(!_0x212185[_0x3552('0x37')][_0x3552('0x39')]('nolimit')){_0x32b45f[_0x3552('0x1c')]=qs['limit'](_0x212185[_0x3552('0x37')]['limit']);_0x32b45f[_0x3552('0x1b')]=qs[_0x3552('0x1b')](_0x212185[_0x3552('0x37')][_0x3552('0x1b')]);}_0x32b45f[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x212185[_0x3552('0x37')][_0x3552('0x3b')]);_0x32b45f[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x212185[_0x3552('0x37')],_0x144d92['filters']),_0xa8952e);if(_0x212185[_0x3552('0x37')][_0x3552('0x3e')]){_0x32b45f[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x32b45f[_0x3552('0x3c')],{'$or':_['map'](_0xa8952e,function(_0x36d84b){if(_0x36d84b['type']!==_0x3552('0x40')){var _0x1e8d10={};_0x1e8d10[_0x36d84b['name']]={'$like':'%'+_0x212185[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x1e8d10;}})});}_0x32b45f=_[_0x3552('0x3f')]({},_0x32b45f,_0x212185[_0x3552('0x41')]);var _0xaab25d={'where':_0x32b45f[_0x3552('0x3c')]};return db[_0x3552('0x42')][_0x3552('0x1e')](_0xaab25d)[_0x3552('0x23')](function(_0x142da0){_0x4bbe07[_0x3552('0x1e')]=_0x142da0;if(_0x212185[_0x3552('0x37')]['includeAll']){_0x32b45f[_0x3552('0x43')]=[{'all':!![]}];}return db[_0x3552('0x42')][_0x3552('0x44')](_0x32b45f);})[_0x3552('0x23')](function(_0x45973b){_0x4bbe07[_0x3552('0x45')]=_0x45973b;return _0x4bbe07;})[_0x3552('0x23')](respondWithFilteredResult(_0x52220d,_0x32b45f))[_0x3552('0x46')](handleError(_0x52220d,null));};exports['show']=function(_0x1631d0,_0x3e9921){var _0x200fe8={'raw':![],'where':{'id':_0x1631d0[_0x3552('0x47')]['id']}},_0x38290f={};_0x38290f[_0x3552('0x31')]=_[_0x3552('0x48')](db['Campaign'][_0x3552('0x2d')]);_0x38290f[_0x3552('0x37')]=_[_0x3552('0x48')](_0x1631d0[_0x3552('0x37')]);_0x38290f[_0x3552('0x33')]=_[_0x3552('0x34')](_0x38290f[_0x3552('0x31')],_0x38290f[_0x3552('0x37')]);_0x200fe8['attributes']=_[_0x3552('0x34')](_0x38290f[_0x3552('0x31')],qs[_0x3552('0x36')](_0x1631d0[_0x3552('0x37')][_0x3552('0x36')]));_0x200fe8[_0x3552('0x35')]=_0x200fe8[_0x3552('0x35')][_0x3552('0x38')]?_0x200fe8[_0x3552('0x35')]:_0x38290f['model'];if(_0x1631d0[_0x3552('0x37')]['includeAll']){_0x200fe8[_0x3552('0x43')]=[{'all':!![]}];}_0x200fe8=_[_0x3552('0x3f')]({},_0x200fe8,_0x1631d0['options']);return db['Campaign'][_0x3552('0x49')](_0x200fe8)[_0x3552('0x23')](handleEntityNotFound(_0x3e9921,null))['then'](respondWithResult(_0x3e9921,null))[_0x3552('0x46')](handleError(_0x3e9921,null));};exports[_0x3552('0x4a')]=function(_0x68222b,_0x71ca89){return db[_0x3552('0x42')]['create'](_0x68222b[_0x3552('0x4b')],{})[_0x3552('0x23')](function(_0x40c412){var _0x4eff7a=_0x68222b[_0x3552('0x4c')][_0x3552('0x4d')]({'plain':!![]});if(!_0x4eff7a)throw new Error(_0x3552('0x4e'));if(_0x4eff7a[_0x3552('0x4f')]===_0x3552('0x4c')){var _0x2f94e4=_0x40c412[_0x3552('0x4d')]({'plain':!![]});var _0x3b78b8=_0x3552('0x25');return db[_0x3552('0x50')][_0x3552('0x49')]({'where':{'name':_0x3b78b8,'userProfileId':_0x4eff7a[_0x3552('0x51')]},'raw':!![]})['then'](function(_0x1bfc84){if(_0x1bfc84&&_0x1bfc84[_0x3552('0x52')]===0x0){return db[_0x3552('0x26')][_0x3552('0x4a')]({'name':_0x2f94e4[_0x3552('0x2a')],'resourceId':_0x2f94e4['id'],'type':_0x1bfc84['name'],'sectionId':_0x1bfc84['id']},{})['then'](function(){return _0x40c412;});}else{return _0x40c412;}})[_0x3552('0x46')](function(_0x42c63d){logger[_0x3552('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x42c63d);throw _0x42c63d;});}return _0x40c412;})['then'](respondWithResult(_0x71ca89,0xc9))['catch'](handleError(_0x71ca89,null));};exports[_0x3552('0x53')]=function(_0x4ad6e5,_0x5daef7){var _0xc7d21e={'where':{'id':_0x4ad6e5[_0x3552('0x47')]['id']}},_0x2e43eb={};_0x2e43eb[_0x3552('0x31')]=_['keys'](db[_0x3552('0x42')][_0x3552('0x2d')]);_0xc7d21e[_0x3552('0x35')]=_[_0x3552('0x34')](_0x2e43eb[_0x3552('0x31')],qs[_0x3552('0x36')](_0x4ad6e5['query'][_0x3552('0x36')]));_0xc7d21e[_0x3552('0x35')]=_0xc7d21e[_0x3552('0x35')][_0x3552('0x38')]?_0xc7d21e['attributes']:_0x2e43eb[_0x3552('0x31')];if(_0x4ad6e5[_0x3552('0x37')][_0x3552('0x54')]){_0xc7d21e[_0x3552('0x43')]=[{'all':!![]}];}_0xc7d21e=_[_0x3552('0x3f')]({},_0xc7d21e,_0x4ad6e5[_0x3552('0x41')]);return db['Campaign'][_0x3552('0x49')](_0xc7d21e)['then'](handleEntityNotFound(_0x5daef7,null))['then'](function(_0x2a7d99){if(_0x2a7d99){var _0x306e98=_0x2a7d99[_0x3552('0x4d')]({'plain':!![]});_0x306e98=qs['omit'](_0x306e98,['id','createdAt','updatedAt']);_0x4ad6e5['body']=_['omit'](_0x4ad6e5[_0x3552('0x4b')],['id',_0x3552('0x55'),_0x3552('0x56')]);return db[_0x3552('0x42')][_0x3552('0x4a')](_[_0x3552('0x3f')](_0x306e98,_0x4ad6e5['body']),{'include':_0x4ad6e5['query']['includeAll']?[{'all':!![]}]:undefined})[_0x3552('0x23')](function(_0x318e4c){var _0x4a40a3=_0x4ad6e5['user'][_0x3552('0x4d')]({'plain':!![]});if(!_0x4a40a3)throw new Error(_0x3552('0x4e'));if(_0x4a40a3['role']==='user'){var _0x1039b0=_0x318e4c[_0x3552('0x4d')]({'plain':!![]});var _0x28e503='IvrCampaigns';return db[_0x3552('0x50')][_0x3552('0x49')]({'where':{'name':_0x28e503,'userProfileId':_0x4a40a3['userProfileId']},'raw':!![]})['then'](function(_0x5e1181){if(_0x5e1181&&_0x5e1181['autoAssociation']===0x0){return db[_0x3552('0x26')][_0x3552('0x4a')]({'name':_0x1039b0[_0x3552('0x2a')],'resourceId':_0x1039b0['id'],'type':_0x5e1181[_0x3552('0x2a')],'sectionId':_0x5e1181['id']},{})[_0x3552('0x23')](function(){return _0x318e4c;});}else{return _0x318e4c;}})['catch'](function(_0x4eaaa8){logger['error'](_0x3552('0x57'),_0x4eaaa8);throw _0x4eaaa8;});}return _0x318e4c;});}})['then'](respondWithResult(_0x5daef7,0xc9))[_0x3552('0x46')](handleError(_0x5daef7,null));};exports[_0x3552('0x58')]=function(_0x8a4545,_0x4bf9ff){if(_0x8a4545[_0x3552('0x4b')]['id']){delete _0x8a4545[_0x3552('0x4b')]['id'];}return db[_0x3552('0x42')]['find']({'where':{'id':_0x8a4545[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4bf9ff,null))[_0x3552('0x23')](saveUpdates(_0x8a4545['body'],null))[_0x3552('0x23')](respondWithResult(_0x4bf9ff,null))['catch'](handleError(_0x4bf9ff,null));};exports[_0x3552('0x24')]=function(_0x4e37d0,_0x571322){return db[_0x3552('0x42')]['find']({'where':{'id':_0x4e37d0['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x571322,null))[_0x3552('0x23')](removeEntity(_0x571322,null))[_0x3552('0x46')](handleError(_0x571322,null));};exports[_0x3552('0x59')]=function(_0x763317,_0x1da9c0,_0x1d345c){var _0x4702bc={'raw':!![],'where':{}};var _0x27aa33={};var _0x1eacba={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x763317['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x1da9c0,null))[_0x3552('0x23')](function(_0x185a1a){if(_0x185a1a){_0x27aa33[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x5b')]['rawAttributes']);_0x27aa33['query']=_[_0x3552('0x48')](_0x763317[_0x3552('0x37')]);_0x27aa33[_0x3552('0x33')]=_[_0x3552('0x34')](_0x27aa33[_0x3552('0x31')],_0x27aa33['query']);_0x4702bc[_0x3552('0x35')]=_[_0x3552('0x34')](_0x27aa33[_0x3552('0x31')],qs[_0x3552('0x36')](_0x763317[_0x3552('0x37')][_0x3552('0x36')]));_0x4702bc[_0x3552('0x35')]=_0x4702bc[_0x3552('0x35')][_0x3552('0x38')]?_0x4702bc[_0x3552('0x35')]:_0x27aa33[_0x3552('0x31')];if(!_0x763317[_0x3552('0x37')]['hasOwnProperty'](_0x3552('0x5c'))){_0x4702bc[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x763317[_0x3552('0x37')]['limit']);_0x4702bc[_0x3552('0x1b')]=qs['offset'](_0x763317[_0x3552('0x37')][_0x3552('0x1b')]);}_0x4702bc['order']=qs['sort'](_0x763317[_0x3552('0x37')][_0x3552('0x3b')]);_0x4702bc[_0x3552('0x3c')]=qs['filters'](_['pick'](_0x763317[_0x3552('0x37')],_0x27aa33[_0x3552('0x33')]));_0x4702bc[_0x3552('0x3c')][_0x3552('0x5d')]=_0x185a1a['id'];if(_0x763317[_0x3552('0x37')]['filter']){_0x4702bc[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x4702bc[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x4702bc[_0x3552('0x35')],function(_0x17d06f){var _0x49f6ba={};_0x49f6ba[_0x17d06f]={'$like':'%'+_0x763317[_0x3552('0x37')]['filter']+'%'};return _0x49f6ba;})});}_0x4702bc=_[_0x3552('0x3f')]({},_0x4702bc,_0x763317[_0x3552('0x41')]);return db[_0x3552('0x5b')]['count']({'where':_0x4702bc[_0x3552('0x3c')]})['then'](function(_0x497a35){_0x1eacba[_0x3552('0x1e')]=_0x497a35;if(_0x763317[_0x3552('0x37')]['includeAll']){_0x4702bc['include']=[{'all':!![]}];}return db[_0x3552('0x5b')]['findAll'](_0x4702bc);})['then'](function(_0x1a43b4){_0x1eacba['rows']=_0x1a43b4;return _0x1eacba;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x1da9c0,_0x4702bc))[_0x3552('0x46')](handleError(_0x1da9c0,null));};exports['getHopperHistories']=function(_0x2960a2,_0x53bf9e,_0x39efa7){var _0x3db63d={'raw':!![],'where':{}};var _0x1566ab={};var _0x46c6f1={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x2960a2[_0x3552('0x47')]['id']}})['then'](handleEntityNotFound(_0x53bf9e,null))[_0x3552('0x23')](function(_0x336b58){if(_0x336b58){_0x1566ab['model']=_['keys'](db['CmHopperHistory'][_0x3552('0x2d')]);_0x1566ab[_0x3552('0x37')]=_[_0x3552('0x48')](_0x2960a2[_0x3552('0x37')]);_0x1566ab[_0x3552('0x33')]=_[_0x3552('0x34')](_0x1566ab[_0x3552('0x31')],_0x1566ab[_0x3552('0x37')]);_0x3db63d['attributes']=_[_0x3552('0x34')](_0x1566ab[_0x3552('0x31')],qs[_0x3552('0x36')](_0x2960a2['query'][_0x3552('0x36')]));_0x3db63d[_0x3552('0x35')]=_0x3db63d[_0x3552('0x35')][_0x3552('0x38')]?_0x3db63d[_0x3552('0x35')]:_0x1566ab['model'];if(!_0x2960a2['query']['hasOwnProperty'](_0x3552('0x5c'))){_0x3db63d[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x2960a2[_0x3552('0x37')]['limit']);_0x3db63d[_0x3552('0x1b')]=qs['offset'](_0x2960a2[_0x3552('0x37')][_0x3552('0x1b')]);}_0x3db63d['order']=qs[_0x3552('0x3b')](_0x2960a2[_0x3552('0x37')]['sort']);_0x3db63d['where']=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x2960a2['query'],_0x1566ab[_0x3552('0x33')]));_0x3db63d[_0x3552('0x3c')][_0x3552('0x5d')]=_0x336b58['id'];if(_0x2960a2[_0x3552('0x37')][_0x3552('0x3e')]){_0x3db63d[_0x3552('0x3c')]=_['merge'](_0x3db63d[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x3db63d[_0x3552('0x35')],function(_0x88b8a2){var _0x45f44a={};_0x45f44a[_0x88b8a2]={'$like':'%'+_0x2960a2['query'][_0x3552('0x3e')]+'%'};return _0x45f44a;})});}_0x3db63d=_[_0x3552('0x3f')]({},_0x3db63d,_0x2960a2[_0x3552('0x41')]);return db[_0x3552('0x5e')][_0x3552('0x1e')]({'where':_0x3db63d[_0x3552('0x3c')]})[_0x3552('0x23')](function(_0xe4f31d){_0x46c6f1[_0x3552('0x1e')]=_0xe4f31d;if(_0x2960a2[_0x3552('0x37')][_0x3552('0x54')]){_0x3db63d[_0x3552('0x43')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3552('0x44')](_0x3db63d);})[_0x3552('0x23')](function(_0x4044c5){_0x46c6f1[_0x3552('0x45')]=_0x4044c5;return _0x46c6f1;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x53bf9e,_0x3db63d))[_0x3552('0x46')](handleError(_0x53bf9e,null));};exports[_0x3552('0x5f')]=function(_0x15ed73,_0x44ec6c,_0x126b96){var _0x36c4af={'raw':!![],'where':{}};var _0x38f38f={};var _0x29a239={'count':0x0,'rows':[]};return db[_0x3552('0x42')][_0x3552('0x5a')]({'where':{'id':_0x15ed73[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x44ec6c,null))['then'](function(_0x411efc){if(_0x411efc){_0x38f38f[_0x3552('0x31')]=_[_0x3552('0x48')](db['CmHopperFinal'][_0x3552('0x2d')]);_0x38f38f['query']=_[_0x3552('0x48')](_0x15ed73[_0x3552('0x37')]);_0x38f38f[_0x3552('0x33')]=_[_0x3552('0x34')](_0x38f38f['model'],_0x38f38f[_0x3552('0x37')]);_0x36c4af['attributes']=_[_0x3552('0x34')](_0x38f38f['model'],qs[_0x3552('0x36')](_0x15ed73[_0x3552('0x37')][_0x3552('0x36')]));_0x36c4af[_0x3552('0x35')]=_0x36c4af['attributes'][_0x3552('0x38')]?_0x36c4af[_0x3552('0x35')]:_0x38f38f[_0x3552('0x31')];if(!_0x15ed73[_0x3552('0x37')][_0x3552('0x39')](_0x3552('0x5c'))){_0x36c4af[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x15ed73['query'][_0x3552('0x1c')]);_0x36c4af[_0x3552('0x1b')]=qs['offset'](_0x15ed73['query'][_0x3552('0x1b')]);}_0x36c4af[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x15ed73['query'][_0x3552('0x3b')]);_0x36c4af['where']=qs[_0x3552('0x33')](_['pick'](_0x15ed73[_0x3552('0x37')],_0x38f38f[_0x3552('0x33')]));_0x36c4af['where'][_0x3552('0x5d')]=_0x411efc['id'];if(_0x15ed73[_0x3552('0x37')][_0x3552('0x3e')]){_0x36c4af[_0x3552('0x3c')]=_['merge'](_0x36c4af[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x36c4af[_0x3552('0x35')],function(_0x1c7c22){var _0x4edd90={};_0x4edd90[_0x1c7c22]={'$like':'%'+_0x15ed73[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x4edd90;})});}_0x36c4af=_[_0x3552('0x3f')]({},_0x36c4af,_0x15ed73[_0x3552('0x41')]);return db[_0x3552('0x60')][_0x3552('0x1e')]({'where':_0x36c4af[_0x3552('0x3c')]})['then'](function(_0x193c08){_0x29a239[_0x3552('0x1e')]=_0x193c08;if(_0x15ed73['query']['includeAll']){_0x36c4af['include']=[{'all':!![]}];}return db[_0x3552('0x60')][_0x3552('0x44')](_0x36c4af);})[_0x3552('0x23')](function(_0x17f128){_0x29a239[_0x3552('0x45')]=_0x17f128;return _0x29a239;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x44ec6c,_0x36c4af))[_0x3552('0x46')](handleError(_0x44ec6c,null));};exports[_0x3552('0x61')]=function(_0x7f2bff,_0x41e1e1,_0x32e57c){var _0x231360={'raw':!![],'where':{}};var _0x4ff5b9={};var _0xfa805d={'count':0x0,'rows':[]};return db[_0x3552('0x42')]['findOne']({'where':{'id':_0x7f2bff['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x41e1e1,null))[_0x3552('0x23')](function(_0x5d2a92){if(_0x5d2a92){_0x4ff5b9[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x62')]['rawAttributes']);_0x4ff5b9[_0x3552('0x37')]=_['keys'](_0x7f2bff[_0x3552('0x37')]);_0x4ff5b9['filters']=_[_0x3552('0x34')](_0x4ff5b9[_0x3552('0x31')],_0x4ff5b9[_0x3552('0x37')]);_0x231360[_0x3552('0x35')]=_[_0x3552('0x34')](_0x4ff5b9[_0x3552('0x31')],qs[_0x3552('0x36')](_0x7f2bff[_0x3552('0x37')]['fields']));_0x231360['attributes']=_0x231360[_0x3552('0x35')][_0x3552('0x38')]?_0x231360[_0x3552('0x35')]:_0x4ff5b9['model'];if(!_0x7f2bff['query']['hasOwnProperty'](_0x3552('0x5c'))){_0x231360[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x7f2bff[_0x3552('0x37')][_0x3552('0x1c')]);_0x231360[_0x3552('0x1b')]=qs['offset'](_0x7f2bff[_0x3552('0x37')]['offset']);}_0x231360[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x7f2bff[_0x3552('0x37')][_0x3552('0x3b')]);_0x231360[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x7f2bff[_0x3552('0x37')],_0x4ff5b9[_0x3552('0x33')]));_0x231360['where']['CampaignId']=_0x5d2a92['id'];if(_0x7f2bff[_0x3552('0x37')][_0x3552('0x3e')]){_0x231360[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x231360['where'],{'$or':_[_0x3552('0x32')](_0x231360[_0x3552('0x35')],function(_0x119bf3){var _0x4e2f1b={};_0x4e2f1b[_0x119bf3]={'$like':'%'+_0x7f2bff['query'][_0x3552('0x3e')]+'%'};return _0x4e2f1b;})});}_0x231360=_['merge']({},_0x231360,_0x7f2bff['options']);return db[_0x3552('0x62')][_0x3552('0x1e')]({'where':_0x231360[_0x3552('0x3c')]})[_0x3552('0x23')](function(_0x3006b0){_0xfa805d[_0x3552('0x1e')]=_0x3006b0;if(_0x7f2bff[_0x3552('0x37')][_0x3552('0x54')]){_0x231360[_0x3552('0x43')]=[{'all':!![]}];}return db[_0x3552('0x62')]['findAll'](_0x231360);})[_0x3552('0x23')](function(_0x26c443){_0xfa805d['rows']=_0x26c443;return _0xfa805d;});}})[_0x3552('0x23')](respondWithFilteredResult(_0x41e1e1,_0x231360))[_0x3552('0x46')](handleError(_0x41e1e1,null));};exports[_0x3552('0x63')]=function(_0x702218,_0x4b8860,_0x3492b1){var _0x48f184={};var _0x1da704={};var _0x172bde;var _0x1b6bc7;return db['Campaign'][_0x3552('0x5a')]({'where':{'id':_0x702218[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4b8860,null))[_0x3552('0x23')](function(_0x12fb89){if(_0x12fb89){_0x172bde=_0x12fb89;_0x1da704[_0x3552('0x31')]=_[_0x3552('0x48')](db[_0x3552('0x64')][_0x3552('0x2d')]);_0x1da704[_0x3552('0x37')]=_[_0x3552('0x48')](_0x702218[_0x3552('0x37')]);_0x1da704[_0x3552('0x33')]=_['intersection'](_0x1da704[_0x3552('0x31')],_0x1da704[_0x3552('0x37')]);_0x48f184[_0x3552('0x35')]=_['intersection'](_0x1da704[_0x3552('0x31')],qs[_0x3552('0x36')](_0x702218[_0x3552('0x37')][_0x3552('0x36')]));_0x48f184[_0x3552('0x35')]=_0x48f184[_0x3552('0x35')][_0x3552('0x38')]?_0x48f184[_0x3552('0x35')]:_0x1da704[_0x3552('0x31')];_0x48f184['order']=qs[_0x3552('0x3b')](_0x702218[_0x3552('0x37')][_0x3552('0x3b')]);_0x48f184[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x702218['query'],_0x1da704[_0x3552('0x33')]));if(_0x702218[_0x3552('0x37')][_0x3552('0x3e')]){_0x48f184['where']=_[_0x3552('0x3f')](_0x48f184['where'],{'$or':_['map'](_0x48f184['attributes'],function(_0x52d5ea){var _0x288e8b={};_0x288e8b[_0x52d5ea]={'$like':'%'+_0x702218[_0x3552('0x37')]['filter']+'%'};return _0x288e8b;})});}_0x48f184=_[_0x3552('0x3f')]({},_0x48f184,_0x702218[_0x3552('0x41')]);return _0x172bde[_0x3552('0x63')](_0x48f184);}})[_0x3552('0x23')](function(_0x131ce0){if(_0x131ce0){_0x1b6bc7=_0x131ce0[_0x3552('0x38')];if(!_0x702218[_0x3552('0x37')][_0x3552('0x39')](_0x3552('0x5c'))){_0x48f184[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x702218[_0x3552('0x37')][_0x3552('0x1c')]);_0x48f184['offset']=qs[_0x3552('0x1b')](_0x702218[_0x3552('0x37')][_0x3552('0x1b')]);}return _0x172bde[_0x3552('0x63')](_0x48f184);}})[_0x3552('0x23')](function(_0x12b567){if(_0x12b567){return _0x12b567?{'count':_0x1b6bc7,'rows':_0x12b567}:null;}})[_0x3552('0x23')](respondWithResult(_0x4b8860,null))[_0x3552('0x46')](handleError(_0x4b8860,null));};exports['addLists']=function(_0x155529,_0xfdec5c,_0x5e585d){var _0x35a9bc,_0x2b6424;var _0xe15d9b=[];var _0x47d898=moment()[_0x3552('0x65')](_0x3552('0x66'));return db['Campaign'][_0x3552('0x49')]({'where':{'id':_0x155529[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0xfdec5c,null))['then'](function(_0x38d246){if(_0x38d246){_0x2b6424=_0x38d246;return _0x38d246[_0x3552('0x67')](_0x155529[_0x3552('0x4b')][_0x3552('0x68')],_['omit'](_0x155529[_0x3552('0x4b')],['ids','id'])||{});}return null;})[_0x3552('0x69')](function(_0xdc0ec3){var _0x392eb4;var _0x5dd02a;_0x35a9bc=_0xdc0ec3||[];var _0x46d1be=[];if(_0xdc0ec3){for(var _0x10638a=0x0;_0x10638a<_0xdc0ec3[_0x3552('0x38')];_0x10638a+=0x1){var _0x3721db=_0xdc0ec3[_0x10638a][_0x3552('0x4d')]({'plain':!![]});_0x2b6424[_0x3552('0x6a')]=_0x155529['body']['dialCheckDuplicateType']?_0x155529[_0x3552('0x4b')]['dialCheckDuplicateType']:_0x2b6424[_0x3552('0x6a')];switch(_0x2b6424[_0x3552('0x6a')]){case _0x3552('0x6b'):_0x392eb4=squel['insert']()[_0x3552('0x6c')](_0x3552('0x6d'))[_0x3552('0x6e')](['phone','scheduledAt','ContactId',_0x3552('0x6f'),_0x3552('0x5d'),_0x3552('0x55'),'updatedAt'],squel[_0x3552('0x70')]()['field'](_0x3552('0x71'),_0x3552('0x71'))[_0x3552('0x72')](_0x3552('0x73'),'scheduledAt')['field']('id','ContactId')[_0x3552('0x72')](_0x3721db['CmListId'][_0x3552('0x74')](),'ListId')[_0x3552('0x72')](_0x155529['params']['id'][_0x3552('0x74')](),_0x3552('0x5d'))['field']('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')]('ListId\x20=\x20?',_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x3552('0x3c')](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')]('COALESCE(calleridnum,\x27\x27)')[_0x3552('0x75')]('cm_hopper_final')[_0x3552('0x3c')]('CampaignId\x20=\x20?',_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]()))['where'](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x7a'))['from'](_0x3552('0x6d'))[_0x3552('0x3c')](_0x3552('0x7b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())))[_0x3552('0x74')]();break;case _0x3552('0x7c'):_0x392eb4=squel['insert']()['into'](_0x3552('0x6d'))[_0x3552('0x6e')]([_0x3552('0x71'),'scheduledAt',_0x3552('0x7d'),'ListId','CampaignId',_0x3552('0x55'),_0x3552('0x56')],squel['select']()['field'](_0x3552('0x71'),'phone')[_0x3552('0x72')]('NOW()','scheduledAt')[_0x3552('0x72')]('id','ContactId')[_0x3552('0x72')](_0x3721db[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))['field'](_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')](),_0x3552('0x5d'))['field']('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))['from'](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')](_0x3552('0x7e'),_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())['where'](_0x3552('0x7f'))['where'](_0x3552('0x79'),squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x7a'))[_0x3552('0x75')](_0x3552('0x6d'))['where'](_0x3552('0x7b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())))[_0x3552('0x74')]();break;default:_0x392eb4=squel['insert']()[_0x3552('0x6c')](_0x3552('0x6d'))['fromQuery']([_0x3552('0x71'),_0x3552('0x80'),_0x3552('0x7d'),'ListId',_0x3552('0x5d'),_0x3552('0x55'),_0x3552('0x56')],squel[_0x3552('0x70')]()['field'](_0x3552('0x71'),_0x3552('0x71'))[_0x3552('0x72')]('NOW()','scheduledAt')['field']('id',_0x3552('0x7d'))[_0x3552('0x72')](_0x3721db[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))[_0x3552('0x72')](_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')](),_0x3552('0x5d'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')]('cm_contacts')[_0x3552('0x3c')](_0x3552('0x77'))[_0x3552('0x3c')]('ListId\x20=\x20?',_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())['where'](_0x3552('0x7f')))[_0x3552('0x74')]();}_0x5dd02a=squel['insert']()['into'](_0x3552('0x81'))[_0x3552('0x6e')]([_0x3552('0x82'),_0x3552('0x80'),'phone',_0x3552('0x83'),_0x3552('0x55'),'updatedAt'],squel[_0x3552('0x70')]()[_0x3552('0x72')](_0x3552('0x84'),'id')[_0x3552('0x72')]('NOW()',_0x3552('0x80'))[_0x3552('0x72')](_0x3552('0x85'),_0x3552('0x71'))[_0x3552('0x72')](_0x3552('0x86'),_0x3552('0x83'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x55'))[_0x3552('0x72')]('\x27'+_0x47d898+'\x27',_0x3552('0x56'))[_0x3552('0x75')](_0x3552('0x87'),'ci')[_0x3552('0x88')](_0x3552('0x6d'),'h',_0x3552('0x89'))[_0x3552('0x3c')](_0x3552('0x8a'),_0x3721db[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x8b'),_0x155529[_0x3552('0x47')]['id'][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x8c'),_0x47d898))['toString']();_0x46d1be[_0x3552('0x8d')](db[_0x3552('0x8e')][_0x3552('0x37')](_0x392eb4));_0xe15d9b[_0x3552('0x8d')](db['sequelize'][_0x3552('0x37')](_0x5dd02a));}return BPromise[_0x3552('0x8f')](_0x46d1be);}})[_0x3552('0x23')](function(){return BPromise[_0x3552('0x8f')](_0xe15d9b);})[_0x3552('0x23')](function(){return _0x35a9bc;})[_0x3552('0x23')](respondWithResult(_0xfdec5c,null))['catch'](handleError(_0xfdec5c,null));};exports[_0x3552('0x90')]=function(_0x22f37a,_0x5809c2,_0x367601){return db['Campaign'][_0x3552('0x49')]({'where':{'id':_0x22f37a['params']['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x5809c2,null))[_0x3552('0x23')](function(_0x407720){if(_0x407720){return _0x407720[_0x3552('0x90')](_0x22f37a[_0x3552('0x37')][_0x3552('0x68')]);}})[_0x3552('0x23')](function(_0x100c3e){if(_0x100c3e){return db[_0x3552('0x5b')]['destroy']({'where':{'ListId':_0x22f37a['query']['ids'],'CampaignId':_0x22f37a[_0x3552('0x47')]['id']}})[_0x3552('0x23')](function(){return _0x100c3e;});}})[_0x3552('0x23')](respondWithStatusCode(_0x5809c2,null))[_0x3552('0x46')](handleError(_0x5809c2,null));};exports[_0x3552('0x91')]=function(_0x2fd053,_0xbdd748,_0x3cca8e){var _0x2e65fe={};var _0x3258be={};var _0x505bdf;var _0x1297a7;return db['Campaign'][_0x3552('0x5a')]({'where':{'id':_0x2fd053[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0xbdd748,null))[_0x3552('0x23')](function(_0x39d646){if(_0x39d646){_0x505bdf=_0x39d646;_0x3258be['model']=_[_0x3552('0x48')](db[_0x3552('0x64')]['rawAttributes']);_0x3258be[_0x3552('0x37')]=_[_0x3552('0x48')](_0x2fd053[_0x3552('0x37')]);_0x3258be[_0x3552('0x33')]=_[_0x3552('0x34')](_0x3258be[_0x3552('0x31')],_0x3258be[_0x3552('0x37')]);_0x2e65fe['attributes']=_[_0x3552('0x34')](_0x3258be[_0x3552('0x31')],qs[_0x3552('0x36')](_0x2fd053[_0x3552('0x37')]['fields']));_0x2e65fe['attributes']=_0x2e65fe[_0x3552('0x35')]['length']?_0x2e65fe['attributes']:_0x3258be[_0x3552('0x31')];_0x2e65fe[_0x3552('0x3a')]=qs[_0x3552('0x3b')](_0x2fd053[_0x3552('0x37')][_0x3552('0x3b')]);_0x2e65fe[_0x3552('0x3c')]=qs[_0x3552('0x33')](_[_0x3552('0x3d')](_0x2fd053[_0x3552('0x37')],_0x3258be[_0x3552('0x33')]));if(_0x2fd053[_0x3552('0x37')][_0x3552('0x3e')]){_0x2e65fe[_0x3552('0x3c')]=_[_0x3552('0x3f')](_0x2e65fe[_0x3552('0x3c')],{'$or':_[_0x3552('0x32')](_0x2e65fe[_0x3552('0x35')],function(_0x1d949e){var _0x818236={};_0x818236[_0x1d949e]={'$like':'%'+_0x2fd053[_0x3552('0x37')][_0x3552('0x3e')]+'%'};return _0x818236;})});}_0x2e65fe=_['merge']({},_0x2e65fe,_0x2fd053[_0x3552('0x41')]);return _0x505bdf[_0x3552('0x91')](_0x2e65fe);}})[_0x3552('0x23')](function(_0x44cd4e){if(_0x44cd4e){_0x1297a7=_0x44cd4e[_0x3552('0x38')];if(!_0x2fd053[_0x3552('0x37')][_0x3552('0x39')]('nolimit')){_0x2e65fe[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x2fd053[_0x3552('0x37')]['limit']);_0x2e65fe[_0x3552('0x1b')]=qs[_0x3552('0x1b')](_0x2fd053[_0x3552('0x37')][_0x3552('0x1b')]);}return _0x505bdf['getBlackLists'](_0x2e65fe);}})[_0x3552('0x23')](function(_0x298650){if(_0x298650){return _0x298650?{'count':_0x1297a7,'rows':_0x298650}:null;}})[_0x3552('0x23')](respondWithResult(_0xbdd748,null))[_0x3552('0x46')](handleError(_0xbdd748,null));};exports[_0x3552('0x92')]=function(_0x1c12a3,_0x3c8eb2,_0x6bf543){var _0x4e2c47,_0x3f162a;var _0x3350fb=[];var _0x4c7e23=moment()[_0x3552('0x65')](_0x3552('0x66'));return db[_0x3552('0x42')][_0x3552('0x49')]({'where':{'id':_0x1c12a3[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x3c8eb2,null))[_0x3552('0x23')](function(_0xe92ed0){if(_0xe92ed0){_0x3f162a=_0xe92ed0;return _0xe92ed0[_0x3552('0x92')](_0x1c12a3['body'][_0x3552('0x68')],_[_0x3552('0x93')](_0x1c12a3['body'],[_0x3552('0x68'),'id'])||{});}return null;})[_0x3552('0x69')](function(_0x1d31e8){var _0x24fef4;var _0x58fc52;_0x4e2c47=_0x1d31e8||[];var _0x4e59c9=[];if(_0x1d31e8){for(var _0x273202=0x0;_0x273202<_0x1d31e8[_0x3552('0x38')];_0x273202+=0x1){var _0x55febe=_0x1d31e8[_0x273202]['get']({'plain':!![]});_0x24fef4=squel[_0x3552('0x94')]()[_0x3552('0x6c')](_0x3552('0x95'))[_0x3552('0x6e')](['phone',_0x3552('0x7d'),'ListId',_0x3552('0x5d'),_0x3552('0x55'),'updatedAt'],squel['select']()[_0x3552('0x72')]('phone',_0x3552('0x71'))[_0x3552('0x72')]('id',_0x3552('0x7d'))['field'](_0x55febe[_0x3552('0x78')][_0x3552('0x74')](),_0x3552('0x6f'))[_0x3552('0x72')](_0x1c12a3[_0x3552('0x47')]['id'][_0x3552('0x74')](),'CampaignId')[_0x3552('0x72')](_0x3552('0x73'),_0x3552('0x55'))[_0x3552('0x72')](_0x3552('0x73'),_0x3552('0x56'))['from'](_0x3552('0x76'))[_0x3552('0x3c')](_0x3552('0x77'))['where']('ListId\x20=\x20?',_0x55febe[_0x3552('0x78')][_0x3552('0x74')]())[_0x3552('0x3c')](_0x3552('0x7f')))[_0x3552('0x74')]();_0x4e59c9['push'](db['sequelize'][_0x3552('0x37')](_0x24fef4));}return BPromise[_0x3552('0x8f')](_0x4e59c9);}})[_0x3552('0x23')](function(){return _0x4e2c47;})[_0x3552('0x23')](respondWithResult(_0x3c8eb2,null))['catch'](handleError(_0x3c8eb2,null));};exports[_0x3552('0x96')]=function(_0x29acd0,_0x4c6ee0,_0x317239){return db[_0x3552('0x42')][_0x3552('0x49')]({'where':{'id':_0x29acd0[_0x3552('0x47')]['id']}})[_0x3552('0x23')](handleEntityNotFound(_0x4c6ee0,null))[_0x3552('0x23')](function(_0x59cf51){if(_0x59cf51){return _0x59cf51[_0x3552('0x96')](_0x29acd0[_0x3552('0x37')][_0x3552('0x68')]);}})[_0x3552('0x23')](function(_0x42cd52){if(_0x42cd52){return db['CmHopperBlack'][_0x3552('0x24')]({'where':{'ListId':_0x29acd0[_0x3552('0x37')]['ids'],'CampaignId':_0x29acd0[_0x3552('0x47')]['id']}})['then'](function(){return _0x42cd52;});}})[_0x3552('0x23')](respondWithStatusCode(_0x4c6ee0,null))[_0x3552('0x46')](handleError(_0x4c6ee0,null));};
\ No newline at end of file
index 2410210..afdc304 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x381f7e,_0x16aa4a){var _0x1c869f=function(_0xf4378d){while(--_0xf4378d){_0x381f7e['push'](_0x381f7e['shift']());}};_0x1c869f(++_0x16aa4a);}(_0x7a54,0x106));var _0x47a5=function(_0x4f2395,_0x5c2436){_0x4f2395=_0x4f2395-0x0;var _0x3f75ac=_0x7a54[_0x4f2395];return _0x3f75ac;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index bec76c4..f05638c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x12cc=['code','message','catch','GetCampaign','Campaign','findAll','options','raw','attributes','limit','map','include','model','debug','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x13b8d8,_0x338fcf){var _0x2bc3e9=function(_0xb4913c){while(--_0xb4913c){_0x13b8d8['push'](_0x13b8d8['shift']());}};_0x2bc3e9(++_0x338fcf);}(_0x12cc,0xc2));var _0xc12c=function(_0x416b64,_0x2c4ccd){_0x416b64=_0x416b64-0x0;var _0x490919=_0x12cc[_0x416b64];return _0x490919;};'use strict';var _=require('lodash');var util=require(_0xc12c('0x0'));var moment=require(_0xc12c('0x1'));var BPromise=require(_0xc12c('0x2'));var rs=require(_0xc12c('0x3'));var fs=require('fs');var Redis=require(_0xc12c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc12c('0x5'))(_0xc12c('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc12c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c0435,_0xe572e1,_0x52017f){return new BPromise(function(_0x488940,_0x2f11ba){return client[_0xc12c('0x8')](_0x1c0435,_0x52017f)[_0xc12c('0x9')](function(_0x53bde7){logger[_0xc12c('0xa')](_0xc12c('0xb'),_0xe572e1,_0xc12c('0xc'));logger['debug'](_0xc12c('0xd'),_0xe572e1,_0xc12c('0xc'),JSON[_0xc12c('0xe')](_0x53bde7));if(_0x53bde7[_0xc12c('0xf')]){if(_0x53bde7[_0xc12c('0xf')][_0xc12c('0x10')]===0x1f4){logger['error'](_0xc12c('0xb'),_0xe572e1,_0x53bde7[_0xc12c('0xf')][_0xc12c('0x11')]);return _0x2f11ba(_0x53bde7['error']['message']);}logger[_0xc12c('0xf')]('Campaign,\x20%s,\x20%s',_0xe572e1,_0x53bde7[_0xc12c('0xf')][_0xc12c('0x11')]);return _0x488940(_0x53bde7['error'][_0xc12c('0x11')]);}else{logger['info'](_0xc12c('0xb'),_0xe572e1,_0xc12c('0xc'));_0x488940(_0x53bde7['result']['message']);}})[_0xc12c('0x12')](function(_0x18dca7){logger['error'](_0xc12c('0xb'),_0xe572e1,_0x18dca7);_0x2f11ba(_0x18dca7);});});}exports[_0xc12c('0x13')]=function(_0x5c0c82){var _0x9fba66=this;return new Promise(function(_0x19a59a,_0x5ef398){return db[_0xc12c('0x14')][_0xc12c('0x15')]({'raw':_0x5c0c82[_0xc12c('0x16')]?_0x5c0c82['options'][_0xc12c('0x17')]===undefined?!![]:![]:!![],'where':_0x5c0c82[_0xc12c('0x16')]?_0x5c0c82['options']['where']||null:null,'attributes':_0x5c0c82['options']?_0x5c0c82[_0xc12c('0x16')][_0xc12c('0x18')]||null:null,'limit':_0x5c0c82[_0xc12c('0x16')]?_0x5c0c82[_0xc12c('0x16')][_0xc12c('0x19')]||null:null,'include':_0x5c0c82[_0xc12c('0x16')]?_0x5c0c82[_0xc12c('0x16')]['include']?_[_0xc12c('0x1a')](_0x5c0c82[_0xc12c('0x16')][_0xc12c('0x1b')],function(_0x3423f4){return{'model':db[_0x3423f4[_0xc12c('0x1c')]],'as':_0x3423f4['as'],'attributes':_0x3423f4[_0xc12c('0x18')],'include':_0x3423f4[_0xc12c('0x1b')]?_[_0xc12c('0x1a')](_0x3423f4[_0xc12c('0x1b')],function(_0x42d01c){return{'model':db[_0x42d01c[_0xc12c('0x1c')]],'as':_0x42d01c['as'],'attributes':_0x42d01c[_0xc12c('0x18')],'include':_0x42d01c[_0xc12c('0x1b')]?_[_0xc12c('0x1a')](_0x42d01c[_0xc12c('0x1b')],function(_0x4c1fc0){return{'model':db[_0x4c1fc0['model']],'as':_0x4c1fc0['as'],'attributes':_0x4c1fc0[_0xc12c('0x18')]};}):[]};}):[]};}):[]:[]})[_0xc12c('0x9')](function(_0x5b2e7e){logger[_0xc12c('0xa')](_0xc12c('0x13'),_0x5c0c82);logger[_0xc12c('0x1d')](_0xc12c('0x13'),_0x5c0c82,JSON['stringify'](_0x5b2e7e));_0x19a59a(_0x5b2e7e);})[_0xc12c('0x12')](function(_0x4df374){logger[_0xc12c('0xf')](_0xc12c('0x13'),_0x4df374['message'],_0x5c0c82);_0x5ef398(_0x9fba66['error'](0x1f4,_0x4df374['message']));});});};
\ No newline at end of file
+var _0x8c99=['limit','include','model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','findAll','options','raw','attributes'];(function(_0x31e94d,_0x19454d){var _0x2fbb0a=function(_0x5ac89b){while(--_0x5ac89b){_0x31e94d['push'](_0x31e94d['shift']());}};_0x2fbb0a(++_0x19454d);}(_0x8c99,0x1a8));var _0x98c9=function(_0xaaf2e2,_0x19d28a){_0xaaf2e2=_0xaaf2e2-0x0;var _0x28bc36=_0x8c99[_0xaaf2e2];return _0x28bc36;};'use strict';var _=require(_0x98c9('0x0'));var util=require(_0x98c9('0x1'));var moment=require(_0x98c9('0x2'));var BPromise=require(_0x98c9('0x3'));var rs=require(_0x98c9('0x4'));var fs=require('fs');var Redis=require(_0x98c9('0x5'));var db=require(_0x98c9('0x6'))['db'];var utils=require(_0x98c9('0x7'));var logger=require(_0x98c9('0x8'))(_0x98c9('0x9'));var config=require(_0x98c9('0xa'));var jayson=require(_0x98c9('0xb'));var client=jayson['client'][_0x98c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ed2b6,_0x538465,_0x4af8a6){return new BPromise(function(_0x5b983e,_0xc789b1){return client[_0x98c9('0xd')](_0x2ed2b6,_0x4af8a6)[_0x98c9('0xe')](function(_0x4052cf){logger[_0x98c9('0xf')](_0x98c9('0x10'),_0x538465,_0x98c9('0x11'));logger[_0x98c9('0x12')](_0x98c9('0x13'),_0x538465,_0x98c9('0x11'),JSON[_0x98c9('0x14')](_0x4052cf));if(_0x4052cf['error']){if(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x16')]===0x1f4){logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x4052cf['error'][_0x98c9('0x17')]);return _0xc789b1(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x17')]);}logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x4052cf['error'][_0x98c9('0x17')]);return _0x5b983e(_0x4052cf[_0x98c9('0x15')][_0x98c9('0x17')]);}else{logger[_0x98c9('0xf')](_0x98c9('0x10'),_0x538465,_0x98c9('0x11'));_0x5b983e(_0x4052cf[_0x98c9('0x18')][_0x98c9('0x17')]);}})[_0x98c9('0x19')](function(_0x2bb8b6){logger[_0x98c9('0x15')](_0x98c9('0x10'),_0x538465,_0x2bb8b6);_0xc789b1(_0x2bb8b6);});});}exports[_0x98c9('0x1a')]=function(_0x39ed74){var _0x534903=this;return new Promise(function(_0x351254,_0x22fe71){return db['Campaign'][_0x98c9('0x1b')]({'raw':_0x39ed74['options']?_0x39ed74[_0x98c9('0x1c')][_0x98c9('0x1d')]===undefined?!![]:![]:!![],'where':_0x39ed74[_0x98c9('0x1c')]?_0x39ed74[_0x98c9('0x1c')]['where']||null:null,'attributes':_0x39ed74[_0x98c9('0x1c')]?_0x39ed74[_0x98c9('0x1c')][_0x98c9('0x1e')]||null:null,'limit':_0x39ed74[_0x98c9('0x1c')]?_0x39ed74['options'][_0x98c9('0x1f')]||null:null,'include':_0x39ed74[_0x98c9('0x1c')]?_0x39ed74[_0x98c9('0x1c')][_0x98c9('0x20')]?_['map'](_0x39ed74['options'][_0x98c9('0x20')],function(_0x4373cc){return{'model':db[_0x4373cc[_0x98c9('0x21')]],'as':_0x4373cc['as'],'attributes':_0x4373cc['attributes'],'include':_0x4373cc['include']?_['map'](_0x4373cc[_0x98c9('0x20')],function(_0x1653e0){return{'model':db[_0x1653e0['model']],'as':_0x1653e0['as'],'attributes':_0x1653e0[_0x98c9('0x1e')],'include':_0x1653e0[_0x98c9('0x20')]?_[_0x98c9('0x22')](_0x1653e0[_0x98c9('0x20')],function(_0x3f503a){return{'model':db[_0x3f503a[_0x98c9('0x21')]],'as':_0x3f503a['as'],'attributes':_0x3f503a['attributes']};}):[]};}):[]};}):[]:[]})[_0x98c9('0xe')](function(_0x361305){logger[_0x98c9('0xf')](_0x98c9('0x1a'),_0x39ed74);logger[_0x98c9('0x12')]('GetCampaign',_0x39ed74,JSON[_0x98c9('0x14')](_0x361305));_0x351254(_0x361305);})[_0x98c9('0x19')](function(_0x58c6e3){logger[_0x98c9('0x15')]('GetCampaign',_0x58c6e3['message'],_0x39ed74);_0x22fe71(_0x534903[_0x98c9('0x15')](0x1f4,_0x58c6e3['message']));});});};
\ No newline at end of file
index e0a750f..d92f500 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x193c=['getLists','/:id/blacklists','getBlackLists','post','addLists','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','getHopperBlacks','/:id/lists'];(function(_0x133cbc,_0x575485){var _0x4c040b=function(_0x2fa05b){while(--_0x2fa05b){_0x133cbc['push'](_0x133cbc['shift']());}};_0x4c040b(++_0x575485);}(_0x193c,0x1a3));var _0xc193=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x193c[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xc193('0x0'));var util=require(_0xc193('0x1'));var path=require(_0xc193('0x2'));var timeout=require(_0xc193('0x3'));var express=require('express');var router=express[_0xc193('0x4')]();var fs_extra=require(_0xc193('0x5'));var auth=require(_0xc193('0x6'));var interaction=require(_0xc193('0x7'));var config=require(_0xc193('0x8'));var controller=require(_0xc193('0x9'));router[_0xc193('0xa')]('/',auth[_0xc193('0xb')](),controller[_0xc193('0xc')]);router[_0xc193('0xa')](_0xc193('0xd'),auth[_0xc193('0xb')](),controller[_0xc193('0xe')]);router[_0xc193('0xa')](_0xc193('0xf'),auth['isAuthenticated'](),controller[_0xc193('0x10')]);router['get'](_0xc193('0x11'),auth[_0xc193('0xb')](),controller[_0xc193('0x12')]);router[_0xc193('0xa')](_0xc193('0x13'),auth[_0xc193('0xb')](),controller[_0xc193('0x14')]);router[_0xc193('0xa')]('/:id/hopper_black',auth['isAuthenticated'](),controller[_0xc193('0x15')]);router['get'](_0xc193('0x16'),auth[_0xc193('0xb')](),controller[_0xc193('0x17')]);router[_0xc193('0xa')](_0xc193('0x18'),auth[_0xc193('0xb')](),controller[_0xc193('0x19')]);router[_0xc193('0x1a')]('/',auth[_0xc193('0xb')](),controller['create']);router[_0xc193('0x1a')]('/:id/clone',auth[_0xc193('0xb')](),controller['clone']);router[_0xc193('0x1a')](_0xc193('0x16'),auth[_0xc193('0xb')](),controller[_0xc193('0x1b')]);router[_0xc193('0x1a')](_0xc193('0x18'),auth[_0xc193('0xb')](),controller['addBlackLists']);router['put']('/:id',auth[_0xc193('0xb')](),controller[_0xc193('0x1c')]);router[_0xc193('0x1d')](_0xc193('0xd'),auth[_0xc193('0xb')](),controller[_0xc193('0x1e')]);router[_0xc193('0x1d')]('/:id/lists',auth[_0xc193('0xb')](),controller[_0xc193('0x1f')]);router[_0xc193('0x1d')](_0xc193('0x18'),auth[_0xc193('0xb')](),controller[_0xc193('0x20')]);module[_0xc193('0x21')]=router;
\ No newline at end of file
+var _0x0a8d=['index','/:id','/:id/hoppers','getHoppers','getHopperHistories','/:id/hopper_black','getHopperBlacks','getBlackLists','create','/:id/clone','post','/:id/lists','addLists','/:id/blacklists','addBlackLists','put','update','delete','destroy','removeBlackLists','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x4e6588,_0x18805c){var _0x4d9433=function(_0xceab8a){while(--_0xceab8a){_0x4e6588['push'](_0x4e6588['shift']());}};_0x4d9433(++_0x18805c);}(_0x0a8d,0x89));var _0xd0a8=function(_0x1023ab,_0x2a9604){_0x1023ab=_0x1023ab-0x0;var _0x10701d=_0x0a8d[_0x1023ab];return _0x10701d;};'use strict';var multer=require(_0xd0a8('0x0'));var util=require(_0xd0a8('0x1'));var path=require('path');var timeout=require(_0xd0a8('0x2'));var express=require(_0xd0a8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd0a8('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd0a8('0x5'));var controller=require('./campaign.controller');router[_0xd0a8('0x6')]('/',auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x8')]);router['get'](_0xd0a8('0x9'),auth['isAuthenticated'](),controller['show']);router['get'](_0xd0a8('0xa'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0xb')]);router[_0xd0a8('0x6')]('/:id/hopper_histories',auth['isAuthenticated'](),controller[_0xd0a8('0xc')]);router[_0xd0a8('0x6')]('/:id/hopper_finals',auth[_0xd0a8('0x7')](),controller['getHopperFinals']);router[_0xd0a8('0x6')](_0xd0a8('0xd'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0xe')]);router[_0xd0a8('0x6')]('/:id/lists',auth[_0xd0a8('0x7')](),controller['getLists']);router[_0xd0a8('0x6')]('/:id/blacklists',auth[_0xd0a8('0x7')](),controller[_0xd0a8('0xf')]);router['post']('/',auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x10')]);router['post'](_0xd0a8('0x11'),auth[_0xd0a8('0x7')](),controller['clone']);router[_0xd0a8('0x12')](_0xd0a8('0x13'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x14')]);router[_0xd0a8('0x12')](_0xd0a8('0x15'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x16')]);router[_0xd0a8('0x17')](_0xd0a8('0x9'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x18')]);router[_0xd0a8('0x19')](_0xd0a8('0x9'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x1a')]);router[_0xd0a8('0x19')](_0xd0a8('0x13'),auth[_0xd0a8('0x7')](),controller['removeLists']);router[_0xd0a8('0x19')](_0xd0a8('0x15'),auth[_0xd0a8('0x7')](),controller[_0xd0a8('0x1b')]);module[_0xd0a8('0x1c')]=router;
\ No newline at end of file
index 4642e89..f6bdcc4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0de8=['medium','STRING','key','sequelize','exports','TEXT'];(function(_0x173d2a,_0x1ef548){var _0x222a13=function(_0x527b08){while(--_0x527b08){_0x173d2a['push'](_0x173d2a['shift']());}};_0x222a13(++_0x1ef548);}(_0x0de8,0xa5));var _0x80de=function(_0x308c00,_0x3cbd67){_0x308c00=_0x308c00-0x0;var _0x2b21b2=_0x0de8[_0x308c00];return _0x2b21b2;};'use strict';var Sequelize=require(_0x80de('0x0'));module[_0x80de('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x80de('0x2')],'length':_0x80de('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x80de('0x4')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x80de('0x5'));}}};
\ No newline at end of file
+var _0x14b5=['exports','STRING','medium','VIRTUAL','getDataValue','key','sequelize'];(function(_0x2c5d0c,_0x2efb70){var _0x4d7408=function(_0x1e66fe){while(--_0x1e66fe){_0x2c5d0c['push'](_0x2c5d0c['shift']());}};_0x4d7408(++_0x2efb70);}(_0x14b5,0x1a3));var _0x514b=function(_0xcea3b6,_0x434ab3){_0xcea3b6=_0xcea3b6-0x0;var _0x285105=_0x14b5[_0xcea3b6];return _0x285105;};'use strict';var Sequelize=require(_0x514b('0x0'));module[_0x514b('0x1')]={'key':{'type':Sequelize[_0x514b('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x514b('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x514b('0x2')]},'name':{'type':Sequelize[_0x514b('0x4')],'get':function(){return this[_0x514b('0x5')](_0x514b('0x6'));}}};
\ No newline at end of file
index 488c1b8..1cf3142 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1444=['undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','send','index','map','CannedAnswer','type','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json'];(function(_0x30fe44,_0x3bd693){var _0x55c965=function(_0x51e40b){while(--_0x51e40b){_0x30fe44['push'](_0x30fe44['shift']());}};_0x55c965(++_0x3bd693);}(_0x1444,0x94));var _0x4144=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x1444[_0x20ef64];return _0x3707d8;};'use strict';var emlformat=require(_0x4144('0x0'));var rimraf=require(_0x4144('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4144('0x2'));var rp=require(_0x4144('0x3'));var moment=require(_0x4144('0x4'));var BPromise=require(_0x4144('0x5'));var Mustache=require(_0x4144('0x6'));var util=require('util');var path=require(_0x4144('0x7'));var sox=require(_0x4144('0x8'));var csv=require(_0x4144('0x9'));var ejs=require(_0x4144('0xa'));var fs=require('fs');var fs_extra=require(_0x4144('0xb'));var _=require('lodash');var squel=require(_0x4144('0xc'));var crypto=require('crypto');var jsforce=require(_0x4144('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4144('0x9'));var querystring=require(_0x4144('0xe'));var Papa=require(_0x4144('0xf'));var Redis=require(_0x4144('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4144('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4144('0x12'));var logger=require('../../config/logger')(_0x4144('0x13'));var utils=require(_0x4144('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4144('0x15'));var db=require(_0x4144('0x16'))['db'];function respondWithStatusCode(_0x261b81,_0x382796){_0x382796=_0x382796||0xcc;return function(_0xf97c6a){if(_0xf97c6a){return _0x261b81[_0x4144('0x17')](_0x382796);}return _0x261b81['status'](_0x382796)[_0x4144('0x18')]();};}function respondWithResult(_0x1b9efd,_0x24a73c){_0x24a73c=_0x24a73c||0xc8;return function(_0x330c89){if(_0x330c89){return _0x1b9efd['status'](_0x24a73c)[_0x4144('0x19')](_0x330c89);}};}function respondWithFilteredResult(_0x1e38fa,_0x15724a){return function(_0xa3e2b8){if(_0xa3e2b8){var _0x29e2de=typeof _0x15724a['offset']==='undefined'&&typeof _0x15724a['limit']===_0x4144('0x1a');var _0x36328c=_0xa3e2b8[_0x4144('0x1b')];var _0x2ad46e=_0x29e2de?0x0:_0x15724a[_0x4144('0x1c')];var _0x4e0b16=_0x29e2de?_0xa3e2b8[_0x4144('0x1b')]:_0x15724a[_0x4144('0x1c')]+_0x15724a[_0x4144('0x1d')];var _0x388fb3;if(_0x4e0b16>=_0x36328c){_0x4e0b16=_0x36328c;_0x388fb3=0xc8;}else{_0x388fb3=0xce;}_0x1e38fa['status'](_0x388fb3);return _0x1e38fa[_0x4144('0x1e')](_0x4144('0x1f'),_0x2ad46e+'-'+_0x4e0b16+'/'+_0x36328c)['json'](_0xa3e2b8);}return null;};}function patchUpdates(_0x62aacb){return function(_0x50e9fd){try{jsonpatch[_0x4144('0x20')](_0x50e9fd,_0x62aacb,!![]);}catch(_0x306476){return BPromise[_0x4144('0x21')](_0x306476);}return _0x50e9fd['save']();};}function saveUpdates(_0x3b4fa7,_0x2cbfac){return function(_0x13d39e){if(_0x13d39e){return _0x13d39e[_0x4144('0x22')](_0x3b4fa7)[_0x4144('0x23')](function(_0x5d8cf4){return _0x5d8cf4;});}return null;};}function removeEntity(_0x1dc935,_0x3d107c){return function(_0x296bb1){if(_0x296bb1){return _0x296bb1[_0x4144('0x24')]()[_0x4144('0x23')](function(){var _0xb40341=_0x296bb1[_0x4144('0x25')]({'plain':!![]});var _0x4c2ceb=_0x4144('0x26');return db[_0x4144('0x27')][_0x4144('0x24')]({'where':{'type':_0x4c2ceb,'resourceId':_0xb40341['id']}})[_0x4144('0x23')](function(){return _0x296bb1;});})[_0x4144('0x23')](function(){_0x1dc935['status'](0xcc)[_0x4144('0x18')]();});}};}function handleEntityNotFound(_0x5492c0,_0x20ae73){return function(_0x20e835){if(!_0x20e835){_0x5492c0[_0x4144('0x17')](0x194);}return _0x20e835;};}function handleError(_0x33c541,_0x4054b9){_0x4054b9=_0x4054b9||0x1f4;return function(_0x2e6a5d){logger[_0x4144('0x28')](_0x2e6a5d[_0x4144('0x29')]);if(_0x2e6a5d['name']){delete _0x2e6a5d['name'];}_0x33c541['status'](_0x4054b9)[_0x4144('0x2a')](_0x2e6a5d);};}exports[_0x4144('0x2b')]=function(_0x28daca,_0x406dd4){var _0x2a4597={},_0x52dfd0={},_0x22f132={'count':0x0,'rows':[]};var _0x3524ab=_[_0x4144('0x2c')](db[_0x4144('0x2d')]['rawAttributes'],function(_0x58734c){return{'name':_0x58734c['fieldName'],'type':_0x58734c[_0x4144('0x2e')]['key']};});_0x52dfd0[_0x4144('0x2f')]=_[_0x4144('0x2c')](_0x3524ab,_0x4144('0x30'));_0x52dfd0['query']=_[_0x4144('0x31')](_0x28daca[_0x4144('0x32')]);_0x52dfd0['filters']=_[_0x4144('0x33')](_0x52dfd0[_0x4144('0x2f')],_0x52dfd0['query']);_0x2a4597[_0x4144('0x34')]=_[_0x4144('0x33')](_0x52dfd0[_0x4144('0x2f')],qs[_0x4144('0x35')](_0x28daca[_0x4144('0x32')][_0x4144('0x35')]));_0x2a4597[_0x4144('0x34')]=_0x2a4597[_0x4144('0x34')][_0x4144('0x36')]?_0x2a4597[_0x4144('0x34')]:_0x52dfd0[_0x4144('0x2f')];if(!_0x28daca[_0x4144('0x32')][_0x4144('0x37')]('nolimit')){_0x2a4597[_0x4144('0x1d')]=qs[_0x4144('0x1d')](_0x28daca['query'][_0x4144('0x1d')]);_0x2a4597[_0x4144('0x1c')]=qs[_0x4144('0x1c')](_0x28daca[_0x4144('0x32')][_0x4144('0x1c')]);}_0x2a4597[_0x4144('0x38')]=qs[_0x4144('0x39')](_0x28daca['query'][_0x4144('0x39')]);_0x2a4597[_0x4144('0x3a')]=qs[_0x4144('0x3b')](_['pick'](_0x28daca[_0x4144('0x32')],_0x52dfd0['filters']),_0x3524ab);if(_0x28daca[_0x4144('0x32')][_0x4144('0x3c')]){_0x2a4597[_0x4144('0x3a')]=_[_0x4144('0x3d')](_0x2a4597[_0x4144('0x3a')],{'$or':[{'key':{'$like':'%'+_0x28daca[_0x4144('0x32')][_0x4144('0x3c')]+'%'}},{'value':{'$like':'%'+_0x28daca[_0x4144('0x32')][_0x4144('0x3c')]+'%'}}]});}_0x2a4597=_['merge']({},_0x2a4597,_0x28daca[_0x4144('0x3e')]);var _0x42fb05={'where':_0x2a4597[_0x4144('0x3a')]};return db[_0x4144('0x2d')]['count'](_0x42fb05)[_0x4144('0x23')](function(_0x361936){_0x22f132['count']=_0x361936;if(_0x28daca[_0x4144('0x32')][_0x4144('0x3f')]){_0x2a4597[_0x4144('0x40')]=[{'all':!![]}];}return db[_0x4144('0x2d')][_0x4144('0x41')](_0x2a4597);})[_0x4144('0x23')](function(_0x346e89){_0x22f132[_0x4144('0x42')]=_0x346e89;return _0x22f132;})[_0x4144('0x23')](respondWithFilteredResult(_0x406dd4,_0x2a4597))[_0x4144('0x43')](handleError(_0x406dd4,null));};exports[_0x4144('0x44')]=function(_0xf657a1,_0x1a8339){var _0x42dc39={'raw':!![],'where':{'id':_0xf657a1[_0x4144('0x45')]['id']}},_0x4541ec={};_0x4541ec[_0x4144('0x2f')]=_[_0x4144('0x31')](db[_0x4144('0x2d')]['rawAttributes']);_0x4541ec['query']=_[_0x4144('0x31')](_0xf657a1[_0x4144('0x32')]);_0x4541ec[_0x4144('0x3b')]=_[_0x4144('0x33')](_0x4541ec[_0x4144('0x2f')],_0x4541ec[_0x4144('0x32')]);_0x42dc39[_0x4144('0x34')]=_[_0x4144('0x33')](_0x4541ec[_0x4144('0x2f')],qs[_0x4144('0x35')](_0xf657a1['query'][_0x4144('0x35')]));_0x42dc39[_0x4144('0x34')]=_0x42dc39[_0x4144('0x34')][_0x4144('0x36')]?_0x42dc39[_0x4144('0x34')]:_0x4541ec[_0x4144('0x2f')];if(_0xf657a1[_0x4144('0x32')][_0x4144('0x3f')]){_0x42dc39[_0x4144('0x40')]=[{'all':!![]}];}_0x42dc39=_[_0x4144('0x3d')]({},_0x42dc39,_0xf657a1['options']);return db[_0x4144('0x2d')]['find'](_0x42dc39)[_0x4144('0x23')](handleEntityNotFound(_0x1a8339,null))[_0x4144('0x23')](respondWithResult(_0x1a8339,null))[_0x4144('0x43')](handleError(_0x1a8339,null));};exports[_0x4144('0x22')]=function(_0x40cfd2,_0x294462){if(_0x40cfd2['body']['id']){delete _0x40cfd2[_0x4144('0x46')]['id'];}return db[_0x4144('0x2d')][_0x4144('0x47')]({'where':{'id':_0x40cfd2[_0x4144('0x45')]['id']}})[_0x4144('0x23')](handleEntityNotFound(_0x294462,null))[_0x4144('0x23')](saveUpdates(_0x40cfd2[_0x4144('0x46')],null))['then'](respondWithResult(_0x294462,null))[_0x4144('0x43')](handleError(_0x294462,null));};exports[_0x4144('0x24')]=function(_0x7b990e,_0x572e05){return db['CannedAnswer'][_0x4144('0x47')]({'where':{'id':_0x7b990e[_0x4144('0x45')]['id']}})[_0x4144('0x23')](handleEntityNotFound(_0x572e05,null))[_0x4144('0x23')](removeEntity(_0x572e05,null))[_0x4144('0x43')](handleError(_0x572e05,null));};exports[_0x4144('0x48')]=function(_0x4efa83,_0x68cdfd){var _0x4c830c={'key':_0x4efa83['body'][_0x4144('0x49')]};if(_0x4efa83[_0x4144('0x46')][_0x4144('0x4a')]){_0x4c830c[_0x4144('0x4a')]=_0x4efa83['body'][_0x4144('0x4a')];}else if(_0x4efa83['body']['SmsAccountId']){_0x4c830c['SmsAccountId']=_0x4efa83[_0x4144('0x46')][_0x4144('0x4b')];}else if(_0x4efa83[_0x4144('0x46')][_0x4144('0x4c')]){_0x4c830c[_0x4144('0x4c')]=_0x4efa83['body'][_0x4144('0x4c')];}else if(_0x4efa83[_0x4144('0x46')][_0x4144('0x4d')]){_0x4c830c[_0x4144('0x4d')]=_0x4efa83['body'][_0x4144('0x4d')];}return db[_0x4144('0x2d')]['find']({'where':_0x4c830c})[_0x4144('0x23')](function(_0x4f22b3){if(_0x4f22b3){throw new db[(_0x4144('0x4e'))][(_0x4144('0x4f'))](_0x4144('0x50'));}return db[_0x4144('0x2d')][_0x4144('0x48')](_0x4efa83[_0x4144('0x46')]);})[_0x4144('0x23')](function(_0x258cad){var _0x41aa30=_0x4efa83['user'][_0x4144('0x25')]({'plain':!![]});if(!_0x41aa30)throw new Error(_0x4144('0x51'));if(_0x41aa30[_0x4144('0x52')]==='user'){var _0x58b3b0=_0x258cad[_0x4144('0x25')]({'plain':!![]});return db[_0x4144('0x53')][_0x4144('0x47')]({'where':{'name':_0x4144('0x26'),'userProfileId':_0x41aa30[_0x4144('0x54')]},'raw':!![]})[_0x4144('0x23')](function(_0x1a212f){if(_0x1a212f&&_0x1a212f[_0x4144('0x55')]===0x0){return db[_0x4144('0x27')]['create']({'name':_0x58b3b0[_0x4144('0x30')],'resourceId':_0x58b3b0['id'],'type':_0x1a212f[_0x4144('0x30')],'sectionId':_0x1a212f['id']},{})[_0x4144('0x23')](function(){return _0x258cad;});}else{return _0x258cad;}})[_0x4144('0x43')](function(_0x3c9e41){logger[_0x4144('0x28')](_0x4144('0x56'),_0x3c9e41);throw _0x3c9e41;});}return _0x258cad;})[_0x4144('0x23')](respondWithResult(_0x68cdfd,0xc9))[_0x4144('0x43')](handleError(_0x68cdfd,null));};
\ No newline at end of file
+var _0x8927=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','CannedAnswer','include','findAll','show','params','find','catch','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','then','destroy','get','CannedAnswers','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key'];(function(_0x451d1b,_0x491c93){var _0x1fed5e=function(_0x3aebcd){while(--_0x3aebcd){_0x451d1b['push'](_0x451d1b['shift']());}};_0x1fed5e(++_0x491c93);}(_0x8927,0xdc));var _0x7892=function(_0x558f77,_0xb93712){_0x558f77=_0x558f77-0x0;var _0x4a20e3=_0x8927[_0x558f77];return _0x4a20e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7892('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7892('0x1'));var rp=require(_0x7892('0x2'));var moment=require(_0x7892('0x3'));var BPromise=require(_0x7892('0x4'));var Mustache=require(_0x7892('0x5'));var util=require(_0x7892('0x6'));var path=require(_0x7892('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x7892('0x8'));var fs=require('fs');var fs_extra=require(_0x7892('0x9'));var _=require(_0x7892('0xa'));var squel=require(_0x7892('0xb'));var crypto=require(_0x7892('0xc'));var jsforce=require(_0x7892('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7892('0xe'));var querystring=require(_0x7892('0xf'));var Papa=require(_0x7892('0x10'));var Redis=require(_0x7892('0x11'));var authService=require(_0x7892('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7892('0x13'));var hardwareService=require(_0x7892('0x14'));var logger=require(_0x7892('0x15'))('api');var utils=require(_0x7892('0x16'));var config=require(_0x7892('0x17'));var licenseUtil=require(_0x7892('0x18'));var db=require(_0x7892('0x19'))['db'];function respondWithStatusCode(_0xf802e,_0x8b3678){_0x8b3678=_0x8b3678||0xcc;return function(_0x1460d8){if(_0x1460d8){return _0xf802e[_0x7892('0x1a')](_0x8b3678);}return _0xf802e[_0x7892('0x1b')](_0x8b3678)[_0x7892('0x1c')]();};}function respondWithResult(_0x488e8f,_0x2fd5c6){_0x2fd5c6=_0x2fd5c6||0xc8;return function(_0x5210b2){if(_0x5210b2){return _0x488e8f[_0x7892('0x1b')](_0x2fd5c6)[_0x7892('0x1d')](_0x5210b2);}};}function respondWithFilteredResult(_0x1297b2,_0x223f09){return function(_0x3f44ef){if(_0x3f44ef){var _0x35c7eb=typeof _0x223f09['offset']===_0x7892('0x1e')&&typeof _0x223f09[_0x7892('0x1f')]==='undefined';var _0x34398a=_0x3f44ef['count'];var _0x3fff01=_0x35c7eb?0x0:_0x223f09[_0x7892('0x20')];var _0x504a59=_0x35c7eb?_0x3f44ef[_0x7892('0x21')]:_0x223f09['offset']+_0x223f09[_0x7892('0x1f')];var _0x28924;if(_0x504a59>=_0x34398a){_0x504a59=_0x34398a;_0x28924=0xc8;}else{_0x28924=0xce;}_0x1297b2['status'](_0x28924);return _0x1297b2[_0x7892('0x22')]('Content-Range',_0x3fff01+'-'+_0x504a59+'/'+_0x34398a)['json'](_0x3f44ef);}return null;};}function patchUpdates(_0x3835c4){return function(_0x8f97ba){try{jsonpatch[_0x7892('0x23')](_0x8f97ba,_0x3835c4,!![]);}catch(_0x490ab2){return BPromise[_0x7892('0x24')](_0x490ab2);}return _0x8f97ba[_0x7892('0x25')]();};}function saveUpdates(_0x21df42,_0x5c8400){return function(_0x3ac33c){if(_0x3ac33c){return _0x3ac33c[_0x7892('0x26')](_0x21df42)[_0x7892('0x27')](function(_0x284a49){return _0x284a49;});}return null;};}function removeEntity(_0x10144e,_0x38a97b){return function(_0x12a0a7){if(_0x12a0a7){return _0x12a0a7[_0x7892('0x28')]()['then'](function(){var _0x4396f9=_0x12a0a7[_0x7892('0x29')]({'plain':!![]});var _0x313449=_0x7892('0x2a');return db[_0x7892('0x2b')]['destroy']({'where':{'type':_0x313449,'resourceId':_0x4396f9['id']}})['then'](function(){return _0x12a0a7;});})[_0x7892('0x27')](function(){_0x10144e[_0x7892('0x1b')](0xcc)[_0x7892('0x1c')]();});}};}function handleEntityNotFound(_0x3ba5e7,_0x3842e4){return function(_0x21a8e7){if(!_0x21a8e7){_0x3ba5e7[_0x7892('0x1a')](0x194);}return _0x21a8e7;};}function handleError(_0x782131,_0x91e1f6){_0x91e1f6=_0x91e1f6||0x1f4;return function(_0x55d043){logger[_0x7892('0x2c')](_0x55d043[_0x7892('0x2d')]);if(_0x55d043[_0x7892('0x2e')]){delete _0x55d043['name'];}_0x782131['status'](_0x91e1f6)[_0x7892('0x2f')](_0x55d043);};}exports['index']=function(_0x2ae69d,_0x32d39d){var _0x619939={},_0x4c8fd1={},_0x30fc8b={'count':0x0,'rows':[]};var _0x4843ab=_[_0x7892('0x30')](db['CannedAnswer'][_0x7892('0x31')],function(_0x1e27f7){return{'name':_0x1e27f7[_0x7892('0x32')],'type':_0x1e27f7[_0x7892('0x33')][_0x7892('0x34')]};});_0x4c8fd1[_0x7892('0x35')]=_[_0x7892('0x30')](_0x4843ab,_0x7892('0x2e'));_0x4c8fd1[_0x7892('0x36')]=_[_0x7892('0x37')](_0x2ae69d[_0x7892('0x36')]);_0x4c8fd1[_0x7892('0x38')]=_[_0x7892('0x39')](_0x4c8fd1['model'],_0x4c8fd1[_0x7892('0x36')]);_0x619939[_0x7892('0x3a')]=_['intersection'](_0x4c8fd1[_0x7892('0x35')],qs['fields'](_0x2ae69d[_0x7892('0x36')][_0x7892('0x3b')]));_0x619939[_0x7892('0x3a')]=_0x619939[_0x7892('0x3a')][_0x7892('0x3c')]?_0x619939[_0x7892('0x3a')]:_0x4c8fd1[_0x7892('0x35')];if(!_0x2ae69d[_0x7892('0x36')][_0x7892('0x3d')](_0x7892('0x3e'))){_0x619939[_0x7892('0x1f')]=qs[_0x7892('0x1f')](_0x2ae69d[_0x7892('0x36')][_0x7892('0x1f')]);_0x619939['offset']=qs[_0x7892('0x20')](_0x2ae69d[_0x7892('0x36')][_0x7892('0x20')]);}_0x619939['order']=qs[_0x7892('0x3f')](_0x2ae69d[_0x7892('0x36')][_0x7892('0x3f')]);_0x619939[_0x7892('0x40')]=qs[_0x7892('0x38')](_[_0x7892('0x41')](_0x2ae69d[_0x7892('0x36')],_0x4c8fd1[_0x7892('0x38')]),_0x4843ab);if(_0x2ae69d[_0x7892('0x36')]['filter']){_0x619939[_0x7892('0x40')]=_[_0x7892('0x42')](_0x619939[_0x7892('0x40')],{'$or':[{'key':{'$like':'%'+_0x2ae69d[_0x7892('0x36')][_0x7892('0x43')]+'%'}},{'value':{'$like':'%'+_0x2ae69d[_0x7892('0x36')]['filter']+'%'}}]});}_0x619939=_['merge']({},_0x619939,_0x2ae69d[_0x7892('0x44')]);var _0x1153cb={'where':_0x619939[_0x7892('0x40')]};return db[_0x7892('0x45')]['count'](_0x1153cb)[_0x7892('0x27')](function(_0x576cf9){_0x30fc8b[_0x7892('0x21')]=_0x576cf9;if(_0x2ae69d[_0x7892('0x36')]['includeAll']){_0x619939[_0x7892('0x46')]=[{'all':!![]}];}return db[_0x7892('0x45')][_0x7892('0x47')](_0x619939);})[_0x7892('0x27')](function(_0x1c94c6){_0x30fc8b['rows']=_0x1c94c6;return _0x30fc8b;})[_0x7892('0x27')](respondWithFilteredResult(_0x32d39d,_0x619939))['catch'](handleError(_0x32d39d,null));};exports[_0x7892('0x48')]=function(_0x3cd3a4,_0x25fffe){var _0xc3b26={'raw':!![],'where':{'id':_0x3cd3a4[_0x7892('0x49')]['id']}},_0x9270b5={};_0x9270b5[_0x7892('0x35')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x9270b5[_0x7892('0x36')]=_[_0x7892('0x37')](_0x3cd3a4[_0x7892('0x36')]);_0x9270b5['filters']=_['intersection'](_0x9270b5[_0x7892('0x35')],_0x9270b5[_0x7892('0x36')]);_0xc3b26['attributes']=_[_0x7892('0x39')](_0x9270b5[_0x7892('0x35')],qs['fields'](_0x3cd3a4['query'][_0x7892('0x3b')]));_0xc3b26['attributes']=_0xc3b26[_0x7892('0x3a')]['length']?_0xc3b26[_0x7892('0x3a')]:_0x9270b5[_0x7892('0x35')];if(_0x3cd3a4[_0x7892('0x36')]['includeAll']){_0xc3b26['include']=[{'all':!![]}];}_0xc3b26=_[_0x7892('0x42')]({},_0xc3b26,_0x3cd3a4[_0x7892('0x44')]);return db['CannedAnswer'][_0x7892('0x4a')](_0xc3b26)[_0x7892('0x27')](handleEntityNotFound(_0x25fffe,null))[_0x7892('0x27')](respondWithResult(_0x25fffe,null))[_0x7892('0x4b')](handleError(_0x25fffe,null));};exports[_0x7892('0x26')]=function(_0x3beb20,_0x21df5b){if(_0x3beb20[_0x7892('0x4c')]['id']){delete _0x3beb20['body']['id'];}return db['CannedAnswer'][_0x7892('0x4a')]({'where':{'id':_0x3beb20[_0x7892('0x49')]['id']}})[_0x7892('0x27')](handleEntityNotFound(_0x21df5b,null))[_0x7892('0x27')](saveUpdates(_0x3beb20['body'],null))[_0x7892('0x27')](respondWithResult(_0x21df5b,null))[_0x7892('0x4b')](handleError(_0x21df5b,null));};exports['destroy']=function(_0x552266,_0x576855){return db[_0x7892('0x45')][_0x7892('0x4a')]({'where':{'id':_0x552266['params']['id']}})['then'](handleEntityNotFound(_0x576855,null))[_0x7892('0x27')](removeEntity(_0x576855,null))['catch'](handleError(_0x576855,null));};exports[_0x7892('0x4d')]=function(_0x342484,_0x1b0aa5){var _0x16a138={'key':_0x342484['body'][_0x7892('0x34')]};if(_0x342484[_0x7892('0x4c')][_0x7892('0x4e')]){_0x16a138[_0x7892('0x4e')]=_0x342484[_0x7892('0x4c')][_0x7892('0x4e')];}else if(_0x342484[_0x7892('0x4c')][_0x7892('0x4f')]){_0x16a138[_0x7892('0x4f')]=_0x342484['body'][_0x7892('0x4f')];}else if(_0x342484[_0x7892('0x4c')][_0x7892('0x50')]){_0x16a138[_0x7892('0x50')]=_0x342484[_0x7892('0x4c')][_0x7892('0x50')];}else if(_0x342484['body'][_0x7892('0x51')]){_0x16a138[_0x7892('0x51')]=_0x342484[_0x7892('0x4c')][_0x7892('0x51')];}return db[_0x7892('0x45')]['find']({'where':_0x16a138})[_0x7892('0x27')](function(_0x2c45d8){if(_0x2c45d8){throw new db['Sequelize'][(_0x7892('0x52'))](_0x7892('0x53'));}return db[_0x7892('0x45')][_0x7892('0x4d')](_0x342484[_0x7892('0x4c')]);})['then'](function(_0x2f3d64){var _0x14e115=_0x342484[_0x7892('0x54')][_0x7892('0x29')]({'plain':!![]});if(!_0x14e115)throw new Error(_0x7892('0x55'));if(_0x14e115[_0x7892('0x56')]==='user'){var _0xa5686b=_0x2f3d64[_0x7892('0x29')]({'plain':!![]});return db[_0x7892('0x57')][_0x7892('0x4a')]({'where':{'name':_0x7892('0x2a'),'userProfileId':_0x14e115[_0x7892('0x58')]},'raw':!![]})[_0x7892('0x27')](function(_0x1e6b52){if(_0x1e6b52&&_0x1e6b52[_0x7892('0x59')]===0x0){return db[_0x7892('0x2b')][_0x7892('0x4d')]({'name':_0xa5686b[_0x7892('0x2e')],'resourceId':_0xa5686b['id'],'type':_0x1e6b52['name'],'sectionId':_0x1e6b52['id']},{})['then'](function(){return _0x2f3d64;});}else{return _0x2f3d64;}})[_0x7892('0x4b')](function(_0x1e409e){logger[_0x7892('0x2c')](_0x7892('0x5a'),_0x1e409e);throw _0x1e409e;});}return _0x2f3d64;})['then'](respondWithResult(_0x1b0aa5,0xc9))[_0x7892('0x4b')](handleError(_0x1b0aa5,null));};
\ No newline at end of file
index b005b49..f097660 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39d5=['rimraf','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x39d5,0x1f2));var _0x539d=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x39d5[_0x31e29a];return _0x32d892;};'use strict';var _=require('lodash');var util=require(_0x539d('0x0'));var logger=require(_0x539d('0x1'))(_0x539d('0x2'));var moment=require(_0x539d('0x3'));var BPromise=require(_0x539d('0x4'));var rp=require(_0x539d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x539d('0x6'));var config=require('../../config/environment');var attributes=require(_0x539d('0x7'));module[_0x539d('0x8')]=function(_0x1b3a61,_0x531f82){return _0x1b3a61[_0x539d('0x9')](_0x539d('0xa'),attributes,{'tableName':_0x539d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0xdd70=['util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x1a33a7,_0x3a9262){var _0x22d80d=function(_0xad057){while(--_0xad057){_0x1a33a7['push'](_0x1a33a7['shift']());}};_0x22d80d(++_0x3a9262);}(_0xdd70,0x18b));var _0x0dd7=function(_0x5af911,_0x5a72aa){_0x5af911=_0x5af911-0x0;var _0x336e64=_0xdd70[_0x5af911];return _0x336e64;};'use strict';var _=require(_0x0dd7('0x0'));var util=require(_0x0dd7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0dd7('0x2'));var BPromise=require(_0x0dd7('0x3'));var rp=require(_0x0dd7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dd7('0x5'));var config=require(_0x0dd7('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0x0dd7('0x7')]=function(_0x349081,_0x34aa1b){return _0x349081['define'](_0x0dd7('0x8'),attributes,{'tableName':_0x0dd7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0dd7('0xa'),'collate':_0x0dd7('0xb')});};
\ No newline at end of file
index 4598266..4cce389 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa3051f,_0x298c78){var _0x15e9e4=function(_0x498307){while(--_0x498307){_0xa3051f['push'](_0xa3051f['shift']());}};_0x15e9e4(++_0x298c78);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
+var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3b9c2d,_0x262a19){var _0x5591f8=function(_0x3f55fd){while(--_0x3f55fd){_0x3b9c2d['push'](_0x3b9c2d['shift']());}};_0x5591f8(++_0x262a19);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
index f40149b..4ca5cec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x599b=['create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','index','/:id','isAuthenticated','post'];(function(_0x4aaf38,_0x5bf7b4){var _0x38b1b9=function(_0x53cd54){while(--_0x53cd54){_0x4aaf38['push'](_0x4aaf38['shift']());}};_0x38b1b9(++_0x5bf7b4);}(_0x599b,0x15c));var _0xb599=function(_0x37e6e4,_0x528b2d){_0x37e6e4=_0x37e6e4-0x0;var _0x51b3ba=_0x599b[_0x37e6e4];return _0x51b3ba;};'use strict';var multer=require(_0xb599('0x0'));var util=require('util');var path=require(_0xb599('0x1'));var timeout=require(_0xb599('0x2'));var express=require(_0xb599('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb599('0x4'));var interaction=require(_0xb599('0x5'));var config=require(_0xb599('0x6'));var controller=require(_0xb599('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xb599('0x8')]);router['get'](_0xb599('0x9'),auth[_0xb599('0xa')](),controller['show']);router[_0xb599('0xb')]('/',auth[_0xb599('0xa')](),controller[_0xb599('0xc')]);router[_0xb599('0xd')](_0xb599('0x9'),auth['isAuthenticated'](),controller[_0xb599('0xe')]);router[_0xb599('0xf')](_0xb599('0x9'),auth['isAuthenticated'](),controller[_0xb599('0x10')]);module[_0xb599('0x11')]=router;
\ No newline at end of file
+var _0xd65d=['express','Router','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout'];(function(_0x24773e,_0x3e0ff1){var _0x42129c=function(_0x47a58e){while(--_0x47a58e){_0x24773e['push'](_0x24773e['shift']());}};_0x42129c(++_0x3e0ff1);}(_0xd65d,0x183));var _0xdd65=function(_0x19d2b2,_0x2fd6b1){_0x19d2b2=_0x19d2b2-0x0;var _0x457228=_0xd65d[_0x19d2b2];return _0x457228;};'use strict';var multer=require(_0xdd65('0x0'));var util=require(_0xdd65('0x1'));var path=require(_0xdd65('0x2'));var timeout=require(_0xdd65('0x3'));var express=require(_0xdd65('0x4'));var router=express[_0xdd65('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdd65('0x6'));var config=require(_0xdd65('0x7'));var controller=require(_0xdd65('0x8'));router[_0xdd65('0x9')]('/',auth[_0xdd65('0xa')](),controller['index']);router['get'](_0xdd65('0xb'),auth['isAuthenticated'](),controller[_0xdd65('0xc')]);router['post']('/',auth[_0xdd65('0xa')](),controller[_0xdd65('0xd')]);router[_0xdd65('0xe')](_0xdd65('0xb'),auth[_0xdd65('0xa')](),controller['update']);router[_0xdd65('0xf')](_0xdd65('0xb'),auth['isAuthenticated'](),controller[_0xdd65('0x10')]);module['exports']=router;
\ No newline at end of file
index d231e5d..30e48b7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x67c7=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x67c7,0x172));var _0x767c=function(_0x1f16de,_0x548eb9){_0x1f16de=_0x1f16de-0x0;var _0x36cd80=_0x67c7[_0x1f16de];return _0x36cd80;};'use strict';var Sequelize=require(_0x767c('0x0'));module[_0x767c('0x1')]={'calldate':{'type':Sequelize[_0x767c('0x2')],'allowNull':![],'defaultValue':_0x767c('0x3')},'clid':{'type':Sequelize[_0x767c('0x4')]},'src':{'type':Sequelize[_0x767c('0x4')]},'dst':{'type':Sequelize[_0x767c('0x4')]},'dcontext':{'type':Sequelize[_0x767c('0x4')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x767c('0x4')]},'lastapp':{'type':Sequelize[_0x767c('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x767c('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x767c('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x767c('0x4')]},'amaflags':{'type':Sequelize[_0x767c('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x767c('0x4')]},'userfield':{'type':Sequelize[_0x767c('0x4')]},'uniqueid':{'type':Sequelize[_0x767c('0x4')]},'linkedid':{'type':Sequelize[_0x767c('0x4')]},'sequence':{'type':Sequelize[_0x767c('0x4')]},'peeraccount':{'type':Sequelize[_0x767c('0x4')]},'type':{'type':Sequelize[_0x767c('0x4')]},'tag':{'type':Sequelize[_0x767c('0x4')]}};
\ No newline at end of file
+var _0x5c42=['INTEGER','sequelize','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x5431df,_0x6dbf5e){var _0x52a89e=function(_0x4e7b20){while(--_0x4e7b20){_0x5431df['push'](_0x5431df['shift']());}};_0x52a89e(++_0x6dbf5e);}(_0x5c42,0x182));var _0x25c4=function(_0x1c9531,_0x1b45bc){_0x1c9531=_0x1c9531-0x0;var _0x1f8c5e=_0x5c42[_0x1c9531];return _0x1f8c5e;};'use strict';var Sequelize=require(_0x25c4('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x25c4('0x1')],'allowNull':![],'defaultValue':_0x25c4('0x2')},'clid':{'type':Sequelize[_0x25c4('0x3')]},'src':{'type':Sequelize[_0x25c4('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x25c4('0x3')]},'channel':{'type':Sequelize[_0x25c4('0x3')]},'dstchannel':{'type':Sequelize[_0x25c4('0x3')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x25c4('0x3')]},'duration':{'type':Sequelize[_0x25c4('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x25c4('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x25c4('0x3')]},'amaflags':{'type':Sequelize[_0x25c4('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x25c4('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x25c4('0x3')]},'linkedid':{'type':Sequelize[_0x25c4('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x25c4('0x3')]},'type':{'type':Sequelize[_0x25c4('0x3')]},'tag':{'type':Sequelize[_0x25c4('0x3')]}};
\ No newline at end of file
index 81c1609..b0de3ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ce1=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','send','index','Cdr','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0x8ce1,0x183));var _0x18ce=function(_0x3df9b2,_0x369d46){_0x3df9b2=_0x3df9b2-0x0;var _0x4a719b=_0x8ce1[_0x3df9b2];return _0x4a719b;};'use strict';var emlformat=require(_0x18ce('0x0'));var rimraf=require(_0x18ce('0x1'));var zipdir=require(_0x18ce('0x2'));var jsonpatch=require(_0x18ce('0x3'));var rp=require(_0x18ce('0x4'));var moment=require(_0x18ce('0x5'));var BPromise=require(_0x18ce('0x6'));var Mustache=require(_0x18ce('0x7'));var util=require(_0x18ce('0x8'));var path=require(_0x18ce('0x9'));var sox=require(_0x18ce('0xa'));var csv=require(_0x18ce('0xb'));var ejs=require(_0x18ce('0xc'));var fs=require('fs');var fs_extra=require(_0x18ce('0xd'));var _=require(_0x18ce('0xe'));var squel=require(_0x18ce('0xf'));var crypto=require('crypto');var jsforce=require(_0x18ce('0x10'));var deskjs=require(_0x18ce('0x11'));var toCsv=require(_0x18ce('0xb'));var querystring=require(_0x18ce('0x12'));var Papa=require('papaparse');var Redis=require(_0x18ce('0x13'));var authService=require(_0x18ce('0x14'));var qs=require(_0x18ce('0x15'));var as=require(_0x18ce('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x18ce('0x17'));var utils=require(_0x18ce('0x18'));var config=require(_0x18ce('0x19'));var licenseUtil=require(_0x18ce('0x1a'));var db=require(_0x18ce('0x1b'))['db'];function respondWithStatusCode(_0x5e8c23,_0xbd514b){_0xbd514b=_0xbd514b||0xcc;return function(_0x402ba4){if(_0x402ba4){return _0x5e8c23[_0x18ce('0x1c')](_0xbd514b);}return _0x5e8c23[_0x18ce('0x1d')](_0xbd514b)[_0x18ce('0x1e')]();};}function respondWithResult(_0x5daf04,_0x176797){_0x176797=_0x176797||0xc8;return function(_0xdd4626){if(_0xdd4626){return _0x5daf04[_0x18ce('0x1d')](_0x176797)[_0x18ce('0x1f')](_0xdd4626);}};}function respondWithFilteredResult(_0x46e346,_0x36b5da){return function(_0x17460e){if(_0x17460e){var _0x4a934f=typeof _0x36b5da[_0x18ce('0x20')]===_0x18ce('0x21')&&typeof _0x36b5da[_0x18ce('0x22')]===_0x18ce('0x21');var _0x1edc10=_0x17460e[_0x18ce('0x23')];var _0x482458=_0x4a934f?0x0:_0x36b5da[_0x18ce('0x20')];var _0x29c691=_0x4a934f?_0x17460e[_0x18ce('0x23')]:_0x36b5da['offset']+_0x36b5da[_0x18ce('0x22')];var _0x2fa3d4;if(_0x29c691>=_0x1edc10){_0x29c691=_0x1edc10;_0x2fa3d4=0xc8;}else{_0x2fa3d4=0xce;}_0x46e346[_0x18ce('0x1d')](_0x2fa3d4);return _0x46e346['set'](_0x18ce('0x24'),_0x482458+'-'+_0x29c691+'/'+_0x1edc10)[_0x18ce('0x1f')](_0x17460e);}return null;};}function patchUpdates(_0x5d22cd){return function(_0x29c1ab){try{jsonpatch[_0x18ce('0x25')](_0x29c1ab,_0x5d22cd,!![]);}catch(_0x16802e){return BPromise[_0x18ce('0x26')](_0x16802e);}return _0x29c1ab[_0x18ce('0x27')]();};}function saveUpdates(_0xd41f29,_0x35abf9){return function(_0x545459){if(_0x545459){return _0x545459[_0x18ce('0x28')](_0xd41f29)['then'](function(_0x482c90){return _0x482c90;});}return null;};}function removeEntity(_0x5d2299,_0x32e910){return function(_0x576ecc){if(_0x576ecc){return _0x576ecc[_0x18ce('0x29')]()[_0x18ce('0x2a')](function(){_0x5d2299[_0x18ce('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53abbd,_0x55e17c){return function(_0x317812){if(!_0x317812){_0x53abbd[_0x18ce('0x1c')](0x194);}return _0x317812;};}function handleError(_0x12dbd2,_0x461113){_0x461113=_0x461113||0x1f4;return function(_0x62b2bd){logger[_0x18ce('0x2b')](_0x62b2bd['stack']);if(_0x62b2bd['name']){delete _0x62b2bd['name'];}_0x12dbd2[_0x18ce('0x1d')](_0x461113)[_0x18ce('0x2c')](_0x62b2bd);};}exports[_0x18ce('0x2d')]=function(_0x5f3ec2,_0x1a87f6){var _0xf2683f={},_0x1988e4={},_0x5ef96c={'count':0x0,'rows':[]};var _0x56d296=_['map'](db[_0x18ce('0x2e')][_0x18ce('0x2f')],function(_0x5c2d96){return{'name':_0x5c2d96['fieldName'],'type':_0x5c2d96[_0x18ce('0x30')][_0x18ce('0x31')]};});_0x1988e4[_0x18ce('0x32')]=_['map'](_0x56d296,'name');_0x1988e4[_0x18ce('0x33')]=_[_0x18ce('0x34')](_0x5f3ec2[_0x18ce('0x33')]);_0x1988e4[_0x18ce('0x35')]=_[_0x18ce('0x36')](_0x1988e4[_0x18ce('0x32')],_0x1988e4[_0x18ce('0x33')]);_0xf2683f[_0x18ce('0x37')]=_['intersection'](_0x1988e4['model'],qs[_0x18ce('0x38')](_0x5f3ec2[_0x18ce('0x33')]['fields']));_0xf2683f[_0x18ce('0x37')]=_0xf2683f['attributes'][_0x18ce('0x39')]?_0xf2683f['attributes']:_0x1988e4[_0x18ce('0x32')];if(!_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x3a')]('nolimit')){_0xf2683f['limit']=qs[_0x18ce('0x22')](_0x5f3ec2[_0x18ce('0x33')]['limit']);_0xf2683f['offset']=qs[_0x18ce('0x20')](_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x20')]);}_0xf2683f[_0x18ce('0x3b')]=qs[_0x18ce('0x3c')](_0x5f3ec2[_0x18ce('0x33')][_0x18ce('0x3c')]);_0xf2683f[_0x18ce('0x3d')]=qs[_0x18ce('0x35')](_[_0x18ce('0x3e')](_0x5f3ec2[_0x18ce('0x33')],_0x1988e4[_0x18ce('0x35')]),_0x56d296);if(_0x5f3ec2[_0x18ce('0x33')]['filter']){_0xf2683f[_0x18ce('0x3d')]=_[_0x18ce('0x3f')](_0xf2683f[_0x18ce('0x3d')],{'$or':_[_0x18ce('0x40')](_0x56d296,function(_0x1e67dd){if(_0x1e67dd[_0x18ce('0x30')]!==_0x18ce('0x41')){var _0x27c55a={};_0x27c55a[_0x1e67dd[_0x18ce('0x42')]]={'$like':'%'+_0x5f3ec2[_0x18ce('0x33')]['filter']+'%'};return _0x27c55a;}})});}_0xf2683f=_['merge']({},_0xf2683f,_0x5f3ec2[_0x18ce('0x43')]);var _0x23486c={'where':_0xf2683f[_0x18ce('0x3d')]};return db[_0x18ce('0x2e')][_0x18ce('0x23')](_0x23486c)[_0x18ce('0x2a')](function(_0x2eba88){_0x5ef96c['count']=_0x2eba88;if(_0x5f3ec2['query'][_0x18ce('0x44')]){_0xf2683f[_0x18ce('0x45')]=[{'all':!![]}];}return db['Cdr'][_0x18ce('0x46')](_0xf2683f);})[_0x18ce('0x2a')](function(_0x2941ce){_0x5ef96c[_0x18ce('0x47')]=_0x2941ce;return _0x5ef96c;})[_0x18ce('0x2a')](respondWithFilteredResult(_0x1a87f6,_0xf2683f))[_0x18ce('0x48')](handleError(_0x1a87f6,null));};exports[_0x18ce('0x49')]=function(_0x2a96a7,_0x33b409){var _0x1d6d5f={'raw':!![],'where':{'id':_0x2a96a7[_0x18ce('0x4a')]['id']}},_0x3885e6={};_0x3885e6['model']=_[_0x18ce('0x34')](db[_0x18ce('0x2e')][_0x18ce('0x2f')]);_0x3885e6[_0x18ce('0x33')]=_[_0x18ce('0x34')](_0x2a96a7[_0x18ce('0x33')]);_0x3885e6[_0x18ce('0x35')]=_['intersection'](_0x3885e6['model'],_0x3885e6[_0x18ce('0x33')]);_0x1d6d5f[_0x18ce('0x37')]=_[_0x18ce('0x36')](_0x3885e6[_0x18ce('0x32')],qs['fields'](_0x2a96a7[_0x18ce('0x33')][_0x18ce('0x38')]));_0x1d6d5f[_0x18ce('0x37')]=_0x1d6d5f['attributes']['length']?_0x1d6d5f[_0x18ce('0x37')]:_0x3885e6[_0x18ce('0x32')];if(_0x2a96a7['query'][_0x18ce('0x44')]){_0x1d6d5f[_0x18ce('0x45')]=[{'all':!![]}];}_0x1d6d5f=_[_0x18ce('0x3f')]({},_0x1d6d5f,_0x2a96a7[_0x18ce('0x43')]);return db[_0x18ce('0x2e')][_0x18ce('0x4b')](_0x1d6d5f)[_0x18ce('0x2a')](handleEntityNotFound(_0x33b409,null))['then'](respondWithResult(_0x33b409,null))[_0x18ce('0x48')](handleError(_0x33b409,null));};exports[_0x18ce('0x4c')]=function(_0x476c6a,_0x1e445d){return db[_0x18ce('0x2e')][_0x18ce('0x4c')](_0x476c6a[_0x18ce('0x4d')],{})[_0x18ce('0x2a')](respondWithResult(_0x1e445d,0xc9))[_0x18ce('0x48')](handleError(_0x1e445d,null));};exports[_0x18ce('0x28')]=function(_0x1211d0,_0x3f9960){if(_0x1211d0[_0x18ce('0x4d')]['id']){delete _0x1211d0[_0x18ce('0x4d')]['id'];}return db['Cdr'][_0x18ce('0x4b')]({'where':{'id':_0x1211d0[_0x18ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3f9960,null))[_0x18ce('0x2a')](saveUpdates(_0x1211d0['body'],null))[_0x18ce('0x2a')](respondWithResult(_0x3f9960,null))['catch'](handleError(_0x3f9960,null));};exports[_0x18ce('0x29')]=function(_0x188f57,_0x3d5b1b){return db[_0x18ce('0x2e')]['find']({'where':{'id':_0x188f57[_0x18ce('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3d5b1b,null))['then'](removeEntity(_0x3d5b1b,null))[_0x18ce('0x48')](handleError(_0x3d5b1b,null));};exports[_0x18ce('0x4e')]=function(_0x8aa4a7,_0x5f164a){return db['Cdr'][_0x18ce('0x4e')]()[_0x18ce('0x2a')](respondWithResult(_0x5f164a,null))[_0x18ce('0x48')](handleError(_0x5f164a,null));};
\ No newline at end of file
+var _0x5fc3=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch','show','options','create','body','find','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','Cdr','fieldName','type','model','query','keys','filters'];(function(_0x4be27a,_0x385776){var _0x4ffa98=function(_0x240df9){while(--_0x240df9){_0x4be27a['push'](_0x4be27a['shift']());}};_0x4ffa98(++_0x385776);}(_0x5fc3,0xa8));var _0x35fc=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0x5fc3[_0x56740a];return _0x257144;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){_0x2d8183['status'](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x5a93df,_0x3d4a98){return function(_0x51cfec){if(!_0x51cfec){_0x5a93df[_0x35fc('0x17')](0x194);}return _0x51cfec;};}function handleError(_0x598d7a,_0x1bf180){_0x1bf180=_0x1bf180||0x1f4;return function(_0xdfab9f){logger['error'](_0xdfab9f['stack']);if(_0xdfab9f[_0x35fc('0x26')]){delete _0xdfab9f['name'];}_0x598d7a[_0x35fc('0x18')](_0x1bf180)[_0x35fc('0x27')](_0xdfab9f);};}exports['index']=function(_0x26b7cb,_0x645eac){var _0x383837={},_0x9f3c8a={},_0x3735da={'count':0x0,'rows':[]};var _0x134dfa=_[_0x35fc('0x28')](db[_0x35fc('0x29')]['rawAttributes'],function(_0x1cd1ae){return{'name':_0x1cd1ae[_0x35fc('0x2a')],'type':_0x1cd1ae[_0x35fc('0x2b')]['key']};});_0x9f3c8a[_0x35fc('0x2c')]=_[_0x35fc('0x28')](_0x134dfa,_0x35fc('0x26'));_0x9f3c8a[_0x35fc('0x2d')]=_[_0x35fc('0x2e')](_0x26b7cb[_0x35fc('0x2d')]);_0x9f3c8a[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x9f3c8a[_0x35fc('0x2c')],_0x9f3c8a[_0x35fc('0x2d')]);_0x383837['attributes']=_['intersection'](_0x9f3c8a[_0x35fc('0x2c')],qs['fields'](_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x31')]));_0x383837[_0x35fc('0x32')]=_0x383837[_0x35fc('0x32')][_0x35fc('0x33')]?_0x383837[_0x35fc('0x32')]:_0x9f3c8a['model'];if(!_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x34')](_0x35fc('0x35'))){_0x383837[_0x35fc('0x1c')]=qs[_0x35fc('0x1c')](_0x26b7cb[_0x35fc('0x2d')]['limit']);_0x383837[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x26b7cb[_0x35fc('0x2d')]['offset']);}_0x383837[_0x35fc('0x36')]=qs['sort'](_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x37')]);_0x383837[_0x35fc('0x38')]=qs[_0x35fc('0x2f')](_['pick'](_0x26b7cb['query'],_0x9f3c8a['filters']),_0x134dfa);if(_0x26b7cb[_0x35fc('0x2d')]['filter']){_0x383837[_0x35fc('0x38')]=_['merge'](_0x383837[_0x35fc('0x38')],{'$or':_[_0x35fc('0x28')](_0x134dfa,function(_0x2ca9ac){if(_0x2ca9ac[_0x35fc('0x2b')]!==_0x35fc('0x39')){var _0x3313fa={};_0x3313fa[_0x2ca9ac[_0x35fc('0x26')]]={'$like':'%'+_0x26b7cb['query'][_0x35fc('0x3a')]+'%'};return _0x3313fa;}})});}_0x383837=_[_0x35fc('0x3b')]({},_0x383837,_0x26b7cb['options']);var _0x1feda5={'where':_0x383837[_0x35fc('0x38')]};return db[_0x35fc('0x29')][_0x35fc('0x1d')](_0x1feda5)[_0x35fc('0x24')](function(_0x31d926){_0x3735da['count']=_0x31d926;if(_0x26b7cb[_0x35fc('0x2d')][_0x35fc('0x3c')]){_0x383837[_0x35fc('0x3d')]=[{'all':!![]}];}return db['Cdr'][_0x35fc('0x3e')](_0x383837);})[_0x35fc('0x24')](function(_0x596919){_0x3735da[_0x35fc('0x3f')]=_0x596919;return _0x3735da;})[_0x35fc('0x24')](respondWithFilteredResult(_0x645eac,_0x383837))[_0x35fc('0x40')](handleError(_0x645eac,null));};exports[_0x35fc('0x41')]=function(_0x331439,_0x2a1cf6){var _0x211b70={'raw':!![],'where':{'id':_0x331439['params']['id']}},_0x3ec51f={};_0x3ec51f['model']=_[_0x35fc('0x2e')](db[_0x35fc('0x29')]['rawAttributes']);_0x3ec51f['query']=_['keys'](_0x331439[_0x35fc('0x2d')]);_0x3ec51f[_0x35fc('0x2f')]=_['intersection'](_0x3ec51f[_0x35fc('0x2c')],_0x3ec51f[_0x35fc('0x2d')]);_0x211b70[_0x35fc('0x32')]=_[_0x35fc('0x30')](_0x3ec51f['model'],qs['fields'](_0x331439['query']['fields']));_0x211b70['attributes']=_0x211b70[_0x35fc('0x32')][_0x35fc('0x33')]?_0x211b70['attributes']:_0x3ec51f[_0x35fc('0x2c')];if(_0x331439['query'][_0x35fc('0x3c')]){_0x211b70[_0x35fc('0x3d')]=[{'all':!![]}];}_0x211b70=_[_0x35fc('0x3b')]({},_0x211b70,_0x331439[_0x35fc('0x42')]);return db[_0x35fc('0x29')]['find'](_0x211b70)[_0x35fc('0x24')](handleEntityNotFound(_0x2a1cf6,null))[_0x35fc('0x24')](respondWithResult(_0x2a1cf6,null))['catch'](handleError(_0x2a1cf6,null));};exports[_0x35fc('0x43')]=function(_0x298b7b,_0x2a8a09){return db[_0x35fc('0x29')]['create'](_0x298b7b[_0x35fc('0x44')],{})['then'](respondWithResult(_0x2a8a09,0xc9))['catch'](handleError(_0x2a8a09,null));};exports[_0x35fc('0x23')]=function(_0x9db7e8,_0x18dc78){if(_0x9db7e8[_0x35fc('0x44')]['id']){delete _0x9db7e8[_0x35fc('0x44')]['id'];}return db[_0x35fc('0x29')][_0x35fc('0x45')]({'where':{'id':_0x9db7e8[_0x35fc('0x46')]['id']}})['then'](handleEntityNotFound(_0x18dc78,null))[_0x35fc('0x24')](saveUpdates(_0x9db7e8[_0x35fc('0x44')],null))[_0x35fc('0x24')](respondWithResult(_0x18dc78,null))[_0x35fc('0x40')](handleError(_0x18dc78,null));};exports[_0x35fc('0x25')]=function(_0x1e3221,_0x1b8229){return db[_0x35fc('0x29')][_0x35fc('0x45')]({'where':{'id':_0x1e3221[_0x35fc('0x46')]['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x1b8229,null))[_0x35fc('0x24')](removeEntity(_0x1b8229,null))[_0x35fc('0x40')](handleError(_0x1b8229,null));};exports[_0x35fc('0x47')]=function(_0x59c666,_0x553ed6){return db[_0x35fc('0x29')][_0x35fc('0x47')]()[_0x35fc('0x24')](respondWithResult(_0x553ed6,null))[_0x35fc('0x40')](handleError(_0x553ed6,null));};
\ No newline at end of file
index 09a0158..0c4b8fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x13d103,_0xfdf392){var _0x113c9e=function(_0xb92811){while(--_0xb92811){_0x13d103['push'](_0x13d103['shift']());}};_0x113c9e(++_0xfdf392);}(_0x7a54,0x106));var _0x47a5=function(_0x538e54,_0x801ae6){_0x538e54=_0x538e54-0x0;var _0x4e599f=_0x7a54[_0x538e54];return _0x4e599f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x5ea2f3,_0x12c412){var _0xaac097=function(_0x265d61){while(--_0x265d61){_0x5ea2f3['push'](_0x5ea2f3['shift']());}};_0xaac097(++_0x12c412);}(_0x7a54,0x106));var _0x47a5=function(_0x40934e,_0x1cc7b6){_0x40934e=_0x40934e-0x0;var _0x1c9b38=_0x7a54[_0x40934e];return _0x1c9b38;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});};
\ No newline at end of file
index 276f68f..4440377 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbf0a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','ioredis'];(function(_0x305ed7,_0x40f792){var _0x26d06e=function(_0x43e191){while(--_0x43e191){_0x305ed7['push'](_0x305ed7['shift']());}};_0x26d06e(++_0x40f792);}(_0xbf0a,0x18c));var _0xabf0=function(_0x1a23e9,_0x45566e){_0x1a23e9=_0x1a23e9-0x0;var _0x4a942d=_0xbf0a[_0x1a23e9];return _0x4a942d;};'use strict';var _=require(_0xabf0('0x0'));var util=require('util');var moment=require(_0xabf0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xabf0('0x2'));var db=require(_0xabf0('0x3'))['db'];var utils=require(_0xabf0('0x4'));var logger=require(_0xabf0('0x5'))(_0xabf0('0x6'));var config=require(_0xabf0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xabf0('0x8')][_0xabf0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x222249,_0x2e83aa,_0x363c04){return new BPromise(function(_0x42ad5c,_0x442908){return client[_0xabf0('0xa')](_0x222249,_0x363c04)[_0xabf0('0xb')](function(_0x4c4a14){logger['info'](_0xabf0('0xc'),_0x2e83aa,_0xabf0('0xd'));logger[_0xabf0('0xe')]('Cdr,\x20%s,\x20%s,\x20%s',_0x2e83aa,_0xabf0('0xd'),JSON[_0xabf0('0xf')](_0x4c4a14));if(_0x4c4a14[_0xabf0('0x10')]){if(_0x4c4a14[_0xabf0('0x10')]['code']===0x1f4){logger['error'](_0xabf0('0xc'),_0x2e83aa,_0x4c4a14['error']['message']);return _0x442908(_0x4c4a14['error'][_0xabf0('0x11')]);}logger[_0xabf0('0x10')](_0xabf0('0xc'),_0x2e83aa,_0x4c4a14[_0xabf0('0x10')]['message']);return _0x42ad5c(_0x4c4a14[_0xabf0('0x10')][_0xabf0('0x11')]);}else{logger[_0xabf0('0x12')]('Cdr,\x20%s,\x20%s',_0x2e83aa,_0xabf0('0xd'));_0x42ad5c(_0x4c4a14[_0xabf0('0x13')][_0xabf0('0x11')]);}})[_0xabf0('0x14')](function(_0x31b0ec){logger[_0xabf0('0x10')](_0xabf0('0xc'),_0x2e83aa,_0x31b0ec);_0x442908(_0x31b0ec);});});}
\ No newline at end of file
+var _0x7433=['../../config/environment','jayson/promise','request','then','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','rpc'];(function(_0x3e9d06,_0x30e68f){var _0x1f5e28=function(_0x5790f5){while(--_0x5790f5){_0x3e9d06['push'](_0x3e9d06['shift']());}};_0x1f5e28(++_0x30e68f);}(_0x7433,0x87));var _0x3743=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x7433[_0x28b0a1];return _0x21470c;};'use strict';var _=require(_0x3743('0x0'));var util=require('util');var moment=require(_0x3743('0x1'));var BPromise=require(_0x3743('0x2'));var rs=require(_0x3743('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3743('0x4'));var config=require(_0x3743('0x5'));var jayson=require(_0x3743('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x155e85,_0x147f88,_0x1a0a57){return new BPromise(function(_0x50b8b3,_0xfa4f45){return client[_0x3743('0x7')](_0x155e85,_0x1a0a57)[_0x3743('0x8')](function(_0x28b55d){logger[_0x3743('0x9')](_0x3743('0xa'),_0x147f88,'request\x20sent');logger[_0x3743('0xb')](_0x3743('0xc'),_0x147f88,_0x3743('0xd'),JSON[_0x3743('0xe')](_0x28b55d));if(_0x28b55d[_0x3743('0xf')]){if(_0x28b55d['error'][_0x3743('0x10')]===0x1f4){logger[_0x3743('0xf')](_0x3743('0xa'),_0x147f88,_0x28b55d['error'][_0x3743('0x11')]);return _0xfa4f45(_0x28b55d[_0x3743('0xf')][_0x3743('0x11')]);}logger['error'](_0x3743('0xa'),_0x147f88,_0x28b55d[_0x3743('0xf')][_0x3743('0x11')]);return _0x50b8b3(_0x28b55d[_0x3743('0xf')][_0x3743('0x11')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x147f88,'request\x20sent');_0x50b8b3(_0x28b55d[_0x3743('0x12')][_0x3743('0x11')]);}})[_0x3743('0x13')](function(_0x39c9b0){logger['error'](_0x3743('0xa'),_0x147f88,_0x39c9b0);_0xfa4f45(_0x39c9b0);});});}
\ No newline at end of file
index 98edd68..7e1daba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x27c9f6,_0x4237b5){var _0x24533c=function(_0x199f37){while(--_0x199f37){_0x27c9f6['push'](_0x27c9f6['shift']());}};_0x24533c(++_0x4237b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x5089ea,_0x3d8378){_0x5089ea=_0x5089ea-0x0;var _0xabe953=_0xb10b[_0x5089ea];return _0xabe953;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router;
\ No newline at end of file
+var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x5ac188,_0x163bcf){var _0x32fa2f=function(_0x2331c0){while(--_0x2331c0){_0x5ac188['push'](_0x5ac188['shift']());}};_0x32fa2f(++_0x163bcf);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router;
\ No newline at end of file
index f672cb7..4492dd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x318d=['exports','INTEGER','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x398db3,_0x2ca4ac){var _0x298ed6=function(_0x10cd53){while(--_0x10cd53){_0x398db3['push'](_0x398db3['shift']());}};_0x298ed6(++_0x2ca4ac);}(_0x318d,0xbf));var _0xd318=function(_0x219cc1,_0x3d03b5){_0x219cc1=_0x219cc1-0x0;var _0x177034=_0x318d[_0x219cc1];return _0x177034;};'use strict';var Sequelize=require(_0xd318('0x0'));module[_0xd318('0x1')]={'priority':{'type':Sequelize[_0xd318('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd318('0x3')]()},'description':{'type':Sequelize[_0xd318('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd318('0x5')}};
\ No newline at end of file
+var _0x2d71=['INTEGER','STRING','noop','TEXT','sequelize','exports'];(function(_0x2b96be,_0x562edf){var _0x2d66fb=function(_0x346861){while(--_0x346861){_0x2b96be['push'](_0x2b96be['shift']());}};_0x2d66fb(++_0x562edf);}(_0x2d71,0x184));var _0x12d7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2d71[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x12d7('0x0'));module[_0x12d7('0x1')]={'priority':{'type':Sequelize[_0x12d7('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x12d7('0x3')],'allowNull':![],'defaultValue':_0x12d7('0x4')},'appdata':{'type':Sequelize[_0x12d7('0x5')]()},'description':{'type':Sequelize[_0x12d7('0x3')]},'interval':{'type':Sequelize[_0x12d7('0x3')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
index 1c1c965..7c4036a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cdf=['merge','find','catch','update','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','show','params','model','ChatApplication','query','keys','filters','attributes','intersection','fields','length','includeAll','include'];(function(_0x45f201,_0x27244f){var _0x54150e=function(_0x343106){while(--_0x343106){_0x45f201['push'](_0x45f201['shift']());}};_0x54150e(++_0x27244f);}(_0x4cdf,0x180));var _0xf4cd=function(_0xf01848,_0x1db5a2){_0xf01848=_0xf01848-0x0;var _0x314cc9=_0x4cdf[_0xf01848];return _0x314cc9;};'use strict';var emlformat=require(_0xf4cd('0x0'));var rimraf=require(_0xf4cd('0x1'));var zipdir=require(_0xf4cd('0x2'));var jsonpatch=require(_0xf4cd('0x3'));var rp=require(_0xf4cd('0x4'));var moment=require(_0xf4cd('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf4cd('0x6'));var util=require(_0xf4cd('0x7'));var path=require('path');var sox=require(_0xf4cd('0x8'));var csv=require(_0xf4cd('0x9'));var ejs=require(_0xf4cd('0xa'));var fs=require('fs');var fs_extra=require(_0xf4cd('0xb'));var _=require(_0xf4cd('0xc'));var squel=require('squel');var crypto=require(_0xf4cd('0xd'));var jsforce=require(_0xf4cd('0xe'));var deskjs=require(_0xf4cd('0xf'));var toCsv=require(_0xf4cd('0x9'));var querystring=require('querystring');var Papa=require(_0xf4cd('0x10'));var Redis=require(_0xf4cd('0x11'));var authService=require(_0xf4cd('0x12'));var qs=require(_0xf4cd('0x13'));var as=require(_0xf4cd('0x14'));var hardwareService=require(_0xf4cd('0x15'));var logger=require(_0xf4cd('0x16'))('api');var utils=require(_0xf4cd('0x17'));var config=require(_0xf4cd('0x18'));var licenseUtil=require(_0xf4cd('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58a73a,_0x240614){_0x240614=_0x240614||0xcc;return function(_0x16c4a1){if(_0x16c4a1){return _0x58a73a[_0xf4cd('0x1a')](_0x240614);}return _0x58a73a['status'](_0x240614)[_0xf4cd('0x1b')]();};}function respondWithResult(_0x3c9a6e,_0x216b55){_0x216b55=_0x216b55||0xc8;return function(_0xf12547){if(_0xf12547){return _0x3c9a6e[_0xf4cd('0x1c')](_0x216b55)[_0xf4cd('0x1d')](_0xf12547);}};}function respondWithFilteredResult(_0x5e4a4e,_0x1cfb21){return function(_0xa1ee6){if(_0xa1ee6){var _0x1488c0=typeof _0x1cfb21[_0xf4cd('0x1e')]==='undefined'&&typeof _0x1cfb21[_0xf4cd('0x1f')]===_0xf4cd('0x20');var _0x26ce07=_0xa1ee6[_0xf4cd('0x21')];var _0x4f56b4=_0x1488c0?0x0:_0x1cfb21['offset'];var _0x4042b0=_0x1488c0?_0xa1ee6[_0xf4cd('0x21')]:_0x1cfb21['offset']+_0x1cfb21[_0xf4cd('0x1f')];var _0x51ffbc;if(_0x4042b0>=_0x26ce07){_0x4042b0=_0x26ce07;_0x51ffbc=0xc8;}else{_0x51ffbc=0xce;}_0x5e4a4e[_0xf4cd('0x1c')](_0x51ffbc);return _0x5e4a4e[_0xf4cd('0x22')](_0xf4cd('0x23'),_0x4f56b4+'-'+_0x4042b0+'/'+_0x26ce07)[_0xf4cd('0x1d')](_0xa1ee6);}return null;};}function patchUpdates(_0x36ab1a){return function(_0x7e607){try{jsonpatch[_0xf4cd('0x24')](_0x7e607,_0x36ab1a,!![]);}catch(_0xface7d){return BPromise[_0xf4cd('0x25')](_0xface7d);}return _0x7e607[_0xf4cd('0x26')]();};}function saveUpdates(_0x53603b,_0xfdfbd9){return function(_0x5b634b){if(_0x5b634b){return _0x5b634b['update'](_0x53603b)[_0xf4cd('0x27')](function(_0x7413fa){return _0x7413fa;});}return null;};}function removeEntity(_0x2a6938,_0x18000c){return function(_0x4e81cc){if(_0x4e81cc){return _0x4e81cc['destroy']()['then'](function(){_0x2a6938[_0xf4cd('0x1c')](0xcc)[_0xf4cd('0x1b')]();});}};}function handleEntityNotFound(_0x347c46,_0x3ce52c){return function(_0x5617ce){if(!_0x5617ce){_0x347c46['sendStatus'](0x194);}return _0x5617ce;};}function handleError(_0x41eda1,_0x140d07){_0x140d07=_0x140d07||0x1f4;return function(_0xe83f03){logger[_0xf4cd('0x28')](_0xe83f03[_0xf4cd('0x29')]);if(_0xe83f03['name']){delete _0xe83f03[_0xf4cd('0x2a')];}_0x41eda1[_0xf4cd('0x1c')](_0x140d07)[_0xf4cd('0x2b')](_0xe83f03);};}exports[_0xf4cd('0x2c')]=function(_0x5348a0,_0x46f266){var _0xd4e453={'raw':!![],'where':{'id':_0x5348a0[_0xf4cd('0x2d')]['id']}},_0xcafa84={};_0xcafa84[_0xf4cd('0x2e')]=_['keys'](db[_0xf4cd('0x2f')]['rawAttributes']);_0xcafa84[_0xf4cd('0x30')]=_[_0xf4cd('0x31')](_0x5348a0[_0xf4cd('0x30')]);_0xcafa84[_0xf4cd('0x32')]=_['intersection'](_0xcafa84['model'],_0xcafa84['query']);_0xd4e453[_0xf4cd('0x33')]=_[_0xf4cd('0x34')](_0xcafa84[_0xf4cd('0x2e')],qs[_0xf4cd('0x35')](_0x5348a0[_0xf4cd('0x30')][_0xf4cd('0x35')]));_0xd4e453[_0xf4cd('0x33')]=_0xd4e453[_0xf4cd('0x33')][_0xf4cd('0x36')]?_0xd4e453['attributes']:_0xcafa84['model'];if(_0x5348a0[_0xf4cd('0x30')][_0xf4cd('0x37')]){_0xd4e453[_0xf4cd('0x38')]=[{'all':!![]}];}_0xd4e453=_[_0xf4cd('0x39')]({},_0xd4e453,_0x5348a0['options']);return db[_0xf4cd('0x2f')][_0xf4cd('0x3a')](_0xd4e453)[_0xf4cd('0x27')](handleEntityNotFound(_0x46f266,null))[_0xf4cd('0x27')](respondWithResult(_0x46f266,null))[_0xf4cd('0x3b')](handleError(_0x46f266,null));};exports[_0xf4cd('0x3c')]=function(_0x13f5f9,_0x2e4d3f){if(_0x13f5f9[_0xf4cd('0x3d')]['id']){delete _0x13f5f9[_0xf4cd('0x3d')]['id'];}return db[_0xf4cd('0x2f')][_0xf4cd('0x3a')]({'where':{'id':_0x13f5f9[_0xf4cd('0x2d')]['id']}})['then'](handleEntityNotFound(_0x2e4d3f,null))[_0xf4cd('0x27')](saveUpdates(_0x13f5f9['body'],null))['then'](respondWithResult(_0x2e4d3f,null))['catch'](handleError(_0x2e4d3f,null));};exports[_0xf4cd('0x3e')]=function(_0x1865b1,_0xff784b){return db[_0xf4cd('0x2f')]['find']({'where':{'id':_0x1865b1['params']['id']}})[_0xf4cd('0x27')](handleEntityNotFound(_0xff784b,null))[_0xf4cd('0x27')](removeEntity(_0xff784b,null))['catch'](handleError(_0xff784b,null));};
\ No newline at end of file
+var _0x3cfb=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','show','params','model','keys','ChatApplication','rawAttributes','query','intersection','fields','attributes','length','includeAll','include','merge','options','body','find','catch','eml-format'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x47e538,_0xeb0bd4){_0x47e538=_0x47e538-0x0;var _0x2044b3=_0x3cfb[_0x47e538];return _0x2044b3;};'use strict';var emlformat=require(_0xb3cf('0x0'));var rimraf=require(_0xb3cf('0x1'));var zipdir=require(_0xb3cf('0x2'));var jsonpatch=require(_0xb3cf('0x3'));var rp=require(_0xb3cf('0x4'));var moment=require(_0xb3cf('0x5'));var BPromise=require(_0xb3cf('0x6'));var Mustache=require(_0xb3cf('0x7'));var util=require('util');var path=require(_0xb3cf('0x8'));var sox=require(_0xb3cf('0x9'));var csv=require(_0xb3cf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb3cf('0xb'));var _=require(_0xb3cf('0xc'));var squel=require(_0xb3cf('0xd'));var crypto=require('crypto');var jsforce=require(_0xb3cf('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb3cf('0xf'));var Papa=require(_0xb3cf('0x10'));var Redis=require(_0xb3cf('0x11'));var authService=require(_0xb3cf('0x12'));var qs=require(_0xb3cf('0x13'));var as=require(_0xb3cf('0x14'));var hardwareService=require(_0xb3cf('0x15'));var logger=require(_0xb3cf('0x16'))(_0xb3cf('0x17'));var utils=require(_0xb3cf('0x18'));var config=require(_0xb3cf('0x19'));var licenseUtil=require(_0xb3cf('0x1a'));var db=require(_0xb3cf('0x1b'))['db'];function respondWithStatusCode(_0x80af12,_0x16bb17){_0x16bb17=_0x16bb17||0xcc;return function(_0x530325){if(_0x530325){return _0x80af12['sendStatus'](_0x16bb17);}return _0x80af12[_0xb3cf('0x1c')](_0x16bb17)[_0xb3cf('0x1d')]();};}function respondWithResult(_0x5ec589,_0x21ce6c){_0x21ce6c=_0x21ce6c||0xc8;return function(_0x510bae){if(_0x510bae){return _0x5ec589['status'](_0x21ce6c)[_0xb3cf('0x1e')](_0x510bae);}};}function respondWithFilteredResult(_0x66ea06,_0x2eff5c){return function(_0x56f703){if(_0x56f703){var _0x17e8cd=typeof _0x2eff5c[_0xb3cf('0x1f')]===_0xb3cf('0x20')&&typeof _0x2eff5c[_0xb3cf('0x21')]===_0xb3cf('0x20');var _0x31ad79=_0x56f703[_0xb3cf('0x22')];var _0x2d0018=_0x17e8cd?0x0:_0x2eff5c[_0xb3cf('0x1f')];var _0x222c1d=_0x17e8cd?_0x56f703['count']:_0x2eff5c[_0xb3cf('0x1f')]+_0x2eff5c[_0xb3cf('0x21')];var _0x35fb62;if(_0x222c1d>=_0x31ad79){_0x222c1d=_0x31ad79;_0x35fb62=0xc8;}else{_0x35fb62=0xce;}_0x66ea06[_0xb3cf('0x1c')](_0x35fb62);return _0x66ea06['set'](_0xb3cf('0x23'),_0x2d0018+'-'+_0x222c1d+'/'+_0x31ad79)[_0xb3cf('0x1e')](_0x56f703);}return null;};}function patchUpdates(_0x2557db){return function(_0x1dfbc3){try{jsonpatch[_0xb3cf('0x24')](_0x1dfbc3,_0x2557db,!![]);}catch(_0x2ee4a0){return BPromise[_0xb3cf('0x25')](_0x2ee4a0);}return _0x1dfbc3[_0xb3cf('0x26')]();};}function saveUpdates(_0x33ed8f,_0x1bfe02){return function(_0x4c96fd){if(_0x4c96fd){return _0x4c96fd[_0xb3cf('0x27')](_0x33ed8f)[_0xb3cf('0x28')](function(_0x351196){return _0x351196;});}return null;};}function removeEntity(_0x203ce3,_0x1fb3ea){return function(_0x402d3e){if(_0x402d3e){return _0x402d3e[_0xb3cf('0x29')]()[_0xb3cf('0x28')](function(){_0x203ce3[_0xb3cf('0x1c')](0xcc)[_0xb3cf('0x1d')]();});}};}function handleEntityNotFound(_0x5d939e,_0x89f345){return function(_0x3b8c91){if(!_0x3b8c91){_0x5d939e[_0xb3cf('0x2a')](0x194);}return _0x3b8c91;};}function handleError(_0x4fd689,_0x4cae37){_0x4cae37=_0x4cae37||0x1f4;return function(_0x15cf4d){logger[_0xb3cf('0x2b')](_0x15cf4d['stack']);if(_0x15cf4d['name']){delete _0x15cf4d[_0xb3cf('0x2c')];}_0x4fd689[_0xb3cf('0x1c')](_0x4cae37)['send'](_0x15cf4d);};}exports[_0xb3cf('0x2d')]=function(_0x42b1fc,_0x20c6f5){var _0x376f73={'raw':!![],'where':{'id':_0x42b1fc[_0xb3cf('0x2e')]['id']}},_0x1b1460={};_0x1b1460[_0xb3cf('0x2f')]=_[_0xb3cf('0x30')](db[_0xb3cf('0x31')][_0xb3cf('0x32')]);_0x1b1460['query']=_[_0xb3cf('0x30')](_0x42b1fc['query']);_0x1b1460['filters']=_['intersection'](_0x1b1460[_0xb3cf('0x2f')],_0x1b1460[_0xb3cf('0x33')]);_0x376f73['attributes']=_[_0xb3cf('0x34')](_0x1b1460[_0xb3cf('0x2f')],qs[_0xb3cf('0x35')](_0x42b1fc[_0xb3cf('0x33')][_0xb3cf('0x35')]));_0x376f73[_0xb3cf('0x36')]=_0x376f73['attributes'][_0xb3cf('0x37')]?_0x376f73['attributes']:_0x1b1460[_0xb3cf('0x2f')];if(_0x42b1fc[_0xb3cf('0x33')][_0xb3cf('0x38')]){_0x376f73[_0xb3cf('0x39')]=[{'all':!![]}];}_0x376f73=_[_0xb3cf('0x3a')]({},_0x376f73,_0x42b1fc[_0xb3cf('0x3b')]);return db['ChatApplication']['find'](_0x376f73)[_0xb3cf('0x28')](handleEntityNotFound(_0x20c6f5,null))['then'](respondWithResult(_0x20c6f5,null))['catch'](handleError(_0x20c6f5,null));};exports[_0xb3cf('0x27')]=function(_0x4d7ea4,_0x1c088c){if(_0x4d7ea4[_0xb3cf('0x3c')]['id']){delete _0x4d7ea4[_0xb3cf('0x3c')]['id'];}return db[_0xb3cf('0x31')][_0xb3cf('0x3d')]({'where':{'id':_0x4d7ea4[_0xb3cf('0x2e')]['id']}})['then'](handleEntityNotFound(_0x1c088c,null))[_0xb3cf('0x28')](saveUpdates(_0x4d7ea4[_0xb3cf('0x3c')],null))[_0xb3cf('0x28')](respondWithResult(_0x1c088c,null))[_0xb3cf('0x3e')](handleError(_0x1c088c,null));};exports['destroy']=function(_0x37b5fc,_0x4c3b82){return db[_0xb3cf('0x31')]['find']({'where':{'id':_0x37b5fc[_0xb3cf('0x2e')]['id']}})[_0xb3cf('0x28')](handleEntityNotFound(_0x4c3b82,null))[_0xb3cf('0x28')](removeEntity(_0x4c3b82,null))['catch'](handleError(_0x4c3b82,null));};
\ No newline at end of file
index 0b33f53..390c03d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x689c=['define','ChatApplication','chat_applications','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x689c,0x9e));var _0xc689=function(_0x386865,_0xcf154f){_0x386865=_0x386865-0x0;var _0x5121d4=_0x689c[_0x386865];return _0x5121d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc689('0x0'))(_0xc689('0x1'));var moment=require(_0xc689('0x2'));var BPromise=require(_0xc689('0x3'));var rp=require(_0xc689('0x4'));var fs=require('fs');var path=require(_0xc689('0x5'));var rimraf=require('rimraf');var config=require(_0xc689('0x6'));var attributes=require('./chatApplication.attributes');module['exports']=function(_0x3a4916,_0x28ce4c){return _0x3a4916[_0xc689('0x7')](_0xc689('0x8'),attributes,{'tableName':_0xc689('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xc689('0xa')});};
\ No newline at end of file
+var _0x43e4=['exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0xe240db,_0x1740a9){var _0x30de38=function(_0x5d26fb){while(--_0x5d26fb){_0xe240db['push'](_0xe240db['shift']());}};_0x30de38(++_0x1740a9);}(_0x43e4,0x68));var _0x443e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x43e4[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x443e('0x0'));var util=require('util');var logger=require(_0x443e('0x1'))(_0x443e('0x2'));var moment=require(_0x443e('0x3'));var BPromise=require(_0x443e('0x4'));var rp=require(_0x443e('0x5'));var fs=require('fs');var path=require(_0x443e('0x6'));var rimraf=require('rimraf');var config=require(_0x443e('0x7'));var attributes=require('./chatApplication.attributes');module[_0x443e('0x8')]=function(_0x452dba,_0x4e738a){return _0x452dba[_0x443e('0x9')](_0x443e('0xa'),attributes,{'tableName':_0x443e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x443e('0xc'),'collate':_0x443e('0xd')});};
\ No newline at end of file
index 5274209..34ac01a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8643=['../../config/logger','rpc','../../config/environment','client','request','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2a67fe,_0x295c09){var _0x57e726=function(_0x280573){while(--_0x280573){_0x2a67fe['push'](_0x2a67fe['shift']());}};_0x57e726(++_0x295c09);}(_0x8643,0x6c));var _0x3864=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8643[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x3864('0x0'));var util=require('util');var moment=require(_0x3864('0x1'));var BPromise=require(_0x3864('0x2'));var rs=require(_0x3864('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3864('0x4'))['db'];var utils=require(_0x3864('0x5'));var logger=require(_0x3864('0x6'))(_0x3864('0x7'));var config=require(_0x3864('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3864('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b855c,_0x33554e,_0x4d2963){return new BPromise(function(_0x2d7203,_0x1e3619){return client[_0x3864('0xa')](_0x2b855c,_0x4d2963)['then'](function(_0x3c979e){logger['info'](_0x3864('0xb'),_0x33554e,_0x3864('0xc'));logger[_0x3864('0xd')](_0x3864('0xe'),_0x33554e,_0x3864('0xc'),JSON[_0x3864('0xf')](_0x3c979e));if(_0x3c979e[_0x3864('0x10')]){if(_0x3c979e[_0x3864('0x10')]['code']===0x1f4){logger[_0x3864('0x10')](_0x3864('0xb'),_0x33554e,_0x3c979e[_0x3864('0x10')][_0x3864('0x11')]);return _0x1e3619(_0x3c979e[_0x3864('0x10')][_0x3864('0x11')]);}logger[_0x3864('0x10')](_0x3864('0xb'),_0x33554e,_0x3c979e[_0x3864('0x10')][_0x3864('0x11')]);return _0x2d7203(_0x3c979e[_0x3864('0x10')][_0x3864('0x11')]);}else{logger['info'](_0x3864('0xb'),_0x33554e,_0x3864('0xc'));_0x2d7203(_0x3c979e[_0x3864('0x12')][_0x3864('0x11')]);}})['catch'](function(_0x2e3cfa){logger[_0x3864('0x10')](_0x3864('0xb'),_0x33554e,_0x2e3cfa);_0x1e3619(_0x2e3cfa);});});}
\ No newline at end of file
+var _0x96c9=['lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','code','error','ChatApplication,\x20%s,\x20%s','message','result','catch'];(function(_0x323015,_0x37777d){var _0x581879=function(_0x160b45){while(--_0x160b45){_0x323015['push'](_0x323015['shift']());}};_0x581879(++_0x37777d);}(_0x96c9,0x17c));var _0x996c=function(_0x478fbd,_0x5aee52){_0x478fbd=_0x478fbd-0x0;var _0x21883d=_0x96c9[_0x478fbd];return _0x21883d;};'use strict';var _=require(_0x996c('0x0'));var util=require(_0x996c('0x1'));var moment=require(_0x996c('0x2'));var BPromise=require(_0x996c('0x3'));var rs=require(_0x996c('0x4'));var fs=require('fs');var Redis=require(_0x996c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x996c('0x6'));var config=require(_0x996c('0x7'));var jayson=require(_0x996c('0x8'));var client=jayson['client'][_0x996c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x144fba,_0x401d4a,_0xb240c0){return new BPromise(function(_0x17c887,_0x496493){return client['request'](_0x144fba,_0xb240c0)[_0x996c('0xa')](function(_0x370d4b){logger[_0x996c('0xb')]('ChatApplication,\x20%s,\x20%s',_0x401d4a,_0x996c('0xc'));logger[_0x996c('0xd')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x401d4a,_0x996c('0xc'),JSON['stringify'](_0x370d4b));if(_0x370d4b['error']){if(_0x370d4b['error'][_0x996c('0xe')]===0x1f4){logger[_0x996c('0xf')](_0x996c('0x10'),_0x401d4a,_0x370d4b[_0x996c('0xf')][_0x996c('0x11')]);return _0x496493(_0x370d4b[_0x996c('0xf')][_0x996c('0x11')]);}logger[_0x996c('0xf')](_0x996c('0x10'),_0x401d4a,_0x370d4b[_0x996c('0xf')]['message']);return _0x17c887(_0x370d4b[_0x996c('0xf')][_0x996c('0x11')]);}else{logger[_0x996c('0xb')](_0x996c('0x10'),_0x401d4a,_0x996c('0xc'));_0x17c887(_0x370d4b[_0x996c('0x12')][_0x996c('0x11')]);}})[_0x996c('0x13')](function(_0x3c7fea){logger[_0x996c('0xf')](_0x996c('0x10'),_0x401d4a,_0x3c7fea);_0x496493(_0x3c7fea);});});}
\ No newline at end of file
index 08d39b1..65fde06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6d8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','isAuthenticated','show','put','update','delete','/:id','exports','multer','util','path'];(function(_0x290f0e,_0x5400ed){var _0x4e51bc=function(_0x4acf21){while(--_0x4acf21){_0x290f0e['push'](_0x290f0e['shift']());}};_0x4e51bc(++_0x5400ed);}(_0xd6d8,0xc3));var _0x8d6d=function(_0x28836b,_0x389433){_0x28836b=_0x28836b-0x0;var _0x51f3f8=_0xd6d8[_0x28836b];return _0x51f3f8;};'use strict';var multer=require(_0x8d6d('0x0'));var util=require(_0x8d6d('0x1'));var path=require(_0x8d6d('0x2'));var timeout=require(_0x8d6d('0x3'));var express=require(_0x8d6d('0x4'));var router=express[_0x8d6d('0x5')]();var fs_extra=require(_0x8d6d('0x6'));var auth=require(_0x8d6d('0x7'));var interaction=require(_0x8d6d('0x8'));var config=require('../../config/environment');var controller=require(_0x8d6d('0x9'));router[_0x8d6d('0xa')]('/:id',auth[_0x8d6d('0xb')](),controller[_0x8d6d('0xc')]);router[_0x8d6d('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x8d6d('0xe')]);router[_0x8d6d('0xf')](_0x8d6d('0x10'),auth[_0x8d6d('0xb')](),controller['destroy']);module[_0x8d6d('0x11')]=router;
\ No newline at end of file
+var _0x90bd=['delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x90bd,0x102));var _0xd90b=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x90bd[_0x36ed3c];return _0x52a2e0;};'use strict';var multer=require(_0xd90b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd90b('0x1'));var express=require(_0xd90b('0x2'));var router=express['Router']();var fs_extra=require(_0xd90b('0x3'));var auth=require(_0xd90b('0x4'));var interaction=require(_0xd90b('0x5'));var config=require(_0xd90b('0x6'));var controller=require(_0xd90b('0x7'));router[_0xd90b('0x8')](_0xd90b('0x9'),auth[_0xd90b('0xa')](),controller[_0xd90b('0xb')]);router[_0xd90b('0xc')](_0xd90b('0x9'),auth['isAuthenticated'](),controller[_0xd90b('0xd')]);router[_0xd90b('0xe')](_0xd90b('0x9'),auth['isAuthenticated'](),controller[_0xd90b('0xf')]);module['exports']=router;
\ No newline at end of file
index 20d2ee9..70cd82d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ec4=['BOOLEAN','sequelize','STRING'];(function(_0x486e8a,_0x3f8970){var _0x4212e7=function(_0x3e20cc){while(--_0x3e20cc){_0x486e8a['push'](_0x486e8a['shift']());}};_0x4212e7(++_0x3f8970);}(_0x5ec4,0x172));var _0x45ec=function(_0x53bb2e,_0x13c7e9){_0x53bb2e=_0x53bb2e-0x0;var _0x59cb77=_0x5ec4[_0x53bb2e];return _0x59cb77;};'use strict';var Sequelize=require(_0x45ec('0x0'));module['exports']={'name':{'type':Sequelize[_0x45ec('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x45ec('0x1')]},'write':{'type':Sequelize[_0x45ec('0x2')],'defaultValue':!![]}};
\ No newline at end of file
+var _0xce14=['STRING','BOOLEAN','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xce14,0x17f));var _0x4ce1=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xce14[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require('sequelize');module[_0x4ce1('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x4ce1('0x1')]},'write':{'type':Sequelize[_0x4ce1('0x2')],'defaultValue':!![]}};
\ No newline at end of file
index 7c87cb9..c9b96f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9918=['map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','ChatGroup','includeAll','include','rows','catch','show','find','create','body','params','describe','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','User','pick','removeMembers','addMessage','ChatGroupId','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','update','destroy','then','error','stack','name','send','index'];(function(_0x38ffed,_0xc5d97c){var _0x57a219=function(_0xd93517){while(--_0xd93517){_0x38ffed['push'](_0x38ffed['shift']());}};_0x57a219(++_0xc5d97c);}(_0x9918,0xe5));var _0x8991=function(_0xf1f37e,_0x159a20){_0xf1f37e=_0xf1f37e-0x0;var _0x2e3a6d=_0x9918[_0xf1f37e];return _0x2e3a6d;};'use strict';var emlformat=require(_0x8991('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8991('0x1'));var jsonpatch=require(_0x8991('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8991('0x3'));var util=require(_0x8991('0x4'));var path=require(_0x8991('0x5'));var sox=require('sox');var csv=require(_0x8991('0x6'));var ejs=require(_0x8991('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8991('0x8'));var squel=require(_0x8991('0x9'));var crypto=require(_0x8991('0xa'));var jsforce=require(_0x8991('0xb'));var deskjs=require(_0x8991('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8991('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x8991('0xe'));var as=require(_0x8991('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8991('0x10'))(_0x8991('0x11'));var utils=require(_0x8991('0x12'));var config=require(_0x8991('0x13'));var licenseUtil=require(_0x8991('0x14'));var db=require(_0x8991('0x15'))['db'];config[_0x8991('0x16')]=_['defaults'](config[_0x8991('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x8991('0x17'))(new Redis(config['redis']));require(_0x8991('0x18'))[_0x8991('0x19')](socket);function respondWithStatusCode(_0x6e8c14,_0x4208df){_0x4208df=_0x4208df||0xcc;return function(_0x178fd7){if(_0x178fd7){return _0x6e8c14[_0x8991('0x1a')](_0x4208df);}return _0x6e8c14[_0x8991('0x1b')](_0x4208df)[_0x8991('0x1c')]();};}function respondWithResult(_0x3866a2,_0x322ac3){_0x322ac3=_0x322ac3||0xc8;return function(_0x22b9ff){if(_0x22b9ff){return _0x3866a2[_0x8991('0x1b')](_0x322ac3)[_0x8991('0x1d')](_0x22b9ff);}};}function respondWithFilteredResult(_0x2ef06c,_0x1abda8){return function(_0x519bf3){if(_0x519bf3){var _0x2beeb4=typeof _0x1abda8[_0x8991('0x1e')]==='undefined'&&typeof _0x1abda8['limit']===_0x8991('0x1f');var _0x54558c=_0x519bf3[_0x8991('0x20')];var _0x5ddfb6=_0x2beeb4?0x0:_0x1abda8['offset'];var _0x2055fe=_0x2beeb4?_0x519bf3[_0x8991('0x20')]:_0x1abda8[_0x8991('0x1e')]+_0x1abda8[_0x8991('0x21')];var _0x29d8d3;if(_0x2055fe>=_0x54558c){_0x2055fe=_0x54558c;_0x29d8d3=0xc8;}else{_0x29d8d3=0xce;}_0x2ef06c['status'](_0x29d8d3);return _0x2ef06c['set']('Content-Range',_0x5ddfb6+'-'+_0x2055fe+'/'+_0x54558c)[_0x8991('0x1d')](_0x519bf3);}return null;};}function patchUpdates(_0x323361){return function(_0x3d6ea8){try{jsonpatch[_0x8991('0x22')](_0x3d6ea8,_0x323361,!![]);}catch(_0x35e407){return BPromise[_0x8991('0x23')](_0x35e407);}return _0x3d6ea8['save']();};}function saveUpdates(_0x2eb8e9,_0x49c97a){return function(_0x1c4209){if(_0x1c4209){return _0x1c4209[_0x8991('0x24')](_0x2eb8e9)['then'](function(_0x4744bf){return _0x4744bf;});}return null;};}function removeEntity(_0x440650,_0x212cef){return function(_0x1f4596){if(_0x1f4596){return _0x1f4596[_0x8991('0x25')]()[_0x8991('0x26')](function(){_0x440650[_0x8991('0x1b')](0xcc)[_0x8991('0x1c')]();});}};}function handleEntityNotFound(_0x187a13,_0x37db2e){return function(_0x259516){if(!_0x259516){_0x187a13[_0x8991('0x1a')](0x194);}return _0x259516;};}function handleError(_0x4da47b,_0x592e89){_0x592e89=_0x592e89||0x1f4;return function(_0x40b269){logger[_0x8991('0x27')](_0x40b269[_0x8991('0x28')]);if(_0x40b269[_0x8991('0x29')]){delete _0x40b269[_0x8991('0x29')];}_0x4da47b[_0x8991('0x1b')](_0x592e89)[_0x8991('0x2a')](_0x40b269);};}exports[_0x8991('0x2b')]=function(_0x2267a1,_0x5b9e0b){var _0x55a49f={},_0x1175fe={},_0x29b23e={'count':0x0,'rows':[]};var _0x25208d=_[_0x8991('0x2c')](db['ChatGroup'][_0x8991('0x2d')],function(_0x114e0f){return{'name':_0x114e0f[_0x8991('0x2e')],'type':_0x114e0f[_0x8991('0x2f')][_0x8991('0x30')]};});_0x1175fe[_0x8991('0x31')]=_[_0x8991('0x2c')](_0x25208d,_0x8991('0x29'));_0x1175fe[_0x8991('0x32')]=_[_0x8991('0x33')](_0x2267a1[_0x8991('0x32')]);_0x1175fe['filters']=_[_0x8991('0x34')](_0x1175fe[_0x8991('0x31')],_0x1175fe[_0x8991('0x32')]);_0x55a49f[_0x8991('0x35')]=_[_0x8991('0x34')](_0x1175fe['model'],qs[_0x8991('0x36')](_0x2267a1[_0x8991('0x32')][_0x8991('0x36')]));_0x55a49f['attributes']=_0x55a49f[_0x8991('0x35')][_0x8991('0x37')]?_0x55a49f[_0x8991('0x35')]:_0x1175fe[_0x8991('0x31')];if(!_0x2267a1['query'][_0x8991('0x38')](_0x8991('0x39'))){_0x55a49f[_0x8991('0x21')]=qs['limit'](_0x2267a1['query']['limit']);_0x55a49f[_0x8991('0x1e')]=qs[_0x8991('0x1e')](_0x2267a1[_0x8991('0x32')][_0x8991('0x1e')]);}_0x55a49f[_0x8991('0x3a')]=qs[_0x8991('0x3b')](_0x2267a1[_0x8991('0x32')][_0x8991('0x3b')]);_0x55a49f[_0x8991('0x3c')]=qs['filters'](_['pick'](_0x2267a1[_0x8991('0x32')],_0x1175fe[_0x8991('0x3d')]),_0x25208d);if(_0x2267a1['query'][_0x8991('0x3e')]){_0x55a49f['where']=_[_0x8991('0x3f')](_0x55a49f['where'],{'$or':_[_0x8991('0x2c')](_0x25208d,function(_0x4b3667){if(_0x4b3667[_0x8991('0x2f')]!=='VIRTUAL'){var _0x1b88c9={};_0x1b88c9[_0x4b3667[_0x8991('0x29')]]={'$like':'%'+_0x2267a1['query'][_0x8991('0x3e')]+'%'};return _0x1b88c9;}})});}_0x55a49f=_[_0x8991('0x3f')]({},_0x55a49f,_0x2267a1[_0x8991('0x40')]);var _0x40914d={'where':_0x55a49f[_0x8991('0x3c')]};return db[_0x8991('0x41')][_0x8991('0x20')](_0x40914d)[_0x8991('0x26')](function(_0x540abc){_0x29b23e['count']=_0x540abc;if(_0x2267a1['query'][_0x8991('0x42')]){_0x55a49f[_0x8991('0x43')]=[{'all':!![]}];}return db[_0x8991('0x41')]['findAll'](_0x55a49f);})[_0x8991('0x26')](function(_0x505d8a){_0x29b23e[_0x8991('0x44')]=_0x505d8a;return _0x29b23e;})[_0x8991('0x26')](respondWithFilteredResult(_0x5b9e0b,_0x55a49f))[_0x8991('0x45')](handleError(_0x5b9e0b,null));};exports[_0x8991('0x46')]=function(_0x61419f,_0x534a61){var _0x422d14={'raw':!![],'where':{'id':_0x61419f['params']['id']}},_0x3f5c51={};_0x3f5c51[_0x8991('0x31')]=_[_0x8991('0x33')](db['ChatGroup'][_0x8991('0x2d')]);_0x3f5c51[_0x8991('0x32')]=_['keys'](_0x61419f[_0x8991('0x32')]);_0x3f5c51['filters']=_[_0x8991('0x34')](_0x3f5c51['model'],_0x3f5c51[_0x8991('0x32')]);_0x422d14[_0x8991('0x35')]=_[_0x8991('0x34')](_0x3f5c51[_0x8991('0x31')],qs[_0x8991('0x36')](_0x61419f[_0x8991('0x32')][_0x8991('0x36')]));_0x422d14[_0x8991('0x35')]=_0x422d14[_0x8991('0x35')][_0x8991('0x37')]?_0x422d14[_0x8991('0x35')]:_0x3f5c51[_0x8991('0x31')];if(_0x61419f['query'][_0x8991('0x42')]){_0x422d14[_0x8991('0x43')]=[{'all':!![]}];}_0x422d14=_[_0x8991('0x3f')]({},_0x422d14,_0x61419f['options']);return db[_0x8991('0x41')][_0x8991('0x47')](_0x422d14)[_0x8991('0x26')](handleEntityNotFound(_0x534a61,null))[_0x8991('0x26')](respondWithResult(_0x534a61,null))[_0x8991('0x45')](handleError(_0x534a61,null));};exports[_0x8991('0x48')]=function(_0x112026,_0x10871c){return db[_0x8991('0x41')][_0x8991('0x48')](_0x112026[_0x8991('0x49')],{})[_0x8991('0x26')](respondWithResult(_0x10871c,0xc9))[_0x8991('0x45')](handleError(_0x10871c,null));};exports['update']=function(_0x5bf62c,_0x40efc8){if(_0x5bf62c[_0x8991('0x49')]['id']){delete _0x5bf62c[_0x8991('0x49')]['id'];}return db[_0x8991('0x41')][_0x8991('0x47')]({'where':{'id':_0x5bf62c['params']['id']}})['then'](handleEntityNotFound(_0x40efc8,null))[_0x8991('0x26')](saveUpdates(_0x5bf62c[_0x8991('0x49')],null))[_0x8991('0x26')](respondWithResult(_0x40efc8,null))[_0x8991('0x45')](handleError(_0x40efc8,null));};exports[_0x8991('0x25')]=function(_0xa3b0d5,_0x17c430){return db['ChatGroup'][_0x8991('0x47')]({'where':{'id':_0xa3b0d5[_0x8991('0x4a')]['id']}})[_0x8991('0x26')](handleEntityNotFound(_0x17c430,null))[_0x8991('0x26')](removeEntity(_0x17c430,null))[_0x8991('0x45')](handleError(_0x17c430,null));};exports[_0x8991('0x4b')]=function(_0x4d1388,_0x8b083){return db['ChatGroup'][_0x8991('0x4b')]()[_0x8991('0x26')](respondWithResult(_0x8b083,null))[_0x8991('0x45')](handleError(_0x8b083,null));};exports['getUnread']=function(_0x3ae116,_0x14bcf5,_0x2f611c){return db[_0x8991('0x4c')][_0x8991('0x20')]({'where':{'ChatGroupId':_0x3ae116[_0x8991('0x4a')]['id'],'ToId':_0x3ae116['user']['id'],'read':![]}})[_0x8991('0x26')](function(_0x26516b){return{'id':_[_0x8991('0x4d')](_0x3ae116[_0x8991('0x4a')]['id']),'count':_0x26516b};})[_0x8991('0x26')](respondWithResult(_0x14bcf5,null))[_0x8991('0x45')](handleError(_0x14bcf5,null));};exports['addMembers']=function(_0x4f1dc7,_0x4dcee7,_0x1df21d){return db['ChatGroup'][_0x8991('0x47')]({'where':{'id':_0x4f1dc7[_0x8991('0x4a')]['id']}})[_0x8991('0x26')](handleEntityNotFound(_0x4dcee7,null))['then'](function(_0x4f5c34){if(_0x4f5c34){return _0x4f5c34[_0x8991('0x4e')](_0x4f1dc7[_0x8991('0x49')][_0x8991('0x4f')],_['omit'](_0x4f1dc7['body'],['ids','id'])||{});}})[_0x8991('0x26')](respondWithResult(_0x4dcee7,null))[_0x8991('0x45')](handleError(_0x4dcee7,null));};exports[_0x8991('0x50')]=function(_0x48901b,_0x1660fb,_0x441856){var _0x3113f7={};var _0x67ae52={};var _0x123768;var _0xdcdddf;return db[_0x8991('0x41')][_0x8991('0x51')]({'where':{'id':_0x48901b['params']['id']}})[_0x8991('0x26')](handleEntityNotFound(_0x1660fb,null))[_0x8991('0x26')](function(_0x2af86e){if(_0x2af86e){_0x123768=_0x2af86e;_0x67ae52[_0x8991('0x31')]=_[_0x8991('0x33')](db[_0x8991('0x52')][_0x8991('0x2d')]);_0x67ae52[_0x8991('0x32')]=_['keys'](_0x48901b[_0x8991('0x32')]);_0x67ae52[_0x8991('0x3d')]=_[_0x8991('0x34')](_0x67ae52[_0x8991('0x31')],_0x67ae52[_0x8991('0x32')]);_0x3113f7[_0x8991('0x35')]=_[_0x8991('0x34')](_0x67ae52[_0x8991('0x31')],qs[_0x8991('0x36')](_0x48901b['query']['fields']));_0x3113f7[_0x8991('0x35')]=_0x3113f7[_0x8991('0x35')]['length']?_0x3113f7['attributes']:_0x67ae52[_0x8991('0x31')];_0x3113f7[_0x8991('0x3a')]=qs[_0x8991('0x3b')](_0x48901b['query'][_0x8991('0x3b')]);_0x3113f7[_0x8991('0x3c')]=qs['filters'](_[_0x8991('0x53')](_0x48901b[_0x8991('0x32')],_0x67ae52[_0x8991('0x3d')]));if(_0x48901b[_0x8991('0x32')][_0x8991('0x3e')]){_0x3113f7[_0x8991('0x3c')]=_[_0x8991('0x3f')](_0x3113f7['where'],{'$or':_[_0x8991('0x2c')](_0x3113f7[_0x8991('0x35')],function(_0x383374){var _0x5ea639={};_0x5ea639[_0x383374]={'$like':'%'+_0x48901b['query']['filter']+'%'};return _0x5ea639;})});}_0x3113f7=_[_0x8991('0x3f')]({},_0x3113f7,_0x48901b[_0x8991('0x40')]);return _0x123768[_0x8991('0x50')](_0x3113f7);}})[_0x8991('0x26')](function(_0x12ab22){if(_0x12ab22){_0xdcdddf=_0x12ab22['length'];if(!_0x48901b[_0x8991('0x32')][_0x8991('0x38')](_0x8991('0x39'))){_0x3113f7['limit']=qs['limit'](_0x48901b[_0x8991('0x32')][_0x8991('0x21')]);_0x3113f7[_0x8991('0x1e')]=qs[_0x8991('0x1e')](_0x48901b[_0x8991('0x32')]['offset']);}return _0x123768[_0x8991('0x50')](_0x3113f7);}})[_0x8991('0x26')](function(_0x4683b0){if(_0x4683b0){return _0x4683b0?{'count':_0xdcdddf,'rows':_0x4683b0}:null;}})[_0x8991('0x26')](respondWithResult(_0x1660fb,null))['catch'](handleError(_0x1660fb,null));};exports[_0x8991('0x54')]=function(_0x71d5a4,_0x4a58f7,_0x291d5b){return db[_0x8991('0x41')][_0x8991('0x47')]({'where':{'id':_0x71d5a4[_0x8991('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4a58f7,null))[_0x8991('0x26')](function(_0x27c1ff){if(_0x27c1ff){return _0x27c1ff[_0x8991('0x54')](_0x71d5a4[_0x8991('0x32')][_0x8991('0x4f')]);}})[_0x8991('0x26')](respondWithStatusCode(_0x4a58f7,null))[_0x8991('0x45')](handleError(_0x4a58f7,null));};exports[_0x8991('0x55')]=function(_0x3fba42,_0x483fea,_0x58fc06){if(_0x3fba42[_0x8991('0x49')]['id']){delete _0x3fba42[_0x8991('0x49')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0x3fba42[_0x8991('0x4a')]['id']}})['then'](handleEntityNotFound(_0x483fea,null))[_0x8991('0x26')](function(_0x284657){if(_0x284657){_0x3fba42[_0x8991('0x49')][_0x8991('0x56')]=_0x284657['id'];return db[_0x8991('0x4c')][_0x8991('0x48')](_0x3fba42['body']);}})[_0x8991('0x26')](respondWithResult(_0x483fea,null))[_0x8991('0x45')](handleError(_0x483fea,null));};exports[_0x8991('0x57')]=function(_0x13ed18,_0x3319de,_0x8d33d5){var _0x16918e={};var _0x4c28ec={};var _0x4a0e67;var _0x3bc1ca;return db[_0x8991('0x41')]['findOne']({'where':{'id':_0x13ed18[_0x8991('0x4a')]['id']}})[_0x8991('0x26')](handleEntityNotFound(_0x3319de,null))['then'](function(_0x5a9865){if(_0x5a9865){_0x4a0e67=_0x5a9865;_0x4c28ec['model']=_[_0x8991('0x33')](db[_0x8991('0x4c')]['rawAttributes']);_0x4c28ec[_0x8991('0x32')]=_[_0x8991('0x33')](_0x13ed18['query']);_0x4c28ec[_0x8991('0x3d')]=_[_0x8991('0x34')](_0x4c28ec['model'],_0x4c28ec['query']);_0x16918e['attributes']=_[_0x8991('0x34')](_0x4c28ec[_0x8991('0x31')],qs[_0x8991('0x36')](_0x13ed18[_0x8991('0x32')][_0x8991('0x36')]));_0x16918e[_0x8991('0x35')]=_0x16918e[_0x8991('0x35')][_0x8991('0x37')]?_0x16918e[_0x8991('0x35')]:_0x4c28ec[_0x8991('0x31')];_0x16918e[_0x8991('0x3a')]=qs[_0x8991('0x3b')](_0x13ed18[_0x8991('0x32')][_0x8991('0x3b')]);_0x16918e[_0x8991('0x3c')]=qs[_0x8991('0x3d')](_['pick'](_0x13ed18[_0x8991('0x32')],_0x4c28ec['filters']));if(_0x13ed18[_0x8991('0x32')][_0x8991('0x3e')]){_0x16918e['where']=_[_0x8991('0x3f')](_0x16918e[_0x8991('0x3c')],{'$or':_[_0x8991('0x2c')](_0x16918e[_0x8991('0x35')],function(_0x44736b){var _0x4a6b25={};_0x4a6b25[_0x44736b]={'$like':'%'+_0x13ed18[_0x8991('0x32')]['filter']+'%'};return _0x4a6b25;})});}if(_0x13ed18[_0x8991('0x32')][_0x8991('0x58')]){var _0x32ec3a=_0x13ed18[_0x8991('0x32')]['$gte']['split'](',');var _0x51cf62={};_0x51cf62[_0x32ec3a[0x0]]={'$gte':moment(_0x32ec3a[0x1])[_0x8991('0x59')](_0x8991('0x5a'))};_0x16918e[_0x8991('0x3c')]=_['merge'](_0x16918e[_0x8991('0x3c')],_0x51cf62);}_0x16918e=_[_0x8991('0x3f')]({},_0x16918e,_0x13ed18['options']);return _0x4a0e67['getMessages'](_0x16918e);}})[_0x8991('0x26')](function(_0x6acb63){if(_0x6acb63){_0x3bc1ca=_0x6acb63[_0x8991('0x37')];if(!_0x13ed18[_0x8991('0x32')][_0x8991('0x38')](_0x8991('0x39'))){_0x16918e['limit']=qs[_0x8991('0x21')](_0x13ed18[_0x8991('0x32')][_0x8991('0x21')]);_0x16918e[_0x8991('0x1e')]=qs[_0x8991('0x1e')](_0x13ed18[_0x8991('0x32')][_0x8991('0x1e')]);}return _0x4a0e67[_0x8991('0x57')](_0x16918e);}})[_0x8991('0x26')](function(_0x41977c){if(_0x41977c){return _0x41977c?{'count':_0x3bc1ca,'rows':_0x41977c}:null;}})[_0x8991('0x26')](respondWithResult(_0x3319de,null))[_0x8991('0x45')](handleError(_0x3319de,null));};
\ No newline at end of file
+var _0x8b7b=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','count','set','Content-Range','apply','save','update','then','error','name','send','index','ChatGroup','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','limit','order','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','find','create','body','params','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','keys','User','length','sort','pick','hasOwnProperty','nolimit','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x8b7b,0xbb));var _0xb8b7=function(_0x35b6eb,_0x4e40ec){_0x35b6eb=_0x35b6eb-0x0;var _0x2d5666=_0x8b7b[_0x35b6eb];return _0x2d5666;};'use strict';var emlformat=require(_0xb8b7('0x0'));var rimraf=require(_0xb8b7('0x1'));var zipdir=require(_0xb8b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b7('0x3'));var moment=require(_0xb8b7('0x4'));var BPromise=require(_0xb8b7('0x5'));var Mustache=require(_0xb8b7('0x6'));var util=require('util');var path=require(_0xb8b7('0x7'));var sox=require(_0xb8b7('0x8'));var csv=require(_0xb8b7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8b7('0xa'));var _=require(_0xb8b7('0xb'));var squel=require(_0xb8b7('0xc'));var crypto=require(_0xb8b7('0xd'));var jsforce=require(_0xb8b7('0xe'));var deskjs=require(_0xb8b7('0xf'));var toCsv=require(_0xb8b7('0x9'));var querystring=require(_0xb8b7('0x10'));var Papa=require(_0xb8b7('0x11'));var Redis=require(_0xb8b7('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb8b7('0x13'));var as=require(_0xb8b7('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b7('0x15'))(_0xb8b7('0x16'));var utils=require(_0xb8b7('0x17'));var config=require(_0xb8b7('0x18'));var licenseUtil=require(_0xb8b7('0x19'));var db=require(_0xb8b7('0x1a'))['db'];config['redis']=_[_0xb8b7('0x1b')](config[_0xb8b7('0x1c')],{'host':_0xb8b7('0x1d'),'port':0x18eb});var socket=require(_0xb8b7('0x1e'))(new Redis(config[_0xb8b7('0x1c')]));require(_0xb8b7('0x1f'))[_0xb8b7('0x20')](socket);function respondWithStatusCode(_0x1d60ed,_0x4894e0){_0x4894e0=_0x4894e0||0xcc;return function(_0x599b5b){if(_0x599b5b){return _0x1d60ed[_0xb8b7('0x21')](_0x4894e0);}return _0x1d60ed[_0xb8b7('0x22')](_0x4894e0)[_0xb8b7('0x23')]();};}function respondWithResult(_0x5ca998,_0x280845){_0x280845=_0x280845||0xc8;return function(_0x3656f2){if(_0x3656f2){return _0x5ca998['status'](_0x280845)['json'](_0x3656f2);}};}function respondWithFilteredResult(_0x1f0a1f,_0x52bad7){return function(_0x4f7419){if(_0x4f7419){var _0xd0e34d=typeof _0x52bad7[_0xb8b7('0x24')]===_0xb8b7('0x25')&&typeof _0x52bad7['limit']===_0xb8b7('0x25');var _0x7b2f04=_0x4f7419[_0xb8b7('0x26')];var _0x138081=_0xd0e34d?0x0:_0x52bad7[_0xb8b7('0x24')];var _0x48ac33=_0xd0e34d?_0x4f7419[_0xb8b7('0x26')]:_0x52bad7[_0xb8b7('0x24')]+_0x52bad7['limit'];var _0xa1711e;if(_0x48ac33>=_0x7b2f04){_0x48ac33=_0x7b2f04;_0xa1711e=0xc8;}else{_0xa1711e=0xce;}_0x1f0a1f[_0xb8b7('0x22')](_0xa1711e);return _0x1f0a1f[_0xb8b7('0x27')](_0xb8b7('0x28'),_0x138081+'-'+_0x48ac33+'/'+_0x7b2f04)['json'](_0x4f7419);}return null;};}function patchUpdates(_0x4f186b){return function(_0x54e0f3){try{jsonpatch[_0xb8b7('0x29')](_0x54e0f3,_0x4f186b,!![]);}catch(_0x243b70){return BPromise['reject'](_0x243b70);}return _0x54e0f3[_0xb8b7('0x2a')]();};}function saveUpdates(_0x26f583,_0x2934d8){return function(_0x343b97){if(_0x343b97){return _0x343b97[_0xb8b7('0x2b')](_0x26f583)[_0xb8b7('0x2c')](function(_0xd9902){return _0xd9902;});}return null;};}function removeEntity(_0x20e09c,_0x3c8236){return function(_0x1f6635){if(_0x1f6635){return _0x1f6635['destroy']()['then'](function(){_0x20e09c[_0xb8b7('0x22')](0xcc)[_0xb8b7('0x23')]();});}};}function handleEntityNotFound(_0x40e35d,_0x52072e){return function(_0x124b8a){if(!_0x124b8a){_0x40e35d[_0xb8b7('0x21')](0x194);}return _0x124b8a;};}function handleError(_0x12e0ab,_0x183e83){_0x183e83=_0x183e83||0x1f4;return function(_0x43007d){logger[_0xb8b7('0x2d')](_0x43007d['stack']);if(_0x43007d[_0xb8b7('0x2e')]){delete _0x43007d['name'];}_0x12e0ab[_0xb8b7('0x22')](_0x183e83)[_0xb8b7('0x2f')](_0x43007d);};}exports[_0xb8b7('0x30')]=function(_0x4e70ce,_0x2b861c){var _0x100c73={},_0x8cc4a6={},_0x317c91={'count':0x0,'rows':[]};var _0x5ac391=_['map'](db[_0xb8b7('0x31')][_0xb8b7('0x32')],function(_0x40ff48){return{'name':_0x40ff48[_0xb8b7('0x33')],'type':_0x40ff48['type'][_0xb8b7('0x34')]};});_0x8cc4a6[_0xb8b7('0x35')]=_[_0xb8b7('0x36')](_0x5ac391,_0xb8b7('0x2e'));_0x8cc4a6[_0xb8b7('0x37')]=_['keys'](_0x4e70ce[_0xb8b7('0x37')]);_0x8cc4a6[_0xb8b7('0x38')]=_[_0xb8b7('0x39')](_0x8cc4a6[_0xb8b7('0x35')],_0x8cc4a6[_0xb8b7('0x37')]);_0x100c73[_0xb8b7('0x3a')]=_[_0xb8b7('0x39')](_0x8cc4a6[_0xb8b7('0x35')],qs[_0xb8b7('0x3b')](_0x4e70ce[_0xb8b7('0x37')]['fields']));_0x100c73['attributes']=_0x100c73[_0xb8b7('0x3a')]['length']?_0x100c73['attributes']:_0x8cc4a6[_0xb8b7('0x35')];if(!_0x4e70ce[_0xb8b7('0x37')]['hasOwnProperty']('nolimit')){_0x100c73[_0xb8b7('0x3c')]=qs[_0xb8b7('0x3c')](_0x4e70ce[_0xb8b7('0x37')][_0xb8b7('0x3c')]);_0x100c73[_0xb8b7('0x24')]=qs[_0xb8b7('0x24')](_0x4e70ce[_0xb8b7('0x37')]['offset']);}_0x100c73[_0xb8b7('0x3d')]=qs['sort'](_0x4e70ce[_0xb8b7('0x37')]['sort']);_0x100c73['where']=qs[_0xb8b7('0x38')](_['pick'](_0x4e70ce['query'],_0x8cc4a6[_0xb8b7('0x38')]),_0x5ac391);if(_0x4e70ce[_0xb8b7('0x37')]['filter']){_0x100c73[_0xb8b7('0x3e')]=_[_0xb8b7('0x3f')](_0x100c73[_0xb8b7('0x3e')],{'$or':_[_0xb8b7('0x36')](_0x5ac391,function(_0x3b0582){if(_0x3b0582['type']!==_0xb8b7('0x40')){var _0x8b8fab={};_0x8b8fab[_0x3b0582[_0xb8b7('0x2e')]]={'$like':'%'+_0x4e70ce[_0xb8b7('0x37')][_0xb8b7('0x41')]+'%'};return _0x8b8fab;}})});}_0x100c73=_[_0xb8b7('0x3f')]({},_0x100c73,_0x4e70ce[_0xb8b7('0x42')]);var _0x2d1a7a={'where':_0x100c73[_0xb8b7('0x3e')]};return db['ChatGroup']['count'](_0x2d1a7a)[_0xb8b7('0x2c')](function(_0x543885){_0x317c91[_0xb8b7('0x26')]=_0x543885;if(_0x4e70ce['query'][_0xb8b7('0x43')]){_0x100c73[_0xb8b7('0x44')]=[{'all':!![]}];}return db[_0xb8b7('0x31')][_0xb8b7('0x45')](_0x100c73);})[_0xb8b7('0x2c')](function(_0x3ea7f2){_0x317c91['rows']=_0x3ea7f2;return _0x317c91;})[_0xb8b7('0x2c')](respondWithFilteredResult(_0x2b861c,_0x100c73))[_0xb8b7('0x46')](handleError(_0x2b861c,null));};exports[_0xb8b7('0x47')]=function(_0x5ef3c2,_0x1739f8){var _0x1016f6={'raw':!![],'where':{'id':_0x5ef3c2['params']['id']}},_0x21a3b5={};_0x21a3b5['model']=_['keys'](db[_0xb8b7('0x31')][_0xb8b7('0x32')]);_0x21a3b5[_0xb8b7('0x37')]=_['keys'](_0x5ef3c2[_0xb8b7('0x37')]);_0x21a3b5[_0xb8b7('0x38')]=_[_0xb8b7('0x39')](_0x21a3b5['model'],_0x21a3b5['query']);_0x1016f6[_0xb8b7('0x3a')]=_[_0xb8b7('0x39')](_0x21a3b5['model'],qs[_0xb8b7('0x3b')](_0x5ef3c2[_0xb8b7('0x37')]['fields']));_0x1016f6[_0xb8b7('0x3a')]=_0x1016f6[_0xb8b7('0x3a')]['length']?_0x1016f6[_0xb8b7('0x3a')]:_0x21a3b5[_0xb8b7('0x35')];if(_0x5ef3c2[_0xb8b7('0x37')][_0xb8b7('0x43')]){_0x1016f6[_0xb8b7('0x44')]=[{'all':!![]}];}_0x1016f6=_[_0xb8b7('0x3f')]({},_0x1016f6,_0x5ef3c2[_0xb8b7('0x42')]);return db[_0xb8b7('0x31')][_0xb8b7('0x48')](_0x1016f6)['then'](handleEntityNotFound(_0x1739f8,null))[_0xb8b7('0x2c')](respondWithResult(_0x1739f8,null))[_0xb8b7('0x46')](handleError(_0x1739f8,null));};exports[_0xb8b7('0x49')]=function(_0x28ff4e,_0x3f9cc5){return db[_0xb8b7('0x31')][_0xb8b7('0x49')](_0x28ff4e[_0xb8b7('0x4a')],{})[_0xb8b7('0x2c')](respondWithResult(_0x3f9cc5,0xc9))['catch'](handleError(_0x3f9cc5,null));};exports['update']=function(_0x4574d0,_0x320ddf){if(_0x4574d0[_0xb8b7('0x4a')]['id']){delete _0x4574d0[_0xb8b7('0x4a')]['id'];}return db[_0xb8b7('0x31')]['find']({'where':{'id':_0x4574d0['params']['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x320ddf,null))[_0xb8b7('0x2c')](saveUpdates(_0x4574d0[_0xb8b7('0x4a')],null))[_0xb8b7('0x2c')](respondWithResult(_0x320ddf,null))[_0xb8b7('0x46')](handleError(_0x320ddf,null));};exports['destroy']=function(_0x260920,_0x10beef){return db[_0xb8b7('0x31')][_0xb8b7('0x48')]({'where':{'id':_0x260920[_0xb8b7('0x4b')]['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x10beef,null))[_0xb8b7('0x2c')](removeEntity(_0x10beef,null))[_0xb8b7('0x46')](handleError(_0x10beef,null));};exports[_0xb8b7('0x4c')]=function(_0x3383a8,_0x3ccaac){return db[_0xb8b7('0x31')][_0xb8b7('0x4c')]()['then'](respondWithResult(_0x3ccaac,null))[_0xb8b7('0x46')](handleError(_0x3ccaac,null));};exports['getUnread']=function(_0xeac3af,_0xc0a1f7,_0x51cfbd){return db[_0xb8b7('0x4d')]['count']({'where':{'ChatGroupId':_0xeac3af[_0xb8b7('0x4b')]['id'],'ToId':_0xeac3af[_0xb8b7('0x4e')]['id'],'read':![]}})[_0xb8b7('0x2c')](function(_0x3bb49d){return{'id':_[_0xb8b7('0x4f')](_0xeac3af[_0xb8b7('0x4b')]['id']),'count':_0x3bb49d};})[_0xb8b7('0x2c')](respondWithResult(_0xc0a1f7,null))[_0xb8b7('0x46')](handleError(_0xc0a1f7,null));};exports[_0xb8b7('0x50')]=function(_0x2e4f71,_0x176070,_0x34e84e){return db[_0xb8b7('0x31')][_0xb8b7('0x48')]({'where':{'id':_0x2e4f71[_0xb8b7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x176070,null))[_0xb8b7('0x2c')](function(_0x5a7923){if(_0x5a7923){return _0x5a7923[_0xb8b7('0x50')](_0x2e4f71[_0xb8b7('0x4a')][_0xb8b7('0x51')],_[_0xb8b7('0x52')](_0x2e4f71['body'],[_0xb8b7('0x51'),'id'])||{});}})[_0xb8b7('0x2c')](respondWithResult(_0x176070,null))[_0xb8b7('0x46')](handleError(_0x176070,null));};exports[_0xb8b7('0x53')]=function(_0x1621a4,_0x1118e4,_0x17c8a8){var _0x391153={};var _0x2b24a3={};var _0x5f56a6;var _0x5d24c1;return db['ChatGroup'][_0xb8b7('0x54')]({'where':{'id':_0x1621a4['params']['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x1118e4,null))[_0xb8b7('0x2c')](function(_0x13c3a6){if(_0x13c3a6){_0x5f56a6=_0x13c3a6;_0x2b24a3[_0xb8b7('0x35')]=_[_0xb8b7('0x55')](db[_0xb8b7('0x56')]['rawAttributes']);_0x2b24a3[_0xb8b7('0x37')]=_['keys'](_0x1621a4['query']);_0x2b24a3[_0xb8b7('0x38')]=_[_0xb8b7('0x39')](_0x2b24a3[_0xb8b7('0x35')],_0x2b24a3['query']);_0x391153[_0xb8b7('0x3a')]=_['intersection'](_0x2b24a3[_0xb8b7('0x35')],qs[_0xb8b7('0x3b')](_0x1621a4[_0xb8b7('0x37')]['fields']));_0x391153[_0xb8b7('0x3a')]=_0x391153['attributes'][_0xb8b7('0x57')]?_0x391153[_0xb8b7('0x3a')]:_0x2b24a3[_0xb8b7('0x35')];_0x391153[_0xb8b7('0x3d')]=qs[_0xb8b7('0x58')](_0x1621a4[_0xb8b7('0x37')][_0xb8b7('0x58')]);_0x391153[_0xb8b7('0x3e')]=qs[_0xb8b7('0x38')](_[_0xb8b7('0x59')](_0x1621a4[_0xb8b7('0x37')],_0x2b24a3[_0xb8b7('0x38')]));if(_0x1621a4['query'][_0xb8b7('0x41')]){_0x391153[_0xb8b7('0x3e')]=_['merge'](_0x391153[_0xb8b7('0x3e')],{'$or':_[_0xb8b7('0x36')](_0x391153['attributes'],function(_0x582752){var _0x3ddc75={};_0x3ddc75[_0x582752]={'$like':'%'+_0x1621a4['query'][_0xb8b7('0x41')]+'%'};return _0x3ddc75;})});}_0x391153=_[_0xb8b7('0x3f')]({},_0x391153,_0x1621a4[_0xb8b7('0x42')]);return _0x5f56a6[_0xb8b7('0x53')](_0x391153);}})[_0xb8b7('0x2c')](function(_0x58d0ef){if(_0x58d0ef){_0x5d24c1=_0x58d0ef['length'];if(!_0x1621a4[_0xb8b7('0x37')][_0xb8b7('0x5a')](_0xb8b7('0x5b'))){_0x391153[_0xb8b7('0x3c')]=qs[_0xb8b7('0x3c')](_0x1621a4['query'][_0xb8b7('0x3c')]);_0x391153[_0xb8b7('0x24')]=qs['offset'](_0x1621a4[_0xb8b7('0x37')][_0xb8b7('0x24')]);}return _0x5f56a6[_0xb8b7('0x53')](_0x391153);}})[_0xb8b7('0x2c')](function(_0x5f1df7){if(_0x5f1df7){return _0x5f1df7?{'count':_0x5d24c1,'rows':_0x5f1df7}:null;}})[_0xb8b7('0x2c')](respondWithResult(_0x1118e4,null))[_0xb8b7('0x46')](handleError(_0x1118e4,null));};exports['removeMembers']=function(_0x1adefd,_0x25bd8f,_0x2eafc1){return db[_0xb8b7('0x31')][_0xb8b7('0x48')]({'where':{'id':_0x1adefd[_0xb8b7('0x4b')]['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x25bd8f,null))['then'](function(_0xbc4745){if(_0xbc4745){return _0xbc4745[_0xb8b7('0x5c')](_0x1adefd['query'][_0xb8b7('0x51')]);}})[_0xb8b7('0x2c')](respondWithStatusCode(_0x25bd8f,null))[_0xb8b7('0x46')](handleError(_0x25bd8f,null));};exports[_0xb8b7('0x5d')]=function(_0x3b5fa4,_0x1e804e,_0x28969a){if(_0x3b5fa4['body']['id']){delete _0x3b5fa4['body']['id'];}return db[_0xb8b7('0x31')][_0xb8b7('0x48')]({'where':{'id':_0x3b5fa4[_0xb8b7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e804e,null))[_0xb8b7('0x2c')](function(_0x410b55){if(_0x410b55){_0x3b5fa4[_0xb8b7('0x4a')][_0xb8b7('0x5e')]=_0x410b55['id'];return db['ChatInternalMessage'][_0xb8b7('0x49')](_0x3b5fa4['body']);}})[_0xb8b7('0x2c')](respondWithResult(_0x1e804e,null))[_0xb8b7('0x46')](handleError(_0x1e804e,null));};exports[_0xb8b7('0x5f')]=function(_0x5cdcda,_0x537e08,_0x3b3efd){var _0x21094f={};var _0xcaf45d={};var _0x4772a1;var _0x2870a0;return db[_0xb8b7('0x31')]['findOne']({'where':{'id':_0x5cdcda['params']['id']}})[_0xb8b7('0x2c')](handleEntityNotFound(_0x537e08,null))[_0xb8b7('0x2c')](function(_0x50bb18){if(_0x50bb18){_0x4772a1=_0x50bb18;_0xcaf45d[_0xb8b7('0x35')]=_['keys'](db[_0xb8b7('0x4d')][_0xb8b7('0x32')]);_0xcaf45d[_0xb8b7('0x37')]=_['keys'](_0x5cdcda[_0xb8b7('0x37')]);_0xcaf45d[_0xb8b7('0x38')]=_[_0xb8b7('0x39')](_0xcaf45d[_0xb8b7('0x35')],_0xcaf45d[_0xb8b7('0x37')]);_0x21094f[_0xb8b7('0x3a')]=_[_0xb8b7('0x39')](_0xcaf45d[_0xb8b7('0x35')],qs[_0xb8b7('0x3b')](_0x5cdcda['query'][_0xb8b7('0x3b')]));_0x21094f[_0xb8b7('0x3a')]=_0x21094f['attributes'][_0xb8b7('0x57')]?_0x21094f['attributes']:_0xcaf45d[_0xb8b7('0x35')];_0x21094f['order']=qs[_0xb8b7('0x58')](_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x58')]);_0x21094f[_0xb8b7('0x3e')]=qs[_0xb8b7('0x38')](_[_0xb8b7('0x59')](_0x5cdcda['query'],_0xcaf45d[_0xb8b7('0x38')]));if(_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x41')]){_0x21094f[_0xb8b7('0x3e')]=_[_0xb8b7('0x3f')](_0x21094f['where'],{'$or':_[_0xb8b7('0x36')](_0x21094f[_0xb8b7('0x3a')],function(_0x2e6bff){var _0x1b3f33={};_0x1b3f33[_0x2e6bff]={'$like':'%'+_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x41')]+'%'};return _0x1b3f33;})});}if(_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x60')]){var _0x58f388=_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x60')][_0xb8b7('0x61')](',');var _0x1a4de6={};_0x1a4de6[_0x58f388[0x0]]={'$gte':moment(_0x58f388[0x1])['format'](_0xb8b7('0x62'))};_0x21094f[_0xb8b7('0x3e')]=_[_0xb8b7('0x3f')](_0x21094f['where'],_0x1a4de6);}_0x21094f=_[_0xb8b7('0x3f')]({},_0x21094f,_0x5cdcda[_0xb8b7('0x42')]);return _0x4772a1[_0xb8b7('0x5f')](_0x21094f);}})[_0xb8b7('0x2c')](function(_0x4400d7){if(_0x4400d7){_0x2870a0=_0x4400d7['length'];if(!_0x5cdcda['query'][_0xb8b7('0x5a')]('nolimit')){_0x21094f[_0xb8b7('0x3c')]=qs[_0xb8b7('0x3c')](_0x5cdcda[_0xb8b7('0x37')][_0xb8b7('0x3c')]);_0x21094f[_0xb8b7('0x24')]=qs['offset'](_0x5cdcda['query']['offset']);}return _0x4772a1[_0xb8b7('0x5f')](_0x21094f);}})['then'](function(_0x81a070){if(_0x81a070){return _0x81a070?{'count':_0x2870a0,'rows':_0x81a070}:null;}})[_0xb8b7('0x2c')](respondWithResult(_0x537e08,null))[_0xb8b7('0x46')](handleError(_0x537e08,null));};
\ No newline at end of file
index 7bdf97a..55f3614 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x917f=['ChatGroup','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x917f,0x110));var _0xf917=function(_0x4d882c,_0x1f145c){_0x4d882c=_0x4d882c-0x0;var _0x301126=_0x917f[_0x4d882c];return _0x301126;};'use strict';var EventEmitter=require('events');var ChatGroup=require('../../mysqldb')['db'][_0xf917('0x0')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xf917('0x1')](0x0);var events={'afterCreate':_0xf917('0x2'),'afterUpdate':'update','afterDestroy':_0xf917('0x3')};function emitEvent(_0x25df66){return function(_0x5070ff,_0x1ef89d,_0x29300b){ChatGroupEvents[_0xf917('0x4')](_0x25df66+':'+_0x5070ff['id'],_0x5070ff);ChatGroupEvents[_0xf917('0x4')](_0x25df66,_0x5070ff);_0x29300b(null);};}for(var e in events){if(events[_0xf917('0x5')](e)){var event=events[e];ChatGroup[_0xf917('0x6')](e,emitEvent(event));}}module[_0xf917('0x7')]=ChatGroupEvents;
\ No newline at end of file
+var _0x1000=['hasOwnProperty','hook','events','../../mysqldb','ChatGroup','save','update','remove','emit'];(function(_0x1c5ca3,_0x18dcc2){var _0x5db079=function(_0x10bbce){while(--_0x10bbce){_0x1c5ca3['push'](_0x1c5ca3['shift']());}};_0x5db079(++_0x18dcc2);}(_0x1000,0x1e8));var _0x0100=function(_0x48b139,_0x5e089c){_0x48b139=_0x48b139-0x0;var _0x52d29d=_0x1000[_0x48b139];return _0x52d29d;};'use strict';var EventEmitter=require(_0x0100('0x0'));var ChatGroup=require(_0x0100('0x1'))['db'][_0x0100('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0100('0x3'),'afterUpdate':_0x0100('0x4'),'afterDestroy':_0x0100('0x5')};function emitEvent(_0x3b417e){return function(_0x2b662a,_0x416152,_0x1e8674){ChatGroupEvents[_0x0100('0x6')](_0x3b417e+':'+_0x2b662a['id'],_0x2b662a);ChatGroupEvents['emit'](_0x3b417e,_0x2b662a);_0x1e8674(null);};}for(var e in events){if(events[_0x0100('0x7')](e)){var event=events[e];ChatGroup[_0x0100('0x8')](e,emitEvent(event));}}module['exports']=ChatGroupEvents;
\ No newline at end of file
index bfab208..51e88ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d4f=['../../config/environment','exports','ChatGroup','chat_groups','lodash','util','request-promise','path','rimraf'];(function(_0x423f1c,_0x2adb8c){var _0xebed4c=function(_0x1beec9){while(--_0x1beec9){_0x423f1c['push'](_0x423f1c['shift']());}};_0xebed4c(++_0x2adb8c);}(_0x3d4f,0x94));var _0xf3d4=function(_0x465bd8,_0xf7c8f1){_0x465bd8=_0x465bd8-0x0;var _0x330d8d=_0x3d4f[_0x465bd8];return _0x330d8d;};'use strict';var _=require(_0xf3d4('0x0'));var util=require(_0xf3d4('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf3d4('0x2'));var fs=require('fs');var path=require(_0xf3d4('0x3'));var rimraf=require(_0xf3d4('0x4'));var config=require(_0xf3d4('0x5'));var attributes=require('./chatGroup.attributes');module[_0xf3d4('0x6')]=function(_0x418722,_0x40acc0){return _0x418722['define'](_0xf3d4('0x7'),attributes,{'tableName':_0xf3d4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2ebd=['chat_groups','util','api','moment','path','./chatGroup.attributes','exports','define','ChatGroup'];(function(_0x5e6cb8,_0x16cf56){var _0x3faeb3=function(_0x1a7355){while(--_0x1a7355){_0x5e6cb8['push'](_0x5e6cb8['shift']());}};_0x3faeb3(++_0x16cf56);}(_0x2ebd,0xfd));var _0xd2eb=function(_0x17ce0f,_0x529746){_0x17ce0f=_0x17ce0f-0x0;var _0x197cfa=_0x2ebd[_0x17ce0f];return _0x197cfa;};'use strict';var _=require('lodash');var util=require(_0xd2eb('0x0'));var logger=require('../../config/logger')(_0xd2eb('0x1'));var moment=require(_0xd2eb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd2eb('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd2eb('0x4'));module[_0xd2eb('0x5')]=function(_0x498dfd,_0x43c634){return _0x498dfd[_0xd2eb('0x6')](_0xd2eb('0x7'),attributes,{'tableName':_0xd2eb('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 36880d5..d5bb75d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf15e=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','ChatGroup,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0xf15e,0xb9));var _0xef15=function(_0x3765d7,_0x5790d9){_0x3765d7=_0x3765d7-0x0;var _0x87ed7d=_0xf15e[_0x3765d7];return _0x87ed7d;};'use strict';var _=require(_0xef15('0x0'));var util=require('util');var moment=require(_0xef15('0x1'));var BPromise=require(_0xef15('0x2'));var rs=require(_0xef15('0x3'));var fs=require('fs');var Redis=require(_0xef15('0x4'));var db=require(_0xef15('0x5'))['db'];var utils=require(_0xef15('0x6'));var logger=require('../../config/logger')(_0xef15('0x7'));var config=require(_0xef15('0x8'));var jayson=require(_0xef15('0x9'));var client=jayson[_0xef15('0xa')]['http']({'port':0x232a});config[_0xef15('0xb')]=_[_0xef15('0xc')](config[_0xef15('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xef15('0xd'))(new Redis(config[_0xef15('0xb')]));require(_0xef15('0xe'))[_0xef15('0xf')](socket);function respondWithRpcPromise(_0x4989da,_0xf5c4a7,_0x2290c3){return new BPromise(function(_0x416c5c,_0x4b51ab){return client[_0xef15('0x10')](_0x4989da,_0x2290c3)[_0xef15('0x11')](function(_0x16e4ee){logger[_0xef15('0x12')](_0xef15('0x13'),_0xf5c4a7,'request\x20sent');logger['debug'](_0xef15('0x14'),_0xf5c4a7,_0xef15('0x15'),JSON[_0xef15('0x16')](_0x16e4ee));if(_0x16e4ee['error']){if(_0x16e4ee[_0xef15('0x17')]['code']===0x1f4){logger[_0xef15('0x17')](_0xef15('0x13'),_0xf5c4a7,_0x16e4ee[_0xef15('0x17')]['message']);return _0x4b51ab(_0x16e4ee[_0xef15('0x17')]['message']);}logger['error'](_0xef15('0x13'),_0xf5c4a7,_0x16e4ee['error'][_0xef15('0x18')]);return _0x416c5c(_0x16e4ee[_0xef15('0x17')][_0xef15('0x18')]);}else{logger[_0xef15('0x12')](_0xef15('0x13'),_0xf5c4a7,'request\x20sent');_0x416c5c(_0x16e4ee[_0xef15('0x19')][_0xef15('0x18')]);}})[_0xef15('0x1a')](function(_0x40b9ca){logger['error'](_0xef15('0x13'),_0xf5c4a7,_0x40b9ca);_0x4b51ab(_0x40b9ca);});});}
\ No newline at end of file
+var _0x8cdb=['socket.io-emitter','redis','./chatGroup.socket','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','localhost'];(function(_0x39c9dd,_0x5d26ad){var _0xc66af8=function(_0x248d0f){while(--_0x248d0f){_0x39c9dd['push'](_0x39c9dd['shift']());}};_0xc66af8(++_0x5d26ad);}(_0x8cdb,0x138));var _0xb8cd=function(_0x527670,_0x26046e){_0x527670=_0x527670-0x0;var _0x3080a1=_0x8cdb[_0x527670];return _0x3080a1;};'use strict';var _=require(_0xb8cd('0x0'));var util=require('util');var moment=require(_0xb8cd('0x1'));var BPromise=require(_0xb8cd('0x2'));var rs=require(_0xb8cd('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8cd('0x4'))['db'];var utils=require(_0xb8cd('0x5'));var logger=require(_0xb8cd('0x6'))(_0xb8cd('0x7'));var config=require('../../config/environment');var jayson=require(_0xb8cd('0x8'));var client=jayson['client'][_0xb8cd('0x9')]({'port':0x232a});config['redis']=_[_0xb8cd('0xa')](config['redis'],{'host':_0xb8cd('0xb'),'port':0x18eb});var socket=require(_0xb8cd('0xc'))(new Redis(config[_0xb8cd('0xd')]));require(_0xb8cd('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c17e9,_0x2048a4,_0x2f9f59){return new BPromise(function(_0xcd14ca,_0x2de51f){return client[_0xb8cd('0xf')](_0x3c17e9,_0x2f9f59)[_0xb8cd('0x10')](function(_0x3c22af){logger[_0xb8cd('0x11')](_0xb8cd('0x12'),_0x2048a4,_0xb8cd('0x13'));logger[_0xb8cd('0x14')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2048a4,_0xb8cd('0x13'),JSON[_0xb8cd('0x15')](_0x3c22af));if(_0x3c22af[_0xb8cd('0x16')]){if(_0x3c22af['error'][_0xb8cd('0x17')]===0x1f4){logger[_0xb8cd('0x16')](_0xb8cd('0x12'),_0x2048a4,_0x3c22af[_0xb8cd('0x16')][_0xb8cd('0x18')]);return _0x2de51f(_0x3c22af[_0xb8cd('0x16')][_0xb8cd('0x18')]);}logger['error'](_0xb8cd('0x12'),_0x2048a4,_0x3c22af[_0xb8cd('0x16')][_0xb8cd('0x18')]);return _0xcd14ca(_0x3c22af[_0xb8cd('0x16')]['message']);}else{logger[_0xb8cd('0x11')](_0xb8cd('0x12'),_0x2048a4,_0xb8cd('0x13'));_0xcd14ca(_0x3c22af[_0xb8cd('0x19')][_0xb8cd('0x18')]);}})[_0xb8cd('0x1a')](function(_0x46dc9c){logger[_0xb8cd('0x16')](_0xb8cd('0x12'),_0x2048a4,_0x46dc9c);_0x2de51f(_0x46dc9c);});});}
\ No newline at end of file
index 2afdd3a..6ff0f9b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x74dd=['./chatGroup.events','save','remove','update','emit','removeListener','register','length','chatGroup:'];(function(_0x5a2a2b,_0x37bc37){var _0x4cf8fb=function(_0x4edf3){while(--_0x4edf3){_0x5a2a2b['push'](_0x5a2a2b['shift']());}};_0x4cf8fb(++_0x37bc37);}(_0x74dd,0x90));var _0xd74d=function(_0xa861aa,_0x2895a4){_0xa861aa=_0xa861aa-0x0;var _0x1e34de=_0x74dd[_0xa861aa];return _0x1e34de;};'use strict';var ChatGroupEvents=require(_0xd74d('0x0'));var events=[_0xd74d('0x1'),_0xd74d('0x2'),_0xd74d('0x3')];function createListener(_0x1799c6,_0x472b2a){return function(_0x3bcd1c){_0x472b2a[_0xd74d('0x4')](_0x1799c6,_0x3bcd1c);};}function removeListener(_0x550bbe,_0x3ff693){return function(){ChatGroupEvents[_0xd74d('0x5')](_0x550bbe,_0x3ff693);};}exports[_0xd74d('0x6')]=function(_0x2af664){for(var _0x31321a=0x0,_0x35413e=events[_0xd74d('0x7')];_0x31321a<_0x35413e;_0x31321a++){var _0x4d94c5=events[_0x31321a];var _0x3c5888=createListener(_0xd74d('0x8')+_0x4d94c5,_0x2af664);ChatGroupEvents['on'](_0x4d94c5,_0x3c5888);}};
\ No newline at end of file
+var _0x23e5=['chatGroup:','save','remove','update','emit','removeListener','register','length'];(function(_0x3e14cb,_0x2d27f2){var _0x1fdfc7=function(_0x309726){while(--_0x309726){_0x3e14cb['push'](_0x3e14cb['shift']());}};_0x1fdfc7(++_0x2d27f2);}(_0x23e5,0xe9));var _0x523e=function(_0x14aee3,_0x4be548){_0x14aee3=_0x14aee3-0x0;var _0x58954c=_0x23e5[_0x14aee3];return _0x58954c;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x523e('0x0'),_0x523e('0x1'),_0x523e('0x2')];function createListener(_0x282ab8,_0x5e1221){return function(_0x38a949){_0x5e1221[_0x523e('0x3')](_0x282ab8,_0x38a949);};}function removeListener(_0x5c2bba,_0x15a262){return function(){ChatGroupEvents[_0x523e('0x4')](_0x5c2bba,_0x15a262);};}exports[_0x523e('0x5')]=function(_0x5b97dd){for(var _0x18b4ea=0x0,_0x376e2a=events[_0x523e('0x6')];_0x18b4ea<_0x376e2a;_0x18b4ea++){var _0x15d135=events[_0x18b4ea];var _0x221612=createListener(_0x523e('0x7')+_0x15d135,_0x5b97dd);ChatGroupEvents['on'](_0x15d135,_0x221612);}};
\ No newline at end of file
index a0428f1..6311fcb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2422=['getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','create','addMembers','addMessage','put','update','destroy','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./chatGroup.controller','isAuthenticated','index','get','/describe','describe','/:id','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2422,0x1b2));var _0x2242=function(_0x441fe7,_0x573eb8){_0x441fe7=_0x441fe7-0x0;var _0x2abb93=_0x2422[_0x441fe7];return _0x2abb93;};'use strict';var multer=require(_0x2242('0x0'));var util=require(_0x2242('0x1'));var path=require(_0x2242('0x2'));var timeout=require(_0x2242('0x3'));var express=require(_0x2242('0x4'));var router=express[_0x2242('0x5')]();var fs_extra=require(_0x2242('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2242('0x7'));var controller=require(_0x2242('0x8'));router['get']('/',auth[_0x2242('0x9')](),controller[_0x2242('0xa')]);router[_0x2242('0xb')](_0x2242('0xc'),auth[_0x2242('0x9')](),controller[_0x2242('0xd')]);router['get'](_0x2242('0xe'),auth[_0x2242('0x9')](),controller[_0x2242('0xf')]);router['get']('/:id/unread',auth['isAuthenticated'](),controller[_0x2242('0x10')]);router['get'](_0x2242('0x11'),auth['isAuthenticated'](),controller[_0x2242('0x12')]);router[_0x2242('0xb')](_0x2242('0x13'),auth['isAuthenticated'](),controller[_0x2242('0x14')]);router[_0x2242('0x15')]('/',auth[_0x2242('0x9')](),controller[_0x2242('0x16')]);router[_0x2242('0x15')](_0x2242('0x11'),auth[_0x2242('0x9')](),controller[_0x2242('0x17')]);router['post'](_0x2242('0x13'),auth[_0x2242('0x9')](),controller[_0x2242('0x18')]);router[_0x2242('0x19')](_0x2242('0xe'),auth[_0x2242('0x9')](),controller[_0x2242('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2242('0x1b')]);router[_0x2242('0x1c')](_0x2242('0x11'),auth[_0x2242('0x9')](),controller['removeMembers']);module[_0x2242('0x1d')]=router;
\ No newline at end of file
+var _0x0b7c=['show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','post','addMessage','put','delete','destroy','removeMembers','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id'];(function(_0x6d0143,_0x3d7c30){var _0x29cb75=function(_0x3bfcf4){while(--_0x3bfcf4){_0x6d0143['push'](_0x6d0143['shift']());}};_0x29cb75(++_0x3d7c30);}(_0x0b7c,0x139));var _0xc0b7=function(_0x3b9d5f,_0x2e9039){_0x3b9d5f=_0x3b9d5f-0x0;var _0x39924e=_0x0b7c[_0x3b9d5f];return _0x39924e;};'use strict';var multer=require('multer');var util=require(_0xc0b7('0x0'));var path=require('path');var timeout=require(_0xc0b7('0x1'));var express=require('express');var router=express[_0xc0b7('0x2')]();var fs_extra=require(_0xc0b7('0x3'));var auth=require(_0xc0b7('0x4'));var interaction=require(_0xc0b7('0x5'));var config=require(_0xc0b7('0x6'));var controller=require('./chatGroup.controller');router[_0xc0b7('0x7')]('/',auth['isAuthenticated'](),controller[_0xc0b7('0x8')]);router[_0xc0b7('0x7')]('/describe',auth[_0xc0b7('0x9')](),controller[_0xc0b7('0xa')]);router[_0xc0b7('0x7')](_0xc0b7('0xb'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0xc')]);router['get'](_0xc0b7('0xd'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0xe')]);router[_0xc0b7('0x7')](_0xc0b7('0xf'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x10')]);router[_0xc0b7('0x7')](_0xc0b7('0x11'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x12')]);router[_0xc0b7('0x13')]('/',auth[_0xc0b7('0x9')](),controller['create']);router[_0xc0b7('0x13')](_0xc0b7('0xf'),auth[_0xc0b7('0x9')](),controller['addMembers']);router['post'](_0xc0b7('0x11'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x14')]);router[_0xc0b7('0x15')](_0xc0b7('0xb'),auth[_0xc0b7('0x9')](),controller['update']);router[_0xc0b7('0x16')](_0xc0b7('0xb'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x17')]);router[_0xc0b7('0x16')](_0xc0b7('0xf'),auth[_0xc0b7('0x9')](),controller[_0xc0b7('0x18')]);module['exports']=router;
\ No newline at end of file
index b959985..242ec58 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc88=['out','BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long'];(function(_0x5558e5,_0x3cd554){var _0x2ccef1=function(_0x1cd7be){while(--_0x1cd7be){_0x5558e5['push'](_0x5558e5['shift']());}};_0x2ccef1(++_0x3cd554);}(_0xfc88,0x1cd));var _0x8fc8=function(_0x599c94,_0x464f0e){_0x599c94=_0x599c94-0x0;var _0x34e215=_0xfc88[_0x599c94];return _0x34e215;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x8fc8('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8fc8('0x1')]},'ratingType':{'type':Sequelize[_0x8fc8('0x2')](_0x8fc8('0x3'),_0x8fc8('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x8fc8('0x5')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x8fc8('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8fc8('0x7')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8fc8('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x8fc8('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x8fc8('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x8fc8('0x6')]},'deviceVendor':{'type':Sequelize[_0x8fc8('0x6')]},'deviceType':{'type':Sequelize[_0x8fc8('0x6')]},'referer':{'type':Sequelize[_0x8fc8('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x8fc8('0x5')](_0x8fc8('0x8'))},'read1stAt':{'type':Sequelize[_0x8fc8('0x7')]},'lastMsgAt':{'type':Sequelize[_0x8fc8('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x8fc8('0x2')]('in',_0x8fc8('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x8fc8('0x6')]},'customerPort':{'type':Sequelize[_0x8fc8('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x8fc8('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x8fc8('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x4dcf=['long','ENUM','out','exports','BOOLEAN','INTEGER','star','thumb','TEXT','STRING','DATE'];(function(_0x28717b,_0x497695){var _0x284566=function(_0xa5ffa1){while(--_0xa5ffa1){_0x28717b['push'](_0x28717b['shift']());}};_0x284566(++_0x497695);}(_0x4dcf,0xc9));var _0xf4dc=function(_0x563918,_0x102c5f){_0x563918=_0x563918-0x0;var _0x1e1738=_0x4dcf[_0x563918];return _0x1e1738;};'use strict';var Sequelize=require('sequelize');module[_0xf4dc('0x0')]={'closed':{'type':Sequelize[_0xf4dc('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xf4dc('0x2')]},'ratingType':{'type':Sequelize['ENUM'](_0xf4dc('0x3'),_0xf4dc('0x4')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0xf4dc('0x5')]},'pathTranscript':{'type':Sequelize[_0xf4dc('0x5')]},'mailTranscript':{'type':Sequelize[_0xf4dc('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xf4dc('0x7')]},'disposition':{'type':Sequelize[_0xf4dc('0x6')]},'secondDisposition':{'type':Sequelize[_0xf4dc('0x6')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf4dc('0x6')]},'browserName':{'type':Sequelize[_0xf4dc('0x6')]},'browserVersion':{'type':Sequelize[_0xf4dc('0x6')]},'osName':{'type':Sequelize[_0xf4dc('0x6')]},'osVersion':{'type':Sequelize[_0xf4dc('0x6')]},'deviceModel':{'type':Sequelize[_0xf4dc('0x6')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0xf4dc('0x6')]},'referer':{'type':Sequelize[_0xf4dc('0x5')]},'customerIp':{'type':Sequelize[_0xf4dc('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xf4dc('0x8'))},'read1stAt':{'type':Sequelize[_0xf4dc('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf4dc('0x9')]('in',_0xf4dc('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xf4dc('0x6')]},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize[_0xf4dc('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0xf4dc('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xf4dc('0x2')]}};
\ No newline at end of file
index 2281f7b..f512ff3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdab2=['sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','intersection','hasOwnProperty','nolimit','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','order','sort','ChatInteractionId','include','push','addTags','omit','spread','color','removeTags','toString','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','createdAt','read','Account','get','mkdirSync','Owner','N.A.','browserName','referer','customerIp','customerPort','tail','existsSync','pipe','direction','out','value','renderFile','views','downloadInteraction.ejs','transcript-','Chat','createPdfFromHTML','err','unlinkSync','zip-dir','request-promise','moment','bluebird','mustache','lodash','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','jayson/promise','client','http','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','then','end','name','merge','body','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','keys','filters','attributes','model','fields','length','options','find','create','update','params','describe','createVidaooSession','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','ChatMessage','ValidationError','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','AbandonInteraction','originalname','basename','file','filename','Attachment','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','format','transcript-%s.txt','now','pathTranscript','User','ChatWebsiteId','ContactId','Messages','agentAlias','System','customer','%s%d','Visitor','agentIdentifier','alias','agent_fullname','secret','appendFileSync','MailAccount','MailServerOut','Smtp','getSmtpOptions'];(function(_0x2f8e37,_0x5da168){var _0x2e693d=function(_0x14da73){while(--_0x14da73){_0x2f8e37['push'](_0x2f8e37['shift']());}};_0x2e693d(++_0x5da168);}(_0xdab2,0x1c3));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x2dab('0x0'));var rp=require(_0x2dab('0x1'));var moment=require(_0x2dab('0x2'));var BPromise=require(_0x2dab('0x3'));var Mustache=require(_0x2dab('0x4'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x2dab('0x5'));var Redis=require(_0x2dab('0x6'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x2dab('0x7'))('api');var config=require('../../config/environment');var db=require(_0x2dab('0x8'))['db'];config[_0x2dab('0x9')]=_[_0x2dab('0xa')](config[_0x2dab('0x9')],{'host':_0x2dab('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2dab('0x9')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x2dab('0xc'));var client=jayson[_0x2dab('0xd')][_0x2dab('0xe')]({'port':0x232b});var client9004=jayson[_0x2dab('0xd')][_0x2dab('0xe')]({'port':0x232c});function respondWithRpcPromise(_0x28d67c,_0x307c31,_0x4f837d,_0x3fca1c){return new BPromise(function(_0x181de7,_0x2b8f77){var _0x13f1ef=_0x3fca1c||client;return _0x13f1ef['request'](_0x28d67c,_0x4f837d)['then'](function(_0x2b2394){logger[_0x2dab('0xf')](_0x2dab('0x10'),_0x307c31,'request\x20sent');logger[_0x2dab('0x11')](_0x2dab('0x12'),_0x307c31,_0x2dab('0x13'),JSON[_0x2dab('0x14')](_0x2b2394));if(_0x2b2394[_0x2dab('0x15')]){if(_0x2b2394[_0x2dab('0x15')][_0x2dab('0x16')]===0x1f4){logger[_0x2dab('0x15')](_0x2dab('0x10'),_0x307c31,_0x2b2394[_0x2dab('0x15')][_0x2dab('0x17')]);return _0x2b8f77(_0x2b2394['error'][_0x2dab('0x17')]);}logger[_0x2dab('0x15')](_0x2dab('0x10'),_0x307c31,_0x2b2394[_0x2dab('0x15')][_0x2dab('0x17')]);return _0x181de7(_0x2b2394[_0x2dab('0x15')][_0x2dab('0x17')]);}else{logger[_0x2dab('0xf')](_0x2dab('0x10'),_0x307c31,_0x2dab('0x13'));_0x181de7(_0x2b2394[_0x2dab('0x18')]['message']);}})['catch'](function(_0x3bf5d8){logger[_0x2dab('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x307c31,_0x3bf5d8);_0x2b8f77(_0x3bf5d8);});});}function respondWithStatusCode(_0x301d3d,_0x574d1b){_0x574d1b=_0x574d1b||0xcc;return function(_0x17c15d){if(_0x17c15d){return _0x301d3d[_0x2dab('0x19')](_0x574d1b);}return _0x301d3d[_0x2dab('0x1a')](_0x574d1b)['end']();};}function respondWithResult(_0x475796,_0xcdaa1){_0xcdaa1=_0xcdaa1||0xc8;return function(_0x21e251){if(_0x21e251){return _0x475796[_0x2dab('0x1a')](_0xcdaa1)[_0x2dab('0x1b')](_0x21e251);}};}function respondWithFilteredResult(_0x21ced0,_0x2a493d){return function(_0x4e442d){if(_0x4e442d){var _0x3d9159=typeof _0x2a493d[_0x2dab('0x1c')]===_0x2dab('0x1d')&&typeof _0x2a493d[_0x2dab('0x1e')]==='undefined';var _0x1ac2c4=_0x4e442d[_0x2dab('0x1f')];var _0x2efe11=_0x3d9159?0x0:_0x2a493d[_0x2dab('0x1c')];var _0x111468=_0x3d9159?_0x4e442d['count']:_0x2a493d[_0x2dab('0x1c')]+_0x2a493d[_0x2dab('0x1e')];var _0x26e088;if(_0x111468>=_0x1ac2c4){_0x111468=_0x1ac2c4;_0x26e088=0xc8;}else{_0x26e088=0xce;}_0x21ced0[_0x2dab('0x1a')](_0x26e088);return _0x21ced0[_0x2dab('0x20')](_0x2dab('0x21'),_0x2efe11+'-'+_0x111468+'/'+_0x1ac2c4)[_0x2dab('0x1b')](_0x4e442d);}return null;};}function saveUpdates(_0x4a1f8b){return function(_0x3db6b1){if(_0x3db6b1){return _0x3db6b1['update'](_0x4a1f8b)['then'](function(_0x1fa48e){return _0x1fa48e;});}return null;};}function removeEntity(_0x535691){return function(_0x33f21d){if(_0x33f21d){return _0x33f21d[_0x2dab('0x22')]()[_0x2dab('0x23')](function(){_0x535691[_0x2dab('0x1a')](0xcc)[_0x2dab('0x24')]();});}};}function handleEntityNotFound(_0x408a52){return function(_0x4c93f9){if(!_0x4c93f9){_0x408a52[_0x2dab('0x19')](0x194);}return _0x4c93f9;};}function handleError(_0x217ef4,_0x244c2e){_0x244c2e=_0x244c2e||0x1f4;return function(_0x1dec88){logger['error'](_0x1dec88['stack']);if(_0x1dec88[_0x2dab('0x25')]){delete _0x1dec88[_0x2dab('0x25')];}_0x217ef4[_0x2dab('0x1a')](_0x244c2e)['send'](_0x1dec88);};}function getMustacheRender(_0x3d1ac8,_0x3fffa7){return Mustache['render'](_0x3d1ac8,_[_0x2dab('0x26')](_0x3fffa7[_0x2dab('0x27')],{'contact':_0x3fffa7[_0x2dab('0x28')],'message':_0x3fffa7[_0x2dab('0x17')],'agent':_0x3fffa7[_0x2dab('0x29')],'interaction':_0x3fffa7[_0x2dab('0x2a')],'account':_0x3fffa7[_0x2dab('0x2b')]}))||'';}exports['index']=function(_0x5887ac,_0x2963dc){var _0x246828={};var _0x34b6e1=_[_0x2dab('0x2c')](db[_0x2dab('0x2d')][_0x2dab('0x2e')],function(_0x302857){return{'name':_0x302857[_0x2dab('0x2f')],'type':_0x302857[_0x2dab('0x30')][_0x2dab('0x31')]};});_0x246828=qs[_0x2dab('0x32')](_0x34b6e1,_0x5887ac);return interaction[_0x2dab('0x33')]('chat',_0x5887ac[_0x2dab('0x34')],_0x5887ac['user'],_0x246828,_0x34b6e1)[_0x2dab('0x23')](respondWithFilteredResult(_0x2963dc,_0x246828))[_0x2dab('0x35')](handleError(_0x2963dc,null));};exports['show']=function(_0x177766,_0x54628b){var _0x3c37c4={'raw':![],'where':{'id':_0x177766['params']['id']}},_0x20b8e3={};_0x20b8e3['model']=_[_0x2dab('0x36')](db['ChatInteraction'][_0x2dab('0x2e')]);_0x20b8e3[_0x2dab('0x34')]=_['keys'](_0x177766[_0x2dab('0x34')]);_0x20b8e3[_0x2dab('0x37')]=_['intersection'](_0x20b8e3['model'],_0x20b8e3[_0x2dab('0x34')]);_0x3c37c4[_0x2dab('0x38')]=_['intersection'](_0x20b8e3[_0x2dab('0x39')],qs[_0x2dab('0x3a')](_0x177766['query']['fields']));_0x3c37c4[_0x2dab('0x38')]=_0x3c37c4[_0x2dab('0x38')][_0x2dab('0x3b')]?_0x3c37c4['attributes']:_0x20b8e3[_0x2dab('0x39')];if(_0x177766[_0x2dab('0x34')]['includeAll']){_0x3c37c4['include']=[{'all':!![]}];}_0x3c37c4=_[_0x2dab('0x26')]({},_0x3c37c4,_0x177766[_0x2dab('0x3c')]);return db[_0x2dab('0x2d')][_0x2dab('0x3d')](_0x3c37c4)[_0x2dab('0x23')](handleEntityNotFound(_0x54628b,null))[_0x2dab('0x23')](respondWithResult(_0x54628b,null))['catch'](handleError(_0x54628b,null));};exports['create']=function(_0x5c0911,_0x173683){return db[_0x2dab('0x2d')][_0x2dab('0x3e')](_0x5c0911['body'],{})[_0x2dab('0x23')](respondWithResult(_0x173683,0xc9))[_0x2dab('0x35')](handleError(_0x173683,null));};exports[_0x2dab('0x3f')]=function(_0xc946b7,_0x19e281){if(_0xc946b7[_0x2dab('0x27')]['id']){delete _0xc946b7[_0x2dab('0x27')]['id'];}return db[_0x2dab('0x2d')][_0x2dab('0x3d')]({'where':{'id':_0xc946b7[_0x2dab('0x40')]['id']}})[_0x2dab('0x23')](handleEntityNotFound(_0x19e281,null))[_0x2dab('0x23')](saveUpdates(_0xc946b7[_0x2dab('0x27')],null))[_0x2dab('0x23')](respondWithResult(_0x19e281,null))[_0x2dab('0x35')](handleError(_0x19e281,null));};exports[_0x2dab('0x22')]=function(_0x459a68,_0x2557a2){return db[_0x2dab('0x2d')][_0x2dab('0x3d')]({'where':{'id':_0x459a68[_0x2dab('0x40')]['id']}})['then'](handleEntityNotFound(_0x2557a2,null))[_0x2dab('0x23')](removeEntity(_0x2557a2,null))[_0x2dab('0x35')](handleError(_0x2557a2,null));};exports['describe']=function(_0x120dd0,_0x1e6388){return db[_0x2dab('0x2d')][_0x2dab('0x41')]()['then'](respondWithResult(_0x1e6388,null))[_0x2dab('0x35')](handleError(_0x1e6388,null));};exports[_0x2dab('0x42')]=function(_0x5471cc,_0xda5831){var _0x7eb021=_0x5471cc[_0x2dab('0x40')]['id'];var _0x11d7a8;var _0x2ee3f2;var _0x44fde7;return db[_0x2dab('0x2d')][_0x2dab('0x43')]({'where':{'id':_0x7eb021}})[_0x2dab('0x23')](function(_0x150721){_0x11d7a8=_0x150721;return db[_0x2dab('0x44')][_0x2dab('0x43')]({'where':{'id':_0x150721['ChatWebsiteId']},'attributes':['id',_0x2dab('0x45'),_0x2dab('0x46'),_0x2dab('0x47'),_0x2dab('0x48'),_0x2dab('0x49')],'raw':!![]});})[_0x2dab('0x23')](function(_0x503894){if(_0x503894&&_0x503894[_0x2dab('0x45')]&&_0x503894['vidaooEscalation']){_0x2ee3f2=_0x503894;var _0x47f124={'interaction':{'id':_0x7eb021},'agent':{'id':_0x5471cc['user']['id'],'name':_0x5471cc[_0x2dab('0x4a')][_0x2dab('0x25')],'fullname':_0x5471cc[_0x2dab('0x4a')][_0x2dab('0x4b')],'email':_0x5471cc[_0x2dab('0x4a')][_0x2dab('0x4c')]},'contact':_0x5471cc['body']['contact'],'account':_0x5471cc[_0x2dab('0x27')][_0x2dab('0x2b')]};var _0x4d07b9={'rejectUnauthorized':![],'method':'POST','url':_0x2dab('0x4d'),'headers':{'X-APIKEY':_0x503894[_0x2dab('0x45')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5471cc[_0x2dab('0x4a')][_0x2dab('0x4c')]],'buttons':null,'topic':_0x2ee3f2['vidaooTopic'],'note':_[_0x2dab('0x4e')](_0x2ee3f2['vidaooNote'])?null:getMustacheRender(_0x2ee3f2[_0x2dab('0x48')],_0x47f124),'metadata':null},'redirect':_0x2dab('0x4f'),'json':!![]};try{if(!_[_0x2dab('0x4e')](_0x2ee3f2[_0x2dab('0x49')])){var _0x3e2dd3=getMustacheRender(_0x2ee3f2['vidaooMetadata'],_0x47f124);var _0x55d598=JSON[_0x2dab('0x50')](_0x3e2dd3);_0x4d07b9[_0x2dab('0x27')][_0x2dab('0x51')]=_0x55d598;}}catch(_0x56b164){throw new db[(_0x2dab('0x52'))]['ValidationError'](_0x2dab('0x53'));}return rp(_0x4d07b9);}else{throw new db[(_0x2dab('0x52'))]['ValidationError'](_0x2dab('0x54'));}})[_0x2dab('0x23')](function(_0x31d389){_0x44fde7=_0x31d389;if(_0x44fde7['id']){var _0x2e7e6c={'body':_0x44fde7['join_url'],'ChatWebsiteId':_0x2ee3f2['id'],'ChatInteractionId':_0x11d7a8['id'],'direction':'out','UserId':_0x5471cc[_0x2dab('0x4a')]['id']};return db[_0x2dab('0x55')]['create'](_0x2e7e6c,{});}else{throw new db[(_0x2dab('0x52'))][(_0x2dab('0x56'))](_0x2dab('0x57'));}})['then'](function(){return _0x11d7a8[_0x2dab('0x58')]({'vidaooSessionId':_0x44fde7['id']});})[_0x2dab('0x23')](respondWithResult(_0xda5831,null))[_0x2dab('0x35')](handleError(_0xda5831,null));};exports[_0x2dab('0x59')]=function(_0x4575b3,_0x37f3c7){if(_0x4575b3[_0x2dab('0x27')]['id']){delete _0x4575b3[_0x2dab('0x27')]['id'];}return db[_0x2dab('0x2d')][_0x2dab('0x3d')]({'where':{'id':_0x4575b3[_0x2dab('0x40')]['id']},'include':[{'model':db[_0x2dab('0x5a')],'as':_0x2dab('0x5b')}]})['then'](handleEntityNotFound(_0x37f3c7,null))[_0x2dab('0x23')](saveUpdates(_0x4575b3['body'],null))[_0x2dab('0x23')](respondWithResult(_0x37f3c7,null))[_0x2dab('0x35')](handleError(_0x37f3c7,null));};exports[_0x2dab('0x5c')]=function(_0x4e4d93,_0x49359a){if(_0x4e4d93[_0x2dab('0x27')]['id']){delete _0x4e4d93[_0x2dab('0x27')]['id'];}return db[_0x2dab('0x2d')][_0x2dab('0x3d')]({'where':{'id':_0x4e4d93[_0x2dab('0x40')]['id']}})['then'](function(_0x30a7ef){if(!_0x30a7ef){logger[_0x2dab('0x15')](_0x2dab('0x5d'),'abandon',0x194,_0x2dab('0x5e'));_0x49359a['sendStatus'](0x194);}else{if(_0x30a7ef[_0x2dab('0x5f')]){throw new db[(_0x2dab('0x52'))][(_0x2dab('0x56'))]('Interaction\x20already\x20assigned');}}return _0x30a7ef;})[_0x2dab('0x23')](function(_0x2a61d3){if(_0x2a61d3){return _0x2a61d3[_0x2dab('0x3f')]({'closed':_0x4e4d93['body']['closed'],'disposition':_0x4e4d93[_0x2dab('0x27')]['disposition']})[_0x2dab('0x23')](function(_0x5a10f3){return _0x5a10f3;});}})[_0x2dab('0x23')](function(){return respondWithRpcPromise(_0x2dab('0x60'),_0x2dab('0x5c'),_0x4e4d93[_0x2dab('0x27')],client9004);})[_0x2dab('0x23')](respondWithResult(_0x49359a,null))[_0x2dab('0x35')](handleError(_0x49359a,null));};exports['attachmentUpload']=function(_0x538007,_0x3f0832){_0x538007[_0x2dab('0x27')][_0x2dab('0x25')]=_0x538007['file'][_0x2dab('0x61')];_0x538007[_0x2dab('0x27')][_0x2dab('0x62')]=_0x538007[_0x2dab('0x63')][_0x2dab('0x64')];_0x538007['body']['type']=_0x538007[_0x2dab('0x63')]['mimetype'];return db[_0x2dab('0x65')][_0x2dab('0x3e')](_0x538007[_0x2dab('0x27')])[_0x2dab('0x23')](respondWithResult(_0x3f0832,0xc9))['catch'](handleError(_0x3f0832,null));};exports[_0x2dab('0x66')]=function(_0x52f579,_0x2a3022){return db[_0x2dab('0x2d')][_0x2dab('0x43')]({'where':{'id':_0x52f579[_0x2dab('0x40')]['id']},'raw':!![]})[_0x2dab('0x23')](handleEntityNotFound(_0x2a3022,null))[_0x2dab('0x23')](function(_0xbeff4f){if(_0xbeff4f){if(_0xbeff4f[_0x2dab('0x67')]){return _0x2a3022[_0x2dab('0x1a')](0x193)[_0x2dab('0x1b')]({'status':0x193,'message':_0x2dab('0x68')});}return db[_0x2dab('0x65')][_0x2dab('0x43')]({'where':{'id':_0x52f579[_0x2dab('0x34')][_0x2dab('0x69')]},'raw':!![]})[_0x2dab('0x23')](handleEntityNotFound(_0x2a3022,null));}})[_0x2dab('0x23')](function(_0x2cb085){if(_0x2cb085){var _0x1a2d29=_0x2cb085[_0x2dab('0x6a')]!==null;var _0x2ceb89=path[_0x2dab('0x6b')](config[_0x2dab('0x6c')],_0x2dab('0x6d'));if(_0x1a2d29){_0x2ceb89=path['join'](_0x2ceb89,_0x2dab('0x6e'));}var _0x1e5dba=path[_0x2dab('0x6b')](_0x2ceb89,_0x2cb085['basename']);return _0x2a3022[_0x2dab('0x6f')](_0x1e5dba);}})[_0x2dab('0x35')](handleError(_0x2a3022,null));};exports['close']=function(_0x2df89e,_0x2143b6){var _0x2d5fb3=null;var _0x37b48f=null;var _0x126352=null;if(_0x2df89e[_0x2dab('0x27')]['id']){delete _0x2df89e[_0x2dab('0x27')]['id'];}if(_0x2df89e[_0x2dab('0x27')]['mailTranscript']){_0x126352=path['join'](config['root'],'server/files/chat/upload/',util[_0x2dab('0x70')](_0x2dab('0x71'),Date[_0x2dab('0x72')]()));_0x2df89e[_0x2dab('0x27')][_0x2dab('0x73')]=_0x126352;}return db[_0x2dab('0x2d')][_0x2dab('0x3d')]({'where':{'id':_0x2df89e[_0x2dab('0x40')]['id']},'include':[{'model':db[_0x2dab('0x55')],'as':'Messages','include':[{'model':db[_0x2dab('0x74')],'as':_0x2dab('0x74')}]}]})[_0x2dab('0x23')](handleEntityNotFound(_0x2143b6,null))[_0x2dab('0x23')](saveUpdates(_0x2df89e[_0x2dab('0x27')],null))['then'](function(_0x2e8dfc){if(_0x2e8dfc){_0x2d5fb3=_0x2e8dfc;return db[_0x2dab('0x44')]['find']({'where':{'id':_0x2d5fb3[_0x2dab('0x75')]}});}})[_0x2dab('0x23')](function(_0x5e2aee){if(_0x5e2aee){_0x37b48f=_0x5e2aee;return db['CmContact'][_0x2dab('0x3d')]({'where':{'id':_0x2d5fb3[_0x2dab('0x76')]}});}})[_0x2dab('0x23')](function(_0xd23977){if(_0xd23977){if(_0x126352){var _0x1a6012=null;for(var _0x2da242=0x1;_0x2da242<_0x2d5fb3[_0x2dab('0x77')][_0x2dab('0x3b')];++_0x2da242){_0x1a6012=_0x2d5fb3[_0x2dab('0x77')][_0x2da242];var _0x4ac114=_0x1a6012[_0x2dab('0x5f')]?util[_0x2dab('0x70')]('%s%d',_0x37b48f[_0x2dab('0x78')],_0x1a6012['UserId']):_0x2dab('0x79');var _0x22dcfa=_0x2df89e[_0x2dab('0x27')][_0x2dab('0x7a')]||util[_0x2dab('0x70')](_0x2dab('0x7b'),_0x2dab('0x7c'),_0x1a6012[_0x2dab('0x76')]);switch(_0x37b48f[_0x2dab('0x7d')]){case'website_alias':_0x4ac114=_0x1a6012[_0x2dab('0x5f')]?util[_0x2dab('0x70')]('%s%d',_0x37b48f[_0x2dab('0x78')],_0x1a6012[_0x2dab('0x5f')]):'System';break;case'agent_alias':_0x4ac114=_0x1a6012[_0x2dab('0x5f')]?_0x1a6012[_0x2dab('0x74')][_0x2dab('0x7e')]||_0x1a6012[_0x2dab('0x74')][_0x2dab('0x4b')]:_0x2dab('0x79');break;case _0x2dab('0x7f'):_0x4ac114=_0x1a6012[_0x2dab('0x5f')]?_0x1a6012[_0x2dab('0x74')]['fullname']:_0x2dab('0x79');break;default:_0x4ac114=_0x1a6012['UserId']?util['format']('%s%d',_0x37b48f[_0x2dab('0x78')],_0x1a6012[_0x2dab('0x5f')]):_0x2dab('0x79');}var _0x3b7a2b=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x1a6012['createdAt'])[_0x2dab('0x70')]('MM/DD/YYYY\x20HH:mm:ss'),_0x1a6012['direction']==='in'?_0x22dcfa:_0x4ac114,_0x1a6012[_0x2dab('0x27')]);if(!_0x1a6012[_0x2dab('0x80')]){fs[_0x2dab('0x81')](_0x126352,_0x3b7a2b);}}return db[_0x2dab('0x82')][_0x2dab('0x43')]({'where':{'service':!![]},'include':[{'model':db[_0x2dab('0x83')],'as':_0x2dab('0x84'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x2dab('0x23')](function(_0xa31cf9){if(!_0xa31cf9||!_0xa31cf9[_0x2dab('0x84')]||!_0x2df89e[_0x2dab('0x27')])return _0x2d5fb3;var _0x189a85=_0xa31cf9[_0x2dab('0x85')]();return respondWithRpcPromise('SendMail',_0x2dab('0x86'),{'account':_0x189a85,'message':{'from':util[_0x2dab('0x70')](_0x2dab('0x87'),_0xa31cf9['name'],_0xa31cf9['email']||_0xa31cf9[_0x2dab('0x84')][_0x2dab('0x4a')]),'to':_0x2df89e[_0x2dab('0x27')][_0x2dab('0x88')],'subject':_0x2dab('0x89'),'text':util[_0x2dab('0x70')](_0x2dab('0x8a'),_0x2df89e['body'][_0x2dab('0x88')]),'attachments':[{'path':_0x126352}]}})['then'](function(){return _0x2d5fb3;})[_0x2dab('0x35')](function(_0x3bc16c){logger[_0x2dab('0x15')](_0x3bc16c);});})['then'](respondWithStatusCode(_0x2143b6,0xc8))[_0x2dab('0x35')](handleError(_0x2143b6,null));};exports[_0x2dab('0x8b')]=function(_0x13b7a1,_0x464c2a){return db['ChatMessage'][_0x2dab('0x3d')]({'where':{'id':_0x13b7a1[_0x2dab('0x40')]['id']}})[_0x2dab('0x23')](handleEntityNotFound(_0x464c2a,null))['then'](function(_0x300a0f){if(_0x300a0f){return _0x300a0f['addMessage'](_0x13b7a1[_0x2dab('0x27')][_0x2dab('0x8c')],_['omit'](_0x13b7a1['body'],[_0x2dab('0x8c'),'id'])||{});}})[_0x2dab('0x23')](respondWithResult(_0x464c2a,null))['catch'](handleError(_0x464c2a,null));};exports[_0x2dab('0x8d')]=function(_0x24404c,_0x281b7f){var _0x5323d9={'raw':![],'where':{}};var _0x113854={};var _0x4f7d93={'count':0x0,'rows':[]};return db[_0x2dab('0x2d')]['findOne']({'where':{'id':_0x24404c['params']['id']}})['then'](handleEntityNotFound(_0x281b7f,null))['then'](function(_0x43d1b3){if(_0x43d1b3){_0x113854[_0x2dab('0x39')]=_[_0x2dab('0x36')](db[_0x2dab('0x55')][_0x2dab('0x2e')]);_0x113854[_0x2dab('0x34')]=_[_0x2dab('0x36')](_0x24404c[_0x2dab('0x34')]);_0x113854['filters']=_[_0x2dab('0x8e')](_0x113854['model'],_0x113854[_0x2dab('0x34')]);_0x5323d9['attributes']=_[_0x2dab('0x8e')](_0x113854[_0x2dab('0x39')],qs[_0x2dab('0x3a')](_0x24404c[_0x2dab('0x34')][_0x2dab('0x3a')]));_0x5323d9[_0x2dab('0x38')]=_0x5323d9[_0x2dab('0x38')][_0x2dab('0x3b')]?_0x5323d9[_0x2dab('0x38')]:_0x113854[_0x2dab('0x39')];if(!_0x24404c[_0x2dab('0x34')][_0x2dab('0x8f')](_0x2dab('0x90'))){_0x5323d9[_0x2dab('0x1e')]=qs[_0x2dab('0x1e')](_0x24404c[_0x2dab('0x34')][_0x2dab('0x1e')]);_0x5323d9[_0x2dab('0x1c')]=qs['offset'](_0x24404c['query'][_0x2dab('0x1c')]);}_0x5323d9['order']=qs['sort'](_0x24404c['query']['sort']);_0x5323d9[_0x2dab('0x91')]=qs[_0x2dab('0x37')](_[_0x2dab('0x92')](_0x24404c[_0x2dab('0x34')],_0x113854[_0x2dab('0x37')]));_0x5323d9[_0x2dab('0x91')]['ChatInteractionId']=_0x43d1b3['id'];if(_0x24404c['query']['filter']){_0x5323d9[_0x2dab('0x91')]=_[_0x2dab('0x26')](_0x5323d9['where'],{'$or':_[_0x2dab('0x2c')](_0x5323d9[_0x2dab('0x38')],function(_0x19ba16){var _0x5483e9={};_0x5483e9[_0x19ba16]={'$like':'%'+_0x24404c['query'][_0x2dab('0x93')]+'%'};return _0x5483e9;})});}if(_0x24404c['query'][_0x2dab('0x94')]){var _0x8e0549=_0x24404c[_0x2dab('0x34')]['$gte']['split'](',');var _0x4cdb3b={};_0x4cdb3b[_0x8e0549[0x0]]={'$gte':moment(_0x8e0549[0x1])[_0x2dab('0x70')](_0x2dab('0x95'))};_0x5323d9[_0x2dab('0x91')]=_[_0x2dab('0x26')](_0x5323d9[_0x2dab('0x91')],_0x4cdb3b);}_0x5323d9=_[_0x2dab('0x26')]({},_0x5323d9,_0x24404c['options']);return db[_0x2dab('0x55')][_0x2dab('0x1f')]({'where':_0x5323d9[_0x2dab('0x91')]})[_0x2dab('0x23')](function(_0x30442e){_0x4f7d93[_0x2dab('0x1f')]=_0x30442e;if(_0x24404c[_0x2dab('0x34')][_0x2dab('0x96')]){_0x5323d9['include']=[{'all':!![]}];}return db[_0x2dab('0x55')][_0x2dab('0x33')](_0x5323d9);})[_0x2dab('0x23')](function(_0xd99616){_0x4f7d93[_0x2dab('0x97')]=_0xd99616;return _0x4f7d93;});}})[_0x2dab('0x23')](respondWithFilteredResult(_0x281b7f,_0x5323d9))[_0x2dab('0x35')](handleError(_0x281b7f,null));};exports[_0x2dab('0x98')]=function(_0x2304d6,_0x19973c){var _0x51035c={'where':{}},_0x4dbeac={},_0x2e3acb={'count':0x0,'rows':[]};return db[_0x2dab('0x2d')][_0x2dab('0x43')]({'where':{'id':_0x2304d6[_0x2dab('0x40')]['id']}})['then'](handleEntityNotFound(_0x19973c,null))[_0x2dab('0x23')](function(_0x2d1898){if(_0x2d1898){_0x4dbeac['model']=_[_0x2dab('0x36')](db[_0x2dab('0x55')]['rawAttributes']);_0x4dbeac[_0x2dab('0x34')]=_[_0x2dab('0x36')](_0x2304d6[_0x2dab('0x34')]);_0x4dbeac[_0x2dab('0x37')]=_[_0x2dab('0x8e')](_0x4dbeac[_0x2dab('0x39')],_0x4dbeac['query']);_0x51035c[_0x2dab('0x38')]=_['intersection'](_0x4dbeac[_0x2dab('0x39')],qs['fields'](_0x2304d6[_0x2dab('0x34')][_0x2dab('0x3a')]));_0x51035c[_0x2dab('0x38')]=_0x51035c['attributes'][_0x2dab('0x3b')]?_0x51035c['attributes']:_0x4dbeac[_0x2dab('0x39')];if(!_0x2304d6[_0x2dab('0x34')][_0x2dab('0x8f')]('nolimit')){_0x51035c[_0x2dab('0x1e')]=qs[_0x2dab('0x1e')](_0x2304d6['query'][_0x2dab('0x1e')]);_0x51035c['offset']=qs['offset'](_0x2304d6[_0x2dab('0x34')][_0x2dab('0x1c')]);}_0x51035c[_0x2dab('0x99')]=qs[_0x2dab('0x9a')](_0x2304d6[_0x2dab('0x34')]['sort']);_0x51035c[_0x2dab('0x91')]=qs[_0x2dab('0x37')](_[_0x2dab('0x92')](_0x2304d6[_0x2dab('0x34')],_0x4dbeac[_0x2dab('0x37')]));_0x51035c[_0x2dab('0x91')][_0x2dab('0x9b')]=_0x2d1898['id'];if(_0x2304d6[_0x2dab('0x34')][_0x2dab('0x93')]){_0x51035c[_0x2dab('0x91')]=_[_0x2dab('0x26')](_0x51035c[_0x2dab('0x91')],{'$or':_[_0x2dab('0x2c')](_0x51035c[_0x2dab('0x38')],function(_0x1c9699){var _0x3dc192={};_0x3dc192[_0x1c9699]={'$like':'%'+_0x2304d6[_0x2dab('0x34')]['filter']+'%'};return _0x3dc192;})});}_0x51035c[_0x2dab('0x91')][_0x2dab('0x80')]=![];if(_0x2304d6[_0x2dab('0x34')]['id']){_0x51035c[_0x2dab('0x91')]['id']={'$gt':_0x2304d6[_0x2dab('0x34')]['id']};}_0x51035c=_[_0x2dab('0x26')]({},_0x51035c,_0x2304d6[_0x2dab('0x3c')]);return db[_0x2dab('0x55')]['count']({'where':_0x51035c[_0x2dab('0x91')]})['then'](function(_0x1589a3){_0x2e3acb['count']=_0x1589a3;_0x51035c[_0x2dab('0x9c')]=[];if(_0x2304d6[_0x2dab('0x34')]['includeAgent']){_0x51035c[_0x2dab('0x9c')][_0x2dab('0x9d')]({'model':db[_0x2dab('0x74')],'as':'User','attributes':['id',_0x2dab('0x4b'),_0x2dab('0x7e')]});}if(_0x2304d6[_0x2dab('0x34')][_0x2dab('0x96')]){_0x51035c[_0x2dab('0x9c')]=[{'all':!![]}];}return db[_0x2dab('0x55')][_0x2dab('0x33')](_0x51035c);})['then'](function(_0x53319b){_0x2e3acb['rows']=_0x53319b;return _0x2e3acb;});}})[_0x2dab('0x23')](respondWithFilteredResult(_0x19973c,_0x51035c))[_0x2dab('0x35')](handleError(_0x19973c,null));};exports[_0x2dab('0x9e')]=function(_0x17b45d,_0x44d72c){return db[_0x2dab('0x2d')][_0x2dab('0x3d')]({'where':{'id':_0x17b45d[_0x2dab('0x40')]['id']}})[_0x2dab('0x23')](handleEntityNotFound(_0x44d72c,null))[_0x2dab('0x23')](function(_0x2a2aad){if(_0x2a2aad){return _0x2a2aad['setTags'](_0x17b45d[_0x2dab('0x27')]['ids'],_[_0x2dab('0x9f')](_0x17b45d[_0x2dab('0x27')],[_0x2dab('0x8c'),'id'])||{})[_0x2dab('0xa0')](function(){return db['Tag'][_0x2dab('0x33')]({'attributes':['id',_0x2dab('0x25'),_0x2dab('0xa1')],'where':{'id':_0x17b45d[_0x2dab('0x27')][_0x2dab('0x8c')]}});})[_0x2dab('0x23')](function(_0x508b63){socket['emit']('chatInteractionTags:save',{'id':Number(_0x17b45d[_0x2dab('0x40')]['id']),'tags':_0x508b63||[]});return{'id':Number(_0x17b45d[_0x2dab('0x40')]['id']),'tags':_0x508b63||[]};});}})['then'](respondWithResult(_0x44d72c,null))['catch'](handleError(_0x44d72c,null));};exports[_0x2dab('0xa2')]=function(_0x1f88dc,_0x26ff80){return db['ChatInteraction'][_0x2dab('0x3d')]({'where':{'id':_0x1f88dc[_0x2dab('0x40')]['id']}})['then'](handleEntityNotFound(_0x26ff80,null))['then'](function(_0x3b7819){if(_0x3b7819){return _0x3b7819[_0x2dab('0xa2')](_0x1f88dc[_0x2dab('0x34')]['ids']);}})[_0x2dab('0x23')](respondWithStatusCode(_0x26ff80,null))[_0x2dab('0x35')](handleError(_0x26ff80,null));};exports['download']=function(_0x2d270c,_0xe26d79){var _0x5297e3=moment()['unix']()[_0x2dab('0xa3')]();var _0x1c0050=path[_0x2dab('0x6b')](config['root'],_0x2dab('0xa4'),_0x2dab('0xa5'),'tmp');var _0x204592=path[_0x2dab('0x6b')](config[_0x2dab('0x6c')],'server','files',_0x2dab('0xa6'));var _0x5cab7d=path[_0x2dab('0x6b')](_0x1c0050,_0x5297e3);var _0x2ed60d=util['format'](_0x2dab('0xa7'),_0x2d270c['params']['id'],_0x5297e3);var _0x15003c=path['join'](_0x1c0050,_0x2ed60d);var _0x30120e=[];_0x30120e[_0x2dab('0x9d')]({'model':db[_0x2dab('0x74')],'as':'User','attributes':['id',_0x2dab('0x4b')],'raw':!![]});_0x30120e[_0x2dab('0x9d')]({'model':db[_0x2dab('0x5a')],'as':_0x2dab('0x5b'),'attributes':['id',_0x2dab('0xa8'),_0x2dab('0xa9')],'raw':!![]});if(_0x2d270c['query'][_0x2dab('0xa6')]){_0x30120e[_0x2dab('0x9d')]({'model':db[_0x2dab('0x65')],'as':_0x2dab('0x65'),'raw':!![]});}var _0x37cf63=[{'model':db['ChatMessage'],'as':_0x2dab('0x77'),'attributes':['id',_0x2dab('0x27'),_0x2dab('0xaa'),'direction','secret',_0x2dab('0xab')],'include':_0x30120e}];_0x37cf63[_0x2dab('0x9d')]({'model':db[_0x2dab('0x44')],'as':_0x2dab('0xac'),'attributes':['id',_0x2dab('0x25')]});_0x37cf63[_0x2dab('0x9d')]({'model':db[_0x2dab('0x74')],'as':'Owner','attributes':['id',_0x2dab('0x4b')]});return db[_0x2dab('0x2d')][_0x2dab('0x3d')]({'where':{'id':_0x2d270c[_0x2dab('0x40')]['id']},'include':_0x37cf63})[_0x2dab('0x23')](handleEntityNotFound(_0xe26d79,null))[_0x2dab('0x23')](function(_0x449ebd){if(_0x449ebd){var _0x5cf43c=_0x449ebd[_0x2dab('0xad')]({'plain':!![]});fs[_0x2dab('0xae')](_0x5cab7d);var _0x18780a={'channel':'Chat','account':_0x5cf43c[_0x2dab('0xac')]['name'],'agent':_0x5cf43c['Owner']?_0x5cf43c[_0x2dab('0xaf')][_0x2dab('0x4b')]:_0x2dab('0xb0'),'createdAt':moment(_0x5cf43c[_0x2dab('0xaa')])[_0x2dab('0x70')](_0x2dab('0x95'))[_0x2dab('0xa3')](),'closedAt':_0x5cf43c[_0x2dab('0x67')]?moment(_0x5cf43c['closedAt'])[_0x2dab('0x70')](_0x2dab('0x95'))[_0x2dab('0xa3')]():'','disposition':_0x5cf43c['disposition'],'chatInfo':{'browser':_0x5cf43c[_0x2dab('0xb1')],'os':_0x5cf43c['osName'],'referer':_0x5cf43c[_0x2dab('0xb2')],'customerIp':_0x5cf43c[_0x2dab('0xb3')],'customerPort':_0x5cf43c[_0x2dab('0xb4')]?_0x5cf43c[_0x2dab('0xb4')]:_0x2dab('0xb0')},'messages':_(_0x5cf43c[_0x2dab('0x77')])[_0x2dab('0xb5')]()['filter']({'secret':![]})['map'](function(_0x54180b){if(_0x54180b[_0x2dab('0x65')]){var _0x1c3b14=path['join'](_0x204592,_0x54180b[_0x2dab('0x65')][_0x2dab('0x62')]);if(fs[_0x2dab('0xb6')](_0x1c3b14)){fs['createReadStream'](_0x1c3b14)[_0x2dab('0xb7')](fs['createWriteStream'](path[_0x2dab('0x6b')](_0x5cab7d,_0x54180b['Attachment'][_0x2dab('0x62')])));}}return{'date':moment(_0x54180b[_0x2dab('0xaa')])[_0x2dab('0x70')](_0x2dab('0x95'))[_0x2dab('0xa3')](),'sender':_0x54180b[_0x2dab('0xb8')]===_0x2dab('0xb9')?_0x54180b[_0x2dab('0x74')]?_0x54180b[_0x2dab('0x74')][_0x2dab('0x4b')]:_0x2dab('0x79'):_0x54180b[_0x2dab('0x5b')][_0x2dab('0xa8')]+(_0x54180b['Contact'][_0x2dab('0xa9')]?'\x20'+_0x54180b['Contact']['lastName']:''),'body':_0x54180b[_0x2dab('0x65')]?_0x54180b['Attachment'][_0x2dab('0x62')]:_0x54180b[_0x2dab('0x27')],'direction':_0x54180b['direction']===_0x2dab('0xb9')?'A':'C','secret':_0x54180b['secret'],'read':_0x54180b[_0x2dab('0xab')],'attachment':_0x54180b[_0x2dab('0x65')]};})[_0x2dab('0xba')]()};return ejs[_0x2dab('0xbb')](path[_0x2dab('0x6b')](config[_0x2dab('0x6c')],_0x2dab('0xa4'),_0x2dab('0xbc'),_0x2dab('0xbd')),{'interaction':_0x18780a})[_0x2dab('0x23')](function(_0x840b7d){var _0x49bc05=path['join'](_0x5cab7d,_0x2dab('0xbe')+_0x5cf43c['id']+'-'+_0x5297e3+'.pdf');var _0x209ebe={'path':_0x49bc05,'channel':_0x2dab('0xbf'),'interactionId':_0x5cf43c['id']};return pdf[_0x2dab('0xc0')](_0x840b7d,_0x209ebe);})[_0x2dab('0x23')](function(){return new Promise(function(_0x15a5bf,_0x3b3714){zipdir(_0x5cab7d,{'saveTo':_0x15003c},function(_0x129e6c,_0x549bea){if(_0x129e6c)return _0x3b3714(_0x129e6c);return _0x15a5bf(_0x549bea);});})[_0x2dab('0x23')](function(){return new BPromise(function(_0x1a92bb,_0x192963){rimraf(_0x5cab7d,function(_0x513869){if(_0x513869)_0x192963(_0x513869);return _0x1a92bb();});});})['then'](function(){return _0xe26d79[_0x2dab('0x6f')](_0x15003c,_0x2ed60d,function(_0xe925bf){if(_0xe925bf){logger[_0x2dab('0x15')](_0x2dab('0xc1'),_0xe925bf);}else{fs[_0x2dab('0xc2')](_0x15003c);}});});});}else{return _0xe26d79[_0x2dab('0x19')](0xc8);}})[_0x2dab('0x35')](handleError(_0xe26d79,null));};
\ No newline at end of file
+var _0x5239=['Chat','err','unlinkSync','zip-dir','request-promise','mustache','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','destroy','stack','name','send','render','merge','body','contact','agent','account','map','ChatInteraction','fieldName','type','key','getOptions','findAll','chat','query','user','show','params','model','keys','intersection','attributes','fields','length','includeAll','create','find','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','fullname','email','POST','isNull','vidaooNote','follow','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','updateAttributes','CmContact','Contact','abandon','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','mimetype','Attachment','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','basename','close','mailTranscript','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ChatWebsite','ContactId','UserId','%s%d','agentAlias','Visitor','agentIdentifier','website_alias','System','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','getMessages','filters','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','include','rows','getMyMessages','rawAttributes','includeAgent','push','alias','addTags','setTags','omit','spread','Tag','ids','chatInteractionTags:save','removeTags','download','toString','server','files','tmp','attachments','lastName','createdAt','Account','Owner','mkdirSync','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','firstName','read','value','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x461c41,_0x2e6d1c){var _0x509e12=function(_0x245f5d){while(--_0x245f5d){_0x461c41['push'](_0x461c41['shift']());}};_0x509e12(++_0x2e6d1c);}(_0x5239,0x1a5));var _0x9523=function(_0x2f9a42,_0x222316){_0x2f9a42=_0x2f9a42-0x0;var _0x440df7=_0x5239[_0x2f9a42];return _0x440df7;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x9523('0x0'));var rp=require(_0x9523('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9523('0x2'));var util=require(_0x9523('0x3'));var path=require(_0x9523('0x4'));var ejs=require(_0x9523('0x5'));var fs=require('fs');var _=require(_0x9523('0x6'));var Redis=require(_0x9523('0x7'));var interaction=require(_0x9523('0x8'));var qs=require('../../components/parsers/qs');var pdf=require(_0x9523('0x9'));var logger=require(_0x9523('0xa'))(_0x9523('0xb'));var config=require(_0x9523('0xc'));var db=require(_0x9523('0xd'))['db'];config[_0x9523('0xe')]=_[_0x9523('0xf')](config['redis'],{'host':_0x9523('0x10'),'port':0x18eb});var socket=require(_0x9523('0x11'))(new Redis(config[_0x9523('0xe')]));require(_0x9523('0x12'))[_0x9523('0x13')](socket);var jayson=require(_0x9523('0x14'));var client=jayson[_0x9523('0x15')]['http']({'port':0x232b});var client9004=jayson[_0x9523('0x15')][_0x9523('0x16')]({'port':0x232c});function respondWithRpcPromise(_0x2067ed,_0x596e2c,_0x33db01,_0x449d6a){return new BPromise(function(_0x5b8607,_0x15f7c6){var _0x370206=_0x449d6a||client;return _0x370206[_0x9523('0x17')](_0x2067ed,_0x33db01)[_0x9523('0x18')](function(_0x440fc3){logger['info'](_0x9523('0x19'),_0x596e2c,_0x9523('0x1a'));logger[_0x9523('0x1b')](_0x9523('0x1c'),_0x596e2c,_0x9523('0x1a'),JSON[_0x9523('0x1d')](_0x440fc3));if(_0x440fc3[_0x9523('0x1e')]){if(_0x440fc3['error'][_0x9523('0x1f')]===0x1f4){logger['error'](_0x9523('0x19'),_0x596e2c,_0x440fc3[_0x9523('0x1e')][_0x9523('0x20')]);return _0x15f7c6(_0x440fc3[_0x9523('0x1e')][_0x9523('0x20')]);}logger['error'](_0x9523('0x19'),_0x596e2c,_0x440fc3['error'][_0x9523('0x20')]);return _0x5b8607(_0x440fc3[_0x9523('0x1e')]['message']);}else{logger[_0x9523('0x21')]('ChatInteraction,\x20%s,\x20%s',_0x596e2c,'request\x20sent');_0x5b8607(_0x440fc3[_0x9523('0x22')][_0x9523('0x20')]);}})[_0x9523('0x23')](function(_0x5d4f9d){logger[_0x9523('0x1e')](_0x9523('0x19'),_0x596e2c,_0x5d4f9d);_0x15f7c6(_0x5d4f9d);});});}function respondWithStatusCode(_0xfdd4c,_0x1ab936){_0x1ab936=_0x1ab936||0xcc;return function(_0x22622b){if(_0x22622b){return _0xfdd4c[_0x9523('0x24')](_0x1ab936);}return _0xfdd4c[_0x9523('0x25')](_0x1ab936)[_0x9523('0x26')]();};}function respondWithResult(_0x3aa55f,_0x1c31e1){_0x1c31e1=_0x1c31e1||0xc8;return function(_0x56626c){if(_0x56626c){return _0x3aa55f[_0x9523('0x25')](_0x1c31e1)[_0x9523('0x27')](_0x56626c);}};}function respondWithFilteredResult(_0x269386,_0x4c4ca6){return function(_0x797250){if(_0x797250){var _0x45eb0d=typeof _0x4c4ca6[_0x9523('0x28')]==='undefined'&&typeof _0x4c4ca6[_0x9523('0x29')]==='undefined';var _0x3584f6=_0x797250[_0x9523('0x2a')];var _0x3cbe96=_0x45eb0d?0x0:_0x4c4ca6['offset'];var _0x8aae3c=_0x45eb0d?_0x797250[_0x9523('0x2a')]:_0x4c4ca6[_0x9523('0x28')]+_0x4c4ca6[_0x9523('0x29')];var _0x241567;if(_0x8aae3c>=_0x3584f6){_0x8aae3c=_0x3584f6;_0x241567=0xc8;}else{_0x241567=0xce;}_0x269386['status'](_0x241567);return _0x269386[_0x9523('0x2b')](_0x9523('0x2c'),_0x3cbe96+'-'+_0x8aae3c+'/'+_0x3584f6)[_0x9523('0x27')](_0x797250);}return null;};}function saveUpdates(_0x5b8486){return function(_0x171d47){if(_0x171d47){return _0x171d47[_0x9523('0x2d')](_0x5b8486)['then'](function(_0x2e1038){return _0x2e1038;});}return null;};}function removeEntity(_0x13bfc2){return function(_0x20f627){if(_0x20f627){return _0x20f627[_0x9523('0x2e')]()[_0x9523('0x18')](function(){_0x13bfc2['status'](0xcc)[_0x9523('0x26')]();});}};}function handleEntityNotFound(_0x573c2c){return function(_0x23bab5){if(!_0x23bab5){_0x573c2c['sendStatus'](0x194);}return _0x23bab5;};}function handleError(_0x339875,_0x2add77){_0x2add77=_0x2add77||0x1f4;return function(_0xcfa8d2){logger[_0x9523('0x1e')](_0xcfa8d2[_0x9523('0x2f')]);if(_0xcfa8d2[_0x9523('0x30')]){delete _0xcfa8d2[_0x9523('0x30')];}_0x339875[_0x9523('0x25')](_0x2add77)[_0x9523('0x31')](_0xcfa8d2);};}function getMustacheRender(_0x3cddfd,_0x4e4445){return Mustache[_0x9523('0x32')](_0x3cddfd,_[_0x9523('0x33')](_0x4e4445[_0x9523('0x34')],{'contact':_0x4e4445[_0x9523('0x35')],'message':_0x4e4445['message'],'agent':_0x4e4445[_0x9523('0x36')],'interaction':_0x4e4445['interaction'],'account':_0x4e4445[_0x9523('0x37')]}))||'';}exports['index']=function(_0xb0a9fc,_0x487e6a){var _0x23420e={};var _0xac8ee1=_[_0x9523('0x38')](db[_0x9523('0x39')]['rawAttributes'],function(_0x1a36ec){return{'name':_0x1a36ec[_0x9523('0x3a')],'type':_0x1a36ec[_0x9523('0x3b')][_0x9523('0x3c')]};});_0x23420e=qs[_0x9523('0x3d')](_0xac8ee1,_0xb0a9fc);return interaction[_0x9523('0x3e')](_0x9523('0x3f'),_0xb0a9fc[_0x9523('0x40')],_0xb0a9fc[_0x9523('0x41')],_0x23420e,_0xac8ee1)['then'](respondWithFilteredResult(_0x487e6a,_0x23420e))[_0x9523('0x23')](handleError(_0x487e6a,null));};exports[_0x9523('0x42')]=function(_0x1eb145,_0x159737){var _0x52c290={'raw':![],'where':{'id':_0x1eb145[_0x9523('0x43')]['id']}},_0x268796={};_0x268796[_0x9523('0x44')]=_[_0x9523('0x45')](db[_0x9523('0x39')]['rawAttributes']);_0x268796[_0x9523('0x40')]=_[_0x9523('0x45')](_0x1eb145[_0x9523('0x40')]);_0x268796['filters']=_[_0x9523('0x46')](_0x268796[_0x9523('0x44')],_0x268796[_0x9523('0x40')]);_0x52c290[_0x9523('0x47')]=_['intersection'](_0x268796['model'],qs[_0x9523('0x48')](_0x1eb145[_0x9523('0x40')]['fields']));_0x52c290[_0x9523('0x47')]=_0x52c290['attributes'][_0x9523('0x49')]?_0x52c290[_0x9523('0x47')]:_0x268796[_0x9523('0x44')];if(_0x1eb145[_0x9523('0x40')][_0x9523('0x4a')]){_0x52c290['include']=[{'all':!![]}];}_0x52c290=_[_0x9523('0x33')]({},_0x52c290,_0x1eb145['options']);return db[_0x9523('0x39')]['find'](_0x52c290)[_0x9523('0x18')](handleEntityNotFound(_0x159737,null))[_0x9523('0x18')](respondWithResult(_0x159737,null))[_0x9523('0x23')](handleError(_0x159737,null));};exports[_0x9523('0x4b')]=function(_0xc1db4c,_0x19d9f9){return db[_0x9523('0x39')][_0x9523('0x4b')](_0xc1db4c[_0x9523('0x34')],{})[_0x9523('0x18')](respondWithResult(_0x19d9f9,0xc9))[_0x9523('0x23')](handleError(_0x19d9f9,null));};exports[_0x9523('0x2d')]=function(_0x1b2bde,_0x549867){if(_0x1b2bde[_0x9523('0x34')]['id']){delete _0x1b2bde['body']['id'];}return db[_0x9523('0x39')][_0x9523('0x4c')]({'where':{'id':_0x1b2bde[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x549867,null))[_0x9523('0x18')](saveUpdates(_0x1b2bde[_0x9523('0x34')],null))[_0x9523('0x18')](respondWithResult(_0x549867,null))[_0x9523('0x23')](handleError(_0x549867,null));};exports['destroy']=function(_0x499f6c,_0x183481){return db[_0x9523('0x39')]['find']({'where':{'id':_0x499f6c['params']['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x183481,null))['then'](removeEntity(_0x183481,null))[_0x9523('0x23')](handleError(_0x183481,null));};exports[_0x9523('0x4d')]=function(_0xb39f0e,_0x537a8f){return db[_0x9523('0x39')]['describe']()[_0x9523('0x18')](respondWithResult(_0x537a8f,null))['catch'](handleError(_0x537a8f,null));};exports[_0x9523('0x4e')]=function(_0x778cda,_0x5cfb5a){var _0x4bb89a=_0x778cda[_0x9523('0x43')]['id'];var _0x144a0c;var _0x49ce3b;var _0x4d1565;return db[_0x9523('0x39')][_0x9523('0x4f')]({'where':{'id':_0x4bb89a}})[_0x9523('0x18')](function(_0x1e5724){_0x144a0c=_0x1e5724;return db['ChatWebsite'][_0x9523('0x4f')]({'where':{'id':_0x1e5724[_0x9523('0x50')]},'attributes':['id',_0x9523('0x51'),_0x9523('0x52'),_0x9523('0x53'),'vidaooNote',_0x9523('0x54')],'raw':!![]});})[_0x9523('0x18')](function(_0x533209){if(_0x533209&&_0x533209[_0x9523('0x51')]&&_0x533209[_0x9523('0x52')]){_0x49ce3b=_0x533209;var _0x5d42e1={'interaction':{'id':_0x4bb89a},'agent':{'id':_0x778cda[_0x9523('0x41')]['id'],'name':_0x778cda[_0x9523('0x41')][_0x9523('0x30')],'fullname':_0x778cda[_0x9523('0x41')][_0x9523('0x55')],'email':_0x778cda[_0x9523('0x41')][_0x9523('0x56')]},'contact':_0x778cda[_0x9523('0x34')][_0x9523('0x35')],'account':_0x778cda['body'][_0x9523('0x37')]};var _0x17b72f={'rejectUnauthorized':![],'method':_0x9523('0x57'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x533209['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x778cda[_0x9523('0x41')][_0x9523('0x56')]],'buttons':null,'topic':_0x49ce3b[_0x9523('0x53')],'note':_[_0x9523('0x58')](_0x49ce3b[_0x9523('0x59')])?null:getMustacheRender(_0x49ce3b['vidaooNote'],_0x5d42e1),'metadata':null},'redirect':_0x9523('0x5a'),'json':!![]};try{if(!_['isNull'](_0x49ce3b[_0x9523('0x54')])){var _0x4b2cfd=getMustacheRender(_0x49ce3b[_0x9523('0x54')],_0x5d42e1);var _0x589b34=JSON[_0x9523('0x5b')](_0x4b2cfd);_0x17b72f[_0x9523('0x34')][_0x9523('0x5c')]=_0x589b34;}}catch(_0x2a2cea){throw new db[(_0x9523('0x5d'))][(_0x9523('0x5e'))](_0x9523('0x5f'));}return rp(_0x17b72f);}else{throw new db[(_0x9523('0x5d'))][(_0x9523('0x5e'))](_0x9523('0x60'));}})['then'](function(_0x1c6f42){_0x4d1565=_0x1c6f42;if(_0x4d1565['id']){var _0x3b3e44={'body':_0x4d1565['join_url'],'ChatWebsiteId':_0x49ce3b['id'],'ChatInteractionId':_0x144a0c['id'],'direction':_0x9523('0x61'),'UserId':_0x778cda[_0x9523('0x41')]['id']};return db['ChatMessage'][_0x9523('0x4b')](_0x3b3e44,{});}else{throw new db[(_0x9523('0x5d'))][(_0x9523('0x5e'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})['then'](function(){return _0x144a0c[_0x9523('0x62')]({'vidaooSessionId':_0x4d1565['id']});})[_0x9523('0x18')](respondWithResult(_0x5cfb5a,null))[_0x9523('0x23')](handleError(_0x5cfb5a,null));};exports['customUpdate']=function(_0x20e9a7,_0x43c6cf){if(_0x20e9a7['body']['id']){delete _0x20e9a7[_0x9523('0x34')]['id'];}return db[_0x9523('0x39')][_0x9523('0x4c')]({'where':{'id':_0x20e9a7[_0x9523('0x43')]['id']},'include':[{'model':db[_0x9523('0x63')],'as':_0x9523('0x64')}]})['then'](handleEntityNotFound(_0x43c6cf,null))[_0x9523('0x18')](saveUpdates(_0x20e9a7[_0x9523('0x34')],null))[_0x9523('0x18')](respondWithResult(_0x43c6cf,null))[_0x9523('0x23')](handleError(_0x43c6cf,null));};exports['abandon']=function(_0x3e7138,_0xe345cb){if(_0x3e7138['body']['id']){delete _0x3e7138[_0x9523('0x34')]['id'];}return db[_0x9523('0x39')][_0x9523('0x4c')]({'where':{'id':_0x3e7138['params']['id']}})[_0x9523('0x18')](function(_0x5166e8){if(!_0x5166e8){logger['error']('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x9523('0x65'),0x194,'entity\x20not\x20found');_0xe345cb[_0x9523('0x24')](0x194);}else{if(_0x5166e8['UserId']){throw new db['Sequelize'][(_0x9523('0x5e'))]('Interaction\x20already\x20assigned');}}return _0x5166e8;})['then'](function(_0x37d7e4){if(_0x37d7e4){return _0x37d7e4[_0x9523('0x2d')]({'closed':_0x3e7138[_0x9523('0x34')][_0x9523('0x66')],'disposition':_0x3e7138[_0x9523('0x34')][_0x9523('0x67')]})['then'](function(_0x45a1ac){return _0x45a1ac;});}})[_0x9523('0x18')](function(){return respondWithRpcPromise(_0x9523('0x68'),_0x9523('0x65'),_0x3e7138[_0x9523('0x34')],client9004);})['then'](respondWithResult(_0xe345cb,null))[_0x9523('0x23')](handleError(_0xe345cb,null));};exports[_0x9523('0x69')]=function(_0x343481,_0x41d33f){_0x343481[_0x9523('0x34')][_0x9523('0x30')]=_0x343481[_0x9523('0x6a')][_0x9523('0x6b')];_0x343481[_0x9523('0x34')]['basename']=_0x343481[_0x9523('0x6a')]['filename'];_0x343481[_0x9523('0x34')]['type']=_0x343481[_0x9523('0x6a')][_0x9523('0x6c')];return db[_0x9523('0x6d')][_0x9523('0x4b')](_0x343481[_0x9523('0x34')])[_0x9523('0x18')](respondWithResult(_0x41d33f,0xc9))[_0x9523('0x23')](handleError(_0x41d33f,null));};exports['attachmentDownload']=function(_0x5e88b0,_0x32e736){return db[_0x9523('0x39')]['findOne']({'where':{'id':_0x5e88b0[_0x9523('0x43')]['id']},'raw':!![]})[_0x9523('0x18')](handleEntityNotFound(_0x32e736,null))[_0x9523('0x18')](function(_0xd2ebea){if(_0xd2ebea){if(_0xd2ebea['closed']){return _0x32e736[_0x9523('0x25')](0x193)[_0x9523('0x27')]({'status':0x193,'message':_0x9523('0x6e')});}return db['Attachment'][_0x9523('0x4f')]({'where':{'id':_0x5e88b0[_0x9523('0x40')][_0x9523('0x6f')]},'raw':!![]})[_0x9523('0x18')](handleEntityNotFound(_0x32e736,null));}})[_0x9523('0x18')](function(_0x3f9cd7){if(_0x3f9cd7){var _0x74385b=_0x3f9cd7[_0x9523('0x70')]!==null;var _0x338e2a=path['join'](config[_0x9523('0x71')],_0x9523('0x72'));if(_0x74385b){_0x338e2a=path[_0x9523('0x73')](_0x338e2a,_0x9523('0x74'));}var _0x114a04=path[_0x9523('0x73')](_0x338e2a,_0x3f9cd7[_0x9523('0x75')]);return _0x32e736['download'](_0x114a04);}})[_0x9523('0x23')](handleError(_0x32e736,null));};exports[_0x9523('0x76')]=function(_0x32f69e,_0x104d52){var _0x4f93f7=null;var _0x24949b=null;var _0x179fc8=null;if(_0x32f69e[_0x9523('0x34')]['id']){delete _0x32f69e[_0x9523('0x34')]['id'];}if(_0x32f69e[_0x9523('0x34')][_0x9523('0x77')]){_0x179fc8=path[_0x9523('0x73')](config['root'],'server/files/chat/upload/',util[_0x9523('0x78')](_0x9523('0x79'),Date[_0x9523('0x7a')]()));_0x32f69e[_0x9523('0x34')][_0x9523('0x7b')]=_0x179fc8;}return db[_0x9523('0x39')][_0x9523('0x4c')]({'where':{'id':_0x32f69e[_0x9523('0x43')]['id']},'include':[{'model':db[_0x9523('0x7c')],'as':_0x9523('0x7d'),'include':[{'model':db[_0x9523('0x7e')],'as':_0x9523('0x7e')}]}]})['then'](handleEntityNotFound(_0x104d52,null))[_0x9523('0x18')](saveUpdates(_0x32f69e['body'],null))[_0x9523('0x18')](function(_0x299cc1){if(_0x299cc1){_0x4f93f7=_0x299cc1;return db[_0x9523('0x7f')][_0x9523('0x4c')]({'where':{'id':_0x4f93f7[_0x9523('0x50')]}});}})[_0x9523('0x18')](function(_0x4b5886){if(_0x4b5886){_0x24949b=_0x4b5886;return db['CmContact'][_0x9523('0x4c')]({'where':{'id':_0x4f93f7[_0x9523('0x80')]}});}})[_0x9523('0x18')](function(_0x4456ea){if(_0x4456ea){if(_0x179fc8){var _0x19c8c3=null;for(var _0x4d529a=0x1;_0x4d529a<_0x4f93f7['Messages'][_0x9523('0x49')];++_0x4d529a){_0x19c8c3=_0x4f93f7[_0x9523('0x7d')][_0x4d529a];var _0x587323=_0x19c8c3[_0x9523('0x81')]?util[_0x9523('0x78')](_0x9523('0x82'),_0x24949b[_0x9523('0x83')],_0x19c8c3[_0x9523('0x81')]):'System';var _0x5a9dfa=_0x32f69e[_0x9523('0x34')]['customer']||util['format']('%s%d',_0x9523('0x84'),_0x19c8c3['ContactId']);switch(_0x24949b[_0x9523('0x85')]){case _0x9523('0x86'):_0x587323=_0x19c8c3[_0x9523('0x81')]?util[_0x9523('0x78')](_0x9523('0x82'),_0x24949b[_0x9523('0x83')],_0x19c8c3[_0x9523('0x81')]):_0x9523('0x87');break;case'agent_alias':_0x587323=_0x19c8c3['UserId']?_0x19c8c3[_0x9523('0x7e')]['alias']||_0x19c8c3[_0x9523('0x7e')][_0x9523('0x55')]:_0x9523('0x87');break;case _0x9523('0x88'):_0x587323=_0x19c8c3[_0x9523('0x81')]?_0x19c8c3[_0x9523('0x7e')]['fullname']:_0x9523('0x87');break;default:_0x587323=_0x19c8c3[_0x9523('0x81')]?util[_0x9523('0x78')](_0x9523('0x82'),_0x24949b['agentAlias'],_0x19c8c3['UserId']):_0x9523('0x87');}var _0x45f2ae=util['format'](_0x9523('0x89'),moment(_0x19c8c3['createdAt'])[_0x9523('0x78')](_0x9523('0x8a')),_0x19c8c3[_0x9523('0x8b')]==='in'?_0x5a9dfa:_0x587323,_0x19c8c3[_0x9523('0x34')]);if(!_0x19c8c3[_0x9523('0x8c')]){fs[_0x9523('0x8d')](_0x179fc8,_0x45f2ae);}}return db[_0x9523('0x8e')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x9523('0x8f')],'as':_0x9523('0x90'),'raw':!![],'include':[{'model':db[_0x9523('0x91')],'as':_0x9523('0x91'),'raw':!![]}]}]});}}})['then'](function(_0x5ccc13){if(!_0x5ccc13||!_0x5ccc13[_0x9523('0x90')]||!_0x32f69e[_0x9523('0x34')])return _0x4f93f7;var _0x123d7e=_0x5ccc13[_0x9523('0x92')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x123d7e,'message':{'from':util[_0x9523('0x78')](_0x9523('0x93'),_0x5ccc13[_0x9523('0x30')],_0x5ccc13[_0x9523('0x56')]||_0x5ccc13[_0x9523('0x90')][_0x9523('0x41')]),'to':_0x32f69e[_0x9523('0x34')][_0x9523('0x77')],'subject':'Mail\x20Transcript','text':util['format'](_0x9523('0x94'),_0x32f69e[_0x9523('0x34')][_0x9523('0x77')]),'attachments':[{'path':_0x179fc8}]}})[_0x9523('0x18')](function(){return _0x4f93f7;})[_0x9523('0x23')](function(_0x4df0c1){logger[_0x9523('0x1e')](_0x4df0c1);});})[_0x9523('0x18')](respondWithStatusCode(_0x104d52,0xc8))[_0x9523('0x23')](handleError(_0x104d52,null));};exports[_0x9523('0x95')]=function(_0x5bdb21,_0x35499f){return db[_0x9523('0x7c')][_0x9523('0x4c')]({'where':{'id':_0x5bdb21[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x35499f,null))[_0x9523('0x18')](function(_0x4afcfe){if(_0x4afcfe){return _0x4afcfe[_0x9523('0x95')](_0x5bdb21[_0x9523('0x34')]['ids'],_['omit'](_0x5bdb21[_0x9523('0x34')],['ids','id'])||{});}})['then'](respondWithResult(_0x35499f,null))['catch'](handleError(_0x35499f,null));};exports[_0x9523('0x96')]=function(_0x5833eb,_0x29dabd){var _0x3292f0={'raw':![],'where':{}};var _0x3780d9={};var _0x5586e8={'count':0x0,'rows':[]};return db[_0x9523('0x39')][_0x9523('0x4f')]({'where':{'id':_0x5833eb[_0x9523('0x43')]['id']}})['then'](handleEntityNotFound(_0x29dabd,null))['then'](function(_0x30b845){if(_0x30b845){_0x3780d9['model']=_[_0x9523('0x45')](db[_0x9523('0x7c')]['rawAttributes']);_0x3780d9[_0x9523('0x40')]=_[_0x9523('0x45')](_0x5833eb[_0x9523('0x40')]);_0x3780d9[_0x9523('0x97')]=_[_0x9523('0x46')](_0x3780d9[_0x9523('0x44')],_0x3780d9[_0x9523('0x40')]);_0x3292f0['attributes']=_[_0x9523('0x46')](_0x3780d9[_0x9523('0x44')],qs[_0x9523('0x48')](_0x5833eb[_0x9523('0x40')][_0x9523('0x48')]));_0x3292f0[_0x9523('0x47')]=_0x3292f0[_0x9523('0x47')][_0x9523('0x49')]?_0x3292f0[_0x9523('0x47')]:_0x3780d9['model'];if(!_0x5833eb[_0x9523('0x40')][_0x9523('0x98')](_0x9523('0x99'))){_0x3292f0[_0x9523('0x29')]=qs[_0x9523('0x29')](_0x5833eb['query'][_0x9523('0x29')]);_0x3292f0[_0x9523('0x28')]=qs[_0x9523('0x28')](_0x5833eb[_0x9523('0x40')]['offset']);}_0x3292f0['order']=qs[_0x9523('0x9a')](_0x5833eb[_0x9523('0x40')][_0x9523('0x9a')]);_0x3292f0[_0x9523('0x9b')]=qs[_0x9523('0x97')](_[_0x9523('0x9c')](_0x5833eb['query'],_0x3780d9[_0x9523('0x97')]));_0x3292f0[_0x9523('0x9b')]['ChatInteractionId']=_0x30b845['id'];if(_0x5833eb[_0x9523('0x40')][_0x9523('0x9d')]){_0x3292f0['where']=_[_0x9523('0x33')](_0x3292f0[_0x9523('0x9b')],{'$or':_['map'](_0x3292f0[_0x9523('0x47')],function(_0x1396dd){var _0x4b3470={};_0x4b3470[_0x1396dd]={'$like':'%'+_0x5833eb[_0x9523('0x40')][_0x9523('0x9d')]+'%'};return _0x4b3470;})});}if(_0x5833eb[_0x9523('0x40')][_0x9523('0x9e')]){var _0x1f6341=_0x5833eb[_0x9523('0x40')][_0x9523('0x9e')][_0x9523('0x9f')](',');var _0x209f3f={};_0x209f3f[_0x1f6341[0x0]]={'$gte':moment(_0x1f6341[0x1])['format'](_0x9523('0xa0'))};_0x3292f0[_0x9523('0x9b')]=_[_0x9523('0x33')](_0x3292f0[_0x9523('0x9b')],_0x209f3f);}_0x3292f0=_[_0x9523('0x33')]({},_0x3292f0,_0x5833eb[_0x9523('0xa1')]);return db[_0x9523('0x7c')][_0x9523('0x2a')]({'where':_0x3292f0[_0x9523('0x9b')]})[_0x9523('0x18')](function(_0x520b45){_0x5586e8['count']=_0x520b45;if(_0x5833eb['query'][_0x9523('0x4a')]){_0x3292f0[_0x9523('0xa2')]=[{'all':!![]}];}return db[_0x9523('0x7c')][_0x9523('0x3e')](_0x3292f0);})[_0x9523('0x18')](function(_0x5dec5f){_0x5586e8[_0x9523('0xa3')]=_0x5dec5f;return _0x5586e8;});}})[_0x9523('0x18')](respondWithFilteredResult(_0x29dabd,_0x3292f0))[_0x9523('0x23')](handleError(_0x29dabd,null));};exports[_0x9523('0xa4')]=function(_0x5a0dbc,_0xe528fc){var _0x5d167d={'where':{}},_0x26cdd2={},_0x2343d7={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9523('0x4f')]({'where':{'id':_0x5a0dbc[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0xe528fc,null))[_0x9523('0x18')](function(_0x512771){if(_0x512771){_0x26cdd2['model']=_['keys'](db['ChatMessage'][_0x9523('0xa5')]);_0x26cdd2[_0x9523('0x40')]=_[_0x9523('0x45')](_0x5a0dbc[_0x9523('0x40')]);_0x26cdd2[_0x9523('0x97')]=_[_0x9523('0x46')](_0x26cdd2[_0x9523('0x44')],_0x26cdd2[_0x9523('0x40')]);_0x5d167d[_0x9523('0x47')]=_[_0x9523('0x46')](_0x26cdd2[_0x9523('0x44')],qs['fields'](_0x5a0dbc[_0x9523('0x40')][_0x9523('0x48')]));_0x5d167d[_0x9523('0x47')]=_0x5d167d[_0x9523('0x47')][_0x9523('0x49')]?_0x5d167d['attributes']:_0x26cdd2[_0x9523('0x44')];if(!_0x5a0dbc['query'][_0x9523('0x98')](_0x9523('0x99'))){_0x5d167d[_0x9523('0x29')]=qs[_0x9523('0x29')](_0x5a0dbc[_0x9523('0x40')][_0x9523('0x29')]);_0x5d167d['offset']=qs[_0x9523('0x28')](_0x5a0dbc[_0x9523('0x40')]['offset']);}_0x5d167d['order']=qs['sort'](_0x5a0dbc['query'][_0x9523('0x9a')]);_0x5d167d['where']=qs[_0x9523('0x97')](_[_0x9523('0x9c')](_0x5a0dbc[_0x9523('0x40')],_0x26cdd2['filters']));_0x5d167d['where']['ChatInteractionId']=_0x512771['id'];if(_0x5a0dbc[_0x9523('0x40')][_0x9523('0x9d')]){_0x5d167d[_0x9523('0x9b')]=_[_0x9523('0x33')](_0x5d167d[_0x9523('0x9b')],{'$or':_[_0x9523('0x38')](_0x5d167d[_0x9523('0x47')],function(_0x34ce61){var _0x4776e3={};_0x4776e3[_0x34ce61]={'$like':'%'+_0x5a0dbc[_0x9523('0x40')][_0x9523('0x9d')]+'%'};return _0x4776e3;})});}_0x5d167d[_0x9523('0x9b')][_0x9523('0x8c')]=![];if(_0x5a0dbc[_0x9523('0x40')]['id']){_0x5d167d[_0x9523('0x9b')]['id']={'$gt':_0x5a0dbc[_0x9523('0x40')]['id']};}_0x5d167d=_[_0x9523('0x33')]({},_0x5d167d,_0x5a0dbc['options']);return db[_0x9523('0x7c')][_0x9523('0x2a')]({'where':_0x5d167d['where']})['then'](function(_0x3f90ac){_0x2343d7[_0x9523('0x2a')]=_0x3f90ac;_0x5d167d[_0x9523('0xa2')]=[];if(_0x5a0dbc[_0x9523('0x40')][_0x9523('0xa6')]){_0x5d167d[_0x9523('0xa2')][_0x9523('0xa7')]({'model':db['User'],'as':_0x9523('0x7e'),'attributes':['id',_0x9523('0x55'),_0x9523('0xa8')]});}if(_0x5a0dbc[_0x9523('0x40')][_0x9523('0x4a')]){_0x5d167d[_0x9523('0xa2')]=[{'all':!![]}];}return db[_0x9523('0x7c')][_0x9523('0x3e')](_0x5d167d);})[_0x9523('0x18')](function(_0x1a5ac6){_0x2343d7[_0x9523('0xa3')]=_0x1a5ac6;return _0x2343d7;});}})[_0x9523('0x18')](respondWithFilteredResult(_0xe528fc,_0x5d167d))[_0x9523('0x23')](handleError(_0xe528fc,null));};exports[_0x9523('0xa9')]=function(_0xf957c3,_0x52b5f4){return db['ChatInteraction'][_0x9523('0x4c')]({'where':{'id':_0xf957c3[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x52b5f4,null))[_0x9523('0x18')](function(_0xb1448c){if(_0xb1448c){return _0xb1448c[_0x9523('0xaa')](_0xf957c3[_0x9523('0x34')]['ids'],_[_0x9523('0xab')](_0xf957c3['body'],['ids','id'])||{})[_0x9523('0xac')](function(){return db[_0x9523('0xad')][_0x9523('0x3e')]({'attributes':['id',_0x9523('0x30'),'color'],'where':{'id':_0xf957c3[_0x9523('0x34')][_0x9523('0xae')]}});})['then'](function(_0x39fcf5){socket['emit'](_0x9523('0xaf'),{'id':Number(_0xf957c3['params']['id']),'tags':_0x39fcf5||[]});return{'id':Number(_0xf957c3[_0x9523('0x43')]['id']),'tags':_0x39fcf5||[]};});}})[_0x9523('0x18')](respondWithResult(_0x52b5f4,null))[_0x9523('0x23')](handleError(_0x52b5f4,null));};exports[_0x9523('0xb0')]=function(_0x56de27,_0x32b098){return db[_0x9523('0x39')]['find']({'where':{'id':_0x56de27[_0x9523('0x43')]['id']}})[_0x9523('0x18')](handleEntityNotFound(_0x32b098,null))[_0x9523('0x18')](function(_0x4e4dc8){if(_0x4e4dc8){return _0x4e4dc8[_0x9523('0xb0')](_0x56de27[_0x9523('0x40')][_0x9523('0xae')]);}})[_0x9523('0x18')](respondWithStatusCode(_0x32b098,null))[_0x9523('0x23')](handleError(_0x32b098,null));};exports[_0x9523('0xb1')]=function(_0x776ae9,_0x26a1c1){var _0x5ba046=moment()['unix']()[_0x9523('0xb2')]();var _0x1d0e0f=path[_0x9523('0x73')](config[_0x9523('0x71')],_0x9523('0xb3'),_0x9523('0xb4'),_0x9523('0xb5'));var _0x237b64=path['join'](config[_0x9523('0x71')],_0x9523('0xb3'),_0x9523('0xb4'),_0x9523('0xb6'));var _0x176213=path['join'](_0x1d0e0f,_0x5ba046);var _0x4e940c=util['format']('transcript-%d-%s.zip',_0x776ae9[_0x9523('0x43')]['id'],_0x5ba046);var _0x2e4e90=path[_0x9523('0x73')](_0x1d0e0f,_0x4e940c);var _0x48668e=[];_0x48668e['push']({'model':db['User'],'as':_0x9523('0x7e'),'attributes':['id','fullname'],'raw':!![]});_0x48668e[_0x9523('0xa7')]({'model':db['CmContact'],'as':_0x9523('0x64'),'attributes':['id','firstName',_0x9523('0xb7')],'raw':!![]});if(_0x776ae9[_0x9523('0x40')][_0x9523('0xb6')]){_0x48668e[_0x9523('0xa7')]({'model':db[_0x9523('0x6d')],'as':_0x9523('0x6d'),'raw':!![]});}var _0x9da4d9=[{'model':db[_0x9523('0x7c')],'as':_0x9523('0x7d'),'attributes':['id',_0x9523('0x34'),_0x9523('0xb8'),_0x9523('0x8b'),_0x9523('0x8c'),'read'],'include':_0x48668e}];_0x9da4d9['push']({'model':db[_0x9523('0x7f')],'as':_0x9523('0xb9'),'attributes':['id','name']});_0x9da4d9['push']({'model':db['User'],'as':_0x9523('0xba'),'attributes':['id',_0x9523('0x55')]});return db[_0x9523('0x39')]['find']({'where':{'id':_0x776ae9['params']['id']},'include':_0x9da4d9})[_0x9523('0x18')](handleEntityNotFound(_0x26a1c1,null))[_0x9523('0x18')](function(_0x28ce72){if(_0x28ce72){var _0x391dda=_0x28ce72['get']({'plain':!![]});fs[_0x9523('0xbb')](_0x176213);var _0x81ac63={'channel':'Chat','account':_0x391dda['Account'][_0x9523('0x30')],'agent':_0x391dda[_0x9523('0xba')]?_0x391dda[_0x9523('0xba')][_0x9523('0x55')]:_0x9523('0xbc'),'createdAt':moment(_0x391dda[_0x9523('0xb8')])['format'](_0x9523('0xa0'))[_0x9523('0xb2')](),'closedAt':_0x391dda[_0x9523('0x66')]?moment(_0x391dda[_0x9523('0xbd')])[_0x9523('0x78')](_0x9523('0xa0'))[_0x9523('0xb2')]():'','disposition':_0x391dda[_0x9523('0x67')],'chatInfo':{'browser':_0x391dda[_0x9523('0xbe')],'os':_0x391dda[_0x9523('0xbf')],'referer':_0x391dda[_0x9523('0xc0')],'customerIp':_0x391dda[_0x9523('0xc1')],'customerPort':_0x391dda[_0x9523('0xc2')]?_0x391dda['customerPort']:'N.A.'},'messages':_(_0x391dda[_0x9523('0x7d')])[_0x9523('0xc3')]()[_0x9523('0x9d')]({'secret':![]})[_0x9523('0x38')](function(_0x389c12){if(_0x389c12[_0x9523('0x6d')]){var _0x41d73e=path[_0x9523('0x73')](_0x237b64,_0x389c12[_0x9523('0x6d')][_0x9523('0x75')]);if(fs[_0x9523('0xc4')](_0x41d73e)){fs[_0x9523('0xc5')](_0x41d73e)[_0x9523('0xc6')](fs[_0x9523('0xc7')](path[_0x9523('0x73')](_0x176213,_0x389c12['Attachment']['basename'])));}}return{'date':moment(_0x389c12['createdAt'])[_0x9523('0x78')](_0x9523('0xa0'))['toString'](),'sender':_0x389c12[_0x9523('0x8b')]===_0x9523('0x61')?_0x389c12[_0x9523('0x7e')]?_0x389c12[_0x9523('0x7e')]['fullname']:_0x9523('0x87'):_0x389c12[_0x9523('0x64')][_0x9523('0xc8')]+(_0x389c12['Contact']['lastName']?'\x20'+_0x389c12['Contact'][_0x9523('0xb7')]:''),'body':_0x389c12[_0x9523('0x6d')]?_0x389c12[_0x9523('0x6d')][_0x9523('0x75')]:_0x389c12[_0x9523('0x34')],'direction':_0x389c12[_0x9523('0x8b')]===_0x9523('0x61')?'A':'C','secret':_0x389c12['secret'],'read':_0x389c12[_0x9523('0xc9')],'attachment':_0x389c12[_0x9523('0x6d')]};})[_0x9523('0xca')]()};return ejs['renderFile'](path[_0x9523('0x73')](config[_0x9523('0x71')],_0x9523('0xb3'),'views',_0x9523('0xcb')),{'interaction':_0x81ac63})[_0x9523('0x18')](function(_0x1ee0d0){var _0x20ea34=path[_0x9523('0x73')](_0x176213,_0x9523('0xcc')+_0x391dda['id']+'-'+_0x5ba046+_0x9523('0xcd'));var _0x22d984={'path':_0x20ea34,'channel':_0x9523('0xce'),'interactionId':_0x391dda['id']};return pdf['createPdfFromHTML'](_0x1ee0d0,_0x22d984);})[_0x9523('0x18')](function(){return new Promise(function(_0x3e2436,_0x219f51){zipdir(_0x176213,{'saveTo':_0x2e4e90},function(_0x2bd786,_0x2764af){if(_0x2bd786)return _0x219f51(_0x2bd786);return _0x3e2436(_0x2764af);});})[_0x9523('0x18')](function(){return new BPromise(function(_0x210098,_0x3e4c43){rimraf(_0x176213,function(_0x3d29e2){if(_0x3d29e2)_0x3e4c43(_0x3d29e2);return _0x210098();});});})[_0x9523('0x18')](function(){return _0x26a1c1[_0x9523('0xb1')](_0x2e4e90,_0x4e940c,function(_0x413636){if(_0x413636){logger[_0x9523('0x1e')](_0x9523('0xcf'),_0x413636);}else{fs[_0x9523('0xd0')](_0x2e4e90);}});});});}else{return _0x26a1c1[_0x9523('0x24')](0xc8);}})[_0x9523('0x23')](handleError(_0x26a1c1,null));};
\ No newline at end of file
index 9a093e8..33b9569 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x274e=['ChatInteraction','ChatMessage','setMaxListeners','save','remove','then','setDataValue','map','emit','catch','hasOwnProperty','hook','../../mysqldb'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x274e,0x137));var _0xe274=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x274e[_0x1e7b16];return _0x37fadc;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xe274('0x0'))['db'][_0xe274('0x1')];var ChatMessage=require(_0xe274('0x0'))['db'][_0xe274('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xe274('0x3')](0x0);var events={'afterCreate':_0xe274('0x4'),'afterUpdate':'update','afterDestroy':_0xe274('0x5')};function emitEvent(_0x24eacb){return function(_0x13903f,_0x120234,_0xc5d148){_0x13903f['getUsers']({'attributes':['id'],'raw':!![]})[_0xe274('0x6')](function(_0xe5a687){_0x13903f[_0xe274('0x7')]('Users',_0xe5a687[_0xe274('0x8')](function(_0x3f8ba8){return{'id':_0x3f8ba8['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x13903f['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe274('0x6')](function(_0x515630){_0x13903f['setDataValue']('unreadMessages',_0x515630['length']);ChatInteractionEvents[_0xe274('0x9')](_0x24eacb+':'+_0x13903f['id'],_0x13903f);ChatInteractionEvents[_0xe274('0x9')](_0x24eacb,_0x13903f);_0xc5d148(null);})[_0xe274('0xa')](_0xc5d148(null));};}for(var e in events){if(events[_0xe274('0xb')](e)){var event=events[e];ChatInteraction[_0xe274('0xc')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents;
\ No newline at end of file
+var _0x545c=['findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map'];(function(_0x8b247d,_0x9401a9){var _0x4e10a3=function(_0x176b53){while(--_0x176b53){_0x8b247d['push'](_0x8b247d['shift']());}};_0x4e10a3(++_0x9401a9);}(_0x545c,0x80));var _0xc545=function(_0x30e004,_0x46f8c2){_0x30e004=_0x30e004-0x0;var _0x5ca247=_0x545c[_0x30e004];return _0x5ca247;};'use strict';var EventEmitter=require(_0xc545('0x0'));var ChatInteraction=require(_0xc545('0x1'))['db'][_0xc545('0x2')];var ChatMessage=require(_0xc545('0x1'))['db'][_0xc545('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xc545('0x4')](0x0);var events={'afterCreate':_0xc545('0x5'),'afterUpdate':_0xc545('0x6'),'afterDestroy':_0xc545('0x7')};function emitEvent(_0x249064){return function(_0x5b5355,_0x556447,_0x281192){_0x5b5355[_0xc545('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2a1c56){_0x5b5355[_0xc545('0x9')](_0xc545('0xa'),_0x2a1c56[_0xc545('0xb')](function(_0x24bc50){return{'id':_0x24bc50['id']};}));return ChatMessage[_0xc545('0xc')]({'where':{'ChatInteractionId':_0x5b5355['id'],'direction':'in','read':![]},'raw':!![]});})[_0xc545('0xd')](function(_0x1c3b98){_0x5b5355['setDataValue']('unreadMessages',_0x1c3b98[_0xc545('0xe')]);ChatInteractionEvents['emit'](_0x249064+':'+_0x5b5355['id'],_0x5b5355);ChatInteractionEvents[_0xc545('0xf')](_0x249064,_0x5b5355);_0x281192(null);})[_0xc545('0x10')](_0x281192(null));};}for(var e in events){if(events[_0xc545('0x11')](e)){var event=events[e];ChatInteraction[_0xc545('0x12')](e,emitEvent(event));}}module[_0xc545('0x13')]=ChatInteractionEvents;
\ No newline at end of file
index 9579473..9cb319e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabb4=['ChatInteraction','chat_interactions','changed','closed','closedAt','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','define'];(function(_0x17a1da,_0x8d545a){var _0x584091=function(_0x2ba31d){while(--_0x2ba31d){_0x17a1da['push'](_0x17a1da['shift']());}};_0x584091(++_0x8d545a);}(_0xabb4,0x1c7));var _0x4abb=function(_0x2d11c3,_0x3410f7){_0x2d11c3=_0x2d11c3-0x0;var _0x160d4=_0xabb4[_0x2d11c3];return _0x160d4;};'use strict';var _=require(_0x4abb('0x0'));var util=require(_0x4abb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4abb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4abb('0x3'));var rimraf=require(_0x4abb('0x4'));var config=require(_0x4abb('0x5'));var attributes=require(_0x4abb('0x6'));module[_0x4abb('0x7')]=function(_0x905e2b,_0x21ea32){return _0x905e2b[_0x4abb('0x8')](_0x4abb('0x9'),attributes,{'tableName':_0x4abb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xdcf744,_0x19fdc4,_0x4fedaa){if(_0xdcf744[_0x4abb('0xb')](_0x4abb('0xc'))){_0xdcf744[_0x4abb('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4fedaa(null,_0xdcf744);}},'charset':_0x4abb('0xe'),'collate':_0x4abb('0xf')});};
\ No newline at end of file
+var _0x94eb=['closedAt','format','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInteraction.attributes','exports','define','chat_interactions'];(function(_0x1e8aa8,_0x2b9059){var _0x327768=function(_0x2a2572){while(--_0x2a2572){_0x1e8aa8['push'](_0x1e8aa8['shift']());}};_0x327768(++_0x2b9059);}(_0x94eb,0x86));var _0xb94e=function(_0x3abe59,_0x592d4e){_0x3abe59=_0x3abe59-0x0;var _0x2492ba=_0x94eb[_0x3abe59];return _0x2492ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb94e('0x0'))(_0xb94e('0x1'));var moment=require('moment');var BPromise=require(_0xb94e('0x2'));var rp=require(_0xb94e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb94e('0x4'));var config=require(_0xb94e('0x5'));var attributes=require(_0xb94e('0x6'));module[_0xb94e('0x7')]=function(_0x54b86f,_0x49525f){return _0x54b86f[_0xb94e('0x8')]('ChatInteraction',attributes,{'tableName':_0xb94e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x264de1,_0x3f6226,_0x5366c0){if(_0x264de1['changed']('closed')){_0x264de1[_0xb94e('0xa')]=moment()[_0xb94e('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5366c0(null,_0x264de1);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index 32b443b..c09c717 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ee3=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring'];(function(_0x1f6a87,_0x31aa8d){var _0x4db6f0=function(_0x46321a){while(--_0x46321a){_0x1f6a87['push'](_0x1f6a87['shift']());}};_0x4db6f0(++_0x31aa8d);}(_0x0ee3,0x195));var _0x30ee=function(_0x505eb2,_0x4baf2b){_0x505eb2=_0x505eb2-0x0;var _0x32f263=_0x0ee3[_0x505eb2];return _0x32f263;};'use strict';var _=require(_0x30ee('0x0'));var util=require(_0x30ee('0x1'));var moment=require(_0x30ee('0x2'));var BPromise=require(_0x30ee('0x3'));var rs=require(_0x30ee('0x4'));var fs=require('fs');var Redis=require(_0x30ee('0x5'));var db=require(_0x30ee('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x30ee('0x7'));var config=require('../../config/environment');var jayson=require(_0x30ee('0x8'));var client=jayson[_0x30ee('0x9')][_0x30ee('0xa')]({'port':0x232a});config[_0x30ee('0xb')]=_['defaults'](config[_0x30ee('0xb')],{'host':_0x30ee('0xc'),'port':0x18eb});var socket=require(_0x30ee('0xd'))(new Redis(config['redis']));require('./chatInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x41fd98,_0x3d56b3,_0xc31c41){return new BPromise(function(_0x5b345f,_0x5d1d40){return client[_0x30ee('0xe')](_0x41fd98,_0xc31c41)[_0x30ee('0xf')](function(_0x2fe4cb){logger[_0x30ee('0x10')](_0x30ee('0x11'),_0x3d56b3,_0x30ee('0x12'));logger[_0x30ee('0x13')](_0x30ee('0x14'),_0x3d56b3,'request\x20sent',JSON[_0x30ee('0x15')](_0x2fe4cb));if(_0x2fe4cb[_0x30ee('0x16')]){if(_0x2fe4cb[_0x30ee('0x16')]['code']===0x1f4){logger[_0x30ee('0x16')](_0x30ee('0x11'),_0x3d56b3,_0x2fe4cb[_0x30ee('0x16')][_0x30ee('0x17')]);return _0x5d1d40(_0x2fe4cb[_0x30ee('0x16')]['message']);}logger[_0x30ee('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x3d56b3,_0x2fe4cb[_0x30ee('0x16')][_0x30ee('0x17')]);return _0x5b345f(_0x2fe4cb[_0x30ee('0x16')][_0x30ee('0x17')]);}else{logger[_0x30ee('0x10')](_0x30ee('0x11'),_0x3d56b3,'request\x20sent');_0x5b345f(_0x2fe4cb[_0x30ee('0x18')]['message']);}})['catch'](function(_0x474e4c){logger[_0x30ee('0x16')](_0x30ee('0x11'),_0x3d56b3,_0x474e4c);_0x5d1d40(_0x474e4c);});});}exports[_0x30ee('0x19')]=function(_0x53ef4b){var _0x43886f=this;return new Promise(function(_0x305ba9,_0x36751a){return db[_0x30ee('0x1a')][_0x30ee('0x1b')](_0x53ef4b['body'],{'raw':_0x53ef4b[_0x30ee('0x1c')]?_0x53ef4b[_0x30ee('0x1c')][_0x30ee('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53ef4b[_0x30ee('0x1c')]?_0x53ef4b['options'][_0x30ee('0x1e')]||null:null,'attributes':_0x53ef4b[_0x30ee('0x1c')]?_0x53ef4b[_0x30ee('0x1c')][_0x30ee('0x1f')]||null:null,'limit':_0x53ef4b[_0x30ee('0x1c')]?_0x53ef4b[_0x30ee('0x1c')][_0x30ee('0x20')]||null:null})['then'](function(_0x3e36be){logger['info']('UpdateChatInteraction',_0x53ef4b);logger[_0x30ee('0x13')](_0x30ee('0x19'),_0x53ef4b,JSON['stringify'](_0x3e36be));_0x305ba9(_0x3e36be);})[_0x30ee('0x21')](function(_0x32ae25){logger['error'](_0x30ee('0x19'),_0x32ae25[_0x30ee('0x17')],_0x53ef4b);_0x36751a(_0x43886f[_0x30ee('0x16')](0x1f4,_0x32ae25['message']));});});};exports[_0x30ee('0x22')]=function(_0x54c968){return new Promise(function(_0x23f4c7,_0x5bb2e6){return db[_0x30ee('0x1a')][_0x30ee('0x23')]({'where':_0x54c968['options']?_0x54c968[_0x30ee('0x1c')][_0x30ee('0x1e')]||null:null})[_0x30ee('0xf')](function(_0x176086){if(_0x176086){return _0x176086['addTags'](_0x54c968[_0x30ee('0x24')][_0x30ee('0x25')],_[_0x30ee('0x26')](_0x54c968[_0x30ee('0x24')],[_0x30ee('0x25'),'id'])||{});}})[_0x30ee('0x27')](function(_0x854872){logger[_0x30ee('0x10')](_0x30ee('0x28'),_0x54c968);logger[_0x30ee('0x13')](_0x30ee('0x28'),_0x54c968,JSON[_0x30ee('0x15')](_0x854872));_0x23f4c7(_0x854872);})[_0x30ee('0x21')](function(_0x3cf3ac){logger['error'](_0x30ee('0x28'),_0x3cf3ac[_0x30ee('0x17')],_0x54c968);_0x5bb2e6(_this['error'](0x1f4,_0x3cf3ac['message']));});});};
\ No newline at end of file
+var _0xa015=['request\x20sent','debug','stringify','error','message','info','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','AddTagsToChatInteraction','find','addTags','omit','spread','AddTags','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','request','then','ChatInteraction,\x20%s,\x20%s'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xa015,0x66));var _0x5a01=function(_0x4d817f,_0x414fa2){_0x4d817f=_0x4d817f-0x0;var _0x65cfa0=_0xa015[_0x4d817f];return _0x65cfa0;};'use strict';var _=require('lodash');var util=require(_0x5a01('0x0'));var moment=require(_0x5a01('0x1'));var BPromise=require('bluebird');var rs=require(_0x5a01('0x2'));var fs=require('fs');var Redis=require(_0x5a01('0x3'));var db=require(_0x5a01('0x4'))['db'];var utils=require(_0x5a01('0x5'));var logger=require(_0x5a01('0x6'))('rpc');var config=require(_0x5a01('0x7'));var jayson=require(_0x5a01('0x8'));var client=jayson[_0x5a01('0x9')][_0x5a01('0xa')]({'port':0x232a});config[_0x5a01('0xb')]=_['defaults'](config['redis'],{'host':_0x5a01('0xc'),'port':0x18eb});var socket=require(_0x5a01('0xd'))(new Redis(config[_0x5a01('0xb')]));require(_0x5a01('0xe'))['register'](socket);function respondWithRpcPromise(_0x5b2ba5,_0xe70104,_0x48a314){return new BPromise(function(_0x414ff9,_0x4b15e0){return client[_0x5a01('0xf')](_0x5b2ba5,_0x48a314)[_0x5a01('0x10')](function(_0x27a1b3){logger['info'](_0x5a01('0x11'),_0xe70104,_0x5a01('0x12'));logger[_0x5a01('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0xe70104,'request\x20sent',JSON[_0x5a01('0x14')](_0x27a1b3));if(_0x27a1b3[_0x5a01('0x15')]){if(_0x27a1b3[_0x5a01('0x15')]['code']===0x1f4){logger[_0x5a01('0x15')]('ChatInteraction,\x20%s,\x20%s',_0xe70104,_0x27a1b3[_0x5a01('0x15')]['message']);return _0x4b15e0(_0x27a1b3[_0x5a01('0x15')][_0x5a01('0x16')]);}logger['error'](_0x5a01('0x11'),_0xe70104,_0x27a1b3[_0x5a01('0x15')][_0x5a01('0x16')]);return _0x414ff9(_0x27a1b3['error'][_0x5a01('0x16')]);}else{logger[_0x5a01('0x17')]('ChatInteraction,\x20%s,\x20%s',_0xe70104,_0x5a01('0x12'));_0x414ff9(_0x27a1b3[_0x5a01('0x18')][_0x5a01('0x16')]);}})[_0x5a01('0x19')](function(_0x4bf128){logger[_0x5a01('0x15')](_0x5a01('0x11'),_0xe70104,_0x4bf128);_0x4b15e0(_0x4bf128);});});}exports[_0x5a01('0x1a')]=function(_0x40c653){var _0x14f795=this;return new Promise(function(_0x3edcb2,_0x3edbc5){return db[_0x5a01('0x1b')][_0x5a01('0x1c')](_0x40c653[_0x5a01('0x1d')],{'raw':_0x40c653[_0x5a01('0x1e')]?_0x40c653[_0x5a01('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40c653[_0x5a01('0x1e')]?_0x40c653['options'][_0x5a01('0x1f')]||null:null,'attributes':_0x40c653[_0x5a01('0x1e')]?_0x40c653['options'][_0x5a01('0x20')]||null:null,'limit':_0x40c653[_0x5a01('0x1e')]?_0x40c653['options'][_0x5a01('0x21')]||null:null})[_0x5a01('0x10')](function(_0x4b2eeb){logger['info'](_0x5a01('0x1a'),_0x40c653);logger['debug']('UpdateChatInteraction',_0x40c653,JSON['stringify'](_0x4b2eeb));_0x3edcb2(_0x4b2eeb);})['catch'](function(_0x1d6396){logger[_0x5a01('0x15')](_0x5a01('0x1a'),_0x1d6396[_0x5a01('0x16')],_0x40c653);_0x3edbc5(_0x14f795[_0x5a01('0x15')](0x1f4,_0x1d6396['message']));});});};exports[_0x5a01('0x22')]=function(_0xb0602f){return new Promise(function(_0xbe41a5,_0x428051){return db[_0x5a01('0x1b')][_0x5a01('0x23')]({'where':_0xb0602f[_0x5a01('0x1e')]?_0xb0602f[_0x5a01('0x1e')][_0x5a01('0x1f')]||null:null})[_0x5a01('0x10')](function(_0x3de295){if(_0x3de295){return _0x3de295[_0x5a01('0x24')](_0xb0602f[_0x5a01('0x1d')]['ids'],_[_0x5a01('0x25')](_0xb0602f['body'],['ids','id'])||{});}})[_0x5a01('0x26')](function(_0x5236fe){logger[_0x5a01('0x17')]('AddTags',_0xb0602f);logger['debug']('AddTags',_0xb0602f,JSON[_0x5a01('0x14')](_0x5236fe));_0xbe41a5(_0x5236fe);})[_0x5a01('0x19')](function(_0x398c2b){logger[_0x5a01('0x15')](_0x5a01('0x27'),_0x398c2b[_0x5a01('0x16')],_0xb0602f);_0x428051(_this[_0x5a01('0x15')](0x1f4,_0x398c2b['message']));});});};
\ No newline at end of file
index 37e8916..d2db4bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc55e=['emit','removeListener','register','chatInteraction:','./chatInteraction.events','save','remove','update'];(function(_0x82158f,_0x4e103e){var _0x5f475f=function(_0x473255){while(--_0x473255){_0x82158f['push'](_0x82158f['shift']());}};_0x5f475f(++_0x4e103e);}(_0xc55e,0x184));var _0xec55=function(_0x5e6638,_0x1ab32c){_0x5e6638=_0x5e6638-0x0;var _0x45d9c9=_0xc55e[_0x5e6638];return _0x45d9c9;};'use strict';var ChatInteractionEvents=require(_0xec55('0x0'));var events=[_0xec55('0x1'),_0xec55('0x2'),_0xec55('0x3')];function createListener(_0x1ee8ff,_0x1de7c0){return function(_0x506a5d){_0x1de7c0[_0xec55('0x4')](_0x1ee8ff,_0x506a5d);};}function removeListener(_0x3e408f,_0x567a83){return function(){ChatInteractionEvents[_0xec55('0x5')](_0x3e408f,_0x567a83);};}exports[_0xec55('0x6')]=function(_0x304e5a){for(var _0x4ed9ee=0x0,_0x46c145=events['length'];_0x4ed9ee<_0x46c145;_0x4ed9ee++){var _0x52f38f=events[_0x4ed9ee];var _0x7217b8=createListener(_0xec55('0x7')+_0x52f38f,_0x304e5a);ChatInteractionEvents['on'](_0x52f38f,_0x7217b8);}};
\ No newline at end of file
+var _0xf5ed=['remove','update','emit','removeListener','register','length','chatInteraction:','./chatInteraction.events','save'];(function(_0x4777ae,_0x557fd2){var _0x2f12b9=function(_0x4b9a26){while(--_0x4b9a26){_0x4777ae['push'](_0x4777ae['shift']());}};_0x2f12b9(++_0x557fd2);}(_0xf5ed,0x154));var _0xdf5e=function(_0x15dd28,_0x2fd167){_0x15dd28=_0x15dd28-0x0;var _0x3c2a16=_0xf5ed[_0x15dd28];return _0x3c2a16;};'use strict';var ChatInteractionEvents=require(_0xdf5e('0x0'));var events=[_0xdf5e('0x1'),_0xdf5e('0x2'),_0xdf5e('0x3')];function createListener(_0x5e238c,_0x544c31){return function(_0x1f3a7b){_0x544c31[_0xdf5e('0x4')](_0x5e238c,_0x1f3a7b);};}function removeListener(_0x3d9f7f,_0x3989aa){return function(){ChatInteractionEvents[_0xdf5e('0x5')](_0x3d9f7f,_0x3989aa);};}exports[_0xdf5e('0x6')]=function(_0x1f666b){for(var _0x3eb9fc=0x0,_0x289d41=events[_0xdf5e('0x7')];_0x3eb9fc<_0x289d41;_0x3eb9fc++){var _0x5d29a8=events[_0x3eb9fc];var _0x3ff12b=createListener(_0xdf5e('0x8')+_0x5d29a8,_0x1f666b);ChatInteractionEvents['on'](_0x5d29a8,_0x3ff12b);}};
\ No newline at end of file
index b4299d8..00f3809 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a10=['/:id/abandon','abandon','/:id/close','close','delete','/:id','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','/:id/download','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','tracked','addTags','chat','chatinteraction:update','put','/:id/custom_update','customUpdate'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x1a10,0xcd));var _0x01a1=function(_0x45552c,_0x56a349){_0x45552c=_0x45552c-0x0;var _0x482c08=_0x1a10[_0x45552c];return _0x482c08;};'use strict';var multer=require(_0x01a1('0x0'));var util=require(_0x01a1('0x1'));var path=require(_0x01a1('0x2'));var timeout=require(_0x01a1('0x3'));var express=require(_0x01a1('0x4'));var router=express[_0x01a1('0x5')]();var fs_extra=require(_0x01a1('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x01a1('0x7'));var controller=require('./chatInteraction.controller');router[_0x01a1('0x8')]('/',auth[_0x01a1('0x9')](),controller[_0x01a1('0xa')]);router[_0x01a1('0x8')]('/describe',auth[_0x01a1('0x9')](),controller[_0x01a1('0xb')]);router[_0x01a1('0x8')]('/:id',auth[_0x01a1('0xc')](),controller[_0x01a1('0xd')]);router[_0x01a1('0x8')](_0x01a1('0xe'),auth[_0x01a1('0xc')](),controller[_0x01a1('0xf')]);router['get'](_0x01a1('0x10'),auth[_0x01a1('0x9')](),controller[_0x01a1('0x11')]);router[_0x01a1('0x8')]('/:id/my_messages',auth[_0x01a1('0xc')](),controller[_0x01a1('0x12')]);router[_0x01a1('0x8')](_0x01a1('0x13'),auth[_0x01a1('0x9')](),controller['download']);router[_0x01a1('0x14')]('/',auth[_0x01a1('0x9')](),controller['create']);router[_0x01a1('0x14')](_0x01a1('0x15'),auth['isAuthenticated'](),controller[_0x01a1('0x16')]);var upload=multer({'storage':multer[_0x01a1('0x17')]({'destination':function(_0x5b314f,_0x4cbb16,_0xa1802a){_0xa1802a(null,path['join'](config[_0x01a1('0x18')],_0x01a1('0x19')));},'filename':function(_0x41bba3,_0x2fff08,_0x36d3a6){_0x36d3a6(null,util['format']('%s-%s',Date['now'](),_0x2fff08[_0x01a1('0x1a')][_0x01a1('0x1b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x01a1('0x14')](_0x01a1('0x1c'),upload[_0x01a1('0x1d')](_0x01a1('0x1e')),controller[_0x01a1('0x1f')]);router[_0x01a1('0x14')](_0x01a1('0x10'),auth[_0x01a1('0xc')](),controller[_0x01a1('0x20')]);router[_0x01a1('0x14')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x01a1('0x21')]('chat','chatinteraction:addtags'),controller[_0x01a1('0x22')]);router['put']('/:id',auth[_0x01a1('0x9')](),interaction[_0x01a1('0x21')](_0x01a1('0x23'),_0x01a1('0x24')),controller['update']);router[_0x01a1('0x25')](_0x01a1('0x26'),controller[_0x01a1('0x27')]);router['put'](_0x01a1('0x28'),auth[_0x01a1('0xc')](),controller[_0x01a1('0x29')]);router[_0x01a1('0x25')](_0x01a1('0x2a'),controller[_0x01a1('0x2b')]);router[_0x01a1('0x2c')](_0x01a1('0x2d'),auth['isAuthenticated'](),interaction[_0x01a1('0x21')](_0x01a1('0x23'),'chatinteraction:destroy'),controller['destroy']);router['delete'](_0x01a1('0x2e'),auth[_0x01a1('0x9')](),controller[_0x01a1('0x2f')]);module[_0x01a1('0x30')]=router;
\ No newline at end of file
+var _0x7e47=['describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','%s-%s','now','originalname','replace','attachmentUpload','addMessage','/:id/tags','tracked','addTags','put','chat','chatinteraction:update','update','customUpdate','/:id/abandon','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index'];(function(_0x5347c9,_0x399981){var _0x2b3980=function(_0x447f64){while(--_0x447f64){_0x5347c9['push'](_0x5347c9['shift']());}};_0x2b3980(++_0x399981);}(_0x7e47,0x110));var _0x77e4=function(_0x20372a,_0x5636bd){_0x20372a=_0x20372a-0x0;var _0x28653b=_0x7e47[_0x20372a];return _0x28653b;};'use strict';var multer=require(_0x77e4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x77e4('0x1'));var express=require('express');var router=express[_0x77e4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x77e4('0x3'));var interaction=require(_0x77e4('0x4'));var config=require(_0x77e4('0x5'));var controller=require(_0x77e4('0x6'));router[_0x77e4('0x7')]('/',auth[_0x77e4('0x8')](),controller[_0x77e4('0x9')]);router[_0x77e4('0x7')]('/describe',auth[_0x77e4('0x8')](),controller[_0x77e4('0xa')]);router[_0x77e4('0x7')](_0x77e4('0xb'),auth[_0x77e4('0xc')](),controller['show']);router[_0x77e4('0x7')](_0x77e4('0xd'),auth[_0x77e4('0xc')](),controller[_0x77e4('0xe')]);router[_0x77e4('0x7')](_0x77e4('0xf'),auth[_0x77e4('0x8')](),controller[_0x77e4('0x10')]);router[_0x77e4('0x7')](_0x77e4('0x11'),auth[_0x77e4('0xc')](),controller[_0x77e4('0x12')]);router[_0x77e4('0x7')]('/:id/download',auth[_0x77e4('0x8')](),controller[_0x77e4('0x13')]);router[_0x77e4('0x14')]('/',auth[_0x77e4('0x8')](),controller[_0x77e4('0x15')]);router[_0x77e4('0x14')](_0x77e4('0x16'),auth[_0x77e4('0x8')](),controller[_0x77e4('0x17')]);var upload=multer({'storage':multer[_0x77e4('0x18')]({'destination':function(_0x2a0eae,_0xc8e8f0,_0x5f128f){_0x5f128f(null,path['join'](config[_0x77e4('0x19')],_0x77e4('0x1a')));},'filename':function(_0x39c57d,_0x335e47,_0x4f8cc2){_0x4f8cc2(null,util['format'](_0x77e4('0x1b'),Date[_0x77e4('0x1c')](),_0x335e47[_0x77e4('0x1d')][_0x77e4('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x77e4('0x14')]('/:id/attachment_upload',upload['single']('file'),controller[_0x77e4('0x1f')]);router[_0x77e4('0x14')](_0x77e4('0xf'),auth[_0x77e4('0xc')](),controller[_0x77e4('0x20')]);router[_0x77e4('0x14')](_0x77e4('0x21'),auth['isAuthenticated'](),interaction[_0x77e4('0x22')]('chat','chatinteraction:addtags'),controller[_0x77e4('0x23')]);router[_0x77e4('0x24')](_0x77e4('0xb'),auth['isAuthenticated'](),interaction['tracked'](_0x77e4('0x25'),_0x77e4('0x26')),controller[_0x77e4('0x27')]);router['put']('/:id/custom_update',controller[_0x77e4('0x28')]);router[_0x77e4('0x24')](_0x77e4('0x29'),auth[_0x77e4('0xc')](),controller['abandon']);router[_0x77e4('0x24')]('/:id/close',controller['close']);router[_0x77e4('0x2a')](_0x77e4('0xb'),auth[_0x77e4('0x8')](),interaction[_0x77e4('0x22')]('chat',_0x77e4('0x2b')),controller[_0x77e4('0x2c')]);router[_0x77e4('0x2a')](_0x77e4('0x21'),auth[_0x77e4('0x8')](),controller[_0x77e4('0x2d')]);module[_0x77e4('0x2e')]=router;
\ No newline at end of file
index 3dba777..fd02123 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e72=['TEXT','INTEGER','sequelize','exports'];(function(_0x80d733,_0x266211){var _0x435868=function(_0x2ae0f0){while(--_0x2ae0f0){_0x80d733['push'](_0x80d733['shift']());}};_0x435868(++_0x266211);}(_0x4e72,0x1d6));var _0x24e7=function(_0x783062,_0xaadc97){_0x783062=_0x783062-0x0;var _0x3d69e0=_0x4e72[_0x783062];return _0x3d69e0;};'use strict';var Sequelize=require(_0x24e7('0x0'));module[_0x24e7('0x1')]={'body':{'type':Sequelize[_0x24e7('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x24e7('0x3')]}};
\ No newline at end of file
+var _0x6129=['INTEGER','medium','BOOLEAN'];(function(_0x5018ed,_0x5adc7c){var _0x137df7=function(_0x565d94){while(--_0x565d94){_0x5018ed['push'](_0x5018ed['shift']());}};_0x137df7(++_0x5adc7c);}(_0x6129,0x1c3));var _0x9612=function(_0x3c51af,_0x1991ce){_0x3c51af=_0x3c51af-0x0;var _0xeb10d9=_0x6129[_0x3c51af];return _0xeb10d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize['TEXT'](_0x9612('0x0')),'allowNull':![]},'read':{'type':Sequelize[_0x9612('0x1')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x9612('0x2')]}};
\ No newline at end of file
index 070b453..1a4452f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x74cc=['user','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','resourceId','push','read','-createdAt','all','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','ChatInternalMessage','rawAttributes','key','model','query','attributes','fields','length','order','sort','filters','pick','where','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','show','keys','intersection','options','find','catch','create','body','params','describe','get','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent','admin'];(function(_0x3d39d2,_0x1bee14){var _0x448f18=function(_0x3b6db6){while(--_0x3b6db6){_0x3d39d2['push'](_0x3d39d2['shift']());}};_0x448f18(++_0x1bee14);}(_0x74cc,0xed));var _0xc74c=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x74cc[_0x2bf141];return _0x48277b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc74c('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc74c('0x1'));var moment=require(_0xc74c('0x2'));var BPromise=require(_0xc74c('0x3'));var Mustache=require(_0xc74c('0x4'));var util=require(_0xc74c('0x5'));var path=require(_0xc74c('0x6'));var sox=require(_0xc74c('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc74c('0x8'));var _=require(_0xc74c('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc74c('0xa'));var deskjs=require(_0xc74c('0xb'));var toCsv=require(_0xc74c('0xc'));var querystring=require('querystring');var Papa=require(_0xc74c('0xd'));var Redis=require(_0xc74c('0xe'));var authService=require(_0xc74c('0xf'));var qs=require(_0xc74c('0x10'));var as=require(_0xc74c('0x11'));var hardwareService=require(_0xc74c('0x12'));var logger=require('../../config/logger')(_0xc74c('0x13'));var utils=require(_0xc74c('0x14'));var config=require(_0xc74c('0x15'));var licenseUtil=require(_0xc74c('0x16'));var db=require(_0xc74c('0x17'))['db'];config['redis']=_[_0xc74c('0x18')](config[_0xc74c('0x19')],{'host':_0xc74c('0x1a'),'port':0x18eb});var socket=require(_0xc74c('0x1b'))(new Redis(config['redis']));require(_0xc74c('0x1c'))[_0xc74c('0x1d')](socket);function respondWithStatusCode(_0x4c0226,_0x31c561){_0x31c561=_0x31c561||0xcc;return function(_0x17f988){if(_0x17f988){return _0x4c0226[_0xc74c('0x1e')](_0x31c561);}return _0x4c0226[_0xc74c('0x1f')](_0x31c561)[_0xc74c('0x20')]();};}function respondWithResult(_0x4948e3,_0x4c73ae){_0x4c73ae=_0x4c73ae||0xc8;return function(_0x5f2689){if(_0x5f2689){return _0x4948e3['status'](_0x4c73ae)[_0xc74c('0x21')](_0x5f2689);}};}function respondWithFilteredResult(_0x325560,_0x359b37){return function(_0x552cd8){if(_0x552cd8){var _0xf08f14=typeof _0x359b37[_0xc74c('0x22')]===_0xc74c('0x23')&&typeof _0x359b37['limit']==='undefined';var _0x45fa36=_0x552cd8[_0xc74c('0x24')];var _0x53f01b=_0xf08f14?0x0:_0x359b37[_0xc74c('0x22')];var _0x3bb4cc=_0xf08f14?_0x552cd8['count']:_0x359b37[_0xc74c('0x22')]+_0x359b37[_0xc74c('0x25')];var _0x35e463;if(_0x3bb4cc>=_0x45fa36){_0x3bb4cc=_0x45fa36;_0x35e463=0xc8;}else{_0x35e463=0xce;}_0x325560[_0xc74c('0x1f')](_0x35e463);return _0x325560['set'](_0xc74c('0x26'),_0x53f01b+'-'+_0x3bb4cc+'/'+_0x45fa36)[_0xc74c('0x21')](_0x552cd8);}return null;};}function patchUpdates(_0x5dbc58){return function(_0x4b84a5){try{jsonpatch[_0xc74c('0x27')](_0x4b84a5,_0x5dbc58,!![]);}catch(_0x859c28){return BPromise[_0xc74c('0x28')](_0x859c28);}return _0x4b84a5['save']();};}function saveUpdates(_0x425637,_0x588701){return function(_0x186fe5){if(_0x186fe5){return _0x186fe5[_0xc74c('0x29')](_0x425637)[_0xc74c('0x2a')](function(_0x418b82){return _0x418b82;});}return null;};}function removeEntity(_0x2f19ef,_0xf3805a){return function(_0xc80991){if(_0xc80991){return _0xc80991[_0xc74c('0x2b')]()[_0xc74c('0x2a')](function(){_0x2f19ef['status'](0xcc)[_0xc74c('0x20')]();});}};}function handleEntityNotFound(_0x302523,_0x3d4d2d){return function(_0xa232da){if(!_0xa232da){_0x302523[_0xc74c('0x1e')](0x194);}return _0xa232da;};}function handleError(_0xbf8099,_0x87f56f){_0x87f56f=_0x87f56f||0x1f4;return function(_0x113d70){logger['error'](_0x113d70[_0xc74c('0x2c')]);if(_0x113d70[_0xc74c('0x2d')]){delete _0x113d70[_0xc74c('0x2d')];}_0xbf8099[_0xc74c('0x1f')](_0x87f56f)[_0xc74c('0x2e')](_0x113d70);};}exports[_0xc74c('0x2f')]=function(_0x5b2d68,_0x595cee){var _0x2fa346={},_0x355f61={},_0x317700={'count':0x0,'rows':[]};var _0x49fdac=_[_0xc74c('0x30')](db[_0xc74c('0x31')][_0xc74c('0x32')],function(_0x4bae27){return{'name':_0x4bae27['fieldName'],'type':_0x4bae27['type'][_0xc74c('0x33')]};});_0x355f61[_0xc74c('0x34')]=_['map'](_0x49fdac,_0xc74c('0x2d'));_0x355f61[_0xc74c('0x35')]=_['keys'](_0x5b2d68[_0xc74c('0x35')]);_0x355f61['filters']=_['intersection'](_0x355f61[_0xc74c('0x34')],_0x355f61['query']);_0x2fa346[_0xc74c('0x36')]=_['intersection'](_0x355f61['model'],qs[_0xc74c('0x37')](_0x5b2d68[_0xc74c('0x35')][_0xc74c('0x37')]));_0x2fa346[_0xc74c('0x36')]=_0x2fa346[_0xc74c('0x36')][_0xc74c('0x38')]?_0x2fa346[_0xc74c('0x36')]:_0x355f61[_0xc74c('0x34')];if(!_0x5b2d68[_0xc74c('0x35')]['hasOwnProperty']('nolimit')){_0x2fa346['limit']=qs[_0xc74c('0x25')](_0x5b2d68['query'][_0xc74c('0x25')]);_0x2fa346[_0xc74c('0x22')]=qs['offset'](_0x5b2d68[_0xc74c('0x35')][_0xc74c('0x22')]);}_0x2fa346[_0xc74c('0x39')]=qs[_0xc74c('0x3a')](_0x5b2d68[_0xc74c('0x35')][_0xc74c('0x3a')]);_0x2fa346['where']=qs[_0xc74c('0x3b')](_[_0xc74c('0x3c')](_0x5b2d68[_0xc74c('0x35')],_0x355f61[_0xc74c('0x3b')]),_0x49fdac);if(_0x5b2d68['query']['filter']){_0x2fa346[_0xc74c('0x3d')]=_['merge'](_0x2fa346['where'],{'$or':_[_0xc74c('0x30')](_0x49fdac,function(_0x4c1846){if(_0x4c1846[_0xc74c('0x3e')]!==_0xc74c('0x3f')){var _0x1f24a7={};_0x1f24a7[_0x4c1846[_0xc74c('0x2d')]]={'$like':'%'+_0x5b2d68[_0xc74c('0x35')][_0xc74c('0x40')]+'%'};return _0x1f24a7;}})});}_0x2fa346=_[_0xc74c('0x41')]({},_0x2fa346,_0x5b2d68['options']);var _0x5ce2c2={'where':_0x2fa346['where']};return db[_0xc74c('0x31')][_0xc74c('0x24')](_0x5ce2c2)['then'](function(_0x466502){_0x317700['count']=_0x466502;if(_0x5b2d68[_0xc74c('0x35')][_0xc74c('0x42')]){_0x2fa346[_0xc74c('0x43')]=[{'all':!![]}];}return db[_0xc74c('0x31')][_0xc74c('0x44')](_0x2fa346);})[_0xc74c('0x2a')](function(_0x170f59){_0x317700[_0xc74c('0x45')]=_0x170f59;return _0x317700;})[_0xc74c('0x2a')](respondWithFilteredResult(_0x595cee,_0x2fa346))['catch'](handleError(_0x595cee,null));};exports[_0xc74c('0x46')]=function(_0x35f48a,_0x22aad5){var _0x21a753={'raw':!![],'where':{'id':_0x35f48a['params']['id']}},_0x3c1b2b={};_0x3c1b2b[_0xc74c('0x34')]=_['keys'](db[_0xc74c('0x31')][_0xc74c('0x32')]);_0x3c1b2b[_0xc74c('0x35')]=_[_0xc74c('0x47')](_0x35f48a[_0xc74c('0x35')]);_0x3c1b2b[_0xc74c('0x3b')]=_[_0xc74c('0x48')](_0x3c1b2b[_0xc74c('0x34')],_0x3c1b2b[_0xc74c('0x35')]);_0x21a753['attributes']=_[_0xc74c('0x48')](_0x3c1b2b[_0xc74c('0x34')],qs['fields'](_0x35f48a[_0xc74c('0x35')][_0xc74c('0x37')]));_0x21a753[_0xc74c('0x36')]=_0x21a753[_0xc74c('0x36')][_0xc74c('0x38')]?_0x21a753[_0xc74c('0x36')]:_0x3c1b2b[_0xc74c('0x34')];if(_0x35f48a[_0xc74c('0x35')][_0xc74c('0x42')]){_0x21a753['include']=[{'all':!![]}];}_0x21a753=_[_0xc74c('0x41')]({},_0x21a753,_0x35f48a[_0xc74c('0x49')]);return db[_0xc74c('0x31')][_0xc74c('0x4a')](_0x21a753)[_0xc74c('0x2a')](handleEntityNotFound(_0x22aad5,null))[_0xc74c('0x2a')](respondWithResult(_0x22aad5,null))[_0xc74c('0x4b')](handleError(_0x22aad5,null));};exports[_0xc74c('0x4c')]=function(_0x1e18a6,_0x245846){return db['ChatInternalMessage']['create'](_0x1e18a6[_0xc74c('0x4d')],{})['then'](respondWithResult(_0x245846,0xc9))[_0xc74c('0x4b')](handleError(_0x245846,null));};exports[_0xc74c('0x29')]=function(_0x23131f,_0x43cc89){if(_0x23131f[_0xc74c('0x4d')]['id']){delete _0x23131f['body']['id'];}return db[_0xc74c('0x31')][_0xc74c('0x4a')]({'where':{'id':_0x23131f[_0xc74c('0x4e')]['id']}})[_0xc74c('0x2a')](handleEntityNotFound(_0x43cc89,null))[_0xc74c('0x2a')](saveUpdates(_0x23131f[_0xc74c('0x4d')],null))[_0xc74c('0x2a')](respondWithResult(_0x43cc89,null))['catch'](handleError(_0x43cc89,null));};exports['destroy']=function(_0x1c0c80,_0x14c72c){return db[_0xc74c('0x31')][_0xc74c('0x4a')]({'where':{'id':_0x1c0c80[_0xc74c('0x4e')]['id']}})[_0xc74c('0x2a')](handleEntityNotFound(_0x14c72c,null))[_0xc74c('0x2a')](removeEntity(_0x14c72c,null))[_0xc74c('0x4b')](handleError(_0x14c72c,null));};exports['describe']=function(_0x3a08bc,_0x13342c){return db[_0xc74c('0x31')][_0xc74c('0x4f')]()['then'](respondWithResult(_0x13342c,null))[_0xc74c('0x4b')](handleError(_0x13342c,null));};function wrapUser(_0x568de5){return function(_0x252101){var _0x1f34f6=_0x568de5[_0xc74c('0x50')]({'plain':!![]});_0x1f34f6['messages']=[];if(_0x252101){_0x1f34f6[_0xc74c('0x51')]=_0x252101[_0xc74c('0x52')];_0x1f34f6['lastMessage']=_0x252101;}else{_0x1f34f6['lastMessageAt']=moment(0x0)[_0xc74c('0x53')](_0xc74c('0x54'));_0x1f34f6[_0xc74c('0x55')]={};}return _0x1f34f6;};}exports[_0xc74c('0x56')]=function(_0x2aeb93,_0x5450d8,_0x248f83){var _0x1f4fd7=[];return db[_0xc74c('0x57')][_0xc74c('0x44')]({'where':{'role':[_0xc74c('0x58'),_0xc74c('0x59'),_0xc74c('0x5a')]},'attributes':['id','fullname',_0xc74c('0x2d'),'role','userpic',_0xc74c('0x5b'),'online',_0xc74c('0x5c'),_0xc74c('0x5d'),_0xc74c('0x5e')],'order':qs[_0xc74c('0x3a')](_0xc74c('0x5f')),'include':[{'model':db[_0xc74c('0x60')],'as':_0xc74c('0x61'),'attributes':['id','name',_0xc74c('0x3e')],'through':{'attributes':[]}}]})[_0xc74c('0x2a')](function(_0x1ca7e2){if(_0x1ca7e2){var _0x406930=_0x2aeb93[_0xc74c('0x5a')]['get']({'plain':!![]});if(!_0x406930)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x406930[_0xc74c('0x62')]===_0xc74c('0x5a')){return db[_0xc74c('0x63')][_0xc74c('0x4a')]({'where':{'name':_0xc74c('0x64'),'userProfileId':_0x406930[_0xc74c('0x65')]},'raw':!![]})[_0xc74c('0x2a')](function(_0x16c639){if(_0x16c639){if(_0x16c639[_0xc74c('0x66')]===0x0){return db[_0xc74c('0x67')][_0xc74c('0x44')]({'where':{'sectionId':_0x16c639['id']},'raw':!![]})['then'](function(_0x2d11c3){var _0x11d3d3=[];if(_['isEmpty'](_0x2d11c3)){_0x11d3d3=_[_0xc74c('0x40')](_0x1ca7e2,function(_0x58d17b){if(_0x58d17b[_0xc74c('0x62')]!=='agent'){return _0x58d17b;}});return _0x11d3d3;}else{for(var _0x21090f=0x0;_0x21090f<_0x1ca7e2[_0xc74c('0x38')];_0x21090f++){var _0x1edd6e=_0x1ca7e2[_0x21090f];if(_0x1edd6e['role']==='agent'){var _0x141179=_[_0xc74c('0x4a')](_0x2d11c3,function(_0x21551f){return _0x21551f[_0xc74c('0x68')]===_0x1edd6e['id'];});if(_0x141179)_0x11d3d3[_0xc74c('0x69')](_0x1edd6e);}else{_0x11d3d3[_0xc74c('0x69')](_0x1edd6e);}}return _0x11d3d3;}});}else{return _0x1ca7e2;}}else{var _0x52c693=_['filter'](_0x1ca7e2,function(_0x5ad78b){if(_0x5ad78b[_0xc74c('0x62')]!==_0xc74c('0x58')){return _0x5ad78b;}});return _0x52c693;}});}else{return _0x1ca7e2;}}})['then'](function(_0x15df54){var _0x4f0085=[];if(_0x15df54){_0x1f4fd7=_0x15df54;for(var _0x58b364=0x0;_0x58b364<_0x15df54['length'];_0x58b364+=0x1){_0x1f4fd7[_0x58b364]['messages']=[];_0x4f0085[_0xc74c('0x69')](db[_0xc74c('0x31')][_0xc74c('0x4a')]({'where':{'FromId':[_0x2aeb93['user']['id'],_0x15df54[_0x58b364]['id']],'ToId':[_0x2aeb93['user']['id'],_0x15df54[_0x58b364]['id']],'ChatGroupId':null},'attributes':['id',_0xc74c('0x52'),'FromId','ToId',_0xc74c('0x6a'),_0xc74c('0x4d')],'order':qs['sort'](_0xc74c('0x6b')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc74c('0x2a')](wrapUser(_0x15df54[_0x58b364])));}return BPromise[_0xc74c('0x6c')](_0x4f0085);}return[];})[_0xc74c('0x2a')](function(_0x223145){return{'rows':_0x223145,'count':_0x223145['length']};})[_0xc74c('0x2a')](respondWithResult(_0x5450d8,null))[_0xc74c('0x4b')](handleError(_0x5450d8,null));};
\ No newline at end of file
+var _0x83ba=['then','destroy','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','include','rows','catch','show','includeAll','options','find','create','body','params','describe','get','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','agent','user','role','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update'];(function(_0x297d70,_0x39c7a6){var _0x5ada9e=function(_0x23b8c0){while(--_0x23b8c0){_0x297d70['push'](_0x297d70['shift']());}};_0x5ada9e(++_0x39c7a6);}(_0x83ba,0x129));var _0xa83b=function(_0x6f6680,_0x57dcc6){_0x6f6680=_0x6f6680-0x0;var _0x15e6af=_0x83ba[_0x6f6680];return _0x15e6af;};'use strict';var emlformat=require(_0xa83b('0x0'));var rimraf=require(_0xa83b('0x1'));var zipdir=require(_0xa83b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa83b('0x3'));var moment=require(_0xa83b('0x4'));var BPromise=require(_0xa83b('0x5'));var Mustache=require('mustache');var util=require(_0xa83b('0x6'));var path=require(_0xa83b('0x7'));var sox=require(_0xa83b('0x8'));var csv=require(_0xa83b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa83b('0xa'));var _=require(_0xa83b('0xb'));var squel=require(_0xa83b('0xc'));var crypto=require(_0xa83b('0xd'));var jsforce=require(_0xa83b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa83b('0x9'));var querystring=require(_0xa83b('0xf'));var Papa=require(_0xa83b('0x10'));var Redis=require(_0xa83b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xa83b('0x12'));var as=require(_0xa83b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa83b('0x14'));var config=require(_0xa83b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa83b('0x16'))['db'];config[_0xa83b('0x17')]=_[_0xa83b('0x18')](config[_0xa83b('0x17')],{'host':_0xa83b('0x19'),'port':0x18eb});var socket=require(_0xa83b('0x1a'))(new Redis(config[_0xa83b('0x17')]));require(_0xa83b('0x1b'))[_0xa83b('0x1c')](socket);function respondWithStatusCode(_0x214eb5,_0x19693f){_0x19693f=_0x19693f||0xcc;return function(_0x46e388){if(_0x46e388){return _0x214eb5[_0xa83b('0x1d')](_0x19693f);}return _0x214eb5['status'](_0x19693f)['end']();};}function respondWithResult(_0x5d8705,_0x399506){_0x399506=_0x399506||0xc8;return function(_0x1b1989){if(_0x1b1989){return _0x5d8705[_0xa83b('0x1e')](_0x399506)['json'](_0x1b1989);}};}function respondWithFilteredResult(_0x27df5f,_0x7fb44b){return function(_0x594ddc){if(_0x594ddc){var _0x392202=typeof _0x7fb44b[_0xa83b('0x1f')]===_0xa83b('0x20')&&typeof _0x7fb44b[_0xa83b('0x21')]===_0xa83b('0x20');var _0x32f0bd=_0x594ddc[_0xa83b('0x22')];var _0x2590e0=_0x392202?0x0:_0x7fb44b['offset'];var _0x1a31b1=_0x392202?_0x594ddc['count']:_0x7fb44b['offset']+_0x7fb44b[_0xa83b('0x21')];var _0xf7ef30;if(_0x1a31b1>=_0x32f0bd){_0x1a31b1=_0x32f0bd;_0xf7ef30=0xc8;}else{_0xf7ef30=0xce;}_0x27df5f['status'](_0xf7ef30);return _0x27df5f[_0xa83b('0x23')](_0xa83b('0x24'),_0x2590e0+'-'+_0x1a31b1+'/'+_0x32f0bd)[_0xa83b('0x25')](_0x594ddc);}return null;};}function patchUpdates(_0x1db196){return function(_0x5d126b){try{jsonpatch[_0xa83b('0x26')](_0x5d126b,_0x1db196,!![]);}catch(_0x1513ae){return BPromise[_0xa83b('0x27')](_0x1513ae);}return _0x5d126b[_0xa83b('0x28')]();};}function saveUpdates(_0x5b7438,_0x543bd5){return function(_0x5802bc){if(_0x5802bc){return _0x5802bc[_0xa83b('0x29')](_0x5b7438)[_0xa83b('0x2a')](function(_0x33f7e2){return _0x33f7e2;});}return null;};}function removeEntity(_0x2772a6,_0x2b6dec){return function(_0x425d27){if(_0x425d27){return _0x425d27[_0xa83b('0x2b')]()['then'](function(){_0x2772a6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x67d83b,_0x2cfdf1){return function(_0x5d22c2){if(!_0x5d22c2){_0x67d83b[_0xa83b('0x1d')](0x194);}return _0x5d22c2;};}function handleError(_0x4f68cf,_0x48e3b0){_0x48e3b0=_0x48e3b0||0x1f4;return function(_0x2d51b3){logger[_0xa83b('0x2c')](_0x2d51b3[_0xa83b('0x2d')]);if(_0x2d51b3[_0xa83b('0x2e')]){delete _0x2d51b3[_0xa83b('0x2e')];}_0x4f68cf['status'](_0x48e3b0)[_0xa83b('0x2f')](_0x2d51b3);};}exports[_0xa83b('0x30')]=function(_0x59ed4b,_0x561bce){var _0x48101e={},_0x12d808={},_0x11b7d4={'count':0x0,'rows':[]};var _0x37b61b=_[_0xa83b('0x31')](db[_0xa83b('0x32')][_0xa83b('0x33')],function(_0x498207){return{'name':_0x498207['fieldName'],'type':_0x498207['type'][_0xa83b('0x34')]};});_0x12d808[_0xa83b('0x35')]=_[_0xa83b('0x31')](_0x37b61b,'name');_0x12d808[_0xa83b('0x36')]=_[_0xa83b('0x37')](_0x59ed4b[_0xa83b('0x36')]);_0x12d808['filters']=_['intersection'](_0x12d808['model'],_0x12d808['query']);_0x48101e[_0xa83b('0x38')]=_[_0xa83b('0x39')](_0x12d808[_0xa83b('0x35')],qs['fields'](_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x3a')]));_0x48101e[_0xa83b('0x38')]=_0x48101e[_0xa83b('0x38')][_0xa83b('0x3b')]?_0x48101e['attributes']:_0x12d808[_0xa83b('0x35')];if(!_0x59ed4b['query'][_0xa83b('0x3c')](_0xa83b('0x3d'))){_0x48101e[_0xa83b('0x21')]=qs[_0xa83b('0x21')](_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x21')]);_0x48101e[_0xa83b('0x1f')]=qs['offset'](_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x1f')]);}_0x48101e[_0xa83b('0x3e')]=qs['sort'](_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x3f')]);_0x48101e[_0xa83b('0x40')]=qs[_0xa83b('0x41')](_[_0xa83b('0x42')](_0x59ed4b[_0xa83b('0x36')],_0x12d808[_0xa83b('0x41')]),_0x37b61b);if(_0x59ed4b[_0xa83b('0x36')]['filter']){_0x48101e[_0xa83b('0x40')]=_['merge'](_0x48101e[_0xa83b('0x40')],{'$or':_[_0xa83b('0x31')](_0x37b61b,function(_0x474104){if(_0x474104[_0xa83b('0x43')]!==_0xa83b('0x44')){var _0x43fff2={};_0x43fff2[_0x474104['name']]={'$like':'%'+_0x59ed4b[_0xa83b('0x36')][_0xa83b('0x45')]+'%'};return _0x43fff2;}})});}_0x48101e=_[_0xa83b('0x46')]({},_0x48101e,_0x59ed4b['options']);var _0x2ea549={'where':_0x48101e['where']};return db['ChatInternalMessage']['count'](_0x2ea549)[_0xa83b('0x2a')](function(_0xb8d90b){_0x11b7d4['count']=_0xb8d90b;if(_0x59ed4b[_0xa83b('0x36')]['includeAll']){_0x48101e[_0xa83b('0x47')]=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x48101e);})[_0xa83b('0x2a')](function(_0x19584b){_0x11b7d4[_0xa83b('0x48')]=_0x19584b;return _0x11b7d4;})[_0xa83b('0x2a')](respondWithFilteredResult(_0x561bce,_0x48101e))[_0xa83b('0x49')](handleError(_0x561bce,null));};exports[_0xa83b('0x4a')]=function(_0x1ae5c6,_0x40be33){var _0x347cb5={'raw':!![],'where':{'id':_0x1ae5c6['params']['id']}},_0x3fa3d0={};_0x3fa3d0[_0xa83b('0x35')]=_[_0xa83b('0x37')](db['ChatInternalMessage'][_0xa83b('0x33')]);_0x3fa3d0[_0xa83b('0x36')]=_[_0xa83b('0x37')](_0x1ae5c6[_0xa83b('0x36')]);_0x3fa3d0[_0xa83b('0x41')]=_[_0xa83b('0x39')](_0x3fa3d0[_0xa83b('0x35')],_0x3fa3d0[_0xa83b('0x36')]);_0x347cb5['attributes']=_[_0xa83b('0x39')](_0x3fa3d0[_0xa83b('0x35')],qs['fields'](_0x1ae5c6[_0xa83b('0x36')]['fields']));_0x347cb5[_0xa83b('0x38')]=_0x347cb5[_0xa83b('0x38')][_0xa83b('0x3b')]?_0x347cb5[_0xa83b('0x38')]:_0x3fa3d0['model'];if(_0x1ae5c6[_0xa83b('0x36')][_0xa83b('0x4b')]){_0x347cb5[_0xa83b('0x47')]=[{'all':!![]}];}_0x347cb5=_[_0xa83b('0x46')]({},_0x347cb5,_0x1ae5c6[_0xa83b('0x4c')]);return db[_0xa83b('0x32')][_0xa83b('0x4d')](_0x347cb5)['then'](handleEntityNotFound(_0x40be33,null))[_0xa83b('0x2a')](respondWithResult(_0x40be33,null))[_0xa83b('0x49')](handleError(_0x40be33,null));};exports[_0xa83b('0x4e')]=function(_0x4e61bb,_0x95132a){return db[_0xa83b('0x32')]['create'](_0x4e61bb[_0xa83b('0x4f')],{})[_0xa83b('0x2a')](respondWithResult(_0x95132a,0xc9))[_0xa83b('0x49')](handleError(_0x95132a,null));};exports[_0xa83b('0x29')]=function(_0x1a2245,_0x1b75cc){if(_0x1a2245['body']['id']){delete _0x1a2245['body']['id'];}return db[_0xa83b('0x32')][_0xa83b('0x4d')]({'where':{'id':_0x1a2245[_0xa83b('0x50')]['id']}})[_0xa83b('0x2a')](handleEntityNotFound(_0x1b75cc,null))[_0xa83b('0x2a')](saveUpdates(_0x1a2245[_0xa83b('0x4f')],null))[_0xa83b('0x2a')](respondWithResult(_0x1b75cc,null))[_0xa83b('0x49')](handleError(_0x1b75cc,null));};exports[_0xa83b('0x2b')]=function(_0x479675,_0x45c967){return db['ChatInternalMessage'][_0xa83b('0x4d')]({'where':{'id':_0x479675[_0xa83b('0x50')]['id']}})[_0xa83b('0x2a')](handleEntityNotFound(_0x45c967,null))[_0xa83b('0x2a')](removeEntity(_0x45c967,null))['catch'](handleError(_0x45c967,null));};exports[_0xa83b('0x51')]=function(_0x75f45f,_0x316b38){return db[_0xa83b('0x32')][_0xa83b('0x51')]()[_0xa83b('0x2a')](respondWithResult(_0x316b38,null))[_0xa83b('0x49')](handleError(_0x316b38,null));};function wrapUser(_0x247628){return function(_0x47a7de){var _0x47498c=_0x247628[_0xa83b('0x52')]({'plain':!![]});_0x47498c[_0xa83b('0x53')]=[];if(_0x47a7de){_0x47498c[_0xa83b('0x54')]=_0x47a7de['createdAt'];_0x47498c[_0xa83b('0x55')]=_0x47a7de;}else{_0x47498c[_0xa83b('0x54')]=moment(0x0)[_0xa83b('0x56')](_0xa83b('0x57'));_0x47498c[_0xa83b('0x55')]={};}return _0x47498c;};}exports[_0xa83b('0x58')]=function(_0x582511,_0x27e707,_0x3cfcc1){var _0x3ab199=[];return db['User'][_0xa83b('0x59')]({'where':{'role':[_0xa83b('0x5a'),'admin',_0xa83b('0x5b')]},'attributes':['id','fullname',_0xa83b('0x2e'),_0xa83b('0x5c'),'userpic','internal','online',_0xa83b('0x5d'),_0xa83b('0x5e'),_0xa83b('0x5f')],'order':qs['sort']('-online'),'include':[{'model':db[_0xa83b('0x60')],'as':_0xa83b('0x61'),'attributes':['id',_0xa83b('0x2e'),_0xa83b('0x43')],'through':{'attributes':[]}}]})[_0xa83b('0x2a')](function(_0x5ee640){if(_0x5ee640){var _0x40fd0a=_0x582511[_0xa83b('0x5b')][_0xa83b('0x52')]({'plain':!![]});if(!_0x40fd0a)throw new Error(_0xa83b('0x62'));if(_0x40fd0a[_0xa83b('0x5c')]===_0xa83b('0x5b')){return db[_0xa83b('0x63')][_0xa83b('0x4d')]({'where':{'name':_0xa83b('0x64'),'userProfileId':_0x40fd0a[_0xa83b('0x65')]},'raw':!![]})[_0xa83b('0x2a')](function(_0x1ba915){if(_0x1ba915){if(_0x1ba915[_0xa83b('0x66')]===0x0){return db[_0xa83b('0x67')][_0xa83b('0x59')]({'where':{'sectionId':_0x1ba915['id']},'raw':!![]})[_0xa83b('0x2a')](function(_0x4f9b98){var _0x43b5ae=[];if(_[_0xa83b('0x68')](_0x4f9b98)){_0x43b5ae=_[_0xa83b('0x45')](_0x5ee640,function(_0x4ab9e1){if(_0x4ab9e1[_0xa83b('0x5c')]!=='agent'){return _0x4ab9e1;}});return _0x43b5ae;}else{for(var _0x24a34f=0x0;_0x24a34f<_0x5ee640[_0xa83b('0x3b')];_0x24a34f++){var _0xca9ccd=_0x5ee640[_0x24a34f];if(_0xca9ccd[_0xa83b('0x5c')]===_0xa83b('0x5a')){var _0xb69c5f=_[_0xa83b('0x4d')](_0x4f9b98,function(_0x3c9796){return _0x3c9796[_0xa83b('0x69')]===_0xca9ccd['id'];});if(_0xb69c5f)_0x43b5ae['push'](_0xca9ccd);}else{_0x43b5ae[_0xa83b('0x6a')](_0xca9ccd);}}return _0x43b5ae;}});}else{return _0x5ee640;}}else{var _0x5707ef=_[_0xa83b('0x45')](_0x5ee640,function(_0x38679b){if(_0x38679b['role']!==_0xa83b('0x5a')){return _0x38679b;}});return _0x5707ef;}});}else{return _0x5ee640;}}})[_0xa83b('0x2a')](function(_0x34a5e1){var _0x327b70=[];if(_0x34a5e1){_0x3ab199=_0x34a5e1;for(var _0x2fe192=0x0;_0x2fe192<_0x34a5e1[_0xa83b('0x3b')];_0x2fe192+=0x1){_0x3ab199[_0x2fe192]['messages']=[];_0x327b70['push'](db[_0xa83b('0x32')][_0xa83b('0x4d')]({'where':{'FromId':[_0x582511[_0xa83b('0x5b')]['id'],_0x34a5e1[_0x2fe192]['id']],'ToId':[_0x582511[_0xa83b('0x5b')]['id'],_0x34a5e1[_0x2fe192]['id']],'ChatGroupId':null},'attributes':['id',_0xa83b('0x6b'),_0xa83b('0x6c'),_0xa83b('0x6d'),_0xa83b('0x6e'),_0xa83b('0x4f')],'order':qs[_0xa83b('0x3f')](_0xa83b('0x6f')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x34a5e1[_0x2fe192])));}return BPromise[_0xa83b('0x70')](_0x327b70);}return[];})[_0xa83b('0x2a')](function(_0x4dc7ae){return{'rows':_0x4dc7ae,'count':_0x4dc7ae['length']};})[_0xa83b('0x2a')](respondWithResult(_0x27e707,null))['catch'](handleError(_0x27e707,null));};
\ No newline at end of file
index 93b1af3..83801cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf3a8=['emit','hasOwnProperty','hook','exports','../../mysqldb','ChatInternalMessage','save'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x5b930b,_0x262a69){_0x5b930b=_0x5b930b-0x0;var _0x5cee80=_0xf3a8[_0x5b930b];return _0x5cee80;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x8f3a('0x0'))['db'][_0x8f3a('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8f3a('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x109638){return function(_0x48673f,_0x38fe23,_0x5a47bd){ChatInternalMessageEvents[_0x8f3a('0x3')](_0x109638+':'+_0x48673f['id'],_0x48673f);ChatInternalMessageEvents[_0x8f3a('0x3')](_0x109638,_0x48673f);_0x5a47bd(null);};}for(var e in events){if(events[_0x8f3a('0x4')](e)){var event=events[e];ChatInternalMessage[_0x8f3a('0x5')](e,emitEvent(event));}}module[_0x8f3a('0x6')]=ChatInternalMessageEvents;
\ No newline at end of file
+var _0x96f1=['hook','exports','../../mysqldb','ChatInternalMessage','save','update'];(function(_0x551f88,_0x330636){var _0x585273=function(_0x29c2d9){while(--_0x29c2d9){_0x551f88['push'](_0x551f88['shift']());}};_0x585273(++_0x330636);}(_0x96f1,0x10a));var _0x196f=function(_0x529c3a,_0x48b765){_0x529c3a=_0x529c3a-0x0;var _0x1a00ce=_0x96f1[_0x529c3a];return _0x1a00ce;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0x196f('0x0'))['db'][_0x196f('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x196f('0x2'),'afterUpdate':_0x196f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2ee279){return function(_0x59e862,_0xd756d6,_0x3c6470){ChatInternalMessageEvents['emit'](_0x2ee279+':'+_0x59e862['id'],_0x59e862);ChatInternalMessageEvents['emit'](_0x2ee279,_0x59e862);_0x3c6470(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x196f('0x4')](e,emitEvent(event));}}module[_0x196f('0x5')]=ChatInternalMessageEvents;
\ No newline at end of file
index acf4c8e..9b9790e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc72b=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./chatInternalMessage.attributes','exports','define','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x5bda3b,_0x41160f){var _0x431bb9=function(_0x160122){while(--_0x160122){_0x5bda3b['push'](_0x5bda3b['shift']());}};_0x431bb9(++_0x41160f);}(_0xc72b,0x116));var _0xbc72=function(_0x4d08b8,_0x34c445){_0x4d08b8=_0x4d08b8-0x0;var _0x70214a=_0xc72b[_0x4d08b8];return _0x70214a;};'use strict';var _=require(_0xbc72('0x0'));var util=require(_0xbc72('0x1'));var logger=require(_0xbc72('0x2'))('api');var moment=require(_0xbc72('0x3'));var BPromise=require(_0xbc72('0x4'));var rp=require(_0xbc72('0x5'));var fs=require('fs');var path=require(_0xbc72('0x6'));var rimraf=require('rimraf');var config=require(_0xbc72('0x7'));var attributes=require(_0xbc72('0x8'));module[_0xbc72('0x9')]=function(_0x48afb1,_0x51e786){return _0x48afb1[_0xbc72('0xa')]('ChatInternalMessage',attributes,{'tableName':_0xbc72('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xbc72('0xc'),'collate':_0xbc72('0xd')});};
\ No newline at end of file
+var _0x8265=['rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x293b44,_0x122a8b){var _0x1ca24b=function(_0xa7314a){while(--_0xa7314a){_0x293b44['push'](_0x293b44['shift']());}};_0x1ca24b(++_0x122a8b);}(_0x8265,0xa0));var _0x5826=function(_0x13ead2,_0x5ec737){_0x13ead2=_0x13ead2-0x0;var _0x5cca4a=_0x8265[_0x13ead2];return _0x5cca4a;};'use strict';var _=require(_0x5826('0x0'));var util=require(_0x5826('0x1'));var logger=require(_0x5826('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5826('0x3'));var rp=require(_0x5826('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5826('0x5'));var config=require(_0x5826('0x6'));var attributes=require(_0x5826('0x7'));module[_0x5826('0x8')]=function(_0x3bf5a3,_0x53cbb0){return _0x3bf5a3[_0x5826('0x9')](_0x5826('0xa'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index e6f0294..3c4da8b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96a2=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','catch'];(function(_0x2c44d1,_0x434114){var _0x1e67e0=function(_0xa4f951){while(--_0xa4f951){_0x2c44d1['push'](_0x2c44d1['shift']());}};_0x1e67e0(++_0x434114);}(_0x96a2,0x96));var _0x296a=function(_0x3e26e0,_0x4629e8){_0x3e26e0=_0x3e26e0-0x0;var _0x308893=_0x96a2[_0x3e26e0];return _0x308893;};'use strict';var _=require(_0x296a('0x0'));var util=require('util');var moment=require(_0x296a('0x1'));var BPromise=require(_0x296a('0x2'));var rs=require(_0x296a('0x3'));var fs=require('fs');var Redis=require(_0x296a('0x4'));var db=require(_0x296a('0x5'))['db'];var utils=require(_0x296a('0x6'));var logger=require(_0x296a('0x7'))(_0x296a('0x8'));var config=require(_0x296a('0x9'));var jayson=require(_0x296a('0xa'));var client=jayson[_0x296a('0xb')][_0x296a('0xc')]({'port':0x232a});config[_0x296a('0xd')]=_[_0x296a('0xe')](config[_0x296a('0xd')],{'host':_0x296a('0xf'),'port':0x18eb});var socket=require(_0x296a('0x10'))(new Redis(config[_0x296a('0xd')]));require('./chatInternalMessage.socket')[_0x296a('0x11')](socket);function respondWithRpcPromise(_0x250b74,_0x5e95dd,_0x625a2){return new BPromise(function(_0x1d1896,_0xc31eec){return client[_0x296a('0x12')](_0x250b74,_0x625a2)[_0x296a('0x13')](function(_0x323e6a){logger[_0x296a('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x5e95dd,_0x296a('0x15'));logger[_0x296a('0x16')](_0x296a('0x17'),_0x5e95dd,_0x296a('0x15'),JSON[_0x296a('0x18')](_0x323e6a));if(_0x323e6a['error']){if(_0x323e6a[_0x296a('0x19')][_0x296a('0x1a')]===0x1f4){logger['error'](_0x296a('0x1b'),_0x5e95dd,_0x323e6a[_0x296a('0x19')][_0x296a('0x1c')]);return _0xc31eec(_0x323e6a[_0x296a('0x19')][_0x296a('0x1c')]);}logger[_0x296a('0x19')]('ChatInternalMessage,\x20%s,\x20%s',_0x5e95dd,_0x323e6a[_0x296a('0x19')]['message']);return _0x1d1896(_0x323e6a['error']['message']);}else{logger[_0x296a('0x14')](_0x296a('0x1b'),_0x5e95dd,_0x296a('0x15'));_0x1d1896(_0x323e6a['result']['message']);}})[_0x296a('0x1d')](function(_0x566ce2){logger[_0x296a('0x19')](_0x296a('0x1b'),_0x5e95dd,_0x566ce2);_0xc31eec(_0x566ce2);});});}
\ No newline at end of file
+var _0x4ecf=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults'];(function(_0x53818b,_0x1523cc){var _0x5a6429=function(_0x5d7407){while(--_0x5d7407){_0x53818b['push'](_0x53818b['shift']());}};_0x5a6429(++_0x1523cc);}(_0x4ecf,0x186));var _0xf4ec=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x4ecf[_0x19950b];return _0x3c6b41;};'use strict';var _=require(_0xf4ec('0x0'));var util=require(_0xf4ec('0x1'));var moment=require('moment');var BPromise=require(_0xf4ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf4ec('0x3'))['db'];var utils=require(_0xf4ec('0x4'));var logger=require('../../config/logger')(_0xf4ec('0x5'));var config=require(_0xf4ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf4ec('0x7')]['http']({'port':0x232a});config[_0xf4ec('0x8')]=_[_0xf4ec('0x9')](config[_0xf4ec('0x8')],{'host':_0xf4ec('0xa'),'port':0x18eb});var socket=require(_0xf4ec('0xb'))(new Redis(config[_0xf4ec('0x8')]));require(_0xf4ec('0xc'))[_0xf4ec('0xd')](socket);function respondWithRpcPromise(_0x3cbed1,_0xe7b504,_0x35081f){return new BPromise(function(_0x293c3b,_0x30ed79){return client[_0xf4ec('0xe')](_0x3cbed1,_0x35081f)[_0xf4ec('0xf')](function(_0x58bfe6){logger[_0xf4ec('0x10')](_0xf4ec('0x11'),_0xe7b504,_0xf4ec('0x12'));logger['debug']('ChatInternalMessage,\x20%s,\x20%s,\x20%s',_0xe7b504,'request\x20sent',JSON[_0xf4ec('0x13')](_0x58bfe6));if(_0x58bfe6['error']){if(_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x15')]===0x1f4){logger['error'](_0xf4ec('0x11'),_0xe7b504,_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x16')]);return _0x30ed79(_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x16')]);}logger['error'](_0xf4ec('0x11'),_0xe7b504,_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x16')]);return _0x293c3b(_0x58bfe6[_0xf4ec('0x14')][_0xf4ec('0x16')]);}else{logger[_0xf4ec('0x10')](_0xf4ec('0x11'),_0xe7b504,_0xf4ec('0x12'));_0x293c3b(_0x58bfe6[_0xf4ec('0x17')]['message']);}})[_0xf4ec('0x18')](function(_0x31511a){logger[_0xf4ec('0x14')](_0xf4ec('0x11'),_0xe7b504,_0x31511a);_0x30ed79(_0x31511a);});});}
\ No newline at end of file
index 9548459..23c5dec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b2a=['save','update','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x101e7b,_0x4ef05b){var _0x4995c0=function(_0x1a6488){while(--_0x1a6488){_0x101e7b['push'](_0x101e7b['shift']());}};_0x4995c0(++_0x4ef05b);}(_0x8b2a,0xc4));var _0xa8b2=function(_0x112d20,_0x4bd3b6){_0x112d20=_0x112d20-0x0;var _0x48c4ce=_0x8b2a[_0x112d20];return _0x48c4ce;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xa8b2('0x0'),'remove',_0xa8b2('0x1')];function createListener(_0x2f6e08,_0x17d7bb){return function(_0x1535f3){_0x17d7bb[_0xa8b2('0x2')](_0x2f6e08,_0x1535f3);};}function removeListener(_0xc28278,_0x19b7bd){return function(){ChatInternalMessageEvents[_0xa8b2('0x3')](_0xc28278,_0x19b7bd);};}exports[_0xa8b2('0x4')]=function(_0x1d35e6){for(var _0xa7fd91=0x0,_0x1d1c7f=events[_0xa8b2('0x5')];_0xa7fd91<_0x1d1c7f;_0xa7fd91++){var _0x2e9e13=events[_0xa7fd91];var _0x1545b6=createListener(_0xa8b2('0x6')+_0x2e9e13,_0x1d35e6);ChatInternalMessageEvents['on'](_0x2e9e13,_0x1545b6);}};
\ No newline at end of file
+var _0x926d=['save','remove','emit','removeListener','register'];(function(_0x170b0b,_0x4aa600){var _0x33cd22=function(_0x35263c){while(--_0x35263c){_0x170b0b['push'](_0x170b0b['shift']());}};_0x33cd22(++_0x4aa600);}(_0x926d,0x177));var _0xd926=function(_0x855e7,_0x21975d){_0x855e7=_0x855e7-0x0;var _0xe4a718=_0x926d[_0x855e7];return _0xe4a718;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0xd926('0x0'),_0xd926('0x1'),'update'];function createListener(_0x53efe8,_0x5959e6){return function(_0x2ef23a){_0x5959e6[_0xd926('0x2')](_0x53efe8,_0x2ef23a);};}function removeListener(_0x2e8a31,_0x232ac0){return function(){ChatInternalMessageEvents[_0xd926('0x3')](_0x2e8a31,_0x232ac0);};}exports[_0xd926('0x4')]=function(_0x19675d){for(var _0x3b830c=0x0,_0x38422e=events['length'];_0x3b830c<_0x38422e;_0x3b830c++){var _0xb1aa1=events[_0x3b830c];var _0x2973cb=createListener('chatInternalMessage:'+_0xb1aa1,_0x19675d);ChatInternalMessageEvents['on'](_0xb1aa1,_0x2973cb);}};
\ No newline at end of file
index eeee082..7248225 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb1a=['Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/users','getUsers','show','post','update','/:id','destroy','exports','multer','util','path','connect-timeout'];(function(_0x4d84bc,_0x46f7c6){var _0x16a301=function(_0x1fa0d7){while(--_0x1fa0d7){_0x4d84bc['push'](_0x4d84bc['shift']());}};_0x16a301(++_0x46f7c6);}(_0xcb1a,0xd8));var _0xacb1=function(_0x4e679b,_0x5a0d66){_0x4e679b=_0x4e679b-0x0;var _0x37ebd6=_0xcb1a[_0x4e679b];return _0x37ebd6;};'use strict';var multer=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var path=require(_0xacb1('0x2'));var timeout=require(_0xacb1('0x3'));var express=require('express');var router=express[_0xacb1('0x4')]();var fs_extra=require(_0xacb1('0x5'));var auth=require(_0xacb1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xacb1('0x7'));var controller=require('./chatInternalMessage.controller');router[_0xacb1('0x8')]('/',auth[_0xacb1('0x9')](),controller[_0xacb1('0xa')]);router[_0xacb1('0x8')](_0xacb1('0xb'),auth[_0xacb1('0x9')](),controller['describe']);router['get'](_0xacb1('0xc'),auth[_0xacb1('0x9')](),controller[_0xacb1('0xd')]);router[_0xacb1('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xacb1('0xe')]);router[_0xacb1('0xf')]('/',auth[_0xacb1('0x9')](),controller['create']);router['put']('/:id',controller[_0xacb1('0x10')]);router['delete'](_0xacb1('0x11'),auth[_0xacb1('0x9')](),controller[_0xacb1('0x12')]);module[_0xacb1('0x13')]=router;
\ No newline at end of file
+var _0xb156=['multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','index','get','/describe','describe','/users','getUsers','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2ae2ad,_0xac5b0c){var _0x26dbd7=function(_0x5e685b){while(--_0x5e685b){_0x2ae2ad['push'](_0x2ae2ad['shift']());}};_0x26dbd7(++_0xac5b0c);}(_0xb156,0xfd));var _0x6b15=function(_0x21bfce,_0x4c2c80){_0x21bfce=_0x21bfce-0x0;var _0x1cd9e0=_0xb156[_0x21bfce];return _0x1cd9e0;};'use strict';var multer=require(_0x6b15('0x0'));var util=require('util');var path=require(_0x6b15('0x1'));var timeout=require(_0x6b15('0x2'));var express=require('express');var router=express[_0x6b15('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6b15('0x4'));var interaction=require(_0x6b15('0x5'));var config=require('../../config/environment');var controller=require(_0x6b15('0x6'));router['get']('/',auth[_0x6b15('0x7')](),controller[_0x6b15('0x8')]);router[_0x6b15('0x9')](_0x6b15('0xa'),auth[_0x6b15('0x7')](),controller[_0x6b15('0xb')]);router[_0x6b15('0x9')](_0x6b15('0xc'),auth['isAuthenticated'](),controller[_0x6b15('0xd')]);router[_0x6b15('0x9')](_0x6b15('0xe'),auth[_0x6b15('0x7')](),controller[_0x6b15('0xf')]);router[_0x6b15('0x10')]('/',auth['isAuthenticated'](),controller[_0x6b15('0x11')]);router[_0x6b15('0x12')](_0x6b15('0xe'),controller[_0x6b15('0x13')]);router[_0x6b15('0x14')](_0x6b15('0xe'),auth['isAuthenticated'](),controller[_0x6b15('0x15')]);module[_0x6b15('0x16')]=router;
\ No newline at end of file
index 91f3aa6..8a2d60a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x73a1=['medium','BOOLEAN','ENUM','out','DATE','TEXT'];(function(_0xb9fe33,_0x47a545){var _0x15f7c2=function(_0x24f0e3){while(--_0x24f0e3){_0xb9fe33['push'](_0xb9fe33['shift']());}};_0x15f7c2(++_0x47a545);}(_0x73a1,0x161));var _0x173a=function(_0x4d2f00,_0x4e94d5){_0x4d2f00=_0x4d2f00-0x0;var _0x2d7b7f=_0x73a1[_0x4d2f00];return _0x2d7b7f;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x173a('0x0')](_0x173a('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x173a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x173a('0x3')]('in',_0x173a('0x4')),'defaultValue':_0x173a('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x173a('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x173a('0x0')]}};
\ No newline at end of file
+var _0x9ccd=['TEXT','medium','ENUM','out','DATE','STRING','sequelize'];(function(_0xecfad3,_0x5e4ce6){var _0x3061bb=function(_0x525e75){while(--_0x525e75){_0xecfad3['push'](_0xecfad3['shift']());}};_0x3061bb(++_0x5e4ce6);}(_0x9ccd,0x1a3));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xd9cc('0x0'));module['exports']={'body':{'type':Sequelize[_0xd9cc('0x1')](_0xd9cc('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9cc('0x3')]('in','out'),'defaultValue':_0xd9cc('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd9cc('0x5')]},'providerName':{'type':Sequelize[_0xd9cc('0x6')]},'providerResponse':{'type':Sequelize[_0xd9cc('0x1')]}};
\ No newline at end of file
index ff4d15e..a4bb4c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1d91=['keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','findAll','rows','show','params','include','options','create','body','find','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','SIP/%s','channel','event','EventManager','acceptmessage','chat-interactions','ChatInteraction','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','sequelize','QueryTypes','agent','motionChannel','rejectmessage','parse','formData','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','stack','name','ChatMessage','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x303dbc,_0x23de7c){var _0x262078=function(_0x1a61db){while(--_0x1a61db){_0x303dbc['push'](_0x303dbc['shift']());}};_0x262078(++_0x23de7c);}(_0x1d91,0x1cd));var _0x11d9=function(_0x5d7cef,_0x4a2bd5){_0x5d7cef=_0x5d7cef-0x0;var _0x525e2b=_0x1d91[_0x5d7cef];return _0x525e2b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11d9('0x0'));var jsonpatch=require(_0x11d9('0x1'));var rp=require(_0x11d9('0x2'));var moment=require(_0x11d9('0x3'));var BPromise=require(_0x11d9('0x4'));var Mustache=require(_0x11d9('0x5'));var util=require(_0x11d9('0x6'));var path=require(_0x11d9('0x7'));var sox=require(_0x11d9('0x8'));var csv=require(_0x11d9('0x9'));var ejs=require(_0x11d9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11d9('0xb'));var crypto=require(_0x11d9('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x11d9('0xd'));var toCsv=require(_0x11d9('0x9'));var querystring=require(_0x11d9('0xe'));var Papa=require(_0x11d9('0xf'));var Redis=require(_0x11d9('0x10'));var authService=require(_0x11d9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11d9('0x12'));var logger=require(_0x11d9('0x13'))('api');var utils=require(_0x11d9('0x14'));var config=require(_0x11d9('0x15'));var licenseUtil=require(_0x11d9('0x16'));var db=require(_0x11d9('0x17'))['db'];config['redis']=_['defaults'](config[_0x11d9('0x18')],{'host':_0x11d9('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11d9('0x18')]));require(_0x11d9('0x1a'))[_0x11d9('0x1b')](socket);var jayson=require(_0x11d9('0x1c'));var client=jayson[_0x11d9('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x11d9('0x1d')][_0x11d9('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x442e58,_0x3c894f,_0x4d9ac6,_0x5a78b3){return new BPromise(function(_0x1b6a8e,_0x520a18){var _0x48c812=_0x5a78b3||client;return _0x48c812[_0x11d9('0x1f')](_0x442e58,_0x4d9ac6)[_0x11d9('0x20')](function(_0x4be5d4){logger[_0x11d9('0x21')](_0x11d9('0x22'),_0x3c894f,'request\x20sent');logger['debug'](_0x11d9('0x23'),_0x3c894f,_0x11d9('0x24'),JSON[_0x11d9('0x25')](_0x4be5d4));if(_0x4be5d4[_0x11d9('0x26')]){if(_0x4be5d4[_0x11d9('0x26')][_0x11d9('0x27')]===0x1f4){logger['error'](_0x11d9('0x22'),_0x3c894f,_0x4be5d4[_0x11d9('0x26')][_0x11d9('0x28')]);return _0x520a18(_0x4be5d4[_0x11d9('0x26')][_0x11d9('0x28')]);}logger[_0x11d9('0x26')]('ChatMessage,\x20%s,\x20%s',_0x3c894f,_0x4be5d4[_0x11d9('0x26')][_0x11d9('0x28')]);return _0x1b6a8e(_0x4be5d4['error'][_0x11d9('0x28')]);}else{logger[_0x11d9('0x21')](_0x11d9('0x22'),_0x3c894f,_0x11d9('0x24'));_0x1b6a8e(_0x4be5d4[_0x11d9('0x29')]['message']);}})[_0x11d9('0x2a')](function(_0x34574b){logger[_0x11d9('0x26')](_0x11d9('0x22'),_0x3c894f,_0x34574b);_0x520a18(_0x34574b);});});}function respondWithStatusCode(_0x56983a,_0x33582c){_0x33582c=_0x33582c||0xcc;return function(_0x56c201){if(_0x56c201){return _0x56983a[_0x11d9('0x2b')](_0x33582c);}return _0x56983a['status'](_0x33582c)[_0x11d9('0x2c')]();};}function respondWithResult(_0x3605b9,_0xea69f5){_0xea69f5=_0xea69f5||0xc8;return function(_0xa4c6eb){if(_0xa4c6eb){return _0x3605b9[_0x11d9('0x2d')](_0xea69f5)['json'](_0xa4c6eb);}};}function respondWithFilteredResult(_0x3ca861,_0x2c91eb){return function(_0x184af5){if(_0x184af5){var _0x2f9e78=typeof _0x2c91eb[_0x11d9('0x2e')]===_0x11d9('0x2f')&&typeof _0x2c91eb[_0x11d9('0x30')]===_0x11d9('0x2f');var _0xa2964f=_0x184af5['count'];var _0xbaf19c=_0x2f9e78?0x0:_0x2c91eb['offset'];var _0x113ab5=_0x2f9e78?_0x184af5[_0x11d9('0x31')]:_0x2c91eb[_0x11d9('0x2e')]+_0x2c91eb[_0x11d9('0x30')];var _0x45ce08;if(_0x113ab5>=_0xa2964f){_0x113ab5=_0xa2964f;_0x45ce08=0xc8;}else{_0x45ce08=0xce;}_0x3ca861[_0x11d9('0x2d')](_0x45ce08);return _0x3ca861[_0x11d9('0x32')](_0x11d9('0x33'),_0xbaf19c+'-'+_0x113ab5+'/'+_0xa2964f)[_0x11d9('0x34')](_0x184af5);}return null;};}function patchUpdates(_0x22a648){return function(_0x2c9075){try{jsonpatch[_0x11d9('0x35')](_0x2c9075,_0x22a648,!![]);}catch(_0x47dad4){return BPromise[_0x11d9('0x36')](_0x47dad4);}return _0x2c9075[_0x11d9('0x37')]();};}function saveUpdates(_0x2df2b4,_0x3f5afa){return function(_0xc06e28){if(_0xc06e28){return _0xc06e28['update'](_0x2df2b4)['then'](function(_0x24dd89){return _0x24dd89;});}return null;};}function removeEntity(_0x2b5271,_0x224200){return function(_0x2ab8ba){if(_0x2ab8ba){return _0x2ab8ba[_0x11d9('0x38')]()[_0x11d9('0x20')](function(){_0x2b5271['status'](0xcc)[_0x11d9('0x2c')]();});}};}function handleEntityNotFound(_0x48f746,_0x4b1ede){return function(_0x23ac64){if(!_0x23ac64){_0x48f746[_0x11d9('0x2b')](0x194);}return _0x23ac64;};}function handleError(_0x1b6569,_0x5805ec){_0x5805ec=_0x5805ec||0x1f4;return function(_0x50b6d6){logger['error'](_0x50b6d6[_0x11d9('0x39')]);if(_0x50b6d6['name']){delete _0x50b6d6[_0x11d9('0x3a')];}_0x1b6569[_0x11d9('0x2d')](_0x5805ec)['send'](_0x50b6d6);};}exports['index']=function(_0x4eb034,_0x2078f2){var _0x1e3530={},_0x16b4d3={},_0x2faee7={'count':0x0,'rows':[]};var _0x51c02c=_['map'](db[_0x11d9('0x3b')][_0x11d9('0x3c')],function(_0x3d08cc){return{'name':_0x3d08cc[_0x11d9('0x3d')],'type':_0x3d08cc[_0x11d9('0x3e')][_0x11d9('0x3f')]};});_0x16b4d3[_0x11d9('0x40')]=_[_0x11d9('0x41')](_0x51c02c,_0x11d9('0x3a'));_0x16b4d3[_0x11d9('0x42')]=_[_0x11d9('0x43')](_0x4eb034[_0x11d9('0x42')]);_0x16b4d3[_0x11d9('0x44')]=_[_0x11d9('0x45')](_0x16b4d3[_0x11d9('0x40')],_0x16b4d3[_0x11d9('0x42')]);_0x1e3530['attributes']=_['intersection'](_0x16b4d3[_0x11d9('0x40')],qs[_0x11d9('0x46')](_0x4eb034['query']['fields']));_0x1e3530[_0x11d9('0x47')]=_0x1e3530[_0x11d9('0x47')][_0x11d9('0x48')]?_0x1e3530[_0x11d9('0x47')]:_0x16b4d3[_0x11d9('0x40')];if(!_0x4eb034[_0x11d9('0x42')][_0x11d9('0x49')]('nolimit')){_0x1e3530['limit']=qs[_0x11d9('0x30')](_0x4eb034[_0x11d9('0x42')][_0x11d9('0x30')]);_0x1e3530['offset']=qs[_0x11d9('0x2e')](_0x4eb034[_0x11d9('0x42')][_0x11d9('0x2e')]);}_0x1e3530[_0x11d9('0x4a')]=qs[_0x11d9('0x4b')](_0x4eb034[_0x11d9('0x42')][_0x11d9('0x4b')]);_0x1e3530[_0x11d9('0x4c')]=qs[_0x11d9('0x44')](_[_0x11d9('0x4d')](_0x4eb034[_0x11d9('0x42')],_0x16b4d3['filters']),_0x51c02c);if(_0x4eb034[_0x11d9('0x42')][_0x11d9('0x4e')]){_0x1e3530[_0x11d9('0x4c')]=_[_0x11d9('0x4f')](_0x1e3530['where'],{'$or':_[_0x11d9('0x41')](_0x51c02c,function(_0x5b3edd){if(_0x5b3edd[_0x11d9('0x3e')]!=='VIRTUAL'){var _0x3d1251={};_0x3d1251[_0x5b3edd[_0x11d9('0x3a')]]={'$like':'%'+_0x4eb034[_0x11d9('0x42')]['filter']+'%'};return _0x3d1251;}})});}_0x1e3530=_[_0x11d9('0x4f')]({},_0x1e3530,_0x4eb034['options']);var _0x22feeb={'where':_0x1e3530['where']};return db[_0x11d9('0x3b')]['count'](_0x22feeb)[_0x11d9('0x20')](function(_0x347220){_0x2faee7[_0x11d9('0x31')]=_0x347220;if(_0x4eb034[_0x11d9('0x42')][_0x11d9('0x50')]){_0x1e3530['include']=[{'all':!![]}];}return db[_0x11d9('0x3b')][_0x11d9('0x51')](_0x1e3530);})['then'](function(_0x575d35){_0x2faee7[_0x11d9('0x52')]=_0x575d35;return _0x2faee7;})[_0x11d9('0x20')](respondWithFilteredResult(_0x2078f2,_0x1e3530))[_0x11d9('0x2a')](handleError(_0x2078f2,null));};exports[_0x11d9('0x53')]=function(_0x200150,_0x4ba97d){var _0x16c16b={'raw':!![],'where':{'id':_0x200150[_0x11d9('0x54')]['id']}},_0x238d8e={};_0x238d8e['model']=_[_0x11d9('0x43')](db[_0x11d9('0x3b')][_0x11d9('0x3c')]);_0x238d8e[_0x11d9('0x42')]=_[_0x11d9('0x43')](_0x200150[_0x11d9('0x42')]);_0x238d8e[_0x11d9('0x44')]=_[_0x11d9('0x45')](_0x238d8e['model'],_0x238d8e[_0x11d9('0x42')]);_0x16c16b[_0x11d9('0x47')]=_['intersection'](_0x238d8e[_0x11d9('0x40')],qs[_0x11d9('0x46')](_0x200150[_0x11d9('0x42')]['fields']));_0x16c16b[_0x11d9('0x47')]=_0x16c16b['attributes'][_0x11d9('0x48')]?_0x16c16b[_0x11d9('0x47')]:_0x238d8e[_0x11d9('0x40')];if(_0x200150[_0x11d9('0x42')]['includeAll']){_0x16c16b[_0x11d9('0x55')]=[{'all':!![]}];}_0x16c16b=_[_0x11d9('0x4f')]({},_0x16c16b,_0x200150[_0x11d9('0x56')]);return db['ChatMessage']['find'](_0x16c16b)[_0x11d9('0x20')](handleEntityNotFound(_0x4ba97d,null))[_0x11d9('0x20')](respondWithResult(_0x4ba97d,null))[_0x11d9('0x2a')](handleError(_0x4ba97d,null));};exports[_0x11d9('0x57')]=function(_0x3fc8a0,_0x2ae98d){return db[_0x11d9('0x3b')][_0x11d9('0x57')](_0x3fc8a0['body'],{})[_0x11d9('0x20')](respondWithResult(_0x2ae98d,0xc9))[_0x11d9('0x2a')](handleError(_0x2ae98d,null));};exports['update']=function(_0x31023d,_0xb8438c){if(_0x31023d[_0x11d9('0x58')]['id']){delete _0x31023d[_0x11d9('0x58')]['id'];}return db[_0x11d9('0x3b')][_0x11d9('0x59')]({'where':{'id':_0x31023d[_0x11d9('0x54')]['id']}})[_0x11d9('0x20')](handleEntityNotFound(_0xb8438c,null))['then'](saveUpdates(_0x31023d[_0x11d9('0x58')],null))[_0x11d9('0x20')](respondWithResult(_0xb8438c,null))[_0x11d9('0x2a')](handleError(_0xb8438c,null));};exports['destroy']=function(_0x49daa0,_0x3040e3){return db['ChatMessage'][_0x11d9('0x59')]({'where':{'id':_0x49daa0[_0x11d9('0x54')]['id']}})[_0x11d9('0x20')](handleEntityNotFound(_0x3040e3,null))['then'](removeEntity(_0x3040e3,null))['catch'](handleError(_0x3040e3,null));};exports[_0x11d9('0x5a')]=function(_0x3c0b95,_0x393c04){return db[_0x11d9('0x3b')][_0x11d9('0x5a')]()[_0x11d9('0x20')](respondWithResult(_0x393c04,null))['catch'](handleError(_0x393c04,null));};var interaction_log=require(_0x11d9('0x13'))('chat-interactions');exports[_0x11d9('0x5b')]=function(_0x17bc44,_0x21478a,_0x5d24f9){var _0x16f60c={'agent':{},'channel':_0x11d9('0x5c')};if(_0x17bc44[_0x11d9('0x58')]['id']){delete _0x17bc44[_0x11d9('0x58')]['id'];}_0x17bc44['body']['read']=!![];_0x17bc44['body'][_0x11d9('0x5d')]=moment()[_0x11d9('0x5e')](_0x11d9('0x5f'));_0x17bc44['body'][_0x11d9('0x60')]=_0x17bc44[_0x11d9('0x58')]['UserId']||_0x17bc44[_0x11d9('0x61')]['id'];_0x16f60c['agent']['id']=_0x17bc44[_0x11d9('0x58')]['UserId'];return db['ChatMessage'][_0x11d9('0x59')]({'where':{'id':_0x17bc44[_0x11d9('0x54')]['id'],'UserId':null}})[_0x11d9('0x20')](handleEntityNotFound(_0x21478a,null))[_0x11d9('0x20')](saveUpdates(_0x17bc44[_0x11d9('0x58')],null))[_0x11d9('0x20')](function(_0x5c56cd){if(_0x5c56cd){_0x16f60c[_0x11d9('0x28')]=_0x5c56cd[_0x11d9('0x62')]({'plain':!![]});return db['ChatInteraction'][_0x11d9('0x59')]({'where':{'id':_0x5c56cd['ChatInteractionId']}});}return null;})[_0x11d9('0x20')](handleEntityNotFound(_0x21478a,null))[_0x11d9('0x20')](function(_0x1fffb9){if(_0x1fffb9){return _0x1fffb9['update']({'UserId':_0x17bc44[_0x11d9('0x58')][_0x11d9('0x60')],'read1stAt':_[_0x11d9('0x63')](_0x1fffb9[_0x11d9('0x64')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x11d9('0x20')](function(_0x9e4fa){if(_0x9e4fa){_0x16f60c[_0x11d9('0x65')]=_0x9e4fa['get']({'plain':!![]});interaction_log[_0x11d9('0x21')](_0x11d9('0x66'),_0x17bc44[_0x11d9('0x61')]['id'],_0x17bc44[_0x11d9('0x61')][_0x11d9('0x3a')],_0x17bc44[_0x11d9('0x61')][_0x11d9('0x67')],_0x16f60c[_0x11d9('0x65')]['id'],_0x17bc44['body']?JSON['stringify'](_0x17bc44[_0x11d9('0x58')]):_0x11d9('0x68'));return respondWithRpcPromise(_0x11d9('0x69'),_0x11d9('0x6a'),_0x16f60c);}return null;})[_0x11d9('0x20')](function(_0x1f41ff){var _0x4cf098=_0x11d9('0x6b')+_0x1f41ff[_0x11d9('0x28')][_0x11d9('0x6c')];return db['sequelize'][_0x11d9('0x42')](_0x4cf098,{'type':db[_0x11d9('0x6d')]['QueryTypes'][_0x11d9('0x6e')],'raw':!![]})[_0x11d9('0x20')](function(_0x19f910){return _0x19f910;});})[_0x11d9('0x20')](function(_0x309eb4){if(_0x309eb4){_0x16f60c[_0x11d9('0x28')][_0x11d9('0x6f')]=_0x309eb4[0x0];if(!_0x17bc44['body'][_0x11d9('0x60')])return;return db[_0x11d9('0x70')][_0x11d9('0x59')]({'where':{'id':_0x17bc44[_0x11d9('0x58')][_0x11d9('0x60')],'role':'agent'},'attributes':['id',_0x11d9('0x3a'),_0x11d9('0x71'),_0x11d9('0x72'),_0x11d9('0x73')],'raw':!![]});}return null;})[_0x11d9('0x20')](function(_0x338b44){if(!_0x338b44)return null;_0x16f60c[_0x11d9('0x28')]['agent']=_0x338b44;return _0x16f60c;})[_0x11d9('0x20')](function(_0xa0542){if(_0xa0542){if(_0x17bc44[_0x11d9('0x58')]['manual']){_0x16f60c[_0x11d9('0x28')]['interface']=util['format'](_0x11d9('0x74'),_0x17bc44[_0x11d9('0x61')][_0x11d9('0x3a')]);_0x16f60c[_0x11d9('0x28')][_0x11d9('0x75')]=_0x16f60c[_0x11d9('0x75')];_0x16f60c[_0x11d9('0x28')]['motionChannel']=_0x16f60c[_0x11d9('0x75')];_0x16f60c[_0x11d9('0x28')][_0x11d9('0x76')]=_0x11d9('0x5b');return respondWithRpcPromise(_0x11d9('0x77'),'EventManager',{'event':_0x11d9('0x78'),'message':_[_0x11d9('0x4f')](_0x16f60c[_0x11d9('0x28')],JSON['parse'](_0x16f60c[_0x11d9('0x65')]['formData']))},client9002)['then'](function(){return _0x16f60c;});}return _0x16f60c;}return null;})['then'](respondWithResult(_0x21478a,null))['catch'](handleError(_0x21478a,null));};var interaction_log=require(_0x11d9('0x13'))(_0x11d9('0x79'));exports[_0x11d9('0x36')]=function(_0x27eb6f,_0x2f0c68,_0xa89674){var _0x50d61d={'agent':{},'channel':_0x11d9('0x5c')};if(_0x27eb6f[_0x11d9('0x58')]['id']){delete _0x27eb6f[_0x11d9('0x58')]['id'];}_0x27eb6f[_0x11d9('0x58')][_0x11d9('0x60')]=_0x27eb6f[_0x11d9('0x58')][_0x11d9('0x60')]||_0x27eb6f[_0x11d9('0x61')]['id'];_0x50d61d['agent']['id']=_0x27eb6f['body'][_0x11d9('0x60')];return db[_0x11d9('0x3b')]['find']({'where':{'id':_0x27eb6f[_0x11d9('0x54')]['id'],'UserId':null}})[_0x11d9('0x20')](handleEntityNotFound(_0x2f0c68,null))[_0x11d9('0x20')](function(_0x8aada2){if(_0x8aada2){_0x50d61d[_0x11d9('0x28')]=_0x8aada2[_0x11d9('0x62')]({'plain':!![]});return db[_0x11d9('0x7a')][_0x11d9('0x59')]({'where':{'id':_0x8aada2[_0x11d9('0x7b')]}});}return null;})[_0x11d9('0x20')](handleEntityNotFound(_0x2f0c68,null))[_0x11d9('0x20')](function(_0x1ddf95){if(_0x1ddf95){_0x50d61d[_0x11d9('0x65')]=_0x1ddf95['get']({'plain':!![]});interaction_log[_0x11d9('0x21')](_0x11d9('0x7c'),_0x27eb6f[_0x11d9('0x61')]['id'],_0x27eb6f[_0x11d9('0x61')]['name'],_0x27eb6f[_0x11d9('0x61')][_0x11d9('0x67')],_0x50d61d['interaction']['id'],_0x27eb6f[_0x11d9('0x58')]?JSON[_0x11d9('0x25')](_0x27eb6f[_0x11d9('0x58')]):'null');return respondWithRpcPromise('RejectMessage','rejectMessage',_0x50d61d);}return null;})[_0x11d9('0x20')](function(_0x53693c){var _0x361068=_0x11d9('0x6b')+_0x53693c['message'][_0x11d9('0x6c')];return db[_0x11d9('0x7d')][_0x11d9('0x42')](_0x361068,{'type':db['Sequelize'][_0x11d9('0x7e')][_0x11d9('0x6e')],'raw':!![]})['then'](function(_0x499633){return _0x499633;});})[_0x11d9('0x20')](function(_0x3b2d61){if(_0x3b2d61){_0x50d61d[_0x11d9('0x28')][_0x11d9('0x6f')]=_0x3b2d61[0x0];if(!_0x27eb6f[_0x11d9('0x58')]['UserId'])return;return db[_0x11d9('0x70')][_0x11d9('0x59')]({'where':{'id':_0x27eb6f[_0x11d9('0x58')][_0x11d9('0x60')],'role':_0x11d9('0x7f')},'attributes':['id','name','fullname',_0x11d9('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x23bedb){if(!_0x23bedb)return null;_0x50d61d[_0x11d9('0x28')][_0x11d9('0x7f')]=_0x23bedb;return _0x50d61d;})[_0x11d9('0x20')](function(_0x548cba){if(_0x548cba){_0x548cba[_0x11d9('0x28')]['interface']=util[_0x11d9('0x5e')](_0x11d9('0x74'),_0x27eb6f[_0x11d9('0x61')]['name']);_0x548cba[_0x11d9('0x28')][_0x11d9('0x75')]=_0x50d61d[_0x11d9('0x75')];_0x548cba[_0x11d9('0x28')][_0x11d9('0x80')]=_0x50d61d[_0x11d9('0x75')];_0x548cba[_0x11d9('0x28')]['event']=_0x11d9('0x36');respondWithRpcPromise(_0x11d9('0x77'),_0x11d9('0x77'),{'event':_0x11d9('0x81'),'message':_[_0x11d9('0x4f')](_0x50d61d[_0x11d9('0x28')],JSON[_0x11d9('0x82')](_0x50d61d[_0x11d9('0x65')][_0x11d9('0x83')]))},client9002);return _0x50d61d;}return null;})[_0x11d9('0x20')](respondWithResult(_0x2f0c68,null))['catch'](handleError(_0x2f0c68,null));};
\ No newline at end of file
+var _0xc9d8=['filters','pick','filter','VIRTUAL','includeAll','findAll','rows','show','params','rawAttributes','keys','include','merge','options','create','body','find','chat-interactions','chat','read','readAt','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','accept','EventManager','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','ContactId','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','map','ChatMessage','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4877ab,_0x22d949){var _0x36b940=function(_0x3f7d8c){while(--_0x3f7d8c){_0x4877ab['push'](_0x4877ab['shift']());}};_0x36b940(++_0x22d949);}(_0xc9d8,0xc2));var _0x8c9d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc9d8[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8c9d('0x0'));var rimraf=require(_0x8c9d('0x1'));var zipdir=require(_0x8c9d('0x2'));var jsonpatch=require(_0x8c9d('0x3'));var rp=require('request-promise');var moment=require(_0x8c9d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8c9d('0x5'));var path=require(_0x8c9d('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8c9d('0x7'));var fs=require('fs');var fs_extra=require(_0x8c9d('0x8'));var _=require(_0x8c9d('0x9'));var squel=require(_0x8c9d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8c9d('0xb'));var toCsv=require(_0x8c9d('0xc'));var querystring=require(_0x8c9d('0xd'));var Papa=require(_0x8c9d('0xe'));var Redis=require(_0x8c9d('0xf'));var authService=require(_0x8c9d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8c9d('0x11'));var hardwareService=require(_0x8c9d('0x12'));var logger=require(_0x8c9d('0x13'))('api');var utils=require(_0x8c9d('0x14'));var config=require(_0x8c9d('0x15'));var licenseUtil=require(_0x8c9d('0x16'));var db=require('../../mysqldb')['db'];config[_0x8c9d('0x17')]=_[_0x8c9d('0x18')](config[_0x8c9d('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x8c9d('0x19'))(new Redis(config[_0x8c9d('0x17')]));require(_0x8c9d('0x1a'))[_0x8c9d('0x1b')](socket);var jayson=require(_0x8c9d('0x1c'));var client=jayson[_0x8c9d('0x1d')][_0x8c9d('0x1e')]({'port':0x232c});var client9002=jayson[_0x8c9d('0x1d')][_0x8c9d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0xe47db,_0x107bd6,_0x288fef,_0x398000){return new BPromise(function(_0x3b6315,_0x44256e){var _0x3ecfff=_0x398000||client;return _0x3ecfff[_0x8c9d('0x1f')](_0xe47db,_0x288fef)[_0x8c9d('0x20')](function(_0x55d9c4){logger[_0x8c9d('0x21')](_0x8c9d('0x22'),_0x107bd6,_0x8c9d('0x23'));logger['debug'](_0x8c9d('0x24'),_0x107bd6,'request\x20sent',JSON['stringify'](_0x55d9c4));if(_0x55d9c4[_0x8c9d('0x25')]){if(_0x55d9c4[_0x8c9d('0x25')][_0x8c9d('0x26')]===0x1f4){logger[_0x8c9d('0x25')](_0x8c9d('0x22'),_0x107bd6,_0x55d9c4[_0x8c9d('0x25')][_0x8c9d('0x27')]);return _0x44256e(_0x55d9c4[_0x8c9d('0x25')]['message']);}logger[_0x8c9d('0x25')](_0x8c9d('0x22'),_0x107bd6,_0x55d9c4[_0x8c9d('0x25')]['message']);return _0x3b6315(_0x55d9c4['error'][_0x8c9d('0x27')]);}else{logger[_0x8c9d('0x21')](_0x8c9d('0x22'),_0x107bd6,_0x8c9d('0x23'));_0x3b6315(_0x55d9c4[_0x8c9d('0x28')][_0x8c9d('0x27')]);}})[_0x8c9d('0x29')](function(_0x1d8731){logger[_0x8c9d('0x25')]('ChatMessage,\x20%s,\x20%s',_0x107bd6,_0x1d8731);_0x44256e(_0x1d8731);});});}function respondWithStatusCode(_0x3c4d04,_0x666602){_0x666602=_0x666602||0xcc;return function(_0x145cd2){if(_0x145cd2){return _0x3c4d04[_0x8c9d('0x2a')](_0x666602);}return _0x3c4d04[_0x8c9d('0x2b')](_0x666602)[_0x8c9d('0x2c')]();};}function respondWithResult(_0x45d91c,_0x485933){_0x485933=_0x485933||0xc8;return function(_0x12e297){if(_0x12e297){return _0x45d91c[_0x8c9d('0x2b')](_0x485933)[_0x8c9d('0x2d')](_0x12e297);}};}function respondWithFilteredResult(_0x5e220f,_0x55b457){return function(_0x167519){if(_0x167519){var _0x126217=typeof _0x55b457['offset']===_0x8c9d('0x2e')&&typeof _0x55b457[_0x8c9d('0x2f')]===_0x8c9d('0x2e');var _0x516811=_0x167519[_0x8c9d('0x30')];var _0x458669=_0x126217?0x0:_0x55b457[_0x8c9d('0x31')];var _0x247871=_0x126217?_0x167519[_0x8c9d('0x30')]:_0x55b457[_0x8c9d('0x31')]+_0x55b457[_0x8c9d('0x2f')];var _0x13b2ad;if(_0x247871>=_0x516811){_0x247871=_0x516811;_0x13b2ad=0xc8;}else{_0x13b2ad=0xce;}_0x5e220f[_0x8c9d('0x2b')](_0x13b2ad);return _0x5e220f[_0x8c9d('0x32')](_0x8c9d('0x33'),_0x458669+'-'+_0x247871+'/'+_0x516811)[_0x8c9d('0x2d')](_0x167519);}return null;};}function patchUpdates(_0x161a39){return function(_0x19d1f3){try{jsonpatch[_0x8c9d('0x34')](_0x19d1f3,_0x161a39,!![]);}catch(_0x29f6b6){return BPromise[_0x8c9d('0x35')](_0x29f6b6);}return _0x19d1f3[_0x8c9d('0x36')]();};}function saveUpdates(_0x10297d,_0x4507c7){return function(_0x12b136){if(_0x12b136){return _0x12b136[_0x8c9d('0x37')](_0x10297d)[_0x8c9d('0x20')](function(_0x18c6e8){return _0x18c6e8;});}return null;};}function removeEntity(_0x58a889,_0x16aeb0){return function(_0x48ee4c){if(_0x48ee4c){return _0x48ee4c[_0x8c9d('0x38')]()['then'](function(){_0x58a889[_0x8c9d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x237722,_0x4e81c2){return function(_0x133884){if(!_0x133884){_0x237722[_0x8c9d('0x2a')](0x194);}return _0x133884;};}function handleError(_0x2a970e,_0x375632){_0x375632=_0x375632||0x1f4;return function(_0x15a4c5){logger[_0x8c9d('0x25')](_0x15a4c5[_0x8c9d('0x39')]);if(_0x15a4c5[_0x8c9d('0x3a')]){delete _0x15a4c5[_0x8c9d('0x3a')];}_0x2a970e[_0x8c9d('0x2b')](_0x375632)['send'](_0x15a4c5);};}exports['index']=function(_0x5e3cae,_0x5767dd){var _0x1df5ba={},_0x503853={},_0x3e671c={'count':0x0,'rows':[]};var _0x3dc755=_[_0x8c9d('0x3b')](db[_0x8c9d('0x3c')]['rawAttributes'],function(_0x109fc7){return{'name':_0x109fc7['fieldName'],'type':_0x109fc7[_0x8c9d('0x3d')][_0x8c9d('0x3e')]};});_0x503853[_0x8c9d('0x3f')]=_[_0x8c9d('0x3b')](_0x3dc755,'name');_0x503853[_0x8c9d('0x40')]=_['keys'](_0x5e3cae[_0x8c9d('0x40')]);_0x503853['filters']=_[_0x8c9d('0x41')](_0x503853[_0x8c9d('0x3f')],_0x503853['query']);_0x1df5ba[_0x8c9d('0x42')]=_[_0x8c9d('0x41')](_0x503853[_0x8c9d('0x3f')],qs[_0x8c9d('0x43')](_0x5e3cae[_0x8c9d('0x40')]['fields']));_0x1df5ba[_0x8c9d('0x42')]=_0x1df5ba[_0x8c9d('0x42')][_0x8c9d('0x44')]?_0x1df5ba['attributes']:_0x503853['model'];if(!_0x5e3cae[_0x8c9d('0x40')][_0x8c9d('0x45')](_0x8c9d('0x46'))){_0x1df5ba['limit']=qs[_0x8c9d('0x2f')](_0x5e3cae[_0x8c9d('0x40')]['limit']);_0x1df5ba['offset']=qs[_0x8c9d('0x31')](_0x5e3cae['query'][_0x8c9d('0x31')]);}_0x1df5ba[_0x8c9d('0x47')]=qs[_0x8c9d('0x48')](_0x5e3cae[_0x8c9d('0x40')]['sort']);_0x1df5ba[_0x8c9d('0x49')]=qs[_0x8c9d('0x4a')](_[_0x8c9d('0x4b')](_0x5e3cae[_0x8c9d('0x40')],_0x503853['filters']),_0x3dc755);if(_0x5e3cae[_0x8c9d('0x40')][_0x8c9d('0x4c')]){_0x1df5ba[_0x8c9d('0x49')]=_['merge'](_0x1df5ba['where'],{'$or':_[_0x8c9d('0x3b')](_0x3dc755,function(_0x245dd4){if(_0x245dd4[_0x8c9d('0x3d')]!==_0x8c9d('0x4d')){var _0x4624c4={};_0x4624c4[_0x245dd4[_0x8c9d('0x3a')]]={'$like':'%'+_0x5e3cae['query'][_0x8c9d('0x4c')]+'%'};return _0x4624c4;}})});}_0x1df5ba=_['merge']({},_0x1df5ba,_0x5e3cae['options']);var _0xfa89b8={'where':_0x1df5ba[_0x8c9d('0x49')]};return db[_0x8c9d('0x3c')][_0x8c9d('0x30')](_0xfa89b8)[_0x8c9d('0x20')](function(_0x108ebc){_0x3e671c['count']=_0x108ebc;if(_0x5e3cae[_0x8c9d('0x40')][_0x8c9d('0x4e')]){_0x1df5ba['include']=[{'all':!![]}];}return db[_0x8c9d('0x3c')][_0x8c9d('0x4f')](_0x1df5ba);})['then'](function(_0xf65f1c){_0x3e671c[_0x8c9d('0x50')]=_0xf65f1c;return _0x3e671c;})[_0x8c9d('0x20')](respondWithFilteredResult(_0x5767dd,_0x1df5ba))['catch'](handleError(_0x5767dd,null));};exports[_0x8c9d('0x51')]=function(_0x436a33,_0x5ee1c2){var _0x435dff={'raw':!![],'where':{'id':_0x436a33[_0x8c9d('0x52')]['id']}},_0x18bc27={};_0x18bc27[_0x8c9d('0x3f')]=_['keys'](db[_0x8c9d('0x3c')][_0x8c9d('0x53')]);_0x18bc27[_0x8c9d('0x40')]=_[_0x8c9d('0x54')](_0x436a33[_0x8c9d('0x40')]);_0x18bc27['filters']=_[_0x8c9d('0x41')](_0x18bc27[_0x8c9d('0x3f')],_0x18bc27[_0x8c9d('0x40')]);_0x435dff[_0x8c9d('0x42')]=_[_0x8c9d('0x41')](_0x18bc27[_0x8c9d('0x3f')],qs[_0x8c9d('0x43')](_0x436a33[_0x8c9d('0x40')]['fields']));_0x435dff['attributes']=_0x435dff[_0x8c9d('0x42')][_0x8c9d('0x44')]?_0x435dff['attributes']:_0x18bc27['model'];if(_0x436a33['query'][_0x8c9d('0x4e')]){_0x435dff[_0x8c9d('0x55')]=[{'all':!![]}];}_0x435dff=_[_0x8c9d('0x56')]({},_0x435dff,_0x436a33[_0x8c9d('0x57')]);return db[_0x8c9d('0x3c')]['find'](_0x435dff)[_0x8c9d('0x20')](handleEntityNotFound(_0x5ee1c2,null))[_0x8c9d('0x20')](respondWithResult(_0x5ee1c2,null))['catch'](handleError(_0x5ee1c2,null));};exports[_0x8c9d('0x58')]=function(_0x27e97c,_0x688746){return db[_0x8c9d('0x3c')][_0x8c9d('0x58')](_0x27e97c['body'],{})[_0x8c9d('0x20')](respondWithResult(_0x688746,0xc9))[_0x8c9d('0x29')](handleError(_0x688746,null));};exports[_0x8c9d('0x37')]=function(_0x3075d3,_0x5adb79){if(_0x3075d3[_0x8c9d('0x59')]['id']){delete _0x3075d3[_0x8c9d('0x59')]['id'];}return db[_0x8c9d('0x3c')][_0x8c9d('0x5a')]({'where':{'id':_0x3075d3[_0x8c9d('0x52')]['id']}})[_0x8c9d('0x20')](handleEntityNotFound(_0x5adb79,null))['then'](saveUpdates(_0x3075d3['body'],null))[_0x8c9d('0x20')](respondWithResult(_0x5adb79,null))[_0x8c9d('0x29')](handleError(_0x5adb79,null));};exports[_0x8c9d('0x38')]=function(_0x1b4122,_0x35ab85){return db['ChatMessage'][_0x8c9d('0x5a')]({'where':{'id':_0x1b4122[_0x8c9d('0x52')]['id']}})['then'](handleEntityNotFound(_0x35ab85,null))['then'](removeEntity(_0x35ab85,null))[_0x8c9d('0x29')](handleError(_0x35ab85,null));};exports['describe']=function(_0x16c4e5,_0x4398fa){return db[_0x8c9d('0x3c')]['describe']()[_0x8c9d('0x20')](respondWithResult(_0x4398fa,null))[_0x8c9d('0x29')](handleError(_0x4398fa,null));};var interaction_log=require(_0x8c9d('0x13'))(_0x8c9d('0x5b'));exports['accept']=function(_0x2330c8,_0x1577a9,_0xd80b19){var _0x12144a={'agent':{},'channel':_0x8c9d('0x5c')};if(_0x2330c8[_0x8c9d('0x59')]['id']){delete _0x2330c8[_0x8c9d('0x59')]['id'];}_0x2330c8['body'][_0x8c9d('0x5d')]=!![];_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x5e')]=moment()[_0x8c9d('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x60')]=_0x2330c8[_0x8c9d('0x59')]['UserId']||_0x2330c8[_0x8c9d('0x61')]['id'];_0x12144a[_0x8c9d('0x62')]['id']=_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x60')];return db['ChatMessage']['find']({'where':{'id':_0x2330c8[_0x8c9d('0x52')]['id'],'UserId':null}})[_0x8c9d('0x20')](handleEntityNotFound(_0x1577a9,null))['then'](saveUpdates(_0x2330c8[_0x8c9d('0x59')],null))[_0x8c9d('0x20')](function(_0x414176){if(_0x414176){_0x12144a[_0x8c9d('0x27')]=_0x414176[_0x8c9d('0x63')]({'plain':!![]});return db[_0x8c9d('0x64')][_0x8c9d('0x5a')]({'where':{'id':_0x414176[_0x8c9d('0x65')]}});}return null;})['then'](handleEntityNotFound(_0x1577a9,null))[_0x8c9d('0x20')](function(_0x4dec5d){if(_0x4dec5d){return _0x4dec5d[_0x8c9d('0x37')]({'UserId':_0x2330c8[_0x8c9d('0x59')]['UserId'],'read1stAt':_[_0x8c9d('0x66')](_0x4dec5d[_0x8c9d('0x67')])?moment()[_0x8c9d('0x5f')](_0x8c9d('0x68')):undefined});}return null;})[_0x8c9d('0x20')](function(_0x3a2dfe){if(_0x3a2dfe){_0x12144a['interaction']=_0x3a2dfe[_0x8c9d('0x63')]({'plain':!![]});interaction_log[_0x8c9d('0x21')](_0x8c9d('0x69'),_0x2330c8[_0x8c9d('0x61')]['id'],_0x2330c8[_0x8c9d('0x61')][_0x8c9d('0x3a')],_0x2330c8[_0x8c9d('0x61')][_0x8c9d('0x6a')],_0x12144a[_0x8c9d('0x6b')]['id'],_0x2330c8[_0x8c9d('0x59')]?JSON[_0x8c9d('0x6c')](_0x2330c8[_0x8c9d('0x59')]):'null');return respondWithRpcPromise(_0x8c9d('0x6d'),_0x8c9d('0x6e'),_0x12144a);}return null;})[_0x8c9d('0x20')](function(_0x166706){var _0x1037bc=_0x8c9d('0x6f')+_0x166706['message']['ContactId'];return db[_0x8c9d('0x70')][_0x8c9d('0x40')](_0x1037bc,{'type':db['Sequelize'][_0x8c9d('0x71')][_0x8c9d('0x72')],'raw':!![]})[_0x8c9d('0x20')](function(_0x2e8110){return _0x2e8110;});})[_0x8c9d('0x20')](function(_0x555688){if(_0x555688){_0x12144a[_0x8c9d('0x27')][_0x8c9d('0x73')]=_0x555688[0x0];if(!_0x2330c8['body'][_0x8c9d('0x60')])return;return db[_0x8c9d('0x74')][_0x8c9d('0x5a')]({'where':{'id':_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x60')],'role':_0x8c9d('0x62')},'attributes':['id','name',_0x8c9d('0x75'),_0x8c9d('0x76'),_0x8c9d('0x77')],'raw':!![]});}return null;})[_0x8c9d('0x20')](function(_0xcae539){if(!_0xcae539)return null;_0x12144a['message'][_0x8c9d('0x62')]=_0xcae539;return _0x12144a;})[_0x8c9d('0x20')](function(_0x5923f0){if(_0x5923f0){if(_0x2330c8[_0x8c9d('0x59')][_0x8c9d('0x78')]){_0x12144a['message'][_0x8c9d('0x79')]=util[_0x8c9d('0x5f')](_0x8c9d('0x7a'),_0x2330c8[_0x8c9d('0x61')]['name']);_0x12144a[_0x8c9d('0x27')][_0x8c9d('0x7b')]=_0x12144a['channel'];_0x12144a['message']['motionChannel']=_0x12144a['channel'];_0x12144a[_0x8c9d('0x27')][_0x8c9d('0x7c')]=_0x8c9d('0x7d');return respondWithRpcPromise(_0x8c9d('0x7e'),'EventManager',{'event':'acceptmessage','message':_[_0x8c9d('0x56')](_0x12144a[_0x8c9d('0x27')],JSON[_0x8c9d('0x7f')](_0x12144a[_0x8c9d('0x6b')][_0x8c9d('0x80')]))},client9002)[_0x8c9d('0x20')](function(){return _0x12144a;});}return _0x12144a;}return null;})[_0x8c9d('0x20')](respondWithResult(_0x1577a9,null))[_0x8c9d('0x29')](handleError(_0x1577a9,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0x8c9d('0x35')]=function(_0x5a0330,_0x51ff8b,_0x40a1b4){var _0x54af8f={'agent':{},'channel':'chat'};if(_0x5a0330['body']['id']){delete _0x5a0330[_0x8c9d('0x59')]['id'];}_0x5a0330[_0x8c9d('0x59')][_0x8c9d('0x60')]=_0x5a0330['body']['UserId']||_0x5a0330[_0x8c9d('0x61')]['id'];_0x54af8f[_0x8c9d('0x62')]['id']=_0x5a0330[_0x8c9d('0x59')]['UserId'];return db['ChatMessage'][_0x8c9d('0x5a')]({'where':{'id':_0x5a0330[_0x8c9d('0x52')]['id'],'UserId':null}})[_0x8c9d('0x20')](handleEntityNotFound(_0x51ff8b,null))[_0x8c9d('0x20')](function(_0x4cc6ae){if(_0x4cc6ae){_0x54af8f[_0x8c9d('0x27')]=_0x4cc6ae[_0x8c9d('0x63')]({'plain':!![]});return db[_0x8c9d('0x64')]['find']({'where':{'id':_0x4cc6ae[_0x8c9d('0x65')]}});}return null;})[_0x8c9d('0x20')](handleEntityNotFound(_0x51ff8b,null))[_0x8c9d('0x20')](function(_0x2afd63){if(_0x2afd63){_0x54af8f[_0x8c9d('0x6b')]=_0x2afd63[_0x8c9d('0x63')]({'plain':!![]});interaction_log[_0x8c9d('0x21')](_0x8c9d('0x81'),_0x5a0330[_0x8c9d('0x61')]['id'],_0x5a0330[_0x8c9d('0x61')][_0x8c9d('0x3a')],_0x5a0330[_0x8c9d('0x61')]['role'],_0x54af8f[_0x8c9d('0x6b')]['id'],_0x5a0330[_0x8c9d('0x59')]?JSON['stringify'](_0x5a0330['body']):_0x8c9d('0x82'));return respondWithRpcPromise('RejectMessage',_0x8c9d('0x83'),_0x54af8f);}return null;})[_0x8c9d('0x20')](function(_0x1dbbc8){var _0x25e71e=_0x8c9d('0x6f')+_0x1dbbc8['message'][_0x8c9d('0x84')];return db['sequelize'][_0x8c9d('0x40')](_0x25e71e,{'type':db['Sequelize'][_0x8c9d('0x71')][_0x8c9d('0x72')],'raw':!![]})['then'](function(_0x97c63a){return _0x97c63a;});})[_0x8c9d('0x20')](function(_0x3d23fe){if(_0x3d23fe){_0x54af8f[_0x8c9d('0x27')][_0x8c9d('0x73')]=_0x3d23fe[0x0];if(!_0x5a0330['body'][_0x8c9d('0x60')])return;return db[_0x8c9d('0x74')][_0x8c9d('0x5a')]({'where':{'id':_0x5a0330[_0x8c9d('0x59')][_0x8c9d('0x60')],'role':'agent'},'attributes':['id',_0x8c9d('0x3a'),_0x8c9d('0x75'),_0x8c9d('0x76'),_0x8c9d('0x77')],'raw':!![]});}return null;})[_0x8c9d('0x20')](function(_0x27bccf){if(!_0x27bccf)return null;_0x54af8f[_0x8c9d('0x27')][_0x8c9d('0x62')]=_0x27bccf;return _0x54af8f;})[_0x8c9d('0x20')](function(_0x190309){if(_0x190309){_0x190309[_0x8c9d('0x27')][_0x8c9d('0x79')]=util['format'](_0x8c9d('0x7a'),_0x5a0330[_0x8c9d('0x61')][_0x8c9d('0x3a')]);_0x190309[_0x8c9d('0x27')][_0x8c9d('0x7b')]=_0x54af8f['channel'];_0x190309['message']['motionChannel']=_0x54af8f['channel'];_0x190309['message'][_0x8c9d('0x7c')]=_0x8c9d('0x35');respondWithRpcPromise(_0x8c9d('0x7e'),_0x8c9d('0x7e'),{'event':_0x8c9d('0x85'),'message':_[_0x8c9d('0x56')](_0x54af8f[_0x8c9d('0x27')],JSON[_0x8c9d('0x7f')](_0x54af8f['interaction'][_0x8c9d('0x80')]))},client9002);return _0x54af8f;}return null;})[_0x8c9d('0x20')](respondWithResult(_0x51ff8b,null))[_0x8c9d('0x29')](handleError(_0x51ff8b,null));};
\ No newline at end of file
index 6dc5584..847a72a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x064f=['../../mysqldb','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x49a4b5,_0x420d0c){var _0x343547=function(_0xdd6b78){while(--_0xdd6b78){_0x49a4b5['push'](_0x49a4b5['shift']());}};_0x343547(++_0x420d0c);}(_0x064f,0x130));var _0xf064=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x064f[_0x1589dd];return _0x1bddd1;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xf064('0x0'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf064('0x1')](0x0);var events={'afterCreate':_0xf064('0x2'),'afterUpdate':_0xf064('0x3'),'afterDestroy':_0xf064('0x4')};function emitEvent(_0x31b18f){return function(_0x4df233,_0xe4b348,_0x50da55){ChatMessageEvents[_0xf064('0x5')](_0x31b18f+':'+_0x4df233['id'],_0x4df233);ChatMessageEvents['emit'](_0x31b18f,_0x4df233);_0x50da55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0xf064('0x6')](e,emitEvent(event));}}module[_0xf064('0x7')]=ChatMessageEvents;
\ No newline at end of file
+var _0xdd03=['emit','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','remove'];(function(_0x3a6e4b,_0x118cd9){var _0x36572d=function(_0x2a53cf){while(--_0x2a53cf){_0x3a6e4b['push'](_0x3a6e4b['shift']());}};_0x36572d(++_0x118cd9);}(_0xdd03,0x12a));var _0x3dd0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xdd03[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x3dd0('0x0'))['db'][_0x3dd0('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3dd0('0x2')](0x0);var events={'afterCreate':_0x3dd0('0x3'),'afterUpdate':_0x3dd0('0x4'),'afterDestroy':_0x3dd0('0x5')};function emitEvent(_0x97a444){return function(_0x37c4e8,_0x24706c,_0x2f8292){ChatMessageEvents[_0x3dd0('0x6')](_0x97a444+':'+_0x37c4e8['id'],_0x37c4e8);ChatMessageEvents[_0x3dd0('0x6')](_0x97a444,_0x37c4e8);_0x2f8292(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x3dd0('0x7')]=ChatMessageEvents;
\ No newline at end of file
index a42163e..cec482d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x59a5=['error','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise','path','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','FULLTEXT','models','get','direction','toLowerCase','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','createdAt'];(function(_0x39dc76,_0x5ed412){var _0x14c683=function(_0x3ab25e){while(--_0x3ab25e){_0x39dc76['push'](_0x39dc76['shift']());}};_0x14c683(++_0x5ed412);}(_0x59a5,0x162));var _0x559a=function(_0x2943e3,_0x2510b8){_0x2943e3=_0x2943e3-0x0;var _0x28ad5d=_0x59a5[_0x2943e3];return _0x28ad5d;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x559a('0x0'));var moment=require(_0x559a('0x1'));var BPromise=require(_0x559a('0x2'));var rp=require(_0x559a('0x3'));var fs=require('fs');var path=require(_0x559a('0x4'));var rimraf=require('rimraf');var config=require(_0x559a('0x5'));var attributes=require(_0x559a('0x6'));module[_0x559a('0x7')]=function(_0x4f5be4,_0x4b14ca){return _0x4f5be4[_0x559a('0x8')](_0x559a('0x9'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x559a('0xa'),'fields':['body'],'type':_0x559a('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2d1fed,_0x296608,_0xfedbb3){var _0x389232=_0x4f5be4[_0x559a('0xc')];var _0x3003f5=_0x2d1fed[_0x559a('0xd')]({'plain':!![]});if(_0x3003f5[_0x559a('0xe')]['toLowerCase']()==='in'||_0x3003f5['direction'][_0x559a('0xf')]()==='out'&&!_0x3003f5[_0x559a('0x10')]&&!_['isNil'](_0x3003f5[_0x559a('0x11')])){_0x389232[_0x559a('0x12')][_0x559a('0x13')]({'where':{'id':_0x3003f5[_0x559a('0x14')]}})[_0x559a('0x15')](function(_0x5cf6be){if(_0x5cf6be){_0x5cf6be[_0x559a('0x16')]({'lastMsgAt':_0x3003f5[_0x559a('0x17')],'lastMsgDirection':_0x3003f5['direction'][_0x559a('0xf')]()});}})['catch'](function(_0x3119a1){console[_0x559a('0x18')](_0x3119a1);});}_0xfedbb3();}},'charset':_0x559a('0x19'),'collate':_0x559a('0x1a')});};
\ No newline at end of file
+var _0x1f27=['./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','update','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3424c2,_0x527fda){var _0x493a18=function(_0x2d7197){while(--_0x2d7197){_0x3424c2['push'](_0x3424c2['shift']());}};_0x493a18(++_0x527fda);}(_0x1f27,0x13d));var _0x71f2=function(_0x8c0045,_0x2707d8){_0x8c0045=_0x8c0045-0x0;var _0x3e316e=_0x1f27[_0x8c0045];return _0x3e316e;};'use strict';var _=require(_0x71f2('0x0'));var util=require(_0x71f2('0x1'));var logger=require(_0x71f2('0x2'))(_0x71f2('0x3'));var moment=require(_0x71f2('0x4'));var BPromise=require(_0x71f2('0x5'));var rp=require(_0x71f2('0x6'));var fs=require('fs');var path=require(_0x71f2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x71f2('0x8'));module[_0x71f2('0x9')]=function(_0xd0b66,_0x4411d1){return _0xd0b66['define'](_0x71f2('0xa'),attributes,{'tableName':_0x71f2('0xb'),'paranoid':![],'indexes':[{'name':_0x71f2('0xc'),'fields':[_0x71f2('0xd')],'type':_0x71f2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xef5a0e,_0x3ff522,_0x31a36c){var _0x7c36d2=_0xd0b66['models'];var _0x22923e=_0xef5a0e['get']({'plain':!![]});if(_0x22923e[_0x71f2('0xf')]['toLowerCase']()==='in'||_0x22923e['direction'][_0x71f2('0x10')]()===_0x71f2('0x11')&&!_0x22923e[_0x71f2('0x12')]&&!_[_0x71f2('0x13')](_0x22923e[_0x71f2('0x14')])){_0x7c36d2['ChatInteraction']['findOne']({'where':{'id':_0x22923e['ChatInteractionId']}})['then'](function(_0x1bfc7c){if(_0x1bfc7c){_0x1bfc7c[_0x71f2('0x15')]({'lastMsgAt':_0x22923e['createdAt'],'lastMsgDirection':_0x22923e[_0x71f2('0xf')][_0x71f2('0x10')]()});}})['catch'](function(_0x113215){console[_0x71f2('0x16')](_0x113215);});}_0x31a36c();}},'charset':_0x71f2('0x17'),'collate':_0x71f2('0x18')});};
\ No newline at end of file
index 114ea5e..5196cdb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb73=['body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','defaults','redis','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create'];(function(_0x25758f,_0x53c464){var _0x2bc10c=function(_0x38a232){while(--_0x38a232){_0x25758f['push'](_0x25758f['shift']());}};_0x2bc10c(++_0x53c464);}(_0xfb73,0xbd));var _0x3fb7=function(_0x12a143,_0x4743f3){_0x12a143=_0x12a143-0x0;var _0x3fc33d=_0xfb73[_0x12a143];return _0x3fc33d;};'use strict';var _=require('lodash');var util=require(_0x3fb7('0x0'));var moment=require(_0x3fb7('0x1'));var BPromise=require(_0x3fb7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3fb7('0x3'));var db=require(_0x3fb7('0x4'))['db'];var utils=require(_0x3fb7('0x5'));var logger=require('../../config/logger')(_0x3fb7('0x6'));var config=require('../../config/environment');var jayson=require(_0x3fb7('0x7'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x3fb7('0x8')](config[_0x3fb7('0x9')],{'host':_0x3fb7('0xa'),'port':0x18eb});var socket=require(_0x3fb7('0xb'))(new Redis(config[_0x3fb7('0x9')]));require('./chatMessage.socket')[_0x3fb7('0xc')](socket);function respondWithRpcPromise(_0x4fd0bb,_0x190361,_0x1b3da1){return new BPromise(function(_0x1b060a,_0x5551d6){return client[_0x3fb7('0xd')](_0x4fd0bb,_0x1b3da1)[_0x3fb7('0xe')](function(_0xa3ac76){logger[_0x3fb7('0xf')](_0x3fb7('0x10'),_0x190361,_0x3fb7('0x11'));logger[_0x3fb7('0x12')](_0x3fb7('0x13'),_0x190361,'request\x20sent',JSON[_0x3fb7('0x14')](_0xa3ac76));if(_0xa3ac76[_0x3fb7('0x15')]){if(_0xa3ac76[_0x3fb7('0x15')]['code']===0x1f4){logger[_0x3fb7('0x15')](_0x3fb7('0x10'),_0x190361,_0xa3ac76[_0x3fb7('0x15')]['message']);return _0x5551d6(_0xa3ac76['error'][_0x3fb7('0x16')]);}logger[_0x3fb7('0x15')](_0x3fb7('0x10'),_0x190361,_0xa3ac76['error'][_0x3fb7('0x16')]);return _0x1b060a(_0xa3ac76[_0x3fb7('0x15')][_0x3fb7('0x16')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x190361,_0x3fb7('0x11'));_0x1b060a(_0xa3ac76[_0x3fb7('0x17')]['message']);}})[_0x3fb7('0x18')](function(_0x26d9d2){logger['error'](_0x3fb7('0x10'),_0x190361,_0x26d9d2);_0x5551d6(_0x26d9d2);});});}exports[_0x3fb7('0x19')]=function(_0x2dbc78){var _0xa201b5=this;return new Promise(function(_0x2aab0f,_0x376fb5){return db[_0x3fb7('0x1a')][_0x3fb7('0x1b')](_0x2dbc78[_0x3fb7('0x1c')],{'raw':_0x2dbc78[_0x3fb7('0x1d')]?_0x2dbc78['options'][_0x3fb7('0x1e')]===undefined?!![]:![]:!![]})[_0x3fb7('0xe')](function(_0x1724e4){logger['info'](_0x3fb7('0x19'),_0x2dbc78);logger[_0x3fb7('0x12')](_0x3fb7('0x19'),_0x2dbc78,JSON[_0x3fb7('0x14')](_0x1724e4));_0x2aab0f(_0x1724e4);})[_0x3fb7('0x18')](function(_0x23e13a){logger[_0x3fb7('0x15')](_0x3fb7('0x19'),_0x23e13a[_0x3fb7('0x16')],_0x2dbc78);_0x376fb5(_0xa201b5[_0x3fb7('0x15')](0x1f4,_0x23e13a['message']));});});};
\ No newline at end of file
+var _0xaffe=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateChatMessage','body','options','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xaffe,0x158));var _0xeaff=function(_0x1e871d,_0x50eb6c){_0x1e871d=_0x1e871d-0x0;var _0x45a504=_0xaffe[_0x1e871d];return _0x45a504;};'use strict';var _=require(_0xeaff('0x0'));var util=require(_0xeaff('0x1'));var moment=require(_0xeaff('0x2'));var BPromise=require('bluebird');var rs=require(_0xeaff('0x3'));var fs=require('fs');var Redis=require(_0xeaff('0x4'));var db=require(_0xeaff('0x5'))['db'];var utils=require(_0xeaff('0x6'));var logger=require(_0xeaff('0x7'))(_0xeaff('0x8'));var config=require(_0xeaff('0x9'));var jayson=require(_0xeaff('0xa'));var client=jayson[_0xeaff('0xb')][_0xeaff('0xc')]({'port':0x232a});config[_0xeaff('0xd')]=_[_0xeaff('0xe')](config['redis'],{'host':_0xeaff('0xf'),'port':0x18eb});var socket=require(_0xeaff('0x10'))(new Redis(config[_0xeaff('0xd')]));require('./chatMessage.socket')[_0xeaff('0x11')](socket);function respondWithRpcPromise(_0x37fa2f,_0x15b061,_0xe99b56){return new BPromise(function(_0x4f5710,_0x599853){return client[_0xeaff('0x12')](_0x37fa2f,_0xe99b56)[_0xeaff('0x13')](function(_0x20162b){logger[_0xeaff('0x14')](_0xeaff('0x15'),_0x15b061,_0xeaff('0x16'));logger[_0xeaff('0x17')](_0xeaff('0x18'),_0x15b061,_0xeaff('0x16'),JSON[_0xeaff('0x19')](_0x20162b));if(_0x20162b[_0xeaff('0x1a')]){if(_0x20162b[_0xeaff('0x1a')][_0xeaff('0x1b')]===0x1f4){logger[_0xeaff('0x1a')](_0xeaff('0x15'),_0x15b061,_0x20162b[_0xeaff('0x1a')][_0xeaff('0x1c')]);return _0x599853(_0x20162b[_0xeaff('0x1a')]['message']);}logger['error']('ChatMessage,\x20%s,\x20%s',_0x15b061,_0x20162b[_0xeaff('0x1a')][_0xeaff('0x1c')]);return _0x4f5710(_0x20162b[_0xeaff('0x1a')][_0xeaff('0x1c')]);}else{logger[_0xeaff('0x14')]('ChatMessage,\x20%s,\x20%s',_0x15b061,'request\x20sent');_0x4f5710(_0x20162b[_0xeaff('0x1d')]['message']);}})['catch'](function(_0x7f1d8c){logger[_0xeaff('0x1a')](_0xeaff('0x15'),_0x15b061,_0x7f1d8c);_0x599853(_0x7f1d8c);});});}exports[_0xeaff('0x1e')]=function(_0x31389e){var _0x1ca445=this;return new Promise(function(_0x45cd63,_0x56d705){return db['ChatMessage']['create'](_0x31389e[_0xeaff('0x1f')],{'raw':_0x31389e['options']?_0x31389e[_0xeaff('0x20')][_0xeaff('0x21')]===undefined?!![]:![]:!![]})[_0xeaff('0x13')](function(_0x2cfcab){logger[_0xeaff('0x14')](_0xeaff('0x1e'),_0x31389e);logger[_0xeaff('0x17')](_0xeaff('0x1e'),_0x31389e,JSON[_0xeaff('0x19')](_0x2cfcab));_0x45cd63(_0x2cfcab);})[_0xeaff('0x22')](function(_0x47f440){logger[_0xeaff('0x1a')]('CreateChatMessage',_0x47f440[_0xeaff('0x1c')],_0x31389e);_0x56d705(_0x1ca445[_0xeaff('0x1a')](0x1f4,_0x47f440['message']));});});};
\ No newline at end of file
index 409b4b6..1e78e13 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3645=['emit','removeListener','register','length','save','remove','update'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x3645,0x154));var _0x5364=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0x3645[_0x448f8];return _0xa73126;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x5364('0x0'),_0x5364('0x1'),_0x5364('0x2')];function createListener(_0x28eafb,_0x2d71d7){return function(_0x2f629b){_0x2d71d7[_0x5364('0x3')](_0x28eafb,_0x2f629b);};}function removeListener(_0x5a63bf,_0x334a16){return function(){ChatMessageEvents[_0x5364('0x4')](_0x5a63bf,_0x334a16);};}exports[_0x5364('0x5')]=function(_0x1f9c6b){for(var _0x417c44=0x0,_0x7933a5=events[_0x5364('0x6')];_0x417c44<_0x7933a5;_0x417c44++){var _0x43fb3f=events[_0x417c44];var _0x3c1b21=createListener('chatMessage:'+_0x43fb3f,_0x1f9c6b);ChatMessageEvents['on'](_0x43fb3f,_0x3c1b21);}};
\ No newline at end of file
+var _0xe574=['update','emit','removeListener','register','./chatMessage.events','remove'];(function(_0x515cfe,_0x2d4bfb){var _0x4f91cb=function(_0x53ea7a){while(--_0x53ea7a){_0x515cfe['push'](_0x515cfe['shift']());}};_0x4f91cb(++_0x2d4bfb);}(_0xe574,0x100));var _0x4e57=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe574[_0xfae23b];return _0x200640;};'use strict';var ChatMessageEvents=require(_0x4e57('0x0'));var events=['save',_0x4e57('0x1'),_0x4e57('0x2')];function createListener(_0x3cebb9,_0xc485ee){return function(_0x9153d1){_0xc485ee[_0x4e57('0x3')](_0x3cebb9,_0x9153d1);};}function removeListener(_0x10de04,_0x44569b){return function(){ChatMessageEvents[_0x4e57('0x4')](_0x10de04,_0x44569b);};}exports[_0x4e57('0x5')]=function(_0x436174){for(var _0x2825a9=0x0,_0x588b4e=events['length'];_0x2825a9<_0x588b4e;_0x2825a9++){var _0x12ec74=events[_0x2825a9];var _0x534df1=createListener('chatMessage:'+_0x12ec74,_0x436174);ChatMessageEvents['on'](_0x12ec74,_0x534df1);}};
\ No newline at end of file
index 912782f..6a4f1e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa053=['show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x5adc21,_0x2dff4c){var _0xe745ae=function(_0x295f39){while(--_0x295f39){_0x5adc21['push'](_0x5adc21['shift']());}};_0xe745ae(++_0x2dff4c);}(_0xa053,0xb6));var _0x3a05=function(_0x2d5b94,_0x4bc246){_0x2d5b94=_0x2d5b94-0x0;var _0x2d2c50=_0xa053[_0x2d5b94];return _0x2d2c50;};'use strict';var multer=require(_0x3a05('0x0'));var util=require(_0x3a05('0x1'));var path=require(_0x3a05('0x2'));var timeout=require('connect-timeout');var express=require(_0x3a05('0x3'));var router=express['Router']();var fs_extra=require(_0x3a05('0x4'));var auth=require(_0x3a05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3a05('0x6'));var controller=require(_0x3a05('0x7'));router[_0x3a05('0x8')]('/',auth[_0x3a05('0x9')](),controller[_0x3a05('0xa')]);router[_0x3a05('0x8')](_0x3a05('0xb'),auth['isAuthenticated'](),controller[_0x3a05('0xc')]);router['get'](_0x3a05('0xd'),auth['isAuthenticated'](),controller[_0x3a05('0xe')]);router[_0x3a05('0xf')]('/',auth['isAuthenticated'](),interaction[_0x3a05('0x10')](_0x3a05('0x11'),_0x3a05('0x12')),controller[_0x3a05('0x13')]);router[_0x3a05('0x14')](_0x3a05('0xd'),controller[_0x3a05('0x15')]);router[_0x3a05('0x14')](_0x3a05('0x16'),auth['isAuthenticated'](),controller[_0x3a05('0x17')]);router['put'](_0x3a05('0x18'),auth[_0x3a05('0x9')](),controller['reject']);router[_0x3a05('0x19')](_0x3a05('0xd'),auth[_0x3a05('0x9')](),controller[_0x3a05('0x1a')]);module[_0x3a05('0x1b')]=router;
\ No newline at end of file
+var _0xfe53=['../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','tracked','chat','create','put','/:id/accept','accept','/:id/reject','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14855f,_0x5841d7){var _0x2d61ba=function(_0xa491ab){while(--_0xa491ab){_0x14855f['push'](_0x14855f['shift']());}};_0x2d61ba(++_0x5841d7);}(_0xfe53,0x1a9));var _0x3fe5=function(_0x8d0bf4,_0x1b0290){_0x8d0bf4=_0x8d0bf4-0x0;var _0x3f23eb=_0xfe53[_0x8d0bf4];return _0x3f23eb;};'use strict';var multer=require(_0x3fe5('0x0'));var util=require(_0x3fe5('0x1'));var path=require('path');var timeout=require(_0x3fe5('0x2'));var express=require(_0x3fe5('0x3'));var router=express[_0x3fe5('0x4')]();var fs_extra=require(_0x3fe5('0x5'));var auth=require(_0x3fe5('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3fe5('0x7'));var controller=require(_0x3fe5('0x8'));router[_0x3fe5('0x9')]('/',auth[_0x3fe5('0xa')](),controller['index']);router[_0x3fe5('0x9')](_0x3fe5('0xb'),auth[_0x3fe5('0xa')](),controller[_0x3fe5('0xc')]);router[_0x3fe5('0x9')](_0x3fe5('0xd'),auth[_0x3fe5('0xa')](),controller[_0x3fe5('0xe')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x3fe5('0xf')](_0x3fe5('0x10'),'chatmessage:create'),controller[_0x3fe5('0x11')]);router[_0x3fe5('0x12')](_0x3fe5('0xd'),controller['update']);router[_0x3fe5('0x12')](_0x3fe5('0x13'),auth[_0x3fe5('0xa')](),controller[_0x3fe5('0x14')]);router['put'](_0x3fe5('0x15'),auth[_0x3fe5('0xa')](),controller['reject']);router[_0x3fe5('0x16')](_0x3fe5('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x3fe5('0x17')]=router;
\ No newline at end of file
index c4f52c2..2b3850a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['medium','TEXT','exports'];(function(_0x489a92,_0x33e9a5){var _0x23512c=function(_0x4036e3){while(--_0x4036e3){_0x489a92['push'](_0x489a92['shift']());}};_0x23512c(++_0x33e9a5);}(_0xadb5,0xad));var _0x5adb=function(_0x6ba3be,_0x2f5383){_0x6ba3be=_0x6ba3be-0x0;var _0x110fe5=_0xadb5[_0x6ba3be];return _0x110fe5;};'use strict';var Sequelize=require('sequelize');module[_0x5adb('0x0')]={'body':{'type':Sequelize['TEXT'](_0x5adb('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x5adb('0x2')](_0x5adb('0x1')),'allowNull':![]}};
\ No newline at end of file
+var _0x5f66=['medium','TEXT','exports'];(function(_0x54236b,_0x541ffc){var _0x469b5f=function(_0x4cedfe){while(--_0x4cedfe){_0x54236b['push'](_0x54236b['shift']());}};_0x469b5f(++_0x541ffc);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}};
\ No newline at end of file
index f08e04e..887bc2d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x4640ff,_0x10606d){var _0xd8d941=function(_0x2f2e23){while(--_0x2f2e23){_0x4640ff['push'](_0x4640ff['shift']());}};_0xd8d941(++_0x10606d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));};
\ No newline at end of file
+var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0x7a54,0x106));var _0x47a5=function(_0x4cafea,_0x26b660){_0x4cafea=_0x4cafea-0x0;var _0x22f1cd=_0x7a54[_0x4cafea];return _0x22f1cd;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));};
\ No newline at end of file
index 4dc1281..aab3bee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xafc4=['update','remove','emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage','save'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0xafc4,0x69));var _0x4afc=function(_0x1d5037,_0x24c0e3){_0x1d5037=_0x1d5037-0x0;var _0x2528f3=_0xafc4[_0x1d5037];return _0x2528f3;};'use strict';var EventEmitter=require(_0x4afc('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x4afc('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4afc('0x2'),'afterUpdate':_0x4afc('0x3'),'afterDestroy':_0x4afc('0x4')};function emitEvent(_0x237ea0){return function(_0x4d9dbd,_0x49f417,_0x5378e5){ChatOfflineMessageEvents[_0x4afc('0x5')](_0x237ea0+':'+_0x4d9dbd['id'],_0x4d9dbd);ChatOfflineMessageEvents[_0x4afc('0x5')](_0x237ea0,_0x4d9dbd);_0x5378e5(null);};}for(var e in events){if(events[_0x4afc('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x4afc('0x7')](e,emitEvent(event));}}module[_0x4afc('0x8')]=ChatOfflineMessageEvents;
\ No newline at end of file
+var _0x36c3=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x10969f,_0x11acfc){var _0x202897=function(_0x5b06b1){while(--_0x5b06b1){_0x10969f['push'](_0x10969f['shift']());}};_0x202897(++_0x11acfc);}(_0x36c3,0x1a6));var _0x336c=function(_0x5a184b,_0x457876){_0x5a184b=_0x5a184b-0x0;var _0x713964=_0x36c3[_0x5a184b];return _0x713964;};'use strict';var EventEmitter=require(_0x336c('0x0'));var ChatOfflineMessage=require(_0x336c('0x1'))['db']['ChatOfflineMessage'];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x336c('0x2')](0x0);var events={'afterCreate':_0x336c('0x3'),'afterUpdate':_0x336c('0x4'),'afterDestroy':_0x336c('0x5')};function emitEvent(_0x32aed2){return function(_0x2b1194,_0x39ed12,_0x4e4c07){ChatOfflineMessageEvents[_0x336c('0x6')](_0x32aed2+':'+_0x2b1194['id'],_0x2b1194);ChatOfflineMessageEvents[_0x336c('0x6')](_0x32aed2,_0x2b1194);_0x4e4c07(null);};}for(var e in events){if(events[_0x336c('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x336c('0x8')](e,emitEvent(event));}}module[_0x336c('0x9')]=ChatOfflineMessageEvents;
\ No newline at end of file
index e355187..79709e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb007=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x5a662b,_0x379a0b){var _0x2f287b=function(_0x1ddc89){while(--_0x1ddc89){_0x5a662b['push'](_0x5a662b['shift']());}};_0x2f287b(++_0x379a0b);}(_0xb007,0x191));var _0x7b00=function(_0x202394,_0x14f2d4){_0x202394=_0x202394-0x0;var _0x51939f=_0xb007[_0x202394];return _0x51939f;};'use strict';var attributes=require(_0x7b00('0x0'));module[_0x7b00('0x1')]=function(_0x3b39c5){return _0x3b39c5[_0x7b00('0x2')](_0x7b00('0x3'),attributes,{'tableName':_0x7b00('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7b00('0x5')});};
\ No newline at end of file
+var _0x2496=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x1cac35,_0x32ec7a){var _0x152589=function(_0x47eed8){while(--_0x47eed8){_0x1cac35['push'](_0x1cac35['shift']());}};_0x152589(++_0x32ec7a);}(_0x2496,0x180));var _0x6249=function(_0x5b0d94,_0xe1b0ab){_0x5b0d94=_0x5b0d94-0x0;var _0x2af1e1=_0x2496[_0x5b0d94];return _0x2af1e1;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x6249('0x0')]=function(_0x2ca194){return _0x2ca194[_0x6249('0x1')](_0x6249('0x2'),attributes,{'tableName':_0x6249('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x6249('0x4')});};
\ No newline at end of file
index cf76b20..a3896e6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5057=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0xd4486b,_0x5c0fb7){var _0x387a59=function(_0x2b6277){while(--_0x2b6277){_0xd4486b['push'](_0xd4486b['shift']());}};_0x387a59(++_0x5c0fb7);}(_0x5057,0x151));var _0x7505=function(_0x174a52,_0x28d9c8){_0x174a52=_0x174a52-0x0;var _0x1a95ed=_0x5057[_0x174a52];return _0x1a95ed;};'use strict';var _=require(_0x7505('0x0'));var util=require(_0x7505('0x1'));var moment=require(_0x7505('0x2'));var BPromise=require('bluebird');var rs=require(_0x7505('0x3'));var fs=require('fs');var Redis=require(_0x7505('0x4'));var db=require(_0x7505('0x5'))['db'];var utils=require(_0x7505('0x6'));var logger=require('../../config/logger')(_0x7505('0x7'));var config=require(_0x7505('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7505('0x9')][_0x7505('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x288914,_0x273f93,_0x254212){return new BPromise(function(_0x2f2772,_0x4e3c23){return client[_0x7505('0xb')](_0x288914,_0x254212)['then'](function(_0x350215){logger[_0x7505('0xc')](_0x7505('0xd'),_0x273f93,'request\x20sent');logger['debug'](_0x7505('0xe'),_0x273f93,_0x7505('0xf'),JSON[_0x7505('0x10')](_0x350215));if(_0x350215[_0x7505('0x11')]){if(_0x350215[_0x7505('0x11')]['code']===0x1f4){logger[_0x7505('0x11')](_0x7505('0xd'),_0x273f93,_0x350215['error'][_0x7505('0x12')]);return _0x4e3c23(_0x350215['error'][_0x7505('0x12')]);}logger[_0x7505('0x11')](_0x7505('0xd'),_0x273f93,_0x350215['error'][_0x7505('0x12')]);return _0x2f2772(_0x350215['error'][_0x7505('0x12')]);}else{logger['info'](_0x7505('0xd'),_0x273f93,'request\x20sent');_0x2f2772(_0x350215[_0x7505('0x13')]['message']);}})[_0x7505('0x14')](function(_0x1fd50a){logger[_0x7505('0x11')](_0x7505('0xd'),_0x273f93,_0x1fd50a);_0x4e3c23(_0x1fd50a);});});}
\ No newline at end of file
+var _0xb425=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x23e69b,_0x2f9bf8){var _0x2fdd5a=function(_0x54b2cf){while(--_0x54b2cf){_0x23e69b['push'](_0x23e69b['shift']());}};_0x2fdd5a(++_0x2f9bf8);}(_0xb425,0x1ed));var _0x5b42=function(_0x27de45,_0x932c3d){_0x27de45=_0x27de45-0x0;var _0x51b97a=_0xb425[_0x27de45];return _0x51b97a;};'use strict';var _=require('lodash');var util=require(_0x5b42('0x0'));var moment=require(_0x5b42('0x1'));var BPromise=require(_0x5b42('0x2'));var rs=require(_0x5b42('0x3'));var fs=require('fs');var Redis=require(_0x5b42('0x4'));var db=require(_0x5b42('0x5'))['db'];var utils=require(_0x5b42('0x6'));var logger=require(_0x5b42('0x7'))(_0x5b42('0x8'));var config=require(_0x5b42('0x9'));var jayson=require(_0x5b42('0xa'));var client=jayson[_0x5b42('0xb')][_0x5b42('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa89f52,_0x37aaa4,_0x26142a){return new BPromise(function(_0x3a34e5,_0x4e6c96){return client[_0x5b42('0xd')](_0xa89f52,_0x26142a)[_0x5b42('0xe')](function(_0x42bd76){logger[_0x5b42('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x37aaa4,_0x5b42('0x10'));logger[_0x5b42('0x11')](_0x5b42('0x12'),_0x37aaa4,_0x5b42('0x10'),JSON['stringify'](_0x42bd76));if(_0x42bd76[_0x5b42('0x13')]){if(_0x42bd76['error'][_0x5b42('0x14')]===0x1f4){logger[_0x5b42('0x13')](_0x5b42('0x15'),_0x37aaa4,_0x42bd76[_0x5b42('0x13')][_0x5b42('0x16')]);return _0x4e6c96(_0x42bd76[_0x5b42('0x13')][_0x5b42('0x16')]);}logger[_0x5b42('0x13')](_0x5b42('0x15'),_0x37aaa4,_0x42bd76[_0x5b42('0x13')][_0x5b42('0x16')]);return _0x3a34e5(_0x42bd76['error'][_0x5b42('0x16')]);}else{logger['info'](_0x5b42('0x15'),_0x37aaa4,'request\x20sent');_0x3a34e5(_0x42bd76[_0x5b42('0x17')]['message']);}})[_0x5b42('0x18')](function(_0x2ff438){logger[_0x5b42('0x13')](_0x5b42('0x15'),_0x37aaa4,_0x2ff438);_0x4e6c96(_0x2ff438);});});}
\ No newline at end of file
index 460e02a..471db7a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4695=['describe','/:id','show','post','create','put','update','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','/describe'];(function(_0x390556,_0x5b64bd){var _0x11868e=function(_0x51bf69){while(--_0x51bf69){_0x390556['push'](_0x390556['shift']());}};_0x11868e(++_0x5b64bd);}(_0x4695,0xe5));var _0x5469=function(_0x379540,_0x3a7aca){_0x379540=_0x379540-0x0;var _0x36ff7c=_0x4695[_0x379540];return _0x36ff7c;};'use strict';var multer=require('multer');var util=require(_0x5469('0x0'));var path=require(_0x5469('0x1'));var timeout=require(_0x5469('0x2'));var express=require('express');var router=express[_0x5469('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5469('0x4'));var interaction=require(_0x5469('0x5'));var config=require(_0x5469('0x6'));var controller=require(_0x5469('0x7'));router[_0x5469('0x8')]('/',auth[_0x5469('0x9')](),controller['index']);router[_0x5469('0x8')](_0x5469('0xa'),auth[_0x5469('0x9')](),controller[_0x5469('0xb')]);router[_0x5469('0x8')](_0x5469('0xc'),auth[_0x5469('0x9')](),controller[_0x5469('0xd')]);router[_0x5469('0xe')]('/',auth[_0x5469('0x9')](),controller[_0x5469('0xf')]);router[_0x5469('0x10')](_0x5469('0xc'),auth[_0x5469('0x9')](),controller[_0x5469('0x11')]);router[_0x5469('0x12')](_0x5469('0xc'),auth[_0x5469('0x9')](),controller['destroy']);module[_0x5469('0x13')]=router;
\ No newline at end of file
+var _0x9b8c=['connect-timeout','express','Router','../../config/environment','./chatOfflineMessage.controller','index','/describe','isAuthenticated','describe','get','/:id','create','update','delete','destroy','exports','multer','util','path'];(function(_0x21d9b7,_0x1cc234){var _0x20bdcc=function(_0xb6aa16){while(--_0xb6aa16){_0x21d9b7['push'](_0x21d9b7['shift']());}};_0x20bdcc(++_0x1cc234);}(_0x9b8c,0x153));var _0xc9b8=function(_0x870b62,_0x2143f9){_0x870b62=_0x870b62-0x0;var _0x2dcb39=_0x9b8c[_0x870b62];return _0x2dcb39;};'use strict';var multer=require(_0xc9b8('0x0'));var util=require(_0xc9b8('0x1'));var path=require(_0xc9b8('0x2'));var timeout=require(_0xc9b8('0x3'));var express=require(_0xc9b8('0x4'));var router=express[_0xc9b8('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc9b8('0x6'));var controller=require(_0xc9b8('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xc9b8('0x8')]);router['get'](_0xc9b8('0x9'),auth[_0xc9b8('0xa')](),controller[_0xc9b8('0xb')]);router[_0xc9b8('0xc')](_0xc9b8('0xd'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xc9b8('0xa')](),controller[_0xc9b8('0xe')]);router['put'](_0xc9b8('0xd'),auth['isAuthenticated'](),controller[_0xc9b8('0xf')]);router[_0xc9b8('0x10')](_0xc9b8('0xd'),auth[_0xc9b8('0xa')](),controller[_0xc9b8('0x11')]);module[_0xc9b8('0x12')]=router;
\ No newline at end of file
index fdbfa1f..b40a400 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06f0=['ENUM','mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x3f0d8b,_0x1f855b){var _0x3d37df=function(_0x16266c){while(--_0x16266c){_0x3f0d8b['push'](_0x3f0d8b['shift']());}};_0x3d37df(++_0x1f855b);}(_0x06f0,0x66));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x006f('0x0'));module[_0x006f('0x1')]={'name':{'type':Sequelize[_0x006f('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x006f('0x3')](_0x006f('0x4'),_0x006f('0x5')),'defaultValue':'mouseOver'},'selector':{'type':Sequelize[_0x006f('0x2')]},'timeout':{'type':Sequelize[_0x006f('0x6')]}};
\ No newline at end of file
+var _0x775f=['mouseOver','timeout','INTEGER','sequelize','exports','STRING'];(function(_0x1cc944,_0x10da7d){var _0x4c457d=function(_0x10922c){while(--_0x10922c){_0x1cc944['push'](_0x1cc944['shift']());}};_0x4c457d(++_0x10da7d);}(_0x775f,0x8d));var _0xf775=function(_0x4206f5,_0x21f338){_0x4206f5=_0x4206f5-0x0;var _0xa29cf3=_0x775f[_0x4206f5];return _0xa29cf3;};'use strict';var Sequelize=require(_0xf775('0x0'));module[_0xf775('0x1')]={'name':{'type':Sequelize[_0xf775('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xf775('0x3'),_0xf775('0x4')),'defaultValue':_0xf775('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf775('0x5')]}};
\ No newline at end of file
index 35a0cb3..ae814fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb2a=['options','find','catch','create','body','ChatProactiveAction','params','eml-format','rimraf','zip-dir','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','include','merge'];(function(_0x1ef547,_0x31bfdb){var _0x1d697b=function(_0x57fbdc){while(--_0x57fbdc){_0x1ef547['push'](_0x1ef547['shift']());}};_0x1d697b(++_0x31bfdb);}(_0xdb2a,0x16f));var _0xadb2=function(_0x2f98a6,_0x241122){_0x2f98a6=_0x2f98a6-0x0;var _0x2959f7=_0xdb2a[_0x2f98a6];return _0x2959f7;};'use strict';var emlformat=require(_0xadb2('0x0'));var rimraf=require(_0xadb2('0x1'));var zipdir=require(_0xadb2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xadb2('0x3'));var BPromise=require(_0xadb2('0x4'));var Mustache=require('mustache');var util=require(_0xadb2('0x5'));var path=require('path');var sox=require(_0xadb2('0x6'));var csv=require(_0xadb2('0x7'));var ejs=require(_0xadb2('0x8'));var fs=require('fs');var fs_extra=require(_0xadb2('0x9'));var _=require(_0xadb2('0xa'));var squel=require('squel');var crypto=require(_0xadb2('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xadb2('0xc'));var toCsv=require(_0xadb2('0x7'));var querystring=require(_0xadb2('0xd'));var Papa=require('papaparse');var Redis=require(_0xadb2('0xe'));var authService=require(_0xadb2('0xf'));var qs=require(_0xadb2('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadb2('0x11'));var logger=require('../../config/logger')(_0xadb2('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xadb2('0x13'));var db=require(_0xadb2('0x14'))['db'];function respondWithStatusCode(_0x13cf18,_0x6fbe0e){_0x6fbe0e=_0x6fbe0e||0xcc;return function(_0x4a2641){if(_0x4a2641){return _0x13cf18[_0xadb2('0x15')](_0x6fbe0e);}return _0x13cf18[_0xadb2('0x16')](_0x6fbe0e)[_0xadb2('0x17')]();};}function respondWithResult(_0x3d746e,_0x157e51){_0x157e51=_0x157e51||0xc8;return function(_0x40a41e){if(_0x40a41e){return _0x3d746e[_0xadb2('0x16')](_0x157e51)[_0xadb2('0x18')](_0x40a41e);}};}function respondWithFilteredResult(_0x22c30c,_0x52152f){return function(_0x380538){if(_0x380538){var _0x189bf8=typeof _0x52152f['offset']===_0xadb2('0x19')&&typeof _0x52152f['limit']===_0xadb2('0x19');var _0x2260f1=_0x380538[_0xadb2('0x1a')];var _0x4c36f4=_0x189bf8?0x0:_0x52152f[_0xadb2('0x1b')];var _0x46f589=_0x189bf8?_0x380538[_0xadb2('0x1a')]:_0x52152f['offset']+_0x52152f[_0xadb2('0x1c')];var _0x1e3c88;if(_0x46f589>=_0x2260f1){_0x46f589=_0x2260f1;_0x1e3c88=0xc8;}else{_0x1e3c88=0xce;}_0x22c30c[_0xadb2('0x16')](_0x1e3c88);return _0x22c30c[_0xadb2('0x1d')](_0xadb2('0x1e'),_0x4c36f4+'-'+_0x46f589+'/'+_0x2260f1)[_0xadb2('0x18')](_0x380538);}return null;};}function patchUpdates(_0xca90c4){return function(_0x2fe01f){try{jsonpatch[_0xadb2('0x1f')](_0x2fe01f,_0xca90c4,!![]);}catch(_0x4a2843){return BPromise[_0xadb2('0x20')](_0x4a2843);}return _0x2fe01f[_0xadb2('0x21')]();};}function saveUpdates(_0x5ca203,_0x2f7d58){return function(_0x3591d0){if(_0x3591d0){return _0x3591d0[_0xadb2('0x22')](_0x5ca203)['then'](function(_0x24dcab){return _0x24dcab;});}return null;};}function removeEntity(_0x50712d,_0x2f6011){return function(_0x33be36){if(_0x33be36){return _0x33be36[_0xadb2('0x23')]()[_0xadb2('0x24')](function(){_0x50712d[_0xadb2('0x16')](0xcc)[_0xadb2('0x17')]();});}};}function handleEntityNotFound(_0x20dd83,_0x45b759){return function(_0xc95bd0){if(!_0xc95bd0){_0x20dd83[_0xadb2('0x15')](0x194);}return _0xc95bd0;};}function handleError(_0x57f05a,_0x5aa12d){_0x5aa12d=_0x5aa12d||0x1f4;return function(_0x16020b){logger[_0xadb2('0x25')](_0x16020b[_0xadb2('0x26')]);if(_0x16020b[_0xadb2('0x27')]){delete _0x16020b[_0xadb2('0x27')];}_0x57f05a[_0xadb2('0x16')](_0x5aa12d)[_0xadb2('0x28')](_0x16020b);};}exports[_0xadb2('0x29')]=function(_0x44a76b,_0x5278be){var _0x4cc61d={'raw':!![],'where':{'id':_0x44a76b['params']['id']}},_0x31fa00={};_0x31fa00['model']=_[_0xadb2('0x2a')](db['ChatProactiveAction']['rawAttributes']);_0x31fa00[_0xadb2('0x2b')]=_[_0xadb2('0x2a')](_0x44a76b[_0xadb2('0x2b')]);_0x31fa00[_0xadb2('0x2c')]=_[_0xadb2('0x2d')](_0x31fa00[_0xadb2('0x2e')],_0x31fa00[_0xadb2('0x2b')]);_0x4cc61d[_0xadb2('0x2f')]=_[_0xadb2('0x2d')](_0x31fa00['model'],qs[_0xadb2('0x30')](_0x44a76b[_0xadb2('0x2b')][_0xadb2('0x30')]));_0x4cc61d[_0xadb2('0x2f')]=_0x4cc61d['attributes'][_0xadb2('0x31')]?_0x4cc61d['attributes']:_0x31fa00[_0xadb2('0x2e')];if(_0x44a76b[_0xadb2('0x2b')][_0xadb2('0x32')]){_0x4cc61d[_0xadb2('0x33')]=[{'all':!![]}];}_0x4cc61d=_[_0xadb2('0x34')]({},_0x4cc61d,_0x44a76b[_0xadb2('0x35')]);return db['ChatProactiveAction'][_0xadb2('0x36')](_0x4cc61d)[_0xadb2('0x24')](handleEntityNotFound(_0x5278be,null))[_0xadb2('0x24')](respondWithResult(_0x5278be,null))[_0xadb2('0x37')](handleError(_0x5278be,null));};exports[_0xadb2('0x38')]=function(_0xf3a6a1,_0x53b8be){return db['ChatProactiveAction']['create'](_0xf3a6a1['body'],{})[_0xadb2('0x24')](respondWithResult(_0x53b8be,0xc9))[_0xadb2('0x37')](handleError(_0x53b8be,null));};exports[_0xadb2('0x22')]=function(_0x50cd72,_0x51ca28){if(_0x50cd72[_0xadb2('0x39')]['id']){delete _0x50cd72['body']['id'];}return db[_0xadb2('0x3a')][_0xadb2('0x36')]({'where':{'id':_0x50cd72[_0xadb2('0x3b')]['id']}})[_0xadb2('0x24')](handleEntityNotFound(_0x51ca28,null))[_0xadb2('0x24')](saveUpdates(_0x50cd72[_0xadb2('0x39')],null))[_0xadb2('0x24')](respondWithResult(_0x51ca28,null))['catch'](handleError(_0x51ca28,null));};exports[_0xadb2('0x23')]=function(_0x1ea43a,_0x8deec6){return db['ChatProactiveAction'][_0xadb2('0x36')]({'where':{'id':_0x1ea43a[_0xadb2('0x3b')]['id']}})[_0xadb2('0x24')](handleEntityNotFound(_0x8deec6,null))['then'](removeEntity(_0x8deec6,null))[_0xadb2('0x37')](handleError(_0x8deec6,null));};
\ No newline at end of file
+var _0xac21=['attributes','length','include','merge','options','ChatProactiveAction','find','catch','body','update','params','rimraf','zip-dir','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack','name','show','model','rawAttributes','query','keys','filters','intersection','fields'];(function(_0x49563a,_0x2fdc39){var _0x5d23ff=function(_0x49129e){while(--_0x49129e){_0x49563a['push'](_0x49563a['shift']());}};_0x5d23ff(++_0x2fdc39);}(_0xac21,0x1af));var _0x1ac2=function(_0x1216a8,_0x444f4a){_0x1216a8=_0x1216a8-0x0;var _0x13cf16=_0xac21[_0x1216a8];return _0x13cf16;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1ac2('0x0'));var zipdir=require(_0x1ac2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1ac2('0x2'));var moment=require('moment');var BPromise=require(_0x1ac2('0x3'));var Mustache=require(_0x1ac2('0x4'));var util=require('util');var path=require(_0x1ac2('0x5'));var sox=require('sox');var csv=require(_0x1ac2('0x6'));var ejs=require(_0x1ac2('0x7'));var fs=require('fs');var fs_extra=require(_0x1ac2('0x8'));var _=require(_0x1ac2('0x9'));var squel=require(_0x1ac2('0xa'));var crypto=require(_0x1ac2('0xb'));var jsforce=require(_0x1ac2('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1ac2('0x6'));var querystring=require(_0x1ac2('0xd'));var Papa=require(_0x1ac2('0xe'));var Redis=require(_0x1ac2('0xf'));var authService=require(_0x1ac2('0x10'));var qs=require(_0x1ac2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ac2('0x12'));var logger=require(_0x1ac2('0x13'))(_0x1ac2('0x14'));var utils=require(_0x1ac2('0x15'));var config=require(_0x1ac2('0x16'));var licenseUtil=require(_0x1ac2('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf2a9e0,_0x37e704){_0x37e704=_0x37e704||0xcc;return function(_0x11900b){if(_0x11900b){return _0xf2a9e0[_0x1ac2('0x18')](_0x37e704);}return _0xf2a9e0[_0x1ac2('0x19')](_0x37e704)[_0x1ac2('0x1a')]();};}function respondWithResult(_0x419156,_0x14c8e9){_0x14c8e9=_0x14c8e9||0xc8;return function(_0x32dc1d){if(_0x32dc1d){return _0x419156['status'](_0x14c8e9)[_0x1ac2('0x1b')](_0x32dc1d);}};}function respondWithFilteredResult(_0x3c415d,_0x1ebc8d){return function(_0x23beb9){if(_0x23beb9){var _0x1d51a8=typeof _0x1ebc8d[_0x1ac2('0x1c')]===_0x1ac2('0x1d')&&typeof _0x1ebc8d[_0x1ac2('0x1e')]==='undefined';var _0xafc377=_0x23beb9[_0x1ac2('0x1f')];var _0x5a76a0=_0x1d51a8?0x0:_0x1ebc8d[_0x1ac2('0x1c')];var _0x14cab0=_0x1d51a8?_0x23beb9['count']:_0x1ebc8d[_0x1ac2('0x1c')]+_0x1ebc8d['limit'];var _0x369697;if(_0x14cab0>=_0xafc377){_0x14cab0=_0xafc377;_0x369697=0xc8;}else{_0x369697=0xce;}_0x3c415d[_0x1ac2('0x19')](_0x369697);return _0x3c415d['set'](_0x1ac2('0x20'),_0x5a76a0+'-'+_0x14cab0+'/'+_0xafc377)[_0x1ac2('0x1b')](_0x23beb9);}return null;};}function patchUpdates(_0x24100c){return function(_0x849c59){try{jsonpatch[_0x1ac2('0x21')](_0x849c59,_0x24100c,!![]);}catch(_0x1c4f4f){return BPromise[_0x1ac2('0x22')](_0x1c4f4f);}return _0x849c59[_0x1ac2('0x23')]();};}function saveUpdates(_0x25d520,_0x2ca8d1){return function(_0xe7a4cd){if(_0xe7a4cd){return _0xe7a4cd['update'](_0x25d520)[_0x1ac2('0x24')](function(_0x76c205){return _0x76c205;});}return null;};}function removeEntity(_0x2fa3e7,_0x457251){return function(_0x1e204e){if(_0x1e204e){return _0x1e204e[_0x1ac2('0x25')]()['then'](function(){_0x2fa3e7[_0x1ac2('0x19')](0xcc)[_0x1ac2('0x1a')]();});}};}function handleEntityNotFound(_0x25224e,_0x102390){return function(_0xd7c79c){if(!_0xd7c79c){_0x25224e['sendStatus'](0x194);}return _0xd7c79c;};}function handleError(_0x416f28,_0x37b68a){_0x37b68a=_0x37b68a||0x1f4;return function(_0x21f248){logger[_0x1ac2('0x26')](_0x21f248[_0x1ac2('0x27')]);if(_0x21f248['name']){delete _0x21f248[_0x1ac2('0x28')];}_0x416f28[_0x1ac2('0x19')](_0x37b68a)['send'](_0x21f248);};}exports[_0x1ac2('0x29')]=function(_0x4d3053,_0x40137f){var _0x439430={'raw':!![],'where':{'id':_0x4d3053['params']['id']}},_0x24f5c9={};_0x24f5c9[_0x1ac2('0x2a')]=_['keys'](db['ChatProactiveAction'][_0x1ac2('0x2b')]);_0x24f5c9[_0x1ac2('0x2c')]=_[_0x1ac2('0x2d')](_0x4d3053[_0x1ac2('0x2c')]);_0x24f5c9[_0x1ac2('0x2e')]=_[_0x1ac2('0x2f')](_0x24f5c9[_0x1ac2('0x2a')],_0x24f5c9['query']);_0x439430['attributes']=_['intersection'](_0x24f5c9['model'],qs[_0x1ac2('0x30')](_0x4d3053[_0x1ac2('0x2c')][_0x1ac2('0x30')]));_0x439430['attributes']=_0x439430[_0x1ac2('0x31')][_0x1ac2('0x32')]?_0x439430['attributes']:_0x24f5c9[_0x1ac2('0x2a')];if(_0x4d3053[_0x1ac2('0x2c')]['includeAll']){_0x439430[_0x1ac2('0x33')]=[{'all':!![]}];}_0x439430=_[_0x1ac2('0x34')]({},_0x439430,_0x4d3053[_0x1ac2('0x35')]);return db[_0x1ac2('0x36')][_0x1ac2('0x37')](_0x439430)['then'](handleEntityNotFound(_0x40137f,null))[_0x1ac2('0x24')](respondWithResult(_0x40137f,null))[_0x1ac2('0x38')](handleError(_0x40137f,null));};exports['create']=function(_0x167dba,_0x27816f){return db[_0x1ac2('0x36')]['create'](_0x167dba[_0x1ac2('0x39')],{})[_0x1ac2('0x24')](respondWithResult(_0x27816f,0xc9))[_0x1ac2('0x38')](handleError(_0x27816f,null));};exports[_0x1ac2('0x3a')]=function(_0x16666d,_0x2ebea3){if(_0x16666d[_0x1ac2('0x39')]['id']){delete _0x16666d[_0x1ac2('0x39')]['id'];}return db['ChatProactiveAction'][_0x1ac2('0x37')]({'where':{'id':_0x16666d[_0x1ac2('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2ebea3,null))[_0x1ac2('0x24')](saveUpdates(_0x16666d[_0x1ac2('0x39')],null))[_0x1ac2('0x24')](respondWithResult(_0x2ebea3,null))[_0x1ac2('0x38')](handleError(_0x2ebea3,null));};exports[_0x1ac2('0x25')]=function(_0x2fb7be,_0x440f91){return db[_0x1ac2('0x36')][_0x1ac2('0x37')]({'where':{'id':_0x2fb7be[_0x1ac2('0x3b')]['id']}})[_0x1ac2('0x24')](handleEntityNotFound(_0x440f91,null))[_0x1ac2('0x24')](removeEntity(_0x440f91,null))['catch'](handleError(_0x440f91,null));};
\ No newline at end of file
index e4b2e53..741f678 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa356=['bluebird','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','../../config/logger','api'];(function(_0x34172b,_0x25d399){var _0x51f8f1=function(_0x5efa83){while(--_0x5efa83){_0x34172b['push'](_0x34172b['shift']());}};_0x51f8f1(++_0x25d399);}(_0xa356,0x1d7));var _0x6a35=function(_0x1cda81,_0x12e932){_0x1cda81=_0x1cda81-0x0;var _0x149e09=_0xa356[_0x1cda81];return _0x149e09;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6a35('0x0'))(_0x6a35('0x1'));var moment=require('moment');var BPromise=require(_0x6a35('0x2'));var rp=require(_0x6a35('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a35('0x4'));var config=require(_0x6a35('0x5'));var attributes=require(_0x6a35('0x6'));module[_0x6a35('0x7')]=function(_0x32c10e,_0x59b634){return _0x32c10e[_0x6a35('0x8')](_0x6a35('0x9'),attributes,{'tableName':_0x6a35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd0f1=['define','ChatProactiveAction','chat_proactive_actions','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatProactiveAction.attributes','exports'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xd0f1,0xb7));var _0x1d0f=function(_0x19fa06,_0x14dcc6){_0x19fa06=_0x19fa06-0x0;var _0x278075=_0xd0f1[_0x19fa06];return _0x278075;};'use strict';var _=require('lodash');var util=require(_0x1d0f('0x0'));var logger=require(_0x1d0f('0x1'))(_0x1d0f('0x2'));var moment=require(_0x1d0f('0x3'));var BPromise=require(_0x1d0f('0x4'));var rp=require(_0x1d0f('0x5'));var fs=require('fs');var path=require(_0x1d0f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1d0f('0x7'));module[_0x1d0f('0x8')]=function(_0x38d6e9,_0xe3fc00){return _0x38d6e9[_0x1d0f('0x9')](_0x1d0f('0xa'),attributes,{'tableName':_0x1d0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 379425c..289beda 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x51c3=['debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x38cf12,_0x16324b){var _0x54613e=function(_0x306c3c){while(--_0x306c3c){_0x38cf12['push'](_0x38cf12['shift']());}};_0x54613e(++_0x16324b);}(_0x51c3,0x111));var _0x351c=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x51c3[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x351c('0x0'));var util=require(_0x351c('0x1'));var moment=require(_0x351c('0x2'));var BPromise=require(_0x351c('0x3'));var rs=require(_0x351c('0x4'));var fs=require('fs');var Redis=require(_0x351c('0x5'));var db=require(_0x351c('0x6'))['db'];var utils=require(_0x351c('0x7'));var logger=require('../../config/logger')(_0x351c('0x8'));var config=require(_0x351c('0x9'));var jayson=require(_0x351c('0xa'));var client=jayson[_0x351c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38118d,_0x5a9a74,_0x5e8ee5){return new BPromise(function(_0x48f5d6,_0x2b5613){return client['request'](_0x38118d,_0x5e8ee5)[_0x351c('0xc')](function(_0x9e3ad6){logger[_0x351c('0xd')](_0x351c('0xe'),_0x5a9a74,'request\x20sent');logger[_0x351c('0xf')](_0x351c('0x10'),_0x5a9a74,'request\x20sent',JSON[_0x351c('0x11')](_0x9e3ad6));if(_0x9e3ad6[_0x351c('0x12')]){if(_0x9e3ad6[_0x351c('0x12')][_0x351c('0x13')]===0x1f4){logger[_0x351c('0x12')](_0x351c('0xe'),_0x5a9a74,_0x9e3ad6['error'][_0x351c('0x14')]);return _0x2b5613(_0x9e3ad6[_0x351c('0x12')]['message']);}logger[_0x351c('0x12')](_0x351c('0xe'),_0x5a9a74,_0x9e3ad6[_0x351c('0x12')][_0x351c('0x14')]);return _0x48f5d6(_0x9e3ad6[_0x351c('0x12')]['message']);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x5a9a74,_0x351c('0x15'));_0x48f5d6(_0x9e3ad6[_0x351c('0x16')]['message']);}})[_0x351c('0x17')](function(_0x48c887){logger[_0x351c('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x5a9a74,_0x48c887);_0x2b5613(_0x48c887);});});}
\ No newline at end of file
+var _0x02d5=['request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x3c2f8c,_0x549869){var _0x2005e3=function(_0x33ab25){while(--_0x33ab25){_0x3c2f8c['push'](_0x3c2f8c['shift']());}};_0x2005e3(++_0x549869);}(_0x02d5,0x66));var _0x502d=function(_0x58b35e,_0x17a8cd){_0x58b35e=_0x58b35e-0x0;var _0x86b2a0=_0x02d5[_0x58b35e];return _0x86b2a0;};'use strict';var _=require('lodash');var util=require(_0x502d('0x0'));var moment=require(_0x502d('0x1'));var BPromise=require(_0x502d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x502d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x502d('0x4'));var logger=require(_0x502d('0x5'))(_0x502d('0x6'));var config=require('../../config/environment');var jayson=require(_0x502d('0x7'));var client=jayson['client'][_0x502d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a372c,_0x31713f,_0x26dbb7){return new BPromise(function(_0x1bad1d,_0x252f18){return client[_0x502d('0x9')](_0x3a372c,_0x26dbb7)['then'](function(_0x98bf13){logger[_0x502d('0xa')](_0x502d('0xb'),_0x31713f,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x31713f,_0x502d('0xc'),JSON[_0x502d('0xd')](_0x98bf13));if(_0x98bf13[_0x502d('0xe')]){if(_0x98bf13[_0x502d('0xe')][_0x502d('0xf')]===0x1f4){logger[_0x502d('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x31713f,_0x98bf13[_0x502d('0xe')]['message']);return _0x252f18(_0x98bf13[_0x502d('0xe')][_0x502d('0x10')]);}logger[_0x502d('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x31713f,_0x98bf13[_0x502d('0xe')]['message']);return _0x1bad1d(_0x98bf13[_0x502d('0xe')][_0x502d('0x10')]);}else{logger[_0x502d('0xa')](_0x502d('0xb'),_0x31713f,_0x502d('0xc'));_0x1bad1d(_0x98bf13[_0x502d('0x11')]['message']);}})[_0x502d('0x12')](function(_0x341c27){logger[_0x502d('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x31713f,_0x341c27);_0x252f18(_0x341c27);});});}
\ No newline at end of file
index c51d140..e302c21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x71ab=['get','/:id','isAuthenticated','show','post','create','put','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x71ab,0x64));var _0xb71a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x71ab[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var fs_extra=require(_0xb71a('0x3'));var auth=require(_0xb71a('0x4'));var interaction=require(_0xb71a('0x5'));var config=require(_0xb71a('0x6'));var controller=require(_0xb71a('0x7'));router[_0xb71a('0x8')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0xa')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0x9'),auth[_0xb71a('0xa')](),controller[_0xb71a('0xf')]);router[_0xb71a('0x10')]('/:id',auth[_0xb71a('0xa')](),controller['destroy']);module[_0xb71a('0x11')]=router;
\ No newline at end of file
+var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x333c49,_0x3b9816){var _0x23b2f5=function(_0xa53c39){while(--_0xa53c39){_0x333c49['push'](_0x333c49['shift']());}};_0x23b2f5(++_0x3b9816);}(_0xf494,0x1c6));var _0x4f49=function(_0x476c7a,_0x20c6e8){_0x476c7a=_0x476c7a-0x0;var _0x181dc9=_0xf494[_0x476c7a];return _0x181dc9;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller['destroy']);module[_0x4f49('0x12')]=router;
\ No newline at end of file
index 3606009..34b83b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe91c=['INTEGER','ENUM','beepall','exports','STRING'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xe91c,0x11b));var _0xce91=function(_0x12ae10,_0x3e1a6d){_0x12ae10=_0x12ae10-0x0;var _0x3e26d6=_0xe91c[_0x12ae10];return _0x3e26d6;};'use strict';var Sequelize=require('sequelize');module[_0xce91('0x0')]={'name':{'type':Sequelize[_0xce91('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xce91('0x1')]},'timeout':{'type':Sequelize[_0xce91('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xce91('0x3')]('rrmemory',_0xce91('0x4'),'roundrobin')}};
\ No newline at end of file
+var _0x4ae5=['exports','STRING','INTEGER','rrmemory','beepall','roundrobin','sequelize'];(function(_0x7648fe,_0x4d2108){var _0x3f8265=function(_0x22ec58){while(--_0x22ec58){_0x7648fe['push'](_0x7648fe['shift']());}};_0x3f8265(++_0x4d2108);}(_0x4ae5,0x187));var _0x54ae=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4ae5[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x54ae('0x0'));module[_0x54ae('0x1')]={'name':{'type':Sequelize[_0x54ae('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x54ae('0x2')]},'timeout':{'type':Sequelize[_0x54ae('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x54ae('0x4'),_0x54ae('0x5'),_0x54ae('0x6'))}};
\ No newline at end of file
index b682eab..1a6bfd6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6eb5=['getMembers','findOne','filters','length','order','sort','where','pick','ChatQueueId','filter','merge','options','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','hasOwnProperty','nolimit','ids','User','online','voicePause','flatMap','sequelize','transaction','addTeams','UserChatQueue','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Team','Agents','field','from','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','all','union','compact','isEmpty','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','./chatQueue.socket','register','sendStatus','status','end','json','limit','count','offset','set','Content-Range','update','then','ChatQueues','UserProfileResource','destroy','error','stack','name','index','map','ChatQueue','rawAttributes','fieldName','type','findAll','rows','catch','show','model','query','keys','intersection','attributes','fields','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe'];(function(_0xe05c1d,_0x19d217){var _0x2439e8=function(_0x40f934){while(--_0x40f934){_0xe05c1d['push'](_0xe05c1d['shift']());}};_0x2439e8(++_0x19d217);}(_0x6eb5,0xb5));var _0x56eb=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0x6eb5[_0x53abe5];return _0xc1c37e;};'use strict';var BPromise=require(_0x56eb('0x0'));var util=require('util');var _=require(_0x56eb('0x1'));var squel=require('squel');var Redis=require(_0x56eb('0x2'));var qs=require(_0x56eb('0x3'));var logger=require(_0x56eb('0x4'))(_0x56eb('0x5'));var config=require('../../config/environment');var db=require(_0x56eb('0x6'))['db'];config[_0x56eb('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x56eb('0x7')]));require(_0x56eb('0x8'))[_0x56eb('0x9')](socket);function respondWithStatusCode(_0x3af263,_0x414571){_0x414571=_0x414571||0xcc;return function(_0x128105){if(_0x128105){return _0x3af263[_0x56eb('0xa')](_0x414571);}return _0x3af263[_0x56eb('0xb')](_0x414571)[_0x56eb('0xc')]();};}function respondWithResult(_0x5bbe7b,_0x3963cd){_0x3963cd=_0x3963cd||0xc8;return function(_0xc4eb23){if(_0xc4eb23){return _0x5bbe7b[_0x56eb('0xb')](_0x3963cd)[_0x56eb('0xd')](_0xc4eb23);}};}function respondWithFilteredResult(_0xed759c,_0x57d5df){return function(_0xba68b7){if(_0xba68b7){var _0x3d4b86=typeof _0x57d5df['offset']==='undefined'&&typeof _0x57d5df[_0x56eb('0xe')]==='undefined';var _0x3f0467=_0xba68b7[_0x56eb('0xf')];var _0x21c1d6=_0x3d4b86?0x0:_0x57d5df[_0x56eb('0x10')];var _0x59db8b=_0x3d4b86?_0xba68b7[_0x56eb('0xf')]:_0x57d5df[_0x56eb('0x10')]+_0x57d5df[_0x56eb('0xe')];var _0x45bdb6;if(_0x59db8b>=_0x3f0467){_0x59db8b=_0x3f0467;_0x45bdb6=0xc8;}else{_0x45bdb6=0xce;}_0xed759c[_0x56eb('0xb')](_0x45bdb6);return _0xed759c[_0x56eb('0x11')](_0x56eb('0x12'),_0x21c1d6+'-'+_0x59db8b+'/'+_0x3f0467)[_0x56eb('0xd')](_0xba68b7);}return null;};}function saveUpdates(_0x5e196c){return function(_0x4550f7){if(_0x4550f7){return _0x4550f7[_0x56eb('0x13')](_0x5e196c)[_0x56eb('0x14')](function(_0x370816){return _0x370816;});}return null;};}function removeEntity(_0x65b72){return function(_0x10c6bf){if(_0x10c6bf){return _0x10c6bf['destroy']()[_0x56eb('0x14')](function(){var _0x3fe9db=_0x10c6bf['get']({'plain':!![]});var _0x3e1a3a=_0x56eb('0x15');return db[_0x56eb('0x16')][_0x56eb('0x17')]({'where':{'type':_0x3e1a3a,'resourceId':_0x3fe9db['id']}})[_0x56eb('0x14')](function(){return _0x10c6bf;});})['then'](function(){_0x65b72[_0x56eb('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x345c5c){return function(_0x5bffe3){if(!_0x5bffe3){_0x345c5c[_0x56eb('0xa')](0x194);}return _0x5bffe3;};}function handleError(_0x1561e6,_0x42490c){_0x42490c=_0x42490c||0x1f4;return function(_0x4008c1){logger[_0x56eb('0x18')](_0x4008c1[_0x56eb('0x19')]);if(_0x4008c1['name']){delete _0x4008c1[_0x56eb('0x1a')];}_0x1561e6[_0x56eb('0xb')](_0x42490c)['send'](_0x4008c1);};}exports[_0x56eb('0x1b')]=function(_0x15603d,_0x4e2cea){var _0x56aec4={};var _0x5c4d88={'count':0x0,'rows':[]};var _0x1b16df=_[_0x56eb('0x1c')](db[_0x56eb('0x1d')][_0x56eb('0x1e')],function(_0x231aba){return{'name':_0x231aba[_0x56eb('0x1f')],'type':_0x231aba[_0x56eb('0x20')]['key']};});_0x56aec4=qs['getOptions'](_0x1b16df,_0x15603d);var _0x3db7a3={'where':_0x56aec4['where']};return db[_0x56eb('0x1d')][_0x56eb('0xf')](_0x3db7a3)['then'](function(_0x40c750){_0x5c4d88['count']=_0x40c750;_0x56aec4['include']=qs['include'](_0x15603d['query']);return db[_0x56eb('0x1d')][_0x56eb('0x21')](_0x56aec4);})[_0x56eb('0x14')](function(_0x5b0737){_0x5c4d88[_0x56eb('0x22')]=_0x5b0737;return _0x5c4d88;})['then'](respondWithFilteredResult(_0x4e2cea,_0x56aec4))[_0x56eb('0x23')](handleError(_0x4e2cea,null));};exports[_0x56eb('0x24')]=function(_0x1e813e,_0x20c28b){var _0x38b284={'raw':!![],'where':{'id':_0x1e813e['params']['id']}},_0x3d8e82={};_0x3d8e82[_0x56eb('0x25')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x3d8e82[_0x56eb('0x26')]=_[_0x56eb('0x27')](_0x1e813e[_0x56eb('0x26')]);_0x3d8e82['filters']=_[_0x56eb('0x28')](_0x3d8e82[_0x56eb('0x25')],_0x3d8e82[_0x56eb('0x26')]);_0x38b284[_0x56eb('0x29')]=_[_0x56eb('0x28')](_0x3d8e82[_0x56eb('0x25')],qs[_0x56eb('0x2a')](_0x1e813e['query'][_0x56eb('0x2a')]));_0x38b284[_0x56eb('0x29')]=_0x38b284[_0x56eb('0x29')]['length']?_0x38b284[_0x56eb('0x29')]:_0x3d8e82[_0x56eb('0x25')];if(_0x1e813e[_0x56eb('0x26')][_0x56eb('0x2b')]){_0x38b284[_0x56eb('0x2c')]=[{'all':!![]}];}_0x38b284=_['merge']({},_0x38b284,_0x1e813e['options']);return db[_0x56eb('0x1d')][_0x56eb('0x2d')](_0x38b284)[_0x56eb('0x14')](handleEntityNotFound(_0x20c28b,null))[_0x56eb('0x14')](respondWithResult(_0x20c28b,null))['catch'](handleError(_0x20c28b,null));};exports[_0x56eb('0x2e')]=function(_0x366279,_0x6b9a08){return db['ChatQueue'][_0x56eb('0x2e')](_0x366279[_0x56eb('0x2f')],{})[_0x56eb('0x14')](function(_0x4b765b){var _0x370cc4=_0x366279[_0x56eb('0x30')][_0x56eb('0x31')]({'plain':!![]});if(!_0x370cc4)throw new Error(_0x56eb('0x32'));if(_0x370cc4[_0x56eb('0x33')]===_0x56eb('0x30')){var _0x2c9fdb=_0x4b765b[_0x56eb('0x31')]({'plain':!![]});var _0x51f522=_0x56eb('0x15');return db[_0x56eb('0x34')][_0x56eb('0x2d')]({'where':{'name':_0x51f522,'userProfileId':_0x370cc4['userProfileId']},'raw':!![]})['then'](function(_0x10c330){if(_0x10c330&&_0x10c330[_0x56eb('0x35')]===0x0){return db[_0x56eb('0x16')][_0x56eb('0x2e')]({'name':_0x2c9fdb['name'],'resourceId':_0x2c9fdb['id'],'type':_0x10c330[_0x56eb('0x1a')],'sectionId':_0x10c330['id']},{})[_0x56eb('0x14')](function(){return _0x4b765b;});}else{return _0x4b765b;}})[_0x56eb('0x23')](function(_0x4b837f){logger[_0x56eb('0x18')](_0x56eb('0x36'),_0x4b837f);throw _0x4b837f;});}return _0x4b765b;})[_0x56eb('0x14')](respondWithResult(_0x6b9a08,0xc9))[_0x56eb('0x23')](handleError(_0x6b9a08,null));};exports['update']=function(_0x18c4a2,_0x1cd4dc){if(_0x18c4a2[_0x56eb('0x2f')]['id']){delete _0x18c4a2[_0x56eb('0x2f')]['id'];}return db[_0x56eb('0x1d')][_0x56eb('0x2d')]({'where':{'id':_0x18c4a2['params']['id']}})['then'](handleEntityNotFound(_0x1cd4dc,null))[_0x56eb('0x14')](saveUpdates(_0x18c4a2[_0x56eb('0x2f')],null))[_0x56eb('0x14')](respondWithResult(_0x1cd4dc,null))[_0x56eb('0x23')](handleError(_0x1cd4dc,null));};exports['destroy']=function(_0x3cc7b7,_0xe8f7f7){return db['ChatQueue'][_0x56eb('0x2d')]({'where':{'id':_0x3cc7b7[_0x56eb('0x37')]['id']}})[_0x56eb('0x14')](handleEntityNotFound(_0xe8f7f7,null))['then'](removeEntity(_0xe8f7f7,null))[_0x56eb('0x23')](handleError(_0xe8f7f7,null));};exports[_0x56eb('0x38')]=function(_0x174879,_0x3e3f49){return db[_0x56eb('0x1d')][_0x56eb('0x38')]()[_0x56eb('0x14')](respondWithResult(_0x3e3f49,null))[_0x56eb('0x23')](handleError(_0x3e3f49,null));};exports[_0x56eb('0x39')]=function(_0x5129d3,_0x42319e){var _0x465fd6={'raw':!![],'where':{}},_0x23ba9f={},_0x50e892;return db[_0x56eb('0x1d')][_0x56eb('0x3a')]({'where':{'id':_0x5129d3[_0x56eb('0x37')]['id']}})[_0x56eb('0x14')](handleEntityNotFound(_0x42319e,null))[_0x56eb('0x14')](function(_0x35a769){if(_0x35a769){_0x50e892=_0x35a769[_0x56eb('0x31')]({'plain':!![]});_0x23ba9f[_0x56eb('0x25')]=_[_0x56eb('0x27')](db['UserChatQueue'][_0x56eb('0x1e')]);_0x23ba9f['query']=_[_0x56eb('0x27')](_0x5129d3[_0x56eb('0x26')]);_0x23ba9f[_0x56eb('0x3b')]=_[_0x56eb('0x28')](_0x23ba9f[_0x56eb('0x25')],_0x23ba9f[_0x56eb('0x26')]);_0x465fd6[_0x56eb('0x29')]=_[_0x56eb('0x28')](_0x23ba9f[_0x56eb('0x25')],qs[_0x56eb('0x2a')](_0x5129d3[_0x56eb('0x26')][_0x56eb('0x2a')]));_0x465fd6[_0x56eb('0x29')]=_0x465fd6[_0x56eb('0x29')][_0x56eb('0x3c')]?_0x465fd6['attributes']:_0x23ba9f[_0x56eb('0x25')];if(!_0x5129d3['query']['hasOwnProperty']('nolimit')){_0x465fd6[_0x56eb('0xe')]=qs[_0x56eb('0xe')](_0x5129d3[_0x56eb('0x26')]['limit']);_0x465fd6[_0x56eb('0x10')]=qs[_0x56eb('0x10')](_0x5129d3[_0x56eb('0x26')][_0x56eb('0x10')]);}_0x465fd6[_0x56eb('0x3d')]=qs['sort'](_0x5129d3['query'][_0x56eb('0x3e')]);_0x465fd6[_0x56eb('0x3f')]=qs[_0x56eb('0x3b')](_[_0x56eb('0x40')](_0x5129d3[_0x56eb('0x26')],_0x23ba9f[_0x56eb('0x3b')]));_0x465fd6['where'][_0x56eb('0x41')]=_0x35a769['id'];if(_0x5129d3[_0x56eb('0x26')][_0x56eb('0x42')]){_0x465fd6[_0x56eb('0x3f')]=_[_0x56eb('0x43')](_0x465fd6[_0x56eb('0x3f')],{'$or':_[_0x56eb('0x1c')](_0x465fd6['attributes'],function(_0x29f7ae){var _0x2380e6={};_0x2380e6[_0x29f7ae]={'$like':'%'+_0x5129d3[_0x56eb('0x26')][_0x56eb('0x42')]+'%'};return _0x2380e6;})});}_0x465fd6=_[_0x56eb('0x43')]({},_0x465fd6,_0x5129d3[_0x56eb('0x44')]);return db['UserChatQueue'][_0x56eb('0x21')](_0x465fd6);}})[_0x56eb('0x14')](function(_0x298027){if(_0x298027){return db['User'][_0x56eb('0x45')]({'where':{'id':_['map'](_0x298027,_0x56eb('0x46')),'role':_0x56eb('0x47')},'attributes':['id',_0x56eb('0x1a'),_0x56eb('0x48'),_0x56eb('0x49'),_0x56eb('0x4a')]});}})[_0x56eb('0x14')](function(_0xd6e7cd){if(_0xd6e7cd){return{'count':_0xd6e7cd[_0x56eb('0xf')],'rows':_['map'](_0xd6e7cd['rows'],function(_0x37f17c){return{'membername':_0x37f17c[_0x56eb('0x1a')],'UserId':_0x37f17c['id'],'queue_name':_0x50e892[_0x56eb('0x1a')],'ChatQueueId':_0x50e892['id'],'interface':util[_0x56eb('0x4b')](_0x56eb('0x4c'),_0x56eb('0x4d'),_0x37f17c[_0x56eb('0x1a')]),'penalty':0x0,'paused':_0x37f17c['chatPause'],'createdAt':_0x37f17c[_0x56eb('0x4a')],'updatedAt':_0x37f17c[_0x56eb('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x56eb('0x14')](respondWithFilteredResult(_0x42319e,_0x465fd6))['catch'](handleError(_0x42319e,null));};exports[_0x56eb('0x4e')]=function(_0x33f0d7,_0x1ddb8b){var _0x2f9d73={};var _0x4af881={};var _0x1f5cc4;var _0x4e1d33;return db[_0x56eb('0x1d')][_0x56eb('0x3a')]({'where':{'id':_0x33f0d7[_0x56eb('0x37')]['id']}})[_0x56eb('0x14')](handleEntityNotFound(_0x1ddb8b,null))[_0x56eb('0x14')](function(_0x78916a){if(_0x78916a){_0x1f5cc4=_0x78916a;_0x4af881['model']=_[_0x56eb('0x27')](db['Team'][_0x56eb('0x1e')]);_0x4af881[_0x56eb('0x26')]=_[_0x56eb('0x27')](_0x33f0d7[_0x56eb('0x26')]);_0x4af881[_0x56eb('0x3b')]=_[_0x56eb('0x28')](_0x4af881[_0x56eb('0x25')],_0x4af881[_0x56eb('0x26')]);_0x2f9d73[_0x56eb('0x29')]=_['intersection'](_0x4af881[_0x56eb('0x25')],qs[_0x56eb('0x2a')](_0x33f0d7[_0x56eb('0x26')][_0x56eb('0x2a')]));_0x2f9d73[_0x56eb('0x29')]=_0x2f9d73[_0x56eb('0x29')][_0x56eb('0x3c')]?_0x2f9d73[_0x56eb('0x29')]:_0x4af881[_0x56eb('0x25')];_0x2f9d73['order']=qs['sort'](_0x33f0d7[_0x56eb('0x26')]['sort']);_0x2f9d73[_0x56eb('0x3f')]=qs['filters'](_[_0x56eb('0x40')](_0x33f0d7[_0x56eb('0x26')],_0x4af881[_0x56eb('0x3b')]));if(_0x33f0d7['query'][_0x56eb('0x42')]){_0x2f9d73['where']=_['merge'](_0x2f9d73[_0x56eb('0x3f')],{'$or':_['map'](_0x2f9d73[_0x56eb('0x29')],function(_0x372d00){var _0x2aa39f={};_0x2aa39f[_0x372d00]={'$like':'%'+_0x33f0d7[_0x56eb('0x26')][_0x56eb('0x42')]+'%'};return _0x2aa39f;})});}_0x2f9d73=_[_0x56eb('0x43')]({},_0x2f9d73,_0x33f0d7['options']);return _0x1f5cc4['getTeams'](_0x2f9d73);}})[_0x56eb('0x14')](function(_0x1d9cf1){if(_0x1d9cf1){_0x4e1d33=_0x1d9cf1[_0x56eb('0x3c')];if(!_0x33f0d7[_0x56eb('0x26')][_0x56eb('0x4f')](_0x56eb('0x50'))){_0x2f9d73[_0x56eb('0xe')]=qs['limit'](_0x33f0d7['query'][_0x56eb('0xe')]);_0x2f9d73[_0x56eb('0x10')]=qs[_0x56eb('0x10')](_0x33f0d7[_0x56eb('0x26')]['offset']);}return _0x1f5cc4[_0x56eb('0x4e')](_0x2f9d73);}})['then'](function(_0x552dab){if(_0x552dab){return _0x552dab?{'count':_0x4e1d33,'rows':_0x552dab}:null;}})['then'](respondWithResult(_0x1ddb8b,null))[_0x56eb('0x23')](handleError(_0x1ddb8b,null));};exports['addTeams']=function(_0x5ef353,_0x26f9e4){var _0x19291a=_0x5ef353[_0x56eb('0x2f')][_0x56eb('0x51')];return db['Team']['findAll']({'where':{'id':_0x19291a},'attributes':['id'],'include':[{'model':db[_0x56eb('0x52')],'as':'Agents','attributes':['id','name',_0x56eb('0x53'),_0x56eb('0x54'),'interface'],'raw':!![]}]})[_0x56eb('0x14')](function(_0x28f19f){if(_0x28f19f){var _0x1b0653=_[_0x56eb('0x55')](_0x28f19f,function(_0xcd76c6){var _0x55d6a6=_0xcd76c6[_0x56eb('0x31')]({'plain':!![]});return _0x55d6a6['Agents'];});return db[_0x56eb('0x1d')]['find']({'where':{'id':_0x5ef353[_0x56eb('0x37')]['id']}})[_0x56eb('0x14')](function(_0x7f0a9){return db[_0x56eb('0x56')][_0x56eb('0x57')](function(_0x49087b){return _0x7f0a9[_0x56eb('0x58')](_0x19291a,{'transaction':_0x49087b})[_0x56eb('0x14')](function(){return BPromise['each'](_0x1b0653,function(_0x225ca3){return db[_0x56eb('0x59')][_0x56eb('0x5a')]({'where':{'UserId':_0x225ca3['id'],'ChatQueueId':_0x5ef353[_0x56eb('0x37')]['id']},'transaction':_0x49087b});});})[_0x56eb('0x14')](function(){_0x1b0653[_0x56eb('0x5b')](function(_0x177b19){socket[_0x56eb('0x5c')](_0x56eb('0x5d'),{'UserId':_0x177b19['id'],'ChatQueueId':_0x7f0a9['id']});});});});});}})[_0x56eb('0x14')](respondWithStatusCode(_0x26f9e4,null))[_0x56eb('0x23')](handleError(_0x26f9e4,null));};exports[_0x56eb('0x5e')]=function(_0x460af1,_0x263cc6){return db[_0x56eb('0x5f')]['findAll']({'where':{'id':_0x460af1[_0x56eb('0x26')][_0x56eb('0x51')]},'attributes':['id'],'include':[{'model':db[_0x56eb('0x52')],'as':_0x56eb('0x60'),'attributes':['id'],'raw':!![]}]})[_0x56eb('0x14')](handleEntityNotFound(_0x263cc6,null))['then'](function(_0x424bf4){var _0x4e1df8=_[_0x56eb('0x1c')](_0x424bf4,'id');var _0x2da582=[];var _0x269ae8=[];var _0x3853cc=squel['select']();_0x3853cc[_0x56eb('0x61')]('tq.TeamId')[_0x56eb('0x62')]('team_has_chat_queues','tq')[_0x56eb('0x63')]('user_has_teams','ut',_0x56eb('0x64'))[_0x56eb('0x3f')](_0x56eb('0x65'),_0x460af1['params']['id']);for(var _0x53e4f3=0x0;_0x53e4f3<_0x424bf4[_0x56eb('0x3c')];_0x53e4f3+=0x1){let _0x53c073=_0x424bf4[_0x53e4f3];for(var _0x1da986=0x0;_0x1da986<_0x53c073[_0x56eb('0x60')][_0x56eb('0x3c')];_0x1da986+=0x1){let _0x20e316=_0x53c073['Agents'][_0x1da986];var _0x39c0bb=_0x3853cc[_0x56eb('0x66')]();_0x39c0bb['where']('ut.UserId\x20=\x20?',_0x20e316['id']);_0x269ae8[_0x56eb('0x67')](db[_0x56eb('0x56')][_0x56eb('0x26')](_0x39c0bb[_0x56eb('0x68')](),{'type':db[_0x56eb('0x56')][_0x56eb('0x69')]['SELECT']})[_0x56eb('0x14')](function(_0x11c2f0){if(_0x11c2f0[_0x56eb('0x3c')]===0x1){return _0x20e316['id'];}else{var _0xd854af=_[_0x56eb('0x6a')](_[_0x56eb('0x1c')](_0x11c2f0,_0x56eb('0x6b')),function(_0x54c753){return _['includes'](_0x4e1df8,_0x54c753);});if(_0xd854af){return _0x20e316['id'];}}}));}}return BPromise[_0x56eb('0x6c')](_0x269ae8)[_0x56eb('0x14')](function(_0x2f4dc9){_0x2da582=_(_0x2da582)[_0x56eb('0x6d')](_0x2f4dc9)[_0x56eb('0x6e')]()['value']();return db[_0x56eb('0x1d')][_0x56eb('0x2d')]({'where':{'id':_0x460af1[_0x56eb('0x37')]['id']}})[_0x56eb('0x14')](function(_0xf5846f){return db['sequelize'][_0x56eb('0x57')](function(_0x1f9cd7){return _0xf5846f[_0x56eb('0x5e')](_0x460af1[_0x56eb('0x26')]['ids'],{'transaction':_0x1f9cd7})[_0x56eb('0x14')](function(){if(!_[_0x56eb('0x6f')](_0x2da582)){return _0xf5846f[_0x56eb('0x70')](_0x2da582,{'transaction':_0x1f9cd7});}})[_0x56eb('0x14')](function(){_0x2da582['forEach'](function(_0x2fc0a2){socket['emit']('userChatQueue:remove',{'UserId':_0x2fc0a2,'ChatQueueId':_0xf5846f['id']});});});});});});})[_0x56eb('0x14')](respondWithStatusCode(_0x263cc6,null))['catch'](handleError(_0x263cc6,null));};exports[_0x56eb('0x71')]=function(_0x3bb1bb,_0xda26f4){return db[_0x56eb('0x1d')][_0x56eb('0x2d')]({'where':{'id':_0x3bb1bb[_0x56eb('0x37')]['id']}})[_0x56eb('0x14')](handleEntityNotFound(_0xda26f4,null))[_0x56eb('0x14')](function(_0x1a32be){if(_0x1a32be){return _0x1a32be[_0x56eb('0x71')](_0x3bb1bb[_0x56eb('0x2f')][_0x56eb('0x51')],_[_0x56eb('0x72')](_0x3bb1bb['body'],[_0x56eb('0x51'),'id'])||{})[_0x56eb('0x73')](function(_0x1a6f74){for(var _0x4e39f8=0x0;_0x4e39f8<_0x3bb1bb[_0x56eb('0x2f')]['ids'][_0x56eb('0x3c')];_0x4e39f8+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x3bb1bb['body'][_0x56eb('0x51')][_0x4e39f8]),'ChatQueueId':Number(_0x3bb1bb[_0x56eb('0x37')]['id'])});}return _0x1a6f74;});}})[_0x56eb('0x14')](respondWithResult(_0xda26f4,null))[_0x56eb('0x23')](handleError(_0xda26f4,null));};exports[_0x56eb('0x70')]=function(_0x578615,_0x3100c6){return db['ChatQueue']['find']({'where':{'id':_0x578615[_0x56eb('0x37')]['id']}})[_0x56eb('0x14')](handleEntityNotFound(_0x3100c6,null))[_0x56eb('0x14')](function(_0x283587){if(_0x283587){return _0x283587[_0x56eb('0x70')](_0x578615[_0x56eb('0x26')][_0x56eb('0x51')])['then'](function(){if(_[_0x56eb('0x74')](_0x578615['query'][_0x56eb('0x51')])){for(var _0x35466d=0x0;_0x35466d<_0x578615[_0x56eb('0x26')][_0x56eb('0x51')][_0x56eb('0x3c')];_0x35466d+=0x1){socket[_0x56eb('0x5c')]('userChatQueue:remove',{'UserId':Number(_0x578615[_0x56eb('0x26')][_0x56eb('0x51')][_0x35466d]),'ChatQueueId':Number(_0x578615[_0x56eb('0x37')]['id'])});}}else{socket[_0x56eb('0x5c')](_0x56eb('0x75'),{'UserId':Number(_0x578615['query'][_0x56eb('0x51')]),'ChatQueueId':Number(_0x578615[_0x56eb('0x37')]['id'])});}});}})[_0x56eb('0x14')](respondWithStatusCode(_0x3100c6,null))[_0x56eb('0x23')](handleError(_0x3100c6,null));};exports[_0x56eb('0x76')]=function(_0x1b7f37,_0x3d9b16){var _0x1e9c32={};var _0x5dd989={};var _0xf8b17f;var _0x4389e5;return db[_0x56eb('0x1d')]['findOne']({'where':{'id':_0x1b7f37[_0x56eb('0x37')]['id']}})['then'](handleEntityNotFound(_0x3d9b16,null))[_0x56eb('0x14')](function(_0xc4484f){if(_0xc4484f){_0xf8b17f=_0xc4484f;_0x5dd989[_0x56eb('0x25')]=_[_0x56eb('0x27')](db[_0x56eb('0x52')][_0x56eb('0x1e')]);_0x5dd989[_0x56eb('0x26')]=_[_0x56eb('0x27')](_0x1b7f37[_0x56eb('0x26')]);_0x5dd989[_0x56eb('0x3b')]=_[_0x56eb('0x28')](_0x5dd989[_0x56eb('0x25')],_0x5dd989['query']);_0x1e9c32[_0x56eb('0x29')]=_[_0x56eb('0x28')](_0x5dd989[_0x56eb('0x25')],qs[_0x56eb('0x2a')](_0x1b7f37[_0x56eb('0x26')]['fields']));_0x1e9c32['attributes']=_0x1e9c32['attributes']['length']?_0x1e9c32[_0x56eb('0x29')]:_0x5dd989[_0x56eb('0x25')];_0x1e9c32[_0x56eb('0x3d')]=qs[_0x56eb('0x3e')](_0x1b7f37[_0x56eb('0x26')][_0x56eb('0x3e')]);_0x1e9c32[_0x56eb('0x3f')]=qs[_0x56eb('0x3b')](_[_0x56eb('0x40')](_0x1b7f37[_0x56eb('0x26')],_0x5dd989[_0x56eb('0x3b')]));if(_0x1b7f37[_0x56eb('0x26')][_0x56eb('0x42')]){_0x1e9c32[_0x56eb('0x3f')]=_[_0x56eb('0x43')](_0x1e9c32[_0x56eb('0x3f')],{'$or':_['map'](_0x1e9c32['attributes'],function(_0x8e96ad){var _0x138f94={};_0x138f94[_0x8e96ad]={'$like':'%'+_0x1b7f37[_0x56eb('0x26')][_0x56eb('0x42')]+'%'};return _0x138f94;})});}_0x1e9c32=_[_0x56eb('0x43')]({},_0x1e9c32,_0x1b7f37['options']);return _0xf8b17f[_0x56eb('0x76')](_0x1e9c32);}})[_0x56eb('0x14')](function(_0x227fa9){if(_0x227fa9){_0x4389e5=_0x227fa9[_0x56eb('0x3c')];if(!_0x1b7f37[_0x56eb('0x26')][_0x56eb('0x4f')](_0x56eb('0x50'))){_0x1e9c32[_0x56eb('0xe')]=qs[_0x56eb('0xe')](_0x1b7f37[_0x56eb('0x26')]['limit']);_0x1e9c32[_0x56eb('0x10')]=qs[_0x56eb('0x10')](_0x1b7f37[_0x56eb('0x26')][_0x56eb('0x10')]);}return _0xf8b17f[_0x56eb('0x76')](_0x1e9c32);}})[_0x56eb('0x14')](function(_0x4b45b0){if(_0x4b45b0){return _0x4b45b0?{'count':_0x4389e5,'rows':_0x4b45b0}:null;}})['then'](respondWithResult(_0x3d9b16,null))[_0x56eb('0x23')](handleError(_0x3d9b16,null));};
\ No newline at end of file
+var _0x9b1d=['describe','findOne','keys','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','UserChatQueue','findAll','findAndCountAll','agent','chatPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','Team','filter','ids','User','Agents','online','voicePause','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','value','removeAgents','addAgents','spread','isArray','userChatQueue:remove','getAgents','options','bluebird','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','then','destroy','ChatQueues','UserProfileResource','name','index','map','ChatQueue','rawAttributes','fieldName','type','getOptions','where','include','query','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','merge','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId','error','update'];(function(_0x1199a2,_0x216ec7){var _0x40e834=function(_0x5570f3){while(--_0x5570f3){_0x1199a2['push'](_0x1199a2['shift']());}};_0x40e834(++_0x216ec7);}(_0x9b1d,0xb8));var _0xd9b1=function(_0x469693,_0x289b1d){_0x469693=_0x469693-0x0;var _0x188b42=_0x9b1d[_0x469693];return _0x188b42;};'use strict';var BPromise=require(_0xd9b1('0x0'));var util=require('util');var _=require(_0xd9b1('0x1'));var squel=require(_0xd9b1('0x2'));var Redis=require(_0xd9b1('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xd9b1('0x4'))(_0xd9b1('0x5'));var config=require(_0xd9b1('0x6'));var db=require(_0xd9b1('0x7'))['db'];config['redis']=_['defaults'](config[_0xd9b1('0x8')],{'host':_0xd9b1('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9b1('0x8')]));require('./chatQueue.socket')[_0xd9b1('0xa')](socket);function respondWithStatusCode(_0x4945af,_0x40ab0f){_0x40ab0f=_0x40ab0f||0xcc;return function(_0x49d66e){if(_0x49d66e){return _0x4945af[_0xd9b1('0xb')](_0x40ab0f);}return _0x4945af['status'](_0x40ab0f)[_0xd9b1('0xc')]();};}function respondWithResult(_0x32024e,_0x6a2e8){_0x6a2e8=_0x6a2e8||0xc8;return function(_0x163147){if(_0x163147){return _0x32024e['status'](_0x6a2e8)[_0xd9b1('0xd')](_0x163147);}};}function respondWithFilteredResult(_0x367d99,_0xc736e5){return function(_0x58ef66){if(_0x58ef66){var _0x28ef36=typeof _0xc736e5[_0xd9b1('0xe')]===_0xd9b1('0xf')&&typeof _0xc736e5[_0xd9b1('0x10')]===_0xd9b1('0xf');var _0x1b200d=_0x58ef66[_0xd9b1('0x11')];var _0x2d0fde=_0x28ef36?0x0:_0xc736e5['offset'];var _0x286f8b=_0x28ef36?_0x58ef66[_0xd9b1('0x11')]:_0xc736e5[_0xd9b1('0xe')]+_0xc736e5[_0xd9b1('0x10')];var _0x38c9aa;if(_0x286f8b>=_0x1b200d){_0x286f8b=_0x1b200d;_0x38c9aa=0xc8;}else{_0x38c9aa=0xce;}_0x367d99[_0xd9b1('0x12')](_0x38c9aa);return _0x367d99['set'](_0xd9b1('0x13'),_0x2d0fde+'-'+_0x286f8b+'/'+_0x1b200d)[_0xd9b1('0xd')](_0x58ef66);}return null;};}function saveUpdates(_0x177756){return function(_0x510ad2){if(_0x510ad2){return _0x510ad2['update'](_0x177756)[_0xd9b1('0x14')](function(_0x4f62df){return _0x4f62df;});}return null;};}function removeEntity(_0x7f1620){return function(_0xcd1a2c){if(_0xcd1a2c){return _0xcd1a2c[_0xd9b1('0x15')]()['then'](function(){var _0x7ba82f=_0xcd1a2c['get']({'plain':!![]});var _0xc37540=_0xd9b1('0x16');return db[_0xd9b1('0x17')]['destroy']({'where':{'type':_0xc37540,'resourceId':_0x7ba82f['id']}})['then'](function(){return _0xcd1a2c;});})['then'](function(){_0x7f1620[_0xd9b1('0x12')](0xcc)[_0xd9b1('0xc')]();});}};}function handleEntityNotFound(_0x4fc0d2){return function(_0x3173ee){if(!_0x3173ee){_0x4fc0d2[_0xd9b1('0xb')](0x194);}return _0x3173ee;};}function handleError(_0xc86f3f,_0x1cd536){_0x1cd536=_0x1cd536||0x1f4;return function(_0x143f64){logger['error'](_0x143f64['stack']);if(_0x143f64[_0xd9b1('0x18')]){delete _0x143f64[_0xd9b1('0x18')];}_0xc86f3f[_0xd9b1('0x12')](_0x1cd536)['send'](_0x143f64);};}exports[_0xd9b1('0x19')]=function(_0x36f426,_0x4e1602){var _0x4bac87={};var _0x1ca35e={'count':0x0,'rows':[]};var _0x381357=_[_0xd9b1('0x1a')](db[_0xd9b1('0x1b')][_0xd9b1('0x1c')],function(_0x3f3d44){return{'name':_0x3f3d44[_0xd9b1('0x1d')],'type':_0x3f3d44[_0xd9b1('0x1e')]['key']};});_0x4bac87=qs[_0xd9b1('0x1f')](_0x381357,_0x36f426);var _0x32003f={'where':_0x4bac87[_0xd9b1('0x20')]};return db[_0xd9b1('0x1b')][_0xd9b1('0x11')](_0x32003f)['then'](function(_0x32b7a0){_0x1ca35e[_0xd9b1('0x11')]=_0x32b7a0;_0x4bac87[_0xd9b1('0x21')]=qs[_0xd9b1('0x21')](_0x36f426[_0xd9b1('0x22')]);return db[_0xd9b1('0x1b')]['findAll'](_0x4bac87);})[_0xd9b1('0x14')](function(_0x265970){_0x1ca35e['rows']=_0x265970;return _0x1ca35e;})[_0xd9b1('0x14')](respondWithFilteredResult(_0x4e1602,_0x4bac87))[_0xd9b1('0x23')](handleError(_0x4e1602,null));};exports[_0xd9b1('0x24')]=function(_0x1cf610,_0x2e56bb){var _0x2bd4ee={'raw':!![],'where':{'id':_0x1cf610[_0xd9b1('0x25')]['id']}},_0x460b7b={};_0x460b7b[_0xd9b1('0x26')]=_['keys'](db[_0xd9b1('0x1b')][_0xd9b1('0x1c')]);_0x460b7b[_0xd9b1('0x22')]=_['keys'](_0x1cf610['query']);_0x460b7b[_0xd9b1('0x27')]=_[_0xd9b1('0x28')](_0x460b7b[_0xd9b1('0x26')],_0x460b7b['query']);_0x2bd4ee[_0xd9b1('0x29')]=_[_0xd9b1('0x28')](_0x460b7b[_0xd9b1('0x26')],qs[_0xd9b1('0x2a')](_0x1cf610[_0xd9b1('0x22')][_0xd9b1('0x2a')]));_0x2bd4ee['attributes']=_0x2bd4ee['attributes'][_0xd9b1('0x2b')]?_0x2bd4ee['attributes']:_0x460b7b[_0xd9b1('0x26')];if(_0x1cf610[_0xd9b1('0x22')][_0xd9b1('0x2c')]){_0x2bd4ee[_0xd9b1('0x21')]=[{'all':!![]}];}_0x2bd4ee=_[_0xd9b1('0x2d')]({},_0x2bd4ee,_0x1cf610['options']);return db[_0xd9b1('0x1b')]['find'](_0x2bd4ee)[_0xd9b1('0x14')](handleEntityNotFound(_0x2e56bb,null))[_0xd9b1('0x14')](respondWithResult(_0x2e56bb,null))[_0xd9b1('0x23')](handleError(_0x2e56bb,null));};exports[_0xd9b1('0x2e')]=function(_0x5771ca,_0x5ef565){return db[_0xd9b1('0x1b')]['create'](_0x5771ca[_0xd9b1('0x2f')],{})['then'](function(_0x279e7d){var _0x41e7e7=_0x5771ca['user'][_0xd9b1('0x30')]({'plain':!![]});if(!_0x41e7e7)throw new Error(_0xd9b1('0x31'));if(_0x41e7e7['role']===_0xd9b1('0x32')){var _0xa3f761=_0x279e7d['get']({'plain':!![]});var _0x13ea6a='ChatQueues';return db[_0xd9b1('0x33')][_0xd9b1('0x34')]({'where':{'name':_0x13ea6a,'userProfileId':_0x41e7e7[_0xd9b1('0x35')]},'raw':!![]})['then'](function(_0x1679e0){if(_0x1679e0&&_0x1679e0['autoAssociation']===0x0){return db[_0xd9b1('0x17')][_0xd9b1('0x2e')]({'name':_0xa3f761[_0xd9b1('0x18')],'resourceId':_0xa3f761['id'],'type':_0x1679e0[_0xd9b1('0x18')],'sectionId':_0x1679e0['id']},{})[_0xd9b1('0x14')](function(){return _0x279e7d;});}else{return _0x279e7d;}})[_0xd9b1('0x23')](function(_0x3fec74){logger[_0xd9b1('0x36')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3fec74);throw _0x3fec74;});}return _0x279e7d;})[_0xd9b1('0x14')](respondWithResult(_0x5ef565,0xc9))[_0xd9b1('0x23')](handleError(_0x5ef565,null));};exports[_0xd9b1('0x37')]=function(_0x18cd80,_0x8c953a){if(_0x18cd80[_0xd9b1('0x2f')]['id']){delete _0x18cd80['body']['id'];}return db[_0xd9b1('0x1b')][_0xd9b1('0x34')]({'where':{'id':_0x18cd80[_0xd9b1('0x25')]['id']}})['then'](handleEntityNotFound(_0x8c953a,null))[_0xd9b1('0x14')](saveUpdates(_0x18cd80[_0xd9b1('0x2f')],null))[_0xd9b1('0x14')](respondWithResult(_0x8c953a,null))[_0xd9b1('0x23')](handleError(_0x8c953a,null));};exports[_0xd9b1('0x15')]=function(_0x2471e8,_0x23049c){return db[_0xd9b1('0x1b')]['find']({'where':{'id':_0x2471e8[_0xd9b1('0x25')]['id']}})[_0xd9b1('0x14')](handleEntityNotFound(_0x23049c,null))[_0xd9b1('0x14')](removeEntity(_0x23049c,null))[_0xd9b1('0x23')](handleError(_0x23049c,null));};exports[_0xd9b1('0x38')]=function(_0x1c9419,_0x2eef68){return db[_0xd9b1('0x1b')][_0xd9b1('0x38')]()[_0xd9b1('0x14')](respondWithResult(_0x2eef68,null))[_0xd9b1('0x23')](handleError(_0x2eef68,null));};exports['getMembers']=function(_0x330300,_0x5119c4){var _0x341ab2={'raw':!![],'where':{}},_0x16ac91={},_0x930a32;return db[_0xd9b1('0x1b')][_0xd9b1('0x39')]({'where':{'id':_0x330300['params']['id']}})[_0xd9b1('0x14')](handleEntityNotFound(_0x5119c4,null))[_0xd9b1('0x14')](function(_0x26c075){if(_0x26c075){_0x930a32=_0x26c075[_0xd9b1('0x30')]({'plain':!![]});_0x16ac91[_0xd9b1('0x26')]=_[_0xd9b1('0x3a')](db['UserChatQueue'][_0xd9b1('0x1c')]);_0x16ac91[_0xd9b1('0x22')]=_['keys'](_0x330300[_0xd9b1('0x22')]);_0x16ac91['filters']=_['intersection'](_0x16ac91[_0xd9b1('0x26')],_0x16ac91[_0xd9b1('0x22')]);_0x341ab2[_0xd9b1('0x29')]=_['intersection'](_0x16ac91[_0xd9b1('0x26')],qs[_0xd9b1('0x2a')](_0x330300['query']['fields']));_0x341ab2[_0xd9b1('0x29')]=_0x341ab2['attributes'][_0xd9b1('0x2b')]?_0x341ab2[_0xd9b1('0x29')]:_0x16ac91[_0xd9b1('0x26')];if(!_0x330300[_0xd9b1('0x22')][_0xd9b1('0x3b')](_0xd9b1('0x3c'))){_0x341ab2[_0xd9b1('0x10')]=qs[_0xd9b1('0x10')](_0x330300[_0xd9b1('0x22')]['limit']);_0x341ab2[_0xd9b1('0xe')]=qs[_0xd9b1('0xe')](_0x330300['query'][_0xd9b1('0xe')]);}_0x341ab2[_0xd9b1('0x3d')]=qs[_0xd9b1('0x3e')](_0x330300[_0xd9b1('0x22')][_0xd9b1('0x3e')]);_0x341ab2[_0xd9b1('0x20')]=qs[_0xd9b1('0x27')](_[_0xd9b1('0x3f')](_0x330300['query'],_0x16ac91['filters']));_0x341ab2[_0xd9b1('0x20')][_0xd9b1('0x40')]=_0x26c075['id'];if(_0x330300[_0xd9b1('0x22')]['filter']){_0x341ab2[_0xd9b1('0x20')]=_[_0xd9b1('0x2d')](_0x341ab2[_0xd9b1('0x20')],{'$or':_[_0xd9b1('0x1a')](_0x341ab2[_0xd9b1('0x29')],function(_0x22675c){var _0x4aac71={};_0x4aac71[_0x22675c]={'$like':'%'+_0x330300[_0xd9b1('0x22')]['filter']+'%'};return _0x4aac71;})});}_0x341ab2=_[_0xd9b1('0x2d')]({},_0x341ab2,_0x330300['options']);return db[_0xd9b1('0x41')][_0xd9b1('0x42')](_0x341ab2);}})[_0xd9b1('0x14')](function(_0x46bdd6){if(_0x46bdd6){return db['User'][_0xd9b1('0x43')]({'where':{'id':_[_0xd9b1('0x1a')](_0x46bdd6,'UserId'),'role':_0xd9b1('0x44')},'attributes':['id',_0xd9b1('0x18'),_0xd9b1('0x45'),_0xd9b1('0x46'),'createdAt']});}})[_0xd9b1('0x14')](function(_0x493c3d){if(_0x493c3d){return{'count':_0x493c3d[_0xd9b1('0x11')],'rows':_[_0xd9b1('0x1a')](_0x493c3d[_0xd9b1('0x47')],function(_0x2b614f){return{'membername':_0x2b614f[_0xd9b1('0x18')],'UserId':_0x2b614f['id'],'queue_name':_0x930a32['name'],'ChatQueueId':_0x930a32['id'],'interface':util[_0xd9b1('0x48')](_0xd9b1('0x49'),_0xd9b1('0x4a'),_0x2b614f['name']),'penalty':0x0,'paused':_0x2b614f[_0xd9b1('0x45')],'createdAt':_0x2b614f[_0xd9b1('0x4b')],'updatedAt':_0x2b614f[_0xd9b1('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9b1('0x14')](respondWithFilteredResult(_0x5119c4,_0x341ab2))['catch'](handleError(_0x5119c4,null));};exports[_0xd9b1('0x4c')]=function(_0x2b9bf8,_0x31e49d){var _0x43a2ea={};var _0xdb690d={};var _0x29fbd9;var _0x387b33;return db[_0xd9b1('0x1b')][_0xd9b1('0x39')]({'where':{'id':_0x2b9bf8[_0xd9b1('0x25')]['id']}})[_0xd9b1('0x14')](handleEntityNotFound(_0x31e49d,null))[_0xd9b1('0x14')](function(_0x5c8ad9){if(_0x5c8ad9){_0x29fbd9=_0x5c8ad9;_0xdb690d[_0xd9b1('0x26')]=_[_0xd9b1('0x3a')](db[_0xd9b1('0x4d')][_0xd9b1('0x1c')]);_0xdb690d[_0xd9b1('0x22')]=_[_0xd9b1('0x3a')](_0x2b9bf8[_0xd9b1('0x22')]);_0xdb690d[_0xd9b1('0x27')]=_['intersection'](_0xdb690d['model'],_0xdb690d[_0xd9b1('0x22')]);_0x43a2ea['attributes']=_[_0xd9b1('0x28')](_0xdb690d[_0xd9b1('0x26')],qs[_0xd9b1('0x2a')](_0x2b9bf8[_0xd9b1('0x22')]['fields']));_0x43a2ea[_0xd9b1('0x29')]=_0x43a2ea[_0xd9b1('0x29')][_0xd9b1('0x2b')]?_0x43a2ea[_0xd9b1('0x29')]:_0xdb690d[_0xd9b1('0x26')];_0x43a2ea['order']=qs[_0xd9b1('0x3e')](_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0x3e')]);_0x43a2ea[_0xd9b1('0x20')]=qs[_0xd9b1('0x27')](_['pick'](_0x2b9bf8[_0xd9b1('0x22')],_0xdb690d[_0xd9b1('0x27')]));if(_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0x4e')]){_0x43a2ea[_0xd9b1('0x20')]=_['merge'](_0x43a2ea[_0xd9b1('0x20')],{'$or':_['map'](_0x43a2ea['attributes'],function(_0x160b71){var _0x3a636c={};_0x3a636c[_0x160b71]={'$like':'%'+_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0x4e')]+'%'};return _0x3a636c;})});}_0x43a2ea=_[_0xd9b1('0x2d')]({},_0x43a2ea,_0x2b9bf8['options']);return _0x29fbd9['getTeams'](_0x43a2ea);}})['then'](function(_0x1186cd){if(_0x1186cd){_0x387b33=_0x1186cd['length'];if(!_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0x3b')](_0xd9b1('0x3c'))){_0x43a2ea[_0xd9b1('0x10')]=qs[_0xd9b1('0x10')](_0x2b9bf8[_0xd9b1('0x22')]['limit']);_0x43a2ea[_0xd9b1('0xe')]=qs[_0xd9b1('0xe')](_0x2b9bf8[_0xd9b1('0x22')][_0xd9b1('0xe')]);}return _0x29fbd9[_0xd9b1('0x4c')](_0x43a2ea);}})[_0xd9b1('0x14')](function(_0x89cc0a){if(_0x89cc0a){return _0x89cc0a?{'count':_0x387b33,'rows':_0x89cc0a}:null;}})[_0xd9b1('0x14')](respondWithResult(_0x31e49d,null))[_0xd9b1('0x23')](handleError(_0x31e49d,null));};exports['addTeams']=function(_0x3d173c,_0x2d5f65){var _0x4a11b2=_0x3d173c['body'][_0xd9b1('0x4f')];return db['Team'][_0xd9b1('0x42')]({'where':{'id':_0x4a11b2},'attributes':['id'],'include':[{'model':db[_0xd9b1('0x50')],'as':_0xd9b1('0x51'),'attributes':['id',_0xd9b1('0x18'),_0xd9b1('0x52'),_0xd9b1('0x53'),'interface'],'raw':!![]}]})[_0xd9b1('0x14')](function(_0x58571b){if(_0x58571b){var _0x2c2915=_[_0xd9b1('0x54')](_0x58571b,function(_0x20592e){var _0x21b572=_0x20592e[_0xd9b1('0x30')]({'plain':!![]});return _0x21b572[_0xd9b1('0x51')];});return db[_0xd9b1('0x1b')][_0xd9b1('0x34')]({'where':{'id':_0x3d173c[_0xd9b1('0x25')]['id']}})['then'](function(_0x3ffd10){return db[_0xd9b1('0x55')][_0xd9b1('0x56')](function(_0x41d195){return _0x3ffd10[_0xd9b1('0x57')](_0x4a11b2,{'transaction':_0x41d195})[_0xd9b1('0x14')](function(){return BPromise[_0xd9b1('0x58')](_0x2c2915,function(_0x237310){return db[_0xd9b1('0x41')][_0xd9b1('0x59')]({'where':{'UserId':_0x237310['id'],'ChatQueueId':_0x3d173c[_0xd9b1('0x25')]['id']},'transaction':_0x41d195});});})[_0xd9b1('0x14')](function(){_0x2c2915[_0xd9b1('0x5a')](function(_0x28dbb5){socket[_0xd9b1('0x5b')](_0xd9b1('0x5c'),{'UserId':_0x28dbb5['id'],'ChatQueueId':_0x3ffd10['id']});});});});});}})[_0xd9b1('0x14')](respondWithStatusCode(_0x2d5f65,null))[_0xd9b1('0x23')](handleError(_0x2d5f65,null));};exports[_0xd9b1('0x5d')]=function(_0x519959,_0xf22845){return db[_0xd9b1('0x4d')]['findAll']({'where':{'id':_0x519959[_0xd9b1('0x22')][_0xd9b1('0x4f')]},'attributes':['id'],'include':[{'model':db[_0xd9b1('0x50')],'as':_0xd9b1('0x51'),'attributes':['id'],'raw':!![]}]})[_0xd9b1('0x14')](handleEntityNotFound(_0xf22845,null))[_0xd9b1('0x14')](function(_0x2e22d2){var _0x3e88c7=_['map'](_0x2e22d2,'id');var _0x4b51a4=[];var _0x4829f9=[];var _0x1fb26b=squel[_0xd9b1('0x5e')]();_0x1fb26b[_0xd9b1('0x5f')](_0xd9b1('0x60'))[_0xd9b1('0x61')]('team_has_chat_queues','tq')[_0xd9b1('0x62')](_0xd9b1('0x63'),'ut',_0xd9b1('0x64'))[_0xd9b1('0x20')](_0xd9b1('0x65'),_0x519959['params']['id']);for(var _0x747777=0x0;_0x747777<_0x2e22d2['length'];_0x747777+=0x1){let _0x3f1637=_0x2e22d2[_0x747777];for(var _0x577299=0x0;_0x577299<_0x3f1637[_0xd9b1('0x51')]['length'];_0x577299+=0x1){let _0x103b1d=_0x3f1637[_0xd9b1('0x51')][_0x577299];var _0x4aeab5=_0x1fb26b[_0xd9b1('0x66')]();_0x4aeab5[_0xd9b1('0x20')](_0xd9b1('0x67'),_0x103b1d['id']);_0x4829f9[_0xd9b1('0x68')](db[_0xd9b1('0x55')][_0xd9b1('0x22')](_0x4aeab5[_0xd9b1('0x69')](),{'type':db['sequelize'][_0xd9b1('0x6a')][_0xd9b1('0x6b')]})[_0xd9b1('0x14')](function(_0x6e75c7){if(_0x6e75c7[_0xd9b1('0x2b')]===0x1){return _0x103b1d['id'];}else{var _0x2a8858=_['every'](_[_0xd9b1('0x1a')](_0x6e75c7,_0xd9b1('0x6c')),function(_0x1c98b6){return _[_0xd9b1('0x6d')](_0x3e88c7,_0x1c98b6);});if(_0x2a8858){return _0x103b1d['id'];}}}));}}return BPromise[_0xd9b1('0x6e')](_0x4829f9)[_0xd9b1('0x14')](function(_0x2ae438){_0x4b51a4=_(_0x4b51a4)[_0xd9b1('0x6f')](_0x2ae438)['compact']()[_0xd9b1('0x70')]();return db[_0xd9b1('0x1b')][_0xd9b1('0x34')]({'where':{'id':_0x519959[_0xd9b1('0x25')]['id']}})['then'](function(_0x4730c7){return db[_0xd9b1('0x55')][_0xd9b1('0x56')](function(_0x2cea14){return _0x4730c7[_0xd9b1('0x5d')](_0x519959[_0xd9b1('0x22')][_0xd9b1('0x4f')],{'transaction':_0x2cea14})[_0xd9b1('0x14')](function(){if(!_['isEmpty'](_0x4b51a4)){return _0x4730c7[_0xd9b1('0x71')](_0x4b51a4,{'transaction':_0x2cea14});}})[_0xd9b1('0x14')](function(){_0x4b51a4['forEach'](function(_0x743f80){socket[_0xd9b1('0x5b')]('userChatQueue:remove',{'UserId':_0x743f80,'ChatQueueId':_0x4730c7['id']});});});});});});})[_0xd9b1('0x14')](respondWithStatusCode(_0xf22845,null))[_0xd9b1('0x23')](handleError(_0xf22845,null));};exports[_0xd9b1('0x72')]=function(_0x44ea1b,_0x56ef97){return db['ChatQueue']['find']({'where':{'id':_0x44ea1b[_0xd9b1('0x25')]['id']}})[_0xd9b1('0x14')](handleEntityNotFound(_0x56ef97,null))[_0xd9b1('0x14')](function(_0x274dba){if(_0x274dba){return _0x274dba[_0xd9b1('0x72')](_0x44ea1b['body'][_0xd9b1('0x4f')],_['omit'](_0x44ea1b[_0xd9b1('0x2f')],[_0xd9b1('0x4f'),'id'])||{})[_0xd9b1('0x73')](function(_0x18f9a2){for(var _0x21421b=0x0;_0x21421b<_0x44ea1b['body']['ids'][_0xd9b1('0x2b')];_0x21421b+=0x1){socket[_0xd9b1('0x5b')]('userChatQueue:save',{'UserId':Number(_0x44ea1b[_0xd9b1('0x2f')][_0xd9b1('0x4f')][_0x21421b]),'ChatQueueId':Number(_0x44ea1b['params']['id'])});}return _0x18f9a2;});}})[_0xd9b1('0x14')](respondWithResult(_0x56ef97,null))['catch'](handleError(_0x56ef97,null));};exports[_0xd9b1('0x71')]=function(_0x40900a,_0x3e748a){return db[_0xd9b1('0x1b')][_0xd9b1('0x34')]({'where':{'id':_0x40900a[_0xd9b1('0x25')]['id']}})['then'](handleEntityNotFound(_0x3e748a,null))[_0xd9b1('0x14')](function(_0x2463ca){if(_0x2463ca){return _0x2463ca[_0xd9b1('0x71')](_0x40900a['query'][_0xd9b1('0x4f')])[_0xd9b1('0x14')](function(){if(_[_0xd9b1('0x74')](_0x40900a['query'][_0xd9b1('0x4f')])){for(var _0x10407b=0x0;_0x10407b<_0x40900a['query'][_0xd9b1('0x4f')][_0xd9b1('0x2b')];_0x10407b+=0x1){socket[_0xd9b1('0x5b')](_0xd9b1('0x75'),{'UserId':Number(_0x40900a[_0xd9b1('0x22')]['ids'][_0x10407b]),'ChatQueueId':Number(_0x40900a[_0xd9b1('0x25')]['id'])});}}else{socket[_0xd9b1('0x5b')](_0xd9b1('0x75'),{'UserId':Number(_0x40900a[_0xd9b1('0x22')][_0xd9b1('0x4f')]),'ChatQueueId':Number(_0x40900a['params']['id'])});}});}})[_0xd9b1('0x14')](respondWithStatusCode(_0x3e748a,null))[_0xd9b1('0x23')](handleError(_0x3e748a,null));};exports[_0xd9b1('0x76')]=function(_0x507793,_0x1af87f){var _0x5eb5a2={};var _0x5a0395={};var _0x575f8a;var _0x5d07e1;return db[_0xd9b1('0x1b')][_0xd9b1('0x39')]({'where':{'id':_0x507793[_0xd9b1('0x25')]['id']}})['then'](handleEntityNotFound(_0x1af87f,null))[_0xd9b1('0x14')](function(_0x253635){if(_0x253635){_0x575f8a=_0x253635;_0x5a0395[_0xd9b1('0x26')]=_[_0xd9b1('0x3a')](db['User'][_0xd9b1('0x1c')]);_0x5a0395['query']=_['keys'](_0x507793['query']);_0x5a0395[_0xd9b1('0x27')]=_[_0xd9b1('0x28')](_0x5a0395[_0xd9b1('0x26')],_0x5a0395[_0xd9b1('0x22')]);_0x5eb5a2['attributes']=_[_0xd9b1('0x28')](_0x5a0395[_0xd9b1('0x26')],qs[_0xd9b1('0x2a')](_0x507793[_0xd9b1('0x22')][_0xd9b1('0x2a')]));_0x5eb5a2['attributes']=_0x5eb5a2[_0xd9b1('0x29')][_0xd9b1('0x2b')]?_0x5eb5a2[_0xd9b1('0x29')]:_0x5a0395[_0xd9b1('0x26')];_0x5eb5a2[_0xd9b1('0x3d')]=qs[_0xd9b1('0x3e')](_0x507793[_0xd9b1('0x22')]['sort']);_0x5eb5a2[_0xd9b1('0x20')]=qs['filters'](_[_0xd9b1('0x3f')](_0x507793[_0xd9b1('0x22')],_0x5a0395[_0xd9b1('0x27')]));if(_0x507793['query'][_0xd9b1('0x4e')]){_0x5eb5a2[_0xd9b1('0x20')]=_[_0xd9b1('0x2d')](_0x5eb5a2['where'],{'$or':_[_0xd9b1('0x1a')](_0x5eb5a2[_0xd9b1('0x29')],function(_0x53d2f1){var _0x887e61={};_0x887e61[_0x53d2f1]={'$like':'%'+_0x507793[_0xd9b1('0x22')]['filter']+'%'};return _0x887e61;})});}_0x5eb5a2=_[_0xd9b1('0x2d')]({},_0x5eb5a2,_0x507793[_0xd9b1('0x77')]);return _0x575f8a[_0xd9b1('0x76')](_0x5eb5a2);}})['then'](function(_0x25a974){if(_0x25a974){_0x5d07e1=_0x25a974['length'];if(!_0x507793[_0xd9b1('0x22')]['hasOwnProperty'](_0xd9b1('0x3c'))){_0x5eb5a2[_0xd9b1('0x10')]=qs['limit'](_0x507793[_0xd9b1('0x22')][_0xd9b1('0x10')]);_0x5eb5a2[_0xd9b1('0xe')]=qs[_0xd9b1('0xe')](_0x507793[_0xd9b1('0x22')][_0xd9b1('0xe')]);}return _0x575f8a[_0xd9b1('0x76')](_0x5eb5a2);}})[_0xd9b1('0x14')](function(_0x25fbcf){if(_0x25fbcf){return _0x25fbcf?{'count':_0x5d07e1,'rows':_0x25fbcf}:null;}})[_0xd9b1('0x14')](respondWithResult(_0x1af87f,null))[_0xd9b1('0x23')](handleError(_0x1af87f,null));};
\ No newline at end of file
index cc6c6a5..4ff066c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb47b=['events','../../mysqldb','ChatQueue','save','update','emit','hook'];(function(_0x14e82b,_0xedbe76){var _0x152348=function(_0x461f87){while(--_0x461f87){_0x14e82b['push'](_0x14e82b['shift']());}};_0x152348(++_0xedbe76);}(_0xb47b,0x157));var _0xbb47=function(_0x16a8c9,_0x4742ba){_0x16a8c9=_0x16a8c9-0x0;var _0x3b701a=_0xb47b[_0x16a8c9];return _0x3b701a;};'use strict';var EventEmitter=require(_0xbb47('0x0'));var ChatQueue=require(_0xbb47('0x1'))['db'][_0xbb47('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbb47('0x3'),'afterUpdate':_0xbb47('0x4'),'afterDestroy':'remove'};function emitEvent(_0x278d34){return function(_0x1686ee,_0x435f42,_0xb451f){ChatQueueEvents[_0xbb47('0x5')](_0x278d34+':'+_0x1686ee['id'],_0x1686ee);ChatQueueEvents[_0xbb47('0x5')](_0x278d34,_0x1686ee);_0xb451f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xbb47('0x6')](e,emitEvent(event));}}module['exports']=ChatQueueEvents;
\ No newline at end of file
+var _0x0002=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners'];(function(_0x18d9d2,_0x5e0e1c){var _0x2d9739=function(_0x28201d){while(--_0x28201d){_0x18d9d2['push'](_0x18d9d2['shift']());}};_0x2d9739(++_0x5e0e1c);}(_0x0002,0x8e));var _0x2000=function(_0x5b214b,_0x4bd6d1){_0x5b214b=_0x5b214b-0x0;var _0xc8d63b=_0x0002[_0x5b214b];return _0xc8d63b;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0x2000('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x2000('0x1')](0x0);var events={'afterCreate':_0x2000('0x2'),'afterUpdate':_0x2000('0x3'),'afterDestroy':_0x2000('0x4')};function emitEvent(_0x5ac7c3){return function(_0x46353c,_0x57a71f,_0x12ebe1){ChatQueueEvents[_0x2000('0x5')](_0x5ac7c3+':'+_0x46353c['id'],_0x46353c);ChatQueueEvents[_0x2000('0x5')](_0x5ac7c3,_0x46353c);_0x12ebe1(null);};}for(var e in events){if(events[_0x2000('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module[_0x2000('0x7')]=ChatQueueEvents;
\ No newline at end of file
index 6e7842c..5a4f9a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x969f=['define','ChatQueue','../../config/logger','bluebird','request-promise','../../config/environment','exports'];(function(_0x436572,_0x3dc862){var _0x38319b=function(_0x53d983){while(--_0x53d983){_0x436572['push'](_0x436572['shift']());}};_0x38319b(++_0x3dc862);}(_0x969f,0x72));var _0xf969=function(_0x4b043b,_0x598b17){_0x4b043b=_0x4b043b-0x0;var _0x398f5a=_0x969f[_0x4b043b];return _0x398f5a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf969('0x0'))('api');var moment=require('moment');var BPromise=require(_0xf969('0x1'));var rp=require(_0xf969('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf969('0x3'));var attributes=require('./chatQueue.attributes');module[_0xf969('0x4')]=function(_0x1d766a,_0x409d32){return _0x1d766a[_0xf969('0x5')](_0xf969('0x6'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd1dc=['util','api','moment','request-promise','./chatQueue.attributes','define','ChatQueue','lodash'];(function(_0x41e8da,_0x23b529){var _0x26260e=function(_0x52f2b9){while(--_0x52f2b9){_0x41e8da['push'](_0x41e8da['shift']());}};_0x26260e(++_0x23b529);}(_0xd1dc,0x147));var _0xcd1d=function(_0xd25b59,_0x217f8a){_0xd25b59=_0xd25b59-0x0;var _0x4cab47=_0xd1dc[_0xd25b59];return _0x4cab47;};'use strict';var _=require(_0xcd1d('0x0'));var util=require(_0xcd1d('0x1'));var logger=require('../../config/logger')(_0xcd1d('0x2'));var moment=require(_0xcd1d('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xcd1d('0x5'));module['exports']=function(_0x5bc728,_0x390319){return _0x5bc728[_0xcd1d('0x6')](_0xcd1d('0x7'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 004a13c..2160b01 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7400=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','then','ShowChatQueue','find','raw','util','moment'];(function(_0x2b9138,_0x482c5f){var _0x9a18ab=function(_0x151b53){while(--_0x151b53){_0x2b9138['push'](_0x2b9138['shift']());}};_0x9a18ab(++_0x482c5f);}(_0x7400,0x1d7));var _0x0740=function(_0x2fa9ef,_0x11eb49){_0x2fa9ef=_0x2fa9ef-0x0;var _0x40a7db=_0x7400[_0x2fa9ef];return _0x40a7db;};'use strict';var _=require('lodash');var util=require(_0x0740('0x0'));var moment=require(_0x0740('0x1'));var BPromise=require(_0x0740('0x2'));var rs=require(_0x0740('0x3'));var fs=require('fs');var Redis=require(_0x0740('0x4'));var db=require(_0x0740('0x5'))['db'];var utils=require(_0x0740('0x6'));var logger=require(_0x0740('0x7'))(_0x0740('0x8'));var config=require(_0x0740('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0740('0xa')][_0x0740('0xb')]({'port':0x232a});config['redis']=_[_0x0740('0xc')](config[_0x0740('0xd')],{'host':_0x0740('0xe'),'port':0x18eb});var socket=require(_0x0740('0xf'))(new Redis(config[_0x0740('0xd')]));require('./chatQueue.socket')[_0x0740('0x10')](socket);function respondWithRpcPromise(_0x224ffc,_0x18a9be,_0x13fe8d){return new BPromise(function(_0x284b9f,_0x8b295a){return client[_0x0740('0x11')](_0x224ffc,_0x13fe8d)['then'](function(_0x1d308c){logger[_0x0740('0x12')]('ChatQueue,\x20%s,\x20%s',_0x18a9be,_0x0740('0x13'));logger[_0x0740('0x14')](_0x0740('0x15'),_0x18a9be,_0x0740('0x13'),JSON[_0x0740('0x16')](_0x1d308c));if(_0x1d308c[_0x0740('0x17')]){if(_0x1d308c[_0x0740('0x17')][_0x0740('0x18')]===0x1f4){logger['error']('ChatQueue,\x20%s,\x20%s',_0x18a9be,_0x1d308c[_0x0740('0x17')][_0x0740('0x19')]);return _0x8b295a(_0x1d308c[_0x0740('0x17')][_0x0740('0x19')]);}logger['error'](_0x0740('0x1a'),_0x18a9be,_0x1d308c[_0x0740('0x17')][_0x0740('0x19')]);return _0x284b9f(_0x1d308c[_0x0740('0x17')][_0x0740('0x19')]);}else{logger[_0x0740('0x12')]('ChatQueue,\x20%s,\x20%s',_0x18a9be,_0x0740('0x13'));_0x284b9f(_0x1d308c[_0x0740('0x1b')][_0x0740('0x19')]);}})[_0x0740('0x1c')](function(_0x57cec3){logger[_0x0740('0x17')](_0x0740('0x1a'),_0x18a9be,_0x57cec3);_0x8b295a(_0x57cec3);});});}exports[_0x0740('0x1d')]=function(_0x3e9c32){var _0x448f12=this;return new Promise(function(_0x1c15f8,_0x3ceb7d){return db[_0x0740('0x1e')][_0x0740('0x1f')]({'raw':_0x3e9c32[_0x0740('0x20')]?_0x3e9c32[_0x0740('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x3e9c32[_0x0740('0x20')]?_0x3e9c32[_0x0740('0x20')][_0x0740('0x21')]||null:null,'attributes':_0x3e9c32['options']?_0x3e9c32[_0x0740('0x20')][_0x0740('0x22')]||null:null,'limit':_0x3e9c32[_0x0740('0x20')]?_0x3e9c32[_0x0740('0x20')][_0x0740('0x23')]||null:null,'include':_0x3e9c32['options']?_0x3e9c32[_0x0740('0x20')][_0x0740('0x24')]?_[_0x0740('0x25')](_0x3e9c32['options']['include'],function(_0x4964a1){return{'model':db[_0x4964a1[_0x0740('0x26')]],'as':_0x4964a1['as'],'attributes':_0x4964a1[_0x0740('0x22')],'include':_0x4964a1[_0x0740('0x24')]?_[_0x0740('0x25')](_0x4964a1[_0x0740('0x24')],function(_0x4004d9){return{'model':db[_0x4004d9[_0x0740('0x26')]],'as':_0x4004d9['as'],'attributes':_0x4004d9[_0x0740('0x22')],'include':_0x4004d9[_0x0740('0x24')]?_[_0x0740('0x25')](_0x4004d9[_0x0740('0x24')],function(_0x3b11dc){return{'model':db[_0x3b11dc[_0x0740('0x26')]],'as':_0x3b11dc['as'],'attributes':_0x3b11dc[_0x0740('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0740('0x27')](function(_0x1ea4e8){logger[_0x0740('0x12')]('GetChatQueue',_0x3e9c32);logger[_0x0740('0x14')](_0x0740('0x1d'),_0x3e9c32,JSON[_0x0740('0x16')](_0x1ea4e8));_0x1c15f8(_0x1ea4e8);})['catch'](function(_0x2eed03){logger[_0x0740('0x17')]('GetChatQueue',_0x2eed03[_0x0740('0x19')],_0x3e9c32);_0x3ceb7d(_0x448f12[_0x0740('0x17')](0x1f4,_0x2eed03['message']));});});};exports[_0x0740('0x28')]=function(_0x17e8c3){var _0x4b2202=this;return new Promise(function(_0x3029e1,_0x5af496){return db[_0x0740('0x1e')][_0x0740('0x29')]({'raw':_0x17e8c3[_0x0740('0x20')]?_0x17e8c3['options'][_0x0740('0x2a')]===undefined?!![]:![]:!![],'where':_0x17e8c3['options']?_0x17e8c3[_0x0740('0x20')][_0x0740('0x21')]||null:null,'attributes':_0x17e8c3[_0x0740('0x20')]?_0x17e8c3[_0x0740('0x20')][_0x0740('0x22')]||null:null,'include':_0x17e8c3[_0x0740('0x20')]?_0x17e8c3[_0x0740('0x20')][_0x0740('0x24')]?_[_0x0740('0x25')](_0x17e8c3[_0x0740('0x20')][_0x0740('0x24')],function(_0xa1db17){return{'model':db[_0xa1db17[_0x0740('0x26')]],'as':_0xa1db17['as'],'attributes':_0xa1db17[_0x0740('0x22')],'include':_0xa1db17['include']?_[_0x0740('0x25')](_0xa1db17['include'],function(_0xafc96b){return{'model':db[_0xafc96b[_0x0740('0x26')]],'as':_0xafc96b['as'],'attributes':_0xafc96b['attributes'],'include':_0xafc96b[_0x0740('0x24')]?_[_0x0740('0x25')](_0xafc96b['include'],function(_0x10e3bf){return{'model':db[_0x10e3bf[_0x0740('0x26')]],'as':_0x10e3bf['as'],'attributes':_0x10e3bf[_0x0740('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3cd074){logger[_0x0740('0x12')]('ShowChatQueue',_0x17e8c3);logger[_0x0740('0x14')](_0x0740('0x28'),_0x17e8c3,JSON[_0x0740('0x16')](_0x3cd074));_0x3029e1(_0x3cd074);})[_0x0740('0x1c')](function(_0x52a6ab){logger[_0x0740('0x17')]('ShowChatQueue',_0x52a6ab[_0x0740('0x19')],_0x17e8c3);_0x5af496(_0x4b2202[_0x0740('0x17')](0x1f4,_0x52a6ab[_0x0740('0x19')]));});});};
\ No newline at end of file
+var _0x8f71=['redis','defaults','socket.io-emitter','./chatQueue.socket','register','request','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','ChatQueue,\x20%s,\x20%s','message','result','findAll','options','raw','where','attributes','limit','include','model','map','GetChatQueue','catch','ShowChatQueue','ChatQueue','stringify','util','moment','randomstring','../../mysqldb','rpc','jayson/promise','client','http'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x8f71,0x1e6));var _0x18f7=function(_0x16db8d,_0x3b7798){_0x16db8d=_0x16db8d-0x0;var _0x43aa6c=_0x8f71[_0x16db8d];return _0x43aa6c;};'use strict';var _=require('lodash');var util=require(_0x18f7('0x0'));var moment=require(_0x18f7('0x1'));var BPromise=require('bluebird');var rs=require(_0x18f7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18f7('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x18f7('0x4'));var config=require('../../config/environment');var jayson=require(_0x18f7('0x5'));var client=jayson[_0x18f7('0x6')][_0x18f7('0x7')]({'port':0x232a});config[_0x18f7('0x8')]=_[_0x18f7('0x9')](config[_0x18f7('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x18f7('0xa'))(new Redis(config[_0x18f7('0x8')]));require(_0x18f7('0xb'))[_0x18f7('0xc')](socket);function respondWithRpcPromise(_0x565c32,_0x3e765c,_0x3c4464){return new BPromise(function(_0x4dab47,_0x40c7b8){return client[_0x18f7('0xd')](_0x565c32,_0x3c4464)[_0x18f7('0xe')](function(_0x6d486d){logger[_0x18f7('0xf')]('ChatQueue,\x20%s,\x20%s',_0x3e765c,_0x18f7('0x10'));logger[_0x18f7('0x11')](_0x18f7('0x12'),_0x3e765c,_0x18f7('0x10'),JSON['stringify'](_0x6d486d));if(_0x6d486d[_0x18f7('0x13')]){if(_0x6d486d[_0x18f7('0x13')][_0x18f7('0x14')]===0x1f4){logger[_0x18f7('0x13')](_0x18f7('0x15'),_0x3e765c,_0x6d486d['error'][_0x18f7('0x16')]);return _0x40c7b8(_0x6d486d[_0x18f7('0x13')][_0x18f7('0x16')]);}logger[_0x18f7('0x13')](_0x18f7('0x15'),_0x3e765c,_0x6d486d[_0x18f7('0x13')][_0x18f7('0x16')]);return _0x4dab47(_0x6d486d[_0x18f7('0x13')][_0x18f7('0x16')]);}else{logger['info'](_0x18f7('0x15'),_0x3e765c,'request\x20sent');_0x4dab47(_0x6d486d[_0x18f7('0x17')][_0x18f7('0x16')]);}})['catch'](function(_0x22f584){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3e765c,_0x22f584);_0x40c7b8(_0x22f584);});});}exports['GetChatQueue']=function(_0x1d7362){var _0x4aadaa=this;return new Promise(function(_0x4cebcc,_0x176c24){return db['ChatQueue'][_0x18f7('0x18')]({'raw':_0x1d7362[_0x18f7('0x19')]?_0x1d7362[_0x18f7('0x19')][_0x18f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x1d7362[_0x18f7('0x19')]?_0x1d7362['options'][_0x18f7('0x1b')]||null:null,'attributes':_0x1d7362[_0x18f7('0x19')]?_0x1d7362['options'][_0x18f7('0x1c')]||null:null,'limit':_0x1d7362['options']?_0x1d7362[_0x18f7('0x19')][_0x18f7('0x1d')]||null:null,'include':_0x1d7362[_0x18f7('0x19')]?_0x1d7362[_0x18f7('0x19')][_0x18f7('0x1e')]?_['map'](_0x1d7362[_0x18f7('0x19')][_0x18f7('0x1e')],function(_0x2f5d67){return{'model':db[_0x2f5d67[_0x18f7('0x1f')]],'as':_0x2f5d67['as'],'attributes':_0x2f5d67[_0x18f7('0x1c')],'include':_0x2f5d67['include']?_[_0x18f7('0x20')](_0x2f5d67[_0x18f7('0x1e')],function(_0x167b7e){return{'model':db[_0x167b7e[_0x18f7('0x1f')]],'as':_0x167b7e['as'],'attributes':_0x167b7e[_0x18f7('0x1c')],'include':_0x167b7e[_0x18f7('0x1e')]?_['map'](_0x167b7e[_0x18f7('0x1e')],function(_0x132293){return{'model':db[_0x132293['model']],'as':_0x132293['as'],'attributes':_0x132293['attributes']};}):[]};}):[]};}):[]:[]})[_0x18f7('0xe')](function(_0x18e938){logger[_0x18f7('0xf')]('GetChatQueue',_0x1d7362);logger[_0x18f7('0x11')](_0x18f7('0x21'),_0x1d7362,JSON['stringify'](_0x18e938));_0x4cebcc(_0x18e938);})[_0x18f7('0x22')](function(_0x184079){logger[_0x18f7('0x13')](_0x18f7('0x21'),_0x184079[_0x18f7('0x16')],_0x1d7362);_0x176c24(_0x4aadaa['error'](0x1f4,_0x184079[_0x18f7('0x16')]));});});};exports[_0x18f7('0x23')]=function(_0x46662d){var _0x3d90c2=this;return new Promise(function(_0x2f6772,_0x5f0acf){return db[_0x18f7('0x24')]['find']({'raw':_0x46662d[_0x18f7('0x19')]?_0x46662d[_0x18f7('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x46662d[_0x18f7('0x19')]?_0x46662d['options'][_0x18f7('0x1b')]||null:null,'attributes':_0x46662d['options']?_0x46662d['options'][_0x18f7('0x1c')]||null:null,'include':_0x46662d['options']?_0x46662d[_0x18f7('0x19')][_0x18f7('0x1e')]?_['map'](_0x46662d[_0x18f7('0x19')]['include'],function(_0x492202){return{'model':db[_0x492202[_0x18f7('0x1f')]],'as':_0x492202['as'],'attributes':_0x492202[_0x18f7('0x1c')],'include':_0x492202[_0x18f7('0x1e')]?_[_0x18f7('0x20')](_0x492202[_0x18f7('0x1e')],function(_0x153e2b){return{'model':db[_0x153e2b[_0x18f7('0x1f')]],'as':_0x153e2b['as'],'attributes':_0x153e2b['attributes'],'include':_0x153e2b[_0x18f7('0x1e')]?_[_0x18f7('0x20')](_0x153e2b['include'],function(_0x172590){return{'model':db[_0x172590[_0x18f7('0x1f')]],'as':_0x172590['as'],'attributes':_0x172590[_0x18f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x18f7('0xe')](function(_0xf43895){logger[_0x18f7('0xf')](_0x18f7('0x23'),_0x46662d);logger[_0x18f7('0x11')](_0x18f7('0x23'),_0x46662d,JSON[_0x18f7('0x25')](_0xf43895));_0x2f6772(_0xf43895);})[_0x18f7('0x22')](function(_0x2bdafe){logger[_0x18f7('0x13')](_0x18f7('0x23'),_0x2bdafe[_0x18f7('0x16')],_0x46662d);_0x5f0acf(_0x3d90c2[_0x18f7('0x13')](0x1f4,_0x2bdafe['message']));});});};
\ No newline at end of file
index 61ed53e..f3af22d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3667=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x5cea7c,_0x1d1f88){var _0x3d6c6f=function(_0x3fd4fb){while(--_0x3fd4fb){_0x5cea7c['push'](_0x5cea7c['shift']());}};_0x3d6c6f(++_0x1d1f88);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var ChatQueueEvents=require(_0x7366('0x0'));var events=[_0x7366('0x1'),_0x7366('0x2'),_0x7366('0x3')];function createListener(_0x3c601d,_0x5d1072){return function(_0x27a90d){_0x5d1072[_0x7366('0x4')](_0x3c601d,_0x27a90d);};}function removeListener(_0x4b32a7,_0x27726b){return function(){ChatQueueEvents[_0x7366('0x5')](_0x4b32a7,_0x27726b);};}exports[_0x7366('0x6')]=function(_0x1c0cf4){for(var _0x101e3d=0x0,_0x589397=events[_0x7366('0x7')];_0x101e3d<_0x589397;_0x101e3d++){var _0xa1a3c5=events[_0x101e3d];var _0x2dd32b=createListener(_0x7366('0x8')+_0xa1a3c5,_0x1c0cf4);ChatQueueEvents['on'](_0xa1a3c5,_0x2dd32b);}};
\ No newline at end of file
+var _0x6aa7=['update','emit','length','chatQueue:','./chatQueue.events','remove'];(function(_0x5a3b09,_0x24a4a3){var _0x46298a=function(_0x20e887){while(--_0x20e887){_0x5a3b09['push'](_0x5a3b09['shift']());}};_0x46298a(++_0x24a4a3);}(_0x6aa7,0x178));var _0x76aa=function(_0x516c35,_0x229264){_0x516c35=_0x516c35-0x0;var _0x4feef9=_0x6aa7[_0x516c35];return _0x4feef9;};'use strict';var ChatQueueEvents=require(_0x76aa('0x0'));var events=['save',_0x76aa('0x1'),_0x76aa('0x2')];function createListener(_0x25c818,_0x2db4fe){return function(_0x4f007e){_0x2db4fe[_0x76aa('0x3')](_0x25c818,_0x4f007e);};}function removeListener(_0xef15ef,_0x1d6e04){return function(){ChatQueueEvents['removeListener'](_0xef15ef,_0x1d6e04);};}exports['register']=function(_0x1aceaa){for(var _0x4d53f6=0x0,_0x32dee5=events[_0x76aa('0x4')];_0x4d53f6<_0x32dee5;_0x4d53f6++){var _0xa9b695=events[_0x4d53f6];var _0x56d6bc=createListener(_0x76aa('0x5')+_0xa9b695,_0x1aceaa);ChatQueueEvents['on'](_0xa9b695,_0x56d6bc);}};
\ No newline at end of file
index 0efeb9a..c2e3789 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fc3=['update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','create','addTeams','put'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5fc3,0xa8));var _0x35fc=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x5fc3[_0xb833b1];return _0x1ab87a;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/describe',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0x9')]('/:id/members',auth[_0x35fc('0xa')](),controller[_0x35fc('0xe')]);router['get'](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller['getTeams']);router[_0x35fc('0x9')](_0x35fc('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0x35fc('0x11')]('/',auth['isAuthenticated'](),controller[_0x35fc('0x12')]);router[_0x35fc('0x11')](_0x35fc('0xf'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x13')]);router['post']('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x35fc('0x14')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0x15')]);router[_0x35fc('0x16')](_0x35fc('0xc'),auth['isAuthenticated'](),controller[_0x35fc('0x17')]);router[_0x35fc('0x16')]('/:id/teams',auth[_0x35fc('0xa')](),controller[_0x35fc('0x18')]);router[_0x35fc('0x16')]('/:id/users',auth[_0x35fc('0xa')](),controller[_0x35fc('0x19')]);module[_0x35fc('0x1a')]=router;
\ No newline at end of file
+var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x366aef,_0x361e9e){var _0x2549c1=function(_0x4a4d06){while(--_0x4a4d06){_0x366aef['push'](_0x366aef['shift']());}};_0x2549c1(++_0x361e9e);}(_0x7217,0x19e));var _0x7721=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7217[_0x5b561d];return _0x431060;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router;
\ No newline at end of file
index 29bf2d4..b5b83e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb416=['sequelize','STRING','DATE','moment'];(function(_0x5315a8,_0x4e8cb3){var _0x5a2afc=function(_0x270b3b){while(--_0x270b3b){_0x5315a8['push'](_0x5315a8['shift']());}};_0x5a2afc(++_0x4e8cb3);}(_0xb416,0x173));var _0x6b41=function(_0x3d20e5,_0x15dd50){_0x3d20e5=_0x3d20e5-0x0;var _0xc855c9=_0xb416[_0x3d20e5];return _0xc855c9;};'use strict';var moment=require(_0x6b41('0x0'));var Sequelize=require(_0x6b41('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x6b41('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x6b41('0x2')]},'joinAt':{'type':Sequelize[_0x6b41('0x3')]},'leaveAt':{'type':Sequelize[_0x6b41('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6b41('0x3')]},'reason':{'type':Sequelize[_0x6b41('0x2')]}};
\ No newline at end of file
+var _0x8f35=['sequelize','STRING','DATE','moment'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x8f35,0x107));var _0x58f3=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x8f35[_0x231e16];return _0x570a7c;};'use strict';var moment=require(_0x58f3('0x0'));var Sequelize=require(_0x58f3('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x58f3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x58f3('0x2')]},'joinAt':{'type':Sequelize[_0x58f3('0x3')]},'leaveAt':{'type':Sequelize[_0x58f3('0x3')]},'acceptAt':{'type':Sequelize[_0x58f3('0x3')]},'exitAt':{'type':Sequelize[_0x58f3('0x3')]},'reason':{'type':Sequelize[_0x58f3('0x2')]}};
\ No newline at end of file
index 97ca737..b725590 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0c9=['ChatQueueReport','findAll','rows','catch','show','params','includeAll','include','options','find','create','body','destroy','eml-format','rimraf','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','end','error','name','send','rawAttributes','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xd0c9,0xe2));var _0x9d0c=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd0c9[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x9d0c('0x0'));var rimraf=require(_0x9d0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9d0c('0x2'));var BPromise=require(_0x9d0c('0x3'));var Mustache=require(_0x9d0c('0x4'));var util=require('util');var path=require(_0x9d0c('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9d0c('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9d0c('0x7'));var squel=require(_0x9d0c('0x8'));var crypto=require(_0x9d0c('0x9'));var jsforce=require(_0x9d0c('0xa'));var deskjs=require(_0x9d0c('0xb'));var toCsv=require(_0x9d0c('0xc'));var querystring=require('querystring');var Papa=require(_0x9d0c('0xd'));var Redis=require('ioredis');var authService=require(_0x9d0c('0xe'));var qs=require(_0x9d0c('0xf'));var as=require(_0x9d0c('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9d0c('0x11'))(_0x9d0c('0x12'));var utils=require(_0x9d0c('0x13'));var config=require(_0x9d0c('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d0c('0x15'))['db'];function respondWithStatusCode(_0x575341,_0x191b79){_0x191b79=_0x191b79||0xcc;return function(_0x17e43b){if(_0x17e43b){return _0x575341[_0x9d0c('0x16')](_0x191b79);}return _0x575341[_0x9d0c('0x17')](_0x191b79)['end']();};}function respondWithResult(_0x5b1b42,_0x52ff64){_0x52ff64=_0x52ff64||0xc8;return function(_0x2b7885){if(_0x2b7885){return _0x5b1b42['status'](_0x52ff64)[_0x9d0c('0x18')](_0x2b7885);}};}function respondWithFilteredResult(_0x261be7,_0x2b20ca){return function(_0x275bb0){if(_0x275bb0){var _0x40e4e7=typeof _0x2b20ca[_0x9d0c('0x19')]===_0x9d0c('0x1a')&&typeof _0x2b20ca[_0x9d0c('0x1b')]==='undefined';var _0x4514fd=_0x275bb0[_0x9d0c('0x1c')];var _0x599ddb=_0x40e4e7?0x0:_0x2b20ca[_0x9d0c('0x19')];var _0x182dfb=_0x40e4e7?_0x275bb0[_0x9d0c('0x1c')]:_0x2b20ca['offset']+_0x2b20ca['limit'];var _0x11832a;if(_0x182dfb>=_0x4514fd){_0x182dfb=_0x4514fd;_0x11832a=0xc8;}else{_0x11832a=0xce;}_0x261be7[_0x9d0c('0x17')](_0x11832a);return _0x261be7['set'](_0x9d0c('0x1d'),_0x599ddb+'-'+_0x182dfb+'/'+_0x4514fd)[_0x9d0c('0x18')](_0x275bb0);}return null;};}function patchUpdates(_0xf60863){return function(_0x174ce3){try{jsonpatch[_0x9d0c('0x1e')](_0x174ce3,_0xf60863,!![]);}catch(_0x5b53d9){return BPromise[_0x9d0c('0x1f')](_0x5b53d9);}return _0x174ce3['save']();};}function saveUpdates(_0x1ff3f0,_0x17390f){return function(_0x52049b){if(_0x52049b){return _0x52049b[_0x9d0c('0x20')](_0x1ff3f0)[_0x9d0c('0x21')](function(_0x41d0a8){return _0x41d0a8;});}return null;};}function removeEntity(_0x4ab375,_0x2a1a70){return function(_0x280b22){if(_0x280b22){return _0x280b22['destroy']()[_0x9d0c('0x21')](function(){_0x4ab375[_0x9d0c('0x17')](0xcc)[_0x9d0c('0x22')]();});}};}function handleEntityNotFound(_0x35b60f,_0x472f95){return function(_0xb176f9){if(!_0xb176f9){_0x35b60f[_0x9d0c('0x16')](0x194);}return _0xb176f9;};}function handleError(_0x48b65b,_0x46b647){_0x46b647=_0x46b647||0x1f4;return function(_0x1f35a5){logger[_0x9d0c('0x23')](_0x1f35a5['stack']);if(_0x1f35a5[_0x9d0c('0x24')]){delete _0x1f35a5[_0x9d0c('0x24')];}_0x48b65b[_0x9d0c('0x17')](_0x46b647)[_0x9d0c('0x25')](_0x1f35a5);};}exports['index']=function(_0x12d75f,_0x46955f){var _0x1846f0={},_0x2cbbbc={},_0x4ed782={'count':0x0,'rows':[]};var _0x5bf51b=_['map'](db['ChatQueueReport'][_0x9d0c('0x26')],function(_0x263482){return{'name':_0x263482[_0x9d0c('0x27')],'type':_0x263482[_0x9d0c('0x28')]['key']};});_0x2cbbbc['model']=_[_0x9d0c('0x29')](_0x5bf51b,_0x9d0c('0x24'));_0x2cbbbc[_0x9d0c('0x2a')]=_[_0x9d0c('0x2b')](_0x12d75f[_0x9d0c('0x2a')]);_0x2cbbbc[_0x9d0c('0x2c')]=_['intersection'](_0x2cbbbc[_0x9d0c('0x2d')],_0x2cbbbc[_0x9d0c('0x2a')]);_0x1846f0[_0x9d0c('0x2e')]=_[_0x9d0c('0x2f')](_0x2cbbbc[_0x9d0c('0x2d')],qs[_0x9d0c('0x30')](_0x12d75f['query']['fields']));_0x1846f0['attributes']=_0x1846f0[_0x9d0c('0x2e')][_0x9d0c('0x31')]?_0x1846f0['attributes']:_0x2cbbbc[_0x9d0c('0x2d')];if(!_0x12d75f['query'][_0x9d0c('0x32')]('nolimit')){_0x1846f0['limit']=qs[_0x9d0c('0x1b')](_0x12d75f['query'][_0x9d0c('0x1b')]);_0x1846f0[_0x9d0c('0x19')]=qs['offset'](_0x12d75f[_0x9d0c('0x2a')][_0x9d0c('0x19')]);}_0x1846f0[_0x9d0c('0x33')]=qs['sort'](_0x12d75f[_0x9d0c('0x2a')][_0x9d0c('0x34')]);_0x1846f0[_0x9d0c('0x35')]=qs[_0x9d0c('0x2c')](_[_0x9d0c('0x36')](_0x12d75f[_0x9d0c('0x2a')],_0x2cbbbc[_0x9d0c('0x2c')]),_0x5bf51b);if(_0x12d75f[_0x9d0c('0x2a')]['filter']){_0x1846f0[_0x9d0c('0x35')]=_[_0x9d0c('0x37')](_0x1846f0['where'],{'$or':_[_0x9d0c('0x29')](_0x5bf51b,function(_0x346462){if(_0x346462[_0x9d0c('0x28')]!==_0x9d0c('0x38')){var _0x4935f2={};_0x4935f2[_0x346462[_0x9d0c('0x24')]]={'$like':'%'+_0x12d75f[_0x9d0c('0x2a')][_0x9d0c('0x39')]+'%'};return _0x4935f2;}})});}_0x1846f0=_[_0x9d0c('0x37')]({},_0x1846f0,_0x12d75f['options']);var _0x528517={'where':_0x1846f0[_0x9d0c('0x35')]};return db[_0x9d0c('0x3a')][_0x9d0c('0x1c')](_0x528517)['then'](function(_0x17a5bc){_0x4ed782[_0x9d0c('0x1c')]=_0x17a5bc;if(_0x12d75f[_0x9d0c('0x2a')]['includeAll']){_0x1846f0['include']=[{'all':!![]}];}return db[_0x9d0c('0x3a')][_0x9d0c('0x3b')](_0x1846f0);})[_0x9d0c('0x21')](function(_0x1a28fc){_0x4ed782[_0x9d0c('0x3c')]=_0x1a28fc;return _0x4ed782;})[_0x9d0c('0x21')](respondWithFilteredResult(_0x46955f,_0x1846f0))[_0x9d0c('0x3d')](handleError(_0x46955f,null));};exports[_0x9d0c('0x3e')]=function(_0x20473b,_0x454e01){var _0x3a88af={'raw':!![],'where':{'id':_0x20473b[_0x9d0c('0x3f')]['id']}},_0x3b2554={};_0x3b2554[_0x9d0c('0x2d')]=_[_0x9d0c('0x2b')](db[_0x9d0c('0x3a')][_0x9d0c('0x26')]);_0x3b2554[_0x9d0c('0x2a')]=_['keys'](_0x20473b[_0x9d0c('0x2a')]);_0x3b2554[_0x9d0c('0x2c')]=_[_0x9d0c('0x2f')](_0x3b2554[_0x9d0c('0x2d')],_0x3b2554[_0x9d0c('0x2a')]);_0x3a88af[_0x9d0c('0x2e')]=_['intersection'](_0x3b2554[_0x9d0c('0x2d')],qs['fields'](_0x20473b[_0x9d0c('0x2a')][_0x9d0c('0x30')]));_0x3a88af['attributes']=_0x3a88af[_0x9d0c('0x2e')][_0x9d0c('0x31')]?_0x3a88af[_0x9d0c('0x2e')]:_0x3b2554[_0x9d0c('0x2d')];if(_0x20473b[_0x9d0c('0x2a')][_0x9d0c('0x40')]){_0x3a88af[_0x9d0c('0x41')]=[{'all':!![]}];}_0x3a88af=_[_0x9d0c('0x37')]({},_0x3a88af,_0x20473b[_0x9d0c('0x42')]);return db[_0x9d0c('0x3a')][_0x9d0c('0x43')](_0x3a88af)[_0x9d0c('0x21')](handleEntityNotFound(_0x454e01,null))[_0x9d0c('0x21')](respondWithResult(_0x454e01,null))[_0x9d0c('0x3d')](handleError(_0x454e01,null));};exports[_0x9d0c('0x44')]=function(_0x575b66,_0x4ea9c6){return db[_0x9d0c('0x3a')][_0x9d0c('0x44')](_0x575b66[_0x9d0c('0x45')],{})[_0x9d0c('0x21')](respondWithResult(_0x4ea9c6,0xc9))['catch'](handleError(_0x4ea9c6,null));};exports[_0x9d0c('0x20')]=function(_0x6b2dcf,_0x38a61d){if(_0x6b2dcf[_0x9d0c('0x45')]['id']){delete _0x6b2dcf['body']['id'];}return db[_0x9d0c('0x3a')][_0x9d0c('0x43')]({'where':{'id':_0x6b2dcf[_0x9d0c('0x3f')]['id']}})[_0x9d0c('0x21')](handleEntityNotFound(_0x38a61d,null))[_0x9d0c('0x21')](saveUpdates(_0x6b2dcf[_0x9d0c('0x45')],null))[_0x9d0c('0x21')](respondWithResult(_0x38a61d,null))[_0x9d0c('0x3d')](handleError(_0x38a61d,null));};exports[_0x9d0c('0x46')]=function(_0xb0c06,_0xbabbd1){return db[_0x9d0c('0x3a')][_0x9d0c('0x43')]({'where':{'id':_0xb0c06[_0x9d0c('0x3f')]['id']}})['then'](handleEntityNotFound(_0xbabbd1,null))['then'](removeEntity(_0xbabbd1,null))['catch'](handleError(_0xbabbd1,null));};exports['describe']=function(_0x838eff,_0x5afa46){return db[_0x9d0c('0x3a')]['describe']()['then'](respondWithResult(_0x5afa46,null))[_0x9d0c('0x3d')](handleError(_0x5afa46,null));};
\ No newline at end of file
+var _0x627e=['limit','count','set','reject','save','then','destroy','error','stack','name','index','ChatQueueReport','fieldName','key','map','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','rows','catch','params','fields','length','includeAll','include','find','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x4e5771,_0x42d424){var _0x281a54=function(_0x231c62){while(--_0x231c62){_0x4e5771['push'](_0x4e5771['shift']());}};_0x281a54(++_0x42d424);}(_0x627e,0x14a));var _0xe627=function(_0x122980,_0x133e47){_0x122980=_0x122980-0x0;var _0x2f78cb=_0x627e[_0x122980];return _0x2f78cb;};'use strict';var emlformat=require(_0xe627('0x0'));var rimraf=require(_0xe627('0x1'));var zipdir=require(_0xe627('0x2'));var jsonpatch=require(_0xe627('0x3'));var rp=require(_0xe627('0x4'));var moment=require('moment');var BPromise=require(_0xe627('0x5'));var Mustache=require(_0xe627('0x6'));var util=require(_0xe627('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe627('0x8'));var fs=require('fs');var fs_extra=require(_0xe627('0x9'));var _=require(_0xe627('0xa'));var squel=require(_0xe627('0xb'));var crypto=require(_0xe627('0xc'));var jsforce=require(_0xe627('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe627('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe627('0xf'));var authService=require(_0xe627('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe627('0x11'));var logger=require(_0xe627('0x12'))(_0xe627('0x13'));var utils=require(_0xe627('0x14'));var config=require(_0xe627('0x15'));var licenseUtil=require(_0xe627('0x16'));var db=require(_0xe627('0x17'))['db'];function respondWithStatusCode(_0x3919be,_0x1922f5){_0x1922f5=_0x1922f5||0xcc;return function(_0x582190){if(_0x582190){return _0x3919be[_0xe627('0x18')](_0x1922f5);}return _0x3919be[_0xe627('0x19')](_0x1922f5)[_0xe627('0x1a')]();};}function respondWithResult(_0x4be370,_0x42dd1c){_0x42dd1c=_0x42dd1c||0xc8;return function(_0x1e2e62){if(_0x1e2e62){return _0x4be370[_0xe627('0x19')](_0x42dd1c)[_0xe627('0x1b')](_0x1e2e62);}};}function respondWithFilteredResult(_0x62896f,_0x6a9a15){return function(_0x271325){if(_0x271325){var _0x54720a=typeof _0x6a9a15[_0xe627('0x1c')]===_0xe627('0x1d')&&typeof _0x6a9a15[_0xe627('0x1e')]===_0xe627('0x1d');var _0x403982=_0x271325[_0xe627('0x1f')];var _0x56559b=_0x54720a?0x0:_0x6a9a15[_0xe627('0x1c')];var _0x538b22=_0x54720a?_0x271325[_0xe627('0x1f')]:_0x6a9a15['offset']+_0x6a9a15[_0xe627('0x1e')];var _0x565213;if(_0x538b22>=_0x403982){_0x538b22=_0x403982;_0x565213=0xc8;}else{_0x565213=0xce;}_0x62896f['status'](_0x565213);return _0x62896f[_0xe627('0x20')]('Content-Range',_0x56559b+'-'+_0x538b22+'/'+_0x403982)[_0xe627('0x1b')](_0x271325);}return null;};}function patchUpdates(_0x3391ce){return function(_0x4adde7){try{jsonpatch['apply'](_0x4adde7,_0x3391ce,!![]);}catch(_0x4ecfa6){return BPromise[_0xe627('0x21')](_0x4ecfa6);}return _0x4adde7[_0xe627('0x22')]();};}function saveUpdates(_0x4e3338,_0x708a8a){return function(_0x33cb27){if(_0x33cb27){return _0x33cb27['update'](_0x4e3338)[_0xe627('0x23')](function(_0x29221b){return _0x29221b;});}return null;};}function removeEntity(_0x52d492,_0x42f3d1){return function(_0x19adbc){if(_0x19adbc){return _0x19adbc[_0xe627('0x24')]()['then'](function(){_0x52d492[_0xe627('0x19')](0xcc)[_0xe627('0x1a')]();});}};}function handleEntityNotFound(_0x1a5081,_0x3ddd8d){return function(_0x4b9ff9){if(!_0x4b9ff9){_0x1a5081[_0xe627('0x18')](0x194);}return _0x4b9ff9;};}function handleError(_0x1fe192,_0x1635a0){_0x1635a0=_0x1635a0||0x1f4;return function(_0x29eb8e){logger[_0xe627('0x25')](_0x29eb8e[_0xe627('0x26')]);if(_0x29eb8e[_0xe627('0x27')]){delete _0x29eb8e[_0xe627('0x27')];}_0x1fe192[_0xe627('0x19')](_0x1635a0)['send'](_0x29eb8e);};}exports[_0xe627('0x28')]=function(_0x5aeba1,_0x5cd7c8){var _0x1e0bd7={},_0xdf63c8={},_0x5799a3={'count':0x0,'rows':[]};var _0x39c23f=_['map'](db[_0xe627('0x29')]['rawAttributes'],function(_0x262253){return{'name':_0x262253[_0xe627('0x2a')],'type':_0x262253['type'][_0xe627('0x2b')]};});_0xdf63c8['model']=_[_0xe627('0x2c')](_0x39c23f,_0xe627('0x27'));_0xdf63c8[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x5aeba1[_0xe627('0x2d')]);_0xdf63c8[_0xe627('0x2f')]=_[_0xe627('0x30')](_0xdf63c8[_0xe627('0x31')],_0xdf63c8[_0xe627('0x2d')]);_0x1e0bd7[_0xe627('0x32')]=_[_0xe627('0x30')](_0xdf63c8['model'],qs['fields'](_0x5aeba1[_0xe627('0x2d')]['fields']));_0x1e0bd7[_0xe627('0x32')]=_0x1e0bd7['attributes']['length']?_0x1e0bd7[_0xe627('0x32')]:_0xdf63c8['model'];if(!_0x5aeba1['query'][_0xe627('0x33')](_0xe627('0x34'))){_0x1e0bd7[_0xe627('0x1e')]=qs['limit'](_0x5aeba1['query']['limit']);_0x1e0bd7[_0xe627('0x1c')]=qs['offset'](_0x5aeba1[_0xe627('0x2d')][_0xe627('0x1c')]);}_0x1e0bd7['order']=qs[_0xe627('0x35')](_0x5aeba1[_0xe627('0x2d')]['sort']);_0x1e0bd7[_0xe627('0x36')]=qs[_0xe627('0x2f')](_[_0xe627('0x37')](_0x5aeba1[_0xe627('0x2d')],_0xdf63c8[_0xe627('0x2f')]),_0x39c23f);if(_0x5aeba1[_0xe627('0x2d')]['filter']){_0x1e0bd7[_0xe627('0x36')]=_['merge'](_0x1e0bd7[_0xe627('0x36')],{'$or':_['map'](_0x39c23f,function(_0xe90eda){if(_0xe90eda[_0xe627('0x38')]!==_0xe627('0x39')){var _0x21a533={};_0x21a533[_0xe90eda[_0xe627('0x27')]]={'$like':'%'+_0x5aeba1[_0xe627('0x2d')][_0xe627('0x3a')]+'%'};return _0x21a533;}})});}_0x1e0bd7=_[_0xe627('0x3b')]({},_0x1e0bd7,_0x5aeba1[_0xe627('0x3c')]);var _0x415a25={'where':_0x1e0bd7[_0xe627('0x36')]};return db[_0xe627('0x29')][_0xe627('0x1f')](_0x415a25)['then'](function(_0x4ddff5){_0x5799a3['count']=_0x4ddff5;if(_0x5aeba1['query']['includeAll']){_0x1e0bd7['include']=[{'all':!![]}];}return db[_0xe627('0x29')]['findAll'](_0x1e0bd7);})[_0xe627('0x23')](function(_0x59cd6a){_0x5799a3[_0xe627('0x3d')]=_0x59cd6a;return _0x5799a3;})[_0xe627('0x23')](respondWithFilteredResult(_0x5cd7c8,_0x1e0bd7))[_0xe627('0x3e')](handleError(_0x5cd7c8,null));};exports['show']=function(_0x58e110,_0x26064c){var _0x5f3374={'raw':!![],'where':{'id':_0x58e110[_0xe627('0x3f')]['id']}},_0x5e352e={};_0x5e352e['model']=_[_0xe627('0x2e')](db['ChatQueueReport']['rawAttributes']);_0x5e352e[_0xe627('0x2d')]=_[_0xe627('0x2e')](_0x58e110[_0xe627('0x2d')]);_0x5e352e['filters']=_['intersection'](_0x5e352e[_0xe627('0x31')],_0x5e352e['query']);_0x5f3374['attributes']=_[_0xe627('0x30')](_0x5e352e[_0xe627('0x31')],qs[_0xe627('0x40')](_0x58e110[_0xe627('0x2d')][_0xe627('0x40')]));_0x5f3374[_0xe627('0x32')]=_0x5f3374['attributes'][_0xe627('0x41')]?_0x5f3374[_0xe627('0x32')]:_0x5e352e['model'];if(_0x58e110['query'][_0xe627('0x42')]){_0x5f3374[_0xe627('0x43')]=[{'all':!![]}];}_0x5f3374=_[_0xe627('0x3b')]({},_0x5f3374,_0x58e110[_0xe627('0x3c')]);return db[_0xe627('0x29')][_0xe627('0x44')](_0x5f3374)[_0xe627('0x23')](handleEntityNotFound(_0x26064c,null))['then'](respondWithResult(_0x26064c,null))[_0xe627('0x3e')](handleError(_0x26064c,null));};exports['create']=function(_0x648456,_0xcd19f5){return db[_0xe627('0x29')]['create'](_0x648456[_0xe627('0x45')],{})['then'](respondWithResult(_0xcd19f5,0xc9))[_0xe627('0x3e')](handleError(_0xcd19f5,null));};exports[_0xe627('0x46')]=function(_0x375e05,_0x30e057){if(_0x375e05[_0xe627('0x45')]['id']){delete _0x375e05['body']['id'];}return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x375e05[_0xe627('0x3f')]['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x30e057,null))[_0xe627('0x23')](saveUpdates(_0x375e05[_0xe627('0x45')],null))[_0xe627('0x23')](respondWithResult(_0x30e057,null))[_0xe627('0x3e')](handleError(_0x30e057,null));};exports[_0xe627('0x24')]=function(_0x3824da,_0x550b74){return db[_0xe627('0x29')][_0xe627('0x44')]({'where':{'id':_0x3824da['params']['id']}})[_0xe627('0x23')](handleEntityNotFound(_0x550b74,null))[_0xe627('0x23')](removeEntity(_0x550b74,null))['catch'](handleError(_0x550b74,null));};exports[_0xe627('0x47')]=function(_0x3a827e,_0x542a4c){return db[_0xe627('0x29')][_0xe627('0x47')]()['then'](respondWithResult(_0x542a4c,null))[_0xe627('0x3e')](handleError(_0x542a4c,null));};
\ No newline at end of file
index e0d5942..b14c683 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x216b79,_0x3a8fc0){var _0xd42888=function(_0x39426d){while(--_0x39426d){_0x216b79['push'](_0x216b79['shift']());}};_0xd42888(++_0x3a8fc0);}(_0x757a,0xde));var _0xa757=function(_0x5bacec,_0x3e3ebc){_0x5bacec=_0x5bacec-0x0;var _0x31bcb5=_0x757a[_0x5bacec];return _0x31bcb5;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index 1f36473..55b7f83 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d98=['then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw','update','body','where','attributes','UpdateChatQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','request'];(function(_0x2e2ca8,_0x557dbb){var _0x841668=function(_0x448bf9){while(--_0x448bf9){_0x2e2ca8['push'](_0x2e2ca8['shift']());}};_0x841668(++_0x557dbb);}(_0x7d98,0xe7));var _0x87d9=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0x7d98[_0x23be51];return _0x47a26d;};'use strict';var _=require(_0x87d9('0x0'));var util=require('util');var moment=require(_0x87d9('0x1'));var BPromise=require(_0x87d9('0x2'));var rs=require(_0x87d9('0x3'));var fs=require('fs');var Redis=require(_0x87d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x87d9('0x5'));var logger=require(_0x87d9('0x6'))('rpc');var config=require(_0x87d9('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3fe56d,_0x24c05f,_0x2dc542){return new BPromise(function(_0x5f2693,_0x2aa885){return client[_0x87d9('0x8')](_0x3fe56d,_0x2dc542)[_0x87d9('0x9')](function(_0x545f4f){logger[_0x87d9('0xa')](_0x87d9('0xb'),_0x24c05f,_0x87d9('0xc'));logger[_0x87d9('0xd')](_0x87d9('0xe'),_0x24c05f,_0x87d9('0xc'),JSON[_0x87d9('0xf')](_0x545f4f));if(_0x545f4f[_0x87d9('0x10')]){if(_0x545f4f[_0x87d9('0x10')][_0x87d9('0x11')]===0x1f4){logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);return _0x2aa885(_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);}logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x545f4f[_0x87d9('0x10')][_0x87d9('0x12')]);return _0x5f2693(_0x545f4f['error']['message']);}else{logger[_0x87d9('0xa')](_0x87d9('0xb'),_0x24c05f,_0x87d9('0xc'));_0x5f2693(_0x545f4f['result']['message']);}})[_0x87d9('0x13')](function(_0x109d61){logger[_0x87d9('0x10')](_0x87d9('0xb'),_0x24c05f,_0x109d61);_0x2aa885(_0x109d61);});});}exports[_0x87d9('0x14')]=function(_0xebc1eb){var _0x3ad8d5=this;return new Promise(function(_0x1f33a3,_0x6cbbca){return db[_0x87d9('0x15')][_0x87d9('0x16')](_0xebc1eb['body'],{'raw':_0xebc1eb[_0x87d9('0x17')]?_0xebc1eb['options'][_0x87d9('0x18')]===undefined?!![]:![]:!![]})[_0x87d9('0x9')](function(_0x334d31){logger['info']('CreateChatQueueReport',_0xebc1eb);logger['debug'](_0x87d9('0x14'),_0xebc1eb,JSON[_0x87d9('0xf')](_0x334d31));_0x1f33a3(_0x334d31);})[_0x87d9('0x13')](function(_0x6ab839){logger[_0x87d9('0x10')](_0x87d9('0x14'),_0x6ab839[_0x87d9('0x12')],_0xebc1eb);_0x6cbbca(_0x3ad8d5[_0x87d9('0x10')](0x1f4,_0x6ab839[_0x87d9('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x31e1b2){var _0x3e23b1=this;return new Promise(function(_0x40a7ed,_0xb2a651){return db[_0x87d9('0x15')][_0x87d9('0x19')](_0x31e1b2[_0x87d9('0x1a')],{'raw':_0x31e1b2[_0x87d9('0x17')]?_0x31e1b2['options'][_0x87d9('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31e1b2[_0x87d9('0x17')]?_0x31e1b2[_0x87d9('0x17')][_0x87d9('0x1b')]||null:null,'attributes':_0x31e1b2['options']?_0x31e1b2[_0x87d9('0x17')][_0x87d9('0x1c')]||null:null,'limit':_0x31e1b2[_0x87d9('0x17')]?_0x31e1b2[_0x87d9('0x17')]['limit']||null:null})[_0x87d9('0x9')](function(_0x3c0283){logger[_0x87d9('0xa')]('UpdateChatQueueReport',_0x31e1b2);logger[_0x87d9('0xd')](_0x87d9('0x1d'),_0x31e1b2,JSON['stringify'](_0x3c0283));_0x40a7ed(_0x3c0283);})['catch'](function(_0x4f13db){logger[_0x87d9('0x10')](_0x87d9('0x1d'),_0x4f13db['message'],_0x31e1b2);_0xb2a651(_0x3e23b1[_0x87d9('0x10')](0x1f4,_0x4f13db['message']));});});};
\ No newline at end of file
+var _0xc5a8=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateChatQueueReport','body','options','raw','stringify','UpdateChatQueueReport','ChatQueueReport','update','where','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x40646e,_0x2b7664){var _0x5911a0=function(_0xea0d93){while(--_0xea0d93){_0x40646e['push'](_0x40646e['shift']());}};_0x5911a0(++_0x2b7664);}(_0xc5a8,0x11a));var _0x8c5a=function(_0x5efffe,_0x195199){_0x5efffe=_0x5efffe-0x0;var _0x409f8e=_0xc5a8[_0x5efffe];return _0x409f8e;};'use strict';var _=require(_0x8c5a('0x0'));var util=require(_0x8c5a('0x1'));var moment=require(_0x8c5a('0x2'));var BPromise=require(_0x8c5a('0x3'));var rs=require(_0x8c5a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c5a('0x5'));var logger=require(_0x8c5a('0x6'))(_0x8c5a('0x7'));var config=require('../../config/environment');var jayson=require(_0x8c5a('0x8'));var client=jayson[_0x8c5a('0x9')][_0x8c5a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b0cca,_0x20353b,_0x549bc3){return new BPromise(function(_0x2ade80,_0x1a74d2){return client[_0x8c5a('0xb')](_0x3b0cca,_0x549bc3)[_0x8c5a('0xc')](function(_0x1f3b08){logger[_0x8c5a('0xd')](_0x8c5a('0xe'),_0x20353b,'request\x20sent');logger[_0x8c5a('0xf')](_0x8c5a('0x10'),_0x20353b,_0x8c5a('0x11'),JSON['stringify'](_0x1f3b08));if(_0x1f3b08[_0x8c5a('0x12')]){if(_0x1f3b08[_0x8c5a('0x12')][_0x8c5a('0x13')]===0x1f4){logger[_0x8c5a('0x12')](_0x8c5a('0xe'),_0x20353b,_0x1f3b08['error'][_0x8c5a('0x14')]);return _0x1a74d2(_0x1f3b08[_0x8c5a('0x12')][_0x8c5a('0x14')]);}logger['error'](_0x8c5a('0xe'),_0x20353b,_0x1f3b08['error'][_0x8c5a('0x14')]);return _0x2ade80(_0x1f3b08['error'][_0x8c5a('0x14')]);}else{logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x20353b,_0x8c5a('0x11'));_0x2ade80(_0x1f3b08[_0x8c5a('0x15')]['message']);}})[_0x8c5a('0x16')](function(_0x4abc97){logger[_0x8c5a('0x12')](_0x8c5a('0xe'),_0x20353b,_0x4abc97);_0x1a74d2(_0x4abc97);});});}exports[_0x8c5a('0x17')]=function(_0x50442d){var _0x13c85d=this;return new Promise(function(_0x52ddc8,_0x5610f1){return db['ChatQueueReport']['create'](_0x50442d[_0x8c5a('0x18')],{'raw':_0x50442d[_0x8c5a('0x19')]?_0x50442d['options'][_0x8c5a('0x1a')]===undefined?!![]:![]:!![]})[_0x8c5a('0xc')](function(_0x4b64e8){logger['info'](_0x8c5a('0x17'),_0x50442d);logger[_0x8c5a('0xf')]('CreateChatQueueReport',_0x50442d,JSON[_0x8c5a('0x1b')](_0x4b64e8));_0x52ddc8(_0x4b64e8);})[_0x8c5a('0x16')](function(_0x36ca48){logger[_0x8c5a('0x12')](_0x8c5a('0x17'),_0x36ca48[_0x8c5a('0x14')],_0x50442d);_0x5610f1(_0x13c85d[_0x8c5a('0x12')](0x1f4,_0x36ca48[_0x8c5a('0x14')]));});});};exports[_0x8c5a('0x1c')]=function(_0x51b209){var _0x2d95b3=this;return new Promise(function(_0x5db9fa,_0x5e0489){return db[_0x8c5a('0x1d')][_0x8c5a('0x1e')](_0x51b209[_0x8c5a('0x18')],{'raw':_0x51b209[_0x8c5a('0x19')]?_0x51b209[_0x8c5a('0x19')][_0x8c5a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51b209[_0x8c5a('0x19')]?_0x51b209[_0x8c5a('0x19')][_0x8c5a('0x1f')]||null:null,'attributes':_0x51b209['options']?_0x51b209[_0x8c5a('0x19')]['attributes']||null:null,'limit':_0x51b209['options']?_0x51b209[_0x8c5a('0x19')]['limit']||null:null})['then'](function(_0x36b286){logger[_0x8c5a('0xd')](_0x8c5a('0x1c'),_0x51b209);logger[_0x8c5a('0xf')](_0x8c5a('0x1c'),_0x51b209,JSON[_0x8c5a('0x1b')](_0x36b286));_0x5db9fa(_0x36b286);})[_0x8c5a('0x16')](function(_0x2365f9){logger[_0x8c5a('0x12')](_0x8c5a('0x1c'),_0x2365f9['message'],_0x51b209);_0x5e0489(_0x2d95b3['error'](0x1f4,_0x2365f9[_0x8c5a('0x14')]));});});};
\ No newline at end of file
index 58f1294..9a5731c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9438=['post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9438,0x147));var _0x8943=function(_0x57d8cb,_0xa1babd){_0x57d8cb=_0x57d8cb-0x0;var _0x3bbed7=_0x9438[_0x57d8cb];return _0x3bbed7;};'use strict';var multer=require(_0x8943('0x0'));var util=require(_0x8943('0x1'));var path=require('path');var timeout=require(_0x8943('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8943('0x3'));var interaction=require(_0x8943('0x4'));var config=require(_0x8943('0x5'));var controller=require(_0x8943('0x6'));router[_0x8943('0x7')]('/',auth['isAuthenticated'](),controller[_0x8943('0x8')]);router[_0x8943('0x7')](_0x8943('0x9'),auth[_0x8943('0xa')](),controller[_0x8943('0xb')]);router[_0x8943('0x7')](_0x8943('0xc'),auth[_0x8943('0xa')](),controller['show']);router[_0x8943('0xd')]('/',auth[_0x8943('0xa')](),controller[_0x8943('0xe')]);router[_0x8943('0xf')](_0x8943('0xc'),auth['isAuthenticated'](),controller[_0x8943('0x10')]);router[_0x8943('0x11')](_0x8943('0xc'),auth[_0x8943('0xa')](),controller[_0x8943('0x12')]);module[_0x8943('0x13')]=router;
\ No newline at end of file
+var _0x72b2=['get','isAuthenticated','describe','/:id','show','create','delete','destroy','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueueReport.controller'];(function(_0x58c576,_0x3df9c6){var _0x2677c3=function(_0x9a8fca){while(--_0x9a8fca){_0x58c576['push'](_0x58c576['shift']());}};_0x2677c3(++_0x3df9c6);}(_0x72b2,0x19d));var _0x272b=function(_0x13d34c,_0x294fed){_0x13d34c=_0x13d34c-0x0;var _0x1e13aa=_0x72b2[_0x13d34c];return _0x1e13aa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x272b('0x0'));var timeout=require(_0x272b('0x1'));var express=require('express');var router=express[_0x272b('0x2')]();var fs_extra=require(_0x272b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x272b('0x4'));var config=require(_0x272b('0x5'));var controller=require(_0x272b('0x6'));router[_0x272b('0x7')]('/',auth[_0x272b('0x8')](),controller['index']);router[_0x272b('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x272b('0x9')]);router[_0x272b('0x7')](_0x272b('0xa'),auth['isAuthenticated'](),controller[_0x272b('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x272b('0xc')]);router['put'](_0x272b('0xa'),auth[_0x272b('0x8')](),controller['update']);router[_0x272b('0xd')](_0x272b('0xa'),auth[_0x272b('0x8')](),controller[_0x272b('0xe')]);module['exports']=router;
\ No newline at end of file
index 632162b..c091185 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x191c44,_0x20a896){var _0x1086cd=function(_0x2e2cac){while(--_0x2e2cac){_0x191c44['push'](_0x191c44['shift']());}};_0x1086cd(++_0x20a896);}(_0x54ef,0x112));var _0xf54e=function(_0x3040d7,_0x104aba){_0x3040d7=_0x3040d7-0x0;var _0x57ce0b=_0x54ef[_0x3040d7];return _0x57ce0b;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}};
\ No newline at end of file
+var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x1e01ca,_0x14dc80){var _0x318e7f=function(_0x1fe292){while(--_0x1fe292){_0x1e01ca['push'](_0x1e01ca['shift']());}};_0x318e7f(++_0x14dc80);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}};
\ No newline at end of file
index 08ace65..5e692b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe2cf=['body','destroy','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x504208,_0x53265f){var _0x410056=function(_0x231fc0){while(--_0x231fc0){_0x504208['push'](_0x504208['shift']());}};_0x410056(++_0x53265f);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x3d9565,_0x5db973){_0x3d9565=_0x3d9565-0x0;var _0x546f66=_0xe2cf[_0x3d9565];return _0x546f66;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfe2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe2c('0x1'));var rp=require('request-promise');var moment=require(_0xfe2c('0x2'));var BPromise=require(_0xfe2c('0x3'));var Mustache=require(_0xfe2c('0x4'));var util=require(_0xfe2c('0x5'));var path=require('path');var sox=require(_0xfe2c('0x6'));var csv=require(_0xfe2c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfe2c('0x8'));var squel=require(_0xfe2c('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfe2c('0xa'));var toCsv=require(_0xfe2c('0x7'));var querystring=require(_0xfe2c('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfe2c('0xc'));var qs=require(_0xfe2c('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfe2c('0xe'));var logger=require(_0xfe2c('0xf'))(_0xfe2c('0x10'));var utils=require(_0xfe2c('0x11'));var config=require(_0xfe2c('0x12'));var licenseUtil=require(_0xfe2c('0x13'));var db=require(_0xfe2c('0x14'))['db'];function respondWithStatusCode(_0x4af8b7,_0x5e7389){_0x5e7389=_0x5e7389||0xcc;return function(_0x59ecf8){if(_0x59ecf8){return _0x4af8b7['sendStatus'](_0x5e7389);}return _0x4af8b7[_0xfe2c('0x15')](_0x5e7389)['end']();};}function respondWithResult(_0x5a6ad5,_0x38ba2c){_0x38ba2c=_0x38ba2c||0xc8;return function(_0x4d0a10){if(_0x4d0a10){return _0x5a6ad5[_0xfe2c('0x15')](_0x38ba2c)[_0xfe2c('0x16')](_0x4d0a10);}};}function respondWithFilteredResult(_0x522692,_0x5039cb){return function(_0x1a4684){if(_0x1a4684){var _0x3b3ebd=typeof _0x5039cb[_0xfe2c('0x17')]===_0xfe2c('0x18')&&typeof _0x5039cb['limit']===_0xfe2c('0x18');var _0x96a3a3=_0x1a4684[_0xfe2c('0x19')];var _0x23242b=_0x3b3ebd?0x0:_0x5039cb[_0xfe2c('0x17')];var _0x13f233=_0x3b3ebd?_0x1a4684['count']:_0x5039cb[_0xfe2c('0x17')]+_0x5039cb[_0xfe2c('0x1a')];var _0x1d7852;if(_0x13f233>=_0x96a3a3){_0x13f233=_0x96a3a3;_0x1d7852=0xc8;}else{_0x1d7852=0xce;}_0x522692[_0xfe2c('0x15')](_0x1d7852);return _0x522692['set'](_0xfe2c('0x1b'),_0x23242b+'-'+_0x13f233+'/'+_0x96a3a3)['json'](_0x1a4684);}return null;};}function patchUpdates(_0x4e9137){return function(_0x408f31){try{jsonpatch[_0xfe2c('0x1c')](_0x408f31,_0x4e9137,!![]);}catch(_0x4bf7c0){return BPromise[_0xfe2c('0x1d')](_0x4bf7c0);}return _0x408f31[_0xfe2c('0x1e')]();};}function saveUpdates(_0x5e609f,_0x1bd50e){return function(_0x5dd54b){if(_0x5dd54b){return _0x5dd54b[_0xfe2c('0x1f')](_0x5e609f)[_0xfe2c('0x20')](function(_0x8b5c0d){return _0x8b5c0d;});}return null;};}function removeEntity(_0x298819,_0x360928){return function(_0x2ee3b3){if(_0x2ee3b3){return _0x2ee3b3['destroy']()[_0xfe2c('0x20')](function(){_0x298819[_0xfe2c('0x15')](0xcc)[_0xfe2c('0x21')]();});}};}function handleEntityNotFound(_0x26448c,_0x3486b5){return function(_0x10afde){if(!_0x10afde){_0x26448c['sendStatus'](0x194);}return _0x10afde;};}function handleError(_0x205da8,_0x5e8abf){_0x5e8abf=_0x5e8abf||0x1f4;return function(_0x16daf3){logger[_0xfe2c('0x22')](_0x16daf3[_0xfe2c('0x23')]);if(_0x16daf3['name']){delete _0x16daf3[_0xfe2c('0x24')];}_0x205da8[_0xfe2c('0x15')](_0x5e8abf)['send'](_0x16daf3);};}exports[_0xfe2c('0x25')]=function(_0x1b6eb7,_0x3352e8){var _0x53a8c1={},_0x170026={},_0x1b7c91={'count':0x0,'rows':[]};var _0x55aed7=_['map'](db[_0xfe2c('0x26')][_0xfe2c('0x27')],function(_0x1a5e15){return{'name':_0x1a5e15[_0xfe2c('0x28')],'type':_0x1a5e15[_0xfe2c('0x29')]['key']};});_0x170026[_0xfe2c('0x2a')]=_[_0xfe2c('0x2b')](_0x55aed7,_0xfe2c('0x24'));_0x170026[_0xfe2c('0x2c')]=_[_0xfe2c('0x2d')](_0x1b6eb7[_0xfe2c('0x2c')]);_0x170026[_0xfe2c('0x2e')]=_[_0xfe2c('0x2f')](_0x170026[_0xfe2c('0x2a')],_0x170026[_0xfe2c('0x2c')]);_0x53a8c1[_0xfe2c('0x30')]=_[_0xfe2c('0x2f')](_0x170026['model'],qs[_0xfe2c('0x31')](_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x31')]));_0x53a8c1['attributes']=_0x53a8c1[_0xfe2c('0x30')][_0xfe2c('0x32')]?_0x53a8c1['attributes']:_0x170026[_0xfe2c('0x2a')];if(!_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x33')]('nolimit')){_0x53a8c1[_0xfe2c('0x1a')]=qs[_0xfe2c('0x1a')](_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x1a')]);_0x53a8c1[_0xfe2c('0x17')]=qs[_0xfe2c('0x17')](_0x1b6eb7[_0xfe2c('0x2c')]['offset']);}_0x53a8c1['order']=qs[_0xfe2c('0x34')](_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x34')]);_0x53a8c1[_0xfe2c('0x35')]=qs['filters'](_[_0xfe2c('0x36')](_0x1b6eb7['query'],_0x170026[_0xfe2c('0x2e')]),_0x55aed7);if(_0x1b6eb7[_0xfe2c('0x2c')]['filter']){_0x53a8c1[_0xfe2c('0x35')]=_['merge'](_0x53a8c1['where'],{'$or':_[_0xfe2c('0x2b')](_0x55aed7,function(_0x3d3b5e){if(_0x3d3b5e[_0xfe2c('0x29')]!==_0xfe2c('0x37')){var _0xae2808={};_0xae2808[_0x3d3b5e[_0xfe2c('0x24')]]={'$like':'%'+_0x1b6eb7[_0xfe2c('0x2c')][_0xfe2c('0x38')]+'%'};return _0xae2808;}})});}_0x53a8c1=_[_0xfe2c('0x39')]({},_0x53a8c1,_0x1b6eb7[_0xfe2c('0x3a')]);var _0x222335={'where':_0x53a8c1['where']};return db[_0xfe2c('0x26')][_0xfe2c('0x19')](_0x222335)[_0xfe2c('0x20')](function(_0x55ea45){_0x1b7c91['count']=_0x55ea45;if(_0x1b6eb7['query'][_0xfe2c('0x3b')]){_0x53a8c1[_0xfe2c('0x3c')]=[{'all':!![]}];}return db[_0xfe2c('0x26')][_0xfe2c('0x3d')](_0x53a8c1);})['then'](function(_0x1ed30b){_0x1b7c91[_0xfe2c('0x3e')]=_0x1ed30b;return _0x1b7c91;})[_0xfe2c('0x20')](respondWithFilteredResult(_0x3352e8,_0x53a8c1))[_0xfe2c('0x3f')](handleError(_0x3352e8,null));};exports[_0xfe2c('0x40')]=function(_0x48e361,_0x5a8d4e){var _0xeb04b9={'raw':!![],'where':{'id':_0x48e361[_0xfe2c('0x41')]['id']}},_0x6055dd={};_0x6055dd['model']=_['keys'](db[_0xfe2c('0x26')][_0xfe2c('0x27')]);_0x6055dd['query']=_[_0xfe2c('0x2d')](_0x48e361[_0xfe2c('0x2c')]);_0x6055dd[_0xfe2c('0x2e')]=_[_0xfe2c('0x2f')](_0x6055dd['model'],_0x6055dd[_0xfe2c('0x2c')]);_0xeb04b9[_0xfe2c('0x30')]=_[_0xfe2c('0x2f')](_0x6055dd[_0xfe2c('0x2a')],qs[_0xfe2c('0x31')](_0x48e361[_0xfe2c('0x2c')][_0xfe2c('0x31')]));_0xeb04b9[_0xfe2c('0x30')]=_0xeb04b9['attributes'][_0xfe2c('0x32')]?_0xeb04b9['attributes']:_0x6055dd[_0xfe2c('0x2a')];if(_0x48e361[_0xfe2c('0x2c')][_0xfe2c('0x3b')]){_0xeb04b9[_0xfe2c('0x3c')]=[{'all':!![]}];}_0xeb04b9=_['merge']({},_0xeb04b9,_0x48e361['options']);return db['ChatTransferReport']['find'](_0xeb04b9)['then'](handleEntityNotFound(_0x5a8d4e,null))[_0xfe2c('0x20')](respondWithResult(_0x5a8d4e,null))['catch'](handleError(_0x5a8d4e,null));};exports['create']=function(_0x22adee,_0x5d76be){return db[_0xfe2c('0x26')]['create'](_0x22adee[_0xfe2c('0x42')],{})[_0xfe2c('0x20')](respondWithResult(_0x5d76be,0xc9))[_0xfe2c('0x3f')](handleError(_0x5d76be,null));};exports[_0xfe2c('0x1f')]=function(_0x3cfda2,_0x57ad76){if(_0x3cfda2[_0xfe2c('0x42')]['id']){delete _0x3cfda2[_0xfe2c('0x42')]['id'];}return db[_0xfe2c('0x26')]['find']({'where':{'id':_0x3cfda2[_0xfe2c('0x41')]['id']}})[_0xfe2c('0x20')](handleEntityNotFound(_0x57ad76,null))['then'](saveUpdates(_0x3cfda2['body'],null))['then'](respondWithResult(_0x57ad76,null))[_0xfe2c('0x3f')](handleError(_0x57ad76,null));};exports[_0xfe2c('0x43')]=function(_0x47023e,_0x2e0012){return db[_0xfe2c('0x26')]['find']({'where':{'id':_0x47023e[_0xfe2c('0x41')]['id']}})[_0xfe2c('0x20')](handleEntityNotFound(_0x2e0012,null))[_0xfe2c('0x20')](removeEntity(_0x2e0012,null))['catch'](handleError(_0x2e0012,null));};exports['describe']=function(_0x3e7c9f,_0xa711b0){return db[_0xfe2c('0x26')][_0xfe2c('0x44')]()[_0xfe2c('0x20')](respondWithResult(_0xa711b0,null))[_0xfe2c('0x3f')](handleError(_0xa711b0,null));};
\ No newline at end of file
+var _0xb856=['Content-Range','apply','reject','save','then','end','error','stack','map','ChatTransferReport','rawAttributes','fieldName','key','model','name','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','filter','options','includeAll','include','rows','catch','show','params','intersection','find','create','body','destroy','describe','eml-format','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set'];(function(_0x16f8aa,_0x1f4309){var _0x56ceff=function(_0x200942){while(--_0x200942){_0x16f8aa['push'](_0x16f8aa['shift']());}};_0x56ceff(++_0x1f4309);}(_0xb856,0x198));var _0x6b85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb856[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x6b85('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6b85('0x1'));var rp=require(_0x6b85('0x2'));var moment=require('moment');var BPromise=require(_0x6b85('0x3'));var Mustache=require(_0x6b85('0x4'));var util=require('util');var path=require(_0x6b85('0x5'));var sox=require(_0x6b85('0x6'));var csv=require('to-csv');var ejs=require(_0x6b85('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b85('0x8'));var squel=require(_0x6b85('0x9'));var crypto=require(_0x6b85('0xa'));var jsforce=require(_0x6b85('0xb'));var deskjs=require(_0x6b85('0xc'));var toCsv=require(_0x6b85('0xd'));var querystring=require(_0x6b85('0xe'));var Papa=require('papaparse');var Redis=require(_0x6b85('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x6b85('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b85('0x11'));var logger=require(_0x6b85('0x12'))('api');var utils=require(_0x6b85('0x13'));var config=require(_0x6b85('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x6b85('0x15'))['db'];function respondWithStatusCode(_0x18d208,_0x1932eb){_0x1932eb=_0x1932eb||0xcc;return function(_0x252397){if(_0x252397){return _0x18d208[_0x6b85('0x16')](_0x1932eb);}return _0x18d208[_0x6b85('0x17')](_0x1932eb)['end']();};}function respondWithResult(_0x4cb88f,_0x509f41){_0x509f41=_0x509f41||0xc8;return function(_0x4a7255){if(_0x4a7255){return _0x4cb88f[_0x6b85('0x17')](_0x509f41)[_0x6b85('0x18')](_0x4a7255);}};}function respondWithFilteredResult(_0x1c36af,_0x3b1d25){return function(_0x5164a6){if(_0x5164a6){var _0x44f494=typeof _0x3b1d25['offset']===_0x6b85('0x19')&&typeof _0x3b1d25['limit']===_0x6b85('0x19');var _0x583f7e=_0x5164a6[_0x6b85('0x1a')];var _0x4f9838=_0x44f494?0x0:_0x3b1d25[_0x6b85('0x1b')];var _0x2cde03=_0x44f494?_0x5164a6[_0x6b85('0x1a')]:_0x3b1d25[_0x6b85('0x1b')]+_0x3b1d25[_0x6b85('0x1c')];var _0x4b31d6;if(_0x2cde03>=_0x583f7e){_0x2cde03=_0x583f7e;_0x4b31d6=0xc8;}else{_0x4b31d6=0xce;}_0x1c36af[_0x6b85('0x17')](_0x4b31d6);return _0x1c36af[_0x6b85('0x1d')](_0x6b85('0x1e'),_0x4f9838+'-'+_0x2cde03+'/'+_0x583f7e)[_0x6b85('0x18')](_0x5164a6);}return null;};}function patchUpdates(_0x3076ce){return function(_0x3e2d3c){try{jsonpatch[_0x6b85('0x1f')](_0x3e2d3c,_0x3076ce,!![]);}catch(_0x4a24e4){return BPromise[_0x6b85('0x20')](_0x4a24e4);}return _0x3e2d3c[_0x6b85('0x21')]();};}function saveUpdates(_0xf1f089,_0xe781c){return function(_0x14dfbf){if(_0x14dfbf){return _0x14dfbf['update'](_0xf1f089)[_0x6b85('0x22')](function(_0x16b625){return _0x16b625;});}return null;};}function removeEntity(_0x2bc354,_0x11ff3c){return function(_0x156da2){if(_0x156da2){return _0x156da2['destroy']()['then'](function(){_0x2bc354[_0x6b85('0x17')](0xcc)[_0x6b85('0x23')]();});}};}function handleEntityNotFound(_0x35e2aa,_0x16ba7b){return function(_0x59757a){if(!_0x59757a){_0x35e2aa['sendStatus'](0x194);}return _0x59757a;};}function handleError(_0x2d9c90,_0x1357bf){_0x1357bf=_0x1357bf||0x1f4;return function(_0x41070c){logger[_0x6b85('0x24')](_0x41070c[_0x6b85('0x25')]);if(_0x41070c['name']){delete _0x41070c['name'];}_0x2d9c90['status'](_0x1357bf)['send'](_0x41070c);};}exports['index']=function(_0x3340e5,_0x32f3d4){var _0x4a7edf={},_0x12158e={},_0x20c6ea={'count':0x0,'rows':[]};var _0x59330d=_[_0x6b85('0x26')](db[_0x6b85('0x27')][_0x6b85('0x28')],function(_0x4c5c4a){return{'name':_0x4c5c4a[_0x6b85('0x29')],'type':_0x4c5c4a['type'][_0x6b85('0x2a')]};});_0x12158e[_0x6b85('0x2b')]=_[_0x6b85('0x26')](_0x59330d,_0x6b85('0x2c'));_0x12158e[_0x6b85('0x2d')]=_[_0x6b85('0x2e')](_0x3340e5['query']);_0x12158e['filters']=_['intersection'](_0x12158e['model'],_0x12158e[_0x6b85('0x2d')]);_0x4a7edf[_0x6b85('0x2f')]=_['intersection'](_0x12158e[_0x6b85('0x2b')],qs['fields'](_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x30')]));_0x4a7edf[_0x6b85('0x2f')]=_0x4a7edf['attributes'][_0x6b85('0x31')]?_0x4a7edf[_0x6b85('0x2f')]:_0x12158e['model'];if(!_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x32')](_0x6b85('0x33'))){_0x4a7edf[_0x6b85('0x1c')]=qs[_0x6b85('0x1c')](_0x3340e5['query']['limit']);_0x4a7edf['offset']=qs[_0x6b85('0x1b')](_0x3340e5['query'][_0x6b85('0x1b')]);}_0x4a7edf[_0x6b85('0x34')]=qs[_0x6b85('0x35')](_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x35')]);_0x4a7edf['where']=qs[_0x6b85('0x36')](_[_0x6b85('0x37')](_0x3340e5[_0x6b85('0x2d')],_0x12158e[_0x6b85('0x36')]),_0x59330d);if(_0x3340e5[_0x6b85('0x2d')]['filter']){_0x4a7edf[_0x6b85('0x38')]=_[_0x6b85('0x39')](_0x4a7edf['where'],{'$or':_[_0x6b85('0x26')](_0x59330d,function(_0x1bcd14){if(_0x1bcd14[_0x6b85('0x3a')]!=='VIRTUAL'){var _0x336ff7={};_0x336ff7[_0x1bcd14[_0x6b85('0x2c')]]={'$like':'%'+_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x3b')]+'%'};return _0x336ff7;}})});}_0x4a7edf=_[_0x6b85('0x39')]({},_0x4a7edf,_0x3340e5[_0x6b85('0x3c')]);var _0x17a3db={'where':_0x4a7edf[_0x6b85('0x38')]};return db['ChatTransferReport'][_0x6b85('0x1a')](_0x17a3db)['then'](function(_0x39b9c8){_0x20c6ea[_0x6b85('0x1a')]=_0x39b9c8;if(_0x3340e5[_0x6b85('0x2d')][_0x6b85('0x3d')]){_0x4a7edf[_0x6b85('0x3e')]=[{'all':!![]}];}return db[_0x6b85('0x27')]['findAll'](_0x4a7edf);})[_0x6b85('0x22')](function(_0x4dc79d){_0x20c6ea[_0x6b85('0x3f')]=_0x4dc79d;return _0x20c6ea;})[_0x6b85('0x22')](respondWithFilteredResult(_0x32f3d4,_0x4a7edf))[_0x6b85('0x40')](handleError(_0x32f3d4,null));};exports[_0x6b85('0x41')]=function(_0x42d56a,_0x316450){var _0x37d1a6={'raw':!![],'where':{'id':_0x42d56a[_0x6b85('0x42')]['id']}},_0x3a3bd2={};_0x3a3bd2[_0x6b85('0x2b')]=_['keys'](db[_0x6b85('0x27')][_0x6b85('0x28')]);_0x3a3bd2[_0x6b85('0x2d')]=_[_0x6b85('0x2e')](_0x42d56a['query']);_0x3a3bd2[_0x6b85('0x36')]=_[_0x6b85('0x43')](_0x3a3bd2['model'],_0x3a3bd2[_0x6b85('0x2d')]);_0x37d1a6['attributes']=_[_0x6b85('0x43')](_0x3a3bd2['model'],qs['fields'](_0x42d56a['query'][_0x6b85('0x30')]));_0x37d1a6[_0x6b85('0x2f')]=_0x37d1a6[_0x6b85('0x2f')][_0x6b85('0x31')]?_0x37d1a6['attributes']:_0x3a3bd2[_0x6b85('0x2b')];if(_0x42d56a[_0x6b85('0x2d')][_0x6b85('0x3d')]){_0x37d1a6['include']=[{'all':!![]}];}_0x37d1a6=_['merge']({},_0x37d1a6,_0x42d56a[_0x6b85('0x3c')]);return db[_0x6b85('0x27')][_0x6b85('0x44')](_0x37d1a6)['then'](handleEntityNotFound(_0x316450,null))[_0x6b85('0x22')](respondWithResult(_0x316450,null))[_0x6b85('0x40')](handleError(_0x316450,null));};exports['create']=function(_0x350553,_0x5a234b){return db[_0x6b85('0x27')][_0x6b85('0x45')](_0x350553[_0x6b85('0x46')],{})[_0x6b85('0x22')](respondWithResult(_0x5a234b,0xc9))[_0x6b85('0x40')](handleError(_0x5a234b,null));};exports['update']=function(_0x2f6e2f,_0x562cdc){if(_0x2f6e2f[_0x6b85('0x46')]['id']){delete _0x2f6e2f['body']['id'];}return db[_0x6b85('0x27')][_0x6b85('0x44')]({'where':{'id':_0x2f6e2f[_0x6b85('0x42')]['id']}})[_0x6b85('0x22')](handleEntityNotFound(_0x562cdc,null))[_0x6b85('0x22')](saveUpdates(_0x2f6e2f[_0x6b85('0x46')],null))[_0x6b85('0x22')](respondWithResult(_0x562cdc,null))[_0x6b85('0x40')](handleError(_0x562cdc,null));};exports[_0x6b85('0x47')]=function(_0x593243,_0x48a538){return db[_0x6b85('0x27')][_0x6b85('0x44')]({'where':{'id':_0x593243[_0x6b85('0x42')]['id']}})[_0x6b85('0x22')](handleEntityNotFound(_0x48a538,null))[_0x6b85('0x22')](removeEntity(_0x48a538,null))[_0x6b85('0x40')](handleError(_0x48a538,null));};exports[_0x6b85('0x48')]=function(_0x2a790c,_0x539ec5){return db[_0x6b85('0x27')]['describe']()[_0x6b85('0x22')](respondWithResult(_0x539ec5,null))[_0x6b85('0x40')](handleError(_0x539ec5,null));};
\ No newline at end of file
index be257a7..13d805c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5663=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x5ca353,_0x21eb37){var _0x4f2fe5=function(_0x14cd1b){while(--_0x14cd1b){_0x5ca353['push'](_0x5ca353['shift']());}};_0x4f2fe5(++_0x21eb37);}(_0x5663,0x152));var _0x3566=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x5663[_0xa1e3ca];return _0x5005ab;};'use strict';var _=require(_0x3566('0x0'));var util=require('util');var logger=require(_0x3566('0x1'))(_0x3566('0x2'));var moment=require('moment');var BPromise=require(_0x3566('0x3'));var rp=require(_0x3566('0x4'));var fs=require('fs');var path=require(_0x3566('0x5'));var rimraf=require(_0x3566('0x6'));var config=require(_0x3566('0x7'));var attributes=require(_0x3566('0x8'));module[_0x3566('0x9')]=function(_0x20890a,_0x38758a){return _0x20890a['define'](_0x3566('0xa'),attributes,{'tableName':_0x3566('0xb'),'paranoid':![],'indexes':[{'name':_0x3566('0xc'),'fields':[_0x3566('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xba39=['util','../../config/logger','api','bluebird','request-promise','rimraf','./chatTransferReport.attributes','exports','define','ChatTransferReport','uniqueid','lodash'];(function(_0x140a86,_0x426df8){var _0x20c777=function(_0x46e9e5){while(--_0x46e9e5){_0x140a86['push'](_0x140a86['shift']());}};_0x20c777(++_0x426df8);}(_0xba39,0xbf));var _0x9ba3=function(_0x2805d2,_0x281ebb){_0x2805d2=_0x2805d2-0x0;var _0x16b104=_0xba39[_0x2805d2];return _0x16b104;};'use strict';var _=require(_0x9ba3('0x0'));var util=require(_0x9ba3('0x1'));var logger=require(_0x9ba3('0x2'))(_0x9ba3('0x3'));var moment=require('moment');var BPromise=require(_0x9ba3('0x4'));var rp=require(_0x9ba3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9ba3('0x6'));var config=require('../../config/environment');var attributes=require(_0x9ba3('0x7'));module[_0x9ba3('0x8')]=function(_0x386709,_0x4d77a5){return _0x386709[_0x9ba3('0x9')](_0x9ba3('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0x9ba3('0xb'),'fields':[_0x9ba3('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index db5262d..950f060 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x07e4=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x112b68,_0x3eecb2){var _0x1dfa3a=function(_0x21e72e){while(--_0x21e72e){_0x112b68['push'](_0x112b68['shift']());}};_0x1dfa3a(++_0x3eecb2);}(_0x07e4,0x87));var _0x407e=function(_0x37cfe0,_0x44bf3c){_0x37cfe0=_0x37cfe0-0x0;var _0x47f01d=_0x07e4[_0x37cfe0];return _0x47f01d;};'use strict';var _=require(_0x407e('0x0'));var util=require('util');var moment=require(_0x407e('0x1'));var BPromise=require(_0x407e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x407e('0x3'));var db=require(_0x407e('0x4'))['db'];var utils=require(_0x407e('0x5'));var logger=require(_0x407e('0x6'))(_0x407e('0x7'));var config=require('../../config/environment');var jayson=require(_0x407e('0x8'));var client=jayson[_0x407e('0x9')][_0x407e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x359512,_0x40365f,_0x5c2c6f){return new BPromise(function(_0x26eaaa,_0x342d82){return client['request'](_0x359512,_0x5c2c6f)['then'](function(_0x1d1536){logger[_0x407e('0xb')](_0x407e('0xc'),_0x40365f,_0x407e('0xd'));logger[_0x407e('0xe')](_0x407e('0xf'),_0x40365f,_0x407e('0xd'),JSON[_0x407e('0x10')](_0x1d1536));if(_0x1d1536[_0x407e('0x11')]){if(_0x1d1536[_0x407e('0x11')][_0x407e('0x12')]===0x1f4){logger[_0x407e('0x11')](_0x407e('0xc'),_0x40365f,_0x1d1536[_0x407e('0x11')]['message']);return _0x342d82(_0x1d1536['error'][_0x407e('0x13')]);}logger[_0x407e('0x11')](_0x407e('0xc'),_0x40365f,_0x1d1536[_0x407e('0x11')][_0x407e('0x13')]);return _0x26eaaa(_0x1d1536[_0x407e('0x11')]['message']);}else{logger[_0x407e('0xb')](_0x407e('0xc'),_0x40365f,_0x407e('0xd'));_0x26eaaa(_0x1d1536[_0x407e('0x14')]['message']);}})[_0x407e('0x15')](function(_0x2c1133){logger[_0x407e('0x11')](_0x407e('0xc'),_0x40365f,_0x2c1133);_0x342d82(_0x2c1133);});});}
\ No newline at end of file
+var _0xc8f9=['util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x3ef5a9,_0x4a2ac6){var _0x272e9a=function(_0x4e5d1d){while(--_0x4e5d1d){_0x3ef5a9['push'](_0x3ef5a9['shift']());}};_0x272e9a(++_0x4a2ac6);}(_0xc8f9,0x1b4));var _0x9c8f=function(_0x1af906,_0x163d6c){_0x1af906=_0x1af906-0x0;var _0x12e02f=_0xc8f9[_0x1af906];return _0x12e02f;};'use strict';var _=require(_0x9c8f('0x0'));var util=require(_0x9c8f('0x1'));var moment=require(_0x9c8f('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c8f('0x3'));var fs=require('fs');var Redis=require(_0x9c8f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9c8f('0x5'))(_0x9c8f('0x6'));var config=require(_0x9c8f('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9c8f('0x8')][_0x9c8f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x314a9a,_0x4d0de8,_0x497a49){return new BPromise(function(_0x3466c8,_0x225e05){return client[_0x9c8f('0xa')](_0x314a9a,_0x497a49)[_0x9c8f('0xb')](function(_0x3a9041){logger[_0x9c8f('0xc')](_0x9c8f('0xd'),_0x4d0de8,'request\x20sent');logger[_0x9c8f('0xe')](_0x9c8f('0xf'),_0x4d0de8,_0x9c8f('0x10'),JSON[_0x9c8f('0x11')](_0x3a9041));if(_0x3a9041[_0x9c8f('0x12')]){if(_0x3a9041['error'][_0x9c8f('0x13')]===0x1f4){logger['error'](_0x9c8f('0xd'),_0x4d0de8,_0x3a9041[_0x9c8f('0x12')][_0x9c8f('0x14')]);return _0x225e05(_0x3a9041[_0x9c8f('0x12')][_0x9c8f('0x14')]);}logger[_0x9c8f('0x12')](_0x9c8f('0xd'),_0x4d0de8,_0x3a9041['error'][_0x9c8f('0x14')]);return _0x3466c8(_0x3a9041[_0x9c8f('0x12')][_0x9c8f('0x14')]);}else{logger[_0x9c8f('0xc')]('ChatTransferReport,\x20%s,\x20%s',_0x4d0de8,_0x9c8f('0x10'));_0x3466c8(_0x3a9041[_0x9c8f('0x15')]['message']);}})[_0x9c8f('0x16')](function(_0x423d7b){logger[_0x9c8f('0x12')](_0x9c8f('0xd'),_0x4d0de8,_0x423d7b);_0x225e05(_0x423d7b);});});}
\ No newline at end of file
index 6d20a08..b3d0906 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf523=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','delete','destroy','exports','multer','util'];(function(_0x12c1bb,_0x453f58){var _0x4bda82=function(_0x257178){while(--_0x257178){_0x12c1bb['push'](_0x12c1bb['shift']());}};_0x4bda82(++_0x453f58);}(_0xf523,0x166));var _0x3f52=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf523[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x3f52('0x0'));var util=require(_0x3f52('0x1'));var path=require('path');var timeout=require(_0x3f52('0x2'));var express=require(_0x3f52('0x3'));var router=express['Router']();var fs_extra=require(_0x3f52('0x4'));var auth=require(_0x3f52('0x5'));var interaction=require(_0x3f52('0x6'));var config=require(_0x3f52('0x7'));var controller=require(_0x3f52('0x8'));router[_0x3f52('0x9')]('/',auth[_0x3f52('0xa')](),controller[_0x3f52('0xb')]);router['get'](_0x3f52('0xc'),auth['isAuthenticated'](),controller[_0x3f52('0xd')]);router[_0x3f52('0x9')](_0x3f52('0xe'),auth[_0x3f52('0xa')](),controller['show']);router[_0x3f52('0xf')]('/',auth[_0x3f52('0xa')](),controller[_0x3f52('0x10')]);router['put'](_0x3f52('0xe'),auth[_0x3f52('0xa')](),controller['update']);router[_0x3f52('0x11')](_0x3f52('0xe'),auth[_0x3f52('0xa')](),controller[_0x3f52('0x12')]);module[_0x3f52('0x13')]=router;
\ No newline at end of file
+var _0xe3d3=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','describe','get','post','create','put','/:id','update','destroy'];(function(_0x3c1df4,_0x2307ff){var _0x67bac2=function(_0x205287){while(--_0x205287){_0x3c1df4['push'](_0x3c1df4['shift']());}};_0x67bac2(++_0x2307ff);}(_0xe3d3,0x104));var _0x3e3d=function(_0x27cc41,_0x3c7e5d){_0x27cc41=_0x27cc41-0x0;var _0x3e4f89=_0xe3d3[_0x27cc41];return _0x3e4f89;};'use strict';var multer=require(_0x3e3d('0x0'));var util=require(_0x3e3d('0x1'));var path=require(_0x3e3d('0x2'));var timeout=require('connect-timeout');var express=require(_0x3e3d('0x3'));var router=express[_0x3e3d('0x4')]();var fs_extra=require(_0x3e3d('0x5'));var auth=require(_0x3e3d('0x6'));var interaction=require(_0x3e3d('0x7'));var config=require(_0x3e3d('0x8'));var controller=require(_0x3e3d('0x9'));router['get']('/',auth[_0x3e3d('0xa')](),controller[_0x3e3d('0xb')]);router['get']('/describe',auth[_0x3e3d('0xa')](),controller[_0x3e3d('0xc')]);router[_0x3e3d('0xd')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3e3d('0xe')]('/',auth['isAuthenticated'](),controller[_0x3e3d('0xf')]);router[_0x3e3d('0x10')](_0x3e3d('0x11'),auth[_0x3e3d('0xa')](),controller[_0x3e3d('0x12')]);router['delete']('/:id',auth[_0x3e3d('0xa')](),controller[_0x3e3d('0x13')]);module['exports']=router;
\ No newline at end of file
index 92f359a..5a94d9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa4c6=['generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','Skip','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Contact\x20us','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','star','stringify','input','name','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm'];(function(_0x81923a,_0xe84ec0){var _0x2696db=function(_0x3dfa19){while(--_0x3dfa19){_0x81923a['push'](_0x81923a['shift']());}};_0x2696db(++_0xe84ec0);}(_0xa4c6,0x1e4));var _0x6a4c=function(_0x3b7883,_0x3c0c7e){_0x3b7883=_0x3b7883-0x0;var _0x246e63=_0xa4c6[_0x3b7883];return _0x246e63;};'use strict';var Sequelize=require(_0x6a4c('0x0'));var rs=require(_0x6a4c('0x1'));module['exports']={'name':{'type':Sequelize[_0x6a4c('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x6a4c('0x2')],'allowNull':![],'unique':_0x6a4c('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x4')},'mapKeyOffline':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x4')},'key':{'type':Sequelize[_0x6a4c('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x5')},'customerAlias':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x6a4c('0x2')],'allowNull':![],'defaultValue':_0x6a4c('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x6a4c('0x2')],'allowNull':![],'defaultValue':_0x6a4c('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6a4c('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x6a4c('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x6a4c('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x6a4c('0x2')]},'animation':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x6a4c('0xa')]('rounded',_0x6a4c('0xb')),'defaultValue':_0x6a4c('0xc')},'header_online':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0xd')},'start_chat_button':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0xe')},'offline_chat_button':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0xf')},'header_offline':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x10')},'download_transcript':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x6a4c('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x11')},'defaultWhiteLabel':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x6a4c('0x12')]},'closingQuestion':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x13')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0x6a4c('0x14')},'noteTitle':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x15')},'placeholderMessage':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x16')},'closingMessage':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x17')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x6a4c('0xf')},'skipMessageButton':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x6a4c('0xa')]('star','thumb'),'defaultValue':_0x6a4c('0x18')},'ratingStarsNumber':{'type':Sequelize[_0x6a4c('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x6a4c('0x12')],'defaultValue':function(){return JSON[_0x6a4c('0x19')]({'items':[{'type':_0x6a4c('0x1a'),'variable':null,'config':{'placeholder':_0x6a4c('0x1b'),'type':'text','required':!![]},'props':{'title':_0x6a4c('0x1b'),'helpText':''}},{'type':_0x6a4c('0x1a'),'props':{'title':_0x6a4c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6a4c('0x4'),'type':_0x6a4c('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x6a4c('0x1c')](_0x6a4c('0x1d'))?JSON[_0x6a4c('0x1e')](this[_0x6a4c('0x1c')]('onlineForm')):{};},'set':function(_0x1c9338){return this[_0x6a4c('0x1f')](_0x6a4c('0x1d'),JSON[_0x6a4c('0x19')](_0x1c9338));}},'offlineForm':{'type':Sequelize[_0x6a4c('0x12')],'defaultValue':function(){return JSON[_0x6a4c('0x19')]({'items':[{'type':_0x6a4c('0x1a'),'props':{'title':_0x6a4c('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x6a4c('0x4'),'type':_0x6a4c('0x4')},'variable':null},{'type':_0x6a4c('0x20'),'config':{'placeholder':_0x6a4c('0x21')},'props':{'title':_0x6a4c('0x21'),'helpText':_0x6a4c('0x22')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0x6a4c('0x1e')](this[_0x6a4c('0x1c')](_0x6a4c('0x23'))):{};},'set':function(_0x167184){return this[_0x6a4c('0x1f')](_0x6a4c('0x23'),JSON[_0x6a4c('0x19')](_0x167184));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6a4c('0x24')]();}},'autoclose':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x6a4c('0x2')]},'forwardOffline':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x6a4c('0x2')]},'waitingTitle':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x25')},'waitingMessage':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x26')},'offlineMessageBody':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x27')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x6a4c('0x2')]},'notificationTemplate':{'type':Sequelize[_0x6a4c('0x12')],'defaultValue':function(){return _0x6a4c('0x28');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x6a4c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x6a4c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x2a')},'verticalAlignment':{'type':Sequelize[_0x6a4c('0x8')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':_0x6a4c('0x2b')},'defaultTitle':{'type':Sequelize[_0x6a4c('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x6a4c('0x2')],'allowNull':![],'defaultValue':_0x6a4c('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6a4c('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0x6a4c('0x2d')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x6a4c('0x2e')},'mandatoryDisposition':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![],'comment':_0x6a4c('0x2f'),'set':function(_0xc7db9c){if(!_0xc7db9c)this[_0x6a4c('0x1f')](_0x6a4c('0x30'),null);this[_0x6a4c('0x1f')](_0x6a4c('0x31'),_0xc7db9c);}},'vidaooEscalation':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x6a4c('0x2')]},'vidaooTopic':{'type':Sequelize[_0x6a4c('0x2')],'allowNull':![],'defaultValue':_0x6a4c('0x32')},'vidaooNote':{'type':Sequelize[_0x6a4c('0x2')],'defaultValue':function(){return _0x6a4c('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x6a4c('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x6a4c('0x12')]}};
\ No newline at end of file
+var _0x9d4d=['star','TEXT','stringify','input','name','text','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','parse','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','exports','STRING','address','email','#011F6A','#ffffff','INTEGER','squared','rounded','We\x20are\x20here!','Send','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb'];(function(_0x5ebb89,_0x26c132){var _0x375087=function(_0x2a4c29){while(--_0x2a4c29){_0x5ebb89['push'](_0x5ebb89['shift']());}};_0x375087(++_0x26c132);}(_0x9d4d,0xed));var _0xd9d4=function(_0x4390aa,_0x80bc78){_0x4390aa=_0x4390aa-0x0;var _0x88eb9a=_0x9d4d[_0x4390aa];return _0x88eb9a;};'use strict';var Sequelize=require(_0xd9d4('0x0'));var rs=require('randomstring');module[_0xd9d4('0x1')]={'name':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd9d4('0x3')},'description':{'type':Sequelize[_0xd9d4('0x2')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x4')},'key':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize['STRING'],'defaultValue':'Me'},'color':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xd9d4('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM']('rounded',_0xd9d4('0x8')),'defaultValue':_0xd9d4('0x9')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0xa')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0xb')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xd9d4('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0xd')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0xe')},'formSubmitSuccessMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0xf')},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x10')},'noteTitle':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x11')},'placeholderMessage':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x12')},'closingMessageButton':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x13')},'conditionAgreement':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x14')},'ratingType':{'type':Sequelize[_0xd9d4('0x15')]('star',_0xd9d4('0x16')),'defaultValue':_0xd9d4('0x17')},'ratingStarsNumber':{'type':Sequelize[_0xd9d4('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xd9d4('0x18')],'defaultValue':function(){return JSON[_0xd9d4('0x19')]({'items':[{'type':_0xd9d4('0x1a'),'variable':null,'config':{'placeholder':_0xd9d4('0x1b'),'type':_0xd9d4('0x1c'),'required':!![]},'props':{'title':_0xd9d4('0x1b'),'helpText':''}},{'type':_0xd9d4('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xd9d4('0x4'),'type':_0xd9d4('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xd9d4('0x1d')](_0xd9d4('0x1e'))?JSON['parse'](this[_0xd9d4('0x1d')](_0xd9d4('0x1e'))):{};},'set':function(_0x1a1aef){return this[_0xd9d4('0x1f')](_0xd9d4('0x1e'),JSON['stringify'](_0x1a1aef));}},'offlineForm':{'type':Sequelize[_0xd9d4('0x18')],'defaultValue':function(){return JSON[_0xd9d4('0x19')]({'items':[{'type':'input','props':{'title':_0xd9d4('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xd9d4('0x4'),'type':_0xd9d4('0x4')},'variable':null},{'type':_0xd9d4('0x20'),'config':{'placeholder':_0xd9d4('0x21')},'props':{'title':_0xd9d4('0x21'),'helpText':_0xd9d4('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xd9d4('0x1d')](_0xd9d4('0x23'))?JSON[_0xd9d4('0x24')](this[_0xd9d4('0x1d')](_0xd9d4('0x23'))):{};},'set':function(_0x1d35c6){return this[_0xd9d4('0x1f')](_0xd9d4('0x23'),JSON[_0xd9d4('0x19')](_0x1d35c6));}},'token':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xd9d4('0x2')]},'forwardOffline':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x26')},'offlineMessageBody':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x27')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xd9d4('0x13')},'sendUnmanaged':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xd9d4('0x18')]},'showAgentAvatar':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xd9d4('0x2')]},'notificationTemplate':{'type':Sequelize[_0xd9d4('0x18')],'defaultValue':function(){return _0xd9d4('0x29');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xd9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x2b')},'verticalAlignment':{'type':Sequelize[_0xd9d4('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x2c')},'messagesAlignment':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':_0xd9d4('0x2d')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':'System'},'systemAvatar':{'type':Sequelize[_0xd9d4('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xd9d4('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![],'comment':_0xd9d4('0x30'),'set':function(_0x30a0af){if(!_0x30a0af)this[_0xd9d4('0x1f')](_0xd9d4('0x31'),null);this[_0xd9d4('0x1f')](_0xd9d4('0x32'),_0x30a0af);}},'vidaooEscalation':{'type':Sequelize[_0xd9d4('0xc')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xd9d4('0x2')]},'vidaooTopic':{'type':Sequelize[_0xd9d4('0x2')],'allowNull':![],'defaultValue':_0xd9d4('0x33')},'vidaooNote':{'type':Sequelize[_0xd9d4('0x2')],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xd9d4('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 2df96e9..7e16ffa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd07f=['tag','getSnippet','getProactiveActions','License','increment','server/files/chat/iframe.ejs','URL','address','origin','3.5.0','x-real-ip','connection','remoteAddress','referer','virtual','replace','render','color','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Contact','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','url','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIOutOfIntervalError','../../mysqldb','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatWebsite,\x20%s,\x20%s','result','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','get','ChatWebsites','UserProfileResource','stack','name','Command','iftime\x20%s,%s','timezone','iftime\x20%s','interval','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','OFFLINE','No\x20timezone','catch','map','Intervals','all','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','version','%s\x20%s','unknown','format','device','model','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','ChatWebsite','fieldName','key','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','show','params','rawAttributes','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','ChatWebsiteId','Disposition','getDispositions','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addLogo','file','filename','addAvatar','agentAvatar','addCustomerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','sitepic','download','server/files/images/avatars/default_avatar.png','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','customerAvatar','notify','chat','CmContact','Sequelize','ValidationError','difference','createdAt','CompanyId','ListId','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','DESC','ChatApplication','Interval','account','applications','orderBy','Applications','priority','asc','Contacts','contact','headers','threadId','ChatInteraction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','*,*,*,*','ChatMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','Start','startRouting','offline','files','no\x20available\x20attributes','updatedAt','send','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','defaults','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','originalname','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','fullname','internal','Tag','Tags'];(function(_0x1ba31e,_0x4b67d2){var _0x56bcec=function(_0x160cd4){while(--_0x160cd4){_0x1ba31e['push'](_0x1ba31e['shift']());}};_0x56bcec(++_0x4b67d2);}(_0xd07f,0x165));var _0xfd07=function(_0x5ce07e,_0x3727e6){_0x5ce07e=_0x5ce07e-0x0;var _0x41cb83=_0xd07f[_0x5ce07e];return _0x41cb83;};'use strict';var Mustache=require(_0xfd07('0x0'));var util=require(_0xfd07('0x1'));var path=require(_0xfd07('0x2'));var ejs=require(_0xfd07('0x3'));var fs=require('fs');var fs_extra=require(_0xfd07('0x4'));var _=require(_0xfd07('0x5'));var querystring=require(_0xfd07('0x6'));var htmlToText=require(_0xfd07('0x7'));var Redis=require(_0xfd07('0x8'));var jayson=require('jayson/promise');var url=require(_0xfd07('0x9'));var qs=require(_0xfd07('0xa'));var logger=require(_0xfd07('0xb'))(_0xfd07('0xc'));var config=require(_0xfd07('0xd'));var APIOutOfIntervalError=require(_0xfd07('0xe'))[_0xfd07('0xf')];var APINotFoundError=require(_0xfd07('0xe'))['APINotFoundError'];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0xfd07('0x10'))['db'];config[_0xfd07('0x11')]=_['defaults'](config[_0xfd07('0x11')],{'host':_0xfd07('0x12'),'port':0x18eb});var socket=require(_0xfd07('0x13'))(new Redis(config[_0xfd07('0x11')]));require(_0xfd07('0x14'))[_0xfd07('0x15')](socket);var client=jayson[_0xfd07('0x16')][_0xfd07('0x17')]({'port':0x232c});var client9002=jayson[_0xfd07('0x16')][_0xfd07('0x17')]({'port':0x232a});var client9003=jayson[_0xfd07('0x16')][_0xfd07('0x17')]({'port':0x232b});var client9001=jayson[_0xfd07('0x16')][_0xfd07('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x24b4c1,_0x22b6d5,_0x37e1a1,_0x2ceab9){return new Promise(function(_0x2383a9,_0x23f7b9){var _0x5abcf7=_0x2ceab9||client;return _0x5abcf7['request'](_0x24b4c1,_0x37e1a1)[_0xfd07('0x18')](function(_0x2c4b65){logger[_0xfd07('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x22b6d5,_0xfd07('0x1a'));logger[_0xfd07('0x1b')](_0xfd07('0x1c'),_0x22b6d5,_0xfd07('0x1a'),JSON[_0xfd07('0x1d')](_0x2c4b65));if(_0x2c4b65[_0xfd07('0x1e')]){if(_0x2c4b65['error']['code']===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x22b6d5,_0x2c4b65[_0xfd07('0x1e')][_0xfd07('0x1f')]);return _0x23f7b9(_0x2c4b65['error'][_0xfd07('0x1f')]);}logger[_0xfd07('0x1e')](_0xfd07('0x20'),_0x22b6d5,_0x2c4b65[_0xfd07('0x1e')]['message']);return _0x2383a9(_0x2c4b65['error'][_0xfd07('0x1f')]);}else{logger[_0xfd07('0x19')](_0xfd07('0x20'),_0x22b6d5,_0xfd07('0x1a'));_0x2383a9(_0x2c4b65[_0xfd07('0x21')][_0xfd07('0x1f')]);}})['catch'](function(_0x35403d){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x22b6d5,_0x35403d);_0x23f7b9(_0x35403d);});});}function respondWithStatusCode(_0x56aee6,_0x37347c){_0x37347c=_0x37347c||0xcc;return function(_0x4ae190){if(_0x4ae190){return _0x56aee6[_0xfd07('0x22')](_0x37347c);}return _0x56aee6['status'](_0x37347c)[_0xfd07('0x23')]();};}function respondWithResult(_0x4302e9,_0x5e806f){_0x5e806f=_0x5e806f||0xc8;return function(_0x11c8fb){if(_0x11c8fb){return _0x4302e9[_0xfd07('0x24')](_0x5e806f)['json'](_0x11c8fb);}};}function respondWithFilteredResult(_0x3b1c14,_0x24bb73){return function(_0x595556){if(_0x595556){var _0xa10c82=typeof _0x24bb73[_0xfd07('0x25')]===_0xfd07('0x26')&&typeof _0x24bb73[_0xfd07('0x27')]===_0xfd07('0x26');var _0x1da6be=_0x595556[_0xfd07('0x28')];var _0x4e2af3=_0xa10c82?0x0:_0x24bb73[_0xfd07('0x25')];var _0x136b85=_0xa10c82?_0x595556[_0xfd07('0x28')]:_0x24bb73['offset']+_0x24bb73[_0xfd07('0x27')];var _0x2b3555;if(_0x136b85>=_0x1da6be){_0x136b85=_0x1da6be;_0x2b3555=0xc8;}else{_0x2b3555=0xce;}_0x3b1c14[_0xfd07('0x24')](_0x2b3555);return _0x3b1c14[_0xfd07('0x29')](_0xfd07('0x2a'),_0x4e2af3+'-'+_0x136b85+'/'+_0x1da6be)[_0xfd07('0x2b')](_0x595556);}return null;};}function saveUpdates(_0x18b401){return function(_0x22662b){if(_0x22662b){return _0x22662b[_0xfd07('0x2c')](_0x18b401)['then'](function(_0x52a2fd){return _0x52a2fd;});}return null;};}function removeEntity(_0x424776){return function(_0x592d8d){if(_0x592d8d){return _0x592d8d[_0xfd07('0x2d')]()[_0xfd07('0x18')](function(){var _0x2cd86a=_0x592d8d[_0xfd07('0x2e')]({'plain':!![]});var _0x4471e3=_0xfd07('0x2f');return db[_0xfd07('0x30')][_0xfd07('0x2d')]({'where':{'type':_0x4471e3,'resourceId':_0x2cd86a['id']}})['then'](function(){return _0x592d8d;});})[_0xfd07('0x18')](function(){_0x424776['status'](0xcc)[_0xfd07('0x23')]();});}};}function handleEntityNotFound(_0x1a62b0){return function(_0x506388){if(!_0x506388){_0x1a62b0[_0xfd07('0x22')](0x194);}return _0x506388;};}function handleError(_0x51e83e,_0x5c9c1d){_0x5c9c1d=_0x5c9c1d||0x1f4;return function(_0x2a8a55){logger['error'](_0x2a8a55[_0xfd07('0x31')]);if(_0x2a8a55[_0xfd07('0x32')]){delete _0x2a8a55[_0xfd07('0x32')];}_0x51e83e[_0xfd07('0x24')](_0x5c9c1d)['send'](_0x2a8a55);};}function iftimePromise(_0x319bd9,_0x1d5a3b){return respondWithRpcPromise(_0xfd07('0x33'),'getSnippet',{'command':_0x1d5a3b['timezone']?util['format'](_0xfd07('0x34'),_0x319bd9['interval'],_0x1d5a3b[_0xfd07('0x35')]):util['format'](_0xfd07('0x36'),_0x319bd9[_0xfd07('0x37')])},client9002)['then'](function(_0x54e684){var _0x162470=_0x54e684&&_0x54e684[_0xfd07('0x38')](_0xfd07('0x39'))>=0x0?!![]:![];logger['info'](_0xfd07('0x3a'),_0x1d5a3b['id'],_0x319bd9['id'],_0x319bd9['interval'],_0x162470?'ONLINE':_0xfd07('0x3b'),_0x1d5a3b[_0xfd07('0x35')]?_0x1d5a3b[_0xfd07('0x35')]:_0xfd07('0x3c'));return _0x162470;})[_0xfd07('0x3d')](function(_0x6663d8){logger[_0xfd07('0x1e')](_0xfd07('0x3a'),_0x1d5a3b['id'],_0x319bd9['id'],_0x319bd9[_0xfd07('0x37')],util['inspect'](_0x6663d8,{'showHidden':![],'depth':null}),_0x1d5a3b[_0xfd07('0x35')]?_0x1d5a3b['timezone']:_0xfd07('0x3c'));return![];});}function checkWebsiteIntervals(_0x58f3d9){var _0x469215=_[_0xfd07('0x3e')](_0x58f3d9['Interval'][_0xfd07('0x3f')],function(_0x18905b){var _0x5e5667=_0x18905b[_0xfd07('0x2e')]({'plain':!![]});return iftimePromise(_0x5e5667,_0x58f3d9);});return Promise[_0xfd07('0x40')](_0x469215)[_0xfd07('0x18')](function(_0x1f5e51){return _['some'](_0x1f5e51);});}function createInteractionObject(_0x3bd9c0,_0x1ea91f,_0x510639,_0x193e92){var _0x2f587d=require(_0xfd07('0x41'));var _0x4121d2=new _0x2f587d();var _0x3c855a=_0x4121d2[_0xfd07('0x42')](_0x510639[_0xfd07('0x43')])[_0xfd07('0x44')]();var _0x5de6d1=_0x1ea91f[_0xfd07('0x45')];if(_0x510639[_0xfd07('0x46')]){_0x5de6d1=_0x510639[_0xfd07('0x46')];}else if(_0x510639[_0xfd07('0x47')]){_0x5de6d1=_[_0xfd07('0x48')](_0x510639[_0xfd07('0x47')][_0xfd07('0x49')](','));}return{'ContactId':_0x193e92['id'],'ChatWebsiteId':_0x3bd9c0,'from':(_0x193e92[_0xfd07('0x4a')]||'')+'\x20'+(_0x193e92[_0xfd07('0x4b')]||''),'customerIp':_0x5de6d1,'customerPort':_0x510639[_0xfd07('0x4c')]?_0x510639[_0xfd07('0x4c')]:null,'referer':_0x1ea91f['referer'],'browserName':_0x3c855a['browser'][_0xfd07('0x32')]&&_0x3c855a[_0xfd07('0x4d')][_0xfd07('0x4e')]?util['format'](_0xfd07('0x4f'),_0x3c855a['browser'][_0xfd07('0x32')],_0x3c855a['browser'][_0xfd07('0x4e')]):_0xfd07('0x50'),'browserVersion':_0x3c855a[_0xfd07('0x4d')][_0xfd07('0x4e')]||_0xfd07('0x50'),'osName':util[_0xfd07('0x51')](_0xfd07('0x4f'),_0x3c855a['os']['name'],_0x3c855a['os'][_0xfd07('0x4e')]),'osVersion':_0x3c855a['os'][_0xfd07('0x4e')],'deviceModel':_0x3c855a[_0xfd07('0x52')][_0xfd07('0x53')]&&_0x3c855a[_0xfd07('0x52')][_0xfd07('0x54')]?util[_0xfd07('0x51')](_0xfd07('0x55'),_0x3c855a['device']['model'],_0x3c855a['device']['vendor'],_0x3c855a[_0xfd07('0x52')][_0xfd07('0x56')]):null,'deviceVendor':_0x3c855a[_0xfd07('0x52')][_0xfd07('0x54')],'deviceType':_0x3c855a[_0xfd07('0x52')][_0xfd07('0x56')],'formData':JSON[_0xfd07('0x1d')](_0x1ea91f)};}exports[_0xfd07('0x57')]=function(_0x34b77d,_0x254b47){var _0x177fcf={'include':[{'model':db[_0xfd07('0x58')],'as':_0xfd07('0x59')}]},_0x5e852e={},_0x3e441b={'count':0x0,'rows':[]};var _0x5b523c=_['map'](db[_0xfd07('0x5a')]['rawAttributes'],function(_0x4e809a){return{'name':_0x4e809a[_0xfd07('0x5b')],'type':_0x4e809a[_0xfd07('0x56')][_0xfd07('0x5c')]};});_0x5e852e[_0xfd07('0x53')]=_[_0xfd07('0x3e')](_0x5b523c,_0xfd07('0x32'));_0x5e852e[_0xfd07('0x5d')]=_[_0xfd07('0x5e')](_0x34b77d[_0xfd07('0x5d')]);_0x5e852e['filters']=_['intersection'](_0x5e852e[_0xfd07('0x53')],_0x5e852e['query']);_0x177fcf[_0xfd07('0x5f')]=_[_0xfd07('0x60')](_0x5e852e[_0xfd07('0x53')],qs[_0xfd07('0x61')](_0x34b77d[_0xfd07('0x5d')]['fields']));_0x177fcf[_0xfd07('0x5f')]=_0x177fcf[_0xfd07('0x5f')][_0xfd07('0x62')]?_0x177fcf['attributes']:_0x5e852e[_0xfd07('0x53')];if(!_0x34b77d[_0xfd07('0x5d')][_0xfd07('0x63')](_0xfd07('0x64'))){_0x177fcf[_0xfd07('0x27')]=qs['limit'](_0x34b77d['query'][_0xfd07('0x27')]);_0x177fcf['offset']=qs[_0xfd07('0x25')](_0x34b77d[_0xfd07('0x5d')][_0xfd07('0x25')]);}_0x177fcf['order']=qs[_0xfd07('0x65')](_0x34b77d[_0xfd07('0x5d')][_0xfd07('0x65')]);_0x177fcf[_0xfd07('0x66')]=qs[_0xfd07('0x67')](_[_0xfd07('0x68')](_0x34b77d[_0xfd07('0x5d')],_0x5e852e[_0xfd07('0x67')]),_0x5b523c);if(_0x34b77d[_0xfd07('0x5d')]['filter']){_0x177fcf[_0xfd07('0x66')]=_[_0xfd07('0x69')](_0x177fcf['where'],{'$or':_[_0xfd07('0x3e')](_0x5b523c,function(_0x3d1345){if(_0x3d1345[_0xfd07('0x56')]!=='VIRTUAL'){var _0x896129={};_0x896129[_0x3d1345['name']]={'$like':'%'+_0x34b77d['query'][_0xfd07('0x6a')]+'%'};return _0x896129;}})});}_0x177fcf=_['merge']({},_0x177fcf,_0x34b77d['options']);var _0x33dc39={'where':_0x177fcf[_0xfd07('0x66')]};return db[_0xfd07('0x5a')]['count'](_0x33dc39)[_0xfd07('0x18')](function(_0x5a028d){_0x3e441b[_0xfd07('0x28')]=_0x5a028d;if(_0x34b77d[_0xfd07('0x5d')][_0xfd07('0x6b')]){_0x177fcf[_0xfd07('0x6c')]=[{'all':!![]}];}return db[_0xfd07('0x5a')][_0xfd07('0x6d')](_0x177fcf);})['then'](function(_0x4c0f57){_0x3e441b[_0xfd07('0x6e')]=_0x4c0f57;return _0x3e441b;})[_0xfd07('0x18')](respondWithFilteredResult(_0x254b47,_0x177fcf))[_0xfd07('0x3d')](handleError(_0x254b47,null));};exports[_0xfd07('0x6f')]=function(_0x883675,_0x8bc172){var _0xbd145a={'raw':![],'where':{'id':_0x883675[_0xfd07('0x70')]['id']},'include':[{'model':db[_0xfd07('0x58')],'as':_0xfd07('0x59')}]},_0x1cafcd={};_0x1cafcd[_0xfd07('0x53')]=_[_0xfd07('0x5e')](db['ChatWebsite'][_0xfd07('0x71')]);_0x1cafcd['query']=_[_0xfd07('0x5e')](_0x883675['query']);_0x1cafcd[_0xfd07('0x67')]=_['intersection'](_0x1cafcd[_0xfd07('0x53')],_0x1cafcd['query']);_0xbd145a[_0xfd07('0x5f')]=_[_0xfd07('0x60')](_0x1cafcd[_0xfd07('0x53')],qs[_0xfd07('0x61')](_0x883675[_0xfd07('0x5d')]['fields']));_0xbd145a[_0xfd07('0x5f')]=_0xbd145a['attributes']['length']?_0xbd145a[_0xfd07('0x5f')]:_0x1cafcd[_0xfd07('0x53')];if(_0x883675[_0xfd07('0x5d')]['includeAll']){_0xbd145a[_0xfd07('0x6c')]=[{'all':!![]}];}_0xbd145a=_['merge']({},_0xbd145a,_0x883675[_0xfd07('0x72')]);return db[_0xfd07('0x5a')]['find'](_0xbd145a)[_0xfd07('0x18')](handleEntityNotFound(_0x8bc172,null))[_0xfd07('0x18')](respondWithResult(_0x8bc172,null))['catch'](handleError(_0x8bc172,null));};exports[_0xfd07('0x73')]=function(_0x35bb28,_0x5abd46){return db[_0xfd07('0x5a')][_0xfd07('0x73')](_0x35bb28[_0xfd07('0x74')],{})[_0xfd07('0x18')](function(_0x380bba){var _0x4354f2=_0x35bb28[_0xfd07('0x75')][_0xfd07('0x2e')]({'plain':!![]});if(!_0x4354f2)throw new Error(_0xfd07('0x76'));if(_0x4354f2['role']===_0xfd07('0x75')){var _0x27706e=_0x380bba[_0xfd07('0x2e')]({'plain':!![]});var _0xbe9101=_0xfd07('0x2f');return db[_0xfd07('0x77')][_0xfd07('0x78')]({'where':{'name':_0xbe9101,'userProfileId':_0x4354f2[_0xfd07('0x79')]},'raw':!![]})[_0xfd07('0x18')](function(_0x4d0f1e){if(_0x4d0f1e&&_0x4d0f1e[_0xfd07('0x7a')]===0x0){return db[_0xfd07('0x30')][_0xfd07('0x73')]({'name':_0x27706e['name'],'resourceId':_0x27706e['id'],'type':_0x4d0f1e[_0xfd07('0x32')],'sectionId':_0x4d0f1e['id']},{})[_0xfd07('0x18')](function(){return _0x380bba;});}else{return _0x380bba;}})[_0xfd07('0x3d')](function(_0x21e726){logger['error'](_0xfd07('0x7b'),_0x21e726);throw _0x21e726;});}return _0x380bba;})[_0xfd07('0x18')](respondWithResult(_0x5abd46,0xc9))['catch'](handleError(_0x5abd46,null));};exports[_0xfd07('0x2c')]=function(_0xf02622,_0x2c1b3c){if(_0xf02622[_0xfd07('0x74')]['id']){delete _0xf02622[_0xfd07('0x74')]['id'];}return db['ChatWebsite'][_0xfd07('0x78')]({'where':{'id':_0xf02622[_0xfd07('0x70')]['id']},'include':[{'model':db[_0xfd07('0x58')],'as':_0xfd07('0x59')}]})[_0xfd07('0x18')](handleEntityNotFound(_0x2c1b3c,null))[_0xfd07('0x18')](saveUpdates(_0xf02622['body'],null))[_0xfd07('0x18')](respondWithResult(_0x2c1b3c,null))[_0xfd07('0x3d')](handleError(_0x2c1b3c,null));};exports[_0xfd07('0x2d')]=function(_0x538027,_0x3a9dae){return db[_0xfd07('0x5a')][_0xfd07('0x78')]({'where':{'id':_0x538027[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x3a9dae,null))['then'](removeEntity(_0x3a9dae,null))['catch'](handleError(_0x3a9dae,null));};exports[_0xfd07('0x7c')]=function(_0x4e9290,_0x35871c){return db['ChatWebsite'][_0xfd07('0x7c')]()['then'](respondWithResult(_0x35871c,null))['catch'](handleError(_0x35871c,null));};exports['addDisposition']=function(_0x1b4e7d,_0xa19f27){if(_0x1b4e7d[_0xfd07('0x74')]['id']){delete _0x1b4e7d[_0xfd07('0x74')]['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x1b4e7d[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0xa19f27,null))[_0xfd07('0x18')](function(_0x4c9421){if(_0x4c9421){_0x1b4e7d[_0xfd07('0x74')][_0xfd07('0x7d')]=_0x4c9421['id'];return db[_0xfd07('0x7e')][_0xfd07('0x73')](_0x1b4e7d[_0xfd07('0x74')]);}})[_0xfd07('0x18')](respondWithResult(_0xa19f27,null))[_0xfd07('0x3d')](handleError(_0xa19f27,null));};exports[_0xfd07('0x7f')]=function(_0x4856cf,_0xe0c4f8){var _0x470826={'raw':![],'where':{}};var _0x349dcb={};var _0x344642={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xfd07('0x80')]({'where':{'id':_0x4856cf['params']['id']}})['then'](handleEntityNotFound(_0xe0c4f8,null))[_0xfd07('0x18')](function(_0x97b7f8){if(_0x97b7f8){_0x349dcb[_0xfd07('0x53')]=_[_0xfd07('0x5e')](db['Disposition'][_0xfd07('0x71')]);_0x349dcb[_0xfd07('0x5d')]=_['keys'](_0x4856cf['query']);_0x349dcb[_0xfd07('0x67')]=_[_0xfd07('0x60')](_0x349dcb[_0xfd07('0x53')],_0x349dcb[_0xfd07('0x5d')]);_0x470826['attributes']=_[_0xfd07('0x60')](_0x349dcb['model'],qs[_0xfd07('0x61')](_0x4856cf[_0xfd07('0x5d')][_0xfd07('0x61')]));_0x470826[_0xfd07('0x5f')]=_0x470826[_0xfd07('0x5f')][_0xfd07('0x62')]?_0x470826[_0xfd07('0x5f')]:_0x349dcb[_0xfd07('0x53')];if(!_0x4856cf[_0xfd07('0x5d')][_0xfd07('0x63')](_0xfd07('0x64'))){_0x470826['limit']=qs['limit'](_0x4856cf[_0xfd07('0x5d')][_0xfd07('0x27')]);_0x470826['offset']=qs[_0xfd07('0x25')](_0x4856cf[_0xfd07('0x5d')][_0xfd07('0x25')]);}_0x470826[_0xfd07('0x81')]=qs[_0xfd07('0x65')](_0x4856cf['query'][_0xfd07('0x65')]);_0x470826[_0xfd07('0x66')]=qs[_0xfd07('0x67')](_[_0xfd07('0x68')](_0x4856cf[_0xfd07('0x5d')],_0x349dcb[_0xfd07('0x67')]));_0x470826['where'][_0xfd07('0x7d')]=_0x97b7f8['id'];if(_0x4856cf[_0xfd07('0x5d')][_0xfd07('0x6a')]){_0x470826[_0xfd07('0x66')]=_[_0xfd07('0x69')](_0x470826[_0xfd07('0x66')],{'$or':_['map'](_0x470826[_0xfd07('0x5f')],function(_0x5789db){var _0x362db9={};_0x362db9[_0x5789db]={'$like':'%'+_0x4856cf[_0xfd07('0x5d')][_0xfd07('0x6a')]+'%'};return _0x362db9;})});}_0x470826=_[_0xfd07('0x69')]({},_0x470826,_0x4856cf[_0xfd07('0x72')]);return db['Disposition']['count']({'where':_0x470826[_0xfd07('0x66')]})[_0xfd07('0x18')](function(_0x5cfec4){_0x344642[_0xfd07('0x28')]=_0x5cfec4;if(_0x4856cf[_0xfd07('0x5d')][_0xfd07('0x6b')]){_0x470826[_0xfd07('0x6c')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x470826);})['then'](function(_0x44a103){_0x344642[_0xfd07('0x6e')]=_0x44a103;return _0x344642;});}})['then'](respondWithFilteredResult(_0xe0c4f8,_0x470826))['catch'](handleError(_0xe0c4f8,null));};exports[_0xfd07('0x82')]=function(_0x3dd9c0,_0x2cb403){return db[_0xfd07('0x5a')][_0xfd07('0x78')]({'where':{'id':_0x3dd9c0['params']['id']}})['then'](handleEntityNotFound(_0x2cb403,null))[_0xfd07('0x18')](function(_0x56e647){if(_0x56e647){return _0x56e647['removeDispositions'](_0x3dd9c0[_0xfd07('0x5d')][_0xfd07('0x83')]);}})[_0xfd07('0x18')](respondWithStatusCode(_0x2cb403,null))[_0xfd07('0x3d')](handleError(_0x2cb403,null));};exports[_0xfd07('0x84')]=function(_0x4be356,_0x3296d3){if(_0x4be356[_0xfd07('0x74')]['id']){delete _0x4be356[_0xfd07('0x74')]['id'];}return db[_0xfd07('0x5a')][_0xfd07('0x78')]({'where':{'id':_0x4be356[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x3296d3,null))[_0xfd07('0x18')](function(_0x23b1d8){if(_0x23b1d8){_0x4be356[_0xfd07('0x74')]['ChatWebsiteId']=_0x23b1d8['id'];return db['CannedAnswer']['create'](_0x4be356[_0xfd07('0x74')]);}})[_0xfd07('0x18')](respondWithResult(_0x3296d3,null))[_0xfd07('0x3d')](handleError(_0x3296d3,null));};exports['getAnswers']=function(_0x194f5a,_0x102d7c){var _0x2e5727={'raw':![],'where':{}};var _0x2e6bbe={};var _0x4166fb={'count':0x0,'rows':[]};return db[_0xfd07('0x5a')][_0xfd07('0x80')]({'where':{'id':_0x194f5a[_0xfd07('0x70')]['id']}})['then'](handleEntityNotFound(_0x102d7c,null))[_0xfd07('0x18')](function(_0x20ea7f){if(_0x20ea7f){_0x2e6bbe[_0xfd07('0x53')]=_[_0xfd07('0x5e')](db[_0xfd07('0x85')][_0xfd07('0x71')]);_0x2e6bbe[_0xfd07('0x5d')]=_['keys'](_0x194f5a[_0xfd07('0x5d')]);_0x2e6bbe[_0xfd07('0x67')]=_[_0xfd07('0x60')](_0x2e6bbe[_0xfd07('0x53')],_0x2e6bbe[_0xfd07('0x5d')]);_0x2e5727['attributes']=_[_0xfd07('0x60')](_0x2e6bbe[_0xfd07('0x53')],qs[_0xfd07('0x61')](_0x194f5a[_0xfd07('0x5d')][_0xfd07('0x61')]));_0x2e5727[_0xfd07('0x5f')]=_0x2e5727['attributes']['length']?_0x2e5727['attributes']:_0x2e6bbe[_0xfd07('0x53')];if(!_0x194f5a['query'][_0xfd07('0x63')](_0xfd07('0x64'))){_0x2e5727[_0xfd07('0x27')]=qs['limit'](_0x194f5a['query']['limit']);_0x2e5727[_0xfd07('0x25')]=qs[_0xfd07('0x25')](_0x194f5a[_0xfd07('0x5d')][_0xfd07('0x25')]);}_0x2e5727[_0xfd07('0x81')]=qs[_0xfd07('0x65')](_0x194f5a[_0xfd07('0x5d')]['sort']);_0x2e5727['where']=qs['filters'](_['pick'](_0x194f5a[_0xfd07('0x5d')],_0x2e6bbe['filters']));_0x2e5727['where'][_0xfd07('0x7d')]=_0x20ea7f['id'];if(_0x194f5a[_0xfd07('0x5d')][_0xfd07('0x6a')]){_0x2e5727[_0xfd07('0x66')]=_[_0xfd07('0x69')](_0x2e5727[_0xfd07('0x66')],{'$or':_[_0xfd07('0x3e')](_0x2e5727['attributes'],function(_0x54b562){var _0x2b1c81={};_0x2b1c81[_0x54b562]={'$like':'%'+_0x194f5a[_0xfd07('0x5d')][_0xfd07('0x6a')]+'%'};return _0x2b1c81;})});}_0x2e5727=_[_0xfd07('0x69')]({},_0x2e5727,_0x194f5a['options']);return db['CannedAnswer'][_0xfd07('0x28')]({'where':_0x2e5727['where']})[_0xfd07('0x18')](function(_0x4456a5){_0x4166fb['count']=_0x4456a5;if(_0x194f5a[_0xfd07('0x5d')]['includeAll']){_0x2e5727[_0xfd07('0x6c')]=[{'all':!![]}];}return db[_0xfd07('0x85')][_0xfd07('0x6d')](_0x2e5727);})[_0xfd07('0x18')](function(_0x2c252f){_0x4166fb['rows']=_0x2c252f;return _0x4166fb;});}})['then'](respondWithFilteredResult(_0x102d7c,_0x2e5727))[_0xfd07('0x3d')](handleError(_0x102d7c,null));};exports[_0xfd07('0x86')]=function(_0x48364a,_0x14c171){return db['ChatWebsite'][_0xfd07('0x78')]({'where':{'id':_0x48364a[_0xfd07('0x70')]['id']}})['then'](handleEntityNotFound(_0x14c171,null))[_0xfd07('0x18')](function(_0x47a0bc){if(_0x47a0bc){return _0x47a0bc[_0xfd07('0x86')](_0x48364a[_0xfd07('0x5d')][_0xfd07('0x83')]);}})['then'](respondWithStatusCode(_0x14c171,null))[_0xfd07('0x3d')](handleError(_0x14c171,null));};exports[_0xfd07('0x87')]=function(_0x2d8881,_0x2c29d0){_0x2d8881['body']['sitepic']=_0x2d8881[_0xfd07('0x88')][_0xfd07('0x89')];return db[_0xfd07('0x5a')][_0xfd07('0x78')]({'where':{'id':_0x2d8881[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x2c29d0,null))[_0xfd07('0x18')](saveUpdates(_0x2d8881[_0xfd07('0x74')],null))[_0xfd07('0x18')](respondWithResult(_0x2c29d0,null))['catch'](handleError(_0x2c29d0,null));};exports[_0xfd07('0x8a')]=function(_0x492ded,_0x1a5d8e){_0x492ded[_0xfd07('0x74')][_0xfd07('0x8b')]=_0x492ded[_0xfd07('0x88')][_0xfd07('0x89')];return db[_0xfd07('0x5a')]['find']({'where':{'id':_0x492ded[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x1a5d8e,null))[_0xfd07('0x18')](saveUpdates(_0x492ded[_0xfd07('0x74')],null))[_0xfd07('0x18')](respondWithResult(_0x1a5d8e,null))[_0xfd07('0x3d')](handleError(_0x1a5d8e,null));};exports[_0xfd07('0x8c')]=function(_0x3fc6ad,_0xd081c3){_0x3fc6ad[_0xfd07('0x74')]['customerAvatar']=_0x3fc6ad[_0xfd07('0x88')][_0xfd07('0x89')];return db[_0xfd07('0x5a')]['find']({'where':{'id':_0x3fc6ad[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0xd081c3,null))[_0xfd07('0x18')](saveUpdates(_0x3fc6ad[_0xfd07('0x74')],null))[_0xfd07('0x18')](respondWithResult(_0xd081c3,null))[_0xfd07('0x3d')](handleError(_0xd081c3,null));};exports[_0xfd07('0x8d')]=function(_0x13b52d,_0x2358b5){_0x13b52d[_0xfd07('0x74')][_0xfd07('0x8e')]=_0x13b52d[_0xfd07('0x88')][_0xfd07('0x89')];return db['ChatWebsite']['find']({'where':{'id':_0x13b52d[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x2358b5,null))[_0xfd07('0x18')](saveUpdates(_0x13b52d['body'],null))[_0xfd07('0x18')](respondWithResult(_0x2358b5,null))['catch'](handleError(_0x2358b5,null));};exports[_0xfd07('0x8f')]=function(_0x2be115,_0x41d462){var _0x4ac032=path[_0xfd07('0x90')](config[_0xfd07('0x91')],'server/files/images/logos/default_logo.svg');var _0x3762a9={'where':{'id':_0x2be115['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3976d0=![];return require(_0xfd07('0x92'))[_0xfd07('0x93')]()[_0xfd07('0x18')](function(_0x3e2244){if(_0x3e2244){_0x3976d0=_0x3e2244[_0xfd07('0x94')];}})['then'](function(){return db[_0xfd07('0x5a')][_0xfd07('0x78')](_0x3762a9);})[_0xfd07('0x18')](handleEntityNotFound(_0x41d462,null))[_0xfd07('0x18')](function(_0xc1eb04){if(_0xc1eb04){if(!_[_0xfd07('0x95')](_0xc1eb04['sitepic'])){if(fs['existsSync'](path[_0xfd07('0x90')](config[_0xfd07('0x91')],_0xfd07('0x96'),_0xc1eb04['sitepic']))&&_0x3976d0){_0x4ac032=path[_0xfd07('0x90')](config[_0xfd07('0x91')],_0xfd07('0x96'),_0xc1eb04[_0xfd07('0x97')]);}}return _0x41d462[_0xfd07('0x98')](_0x4ac032);}})['catch'](handleError(_0x41d462,null));};exports['getAvatar']=function(_0x15123f,_0x3df47c){var _0x391f4e=path[_0xfd07('0x90')](config[_0xfd07('0x91')],_0xfd07('0x99'));var _0xbc93a8={'where':{'id':_0x15123f['params']['id']},'attributes':['id',_0xfd07('0x8b')],'raw':!![]};return db[_0xfd07('0x5a')][_0xfd07('0x78')](_0xbc93a8)['then'](handleEntityNotFound(_0x3df47c,null))[_0xfd07('0x18')](function(_0x3a8f3e){if(_0x3a8f3e){if(!_[_0xfd07('0x95')](_0x3a8f3e['agentAvatar'])){if(fs[_0xfd07('0x9a')](path[_0xfd07('0x90')](config[_0xfd07('0x91')],_0xfd07('0x9b'),_0x3a8f3e[_0xfd07('0x8b')]))){_0x391f4e=path[_0xfd07('0x90')](config['root'],_0xfd07('0x9b'),_0x3a8f3e['agentAvatar']);}}return _0x3df47c['download'](_0x391f4e);}})[_0xfd07('0x3d')](handleError(_0x3df47c,null));};exports[_0xfd07('0x9c')]=function(_0x376ee1,_0x54d9ca){var _0x3f7f86=path[_0xfd07('0x90')](config['root'],_0xfd07('0x9d'));var _0x4ae84f={'where':{'id':_0x376ee1[_0xfd07('0x70')]['id']},'attributes':['id','customerAvatar',_0xfd07('0x9e')],'raw':!![]};return db[_0xfd07('0x5a')][_0xfd07('0x78')](_0x4ae84f)[_0xfd07('0x18')](handleEntityNotFound(_0x54d9ca,null))[_0xfd07('0x18')](function(_0x53f6ab){if(_0x53f6ab){if(!_[_0xfd07('0x95')](_0x53f6ab[_0xfd07('0x9f')])){if(fs[_0xfd07('0x9a')](path['join'](config[_0xfd07('0x91')],'server/files/images/avatars/',_0x53f6ab[_0xfd07('0x9f')]))&&_0x53f6ab[_0xfd07('0x9e')]){_0x3f7f86=path['join'](config[_0xfd07('0x91')],_0xfd07('0x9b'),_0x53f6ab[_0xfd07('0x9f')]);}}return _0x54d9ca[_0xfd07('0x98')](_0x3f7f86);}})[_0xfd07('0x3d')](handleError(_0x54d9ca,null));};exports['getSystemAvatar']=function(_0x33c95b,_0xd826d3){var _0x38027b=path[_0xfd07('0x90')](config['root'],'server/files/images/avatars/system_avatar.png');var _0xbf0a={'where':{'id':_0x33c95b[_0xfd07('0x70')]['id']},'attributes':['id',_0xfd07('0x8e')],'raw':!![]};return db['ChatWebsite'][_0xfd07('0x78')](_0xbf0a)[_0xfd07('0x18')](handleEntityNotFound(_0xd826d3,null))[_0xfd07('0x18')](function(_0x1b266b){if(_0x1b266b){if(!_[_0xfd07('0x95')](_0x1b266b[_0xfd07('0x8e')])){if(fs[_0xfd07('0x9a')](path[_0xfd07('0x90')](config[_0xfd07('0x91')],_0xfd07('0x9b'),_0x1b266b[_0xfd07('0x8e')]))){_0x38027b=path[_0xfd07('0x90')](config['root'],_0xfd07('0x9b'),_0x1b266b[_0xfd07('0x8e')]);}}return _0xd826d3[_0xfd07('0x98')](_0x38027b);}})[_0xfd07('0x3d')](handleError(_0xd826d3,null));};exports[_0xfd07('0xa0')]=function(_0x5daa14,_0x5cf815){var _0x542744={'body':_0x5daa14[_0xfd07('0x74')],'channel':_0xfd07('0xa1')};var _0x1e30ac=[];var _0x1b5f08=[];var _0x5f29b0={};var _0xc6ac23=![];return db[_0xfd07('0xa2')][_0xfd07('0x7c')]()[_0xfd07('0x18')](function(_0x4d87f9){if(!_0x4d87f9){throw new db[(_0xfd07('0xa3'))][(_0xfd07('0xa4'))]('no\x20available\x20attributes');}_0x1e30ac=_[_0xfd07('0xa5')](_[_0xfd07('0x5e')](_0x4d87f9),[_0xfd07('0xa6'),'updatedAt']);_0x1b5f08=_[_0xfd07('0xa5')](_[_0xfd07('0x5e')](_0x4d87f9),['createdAt','updatedAt',_0xfd07('0xa7'),_0xfd07('0xa8')]);if(_0x5daa14['body']['id']){delete _0x5daa14['body']['id'];}if(_[_0xfd07('0x95')](_0x5daa14[_0xfd07('0x74')][_0xfd07('0xa9')])){throw new db[(_0xfd07('0xa3'))][(_0xfd07('0xa4'))](_0xfd07('0xaa'));}if(_[_0xfd07('0x95')](_0x5daa14['body'][_0xfd07('0x74')])||_0x5daa14[_0xfd07('0x74')][_0xfd07('0x74')]===''){throw new db[(_0xfd07('0xa3'))][(_0xfd07('0xa4'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xfd07('0x95')](_0x5daa14['body'][_0xfd07('0xab')])){throw new db[(_0xfd07('0xa3'))]['ValidationError'](_0xfd07('0xac')+_0x1b5f08);}if(!_['includes'](_0x1b5f08,_0x5daa14[_0xfd07('0x74')][_0xfd07('0xab')])){throw new db[(_0xfd07('0xa3'))][(_0xfd07('0xa4'))](_0xfd07('0xad')+_0x1b5f08);}_0x5f29b0[_0x5daa14['body'][_0xfd07('0xab')]]=_0x5daa14['body'][_0xfd07('0xa9')];})[_0xfd07('0x18')](function(){return db[_0xfd07('0x5a')][_0xfd07('0x78')]({'where':{'id':_0x5daa14['params']['id']},'include':[{'model':db[_0xfd07('0xae')],'as':_0xfd07('0xaf'),'include':[{'model':db[_0xfd07('0xa2')],'as':'Contacts','where':_0x5f29b0,'limit':0x1,'order':[['updatedAt',_0xfd07('0xb0')]]}]},{'model':db[_0xfd07('0xb1')],'as':'Applications'},{'model':db[_0xfd07('0xb2')],'as':_0xfd07('0xb2'),'include':[{'model':db[_0xfd07('0xb2')],'as':'Intervals','attributes':['id',_0xfd07('0x37')],'raw':!![]}]}]});})[_0xfd07('0x18')](function(_0x37919c){if(!_0x37919c)throw new APINotFoundError(util[_0xfd07('0x51')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x5daa14[_0xfd07('0x70')]['id']));if(!_0x37919c['Interval']||!_0x37919c[_0xfd07('0xb2')]['Intervals'])return[_0x37919c,!![]];return[_0x37919c,checkWebsiteIntervals(_0x37919c)];})['spread'](function(_0x2e3adf,_0x1ca479){if(!_0x1ca479)throw new APIOutOfIntervalError();if(!_0x2e3adf[_0xfd07('0xaf')])return;_0x542744[_0xfd07('0xb3')]=_0x2e3adf;_0x542744['list']=_0x2e3adf['List'];_0x542744[_0xfd07('0xb4')]=_[_0xfd07('0xb5')](_0x2e3adf[_0xfd07('0xb6')],[_0xfd07('0xb7')],[_0xfd07('0xb8')]);if(_0x542744[_0xfd07('0xb3')][_0xfd07('0xb6')]){delete _0x542744['account']['Applications'];}if(_0x542744[_0xfd07('0xb3')][_0xfd07('0xaf')]&&_0x542744['account']['List'][_0xfd07('0xb9')][_0xfd07('0x62')]){return _0x542744[_0xfd07('0xb3')][_0xfd07('0xaf')]['Contacts'][0x0];}var _0x22ad46=_['defaults'](_0x5daa14[_0xfd07('0x74')],{'firstName':_0x5daa14[_0xfd07('0x74')][_0xfd07('0xa9')],'ListId':_0x2e3adf[_0xfd07('0xa8')]});_0x22ad46[_0x5daa14[_0xfd07('0x74')][_0xfd07('0xab')]]=_0x5daa14['body'][_0xfd07('0xa9')];return db[_0xfd07('0xa2')][_0xfd07('0x73')](_0x22ad46,{'fields':_0x1e30ac,'raw':!![]});})[_0xfd07('0x18')](function(_0x483795){_0x542744[_0xfd07('0xba')]=_0x483795;var _0x5d63ff=createInteractionObject(_0x5daa14['params']['id'],_0x5daa14[_0xfd07('0x74')],_0x5daa14[_0xfd07('0xbb')],_0x483795);var _0x2addda={'ChatWebsiteId':_0x5daa14[_0xfd07('0x70')]['id'],'closed':![]};if(_0x5daa14[_0xfd07('0x74')][_0xfd07('0xbc')]){_0x2addda[_0xfd07('0xbc')]=_0x5daa14['body'][_0xfd07('0xbc')];return db[_0xfd07('0xbd')][_0xfd07('0x78')]({'where':_0x2addda})[_0xfd07('0x18')](function(_0x2a427c){if(_0x2a427c){_0xc6ac23=!![];return _0x2a427c;}_0x5d63ff[_0xfd07('0xbc')]=_0x5daa14[_0xfd07('0x74')][_0xfd07('0xbc')];_0x5d63ff[_0xfd07('0xbe')]=_0x5daa14[_0xfd07('0x74')][_0xfd07('0xbe')];return db[_0xfd07('0xbd')][_0xfd07('0x73')](_0x5d63ff);});}_0x2addda[_0xfd07('0xbf')]=_0x483795['id'];if(_0x5daa14[_0xfd07('0x74')][_0xfd07('0xc0')]&&_0x5daa14[_0xfd07('0x74')][_0xfd07('0xc0')]['id']){_0x2addda['id']=_0x5daa14[_0xfd07('0x74')][_0xfd07('0xc0')]['id'];return db[_0xfd07('0xbd')][_0xfd07('0x78')]({'where':_0x2addda})[_0xfd07('0x18')](function(_0x3bbc53){if(_0x3bbc53){_0xc6ac23=!![];return _0x3bbc53;}return db[_0xfd07('0xbd')][_0xfd07('0x73')](_0x5d63ff);});}return db[_0xfd07('0xbd')][_0xfd07('0x73')](_0x5d63ff);})['then'](function(_0x48f633){if(!_0xc6ac23)return _0x48f633;var _0x2929e9={'from':(_0x542744[_0xfd07('0xba')][_0xfd07('0x4a')]||'')+'\x20'+(_0x542744[_0xfd07('0xba')]['lastName']||'')};if(_0x5daa14[_0xfd07('0x74')][_0xfd07('0xbc')]&&_0x5daa14[_0xfd07('0x74')][_0xfd07('0xc1')]&&_0x5daa14[_0xfd07('0x74')][_0xfd07('0xbc')]!=_0x5daa14[_0xfd07('0x74')][_0xfd07('0xc1')]){_0x2929e9[_0xfd07('0xbc')]=_0x5daa14[_0xfd07('0x74')][_0xfd07('0xc1')];}return _0x48f633['update'](_0x2929e9);})['then'](function(_0x282287){_0x542744[_0xfd07('0xc0')]=_0x282287[_0xfd07('0x2e')]({'plain':!![]});_0x542744[_0xfd07('0xc0')]['created']=!_0xc6ac23;if(_0x542744[_0xfd07('0xc0')][_0xfd07('0xc2')]){if(_0x542744[_0xfd07('0xb3')][_0xfd07('0xc3')]){_0x542744[_0xfd07('0xb4')][_0xfd07('0xc4')]({'id':0x0,'priority':_0x542744['applications'][_0xfd07('0x62')]+0x1,'app':_0xfd07('0xc5'),'appdata':'unmanaged','interval':_0xfd07('0xc6')});}}return db[_0xfd07('0xc7')][_0xfd07('0x73')]({'body':_0x5daa14['body'][_0xfd07('0x74')],'ChatWebsiteId':_0x5daa14[_0xfd07('0x70')]['id'],'ChatInteractionId':_0x282287['id'],'direction':'in','ContactId':_0x542744[_0xfd07('0xba')]['id'],'AttachmentId':_0x5daa14[_0xfd07('0x74')]['AttachmentId']});})[_0xfd07('0x18')](function(_0x5a1619){_0x542744[_0xfd07('0x1f')]=_0x5a1619;if(!_0x542744[_0xfd07('0xc0')][_0xfd07('0xc8')]){return;}return db[_0xfd07('0xc9')][_0xfd07('0x78')]({'attributes':['id',_0xfd07('0x32')],'where':{'id':_0x542744[_0xfd07('0xc0')][_0xfd07('0xc8')]}});})[_0xfd07('0x18')](function(_0x5e630d){if(_0x5e630d){_0x542744[_0xfd07('0xb4')][_0xfd07('0xca')]({'id':0x0,'priority':0x0,'app':_0xfd07('0xcb'),'appdata':_0x5e630d[_0xfd07('0x32')]+','+(_0x542744['account'][_0xfd07('0xcc')]||0xa),'interval':_0xfd07('0xc6')});_0x542744[_0xfd07('0xcd')]=!![];}if(!_0x542744[_0xfd07('0xc0')][_0xfd07('0xce')]){return;}return db[_0xfd07('0xcf')][_0xfd07('0x78')]({'attributes':['id',_0xfd07('0x32')],'where':{'id':_0x542744['interaction']['queueId']}});})[_0xfd07('0x18')](function(_0x463882){if(_0x463882){_0x542744['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xfd07('0xd0'),'appdata':_0x463882[_0xfd07('0x32')]+','+(_0x542744[_0xfd07('0xb3')]['waitForTheAssignedQueue']||0x12c),'interval':_0xfd07('0xc6')});}return respondWithRpcPromise(_0xfd07('0xd1'),_0xfd07('0xd2'),_0x542744);})[_0xfd07('0x18')](function(_0x8788ef){respondWithRpcPromise('EventManager','EventManager',{'event':'notify','message':_0x8788ef},client9002);return _0x8788ef;})['then'](respondWithResult(_0x5cf815,null))[_0xfd07('0x3d')](APIHandleError(_0x5cf815));};exports[_0xfd07('0xd3')]=function(_0x219e62,_0x191f75){var _0x4a47f3,_0x5ab3a7,_0x5c21e7;var _0x492e3b=[];var _0x597d69={};var _0x2838d3=_0x219e62[_0xfd07('0xd4')]||[];var _0x422054=[];var _0xbad986;return db[_0xfd07('0xa2')]['describe']()[_0xfd07('0x18')](function(_0x550ce9){if(!_0x550ce9){throw new db['Sequelize']['ValidationError'](_0xfd07('0xd5'));}_0x492e3b=_['difference'](_[_0xfd07('0x5e')](_0x550ce9),[_0xfd07('0xa6'),_0xfd07('0xd6'),_0xfd07('0xa7'),'ListId']);if(_0x219e62[_0xfd07('0x74')]['id']){delete _0x219e62[_0xfd07('0x74')]['id'];}if(_[_0xfd07('0x95')](_0x219e62['body'][_0xfd07('0xa9')])){throw _0x191f75[_0xfd07('0x24')](0x1f4)[_0xfd07('0xd7')](new db[(_0xfd07('0xa3'))][(_0xfd07('0xa4'))](_0xfd07('0xaa')));}if(_['isNil'](_0x219e62[_0xfd07('0x74')][_0xfd07('0x74')])||_0x219e62[_0xfd07('0x74')]['body']===''){throw _0x191f75['status'](0x1f4)['send'](new db[(_0xfd07('0xa3'))]['ValidationError'](_0xfd07('0xd8')));}if(_[_0xfd07('0x95')](_0x219e62[_0xfd07('0x74')][_0xfd07('0xd9')])){throw _0x191f75['status'](0x1f4)[_0xfd07('0xd7')](new db['Sequelize'][(_0xfd07('0xa4'))](_0xfd07('0xda')+_0x492e3b));}if(!_['includes'](_0x492e3b,_0x219e62[_0xfd07('0x74')]['mapKeyOffline'])){throw _0x191f75['status'](0x1f4)['send'](new db[(_0xfd07('0xa3'))][(_0xfd07('0xa4'))](_0xfd07('0xdb')+_0x492e3b));}_0x597d69[_0x219e62[_0xfd07('0x74')]['mapKeyOffline']]=_0x219e62[_0xfd07('0x74')][_0xfd07('0xa9')];})[_0xfd07('0x18')](function(){return db[_0xfd07('0x5a')][_0xfd07('0x78')]({'where':{'id':_0x219e62[_0xfd07('0x70')]['id']},'include':[{'model':db[_0xfd07('0xae')],'as':_0xfd07('0xaf')},{'model':db['MailAccount'],'as':_0xfd07('0xdc')}]});})['then'](handleEntityNotFound(_0x191f75,null))[_0xfd07('0x18')](function(_0x1fb2df){if(_0x1fb2df&&_0x1fb2df[_0xfd07('0xaf')]){_0x5ab3a7=_0x1fb2df;var _0x1a1991=_[_0xfd07('0xdd')](_0x219e62[_0xfd07('0x74')],{'firstName':_0x219e62[_0xfd07('0x74')][_0xfd07('0xa9')],'phone':_0x219e62[_0xfd07('0x74')]['from'],'ListId':_0x1fb2df[_0xfd07('0xa8')]});_0x1a1991[_0x219e62[_0xfd07('0x74')][_0xfd07('0xd9')]]=_0x219e62[_0xfd07('0x74')][_0xfd07('0xa9')];return db[_0xfd07('0xa2')][_0xfd07('0xde')]({'where':_0x597d69,'defaults':_0x1a1991});}})['spread'](function(_0x4c3e3e){if(_0x4c3e3e){_0x5c21e7=_0x4c3e3e;var _0x428e1f=fs['readFileSync'](path[_0xfd07('0x90')](config[_0xfd07('0x91')],_0xfd07('0xdf')),_0xfd07('0xe0'));var _0x2ab4c5=ejs['render'](_0x428e1f,{'body':_[_0xfd07('0xe1')](_0x219e62[_0xfd07('0x74')][_0xfd07('0x74')]),'bodyTitle':_0x5ab3a7[_0xfd07('0xe2')]});return db[_0xfd07('0xe3')][_0xfd07('0x73')]({'body':_0x2ab4c5,'plainBody':htmlToText[_0xfd07('0xe4')](_0x2ab4c5),'ContactId':_0x4c3e3e['id'],'ChatWebsiteId':_0x5ab3a7['id']});}})[_0xfd07('0x18')](function(_0x5e4025){_0xbad986=_0x5e4025;if(_0x2838d3[_0xfd07('0x62')]){var _0x5b1717=_0x2838d3[_0xfd07('0x3e')](function(_0x4928c2){return{'name':_0x4928c2['originalname'],'basename':_0x4928c2[_0xfd07('0x89')],'type':_0x4928c2['mimetype'],'ChatOfflineMessageId':_0x5e4025['id']};});_0x422054=_0x5b1717[_0xfd07('0x3e')](_0x2babd2=>{var _0x484735={'filename':_0x2babd2[_0xfd07('0x32')],'path':path[_0xfd07('0x90')](config[_0xfd07('0x91')],_0xfd07('0xe5'),'files','attachments',_0xfd07('0xe6'),_0x2babd2[_0xfd07('0xe7')])};return _0x484735;});if(!_0x5ab3a7[_0xfd07('0xe8')]){return db[_0xfd07('0xe9')][_0xfd07('0xea')](function(_0x5ac3a6){return db[_0xfd07('0xeb')][_0xfd07('0xec')](_0x5b1717,{'transaction':_0x5ac3a6});});}}})[_0xfd07('0x18')](function(){if(_0xbad986){_0x4a47f3=_0xbad986;return db[_0xfd07('0xdc')][_0xfd07('0x80')]({'where':{'service':!![]},'include':[{'model':db[_0xfd07('0xed')],'as':_0xfd07('0xee'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0xfd07('0x18')](function(_0x300c45){if(_0x300c45&&_0x300c45[_0xfd07('0xee')]&&_0x5ab3a7[_0xfd07('0xef')]&&_0x5ab3a7['forwardOfflineAddress']){var _0x49e775=_0x300c45[_0xfd07('0xf0')]();return respondWithRpcPromise(_0xfd07('0xf1'),_0xfd07('0xf2'),{'account':_0x49e775,'message':{'from':util[_0xfd07('0x51')](_0xfd07('0xf3'),_0x300c45[_0xfd07('0x32')],_0x300c45[_0xfd07('0xf4')]||_0x300c45[_0xfd07('0xee')]['user']),'to':_0x5ab3a7[_0xfd07('0xf5')],'subject':_0x5ab3a7[_0xfd07('0xf6')],'html':_0x4a47f3[_0xfd07('0x74')],'attachments':_0x422054}},client9003)['then'](function(){return _0x4a47f3;})[_0xfd07('0x3d')](function(_0x1cffca){logger['error'](_0x1cffca);});}})[_0xfd07('0x18')](function(){if(_0x5ab3a7&&_0x5ab3a7['openNewInteraction']&&_0x5ab3a7[_0xfd07('0xf7')]){var _0x3066d4=[];if(_0x2838d3[_0xfd07('0x62')]){_0x3066d4=_0x2838d3['map'](function(_0x100e3c){return{'name':_0x100e3c[_0xfd07('0xf8')],'basename':_0x100e3c[_0xfd07('0x89')],'type':_0x100e3c['mimetype'],'ChatOfflineMessageId':_0xbad986['id']};});}var _0x3dd839;if(!_['isNil'](_0x5ab3a7[_0xfd07('0xf9')])){var _0x482022=_[_0xfd07('0x3e')](_0x219e62[_0xfd07('0x74')],function(_0x52a14b){return _0x52a14b;});var _0x3d1486=_[_0xfd07('0xfa')](_0x482022)[0x0];var _0x1117aa=_['mapValues'](_0x3d1486,function(_0x300403){return _0x300403;});_0x3dd839=_0x1117aa[0x1][_0x5ab3a7[_0xfd07('0xf9')]];}var _0x2d9c73={'from':_0x5c21e7[_0xfd07('0xf4')],'firstName':_0x5c21e7['firstName'],'lastName':_0x5c21e7['lastName'],'mapKey':_0xfd07('0xf4'),'message':{'from':_0x5c21e7['email'],'to':_0x5ab3a7['MailAccount'][_0xfd07('0xf4')],'cc':'','subject':_['isNil'](_0x3dd839)?_0x5ab3a7['offlineMessageSubject']:_0x3dd839,'messageId':'','sentAt':new Date(),'attach':_0x3066d4[_0xfd07('0x62')],'attachments':_0x3066d4,'originChannel':_0xfd07('0xfb'),'ChatWebsiteId':_0x5ab3a7['id'],'ChatOfflineMessageId':_0x4a47f3['id'],'originTo':_0x5ab3a7['MailAccount']['email']},'body':_0x4a47f3['body']};var _0x4fb1f4={'account':{'id':_0x5ab3a7['MailAccountId']},'body':_0x2d9c73,'log':_0xfd07('0xfc')};return respondWithRpcPromise(_0xfd07('0xfc'),_0xfd07('0xfd'),_0x4fb1f4,client9001)[_0xfd07('0x18')](function(){return _0x4a47f3;})[_0xfd07('0x3d')](function(_0x2f1ec0){logger[_0xfd07('0x1e')](_0x2f1ec0);});}return;})['then'](function(){if(_0x4a47f3){return _0x4a47f3;}})[_0xfd07('0x18')](respondWithResult(_0x191f75,null))['catch'](function(){for(var _0x4e1775 of _0x2838d3){var _0xc45757=path[_0xfd07('0x90')](config['root'],_0xfd07('0xe5'),_0xfd07('0xd4'),_0xfd07('0xfe'),'offline-chat',_0x4e1775[_0xfd07('0x89')]);fs_extra[_0xfd07('0xff')](_0xc45757)[_0xfd07('0x3d')](function(_0x2b50df){logger['error'](_0xfd07('0x100'),_0xc45757,_0x2b50df);});}});};exports[_0xfd07('0x101')]=function(_0x1b285d,_0x38dbff){return db[_0xfd07('0xbd')][_0xfd07('0x78')]({'where':{'id':_0x1b285d[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x38dbff,null))[_0xfd07('0x18')](function(_0x18a8c0){if(_0x18a8c0){return _0x18a8c0[_0xfd07('0x101')](_0x1b285d['body'][_0xfd07('0x83')],_[_0xfd07('0x102')](_0x1b285d[_0xfd07('0x74')],['ids','id'])||{});}})[_0xfd07('0x18')](respondWithResult(_0x38dbff,null))['catch'](handleError(_0x38dbff,null));};exports[_0xfd07('0x103')]=function(_0x29ddbb,_0x2f2239){var _0x125808={'raw':![],'where':{}};var _0x33c46e={};var _0x8ed1bc={'count':0x0,'rows':[]};return db[_0xfd07('0x5a')][_0xfd07('0x80')]({'where':{'id':_0x29ddbb[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x2f2239,null))['then'](function(_0x37f4d2){if(_0x37f4d2){_0x33c46e[_0xfd07('0x53')]=_[_0xfd07('0x5e')](db[_0xfd07('0xbd')][_0xfd07('0x71')]);_0x33c46e[_0xfd07('0x5d')]=_['keys'](_0x29ddbb[_0xfd07('0x5d')]);_0x33c46e['filters']=_[_0xfd07('0x60')](_0x33c46e[_0xfd07('0x53')],_0x33c46e[_0xfd07('0x5d')]);_0x125808[_0xfd07('0x5f')]=_[_0xfd07('0x60')](_0x33c46e[_0xfd07('0x53')],qs[_0xfd07('0x61')](_0x29ddbb[_0xfd07('0x5d')][_0xfd07('0x61')]));_0x125808['attributes']=_0x125808['attributes'][_0xfd07('0x62')]?_0x125808[_0xfd07('0x5f')]:_0x33c46e[_0xfd07('0x53')];if(!_0x29ddbb[_0xfd07('0x5d')]['hasOwnProperty']('nolimit')){_0x125808['limit']=qs['limit'](_0x29ddbb[_0xfd07('0x5d')][_0xfd07('0x27')]);_0x125808[_0xfd07('0x25')]=qs[_0xfd07('0x25')](_0x29ddbb[_0xfd07('0x5d')][_0xfd07('0x25')]);}_0x125808[_0xfd07('0x81')]=qs[_0xfd07('0x65')](_0x29ddbb[_0xfd07('0x5d')][_0xfd07('0x65')]);_0x125808[_0xfd07('0x66')]=qs['filters'](_[_0xfd07('0x68')](_0x29ddbb['query'],_0x33c46e[_0xfd07('0x67')]));_0x125808[_0xfd07('0x66')][_0xfd07('0x7d')]=_0x37f4d2['id'];if(_0x29ddbb[_0xfd07('0x5d')][_0xfd07('0x6a')]){_0x125808[_0xfd07('0x66')]=_[_0xfd07('0x69')](_0x125808[_0xfd07('0x66')],{'$or':_['map'](_0x125808['attributes'],function(_0x421e6a){var _0x3cb7f4={};_0x3cb7f4[_0x421e6a]={'$like':'%'+_0x29ddbb['query'][_0xfd07('0x6a')]+'%'};return _0x3cb7f4;})});}_0x125808=_[_0xfd07('0x69')]({},_0x125808,_0x29ddbb[_0xfd07('0x72')]);return db[_0xfd07('0xbd')][_0xfd07('0x28')]({'where':_0x125808['where']})[_0xfd07('0x18')](function(_0x59b601){_0x8ed1bc[_0xfd07('0x28')]=_0x59b601;if(_0x29ddbb['query'][_0xfd07('0x6b')]){_0x125808[_0xfd07('0x6c')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0xfd07('0xc9')],'as':_0xfd07('0x104'),'attributes':[_0xfd07('0x32'),_0xfd07('0x105'),_0xfd07('0x106')],'required':![]},{'model':db[_0xfd07('0x107')],'as':_0xfd07('0x108'),'attributes':['id',_0xfd07('0x32'),'color'],'where':_0x29ddbb[_0xfd07('0x5d')][_0xfd07('0x109')]?{'id':_0x29ddbb['query'][_0xfd07('0x109')]}:undefined,'required':_0x29ddbb[_0xfd07('0x5d')]['tag']?!![]:![]}];}return db[_0xfd07('0xbd')][_0xfd07('0x6d')](_0x125808);})[_0xfd07('0x18')](function(_0x471160){_0x8ed1bc['rows']=_0x471160;return _0x8ed1bc;});}})[_0xfd07('0x18')](respondWithFilteredResult(_0x2f2239,_0x125808))[_0xfd07('0x3d')](handleError(_0x2f2239,null));};exports[_0xfd07('0x10a')]=function(_0x304f57,_0x2a364c){var _0x438c4a=0x0;var _0x2e8430=0x0;var _0x1ecab0=![];var _0x129a87;var _0x3d843a;return db[_0xfd07('0x5a')]['find']({'where':{'id':_0x304f57['params']['id']},'include':[{'model':db[_0xfd07('0xb2')],'as':_0xfd07('0xb2'),'include':[{'model':db[_0xfd07('0xb2')],'as':_0xfd07('0x3f'),'attributes':['id','interval']}]}]})[_0xfd07('0x18')](handleEntityNotFound(_0x2a364c,null))[_0xfd07('0x18')](function(_0x396525){if(_0x396525){_0x129a87=_0x396525;return _0x396525[_0xfd07('0x10b')]({'raw':!![]});}})[_0xfd07('0x18')](function(_0x2a5e06){if(_0x129a87){if(_0x2a5e06){_0x3d843a=_0x2a5e06;}}return require(_0xfd07('0x92'))[_0xfd07('0x93')]();})[_0xfd07('0x18')](function(_0x31d741){if(_0x31d741){_0x2e8430=_0x31d741['virtual'];_0x1ecab0=_0x31d741[_0xfd07('0x94')];}})[_0xfd07('0x18')](function(){return db[_0xfd07('0xbd')][_0xfd07('0x28')]({'where':{'closed':![]}});})[_0xfd07('0x18')](function(_0x5effdb){_0x438c4a=_0x5effdb;if(_0x2e8430&&_0x5effdb>_0x2e8430){return db[_0xfd07('0x10c')][_0xfd07('0x80')]({'where':{'id':0x1}})['then'](function(_0x429a4e){if(_0x429a4e){_0x429a4e[_0xfd07('0x10d')]('chatLicenseExceeded');}});}})[_0xfd07('0x18')](function(){if(!_0x129a87['Interval']||!_0x129a87[_0xfd07('0xb2')][_0xfd07('0x3f')])return!![];return checkWebsiteIntervals(_0x129a87);})[_0xfd07('0x18')](function(_0x4b3591){var _0x1fa56e=fs['readFileSync'](path[_0xfd07('0x90')](config[_0xfd07('0x91')],_0xfd07('0x10e')),'utf8');var _0x5eb8f7=new url[(_0xfd07('0x10f'))](_0x129a87[_0xfd07('0x110')])[_0xfd07('0x111')];var _0x2eb79d=_0xfd07('0x112');var _0x5ec174=![];var _0x2aa97c={'chatVersion':_0x2eb79d,'chatWebsiteAddressOrigin':_0x5eb8f7,'remote':_0x129a87['remote'],'query':querystring['stringify'](_['merge'](_0x129a87[_0xfd07('0x2e')]({'plain':!![]}),{'customerIp':_0x304f57[_0xfd07('0xbb')]['x-forwarded-for']||_0x304f57[_0xfd07('0xbb')][_0xfd07('0x113')]||_0x304f57[_0xfd07('0x114')][_0xfd07('0x115')]||_0x304f57['ip'],'referer':_0x304f57[_0xfd07('0xbb')][_0xfd07('0x116')],'openedInteractions':_0x438c4a,'maxInteractions':_0x2e8430,'virtual':_0x1ecab0[_0xfd07('0x117')],'online':_0x4b3591,'custom':_0x1ecab0}))[_0xfd07('0x118')](/'/g,'\x5c\x27')};_0x2a364c[_0xfd07('0xd7')](ejs[_0xfd07('0x119')](Mustache[_0xfd07('0x119')](_0x1fa56e,_0x2aa97c),{'proactiveActions':_0x3d843a,'alignment':_0x129a87['alignment'],'verticalAlignment':_0x129a87['verticalAlignment'],'div_color':_0x129a87[_0xfd07('0x11a')],'labelText':_0x129a87[_0xfd07('0x11b')],'text_color':_0x129a87[_0xfd07('0x11c')],'text_button_color':_0x129a87[_0xfd07('0x11d')],'button_color':_0x129a87[_0xfd07('0x11e')],'background_color':_0x129a87[_0xfd07('0x11f')],'hideWhenOffline':_0x129a87[_0xfd07('0x120')],'intervalId':_0x129a87['IntervalId'],'isDevelopment':_0x5ec174,'chatVersion':_0x2eb79d}));})[_0xfd07('0x3d')](handleError(_0x2a364c,null));};exports[_0xfd07('0x121')]=function(_0x2eb384,_0x48301e){var _0x5bc056=_0x2eb384['params']['id'];var _0x233713=_0x2eb384['body'];var _0xed4fd=0xc8;var _0x564ec7=null;return db['sequelize'][_0xfd07('0xea')]({'isolationLevel':db[_0xfd07('0xe9')]['Transaction'][_0xfd07('0x122')][_0xfd07('0x123')]},function(_0x12ecb9){return db['ChatWebsite']['findOne']({'where':{'id':_0x5bc056},'transaction':_0x12ecb9})[_0xfd07('0x18')](function(_0x2229fb){if(_0x2229fb){return db[_0xfd07('0xb1')][_0xfd07('0x2d')]({'where':{'ChatWebsiteId':_0x5bc056},'transaction':_0x12ecb9})[_0xfd07('0x18')](function(){var _0x553b3a=_['map'](_0x233713,function(_0x52ae56){_0x52ae56[_0xfd07('0x7d')]=_0x5bc056;return _0x52ae56;});return db[_0xfd07('0xb1')][_0xfd07('0xec')](_0x553b3a,{'transaction':_0x12ecb9});});}else{_0xed4fd=0x194;_0x564ec7=[];}});})[_0xfd07('0x18')](function(){if(_0xed4fd!==0x194){return db['ChatApplication'][_0xfd07('0x124')]({'where':{'ChatWebsiteId':_0x5bc056},'order':_0xfd07('0xb7')})[_0xfd07('0x18')](function(_0x32e231){_0x564ec7=_0x32e231;});}})['catch'](function(_0x10fe36){_0xed4fd=0x1f4;logger[_0xfd07('0x1e')](_0x10fe36[_0xfd07('0x31')]);if(_0x10fe36[_0xfd07('0x32')]){delete _0x10fe36[_0xfd07('0x32')];}_0x564ec7=_0x10fe36;})['finally'](function(){if(_0x564ec7===null){_0x48301e[_0xfd07('0x22')](_0xed4fd);}else{if(_0xed4fd===0x1f4){_0x48301e[_0xfd07('0x24')](_0xed4fd)[_0xfd07('0xd7')](_0x564ec7);}else{_0x48301e[_0xfd07('0x24')](_0xed4fd)[_0xfd07('0x2b')](_0x564ec7);}}});};exports['getApplications']=function(_0x4fbd8f,_0x4a673a){var _0x486d0f={};var _0x1a853e={};var _0x34b55f;var _0xe331a6;return db[_0xfd07('0x5a')]['findOne']({'where':{'id':_0x4fbd8f['params']['id']}})['then'](handleEntityNotFound(_0x4a673a,null))[_0xfd07('0x18')](function(_0x43abd9){if(_0x43abd9){_0x34b55f=_0x43abd9;_0x1a853e[_0xfd07('0x53')]=_[_0xfd07('0x5e')](db[_0xfd07('0xb1')]['rawAttributes']);_0x1a853e[_0xfd07('0x5d')]=_['keys'](_0x4fbd8f['query']);_0x1a853e[_0xfd07('0x67')]=_[_0xfd07('0x60')](_0x1a853e[_0xfd07('0x53')],_0x1a853e['query']);_0x486d0f[_0xfd07('0x5f')]=_[_0xfd07('0x60')](_0x1a853e[_0xfd07('0x53')],qs[_0xfd07('0x61')](_0x4fbd8f[_0xfd07('0x5d')][_0xfd07('0x61')]));_0x486d0f['attributes']=_0x486d0f['attributes']['length']?_0x486d0f['attributes']:_0x1a853e[_0xfd07('0x53')];_0x486d0f['order']=qs[_0xfd07('0x65')](_0x4fbd8f[_0xfd07('0x5d')]['sort']);_0x486d0f['where']=qs['filters'](_[_0xfd07('0x68')](_0x4fbd8f[_0xfd07('0x5d')],_0x1a853e[_0xfd07('0x67')]));if(_0x4fbd8f['query'][_0xfd07('0x6a')]){_0x486d0f[_0xfd07('0x66')]=_[_0xfd07('0x69')](_0x486d0f['where'],{'$or':_['map'](_0x486d0f[_0xfd07('0x5f')],function(_0x4f72eb){var _0x1d5659={};_0x1d5659[_0x4f72eb]={'$like':'%'+_0x4fbd8f[_0xfd07('0x5d')][_0xfd07('0x6a')]+'%'};return _0x1d5659;})});}_0x486d0f=_[_0xfd07('0x69')]({},_0x486d0f,_0x4fbd8f[_0xfd07('0x72')]);return _0x34b55f[_0xfd07('0x125')](_0x486d0f);}})['then'](function(_0x19830b){if(_0x19830b){_0xe331a6=_0x19830b[_0xfd07('0x62')];if(!_0x4fbd8f['query'][_0xfd07('0x63')]('nolimit')){_0x486d0f['limit']=qs[_0xfd07('0x27')](_0x4fbd8f[_0xfd07('0x5d')][_0xfd07('0x27')]);_0x486d0f[_0xfd07('0x25')]=qs[_0xfd07('0x25')](_0x4fbd8f['query'][_0xfd07('0x25')]);}return _0x34b55f['getApplications'](_0x486d0f);}})['then'](function(_0x2558d7){if(_0x2558d7){return _0x2558d7?{'count':_0xe331a6,'rows':_0x2558d7}:null;}})['then'](respondWithResult(_0x4a673a,null))[_0xfd07('0x3d')](handleError(_0x4a673a,null));};exports['addProactiveActions']=function(_0xa0b734,_0x2fc92f){return db[_0xfd07('0x126')]['find']({'where':{'id':_0xa0b734['params']['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x2fc92f,null))['then'](function(_0x2922a4){if(_0x2922a4){return _0x2922a4[_0xfd07('0x127')](_0xa0b734[_0xfd07('0x74')][_0xfd07('0x83')],_[_0xfd07('0x102')](_0xa0b734[_0xfd07('0x74')],[_0xfd07('0x83'),'id'])||{});}})[_0xfd07('0x18')](respondWithResult(_0x2fc92f,null))[_0xfd07('0x3d')](handleError(_0x2fc92f,null));};exports[_0xfd07('0x10b')]=function(_0x4cc5cb,_0x55c821){var _0x31430e={};var _0x3fbb5d={};var _0x552219;var _0x223bee;return db['ChatWebsite'][_0xfd07('0x80')]({'where':{'id':_0x4cc5cb[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x55c821,null))[_0xfd07('0x18')](function(_0x3ae507){if(_0x3ae507){_0x552219=_0x3ae507;_0x3fbb5d[_0xfd07('0x53')]=_[_0xfd07('0x5e')](db[_0xfd07('0x128')][_0xfd07('0x71')]);_0x3fbb5d[_0xfd07('0x5d')]=_['keys'](_0x4cc5cb[_0xfd07('0x5d')]);_0x3fbb5d[_0xfd07('0x67')]=_[_0xfd07('0x60')](_0x3fbb5d[_0xfd07('0x53')],_0x3fbb5d[_0xfd07('0x5d')]);_0x31430e[_0xfd07('0x5f')]=_[_0xfd07('0x60')](_0x3fbb5d[_0xfd07('0x53')],qs[_0xfd07('0x61')](_0x4cc5cb[_0xfd07('0x5d')]['fields']));_0x31430e['attributes']=_0x31430e[_0xfd07('0x5f')][_0xfd07('0x62')]?_0x31430e[_0xfd07('0x5f')]:_0x3fbb5d[_0xfd07('0x53')];_0x31430e[_0xfd07('0x81')]=qs['sort'](_0x4cc5cb[_0xfd07('0x5d')][_0xfd07('0x65')]);_0x31430e[_0xfd07('0x66')]=qs[_0xfd07('0x67')](_[_0xfd07('0x68')](_0x4cc5cb[_0xfd07('0x5d')],_0x3fbb5d[_0xfd07('0x67')]));if(_0x4cc5cb[_0xfd07('0x5d')][_0xfd07('0x6a')]){_0x31430e[_0xfd07('0x66')]=_[_0xfd07('0x69')](_0x31430e[_0xfd07('0x66')],{'$or':_[_0xfd07('0x3e')](_0x31430e['attributes'],function(_0x2dff71){var _0x223500={};_0x223500[_0x2dff71]={'$like':'%'+_0x4cc5cb['query']['filter']+'%'};return _0x223500;})});}_0x31430e=_[_0xfd07('0x69')]({},_0x31430e,_0x4cc5cb[_0xfd07('0x72')]);return _0x552219[_0xfd07('0x10b')](_0x31430e);}})[_0xfd07('0x18')](function(_0x47c000){if(_0x47c000){_0x223bee=_0x47c000[_0xfd07('0x62')];if(!_0x4cc5cb['query'][_0xfd07('0x63')](_0xfd07('0x64'))){_0x31430e[_0xfd07('0x27')]=qs[_0xfd07('0x27')](_0x4cc5cb[_0xfd07('0x5d')][_0xfd07('0x27')]);_0x31430e['offset']=qs[_0xfd07('0x25')](_0x4cc5cb[_0xfd07('0x5d')][_0xfd07('0x25')]);}return _0x552219[_0xfd07('0x10b')](_0x31430e);}})[_0xfd07('0x18')](function(_0x504359){if(_0x504359){return _0x504359?{'count':_0x223bee,'rows':_0x504359}:null;}})[_0xfd07('0x18')](respondWithResult(_0x55c821,null))['catch'](handleError(_0x55c821,null));};exports[_0xfd07('0x129')]=function(_0x15bfa7,_0x4e29c5){var _0x218cb2=_0x15bfa7[_0xfd07('0x5d')][_0xfd07('0x12a')]===_0xfd07('0x12b')?_0xfd07('0x12c'):_0xfd07('0x12d');return db[_0xfd07('0x5a')][_0xfd07('0x78')]({'attributes':['id',_0x218cb2],'where':{'id':_0x15bfa7[_0xfd07('0x70')]['id']}})['then'](handleEntityNotFound(_0x4e29c5,null))[_0xfd07('0x18')](function(_0x3421b9){if(_0x3421b9){var _0x24634c=_0x3421b9[_0x218cb2];var _0x21b69e=_0x24634c&&_0x24634c[_0xfd07('0x12e')]?_0x24634c['items']:[];_0x4e29c5[_0xfd07('0xd7')]({'fromKey':_['isNil'](_0x24634c[_0xfd07('0x12f')])?undefined:_0x24634c[_0xfd07('0x12f')],'count':_0x21b69e['length'],'rows':_0x21b69e});}})['catch'](handleError(_0x4e29c5,null));};exports['getOfflineMessages']=function(_0x17fffc,_0x1d9b2c){var _0x36556d={'raw':![],'where':{}};var _0x262135={};var _0xfe8cf4={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x17fffc[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x1d9b2c,null))[_0xfd07('0x18')](function(_0x32420f){if(_0x32420f){_0x262135['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x262135[_0xfd07('0x5d')]=_[_0xfd07('0x5e')](_0x17fffc[_0xfd07('0x5d')]);_0x262135[_0xfd07('0x67')]=_['intersection'](_0x262135[_0xfd07('0x53')],_0x262135[_0xfd07('0x5d')]);_0x36556d[_0xfd07('0x5f')]=_[_0xfd07('0x60')](_0x262135['model'],qs[_0xfd07('0x61')](_0x17fffc[_0xfd07('0x5d')][_0xfd07('0x61')]));_0x36556d[_0xfd07('0x5f')]=_0x36556d[_0xfd07('0x5f')]['length']?_0x36556d['attributes']:_0x262135[_0xfd07('0x53')];if(!_0x17fffc[_0xfd07('0x5d')]['hasOwnProperty'](_0xfd07('0x64'))){_0x36556d['limit']=qs[_0xfd07('0x27')](_0x17fffc['query'][_0xfd07('0x27')]);_0x36556d[_0xfd07('0x25')]=qs[_0xfd07('0x25')](_0x17fffc[_0xfd07('0x5d')][_0xfd07('0x25')]);}_0x36556d[_0xfd07('0x81')]=qs[_0xfd07('0x65')](_0x17fffc[_0xfd07('0x5d')]['sort']);_0x36556d[_0xfd07('0x66')]=qs[_0xfd07('0x67')](_[_0xfd07('0x68')](_0x17fffc[_0xfd07('0x5d')],_0x262135[_0xfd07('0x67')]));_0x36556d['where']['ChatWebsiteId']=_0x32420f['id'];if(_0x17fffc[_0xfd07('0x5d')]['filter']){_0x36556d[_0xfd07('0x66')]=_[_0xfd07('0x69')](_0x36556d[_0xfd07('0x66')],{'$or':_[_0xfd07('0x3e')](_0x36556d[_0xfd07('0x5f')],function(_0x1ac1f6){var _0x236ab8={};_0x236ab8[_0x1ac1f6]={'$like':'%'+_0x17fffc[_0xfd07('0x5d')][_0xfd07('0x6a')]+'%'};return _0x236ab8;})});}_0x36556d=_[_0xfd07('0x69')]({},_0x36556d,_0x17fffc['options']);return db[_0xfd07('0xe3')]['count']({'where':_0x36556d[_0xfd07('0x66')]})[_0xfd07('0x18')](function(_0x19a57c){_0xfe8cf4[_0xfd07('0x28')]=_0x19a57c;if(_0x17fffc['query']['includeAll']){_0x36556d[_0xfd07('0x6c')]=[{'all':!![]}];}else{_0x36556d[_0xfd07('0x6c')]=[{'model':db['CmContact'],'as':_0xfd07('0x130'),'required':![]},{'model':db[_0xfd07('0xeb')],'as':_0xfd07('0x131'),'required':![]}];}return db[_0xfd07('0xe3')][_0xfd07('0x6d')](_0x36556d);})[_0xfd07('0x18')](function(_0x5582c6){_0xfe8cf4[_0xfd07('0x6e')]=_0x5582c6;return _0xfe8cf4;});}})['then'](respondWithFilteredResult(_0x1d9b2c,_0x36556d))[_0xfd07('0x3d')](handleError(_0x1d9b2c,null));};exports[_0xfd07('0x132')]=function(_0x444a19,_0x1181a2){return db[_0xfd07('0x5a')][_0xfd07('0x78')]({'where':{'id':_0x444a19[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x1181a2,null))[_0xfd07('0x18')](function(_0x3be2b5){if(_0x3be2b5){return _0x3be2b5[_0xfd07('0x132')](_0x444a19[_0xfd07('0x74')]['ids'],_['omit'](_0x444a19['body'],['ids','id'])||{})['spread'](function(_0x210505){for(var _0x5c4dfd=0x0;_0x5c4dfd<_0x444a19[_0xfd07('0x74')]['ids'][_0xfd07('0x62')];_0x5c4dfd+=0x1){socket[_0xfd07('0x133')]('userChatWebsite:save',{'UserId':Number(_0x444a19[_0xfd07('0x74')][_0xfd07('0x83')][_0x5c4dfd]),'ChatWebsiteId':Number(_0x444a19[_0xfd07('0x70')]['id'])});}return _0x210505;});}})[_0xfd07('0x18')](respondWithResult(_0x1181a2,null))[_0xfd07('0x3d')](handleError(_0x1181a2,null));};exports[_0xfd07('0x134')]=function(_0xc86d05,_0x32cdb9){return db[_0xfd07('0x5a')]['find']({'where':{'id':_0xc86d05[_0xfd07('0x70')]['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x32cdb9,null))[_0xfd07('0x18')](function(_0x2835f1){if(_0x2835f1){return _0x2835f1['removeAgents'](_0xc86d05[_0xfd07('0x5d')]['ids'])[_0xfd07('0x18')](function(){if(_[_0xfd07('0x135')](_0xc86d05[_0xfd07('0x5d')]['ids'])){for(var _0x3667ba=0x0;_0x3667ba<_0xc86d05[_0xfd07('0x5d')]['ids'][_0xfd07('0x62')];_0x3667ba+=0x1){socket[_0xfd07('0x133')](_0xfd07('0x136'),{'UserId':Number(_0xc86d05[_0xfd07('0x5d')][_0xfd07('0x83')][_0x3667ba]),'ChatWebsiteId':Number(_0xc86d05[_0xfd07('0x70')]['id'])});}}else{socket[_0xfd07('0x133')](_0xfd07('0x136'),{'UserId':Number(_0xc86d05[_0xfd07('0x5d')][_0xfd07('0x83')]),'ChatWebsiteId':Number(_0xc86d05[_0xfd07('0x70')]['id'])});}});}})[_0xfd07('0x18')](respondWithStatusCode(_0x32cdb9,null))[_0xfd07('0x3d')](handleError(_0x32cdb9,null));};exports['getAgents']=function(_0x5d41f0,_0x27882d){var _0xabfe4={};var _0x4499c5={};var _0x60396c;var _0x53975b;return db['ChatWebsite'][_0xfd07('0x80')]({'where':{'id':_0x5d41f0['params']['id']}})[_0xfd07('0x18')](handleEntityNotFound(_0x27882d,null))[_0xfd07('0x18')](function(_0x5d1ba5){if(_0x5d1ba5){_0x60396c=_0x5d1ba5;_0x4499c5['model']=_[_0xfd07('0x5e')](db[_0xfd07('0xc9')][_0xfd07('0x71')]);_0x4499c5[_0xfd07('0x5d')]=_[_0xfd07('0x5e')](_0x5d41f0[_0xfd07('0x5d')]);_0x4499c5[_0xfd07('0x67')]=_[_0xfd07('0x60')](_0x4499c5[_0xfd07('0x53')],_0x4499c5['query']);_0xabfe4[_0xfd07('0x5f')]=_[_0xfd07('0x60')](_0x4499c5[_0xfd07('0x53')],qs['fields'](_0x5d41f0['query']['fields']));_0xabfe4[_0xfd07('0x5f')]=_0xabfe4[_0xfd07('0x5f')][_0xfd07('0x62')]?_0xabfe4[_0xfd07('0x5f')]:_0x4499c5[_0xfd07('0x53')];_0xabfe4[_0xfd07('0x81')]=qs[_0xfd07('0x65')](_0x5d41f0[_0xfd07('0x5d')][_0xfd07('0x65')]);_0xabfe4['where']=qs['filters'](_[_0xfd07('0x68')](_0x5d41f0[_0xfd07('0x5d')],_0x4499c5[_0xfd07('0x67')]));if(_0x5d41f0[_0xfd07('0x5d')]['filter']){_0xabfe4[_0xfd07('0x66')]=_[_0xfd07('0x69')](_0xabfe4['where'],{'$or':_[_0xfd07('0x3e')](_0xabfe4[_0xfd07('0x5f')],function(_0x538b98){var _0x10b3dd={};_0x10b3dd[_0x538b98]={'$like':'%'+_0x5d41f0[_0xfd07('0x5d')][_0xfd07('0x6a')]+'%'};return _0x10b3dd;})});}_0xabfe4=_['merge']({},_0xabfe4,_0x5d41f0[_0xfd07('0x72')]);return _0x60396c['getAgents'](_0xabfe4);}})[_0xfd07('0x18')](function(_0x20b184){if(_0x20b184){_0x53975b=_0x20b184['length'];if(!_0x5d41f0[_0xfd07('0x5d')]['hasOwnProperty'](_0xfd07('0x64'))){_0xabfe4[_0xfd07('0x27')]=qs[_0xfd07('0x27')](_0x5d41f0[_0xfd07('0x5d')][_0xfd07('0x27')]);_0xabfe4['offset']=qs[_0xfd07('0x25')](_0x5d41f0[_0xfd07('0x5d')]['offset']);}return _0x60396c['getAgents'](_0xabfe4);}})[_0xfd07('0x18')](function(_0x1a3195){if(_0x1a3195){return _0x1a3195?{'count':_0x53975b,'rows':_0x1a3195}:null;}})[_0xfd07('0x18')](respondWithResult(_0x27882d,null))['catch'](handleError(_0x27882d,null));};
\ No newline at end of file
+var _0x6faf=['removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','notify','CmContact','Sequelize','difference','createdAt','updatedAt','ListId','from','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','spread','account','list','applications','orderBy','Applications','priority','asc','headers','threadId','externalUrl','ContactId','interaction','ChatInteraction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','queue','waitForTheAssignedQueue','Start','EventManager','offline','files','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','basename','openNewInteraction','sequelize','Attachment','CloudProvider','Smtp','forwardOfflineAddress','SendMail','sendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','Chat','NotifyMailAccount','notifyMail','server','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','getProactiveActions','getLicense','virtual','custom','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','URL','address','remote','x-real-ip','connection','remoteAddress','referer','alignment','verticalAlignment','labelText','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','transaction','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','path','ejs','fs-extra','lodash','html-to-text','ioredis','jayson/promise','url','../../components/parsers/qs','../../config/logger','api','../../errors/api','APIOutOfIntervalError','APINotFoundError','handleError','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','Content-Range','then','destroy','ChatWebsites','UserProfileResource','sendStatus','stack','name','Command','getSnippet','timezone','format','iftime\x20%s,%s','iftime\x20%s','interval','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','map','Interval','Intervals','get','user-agent-parser','setUA','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','type','Pause','mandatoryDispositionPause','ChatWebsite','rawAttributes','fieldName','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','rows','show','merge','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','update','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne'];(function(_0x37cb61,_0xa49d0){var _0x4ca1c7=function(_0x4201f9){while(--_0x4201f9){_0x37cb61['push'](_0x37cb61['shift']());}};_0x4ca1c7(++_0xa49d0);}(_0x6faf,0xb0));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var Mustache=require(_0xf6fa('0x0'));var util=require('util');var path=require(_0xf6fa('0x1'));var ejs=require(_0xf6fa('0x2'));var fs=require('fs');var fs_extra=require(_0xf6fa('0x3'));var _=require(_0xf6fa('0x4'));var querystring=require('querystring');var htmlToText=require(_0xf6fa('0x5'));var Redis=require(_0xf6fa('0x6'));var jayson=require(_0xf6fa('0x7'));var url=require(_0xf6fa('0x8'));var qs=require(_0xf6fa('0x9'));var logger=require(_0xf6fa('0xa'))(_0xf6fa('0xb'));var config=require('../../config/environment');var APIOutOfIntervalError=require(_0xf6fa('0xc'))[_0xf6fa('0xd')];var APINotFoundError=require('../../errors/api')[_0xf6fa('0xe')];var APIHandleError=require('../../errors/api')[_0xf6fa('0xf')];var db=require(_0xf6fa('0x10'))['db'];config[_0xf6fa('0x11')]=_[_0xf6fa('0x12')](config[_0xf6fa('0x11')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6fa('0x13'))(new Redis(config[_0xf6fa('0x11')]));require('./chatWebsite.socket')[_0xf6fa('0x14')](socket);var client=jayson[_0xf6fa('0x15')]['http']({'port':0x232c});var client9002=jayson[_0xf6fa('0x15')][_0xf6fa('0x16')]({'port':0x232a});var client9003=jayson[_0xf6fa('0x15')][_0xf6fa('0x16')]({'port':0x232b});var client9001=jayson[_0xf6fa('0x15')][_0xf6fa('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x3fb0c3,_0x29f4f0,_0x29699b,_0x575cd7){return new Promise(function(_0x45b2eb,_0xb88b48){var _0x2c7e75=_0x575cd7||client;return _0x2c7e75['request'](_0x3fb0c3,_0x29699b)['then'](function(_0x2527a5){logger[_0xf6fa('0x17')](_0xf6fa('0x18'),_0x29f4f0,_0xf6fa('0x19'));logger[_0xf6fa('0x1a')](_0xf6fa('0x1b'),_0x29f4f0,'request\x20sent',JSON[_0xf6fa('0x1c')](_0x2527a5));if(_0x2527a5[_0xf6fa('0x1d')]){if(_0x2527a5[_0xf6fa('0x1d')]['code']===0x1f4){logger['error'](_0xf6fa('0x18'),_0x29f4f0,_0x2527a5[_0xf6fa('0x1d')][_0xf6fa('0x1e')]);return _0xb88b48(_0x2527a5[_0xf6fa('0x1d')][_0xf6fa('0x1e')]);}logger[_0xf6fa('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x29f4f0,_0x2527a5[_0xf6fa('0x1d')][_0xf6fa('0x1e')]);return _0x45b2eb(_0x2527a5[_0xf6fa('0x1d')][_0xf6fa('0x1e')]);}else{logger[_0xf6fa('0x17')](_0xf6fa('0x18'),_0x29f4f0,'request\x20sent');_0x45b2eb(_0x2527a5[_0xf6fa('0x1f')][_0xf6fa('0x1e')]);}})[_0xf6fa('0x20')](function(_0x26062a){logger[_0xf6fa('0x1d')](_0xf6fa('0x18'),_0x29f4f0,_0x26062a);_0xb88b48(_0x26062a);});});}function respondWithStatusCode(_0x26275a,_0x347469){_0x347469=_0x347469||0xcc;return function(_0x14e9f9){if(_0x14e9f9){return _0x26275a['sendStatus'](_0x347469);}return _0x26275a[_0xf6fa('0x21')](_0x347469)[_0xf6fa('0x22')]();};}function respondWithResult(_0x504898,_0x5807c3){_0x5807c3=_0x5807c3||0xc8;return function(_0x124e29){if(_0x124e29){return _0x504898[_0xf6fa('0x21')](_0x5807c3)[_0xf6fa('0x23')](_0x124e29);}};}function respondWithFilteredResult(_0x47bf12,_0x523057){return function(_0x29bcfb){if(_0x29bcfb){var _0x56dec2=typeof _0x523057[_0xf6fa('0x24')]===_0xf6fa('0x25')&&typeof _0x523057[_0xf6fa('0x26')]===_0xf6fa('0x25');var _0x2f579a=_0x29bcfb[_0xf6fa('0x27')];var _0x298f0f=_0x56dec2?0x0:_0x523057[_0xf6fa('0x24')];var _0x424e8b=_0x56dec2?_0x29bcfb[_0xf6fa('0x27')]:_0x523057['offset']+_0x523057['limit'];var _0xf115fe;if(_0x424e8b>=_0x2f579a){_0x424e8b=_0x2f579a;_0xf115fe=0xc8;}else{_0xf115fe=0xce;}_0x47bf12['status'](_0xf115fe);return _0x47bf12['set'](_0xf6fa('0x28'),_0x298f0f+'-'+_0x424e8b+'/'+_0x2f579a)[_0xf6fa('0x23')](_0x29bcfb);}return null;};}function saveUpdates(_0x536b53){return function(_0x41af04){if(_0x41af04){return _0x41af04['update'](_0x536b53)[_0xf6fa('0x29')](function(_0x5ca4ce){return _0x5ca4ce;});}return null;};}function removeEntity(_0x38b986){return function(_0x262ea2){if(_0x262ea2){return _0x262ea2[_0xf6fa('0x2a')]()['then'](function(){var _0x411a83=_0x262ea2['get']({'plain':!![]});var _0x19dc4b=_0xf6fa('0x2b');return db[_0xf6fa('0x2c')][_0xf6fa('0x2a')]({'where':{'type':_0x19dc4b,'resourceId':_0x411a83['id']}})[_0xf6fa('0x29')](function(){return _0x262ea2;});})[_0xf6fa('0x29')](function(){_0x38b986[_0xf6fa('0x21')](0xcc)[_0xf6fa('0x22')]();});}};}function handleEntityNotFound(_0x105938){return function(_0x48d5c3){if(!_0x48d5c3){_0x105938[_0xf6fa('0x2d')](0x194);}return _0x48d5c3;};}function handleError(_0x365685,_0x18f0d3){_0x18f0d3=_0x18f0d3||0x1f4;return function(_0x470326){logger[_0xf6fa('0x1d')](_0x470326[_0xf6fa('0x2e')]);if(_0x470326['name']){delete _0x470326[_0xf6fa('0x2f')];}_0x365685[_0xf6fa('0x21')](_0x18f0d3)['send'](_0x470326);};}function iftimePromise(_0x21176f,_0x4747db){return respondWithRpcPromise(_0xf6fa('0x30'),_0xf6fa('0x31'),{'command':_0x4747db[_0xf6fa('0x32')]?util[_0xf6fa('0x33')](_0xf6fa('0x34'),_0x21176f['interval'],_0x4747db[_0xf6fa('0x32')]):util[_0xf6fa('0x33')](_0xf6fa('0x35'),_0x21176f[_0xf6fa('0x36')])},client9002)[_0xf6fa('0x29')](function(_0x4764be){var _0x522cfa=_0x4764be&&_0x4764be['indexOf'](_0xf6fa('0x37'))>=0x0?!![]:![];logger[_0xf6fa('0x17')](_0xf6fa('0x38'),_0x4747db['id'],_0x21176f['id'],_0x21176f[_0xf6fa('0x36')],_0x522cfa?_0xf6fa('0x39'):_0xf6fa('0x3a'),_0x4747db['timezone']?_0x4747db[_0xf6fa('0x32')]:_0xf6fa('0x3b'));return _0x522cfa;})[_0xf6fa('0x20')](function(_0x4bbf36){logger[_0xf6fa('0x1d')](_0xf6fa('0x38'),_0x4747db['id'],_0x21176f['id'],_0x21176f[_0xf6fa('0x36')],util['inspect'](_0x4bbf36,{'showHidden':![],'depth':null}),_0x4747db[_0xf6fa('0x32')]?_0x4747db[_0xf6fa('0x32')]:_0xf6fa('0x3b'));return![];});}function checkWebsiteIntervals(_0x238a07){var _0x7263bf=_[_0xf6fa('0x3c')](_0x238a07[_0xf6fa('0x3d')][_0xf6fa('0x3e')],function(_0x675772){var _0x41a6ec=_0x675772[_0xf6fa('0x3f')]({'plain':!![]});return iftimePromise(_0x41a6ec,_0x238a07);});return Promise['all'](_0x7263bf)[_0xf6fa('0x29')](function(_0x5553e3){return _['some'](_0x5553e3);});}function createInteractionObject(_0x10cec8,_0x38cb34,_0x155654,_0x14c679){var _0x32b67b=require(_0xf6fa('0x40'));var _0x3b9738=new _0x32b67b();var _0x3ef49b=_0x3b9738[_0xf6fa('0x41')](_0x155654['user-agent'])['getResult']();var _0x46e709=_0x38cb34[_0xf6fa('0x42')];if(_0x155654[_0xf6fa('0x43')]){_0x46e709=_0x155654[_0xf6fa('0x43')];}else if(_0x155654[_0xf6fa('0x44')]){_0x46e709=_[_0xf6fa('0x45')](_0x155654['x-forwarded-for'][_0xf6fa('0x46')](','));}return{'ContactId':_0x14c679['id'],'ChatWebsiteId':_0x10cec8,'from':(_0x14c679[_0xf6fa('0x47')]||'')+'\x20'+(_0x14c679[_0xf6fa('0x48')]||''),'customerIp':_0x46e709,'customerPort':_0x155654[_0xf6fa('0x49')]?_0x155654[_0xf6fa('0x49')]:null,'referer':_0x38cb34['referer'],'browserName':_0x3ef49b[_0xf6fa('0x4a')][_0xf6fa('0x2f')]&&_0x3ef49b[_0xf6fa('0x4a')]['version']?util[_0xf6fa('0x33')](_0xf6fa('0x4b'),_0x3ef49b['browser'][_0xf6fa('0x2f')],_0x3ef49b[_0xf6fa('0x4a')][_0xf6fa('0x4c')]):'unknown','browserVersion':_0x3ef49b['browser'][_0xf6fa('0x4c')]||_0xf6fa('0x4d'),'osName':util['format']('%s\x20%s',_0x3ef49b['os'][_0xf6fa('0x2f')],_0x3ef49b['os']['version']),'osVersion':_0x3ef49b['os'][_0xf6fa('0x4c')],'deviceModel':_0x3ef49b['device']['model']&&_0x3ef49b[_0xf6fa('0x4e')][_0xf6fa('0x4f')]?util[_0xf6fa('0x33')](_0xf6fa('0x50'),_0x3ef49b[_0xf6fa('0x4e')]['model'],_0x3ef49b[_0xf6fa('0x4e')][_0xf6fa('0x4f')],_0x3ef49b[_0xf6fa('0x4e')][_0xf6fa('0x51')]):null,'deviceVendor':_0x3ef49b['device']['vendor'],'deviceType':_0x3ef49b[_0xf6fa('0x4e')]['type'],'formData':JSON[_0xf6fa('0x1c')](_0x38cb34)};}exports['index']=function(_0x1efbdd,_0x180aeb){var _0xa8d61a={'include':[{'model':db[_0xf6fa('0x52')],'as':_0xf6fa('0x53')}]},_0x58e608={},_0x8cab02={'count':0x0,'rows':[]};var _0x4f6c05=_['map'](db[_0xf6fa('0x54')][_0xf6fa('0x55')],function(_0x36c434){return{'name':_0x36c434[_0xf6fa('0x56')],'type':_0x36c434[_0xf6fa('0x51')]['key']};});_0x58e608['model']=_[_0xf6fa('0x3c')](_0x4f6c05,_0xf6fa('0x2f'));_0x58e608[_0xf6fa('0x57')]=_[_0xf6fa('0x58')](_0x1efbdd['query']);_0x58e608[_0xf6fa('0x59')]=_['intersection'](_0x58e608[_0xf6fa('0x5a')],_0x58e608[_0xf6fa('0x57')]);_0xa8d61a['attributes']=_[_0xf6fa('0x5b')](_0x58e608[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x1efbdd[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0xa8d61a['attributes']=_0xa8d61a[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0xa8d61a[_0xf6fa('0x5d')]:_0x58e608[_0xf6fa('0x5a')];if(!_0x1efbdd[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0xa8d61a[_0xf6fa('0x26')]=qs['limit'](_0x1efbdd['query'][_0xf6fa('0x26')]);_0xa8d61a['offset']=qs[_0xf6fa('0x24')](_0x1efbdd[_0xf6fa('0x57')]['offset']);}_0xa8d61a[_0xf6fa('0x61')]=qs['sort'](_0x1efbdd[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0xa8d61a[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x1efbdd[_0xf6fa('0x57')],_0x58e608[_0xf6fa('0x59')]),_0x4f6c05);if(_0x1efbdd[_0xf6fa('0x57')][_0xf6fa('0x65')]){_0xa8d61a[_0xf6fa('0x63')]=_['merge'](_0xa8d61a[_0xf6fa('0x63')],{'$or':_[_0xf6fa('0x3c')](_0x4f6c05,function(_0x28c096){if(_0x28c096[_0xf6fa('0x51')]!=='VIRTUAL'){var _0xc2444c={};_0xc2444c[_0x28c096[_0xf6fa('0x2f')]]={'$like':'%'+_0x1efbdd[_0xf6fa('0x57')]['filter']+'%'};return _0xc2444c;}})});}_0xa8d61a=_['merge']({},_0xa8d61a,_0x1efbdd[_0xf6fa('0x66')]);var _0x37f179={'where':_0xa8d61a[_0xf6fa('0x63')]};return db[_0xf6fa('0x54')][_0xf6fa('0x27')](_0x37f179)[_0xf6fa('0x29')](function(_0xe41bb2){_0x8cab02[_0xf6fa('0x27')]=_0xe41bb2;if(_0x1efbdd['query'][_0xf6fa('0x67')]){_0xa8d61a[_0xf6fa('0x68')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0xa8d61a);})[_0xf6fa('0x29')](function(_0x1d014d){_0x8cab02[_0xf6fa('0x69')]=_0x1d014d;return _0x8cab02;})['then'](respondWithFilteredResult(_0x180aeb,_0xa8d61a))['catch'](handleError(_0x180aeb,null));};exports[_0xf6fa('0x6a')]=function(_0x3e6c85,_0x2fc5c4){var _0x1f7aec={'raw':![],'where':{'id':_0x3e6c85['params']['id']},'include':[{'model':db[_0xf6fa('0x52')],'as':_0xf6fa('0x53')}]},_0x4f66c6={};_0x4f66c6[_0xf6fa('0x5a')]=_['keys'](db[_0xf6fa('0x54')][_0xf6fa('0x55')]);_0x4f66c6['query']=_[_0xf6fa('0x58')](_0x3e6c85[_0xf6fa('0x57')]);_0x4f66c6['filters']=_[_0xf6fa('0x5b')](_0x4f66c6[_0xf6fa('0x5a')],_0x4f66c6[_0xf6fa('0x57')]);_0x1f7aec[_0xf6fa('0x5d')]=_['intersection'](_0x4f66c6['model'],qs['fields'](_0x3e6c85[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x1f7aec[_0xf6fa('0x5d')]=_0x1f7aec[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x1f7aec[_0xf6fa('0x5d')]:_0x4f66c6[_0xf6fa('0x5a')];if(_0x3e6c85[_0xf6fa('0x57')][_0xf6fa('0x67')]){_0x1f7aec['include']=[{'all':!![]}];}_0x1f7aec=_[_0xf6fa('0x6b')]({},_0x1f7aec,_0x3e6c85[_0xf6fa('0x66')]);return db[_0xf6fa('0x54')]['find'](_0x1f7aec)[_0xf6fa('0x29')](handleEntityNotFound(_0x2fc5c4,null))[_0xf6fa('0x29')](respondWithResult(_0x2fc5c4,null))['catch'](handleError(_0x2fc5c4,null));};exports[_0xf6fa('0x6c')]=function(_0x1efe78,_0x564d65){return db[_0xf6fa('0x54')]['create'](_0x1efe78['body'],{})[_0xf6fa('0x29')](function(_0x4262a5){var _0x2695c0=_0x1efe78[_0xf6fa('0x6d')][_0xf6fa('0x3f')]({'plain':!![]});if(!_0x2695c0)throw new Error(_0xf6fa('0x6e'));if(_0x2695c0[_0xf6fa('0x6f')]==='user'){var _0xf3dc7f=_0x4262a5['get']({'plain':!![]});var _0x33ddf8=_0xf6fa('0x2b');return db[_0xf6fa('0x70')][_0xf6fa('0x71')]({'where':{'name':_0x33ddf8,'userProfileId':_0x2695c0[_0xf6fa('0x72')]},'raw':!![]})[_0xf6fa('0x29')](function(_0x4941d5){if(_0x4941d5&&_0x4941d5[_0xf6fa('0x73')]===0x0){return db['UserProfileResource'][_0xf6fa('0x6c')]({'name':_0xf3dc7f[_0xf6fa('0x2f')],'resourceId':_0xf3dc7f['id'],'type':_0x4941d5[_0xf6fa('0x2f')],'sectionId':_0x4941d5['id']},{})['then'](function(){return _0x4262a5;});}else{return _0x4262a5;}})['catch'](function(_0x4bf40e){logger[_0xf6fa('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4bf40e);throw _0x4bf40e;});}return _0x4262a5;})['then'](respondWithResult(_0x564d65,0xc9))[_0xf6fa('0x20')](handleError(_0x564d65,null));};exports[_0xf6fa('0x74')]=function(_0x5b5d75,_0x465b0b){if(_0x5b5d75['body']['id']){delete _0x5b5d75[_0xf6fa('0x75')]['id'];}return db[_0xf6fa('0x54')]['find']({'where':{'id':_0x5b5d75[_0xf6fa('0x76')]['id']},'include':[{'model':db[_0xf6fa('0x52')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x465b0b,null))['then'](saveUpdates(_0x5b5d75[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0x465b0b,null))['catch'](handleError(_0x465b0b,null));};exports[_0xf6fa('0x2a')]=function(_0x323871,_0x1a34b3){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x323871[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x1a34b3,null))['then'](removeEntity(_0x1a34b3,null))[_0xf6fa('0x20')](handleError(_0x1a34b3,null));};exports[_0xf6fa('0x77')]=function(_0x57be89,_0xe54ee6){return db[_0xf6fa('0x54')][_0xf6fa('0x77')]()[_0xf6fa('0x29')](respondWithResult(_0xe54ee6,null))[_0xf6fa('0x20')](handleError(_0xe54ee6,null));};exports[_0xf6fa('0x78')]=function(_0x43aff5,_0x25ef7d){if(_0x43aff5[_0xf6fa('0x75')]['id']){delete _0x43aff5[_0xf6fa('0x75')]['id'];}return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x43aff5[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x25ef7d,null))['then'](function(_0x5b134b){if(_0x5b134b){_0x43aff5[_0xf6fa('0x75')][_0xf6fa('0x79')]=_0x5b134b['id'];return db[_0xf6fa('0x7a')][_0xf6fa('0x6c')](_0x43aff5[_0xf6fa('0x75')]);}})[_0xf6fa('0x29')](respondWithResult(_0x25ef7d,null))[_0xf6fa('0x20')](handleError(_0x25ef7d,null));};exports[_0xf6fa('0x7b')]=function(_0x5210e7,_0x505045){var _0x14442e={'raw':![],'where':{}};var _0x5d73bb={};var _0x5f1031={'count':0x0,'rows':[]};return db[_0xf6fa('0x54')]['findOne']({'where':{'id':_0x5210e7[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x505045,null))['then'](function(_0x2113ac){if(_0x2113ac){_0x5d73bb['model']=_['keys'](db[_0xf6fa('0x7a')]['rawAttributes']);_0x5d73bb['query']=_['keys'](_0x5210e7[_0xf6fa('0x57')]);_0x5d73bb['filters']=_['intersection'](_0x5d73bb[_0xf6fa('0x5a')],_0x5d73bb[_0xf6fa('0x57')]);_0x14442e[_0xf6fa('0x5d')]=_['intersection'](_0x5d73bb[_0xf6fa('0x5a')],qs['fields'](_0x5210e7[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x14442e[_0xf6fa('0x5d')]=_0x14442e[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x14442e[_0xf6fa('0x5d')]:_0x5d73bb['model'];if(!_0x5210e7[_0xf6fa('0x57')]['hasOwnProperty']('nolimit')){_0x14442e['limit']=qs['limit'](_0x5210e7[_0xf6fa('0x57')]['limit']);_0x14442e[_0xf6fa('0x24')]=qs[_0xf6fa('0x24')](_0x5210e7[_0xf6fa('0x57')][_0xf6fa('0x24')]);}_0x14442e[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x5210e7[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x14442e[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x5210e7['query'],_0x5d73bb[_0xf6fa('0x59')]));_0x14442e[_0xf6fa('0x63')][_0xf6fa('0x79')]=_0x2113ac['id'];if(_0x5210e7['query'][_0xf6fa('0x65')]){_0x14442e[_0xf6fa('0x63')]=_[_0xf6fa('0x6b')](_0x14442e[_0xf6fa('0x63')],{'$or':_[_0xf6fa('0x3c')](_0x14442e[_0xf6fa('0x5d')],function(_0x249219){var _0x3f6a53={};_0x3f6a53[_0x249219]={'$like':'%'+_0x5210e7[_0xf6fa('0x57')]['filter']+'%'};return _0x3f6a53;})});}_0x14442e=_['merge']({},_0x14442e,_0x5210e7[_0xf6fa('0x66')]);return db[_0xf6fa('0x7a')][_0xf6fa('0x27')]({'where':_0x14442e[_0xf6fa('0x63')]})[_0xf6fa('0x29')](function(_0x3ec3c2){_0x5f1031['count']=_0x3ec3c2;if(_0x5210e7[_0xf6fa('0x57')][_0xf6fa('0x67')]){_0x14442e[_0xf6fa('0x68')]=[{'all':!![]}];}return db[_0xf6fa('0x7a')][_0xf6fa('0x7c')](_0x14442e);})[_0xf6fa('0x29')](function(_0x26e6af){_0x5f1031['rows']=_0x26e6af;return _0x5f1031;});}})[_0xf6fa('0x29')](respondWithFilteredResult(_0x505045,_0x14442e))[_0xf6fa('0x20')](handleError(_0x505045,null));};exports['removeDispositions']=function(_0x4682c5,_0x5b7952){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x4682c5['params']['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x5b7952,null))['then'](function(_0x317cff){if(_0x317cff){return _0x317cff[_0xf6fa('0x7d')](_0x4682c5[_0xf6fa('0x57')][_0xf6fa('0x7e')]);}})['then'](respondWithStatusCode(_0x5b7952,null))['catch'](handleError(_0x5b7952,null));};exports[_0xf6fa('0x7f')]=function(_0x32b710,_0x1d81a0){if(_0x32b710[_0xf6fa('0x75')]['id']){delete _0x32b710[_0xf6fa('0x75')]['id'];}return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x32b710[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x1d81a0,null))[_0xf6fa('0x29')](function(_0x23d157){if(_0x23d157){_0x32b710[_0xf6fa('0x75')]['ChatWebsiteId']=_0x23d157['id'];return db[_0xf6fa('0x80')][_0xf6fa('0x6c')](_0x32b710['body']);}})[_0xf6fa('0x29')](respondWithResult(_0x1d81a0,null))['catch'](handleError(_0x1d81a0,null));};exports[_0xf6fa('0x81')]=function(_0x1fad87,_0xc2c363){var _0x2c6508={'raw':![],'where':{}};var _0x3b980c={};var _0x1f056e={'count':0x0,'rows':[]};return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x1fad87[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0xc2c363,null))[_0xf6fa('0x29')](function(_0x3d9014){if(_0x3d9014){_0x3b980c[_0xf6fa('0x5a')]=_[_0xf6fa('0x58')](db[_0xf6fa('0x80')]['rawAttributes']);_0x3b980c[_0xf6fa('0x57')]=_['keys'](_0x1fad87['query']);_0x3b980c[_0xf6fa('0x59')]=_['intersection'](_0x3b980c[_0xf6fa('0x5a')],_0x3b980c[_0xf6fa('0x57')]);_0x2c6508[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0x3b980c[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x1fad87['query'][_0xf6fa('0x5c')]));_0x2c6508[_0xf6fa('0x5d')]=_0x2c6508[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x2c6508[_0xf6fa('0x5d')]:_0x3b980c[_0xf6fa('0x5a')];if(!_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0x2c6508[_0xf6fa('0x26')]=qs[_0xf6fa('0x26')](_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x26')]);_0x2c6508[_0xf6fa('0x24')]=qs['offset'](_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x24')]);}_0x2c6508[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x2c6508[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x1fad87[_0xf6fa('0x57')],_0x3b980c[_0xf6fa('0x59')]));_0x2c6508[_0xf6fa('0x63')][_0xf6fa('0x79')]=_0x3d9014['id'];if(_0x1fad87[_0xf6fa('0x57')][_0xf6fa('0x65')]){_0x2c6508[_0xf6fa('0x63')]=_['merge'](_0x2c6508[_0xf6fa('0x63')],{'$or':_['map'](_0x2c6508[_0xf6fa('0x5d')],function(_0x4ff6bb){var _0x577f76={};_0x577f76[_0x4ff6bb]={'$like':'%'+_0x1fad87['query'][_0xf6fa('0x65')]+'%'};return _0x577f76;})});}_0x2c6508=_[_0xf6fa('0x6b')]({},_0x2c6508,_0x1fad87[_0xf6fa('0x66')]);return db[_0xf6fa('0x80')]['count']({'where':_0x2c6508['where']})['then'](function(_0x59137e){_0x1f056e[_0xf6fa('0x27')]=_0x59137e;if(_0x1fad87['query'][_0xf6fa('0x67')]){_0x2c6508[_0xf6fa('0x68')]=[{'all':!![]}];}return db[_0xf6fa('0x80')][_0xf6fa('0x7c')](_0x2c6508);})[_0xf6fa('0x29')](function(_0xab2ee1){_0x1f056e[_0xf6fa('0x69')]=_0xab2ee1;return _0x1f056e;});}})[_0xf6fa('0x29')](respondWithFilteredResult(_0xc2c363,_0x2c6508))[_0xf6fa('0x20')](handleError(_0xc2c363,null));};exports['removeAnswers']=function(_0x4618fd,_0x5111db){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x4618fd[_0xf6fa('0x76')]['id']}})['then'](handleEntityNotFound(_0x5111db,null))[_0xf6fa('0x29')](function(_0x40dd25){if(_0x40dd25){return _0x40dd25[_0xf6fa('0x83')](_0x4618fd[_0xf6fa('0x57')][_0xf6fa('0x7e')]);}})[_0xf6fa('0x29')](respondWithStatusCode(_0x5111db,null))[_0xf6fa('0x20')](handleError(_0x5111db,null));};exports[_0xf6fa('0x84')]=function(_0x5c6552,_0x1205c0){_0x5c6552[_0xf6fa('0x75')][_0xf6fa('0x85')]=_0x5c6552['file'][_0xf6fa('0x86')];return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x5c6552[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x1205c0,null))[_0xf6fa('0x29')](saveUpdates(_0x5c6552[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0x1205c0,null))['catch'](handleError(_0x1205c0,null));};exports[_0xf6fa('0x87')]=function(_0x5f27ee,_0xd16dd0){_0x5f27ee[_0xf6fa('0x75')][_0xf6fa('0x88')]=_0x5f27ee['file'][_0xf6fa('0x86')];return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x5f27ee[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0xd16dd0,null))['then'](saveUpdates(_0x5f27ee[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0xd16dd0,null))[_0xf6fa('0x20')](handleError(_0xd16dd0,null));};exports[_0xf6fa('0x89')]=function(_0x40dcb8,_0x192d56){_0x40dcb8[_0xf6fa('0x75')][_0xf6fa('0x8a')]=_0x40dcb8[_0xf6fa('0x8b')][_0xf6fa('0x86')];return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x40dcb8[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x192d56,null))[_0xf6fa('0x29')](saveUpdates(_0x40dcb8[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0x192d56,null))['catch'](handleError(_0x192d56,null));};exports[_0xf6fa('0x8c')]=function(_0xe95e0b,_0x32bfd3){_0xe95e0b['body'][_0xf6fa('0x8d')]=_0xe95e0b[_0xf6fa('0x8b')]['filename'];return db[_0xf6fa('0x54')]['find']({'where':{'id':_0xe95e0b[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x32bfd3,null))[_0xf6fa('0x29')](saveUpdates(_0xe95e0b[_0xf6fa('0x75')],null))[_0xf6fa('0x29')](respondWithResult(_0x32bfd3,null))[_0xf6fa('0x20')](handleError(_0x32bfd3,null));};exports[_0xf6fa('0x8e')]=function(_0x1fff07,_0x592c73){var _0x7f5cd8=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x91'));var _0x47d7e8={'where':{'id':_0x1fff07['params']['id']},'attributes':['id',_0xf6fa('0x85')],'raw':!![]};var _0x2c90e1=![];return require(_0xf6fa('0x92'))['getLicense']()['then'](function(_0x27034f){if(_0x27034f){_0x2c90e1=_0x27034f['custom'];}})['then'](function(){return db[_0xf6fa('0x54')]['find'](_0x47d7e8);})[_0xf6fa('0x29')](handleEntityNotFound(_0x592c73,null))['then'](function(_0x338c72){if(_0x338c72){if(!_[_0xf6fa('0x93')](_0x338c72[_0xf6fa('0x85')])){if(fs[_0xf6fa('0x94')](path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x95'),_0x338c72[_0xf6fa('0x85')]))&&_0x2c90e1){_0x7f5cd8=path['join'](config[_0xf6fa('0x90')],_0xf6fa('0x95'),_0x338c72['sitepic']);}}return _0x592c73[_0xf6fa('0x96')](_0x7f5cd8);}})[_0xf6fa('0x20')](handleError(_0x592c73,null));};exports[_0xf6fa('0x97')]=function(_0x253f98,_0x411d58){var _0x2b4d27=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x98'));var _0x2cebff={'where':{'id':_0x253f98[_0xf6fa('0x76')]['id']},'attributes':['id',_0xf6fa('0x88')],'raw':!![]};return db[_0xf6fa('0x54')][_0xf6fa('0x71')](_0x2cebff)[_0xf6fa('0x29')](handleEntityNotFound(_0x411d58,null))['then'](function(_0x5bed8f){if(_0x5bed8f){if(!_['isNil'](_0x5bed8f[_0xf6fa('0x88')])){if(fs[_0xf6fa('0x94')](path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x99'),_0x5bed8f[_0xf6fa('0x88')]))){_0x2b4d27=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x99'),_0x5bed8f[_0xf6fa('0x88')]);}}return _0x411d58[_0xf6fa('0x96')](_0x2b4d27);}})[_0xf6fa('0x20')](handleError(_0x411d58,null));};exports[_0xf6fa('0x9a')]=function(_0x4a76aa,_0x3c2003){var _0xb711a4=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x9b'));var _0x395d36={'where':{'id':_0x4a76aa[_0xf6fa('0x76')]['id']},'attributes':['id',_0xf6fa('0x8a'),_0xf6fa('0x9c')],'raw':!![]};return db[_0xf6fa('0x54')][_0xf6fa('0x71')](_0x395d36)[_0xf6fa('0x29')](handleEntityNotFound(_0x3c2003,null))[_0xf6fa('0x29')](function(_0x71359a){if(_0x71359a){if(!_[_0xf6fa('0x93')](_0x71359a[_0xf6fa('0x8a')])){if(fs[_0xf6fa('0x94')](path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],'server/files/images/avatars/',_0x71359a[_0xf6fa('0x8a')]))&&_0x71359a[_0xf6fa('0x9c')]){_0xb711a4=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],'server/files/images/avatars/',_0x71359a[_0xf6fa('0x8a')]);}}return _0x3c2003[_0xf6fa('0x96')](_0xb711a4);}})[_0xf6fa('0x20')](handleError(_0x3c2003,null));};exports[_0xf6fa('0x9d')]=function(_0x1d9d13,_0x57175a){var _0x2f8ff6=path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],'server/files/images/avatars/system_avatar.png');var _0x4f7538={'where':{'id':_0x1d9d13[_0xf6fa('0x76')]['id']},'attributes':['id',_0xf6fa('0x8d')],'raw':!![]};return db[_0xf6fa('0x54')][_0xf6fa('0x71')](_0x4f7538)[_0xf6fa('0x29')](handleEntityNotFound(_0x57175a,null))[_0xf6fa('0x29')](function(_0x27cc50){if(_0x27cc50){if(!_[_0xf6fa('0x93')](_0x27cc50[_0xf6fa('0x8d')])){if(fs[_0xf6fa('0x94')](path[_0xf6fa('0x8f')](config['root'],_0xf6fa('0x99'),_0x27cc50[_0xf6fa('0x8d')]))){_0x2f8ff6=path['join'](config[_0xf6fa('0x90')],_0xf6fa('0x99'),_0x27cc50[_0xf6fa('0x8d')]);}}return _0x57175a[_0xf6fa('0x96')](_0x2f8ff6);}})[_0xf6fa('0x20')](handleError(_0x57175a,null));};exports[_0xf6fa('0x9e')]=function(_0x2c7fc9,_0x2c1f70){var _0xbc37c8={'body':_0x2c7fc9[_0xf6fa('0x75')],'channel':'chat'};var _0xdf52d3=[];var _0x2b3770=[];var _0x1a0d99={};var _0x5377d1=![];return db[_0xf6fa('0x9f')][_0xf6fa('0x77')]()['then'](function(_0x32672b){if(!_0x32672b){throw new db[(_0xf6fa('0xa0'))]['ValidationError']('no\x20available\x20attributes');}_0xdf52d3=_[_0xf6fa('0xa1')](_[_0xf6fa('0x58')](_0x32672b),[_0xf6fa('0xa2'),_0xf6fa('0xa3')]);_0x2b3770=_[_0xf6fa('0xa1')](_[_0xf6fa('0x58')](_0x32672b),[_0xf6fa('0xa2'),_0xf6fa('0xa3'),'CompanyId',_0xf6fa('0xa4')]);if(_0x2c7fc9[_0xf6fa('0x75')]['id']){delete _0x2c7fc9[_0xf6fa('0x75')]['id'];}if(_['isNil'](_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa5')])){throw new db[(_0xf6fa('0xa0'))][(_0xf6fa('0xa6'))]('from\x20is\x20mandatory');}if(_[_0xf6fa('0x93')](_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0x75')])||_0x2c7fc9['body'][_0xf6fa('0x75')]===''){throw new db[(_0xf6fa('0xa0'))][(_0xf6fa('0xa6'))](_0xf6fa('0xa7'));}if(_[_0xf6fa('0x93')](_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa8')])){throw new db[(_0xf6fa('0xa0'))]['ValidationError'](_0xf6fa('0xa9')+_0x2b3770);}if(!_[_0xf6fa('0xaa')](_0x2b3770,_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa8')])){throw new db[(_0xf6fa('0xa0'))]['ValidationError'](_0xf6fa('0xab')+_0x2b3770);}_0x1a0d99[_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa8')]]=_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa5')];})['then'](function(){return db['ChatWebsite']['find']({'where':{'id':_0x2c7fc9[_0xf6fa('0x76')]['id']},'include':[{'model':db[_0xf6fa('0xac')],'as':_0xf6fa('0xad'),'include':[{'model':db[_0xf6fa('0x9f')],'as':_0xf6fa('0xae'),'where':_0x1a0d99,'limit':0x1,'order':[[_0xf6fa('0xa3'),_0xf6fa('0xaf')]]}]},{'model':db[_0xf6fa('0xb0')],'as':'Applications'},{'model':db[_0xf6fa('0x3d')],'as':_0xf6fa('0x3d'),'include':[{'model':db[_0xf6fa('0x3d')],'as':_0xf6fa('0x3e'),'attributes':['id',_0xf6fa('0x36')],'raw':!![]}]}]});})[_0xf6fa('0x29')](function(_0x4560cd){if(!_0x4560cd)throw new APINotFoundError(util[_0xf6fa('0x33')](_0xf6fa('0xb1'),_0x2c7fc9[_0xf6fa('0x76')]['id']));if(!_0x4560cd[_0xf6fa('0x3d')]||!_0x4560cd[_0xf6fa('0x3d')]['Intervals'])return[_0x4560cd,!![]];return[_0x4560cd,checkWebsiteIntervals(_0x4560cd)];})[_0xf6fa('0xb2')](function(_0x145fc4,_0xfc230d){if(!_0xfc230d)throw new APIOutOfIntervalError();if(!_0x145fc4[_0xf6fa('0xad')])return;_0xbc37c8[_0xf6fa('0xb3')]=_0x145fc4;_0xbc37c8[_0xf6fa('0xb4')]=_0x145fc4['List'];_0xbc37c8[_0xf6fa('0xb5')]=_[_0xf6fa('0xb6')](_0x145fc4[_0xf6fa('0xb7')],[_0xf6fa('0xb8')],[_0xf6fa('0xb9')]);if(_0xbc37c8[_0xf6fa('0xb3')]['Applications']){delete _0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xb7')];}if(_0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xad')]&&_0xbc37c8['account'][_0xf6fa('0xad')][_0xf6fa('0xae')][_0xf6fa('0x5e')]){return _0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xad')][_0xf6fa('0xae')][0x0];}var _0x136a54=_[_0xf6fa('0x12')](_0x2c7fc9[_0xf6fa('0x75')],{'firstName':_0x2c7fc9['body']['from'],'ListId':_0x145fc4['ListId']});_0x136a54[_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xa8')]]=_0x2c7fc9[_0xf6fa('0x75')]['from'];return db['CmContact'][_0xf6fa('0x6c')](_0x136a54,{'fields':_0xdf52d3,'raw':!![]});})[_0xf6fa('0x29')](function(_0xfa2350){_0xbc37c8['contact']=_0xfa2350;var _0x2eda39=createInteractionObject(_0x2c7fc9[_0xf6fa('0x76')]['id'],_0x2c7fc9[_0xf6fa('0x75')],_0x2c7fc9[_0xf6fa('0xba')],_0xfa2350);var _0x56e67e={'ChatWebsiteId':_0x2c7fc9[_0xf6fa('0x76')]['id'],'closed':![]};if(_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbb')]){_0x56e67e[_0xf6fa('0xbb')]=_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbb')];return db['ChatInteraction']['find']({'where':_0x56e67e})[_0xf6fa('0x29')](function(_0x17a097){if(_0x17a097){_0x5377d1=!![];return _0x17a097;}_0x2eda39[_0xf6fa('0xbb')]=_0x2c7fc9['body'][_0xf6fa('0xbb')];_0x2eda39[_0xf6fa('0xbc')]=_0x2c7fc9['body'][_0xf6fa('0xbc')];return db['ChatInteraction'][_0xf6fa('0x6c')](_0x2eda39);});}_0x56e67e[_0xf6fa('0xbd')]=_0xfa2350['id'];if(_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbe')]&&_0x2c7fc9['body'][_0xf6fa('0xbe')]['id']){_0x56e67e['id']=_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbe')]['id'];return db[_0xf6fa('0xbf')][_0xf6fa('0x71')]({'where':_0x56e67e})[_0xf6fa('0x29')](function(_0x553ad2){if(_0x553ad2){_0x5377d1=!![];return _0x553ad2;}return db[_0xf6fa('0xbf')]['create'](_0x2eda39);});}return db[_0xf6fa('0xbf')]['create'](_0x2eda39);})[_0xf6fa('0x29')](function(_0x1faabb){if(!_0x5377d1)return _0x1faabb;var _0x3c575e={'from':(_0xbc37c8['contact'][_0xf6fa('0x47')]||'')+'\x20'+(_0xbc37c8[_0xf6fa('0xc0')][_0xf6fa('0x48')]||'')};if(_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xbb')]&&_0x2c7fc9[_0xf6fa('0x75')]['messageId']&&_0x2c7fc9['body']['threadId']!=_0x2c7fc9[_0xf6fa('0x75')]['messageId']){_0x3c575e[_0xf6fa('0xbb')]=_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0xc1')];}return _0x1faabb['update'](_0x3c575e);})[_0xf6fa('0x29')](function(_0x1ff9b2){_0xbc37c8[_0xf6fa('0xbe')]=_0x1ff9b2['get']({'plain':!![]});_0xbc37c8[_0xf6fa('0xbe')]['created']=!_0x5377d1;if(_0xbc37c8[_0xf6fa('0xbe')][_0xf6fa('0xc2')]){if(_0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xc3')]){_0xbc37c8['applications'][_0xf6fa('0xc4')]({'id':0x0,'priority':_0xbc37c8['applications']['length']+0x1,'app':_0xf6fa('0xc5'),'appdata':_0xf6fa('0xc6'),'interval':_0xf6fa('0xc7')});}}return db[_0xf6fa('0xc8')][_0xf6fa('0x6c')]({'body':_0x2c7fc9[_0xf6fa('0x75')][_0xf6fa('0x75')],'ChatWebsiteId':_0x2c7fc9[_0xf6fa('0x76')]['id'],'ChatInteractionId':_0x1ff9b2['id'],'direction':'in','ContactId':_0xbc37c8[_0xf6fa('0xc0')]['id'],'AttachmentId':_0x2c7fc9['body'][_0xf6fa('0xc9')]});})['then'](function(_0x25cc2c){_0xbc37c8['message']=_0x25cc2c;if(!_0xbc37c8[_0xf6fa('0xbe')]['UserId']){return;}return db['User']['find']({'attributes':['id','name'],'where':{'id':_0xbc37c8[_0xf6fa('0xbe')][_0xf6fa('0xca')]}});})['then'](function(_0xb0cd1){if(_0xb0cd1){_0xbc37c8[_0xf6fa('0xb5')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf6fa('0xcb'),'appdata':_0xb0cd1[_0xf6fa('0x2f')]+','+(_0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xcc')]||0xa),'interval':_0xf6fa('0xc7')});_0xbc37c8[_0xf6fa('0xcd')]=!![];}if(!_0xbc37c8['interaction'][_0xf6fa('0xce')]){return;}return db[_0xf6fa('0xcf')][_0xf6fa('0x71')]({'attributes':['id','name'],'where':{'id':_0xbc37c8[_0xf6fa('0xbe')][_0xf6fa('0xce')]}});})[_0xf6fa('0x29')](function(_0x584c6c){if(_0x584c6c){_0xbc37c8[_0xf6fa('0xb5')][_0xf6fa('0xd0')]({'id':0x0,'priority':0x1,'app':_0xf6fa('0xd1'),'appdata':_0x584c6c[_0xf6fa('0x2f')]+','+(_0xbc37c8[_0xf6fa('0xb3')][_0xf6fa('0xd2')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xf6fa('0xd3'),'startRouting',_0xbc37c8);})['then'](function(_0x2d901a){respondWithRpcPromise(_0xf6fa('0xd4'),_0xf6fa('0xd4'),{'event':'notify','message':_0x2d901a},client9002);return _0x2d901a;})['then'](respondWithResult(_0x2c1f70,null))[_0xf6fa('0x20')](APIHandleError(_0x2c1f70));};exports[_0xf6fa('0xd5')]=function(_0x2aef5d,_0x5224b4){var _0x2aa40d,_0xfa92b3,_0x4df00c;var _0xb22606=[];var _0x452b81={};var _0x5cfd6b=_0x2aef5d[_0xf6fa('0xd6')]||[];var _0x514321=[];var _0x43a578;return db[_0xf6fa('0x9f')]['describe']()[_0xf6fa('0x29')](function(_0x2ee2a3){if(!_0x2ee2a3){throw new db[(_0xf6fa('0xa0'))][(_0xf6fa('0xa6'))]('no\x20available\x20attributes');}_0xb22606=_[_0xf6fa('0xa1')](_[_0xf6fa('0x58')](_0x2ee2a3),[_0xf6fa('0xa2'),_0xf6fa('0xa3'),'CompanyId','ListId']);if(_0x2aef5d[_0xf6fa('0x75')]['id']){delete _0x2aef5d[_0xf6fa('0x75')]['id'];}if(_[_0xf6fa('0x93')](_0x2aef5d[_0xf6fa('0x75')][_0xf6fa('0xa5')])){throw _0x5224b4[_0xf6fa('0x21')](0x1f4)[_0xf6fa('0xd7')](new db['Sequelize'][(_0xf6fa('0xa6'))](_0xf6fa('0xd8')));}if(_[_0xf6fa('0x93')](_0x2aef5d[_0xf6fa('0x75')]['body'])||_0x2aef5d['body'][_0xf6fa('0x75')]===''){throw _0x5224b4['status'](0x1f4)['send'](new db['Sequelize'][(_0xf6fa('0xa6'))](_0xf6fa('0xa7')));}if(_[_0xf6fa('0x93')](_0x2aef5d[_0xf6fa('0x75')][_0xf6fa('0xd9')])){throw _0x5224b4[_0xf6fa('0x21')](0x1f4)[_0xf6fa('0xd7')](new db[(_0xf6fa('0xa0'))][(_0xf6fa('0xa6'))](_0xf6fa('0xda')+_0xb22606));}if(!_[_0xf6fa('0xaa')](_0xb22606,_0x2aef5d[_0xf6fa('0x75')][_0xf6fa('0xd9')])){throw _0x5224b4['status'](0x1f4)[_0xf6fa('0xd7')](new db[(_0xf6fa('0xa0'))]['ValidationError'](_0xf6fa('0xdb')+_0xb22606));}_0x452b81[_0x2aef5d['body'][_0xf6fa('0xd9')]]=_0x2aef5d['body'][_0xf6fa('0xa5')];})[_0xf6fa('0x29')](function(){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x2aef5d[_0xf6fa('0x76')]['id']},'include':[{'model':db['CmList'],'as':_0xf6fa('0xad')},{'model':db[_0xf6fa('0xdc')],'as':_0xf6fa('0xdc')}]});})[_0xf6fa('0x29')](handleEntityNotFound(_0x5224b4,null))[_0xf6fa('0x29')](function(_0x2564fa){if(_0x2564fa&&_0x2564fa[_0xf6fa('0xad')]){_0xfa92b3=_0x2564fa;var _0x5b2722=_[_0xf6fa('0x12')](_0x2aef5d[_0xf6fa('0x75')],{'firstName':_0x2aef5d[_0xf6fa('0x75')]['from'],'phone':_0x2aef5d[_0xf6fa('0x75')]['from'],'ListId':_0x2564fa['ListId']});_0x5b2722[_0x2aef5d[_0xf6fa('0x75')][_0xf6fa('0xd9')]]=_0x2aef5d[_0xf6fa('0x75')]['from'];return db[_0xf6fa('0x9f')][_0xf6fa('0xdd')]({'where':_0x452b81,'defaults':_0x5b2722});}})[_0xf6fa('0xb2')](function(_0x2e95f8){if(_0x2e95f8){_0x4df00c=_0x2e95f8;var _0xc5cbf0=fs[_0xf6fa('0xde')](path[_0xf6fa('0x8f')](config['root'],_0xf6fa('0xdf')),_0xf6fa('0xe0'));var _0x1ae0e7=ejs[_0xf6fa('0xe1')](_0xc5cbf0,{'body':_[_0xf6fa('0xe2')](_0x2aef5d[_0xf6fa('0x75')]['body']),'bodyTitle':_0xfa92b3[_0xf6fa('0xe3')]});return db[_0xf6fa('0xe4')][_0xf6fa('0x6c')]({'body':_0x1ae0e7,'plainBody':htmlToText[_0xf6fa('0xe5')](_0x1ae0e7),'ContactId':_0x2e95f8['id'],'ChatWebsiteId':_0xfa92b3['id']});}})[_0xf6fa('0x29')](function(_0x336568){_0x43a578=_0x336568;if(_0x5cfd6b['length']){var _0x1130a=_0x5cfd6b[_0xf6fa('0x3c')](function(_0x268c9b){return{'name':_0x268c9b[_0xf6fa('0xe6')],'basename':_0x268c9b[_0xf6fa('0x86')],'type':_0x268c9b[_0xf6fa('0xe7')],'ChatOfflineMessageId':_0x336568['id']};});_0x514321=_0x1130a[_0xf6fa('0x3c')](_0x1a3c35=>{var _0x206a3d={'filename':_0x1a3c35[_0xf6fa('0x2f')],'path':path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],'server','files','attachments','offline-chat',_0x1a3c35[_0xf6fa('0xe8')])};return _0x206a3d;});if(!_0xfa92b3[_0xf6fa('0xe9')]){return db[_0xf6fa('0xea')]['transaction'](function(_0x5332e7){return db[_0xf6fa('0xeb')]['bulkCreate'](_0x1130a,{'transaction':_0x5332e7});});}}})[_0xf6fa('0x29')](function(){if(_0x43a578){_0x2aa40d=_0x43a578;return db[_0xf6fa('0xdc')][_0xf6fa('0x82')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xf6fa('0xec')],'as':_0xf6fa('0xec'),'raw':!![]}]}]});}})['then'](function(_0x23e822){if(_0x23e822&&_0x23e822[_0xf6fa('0xed')]&&_0xfa92b3['forwardOffline']&&_0xfa92b3[_0xf6fa('0xee')]){var _0x38631b=_0x23e822['getSmtpOptions']();return respondWithRpcPromise(_0xf6fa('0xef'),_0xf6fa('0xf0'),{'account':_0x38631b,'message':{'from':util[_0xf6fa('0x33')]('\x22%s\x22\x20<%s>',_0x23e822[_0xf6fa('0x2f')],_0x23e822[_0xf6fa('0xf1')]||_0x23e822[_0xf6fa('0xed')][_0xf6fa('0x6d')]),'to':_0xfa92b3[_0xf6fa('0xee')],'subject':_0xfa92b3[_0xf6fa('0xf2')],'html':_0x2aa40d[_0xf6fa('0x75')],'attachments':_0x514321}},client9003)[_0xf6fa('0x29')](function(){return _0x2aa40d;})[_0xf6fa('0x20')](function(_0x3b5cd6){logger[_0xf6fa('0x1d')](_0x3b5cd6);});}})[_0xf6fa('0x29')](function(){if(_0xfa92b3&&_0xfa92b3[_0xf6fa('0xe9')]&&_0xfa92b3[_0xf6fa('0xf3')]){var _0x609d75=[];if(_0x5cfd6b[_0xf6fa('0x5e')]){_0x609d75=_0x5cfd6b[_0xf6fa('0x3c')](function(_0x2f054f){return{'name':_0x2f054f[_0xf6fa('0xe6')],'basename':_0x2f054f[_0xf6fa('0x86')],'type':_0x2f054f[_0xf6fa('0xe7')],'ChatOfflineMessageId':_0x43a578['id']};});}var _0x382fb4;if(!_[_0xf6fa('0x93')](_0xfa92b3[_0xf6fa('0xf4')])){var _0x2fb21d=_[_0xf6fa('0x3c')](_0x2aef5d[_0xf6fa('0x75')],function(_0x2c3dbd){return _0x2c3dbd;});var _0x247708=_[_0xf6fa('0xf5')](_0x2fb21d)[0x0];var _0x3f05f4=_['mapValues'](_0x247708,function(_0x2a3ac8){return _0x2a3ac8;});_0x382fb4=_0x3f05f4[0x1][_0xfa92b3[_0xf6fa('0xf4')]];}var _0x581409={'from':_0x4df00c[_0xf6fa('0xf1')],'firstName':_0x4df00c[_0xf6fa('0x47')],'lastName':_0x4df00c['lastName'],'mapKey':_0xf6fa('0xf1'),'message':{'from':_0x4df00c[_0xf6fa('0xf1')],'to':_0xfa92b3['MailAccount'][_0xf6fa('0xf1')],'cc':'','subject':_['isNil'](_0x382fb4)?_0xfa92b3[_0xf6fa('0xf2')]:_0x382fb4,'messageId':'','sentAt':new Date(),'attach':_0x609d75[_0xf6fa('0x5e')],'attachments':_0x609d75,'originChannel':_0xf6fa('0xf6'),'ChatWebsiteId':_0xfa92b3['id'],'ChatOfflineMessageId':_0x2aa40d['id'],'originTo':_0xfa92b3[_0xf6fa('0xdc')][_0xf6fa('0xf1')]},'body':_0x2aa40d[_0xf6fa('0x75')]};var _0x48fe91={'account':{'id':_0xfa92b3[_0xf6fa('0xf3')]},'body':_0x581409,'log':_0xf6fa('0xf7')};return respondWithRpcPromise(_0xf6fa('0xf7'),_0xf6fa('0xf8'),_0x48fe91,client9001)[_0xf6fa('0x29')](function(){return _0x2aa40d;})[_0xf6fa('0x20')](function(_0x3df2f3){logger[_0xf6fa('0x1d')](_0x3df2f3);});}return;})[_0xf6fa('0x29')](function(){if(_0x2aa40d){return _0x2aa40d;}})[_0xf6fa('0x29')](respondWithResult(_0x5224b4,null))[_0xf6fa('0x20')](function(){for(var _0x4c5e50 of _0x5cfd6b){var _0x43e95d=path['join'](config['root'],_0xf6fa('0xf9'),'files','attachments','offline-chat',_0x4c5e50[_0xf6fa('0x86')]);fs_extra['remove'](_0x43e95d)[_0xf6fa('0x20')](function(_0x8d2dd9){logger[_0xf6fa('0x1d')]('Could\x20not\x20remove\x20attachment\x20file',_0x43e95d,_0x8d2dd9);});}});};exports[_0xf6fa('0xfa')]=function(_0x439dbc,_0x4522ee){return db[_0xf6fa('0xbf')][_0xf6fa('0x71')]({'where':{'id':_0x439dbc[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x4522ee,null))[_0xf6fa('0x29')](function(_0x4e6b58){if(_0x4e6b58){return _0x4e6b58[_0xf6fa('0xfa')](_0x439dbc['body'][_0xf6fa('0x7e')],_[_0xf6fa('0xfb')](_0x439dbc['body'],[_0xf6fa('0x7e'),'id'])||{});}})[_0xf6fa('0x29')](respondWithResult(_0x4522ee,null))[_0xf6fa('0x20')](handleError(_0x4522ee,null));};exports[_0xf6fa('0xfc')]=function(_0x3649d1,_0x304a04){var _0x5f13fa={'raw':![],'where':{}};var _0x414a56={};var _0x21c638={'count':0x0,'rows':[]};return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x3649d1[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x304a04,null))['then'](function(_0x5424b9){if(_0x5424b9){_0x414a56[_0xf6fa('0x5a')]=_[_0xf6fa('0x58')](db[_0xf6fa('0xbf')][_0xf6fa('0x55')]);_0x414a56[_0xf6fa('0x57')]=_[_0xf6fa('0x58')](_0x3649d1[_0xf6fa('0x57')]);_0x414a56[_0xf6fa('0x59')]=_[_0xf6fa('0x5b')](_0x414a56['model'],_0x414a56[_0xf6fa('0x57')]);_0x5f13fa[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0x414a56[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x3649d1[_0xf6fa('0x57')]['fields']));_0x5f13fa[_0xf6fa('0x5d')]=_0x5f13fa[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x5f13fa[_0xf6fa('0x5d')]:_0x414a56[_0xf6fa('0x5a')];if(!_0x3649d1['query'][_0xf6fa('0x5f')]('nolimit')){_0x5f13fa[_0xf6fa('0x26')]=qs['limit'](_0x3649d1[_0xf6fa('0x57')]['limit']);_0x5f13fa['offset']=qs[_0xf6fa('0x24')](_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x24')]);}_0x5f13fa[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x5f13fa['where']=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x3649d1[_0xf6fa('0x57')],_0x414a56[_0xf6fa('0x59')]));_0x5f13fa[_0xf6fa('0x63')][_0xf6fa('0x79')]=_0x5424b9['id'];if(_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x65')]){_0x5f13fa[_0xf6fa('0x63')]=_[_0xf6fa('0x6b')](_0x5f13fa['where'],{'$or':_[_0xf6fa('0x3c')](_0x5f13fa[_0xf6fa('0x5d')],function(_0x584e47){var _0x3777c0={};_0x3777c0[_0x584e47]={'$like':'%'+_0x3649d1[_0xf6fa('0x57')]['filter']+'%'};return _0x3777c0;})});}_0x5f13fa=_[_0xf6fa('0x6b')]({},_0x5f13fa,_0x3649d1[_0xf6fa('0x66')]);return db[_0xf6fa('0xbf')][_0xf6fa('0x27')]({'where':_0x5f13fa[_0xf6fa('0x63')]})['then'](function(_0x38851f){_0x21c638[_0xf6fa('0x27')]=_0x38851f;if(_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x67')]){_0x5f13fa[_0xf6fa('0x68')]=[{'model':db['CmContact'],'as':_0xf6fa('0xfd'),'required':![]},{'model':db['User'],'as':'Owner','attributes':['name',_0xf6fa('0xfe'),_0xf6fa('0xff')],'required':![]},{'model':db[_0xf6fa('0x100')],'as':_0xf6fa('0x101'),'attributes':['id',_0xf6fa('0x2f'),_0xf6fa('0x102')],'where':_0x3649d1[_0xf6fa('0x57')][_0xf6fa('0x103')]?{'id':_0x3649d1[_0xf6fa('0x57')]['tag']}:undefined,'required':_0x3649d1[_0xf6fa('0x57')]['tag']?!![]:![]}];}return db[_0xf6fa('0xbf')][_0xf6fa('0x7c')](_0x5f13fa);})[_0xf6fa('0x29')](function(_0x147a8a){_0x21c638['rows']=_0x147a8a;return _0x21c638;});}})[_0xf6fa('0x29')](respondWithFilteredResult(_0x304a04,_0x5f13fa))[_0xf6fa('0x20')](handleError(_0x304a04,null));};exports['getSnippet']=function(_0x58672b,_0x5c3ced){var _0x2157d9=0x0;var _0x54e7eb=0x0;var _0x3b6a35=![];var _0x13ffdf;var _0x4e3a15;return db[_0xf6fa('0x54')]['find']({'where':{'id':_0x58672b[_0xf6fa('0x76')]['id']},'include':[{'model':db['Interval'],'as':'Interval','include':[{'model':db[_0xf6fa('0x3d')],'as':_0xf6fa('0x3e'),'attributes':['id',_0xf6fa('0x36')]}]}]})['then'](handleEntityNotFound(_0x5c3ced,null))['then'](function(_0x5efcb2){if(_0x5efcb2){_0x13ffdf=_0x5efcb2;return _0x5efcb2[_0xf6fa('0x104')]({'raw':!![]});}})[_0xf6fa('0x29')](function(_0x4513b9){if(_0x13ffdf){if(_0x4513b9){_0x4e3a15=_0x4513b9;}}return require('../../config/license/util')[_0xf6fa('0x105')]();})[_0xf6fa('0x29')](function(_0x62fa41){if(_0x62fa41){_0x54e7eb=_0x62fa41[_0xf6fa('0x106')];_0x3b6a35=_0x62fa41[_0xf6fa('0x107')];}})[_0xf6fa('0x29')](function(){return db['ChatInteraction'][_0xf6fa('0x27')]({'where':{'closed':![]}});})[_0xf6fa('0x29')](function(_0x570021){_0x2157d9=_0x570021;if(_0x54e7eb&&_0x570021>_0x54e7eb){return db[_0xf6fa('0x108')][_0xf6fa('0x82')]({'where':{'id':0x1}})[_0xf6fa('0x29')](function(_0x415573){if(_0x415573){_0x415573[_0xf6fa('0x109')](_0xf6fa('0x10a'));}});}})[_0xf6fa('0x29')](function(){if(!_0x13ffdf['Interval']||!_0x13ffdf[_0xf6fa('0x3d')][_0xf6fa('0x3e')])return!![];return checkWebsiteIntervals(_0x13ffdf);})['then'](function(_0xe38587){var _0x25c351=fs[_0xf6fa('0xde')](path[_0xf6fa('0x8f')](config[_0xf6fa('0x90')],_0xf6fa('0x10b')),_0xf6fa('0xe0'));var _0x251af8=new url[(_0xf6fa('0x10c'))](_0x13ffdf[_0xf6fa('0x10d')])['origin'];var _0x2e9133='3.5.0';var _0x2d7257=![];var _0xc54a68={'chatVersion':_0x2e9133,'chatWebsiteAddressOrigin':_0x251af8,'remote':_0x13ffdf[_0xf6fa('0x10e')],'query':querystring['stringify'](_['merge'](_0x13ffdf[_0xf6fa('0x3f')]({'plain':!![]}),{'customerIp':_0x58672b[_0xf6fa('0xba')][_0xf6fa('0x44')]||_0x58672b[_0xf6fa('0xba')][_0xf6fa('0x10f')]||_0x58672b[_0xf6fa('0x110')][_0xf6fa('0x111')]||_0x58672b['ip'],'referer':_0x58672b['headers'][_0xf6fa('0x112')],'openedInteractions':_0x2157d9,'maxInteractions':_0x54e7eb,'virtual':_0x3b6a35[_0xf6fa('0x106')],'online':_0xe38587,'custom':_0x3b6a35}))['replace'](/'/g,'\x5c\x27')};_0x5c3ced[_0xf6fa('0xd7')](ejs[_0xf6fa('0xe1')](Mustache[_0xf6fa('0xe1')](_0x25c351,_0xc54a68),{'proactiveActions':_0x4e3a15,'alignment':_0x13ffdf[_0xf6fa('0x113')],'verticalAlignment':_0x13ffdf[_0xf6fa('0x114')],'div_color':_0x13ffdf[_0xf6fa('0x102')],'labelText':_0x13ffdf[_0xf6fa('0x115')],'text_color':_0x13ffdf['textColor'],'text_button_color':_0x13ffdf[_0xf6fa('0x116')],'button_color':_0x13ffdf[_0xf6fa('0x117')],'background_color':_0x13ffdf[_0xf6fa('0x118')],'hideWhenOffline':_0x13ffdf[_0xf6fa('0x119')],'intervalId':_0x13ffdf['IntervalId'],'isDevelopment':_0x2d7257,'chatVersion':_0x2e9133}));})[_0xf6fa('0x20')](handleError(_0x5c3ced,null));};exports[_0xf6fa('0x11a')]=function(_0x1c95bd,_0x1da0dd){var _0x3d3164=_0x1c95bd[_0xf6fa('0x76')]['id'];var _0xf670ce=_0x1c95bd['body'];var _0x5b9650=0xc8;var _0x3165c5=null;return db['sequelize'][_0xf6fa('0x11b')]({'isolationLevel':db[_0xf6fa('0xea')]['Transaction']['ISOLATION_LEVELS'][_0xf6fa('0x11c')]},function(_0x38e825){return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x3d3164},'transaction':_0x38e825})[_0xf6fa('0x29')](function(_0x5793fc){if(_0x5793fc){return db[_0xf6fa('0xb0')]['destroy']({'where':{'ChatWebsiteId':_0x3d3164},'transaction':_0x38e825})[_0xf6fa('0x29')](function(){var _0x15678e=_[_0xf6fa('0x3c')](_0xf670ce,function(_0x3ddb28){_0x3ddb28[_0xf6fa('0x79')]=_0x3d3164;return _0x3ddb28;});return db['ChatApplication'][_0xf6fa('0x11d')](_0x15678e,{'transaction':_0x38e825});});}else{_0x5b9650=0x194;_0x3165c5=[];}});})[_0xf6fa('0x29')](function(){if(_0x5b9650!==0x194){return db[_0xf6fa('0xb0')][_0xf6fa('0x11e')]({'where':{'ChatWebsiteId':_0x3d3164},'order':_0xf6fa('0xb8')})[_0xf6fa('0x29')](function(_0xa6fc8e){_0x3165c5=_0xa6fc8e;});}})[_0xf6fa('0x20')](function(_0x34ea82){_0x5b9650=0x1f4;logger['error'](_0x34ea82['stack']);if(_0x34ea82[_0xf6fa('0x2f')]){delete _0x34ea82[_0xf6fa('0x2f')];}_0x3165c5=_0x34ea82;})[_0xf6fa('0x11f')](function(){if(_0x3165c5===null){_0x1da0dd[_0xf6fa('0x2d')](_0x5b9650);}else{if(_0x5b9650===0x1f4){_0x1da0dd[_0xf6fa('0x21')](_0x5b9650)[_0xf6fa('0xd7')](_0x3165c5);}else{_0x1da0dd['status'](_0x5b9650)['json'](_0x3165c5);}}});};exports['getApplications']=function(_0x41bac2,_0x49ae11){var _0x42ffbd={};var _0xed1cb5={};var _0x4f3da0;var _0x51243c;return db[_0xf6fa('0x54')]['findOne']({'where':{'id':_0x41bac2['params']['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x49ae11,null))[_0xf6fa('0x29')](function(_0xcf8bff){if(_0xcf8bff){_0x4f3da0=_0xcf8bff;_0xed1cb5[_0xf6fa('0x5a')]=_['keys'](db['ChatApplication'][_0xf6fa('0x55')]);_0xed1cb5[_0xf6fa('0x57')]=_['keys'](_0x41bac2[_0xf6fa('0x57')]);_0xed1cb5['filters']=_[_0xf6fa('0x5b')](_0xed1cb5[_0xf6fa('0x5a')],_0xed1cb5[_0xf6fa('0x57')]);_0x42ffbd[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0xed1cb5[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x41bac2[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x42ffbd['attributes']=_0x42ffbd[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x42ffbd['attributes']:_0xed1cb5[_0xf6fa('0x5a')];_0x42ffbd[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x41bac2['query'][_0xf6fa('0x62')]);_0x42ffbd[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x41bac2[_0xf6fa('0x57')],_0xed1cb5[_0xf6fa('0x59')]));if(_0x41bac2[_0xf6fa('0x57')][_0xf6fa('0x65')]){_0x42ffbd[_0xf6fa('0x63')]=_[_0xf6fa('0x6b')](_0x42ffbd['where'],{'$or':_['map'](_0x42ffbd[_0xf6fa('0x5d')],function(_0x20c307){var _0x1dd4ad={};_0x1dd4ad[_0x20c307]={'$like':'%'+_0x41bac2[_0xf6fa('0x57')][_0xf6fa('0x65')]+'%'};return _0x1dd4ad;})});}_0x42ffbd=_['merge']({},_0x42ffbd,_0x41bac2[_0xf6fa('0x66')]);return _0x4f3da0[_0xf6fa('0x120')](_0x42ffbd);}})[_0xf6fa('0x29')](function(_0x28841d){if(_0x28841d){_0x51243c=_0x28841d[_0xf6fa('0x5e')];if(!_0x41bac2[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0x42ffbd[_0xf6fa('0x26')]=qs['limit'](_0x41bac2[_0xf6fa('0x57')]['limit']);_0x42ffbd[_0xf6fa('0x24')]=qs['offset'](_0x41bac2[_0xf6fa('0x57')]['offset']);}return _0x4f3da0[_0xf6fa('0x120')](_0x42ffbd);}})[_0xf6fa('0x29')](function(_0x326519){if(_0x326519){return _0x326519?{'count':_0x51243c,'rows':_0x326519}:null;}})[_0xf6fa('0x29')](respondWithResult(_0x49ae11,null))[_0xf6fa('0x20')](handleError(_0x49ae11,null));};exports[_0xf6fa('0x121')]=function(_0x3954b4,_0x36274e){return db[_0xf6fa('0x122')]['find']({'where':{'id':_0x3954b4['params']['id']}})['then'](handleEntityNotFound(_0x36274e,null))[_0xf6fa('0x29')](function(_0x4072ae){if(_0x4072ae){return _0x4072ae[_0xf6fa('0x121')](_0x3954b4[_0xf6fa('0x75')][_0xf6fa('0x7e')],_[_0xf6fa('0xfb')](_0x3954b4['body'],[_0xf6fa('0x7e'),'id'])||{});}})[_0xf6fa('0x29')](respondWithResult(_0x36274e,null))[_0xf6fa('0x20')](handleError(_0x36274e,null));};exports[_0xf6fa('0x104')]=function(_0x2791e8,_0x56d874){var _0x3f4d0e={};var _0x22f68e={};var _0x40fe0e;var _0x128a26;return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x2791e8[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x56d874,null))[_0xf6fa('0x29')](function(_0x45808f){if(_0x45808f){_0x40fe0e=_0x45808f;_0x22f68e[_0xf6fa('0x5a')]=_[_0xf6fa('0x58')](db[_0xf6fa('0x123')][_0xf6fa('0x55')]);_0x22f68e['query']=_['keys'](_0x2791e8['query']);_0x22f68e['filters']=_[_0xf6fa('0x5b')](_0x22f68e['model'],_0x22f68e['query']);_0x3f4d0e['attributes']=_[_0xf6fa('0x5b')](_0x22f68e[_0xf6fa('0x5a')],qs[_0xf6fa('0x5c')](_0x2791e8[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x3f4d0e[_0xf6fa('0x5d')]=_0x3f4d0e['attributes']['length']?_0x3f4d0e['attributes']:_0x22f68e[_0xf6fa('0x5a')];_0x3f4d0e[_0xf6fa('0x61')]=qs[_0xf6fa('0x62')](_0x2791e8[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x3f4d0e[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x2791e8[_0xf6fa('0x57')],_0x22f68e[_0xf6fa('0x59')]));if(_0x2791e8[_0xf6fa('0x57')]['filter']){_0x3f4d0e[_0xf6fa('0x63')]=_[_0xf6fa('0x6b')](_0x3f4d0e[_0xf6fa('0x63')],{'$or':_['map'](_0x3f4d0e[_0xf6fa('0x5d')],function(_0x288a47){var _0x1e29ff={};_0x1e29ff[_0x288a47]={'$like':'%'+_0x2791e8[_0xf6fa('0x57')][_0xf6fa('0x65')]+'%'};return _0x1e29ff;})});}_0x3f4d0e=_[_0xf6fa('0x6b')]({},_0x3f4d0e,_0x2791e8['options']);return _0x40fe0e['getProactiveActions'](_0x3f4d0e);}})[_0xf6fa('0x29')](function(_0x5406b4){if(_0x5406b4){_0x128a26=_0x5406b4[_0xf6fa('0x5e')];if(!_0x2791e8[_0xf6fa('0x57')]['hasOwnProperty'](_0xf6fa('0x60'))){_0x3f4d0e[_0xf6fa('0x26')]=qs['limit'](_0x2791e8['query'][_0xf6fa('0x26')]);_0x3f4d0e[_0xf6fa('0x24')]=qs[_0xf6fa('0x24')](_0x2791e8[_0xf6fa('0x57')][_0xf6fa('0x24')]);}return _0x40fe0e[_0xf6fa('0x104')](_0x3f4d0e);}})[_0xf6fa('0x29')](function(_0x4b4a9c){if(_0x4b4a9c){return _0x4b4a9c?{'count':_0x128a26,'rows':_0x4b4a9c}:null;}})['then'](respondWithResult(_0x56d874,null))['catch'](handleError(_0x56d874,null));};exports[_0xf6fa('0x124')]=function(_0x31d32f,_0x1c5912){var _0x286211=_0x31d32f['query'][_0xf6fa('0x125')]===_0xf6fa('0x126')?_0xf6fa('0x127'):_0xf6fa('0x128');return db['ChatWebsite']['find']({'attributes':['id',_0x286211],'where':{'id':_0x31d32f[_0xf6fa('0x76')]['id']}})['then'](handleEntityNotFound(_0x1c5912,null))['then'](function(_0x38d15d){if(_0x38d15d){var _0x142684=_0x38d15d[_0x286211];var _0x46952a=_0x142684&&_0x142684[_0xf6fa('0x129')]?_0x142684[_0xf6fa('0x129')]:[];_0x1c5912[_0xf6fa('0xd7')]({'fromKey':_[_0xf6fa('0x93')](_0x142684['fromKey'])?undefined:_0x142684[_0xf6fa('0x12a')],'count':_0x46952a[_0xf6fa('0x5e')],'rows':_0x46952a});}})[_0xf6fa('0x20')](handleError(_0x1c5912,null));};exports[_0xf6fa('0x12b')]=function(_0x559ea9,_0x298b12){var _0x2479f1={'raw':![],'where':{}};var _0x2c4660={};var _0x40bd18={'count':0x0,'rows':[]};return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0x559ea9['params']['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x298b12,null))[_0xf6fa('0x29')](function(_0x49ad42){if(_0x49ad42){_0x2c4660['model']=_[_0xf6fa('0x58')](db[_0xf6fa('0xe4')]['rawAttributes']);_0x2c4660['query']=_[_0xf6fa('0x58')](_0x559ea9[_0xf6fa('0x57')]);_0x2c4660[_0xf6fa('0x59')]=_[_0xf6fa('0x5b')](_0x2c4660[_0xf6fa('0x5a')],_0x2c4660['query']);_0x2479f1[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0x2c4660['model'],qs['fields'](_0x559ea9['query']['fields']));_0x2479f1[_0xf6fa('0x5d')]=_0x2479f1[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x2479f1[_0xf6fa('0x5d')]:_0x2c4660[_0xf6fa('0x5a')];if(!_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0x2479f1[_0xf6fa('0x26')]=qs[_0xf6fa('0x26')](_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x26')]);_0x2479f1[_0xf6fa('0x24')]=qs[_0xf6fa('0x24')](_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x24')]);}_0x2479f1[_0xf6fa('0x61')]=qs['sort'](_0x559ea9['query']['sort']);_0x2479f1[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0x559ea9['query'],_0x2c4660[_0xf6fa('0x59')]));_0x2479f1[_0xf6fa('0x63')][_0xf6fa('0x79')]=_0x49ad42['id'];if(_0x559ea9['query'][_0xf6fa('0x65')]){_0x2479f1['where']=_[_0xf6fa('0x6b')](_0x2479f1[_0xf6fa('0x63')],{'$or':_[_0xf6fa('0x3c')](_0x2479f1[_0xf6fa('0x5d')],function(_0x572f5a){var _0x151c95={};_0x151c95[_0x572f5a]={'$like':'%'+_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x65')]+'%'};return _0x151c95;})});}_0x2479f1=_[_0xf6fa('0x6b')]({},_0x2479f1,_0x559ea9[_0xf6fa('0x66')]);return db[_0xf6fa('0xe4')][_0xf6fa('0x27')]({'where':_0x2479f1[_0xf6fa('0x63')]})['then'](function(_0x5a814a){_0x40bd18[_0xf6fa('0x27')]=_0x5a814a;if(_0x559ea9[_0xf6fa('0x57')][_0xf6fa('0x67')]){_0x2479f1[_0xf6fa('0x68')]=[{'all':!![]}];}else{_0x2479f1['include']=[{'model':db['CmContact'],'as':_0xf6fa('0xfd'),'required':![]},{'model':db[_0xf6fa('0xeb')],'as':_0xf6fa('0x12c'),'required':![]}];}return db[_0xf6fa('0xe4')][_0xf6fa('0x7c')](_0x2479f1);})[_0xf6fa('0x29')](function(_0x269312){_0x40bd18[_0xf6fa('0x69')]=_0x269312;return _0x40bd18;});}})[_0xf6fa('0x29')](respondWithFilteredResult(_0x298b12,_0x2479f1))['catch'](handleError(_0x298b12,null));};exports['addAgents']=function(_0x221a9e,_0x27c7ba){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0x221a9e['params']['id']}})['then'](handleEntityNotFound(_0x27c7ba,null))['then'](function(_0x5e9be4){if(_0x5e9be4){return _0x5e9be4[_0xf6fa('0x12d')](_0x221a9e[_0xf6fa('0x75')][_0xf6fa('0x7e')],_[_0xf6fa('0xfb')](_0x221a9e[_0xf6fa('0x75')],[_0xf6fa('0x7e'),'id'])||{})[_0xf6fa('0xb2')](function(_0x155020){for(var _0x2ad125=0x0;_0x2ad125<_0x221a9e[_0xf6fa('0x75')][_0xf6fa('0x7e')][_0xf6fa('0x5e')];_0x2ad125+=0x1){socket[_0xf6fa('0x12e')]('userChatWebsite:save',{'UserId':Number(_0x221a9e['body'][_0xf6fa('0x7e')][_0x2ad125]),'ChatWebsiteId':Number(_0x221a9e[_0xf6fa('0x76')]['id'])});}return _0x155020;});}})[_0xf6fa('0x29')](respondWithResult(_0x27c7ba,null))[_0xf6fa('0x20')](handleError(_0x27c7ba,null));};exports[_0xf6fa('0x12f')]=function(_0xa2cd80,_0xbd9c73){return db[_0xf6fa('0x54')][_0xf6fa('0x71')]({'where':{'id':_0xa2cd80[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0xbd9c73,null))['then'](function(_0x552b6c){if(_0x552b6c){return _0x552b6c[_0xf6fa('0x12f')](_0xa2cd80[_0xf6fa('0x57')][_0xf6fa('0x7e')])['then'](function(){if(_[_0xf6fa('0x130')](_0xa2cd80['query'][_0xf6fa('0x7e')])){for(var _0x1288de=0x0;_0x1288de<_0xa2cd80['query'][_0xf6fa('0x7e')][_0xf6fa('0x5e')];_0x1288de+=0x1){socket[_0xf6fa('0x12e')]('userChatWebsite:remove',{'UserId':Number(_0xa2cd80[_0xf6fa('0x57')][_0xf6fa('0x7e')][_0x1288de]),'ChatWebsiteId':Number(_0xa2cd80[_0xf6fa('0x76')]['id'])});}}else{socket['emit'](_0xf6fa('0x131'),{'UserId':Number(_0xa2cd80['query'][_0xf6fa('0x7e')]),'ChatWebsiteId':Number(_0xa2cd80['params']['id'])});}});}})['then'](respondWithStatusCode(_0xbd9c73,null))['catch'](handleError(_0xbd9c73,null));};exports['getAgents']=function(_0xaff431,_0x39097b){var _0x4cc1d6={};var _0x12cb49={};var _0x55a7bd;var _0x3eab18;return db[_0xf6fa('0x54')][_0xf6fa('0x82')]({'where':{'id':_0xaff431[_0xf6fa('0x76')]['id']}})[_0xf6fa('0x29')](handleEntityNotFound(_0x39097b,null))[_0xf6fa('0x29')](function(_0x149ffa){if(_0x149ffa){_0x55a7bd=_0x149ffa;_0x12cb49[_0xf6fa('0x5a')]=_[_0xf6fa('0x58')](db['User'][_0xf6fa('0x55')]);_0x12cb49[_0xf6fa('0x57')]=_['keys'](_0xaff431[_0xf6fa('0x57')]);_0x12cb49[_0xf6fa('0x59')]=_['intersection'](_0x12cb49['model'],_0x12cb49[_0xf6fa('0x57')]);_0x4cc1d6[_0xf6fa('0x5d')]=_[_0xf6fa('0x5b')](_0x12cb49['model'],qs[_0xf6fa('0x5c')](_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x5c')]));_0x4cc1d6[_0xf6fa('0x5d')]=_0x4cc1d6[_0xf6fa('0x5d')][_0xf6fa('0x5e')]?_0x4cc1d6[_0xf6fa('0x5d')]:_0x12cb49[_0xf6fa('0x5a')];_0x4cc1d6[_0xf6fa('0x61')]=qs['sort'](_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x62')]);_0x4cc1d6[_0xf6fa('0x63')]=qs[_0xf6fa('0x59')](_[_0xf6fa('0x64')](_0xaff431[_0xf6fa('0x57')],_0x12cb49[_0xf6fa('0x59')]));if(_0xaff431['query']['filter']){_0x4cc1d6['where']=_[_0xf6fa('0x6b')](_0x4cc1d6[_0xf6fa('0x63')],{'$or':_['map'](_0x4cc1d6[_0xf6fa('0x5d')],function(_0x55a5e3){var _0x1f4936={};_0x1f4936[_0x55a5e3]={'$like':'%'+_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x65')]+'%'};return _0x1f4936;})});}_0x4cc1d6=_['merge']({},_0x4cc1d6,_0xaff431[_0xf6fa('0x66')]);return _0x55a7bd['getAgents'](_0x4cc1d6);}})['then'](function(_0x14fa2a){if(_0x14fa2a){_0x3eab18=_0x14fa2a[_0xf6fa('0x5e')];if(!_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x5f')](_0xf6fa('0x60'))){_0x4cc1d6[_0xf6fa('0x26')]=qs[_0xf6fa('0x26')](_0xaff431['query']['limit']);_0x4cc1d6[_0xf6fa('0x24')]=qs[_0xf6fa('0x24')](_0xaff431[_0xf6fa('0x57')][_0xf6fa('0x24')]);}return _0x55a7bd[_0xf6fa('0x132')](_0x4cc1d6);}})[_0xf6fa('0x29')](function(_0x16a861){if(_0x16a861){return _0x16a861?{'count':_0x3eab18,'rows':_0x16a861}:null;}})[_0xf6fa('0x29')](respondWithResult(_0x39097b,null))[_0xf6fa('0x20')](handleError(_0x39097b,null));};
\ No newline at end of file
index 0672708..035b5fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcabc=['hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit'];(function(_0x53c01b,_0x59efb1){var _0x5611f5=function(_0x81518f){while(--_0x81518f){_0x53c01b['push'](_0x53c01b['shift']());}};_0x5611f5(++_0x59efb1);}(_0xcabc,0x16a));var _0xccab=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xcabc[_0x40a045];return _0x1a687c;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xccab('0x0'))['db'][_0xccab('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xccab('0x2')](0x0);var events={'afterCreate':_0xccab('0x3'),'afterUpdate':_0xccab('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b1e99){return function(_0x38a3af,_0x59a105,_0x391c81){ChatWebsiteEvents[_0xccab('0x5')](_0x2b1e99+':'+_0x38a3af['id'],_0x38a3af);ChatWebsiteEvents[_0xccab('0x5')](_0x2b1e99,_0x38a3af);_0x391c81(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xccab('0x6')](e,emitEvent(event));}}module[_0xccab('0x7')]=ChatWebsiteEvents;
\ No newline at end of file
+var _0x684d=['exports','../../mysqldb','ChatWebsite','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x47e86f,_0xcec17e){var _0xc749bb=function(_0x57bf84){while(--_0x57bf84){_0x47e86f['push'](_0x47e86f['shift']());}};_0xc749bb(++_0xcec17e);}(_0x684d,0x174));var _0xd684=function(_0x55ef86,_0x22479e){_0x55ef86=_0x55ef86-0x0;var _0x206965=_0x684d[_0x55ef86];return _0x206965;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xd684('0x0'))['db'][_0xd684('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd684('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd684('0x3'),'afterDestroy':'remove'};function emitEvent(_0x20d7ea){return function(_0x1d505b,_0x654972,_0x51ac07){ChatWebsiteEvents[_0xd684('0x4')](_0x20d7ea+':'+_0x1d505b['id'],_0x1d505b);ChatWebsiteEvents['emit'](_0x20d7ea,_0x1d505b);_0x51ac07(null);};}for(var e in events){if(events[_0xd684('0x5')](e)){var event=events[e];ChatWebsite['hook'](e,emitEvent(event));}}module[_0xd684('0x6')]=ChatWebsiteEvents;
\ No newline at end of file
index f152f60..17b93b7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa323=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ChatWebsite'];(function(_0x6ab649,_0x3b471e){var _0x371bd9=function(_0x3e6368){while(--_0x3e6368){_0x6ab649['push'](_0x6ab649['shift']());}};_0x371bd9(++_0x3b471e);}(_0xa323,0xe4));var _0x3a32=function(_0x5795f5,_0xa4aa64){_0x5795f5=_0x5795f5-0x0;var _0x3c6736=_0xa323[_0x5795f5];return _0x3c6736;};'use strict';var _=require(_0x3a32('0x0'));var util=require(_0x3a32('0x1'));var logger=require(_0x3a32('0x2'))(_0x3a32('0x3'));var moment=require(_0x3a32('0x4'));var BPromise=require(_0x3a32('0x5'));var rp=require(_0x3a32('0x6'));var fs=require('fs');var path=require(_0x3a32('0x7'));var rimraf=require(_0x3a32('0x8'));var config=require(_0x3a32('0x9'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x423909,_0x23ef23){return _0x423909[_0x3a32('0xa')](_0x3a32('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5183=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatWebsite','chat_websites','lodash','../../config/logger'];(function(_0x32f0e2,_0x230534){var _0x1038b6=function(_0x3ef3a6){while(--_0x3ef3a6){_0x32f0e2['push'](_0x32f0e2['shift']());}};_0x1038b6(++_0x230534);}(_0x5183,0xfb));var _0x3518=function(_0x2a5303,_0x5b85fc){_0x2a5303=_0x2a5303-0x0;var _0x218496=_0x5183[_0x2a5303];return _0x218496;};'use strict';var _=require(_0x3518('0x0'));var util=require('util');var logger=require(_0x3518('0x1'))(_0x3518('0x2'));var moment=require(_0x3518('0x3'));var BPromise=require(_0x3518('0x4'));var rp=require(_0x3518('0x5'));var fs=require('fs');var path=require(_0x3518('0x6'));var rimraf=require(_0x3518('0x7'));var config=require(_0x3518('0x8'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x31c90d,_0x18e66e){return _0x31c90d['define'](_0x3518('0x9'),attributes,{'tableName':_0x3518('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3b05c2c..f161d7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x020e=['../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./chatWebsite.socket','register','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x272da9,_0x5421a8){var _0x9d7a19=function(_0x45f847){while(--_0x45f847){_0x272da9['push'](_0x272da9['shift']());}};_0x9d7a19(++_0x5421a8);}(_0x020e,0x68));var _0xe020=function(_0xf3e4d6,_0x55f90c){_0xf3e4d6=_0xf3e4d6-0x0;var _0x3951a2=_0x020e[_0xf3e4d6];return _0x3951a2;};'use strict';var _=require(_0xe020('0x0'));var util=require(_0xe020('0x1'));var moment=require(_0xe020('0x2'));var BPromise=require('bluebird');var rs=require(_0xe020('0x3'));var fs=require('fs');var Redis=require(_0xe020('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe020('0x5'));var logger=require(_0xe020('0x6'))(_0xe020('0x7'));var config=require(_0xe020('0x8'));var jayson=require(_0xe020('0x9'));var client=jayson[_0xe020('0xa')][_0xe020('0xb')]({'port':0x232a});config[_0xe020('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe020('0xd'))(new Redis(config[_0xe020('0xc')]));require(_0xe020('0xe'))[_0xe020('0xf')](socket);function respondWithRpcPromise(_0x5247b0,_0x3779e3,_0x220576){return new BPromise(function(_0x43f6a5,_0x3cf2a1){return client['request'](_0x5247b0,_0x220576)[_0xe020('0x10')](function(_0x4915ba){logger[_0xe020('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x3779e3,_0xe020('0x12'));logger[_0xe020('0x13')](_0xe020('0x14'),_0x3779e3,_0xe020('0x12'),JSON[_0xe020('0x15')](_0x4915ba));if(_0x4915ba[_0xe020('0x16')]){if(_0x4915ba[_0xe020('0x16')][_0xe020('0x17')]===0x1f4){logger[_0xe020('0x16')](_0xe020('0x18'),_0x3779e3,_0x4915ba[_0xe020('0x16')][_0xe020('0x19')]);return _0x3cf2a1(_0x4915ba[_0xe020('0x16')]['message']);}logger[_0xe020('0x16')](_0xe020('0x18'),_0x3779e3,_0x4915ba['error']['message']);return _0x43f6a5(_0x4915ba[_0xe020('0x16')][_0xe020('0x19')]);}else{logger[_0xe020('0x11')](_0xe020('0x18'),_0x3779e3,'request\x20sent');_0x43f6a5(_0x4915ba[_0xe020('0x1a')]['message']);}})[_0xe020('0x1b')](function(_0x38bbe4){logger[_0xe020('0x16')](_0xe020('0x18'),_0x3779e3,_0x38bbe4);_0x3cf2a1(_0x38bbe4);});});}
\ No newline at end of file
+var _0x10a7=['./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x10a7,0x1b3));var _0x710a=function(_0x2abeaf,_0x1071c8){_0x2abeaf=_0x2abeaf-0x0;var _0x503043=_0x10a7[_0x2abeaf];return _0x503043;};'use strict';var _=require(_0x710a('0x0'));var util=require(_0x710a('0x1'));var moment=require(_0x710a('0x2'));var BPromise=require(_0x710a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x710a('0x4'));var db=require(_0x710a('0x5'))['db'];var utils=require(_0x710a('0x6'));var logger=require(_0x710a('0x7'))(_0x710a('0x8'));var config=require(_0x710a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x710a('0xa')]['http']({'port':0x232a});config[_0x710a('0xb')]=_[_0x710a('0xc')](config[_0x710a('0xb')],{'host':_0x710a('0xd'),'port':0x18eb});var socket=require(_0x710a('0xe'))(new Redis(config[_0x710a('0xb')]));require(_0x710a('0xf'))[_0x710a('0x10')](socket);function respondWithRpcPromise(_0x417dcc,_0x4c34e5,_0x47926f){return new BPromise(function(_0x5487b6,_0x4fcd7c){return client[_0x710a('0x11')](_0x417dcc,_0x47926f)[_0x710a('0x12')](function(_0x4bf4a7){logger[_0x710a('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x4c34e5,_0x710a('0x14'));logger[_0x710a('0x15')](_0x710a('0x16'),_0x4c34e5,_0x710a('0x14'),JSON[_0x710a('0x17')](_0x4bf4a7));if(_0x4bf4a7[_0x710a('0x18')]){if(_0x4bf4a7[_0x710a('0x18')][_0x710a('0x19')]===0x1f4){logger[_0x710a('0x18')](_0x710a('0x1a'),_0x4c34e5,_0x4bf4a7[_0x710a('0x18')][_0x710a('0x1b')]);return _0x4fcd7c(_0x4bf4a7[_0x710a('0x18')][_0x710a('0x1b')]);}logger['error'](_0x710a('0x1a'),_0x4c34e5,_0x4bf4a7['error'][_0x710a('0x1b')]);return _0x5487b6(_0x4bf4a7['error'][_0x710a('0x1b')]);}else{logger[_0x710a('0x13')]('ChatWebsite,\x20%s,\x20%s',_0x4c34e5,_0x710a('0x14'));_0x5487b6(_0x4bf4a7[_0x710a('0x1c')][_0x710a('0x1b')]);}})[_0x710a('0x1d')](function(_0x48cd32){logger[_0x710a('0x18')](_0x710a('0x1a'),_0x4c34e5,_0x48cd32);_0x4fcd7c(_0x48cd32);});});}
\ No newline at end of file
index 66277cc..d274e21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bdb=['remove','update','emit','removeListener','register','length','./chatWebsite.events','save'];(function(_0x65f16f,_0x3cca03){var _0x2b4f39=function(_0xb4a2e3){while(--_0xb4a2e3){_0x65f16f['push'](_0x65f16f['shift']());}};_0x2b4f39(++_0x3cca03);}(_0x2bdb,0x186));var _0xb2bd=function(_0x3bc6ee,_0x5ee4d8){_0x3bc6ee=_0x3bc6ee-0x0;var _0x369102=_0x2bdb[_0x3bc6ee];return _0x369102;};'use strict';var ChatWebsiteEvents=require(_0xb2bd('0x0'));var events=[_0xb2bd('0x1'),_0xb2bd('0x2'),_0xb2bd('0x3')];function createListener(_0x43d004,_0x520fdd){return function(_0x428e0d){_0x520fdd[_0xb2bd('0x4')](_0x43d004,_0x428e0d);};}function removeListener(_0x3366dd,_0x3ef793){return function(){ChatWebsiteEvents[_0xb2bd('0x5')](_0x3366dd,_0x3ef793);};}exports[_0xb2bd('0x6')]=function(_0x18757e){for(var _0x4d43d3=0x0,_0x559b65=events[_0xb2bd('0x7')];_0x4d43d3<_0x559b65;_0x4d43d3++){var _0x23e73a=events[_0x4d43d3];var _0x36dc4d=createListener('chatWebsite:'+_0x23e73a,_0x18757e);ChatWebsiteEvents['on'](_0x23e73a,_0x36dc4d);}};
\ No newline at end of file
+var _0x8c78=['chatWebsite:','save','remove','removeListener','register','length'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x8c78,0x103));var _0x88c7=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8c78[_0x126558];return _0x1f6d14;};'use strict';var ChatWebsiteEvents=require('./chatWebsite.events');var events=[_0x88c7('0x0'),_0x88c7('0x1'),'update'];function createListener(_0x22902c,_0x444e76){return function(_0x3c72a3){_0x444e76['emit'](_0x22902c,_0x3c72a3);};}function removeListener(_0x17fbe8,_0x1fe30d){return function(){ChatWebsiteEvents[_0x88c7('0x2')](_0x17fbe8,_0x1fe30d);};}exports[_0x88c7('0x3')]=function(_0x4ae3f){for(var _0x26c694=0x0,_0x1abce2=events[_0x88c7('0x4')];_0x26c694<_0x1abce2;_0x26c694++){var _0x351b8c=events[_0x26c694];var _0x1f8a50=createListener(_0x88c7('0x5')+_0x351b8c,_0x4ae3f);ChatWebsiteEvents['on'](_0x351b8c,_0x1f8a50);}};
\ No newline at end of file
index 6395321..bd8e218 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe928=['removeDispositions','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/logo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','/:id/interactions','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','post','create','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','now','originalname','join','server/files/images/avatars/','file','addAvatar','single','addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','extname','replace','/:id/offline','any','offline','addApplications','addProactiveActions','addAgents','put','destroy','delete'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0xe928,0x1ec));var _0x8e92=function(_0x474a72,_0x439f5a){_0x474a72=_0x474a72-0x0;var _0x304966=_0xe928[_0x474a72];return _0x304966;};'use strict';var multer=require(_0x8e92('0x0'));var util=require('util');var path=require(_0x8e92('0x1'));var timeout=require(_0x8e92('0x2'));var express=require(_0x8e92('0x3'));var router=express['Router']();var fs_extra=require(_0x8e92('0x4'));var auth=require(_0x8e92('0x5'));var interaction=require(_0x8e92('0x6'));var config=require(_0x8e92('0x7'));var controller=require(_0x8e92('0x8'));router[_0x8e92('0x9')]('/',auth[_0x8e92('0xa')](),controller[_0x8e92('0xb')]);router[_0x8e92('0x9')](_0x8e92('0xc'),auth[_0x8e92('0xa')](),controller[_0x8e92('0xd')]);router['get'](_0x8e92('0xe'),auth['isAuthenticated'](),controller[_0x8e92('0xf')]);router[_0x8e92('0x9')](_0x8e92('0x10'),auth['isAuthenticated'](),controller[_0x8e92('0x11')]);router['get'](_0x8e92('0x12'),auth[_0x8e92('0xa')](),controller['getAnswers']);router[_0x8e92('0x9')](_0x8e92('0x13'),controller['getLogo']);router['get'](_0x8e92('0x14'),controller['getAvatar']);router[_0x8e92('0x9')](_0x8e92('0x15'),controller[_0x8e92('0x16')]);router[_0x8e92('0x9')](_0x8e92('0x17'),controller['getSystemAvatar']);router[_0x8e92('0x9')](_0x8e92('0x18'),auth[_0x8e92('0xa')](),controller[_0x8e92('0x19')]);router[_0x8e92('0x9')]('/:id/snippet',controller[_0x8e92('0x1a')]);router[_0x8e92('0x9')](_0x8e92('0x1b'),auth[_0x8e92('0xa')](),controller['getApplications']);router[_0x8e92('0x9')](_0x8e92('0x1c'),auth['isAuthenticated'](),controller[_0x8e92('0x1d')]);router[_0x8e92('0x9')](_0x8e92('0x1e'),controller[_0x8e92('0x1f')]);router[_0x8e92('0x9')](_0x8e92('0x20'),auth[_0x8e92('0xa')](),controller[_0x8e92('0x21')]);router[_0x8e92('0x9')](_0x8e92('0x22'),auth[_0x8e92('0xa')](),controller['getAgents']);router[_0x8e92('0x23')]('/',auth['isAuthenticated'](),controller[_0x8e92('0x24')]);router[_0x8e92('0x23')](_0x8e92('0x10'),auth['isAuthenticated'](),controller[_0x8e92('0x25')]);router[_0x8e92('0x23')](_0x8e92('0x12'),auth[_0x8e92('0xa')](),controller[_0x8e92('0x26')]);var upload=multer({'storage':multer[_0x8e92('0x27')]({'destination':function(_0x29410b,_0x2917a4,_0x1d135a){_0x1d135a(null,path['join'](config[_0x8e92('0x28')],_0x8e92('0x29')));},'filename':function(_0x37dc06,_0x20df9a,_0x2c63e0){_0x2c63e0(null,util[_0x8e92('0x2a')](_0x8e92('0x2b'),Date[_0x8e92('0x2c')](),_0x20df9a[_0x8e92('0x2d')]));}})});router[_0x8e92('0x23')]('/:id/logo',upload['single']('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x8e92('0x27')]({'destination':function(_0x39497b,_0x12e08a,_0x1c1402){_0x1c1402(null,path[_0x8e92('0x2e')](config[_0x8e92('0x28')],_0x8e92('0x2f')));},'filename':function(_0x3905fe,_0x4265e8,_0x2019b5){_0x2019b5(null,util[_0x8e92('0x2a')]('%s-%s',Date[_0x8e92('0x2c')](),_0x4265e8['originalname']));}})});router[_0x8e92('0x23')]('/:id/avatar',upload['single'](_0x8e92('0x30')),controller[_0x8e92('0x31')]);var upload=multer({'storage':multer[_0x8e92('0x27')]({'destination':function(_0x1742fe,_0x1f7158,_0x5b80af){_0x5b80af(null,path[_0x8e92('0x2e')](config[_0x8e92('0x28')],'server/files/images/avatars/'));},'filename':function(_0x2efd3a,_0x3681a5,_0x5834a3){_0x5834a3(null,util[_0x8e92('0x2a')](_0x8e92('0x2b'),Date['now'](),_0x3681a5[_0x8e92('0x2d')]));}})});router[_0x8e92('0x23')](_0x8e92('0x15'),upload[_0x8e92('0x32')](_0x8e92('0x30')),controller[_0x8e92('0x33')]);var upload=multer({'storage':multer[_0x8e92('0x27')]({'destination':function(_0x7d1de0,_0xf545d1,_0x1e6dc4){_0x1e6dc4(null,path[_0x8e92('0x2e')](config[_0x8e92('0x28')],_0x8e92('0x2f')));},'filename':function(_0x6f8c7a,_0x483ca8,_0x1c2ffa){_0x1c2ffa(null,util[_0x8e92('0x2a')](_0x8e92('0x2b'),Date[_0x8e92('0x2c')](),_0x483ca8[_0x8e92('0x2d')]));}})});router['post'](_0x8e92('0x17'),upload['single']('file'),controller['addSystemAvatar']);router[_0x8e92('0x23')](_0x8e92('0x34'),controller[_0x8e92('0x35')]);const offlineUploadMulter=multer({'storage':multer[_0x8e92('0x27')]({'destination':function(_0x570fc9,_0x55f859,_0xd61ad6){const _0x737062=path[_0x8e92('0x2e')](config[_0x8e92('0x28')],_0x8e92('0x36'),'attachments',_0x8e92('0x37'));fs_extra[_0x8e92('0x38')](_0x737062,function(){_0xd61ad6(null,_0x737062);});},'filename':function(_0x3c28cf,_0x184ee3,_0x186332){const _0xff4505=_0x184ee3[_0x8e92('0x2d')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x24b43c=path[_0x8e92('0x39')](_0xff4505);const _0x245e8a=Date[_0x8e92('0x2c')]()+'-'+_0xff4505[_0x8e92('0x3a')](_0x24b43c,'')+_0x24b43c;_0x186332(null,_0x245e8a);}})});router[_0x8e92('0x23')](_0x8e92('0x3b'),offlineUploadMulter[_0x8e92('0x3c')](),controller[_0x8e92('0x3d')]);router[_0x8e92('0x23')](_0x8e92('0x18'),auth['isAuthenticated'](),controller['addInteraction']);router['post'](_0x8e92('0x1b'),auth[_0x8e92('0xa')](),controller[_0x8e92('0x3e')]);router['post'](_0x8e92('0x1c'),auth['isAuthenticated'](),controller[_0x8e92('0x3f')]);router['post'](_0x8e92('0x22'),auth['isAuthenticated'](),controller[_0x8e92('0x40')]);router[_0x8e92('0x41')](_0x8e92('0xe'),auth[_0x8e92('0xa')](),controller['update']);router['delete'](_0x8e92('0xe'),auth[_0x8e92('0xa')](),controller[_0x8e92('0x42')]);router[_0x8e92('0x43')](_0x8e92('0x10'),auth[_0x8e92('0xa')](),controller[_0x8e92('0x44')]);router[_0x8e92('0x43')]('/:id/canned_answers',auth[_0x8e92('0xa')](),controller['removeAnswers']);router[_0x8e92('0x43')](_0x8e92('0x22'),auth[_0x8e92('0xa')](),controller['removeAgents']);module[_0x8e92('0x45')]=router;
\ No newline at end of file
+var _0x8b34=['getSnippet','getApplications','/:id/fields','getFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','now','originalname','file','addLogo','join','server/files/images/avatars/','%s-%s','/:id/avatar','addAvatar','single','addCustomerAvatar','/:id/notify','notify','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/applications','/:id/proactive_actions','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','removeAnswers','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','isAuthenticated','get','/describe','describe','/:id','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet'];(function(_0x3d92f7,_0x39b899){var _0x509790=function(_0x5219ed){while(--_0x5219ed){_0x3d92f7['push'](_0x3d92f7['shift']());}};_0x509790(++_0x39b899);}(_0x8b34,0x1dd));var _0x48b3=function(_0x2af337,_0xf67452){_0x2af337=_0x2af337-0x0;var _0x122c54=_0x8b34[_0x2af337];return _0x122c54;};'use strict';var multer=require(_0x48b3('0x0'));var util=require(_0x48b3('0x1'));var path=require(_0x48b3('0x2'));var timeout=require(_0x48b3('0x3'));var express=require(_0x48b3('0x4'));var router=express[_0x48b3('0x5')]();var fs_extra=require(_0x48b3('0x6'));var auth=require(_0x48b3('0x7'));var interaction=require(_0x48b3('0x8'));var config=require(_0x48b3('0x9'));var controller=require(_0x48b3('0xa'));router['get']('/',auth[_0x48b3('0xb')](),controller['index']);router[_0x48b3('0xc')](_0x48b3('0xd'),auth[_0x48b3('0xb')](),controller[_0x48b3('0xe')]);router[_0x48b3('0xc')](_0x48b3('0xf'),auth[_0x48b3('0xb')](),controller['show']);router[_0x48b3('0xc')]('/:id/dispositions',auth[_0x48b3('0xb')](),controller['getDispositions']);router[_0x48b3('0xc')](_0x48b3('0x10'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x11')]);router[_0x48b3('0xc')](_0x48b3('0x12'),controller[_0x48b3('0x13')]);router[_0x48b3('0xc')]('/:id/avatar',controller['getAvatar']);router['get'](_0x48b3('0x14'),controller[_0x48b3('0x15')]);router[_0x48b3('0xc')](_0x48b3('0x16'),controller[_0x48b3('0x17')]);router['get'](_0x48b3('0x18'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x19')]);router['get'](_0x48b3('0x1a'),controller[_0x48b3('0x1b')]);router[_0x48b3('0xc')]('/:id/applications',auth[_0x48b3('0xb')](),controller[_0x48b3('0x1c')]);router['get']('/:id/proactive_actions',auth[_0x48b3('0xb')](),controller['getProactiveActions']);router[_0x48b3('0xc')](_0x48b3('0x1d'),controller[_0x48b3('0x1e')]);router['get']('/:id/offline_messages',auth[_0x48b3('0xb')](),controller['getOfflineMessages']);router[_0x48b3('0xc')](_0x48b3('0x1f'),auth['isAuthenticated'](),controller[_0x48b3('0x20')]);router[_0x48b3('0x21')]('/',auth[_0x48b3('0xb')](),controller[_0x48b3('0x22')]);router[_0x48b3('0x21')](_0x48b3('0x23'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x24')]);router[_0x48b3('0x21')]('/:id/canned_answers',auth[_0x48b3('0xb')](),controller[_0x48b3('0x25')]);var upload=multer({'storage':multer[_0x48b3('0x26')]({'destination':function(_0x718990,_0x806557,_0x35b943){_0x35b943(null,path['join'](config[_0x48b3('0x27')],_0x48b3('0x28')));},'filename':function(_0x592081,_0x5a9859,_0x4e5a95){_0x4e5a95(null,util[_0x48b3('0x29')]('%s-%s',Date[_0x48b3('0x2a')](),_0x5a9859[_0x48b3('0x2b')]));}})});router['post']('/:id/logo',upload['single'](_0x48b3('0x2c')),controller[_0x48b3('0x2d')]);var upload=multer({'storage':multer[_0x48b3('0x26')]({'destination':function(_0x54be8b,_0x2f2f52,_0x14783a){_0x14783a(null,path[_0x48b3('0x2e')](config[_0x48b3('0x27')],_0x48b3('0x2f')));},'filename':function(_0x173003,_0x39affb,_0x2b3469){_0x2b3469(null,util[_0x48b3('0x29')](_0x48b3('0x30'),Date['now'](),_0x39affb['originalname']));}})});router[_0x48b3('0x21')](_0x48b3('0x31'),upload['single'](_0x48b3('0x2c')),controller[_0x48b3('0x32')]);var upload=multer({'storage':multer[_0x48b3('0x26')]({'destination':function(_0x2b1c6c,_0x870b6b,_0x51d0c6){_0x51d0c6(null,path['join'](config[_0x48b3('0x27')],_0x48b3('0x2f')));},'filename':function(_0x413fae,_0xcb468,_0x38c9cb){_0x38c9cb(null,util[_0x48b3('0x29')](_0x48b3('0x30'),Date[_0x48b3('0x2a')](),_0xcb468[_0x48b3('0x2b')]));}})});router[_0x48b3('0x21')](_0x48b3('0x14'),upload[_0x48b3('0x33')]('file'),controller[_0x48b3('0x34')]);var upload=multer({'storage':multer[_0x48b3('0x26')]({'destination':function(_0x3a1c06,_0x57fbd8,_0x4f04dd){_0x4f04dd(null,path[_0x48b3('0x2e')](config[_0x48b3('0x27')],'server/files/images/avatars/'));},'filename':function(_0x1356ad,_0x4c21fc,_0x1e789b){_0x1e789b(null,util['format'](_0x48b3('0x30'),Date['now'](),_0x4c21fc[_0x48b3('0x2b')]));}})});router[_0x48b3('0x21')]('/:id/system_avatar',upload[_0x48b3('0x33')](_0x48b3('0x2c')),controller['addSystemAvatar']);router[_0x48b3('0x21')](_0x48b3('0x35'),controller[_0x48b3('0x36')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x546605,_0x1884ef,_0x407006){const _0x382d69=path['join'](config[_0x48b3('0x27')],'server/files',_0x48b3('0x37'),_0x48b3('0x38'));fs_extra[_0x48b3('0x39')](_0x382d69,function(){_0x407006(null,_0x382d69);});},'filename':function(_0x1990ed,_0x3c4c54,_0x3defb0){const _0x4fc26d=_0x3c4c54['originalname'][_0x48b3('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2f39d1=path[_0x48b3('0x3b')](_0x4fc26d);const _0x1be258=Date[_0x48b3('0x2a')]()+'-'+_0x4fc26d['replace'](_0x2f39d1,'')+_0x2f39d1;_0x3defb0(null,_0x1be258);}})});router[_0x48b3('0x21')](_0x48b3('0x3c'),offlineUploadMulter[_0x48b3('0x3d')](),controller[_0x48b3('0x3e')]);router['post'](_0x48b3('0x18'),auth[_0x48b3('0xb')](),controller['addInteraction']);router['post'](_0x48b3('0x3f'),auth[_0x48b3('0xb')](),controller['addApplications']);router[_0x48b3('0x21')](_0x48b3('0x40'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x41')]);router[_0x48b3('0x21')](_0x48b3('0x1f'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x42')]);router['put'](_0x48b3('0xf'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x43')]);router[_0x48b3('0x44')](_0x48b3('0xf'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x45')]);router[_0x48b3('0x44')](_0x48b3('0x23'),auth[_0x48b3('0xb')](),controller[_0x48b3('0x46')]);router[_0x48b3('0x44')](_0x48b3('0x10'),auth['isAuthenticated'](),controller[_0x48b3('0x47')]);router[_0x48b3('0x44')](_0x48b3('0x1f'),auth['isAuthenticated'](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
index a599216..d5b1750 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x03fc=['Router','env','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','exports','beaver-logger/server','../components/auth/service','../config/environment'];(function(_0x480b3f,_0x2121a6){var _0x48e6d7=function(_0x21c66b){while(--_0x21c66b){_0x480b3f['push'](_0x480b3f['shift']());}};_0x48e6d7(++_0x2121a6);}(_0x03fc,0x1b7));var _0xc03f=function(_0x434ec1,_0x16624f){_0x434ec1=_0x434ec1-0x0;var _0x2b6848=_0x03fc[_0x434ec1];return _0x2b6848;};var beaverLogger=require(_0xc03f('0x0'));var express=require('express');var auth=require(_0xc03f('0x1'));var config=require(_0xc03f('0x2'));var router=express[_0xc03f('0x3')]();var isProduction=config[_0xc03f('0x4')]==='production'||![];function clientSideLogs(_0x1f029c,_0x4d4594,_0x23bece){var _0x5d2792=_0x1f029c[_0xc03f('0x5')][_0xc03f('0x6')](_0xc03f('0x7'));if(!_0x5d2792){throw new Error(_0xc03f('0x8'));}return beaverLogger[_0xc03f('0x9')]({'uri':_0xc03f('0xa'),'logger':_0x5d2792,'enableCors':!isProduction})(_0x1f029c,_0x4d4594,_0x23bece);}router[_0xc03f('0xb')](auth['isAuthenticated'](),clientSideLogs);module[_0xc03f('0xc')]=router;
\ No newline at end of file
+var _0x5d24=['Router','env','production','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','isAuthenticated','beaver-logger/server','express','../components/auth/service'];(function(_0x5045e2,_0x32fe5a){var _0x1b5794=function(_0x2d9f4d){while(--_0x2d9f4d){_0x5045e2['push'](_0x5045e2['shift']());}};_0x1b5794(++_0x32fe5a);}(_0x5d24,0xc3));var _0x45d2=function(_0x3653a0,_0x378bef){_0x3653a0=_0x3653a0-0x0;var _0x2cca6a=_0x5d24[_0x3653a0];return _0x2cca6a;};var beaverLogger=require(_0x45d2('0x0'));var express=require(_0x45d2('0x1'));var auth=require(_0x45d2('0x2'));var config=require('../config/environment');var router=express[_0x45d2('0x3')]();var isProduction=config[_0x45d2('0x4')]===_0x45d2('0x5')||![];function clientSideLogs(_0x4e49e5,_0x1c7fbb,_0x19c8dc){var _0x5113e6=_0x4e49e5['app']['get'](_0x45d2('0x6'));if(!_0x5113e6){throw new Error(_0x45d2('0x7'));}return beaverLogger[_0x45d2('0x8')]({'uri':'/client-logs','logger':_0x5113e6,'enableCors':!isProduction})(_0x4e49e5,_0x1c7fbb,_0x19c8dc);}router[_0x45d2('0x9')](auth[_0x45d2('0xa')](),clientSideLogs);module['exports']=router;
\ No newline at end of file
index c65a7f7..9f60a3c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0498=['STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','Dynamics365'];(function(_0x399bd4,_0x3c84ab){var _0x12d41b=function(_0x2341dc){while(--_0x2341dc){_0x399bd4['push'](_0x399bd4['shift']());}};_0x12d41b(++_0x3c84ab);}(_0x0498,0xc8));var _0x8049=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x0498[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x8049('0x0'));module[_0x8049('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x8049('0x2')](_0x8049('0x3'),_0x8049('0x4'),_0x8049('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x8049('0x2')](_0x8049('0x6'),_0x8049('0x7'))},'data1':{'type':Sequelize[_0x8049('0x8')],'comment':_0x8049('0x9')},'data2':{'type':Sequelize[_0x8049('0x8')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x8049('0x8')],'comment':_0x8049('0xa')},'data4':{'type':Sequelize[_0x8049('0x8')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0x8049('0xb')],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x8049('0xb')],'comment':_0x8049('0xc')}};
\ No newline at end of file
+var _0x803c=['STRING','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','ENUM','Google','MicrosoftAzure','Outlook365'];(function(_0x40129c,_0x440255){var _0x2bd64e=function(_0x17639e){while(--_0x17639e){_0x40129c['push'](_0x40129c['shift']());}};_0x2bd64e(++_0x440255);}(_0x803c,0x1f2));var _0xc803=function(_0x228bf3,_0x4c4ad6){_0x228bf3=_0x228bf3-0x0;var _0x4798e1=_0x803c[_0x228bf3];return _0x4798e1;};'use strict';var Sequelize=require(_0xc803('0x0'));module[_0xc803('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc803('0x2')]('AmazonAWS',_0xc803('0x3'),_0xc803('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc803('0x2')](_0xc803('0x5'),'Dynamics365')},'data1':{'type':Sequelize[_0xc803('0x6')],'comment':_0xc803('0x7')},'data2':{'type':Sequelize[_0xc803('0x6')],'comment':_0xc803('0x8')},'data3':{'type':Sequelize[_0xc803('0x6')],'comment':_0xc803('0x9')},'data4':{'type':Sequelize[_0xc803('0x6')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xc803('0xa')],'comment':_0xc803('0xb')},'data6':{'type':Sequelize[_0xc803('0xa')],'comment':_0xc803('0xc')},'data7':{'type':Sequelize[_0xc803('0xa')],'comment':_0xc803('0xd')}};
\ No newline at end of file
index bf878bd..726e01a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3306=['set','update','destroy','then','stack','name','slice','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','length','includeAll','include','find','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','error','get','state','parse','base64','toString','ascii','isValidIdToken','del','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','send','message','lodash','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x5093a6,_0x4d26ba){var _0x5f4741=function(_0x24c25d){while(--_0x24c25d){_0x5093a6['push'](_0x5093a6['shift']());}};_0x5f4741(++_0x4d26ba);}(_0x3306,0x1b8));var _0x6330=function(_0x11d1f3,_0x51568e){_0x11d1f3=_0x11d1f3-0x0;var _0x15b9e0=_0x3306[_0x11d1f3];return _0x15b9e0;};'use strict';var _=require(_0x6330('0x0'));var Redis=require('ioredis');var qs=require(_0x6330('0x1'));var encryptor=require(_0x6330('0x2'));var config=require(_0x6330('0x3'));var logger=require(_0x6330('0x4'))(_0x6330('0x5'));var db=require(_0x6330('0x6'))['db'];var oauth=require(_0x6330('0x7'));config[_0x6330('0x8')]=_[_0x6330('0x9')](config['redis'],{'host':_0x6330('0xa'),'port':0x18eb});var socket=require(_0x6330('0xb'))(new Redis(config[_0x6330('0x8')]));var redis=new Redis(config[_0x6330('0x8')]);function respondWithStatusCode(_0x411cc0,_0x13d16a){_0x13d16a=_0x13d16a||0xcc;return function(_0x210b9a){if(_0x210b9a){return _0x411cc0[_0x6330('0xc')](_0x13d16a);}return _0x411cc0[_0x6330('0xd')](_0x13d16a)[_0x6330('0xe')]();};}function respondWithResult(_0xe7656b,_0x166aff){_0x166aff=_0x166aff||0xc8;return function(_0x290c42){if(_0x290c42){return _0xe7656b['status'](_0x166aff)[_0x6330('0xf')](_0x290c42);}};}function respondWithFilteredResult(_0x44cdb5,_0x299b50){return function(_0x2e8da4){if(_0x2e8da4){var _0xdf460a=typeof _0x299b50['offset']===_0x6330('0x10')&&typeof _0x299b50[_0x6330('0x11')]===_0x6330('0x10');var _0x16a124=_0x2e8da4[_0x6330('0x12')];var _0x339048=_0xdf460a?0x0:_0x299b50[_0x6330('0x13')];var _0x506da4=_0xdf460a?_0x2e8da4[_0x6330('0x12')]:_0x299b50[_0x6330('0x13')]+_0x299b50[_0x6330('0x11')];var _0x33ed31;if(_0x506da4>=_0x16a124){_0x506da4=_0x16a124;_0x33ed31=0xc8;}else{_0x33ed31=0xce;}_0x44cdb5['status'](_0x33ed31);return _0x44cdb5[_0x6330('0x14')]('Content-Range',_0x339048+'-'+_0x506da4+'/'+_0x16a124)['json'](_0x2e8da4);}return null;};}function saveUpdates(_0x73e8e1){return function(_0x2f207f){if(_0x2f207f){return _0x2f207f[_0x6330('0x15')](_0x73e8e1)['then'](function(_0x41ac04){return _0x41ac04;});}return null;};}function removeEntity(_0x303c45){return function(_0xe23b12){if(_0xe23b12){return _0xe23b12[_0x6330('0x16')]()[_0x6330('0x17')](function(){_0x303c45[_0x6330('0xd')](0xcc)[_0x6330('0xe')]();});}};}function handleEntityNotFound(_0x287a85){return function(_0x3a469b){if(!_0x3a469b){_0x287a85[_0x6330('0xc')](0x194);}return _0x3a469b;};}function handleError(_0x219b2b,_0x215d8d){_0x215d8d=_0x215d8d||0x1f4;return function(_0x29f247){logger['error'](_0x29f247[_0x6330('0x18')]);if(_0x29f247[_0x6330('0x19')]){delete _0x29f247[_0x6330('0x19')];}_0x219b2b[_0x6330('0xd')](_0x215d8d)['send'](_0x29f247);};}function maskClientSecret(_0x1476c9){return _['padEnd'](_0x1476c9[_0x6330('0x1a')](0x0,0x3),0x14,'*');}exports[_0x6330('0x1b')]=function(_0x3b5033,_0x667af8){var _0x304e9b={},_0x21ba80={},_0x23fc39={'count':0x0,'rows':[]};var _0x414327=_[_0x6330('0x1c')](db[_0x6330('0x1d')][_0x6330('0x1e')],function(_0x352537){return{'name':_0x352537[_0x6330('0x1f')],'type':_0x352537[_0x6330('0x20')][_0x6330('0x21')]};});_0x21ba80[_0x6330('0x22')]=_[_0x6330('0x1c')](_0x414327,_0x6330('0x19'));_0x21ba80[_0x6330('0x23')]=_['keys'](_0x3b5033[_0x6330('0x23')]);_0x21ba80[_0x6330('0x24')]=_[_0x6330('0x25')](_0x21ba80[_0x6330('0x22')],_0x21ba80['query']);_0x304e9b[_0x6330('0x26')]=_[_0x6330('0x25')](_0x21ba80[_0x6330('0x22')],qs[_0x6330('0x27')](_0x3b5033['query'][_0x6330('0x27')]));_0x304e9b['attributes']=_0x304e9b[_0x6330('0x26')]['length']?_0x304e9b[_0x6330('0x26')]:_0x21ba80[_0x6330('0x22')];if(!_0x3b5033[_0x6330('0x23')]['hasOwnProperty'](_0x6330('0x28'))){_0x304e9b[_0x6330('0x11')]=qs[_0x6330('0x11')](_0x3b5033['query'][_0x6330('0x11')]);_0x304e9b[_0x6330('0x13')]=qs[_0x6330('0x13')](_0x3b5033[_0x6330('0x23')][_0x6330('0x13')]);}_0x304e9b[_0x6330('0x29')]=qs[_0x6330('0x2a')](_0x3b5033[_0x6330('0x23')][_0x6330('0x2a')]);_0x304e9b[_0x6330('0x2b')]=qs['filters'](_[_0x6330('0x2c')](_0x3b5033[_0x6330('0x23')],_0x21ba80[_0x6330('0x24')]),_0x414327);if(_0x3b5033[_0x6330('0x23')][_0x6330('0x2d')]){_0x304e9b['where']=_[_0x6330('0x2e')](_0x304e9b['where'],{'$or':_['map'](_0x414327,function(_0x3da88c){if(_0x3da88c[_0x6330('0x20')]!==_0x6330('0x2f')){var _0x3714ac={};_0x3714ac[_0x3da88c[_0x6330('0x19')]]={'$like':'%'+_0x3b5033[_0x6330('0x23')][_0x6330('0x2d')]+'%'};return _0x3714ac;}})});}_0x304e9b=_[_0x6330('0x2e')]({},_0x304e9b,_0x3b5033[_0x6330('0x30')]);var _0xdfe6c8={'where':_0x304e9b[_0x6330('0x2b')]};return db[_0x6330('0x1d')][_0x6330('0x12')](_0xdfe6c8)[_0x6330('0x17')](function(_0x282b21){_0x23fc39[_0x6330('0x12')]=_0x282b21;if(_0x3b5033[_0x6330('0x23')]['includeAll']){_0x304e9b['include']=[{'all':!![]}];}return db[_0x6330('0x1d')]['findAll'](_0x304e9b);})[_0x6330('0x17')](function(_0x345661){_0x23fc39['rows']=_['map'](_0x345661,function(_0x16cd8f){if(_0x16cd8f[_0x6330('0x31')]===_0x6330('0x32')){var _0x723948=encryptor[_0x6330('0x33')](_0x16cd8f[_0x6330('0x34')]);_0x16cd8f[_0x6330('0x34')]=maskClientSecret(_0x723948);}return _0x16cd8f;});return _0x23fc39;})[_0x6330('0x17')](respondWithFilteredResult(_0x667af8,_0x304e9b))[_0x6330('0x35')](handleError(_0x667af8,null));};exports[_0x6330('0x36')]=function(_0x500a39,_0x17d336){var _0x1d1f58={'raw':!![],'where':{'id':_0x500a39[_0x6330('0x37')]['id']}},_0x1bb218={};_0x1bb218[_0x6330('0x22')]=_['keys'](db[_0x6330('0x1d')][_0x6330('0x1e')]);_0x1bb218[_0x6330('0x23')]=_[_0x6330('0x38')](_0x500a39['query']);_0x1bb218[_0x6330('0x24')]=_[_0x6330('0x25')](_0x1bb218['model'],_0x1bb218[_0x6330('0x23')]);_0x1d1f58[_0x6330('0x26')]=_[_0x6330('0x25')](_0x1bb218[_0x6330('0x22')],qs['fields'](_0x500a39['query'][_0x6330('0x27')]));_0x1d1f58['attributes']=_0x1d1f58[_0x6330('0x26')][_0x6330('0x39')]?_0x1d1f58[_0x6330('0x26')]:_0x1bb218[_0x6330('0x22')];if(_0x500a39[_0x6330('0x23')][_0x6330('0x3a')]){_0x1d1f58[_0x6330('0x3b')]=[{'all':!![]}];}_0x1d1f58=_[_0x6330('0x2e')]({},_0x1d1f58,_0x500a39[_0x6330('0x30')]);return db[_0x6330('0x1d')][_0x6330('0x3c')](_0x1d1f58)[_0x6330('0x17')](handleEntityNotFound(_0x17d336,null))[_0x6330('0x17')](function(_0x1a3703){if(_0x1a3703[_0x6330('0x31')]==='MicrosoftAzure'){var _0x23c2a9=encryptor[_0x6330('0x33')](_0x1a3703[_0x6330('0x34')]);_0x1a3703[_0x6330('0x34')]=maskClientSecret(_0x23c2a9);}return _0x1a3703;})[_0x6330('0x17')](respondWithResult(_0x17d336,null))[_0x6330('0x35')](handleError(_0x17d336,null));};exports['create']=function(_0xc3ac59,_0x575f0c){if(!_0xc3ac59[_0x6330('0x3d')][_0x6330('0x19')])throw new Error(_0x6330('0x3e'));if(!_0xc3ac59[_0x6330('0x3d')][_0x6330('0x31')])throw new Error(_0x6330('0x3f'));var _0x3db041=db[_0x6330('0x1d')][_0x6330('0x1e')][_0x6330('0x31')]['values'];if(!_0x3db041[_0x6330('0x40')](_0xc3ac59[_0x6330('0x3d')]['service']))throw new Error(_0x6330('0x41')+_0x3db041[_0x6330('0x42')](',\x20'));if(_0xc3ac59[_0x6330('0x3d')][_0x6330('0x31')]===_0x6330('0x32')&&_0xc3ac59[_0x6330('0x3d')][_0x6330('0x34')]){_0xc3ac59[_0x6330('0x3d')][_0x6330('0x34')]=encryptor[_0x6330('0x43')](_0xc3ac59[_0x6330('0x3d')]['data3']);}return db[_0x6330('0x1d')][_0x6330('0x44')](_0xc3ac59[_0x6330('0x3d')],{})[_0x6330('0x17')](respondWithResult(_0x575f0c,0xc9))[_0x6330('0x35')](handleError(_0x575f0c,null));};exports[_0x6330('0x15')]=function(_0x4141d6,_0x293e6e){if(_0x4141d6[_0x6330('0x3d')]['id']){delete _0x4141d6[_0x6330('0x3d')]['id'];}return db[_0x6330('0x1d')][_0x6330('0x3c')]({'where':{'id':_0x4141d6['params']['id']}})[_0x6330('0x17')](handleEntityNotFound(_0x293e6e,null))[_0x6330('0x17')](function(_0x9fb101){if(_0x9fb101[_0x6330('0x31')]===_0x6330('0x32')&&_0x4141d6[_0x6330('0x3d')]['data3']){_0x4141d6[_0x6330('0x3d')][_0x6330('0x34')]=encryptor[_0x6330('0x43')](_0x4141d6['body']['data3']);}return _0x9fb101;})[_0x6330('0x17')](saveUpdates(_0x4141d6[_0x6330('0x3d')],null))[_0x6330('0x17')](respondWithResult(_0x293e6e,null))['catch'](handleError(_0x293e6e,null));};exports[_0x6330('0x16')]=function(_0x51dce7,_0x35f1af){return db[_0x6330('0x1d')][_0x6330('0x3c')]({'where':{'id':_0x51dce7[_0x6330('0x37')]['id']}})[_0x6330('0x17')](handleEntityNotFound(_0x35f1af,null))[_0x6330('0x17')](removeEntity(_0x35f1af,null))[_0x6330('0x35')](handleError(_0x35f1af,null));};exports['oauth2MicrosoftAuthorize']=function(_0x55e626,_0x34cbb3){return db[_0x6330('0x1d')][_0x6330('0x45')]({'where':{'id':_0x55e626[_0x6330('0x37')]['id']},'raw':!![]})[_0x6330('0x17')](function(_0x4503bf){if(!_0x4503bf)return _0x34cbb3[_0x6330('0xc')](0x194);return{'url':oauth[_0x6330('0x46')](_0x4503bf,_0x55e626['user']['id'])};})[_0x6330('0x17')](respondWithResult(_0x34cbb3,null))['catch'](handleError(_0x34cbb3,null));};exports[_0x6330('0x47')]=function(_0x2b6c01,_0x50c04b){var _0x587fc3=_0x2b6c01['body'];var _0x1dacd0;var _0x5776ce;if(_0x587fc3[_0x6330('0x48')])throw _0x587fc3;redis[_0x6330('0x49')](_0x587fc3[_0x6330('0x4a')])['then'](function(_0x10fed3){if(!_0x10fed3)throw new Error('Invalid\x20state\x20parameter');_0x1dacd0=JSON[_0x6330('0x4b')](_0x10fed3);var _0x3822ce=Buffer['from'](_0x587fc3['state'],_0x6330('0x4c'))[_0x6330('0x4d')](_0x6330('0x4e'));_0x5776ce=JSON['parse'](_0x3822ce);if(!oauth[_0x6330('0x4f')](_0x587fc3['id_token'],_0x1dacd0['oauth2Claims']))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x6330('0x50')](_0x587fc3[_0x6330('0x4a')]);return oauth[_0x6330('0x51')](_0x587fc3[_0x6330('0x52')],_0x1dacd0);})[_0x6330('0x17')](function(_0x888844){_0x1dacd0[_0x6330('0x53')]=_0x888844[_0x6330('0x54')];_0x1dacd0[_0x6330('0x55')]=_0x888844[_0x6330('0x56')];return db[_0x6330('0x1d')]['update']({'data5':_0x1dacd0['data5'],'data6':_0x1dacd0[_0x6330('0x55')]},{'where':{'id':_0x1dacd0['id']}});})[_0x6330('0x17')](function(){oauth['startRefreshInterval'](_0x1dacd0);socket[_0x6330('0x57')](_0x6330('0x58'),{'id':_0x5776ce['id']});return;})[_0x6330('0x17')](respondWithStatusCode(_0x50c04b,null))[_0x6330('0x35')](function(_0x3e98a2){if(_0x5776ce){socket[_0x6330('0x57')]('microsoftAuthorization:error',{'id':_0x5776ce['id']});}if(!_0x1dacd0){logger[_0x6330('0x48')](_0x6330('0x59'),_0x3e98a2);return _0x50c04b[_0x6330('0xd')](0x1f4)[_0x6330('0x5a')](_0x3e98a2[_0x6330('0x5b')]);}logger[_0x6330('0x48')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1dacd0['id'],JSON['stringify'](_0x3e98a2));});};
\ No newline at end of file
+var _0xbcd2=['state','parse','from','base64','ascii','id_token','oauth2Claims','getOauth2MicrosoftAccessToken','code','access_token','data6','data5','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','service','MicrosoftAzure','data3','show','params','keys','find','decryptString','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','create','update','encryptString','catch','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','get'];(function(_0x4a96ca,_0x13754e){var _0x2aed48=function(_0x361330){while(--_0x361330){_0x4a96ca['push'](_0x4a96ca['shift']());}};_0x2aed48(++_0x13754e);}(_0xbcd2,0x1d0));var _0x2bcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcd2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Redis=require(_0x2bcd('0x0'));var qs=require(_0x2bcd('0x1'));var encryptor=require(_0x2bcd('0x2'));var config=require('../../config/environment');var logger=require(_0x2bcd('0x3'))('api');var db=require(_0x2bcd('0x4'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x2bcd('0x5')]=_['defaults'](config[_0x2bcd('0x5')],{'host':_0x2bcd('0x6'),'port':0x18eb});var socket=require(_0x2bcd('0x7'))(new Redis(config[_0x2bcd('0x5')]));var redis=new Redis(config[_0x2bcd('0x5')]);function respondWithStatusCode(_0x4b427e,_0x151946){_0x151946=_0x151946||0xcc;return function(_0x43f330){if(_0x43f330){return _0x4b427e[_0x2bcd('0x8')](_0x151946);}return _0x4b427e[_0x2bcd('0x9')](_0x151946)[_0x2bcd('0xa')]();};}function respondWithResult(_0x2c4a7f,_0x11598e){_0x11598e=_0x11598e||0xc8;return function(_0xdf2ad0){if(_0xdf2ad0){return _0x2c4a7f['status'](_0x11598e)[_0x2bcd('0xb')](_0xdf2ad0);}};}function respondWithFilteredResult(_0x58b7d0,_0x5b44ce){return function(_0xb33d18){if(_0xb33d18){var _0x2dc1a7=typeof _0x5b44ce[_0x2bcd('0xc')]===_0x2bcd('0xd')&&typeof _0x5b44ce[_0x2bcd('0xe')]===_0x2bcd('0xd');var _0x454d23=_0xb33d18[_0x2bcd('0xf')];var _0x2b4734=_0x2dc1a7?0x0:_0x5b44ce[_0x2bcd('0xc')];var _0x3f12f1=_0x2dc1a7?_0xb33d18[_0x2bcd('0xf')]:_0x5b44ce[_0x2bcd('0xc')]+_0x5b44ce[_0x2bcd('0xe')];var _0x340fb7;if(_0x3f12f1>=_0x454d23){_0x3f12f1=_0x454d23;_0x340fb7=0xc8;}else{_0x340fb7=0xce;}_0x58b7d0[_0x2bcd('0x9')](_0x340fb7);return _0x58b7d0[_0x2bcd('0x10')](_0x2bcd('0x11'),_0x2b4734+'-'+_0x3f12f1+'/'+_0x454d23)[_0x2bcd('0xb')](_0xb33d18);}return null;};}function saveUpdates(_0x15d8ad){return function(_0x398ceb){if(_0x398ceb){return _0x398ceb['update'](_0x15d8ad)[_0x2bcd('0x12')](function(_0x3a11b5){return _0x3a11b5;});}return null;};}function removeEntity(_0x38026b){return function(_0x5c94cc){if(_0x5c94cc){return _0x5c94cc[_0x2bcd('0x13')]()[_0x2bcd('0x12')](function(){_0x38026b[_0x2bcd('0x9')](0xcc)[_0x2bcd('0xa')]();});}};}function handleEntityNotFound(_0x11fb07){return function(_0x12b82a){if(!_0x12b82a){_0x11fb07[_0x2bcd('0x8')](0x194);}return _0x12b82a;};}function handleError(_0x46e6bf,_0x2ecf29){_0x2ecf29=_0x2ecf29||0x1f4;return function(_0x4a82f7){logger[_0x2bcd('0x14')](_0x4a82f7[_0x2bcd('0x15')]);if(_0x4a82f7['name']){delete _0x4a82f7[_0x2bcd('0x16')];}_0x46e6bf[_0x2bcd('0x9')](_0x2ecf29)[_0x2bcd('0x17')](_0x4a82f7);};}function maskClientSecret(_0x345f49){return _[_0x2bcd('0x18')](_0x345f49['slice'](0x0,0x3),0x14,'*');}exports[_0x2bcd('0x19')]=function(_0x4cf1c2,_0xf63736){var _0x520392={},_0x540241={},_0x114c0a={'count':0x0,'rows':[]};var _0xf2796f=_[_0x2bcd('0x1a')](db[_0x2bcd('0x1b')][_0x2bcd('0x1c')],function(_0x15861d){return{'name':_0x15861d[_0x2bcd('0x1d')],'type':_0x15861d[_0x2bcd('0x1e')][_0x2bcd('0x1f')]};});_0x540241[_0x2bcd('0x20')]=_[_0x2bcd('0x1a')](_0xf2796f,'name');_0x540241['query']=_['keys'](_0x4cf1c2[_0x2bcd('0x21')]);_0x540241[_0x2bcd('0x22')]=_[_0x2bcd('0x23')](_0x540241[_0x2bcd('0x20')],_0x540241[_0x2bcd('0x21')]);_0x520392[_0x2bcd('0x24')]=_[_0x2bcd('0x23')](_0x540241[_0x2bcd('0x20')],qs[_0x2bcd('0x25')](_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0x25')]));_0x520392['attributes']=_0x520392['attributes'][_0x2bcd('0x26')]?_0x520392[_0x2bcd('0x24')]:_0x540241[_0x2bcd('0x20')];if(!_0x4cf1c2['query']['hasOwnProperty'](_0x2bcd('0x27'))){_0x520392[_0x2bcd('0xe')]=qs[_0x2bcd('0xe')](_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0xe')]);_0x520392[_0x2bcd('0xc')]=qs['offset'](_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0xc')]);}_0x520392['order']=qs[_0x2bcd('0x28')](_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0x28')]);_0x520392[_0x2bcd('0x29')]=qs[_0x2bcd('0x22')](_[_0x2bcd('0x2a')](_0x4cf1c2['query'],_0x540241['filters']),_0xf2796f);if(_0x4cf1c2['query']['filter']){_0x520392[_0x2bcd('0x29')]=_[_0x2bcd('0x2b')](_0x520392[_0x2bcd('0x29')],{'$or':_[_0x2bcd('0x1a')](_0xf2796f,function(_0x31af39){if(_0x31af39[_0x2bcd('0x1e')]!==_0x2bcd('0x2c')){var _0x4328d4={};_0x4328d4[_0x31af39[_0x2bcd('0x16')]]={'$like':'%'+_0x4cf1c2[_0x2bcd('0x21')]['filter']+'%'};return _0x4328d4;}})});}_0x520392=_[_0x2bcd('0x2b')]({},_0x520392,_0x4cf1c2[_0x2bcd('0x2d')]);var _0x5b739c={'where':_0x520392[_0x2bcd('0x29')]};return db[_0x2bcd('0x1b')][_0x2bcd('0xf')](_0x5b739c)['then'](function(_0x1edbf9){_0x114c0a[_0x2bcd('0xf')]=_0x1edbf9;if(_0x4cf1c2[_0x2bcd('0x21')][_0x2bcd('0x2e')]){_0x520392[_0x2bcd('0x2f')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x520392);})[_0x2bcd('0x12')](function(_0x4e6226){_0x114c0a[_0x2bcd('0x30')]=_[_0x2bcd('0x1a')](_0x4e6226,function(_0x5a2129){if(_0x5a2129[_0x2bcd('0x31')]===_0x2bcd('0x32')){var _0x11550d=encryptor['decryptString'](_0x5a2129[_0x2bcd('0x33')]);_0x5a2129[_0x2bcd('0x33')]=maskClientSecret(_0x11550d);}return _0x5a2129;});return _0x114c0a;})['then'](respondWithFilteredResult(_0xf63736,_0x520392))['catch'](handleError(_0xf63736,null));};exports[_0x2bcd('0x34')]=function(_0x330df3,_0x5e4ae7){var _0x481ad0={'raw':!![],'where':{'id':_0x330df3[_0x2bcd('0x35')]['id']}},_0x10813a={};_0x10813a['model']=_[_0x2bcd('0x36')](db['CloudProvider'][_0x2bcd('0x1c')]);_0x10813a[_0x2bcd('0x21')]=_[_0x2bcd('0x36')](_0x330df3['query']);_0x10813a[_0x2bcd('0x22')]=_['intersection'](_0x10813a['model'],_0x10813a[_0x2bcd('0x21')]);_0x481ad0[_0x2bcd('0x24')]=_[_0x2bcd('0x23')](_0x10813a[_0x2bcd('0x20')],qs[_0x2bcd('0x25')](_0x330df3[_0x2bcd('0x21')][_0x2bcd('0x25')]));_0x481ad0[_0x2bcd('0x24')]=_0x481ad0['attributes'][_0x2bcd('0x26')]?_0x481ad0[_0x2bcd('0x24')]:_0x10813a[_0x2bcd('0x20')];if(_0x330df3[_0x2bcd('0x21')][_0x2bcd('0x2e')]){_0x481ad0[_0x2bcd('0x2f')]=[{'all':!![]}];}_0x481ad0=_[_0x2bcd('0x2b')]({},_0x481ad0,_0x330df3[_0x2bcd('0x2d')]);return db[_0x2bcd('0x1b')][_0x2bcd('0x37')](_0x481ad0)['then'](handleEntityNotFound(_0x5e4ae7,null))['then'](function(_0x14a89f){if(_0x14a89f[_0x2bcd('0x31')]===_0x2bcd('0x32')){var _0x327d82=encryptor[_0x2bcd('0x38')](_0x14a89f['data3']);_0x14a89f[_0x2bcd('0x33')]=maskClientSecret(_0x327d82);}return _0x14a89f;})[_0x2bcd('0x12')](respondWithResult(_0x5e4ae7,null))['catch'](handleError(_0x5e4ae7,null));};exports['create']=function(_0x1207be,_0x4997b9){if(!_0x1207be[_0x2bcd('0x39')][_0x2bcd('0x16')])throw new Error(_0x2bcd('0x3a'));if(!_0x1207be['body'][_0x2bcd('0x31')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x25edeb=db[_0x2bcd('0x1b')][_0x2bcd('0x1c')][_0x2bcd('0x31')][_0x2bcd('0x3b')];if(!_0x25edeb[_0x2bcd('0x3c')](_0x1207be['body'][_0x2bcd('0x31')]))throw new Error(_0x2bcd('0x3d')+_0x25edeb['join'](',\x20'));if(_0x1207be[_0x2bcd('0x39')][_0x2bcd('0x31')]===_0x2bcd('0x32')&&_0x1207be['body'][_0x2bcd('0x33')]){_0x1207be['body']['data3']=encryptor['encryptString'](_0x1207be[_0x2bcd('0x39')]['data3']);}return db[_0x2bcd('0x1b')][_0x2bcd('0x3e')](_0x1207be[_0x2bcd('0x39')],{})[_0x2bcd('0x12')](respondWithResult(_0x4997b9,0xc9))['catch'](handleError(_0x4997b9,null));};exports[_0x2bcd('0x3f')]=function(_0x55ac1f,_0x78555c){if(_0x55ac1f[_0x2bcd('0x39')]['id']){delete _0x55ac1f[_0x2bcd('0x39')]['id'];}return db[_0x2bcd('0x1b')][_0x2bcd('0x37')]({'where':{'id':_0x55ac1f[_0x2bcd('0x35')]['id']}})[_0x2bcd('0x12')](handleEntityNotFound(_0x78555c,null))[_0x2bcd('0x12')](function(_0x1c01ae){if(_0x1c01ae[_0x2bcd('0x31')]==='MicrosoftAzure'&&_0x55ac1f[_0x2bcd('0x39')]['data3']){_0x55ac1f['body']['data3']=encryptor[_0x2bcd('0x40')](_0x55ac1f[_0x2bcd('0x39')][_0x2bcd('0x33')]);}return _0x1c01ae;})[_0x2bcd('0x12')](saveUpdates(_0x55ac1f[_0x2bcd('0x39')],null))[_0x2bcd('0x12')](respondWithResult(_0x78555c,null))['catch'](handleError(_0x78555c,null));};exports[_0x2bcd('0x13')]=function(_0x3031b8,_0x2ebae1){return db['CloudProvider']['find']({'where':{'id':_0x3031b8[_0x2bcd('0x35')]['id']}})['then'](handleEntityNotFound(_0x2ebae1,null))[_0x2bcd('0x12')](removeEntity(_0x2ebae1,null))[_0x2bcd('0x41')](handleError(_0x2ebae1,null));};exports['oauth2MicrosoftAuthorize']=function(_0x5a1ff9,_0x124583){return db[_0x2bcd('0x1b')][_0x2bcd('0x42')]({'where':{'id':_0x5a1ff9['params']['id']},'raw':!![]})[_0x2bcd('0x12')](function(_0x4cb16d){if(!_0x4cb16d)return _0x124583[_0x2bcd('0x8')](0x194);return{'url':oauth[_0x2bcd('0x43')](_0x4cb16d,_0x5a1ff9['user']['id'])};})[_0x2bcd('0x12')](respondWithResult(_0x124583,null))[_0x2bcd('0x41')](handleError(_0x124583,null));};exports[_0x2bcd('0x44')]=function(_0x2fba5a,_0x16857e){var _0x2b566f=_0x2fba5a[_0x2bcd('0x39')];var _0x17f2b9;var _0x34c9a6;if(_0x2b566f['error'])throw _0x2b566f;redis[_0x2bcd('0x45')](_0x2b566f[_0x2bcd('0x46')])[_0x2bcd('0x12')](function(_0x1e72ea){if(!_0x1e72ea)throw new Error('Invalid\x20state\x20parameter');_0x17f2b9=JSON[_0x2bcd('0x47')](_0x1e72ea);var _0x4832b8=Buffer[_0x2bcd('0x48')](_0x2b566f[_0x2bcd('0x46')],_0x2bcd('0x49'))['toString'](_0x2bcd('0x4a'));_0x34c9a6=JSON[_0x2bcd('0x47')](_0x4832b8);if(!oauth['isValidIdToken'](_0x2b566f[_0x2bcd('0x4b')],_0x17f2b9[_0x2bcd('0x4c')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis['del'](_0x2b566f['state']);return oauth[_0x2bcd('0x4d')](_0x2b566f[_0x2bcd('0x4e')],_0x17f2b9);})[_0x2bcd('0x12')](function(_0x3b423f){_0x17f2b9['data5']=_0x3b423f[_0x2bcd('0x4f')];_0x17f2b9[_0x2bcd('0x50')]=_0x3b423f['refresh_token'];return db[_0x2bcd('0x1b')]['update']({'data5':_0x17f2b9[_0x2bcd('0x51')],'data6':_0x17f2b9[_0x2bcd('0x50')]},{'where':{'id':_0x17f2b9['id']}});})['then'](function(){oauth[_0x2bcd('0x52')](_0x17f2b9);socket[_0x2bcd('0x53')](_0x2bcd('0x54'),{'id':_0x34c9a6['id']});return;})['then'](respondWithStatusCode(_0x16857e,null))[_0x2bcd('0x41')](function(_0x3a2cf2){if(_0x34c9a6){socket['emit'](_0x2bcd('0x55'),{'id':_0x34c9a6['id']});}if(!_0x17f2b9){logger[_0x2bcd('0x14')]('Invalid\x20authentication\x20state\x20parameter',_0x3a2cf2);return _0x16857e[_0x2bcd('0x9')](0x1f4)['send'](_0x3a2cf2[_0x2bcd('0x56')]);}logger[_0x2bcd('0x14')](_0x2bcd('0x57'),_0x17f2b9['id'],JSON[_0x2bcd('0x58')](_0x3a2cf2));});};
\ No newline at end of file
index fec8e36..16678d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f23=['../../config/environment','./cloudProvider.attributes','define','CloudProvider','cloud_providers','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x47aec7,_0x423a48){var _0x4f6df5=function(_0x12cba8){while(--_0x12cba8){_0x47aec7['push'](_0x47aec7['shift']());}};_0x4f6df5(++_0x423a48);}(_0x3f23,0x94));var _0x33f2=function(_0xcfe6f9,_0x3d23fd){_0xcfe6f9=_0xcfe6f9-0x0;var _0x5a9c64=_0x3f23[_0xcfe6f9];return _0x5a9c64;};'use strict';var _=require(_0x33f2('0x0'));var util=require(_0x33f2('0x1'));var logger=require(_0x33f2('0x2'))(_0x33f2('0x3'));var moment=require(_0x33f2('0x4'));var BPromise=require('bluebird');var rp=require(_0x33f2('0x5'));var fs=require('fs');var path=require(_0x33f2('0x6'));var rimraf=require(_0x33f2('0x7'));var config=require(_0x33f2('0x8'));var attributes=require(_0x33f2('0x9'));module['exports']=function(_0x1eb9ae,_0x25b9e5){return _0x1eb9ae[_0x33f2('0xa')](_0x33f2('0xb'),attributes,{'tableName':_0x33f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xaecc=['api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider','util','../../config/logger'];(function(_0x9f0bdf,_0x14e6ca){var _0x523eca=function(_0x3ac7f6){while(--_0x3ac7f6){_0x9f0bdf['push'](_0x9f0bdf['shift']());}};_0x523eca(++_0x14e6ca);}(_0xaecc,0x153));var _0xcaec=function(_0x493df0,_0x3808fe){_0x493df0=_0x493df0-0x0;var _0x4b6a03=_0xaecc[_0x493df0];return _0x4b6a03;};'use strict';var _=require('lodash');var util=require(_0xcaec('0x0'));var logger=require(_0xcaec('0x1'))(_0xcaec('0x2'));var moment=require(_0xcaec('0x3'));var BPromise=require(_0xcaec('0x4'));var rp=require(_0xcaec('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaec('0x6'));var config=require(_0xcaec('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xcaec('0x8')]=function(_0x37e146,_0x4a0388){return _0x37e146[_0xcaec('0x9')](_0xcaec('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d7b263e..4796fe8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x637b=['decryptString','data3','POST','{TENANT_ID}','data5','access_token','data6','refresh_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','map','type','Dynamics365','push','data7','/.default','Outlook365','replace','data2','id_token','stringify','toString','base64','randomBytes','hex','client_id','data1','response_type','join','data4','response_mode','state','nonce','login','key','value','oauth2Claims','set','iss','aud','isAfter','unix','exp','resolve','then','CloudProvider'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x637b,0x1cd));var _0xb637=function(_0xaa834,_0x785375){_0xaa834=_0xaa834-0x0;var _0x531327=_0x637b[_0xaa834];return _0x531327;};'use strict';var _=require(_0xb637('0x0'));var crypto=require(_0xb637('0x1'));var jwt=require(_0xb637('0x2'));var moment=require(_0xb637('0x3'));var Redis=require(_0xb637('0x4'));var rp=require(_0xb637('0x5'));var util=require(_0xb637('0x6'));var encryptor=require('../../components/encryptor');var config=require(_0xb637('0x7'));var logger=require(_0xb637('0x8'))(_0xb637('0x9'));var schedule=require(_0xb637('0xa'));var db=require(_0xb637('0xb'))['db'];config[_0xb637('0xc')]=_[_0xb637('0xd')](config[_0xb637('0xc')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xb637('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xb637('0xf'),_0xb637('0x10'),'email',_0xb637('0x11'),_0xb637('0x12'),_0xb637('0x13'),_0xb637('0x14')],'Dynamics365':[_0xb637('0xf'),_0xb637('0x11')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x1483ce){var _0x4339f3=_[_0xb637('0x15')](AZURE_AUTH_SCOPES[_0x1483ce[_0xb637('0x16')]]);if(_0x1483ce[_0xb637('0x16')]===_0xb637('0x17'))_0x4339f3[_0xb637('0x18')](_0x1483ce[_0xb637('0x19')]+_0xb637('0x1a'));return _0x4339f3['join']('\x20');}function getAccessTokenScope(_0x34aeee){if(_0x34aeee[_0xb637('0x16')]===_0xb637('0x1b'))return _0xb637('0x12');if(_0x34aeee['type']===_0xb637('0x17'))return _0x34aeee['data7']+_0xb637('0x1a');}function generateMicrosoftAuthorizationUrl(_0x5d1f8d,_0x2af3ce){var _0x3b35e2=MICROSOFT_AUTH_URL[_0xb637('0x1c')]('{TENANT_ID}',_0x5d1f8d[_0xb637('0x1d')]);var _0x28bb4b=['code',_0xb637('0x1e')];var _0x2d0362=Buffer['from'](JSON[_0xb637('0x1f')]({'id':_0x2af3ce}))[_0xb637('0x20')](_0xb637('0x21'));var _0x172279=crypto[_0xb637('0x22')](0x10)[_0xb637('0x20')](_0xb637('0x23'));var _0x5a89a3=getAuthorizationScopes(_0x5d1f8d);var _0x1baf51=[{'key':_0xb637('0x24'),'value':_0x5d1f8d[_0xb637('0x25')]},{'key':_0xb637('0x26'),'value':encodeURIComponent(_0x28bb4b[_0xb637('0x27')]('\x20'))},{'key':'redirect_uri','value':_0x5d1f8d[_0xb637('0x28')]},{'key':_0xb637('0x29'),'value':'form_post'},{'key':'scope','value':encodeURIComponent(_0x5a89a3)},{'key':_0xb637('0x2a'),'value':_0x2d0362},{'key':_0xb637('0x2b'),'value':_0x172279},{'key':'prompt','value':_0xb637('0x2c')}];var _0x1196fb=_0x3b35e2+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb637('0x15')](_0x1baf51,function(_0x3346ee){return _0x3346ee[_0xb637('0x2d')]+'='+_0x3346ee[_0xb637('0x2e')];})[_0xb637('0x27')]('&');_0x5d1f8d[_0xb637('0x2f')]={'issuer':_0x3b35e2[_0xb637('0x1c')]('oauth2/',''),'audience':_0x5d1f8d[_0xb637('0x25')],'state':_0x2d0362,'nonce':_0x172279};redis[_0xb637('0x30')](_0x2d0362,JSON[_0xb637('0x1f')](_0x5d1f8d));return _0x1196fb;}function isValidIdToken(_0x27de7e,_0x479afc){try{var _0x227ecf=jwt['decode'](_0x27de7e,{'complete':!![]});var _0x33688c=_0x227ecf['payload'];if(_0x33688c[_0xb637('0x31')]!==_0x479afc['issuer'])return![];if(_0x33688c[_0xb637('0x32')]!==_0x479afc['audience'])return![];if(_0x33688c['nonce']!==_0x479afc['nonce'])return![];if(moment()[_0xb637('0x33')](moment[_0xb637('0x34')](_0x33688c[_0xb637('0x35')])))return![];return!![];}catch(_0x485bd4){throw _0x485bd4;}}function refreshOauth2MicrosoftAccessToken(_0x12e756){return Promise[_0xb637('0x36')]()[_0xb637('0x37')](function(){if(_0x12e756['data3'])return _0x12e756;return db[_0xb637('0x38')]['findOne']({'where':{'id':_0x12e756['id']},'raw':!![]});})[_0xb637('0x37')](function(_0x38d5e2){var _0x2d0cdd={'grant_type':'refresh_token','refresh_token':_0x38d5e2['data6'],'scope':getAccessTokenScope(_0x38d5e2),'redirect_uri':_0x38d5e2[_0xb637('0x28')],'client_id':_0x38d5e2[_0xb637('0x25')],'client_secret':encryptor[_0xb637('0x39')](_0x38d5e2[_0xb637('0x3a')])};var _0x32488c={'method':_0xb637('0x3b'),'uri':MICROSOFT_AUTH_URL[_0xb637('0x1c')](_0xb637('0x3c'),_0x38d5e2['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2d0cdd,'json':!![]};return rp(_0x32488c);})[_0xb637('0x37')](function(_0x4c0560){_0x12e756[_0xb637('0x3d')]=_0x4c0560[_0xb637('0x3e')];_0x12e756[_0xb637('0x3f')]=_0x4c0560[_0xb637('0x40')];return db[_0xb637('0x38')]['update']({'data5':_0x12e756[_0xb637('0x3d')],'data6':_0x12e756['data6']},{'where':{'id':_0x12e756['id']}});})[_0xb637('0x37')](function(){return _0x12e756;})[_0xb637('0x41')](function(_0x2424d1){logger[_0xb637('0x42')](_0xb637('0x43'),_0x12e756['id'],_0x2424d1);});}function getOauth2MicrosoftAccessToken(_0x5a7eed,_0x2f6321){var _0x35b1f8={'grant_type':_0xb637('0x44'),'code':_0x5a7eed,'scope':getAccessTokenScope(_0x2f6321),'redirect_uri':_0x2f6321[_0xb637('0x28')],'client_id':_0x2f6321['data1'],'client_secret':encryptor['decryptString'](_0x2f6321['data3'])};var _0x144ab7={'method':_0xb637('0x3b'),'uri':MICROSOFT_AUTH_URL['replace'](_0xb637('0x3c'),_0x2f6321[_0xb637('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x35b1f8,'json':!![]};return rp(_0x144ab7);}function startRefreshInterval(_0x2eb9cf){var _0x5e1fb8=schedule[_0xb637('0x45')];if(_0x5e1fb8[_0x2eb9cf['id']])clearInterval(_0x5e1fb8[_0x2eb9cf['id']]);_0x5e1fb8[_0x2eb9cf['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb637('0x46')](this,{'id':_0x2eb9cf['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb637('0x45')]=_0x5e1fb8;}function startAllRefreshIntervals(){return db['CloudProvider'][_0xb637('0x47')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb637('0x37')](function(_0x3c4312){var _0x4a7928=_0x3c4312[_0xb637('0x15')](function(_0x206999){return refreshOauth2MicrosoftAccessToken(_0x206999)['then'](function(_0x688c6a){startRefreshInterval(_0x688c6a);});});return Promise[_0xb637('0x48')](_0x4a7928);})[_0xb637('0x41')](function(_0x587fd1){var _0x591607=_0x587fd1?util['inspect'](_0x587fd1,{'showHidden':![],'depth':null}):'';logger['error'](_0xb637('0x49'),_0x591607);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval};
\ No newline at end of file
+var _0x5918=['Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','ioredis','request-promise','../../components/encryptor','../../config/logger','api','../../config/schedule/cloud-provider','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','data7','/.default','replace','{TENANT_ID}','code','from','stringify','base64','randomBytes','hex','client_id','data1','join','redirect_uri','data4','response_mode','form_post','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','decode','payload','iss','aud','isAfter','resolve','then','data3','CloudProvider','findOne','refresh_token','decryptString','data5','access_token','data6','catch','error'];(function(_0xe1441d,_0x36fb8e){var _0x2ef242=function(_0x52bf2d){while(--_0x52bf2d){_0xe1441d['push'](_0xe1441d['shift']());}};_0x2ef242(++_0x36fb8e);}(_0x5918,0x1cc));var _0x8591=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5918[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8591('0x0'));var crypto=require(_0x8591('0x1'));var jwt=require(_0x8591('0x2'));var moment=require('moment');var Redis=require(_0x8591('0x3'));var rp=require(_0x8591('0x4'));var util=require('util');var encryptor=require(_0x8591('0x5'));var config=require('../../config/environment');var logger=require(_0x8591('0x6'))(_0x8591('0x7'));var schedule=require(_0x8591('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x8591('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x8591('0xa')]);var MICROSOFT_AUTH_URL=_0x8591('0xb');var AZURE_AUTH_SCOPES={'Outlook365':[_0x8591('0xc'),'profile',_0x8591('0xd'),_0x8591('0xe'),_0x8591('0xf'),'https://outlook.office.com/POP.AccessAsUser.All',_0x8591('0x10')],'Dynamics365':[_0x8591('0xc'),_0x8591('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0x8591('0x11');var MICROSOFT_TOKEN_ENDPOINT=_0x8591('0x12');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x16e6be){var _0x1c2b74=_[_0x8591('0x13')](AZURE_AUTH_SCOPES[_0x16e6be[_0x8591('0x14')]]);if(_0x16e6be[_0x8591('0x14')]===_0x8591('0x15'))_0x1c2b74['push'](_0x16e6be[_0x8591('0x16')]+'/.default');return _0x1c2b74['join']('\x20');}function getAccessTokenScope(_0x5d6181){if(_0x5d6181[_0x8591('0x14')]==='Outlook365')return _0x8591('0xf');if(_0x5d6181[_0x8591('0x14')]===_0x8591('0x15'))return _0x5d6181[_0x8591('0x16')]+_0x8591('0x17');}function generateMicrosoftAuthorizationUrl(_0x54df18,_0x49486a){var _0x14e9a9=MICROSOFT_AUTH_URL[_0x8591('0x18')](_0x8591('0x19'),_0x54df18['data2']);var _0x467eed=[_0x8591('0x1a'),'id_token'];var _0x374fe8=Buffer[_0x8591('0x1b')](JSON[_0x8591('0x1c')]({'id':_0x49486a}))['toString'](_0x8591('0x1d'));var _0x1c4ef4=crypto[_0x8591('0x1e')](0x10)['toString'](_0x8591('0x1f'));var _0x4d6b6a=getAuthorizationScopes(_0x54df18);var _0x320e62=[{'key':_0x8591('0x20'),'value':_0x54df18[_0x8591('0x21')]},{'key':'response_type','value':encodeURIComponent(_0x467eed[_0x8591('0x22')]('\x20'))},{'key':_0x8591('0x23'),'value':_0x54df18[_0x8591('0x24')]},{'key':_0x8591('0x25'),'value':_0x8591('0x26')},{'key':'scope','value':encodeURIComponent(_0x4d6b6a)},{'key':_0x8591('0x27'),'value':_0x374fe8},{'key':_0x8591('0x28'),'value':_0x1c4ef4},{'key':_0x8591('0x29'),'value':_0x8591('0x2a')}];var _0xd98c84=_0x14e9a9+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8591('0x13')](_0x320e62,function(_0x1b89d5){return _0x1b89d5[_0x8591('0x2b')]+'='+_0x1b89d5[_0x8591('0x2c')];})[_0x8591('0x22')]('&');_0x54df18[_0x8591('0x2d')]={'issuer':_0x14e9a9[_0x8591('0x18')](_0x8591('0x2e'),''),'audience':_0x54df18[_0x8591('0x21')],'state':_0x374fe8,'nonce':_0x1c4ef4};redis[_0x8591('0x2f')](_0x374fe8,JSON[_0x8591('0x1c')](_0x54df18));return _0xd98c84;}function isValidIdToken(_0x374791,_0x586e06){try{var _0xbcbdff=jwt[_0x8591('0x30')](_0x374791,{'complete':!![]});var _0x464620=_0xbcbdff[_0x8591('0x31')];if(_0x464620[_0x8591('0x32')]!==_0x586e06['issuer'])return![];if(_0x464620[_0x8591('0x33')]!==_0x586e06['audience'])return![];if(_0x464620[_0x8591('0x28')]!==_0x586e06[_0x8591('0x28')])return![];if(moment()[_0x8591('0x34')](moment['unix'](_0x464620['exp'])))return![];return!![];}catch(_0x1a8c8c){throw _0x1a8c8c;}}function refreshOauth2MicrosoftAccessToken(_0x2d12dc){return Promise[_0x8591('0x35')]()[_0x8591('0x36')](function(){if(_0x2d12dc[_0x8591('0x37')])return _0x2d12dc;return db[_0x8591('0x38')][_0x8591('0x39')]({'where':{'id':_0x2d12dc['id']},'raw':!![]});})[_0x8591('0x36')](function(_0x4794b6){var _0x49ec15={'grant_type':_0x8591('0x3a'),'refresh_token':_0x4794b6['data6'],'scope':getAccessTokenScope(_0x4794b6),'redirect_uri':_0x4794b6[_0x8591('0x24')],'client_id':_0x4794b6['data1'],'client_secret':encryptor[_0x8591('0x3b')](_0x4794b6['data3'])};var _0x5b2b6f={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x8591('0x19'),_0x4794b6['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x49ec15,'json':!![]};return rp(_0x5b2b6f);})[_0x8591('0x36')](function(_0x54900d){_0x2d12dc[_0x8591('0x3c')]=_0x54900d[_0x8591('0x3d')];_0x2d12dc['data6']=_0x54900d[_0x8591('0x3a')];return db[_0x8591('0x38')]['update']({'data5':_0x2d12dc['data5'],'data6':_0x2d12dc[_0x8591('0x3e')]},{'where':{'id':_0x2d12dc['id']}});})[_0x8591('0x36')](function(){return _0x2d12dc;})[_0x8591('0x3f')](function(_0x112f02){logger[_0x8591('0x40')](_0x8591('0x41'),_0x2d12dc['id'],_0x112f02);});}function getOauth2MicrosoftAccessToken(_0x3a0494,_0x5bb87e){var _0x3f84a5={'grant_type':_0x8591('0x42'),'code':_0x3a0494,'scope':getAccessTokenScope(_0x5bb87e),'redirect_uri':_0x5bb87e['data4'],'client_id':_0x5bb87e[_0x8591('0x21')],'client_secret':encryptor['decryptString'](_0x5bb87e[_0x8591('0x37')])};var _0xcfb055={'method':_0x8591('0x43'),'uri':MICROSOFT_AUTH_URL[_0x8591('0x18')]('{TENANT_ID}',_0x5bb87e['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f84a5,'json':!![]};return rp(_0xcfb055);}function startRefreshInterval(_0x30da7c){var _0x3363aa=schedule[_0x8591('0x44')];if(_0x3363aa[_0x30da7c['id']])clearInterval(_0x3363aa[_0x30da7c['id']]);_0x3363aa[_0x30da7c['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8591('0x45')](this,{'id':_0x30da7c['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x8591('0x44')]=_0x3363aa;}function startAllRefreshIntervals(){return db[_0x8591('0x38')][_0x8591('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8591('0x36')](function(_0x12d626){var _0x4a2c45=_0x12d626[_0x8591('0x13')](function(_0x3b17ce){return refreshOauth2MicrosoftAccessToken(_0x3b17ce)['then'](function(_0x298245){startRefreshInterval(_0x298245);});});return Promise[_0x8591('0x47')](_0x4a2c45);})['catch'](function(_0x188782){var _0x22f4da=_0x188782?util[_0x8591('0x48')](_0x188782,{'showHidden':![],'depth':null}):'';logger[_0x8591('0x40')](_0x8591('0x49'),_0x22f4da);});}module[_0x8591('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval};
\ No newline at end of file
index f6edb3c..7c81686 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CloudProvider,\x20%s,\x20%s','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5c7fab,_0xe377d0){var _0x3fc2e3=function(_0x18ed0d){while(--_0x18ed0d){_0x5c7fab['push'](_0x5c7fab['shift']());}};_0x3fc2e3(++_0xe377d0);}(_0xb10b,0x12a));var _0xbb10=function(_0x40b723,_0x118b22){_0x40b723=_0x40b723-0x0;var _0x1981ad=_0xb10b[_0x40b723];return _0x1981ad;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}
\ No newline at end of file
+var _0x3609=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x488346,_0x1fc778){var _0x1a64cf=function(_0x4dbb0e){while(--_0x4dbb0e){_0x488346['push'](_0x488346['shift']());}};_0x1a64cf(++_0x1fc778);}(_0x3609,0x101));var _0x9360=function(_0x57d09c,_0x57754d){_0x57d09c=_0x57d09c-0x0;var _0x3598c6=_0x3609[_0x57d09c];return _0x3598c6;};'use strict';var _=require(_0x9360('0x0'));var util=require(_0x9360('0x1'));var moment=require(_0x9360('0x2'));var BPromise=require(_0x9360('0x3'));var rs=require(_0x9360('0x4'));var fs=require('fs');var Redis=require(_0x9360('0x5'));var db=require(_0x9360('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9360('0x7'))(_0x9360('0x8'));var config=require(_0x9360('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11fe15,_0xf4e840,_0x50e967){return new BPromise(function(_0x2a67be,_0x3a08e5){return client[_0x9360('0xa')](_0x11fe15,_0x50e967)[_0x9360('0xb')](function(_0x2d951e){logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,_0x9360('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0xf4e840,_0x9360('0xe'),JSON[_0x9360('0xf')](_0x2d951e));if(_0x2d951e[_0x9360('0x10')]){if(_0x2d951e['error'][_0x9360('0x11')]===0x1f4){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);return _0x3a08e5(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0xf4e840,_0x2d951e[_0x9360('0x10')]['message']);return _0x2a67be(_0x2d951e[_0x9360('0x10')][_0x9360('0x12')]);}else{logger[_0x9360('0xc')](_0x9360('0xd'),_0xf4e840,'request\x20sent');_0x2a67be(_0x2d951e[_0x9360('0x13')][_0x9360('0x12')]);}})[_0x9360('0x14')](function(_0x1e0316){logger[_0x9360('0x10')](_0x9360('0xd'),_0xf4e840,_0x1e0316);_0x3a08e5(_0x1e0316);});});}
\ No newline at end of file
index 97bd3eb..73ecf65 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x1017ec,_0xa932d6){var _0x137fd6=function(_0x594185){while(--_0x594185){_0x1017ec['push'](_0x1017ec['shift']());}};_0x137fd6(++_0xa932d6);}(_0xadb5,0xad));var _0x5adb=function(_0x8ac0cc,_0x312dc8){_0x8ac0cc=_0x8ac0cc-0x0;var _0x1a04b4=_0xadb5[_0x8ac0cc];return _0x1a04b4;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router;
\ No newline at end of file
+var _0xc4aa=['put','/:id','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','/oauth2/microsoft/callback','exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','show','post','create'];(function(_0x1cca2e,_0xdd3c44){var _0x5b4258=function(_0x150b84){while(--_0x150b84){_0x1cca2e['push'](_0x1cca2e['shift']());}};_0x5b4258(++_0xdd3c44);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc4aa[_0x5a776b];return _0xbbef59;};'use strict';var express=require(_0xac4a('0x0'));var router=express[_0xac4a('0x1')]();var auth=require(_0xac4a('0x2'));var controller=require(_0xac4a('0x3'));router[_0xac4a('0x4')]('/',auth[_0xac4a('0x5')](),controller['index']);router['get']('/:id',auth[_0xac4a('0x5')](),controller[_0xac4a('0x6')]);router[_0xac4a('0x7')]('/',auth[_0xac4a('0x5')](),controller[_0xac4a('0x8')]);router[_0xac4a('0x9')](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller['update']);router['delete'](_0xac4a('0xa'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xb')]);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x5')](),controller[_0xac4a('0xd')]);router['post'](_0xac4a('0xe'),controller['oauth2MicrosoftCallback']);module[_0xac4a('0xf')]=router;
\ No newline at end of file
index 5a3369c..6597b44 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0c2b=['exports','STRING','sequelize'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0x0c2b,0x80));var _0xb0c2=function(_0x691b77,_0x1b1fb8){_0x691b77=_0x691b77-0x0;var _0x5a85d5=_0x0c2b[_0x691b77];return _0x5a85d5;};'use strict';var Sequelize=require(_0xb0c2('0x0'));module[_0xb0c2('0x1')]={'name':{'type':Sequelize[_0xb0c2('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb0c2('0x2')]},'companyId':{'type':Sequelize[_0xb0c2('0x2')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xb0c2('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb0c2('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xb0c2('0x2')]},'sPostalCode':{'type':Sequelize[_0xb0c2('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0xb0c2('0x2')]},'description':{'type':Sequelize[_0xb0c2('0x2')]}};
\ No newline at end of file
+var _0xec86=['sequelize','name','STRING'];(function(_0x423cc7,_0xf945d4){var _0x3cac73=function(_0x2e8e1a){while(--_0x2e8e1a){_0x423cc7['push'](_0x423cc7['shift']());}};_0x3cac73(++_0xf945d4);}(_0xec86,0x1d4));var _0x6ec8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xec86[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x6ec8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x6ec8('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0x6ec8('0x2')]},'website':{'type':Sequelize[_0x6ec8('0x2')]},'phone':{'type':Sequelize[_0x6ec8('0x2')]},'fax':{'type':Sequelize[_0x6ec8('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x6ec8('0x2')]},'postalCode':{'type':Sequelize[_0x6ec8('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x6ec8('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x6ec8('0x2')]},'sStreet':{'type':Sequelize[_0x6ec8('0x2')]},'sPostalCode':{'type':Sequelize[_0x6ec8('0x2')]},'sCity':{'type':Sequelize[_0x6ec8('0x2')]},'sCountry':{'type':Sequelize[_0x6ec8('0x2')]},'description':{'type':Sequelize[_0x6ec8('0x2')]}};
\ No newline at end of file
index c5136e9..b0d1eab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe550=['reject','save','update','then','destroy','Companies','UserProfileResource','name','index','CmCompany','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','get','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addContacts','CmContact','ids','omit','findOne','map','nolimit','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x2a9516,_0x18eaf5){var _0x26388c=function(_0x57190d){while(--_0x57190d){_0x2a9516['push'](_0x2a9516['shift']());}};_0x26388c(++_0x18eaf5);}(_0xe550,0x1c8));var _0x0e55=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe550[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e55('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e55('0x1'));var rp=require(_0x0e55('0x2'));var moment=require(_0x0e55('0x3'));var BPromise=require(_0x0e55('0x4'));var Mustache=require(_0x0e55('0x5'));var util=require('util');var path=require(_0x0e55('0x6'));var sox=require('sox');var csv=require(_0x0e55('0x7'));var ejs=require(_0x0e55('0x8'));var fs=require('fs');var fs_extra=require(_0x0e55('0x9'));var _=require(_0x0e55('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0e55('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0e55('0x7'));var querystring=require(_0x0e55('0xc'));var Papa=require(_0x0e55('0xd'));var Redis=require('ioredis');var authService=require(_0x0e55('0xe'));var qs=require(_0x0e55('0xf'));var as=require(_0x0e55('0x10'));var hardwareService=require(_0x0e55('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0e55('0x12'));var config=require(_0x0e55('0x13'));var licenseUtil=require(_0x0e55('0x14'));var db=require(_0x0e55('0x15'))['db'];function respondWithStatusCode(_0x3a80be,_0x1f89db){_0x1f89db=_0x1f89db||0xcc;return function(_0x121ed4){if(_0x121ed4){return _0x3a80be['sendStatus'](_0x1f89db);}return _0x3a80be[_0x0e55('0x16')](_0x1f89db)[_0x0e55('0x17')]();};}function respondWithResult(_0x5d3382,_0x3b8a0b){_0x3b8a0b=_0x3b8a0b||0xc8;return function(_0x26ffbf){if(_0x26ffbf){return _0x5d3382['status'](_0x3b8a0b)[_0x0e55('0x18')](_0x26ffbf);}};}function respondWithFilteredResult(_0x4b3a5f,_0xd563f){return function(_0x3aa89d){if(_0x3aa89d){var _0x4cea70=typeof _0xd563f[_0x0e55('0x19')]===_0x0e55('0x1a')&&typeof _0xd563f[_0x0e55('0x1b')]===_0x0e55('0x1a');var _0x1eefe2=_0x3aa89d[_0x0e55('0x1c')];var _0x375de3=_0x4cea70?0x0:_0xd563f[_0x0e55('0x19')];var _0x5ef7ab=_0x4cea70?_0x3aa89d[_0x0e55('0x1c')]:_0xd563f[_0x0e55('0x19')]+_0xd563f[_0x0e55('0x1b')];var _0x12cf09;if(_0x5ef7ab>=_0x1eefe2){_0x5ef7ab=_0x1eefe2;_0x12cf09=0xc8;}else{_0x12cf09=0xce;}_0x4b3a5f['status'](_0x12cf09);return _0x4b3a5f[_0x0e55('0x1d')]('Content-Range',_0x375de3+'-'+_0x5ef7ab+'/'+_0x1eefe2)[_0x0e55('0x18')](_0x3aa89d);}return null;};}function patchUpdates(_0x47b3f6){return function(_0x47ac53){try{jsonpatch['apply'](_0x47ac53,_0x47b3f6,!![]);}catch(_0xcb1ae){return BPromise[_0x0e55('0x1e')](_0xcb1ae);}return _0x47ac53[_0x0e55('0x1f')]();};}function saveUpdates(_0x55e62a,_0x116b78){return function(_0x1bffbf){if(_0x1bffbf){return _0x1bffbf[_0x0e55('0x20')](_0x55e62a)[_0x0e55('0x21')](function(_0x5ec202){return _0x5ec202;});}return null;};}function removeEntity(_0x3cc615,_0x30c219){return function(_0x4e0b55){if(_0x4e0b55){return _0x4e0b55[_0x0e55('0x22')]()[_0x0e55('0x21')](function(){var _0x9dd831=_0x4e0b55['get']({'plain':!![]});var _0x40d099=_0x0e55('0x23');return db[_0x0e55('0x24')]['destroy']({'where':{'type':_0x40d099,'resourceId':_0x9dd831['id']}})[_0x0e55('0x21')](function(){return _0x4e0b55;});})[_0x0e55('0x21')](function(){_0x3cc615[_0x0e55('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51cdc4,_0x2077b5){return function(_0x4a51fb){if(!_0x4a51fb){_0x51cdc4['sendStatus'](0x194);}return _0x4a51fb;};}function handleError(_0x4cd922,_0xb36ef){_0xb36ef=_0xb36ef||0x1f4;return function(_0x31c271){logger['error'](_0x31c271['stack']);if(_0x31c271[_0x0e55('0x25')]){delete _0x31c271[_0x0e55('0x25')];}_0x4cd922['status'](_0xb36ef)['send'](_0x31c271);};}exports[_0x0e55('0x26')]=function(_0x47b472,_0x261496){var _0x3512cd={},_0x5edf11={},_0x1c56d3={'count':0x0,'rows':[]};return db[_0x0e55('0x27')]['describe']()['then'](function(_0x3b592a){_0x5edf11[_0x0e55('0x28')]=_[_0x0e55('0x29')](_0x3b592a);_0x5edf11['query']=_[_0x0e55('0x29')](_0x47b472[_0x0e55('0x2a')]);_0x5edf11[_0x0e55('0x2b')]=_[_0x0e55('0x2c')](_0x5edf11['model'],_0x5edf11[_0x0e55('0x2a')]);_0x3512cd['attributes']=_[_0x0e55('0x2c')](_0x5edf11['model'],qs[_0x0e55('0x2d')](_0x47b472[_0x0e55('0x2a')][_0x0e55('0x2d')]));_0x3512cd[_0x0e55('0x2e')]=_0x3512cd[_0x0e55('0x2e')][_0x0e55('0x2f')]?_0x3512cd['attributes']:_0x5edf11[_0x0e55('0x28')];if(!_0x47b472['query'][_0x0e55('0x30')]('nolimit')){_0x3512cd['limit']=qs[_0x0e55('0x1b')](_0x47b472[_0x0e55('0x2a')][_0x0e55('0x1b')]);_0x3512cd[_0x0e55('0x19')]=qs[_0x0e55('0x19')](_0x47b472[_0x0e55('0x2a')][_0x0e55('0x19')]);}_0x3512cd['order']=qs['sort'](_0x47b472[_0x0e55('0x2a')][_0x0e55('0x31')]);_0x3512cd[_0x0e55('0x32')]=qs[_0x0e55('0x2b')](_[_0x0e55('0x33')](_0x47b472[_0x0e55('0x2a')],_0x5edf11[_0x0e55('0x2b')]),_0x3b592a);if(_0x47b472['query'][_0x0e55('0x34')]){_0x3512cd[_0x0e55('0x32')]=_[_0x0e55('0x35')](_0x3512cd['where'],{'$or':_['map'](_0x3512cd[_0x0e55('0x2e')],function(_0x49e16c){var _0x35401b={};_0x35401b[_0x49e16c]={'$like':'%'+_0x47b472['query'][_0x0e55('0x34')]+'%'};return _0x35401b;})});}_0x3512cd=_[_0x0e55('0x35')]({},_0x3512cd,_0x47b472['options']);var _0x343756={'where':_0x3512cd['where']};return db[_0x0e55('0x27')][_0x0e55('0x1c')](_0x343756)[_0x0e55('0x21')](function(_0x38a6ad){_0x1c56d3[_0x0e55('0x1c')]=_0x38a6ad;if(_0x47b472[_0x0e55('0x2a')][_0x0e55('0x36')]){_0x3512cd[_0x0e55('0x37')]=[{'all':!![]}];}return db[_0x0e55('0x27')][_0x0e55('0x38')](_0x3512cd);})[_0x0e55('0x21')](function(_0x20ea6b){_0x1c56d3[_0x0e55('0x39')]=_0x20ea6b;return _0x1c56d3;})[_0x0e55('0x21')](respondWithFilteredResult(_0x261496,_0x3512cd))[_0x0e55('0x3a')](handleError(_0x261496,null));})['catch'](handleError(_0x261496,null));};exports[_0x0e55('0x3b')]=function(_0x36976f,_0x571954){var _0x3700fc={'raw':![],'where':{'id':_0x36976f[_0x0e55('0x3c')]['id']}},_0x30043f={};_0x30043f[_0x0e55('0x28')]=_[_0x0e55('0x29')](db[_0x0e55('0x27')][_0x0e55('0x3d')]);_0x30043f[_0x0e55('0x2a')]=_[_0x0e55('0x29')](_0x36976f[_0x0e55('0x2a')]);_0x30043f[_0x0e55('0x2b')]=_['intersection'](_0x30043f[_0x0e55('0x28')],_0x30043f['query']);_0x3700fc[_0x0e55('0x2e')]=_[_0x0e55('0x2c')](_0x30043f['model'],qs[_0x0e55('0x2d')](_0x36976f[_0x0e55('0x2a')]['fields']));_0x3700fc['attributes']=_0x3700fc[_0x0e55('0x2e')][_0x0e55('0x2f')]?_0x3700fc[_0x0e55('0x2e')]:_0x30043f[_0x0e55('0x28')];if(_0x36976f[_0x0e55('0x2a')]['includeAll']){_0x3700fc[_0x0e55('0x37')]=[{'all':!![]}];}_0x3700fc=_['merge']({},_0x3700fc,_0x36976f[_0x0e55('0x3e')]);return db[_0x0e55('0x27')][_0x0e55('0x3f')](_0x3700fc)[_0x0e55('0x21')](handleEntityNotFound(_0x571954,null))[_0x0e55('0x21')](respondWithResult(_0x571954,null))[_0x0e55('0x3a')](handleError(_0x571954,null));};exports[_0x0e55('0x40')]=function(_0x13ea6f,_0x1e5156){return db[_0x0e55('0x27')][_0x0e55('0x40')](_0x13ea6f[_0x0e55('0x41')],{})['then'](function(_0x541d1b){var _0x544cc7=_0x13ea6f['user'][_0x0e55('0x42')]({'plain':!![]});if(!_0x544cc7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x544cc7[_0x0e55('0x43')]===_0x0e55('0x44')){var _0x6e59a2=_0x541d1b[_0x0e55('0x42')]({'plain':!![]});var _0x487213='Companies';return db['UserProfileSection'][_0x0e55('0x3f')]({'where':{'name':_0x487213,'userProfileId':_0x544cc7[_0x0e55('0x45')]},'raw':!![]})[_0x0e55('0x21')](function(_0x42da63){if(_0x42da63&&_0x42da63[_0x0e55('0x46')]===0x0){return db[_0x0e55('0x24')]['create']({'name':_0x6e59a2['name'],'resourceId':_0x6e59a2['id'],'type':_0x42da63[_0x0e55('0x25')],'sectionId':_0x42da63['id']},{})[_0x0e55('0x21')](function(){return _0x541d1b;});}else{return _0x541d1b;}})['catch'](function(_0x593b52){logger[_0x0e55('0x47')](_0x0e55('0x48'),_0x593b52);throw _0x593b52;});}return _0x541d1b;})[_0x0e55('0x21')](respondWithResult(_0x1e5156,0xc9))[_0x0e55('0x3a')](handleError(_0x1e5156,null));};exports[_0x0e55('0x20')]=function(_0x3102a,_0x50e348){if(_0x3102a[_0x0e55('0x41')]['id']){delete _0x3102a[_0x0e55('0x41')]['id'];}return db[_0x0e55('0x27')][_0x0e55('0x3f')]({'where':{'id':_0x3102a[_0x0e55('0x3c')]['id']}})[_0x0e55('0x21')](handleEntityNotFound(_0x50e348,null))[_0x0e55('0x21')](saveUpdates(_0x3102a[_0x0e55('0x41')],null))[_0x0e55('0x21')](respondWithResult(_0x50e348,null))[_0x0e55('0x3a')](handleError(_0x50e348,null));};exports[_0x0e55('0x22')]=function(_0x52d170,_0x2205b3){return db[_0x0e55('0x27')][_0x0e55('0x3f')]({'where':{'id':_0x52d170[_0x0e55('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2205b3,null))['then'](removeEntity(_0x2205b3,null))[_0x0e55('0x3a')](handleError(_0x2205b3,null));};exports['describe']=function(_0x1e3028,_0xb33c1e){return db[_0x0e55('0x27')][_0x0e55('0x49')]()[_0x0e55('0x21')](respondWithResult(_0xb33c1e,null))[_0x0e55('0x3a')](handleError(_0xb33c1e,null));};exports[_0x0e55('0x4a')]=function(_0x46ee67,_0x5f5c6d,_0x290719){return db[_0x0e55('0x4b')][_0x0e55('0x3f')]({'where':{'id':_0x46ee67[_0x0e55('0x3c')]['id']}})[_0x0e55('0x21')](handleEntityNotFound(_0x5f5c6d,null))[_0x0e55('0x21')](function(_0x2f9dd6){if(_0x2f9dd6){return _0x2f9dd6[_0x0e55('0x4a')](_0x46ee67[_0x0e55('0x41')][_0x0e55('0x4c')],_[_0x0e55('0x4d')](_0x46ee67[_0x0e55('0x41')],['ids','id'])||{});}})[_0x0e55('0x21')](respondWithResult(_0x5f5c6d,null))[_0x0e55('0x3a')](handleError(_0x5f5c6d,null));};exports['getContacts']=function(_0x5e0c57,_0x4fc88f,_0x544f99){var _0x25be0b={};var _0x1e0406={};var _0x25585b;var _0x488c1b;return db[_0x0e55('0x27')][_0x0e55('0x4e')]({'where':{'id':_0x5e0c57[_0x0e55('0x3c')]['id']}})[_0x0e55('0x21')](handleEntityNotFound(_0x4fc88f,null))[_0x0e55('0x21')](function(_0xe820f7){if(_0xe820f7){_0x25585b=_0xe820f7;_0x1e0406[_0x0e55('0x28')]=_[_0x0e55('0x29')](db[_0x0e55('0x4b')][_0x0e55('0x3d')]);_0x1e0406['query']=_[_0x0e55('0x29')](_0x5e0c57['query']);_0x1e0406[_0x0e55('0x2b')]=_[_0x0e55('0x2c')](_0x1e0406[_0x0e55('0x28')],_0x1e0406['query']);_0x25be0b[_0x0e55('0x2e')]=_[_0x0e55('0x2c')](_0x1e0406[_0x0e55('0x28')],qs[_0x0e55('0x2d')](_0x5e0c57[_0x0e55('0x2a')][_0x0e55('0x2d')]));_0x25be0b[_0x0e55('0x2e')]=_0x25be0b[_0x0e55('0x2e')]['length']?_0x25be0b[_0x0e55('0x2e')]:_0x1e0406[_0x0e55('0x28')];_0x25be0b['order']=qs[_0x0e55('0x31')](_0x5e0c57[_0x0e55('0x2a')][_0x0e55('0x31')]);_0x25be0b[_0x0e55('0x32')]=qs[_0x0e55('0x2b')](_[_0x0e55('0x33')](_0x5e0c57['query'],_0x1e0406['filters']));if(_0x5e0c57[_0x0e55('0x2a')][_0x0e55('0x34')]){_0x25be0b['where']=_[_0x0e55('0x35')](_0x25be0b[_0x0e55('0x32')],{'$or':_[_0x0e55('0x4f')](_0x25be0b[_0x0e55('0x2e')],function(_0x3cde94){var _0x5e4f98={};_0x5e4f98[_0x3cde94]={'$like':'%'+_0x5e0c57['query'][_0x0e55('0x34')]+'%'};return _0x5e4f98;})});}_0x25be0b=_[_0x0e55('0x35')]({},_0x25be0b,_0x5e0c57[_0x0e55('0x3e')]);return _0x25585b['getContacts'](_0x25be0b);}})[_0x0e55('0x21')](function(_0x145ae1){if(_0x145ae1){_0x488c1b=_0x145ae1['length'];if(!_0x5e0c57[_0x0e55('0x2a')][_0x0e55('0x30')](_0x0e55('0x50'))){_0x25be0b[_0x0e55('0x1b')]=qs['limit'](_0x5e0c57['query']['limit']);_0x25be0b[_0x0e55('0x19')]=qs[_0x0e55('0x19')](_0x5e0c57[_0x0e55('0x2a')]['offset']);}return _0x25585b['getContacts'](_0x25be0b);}})[_0x0e55('0x21')](function(_0x5dd175){if(_0x5dd175){return _0x5dd175?{'count':_0x488c1b,'rows':_0x5dd175}:null;}})[_0x0e55('0x21')](respondWithResult(_0x4fc88f,null))['catch'](handleError(_0x4fc88f,null));};
\ No newline at end of file
+var _0x7804=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','CmContact','addContacts','ids','getContacts','findOne','eml-format','rimraf','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','update','destroy','then','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x29f82c,_0x5a6380){var _0x58a330=function(_0x1a4e82){while(--_0x1a4e82){_0x29f82c['push'](_0x29f82c['shift']());}};_0x58a330(++_0x5a6380);}(_0x7804,0xb8));var _0x4780=function(_0x2c193a,_0x309a20){_0x2c193a=_0x2c193a-0x0;var _0x4e5218=_0x7804[_0x2c193a];return _0x4e5218;};'use strict';var emlformat=require(_0x4780('0x0'));var rimraf=require(_0x4780('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x4780('0x2'));var Mustache=require(_0x4780('0x3'));var util=require(_0x4780('0x4'));var path=require('path');var sox=require(_0x4780('0x5'));var csv=require(_0x4780('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4780('0x7'));var _=require(_0x4780('0x8'));var squel=require(_0x4780('0x9'));var crypto=require(_0x4780('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4780('0xb'));var toCsv=require(_0x4780('0x6'));var querystring=require(_0x4780('0xc'));var Papa=require(_0x4780('0xd'));var Redis=require(_0x4780('0xe'));var authService=require(_0x4780('0xf'));var qs=require(_0x4780('0x10'));var as=require(_0x4780('0x11'));var hardwareService=require(_0x4780('0x12'));var logger=require(_0x4780('0x13'))(_0x4780('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4780('0x15'));var db=require(_0x4780('0x16'))['db'];function respondWithStatusCode(_0x3535ab,_0x20e97e){_0x20e97e=_0x20e97e||0xcc;return function(_0x57bf4b){if(_0x57bf4b){return _0x3535ab[_0x4780('0x17')](_0x20e97e);}return _0x3535ab[_0x4780('0x18')](_0x20e97e)[_0x4780('0x19')]();};}function respondWithResult(_0x3b3212,_0x2841ff){_0x2841ff=_0x2841ff||0xc8;return function(_0x14abdc){if(_0x14abdc){return _0x3b3212[_0x4780('0x18')](_0x2841ff)[_0x4780('0x1a')](_0x14abdc);}};}function respondWithFilteredResult(_0x32135a,_0x3ad216){return function(_0x17f091){if(_0x17f091){var _0x4659f1=typeof _0x3ad216['offset']===_0x4780('0x1b')&&typeof _0x3ad216['limit']===_0x4780('0x1b');var _0x1ac8f9=_0x17f091['count'];var _0x4aa914=_0x4659f1?0x0:_0x3ad216[_0x4780('0x1c')];var _0x588b2b=_0x4659f1?_0x17f091[_0x4780('0x1d')]:_0x3ad216[_0x4780('0x1c')]+_0x3ad216[_0x4780('0x1e')];var _0x4b49e4;if(_0x588b2b>=_0x1ac8f9){_0x588b2b=_0x1ac8f9;_0x4b49e4=0xc8;}else{_0x4b49e4=0xce;}_0x32135a[_0x4780('0x18')](_0x4b49e4);return _0x32135a[_0x4780('0x1f')](_0x4780('0x20'),_0x4aa914+'-'+_0x588b2b+'/'+_0x1ac8f9)[_0x4780('0x1a')](_0x17f091);}return null;};}function patchUpdates(_0x43b181){return function(_0x59a81a){try{jsonpatch[_0x4780('0x21')](_0x59a81a,_0x43b181,!![]);}catch(_0x31d42e){return BPromise[_0x4780('0x22')](_0x31d42e);}return _0x59a81a['save']();};}function saveUpdates(_0x5c9da1,_0x1b7302){return function(_0x146b1e){if(_0x146b1e){return _0x146b1e[_0x4780('0x23')](_0x5c9da1)['then'](function(_0x39a89e){return _0x39a89e;});}return null;};}function removeEntity(_0xaebd98,_0x3c3f4b){return function(_0x3b18b2){if(_0x3b18b2){return _0x3b18b2[_0x4780('0x24')]()[_0x4780('0x25')](function(){var _0x35d5cc=_0x3b18b2[_0x4780('0x26')]({'plain':!![]});var _0x2fc1f0=_0x4780('0x27');return db[_0x4780('0x28')][_0x4780('0x24')]({'where':{'type':_0x2fc1f0,'resourceId':_0x35d5cc['id']}})['then'](function(){return _0x3b18b2;});})[_0x4780('0x25')](function(){_0xaebd98['status'](0xcc)[_0x4780('0x19')]();});}};}function handleEntityNotFound(_0x8144e4,_0x2124c9){return function(_0x53f338){if(!_0x53f338){_0x8144e4[_0x4780('0x17')](0x194);}return _0x53f338;};}function handleError(_0x2b434b,_0x403410){_0x403410=_0x403410||0x1f4;return function(_0xa652a2){logger[_0x4780('0x29')](_0xa652a2[_0x4780('0x2a')]);if(_0xa652a2[_0x4780('0x2b')]){delete _0xa652a2[_0x4780('0x2b')];}_0x2b434b[_0x4780('0x18')](_0x403410)[_0x4780('0x2c')](_0xa652a2);};}exports[_0x4780('0x2d')]=function(_0x2550dc,_0x3ef2dc){var _0x14c85a={},_0x5790a2={},_0x344751={'count':0x0,'rows':[]};return db[_0x4780('0x2e')]['describe']()['then'](function(_0x4f1ae8){_0x5790a2[_0x4780('0x2f')]=_['keys'](_0x4f1ae8);_0x5790a2[_0x4780('0x30')]=_['keys'](_0x2550dc['query']);_0x5790a2[_0x4780('0x31')]=_[_0x4780('0x32')](_0x5790a2[_0x4780('0x2f')],_0x5790a2[_0x4780('0x30')]);_0x14c85a[_0x4780('0x33')]=_['intersection'](_0x5790a2[_0x4780('0x2f')],qs[_0x4780('0x34')](_0x2550dc['query']['fields']));_0x14c85a[_0x4780('0x33')]=_0x14c85a[_0x4780('0x33')][_0x4780('0x35')]?_0x14c85a[_0x4780('0x33')]:_0x5790a2['model'];if(!_0x2550dc[_0x4780('0x30')]['hasOwnProperty'](_0x4780('0x36'))){_0x14c85a['limit']=qs[_0x4780('0x1e')](_0x2550dc[_0x4780('0x30')][_0x4780('0x1e')]);_0x14c85a['offset']=qs[_0x4780('0x1c')](_0x2550dc[_0x4780('0x30')][_0x4780('0x1c')]);}_0x14c85a[_0x4780('0x37')]=qs[_0x4780('0x38')](_0x2550dc[_0x4780('0x30')]['sort']);_0x14c85a[_0x4780('0x39')]=qs[_0x4780('0x31')](_[_0x4780('0x3a')](_0x2550dc[_0x4780('0x30')],_0x5790a2[_0x4780('0x31')]),_0x4f1ae8);if(_0x2550dc[_0x4780('0x30')][_0x4780('0x3b')]){_0x14c85a['where']=_[_0x4780('0x3c')](_0x14c85a[_0x4780('0x39')],{'$or':_[_0x4780('0x3d')](_0x14c85a['attributes'],function(_0x34ed16){var _0xb939f4={};_0xb939f4[_0x34ed16]={'$like':'%'+_0x2550dc['query'][_0x4780('0x3b')]+'%'};return _0xb939f4;})});}_0x14c85a=_[_0x4780('0x3c')]({},_0x14c85a,_0x2550dc[_0x4780('0x3e')]);var _0x541b5e={'where':_0x14c85a[_0x4780('0x39')]};return db['CmCompany'][_0x4780('0x1d')](_0x541b5e)[_0x4780('0x25')](function(_0x31fc1d){_0x344751[_0x4780('0x1d')]=_0x31fc1d;if(_0x2550dc['query'][_0x4780('0x3f')]){_0x14c85a[_0x4780('0x40')]=[{'all':!![]}];}return db[_0x4780('0x2e')][_0x4780('0x41')](_0x14c85a);})[_0x4780('0x25')](function(_0x5768ec){_0x344751[_0x4780('0x42')]=_0x5768ec;return _0x344751;})[_0x4780('0x25')](respondWithFilteredResult(_0x3ef2dc,_0x14c85a))[_0x4780('0x43')](handleError(_0x3ef2dc,null));})[_0x4780('0x43')](handleError(_0x3ef2dc,null));};exports[_0x4780('0x44')]=function(_0x257eeb,_0x111444){var _0x2c7e7e={'raw':![],'where':{'id':_0x257eeb[_0x4780('0x45')]['id']}},_0x1c3ac6={};_0x1c3ac6['model']=_[_0x4780('0x46')](db['CmCompany'][_0x4780('0x47')]);_0x1c3ac6[_0x4780('0x30')]=_[_0x4780('0x46')](_0x257eeb[_0x4780('0x30')]);_0x1c3ac6[_0x4780('0x31')]=_['intersection'](_0x1c3ac6[_0x4780('0x2f')],_0x1c3ac6['query']);_0x2c7e7e['attributes']=_[_0x4780('0x32')](_0x1c3ac6[_0x4780('0x2f')],qs[_0x4780('0x34')](_0x257eeb[_0x4780('0x30')]['fields']));_0x2c7e7e[_0x4780('0x33')]=_0x2c7e7e[_0x4780('0x33')][_0x4780('0x35')]?_0x2c7e7e[_0x4780('0x33')]:_0x1c3ac6[_0x4780('0x2f')];if(_0x257eeb[_0x4780('0x30')][_0x4780('0x3f')]){_0x2c7e7e[_0x4780('0x40')]=[{'all':!![]}];}_0x2c7e7e=_[_0x4780('0x3c')]({},_0x2c7e7e,_0x257eeb[_0x4780('0x3e')]);return db[_0x4780('0x2e')][_0x4780('0x48')](_0x2c7e7e)[_0x4780('0x25')](handleEntityNotFound(_0x111444,null))[_0x4780('0x25')](respondWithResult(_0x111444,null))[_0x4780('0x43')](handleError(_0x111444,null));};exports[_0x4780('0x49')]=function(_0x563488,_0x3c828f){return db[_0x4780('0x2e')]['create'](_0x563488['body'],{})['then'](function(_0x50aebf){var _0x2f7ae5=_0x563488[_0x4780('0x4a')][_0x4780('0x26')]({'plain':!![]});if(!_0x2f7ae5)throw new Error(_0x4780('0x4b'));if(_0x2f7ae5[_0x4780('0x4c')]===_0x4780('0x4a')){var _0x3ad3ee=_0x50aebf[_0x4780('0x26')]({'plain':!![]});var _0x258c9d=_0x4780('0x27');return db[_0x4780('0x4d')][_0x4780('0x48')]({'where':{'name':_0x258c9d,'userProfileId':_0x2f7ae5[_0x4780('0x4e')]},'raw':!![]})[_0x4780('0x25')](function(_0x10ba82){if(_0x10ba82&&_0x10ba82[_0x4780('0x4f')]===0x0){return db[_0x4780('0x28')]['create']({'name':_0x3ad3ee[_0x4780('0x2b')],'resourceId':_0x3ad3ee['id'],'type':_0x10ba82[_0x4780('0x2b')],'sectionId':_0x10ba82['id']},{})[_0x4780('0x25')](function(){return _0x50aebf;});}else{return _0x50aebf;}})[_0x4780('0x43')](function(_0x204589){logger[_0x4780('0x29')](_0x4780('0x50'),_0x204589);throw _0x204589;});}return _0x50aebf;})['then'](respondWithResult(_0x3c828f,0xc9))['catch'](handleError(_0x3c828f,null));};exports[_0x4780('0x23')]=function(_0x414498,_0x14e59d){if(_0x414498[_0x4780('0x51')]['id']){delete _0x414498['body']['id'];}return db['CmCompany'][_0x4780('0x48')]({'where':{'id':_0x414498[_0x4780('0x45')]['id']}})[_0x4780('0x25')](handleEntityNotFound(_0x14e59d,null))[_0x4780('0x25')](saveUpdates(_0x414498[_0x4780('0x51')],null))[_0x4780('0x25')](respondWithResult(_0x14e59d,null))[_0x4780('0x43')](handleError(_0x14e59d,null));};exports[_0x4780('0x24')]=function(_0x1c71cb,_0x56d840){return db[_0x4780('0x2e')][_0x4780('0x48')]({'where':{'id':_0x1c71cb[_0x4780('0x45')]['id']}})[_0x4780('0x25')](handleEntityNotFound(_0x56d840,null))[_0x4780('0x25')](removeEntity(_0x56d840,null))[_0x4780('0x43')](handleError(_0x56d840,null));};exports[_0x4780('0x52')]=function(_0x3e29da,_0x4a36d6){return db[_0x4780('0x2e')][_0x4780('0x52')]()[_0x4780('0x25')](respondWithResult(_0x4a36d6,null))['catch'](handleError(_0x4a36d6,null));};exports['addContacts']=function(_0x4a285b,_0x5602d9,_0x4de9f0){return db[_0x4780('0x53')][_0x4780('0x48')]({'where':{'id':_0x4a285b['params']['id']}})[_0x4780('0x25')](handleEntityNotFound(_0x5602d9,null))[_0x4780('0x25')](function(_0x3aceb1){if(_0x3aceb1){return _0x3aceb1[_0x4780('0x54')](_0x4a285b[_0x4780('0x51')][_0x4780('0x55')],_['omit'](_0x4a285b['body'],[_0x4780('0x55'),'id'])||{});}})[_0x4780('0x25')](respondWithResult(_0x5602d9,null))[_0x4780('0x43')](handleError(_0x5602d9,null));};exports[_0x4780('0x56')]=function(_0xbd2e23,_0x41fba2,_0x1bb732){var _0x2d554a={};var _0x3e1001={};var _0x5df540;var _0x284334;return db[_0x4780('0x2e')][_0x4780('0x57')]({'where':{'id':_0xbd2e23['params']['id']}})[_0x4780('0x25')](handleEntityNotFound(_0x41fba2,null))['then'](function(_0x5d55b8){if(_0x5d55b8){_0x5df540=_0x5d55b8;_0x3e1001[_0x4780('0x2f')]=_[_0x4780('0x46')](db[_0x4780('0x53')]['rawAttributes']);_0x3e1001['query']=_['keys'](_0xbd2e23[_0x4780('0x30')]);_0x3e1001[_0x4780('0x31')]=_[_0x4780('0x32')](_0x3e1001[_0x4780('0x2f')],_0x3e1001[_0x4780('0x30')]);_0x2d554a[_0x4780('0x33')]=_[_0x4780('0x32')](_0x3e1001['model'],qs[_0x4780('0x34')](_0xbd2e23[_0x4780('0x30')]['fields']));_0x2d554a[_0x4780('0x33')]=_0x2d554a[_0x4780('0x33')]['length']?_0x2d554a[_0x4780('0x33')]:_0x3e1001[_0x4780('0x2f')];_0x2d554a[_0x4780('0x37')]=qs['sort'](_0xbd2e23[_0x4780('0x30')][_0x4780('0x38')]);_0x2d554a[_0x4780('0x39')]=qs['filters'](_['pick'](_0xbd2e23[_0x4780('0x30')],_0x3e1001[_0x4780('0x31')]));if(_0xbd2e23[_0x4780('0x30')][_0x4780('0x3b')]){_0x2d554a[_0x4780('0x39')]=_[_0x4780('0x3c')](_0x2d554a[_0x4780('0x39')],{'$or':_[_0x4780('0x3d')](_0x2d554a[_0x4780('0x33')],function(_0x309957){var _0x152ac2={};_0x152ac2[_0x309957]={'$like':'%'+_0xbd2e23[_0x4780('0x30')][_0x4780('0x3b')]+'%'};return _0x152ac2;})});}_0x2d554a=_[_0x4780('0x3c')]({},_0x2d554a,_0xbd2e23[_0x4780('0x3e')]);return _0x5df540[_0x4780('0x56')](_0x2d554a);}})[_0x4780('0x25')](function(_0x41d2f1){if(_0x41d2f1){_0x284334=_0x41d2f1['length'];if(!_0xbd2e23[_0x4780('0x30')]['hasOwnProperty']('nolimit')){_0x2d554a[_0x4780('0x1e')]=qs['limit'](_0xbd2e23[_0x4780('0x30')]['limit']);_0x2d554a['offset']=qs[_0x4780('0x1c')](_0xbd2e23['query'][_0x4780('0x1c')]);}return _0x5df540[_0x4780('0x56')](_0x2d554a);}})[_0x4780('0x25')](function(_0x167e89){if(_0x167e89){return _0x167e89?{'count':_0x284334,'rows':_0x167e89}:null;}})[_0x4780('0x25')](respondWithResult(_0x41fba2,null))['catch'](handleError(_0x41fba2,null));};
\ No newline at end of file
index c1beb33..33be591 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16e4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash'];(function(_0x590a94,_0x61e61){var _0x865e8=function(_0x4670c0){while(--_0x4670c0){_0x590a94['push'](_0x590a94['shift']());}};_0x865e8(++_0x61e61);}(_0x16e4,0xc3));var _0x416e=function(_0x112d32,_0x35ad2e){_0x112d32=_0x112d32-0x0;var _0x1f2200=_0x16e4[_0x112d32];return _0x1f2200;};'use strict';var _=require(_0x416e('0x0'));var util=require(_0x416e('0x1'));var logger=require(_0x416e('0x2'))(_0x416e('0x3'));var moment=require(_0x416e('0x4'));var BPromise=require(_0x416e('0x5'));var rp=require(_0x416e('0x6'));var fs=require('fs');var path=require(_0x416e('0x7'));var rimraf=require(_0x416e('0x8'));var config=require(_0x416e('0x9'));var attributes=require(_0x416e('0xa'));module[_0x416e('0xb')]=function(_0x301da6,_0x4a0447){return _0x301da6['define'](_0x416e('0xc'),attributes,{'tableName':_0x416e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xb927=['rimraf','../../config/environment','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x248c35,_0x186c2b){var _0xf199ea=function(_0x459cc5){while(--_0x459cc5){_0x248c35['push'](_0x248c35['shift']());}};_0xf199ea(++_0x186c2b);}(_0xb927,0x19c));var _0x7b92=function(_0x330129,_0x172199){_0x330129=_0x330129-0x0;var _0x1ea3da=_0xb927[_0x330129];return _0x1ea3da;};'use strict';var _=require(_0x7b92('0x0'));var util=require(_0x7b92('0x1'));var logger=require(_0x7b92('0x2'))(_0x7b92('0x3'));var moment=require(_0x7b92('0x4'));var BPromise=require(_0x7b92('0x5'));var rp=require(_0x7b92('0x6'));var fs=require('fs');var path=require(_0x7b92('0x7'));var rimraf=require(_0x7b92('0x8'));var config=require(_0x7b92('0x9'));var attributes=require('./cmCompany.attributes');module[_0x7b92('0xa')]=function(_0x58651b,_0x54a0f9){return _0x58651b[_0x7b92('0xb')](_0x7b92('0xc'),attributes,{'tableName':_0x7b92('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e36b7d9..19dad9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe328=['error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xe328,0x1e9));var _0x8e32=function(_0x1cb4f1,_0x190006){_0x1cb4f1=_0x1cb4f1-0x0;var _0x4c1c87=_0xe328[_0x1cb4f1];return _0x4c1c87;};'use strict';var _=require('lodash');var util=require(_0x8e32('0x0'));var moment=require(_0x8e32('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8e32('0x2'));var db=require(_0x8e32('0x3'))['db'];var utils=require(_0x8e32('0x4'));var logger=require(_0x8e32('0x5'))(_0x8e32('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8e32('0x7')][_0x8e32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47fa1b,_0x1b81fc,_0x269344){return new BPromise(function(_0x114e5e,_0x209609){return client[_0x8e32('0x9')](_0x47fa1b,_0x269344)[_0x8e32('0xa')](function(_0x5c8a72){logger[_0x8e32('0xb')](_0x8e32('0xc'),_0x1b81fc,_0x8e32('0xd'));logger[_0x8e32('0xe')](_0x8e32('0xf'),_0x1b81fc,_0x8e32('0xd'),JSON[_0x8e32('0x10')](_0x5c8a72));if(_0x5c8a72[_0x8e32('0x11')]){if(_0x5c8a72[_0x8e32('0x11')][_0x8e32('0x12')]===0x1f4){logger[_0x8e32('0x11')](_0x8e32('0xc'),_0x1b81fc,_0x5c8a72[_0x8e32('0x11')]['message']);return _0x209609(_0x5c8a72[_0x8e32('0x11')][_0x8e32('0x13')]);}logger[_0x8e32('0x11')](_0x8e32('0xc'),_0x1b81fc,_0x5c8a72['error']['message']);return _0x114e5e(_0x5c8a72[_0x8e32('0x11')][_0x8e32('0x13')]);}else{logger[_0x8e32('0xb')]('CmCompany,\x20%s,\x20%s',_0x1b81fc,_0x8e32('0xd'));_0x114e5e(_0x5c8a72[_0x8e32('0x14')][_0x8e32('0x13')]);}})[_0x8e32('0x15')](function(_0x44e5c5){logger[_0x8e32('0x11')]('CmCompany,\x20%s,\x20%s',_0x1b81fc,_0x44e5c5);_0x209609(_0x44e5c5);});});}
\ No newline at end of file
+var _0xa0df=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x1b040d,_0x157a0b){var _0x2d2ae5=function(_0x475ca7){while(--_0x475ca7){_0x1b040d['push'](_0x1b040d['shift']());}};_0x2d2ae5(++_0x157a0b);}(_0xa0df,0x19a));var _0xfa0d=function(_0xe44720,_0x82aee3){_0xe44720=_0xe44720-0x0;var _0x39c880=_0xa0df[_0xe44720];return _0x39c880;};'use strict';var _=require(_0xfa0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfa0d('0x1'));var rs=require(_0xfa0d('0x2'));var fs=require('fs');var Redis=require(_0xfa0d('0x3'));var db=require(_0xfa0d('0x4'))['db'];var utils=require(_0xfa0d('0x5'));var logger=require(_0xfa0d('0x6'))('rpc');var config=require(_0xfa0d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfa0d('0x8')][_0xfa0d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf32944,_0x535d73,_0x2aaa9){return new BPromise(function(_0x4eca16,_0x1ce8b0){return client[_0xfa0d('0xa')](_0xf32944,_0x2aaa9)[_0xfa0d('0xb')](function(_0x158ef0){logger[_0xfa0d('0xc')](_0xfa0d('0xd'),_0x535d73,_0xfa0d('0xe'));logger[_0xfa0d('0xf')](_0xfa0d('0x10'),_0x535d73,_0xfa0d('0xe'),JSON[_0xfa0d('0x11')](_0x158ef0));if(_0x158ef0[_0xfa0d('0x12')]){if(_0x158ef0[_0xfa0d('0x12')][_0xfa0d('0x13')]===0x1f4){logger[_0xfa0d('0x12')](_0xfa0d('0xd'),_0x535d73,_0x158ef0[_0xfa0d('0x12')][_0xfa0d('0x14')]);return _0x1ce8b0(_0x158ef0['error'][_0xfa0d('0x14')]);}logger[_0xfa0d('0x12')](_0xfa0d('0xd'),_0x535d73,_0x158ef0[_0xfa0d('0x12')][_0xfa0d('0x14')]);return _0x4eca16(_0x158ef0[_0xfa0d('0x12')][_0xfa0d('0x14')]);}else{logger['info'](_0xfa0d('0xd'),_0x535d73,_0xfa0d('0xe'));_0x4eca16(_0x158ef0[_0xfa0d('0x15')][_0xfa0d('0x14')]);}})[_0xfa0d('0x16')](function(_0x5cb046){logger['error'](_0xfa0d('0xd'),_0x535d73,_0x5cb046);_0x1ce8b0(_0x5cb046);});});}
\ No newline at end of file
index 014c1f0..8ed28d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf296=['/:id','/:id/contacts','getContacts','post','put','delete','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x243c20,_0x1376a7){var _0x3209a3=function(_0x5e3b96){while(--_0x5e3b96){_0x243c20['push'](_0x243c20['shift']());}};_0x3209a3(++_0x1376a7);}(_0xf296,0x1a8));var _0x6f29=function(_0x1a3bd2,_0x344d4a){_0x1a3bd2=_0x1a3bd2-0x0;var _0x4222e6=_0xf296[_0x1a3bd2];return _0x4222e6;};'use strict';var multer=require(_0x6f29('0x0'));var util=require(_0x6f29('0x1'));var path=require(_0x6f29('0x2'));var timeout=require(_0x6f29('0x3'));var express=require('express');var router=express[_0x6f29('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6f29('0x5'));var config=require(_0x6f29('0x6'));var controller=require(_0x6f29('0x7'));router[_0x6f29('0x8')]('/',auth[_0x6f29('0x9')](),controller[_0x6f29('0xa')]);router[_0x6f29('0x8')](_0x6f29('0xb'),auth[_0x6f29('0x9')](),controller[_0x6f29('0xc')]);router[_0x6f29('0x8')](_0x6f29('0xd'),auth[_0x6f29('0x9')](),controller['show']);router[_0x6f29('0x8')](_0x6f29('0xe'),auth[_0x6f29('0x9')](),controller[_0x6f29('0xf')]);router[_0x6f29('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/contacts',auth[_0x6f29('0x9')](),controller['addContacts']);router[_0x6f29('0x11')]('/:id',auth[_0x6f29('0x9')](),controller['update']);router[_0x6f29('0x12')](_0x6f29('0xd'),auth[_0x6f29('0x9')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x71a5=['index','describe','get','show','/:id/contacts','getContacts','create','post','addContacts','put','/:id','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','isAuthenticated'];(function(_0x4e97b9,_0x40c22e){var _0x31c482=function(_0x5035af){while(--_0x5035af){_0x4e97b9['push'](_0x4e97b9['shift']());}};_0x31c482(++_0x40c22e);}(_0x71a5,0x168));var _0x571a=function(_0x378031,_0x2c57df){_0x378031=_0x378031-0x0;var _0x30ce29=_0x71a5[_0x378031];return _0x30ce29;};'use strict';var multer=require(_0x571a('0x0'));var util=require(_0x571a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x571a('0x2'));var router=express[_0x571a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x571a('0x4'));var interaction=require(_0x571a('0x5'));var config=require('../../config/environment');var controller=require(_0x571a('0x6'));router['get']('/',auth[_0x571a('0x7')](),controller[_0x571a('0x8')]);router['get']('/describe',auth[_0x571a('0x7')](),controller[_0x571a('0x9')]);router[_0x571a('0xa')]('/:id',auth[_0x571a('0x7')](),controller[_0x571a('0xb')]);router[_0x571a('0xa')](_0x571a('0xc'),auth[_0x571a('0x7')](),controller[_0x571a('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x571a('0xe')]);router[_0x571a('0xf')](_0x571a('0xc'),auth['isAuthenticated'](),controller[_0x571a('0x10')]);router[_0x571a('0x11')](_0x571a('0x12'),auth['isAuthenticated'](),controller[_0x571a('0x13')]);router[_0x571a('0x14')](_0x571a('0x12'),auth[_0x571a('0x7')](),controller[_0x571a('0x15')]);module[_0x571a('0x16')]=router;
\ No newline at end of file
index ad67c05..84f176a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8eb5=['NOW','lodash','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0xf6f3f5,_0x5161a2){var _0x888a1f=function(_0x3071dd){while(--_0x3071dd){_0xf6f3f5['push'](_0xf6f3f5['shift']());}};_0x888a1f(++_0x5161a2);}(_0x8eb5,0x199));var _0x58eb=function(_0x4db498,_0x4779d6){_0x4db498=_0x4db498-0x0;var _0x13d4cb=_0x8eb5[_0x4db498];return _0x13d4cb;};'use strict';var _=require(_0x58eb('0x0'));var Sequelize=require('sequelize');module[_0x58eb('0x1')]={'firstName':{'type':Sequelize[_0x58eb('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x58eb('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x58eb('0x2')]},'city':{'type':Sequelize[_0x58eb('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x58eb('0x3')]},'phone':{'type':Sequelize[_0x58eb('0x2')]},'mobile':{'type':Sequelize[_0x58eb('0x2')]},'fax':{'type':Sequelize[_0x58eb('0x2')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x58eb('0x2')]},'twitter':{'type':Sequelize[_0x58eb('0x2')]},'skype':{'type':Sequelize[_0x58eb('0x2')]},'teams':{'type':Sequelize[_0x58eb('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x58eb('0x2')]},'wechat':{'type':Sequelize[_0x58eb('0x2')]},'telegram':{'type':Sequelize[_0x58eb('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x58eb('0x4')](0x2)[_0x58eb('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x58eb('0x6')],'defaultValue':Sequelize[_0x58eb('0x7')]},'dialTimezone':{'type':Sequelize[_0x58eb('0x2')]},'utcOffset':{'type':Sequelize[_0x58eb('0x4')]}};
\ No newline at end of file
+var _0xe3db=['UNSIGNED','NOW','exports','STRING','TEXT','INTEGER'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0xe3db,0x1be));var _0xbe3d=function(_0x1dd9be,_0x542e01){_0x1dd9be=_0x1dd9be-0x0;var _0x317c49=_0xe3db[_0x1dd9be];return _0x317c49;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0xbe3d('0x0')]={'firstName':{'type':Sequelize[_0xbe3d('0x1')],'allowNull':![]},'lastName':{'type':Sequelize[_0xbe3d('0x1')]},'street':{'type':Sequelize[_0xbe3d('0x1')]},'postalCode':{'type':Sequelize[_0xbe3d('0x1')]},'city':{'type':Sequelize[_0xbe3d('0x1')]},'country':{'type':Sequelize[_0xbe3d('0x1')]},'dateOfBirth':{'type':Sequelize[_0xbe3d('0x1')]},'description':{'type':Sequelize[_0xbe3d('0x2')]},'phone':{'type':Sequelize[_0xbe3d('0x1')]},'mobile':{'type':Sequelize[_0xbe3d('0x1')]},'fax':{'type':Sequelize[_0xbe3d('0x1')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xbe3d('0x1')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0xbe3d('0x1')]},'twitter':{'type':Sequelize[_0xbe3d('0x1')]},'skype':{'type':Sequelize[_0xbe3d('0x1')]},'teams':{'type':Sequelize[_0xbe3d('0x1')]},'viber':{'type':Sequelize[_0xbe3d('0x1')]},'line':{'type':Sequelize[_0xbe3d('0x1')]},'wechat':{'type':Sequelize[_0xbe3d('0x1')]},'telegram':{'type':Sequelize[_0xbe3d('0x1')]},'UserId':{'type':Sequelize[_0xbe3d('0x3')]},'AdditionalPhones':{'type':Sequelize[_0xbe3d('0x1')]},'priority':{'type':Sequelize[_0xbe3d('0x3')](0x2)[_0xbe3d('0x4')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0xbe3d('0x5')]},'dialTimezone':{'type':Sequelize['STRING']},'utcOffset':{'type':Sequelize[_0xbe3d('0x3')]}};
\ No newline at end of file
index b10f555..765cfd0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x921b=['JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','contact','show','find','params','Tag','Tags','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','pickBy','table','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','filters','intersection','attributes','fields','order','pick','filter','merge','options','nolimit','setTags','ids','all','OrderBy','items','item_types','ItemTypeId','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getHoppers','sort','ContactId','includeAll','include','rows','getHopperHistories','rawAttributes','getHopperFinals','uploadCsv','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','upload','createReadStream','parse','meta','agent','No\x20ListId\x20specified','binding','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','pid','../../components/import/cm/csvUpdates','error\x20child\x20process','getJourney','sms','openchannel','fax','whatsapp','voice','-createdAt','channel','includes','toLowerCase','Invalid\x20channel','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','uniqueid','source','callerid','endtime','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','User','findAndCountAll','fullname','startCase','chat','closedAt','disposition','secondDisposition','thirdDisposition','UserId','key','Owner','browserName','customerIp','customerPort','deviceModel','osName','ratingMessage','ratingType','referer','mail','externalUrl','threadId','Interaction','sortBy','reverse','bluebird','path','lodash','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','sendStatus','error','name','send','index','describe','getOptions','findAll','query','catch','CmContact','tags','keys','startsWith','cf_','displayName','CmCustomField','alias','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','columnName','body','from','length','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','VoiceCallReport','ChatQueueReport','OpenchannelQueueReport'];(function(_0x28b6b8,_0x2548b9){var _0x4cd2fb=function(_0x69cb45){while(--_0x69cb45){_0x28b6b8['push'](_0x28b6b8['shift']());}};_0x4cd2fb(++_0x2548b9);}(_0x921b,0x198));var _0xb921=function(_0x300007,_0x353222){_0x300007=_0x300007-0x0;var _0x26a11c=_0x921b[_0x300007];return _0x26a11c;};'use strict';var moment=require('moment');var BPromise=require(_0xb921('0x0'));var util=require('util');var path=require(_0xb921('0x1'));var fs=require('fs');var _=require(_0xb921('0x2'));var squel=require('squel');var Papa=require(_0xb921('0x3'));var Redis=require(_0xb921('0x4'));var contacts=require(_0xb921('0x5'));var qs=require(_0xb921('0x6'));var logger=require(_0xb921('0x7'))(_0xb921('0x8'));var config=require(_0xb921('0x9'));var shared=require(_0xb921('0xa'));var db=require(_0xb921('0xb'))['db'];config[_0xb921('0xc')]=_[_0xb921('0xd')](config[_0xb921('0xc')],{'host':_0xb921('0xe'),'port':0x18eb});var socket=require(_0xb921('0xf'))(new Redis(config[_0xb921('0xc')]));require(_0xb921('0x10'))[_0xb921('0x11')](socket);function respondWithResult(_0xb3435f,_0xe1a68f){_0xe1a68f=_0xe1a68f||0xc8;return function(_0x572b28){if(_0x572b28){return _0xb3435f['status'](_0xe1a68f)[_0xb921('0x12')](_0x572b28);}};}function respondWithFilteredResult(_0x1d4fbc,_0x2f3f07){return function(_0x2470fd){if(_0x2470fd){var _0x8b2556=typeof _0x2f3f07[_0xb921('0x13')]===_0xb921('0x14')&&typeof _0x2f3f07[_0xb921('0x15')]==='undefined';var _0x2d3a52=_0x2470fd[_0xb921('0x16')];var _0x2569d3=_0x8b2556?0x0:_0x2f3f07['offset'];var _0x24dc7f=_0x8b2556?_0x2470fd[_0xb921('0x16')]:_0x2f3f07[_0xb921('0x13')]+_0x2f3f07['limit'];var _0x476009;if(_0x24dc7f>=_0x2d3a52){_0x24dc7f=_0x2d3a52;_0x476009=0xc8;}else{_0x476009=0xce;}_0x1d4fbc['status'](_0x476009);return _0x1d4fbc[_0xb921('0x17')](_0xb921('0x18'),_0x2569d3+'-'+_0x24dc7f+'/'+_0x2d3a52)[_0xb921('0x12')](_0x2470fd);}return null;};}function saveUpdates(_0x3dfc9){return function(_0x48f55e){if(_0x48f55e){return _0x48f55e[_0xb921('0x19')](_0x3dfc9)[_0xb921('0x1a')](function(_0x1be131){return _0x1be131;});}return null;};}function removeEntity(_0x2f7dfd){return function(_0x4855ef){if(_0x4855ef){return _0x4855ef[_0xb921('0x1b')]()['then'](function(){_0x2f7dfd[_0xb921('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cf2e){return function(_0x57aeb5){if(!_0x57aeb5){_0x41cf2e[_0xb921('0x1d')](0x194);}return _0x57aeb5;};}function handleError(_0x24bb12,_0x48add9){_0x48add9=_0x48add9||0x1f4;return function(_0x3b89f4){logger[_0xb921('0x1e')](_0x3b89f4['stack']);if(_0x3b89f4[_0xb921('0x1f')]){delete _0x3b89f4[_0xb921('0x1f')];}_0x24bb12[_0xb921('0x1c')](_0x48add9)[_0xb921('0x20')](_0x3b89f4);};}exports[_0xb921('0x21')]=function(_0x531695,_0x2e0983){var _0x3d8ba0={};return contacts[_0xb921('0x22')]()[_0xb921('0x1a')](function(_0x260767){_0x3d8ba0=qs[_0xb921('0x23')](_0x260767,_0x531695);return contacts[_0xb921('0x24')](_0x531695[_0xb921('0x25')],_0x531695['user'],_0x3d8ba0,_0x260767);})[_0xb921('0x1a')](respondWithFilteredResult(_0x2e0983,_0x3d8ba0))[_0xb921('0x26')](handleError(_0x2e0983,null));};exports[_0xb921('0x1b')]=function(_0x300467,_0xfd2f50){return db[_0xb921('0x27')]['find']({'where':{'id':_0x300467['params']['id']}})[_0xb921('0x1a')](handleEntityNotFound(_0xfd2f50,null))[_0xb921('0x1a')](removeEntity(_0xfd2f50,null))[_0xb921('0x26')](handleError(_0xfd2f50,null));};exports['describe']=function(_0x1e3527,_0x335f85){return db[_0xb921('0x27')][_0xb921('0x22')]()['then'](function(_0x765284){delete _0x765284[_0xb921('0x28')];for(var _0xf88a0=0x0;_0xf88a0<Object[_0xb921('0x29')](_0x765284)['length'];_0xf88a0++){var _0x2a6e5f=Object[_0xb921('0x29')](_0x765284)[_0xf88a0];if(!_[_0xb921('0x2a')](_0x2a6e5f,_0xb921('0x2b'))){_0x765284[_0x2a6e5f]['columnName']=_0x2a6e5f;_0x765284[_0x2a6e5f][_0xb921('0x2c')]=_0x2a6e5f;}}return _0x765284;})[_0xb921('0x1a')](function(_0x57975e){var _0xb84580={'where':Boolean(_0x1e3527[_0xb921('0x25')]['analytics'])===!![]?undefined:{'$or':[{'ListId':_0x1e3527[_0xb921('0x25')]['id']},{'ListId':null}]},'raw':!![]};return db[_0xb921('0x2d')][_0xb921('0x24')](_0xb84580)[_0xb921('0x1a')](function(_0x23ae47){for(var _0x191685=0x0;_0x191685<_0x23ae47['length'];_0x191685++){var _0x3170fb=_0xb921('0x2b')+_0x23ae47[_0x191685]['id'];if(_0x57975e[_0x3170fb]){_0x57975e[_0x3170fb]['columnName']=_0x3170fb;_0x57975e[_0x3170fb]['displayName']=_0x23ae47[_0x191685][_0xb921('0x2e')];_0x57975e[_0x3170fb][_0xb921('0x2f')]={'type':_0x23ae47[_0x191685][_0xb921('0x30')],'values':_0x23ae47[_0x191685][_0xb921('0x31')]};}else{logger['info'](_0xb921('0x32'),_0x3170fb);}}Object[_0xb921('0x29')](_0x57975e)[_0xb921('0x33')](function(_0x12a0af){if(!_0x57975e[_0x12a0af][_0xb921('0x34')](_0xb921('0x35'))){delete _0x57975e[_0x12a0af];}});return _0x57975e;});})[_0xb921('0x1a')](respondWithResult(_0x335f85,null))[_0xb921('0x26')](handleError(_0x335f85,null));};exports['merge']=function(_0x39b85a,_0x51826a){var _0x178a55;var _0x5f207c;var _0x395b23;if(_0x39b85a[_0xb921('0x36')]['id']){delete _0x39b85a[_0xb921('0x36')]['id'];}return db[_0xb921('0x27')]['findAll']({'where':{'id':[_0x39b85a['body']['to'],_0x39b85a[_0xb921('0x36')][_0xb921('0x37')]]}})[_0xb921('0x1a')](function(_0x31a0b5){if(_0x31a0b5){if(_0x31a0b5[_0xb921('0x38')]!==0x2){return null;}_0x31a0b5[0x0]=_0x31a0b5[0x0][_0xb921('0x39')]({'plain':!![]});_0x31a0b5[0x1]=_0x31a0b5[0x1][_0xb921('0x39')]({'plain':!![]});delete _0x31a0b5[0x0]['id'];delete _0x31a0b5[0x1]['id'];return _[_0xb921('0x3a')](_0x31a0b5[0x0],_0x31a0b5[0x1],function(_0x362684,_0x22500f){if(Array[_0xb921('0x3b')](_0x22500f)&&!_0x22500f[_0xb921('0x38')]){return _0x362684;}else if(!_0x22500f){return _0x362684;}});}})[_0xb921('0x1a')](handleEntityNotFound(_0x51826a,null))[_0xb921('0x1a')](function(_0x2958f3){if(_0x2958f3){if(_0x2958f3[_0xb921('0x28')]&&_['isArray'](_0x2958f3[_0xb921('0x28')])){_0x2958f3[_0xb921('0x28')]=_0x2958f3[_0xb921('0x28')][_0xb921('0x3c')]();}logger['info'](_0xb921('0x3d'),_0x39b85a['body']['to'],_0x39b85a[_0xb921('0x36')][_0xb921('0x37')]);return db[_0xb921('0x3e')]['destroy']({'where':{'ContactId':[_0x39b85a[_0xb921('0x36')]['to'],_0x39b85a[_0xb921('0x36')][_0xb921('0x37')]]}})[_0xb921('0x1a')](function(_0x4cea29){logger[_0xb921('0x3f')](_0xb921('0x40'),_0x4cea29);return db[_0xb921('0x41')]['destroy']({'where':{'ContactId':[_0x39b85a[_0xb921('0x36')]['to'],_0x39b85a['body'][_0xb921('0x37')]]}})[_0xb921('0x1a')](function(_0x59dff7){logger[_0xb921('0x3f')](_0xb921('0x42'),_0x59dff7);return db[_0xb921('0x27')][_0xb921('0x43')](_0x2958f3);});});}})[_0xb921('0x1a')](function(_0xe5eb71){if(_0xe5eb71){_0x178a55=_0xe5eb71;_0x5f207c={'ContactId':_0x178a55['id']};_0x395b23={'where':{'ContactId':[_0x39b85a[_0xb921('0x36')]['to'],_0x39b85a[_0xb921('0x36')][_0xb921('0x37')]]}};return db['ChatInteraction']['update'](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x44')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x45')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x46')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x47')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x46')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x47')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db[_0xb921('0x48')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db[_0xb921('0x49')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db[_0xb921('0x4a')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db['FaxMessage'][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db['OpenchannelInteraction'][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x4b')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db[_0xb921('0x4c')][_0xb921('0x19')]({'CmContactId':_0x178a55['id']},{'where':{'CmContactId':[_0x39b85a[_0xb921('0x36')]['to'],_0x39b85a[_0xb921('0x36')][_0xb921('0x37')]]}});}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x4d')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db[_0xb921('0x4e')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db['ReportAgentPreview'][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db[_0xb921('0x4f')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x50')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db['FaxQueueReport'][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db['MailQueueReport']['update'](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x51')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})['then'](function(){if(_0x178a55){return db['SmsQueueReport'][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x52')]['update'](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x53')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x54')]['update'](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x55')][_0xb921('0x19')](_0x5f207c,_0x395b23);}})[_0xb921('0x1a')](function(){if(_0x178a55){return db[_0xb921('0x27')][_0xb921('0x1b')]({'where':{'id':[_0x39b85a[_0xb921('0x36')]['to'],_0x39b85a['body'][_0xb921('0x37')]]}});}})[_0xb921('0x1a')](function(){if(_0x178a55){return _0x178a55;}})['then'](respondWithResult(_0x51826a,null))[_0xb921('0x26')](handleError(_0x51826a,null));};exports[_0xb921('0x43')]=function(_0x58ead0,_0x247374){return db[_0xb921('0x27')][_0xb921('0x22')]()['then'](function(_0x553edb){if(_0x58ead0[_0xb921('0x36')][_0xb921('0x28')]&&_['isArray'](_0x58ead0[_0xb921('0x36')][_0xb921('0x28')])){if(_0x58ead0[_0xb921('0x36')][_0xb921('0x28')][_0xb921('0x38')]){_0x58ead0[_0xb921('0x36')]['tags']=_0x58ead0['body'][_0xb921('0x28')]['join'](';')+';';}else{_0x58ead0[_0xb921('0x36')][_0xb921('0x28')]=null;}}else{_0x58ead0[_0xb921('0x36')][_0xb921('0x28')]=null;}if(!_[_0xb921('0x56')](_0x58ead0['body']['dialTimezone'])){var _0x6ed0fc=_0x58ead0['body'][_0xb921('0x57')];if(!_['isNil'](shared[_0xb921('0x58')][_0x6ed0fc]))_0x58ead0[_0xb921('0x36')][_0xb921('0x59')]=shared[_0xb921('0x58')][_0x6ed0fc][_0xb921('0x59')];}return db[_0xb921('0x27')][_0xb921('0x43')](_0x58ead0['body'],{'fields':_[_0xb921('0x29')](_0x553edb),'raw':!![]});})['then'](function(_0xff4e9e){if(_0x58ead0[_0xb921('0x36')][_0xb921('0x5a')]){return insertAdditionalPhones(_0xff4e9e,_0x58ead0[_0xb921('0x36')][_0xb921('0x5a')]);}else{return _0xff4e9e;}})[_0xb921('0x1a')](respondWithResult(_0x247374,0xc9))[_0xb921('0x26')](handleError(_0x247374,null));};exports[_0xb921('0x5b')]=function(_0x3c3aa1,_0x587030){var _0x42290e=0x0;var _0xd8214f=0x0;var _0x4a63e3=0x0;var _0x36de7a=[];return db[_0xb921('0x27')][_0xb921('0x22')]()[_0xb921('0x1a')](function(_0x236901){return BPromise[_0xb921('0x5c')](_0x3c3aa1['body'],function(_0x3be301){var _0x3f603d={'where':{'$or':[]},'defaults':_0x3be301,'fields':_['keys'](_0x236901),'raw':!![]};if(_0x3be301[_0xb921('0x5d')]){for(var _0x2a43cf=0x0;_0x2a43cf<_0x3be301[_0xb921('0x5d')][_0xb921('0x38')];_0x2a43cf++){var _0x1821e6={};_0x1821e6[_0x3be301[_0xb921('0x5d')][_0x2a43cf]]=_0x3be301[_0x3be301[_0xb921('0x5d')][_0x2a43cf]];_0x3f603d[_0xb921('0x5e')][_0xb921('0x5f')][_0xb921('0x60')](_0x1821e6);}_0x3f603d['where'][_0xb921('0x61')]=_0x3be301[_0xb921('0x61')];}return db[_0xb921('0x27')][_0xb921('0x62')](_0x3f603d)['spread'](function(_0x104a5c,_0x574aa8){if(_0x574aa8){if(_0x3be301[_0xb921('0x34')]('additionalPhones')){_0x36de7a[_0xb921('0x60')]({'contact':_0x104a5c,'additionalPhones':_0x3be301[_0xb921('0x5a')]});}_0x42290e++;}else{_0x4a63e3++;}})['catch'](function(){_0xd8214f++;});});})[_0xb921('0x1a')](function(_0x5f2976){if(_0x5f2976){if(_0x36de7a[_0xb921('0x38')]>0x0){return new Promise(function(_0x2fe59e){var _0x5ed8c4=[];for(var _0x15561b=0x0;_0x15561b<_0x36de7a[_0xb921('0x38')];_0x15561b++){_0x5ed8c4[_0xb921('0x60')](insertAdditionalPhones(_0x36de7a[_0x15561b][_0xb921('0x63')],_0x36de7a[_0x15561b][_0xb921('0x5a')]));}Promise['all'](_0x5ed8c4)[_0xb921('0x1a')](function(){_0x2fe59e(0x1);});})[_0xb921('0x1a')](function(){return{'success':_0x42290e,'failure':_0xd8214f,'duplicates':_0x4a63e3};});}else{return{'success':_0x42290e,'failure':_0xd8214f,'duplicates':_0x4a63e3};}}})['then'](respondWithResult(_0x587030,0xc9))['catch'](handleError(_0x587030,null));};exports[_0xb921('0x64')]=function(_0x112cc7,_0x1bf122){var _0x3b8092;return db[_0xb921('0x27')][_0xb921('0x22')]()[_0xb921('0x1a')](function(_0x2c1bbf){return db[_0xb921('0x27')][_0xb921('0x65')]({'where':{'id':_0x112cc7[_0xb921('0x66')]['id']},'include':[{'model':db[_0xb921('0x67')],'as':_0xb921('0x68'),'attributes':['id',_0xb921('0x1f'),_0xb921('0x69')],'required':_0x112cc7[_0xb921('0x25')][_0xb921('0x6a')]?!![]:![]},{'model':db[_0xb921('0x4c')],'as':_0xb921('0x6b'),'where':{'CmContactId':_0x112cc7[_0xb921('0x66')]['id']},'required':![],'include':[{'model':db[_0xb921('0x6c')],'as':_0xb921('0x6d')}]}],'order':[db[_0xb921('0x6e')][_0xb921('0x6f')](_0xb921('0x70'))],'attributes':_[_0xb921('0x29')](_0x2c1bbf)});})[_0xb921('0x1a')](function(_0x533e2b){if(!_['isNil'](_0x533e2b)){_0x3b8092=_0x533e2b[_0xb921('0x39')]({'plain':!![]});var _0x520411={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x533e2b&&_0x533e2b[_0xb921('0x61')]){if(_0x533e2b[_0xb921('0x61')]){_0x520411['where'][_0xb921('0x71')][_0xb921('0x60')]({'ListId':{'$ne':_0x533e2b[_0xb921('0x61')]}});}}return db[_0xb921('0x2d')][_0xb921('0x24')](_0x520411);}})[_0xb921('0x1a')](function(_0x5668bb){if(!_[_0xb921('0x56')](_0x5668bb)){return _[_0xb921('0x72')](_0x3b8092,_[_0xb921('0x73')](_0x5668bb,function(_0x34c93a){return util[_0xb921('0x74')]('cf_%d',_0x34c93a['id']);}));}})[_0xb921('0x1a')](handleEntityNotFound(_0x1bf122,null))[_0xb921('0x1a')](respondWithResult(_0x1bf122,null))[_0xb921('0x26')](handleError(_0x1bf122,null));};exports[_0xb921('0x19')]=function(_0x496c4a,_0x562fdc){var _0x241f79;if(_0x496c4a[_0xb921('0x36')]['id']){delete _0x496c4a[_0xb921('0x36')]['id'];}if(!_[_0xb921('0x56')](_0x496c4a[_0xb921('0x36')][_0xb921('0x57')])){var _0x50efde=_0x496c4a['body']['dialTimezone'];if(!_[_0xb921('0x56')](shared[_0xb921('0x58')][_0x50efde]))_0x496c4a['body'][_0xb921('0x59')]=shared[_0xb921('0x58')][_0x50efde]['utcOffset'];}return db[_0xb921('0x27')][_0xb921('0x65')]({'where':{'id':_0x496c4a['params']['id']}})[_0xb921('0x1a')](handleEntityNotFound(_0x562fdc,null))[_0xb921('0x1a')](saveUpdates(_0x496c4a[_0xb921('0x36')],null))[_0xb921('0x1a')](function(_0x101f03){_0x241f79=_0x101f03;var _0x2875f4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x101f03&&_0x101f03[_0xb921('0x61')]){if(_0x101f03[_0xb921('0x61')]){_0x2875f4[_0xb921('0x5e')][_0xb921('0x71')][_0xb921('0x60')]({'ListId':{'$ne':_0x101f03[_0xb921('0x61')]}});}}return db[_0xb921('0x2d')][_0xb921('0x24')](_0x2875f4);})[_0xb921('0x1a')](function(_0x16b8da){if(_0x16b8da){return _[_0xb921('0x72')](_[_0xb921('0x75')](_0x496c4a['body'],function(_0x48cf23,_0x3ca7e9){return _[_0xb921('0x2a')](_0x3ca7e9,_0xb921('0x2b'));}),_[_0xb921('0x73')](_0x16b8da,function(_0x26a17d){return util[_0xb921('0x74')]('cf_%d',_0x26a17d['id']);}));}})['then'](function(_0x4bd03f){if(_0x4bd03f&&!_['isEmpty'](_0x4bd03f)){var _0x2b2b8d=squel[_0xb921('0x19')]()[_0xb921('0x76')]('cm_contacts')['setFields'](_0x4bd03f)['where'](_0xb921('0x77'),_0x496c4a['params']['id'])[_0xb921('0x78')]();return db[_0xb921('0x6e')][_0xb921('0x25')](_0x2b2b8d[_0xb921('0x79')],{'replacements':_0x2b2b8d[_0xb921('0x31')]});}})[_0xb921('0x1a')](function(){if(_0x496c4a[_0xb921('0x36')][_0xb921('0x7a')]&&_0x241f79){return db[_0xb921('0x3e')][_0xb921('0x19')]({'phone':_0x496c4a[_0xb921('0x36')][_0xb921('0x7a')],'OrderBy':0x0},{'where':{'ContactId':_0x241f79['id']}});}})[_0xb921('0x1a')](function(){return _0x241f79;})[_0xb921('0x1a')](respondWithResult(_0x562fdc,null))[_0xb921('0x26')](handleError(_0x562fdc,null));};exports[_0xb921('0x7b')]=function(_0x494c85,_0x797e3a){var _0x31f6de={};var _0x3e08ca={};var _0x20475a;var _0x34d712;return db[_0xb921('0x27')][_0xb921('0x7c')]({'where':{'id':_0x494c85[_0xb921('0x66')]['id']}})[_0xb921('0x1a')](handleEntityNotFound(_0x797e3a,null))[_0xb921('0x1a')](function(_0x814831){if(_0x814831){_0x20475a=_0x814831;_0x3e08ca[_0xb921('0x7d')]=_[_0xb921('0x29')](db[_0xb921('0x67')]['rawAttributes']);_0x3e08ca[_0xb921('0x25')]=_[_0xb921('0x29')](_0x494c85[_0xb921('0x25')]);_0x3e08ca[_0xb921('0x7e')]=_[_0xb921('0x7f')](_0x3e08ca['model'],_0x3e08ca[_0xb921('0x25')]);_0x31f6de[_0xb921('0x80')]=_[_0xb921('0x7f')](_0x3e08ca[_0xb921('0x7d')],qs[_0xb921('0x81')](_0x494c85['query'][_0xb921('0x81')]));_0x31f6de[_0xb921('0x80')]=_0x31f6de[_0xb921('0x80')][_0xb921('0x38')]?_0x31f6de[_0xb921('0x80')]:_0x3e08ca[_0xb921('0x7d')];_0x31f6de[_0xb921('0x82')]=qs['sort'](_0x494c85[_0xb921('0x25')]['sort']);_0x31f6de[_0xb921('0x5e')]=qs[_0xb921('0x7e')](_[_0xb921('0x83')](_0x494c85[_0xb921('0x25')],_0x3e08ca[_0xb921('0x7e')]));if(_0x494c85[_0xb921('0x25')][_0xb921('0x84')]){_0x31f6de['where']=_[_0xb921('0x85')](_0x31f6de['where'],{'$or':_[_0xb921('0x73')](_0x31f6de['attributes'],function(_0x5ab32c){var _0x8a6375={};_0x8a6375[_0x5ab32c]={'$like':'%'+_0x494c85[_0xb921('0x25')][_0xb921('0x84')]+'%'};return _0x8a6375;})});}_0x31f6de=_[_0xb921('0x85')]({},_0x31f6de,_0x494c85[_0xb921('0x86')]);return _0x20475a[_0xb921('0x7b')](_0x31f6de);}})['then'](function(_0x40a817){if(_0x40a817){_0x34d712=_0x40a817[_0xb921('0x38')];if(!_0x494c85[_0xb921('0x25')][_0xb921('0x34')](_0xb921('0x87'))){_0x31f6de[_0xb921('0x15')]=qs[_0xb921('0x15')](_0x494c85['query'][_0xb921('0x15')]);_0x31f6de['offset']=qs[_0xb921('0x13')](_0x494c85[_0xb921('0x25')][_0xb921('0x13')]);}return _0x20475a[_0xb921('0x7b')](_0x31f6de);}})[_0xb921('0x1a')](function(_0x2d38c1){if(_0x2d38c1){return _0x2d38c1?{'count':_0x34d712,'rows':_0x2d38c1}:null;}})['then'](respondWithResult(_0x797e3a,null))[_0xb921('0x26')](handleError(_0x797e3a,null));};exports[_0xb921('0x88')]=function(_0x2e6ac0,_0x500589){if(_0x2e6ac0[_0xb921('0x36')]['id']){delete _0x2e6ac0['body']['id'];}return db[_0xb921('0x27')][_0xb921('0x7c')]({'where':{'id':_0x2e6ac0['params']['id']}})[_0xb921('0x1a')](handleEntityNotFound(_0x500589,null))['then'](function(_0x5342ea){if(_0x5342ea){return _0x5342ea[_0xb921('0x88')](_0x2e6ac0[_0xb921('0x36')][_0xb921('0x89')]||[]);}return null;})[_0xb921('0x1a')](respondWithResult(_0x500589,null))[_0xb921('0x26')](handleError(_0x500589,null));};exports['setAdditionalPhones']=function(_0x25056a,_0x456282){var _0xade5e7=[];_0xade5e7[_0xb921('0x60')](addAdditionalPhones(_0x25056a[_0xb921('0x36')]));Promise[_0xb921('0x8a')](_0xade5e7)[_0xb921('0x1a')](function(){_0xade5e7=[];_0xade5e7[_0xb921('0x60')](deleteCmHopperPhones(_0x25056a['body']['id']));_0xade5e7[_0xb921('0x60')](addCmHopperPhones(_0x25056a[_0xb921('0x36')]['id']));Promise[_0xb921('0x8a')](_0xade5e7)[_0xb921('0x1a')](function(){return[0x1];})[_0xb921('0x1a')](respondWithResult(_0x456282,null));});};function addAdditionalPhones(_0x31163c){var _0x49ea0f;return new Promise(function(_0x5612e5){return db[_0xb921('0x4c')][_0xb921('0x1b')]({'where':{'CmContactId':_0x31163c['id']}})['then'](function(){db['ContactItemType'][_0xb921('0x24')]({'raw':!![],'attributes':['id',_0xb921('0x8b')]})['then'](function(_0x635e4e){var _0x4c6c56=[];for(var _0x3cd4dc=0x0;_0x3cd4dc<_0x31163c[_0xb921('0x8c')][_0xb921('0x38')];_0x3cd4dc++){var _0x3ec5eb=_0x31163c[_0xb921('0x8d')]?_[_0xb921('0x56')](_0x31163c['item_types'][_0x3cd4dc])?'':_0x31163c[_0xb921('0x8d')][_0x3cd4dc]:_0x31163c[_0xb921('0x8c')][_0x3cd4dc][_0xb921('0x8e')]?_0x31163c[_0xb921('0x8c')][_0x3cd4dc][_0xb921('0x8e')]:'';var _0x485f89=_[_0xb921('0x56')](_0x31163c[_0xb921('0x8c')][_0x3cd4dc]['description'])?'':_0x31163c[_0xb921('0x8c')][_0x3cd4dc]['description'];var _0x1869d1=_0x3ec5eb+':'+_0x31163c['items'][_0x3cd4dc][_0xb921('0x7a')]+'§'+_0x485f89;if(_[_0xb921('0x56')](_0x49ea0f))_0x49ea0f=_0x1869d1;else _0x49ea0f+=';'+_0x1869d1;var _0x153256=null;var _0x5dad69=null;if(_0x31163c[_0xb921('0x8d')]){if(!_[_0xb921('0x56')](_0x31163c[_0xb921('0x8d')][_0x3cd4dc])){_0x5dad69=_[_0xb921('0x65')](_0x635e4e,function(_0x37f851){return _0x37f851['id']===_0x31163c['item_types'][_0x3cd4dc];});if(!_[_0xb921('0x56')](_0x5dad69)){_0x153256=_0x5dad69['OrderBy'];}}}else{if(!_[_0xb921('0x56')](_0x31163c[_0xb921('0x8c')][_0x3cd4dc])){_0x5dad69=_[_0xb921('0x65')](_0x635e4e,function(_0x2838d8){return _0x2838d8['id']===_0x31163c[_0xb921('0x8c')][_0x3cd4dc][_0xb921('0x8e')];});if(!_[_0xb921('0x56')](_0x5dad69)){_0x153256=_0x3cd4dc;}}}if(_[_0xb921('0x56')](_0x153256)){_0x153256=0x64;}_0x4c6c56[_0xb921('0x60')](addAdditionalPhone(_0x31163c['id'],_0x31163c[_0xb921('0x8c')][_0x3cd4dc][_0xb921('0x7a')],_0x31163c['item_types']?_[_0xb921('0x56')](_0x31163c['item_types'][_0x3cd4dc])?null:_0x31163c[_0xb921('0x8d')][_0x3cd4dc]:_0x31163c[_0xb921('0x8c')][_0x3cd4dc][_0xb921('0x8e')]?_0x31163c[_0xb921('0x8c')][_0x3cd4dc]['ItemTypeId']:null,_0x153256,_0x485f89));}Promise[_0xb921('0x8a')](_0x4c6c56)[_0xb921('0x1a')](function(){db[_0xb921('0x27')][_0xb921('0x19')]({'AdditionalPhones':_0x49ea0f},{'where':{'id':_0x31163c['id']}})[_0xb921('0x1a')](function(){_0x5612e5(0x1);});});});});});}function addAdditionalPhone(_0x5d7238,_0x596fac,_0x541310,_0x20caac,_0x337af8){return db[_0xb921('0x4c')][_0xb921('0x65')]({'where':{'CmContactId':_0x5d7238,'item':_0x596fac}})[_0xb921('0x1a')](function(_0x454560){if(_0x454560)logger[_0xb921('0x3f')](_0xb921('0x8f'),_0x454560);else{db[_0xb921('0x4c')][_0xb921('0x43')]({'CmContactId':_0x5d7238,'item':_0x596fac,'ItemTypeId':_0x541310,'OrderBy':_0x20caac,'ItemClass':_0xb921('0x90'),'description':_0x337af8});}});}function deleteCmHopperPhones(_0x4983a1){return new Promise(function(_0x59c9e2){return db[_0xb921('0x3e')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x4983a1}})[_0xb921('0x1a')](function(_0x2aadb9){db[_0xb921('0x91')][_0xb921('0x1b')]({'where':{'CmHopperId':{'$in':_[_0xb921('0x73')](_0x2aadb9,'id')}}});})[_0xb921('0x1a')](function(){_0x59c9e2(0x1);});});}function addCmHopperPhones(_0x1053ef){return new Promise(function(_0x3fc4b5){return db[_0xb921('0x3e')][_0xb921('0x24')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1053ef}})[_0xb921('0x1a')](function(_0x351f84){var _0x142941=[];_[_0xb921('0x73')](_0x351f84,function(_0x3522d3){_0x142941['push'](createCmHopperPhone(_0x1053ef,_0x3522d3['id']));});Promise['all'](_0x142941)[_0xb921('0x1a')](function(){_0x3fc4b5(0x1);});});});}function createCmHopperPhone(_0x40560a,_0x488d04){return new Promise(function(_0x34285a){db['CmContactHasItem'][_0xb921('0x24')]({'raw':!![],'attributes':[_0xb921('0x92'),_0xb921('0x8b')],'where':{'CmContactId':_0x40560a,'ItemClass':_0xb921('0x90')},'include':[{'model':db[_0xb921('0x6c')],'attributes':[_0xb921('0x8b')],'as':_0xb921('0x6d')}],'order':['OrderBy',db[_0xb921('0x6e')][_0xb921('0x6f')](_0xb921('0x93'))]})[_0xb921('0x1a')](function(_0x2002ea){var _0x4f0376=0x1;var _0x16e590=_[_0xb921('0x73')](_0x2002ea,function(_0x1f42b7){_0x1f42b7[_0xb921('0x94')]=_0x488d04;_0x1f42b7['phone']=_0x1f42b7[_0xb921('0x92')];_0x1f42b7[_0xb921('0x8b')]=_0x4f0376;delete _0x1f42b7[_0xb921('0x95')];_0x4f0376=_0x4f0376+0x1;return _0x1f42b7;});return db[_0xb921('0x91')][_0xb921('0x5b')](_0x16e590,{});})['then'](function(){_0x34285a(0x1);});});}function insertAdditionalPhones(_0x245c11,_0x6b22b5){return new Promise(function(_0x4cd612){var _0x548a8d=[];for(var _0x5e7bb9=0x0;_0x5e7bb9<_0x6b22b5[_0xb921('0x38')];_0x5e7bb9++){var _0x4e95aa=_0x6b22b5[_0x5e7bb9];_0x548a8d['push'](parseContactItemType(_0x4e95aa));}Promise[_0xb921('0x8a')](_0x548a8d)[_0xb921('0x1a')](function(){var _0x57237b={'id':_0x245c11['id'],'items':_0x6b22b5};return addAdditionalPhones(_0x57237b)[_0xb921('0x1a')](function(){return addCmHopperPhones(_0x245c11['id']);});})[_0xb921('0x1a')](function(){_0x4cd612(_0x245c11);});});}function parseContactItemType(_0x16bb6b){return new Promise(function(_0x526ac9){if(_0x16bb6b[_0xb921('0x34')](_0xb921('0x8e'))){_0x526ac9(_0x16bb6b);}else{return db[_0xb921('0x6c')]['find']({'where':{'name':_0x16bb6b[_0xb921('0x6d')]}})['then'](function(_0x730d5e){if(_[_0xb921('0x56')](_0x730d5e))_0x16bb6b['ItemTypeId']=null;else _0x16bb6b[_0xb921('0x8e')]=_0x730d5e['id'];_0x526ac9(_0x16bb6b);});}});}exports['getAdditionalPhones']=function(_0x31975a,_0x2e244d){return db[_0xb921('0x4c')][_0xb921('0x24')]({'raw':!![],'where':{'CmContactId':_0x31975a[_0xb921('0x66')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0xb921('0x6c')],'as':_0xb921('0x6d')}],'order':[['OrderBy'],[db[_0xb921('0x6e')][_0xb921('0x6f')](_0xb921('0x93'))]]})[_0xb921('0x1a')](function(_0x4670bc){return _0x4670bc;})[_0xb921('0x1a')](respondWithResult(_0x2e244d,null))[_0xb921('0x26')](handleError(_0x2e244d,null));};exports['duplicateAdditionalPhones']=function(_0x1be475,_0x17fc67){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x1be475['body']['fromContactId']}})[_0xb921('0x1a')](function(_0xa180a5){var _0x2f8d53=_['map'](_0xa180a5,function(_0x12124e){_0x12124e['CmContactId']=_0x1be475[_0xb921('0x36')]['toContactId'];return _0x12124e;});return db[_0xb921('0x4c')][_0xb921('0x5b')](_0x2f8d53,{});})[_0xb921('0x1a')](function(){return addCmHopperPhones(_0x1be475[_0xb921('0x36')]['toContactId']);})[_0xb921('0x1a')](function(){return['ok'];})[_0xb921('0x1a')](respondWithResult(_0x17fc67,null))['catch'](handleError(_0x17fc67,null));};exports['rescheduleAdditionalPhones']=function(_0x3a6fad,_0x411244){var _0x5b07a5=[];_0x5b07a5[_0xb921('0x60')](createCmHopperPhone(_0x3a6fad[_0xb921('0x36')]['id'],_0x3a6fad[_0xb921('0x36')]['hopperId']));Promise[_0xb921('0x8a')](_0x5b07a5)[_0xb921('0x1a')](function(){return[0x1];})[_0xb921('0x1a')](respondWithResult(_0x411244,null));};exports[_0xb921('0x96')]=function(_0x5acc88,_0x17fc26){var _0x3d9b7a={'raw':![],'where':{}};var _0x5c10f9={};var _0x5d8436={'count':0x0,'rows':[]};return db[_0xb921('0x27')][_0xb921('0x7c')]({'where':{'id':_0x5acc88[_0xb921('0x66')]['id']}})[_0xb921('0x1a')](handleEntityNotFound(_0x17fc26,null))['then'](function(_0x11abef){if(_0x11abef){_0x5c10f9[_0xb921('0x7d')]=_[_0xb921('0x29')](db[_0xb921('0x3e')]['rawAttributes']);_0x5c10f9[_0xb921('0x25')]=_[_0xb921('0x29')](_0x5acc88['query']);_0x5c10f9[_0xb921('0x7e')]=_['intersection'](_0x5c10f9['model'],_0x5c10f9[_0xb921('0x25')]);_0x3d9b7a[_0xb921('0x80')]=_[_0xb921('0x7f')](_0x5c10f9['model'],qs[_0xb921('0x81')](_0x5acc88[_0xb921('0x25')][_0xb921('0x81')]));_0x3d9b7a['attributes']=_0x3d9b7a['attributes'][_0xb921('0x38')]?_0x3d9b7a[_0xb921('0x80')]:_0x5c10f9['model'];if(!_0x5acc88[_0xb921('0x25')][_0xb921('0x34')](_0xb921('0x87'))){_0x3d9b7a[_0xb921('0x15')]=qs[_0xb921('0x15')](_0x5acc88[_0xb921('0x25')]['limit']);_0x3d9b7a[_0xb921('0x13')]=qs[_0xb921('0x13')](_0x5acc88[_0xb921('0x25')][_0xb921('0x13')]);}_0x3d9b7a[_0xb921('0x82')]=qs[_0xb921('0x97')](_0x5acc88[_0xb921('0x25')]['sort']);_0x3d9b7a[_0xb921('0x5e')]=qs[_0xb921('0x7e')](_[_0xb921('0x83')](_0x5acc88[_0xb921('0x25')],_0x5c10f9[_0xb921('0x7e')]));_0x3d9b7a[_0xb921('0x5e')][_0xb921('0x98')]=_0x11abef['id'];if(_0x5acc88[_0xb921('0x25')][_0xb921('0x84')]){_0x3d9b7a[_0xb921('0x5e')]=_[_0xb921('0x85')](_0x3d9b7a['where'],{'$or':_['map'](_0x3d9b7a[_0xb921('0x80')],function(_0x3b09de){var _0x4611da={};_0x4611da[_0x3b09de]={'$like':'%'+_0x5acc88[_0xb921('0x25')][_0xb921('0x84')]+'%'};return _0x4611da;})});}_0x3d9b7a=_[_0xb921('0x85')]({},_0x3d9b7a,_0x5acc88['options']);return db['CmHopper']['count']({'where':_0x3d9b7a[_0xb921('0x5e')]})[_0xb921('0x1a')](function(_0x46eb8e){_0x5d8436[_0xb921('0x16')]=_0x46eb8e;if(_0x5acc88[_0xb921('0x25')][_0xb921('0x99')]){_0x3d9b7a[_0xb921('0x9a')]=[{'all':!![]}];}return db[_0xb921('0x3e')][_0xb921('0x24')](_0x3d9b7a);})[_0xb921('0x1a')](function(_0x46bb21){_0x5d8436[_0xb921('0x9b')]=_0x46bb21;return _0x5d8436;});}})[_0xb921('0x1a')](respondWithFilteredResult(_0x17fc26,_0x3d9b7a))[_0xb921('0x26')](handleError(_0x17fc26,null));};exports[_0xb921('0x9c')]=function(_0x502171,_0x1c1c90){var _0x46b5ec={'raw':!![],'where':{}};var _0x5f50b3={};var _0x2e306f={'count':0x0,'rows':[]};return db[_0xb921('0x27')][_0xb921('0x7c')]({'where':{'id':_0x502171[_0xb921('0x66')]['id']}})[_0xb921('0x1a')](handleEntityNotFound(_0x1c1c90,null))[_0xb921('0x1a')](function(_0x578444){if(_0x578444){_0x5f50b3[_0xb921('0x7d')]=_[_0xb921('0x29')](db[_0xb921('0x4e')][_0xb921('0x9d')]);_0x5f50b3[_0xb921('0x25')]=_[_0xb921('0x29')](_0x502171['query']);_0x5f50b3[_0xb921('0x7e')]=_[_0xb921('0x7f')](_0x5f50b3[_0xb921('0x7d')],_0x5f50b3[_0xb921('0x25')]);_0x46b5ec[_0xb921('0x80')]=_[_0xb921('0x7f')](_0x5f50b3[_0xb921('0x7d')],qs['fields'](_0x502171['query'][_0xb921('0x81')]));_0x46b5ec[_0xb921('0x80')]=_0x46b5ec[_0xb921('0x80')][_0xb921('0x38')]?_0x46b5ec[_0xb921('0x80')]:_0x5f50b3[_0xb921('0x7d')];if(!_0x502171['query']['hasOwnProperty']('nolimit')){_0x46b5ec['limit']=qs[_0xb921('0x15')](_0x502171[_0xb921('0x25')][_0xb921('0x15')]);_0x46b5ec[_0xb921('0x13')]=qs[_0xb921('0x13')](_0x502171['query']['offset']);}_0x46b5ec[_0xb921('0x82')]=qs[_0xb921('0x97')](_0x502171[_0xb921('0x25')][_0xb921('0x97')]);_0x46b5ec[_0xb921('0x5e')]=qs[_0xb921('0x7e')](_['pick'](_0x502171[_0xb921('0x25')],_0x5f50b3[_0xb921('0x7e')]));_0x46b5ec[_0xb921('0x5e')][_0xb921('0x98')]=_0x578444['id'];if(_0x502171[_0xb921('0x25')][_0xb921('0x84')]){_0x46b5ec[_0xb921('0x5e')]=_[_0xb921('0x85')](_0x46b5ec[_0xb921('0x5e')],{'$or':_[_0xb921('0x73')](_0x46b5ec['attributes'],function(_0x4eb0b1){var _0x4f3ca0={};_0x4f3ca0[_0x4eb0b1]={'$like':'%'+_0x502171[_0xb921('0x25')][_0xb921('0x84')]+'%'};return _0x4f3ca0;})});}_0x46b5ec=_[_0xb921('0x85')]({},_0x46b5ec,_0x502171[_0xb921('0x86')]);return db[_0xb921('0x4e')][_0xb921('0x16')]({'where':_0x46b5ec['where']})['then'](function(_0x47eb20){_0x2e306f[_0xb921('0x16')]=_0x47eb20;if(_0x502171['query'][_0xb921('0x99')]){_0x46b5ec[_0xb921('0x9a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xb921('0x24')](_0x46b5ec);})['then'](function(_0x4f5ffe){_0x2e306f[_0xb921('0x9b')]=_0x4f5ffe;return _0x2e306f;});}})[_0xb921('0x1a')](respondWithFilteredResult(_0x1c1c90,_0x46b5ec))[_0xb921('0x26')](handleError(_0x1c1c90,null));};exports[_0xb921('0x9e')]=function(_0x450ac1,_0xbfdf24){var _0x524bca={'raw':!![],'where':{}};var _0x3ed600={};var _0x407066={'count':0x0,'rows':[]};return db[_0xb921('0x27')][_0xb921('0x7c')]({'where':{'id':_0x450ac1[_0xb921('0x66')]['id']}})['then'](handleEntityNotFound(_0xbfdf24,null))['then'](function(_0x2e4eac){if(_0x2e4eac){_0x3ed600[_0xb921('0x7d')]=_[_0xb921('0x29')](db[_0xb921('0x4d')][_0xb921('0x9d')]);_0x3ed600[_0xb921('0x25')]=_[_0xb921('0x29')](_0x450ac1[_0xb921('0x25')]);_0x3ed600['filters']=_[_0xb921('0x7f')](_0x3ed600[_0xb921('0x7d')],_0x3ed600[_0xb921('0x25')]);_0x524bca[_0xb921('0x80')]=_[_0xb921('0x7f')](_0x3ed600[_0xb921('0x7d')],qs[_0xb921('0x81')](_0x450ac1[_0xb921('0x25')][_0xb921('0x81')]));_0x524bca[_0xb921('0x80')]=_0x524bca['attributes'][_0xb921('0x38')]?_0x524bca['attributes']:_0x3ed600[_0xb921('0x7d')];if(!_0x450ac1[_0xb921('0x25')][_0xb921('0x34')]('nolimit')){_0x524bca[_0xb921('0x15')]=qs[_0xb921('0x15')](_0x450ac1[_0xb921('0x25')][_0xb921('0x15')]);_0x524bca[_0xb921('0x13')]=qs[_0xb921('0x13')](_0x450ac1[_0xb921('0x25')][_0xb921('0x13')]);}_0x524bca['order']=qs[_0xb921('0x97')](_0x450ac1[_0xb921('0x25')][_0xb921('0x97')]);_0x524bca['where']=qs[_0xb921('0x7e')](_[_0xb921('0x83')](_0x450ac1[_0xb921('0x25')],_0x3ed600['filters']));_0x524bca['where'][_0xb921('0x98')]=_0x2e4eac['id'];if(_0x450ac1['query'][_0xb921('0x84')]){_0x524bca['where']=_[_0xb921('0x85')](_0x524bca[_0xb921('0x5e')],{'$or':_[_0xb921('0x73')](_0x524bca[_0xb921('0x80')],function(_0x3387ff){var _0x3cec9d={};_0x3cec9d[_0x3387ff]={'$like':'%'+_0x450ac1[_0xb921('0x25')][_0xb921('0x84')]+'%'};return _0x3cec9d;})});}_0x524bca=_[_0xb921('0x85')]({},_0x524bca,_0x450ac1[_0xb921('0x86')]);return db[_0xb921('0x4d')][_0xb921('0x16')]({'where':_0x524bca[_0xb921('0x5e')]})[_0xb921('0x1a')](function(_0x4cb177){_0x407066[_0xb921('0x16')]=_0x4cb177;if(_0x450ac1[_0xb921('0x25')][_0xb921('0x99')]){_0x524bca[_0xb921('0x9a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb921('0x24')](_0x524bca);})[_0xb921('0x1a')](function(_0x577612){_0x407066[_0xb921('0x9b')]=_0x577612;return _0x407066;});}})[_0xb921('0x1a')](respondWithFilteredResult(_0xbfdf24,_0x524bca))[_0xb921('0x26')](handleError(_0xbfdf24,null));};exports['getJscriptySessions']=function(_0x38aa8a,_0xe791f6){var _0x5e14b0={'raw':!![],'where':{}};var _0x4e8972={};var _0x42c192={'count':0x0,'rows':[]};return db[_0xb921('0x27')][_0xb921('0x7c')]({'where':{'id':_0x38aa8a[_0xb921('0x66')]['id']}})[_0xb921('0x1a')](handleEntityNotFound(_0xe791f6,null))[_0xb921('0x1a')](function(_0x3dcb1e){if(_0x3dcb1e){_0x4e8972[_0xb921('0x7d')]=_[_0xb921('0x29')](db[_0xb921('0x52')][_0xb921('0x9d')]);_0x4e8972[_0xb921('0x25')]=_[_0xb921('0x29')](_0x38aa8a[_0xb921('0x25')]);_0x4e8972[_0xb921('0x7e')]=_[_0xb921('0x7f')](_0x4e8972[_0xb921('0x7d')],_0x4e8972['query']);_0x5e14b0[_0xb921('0x80')]=_[_0xb921('0x7f')](_0x4e8972[_0xb921('0x7d')],qs[_0xb921('0x81')](_0x38aa8a['query'][_0xb921('0x81')]));_0x5e14b0['attributes']=_0x5e14b0['attributes'][_0xb921('0x38')]?_0x5e14b0[_0xb921('0x80')]:_0x4e8972[_0xb921('0x7d')];if(!_0x38aa8a[_0xb921('0x25')][_0xb921('0x34')](_0xb921('0x87'))){_0x5e14b0[_0xb921('0x15')]=qs[_0xb921('0x15')](_0x38aa8a[_0xb921('0x25')][_0xb921('0x15')]);_0x5e14b0[_0xb921('0x13')]=qs[_0xb921('0x13')](_0x38aa8a[_0xb921('0x25')][_0xb921('0x13')]);}_0x5e14b0[_0xb921('0x82')]=qs['sort'](_0x38aa8a['query'][_0xb921('0x97')]);_0x5e14b0[_0xb921('0x5e')]=qs[_0xb921('0x7e')](_['pick'](_0x38aa8a[_0xb921('0x25')],_0x4e8972['filters']));_0x5e14b0[_0xb921('0x5e')][_0xb921('0x98')]=_0x3dcb1e['id'];if(_0x38aa8a[_0xb921('0x25')][_0xb921('0x84')]){_0x5e14b0[_0xb921('0x5e')]=_[_0xb921('0x85')](_0x5e14b0[_0xb921('0x5e')],{'$or':_['map'](_0x5e14b0[_0xb921('0x80')],function(_0x1c47e3){var _0x323946={};_0x323946[_0x1c47e3]={'$like':'%'+_0x38aa8a['query'][_0xb921('0x84')]+'%'};return _0x323946;})});}_0x5e14b0=_[_0xb921('0x85')]({},_0x5e14b0,_0x38aa8a[_0xb921('0x86')]);return db['JscriptySessionReport'][_0xb921('0x16')]({'where':_0x5e14b0[_0xb921('0x5e')]})[_0xb921('0x1a')](function(_0x2ad2b2){_0x42c192['count']=_0x2ad2b2;if(_0x38aa8a[_0xb921('0x25')][_0xb921('0x99')]){_0x5e14b0[_0xb921('0x9a')]=[{'all':!![]}];}return db[_0xb921('0x52')][_0xb921('0x24')](_0x5e14b0);})[_0xb921('0x1a')](function(_0x31a5e1){_0x42c192[_0xb921('0x9b')]=_0x31a5e1;return _0x42c192;});}})[_0xb921('0x1a')](respondWithFilteredResult(_0xe791f6,_0x5e14b0))[_0xb921('0x26')](handleError(_0xe791f6,null));};exports[_0xb921('0x9f')]=function(_0x1341f7,_0x4fa873){try{if(!_0x1341f7[_0xb921('0x36')][_0xb921('0x61')]){throw new Error('No\x20ListId\x20specified');}if(!_0x1341f7[_0xb921('0x36')][_0xb921('0xa0')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x1341f7[_0xb921('0x36')][_0xb921('0xa1')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x1341f7[_0xb921('0x36')][_0xb921('0xa2')]){throw new Error(_0xb921('0xa3'));}var _0x1caa2a=_0x1341f7[_0xb921('0x36')][_0xb921('0xa0')][_0xb921('0xa4')](',');var _0x550c03=_0x1341f7[_0xb921('0x36')][_0xb921('0xa1')]['split'](',');if(!_0x1caa2a[_0xb921('0x38')]||!_0x550c03[_0xb921('0x38')]||_0x1caa2a[_0xb921('0x38')]!==_0x550c03[_0xb921('0x38')]){throw new Error(_0xb921('0xa5'));}_0x1341f7['body'][_0xb921('0x81')]=_[_0xb921('0xa6')](_0x1caa2a,_0x550c03);if(!_0x1341f7[_0xb921('0x36')]['fields'][_0xb921('0x7a')]){throw new Error(_0xb921('0xa7'));}if(!_0x1341f7[_0xb921('0x36')][_0xb921('0x81')][_0xb921('0xa8')]){throw new Error(_0xb921('0xa9'));}var _0x1e5213=path['join'](config['root'],_0xb921('0xaa'),_0x1341f7[_0xb921('0xab')][_0xb921('0xac')]);fs[_0xb921('0xad')](_0x1e5213,parseInt(_0xb921('0xae'),0x8));var _0x5495df=require(_0xb921('0xaf'))['fork'](path[_0xb921('0x3c')](__dirname,_0xb921('0xb0')),[_0x1e5213,_0x1341f7['body']['binding_keys'],_0x1341f7[_0xb921('0x36')][_0xb921('0xa1')],_0x1341f7[_0xb921('0x36')]['ListId'],_0x1341f7[_0xb921('0x36')][_0xb921('0xb1')],_0x1341f7[_0xb921('0x36')][_0xb921('0x5d')],_0x1341f7['body'][_0xb921('0xa2')]]);return _0x4fa873['status'](0xc8)[_0xb921('0x12')]({'message':_0xb921('0xb2'),'pid':_0x5495df['pid']});}catch(_0x5881ef){return _0x4fa873[_0xb921('0x1c')](0x1f4)[_0xb921('0x20')](_0x5881ef);}};exports[_0xb921('0xb3')]=function(_0x3ec62c,_0x13a141){var _0x2a7393=fs[_0xb921('0xb4')](_0x3ec62c['file']['path']);Papa[_0xb921('0xb5')](_0x2a7393,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x545102){return _0x13a141['status'](0xc8)['json']({'file':_0x3ec62c[_0xb921('0xab')],'fields':_0x545102[_0xb921('0xb6')]['fields']});}});};exports['import']=function(_0x15f4b4,_0x26c5e6){return db['User'][_0xb921('0x24')]({'raw':!![],'attributes':['id'],'where':{'role':_0xb921('0xb7')}})[_0xb921('0x1a')](function(_0x1b0c54){var _0x56d71c=![];if(!_0x15f4b4[_0xb921('0x36')][_0xb921('0x61')]){throw new Error(_0xb921('0xb8'));}if(!_0x15f4b4[_0xb921('0x36')]['binding'][_0xb921('0x7a')]){throw new Error(_0xb921('0xa7'));}if(!_0x15f4b4['body'][_0xb921('0xb9')][_0xb921('0xa8')]){throw new Error(_0xb921('0xa9'));}if(!_0x15f4b4[_0xb921('0x36')][_0xb921('0xa2')]){throw new Error(_0xb921('0xa3'));}var _0x37379d=require(_0xb921('0xaf'))[_0xb921('0xba')](path['join'](__dirname,_0xb921('0xbb')),[_0x15f4b4['params']['id'],JSON[_0xb921('0xbc')](_0x15f4b4[_0xb921('0x36')]),JSON[_0xb921('0xbc')](_0x1b0c54)]);_0x37379d['on'](_0xb921('0xbd'),function(){_0x56d71c=!![];return _0x26c5e6['status'](0xc8)[_0xb921('0x12')]({'message':_0xb921('0xbe'),'pid':_0x37379d['pid']});});_0x37379d['on'](_0xb921('0xbf'),function(_0xb3f2ee){if(_0xb3f2ee&&!_0x56d71c){return _0x26c5e6[_0xb921('0x1c')](0x1f4)[_0xb921('0x12')]({'message':'error\x20child\x20process','pid':_0x37379d[_0xb921('0xc0')]});}});})[_0xb921('0x26')](handleError(_0x26c5e6,null));};exports['importUpdates']=function(_0x3b1c36,_0x1a7ca4){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xb921('0xb7')}})[_0xb921('0x1a')](function(_0x9245d1){var _0x59c1a8=![];if(!_0x3b1c36['body'][_0xb921('0x61')]){throw new Error(_0xb921('0xb8'));}if(!_0x3b1c36[_0xb921('0x36')][_0xb921('0xb9')][_0xb921('0x7a')]){throw new Error(_0xb921('0xa7'));}if(!_0x3b1c36['body'][_0xb921('0xb9')][_0xb921('0xa8')]){throw new Error(_0xb921('0xa9'));}if(!_0x3b1c36['body'][_0xb921('0xa2')]){throw new Error(_0xb921('0xa3'));}var _0x2ac289=require(_0xb921('0xaf'))[_0xb921('0xba')](path[_0xb921('0x3c')](__dirname,_0xb921('0xc1')),[_0x3b1c36['params']['id'],JSON[_0xb921('0xbc')](_0x3b1c36[_0xb921('0x36')]),JSON[_0xb921('0xbc')](_0x9245d1)]);_0x2ac289['on']('message',function(){_0x59c1a8=!![];return _0x1a7ca4['status'](0xc8)[_0xb921('0x12')]({'message':_0xb921('0xbe'),'pid':_0x2ac289[_0xb921('0xc0')]});});_0x2ac289['on'](_0xb921('0xbf'),function(_0x547a15){if(_0x547a15&&!_0x59c1a8){return _0x1a7ca4['status'](0x1f4)[_0xb921('0x12')]({'message':_0xb921('0xc2'),'pid':_0x2ac289[_0xb921('0xc0')]});}});})['catch'](handleError(_0x1a7ca4,null));};exports[_0xb921('0xc3')]=function(_0x503bf0,_0x4c1bff){var _0x2789a9=['mail','chat',_0xb921('0xc4'),_0xb921('0xc5'),_0xb921('0xc6'),_0xb921('0xc7'),_0xb921('0xc8')];var _0x101adf={'offset':0x0,'order':qs[_0xb921('0x97')](_0xb921('0xc9'))},_0xec0ef7={'count':0x0,'rows':[]};Promise['resolve']()[_0xb921('0x1a')](function(){if(_0x503bf0[_0xb921('0x25')][_0xb921('0xca')]){if(!_[_0xb921('0xcb')](_0x2789a9,_0x503bf0[_0xb921('0x25')][_0xb921('0xca')][_0xb921('0xcc')]())){throw new Error(_0xb921('0xcd'));}_0x2789a9=[_0x503bf0[_0xb921('0x25')][_0xb921('0xca')][_0xb921('0xcc')]()];}if(_0x503bf0[_0xb921('0x25')]['range']){try{var _0xea8ccd=JSON[_0xb921('0xb5')](_0x503bf0[_0xb921('0x25')][_0xb921('0xce')]);if(!moment(_0xea8ccd[_0xb921('0x37')])['isValid']()){throw new Error(_0xb921('0xcf'));}if(!moment(_0xea8ccd['to'])[_0xb921('0xd0')]()){throw new Error(_0xb921('0xd1'));}}catch(_0x9c7073){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x503bf0[_0xb921('0x25')][_0xb921('0x34')](_0xb921('0x87'))){_0x101adf['limit']=qs[_0xb921('0x15')](_0x503bf0[_0xb921('0x25')][_0xb921('0x15')]||0xa);_0x101adf['offset']=qs[_0xb921('0x13')](_0x503bf0['query'][_0xb921('0x13')]);}var _0x4fc904=_0x2789a9[_0xb921('0x73')](function(_0x4eeddd){if(_0x4eeddd===_0xb921('0xc8')){var _0x2de47e={'attributes':['id',_0xb921('0xd2'),_0xb921('0x30'),_0xb921('0xd3'),'destination',_0xb921('0xd4'),'starttime',_0xb921('0xd5'),'duration',_0xb921('0xd6'),_0xb921('0xd7'),_0xb921('0xd8'),_0xb921('0xd9'),_0xb921('0xda'),'UserId'],'where':{'ContactId':_0x503bf0['params']['id']},'include':[{'model':db[_0xb921('0xdb')],'as':_0xb921('0xdb'),'attributes':['id',_0xb921('0x1f'),'fullname',_0xb921('0x2e')]}],'order':[[_0xb921('0xd7'),'DESC']]};if(_0x503bf0['query'][_0xb921('0xce')]){_0x2de47e[_0xb921('0x5e')]['createdAt']={'$gte':_0xea8ccd['from'],'$lte':_0xea8ccd['to']};}return db[_0xb921('0x4f')][_0xb921('0xdc')](_0x2de47e)[_0xb921('0x1a')](function(_0xf57521){_0xec0ef7[_0xb921('0x16')]+=_0xf57521[_0xb921('0x16')];return _[_0xb921('0x73')](_0xf57521[_0xb921('0x9b')],function(_0x4b1ed5){var _0x15ceb9=_0x4b1ed5[_0xb921('0x39')]({'plain':!![]});_0x15ceb9[_0xb921('0xca')]=_0x4eeddd;if(_0x15ceb9['User']){_0x15ceb9[_0xb921('0xdb')]={'id':_0x15ceb9['User']['id'],'name':_0x15ceb9[_0xb921('0xdb')]['name'],'fullname':_0x15ceb9['User'][_0xb921('0xdd')],'alias':_0x15ceb9[_0xb921('0xdb')][_0xb921('0x2e')]};}return _0x15ceb9;});});}else{var _0x345b6a=_[_0xb921('0xde')](_0x4eeddd)+(_0x4eeddd===_0xb921('0xdf')?'Website':'Account');var _0xa31742={'attributes':['id','closed',_0xb921('0xe0'),_0xb921('0xd7'),'note',_0xb921('0xe1'),_0xb921('0xe2'),_0xb921('0xe3'),_0xb921('0xe4'),_0x345b6a+'Id'],'where':{'ContactId':_0x503bf0[_0xb921('0x66')]['id']},'include':[{'model':db[_0x345b6a],'as':'Account','attributes':['id',_0xb921('0x1f'),_0xb921('0xe5')]},{'model':db[_0xb921('0xdb')],'as':_0xb921('0xe6'),'attributes':['id',_0xb921('0x1f'),_0xb921('0xdd')]},{'model':db[_0xb921('0x67')],'as':_0xb921('0x68'),'attributes':['id',_0xb921('0x1f'),'color'],'through':{'attributes':[]}}],'order':[['createdAt','DESC']]};if(_0x503bf0[_0xb921('0x25')][_0xb921('0xce')]){_0xa31742[_0xb921('0x5e')][_0xb921('0xd7')]={'$gte':_0xea8ccd['from'],'$lte':_0xea8ccd['to']};}switch(_0x4eeddd){case _0xb921('0xdf'):_0xa31742[_0xb921('0x80')][_0xb921('0x60')](_0xb921('0xe7'),_0xb921('0xe8'),_0xb921('0xe9'),_0xb921('0xea'),_0xb921('0xeb'),_0xb921('0xec'),_0xb921('0xed'),'ratingValue',_0xb921('0xee'));break;case _0xb921('0xef'):_0xa31742[_0xb921('0x80')]['push']('subject','substatus');break;case _0xb921('0xc5'):_0xa31742[_0xb921('0x80')][_0xb921('0x60')](_0xb921('0xf0'),_0xb921('0xf1'));break;}return db[_[_0xb921('0xde')](_0x4eeddd)+_0xb921('0xf2')][_0xb921('0xdc')](_0xa31742)[_0xb921('0x1a')](function(_0x42592f){_0xec0ef7[_0xb921('0x16')]+=_0x42592f[_0xb921('0x16')];return _[_0xb921('0x73')](_0x42592f['rows'],function(_0x1cbe17){var _0x38071c=_0x1cbe17[_0xb921('0x39')]({'plain':!![]});_0x38071c[_0xb921('0xca')]=_0x4eeddd;if(_0x38071c[_0xb921('0xe6')]){_0x38071c[_0xb921('0xe6')]={'id':_0x38071c[_0xb921('0xe6')]['id'],'name':_0x38071c[_0xb921('0xe6')][_0xb921('0x1f')],'fullname':_0x38071c['Owner'][_0xb921('0xdd')]};}return _0x38071c;});});}});return Promise['all'](_0x4fc904);})[_0xb921('0x1a')](function(_0x37d5c0){return _(_0x37d5c0)['flatten']()[_0xb921('0xf3')](_0xb921('0xd7'))[_0xb921('0xf4')]()['value']();})[_0xb921('0x1a')](function(_0xe50921){_0xec0ef7[_0xb921('0x9b')]=_0x101adf[_0xb921('0x15')]?_0xe50921['slice'](_0x101adf[_0xb921('0x13')],_0x101adf['offset']+_0x101adf[_0xb921('0x15')]):_0xe50921;return _0xec0ef7;})[_0xb921('0x1a')](respondWithFilteredResult(_0x4c1bff,_0x101adf))[_0xb921('0x26')](handleError(_0x4c1bff,null));};
\ No newline at end of file
+var _0x9582=['redis','socket.io-emitter','./cmContact.socket','register','status','json','offset','undefined','count','update','end','error','stack','name','send','index','describe','then','getOptions','findAll','query','user','CmContact','find','catch','keys','length','cf_','columnName','displayName','analytics','CmCustomField','alias','type','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','merge','body','from','get','mergeWith','tags','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','destroy','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','FaxInteraction','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','push','ListId','findOrCreate','spread','all','show','params','Tag','color','tag','Phones','ContactItemType','sequelize','literal','$and','omit','map','format','cf_%d','pickBy','table','id\x20=\x20?','toParam','text','values','phone','getTags','findOne','model','filters','intersection','attributes','fields','order','sort','pick','options','hasOwnProperty','nolimit','limit','setTags','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','rawAttributes','ContactId','filter','includeAll','include','rows','getHopperHistories','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','filename','chmodSync','child_process','fork','join','../../components/import/cm/csv','socket_timestamp','upload','createReadStream','file','parse','meta','User','binding','No\x20firstName\x20column\x20specified','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','../../components/import/cm/csvUpdates','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','fullname','findAndCountAll','startCase','Account','disposition','UserId','key','Owner','Tags','DESC','browserName','customerIp','customerPort','deviceModel','ratingMessage','ratingType','referer','substatus','externalUrl','threadId','flatten','sortBy','value','slice','bluebird','path','lodash','squel','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9582,0xed));var _0x2958=function(_0x3ac8ff,_0x4e52ca){_0x3ac8ff=_0x3ac8ff-0x0;var _0x3f9247=_0x9582[_0x3ac8ff];return _0x3f9247;};'use strict';var moment=require('moment');var BPromise=require(_0x2958('0x0'));var util=require('util');var path=require(_0x2958('0x1'));var fs=require('fs');var _=require(_0x2958('0x2'));var squel=require(_0x2958('0x3'));var Papa=require(_0x2958('0x4'));var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x2958('0x5'));var logger=require(_0x2958('0x6'))(_0x2958('0x7'));var config=require(_0x2958('0x8'));var shared=require(_0x2958('0x9'));var db=require(_0x2958('0xa'))['db'];config['redis']=_[_0x2958('0xb')](config[_0x2958('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x2958('0xd'))(new Redis(config['redis']));require(_0x2958('0xe'))[_0x2958('0xf')](socket);function respondWithResult(_0x1540eb,_0x5df0f6){_0x5df0f6=_0x5df0f6||0xc8;return function(_0x708d8){if(_0x708d8){return _0x1540eb[_0x2958('0x10')](_0x5df0f6)[_0x2958('0x11')](_0x708d8);}};}function respondWithFilteredResult(_0x592b73,_0x49c0c3){return function(_0x2b8501){if(_0x2b8501){var _0x56c6e1=typeof _0x49c0c3[_0x2958('0x12')]==='undefined'&&typeof _0x49c0c3['limit']===_0x2958('0x13');var _0x535949=_0x2b8501[_0x2958('0x14')];var _0x34e647=_0x56c6e1?0x0:_0x49c0c3[_0x2958('0x12')];var _0x485bc5=_0x56c6e1?_0x2b8501['count']:_0x49c0c3[_0x2958('0x12')]+_0x49c0c3['limit'];var _0x43a333;if(_0x485bc5>=_0x535949){_0x485bc5=_0x535949;_0x43a333=0xc8;}else{_0x43a333=0xce;}_0x592b73[_0x2958('0x10')](_0x43a333);return _0x592b73['set']('Content-Range',_0x34e647+'-'+_0x485bc5+'/'+_0x535949)[_0x2958('0x11')](_0x2b8501);}return null;};}function saveUpdates(_0x5df6e4){return function(_0x3e00e3){if(_0x3e00e3){return _0x3e00e3[_0x2958('0x15')](_0x5df6e4)['then'](function(_0x41bd8d){return _0x41bd8d;});}return null;};}function removeEntity(_0x3b9017){return function(_0x1a1761){if(_0x1a1761){return _0x1a1761['destroy']()['then'](function(){_0x3b9017[_0x2958('0x10')](0xcc)[_0x2958('0x16')]();});}};}function handleEntityNotFound(_0x259a2a){return function(_0x49289b){if(!_0x49289b){_0x259a2a['sendStatus'](0x194);}return _0x49289b;};}function handleError(_0x5d8a94,_0x341aee){_0x341aee=_0x341aee||0x1f4;return function(_0x54e81e){logger[_0x2958('0x17')](_0x54e81e[_0x2958('0x18')]);if(_0x54e81e[_0x2958('0x19')]){delete _0x54e81e[_0x2958('0x19')];}_0x5d8a94[_0x2958('0x10')](_0x341aee)[_0x2958('0x1a')](_0x54e81e);};}exports[_0x2958('0x1b')]=function(_0x5ce4df,_0x424944){var _0x44d408={};return contacts[_0x2958('0x1c')]()[_0x2958('0x1d')](function(_0x2e826d){_0x44d408=qs[_0x2958('0x1e')](_0x2e826d,_0x5ce4df);return contacts[_0x2958('0x1f')](_0x5ce4df[_0x2958('0x20')],_0x5ce4df[_0x2958('0x21')],_0x44d408,_0x2e826d);})[_0x2958('0x1d')](respondWithFilteredResult(_0x424944,_0x44d408))['catch'](handleError(_0x424944,null));};exports['destroy']=function(_0x4ff538,_0x3d626e){return db[_0x2958('0x22')][_0x2958('0x23')]({'where':{'id':_0x4ff538['params']['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0x3d626e,null))[_0x2958('0x1d')](removeEntity(_0x3d626e,null))[_0x2958('0x24')](handleError(_0x3d626e,null));};exports['describe']=function(_0x4e8a2d,_0x392196){return db[_0x2958('0x22')][_0x2958('0x1c')]()['then'](function(_0x2a8268){delete _0x2a8268['tags'];for(var _0x113cbb=0x0;_0x113cbb<Object[_0x2958('0x25')](_0x2a8268)[_0x2958('0x26')];_0x113cbb++){var _0xd4b0d2=Object['keys'](_0x2a8268)[_0x113cbb];if(!_['startsWith'](_0xd4b0d2,_0x2958('0x27'))){_0x2a8268[_0xd4b0d2][_0x2958('0x28')]=_0xd4b0d2;_0x2a8268[_0xd4b0d2][_0x2958('0x29')]=_0xd4b0d2;}}return _0x2a8268;})[_0x2958('0x1d')](function(_0x56923a){var _0x6f5f89={'where':Boolean(_0x4e8a2d['query'][_0x2958('0x2a')])===!![]?undefined:{'$or':[{'ListId':_0x4e8a2d[_0x2958('0x20')]['id']},{'ListId':null}]},'raw':!![]};return db[_0x2958('0x2b')]['findAll'](_0x6f5f89)[_0x2958('0x1d')](function(_0xd01e62){for(var _0x6fae5=0x0;_0x6fae5<_0xd01e62[_0x2958('0x26')];_0x6fae5++){var _0x333b6d=_0x2958('0x27')+_0xd01e62[_0x6fae5]['id'];if(_0x56923a[_0x333b6d]){_0x56923a[_0x333b6d][_0x2958('0x28')]=_0x333b6d;_0x56923a[_0x333b6d][_0x2958('0x29')]=_0xd01e62[_0x6fae5][_0x2958('0x2c')];_0x56923a[_0x333b6d]['custom']={'type':_0xd01e62[_0x6fae5][_0x2958('0x2d')],'values':_0xd01e62[_0x6fae5]['values']};}else{logger[_0x2958('0x2e')](_0x2958('0x2f'),_0x333b6d);}}Object[_0x2958('0x25')](_0x56923a)[_0x2958('0x30')](function(_0x21ac9e){if(!_0x56923a[_0x21ac9e]['hasOwnProperty']('columnName')){delete _0x56923a[_0x21ac9e];}});return _0x56923a;});})[_0x2958('0x1d')](respondWithResult(_0x392196,null))['catch'](handleError(_0x392196,null));};exports[_0x2958('0x31')]=function(_0x5a23f4,_0x5077d4){var _0x216436;var _0x41560c;var _0x2a0aff;if(_0x5a23f4[_0x2958('0x32')]['id']){delete _0x5a23f4[_0x2958('0x32')]['id'];}return db['CmContact'][_0x2958('0x1f')]({'where':{'id':[_0x5a23f4[_0x2958('0x32')]['to'],_0x5a23f4[_0x2958('0x32')][_0x2958('0x33')]]}})[_0x2958('0x1d')](function(_0x5745f3){if(_0x5745f3){if(_0x5745f3[_0x2958('0x26')]!==0x2){return null;}_0x5745f3[0x0]=_0x5745f3[0x0][_0x2958('0x34')]({'plain':!![]});_0x5745f3[0x1]=_0x5745f3[0x1][_0x2958('0x34')]({'plain':!![]});delete _0x5745f3[0x0]['id'];delete _0x5745f3[0x1]['id'];return _[_0x2958('0x35')](_0x5745f3[0x0],_0x5745f3[0x1],function(_0x27ed77,_0x1152e6){if(Array['isArray'](_0x1152e6)&&!_0x1152e6[_0x2958('0x26')]){return _0x27ed77;}else if(!_0x1152e6){return _0x27ed77;}});}})[_0x2958('0x1d')](handleEntityNotFound(_0x5077d4,null))[_0x2958('0x1d')](function(_0x4f1e1e){if(_0x4f1e1e){if(_0x4f1e1e[_0x2958('0x36')]&&_[_0x2958('0x37')](_0x4f1e1e[_0x2958('0x36')])){_0x4f1e1e[_0x2958('0x36')]=_0x4f1e1e[_0x2958('0x36')]['join']();}logger[_0x2958('0x2e')](_0x2958('0x38'),_0x5a23f4['body']['to'],_0x5a23f4[_0x2958('0x32')]['from']);return db[_0x2958('0x39')][_0x2958('0x3a')]({'where':{'ContactId':[_0x5a23f4[_0x2958('0x32')]['to'],_0x5a23f4['body'][_0x2958('0x33')]]}})[_0x2958('0x1d')](function(_0x527abe){logger['info']('[CmContact][merge][destroy][CmHopper],\x20%s',_0x527abe);return db[_0x2958('0x3b')][_0x2958('0x3a')]({'where':{'ContactId':[_0x5a23f4[_0x2958('0x32')]['to'],_0x5a23f4[_0x2958('0x32')][_0x2958('0x33')]]}})['then'](function(_0x3b3226){logger['info'](_0x2958('0x3c'),_0x3b3226);return db[_0x2958('0x22')]['create'](_0x4f1e1e);});});}})['then'](function(_0x45734d){if(_0x45734d){_0x216436=_0x45734d;_0x41560c={'ContactId':_0x216436['id']};_0x2a0aff={'where':{'ContactId':[_0x5a23f4['body']['to'],_0x5a23f4[_0x2958('0x32')][_0x2958('0x33')]]}};return db[_0x2958('0x3d')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x3e')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x3f')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x40')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})['then'](function(){if(_0x216436){return db[_0x2958('0x41')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x40')]['update'](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x41')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})['then'](function(){if(_0x216436){return db['SmsInteraction'][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db['SmsMessage'][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x42')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})['then'](function(){if(_0x216436){return db['FaxMessage']['update'](_0x41560c,_0x2a0aff);}})['then'](function(){if(_0x216436){return db[_0x2958('0x43')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x44')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})['then'](function(){if(_0x216436){return db[_0x2958('0x45')][_0x2958('0x15')]({'CmContactId':_0x216436['id']},{'where':{'CmContactId':[_0x5a23f4[_0x2958('0x32')]['to'],_0x5a23f4['body'][_0x2958('0x33')]]}});}})[_0x2958('0x1d')](function(){if(_0x216436){return db['CmHopperFinal'][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x46')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x47')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x48')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x49')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db['FaxQueueReport'][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x4a')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db['OpenchannelQueueReport'][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x4b')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})['then'](function(){if(_0x216436){return db[_0x2958('0x4c')]['update'](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x4d')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x4e')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x4f')][_0x2958('0x15')](_0x41560c,_0x2a0aff);}})[_0x2958('0x1d')](function(){if(_0x216436){return db[_0x2958('0x22')][_0x2958('0x3a')]({'where':{'id':[_0x5a23f4[_0x2958('0x32')]['to'],_0x5a23f4[_0x2958('0x32')][_0x2958('0x33')]]}});}})['then'](function(){if(_0x216436){return _0x216436;}})['then'](respondWithResult(_0x5077d4,null))[_0x2958('0x24')](handleError(_0x5077d4,null));};exports[_0x2958('0x50')]=function(_0x25fe64,_0x210507){return db[_0x2958('0x22')][_0x2958('0x1c')]()[_0x2958('0x1d')](function(_0x382797){if(_0x25fe64[_0x2958('0x32')][_0x2958('0x36')]&&_[_0x2958('0x37')](_0x25fe64[_0x2958('0x32')][_0x2958('0x36')])){if(_0x25fe64[_0x2958('0x32')][_0x2958('0x36')][_0x2958('0x26')]){_0x25fe64['body']['tags']=_0x25fe64[_0x2958('0x32')]['tags']['join'](';')+';';}else{_0x25fe64['body']['tags']=null;}}else{_0x25fe64[_0x2958('0x32')][_0x2958('0x36')]=null;}if(!_['isNil'](_0x25fe64['body'][_0x2958('0x51')])){var _0x13273c=_0x25fe64[_0x2958('0x32')][_0x2958('0x51')];if(!_[_0x2958('0x52')](shared[_0x2958('0x53')][_0x13273c]))_0x25fe64[_0x2958('0x32')][_0x2958('0x54')]=shared[_0x2958('0x53')][_0x13273c][_0x2958('0x54')];}return db[_0x2958('0x22')][_0x2958('0x50')](_0x25fe64[_0x2958('0x32')],{'fields':_[_0x2958('0x25')](_0x382797),'raw':!![]});})['then'](function(_0x1dbeb2){if(_0x25fe64[_0x2958('0x32')]['additionalPhones']){return insertAdditionalPhones(_0x1dbeb2,_0x25fe64[_0x2958('0x32')][_0x2958('0x55')]);}else{return _0x1dbeb2;}})[_0x2958('0x1d')](respondWithResult(_0x210507,0xc9))[_0x2958('0x24')](handleError(_0x210507,null));};exports[_0x2958('0x56')]=function(_0x1340b2,_0xa60afe){var _0x4c0675=0x0;var _0x26a27e=0x0;var _0x24102d=0x0;var _0x3c141a=[];return db['CmContact'][_0x2958('0x1c')]()['then'](function(_0x5b5e18){return BPromise[_0x2958('0x57')](_0x1340b2[_0x2958('0x32')],function(_0xa05110){var _0x1c41af={'where':{'$or':[]},'defaults':_0xa05110,'fields':_[_0x2958('0x25')](_0x5b5e18),'raw':!![]};if(_0xa05110[_0x2958('0x58')]){for(var _0x200a21=0x0;_0x200a21<_0xa05110[_0x2958('0x58')][_0x2958('0x26')];_0x200a21++){var _0x17d713={};_0x17d713[_0xa05110[_0x2958('0x58')][_0x200a21]]=_0xa05110[_0xa05110[_0x2958('0x58')][_0x200a21]];_0x1c41af[_0x2958('0x59')]['$or'][_0x2958('0x5a')](_0x17d713);}_0x1c41af[_0x2958('0x59')][_0x2958('0x5b')]=_0xa05110[_0x2958('0x5b')];}return db[_0x2958('0x22')][_0x2958('0x5c')](_0x1c41af)[_0x2958('0x5d')](function(_0x2a405f,_0x2da769){if(_0x2da769){if(_0xa05110['hasOwnProperty']('additionalPhones')){_0x3c141a['push']({'contact':_0x2a405f,'additionalPhones':_0xa05110[_0x2958('0x55')]});}_0x4c0675++;}else{_0x24102d++;}})['catch'](function(){_0x26a27e++;});});})[_0x2958('0x1d')](function(_0x2c6c08){if(_0x2c6c08){if(_0x3c141a[_0x2958('0x26')]>0x0){return new Promise(function(_0xd607db){var _0x2b4552=[];for(var _0x22714a=0x0;_0x22714a<_0x3c141a['length'];_0x22714a++){_0x2b4552[_0x2958('0x5a')](insertAdditionalPhones(_0x3c141a[_0x22714a]['contact'],_0x3c141a[_0x22714a][_0x2958('0x55')]));}Promise[_0x2958('0x5e')](_0x2b4552)[_0x2958('0x1d')](function(){_0xd607db(0x1);});})[_0x2958('0x1d')](function(){return{'success':_0x4c0675,'failure':_0x26a27e,'duplicates':_0x24102d};});}else{return{'success':_0x4c0675,'failure':_0x26a27e,'duplicates':_0x24102d};}}})[_0x2958('0x1d')](respondWithResult(_0xa60afe,0xc9))['catch'](handleError(_0xa60afe,null));};exports[_0x2958('0x5f')]=function(_0x1fde70,_0x507132){var _0x1dc5a8;return db[_0x2958('0x22')][_0x2958('0x1c')]()[_0x2958('0x1d')](function(_0x506785){return db[_0x2958('0x22')]['find']({'where':{'id':_0x1fde70[_0x2958('0x60')]['id']},'include':[{'model':db[_0x2958('0x61')],'as':'Tags','attributes':['id','name',_0x2958('0x62')],'required':_0x1fde70[_0x2958('0x20')][_0x2958('0x63')]?!![]:![]},{'model':db[_0x2958('0x45')],'as':_0x2958('0x64'),'where':{'CmContactId':_0x1fde70['params']['id']},'required':![],'include':[{'model':db[_0x2958('0x65')],'as':'ItemType'}]}],'order':[db[_0x2958('0x66')][_0x2958('0x67')]('Phones.OrderBy')],'attributes':_[_0x2958('0x25')](_0x506785)});})[_0x2958('0x1d')](function(_0x1c118d){if(!_[_0x2958('0x52')](_0x1c118d)){_0x1dc5a8=_0x1c118d[_0x2958('0x34')]({'plain':!![]});var _0x4b3fd5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x1c118d&&_0x1c118d[_0x2958('0x5b')]){if(_0x1c118d[_0x2958('0x5b')]){_0x4b3fd5[_0x2958('0x59')][_0x2958('0x68')]['push']({'ListId':{'$ne':_0x1c118d[_0x2958('0x5b')]}});}}return db[_0x2958('0x2b')]['findAll'](_0x4b3fd5);}})[_0x2958('0x1d')](function(_0x179f7f){if(!_[_0x2958('0x52')](_0x179f7f)){return _[_0x2958('0x69')](_0x1dc5a8,_[_0x2958('0x6a')](_0x179f7f,function(_0x2bdcc6){return util[_0x2958('0x6b')](_0x2958('0x6c'),_0x2bdcc6['id']);}));}})[_0x2958('0x1d')](handleEntityNotFound(_0x507132,null))[_0x2958('0x1d')](respondWithResult(_0x507132,null))[_0x2958('0x24')](handleError(_0x507132,null));};exports[_0x2958('0x15')]=function(_0x4e66b8,_0xe97151){var _0x405eb8;if(_0x4e66b8[_0x2958('0x32')]['id']){delete _0x4e66b8[_0x2958('0x32')]['id'];}if(!_[_0x2958('0x52')](_0x4e66b8[_0x2958('0x32')][_0x2958('0x51')])){var _0x195eba=_0x4e66b8[_0x2958('0x32')]['dialTimezone'];if(!_[_0x2958('0x52')](shared['timezones'][_0x195eba]))_0x4e66b8[_0x2958('0x32')][_0x2958('0x54')]=shared[_0x2958('0x53')][_0x195eba][_0x2958('0x54')];}return db[_0x2958('0x22')][_0x2958('0x23')]({'where':{'id':_0x4e66b8['params']['id']}})['then'](handleEntityNotFound(_0xe97151,null))['then'](saveUpdates(_0x4e66b8[_0x2958('0x32')],null))['then'](function(_0x64331d){_0x405eb8=_0x64331d;var _0x4467c2={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x64331d&&_0x64331d[_0x2958('0x5b')]){if(_0x64331d[_0x2958('0x5b')]){_0x4467c2['where'][_0x2958('0x68')][_0x2958('0x5a')]({'ListId':{'$ne':_0x64331d[_0x2958('0x5b')]}});}}return db[_0x2958('0x2b')][_0x2958('0x1f')](_0x4467c2);})[_0x2958('0x1d')](function(_0x53b15b){if(_0x53b15b){return _[_0x2958('0x69')](_[_0x2958('0x6d')](_0x4e66b8[_0x2958('0x32')],function(_0x501f09,_0x55db32){return _['startsWith'](_0x55db32,_0x2958('0x27'));}),_[_0x2958('0x6a')](_0x53b15b,function(_0x4ff85d){return util['format']('cf_%d',_0x4ff85d['id']);}));}})[_0x2958('0x1d')](function(_0x4547e0){if(_0x4547e0&&!_['isEmpty'](_0x4547e0)){var _0x528635=squel['update']()[_0x2958('0x6e')]('cm_contacts')['setFields'](_0x4547e0)[_0x2958('0x59')](_0x2958('0x6f'),_0x4e66b8['params']['id'])[_0x2958('0x70')]();return db[_0x2958('0x66')][_0x2958('0x20')](_0x528635[_0x2958('0x71')],{'replacements':_0x528635[_0x2958('0x72')]});}})['then'](function(){if(_0x4e66b8[_0x2958('0x32')][_0x2958('0x73')]&&_0x405eb8){return db['CmHopper'][_0x2958('0x15')]({'phone':_0x4e66b8[_0x2958('0x32')][_0x2958('0x73')],'OrderBy':0x0},{'where':{'ContactId':_0x405eb8['id']}});}})['then'](function(){return _0x405eb8;})[_0x2958('0x1d')](respondWithResult(_0xe97151,null))[_0x2958('0x24')](handleError(_0xe97151,null));};exports[_0x2958('0x74')]=function(_0x11b8bc,_0x42e61d){var _0x49c251={};var _0x293876={};var _0xca62bd;var _0x1e96a2;return db[_0x2958('0x22')][_0x2958('0x75')]({'where':{'id':_0x11b8bc[_0x2958('0x60')]['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0x42e61d,null))[_0x2958('0x1d')](function(_0x476748){if(_0x476748){_0xca62bd=_0x476748;_0x293876[_0x2958('0x76')]=_['keys'](db[_0x2958('0x61')]['rawAttributes']);_0x293876[_0x2958('0x20')]=_[_0x2958('0x25')](_0x11b8bc[_0x2958('0x20')]);_0x293876[_0x2958('0x77')]=_[_0x2958('0x78')](_0x293876['model'],_0x293876[_0x2958('0x20')]);_0x49c251[_0x2958('0x79')]=_[_0x2958('0x78')](_0x293876[_0x2958('0x76')],qs['fields'](_0x11b8bc[_0x2958('0x20')][_0x2958('0x7a')]));_0x49c251[_0x2958('0x79')]=_0x49c251[_0x2958('0x79')][_0x2958('0x26')]?_0x49c251['attributes']:_0x293876[_0x2958('0x76')];_0x49c251[_0x2958('0x7b')]=qs[_0x2958('0x7c')](_0x11b8bc[_0x2958('0x20')][_0x2958('0x7c')]);_0x49c251['where']=qs['filters'](_[_0x2958('0x7d')](_0x11b8bc[_0x2958('0x20')],_0x293876[_0x2958('0x77')]));if(_0x11b8bc[_0x2958('0x20')]['filter']){_0x49c251[_0x2958('0x59')]=_[_0x2958('0x31')](_0x49c251[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0x49c251[_0x2958('0x79')],function(_0x176f94){var _0x12442a={};_0x12442a[_0x176f94]={'$like':'%'+_0x11b8bc[_0x2958('0x20')]['filter']+'%'};return _0x12442a;})});}_0x49c251=_[_0x2958('0x31')]({},_0x49c251,_0x11b8bc[_0x2958('0x7e')]);return _0xca62bd[_0x2958('0x74')](_0x49c251);}})['then'](function(_0x2be22c){if(_0x2be22c){_0x1e96a2=_0x2be22c[_0x2958('0x26')];if(!_0x11b8bc[_0x2958('0x20')][_0x2958('0x7f')](_0x2958('0x80'))){_0x49c251['limit']=qs[_0x2958('0x81')](_0x11b8bc['query']['limit']);_0x49c251[_0x2958('0x12')]=qs[_0x2958('0x12')](_0x11b8bc[_0x2958('0x20')][_0x2958('0x12')]);}return _0xca62bd['getTags'](_0x49c251);}})['then'](function(_0x1aaf70){if(_0x1aaf70){return _0x1aaf70?{'count':_0x1e96a2,'rows':_0x1aaf70}:null;}})[_0x2958('0x1d')](respondWithResult(_0x42e61d,null))['catch'](handleError(_0x42e61d,null));};exports[_0x2958('0x82')]=function(_0x2af91b,_0x406c78){if(_0x2af91b[_0x2958('0x32')]['id']){delete _0x2af91b[_0x2958('0x32')]['id'];}return db[_0x2958('0x22')][_0x2958('0x75')]({'where':{'id':_0x2af91b[_0x2958('0x60')]['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0x406c78,null))[_0x2958('0x1d')](function(_0x2bb9d4){if(_0x2bb9d4){return _0x2bb9d4[_0x2958('0x82')](_0x2af91b[_0x2958('0x32')]['ids']||[]);}return null;})['then'](respondWithResult(_0x406c78,null))[_0x2958('0x24')](handleError(_0x406c78,null));};exports[_0x2958('0x83')]=function(_0xccae28,_0x1bd8a8){var _0x39c005=[];_0x39c005[_0x2958('0x5a')](addAdditionalPhones(_0xccae28[_0x2958('0x32')]));Promise[_0x2958('0x5e')](_0x39c005)[_0x2958('0x1d')](function(){_0x39c005=[];_0x39c005[_0x2958('0x5a')](deleteCmHopperPhones(_0xccae28[_0x2958('0x32')]['id']));_0x39c005[_0x2958('0x5a')](addCmHopperPhones(_0xccae28[_0x2958('0x32')]['id']));Promise[_0x2958('0x5e')](_0x39c005)[_0x2958('0x1d')](function(){return[0x1];})[_0x2958('0x1d')](respondWithResult(_0x1bd8a8,null));});};function addAdditionalPhones(_0x3fcef2){var _0x16ba57;return new Promise(function(_0x2be477){return db[_0x2958('0x45')]['destroy']({'where':{'CmContactId':_0x3fcef2['id']}})[_0x2958('0x1d')](function(){db['ContactItemType'][_0x2958('0x1f')]({'raw':!![],'attributes':['id',_0x2958('0x84')]})[_0x2958('0x1d')](function(_0x426e77){var _0x456961=[];for(var _0x387f52=0x0;_0x387f52<_0x3fcef2[_0x2958('0x85')][_0x2958('0x26')];_0x387f52++){var _0x2861e8=_0x3fcef2[_0x2958('0x86')]?_[_0x2958('0x52')](_0x3fcef2[_0x2958('0x86')][_0x387f52])?'':_0x3fcef2['item_types'][_0x387f52]:_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x87')]?_0x3fcef2[_0x2958('0x85')][_0x387f52]['ItemTypeId']:'';var _0x2e2a7b=_['isNil'](_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x88')])?'':_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x88')];var _0x3b7eb3=_0x2861e8+':'+_0x3fcef2[_0x2958('0x85')][_0x387f52]['phone']+'§'+_0x2e2a7b;if(_[_0x2958('0x52')](_0x16ba57))_0x16ba57=_0x3b7eb3;else _0x16ba57+=';'+_0x3b7eb3;var _0x170472=null;var _0x58ce38=null;if(_0x3fcef2['item_types']){if(!_[_0x2958('0x52')](_0x3fcef2['item_types'][_0x387f52])){_0x58ce38=_[_0x2958('0x23')](_0x426e77,function(_0x310d97){return _0x310d97['id']===_0x3fcef2[_0x2958('0x86')][_0x387f52];});if(!_[_0x2958('0x52')](_0x58ce38)){_0x170472=_0x58ce38[_0x2958('0x84')];}}}else{if(!_[_0x2958('0x52')](_0x3fcef2[_0x2958('0x85')][_0x387f52])){_0x58ce38=_['find'](_0x426e77,function(_0x2e7ea8){return _0x2e7ea8['id']===_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x87')];});if(!_[_0x2958('0x52')](_0x58ce38)){_0x170472=_0x387f52;}}}if(_[_0x2958('0x52')](_0x170472)){_0x170472=0x64;}_0x456961[_0x2958('0x5a')](addAdditionalPhone(_0x3fcef2['id'],_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x73')],_0x3fcef2[_0x2958('0x86')]?_[_0x2958('0x52')](_0x3fcef2['item_types'][_0x387f52])?null:_0x3fcef2['item_types'][_0x387f52]:_0x3fcef2[_0x2958('0x85')][_0x387f52][_0x2958('0x87')]?_0x3fcef2[_0x2958('0x85')][_0x387f52]['ItemTypeId']:null,_0x170472,_0x2e2a7b));}Promise[_0x2958('0x5e')](_0x456961)[_0x2958('0x1d')](function(){db[_0x2958('0x22')][_0x2958('0x15')]({'AdditionalPhones':_0x16ba57},{'where':{'id':_0x3fcef2['id']}})[_0x2958('0x1d')](function(){_0x2be477(0x1);});});});});});}function addAdditionalPhone(_0x40b05a,_0x381256,_0x5d5574,_0x348a61,_0x54bdc3){return db[_0x2958('0x45')][_0x2958('0x23')]({'where':{'CmContactId':_0x40b05a,'item':_0x381256}})[_0x2958('0x1d')](function(_0x3bae74){if(_0x3bae74)logger[_0x2958('0x2e')]('contact\x20phone\x20exists',_0x3bae74);else{db['CmContactHasItem'][_0x2958('0x50')]({'CmContactId':_0x40b05a,'item':_0x381256,'ItemTypeId':_0x5d5574,'OrderBy':_0x348a61,'ItemClass':_0x2958('0x89'),'description':_0x54bdc3});}});}function deleteCmHopperPhones(_0x257308){return new Promise(function(_0x29b6d3){return db['CmHopper'][_0x2958('0x1f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x257308}})['then'](function(_0x59cda5){db[_0x2958('0x8a')][_0x2958('0x3a')]({'where':{'CmHopperId':{'$in':_[_0x2958('0x6a')](_0x59cda5,'id')}}});})['then'](function(){_0x29b6d3(0x1);});});}function addCmHopperPhones(_0x255b99){return new Promise(function(_0xfe3257){return db[_0x2958('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x255b99}})[_0x2958('0x1d')](function(_0x38d95b){var _0x363b06=[];_[_0x2958('0x6a')](_0x38d95b,function(_0x164afb){_0x363b06[_0x2958('0x5a')](createCmHopperPhone(_0x255b99,_0x164afb['id']));});Promise[_0x2958('0x5e')](_0x363b06)[_0x2958('0x1d')](function(){_0xfe3257(0x1);});});});}function createCmHopperPhone(_0x1d099a,_0x23dff9){return new Promise(function(_0x5c9811){db[_0x2958('0x45')][_0x2958('0x1f')]({'raw':!![],'attributes':[_0x2958('0x8b'),_0x2958('0x84')],'where':{'CmContactId':_0x1d099a,'ItemClass':_0x2958('0x89')},'include':[{'model':db['ContactItemType'],'attributes':[_0x2958('0x84')],'as':_0x2958('0x8c')}],'order':[_0x2958('0x84'),db[_0x2958('0x66')][_0x2958('0x67')](_0x2958('0x8d'))]})['then'](function(_0x320731){var _0x596c4b=0x1;var _0xfb621a=_[_0x2958('0x6a')](_0x320731,function(_0x1ba590){_0x1ba590[_0x2958('0x8e')]=_0x23dff9;_0x1ba590['phone']=_0x1ba590['item'];_0x1ba590[_0x2958('0x84')]=_0x596c4b;delete _0x1ba590[_0x2958('0x8f')];_0x596c4b=_0x596c4b+0x1;return _0x1ba590;});return db[_0x2958('0x8a')]['bulkCreate'](_0xfb621a,{});})[_0x2958('0x1d')](function(){_0x5c9811(0x1);});});}function insertAdditionalPhones(_0x15543b,_0x1eb13d){return new Promise(function(_0x436a16){var _0x50cbd8=[];for(var _0x3045e5=0x0;_0x3045e5<_0x1eb13d[_0x2958('0x26')];_0x3045e5++){var _0x203cfb=_0x1eb13d[_0x3045e5];_0x50cbd8[_0x2958('0x5a')](parseContactItemType(_0x203cfb));}Promise[_0x2958('0x5e')](_0x50cbd8)[_0x2958('0x1d')](function(){var _0x1120b2={'id':_0x15543b['id'],'items':_0x1eb13d};return addAdditionalPhones(_0x1120b2)[_0x2958('0x1d')](function(){return addCmHopperPhones(_0x15543b['id']);});})[_0x2958('0x1d')](function(){_0x436a16(_0x15543b);});});}function parseContactItemType(_0x58fda3){return new Promise(function(_0x7a4039){if(_0x58fda3['hasOwnProperty'](_0x2958('0x87'))){_0x7a4039(_0x58fda3);}else{return db['ContactItemType'][_0x2958('0x23')]({'where':{'name':_0x58fda3[_0x2958('0x8c')]}})[_0x2958('0x1d')](function(_0x3f3442){if(_[_0x2958('0x52')](_0x3f3442))_0x58fda3[_0x2958('0x87')]=null;else _0x58fda3[_0x2958('0x87')]=_0x3f3442['id'];_0x7a4039(_0x58fda3);});}});}exports[_0x2958('0x90')]=function(_0x413f1d,_0x2380be){return db['CmContactHasItem'][_0x2958('0x1f')]({'raw':!![],'where':{'CmContactId':_0x413f1d[_0x2958('0x60')]['id'],'ItemClass':'PHONE'},'include':[{'model':db[_0x2958('0x65')],'as':_0x2958('0x8c')}],'order':[['OrderBy'],[db[_0x2958('0x66')][_0x2958('0x67')]('`ItemType`.OrderBy')]]})[_0x2958('0x1d')](function(_0x4703a3){return _0x4703a3;})[_0x2958('0x1d')](respondWithResult(_0x2380be,null))[_0x2958('0x24')](handleError(_0x2380be,null));};exports[_0x2958('0x91')]=function(_0x351373,_0x10d1fd){return db[_0x2958('0x45')][_0x2958('0x1f')]({'raw':!![],'where':{'CmContactId':_0x351373[_0x2958('0x32')]['fromContactId']}})[_0x2958('0x1d')](function(_0x38ea90){var _0x487bf8=_[_0x2958('0x6a')](_0x38ea90,function(_0x23fa69){_0x23fa69[_0x2958('0x92')]=_0x351373[_0x2958('0x32')][_0x2958('0x93')];return _0x23fa69;});return db['CmContactHasItem']['bulkCreate'](_0x487bf8,{});})[_0x2958('0x1d')](function(){return addCmHopperPhones(_0x351373['body']['toContactId']);})[_0x2958('0x1d')](function(){return['ok'];})[_0x2958('0x1d')](respondWithResult(_0x10d1fd,null))[_0x2958('0x24')](handleError(_0x10d1fd,null));};exports[_0x2958('0x94')]=function(_0x4435d7,_0x362e30){var _0x3eef06=[];_0x3eef06[_0x2958('0x5a')](createCmHopperPhone(_0x4435d7[_0x2958('0x32')]['id'],_0x4435d7[_0x2958('0x32')][_0x2958('0x95')]));Promise['all'](_0x3eef06)[_0x2958('0x1d')](function(){return[0x1];})['then'](respondWithResult(_0x362e30,null));};exports['getHoppers']=function(_0xe785ed,_0x39ee9f){var _0xd574ff={'raw':![],'where':{}};var _0x148186={};var _0x117670={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0xe785ed[_0x2958('0x60')]['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0x39ee9f,null))[_0x2958('0x1d')](function(_0x3ab28d){if(_0x3ab28d){_0x148186[_0x2958('0x76')]=_[_0x2958('0x25')](db[_0x2958('0x39')][_0x2958('0x96')]);_0x148186['query']=_[_0x2958('0x25')](_0xe785ed[_0x2958('0x20')]);_0x148186[_0x2958('0x77')]=_[_0x2958('0x78')](_0x148186[_0x2958('0x76')],_0x148186[_0x2958('0x20')]);_0xd574ff[_0x2958('0x79')]=_[_0x2958('0x78')](_0x148186[_0x2958('0x76')],qs[_0x2958('0x7a')](_0xe785ed[_0x2958('0x20')][_0x2958('0x7a')]));_0xd574ff[_0x2958('0x79')]=_0xd574ff['attributes'][_0x2958('0x26')]?_0xd574ff['attributes']:_0x148186['model'];if(!_0xe785ed[_0x2958('0x20')][_0x2958('0x7f')]('nolimit')){_0xd574ff[_0x2958('0x81')]=qs[_0x2958('0x81')](_0xe785ed[_0x2958('0x20')]['limit']);_0xd574ff[_0x2958('0x12')]=qs[_0x2958('0x12')](_0xe785ed[_0x2958('0x20')][_0x2958('0x12')]);}_0xd574ff[_0x2958('0x7b')]=qs['sort'](_0xe785ed[_0x2958('0x20')][_0x2958('0x7c')]);_0xd574ff[_0x2958('0x59')]=qs[_0x2958('0x77')](_[_0x2958('0x7d')](_0xe785ed['query'],_0x148186[_0x2958('0x77')]));_0xd574ff[_0x2958('0x59')][_0x2958('0x97')]=_0x3ab28d['id'];if(_0xe785ed[_0x2958('0x20')][_0x2958('0x98')]){_0xd574ff['where']=_[_0x2958('0x31')](_0xd574ff[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0xd574ff[_0x2958('0x79')],function(_0x55ce7d){var _0x2f1dea={};_0x2f1dea[_0x55ce7d]={'$like':'%'+_0xe785ed['query'][_0x2958('0x98')]+'%'};return _0x2f1dea;})});}_0xd574ff=_['merge']({},_0xd574ff,_0xe785ed[_0x2958('0x7e')]);return db['CmHopper'][_0x2958('0x14')]({'where':_0xd574ff[_0x2958('0x59')]})[_0x2958('0x1d')](function(_0x76c9cc){_0x117670[_0x2958('0x14')]=_0x76c9cc;if(_0xe785ed[_0x2958('0x20')][_0x2958('0x99')]){_0xd574ff[_0x2958('0x9a')]=[{'all':!![]}];}return db[_0x2958('0x39')][_0x2958('0x1f')](_0xd574ff);})[_0x2958('0x1d')](function(_0x57d717){_0x117670[_0x2958('0x9b')]=_0x57d717;return _0x117670;});}})[_0x2958('0x1d')](respondWithFilteredResult(_0x39ee9f,_0xd574ff))['catch'](handleError(_0x39ee9f,null));};exports[_0x2958('0x9c')]=function(_0x5e96b8,_0x5c761b){var _0x28bd5a={'raw':!![],'where':{}};var _0x56bc4d={};var _0x362537={'count':0x0,'rows':[]};return db[_0x2958('0x22')][_0x2958('0x75')]({'where':{'id':_0x5e96b8['params']['id']}})['then'](handleEntityNotFound(_0x5c761b,null))[_0x2958('0x1d')](function(_0x3dc870){if(_0x3dc870){_0x56bc4d[_0x2958('0x76')]=_['keys'](db[_0x2958('0x46')][_0x2958('0x96')]);_0x56bc4d['query']=_[_0x2958('0x25')](_0x5e96b8[_0x2958('0x20')]);_0x56bc4d[_0x2958('0x77')]=_[_0x2958('0x78')](_0x56bc4d[_0x2958('0x76')],_0x56bc4d[_0x2958('0x20')]);_0x28bd5a[_0x2958('0x79')]=_[_0x2958('0x78')](_0x56bc4d[_0x2958('0x76')],qs[_0x2958('0x7a')](_0x5e96b8[_0x2958('0x20')]['fields']));_0x28bd5a[_0x2958('0x79')]=_0x28bd5a[_0x2958('0x79')][_0x2958('0x26')]?_0x28bd5a[_0x2958('0x79')]:_0x56bc4d[_0x2958('0x76')];if(!_0x5e96b8[_0x2958('0x20')][_0x2958('0x7f')](_0x2958('0x80'))){_0x28bd5a[_0x2958('0x81')]=qs['limit'](_0x5e96b8['query'][_0x2958('0x81')]);_0x28bd5a[_0x2958('0x12')]=qs[_0x2958('0x12')](_0x5e96b8['query'][_0x2958('0x12')]);}_0x28bd5a['order']=qs[_0x2958('0x7c')](_0x5e96b8[_0x2958('0x20')][_0x2958('0x7c')]);_0x28bd5a[_0x2958('0x59')]=qs[_0x2958('0x77')](_[_0x2958('0x7d')](_0x5e96b8[_0x2958('0x20')],_0x56bc4d[_0x2958('0x77')]));_0x28bd5a[_0x2958('0x59')][_0x2958('0x97')]=_0x3dc870['id'];if(_0x5e96b8[_0x2958('0x20')][_0x2958('0x98')]){_0x28bd5a['where']=_['merge'](_0x28bd5a[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0x28bd5a[_0x2958('0x79')],function(_0x38f78a){var _0x52618c={};_0x52618c[_0x38f78a]={'$like':'%'+_0x5e96b8[_0x2958('0x20')]['filter']+'%'};return _0x52618c;})});}_0x28bd5a=_[_0x2958('0x31')]({},_0x28bd5a,_0x5e96b8['options']);return db[_0x2958('0x46')][_0x2958('0x14')]({'where':_0x28bd5a[_0x2958('0x59')]})[_0x2958('0x1d')](function(_0x12e976){_0x362537[_0x2958('0x14')]=_0x12e976;if(_0x5e96b8['query']['includeAll']){_0x28bd5a[_0x2958('0x9a')]=[{'all':!![]}];}return db[_0x2958('0x46')][_0x2958('0x1f')](_0x28bd5a);})[_0x2958('0x1d')](function(_0x58d2bc){_0x362537[_0x2958('0x9b')]=_0x58d2bc;return _0x362537;});}})[_0x2958('0x1d')](respondWithFilteredResult(_0x5c761b,_0x28bd5a))[_0x2958('0x24')](handleError(_0x5c761b,null));};exports[_0x2958('0x9d')]=function(_0x1508e2,_0x11d4dc){var _0x4d6a8b={'raw':!![],'where':{}};var _0xb36d57={};var _0x410c84={'count':0x0,'rows':[]};return db[_0x2958('0x22')]['findOne']({'where':{'id':_0x1508e2[_0x2958('0x60')]['id']}})['then'](handleEntityNotFound(_0x11d4dc,null))[_0x2958('0x1d')](function(_0x5081c2){if(_0x5081c2){_0xb36d57[_0x2958('0x76')]=_[_0x2958('0x25')](db[_0x2958('0x9e')][_0x2958('0x96')]);_0xb36d57['query']=_[_0x2958('0x25')](_0x1508e2[_0x2958('0x20')]);_0xb36d57[_0x2958('0x77')]=_[_0x2958('0x78')](_0xb36d57[_0x2958('0x76')],_0xb36d57[_0x2958('0x20')]);_0x4d6a8b[_0x2958('0x79')]=_[_0x2958('0x78')](_0xb36d57['model'],qs['fields'](_0x1508e2['query'][_0x2958('0x7a')]));_0x4d6a8b[_0x2958('0x79')]=_0x4d6a8b[_0x2958('0x79')]['length']?_0x4d6a8b[_0x2958('0x79')]:_0xb36d57['model'];if(!_0x1508e2['query'][_0x2958('0x7f')](_0x2958('0x80'))){_0x4d6a8b[_0x2958('0x81')]=qs['limit'](_0x1508e2[_0x2958('0x20')][_0x2958('0x81')]);_0x4d6a8b['offset']=qs[_0x2958('0x12')](_0x1508e2[_0x2958('0x20')][_0x2958('0x12')]);}_0x4d6a8b[_0x2958('0x7b')]=qs[_0x2958('0x7c')](_0x1508e2[_0x2958('0x20')][_0x2958('0x7c')]);_0x4d6a8b[_0x2958('0x59')]=qs['filters'](_[_0x2958('0x7d')](_0x1508e2[_0x2958('0x20')],_0xb36d57[_0x2958('0x77')]));_0x4d6a8b[_0x2958('0x59')]['ContactId']=_0x5081c2['id'];if(_0x1508e2[_0x2958('0x20')][_0x2958('0x98')]){_0x4d6a8b[_0x2958('0x59')]=_[_0x2958('0x31')](_0x4d6a8b[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0x4d6a8b[_0x2958('0x79')],function(_0x38ab7d){var _0x550d42={};_0x550d42[_0x38ab7d]={'$like':'%'+_0x1508e2[_0x2958('0x20')][_0x2958('0x98')]+'%'};return _0x550d42;})});}_0x4d6a8b=_[_0x2958('0x31')]({},_0x4d6a8b,_0x1508e2[_0x2958('0x7e')]);return db[_0x2958('0x9e')][_0x2958('0x14')]({'where':_0x4d6a8b[_0x2958('0x59')]})[_0x2958('0x1d')](function(_0x29f536){_0x410c84['count']=_0x29f536;if(_0x1508e2[_0x2958('0x20')][_0x2958('0x99')]){_0x4d6a8b[_0x2958('0x9a')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x2958('0x1f')](_0x4d6a8b);})[_0x2958('0x1d')](function(_0x1914e8){_0x410c84[_0x2958('0x9b')]=_0x1914e8;return _0x410c84;});}})[_0x2958('0x1d')](respondWithFilteredResult(_0x11d4dc,_0x4d6a8b))['catch'](handleError(_0x11d4dc,null));};exports[_0x2958('0x9f')]=function(_0x8658da,_0xf0b9ae){var _0x4003e4={'raw':!![],'where':{}};var _0x2c32db={};var _0xd51aa6={'count':0x0,'rows':[]};return db['CmContact'][_0x2958('0x75')]({'where':{'id':_0x8658da[_0x2958('0x60')]['id']}})[_0x2958('0x1d')](handleEntityNotFound(_0xf0b9ae,null))[_0x2958('0x1d')](function(_0x374383){if(_0x374383){_0x2c32db[_0x2958('0x76')]=_['keys'](db[_0x2958('0x4c')]['rawAttributes']);_0x2c32db[_0x2958('0x20')]=_[_0x2958('0x25')](_0x8658da[_0x2958('0x20')]);_0x2c32db[_0x2958('0x77')]=_[_0x2958('0x78')](_0x2c32db[_0x2958('0x76')],_0x2c32db[_0x2958('0x20')]);_0x4003e4[_0x2958('0x79')]=_[_0x2958('0x78')](_0x2c32db['model'],qs['fields'](_0x8658da[_0x2958('0x20')][_0x2958('0x7a')]));_0x4003e4['attributes']=_0x4003e4['attributes'][_0x2958('0x26')]?_0x4003e4[_0x2958('0x79')]:_0x2c32db[_0x2958('0x76')];if(!_0x8658da[_0x2958('0x20')]['hasOwnProperty'](_0x2958('0x80'))){_0x4003e4[_0x2958('0x81')]=qs['limit'](_0x8658da['query']['limit']);_0x4003e4[_0x2958('0x12')]=qs[_0x2958('0x12')](_0x8658da[_0x2958('0x20')][_0x2958('0x12')]);}_0x4003e4[_0x2958('0x7b')]=qs['sort'](_0x8658da[_0x2958('0x20')]['sort']);_0x4003e4[_0x2958('0x59')]=qs[_0x2958('0x77')](_[_0x2958('0x7d')](_0x8658da[_0x2958('0x20')],_0x2c32db[_0x2958('0x77')]));_0x4003e4['where']['ContactId']=_0x374383['id'];if(_0x8658da[_0x2958('0x20')][_0x2958('0x98')]){_0x4003e4[_0x2958('0x59')]=_[_0x2958('0x31')](_0x4003e4[_0x2958('0x59')],{'$or':_[_0x2958('0x6a')](_0x4003e4['attributes'],function(_0x5de095){var _0x1698f2={};_0x1698f2[_0x5de095]={'$like':'%'+_0x8658da[_0x2958('0x20')][_0x2958('0x98')]+'%'};return _0x1698f2;})});}_0x4003e4=_['merge']({},_0x4003e4,_0x8658da[_0x2958('0x7e')]);return db[_0x2958('0x4c')][_0x2958('0x14')]({'where':_0x4003e4['where']})[_0x2958('0x1d')](function(_0x4e52f0){_0xd51aa6[_0x2958('0x14')]=_0x4e52f0;if(_0x8658da[_0x2958('0x20')][_0x2958('0x99')]){_0x4003e4[_0x2958('0x9a')]=[{'all':!![]}];}return db[_0x2958('0x4c')]['findAll'](_0x4003e4);})[_0x2958('0x1d')](function(_0xf0a1dc){_0xd51aa6[_0x2958('0x9b')]=_0xf0a1dc;return _0xd51aa6;});}})[_0x2958('0x1d')](respondWithFilteredResult(_0xf0b9ae,_0x4003e4))[_0x2958('0x24')](handleError(_0xf0b9ae,null));};exports[_0x2958('0xa0')]=function(_0x307e6e,_0xdc2bd3){try{if(!_0x307e6e[_0x2958('0x32')][_0x2958('0x5b')]){throw new Error(_0x2958('0xa1'));}if(!_0x307e6e[_0x2958('0x32')][_0x2958('0xa2')]){throw new Error(_0x2958('0xa3'));}if(!_0x307e6e[_0x2958('0x32')][_0x2958('0xa4')]){throw new Error(_0x2958('0xa5'));}if(!_0x307e6e[_0x2958('0x32')]['socket_timestamp']){throw new Error(_0x2958('0xa6'));}var _0x5d5ac9=_0x307e6e[_0x2958('0x32')][_0x2958('0xa2')][_0x2958('0xa7')](',');var _0x44da7c=_0x307e6e[_0x2958('0x32')][_0x2958('0xa4')][_0x2958('0xa7')](',');if(!_0x5d5ac9[_0x2958('0x26')]||!_0x44da7c[_0x2958('0x26')]||_0x5d5ac9[_0x2958('0x26')]!==_0x44da7c[_0x2958('0x26')]){throw new Error(_0x2958('0xa8'));}_0x307e6e[_0x2958('0x32')][_0x2958('0x7a')]=_['zipObject'](_0x5d5ac9,_0x44da7c);if(!_0x307e6e[_0x2958('0x32')][_0x2958('0x7a')][_0x2958('0x73')]){throw new Error(_0x2958('0xa9'));}if(!_0x307e6e[_0x2958('0x32')][_0x2958('0x7a')][_0x2958('0xaa')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x77c1e1=path['join'](config[_0x2958('0xab')],_0x2958('0xac'),_0x307e6e['file'][_0x2958('0xad')]);fs[_0x2958('0xae')](_0x77c1e1,parseInt('0777',0x8));var _0x198dfa=require(_0x2958('0xaf'))[_0x2958('0xb0')](path[_0x2958('0xb1')](__dirname,_0x2958('0xb2')),[_0x77c1e1,_0x307e6e['body']['binding_keys'],_0x307e6e['body'][_0x2958('0xa4')],_0x307e6e[_0x2958('0x32')][_0x2958('0x5b')],_0x307e6e['body']['CompanyId'],_0x307e6e[_0x2958('0x32')][_0x2958('0x58')],_0x307e6e[_0x2958('0x32')][_0x2958('0xb3')]]);return _0xdc2bd3['status'](0xc8)[_0x2958('0x11')]({'message':'File\x20uploaded\x20correctly!','pid':_0x198dfa['pid']});}catch(_0x4dc429){return _0xdc2bd3['status'](0x1f4)[_0x2958('0x1a')](_0x4dc429);}};exports[_0x2958('0xb4')]=function(_0xac962b,_0x4533c3){var _0x34a36f=fs[_0x2958('0xb5')](_0xac962b[_0x2958('0xb6')]['path']);Papa[_0x2958('0xb7')](_0x34a36f,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0xf318d6){return _0x4533c3[_0x2958('0x10')](0xc8)[_0x2958('0x11')]({'file':_0xac962b[_0x2958('0xb6')],'fields':_0xf318d6[_0x2958('0xb8')][_0x2958('0x7a')]});}});};exports['import']=function(_0x305356,_0x408528){return db[_0x2958('0xb9')][_0x2958('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x2958('0x1d')](function(_0x2d18d2){var _0x1508d1=![];if(!_0x305356[_0x2958('0x32')][_0x2958('0x5b')]){throw new Error(_0x2958('0xa1'));}if(!_0x305356['body']['binding'][_0x2958('0x73')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x305356[_0x2958('0x32')][_0x2958('0xba')][_0x2958('0xaa')]){throw new Error(_0x2958('0xbb'));}if(!_0x305356[_0x2958('0x32')][_0x2958('0xb3')]){throw new Error(_0x2958('0xa6'));}var _0x54a5fc=require(_0x2958('0xaf'))[_0x2958('0xb0')](path[_0x2958('0xb1')](__dirname,_0x2958('0xbc')),[_0x305356[_0x2958('0x60')]['id'],JSON[_0x2958('0xbd')](_0x305356[_0x2958('0x32')]),JSON[_0x2958('0xbd')](_0x2d18d2)]);_0x54a5fc['on'](_0x2958('0xbe'),function(){_0x1508d1=!![];return _0x408528[_0x2958('0x10')](0xc8)[_0x2958('0x11')]({'message':_0x2958('0xbf'),'pid':_0x54a5fc[_0x2958('0xc0')]});});_0x54a5fc['on'](_0x2958('0xc1'),function(_0x428e11){if(_0x428e11&&!_0x1508d1){return _0x408528[_0x2958('0x10')](0x1f4)['json']({'message':_0x2958('0xc2'),'pid':_0x54a5fc['pid']});}});})[_0x2958('0x24')](handleError(_0x408528,null));};exports[_0x2958('0xc3')]=function(_0x406ecd,_0xce0936){return db[_0x2958('0xb9')][_0x2958('0x1f')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x2958('0x1d')](function(_0x37c43b){var _0x1a8ce7=![];if(!_0x406ecd['body']['ListId']){throw new Error(_0x2958('0xa1'));}if(!_0x406ecd[_0x2958('0x32')][_0x2958('0xba')][_0x2958('0x73')]){throw new Error(_0x2958('0xa9'));}if(!_0x406ecd[_0x2958('0x32')][_0x2958('0xba')][_0x2958('0xaa')]){throw new Error(_0x2958('0xbb'));}if(!_0x406ecd['body'][_0x2958('0xb3')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2b323c=require(_0x2958('0xaf'))[_0x2958('0xb0')](path[_0x2958('0xb1')](__dirname,_0x2958('0xc4')),[_0x406ecd[_0x2958('0x60')]['id'],JSON['stringify'](_0x406ecd[_0x2958('0x32')]),JSON[_0x2958('0xbd')](_0x37c43b)]);_0x2b323c['on'](_0x2958('0xbe'),function(){_0x1a8ce7=!![];return _0xce0936[_0x2958('0x10')](0xc8)['json']({'message':_0x2958('0xbf'),'pid':_0x2b323c['pid']});});_0x2b323c['on'](_0x2958('0xc1'),function(_0x249d99){if(_0x249d99&&!_0x1a8ce7){return _0xce0936[_0x2958('0x10')](0x1f4)[_0x2958('0x11')]({'message':_0x2958('0xc2'),'pid':_0x2b323c['pid']});}});})[_0x2958('0x24')](handleError(_0xce0936,null));};exports[_0x2958('0xc5')]=function(_0x439db3,_0xa68cf0){var _0x1fa226=[_0x2958('0xc6'),_0x2958('0xc7'),_0x2958('0xc8'),_0x2958('0xc9'),_0x2958('0xca'),_0x2958('0xcb'),_0x2958('0xcc')];var _0x21b0d7={'offset':0x0,'order':qs['sort'](_0x2958('0xcd'))},_0x1169aa={'count':0x0,'rows':[]};Promise[_0x2958('0xce')]()['then'](function(){if(_0x439db3[_0x2958('0x20')][_0x2958('0xcf')]){if(!_[_0x2958('0xd0')](_0x1fa226,_0x439db3['query'][_0x2958('0xcf')][_0x2958('0xd1')]())){throw new Error(_0x2958('0xd2'));}_0x1fa226=[_0x439db3[_0x2958('0x20')][_0x2958('0xcf')][_0x2958('0xd1')]()];}if(_0x439db3['query'][_0x2958('0xd3')]){try{var _0x5e61a5=JSON['parse'](_0x439db3[_0x2958('0x20')]['range']);if(!moment(_0x5e61a5[_0x2958('0x33')])[_0x2958('0xd4')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x5e61a5['to'])[_0x2958('0xd4')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x444dd0){throw new Error(_0x2958('0xd5'));}}if(!_0x439db3['query'][_0x2958('0x7f')]('nolimit')){_0x21b0d7['limit']=qs[_0x2958('0x81')](_0x439db3[_0x2958('0x20')][_0x2958('0x81')]||0xa);_0x21b0d7[_0x2958('0x12')]=qs[_0x2958('0x12')](_0x439db3[_0x2958('0x20')][_0x2958('0x12')]);}var _0x2e64c9=_0x1fa226['map'](function(_0x53269c){if(_0x53269c===_0x2958('0xcc')){var _0x4e3ccb={'attributes':['id',_0x2958('0xd6'),'type',_0x2958('0xd7'),_0x2958('0xd8'),_0x2958('0xd9'),_0x2958('0xda'),_0x2958('0xdb'),_0x2958('0xdc'),_0x2958('0xdd'),_0x2958('0xde'),_0x2958('0xdf'),_0x2958('0xe0'),'userThirdDisposition','UserId'],'where':{'ContactId':_0x439db3[_0x2958('0x60')]['id']},'include':[{'model':db[_0x2958('0xb9')],'as':_0x2958('0xb9'),'attributes':['id',_0x2958('0x19'),_0x2958('0xe1'),_0x2958('0x2c')]}],'order':[[_0x2958('0xde'),'DESC']]};if(_0x439db3[_0x2958('0x20')][_0x2958('0xd3')]){_0x4e3ccb['where'][_0x2958('0xde')]={'$gte':_0x5e61a5['from'],'$lte':_0x5e61a5['to']};}return db[_0x2958('0x48')][_0x2958('0xe2')](_0x4e3ccb)['then'](function(_0x3f8e9c){_0x1169aa[_0x2958('0x14')]+=_0x3f8e9c[_0x2958('0x14')];return _[_0x2958('0x6a')](_0x3f8e9c[_0x2958('0x9b')],function(_0x4c26e8){var _0x5f4bbd=_0x4c26e8[_0x2958('0x34')]({'plain':!![]});_0x5f4bbd[_0x2958('0xcf')]=_0x53269c;if(_0x5f4bbd[_0x2958('0xb9')]){_0x5f4bbd[_0x2958('0xb9')]={'id':_0x5f4bbd[_0x2958('0xb9')]['id'],'name':_0x5f4bbd[_0x2958('0xb9')][_0x2958('0x19')],'fullname':_0x5f4bbd[_0x2958('0xb9')][_0x2958('0xe1')],'alias':_0x5f4bbd[_0x2958('0xb9')][_0x2958('0x2c')]};}return _0x5f4bbd;});});}else{var _0x37f99b=_[_0x2958('0xe3')](_0x53269c)+(_0x53269c===_0x2958('0xc7')?'Website':_0x2958('0xe4'));var _0x56b8b0={'attributes':['id','closed','closedAt',_0x2958('0xde'),'note',_0x2958('0xe5'),'secondDisposition','thirdDisposition',_0x2958('0xe6'),_0x37f99b+'Id'],'where':{'ContactId':_0x439db3[_0x2958('0x60')]['id']},'include':[{'model':db[_0x37f99b],'as':'Account','attributes':['id',_0x2958('0x19'),_0x2958('0xe7')]},{'model':db['User'],'as':_0x2958('0xe8'),'attributes':['id',_0x2958('0x19'),_0x2958('0xe1')]},{'model':db[_0x2958('0x61')],'as':_0x2958('0xe9'),'attributes':['id','name',_0x2958('0x62')],'through':{'attributes':[]}}],'order':[['createdAt',_0x2958('0xea')]]};if(_0x439db3[_0x2958('0x20')][_0x2958('0xd3')]){_0x56b8b0[_0x2958('0x59')]['createdAt']={'$gte':_0x5e61a5[_0x2958('0x33')],'$lte':_0x5e61a5['to']};}switch(_0x53269c){case _0x2958('0xc7'):_0x56b8b0[_0x2958('0x79')][_0x2958('0x5a')](_0x2958('0xeb'),_0x2958('0xec'),_0x2958('0xed'),_0x2958('0xee'),'osName',_0x2958('0xef'),_0x2958('0xf0'),'ratingValue',_0x2958('0xf1'));break;case _0x2958('0xc6'):_0x56b8b0[_0x2958('0x79')][_0x2958('0x5a')]('subject',_0x2958('0xf2'));break;case'openchannel':_0x56b8b0['attributes'][_0x2958('0x5a')](_0x2958('0xf3'),_0x2958('0xf4'));break;}return db[_[_0x2958('0xe3')](_0x53269c)+'Interaction'][_0x2958('0xe2')](_0x56b8b0)[_0x2958('0x1d')](function(_0x1ae511){_0x1169aa['count']+=_0x1ae511['count'];return _['map'](_0x1ae511[_0x2958('0x9b')],function(_0x2e18b7){var _0x3cd4a2=_0x2e18b7[_0x2958('0x34')]({'plain':!![]});_0x3cd4a2[_0x2958('0xcf')]=_0x53269c;if(_0x3cd4a2[_0x2958('0xe8')]){_0x3cd4a2[_0x2958('0xe8')]={'id':_0x3cd4a2[_0x2958('0xe8')]['id'],'name':_0x3cd4a2[_0x2958('0xe8')][_0x2958('0x19')],'fullname':_0x3cd4a2[_0x2958('0xe8')][_0x2958('0xe1')]};}return _0x3cd4a2;});});}});return Promise[_0x2958('0x5e')](_0x2e64c9);})[_0x2958('0x1d')](function(_0xf16241){return _(_0xf16241)[_0x2958('0xf5')]()[_0x2958('0xf6')](_0x2958('0xde'))['reverse']()[_0x2958('0xf7')]();})['then'](function(_0x3a3da3){_0x1169aa[_0x2958('0x9b')]=_0x21b0d7[_0x2958('0x81')]?_0x3a3da3[_0x2958('0xf8')](_0x21b0d7['offset'],_0x21b0d7['offset']+_0x21b0d7[_0x2958('0x81')]):_0x3a3da3;return _0x1169aa;})[_0x2958('0x1d')](respondWithFilteredResult(_0xa68cf0,_0x21b0d7))['catch'](handleError(_0xa68cf0,null));};
\ No newline at end of file
index a3f8b47..6dd219d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe092=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x13d1e8,_0x3a06bd){var _0x2b9a0d=function(_0x443966){while(--_0x443966){_0x13d1e8['push'](_0x13d1e8['shift']());}};_0x2b9a0d(++_0x3a06bd);}(_0xe092,0x82));var _0x2e09=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xe092[_0x4aa4e6];return _0x322588;};'use strict';var EventEmitter=require(_0x2e09('0x0'));var CmContact=require(_0x2e09('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x2e09('0x2')](0x0);var events={'afterCreate':_0x2e09('0x3'),'afterUpdate':'update','afterDestroy':_0x2e09('0x4')};function emitEvent(_0x45f774){return function(_0x2b7a2e,_0x6b91f,_0x47e286){CmContactEvents[_0x2e09('0x5')](_0x45f774+':'+_0x2b7a2e['id'],_0x2b7a2e);CmContactEvents[_0x2e09('0x5')](_0x45f774,_0x2b7a2e);_0x47e286(null);};}for(var e in events){if(events[_0x2e09('0x6')](e)){var event=events[e];CmContact[_0x2e09('0x7')](e,emitEvent(event));}}module[_0x2e09('0x8')]=CmContactEvents;
\ No newline at end of file
+var _0x5765=['events','../../mysqldb','CmContact','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x2f09f7,_0x461707){var _0x1b266c=function(_0xbff8dc){while(--_0xbff8dc){_0x2f09f7['push'](_0x2f09f7['shift']());}};_0x1b266c(++_0x461707);}(_0x5765,0x157));var _0x5576=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0x5765[_0x441563];return _0x2369ec;};'use strict';var EventEmitter=require(_0x5576('0x0'));var CmContact=require(_0x5576('0x1'))['db'][_0x5576('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x5576('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5576('0x4'),'afterDestroy':'remove'};function emitEvent(_0x10bc6e){return function(_0x405ef9,_0x3a6d40,_0xee07b9){CmContactEvents['emit'](_0x10bc6e+':'+_0x405ef9['id'],_0x405ef9);CmContactEvents[_0x5576('0x5')](_0x10bc6e,_0x405ef9);_0xee07b9(null);};}for(var e in events){if(events[_0x5576('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents;
\ No newline at end of file
index c97b97c..e62bfc9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa694=['cmContact,\x20afterCreate,\x20','create','catch','inspect','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','CmList','Lists','dialCheckDuplicateType','always','onlyIfOpen','BlackLists','length','CmHopperBlack','cmContact,\x20%s,\x20%s','message','List\x20not\x20found','destroy','ContactId','VoiceQueueId','CampaignId','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../config/environment/shared','exports','define','CmContact','cm_contacts','phone','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','format','isNil','dialTimezone','VoiceQueue','findOne','timezones','utcOffset','scheduledat','add','minutes','YYYY-MM-DD\x20HH:mm:ss','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xa694,0x65));var _0x4a69=function(_0x31cfaa,_0x56581b){_0x31cfaa=_0x31cfaa-0x0;var _0x22a3df=_0xa694[_0x31cfaa];return _0x22a3df;};'use strict';var _=require(_0x4a69('0x0'));var util=require('util');var logger=require(_0x4a69('0x1'))(_0x4a69('0x2'));var moment=require(_0x4a69('0x3'));var BPromise=require(_0x4a69('0x4'));var rp=require(_0x4a69('0x5'));var fs=require('fs');var path=require(_0x4a69('0x6'));var rimraf=require(_0x4a69('0x7'));var config=require(_0x4a69('0x8'));var shared=require(_0x4a69('0x9'));var attributes=require('./cmContact.attributes');module[_0x4a69('0xa')]=function(_0x2e8389,_0x192df2){return _0x2e8389[_0x4a69('0xb')](_0x4a69('0xc'),attributes,{'tableName':_0x4a69('0xd'),'paranoid':!![],'indexes':[{'name':'phone','fields':[_0x4a69('0xe')]},{'name':_0x4a69('0xf'),'fields':[_0x4a69('0x10'),'lastName',_0x4a69('0xe'),_0x4a69('0x11'),_0x4a69('0x12'),_0x4a69('0x13')],'type':_0x4a69('0x14')}],'timestamps':!![],'charset':_0x4a69('0x15'),'collate':_0x4a69('0x16'),'hooks':{'afterCreate':function(_0x3fd2e0,_0x1e3195,_0x3762ac){var _0x711081=_0x2e8389[_0x4a69('0x17')];var _0x44854e=_0x3fd2e0[_0x4a69('0x18')]({'plain':!![]});function _0x1d21d4(){return function(_0x28834a){logger[_0x4a69('0x19')](_0x4a69('0x1a'),_0x4a69('0x1b'),util['inspect'](_0x28834a,{'showHidden':![],'depth':null}));};}function _0x12f632(_0x4d4ed2,_0x50a109){var _0x258dc4=_0x50a109['scheduledat']?_0x50a109['scheduledat']:moment()[_0x4a69('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');return new BPromise(function(_0x319321,_0x360533){if(_[_0x4a69('0x1d')](_0x50a109[_0x4a69('0x1e')])){_0x319321({'ret':_0x258dc4});}else{_0x711081[_0x4a69('0x1f')][_0x4a69('0x20')]({'where':{'id':_0x4d4ed2['id']}})['then'](function(_0x129375){if(!_['isNil'](_0x129375)){var _0x2c9ab5=_0x129375[_0x4a69('0x1e')];if(!_[_0x4a69('0x1d')](_0x2c9ab5)){var _0x3a2de1=shared[_0x4a69('0x21')];var _0x38cd01=_0x3a2de1[_0x2c9ab5];var _0x5744c9=_0x3a2de1[_0x50a109[_0x4a69('0x1e')]];if(!_[_0x4a69('0x1d')](_0x38cd01)&&!_[_0x4a69('0x1d')](_0x5744c9)){var _0x419bf3=_0x38cd01[_0x4a69('0x22')]-_0x5744c9[_0x4a69('0x22')];_0x258dc4=_0x50a109['scheduledat']?_0x50a109[_0x4a69('0x23')]:moment();var _0xddadf2=moment(_0x258dc4)[_0x4a69('0x24')](_0x419bf3,_0x4a69('0x25'));_0x319321({'ret':_0xddadf2[_0x4a69('0x1c')](_0x4a69('0x26'))});}else _0x319321({'ret':_0x258dc4});}else _0x319321({'ret':_0x258dc4});}else{_0x319321({'ret':_0x258dc4});}});}});return 0xa;}var _0x202afa=function(_0x32259e){return new BPromise(function(_0x4c5e71,_0x322712){_0x12f632(_0x32259e,_0x44854e)['then'](function(_0x284fc7){_0x44854e['scheduledat']=_0x284fc7[_0x4a69('0x27')];_0x711081[_0x4a69('0x28')][_0x4a69('0x20')]({'where':{'phone':_0x44854e[_0x4a69('0xe')],'VoiceQueueId':_0x32259e['id']}})['then'](function(_0x561eeb){if(!_[_0x4a69('0x1d')](_0x561eeb)){throw new Error(_0x4a69('0x29')+_0x44854e[_0x4a69('0xe')]+_0x4a69('0x2a')+_0x32259e['id']);}return _0x711081[_0x4a69('0x28')]['create']({'phone':_0x44854e[_0x4a69('0xe')],'ContactId':_0x44854e['id'],'ListId':_0x44854e[_0x4a69('0x2b')],'priority':_0x44854e[_0x4a69('0x2c')]?_0x44854e['priority']:0x2,'scheduledat':_0x44854e[_0x4a69('0x23')]?_0x44854e['scheduledat']:moment()[_0x4a69('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x44854e[_0x4a69('0x2d')]?!![]:![],'callbackuniqueid':_0x44854e[_0x4a69('0x2d')]?_0x44854e[_0x4a69('0x2d')]:undefined,'callbackat':_0x44854e[_0x4a69('0x2d')]?moment()[_0x4a69('0x1c')](_0x4a69('0x26')):undefined,'VoiceQueueId':_0x32259e['id']});})['catch'](function(_0x2fcda6){_0x322712(_0x2fcda6);});});});};var _0x5b5fa0=function(_0x5c8470){return new BPromise(function(_0x3b732b,_0x298f02){_0x12f632(_0x5c8470,_0x44854e)[_0x4a69('0x2e')](function(_0xe1f301){_0x44854e[_0x4a69('0x23')]=_0xe1f301[_0x4a69('0x27')];_0x711081['CmHopper'][_0x4a69('0x20')]({'where':{'phone':_0x44854e[_0x4a69('0xe')],'VoiceQueueId':_0x5c8470['id']}})[_0x4a69('0x2e')](function(_0x1781f8){if(!_[_0x4a69('0x1d')](_0x1781f8)){throw new Error(_0x4a69('0x29')+_0x44854e['phone']+_0x4a69('0x2f')+_0x5c8470['id']);}return _0x711081[_0x4a69('0x30')][_0x4a69('0x20')]({'where':{'calleridnum':_0x44854e['phone'],'VoiceQueueId':_0x5c8470['id']}});})['then'](function(_0x15ea07){if(!_['isNil'](_0x15ea07)){throw new Error(_0x4a69('0x31')+_0x44854e[_0x4a69('0xe')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'+_0x5c8470['id']);}return _0x711081[_0x4a69('0x28')][_0x4a69('0x32')]({'phone':_0x44854e['phone'],'ContactId':_0x44854e['id'],'ListId':_0x44854e[_0x4a69('0x2b')],'priority':_0x44854e['priority']?_0x44854e[_0x4a69('0x2c')]:0x2,'scheduledat':_0x44854e[_0x4a69('0x23')]?_0x44854e[_0x4a69('0x23')]:moment()[_0x4a69('0x1c')](_0x4a69('0x26')),'callback':_0x44854e[_0x4a69('0x2d')]?!![]:![],'callbackuniqueid':_0x44854e[_0x4a69('0x2d')]?_0x44854e[_0x4a69('0x2d')]:undefined,'callbackat':_0x44854e[_0x4a69('0x2d')]?moment()[_0x4a69('0x1c')](_0x4a69('0x26')):undefined,'VoiceQueueId':_0x5c8470['id']});})[_0x4a69('0x33')](function(_0x582622){_0x298f02(_0x582622);});});});};function _0x8eca82(){return function(_0x4d095b){logger[_0x4a69('0x19')](_0x4a69('0x1a'),'afterCreate',util[_0x4a69('0x34')](_0x4d095b,{'showHidden':![],'depth':null}));};}function _0x21d86c(_0x572c79,_0x157b96){var _0x580813=_0x157b96['scheduledat']?_0x157b96['scheduledat']:moment()[_0x4a69('0x1c')](_0x4a69('0x26'));return new BPromise(function(_0x57d3c2,_0x398736){if(_[_0x4a69('0x1d')](_0x157b96[_0x4a69('0x1e')])){_0x57d3c2({'ret':_0x580813});}else{_0x711081[_0x4a69('0x35')]['findOne']({'where':{'id':_0x572c79['id']}})[_0x4a69('0x2e')](function(_0x74085b){if(!_[_0x4a69('0x1d')](_0x74085b)){var _0x5e15a2=_0x74085b['dialTimezone'];if(!_['isNil'](_0x5e15a2)){var _0x5018ad=shared[_0x4a69('0x21')];var _0x32c836=_0x5018ad[_0x5e15a2];var _0xbbd957=_0x5018ad[_0x157b96['dialTimezone']];if(!_[_0x4a69('0x1d')](_0x32c836)&&!_[_0x4a69('0x1d')](_0xbbd957)){var _0x5e180b=_0x32c836['utcOffset']-_0xbbd957[_0x4a69('0x22')];_0x580813=_0x157b96[_0x4a69('0x23')]?_0x157b96[_0x4a69('0x23')]:moment();var _0x674926=moment(_0x580813)['add'](_0x5e180b,_0x4a69('0x25'));_0x57d3c2({'ret':_0x674926['format'](_0x4a69('0x26'))});}else _0x57d3c2({'ret':_0x580813});}else _0x57d3c2({'ret':_0x580813});}else{_0x57d3c2({'ret':_0x580813});}});}});return 0xa;}var _0x597e7a=function(_0x46606a){return new BPromise(function(_0x535325,_0x603f4a){_0x21d86c(_0x46606a,_0x44854e)[_0x4a69('0x2e')](function(_0x35d310){_0x44854e[_0x4a69('0x23')]=_0x35d310[_0x4a69('0x27')];_0x711081[_0x4a69('0x28')]['findOne']({'where':{'phone':_0x44854e[_0x4a69('0xe')],'CampaignId':_0x46606a['id']}})[_0x4a69('0x2e')](function(_0x6d358b){if(!_[_0x4a69('0x1d')](_0x6d358b)){throw new Error(_0x4a69('0x29')+_0x44854e['phone']+_0x4a69('0x36')+_0x46606a['id']);}return _0x711081['CmHopper'][_0x4a69('0x32')]({'phone':_0x44854e['phone'],'ContactId':_0x44854e['id'],'ListId':_0x44854e[_0x4a69('0x2b')],'priority':_0x44854e[_0x4a69('0x2c')]?_0x44854e[_0x4a69('0x2c')]:0x2,'scheduledat':_0x44854e[_0x4a69('0x23')]?_0x44854e[_0x4a69('0x23')]:moment()[_0x4a69('0x1c')](_0x4a69('0x26')),'callback':_0x44854e[_0x4a69('0x2d')]?!![]:![],'callbackuniqueid':_0x44854e[_0x4a69('0x2d')]?_0x44854e['callbackUniqueid']:undefined,'callbackat':_0x44854e['callbackUniqueid']?moment()[_0x4a69('0x1c')](_0x4a69('0x26')):undefined,'CampaignId':_0x46606a['id']});})[_0x4a69('0x33')](function(_0x12cf7d){_0x603f4a(_0x12cf7d);});});});};var _0x31f06d=function(_0x347785){return new BPromise(function(_0x38fb64,_0x3474a9){_0x21d86c(_0x347785,_0x44854e)[_0x4a69('0x2e')](function(_0x2d787e){_0x44854e[_0x4a69('0x23')]=_0x2d787e['ret'];_0x711081[_0x4a69('0x28')][_0x4a69('0x20')]({'where':{'phone':_0x44854e[_0x4a69('0xe')],'CampaignId':_0x347785['id']}})[_0x4a69('0x2e')](function(_0x24435f){if(!_[_0x4a69('0x1d')](_0x24435f)){throw new Error(_0x4a69('0x29')+_0x44854e[_0x4a69('0xe')]+_0x4a69('0x37')+_0x347785['id']);}return _0x711081[_0x4a69('0x30')]['findOne']({'where':{'calleridnum':_0x44854e['phone'],'CampaignId':_0x347785['id']}});})[_0x4a69('0x2e')](function(_0x399b3c){if(!_[_0x4a69('0x1d')](_0x399b3c)){throw new Error(_0x4a69('0x31')+_0x44854e[_0x4a69('0xe')]+_0x4a69('0x38')+_0x347785['id']);}return _0x711081[_0x4a69('0x28')][_0x4a69('0x32')]({'phone':_0x44854e[_0x4a69('0xe')],'ContactId':_0x44854e['id'],'ListId':_0x44854e[_0x4a69('0x2b')],'priority':_0x44854e[_0x4a69('0x2c')]?_0x44854e[_0x4a69('0x2c')]:0x2,'scheduledat':_0x44854e[_0x4a69('0x23')]?_0x44854e[_0x4a69('0x23')]:moment()['format'](_0x4a69('0x26')),'callback':_0x44854e[_0x4a69('0x2d')]?!![]:![],'callbackuniqueid':_0x44854e[_0x4a69('0x2d')]?_0x44854e[_0x4a69('0x2d')]:undefined,'callbackat':_0x44854e[_0x4a69('0x2d')]?moment()[_0x4a69('0x1c')](_0x4a69('0x26')):undefined,'CampaignId':_0x347785['id']});})[_0x4a69('0x33')](function(_0x7c48d9){_0x3474a9(_0x7c48d9);});});});};if(_0x44854e[_0x4a69('0x2b')]){_0x711081[_0x4a69('0x1f')][_0x4a69('0x39')]({'where':{'type':'outbound'},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x711081[_0x4a69('0x3a')],'as':_0x4a69('0x3b'),'where':{'id':_0x44854e[_0x4a69('0x2b')]}}]})[_0x4a69('0x2e')](function(_0xa18d53){if(_0xa18d53){var _0x4b2c1a=[];for(var _0x17e83f=0x0,_0x4866e4;_0x17e83f<_0xa18d53['length'];_0x17e83f+=0x1){_0x4866e4=_0xa18d53[_0x17e83f]['get']({'plain':!![]});switch(_0x4866e4[_0x4a69('0x3c')]){case _0x4a69('0x3d'):_0x5b5fa0(_0x4866e4)[_0x4a69('0x33')](_0x1d21d4());break;case _0x4a69('0x3e'):_0x202afa(_0x4866e4)['catch'](_0x1d21d4());break;default:_0x21d86c(_0x4866e4,_0x44854e)['then'](function(_0x506df7){_0x44854e[_0x4a69('0x23')]=_0x506df7[_0x4a69('0x27')];_0x711081[_0x4a69('0x28')]['create']({'phone':_0x44854e[_0x4a69('0xe')],'ContactId':_0x44854e['id'],'ListId':_0x44854e[_0x4a69('0x2b')],'scheduledat':_0x44854e[_0x4a69('0x23')]?_0x44854e[_0x4a69('0x23')]:moment()[_0x4a69('0x1c')](_0x4a69('0x26')),'priority':_0x44854e[_0x4a69('0x2c')]?_0x44854e['priority']:0x2,'callback':_0x44854e['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x44854e[_0x4a69('0x2d')]?_0x44854e['callbackUniqueid']:undefined,'callbackat':_0x44854e['callbackUniqueid']?moment()[_0x4a69('0x1c')](_0x4a69('0x26')):undefined,'VoiceQueueId':_0x4866e4['id']})[_0x4a69('0x33')](_0x1d21d4());});}}}})[_0x4a69('0x2e')](function(){return _0x711081[_0x4a69('0x1f')][_0x4a69('0x39')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x711081[_0x4a69('0x3a')],'as':_0x4a69('0x3f'),'where':{'id':_0x44854e[_0x4a69('0x2b')]}}]})[_0x4a69('0x2e')](function(_0x452583){if(_0x452583){var _0x5076c5=[];for(var _0x3fedce=0x0,_0x1b5efb;_0x3fedce<_0x452583[_0x4a69('0x40')];_0x3fedce+=0x1){_0x1b5efb=_0x452583[_0x3fedce][_0x4a69('0x18')]({'plain':!![]});_0x711081[_0x4a69('0x41')][_0x4a69('0x32')]({'phone':_0x44854e['phone'],'ContactId':_0x44854e['id'],'ListId':_0x44854e['ListId'],'VoiceQueueId':_0x1b5efb['id']})[_0x4a69('0x33')](function(_0x17ac63){logger[_0x4a69('0x19')](_0x4a69('0x42'),_0x4a69('0x1b'),_0x17ac63['message']);});}}});})[_0x4a69('0x2e')](function(){return _0x711081['Campaign'][_0x4a69('0x39')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x711081[_0x4a69('0x3a')],'as':'Lists','where':{'id':_0x44854e[_0x4a69('0x2b')]}}]})[_0x4a69('0x2e')](function(_0x27e288){if(_0x27e288){var _0xffef93=[];for(var _0x1b89a1=0x0,_0x55430d;_0x1b89a1<_0x27e288[_0x4a69('0x40')];_0x1b89a1+=0x1){_0x55430d=_0x27e288[_0x1b89a1][_0x4a69('0x18')]({'plain':!![]});switch(_0x55430d['dialCheckDuplicateType']){case _0x4a69('0x3d'):_0x31f06d(_0x55430d)[_0x4a69('0x33')](_0x8eca82());break;case _0x4a69('0x3e'):_0x597e7a(_0x55430d)[_0x4a69('0x33')](_0x8eca82());break;default:_0x711081[_0x4a69('0x28')]['create']({'phone':_0x44854e[_0x4a69('0xe')],'ContactId':_0x44854e['id'],'ListId':_0x44854e[_0x4a69('0x2b')],'scheduledat':_0x44854e[_0x4a69('0x23')]?_0x44854e[_0x4a69('0x23')]:moment()[_0x4a69('0x1c')](_0x4a69('0x26')),'priority':_0x44854e[_0x4a69('0x2c')]?_0x44854e[_0x4a69('0x2c')]:0x2,'callback':_0x44854e[_0x4a69('0x2d')]?!![]:![],'callbackuniqueid':_0x44854e[_0x4a69('0x2d')]?_0x44854e[_0x4a69('0x2d')]:undefined,'callbackat':_0x44854e['callbackUniqueid']?moment()['format'](_0x4a69('0x26')):undefined,'CampaignId':_0x55430d['id']})[_0x4a69('0x33')](_0x8eca82());}}}});})[_0x4a69('0x2e')](function(){return _0x711081['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x711081[_0x4a69('0x3a')],'as':_0x4a69('0x3f'),'where':{'id':_0x44854e['ListId']}}]})['then'](function(_0x130a49){if(_0x130a49){var _0x229c12=[];for(var _0x2b0d36=0x0,_0x22ae5f;_0x2b0d36<_0x130a49[_0x4a69('0x40')];_0x2b0d36+=0x1){_0x22ae5f=_0x130a49[_0x2b0d36][_0x4a69('0x18')]({'plain':!![]});_0x711081[_0x4a69('0x41')][_0x4a69('0x32')]({'phone':_0x44854e[_0x4a69('0xe')],'ContactId':_0x44854e['id'],'ListId':_0x44854e[_0x4a69('0x2b')],'CampaignId':_0x22ae5f['id']})[_0x4a69('0x33')](function(_0xe1f44f){logger['error'](_0x4a69('0x42'),_0x4a69('0x1b'),_0xe1f44f[_0x4a69('0x43')]);});}}});})['then'](function(){_0x3762ac();})['catch'](function(_0x12eadc){logger[_0x4a69('0x19')]('cmContact,\x20%s,\x20%s',_0x4a69('0x1b'),_0x12eadc[_0x4a69('0x43')]);_0x3762ac(_0x12eadc);});}else{_0x3762ac(new Error(_0x4a69('0x44')));}},'afterDestroy':function(_0x57ef9b,_0x50d317,_0x183bf9){var _0x363ac3=_0x2e8389[_0x4a69('0x17')];var _0x33a122=_0x57ef9b[_0x4a69('0x18')]({'plain':!![]});return _0x363ac3['CmHopper'][_0x4a69('0x39')]({'raw':!![],'where':{'ListId':_0x33a122[_0x4a69('0x2b')],'ContactId':_0x33a122['id']}})[_0x4a69('0x2e')](function(_0x33dff4){if(!_['isEmpty'](_0x33dff4)){var _0x41e72d=[];for(var _0x4ecdfa=0x0;_0x4ecdfa<_0x33dff4[_0x4a69('0x40')];_0x4ecdfa+=0x1){var _0x994ee6=_0x363ac3[_0x4a69('0x28')][_0x4a69('0x45')]({'where':{'ListId':_0x33dff4[_0x4ecdfa][_0x4a69('0x2b')],'ContactId':_0x33dff4[_0x4ecdfa][_0x4a69('0x46')],'VoiceQueueId':_0x33dff4[_0x4ecdfa][_0x4a69('0x47')],'CampaignId':_0x33dff4[_0x4ecdfa][_0x4a69('0x48')]}});_0x41e72d['push'](_0x994ee6);}return BPromise['all'](_0x41e72d);}})[_0x4a69('0x2e')](function(_0x1efa97){logger['info'](_0x4a69('0x49'),util[_0x4a69('0x34')](_0x1efa97,{'showHidden':![],'depth':null}));_0x183bf9();})[_0x4a69('0x33')](function(_0x1913e9){logger['error'](_0x4a69('0x4a'),util[_0x4a69('0x34')](_0x1913e9,{'showHidden':![],'depth':null}));_0x183bf9(_0x1913e9);});}}});};
\ No newline at end of file
+var _0x04e8=['create','format','timezones','add','minutes','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','findAll','outbound','CmList','Lists','length','dialCheckDuplicateType','always','BlackLists','CmHopperBlack','cmContact,\x20%s,\x20%s','message','Campaign','onlyIfOpen','List\x20not\x20found','isEmpty','VoiceQueueId','CampaignId','push','all','info','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment/shared','./cmContact.attributes','exports','define','cm_contacts','phone','fti_cm_contacts','lastName','mobile','FULLTEXT','utf8mb4_unicode_ci','models','get','error','cmContact','afterCreate','inspect','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','VoiceQueue','findOne','utcOffset','then','ret','CmHopper','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','ListId','priority','callbackUniqueid','catch','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20'];(function(_0x1d75f7,_0x139d5e){var _0x307f9a=function(_0x400ae1){while(--_0x400ae1){_0x1d75f7['push'](_0x1d75f7['shift']());}};_0x307f9a(++_0x139d5e);}(_0x04e8,0xf8));var _0x804e=function(_0x313f4b,_0x3d3759){_0x313f4b=_0x313f4b-0x0;var _0x57634c=_0x04e8[_0x313f4b];return _0x57634c;};'use strict';var _=require('lodash');var util=require(_0x804e('0x0'));var logger=require(_0x804e('0x1'))(_0x804e('0x2'));var moment=require(_0x804e('0x3'));var BPromise=require('bluebird');var rp=require(_0x804e('0x4'));var fs=require('fs');var path=require(_0x804e('0x5'));var rimraf=require(_0x804e('0x6'));var config=require('../../config/environment');var shared=require(_0x804e('0x7'));var attributes=require(_0x804e('0x8'));module[_0x804e('0x9')]=function(_0x316d90,_0x47e9cf){return _0x316d90[_0x804e('0xa')]('CmContact',attributes,{'tableName':_0x804e('0xb'),'paranoid':!![],'indexes':[{'name':_0x804e('0xc'),'fields':[_0x804e('0xc')]},{'name':_0x804e('0xd'),'fields':['firstName',_0x804e('0xe'),_0x804e('0xc'),_0x804e('0xf'),'fax','email'],'type':_0x804e('0x10')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x804e('0x11'),'hooks':{'afterCreate':function(_0x553314,_0x208806,_0x3eac6d){var _0x248013=_0x316d90[_0x804e('0x12')];var _0x75c909=_0x553314[_0x804e('0x13')]({'plain':!![]});function _0x5199f3(){return function(_0x5f08af){logger[_0x804e('0x14')](_0x804e('0x15'),_0x804e('0x16'),util[_0x804e('0x17')](_0x5f08af,{'showHidden':![],'depth':null}));};}function _0x5053e0(_0x10f665,_0x176b37){var _0x453d50=_0x176b37[_0x804e('0x18')]?_0x176b37[_0x804e('0x18')]:moment()['format'](_0x804e('0x19'));return new BPromise(function(_0x1d3511,_0x43da49){if(_[_0x804e('0x1a')](_0x176b37[_0x804e('0x1b')])){_0x1d3511({'ret':_0x453d50});}else{_0x248013[_0x804e('0x1c')][_0x804e('0x1d')]({'where':{'id':_0x10f665['id']}})['then'](function(_0x252d11){if(!_[_0x804e('0x1a')](_0x252d11)){var _0x22049a=_0x252d11[_0x804e('0x1b')];if(!_['isNil'](_0x22049a)){var _0x2a311d=shared['timezones'];var _0x5ba3fb=_0x2a311d[_0x22049a];var _0x209a97=_0x2a311d[_0x176b37[_0x804e('0x1b')]];if(!_[_0x804e('0x1a')](_0x5ba3fb)&&!_[_0x804e('0x1a')](_0x209a97)){var _0x121d54=_0x5ba3fb['utcOffset']-_0x209a97[_0x804e('0x1e')];_0x453d50=_0x176b37[_0x804e('0x18')]?_0x176b37['scheduledat']:moment();var _0x323d0b=moment(_0x453d50)['add'](_0x121d54,'minutes');_0x1d3511({'ret':_0x323d0b['format']('YYYY-MM-DD\x20HH:mm:ss')});}else _0x1d3511({'ret':_0x453d50});}else _0x1d3511({'ret':_0x453d50});}else{_0x1d3511({'ret':_0x453d50});}});}});return 0xa;}var _0x517373=function(_0x41bb39){return new BPromise(function(_0x29fd13,_0x4e9551){_0x5053e0(_0x41bb39,_0x75c909)[_0x804e('0x1f')](function(_0x131c4e){_0x75c909[_0x804e('0x18')]=_0x131c4e[_0x804e('0x20')];_0x248013[_0x804e('0x21')][_0x804e('0x1d')]({'where':{'phone':_0x75c909[_0x804e('0xc')],'VoiceQueueId':_0x41bb39['id']}})[_0x804e('0x1f')](function(_0xddedc6){if(!_[_0x804e('0x1a')](_0xddedc6)){throw new Error(_0x804e('0x22')+_0x75c909[_0x804e('0xc')]+_0x804e('0x23')+_0x41bb39['id']);}return _0x248013[_0x804e('0x21')]['create']({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'priority':_0x75c909[_0x804e('0x25')]?_0x75c909[_0x804e('0x25')]:0x2,'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909[_0x804e('0x18')]:moment()['format'](_0x804e('0x19')),'callback':_0x75c909['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x75c909[_0x804e('0x26')]?_0x75c909[_0x804e('0x26')]:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()['format'](_0x804e('0x19')):undefined,'VoiceQueueId':_0x41bb39['id']});})[_0x804e('0x27')](function(_0x3ecb43){_0x4e9551(_0x3ecb43);});});});};var _0x3489b6=function(_0x5c938c){return new BPromise(function(_0x11743c,_0x17e117){_0x5053e0(_0x5c938c,_0x75c909)[_0x804e('0x1f')](function(_0x22e94e){_0x75c909[_0x804e('0x18')]=_0x22e94e['ret'];_0x248013[_0x804e('0x21')][_0x804e('0x1d')]({'where':{'phone':_0x75c909[_0x804e('0xc')],'VoiceQueueId':_0x5c938c['id']}})[_0x804e('0x1f')](function(_0x4f36f6){if(!_[_0x804e('0x1a')](_0x4f36f6)){throw new Error(_0x804e('0x22')+_0x75c909[_0x804e('0xc')]+_0x804e('0x28')+_0x5c938c['id']);}return _0x248013[_0x804e('0x29')][_0x804e('0x1d')]({'where':{'calleridnum':_0x75c909[_0x804e('0xc')],'VoiceQueueId':_0x5c938c['id']}});})[_0x804e('0x1f')](function(_0x15d3fc){if(!_[_0x804e('0x1a')](_0x15d3fc)){throw new Error(_0x804e('0x2a')+_0x75c909[_0x804e('0xc')]+_0x804e('0x2b')+_0x5c938c['id']);}return _0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909['ListId'],'priority':_0x75c909['priority']?_0x75c909[_0x804e('0x25')]:0x2,'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909['scheduledat']:moment()[_0x804e('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x75c909[_0x804e('0x26')]?!![]:![],'callbackuniqueid':_0x75c909[_0x804e('0x26')]?_0x75c909[_0x804e('0x26')]:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()[_0x804e('0x2d')](_0x804e('0x19')):undefined,'VoiceQueueId':_0x5c938c['id']});})[_0x804e('0x27')](function(_0x29b28a){_0x17e117(_0x29b28a);});});});};function _0xd7a9fa(){return function(_0x2180ca){logger[_0x804e('0x14')](_0x804e('0x15'),_0x804e('0x16'),util[_0x804e('0x17')](_0x2180ca,{'showHidden':![],'depth':null}));};}function _0x312c4e(_0x2242db,_0x4e1283){var _0xa4a09b=_0x4e1283[_0x804e('0x18')]?_0x4e1283['scheduledat']:moment()[_0x804e('0x2d')](_0x804e('0x19'));return new BPromise(function(_0x226572,_0x23a620){if(_[_0x804e('0x1a')](_0x4e1283[_0x804e('0x1b')])){_0x226572({'ret':_0xa4a09b});}else{_0x248013['Campaign'][_0x804e('0x1d')]({'where':{'id':_0x2242db['id']}})[_0x804e('0x1f')](function(_0x4322e3){if(!_['isNil'](_0x4322e3)){var _0xcc9e41=_0x4322e3[_0x804e('0x1b')];if(!_[_0x804e('0x1a')](_0xcc9e41)){var _0x20815f=shared[_0x804e('0x2e')];var _0x2ce720=_0x20815f[_0xcc9e41];var _0x57ce82=_0x20815f[_0x4e1283[_0x804e('0x1b')]];if(!_['isNil'](_0x2ce720)&&!_['isNil'](_0x57ce82)){var _0x3cd2e3=_0x2ce720[_0x804e('0x1e')]-_0x57ce82[_0x804e('0x1e')];_0xa4a09b=_0x4e1283[_0x804e('0x18')]?_0x4e1283[_0x804e('0x18')]:moment();var _0xb61fc9=moment(_0xa4a09b)[_0x804e('0x2f')](_0x3cd2e3,_0x804e('0x30'));_0x226572({'ret':_0xb61fc9[_0x804e('0x2d')](_0x804e('0x19'))});}else _0x226572({'ret':_0xa4a09b});}else _0x226572({'ret':_0xa4a09b});}else{_0x226572({'ret':_0xa4a09b});}});}});return 0xa;}var _0x2f1075=function(_0x49b0a7){return new BPromise(function(_0x54e53c,_0x21f63c){_0x312c4e(_0x49b0a7,_0x75c909)['then'](function(_0x45d123){_0x75c909['scheduledat']=_0x45d123[_0x804e('0x20')];_0x248013[_0x804e('0x21')]['findOne']({'where':{'phone':_0x75c909[_0x804e('0xc')],'CampaignId':_0x49b0a7['id']}})['then'](function(_0x162418){if(!_['isNil'](_0x162418)){throw new Error(_0x804e('0x22')+_0x75c909[_0x804e('0xc')]+_0x804e('0x31')+_0x49b0a7['id']);}return _0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909['ListId'],'priority':_0x75c909['priority']?_0x75c909[_0x804e('0x25')]:0x2,'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909[_0x804e('0x18')]:moment()[_0x804e('0x2d')](_0x804e('0x19')),'callback':_0x75c909[_0x804e('0x26')]?!![]:![],'callbackuniqueid':_0x75c909[_0x804e('0x26')]?_0x75c909['callbackUniqueid']:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()[_0x804e('0x2d')](_0x804e('0x19')):undefined,'CampaignId':_0x49b0a7['id']});})['catch'](function(_0x45fae2){_0x21f63c(_0x45fae2);});});});};var _0x28f328=function(_0x538716){return new BPromise(function(_0x52ba3f,_0x500658){_0x312c4e(_0x538716,_0x75c909)[_0x804e('0x1f')](function(_0x5e72f4){_0x75c909[_0x804e('0x18')]=_0x5e72f4[_0x804e('0x20')];_0x248013[_0x804e('0x21')]['findOne']({'where':{'phone':_0x75c909[_0x804e('0xc')],'CampaignId':_0x538716['id']}})[_0x804e('0x1f')](function(_0x5ba64c){if(!_[_0x804e('0x1a')](_0x5ba64c)){throw new Error('cmContact,\x20afterCreate\x20'+_0x75c909[_0x804e('0xc')]+_0x804e('0x32')+_0x538716['id']);}return _0x248013[_0x804e('0x29')][_0x804e('0x1d')]({'where':{'calleridnum':_0x75c909[_0x804e('0xc')],'CampaignId':_0x538716['id']}});})[_0x804e('0x1f')](function(_0x2eeaf9){if(!_[_0x804e('0x1a')](_0x2eeaf9)){throw new Error('cmContact,\x20afterCreate,\x20'+_0x75c909[_0x804e('0xc')]+_0x804e('0x33')+_0x538716['id']);}return _0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'priority':_0x75c909[_0x804e('0x25')]?_0x75c909[_0x804e('0x25')]:0x2,'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909[_0x804e('0x18')]:moment()[_0x804e('0x2d')](_0x804e('0x19')),'callback':_0x75c909[_0x804e('0x26')]?!![]:![],'callbackuniqueid':_0x75c909['callbackUniqueid']?_0x75c909['callbackUniqueid']:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()[_0x804e('0x2d')](_0x804e('0x19')):undefined,'CampaignId':_0x538716['id']});})[_0x804e('0x27')](function(_0x2f8110){_0x500658(_0x2f8110);});});});};if(_0x75c909['ListId']){_0x248013[_0x804e('0x1c')][_0x804e('0x34')]({'where':{'type':_0x804e('0x35')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x248013[_0x804e('0x36')],'as':_0x804e('0x37'),'where':{'id':_0x75c909[_0x804e('0x24')]}}]})[_0x804e('0x1f')](function(_0x57523e){if(_0x57523e){var _0x3d0b9f=[];for(var _0x370153=0x0,_0x3a4e8a;_0x370153<_0x57523e[_0x804e('0x38')];_0x370153+=0x1){_0x3a4e8a=_0x57523e[_0x370153]['get']({'plain':!![]});switch(_0x3a4e8a[_0x804e('0x39')]){case _0x804e('0x3a'):_0x3489b6(_0x3a4e8a)[_0x804e('0x27')](_0x5199f3());break;case'onlyIfOpen':_0x517373(_0x3a4e8a)['catch'](_0x5199f3());break;default:_0x312c4e(_0x3a4e8a,_0x75c909)[_0x804e('0x1f')](function(_0xfdf87){_0x75c909[_0x804e('0x18')]=_0xfdf87['ret'];_0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'scheduledat':_0x75c909[_0x804e('0x18')]?_0x75c909[_0x804e('0x18')]:moment()[_0x804e('0x2d')](_0x804e('0x19')),'priority':_0x75c909[_0x804e('0x25')]?_0x75c909[_0x804e('0x25')]:0x2,'callback':_0x75c909[_0x804e('0x26')]?!![]:![],'callbackuniqueid':_0x75c909[_0x804e('0x26')]?_0x75c909[_0x804e('0x26')]:undefined,'callbackat':_0x75c909['callbackUniqueid']?moment()[_0x804e('0x2d')](_0x804e('0x19')):undefined,'VoiceQueueId':_0x3a4e8a['id']})['catch'](_0x5199f3());});}}}})['then'](function(){return _0x248013[_0x804e('0x1c')][_0x804e('0x34')]({'where':{'type':_0x804e('0x35')},'attributes':['id'],'include':[{'model':_0x248013[_0x804e('0x36')],'as':_0x804e('0x3b'),'where':{'id':_0x75c909[_0x804e('0x24')]}}]})[_0x804e('0x1f')](function(_0x34ad21){if(_0x34ad21){var _0x3a188b=[];for(var _0x244abb=0x0,_0x15cf6e;_0x244abb<_0x34ad21[_0x804e('0x38')];_0x244abb+=0x1){_0x15cf6e=_0x34ad21[_0x244abb]['get']({'plain':!![]});_0x248013[_0x804e('0x3c')]['create']({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'VoiceQueueId':_0x15cf6e['id']})[_0x804e('0x27')](function(_0x4729b0){logger[_0x804e('0x14')](_0x804e('0x3d'),_0x804e('0x16'),_0x4729b0[_0x804e('0x3e')]);});}}});})[_0x804e('0x1f')](function(){return _0x248013[_0x804e('0x3f')][_0x804e('0x34')]({'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x248013[_0x804e('0x36')],'as':_0x804e('0x37'),'where':{'id':_0x75c909['ListId']}}]})[_0x804e('0x1f')](function(_0x239f91){if(_0x239f91){var _0x71a3b0=[];for(var _0x47534b=0x0,_0xfba914;_0x47534b<_0x239f91[_0x804e('0x38')];_0x47534b+=0x1){_0xfba914=_0x239f91[_0x47534b][_0x804e('0x13')]({'plain':!![]});switch(_0xfba914[_0x804e('0x39')]){case'always':_0x28f328(_0xfba914)[_0x804e('0x27')](_0xd7a9fa());break;case _0x804e('0x40'):_0x2f1075(_0xfba914)['catch'](_0xd7a9fa());break;default:_0x248013[_0x804e('0x21')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'scheduledat':_0x75c909['scheduledat']?_0x75c909['scheduledat']:moment()['format'](_0x804e('0x19')),'priority':_0x75c909['priority']?_0x75c909['priority']:0x2,'callback':_0x75c909['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x75c909['callbackUniqueid']?_0x75c909[_0x804e('0x26')]:undefined,'callbackat':_0x75c909[_0x804e('0x26')]?moment()['format'](_0x804e('0x19')):undefined,'CampaignId':_0xfba914['id']})[_0x804e('0x27')](_0xd7a9fa());}}}});})[_0x804e('0x1f')](function(){return _0x248013[_0x804e('0x3f')][_0x804e('0x34')]({'attributes':['id'],'include':[{'model':_0x248013[_0x804e('0x36')],'as':_0x804e('0x3b'),'where':{'id':_0x75c909['ListId']}}]})['then'](function(_0x1d602d){if(_0x1d602d){var _0x345e47=[];for(var _0x4bd518=0x0,_0x548b33;_0x4bd518<_0x1d602d[_0x804e('0x38')];_0x4bd518+=0x1){_0x548b33=_0x1d602d[_0x4bd518][_0x804e('0x13')]({'plain':!![]});_0x248013[_0x804e('0x3c')][_0x804e('0x2c')]({'phone':_0x75c909[_0x804e('0xc')],'ContactId':_0x75c909['id'],'ListId':_0x75c909[_0x804e('0x24')],'CampaignId':_0x548b33['id']})[_0x804e('0x27')](function(_0x39efe9){logger[_0x804e('0x14')](_0x804e('0x3d'),_0x804e('0x16'),_0x39efe9['message']);});}}});})['then'](function(){_0x3eac6d();})[_0x804e('0x27')](function(_0x23c52e){logger['error'](_0x804e('0x3d'),_0x804e('0x16'),_0x23c52e[_0x804e('0x3e')]);_0x3eac6d(_0x23c52e);});}else{_0x3eac6d(new Error(_0x804e('0x41')));}},'afterDestroy':function(_0x375980,_0x4ca7f0,_0x5936ba){var _0x34cf6c=_0x316d90['models'];var _0x1c9d26=_0x375980['get']({'plain':!![]});return _0x34cf6c['CmHopper'][_0x804e('0x34')]({'raw':!![],'where':{'ListId':_0x1c9d26[_0x804e('0x24')],'ContactId':_0x1c9d26['id']}})[_0x804e('0x1f')](function(_0x4e774f){if(!_[_0x804e('0x42')](_0x4e774f)){var _0x5cafd3=[];for(var _0x553002=0x0;_0x553002<_0x4e774f['length'];_0x553002+=0x1){var _0x67de01=_0x34cf6c[_0x804e('0x21')]['destroy']({'where':{'ListId':_0x4e774f[_0x553002][_0x804e('0x24')],'ContactId':_0x4e774f[_0x553002]['ContactId'],'VoiceQueueId':_0x4e774f[_0x553002][_0x804e('0x43')],'CampaignId':_0x4e774f[_0x553002][_0x804e('0x44')]}});_0x5cafd3[_0x804e('0x45')](_0x67de01);}return BPromise[_0x804e('0x46')](_0x5cafd3);}})[_0x804e('0x1f')](function(_0x4f75d3){logger[_0x804e('0x47')]('[CmContact][afterDestroy][Succesfull]',util['inspect'](_0x4f75d3,{'showHidden':![],'depth':null}));_0x5936ba();})[_0x804e('0x27')](function(_0x16851e){logger[_0x804e('0x14')](_0x804e('0x48'),util['inspect'](_0x16851e,{'showHidden':![],'depth':null}));_0x5936ba(_0x16851e);});}}});};
\ No newline at end of file
index fcdf9f7..b6acade 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a<Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x0a9e('0x2e')];_0x24936a++){var _0x4f41ae=Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x24936a];if(_0x4f41ae[_0x0a9e('0x2f')]('cf_')){_0x5640eb=squel[_0x0a9e('0x30')]()[_0x0a9e('0x31')](_0x0a9e('0x32'))['set'](_0x4f41ae,_0x2cc7a0['body'][_0x4f41ae])[_0x0a9e('0x1d')](_0x0a9e('0x33'),_0x1e8694['id'])['toString']();break;}}if(!_0x5640eb)return _0x1e8694;return db[_0x0a9e('0x34')][_0x0a9e('0x35')](_0x5640eb)[_0x0a9e('0x23')](function(){return _0x1e8694;});})[_0x0a9e('0x23')](function(_0x4b38d9){logger['info'](_0x0a9e('0x36'),_0x2cc7a0);logger[_0x0a9e('0x12')]('CreateCmContact',_0x2cc7a0,JSON[_0x0a9e('0x24')](_0x4b38d9));_0x2b7e7f(_0x4b38d9);})[_0x0a9e('0x18')](function(_0x1459bb){logger['error'](_0x0a9e('0x36'),_0x1459bb[_0x0a9e('0x16')],_0x2cc7a0);_0x3f3d41(_0x14b13f[_0x0a9e('0x14')](0x1f4,_0x1459bb[_0x0a9e('0x16')]));});});};
\ No newline at end of file
+var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a<Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x0a9e('0x2e')];_0x24936a++){var _0x4f41ae=Object[_0x0a9e('0x2d')](_0x2cc7a0[_0x0a9e('0x2c')])[_0x24936a];if(_0x4f41ae[_0x0a9e('0x2f')]('cf_')){_0x5640eb=squel[_0x0a9e('0x30')]()[_0x0a9e('0x31')](_0x0a9e('0x32'))['set'](_0x4f41ae,_0x2cc7a0['body'][_0x4f41ae])[_0x0a9e('0x1d')](_0x0a9e('0x33'),_0x1e8694['id'])['toString']();break;}}if(!_0x5640eb)return _0x1e8694;return db[_0x0a9e('0x34')][_0x0a9e('0x35')](_0x5640eb)[_0x0a9e('0x23')](function(){return _0x1e8694;});})[_0x0a9e('0x23')](function(_0x4b38d9){logger['info'](_0x0a9e('0x36'),_0x2cc7a0);logger[_0x0a9e('0x12')]('CreateCmContact',_0x2cc7a0,JSON[_0x0a9e('0x24')](_0x4b38d9));_0x2b7e7f(_0x4b38d9);})[_0x0a9e('0x18')](function(_0x1459bb){logger['error'](_0x0a9e('0x36'),_0x1459bb[_0x0a9e('0x16')],_0x2cc7a0);_0x3f3d41(_0x14b13f[_0x0a9e('0x14')](0x1f4,_0x1459bb[_0x0a9e('0x16')]));});});};
\ No newline at end of file
index f9e6301..5424a59 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','length','cmContact:','./cmContact.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var CmContactEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){CmContactEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);CmContactEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
+var _0xa9e0=['register','length','cmContact:','./cmContact.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var CmContactEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){CmContactEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);CmContactEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
index 38e73ef..eb81274 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x9fd786,_0x1ee687){var _0x48152e=function(_0x19b478){while(--_0x19b478){_0x9fd786['push'](_0x9fd786['shift']());}};_0x48152e(++_0x1ee687);}(_0xa9e0,0x123));var _0x0a9e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa9e0[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router;
\ No newline at end of file
+var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x427c41,_0x3b4582){var _0xa8894d=function(_0x1feb75){while(--_0x1feb75){_0x427c41['push'](_0x427c41['shift']());}};_0xa8894d(++_0x3b4582);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router;
\ No newline at end of file
index acb7841..c285138 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e16=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x139d86,_0x300080){var _0x56c2da=function(_0x261fda){while(--_0x261fda){_0x139d86['push'](_0x139d86['shift']());}};_0x56c2da(++_0x300080);}(_0x7e16,0x16f));var _0x67e1=function(_0x14ba12,_0x312462){_0x14ba12=_0x14ba12-0x0;var _0xed365e=_0x7e16[_0x14ba12];return _0xed365e;};'use strict';var Sequelize=require(_0x67e1('0x0'));module[_0x67e1('0x1')]={'CmContactId':{'type':Sequelize[_0x67e1('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x67e1('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x67e1('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x67e1('0x3')],'defaultValue':null}};
\ No newline at end of file
+var _0xcb91=['STRING','INTEGER'];(function(_0x58b6a8,_0x307021){var _0xc566dc=function(_0x59bd76){while(--_0x59bd76){_0x58b6a8['push'](_0x58b6a8['shift']());}};_0xc566dc(++_0x307021);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xcb91[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0x1cb9('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0x1cb9('0x0')],'defaultValue':null},'description':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':null}};
\ No newline at end of file
index 3c2c473..ed927a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d6c=['mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','then','get','CmContactHasItems','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','VIRTUAL','CmContactHasItem','include','findAll','catch','show','keys','length','includeAll','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x4d6c,0x19a));var _0xc4d6=function(_0x1c601f,_0x42fcb2){_0x1c601f=_0x1c601f-0x0;var _0x4e4ea0=_0x4d6c[_0x1c601f];return _0x4e4ea0;};'use strict';var emlformat=require(_0xc4d6('0x0'));var rimraf=require(_0xc4d6('0x1'));var zipdir=require(_0xc4d6('0x2'));var jsonpatch=require(_0xc4d6('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc4d6('0x4'));var Mustache=require(_0xc4d6('0x5'));var util=require('util');var path=require(_0xc4d6('0x6'));var sox=require(_0xc4d6('0x7'));var csv=require(_0xc4d6('0x8'));var ejs=require(_0xc4d6('0x9'));var fs=require('fs');var fs_extra=require(_0xc4d6('0xa'));var _=require(_0xc4d6('0xb'));var squel=require(_0xc4d6('0xc'));var crypto=require('crypto');var jsforce=require(_0xc4d6('0xd'));var deskjs=require(_0xc4d6('0xe'));var toCsv=require(_0xc4d6('0x8'));var querystring=require(_0xc4d6('0xf'));var Papa=require('papaparse');var Redis=require(_0xc4d6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc4d6('0x11'));var as=require(_0xc4d6('0x12'));var hardwareService=require(_0xc4d6('0x13'));var logger=require(_0xc4d6('0x14'))(_0xc4d6('0x15'));var utils=require(_0xc4d6('0x16'));var config=require(_0xc4d6('0x17'));var licenseUtil=require(_0xc4d6('0x18'));var db=require(_0xc4d6('0x19'))['db'];function respondWithStatusCode(_0x3ae3ed,_0x429f9f){_0x429f9f=_0x429f9f||0xcc;return function(_0xaba2cb){if(_0xaba2cb){return _0x3ae3ed[_0xc4d6('0x1a')](_0x429f9f);}return _0x3ae3ed[_0xc4d6('0x1b')](_0x429f9f)[_0xc4d6('0x1c')]();};}function respondWithResult(_0x3ac706,_0x1883f8){_0x1883f8=_0x1883f8||0xc8;return function(_0x44e7d9){if(_0x44e7d9){return _0x3ac706[_0xc4d6('0x1b')](_0x1883f8)[_0xc4d6('0x1d')](_0x44e7d9);}};}function respondWithFilteredResult(_0x2bb6e3,_0xac23f1){return function(_0x59d0d8){if(_0x59d0d8){var _0x29404b=typeof _0xac23f1[_0xc4d6('0x1e')]==='undefined'&&typeof _0xac23f1[_0xc4d6('0x1f')]===_0xc4d6('0x20');var _0x54c984=_0x59d0d8[_0xc4d6('0x21')];var _0x444556=_0x29404b?0x0:_0xac23f1[_0xc4d6('0x1e')];var _0x155ab7=_0x29404b?_0x59d0d8[_0xc4d6('0x21')]:_0xac23f1[_0xc4d6('0x1e')]+_0xac23f1[_0xc4d6('0x1f')];var _0x589d07;if(_0x155ab7>=_0x54c984){_0x155ab7=_0x54c984;_0x589d07=0xc8;}else{_0x589d07=0xce;}_0x2bb6e3[_0xc4d6('0x1b')](_0x589d07);return _0x2bb6e3['set'](_0xc4d6('0x22'),_0x444556+'-'+_0x155ab7+'/'+_0x54c984)[_0xc4d6('0x1d')](_0x59d0d8);}return null;};}function patchUpdates(_0x2380c5){return function(_0x4e40b7){try{jsonpatch[_0xc4d6('0x23')](_0x4e40b7,_0x2380c5,!![]);}catch(_0xebcb1e){return BPromise['reject'](_0xebcb1e);}return _0x4e40b7[_0xc4d6('0x24')]();};}function saveUpdates(_0x43f39f,_0x3a4581){return function(_0xa55612){if(_0xa55612){return _0xa55612[_0xc4d6('0x25')](_0x43f39f)['then'](function(_0x472e7d){return _0x472e7d;});}return null;};}function removeEntity(_0x47b117,_0x4d8d24){return function(_0x647fec){if(_0x647fec){return _0x647fec[_0xc4d6('0x26')]()[_0xc4d6('0x27')](function(){var _0x18370d=_0x647fec[_0xc4d6('0x28')]({'plain':!![]});var _0xc0cc39=_0xc4d6('0x29');return db[_0xc4d6('0x2a')]['destroy']({'where':{'type':_0xc0cc39,'resourceId':_0x18370d['id']}})[_0xc4d6('0x27')](function(){return _0x647fec;});})[_0xc4d6('0x27')](function(){_0x47b117[_0xc4d6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f52fa,_0x3f1407){return function(_0x57c200){if(!_0x57c200){_0x4f52fa[_0xc4d6('0x1a')](0x194);}return _0x57c200;};}function handleError(_0x3f3bf0,_0x433306){_0x433306=_0x433306||0x1f4;return function(_0x39af36){logger['error'](_0x39af36[_0xc4d6('0x2b')]);if(_0x39af36[_0xc4d6('0x2c')]){delete _0x39af36[_0xc4d6('0x2c')];}_0x3f3bf0[_0xc4d6('0x1b')](_0x433306)[_0xc4d6('0x2d')](_0x39af36);};}exports[_0xc4d6('0x2e')]=function(_0x3f5672,_0x4a80f5){var _0x4a8426={},_0x2a24f9={},_0x170b99={'count':0x0,'rows':[]};var _0x513813=_[_0xc4d6('0x2f')](db['CmContactHasItem'][_0xc4d6('0x30')],function(_0x289bc4){return{'name':_0x289bc4[_0xc4d6('0x31')],'type':_0x289bc4[_0xc4d6('0x32')]['key']};});_0x2a24f9[_0xc4d6('0x33')]=_[_0xc4d6('0x2f')](_0x513813,_0xc4d6('0x2c'));_0x2a24f9[_0xc4d6('0x34')]=_['keys'](_0x3f5672['query']);_0x2a24f9[_0xc4d6('0x35')]=_[_0xc4d6('0x36')](_0x2a24f9['model'],_0x2a24f9['query']);_0x4a8426[_0xc4d6('0x37')]=_[_0xc4d6('0x36')](_0x2a24f9[_0xc4d6('0x33')],qs[_0xc4d6('0x38')](_0x3f5672[_0xc4d6('0x34')][_0xc4d6('0x38')]));_0x4a8426[_0xc4d6('0x37')]=_0x4a8426[_0xc4d6('0x37')]['length']?_0x4a8426[_0xc4d6('0x37')]:_0x2a24f9['model'];if(!_0x3f5672['query'][_0xc4d6('0x39')]('nolimit')){_0x4a8426['limit']=qs[_0xc4d6('0x1f')](_0x3f5672['query'][_0xc4d6('0x1f')]);_0x4a8426[_0xc4d6('0x1e')]=qs[_0xc4d6('0x1e')](_0x3f5672['query']['offset']);}_0x4a8426['order']=qs[_0xc4d6('0x3a')](_0x3f5672['query'][_0xc4d6('0x3a')]);_0x4a8426['where']=qs[_0xc4d6('0x35')](_[_0xc4d6('0x3b')](_0x3f5672[_0xc4d6('0x34')],_0x2a24f9['filters']),_0x513813);if(_0x3f5672[_0xc4d6('0x34')][_0xc4d6('0x3c')]){_0x4a8426[_0xc4d6('0x3d')]=_[_0xc4d6('0x3e')](_0x4a8426[_0xc4d6('0x3d')],{'$or':_[_0xc4d6('0x2f')](_0x513813,function(_0x52ad82){if(_0x52ad82[_0xc4d6('0x32')]!==_0xc4d6('0x3f')){var _0x90ef24={};_0x90ef24[_0x52ad82[_0xc4d6('0x2c')]]={'$like':'%'+_0x3f5672[_0xc4d6('0x34')][_0xc4d6('0x3c')]+'%'};return _0x90ef24;}})});}_0x4a8426=_[_0xc4d6('0x3e')]({},_0x4a8426,_0x3f5672['options']);var _0x19c2f7={'where':_0x4a8426[_0xc4d6('0x3d')]};return db[_0xc4d6('0x40')][_0xc4d6('0x21')](_0x19c2f7)['then'](function(_0x487379){_0x170b99[_0xc4d6('0x21')]=_0x487379;if(_0x3f5672[_0xc4d6('0x34')]['includeAll']){_0x4a8426[_0xc4d6('0x41')]=[{'all':!![]}];}return db[_0xc4d6('0x40')][_0xc4d6('0x42')](_0x4a8426);})[_0xc4d6('0x27')](function(_0x2f8829){_0x170b99['rows']=_0x2f8829;return _0x170b99;})[_0xc4d6('0x27')](respondWithFilteredResult(_0x4a80f5,_0x4a8426))[_0xc4d6('0x43')](handleError(_0x4a80f5,null));};exports[_0xc4d6('0x44')]=function(_0x554da8,_0x152c43){var _0x2393ec={'raw':!![],'where':{'id':_0x554da8['params']['id']}},_0x29d86f={};_0x29d86f['model']=_[_0xc4d6('0x45')](db['CmContactHasItem']['rawAttributes']);_0x29d86f[_0xc4d6('0x34')]=_[_0xc4d6('0x45')](_0x554da8[_0xc4d6('0x34')]);_0x29d86f[_0xc4d6('0x35')]=_['intersection'](_0x29d86f[_0xc4d6('0x33')],_0x29d86f[_0xc4d6('0x34')]);_0x2393ec[_0xc4d6('0x37')]=_[_0xc4d6('0x36')](_0x29d86f['model'],qs[_0xc4d6('0x38')](_0x554da8[_0xc4d6('0x34')][_0xc4d6('0x38')]));_0x2393ec[_0xc4d6('0x37')]=_0x2393ec['attributes'][_0xc4d6('0x46')]?_0x2393ec[_0xc4d6('0x37')]:_0x29d86f[_0xc4d6('0x33')];if(_0x554da8['query'][_0xc4d6('0x47')]){_0x2393ec[_0xc4d6('0x41')]=[{'all':!![]}];}_0x2393ec=_[_0xc4d6('0x3e')]({},_0x2393ec,_0x554da8[_0xc4d6('0x48')]);return db[_0xc4d6('0x40')]['find'](_0x2393ec)['then'](handleEntityNotFound(_0x152c43,null))[_0xc4d6('0x27')](respondWithResult(_0x152c43,null))[_0xc4d6('0x43')](handleError(_0x152c43,null));};exports[_0xc4d6('0x49')]=function(_0x2a78b7,_0x4db431){return db[_0xc4d6('0x40')]['create'](_0x2a78b7['body'],{})[_0xc4d6('0x27')](function(_0x2c19cf){var _0x1a6f6b=_0x2a78b7[_0xc4d6('0x4a')][_0xc4d6('0x28')]({'plain':!![]});if(!_0x1a6f6b)throw new Error(_0xc4d6('0x4b'));if(_0x1a6f6b['role']===_0xc4d6('0x4a')){var _0xdefc9c=_0x2c19cf['get']({'plain':!![]});var _0x384029=_0xc4d6('0x29');return db['UserProfileSection'][_0xc4d6('0x4c')]({'where':{'name':_0x384029,'userProfileId':_0x1a6f6b[_0xc4d6('0x4d')]},'raw':!![]})['then'](function(_0x3235f1){if(_0x3235f1&&_0x3235f1[_0xc4d6('0x4e')]===0x0){return db[_0xc4d6('0x2a')][_0xc4d6('0x49')]({'name':_0xdefc9c['name'],'resourceId':_0xdefc9c['id'],'type':_0x3235f1[_0xc4d6('0x2c')],'sectionId':_0x3235f1['id']},{})[_0xc4d6('0x27')](function(){return _0x2c19cf;});}else{return _0x2c19cf;}})[_0xc4d6('0x43')](function(_0x1aa6a3){logger[_0xc4d6('0x4f')](_0xc4d6('0x50'),_0x1aa6a3);throw _0x1aa6a3;});}return _0x2c19cf;})[_0xc4d6('0x27')](respondWithResult(_0x4db431,0xc9))[_0xc4d6('0x43')](handleError(_0x4db431,null));};exports[_0xc4d6('0x25')]=function(_0x20efb3,_0x4738e9){if(_0x20efb3[_0xc4d6('0x51')]['id']){delete _0x20efb3['body']['id'];}return db[_0xc4d6('0x40')][_0xc4d6('0x4c')]({'where':{'id':_0x20efb3['params']['id']}})[_0xc4d6('0x27')](handleEntityNotFound(_0x4738e9,null))[_0xc4d6('0x27')](saveUpdates(_0x20efb3['body'],null))[_0xc4d6('0x27')](respondWithResult(_0x4738e9,null))[_0xc4d6('0x43')](handleError(_0x4738e9,null));};exports[_0xc4d6('0x26')]=function(_0x48b991,_0x54f465){return db['CmContactHasItem'][_0xc4d6('0x4c')]({'where':{'id':_0x48b991[_0xc4d6('0x52')]['id']}})['then'](handleEntityNotFound(_0x54f465,null))['then'](removeEntity(_0x54f465,null))[_0xc4d6('0x43')](handleError(_0x54f465,null));};
\ No newline at end of file
+var _0x315b=['nolimit','order','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','get','CmContactHasItems','UserProfileResource','destroy','error','stack','name','send','map','CmContactHasItem','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x315b,0x151));var _0xb315=function(_0x4e1762,_0x42981a){_0x4e1762=_0x4e1762-0x0;var _0x21f41c=_0x315b[_0x4e1762];return _0x21f41c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb315('0x0'));var zipdir=require(_0xb315('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb315('0x2'));var moment=require('moment');var BPromise=require(_0xb315('0x3'));var Mustache=require(_0xb315('0x4'));var util=require(_0xb315('0x5'));var path=require(_0xb315('0x6'));var sox=require(_0xb315('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb315('0x8'));var squel=require(_0xb315('0x9'));var crypto=require(_0xb315('0xa'));var jsforce=require(_0xb315('0xb'));var deskjs=require(_0xb315('0xc'));var toCsv=require(_0xb315('0xd'));var querystring=require(_0xb315('0xe'));var Papa=require(_0xb315('0xf'));var Redis=require('ioredis');var authService=require(_0xb315('0x10'));var qs=require(_0xb315('0x11'));var as=require(_0xb315('0x12'));var hardwareService=require(_0xb315('0x13'));var logger=require(_0xb315('0x14'))(_0xb315('0x15'));var utils=require(_0xb315('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb315('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x55ec67,_0x2feaa4){_0x2feaa4=_0x2feaa4||0xcc;return function(_0x4fe089){if(_0x4fe089){return _0x55ec67[_0xb315('0x18')](_0x2feaa4);}return _0x55ec67[_0xb315('0x19')](_0x2feaa4)[_0xb315('0x1a')]();};}function respondWithResult(_0x2ccf41,_0x34e436){_0x34e436=_0x34e436||0xc8;return function(_0x7dafef){if(_0x7dafef){return _0x2ccf41['status'](_0x34e436)[_0xb315('0x1b')](_0x7dafef);}};}function respondWithFilteredResult(_0x679ea9,_0x33f3a2){return function(_0x469f0c){if(_0x469f0c){var _0x36c829=typeof _0x33f3a2['offset']===_0xb315('0x1c')&&typeof _0x33f3a2[_0xb315('0x1d')]===_0xb315('0x1c');var _0x3e52de=_0x469f0c[_0xb315('0x1e')];var _0x55c89c=_0x36c829?0x0:_0x33f3a2['offset'];var _0x21bff2=_0x36c829?_0x469f0c[_0xb315('0x1e')]:_0x33f3a2[_0xb315('0x1f')]+_0x33f3a2[_0xb315('0x1d')];var _0xdcb96b;if(_0x21bff2>=_0x3e52de){_0x21bff2=_0x3e52de;_0xdcb96b=0xc8;}else{_0xdcb96b=0xce;}_0x679ea9[_0xb315('0x19')](_0xdcb96b);return _0x679ea9[_0xb315('0x20')]('Content-Range',_0x55c89c+'-'+_0x21bff2+'/'+_0x3e52de)[_0xb315('0x1b')](_0x469f0c);}return null;};}function patchUpdates(_0x3c8b86){return function(_0x4d5d5f){try{jsonpatch[_0xb315('0x21')](_0x4d5d5f,_0x3c8b86,!![]);}catch(_0x24f69f){return BPromise[_0xb315('0x22')](_0x24f69f);}return _0x4d5d5f['save']();};}function saveUpdates(_0xc45815,_0x17fe5c){return function(_0x1e15d4){if(_0x1e15d4){return _0x1e15d4[_0xb315('0x23')](_0xc45815)['then'](function(_0x45d6fa){return _0x45d6fa;});}return null;};}function removeEntity(_0x171750,_0x4fa3b4){return function(_0x220525){if(_0x220525){return _0x220525['destroy']()[_0xb315('0x24')](function(){var _0x41a2f5=_0x220525[_0xb315('0x25')]({'plain':!![]});var _0x5adea0=_0xb315('0x26');return db[_0xb315('0x27')][_0xb315('0x28')]({'where':{'type':_0x5adea0,'resourceId':_0x41a2f5['id']}})[_0xb315('0x24')](function(){return _0x220525;});})[_0xb315('0x24')](function(){_0x171750[_0xb315('0x19')](0xcc)[_0xb315('0x1a')]();});}};}function handleEntityNotFound(_0x2ee6c5,_0x5946d1){return function(_0x1a3ada){if(!_0x1a3ada){_0x2ee6c5[_0xb315('0x18')](0x194);}return _0x1a3ada;};}function handleError(_0x5cd9b2,_0x359c0f){_0x359c0f=_0x359c0f||0x1f4;return function(_0x524dba){logger[_0xb315('0x29')](_0x524dba[_0xb315('0x2a')]);if(_0x524dba[_0xb315('0x2b')]){delete _0x524dba[_0xb315('0x2b')];}_0x5cd9b2['status'](_0x359c0f)[_0xb315('0x2c')](_0x524dba);};}exports['index']=function(_0x553294,_0x2c04c3){var _0x52d289={},_0x138cdc={},_0x1f35ec={'count':0x0,'rows':[]};var _0xe99fe4=_[_0xb315('0x2d')](db[_0xb315('0x2e')]['rawAttributes'],function(_0x19a6e1){return{'name':_0x19a6e1['fieldName'],'type':_0x19a6e1[_0xb315('0x2f')][_0xb315('0x30')]};});_0x138cdc['model']=_[_0xb315('0x2d')](_0xe99fe4,_0xb315('0x2b'));_0x138cdc[_0xb315('0x31')]=_[_0xb315('0x32')](_0x553294['query']);_0x138cdc[_0xb315('0x33')]=_[_0xb315('0x34')](_0x138cdc[_0xb315('0x35')],_0x138cdc[_0xb315('0x31')]);_0x52d289['attributes']=_[_0xb315('0x34')](_0x138cdc[_0xb315('0x35')],qs['fields'](_0x553294[_0xb315('0x31')][_0xb315('0x36')]));_0x52d289[_0xb315('0x37')]=_0x52d289[_0xb315('0x37')][_0xb315('0x38')]?_0x52d289['attributes']:_0x138cdc[_0xb315('0x35')];if(!_0x553294[_0xb315('0x31')][_0xb315('0x39')](_0xb315('0x3a'))){_0x52d289['limit']=qs['limit'](_0x553294['query'][_0xb315('0x1d')]);_0x52d289[_0xb315('0x1f')]=qs[_0xb315('0x1f')](_0x553294['query'][_0xb315('0x1f')]);}_0x52d289[_0xb315('0x3b')]=qs['sort'](_0x553294[_0xb315('0x31')]['sort']);_0x52d289[_0xb315('0x3c')]=qs[_0xb315('0x33')](_[_0xb315('0x3d')](_0x553294['query'],_0x138cdc[_0xb315('0x33')]),_0xe99fe4);if(_0x553294[_0xb315('0x31')][_0xb315('0x3e')]){_0x52d289[_0xb315('0x3c')]=_['merge'](_0x52d289[_0xb315('0x3c')],{'$or':_[_0xb315('0x2d')](_0xe99fe4,function(_0x30b16f){if(_0x30b16f[_0xb315('0x2f')]!=='VIRTUAL'){var _0x2bbe36={};_0x2bbe36[_0x30b16f[_0xb315('0x2b')]]={'$like':'%'+_0x553294[_0xb315('0x31')][_0xb315('0x3e')]+'%'};return _0x2bbe36;}})});}_0x52d289=_[_0xb315('0x3f')]({},_0x52d289,_0x553294[_0xb315('0x40')]);var _0x931f0={'where':_0x52d289['where']};return db['CmContactHasItem'][_0xb315('0x1e')](_0x931f0)[_0xb315('0x24')](function(_0x245a48){_0x1f35ec[_0xb315('0x1e')]=_0x245a48;if(_0x553294[_0xb315('0x31')][_0xb315('0x41')]){_0x52d289['include']=[{'all':!![]}];}return db['CmContactHasItem'][_0xb315('0x42')](_0x52d289);})[_0xb315('0x24')](function(_0x3907f8){_0x1f35ec[_0xb315('0x43')]=_0x3907f8;return _0x1f35ec;})[_0xb315('0x24')](respondWithFilteredResult(_0x2c04c3,_0x52d289))[_0xb315('0x44')](handleError(_0x2c04c3,null));};exports[_0xb315('0x45')]=function(_0x3dbbc2,_0x319495){var _0x58b85f={'raw':!![],'where':{'id':_0x3dbbc2[_0xb315('0x46')]['id']}},_0xc8a6a6={};_0xc8a6a6[_0xb315('0x35')]=_['keys'](db['CmContactHasItem']['rawAttributes']);_0xc8a6a6[_0xb315('0x31')]=_[_0xb315('0x32')](_0x3dbbc2[_0xb315('0x31')]);_0xc8a6a6[_0xb315('0x33')]=_[_0xb315('0x34')](_0xc8a6a6[_0xb315('0x35')],_0xc8a6a6[_0xb315('0x31')]);_0x58b85f[_0xb315('0x37')]=_[_0xb315('0x34')](_0xc8a6a6['model'],qs[_0xb315('0x36')](_0x3dbbc2[_0xb315('0x31')]['fields']));_0x58b85f[_0xb315('0x37')]=_0x58b85f['attributes'][_0xb315('0x38')]?_0x58b85f[_0xb315('0x37')]:_0xc8a6a6[_0xb315('0x35')];if(_0x3dbbc2[_0xb315('0x31')]['includeAll']){_0x58b85f[_0xb315('0x47')]=[{'all':!![]}];}_0x58b85f=_['merge']({},_0x58b85f,_0x3dbbc2['options']);return db['CmContactHasItem']['find'](_0x58b85f)[_0xb315('0x24')](handleEntityNotFound(_0x319495,null))['then'](respondWithResult(_0x319495,null))['catch'](handleError(_0x319495,null));};exports[_0xb315('0x48')]=function(_0x1ecbcf,_0x2641cb){return db[_0xb315('0x2e')][_0xb315('0x48')](_0x1ecbcf[_0xb315('0x49')],{})[_0xb315('0x24')](function(_0x2cd9db){var _0x59022c=_0x1ecbcf['user']['get']({'plain':!![]});if(!_0x59022c)throw new Error(_0xb315('0x4a'));if(_0x59022c['role']===_0xb315('0x4b')){var _0x35a5e1=_0x2cd9db[_0xb315('0x25')]({'plain':!![]});var _0x35e286='CmContactHasItems';return db['UserProfileSection'][_0xb315('0x4c')]({'where':{'name':_0x35e286,'userProfileId':_0x59022c['userProfileId']},'raw':!![]})[_0xb315('0x24')](function(_0x54825f){if(_0x54825f&&_0x54825f[_0xb315('0x4d')]===0x0){return db[_0xb315('0x27')]['create']({'name':_0x35a5e1[_0xb315('0x2b')],'resourceId':_0x35a5e1['id'],'type':_0x54825f[_0xb315('0x2b')],'sectionId':_0x54825f['id']},{})['then'](function(){return _0x2cd9db;});}else{return _0x2cd9db;}})[_0xb315('0x44')](function(_0x3708a3){logger['error'](_0xb315('0x4e'),_0x3708a3);throw _0x3708a3;});}return _0x2cd9db;})[_0xb315('0x24')](respondWithResult(_0x2641cb,0xc9))[_0xb315('0x44')](handleError(_0x2641cb,null));};exports[_0xb315('0x23')]=function(_0x5d0e59,_0x3b4615){if(_0x5d0e59['body']['id']){delete _0x5d0e59[_0xb315('0x49')]['id'];}return db[_0xb315('0x2e')]['find']({'where':{'id':_0x5d0e59[_0xb315('0x46')]['id']}})[_0xb315('0x24')](handleEntityNotFound(_0x3b4615,null))[_0xb315('0x24')](saveUpdates(_0x5d0e59['body'],null))[_0xb315('0x24')](respondWithResult(_0x3b4615,null))[_0xb315('0x44')](handleError(_0x3b4615,null));};exports['destroy']=function(_0x5550fd,_0x3b9875){return db['CmContactHasItem'][_0xb315('0x4c')]({'where':{'id':_0x5550fd['params']['id']}})[_0xb315('0x24')](handleEntityNotFound(_0x3b9875,null))[_0xb315('0x24')](removeEntity(_0x3b9875,null))[_0xb315('0x44')](handleError(_0x3b9875,null));};
\ No newline at end of file
index c26f322..7bb9d81 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7631=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0x7631,0x1c5));var _0x1763=function(_0x165e34,_0x50f8f8){_0x165e34=_0x165e34-0x0;var _0x2103ec=_0x7631[_0x165e34];return _0x2103ec;};'use strict';var _=require(_0x1763('0x0'));var util=require(_0x1763('0x1'));var logger=require(_0x1763('0x2'))(_0x1763('0x3'));var moment=require(_0x1763('0x4'));var BPromise=require(_0x1763('0x5'));var rp=require(_0x1763('0x6'));var fs=require('fs');var path=require(_0x1763('0x7'));var rimraf=require(_0x1763('0x8'));var config=require('../../config/environment');var attributes=require(_0x1763('0x9'));module[_0x1763('0xa')]=function(_0x4324b0,_0x1f8801){return _0x4324b0[_0x1763('0xb')](_0x1763('0xc'),attributes,{'tableName':_0x1763('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x6aa8=['define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmContactHasItem.attributes','exports'];(function(_0x38e5ee,_0x3cd0cb){var _0x85812d=function(_0x3715a7){while(--_0x3715a7){_0x38e5ee['push'](_0x38e5ee['shift']());}};_0x85812d(++_0x3cd0cb);}(_0x6aa8,0x120));var _0x86aa=function(_0x7a1bcc,_0x30120f){_0x7a1bcc=_0x7a1bcc-0x0;var _0xf98e07=_0x6aa8[_0x7a1bcc];return _0xf98e07;};'use strict';var _=require(_0x86aa('0x0'));var util=require(_0x86aa('0x1'));var logger=require(_0x86aa('0x2'))(_0x86aa('0x3'));var moment=require(_0x86aa('0x4'));var BPromise=require(_0x86aa('0x5'));var rp=require(_0x86aa('0x6'));var fs=require('fs');var path=require(_0x86aa('0x7'));var rimraf=require(_0x86aa('0x8'));var config=require('../../config/environment');var attributes=require(_0x86aa('0x9'));module[_0x86aa('0xa')]=function(_0x5aaab7,_0x397919){return _0x5aaab7[_0x86aa('0xb')](_0x86aa('0xc'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8c6cc7c..455fb31 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb71e=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb71e,0x187));var _0xeb71=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xb71e[_0x1b6186];return _0x186121;};'use strict';var _=require(_0xeb71('0x0'));var util=require('util');var moment=require(_0xeb71('0x1'));var BPromise=require('bluebird');var rs=require(_0xeb71('0x2'));var fs=require('fs');var Redis=require(_0xeb71('0x3'));var db=require(_0xeb71('0x4'))['db'];var utils=require(_0xeb71('0x5'));var logger=require(_0xeb71('0x6'))('rpc');var config=require(_0xeb71('0x7'));var jayson=require(_0xeb71('0x8'));var client=jayson[_0xeb71('0x9')][_0xeb71('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x130832,_0x3637f3,_0x111a6f){return new BPromise(function(_0x590ff6,_0x364e8a){return client[_0xeb71('0xb')](_0x130832,_0x111a6f)[_0xeb71('0xc')](function(_0x39e95b){logger['info'](_0xeb71('0xd'),_0x3637f3,_0xeb71('0xe'));logger['debug'](_0xeb71('0xf'),_0x3637f3,_0xeb71('0xe'),JSON[_0xeb71('0x10')](_0x39e95b));if(_0x39e95b['error']){if(_0x39e95b['error']['code']===0x1f4){logger[_0xeb71('0x11')](_0xeb71('0xd'),_0x3637f3,_0x39e95b['error'][_0xeb71('0x12')]);return _0x364e8a(_0x39e95b[_0xeb71('0x11')][_0xeb71('0x12')]);}logger['error'](_0xeb71('0xd'),_0x3637f3,_0x39e95b[_0xeb71('0x11')][_0xeb71('0x12')]);return _0x590ff6(_0x39e95b['error']['message']);}else{logger[_0xeb71('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x3637f3,_0xeb71('0xe'));_0x590ff6(_0x39e95b[_0xeb71('0x14')][_0xeb71('0x12')]);}})[_0xeb71('0x15')](function(_0x326274){logger[_0xeb71('0x11')](_0xeb71('0xd'),_0x3637f3,_0x326274);_0x364e8a(_0x326274);});});}
\ No newline at end of file
+var _0x0a0f=['../../config/logger','../../config/environment','jayson/promise','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x28490c,_0xaaa013){var _0x1972c2=function(_0x2b9b24){while(--_0x2b9b24){_0x28490c['push'](_0x28490c['shift']());}};_0x1972c2(++_0xaaa013);}(_0x0a0f,0x101));var _0xf0a0=function(_0x310ee0,_0x1c5d46){_0x310ee0=_0x310ee0-0x0;var _0x2aae43=_0x0a0f[_0x310ee0];return _0x2aae43;};'use strict';var _=require(_0xf0a0('0x0'));var util=require('util');var moment=require(_0xf0a0('0x1'));var BPromise=require(_0xf0a0('0x2'));var rs=require(_0xf0a0('0x3'));var fs=require('fs');var Redis=require(_0xf0a0('0x4'));var db=require(_0xf0a0('0x5'))['db'];var utils=require(_0xf0a0('0x6'));var logger=require(_0xf0a0('0x7'))('rpc');var config=require(_0xf0a0('0x8'));var jayson=require(_0xf0a0('0x9'));var client=jayson['client'][_0xf0a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b1b42,_0x55ec1a,_0x18755d){return new BPromise(function(_0xd9cbb8,_0x4f3014){return client['request'](_0x4b1b42,_0x18755d)[_0xf0a0('0xb')](function(_0xbe85a7){logger[_0xf0a0('0xc')](_0xf0a0('0xd'),_0x55ec1a,_0xf0a0('0xe'));logger[_0xf0a0('0xf')](_0xf0a0('0x10'),_0x55ec1a,_0xf0a0('0xe'),JSON[_0xf0a0('0x11')](_0xbe85a7));if(_0xbe85a7[_0xf0a0('0x12')]){if(_0xbe85a7['error'][_0xf0a0('0x13')]===0x1f4){logger['error'](_0xf0a0('0xd'),_0x55ec1a,_0xbe85a7['error']['message']);return _0x4f3014(_0xbe85a7[_0xf0a0('0x12')][_0xf0a0('0x14')]);}logger[_0xf0a0('0x12')](_0xf0a0('0xd'),_0x55ec1a,_0xbe85a7[_0xf0a0('0x12')][_0xf0a0('0x14')]);return _0xd9cbb8(_0xbe85a7[_0xf0a0('0x12')][_0xf0a0('0x14')]);}else{logger[_0xf0a0('0xc')](_0xf0a0('0xd'),_0x55ec1a,'request\x20sent');_0xd9cbb8(_0xbe85a7['result'][_0xf0a0('0x14')]);}})[_0xf0a0('0x15')](function(_0x3b9d18){logger[_0xf0a0('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x55ec1a,_0x3b9d18);_0x4f3014(_0x3b9d18);});});}
\ No newline at end of file
index 711dad3..b1096f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4552=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post','create','put','/:id','update','exports','multer','util'];(function(_0x2573f2,_0x521dd5){var _0x54dc3e=function(_0x468f98){while(--_0x468f98){_0x2573f2['push'](_0x2573f2['shift']());}};_0x54dc3e(++_0x521dd5);}(_0x4552,0x1eb));var _0x2455=function(_0x385f76,_0x3d2b74){_0x385f76=_0x385f76-0x0;var _0x12ee64=_0x4552[_0x385f76];return _0x12ee64;};'use strict';var multer=require(_0x2455('0x0'));var util=require(_0x2455('0x1'));var path=require(_0x2455('0x2'));var timeout=require('connect-timeout');var express=require(_0x2455('0x3'));var router=express[_0x2455('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2455('0x5'));var interaction=require(_0x2455('0x6'));var config=require(_0x2455('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x2455('0x8')]('/',auth[_0x2455('0x9')](),controller[_0x2455('0xa')]);router[_0x2455('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2455('0xb')]('/',auth[_0x2455('0x9')](),controller[_0x2455('0xc')]);router[_0x2455('0xd')](_0x2455('0xe'),auth['isAuthenticated'](),controller[_0x2455('0xf')]);router['delete'](_0x2455('0xe'),auth[_0x2455('0x9')](),controller['destroy']);module[_0x2455('0x10')]=router;
\ No newline at end of file
+var _0xc1ae=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x3dacc3,_0x3a475f){var _0x3ed9a5=function(_0x167eac){while(--_0x167eac){_0x3dacc3['push'](_0x3dacc3['shift']());}};_0x3ed9a5(++_0x3a475f);}(_0xc1ae,0xae));var _0xec1a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc1ae[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xec1a('0x0'));var util=require(_0xec1a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xec1a('0x2'));var auth=require(_0xec1a('0x3'));var interaction=require(_0xec1a('0x4'));var config=require(_0xec1a('0x5'));var controller=require('./cmContactHasItem.controller');router[_0xec1a('0x6')]('/',auth[_0xec1a('0x7')](),controller['index']);router['get'](_0xec1a('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xec1a('0x9')]('/',auth[_0xec1a('0x7')](),controller[_0xec1a('0xa')]);router[_0xec1a('0xb')](_0xec1a('0x8'),auth[_0xec1a('0x7')](),controller[_0xec1a('0xc')]);router[_0xec1a('0xd')](_0xec1a('0x8'),auth[_0xec1a('0x7')](),controller[_0xec1a('0xe')]);module[_0xec1a('0xf')]=router;
\ No newline at end of file
index fadbe31..bfd5b9d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85b4=['stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','long','type','select','parse','values'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x85b4,0xf1));var _0x485b=function(_0x3f8282,_0x11b607){_0x3f8282=_0x3f8282-0x0;var _0x50f918=_0x85b4[_0x3f8282];return _0x50f918;};'use strict';var Sequelize=require(_0x485b('0x0'));var _=require(_0x485b('0x1'));module[_0x485b('0x2')]={'name':{'type':Sequelize[_0x485b('0x3')],'get':function(_0x2b87fe){return this[_0x485b('0x4')]('alias');}},'alias':{'type':Sequelize[_0x485b('0x5')],'allowNull':![],'set':function(_0x2a19dd){this[_0x485b('0x6')](_0x485b('0x7'),_0x2a19dd?_0x2a19dd:this[_0x485b('0x4')](_0x485b('0x8')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x485b('0x9')),'get':function(){if(this[_0x485b('0x4')](_0x485b('0xa'))===_0x485b('0xb')){return JSON[_0x485b('0xc')](this['getDataValue'](_0x485b('0xd')));}else{return this['getDataValue'](_0x485b('0xd'));}},'set':function(_0x1593e2){if(Array['isArray'](_0x1593e2)){this[_0x485b('0x6')](_0x485b('0xd'),JSON[_0x485b('0xe')](_0x1593e2));}else{this[_0x485b('0x6')]('values',_0x1593e2);}}},'required':{'type':Sequelize[_0x485b('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x485b('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x485b('0x10')]('voice')}};
\ No newline at end of file
+var _0x81ff=['lodash','exports','VIRTUAL','alias','STRING','getDataValue','name','TEXT','long','type','select','values','stringify','setDataValue','BOOLEAN','ENUM','voice','sequelize'];(function(_0x7af18,_0x4993a1){var _0x45bb08=function(_0x39b2bd){while(--_0x39b2bd){_0x7af18['push'](_0x7af18['shift']());}};_0x45bb08(++_0x4993a1);}(_0x81ff,0xe9));var _0xf81f=function(_0x27f789,_0x4276de){_0x27f789=_0x27f789-0x0;var _0xe8fc8=_0x81ff[_0x27f789];return _0xe8fc8;};'use strict';var Sequelize=require(_0xf81f('0x0'));var _=require(_0xf81f('0x1'));module[_0xf81f('0x2')]={'name':{'type':Sequelize[_0xf81f('0x3')],'get':function(_0x246f99){return this['getDataValue'](_0xf81f('0x4'));}},'alias':{'type':Sequelize[_0xf81f('0x5')],'allowNull':![],'set':function(_0x3dfbf2){this['setDataValue'](_0xf81f('0x4'),_0x3dfbf2?_0x3dfbf2:this[_0xf81f('0x6')](_0xf81f('0x7')));}},'type':{'type':Sequelize[_0xf81f('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf81f('0x8')](_0xf81f('0x9')),'get':function(){if(this[_0xf81f('0x6')](_0xf81f('0xa'))===_0xf81f('0xb')){return JSON['parse'](this[_0xf81f('0x6')](_0xf81f('0xc')));}else{return this[_0xf81f('0x6')](_0xf81f('0xc'));}},'set':function(_0x23eed8){if(Array['isArray'](_0x23eed8)){this['setDataValue'](_0xf81f('0xc'),JSON[_0xf81f('0xd')](_0x23eed8));}else{this[_0xf81f('0xe')]('values',_0x23eed8);}}},'required':{'type':Sequelize[_0xf81f('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf81f('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf81f('0x10')](_0xf81f('0x11'))}};
\ No newline at end of file
index 23f0013..03593ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcee2=['TEXT','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','error','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','model','differenceBy','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','then','findAll','rows','show','params','includeAll','include','find','body','catch','sequelize','Sequelize'];(function(_0x39518d,_0x2c2f52){var _0x4bfb63=function(_0x2f87cb){while(--_0x2f87cb){_0x39518d['push'](_0x39518d['shift']());}};_0x4bfb63(++_0x2c2f52);}(_0xcee2,0x1b7));var _0x2cee=function(_0xc38f8,_0x17f2e8){_0xc38f8=_0xc38f8-0x0;var _0xc90523=_0xcee2[_0xc38f8];return _0xc90523;};'use strict';var emlformat=require(_0x2cee('0x0'));var rimraf=require(_0x2cee('0x1'));var zipdir=require(_0x2cee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2cee('0x3'));var moment=require(_0x2cee('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2cee('0x5'));var path=require('path');var sox=require(_0x2cee('0x6'));var csv=require('to-csv');var ejs=require(_0x2cee('0x7'));var fs=require('fs');var fs_extra=require(_0x2cee('0x8'));var _=require(_0x2cee('0x9'));var squel=require(_0x2cee('0xa'));var crypto=require(_0x2cee('0xb'));var jsforce=require(_0x2cee('0xc'));var deskjs=require(_0x2cee('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2cee('0xe'));var authService=require(_0x2cee('0xf'));var qs=require(_0x2cee('0x10'));var as=require(_0x2cee('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2cee('0x12'))(_0x2cee('0x13'));var utils=require('../../config/utils');var config=require(_0x2cee('0x14'));var licenseUtil=require(_0x2cee('0x15'));var db=require(_0x2cee('0x16'))['db'];function respondWithStatusCode(_0x30664d,_0x4db259){_0x4db259=_0x4db259||0xcc;return function(_0x4823a3){if(_0x4823a3){return _0x30664d[_0x2cee('0x17')](_0x4db259);}return _0x30664d[_0x2cee('0x18')](_0x4db259)[_0x2cee('0x19')]();};}function respondWithResult(_0x47d66d,_0x44a6b5){_0x44a6b5=_0x44a6b5||0xc8;return function(_0x5763c8){if(_0x5763c8){return _0x47d66d[_0x2cee('0x18')](_0x44a6b5)[_0x2cee('0x1a')](_0x5763c8);}};}function respondWithFilteredResult(_0x534eff,_0x3a5d39){return function(_0x23a4d5){if(_0x23a4d5){var _0x1f0edc=typeof _0x3a5d39[_0x2cee('0x1b')]===_0x2cee('0x1c')&&typeof _0x3a5d39['limit']===_0x2cee('0x1c');var _0x2a74ed=_0x23a4d5[_0x2cee('0x1d')];var _0x45cdf1=_0x1f0edc?0x0:_0x3a5d39[_0x2cee('0x1b')];var _0x19d51c=_0x1f0edc?_0x23a4d5[_0x2cee('0x1d')]:_0x3a5d39['offset']+_0x3a5d39[_0x2cee('0x1e')];var _0x1d99ca;if(_0x19d51c>=_0x2a74ed){_0x19d51c=_0x2a74ed;_0x1d99ca=0xc8;}else{_0x1d99ca=0xce;}_0x534eff[_0x2cee('0x18')](_0x1d99ca);return _0x534eff[_0x2cee('0x1f')](_0x2cee('0x20'),_0x45cdf1+'-'+_0x19d51c+'/'+_0x2a74ed)[_0x2cee('0x1a')](_0x23a4d5);}return null;};}function patchUpdates(_0xf3c74f){return function(_0x284a56){try{jsonpatch[_0x2cee('0x21')](_0x284a56,_0xf3c74f,!![]);}catch(_0x44849e){return BPromise[_0x2cee('0x22')](_0x44849e);}return _0x284a56['save']();};}function saveUpdates(_0xc6229d,_0x3aae77){return function(_0x40a132){if(_0x40a132){return _0x40a132[_0x2cee('0x23')](_0xc6229d)['then'](function(_0x157c75){return _0x157c75;});}return null;};}function removeEntity(_0x45b38b,_0x746961){return function(_0x58c141){if(_0x58c141){return _0x58c141['destroy']()['then'](function(){_0x45b38b['status'](0xcc)[_0x2cee('0x19')]();});}};}function handleEntityNotFound(_0x127843,_0x5b1be5){return function(_0x1acdcf){if(!_0x1acdcf){_0x127843[_0x2cee('0x17')](0x194);}return _0x1acdcf;};}function handleError(_0x49e31d,_0x15eed8){_0x15eed8=_0x15eed8||0x1f4;return function(_0x1d9db9){logger[_0x2cee('0x24')](_0x1d9db9[_0x2cee('0x25')]);if(_0x1d9db9[_0x2cee('0x26')]){delete _0x1d9db9[_0x2cee('0x26')];}_0x49e31d['status'](_0x15eed8)[_0x2cee('0x27')](_0x1d9db9);};}exports[_0x2cee('0x28')]=function(_0xba5ef6,_0xbe4034){var _0x1ef30d={},_0x45dc55={},_0xba215d={'count':0x0,'rows':[]};var _0x48ce39=_[_0x2cee('0x29')](db[_0x2cee('0x2a')][_0x2cee('0x2b')],function(_0x4fbfdc){return{'name':_0x4fbfdc[_0x2cee('0x2c')],'type':_0x4fbfdc[_0x2cee('0x2d')]['key']};});_0x45dc55[_0x2cee('0x2e')]=_[_0x2cee('0x2f')](_[_0x2cee('0x29')](_0x48ce39,'name'),['name']);_0x45dc55[_0x2cee('0x30')]=_[_0x2cee('0x31')](_0xba5ef6[_0x2cee('0x30')]);_0x45dc55['filters']=_[_0x2cee('0x32')](_0x45dc55[_0x2cee('0x2e')],_0x45dc55[_0x2cee('0x30')]);_0x1ef30d[_0x2cee('0x33')]=_[_0x2cee('0x32')](_0x45dc55[_0x2cee('0x2e')],qs[_0x2cee('0x34')](_0xba5ef6['query'][_0x2cee('0x34')]));_0x1ef30d[_0x2cee('0x33')]=_0x1ef30d[_0x2cee('0x33')][_0x2cee('0x35')]?_0x1ef30d[_0x2cee('0x33')]:_0x45dc55[_0x2cee('0x2e')];if(!_0xba5ef6[_0x2cee('0x30')][_0x2cee('0x36')](_0x2cee('0x37'))){_0x1ef30d[_0x2cee('0x1e')]=qs[_0x2cee('0x1e')](_0xba5ef6[_0x2cee('0x30')][_0x2cee('0x1e')]);_0x1ef30d[_0x2cee('0x1b')]=qs[_0x2cee('0x1b')](_0xba5ef6[_0x2cee('0x30')][_0x2cee('0x1b')]);}_0x1ef30d[_0x2cee('0x38')]=qs[_0x2cee('0x39')](_0xba5ef6[_0x2cee('0x30')]['sort']);_0x1ef30d[_0x2cee('0x3a')]=qs[_0x2cee('0x3b')](_[_0x2cee('0x3c')](_0xba5ef6[_0x2cee('0x30')],_0x45dc55['filters']),_0x48ce39);if(_0xba5ef6['query'][_0x2cee('0x3d')]){_0x1ef30d[_0x2cee('0x3a')]=_[_0x2cee('0x3e')](_0x1ef30d['where'],{'$or':_[_0x2cee('0x29')](_0x48ce39,function(_0x1c75c1){if(_0x1c75c1[_0x2cee('0x2d')]!==_0x2cee('0x3f')){var _0x13c303={};_0x13c303[_0x1c75c1['name']]={'$like':'%'+_0xba5ef6[_0x2cee('0x30')][_0x2cee('0x3d')]+'%'};return _0x13c303;}})});}_0x1ef30d=_[_0x2cee('0x3e')]({},_0x1ef30d,_0xba5ef6[_0x2cee('0x40')]);var _0x311272={'where':_0x1ef30d[_0x2cee('0x3a')]};return db[_0x2cee('0x2a')]['count'](_0x311272)[_0x2cee('0x41')](function(_0x4fce74){_0xba215d[_0x2cee('0x1d')]=_0x4fce74;if(_0xba5ef6['query']['includeAll']){_0x1ef30d['include']=[{'all':!![]}];}return db[_0x2cee('0x2a')][_0x2cee('0x42')](_0x1ef30d);})['then'](function(_0x5e58e0){_0xba215d[_0x2cee('0x43')]=_0x5e58e0;return _0xba215d;})[_0x2cee('0x41')](respondWithFilteredResult(_0xbe4034,_0x1ef30d))['catch'](handleError(_0xbe4034,null));};exports[_0x2cee('0x44')]=function(_0x2b3133,_0x168b45){var _0x360f1d={'raw':!![],'where':{'id':_0x2b3133[_0x2cee('0x45')]['id']}},_0x53a5c9={};_0x53a5c9['model']=_[_0x2cee('0x31')](db['CmCustomField'][_0x2cee('0x2b')]);_0x53a5c9[_0x2cee('0x30')]=_[_0x2cee('0x31')](_0x2b3133['query']);_0x53a5c9[_0x2cee('0x3b')]=_[_0x2cee('0x32')](_0x53a5c9[_0x2cee('0x2e')],_0x53a5c9['query']);_0x360f1d['attributes']=_[_0x2cee('0x32')](_0x53a5c9['model'],qs[_0x2cee('0x34')](_0x2b3133[_0x2cee('0x30')][_0x2cee('0x34')]));_0x360f1d['attributes']=_0x360f1d[_0x2cee('0x33')][_0x2cee('0x35')]?_0x360f1d[_0x2cee('0x33')]:_0x53a5c9[_0x2cee('0x2e')];if(_0x2b3133['query'][_0x2cee('0x46')]){_0x360f1d[_0x2cee('0x47')]=[{'all':!![]}];}_0x360f1d=_['merge']({},_0x360f1d,_0x2b3133[_0x2cee('0x40')]);return db[_0x2cee('0x2a')][_0x2cee('0x48')](_0x360f1d)[_0x2cee('0x41')](handleEntityNotFound(_0x168b45,null))[_0x2cee('0x41')](respondWithResult(_0x168b45,null))['catch'](handleError(_0x168b45,null));};exports['update']=function(_0xc9bf83,_0x2b0902){if(_0xc9bf83[_0x2cee('0x49')]['id']){delete _0xc9bf83[_0x2cee('0x49')]['id'];}return db[_0x2cee('0x2a')][_0x2cee('0x48')]({'where':{'id':_0xc9bf83[_0x2cee('0x45')]['id']}})[_0x2cee('0x41')](handleEntityNotFound(_0x2b0902,null))['then'](saveUpdates(_0xc9bf83[_0x2cee('0x49')],null))[_0x2cee('0x41')](respondWithResult(_0x2b0902,null))[_0x2cee('0x4a')](handleError(_0x2b0902,null));};exports['destroy']=function(_0x54c937,_0x44638b){return db[_0x2cee('0x2a')]['find']({'where':{'id':_0x54c937[_0x2cee('0x45')]['id']}})[_0x2cee('0x41')](handleEntityNotFound(_0x44638b,null))[_0x2cee('0x41')](removeEntity(_0x44638b,null))['catch'](handleError(_0x44638b,null));};exports['create']=function(_0x5ac9c1,_0xff37f0){var _0xc3fb8f;return db[_0x2cee('0x4b')]['transaction'](function(_0x4f2442){return db[_0x2cee('0x2a')]['create'](_0x5ac9c1[_0x2cee('0x49')],{'transaction':_0x4f2442})[_0x2cee('0x41')](function(_0x289c94){_0xc3fb8f=_0x289c94;var _0x585e76={'type':db[_0x2cee('0x4c')][_0x2cee('0x4d')],'transaction':_0x4f2442};switch(_0x5ac9c1[_0x2cee('0x49')][_0x2cee('0x2d')]){case'text':_0x585e76[_0x2cee('0x2d')]=db['Sequelize']['TEXT'];break;case'number':_0x585e76[_0x2cee('0x2d')]=db['Sequelize'][_0x2cee('0x4e')];break;case _0x2cee('0x4f'):_0x585e76[_0x2cee('0x2d')]=db[_0x2cee('0x4c')][_0x2cee('0x50')];_0x585e76['defaultValue']=![];break;default:}return db[_0x2cee('0x4b')][_0x2cee('0x51')][_0x2cee('0x52')](_0x2cee('0x53'),util[_0x2cee('0x54')](_0x2cee('0x55'),_0xc3fb8f['id']),_0x585e76);})['then'](function(){return _0xc3fb8f;});})['then'](respondWithResult(_0xff37f0,0xc9))[_0x2cee('0x4a')](handleError(_0xff37f0,null));};
\ No newline at end of file
+var _0x3398=['create','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','send','index','CmCustomField','rawAttributes','type','key','model','differenceBy','name','query','keys','filters','fields','attributes','length','nolimit','order','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','body'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x3398,0xb4));var _0x8339=function(_0x525b68,_0x321435){_0x525b68=_0x525b68-0x0;var _0x5430c4=_0x3398[_0x525b68];return _0x5430c4;};'use strict';var emlformat=require(_0x8339('0x0'));var rimraf=require(_0x8339('0x1'));var zipdir=require(_0x8339('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8339('0x3'));var moment=require(_0x8339('0x4'));var BPromise=require(_0x8339('0x5'));var Mustache=require(_0x8339('0x6'));var util=require('util');var path=require(_0x8339('0x7'));var sox=require(_0x8339('0x8'));var csv=require(_0x8339('0x9'));var ejs=require(_0x8339('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8339('0xb'));var squel=require(_0x8339('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8339('0xd'));var toCsv=require(_0x8339('0x9'));var querystring=require('querystring');var Papa=require(_0x8339('0xe'));var Redis=require(_0x8339('0xf'));var authService=require(_0x8339('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8339('0x11'));var hardwareService=require(_0x8339('0x12'));var logger=require('../../config/logger')(_0x8339('0x13'));var utils=require(_0x8339('0x14'));var config=require(_0x8339('0x15'));var licenseUtil=require(_0x8339('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x339d67,_0x178a69){_0x178a69=_0x178a69||0xcc;return function(_0x3b1bfc){if(_0x3b1bfc){return _0x339d67['sendStatus'](_0x178a69);}return _0x339d67['status'](_0x178a69)[_0x8339('0x17')]();};}function respondWithResult(_0x17705c,_0x4548ad){_0x4548ad=_0x4548ad||0xc8;return function(_0x59329b){if(_0x59329b){return _0x17705c[_0x8339('0x18')](_0x4548ad)[_0x8339('0x19')](_0x59329b);}};}function respondWithFilteredResult(_0x438435,_0x142945){return function(_0x863b45){if(_0x863b45){var _0x1257f5=typeof _0x142945[_0x8339('0x1a')]===_0x8339('0x1b')&&typeof _0x142945['limit']===_0x8339('0x1b');var _0x311d64=_0x863b45['count'];var _0x57ae1d=_0x1257f5?0x0:_0x142945[_0x8339('0x1a')];var _0x5e5d52=_0x1257f5?_0x863b45[_0x8339('0x1c')]:_0x142945[_0x8339('0x1a')]+_0x142945[_0x8339('0x1d')];var _0x367602;if(_0x5e5d52>=_0x311d64){_0x5e5d52=_0x311d64;_0x367602=0xc8;}else{_0x367602=0xce;}_0x438435[_0x8339('0x18')](_0x367602);return _0x438435[_0x8339('0x1e')](_0x8339('0x1f'),_0x57ae1d+'-'+_0x5e5d52+'/'+_0x311d64)[_0x8339('0x19')](_0x863b45);}return null;};}function patchUpdates(_0x83e212){return function(_0x379e94){try{jsonpatch[_0x8339('0x20')](_0x379e94,_0x83e212,!![]);}catch(_0x5f0878){return BPromise['reject'](_0x5f0878);}return _0x379e94[_0x8339('0x21')]();};}function saveUpdates(_0x3b8e8a,_0x1d6ef8){return function(_0x2dcfe2){if(_0x2dcfe2){return _0x2dcfe2[_0x8339('0x22')](_0x3b8e8a)[_0x8339('0x23')](function(_0x2124f4){return _0x2124f4;});}return null;};}function removeEntity(_0x376007,_0x3caf18){return function(_0x458f26){if(_0x458f26){return _0x458f26[_0x8339('0x24')]()[_0x8339('0x23')](function(){_0x376007[_0x8339('0x18')](0xcc)[_0x8339('0x17')]();});}};}function handleEntityNotFound(_0x472cc1,_0x5f0f4e){return function(_0x32d3a1){if(!_0x32d3a1){_0x472cc1[_0x8339('0x25')](0x194);}return _0x32d3a1;};}function handleError(_0x598f83,_0xf7874c){_0xf7874c=_0xf7874c||0x1f4;return function(_0x26c3c6){logger[_0x8339('0x26')](_0x26c3c6['stack']);if(_0x26c3c6['name']){delete _0x26c3c6['name'];}_0x598f83['status'](_0xf7874c)[_0x8339('0x27')](_0x26c3c6);};}exports[_0x8339('0x28')]=function(_0x368c80,_0x1faf8c){var _0x19d820={},_0x2ecf43={},_0x269fec={'count':0x0,'rows':[]};var _0x44dfda=_['map'](db[_0x8339('0x29')][_0x8339('0x2a')],function(_0x12c498){return{'name':_0x12c498['fieldName'],'type':_0x12c498[_0x8339('0x2b')][_0x8339('0x2c')]};});_0x2ecf43[_0x8339('0x2d')]=_[_0x8339('0x2e')](_['map'](_0x44dfda,_0x8339('0x2f')),[_0x8339('0x2f')]);_0x2ecf43[_0x8339('0x30')]=_[_0x8339('0x31')](_0x368c80[_0x8339('0x30')]);_0x2ecf43[_0x8339('0x32')]=_['intersection'](_0x2ecf43['model'],_0x2ecf43['query']);_0x19d820['attributes']=_['intersection'](_0x2ecf43[_0x8339('0x2d')],qs[_0x8339('0x33')](_0x368c80[_0x8339('0x30')][_0x8339('0x33')]));_0x19d820[_0x8339('0x34')]=_0x19d820[_0x8339('0x34')][_0x8339('0x35')]?_0x19d820[_0x8339('0x34')]:_0x2ecf43['model'];if(!_0x368c80[_0x8339('0x30')]['hasOwnProperty'](_0x8339('0x36'))){_0x19d820[_0x8339('0x1d')]=qs[_0x8339('0x1d')](_0x368c80['query']['limit']);_0x19d820[_0x8339('0x1a')]=qs[_0x8339('0x1a')](_0x368c80[_0x8339('0x30')][_0x8339('0x1a')]);}_0x19d820[_0x8339('0x37')]=qs['sort'](_0x368c80[_0x8339('0x30')]['sort']);_0x19d820['where']=qs[_0x8339('0x32')](_[_0x8339('0x38')](_0x368c80['query'],_0x2ecf43[_0x8339('0x32')]),_0x44dfda);if(_0x368c80[_0x8339('0x30')][_0x8339('0x39')]){_0x19d820[_0x8339('0x3a')]=_['merge'](_0x19d820[_0x8339('0x3a')],{'$or':_['map'](_0x44dfda,function(_0x503695){if(_0x503695[_0x8339('0x2b')]!==_0x8339('0x3b')){var _0x5ceb4c={};_0x5ceb4c[_0x503695['name']]={'$like':'%'+_0x368c80[_0x8339('0x30')][_0x8339('0x39')]+'%'};return _0x5ceb4c;}})});}_0x19d820=_[_0x8339('0x3c')]({},_0x19d820,_0x368c80[_0x8339('0x3d')]);var _0x44d3e4={'where':_0x19d820[_0x8339('0x3a')]};return db['CmCustomField'][_0x8339('0x1c')](_0x44d3e4)[_0x8339('0x23')](function(_0x1ce9d2){_0x269fec[_0x8339('0x1c')]=_0x1ce9d2;if(_0x368c80['query'][_0x8339('0x3e')]){_0x19d820[_0x8339('0x3f')]=[{'all':!![]}];}return db[_0x8339('0x29')][_0x8339('0x40')](_0x19d820);})[_0x8339('0x23')](function(_0x1eab79){_0x269fec[_0x8339('0x41')]=_0x1eab79;return _0x269fec;})['then'](respondWithFilteredResult(_0x1faf8c,_0x19d820))[_0x8339('0x42')](handleError(_0x1faf8c,null));};exports[_0x8339('0x43')]=function(_0x310f7b,_0x442618){var _0x2c7854={'raw':!![],'where':{'id':_0x310f7b[_0x8339('0x44')]['id']}},_0x1ae4dd={};_0x1ae4dd['model']=_['keys'](db['CmCustomField']['rawAttributes']);_0x1ae4dd[_0x8339('0x30')]=_[_0x8339('0x31')](_0x310f7b['query']);_0x1ae4dd[_0x8339('0x32')]=_[_0x8339('0x45')](_0x1ae4dd[_0x8339('0x2d')],_0x1ae4dd['query']);_0x2c7854[_0x8339('0x34')]=_[_0x8339('0x45')](_0x1ae4dd['model'],qs[_0x8339('0x33')](_0x310f7b[_0x8339('0x30')][_0x8339('0x33')]));_0x2c7854[_0x8339('0x34')]=_0x2c7854['attributes'][_0x8339('0x35')]?_0x2c7854[_0x8339('0x34')]:_0x1ae4dd[_0x8339('0x2d')];if(_0x310f7b[_0x8339('0x30')][_0x8339('0x3e')]){_0x2c7854[_0x8339('0x3f')]=[{'all':!![]}];}_0x2c7854=_[_0x8339('0x3c')]({},_0x2c7854,_0x310f7b[_0x8339('0x3d')]);return db[_0x8339('0x29')][_0x8339('0x46')](_0x2c7854)[_0x8339('0x23')](handleEntityNotFound(_0x442618,null))[_0x8339('0x23')](respondWithResult(_0x442618,null))[_0x8339('0x42')](handleError(_0x442618,null));};exports[_0x8339('0x22')]=function(_0x195368,_0x457557){if(_0x195368[_0x8339('0x47')]['id']){delete _0x195368[_0x8339('0x47')]['id'];}return db[_0x8339('0x29')][_0x8339('0x46')]({'where':{'id':_0x195368['params']['id']}})['then'](handleEntityNotFound(_0x457557,null))['then'](saveUpdates(_0x195368['body'],null))[_0x8339('0x23')](respondWithResult(_0x457557,null))[_0x8339('0x42')](handleError(_0x457557,null));};exports[_0x8339('0x24')]=function(_0x16a434,_0x52ad1e){return db[_0x8339('0x29')][_0x8339('0x46')]({'where':{'id':_0x16a434['params']['id']}})[_0x8339('0x23')](handleEntityNotFound(_0x52ad1e,null))[_0x8339('0x23')](removeEntity(_0x52ad1e,null))['catch'](handleError(_0x52ad1e,null));};exports[_0x8339('0x48')]=function(_0x41500c,_0x3832d5){var _0x11b20f;return db['sequelize'][_0x8339('0x49')](function(_0x55811a){return db[_0x8339('0x29')][_0x8339('0x48')](_0x41500c['body'],{'transaction':_0x55811a})[_0x8339('0x23')](function(_0x4d07c4){_0x11b20f=_0x4d07c4;var _0x68dd75={'type':db[_0x8339('0x4a')][_0x8339('0x4b')],'transaction':_0x55811a};switch(_0x41500c[_0x8339('0x47')][_0x8339('0x2b')]){case'text':_0x68dd75['type']=db[_0x8339('0x4a')]['TEXT'];break;case _0x8339('0x4c'):_0x68dd75['type']=db[_0x8339('0x4a')][_0x8339('0x4d')];break;case _0x8339('0x4e'):_0x68dd75[_0x8339('0x2b')]=db[_0x8339('0x4a')][_0x8339('0x4f')];_0x68dd75[_0x8339('0x50')]=![];break;default:}return db[_0x8339('0x51')]['queryInterface']['addColumn']('cm_contacts',util[_0x8339('0x52')](_0x8339('0x53'),_0x11b20f['id']),_0x68dd75);})[_0x8339('0x23')](function(){return _0x11b20f;});})['then'](respondWithResult(_0x3832d5,0xc9))['catch'](handleError(_0x3832d5,null));};
\ No newline at end of file
index 026c990..86ad518 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xee52=['cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x239910,_0xb50f5){var _0x29b032=function(_0x26a881){while(--_0x26a881){_0x239910['push'](_0x239910['shift']());}};_0x29b032(++_0xb50f5);}(_0xee52,0x191));var _0x2ee5=function(_0x1b5a97,_0x5de9c3){_0x1b5a97=_0x1b5a97-0x0;var _0x29e837=_0xee52[_0x1b5a97];return _0x29e837;};'use strict';var _=require('lodash');var util=require(_0x2ee5('0x0'));var logger=require(_0x2ee5('0x1'))(_0x2ee5('0x2'));var moment=require(_0x2ee5('0x3'));var BPromise=require(_0x2ee5('0x4'));var rp=require(_0x2ee5('0x5'));var fs=require('fs');var path=require(_0x2ee5('0x6'));var rimraf=require(_0x2ee5('0x7'));var config=require(_0x2ee5('0x8'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x532a8e,_0x1c9646){return _0x532a8e['define']('CmCustomField',attributes,{'tableName':_0x2ee5('0x9'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc0e2=['../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x43e489,_0x309c03){var _0x4a5078=function(_0x30828a){while(--_0x30828a){_0x43e489['push'](_0x43e489['shift']());}};_0x4a5078(++_0x309c03);}(_0xc0e2,0x1e2));var _0x2c0e=function(_0x2bf613,_0x10449d){_0x2bf613=_0x2bf613-0x0;var _0x57a019=_0xc0e2[_0x2bf613];return _0x57a019;};'use strict';var _=require(_0x2c0e('0x0'));var util=require(_0x2c0e('0x1'));var logger=require(_0x2c0e('0x2'))('api');var moment=require(_0x2c0e('0x3'));var BPromise=require(_0x2c0e('0x4'));var rp=require(_0x2c0e('0x5'));var fs=require('fs');var path=require(_0x2c0e('0x6'));var rimraf=require(_0x2c0e('0x7'));var config=require(_0x2c0e('0x8'));var attributes=require(_0x2c0e('0x9'));module[_0x2c0e('0xa')]=function(_0x2d25ba,_0x18028d){return _0x2d25ba[_0x2c0e('0xb')](_0x2c0e('0xc'),attributes,{'tableName':_0x2c0e('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 429fa1e..a63064e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa80=['ioredis','../../config/logger','rpc','../../config/environment','client','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','util','moment','bluebird'];(function(_0x1ad249,_0x2747ec){var _0x54a9c7=function(_0x359f1e){while(--_0x359f1e){_0x1ad249['push'](_0x1ad249['shift']());}};_0x54a9c7(++_0x2747ec);}(_0xaa80,0x1e3));var _0x0aa8=function(_0x2118f2,_0x294cfa){_0x2118f2=_0x2118f2-0x0;var _0x4769df=_0xaa80[_0x2118f2];return _0x4769df;};'use strict';var _=require('lodash');var util=require(_0x0aa8('0x0'));var moment=require(_0x0aa8('0x1'));var BPromise=require(_0x0aa8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0aa8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0aa8('0x4'))(_0x0aa8('0x5'));var config=require(_0x0aa8('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0aa8('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xcb0d41,_0x2df8d0,_0x540820){return new BPromise(function(_0x5951f2,_0x12712d){return client['request'](_0xcb0d41,_0x540820)['then'](function(_0x398dc0){logger['info'](_0x0aa8('0x8'),_0x2df8d0,'request\x20sent');logger[_0x0aa8('0x9')](_0x0aa8('0xa'),_0x2df8d0,_0x0aa8('0xb'),JSON[_0x0aa8('0xc')](_0x398dc0));if(_0x398dc0[_0x0aa8('0xd')]){if(_0x398dc0[_0x0aa8('0xd')][_0x0aa8('0xe')]===0x1f4){logger[_0x0aa8('0xd')](_0x0aa8('0x8'),_0x2df8d0,_0x398dc0[_0x0aa8('0xd')]['message']);return _0x12712d(_0x398dc0['error']['message']);}logger[_0x0aa8('0xd')](_0x0aa8('0x8'),_0x2df8d0,_0x398dc0[_0x0aa8('0xd')][_0x0aa8('0xf')]);return _0x5951f2(_0x398dc0['error'][_0x0aa8('0xf')]);}else{logger[_0x0aa8('0x10')]('CmCustomField,\x20%s,\x20%s',_0x2df8d0,'request\x20sent');_0x5951f2(_0x398dc0['result'][_0x0aa8('0xf')]);}})[_0x0aa8('0x11')](function(_0x36686b){logger[_0x0aa8('0xd')]('CmCustomField,\x20%s,\x20%s',_0x2df8d0,_0x36686b);_0x12712d(_0x36686b);});});}
\ No newline at end of file
+var _0x1258=['error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4ef7bc,_0x1e8207){var _0x30a74f=function(_0x5c728e){while(--_0x5c728e){_0x4ef7bc['push'](_0x4ef7bc['shift']());}};_0x30a74f(++_0x1e8207);}(_0x1258,0x196));var _0x8125=function(_0x5ccc4c,_0x5bee16){_0x5ccc4c=_0x5ccc4c-0x0;var _0x13d160=_0x1258[_0x5ccc4c];return _0x13d160;};'use strict';var _=require(_0x8125('0x0'));var util=require('util');var moment=require(_0x8125('0x1'));var BPromise=require(_0x8125('0x2'));var rs=require(_0x8125('0x3'));var fs=require('fs');var Redis=require(_0x8125('0x4'));var db=require(_0x8125('0x5'))['db'];var utils=require(_0x8125('0x6'));var logger=require(_0x8125('0x7'))(_0x8125('0x8'));var config=require('../../config/environment');var jayson=require(_0x8125('0x9'));var client=jayson[_0x8125('0xa')][_0x8125('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x322fca,_0x214f30,_0x10f4c9){return new BPromise(function(_0x1bd27d,_0x1a46f9){return client[_0x8125('0xc')](_0x322fca,_0x10f4c9)[_0x8125('0xd')](function(_0x40ea80){logger[_0x8125('0xe')]('CmCustomField,\x20%s,\x20%s',_0x214f30,'request\x20sent');logger[_0x8125('0xf')](_0x8125('0x10'),_0x214f30,_0x8125('0x11'),JSON[_0x8125('0x12')](_0x40ea80));if(_0x40ea80[_0x8125('0x13')]){if(_0x40ea80[_0x8125('0x13')][_0x8125('0x14')]===0x1f4){logger[_0x8125('0x13')](_0x8125('0x15'),_0x214f30,_0x40ea80[_0x8125('0x13')][_0x8125('0x16')]);return _0x1a46f9(_0x40ea80[_0x8125('0x13')]['message']);}logger['error'](_0x8125('0x15'),_0x214f30,_0x40ea80[_0x8125('0x13')][_0x8125('0x16')]);return _0x1bd27d(_0x40ea80[_0x8125('0x13')][_0x8125('0x16')]);}else{logger['info'](_0x8125('0x15'),_0x214f30,_0x8125('0x11'));_0x1bd27d(_0x40ea80[_0x8125('0x17')][_0x8125('0x16')]);}})[_0x8125('0x18')](function(_0x5fa08c){logger[_0x8125('0x13')](_0x8125('0x15'),_0x214f30,_0x5fa08c);_0x1a46f9(_0x5fa08c);});});}
\ No newline at end of file
index 704b941..2f9c836 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e79=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','put','update','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e79,0xeb));var _0x92e7=function(_0x506841,_0x4e330b){_0x506841=_0x506841-0x0;var _0x1a8ed0=_0x2e79[_0x506841];return _0x1a8ed0;};'use strict';var multer=require(_0x92e7('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x92e7('0x1'));var express=require(_0x92e7('0x2'));var router=express[_0x92e7('0x3')]();var fs_extra=require(_0x92e7('0x4'));var auth=require(_0x92e7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x92e7('0x6'));var controller=require(_0x92e7('0x7'));router[_0x92e7('0x8')]('/',auth[_0x92e7('0x9')](),controller[_0x92e7('0xa')]);router[_0x92e7('0x8')](_0x92e7('0xb'),auth[_0x92e7('0x9')](),controller['show']);router[_0x92e7('0xc')]('/',auth[_0x92e7('0x9')](),controller[_0x92e7('0xd')]);router[_0x92e7('0xe')]('/:id',auth[_0x92e7('0x9')](),controller[_0x92e7('0xf')]);router['delete'](_0x92e7('0xb'),auth[_0x92e7('0x9')](),controller[_0x92e7('0x10')]);module[_0x92e7('0x11')]=router;
\ No newline at end of file
+var _0x1c3d=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer'];(function(_0x2359b4,_0x97eed2){var _0x9c21a2=function(_0x4e76ae){while(--_0x4e76ae){_0x2359b4['push'](_0x2359b4['shift']());}};_0x9c21a2(++_0x97eed2);}(_0x1c3d,0x68));var _0xd1c3=function(_0x1fb07d,_0x16b8cb){_0x1fb07d=_0x1fb07d-0x0;var _0x5a101f=_0x1c3d[_0x1fb07d];return _0x5a101f;};'use strict';var multer=require(_0xd1c3('0x0'));var util=require(_0xd1c3('0x1'));var path=require(_0xd1c3('0x2'));var timeout=require(_0xd1c3('0x3'));var express=require(_0xd1c3('0x4'));var router=express['Router']();var fs_extra=require(_0xd1c3('0x5'));var auth=require(_0xd1c3('0x6'));var interaction=require(_0xd1c3('0x7'));var config=require(_0xd1c3('0x8'));var controller=require(_0xd1c3('0x9'));router[_0xd1c3('0xa')]('/',auth[_0xd1c3('0xb')](),controller[_0xd1c3('0xc')]);router[_0xd1c3('0xa')](_0xd1c3('0xd'),auth[_0xd1c3('0xb')](),controller[_0xd1c3('0xe')]);router[_0xd1c3('0xf')]('/',auth['isAuthenticated'](),controller[_0xd1c3('0x10')]);router[_0xd1c3('0x11')](_0xd1c3('0xd'),auth[_0xd1c3('0xb')](),controller[_0xd1c3('0x12')]);router[_0xd1c3('0x13')](_0xd1c3('0xd'),auth[_0xd1c3('0xb')](),controller[_0xd1c3('0x14')]);module['exports']=router;
\ No newline at end of file
index aa07193..f359716 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f27=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','contactListQueue','DATE','moment','sequelize','BOOLEAN'];(function(_0x54597a,_0x4ea42f){var _0x5a764f=function(_0x5c000b){while(--_0x5c000b){_0x54597a['push'](_0x54597a['shift']());}};_0x5a764f(++_0x4ea42f);}(_0x9f27,0x19b));var _0x79f2=function(_0x10ec92,_0x59b5df){_0x10ec92=_0x10ec92-0x0;var _0x41659e=_0x9f27[_0x10ec92];return _0x41659e;};'use strict';var moment=require(_0x79f2('0x0'));var Sequelize=require(_0x79f2('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x79f2('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x79f2('0x3')](_0x79f2('0x4'))},'countbusyretry':{'type':Sequelize[_0x79f2('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x79f2('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x79f2('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x79f2('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x79f2('0x5')],'unique':_0x79f2('0x7')},'ListId':{'type':Sequelize[_0x79f2('0x5')],'unique':_0x79f2('0x7')},'UserId':{'type':Sequelize[_0x79f2('0x5')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x79f2('0x7')},'CampaignId':{'type':Sequelize[_0x79f2('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x79f2('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x79f2('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x79f2('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x79f2('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x79f2('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x79f2('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x79f2('0x6')]},'recallmeNotifiedDate':{'type':Sequelize[_0x79f2('0x8')],'allowNull':!![],'defaultValue':null}};
\ No newline at end of file
+var _0x1f3b=['INTEGER','UNSIGNED','contactListQueue','sequelize','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0x1f3b,0x18b));var _0xb1f3=function(_0x2e2c1b,_0x94deaf){_0x2e2c1b=_0x2e2c1b-0x0;var _0x43a4f2=_0x1f3b[_0x2e2c1b];return _0x43a4f2;};'use strict';var moment=require('moment');var Sequelize=require(_0xb1f3('0x0'));module['exports']={'phone':{'type':Sequelize[_0xb1f3('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0xb1f3('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb1f3('0x3')],'defaultValue':moment()['format'](_0xb1f3('0x4'))},'countbusyretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb1f3('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb1f3('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb1f3('0x3')]},'priority':{'type':Sequelize[_0xb1f3('0x5')](0x2)[_0xb1f3('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb1f3('0x5')],'unique':_0xb1f3('0x7')},'ListId':{'type':Sequelize[_0xb1f3('0x5')],'unique':_0xb1f3('0x7')},'UserId':{'type':Sequelize[_0xb1f3('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xb1f3('0x5')],'unique':_0xb1f3('0x7')},'CampaignId':{'type':Sequelize[_0xb1f3('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb1f3('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb1f3('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xb1f3('0x3')],'allowNull':!![],'defaultValue':null}};
\ No newline at end of file
index 514e384..2722773 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x56a4=['COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','recallme','UPDATE','CmContact','Contact','CmCompany','Company','CmList','List','Queue','dialActive','getPreviewRecall','findOne','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','getTimezones','timezones','push','utcOffset','moment','lodash','../../config/logger','api','status','json','offset','undefined','limit','count','set','Content-Range','then','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','key','model','keys','query','filters','$and','$or','$gte','$lt','$ne','$between','$in','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','map','type','VIRTUAL','filter','options','CmHopper','includeAll','include','findAll','rows','catch','show','params','intersection','find','create','body','update','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','state','deleted','campaign','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperAdditionalPhone','end','getPreview','describe','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','scheduledAt','dialOrderByScheduledAt','DESC','ASC'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x56a4,0x11b));var _0x456a=function(_0x15cbce,_0xda8402){_0x15cbce=_0x15cbce-0x0;var _0x257f29=_0x56a4[_0x15cbce];return _0x257f29;};'use strict';var moment=require(_0x456a('0x0'));var _=require(_0x456a('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x456a('0x2'))(_0x456a('0x3'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x26a7c6,_0x3a11ee){_0x3a11ee=_0x3a11ee||0xc8;return function(_0x143999){if(_0x143999){return _0x26a7c6[_0x456a('0x4')](_0x3a11ee)[_0x456a('0x5')](_0x143999);}};}function respondWithFilteredResult(_0x4b8eec,_0x3b0145){return function(_0x52b38d){if(_0x52b38d){var _0x497df4=typeof _0x3b0145[_0x456a('0x6')]===_0x456a('0x7')&&typeof _0x3b0145[_0x456a('0x8')]==='undefined';var _0x3c8dc5=_0x52b38d['count'];var _0xb56df=_0x497df4?0x0:_0x3b0145[_0x456a('0x6')];var _0x3bb712=_0x497df4?_0x52b38d[_0x456a('0x9')]:_0x3b0145[_0x456a('0x6')]+_0x3b0145[_0x456a('0x8')];var _0x1179fa;if(_0x3bb712>=_0x3c8dc5){_0x3bb712=_0x3c8dc5;_0x1179fa=0xc8;}else{_0x1179fa=0xce;}_0x4b8eec[_0x456a('0x4')](_0x1179fa);return _0x4b8eec[_0x456a('0xa')](_0x456a('0xb'),_0xb56df+'-'+_0x3bb712+'/'+_0x3c8dc5)[_0x456a('0x5')](_0x52b38d);}return null;};}function saveUpdates(_0x479993,_0x2f4b75){return function(_0x5284ce){if(_0x5284ce){return _0x5284ce['update'](_0x479993)[_0x456a('0xc')](function(_0x2924b9){return _0x2924b9;});}return null;};}function handleEntityNotFound(_0xa5b5d8,_0xc01cbb){return function(_0x50c03a){if(!_0x50c03a){_0xa5b5d8[_0x456a('0xd')](0x194);}return _0x50c03a;};}function handleError(_0x2318f3,_0x57f10b){_0x57f10b=_0x57f10b||0x1f4;return function(_0x78c2ec){logger[_0x456a('0xe')](_0x78c2ec[_0x456a('0xf')]);if(_0x78c2ec['name']){delete _0x78c2ec[_0x456a('0x10')];}_0x2318f3[_0x456a('0x4')](_0x57f10b)[_0x456a('0x11')](_0x78c2ec);};}exports[_0x456a('0x12')]=function(_0x5718f4,_0x200eda){var _0x448fd6={},_0x7b2cac={},_0x599c2e={'count':0x0,'rows':[]};var _0x3d06b4=_['map'](db['CmHopper'][_0x456a('0x13')],function(_0x562cfa){return{'name':_0x562cfa[_0x456a('0x14')],'type':_0x562cfa['type'][_0x456a('0x15')]};});_0x7b2cac[_0x456a('0x16')]=_['map'](_0x3d06b4,'name');_0x7b2cac['query']=_[_0x456a('0x17')](_0x5718f4[_0x456a('0x18')]);_0x7b2cac[_0x456a('0x19')]=_['intersection'](_0x7b2cac[_0x456a('0x16')],_0x7b2cac['query']);_0x7b2cac['filters']=_['concat'](_0x7b2cac[_0x456a('0x19')],[_0x456a('0x1a'),_0x456a('0x1b'),'$gt',_0x456a('0x1c'),_0x456a('0x1d'),'$lte',_0x456a('0x1e'),'$eq','$not',_0x456a('0x1f'),'$notBetween',_0x456a('0x20'),'$notIn',_0x456a('0x21'),_0x456a('0x22'),_0x456a('0x23'),_0x456a('0x24'),_0x456a('0x21'),_0x456a('0x25'),_0x456a('0x26'),_0x456a('0x27'),'$any']);_0x448fd6['attributes']=_['intersection'](_0x7b2cac[_0x456a('0x16')],qs[_0x456a('0x28')](_0x5718f4['query'][_0x456a('0x28')]));_0x448fd6[_0x456a('0x29')]=_0x448fd6[_0x456a('0x29')][_0x456a('0x2a')]?_0x448fd6[_0x456a('0x29')]:_0x7b2cac['model'];if(!_0x5718f4[_0x456a('0x18')][_0x456a('0x2b')](_0x456a('0x2c'))){_0x448fd6['limit']=qs[_0x456a('0x8')](_0x5718f4[_0x456a('0x18')]['limit']);_0x448fd6[_0x456a('0x6')]=qs[_0x456a('0x6')](_0x5718f4[_0x456a('0x18')][_0x456a('0x6')]);}_0x448fd6[_0x456a('0x2d')]=qs['sort'](_0x5718f4[_0x456a('0x18')][_0x456a('0x2e')]);_0x448fd6[_0x456a('0x2f')]=qs['filters'](_['pick'](_0x5718f4[_0x456a('0x18')],_0x7b2cac['filters']),_0x3d06b4);if(_0x5718f4['query']['filter']){_0x448fd6[_0x456a('0x2f')]=_[_0x456a('0x30')](_0x448fd6[_0x456a('0x2f')],{'$or':_[_0x456a('0x31')](_0x3d06b4,function(_0x53e8f2){if(_0x53e8f2[_0x456a('0x32')]!==_0x456a('0x33')){var _0x492874={};_0x492874[_0x53e8f2[_0x456a('0x10')]]={'$like':'%'+_0x5718f4[_0x456a('0x18')][_0x456a('0x34')]+'%'};return _0x492874;}})});}_0x448fd6=_[_0x456a('0x30')]({},_0x448fd6,_0x5718f4[_0x456a('0x35')]);var _0x5113da={'where':_0x448fd6[_0x456a('0x2f')]};return db[_0x456a('0x36')]['count'](_0x5113da)[_0x456a('0xc')](function(_0x1d4420){_0x599c2e[_0x456a('0x9')]=_0x1d4420;if(_0x5718f4[_0x456a('0x18')][_0x456a('0x37')]){_0x448fd6[_0x456a('0x38')]=[{'all':!![]}];}return db[_0x456a('0x36')][_0x456a('0x39')](_0x448fd6);})['then'](function(_0xf95001){_0x599c2e[_0x456a('0x3a')]=_0xf95001;return _0x599c2e;})[_0x456a('0xc')](respondWithFilteredResult(_0x200eda,_0x448fd6))[_0x456a('0x3b')](handleError(_0x200eda,null));};exports[_0x456a('0x3c')]=function(_0x57852b,_0xeacac0){var _0x587387={'raw':!![],'where':{'id':_0x57852b[_0x456a('0x3d')]['id']}},_0x27dccd={};_0x27dccd['model']=_[_0x456a('0x17')](db[_0x456a('0x36')][_0x456a('0x13')]);_0x27dccd['query']=_[_0x456a('0x17')](_0x57852b['query']);_0x27dccd['filters']=_[_0x456a('0x3e')](_0x27dccd['model'],_0x27dccd[_0x456a('0x18')]);_0x587387[_0x456a('0x29')]=_['intersection'](_0x27dccd[_0x456a('0x16')],qs[_0x456a('0x28')](_0x57852b[_0x456a('0x18')][_0x456a('0x28')]));_0x587387[_0x456a('0x29')]=_0x587387[_0x456a('0x29')]['length']?_0x587387[_0x456a('0x29')]:_0x27dccd['model'];if(_0x57852b[_0x456a('0x18')][_0x456a('0x37')]){_0x587387[_0x456a('0x38')]=[{'all':!![]}];}_0x587387=_[_0x456a('0x30')]({},_0x587387,_0x57852b[_0x456a('0x35')]);return db['CmHopper'][_0x456a('0x3f')](_0x587387)[_0x456a('0xc')](handleEntityNotFound(_0xeacac0,null))[_0x456a('0xc')](respondWithResult(_0xeacac0,null))[_0x456a('0x3b')](handleError(_0xeacac0,null));};exports[_0x456a('0x40')]=function(_0x1e5156,_0x3a8d96){return db['CmHopper'][_0x456a('0x40')](_0x1e5156[_0x456a('0x41')],{})[_0x456a('0xc')](respondWithResult(_0x3a8d96,0xc9))[_0x456a('0x3b')](handleError(_0x3a8d96,null));};exports[_0x456a('0x42')]=function(_0x4b8aec,_0x2bbe80){if(_0x4b8aec[_0x456a('0x41')]['id']){delete _0x4b8aec['body']['id'];}return db['CmHopper'][_0x456a('0x3f')]({'where':{'id':_0x4b8aec['params']['id']}})[_0x456a('0xc')](handleEntityNotFound(_0x2bbe80,null))['then'](saveUpdates(_0x4b8aec[_0x456a('0x41')],null))[_0x456a('0xc')](respondWithResult(_0x2bbe80,null))['catch'](handleError(_0x2bbe80,null));};exports['describe']=function(_0x4bd87c,_0x19570b){return db[_0x456a('0x36')]['describe']()['then'](respondWithResult(_0x19570b,null))[_0x456a('0x3b')](handleError(_0x19570b,null));};exports['destroy']=function(_0x4e1e36,_0xd08a6d){var _0x29eca8;var _0x51c97d=_0x4e1e36['params']['id'];return db['CmHopper'][_0x456a('0x3f')]({'where':{'id':_0x4e1e36[_0x456a('0x3d')]['id']}})[_0x456a('0xc')](handleEntityNotFound(_0xd08a6d,null))['then'](function(_0x3a6963){if(_0x3a6963){return _0x3a6963[_0x456a('0x43')]()[_0x456a('0xc')](function(_0x2cecc7){return _0x2cecc7;});}})[_0x456a('0xc')](function(_0x413820){_0x29eca8=_0x413820;if(_0x413820){if(_0x413820[_0x456a('0x44')]||_0x413820[_0x456a('0x45')]){return db[_0x413820['VoiceQueueId']?_0x456a('0x46'):_0x456a('0x47')]['find']({'where':{'id':_0x413820[_0x456a('0x44')]?_0x413820[_0x456a('0x44')]:_0x413820['CampaignId']},'attributes':['id',_0x456a('0x10')],'raw':!![]});}}})[_0x456a('0xc')](function(_0x54c33c){var _0x19d20d={};if(_0x54c33c){_[_0x456a('0x30')](_0x19d20d,_[_0x456a('0x48')](_0x29eca8[_0x456a('0x49')],['createdAt','updatedAt','id']));_0x19d20d[_0x456a('0x4a')]=0x15;_0x19d20d['statedesc']=_0x456a('0x4b');_0x19d20d[_0x456a('0x4c')]=_0x54c33c['name'];_0x19d20d['membername']=_0x4e1e36[_0x456a('0x4d')][_0x456a('0x10')];_0x19d20d['UserId']=_0x4e1e36[_0x456a('0x4d')]['id'];_0x19d20d[_0x456a('0x4b')]=!![];_0x19d20d[_0x456a('0x4e')]=moment()[_0x456a('0x4f')](_0x456a('0x50'));_0x19d20d[_0x456a('0x51')]=_0x29eca8[_0x456a('0x52')];_0x19d20d['campaigntype']=_0x29eca8[_0x456a('0x44')]?_0x456a('0x53'):'ivr';return db['CmContact']['find']({'where':{'id':_0x19d20d[_0x456a('0x54')]},'attributes':[_0x456a('0x55'),_0x456a('0x56')]})['then'](function(_0x58d43b){if(!_[_0x456a('0x57')](_0xd08a6d)&&!_[_0x456a('0x57')](_0x58d43b['firstName'])){_0x19d20d['calleridname']=_0x58d43b[_0x456a('0x55')];if(!_[_0x456a('0x57')](_0x58d43b['lastName'])){_0x19d20d[_0x456a('0x58')]+='\x20'+_0x58d43b[_0x456a('0x56')];}}})[_0x456a('0x59')](function(){return db['CmHopperFinal'][_0x456a('0x40')](_0x19d20d);});}})[_0x456a('0xc')](function(_0x3e7365){return db[_0x456a('0x5a')][_0x456a('0x43')]({'where':{'CmHopperId':_0x51c97d}});})[_0x456a('0xc')](function(){return _0xd08a6d[_0x456a('0x4')](0xcc)[_0x456a('0x5b')]();})[_0x456a('0x3b')](handleError(_0xd08a6d,null));};exports[_0x456a('0x5c')]=function(_0x56b933,_0x42720b){var _0x1c145c=[];return db['CmContact'][_0x456a('0x5d')]()[_0x456a('0xc')](function(_0x459c7b){_0x1c145c=_[_0x456a('0x17')](_0x459c7b);return _0x56b933['user'][_0x456a('0x5e')]({'where':{'type':_0x456a('0x5f'),'dialActive':!![],'dialMethod':_0x456a('0x60')},'attributes':['id','dialOrderByScheduledAt',_0x456a('0x61')],'raw':!![]});})[_0x456a('0xc')](function(_0x17c360){if(_0x17c360&&_0x17c360['length']){return db[_0x456a('0x62')][_0x456a('0x63')](function(_0x5781c9){var _0x1a40eb={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x456a('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x456a('0x31')](_0x17c360,'id')},'$or':[{'UserId':null},{'UserId':_0x56b933[_0x456a('0x4d')]['id']}]};var _0x17a62e={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x17c360)['filter']([_0x456a('0x61'),0x0])[_0x456a('0x31')]('id')[_0x456a('0x64')]()},'$or':[{'UserId':null},{'UserId':_0x56b933[_0x456a('0x4d')]['id']}]};var _0x27fafe={'$or':[_0x1a40eb,_0x17a62e]};var _0x2e7a27=[];if(_0x56b933['body'][_0x456a('0x65')]&&_0x56b933[_0x456a('0x41')][_0x456a('0x65')]===_0x456a('0x66')){if(!_[_0x456a('0x67')](_0x56b933[_0x456a('0x41')][_0x456a('0x68')])){_0x27fafe['id']={'$in':_0x56b933[_0x456a('0x41')]['hopperIds']};}_0x2e7a27=[[_0x456a('0x69'),'ASC'],[_0x456a('0x6a'),_0x17c360[0x0][_0x456a('0x6b')]==='ASC'?_0x456a('0x6c'):_0x456a('0x6d')],db[_0x456a('0x62')]['literal'](_0x456a('0x6e')),['id',_0x456a('0x6c')]];}else{if(!_[_0x456a('0x67')](_0x56b933['body'][_0x456a('0x68')])){_0x27fafe['id']={'$notIn':_0x56b933[_0x456a('0x41')][_0x456a('0x68')]};}_0x2e7a27=[[_0x456a('0x69'),_0x456a('0x6c')],[_0x456a('0x6a'),_0x17c360[0x0][_0x456a('0x6b')]],db[_0x456a('0x62')]['literal'](_0x456a('0x6f')),['id',_0x456a('0x6d')]];}return db[_0x456a('0x36')]['findOne']({'attributes':['id',_0x456a('0x70'),'phone',_0x456a('0x71')],'where':_0x27fafe,'order':_0x2e7a27,'transaction':_0x5781c9,'lock':_0x5781c9['LOCK'][_0x456a('0x72')],'include':[{'model':db[_0x456a('0x73')],'as':_0x456a('0x74'),'attributes':_0x1c145c,'include':[{'model':db[_0x456a('0x75')],'as':_0x456a('0x76'),'attributes':['id',_0x456a('0x10')]}]},{'model':db[_0x456a('0x77')],'as':_0x456a('0x78'),'attributes':['id','name']},{'model':db[_0x456a('0x46')],'as':_0x456a('0x79'),'attributes':['id',_0x456a('0x10'),_0x456a('0x7a')]}]})[_0x456a('0xc')](function(_0xd1831d){if(_0xd1831d){return _0xd1831d[_0x456a('0x42')]({'UserId':_0x56b933[_0x456a('0x4d')]['id']},{'transaction':_0x5781c9});}});});}})[_0x456a('0xc')](handleEntityNotFound(_0x42720b,null))[_0x456a('0xc')](respondWithResult(_0x42720b,null))[_0x456a('0x3b')](handleError(_0x42720b,null));};exports[_0x456a('0x7b')]=function(_0x4e8f46,_0x36dadd,_0x39d26a){var _0x392a9a=[];var _0x145f8f=_0x4e8f46[_0x456a('0x3d')]['id'];var _0x18a293=_0x4e8f46[_0x456a('0x4d')]['id'];return db[_0x456a('0x73')]['describe']()[_0x456a('0xc')](function(_0x3a66a8){_0x392a9a=_[_0x456a('0x17')](_0x3a66a8);return db[_0x456a('0x62')][_0x456a('0x63')](function(_0xfb544){const _0x3342f7={'id':_0x145f8f};return db[_0x456a('0x36')][_0x456a('0x7c')]({'attributes':['id','scheduledat',_0x456a('0x71')],'where':_0x3342f7,'transaction':_0xfb544,'lock':_0xfb544['LOCK']['UPDATE'],'include':[{'model':db['CmContact'],'as':_0x456a('0x74'),'attributes':_0x392a9a,'include':[{'model':db['CmCompany'],'as':_0x456a('0x76'),'attributes':['id',_0x456a('0x10')]}]},{'model':db['CmList'],'as':_0x456a('0x78'),'attributes':['id','name']},{'model':db[_0x456a('0x46')],'as':_0x456a('0x79'),'attributes':['id',_0x456a('0x10'),'dialActive']}]})[_0x456a('0xc')](function(_0x1bba34){if(_0x1bba34){return _0x1bba34[_0x456a('0x42')]({'UserId':_0x18a293},{'transaction':_0xfb544});}});});})[_0x456a('0xc')](handleEntityNotFound(_0x36dadd,null))[_0x456a('0xc')](respondWithResult(_0x36dadd,null))[_0x456a('0x3b')](handleError(_0x36dadd,null));};exports[_0x456a('0x7d')]=function(_0x17eec5,_0x9de9a7){return _0x17eec5[_0x456a('0x4d')][_0x456a('0x5e')]({'where':{'type':_0x456a('0x5f'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0x291b72){if(_0x291b72&&_0x291b72[_0x456a('0x2a')]){return db[_0x456a('0x36')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x456a('0x4f')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x291b72,'id')},'$or':[{'UserId':null},{'UserId':_0x17eec5[_0x456a('0x4d')]['id']}]}});}return 0x0;})[_0x456a('0xc')](function(_0x179830){if(!_['isNil'](_0x179830)&&_['isNumber'](_0x179830)){return _0x9de9a7[_0x456a('0x4')](0xc8)[_0x456a('0x5')]({'contacts':_0x179830});}else{logger[_0x456a('0xe')](_0x456a('0x7e'),_0x456a('0x7d'),0x194,'entity\x20not\x20found');_0x9de9a7['sendStatus'](0x194);}})[_0x456a('0x3b')](handleError(_0x9de9a7,null));};exports[_0x456a('0x7f')]=function(_0x4becf2,_0x201632){var _0x2aea65=shared[_0x456a('0x80')];var _0x564829=[];_[_0x456a('0x31')](_0x2aea65,function(_0x5ec703){_0x564829[_0x456a('0x81')]({'id':_0x5ec703[_0x456a('0x10')],'name':_0x5ec703[_0x456a('0x10')],'utcOffset':_0x5ec703[_0x456a('0x82')]});});return _0x201632[_0x456a('0x4')](0xc8)[_0x456a('0x5')]({'tz':_0x564829});};exports['getTimezone']=function(_0xbcde22,_0x4cabd3){var _0x2ed7c6=shared[_0x456a('0x80')];var _0x4332c8={};if(!_[_0x456a('0x57')](_0x2ed7c6[_0xbcde22['body']['id']]))_0x4332c8=_0x2ed7c6[_0xbcde22['body']['id']];return _0x4cabd3[_0x456a('0x4')](0xc8)[_0x456a('0x5')](_0x4332c8);};
\ No newline at end of file
+var _0xa990=['describe','destroy','find','CampaignId','VoiceQueueId','VoiceQueue','Campaign','omit','dataValues','updatedAt','state','statedesc','deleted','campaign','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','format','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','dialOrderByScheduledAt','findOne','scheduledat','recallme','LOCK','UPDATE','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','transaction','CmList','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','set','update','then','sendStatus','error','stack','name','index','map','CmHopper','rawAttributes','type','model','keys','query','filters','intersection','concat','$gt','$gte','$lt','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$any','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','rows','catch','show','include','create','body','params'];(function(_0x12ff98,_0x52151d){var _0x9c49e6=function(_0x16027c){while(--_0x16027c){_0x12ff98['push'](_0x12ff98['shift']());}};_0x9c49e6(++_0x52151d);}(_0xa990,0xc9));var _0x0a99=function(_0x40f871,_0x3d7cce){_0x40f871=_0x40f871-0x0;var _0x2f1e26=_0xa990[_0x40f871];return _0x2f1e26;};'use strict';var moment=require(_0x0a99('0x0'));var _=require(_0x0a99('0x1'));var qs=require(_0x0a99('0x2'));var logger=require(_0x0a99('0x3'))(_0x0a99('0x4'));var shared=require(_0x0a99('0x5'));var db=require(_0x0a99('0x6'))['db'];function respondWithResult(_0x394f1c,_0x4d4992){_0x4d4992=_0x4d4992||0xc8;return function(_0x4d1781){if(_0x4d1781){return _0x394f1c[_0x0a99('0x7')](_0x4d4992)[_0x0a99('0x8')](_0x4d1781);}};}function respondWithFilteredResult(_0xfdb594,_0x320560){return function(_0x45b195){if(_0x45b195){var _0x398d95=typeof _0x320560[_0x0a99('0x9')]===_0x0a99('0xa')&&typeof _0x320560[_0x0a99('0xb')]===_0x0a99('0xa');var _0x1eaa2a=_0x45b195['count'];var _0x813e91=_0x398d95?0x0:_0x320560[_0x0a99('0x9')];var _0x5b5ec3=_0x398d95?_0x45b195['count']:_0x320560[_0x0a99('0x9')]+_0x320560[_0x0a99('0xb')];var _0x1eb2bd;if(_0x5b5ec3>=_0x1eaa2a){_0x5b5ec3=_0x1eaa2a;_0x1eb2bd=0xc8;}else{_0x1eb2bd=0xce;}_0xfdb594[_0x0a99('0x7')](_0x1eb2bd);return _0xfdb594[_0x0a99('0xc')]('Content-Range',_0x813e91+'-'+_0x5b5ec3+'/'+_0x1eaa2a)[_0x0a99('0x8')](_0x45b195);}return null;};}function saveUpdates(_0x3aaaad,_0x57ab88){return function(_0xb6a34d){if(_0xb6a34d){return _0xb6a34d[_0x0a99('0xd')](_0x3aaaad)[_0x0a99('0xe')](function(_0x2bbf1a){return _0x2bbf1a;});}return null;};}function handleEntityNotFound(_0x346061,_0x23d018){return function(_0x18c124){if(!_0x18c124){_0x346061[_0x0a99('0xf')](0x194);}return _0x18c124;};}function handleError(_0x4b6946,_0x5a17e1){_0x5a17e1=_0x5a17e1||0x1f4;return function(_0x2c40db){logger[_0x0a99('0x10')](_0x2c40db[_0x0a99('0x11')]);if(_0x2c40db['name']){delete _0x2c40db[_0x0a99('0x12')];}_0x4b6946['status'](_0x5a17e1)['send'](_0x2c40db);};}exports[_0x0a99('0x13')]=function(_0x3bab16,_0x3de006){var _0x544c2={},_0x572ce5={},_0x564ae9={'count':0x0,'rows':[]};var _0x27a14f=_[_0x0a99('0x14')](db[_0x0a99('0x15')][_0x0a99('0x16')],function(_0x5e6c7e){return{'name':_0x5e6c7e['fieldName'],'type':_0x5e6c7e[_0x0a99('0x17')]['key']};});_0x572ce5[_0x0a99('0x18')]=_['map'](_0x27a14f,_0x0a99('0x12'));_0x572ce5['query']=_[_0x0a99('0x19')](_0x3bab16[_0x0a99('0x1a')]);_0x572ce5[_0x0a99('0x1b')]=_[_0x0a99('0x1c')](_0x572ce5[_0x0a99('0x18')],_0x572ce5[_0x0a99('0x1a')]);_0x572ce5[_0x0a99('0x1b')]=_[_0x0a99('0x1d')](_0x572ce5[_0x0a99('0x1b')],['$and','$or',_0x0a99('0x1e'),_0x0a99('0x1f'),_0x0a99('0x20'),'$lte','$ne',_0x0a99('0x21'),_0x0a99('0x22'),_0x0a99('0x23'),_0x0a99('0x24'),_0x0a99('0x25'),_0x0a99('0x26'),_0x0a99('0x27'),_0x0a99('0x28'),_0x0a99('0x29'),'$notILike',_0x0a99('0x27'),'$overlap','$contains','$contained',_0x0a99('0x2a')]);_0x544c2[_0x0a99('0x2b')]=_[_0x0a99('0x1c')](_0x572ce5[_0x0a99('0x18')],qs[_0x0a99('0x2c')](_0x3bab16[_0x0a99('0x1a')][_0x0a99('0x2c')]));_0x544c2['attributes']=_0x544c2[_0x0a99('0x2b')][_0x0a99('0x2d')]?_0x544c2[_0x0a99('0x2b')]:_0x572ce5[_0x0a99('0x18')];if(!_0x3bab16['query']['hasOwnProperty']('nolimit')){_0x544c2[_0x0a99('0xb')]=qs[_0x0a99('0xb')](_0x3bab16[_0x0a99('0x1a')]['limit']);_0x544c2[_0x0a99('0x9')]=qs[_0x0a99('0x9')](_0x3bab16[_0x0a99('0x1a')][_0x0a99('0x9')]);}_0x544c2[_0x0a99('0x2e')]=qs[_0x0a99('0x2f')](_0x3bab16[_0x0a99('0x1a')]['sort']);_0x544c2[_0x0a99('0x30')]=qs[_0x0a99('0x1b')](_[_0x0a99('0x31')](_0x3bab16[_0x0a99('0x1a')],_0x572ce5[_0x0a99('0x1b')]),_0x27a14f);if(_0x3bab16['query'][_0x0a99('0x32')]){_0x544c2['where']=_['merge'](_0x544c2['where'],{'$or':_['map'](_0x27a14f,function(_0x155a14){if(_0x155a14['type']!==_0x0a99('0x33')){var _0x3d5e0f={};_0x3d5e0f[_0x155a14[_0x0a99('0x12')]]={'$like':'%'+_0x3bab16[_0x0a99('0x1a')][_0x0a99('0x32')]+'%'};return _0x3d5e0f;}})});}_0x544c2=_[_0x0a99('0x34')]({},_0x544c2,_0x3bab16[_0x0a99('0x35')]);var _0x3bc3fc={'where':_0x544c2[_0x0a99('0x30')]};return db[_0x0a99('0x15')][_0x0a99('0x36')](_0x3bc3fc)[_0x0a99('0xe')](function(_0x472850){_0x564ae9['count']=_0x472850;if(_0x3bab16[_0x0a99('0x1a')][_0x0a99('0x37')]){_0x544c2['include']=[{'all':!![]}];}return db[_0x0a99('0x15')]['findAll'](_0x544c2);})[_0x0a99('0xe')](function(_0x563fbc){_0x564ae9[_0x0a99('0x38')]=_0x563fbc;return _0x564ae9;})[_0x0a99('0xe')](respondWithFilteredResult(_0x3de006,_0x544c2))[_0x0a99('0x39')](handleError(_0x3de006,null));};exports[_0x0a99('0x3a')]=function(_0x4a5c58,_0x19774f){var _0x11e046={'raw':!![],'where':{'id':_0x4a5c58['params']['id']}},_0x3b7efc={};_0x3b7efc[_0x0a99('0x18')]=_[_0x0a99('0x19')](db[_0x0a99('0x15')][_0x0a99('0x16')]);_0x3b7efc['query']=_[_0x0a99('0x19')](_0x4a5c58['query']);_0x3b7efc['filters']=_[_0x0a99('0x1c')](_0x3b7efc['model'],_0x3b7efc[_0x0a99('0x1a')]);_0x11e046['attributes']=_[_0x0a99('0x1c')](_0x3b7efc[_0x0a99('0x18')],qs[_0x0a99('0x2c')](_0x4a5c58[_0x0a99('0x1a')]['fields']));_0x11e046[_0x0a99('0x2b')]=_0x11e046[_0x0a99('0x2b')][_0x0a99('0x2d')]?_0x11e046[_0x0a99('0x2b')]:_0x3b7efc['model'];if(_0x4a5c58['query']['includeAll']){_0x11e046[_0x0a99('0x3b')]=[{'all':!![]}];}_0x11e046=_['merge']({},_0x11e046,_0x4a5c58[_0x0a99('0x35')]);return db['CmHopper']['find'](_0x11e046)['then'](handleEntityNotFound(_0x19774f,null))['then'](respondWithResult(_0x19774f,null))[_0x0a99('0x39')](handleError(_0x19774f,null));};exports['create']=function(_0x3e6213,_0x78cd0c){return db['CmHopper'][_0x0a99('0x3c')](_0x3e6213[_0x0a99('0x3d')],{})['then'](respondWithResult(_0x78cd0c,0xc9))[_0x0a99('0x39')](handleError(_0x78cd0c,null));};exports['update']=function(_0x3107bc,_0x278454){if(_0x3107bc['body']['id']){delete _0x3107bc[_0x0a99('0x3d')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x3107bc[_0x0a99('0x3e')]['id']}})[_0x0a99('0xe')](handleEntityNotFound(_0x278454,null))[_0x0a99('0xe')](saveUpdates(_0x3107bc[_0x0a99('0x3d')],null))[_0x0a99('0xe')](respondWithResult(_0x278454,null))['catch'](handleError(_0x278454,null));};exports[_0x0a99('0x3f')]=function(_0x174298,_0x4525d1){return db[_0x0a99('0x15')][_0x0a99('0x3f')]()[_0x0a99('0xe')](respondWithResult(_0x4525d1,null))[_0x0a99('0x39')](handleError(_0x4525d1,null));};exports[_0x0a99('0x40')]=function(_0x1cd328,_0x1621d9){var _0x52c754;var _0x50e04f=_0x1cd328[_0x0a99('0x3e')]['id'];return db[_0x0a99('0x15')][_0x0a99('0x41')]({'where':{'id':_0x1cd328[_0x0a99('0x3e')]['id']}})[_0x0a99('0xe')](handleEntityNotFound(_0x1621d9,null))[_0x0a99('0xe')](function(_0x5cda7d){if(_0x5cda7d){return _0x5cda7d[_0x0a99('0x40')]()[_0x0a99('0xe')](function(_0x55fee0){return _0x55fee0;});}})[_0x0a99('0xe')](function(_0x474e8b){_0x52c754=_0x474e8b;if(_0x474e8b){if(_0x474e8b['VoiceQueueId']||_0x474e8b[_0x0a99('0x42')]){return db[_0x474e8b[_0x0a99('0x43')]?_0x0a99('0x44'):_0x0a99('0x45')][_0x0a99('0x41')]({'where':{'id':_0x474e8b[_0x0a99('0x43')]?_0x474e8b[_0x0a99('0x43')]:_0x474e8b['CampaignId']},'attributes':['id',_0x0a99('0x12')],'raw':!![]});}}})[_0x0a99('0xe')](function(_0x1e9e9d){var _0x5a6762={};if(_0x1e9e9d){_[_0x0a99('0x34')](_0x5a6762,_[_0x0a99('0x46')](_0x52c754[_0x0a99('0x47')],['createdAt',_0x0a99('0x48'),'id']));_0x5a6762[_0x0a99('0x49')]=0x15;_0x5a6762[_0x0a99('0x4a')]=_0x0a99('0x4b');_0x5a6762[_0x0a99('0x4c')]=_0x1e9e9d[_0x0a99('0x12')];_0x5a6762['membername']=_0x1cd328[_0x0a99('0x4d')]['name'];_0x5a6762[_0x0a99('0x4e')]=_0x1cd328[_0x0a99('0x4d')]['id'];_0x5a6762[_0x0a99('0x4b')]=!![];_0x5a6762[_0x0a99('0x4f')]=moment()['format'](_0x0a99('0x50'));_0x5a6762['calleridnum']=_0x52c754[_0x0a99('0x51')];_0x5a6762[_0x0a99('0x52')]=_0x52c754[_0x0a99('0x43')]?_0x0a99('0x53'):_0x0a99('0x54');return db[_0x0a99('0x55')][_0x0a99('0x41')]({'where':{'id':_0x5a6762[_0x0a99('0x56')]},'attributes':[_0x0a99('0x57'),_0x0a99('0x58')]})[_0x0a99('0xe')](function(_0x3f2e09){if(!_[_0x0a99('0x59')](_0x1621d9)&&!_['isNil'](_0x3f2e09[_0x0a99('0x57')])){_0x5a6762[_0x0a99('0x5a')]=_0x3f2e09[_0x0a99('0x57')];if(!_['isNil'](_0x3f2e09[_0x0a99('0x58')])){_0x5a6762[_0x0a99('0x5a')]+='\x20'+_0x3f2e09[_0x0a99('0x58')];}}})['finally'](function(){return db[_0x0a99('0x5b')][_0x0a99('0x3c')](_0x5a6762);});}})[_0x0a99('0xe')](function(_0x144032){return db['CmHopperAdditionalPhone'][_0x0a99('0x40')]({'where':{'CmHopperId':_0x50e04f}});})[_0x0a99('0xe')](function(){return _0x1621d9[_0x0a99('0x7')](0xcc)['end']();})['catch'](handleError(_0x1621d9,null));};exports[_0x0a99('0x5c')]=function(_0x528a5d,_0x53b1f4){var _0x5406a7=[];return db[_0x0a99('0x55')]['describe']()[_0x0a99('0xe')](function(_0x436942){_0x5406a7=_[_0x0a99('0x19')](_0x436942);return _0x528a5d[_0x0a99('0x4d')][_0x0a99('0x5d')]({'where':{'type':_0x0a99('0x5e'),'dialActive':!![],'dialMethod':_0x0a99('0x5f')},'attributes':['id','dialOrderByScheduledAt',_0x0a99('0x60')],'raw':!![]});})[_0x0a99('0xe')](function(_0x2d3b63){if(_0x2d3b63&&_0x2d3b63['length']){return db[_0x0a99('0x61')]['transaction'](function(_0x2109db){var _0x51d18a={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0a99('0x62')](_0x0a99('0x50'))},'VoiceQueueId':{'$in':_['map'](_0x2d3b63,'id')},'$or':[{'UserId':null},{'UserId':_0x528a5d[_0x0a99('0x4d')]['id']}]};var _0x4ce300={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2d3b63)[_0x0a99('0x32')]([_0x0a99('0x60'),0x0])[_0x0a99('0x14')]('id')[_0x0a99('0x63')]()},'$or':[{'UserId':null},{'UserId':_0x528a5d[_0x0a99('0x4d')]['id']}]};var _0x9b52c7={'$or':[_0x51d18a,_0x4ce300]};var _0x44aa5d=[];if(_0x528a5d[_0x0a99('0x3d')][_0x0a99('0x64')]&&_0x528a5d[_0x0a99('0x3d')][_0x0a99('0x64')]===_0x0a99('0x65')){if(!_[_0x0a99('0x66')](_0x528a5d[_0x0a99('0x3d')][_0x0a99('0x67')])){_0x9b52c7['id']={'$in':_0x528a5d[_0x0a99('0x3d')][_0x0a99('0x67')]};}_0x44aa5d=[[_0x0a99('0x68'),'ASC'],['scheduledAt',_0x2d3b63[0x0]['dialOrderByScheduledAt']===_0x0a99('0x69')?_0x0a99('0x6a'):_0x0a99('0x69')],db['sequelize'][_0x0a99('0x6b')](_0x0a99('0x6c')),['id',_0x0a99('0x6a')]];}else{if(!_[_0x0a99('0x66')](_0x528a5d['body'][_0x0a99('0x67')])){_0x9b52c7['id']={'$notIn':_0x528a5d[_0x0a99('0x3d')]['hopperIds']};}_0x44aa5d=[['priority',_0x0a99('0x6a')],[_0x0a99('0x6d'),_0x2d3b63[0x0][_0x0a99('0x6e')]],db[_0x0a99('0x61')][_0x0a99('0x6b')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id','ASC']];}return db[_0x0a99('0x15')][_0x0a99('0x6f')]({'attributes':['id',_0x0a99('0x70'),_0x0a99('0x51'),_0x0a99('0x71')],'where':_0x9b52c7,'order':_0x44aa5d,'transaction':_0x2109db,'lock':_0x2109db[_0x0a99('0x72')][_0x0a99('0x73')],'include':[{'model':db[_0x0a99('0x55')],'as':'Contact','attributes':_0x5406a7,'include':[{'model':db[_0x0a99('0x74')],'as':_0x0a99('0x75'),'attributes':['id',_0x0a99('0x12')]}]},{'model':db['CmList'],'as':_0x0a99('0x76'),'attributes':['id','name']},{'model':db[_0x0a99('0x44')],'as':_0x0a99('0x77'),'attributes':['id',_0x0a99('0x12'),_0x0a99('0x78')]}]})['then'](function(_0x3435e3){if(_0x3435e3){return _0x3435e3[_0x0a99('0xd')]({'UserId':_0x528a5d[_0x0a99('0x4d')]['id']},{'transaction':_0x2109db});}});});}})[_0x0a99('0xe')](handleEntityNotFound(_0x53b1f4,null))[_0x0a99('0xe')](respondWithResult(_0x53b1f4,null))[_0x0a99('0x39')](handleError(_0x53b1f4,null));};exports[_0x0a99('0x79')]=function(_0x4c6a12,_0x656dd,_0x31950f){var _0x436163=[];var _0x2bae3d=_0x4c6a12['params']['id'];var _0x1a40e9=_0x4c6a12['user']['id'];return db['CmContact'][_0x0a99('0x3f')]()[_0x0a99('0xe')](function(_0x3bed6e){_0x436163=_[_0x0a99('0x19')](_0x3bed6e);return db[_0x0a99('0x61')][_0x0a99('0x7a')](function(_0x24a389){const _0x353660={'id':_0x2bae3d};return db['CmHopper'][_0x0a99('0x6f')]({'attributes':['id','scheduledat','recallme'],'where':_0x353660,'transaction':_0x24a389,'lock':_0x24a389['LOCK'][_0x0a99('0x73')],'include':[{'model':db[_0x0a99('0x55')],'as':'Contact','attributes':_0x436163,'include':[{'model':db['CmCompany'],'as':_0x0a99('0x75'),'attributes':['id',_0x0a99('0x12')]}]},{'model':db[_0x0a99('0x7b')],'as':_0x0a99('0x76'),'attributes':['id',_0x0a99('0x12')]},{'model':db[_0x0a99('0x44')],'as':_0x0a99('0x77'),'attributes':['id',_0x0a99('0x12'),_0x0a99('0x78')]}]})['then'](function(_0x51627a){if(_0x51627a){return _0x51627a[_0x0a99('0xd')]({'UserId':_0x1a40e9},{'transaction':_0x24a389});}});});})[_0x0a99('0xe')](handleEntityNotFound(_0x656dd,null))[_0x0a99('0xe')](respondWithResult(_0x656dd,null))[_0x0a99('0x39')](handleError(_0x656dd,null));};exports[_0x0a99('0x7c')]=function(_0x22b737,_0x3a6773){return _0x22b737['user']['getVoiceQueues']({'where':{'type':_0x0a99('0x5e'),'dialActive':!![],'dialMethod':_0x0a99('0x5f')},'attributes':['id'],'raw':!![]})['then'](function(_0x587442){if(_0x587442&&_0x587442[_0x0a99('0x2d')]){return db['CmHopper'][_0x0a99('0x36')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0a99('0x62')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x587442,'id')},'$or':[{'UserId':null},{'UserId':_0x22b737[_0x0a99('0x4d')]['id']}]}});}return 0x0;})['then'](function(_0x17436d){if(!_['isNil'](_0x17436d)&&_[_0x0a99('0x7d')](_0x17436d)){return _0x3a6773[_0x0a99('0x7')](0xc8)[_0x0a99('0x8')]({'contacts':_0x17436d});}else{logger[_0x0a99('0x10')](_0x0a99('0x7e'),_0x0a99('0x7c'),0x194,_0x0a99('0x7f'));_0x3a6773[_0x0a99('0xf')](0x194);}})[_0x0a99('0x39')](handleError(_0x3a6773,null));};exports[_0x0a99('0x80')]=function(_0x2d3efa,_0xe18018){var _0x51df2a=shared[_0x0a99('0x81')];var _0x2f4d34=[];_[_0x0a99('0x14')](_0x51df2a,function(_0x25c31b){_0x2f4d34[_0x0a99('0x82')]({'id':_0x25c31b[_0x0a99('0x12')],'name':_0x25c31b[_0x0a99('0x12')],'utcOffset':_0x25c31b[_0x0a99('0x83')]});});return _0xe18018[_0x0a99('0x7')](0xc8)[_0x0a99('0x8')]({'tz':_0x2f4d34});};exports['getTimezone']=function(_0x5607f1,_0x505a2c){var _0x59228e=shared[_0x0a99('0x81')];var _0x38932f={};if(!_[_0x0a99('0x59')](_0x59228e[_0x5607f1[_0x0a99('0x3d')]['id']]))_0x38932f=_0x59228e[_0x5607f1[_0x0a99('0x3d')]['id']];return _0x505a2c[_0x0a99('0x7')](0xc8)[_0x0a99('0x8')](_0x38932f);};
\ No newline at end of file
index 258b0a4..2b45071 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['define','CmHopper','cm_hopper','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./cmHopper.attributes','exports'];(function(_0x402573,_0x4e6cb4){var _0x51c787=function(_0x24dbb9){while(--_0x24dbb9){_0x402573['push'](_0x402573['shift']());}};_0x51c787(++_0x4e6cb4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xc4aa[_0x346737];return _0x1ade2e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':['scheduledat']},{'name':_0xac4a('0xc'),'fields':[_0xac4a('0xc')]},{'name':_0xac4a('0xd'),'fields':['priority']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x53ec=['moment','bluebird','path','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone','priority','lodash','util','../../config/logger','api'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x53ec,0x192));var _0xc53e=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0x53ec[_0x39bc06];return _0x131143;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]},{'name':_0xc53e('0xc'),'fields':[_0xc53e('0xc')]},{'name':_0xc53e('0xd'),'fields':[_0xc53e('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index b197245..da1a8cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5862=['DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','literal','lodash','bluebird','../../mysqldb','GetCmHopper','findAll','options','attributes','limit','include','map','model','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','raw','where','then','info','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','CmContact','describe','sequelize','transaction','order','LOCK','UPDATE','Contact','keys','User','Agent','name','voicePause','length','UserId','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','destroy','MoveContactManagedDialer','CountReScheduled','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','all','GetContactByPhone','findOne','dialTimezone'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5862,0x137));var _0x2586=function(_0x50ef88,_0x5a1ecc){_0x50ef88=_0x50ef88-0x0;var _0x4ef9a1=_0x5862[_0x50ef88];return _0x4ef9a1;};'use strict';var _=require(_0x2586('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2586('0x1'));var db=require(_0x2586('0x2'))['db'];var logger=require('../../config/logger')('rpc');exports[_0x2586('0x3')]=function(_0x645fb4){var _0x198c27=this;return new Promise(function(_0x5e35e6,_0x3751ff){return db['CmHopper'][_0x2586('0x4')]({'raw':_0x645fb4['options']?_0x645fb4[_0x2586('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x645fb4[_0x2586('0x5')]?_0x645fb4[_0x2586('0x5')]['where']||null:null,'attributes':_0x645fb4[_0x2586('0x5')]?_0x645fb4[_0x2586('0x5')][_0x2586('0x6')]||null:null,'limit':_0x645fb4[_0x2586('0x5')]?_0x645fb4[_0x2586('0x5')][_0x2586('0x7')]||null:null,'include':_0x645fb4[_0x2586('0x5')]?_0x645fb4[_0x2586('0x5')][_0x2586('0x8')]?_[_0x2586('0x9')](_0x645fb4[_0x2586('0x5')][_0x2586('0x8')],function(_0x492df4){return{'model':db[_0x492df4['model']],'as':_0x492df4['as'],'attributes':_0x492df4[_0x2586('0x6')],'include':_0x492df4[_0x2586('0x8')]?_[_0x2586('0x9')](_0x492df4['include'],function(_0x5c7e29){return{'model':db[_0x5c7e29[_0x2586('0xa')]],'as':_0x5c7e29['as'],'attributes':_0x5c7e29[_0x2586('0x6')],'include':_0x5c7e29[_0x2586('0x8')]?_[_0x2586('0x9')](_0x5c7e29[_0x2586('0x8')],function(_0xc5e527){return{'model':db[_0xc5e527[_0x2586('0xa')]],'as':_0xc5e527['as'],'attributes':_0xc5e527[_0x2586('0x6')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x265133){logger['info'](_0x2586('0x3'),_0x645fb4);logger[_0x2586('0xb')](_0x2586('0x3'),_0x645fb4,JSON[_0x2586('0xc')](_0x265133));_0x5e35e6(_0x265133);})[_0x2586('0xd')](function(_0xb0a4fc){logger[_0x2586('0xe')](_0x2586('0x3'),_0xb0a4fc[_0x2586('0xf')],_0x645fb4);_0x3751ff(_0x198c27[_0x2586('0xe')](0x1f4,_0xb0a4fc[_0x2586('0xf')]));});});};exports[_0x2586('0x10')]=function(_0x52b381){var _0x324950=this;return new Promise(function(_0x32b808,_0x5d84f7){return db[_0x2586('0x11')][_0x2586('0x12')]({'raw':_0x52b381[_0x2586('0x5')]?_0x52b381[_0x2586('0x5')][_0x2586('0x13')]===undefined?!![]:![]:!![],'where':_0x52b381[_0x2586('0x5')]?_0x52b381[_0x2586('0x5')][_0x2586('0x14')]||null:null,'attributes':_0x52b381['options']?_0x52b381['options'][_0x2586('0x6')]||null:null,'include':_0x52b381[_0x2586('0x5')]?_0x52b381[_0x2586('0x5')][_0x2586('0x8')]?_['map'](_0x52b381['options']['include'],function(_0x489d51){return{'model':db[_0x489d51[_0x2586('0xa')]],'as':_0x489d51['as'],'attributes':_0x489d51[_0x2586('0x6')],'include':_0x489d51['include']?_[_0x2586('0x9')](_0x489d51[_0x2586('0x8')],function(_0x31af11){return{'model':db[_0x31af11[_0x2586('0xa')]],'as':_0x31af11['as'],'attributes':_0x31af11[_0x2586('0x6')],'include':_0x31af11[_0x2586('0x8')]?_[_0x2586('0x9')](_0x31af11[_0x2586('0x8')],function(_0x16a0cb){return{'model':db[_0x16a0cb[_0x2586('0xa')]],'as':_0x16a0cb['as'],'attributes':_0x16a0cb[_0x2586('0x6')]};}):[]};}):[]};}):[]:[]})[_0x2586('0x15')](function(_0x51de77){logger[_0x2586('0x16')]('ShowCmHopper',_0x52b381);logger[_0x2586('0xb')](_0x2586('0x10'),_0x52b381,JSON[_0x2586('0xc')](_0x51de77));_0x32b808(_0x51de77);})['catch'](function(_0x28b80c){logger[_0x2586('0xe')](_0x2586('0x10'),_0x28b80c[_0x2586('0xf')],_0x52b381);_0x5d84f7(_0x324950[_0x2586('0xe')](0x1f4,_0x28b80c['message']));});});};exports[_0x2586('0x17')]=function(_0x3bb52f){var _0x567d96=this;return new Promise(function(_0x16958c,_0x1d331f){return db['CmHopper'][_0x2586('0x18')](_0x3bb52f[_0x2586('0x19')],{'raw':_0x3bb52f['options']?_0x3bb52f['options'][_0x2586('0x13')]===undefined?!![]:![]:!![]})[_0x2586('0x15')](function(_0xaefe43){logger['info']('CreateCmHopper',_0x3bb52f);logger[_0x2586('0xb')]('CreateCmHopper',_0x3bb52f,JSON['stringify'](_0xaefe43));_0x16958c(_0xaefe43);})[_0x2586('0xd')](function(_0x5d7137){logger[_0x2586('0xe')]('CreateCmHopper',_0x5d7137[_0x2586('0xf')],_0x3bb52f);_0x1d331f(_0x567d96[_0x2586('0xe')](0x1f4,_0x5d7137[_0x2586('0xf')]));});});};exports[_0x2586('0x1a')]=function(_0x2a8fc6){var _0x3eeb44=this;return new Promise(function(_0x21297f,_0x58c538){return db[_0x2586('0x11')][_0x2586('0x1b')](_0x2a8fc6[_0x2586('0x19')],{'raw':_0x2a8fc6['options']?_0x2a8fc6[_0x2586('0x5')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a8fc6['options']?_0x2a8fc6[_0x2586('0x5')]['where']||null:null,'attributes':_0x2a8fc6['options']?_0x2a8fc6['options'][_0x2586('0x6')]||null:null,'limit':_0x2a8fc6[_0x2586('0x5')]?_0x2a8fc6[_0x2586('0x5')][_0x2586('0x7')]||null:null})[_0x2586('0x15')](function(_0x384c45){logger[_0x2586('0x16')](_0x2586('0x1a'),_0x2a8fc6);logger['info'](_0x2586('0x1c'),JSON[_0x2586('0xc')](_0x2a8fc6[_0x2586('0x5')][_0x2586('0x14')]),_0x2a8fc6['body'][_0x2586('0x1d')]);logger[_0x2586('0xb')](_0x2586('0x1a'),_0x2a8fc6,JSON[_0x2586('0xc')](_0x384c45));_0x21297f(_0x384c45);})[_0x2586('0xd')](function(_0x4d6d92){logger[_0x2586('0xe')](_0x2586('0x1a'),_0x4d6d92[_0x2586('0xf')],_0x2a8fc6);_0x58c538(_0x3eeb44['error'](0x1f4,_0x4d6d92[_0x2586('0xf')]));});});};exports[_0x2586('0x1e')]=function(_0x145259){var _0x3a1bc3=this;return new Promise(function(_0x1ba4bd,_0x2ba0c5){return db[_0x2586('0x11')]['destroy']({'where':_0x145259[_0x2586('0x5')]?_0x145259[_0x2586('0x5')]['where']||null:null})[_0x2586('0x15')](function(_0x37767f){logger[_0x2586('0x16')](_0x2586('0x1e'),_0x145259);logger[_0x2586('0xb')]('DestroyCmHopper',_0x145259,JSON[_0x2586('0xc')](_0x37767f));_0x1ba4bd(_0x37767f);})['catch'](function(_0xe347b5){logger[_0x2586('0xe')](_0x2586('0x1e'),_0xe347b5['message'],_0x145259);_0x2ba0c5(_0x3a1bc3[_0x2586('0xe')](0x1f4,_0xe347b5[_0x2586('0xf')]));});});};exports[_0x2586('0x1f')]=function(_0x321233){var _0x323a15=this;return new Promise(function(_0x4a5e66,_0xc4ebf2){return db[_0x2586('0x20')][_0x2586('0x21')]()[_0x2586('0x15')](function(_0x2920f9){return db[_0x2586('0x22')][_0x2586('0x23')](function(_0xd2e733){return db[_0x2586('0x11')][_0x2586('0x4')]({'where':_0x321233[_0x2586('0x5')]?_0x321233['options'][_0x2586('0x14')]||null:null,'attributes':_0x321233[_0x2586('0x5')]?_0x321233[_0x2586('0x5')]['attributes']||null:null,'limit':_0x321233[_0x2586('0x5')]?_0x321233[_0x2586('0x5')]['limit']||null:null,'order':_0x321233[_0x2586('0x5')]?_0x321233['options'][_0x2586('0x24')]||null:null,'transaction':_0xd2e733,'lock':_0xd2e733[_0x2586('0x25')][_0x2586('0x26')],'include':[{'model':db[_0x2586('0x20')],'as':_0x2586('0x27'),'attributes':_[_0x2586('0x28')](_0x2920f9)},{'model':db[_0x2586('0x29')],'as':_0x2586('0x2a'),'attributes':['id',_0x2586('0x2b'),_0x2586('0x2c')]}]})[_0x2586('0x15')](function(_0x42a53b){var _0x149146=[];var _0x20be78=[];for(var _0x59b9df=0x0;_0x59b9df<_0x42a53b[_0x2586('0x2d')];_0x59b9df+=0x1){var _0x22cdcb=_0x42a53b[_0x59b9df][_0x2586('0x2e')];if(_0x22cdcb===null){_0x149146[_0x2586('0x2f')](_0x42a53b[_0x59b9df][_0x2586('0x1b')](_0x321233[_0x2586('0x19')],{'transaction':_0xd2e733}));}else if(!_0x20be78['includes'](_0x22cdcb)){_0x20be78['push'](_0x22cdcb);_0x149146[_0x2586('0x2f')](_0x42a53b[_0x59b9df][_0x2586('0x1b')](_0x321233[_0x2586('0x19')],{'transaction':_0xd2e733}));}}return BPromise['all'](_0x149146);});})[_0x2586('0x15')](function(_0x128353){logger[_0x2586('0x16')](_0x2586('0x1f'),_0x321233);if(_0x128353[_0x2586('0x2d')]>0x0){logger[_0x2586('0x16')](_0x2586('0x30'),_0x128353[0x0][_0x2586('0x31')]['id'],_0x128353[0x0][_0x2586('0x31')][_0x2586('0x32')],_0x128353[0x0][_0x2586('0x31')][_0x2586('0x1d')]);}logger[_0x2586('0xb')](_0x2586('0x1f'),_0x321233,JSON[_0x2586('0xc')](_0x128353));_0x4a5e66(_0x128353);})[_0x2586('0xd')](function(_0x3ce789){logger[_0x2586('0xe')](_0x2586('0x1f'),_0x3ce789[_0x2586('0xf')],_0x321233);_0xc4ebf2(_0x323a15['error'](0x1f4,_0x3ce789[_0x2586('0xf')]));});});});};exports['MoveContactManagedDialer']=function(_0x4de5ce){var _0x542fab=this;return new Promise(function(_0x2e2f8e,_0x55b023){return db[_0x2586('0x22')][_0x2586('0x23')](function(_0x3aab89){return db[_0x2586('0x33')][_0x2586('0x18')](_0x4de5ce[_0x2586('0x19')],{'raw':_0x4de5ce[_0x2586('0x5')]?_0x4de5ce[_0x2586('0x5')][_0x2586('0x13')]===undefined?!![]:![]:!![],'transaction':_0x3aab89})[_0x2586('0x15')](function(){logger[_0x2586('0x16')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x4de5ce[_0x2586('0x5')][_0x2586('0x14')]),_0x4de5ce[_0x2586('0x5')][_0x2586('0x14')][_0x2586('0x1d')]);return db[_0x2586('0x11')][_0x2586('0x34')]({'where':_0x4de5ce[_0x2586('0x5')]?_0x4de5ce[_0x2586('0x5')][_0x2586('0x14')]||null:null,'transaction':_0x3aab89});});})[_0x2586('0x15')](function(_0x30484e){logger[_0x2586('0x16')](_0x2586('0x35'),_0x4de5ce);logger[_0x2586('0xb')](_0x2586('0x35'),_0x4de5ce,JSON['stringify'](_0x30484e));_0x2e2f8e(_0x30484e);})[_0x2586('0xd')](function(_0x438720){logger[_0x2586('0xe')](_0x2586('0x35'),_0x438720[_0x2586('0xf')],_0x4de5ce);_0x55b023(_0x542fab['error'](0x1f4,_0x438720[_0x2586('0xf')]));});});};exports[_0x2586('0x36')]=function(_0x4fefa7){var _0x165403=this;return new Promise(function(_0x52b3e0,_0xbed27e){return db[_0x2586('0x11')][_0x2586('0x4')]({'raw':_0x4fefa7['options']?_0x4fefa7[_0x2586('0x5')][_0x2586('0x13')]===undefined?!![]:![]:!![],'where':_0x4fefa7[_0x2586('0x5')]?_0x4fefa7[_0x2586('0x5')]['where']||null:null,'attributes':[[db[_0x2586('0x22')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x2586('0x22')]['literal'](_0x2586('0x37')+util[_0x2586('0x38')]('\x22%s\x22',moment()[_0x2586('0x38')](_0x2586('0x39')))+'\x20,\x201,\x20null'))),_0x2586('0x3a')]]})[_0x2586('0x15')](function(_0x310a42){logger[_0x2586('0x16')](_0x2586('0x36'),_0x4fefa7);logger[_0x2586('0xb')](_0x2586('0x36'),_0x4fefa7,JSON[_0x2586('0xc')](_0x310a42));_0x52b3e0(_0x310a42);})[_0x2586('0xd')](function(_0x1eb14e){logger[_0x2586('0xe')](_0x2586('0x36'),_0x1eb14e[_0x2586('0xf')],_0x4fefa7);_0xbed27e(_0x165403['error'](0x1f4,_0x1eb14e['message']));});});};exports[_0x2586('0x3b')]=function(_0x199095){var _0x24a641=this;return new Promise(function(_0x8a860b,_0x3ada94){return db[_0x2586('0x20')][_0x2586('0x21')]()[_0x2586('0x15')](function(){return db[_0x2586('0x22')][_0x2586('0x23')](function(_0x168bba){return db[_0x2586('0x11')]['findAll']({'where':_0x199095[_0x2586('0x5')]?_0x199095['options'][_0x2586('0x14')]||null:null,'attributes':_0x199095[_0x2586('0x5')]?_0x199095[_0x2586('0x5')][_0x2586('0x6')]||null:null,'limit':0x1,'order':_0x199095[_0x2586('0x5')]?_0x199095[_0x2586('0x5')]['order']||null:null,'group':db[_0x2586('0x11')][_0x2586('0x2e')],'transaction':_0x168bba,'lock':_0x168bba[_0x2586('0x25')][_0x2586('0x26')],'include':_0x199095[_0x2586('0x5')]?_0x199095[_0x2586('0x5')][_0x2586('0x8')]?_[_0x2586('0x9')](_0x199095[_0x2586('0x5')][_0x2586('0x8')],function(_0x49bee5){return{'model':db[_0x49bee5[_0x2586('0xa')]],'as':_0x49bee5['as'],'attributes':_0x49bee5[_0x2586('0x6')],'include':_0x49bee5[_0x2586('0x8')]?_[_0x2586('0x9')](_0x49bee5['include'],function(_0x255582){return{'model':db[_0x255582[_0x2586('0xa')]],'as':_0x255582['as'],'attributes':_0x255582[_0x2586('0x6')],'include':_0x255582[_0x2586('0x8')]?_[_0x2586('0x9')](_0x255582[_0x2586('0x8')],function(_0x2c40ba){return{'model':db[_0x2c40ba['model']],'as':_0x2c40ba['as'],'attributes':_0x2c40ba[_0x2586('0x6')]};}):[]};}):[]};}):[]:[]})[_0x2586('0x15')](function(_0x24364b){var _0x588141=[];for(var _0x2536c7=0x0;_0x2536c7<_0x24364b[_0x2586('0x2d')];_0x2536c7+=0x1){_0x588141[_0x2586('0x2f')](_0x24364b[_0x2536c7]['update'](_0x199095[_0x2586('0x19')],{'transaction':_0x168bba}));}return BPromise[_0x2586('0x3c')](_0x588141);});})[_0x2586('0x15')](function(_0x2ce61c){logger[_0x2586('0x16')]('GetContactRecallMe',_0x199095);logger[_0x2586('0xb')](_0x2586('0x3b'),_0x199095,JSON[_0x2586('0xc')](_0x2ce61c));_0x8a860b(_0x2ce61c);})[_0x2586('0xd')](function(_0x1c2fa2){logger[_0x2586('0xe')](_0x2586('0x3b'),_0x1c2fa2[_0x2586('0xf')],_0x199095);_0x3ada94(_0x24a641[_0x2586('0xe')](0x1f4,_0x1c2fa2[_0x2586('0xf')]));});});});};exports['GetCmHopperPreview']=function(_0x3da9d0){var _0x42d5f2=this;return new Promise(function(_0x5a3757,_0x5f585c){db[_0x2586('0x20')][_0x2586('0x21')]()[_0x2586('0x15')](function(_0xd11af5){return db['CmHopper']['findAll']({'raw':_0x3da9d0['options']?_0x3da9d0[_0x2586('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x3da9d0[_0x2586('0x5')]?_0x3da9d0[_0x2586('0x5')]['where']||null:null,'attributes':_0x3da9d0[_0x2586('0x5')]?_0x3da9d0[_0x2586('0x5')][_0x2586('0x6')]||null:null,'limit':_0x3da9d0['options']?_0x3da9d0[_0x2586('0x5')][_0x2586('0x7')]||null:null,'include':_0x3da9d0[_0x2586('0x5')]?_0x3da9d0[_0x2586('0x5')][_0x2586('0x8')]?_[_0x2586('0x9')](_0x3da9d0['options'][_0x2586('0x8')],function(_0xa56c7b){return{'model':db[_0xa56c7b['model']],'as':_0xa56c7b['as'],'attributes':_0xa56c7b['as']==='Contact'?_[_0x2586('0x28')](_0xd11af5):_0xa56c7b[_0x2586('0x6')],'include':_0xa56c7b[_0x2586('0x8')]?_[_0x2586('0x9')](_0xa56c7b[_0x2586('0x8')],function(_0x19994e){return{'model':db[_0x19994e[_0x2586('0xa')]],'as':_0x19994e['as'],'attributes':_0x19994e[_0x2586('0x6')],'include':_0x19994e[_0x2586('0x8')]?_['map'](_0x19994e[_0x2586('0x8')],function(_0x2fc91a){return{'model':db[_0x2fc91a[_0x2586('0xa')]],'as':_0x2fc91a['as'],'attributes':_0x2fc91a[_0x2586('0x6')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a89e9){logger[_0x2586('0x16')]('GetCmHopper',_0x3da9d0);logger['debug'](_0x2586('0x3'),_0x3da9d0,JSON[_0x2586('0xc')](_0x4a89e9));_0x5a3757(_0x4a89e9);})[_0x2586('0xd')](function(_0x120485){logger[_0x2586('0xe')](_0x2586('0x3'),_0x120485[_0x2586('0xf')],_0x3da9d0);_0x5f585c(_0x42d5f2[_0x2586('0xe')](0x1f4,_0x120485[_0x2586('0xf')]));});});});};exports[_0x2586('0x3d')]=function(_0x4bcc4a){var _0x4ee766=this;return new Promise(function(_0x4f6a04,_0x348eab){return db[_0x2586('0x20')][_0x2586('0x3e')]({'raw':!![],'where':{'phone':_0x4bcc4a[_0x2586('0x5')][_0x2586('0x14')]['phone']},'attributes':['id',_0x2586('0x3f')],'order':[['id',_0x2586('0x40')]]})[_0x2586('0x15')](function(_0x41c99e){logger[_0x2586('0x16')](_0x2586('0x41'),_0x4bcc4a);logger[_0x2586('0xb')]('getContactByPhone',_0x4bcc4a,JSON[_0x2586('0xc')](_0x41c99e));_0x4f6a04(_0x41c99e);})['catch'](function(_0x15eae5){logger[_0x2586('0xe')]('getContactByPhone',_0x15eae5[_0x2586('0xf')],_0x4bcc4a);_0x348eab(_0x4ee766['error'](0x1f4,_0x15eae5[_0x2586('0xf')]));});});};exports[_0x2586('0x42')]=function(_0xf88f7b){var _0x41f28b=this;return new Promise(function(_0x4fb12f,_0x1a2f35){return db['sequelize'][_0x2586('0x23')](function(_0x5bab95){var _0x3b8976=_0xf88f7b[_0x2586('0x5')]&&_0xf88f7b[_0x2586('0x5')][_0x2586('0x14')]?_0xf88f7b[_0x2586('0x5')][_0x2586('0x14')]:{};return db[_0x2586('0x11')]['update'](_0xf88f7b['body'],{'where':_0x3b8976,'transaction':_0x5bab95})['then'](function(_0x595643){logger['info']('ResetActiveCalls',_0xf88f7b);logger[_0x2586('0xb')](_0x2586('0x42'),_0xf88f7b,JSON[_0x2586('0xc')](_0x595643));_0x4fb12f(_0x595643);})['catch'](function(_0x4475e8){logger[_0x2586('0xe')]('ResetActiveCalls',_0x4475e8['message'],_0xf88f7b);_0x1a2f35(_0x41f28b['error'](0x1f4,_0x4475e8[_0x2586('0xf')]));});});});};exports[_0x2586('0x43')]=function(_0x413eee){var _0x3445e0=this;var _0x394593=_0x413eee[_0x2586('0x19')][_0x2586('0x14')]['voiceQueueIds'];var _0x179012=_0x413eee['body']['where']['interval'];var _0x59e5c2=_0x413eee[_0x2586('0x19')][_0x2586('0x14')][_0x2586('0x44')];return new Promise(function(_0x5d2fac,_0x335222){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x394593},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x2586('0x45')+_0x179012+_0x2586('0x46')),'$gt':db[_0x2586('0x22')]['literal'](_0x2586('0x47'))}},'UserId':{'$in':_0x59e5c2}},'include':[{'model':db[_0x2586('0x20')],'as':_0x2586('0x27')},{'model':db[_0x2586('0x29')],'as':'Agent','attributes':['id',_0x2586('0x2b'),_0x2586('0x2c')]},{'model':db[_0x2586('0x48')],'as':_0x2586('0x49')}]})[_0x2586('0x15')](function(_0x1ab58d){if(_0x1ab58d[_0x2586('0x2d')]>0x0){return db[_0x2586('0x22')][_0x2586('0x23')](function(_0x430d1f){return db[_0x2586('0x11')]['update']({'recallmeNotifiedDate':db[_0x2586('0x22')][_0x2586('0x4a')](_0x2586('0x47'))},{'where':{'id':{'$in':_['map'](_0x1ab58d,'id')}},'transaction':_0x430d1f})[_0x2586('0x15')](function(){_0x5d2fac(_0x1ab58d);})[_0x2586('0xd')](function(_0x433d51){logger[_0x2586('0xe')]('CmHopperHandlePreviewRecallNotifications',_0x433d51[_0x2586('0xf')],_0x413eee);_0x335222(_0x3445e0[_0x2586('0xe')](0x1f4,_0x433d51[_0x2586('0xf')]));});})['catch'](function(_0x489b28){logger['error'](_0x2586('0x43'),_0x489b28[_0x2586('0xf')],_0x413eee);_0x335222(_0x3445e0['error'](0x1f4,_0x489b28[_0x2586('0xf')]));});}else{_0x5d2fac(_0x1ab58d);}});});};
\ No newline at end of file
+var _0x7522=['map','model','then','info','debug','catch','error','message','ShowCmHopper','find','stringify','CreateCmHopper','create','UpdateCmHopper','update','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CmContact','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','UserId','push','body','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','destroy','sequelize','COUNT','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','CountReScheduled','all','GetContactRecallMe','describe','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','CmList','List','lodash','util','moment','../../mysqldb','../../config/logger','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','include'];(function(_0x7cad4,_0x50a25e){var _0xcbbca0=function(_0x42bcae){while(--_0x42bcae){_0x7cad4['push'](_0x7cad4['shift']());}};_0xcbbca0(++_0x50a25e);}(_0x7522,0xe3));var _0x2752=function(_0x38cb8d,_0x3ecb57){_0x38cb8d=_0x38cb8d-0x0;var _0x51c2c1=_0x7522[_0x38cb8d];return _0x51c2c1;};'use strict';var _=require(_0x2752('0x0'));var util=require(_0x2752('0x1'));var moment=require(_0x2752('0x2'));var BPromise=require('bluebird');var db=require(_0x2752('0x3'))['db'];var logger=require(_0x2752('0x4'))('rpc');exports[_0x2752('0x5')]=function(_0x39f21b){var _0x2c3d9d=this;return new Promise(function(_0x1b3f32,_0x48c2be){return db[_0x2752('0x6')][_0x2752('0x7')]({'raw':_0x39f21b['options']?_0x39f21b[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'where':_0x39f21b[_0x2752('0x8')]?_0x39f21b['options'][_0x2752('0xa')]||null:null,'attributes':_0x39f21b[_0x2752('0x8')]?_0x39f21b[_0x2752('0x8')][_0x2752('0xb')]||null:null,'limit':_0x39f21b['options']?_0x39f21b[_0x2752('0x8')]['limit']||null:null,'include':_0x39f21b[_0x2752('0x8')]?_0x39f21b[_0x2752('0x8')][_0x2752('0xc')]?_[_0x2752('0xd')](_0x39f21b[_0x2752('0x8')][_0x2752('0xc')],function(_0x13dea8){return{'model':db[_0x13dea8[_0x2752('0xe')]],'as':_0x13dea8['as'],'attributes':_0x13dea8['attributes'],'include':_0x13dea8[_0x2752('0xc')]?_[_0x2752('0xd')](_0x13dea8[_0x2752('0xc')],function(_0x4a9604){return{'model':db[_0x4a9604[_0x2752('0xe')]],'as':_0x4a9604['as'],'attributes':_0x4a9604['attributes'],'include':_0x4a9604[_0x2752('0xc')]?_['map'](_0x4a9604[_0x2752('0xc')],function(_0x1f9099){return{'model':db[_0x1f9099['model']],'as':_0x1f9099['as'],'attributes':_0x1f9099['attributes']};}):[]};}):[]};}):[]:[]})[_0x2752('0xf')](function(_0x16551e){logger[_0x2752('0x10')](_0x2752('0x5'),_0x39f21b);logger[_0x2752('0x11')](_0x2752('0x5'),_0x39f21b,JSON['stringify'](_0x16551e));_0x1b3f32(_0x16551e);})[_0x2752('0x12')](function(_0xd9450c){logger[_0x2752('0x13')](_0x2752('0x5'),_0xd9450c[_0x2752('0x14')],_0x39f21b);_0x48c2be(_0x2c3d9d[_0x2752('0x13')](0x1f4,_0xd9450c['message']));});});};exports[_0x2752('0x15')]=function(_0xf858e6){var _0x32265b=this;return new Promise(function(_0x13d7b4,_0x4c786e){return db[_0x2752('0x6')][_0x2752('0x16')]({'raw':_0xf858e6['options']?_0xf858e6['options'][_0x2752('0x9')]===undefined?!![]:![]:!![],'where':_0xf858e6[_0x2752('0x8')]?_0xf858e6[_0x2752('0x8')][_0x2752('0xa')]||null:null,'attributes':_0xf858e6[_0x2752('0x8')]?_0xf858e6[_0x2752('0x8')][_0x2752('0xb')]||null:null,'include':_0xf858e6[_0x2752('0x8')]?_0xf858e6[_0x2752('0x8')][_0x2752('0xc')]?_[_0x2752('0xd')](_0xf858e6[_0x2752('0x8')][_0x2752('0xc')],function(_0x53768f){return{'model':db[_0x53768f['model']],'as':_0x53768f['as'],'attributes':_0x53768f[_0x2752('0xb')],'include':_0x53768f[_0x2752('0xc')]?_[_0x2752('0xd')](_0x53768f[_0x2752('0xc')],function(_0x1dc9bf){return{'model':db[_0x1dc9bf['model']],'as':_0x1dc9bf['as'],'attributes':_0x1dc9bf['attributes'],'include':_0x1dc9bf['include']?_[_0x2752('0xd')](_0x1dc9bf[_0x2752('0xc')],function(_0x3f8066){return{'model':db[_0x3f8066[_0x2752('0xe')]],'as':_0x3f8066['as'],'attributes':_0x3f8066[_0x2752('0xb')]};}):[]};}):[]};}):[]:[]})[_0x2752('0xf')](function(_0x4c2a63){logger['info']('ShowCmHopper',_0xf858e6);logger[_0x2752('0x11')](_0x2752('0x15'),_0xf858e6,JSON[_0x2752('0x17')](_0x4c2a63));_0x13d7b4(_0x4c2a63);})[_0x2752('0x12')](function(_0x4796cd){logger[_0x2752('0x13')](_0x2752('0x15'),_0x4796cd[_0x2752('0x14')],_0xf858e6);_0x4c786e(_0x32265b[_0x2752('0x13')](0x1f4,_0x4796cd[_0x2752('0x14')]));});});};exports[_0x2752('0x18')]=function(_0x46fcb6){var _0x5e2f84=this;return new Promise(function(_0x2fda4b,_0x495fca){return db['CmHopper'][_0x2752('0x19')](_0x46fcb6['body'],{'raw':_0x46fcb6[_0x2752('0x8')]?_0x46fcb6[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![]})[_0x2752('0xf')](function(_0x4d3cea){logger[_0x2752('0x10')](_0x2752('0x18'),_0x46fcb6);logger[_0x2752('0x11')]('CreateCmHopper',_0x46fcb6,JSON[_0x2752('0x17')](_0x4d3cea));_0x2fda4b(_0x4d3cea);})[_0x2752('0x12')](function(_0x2c7759){logger[_0x2752('0x13')](_0x2752('0x18'),_0x2c7759[_0x2752('0x14')],_0x46fcb6);_0x495fca(_0x5e2f84[_0x2752('0x13')](0x1f4,_0x2c7759[_0x2752('0x14')]));});});};exports[_0x2752('0x1a')]=function(_0xec59b8){var _0x39424b=this;return new Promise(function(_0x141944,_0x33f22e){return db['CmHopper'][_0x2752('0x1b')](_0xec59b8['body'],{'raw':_0xec59b8[_0x2752('0x8')]?_0xec59b8[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xec59b8[_0x2752('0x8')]?_0xec59b8[_0x2752('0x8')]['where']||null:null,'attributes':_0xec59b8['options']?_0xec59b8[_0x2752('0x8')][_0x2752('0xb')]||null:null,'limit':_0xec59b8[_0x2752('0x8')]?_0xec59b8[_0x2752('0x8')][_0x2752('0x1c')]||null:null})['then'](function(_0x532bd9){logger['info'](_0x2752('0x1a'),_0xec59b8);logger['info'](_0x2752('0x1d'),JSON[_0x2752('0x17')](_0xec59b8[_0x2752('0x8')][_0x2752('0xa')]),_0xec59b8['body']['active']);logger['debug']('UpdateCmHopper',_0xec59b8,JSON[_0x2752('0x17')](_0x532bd9));_0x141944(_0x532bd9);})[_0x2752('0x12')](function(_0x50adbb){logger[_0x2752('0x13')](_0x2752('0x1a'),_0x50adbb[_0x2752('0x14')],_0xec59b8);_0x33f22e(_0x39424b[_0x2752('0x13')](0x1f4,_0x50adbb[_0x2752('0x14')]));});});};exports['DestroyCmHopper']=function(_0x2151c0){var _0x3e9d05=this;return new Promise(function(_0x4e9552,_0x5a7d36){return db[_0x2752('0x6')]['destroy']({'where':_0x2151c0[_0x2752('0x8')]?_0x2151c0[_0x2752('0x8')][_0x2752('0xa')]||null:null})[_0x2752('0xf')](function(_0x56c8fc){logger[_0x2752('0x10')]('DestroyCmHopper',_0x2151c0);logger['debug']('DestroyCmHopper',_0x2151c0,JSON['stringify'](_0x56c8fc));_0x4e9552(_0x56c8fc);})[_0x2752('0x12')](function(_0x20b16f){logger[_0x2752('0x13')]('DestroyCmHopper',_0x20b16f['message'],_0x2151c0);_0x5a7d36(_0x3e9d05[_0x2752('0x13')](0x1f4,_0x20b16f['message']));});});};exports['GetContactDialer']=function(_0x308981){var _0x481ee8=this;return new Promise(function(_0x386c23,_0x2b3c31){return db[_0x2752('0x1e')]['describe']()[_0x2752('0xf')](function(_0x37eb10){return db['sequelize'][_0x2752('0x1f')](function(_0x185588){return db[_0x2752('0x6')]['findAll']({'where':_0x308981[_0x2752('0x8')]?_0x308981[_0x2752('0x8')][_0x2752('0xa')]||null:null,'attributes':_0x308981[_0x2752('0x8')]?_0x308981[_0x2752('0x8')]['attributes']||null:null,'limit':_0x308981[_0x2752('0x8')]?_0x308981[_0x2752('0x8')]['limit']||null:null,'order':_0x308981[_0x2752('0x8')]?_0x308981[_0x2752('0x8')][_0x2752('0x20')]||null:null,'transaction':_0x185588,'lock':_0x185588[_0x2752('0x21')][_0x2752('0x22')],'include':[{'model':db[_0x2752('0x1e')],'as':_0x2752('0x23'),'attributes':_['keys'](_0x37eb10)},{'model':db[_0x2752('0x24')],'as':_0x2752('0x25'),'attributes':['id',_0x2752('0x26'),_0x2752('0x27')]}]})[_0x2752('0xf')](function(_0x2673ce){var _0x318f11=[];var _0x4a2e6e=[];for(var _0xbb9bae=0x0;_0xbb9bae<_0x2673ce[_0x2752('0x28')];_0xbb9bae+=0x1){var _0x20007d=_0x2673ce[_0xbb9bae][_0x2752('0x29')];if(_0x20007d===null){_0x318f11[_0x2752('0x2a')](_0x2673ce[_0xbb9bae][_0x2752('0x1b')](_0x308981[_0x2752('0x2b')],{'transaction':_0x185588}));}else if(!_0x4a2e6e[_0x2752('0x2c')](_0x20007d)){_0x4a2e6e[_0x2752('0x2a')](_0x20007d);_0x318f11['push'](_0x2673ce[_0xbb9bae]['update'](_0x308981[_0x2752('0x2b')],{'transaction':_0x185588}));}}return BPromise['all'](_0x318f11);});})[_0x2752('0xf')](function(_0x50e9d4){logger[_0x2752('0x10')]('GetContactDialer',_0x308981);if(_0x50e9d4[_0x2752('0x28')]>0x0){logger['info'](_0x2752('0x2d'),_0x50e9d4[0x0]['dataValues']['id'],_0x50e9d4[0x0][_0x2752('0x2e')][_0x2752('0x2f')],_0x50e9d4[0x0][_0x2752('0x2e')]['active']);}logger['debug'](_0x2752('0x30'),_0x308981,JSON['stringify'](_0x50e9d4));_0x386c23(_0x50e9d4);})[_0x2752('0x12')](function(_0x6328a8){logger['error'](_0x2752('0x30'),_0x6328a8[_0x2752('0x14')],_0x308981);_0x2b3c31(_0x481ee8[_0x2752('0x13')](0x1f4,_0x6328a8[_0x2752('0x14')]));});});});};exports[_0x2752('0x31')]=function(_0x390bc6){var _0x468acd=this;return new Promise(function(_0x67cda9,_0x5149dc){return db['sequelize'][_0x2752('0x1f')](function(_0x16045a){return db[_0x2752('0x32')][_0x2752('0x19')](_0x390bc6[_0x2752('0x2b')],{'raw':_0x390bc6['options']?_0x390bc6[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'transaction':_0x16045a})[_0x2752('0xf')](function(){logger[_0x2752('0x10')](_0x2752('0x33'),JSON[_0x2752('0x17')](_0x390bc6['options'][_0x2752('0xa')]),_0x390bc6['options'][_0x2752('0xa')][_0x2752('0x34')]);return db['CmHopper'][_0x2752('0x35')]({'where':_0x390bc6[_0x2752('0x8')]?_0x390bc6[_0x2752('0x8')]['where']||null:null,'transaction':_0x16045a});});})[_0x2752('0xf')](function(_0x621486){logger[_0x2752('0x10')](_0x2752('0x31'),_0x390bc6);logger['debug'](_0x2752('0x31'),_0x390bc6,JSON[_0x2752('0x17')](_0x621486));_0x67cda9(_0x621486);})[_0x2752('0x12')](function(_0x5f2d90){logger[_0x2752('0x13')](_0x2752('0x31'),_0x5f2d90[_0x2752('0x14')],_0x390bc6);_0x5149dc(_0x468acd[_0x2752('0x13')](0x1f4,_0x5f2d90['message']));});});};exports['CountReScheduled']=function(_0x426538){var _0x1bd5c9=this;return new Promise(function(_0xa09015,_0x337a44){return db[_0x2752('0x6')][_0x2752('0x7')]({'raw':_0x426538[_0x2752('0x8')]?_0x426538[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'where':_0x426538[_0x2752('0x8')]?_0x426538[_0x2752('0x8')][_0x2752('0xa')]||null:null,'attributes':[[db[_0x2752('0x36')]['fn'](_0x2752('0x37'),db[_0x2752('0x36')]['fn']('IF',db[_0x2752('0x36')][_0x2752('0x38')](_0x2752('0x39')+util[_0x2752('0x3a')]('\x22%s\x22',moment()[_0x2752('0x3a')](_0x2752('0x3b')))+'\x20,\x201,\x20null'))),_0x2752('0x3c')]]})[_0x2752('0xf')](function(_0x275b6c){logger[_0x2752('0x10')](_0x2752('0x3d'),_0x426538);logger['debug'](_0x2752('0x3d'),_0x426538,JSON['stringify'](_0x275b6c));_0xa09015(_0x275b6c);})[_0x2752('0x12')](function(_0x352872){logger[_0x2752('0x13')]('CountReScheduled',_0x352872[_0x2752('0x14')],_0x426538);_0x337a44(_0x1bd5c9['error'](0x1f4,_0x352872[_0x2752('0x14')]));});});};exports['GetContactRecallMe']=function(_0x222386){var _0xa1d998=this;return new Promise(function(_0x1c985d,_0x20eca8){return db[_0x2752('0x1e')]['describe']()[_0x2752('0xf')](function(){return db[_0x2752('0x36')]['transaction'](function(_0x40a7b6){return db['CmHopper'][_0x2752('0x7')]({'where':_0x222386[_0x2752('0x8')]?_0x222386['options']['where']||null:null,'attributes':_0x222386['options']?_0x222386[_0x2752('0x8')][_0x2752('0xb')]||null:null,'limit':0x1,'order':_0x222386[_0x2752('0x8')]?_0x222386[_0x2752('0x8')][_0x2752('0x20')]||null:null,'group':db[_0x2752('0x6')][_0x2752('0x29')],'transaction':_0x40a7b6,'lock':_0x40a7b6[_0x2752('0x21')][_0x2752('0x22')],'include':_0x222386[_0x2752('0x8')]?_0x222386[_0x2752('0x8')][_0x2752('0xc')]?_[_0x2752('0xd')](_0x222386[_0x2752('0x8')][_0x2752('0xc')],function(_0x1bcd21){return{'model':db[_0x1bcd21['model']],'as':_0x1bcd21['as'],'attributes':_0x1bcd21['attributes'],'include':_0x1bcd21[_0x2752('0xc')]?_[_0x2752('0xd')](_0x1bcd21['include'],function(_0x349ae2){return{'model':db[_0x349ae2['model']],'as':_0x349ae2['as'],'attributes':_0x349ae2['attributes'],'include':_0x349ae2[_0x2752('0xc')]?_['map'](_0x349ae2[_0x2752('0xc')],function(_0x447c20){return{'model':db[_0x447c20[_0x2752('0xe')]],'as':_0x447c20['as'],'attributes':_0x447c20[_0x2752('0xb')]};}):[]};}):[]};}):[]:[]})[_0x2752('0xf')](function(_0x94e44f){var _0x1e3d4d=[];for(var _0x14171a=0x0;_0x14171a<_0x94e44f['length'];_0x14171a+=0x1){_0x1e3d4d[_0x2752('0x2a')](_0x94e44f[_0x14171a][_0x2752('0x1b')](_0x222386[_0x2752('0x2b')],{'transaction':_0x40a7b6}));}return BPromise[_0x2752('0x3e')](_0x1e3d4d);});})[_0x2752('0xf')](function(_0x41c7ca){logger['info'](_0x2752('0x3f'),_0x222386);logger['debug'](_0x2752('0x3f'),_0x222386,JSON[_0x2752('0x17')](_0x41c7ca));_0x1c985d(_0x41c7ca);})[_0x2752('0x12')](function(_0x27d47d){logger['error']('GetContactRecallMe',_0x27d47d[_0x2752('0x14')],_0x222386);_0x20eca8(_0xa1d998['error'](0x1f4,_0x27d47d[_0x2752('0x14')]));});});});};exports['GetCmHopperPreview']=function(_0x136397){var _0x46b682=this;return new Promise(function(_0x366075,_0x53733e){db['CmContact'][_0x2752('0x40')]()[_0x2752('0xf')](function(_0x4d0b36){return db[_0x2752('0x6')]['findAll']({'raw':_0x136397['options']?_0x136397[_0x2752('0x8')][_0x2752('0x9')]===undefined?!![]:![]:!![],'where':_0x136397[_0x2752('0x8')]?_0x136397[_0x2752('0x8')][_0x2752('0xa')]||null:null,'attributes':_0x136397[_0x2752('0x8')]?_0x136397[_0x2752('0x8')][_0x2752('0xb')]||null:null,'limit':_0x136397[_0x2752('0x8')]?_0x136397['options'][_0x2752('0x1c')]||null:null,'include':_0x136397[_0x2752('0x8')]?_0x136397[_0x2752('0x8')][_0x2752('0xc')]?_[_0x2752('0xd')](_0x136397[_0x2752('0x8')][_0x2752('0xc')],function(_0x347b0e){return{'model':db[_0x347b0e['model']],'as':_0x347b0e['as'],'attributes':_0x347b0e['as']===_0x2752('0x23')?_['keys'](_0x4d0b36):_0x347b0e[_0x2752('0xb')],'include':_0x347b0e[_0x2752('0xc')]?_[_0x2752('0xd')](_0x347b0e[_0x2752('0xc')],function(_0x5406f9){return{'model':db[_0x5406f9['model']],'as':_0x5406f9['as'],'attributes':_0x5406f9['attributes'],'include':_0x5406f9[_0x2752('0xc')]?_[_0x2752('0xd')](_0x5406f9['include'],function(_0xa6bde7){return{'model':db[_0xa6bde7['model']],'as':_0xa6bde7['as'],'attributes':_0xa6bde7[_0x2752('0xb')]};}):[]};}):[]};}):[]:[]})[_0x2752('0xf')](function(_0xd92bf5){logger[_0x2752('0x10')]('GetCmHopper',_0x136397);logger[_0x2752('0x11')]('GetCmHopper',_0x136397,JSON['stringify'](_0xd92bf5));_0x366075(_0xd92bf5);})[_0x2752('0x12')](function(_0x2c1eb1){logger[_0x2752('0x13')](_0x2752('0x5'),_0x2c1eb1[_0x2752('0x14')],_0x136397);_0x53733e(_0x46b682['error'](0x1f4,_0x2c1eb1[_0x2752('0x14')]));});});});};exports[_0x2752('0x41')]=function(_0x2ae949){var _0x310c88=this;return new Promise(function(_0x29bd05,_0xf378a){return db[_0x2752('0x1e')][_0x2752('0x42')]({'raw':!![],'where':{'phone':_0x2ae949[_0x2752('0x8')]['where'][_0x2752('0x43')]},'attributes':['id',_0x2752('0x44')],'order':[['id','DESC']]})[_0x2752('0xf')](function(_0x290653){logger[_0x2752('0x10')](_0x2752('0x45'),_0x2ae949);logger['debug']('getContactByPhone',_0x2ae949,JSON['stringify'](_0x290653));_0x29bd05(_0x290653);})[_0x2752('0x12')](function(_0x555ca8){logger[_0x2752('0x13')](_0x2752('0x45'),_0x555ca8[_0x2752('0x14')],_0x2ae949);_0xf378a(_0x310c88[_0x2752('0x13')](0x1f4,_0x555ca8[_0x2752('0x14')]));});});};exports[_0x2752('0x46')]=function(_0x4376c0){var _0x4664d2=this;return new Promise(function(_0x344f3e,_0x4efd3c){return db[_0x2752('0x36')]['transaction'](function(_0x1f521c){var _0x3d997b=_0x4376c0[_0x2752('0x8')]&&_0x4376c0['options'][_0x2752('0xa')]?_0x4376c0[_0x2752('0x8')]['where']:{};return db[_0x2752('0x6')][_0x2752('0x1b')](_0x4376c0[_0x2752('0x2b')],{'where':_0x3d997b,'transaction':_0x1f521c})['then'](function(_0x4d2d25){logger['info'](_0x2752('0x46'),_0x4376c0);logger[_0x2752('0x11')](_0x2752('0x46'),_0x4376c0,JSON[_0x2752('0x17')](_0x4d2d25));_0x344f3e(_0x4d2d25);})['catch'](function(_0x13e260){logger[_0x2752('0x13')](_0x2752('0x46'),_0x13e260[_0x2752('0x14')],_0x4376c0);_0x4efd3c(_0x4664d2[_0x2752('0x13')](0x1f4,_0x13e260[_0x2752('0x14')]));});});});};exports[_0x2752('0x47')]=function(_0xfc3f8c){var _0x2cbe95=this;var _0xe5b8be=_0xfc3f8c[_0x2752('0x2b')][_0x2752('0xa')][_0x2752('0x48')];var _0x47af2b=_0xfc3f8c[_0x2752('0x2b')]['where'][_0x2752('0x49')];var _0x1dc218=_0xfc3f8c[_0x2752('0x2b')][_0x2752('0xa')][_0x2752('0x4a')];return new Promise(function(_0x2ba592,_0x4faf31){return db['CmHopper'][_0x2752('0x7')]({'where':{'voiceQueueId':{'$in':_0xe5b8be},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x2752('0x36')][_0x2752('0x38')](_0x2752('0x4b')+_0x47af2b+_0x2752('0x4c')),'$gt':db[_0x2752('0x36')][_0x2752('0x38')](_0x2752('0x4d'))}},'UserId':{'$in':_0x1dc218}},'include':[{'model':db['CmContact'],'as':_0x2752('0x23')},{'model':db['User'],'as':_0x2752('0x25'),'attributes':['id',_0x2752('0x26'),_0x2752('0x27')]},{'model':db[_0x2752('0x4e')],'as':_0x2752('0x4f')}]})[_0x2752('0xf')](function(_0x19a359){if(_0x19a359[_0x2752('0x28')]>0x0){return db[_0x2752('0x36')][_0x2752('0x1f')](function(_0x151ba2){return db[_0x2752('0x6')][_0x2752('0x1b')]({'recallmeNotifiedDate':db[_0x2752('0x36')]['literal'](_0x2752('0x4d'))},{'where':{'id':{'$in':_[_0x2752('0xd')](_0x19a359,'id')}},'transaction':_0x151ba2})[_0x2752('0xf')](function(){_0x2ba592(_0x19a359);})[_0x2752('0x12')](function(_0x496edb){logger[_0x2752('0x13')](_0x2752('0x47'),_0x496edb[_0x2752('0x14')],_0xfc3f8c);_0x4faf31(_0x2cbe95[_0x2752('0x13')](0x1f4,_0x496edb['message']));});})[_0x2752('0x12')](function(_0x17404e){logger[_0x2752('0x13')](_0x2752('0x47'),_0x17404e[_0x2752('0x14')],_0xfc3f8c);_0x4faf31(_0x2cbe95[_0x2752('0x13')](0x1f4,_0x17404e[_0x2752('0x14')]));});}else{_0x2ba592(_0x19a359);}});});};
\ No newline at end of file
index 6883611..caf2764 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b73=['express','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','/timezone','update','delete','destroy','exports'];(function(_0x4bba6d,_0x42f7ab){var _0x32d568=function(_0x1f5555){while(--_0x1f5555){_0x4bba6d['push'](_0x4bba6d['shift']());}};_0x32d568(++_0x42f7ab);}(_0x9b73,0x187));var _0x39b7=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x9b73[_0x5b561d];return _0x431060;};'use strict';var express=require(_0x39b7('0x0'));var router=express[_0x39b7('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x39b7('0x2'));router[_0x39b7('0x3')]('/',auth[_0x39b7('0x4')](),controller[_0x39b7('0x5')]);router['get'](_0x39b7('0x6'),auth['isAuthenticated'](),controller[_0x39b7('0x7')]);router[_0x39b7('0x3')]('/opencontacts',auth[_0x39b7('0x4')](),controller[_0x39b7('0x8')]);router[_0x39b7('0x3')](_0x39b7('0x9'),auth['isAuthenticated'](),controller[_0x39b7('0xa')]);router['get'](_0x39b7('0xb'),auth[_0x39b7('0x4')](),controller[_0x39b7('0xc')]);router[_0x39b7('0x3')](_0x39b7('0xd'),auth[_0x39b7('0x4')](),controller[_0x39b7('0xe')]);router[_0x39b7('0xf')]('/',auth[_0x39b7('0x4')](),controller[_0x39b7('0x10')]);router[_0x39b7('0xf')](_0x39b7('0x11'),auth[_0x39b7('0x4')](),controller['getPreview']);router[_0x39b7('0xf')](_0x39b7('0x12'),auth[_0x39b7('0x4')](),controller['getTimezone']);router['put'](_0x39b7('0xb'),auth[_0x39b7('0x4')](),controller[_0x39b7('0x13')]);router[_0x39b7('0x14')](_0x39b7('0xb'),auth[_0x39b7('0x4')](),controller[_0x39b7('0x15')]);module[_0x39b7('0x16')]=router;
\ No newline at end of file
+var _0x1495=['getPreviewRecall','post','create','/preview','getPreview','put','/:id','delete','exports','Router','../../components/auth/service','./cmHopper.controller','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/:id/previewrecall'];(function(_0x4ff5f9,_0x47a3c2){var _0x5c08fd=function(_0x438938){while(--_0x438938){_0x4ff5f9['push'](_0x4ff5f9['shift']());}};_0x5c08fd(++_0x47a3c2);}(_0x1495,0x68));var _0x5149=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1495[_0x2dafbe];return _0x58a45a;};'use strict';var express=require('express');var router=express[_0x5149('0x0')]();var auth=require(_0x5149('0x1'));var controller=require(_0x5149('0x2'));router[_0x5149('0x3')]('/',auth[_0x5149('0x4')](),controller[_0x5149('0x5')]);router[_0x5149('0x3')](_0x5149('0x6'),auth[_0x5149('0x4')](),controller['describe']);router[_0x5149('0x3')](_0x5149('0x7'),auth[_0x5149('0x4')](),controller[_0x5149('0x8')]);router['get']('/timezones',auth['isAuthenticated'](),controller['getTimezones']);router[_0x5149('0x3')]('/:id',auth[_0x5149('0x4')](),controller['show']);router[_0x5149('0x3')](_0x5149('0x9'),auth[_0x5149('0x4')](),controller[_0x5149('0xa')]);router[_0x5149('0xb')]('/',auth[_0x5149('0x4')](),controller[_0x5149('0xc')]);router[_0x5149('0xb')](_0x5149('0xd'),auth[_0x5149('0x4')](),controller[_0x5149('0xe')]);router[_0x5149('0xb')]('/timezone',auth[_0x5149('0x4')](),controller['getTimezone']);router[_0x5149('0xf')](_0x5149('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x5149('0x11')]('/:id',auth[_0x5149('0x4')](),controller['destroy']);module[_0x5149('0x12')]=router;
\ No newline at end of file
index 248e048..d0b6ad1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca2a=['YYYY-MM-DD\x20HH:mm:ss','moment','exports','INTEGER','DATE','format'];(function(_0x10b4f2,_0x2d4ec8){var _0x1d9640=function(_0x5a55ab){while(--_0x5a55ab){_0x10b4f2['push'](_0x10b4f2['shift']());}};_0x1d9640(++_0x2d4ec8);}(_0xca2a,0x15d));var _0xaca2=function(_0x2066e1,_0x3c5b98){_0x2066e1=_0x2066e1-0x0;var _0x42c6d1=_0xca2a[_0x2066e1];return _0x42c6d1;};'use strict';var moment=require(_0xaca2('0x0'));var Sequelize=require('sequelize');module[_0xaca2('0x1')]={'CmHopperId':{'type':Sequelize[_0xaca2('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0xaca2('0x3')],'defaultValue':moment()[_0xaca2('0x4')](_0xaca2('0x5'))},'countbusyretry':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaca2('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x9ae3=['moment','exports','INTEGER','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x5eb22e,_0x27cbac){var _0x27fed5=function(_0x565467){while(--_0x565467){_0x5eb22e['push'](_0x5eb22e['shift']());}};_0x27fed5(++_0x27cbac);}(_0x9ae3,0x103));var _0x39ae=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9ae3[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x39ae('0x0'));var Sequelize=require('sequelize');module[_0x39ae('0x1')]={'CmHopperId':{'type':Sequelize[_0x39ae('0x2')]},'phone':{'type':Sequelize[_0x39ae('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x39ae('0x4')],'defaultValue':moment()[_0x39ae('0x5')](_0x39ae('0x6'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x39ae('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index f9e84bd..af20a77 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3848=['eml-format','rimraf','zip-dir','bluebird','mustache','to-csv','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','destroy','CmHopperAdditionalPhones','UserProfileResource','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','params'];(function(_0x4b38c0,_0x109792){var _0x5b585b=function(_0x5ecea5){while(--_0x5ecea5){_0x4b38c0['push'](_0x4b38c0['shift']());}};_0x5b585b(++_0x109792);}(_0x3848,0xed));var _0x8384=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x3848[_0x99ff94];return _0x1b5bc0;};'use strict';var emlformat=require(_0x8384('0x0'));var rimraf=require(_0x8384('0x1'));var zipdir=require(_0x8384('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8384('0x3'));var Mustache=require(_0x8384('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x8384('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8384('0x6'));var _=require(_0x8384('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8384('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x8384('0x5'));var querystring=require(_0x8384('0x9'));var Papa=require('papaparse');var Redis=require(_0x8384('0xa'));var authService=require(_0x8384('0xb'));var qs=require(_0x8384('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8384('0xd'));var logger=require(_0x8384('0xe'))(_0x8384('0xf'));var utils=require(_0x8384('0x10'));var config=require(_0x8384('0x11'));var licenseUtil=require(_0x8384('0x12'));var db=require(_0x8384('0x13'))['db'];function respondWithStatusCode(_0x382bb7,_0x5c3fbc){_0x5c3fbc=_0x5c3fbc||0xcc;return function(_0xd15857){if(_0xd15857){return _0x382bb7[_0x8384('0x14')](_0x5c3fbc);}return _0x382bb7[_0x8384('0x15')](_0x5c3fbc)[_0x8384('0x16')]();};}function respondWithResult(_0x3168c9,_0x253fb0){_0x253fb0=_0x253fb0||0xc8;return function(_0x12a458){if(_0x12a458){return _0x3168c9[_0x8384('0x15')](_0x253fb0)[_0x8384('0x17')](_0x12a458);}};}function respondWithFilteredResult(_0x610d0a,_0x2e1448){return function(_0x3e365b){if(_0x3e365b){var _0x4f3ad0=typeof _0x2e1448[_0x8384('0x18')]==='undefined'&&typeof _0x2e1448[_0x8384('0x19')]===_0x8384('0x1a');var _0x24a798=_0x3e365b['count'];var _0x20aea6=_0x4f3ad0?0x0:_0x2e1448[_0x8384('0x18')];var _0x32a6f8=_0x4f3ad0?_0x3e365b[_0x8384('0x1b')]:_0x2e1448['offset']+_0x2e1448[_0x8384('0x19')];var _0x550dd2;if(_0x32a6f8>=_0x24a798){_0x32a6f8=_0x24a798;_0x550dd2=0xc8;}else{_0x550dd2=0xce;}_0x610d0a[_0x8384('0x15')](_0x550dd2);return _0x610d0a['set'](_0x8384('0x1c'),_0x20aea6+'-'+_0x32a6f8+'/'+_0x24a798)['json'](_0x3e365b);}return null;};}function patchUpdates(_0x54f071){return function(_0x2a0dc7){try{jsonpatch['apply'](_0x2a0dc7,_0x54f071,!![]);}catch(_0xa40ddf){return BPromise[_0x8384('0x1d')](_0xa40ddf);}return _0x2a0dc7[_0x8384('0x1e')]();};}function saveUpdates(_0x56f3d4,_0x4712e9){return function(_0x2da218){if(_0x2da218){return _0x2da218[_0x8384('0x1f')](_0x56f3d4)[_0x8384('0x20')](function(_0x540c11){return _0x540c11;});}return null;};}function removeEntity(_0x5d07b8,_0xc58a54){return function(_0x38fe66){if(_0x38fe66){return _0x38fe66[_0x8384('0x21')]()[_0x8384('0x20')](function(){var _0x29e93d=_0x38fe66['get']({'plain':!![]});var _0x681970=_0x8384('0x22');return db[_0x8384('0x23')][_0x8384('0x21')]({'where':{'type':_0x681970,'resourceId':_0x29e93d['id']}})[_0x8384('0x20')](function(){return _0x38fe66;});})[_0x8384('0x20')](function(){_0x5d07b8['status'](0xcc)[_0x8384('0x16')]();});}};}function handleEntityNotFound(_0xab7d24,_0x514dc0){return function(_0x220583){if(!_0x220583){_0xab7d24[_0x8384('0x14')](0x194);}return _0x220583;};}function handleError(_0x408142,_0x5b7aa9){_0x5b7aa9=_0x5b7aa9||0x1f4;return function(_0x512d0b){logger[_0x8384('0x24')](_0x512d0b[_0x8384('0x25')]);if(_0x512d0b[_0x8384('0x26')]){delete _0x512d0b[_0x8384('0x26')];}_0x408142[_0x8384('0x15')](_0x5b7aa9)['send'](_0x512d0b);};}exports[_0x8384('0x27')]=function(_0x4ac30c,_0x4a255d){var _0x296455={},_0x5e3628={},_0x3aa404={'count':0x0,'rows':[]};var _0xa4ffd9=_[_0x8384('0x28')](db[_0x8384('0x29')][_0x8384('0x2a')],function(_0x30984a){return{'name':_0x30984a['fieldName'],'type':_0x30984a[_0x8384('0x2b')][_0x8384('0x2c')]};});_0x5e3628['model']=_[_0x8384('0x28')](_0xa4ffd9,_0x8384('0x26'));_0x5e3628[_0x8384('0x2d')]=_[_0x8384('0x2e')](_0x4ac30c[_0x8384('0x2d')]);_0x5e3628[_0x8384('0x2f')]=_[_0x8384('0x30')](_0x5e3628[_0x8384('0x31')],_0x5e3628[_0x8384('0x2d')]);_0x296455[_0x8384('0x32')]=_['intersection'](_0x5e3628[_0x8384('0x31')],qs[_0x8384('0x33')](_0x4ac30c[_0x8384('0x2d')][_0x8384('0x33')]));_0x296455[_0x8384('0x32')]=_0x296455[_0x8384('0x32')][_0x8384('0x34')]?_0x296455[_0x8384('0x32')]:_0x5e3628[_0x8384('0x31')];if(!_0x4ac30c[_0x8384('0x2d')][_0x8384('0x35')](_0x8384('0x36'))){_0x296455[_0x8384('0x19')]=qs['limit'](_0x4ac30c['query']['limit']);_0x296455[_0x8384('0x18')]=qs[_0x8384('0x18')](_0x4ac30c[_0x8384('0x2d')][_0x8384('0x18')]);}_0x296455[_0x8384('0x37')]=qs[_0x8384('0x38')](_0x4ac30c[_0x8384('0x2d')][_0x8384('0x38')]);_0x296455[_0x8384('0x39')]=qs['filters'](_[_0x8384('0x3a')](_0x4ac30c[_0x8384('0x2d')],_0x5e3628[_0x8384('0x2f')]),_0xa4ffd9);if(_0x4ac30c['query'][_0x8384('0x3b')]){_0x296455[_0x8384('0x39')]=_[_0x8384('0x3c')](_0x296455[_0x8384('0x39')],{'$or':_[_0x8384('0x28')](_0xa4ffd9,function(_0x51e597){if(_0x51e597[_0x8384('0x2b')]!==_0x8384('0x3d')){var _0x4b0c13={};_0x4b0c13[_0x51e597[_0x8384('0x26')]]={'$like':'%'+_0x4ac30c[_0x8384('0x2d')][_0x8384('0x3b')]+'%'};return _0x4b0c13;}})});}_0x296455=_[_0x8384('0x3c')]({},_0x296455,_0x4ac30c[_0x8384('0x3e')]);var _0x934bb0={'where':_0x296455[_0x8384('0x39')]};return db[_0x8384('0x29')][_0x8384('0x1b')](_0x934bb0)[_0x8384('0x20')](function(_0x696342){_0x3aa404['count']=_0x696342;if(_0x4ac30c[_0x8384('0x2d')][_0x8384('0x3f')]){_0x296455[_0x8384('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x8384('0x41')](_0x296455);})[_0x8384('0x20')](function(_0x2e8a32){_0x3aa404[_0x8384('0x42')]=_0x2e8a32;return _0x3aa404;})[_0x8384('0x20')](respondWithFilteredResult(_0x4a255d,_0x296455))[_0x8384('0x43')](handleError(_0x4a255d,null));};exports[_0x8384('0x44')]=function(_0x4fcd10,_0x13862e){var _0x4e39a4={'raw':!![],'where':{'id':_0x4fcd10['params']['id']}},_0xa96de1={};_0xa96de1['model']=_[_0x8384('0x2e')](db[_0x8384('0x29')]['rawAttributes']);_0xa96de1[_0x8384('0x2d')]=_[_0x8384('0x2e')](_0x4fcd10['query']);_0xa96de1[_0x8384('0x2f')]=_[_0x8384('0x30')](_0xa96de1[_0x8384('0x31')],_0xa96de1['query']);_0x4e39a4['attributes']=_[_0x8384('0x30')](_0xa96de1[_0x8384('0x31')],qs[_0x8384('0x33')](_0x4fcd10[_0x8384('0x2d')][_0x8384('0x33')]));_0x4e39a4[_0x8384('0x32')]=_0x4e39a4[_0x8384('0x32')][_0x8384('0x34')]?_0x4e39a4[_0x8384('0x32')]:_0xa96de1['model'];if(_0x4fcd10[_0x8384('0x2d')][_0x8384('0x3f')]){_0x4e39a4['include']=[{'all':!![]}];}_0x4e39a4=_[_0x8384('0x3c')]({},_0x4e39a4,_0x4fcd10[_0x8384('0x3e')]);return db[_0x8384('0x29')][_0x8384('0x45')](_0x4e39a4)['then'](handleEntityNotFound(_0x13862e,null))[_0x8384('0x20')](respondWithResult(_0x13862e,null))[_0x8384('0x43')](handleError(_0x13862e,null));};exports['create']=function(_0x5d826c,_0x136299){return db[_0x8384('0x29')][_0x8384('0x46')](_0x5d826c[_0x8384('0x47')],{})[_0x8384('0x20')](function(_0x472c1d){var _0x3c061c=_0x5d826c[_0x8384('0x48')][_0x8384('0x49')]({'plain':!![]});if(!_0x3c061c)throw new Error(_0x8384('0x4a'));if(_0x3c061c[_0x8384('0x4b')]===_0x8384('0x48')){var _0x334eee=_0x472c1d['get']({'plain':!![]});var _0x73e466=_0x8384('0x22');return db[_0x8384('0x4c')]['find']({'where':{'name':_0x73e466,'userProfileId':_0x3c061c['userProfileId']},'raw':!![]})[_0x8384('0x20')](function(_0x6c246d){if(_0x6c246d&&_0x6c246d[_0x8384('0x4d')]===0x0){return db[_0x8384('0x23')]['create']({'name':_0x334eee[_0x8384('0x26')],'resourceId':_0x334eee['id'],'type':_0x6c246d[_0x8384('0x26')],'sectionId':_0x6c246d['id']},{})[_0x8384('0x20')](function(){return _0x472c1d;});}else{return _0x472c1d;}})[_0x8384('0x43')](function(_0x1d0606){logger[_0x8384('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1d0606);throw _0x1d0606;});}return _0x472c1d;})[_0x8384('0x20')](respondWithResult(_0x136299,0xc9))[_0x8384('0x43')](handleError(_0x136299,null));};exports['update']=function(_0x42a130,_0x989d27){if(_0x42a130[_0x8384('0x47')]['id']){delete _0x42a130[_0x8384('0x47')]['id'];}return db[_0x8384('0x29')][_0x8384('0x45')]({'where':{'id':_0x42a130['params']['id']}})[_0x8384('0x20')](handleEntityNotFound(_0x989d27,null))[_0x8384('0x20')](saveUpdates(_0x42a130[_0x8384('0x47')],null))[_0x8384('0x20')](respondWithResult(_0x989d27,null))[_0x8384('0x43')](handleError(_0x989d27,null));};exports['destroy']=function(_0xd442c,_0x4ddb9b){return db['CmHopperAdditionalPhone'][_0x8384('0x45')]({'where':{'id':_0xd442c[_0x8384('0x4e')]['id']}})[_0x8384('0x20')](handleEntityNotFound(_0x4ddb9b,null))[_0x8384('0x20')](removeEntity(_0x4ddb9b,null))[_0x8384('0x43')](handleError(_0x4ddb9b,null));};
\ No newline at end of file
+var _0x5930=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','end','status','undefined','limit','count','offset','Content-Range','json','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','sendStatus','error','stack','map','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperAdditionalPhone','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x4a45b4,_0x59804f){var _0x1a99c9=function(_0x3aa517){while(--_0x3aa517){_0x4a45b4['push'](_0x4a45b4['shift']());}};_0x1a99c9(++_0x59804f);}(_0x5930,0x92));var _0x0593=function(_0x3bc18b,_0x5269a3){_0x3bc18b=_0x3bc18b-0x0;var _0x36deb1=_0x5930[_0x3bc18b];return _0x36deb1;};'use strict';var emlformat=require(_0x0593('0x0'));var rimraf=require(_0x0593('0x1'));var zipdir=require(_0x0593('0x2'));var jsonpatch=require(_0x0593('0x3'));var rp=require(_0x0593('0x4'));var moment=require(_0x0593('0x5'));var BPromise=require(_0x0593('0x6'));var Mustache=require('mustache');var util=require(_0x0593('0x7'));var path=require(_0x0593('0x8'));var sox=require(_0x0593('0x9'));var csv=require(_0x0593('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0593('0xb'));var _=require(_0x0593('0xc'));var squel=require(_0x0593('0xd'));var crypto=require(_0x0593('0xe'));var jsforce=require(_0x0593('0xf'));var deskjs=require(_0x0593('0x10'));var toCsv=require(_0x0593('0xa'));var querystring=require(_0x0593('0x11'));var Papa=require(_0x0593('0x12'));var Redis=require(_0x0593('0x13'));var authService=require(_0x0593('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x0593('0x15'));var hardwareService=require(_0x0593('0x16'));var logger=require(_0x0593('0x17'))(_0x0593('0x18'));var utils=require('../../config/utils');var config=require(_0x0593('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11c117,_0x588814){_0x588814=_0x588814||0xcc;return function(_0x43d006){if(_0x43d006){return _0x11c117['sendStatus'](_0x588814);}return _0x11c117['status'](_0x588814)[_0x0593('0x1a')]();};}function respondWithResult(_0x1486c,_0x33b26f){_0x33b26f=_0x33b26f||0xc8;return function(_0x447c48){if(_0x447c48){return _0x1486c[_0x0593('0x1b')](_0x33b26f)['json'](_0x447c48);}};}function respondWithFilteredResult(_0x1e4a8a,_0x405878){return function(_0x4e8fd7){if(_0x4e8fd7){var _0x3047dd=typeof _0x405878['offset']===_0x0593('0x1c')&&typeof _0x405878[_0x0593('0x1d')]===_0x0593('0x1c');var _0x22a945=_0x4e8fd7[_0x0593('0x1e')];var _0x31ec12=_0x3047dd?0x0:_0x405878['offset'];var _0x282747=_0x3047dd?_0x4e8fd7['count']:_0x405878[_0x0593('0x1f')]+_0x405878['limit'];var _0x2928de;if(_0x282747>=_0x22a945){_0x282747=_0x22a945;_0x2928de=0xc8;}else{_0x2928de=0xce;}_0x1e4a8a['status'](_0x2928de);return _0x1e4a8a['set'](_0x0593('0x20'),_0x31ec12+'-'+_0x282747+'/'+_0x22a945)[_0x0593('0x21')](_0x4e8fd7);}return null;};}function patchUpdates(_0xbed827){return function(_0x401ecb){try{jsonpatch['apply'](_0x401ecb,_0xbed827,!![]);}catch(_0x15d612){return BPromise['reject'](_0x15d612);}return _0x401ecb[_0x0593('0x22')]();};}function saveUpdates(_0x15aa0c,_0x58977a){return function(_0x2bf6ad){if(_0x2bf6ad){return _0x2bf6ad[_0x0593('0x23')](_0x15aa0c)[_0x0593('0x24')](function(_0x586311){return _0x586311;});}return null;};}function removeEntity(_0x334ebe,_0x21b916){return function(_0x7f1426){if(_0x7f1426){return _0x7f1426['destroy']()[_0x0593('0x24')](function(){var _0x3d2200=_0x7f1426[_0x0593('0x25')]({'plain':!![]});var _0x19aa04=_0x0593('0x26');return db[_0x0593('0x27')][_0x0593('0x28')]({'where':{'type':_0x19aa04,'resourceId':_0x3d2200['id']}})['then'](function(){return _0x7f1426;});})[_0x0593('0x24')](function(){_0x334ebe['status'](0xcc)[_0x0593('0x1a')]();});}};}function handleEntityNotFound(_0x50fe10,_0x3980c2){return function(_0x11e0ae){if(!_0x11e0ae){_0x50fe10[_0x0593('0x29')](0x194);}return _0x11e0ae;};}function handleError(_0x5db63f,_0x9f2acd){_0x9f2acd=_0x9f2acd||0x1f4;return function(_0x400af9){logger[_0x0593('0x2a')](_0x400af9[_0x0593('0x2b')]);if(_0x400af9['name']){delete _0x400af9['name'];}_0x5db63f[_0x0593('0x1b')](_0x9f2acd)['send'](_0x400af9);};}exports['index']=function(_0x208e6d,_0x56ed75){var _0x11bf8b={},_0x3ab0ad={},_0x28efc9={'count':0x0,'rows':[]};var _0x17a6b9=_[_0x0593('0x2c')](db['CmHopperAdditionalPhone'][_0x0593('0x2d')],function(_0x37097f){return{'name':_0x37097f[_0x0593('0x2e')],'type':_0x37097f[_0x0593('0x2f')][_0x0593('0x30')]};});_0x3ab0ad[_0x0593('0x31')]=_['map'](_0x17a6b9,_0x0593('0x32'));_0x3ab0ad['query']=_[_0x0593('0x33')](_0x208e6d[_0x0593('0x34')]);_0x3ab0ad[_0x0593('0x35')]=_[_0x0593('0x36')](_0x3ab0ad[_0x0593('0x31')],_0x3ab0ad[_0x0593('0x34')]);_0x11bf8b['attributes']=_['intersection'](_0x3ab0ad[_0x0593('0x31')],qs[_0x0593('0x37')](_0x208e6d[_0x0593('0x34')]['fields']));_0x11bf8b[_0x0593('0x38')]=_0x11bf8b['attributes'][_0x0593('0x39')]?_0x11bf8b['attributes']:_0x3ab0ad[_0x0593('0x31')];if(!_0x208e6d[_0x0593('0x34')][_0x0593('0x3a')](_0x0593('0x3b'))){_0x11bf8b['limit']=qs[_0x0593('0x1d')](_0x208e6d[_0x0593('0x34')]['limit']);_0x11bf8b[_0x0593('0x1f')]=qs[_0x0593('0x1f')](_0x208e6d[_0x0593('0x34')][_0x0593('0x1f')]);}_0x11bf8b[_0x0593('0x3c')]=qs['sort'](_0x208e6d[_0x0593('0x34')][_0x0593('0x3d')]);_0x11bf8b[_0x0593('0x3e')]=qs[_0x0593('0x35')](_[_0x0593('0x3f')](_0x208e6d[_0x0593('0x34')],_0x3ab0ad[_0x0593('0x35')]),_0x17a6b9);if(_0x208e6d[_0x0593('0x34')][_0x0593('0x40')]){_0x11bf8b[_0x0593('0x3e')]=_[_0x0593('0x41')](_0x11bf8b['where'],{'$or':_[_0x0593('0x2c')](_0x17a6b9,function(_0x9af8f0){if(_0x9af8f0[_0x0593('0x2f')]!==_0x0593('0x42')){var _0x36d659={};_0x36d659[_0x9af8f0['name']]={'$like':'%'+_0x208e6d[_0x0593('0x34')][_0x0593('0x40')]+'%'};return _0x36d659;}})});}_0x11bf8b=_[_0x0593('0x41')]({},_0x11bf8b,_0x208e6d[_0x0593('0x43')]);var _0x4f3a31={'where':_0x11bf8b[_0x0593('0x3e')]};return db[_0x0593('0x44')][_0x0593('0x1e')](_0x4f3a31)[_0x0593('0x24')](function(_0x3c5979){_0x28efc9[_0x0593('0x1e')]=_0x3c5979;if(_0x208e6d[_0x0593('0x34')][_0x0593('0x45')]){_0x11bf8b[_0x0593('0x46')]=[{'all':!![]}];}return db[_0x0593('0x44')][_0x0593('0x47')](_0x11bf8b);})['then'](function(_0xbde80a){_0x28efc9[_0x0593('0x48')]=_0xbde80a;return _0x28efc9;})[_0x0593('0x24')](respondWithFilteredResult(_0x56ed75,_0x11bf8b))[_0x0593('0x49')](handleError(_0x56ed75,null));};exports['show']=function(_0x3a19e6,_0x3b86f7){var _0x5af5b0={'raw':!![],'where':{'id':_0x3a19e6[_0x0593('0x4a')]['id']}},_0x562701={};_0x562701[_0x0593('0x31')]=_[_0x0593('0x33')](db[_0x0593('0x44')]['rawAttributes']);_0x562701[_0x0593('0x34')]=_[_0x0593('0x33')](_0x3a19e6[_0x0593('0x34')]);_0x562701[_0x0593('0x35')]=_[_0x0593('0x36')](_0x562701['model'],_0x562701[_0x0593('0x34')]);_0x5af5b0['attributes']=_[_0x0593('0x36')](_0x562701['model'],qs['fields'](_0x3a19e6[_0x0593('0x34')][_0x0593('0x37')]));_0x5af5b0[_0x0593('0x38')]=_0x5af5b0[_0x0593('0x38')][_0x0593('0x39')]?_0x5af5b0[_0x0593('0x38')]:_0x562701[_0x0593('0x31')];if(_0x3a19e6['query'][_0x0593('0x45')]){_0x5af5b0['include']=[{'all':!![]}];}_0x5af5b0=_[_0x0593('0x41')]({},_0x5af5b0,_0x3a19e6[_0x0593('0x43')]);return db['CmHopperAdditionalPhone'][_0x0593('0x4b')](_0x5af5b0)[_0x0593('0x24')](handleEntityNotFound(_0x3b86f7,null))[_0x0593('0x24')](respondWithResult(_0x3b86f7,null))[_0x0593('0x49')](handleError(_0x3b86f7,null));};exports[_0x0593('0x4c')]=function(_0x37d609,_0xa8ad2b){return db['CmHopperAdditionalPhone'][_0x0593('0x4c')](_0x37d609[_0x0593('0x4d')],{})[_0x0593('0x24')](function(_0x4f84a6){var _0x5b853e=_0x37d609[_0x0593('0x4e')][_0x0593('0x25')]({'plain':!![]});if(!_0x5b853e)throw new Error(_0x0593('0x4f'));if(_0x5b853e['role']===_0x0593('0x4e')){var _0x21782d=_0x4f84a6[_0x0593('0x25')]({'plain':!![]});var _0x34135e=_0x0593('0x26');return db['UserProfileSection'][_0x0593('0x4b')]({'where':{'name':_0x34135e,'userProfileId':_0x5b853e[_0x0593('0x50')]},'raw':!![]})[_0x0593('0x24')](function(_0x2af907){if(_0x2af907&&_0x2af907['autoAssociation']===0x0){return db['UserProfileResource'][_0x0593('0x4c')]({'name':_0x21782d[_0x0593('0x32')],'resourceId':_0x21782d['id'],'type':_0x2af907['name'],'sectionId':_0x2af907['id']},{})[_0x0593('0x24')](function(){return _0x4f84a6;});}else{return _0x4f84a6;}})[_0x0593('0x49')](function(_0x111d92){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x111d92);throw _0x111d92;});}return _0x4f84a6;})[_0x0593('0x24')](respondWithResult(_0xa8ad2b,0xc9))[_0x0593('0x49')](handleError(_0xa8ad2b,null));};exports['update']=function(_0x34a2f3,_0x11ec08){if(_0x34a2f3['body']['id']){delete _0x34a2f3[_0x0593('0x4d')]['id'];}return db[_0x0593('0x44')][_0x0593('0x4b')]({'where':{'id':_0x34a2f3[_0x0593('0x4a')]['id']}})[_0x0593('0x24')](handleEntityNotFound(_0x11ec08,null))['then'](saveUpdates(_0x34a2f3[_0x0593('0x4d')],null))[_0x0593('0x24')](respondWithResult(_0x11ec08,null))[_0x0593('0x49')](handleError(_0x11ec08,null));};exports['destroy']=function(_0x1d4c37,_0x379d09){return db[_0x0593('0x44')]['find']({'where':{'id':_0x1d4c37['params']['id']}})['then'](handleEntityNotFound(_0x379d09,null))[_0x0593('0x24')](removeEntity(_0x379d09,null))[_0x0593('0x49')](handleError(_0x379d09,null));};
\ No newline at end of file
index 360236a..57b1ab5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa540=['../../config/environment','exports','define','CmHopperAdditionalPhone','lodash','../../config/logger','api','moment','rimraf'];(function(_0x493596,_0x2ba137){var _0x297fd9=function(_0x1e6040){while(--_0x1e6040){_0x493596['push'](_0x493596['shift']());}};_0x297fd9(++_0x2ba137);}(_0xa540,0xd3));var _0x0a54=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa540[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a54('0x0'));var util=require('util');var logger=require(_0x0a54('0x1'))(_0x0a54('0x2'));var moment=require(_0x0a54('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a54('0x4'));var config=require(_0x0a54('0x5'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x0a54('0x6')]=function(_0x372681,_0x185102){return _0x372681[_0x0a54('0x7')](_0x0a54('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3036=['moment','request-promise','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','../../config/logger','api'];(function(_0x42d042,_0x18f536){var _0x45b24d=function(_0x1897c4){while(--_0x1897c4){_0x42d042['push'](_0x42d042['shift']());}};_0x45b24d(++_0x18f536);}(_0x3036,0x1a9));var _0x6303=function(_0x5e8571,_0x3add15){_0x5e8571=_0x5e8571-0x0;var _0x830ce=_0x3036[_0x5e8571];return _0x830ce;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6303('0x0'))(_0x6303('0x1'));var moment=require(_0x6303('0x2'));var BPromise=require('bluebird');var rp=require(_0x6303('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6303('0x4'));module['exports']=function(_0x464b99,_0xaa32ef){return _0x464b99[_0x6303('0x5')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x6303('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c420e84..be7be36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bb6=['OrderBy','ASC','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','entity','countbusyretry','countabandonedretry','dialGlobalMaxRetry','CampaignId','duration','isNil','scheduledat','add','minutes','countcongestionretry','createdAt','phone','updatedAt','sequelize','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','VerifyAdditionalPhones','CmHopper','body','ContactId','ListId','VoiceQueueId','CmHopperAdditionalPhone','findOne'];(function(_0x358a0a,_0x4cffea){var _0x41a6ad=function(_0x3f78c0){while(--_0x3f78c0){_0x358a0a['push'](_0x358a0a['shift']());}};_0x41a6ad(++_0x4cffea);}(_0x2bb6,0xf5));var _0x62bb=function(_0x4a29a9,_0x58cd04){_0x4a29a9=_0x4a29a9-0x0;var _0x386570=_0x2bb6[_0x4a29a9];return _0x386570;};'use strict';var _=require(_0x62bb('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x62bb('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x62bb('0x2'));var db=require(_0x62bb('0x3'))['db'];var utils=require(_0x62bb('0x4'));var logger=require(_0x62bb('0x5'))(_0x62bb('0x6'));var config=require(_0x62bb('0x7'));var jayson=require(_0x62bb('0x8'));var client=jayson[_0x62bb('0x9')][_0x62bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x718825,_0x118811,_0x13fb2b){return new BPromise(function(_0x3a915c,_0x25f2c9){return client['request'](_0x718825,_0x13fb2b)[_0x62bb('0xb')](function(_0x3c0adf){logger['info'](_0x62bb('0xc'),_0x118811,_0x62bb('0xd'));logger[_0x62bb('0xe')](_0x62bb('0xf'),_0x118811,_0x62bb('0xd'),JSON[_0x62bb('0x10')](_0x3c0adf));if(_0x3c0adf[_0x62bb('0x11')]){if(_0x3c0adf[_0x62bb('0x11')][_0x62bb('0x12')]===0x1f4){logger[_0x62bb('0x11')](_0x62bb('0xc'),_0x118811,_0x3c0adf[_0x62bb('0x11')][_0x62bb('0x13')]);return _0x25f2c9(_0x3c0adf['error'][_0x62bb('0x13')]);}logger[_0x62bb('0x11')](_0x62bb('0xc'),_0x118811,_0x3c0adf['error'][_0x62bb('0x13')]);return _0x3a915c(_0x3c0adf['error'][_0x62bb('0x13')]);}else{logger[_0x62bb('0x14')](_0x62bb('0xc'),_0x118811,'request\x20sent');_0x3a915c(_0x3c0adf['result'][_0x62bb('0x13')]);}})[_0x62bb('0x15')](function(_0x2fc25e){logger[_0x62bb('0x11')](_0x62bb('0xc'),_0x118811,_0x2fc25e);_0x25f2c9(_0x2fc25e);});});}exports[_0x62bb('0x16')]=function(_0x284690){var _0x3e29e0=this;return new Promise(function(_0x48265a,_0x26ec0f){return db[_0x62bb('0x17')]['findOne']({'raw':!![],'where':{'ContactId':_0x284690[_0x62bb('0x18')][_0x62bb('0x19')],'ListId':_0x284690[_0x62bb('0x18')][_0x62bb('0x1a')],'VoiceQueueId':_0x284690[_0x62bb('0x18')][_0x62bb('0x1b')]===undefined?null:_0x284690[_0x62bb('0x18')][_0x62bb('0x1b')],'CampaignId':_0x284690[_0x62bb('0x18')]['CampaignId']===undefined?null:_0x284690['body']['CampaignId']}})[_0x62bb('0xb')](function(_0x23619e){if(_0x23619e!=null){return db[_0x62bb('0x1c')][_0x62bb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x23619e['id'],'OrderBy':{'$gt':_0x23619e['OrderBy']}},'order':[[_0x62bb('0x1e'),_0x62bb('0x1f')]]})['then'](function(_0x3a4049){var _0x153eab=0x0;if(_0x3a4049){if(_0x3a4049['countbusyretry']+_0x3a4049['countcongestionretry']+_0x3a4049[_0x62bb('0x20')]+_0x3a4049[_0x62bb('0x21')]+_0x3a4049[_0x62bb('0x22')]+_0x3a4049['countabandonedretry']+_0x3a4049[_0x62bb('0x23')]+_0x3a4049[_0x62bb('0x24')]<_0x284690[_0x62bb('0x25')]['dialGlobalMaxRetry'])_0x153eab=0x1;_0x48265a({'additional':_0x153eab});}else{return db[_0x62bb('0x1c')][_0x62bb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x23619e['id']},'order':[['OrderBy',_0x62bb('0x1f')]]})['then'](function(_0x28d09f){var _0x443160=0x0;if(_0x28d09f){if(_0x28d09f[_0x62bb('0x26')]+_0x28d09f['countcongestionretry']+_0x28d09f[_0x62bb('0x20')]+_0x28d09f[_0x62bb('0x21')]+_0x28d09f['countdropretry']+_0x28d09f[_0x62bb('0x27')]+_0x28d09f[_0x62bb('0x23')]+_0x28d09f[_0x62bb('0x24')]<_0x284690[_0x62bb('0x25')][_0x62bb('0x28')])_0x443160=0x1;_0x48265a({'additional':_0x443160});}else{_0x48265a({'additional':0x0});}})[_0x62bb('0x15')](function(_0x5c8d28){logger['error'](_0x62bb('0x16'),_0x5c8d28[_0x62bb('0x13')]);_0x26ec0f(_0x3e29e0[_0x62bb('0x11')](0x1f4,_0x5c8d28[_0x62bb('0x13')]));});}})[_0x62bb('0x15')](function(_0x2fa4e8){logger[_0x62bb('0x11')](_0x62bb('0x16'),_0x2fa4e8[_0x62bb('0x13')]);_0x26ec0f(_0x3e29e0[_0x62bb('0x11')](0x1f4,_0x2fa4e8[_0x62bb('0x13')]));});}else _0x48265a({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x31aa52){var _0x30db5a=this;return new Promise(function(_0x25c6dd,_0x2b7979){return db[_0x62bb('0x17')][_0x62bb('0x1d')]({'raw':!![],'where':{'ContactId':_0x31aa52[_0x62bb('0x18')][_0x62bb('0x19')],'ListId':_0x31aa52[_0x62bb('0x18')][_0x62bb('0x1a')],'VoiceQueueId':_0x31aa52[_0x62bb('0x18')][_0x62bb('0x1b')]===undefined?null:_0x31aa52[_0x62bb('0x18')][_0x62bb('0x1b')],'CampaignId':_0x31aa52[_0x62bb('0x18')]['CampaignId']===undefined?null:_0x31aa52[_0x62bb('0x18')][_0x62bb('0x29')]}})[_0x62bb('0xb')](function(_0x1238d2){if(_0x1238d2!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x1238d2['id'],'OrderBy':{'$gte':_0x1238d2[_0x62bb('0x1e')]}},'order':[[_0x62bb('0x1e'),'ASC']]})[_0x62bb('0xb')](function(_0x5bd90e){if(_0x5bd90e)return activateAdditionalPhone(_0x1238d2,_0x31aa52[_0x62bb('0x18')],_0x5bd90e,_0x31aa52[_0x62bb('0x2a')],_0x31aa52['waitTime'])[_0x62bb('0xb')](function(_0x43f1d6){_0x25c6dd(_0x43f1d6);});else{return db[_0x62bb('0x1c')][_0x62bb('0x1d')]({'raw':!![],'where':{'CmHopperId':_0x1238d2['id']},'order':[['OrderBy','ASC']]})[_0x62bb('0xb')](function(_0x2a8aac){if(_0x2a8aac)return activateAdditionalPhone(_0x1238d2,_0x31aa52[_0x62bb('0x18')],_0x2a8aac,_0x31aa52[_0x62bb('0x2a')],_0x31aa52['waitTime'])[_0x62bb('0xb')](function(_0x579324){_0x25c6dd(_0x579324);});else{_0x25c6dd({'id':_0x1238d2['id'],'phone':''});}})[_0x62bb('0x15')](function(_0x43dda2){logger[_0x62bb('0x11')]('VerifyAdditionalPhones',_0x43dda2[_0x62bb('0x13')]);_0x2b7979(_0x30db5a[_0x62bb('0x11')](0x1f4,_0x43dda2[_0x62bb('0x13')]));});}})[_0x62bb('0x15')](function(_0x1a6643){logger[_0x62bb('0x11')](_0x62bb('0x16'),_0x1a6643[_0x62bb('0x13')]);_0x2b7979(_0x30db5a[_0x62bb('0x11')](0x1f4,_0x1a6643[_0x62bb('0x13')]));});}else _0x25c6dd(0x1);});});};function activateAdditionalPhone(_0x3b8ca9,_0x333036,_0x16b45e,_0x3068a2,_0x5315d9){return new Promise(function(_0x1f4bc6,_0x45ae1c){var _0x347c4c;if(_[_0x62bb('0x2b')](_0x16b45e[_0x62bb('0x2c')])){_0x16b45e[_0x62bb('0x2c')]=moment();}if(moment()>moment(_0x16b45e[_0x62bb('0x2c')])){_0x347c4c=moment()[_0x62bb('0x2d')](_0x5315d9||0x3,_0x62bb('0x2e'));}else{if(_0x16b45e[_0x62bb('0x1e')]==0x0){_0x347c4c=moment(_0x16b45e[_0x62bb('0x2c')]);}else{_0x347c4c=moment()[_0x62bb('0x2d')](_0x5315d9||0x3,_0x62bb('0x2e'));}}if(_['isNil'](_0x347c4c)){_0x347c4c=moment()[_0x62bb('0x2d')](_0x5315d9||0x3,_0x62bb('0x2e'));}var _0x43235a={'phone':_0x3b8ca9['phone'],'active':0x0,'OrderBy':_[_0x62bb('0x2b')](_0x3b8ca9[_0x62bb('0x1e')])?0x0:_0x3b8ca9['OrderBy'],'scheduledat':moment()[_0x62bb('0x2d')](_0x3068a2||0x1,_0x62bb('0x2e')),'countbusyretry':_0x333036[_0x62bb('0x26')],'countcongestionretry':_0x333036[_0x62bb('0x2f')],'countnoanswerretry':_0x333036[_0x62bb('0x20')],'countnosuchnumberretry':_0x333036['countnosuchnumberretry'],'countdropretry':_0x333036['countdropretry'],'countabandonedretry':_0x333036[_0x62bb('0x27')],'countmachineretry':_0x333036[_0x62bb('0x23')],'countagentrejectretry':_0x333036['countagentrejectretry'],'createdAt':_0x333036[_0x62bb('0x30')],'updatedAt':_0x333036['updatedAt']};var _0x2586f3={'CmHopperId':_0x3b8ca9['id'],'phone':_0x16b45e[_0x62bb('0x31')],'active':0x0,'OrderBy':_[_0x62bb('0x2b')](_0x16b45e['OrderBy'])?0x0:_0x16b45e[_0x62bb('0x1e')],'scheduledat':_0x347c4c,'countbusyretry':_0x16b45e[_0x62bb('0x26')],'countcongestionretry':_0x16b45e[_0x62bb('0x2f')],'countnoanswerretry':_0x16b45e[_0x62bb('0x20')],'countnosuchnumberretry':_0x16b45e[_0x62bb('0x21')],'countdropretry':_0x16b45e[_0x62bb('0x22')],'countabandonedretry':_0x16b45e[_0x62bb('0x27')],'countmachineretry':_0x16b45e['countmachineretry'],'countagentrejectretry':_0x16b45e[_0x62bb('0x24')],'createdAt':_0x16b45e[_0x62bb('0x30')],'updatedAt':_0x16b45e[_0x62bb('0x32')]};return db[_0x62bb('0x33')]['transaction'](function(_0x386e08){return db['CmHopperAdditionalPhone'][_0x62bb('0x34')](_0x43235a,{'where':{'id':_0x16b45e['id']}},{'transaction':_0x386e08})[_0x62bb('0xb')](function(){return db[_0x62bb('0x17')]['update'](_0x2586f3,{'where':{'id':_0x3b8ca9['id']}},{'transaction':_0x386e08});});})[_0x62bb('0xb')](function(_0x182646){_0x1f4bc6({'id':_0x3b8ca9['id'],'phone':_0x16b45e['phone']});})['catch'](function(_0x586563){logger[_0x62bb('0x11')](_0x62bb('0x35'),_0x586563[_0x62bb('0x13')]);_0x45ae1c({'error':_0x586563[_0x62bb('0x13')]});});});}exports[_0x62bb('0x36')]=function(_0x422629){var _0x2ab014=this;return new Promise(function(_0x30b17b,_0x234302){return db[_0x62bb('0x17')][_0x62bb('0x34')](_0x422629[_0x62bb('0x18')]['field'],{'where':{'id':_0x422629[_0x62bb('0x18')]['id']}})[_0x62bb('0xb')](function(_0xff92e){_0x30b17b(_0xff92e);})[_0x62bb('0x15')](function(_0x496d6a){logger['error']('IncrementPreviewCounters',_0x496d6a['message']);_0x234302(_0x2ab014[_0x62bb('0x11')](0x1f4,_0x496d6a[_0x62bb('0x13')]));});});};
\ No newline at end of file
+var _0x52bb=['CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','catch','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','then','OrderBy','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','ASC','VerifyAdditionalPhones','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x52bb,0xd4));var _0xb52b=function(_0x1a654a,_0x53fa98){_0x1a654a=_0x1a654a-0x0;var _0x2624d0=_0x52bb[_0x1a654a];return _0x2624d0;};'use strict';var _=require(_0xb52b('0x0'));var util=require(_0xb52b('0x1'));var moment=require(_0xb52b('0x2'));var BPromise=require(_0xb52b('0x3'));var rs=require(_0xb52b('0x4'));var fs=require('fs');var Redis=require(_0xb52b('0x5'));var db=require(_0xb52b('0x6'))['db'];var utils=require(_0xb52b('0x7'));var logger=require(_0xb52b('0x8'))(_0xb52b('0x9'));var config=require('../../config/environment');var jayson=require(_0xb52b('0xa'));var client=jayson['client'][_0xb52b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f401a,_0x4e33e5,_0x2d91be){return new BPromise(function(_0x55ce61,_0x35de34){return client['request'](_0x5f401a,_0x2d91be)['then'](function(_0x2dbb4d){logger['info'](_0xb52b('0xc'),_0x4e33e5,_0xb52b('0xd'));logger[_0xb52b('0xe')](_0xb52b('0xf'),_0x4e33e5,'request\x20sent',JSON['stringify'](_0x2dbb4d));if(_0x2dbb4d['error']){if(_0x2dbb4d[_0xb52b('0x10')][_0xb52b('0x11')]===0x1f4){logger['error'](_0xb52b('0xc'),_0x4e33e5,_0x2dbb4d[_0xb52b('0x10')][_0xb52b('0x12')]);return _0x35de34(_0x2dbb4d['error']['message']);}logger['error'](_0xb52b('0xc'),_0x4e33e5,_0x2dbb4d[_0xb52b('0x10')][_0xb52b('0x12')]);return _0x55ce61(_0x2dbb4d[_0xb52b('0x10')][_0xb52b('0x12')]);}else{logger['info'](_0xb52b('0xc'),_0x4e33e5,'request\x20sent');_0x55ce61(_0x2dbb4d['result']['message']);}})[_0xb52b('0x13')](function(_0x8a7434){logger[_0xb52b('0x10')](_0xb52b('0xc'),_0x4e33e5,_0x8a7434);_0x35de34(_0x8a7434);});});}exports['VerifyAdditionalPhones']=function(_0x447815){var _0x149fa9=this;return new Promise(function(_0x3adcca,_0x15d344){return db[_0xb52b('0x14')][_0xb52b('0x15')]({'raw':!![],'where':{'ContactId':_0x447815[_0xb52b('0x16')][_0xb52b('0x17')],'ListId':_0x447815[_0xb52b('0x16')][_0xb52b('0x18')],'VoiceQueueId':_0x447815['body'][_0xb52b('0x19')]===undefined?null:_0x447815[_0xb52b('0x16')][_0xb52b('0x19')],'CampaignId':_0x447815['body'][_0xb52b('0x1a')]===undefined?null:_0x447815[_0xb52b('0x16')][_0xb52b('0x1a')]}})[_0xb52b('0x1b')](function(_0x5b560f){if(_0x5b560f!=null){return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x5b560f['id'],'OrderBy':{'$gt':_0x5b560f[_0xb52b('0x1c')]}},'order':[['OrderBy','ASC']]})[_0xb52b('0x1b')](function(_0x1889ed){var _0x5ce9ce=0x0;if(_0x1889ed){if(_0x1889ed[_0xb52b('0x1d')]+_0x1889ed[_0xb52b('0x1e')]+_0x1889ed[_0xb52b('0x1f')]+_0x1889ed[_0xb52b('0x20')]+_0x1889ed[_0xb52b('0x21')]+_0x1889ed[_0xb52b('0x22')]+_0x1889ed[_0xb52b('0x23')]+_0x1889ed[_0xb52b('0x24')]<_0x447815[_0xb52b('0x25')][_0xb52b('0x26')])_0x5ce9ce=0x1;_0x3adcca({'additional':_0x5ce9ce});}else{return db[_0xb52b('0x27')][_0xb52b('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5b560f['id']},'order':[[_0xb52b('0x1c'),_0xb52b('0x28')]]})[_0xb52b('0x1b')](function(_0x48bb7d){var _0x56f191=0x0;if(_0x48bb7d){if(_0x48bb7d['countbusyretry']+_0x48bb7d[_0xb52b('0x1e')]+_0x48bb7d[_0xb52b('0x1f')]+_0x48bb7d[_0xb52b('0x20')]+_0x48bb7d[_0xb52b('0x21')]+_0x48bb7d[_0xb52b('0x22')]+_0x48bb7d[_0xb52b('0x23')]+_0x48bb7d[_0xb52b('0x24')]<_0x447815[_0xb52b('0x25')][_0xb52b('0x26')])_0x56f191=0x1;_0x3adcca({'additional':_0x56f191});}else{_0x3adcca({'additional':0x0});}})[_0xb52b('0x13')](function(_0x34d18b){logger[_0xb52b('0x10')](_0xb52b('0x29'),_0x34d18b[_0xb52b('0x12')]);_0x15d344(_0x149fa9[_0xb52b('0x10')](0x1f4,_0x34d18b[_0xb52b('0x12')]));});}})['catch'](function(_0x188fe3){logger[_0xb52b('0x10')](_0xb52b('0x29'),_0x188fe3[_0xb52b('0x12')]);_0x15d344(_0x149fa9['error'](0x1f4,_0x188fe3[_0xb52b('0x12')]));});}else _0x3adcca({'additional':0x0});});});};exports[_0xb52b('0x2a')]=function(_0x2c59d5){var _0xfb6853=this;return new Promise(function(_0x3403a2,_0x41fbad){return db[_0xb52b('0x14')][_0xb52b('0x15')]({'raw':!![],'where':{'ContactId':_0x2c59d5[_0xb52b('0x16')][_0xb52b('0x17')],'ListId':_0x2c59d5[_0xb52b('0x16')][_0xb52b('0x18')],'VoiceQueueId':_0x2c59d5['body']['VoiceQueueId']===undefined?null:_0x2c59d5[_0xb52b('0x16')]['VoiceQueueId'],'CampaignId':_0x2c59d5['body'][_0xb52b('0x1a')]===undefined?null:_0x2c59d5[_0xb52b('0x16')][_0xb52b('0x1a')]}})['then'](function(_0x159397){if(_0x159397!=null){return db[_0xb52b('0x27')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x159397['id'],'OrderBy':{'$gte':_0x159397[_0xb52b('0x1c')]}},'order':[[_0xb52b('0x1c'),_0xb52b('0x28')]]})[_0xb52b('0x1b')](function(_0x55c2b9){if(_0x55c2b9)return activateAdditionalPhone(_0x159397,_0x2c59d5[_0xb52b('0x16')],_0x55c2b9,_0x2c59d5[_0xb52b('0x2b')],_0x2c59d5[_0xb52b('0x2c')])[_0xb52b('0x1b')](function(_0x102826){_0x3403a2(_0x102826);});else{return db[_0xb52b('0x27')][_0xb52b('0x15')]({'raw':!![],'where':{'CmHopperId':_0x159397['id']},'order':[[_0xb52b('0x1c'),_0xb52b('0x28')]]})[_0xb52b('0x1b')](function(_0x149156){if(_0x149156)return activateAdditionalPhone(_0x159397,_0x2c59d5[_0xb52b('0x16')],_0x149156,_0x2c59d5[_0xb52b('0x2b')],_0x2c59d5[_0xb52b('0x2c')])[_0xb52b('0x1b')](function(_0x5121ea){_0x3403a2(_0x5121ea);});else{_0x3403a2({'id':_0x159397['id'],'phone':''});}})[_0xb52b('0x13')](function(_0x33bb50){logger[_0xb52b('0x10')]('VerifyAdditionalPhones',_0x33bb50['message']);_0x41fbad(_0xfb6853[_0xb52b('0x10')](0x1f4,_0x33bb50[_0xb52b('0x12')]));});}})[_0xb52b('0x13')](function(_0x463c5d){logger[_0xb52b('0x10')](_0xb52b('0x29'),_0x463c5d[_0xb52b('0x12')]);_0x41fbad(_0xfb6853[_0xb52b('0x10')](0x1f4,_0x463c5d[_0xb52b('0x12')]));});}else _0x3403a2(0x1);});});};function activateAdditionalPhone(_0x15eb3d,_0x285d90,_0x23ff63,_0x2fa776,_0x350c59){return new Promise(function(_0x562838,_0x3be562){var _0x31a644;if(_[_0xb52b('0x2d')](_0x23ff63[_0xb52b('0x2e')])){_0x23ff63[_0xb52b('0x2e')]=moment();}if(moment()>moment(_0x23ff63[_0xb52b('0x2e')])){_0x31a644=moment()[_0xb52b('0x2f')](_0x350c59||0x3,_0xb52b('0x30'));}else{if(_0x23ff63[_0xb52b('0x1c')]==0x0){_0x31a644=moment(_0x23ff63[_0xb52b('0x2e')]);}else{_0x31a644=moment()[_0xb52b('0x2f')](_0x350c59||0x3,'minutes');}}if(_[_0xb52b('0x2d')](_0x31a644)){_0x31a644=moment()[_0xb52b('0x2f')](_0x350c59||0x3,_0xb52b('0x30'));}var _0x567466={'phone':_0x15eb3d[_0xb52b('0x31')],'active':0x0,'OrderBy':_[_0xb52b('0x2d')](_0x15eb3d[_0xb52b('0x1c')])?0x0:_0x15eb3d[_0xb52b('0x1c')],'scheduledat':moment()[_0xb52b('0x2f')](_0x2fa776||0x1,'minutes'),'countbusyretry':_0x285d90[_0xb52b('0x1d')],'countcongestionretry':_0x285d90[_0xb52b('0x1e')],'countnoanswerretry':_0x285d90[_0xb52b('0x1f')],'countnosuchnumberretry':_0x285d90['countnosuchnumberretry'],'countdropretry':_0x285d90[_0xb52b('0x21')],'countabandonedretry':_0x285d90[_0xb52b('0x22')],'countmachineretry':_0x285d90['countmachineretry'],'countagentrejectretry':_0x285d90[_0xb52b('0x24')],'createdAt':_0x285d90['createdAt'],'updatedAt':_0x285d90[_0xb52b('0x32')]};var _0x324683={'CmHopperId':_0x15eb3d['id'],'phone':_0x23ff63[_0xb52b('0x31')],'active':0x0,'OrderBy':_[_0xb52b('0x2d')](_0x23ff63[_0xb52b('0x1c')])?0x0:_0x23ff63[_0xb52b('0x1c')],'scheduledat':_0x31a644,'countbusyretry':_0x23ff63[_0xb52b('0x1d')],'countcongestionretry':_0x23ff63[_0xb52b('0x1e')],'countnoanswerretry':_0x23ff63['countnoanswerretry'],'countnosuchnumberretry':_0x23ff63['countnosuchnumberretry'],'countdropretry':_0x23ff63['countdropretry'],'countabandonedretry':_0x23ff63[_0xb52b('0x22')],'countmachineretry':_0x23ff63[_0xb52b('0x23')],'countagentrejectretry':_0x23ff63[_0xb52b('0x24')],'createdAt':_0x23ff63['createdAt'],'updatedAt':_0x23ff63['updatedAt']};return db[_0xb52b('0x33')][_0xb52b('0x34')](function(_0x17d2cc){return db[_0xb52b('0x27')][_0xb52b('0x35')](_0x567466,{'where':{'id':_0x23ff63['id']}},{'transaction':_0x17d2cc})[_0xb52b('0x1b')](function(){return db[_0xb52b('0x14')]['update'](_0x324683,{'where':{'id':_0x15eb3d['id']}},{'transaction':_0x17d2cc});});})[_0xb52b('0x1b')](function(_0x4ffad1){_0x562838({'id':_0x15eb3d['id'],'phone':_0x23ff63[_0xb52b('0x31')]});})[_0xb52b('0x13')](function(_0x2d1d2d){logger['error'](_0xb52b('0x36'),_0x2d1d2d[_0xb52b('0x12')]);_0x3be562({'error':_0x2d1d2d[_0xb52b('0x12')]});});});}exports[_0xb52b('0x37')]=function(_0x56a6c8){var _0x276a36=this;return new Promise(function(_0x4c6e62,_0x13c584){return db[_0xb52b('0x14')][_0xb52b('0x35')](_0x56a6c8[_0xb52b('0x16')]['field'],{'where':{'id':_0x56a6c8['body']['id']}})['then'](function(_0xd79afb){_0x4c6e62(_0xd79afb);})['catch'](function(_0x49ef07){logger[_0xb52b('0x10')](_0xb52b('0x37'),_0x49ef07[_0xb52b('0x12')]);_0x13c584(_0x276a36[_0xb52b('0x10')](0x1f4,_0x49ef07[_0xb52b('0x12')]));});});};
\ No newline at end of file
index 4a0e68b..0c9b917 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ca3=['index','/:id','show','put','update','delete','destroy','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated'];(function(_0x511a0f,_0x75398c){var _0x298ee6=function(_0x4e45d4){while(--_0x4e45d4){_0x511a0f['push'](_0x511a0f['shift']());}};_0x298ee6(++_0x75398c);}(_0x1ca3,0x1ba));var _0x31ca=function(_0x2dfad5,_0x2abaca){_0x2dfad5=_0x2dfad5-0x0;var _0x373c6d=_0x1ca3[_0x2dfad5];return _0x373c6d;};'use strict';var multer=require('multer');var util=require(_0x31ca('0x0'));var path=require('path');var timeout=require(_0x31ca('0x1'));var express=require('express');var router=express[_0x31ca('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x31ca('0x3'));var interaction=require(_0x31ca('0x4'));var config=require(_0x31ca('0x5'));var controller=require(_0x31ca('0x6'));router['get']('/',auth[_0x31ca('0x7')](),controller[_0x31ca('0x8')]);router['get'](_0x31ca('0x9'),auth[_0x31ca('0x7')](),controller[_0x31ca('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x31ca('0xb')](_0x31ca('0x9'),auth[_0x31ca('0x7')](),controller[_0x31ca('0xc')]);router[_0x31ca('0xd')](_0x31ca('0x9'),auth[_0x31ca('0x7')](),controller[_0x31ca('0xe')]);module['exports']=router;
\ No newline at end of file
+var _0x3bbd=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id','show','post','create'];(function(_0x39f615,_0xf7942b){var _0x34d59b=function(_0xac3613){while(--_0xac3613){_0x39f615['push'](_0x39f615['shift']());}};_0x34d59b(++_0xf7942b);}(_0x3bbd,0x1b2));var _0xd3bb=function(_0x16a5ba,_0x291f82){_0x16a5ba=_0x16a5ba-0x0;var _0x5eccea=_0x3bbd[_0x16a5ba];return _0x5eccea;};'use strict';var multer=require(_0xd3bb('0x0'));var util=require(_0xd3bb('0x1'));var path=require(_0xd3bb('0x2'));var timeout=require(_0xd3bb('0x3'));var express=require(_0xd3bb('0x4'));var router=express[_0xd3bb('0x5')]();var fs_extra=require(_0xd3bb('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd3bb('0x7'));router['get']('/',auth[_0xd3bb('0x8')](),controller[_0xd3bb('0x9')]);router['get'](_0xd3bb('0xa'),auth[_0xd3bb('0x8')](),controller[_0xd3bb('0xb')]);router[_0xd3bb('0xc')]('/',auth[_0xd3bb('0x8')](),controller[_0xd3bb('0xd')]);router['put']('/:id',auth[_0xd3bb('0x8')](),controller['update']);router[_0xd3bb('0xe')](_0xd3bb('0xa'),auth[_0xd3bb('0x8')](),controller['destroy']);module[_0xd3bb('0xf')]=router;
\ No newline at end of file
index 3b01289..872f313 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xafec=['STRING','INTEGER','contactListQueue','sequelize','exports'];(function(_0x53377b,_0x166f23){var _0x39cba9=function(_0x4be07d){while(--_0x4be07d){_0x53377b['push'](_0x53377b['shift']());}};_0x39cba9(++_0x166f23);}(_0xafec,0x161));var _0xcafe=function(_0x2c5fe8,_0x39a6da){_0x2c5fe8=_0x2c5fe8-0x0;var _0x3a4c8b=_0xafec[_0x2c5fe8];return _0x3a4c8b;};'use strict';var moment=require('moment');var Sequelize=require(_0xcafe('0x0'));module[_0xcafe('0x1')]={'phone':{'type':Sequelize[_0xcafe('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xcafe('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xcafe('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xcafe('0x3')],'unique':_0xcafe('0x4')}};
\ No newline at end of file
+var _0x017e=['moment','exports','INTEGER','contactListQueue'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x017e,0x10c));var _0xe017=function(_0x2c5d4e,_0x6d5975){_0x2c5d4e=_0x2c5d4e-0x0;var _0xe27290=_0x017e[_0x2c5d4e];return _0xe27290;};'use strict';var moment=require(_0xe017('0x0'));var Sequelize=require('sequelize');module[_0xe017('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0xe017('0x2')],'unique':_0xe017('0x3')},'ListId':{'type':Sequelize[_0xe017('0x2')],'unique':_0xe017('0x3')},'VoiceQueueId':{'type':Sequelize[_0xe017('0x2')],'unique':'contactListQueue'}};
\ No newline at end of file
index ca9e67f..b1e8ee5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb1ad=['where','merge','options','then','includeAll','include','rows','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','CmHopperBlack','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','order','sort','pick','filters','filter'];(function(_0x2b8669,_0x42410e){var _0x1ab9c3=function(_0x5c0c6b){while(--_0x5c0c6b){_0x2b8669['push'](_0x2b8669['shift']());}};_0x1ab9c3(++_0x42410e);}(_0xb1ad,0x184));var _0xdb1a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb1ad[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xdb1a('0x0'));var rimraf=require(_0xdb1a('0x1'));var zipdir=require(_0xdb1a('0x2'));var jsonpatch=require(_0xdb1a('0x3'));var rp=require(_0xdb1a('0x4'));var moment=require(_0xdb1a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdb1a('0x6'));var util=require(_0xdb1a('0x7'));var path=require(_0xdb1a('0x8'));var sox=require(_0xdb1a('0x9'));var csv=require(_0xdb1a('0xa'));var ejs=require(_0xdb1a('0xb'));var fs=require('fs');var fs_extra=require(_0xdb1a('0xc'));var _=require(_0xdb1a('0xd'));var squel=require(_0xdb1a('0xe'));var crypto=require(_0xdb1a('0xf'));var jsforce=require(_0xdb1a('0x10'));var deskjs=require(_0xdb1a('0x11'));var toCsv=require(_0xdb1a('0xa'));var querystring=require(_0xdb1a('0x12'));var Papa=require(_0xdb1a('0x13'));var Redis=require('ioredis');var authService=require(_0xdb1a('0x14'));var qs=require(_0xdb1a('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdb1a('0x16'));var utils=require(_0xdb1a('0x17'));var config=require(_0xdb1a('0x18'));var licenseUtil=require(_0xdb1a('0x19'));var db=require(_0xdb1a('0x1a'))['db'];function respondWithStatusCode(_0x31ccd3,_0x3ca28b){_0x3ca28b=_0x3ca28b||0xcc;return function(_0x1c40c8){if(_0x1c40c8){return _0x31ccd3[_0xdb1a('0x1b')](_0x3ca28b);}return _0x31ccd3[_0xdb1a('0x1c')](_0x3ca28b)[_0xdb1a('0x1d')]();};}function respondWithResult(_0x1d69dd,_0x857c00){_0x857c00=_0x857c00||0xc8;return function(_0x5aa761){if(_0x5aa761){return _0x1d69dd[_0xdb1a('0x1c')](_0x857c00)[_0xdb1a('0x1e')](_0x5aa761);}};}function respondWithFilteredResult(_0x112be1,_0x4bdec7){return function(_0x28dfe9){if(_0x28dfe9){var _0x504d92=typeof _0x4bdec7[_0xdb1a('0x1f')]===_0xdb1a('0x20')&&typeof _0x4bdec7[_0xdb1a('0x21')]==='undefined';var _0x9ffb77=_0x28dfe9[_0xdb1a('0x22')];var _0x268ce8=_0x504d92?0x0:_0x4bdec7['offset'];var _0xe3780b=_0x504d92?_0x28dfe9[_0xdb1a('0x22')]:_0x4bdec7[_0xdb1a('0x1f')]+_0x4bdec7[_0xdb1a('0x21')];var _0x37e10c;if(_0xe3780b>=_0x9ffb77){_0xe3780b=_0x9ffb77;_0x37e10c=0xc8;}else{_0x37e10c=0xce;}_0x112be1[_0xdb1a('0x1c')](_0x37e10c);return _0x112be1['set'](_0xdb1a('0x23'),_0x268ce8+'-'+_0xe3780b+'/'+_0x9ffb77)[_0xdb1a('0x1e')](_0x28dfe9);}return null;};}function patchUpdates(_0x386e32){return function(_0x37b776){try{jsonpatch[_0xdb1a('0x24')](_0x37b776,_0x386e32,!![]);}catch(_0x400397){return BPromise[_0xdb1a('0x25')](_0x400397);}return _0x37b776[_0xdb1a('0x26')]();};}function saveUpdates(_0x3a9b3a,_0xc92d26){return function(_0x4d1d09){if(_0x4d1d09){return _0x4d1d09[_0xdb1a('0x27')](_0x3a9b3a)['then'](function(_0x28ccfe){return _0x28ccfe;});}return null;};}function removeEntity(_0x2cc1aa,_0x3d07fc){return function(_0x5d3d24){if(_0x5d3d24){return _0x5d3d24[_0xdb1a('0x28')]()['then'](function(){_0x2cc1aa[_0xdb1a('0x1c')](0xcc)[_0xdb1a('0x1d')]();});}};}function handleEntityNotFound(_0x22c95e,_0x157c6a){return function(_0xaa6f2e){if(!_0xaa6f2e){_0x22c95e[_0xdb1a('0x1b')](0x194);}return _0xaa6f2e;};}function handleError(_0x22c260,_0x2e814e){_0x2e814e=_0x2e814e||0x1f4;return function(_0x5c963b){logger['error'](_0x5c963b[_0xdb1a('0x29')]);if(_0x5c963b[_0xdb1a('0x2a')]){delete _0x5c963b[_0xdb1a('0x2a')];}_0x22c260[_0xdb1a('0x1c')](_0x2e814e)[_0xdb1a('0x2b')](_0x5c963b);};}exports[_0xdb1a('0x2c')]=function(_0x5d1514,_0x3ec2f6){var _0x51f0ff={},_0x5a67c4={},_0xbfa09f={'count':0x0,'rows':[]};var _0x51a26d=_['map'](db[_0xdb1a('0x2d')][_0xdb1a('0x2e')],function(_0x46d019){return{'name':_0x46d019['fieldName'],'type':_0x46d019[_0xdb1a('0x2f')][_0xdb1a('0x30')]};});_0x5a67c4[_0xdb1a('0x31')]=_[_0xdb1a('0x32')](_0x51a26d,'name');_0x5a67c4[_0xdb1a('0x33')]=_[_0xdb1a('0x34')](_0x5d1514[_0xdb1a('0x33')]);_0x5a67c4['filters']=_[_0xdb1a('0x35')](_0x5a67c4[_0xdb1a('0x31')],_0x5a67c4[_0xdb1a('0x33')]);_0x51f0ff[_0xdb1a('0x36')]=_['intersection'](_0x5a67c4['model'],qs['fields'](_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x37')]));_0x51f0ff['attributes']=_0x51f0ff[_0xdb1a('0x36')][_0xdb1a('0x38')]?_0x51f0ff[_0xdb1a('0x36')]:_0x5a67c4[_0xdb1a('0x31')];if(!_0x5d1514[_0xdb1a('0x33')]['hasOwnProperty']('nolimit')){_0x51f0ff['limit']=qs[_0xdb1a('0x21')](_0x5d1514['query']['limit']);_0x51f0ff[_0xdb1a('0x1f')]=qs[_0xdb1a('0x1f')](_0x5d1514['query'][_0xdb1a('0x1f')]);}_0x51f0ff[_0xdb1a('0x39')]=qs[_0xdb1a('0x3a')](_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3a')]);_0x51f0ff['where']=qs['filters'](_[_0xdb1a('0x3b')](_0x5d1514[_0xdb1a('0x33')],_0x5a67c4[_0xdb1a('0x3c')]),_0x51a26d);if(_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3d')]){_0x51f0ff[_0xdb1a('0x3e')]=_[_0xdb1a('0x3f')](_0x51f0ff['where'],{'$or':_[_0xdb1a('0x32')](_0x51a26d,function(_0x5ba671){if(_0x5ba671['type']!=='VIRTUAL'){var _0x4a4366={};_0x4a4366[_0x5ba671[_0xdb1a('0x2a')]]={'$like':'%'+_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x3d')]+'%'};return _0x4a4366;}})});}_0x51f0ff=_[_0xdb1a('0x3f')]({},_0x51f0ff,_0x5d1514[_0xdb1a('0x40')]);var _0x5f535d={'where':_0x51f0ff[_0xdb1a('0x3e')]};return db[_0xdb1a('0x2d')][_0xdb1a('0x22')](_0x5f535d)[_0xdb1a('0x41')](function(_0xcffe52){_0xbfa09f[_0xdb1a('0x22')]=_0xcffe52;if(_0x5d1514[_0xdb1a('0x33')][_0xdb1a('0x42')]){_0x51f0ff[_0xdb1a('0x43')]=[{'all':!![]}];}return db[_0xdb1a('0x2d')]['findAll'](_0x51f0ff);})['then'](function(_0x43e27a){_0xbfa09f[_0xdb1a('0x44')]=_0x43e27a;return _0xbfa09f;})[_0xdb1a('0x41')](respondWithFilteredResult(_0x3ec2f6,_0x51f0ff))[_0xdb1a('0x45')](handleError(_0x3ec2f6,null));};exports[_0xdb1a('0x46')]=function(_0x4572d,_0x149fd6){var _0xad79f2={'raw':!![],'where':{'id':_0x4572d[_0xdb1a('0x47')]['id']}},_0xcb156c={};_0xcb156c[_0xdb1a('0x31')]=_[_0xdb1a('0x34')](db[_0xdb1a('0x2d')]['rawAttributes']);_0xcb156c[_0xdb1a('0x33')]=_[_0xdb1a('0x34')](_0x4572d[_0xdb1a('0x33')]);_0xcb156c[_0xdb1a('0x3c')]=_[_0xdb1a('0x35')](_0xcb156c[_0xdb1a('0x31')],_0xcb156c[_0xdb1a('0x33')]);_0xad79f2['attributes']=_['intersection'](_0xcb156c['model'],qs[_0xdb1a('0x37')](_0x4572d[_0xdb1a('0x33')]['fields']));_0xad79f2[_0xdb1a('0x36')]=_0xad79f2[_0xdb1a('0x36')]['length']?_0xad79f2['attributes']:_0xcb156c[_0xdb1a('0x31')];if(_0x4572d[_0xdb1a('0x33')]['includeAll']){_0xad79f2[_0xdb1a('0x43')]=[{'all':!![]}];}_0xad79f2=_[_0xdb1a('0x3f')]({},_0xad79f2,_0x4572d[_0xdb1a('0x40')]);return db['CmHopperBlack'][_0xdb1a('0x48')](_0xad79f2)[_0xdb1a('0x41')](handleEntityNotFound(_0x149fd6,null))[_0xdb1a('0x41')](respondWithResult(_0x149fd6,null))[_0xdb1a('0x45')](handleError(_0x149fd6,null));};exports['update']=function(_0x37aa5e,_0x452aa8){if(_0x37aa5e[_0xdb1a('0x49')]['id']){delete _0x37aa5e[_0xdb1a('0x49')]['id'];}return db['CmHopperBlack'][_0xdb1a('0x48')]({'where':{'id':_0x37aa5e[_0xdb1a('0x47')]['id']}})[_0xdb1a('0x41')](handleEntityNotFound(_0x452aa8,null))[_0xdb1a('0x41')](saveUpdates(_0x37aa5e[_0xdb1a('0x49')],null))[_0xdb1a('0x41')](respondWithResult(_0x452aa8,null))[_0xdb1a('0x45')](handleError(_0x452aa8,null));};exports[_0xdb1a('0x28')]=function(_0x2bca28,_0x4f187){return db['CmHopperBlack']['find']({'where':{'id':_0x2bca28['params']['id']}})[_0xdb1a('0x41')](handleEntityNotFound(_0x4f187,null))[_0xdb1a('0x41')](removeEntity(_0x4f187,null))[_0xdb1a('0x45')](handleError(_0x4f187,null));};exports[_0xdb1a('0x4a')]=function(_0x32faa7,_0x3e170b){return db[_0xdb1a('0x2d')]['describe']()['then'](respondWithResult(_0x3e170b,null))['catch'](handleError(_0x3e170b,null));};
\ No newline at end of file
+var _0xea41=['fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','sort','filter','where','VIRTUAL','merge','CmHopperBlack','includeAll','include','rows','catch','show','params','options','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0xea41,0xcd));var _0x1ea4=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xea41[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x1ea4('0x0'));var rimraf=require(_0x1ea4('0x1'));var zipdir=require(_0x1ea4('0x2'));var jsonpatch=require(_0x1ea4('0x3'));var rp=require(_0x1ea4('0x4'));var moment=require(_0x1ea4('0x5'));var BPromise=require(_0x1ea4('0x6'));var Mustache=require('mustache');var util=require(_0x1ea4('0x7'));var path=require(_0x1ea4('0x8'));var sox=require('sox');var csv=require(_0x1ea4('0x9'));var ejs=require(_0x1ea4('0xa'));var fs=require('fs');var fs_extra=require(_0x1ea4('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x1ea4('0xc'));var jsforce=require(_0x1ea4('0xd'));var deskjs=require(_0x1ea4('0xe'));var toCsv=require(_0x1ea4('0x9'));var querystring=require(_0x1ea4('0xf'));var Papa=require(_0x1ea4('0x10'));var Redis=require(_0x1ea4('0x11'));var authService=require(_0x1ea4('0x12'));var qs=require(_0x1ea4('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1ea4('0x14'));var logger=require(_0x1ea4('0x15'))(_0x1ea4('0x16'));var utils=require(_0x1ea4('0x17'));var config=require(_0x1ea4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x1ea4('0x19'))['db'];function respondWithStatusCode(_0x29ad89,_0x1c0f87){_0x1c0f87=_0x1c0f87||0xcc;return function(_0x2afbec){if(_0x2afbec){return _0x29ad89[_0x1ea4('0x1a')](_0x1c0f87);}return _0x29ad89['status'](_0x1c0f87)[_0x1ea4('0x1b')]();};}function respondWithResult(_0xd24eeb,_0x27f8b9){_0x27f8b9=_0x27f8b9||0xc8;return function(_0x72e65e){if(_0x72e65e){return _0xd24eeb[_0x1ea4('0x1c')](_0x27f8b9)[_0x1ea4('0x1d')](_0x72e65e);}};}function respondWithFilteredResult(_0x34acd1,_0x476e61){return function(_0x17407d){if(_0x17407d){var _0x54d07a=typeof _0x476e61[_0x1ea4('0x1e')]===_0x1ea4('0x1f')&&typeof _0x476e61[_0x1ea4('0x20')]===_0x1ea4('0x1f');var _0x5476cc=_0x17407d[_0x1ea4('0x21')];var _0x16aa82=_0x54d07a?0x0:_0x476e61['offset'];var _0x105a1e=_0x54d07a?_0x17407d['count']:_0x476e61[_0x1ea4('0x1e')]+_0x476e61[_0x1ea4('0x20')];var _0x59641f;if(_0x105a1e>=_0x5476cc){_0x105a1e=_0x5476cc;_0x59641f=0xc8;}else{_0x59641f=0xce;}_0x34acd1['status'](_0x59641f);return _0x34acd1[_0x1ea4('0x22')](_0x1ea4('0x23'),_0x16aa82+'-'+_0x105a1e+'/'+_0x5476cc)[_0x1ea4('0x1d')](_0x17407d);}return null;};}function patchUpdates(_0x1c8b8c){return function(_0x2fe354){try{jsonpatch[_0x1ea4('0x24')](_0x2fe354,_0x1c8b8c,!![]);}catch(_0x137431){return BPromise[_0x1ea4('0x25')](_0x137431);}return _0x2fe354['save']();};}function saveUpdates(_0x5dbc1a,_0x422f43){return function(_0x5dc113){if(_0x5dc113){return _0x5dc113[_0x1ea4('0x26')](_0x5dbc1a)['then'](function(_0x5309f7){return _0x5309f7;});}return null;};}function removeEntity(_0x562126,_0x53bcd0){return function(_0x2c1d5e){if(_0x2c1d5e){return _0x2c1d5e[_0x1ea4('0x27')]()[_0x1ea4('0x28')](function(){_0x562126['status'](0xcc)[_0x1ea4('0x1b')]();});}};}function handleEntityNotFound(_0x25e4ed,_0x71237e){return function(_0x23cf82){if(!_0x23cf82){_0x25e4ed[_0x1ea4('0x1a')](0x194);}return _0x23cf82;};}function handleError(_0xc71e93,_0x159a12){_0x159a12=_0x159a12||0x1f4;return function(_0x4abe43){logger[_0x1ea4('0x29')](_0x4abe43[_0x1ea4('0x2a')]);if(_0x4abe43[_0x1ea4('0x2b')]){delete _0x4abe43['name'];}_0xc71e93[_0x1ea4('0x1c')](_0x159a12)['send'](_0x4abe43);};}exports[_0x1ea4('0x2c')]=function(_0x44fef7,_0x47ac44){var _0x57044e={},_0xaf0c6e={},_0x194851={'count':0x0,'rows':[]};var _0xdd30b3=_[_0x1ea4('0x2d')](db['CmHopperBlack'][_0x1ea4('0x2e')],function(_0x5b4c7b){return{'name':_0x5b4c7b['fieldName'],'type':_0x5b4c7b[_0x1ea4('0x2f')]['key']};});_0xaf0c6e[_0x1ea4('0x30')]=_[_0x1ea4('0x2d')](_0xdd30b3,_0x1ea4('0x2b'));_0xaf0c6e[_0x1ea4('0x31')]=_[_0x1ea4('0x32')](_0x44fef7[_0x1ea4('0x31')]);_0xaf0c6e[_0x1ea4('0x33')]=_[_0x1ea4('0x34')](_0xaf0c6e['model'],_0xaf0c6e[_0x1ea4('0x31')]);_0x57044e[_0x1ea4('0x35')]=_[_0x1ea4('0x34')](_0xaf0c6e[_0x1ea4('0x30')],qs[_0x1ea4('0x36')](_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x36')]));_0x57044e['attributes']=_0x57044e['attributes'][_0x1ea4('0x37')]?_0x57044e['attributes']:_0xaf0c6e[_0x1ea4('0x30')];if(!_0x44fef7[_0x1ea4('0x31')]['hasOwnProperty']('nolimit')){_0x57044e['limit']=qs[_0x1ea4('0x20')](_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x20')]);_0x57044e['offset']=qs[_0x1ea4('0x1e')](_0x44fef7['query'][_0x1ea4('0x1e')]);}_0x57044e['order']=qs['sort'](_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x38')]);_0x57044e['where']=qs[_0x1ea4('0x33')](_['pick'](_0x44fef7['query'],_0xaf0c6e[_0x1ea4('0x33')]),_0xdd30b3);if(_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x39')]){_0x57044e[_0x1ea4('0x3a')]=_['merge'](_0x57044e['where'],{'$or':_[_0x1ea4('0x2d')](_0xdd30b3,function(_0x40aa91){if(_0x40aa91['type']!==_0x1ea4('0x3b')){var _0x1cf900={};_0x1cf900[_0x40aa91[_0x1ea4('0x2b')]]={'$like':'%'+_0x44fef7[_0x1ea4('0x31')]['filter']+'%'};return _0x1cf900;}})});}_0x57044e=_[_0x1ea4('0x3c')]({},_0x57044e,_0x44fef7['options']);var _0x54986c={'where':_0x57044e[_0x1ea4('0x3a')]};return db[_0x1ea4('0x3d')][_0x1ea4('0x21')](_0x54986c)[_0x1ea4('0x28')](function(_0x1d5f01){_0x194851[_0x1ea4('0x21')]=_0x1d5f01;if(_0x44fef7[_0x1ea4('0x31')][_0x1ea4('0x3e')]){_0x57044e[_0x1ea4('0x3f')]=[{'all':!![]}];}return db[_0x1ea4('0x3d')]['findAll'](_0x57044e);})[_0x1ea4('0x28')](function(_0x3da825){_0x194851[_0x1ea4('0x40')]=_0x3da825;return _0x194851;})[_0x1ea4('0x28')](respondWithFilteredResult(_0x47ac44,_0x57044e))[_0x1ea4('0x41')](handleError(_0x47ac44,null));};exports[_0x1ea4('0x42')]=function(_0x17b63c,_0x57b13b){var _0x2b92ab={'raw':!![],'where':{'id':_0x17b63c[_0x1ea4('0x43')]['id']}},_0x4b4270={};_0x4b4270['model']=_[_0x1ea4('0x32')](db[_0x1ea4('0x3d')][_0x1ea4('0x2e')]);_0x4b4270['query']=_['keys'](_0x17b63c['query']);_0x4b4270[_0x1ea4('0x33')]=_[_0x1ea4('0x34')](_0x4b4270[_0x1ea4('0x30')],_0x4b4270[_0x1ea4('0x31')]);_0x2b92ab[_0x1ea4('0x35')]=_[_0x1ea4('0x34')](_0x4b4270[_0x1ea4('0x30')],qs[_0x1ea4('0x36')](_0x17b63c[_0x1ea4('0x31')][_0x1ea4('0x36')]));_0x2b92ab[_0x1ea4('0x35')]=_0x2b92ab[_0x1ea4('0x35')][_0x1ea4('0x37')]?_0x2b92ab[_0x1ea4('0x35')]:_0x4b4270[_0x1ea4('0x30')];if(_0x17b63c[_0x1ea4('0x31')]['includeAll']){_0x2b92ab[_0x1ea4('0x3f')]=[{'all':!![]}];}_0x2b92ab=_[_0x1ea4('0x3c')]({},_0x2b92ab,_0x17b63c[_0x1ea4('0x44')]);return db[_0x1ea4('0x3d')][_0x1ea4('0x45')](_0x2b92ab)[_0x1ea4('0x28')](handleEntityNotFound(_0x57b13b,null))[_0x1ea4('0x28')](respondWithResult(_0x57b13b,null))[_0x1ea4('0x41')](handleError(_0x57b13b,null));};exports[_0x1ea4('0x26')]=function(_0xcb6bbe,_0x1e3789){if(_0xcb6bbe['body']['id']){delete _0xcb6bbe[_0x1ea4('0x46')]['id'];}return db['CmHopperBlack'][_0x1ea4('0x45')]({'where':{'id':_0xcb6bbe[_0x1ea4('0x43')]['id']}})[_0x1ea4('0x28')](handleEntityNotFound(_0x1e3789,null))[_0x1ea4('0x28')](saveUpdates(_0xcb6bbe[_0x1ea4('0x46')],null))[_0x1ea4('0x28')](respondWithResult(_0x1e3789,null))[_0x1ea4('0x41')](handleError(_0x1e3789,null));};exports[_0x1ea4('0x27')]=function(_0x387af0,_0x1c2a96){return db[_0x1ea4('0x3d')][_0x1ea4('0x45')]({'where':{'id':_0x387af0[_0x1ea4('0x43')]['id']}})[_0x1ea4('0x28')](handleEntityNotFound(_0x1c2a96,null))['then'](removeEntity(_0x1c2a96,null))[_0x1ea4('0x41')](handleError(_0x1c2a96,null));};exports[_0x1ea4('0x47')]=function(_0x4697af,_0x432bd7){return db['CmHopperBlack']['describe']()['then'](respondWithResult(_0x432bd7,null))[_0x1ea4('0x41')](handleError(_0x432bd7,null));};
\ No newline at end of file
index a8b132d..c7fd443 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x970f=['rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x319073,_0x366339){var _0x4acf30=function(_0x13fe40){while(--_0x13fe40){_0x319073['push'](_0x319073['shift']());}};_0x4acf30(++_0x366339);}(_0x970f,0xd9));var _0xf970=function(_0x18a595,_0xf31452){_0x18a595=_0x18a595-0x0;var _0x5b825b=_0x970f[_0x18a595];return _0x5b825b;};'use strict';var _=require(_0xf970('0x0'));var util=require(_0xf970('0x1'));var logger=require(_0xf970('0x2'))(_0xf970('0x3'));var moment=require(_0xf970('0x4'));var BPromise=require(_0xf970('0x5'));var rp=require(_0xf970('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf970('0x7'));var config=require(_0xf970('0x8'));var attributes=require(_0xf970('0x9'));module[_0xf970('0xa')]=function(_0x55d7c5,_0x347104){return _0x55d7c5[_0xf970('0xb')](_0xf970('0xc'),attributes,{'tableName':_0xf970('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8087=['bluebird','request-promise','path','rimraf','../../config/environment','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger','api','moment'];(function(_0x166aa8,_0x338b92){var _0x5a9b90=function(_0x41b565){while(--_0x41b565){_0x166aa8['push'](_0x166aa8['shift']());}};_0x5a9b90(++_0x338b92);}(_0x8087,0x1cf));var _0x7808=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x8087[_0x397cfb];return _0x15fed9;};'use strict';var _=require(_0x7808('0x0'));var util=require(_0x7808('0x1'));var logger=require(_0x7808('0x2'))(_0x7808('0x3'));var moment=require(_0x7808('0x4'));var BPromise=require(_0x7808('0x5'));var rp=require(_0x7808('0x6'));var fs=require('fs');var path=require(_0x7808('0x7'));var rimraf=require(_0x7808('0x8'));var config=require(_0x7808('0x9'));var attributes=require('./cmHopperBlack.attributes');module[_0x7808('0xa')]=function(_0x2eb3d8,_0xc52792){return _0x2eb3d8['define'](_0x7808('0xb'),attributes,{'tableName':_0x7808('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9adbfc3..b2ed8ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x62f0=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','CmHopperBlack','findAll','options','where','limit','include','map','model','attributes','GetCmHopperBlack','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','destroy','moment','bluebird'];(function(_0x56f1d5,_0x2ef718){var _0x134cda=function(_0x53cb26){while(--_0x53cb26){_0x56f1d5['push'](_0x56f1d5['shift']());}};_0x134cda(++_0x2ef718);}(_0x62f0,0x184));var _0x062f=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0x62f0[_0x329905];return _0x3aa42;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x062f('0x0'));var BPromise=require(_0x062f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x062f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x062f('0x3'));var logger=require(_0x062f('0x4'))(_0x062f('0x5'));var config=require(_0x062f('0x6'));var jayson=require(_0x062f('0x7'));var client=jayson[_0x062f('0x8')][_0x062f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x507bec,_0x1d25f5,_0x4d1c51){return new BPromise(function(_0x39c059,_0x5d9c53){return client[_0x062f('0xa')](_0x507bec,_0x4d1c51)[_0x062f('0xb')](function(_0x114bea){logger['info'](_0x062f('0xc'),_0x1d25f5,_0x062f('0xd'));logger[_0x062f('0xe')](_0x062f('0xf'),_0x1d25f5,'request\x20sent',JSON[_0x062f('0x10')](_0x114bea));if(_0x114bea['error']){if(_0x114bea['error'][_0x062f('0x11')]===0x1f4){logger[_0x062f('0x12')](_0x062f('0xc'),_0x1d25f5,_0x114bea[_0x062f('0x12')][_0x062f('0x13')]);return _0x5d9c53(_0x114bea[_0x062f('0x12')]['message']);}logger['error'](_0x062f('0xc'),_0x1d25f5,_0x114bea[_0x062f('0x12')][_0x062f('0x13')]);return _0x39c059(_0x114bea['error'][_0x062f('0x13')]);}else{logger[_0x062f('0x14')](_0x062f('0xc'),_0x1d25f5,_0x062f('0xd'));_0x39c059(_0x114bea[_0x062f('0x15')][_0x062f('0x13')]);}})[_0x062f('0x16')](function(_0x46b014){logger[_0x062f('0x12')](_0x062f('0xc'),_0x1d25f5,_0x46b014);_0x5d9c53(_0x46b014);});});}exports['GetCmHopperBlack']=function(_0x226a31){var _0x470fbd=this;return new Promise(function(_0x46a479,_0x1ab0b0){return db[_0x062f('0x17')][_0x062f('0x18')]({'raw':_0x226a31['options']?_0x226a31[_0x062f('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x226a31[_0x062f('0x19')]?_0x226a31[_0x062f('0x19')][_0x062f('0x1a')]||null:null,'attributes':_0x226a31[_0x062f('0x19')]?_0x226a31[_0x062f('0x19')]['attributes']||null:null,'limit':_0x226a31[_0x062f('0x19')]?_0x226a31[_0x062f('0x19')][_0x062f('0x1b')]||null:null,'include':_0x226a31[_0x062f('0x19')]?_0x226a31[_0x062f('0x19')][_0x062f('0x1c')]?_[_0x062f('0x1d')](_0x226a31[_0x062f('0x19')][_0x062f('0x1c')],function(_0x146deb){return{'model':db[_0x146deb[_0x062f('0x1e')]],'as':_0x146deb['as'],'attributes':_0x146deb[_0x062f('0x1f')],'include':_0x146deb[_0x062f('0x1c')]?_[_0x062f('0x1d')](_0x146deb[_0x062f('0x1c')],function(_0x59f4ed){return{'model':db[_0x59f4ed[_0x062f('0x1e')]],'as':_0x59f4ed['as'],'attributes':_0x59f4ed[_0x062f('0x1f')],'include':_0x59f4ed[_0x062f('0x1c')]?_[_0x062f('0x1d')](_0x59f4ed['include'],function(_0x251090){return{'model':db[_0x251090[_0x062f('0x1e')]],'as':_0x251090['as'],'attributes':_0x251090[_0x062f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x062f('0xb')](function(_0x20bf33){logger[_0x062f('0x14')](_0x062f('0x20'),_0x226a31);logger[_0x062f('0xe')]('GetCmHopperBlack',_0x226a31,JSON[_0x062f('0x10')](_0x20bf33));_0x46a479(_0x20bf33);})[_0x062f('0x16')](function(_0xfba37f){logger[_0x062f('0x12')](_0x062f('0x20'),_0xfba37f[_0x062f('0x13')],_0x226a31);_0x1ab0b0(_0x470fbd['error'](0x1f4,_0xfba37f[_0x062f('0x13')]));});});};exports[_0x062f('0x21')]=function(_0xf94d6a){var _0x2c9a34=this;return new Promise(function(_0x2efa8f,_0x2916b8){return db[_0x062f('0x17')][_0x062f('0x22')](_0xf94d6a[_0x062f('0x23')],{'raw':_0xf94d6a['options']?_0xf94d6a[_0x062f('0x19')][_0x062f('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf94d6a[_0x062f('0x19')]?_0xf94d6a['options'][_0x062f('0x1a')]||null:null,'attributes':_0xf94d6a[_0x062f('0x19')]?_0xf94d6a[_0x062f('0x19')][_0x062f('0x1f')]||null:null,'limit':_0xf94d6a[_0x062f('0x19')]?_0xf94d6a[_0x062f('0x19')][_0x062f('0x1b')]||null:null})[_0x062f('0xb')](function(_0x344463){logger['info'](_0x062f('0x21'),_0xf94d6a);logger[_0x062f('0xe')](_0x062f('0x21'),_0xf94d6a,JSON['stringify'](_0x344463));_0x2efa8f(_0x344463);})['catch'](function(_0x3a475f){logger[_0x062f('0x12')](_0x062f('0x21'),_0x3a475f['message'],_0xf94d6a);_0x2916b8(_0x2c9a34['error'](0x1f4,_0x3a475f[_0x062f('0x13')]));});});};exports[_0x062f('0x25')]=function(_0x1d8a4d){var _0x1b70a8=this;return new Promise(function(_0x5ced5e,_0x221be6){return db[_0x062f('0x17')][_0x062f('0x26')]({'where':_0x1d8a4d[_0x062f('0x19')]?_0x1d8a4d[_0x062f('0x19')][_0x062f('0x1a')]||null:null})['then'](function(_0x2e4b21){logger[_0x062f('0x14')](_0x062f('0x25'),_0x1d8a4d);logger[_0x062f('0xe')](_0x062f('0x25'),_0x1d8a4d,JSON['stringify'](_0x2e4b21));_0x5ced5e(_0x2e4b21);})[_0x062f('0x16')](function(_0x3049e9){logger[_0x062f('0x12')]('DestroyCmHopperBlack',_0x3049e9[_0x062f('0x13')],_0x1d8a4d);_0x221be6(_0x1b70a8[_0x062f('0x12')](0x1f4,_0x3049e9[_0x062f('0x13')]));});});};
\ No newline at end of file
+var _0x19bd=['findAll','options','raw','where','limit','include','model','attributes','map','CmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x19bd,0xae));var _0xd19b=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x19bd[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0xd19b('0x0'));var moment=require(_0xd19b('0x1'));var BPromise=require(_0xd19b('0x2'));var rs=require(_0xd19b('0x3'));var fs=require('fs');var Redis=require(_0xd19b('0x4'));var db=require(_0xd19b('0x5'))['db'];var utils=require(_0xd19b('0x6'));var logger=require('../../config/logger')(_0xd19b('0x7'));var config=require(_0xd19b('0x8'));var jayson=require(_0xd19b('0x9'));var client=jayson[_0xd19b('0xa')][_0xd19b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x51f4a3,_0x347f50,_0x47bcfc){return new BPromise(function(_0x31e214,_0x196ca2){return client[_0xd19b('0xc')](_0x51f4a3,_0x47bcfc)[_0xd19b('0xd')](function(_0x4ac2d7){logger[_0xd19b('0xe')](_0xd19b('0xf'),_0x347f50,'request\x20sent');logger[_0xd19b('0x10')](_0xd19b('0x11'),_0x347f50,_0xd19b('0x12'),JSON[_0xd19b('0x13')](_0x4ac2d7));if(_0x4ac2d7[_0xd19b('0x14')]){if(_0x4ac2d7[_0xd19b('0x14')][_0xd19b('0x15')]===0x1f4){logger['error'](_0xd19b('0xf'),_0x347f50,_0x4ac2d7[_0xd19b('0x14')]['message']);return _0x196ca2(_0x4ac2d7['error']['message']);}logger['error'](_0xd19b('0xf'),_0x347f50,_0x4ac2d7[_0xd19b('0x14')][_0xd19b('0x16')]);return _0x31e214(_0x4ac2d7['error'][_0xd19b('0x16')]);}else{logger[_0xd19b('0xe')](_0xd19b('0xf'),_0x347f50,'request\x20sent');_0x31e214(_0x4ac2d7[_0xd19b('0x17')][_0xd19b('0x16')]);}})[_0xd19b('0x18')](function(_0x194aef){logger[_0xd19b('0x14')](_0xd19b('0xf'),_0x347f50,_0x194aef);_0x196ca2(_0x194aef);});});}exports[_0xd19b('0x19')]=function(_0x1fbc7f){var _0x108677=this;return new Promise(function(_0x9ae7e4,_0x2fabc7){return db['CmHopperBlack'][_0xd19b('0x1a')]({'raw':_0x1fbc7f['options']?_0x1fbc7f[_0xd19b('0x1b')][_0xd19b('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fbc7f[_0xd19b('0x1b')]?_0x1fbc7f['options'][_0xd19b('0x1d')]||null:null,'attributes':_0x1fbc7f[_0xd19b('0x1b')]?_0x1fbc7f[_0xd19b('0x1b')]['attributes']||null:null,'limit':_0x1fbc7f[_0xd19b('0x1b')]?_0x1fbc7f['options'][_0xd19b('0x1e')]||null:null,'include':_0x1fbc7f[_0xd19b('0x1b')]?_0x1fbc7f[_0xd19b('0x1b')][_0xd19b('0x1f')]?_['map'](_0x1fbc7f['options']['include'],function(_0x5e65d8){return{'model':db[_0x5e65d8[_0xd19b('0x20')]],'as':_0x5e65d8['as'],'attributes':_0x5e65d8[_0xd19b('0x21')],'include':_0x5e65d8[_0xd19b('0x1f')]?_[_0xd19b('0x22')](_0x5e65d8[_0xd19b('0x1f')],function(_0xa9a56b){return{'model':db[_0xa9a56b[_0xd19b('0x20')]],'as':_0xa9a56b['as'],'attributes':_0xa9a56b[_0xd19b('0x21')],'include':_0xa9a56b[_0xd19b('0x1f')]?_[_0xd19b('0x22')](_0xa9a56b[_0xd19b('0x1f')],function(_0x413e88){return{'model':db[_0x413e88[_0xd19b('0x20')]],'as':_0x413e88['as'],'attributes':_0x413e88['attributes']};}):[]};}):[]};}):[]:[]})[_0xd19b('0xd')](function(_0x31bfd1){logger[_0xd19b('0xe')](_0xd19b('0x19'),_0x1fbc7f);logger[_0xd19b('0x10')]('GetCmHopperBlack',_0x1fbc7f,JSON['stringify'](_0x31bfd1));_0x9ae7e4(_0x31bfd1);})['catch'](function(_0x21d3c2){logger[_0xd19b('0x14')](_0xd19b('0x19'),_0x21d3c2[_0xd19b('0x16')],_0x1fbc7f);_0x2fabc7(_0x108677['error'](0x1f4,_0x21d3c2[_0xd19b('0x16')]));});});};exports['UpdateCmHopperBlack']=function(_0x3b37b8){var _0x6a573e=this;return new Promise(function(_0x1fa3fb,_0x18db6f){return db[_0xd19b('0x23')][_0xd19b('0x24')](_0x3b37b8[_0xd19b('0x25')],{'raw':_0x3b37b8[_0xd19b('0x1b')]?_0x3b37b8[_0xd19b('0x1b')][_0xd19b('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b37b8['options']?_0x3b37b8[_0xd19b('0x1b')][_0xd19b('0x1d')]||null:null,'attributes':_0x3b37b8['options']?_0x3b37b8[_0xd19b('0x1b')][_0xd19b('0x21')]||null:null,'limit':_0x3b37b8['options']?_0x3b37b8[_0xd19b('0x1b')][_0xd19b('0x1e')]||null:null})[_0xd19b('0xd')](function(_0x214bd3){logger[_0xd19b('0xe')](_0xd19b('0x26'),_0x3b37b8);logger[_0xd19b('0x10')](_0xd19b('0x26'),_0x3b37b8,JSON['stringify'](_0x214bd3));_0x1fa3fb(_0x214bd3);})[_0xd19b('0x18')](function(_0x380d82){logger[_0xd19b('0x14')](_0xd19b('0x26'),_0x380d82[_0xd19b('0x16')],_0x3b37b8);_0x18db6f(_0x6a573e[_0xd19b('0x14')](0x1f4,_0x380d82[_0xd19b('0x16')]));});});};exports[_0xd19b('0x27')]=function(_0x53bbff){var _0x1607ec=this;return new Promise(function(_0x544b9a,_0x1c03fe){return db[_0xd19b('0x23')]['destroy']({'where':_0x53bbff['options']?_0x53bbff['options'][_0xd19b('0x1d')]||null:null})[_0xd19b('0xd')](function(_0x2f1edd){logger[_0xd19b('0xe')](_0xd19b('0x27'),_0x53bbff);logger[_0xd19b('0x10')]('DestroyCmHopperBlack',_0x53bbff,JSON[_0xd19b('0x13')](_0x2f1edd));_0x544b9a(_0x2f1edd);})[_0xd19b('0x18')](function(_0x392205){logger['error'](_0xd19b('0x27'),_0x392205['message'],_0x53bbff);_0x1c03fe(_0x1607ec[_0xd19b('0x14')](0x1f4,_0x392205[_0xd19b('0x16')]));});});};
\ No newline at end of file
index 344c49c..c30ec21 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['isAuthenticated','index','/describe','/:id','show','update','destroy','multer','util','path','connect-timeout','express','Router','../../config/environment','./cmHopperBlack.controller','get'];(function(_0x48b16a,_0x2bcfab){var _0x530dea=function(_0x45ad04){while(--_0x45ad04){_0x48b16a['push'](_0x48b16a['shift']());}};_0x530dea(++_0x2bcfab);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['put'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router['delete'](_0xac4a('0xc'),auth['isAuthenticated'](),controller[_0xac4a('0xf')]);module['exports']=router;
\ No newline at end of file
+var _0xffd6=['path','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','show','/:id','update','delete','destroy','multer','util'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xffd6,0x97));var _0x6ffd=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0xffd6[_0x1c6ef2];return _0x404b8c;};'use strict';var multer=require(_0x6ffd('0x0'));var util=require(_0x6ffd('0x1'));var path=require(_0x6ffd('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6ffd('0x3')]();var fs_extra=require(_0x6ffd('0x4'));var auth=require(_0x6ffd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6ffd('0x6'));var controller=require(_0x6ffd('0x7'));router[_0x6ffd('0x8')]('/',auth[_0x6ffd('0x9')](),controller['index']);router[_0x6ffd('0x8')](_0x6ffd('0xa'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xb')]);router[_0x6ffd('0x8')]('/:id',auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xc')]);router['put'](_0x6ffd('0xd'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0xe')]);router[_0x6ffd('0xf')](_0x6ffd('0xd'),auth[_0x6ffd('0x9')](),controller[_0x6ffd('0x10')]);module['exports']=router;
\ No newline at end of file
index aeb2205..fdfa0ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ef7=['getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','moment','exports','INTEGER','STRING','DATE'];(function(_0x339129,_0x86dcc6){var _0x1570df=function(_0x3b537e){while(--_0x3b537e){_0x339129['push'](_0x339129['shift']());}};_0x1570df(++_0x86dcc6);}(_0x7ef7,0x192));var _0x77ef=function(_0x484f9a,_0x30e92c){_0x484f9a=_0x484f9a-0x0;var _0x2ffcc1=_0x7ef7[_0x484f9a];return _0x2ffcc1;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x77ef('0x0'));module[_0x77ef('0x1')]={'state':{'type':Sequelize[_0x77ef('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x77ef('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x77ef('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x77ef('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x77ef('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x77ef('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x77ef('0x3')]},'starttime':{'type':Sequelize[_0x77ef('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x77ef('0x4')]},'droptime':{'type':Sequelize[_0x77ef('0x4')]},'endtime':{'type':Sequelize[_0x77ef('0x4')]},'ringtime':{'type':Sequelize[_0x77ef('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x77ef('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x77ef('0x3')]},'campaign':{'type':Sequelize[_0x77ef('0x3')]},'campaigntype':{'type':Sequelize[_0x77ef('0x3')]},'membername':{'type':Sequelize[_0x77ef('0x3')]},'reason':{'type':Sequelize[_0x77ef('0x3')]},'disposition':{'type':Sequelize[_0x77ef('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0x77ef('0x4')],'set':function(_0x1748c7){var _0x48c015=this[_0x77ef('0x5')](_0x77ef('0x6'));if(_0x48c015&&_0x1748c7){this[_0x77ef('0x7')](_0x77ef('0x8'),moment(_0x1748c7)[_0x77ef('0x9')](moment(_0x48c015),'seconds'));}}},'amd':{'type':Sequelize[_0x77ef('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x77ef('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x77ef('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x77ef('0x4')]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x77ef('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x77ef('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x77ef('0x4')]},'recallme':{'type':Sequelize[_0x77ef('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x77ef('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x77ef('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x77ef('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x77ef('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0x8fb6=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','diff','BOOLEAN','sequelize','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8fb6,0xfb));var _0x68fb=function(_0x408704,_0x139393){_0x408704=_0x408704-0x0;var _0x3dfbc7=_0x8fb6[_0x408704];return _0x3dfbc7;};'use strict';var Sequelize=require(_0x68fb('0x0'));var moment=require(_0x68fb('0x1'));module[_0x68fb('0x2')]={'state':{'type':Sequelize[_0x68fb('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x68fb('0x4')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x68fb('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x68fb('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x68fb('0x4')]},'starttime':{'type':Sequelize[_0x68fb('0x5')]},'responsetime':{'type':Sequelize[_0x68fb('0x5')]},'answertime':{'type':Sequelize[_0x68fb('0x5')]},'droptime':{'type':Sequelize[_0x68fb('0x5')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x68fb('0x4')]},'campaign':{'type':Sequelize[_0x68fb('0x4')]},'campaigntype':{'type':Sequelize[_0x68fb('0x4')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x68fb('0x4')]},'disposition':{'type':Sequelize[_0x68fb('0x4')]},'secondDisposition':{'type':Sequelize[_0x68fb('0x4')]},'thirdDisposition':{'type':Sequelize[_0x68fb('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x5e323b){var _0x51556a=this[_0x68fb('0x6')](_0x68fb('0x7'));if(_0x51556a&&_0x5e323b){this[_0x68fb('0x8')]('followuptime',moment(_0x5e323b)[_0x68fb('0x9')](moment(_0x51556a),'seconds'));}}},'amd':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x68fb('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x68fb('0x5')]},'deleted':{'type':Sequelize[_0x68fb('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x68fb('0x5')]},'recallme':{'type':Sequelize[_0x68fb('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x68fb('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x68fb('0x3')],'defaultValue':0x0}};
\ No newline at end of file
index b2b35cd..70bf034 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeda8=['calleridnum','state\x20=\x204','group','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','index','map','CmHopperFinal','rawAttributes','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','includeAll','include','rows','catch','show','params','keys','options','find','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','VoiceQueue','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','select'];(function(_0xd0a847,_0x72562b){var _0x2536ec=function(_0x20e4db){while(--_0x20e4db){_0xd0a847['push'](_0xd0a847['shift']());}};_0x2536ec(++_0x72562b);}(_0xeda8,0x104));var _0x8eda=function(_0x22ec02,_0x13aeab){_0x22ec02=_0x22ec02-0x0;var _0x2f6e3d=_0xeda8[_0x22ec02];return _0x2f6e3d;};'use strict';var emlformat=require(_0x8eda('0x0'));var rimraf=require(_0x8eda('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8eda('0x2'));var rp=require(_0x8eda('0x3'));var moment=require(_0x8eda('0x4'));var BPromise=require(_0x8eda('0x5'));var Mustache=require(_0x8eda('0x6'));var util=require(_0x8eda('0x7'));var path=require(_0x8eda('0x8'));var sox=require(_0x8eda('0x9'));var csv=require(_0x8eda('0xa'));var ejs=require(_0x8eda('0xb'));var fs=require('fs');var fs_extra=require(_0x8eda('0xc'));var _=require(_0x8eda('0xd'));var squel=require('squel');var crypto=require(_0x8eda('0xe'));var jsforce=require(_0x8eda('0xf'));var deskjs=require(_0x8eda('0x10'));var toCsv=require(_0x8eda('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8eda('0x11'));var as=require(_0x8eda('0x12'));var hardwareService=require(_0x8eda('0x13'));var logger=require('../../config/logger')(_0x8eda('0x14'));var utils=require('../../config/utils');var config=require(_0x8eda('0x15'));var licenseUtil=require(_0x8eda('0x16'));var db=require(_0x8eda('0x17'))['db'];function respondWithStatusCode(_0x1ad3df,_0x337573){_0x337573=_0x337573||0xcc;return function(_0x3af00c){if(_0x3af00c){return _0x1ad3df[_0x8eda('0x18')](_0x337573);}return _0x1ad3df[_0x8eda('0x19')](_0x337573)['end']();};}function respondWithResult(_0x500bd4,_0xe04d90){_0xe04d90=_0xe04d90||0xc8;return function(_0x223dcf){if(_0x223dcf){return _0x500bd4['status'](_0xe04d90)[_0x8eda('0x1a')](_0x223dcf);}};}function respondWithFilteredResult(_0x34b1ee,_0x123905){return function(_0x56ff8a){if(_0x56ff8a){var _0x3f2925=typeof _0x123905['offset']===_0x8eda('0x1b')&&typeof _0x123905['limit']===_0x8eda('0x1b');var _0x58023b=_0x56ff8a[_0x8eda('0x1c')];var _0x2a4d2b=_0x3f2925?0x0:_0x123905['offset'];var _0x5e44b7=_0x3f2925?_0x56ff8a[_0x8eda('0x1c')]:_0x123905[_0x8eda('0x1d')]+_0x123905[_0x8eda('0x1e')];var _0x41abfa;if(_0x5e44b7>=_0x58023b){_0x5e44b7=_0x58023b;_0x41abfa=0xc8;}else{_0x41abfa=0xce;}_0x34b1ee[_0x8eda('0x19')](_0x41abfa);return _0x34b1ee[_0x8eda('0x1f')](_0x8eda('0x20'),_0x2a4d2b+'-'+_0x5e44b7+'/'+_0x58023b)[_0x8eda('0x1a')](_0x56ff8a);}return null;};}function patchUpdates(_0x850cce){return function(_0x232786){try{jsonpatch[_0x8eda('0x21')](_0x232786,_0x850cce,!![]);}catch(_0x57f336){return BPromise[_0x8eda('0x22')](_0x57f336);}return _0x232786['save']();};}function saveUpdates(_0x45517e,_0x5183bc){return function(_0x1033d6){if(_0x1033d6){return _0x1033d6[_0x8eda('0x23')](_0x45517e)['then'](function(_0x58e54b){return _0x58e54b;});}return null;};}function removeEntity(_0x56dba4,_0x2a4c99){return function(_0x17cae8){if(_0x17cae8){return _0x17cae8['destroy']()[_0x8eda('0x24')](function(){_0x56dba4[_0x8eda('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25e955,_0xfa57ca){return function(_0x24b1e1){if(!_0x24b1e1){_0x25e955[_0x8eda('0x18')](0x194);}return _0x24b1e1;};}function handleError(_0x2e42e4,_0x5c8488){_0x5c8488=_0x5c8488||0x1f4;return function(_0x41b5a9){logger['error'](_0x41b5a9[_0x8eda('0x25')]);if(_0x41b5a9[_0x8eda('0x26')]){delete _0x41b5a9[_0x8eda('0x26')];}_0x2e42e4['status'](_0x5c8488)[_0x8eda('0x27')](_0x41b5a9);};}exports[_0x8eda('0x28')]=function(_0x1dd12,_0x4cdd2e){var _0x1616ea={},_0x11a999={},_0x5dd315={'count':0x0,'rows':[]};var _0x27d2ce=_[_0x8eda('0x29')](db[_0x8eda('0x2a')][_0x8eda('0x2b')],function(_0x53274e){return{'name':_0x53274e['fieldName'],'type':_0x53274e['type'][_0x8eda('0x2c')]};});_0x11a999[_0x8eda('0x2d')]=_[_0x8eda('0x29')](_0x27d2ce,'name');_0x11a999['query']=_['keys'](_0x1dd12[_0x8eda('0x2e')]);_0x11a999[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x11a999['model'],_0x11a999['query']);_0x1616ea['attributes']=_[_0x8eda('0x30')](_0x11a999[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x31')]));_0x1616ea[_0x8eda('0x32')]=_0x1616ea[_0x8eda('0x32')][_0x8eda('0x33')]?_0x1616ea[_0x8eda('0x32')]:_0x11a999[_0x8eda('0x2d')];if(!_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x34')](_0x8eda('0x35'))){_0x1616ea[_0x8eda('0x1e')]=qs['limit'](_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x1e')]);_0x1616ea[_0x8eda('0x1d')]=qs['offset'](_0x1dd12['query'][_0x8eda('0x1d')]);}_0x1616ea[_0x8eda('0x36')]=qs[_0x8eda('0x37')](_0x1dd12[_0x8eda('0x2e')]['sort']);_0x1616ea[_0x8eda('0x38')]=qs[_0x8eda('0x2f')](_[_0x8eda('0x39')](_0x1dd12[_0x8eda('0x2e')],_0x11a999[_0x8eda('0x2f')]),_0x27d2ce);if(_0x1dd12[_0x8eda('0x2e')]['filter']){_0x1616ea[_0x8eda('0x38')]=_[_0x8eda('0x3a')](_0x1616ea[_0x8eda('0x38')],{'$or':_[_0x8eda('0x29')](_0x27d2ce,function(_0x261e12){if(_0x261e12[_0x8eda('0x3b')]!=='VIRTUAL'){var _0x1067eb={};_0x1067eb[_0x261e12[_0x8eda('0x26')]]={'$like':'%'+_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3c')]+'%'};return _0x1067eb;}})});}_0x1616ea=_[_0x8eda('0x3a')]({},_0x1616ea,_0x1dd12['options']);var _0x17ee80={'where':_0x1616ea[_0x8eda('0x38')]};return db[_0x8eda('0x2a')]['count'](_0x17ee80)[_0x8eda('0x24')](function(_0x5d361e){_0x5dd315[_0x8eda('0x1c')]=_0x5d361e;if(_0x1dd12[_0x8eda('0x2e')][_0x8eda('0x3d')]){_0x1616ea[_0x8eda('0x3e')]=[{'all':!![]}];}return db[_0x8eda('0x2a')]['findAll'](_0x1616ea);})['then'](function(_0xbf14a1){_0x5dd315[_0x8eda('0x3f')]=_0xbf14a1;return _0x5dd315;})[_0x8eda('0x24')](respondWithFilteredResult(_0x4cdd2e,_0x1616ea))[_0x8eda('0x40')](handleError(_0x4cdd2e,null));};exports[_0x8eda('0x41')]=function(_0x13b3bc,_0x18b043){var _0xcb6164={'raw':!![],'where':{'id':_0x13b3bc[_0x8eda('0x42')]['id']}},_0x184590={};_0x184590[_0x8eda('0x2d')]=_[_0x8eda('0x43')](db[_0x8eda('0x2a')][_0x8eda('0x2b')]);_0x184590[_0x8eda('0x2e')]=_[_0x8eda('0x43')](_0x13b3bc[_0x8eda('0x2e')]);_0x184590[_0x8eda('0x2f')]=_[_0x8eda('0x30')](_0x184590['model'],_0x184590[_0x8eda('0x2e')]);_0xcb6164[_0x8eda('0x32')]=_['intersection'](_0x184590[_0x8eda('0x2d')],qs[_0x8eda('0x31')](_0x13b3bc['query'][_0x8eda('0x31')]));_0xcb6164[_0x8eda('0x32')]=_0xcb6164['attributes'][_0x8eda('0x33')]?_0xcb6164[_0x8eda('0x32')]:_0x184590[_0x8eda('0x2d')];if(_0x13b3bc['query'][_0x8eda('0x3d')]){_0xcb6164[_0x8eda('0x3e')]=[{'all':!![]}];}_0xcb6164=_[_0x8eda('0x3a')]({},_0xcb6164,_0x13b3bc[_0x8eda('0x44')]);return db[_0x8eda('0x2a')][_0x8eda('0x45')](_0xcb6164)[_0x8eda('0x24')](handleEntityNotFound(_0x18b043,null))['then'](respondWithResult(_0x18b043,null))[_0x8eda('0x40')](handleError(_0x18b043,null));};exports['describe']=function(_0xcde3e,_0x52b026){return db[_0x8eda('0x2a')]['describe']()[_0x8eda('0x24')](respondWithResult(_0x52b026,null))['catch'](handleError(_0x52b026,null));};exports[_0x8eda('0x23')]=function(_0x3aca19,_0xf445){if(_0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')]){delete _0x3aca19[_0x8eda('0x46')][_0x8eda('0x47')];}return db[_0x8eda('0x2a')][_0x8eda('0x45')]({'where':{'uniqueid':_0x3aca19[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0xf445,null))[_0x8eda('0x24')](saveUpdates(_0x3aca19['body'],null))[_0x8eda('0x24')](respondWithResult(_0xf445,null))[_0x8eda('0x40')](handleError(_0xf445,null));};exports[_0x8eda('0x48')]=function(_0x3259de,_0x33ba39,_0x389399){return db[_0x8eda('0x2a')][_0x8eda('0x49')]({'raw':![],'where':{'VoiceQueueId':_0x3259de[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),'noAnswerContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x205,\x201,\x20null'))),_0x8eda('0x4f')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x50')))),'congestionContacts'],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x53')))),'abandonedContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x8eda('0x54')],[db['sequelize']['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x55')))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x33ba39,null))['then'](respondWithResult(_0x33ba39,null))[_0x8eda('0x40')](handleError(_0x33ba39,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xdd71ce,_0x4ba827,_0xfb98bf){return db['CmHopperFinal'][_0x8eda('0x49')]({'raw':![],'where':{'CampaignId':_0xdd71ce[_0x8eda('0x42')]['id']},'attributes':[[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x8eda('0x4c')](_0x8eda('0x4d')))),'noSuchContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x4e')))),_0x8eda('0x57')],[db['sequelize']['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x58')))),'busyContacts'],[db[_0x8eda('0x4a')]['fn']('COUNT',db[_0x8eda('0x4a')]['fn']('IF',db['sequelize'][_0x8eda('0x4c')]('`state`\x20=\x208,\x201,\x20null'))),_0x8eda('0x59')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')](_0x8eda('0x51')))),_0x8eda('0x52')],[db[_0x8eda('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x8eda('0x4a')]['literal'](_0x8eda('0x53')))),_0x8eda('0x5a')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x8eda('0x5b')))),_0x8eda('0x54')],[db[_0x8eda('0x4a')]['fn'](_0x8eda('0x4b'),db[_0x8eda('0x4a')]['fn']('IF',db[_0x8eda('0x4a')][_0x8eda('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x8eda('0x56')]]})[_0x8eda('0x24')](handleEntityNotFound(_0x4ba827,null))['then'](respondWithResult(_0x4ba827,null))[_0x8eda('0x40')](handleError(_0x4ba827,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x47f57c,_0x49d1a1,_0x5e66cd){return db[_0x8eda('0x5c')][_0x8eda('0x45')]({'where':{'id':_0x47f57c[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x49d1a1,null))[_0x8eda('0x24')](function(_0xe5d324){var _0x589c2f;if(_0xe5d324){_0x589c2f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')](['phone',_0x8eda('0x61'),_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x64'),_0x8eda('0x65'),_0x8eda('0x66')],squel['select']()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),_0x8eda('0x61'))[_0x8eda('0x67')](_0x8eda('0x6b'),_0x8eda('0x62'))[_0x8eda('0x67')](_0x8eda('0x6c'),_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x6d'),'VoiceQueueId')['field'](_0x8eda('0x6a'),_0x8eda('0x65'))[_0x8eda('0x67')](_0x8eda('0x6a'),'updatedAt')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x70'),_0x47f57c['params']['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x47f57c['body'][_0x8eda('0x73')][_0x8eda('0x71')]())[_0x8eda('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')]('phone')['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c[_0x8eda('0x42')]['id']['toString']()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x76'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x70'),_0x47f57c['params']['id']['toString']())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x589c2f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x49d1a1,null))[_0x8eda('0x40')](handleError(_0x49d1a1,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1bbe8b,_0x437c6f,_0x1006b1){return db['Campaign'][_0x8eda('0x45')]({'where':{'id':_0x1bbe8b[_0x8eda('0x42')]['id']}})[_0x8eda('0x24')](handleEntityNotFound(_0x437c6f,null))[_0x8eda('0x24')](function(_0x33350e){var _0x3e245f;if(_0x33350e){_0x3e245f=squel[_0x8eda('0x5d')]()[_0x8eda('0x5e')](_0x8eda('0x5f'))[_0x8eda('0x60')]([_0x8eda('0x69'),'scheduledAt',_0x8eda('0x62'),_0x8eda('0x63'),_0x8eda('0x79'),_0x8eda('0x65'),_0x8eda('0x66')],squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x68'),_0x8eda('0x69'))[_0x8eda('0x67')](_0x8eda('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)',_0x8eda('0x62'))[_0x8eda('0x67')]('ANY_VALUE(ListId)',_0x8eda('0x63'))[_0x8eda('0x67')](_0x8eda('0x7a'),'CampaignId')[_0x8eda('0x67')]('NOW()',_0x8eda('0x65'))['field'](_0x8eda('0x6a'),_0x8eda('0x66'))['from'](_0x8eda('0x6f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())[_0x8eda('0x38')](_0x8eda('0x72'),_0x1bbe8b[_0x8eda('0x46')][_0x8eda('0x73')][_0x8eda('0x71')]())['where']('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x8eda('0x75')]()[_0x8eda('0x67')](_0x8eda('0x69'))['from'](_0x8eda('0x5f'))[_0x8eda('0x38')](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]()))[_0x8eda('0x38')](_0x8eda('0x74'),squel[_0x8eda('0x75')]()['field']('calleridnum')[_0x8eda('0x6e')](_0x8eda('0x6f'))['where'](_0x8eda('0x7b'),_0x1bbe8b[_0x8eda('0x42')]['id'][_0x8eda('0x71')]())['where'](_0x8eda('0x77')))[_0x8eda('0x78')](_0x8eda('0x62')))[_0x8eda('0x71')]();return db[_0x8eda('0x4a')][_0x8eda('0x2e')](_0x3e245f);}return[];})[_0x8eda('0x24')](respondWithResult(_0x437c6f,null))['catch'](handleError(_0x437c6f,null));};exports[_0x8eda('0x7c')]=function(_0x11f734,_0x4cb4e6,_0x5d8512){return db['CmHopper'][_0x8eda('0x7d')]({'where':{'VoiceQueueId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x64')],'CampaignId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x79')],'ContactId':_0x11f734[_0x8eda('0x46')][_0x8eda('0x62')]}})[_0x8eda('0x24')](handleEntityNotFound(_0x4cb4e6,null))[_0x8eda('0x24')](function(_0x1a3993){if(_0x1a3993){return _0x1a3993;}return null;})[_0x8eda('0x24')](respondWithResult(_0x4cb4e6,null))[_0x8eda('0x40')](handleError(_0x4cb4e6,null));};
\ No newline at end of file
+var _0x1883=['abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','noAnswerContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','cm_hopper','fromQuery','scheduledAt','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','phone','NOW()','ContactId','field','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','apply','update','then','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','includeAll','include','findAll','params','catch','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null'];(function(_0x41699e,_0x577c18){var _0x2d2e81=function(_0x298afc){while(--_0x298afc){_0x41699e['push'](_0x41699e['shift']());}};_0x2d2e81(++_0x577c18);}(_0x1883,0xab));var _0x3188=function(_0x2da69d,_0x16eabf){_0x2da69d=_0x2da69d-0x0;var _0x100d09=_0x1883[_0x2da69d];return _0x100d09;};'use strict';var emlformat=require(_0x3188('0x0'));var rimraf=require(_0x3188('0x1'));var zipdir=require(_0x3188('0x2'));var jsonpatch=require(_0x3188('0x3'));var rp=require(_0x3188('0x4'));var moment=require(_0x3188('0x5'));var BPromise=require(_0x3188('0x6'));var Mustache=require(_0x3188('0x7'));var util=require(_0x3188('0x8'));var path=require(_0x3188('0x9'));var sox=require(_0x3188('0xa'));var csv=require(_0x3188('0xb'));var ejs=require(_0x3188('0xc'));var fs=require('fs');var fs_extra=require(_0x3188('0xd'));var _=require(_0x3188('0xe'));var squel=require(_0x3188('0xf'));var crypto=require(_0x3188('0x10'));var jsforce=require('jsforce');var deskjs=require(_0x3188('0x11'));var toCsv=require(_0x3188('0xb'));var querystring=require('querystring');var Papa=require(_0x3188('0x12'));var Redis=require('ioredis');var authService=require(_0x3188('0x13'));var qs=require(_0x3188('0x14'));var as=require(_0x3188('0x15'));var hardwareService=require(_0x3188('0x16'));var logger=require('../../config/logger')(_0x3188('0x17'));var utils=require(_0x3188('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3188('0x19'))['db'];function respondWithStatusCode(_0x45e94e,_0x20fef6){_0x20fef6=_0x20fef6||0xcc;return function(_0x3ae228){if(_0x3ae228){return _0x45e94e[_0x3188('0x1a')](_0x20fef6);}return _0x45e94e[_0x3188('0x1b')](_0x20fef6)['end']();};}function respondWithResult(_0x276d69,_0x5e0044){_0x5e0044=_0x5e0044||0xc8;return function(_0x4a2f36){if(_0x4a2f36){return _0x276d69[_0x3188('0x1b')](_0x5e0044)['json'](_0x4a2f36);}};}function respondWithFilteredResult(_0x54a87f,_0x32c239){return function(_0x1beead){if(_0x1beead){var _0xa2269=typeof _0x32c239[_0x3188('0x1c')]===_0x3188('0x1d')&&typeof _0x32c239[_0x3188('0x1e')]==='undefined';var _0x19cc72=_0x1beead[_0x3188('0x1f')];var _0x3f5b35=_0xa2269?0x0:_0x32c239[_0x3188('0x1c')];var _0x18a71a=_0xa2269?_0x1beead[_0x3188('0x1f')]:_0x32c239[_0x3188('0x1c')]+_0x32c239[_0x3188('0x1e')];var _0x5bcbba;if(_0x18a71a>=_0x19cc72){_0x18a71a=_0x19cc72;_0x5bcbba=0xc8;}else{_0x5bcbba=0xce;}_0x54a87f[_0x3188('0x1b')](_0x5bcbba);return _0x54a87f[_0x3188('0x20')]('Content-Range',_0x3f5b35+'-'+_0x18a71a+'/'+_0x19cc72)['json'](_0x1beead);}return null;};}function patchUpdates(_0x5d8d62){return function(_0x46a318){try{jsonpatch[_0x3188('0x21')](_0x46a318,_0x5d8d62,!![]);}catch(_0xd292b5){return BPromise['reject'](_0xd292b5);}return _0x46a318['save']();};}function saveUpdates(_0x266260,_0x461286){return function(_0x375077){if(_0x375077){return _0x375077[_0x3188('0x22')](_0x266260)[_0x3188('0x23')](function(_0x4bd5ee){return _0x4bd5ee;});}return null;};}function removeEntity(_0x30cf2c,_0x33f882){return function(_0x5a2e67){if(_0x5a2e67){return _0x5a2e67[_0x3188('0x24')]()['then'](function(){_0x30cf2c['status'](0xcc)[_0x3188('0x25')]();});}};}function handleEntityNotFound(_0x129bd7,_0x87d5a3){return function(_0x1aeaba){if(!_0x1aeaba){_0x129bd7[_0x3188('0x1a')](0x194);}return _0x1aeaba;};}function handleError(_0x2cd060,_0xe57f73){_0xe57f73=_0xe57f73||0x1f4;return function(_0x11021c){logger['error'](_0x11021c[_0x3188('0x26')]);if(_0x11021c[_0x3188('0x27')]){delete _0x11021c['name'];}_0x2cd060[_0x3188('0x1b')](_0xe57f73)[_0x3188('0x28')](_0x11021c);};}exports[_0x3188('0x29')]=function(_0x44db9a,_0x20e6aa){var _0x1f1c6f={},_0x8f810f={},_0x472926={'count':0x0,'rows':[]};var _0x57c21c=_[_0x3188('0x2a')](db['CmHopperFinal'][_0x3188('0x2b')],function(_0x5623f1){return{'name':_0x5623f1[_0x3188('0x2c')],'type':_0x5623f1[_0x3188('0x2d')][_0x3188('0x2e')]};});_0x8f810f[_0x3188('0x2f')]=_[_0x3188('0x2a')](_0x57c21c,_0x3188('0x27'));_0x8f810f[_0x3188('0x30')]=_[_0x3188('0x31')](_0x44db9a[_0x3188('0x30')]);_0x8f810f[_0x3188('0x32')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],_0x8f810f[_0x3188('0x30')]);_0x1f1c6f[_0x3188('0x34')]=_[_0x3188('0x33')](_0x8f810f[_0x3188('0x2f')],qs[_0x3188('0x35')](_0x44db9a[_0x3188('0x30')]['fields']));_0x1f1c6f[_0x3188('0x34')]=_0x1f1c6f['attributes'][_0x3188('0x36')]?_0x1f1c6f[_0x3188('0x34')]:_0x8f810f['model'];if(!_0x44db9a[_0x3188('0x30')][_0x3188('0x37')](_0x3188('0x38'))){_0x1f1c6f[_0x3188('0x1e')]=qs[_0x3188('0x1e')](_0x44db9a[_0x3188('0x30')][_0x3188('0x1e')]);_0x1f1c6f['offset']=qs['offset'](_0x44db9a[_0x3188('0x30')][_0x3188('0x1c')]);}_0x1f1c6f[_0x3188('0x39')]=qs[_0x3188('0x3a')](_0x44db9a['query'][_0x3188('0x3a')]);_0x1f1c6f[_0x3188('0x3b')]=qs[_0x3188('0x32')](_[_0x3188('0x3c')](_0x44db9a['query'],_0x8f810f[_0x3188('0x32')]),_0x57c21c);if(_0x44db9a['query'][_0x3188('0x3d')]){_0x1f1c6f['where']=_[_0x3188('0x3e')](_0x1f1c6f[_0x3188('0x3b')],{'$or':_[_0x3188('0x2a')](_0x57c21c,function(_0x2990c4){if(_0x2990c4[_0x3188('0x2d')]!==_0x3188('0x3f')){var _0x4666b2={};_0x4666b2[_0x2990c4[_0x3188('0x27')]]={'$like':'%'+_0x44db9a[_0x3188('0x30')][_0x3188('0x3d')]+'%'};return _0x4666b2;}})});}_0x1f1c6f=_['merge']({},_0x1f1c6f,_0x44db9a[_0x3188('0x40')]);var _0x2bad0f={'where':_0x1f1c6f[_0x3188('0x3b')]};return db[_0x3188('0x41')][_0x3188('0x1f')](_0x2bad0f)[_0x3188('0x23')](function(_0x5a815d){_0x472926[_0x3188('0x1f')]=_0x5a815d;if(_0x44db9a['query'][_0x3188('0x42')]){_0x1f1c6f[_0x3188('0x43')]=[{'all':!![]}];}return db[_0x3188('0x41')][_0x3188('0x44')](_0x1f1c6f);})[_0x3188('0x23')](function(_0x549ab2){_0x472926['rows']=_0x549ab2;return _0x472926;})['then'](respondWithFilteredResult(_0x20e6aa,_0x1f1c6f))['catch'](handleError(_0x20e6aa,null));};exports['show']=function(_0x763943,_0x28c224){var _0x3e5f90={'raw':!![],'where':{'id':_0x763943[_0x3188('0x45')]['id']}},_0x1b40b1={};_0x1b40b1['model']=_[_0x3188('0x31')](db['CmHopperFinal'][_0x3188('0x2b')]);_0x1b40b1[_0x3188('0x30')]=_[_0x3188('0x31')](_0x763943[_0x3188('0x30')]);_0x1b40b1['filters']=_[_0x3188('0x33')](_0x1b40b1[_0x3188('0x2f')],_0x1b40b1[_0x3188('0x30')]);_0x3e5f90[_0x3188('0x34')]=_[_0x3188('0x33')](_0x1b40b1['model'],qs['fields'](_0x763943[_0x3188('0x30')][_0x3188('0x35')]));_0x3e5f90['attributes']=_0x3e5f90[_0x3188('0x34')][_0x3188('0x36')]?_0x3e5f90['attributes']:_0x1b40b1[_0x3188('0x2f')];if(_0x763943[_0x3188('0x30')][_0x3188('0x42')]){_0x3e5f90[_0x3188('0x43')]=[{'all':!![]}];}_0x3e5f90=_[_0x3188('0x3e')]({},_0x3e5f90,_0x763943['options']);return db[_0x3188('0x41')]['find'](_0x3e5f90)[_0x3188('0x23')](handleEntityNotFound(_0x28c224,null))[_0x3188('0x23')](respondWithResult(_0x28c224,null))[_0x3188('0x46')](handleError(_0x28c224,null));};exports[_0x3188('0x47')]=function(_0xe4cbb0,_0x315524){return db[_0x3188('0x41')][_0x3188('0x47')]()[_0x3188('0x23')](respondWithResult(_0x315524,null))[_0x3188('0x46')](handleError(_0x315524,null));};exports[_0x3188('0x22')]=function(_0x50c08d,_0x50fd56){if(_0x50c08d[_0x3188('0x48')]['uniqueid']){delete _0x50c08d[_0x3188('0x48')][_0x3188('0x49')];}return db['CmHopperFinal'][_0x3188('0x4a')]({'where':{'uniqueid':_0x50c08d[_0x3188('0x45')]['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x50fd56,null))[_0x3188('0x23')](saveUpdates(_0x50c08d[_0x3188('0x48')],null))[_0x3188('0x23')](respondWithResult(_0x50fd56,null))[_0x3188('0x46')](handleError(_0x50fd56,null));};exports[_0x3188('0x4b')]=function(_0x59a177,_0x3b8fe9,_0x3051ce){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'VoiceQueueId':_0x59a177['params']['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x4f')))),'noAnswerContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x50')))),_0x3188('0x51')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x208,\x201,\x20null'))),'congestionContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x52')))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x54')))),_0x3188('0x55')],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})[_0x3188('0x23')](handleEntityNotFound(_0x3b8fe9,null))[_0x3188('0x23')](respondWithResult(_0x3b8fe9,null))[_0x3188('0x46')](handleError(_0x3b8fe9,null));};exports[_0x3188('0x58')]=function(_0x3afd94,_0x447827,_0x27983c){return db['CmHopperFinal'][_0x3188('0x44')]({'raw':![],'where':{'CampaignId':_0x3afd94[_0x3188('0x45')]['id']},'attributes':[[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db['sequelize'][_0x3188('0x4e')](_0x3188('0x59')))),'noSuchContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x4f')))),_0x3188('0x5a')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')]['literal'](_0x3188('0x50')))),'busyContacts'],[db['sequelize']['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x5b')))),_0x3188('0x5c')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db['sequelize']['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x3188('0x53')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x3188('0x55')],[db[_0x3188('0x4c')]['fn']('COUNT',db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')]('`state`\x20=\x2022,\x201,\x20null'))),_0x3188('0x56')],[db[_0x3188('0x4c')]['fn'](_0x3188('0x4d'),db[_0x3188('0x4c')]['fn']('IF',db[_0x3188('0x4c')][_0x3188('0x4e')](_0x3188('0x57')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x447827,null))['then'](respondWithResult(_0x447827,null))['catch'](handleError(_0x447827,null));};exports[_0x3188('0x5d')]=function(_0x693395,_0x3b6a13,_0x30f3b3){return db[_0x3188('0x5e')]['find']({'where':{'id':_0x693395[_0x3188('0x45')]['id']}})['then'](handleEntityNotFound(_0x3b6a13,null))[_0x3188('0x23')](function(_0x96600f){var _0x5b93cd;if(_0x96600f){_0x5b93cd=squel[_0x3188('0x5f')]()['into'](_0x3188('0x60'))[_0x3188('0x61')](['phone',_0x3188('0x62'),'ContactId',_0x3188('0x63'),_0x3188('0x64'),_0x3188('0x65'),_0x3188('0x66')],squel[_0x3188('0x67')]()['field'](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),_0x3188('0x62'))['field']('ANY_VALUE(ContactId)',_0x3188('0x6b'))[_0x3188('0x6c')](_0x3188('0x6d'),_0x3188('0x63'))[_0x3188('0x6c')](_0x3188('0x6e'),'VoiceQueueId')[_0x3188('0x6c')](_0x3188('0x6a'),_0x3188('0x65'))['field'](_0x3188('0x6a'),_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395['params']['id']['toString']())['where'](_0x3188('0x72'),_0x693395[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()['field'](_0x3188('0x69'))[_0x3188('0x6f')](_0x3188('0x60'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x76'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x71'),_0x693395[_0x3188('0x45')]['id'][_0x3188('0x73')]())['where'](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db[_0x3188('0x4c')]['query'](_0x5b93cd);}return[];})[_0x3188('0x23')](respondWithResult(_0x3b6a13,null))[_0x3188('0x46')](handleError(_0x3b6a13,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0xc1ee8e,_0x2ba5a5,_0x43212c){return db['Campaign'][_0x3188('0x4a')]({'where':{'id':_0xc1ee8e['params']['id']}})[_0x3188('0x23')](handleEntityNotFound(_0x2ba5a5,null))[_0x3188('0x23')](function(_0x31029d){var _0xcf9ceb;if(_0x31029d){_0xcf9ceb=squel[_0x3188('0x5f')]()[_0x3188('0x79')]('cm_hopper')['fromQuery']([_0x3188('0x69'),_0x3188('0x62'),_0x3188('0x6b'),_0x3188('0x63'),_0x3188('0x7a'),_0x3188('0x65'),'updatedAt'],squel[_0x3188('0x67')]()[_0x3188('0x6c')](_0x3188('0x68'),_0x3188('0x69'))['field'](_0x3188('0x6a'),'scheduledAt')['field']('ANY_VALUE(ContactId)','ContactId')[_0x3188('0x6c')](_0x3188('0x6d'),'ListId')[_0x3188('0x6c')](_0x3188('0x7b'),'CampaignId')[_0x3188('0x6c')]('NOW()',_0x3188('0x65'))[_0x3188('0x6c')]('NOW()',_0x3188('0x66'))[_0x3188('0x6f')](_0x3188('0x70'))[_0x3188('0x3b')](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x72'),_0xc1ee8e[_0x3188('0x48')]['state'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x74'))['where'](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('phone')['from']('cm_hopper')['where'](_0x3188('0x7c'),_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]()))[_0x3188('0x3b')](_0x3188('0x75'),squel['select']()[_0x3188('0x6c')]('calleridnum')['from'](_0x3188('0x70'))[_0x3188('0x3b')]('CampaignId\x20=\x20?',_0xc1ee8e[_0x3188('0x45')]['id'][_0x3188('0x73')]())[_0x3188('0x3b')](_0x3188('0x77')))[_0x3188('0x78')](_0x3188('0x6b')))[_0x3188('0x73')]();return db['sequelize'][_0x3188('0x30')](_0xcf9ceb);}return[];})[_0x3188('0x23')](respondWithResult(_0x2ba5a5,null))[_0x3188('0x46')](handleError(_0x2ba5a5,null));};exports[_0x3188('0x7d')]=function(_0x203f04,_0x12c18c,_0x11b74c){return db[_0x3188('0x7e')][_0x3188('0x7f')]({'where':{'VoiceQueueId':_0x203f04['body'][_0x3188('0x64')],'CampaignId':_0x203f04['body'][_0x3188('0x7a')],'ContactId':_0x203f04[_0x3188('0x48')][_0x3188('0x6b')]}})[_0x3188('0x23')](handleEntityNotFound(_0x12c18c,null))[_0x3188('0x23')](function(_0x41ca86){if(_0x41ca86){return _0x41ca86;}return null;})[_0x3188('0x23')](respondWithResult(_0x12c18c,null))[_0x3188('0x46')](handleError(_0x12c18c,null));};
\ No newline at end of file
index 3a98783..0d21b5c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc58=['exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3c07d3,_0x200677){var _0xd12e7d=function(_0x1e64eb){while(--_0x1e64eb){_0x3c07d3['push'](_0x3c07d3['shift']());}};_0xd12e7d(++_0x200677);}(_0xdc58,0x156));var _0x8dc5=function(_0x1cd2df,_0x5b6c5f){_0x1cd2df=_0x1cd2df-0x0;var _0x48542b=_0xdc58[_0x1cd2df];return _0x48542b;};'use strict';var _=require(_0x8dc5('0x0'));var util=require(_0x8dc5('0x1'));var logger=require(_0x8dc5('0x2'))(_0x8dc5('0x3'));var moment=require(_0x8dc5('0x4'));var BPromise=require('bluebird');var rp=require(_0x8dc5('0x5'));var fs=require('fs');var path=require(_0x8dc5('0x6'));var rimraf=require(_0x8dc5('0x7'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0x8dc5('0x8')]=function(_0x5cc6e5,_0x1fa4cb){return _0x5cc6e5[_0x8dc5('0x9')](_0x8dc5('0xa'),attributes,{'tableName':_0x8dc5('0xb'),'paranoid':![],'indexes':[{'name':_0x8dc5('0xc'),'fields':[_0x8dc5('0xc')]},{'name':_0x8dc5('0xd'),'fields':[_0x8dc5('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x9d4d=['CmHopperFinal','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x4284b8,_0x5e4f4d){var _0x437393=function(_0x115c06){while(--_0x115c06){_0x4284b8['push'](_0x4284b8['shift']());}};_0x437393(++_0x5e4f4d);}(_0x9d4d,0x1c3));var _0xd9d4=function(_0x27f533,_0x103756){_0x27f533=_0x27f533-0x0;var _0x548ac3=_0x9d4d[_0x27f533];return _0x548ac3;};'use strict';var _=require(_0xd9d4('0x0'));var util=require(_0xd9d4('0x1'));var logger=require(_0xd9d4('0x2'))(_0xd9d4('0x3'));var moment=require(_0xd9d4('0x4'));var BPromise=require(_0xd9d4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd9d4('0x6'));var rimraf=require(_0xd9d4('0x7'));var config=require(_0xd9d4('0x8'));var attributes=require(_0xd9d4('0x9'));module[_0xd9d4('0xa')]=function(_0x3876d5,_0x2263e4){return _0x3876d5['define'](_0xd9d4('0xb'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xd9d4('0xc'),'fields':[_0xd9d4('0xc')]},{'name':_0xd9d4('0xd'),'fields':[_0xd9d4('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index 014b3d6..ebcfbca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x231ff4,_0x1d63e6){var _0x2130b7=function(_0x149b84){while(--_0x149b84){_0x231ff4['push'](_0x231ff4['shift']());}};_0x2130b7(++_0x1d63e6);}(_0x7a54,0x106));var _0x47a5=function(_0x11d0f1,_0x20336d){_0x11d0f1=_0x11d0f1-0x0;var _0x2cbd4c=_0x7a54[_0x11d0f1];return _0x2cbd4c;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});};
\ No newline at end of file
+var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4e48ac,_0x319a3a){var _0x4c9644=function(_0x531f5d){while(--_0x531f5d){_0x4e48ac['push'](_0x4e48ac['shift']());}};_0x4c9644(++_0x319a3a);}(_0xb10b,0x12a));var _0xbb10=function(_0x40b981,_0x48b308){_0x40b981=_0x40b981-0x0;var _0x58696b=_0xb10b[_0x40b981];return _0x58696b;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});};
\ No newline at end of file
index 0ce0677..9ca40e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf95b=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xf95b,0x197));var _0xbf95=function(_0x5c85d2,_0x3165af){_0x5c85d2=_0x5c85d2-0x0;var _0x2d2d10=_0xf95b[_0x5c85d2];return _0x2d2d10;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbf95('0x0'));var timeout=require(_0xbf95('0x1'));var express=require(_0xbf95('0x2'));var router=express[_0xbf95('0x3')]();var fs_extra=require(_0xbf95('0x4'));var auth=require(_0xbf95('0x5'));var interaction=require(_0xbf95('0x6'));var config=require(_0xbf95('0x7'));var controller=require(_0xbf95('0x8'));router[_0xbf95('0x9')]('/',auth[_0xbf95('0xa')](),controller[_0xbf95('0xb')]);router['get'](_0xbf95('0xc'),auth[_0xbf95('0xa')](),controller['describe']);router['get']('/:id',auth[_0xbf95('0xa')](),controller['show']);router[_0xbf95('0x9')](_0xbf95('0xd'),auth[_0xbf95('0xa')](),controller[_0xbf95('0xe')]);router[_0xbf95('0x9')](_0xbf95('0xf'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xbf95('0x10')](_0xbf95('0x11'),auth['isAuthenticated'](),controller[_0xbf95('0x12')]);router[_0xbf95('0x10')](_0xbf95('0x13'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0xbf95('0x10')](_0xbf95('0x14'),auth['isAuthenticated'](),controller[_0xbf95('0x15')]);router[_0xbf95('0x16')]('/:id',auth[_0xbf95('0xa')](),controller[_0xbf95('0x17')]);module[_0xbf95('0x18')]=router;
\ No newline at end of file
+var _0x4e6b=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout'];(function(_0x5a31a3,_0x259687){var _0xdf1131=function(_0x3daac7){while(--_0x3daac7){_0x5a31a3['push'](_0x5a31a3['shift']());}};_0xdf1131(++_0x259687);}(_0x4e6b,0x134));var _0xb4e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4e6b[_0x397e5f];return _0x5302b8;};'use strict';var multer=require(_0xb4e6('0x0'));var util=require(_0xb4e6('0x1'));var path=require(_0xb4e6('0x2'));var timeout=require(_0xb4e6('0x3'));var express=require('express');var router=express[_0xb4e6('0x4')]();var fs_extra=require(_0xb4e6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb4e6('0x6'));var config=require(_0xb4e6('0x7'));var controller=require(_0xb4e6('0x8'));router[_0xb4e6('0x9')]('/',auth[_0xb4e6('0xa')](),controller[_0xb4e6('0xb')]);router[_0xb4e6('0x9')](_0xb4e6('0xc'),auth[_0xb4e6('0xa')](),controller['describe']);router[_0xb4e6('0x9')](_0xb4e6('0xd'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0xe')]);router[_0xb4e6('0x9')](_0xb4e6('0xf'),auth['isAuthenticated'](),controller[_0xb4e6('0x10')]);router['get'](_0xb4e6('0x11'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0x12')]);router[_0xb4e6('0x13')](_0xb4e6('0x14'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0x15')]);router[_0xb4e6('0x13')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router['post'](_0xb4e6('0x16'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0x17')]);router['put'](_0xb4e6('0xd'),auth[_0xb4e6('0xa')](),controller[_0xb4e6('0x18')]);module[_0xb4e6('0x19')]=router;
\ No newline at end of file
index 520f89f..2a66b83 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdbd4=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0xdbd4,0x11c));var _0x4dbd=function(_0x2078bc,_0x5dca97){_0x2078bc=_0x2078bc-0x0;var _0x34de23=_0xdbd4[_0x2078bc];return _0x34de23;};'use strict';var Sequelize=require(_0x4dbd('0x0'));module[_0x4dbd('0x1')]={'state':{'type':Sequelize[_0x4dbd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x4dbd('0x3')]},'scheduledat':{'type':Sequelize[_0x4dbd('0x4')]},'countbusyretry':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x4dbd('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x4dbd('0x3')]},'originatecalleridname':{'type':Sequelize[_0x4dbd('0x3')]},'calleridnum':{'type':Sequelize[_0x4dbd('0x3')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x4dbd('0x4')]},'responsetime':{'type':Sequelize[_0x4dbd('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x4dbd('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x4dbd('0x3')]},'campaign':{'type':Sequelize[_0x4dbd('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x4dbd('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x4dbd('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0x4dbd('0x4')]},'edited':{'type':Sequelize[_0x4dbd('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x4dbd('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x4dbd('0x3')]}};
\ No newline at end of file
+var _0x84eb=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x1e4896,_0x566ad7){var _0x50978a=function(_0x464722){while(--_0x464722){_0x1e4896['push'](_0x1e4896['shift']());}};_0x50978a(++_0x566ad7);}(_0x84eb,0x130));var _0xb84e=function(_0x3c83a6,_0x40429d){_0x3c83a6=_0x3c83a6-0x0;var _0x12baad=_0x84eb[_0x3c83a6];return _0x12baad;};'use strict';var Sequelize=require(_0xb84e('0x0'));module[_0xb84e('0x1')]={'state':{'type':Sequelize[_0xb84e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb84e('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xb84e('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xb84e('0x3')]},'originatecalleridname':{'type':Sequelize[_0xb84e('0x3')]},'calleridnum':{'type':Sequelize[_0xb84e('0x3')]},'calleridname':{'type':Sequelize[_0xb84e('0x3')]},'starttime':{'type':Sequelize[_0xb84e('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xb84e('0x4')]},'endtime':{'type':Sequelize[_0xb84e('0x4')]},'ringtime':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xb84e('0x3')]},'campaign':{'type':Sequelize[_0xb84e('0x3')]},'campaigntype':{'type':Sequelize[_0xb84e('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xb84e('0x3')]},'amd':{'type':Sequelize[_0xb84e('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xb84e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xb84e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xb84e('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'editedat':{'type':Sequelize[_0xb84e('0x4')]},'edited':{'type':Sequelize[_0xb84e('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb84e('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb84e('0x3')]}};
\ No newline at end of file
index 7c8b543..01dc409 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b72=['CmHopperHistory','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','includeAll','include','findAll','rows','show','params','keys','create','body','describe','catch','uniqueid','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','stack','name','send','index','map'];(function(_0x32e2eb,_0x3347b7){var _0x2418ce=function(_0x13ed52){while(--_0x13ed52){_0x32e2eb['push'](_0x32e2eb['shift']());}};_0x2418ce(++_0x3347b7);}(_0x6b72,0x19d));var _0x26b7=function(_0x4938b1,_0x8c5d21){_0x4938b1=_0x4938b1-0x0;var _0x4b2669=_0x6b72[_0x4938b1];return _0x4b2669;};'use strict';var emlformat=require(_0x26b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26b7('0x1'));var jsonpatch=require(_0x26b7('0x2'));var rp=require('request-promise');var moment=require(_0x26b7('0x3'));var BPromise=require(_0x26b7('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x26b7('0x5'));var sox=require(_0x26b7('0x6'));var csv=require(_0x26b7('0x7'));var ejs=require(_0x26b7('0x8'));var fs=require('fs');var fs_extra=require(_0x26b7('0x9'));var _=require(_0x26b7('0xa'));var squel=require(_0x26b7('0xb'));var crypto=require(_0x26b7('0xc'));var jsforce=require(_0x26b7('0xd'));var deskjs=require(_0x26b7('0xe'));var toCsv=require(_0x26b7('0x7'));var querystring=require('querystring');var Papa=require(_0x26b7('0xf'));var Redis=require(_0x26b7('0x10'));var authService=require(_0x26b7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x26b7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x26b7('0x13'))('api');var utils=require(_0x26b7('0x14'));var config=require(_0x26b7('0x15'));var licenseUtil=require(_0x26b7('0x16'));var db=require(_0x26b7('0x17'))['db'];function respondWithStatusCode(_0x5dc52a,_0x2d1fd1){_0x2d1fd1=_0x2d1fd1||0xcc;return function(_0x3def02){if(_0x3def02){return _0x5dc52a[_0x26b7('0x18')](_0x2d1fd1);}return _0x5dc52a[_0x26b7('0x19')](_0x2d1fd1)[_0x26b7('0x1a')]();};}function respondWithResult(_0x1caaa0,_0x33b34d){_0x33b34d=_0x33b34d||0xc8;return function(_0xf54dee){if(_0xf54dee){return _0x1caaa0[_0x26b7('0x19')](_0x33b34d)[_0x26b7('0x1b')](_0xf54dee);}};}function respondWithFilteredResult(_0x57cae7,_0x3304b1){return function(_0x42f377){if(_0x42f377){var _0x1ed5c0=typeof _0x3304b1[_0x26b7('0x1c')]==='undefined'&&typeof _0x3304b1[_0x26b7('0x1d')]===_0x26b7('0x1e');var _0xb34693=_0x42f377[_0x26b7('0x1f')];var _0x3529b5=_0x1ed5c0?0x0:_0x3304b1['offset'];var _0x2876d9=_0x1ed5c0?_0x42f377[_0x26b7('0x1f')]:_0x3304b1[_0x26b7('0x1c')]+_0x3304b1['limit'];var _0x51edda;if(_0x2876d9>=_0xb34693){_0x2876d9=_0xb34693;_0x51edda=0xc8;}else{_0x51edda=0xce;}_0x57cae7[_0x26b7('0x19')](_0x51edda);return _0x57cae7[_0x26b7('0x20')](_0x26b7('0x21'),_0x3529b5+'-'+_0x2876d9+'/'+_0xb34693)[_0x26b7('0x1b')](_0x42f377);}return null;};}function patchUpdates(_0x58f987){return function(_0x97e10d){try{jsonpatch[_0x26b7('0x22')](_0x97e10d,_0x58f987,!![]);}catch(_0x539a73){return BPromise['reject'](_0x539a73);}return _0x97e10d['save']();};}function saveUpdates(_0x515609,_0x30c116){return function(_0x9327dd){if(_0x9327dd){return _0x9327dd[_0x26b7('0x23')](_0x515609)[_0x26b7('0x24')](function(_0x4b8b23){return _0x4b8b23;});}return null;};}function removeEntity(_0x545109,_0x499eb9){return function(_0x105036){if(_0x105036){return _0x105036[_0x26b7('0x25')]()[_0x26b7('0x24')](function(){_0x545109[_0x26b7('0x19')](0xcc)[_0x26b7('0x1a')]();});}};}function handleEntityNotFound(_0x3bc867,_0x1b7b0d){return function(_0x3a0ec0){if(!_0x3a0ec0){_0x3bc867[_0x26b7('0x18')](0x194);}return _0x3a0ec0;};}function handleError(_0x5042f3,_0x49eade){_0x49eade=_0x49eade||0x1f4;return function(_0x16562d){logger['error'](_0x16562d[_0x26b7('0x26')]);if(_0x16562d[_0x26b7('0x27')]){delete _0x16562d[_0x26b7('0x27')];}_0x5042f3[_0x26b7('0x19')](_0x49eade)[_0x26b7('0x28')](_0x16562d);};}exports[_0x26b7('0x29')]=function(_0x1fbfe1,_0x38dff9){var _0x47e14f={},_0x58f1ee={},_0x1080f5={'count':0x0,'rows':[]};var _0xb0d375=_[_0x26b7('0x2a')](db[_0x26b7('0x2b')][_0x26b7('0x2c')],function(_0x2ce45c){return{'name':_0x2ce45c[_0x26b7('0x2d')],'type':_0x2ce45c[_0x26b7('0x2e')][_0x26b7('0x2f')]};});_0x58f1ee[_0x26b7('0x30')]=_['map'](_0xb0d375,_0x26b7('0x27'));_0x58f1ee[_0x26b7('0x31')]=_['keys'](_0x1fbfe1[_0x26b7('0x31')]);_0x58f1ee[_0x26b7('0x32')]=_[_0x26b7('0x33')](_0x58f1ee[_0x26b7('0x30')],_0x58f1ee[_0x26b7('0x31')]);_0x47e14f[_0x26b7('0x34')]=_['intersection'](_0x58f1ee['model'],qs[_0x26b7('0x35')](_0x1fbfe1[_0x26b7('0x31')][_0x26b7('0x35')]));_0x47e14f['attributes']=_0x47e14f[_0x26b7('0x34')][_0x26b7('0x36')]?_0x47e14f[_0x26b7('0x34')]:_0x58f1ee[_0x26b7('0x30')];if(!_0x1fbfe1[_0x26b7('0x31')][_0x26b7('0x37')](_0x26b7('0x38'))){_0x47e14f[_0x26b7('0x1d')]=qs[_0x26b7('0x1d')](_0x1fbfe1[_0x26b7('0x31')][_0x26b7('0x1d')]);_0x47e14f['offset']=qs['offset'](_0x1fbfe1[_0x26b7('0x31')]['offset']);}_0x47e14f['order']=qs[_0x26b7('0x39')](_0x1fbfe1[_0x26b7('0x31')][_0x26b7('0x39')]);_0x47e14f['where']=qs[_0x26b7('0x32')](_[_0x26b7('0x3a')](_0x1fbfe1['query'],_0x58f1ee['filters']),_0xb0d375);if(_0x1fbfe1['query'][_0x26b7('0x3b')]){_0x47e14f['where']=_[_0x26b7('0x3c')](_0x47e14f[_0x26b7('0x3d')],{'$or':_[_0x26b7('0x2a')](_0xb0d375,function(_0x8a1fed){if(_0x8a1fed[_0x26b7('0x2e')]!=='VIRTUAL'){var _0x13f5cc={};_0x13f5cc[_0x8a1fed[_0x26b7('0x27')]]={'$like':'%'+_0x1fbfe1[_0x26b7('0x31')]['filter']+'%'};return _0x13f5cc;}})});}_0x47e14f=_['merge']({},_0x47e14f,_0x1fbfe1[_0x26b7('0x3e')]);var _0x43d9bd={'where':_0x47e14f['where']};return db[_0x26b7('0x2b')][_0x26b7('0x1f')](_0x43d9bd)[_0x26b7('0x24')](function(_0x3337ed){_0x1080f5[_0x26b7('0x1f')]=_0x3337ed;if(_0x1fbfe1[_0x26b7('0x31')][_0x26b7('0x3f')]){_0x47e14f[_0x26b7('0x40')]=[{'all':!![]}];}return db[_0x26b7('0x2b')][_0x26b7('0x41')](_0x47e14f);})[_0x26b7('0x24')](function(_0x32433b){_0x1080f5[_0x26b7('0x42')]=_0x32433b;return _0x1080f5;})[_0x26b7('0x24')](respondWithFilteredResult(_0x38dff9,_0x47e14f))['catch'](handleError(_0x38dff9,null));};exports[_0x26b7('0x43')]=function(_0xf73919,_0x23d5e5){var _0x2b9d53={'raw':!![],'where':{'id':_0xf73919[_0x26b7('0x44')]['id']}},_0xa5ee4b={};_0xa5ee4b[_0x26b7('0x30')]=_[_0x26b7('0x45')](db['CmHopperHistory'][_0x26b7('0x2c')]);_0xa5ee4b['query']=_['keys'](_0xf73919[_0x26b7('0x31')]);_0xa5ee4b[_0x26b7('0x32')]=_[_0x26b7('0x33')](_0xa5ee4b[_0x26b7('0x30')],_0xa5ee4b['query']);_0x2b9d53[_0x26b7('0x34')]=_['intersection'](_0xa5ee4b['model'],qs['fields'](_0xf73919[_0x26b7('0x31')][_0x26b7('0x35')]));_0x2b9d53[_0x26b7('0x34')]=_0x2b9d53[_0x26b7('0x34')][_0x26b7('0x36')]?_0x2b9d53[_0x26b7('0x34')]:_0xa5ee4b[_0x26b7('0x30')];if(_0xf73919[_0x26b7('0x31')][_0x26b7('0x3f')]){_0x2b9d53['include']=[{'all':!![]}];}_0x2b9d53=_['merge']({},_0x2b9d53,_0xf73919['options']);return db[_0x26b7('0x2b')]['find'](_0x2b9d53)[_0x26b7('0x24')](handleEntityNotFound(_0x23d5e5,null))['then'](respondWithResult(_0x23d5e5,null))['catch'](handleError(_0x23d5e5,null));};exports[_0x26b7('0x46')]=function(_0x185c6e,_0x492cdb){return db[_0x26b7('0x2b')][_0x26b7('0x46')](_0x185c6e[_0x26b7('0x47')],{})[_0x26b7('0x24')](respondWithResult(_0x492cdb,0xc9))['catch'](handleError(_0x492cdb,null));};exports[_0x26b7('0x48')]=function(_0x17747b,_0x255d4c){return db[_0x26b7('0x2b')][_0x26b7('0x48')]()['then'](respondWithResult(_0x255d4c,null))[_0x26b7('0x49')](handleError(_0x255d4c,null));};exports[_0x26b7('0x23')]=function(_0x5989d2,_0x5cce29){if(_0x5989d2[_0x26b7('0x47')][_0x26b7('0x4a')]){delete _0x5989d2[_0x26b7('0x47')][_0x26b7('0x4a')];}return db[_0x26b7('0x2b')][_0x26b7('0x4b')]({'where':{'uniqueid':_0x5989d2['params']['id']}})['then'](handleEntityNotFound(_0x5cce29,null))[_0x26b7('0x24')](saveUpdates(_0x5989d2[_0x26b7('0x47')],null))[_0x26b7('0x24')](respondWithResult(_0x5cce29,null))[_0x26b7('0x49')](handleError(_0x5cce29,null));};
\ No newline at end of file
+var _0x372b=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','reject','save','update','then','error','stack','name','index','map','CmHopperHistory','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','describe','uniqueid','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x372b,0xc9));var _0xb372=function(_0x1a84ae,_0x4ea026){_0x1a84ae=_0x1a84ae-0x0;var _0x26bd09=_0x372b[_0x1a84ae];return _0x26bd09;};'use strict';var emlformat=require(_0xb372('0x0'));var rimraf=require(_0xb372('0x1'));var zipdir=require(_0xb372('0x2'));var jsonpatch=require(_0xb372('0x3'));var rp=require('request-promise');var moment=require(_0xb372('0x4'));var BPromise=require(_0xb372('0x5'));var Mustache=require(_0xb372('0x6'));var util=require(_0xb372('0x7'));var path=require(_0xb372('0x8'));var sox=require(_0xb372('0x9'));var csv=require(_0xb372('0xa'));var ejs=require(_0xb372('0xb'));var fs=require('fs');var fs_extra=require(_0xb372('0xc'));var _=require(_0xb372('0xd'));var squel=require('squel');var crypto=require(_0xb372('0xe'));var jsforce=require(_0xb372('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb372('0x10'));var Redis=require('ioredis');var authService=require(_0xb372('0x11'));var qs=require(_0xb372('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb372('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb372('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb372('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275dd0,_0xe981ba){_0xe981ba=_0xe981ba||0xcc;return function(_0x423fff){if(_0x423fff){return _0x275dd0[_0xb372('0x16')](_0xe981ba);}return _0x275dd0[_0xb372('0x17')](_0xe981ba)[_0xb372('0x18')]();};}function respondWithResult(_0x309a3d,_0x55ae5d){_0x55ae5d=_0x55ae5d||0xc8;return function(_0x29604a){if(_0x29604a){return _0x309a3d[_0xb372('0x17')](_0x55ae5d)[_0xb372('0x19')](_0x29604a);}};}function respondWithFilteredResult(_0x4341ff,_0x1d6030){return function(_0x33f1f7){if(_0x33f1f7){var _0x10ef31=typeof _0x1d6030[_0xb372('0x1a')]==='undefined'&&typeof _0x1d6030[_0xb372('0x1b')]===_0xb372('0x1c');var _0xc5dc07=_0x33f1f7['count'];var _0x33f2de=_0x10ef31?0x0:_0x1d6030[_0xb372('0x1a')];var _0x5a44e9=_0x10ef31?_0x33f1f7[_0xb372('0x1d')]:_0x1d6030[_0xb372('0x1a')]+_0x1d6030[_0xb372('0x1b')];var _0x4bb536;if(_0x5a44e9>=_0xc5dc07){_0x5a44e9=_0xc5dc07;_0x4bb536=0xc8;}else{_0x4bb536=0xce;}_0x4341ff[_0xb372('0x17')](_0x4bb536);return _0x4341ff['set'](_0xb372('0x1e'),_0x33f2de+'-'+_0x5a44e9+'/'+_0xc5dc07)[_0xb372('0x19')](_0x33f1f7);}return null;};}function patchUpdates(_0x43b204){return function(_0x4903eb){try{jsonpatch['apply'](_0x4903eb,_0x43b204,!![]);}catch(_0x1713b5){return BPromise[_0xb372('0x1f')](_0x1713b5);}return _0x4903eb[_0xb372('0x20')]();};}function saveUpdates(_0x1ba472,_0x26dfbb){return function(_0x3deb9c){if(_0x3deb9c){return _0x3deb9c[_0xb372('0x21')](_0x1ba472)[_0xb372('0x22')](function(_0xccbde1){return _0xccbde1;});}return null;};}function removeEntity(_0x447e5c,_0x22a80c){return function(_0xa8841b){if(_0xa8841b){return _0xa8841b['destroy']()[_0xb372('0x22')](function(){_0x447e5c[_0xb372('0x17')](0xcc)[_0xb372('0x18')]();});}};}function handleEntityNotFound(_0x30c28f,_0x5d64c5){return function(_0x7f69ac){if(!_0x7f69ac){_0x30c28f[_0xb372('0x16')](0x194);}return _0x7f69ac;};}function handleError(_0x5b084e,_0x21653a){_0x21653a=_0x21653a||0x1f4;return function(_0x1120ca){logger[_0xb372('0x23')](_0x1120ca[_0xb372('0x24')]);if(_0x1120ca[_0xb372('0x25')]){delete _0x1120ca[_0xb372('0x25')];}_0x5b084e['status'](_0x21653a)['send'](_0x1120ca);};}exports[_0xb372('0x26')]=function(_0x499e2e,_0x3dfc9b){var _0x5c5e1a={},_0x3b0bdc={},_0x3cc634={'count':0x0,'rows':[]};var _0x13c4d6=_[_0xb372('0x27')](db[_0xb372('0x28')][_0xb372('0x29')],function(_0x1080a4){return{'name':_0x1080a4['fieldName'],'type':_0x1080a4[_0xb372('0x2a')][_0xb372('0x2b')]};});_0x3b0bdc[_0xb372('0x2c')]=_[_0xb372('0x27')](_0x13c4d6,'name');_0x3b0bdc['query']=_[_0xb372('0x2d')](_0x499e2e[_0xb372('0x2e')]);_0x3b0bdc[_0xb372('0x2f')]=_[_0xb372('0x30')](_0x3b0bdc[_0xb372('0x2c')],_0x3b0bdc[_0xb372('0x2e')]);_0x5c5e1a[_0xb372('0x31')]=_['intersection'](_0x3b0bdc['model'],qs['fields'](_0x499e2e[_0xb372('0x2e')][_0xb372('0x32')]));_0x5c5e1a['attributes']=_0x5c5e1a[_0xb372('0x31')][_0xb372('0x33')]?_0x5c5e1a[_0xb372('0x31')]:_0x3b0bdc['model'];if(!_0x499e2e['query'][_0xb372('0x34')](_0xb372('0x35'))){_0x5c5e1a[_0xb372('0x1b')]=qs[_0xb372('0x1b')](_0x499e2e['query'][_0xb372('0x1b')]);_0x5c5e1a[_0xb372('0x1a')]=qs[_0xb372('0x1a')](_0x499e2e[_0xb372('0x2e')][_0xb372('0x1a')]);}_0x5c5e1a[_0xb372('0x36')]=qs['sort'](_0x499e2e[_0xb372('0x2e')][_0xb372('0x37')]);_0x5c5e1a[_0xb372('0x38')]=qs[_0xb372('0x2f')](_[_0xb372('0x39')](_0x499e2e[_0xb372('0x2e')],_0x3b0bdc[_0xb372('0x2f')]),_0x13c4d6);if(_0x499e2e[_0xb372('0x2e')][_0xb372('0x3a')]){_0x5c5e1a[_0xb372('0x38')]=_[_0xb372('0x3b')](_0x5c5e1a[_0xb372('0x38')],{'$or':_[_0xb372('0x27')](_0x13c4d6,function(_0xcee542){if(_0xcee542[_0xb372('0x2a')]!==_0xb372('0x3c')){var _0x4fd08e={};_0x4fd08e[_0xcee542[_0xb372('0x25')]]={'$like':'%'+_0x499e2e[_0xb372('0x2e')][_0xb372('0x3a')]+'%'};return _0x4fd08e;}})});}_0x5c5e1a=_[_0xb372('0x3b')]({},_0x5c5e1a,_0x499e2e[_0xb372('0x3d')]);var _0x4a5621={'where':_0x5c5e1a[_0xb372('0x38')]};return db[_0xb372('0x28')][_0xb372('0x1d')](_0x4a5621)[_0xb372('0x22')](function(_0x5da16e){_0x3cc634[_0xb372('0x1d')]=_0x5da16e;if(_0x499e2e[_0xb372('0x2e')][_0xb372('0x3e')]){_0x5c5e1a[_0xb372('0x3f')]=[{'all':!![]}];}return db[_0xb372('0x28')][_0xb372('0x40')](_0x5c5e1a);})[_0xb372('0x22')](function(_0x3b340e){_0x3cc634[_0xb372('0x41')]=_0x3b340e;return _0x3cc634;})[_0xb372('0x22')](respondWithFilteredResult(_0x3dfc9b,_0x5c5e1a))[_0xb372('0x42')](handleError(_0x3dfc9b,null));};exports['show']=function(_0x393e2e,_0x13c6fb){var _0x563490={'raw':!![],'where':{'id':_0x393e2e[_0xb372('0x43')]['id']}},_0x33f5b0={};_0x33f5b0[_0xb372('0x2c')]=_['keys'](db[_0xb372('0x28')][_0xb372('0x29')]);_0x33f5b0['query']=_[_0xb372('0x2d')](_0x393e2e[_0xb372('0x2e')]);_0x33f5b0[_0xb372('0x2f')]=_[_0xb372('0x30')](_0x33f5b0['model'],_0x33f5b0[_0xb372('0x2e')]);_0x563490[_0xb372('0x31')]=_[_0xb372('0x30')](_0x33f5b0[_0xb372('0x2c')],qs['fields'](_0x393e2e[_0xb372('0x2e')]['fields']));_0x563490[_0xb372('0x31')]=_0x563490[_0xb372('0x31')][_0xb372('0x33')]?_0x563490['attributes']:_0x33f5b0[_0xb372('0x2c')];if(_0x393e2e[_0xb372('0x2e')][_0xb372('0x3e')]){_0x563490[_0xb372('0x3f')]=[{'all':!![]}];}_0x563490=_['merge']({},_0x563490,_0x393e2e['options']);return db[_0xb372('0x28')]['find'](_0x563490)[_0xb372('0x22')](handleEntityNotFound(_0x13c6fb,null))[_0xb372('0x22')](respondWithResult(_0x13c6fb,null))[_0xb372('0x42')](handleError(_0x13c6fb,null));};exports[_0xb372('0x44')]=function(_0x30182d,_0x21c791){return db['CmHopperHistory'][_0xb372('0x44')](_0x30182d[_0xb372('0x45')],{})[_0xb372('0x22')](respondWithResult(_0x21c791,0xc9))[_0xb372('0x42')](handleError(_0x21c791,null));};exports[_0xb372('0x46')]=function(_0xac9626,_0x370689){return db[_0xb372('0x28')]['describe']()['then'](respondWithResult(_0x370689,null))[_0xb372('0x42')](handleError(_0x370689,null));};exports[_0xb372('0x21')]=function(_0x1506fb,_0x42f323){if(_0x1506fb[_0xb372('0x45')][_0xb372('0x47')]){delete _0x1506fb[_0xb372('0x45')][_0xb372('0x47')];}return db[_0xb372('0x28')][_0xb372('0x48')]({'where':{'uniqueid':_0x1506fb['params']['id']}})[_0xb372('0x22')](handleEntityNotFound(_0x42f323,null))['then'](saveUpdates(_0x1506fb[_0xb372('0x45')],null))[_0xb372('0x22')](respondWithResult(_0x42f323,null))[_0xb372('0x42')](handleError(_0x42f323,null));};
\ No newline at end of file
index 9012317..3edae9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x753c=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x753c,0x96));var _0xc753=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x753c[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0xc753('0x0'));var logger=require('../../config/logger')(_0xc753('0x1'));var moment=require(_0xc753('0x2'));var BPromise=require(_0xc753('0x3'));var rp=require(_0xc753('0x4'));var fs=require('fs');var path=require(_0xc753('0x5'));var rimraf=require(_0xc753('0x6'));var config=require(_0xc753('0x7'));var attributes=require(_0xc753('0x8'));module[_0xc753('0x9')]=function(_0x2990e6,_0x12fc45){return _0x2990e6[_0xc753('0xa')](_0xc753('0xb'),attributes,{'tableName':_0xc753('0xc'),'paranoid':![],'indexes':[{'name':_0xc753('0xd'),'fields':[_0xc753('0xd')]},{'name':_0xc753('0xe'),'fields':[_0xc753('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xabad=['lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid'];(function(_0x155eb8,_0x5aca30){var _0x159589=function(_0x483293){while(--_0x483293){_0x155eb8['push'](_0x155eb8['shift']());}};_0x159589(++_0x5aca30);}(_0xabad,0x150));var _0xdaba=function(_0x25ccb6,_0x429ba4){_0x25ccb6=_0x25ccb6-0x0;var _0x3c8292=_0xabad[_0x25ccb6];return _0x3c8292;};'use strict';var _=require(_0xdaba('0x0'));var util=require('util');var logger=require(_0xdaba('0x1'))(_0xdaba('0x2'));var moment=require(_0xdaba('0x3'));var BPromise=require('bluebird');var rp=require(_0xdaba('0x4'));var fs=require('fs');var path=require(_0xdaba('0x5'));var rimraf=require('rimraf');var config=require(_0xdaba('0x6'));var attributes=require(_0xdaba('0x7'));module[_0xdaba('0x8')]=function(_0x387d02,_0x20fd9f){return _0x387d02[_0xdaba('0x9')](_0xdaba('0xa'),attributes,{'tableName':_0xdaba('0xb'),'paranoid':![],'indexes':[{'name':'endtime','fields':[_0xdaba('0xc')]},{'name':_0xdaba('0xd'),'fields':[_0xdaba('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index 2b286bc..1fdd2c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x97f5=['CmHopperHistory','create','options','raw','CreateCmHopperHistory','debug','stringify','AvgHandleTime','where','COUNT','sequelize','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0x97f5,0x72));var _0x597f=function(_0x2ab3c9,_0x375683){_0x2ab3c9=_0x2ab3c9-0x0;var _0x4d75d4=_0x97f5[_0x2ab3c9];return _0x4d75d4;};'use strict';var _=require(_0x597f('0x0'));var util=require(_0x597f('0x1'));var moment=require(_0x597f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x597f('0x3'));var db=require(_0x597f('0x4'))['db'];var utils=require(_0x597f('0x5'));var logger=require(_0x597f('0x6'))(_0x597f('0x7'));var config=require(_0x597f('0x8'));var jayson=require(_0x597f('0x9'));var client=jayson[_0x597f('0xa')][_0x597f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5f4eb9,_0x22b5d0,_0x20f0fc){return new BPromise(function(_0x1098e6,_0x40b1cd){return client[_0x597f('0xc')](_0x5f4eb9,_0x20f0fc)[_0x597f('0xd')](function(_0x5b293a){logger[_0x597f('0xe')](_0x597f('0xf'),_0x22b5d0,_0x597f('0x10'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x22b5d0,_0x597f('0x10'),JSON['stringify'](_0x5b293a));if(_0x5b293a[_0x597f('0x11')]){if(_0x5b293a[_0x597f('0x11')][_0x597f('0x12')]===0x1f4){logger['error'](_0x597f('0xf'),_0x22b5d0,_0x5b293a[_0x597f('0x11')][_0x597f('0x13')]);return _0x40b1cd(_0x5b293a[_0x597f('0x11')][_0x597f('0x13')]);}logger[_0x597f('0x11')](_0x597f('0xf'),_0x22b5d0,_0x5b293a[_0x597f('0x11')][_0x597f('0x13')]);return _0x1098e6(_0x5b293a[_0x597f('0x11')][_0x597f('0x13')]);}else{logger[_0x597f('0xe')](_0x597f('0xf'),_0x22b5d0,'request\x20sent');_0x1098e6(_0x5b293a[_0x597f('0x14')][_0x597f('0x13')]);}})[_0x597f('0x15')](function(_0x55eed9){logger[_0x597f('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x22b5d0,_0x55eed9);_0x40b1cd(_0x55eed9);});});}exports['CreateCmHopperHistory']=function(_0x507552){var _0x50f89a=this;return new Promise(function(_0x49f12b,_0x4dcc95){return db[_0x597f('0x16')][_0x597f('0x17')](_0x507552['body'],{'raw':_0x507552[_0x597f('0x18')]?_0x507552[_0x597f('0x18')][_0x597f('0x19')]===undefined?!![]:![]:!![]})[_0x597f('0xd')](function(_0x53b85e){logger['info'](_0x597f('0x1a'),_0x507552);logger[_0x597f('0x1b')](_0x597f('0x1a'),_0x507552,JSON[_0x597f('0x1c')](_0x53b85e));_0x49f12b(_0x53b85e);})['catch'](function(_0x4c13ab){logger[_0x597f('0x11')]('CreateCmHopperHistory',_0x4c13ab['message'],_0x507552);_0x4dcc95(_0x50f89a[_0x597f('0x11')](0x1f4,_0x4c13ab[_0x597f('0x13')]));});});};exports[_0x597f('0x1d')]=function(_0x4c44a7){var _0x553e9c=this;return new Promise(function(_0x51bc3c,_0x2cc8cd){return db[_0x597f('0x16')]['findAll']({'raw':_0x4c44a7[_0x597f('0x18')]?_0x4c44a7[_0x597f('0x18')][_0x597f('0x19')]===undefined?!![]:![]:!![],'where':_0x4c44a7['options']?_0x4c44a7['options'][_0x597f('0x1e')]||null:null,'attributes':[[db['sequelize']['fn'](_0x597f('0x1f'),db[_0x597f('0x20')][_0x597f('0x21')]('id')),_0x597f('0x22')],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db['sequelize']['literal'](_0x597f('0x23')))),'predictiveIntervalAnsweredCalls'],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x25')))),_0x597f('0x26')],[db['sequelize']['fn']('COUNT',db[_0x597f('0x20')]['fn']('IF',db['sequelize'][_0x597f('0x24')](_0x597f('0x27')))),_0x597f('0x28')],[db[_0x597f('0x20')]['fn']('AVG',db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')]['literal'](_0x597f('0x29')))),_0x597f('0x2a')],[db[_0x597f('0x20')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x2b')))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x30e76e){logger[_0x597f('0xe')](_0x597f('0x1d'),_0x4c44a7);logger[_0x597f('0x1b')](_0x597f('0x1d'),_0x4c44a7,JSON['stringify'](_0x30e76e));_0x51bc3c(_0x30e76e);})[_0x597f('0x15')](function(_0xd050c2){logger[_0x597f('0x11')](_0x597f('0x1d'),_0xd050c2[_0x597f('0x13')],_0x4c44a7);_0x2cc8cd(_0x553e9c[_0x597f('0x11')](0x1f4,_0xd050c2[_0x597f('0x13')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2f457d){var _0x47cbe2=this;return new Promise(function(_0x1b0c19,_0x4239cf){return db[_0x597f('0x16')]['findAll']({'raw':_0x2f457d[_0x597f('0x18')]?_0x2f457d['options'][_0x597f('0x19')]===undefined?!![]:![]:!![],'where':_0x2f457d[_0x597f('0x18')]?_0x2f457d[_0x597f('0x18')][_0x597f('0x1e')]||null:null,'attributes':[[_0x597f('0x2c'),_0x597f('0x2d')],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db['sequelize']['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x2e')))),'outboundNoSuchCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x597f('0x2f')],[db[_0x597f('0x20')]['fn']('COUNT',db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')]('`state`\x20=\x204,\x201,\x20null'))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x30')))),_0x597f('0x31')],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x597f('0x32')],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x34')))),'outboundDropCallsDayCallersExit'],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')]['literal'](_0x597f('0x35')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x36')))),'outboundBlacklistCallsDay'],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x37')))),'outboundOriginateFailureCallsDay'],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db['sequelize']['literal'](_0x597f('0x38')))),_0x597f('0x39')],[db['sequelize']['fn'](_0x597f('0x1f'),db['sequelize']['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x3a')))),_0x597f('0x3b')],[db['sequelize']['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['fn']('IF',db[_0x597f('0x20')]['literal'](_0x597f('0x3c')))),'outboundRejectCallsDay'],[db[_0x597f('0x20')]['fn']('COUNT',db[_0x597f('0x20')]['fn']('IF',db['sequelize'][_0x597f('0x24')](_0x597f('0x3d')))),_0x597f('0x3e')]],'group':[_0x597f('0x2c')]})[_0x597f('0xd')](function(_0x2bac8b){logger[_0x597f('0xe')](_0x597f('0x3f'),_0x2f457d);logger[_0x597f('0x1b')]('GetVoiceQueueHopperHistory',_0x2f457d,JSON[_0x597f('0x1c')](_0x2bac8b));_0x1b0c19(_0x2bac8b);})['catch'](function(_0x2d8488){logger[_0x597f('0x11')]('GetVoiceQueueHopperHistory',_0x2d8488['message'],_0x2f457d);_0x4239cf(_0x47cbe2['error'](0x1f4,_0x2d8488[_0x597f('0x13')]));});});};exports[_0x597f('0x40')]=function(_0x199609){var _0x26f817=this;return new Promise(function(_0x4afa3a,_0x2ca00d){return db[_0x597f('0x16')][_0x597f('0x41')]({'raw':_0x199609[_0x597f('0x18')]?_0x199609[_0x597f('0x18')][_0x597f('0x19')]===undefined?!![]:![]:!![],'where':_0x199609['options']?_0x199609[_0x597f('0x18')][_0x597f('0x1e')]||null:null,'attributes':[[_0x597f('0x2c'),_0x597f('0x2d')],[db[_0x597f('0x20')]['fn'](_0x597f('0x1f'),db[_0x597f('0x20')]['col']('id')),_0x597f('0x42')],[db['sequelize']['fn'](_0x597f('0x1f'),db['sequelize']['fn']('IF',db[_0x597f('0x20')][_0x597f('0x24')](_0x597f('0x23')))),_0x597f('0x43')]],'group':[_0x597f('0x2c')]})['then'](function(_0x2625c1){logger[_0x597f('0xe')]('GetCampaignHopperHistory',_0x199609);logger[_0x597f('0x1b')](_0x597f('0x40'),_0x199609,JSON[_0x597f('0x1c')](_0x2625c1));_0x4afa3a(_0x2625c1);})[_0x597f('0x15')](function(_0x211112){logger[_0x597f('0x11')](_0x597f('0x40'),_0x211112[_0x597f('0x13')],_0x199609);_0x2ca00d(_0x26f817['error'](0x1f4,_0x211112[_0x597f('0x13')]));});});};
\ No newline at end of file
+var _0x76a3=['request\x20sent','error','code','message','CmHopperHistory,\x20%s,\x20%s','result','catch','CreateCmHopperHistory','CmHopperHistory','body','options','raw','debug','stringify','AvgHandleTime','findAll','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','GetCampaignHopperHistory','where','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s,\x20%s'];(function(_0x2c4a5d,_0x4886f3){var _0x279244=function(_0x340512){while(--_0x340512){_0x2c4a5d['push'](_0x2c4a5d['shift']());}};_0x279244(++_0x4886f3);}(_0x76a3,0xf8));var _0x376a=function(_0x4c4042,_0x1ea485){_0x4c4042=_0x4c4042-0x0;var _0xbd10dc=_0x76a3[_0x4c4042];return _0xbd10dc;};'use strict';var _=require(_0x376a('0x0'));var util=require(_0x376a('0x1'));var moment=require(_0x376a('0x2'));var BPromise=require(_0x376a('0x3'));var rs=require(_0x376a('0x4'));var fs=require('fs');var Redis=require(_0x376a('0x5'));var db=require(_0x376a('0x6'))['db'];var utils=require(_0x376a('0x7'));var logger=require(_0x376a('0x8'))(_0x376a('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x376a('0xa')][_0x376a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x139dbc,_0x3cb57e,_0x548516){return new BPromise(function(_0x3e2261,_0x409960){return client[_0x376a('0xc')](_0x139dbc,_0x548516)[_0x376a('0xd')](function(_0x347b32){logger[_0x376a('0xe')]('CmHopperHistory,\x20%s,\x20%s',_0x3cb57e,'request\x20sent');logger['debug'](_0x376a('0xf'),_0x3cb57e,_0x376a('0x10'),JSON['stringify'](_0x347b32));if(_0x347b32[_0x376a('0x11')]){if(_0x347b32['error'][_0x376a('0x12')]===0x1f4){logger[_0x376a('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3cb57e,_0x347b32[_0x376a('0x11')][_0x376a('0x13')]);return _0x409960(_0x347b32[_0x376a('0x11')]['message']);}logger[_0x376a('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3cb57e,_0x347b32[_0x376a('0x11')][_0x376a('0x13')]);return _0x3e2261(_0x347b32[_0x376a('0x11')][_0x376a('0x13')]);}else{logger[_0x376a('0xe')](_0x376a('0x14'),_0x3cb57e,_0x376a('0x10'));_0x3e2261(_0x347b32[_0x376a('0x15')]['message']);}})[_0x376a('0x16')](function(_0xe3c5fc){logger['error'](_0x376a('0x14'),_0x3cb57e,_0xe3c5fc);_0x409960(_0xe3c5fc);});});}exports[_0x376a('0x17')]=function(_0x2dff31){var _0xa29966=this;return new Promise(function(_0x2519d4,_0x52bfea){return db[_0x376a('0x18')]['create'](_0x2dff31[_0x376a('0x19')],{'raw':_0x2dff31['options']?_0x2dff31[_0x376a('0x1a')][_0x376a('0x1b')]===undefined?!![]:![]:!![]})[_0x376a('0xd')](function(_0xd9f03a){logger[_0x376a('0xe')]('CreateCmHopperHistory',_0x2dff31);logger[_0x376a('0x1c')](_0x376a('0x17'),_0x2dff31,JSON[_0x376a('0x1d')](_0xd9f03a));_0x2519d4(_0xd9f03a);})['catch'](function(_0x4adf3d){logger[_0x376a('0x11')](_0x376a('0x17'),_0x4adf3d['message'],_0x2dff31);_0x52bfea(_0xa29966[_0x376a('0x11')](0x1f4,_0x4adf3d[_0x376a('0x13')]));});});};exports[_0x376a('0x1e')]=function(_0x12f812){var _0x5be541=this;return new Promise(function(_0xc7f55d,_0x431a8d){return db['CmHopperHistory'][_0x376a('0x1f')]({'raw':_0x12f812[_0x376a('0x1a')]?_0x12f812[_0x376a('0x1a')][_0x376a('0x1b')]===undefined?!![]:![]:!![],'where':_0x12f812[_0x376a('0x1a')]?_0x12f812[_0x376a('0x1a')]['where']||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x376a('0x20')][_0x376a('0x21')]('id')),_0x376a('0x22')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db['sequelize']['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db['sequelize']['fn']('IF',db[_0x376a('0x20')]['literal'](_0x376a('0x25')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db['sequelize'][_0x376a('0x24')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x376a('0x20')]['fn'](_0x376a('0x26'),db['sequelize']['fn']('IF',db[_0x376a('0x20')]['literal'](_0x376a('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x376a('0x20')]['fn'](_0x376a('0x26'),db['sequelize']['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x376a('0x28')]]})[_0x376a('0xd')](function(_0xd1dfaa){logger[_0x376a('0xe')]('AvgHandleTime',_0x12f812);logger[_0x376a('0x1c')](_0x376a('0x1e'),_0x12f812,JSON['stringify'](_0xd1dfaa));_0xc7f55d(_0xd1dfaa);})[_0x376a('0x16')](function(_0x4b5371){logger[_0x376a('0x11')](_0x376a('0x1e'),_0x4b5371[_0x376a('0x13')],_0x12f812);_0x431a8d(_0x5be541[_0x376a('0x11')](0x1f4,_0x4b5371[_0x376a('0x13')]));});});};exports[_0x376a('0x29')]=function(_0x487be8){var _0x3b13e9=this;return new Promise(function(_0x48b189,_0x424e40){return db[_0x376a('0x18')][_0x376a('0x1f')]({'raw':_0x487be8[_0x376a('0x1a')]?_0x487be8[_0x376a('0x1a')][_0x376a('0x1b')]===undefined?!![]:![]:!![],'where':_0x487be8['options']?_0x487be8[_0x376a('0x1a')]['where']||null:null,'attributes':[[_0x376a('0x2a'),'name'],[db[_0x376a('0x20')]['fn']('COUNT',db[_0x376a('0x20')]['fn']('IF',db['sequelize'][_0x376a('0x24')](_0x376a('0x2b')))),'outboundNoSuchCallsDay'],[db[_0x376a('0x20')]['fn']('COUNT',db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x203,\x201,\x20null'))),_0x376a('0x2c')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')]['literal'](_0x376a('0x2d')))),_0x376a('0x2e')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x2f')))),_0x376a('0x30')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x31')))),_0x376a('0x32')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x33')))),_0x376a('0x34')],[db['sequelize']['fn']('COUNT',db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x35')))),_0x376a('0x36')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db['sequelize']['fn']('IF',db[_0x376a('0x20')]['literal'](_0x376a('0x37')))),'outboundUnknownCallsDay'],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db['sequelize'][_0x376a('0x24')](_0x376a('0x38')))),'outboundBlacklistCallsDay'],[db[_0x376a('0x20')]['fn']('COUNT',db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x39')))),_0x376a('0x3a')],[db['sequelize']['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')]['literal']('`state`\x20=\x2018,\x201,\x20null'))),_0x376a('0x3b')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2016,\x201,\x20null'))),'outboundAnswerAgiCallsDay'],[db['sequelize']['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0x376a('0x3b')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x376a('0x3c')]],'group':['campaign']})[_0x376a('0xd')](function(_0x4cdc66){logger[_0x376a('0xe')](_0x376a('0x29'),_0x487be8);logger['debug'](_0x376a('0x29'),_0x487be8,JSON[_0x376a('0x1d')](_0x4cdc66));_0x48b189(_0x4cdc66);})[_0x376a('0x16')](function(_0x4cb8ec){logger['error'](_0x376a('0x29'),_0x4cb8ec[_0x376a('0x13')],_0x487be8);_0x424e40(_0x3b13e9[_0x376a('0x11')](0x1f4,_0x4cb8ec[_0x376a('0x13')]));});});};exports[_0x376a('0x3d')]=function(_0x138a5e){var _0x41cc46=this;return new Promise(function(_0x4bd623,_0xcae367){return db['CmHopperHistory']['findAll']({'raw':_0x138a5e['options']?_0x138a5e['options']['raw']===undefined?!![]:![]:!![],'where':_0x138a5e[_0x376a('0x1a')]?_0x138a5e['options'][_0x376a('0x3e')]||null:null,'attributes':[[_0x376a('0x2a'),_0x376a('0x3f')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')][_0x376a('0x21')]('id')),_0x376a('0x40')],[db[_0x376a('0x20')]['fn'](_0x376a('0x23'),db[_0x376a('0x20')]['fn']('IF',db[_0x376a('0x20')][_0x376a('0x24')](_0x376a('0x2d')))),_0x376a('0x41')]],'group':[_0x376a('0x2a')]})['then'](function(_0x11360d){logger[_0x376a('0xe')]('GetCampaignHopperHistory',_0x138a5e);logger[_0x376a('0x1c')](_0x376a('0x3d'),_0x138a5e,JSON[_0x376a('0x1d')](_0x11360d));_0x4bd623(_0x11360d);})['catch'](function(_0x518d78){logger[_0x376a('0x11')](_0x376a('0x3d'),_0x518d78[_0x376a('0x13')],_0x138a5e);_0xcae367(_0x41cc46['error'](0x1f4,_0x518d78[_0x376a('0x13')]));});});};
\ No newline at end of file
index 5cca872..29bd7eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdeed=['get','isAuthenticated','/:id','show','post','put','exports','multer','util','path','Router','../../components/auth/service','./cmHopperHistory.controller'];(function(_0x36ce29,_0x14823f){var _0x3d5e9e=function(_0x392101){while(--_0x392101){_0x36ce29['push'](_0x36ce29['shift']());}};_0x3d5e9e(++_0x14823f);}(_0xdeed,0xca));var _0xddee=function(_0x2ee81c,_0x15efff){_0x2ee81c=_0x2ee81c-0x0;var _0x1de05f=_0xdeed[_0x2ee81c];return _0x1de05f;};'use strict';var multer=require(_0xddee('0x0'));var util=require(_0xddee('0x1'));var path=require(_0xddee('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xddee('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xddee('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xddee('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xddee('0x6')]('/describe',auth[_0xddee('0x7')](),controller['describe']);router[_0xddee('0x6')](_0xddee('0x8'),auth[_0xddee('0x7')](),controller[_0xddee('0x9')]);router[_0xddee('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xddee('0xb')](_0xddee('0x8'),auth[_0xddee('0x7')](),controller['update']);module[_0xddee('0xc')]=router;
\ No newline at end of file
+var _0xa741=['../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','show','create','put','/:id','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5207e4,_0x3c95ea){var _0x4f0ed6=function(_0x3df5d7){while(--_0x3df5d7){_0x5207e4['push'](_0x5207e4['shift']());}};_0x4f0ed6(++_0x3c95ea);}(_0xa741,0x85));var _0x1a74=function(_0x5d942e,_0x15a6f0){_0x5d942e=_0x5d942e-0x0;var _0x1549f9=_0xa741[_0x5d942e];return _0x1549f9;};'use strict';var multer=require(_0x1a74('0x0'));var util=require(_0x1a74('0x1'));var path=require(_0x1a74('0x2'));var timeout=require('connect-timeout');var express=require(_0x1a74('0x3'));var router=express[_0x1a74('0x4')]();var fs_extra=require(_0x1a74('0x5'));var auth=require(_0x1a74('0x6'));var interaction=require(_0x1a74('0x7'));var config=require(_0x1a74('0x8'));var controller=require(_0x1a74('0x9'));router[_0x1a74('0xa')]('/',auth[_0x1a74('0xb')](),controller[_0x1a74('0xc')]);router[_0x1a74('0xa')](_0x1a74('0xd'),auth[_0x1a74('0xb')](),controller['describe']);router['get']('/:id',auth[_0x1a74('0xb')](),controller[_0x1a74('0xe')]);router['post']('/',auth[_0x1a74('0xb')](),controller[_0x1a74('0xf')]);router[_0x1a74('0x10')](_0x1a74('0x11'),auth['isAuthenticated'](),controller[_0x1a74('0x12')]);module[_0x1a74('0x13')]=router;
\ No newline at end of file
index aca0441..5833c02 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ef6=['STRING','name','sequelize','exports'];(function(_0x48ae97,_0x450240){var _0x13a62f=function(_0x139f44){while(--_0x139f44){_0x48ae97['push'](_0x48ae97['shift']());}};_0x13a62f(++_0x450240);}(_0x8ef6,0xf2));var _0x68ef=function(_0x8c8828,_0x3ed1fb){_0x8c8828=_0x8c8828-0x0;var _0x425647=_0x8ef6[_0x8c8828];return _0x425647;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'name':{'type':Sequelize[_0x68ef('0x2')],'unique':_0x68ef('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x68ef('0x2')]},'dialPrefix':{'type':Sequelize[_0x68ef('0x2')]}};
\ No newline at end of file
+var _0x5577=['name','sequelize','STRING'];(function(_0x47bc5e,_0x6fc500){var _0x323a59=function(_0x32df89){while(--_0x32df89){_0x47bc5e['push'](_0x47bc5e['shift']());}};_0x323a59(++_0x6fc500);}(_0x5577,0x1b4));var _0x7557=function(_0x1bfb5e,_0x272a42){_0x1bfb5e=_0x1bfb5e-0x0;var _0x4f4fcc=_0x5577[_0x1bfb5e];return _0x4f4fcc;};'use strict';var Sequelize=require(_0x7557('0x0'));module['exports']={'name':{'type':Sequelize[_0x7557('0x1')],'unique':_0x7557('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x7557('0x1')]}};
\ No newline at end of file
index b57f65f..c976aa1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x072d=['show','params','find','create','user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','ListId','Disposition','getDispositions','sort','removeDispositions','ids','CmContact','isArray','tags','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','concat','CustomFields','format','cf_%d','pick','raw','ContactItemType','alias','select','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','customField_','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','download','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','spread','userCmList:save','removeAgents','emit','getAgents','User','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','end','status','json','limit','undefined','offset','count','set','apply','reject','save','update','destroy','get','Lists','UserProfileResource','then','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x4575e4,_0x47a667){var _0x18702f=function(_0x3738dc){while(--_0x3738dc){_0x4575e4['push'](_0x4575e4['shift']());}};_0x18702f(++_0x47a667);}(_0x072d,0xf8));var _0xd072=function(_0x1e4a8e,_0x18022b){_0x1e4a8e=_0x1e4a8e-0x0;var _0x5408f9=_0x072d[_0x1e4a8e];return _0x5408f9;};'use strict';var emlformat=require(_0xd072('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd072('0x1'));var jsonpatch=require(_0xd072('0x2'));var rp=require(_0xd072('0x3'));var moment=require(_0xd072('0x4'));var BPromise=require(_0xd072('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xd072('0x6'));var csv=require(_0xd072('0x7'));var ejs=require(_0xd072('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd072('0x9'));var squel=require(_0xd072('0xa'));var crypto=require(_0xd072('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd072('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd072('0xd'));var Papa=require(_0xd072('0xe'));var Redis=require(_0xd072('0xf'));var authService=require(_0xd072('0x10'));var qs=require(_0xd072('0x11'));var as=require(_0xd072('0x12'));var hardwareService=require(_0xd072('0x13'));var logger=require(_0xd072('0x14'))('api');var utils=require(_0xd072('0x15'));var config=require(_0xd072('0x16'));var licenseUtil=require(_0xd072('0x17'));var db=require('../../mysqldb')['db'];var csv_results;config[_0xd072('0x18')]=_[_0xd072('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xd072('0x1a'))(new Redis(config[_0xd072('0x18')]));require(_0xd072('0x1b'))[_0xd072('0x1c')](socket);function respondWithStatusCode(_0x42a9e2,_0x521ab2){_0x521ab2=_0x521ab2||0xcc;return function(_0x1f6bb0){if(_0x1f6bb0){return _0x42a9e2[_0xd072('0x1d')](_0x521ab2);}return _0x42a9e2['status'](_0x521ab2)[_0xd072('0x1e')]();};}function respondWithResult(_0x9c62b3,_0x498597){_0x498597=_0x498597||0xc8;return function(_0x36d82e){if(_0x36d82e){return _0x9c62b3[_0xd072('0x1f')](_0x498597)[_0xd072('0x20')](_0x36d82e);}};}function respondWithFilteredResult(_0x3ad344,_0x55c009){return function(_0x5a90a8){if(_0x5a90a8){var _0x3c4830=typeof _0x55c009['offset']==='undefined'&&typeof _0x55c009[_0xd072('0x21')]===_0xd072('0x22');var _0x48303f=_0x5a90a8['count'];var _0x45b2c6=_0x3c4830?0x0:_0x55c009[_0xd072('0x23')];var _0x15583e=_0x3c4830?_0x5a90a8[_0xd072('0x24')]:_0x55c009['offset']+_0x55c009[_0xd072('0x21')];var _0x5aab2d;if(_0x15583e>=_0x48303f){_0x15583e=_0x48303f;_0x5aab2d=0xc8;}else{_0x5aab2d=0xce;}_0x3ad344[_0xd072('0x1f')](_0x5aab2d);return _0x3ad344[_0xd072('0x25')]('Content-Range',_0x45b2c6+'-'+_0x15583e+'/'+_0x48303f)[_0xd072('0x20')](_0x5a90a8);}return null;};}function patchUpdates(_0x31829d){return function(_0x4836ca){try{jsonpatch[_0xd072('0x26')](_0x4836ca,_0x31829d,!![]);}catch(_0x3818de){return BPromise[_0xd072('0x27')](_0x3818de);}return _0x4836ca[_0xd072('0x28')]();};}function saveUpdates(_0x549d6a,_0x18dc49){return function(_0x4a1c5a){if(_0x4a1c5a){return _0x4a1c5a[_0xd072('0x29')](_0x549d6a)['then'](function(_0x426c93){return _0x426c93;});}return null;};}function removeEntity(_0x59eb87,_0x50a7b9){return function(_0x8f9aa9){if(_0x8f9aa9){return _0x8f9aa9[_0xd072('0x2a')]()['then'](function(){var _0x2fde4d=_0x8f9aa9[_0xd072('0x2b')]({'plain':!![]});var _0x5891ce=_0xd072('0x2c');return db[_0xd072('0x2d')][_0xd072('0x2a')]({'where':{'type':_0x5891ce,'resourceId':_0x2fde4d['id']}})[_0xd072('0x2e')](function(){return _0x8f9aa9;});})[_0xd072('0x2e')](function(){_0x59eb87[_0xd072('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59211e,_0x207e50){return function(_0x316c24){if(!_0x316c24){_0x59211e['sendStatus'](0x194);}return _0x316c24;};}function handleError(_0x4186c6,_0x2180e3){_0x2180e3=_0x2180e3||0x1f4;return function(_0x968a5d){logger['error'](_0x968a5d[_0xd072('0x2f')]);if(_0x968a5d[_0xd072('0x30')]){delete _0x968a5d[_0xd072('0x30')];}_0x4186c6[_0xd072('0x1f')](_0x2180e3)[_0xd072('0x31')](_0x968a5d);};}exports[_0xd072('0x32')]=function(_0x250aab,_0x10d90a){var _0x90d88a={},_0x2a32d4={},_0x468f9d={'count':0x0,'rows':[]};var _0x393cc2=_[_0xd072('0x33')](db[_0xd072('0x34')][_0xd072('0x35')],function(_0x5bb2bf){return{'name':_0x5bb2bf[_0xd072('0x36')],'type':_0x5bb2bf[_0xd072('0x37')][_0xd072('0x38')]};});_0x2a32d4[_0xd072('0x39')]=_['map'](_0x393cc2,_0xd072('0x30'));_0x2a32d4['query']=_[_0xd072('0x3a')](_0x250aab[_0xd072('0x3b')]);_0x2a32d4[_0xd072('0x3c')]=_[_0xd072('0x3d')](_0x2a32d4[_0xd072('0x39')],_0x2a32d4[_0xd072('0x3b')]);_0x90d88a['attributes']=_[_0xd072('0x3d')](_0x2a32d4[_0xd072('0x39')],qs[_0xd072('0x3e')](_0x250aab[_0xd072('0x3b')][_0xd072('0x3e')]));_0x90d88a[_0xd072('0x3f')]=_0x90d88a[_0xd072('0x3f')][_0xd072('0x40')]?_0x90d88a[_0xd072('0x3f')]:_0x2a32d4['model'];if(!_0x250aab[_0xd072('0x3b')][_0xd072('0x41')](_0xd072('0x42'))){_0x90d88a[_0xd072('0x21')]=qs[_0xd072('0x21')](_0x250aab[_0xd072('0x3b')][_0xd072('0x21')]);_0x90d88a[_0xd072('0x23')]=qs['offset'](_0x250aab[_0xd072('0x3b')][_0xd072('0x23')]);}_0x90d88a[_0xd072('0x43')]=qs['sort'](_0x250aab[_0xd072('0x3b')]['sort']);_0x90d88a[_0xd072('0x44')]=qs['filters'](_['pick'](_0x250aab[_0xd072('0x3b')],_0x2a32d4[_0xd072('0x3c')]),_0x393cc2);if(_0x250aab[_0xd072('0x3b')][_0xd072('0x45')]){_0x90d88a['where']=_['merge'](_0x90d88a[_0xd072('0x44')],{'$or':_[_0xd072('0x33')](_0x393cc2,function(_0x37d4d){if(_0x37d4d[_0xd072('0x37')]!==_0xd072('0x46')){var _0x2d5b38={};_0x2d5b38[_0x37d4d[_0xd072('0x30')]]={'$like':'%'+_0x250aab[_0xd072('0x3b')][_0xd072('0x45')]+'%'};return _0x2d5b38;}})});}_0x90d88a=_[_0xd072('0x47')]({},_0x90d88a,_0x250aab[_0xd072('0x48')]);var _0x12ed4f={'where':_0x90d88a[_0xd072('0x44')]};return db['CmList']['count'](_0x12ed4f)[_0xd072('0x2e')](function(_0x28f6fb){_0x468f9d[_0xd072('0x24')]=_0x28f6fb;if(_0x250aab[_0xd072('0x3b')][_0xd072('0x49')]){_0x90d88a[_0xd072('0x4a')]=[{'all':!![]}];}return db['CmList'][_0xd072('0x4b')](_0x90d88a);})[_0xd072('0x2e')](function(_0x2b6e8e){_0x468f9d[_0xd072('0x4c')]=_0x2b6e8e;return _0x468f9d;})[_0xd072('0x2e')](respondWithFilteredResult(_0x10d90a,_0x90d88a))[_0xd072('0x4d')](handleError(_0x10d90a,null));};exports[_0xd072('0x4e')]=function(_0x846748,_0x1325b3){var _0x4a22ce={'raw':![],'where':{'id':_0x846748[_0xd072('0x4f')]['id']}},_0x13f960={};_0x13f960[_0xd072('0x39')]=_['keys'](db[_0xd072('0x34')][_0xd072('0x35')]);_0x13f960[_0xd072('0x3b')]=_[_0xd072('0x3a')](_0x846748[_0xd072('0x3b')]);_0x13f960[_0xd072('0x3c')]=_['intersection'](_0x13f960[_0xd072('0x39')],_0x13f960[_0xd072('0x3b')]);_0x4a22ce['attributes']=_[_0xd072('0x3d')](_0x13f960[_0xd072('0x39')],qs['fields'](_0x846748[_0xd072('0x3b')][_0xd072('0x3e')]));_0x4a22ce[_0xd072('0x3f')]=_0x4a22ce[_0xd072('0x3f')][_0xd072('0x40')]?_0x4a22ce[_0xd072('0x3f')]:_0x13f960[_0xd072('0x39')];if(_0x846748[_0xd072('0x3b')][_0xd072('0x49')]){_0x4a22ce[_0xd072('0x4a')]=[{'all':!![]}];}_0x4a22ce=_[_0xd072('0x47')]({},_0x4a22ce,_0x846748[_0xd072('0x48')]);return db[_0xd072('0x34')][_0xd072('0x50')](_0x4a22ce)[_0xd072('0x2e')](handleEntityNotFound(_0x1325b3,null))[_0xd072('0x2e')](respondWithResult(_0x1325b3,null))[_0xd072('0x4d')](handleError(_0x1325b3,null));};exports['create']=function(_0x5084ee,_0x5f0d4d){return db['CmList'][_0xd072('0x51')](_0x5084ee['body'],{})[_0xd072('0x2e')](function(_0x1d3e12){var _0x41d0dc=_0x5084ee[_0xd072('0x52')]['get']({'plain':!![]});if(!_0x41d0dc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41d0dc[_0xd072('0x53')]==='user'){var _0x409c46=_0x1d3e12[_0xd072('0x2b')]({'plain':!![]});var _0x5c88c7=_0xd072('0x2c');return db['UserProfileSection'][_0xd072('0x50')]({'where':{'name':_0x5c88c7,'userProfileId':_0x41d0dc['userProfileId']},'raw':!![]})['then'](function(_0x42156a){if(_0x42156a&&_0x42156a[_0xd072('0x54')]===0x0){return db[_0xd072('0x2d')][_0xd072('0x51')]({'name':_0x409c46[_0xd072('0x30')],'resourceId':_0x409c46['id'],'type':_0x42156a['name'],'sectionId':_0x42156a['id']},{})[_0xd072('0x2e')](function(){return _0x1d3e12;});}else{return _0x1d3e12;}})[_0xd072('0x4d')](function(_0x1afad0){logger[_0xd072('0x55')](_0xd072('0x56'),_0x1afad0);throw _0x1afad0;});}return _0x1d3e12;})[_0xd072('0x2e')](respondWithResult(_0x5f0d4d,0xc9))[_0xd072('0x4d')](handleError(_0x5f0d4d,null));};exports[_0xd072('0x29')]=function(_0x3cc9a9,_0x1d20bc){if(_0x3cc9a9[_0xd072('0x57')]['id']){delete _0x3cc9a9[_0xd072('0x57')]['id'];}return db[_0xd072('0x34')][_0xd072('0x50')]({'where':{'id':_0x3cc9a9[_0xd072('0x4f')]['id']}})[_0xd072('0x2e')](handleEntityNotFound(_0x1d20bc,null))['then'](saveUpdates(_0x3cc9a9[_0xd072('0x57')],null))[_0xd072('0x2e')](respondWithResult(_0x1d20bc,null))['catch'](handleError(_0x1d20bc,null));};exports[_0xd072('0x2a')]=function(_0x571aab,_0x1ded2c){return db['CmList'][_0xd072('0x50')]({'where':{'id':_0x571aab['params']['id']}})[_0xd072('0x2e')](handleEntityNotFound(_0x1ded2c,null))[_0xd072('0x2e')](removeEntity(_0x1ded2c,null))[_0xd072('0x4d')](handleError(_0x1ded2c,null));};exports[_0xd072('0x58')]=function(_0xbfb3a,_0x383ea6){return db[_0xd072('0x34')][_0xd072('0x58')]()[_0xd072('0x2e')](respondWithResult(_0x383ea6,null))[_0xd072('0x4d')](handleError(_0x383ea6,null));};exports[_0xd072('0x59')]=function(_0x29bd4d,_0x7beabe,_0x244291){if(_0x29bd4d[_0xd072('0x57')]['id']){delete _0x29bd4d[_0xd072('0x57')]['id'];}return db[_0xd072('0x34')][_0xd072('0x50')]({'where':{'id':_0x29bd4d['params']['id']}})[_0xd072('0x2e')](handleEntityNotFound(_0x7beabe,null))['then'](function(_0x2c4ac6){if(_0x2c4ac6){_0x29bd4d[_0xd072('0x57')][_0xd072('0x5a')]=_0x2c4ac6['id'];return db[_0xd072('0x5b')][_0xd072('0x51')](_0x29bd4d[_0xd072('0x57')]);}})[_0xd072('0x2e')](respondWithResult(_0x7beabe,null))[_0xd072('0x4d')](handleError(_0x7beabe,null));};exports[_0xd072('0x5c')]=function(_0xde100b,_0x175540,_0x458077){var _0x3cf793={'raw':![],'where':{}};var _0x4a0808={};var _0x250424={'count':0x0,'rows':[]};return db[_0xd072('0x34')]['findOne']({'where':{'id':_0xde100b[_0xd072('0x4f')]['id']}})[_0xd072('0x2e')](handleEntityNotFound(_0x175540,null))[_0xd072('0x2e')](function(_0x2449b2){if(_0x2449b2){_0x4a0808[_0xd072('0x39')]=_['keys'](db[_0xd072('0x5b')][_0xd072('0x35')]);_0x4a0808[_0xd072('0x3b')]=_['keys'](_0xde100b['query']);_0x4a0808[_0xd072('0x3c')]=_[_0xd072('0x3d')](_0x4a0808[_0xd072('0x39')],_0x4a0808[_0xd072('0x3b')]);_0x3cf793[_0xd072('0x3f')]=_[_0xd072('0x3d')](_0x4a0808[_0xd072('0x39')],qs[_0xd072('0x3e')](_0xde100b[_0xd072('0x3b')]['fields']));_0x3cf793['attributes']=_0x3cf793[_0xd072('0x3f')][_0xd072('0x40')]?_0x3cf793['attributes']:_0x4a0808['model'];if(!_0xde100b[_0xd072('0x3b')][_0xd072('0x41')]('nolimit')){_0x3cf793[_0xd072('0x21')]=qs[_0xd072('0x21')](_0xde100b[_0xd072('0x3b')][_0xd072('0x21')]);_0x3cf793['offset']=qs[_0xd072('0x23')](_0xde100b[_0xd072('0x3b')][_0xd072('0x23')]);}_0x3cf793['order']=qs['sort'](_0xde100b[_0xd072('0x3b')][_0xd072('0x5d')]);_0x3cf793[_0xd072('0x44')]=qs['filters'](_['pick'](_0xde100b['query'],_0x4a0808['filters']));_0x3cf793['where'][_0xd072('0x5a')]=_0x2449b2['id'];if(_0xde100b[_0xd072('0x3b')][_0xd072('0x45')]){_0x3cf793[_0xd072('0x44')]=_[_0xd072('0x47')](_0x3cf793['where'],{'$or':_['map'](_0x3cf793[_0xd072('0x3f')],function(_0x433c2f){var _0x131ef9={};_0x131ef9[_0x433c2f]={'$like':'%'+_0xde100b[_0xd072('0x3b')][_0xd072('0x45')]+'%'};return _0x131ef9;})});}_0x3cf793=_[_0xd072('0x47')]({},_0x3cf793,_0xde100b[_0xd072('0x48')]);return db[_0xd072('0x5b')][_0xd072('0x24')]({'where':_0x3cf793[_0xd072('0x44')]})[_0xd072('0x2e')](function(_0x2bab5){_0x250424[_0xd072('0x24')]=_0x2bab5;if(_0xde100b['query'][_0xd072('0x49')]){_0x3cf793[_0xd072('0x4a')]=[{'all':!![]}];}return db['Disposition'][_0xd072('0x4b')](_0x3cf793);})['then'](function(_0x3c30c8){_0x250424[_0xd072('0x4c')]=_0x3c30c8;return _0x250424;});}})['then'](respondWithFilteredResult(_0x175540,_0x3cf793))[_0xd072('0x4d')](handleError(_0x175540,null));};exports['removeDispositions']=function(_0x2423b8,_0xb51998,_0x26b9cb){return db['CmList'][_0xd072('0x50')]({'where':{'id':_0x2423b8[_0xd072('0x4f')]['id']}})[_0xd072('0x2e')](handleEntityNotFound(_0xb51998,null))[_0xd072('0x2e')](function(_0x1b9bd5){if(_0x1b9bd5){return _0x1b9bd5[_0xd072('0x5e')](_0x2423b8[_0xd072('0x3b')][_0xd072('0x5f')]);}})[_0xd072('0x2e')](respondWithStatusCode(_0xb51998,null))['catch'](handleError(_0xb51998,null));};exports['addContacts']=function(_0xb1578f,_0xc99ff7,_0xc7a054){return db['CmList'][_0xd072('0x50')]({'where':{'id':_0xb1578f['params']['id']}})['then'](handleEntityNotFound(_0xc99ff7,null))[_0xd072('0x2e')](function(_0x5297fe){if(_0x5297fe){var _0x4d2953=[];var _0x547e60={'success':[],'errors':[]};return db[_0xd072('0x60')][_0xd072('0x58')]()['then'](function(_0x43c088){if(_0xb1578f[_0xd072('0x57')]['tags']&&_[_0xd072('0x61')](_0xb1578f[_0xd072('0x57')][_0xd072('0x62')])){if(_0xb1578f[_0xd072('0x57')][_0xd072('0x62')][_0xd072('0x40')]){_0xb1578f[_0xd072('0x57')][_0xd072('0x62')]=_0xb1578f['body'][_0xd072('0x62')]['join'](';')+';';}else{_0xb1578f['body'][_0xd072('0x62')]=null;}}else{_0xb1578f[_0xd072('0x57')][_0xd072('0x62')]=null;}if(_0xb1578f['body']&&_[_0xd072('0x61')](_0xb1578f['body'])){for(var _0x3a21a6=0x0;_0x3a21a6<_0xb1578f[_0xd072('0x57')][_0xd072('0x40')];_0x3a21a6+=0x1){_0xb1578f[_0xd072('0x57')][_0x3a21a6]['ListId']=_0xb1578f[_0xd072('0x4f')]['id'];_0x4d2953[_0xd072('0x63')](_0xb1578f['body'][_0x3a21a6]);}return BPromise[_0xd072('0x64')](_0x4d2953,function(_0x8e6e4a){return db[_0xd072('0x60')][_0xd072('0x51')](_[_0xd072('0x65')](_0x8e6e4a,[_0xd072('0x5f'),'id'])||{},{'fields':_[_0xd072('0x3a')](_0x43c088),'raw':!![]})[_0xd072('0x2e')](function(_0x3230e2){_0x547e60[_0xd072('0x66')]['push'](_0x3230e2[_0xd072('0x67')]);})[_0xd072('0x4d')](function(_0x351cee){_0x547e60[_0xd072('0x68')][_0xd072('0x63')]({'data':_0x8e6e4a,'error':_0x351cee[_0xd072('0x69')]});});})[_0xd072('0x2e')](function(_0x67093){return _0x547e60;})[_0xd072('0x4d')](function(_0x281a7e){return _0x281a7e;});}else{_0xc99ff7[_0xd072('0x1f')](0x190)['json']({'message':_0xd072('0x6a')});}});}})[_0xd072('0x2e')](respondWithResult(_0xc99ff7,null))['catch'](handleError(_0xc99ff7,null));};exports[_0xd072('0x6b')]=function(_0x460a02,_0x256745,_0x2ad910){var _0x19ee72;return db[_0xd072('0x34')][_0xd072('0x50')]({'where':{'id':_0x460a02[_0xd072('0x4f')]['id']},'include':[{'model':db[_0xd072('0x6c')],'as':'CustomFields'}]})[_0xd072('0x2e')](handleEntityNotFound(_0x256745,null))[_0xd072('0x2e')](function(_0x2a020f){if(_0x2a020f){_0x19ee72=_0x2a020f;return db['CmContact']['rawAttributes'];}})[_0xd072('0x2e')](function(_0x7e69ec){if(_0x7e69ec){var _0x152880={};var _0x3cf0bd={};_0x3cf0bd[_0xd072('0x39')]=_[_0xd072('0x6d')](_['keys'](_0x7e69ec),_['map'](_0x19ee72[_0xd072('0x6e')],function(_0x51b7b7){return util[_0xd072('0x6f')](_0xd072('0x70'),_0x51b7b7['id']);}));_0x3cf0bd[_0xd072('0x3b')]=_[_0xd072('0x3a')](_0x460a02[_0xd072('0x3b')]);_0x3cf0bd[_0xd072('0x3c')]=_[_0xd072('0x3d')](_0x3cf0bd[_0xd072('0x39')],_0x3cf0bd[_0xd072('0x3b')]);_0x152880['attributes']=_['intersection'](_0x3cf0bd['model'],qs[_0xd072('0x3e')](_0x460a02[_0xd072('0x3b')][_0xd072('0x3e')]));_0x152880[_0xd072('0x3f')]=_0x152880[_0xd072('0x3f')]['length']?_0x152880['attributes']:_0x3cf0bd[_0xd072('0x39')];if(!_0x460a02[_0xd072('0x3b')][_0xd072('0x41')]('nolimit')){_0x152880[_0xd072('0x21')]=qs[_0xd072('0x21')](_0x460a02[_0xd072('0x3b')]['limit']);_0x152880['offset']=qs[_0xd072('0x23')](_0x460a02[_0xd072('0x3b')]['offset']);}_0x152880[_0xd072('0x43')]=qs[_0xd072('0x5d')](_0x460a02[_0xd072('0x3b')][_0xd072('0x5d')]);_0x152880[_0xd072('0x44')]=qs[_0xd072('0x3c')](_[_0xd072('0x71')](_0x460a02[_0xd072('0x3b')],_0x3cf0bd[_0xd072('0x3c')]));_0x152880[_0xd072('0x72')]=!![];if(_0x460a02['query'][_0xd072('0x45')]){_0x152880[_0xd072('0x44')]=_[_0xd072('0x47')](_0x152880[_0xd072('0x44')],{'$or':_[_0xd072('0x33')](_0x152880[_0xd072('0x3f')],function(_0x40a6ab){var _0x10d453={};_0x10d453[_0x40a6ab]={'$like':'%'+_0x460a02[_0xd072('0x3b')]['filter']+'%'};return _0x10d453;})});}_0x152880=_[_0xd072('0x47')]({},_0x152880,_0x460a02[_0xd072('0x48')]);return _0x19ee72[_0xd072('0x6b')](_0x152880);}})[_0xd072('0x2e')](respondWithResult(_0x256745,null))[_0xd072('0x4d')](handleError(_0x256745,null));};exports['getContactsCsv']=function(_0x22a1a1,_0x1b49fe,_0x5e79ee){var _0x48a3e9;var _0x52c385;var _0x3e625a;var _0x1cd95b=_0x22a1a1[_0xd072('0x4f')]['id'];csv_results=[];return db[_0xd072('0x73')][_0xd072('0x4b')]({'attributes':['id',_0xd072('0x30')],'raw':!![],'order':['OrderBy']})['then'](function(_0x1c04ea){_0x48a3e9=_0x1c04ea;var _0x49640b=_[_0xd072('0x3a')](db[_0xd072('0x60')]['rawAttributes']);return db[_0xd072('0x6c')]['findAll']({'raw':!![],'attributes':['id',_0xd072('0x74')]})[_0xd072('0x2e')](function(_0x195ff7){_0x52c385=_0x195ff7;var _0xcff36=squel[_0xd072('0x75')]()[_0xd072('0x3e')](_0x49640b)['from']('cm_contacts','c')['where'](_0xd072('0x76'),_0x1cd95b)[_0xd072('0x44')](_0xd072('0x77'))[_0xd072('0x78')]();for(var _0x34be9b=0x0;_0x34be9b<_0x52c385[_0xd072('0x40')];_0x34be9b++){_0xcff36[_0xd072('0x79')]('c.cf_'+_0x52c385[_0x34be9b]['id'],_0xd072('0x7a')+_0x52c385[_0x34be9b][_0xd072('0x74')]);}for(var _0x34be9b=0x0;_0x34be9b<_0x48a3e9[_0xd072('0x40')];_0x34be9b++){_0xcff36['field'](squel[_0xd072('0x75')]()['field']('item')['from']('cm_contact_has_items')['where'](_0xd072('0x7b'),_0x48a3e9[_0x34be9b]['id'])[_0xd072('0x44')](_0xd072('0x7c')),_0xd072('0x7d')+_0x48a3e9[_0x34be9b][_0xd072('0x30')]);_0xcff36['field'](squel[_0xd072('0x75')]()[_0xd072('0x79')]('description')['from'](_0xd072('0x7e'))[_0xd072('0x44')](_0xd072('0x7b'),_0x48a3e9[_0x34be9b]['id'])[_0xd072('0x44')]('CmContactId\x20=\x20c.id'),_0xd072('0x7f')+_0x48a3e9[_0x34be9b][_0xd072('0x30')]);}var _0x535953=[];_0x535953[_0xd072('0x63')](_0xcff36[_0xd072('0x80')]());BPromise[_0xd072('0x64')](_0x535953,handleQuery)['then'](function(_0x38828e){handleQuery(_0xcff36['toString']());var _0x23dbae=csv_results[0x0];if(!_[_0xd072('0x81')](_0x23dbae)){var _0x30d265=toCsv(_0x23dbae);var _0x2f0806=Date[_0xd072('0x82')]();fs[_0xd072('0x83')](util[_0xd072('0x6f')](_0xd072('0x84'),_0x1cd95b,_0x2f0806),_0x30d265);_0x1b49fe[_0xd072('0x85')](_0xd072('0x86'),_0xd072('0x87')+util[_0xd072('0x6f')]('list_%d_%s.csv',_0x1cd95b,_0x2f0806));_0x1b49fe[_0xd072('0x85')](_0xd072('0x88'),_0xd072('0x89'));return _0x1b49fe[_0xd072('0x8a')](util[_0xd072('0x6f')](_0xd072('0x84'),_0x1cd95b,_0x2f0806));}else{return _0x1b49fe[_0xd072('0x1d')](0xcc);}});});});};exports[_0xd072('0x8b')]=function(_0x3dea4f,_0x66aae8,_0x4168fe){var _0xb360a4;delete _0x3dea4f[_0xd072('0x57')]['id'];return db[_0xd072('0x34')][_0xd072('0x8c')]({'where':{'id':_0x3dea4f[_0xd072('0x4f')]['id']}})['then'](handleEntityNotFound(_0x66aae8,null))[_0xd072('0x2e')](function(_0x521833){if(_0x521833){return db[_0xd072('0x8d')][_0xd072('0x8e')](function(_0x2e4af1){return db[_0xd072('0x6c')][_0xd072('0x51')](_0x3dea4f['body'],{'transaction':_0x2e4af1})['then'](function(_0x3059c8){_0xb360a4=_0x3059c8;return _0x521833[_0xd072('0x8f')](_0x3059c8,{'transaction':_0x2e4af1});})[_0xd072('0x2e')](function(){var _0x169f73={'type':db[_0xd072('0x90')]['TEXT'],'transaction':_0x2e4af1};switch(_0x3dea4f[_0xd072('0x57')][_0xd072('0x37')]){case _0xd072('0x91'):_0x169f73[_0xd072('0x37')]=db[_0xd072('0x90')][_0xd072('0x92')];break;case _0xd072('0x93'):_0x169f73[_0xd072('0x37')]=db[_0xd072('0x90')][_0xd072('0x94')];break;case _0xd072('0x95'):_0x169f73[_0xd072('0x37')]=db[_0xd072('0x90')]['BOOLEAN'];_0x169f73[_0xd072('0x96')]=![];break;default:}return db['sequelize'][_0xd072('0x97')][_0xd072('0x98')]('cm_contacts',util[_0xd072('0x6f')](_0xd072('0x99'),_0xb360a4['id']),_0x169f73);})[_0xd072('0x2e')](function(){return _0xb360a4;});});}})[_0xd072('0x2e')](respondWithResult(_0x66aae8,null))[_0xd072('0x4d')](handleError(_0x66aae8,null));};exports['getCustomFields']=function(_0x2d864e,_0x2d7cc0,_0x29dfbe){var _0x241945={};var _0x5406e2={};var _0x1fae82;var _0x3f24f8;return db['CmList'][_0xd072('0x8c')]({'where':{'id':_0x2d864e[_0xd072('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2d7cc0,null))[_0xd072('0x2e')](function(_0x3c7b10){if(_0x3c7b10){_0x1fae82=_0x3c7b10;_0x5406e2[_0xd072('0x39')]=_['keys'](db['CmCustomField'][_0xd072('0x35')]);_0x5406e2[_0xd072('0x3b')]=_['keys'](_0x2d864e[_0xd072('0x3b')]);_0x5406e2['filters']=_['intersection'](_0x5406e2[_0xd072('0x39')],_0x5406e2[_0xd072('0x3b')]);_0x241945[_0xd072('0x3f')]=_[_0xd072('0x3d')](_0x5406e2['model'],qs['fields'](_0x2d864e['query'][_0xd072('0x3e')]));_0x241945[_0xd072('0x3f')]=_0x241945[_0xd072('0x3f')][_0xd072('0x40')]?_0x241945['attributes']:_0x5406e2[_0xd072('0x39')];_0x241945[_0xd072('0x43')]=qs[_0xd072('0x5d')](_0x2d864e[_0xd072('0x3b')]['sort']);_0x241945['where']=qs[_0xd072('0x3c')](_[_0xd072('0x71')](_0x2d864e['query'],_0x5406e2[_0xd072('0x3c')]));_0x241945['where']=_[_0xd072('0x47')](_0x241945[_0xd072('0x44')],{'$or':[{'ListId':_0x3c7b10['id']},{'ListId':null}]});if(_0x2d864e['query'][_0xd072('0x45')]){_0x241945['where']=_[_0xd072('0x47')](_0x241945[_0xd072('0x44')],{'$or':_[_0xd072('0x33')](_0x241945['attributes'],function(_0x3f527e){var _0x38d45b={};_0x38d45b[_0x3f527e]={'$like':'%'+_0x2d864e['query']['filter']+'%'};return _0x38d45b;})});}_0x241945=_[_0xd072('0x47')]({},_0x241945,_0x2d864e['options']);return db[_0xd072('0x6c')][_0xd072('0x9a')](_0x241945);}})[_0xd072('0x2e')](respondWithResult(_0x2d7cc0,null))['catch'](handleError(_0x2d7cc0,null));};exports[_0xd072('0x9b')]=function(_0x811f36,_0x85732d){return db[_0xd072('0x6c')][_0xd072('0x9a')]({'where':{'ListId':null}})[_0xd072('0x2e')](handleEntityNotFound(_0x85732d,null))[_0xd072('0x2e')](function(_0x3b1631){return _0x3b1631;})[_0xd072('0x2e')](respondWithResult(_0x85732d,null))[_0xd072('0x4d')](handleError(_0x85732d,null));};exports[_0xd072('0x9c')]=function(_0x1cbabe,_0x3e87bd,_0x16c935){return db[_0xd072('0x34')][_0xd072('0x50')]({'where':{'id':_0x1cbabe['params']['id']}})[_0xd072('0x2e')](handleEntityNotFound(_0x3e87bd,null))[_0xd072('0x2e')](function(_0x5ac2d6){if(_0x5ac2d6){return _0x5ac2d6['addAgents'](_0x1cbabe[_0xd072('0x57')][_0xd072('0x5f')],_[_0xd072('0x65')](_0x1cbabe['body'],[_0xd072('0x5f'),'id'])||{})[_0xd072('0x9d')](function(_0x298634){for(var _0x7edb49=0x0;_0x7edb49<_0x1cbabe[_0xd072('0x57')][_0xd072('0x5f')][_0xd072('0x40')];_0x7edb49+=0x1){socket['emit'](_0xd072('0x9e'),{'UserId':Number(_0x1cbabe[_0xd072('0x57')][_0xd072('0x5f')][_0x7edb49]),'CmListId':Number(_0x1cbabe[_0xd072('0x4f')]['id'])});}return _0x298634;});}})[_0xd072('0x2e')](respondWithResult(_0x3e87bd,null))[_0xd072('0x4d')](handleError(_0x3e87bd,null));};exports['removeAgents']=function(_0x2425cd,_0x39ea5e,_0x18c441){return db[_0xd072('0x34')][_0xd072('0x50')]({'where':{'id':_0x2425cd[_0xd072('0x4f')]['id']}})[_0xd072('0x2e')](handleEntityNotFound(_0x39ea5e,null))[_0xd072('0x2e')](function(_0x44d1a4){if(_0x44d1a4){return _0x44d1a4[_0xd072('0x9f')](_0x2425cd['query'][_0xd072('0x5f')])[_0xd072('0x2e')](function(){if(_[_0xd072('0x61')](_0x2425cd[_0xd072('0x3b')][_0xd072('0x5f')])){for(var _0xc7ebb1=0x0;_0xc7ebb1<_0x2425cd[_0xd072('0x3b')][_0xd072('0x5f')]['length'];_0xc7ebb1+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2425cd[_0xd072('0x3b')]['ids'][_0xc7ebb1]),'CmListId':Number(_0x2425cd['params']['id'])});}}else{socket[_0xd072('0xa0')]('userCmList:remove',{'UserId':Number(_0x2425cd['query']['ids']),'CmListId':Number(_0x2425cd['params']['id'])});}});}})['then'](respondWithStatusCode(_0x39ea5e,null))[_0xd072('0x4d')](handleError(_0x39ea5e,null));};exports[_0xd072('0xa1')]=function(_0x3405fc,_0x50951b,_0x520a5b){var _0x482b8d={};var _0xe16ce8={};var _0x50c774;var _0x2086c2;return db['CmList']['findOne']({'where':{'id':_0x3405fc['params']['id']}})[_0xd072('0x2e')](handleEntityNotFound(_0x50951b,null))[_0xd072('0x2e')](function(_0x3573fa){if(_0x3573fa){_0x50c774=_0x3573fa;_0xe16ce8[_0xd072('0x39')]=_['keys'](db[_0xd072('0xa2')][_0xd072('0x35')]);_0xe16ce8[_0xd072('0x3b')]=_[_0xd072('0x3a')](_0x3405fc['query']);_0xe16ce8[_0xd072('0x3c')]=_[_0xd072('0x3d')](_0xe16ce8[_0xd072('0x39')],_0xe16ce8['query']);_0x482b8d[_0xd072('0x3f')]=_[_0xd072('0x3d')](_0xe16ce8[_0xd072('0x39')],qs[_0xd072('0x3e')](_0x3405fc[_0xd072('0x3b')][_0xd072('0x3e')]));_0x482b8d[_0xd072('0x3f')]=_0x482b8d['attributes'][_0xd072('0x40')]?_0x482b8d[_0xd072('0x3f')]:_0xe16ce8[_0xd072('0x39')];_0x482b8d['order']=qs[_0xd072('0x5d')](_0x3405fc[_0xd072('0x3b')][_0xd072('0x5d')]);_0x482b8d[_0xd072('0x44')]=qs['filters'](_[_0xd072('0x71')](_0x3405fc[_0xd072('0x3b')],_0xe16ce8[_0xd072('0x3c')]));if(_0x3405fc[_0xd072('0x3b')][_0xd072('0x45')]){_0x482b8d['where']=_[_0xd072('0x47')](_0x482b8d[_0xd072('0x44')],{'$or':_[_0xd072('0x33')](_0x482b8d[_0xd072('0x3f')],function(_0x3db787){var _0x213cb5={};_0x213cb5[_0x3db787]={'$like':'%'+_0x3405fc[_0xd072('0x3b')][_0xd072('0x45')]+'%'};return _0x213cb5;})});}_0x482b8d=_[_0xd072('0x47')]({},_0x482b8d,_0x3405fc[_0xd072('0x48')]);return _0x50c774[_0xd072('0xa1')](_0x482b8d);}})[_0xd072('0x2e')](function(_0x3484de){if(_0x3484de){_0x2086c2=_0x3484de[_0xd072('0x40')];if(!_0x3405fc['query'][_0xd072('0x41')]('nolimit')){_0x482b8d[_0xd072('0x21')]=qs[_0xd072('0x21')](_0x3405fc[_0xd072('0x3b')][_0xd072('0x21')]);_0x482b8d[_0xd072('0x23')]=qs[_0xd072('0x23')](_0x3405fc['query'][_0xd072('0x23')]);}return _0x50c774[_0xd072('0xa1')](_0x482b8d);}})['then'](function(_0x460c70){if(_0x460c70){return _0x460c70?{'count':_0x2086c2,'rows':_0x460c70}:null;}})[_0xd072('0x2e')](respondWithResult(_0x50951b,null))[_0xd072('0x4d')](handleError(_0x50951b,null));};function handleQuery(_0x1d85a6){logger['info'](_0x1d85a6);return db[_0xd072('0x8d')][_0xd072('0x3b')](_0x1d85a6)[_0xd072('0x9d')](function(_0x99c1ba){csv_results[_0xd072('0x63')](_0x99c1ba);})['catch'](function(_0x587f89){logger[_0xd072('0x55')](_0x587f89[_0xd072('0x69')]);});}
\ No newline at end of file
+var _0x41b6=['set','Content-Range','apply','reject','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','CmList','findAll','rows','catch','show','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','addDisposition','ListId','getDispositions','findOne','Disposition','nolimit','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','omit','success','push','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','pick','raw','getContactsCsv','OrderBy','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','cm_contact_has_items','description_additionalPhone_','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','download','sequelize','transaction','CmCustomField','addCustomFields','Sequelize','TEXT','text','number','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','info','message','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','end','json','offset','undefined','limit','count','status'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x41b6,0x1db));var _0x641b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x641b('0x0'));var rimraf=require(_0x641b('0x1'));var zipdir=require(_0x641b('0x2'));var jsonpatch=require(_0x641b('0x3'));var rp=require('request-promise');var moment=require(_0x641b('0x4'));var BPromise=require(_0x641b('0x5'));var Mustache=require(_0x641b('0x6'));var util=require(_0x641b('0x7'));var path=require(_0x641b('0x8'));var sox=require('sox');var csv=require(_0x641b('0x9'));var ejs=require(_0x641b('0xa'));var fs=require('fs');var fs_extra=require(_0x641b('0xb'));var _=require(_0x641b('0xc'));var squel=require(_0x641b('0xd'));var crypto=require(_0x641b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x641b('0x9'));var querystring=require(_0x641b('0xf'));var Papa=require(_0x641b('0x10'));var Redis=require(_0x641b('0x11'));var authService=require(_0x641b('0x12'));var qs=require(_0x641b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x641b('0x14'));var logger=require('../../config/logger')(_0x641b('0x15'));var utils=require(_0x641b('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x641b('0x17'))['db'];var csv_results;config[_0x641b('0x18')]=_[_0x641b('0x19')](config[_0x641b('0x18')],{'host':_0x641b('0x1a'),'port':0x18eb});var socket=require(_0x641b('0x1b'))(new Redis(config[_0x641b('0x18')]));require(_0x641b('0x1c'))[_0x641b('0x1d')](socket);function respondWithStatusCode(_0x525e5b,_0x530628){_0x530628=_0x530628||0xcc;return function(_0x412eb1){if(_0x412eb1){return _0x525e5b[_0x641b('0x1e')](_0x530628);}return _0x525e5b['status'](_0x530628)[_0x641b('0x1f')]();};}function respondWithResult(_0x2acaca,_0x5be846){_0x5be846=_0x5be846||0xc8;return function(_0x21255a){if(_0x21255a){return _0x2acaca['status'](_0x5be846)[_0x641b('0x20')](_0x21255a);}};}function respondWithFilteredResult(_0x2c905f,_0x3a4751){return function(_0x280ff9){if(_0x280ff9){var _0x2828f1=typeof _0x3a4751[_0x641b('0x21')]===_0x641b('0x22')&&typeof _0x3a4751[_0x641b('0x23')]==='undefined';var _0x565c94=_0x280ff9[_0x641b('0x24')];var _0x319032=_0x2828f1?0x0:_0x3a4751[_0x641b('0x21')];var _0x16017a=_0x2828f1?_0x280ff9['count']:_0x3a4751[_0x641b('0x21')]+_0x3a4751[_0x641b('0x23')];var _0x5a6763;if(_0x16017a>=_0x565c94){_0x16017a=_0x565c94;_0x5a6763=0xc8;}else{_0x5a6763=0xce;}_0x2c905f[_0x641b('0x25')](_0x5a6763);return _0x2c905f[_0x641b('0x26')](_0x641b('0x27'),_0x319032+'-'+_0x16017a+'/'+_0x565c94)[_0x641b('0x20')](_0x280ff9);}return null;};}function patchUpdates(_0x43d895){return function(_0x2e47df){try{jsonpatch[_0x641b('0x28')](_0x2e47df,_0x43d895,!![]);}catch(_0x493c1b){return BPromise[_0x641b('0x29')](_0x493c1b);}return _0x2e47df[_0x641b('0x2a')]();};}function saveUpdates(_0x484cfe,_0x94e2b8){return function(_0x1b7d18){if(_0x1b7d18){return _0x1b7d18['update'](_0x484cfe)[_0x641b('0x2b')](function(_0x83eff){return _0x83eff;});}return null;};}function removeEntity(_0xdd1595,_0x41e2aa){return function(_0x69ee67){if(_0x69ee67){return _0x69ee67[_0x641b('0x2c')]()['then'](function(){var _0x588cd8=_0x69ee67[_0x641b('0x2d')]({'plain':!![]});var _0x342201=_0x641b('0x2e');return db[_0x641b('0x2f')][_0x641b('0x2c')]({'where':{'type':_0x342201,'resourceId':_0x588cd8['id']}})[_0x641b('0x2b')](function(){return _0x69ee67;});})[_0x641b('0x2b')](function(){_0xdd1595['status'](0xcc)[_0x641b('0x1f')]();});}};}function handleEntityNotFound(_0x42bf7c,_0x159e02){return function(_0x2d58a8){if(!_0x2d58a8){_0x42bf7c[_0x641b('0x1e')](0x194);}return _0x2d58a8;};}function handleError(_0x2d33df,_0x5ab1ed){_0x5ab1ed=_0x5ab1ed||0x1f4;return function(_0x28eb39){logger[_0x641b('0x30')](_0x28eb39[_0x641b('0x31')]);if(_0x28eb39[_0x641b('0x32')]){delete _0x28eb39[_0x641b('0x32')];}_0x2d33df['status'](_0x5ab1ed)[_0x641b('0x33')](_0x28eb39);};}exports['index']=function(_0x49a4c3,_0x206ea9){var _0x3ad18e={},_0x468efa={},_0x52240f={'count':0x0,'rows':[]};var _0x4c78b5=_['map'](db['CmList'][_0x641b('0x34')],function(_0x116220){return{'name':_0x116220['fieldName'],'type':_0x116220[_0x641b('0x35')][_0x641b('0x36')]};});_0x468efa[_0x641b('0x37')]=_[_0x641b('0x38')](_0x4c78b5,'name');_0x468efa[_0x641b('0x39')]=_[_0x641b('0x3a')](_0x49a4c3[_0x641b('0x39')]);_0x468efa['filters']=_[_0x641b('0x3b')](_0x468efa[_0x641b('0x37')],_0x468efa[_0x641b('0x39')]);_0x3ad18e[_0x641b('0x3c')]=_[_0x641b('0x3b')](_0x468efa[_0x641b('0x37')],qs[_0x641b('0x3d')](_0x49a4c3[_0x641b('0x39')][_0x641b('0x3d')]));_0x3ad18e['attributes']=_0x3ad18e['attributes'][_0x641b('0x3e')]?_0x3ad18e[_0x641b('0x3c')]:_0x468efa['model'];if(!_0x49a4c3[_0x641b('0x39')][_0x641b('0x3f')]('nolimit')){_0x3ad18e[_0x641b('0x23')]=qs[_0x641b('0x23')](_0x49a4c3[_0x641b('0x39')]['limit']);_0x3ad18e[_0x641b('0x21')]=qs[_0x641b('0x21')](_0x49a4c3[_0x641b('0x39')][_0x641b('0x21')]);}_0x3ad18e[_0x641b('0x40')]=qs['sort'](_0x49a4c3[_0x641b('0x39')][_0x641b('0x41')]);_0x3ad18e[_0x641b('0x42')]=qs[_0x641b('0x43')](_['pick'](_0x49a4c3['query'],_0x468efa[_0x641b('0x43')]),_0x4c78b5);if(_0x49a4c3[_0x641b('0x39')][_0x641b('0x44')]){_0x3ad18e[_0x641b('0x42')]=_[_0x641b('0x45')](_0x3ad18e['where'],{'$or':_['map'](_0x4c78b5,function(_0x4f51e7){if(_0x4f51e7[_0x641b('0x35')]!==_0x641b('0x46')){var _0x50509c={};_0x50509c[_0x4f51e7['name']]={'$like':'%'+_0x49a4c3[_0x641b('0x39')]['filter']+'%'};return _0x50509c;}})});}_0x3ad18e=_[_0x641b('0x45')]({},_0x3ad18e,_0x49a4c3[_0x641b('0x47')]);var _0x4cb709={'where':_0x3ad18e[_0x641b('0x42')]};return db['CmList'][_0x641b('0x24')](_0x4cb709)[_0x641b('0x2b')](function(_0x3a67cc){_0x52240f[_0x641b('0x24')]=_0x3a67cc;if(_0x49a4c3[_0x641b('0x39')][_0x641b('0x48')]){_0x3ad18e[_0x641b('0x49')]=[{'all':!![]}];}return db[_0x641b('0x4a')][_0x641b('0x4b')](_0x3ad18e);})[_0x641b('0x2b')](function(_0x123888){_0x52240f[_0x641b('0x4c')]=_0x123888;return _0x52240f;})[_0x641b('0x2b')](respondWithFilteredResult(_0x206ea9,_0x3ad18e))[_0x641b('0x4d')](handleError(_0x206ea9,null));};exports[_0x641b('0x4e')]=function(_0x4c940f,_0x480991){var _0x5cc9a2={'raw':![],'where':{'id':_0x4c940f['params']['id']}},_0x3ef0e4={};_0x3ef0e4['model']=_[_0x641b('0x3a')](db[_0x641b('0x4a')]['rawAttributes']);_0x3ef0e4[_0x641b('0x39')]=_['keys'](_0x4c940f[_0x641b('0x39')]);_0x3ef0e4['filters']=_[_0x641b('0x3b')](_0x3ef0e4[_0x641b('0x37')],_0x3ef0e4[_0x641b('0x39')]);_0x5cc9a2[_0x641b('0x3c')]=_[_0x641b('0x3b')](_0x3ef0e4[_0x641b('0x37')],qs[_0x641b('0x3d')](_0x4c940f[_0x641b('0x39')]['fields']));_0x5cc9a2['attributes']=_0x5cc9a2[_0x641b('0x3c')][_0x641b('0x3e')]?_0x5cc9a2['attributes']:_0x3ef0e4[_0x641b('0x37')];if(_0x4c940f[_0x641b('0x39')][_0x641b('0x48')]){_0x5cc9a2['include']=[{'all':!![]}];}_0x5cc9a2=_[_0x641b('0x45')]({},_0x5cc9a2,_0x4c940f[_0x641b('0x47')]);return db[_0x641b('0x4a')]['find'](_0x5cc9a2)[_0x641b('0x2b')](handleEntityNotFound(_0x480991,null))['then'](respondWithResult(_0x480991,null))[_0x641b('0x4d')](handleError(_0x480991,null));};exports[_0x641b('0x4f')]=function(_0x1c1dfb,_0x380f78){return db[_0x641b('0x4a')][_0x641b('0x4f')](_0x1c1dfb[_0x641b('0x50')],{})['then'](function(_0xa422bf){var _0x1f6e97=_0x1c1dfb[_0x641b('0x51')][_0x641b('0x2d')]({'plain':!![]});if(!_0x1f6e97)throw new Error(_0x641b('0x52'));if(_0x1f6e97[_0x641b('0x53')]===_0x641b('0x51')){var _0x445d20=_0xa422bf[_0x641b('0x2d')]({'plain':!![]});var _0x54fcd3=_0x641b('0x2e');return db[_0x641b('0x54')][_0x641b('0x55')]({'where':{'name':_0x54fcd3,'userProfileId':_0x1f6e97[_0x641b('0x56')]},'raw':!![]})[_0x641b('0x2b')](function(_0x2558bd){if(_0x2558bd&&_0x2558bd[_0x641b('0x57')]===0x0){return db[_0x641b('0x2f')]['create']({'name':_0x445d20[_0x641b('0x32')],'resourceId':_0x445d20['id'],'type':_0x2558bd[_0x641b('0x32')],'sectionId':_0x2558bd['id']},{})['then'](function(){return _0xa422bf;});}else{return _0xa422bf;}})[_0x641b('0x4d')](function(_0x19fb3b){logger[_0x641b('0x30')](_0x641b('0x58'),_0x19fb3b);throw _0x19fb3b;});}return _0xa422bf;})[_0x641b('0x2b')](respondWithResult(_0x380f78,0xc9))[_0x641b('0x4d')](handleError(_0x380f78,null));};exports[_0x641b('0x59')]=function(_0x44ff89,_0x413a70){if(_0x44ff89[_0x641b('0x50')]['id']){delete _0x44ff89['body']['id'];}return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x44ff89[_0x641b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x413a70,null))[_0x641b('0x2b')](saveUpdates(_0x44ff89['body'],null))['then'](respondWithResult(_0x413a70,null))[_0x641b('0x4d')](handleError(_0x413a70,null));};exports[_0x641b('0x2c')]=function(_0x4f1872,_0x276c5c){return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x4f1872[_0x641b('0x5a')]['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x276c5c,null))[_0x641b('0x2b')](removeEntity(_0x276c5c,null))[_0x641b('0x4d')](handleError(_0x276c5c,null));};exports[_0x641b('0x5b')]=function(_0x20b26d,_0x115201){return db[_0x641b('0x4a')][_0x641b('0x5b')]()[_0x641b('0x2b')](respondWithResult(_0x115201,null))[_0x641b('0x4d')](handleError(_0x115201,null));};exports[_0x641b('0x5c')]=function(_0x2c0d9a,_0x18cf1e,_0xee802b){if(_0x2c0d9a[_0x641b('0x50')]['id']){delete _0x2c0d9a['body']['id'];}return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x2c0d9a[_0x641b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x18cf1e,null))[_0x641b('0x2b')](function(_0x3a41ea){if(_0x3a41ea){_0x2c0d9a[_0x641b('0x50')][_0x641b('0x5d')]=_0x3a41ea['id'];return db['Disposition'][_0x641b('0x4f')](_0x2c0d9a['body']);}})[_0x641b('0x2b')](respondWithResult(_0x18cf1e,null))['catch'](handleError(_0x18cf1e,null));};exports[_0x641b('0x5e')]=function(_0x2e65ce,_0x3b8edc,_0x2ab5fa){var _0x1f7293={'raw':![],'where':{}};var _0x400c71={};var _0x273788={'count':0x0,'rows':[]};return db[_0x641b('0x4a')][_0x641b('0x5f')]({'where':{'id':_0x2e65ce['params']['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x3b8edc,null))[_0x641b('0x2b')](function(_0x76ac1c){if(_0x76ac1c){_0x400c71['model']=_[_0x641b('0x3a')](db[_0x641b('0x60')][_0x641b('0x34')]);_0x400c71[_0x641b('0x39')]=_[_0x641b('0x3a')](_0x2e65ce[_0x641b('0x39')]);_0x400c71[_0x641b('0x43')]=_[_0x641b('0x3b')](_0x400c71[_0x641b('0x37')],_0x400c71[_0x641b('0x39')]);_0x1f7293['attributes']=_[_0x641b('0x3b')](_0x400c71['model'],qs[_0x641b('0x3d')](_0x2e65ce['query'][_0x641b('0x3d')]));_0x1f7293[_0x641b('0x3c')]=_0x1f7293['attributes'][_0x641b('0x3e')]?_0x1f7293['attributes']:_0x400c71[_0x641b('0x37')];if(!_0x2e65ce[_0x641b('0x39')]['hasOwnProperty'](_0x641b('0x61'))){_0x1f7293[_0x641b('0x23')]=qs[_0x641b('0x23')](_0x2e65ce[_0x641b('0x39')][_0x641b('0x23')]);_0x1f7293[_0x641b('0x21')]=qs['offset'](_0x2e65ce[_0x641b('0x39')][_0x641b('0x21')]);}_0x1f7293[_0x641b('0x40')]=qs[_0x641b('0x41')](_0x2e65ce[_0x641b('0x39')][_0x641b('0x41')]);_0x1f7293[_0x641b('0x42')]=qs[_0x641b('0x43')](_['pick'](_0x2e65ce[_0x641b('0x39')],_0x400c71['filters']));_0x1f7293[_0x641b('0x42')]['ListId']=_0x76ac1c['id'];if(_0x2e65ce['query'][_0x641b('0x44')]){_0x1f7293[_0x641b('0x42')]=_['merge'](_0x1f7293[_0x641b('0x42')],{'$or':_['map'](_0x1f7293[_0x641b('0x3c')],function(_0x458987){var _0x49a195={};_0x49a195[_0x458987]={'$like':'%'+_0x2e65ce[_0x641b('0x39')][_0x641b('0x44')]+'%'};return _0x49a195;})});}_0x1f7293=_[_0x641b('0x45')]({},_0x1f7293,_0x2e65ce[_0x641b('0x47')]);return db[_0x641b('0x60')][_0x641b('0x24')]({'where':_0x1f7293[_0x641b('0x42')]})[_0x641b('0x2b')](function(_0x4a0bd7){_0x273788[_0x641b('0x24')]=_0x4a0bd7;if(_0x2e65ce[_0x641b('0x39')][_0x641b('0x48')]){_0x1f7293[_0x641b('0x49')]=[{'all':!![]}];}return db['Disposition'][_0x641b('0x4b')](_0x1f7293);})[_0x641b('0x2b')](function(_0xc8ba78){_0x273788[_0x641b('0x4c')]=_0xc8ba78;return _0x273788;});}})[_0x641b('0x2b')](respondWithFilteredResult(_0x3b8edc,_0x1f7293))['catch'](handleError(_0x3b8edc,null));};exports['removeDispositions']=function(_0x145da2,_0x264782,_0x1e210b){return db[_0x641b('0x4a')]['find']({'where':{'id':_0x145da2[_0x641b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x264782,null))[_0x641b('0x2b')](function(_0x10c3c6){if(_0x10c3c6){return _0x10c3c6[_0x641b('0x62')](_0x145da2['query'][_0x641b('0x63')]);}})[_0x641b('0x2b')](respondWithStatusCode(_0x264782,null))[_0x641b('0x4d')](handleError(_0x264782,null));};exports[_0x641b('0x64')]=function(_0x13364c,_0x5aea71,_0x2a5c3c){return db['CmList'][_0x641b('0x55')]({'where':{'id':_0x13364c['params']['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x5aea71,null))['then'](function(_0x105458){if(_0x105458){var _0xaef2f=[];var _0x177e45={'success':[],'errors':[]};return db[_0x641b('0x65')][_0x641b('0x5b')]()['then'](function(_0xf2d2c2){if(_0x13364c[_0x641b('0x50')][_0x641b('0x66')]&&_[_0x641b('0x67')](_0x13364c[_0x641b('0x50')][_0x641b('0x66')])){if(_0x13364c['body'][_0x641b('0x66')][_0x641b('0x3e')]){_0x13364c['body'][_0x641b('0x66')]=_0x13364c[_0x641b('0x50')]['tags'][_0x641b('0x68')](';')+';';}else{_0x13364c[_0x641b('0x50')]['tags']=null;}}else{_0x13364c[_0x641b('0x50')][_0x641b('0x66')]=null;}if(_0x13364c[_0x641b('0x50')]&&_[_0x641b('0x67')](_0x13364c[_0x641b('0x50')])){for(var _0x26900b=0x0;_0x26900b<_0x13364c[_0x641b('0x50')]['length'];_0x26900b+=0x1){_0x13364c['body'][_0x26900b][_0x641b('0x5d')]=_0x13364c[_0x641b('0x5a')]['id'];_0xaef2f['push'](_0x13364c['body'][_0x26900b]);}return BPromise[_0x641b('0x69')](_0xaef2f,function(_0x5f2018){return db[_0x641b('0x65')][_0x641b('0x4f')](_[_0x641b('0x6a')](_0x5f2018,[_0x641b('0x63'),'id'])||{},{'fields':_[_0x641b('0x3a')](_0xf2d2c2),'raw':!![]})['then'](function(_0xf979){_0x177e45[_0x641b('0x6b')][_0x641b('0x6c')](_0xf979[_0x641b('0x6d')]);})[_0x641b('0x4d')](function(_0x3c845e){_0x177e45[_0x641b('0x6e')]['push']({'data':_0x5f2018,'error':_0x3c845e['message']});});})[_0x641b('0x2b')](function(_0x5c2101){return _0x177e45;})[_0x641b('0x4d')](function(_0x1c1557){return _0x1c1557;});}else{_0x5aea71[_0x641b('0x25')](0x190)[_0x641b('0x20')]({'message':_0x641b('0x6f')});}});}})[_0x641b('0x2b')](respondWithResult(_0x5aea71,null))['catch'](handleError(_0x5aea71,null));};exports[_0x641b('0x70')]=function(_0x182d10,_0x1e8466,_0x166df0){var _0x39e4df;return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x182d10[_0x641b('0x5a')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x641b('0x71')}]})[_0x641b('0x2b')](handleEntityNotFound(_0x1e8466,null))[_0x641b('0x2b')](function(_0x916b9a){if(_0x916b9a){_0x39e4df=_0x916b9a;return db[_0x641b('0x65')]['rawAttributes'];}})[_0x641b('0x2b')](function(_0x290c53){if(_0x290c53){var _0xdccf11={};var _0x255f2a={};_0x255f2a[_0x641b('0x37')]=_[_0x641b('0x72')](_[_0x641b('0x3a')](_0x290c53),_[_0x641b('0x38')](_0x39e4df[_0x641b('0x71')],function(_0x2c9313){return util[_0x641b('0x73')]('cf_%d',_0x2c9313['id']);}));_0x255f2a['query']=_['keys'](_0x182d10[_0x641b('0x39')]);_0x255f2a[_0x641b('0x43')]=_['intersection'](_0x255f2a[_0x641b('0x37')],_0x255f2a[_0x641b('0x39')]);_0xdccf11[_0x641b('0x3c')]=_[_0x641b('0x3b')](_0x255f2a[_0x641b('0x37')],qs[_0x641b('0x3d')](_0x182d10['query'][_0x641b('0x3d')]));_0xdccf11['attributes']=_0xdccf11[_0x641b('0x3c')][_0x641b('0x3e')]?_0xdccf11[_0x641b('0x3c')]:_0x255f2a['model'];if(!_0x182d10['query'][_0x641b('0x3f')](_0x641b('0x61'))){_0xdccf11[_0x641b('0x23')]=qs['limit'](_0x182d10[_0x641b('0x39')][_0x641b('0x23')]);_0xdccf11['offset']=qs[_0x641b('0x21')](_0x182d10[_0x641b('0x39')][_0x641b('0x21')]);}_0xdccf11[_0x641b('0x40')]=qs[_0x641b('0x41')](_0x182d10['query'][_0x641b('0x41')]);_0xdccf11[_0x641b('0x42')]=qs['filters'](_[_0x641b('0x74')](_0x182d10[_0x641b('0x39')],_0x255f2a['filters']));_0xdccf11[_0x641b('0x75')]=!![];if(_0x182d10[_0x641b('0x39')][_0x641b('0x44')]){_0xdccf11[_0x641b('0x42')]=_['merge'](_0xdccf11[_0x641b('0x42')],{'$or':_[_0x641b('0x38')](_0xdccf11[_0x641b('0x3c')],function(_0x1f9b2a){var _0x477339={};_0x477339[_0x1f9b2a]={'$like':'%'+_0x182d10[_0x641b('0x39')][_0x641b('0x44')]+'%'};return _0x477339;})});}_0xdccf11=_[_0x641b('0x45')]({},_0xdccf11,_0x182d10[_0x641b('0x47')]);return _0x39e4df[_0x641b('0x70')](_0xdccf11);}})[_0x641b('0x2b')](respondWithResult(_0x1e8466,null))[_0x641b('0x4d')](handleError(_0x1e8466,null));};exports[_0x641b('0x76')]=function(_0x20da4c,_0x9653e8,_0x567ea7){var _0x4d071e;var _0x69cbdf;var _0x275d79;var _0x43dec1=_0x20da4c[_0x641b('0x5a')]['id'];csv_results=[];return db['ContactItemType'][_0x641b('0x4b')]({'attributes':['id',_0x641b('0x32')],'raw':!![],'order':[_0x641b('0x77')]})['then'](function(_0x2dac0f){_0x4d071e=_0x2dac0f;var _0x37bdb2=_['keys'](db[_0x641b('0x65')][_0x641b('0x34')]);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x641b('0x78')]})[_0x641b('0x2b')](function(_0x258e63){_0x69cbdf=_0x258e63;var _0x4cc367=squel[_0x641b('0x79')]()['fields'](_0x37bdb2)[_0x641b('0x7a')](_0x641b('0x7b'),'c')[_0x641b('0x42')]('c.ListId\x20=\x20?',_0x43dec1)[_0x641b('0x42')](_0x641b('0x7c'))[_0x641b('0x7d')]();for(var _0x3fc89e=0x0;_0x3fc89e<_0x69cbdf[_0x641b('0x3e')];_0x3fc89e++){_0x4cc367[_0x641b('0x7e')](_0x641b('0x7f')+_0x69cbdf[_0x3fc89e]['id'],_0x641b('0x80')+_0x69cbdf[_0x3fc89e]['alias']);}for(var _0x3fc89e=0x0;_0x3fc89e<_0x4d071e[_0x641b('0x3e')];_0x3fc89e++){_0x4cc367[_0x641b('0x7e')](squel[_0x641b('0x79')]()[_0x641b('0x7e')](_0x641b('0x81'))[_0x641b('0x7a')]('cm_contact_has_items')[_0x641b('0x42')](_0x641b('0x82'),_0x4d071e[_0x3fc89e]['id'])[_0x641b('0x42')](_0x641b('0x83')),_0x641b('0x84')+_0x4d071e[_0x3fc89e][_0x641b('0x32')]);_0x4cc367[_0x641b('0x7e')](squel[_0x641b('0x79')]()['field'](_0x641b('0x85'))[_0x641b('0x7a')](_0x641b('0x86'))[_0x641b('0x42')](_0x641b('0x82'),_0x4d071e[_0x3fc89e]['id'])[_0x641b('0x42')](_0x641b('0x83')),_0x641b('0x87')+_0x4d071e[_0x3fc89e]['name']);}var _0x4b64b4=[];_0x4b64b4[_0x641b('0x6c')](_0x4cc367[_0x641b('0x88')]());BPromise[_0x641b('0x69')](_0x4b64b4,handleQuery)['then'](function(_0x3e242d){handleQuery(_0x4cc367[_0x641b('0x88')]());var _0x5291e4=csv_results[0x0];if(!_[_0x641b('0x89')](_0x5291e4)){var _0x5b5e3e=toCsv(_0x5291e4);var _0x3a546e=Date[_0x641b('0x8a')]();fs[_0x641b('0x8b')](util['format'](_0x641b('0x8c'),_0x43dec1,_0x3a546e),_0x5b5e3e);_0x9653e8[_0x641b('0x8d')](_0x641b('0x8e'),_0x641b('0x8f')+util['format']('list_%d_%s.csv',_0x43dec1,_0x3a546e));_0x9653e8[_0x641b('0x8d')](_0x641b('0x90'),'text/csv');return _0x9653e8[_0x641b('0x91')](util['format'](_0x641b('0x8c'),_0x43dec1,_0x3a546e));}else{return _0x9653e8['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x38b7f6,_0x2b2ef3,_0xae7e70){var _0x4e14ef;delete _0x38b7f6[_0x641b('0x50')]['id'];return db['CmList'][_0x641b('0x5f')]({'where':{'id':_0x38b7f6['params']['id']}})['then'](handleEntityNotFound(_0x2b2ef3,null))[_0x641b('0x2b')](function(_0x36921d){if(_0x36921d){return db[_0x641b('0x92')][_0x641b('0x93')](function(_0x123a2b){return db[_0x641b('0x94')][_0x641b('0x4f')](_0x38b7f6[_0x641b('0x50')],{'transaction':_0x123a2b})[_0x641b('0x2b')](function(_0x5ccf3f){_0x4e14ef=_0x5ccf3f;return _0x36921d[_0x641b('0x95')](_0x5ccf3f,{'transaction':_0x123a2b});})[_0x641b('0x2b')](function(){var _0x2914f2={'type':db[_0x641b('0x96')][_0x641b('0x97')],'transaction':_0x123a2b};switch(_0x38b7f6[_0x641b('0x50')][_0x641b('0x35')]){case _0x641b('0x98'):_0x2914f2[_0x641b('0x35')]=db[_0x641b('0x96')]['TEXT'];break;case _0x641b('0x99'):_0x2914f2['type']=db['Sequelize']['INTEGER'];break;case _0x641b('0x9a'):_0x2914f2[_0x641b('0x35')]=db[_0x641b('0x96')][_0x641b('0x9b')];_0x2914f2['defaultValue']=![];break;default:}return db[_0x641b('0x92')][_0x641b('0x9c')][_0x641b('0x9d')](_0x641b('0x7b'),util[_0x641b('0x73')](_0x641b('0x9e'),_0x4e14ef['id']),_0x2914f2);})[_0x641b('0x2b')](function(){return _0x4e14ef;});});}})[_0x641b('0x2b')](respondWithResult(_0x2b2ef3,null))[_0x641b('0x4d')](handleError(_0x2b2ef3,null));};exports[_0x641b('0x9f')]=function(_0x1e5422,_0x307cd9,_0x5538cf){var _0x1757e9={};var _0x52d424={};var _0xdf31a6;var _0x1a8813;return db['CmList'][_0x641b('0x5f')]({'where':{'id':_0x1e5422[_0x641b('0x5a')]['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x307cd9,null))[_0x641b('0x2b')](function(_0x10778a){if(_0x10778a){_0xdf31a6=_0x10778a;_0x52d424[_0x641b('0x37')]=_[_0x641b('0x3a')](db[_0x641b('0x94')]['rawAttributes']);_0x52d424[_0x641b('0x39')]=_[_0x641b('0x3a')](_0x1e5422[_0x641b('0x39')]);_0x52d424['filters']=_[_0x641b('0x3b')](_0x52d424[_0x641b('0x37')],_0x52d424[_0x641b('0x39')]);_0x1757e9[_0x641b('0x3c')]=_[_0x641b('0x3b')](_0x52d424['model'],qs['fields'](_0x1e5422['query'][_0x641b('0x3d')]));_0x1757e9[_0x641b('0x3c')]=_0x1757e9[_0x641b('0x3c')]['length']?_0x1757e9['attributes']:_0x52d424['model'];_0x1757e9[_0x641b('0x40')]=qs['sort'](_0x1e5422[_0x641b('0x39')][_0x641b('0x41')]);_0x1757e9[_0x641b('0x42')]=qs[_0x641b('0x43')](_['pick'](_0x1e5422[_0x641b('0x39')],_0x52d424['filters']));_0x1757e9[_0x641b('0x42')]=_[_0x641b('0x45')](_0x1757e9['where'],{'$or':[{'ListId':_0x10778a['id']},{'ListId':null}]});if(_0x1e5422[_0x641b('0x39')][_0x641b('0x44')]){_0x1757e9[_0x641b('0x42')]=_[_0x641b('0x45')](_0x1757e9['where'],{'$or':_['map'](_0x1757e9[_0x641b('0x3c')],function(_0x9e279f){var _0x51ca38={};_0x51ca38[_0x9e279f]={'$like':'%'+_0x1e5422[_0x641b('0x39')]['filter']+'%'};return _0x51ca38;})});}_0x1757e9=_['merge']({},_0x1757e9,_0x1e5422[_0x641b('0x47')]);return db[_0x641b('0x94')][_0x641b('0xa0')](_0x1757e9);}})[_0x641b('0x2b')](respondWithResult(_0x307cd9,null))['catch'](handleError(_0x307cd9,null));};exports[_0x641b('0xa1')]=function(_0x2ee324,_0x160b19){return db[_0x641b('0x94')][_0x641b('0xa0')]({'where':{'ListId':null}})[_0x641b('0x2b')](handleEntityNotFound(_0x160b19,null))[_0x641b('0x2b')](function(_0x4e898e){return _0x4e898e;})['then'](respondWithResult(_0x160b19,null))[_0x641b('0x4d')](handleError(_0x160b19,null));};exports['addAgents']=function(_0x17a29e,_0x5341ee,_0x6f11fa){return db[_0x641b('0x4a')][_0x641b('0x55')]({'where':{'id':_0x17a29e['params']['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x5341ee,null))['then'](function(_0x4aeaed){if(_0x4aeaed){return _0x4aeaed[_0x641b('0xa2')](_0x17a29e[_0x641b('0x50')][_0x641b('0x63')],_['omit'](_0x17a29e[_0x641b('0x50')],[_0x641b('0x63'),'id'])||{})[_0x641b('0xa3')](function(_0x30626f){for(var _0xab0466=0x0;_0xab0466<_0x17a29e['body'][_0x641b('0x63')][_0x641b('0x3e')];_0xab0466+=0x1){socket[_0x641b('0xa4')](_0x641b('0xa5'),{'UserId':Number(_0x17a29e['body']['ids'][_0xab0466]),'CmListId':Number(_0x17a29e[_0x641b('0x5a')]['id'])});}return _0x30626f;});}})['then'](respondWithResult(_0x5341ee,null))['catch'](handleError(_0x5341ee,null));};exports['removeAgents']=function(_0x412c1b,_0x529667,_0x116d7d){return db[_0x641b('0x4a')]['find']({'where':{'id':_0x412c1b[_0x641b('0x5a')]['id']}})['then'](handleEntityNotFound(_0x529667,null))[_0x641b('0x2b')](function(_0x3a7dc0){if(_0x3a7dc0){return _0x3a7dc0[_0x641b('0xa6')](_0x412c1b[_0x641b('0x39')][_0x641b('0x63')])[_0x641b('0x2b')](function(){if(_[_0x641b('0x67')](_0x412c1b[_0x641b('0x39')][_0x641b('0x63')])){for(var _0x406766=0x0;_0x406766<_0x412c1b[_0x641b('0x39')][_0x641b('0x63')]['length'];_0x406766+=0x1){socket['emit'](_0x641b('0xa7'),{'UserId':Number(_0x412c1b[_0x641b('0x39')][_0x641b('0x63')][_0x406766]),'CmListId':Number(_0x412c1b[_0x641b('0x5a')]['id'])});}}else{socket['emit'](_0x641b('0xa7'),{'UserId':Number(_0x412c1b[_0x641b('0x39')][_0x641b('0x63')]),'CmListId':Number(_0x412c1b['params']['id'])});}});}})[_0x641b('0x2b')](respondWithStatusCode(_0x529667,null))[_0x641b('0x4d')](handleError(_0x529667,null));};exports[_0x641b('0xa8')]=function(_0x358d5e,_0x21fc45,_0x599fdb){var _0x50ae39={};var _0x11777f={};var _0x342274;var _0x17fcdc;return db[_0x641b('0x4a')]['findOne']({'where':{'id':_0x358d5e[_0x641b('0x5a')]['id']}})[_0x641b('0x2b')](handleEntityNotFound(_0x21fc45,null))[_0x641b('0x2b')](function(_0x25f125){if(_0x25f125){_0x342274=_0x25f125;_0x11777f['model']=_[_0x641b('0x3a')](db['User'][_0x641b('0x34')]);_0x11777f['query']=_[_0x641b('0x3a')](_0x358d5e[_0x641b('0x39')]);_0x11777f['filters']=_[_0x641b('0x3b')](_0x11777f[_0x641b('0x37')],_0x11777f['query']);_0x50ae39[_0x641b('0x3c')]=_['intersection'](_0x11777f[_0x641b('0x37')],qs['fields'](_0x358d5e['query'][_0x641b('0x3d')]));_0x50ae39[_0x641b('0x3c')]=_0x50ae39['attributes'][_0x641b('0x3e')]?_0x50ae39[_0x641b('0x3c')]:_0x11777f['model'];_0x50ae39[_0x641b('0x40')]=qs[_0x641b('0x41')](_0x358d5e['query'][_0x641b('0x41')]);_0x50ae39[_0x641b('0x42')]=qs[_0x641b('0x43')](_[_0x641b('0x74')](_0x358d5e[_0x641b('0x39')],_0x11777f[_0x641b('0x43')]));if(_0x358d5e[_0x641b('0x39')][_0x641b('0x44')]){_0x50ae39[_0x641b('0x42')]=_[_0x641b('0x45')](_0x50ae39[_0x641b('0x42')],{'$or':_[_0x641b('0x38')](_0x50ae39[_0x641b('0x3c')],function(_0x2306f3){var _0x2d28b8={};_0x2d28b8[_0x2306f3]={'$like':'%'+_0x358d5e[_0x641b('0x39')]['filter']+'%'};return _0x2d28b8;})});}_0x50ae39=_[_0x641b('0x45')]({},_0x50ae39,_0x358d5e[_0x641b('0x47')]);return _0x342274['getAgents'](_0x50ae39);}})[_0x641b('0x2b')](function(_0x59717c){if(_0x59717c){_0x17fcdc=_0x59717c[_0x641b('0x3e')];if(!_0x358d5e[_0x641b('0x39')][_0x641b('0x3f')]('nolimit')){_0x50ae39[_0x641b('0x23')]=qs[_0x641b('0x23')](_0x358d5e['query'][_0x641b('0x23')]);_0x50ae39[_0x641b('0x21')]=qs['offset'](_0x358d5e['query'][_0x641b('0x21')]);}return _0x342274[_0x641b('0xa8')](_0x50ae39);}})[_0x641b('0x2b')](function(_0x1dc34c){if(_0x1dc34c){return _0x1dc34c?{'count':_0x17fcdc,'rows':_0x1dc34c}:null;}})['then'](respondWithResult(_0x21fc45,null))[_0x641b('0x4d')](handleError(_0x21fc45,null));};function handleQuery(_0x30b50e){logger[_0x641b('0xa9')](_0x30b50e);return db[_0x641b('0x92')][_0x641b('0x39')](_0x30b50e)[_0x641b('0xa3')](function(_0x11737e){csv_results[_0x641b('0x6c')](_0x11737e);})[_0x641b('0x4d')](function(_0xb428e7){logger['error'](_0xb428e7[_0x641b('0xaa')]);});}
\ No newline at end of file
index 1a94dab..3cb4d7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x2b04f3,_0x15b344){_0x2b04f3=_0x2b04f3-0x0;var _0x22bd7b=_0xe14b[_0x2b04f3];return _0x22bd7b;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents;
\ No newline at end of file
+var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x54f696,_0x532152){var _0x1323d8=function(_0x336656){while(--_0x336656){_0x54f696['push'](_0x54f696['shift']());}};_0x1323d8(++_0x532152);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents;
\ No newline at end of file
index 74b3a8d..eb29895 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x26ccaa,_0x2f3d27){var _0x4d9ce3=function(_0x26a7e1){while(--_0x26a7e1){_0x26ccaa['push'](_0x26ccaa['shift']());}};_0x4d9ce3(++_0x2f3d27);}(_0x6324,0x142));var _0x4632=function(_0x14dd10,_0x4900d6){_0x14dd10=_0x14dd10-0x0;var _0x5cb641=_0x6324[_0x14dd10];return _0x5cb641;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbec5=['request-promise','path','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','api','moment','bluebird'];(function(_0xeaab78,_0x365743){var _0x143298=function(_0x273554){while(--_0x273554){_0xeaab78['push'](_0xeaab78['shift']());}};_0x143298(++_0x365743);}(_0xbec5,0xe5));var _0x5bec=function(_0x31eb67,_0x9bc8c0){_0x31eb67=_0x31eb67-0x0;var _0x2a8cb8=_0xbec5[_0x31eb67];return _0x2a8cb8;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3a82433..393d596 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39a8=['redis','defaults','localhost','./cmList.socket','request','then','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client'];(function(_0x436ad6,_0x497cb8){var _0x41e242=function(_0x53bbf0){while(--_0x53bbf0){_0x436ad6['push'](_0x436ad6['shift']());}};_0x41e242(++_0x497cb8);}(_0x39a8,0x155));var _0x839a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39a8[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x839a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x839a('0x1'));var rs=require(_0x839a('0x2'));var fs=require('fs');var Redis=require(_0x839a('0x3'));var db=require(_0x839a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x839a('0x5'))(_0x839a('0x6'));var config=require(_0x839a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x839a('0x8')]['http']({'port':0x232a});config[_0x839a('0x9')]=_[_0x839a('0xa')](config[_0x839a('0x9')],{'host':_0x839a('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x839a('0xc'))['register'](socket);function respondWithRpcPromise(_0x1703ea,_0x53a601,_0x4622d8){return new BPromise(function(_0x154e4e,_0x1139a0){return client[_0x839a('0xd')](_0x1703ea,_0x4622d8)[_0x839a('0xe')](function(_0x51bbf2){logger['info'](_0x839a('0xf'),_0x53a601,_0x839a('0x10'));logger[_0x839a('0x11')](_0x839a('0x12'),_0x53a601,_0x839a('0x10'),JSON[_0x839a('0x13')](_0x51bbf2));if(_0x51bbf2[_0x839a('0x14')]){if(_0x51bbf2[_0x839a('0x14')]['code']===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x53a601,_0x51bbf2[_0x839a('0x14')][_0x839a('0x15')]);return _0x1139a0(_0x51bbf2['error']['message']);}logger['error'](_0x839a('0xf'),_0x53a601,_0x51bbf2[_0x839a('0x14')][_0x839a('0x15')]);return _0x154e4e(_0x51bbf2[_0x839a('0x14')][_0x839a('0x15')]);}else{logger[_0x839a('0x16')](_0x839a('0xf'),_0x53a601,'request\x20sent');_0x154e4e(_0x51bbf2[_0x839a('0x17')][_0x839a('0x15')]);}})[_0x839a('0x18')](function(_0x4099b8){logger[_0x839a('0x14')](_0x839a('0xf'),_0x53a601,_0x4099b8);_0x1139a0(_0x4099b8);});});}
\ No newline at end of file
+var _0x9a9e=['http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x2cfc8c,_0x5472df){var _0x1de813=function(_0x580f50){while(--_0x580f50){_0x2cfc8c['push'](_0x2cfc8c['shift']());}};_0x1de813(++_0x5472df);}(_0x9a9e,0xc1));var _0xe9a9=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0x9a9e[_0x25bea7];return _0x175952;};'use strict';var _=require(_0xe9a9('0x0'));var util=require('util');var moment=require(_0xe9a9('0x1'));var BPromise=require('bluebird');var rs=require(_0xe9a9('0x2'));var fs=require('fs');var Redis=require(_0xe9a9('0x3'));var db=require(_0xe9a9('0x4'))['db'];var utils=require(_0xe9a9('0x5'));var logger=require(_0xe9a9('0x6'))('rpc');var config=require(_0xe9a9('0x7'));var jayson=require(_0xe9a9('0x8'));var client=jayson[_0xe9a9('0x9')][_0xe9a9('0xa')]({'port':0x232a});config[_0xe9a9('0xb')]=_[_0xe9a9('0xc')](config[_0xe9a9('0xb')],{'host':_0xe9a9('0xd'),'port':0x18eb});var socket=require(_0xe9a9('0xe'))(new Redis(config['redis']));require('./cmList.socket')[_0xe9a9('0xf')](socket);function respondWithRpcPromise(_0x175d55,_0x1a0579,_0xfe219d){return new BPromise(function(_0x41d913,_0x235645){return client[_0xe9a9('0x10')](_0x175d55,_0xfe219d)[_0xe9a9('0x11')](function(_0xdbc2b){logger[_0xe9a9('0x12')](_0xe9a9('0x13'),_0x1a0579,_0xe9a9('0x14'));logger[_0xe9a9('0x15')](_0xe9a9('0x16'),_0x1a0579,_0xe9a9('0x14'),JSON[_0xe9a9('0x17')](_0xdbc2b));if(_0xdbc2b['error']){if(_0xdbc2b[_0xe9a9('0x18')][_0xe9a9('0x19')]===0x1f4){logger['error'](_0xe9a9('0x13'),_0x1a0579,_0xdbc2b[_0xe9a9('0x18')][_0xe9a9('0x1a')]);return _0x235645(_0xdbc2b[_0xe9a9('0x18')][_0xe9a9('0x1a')]);}logger[_0xe9a9('0x18')](_0xe9a9('0x13'),_0x1a0579,_0xdbc2b['error'][_0xe9a9('0x1a')]);return _0x41d913(_0xdbc2b['error'][_0xe9a9('0x1a')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x1a0579,'request\x20sent');_0x41d913(_0xdbc2b[_0xe9a9('0x1b')]['message']);}})[_0xe9a9('0x1c')](function(_0x268c85){logger[_0xe9a9('0x18')]('CmList,\x20%s,\x20%s',_0x1a0579,_0x268c85);_0x235645(_0x268c85);});});}
\ No newline at end of file
index 647b6a8..5a9b2f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x298d=['./cmList.events','emit','removeListener','register','length'];(function(_0x4ee125,_0x1e0f19){var _0x59203d=function(_0xe311ea){while(--_0xe311ea){_0x4ee125['push'](_0x4ee125['shift']());}};_0x59203d(++_0x1e0f19);}(_0x298d,0xcd));var _0xd298=function(_0x617b79,_0x53848f){_0x617b79=_0x617b79-0x0;var _0x3d7e17=_0x298d[_0x617b79];return _0x3d7e17;};'use strict';var CmListEvents=require(_0xd298('0x0'));var events=['save','remove','update'];function createListener(_0x1f15e5,_0xbfc550){return function(_0x2ff79f){_0xbfc550[_0xd298('0x1')](_0x1f15e5,_0x2ff79f);};}function removeListener(_0x3b5d19,_0x3453a4){return function(){CmListEvents[_0xd298('0x2')](_0x3b5d19,_0x3453a4);};}exports[_0xd298('0x3')]=function(_0x30ac68){for(var _0x604373=0x0,_0x292ed8=events[_0xd298('0x4')];_0x604373<_0x292ed8;_0x604373++){var _0x50ae3e=events[_0x604373];var _0x4f8561=createListener('cmList:'+_0x50ae3e,_0x30ac68);CmListEvents['on'](_0x50ae3e,_0x4f8561);}};
\ No newline at end of file
+var _0xca72=['register','length','cmList:','save','remove','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xca72,0x1bf));var _0x2ca7=function(_0x175e89,_0x20835f){_0x175e89=_0x175e89-0x0;var _0x2ed996=_0xca72[_0x175e89];return _0x2ed996;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x2ca7('0x0'),_0x2ca7('0x1'),'update'];function createListener(_0x20d905,_0x5d2415){return function(_0xef2f7){_0x5d2415[_0x2ca7('0x2')](_0x20d905,_0xef2f7);};}function removeListener(_0x279759,_0x35758f){return function(){CmListEvents['removeListener'](_0x279759,_0x35758f);};}exports[_0x2ca7('0x3')]=function(_0x108833){for(var _0x5c4972=0x0,_0xadde62=events[_0x2ca7('0x4')];_0x5c4972<_0xadde62;_0x5c4972++){var _0x5106ff=events[_0x5c4972];var _0x4e2362=createListener(_0x2ca7('0x5')+_0x5106ff,_0x108833);CmListEvents['on'](_0x5106ff,_0x4e2362);}};
\ No newline at end of file
index 8e28c8d..fca7c0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x14bd=['removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addCustomField','addAgents','update','delete','destroy','removeDispositions'];(function(_0x239904,_0x53c0fc){var _0x3ad25d=function(_0x5815a3){while(--_0x5815a3){_0x239904['push'](_0x239904['shift']());}};_0x3ad25d(++_0x53c0fc);}(_0x14bd,0x146));var _0xd14b=function(_0x1d0343,_0x472470){_0x1d0343=_0x1d0343-0x0;var _0xeba613=_0x14bd[_0x1d0343];return _0xeba613;};'use strict';var multer=require(_0xd14b('0x0'));var util=require(_0xd14b('0x1'));var path=require(_0xd14b('0x2'));var timeout=require(_0xd14b('0x3'));var express=require('express');var router=express[_0xd14b('0x4')]();var fs_extra=require(_0xd14b('0x5'));var auth=require(_0xd14b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd14b('0x7'));var controller=require('./cmList.controller');router[_0xd14b('0x8')]('/',auth[_0xd14b('0x9')](),controller['index']);router['get'](_0xd14b('0xa'),auth[_0xd14b('0x9')](),controller[_0xd14b('0xb')]);router[_0xd14b('0x8')](_0xd14b('0xc'),auth[_0xd14b('0x9')](),controller[_0xd14b('0xd')]);router[_0xd14b('0x8')](_0xd14b('0xe'),auth[_0xd14b('0x9')](),controller[_0xd14b('0xf')]);router[_0xd14b('0x8')](_0xd14b('0x10'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x11')]);router[_0xd14b('0x8')]('/:id/contacts',auth[_0xd14b('0x9')](),controller['getContacts']);router['get'](_0xd14b('0x12'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x13')]);router[_0xd14b('0x8')](_0xd14b('0x14'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x15')]);router[_0xd14b('0x8')](_0xd14b('0x16'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x17')]);router[_0xd14b('0x18')]('/',auth[_0xd14b('0x9')](),controller[_0xd14b('0x19')]);router[_0xd14b('0x18')](_0xd14b('0x10'),auth['isAuthenticated'](),controller[_0xd14b('0x1a')]);router[_0xd14b('0x18')](_0xd14b('0x1b'),auth['isAuthenticated'](),controller['addContacts']);router[_0xd14b('0x18')](_0xd14b('0x14'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x1c')]);router[_0xd14b('0x18')]('/:id/users',auth[_0xd14b('0x9')](),controller[_0xd14b('0x1d')]);router['put'](_0xd14b('0xe'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x1e')]);router[_0xd14b('0x1f')](_0xd14b('0xe'),auth['isAuthenticated'](),controller[_0xd14b('0x20')]);router[_0xd14b('0x1f')](_0xd14b('0x10'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x21')]);router[_0xd14b('0x1f')](_0xd14b('0x16'),auth[_0xd14b('0x9')](),controller[_0xd14b('0x22')]);module[_0xd14b('0x23')]=router;
\ No newline at end of file
+var _0xd0d5=['../../components/auth/service','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addContacts','addCustomField','addAgents','put','update','delete','removeDispositions','removeAgents','exports','Router','fs-extra'];(function(_0x438d5c,_0x41407a){var _0x254322=function(_0x2682b8){while(--_0x2682b8){_0x438d5c['push'](_0x438d5c['shift']());}};_0x254322(++_0x41407a);}(_0xd0d5,0x1ed));var _0x5d0d=function(_0x156a7d,_0x30fe8f){_0x156a7d=_0x156a7d-0x0;var _0x49b857=_0xd0d5[_0x156a7d];return _0x49b857;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5d0d('0x0')]();var fs_extra=require(_0x5d0d('0x1'));var auth=require(_0x5d0d('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5d0d('0x3'));router[_0x5d0d('0x4')]('/',auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x6')]);router['get'](_0x5d0d('0x7'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x8')]);router[_0x5d0d('0x4')](_0x5d0d('0x9'),auth['isAuthenticated'](),controller[_0x5d0d('0xa')]);router['get'](_0x5d0d('0xb'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0xc')]);router[_0x5d0d('0x4')](_0x5d0d('0xd'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0xe')]);router['get'](_0x5d0d('0xf'),auth[_0x5d0d('0x5')](),controller['getContacts']);router['get'](_0x5d0d('0x10'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x11')]);router[_0x5d0d('0x4')](_0x5d0d('0x12'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x13')]);router[_0x5d0d('0x4')](_0x5d0d('0x14'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x15')]);router[_0x5d0d('0x16')]('/',auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x17')]);router['post'](_0x5d0d('0xd'),auth[_0x5d0d('0x5')](),controller['addDisposition']);router[_0x5d0d('0x16')](_0x5d0d('0xf'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x18')]);router[_0x5d0d('0x16')](_0x5d0d('0x12'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x19')]);router[_0x5d0d('0x16')]('/:id/users',auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x1a')]);router[_0x5d0d('0x1b')]('/:id',auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x1c')]);router[_0x5d0d('0x1d')](_0x5d0d('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x5d0d('0x1d')](_0x5d0d('0xd'),auth['isAuthenticated'](),controller[_0x5d0d('0x1e')]);router[_0x5d0d('0x1d')](_0x5d0d('0x14'),auth[_0x5d0d('0x5')](),controller[_0x5d0d('0x1f')]);module[_0x5d0d('0x20')]=router;
\ No newline at end of file
index 67d016f..33f065c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xca65=['getDataValue','field','STRING','sequelize','VIRTUAL'];(function(_0x8ff4a4,_0x1748c1){var _0x26d655=function(_0x319941){while(--_0x319941){_0x8ff4a4['push'](_0x8ff4a4['shift']());}};_0x26d655(++_0x1748c1);}(_0xca65,0x139));var _0x5ca6=function(_0x1006ad,_0x15b708){_0x1006ad=_0x1006ad-0x0;var _0x96504f=_0xca65[_0x1006ad];return _0x96504f;};'use strict';var Sequelize=require(_0x5ca6('0x0'));module['exports']={'name':{'type':Sequelize[_0x5ca6('0x1')],'get':function(_0x4fd5ce){return this[_0x5ca6('0x2')](_0x5ca6('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x5ca6('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x5ca6('0x4')],'allowNull':![]}};
\ No newline at end of file
+var _0xd50c=['STRING','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x35967c,_0x135008){var _0x7a39b7=function(_0x207e69){while(--_0x207e69){_0x35967c['push'](_0x35967c['shift']());}};_0x7a39b7(++_0x135008);}(_0xd50c,0x178));var _0xcd50=function(_0x1cb868,_0x17d978){_0x1cb868=_0x1cb868-0x0;var _0x4de2f4=_0xd50c[_0x1cb868];return _0x4de2f4;};'use strict';var Sequelize=require(_0xcd50('0x0'));module[_0xcd50('0x1')]={'name':{'type':Sequelize[_0xcd50('0x2')],'get':function(_0x60d468){return this[_0xcd50('0x3')]('field');}},'field':{'type':Sequelize[_0xcd50('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xcd50('0x4')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}};
\ No newline at end of file
index 2633fdd..f27037a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x3eb19a,_0x560bcf){var _0x164f94=function(_0x1948a4){while(--_0x1948a4){_0x3eb19a['push'](_0x3eb19a['shift']());}};_0x164f94(++_0x560bcf);}(_0x7a54,0x106));var _0x47a5=function(_0x1bcc55,_0xa548e8){_0x1bcc55=_0x1bcc55-0x0;var _0x5b1654=_0x7a54[_0x1bcc55];return _0x5b1654;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));};
\ No newline at end of file
+var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x20643b,_0x199285){var _0x185ef6=function(_0x5ce6da){while(--_0x5ce6da){_0x20643b['push'](_0x20643b['shift']());}};_0x185ef6(++_0x199285);}(_0x7a54,0x106));var _0x47a5=function(_0x117889,_0x394788){_0x117889=_0x117889-0x0;var _0x180bdb=_0x7a54[_0x117889];return _0x180bdb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));};
\ No newline at end of file
index 3c5b2f1..41362c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xef4d=['../../config/logger','bluebird','request-promise','path','rimraf','exports','define','Condition','tools_conditions','lodash','util'];(function(_0x108024,_0x1ef46c){var _0x1a4ab1=function(_0x9442c9){while(--_0x9442c9){_0x108024['push'](_0x108024['shift']());}};_0x1a4ab1(++_0x1ef46c);}(_0xef4d,0x132));var _0xdef4=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xef4d[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0xdef4('0x0'));var util=require(_0xdef4('0x1'));var logger=require(_0xdef4('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdef4('0x3'));var rp=require(_0xdef4('0x4'));var fs=require('fs');var path=require(_0xdef4('0x5'));var rimraf=require(_0xdef4('0x6'));var config=require('../../config/environment');var attributes=require('./condition.attributes');module[_0xdef4('0x7')]=function(_0x172316,_0x273a87){return _0x172316[_0xdef4('0x8')](_0xdef4('0x9'),attributes,{'tableName':_0xdef4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xaca6=['tools_conditions','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','Condition'];(function(_0x8fdbb3,_0x40f930){var _0x3e1f2a=function(_0x2c85e1){while(--_0x2c85e1){_0x8fdbb3['push'](_0x8fdbb3['shift']());}};_0x3e1f2a(++_0x40f930);}(_0xaca6,0x196));var _0x6aca=function(_0x3edbbd,_0x5331ef){_0x3edbbd=_0x3edbbd-0x0;var _0x358679=_0xaca6[_0x3edbbd];return _0x358679;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6aca('0x0'))(_0x6aca('0x1'));var moment=require(_0x6aca('0x2'));var BPromise=require(_0x6aca('0x3'));var rp=require(_0x6aca('0x4'));var fs=require('fs');var path=require(_0x6aca('0x5'));var rimraf=require('rimraf');var config=require(_0x6aca('0x6'));var attributes=require('./condition.attributes');module['exports']=function(_0x56a7b1,_0x9f032f){return _0x56a7b1['define'](_0x6aca('0x7'),attributes,{'tableName':_0x6aca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ce94e04..5554f03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bf2=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','stringify','error','message','info','Condition,\x20%s,\x20%s','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2bf2,0x8c));var _0x22bf=function(_0xdd1b59,_0x319022){_0xdd1b59=_0xdd1b59-0x0;var _0x49d9c8=_0x2bf2[_0xdd1b59];return _0x49d9c8;};'use strict';var _=require('lodash');var util=require(_0x22bf('0x0'));var moment=require(_0x22bf('0x1'));var BPromise=require(_0x22bf('0x2'));var rs=require(_0x22bf('0x3'));var fs=require('fs');var Redis=require(_0x22bf('0x4'));var db=require(_0x22bf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22bf('0x6'))(_0x22bf('0x7'));var config=require('../../config/environment');var jayson=require(_0x22bf('0x8'));var client=jayson['client'][_0x22bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bb62f,_0x4627a8,_0x5af49f){return new BPromise(function(_0xca979b,_0x1b3a97){return client[_0x22bf('0xa')](_0x2bb62f,_0x5af49f)[_0x22bf('0xb')](function(_0x35e29a){logger['info']('Condition,\x20%s,\x20%s',_0x4627a8,_0x22bf('0xc'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x4627a8,_0x22bf('0xc'),JSON[_0x22bf('0xd')](_0x35e29a));if(_0x35e29a['error']){if(_0x35e29a[_0x22bf('0xe')]['code']===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x4627a8,_0x35e29a[_0x22bf('0xe')][_0x22bf('0xf')]);return _0x1b3a97(_0x35e29a[_0x22bf('0xe')][_0x22bf('0xf')]);}logger[_0x22bf('0xe')]('Condition,\x20%s,\x20%s',_0x4627a8,_0x35e29a[_0x22bf('0xe')][_0x22bf('0xf')]);return _0xca979b(_0x35e29a['error']['message']);}else{logger[_0x22bf('0x10')](_0x22bf('0x11'),_0x4627a8,_0x22bf('0xc'));_0xca979b(_0x35e29a[_0x22bf('0x12')][_0x22bf('0xf')]);}})[_0x22bf('0x13')](function(_0x555873){logger[_0x22bf('0xe')](_0x22bf('0x11'),_0x4627a8,_0x555873);_0x1b3a97(_0x555873);});});}
\ No newline at end of file
+var _0xeaf6=['message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','Condition,\x20%s,\x20%s','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x343018,_0x1c1d6d){var _0x382429=function(_0x35efd8){while(--_0x35efd8){_0x343018['push'](_0x343018['shift']());}};_0x382429(++_0x1c1d6d);}(_0xeaf6,0x111));var _0x6eaf=function(_0x5394ee,_0x322947){_0x5394ee=_0x5394ee-0x0;var _0x1acef7=_0xeaf6[_0x5394ee];return _0x1acef7;};'use strict';var _=require(_0x6eaf('0x0'));var util=require(_0x6eaf('0x1'));var moment=require('moment');var BPromise=require(_0x6eaf('0x2'));var rs=require(_0x6eaf('0x3'));var fs=require('fs');var Redis=require(_0x6eaf('0x4'));var db=require(_0x6eaf('0x5'))['db'];var utils=require(_0x6eaf('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6eaf('0x7'));var client=jayson['client'][_0x6eaf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b53e5,_0x51868c,_0xd01133){return new BPromise(function(_0x2fb1f0,_0x22f25c){return client[_0x6eaf('0x9')](_0x1b53e5,_0xd01133)['then'](function(_0x5eb152){logger['info'](_0x6eaf('0xa'),_0x51868c,_0x6eaf('0xb'));logger['debug'](_0x6eaf('0xc'),_0x51868c,_0x6eaf('0xb'),JSON['stringify'](_0x5eb152));if(_0x5eb152[_0x6eaf('0xd')]){if(_0x5eb152[_0x6eaf('0xd')][_0x6eaf('0xe')]===0x1f4){logger[_0x6eaf('0xd')](_0x6eaf('0xa'),_0x51868c,_0x5eb152[_0x6eaf('0xd')][_0x6eaf('0xf')]);return _0x22f25c(_0x5eb152[_0x6eaf('0xd')]['message']);}logger['error'](_0x6eaf('0xa'),_0x51868c,_0x5eb152[_0x6eaf('0xd')]['message']);return _0x2fb1f0(_0x5eb152['error']['message']);}else{logger[_0x6eaf('0x10')](_0x6eaf('0xa'),_0x51868c,'request\x20sent');_0x2fb1f0(_0x5eb152['result'][_0x6eaf('0xf')]);}})[_0x6eaf('0x11')](function(_0x280f6d){logger['error'](_0x6eaf('0xa'),_0x51868c,_0x280f6d);_0x22f25c(_0x280f6d);});});}
\ No newline at end of file
index 0f9a7d2..2583363 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xecf8=['update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated'];(function(_0x4ddd71,_0x42f270){var _0x551953=function(_0x5e08b7){while(--_0x5e08b7){_0x4ddd71['push'](_0x4ddd71['shift']());}};_0x551953(++_0x42f270);}(_0xecf8,0x164));var _0x8ecf=function(_0xcdb485,_0x2ab856){_0xcdb485=_0xcdb485-0x0;var _0x511461=_0xecf8[_0xcdb485];return _0x511461;};'use strict';var multer=require(_0x8ecf('0x0'));var util=require(_0x8ecf('0x1'));var path=require(_0x8ecf('0x2'));var timeout=require('connect-timeout');var express=require(_0x8ecf('0x3'));var router=express[_0x8ecf('0x4')]();var fs_extra=require(_0x8ecf('0x5'));var auth=require(_0x8ecf('0x6'));var interaction=require(_0x8ecf('0x7'));var config=require(_0x8ecf('0x8'));var controller=require('./condition.controller');router[_0x8ecf('0x9')](_0x8ecf('0xa'),auth[_0x8ecf('0xb')](),controller[_0x8ecf('0xc')]);router[_0x8ecf('0xd')](_0x8ecf('0xa'),auth['isAuthenticated'](),controller[_0x8ecf('0xe')]);module[_0x8ecf('0xf')]=router;
\ No newline at end of file
+var _0xe115=['isAuthenticated','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x1a7e22,_0xc1e6d8){var _0x36b1c2=function(_0x3f640e){while(--_0x3f640e){_0x1a7e22['push'](_0x1a7e22['shift']());}};_0x36b1c2(++_0xc1e6d8);}(_0xe115,0xe3));var _0x5e11=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xe115[_0x4243a3];return _0x1b2a33;};'use strict';var multer=require('multer');var util=require(_0x5e11('0x0'));var path=require(_0x5e11('0x1'));var timeout=require(_0x5e11('0x2'));var express=require(_0x5e11('0x3'));var router=express[_0x5e11('0x4')]();var fs_extra=require(_0x5e11('0x5'));var auth=require(_0x5e11('0x6'));var interaction=require(_0x5e11('0x7'));var config=require(_0x5e11('0x8'));var controller=require(_0x5e11('0x9'));router[_0x5e11('0xa')]('/:id',auth[_0x5e11('0xb')](),controller[_0x5e11('0xc')]);router[_0x5e11('0xd')](_0x5e11('0xe'),auth[_0x5e11('0xb')](),controller[_0x5e11('0xf')]);module[_0x5e11('0x10')]=router;
\ No newline at end of file
index af8522d..e800e19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa2a=['sequelize','exports','STRING','name'];(function(_0x271ab4,_0x44dbaa){var _0x1d0515=function(_0x383b32){while(--_0x383b32){_0x271ab4['push'](_0x271ab4['shift']());}};_0x1d0515(++_0x44dbaa);}(_0xaa2a,0x1a4));var _0xaaa2=function(_0x34f58,_0x58d848){_0x34f58=_0x34f58-0x0;var _0x2a87f2=_0xaa2a[_0x34f58];return _0x2a87f2;};'use strict';var Sequelize=require(_0xaaa2('0x0'));module[_0xaaa2('0x1')]={'name':{'type':Sequelize[_0xaaa2('0x2')],'allowNull':![],'unique':_0xaaa2('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xaaa2('0x2')],'allowNull':!![]}};
\ No newline at end of file
+var _0x35d0=['exports','STRING','name','INTEGER','sequelize'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x35d0,0x1da));var _0x035d=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x35d0[_0x29d623];return _0x242e59;};'use strict';var Sequelize=require(_0x035d('0x0'));module[_0x035d('0x1')]={'name':{'type':Sequelize[_0x035d('0x2')],'allowNull':![],'unique':_0x035d('0x3')},'OrderBy':{'type':Sequelize[_0x035d('0x4')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x035d('0x2')],'allowNull':!![]}};
\ No newline at end of file
index 185e6e2..3913f6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a85=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','get','ContactItemTypes','UserProfileResource','destroy','end','error','stack','name','index','ContactItemType','rawAttributes','type','model','map','query','keys','filters','attributes','fields','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','body','CmContactHasItem','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x3cffcf,_0x52270c){var _0x37559c=function(_0x38d5aa){while(--_0x38d5aa){_0x3cffcf['push'](_0x3cffcf['shift']());}};_0x37559c(++_0x52270c);}(_0x1a85,0x178));var _0x51a8=function(_0x4efc87,_0x17a7d1){_0x4efc87=_0x4efc87-0x0;var _0x191fc4=_0x1a85[_0x4efc87];return _0x191fc4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x51a8('0x0'));var jsonpatch=require(_0x51a8('0x1'));var rp=require(_0x51a8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x51a8('0x3'));var util=require(_0x51a8('0x4'));var path=require(_0x51a8('0x5'));var sox=require('sox');var csv=require(_0x51a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a8('0x7'));var _=require('lodash');var squel=require(_0x51a8('0x8'));var crypto=require(_0x51a8('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x51a8('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x51a8('0xb'));var Redis=require(_0x51a8('0xc'));var authService=require(_0x51a8('0xd'));var qs=require(_0x51a8('0xe'));var as=require(_0x51a8('0xf'));var hardwareService=require(_0x51a8('0x10'));var logger=require(_0x51a8('0x11'))(_0x51a8('0x12'));var utils=require(_0x51a8('0x13'));var config=require(_0x51a8('0x14'));var licenseUtil=require(_0x51a8('0x15'));var db=require(_0x51a8('0x16'))['db'];function respondWithStatusCode(_0x38a1d2,_0x1827e6){_0x1827e6=_0x1827e6||0xcc;return function(_0x43c042){if(_0x43c042){return _0x38a1d2[_0x51a8('0x17')](_0x1827e6);}return _0x38a1d2[_0x51a8('0x18')](_0x1827e6)['end']();};}function respondWithResult(_0x461f5c,_0x7a4c36){_0x7a4c36=_0x7a4c36||0xc8;return function(_0xaec066){if(_0xaec066){return _0x461f5c['status'](_0x7a4c36)[_0x51a8('0x19')](_0xaec066);}};}function respondWithFilteredResult(_0x547d40,_0x10584b){return function(_0x2b8d37){if(_0x2b8d37){var _0x39cd45=typeof _0x10584b[_0x51a8('0x1a')]===_0x51a8('0x1b')&&typeof _0x10584b[_0x51a8('0x1c')]===_0x51a8('0x1b');var _0x516abc=_0x2b8d37[_0x51a8('0x1d')];var _0x45a433=_0x39cd45?0x0:_0x10584b[_0x51a8('0x1a')];var _0x23539e=_0x39cd45?_0x2b8d37[_0x51a8('0x1d')]:_0x10584b[_0x51a8('0x1a')]+_0x10584b['limit'];var _0x1df8c2;if(_0x23539e>=_0x516abc){_0x23539e=_0x516abc;_0x1df8c2=0xc8;}else{_0x1df8c2=0xce;}_0x547d40[_0x51a8('0x18')](_0x1df8c2);return _0x547d40[_0x51a8('0x1e')](_0x51a8('0x1f'),_0x45a433+'-'+_0x23539e+'/'+_0x516abc)[_0x51a8('0x19')](_0x2b8d37);}return null;};}function patchUpdates(_0x3bc044){return function(_0x28aea0){try{jsonpatch[_0x51a8('0x20')](_0x28aea0,_0x3bc044,!![]);}catch(_0x5ac1c0){return BPromise[_0x51a8('0x21')](_0x5ac1c0);}return _0x28aea0['save']();};}function saveUpdates(_0xfe0ddb,_0x12c029){return function(_0x8bda40){if(_0x8bda40){return _0x8bda40[_0x51a8('0x22')](_0xfe0ddb)['then'](function(_0xae3588){return _0xae3588;});}return null;};}function removeEntity(_0x4b9cdd,_0x47f063){return function(_0x23d26a){if(_0x23d26a){return _0x23d26a['destroy']()[_0x51a8('0x23')](function(){var _0x78d3d6=_0x23d26a[_0x51a8('0x24')]({'plain':!![]});var _0x18e2f3=_0x51a8('0x25');return db[_0x51a8('0x26')][_0x51a8('0x27')]({'where':{'type':_0x18e2f3,'resourceId':_0x78d3d6['id']}})[_0x51a8('0x23')](function(){return _0x23d26a;});})['then'](function(){_0x4b9cdd[_0x51a8('0x18')](0xcc)[_0x51a8('0x28')]();});}};}function handleEntityNotFound(_0xca5746,_0x3da187){return function(_0x1c150d){if(!_0x1c150d){_0xca5746[_0x51a8('0x17')](0x194);}return _0x1c150d;};}function handleError(_0x1a886f,_0x2742f5){_0x2742f5=_0x2742f5||0x1f4;return function(_0xec08ae){logger[_0x51a8('0x29')](_0xec08ae[_0x51a8('0x2a')]);if(_0xec08ae[_0x51a8('0x2b')]){delete _0xec08ae['name'];}_0x1a886f[_0x51a8('0x18')](_0x2742f5)['send'](_0xec08ae);};}exports[_0x51a8('0x2c')]=function(_0x3bc19a,_0x143f46){var _0x41df56={},_0x2136b4={},_0x4ea271={'count':0x0,'rows':[]};var _0x10c19b=_['map'](db[_0x51a8('0x2d')][_0x51a8('0x2e')],function(_0x253a59){return{'name':_0x253a59['fieldName'],'type':_0x253a59[_0x51a8('0x2f')]['key']};});_0x2136b4[_0x51a8('0x30')]=_[_0x51a8('0x31')](_0x10c19b,_0x51a8('0x2b'));_0x2136b4[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x3bc19a['query']);_0x2136b4[_0x51a8('0x34')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],_0x2136b4[_0x51a8('0x32')]);_0x41df56[_0x51a8('0x35')]=_['intersection'](_0x2136b4[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x36')]));_0x41df56[_0x51a8('0x35')]=_0x41df56['attributes']['length']?_0x41df56['attributes']:_0x2136b4[_0x51a8('0x30')];if(!_0x3bc19a[_0x51a8('0x32')]['hasOwnProperty'](_0x51a8('0x37'))){_0x41df56['limit']=qs[_0x51a8('0x1c')](_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x1c')]);_0x41df56[_0x51a8('0x1a')]=qs[_0x51a8('0x1a')](_0x3bc19a[_0x51a8('0x32')]['offset']);}_0x41df56['order']=qs[_0x51a8('0x38')](_0x3bc19a['query']['sort']);_0x41df56['where']=qs[_0x51a8('0x34')](_[_0x51a8('0x39')](_0x3bc19a[_0x51a8('0x32')],_0x2136b4['filters']),_0x10c19b);if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]){_0x41df56[_0x51a8('0x3b')]=_[_0x51a8('0x3c')](_0x41df56['where'],{'$or':_[_0x51a8('0x31')](_0x10c19b,function(_0xe6a86a){if(_0xe6a86a[_0x51a8('0x2f')]!=='VIRTUAL'){var _0xb96200={};_0xb96200[_0xe6a86a['name']]={'$like':'%'+_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3a')]+'%'};return _0xb96200;}})});}_0x41df56=_[_0x51a8('0x3c')]({},_0x41df56,_0x3bc19a[_0x51a8('0x3d')]);var _0x5c44a9={'where':_0x41df56[_0x51a8('0x3b')]};return db[_0x51a8('0x2d')][_0x51a8('0x1d')](_0x5c44a9)[_0x51a8('0x23')](function(_0xa33fc){_0x4ea271[_0x51a8('0x1d')]=_0xa33fc;if(_0x3bc19a[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x41df56[_0x51a8('0x3f')]=[{'all':!![]}];}return db['ContactItemType'][_0x51a8('0x40')](_0x41df56);})[_0x51a8('0x23')](function(_0x4c7c67){_0x4ea271['rows']=_0x4c7c67;return _0x4ea271;})[_0x51a8('0x23')](respondWithFilteredResult(_0x143f46,_0x41df56))[_0x51a8('0x41')](handleError(_0x143f46,null));};exports[_0x51a8('0x42')]=function(_0x27b8e5,_0x311574){var _0x157a51={'raw':!![],'where':{'id':_0x27b8e5[_0x51a8('0x43')]['id']}},_0x28f5b3={};_0x28f5b3[_0x51a8('0x30')]=_[_0x51a8('0x33')](db['ContactItemType'][_0x51a8('0x2e')]);_0x28f5b3[_0x51a8('0x32')]=_[_0x51a8('0x33')](_0x27b8e5[_0x51a8('0x32')]);_0x28f5b3[_0x51a8('0x34')]=_[_0x51a8('0x44')](_0x28f5b3['model'],_0x28f5b3[_0x51a8('0x32')]);_0x157a51['attributes']=_[_0x51a8('0x44')](_0x28f5b3[_0x51a8('0x30')],qs[_0x51a8('0x36')](_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x36')]));_0x157a51['attributes']=_0x157a51['attributes'][_0x51a8('0x45')]?_0x157a51[_0x51a8('0x35')]:_0x28f5b3[_0x51a8('0x30')];if(_0x27b8e5[_0x51a8('0x32')][_0x51a8('0x3e')]){_0x157a51['include']=[{'all':!![]}];}_0x157a51=_['merge']({},_0x157a51,_0x27b8e5[_0x51a8('0x3d')]);return db[_0x51a8('0x2d')][_0x51a8('0x46')](_0x157a51)[_0x51a8('0x23')](handleEntityNotFound(_0x311574,null))[_0x51a8('0x23')](respondWithResult(_0x311574,null))[_0x51a8('0x41')](handleError(_0x311574,null));};exports[_0x51a8('0x47')]=function(_0x1103a3,_0x301578){return db['ContactItemType']['create'](_0x1103a3['body'],{})[_0x51a8('0x23')](function(_0x279cb1){var _0x103897=_0x1103a3['user'][_0x51a8('0x24')]({'plain':!![]});if(!_0x103897)throw new Error(_0x51a8('0x48'));if(_0x103897['role']===_0x51a8('0x49')){var _0x4fb93c=_0x279cb1['get']({'plain':!![]});var _0xbf828b=_0x51a8('0x25');return db[_0x51a8('0x4a')]['find']({'where':{'name':_0xbf828b,'userProfileId':_0x103897['userProfileId']},'raw':!![]})[_0x51a8('0x23')](function(_0x5b0398){if(_0x5b0398&&_0x5b0398[_0x51a8('0x4b')]===0x0){return db[_0x51a8('0x26')][_0x51a8('0x47')]({'name':_0x4fb93c[_0x51a8('0x2b')],'resourceId':_0x4fb93c['id'],'type':_0x5b0398[_0x51a8('0x2b')],'sectionId':_0x5b0398['id']},{})[_0x51a8('0x23')](function(){return _0x279cb1;});}else{return _0x279cb1;}})[_0x51a8('0x41')](function(_0x406a87){logger[_0x51a8('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x406a87);throw _0x406a87;});}return _0x279cb1;})[_0x51a8('0x23')](respondWithResult(_0x301578,0xc9))[_0x51a8('0x41')](handleError(_0x301578,null));};exports[_0x51a8('0x22')]=function(_0xd3c4,_0x533cfa){if(_0xd3c4[_0x51a8('0x4c')]['id']){delete _0xd3c4['body']['id'];}return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0xd3c4['params']['id']}})['then'](handleEntityNotFound(_0x533cfa,null))[_0x51a8('0x23')](saveUpdates(_0xd3c4[_0x51a8('0x4c')],null))[_0x51a8('0x23')](respondWithResult(_0x533cfa,null))[_0x51a8('0x41')](handleError(_0x533cfa,null));};exports[_0x51a8('0x27')]=function(_0x52f60f,_0x43b79a){return db[_0x51a8('0x2d')][_0x51a8('0x46')]({'where':{'id':_0x52f60f[_0x51a8('0x43')]['id']}})[_0x51a8('0x23')](handleEntityNotFound(_0x43b79a,null))['then'](db[_0x51a8('0x4d')][_0x51a8('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x52f60f[_0x51a8('0x43')]['id']}}))[_0x51a8('0x23')](removeEntity(_0x43b79a,null))[_0x51a8('0x41')](handleError(_0x43b79a,null));};
\ No newline at end of file
+var _0xd4f4=['reject','save','update','destroy','get','ContactItemTypes','then','stack','name','send','index','map','ContactItemType','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xd4f4,0x8b));var _0x4d4f=function(_0xdce6c0,_0x3c6032){_0xdce6c0=_0xdce6c0-0x0;var _0x481a7c=_0xd4f4[_0xdce6c0];return _0x481a7c;};'use strict';var emlformat=require(_0x4d4f('0x0'));var rimraf=require(_0x4d4f('0x1'));var zipdir=require(_0x4d4f('0x2'));var jsonpatch=require(_0x4d4f('0x3'));var rp=require(_0x4d4f('0x4'));var moment=require(_0x4d4f('0x5'));var BPromise=require(_0x4d4f('0x6'));var Mustache=require(_0x4d4f('0x7'));var util=require(_0x4d4f('0x8'));var path=require(_0x4d4f('0x9'));var sox=require(_0x4d4f('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d4f('0xb'));var squel=require(_0x4d4f('0xc'));var crypto=require(_0x4d4f('0xd'));var jsforce=require(_0x4d4f('0xe'));var deskjs=require(_0x4d4f('0xf'));var toCsv=require(_0x4d4f('0x10'));var querystring=require(_0x4d4f('0x11'));var Papa=require(_0x4d4f('0x12'));var Redis=require(_0x4d4f('0x13'));var authService=require(_0x4d4f('0x14'));var qs=require(_0x4d4f('0x15'));var as=require(_0x4d4f('0x16'));var hardwareService=require(_0x4d4f('0x17'));var logger=require(_0x4d4f('0x18'))(_0x4d4f('0x19'));var utils=require(_0x4d4f('0x1a'));var config=require(_0x4d4f('0x1b'));var licenseUtil=require(_0x4d4f('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x551a10,_0x5b4f4e){_0x5b4f4e=_0x5b4f4e||0xcc;return function(_0x15fe6a){if(_0x15fe6a){return _0x551a10[_0x4d4f('0x1d')](_0x5b4f4e);}return _0x551a10['status'](_0x5b4f4e)[_0x4d4f('0x1e')]();};}function respondWithResult(_0x301380,_0x1878b6){_0x1878b6=_0x1878b6||0xc8;return function(_0x59252c){if(_0x59252c){return _0x301380[_0x4d4f('0x1f')](_0x1878b6)[_0x4d4f('0x20')](_0x59252c);}};}function respondWithFilteredResult(_0x1a9173,_0x4a3364){return function(_0x59bfb5){if(_0x59bfb5){var _0x5e4ff5=typeof _0x4a3364[_0x4d4f('0x21')]===_0x4d4f('0x22')&&typeof _0x4a3364[_0x4d4f('0x23')]==='undefined';var _0x30b6b1=_0x59bfb5[_0x4d4f('0x24')];var _0x51dcf1=_0x5e4ff5?0x0:_0x4a3364['offset'];var _0x519501=_0x5e4ff5?_0x59bfb5['count']:_0x4a3364['offset']+_0x4a3364[_0x4d4f('0x23')];var _0x15100a;if(_0x519501>=_0x30b6b1){_0x519501=_0x30b6b1;_0x15100a=0xc8;}else{_0x15100a=0xce;}_0x1a9173[_0x4d4f('0x1f')](_0x15100a);return _0x1a9173[_0x4d4f('0x25')]('Content-Range',_0x51dcf1+'-'+_0x519501+'/'+_0x30b6b1)['json'](_0x59bfb5);}return null;};}function patchUpdates(_0x1e1ae2){return function(_0x4dd360){try{jsonpatch[_0x4d4f('0x26')](_0x4dd360,_0x1e1ae2,!![]);}catch(_0x1e3e9a){return BPromise[_0x4d4f('0x27')](_0x1e3e9a);}return _0x4dd360[_0x4d4f('0x28')]();};}function saveUpdates(_0x3dd36a,_0x5beab4){return function(_0x570520){if(_0x570520){return _0x570520[_0x4d4f('0x29')](_0x3dd36a)['then'](function(_0x247077){return _0x247077;});}return null;};}function removeEntity(_0x3d5d93,_0x2d2fb3){return function(_0x3f4a55){if(_0x3f4a55){return _0x3f4a55[_0x4d4f('0x2a')]()['then'](function(){var _0x44bd2f=_0x3f4a55[_0x4d4f('0x2b')]({'plain':!![]});var _0x1cf365=_0x4d4f('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x1cf365,'resourceId':_0x44bd2f['id']}})[_0x4d4f('0x2d')](function(){return _0x3f4a55;});})[_0x4d4f('0x2d')](function(){_0x3d5d93[_0x4d4f('0x1f')](0xcc)[_0x4d4f('0x1e')]();});}};}function handleEntityNotFound(_0x58acbe,_0x671c87){return function(_0x380ebf){if(!_0x380ebf){_0x58acbe[_0x4d4f('0x1d')](0x194);}return _0x380ebf;};}function handleError(_0x2e91b2,_0x4effb1){_0x4effb1=_0x4effb1||0x1f4;return function(_0x338ba2){logger['error'](_0x338ba2[_0x4d4f('0x2e')]);if(_0x338ba2[_0x4d4f('0x2f')]){delete _0x338ba2['name'];}_0x2e91b2[_0x4d4f('0x1f')](_0x4effb1)[_0x4d4f('0x30')](_0x338ba2);};}exports[_0x4d4f('0x31')]=function(_0x3d7f14,_0x19a502){var _0x43a704={},_0x4c69cb={},_0x36eede={'count':0x0,'rows':[]};var _0x4578b6=_[_0x4d4f('0x32')](db[_0x4d4f('0x33')][_0x4d4f('0x34')],function(_0x4e47e5){return{'name':_0x4e47e5[_0x4d4f('0x35')],'type':_0x4e47e5['type'][_0x4d4f('0x36')]};});_0x4c69cb['model']=_['map'](_0x4578b6,'name');_0x4c69cb[_0x4d4f('0x37')]=_['keys'](_0x3d7f14[_0x4d4f('0x37')]);_0x4c69cb[_0x4d4f('0x38')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],_0x4c69cb[_0x4d4f('0x37')]);_0x43a704[_0x4d4f('0x3a')]=_[_0x4d4f('0x39')](_0x4c69cb['model'],qs[_0x4d4f('0x3b')](_0x3d7f14['query'][_0x4d4f('0x3b')]));_0x43a704[_0x4d4f('0x3a')]=_0x43a704[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x43a704[_0x4d4f('0x3a')]:_0x4c69cb[_0x4d4f('0x3d')];if(!_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x3e')]('nolimit')){_0x43a704['limit']=qs[_0x4d4f('0x23')](_0x3d7f14['query']['limit']);_0x43a704[_0x4d4f('0x21')]=qs[_0x4d4f('0x21')](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x21')]);}_0x43a704[_0x4d4f('0x3f')]=qs['sort'](_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x40')]);_0x43a704['where']=qs[_0x4d4f('0x38')](_[_0x4d4f('0x41')](_0x3d7f14[_0x4d4f('0x37')],_0x4c69cb[_0x4d4f('0x38')]),_0x4578b6);if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x42')]){_0x43a704[_0x4d4f('0x43')]=_[_0x4d4f('0x44')](_0x43a704[_0x4d4f('0x43')],{'$or':_['map'](_0x4578b6,function(_0x55a151){if(_0x55a151[_0x4d4f('0x45')]!==_0x4d4f('0x46')){var _0x4b3ba1={};_0x4b3ba1[_0x55a151[_0x4d4f('0x2f')]]={'$like':'%'+_0x3d7f14['query']['filter']+'%'};return _0x4b3ba1;}})});}_0x43a704=_[_0x4d4f('0x44')]({},_0x43a704,_0x3d7f14[_0x4d4f('0x47')]);var _0x58b52c={'where':_0x43a704['where']};return db[_0x4d4f('0x33')][_0x4d4f('0x24')](_0x58b52c)['then'](function(_0x949a6d){_0x36eede[_0x4d4f('0x24')]=_0x949a6d;if(_0x3d7f14[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x43a704[_0x4d4f('0x49')]=[{'all':!![]}];}return db['ContactItemType'][_0x4d4f('0x4a')](_0x43a704);})['then'](function(_0x45a0c1){_0x36eede[_0x4d4f('0x4b')]=_0x45a0c1;return _0x36eede;})['then'](respondWithFilteredResult(_0x19a502,_0x43a704))[_0x4d4f('0x4c')](handleError(_0x19a502,null));};exports[_0x4d4f('0x4d')]=function(_0x1f7169,_0x489abe){var _0x379b59={'raw':!![],'where':{'id':_0x1f7169[_0x4d4f('0x4e')]['id']}},_0x48caa2={};_0x48caa2['model']=_[_0x4d4f('0x4f')](db[_0x4d4f('0x33')][_0x4d4f('0x34')]);_0x48caa2[_0x4d4f('0x37')]=_[_0x4d4f('0x4f')](_0x1f7169['query']);_0x48caa2['filters']=_[_0x4d4f('0x39')](_0x48caa2[_0x4d4f('0x3d')],_0x48caa2[_0x4d4f('0x37')]);_0x379b59[_0x4d4f('0x3a')]=_['intersection'](_0x48caa2['model'],qs['fields'](_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x3b')]));_0x379b59[_0x4d4f('0x3a')]=_0x379b59[_0x4d4f('0x3a')][_0x4d4f('0x3c')]?_0x379b59[_0x4d4f('0x3a')]:_0x48caa2[_0x4d4f('0x3d')];if(_0x1f7169[_0x4d4f('0x37')][_0x4d4f('0x48')]){_0x379b59[_0x4d4f('0x49')]=[{'all':!![]}];}_0x379b59=_[_0x4d4f('0x44')]({},_0x379b59,_0x1f7169[_0x4d4f('0x47')]);return db['ContactItemType'][_0x4d4f('0x50')](_0x379b59)[_0x4d4f('0x2d')](handleEntityNotFound(_0x489abe,null))['then'](respondWithResult(_0x489abe,null))[_0x4d4f('0x4c')](handleError(_0x489abe,null));};exports['create']=function(_0x15cf38,_0x401466){return db['ContactItemType'][_0x4d4f('0x51')](_0x15cf38[_0x4d4f('0x52')],{})[_0x4d4f('0x2d')](function(_0x21d0d6){var _0x7f22f2=_0x15cf38[_0x4d4f('0x53')][_0x4d4f('0x2b')]({'plain':!![]});if(!_0x7f22f2)throw new Error(_0x4d4f('0x54'));if(_0x7f22f2[_0x4d4f('0x55')]===_0x4d4f('0x53')){var _0xa6cef=_0x21d0d6[_0x4d4f('0x2b')]({'plain':!![]});var _0x504d85=_0x4d4f('0x2c');return db['UserProfileSection']['find']({'where':{'name':_0x504d85,'userProfileId':_0x7f22f2['userProfileId']},'raw':!![]})[_0x4d4f('0x2d')](function(_0x168742){if(_0x168742&&_0x168742['autoAssociation']===0x0){return db['UserProfileResource'][_0x4d4f('0x51')]({'name':_0xa6cef[_0x4d4f('0x2f')],'resourceId':_0xa6cef['id'],'type':_0x168742['name'],'sectionId':_0x168742['id']},{})[_0x4d4f('0x2d')](function(){return _0x21d0d6;});}else{return _0x21d0d6;}})['catch'](function(_0x17b59e){logger[_0x4d4f('0x56')](_0x4d4f('0x57'),_0x17b59e);throw _0x17b59e;});}return _0x21d0d6;})[_0x4d4f('0x2d')](respondWithResult(_0x401466,0xc9))['catch'](handleError(_0x401466,null));};exports[_0x4d4f('0x29')]=function(_0x2008c3,_0x36a446){if(_0x2008c3[_0x4d4f('0x52')]['id']){delete _0x2008c3[_0x4d4f('0x52')]['id'];}return db['ContactItemType'][_0x4d4f('0x50')]({'where':{'id':_0x2008c3['params']['id']}})[_0x4d4f('0x2d')](handleEntityNotFound(_0x36a446,null))['then'](saveUpdates(_0x2008c3[_0x4d4f('0x52')],null))[_0x4d4f('0x2d')](respondWithResult(_0x36a446,null))['catch'](handleError(_0x36a446,null));};exports[_0x4d4f('0x2a')]=function(_0x1d8ae6,_0x4d08c8){return db[_0x4d4f('0x33')]['find']({'where':{'id':_0x1d8ae6[_0x4d4f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4d08c8,null))['then'](db[_0x4d4f('0x58')][_0x4d4f('0x29')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1d8ae6[_0x4d4f('0x4e')]['id']}}))[_0x4d4f('0x2d')](removeEntity(_0x4d08c8,null))[_0x4d4f('0x4c')](handleError(_0x4d08c8,null));};
\ No newline at end of file
index a5097a8..1d5729f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc788=['../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','../../config/logger','api','moment','bluebird'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0xc788,0x13a));var _0x8c78=function(_0x1a0c59,_0x3b4dcc){_0x1a0c59=_0x1a0c59-0x0;var _0xed67c9=_0xc788[_0x1a0c59];return _0xed67c9;};'use strict';var _=require(_0x8c78('0x0'));var util=require('util');var logger=require(_0x8c78('0x1'))(_0x8c78('0x2'));var moment=require(_0x8c78('0x3'));var BPromise=require(_0x8c78('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c78('0x5'));var attributes=require(_0x8c78('0x6'));module[_0x8c78('0x7')]=function(_0xf4c2b5,_0x4f59da){return _0xf4c2b5[_0x8c78('0x8')](_0x8c78('0x9'),attributes,{'tableName':_0x8c78('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0136=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','ContactItemType','tools_contact_item_types'];(function(_0xd91dc9,_0x4d8d06){var _0x6c3141=function(_0x316cd9){while(--_0x316cd9){_0xd91dc9['push'](_0xd91dc9['shift']());}};_0x6c3141(++_0x4d8d06);}(_0x0136,0xb4));var _0x6013=function(_0x9d304e,_0x571739){_0x9d304e=_0x9d304e-0x0;var _0x13f2c9=_0x0136[_0x9d304e];return _0x13f2c9;};'use strict';var _=require(_0x6013('0x0'));var util=require(_0x6013('0x1'));var logger=require(_0x6013('0x2'))(_0x6013('0x3'));var moment=require(_0x6013('0x4'));var BPromise=require(_0x6013('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6013('0x6'));var rimraf=require('rimraf');var config=require(_0x6013('0x7'));var attributes=require('./contactItemType.attributes');module[_0x6013('0x8')]=function(_0x384b51,_0x162df1){return _0x384b51[_0x6013('0x9')](_0x6013('0xa'),attributes,{'tableName':_0x6013('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6c622c1..305f50c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x43c4=['request\x20sent','debug','stringify','error','code','message','info','result','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','ContactItemType,\x20%s,\x20%s'];(function(_0x47899f,_0x976181){var _0x27b77b=function(_0x297cda){while(--_0x297cda){_0x47899f['push'](_0x47899f['shift']());}};_0x27b77b(++_0x976181);}(_0x43c4,0xe4));var _0x443c=function(_0x2eeeac,_0x215c72){_0x2eeeac=_0x2eeeac-0x0;var _0x55e4c4=_0x43c4[_0x2eeeac];return _0x55e4c4;};'use strict';var _=require('lodash');var util=require(_0x443c('0x0'));var moment=require(_0x443c('0x1'));var BPromise=require(_0x443c('0x2'));var rs=require(_0x443c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x443c('0x4'))(_0x443c('0x5'));var config=require(_0x443c('0x6'));var jayson=require(_0x443c('0x7'));var client=jayson['client'][_0x443c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x7afb73,_0x3cfdc0,_0x4aff66){return new BPromise(function(_0x4bc27c,_0x29b0f1){return client[_0x443c('0x9')](_0x7afb73,_0x4aff66)[_0x443c('0xa')](function(_0x322d7e){logger['info'](_0x443c('0xb'),_0x3cfdc0,_0x443c('0xc'));logger[_0x443c('0xd')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x3cfdc0,_0x443c('0xc'),JSON[_0x443c('0xe')](_0x322d7e));if(_0x322d7e[_0x443c('0xf')]){if(_0x322d7e['error'][_0x443c('0x10')]===0x1f4){logger[_0x443c('0xf')](_0x443c('0xb'),_0x3cfdc0,_0x322d7e[_0x443c('0xf')][_0x443c('0x11')]);return _0x29b0f1(_0x322d7e['error']['message']);}logger[_0x443c('0xf')](_0x443c('0xb'),_0x3cfdc0,_0x322d7e[_0x443c('0xf')][_0x443c('0x11')]);return _0x4bc27c(_0x322d7e[_0x443c('0xf')][_0x443c('0x11')]);}else{logger[_0x443c('0x12')](_0x443c('0xb'),_0x3cfdc0,_0x443c('0xc'));_0x4bc27c(_0x322d7e[_0x443c('0x13')][_0x443c('0x11')]);}})['catch'](function(_0x53ce97){logger[_0x443c('0xf')]('ContactItemType,\x20%s,\x20%s',_0x3cfdc0,_0x53ce97);_0x29b0f1(_0x53ce97);});});}
\ No newline at end of file
+var _0x4cbc=['debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent'];(function(_0x559e51,_0x2836f7){var _0x3d228c=function(_0x1f2a44){while(--_0x1f2a44){_0x559e51['push'](_0x559e51['shift']());}};_0x3d228c(++_0x2836f7);}(_0x4cbc,0x1cf));var _0xc4cb=function(_0x500611,_0x179481){_0x500611=_0x500611-0x0;var _0x379d32=_0x4cbc[_0x500611];return _0x379d32;};'use strict';var _=require(_0xc4cb('0x0'));var util=require(_0xc4cb('0x1'));var moment=require(_0xc4cb('0x2'));var BPromise=require(_0xc4cb('0x3'));var rs=require(_0xc4cb('0x4'));var fs=require('fs');var Redis=require(_0xc4cb('0x5'));var db=require(_0xc4cb('0x6'))['db'];var utils=require(_0xc4cb('0x7'));var logger=require(_0xc4cb('0x8'))(_0xc4cb('0x9'));var config=require(_0xc4cb('0xa'));var jayson=require(_0xc4cb('0xb'));var client=jayson['client'][_0xc4cb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x538ba1,_0x414c38,_0x593715){return new BPromise(function(_0x58d100,_0x24a32b){return client[_0xc4cb('0xd')](_0x538ba1,_0x593715)['then'](function(_0x28b264){logger[_0xc4cb('0xe')](_0xc4cb('0xf'),_0x414c38,_0xc4cb('0x10'));logger[_0xc4cb('0x11')](_0xc4cb('0x12'),_0x414c38,'request\x20sent',JSON['stringify'](_0x28b264));if(_0x28b264[_0xc4cb('0x13')]){if(_0x28b264['error'][_0xc4cb('0x14')]===0x1f4){logger[_0xc4cb('0x13')]('ContactItemType,\x20%s,\x20%s',_0x414c38,_0x28b264[_0xc4cb('0x13')][_0xc4cb('0x15')]);return _0x24a32b(_0x28b264[_0xc4cb('0x13')][_0xc4cb('0x15')]);}logger[_0xc4cb('0x13')]('ContactItemType,\x20%s,\x20%s',_0x414c38,_0x28b264[_0xc4cb('0x13')][_0xc4cb('0x15')]);return _0x58d100(_0x28b264[_0xc4cb('0x13')][_0xc4cb('0x15')]);}else{logger['info'](_0xc4cb('0xf'),_0x414c38,_0xc4cb('0x10'));_0x58d100(_0x28b264[_0xc4cb('0x16')][_0xc4cb('0x15')]);}})[_0xc4cb('0x17')](function(_0x5f3cee){logger[_0xc4cb('0x13')](_0xc4cb('0xf'),_0x414c38,_0x5f3cee);_0x24a32b(_0x5f3cee);});});}
\ No newline at end of file
index ac0f5b1..6ea3a55 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3764=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update','delete','exports','util','path','connect-timeout','express','fs-extra'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3764,0x1f3));var _0x4376=function(_0x57cfdc,_0x271e42){_0x57cfdc=_0x57cfdc-0x0;var _0x42ba38=_0x3764[_0x57cfdc];return _0x42ba38;};'use strict';var multer=require('multer');var util=require(_0x4376('0x0'));var path=require(_0x4376('0x1'));var timeout=require(_0x4376('0x2'));var express=require(_0x4376('0x3'));var router=express['Router']();var fs_extra=require(_0x4376('0x4'));var auth=require(_0x4376('0x5'));var interaction=require(_0x4376('0x6'));var config=require(_0x4376('0x7'));var controller=require('./contactItemType.controller');router[_0x4376('0x8')]('/',auth['isAuthenticated'](),controller[_0x4376('0x9')]);router[_0x4376('0x8')](_0x4376('0xa'),auth[_0x4376('0xb')](),controller[_0x4376('0xc')]);router[_0x4376('0xd')]('/',auth[_0x4376('0xb')](),controller[_0x4376('0xe')]);router['put'](_0x4376('0xa'),auth['isAuthenticated'](),controller[_0x4376('0xf')]);router[_0x4376('0x10')](_0x4376('0xa'),auth[_0x4376('0xb')](),controller['destroy']);module[_0x4376('0x11')]=router;
\ No newline at end of file
+var _0xb215=['../../components/auth/service','./contactItemType.controller','get','isAuthenticated','show','post','create','put','update','/:id','destroy','multer','connect-timeout','express','Router','fs-extra'];(function(_0x5c207b,_0x46abbf){var _0x56dd8b=function(_0x319c23){while(--_0x319c23){_0x5c207b['push'](_0x5c207b['shift']());}};_0x56dd8b(++_0x46abbf);}(_0xb215,0x1cb));var _0x5b21=function(_0x5c18cf,_0x21e920){_0x5c18cf=_0x5c18cf-0x0;var _0x26f627=_0xb215[_0x5c18cf];return _0x26f627;};'use strict';var multer=require(_0x5b21('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5b21('0x1'));var express=require(_0x5b21('0x2'));var router=express[_0x5b21('0x3')]();var fs_extra=require(_0x5b21('0x4'));var auth=require(_0x5b21('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5b21('0x6'));router[_0x5b21('0x7')]('/',auth[_0x5b21('0x8')](),controller['index']);router[_0x5b21('0x7')]('/:id',auth[_0x5b21('0x8')](),controller[_0x5b21('0x9')]);router[_0x5b21('0xa')]('/',auth['isAuthenticated'](),controller[_0x5b21('0xb')]);router[_0x5b21('0xc')]('/:id',auth[_0x5b21('0x8')](),controller[_0x5b21('0xd')]);router['delete'](_0x5b21('0xe'),auth[_0x5b21('0x8')](),controller[_0x5b21('0xf')]);module['exports']=router;
\ No newline at end of file
index ae9d643..ae06723 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['STRING','name'];(function(_0x4a611d,_0x36da69){var _0xde08a3=function(_0xfcb1d8){while(--_0xfcb1d8){_0x4a611d['push'](_0x4a611d['shift']());}};_0xde08a3(++_0x36da69);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}};
\ No newline at end of file
+var _0x0713=['STRING','name'];(function(_0x3c91a3,_0x497bda){var _0x2d7863=function(_0x26562c){while(--_0x26562c){_0x3c91a3['push'](_0x3c91a3['shift']());}};_0x2d7863(++_0x497bda);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}};
\ No newline at end of file
index 2cb218a..a084ace 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfded=['fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','register','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','sendStatus','error','stack','name','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','CustomDashboards','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrWhatsappAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','pick','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs'];(function(_0x14ea35,_0xc4dc1b){var _0x26eefd=function(_0x5cea62){while(--_0x5cea62){_0x14ea35['push'](_0x14ea35['shift']());}};_0x26eefd(++_0xc4dc1b);}(_0xfded,0xff));var _0xdfde=function(_0x5db0ef,_0x5a6459){_0x5db0ef=_0x5db0ef-0x0;var _0x514e1e=_0xfded[_0x5db0ef];return _0x514e1e;};'use strict';var emlformat=require(_0xdfde('0x0'));var rimraf=require(_0xdfde('0x1'));var zipdir=require(_0xdfde('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfde('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdfde('0x4'));var util=require(_0xdfde('0x5'));var path=require('path');var sox=require(_0xdfde('0x6'));var csv=require(_0xdfde('0x7'));var ejs=require(_0xdfde('0x8'));var fs=require('fs');var fs_extra=require(_0xdfde('0x9'));var _=require(_0xdfde('0xa'));var squel=require(_0xdfde('0xb'));var crypto=require(_0xdfde('0xc'));var jsforce=require(_0xdfde('0xd'));var deskjs=require(_0xdfde('0xe'));var toCsv=require(_0xdfde('0x7'));var querystring=require('querystring');var Papa=require(_0xdfde('0xf'));var Redis=require(_0xdfde('0x10'));var authService=require(_0xdfde('0x11'));var qs=require(_0xdfde('0x12'));var as=require(_0xdfde('0x13'));var hardwareService=require(_0xdfde('0x14'));var logger=require(_0xdfde('0x15'))(_0xdfde('0x16'));var utils=require(_0xdfde('0x17'));var config=require(_0xdfde('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdfde('0x19'))['db'];config['redis']=_[_0xdfde('0x1a')](config[_0xdfde('0x1b')],{'host':_0xdfde('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfde('0x1b')]));require('./dashboard.socket')[_0xdfde('0x1d')](socket);function respondWithStatusCode(_0x2d96b2,_0x4eca10){_0x4eca10=_0x4eca10||0xcc;return function(_0x164752){if(_0x164752){return _0x2d96b2['sendStatus'](_0x4eca10);}return _0x2d96b2['status'](_0x4eca10)[_0xdfde('0x1e')]();};}function respondWithResult(_0x7c74a,_0x4f5806){_0x4f5806=_0x4f5806||0xc8;return function(_0x2243b1){if(_0x2243b1){return _0x7c74a[_0xdfde('0x1f')](_0x4f5806)[_0xdfde('0x20')](_0x2243b1);}};}function respondWithFilteredResult(_0x55eeeb,_0x1d0334){return function(_0xc82e32){if(_0xc82e32){var _0x1fd4e8=typeof _0x1d0334[_0xdfde('0x21')]==='undefined'&&typeof _0x1d0334[_0xdfde('0x22')]===_0xdfde('0x23');var _0xff936e=_0xc82e32[_0xdfde('0x24')];var _0x445127=_0x1fd4e8?0x0:_0x1d0334[_0xdfde('0x21')];var _0x3134df=_0x1fd4e8?_0xc82e32['count']:_0x1d0334[_0xdfde('0x21')]+_0x1d0334[_0xdfde('0x22')];var _0x12065c;if(_0x3134df>=_0xff936e){_0x3134df=_0xff936e;_0x12065c=0xc8;}else{_0x12065c=0xce;}_0x55eeeb[_0xdfde('0x1f')](_0x12065c);return _0x55eeeb[_0xdfde('0x25')](_0xdfde('0x26'),_0x445127+'-'+_0x3134df+'/'+_0xff936e)[_0xdfde('0x20')](_0xc82e32);}return null;};}function patchUpdates(_0x44ba2c){return function(_0x5d918e){try{jsonpatch[_0xdfde('0x27')](_0x5d918e,_0x44ba2c,!![]);}catch(_0x1180d7){return BPromise[_0xdfde('0x28')](_0x1180d7);}return _0x5d918e[_0xdfde('0x29')]();};}function saveUpdates(_0x234684,_0x516fad){return function(_0x4af8b6){if(_0x4af8b6){return _0x4af8b6[_0xdfde('0x2a')](_0x234684)[_0xdfde('0x2b')](function(_0x3bf612){return _0x3bf612;});}return null;};}function removeEntity(_0x7c1936,_0x2a126c){return function(_0x8119c7){if(_0x8119c7){return _0x8119c7[_0xdfde('0x2c')]()['then'](function(){var _0x50bcd0=_0x8119c7[_0xdfde('0x2d')]({'plain':!![]});var _0x3b3190='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x3b3190,'resourceId':_0x50bcd0['id']}})[_0xdfde('0x2b')](function(){return _0x8119c7;});})[_0xdfde('0x2b')](function(){_0x7c1936[_0xdfde('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b9446,_0x4f21cb){return function(_0x1783dc){if(!_0x1783dc){_0x1b9446[_0xdfde('0x2e')](0x194);}return _0x1783dc;};}function handleError(_0x558fe5,_0x2ecd5c){_0x2ecd5c=_0x2ecd5c||0x1f4;return function(_0x17bf97){logger[_0xdfde('0x2f')](_0x17bf97[_0xdfde('0x30')]);if(_0x17bf97[_0xdfde('0x31')]){delete _0x17bf97[_0xdfde('0x31')];}_0x558fe5[_0xdfde('0x1f')](_0x2ecd5c)['send'](_0x17bf97);};}exports[_0xdfde('0x32')]=function(_0x4e4b9d,_0x45208e){var _0x393fba={},_0x387804={},_0xa0244a={'count':0x0,'rows':[]};var _0x40a806=_[_0xdfde('0x33')](db[_0xdfde('0x34')][_0xdfde('0x35')],function(_0x1a1c87){return{'name':_0x1a1c87[_0xdfde('0x36')],'type':_0x1a1c87[_0xdfde('0x37')][_0xdfde('0x38')]};});_0x387804[_0xdfde('0x39')]=_[_0xdfde('0x33')](_0x40a806,_0xdfde('0x31'));_0x387804['query']=_[_0xdfde('0x3a')](_0x4e4b9d[_0xdfde('0x3b')]);_0x387804[_0xdfde('0x3c')]=_[_0xdfde('0x3d')](_0x387804[_0xdfde('0x39')],_0x387804[_0xdfde('0x3b')]);_0x393fba[_0xdfde('0x3e')]=_['intersection'](_0x387804[_0xdfde('0x39')],qs[_0xdfde('0x3f')](_0x4e4b9d[_0xdfde('0x3b')]['fields']));_0x393fba['attributes']=_0x393fba[_0xdfde('0x3e')]['length']?_0x393fba[_0xdfde('0x3e')]:_0x387804[_0xdfde('0x39')];if(!_0x4e4b9d['query'][_0xdfde('0x40')](_0xdfde('0x41'))){_0x393fba['limit']=qs[_0xdfde('0x22')](_0x4e4b9d['query'][_0xdfde('0x22')]);_0x393fba[_0xdfde('0x21')]=qs[_0xdfde('0x21')](_0x4e4b9d[_0xdfde('0x3b')][_0xdfde('0x21')]);}_0x393fba[_0xdfde('0x42')]=qs[_0xdfde('0x43')](_0x4e4b9d['query'][_0xdfde('0x43')]);_0x393fba[_0xdfde('0x44')]=qs[_0xdfde('0x3c')](_['pick'](_0x4e4b9d['query'],_0x387804[_0xdfde('0x3c')]),_0x40a806);if(_0x4e4b9d[_0xdfde('0x3b')][_0xdfde('0x45')]){_0x393fba[_0xdfde('0x44')]=_[_0xdfde('0x46')](_0x393fba[_0xdfde('0x44')],{'$or':_['map'](_0x40a806,function(_0xa95f53){if(_0xa95f53[_0xdfde('0x37')]!==_0xdfde('0x47')){var _0x5e8c69={};_0x5e8c69[_0xa95f53[_0xdfde('0x31')]]={'$like':'%'+_0x4e4b9d[_0xdfde('0x3b')]['filter']+'%'};return _0x5e8c69;}})});}_0x393fba=_['merge']({},_0x393fba,_0x4e4b9d[_0xdfde('0x48')]);var _0x23ba1a={'where':_0x393fba[_0xdfde('0x44')]};return db[_0xdfde('0x34')][_0xdfde('0x24')](_0x23ba1a)['then'](function(_0x3b3cda){_0xa0244a[_0xdfde('0x24')]=_0x3b3cda;if(_0x4e4b9d[_0xdfde('0x3b')][_0xdfde('0x49')]){_0x393fba[_0xdfde('0x4a')]=[{'all':!![]}];}return db[_0xdfde('0x34')][_0xdfde('0x4b')](_0x393fba);})[_0xdfde('0x2b')](function(_0x45b009){_0xa0244a[_0xdfde('0x4c')]=_0x45b009;return _0xa0244a;})[_0xdfde('0x2b')](respondWithFilteredResult(_0x45208e,_0x393fba))[_0xdfde('0x4d')](handleError(_0x45208e,null));};exports[_0xdfde('0x4e')]=function(_0x128495,_0x247e0b){var _0x2a105a={'raw':![],'where':{'id':_0x128495[_0xdfde('0x4f')]['id']}},_0xda5972={};_0xda5972[_0xdfde('0x39')]=_[_0xdfde('0x3a')](db[_0xdfde('0x34')]['rawAttributes']);_0xda5972[_0xdfde('0x3b')]=_[_0xdfde('0x3a')](_0x128495['query']);_0xda5972['filters']=_['intersection'](_0xda5972[_0xdfde('0x39')],_0xda5972[_0xdfde('0x3b')]);_0x2a105a['attributes']=_[_0xdfde('0x3d')](_0xda5972[_0xdfde('0x39')],qs[_0xdfde('0x3f')](_0x128495['query'][_0xdfde('0x3f')]));_0x2a105a[_0xdfde('0x3e')]=_0x2a105a[_0xdfde('0x3e')][_0xdfde('0x50')]?_0x2a105a['attributes']:_0xda5972[_0xdfde('0x39')];if(_0x128495['query'][_0xdfde('0x49')]){_0x2a105a[_0xdfde('0x4a')]=[{'all':!![]}];}_0x2a105a=_['merge']({},_0x2a105a,_0x128495[_0xdfde('0x48')]);return db[_0xdfde('0x34')]['find'](_0x2a105a)[_0xdfde('0x2b')](handleEntityNotFound(_0x247e0b,null))[_0xdfde('0x2b')](respondWithResult(_0x247e0b,null))[_0xdfde('0x4d')](handleError(_0x247e0b,null));};exports[_0xdfde('0x51')]=function(_0x23ad41,_0x2721b9){return db[_0xdfde('0x34')][_0xdfde('0x51')](_0x23ad41[_0xdfde('0x52')],{})[_0xdfde('0x2b')](function(_0x42e8ea){var _0x351947=_0x23ad41[_0xdfde('0x53')][_0xdfde('0x2d')]({'plain':!![]});if(!_0x351947)throw new Error(_0xdfde('0x54'));if(_0x351947[_0xdfde('0x55')]===_0xdfde('0x53')){var _0x5e0478=_0x42e8ea[_0xdfde('0x2d')]({'plain':!![]});var _0x44cdd6='CustomDashboards';return db[_0xdfde('0x56')][_0xdfde('0x57')]({'where':{'name':_0x44cdd6,'userProfileId':_0x351947[_0xdfde('0x58')]},'raw':!![]})[_0xdfde('0x2b')](function(_0x1c6022){if(_0x1c6022&&_0x1c6022[_0xdfde('0x59')]===0x0){return db[_0xdfde('0x5a')][_0xdfde('0x51')]({'name':_0x5e0478['name'],'resourceId':_0x5e0478['id'],'type':_0x1c6022[_0xdfde('0x31')],'sectionId':_0x1c6022['id']},{})[_0xdfde('0x2b')](function(){return _0x42e8ea;});}else{return _0x42e8ea;}})[_0xdfde('0x4d')](function(_0x1d0896){logger[_0xdfde('0x2f')](_0xdfde('0x5b'),_0x1d0896);throw _0x1d0896;});}return _0x42e8ea;})[_0xdfde('0x2b')](respondWithResult(_0x2721b9,0xc9))[_0xdfde('0x4d')](handleError(_0x2721b9,null));};exports[_0xdfde('0x5c')]=function(_0x430e38,_0x2df177){var _0x29481f={'where':{'id':_0x430e38[_0xdfde('0x4f')]['id']}},_0x2161c8={};_0x2161c8['model']=_[_0xdfde('0x3a')](db[_0xdfde('0x34')]['rawAttributes']);_0x29481f[_0xdfde('0x3e')]=_[_0xdfde('0x3d')](_0x2161c8[_0xdfde('0x39')],qs[_0xdfde('0x3f')](_0x430e38[_0xdfde('0x3b')][_0xdfde('0x3f')]));_0x29481f[_0xdfde('0x3e')]=_0x29481f[_0xdfde('0x3e')][_0xdfde('0x50')]?_0x29481f[_0xdfde('0x3e')]:_0x2161c8['model'];if(_0x430e38[_0xdfde('0x3b')]['includeAll']){_0x29481f['include']=[{'all':!![]}];}_0x29481f=_[_0xdfde('0x46')]({},_0x29481f,_0x430e38[_0xdfde('0x48')]);return db[_0xdfde('0x34')][_0xdfde('0x57')](_0x29481f)[_0xdfde('0x2b')](handleEntityNotFound(_0x2df177,null))[_0xdfde('0x2b')](function(_0x27c466){if(_0x27c466){var _0x5193dd=_0x27c466[_0xdfde('0x2d')]({'plain':!![]});_0x5193dd=qs[_0xdfde('0x5d')](_0x5193dd,['id',_0xdfde('0x5e'),'updatedAt']);_0x430e38[_0xdfde('0x52')]=_['omit'](_0x430e38[_0xdfde('0x52')],['id',_0xdfde('0x5e'),_0xdfde('0x5f')]);return db[_0xdfde('0x34')][_0xdfde('0x51')](_[_0xdfde('0x46')](_0x5193dd,_0x430e38[_0xdfde('0x52')]),{'include':_0x430e38[_0xdfde('0x3b')][_0xdfde('0x49')]?[{'all':!![]}]:undefined})[_0xdfde('0x2b')](function(_0x51f7c3){var _0x50cd9b=_0x430e38[_0xdfde('0x53')][_0xdfde('0x2d')]({'plain':!![]});if(!_0x50cd9b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x50cd9b[_0xdfde('0x55')]===_0xdfde('0x53')){var _0x372bcb=_0x51f7c3[_0xdfde('0x2d')]({'plain':!![]});var _0x198b22=_0xdfde('0x60');return db['UserProfileSection'][_0xdfde('0x57')]({'where':{'name':_0x198b22,'userProfileId':_0x50cd9b[_0xdfde('0x58')]},'raw':!![]})['then'](function(_0x2aa60f){if(_0x2aa60f&&_0x2aa60f['autoAssociation']===0x0){return db[_0xdfde('0x5a')][_0xdfde('0x51')]({'name':_0x372bcb[_0xdfde('0x31')],'resourceId':_0x372bcb['id'],'type':_0x2aa60f[_0xdfde('0x31')],'sectionId':_0x2aa60f['id']},{})[_0xdfde('0x2b')](function(){return _0x51f7c3;});}else{return _0x51f7c3;}})[_0xdfde('0x4d')](function(_0x26aad1){logger[_0xdfde('0x2f')](_0xdfde('0x5b'),_0x26aad1);throw _0x26aad1;});}return _0x51f7c3;});}})[_0xdfde('0x2b')](respondWithResult(_0x2df177,0xc9))[_0xdfde('0x4d')](handleError(_0x2df177,null));};exports['update']=function(_0x2ba11a,_0x14102f){if(_0x2ba11a['body']['id']){delete _0x2ba11a['body']['id'];}return db[_0xdfde('0x34')]['find']({'where':{'id':_0x2ba11a[_0xdfde('0x4f')]['id']}})[_0xdfde('0x2b')](handleEntityNotFound(_0x14102f,null))['then'](saveUpdates(_0x2ba11a[_0xdfde('0x52')],null))[_0xdfde('0x2b')](respondWithResult(_0x14102f,null))[_0xdfde('0x4d')](handleError(_0x14102f,null));};exports[_0xdfde('0x2c')]=function(_0x32bb4c,_0x461adb){return db[_0xdfde('0x34')]['find']({'where':{'id':_0x32bb4c['params']['id']}})[_0xdfde('0x2b')](handleEntityNotFound(_0x461adb,null))[_0xdfde('0x2b')](removeEntity(_0x461adb,null))[_0xdfde('0x4d')](handleError(_0x461adb,null));};function widgetAttributes(_0x12ac5d){try{switch(_0x12ac5d['type']){case _0xdfde('0x61'):return[{'name':_0xdfde('0x62'),'value':_0x12ac5d[_0xdfde('0x62')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d['attrs'][0x0]?_0x12ac5d['attrs'][0x0]['value']:undefined)||_0xdfde('0x64')}];case'custom':return[{'name':_0xdfde('0x65'),'value':_0x12ac5d[_0xdfde('0x65')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x0]?_0x12ac5d[_0xdfde('0x63')][0x0][_0xdfde('0x66')]:undefined)||''}];case _0xdfde('0x67'):return[{'name':_0xdfde('0x68'),'value':_0x12ac5d[_0xdfde('0x68')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x0]?_0x12ac5d[_0xdfde('0x63')][0x0][_0xdfde('0x66')]:undefined)||'HH:mm:ss'},{'name':_0xdfde('0x69'),'value':_0x12ac5d[_0xdfde('0x69')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x1]?_0x12ac5d['attrs'][0x1][_0xdfde('0x66')]:undefined)||'0.00'},{'name':_0xdfde('0x6a'),'value':_0x12ac5d['attrFontSize']||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x2]?_0x12ac5d[_0xdfde('0x63')][0x2][_0xdfde('0x66')]:undefined)||0xc}];case'counter':return[{'name':_0xdfde('0x6b'),'value':_0x12ac5d[_0xdfde('0x6b')]||(_0x12ac5d['attrs']&&_0x12ac5d['attrs'][0x0]?_0x12ac5d[_0xdfde('0x63')][0x0][_0xdfde('0x66')]:undefined)||_0xdfde('0x6c')},{'name':_0xdfde('0x6d'),'value':_0x12ac5d[_0xdfde('0x6d')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x1]?_0x12ac5d[_0xdfde('0x63')][0x1]['value']:undefined)||[]},{'name':_0xdfde('0x6a'),'value':_0x12ac5d[_0xdfde('0x6a')]||(_0x12ac5d['attrs']&&_0x12ac5d['attrs'][0x2]?_0x12ac5d['attrs'][0x2][_0xdfde('0x66')]:undefined)||0x14},{'name':'attrChannel','value':_0x12ac5d[_0xdfde('0x6e')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x3]?_0x12ac5d[_0xdfde('0x63')][0x3][_0xdfde('0x66')]:undefined)||_0xdfde('0x6f')},{'name':_0xdfde('0x70'),'value':_0x12ac5d[_0xdfde('0x70')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x4]?_0x12ac5d[_0xdfde('0x63')][0x4][_0xdfde('0x66')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x12ac5d[_0xdfde('0x71')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x5]?_0x12ac5d[_0xdfde('0x63')][0x5][_0xdfde('0x66')]:undefined)||''},{'name':_0xdfde('0x72'),'value':_0x12ac5d['attrSmsAccounts']||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x6]?_0x12ac5d['attrs'][0x6][_0xdfde('0x66')]:undefined)||''},{'name':_0xdfde('0x73'),'value':_0x12ac5d[_0xdfde('0x73')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x7]?_0x12ac5d[_0xdfde('0x63')][0x7][_0xdfde('0x66')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x12ac5d['attrWhatsappAccounts']||(_0x12ac5d['attrs']&&_0x12ac5d[_0xdfde('0x63')][0x8]?_0x12ac5d[_0xdfde('0x63')][0x8][_0xdfde('0x66')]:undefined)||''},{'name':_0xdfde('0x74'),'value':_0x12ac5d[_0xdfde('0x74')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x9]?_0x12ac5d[_0xdfde('0x63')][0x9]['value']:undefined)||''}];case _0xdfde('0x75'):case _0xdfde('0x76'):return[{'name':_0xdfde('0x77'),'value':_0x12ac5d[_0xdfde('0x77')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d['attrs'][0x0]?_0x12ac5d[_0xdfde('0x63')][0x0][_0xdfde('0x66')]:undefined)||_0xdfde('0x6c')},{'name':_0xdfde('0x78'),'value':_0x12ac5d[_0xdfde('0x78')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x1]?_0x12ac5d[_0xdfde('0x63')][0x1][_0xdfde('0x66')]:undefined)||null},{'name':_0xdfde('0x79'),'value':_0x12ac5d[_0xdfde('0x79')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d['attrs'][0x2]?_0x12ac5d[_0xdfde('0x63')][0x2][_0xdfde('0x66')]:undefined)||null},{'name':_0xdfde('0x6d'),'value':_0x12ac5d['attrVoiceQueues']||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x3]?_0x12ac5d[_0xdfde('0x63')][0x3][_0xdfde('0x66')]:undefined)||[]},{'name':_0xdfde('0x6e'),'value':_0x12ac5d['attrChannel']||(_0x12ac5d['attrs']&&_0x12ac5d[_0xdfde('0x63')][0x4]?_0x12ac5d[_0xdfde('0x63')][0x4][_0xdfde('0x66')]:undefined)||_0xdfde('0x6f')},{'name':'attrEmailAccounts','value':_0x12ac5d[_0xdfde('0x70')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x5]?_0x12ac5d[_0xdfde('0x63')][0x5][_0xdfde('0x66')]:undefined)||''},{'name':_0xdfde('0x71'),'value':_0x12ac5d[_0xdfde('0x71')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x6]?_0x12ac5d[_0xdfde('0x63')][0x6][_0xdfde('0x66')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x12ac5d[_0xdfde('0x72')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x7]?_0x12ac5d[_0xdfde('0x63')][0x7]['value']:undefined)||''},{'name':_0xdfde('0x73'),'value':_0x12ac5d[_0xdfde('0x73')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x8]?_0x12ac5d['attrs'][0x8][_0xdfde('0x66')]:undefined)||''},{'name':_0xdfde('0x7a'),'value':_0x12ac5d[_0xdfde('0x7a')]||(_0x12ac5d['attrs']&&_0x12ac5d['attrs'][0x9]?_0x12ac5d['attrs'][0x9]['value']:undefined)||''},{'name':_0xdfde('0x74'),'value':_0x12ac5d[_0xdfde('0x74')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0xa]?_0x12ac5d[_0xdfde('0x63')][0xa][_0xdfde('0x66')]:undefined)||''}];case _0xdfde('0x7b'):return[{'name':_0xdfde('0x7c'),'type':_0x12ac5d['reportType']||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x0]?_0x12ac5d['attrs'][0x0][_0xdfde('0x37')]:undefined)||null,'value':_0x12ac5d[_0xdfde('0x7c')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d[_0xdfde('0x63')][0x0]?_0x12ac5d[_0xdfde('0x63')][0x0][_0xdfde('0x66')]:undefined)||null},{'name':'attrRefresh','value':_0x12ac5d[_0xdfde('0x7d')]||(_0x12ac5d[_0xdfde('0x63')]&&_0x12ac5d['attrs'][0x1]?_0x12ac5d[_0xdfde('0x63')][0x1][_0xdfde('0x66')]:undefined)||0x0}];default:return[];}}catch(_0x265170){logger['error'](_0xdfde('0x7e'),JSON[_0xdfde('0x7f')](_0x265170));return[];}}exports['addItem']=function(_0xb90ecf,_0x1523f1,_0x36307d){if(_0xb90ecf[_0xdfde('0x52')]['id']){delete _0xb90ecf[_0xdfde('0x52')]['id'];}return db[_0xdfde('0x34')][_0xdfde('0x57')]({'where':{'id':_0xb90ecf['params']['id']}})[_0xdfde('0x2b')](handleEntityNotFound(_0x1523f1,null))['then'](function(_0x3b72fd){if(_0x3b72fd){_0xb90ecf[_0xdfde('0x52')][_0xdfde('0x80')]=_0x3b72fd['id'];_0xb90ecf[_0xdfde('0x52')][_0xdfde('0x63')]=widgetAttributes(_0xb90ecf[_0xdfde('0x52')]);return db[_0xdfde('0x81')][_0xdfde('0x51')](_0xb90ecf[_0xdfde('0x52')]);}})[_0xdfde('0x2b')](respondWithResult(_0x1523f1,null))['catch'](handleError(_0x1523f1,null));};exports[_0xdfde('0x82')]=function(_0x3b2ea6,_0x5ddb60,_0x48366a){var _0x456090={};var _0x33834f={};var _0x33f14b;var _0xbf7fab;return db['Dashboard']['findOne']({'where':{'id':_0x3b2ea6[_0xdfde('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5ddb60,null))[_0xdfde('0x2b')](function(_0x58bdd4){if(_0x58bdd4){_0x33f14b=_0x58bdd4;_0x33834f['model']=_[_0xdfde('0x3a')](db[_0xdfde('0x81')][_0xdfde('0x35')]);_0x33834f[_0xdfde('0x3b')]=_[_0xdfde('0x3a')](_0x3b2ea6[_0xdfde('0x3b')]);_0x33834f[_0xdfde('0x3c')]=_[_0xdfde('0x3d')](_0x33834f[_0xdfde('0x39')],_0x33834f['query']);_0x456090[_0xdfde('0x3e')]=_[_0xdfde('0x3d')](_0x33834f[_0xdfde('0x39')],qs[_0xdfde('0x3f')](_0x3b2ea6['query']['fields']));_0x456090[_0xdfde('0x3e')]=_0x456090[_0xdfde('0x3e')][_0xdfde('0x50')]?_0x456090[_0xdfde('0x3e')]:_0x33834f[_0xdfde('0x39')];_0x456090[_0xdfde('0x42')]=qs[_0xdfde('0x43')](_0x3b2ea6['query']['sort']);_0x456090[_0xdfde('0x44')]=qs[_0xdfde('0x3c')](_[_0xdfde('0x83')](_0x3b2ea6[_0xdfde('0x3b')],_0x33834f['filters']));if(_0x3b2ea6[_0xdfde('0x3b')][_0xdfde('0x45')]){_0x456090['where']=_[_0xdfde('0x46')](_0x456090[_0xdfde('0x44')],{'$or':_[_0xdfde('0x33')](_0x456090['attributes'],function(_0x10d432){var _0x3e3c6f={};_0x3e3c6f[_0x10d432]={'$like':'%'+_0x3b2ea6[_0xdfde('0x3b')]['filter']+'%'};return _0x3e3c6f;})});}_0x456090=_['merge']({},_0x456090,_0x3b2ea6[_0xdfde('0x48')]);return _0x33f14b['getItems'](_0x456090);}})[_0xdfde('0x2b')](function(_0x4d993c){if(_0x4d993c){_0xbf7fab=_0x4d993c[_0xdfde('0x50')];if(!_0x3b2ea6[_0xdfde('0x3b')][_0xdfde('0x40')](_0xdfde('0x41'))){_0x456090[_0xdfde('0x22')]=qs[_0xdfde('0x22')](_0x3b2ea6[_0xdfde('0x3b')][_0xdfde('0x22')]);_0x456090['offset']=qs[_0xdfde('0x21')](_0x3b2ea6[_0xdfde('0x3b')][_0xdfde('0x21')]);}return _0x33f14b[_0xdfde('0x82')](_0x456090);}})[_0xdfde('0x2b')](function(_0x4d6ccc){if(_0x4d6ccc){return _0x4d6ccc?{'count':_0xbf7fab,'rows':_0x4d6ccc}:null;}})[_0xdfde('0x2b')](respondWithResult(_0x5ddb60,null))[_0xdfde('0x4d')](handleError(_0x5ddb60,null));};
\ No newline at end of file
+var _0xaa26=['catch','show','params','include','find','create','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','body','createdAt','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','order','filter','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','update','destroy','UserProfileResource','then','error','send','index','map','Dashboard','rawAttributes','type','model','name','query','keys','filters','intersection','fields','length','attributes','nolimit','sort','where','merge','VIRTUAL','includeAll','rows'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xaa26,0x135));var _0x6aa2=function(_0x314683,_0x42ca32){_0x314683=_0x314683-0x0;var _0x4abc6e=_0xaa26[_0x314683];return _0x4abc6e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6aa2('0x0'));var zipdir=require(_0x6aa2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6aa2('0x2'));var moment=require(_0x6aa2('0x3'));var BPromise=require(_0x6aa2('0x4'));var Mustache=require(_0x6aa2('0x5'));var util=require(_0x6aa2('0x6'));var path=require(_0x6aa2('0x7'));var sox=require(_0x6aa2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6aa2('0x9'));var _=require(_0x6aa2('0xa'));var squel=require('squel');var crypto=require(_0x6aa2('0xb'));var jsforce=require(_0x6aa2('0xc'));var deskjs=require(_0x6aa2('0xd'));var toCsv=require(_0x6aa2('0xe'));var querystring=require('querystring');var Papa=require(_0x6aa2('0xf'));var Redis=require(_0x6aa2('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6aa2('0x11'));var hardwareService=require(_0x6aa2('0x12'));var logger=require(_0x6aa2('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x6aa2('0x14'));var licenseUtil=require(_0x6aa2('0x15'));var db=require(_0x6aa2('0x16'))['db'];config[_0x6aa2('0x17')]=_['defaults'](config[_0x6aa2('0x17')],{'host':_0x6aa2('0x18'),'port':0x18eb});var socket=require(_0x6aa2('0x19'))(new Redis(config[_0x6aa2('0x17')]));require(_0x6aa2('0x1a'))[_0x6aa2('0x1b')](socket);function respondWithStatusCode(_0x5f2f2e,_0x4b58f4){_0x4b58f4=_0x4b58f4||0xcc;return function(_0x4ac1ea){if(_0x4ac1ea){return _0x5f2f2e[_0x6aa2('0x1c')](_0x4b58f4);}return _0x5f2f2e[_0x6aa2('0x1d')](_0x4b58f4)[_0x6aa2('0x1e')]();};}function respondWithResult(_0x550267,_0x546a25){_0x546a25=_0x546a25||0xc8;return function(_0x56e6e1){if(_0x56e6e1){return _0x550267['status'](_0x546a25)[_0x6aa2('0x1f')](_0x56e6e1);}};}function respondWithFilteredResult(_0x2087f6,_0x3b4d03){return function(_0x4b44a6){if(_0x4b44a6){var _0x5c041b=typeof _0x3b4d03['offset']===_0x6aa2('0x20')&&typeof _0x3b4d03['limit']===_0x6aa2('0x20');var _0x4ba6b4=_0x4b44a6[_0x6aa2('0x21')];var _0x56a778=_0x5c041b?0x0:_0x3b4d03['offset'];var _0x1fb5dc=_0x5c041b?_0x4b44a6[_0x6aa2('0x21')]:_0x3b4d03[_0x6aa2('0x22')]+_0x3b4d03[_0x6aa2('0x23')];var _0x3c9f92;if(_0x1fb5dc>=_0x4ba6b4){_0x1fb5dc=_0x4ba6b4;_0x3c9f92=0xc8;}else{_0x3c9f92=0xce;}_0x2087f6[_0x6aa2('0x1d')](_0x3c9f92);return _0x2087f6[_0x6aa2('0x24')]('Content-Range',_0x56a778+'-'+_0x1fb5dc+'/'+_0x4ba6b4)['json'](_0x4b44a6);}return null;};}function patchUpdates(_0x1a60c3){return function(_0x56b491){try{jsonpatch[_0x6aa2('0x25')](_0x56b491,_0x1a60c3,!![]);}catch(_0x309e9d){return BPromise[_0x6aa2('0x26')](_0x309e9d);}return _0x56b491['save']();};}function saveUpdates(_0x317277,_0x2575cd){return function(_0x471a02){if(_0x471a02){return _0x471a02[_0x6aa2('0x27')](_0x317277)['then'](function(_0x412a96){return _0x412a96;});}return null;};}function removeEntity(_0x1a242b,_0x564f9e){return function(_0x3b49df){if(_0x3b49df){return _0x3b49df[_0x6aa2('0x28')]()['then'](function(){var _0x164fec=_0x3b49df['get']({'plain':!![]});var _0x53fd87='CustomDashboards';return db[_0x6aa2('0x29')][_0x6aa2('0x28')]({'where':{'type':_0x53fd87,'resourceId':_0x164fec['id']}})[_0x6aa2('0x2a')](function(){return _0x3b49df;});})[_0x6aa2('0x2a')](function(){_0x1a242b['status'](0xcc)[_0x6aa2('0x1e')]();});}};}function handleEntityNotFound(_0x2d0dc9,_0x45901a){return function(_0x35d79a){if(!_0x35d79a){_0x2d0dc9[_0x6aa2('0x1c')](0x194);}return _0x35d79a;};}function handleError(_0x9730fa,_0x3a3900){_0x3a3900=_0x3a3900||0x1f4;return function(_0x37fdb8){logger[_0x6aa2('0x2b')](_0x37fdb8['stack']);if(_0x37fdb8['name']){delete _0x37fdb8['name'];}_0x9730fa['status'](_0x3a3900)[_0x6aa2('0x2c')](_0x37fdb8);};}exports[_0x6aa2('0x2d')]=function(_0x4dc4db,_0x14d35e){var _0x89f899={},_0xefb8be={},_0x1e23ce={'count':0x0,'rows':[]};var _0x16eb9f=_[_0x6aa2('0x2e')](db[_0x6aa2('0x2f')][_0x6aa2('0x30')],function(_0x3c60fd){return{'name':_0x3c60fd['fieldName'],'type':_0x3c60fd[_0x6aa2('0x31')]['key']};});_0xefb8be[_0x6aa2('0x32')]=_[_0x6aa2('0x2e')](_0x16eb9f,_0x6aa2('0x33'));_0xefb8be[_0x6aa2('0x34')]=_[_0x6aa2('0x35')](_0x4dc4db[_0x6aa2('0x34')]);_0xefb8be[_0x6aa2('0x36')]=_[_0x6aa2('0x37')](_0xefb8be[_0x6aa2('0x32')],_0xefb8be[_0x6aa2('0x34')]);_0x89f899['attributes']=_[_0x6aa2('0x37')](_0xefb8be['model'],qs[_0x6aa2('0x38')](_0x4dc4db[_0x6aa2('0x34')][_0x6aa2('0x38')]));_0x89f899['attributes']=_0x89f899['attributes'][_0x6aa2('0x39')]?_0x89f899[_0x6aa2('0x3a')]:_0xefb8be[_0x6aa2('0x32')];if(!_0x4dc4db[_0x6aa2('0x34')]['hasOwnProperty'](_0x6aa2('0x3b'))){_0x89f899[_0x6aa2('0x23')]=qs[_0x6aa2('0x23')](_0x4dc4db[_0x6aa2('0x34')]['limit']);_0x89f899['offset']=qs[_0x6aa2('0x22')](_0x4dc4db[_0x6aa2('0x34')][_0x6aa2('0x22')]);}_0x89f899['order']=qs[_0x6aa2('0x3c')](_0x4dc4db['query']['sort']);_0x89f899[_0x6aa2('0x3d')]=qs['filters'](_['pick'](_0x4dc4db[_0x6aa2('0x34')],_0xefb8be[_0x6aa2('0x36')]),_0x16eb9f);if(_0x4dc4db[_0x6aa2('0x34')]['filter']){_0x89f899['where']=_[_0x6aa2('0x3e')](_0x89f899['where'],{'$or':_[_0x6aa2('0x2e')](_0x16eb9f,function(_0x28241b){if(_0x28241b[_0x6aa2('0x31')]!==_0x6aa2('0x3f')){var _0x33c0a3={};_0x33c0a3[_0x28241b[_0x6aa2('0x33')]]={'$like':'%'+_0x4dc4db['query']['filter']+'%'};return _0x33c0a3;}})});}_0x89f899=_[_0x6aa2('0x3e')]({},_0x89f899,_0x4dc4db['options']);var _0x12d860={'where':_0x89f899[_0x6aa2('0x3d')]};return db[_0x6aa2('0x2f')][_0x6aa2('0x21')](_0x12d860)['then'](function(_0x4a75d3){_0x1e23ce[_0x6aa2('0x21')]=_0x4a75d3;if(_0x4dc4db[_0x6aa2('0x34')][_0x6aa2('0x40')]){_0x89f899['include']=[{'all':!![]}];}return db['Dashboard']['findAll'](_0x89f899);})[_0x6aa2('0x2a')](function(_0x5d94f3){_0x1e23ce[_0x6aa2('0x41')]=_0x5d94f3;return _0x1e23ce;})[_0x6aa2('0x2a')](respondWithFilteredResult(_0x14d35e,_0x89f899))[_0x6aa2('0x42')](handleError(_0x14d35e,null));};exports[_0x6aa2('0x43')]=function(_0xb23450,_0x398acf){var _0x27e5a7={'raw':![],'where':{'id':_0xb23450[_0x6aa2('0x44')]['id']}},_0x5d2463={};_0x5d2463[_0x6aa2('0x32')]=_[_0x6aa2('0x35')](db[_0x6aa2('0x2f')][_0x6aa2('0x30')]);_0x5d2463[_0x6aa2('0x34')]=_[_0x6aa2('0x35')](_0xb23450[_0x6aa2('0x34')]);_0x5d2463[_0x6aa2('0x36')]=_[_0x6aa2('0x37')](_0x5d2463[_0x6aa2('0x32')],_0x5d2463[_0x6aa2('0x34')]);_0x27e5a7[_0x6aa2('0x3a')]=_[_0x6aa2('0x37')](_0x5d2463[_0x6aa2('0x32')],qs[_0x6aa2('0x38')](_0xb23450[_0x6aa2('0x34')][_0x6aa2('0x38')]));_0x27e5a7[_0x6aa2('0x3a')]=_0x27e5a7['attributes']['length']?_0x27e5a7[_0x6aa2('0x3a')]:_0x5d2463[_0x6aa2('0x32')];if(_0xb23450['query']['includeAll']){_0x27e5a7[_0x6aa2('0x45')]=[{'all':!![]}];}_0x27e5a7=_['merge']({},_0x27e5a7,_0xb23450['options']);return db[_0x6aa2('0x2f')][_0x6aa2('0x46')](_0x27e5a7)[_0x6aa2('0x2a')](handleEntityNotFound(_0x398acf,null))[_0x6aa2('0x2a')](respondWithResult(_0x398acf,null))['catch'](handleError(_0x398acf,null));};exports[_0x6aa2('0x47')]=function(_0x2e3995,_0x390ef4){return db[_0x6aa2('0x2f')][_0x6aa2('0x47')](_0x2e3995['body'],{})[_0x6aa2('0x2a')](function(_0x40f088){var _0xb20a97=_0x2e3995['user'][_0x6aa2('0x48')]({'plain':!![]});if(!_0xb20a97)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xb20a97[_0x6aa2('0x49')]==='user'){var _0x291718=_0x40f088[_0x6aa2('0x48')]({'plain':!![]});var _0xcde267='CustomDashboards';return db[_0x6aa2('0x4a')][_0x6aa2('0x46')]({'where':{'name':_0xcde267,'userProfileId':_0xb20a97[_0x6aa2('0x4b')]},'raw':!![]})['then'](function(_0x56380a){if(_0x56380a&&_0x56380a[_0x6aa2('0x4c')]===0x0){return db[_0x6aa2('0x29')][_0x6aa2('0x47')]({'name':_0x291718[_0x6aa2('0x33')],'resourceId':_0x291718['id'],'type':_0x56380a[_0x6aa2('0x33')],'sectionId':_0x56380a['id']},{})[_0x6aa2('0x2a')](function(){return _0x40f088;});}else{return _0x40f088;}})[_0x6aa2('0x42')](function(_0x6d0d77){logger[_0x6aa2('0x2b')](_0x6aa2('0x4d'),_0x6d0d77);throw _0x6d0d77;});}return _0x40f088;})['then'](respondWithResult(_0x390ef4,0xc9))['catch'](handleError(_0x390ef4,null));};exports[_0x6aa2('0x4e')]=function(_0xd8bd05,_0x2a1623){var _0x3fef27={'where':{'id':_0xd8bd05[_0x6aa2('0x44')]['id']}},_0x5eade0={};_0x5eade0[_0x6aa2('0x32')]=_[_0x6aa2('0x35')](db[_0x6aa2('0x2f')][_0x6aa2('0x30')]);_0x3fef27['attributes']=_[_0x6aa2('0x37')](_0x5eade0[_0x6aa2('0x32')],qs['fields'](_0xd8bd05[_0x6aa2('0x34')][_0x6aa2('0x38')]));_0x3fef27['attributes']=_0x3fef27['attributes'][_0x6aa2('0x39')]?_0x3fef27[_0x6aa2('0x3a')]:_0x5eade0['model'];if(_0xd8bd05['query'][_0x6aa2('0x40')]){_0x3fef27[_0x6aa2('0x45')]=[{'all':!![]}];}_0x3fef27=_['merge']({},_0x3fef27,_0xd8bd05[_0x6aa2('0x4f')]);return db[_0x6aa2('0x2f')][_0x6aa2('0x46')](_0x3fef27)['then'](handleEntityNotFound(_0x2a1623,null))[_0x6aa2('0x2a')](function(_0x10abec){if(_0x10abec){var _0x1135ae=_0x10abec['get']({'plain':!![]});_0x1135ae=qs[_0x6aa2('0x50')](_0x1135ae,['id','createdAt','updatedAt']);_0xd8bd05[_0x6aa2('0x51')]=_[_0x6aa2('0x50')](_0xd8bd05['body'],['id',_0x6aa2('0x52'),_0x6aa2('0x53')]);return db[_0x6aa2('0x2f')][_0x6aa2('0x47')](_[_0x6aa2('0x3e')](_0x1135ae,_0xd8bd05['body']),{'include':_0xd8bd05[_0x6aa2('0x34')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x16201a){var _0x246ef2=_0xd8bd05[_0x6aa2('0x54')][_0x6aa2('0x48')]({'plain':!![]});if(!_0x246ef2)throw new Error(_0x6aa2('0x55'));if(_0x246ef2[_0x6aa2('0x49')]===_0x6aa2('0x54')){var _0x407b71=_0x16201a[_0x6aa2('0x48')]({'plain':!![]});var _0x79c1ac=_0x6aa2('0x56');return db[_0x6aa2('0x4a')]['find']({'where':{'name':_0x79c1ac,'userProfileId':_0x246ef2[_0x6aa2('0x4b')]},'raw':!![]})[_0x6aa2('0x2a')](function(_0x2cf890){if(_0x2cf890&&_0x2cf890[_0x6aa2('0x4c')]===0x0){return db[_0x6aa2('0x29')]['create']({'name':_0x407b71[_0x6aa2('0x33')],'resourceId':_0x407b71['id'],'type':_0x2cf890[_0x6aa2('0x33')],'sectionId':_0x2cf890['id']},{})[_0x6aa2('0x2a')](function(){return _0x16201a;});}else{return _0x16201a;}})[_0x6aa2('0x42')](function(_0xb4dd5e){logger[_0x6aa2('0x2b')](_0x6aa2('0x4d'),_0xb4dd5e);throw _0xb4dd5e;});}return _0x16201a;});}})['then'](respondWithResult(_0x2a1623,0xc9))[_0x6aa2('0x42')](handleError(_0x2a1623,null));};exports[_0x6aa2('0x27')]=function(_0x2352ec,_0x132baf){if(_0x2352ec[_0x6aa2('0x51')]['id']){delete _0x2352ec['body']['id'];}return db['Dashboard'][_0x6aa2('0x46')]({'where':{'id':_0x2352ec[_0x6aa2('0x44')]['id']}})[_0x6aa2('0x2a')](handleEntityNotFound(_0x132baf,null))[_0x6aa2('0x2a')](saveUpdates(_0x2352ec[_0x6aa2('0x51')],null))['then'](respondWithResult(_0x132baf,null))['catch'](handleError(_0x132baf,null));};exports[_0x6aa2('0x28')]=function(_0x250971,_0x1b55f8){return db[_0x6aa2('0x2f')][_0x6aa2('0x46')]({'where':{'id':_0x250971['params']['id']}})[_0x6aa2('0x2a')](handleEntityNotFound(_0x1b55f8,null))[_0x6aa2('0x2a')](removeEntity(_0x1b55f8,null))[_0x6aa2('0x42')](handleError(_0x1b55f8,null));};function widgetAttributes(_0x153e9d){try{switch(_0x153e9d[_0x6aa2('0x31')]){case'iframe':return[{'name':_0x6aa2('0x57'),'value':_0x153e9d[_0x6aa2('0x57')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x5a')}];case'custom':return[{'name':_0x6aa2('0x5b'),'value':_0x153e9d['attrPath']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0]['value']:undefined)||''}];case _0x6aa2('0x5c'):return[{'name':'attrHourFormat','value':_0x153e9d[_0x6aa2('0x5d')]||(_0x153e9d['attrs']&&_0x153e9d[_0x6aa2('0x58')][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x5e')},{'name':_0x6aa2('0x5f'),'value':_0x153e9d[_0x6aa2('0x5f')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x1]?_0x153e9d[_0x6aa2('0x58')][0x1][_0x6aa2('0x59')]:undefined)||'0.00'},{'name':_0x6aa2('0x60'),'value':_0x153e9d[_0x6aa2('0x60')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x2]?_0x153e9d[_0x6aa2('0x58')][0x2][_0x6aa2('0x59')]:undefined)||0xc}];case'counter':return[{'name':_0x6aa2('0x61'),'value':_0x153e9d[_0x6aa2('0x61')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x62')},{'name':_0x6aa2('0x63'),'value':_0x153e9d[_0x6aa2('0x63')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x1]?_0x153e9d[_0x6aa2('0x58')][0x1][_0x6aa2('0x59')]:undefined)||[]},{'name':_0x6aa2('0x60'),'value':_0x153e9d[_0x6aa2('0x60')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x2]?_0x153e9d[_0x6aa2('0x58')][0x2][_0x6aa2('0x59')]:undefined)||0x14},{'name':_0x6aa2('0x64'),'value':_0x153e9d['attrChannel']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x3]?_0x153e9d[_0x6aa2('0x58')][0x3][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x65')},{'name':_0x6aa2('0x66'),'value':_0x153e9d[_0x6aa2('0x66')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x4]?_0x153e9d['attrs'][0x4][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x67'),'value':_0x153e9d[_0x6aa2('0x67')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x5]?_0x153e9d['attrs'][0x5][_0x6aa2('0x59')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x153e9d[_0x6aa2('0x68')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x6]?_0x153e9d[_0x6aa2('0x58')][0x6][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x69'),'value':_0x153e9d[_0x6aa2('0x69')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x7]?_0x153e9d['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x153e9d[_0x6aa2('0x6a')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x8]?_0x153e9d[_0x6aa2('0x58')][0x8][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x6b'),'value':_0x153e9d[_0x6aa2('0x6b')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x9]?_0x153e9d['attrs'][0x9][_0x6aa2('0x59')]:undefined)||''}];case _0x6aa2('0x6c'):case _0x6aa2('0x6d'):return[{'name':_0x6aa2('0x6e'),'value':_0x153e9d['attrSerie1']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d['attrs'][0x0]['value']:undefined)||_0x6aa2('0x62')},{'name':_0x6aa2('0x6f'),'value':_0x153e9d['attrSerie2']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x1]?_0x153e9d[_0x6aa2('0x58')][0x1][_0x6aa2('0x59')]:undefined)||null},{'name':_0x6aa2('0x70'),'value':_0x153e9d[_0x6aa2('0x70')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x2]?_0x153e9d[_0x6aa2('0x58')][0x2][_0x6aa2('0x59')]:undefined)||null},{'name':_0x6aa2('0x63'),'value':_0x153e9d[_0x6aa2('0x63')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x3]?_0x153e9d[_0x6aa2('0x58')][0x3]['value']:undefined)||[]},{'name':_0x6aa2('0x64'),'value':_0x153e9d['attrChannel']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x4]?_0x153e9d[_0x6aa2('0x58')][0x4][_0x6aa2('0x59')]:undefined)||_0x6aa2('0x65')},{'name':'attrEmailAccounts','value':_0x153e9d['attrEmailAccounts']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x5]?_0x153e9d['attrs'][0x5][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x67'),'value':_0x153e9d[_0x6aa2('0x67')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x6]?_0x153e9d[_0x6aa2('0x58')][0x6]['value']:undefined)||''},{'name':'attrSmsAccounts','value':_0x153e9d['attrSmsAccounts']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x7]?_0x153e9d[_0x6aa2('0x58')][0x7][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x69'),'value':_0x153e9d[_0x6aa2('0x69')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x8]?_0x153e9d['attrs'][0x8]['value']:undefined)||''},{'name':_0x6aa2('0x6a'),'value':_0x153e9d[_0x6aa2('0x6a')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x9]?_0x153e9d[_0x6aa2('0x58')][0x9][_0x6aa2('0x59')]:undefined)||''},{'name':_0x6aa2('0x6b'),'value':_0x153e9d[_0x6aa2('0x6b')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0xa]?_0x153e9d[_0x6aa2('0x58')][0xa][_0x6aa2('0x59')]:undefined)||''}];case _0x6aa2('0x71'):return[{'name':_0x6aa2('0x72'),'type':_0x153e9d['reportType']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d[_0x6aa2('0x58')][0x0][_0x6aa2('0x31')]:undefined)||null,'value':_0x153e9d['attrReport']||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d['attrs'][0x0]?_0x153e9d['attrs'][0x0]['value']:undefined)||null},{'name':_0x6aa2('0x73'),'value':_0x153e9d[_0x6aa2('0x73')]||(_0x153e9d[_0x6aa2('0x58')]&&_0x153e9d[_0x6aa2('0x58')][0x1]?_0x153e9d[_0x6aa2('0x58')][0x1][_0x6aa2('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x3e3a22){logger[_0x6aa2('0x2b')](_0x6aa2('0x74'),JSON[_0x6aa2('0x75')](_0x3e3a22));return[];}}exports[_0x6aa2('0x76')]=function(_0x460ae3,_0xf01ed2,_0x4000ed){if(_0x460ae3[_0x6aa2('0x51')]['id']){delete _0x460ae3[_0x6aa2('0x51')]['id'];}return db[_0x6aa2('0x2f')]['find']({'where':{'id':_0x460ae3[_0x6aa2('0x44')]['id']}})[_0x6aa2('0x2a')](handleEntityNotFound(_0xf01ed2,null))[_0x6aa2('0x2a')](function(_0x21d44f){if(_0x21d44f){_0x460ae3['body'][_0x6aa2('0x77')]=_0x21d44f['id'];_0x460ae3[_0x6aa2('0x51')]['attrs']=widgetAttributes(_0x460ae3[_0x6aa2('0x51')]);return db[_0x6aa2('0x78')][_0x6aa2('0x47')](_0x460ae3[_0x6aa2('0x51')]);}})[_0x6aa2('0x2a')](respondWithResult(_0xf01ed2,null))['catch'](handleError(_0xf01ed2,null));};exports[_0x6aa2('0x79')]=function(_0x2403f8,_0x1c212a,_0x32439f){var _0x340cbb={};var _0x16efba={};var _0x381b13;var _0x1d1bce;return db['Dashboard'][_0x6aa2('0x7a')]({'where':{'id':_0x2403f8['params']['id']}})[_0x6aa2('0x2a')](handleEntityNotFound(_0x1c212a,null))[_0x6aa2('0x2a')](function(_0x141077){if(_0x141077){_0x381b13=_0x141077;_0x16efba[_0x6aa2('0x32')]=_['keys'](db[_0x6aa2('0x78')]['rawAttributes']);_0x16efba[_0x6aa2('0x34')]=_[_0x6aa2('0x35')](_0x2403f8[_0x6aa2('0x34')]);_0x16efba['filters']=_[_0x6aa2('0x37')](_0x16efba['model'],_0x16efba['query']);_0x340cbb['attributes']=_[_0x6aa2('0x37')](_0x16efba[_0x6aa2('0x32')],qs[_0x6aa2('0x38')](_0x2403f8['query'][_0x6aa2('0x38')]));_0x340cbb[_0x6aa2('0x3a')]=_0x340cbb[_0x6aa2('0x3a')][_0x6aa2('0x39')]?_0x340cbb[_0x6aa2('0x3a')]:_0x16efba['model'];_0x340cbb[_0x6aa2('0x7b')]=qs[_0x6aa2('0x3c')](_0x2403f8[_0x6aa2('0x34')][_0x6aa2('0x3c')]);_0x340cbb[_0x6aa2('0x3d')]=qs[_0x6aa2('0x36')](_['pick'](_0x2403f8[_0x6aa2('0x34')],_0x16efba[_0x6aa2('0x36')]));if(_0x2403f8[_0x6aa2('0x34')][_0x6aa2('0x7c')]){_0x340cbb[_0x6aa2('0x3d')]=_['merge'](_0x340cbb[_0x6aa2('0x3d')],{'$or':_[_0x6aa2('0x2e')](_0x340cbb[_0x6aa2('0x3a')],function(_0x29fdbb){var _0x26dea7={};_0x26dea7[_0x29fdbb]={'$like':'%'+_0x2403f8['query'][_0x6aa2('0x7c')]+'%'};return _0x26dea7;})});}_0x340cbb=_[_0x6aa2('0x3e')]({},_0x340cbb,_0x2403f8['options']);return _0x381b13[_0x6aa2('0x79')](_0x340cbb);}})[_0x6aa2('0x2a')](function(_0x27b2f6){if(_0x27b2f6){_0x1d1bce=_0x27b2f6[_0x6aa2('0x39')];if(!_0x2403f8[_0x6aa2('0x34')]['hasOwnProperty'](_0x6aa2('0x3b'))){_0x340cbb[_0x6aa2('0x23')]=qs[_0x6aa2('0x23')](_0x2403f8['query']['limit']);_0x340cbb[_0x6aa2('0x22')]=qs[_0x6aa2('0x22')](_0x2403f8['query'][_0x6aa2('0x22')]);}return _0x381b13[_0x6aa2('0x79')](_0x340cbb);}})[_0x6aa2('0x2a')](function(_0x43e12f){if(_0x43e12f){return _0x43e12f?{'count':_0x1d1bce,'rows':_0x43e12f}:null;}})[_0x6aa2('0x2a')](respondWithResult(_0x1c212a,null))['catch'](handleError(_0x1c212a,null));};
\ No newline at end of file
index 79f6eed..ce3ac36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06f8=['Dashboard','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0xa412e5,_0x53c612){var _0x10a772=function(_0x162c3d){while(--_0x162c3d){_0xa412e5['push'](_0xa412e5['shift']());}};_0x10a772(++_0x53c612);}(_0x06f8,0x8f));var _0x806f=function(_0x126e00,_0x36ccf1){_0x126e00=_0x126e00-0x0;var _0x49a4ea=_0x06f8[_0x126e00];return _0x49a4ea;};'use strict';var EventEmitter=require(_0x806f('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x806f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x806f('0x2')](0x0);var events={'afterCreate':_0x806f('0x3'),'afterUpdate':_0x806f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x47a350){return function(_0x37fe59,_0x53e564,_0x379a81){DashboardEvents['emit'](_0x47a350+':'+_0x37fe59['id'],_0x37fe59);DashboardEvents[_0x806f('0x5')](_0x47a350,_0x37fe59);_0x379a81(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x806f('0x6')](e,emitEvent(event));}}module[_0x806f('0x7')]=DashboardEvents;
\ No newline at end of file
+var _0x9f01=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','Dashboard'];(function(_0x325658,_0x41e099){var _0x3025a6=function(_0xebc9f3){while(--_0xebc9f3){_0x325658['push'](_0x325658['shift']());}};_0x3025a6(++_0x41e099);}(_0x9f01,0x19c));var _0x19f0=function(_0x2de065,_0x5754c2){_0x2de065=_0x2de065-0x0;var _0x2bb8c7=_0x9f01[_0x2de065];return _0x2bb8c7;};'use strict';var EventEmitter=require(_0x19f0('0x0'));var Dashboard=require('../../mysqldb')['db'][_0x19f0('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x19f0('0x2')](0x0);var events={'afterCreate':_0x19f0('0x3'),'afterUpdate':_0x19f0('0x4'),'afterDestroy':_0x19f0('0x5')};function emitEvent(_0x48af7a){return function(_0x1b0a46,_0x3886b0,_0x47247c){DashboardEvents[_0x19f0('0x6')](_0x48af7a+':'+_0x1b0a46['id'],_0x1b0a46);DashboardEvents[_0x19f0('0x6')](_0x48af7a,_0x1b0a46);_0x47247c(null);};}for(var e in events){if(events[_0x19f0('0x7')](e)){var event=events[e];Dashboard[_0x19f0('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents;
\ No newline at end of file
index 4d9b0f8..0b6c6bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd5ab=['rimraf','./dashboard.attributes','exports','define','Dashboard','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5bba11,_0xe514ce){var _0xfb4bb1=function(_0x26e319){while(--_0x26e319){_0x5bba11['push'](_0x5bba11['shift']());}};_0xfb4bb1(++_0xe514ce);}(_0xd5ab,0x89));var _0xbd5a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd5ab[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xbd5a('0x0'));var util=require(_0xbd5a('0x1'));var logger=require(_0xbd5a('0x2'))(_0xbd5a('0x3'));var moment=require('moment');var BPromise=require(_0xbd5a('0x4'));var rp=require(_0xbd5a('0x5'));var fs=require('fs');var path=require(_0xbd5a('0x6'));var rimraf=require(_0xbd5a('0x7'));var config=require('../../config/environment');var attributes=require(_0xbd5a('0x8'));module[_0xbd5a('0x9')]=function(_0x38984c,_0x1e4d67){return _0x38984c[_0xbd5a('0xa')](_0xbd5a('0xb'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x83cd=['define','dashboards','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x147fee,_0x5f3654){var _0x1932f5=function(_0x36422e){while(--_0x36422e){_0x147fee['push'](_0x147fee['shift']());}};_0x1932f5(++_0x5f3654);}(_0x83cd,0x120));var _0xd83c=function(_0xd0ebf2,_0x9596d9){_0xd0ebf2=_0xd0ebf2-0x0;var _0x47ec74=_0x83cd[_0xd0ebf2];return _0x47ec74;};'use strict';var _=require('lodash');var util=require(_0xd83c('0x0'));var logger=require(_0xd83c('0x1'))(_0xd83c('0x2'));var moment=require('moment');var BPromise=require(_0xd83c('0x3'));var rp=require(_0xd83c('0x4'));var fs=require('fs');var path=require(_0xd83c('0x5'));var rimraf=require(_0xd83c('0x6'));var config=require(_0xd83c('0x7'));var attributes=require('./dashboard.attributes');module[_0xd83c('0x8')]=function(_0x53d55b,_0x4eb6f1){return _0x53d55b[_0xd83c('0x9')]('Dashboard',attributes,{'tableName':_0xd83c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4f98218..ccf772f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc64f=['client','http','redis','defaults','socket.io-emitter','./dashboard.socket','register','info','Dashboard,\x20%s,\x20%s','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2209b3,_0x6e808){var _0x5dfa01=function(_0x58a5ba){while(--_0x58a5ba){_0x2209b3['push'](_0x2209b3['shift']());}};_0x5dfa01(++_0x6e808);}(_0xc64f,0x1a8));var _0xfc64=function(_0x1b0e88,_0x52c96b){_0x1b0e88=_0x1b0e88-0x0;var _0x2ba774=_0xc64f[_0x1b0e88];return _0x2ba774;};'use strict';var _=require(_0xfc64('0x0'));var util=require(_0xfc64('0x1'));var moment=require(_0xfc64('0x2'));var BPromise=require(_0xfc64('0x3'));var rs=require(_0xfc64('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfc64('0x5'))['db'];var utils=require(_0xfc64('0x6'));var logger=require(_0xfc64('0x7'))(_0xfc64('0x8'));var config=require(_0xfc64('0x9'));var jayson=require(_0xfc64('0xa'));var client=jayson[_0xfc64('0xb')][_0xfc64('0xc')]({'port':0x232a});config[_0xfc64('0xd')]=_[_0xfc64('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xfc64('0xf'))(new Redis(config[_0xfc64('0xd')]));require(_0xfc64('0x10'))[_0xfc64('0x11')](socket);function respondWithRpcPromise(_0x121cbe,_0x5afbe8,_0xba2653){return new BPromise(function(_0x55cbe2,_0x46da67){return client['request'](_0x121cbe,_0xba2653)['then'](function(_0x17ff60){logger[_0xfc64('0x12')](_0xfc64('0x13'),_0x5afbe8,'request\x20sent');logger[_0xfc64('0x14')](_0xfc64('0x15'),_0x5afbe8,_0xfc64('0x16'),JSON[_0xfc64('0x17')](_0x17ff60));if(_0x17ff60['error']){if(_0x17ff60[_0xfc64('0x18')][_0xfc64('0x19')]===0x1f4){logger['error'](_0xfc64('0x13'),_0x5afbe8,_0x17ff60[_0xfc64('0x18')][_0xfc64('0x1a')]);return _0x46da67(_0x17ff60[_0xfc64('0x18')][_0xfc64('0x1a')]);}logger['error'](_0xfc64('0x13'),_0x5afbe8,_0x17ff60['error'][_0xfc64('0x1a')]);return _0x55cbe2(_0x17ff60[_0xfc64('0x18')][_0xfc64('0x1a')]);}else{logger['info'](_0xfc64('0x13'),_0x5afbe8,_0xfc64('0x16'));_0x55cbe2(_0x17ff60[_0xfc64('0x1b')][_0xfc64('0x1a')]);}})[_0xfc64('0x1c')](function(_0x106feb){logger['error'](_0xfc64('0x13'),_0x5afbe8,_0x106feb);_0x46da67(_0x106feb);});});}
\ No newline at end of file
+var _0x3431=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./dashboard.socket','register','request','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','Dashboard,\x20%s,\x20%s','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2f58ea,_0x2c8f38){var _0x514770=function(_0xd39816){while(--_0xd39816){_0x2f58ea['push'](_0x2f58ea['shift']());}};_0x514770(++_0x2c8f38);}(_0x3431,0x1bb));var _0x1343=function(_0xea35d1,_0x302471){_0xea35d1=_0xea35d1-0x0;var _0x1d7a7c=_0x3431[_0xea35d1];return _0x1d7a7c;};'use strict';var _=require('lodash');var util=require(_0x1343('0x0'));var moment=require('moment');var BPromise=require(_0x1343('0x1'));var rs=require(_0x1343('0x2'));var fs=require('fs');var Redis=require(_0x1343('0x3'));var db=require(_0x1343('0x4'))['db'];var utils=require(_0x1343('0x5'));var logger=require(_0x1343('0x6'))(_0x1343('0x7'));var config=require(_0x1343('0x8'));var jayson=require(_0x1343('0x9'));var client=jayson[_0x1343('0xa')][_0x1343('0xb')]({'port':0x232a});config['redis']=_[_0x1343('0xc')](config[_0x1343('0xd')],{'host':_0x1343('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1343('0xd')]));require(_0x1343('0xf'))[_0x1343('0x10')](socket);function respondWithRpcPromise(_0x2bc8de,_0x245cde,_0x4244d2){return new BPromise(function(_0x36d8c4,_0x3a6bd9){return client[_0x1343('0x11')](_0x2bc8de,_0x4244d2)['then'](function(_0x2bfa85){logger[_0x1343('0x12')]('Dashboard,\x20%s,\x20%s',_0x245cde,_0x1343('0x13'));logger[_0x1343('0x14')](_0x1343('0x15'),_0x245cde,_0x1343('0x13'),JSON['stringify'](_0x2bfa85));if(_0x2bfa85[_0x1343('0x16')]){if(_0x2bfa85[_0x1343('0x16')][_0x1343('0x17')]===0x1f4){logger[_0x1343('0x16')]('Dashboard,\x20%s,\x20%s',_0x245cde,_0x2bfa85['error'][_0x1343('0x18')]);return _0x3a6bd9(_0x2bfa85[_0x1343('0x16')][_0x1343('0x18')]);}logger[_0x1343('0x16')](_0x1343('0x19'),_0x245cde,_0x2bfa85[_0x1343('0x16')][_0x1343('0x18')]);return _0x36d8c4(_0x2bfa85[_0x1343('0x16')]['message']);}else{logger[_0x1343('0x12')](_0x1343('0x19'),_0x245cde,_0x1343('0x13'));_0x36d8c4(_0x2bfa85[_0x1343('0x1a')][_0x1343('0x18')]);}})[_0x1343('0x1b')](function(_0x273e1b){logger['error'](_0x1343('0x19'),_0x245cde,_0x273e1b);_0x3a6bd9(_0x273e1b);});});}
\ No newline at end of file
index 0377f92..ffce8a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde1c=['removeListener','register','length','dashboard:','./dashboard.events','save','remove','update','emit'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xde1c,0x199));var _0xcde1=function(_0x5bf0c5,_0x5a0fe4){_0x5bf0c5=_0x5bf0c5-0x0;var _0x19b279=_0xde1c[_0x5bf0c5];return _0x19b279;};'use strict';var DashboardEvents=require(_0xcde1('0x0'));var events=[_0xcde1('0x1'),_0xcde1('0x2'),_0xcde1('0x3')];function createListener(_0x288e5d,_0x2451da){return function(_0x1b01dd){_0x2451da[_0xcde1('0x4')](_0x288e5d,_0x1b01dd);};}function removeListener(_0x5a91bb,_0x2b5383){return function(){DashboardEvents[_0xcde1('0x5')](_0x5a91bb,_0x2b5383);};}exports[_0xcde1('0x6')]=function(_0x45ad3e){for(var _0x360e77=0x0,_0x2ed4ce=events[_0xcde1('0x7')];_0x360e77<_0x2ed4ce;_0x360e77++){var _0x754aae=events[_0x360e77];var _0x5f5053=createListener(_0xcde1('0x8')+_0x754aae,_0x45ad3e);DashboardEvents['on'](_0x754aae,_0x5f5053);}};
\ No newline at end of file
+var _0x3361=['register','length','save','update','emit','removeListener'];(function(_0x24899b,_0x1690ed){var _0x3c714c=function(_0x12f6ad){while(--_0x12f6ad){_0x24899b['push'](_0x24899b['shift']());}};_0x3c714c(++_0x1690ed);}(_0x3361,0xfe));var _0x1336=function(_0x16d016,_0x5329fe){_0x16d016=_0x16d016-0x0;var _0x6896d7=_0x3361[_0x16d016];return _0x6896d7;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x1336('0x0'),'remove',_0x1336('0x1')];function createListener(_0x3d4f69,_0x10f568){return function(_0x127d8a){_0x10f568[_0x1336('0x2')](_0x3d4f69,_0x127d8a);};}function removeListener(_0x42cd5b,_0x3fa8b8){return function(){DashboardEvents[_0x1336('0x3')](_0x42cd5b,_0x3fa8b8);};}exports[_0x1336('0x4')]=function(_0x4b0878){for(var _0x2e3aa5=0x0,_0x3fb88e=events[_0x1336('0x5')];_0x2e3aa5<_0x3fb88e;_0x2e3aa5++){var _0x184891=events[_0x2e3aa5];var _0x2b8d1c=createListener('dashboard:'+_0x184891,_0x4b0878);DashboardEvents['on'](_0x184891,_0x2b8d1c);}};
\ No newline at end of file
index 95aae68..45c8fca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe801=['create','clone','update','delete','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post'];(function(_0x5e1e05,_0x11fcc9){var _0x1fdd68=function(_0x332ea9){while(--_0x332ea9){_0x5e1e05['push'](_0x5e1e05['shift']());}};_0x1fdd68(++_0x11fcc9);}(_0xe801,0x17f));var _0x1e80=function(_0x2ef9bd,_0x45ba75){_0x2ef9bd=_0x2ef9bd-0x0;var _0x513dc9=_0xe801[_0x2ef9bd];return _0x513dc9;};'use strict';var multer=require('multer');var util=require(_0x1e80('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1e80('0x1'));var router=express[_0x1e80('0x2')]();var fs_extra=require(_0x1e80('0x3'));var auth=require(_0x1e80('0x4'));var interaction=require(_0x1e80('0x5'));var config=require(_0x1e80('0x6'));var controller=require(_0x1e80('0x7'));router[_0x1e80('0x8')]('/',auth[_0x1e80('0x9')](),controller[_0x1e80('0xa')]);router[_0x1e80('0x8')](_0x1e80('0xb'),auth[_0x1e80('0x9')](),controller[_0x1e80('0xc')]);router[_0x1e80('0x8')](_0x1e80('0xd'),auth[_0x1e80('0x9')](),controller[_0x1e80('0xe')]);router[_0x1e80('0xf')]('/',auth[_0x1e80('0x9')](),controller[_0x1e80('0x10')]);router[_0x1e80('0xf')]('/:id/clone',auth[_0x1e80('0x9')](),controller[_0x1e80('0x11')]);router[_0x1e80('0xf')](_0x1e80('0xd'),auth[_0x1e80('0x9')](),controller['addItem']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x1e80('0x12')]);router[_0x1e80('0x13')]('/:id',auth[_0x1e80('0x9')](),controller['destroy']);module[_0x1e80('0x14')]=router;
\ No newline at end of file
+var _0xc028=['put','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem'];(function(_0x101223,_0x1a8fa5){var _0x432037=function(_0xc55f11){while(--_0xc55f11){_0x101223['push'](_0x101223['shift']());}};_0x432037(++_0x1a8fa5);}(_0xc028,0x19c));var _0x8c02=function(_0x3747eb,_0x2061a2){_0x3747eb=_0x3747eb-0x0;var _0x123a6c=_0xc028[_0x3747eb];return _0x123a6c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8c02('0x0'));var timeout=require(_0x8c02('0x1'));var express=require(_0x8c02('0x2'));var router=express[_0x8c02('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8c02('0x4'));var interaction=require(_0x8c02('0x5'));var config=require(_0x8c02('0x6'));var controller=require(_0x8c02('0x7'));router[_0x8c02('0x8')]('/',auth[_0x8c02('0x9')](),controller[_0x8c02('0xa')]);router[_0x8c02('0x8')](_0x8c02('0xb'),auth[_0x8c02('0x9')](),controller[_0x8c02('0xc')]);router['get'](_0x8c02('0xd'),auth[_0x8c02('0x9')](),controller[_0x8c02('0xe')]);router[_0x8c02('0xf')]('/',auth[_0x8c02('0x9')](),controller[_0x8c02('0x10')]);router['post'](_0x8c02('0x11'),auth[_0x8c02('0x9')](),controller[_0x8c02('0x12')]);router[_0x8c02('0xf')](_0x8c02('0xd'),auth['isAuthenticated'](),controller[_0x8c02('0x13')]);router[_0x8c02('0x14')]('/:id',auth[_0x8c02('0x9')](),controller['update']);router[_0x8c02('0x15')]('/:id',auth[_0x8c02('0x9')](),controller[_0x8c02('0x16')]);module[_0x8c02('0x17')]=router;
\ No newline at end of file
index 20cf3ca..e8ca353 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfcf0=['sequelize','squel','exports','STRING','TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3'];(function(_0x264d4d,_0x118fb5){var _0xc917e2=function(_0x21b9dc){while(--_0x21b9dc){_0x264d4d['push'](_0x264d4d['shift']());}};_0xc917e2(++_0x118fb5);}(_0xfcf0,0x138));var _0x0fcf=function(_0x1af0e5,_0x152990){_0x1af0e5=_0x1af0e5-0x0;var _0x3c444a=_0xfcf0[_0x1af0e5];return _0x3c444a;};'use strict';var Sequelize=require(_0x0fcf('0x0'));var squel=require(_0x0fcf('0x1'));var _=require('lodash');module[_0x0fcf('0x2')]={'title':{'type':Sequelize[_0x0fcf('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x0fcf('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x0fcf('0x4')]('long'),'get':function(){try{return JSON[_0x0fcf('0x5')](this[_0x0fcf('0x6')](_0x0fcf('0x7')));}catch(_0x3af316){return[];}},'set':function(_0x1bace8){try{this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')](_0x1bace8));}catch(_0x50c575){this[_0x0fcf('0x8')](_0x0fcf('0x7'),JSON[_0x0fcf('0x9')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x0fcf('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x0fcf('0xa')]},'col':{'type':Sequelize[_0x0fcf('0xa')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0fcf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x0fcf('0x3')]},'titleFontSize':{'type':Sequelize[_0x0fcf('0xa')],'defaultValue':0xc}};
\ No newline at end of file
+var _0x33af=['attrs','setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse'];(function(_0x411f6f,_0x1a311d){var _0x14d129=function(_0x4dd216){while(--_0x4dd216){_0x411f6f['push'](_0x411f6f['shift']());}};_0x14d129(++_0x1a311d);}(_0x33af,0xec));var _0xf33a=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0x33af[_0x4e1a49];return _0x136aae;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xf33a('0x0'));var _=require('lodash');module[_0xf33a('0x1')]={'title':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf33a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf33a('0x3')](_0xf33a('0x4')),'get':function(){try{return JSON[_0xf33a('0x5')](this['getDataValue'](_0xf33a('0x6')));}catch(_0x44cfa5){return[];}},'set':function(_0x583e54){try{this[_0xf33a('0x7')](_0xf33a('0x6'),JSON[_0xf33a('0x8')](_0x583e54));}catch(_0x2f3730){this[_0xf33a('0x7')](_0xf33a('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf33a('0x9')]},'col':{'type':Sequelize[_0xf33a('0x9')]},'background':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![],'defaultValue':_0xf33a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf33a('0x2')]},'titleFontSize':{'type':Sequelize[_0xf33a('0x9')],'defaultValue':0xc}};
\ No newline at end of file
index 211a864..ceab439 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1115=['clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','show','DashboardItem','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','options','catch','find','params','type','iframe','attrUrl','attrs','value','https://','custom','attrPath'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1115,0x1b6));var _0x5111=function(_0x2d91c1,_0x795d76){_0x2d91c1=_0x2d91c1-0x0;var _0x214d6c=_0x1115[_0x2d91c1];return _0x214d6c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5111('0x0'));var zipdir=require(_0x5111('0x1'));var jsonpatch=require(_0x5111('0x2'));var rp=require(_0x5111('0x3'));var moment=require(_0x5111('0x4'));var BPromise=require(_0x5111('0x5'));var Mustache=require(_0x5111('0x6'));var util=require(_0x5111('0x7'));var path=require(_0x5111('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5111('0x9'));var fs=require('fs');var fs_extra=require(_0x5111('0xa'));var _=require('lodash');var squel=require(_0x5111('0xb'));var crypto=require(_0x5111('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5111('0xd'));var toCsv=require('to-csv');var querystring=require(_0x5111('0xe'));var Papa=require(_0x5111('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5111('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5111('0x11'));var logger=require('../../config/logger')(_0x5111('0x12'));var utils=require(_0x5111('0x13'));var config=require(_0x5111('0x14'));var licenseUtil=require(_0x5111('0x15'));var db=require(_0x5111('0x16'))['db'];config[_0x5111('0x17')]=_[_0x5111('0x18')](config[_0x5111('0x17')],{'host':_0x5111('0x19'),'port':0x18eb});var socket=require(_0x5111('0x1a'))(new Redis(config[_0x5111('0x17')]));require(_0x5111('0x1b'))[_0x5111('0x1c')](socket);function respondWithStatusCode(_0x3e60b5,_0x3721d5){_0x3721d5=_0x3721d5||0xcc;return function(_0x291d54){if(_0x291d54){return _0x3e60b5[_0x5111('0x1d')](_0x3721d5);}return _0x3e60b5[_0x5111('0x1e')](_0x3721d5)['end']();};}function respondWithResult(_0x1ac606,_0x54e2b7){_0x54e2b7=_0x54e2b7||0xc8;return function(_0x5ba7b1){if(_0x5ba7b1){return _0x1ac606[_0x5111('0x1e')](_0x54e2b7)[_0x5111('0x1f')](_0x5ba7b1);}};}function respondWithFilteredResult(_0x638470,_0x51ce4a){return function(_0x367f8d){if(_0x367f8d){var _0xa3f4ba=typeof _0x51ce4a['offset']===_0x5111('0x20')&&typeof _0x51ce4a[_0x5111('0x21')]===_0x5111('0x20');var _0x1b3b45=_0x367f8d['count'];var _0x52d236=_0xa3f4ba?0x0:_0x51ce4a[_0x5111('0x22')];var _0x1b0e5c=_0xa3f4ba?_0x367f8d[_0x5111('0x23')]:_0x51ce4a[_0x5111('0x22')]+_0x51ce4a[_0x5111('0x21')];var _0x3e8de1;if(_0x1b0e5c>=_0x1b3b45){_0x1b0e5c=_0x1b3b45;_0x3e8de1=0xc8;}else{_0x3e8de1=0xce;}_0x638470[_0x5111('0x1e')](_0x3e8de1);return _0x638470[_0x5111('0x24')](_0x5111('0x25'),_0x52d236+'-'+_0x1b0e5c+'/'+_0x1b3b45)['json'](_0x367f8d);}return null;};}function patchUpdates(_0x3f462d){return function(_0x162ff9){try{jsonpatch[_0x5111('0x26')](_0x162ff9,_0x3f462d,!![]);}catch(_0x5bf534){return BPromise[_0x5111('0x27')](_0x5bf534);}return _0x162ff9[_0x5111('0x28')]();};}function saveUpdates(_0x2d9446,_0x268070){return function(_0x10a3fe){if(_0x10a3fe){return _0x10a3fe[_0x5111('0x29')](_0x2d9446)[_0x5111('0x2a')](function(_0x316b39){return _0x316b39;});}return null;};}function removeEntity(_0x382bd0,_0x1a5793){return function(_0x4ffdc3){if(_0x4ffdc3){return _0x4ffdc3[_0x5111('0x2b')]()[_0x5111('0x2a')](function(){_0x382bd0[_0x5111('0x1e')](0xcc)[_0x5111('0x2c')]();});}};}function handleEntityNotFound(_0x265149,_0x403dd7){return function(_0x2e24ed){if(!_0x2e24ed){_0x265149['sendStatus'](0x194);}return _0x2e24ed;};}function handleError(_0x1ce17f,_0x46134c){_0x46134c=_0x46134c||0x1f4;return function(_0x25a75a){logger['error'](_0x25a75a[_0x5111('0x2d')]);if(_0x25a75a[_0x5111('0x2e')]){delete _0x25a75a[_0x5111('0x2e')];}_0x1ce17f['status'](_0x46134c)['send'](_0x25a75a);};}exports[_0x5111('0x2f')]=function(_0x5165fc,_0xbacf9e){var _0x5b5a6d={'raw':![],'where':{'id':_0x5165fc['params']['id']}},_0x35ed41={};_0x35ed41['model']=_['keys'](db[_0x5111('0x30')][_0x5111('0x31')]);_0x35ed41[_0x5111('0x32')]=_[_0x5111('0x33')](_0x5165fc[_0x5111('0x32')]);_0x35ed41[_0x5111('0x34')]=_[_0x5111('0x35')](_0x35ed41['model'],_0x35ed41[_0x5111('0x32')]);_0x5b5a6d[_0x5111('0x36')]=_[_0x5111('0x35')](_0x35ed41[_0x5111('0x37')],qs['fields'](_0x5165fc['query'][_0x5111('0x38')]));_0x5b5a6d[_0x5111('0x36')]=_0x5b5a6d[_0x5111('0x36')][_0x5111('0x39')]?_0x5b5a6d[_0x5111('0x36')]:_0x35ed41[_0x5111('0x37')];if(_0x5165fc[_0x5111('0x32')][_0x5111('0x3a')]){_0x5b5a6d['include']=[{'all':!![]}];}_0x5b5a6d=_[_0x5111('0x3b')]({},_0x5b5a6d,_0x5165fc[_0x5111('0x3c')]);return db[_0x5111('0x30')]['find'](_0x5b5a6d)[_0x5111('0x2a')](handleEntityNotFound(_0xbacf9e,null))[_0x5111('0x2a')](respondWithResult(_0xbacf9e,null))[_0x5111('0x3d')](handleError(_0xbacf9e,null));};exports['destroy']=function(_0x4ecbc9,_0x4c26b1){return db[_0x5111('0x30')][_0x5111('0x3e')]({'where':{'id':_0x4ecbc9[_0x5111('0x3f')]['id']}})[_0x5111('0x2a')](handleEntityNotFound(_0x4c26b1,null))[_0x5111('0x2a')](removeEntity(_0x4c26b1,null))['catch'](handleError(_0x4c26b1,null));};function widgetAttributes(_0x45d094){try{switch(_0x45d094[_0x5111('0x40')]){case _0x5111('0x41'):return[{'name':_0x5111('0x42'),'value':_0x45d094['attrUrl']||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x0]?_0x45d094[_0x5111('0x43')][0x0][_0x5111('0x44')]:undefined)||_0x5111('0x45')}];case _0x5111('0x46'):return[{'name':_0x5111('0x47'),'value':_0x45d094[_0x5111('0x47')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x0]?_0x45d094[_0x5111('0x43')][0x0][_0x5111('0x44')]:undefined)||''}];case _0x5111('0x48'):return[{'name':'attrHourFormat','value':_0x45d094[_0x5111('0x49')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094['attrs'][0x0]?_0x45d094[_0x5111('0x43')][0x0][_0x5111('0x44')]:undefined)||_0x5111('0x4a')},{'name':_0x5111('0x4b'),'value':_0x45d094[_0x5111('0x4b')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x1]?_0x45d094['attrs'][0x1][_0x5111('0x44')]:undefined)||_0x5111('0x4c')},{'name':_0x5111('0x4d'),'value':_0x45d094[_0x5111('0x4d')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094['attrs'][0x2]?_0x45d094['attrs'][0x2][_0x5111('0x44')]:undefined)||0xc}];case _0x5111('0x4e'):return[{'name':'attrMetric','value':_0x45d094[_0x5111('0x4f')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x0]?_0x45d094[_0x5111('0x43')][0x0][_0x5111('0x44')]:undefined)||_0x5111('0x50')},{'name':_0x5111('0x51'),'value':_0x45d094[_0x5111('0x51')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x1]?_0x45d094['attrs'][0x1]['value']:undefined)||[]},{'name':_0x5111('0x4d'),'value':_0x45d094[_0x5111('0x4d')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x2]?_0x45d094[_0x5111('0x43')][0x2][_0x5111('0x44')]:undefined)||0x14},{'name':'attrChannel','value':_0x45d094[_0x5111('0x52')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x3]?_0x45d094[_0x5111('0x43')][0x3]['value']:undefined)||_0x5111('0x53')},{'name':_0x5111('0x54'),'value':_0x45d094[_0x5111('0x54')]||(_0x45d094['attrs']&&_0x45d094[_0x5111('0x43')][0x4]?_0x45d094[_0x5111('0x43')][0x4][_0x5111('0x44')]:undefined)||''},{'name':_0x5111('0x55'),'value':_0x45d094['attrFaxAccounts']||(_0x45d094['attrs']&&_0x45d094[_0x5111('0x43')][0x5]?_0x45d094['attrs'][0x5]['value']:undefined)||''},{'name':_0x5111('0x56'),'value':_0x45d094[_0x5111('0x56')]||(_0x45d094['attrs']&&_0x45d094[_0x5111('0x43')][0x6]?_0x45d094[_0x5111('0x43')][0x6][_0x5111('0x44')]:undefined)||''},{'name':_0x5111('0x57'),'value':_0x45d094[_0x5111('0x57')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x7]?_0x45d094[_0x5111('0x43')][0x7][_0x5111('0x44')]:undefined)||''},{'name':_0x5111('0x58'),'value':_0x45d094[_0x5111('0x58')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094['attrs'][0x8]?_0x45d094[_0x5111('0x43')][0x8][_0x5111('0x44')]:undefined)||''},{'name':_0x5111('0x59'),'value':_0x45d094[_0x5111('0x59')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x9]?_0x45d094[_0x5111('0x43')][0x9]['value']:undefined)||''}];case'multibar-chart':case _0x5111('0x5a'):return[{'name':'attrSerie1','value':_0x45d094[_0x5111('0x5b')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x0]?_0x45d094[_0x5111('0x43')][0x0][_0x5111('0x44')]:undefined)||_0x5111('0x50')},{'name':_0x5111('0x5c'),'value':_0x45d094['attrSerie2']||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x1]?_0x45d094['attrs'][0x1][_0x5111('0x44')]:undefined)||null},{'name':_0x5111('0x5d'),'value':_0x45d094['attrSerie3']||(_0x45d094[_0x5111('0x43')]&&_0x45d094['attrs'][0x2]?_0x45d094['attrs'][0x2]['value']:undefined)||null},{'name':_0x5111('0x51'),'value':_0x45d094[_0x5111('0x51')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x3]?_0x45d094['attrs'][0x3][_0x5111('0x44')]:undefined)||[]},{'name':_0x5111('0x52'),'value':_0x45d094[_0x5111('0x52')]||(_0x45d094['attrs']&&_0x45d094[_0x5111('0x43')][0x4]?_0x45d094[_0x5111('0x43')][0x4][_0x5111('0x44')]:undefined)||'voice'},{'name':_0x5111('0x54'),'value':_0x45d094['attrEmailAccounts']||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x5]?_0x45d094[_0x5111('0x43')][0x5][_0x5111('0x44')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x45d094[_0x5111('0x55')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x6]?_0x45d094[_0x5111('0x43')][0x6][_0x5111('0x44')]:undefined)||''},{'name':_0x5111('0x56'),'value':_0x45d094[_0x5111('0x56')]||(_0x45d094['attrs']&&_0x45d094[_0x5111('0x43')][0x7]?_0x45d094['attrs'][0x7][_0x5111('0x44')]:undefined)||''},{'name':_0x5111('0x57'),'value':_0x45d094[_0x5111('0x57')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x8]?_0x45d094[_0x5111('0x43')][0x8]['value']:undefined)||''},{'name':_0x5111('0x58'),'value':_0x45d094[_0x5111('0x58')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x9]?_0x45d094[_0x5111('0x43')][0x9][_0x5111('0x44')]:undefined)||''},{'name':'attrChatWebsites','value':_0x45d094[_0x5111('0x59')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0xa]?_0x45d094[_0x5111('0x43')][0xa][_0x5111('0x44')]:undefined)||''}];case'web-report':return[{'name':_0x5111('0x5e'),'type':_0x45d094[_0x5111('0x5f')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x0]?_0x45d094[_0x5111('0x43')][0x0][_0x5111('0x40')]:undefined)||null,'value':_0x45d094[_0x5111('0x5e')]||(_0x45d094['attrs']&&_0x45d094['attrs'][0x0]?_0x45d094['attrs'][0x0][_0x5111('0x44')]:undefined)||null},{'name':_0x5111('0x60'),'value':_0x45d094[_0x5111('0x60')]||(_0x45d094[_0x5111('0x43')]&&_0x45d094[_0x5111('0x43')][0x1]?_0x45d094['attrs'][0x1][_0x5111('0x44')]:undefined)||0x0}];default:return[];}}catch(_0x2d2d52){logger[_0x5111('0x61')](_0x5111('0x62'),JSON[_0x5111('0x63')](_0x2d2d52));return[];}}exports[_0x5111('0x64')]=function(_0x8bc97b,_0x3dee92){if(_0x8bc97b[_0x5111('0x65')]){_0x8bc97b[_0x5111('0x65')]['attrs']=widgetAttributes(_0x8bc97b[_0x5111('0x65')]);}return db[_0x5111('0x30')]['create'](_0x8bc97b[_0x5111('0x65')],{})[_0x5111('0x2a')](respondWithResult(_0x3dee92,0xc9))['catch'](handleError(_0x3dee92,null));};exports[_0x5111('0x29')]=function(_0x3aaecb,_0x1db9a3){if(_0x3aaecb[_0x5111('0x65')]['id']){delete _0x3aaecb[_0x5111('0x65')]['id'];}_0x3aaecb[_0x5111('0x65')][_0x5111('0x43')]=widgetAttributes(_0x3aaecb['body']);return db[_0x5111('0x30')]['find']({'where':{'id':_0x3aaecb['params']['id']}})[_0x5111('0x2a')](handleEntityNotFound(_0x1db9a3,null))['then'](saveUpdates(_0x3aaecb[_0x5111('0x65')],null))['then'](respondWithResult(_0x1db9a3,null))[_0x5111('0x3d')](handleError(_0x1db9a3,null));};
\ No newline at end of file
+var _0xb3f9=['clock','attrHourFormat','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','body','update','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','stack','name','send','params','model','keys','query','filters','attributes','intersection','fields','length','includeAll','include','options','DashboardItem','find','catch','type','iframe','attrUrl','attrs','https://','custom','attrPath','value'];(function(_0xc9c3b0,_0x38b68a){var _0x31ff42=function(_0x22c29d){while(--_0x22c29d){_0xc9c3b0['push'](_0xc9c3b0['shift']());}};_0x31ff42(++_0x38b68a);}(_0xb3f9,0x7a));var _0x9b3f=function(_0x3854ed,_0x335031){_0x3854ed=_0x3854ed-0x0;var _0x5c25c1=_0xb3f9[_0x3854ed];return _0x5c25c1;};'use strict';var emlformat=require(_0x9b3f('0x0'));var rimraf=require(_0x9b3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b3f('0x2'));var moment=require('moment');var BPromise=require(_0x9b3f('0x3'));var Mustache=require(_0x9b3f('0x4'));var util=require(_0x9b3f('0x5'));var path=require(_0x9b3f('0x6'));var sox=require(_0x9b3f('0x7'));var csv=require(_0x9b3f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b3f('0x9'));var squel=require(_0x9b3f('0xa'));var crypto=require('crypto');var jsforce=require(_0x9b3f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9b3f('0xc'));var Redis=require('ioredis');var authService=require(_0x9b3f('0xd'));var qs=require(_0x9b3f('0xe'));var as=require(_0x9b3f('0xf'));var hardwareService=require(_0x9b3f('0x10'));var logger=require(_0x9b3f('0x11'))('api');var utils=require(_0x9b3f('0x12'));var config=require(_0x9b3f('0x13'));var licenseUtil=require(_0x9b3f('0x14'));var db=require(_0x9b3f('0x15'))['db'];config[_0x9b3f('0x16')]=_[_0x9b3f('0x17')](config[_0x9b3f('0x16')],{'host':_0x9b3f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9b3f('0x19'))[_0x9b3f('0x1a')](socket);function respondWithStatusCode(_0x27dab5,_0x377bfa){_0x377bfa=_0x377bfa||0xcc;return function(_0x76978e){if(_0x76978e){return _0x27dab5['sendStatus'](_0x377bfa);}return _0x27dab5['status'](_0x377bfa)['end']();};}function respondWithResult(_0x34fb19,_0x427992){_0x427992=_0x427992||0xc8;return function(_0x484323){if(_0x484323){return _0x34fb19[_0x9b3f('0x1b')](_0x427992)[_0x9b3f('0x1c')](_0x484323);}};}function respondWithFilteredResult(_0x2cdc7c,_0x5f5c1c){return function(_0x579c32){if(_0x579c32){var _0x2f2a53=typeof _0x5f5c1c[_0x9b3f('0x1d')]===_0x9b3f('0x1e')&&typeof _0x5f5c1c[_0x9b3f('0x1f')]===_0x9b3f('0x1e');var _0x297fa8=_0x579c32[_0x9b3f('0x20')];var _0x17f2d3=_0x2f2a53?0x0:_0x5f5c1c[_0x9b3f('0x1d')];var _0x13e65b=_0x2f2a53?_0x579c32[_0x9b3f('0x20')]:_0x5f5c1c[_0x9b3f('0x1d')]+_0x5f5c1c[_0x9b3f('0x1f')];var _0x1218c0;if(_0x13e65b>=_0x297fa8){_0x13e65b=_0x297fa8;_0x1218c0=0xc8;}else{_0x1218c0=0xce;}_0x2cdc7c[_0x9b3f('0x1b')](_0x1218c0);return _0x2cdc7c[_0x9b3f('0x21')](_0x9b3f('0x22'),_0x17f2d3+'-'+_0x13e65b+'/'+_0x297fa8)[_0x9b3f('0x1c')](_0x579c32);}return null;};}function patchUpdates(_0x3360d6){return function(_0x5b4f21){try{jsonpatch[_0x9b3f('0x23')](_0x5b4f21,_0x3360d6,!![]);}catch(_0x4db496){return BPromise[_0x9b3f('0x24')](_0x4db496);}return _0x5b4f21['save']();};}function saveUpdates(_0x3c9d8d,_0x28dd96){return function(_0x16452e){if(_0x16452e){return _0x16452e['update'](_0x3c9d8d)[_0x9b3f('0x25')](function(_0x483eb3){return _0x483eb3;});}return null;};}function removeEntity(_0x325c74,_0x526355){return function(_0x1b3ba8){if(_0x1b3ba8){return _0x1b3ba8[_0x9b3f('0x26')]()['then'](function(){_0x325c74[_0x9b3f('0x1b')](0xcc)[_0x9b3f('0x27')]();});}};}function handleEntityNotFound(_0x2dfef4,_0x9cf303){return function(_0x487527){if(!_0x487527){_0x2dfef4['sendStatus'](0x194);}return _0x487527;};}function handleError(_0x28e426,_0x555bf4){_0x555bf4=_0x555bf4||0x1f4;return function(_0x377d0e){logger['error'](_0x377d0e[_0x9b3f('0x28')]);if(_0x377d0e[_0x9b3f('0x29')]){delete _0x377d0e[_0x9b3f('0x29')];}_0x28e426[_0x9b3f('0x1b')](_0x555bf4)[_0x9b3f('0x2a')](_0x377d0e);};}exports['show']=function(_0x23dff5,_0x38dd12){var _0x1dad0e={'raw':![],'where':{'id':_0x23dff5[_0x9b3f('0x2b')]['id']}},_0x2a0a0c={};_0x2a0a0c[_0x9b3f('0x2c')]=_[_0x9b3f('0x2d')](db['DashboardItem']['rawAttributes']);_0x2a0a0c[_0x9b3f('0x2e')]=_['keys'](_0x23dff5['query']);_0x2a0a0c[_0x9b3f('0x2f')]=_['intersection'](_0x2a0a0c[_0x9b3f('0x2c')],_0x2a0a0c[_0x9b3f('0x2e')]);_0x1dad0e[_0x9b3f('0x30')]=_[_0x9b3f('0x31')](_0x2a0a0c[_0x9b3f('0x2c')],qs['fields'](_0x23dff5[_0x9b3f('0x2e')][_0x9b3f('0x32')]));_0x1dad0e[_0x9b3f('0x30')]=_0x1dad0e[_0x9b3f('0x30')][_0x9b3f('0x33')]?_0x1dad0e[_0x9b3f('0x30')]:_0x2a0a0c['model'];if(_0x23dff5[_0x9b3f('0x2e')][_0x9b3f('0x34')]){_0x1dad0e[_0x9b3f('0x35')]=[{'all':!![]}];}_0x1dad0e=_['merge']({},_0x1dad0e,_0x23dff5[_0x9b3f('0x36')]);return db[_0x9b3f('0x37')][_0x9b3f('0x38')](_0x1dad0e)[_0x9b3f('0x25')](handleEntityNotFound(_0x38dd12,null))[_0x9b3f('0x25')](respondWithResult(_0x38dd12,null))[_0x9b3f('0x39')](handleError(_0x38dd12,null));};exports[_0x9b3f('0x26')]=function(_0x1cfa30,_0x115d38){return db[_0x9b3f('0x37')][_0x9b3f('0x38')]({'where':{'id':_0x1cfa30[_0x9b3f('0x2b')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x115d38,null))[_0x9b3f('0x25')](removeEntity(_0x115d38,null))[_0x9b3f('0x39')](handleError(_0x115d38,null));};function widgetAttributes(_0x4c4aba){try{switch(_0x4c4aba[_0x9b3f('0x3a')]){case _0x9b3f('0x3b'):return[{'name':_0x9b3f('0x3c'),'value':_0x4c4aba[_0x9b3f('0x3c')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0]['value']:undefined)||_0x9b3f('0x3e')}];case _0x9b3f('0x3f'):return[{'name':'attrPath','value':_0x4c4aba[_0x9b3f('0x40')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0][_0x9b3f('0x41')]:undefined)||''}];case _0x9b3f('0x42'):return[{'name':'attrHourFormat','value':_0x4c4aba[_0x9b3f('0x43')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0][_0x9b3f('0x41')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x4c4aba[_0x9b3f('0x44')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x1]?_0x4c4aba['attrs'][0x1][_0x9b3f('0x41')]:undefined)||'0.00'},{'name':_0x9b3f('0x45'),'value':_0x4c4aba['attrFontSize']||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x2]?_0x4c4aba['attrs'][0x2][_0x9b3f('0x41')]:undefined)||0xc}];case _0x9b3f('0x46'):return[{'name':_0x9b3f('0x47'),'value':_0x4c4aba[_0x9b3f('0x47')]||(_0x4c4aba['attrs']&&_0x4c4aba['attrs'][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0]['value']:undefined)||_0x9b3f('0x48')},{'name':_0x9b3f('0x49'),'value':_0x4c4aba['attrVoiceQueues']||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x1]?_0x4c4aba[_0x9b3f('0x3d')][0x1][_0x9b3f('0x41')]:undefined)||[]},{'name':'attrFontSize','value':_0x4c4aba[_0x9b3f('0x45')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x2]?_0x4c4aba[_0x9b3f('0x3d')][0x2][_0x9b3f('0x41')]:undefined)||0x14},{'name':'attrChannel','value':_0x4c4aba[_0x9b3f('0x4a')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x3]?_0x4c4aba[_0x9b3f('0x3d')][0x3][_0x9b3f('0x41')]:undefined)||_0x9b3f('0x4b')},{'name':_0x9b3f('0x4c'),'value':_0x4c4aba[_0x9b3f('0x4c')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x4]?_0x4c4aba['attrs'][0x4][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4d'),'value':_0x4c4aba[_0x9b3f('0x4d')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x5]?_0x4c4aba[_0x9b3f('0x3d')][0x5][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4e'),'value':_0x4c4aba[_0x9b3f('0x4e')]||(_0x4c4aba['attrs']&&_0x4c4aba[_0x9b3f('0x3d')][0x6]?_0x4c4aba['attrs'][0x6][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4f'),'value':_0x4c4aba[_0x9b3f('0x4f')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x7]?_0x4c4aba[_0x9b3f('0x3d')][0x7][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x50'),'value':_0x4c4aba[_0x9b3f('0x50')]||(_0x4c4aba['attrs']&&_0x4c4aba['attrs'][0x8]?_0x4c4aba['attrs'][0x8]['value']:undefined)||''},{'name':_0x9b3f('0x51'),'value':_0x4c4aba[_0x9b3f('0x51')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x9]?_0x4c4aba[_0x9b3f('0x3d')][0x9]['value']:undefined)||''}];case _0x9b3f('0x52'):case'pie-chart':return[{'name':_0x9b3f('0x53'),'value':_0x4c4aba[_0x9b3f('0x53')]||(_0x4c4aba['attrs']&&_0x4c4aba[_0x9b3f('0x3d')][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0][_0x9b3f('0x41')]:undefined)||_0x9b3f('0x48')},{'name':_0x9b3f('0x54'),'value':_0x4c4aba[_0x9b3f('0x54')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x1]?_0x4c4aba[_0x9b3f('0x3d')][0x1]['value']:undefined)||null},{'name':_0x9b3f('0x55'),'value':_0x4c4aba[_0x9b3f('0x55')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x2]?_0x4c4aba[_0x9b3f('0x3d')][0x2]['value']:undefined)||null},{'name':_0x9b3f('0x49'),'value':_0x4c4aba[_0x9b3f('0x49')]||(_0x4c4aba['attrs']&&_0x4c4aba[_0x9b3f('0x3d')][0x3]?_0x4c4aba[_0x9b3f('0x3d')][0x3][_0x9b3f('0x41')]:undefined)||[]},{'name':'attrChannel','value':_0x4c4aba[_0x9b3f('0x4a')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x4]?_0x4c4aba[_0x9b3f('0x3d')][0x4][_0x9b3f('0x41')]:undefined)||_0x9b3f('0x4b')},{'name':_0x9b3f('0x4c'),'value':_0x4c4aba[_0x9b3f('0x4c')]||(_0x4c4aba['attrs']&&_0x4c4aba[_0x9b3f('0x3d')][0x5]?_0x4c4aba[_0x9b3f('0x3d')][0x5][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4d'),'value':_0x4c4aba[_0x9b3f('0x4d')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x6]?_0x4c4aba[_0x9b3f('0x3d')][0x6][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x4e'),'value':_0x4c4aba[_0x9b3f('0x4e')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x7]?_0x4c4aba[_0x9b3f('0x3d')][0x7][_0x9b3f('0x41')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x4c4aba[_0x9b3f('0x4f')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x8]?_0x4c4aba[_0x9b3f('0x3d')][0x8][_0x9b3f('0x41')]:undefined)||''},{'name':_0x9b3f('0x50'),'value':_0x4c4aba[_0x9b3f('0x50')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x9]?_0x4c4aba[_0x9b3f('0x3d')][0x9]['value']:undefined)||''},{'name':_0x9b3f('0x51'),'value':_0x4c4aba[_0x9b3f('0x51')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0xa]?_0x4c4aba[_0x9b3f('0x3d')][0xa][_0x9b3f('0x41')]:undefined)||''}];case _0x9b3f('0x56'):return[{'name':_0x9b3f('0x57'),'type':_0x4c4aba[_0x9b3f('0x58')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x0]?_0x4c4aba[_0x9b3f('0x3d')][0x0][_0x9b3f('0x3a')]:undefined)||null,'value':_0x4c4aba[_0x9b3f('0x57')]||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba[_0x9b3f('0x3d')][0x0]?_0x4c4aba['attrs'][0x0][_0x9b3f('0x41')]:undefined)||null},{'name':_0x9b3f('0x59'),'value':_0x4c4aba['attrRefresh']||(_0x4c4aba[_0x9b3f('0x3d')]&&_0x4c4aba['attrs'][0x1]?_0x4c4aba['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x54f8f3){logger[_0x9b3f('0x5a')](_0x9b3f('0x5b'),JSON['stringify'](_0x54f8f3));return[];}}exports['create']=function(_0x24a45a,_0x7a43a5){if(_0x24a45a[_0x9b3f('0x5c')]){_0x24a45a['body'][_0x9b3f('0x3d')]=widgetAttributes(_0x24a45a['body']);}return db['DashboardItem']['create'](_0x24a45a['body'],{})['then'](respondWithResult(_0x7a43a5,0xc9))[_0x9b3f('0x39')](handleError(_0x7a43a5,null));};exports[_0x9b3f('0x5d')]=function(_0x46e1c9,_0x1bfaad){if(_0x46e1c9[_0x9b3f('0x5c')]['id']){delete _0x46e1c9[_0x9b3f('0x5c')]['id'];}_0x46e1c9[_0x9b3f('0x5c')]['attrs']=widgetAttributes(_0x46e1c9[_0x9b3f('0x5c')]);return db[_0x9b3f('0x37')][_0x9b3f('0x38')]({'where':{'id':_0x46e1c9[_0x9b3f('0x2b')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x1bfaad,null))['then'](saveUpdates(_0x46e1c9['body'],null))[_0x9b3f('0x25')](respondWithResult(_0x1bfaad,null))[_0x9b3f('0x39')](handleError(_0x1bfaad,null));};
\ No newline at end of file
index e334e31..3a698dd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1bcc=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0x4e5128,_0x254e67){var _0x213bf8=function(_0x5c62a3){while(--_0x5c62a3){_0x4e5128['push'](_0x4e5128['shift']());}};_0x213bf8(++_0x254e67);}(_0x1bcc,0x11c));var _0xc1bc=function(_0x11c331,_0x523ccf){_0x11c331=_0x11c331-0x0;var _0x1b89e1=_0x1bcc[_0x11c331];return _0x1b89e1;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xc1bc('0x0'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc1bc('0x1')](0x0);var events={'afterCreate':_0xc1bc('0x2'),'afterUpdate':_0xc1bc('0x3'),'afterDestroy':_0xc1bc('0x4')};function emitEvent(_0x36b5ae){return function(_0x3400db,_0x42b3b4,_0x3e0f85){DashboardItemEvents['emit'](_0x36b5ae+':'+_0x3400db['id'],_0x3400db);DashboardItemEvents[_0xc1bc('0x5')](_0x36b5ae,_0x3400db);_0x3e0f85(null);};}for(var e in events){if(events[_0xc1bc('0x6')](e)){var event=events[e];DashboardItem[_0xc1bc('0x7')](e,emitEvent(event));}}module[_0xc1bc('0x8')]=DashboardItemEvents;
\ No newline at end of file
+var _0xf4e2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','DashboardItem','setMaxListeners','update'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xf4e2,0x15a));var _0x2f4e=function(_0x44faf5,_0x1f0f92){_0x44faf5=_0x44faf5-0x0;var _0x4c0a90=_0xf4e2[_0x44faf5];return _0x4c0a90;};'use strict';var EventEmitter=require(_0x2f4e('0x0'));var DashboardItem=require(_0x2f4e('0x1'))['db'][_0x2f4e('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x2f4e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2f4e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a01dd){return function(_0xe2eccd,_0x2277b2,_0x5a8e0f){DashboardItemEvents['emit'](_0x5a01dd+':'+_0xe2eccd['id'],_0xe2eccd);DashboardItemEvents[_0x2f4e('0x5')](_0x5a01dd,_0xe2eccd);_0x5a8e0f(null);};}for(var e in events){if(events[_0x2f4e('0x6')](e)){var event=events[e];DashboardItem[_0x2f4e('0x7')](e,emitEvent(event));}}module[_0x2f4e('0x8')]=DashboardItemEvents;
\ No newline at end of file
index e89251f..a0b21b0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a24=['util','api','moment','bluebird','request-promise','path','../../config/environment','./dashboardItem.attributes','dashboard_items','lodash'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x6a24,0xd1));var _0x46a2=function(_0x73cafd,_0x4a9bea){_0x73cafd=_0x73cafd-0x0;var _0x2f3a9f=_0x6a24[_0x73cafd];return _0x2f3a9f;};'use strict';var _=require(_0x46a2('0x0'));var util=require(_0x46a2('0x1'));var logger=require('../../config/logger')(_0x46a2('0x2'));var moment=require(_0x46a2('0x3'));var BPromise=require(_0x46a2('0x4'));var rp=require(_0x46a2('0x5'));var fs=require('fs');var path=require(_0x46a2('0x6'));var rimraf=require('rimraf');var config=require(_0x46a2('0x7'));var attributes=require(_0x46a2('0x8'));module['exports']=function(_0x22de0d,_0x8b6541){return _0x22de0d['define']('DashboardItem',attributes,{'tableName':_0x46a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe119=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x8d92a3,_0x44ef39){var _0x1dfe67=function(_0x39a7c8){while(--_0x39a7c8){_0x8d92a3['push'](_0x8d92a3['shift']());}};_0x1dfe67(++_0x44ef39);}(_0xe119,0x1c8));var _0x9e11=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0xe119[_0x48c615];return _0x3d9e22;};'use strict';var _=require(_0x9e11('0x0'));var util=require(_0x9e11('0x1'));var logger=require(_0x9e11('0x2'))(_0x9e11('0x3'));var moment=require(_0x9e11('0x4'));var BPromise=require(_0x9e11('0x5'));var rp=require(_0x9e11('0x6'));var fs=require('fs');var path=require(_0x9e11('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9e11('0x8'));module[_0x9e11('0x9')]=function(_0x280be0,_0x1f5d91){return _0x280be0[_0x9e11('0xa')](_0x9e11('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6058157..0ea9db6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4738=['rpc','http','redis','defaults','socket.io-emitter','register','then','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','DashboardItem,\x20%s,\x20%s','message','info','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x175840,_0x583415){var _0x534c00=function(_0x1223a0){while(--_0x1223a0){_0x175840['push'](_0x175840['shift']());}};_0x534c00(++_0x583415);}(_0x4738,0x70));var _0x8473=function(_0x16094a,_0x16f37f){_0x16094a=_0x16094a-0x0;var _0x17bc67=_0x4738[_0x16094a];return _0x17bc67;};'use strict';var _=require(_0x8473('0x0'));var util=require(_0x8473('0x1'));var moment=require(_0x8473('0x2'));var BPromise=require(_0x8473('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8473('0x4'));var db=require(_0x8473('0x5'))['db'];var utils=require(_0x8473('0x6'));var logger=require(_0x8473('0x7'))(_0x8473('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8473('0x9')]({'port':0x232a});config[_0x8473('0xa')]=_[_0x8473('0xb')](config[_0x8473('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x8473('0xc'))(new Redis(config['redis']));require('./dashboardItem.socket')[_0x8473('0xd')](socket);function respondWithRpcPromise(_0x18e4ac,_0x323105,_0x416a2d){return new BPromise(function(_0x1b64a2,_0x5558d3){return client['request'](_0x18e4ac,_0x416a2d)[_0x8473('0xe')](function(_0x2fb9e5){logger['info']('DashboardItem,\x20%s,\x20%s',_0x323105,_0x8473('0xf'));logger[_0x8473('0x10')](_0x8473('0x11'),_0x323105,_0x8473('0xf'),JSON[_0x8473('0x12')](_0x2fb9e5));if(_0x2fb9e5['error']){if(_0x2fb9e5[_0x8473('0x13')][_0x8473('0x14')]===0x1f4){logger[_0x8473('0x13')](_0x8473('0x15'),_0x323105,_0x2fb9e5['error'][_0x8473('0x16')]);return _0x5558d3(_0x2fb9e5[_0x8473('0x13')][_0x8473('0x16')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x323105,_0x2fb9e5[_0x8473('0x13')][_0x8473('0x16')]);return _0x1b64a2(_0x2fb9e5[_0x8473('0x13')][_0x8473('0x16')]);}else{logger[_0x8473('0x17')]('DashboardItem,\x20%s,\x20%s',_0x323105,_0x8473('0xf'));_0x1b64a2(_0x2fb9e5['result'][_0x8473('0x16')]);}})['catch'](function(_0x313762){logger[_0x8473('0x13')]('DashboardItem,\x20%s,\x20%s',_0x323105,_0x313762);_0x5558d3(_0x313762);});});}
\ No newline at end of file
+var _0x44af=['then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x291a25,_0x31ae01){var _0x380fab=function(_0x205298){while(--_0x205298){_0x291a25['push'](_0x291a25['shift']());}};_0x380fab(++_0x31ae01);}(_0x44af,0x184));var _0xf44a=function(_0x17eba5,_0x434f32){_0x17eba5=_0x17eba5-0x0;var _0x1aa6f1=_0x44af[_0x17eba5];return _0x1aa6f1;};'use strict';var _=require(_0xf44a('0x0'));var util=require(_0xf44a('0x1'));var moment=require(_0xf44a('0x2'));var BPromise=require(_0xf44a('0x3'));var rs=require(_0xf44a('0x4'));var fs=require('fs');var Redis=require(_0xf44a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf44a('0x6'));var logger=require(_0xf44a('0x7'))(_0xf44a('0x8'));var config=require('../../config/environment');var jayson=require(_0xf44a('0x9'));var client=jayson[_0xf44a('0xa')][_0xf44a('0xb')]({'port':0x232a});config['redis']=_[_0xf44a('0xc')](config[_0xf44a('0xd')],{'host':_0xf44a('0xe'),'port':0x18eb});var socket=require(_0xf44a('0xf'))(new Redis(config[_0xf44a('0xd')]));require(_0xf44a('0x10'))['register'](socket);function respondWithRpcPromise(_0x36a69b,_0x391897,_0x1abb3a){return new BPromise(function(_0x136cab,_0xd3d96d){return client['request'](_0x36a69b,_0x1abb3a)[_0xf44a('0x11')](function(_0x2cd362){logger[_0xf44a('0x12')](_0xf44a('0x13'),_0x391897,'request\x20sent');logger[_0xf44a('0x14')](_0xf44a('0x15'),_0x391897,'request\x20sent',JSON[_0xf44a('0x16')](_0x2cd362));if(_0x2cd362[_0xf44a('0x17')]){if(_0x2cd362[_0xf44a('0x17')][_0xf44a('0x18')]===0x1f4){logger[_0xf44a('0x17')](_0xf44a('0x13'),_0x391897,_0x2cd362[_0xf44a('0x17')]['message']);return _0xd3d96d(_0x2cd362[_0xf44a('0x17')]['message']);}logger[_0xf44a('0x17')](_0xf44a('0x13'),_0x391897,_0x2cd362[_0xf44a('0x17')][_0xf44a('0x19')]);return _0x136cab(_0x2cd362['error'][_0xf44a('0x19')]);}else{logger[_0xf44a('0x12')](_0xf44a('0x13'),_0x391897,'request\x20sent');_0x136cab(_0x2cd362['result'][_0xf44a('0x19')]);}})[_0xf44a('0x1a')](function(_0x5b2ab1){logger[_0xf44a('0x17')]('DashboardItem,\x20%s,\x20%s',_0x391897,_0x5b2ab1);_0xd3d96d(_0x5b2ab1);});});}
\ No newline at end of file
index 71bd10d..82d6470 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf10f=['./dashboardItem.events','update','emit','removeListener','register','dashboardItem:'];(function(_0x1be1f0,_0x120678){var _0x36329a=function(_0x3a010f){while(--_0x3a010f){_0x1be1f0['push'](_0x1be1f0['shift']());}};_0x36329a(++_0x120678);}(_0xf10f,0x162));var _0xff10=function(_0x3b4b90,_0x30370b){_0x3b4b90=_0x3b4b90-0x0;var _0x339419=_0xf10f[_0x3b4b90];return _0x339419;};'use strict';var DashboardItemEvents=require(_0xff10('0x0'));var events=['save','remove',_0xff10('0x1')];function createListener(_0x36387e,_0x102f1c){return function(_0x42be7a){_0x102f1c[_0xff10('0x2')](_0x36387e,_0x42be7a);};}function removeListener(_0x56d421,_0x26f0f7){return function(){DashboardItemEvents[_0xff10('0x3')](_0x56d421,_0x26f0f7);};}exports[_0xff10('0x4')]=function(_0x54b132){for(var _0x139dfb=0x0,_0x1cce92=events['length'];_0x139dfb<_0x1cce92;_0x139dfb++){var _0x568925=events[_0x139dfb];var _0x2a83d6=createListener(_0xff10('0x5')+_0x568925,_0x54b132);DashboardItemEvents['on'](_0x568925,_0x2a83d6);}};
\ No newline at end of file
+var _0xb379=['remove','update','emit','removeListener','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x11ebc8,_0x3e5e12){var _0x9ab69d=function(_0xfce6ac){while(--_0xfce6ac){_0x11ebc8['push'](_0x11ebc8['shift']());}};_0x9ab69d(++_0x3e5e12);}(_0xb379,0x18e));var _0x9b37=function(_0x431611,_0x3a439f){_0x431611=_0x431611-0x0;var _0x37a192=_0xb379[_0x431611];return _0x37a192;};'use strict';var DashboardItemEvents=require(_0x9b37('0x0'));var events=[_0x9b37('0x1'),_0x9b37('0x2'),_0x9b37('0x3')];function createListener(_0x1daab5,_0x342a41){return function(_0x8f4c87){_0x342a41[_0x9b37('0x4')](_0x1daab5,_0x8f4c87);};}function removeListener(_0x5c5db5,_0x161139){return function(){DashboardItemEvents[_0x9b37('0x5')](_0x5c5db5,_0x161139);};}exports['register']=function(_0x1d8dd1){for(var _0x3bf8ac=0x0,_0x123692=events[_0x9b37('0x6')];_0x3bf8ac<_0x123692;_0x3bf8ac++){var _0x3b032d=events[_0x3bf8ac];var _0x4c7f31=createListener(_0x9b37('0x7')+_0x3b032d,_0x1d8dd1);DashboardItemEvents['on'](_0x3b032d,_0x4c7f31);}};
\ No newline at end of file
index 7611f41..8567829 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3bab=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path'];(function(_0x421e89,_0x3f18a9){var _0xb2dcfa=function(_0x37cb89){while(--_0x37cb89){_0x421e89['push'](_0x421e89['shift']());}};_0xb2dcfa(++_0x3f18a9);}(_0x3bab,0x1b5));var _0xb3ba=function(_0x16a5a2,_0x1479cf){_0x16a5a2=_0x16a5a2-0x0;var _0x169585=_0x3bab[_0x16a5a2];return _0x169585;};'use strict';var multer=require(_0xb3ba('0x0'));var util=require(_0xb3ba('0x1'));var path=require(_0xb3ba('0x2'));var timeout=require(_0xb3ba('0x3'));var express=require(_0xb3ba('0x4'));var router=express[_0xb3ba('0x5')]();var fs_extra=require(_0xb3ba('0x6'));var auth=require(_0xb3ba('0x7'));var interaction=require(_0xb3ba('0x8'));var config=require(_0xb3ba('0x9'));var controller=require(_0xb3ba('0xa'));router[_0xb3ba('0xb')](_0xb3ba('0xc'),auth[_0xb3ba('0xd')](),controller['show']);router[_0xb3ba('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb3ba('0xf')]('/:id',auth[_0xb3ba('0xd')](),controller[_0xb3ba('0x10')]);router[_0xb3ba('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb3ba('0x12')]);module[_0xb3ba('0x13')]=router;
\ No newline at end of file
+var _0x2bf9=['express','fs-extra','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','create','put','update','delete','destroy','util','path','connect-timeout'];(function(_0x4c73c4,_0x1090cb){var _0x56c316=function(_0xb1e181){while(--_0xb1e181){_0x4c73c4['push'](_0x4c73c4['shift']());}};_0x56c316(++_0x1090cb);}(_0x2bf9,0xfd));var _0x92bf=function(_0x4fde83,_0x2d9011){_0x4fde83=_0x4fde83-0x0;var _0x3b33e3=_0x2bf9[_0x4fde83];return _0x3b33e3;};'use strict';var multer=require('multer');var util=require(_0x92bf('0x0'));var path=require(_0x92bf('0x1'));var timeout=require(_0x92bf('0x2'));var express=require(_0x92bf('0x3'));var router=express['Router']();var fs_extra=require(_0x92bf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92bf('0x5'));var config=require(_0x92bf('0x6'));var controller=require(_0x92bf('0x7'));router[_0x92bf('0x8')](_0x92bf('0x9'),auth[_0x92bf('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x92bf('0xb')]);router[_0x92bf('0xc')](_0x92bf('0x9'),auth['isAuthenticated'](),controller[_0x92bf('0xd')]);router[_0x92bf('0xe')]('/:id',auth[_0x92bf('0xa')](),controller[_0x92bf('0xf')]);module['exports']=router;
\ No newline at end of file
index 3373073..e34cdb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x405c=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0xbad157,_0x11b594){var _0x3c4b4a=function(_0x56af7d){while(--_0x56af7d){_0xbad157['push'](_0xbad157['shift']());}};_0x3c4b4a(++_0x11b594);}(_0x405c,0xdf));var _0xc405=function(_0x163460,_0x3b873c){_0x163460=_0x163460-0x0;var _0x33ccc1=_0x405c[_0x163460];return _0x33ccc1;};'use strict';var Sequelize=require(_0xc405('0x0'));module[_0xc405('0x1')]={'name':{'type':Sequelize[_0xc405('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xc405('0x3')](_0xc405('0x4'),_0xc405('0x5'),_0xc405('0x6')),'allowNull':![],'defaultValue':_0xc405('0x4')},'description':{'type':Sequelize[_0xc405('0x2')]}};
\ No newline at end of file
+var _0xfc8d=['first','sequelize','exports','STRING','ENUM','second','third'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfc8d,0xfd));var _0xdfc8=function(_0x44e7b9,_0xf7f5cc){_0x44e7b9=_0x44e7b9-0x0;var _0x1de7ac=_0xfc8d[_0x44e7b9];return _0x1de7ac;};'use strict';var Sequelize=require(_0xdfc8('0x0'));module[_0xdfc8('0x1')]={'name':{'type':Sequelize[_0xdfc8('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xdfc8('0x3')]('first',_0xdfc8('0x4'),_0xdfc8('0x5')),'allowNull':![],'defaultValue':_0xdfc8('0x6')},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 1031522..1e8844d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa13a=['get','Dispositions','UserProfileResource','end','error','stack','send','index','rawAttributes','type','map','name','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','Disposition','include','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x5519d4,_0x592edc){var _0x198e9b=function(_0x2a860a){while(--_0x2a860a){_0x5519d4['push'](_0x5519d4['shift']());}};_0x198e9b(++_0x592edc);}(_0xa13a,0x1d6));var _0xaa13=function(_0x421db4,_0x4f4c14){_0x421db4=_0x421db4-0x0;var _0x1f357c=_0xa13a[_0x421db4];return _0x1f357c;};'use strict';var emlformat=require(_0xaa13('0x0'));var rimraf=require(_0xaa13('0x1'));var zipdir=require(_0xaa13('0x2'));var jsonpatch=require(_0xaa13('0x3'));var rp=require('request-promise');var moment=require(_0xaa13('0x4'));var BPromise=require(_0xaa13('0x5'));var Mustache=require(_0xaa13('0x6'));var util=require(_0xaa13('0x7'));var path=require(_0xaa13('0x8'));var sox=require('sox');var csv=require(_0xaa13('0x9'));var ejs=require(_0xaa13('0xa'));var fs=require('fs');var fs_extra=require(_0xaa13('0xb'));var _=require('lodash');var squel=require(_0xaa13('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaa13('0xd'));var toCsv=require('to-csv');var querystring=require(_0xaa13('0xe'));var Papa=require('papaparse');var Redis=require(_0xaa13('0xf'));var authService=require(_0xaa13('0x10'));var qs=require(_0xaa13('0x11'));var as=require(_0xaa13('0x12'));var hardwareService=require(_0xaa13('0x13'));var logger=require(_0xaa13('0x14'))(_0xaa13('0x15'));var utils=require(_0xaa13('0x16'));var config=require(_0xaa13('0x17'));var licenseUtil=require(_0xaa13('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe5d6e9,_0x108a52){_0x108a52=_0x108a52||0xcc;return function(_0x59580f){if(_0x59580f){return _0xe5d6e9[_0xaa13('0x19')](_0x108a52);}return _0xe5d6e9['status'](_0x108a52)['end']();};}function respondWithResult(_0x2139be,_0x1d913b){_0x1d913b=_0x1d913b||0xc8;return function(_0x12b347){if(_0x12b347){return _0x2139be[_0xaa13('0x1a')](_0x1d913b)[_0xaa13('0x1b')](_0x12b347);}};}function respondWithFilteredResult(_0xe0f417,_0x16689b){return function(_0x140252){if(_0x140252){var _0x38ad24=typeof _0x16689b['offset']===_0xaa13('0x1c')&&typeof _0x16689b[_0xaa13('0x1d')]===_0xaa13('0x1c');var _0x253f31=_0x140252[_0xaa13('0x1e')];var _0x5e78da=_0x38ad24?0x0:_0x16689b[_0xaa13('0x1f')];var _0x331b0a=_0x38ad24?_0x140252[_0xaa13('0x1e')]:_0x16689b['offset']+_0x16689b['limit'];var _0x216c7f;if(_0x331b0a>=_0x253f31){_0x331b0a=_0x253f31;_0x216c7f=0xc8;}else{_0x216c7f=0xce;}_0xe0f417[_0xaa13('0x1a')](_0x216c7f);return _0xe0f417[_0xaa13('0x20')](_0xaa13('0x21'),_0x5e78da+'-'+_0x331b0a+'/'+_0x253f31)[_0xaa13('0x1b')](_0x140252);}return null;};}function patchUpdates(_0x185779){return function(_0x1a3071){try{jsonpatch[_0xaa13('0x22')](_0x1a3071,_0x185779,!![]);}catch(_0x2dfb0e){return BPromise[_0xaa13('0x23')](_0x2dfb0e);}return _0x1a3071[_0xaa13('0x24')]();};}function saveUpdates(_0x2e9b55,_0x18f628){return function(_0x580e66){if(_0x580e66){return _0x580e66[_0xaa13('0x25')](_0x2e9b55)[_0xaa13('0x26')](function(_0x45ed97){return _0x45ed97;});}return null;};}function removeEntity(_0x4db624,_0x204c9a){return function(_0x4285b0){if(_0x4285b0){return _0x4285b0[_0xaa13('0x27')]()[_0xaa13('0x26')](function(){var _0x134d1a=_0x4285b0[_0xaa13('0x28')]({'plain':!![]});var _0x512df3=_0xaa13('0x29');return db[_0xaa13('0x2a')][_0xaa13('0x27')]({'where':{'type':_0x512df3,'resourceId':_0x134d1a['id']}})['then'](function(){return _0x4285b0;});})['then'](function(){_0x4db624[_0xaa13('0x1a')](0xcc)[_0xaa13('0x2b')]();});}};}function handleEntityNotFound(_0x80d295,_0x23142d){return function(_0x1f3e9b){if(!_0x1f3e9b){_0x80d295[_0xaa13('0x19')](0x194);}return _0x1f3e9b;};}function handleError(_0x507709,_0x173feb){_0x173feb=_0x173feb||0x1f4;return function(_0x1d6f31){logger[_0xaa13('0x2c')](_0x1d6f31[_0xaa13('0x2d')]);if(_0x1d6f31['name']){delete _0x1d6f31['name'];}_0x507709[_0xaa13('0x1a')](_0x173feb)[_0xaa13('0x2e')](_0x1d6f31);};}exports[_0xaa13('0x2f')]=function(_0x24a664,_0x80153){var _0x4bc40={},_0x32f607={},_0x448b84={'count':0x0,'rows':[]};var _0x2d1ab1=_['map'](db['Disposition'][_0xaa13('0x30')],function(_0x2d4988){return{'name':_0x2d4988['fieldName'],'type':_0x2d4988[_0xaa13('0x31')]['key']};});_0x32f607['model']=_[_0xaa13('0x32')](_0x2d1ab1,_0xaa13('0x33'));_0x32f607[_0xaa13('0x34')]=_['keys'](_0x24a664[_0xaa13('0x34')]);_0x32f607[_0xaa13('0x35')]=_[_0xaa13('0x36')](_0x32f607[_0xaa13('0x37')],_0x32f607[_0xaa13('0x34')]);_0x4bc40[_0xaa13('0x38')]=_[_0xaa13('0x36')](_0x32f607['model'],qs['fields'](_0x24a664['query']['fields']));_0x4bc40[_0xaa13('0x38')]=_0x4bc40['attributes'][_0xaa13('0x39')]?_0x4bc40[_0xaa13('0x38')]:_0x32f607[_0xaa13('0x37')];if(!_0x24a664[_0xaa13('0x34')][_0xaa13('0x3a')](_0xaa13('0x3b'))){_0x4bc40[_0xaa13('0x1d')]=qs[_0xaa13('0x1d')](_0x24a664[_0xaa13('0x34')][_0xaa13('0x1d')]);_0x4bc40[_0xaa13('0x1f')]=qs['offset'](_0x24a664[_0xaa13('0x34')][_0xaa13('0x1f')]);}_0x4bc40[_0xaa13('0x3c')]=qs[_0xaa13('0x3d')](_0x24a664[_0xaa13('0x34')]['sort']);_0x4bc40[_0xaa13('0x3e')]=qs['filters'](_['pick'](_0x24a664[_0xaa13('0x34')],_0x32f607['filters']),_0x2d1ab1);if(_0x24a664['query'][_0xaa13('0x3f')]){_0x4bc40[_0xaa13('0x3e')]=_['merge'](_0x4bc40[_0xaa13('0x3e')],{'$or':_[_0xaa13('0x32')](_0x2d1ab1,function(_0x1d6b5b){if(_0x1d6b5b[_0xaa13('0x31')]!==_0xaa13('0x40')){var _0x124df0={};_0x124df0[_0x1d6b5b['name']]={'$like':'%'+_0x24a664[_0xaa13('0x34')][_0xaa13('0x3f')]+'%'};return _0x124df0;}})});}_0x4bc40=_['merge']({},_0x4bc40,_0x24a664[_0xaa13('0x41')]);var _0x2e4a3e={'where':_0x4bc40[_0xaa13('0x3e')]};return db[_0xaa13('0x42')]['count'](_0x2e4a3e)[_0xaa13('0x26')](function(_0x3bd4de){_0x448b84[_0xaa13('0x1e')]=_0x3bd4de;if(_0x24a664[_0xaa13('0x34')]['includeAll']){_0x4bc40[_0xaa13('0x43')]=[{'all':!![]}];}return db[_0xaa13('0x42')][_0xaa13('0x44')](_0x4bc40);})[_0xaa13('0x26')](function(_0x488915){_0x448b84[_0xaa13('0x45')]=_0x488915;return _0x448b84;})[_0xaa13('0x26')](respondWithFilteredResult(_0x80153,_0x4bc40))[_0xaa13('0x46')](handleError(_0x80153,null));};exports[_0xaa13('0x47')]=function(_0x1d672c,_0x4c4f74){var _0x1d878b={'raw':!![],'where':{'id':_0x1d672c[_0xaa13('0x48')]['id']}},_0x117636={};_0x117636[_0xaa13('0x37')]=_[_0xaa13('0x49')](db[_0xaa13('0x42')][_0xaa13('0x30')]);_0x117636['query']=_[_0xaa13('0x49')](_0x1d672c[_0xaa13('0x34')]);_0x117636[_0xaa13('0x35')]=_[_0xaa13('0x36')](_0x117636[_0xaa13('0x37')],_0x117636['query']);_0x1d878b[_0xaa13('0x38')]=_['intersection'](_0x117636[_0xaa13('0x37')],qs[_0xaa13('0x4a')](_0x1d672c[_0xaa13('0x34')][_0xaa13('0x4a')]));_0x1d878b[_0xaa13('0x38')]=_0x1d878b['attributes'][_0xaa13('0x39')]?_0x1d878b[_0xaa13('0x38')]:_0x117636[_0xaa13('0x37')];if(_0x1d672c['query']['includeAll']){_0x1d878b['include']=[{'all':!![]}];}_0x1d878b=_['merge']({},_0x1d878b,_0x1d672c[_0xaa13('0x41')]);return db['Disposition'][_0xaa13('0x4b')](_0x1d878b)['then'](handleEntityNotFound(_0x4c4f74,null))[_0xaa13('0x26')](respondWithResult(_0x4c4f74,null))['catch'](handleError(_0x4c4f74,null));};exports[_0xaa13('0x4c')]=function(_0x249969,_0x493a93){return db[_0xaa13('0x42')][_0xaa13('0x4c')](_0x249969[_0xaa13('0x4d')],{})[_0xaa13('0x26')](function(_0x54d1c1){var _0x48ff45=_0x249969[_0xaa13('0x4e')]['get']({'plain':!![]});if(!_0x48ff45)throw new Error(_0xaa13('0x4f'));if(_0x48ff45[_0xaa13('0x50')]===_0xaa13('0x4e')){var _0x2e1055=_0x54d1c1[_0xaa13('0x28')]({'plain':!![]});var _0x40fb1f='Dispositions';return db[_0xaa13('0x51')]['find']({'where':{'name':_0x40fb1f,'userProfileId':_0x48ff45[_0xaa13('0x52')]},'raw':!![]})[_0xaa13('0x26')](function(_0x563fd7){if(_0x563fd7&&_0x563fd7[_0xaa13('0x53')]===0x0){return db[_0xaa13('0x2a')][_0xaa13('0x4c')]({'name':_0x2e1055[_0xaa13('0x33')],'resourceId':_0x2e1055['id'],'type':_0x563fd7[_0xaa13('0x33')],'sectionId':_0x563fd7['id']},{})[_0xaa13('0x26')](function(){return _0x54d1c1;});}else{return _0x54d1c1;}})[_0xaa13('0x46')](function(_0x142385){logger['error'](_0xaa13('0x54'),_0x142385);throw _0x142385;});}return _0x54d1c1;})['then'](respondWithResult(_0x493a93,0xc9))['catch'](handleError(_0x493a93,null));};exports['update']=function(_0x1a8666,_0x504766){if(_0x1a8666[_0xaa13('0x4d')]['id']){delete _0x1a8666[_0xaa13('0x4d')]['id'];}return db[_0xaa13('0x42')][_0xaa13('0x4b')]({'where':{'id':_0x1a8666[_0xaa13('0x48')]['id']}})['then'](handleEntityNotFound(_0x504766,null))[_0xaa13('0x26')](saveUpdates(_0x1a8666[_0xaa13('0x4d')],null))['then'](respondWithResult(_0x504766,null))[_0xaa13('0x46')](handleError(_0x504766,null));};exports[_0xaa13('0x27')]=function(_0x2a9b8f,_0x4c900a){return db[_0xaa13('0x42')][_0xaa13('0x4b')]({'where':{'id':_0x2a9b8f[_0xaa13('0x48')]['id']}})[_0xaa13('0x26')](handleEntityNotFound(_0x4c900a,null))[_0xaa13('0x26')](removeEntity(_0x4c900a,null))[_0xaa13('0x46')](handleError(_0x4c900a,null));};
\ No newline at end of file
+var _0xe7db=['stack','name','index','map','Disposition','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','get','Dispositions','UserProfileResource','then','error'];(function(_0x3dc93c,_0xfd8a27){var _0x2402c8=function(_0x440744){while(--_0x440744){_0x3dc93c['push'](_0x3dc93c['shift']());}};_0x2402c8(++_0xfd8a27);}(_0xe7db,0x1bd));var _0xbe7d=function(_0x163691,_0x3d10c4){_0x163691=_0x163691-0x0;var _0x543ae5=_0xe7db[_0x163691];return _0x543ae5;};'use strict';var emlformat=require(_0xbe7d('0x0'));var rimraf=require(_0xbe7d('0x1'));var zipdir=require(_0xbe7d('0x2'));var jsonpatch=require(_0xbe7d('0x3'));var rp=require('request-promise');var moment=require(_0xbe7d('0x4'));var BPromise=require(_0xbe7d('0x5'));var Mustache=require(_0xbe7d('0x6'));var util=require(_0xbe7d('0x7'));var path=require('path');var sox=require(_0xbe7d('0x8'));var csv=require(_0xbe7d('0x9'));var ejs=require(_0xbe7d('0xa'));var fs=require('fs');var fs_extra=require(_0xbe7d('0xb'));var _=require('lodash');var squel=require(_0xbe7d('0xc'));var crypto=require('crypto');var jsforce=require(_0xbe7d('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbe7d('0x9'));var querystring=require(_0xbe7d('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbe7d('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe7d('0x10'));var logger=require(_0xbe7d('0x11'))('api');var utils=require(_0xbe7d('0x12'));var config=require(_0xbe7d('0x13'));var licenseUtil=require(_0xbe7d('0x14'));var db=require(_0xbe7d('0x15'))['db'];function respondWithStatusCode(_0x1ee9b8,_0x254a90){_0x254a90=_0x254a90||0xcc;return function(_0x3eb5be){if(_0x3eb5be){return _0x1ee9b8[_0xbe7d('0x16')](_0x254a90);}return _0x1ee9b8[_0xbe7d('0x17')](_0x254a90)[_0xbe7d('0x18')]();};}function respondWithResult(_0x57b464,_0x2e70a4){_0x2e70a4=_0x2e70a4||0xc8;return function(_0x308238){if(_0x308238){return _0x57b464[_0xbe7d('0x17')](_0x2e70a4)[_0xbe7d('0x19')](_0x308238);}};}function respondWithFilteredResult(_0xcc8aae,_0x16c04b){return function(_0xd8c2c9){if(_0xd8c2c9){var _0x462c9b=typeof _0x16c04b[_0xbe7d('0x1a')]===_0xbe7d('0x1b')&&typeof _0x16c04b[_0xbe7d('0x1c')]==='undefined';var _0x3509e7=_0xd8c2c9[_0xbe7d('0x1d')];var _0x45444f=_0x462c9b?0x0:_0x16c04b['offset'];var _0x3f2caa=_0x462c9b?_0xd8c2c9[_0xbe7d('0x1d')]:_0x16c04b[_0xbe7d('0x1a')]+_0x16c04b['limit'];var _0x140e0d;if(_0x3f2caa>=_0x3509e7){_0x3f2caa=_0x3509e7;_0x140e0d=0xc8;}else{_0x140e0d=0xce;}_0xcc8aae[_0xbe7d('0x17')](_0x140e0d);return _0xcc8aae[_0xbe7d('0x1e')](_0xbe7d('0x1f'),_0x45444f+'-'+_0x3f2caa+'/'+_0x3509e7)[_0xbe7d('0x19')](_0xd8c2c9);}return null;};}function patchUpdates(_0x15dfc5){return function(_0x3cb5d6){try{jsonpatch['apply'](_0x3cb5d6,_0x15dfc5,!![]);}catch(_0xbdb4a4){return BPromise[_0xbe7d('0x20')](_0xbdb4a4);}return _0x3cb5d6[_0xbe7d('0x21')]();};}function saveUpdates(_0x55a191,_0x56d6f8){return function(_0x2cd763){if(_0x2cd763){return _0x2cd763[_0xbe7d('0x22')](_0x55a191)['then'](function(_0x5085f0){return _0x5085f0;});}return null;};}function removeEntity(_0xd4a5f6,_0x291c69){return function(_0x2f9499){if(_0x2f9499){return _0x2f9499[_0xbe7d('0x23')]()['then'](function(){var _0x486f33=_0x2f9499[_0xbe7d('0x24')]({'plain':!![]});var _0x3b8fb0=_0xbe7d('0x25');return db[_0xbe7d('0x26')][_0xbe7d('0x23')]({'where':{'type':_0x3b8fb0,'resourceId':_0x486f33['id']}})[_0xbe7d('0x27')](function(){return _0x2f9499;});})['then'](function(){_0xd4a5f6[_0xbe7d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53843c,_0xd07785){return function(_0x5a99da){if(!_0x5a99da){_0x53843c[_0xbe7d('0x16')](0x194);}return _0x5a99da;};}function handleError(_0x2d823c,_0x136643){_0x136643=_0x136643||0x1f4;return function(_0x2acfb3){logger[_0xbe7d('0x28')](_0x2acfb3[_0xbe7d('0x29')]);if(_0x2acfb3[_0xbe7d('0x2a')]){delete _0x2acfb3[_0xbe7d('0x2a')];}_0x2d823c[_0xbe7d('0x17')](_0x136643)['send'](_0x2acfb3);};}exports[_0xbe7d('0x2b')]=function(_0x4b4975,_0x283935){var _0x2e7698={},_0x52fd59={},_0x191c0b={'count':0x0,'rows':[]};var _0x596088=_[_0xbe7d('0x2c')](db[_0xbe7d('0x2d')][_0xbe7d('0x2e')],function(_0x59121e){return{'name':_0x59121e[_0xbe7d('0x2f')],'type':_0x59121e[_0xbe7d('0x30')]['key']};});_0x52fd59[_0xbe7d('0x31')]=_[_0xbe7d('0x2c')](_0x596088,'name');_0x52fd59[_0xbe7d('0x32')]=_[_0xbe7d('0x33')](_0x4b4975[_0xbe7d('0x32')]);_0x52fd59[_0xbe7d('0x34')]=_[_0xbe7d('0x35')](_0x52fd59[_0xbe7d('0x31')],_0x52fd59[_0xbe7d('0x32')]);_0x2e7698[_0xbe7d('0x36')]=_[_0xbe7d('0x35')](_0x52fd59[_0xbe7d('0x31')],qs[_0xbe7d('0x37')](_0x4b4975[_0xbe7d('0x32')]['fields']));_0x2e7698[_0xbe7d('0x36')]=_0x2e7698[_0xbe7d('0x36')][_0xbe7d('0x38')]?_0x2e7698[_0xbe7d('0x36')]:_0x52fd59[_0xbe7d('0x31')];if(!_0x4b4975[_0xbe7d('0x32')]['hasOwnProperty'](_0xbe7d('0x39'))){_0x2e7698[_0xbe7d('0x1c')]=qs[_0xbe7d('0x1c')](_0x4b4975['query']['limit']);_0x2e7698['offset']=qs[_0xbe7d('0x1a')](_0x4b4975[_0xbe7d('0x32')][_0xbe7d('0x1a')]);}_0x2e7698[_0xbe7d('0x3a')]=qs[_0xbe7d('0x3b')](_0x4b4975[_0xbe7d('0x32')][_0xbe7d('0x3b')]);_0x2e7698[_0xbe7d('0x3c')]=qs[_0xbe7d('0x34')](_['pick'](_0x4b4975[_0xbe7d('0x32')],_0x52fd59[_0xbe7d('0x34')]),_0x596088);if(_0x4b4975[_0xbe7d('0x32')][_0xbe7d('0x3d')]){_0x2e7698[_0xbe7d('0x3c')]=_[_0xbe7d('0x3e')](_0x2e7698[_0xbe7d('0x3c')],{'$or':_['map'](_0x596088,function(_0x3b8b46){if(_0x3b8b46[_0xbe7d('0x30')]!==_0xbe7d('0x3f')){var _0x515c7c={};_0x515c7c[_0x3b8b46['name']]={'$like':'%'+_0x4b4975[_0xbe7d('0x32')]['filter']+'%'};return _0x515c7c;}})});}_0x2e7698=_[_0xbe7d('0x3e')]({},_0x2e7698,_0x4b4975[_0xbe7d('0x40')]);var _0x207cac={'where':_0x2e7698[_0xbe7d('0x3c')]};return db[_0xbe7d('0x2d')][_0xbe7d('0x1d')](_0x207cac)[_0xbe7d('0x27')](function(_0x248b19){_0x191c0b['count']=_0x248b19;if(_0x4b4975['query'][_0xbe7d('0x41')]){_0x2e7698[_0xbe7d('0x42')]=[{'all':!![]}];}return db[_0xbe7d('0x2d')][_0xbe7d('0x43')](_0x2e7698);})[_0xbe7d('0x27')](function(_0x224a2a){_0x191c0b[_0xbe7d('0x44')]=_0x224a2a;return _0x191c0b;})[_0xbe7d('0x27')](respondWithFilteredResult(_0x283935,_0x2e7698))['catch'](handleError(_0x283935,null));};exports[_0xbe7d('0x45')]=function(_0x26406b,_0x58582b){var _0x30e483={'raw':!![],'where':{'id':_0x26406b[_0xbe7d('0x46')]['id']}},_0x19aa18={};_0x19aa18[_0xbe7d('0x31')]=_[_0xbe7d('0x33')](db[_0xbe7d('0x2d')][_0xbe7d('0x2e')]);_0x19aa18[_0xbe7d('0x32')]=_['keys'](_0x26406b['query']);_0x19aa18[_0xbe7d('0x34')]=_['intersection'](_0x19aa18[_0xbe7d('0x31')],_0x19aa18['query']);_0x30e483[_0xbe7d('0x36')]=_[_0xbe7d('0x35')](_0x19aa18[_0xbe7d('0x31')],qs[_0xbe7d('0x37')](_0x26406b[_0xbe7d('0x32')][_0xbe7d('0x37')]));_0x30e483[_0xbe7d('0x36')]=_0x30e483['attributes'][_0xbe7d('0x38')]?_0x30e483[_0xbe7d('0x36')]:_0x19aa18['model'];if(_0x26406b[_0xbe7d('0x32')][_0xbe7d('0x41')]){_0x30e483[_0xbe7d('0x42')]=[{'all':!![]}];}_0x30e483=_['merge']({},_0x30e483,_0x26406b[_0xbe7d('0x40')]);return db[_0xbe7d('0x2d')][_0xbe7d('0x47')](_0x30e483)[_0xbe7d('0x27')](handleEntityNotFound(_0x58582b,null))[_0xbe7d('0x27')](respondWithResult(_0x58582b,null))[_0xbe7d('0x48')](handleError(_0x58582b,null));};exports[_0xbe7d('0x49')]=function(_0xbdfeea,_0x4e8427){return db[_0xbe7d('0x2d')][_0xbe7d('0x49')](_0xbdfeea['body'],{})[_0xbe7d('0x27')](function(_0x42181e){var _0x4f5c66=_0xbdfeea[_0xbe7d('0x4a')][_0xbe7d('0x24')]({'plain':!![]});if(!_0x4f5c66)throw new Error(_0xbe7d('0x4b'));if(_0x4f5c66[_0xbe7d('0x4c')]===_0xbe7d('0x4a')){var _0x292be2=_0x42181e[_0xbe7d('0x24')]({'plain':!![]});var _0x3ce120=_0xbe7d('0x25');return db[_0xbe7d('0x4d')][_0xbe7d('0x47')]({'where':{'name':_0x3ce120,'userProfileId':_0x4f5c66[_0xbe7d('0x4e')]},'raw':!![]})[_0xbe7d('0x27')](function(_0x1a3374){if(_0x1a3374&&_0x1a3374['autoAssociation']===0x0){return db[_0xbe7d('0x26')][_0xbe7d('0x49')]({'name':_0x292be2[_0xbe7d('0x2a')],'resourceId':_0x292be2['id'],'type':_0x1a3374[_0xbe7d('0x2a')],'sectionId':_0x1a3374['id']},{})[_0xbe7d('0x27')](function(){return _0x42181e;});}else{return _0x42181e;}})[_0xbe7d('0x48')](function(_0x29e121){logger['error'](_0xbe7d('0x4f'),_0x29e121);throw _0x29e121;});}return _0x42181e;})[_0xbe7d('0x27')](respondWithResult(_0x4e8427,0xc9))['catch'](handleError(_0x4e8427,null));};exports['update']=function(_0x39c6a4,_0x33ad59){if(_0x39c6a4['body']['id']){delete _0x39c6a4[_0xbe7d('0x50')]['id'];}return db['Disposition'][_0xbe7d('0x47')]({'where':{'id':_0x39c6a4[_0xbe7d('0x46')]['id']}})['then'](handleEntityNotFound(_0x33ad59,null))['then'](saveUpdates(_0x39c6a4[_0xbe7d('0x50')],null))[_0xbe7d('0x27')](respondWithResult(_0x33ad59,null))[_0xbe7d('0x48')](handleError(_0x33ad59,null));};exports[_0xbe7d('0x23')]=function(_0x2939f9,_0x48b8a5){return db[_0xbe7d('0x2d')][_0xbe7d('0x47')]({'where':{'id':_0x2939f9[_0xbe7d('0x46')]['id']}})[_0xbe7d('0x27')](handleEntityNotFound(_0x48b8a5,null))['then'](removeEntity(_0x48b8a5,null))[_0xbe7d('0x48')](handleError(_0x48b8a5,null));};
\ No newline at end of file
index 8967b95..fa9fa38 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa5b8=['bluebird','request-promise','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','util','api','moment'];(function(_0xd1c39b,_0x16f0c6){var _0x58f5bc=function(_0x412cf3){while(--_0x412cf3){_0xd1c39b['push'](_0xd1c39b['shift']());}};_0x58f5bc(++_0x16f0c6);}(_0xa5b8,0x173));var _0x8a5b=function(_0x40c032,_0x5d2002){_0x40c032=_0x40c032-0x0;var _0x31fa41=_0xa5b8[_0x40c032];return _0x31fa41;};'use strict';var _=require('lodash');var util=require(_0x8a5b('0x0'));var logger=require('../../config/logger')(_0x8a5b('0x1'));var moment=require(_0x8a5b('0x2'));var BPromise=require(_0x8a5b('0x3'));var rp=require(_0x8a5b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a5b('0x5'));var config=require(_0x8a5b('0x6'));var attributes=require(_0x8a5b('0x7'));module[_0x8a5b('0x8')]=function(_0x1bab69,_0x96ac77){return _0x1bab69['define'](_0x8a5b('0x9'),attributes,{'tableName':_0x8a5b('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8a5b('0xb'),'fields':[_0x8a5b('0xc'),_0x8a5b('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0x8a5b('0xc'),'ChatWebsiteId']},{'unique':!![],'name':_0x8a5b('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x8a5b('0xf'),'fields':[_0x8a5b('0xc'),_0x8a5b('0x10')]},{'unique':!![],'name':_0x8a5b('0x11'),'fields':[_0x8a5b('0xc'),_0x8a5b('0x12')]},{'unique':!![],'name':'name_openchannel','fields':[_0x8a5b('0xc'),_0x8a5b('0x13')]},{'unique':!![],'name':_0x8a5b('0x14'),'fields':[_0x8a5b('0xc'),_0x8a5b('0x15')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xd5dc=['name_fax','FaxAccountId','OpenchannelAccountId','WhatsappAccountId','lodash','util','api','moment','bluebird','request-promise','rimraf','./disposition.attributes','exports','define','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms'];(function(_0x49fc9f,_0x2d91fe){var _0x25f36f=function(_0x4d48fd){while(--_0x4d48fd){_0x49fc9f['push'](_0x49fc9f['shift']());}};_0x25f36f(++_0x2d91fe);}(_0xd5dc,0x12f));var _0xcd5d=function(_0x33d8e4,_0x2ffb48){_0x33d8e4=_0x33d8e4-0x0;var _0x55d1f0=_0xd5dc[_0x33d8e4];return _0x55d1f0;};'use strict';var _=require(_0xcd5d('0x0'));var util=require(_0xcd5d('0x1'));var logger=require('../../config/logger')(_0xcd5d('0x2'));var moment=require(_0xcd5d('0x3'));var BPromise=require(_0xcd5d('0x4'));var rp=require(_0xcd5d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd5d('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd5d('0x7'));module[_0xcd5d('0x8')]=function(_0xd9098c,_0x435c35){return _0xd9098c[_0xcd5d('0x9')]('Disposition',attributes,{'tableName':_0xcd5d('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xcd5d('0xb'),'fields':[_0xcd5d('0xc'),_0xcd5d('0xd')]},{'unique':!![],'name':_0xcd5d('0xe'),'fields':[_0xcd5d('0xc'),_0xcd5d('0xf')]},{'unique':!![],'name':_0xcd5d('0x10'),'fields':[_0xcd5d('0xc'),_0xcd5d('0x11')]},{'unique':!![],'name':_0xcd5d('0x12'),'fields':[_0xcd5d('0xc'),'SmsAccountId']},{'unique':!![],'name':_0xcd5d('0x13'),'fields':[_0xcd5d('0xc'),_0xcd5d('0x14')]},{'unique':!![],'name':'name_openchannel','fields':[_0xcd5d('0xc'),_0xcd5d('0x15')]},{'unique':!![],'name':'name_whatsapp','fields':[_0xcd5d('0xc'),_0xcd5d('0x16')]}],'timestamps':!![]});};
\ No newline at end of file
index 9ef924a..65a184a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xa98ee7,_0x16f22d){var _0x49e5d3=function(_0x32904f){while(--_0x32904f){_0xa98ee7['push'](_0xa98ee7['shift']());}};_0x49e5d3(++_0x16f22d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
+var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x14e02b,_0x13c7bd){var _0x4d9594=function(_0x22c180){while(--_0x22c180){_0x14e02b['push'](_0x14e02b['shift']());}};_0x4d9594(++_0x13c7bd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}
\ No newline at end of file
index 7be2423..93ad800 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc9cb=['./disposition.controller','get','isAuthenticated','/:id','show','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0xc9cb,0x152));var _0xbc9c=function(_0x179dc2,_0x701ce7){_0x179dc2=_0x179dc2-0x0;var _0x460e93=_0xc9cb[_0x179dc2];return _0x460e93;};'use strict';var multer=require(_0xbc9c('0x0'));var util=require(_0xbc9c('0x1'));var path=require('path');var timeout=require(_0xbc9c('0x2'));var express=require(_0xbc9c('0x3'));var router=express[_0xbc9c('0x4')]();var fs_extra=require(_0xbc9c('0x5'));var auth=require(_0xbc9c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc9c('0x7'));router[_0xbc9c('0x8')]('/',auth[_0xbc9c('0x9')](),controller['index']);router['get'](_0xbc9c('0xa'),auth['isAuthenticated'](),controller[_0xbc9c('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbc9c('0xa'),auth[_0xbc9c('0x9')](),controller[_0xbc9c('0xc')]);router[_0xbc9c('0xd')](_0xbc9c('0xa'),auth[_0xbc9c('0x9')](),controller[_0xbc9c('0xe')]);module['exports']=router;
\ No newline at end of file
+var _0x971e=['destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update'];(function(_0x169302,_0x194227){var _0x139a23=function(_0x3e766a){while(--_0x3e766a){_0x169302['push'](_0x169302['shift']());}};_0x139a23(++_0x194227);}(_0x971e,0x80));var _0xe971=function(_0x21d535,_0x9d3bf4){_0x21d535=_0x21d535-0x0;var _0x1194c2=_0x971e[_0x21d535];return _0x1194c2;};'use strict';var multer=require('multer');var util=require(_0xe971('0x0'));var path=require(_0xe971('0x1'));var timeout=require(_0xe971('0x2'));var express=require('express');var router=express[_0xe971('0x3')]();var fs_extra=require(_0xe971('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe971('0x5'));var config=require(_0xe971('0x6'));var controller=require('./disposition.controller');router[_0xe971('0x7')]('/',auth[_0xe971('0x8')](),controller[_0xe971('0x9')]);router['get'](_0xe971('0xa'),auth[_0xe971('0x8')](),controller[_0xe971('0xb')]);router[_0xe971('0xc')]('/',auth[_0xe971('0x8')](),controller[_0xe971('0xd')]);router[_0xe971('0xe')](_0xe971('0xa'),auth[_0xe971('0x8')](),controller[_0xe971('0xf')]);router['delete'](_0xe971('0xa'),auth[_0xe971('0x8')](),controller[_0xe971('0x10')]);module[_0xe971('0x11')]=router;
\ No newline at end of file
index e898e80..8d903b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0309=['7200','12000','2400','9600','14400','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','SIP','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800'];(function(_0x2a8695,_0x4c57fc){var _0xf80575=function(_0x3219b8){while(--_0x3219b8){_0x2a8695['push'](_0x2a8695['shift']());}};_0xf80575(++_0x4c57fc);}(_0x0309,0x165));var _0x9030=function(_0x381777,_0xb9c54e){_0x381777=_0x381777-0x0;var _0x32cbfd=_0x0309[_0x381777];return _0x32cbfd;};'use strict';var Sequelize=require(_0x9030('0x0'));module['exports']={'name':{'type':Sequelize[_0x9030('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x9030('0x2')](_0x9030('0x3'),'no'),'defaultValue':_0x9030('0x3')},'headerinfo':{'type':Sequelize[_0x9030('0x1')],'defaultValue':_0x9030('0x4')},'localstationid':{'type':Sequelize[_0x9030('0x1')],'unique':_0x9030('0x5')},'minrate':{'type':Sequelize['ENUM']('2400',_0x9030('0x6'),_0x9030('0x7'),'9600',_0x9030('0x8'),'14400'),'defaultValue':_0x9030('0x6')},'maxrate':{'type':Sequelize[_0x9030('0x2')](_0x9030('0x9'),'4800',_0x9030('0x7'),_0x9030('0xa'),_0x9030('0x8'),'14400'),'defaultValue':_0x9030('0xb')},'modem':{'type':Sequelize[_0x9030('0x1')],'defaultValue':_0x9030('0xc')},'gateway':{'type':Sequelize[_0x9030('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9030('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9030('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9030('0x2')]('SIP',_0x9030('0xe'),_0x9030('0xf'),_0x9030('0x10')),'defaultValue':_0x9030('0x11')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9030('0x12')],'defaultValue':function(){return _0x9030('0x13');}},'notificationSound':{'type':Sequelize[_0x9030('0x14')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9030('0x14')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9030('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9030('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9030('0x14')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9030('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9030('0x14')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9030('0xd')],'allowNull':!![],'defaultValue':null,'comment':_0x9030('0x15')},'mandatoryDisposition':{'type':Sequelize[_0x9030('0x14')],'defaultValue':![],'comment':_0x9030('0x16'),'set':function(_0x319db3){if(!_0x319db3)this[_0x9030('0x17')](_0x9030('0x18'),null);this[_0x9030('0x17')](_0x9030('0x19'),_0x319db3);}}};
\ No newline at end of file
+var _0xc949=['mandatoryDisposition','sequelize','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','7200','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0xc949,0x181));var _0x9c94=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xc949[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x9c94('0x0'));module['exports']={'name':{'type':Sequelize[_0x9c94('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9c94('0x1')]},'ecm':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':_0x9c94('0x4')},'localstationid':{'type':Sequelize['STRING'],'unique':_0x9c94('0x5')},'minrate':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x6'),_0x9c94('0x7'),'7200',_0x9c94('0x8'),_0x9c94('0x9'),_0x9c94('0xa')),'defaultValue':_0x9c94('0x7')},'maxrate':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0x6'),_0x9c94('0x7'),_0x9c94('0xb'),_0x9c94('0x8'),_0x9c94('0x9'),'14400'),'defaultValue':_0x9c94('0xa')},'modem':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':_0x9c94('0xc')},'gateway':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x9c94('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x9c94('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x9c94('0x2')](_0x9c94('0xe'),_0x9c94('0xf'),_0x9c94('0x10'),_0x9c94('0x11')),'defaultValue':_0x9c94('0xe')},'key':{'type':Sequelize[_0x9c94('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9c94('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x9c94('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9c94('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9c94('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9c94('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9c94('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9c94('0x13')],'defaultValue':![],'comment':_0x9c94('0x14'),'set':function(_0x4d9266){if(!_0x4d9266)this[_0x9c94('0x15')](_0x9c94('0x16'),null);this[_0x9c94('0x15')](_0x9c94('0x17'),_0x4d9266);}}};
\ No newline at end of file
index eb212bc..98eb1d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x462c=['push','gateway','maxrate','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','bulkCreate','updateAccountApplications','tech','key','createdAt','ListId','getMessages','FaxMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','path','from','format','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FaxAccount,\x20%s,\x20%s','catch','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','sendStatus','name','send','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','Disposition','findOne','removeDispositions','ids','addAnswer','FaxAccountId','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','stack','context','from-voip-provider','exten','localstationid','Fax\x20Extension','Answer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x462c,0x1ad));var _0xc462=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x462c[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc462('0x0'));var zipdir=require(_0xc462('0x1'));var jsonpatch=require(_0xc462('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc462('0x3'));var Mustache=require(_0xc462('0x4'));var util=require(_0xc462('0x5'));var path=require('path');var sox=require(_0xc462('0x6'));var csv=require(_0xc462('0x7'));var ejs=require(_0xc462('0x8'));var fs=require('fs');var fs_extra=require(_0xc462('0x9'));var _=require(_0xc462('0xa'));var squel=require('squel');var crypto=require(_0xc462('0xb'));var jsforce=require(_0xc462('0xc'));var deskjs=require(_0xc462('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc462('0xe'));var Papa=require(_0xc462('0xf'));var Redis=require('ioredis');var authService=require(_0xc462('0x10'));var qs=require(_0xc462('0x11'));var as=require(_0xc462('0x12'));var hardwareService=require(_0xc462('0x13'));var logger=require('../../config/logger')(_0xc462('0x14'));var utils=require(_0xc462('0x15'));var config=require(_0xc462('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc462('0x17'))['db'];config[_0xc462('0x18')]=_[_0xc462('0x19')](config[_0xc462('0x18')],{'host':_0xc462('0x1a'),'port':0x18eb});var socket=require(_0xc462('0x1b'))(new Redis(config[_0xc462('0x18')]));require(_0xc462('0x1c'))[_0xc462('0x1d')](socket);var jayson=require(_0xc462('0x1e'));var client=jayson[_0xc462('0x1f')][_0xc462('0x20')]({'port':0x232c});var client9002=jayson[_0xc462('0x1f')][_0xc462('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1277f8,_0x1d1cb4,_0x56edda,_0x4a6f19){return new BPromise(function(_0x2f1469,_0x265b2f){var _0xb3d33d=_0x4a6f19||client;return _0xb3d33d[_0xc462('0x21')](_0x1277f8,_0x56edda)[_0xc462('0x22')](function(_0x33854c){logger[_0xc462('0x23')]('FaxAccount,\x20%s,\x20%s',_0x1d1cb4,_0xc462('0x24'));logger[_0xc462('0x25')](_0xc462('0x26'),_0x1d1cb4,_0xc462('0x24'),JSON[_0xc462('0x27')](_0x33854c));if(_0x33854c[_0xc462('0x28')]){if(_0x33854c[_0xc462('0x28')][_0xc462('0x29')]===0x1f4){logger[_0xc462('0x28')]('FaxAccount,\x20%s,\x20%s',_0x1d1cb4,_0x33854c[_0xc462('0x28')][_0xc462('0x2a')]);return _0x265b2f(_0x33854c[_0xc462('0x28')][_0xc462('0x2a')]);}logger['error'](_0xc462('0x2b'),_0x1d1cb4,_0x33854c['error'][_0xc462('0x2a')]);return _0x2f1469(_0x33854c['error'][_0xc462('0x2a')]);}else{logger[_0xc462('0x23')](_0xc462('0x2b'),_0x1d1cb4,_0xc462('0x24'));_0x2f1469(_0x33854c['result'][_0xc462('0x2a')]);}})[_0xc462('0x2c')](function(_0x2a63cd){logger[_0xc462('0x28')](_0xc462('0x2b'),_0x1d1cb4,_0x2a63cd);_0x265b2f(_0x2a63cd);});});}function respondWithStatusCode(_0x29ef99,_0x48a97b){_0x48a97b=_0x48a97b||0xcc;return function(_0x309559){if(_0x309559){return _0x29ef99['sendStatus'](_0x48a97b);}return _0x29ef99[_0xc462('0x2d')](_0x48a97b)[_0xc462('0x2e')]();};}function respondWithResult(_0x5d8500,_0x5cffe1){_0x5cffe1=_0x5cffe1||0xc8;return function(_0x9e39d2){if(_0x9e39d2){return _0x5d8500[_0xc462('0x2d')](_0x5cffe1)[_0xc462('0x2f')](_0x9e39d2);}};}function respondWithFilteredResult(_0x5be971,_0x2956d8){return function(_0x430aef){if(_0x430aef){var _0x106e45=typeof _0x2956d8[_0xc462('0x30')]===_0xc462('0x31')&&typeof _0x2956d8[_0xc462('0x32')]==='undefined';var _0x187fcc=_0x430aef[_0xc462('0x33')];var _0x35c5f8=_0x106e45?0x0:_0x2956d8[_0xc462('0x30')];var _0x4075fd=_0x106e45?_0x430aef[_0xc462('0x33')]:_0x2956d8['offset']+_0x2956d8['limit'];var _0x3c6282;if(_0x4075fd>=_0x187fcc){_0x4075fd=_0x187fcc;_0x3c6282=0xc8;}else{_0x3c6282=0xce;}_0x5be971[_0xc462('0x2d')](_0x3c6282);return _0x5be971[_0xc462('0x34')]('Content-Range',_0x35c5f8+'-'+_0x4075fd+'/'+_0x187fcc)[_0xc462('0x2f')](_0x430aef);}return null;};}function patchUpdates(_0x455cd9){return function(_0x33e433){try{jsonpatch[_0xc462('0x35')](_0x33e433,_0x455cd9,!![]);}catch(_0x12149b){return BPromise[_0xc462('0x36')](_0x12149b);}return _0x33e433['save']();};}function saveUpdates(_0x455cea,_0x2f5f6c){return function(_0x12595d){if(_0x12595d){return _0x12595d[_0xc462('0x37')](_0x455cea)[_0xc462('0x22')](function(_0x103f7e){return _0x103f7e;});}return null;};}function removeEntity(_0x16bb57,_0x3737af){return function(_0x31752b){if(_0x31752b){return _0x31752b[_0xc462('0x38')]()[_0xc462('0x22')](function(){var _0x3d3ec9=_0x31752b[_0xc462('0x39')]({'plain':!![]});var _0x2eb7e0='FaxAccounts';return db['UserProfileResource'][_0xc462('0x38')]({'where':{'type':_0x2eb7e0,'resourceId':_0x3d3ec9['id']}})[_0xc462('0x22')](function(){return _0x31752b;});})[_0xc462('0x22')](function(){_0x16bb57[_0xc462('0x2d')](0xcc)[_0xc462('0x2e')]();});}};}function handleEntityNotFound(_0x5c8406,_0x42dad3){return function(_0x2d000a){if(!_0x2d000a){_0x5c8406[_0xc462('0x3a')](0x194);}return _0x2d000a;};}function handleError(_0x1ff6ee,_0x386bec){_0x386bec=_0x386bec||0x1f4;return function(_0x75e60e){logger['error'](_0x75e60e['stack']);if(_0x75e60e[_0xc462('0x3b')]){delete _0x75e60e[_0xc462('0x3b')];}_0x1ff6ee[_0xc462('0x2d')](_0x386bec)[_0xc462('0x3c')](_0x75e60e);};}exports[_0xc462('0x3d')]=function(_0x226f02,_0x2b2271){var _0x14ce19={'include':[{'model':db[_0xc462('0x3e')],'as':_0xc462('0x3f')}]},_0x1bd7df={},_0x5535d0={'count':0x0,'rows':[]};var _0x26717e=_['map'](db[_0xc462('0x40')][_0xc462('0x41')],function(_0x521b0a){return{'name':_0x521b0a[_0xc462('0x42')],'type':_0x521b0a[_0xc462('0x43')]['key']};});_0x1bd7df[_0xc462('0x44')]=_[_0xc462('0x45')](_0x26717e,_0xc462('0x3b'));_0x1bd7df[_0xc462('0x46')]=_['keys'](_0x226f02[_0xc462('0x46')]);_0x1bd7df[_0xc462('0x47')]=_[_0xc462('0x48')](_0x1bd7df['model'],_0x1bd7df[_0xc462('0x46')]);_0x14ce19[_0xc462('0x49')]=_[_0xc462('0x48')](_0x1bd7df[_0xc462('0x44')],qs[_0xc462('0x4a')](_0x226f02[_0xc462('0x46')][_0xc462('0x4a')]));_0x14ce19[_0xc462('0x49')]=_0x14ce19[_0xc462('0x49')]['length']?_0x14ce19[_0xc462('0x49')]:_0x1bd7df[_0xc462('0x44')];if(!_0x226f02[_0xc462('0x46')][_0xc462('0x4b')](_0xc462('0x4c'))){_0x14ce19[_0xc462('0x32')]=qs[_0xc462('0x32')](_0x226f02[_0xc462('0x46')]['limit']);_0x14ce19[_0xc462('0x30')]=qs[_0xc462('0x30')](_0x226f02[_0xc462('0x46')][_0xc462('0x30')]);}_0x14ce19[_0xc462('0x4d')]=qs[_0xc462('0x4e')](_0x226f02[_0xc462('0x46')][_0xc462('0x4e')]);_0x14ce19[_0xc462('0x4f')]=qs[_0xc462('0x47')](_[_0xc462('0x50')](_0x226f02[_0xc462('0x46')],_0x1bd7df[_0xc462('0x47')]),_0x26717e);if(_0x226f02[_0xc462('0x46')][_0xc462('0x51')]){_0x14ce19[_0xc462('0x4f')]=_[_0xc462('0x52')](_0x14ce19['where'],{'$or':_[_0xc462('0x45')](_0x26717e,function(_0x2ae1f9){if(_0x2ae1f9['type']!==_0xc462('0x53')){var _0x11cef3={};_0x11cef3[_0x2ae1f9[_0xc462('0x3b')]]={'$like':'%'+_0x226f02[_0xc462('0x46')][_0xc462('0x51')]+'%'};return _0x11cef3;}})});}_0x14ce19=_[_0xc462('0x52')]({},_0x14ce19,_0x226f02[_0xc462('0x54')]);var _0x227236={'where':_0x14ce19['where']};return db[_0xc462('0x40')][_0xc462('0x33')](_0x227236)[_0xc462('0x22')](function(_0x442082){_0x5535d0[_0xc462('0x33')]=_0x442082;if(_0x226f02[_0xc462('0x46')][_0xc462('0x55')]){_0x14ce19[_0xc462('0x56')]=[{'all':!![]}];}return db[_0xc462('0x40')][_0xc462('0x57')](_0x14ce19);})[_0xc462('0x22')](function(_0x5708a){_0x5535d0[_0xc462('0x58')]=_0x5708a;return _0x5535d0;})['then'](respondWithFilteredResult(_0x2b2271,_0x14ce19))[_0xc462('0x2c')](handleError(_0x2b2271,null));};exports[_0xc462('0x59')]=function(_0x4f912a,_0x65cc79){var _0xd180d8={'raw':![],'where':{'id':_0x4f912a[_0xc462('0x5a')]['id']},'include':[{'model':db[_0xc462('0x3e')],'as':'mandatoryDispositionPause'}]},_0x4e299e={};_0x4e299e[_0xc462('0x44')]=_[_0xc462('0x5b')](db[_0xc462('0x40')]['rawAttributes']);_0x4e299e[_0xc462('0x46')]=_['keys'](_0x4f912a['query']);_0x4e299e[_0xc462('0x47')]=_[_0xc462('0x48')](_0x4e299e[_0xc462('0x44')],_0x4e299e[_0xc462('0x46')]);_0xd180d8[_0xc462('0x49')]=_['intersection'](_0x4e299e['model'],qs[_0xc462('0x4a')](_0x4f912a[_0xc462('0x46')][_0xc462('0x4a')]));_0xd180d8[_0xc462('0x49')]=_0xd180d8[_0xc462('0x49')][_0xc462('0x5c')]?_0xd180d8[_0xc462('0x49')]:_0x4e299e[_0xc462('0x44')];if(_0x4f912a[_0xc462('0x46')]['includeAll']){_0xd180d8[_0xc462('0x56')]=[{'all':!![]}];}_0xd180d8=_[_0xc462('0x52')]({},_0xd180d8,_0x4f912a[_0xc462('0x54')]);return db[_0xc462('0x40')][_0xc462('0x5d')](_0xd180d8)[_0xc462('0x22')](handleEntityNotFound(_0x65cc79,null))[_0xc462('0x22')](respondWithResult(_0x65cc79,null))[_0xc462('0x2c')](handleError(_0x65cc79,null));};exports[_0xc462('0x5e')]=function(_0x3c99c5,_0x299828){return db['FaxAccount']['create'](_0x3c99c5[_0xc462('0x5f')],{})[_0xc462('0x22')](function(_0xa24af1){var _0x747ba7=_0x3c99c5[_0xc462('0x60')][_0xc462('0x39')]({'plain':!![]});if(!_0x747ba7)throw new Error(_0xc462('0x61'));if(_0x747ba7[_0xc462('0x62')]==='user'){var _0x5b6b1e=_0xa24af1['get']({'plain':!![]});var _0x28244f='FaxAccounts';return db[_0xc462('0x63')]['find']({'where':{'name':_0x28244f,'userProfileId':_0x747ba7[_0xc462('0x64')]},'raw':!![]})[_0xc462('0x22')](function(_0x2d657c){if(_0x2d657c&&_0x2d657c[_0xc462('0x65')]===0x0){return db[_0xc462('0x66')][_0xc462('0x5e')]({'name':_0x5b6b1e[_0xc462('0x3b')],'resourceId':_0x5b6b1e['id'],'type':_0x2d657c[_0xc462('0x3b')],'sectionId':_0x2d657c['id']},{})[_0xc462('0x22')](function(){return _0xa24af1;});}else{return _0xa24af1;}})['catch'](function(_0x44d350){logger[_0xc462('0x28')](_0xc462('0x67'),_0x44d350);throw _0x44d350;});}return _0xa24af1;})['then'](respondWithResult(_0x299828,0xc9))[_0xc462('0x2c')](handleError(_0x299828,null));};exports['update']=function(_0x54535e,_0x5c1cad){if(_0x54535e['body']['id']){delete _0x54535e[_0xc462('0x5f')]['id'];}return db['FaxAccount'][_0xc462('0x5d')]({'where':{'id':_0x54535e['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc462('0x22')](handleEntityNotFound(_0x5c1cad,null))[_0xc462('0x22')](saveUpdates(_0x54535e[_0xc462('0x5f')],null))[_0xc462('0x22')](respondWithResult(_0x5c1cad,null))[_0xc462('0x2c')](handleError(_0x5c1cad,null));};exports[_0xc462('0x38')]=function(_0x4cb20f,_0x523a3a){return db[_0xc462('0x40')]['find']({'where':{'id':_0x4cb20f['params']['id']}})['then'](handleEntityNotFound(_0x523a3a,null))[_0xc462('0x22')](removeEntity(_0x523a3a,null))[_0xc462('0x2c')](handleError(_0x523a3a,null));};exports[_0xc462('0x68')]=function(_0x2827d1,_0x34b123){return db[_0xc462('0x40')][_0xc462('0x68')]()[_0xc462('0x22')](respondWithResult(_0x34b123,null))[_0xc462('0x2c')](handleError(_0x34b123,null));};exports[_0xc462('0x69')]=function(_0xe9ab73,_0x524512,_0x1e83c4){if(_0xe9ab73[_0xc462('0x5f')]['id']){delete _0xe9ab73[_0xc462('0x5f')]['id'];}return db[_0xc462('0x40')][_0xc462('0x5d')]({'where':{'id':_0xe9ab73[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0x524512,null))[_0xc462('0x22')](function(_0x134628){if(_0x134628){_0xe9ab73[_0xc462('0x5f')]['FaxAccountId']=_0x134628['id'];return db[_0xc462('0x6a')][_0xc462('0x5e')](_0xe9ab73[_0xc462('0x5f')]);}})[_0xc462('0x22')](respondWithResult(_0x524512,null))[_0xc462('0x2c')](handleError(_0x524512,null));};exports['getDispositions']=function(_0x6ffd35,_0x45a733,_0x19ee96){var _0x398b21={'raw':![],'where':{}};var _0x44027b={};var _0x31ed58={'count':0x0,'rows':[]};return db[_0xc462('0x40')][_0xc462('0x6b')]({'where':{'id':_0x6ffd35[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0x45a733,null))[_0xc462('0x22')](function(_0x422d6f){if(_0x422d6f){_0x44027b[_0xc462('0x44')]=_[_0xc462('0x5b')](db['Disposition'][_0xc462('0x41')]);_0x44027b['query']=_['keys'](_0x6ffd35[_0xc462('0x46')]);_0x44027b[_0xc462('0x47')]=_[_0xc462('0x48')](_0x44027b[_0xc462('0x44')],_0x44027b[_0xc462('0x46')]);_0x398b21[_0xc462('0x49')]=_[_0xc462('0x48')](_0x44027b['model'],qs[_0xc462('0x4a')](_0x6ffd35[_0xc462('0x46')][_0xc462('0x4a')]));_0x398b21[_0xc462('0x49')]=_0x398b21[_0xc462('0x49')]['length']?_0x398b21[_0xc462('0x49')]:_0x44027b[_0xc462('0x44')];if(!_0x6ffd35[_0xc462('0x46')]['hasOwnProperty'](_0xc462('0x4c'))){_0x398b21[_0xc462('0x32')]=qs[_0xc462('0x32')](_0x6ffd35['query'][_0xc462('0x32')]);_0x398b21[_0xc462('0x30')]=qs[_0xc462('0x30')](_0x6ffd35[_0xc462('0x46')][_0xc462('0x30')]);}_0x398b21[_0xc462('0x4d')]=qs['sort'](_0x6ffd35[_0xc462('0x46')][_0xc462('0x4e')]);_0x398b21[_0xc462('0x4f')]=qs[_0xc462('0x47')](_[_0xc462('0x50')](_0x6ffd35['query'],_0x44027b['filters']));_0x398b21[_0xc462('0x4f')]['FaxAccountId']=_0x422d6f['id'];if(_0x6ffd35['query'][_0xc462('0x51')]){_0x398b21[_0xc462('0x4f')]=_[_0xc462('0x52')](_0x398b21[_0xc462('0x4f')],{'$or':_['map'](_0x398b21[_0xc462('0x49')],function(_0x19e756){var _0x1225f8={};_0x1225f8[_0x19e756]={'$like':'%'+_0x6ffd35[_0xc462('0x46')][_0xc462('0x51')]+'%'};return _0x1225f8;})});}_0x398b21=_[_0xc462('0x52')]({},_0x398b21,_0x6ffd35[_0xc462('0x54')]);return db[_0xc462('0x6a')][_0xc462('0x33')]({'where':_0x398b21[_0xc462('0x4f')]})['then'](function(_0x4843b9){_0x31ed58[_0xc462('0x33')]=_0x4843b9;if(_0x6ffd35[_0xc462('0x46')][_0xc462('0x55')]){_0x398b21[_0xc462('0x56')]=[{'all':!![]}];}return db[_0xc462('0x6a')][_0xc462('0x57')](_0x398b21);})[_0xc462('0x22')](function(_0x32b3bc){_0x31ed58[_0xc462('0x58')]=_0x32b3bc;return _0x31ed58;});}})['then'](respondWithFilteredResult(_0x45a733,_0x398b21))[_0xc462('0x2c')](handleError(_0x45a733,null));};exports[_0xc462('0x6c')]=function(_0x477a04,_0x2b1553,_0x568eea){return db[_0xc462('0x40')][_0xc462('0x5d')]({'where':{'id':_0x477a04[_0xc462('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2b1553,null))[_0xc462('0x22')](function(_0x2d3f11){if(_0x2d3f11){return _0x2d3f11[_0xc462('0x6c')](_0x477a04[_0xc462('0x46')][_0xc462('0x6d')]);}})[_0xc462('0x22')](respondWithStatusCode(_0x2b1553,null))[_0xc462('0x2c')](handleError(_0x2b1553,null));};exports[_0xc462('0x6e')]=function(_0xbafebe,_0x210a58,_0x3644a0){if(_0xbafebe[_0xc462('0x5f')]['id']){delete _0xbafebe[_0xc462('0x5f')]['id'];}return db[_0xc462('0x40')]['find']({'where':{'id':_0xbafebe[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0x210a58,null))[_0xc462('0x22')](function(_0x1ee1a4){if(_0x1ee1a4){_0xbafebe[_0xc462('0x5f')][_0xc462('0x6f')]=_0x1ee1a4['id'];return db['CannedAnswer'][_0xc462('0x5e')](_0xbafebe[_0xc462('0x5f')]);}})[_0xc462('0x22')](respondWithResult(_0x210a58,null))[_0xc462('0x2c')](handleError(_0x210a58,null));};exports[_0xc462('0x70')]=function(_0x100e3b,_0x159f46,_0x379548){var _0x5948f2={'raw':![],'where':{}};var _0x2bffd5={};var _0x1b3348={'count':0x0,'rows':[]};return db[_0xc462('0x40')][_0xc462('0x6b')]({'where':{'id':_0x100e3b[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0x159f46,null))[_0xc462('0x22')](function(_0x3dd5e0){if(_0x3dd5e0){_0x2bffd5[_0xc462('0x44')]=_[_0xc462('0x5b')](db[_0xc462('0x71')][_0xc462('0x41')]);_0x2bffd5[_0xc462('0x46')]=_[_0xc462('0x5b')](_0x100e3b[_0xc462('0x46')]);_0x2bffd5[_0xc462('0x47')]=_['intersection'](_0x2bffd5['model'],_0x2bffd5[_0xc462('0x46')]);_0x5948f2[_0xc462('0x49')]=_[_0xc462('0x48')](_0x2bffd5[_0xc462('0x44')],qs[_0xc462('0x4a')](_0x100e3b[_0xc462('0x46')][_0xc462('0x4a')]));_0x5948f2[_0xc462('0x49')]=_0x5948f2[_0xc462('0x49')]['length']?_0x5948f2[_0xc462('0x49')]:_0x2bffd5['model'];if(!_0x100e3b['query'][_0xc462('0x4b')](_0xc462('0x4c'))){_0x5948f2['limit']=qs[_0xc462('0x32')](_0x100e3b[_0xc462('0x46')][_0xc462('0x32')]);_0x5948f2[_0xc462('0x30')]=qs[_0xc462('0x30')](_0x100e3b[_0xc462('0x46')][_0xc462('0x30')]);}_0x5948f2[_0xc462('0x4d')]=qs[_0xc462('0x4e')](_0x100e3b['query'][_0xc462('0x4e')]);_0x5948f2[_0xc462('0x4f')]=qs['filters'](_['pick'](_0x100e3b[_0xc462('0x46')],_0x2bffd5['filters']));_0x5948f2['where'][_0xc462('0x6f')]=_0x3dd5e0['id'];if(_0x100e3b[_0xc462('0x46')][_0xc462('0x51')]){_0x5948f2[_0xc462('0x4f')]=_['merge'](_0x5948f2['where'],{'$or':_[_0xc462('0x45')](_0x5948f2['attributes'],function(_0x1f260c){var _0x43ee3a={};_0x43ee3a[_0x1f260c]={'$like':'%'+_0x100e3b[_0xc462('0x46')]['filter']+'%'};return _0x43ee3a;})});}_0x5948f2=_['merge']({},_0x5948f2,_0x100e3b[_0xc462('0x54')]);return db[_0xc462('0x71')][_0xc462('0x33')]({'where':_0x5948f2[_0xc462('0x4f')]})['then'](function(_0x5f4f8e){_0x1b3348[_0xc462('0x33')]=_0x5f4f8e;if(_0x100e3b[_0xc462('0x46')][_0xc462('0x55')]){_0x5948f2[_0xc462('0x56')]=[{'all':!![]}];}return db[_0xc462('0x71')][_0xc462('0x57')](_0x5948f2);})['then'](function(_0x3cd4cb){_0x1b3348['rows']=_0x3cd4cb;return _0x1b3348;});}})[_0xc462('0x22')](respondWithFilteredResult(_0x159f46,_0x5948f2))[_0xc462('0x2c')](handleError(_0x159f46,null));};exports[_0xc462('0x72')]=function(_0x3f96f1,_0x197835,_0x4702bf){return db[_0xc462('0x40')][_0xc462('0x5d')]({'where':{'id':_0x3f96f1['params']['id']}})[_0xc462('0x22')](handleEntityNotFound(_0x197835,null))[_0xc462('0x22')](function(_0x1b7300){if(_0x1b7300){return _0x1b7300[_0xc462('0x72')](_0x3f96f1[_0xc462('0x46')][_0xc462('0x6d')]);}})[_0xc462('0x22')](respondWithStatusCode(_0x197835,null))[_0xc462('0x2c')](handleError(_0x197835,null));};exports[_0xc462('0x73')]=function(_0x3e4f5c,_0x246340,_0x495bbc){return db[_0xc462('0x74')]['find']({'where':{'id':_0x3e4f5c[_0xc462('0x5a')]['id']}})['then'](handleEntityNotFound(_0x246340,null))[_0xc462('0x22')](function(_0x1954fc){if(_0x1954fc){return _0x1954fc[_0xc462('0x73')](_0x3e4f5c[_0xc462('0x5f')][_0xc462('0x6d')],_[_0xc462('0x75')](_0x3e4f5c['body'],[_0xc462('0x6d'),'id'])||{});}})['then'](respondWithResult(_0x246340,null))[_0xc462('0x2c')](handleError(_0x246340,null));};exports['getInteractions']=function(_0x6156a7,_0x182c9a,_0x10d008){var _0x32b92e={'raw':![],'where':{}};var _0x39d029={};var _0x3a2193={'count':0x0,'rows':[]};return db[_0xc462('0x40')][_0xc462('0x6b')]({'where':{'id':_0x6156a7[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0x182c9a,null))[_0xc462('0x22')](function(_0x27e4c1){if(_0x27e4c1){_0x39d029[_0xc462('0x44')]=_[_0xc462('0x5b')](db['FaxInteraction'][_0xc462('0x41')]);_0x39d029['query']=_[_0xc462('0x5b')](_0x6156a7[_0xc462('0x46')]);_0x39d029[_0xc462('0x47')]=_[_0xc462('0x48')](_0x39d029['model'],_0x39d029['query']);_0x32b92e[_0xc462('0x49')]=_[_0xc462('0x48')](_0x39d029[_0xc462('0x44')],qs[_0xc462('0x4a')](_0x6156a7[_0xc462('0x46')][_0xc462('0x4a')]));_0x32b92e[_0xc462('0x49')]=_0x32b92e[_0xc462('0x49')][_0xc462('0x5c')]?_0x32b92e['attributes']:_0x39d029['model'];if(!_0x6156a7['query'][_0xc462('0x4b')](_0xc462('0x4c'))){_0x32b92e['limit']=qs[_0xc462('0x32')](_0x6156a7[_0xc462('0x46')][_0xc462('0x32')]);_0x32b92e['offset']=qs['offset'](_0x6156a7[_0xc462('0x46')][_0xc462('0x30')]);}_0x32b92e['order']=qs['sort'](_0x6156a7[_0xc462('0x46')][_0xc462('0x4e')]);_0x32b92e[_0xc462('0x4f')]=qs[_0xc462('0x47')](_['pick'](_0x6156a7[_0xc462('0x46')],_0x39d029['filters']));_0x32b92e[_0xc462('0x4f')][_0xc462('0x6f')]=_0x27e4c1['id'];if(_0x6156a7['query'][_0xc462('0x51')]){_0x32b92e[_0xc462('0x4f')]=_['merge'](_0x32b92e[_0xc462('0x4f')],{'$or':_['map'](_0x32b92e[_0xc462('0x49')],function(_0x33dfa3){var _0x3cb725={};_0x3cb725[_0x33dfa3]={'$like':'%'+_0x6156a7[_0xc462('0x46')][_0xc462('0x51')]+'%'};return _0x3cb725;})});}_0x32b92e=_[_0xc462('0x52')]({},_0x32b92e,_0x6156a7[_0xc462('0x54')]);return db['FaxInteraction']['count']({'where':_0x32b92e[_0xc462('0x4f')]})[_0xc462('0x22')](function(_0x187e12){_0x3a2193[_0xc462('0x33')]=_0x187e12;if(_0x6156a7['query'][_0xc462('0x55')]){_0x32b92e[_0xc462('0x56')]=[{'model':db[_0xc462('0x76')],'as':_0xc462('0x77'),'required':![]},{'model':db[_0xc462('0x78')],'as':'Owner','attributes':['name',_0xc462('0x79'),_0xc462('0x7a')],'required':![]},{'model':db[_0xc462('0x7b')],'as':_0xc462('0x7c'),'attributes':['id',_0xc462('0x3b'),_0xc462('0x7d')],'where':_0x6156a7[_0xc462('0x46')]['tag']?{'id':_0x6156a7['query'][_0xc462('0x7e')]}:undefined,'required':_0x6156a7[_0xc462('0x46')]['tag']?!![]:![]}];}return db[_0xc462('0x74')][_0xc462('0x57')](_0x32b92e);})['then'](function(_0x3e3ed7){_0x3a2193[_0xc462('0x58')]=_0x3e3ed7;return _0x3a2193;});}})[_0xc462('0x22')](respondWithFilteredResult(_0x182c9a,_0x32b92e))[_0xc462('0x2c')](handleError(_0x182c9a,null));};exports[_0xc462('0x7f')]=function(_0x2b3eb,_0x54ec4f){var _0x3aaed9=_0x2b3eb['params']['id'];var _0x3cc3d8=_0x2b3eb[_0xc462('0x5f')];var _0x3de70a=0xc8;var _0x3416b6=null;return db[_0xc462('0x80')][_0xc462('0x81')]({'isolationLevel':db[_0xc462('0x80')][_0xc462('0x82')][_0xc462('0x83')][_0xc462('0x84')]},function(_0x1c1269){return db[_0xc462('0x40')][_0xc462('0x6b')]({'where':{'id':_0x3aaed9},'transaction':_0x1c1269})[_0xc462('0x22')](function(_0x3e5fdb){if(_0x3e5fdb){return db[_0xc462('0x85')][_0xc462('0x38')]({'where':{'FaxAccountId':_0x3aaed9},'transaction':_0x1c1269})[_0xc462('0x22')](function(){var _0x3c40c2=_[_0xc462('0x45')](_0x3cc3d8,function(_0x2bcb20){_0x2bcb20[_0xc462('0x6f')]=_0x3aaed9;return _0x2bcb20;});return db[_0xc462('0x85')]['bulkCreate'](_0x3c40c2,{'transaction':_0x1c1269});});}else{_0x3de70a=0x194;_0x3416b6=[];}});})[_0xc462('0x22')](function(){if(_0x3de70a!==0x194){return db[_0xc462('0x85')]['findAndCountAll']({'where':{'FaxAccountId':_0x3aaed9},'order':'priority'})['then'](function(_0xcf10c8){_0x3416b6=_0xcf10c8;});}})['catch'](function(_0x85a720){_0x3de70a=0x1f4;logger[_0xc462('0x28')](_0x85a720[_0xc462('0x86')]);if(_0x85a720[_0xc462('0x3b')]){delete _0x85a720[_0xc462('0x3b')];}_0x3416b6=_0x85a720;})['finally'](function(){if(_0x3416b6===null){_0x54ec4f[_0xc462('0x3a')](_0x3de70a);}else{if(_0x3de70a===0x1f4){_0x54ec4f['status'](_0x3de70a)[_0xc462('0x3c')](_0x3416b6);}else{_0x54ec4f[_0xc462('0x2d')](_0x3de70a)[_0xc462('0x2f')](_0x3416b6);}}});};exports['getApplications']=function(_0x43b324,_0x2007f7,_0x19ff3e){var _0x333a4b={};var _0x463052={};var _0xee256e;var _0x15374e;return db[_0xc462('0x40')][_0xc462('0x6b')]({'where':{'id':_0x43b324[_0xc462('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2007f7,null))[_0xc462('0x22')](function(_0x226f85){if(_0x226f85){_0xee256e=_0x226f85;_0x463052[_0xc462('0x44')]=_[_0xc462('0x5b')](db['FaxApplication'][_0xc462('0x41')]);_0x463052[_0xc462('0x46')]=_['keys'](_0x43b324['query']);_0x463052[_0xc462('0x47')]=_['intersection'](_0x463052[_0xc462('0x44')],_0x463052[_0xc462('0x46')]);_0x333a4b[_0xc462('0x49')]=_[_0xc462('0x48')](_0x463052[_0xc462('0x44')],qs['fields'](_0x43b324[_0xc462('0x46')][_0xc462('0x4a')]));_0x333a4b[_0xc462('0x49')]=_0x333a4b[_0xc462('0x49')]['length']?_0x333a4b[_0xc462('0x49')]:_0x463052['model'];_0x333a4b[_0xc462('0x4d')]=qs[_0xc462('0x4e')](_0x43b324[_0xc462('0x46')][_0xc462('0x4e')]);_0x333a4b[_0xc462('0x4f')]=qs[_0xc462('0x47')](_['pick'](_0x43b324['query'],_0x463052['filters']));if(_0x43b324[_0xc462('0x46')]['filter']){_0x333a4b['where']=_['merge'](_0x333a4b[_0xc462('0x4f')],{'$or':_['map'](_0x333a4b[_0xc462('0x49')],function(_0xeb310c){var _0x5e541d={};_0x5e541d[_0xeb310c]={'$like':'%'+_0x43b324[_0xc462('0x46')][_0xc462('0x51')]+'%'};return _0x5e541d;})});}_0x333a4b=_[_0xc462('0x52')]({},_0x333a4b,_0x43b324[_0xc462('0x54')]);return _0xee256e['getApplications'](_0x333a4b);}})[_0xc462('0x22')](function(_0x25088e){if(_0x25088e){_0x15374e=_0x25088e['length'];if(!_0x43b324['query'][_0xc462('0x4b')](_0xc462('0x4c'))){_0x333a4b[_0xc462('0x32')]=qs['limit'](_0x43b324[_0xc462('0x46')][_0xc462('0x32')]);_0x333a4b[_0xc462('0x30')]=qs[_0xc462('0x30')](_0x43b324[_0xc462('0x46')][_0xc462('0x30')]);}return _0xee256e['getApplications'](_0x333a4b);}})[_0xc462('0x22')](function(_0x4676f5){if(_0x4676f5){return _0x4676f5?{'count':_0x15374e,'rows':_0x4676f5}:null;}})[_0xc462('0x22')](respondWithResult(_0x2007f7,null))[_0xc462('0x2c')](handleError(_0x2007f7,null));};function Extension(_0xa697d8,_0x59abaf,_0x2be6d2,_0x3bbd6f){this[_0xc462('0x87')]=_0xc462('0x88');this[_0xc462('0x89')]=_0xa697d8[_0xc462('0x8a')];this['app']=_0x3bbd6f;this['type']='system';this['description']=_0xc462('0x8b');this[_0xc462('0x6f')]=_0xa697d8['id'];this['priority']=_0x59abaf;this['appdata']=_0x2be6d2;}function createExtensionsReciveFax(_0x9a93dd){var _0x1cd99b=0x1;var _0x2bce37=[];_0x2bce37['push'](new Extension(_0x9a93dd,_0x1cd99b,'',_0xc462('0x8c')));_0x1cd99b+=0x1;_0x2bce37[_0xc462('0x8d')](new Extension(_0x9a93dd,_0x1cd99b,'CDR(type)=inbound-fax','Set'));_0x1cd99b+=0x1;for(var _0x5a9728 in _0x9a93dd){if(_0x9a93dd['hasOwnProperty'](_0x5a9728)&&(_0x5a9728==='ecm'||_0x5a9728===_0xc462('0x8a')||_0x5a9728===_0xc462('0x8e')||_0x5a9728==='faxdetect'||_0x5a9728==='headerinfo'||_0x5a9728===_0xc462('0x8f')||_0x5a9728==='minrate'||_0x5a9728==='modem'||_0x5a9728===_0xc462('0x90'))){_0x2bce37[_0xc462('0x8d')](new Extension(_0x9a93dd,_0x1cd99b,_0xc462('0x91')+_0x5a9728+')='+_0x9a93dd[_0x5a9728],'Set'));_0x1cd99b+=0x1;}}_0x2bce37['push'](new Extension(_0x9a93dd,_0x1cd99b,'6',_0xc462('0x92')));_0x1cd99b+=0x1;_0x2bce37[_0xc462('0x8d')](new Extension(_0x9a93dd,_0x1cd99b,_0xc462('0x93'),_0xc462('0x94')));_0x1cd99b=0x0;return _0x2bce37;}exports[_0xc462('0x95')]=function(_0x5f32ef,_0x5c8d3a,_0x10a90c){var _0x5d1d7a;return db[_0xc462('0x80')][_0xc462('0x81')](function(_0x2bb41c){return db[_0xc462('0x40')][_0xc462('0x5e')](_0x5f32ef['body'],{'transaction':_0x2bb41c})[_0xc462('0x22')](function(_0x58f698){_0x5d1d7a=_0x58f698[_0xc462('0x39')]({'plain':!![]});return db['VoiceExtension'][_0xc462('0x96')](createExtensionsReciveFax(_0x5d1d7a),{'transaction':_0x2bb41c});});})[_0xc462('0x22')](function(){return _0x5d1d7a;})['then'](respondWithResult(_0x5c8d3a,null))[_0xc462('0x2c')](handleError(_0x5c8d3a,null));};exports[_0xc462('0x97')]=function(_0x25e357,_0xcb6d45,_0x585bdb){var _0x50b58f;return db[_0xc462('0x80')]['transaction'](function(_0x40751d){return db[_0xc462('0x40')][_0xc462('0x37')](_0x25e357[_0xc462('0x5f')],{'where':{'id':_0x25e357[_0xc462('0x5f')]['id']},'transaction':_0x40751d})['then'](function(_0xcbaccf){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x25e357['body']['id']},'transaction':_0x40751d})[_0xc462('0x22')](function(_0x17cfa6){return db['VoiceExtension'][_0xc462('0x96')](createExtensionsReciveFax(_[_0xc462('0x75')](_0x25e357[_0xc462('0x5f')],[_0xc462('0x98'),_0xc462('0x99'),_0xc462('0x9a'),'updatedAt','TrunkId',_0xc462('0x9b')])),{'transaction':_0x40751d});});});})[_0xc462('0x22')](function(){return db[_0xc462('0x40')]['findById'](_0x25e357[_0xc462('0x5f')]['id']);})['then'](respondWithResult(_0xcb6d45,null))[_0xc462('0x2c')](handleError(_0xcb6d45,null));};exports[_0xc462('0x9c')]=function(_0x47b384,_0x30a1c7,_0x4c8551){var _0x50e18f={'raw':!![],'where':{}};var _0x2e9271={};var _0x5af516={'count':0x0,'rows':[]};return db[_0xc462('0x40')][_0xc462('0x6b')]({'where':{'id':_0x47b384[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0x30a1c7,null))[_0xc462('0x22')](function(_0x306d84){if(_0x306d84){_0x2e9271['model']=_[_0xc462('0x5b')](db[_0xc462('0x9d')][_0xc462('0x41')]);_0x2e9271[_0xc462('0x46')]=_[_0xc462('0x5b')](_0x47b384[_0xc462('0x46')]);_0x2e9271['filters']=_[_0xc462('0x48')](_0x2e9271['model'],_0x2e9271[_0xc462('0x46')]);_0x50e18f[_0xc462('0x49')]=_['intersection'](_0x2e9271[_0xc462('0x44')],qs[_0xc462('0x4a')](_0x47b384[_0xc462('0x46')]['fields']));_0x50e18f[_0xc462('0x49')]=_0x50e18f[_0xc462('0x49')]['length']?_0x50e18f['attributes']:_0x2e9271[_0xc462('0x44')];if(!_0x47b384[_0xc462('0x46')]['hasOwnProperty']('nolimit')){_0x50e18f[_0xc462('0x32')]=qs['limit'](_0x47b384['query'][_0xc462('0x32')]);_0x50e18f[_0xc462('0x30')]=qs[_0xc462('0x30')](_0x47b384['query'][_0xc462('0x30')]);}_0x50e18f[_0xc462('0x4d')]=qs[_0xc462('0x4e')](_0x47b384[_0xc462('0x46')][_0xc462('0x4e')]);_0x50e18f['where']=qs[_0xc462('0x47')](_[_0xc462('0x50')](_0x47b384[_0xc462('0x46')],_0x2e9271[_0xc462('0x47')]));_0x50e18f[_0xc462('0x4f')][_0xc462('0x6f')]=_0x306d84['id'];if(_0x47b384['query']['filter']){_0x50e18f[_0xc462('0x4f')]=_[_0xc462('0x52')](_0x50e18f['where'],{'$or':_['map'](_0x50e18f[_0xc462('0x49')],function(_0x329e6c){var _0xc7e20={};_0xc7e20[_0x329e6c]={'$like':'%'+_0x47b384[_0xc462('0x46')][_0xc462('0x51')]+'%'};return _0xc7e20;})});}if(_0x47b384[_0xc462('0x46')][_0xc462('0x9e')]){var _0x470cf8=_0x47b384[_0xc462('0x46')][_0xc462('0x9e')]['split'](',');var _0x47b655={};_0x47b655[_0x470cf8[0x0]]={'$gte':moment(_0x470cf8[0x1])['format'](_0xc462('0x9f'))};_0x50e18f[_0xc462('0x4f')]=_[_0xc462('0x52')](_0x50e18f['where'],_0x47b655);}_0x50e18f=_['merge']({},_0x50e18f,_0x47b384['options']);return db[_0xc462('0x9d')][_0xc462('0x33')]({'where':_0x50e18f[_0xc462('0x4f')]})['then'](function(_0x3c9a7f){_0x5af516[_0xc462('0x33')]=_0x3c9a7f;if(_0x47b384['query'][_0xc462('0x55')]){_0x50e18f[_0xc462('0x56')]=[{'all':!![]}];}return db[_0xc462('0x9d')][_0xc462('0x57')](_0x50e18f);})['then'](function(_0x1933d0){_0x5af516['rows']=_0x1933d0;return _0x5af516;});}})['then'](respondWithFilteredResult(_0x30a1c7,_0x50e18f))[_0xc462('0x2c')](handleError(_0x30a1c7,null));};exports[_0xc462('0x3c')]=function(_0x5b846a,_0x291425,_0x2b4dde){var _0x377792,_0xd0180a={},_0x4b7380;if(_0x5b846a[_0xc462('0x5f')]['to']){_0x4b7380=_0x5b846a[_0xc462('0x5f')]['to'][0x0];}return db[_0xc462('0x40')][_0xc462('0x5d')]({'where':{'id':_0x5b846a['params']['id']},'include':[{'model':db[_0xc462('0xa0')],'as':_0xc462('0xa1'),'include':[{'model':db['CmContact'],'as':_0xc462('0xa2'),'where':{'fax':_0x4b7380},'limit':0x1,'order':[['updatedAt',_0xc462('0xa3')]]}]}]})[_0xc462('0x22')](handleEntityNotFound(_0x291425,null))[_0xc462('0x22')](function(_0x260484){_0x377792=_0x260484;if(_0x5b846a['body']['attachments']&&_0x5b846a[_0xc462('0x5f')]['attachments'][_0xc462('0x5c')]){for(var _0x4f4705=0x0;_0x4f4705<_0x5b846a['body'][_0xc462('0xa4')][_0xc462('0x5c')];_0x4f4705+=0x1){_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][_0x4f4705]={'filename':_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][_0x4f4705][_0xc462('0x3b')],'id':_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][_0x4f4705]['id'],'path':path['join'](config['root'],_0xc462('0xa5'),_0x5b846a['body'][_0xc462('0xa4')][_0x4f4705][_0xc462('0xa6')])};}}return respondWithRpcPromise(_0xc462('0xa7'),_0xc462('0xa7'),{'FaxAccountId':_[_0xc462('0xa8')](_0x5b846a[_0xc462('0x5a')]['id'])?undefined:_0x5b846a[_0xc462('0x5a')]['id'],'path':_[_0xc462('0xa8')](_0x5b846a[_0xc462('0x5f')]['attachments'][0x0][_0xc462('0xa9')])?undefined:_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][0x0][_0xc462('0xa9')],'fax':_[_0xc462('0xa8')](_0x5b846a[_0xc462('0x5f')]['to'][0x0])?undefined:_0x5b846a[_0xc462('0x5f')]['to'][0x0]},client9002);})['then'](function(){if(_0x377792){if(_['isNil'](_0x5b846a[_0xc462('0x5f')][_0xc462('0xaa')])){_0x5b846a[_0xc462('0x5f')][_0xc462('0xaa')]=util[_0xc462('0xab')]('\x22%s\x22\x20<%s>',_0x377792['name'],_0x377792[_0xc462('0xac')]);}if(_0x377792['List']){if(_0x377792[_0xc462('0xa1')][_0xc462('0xa2')]['length']){return _0x377792[_0xc462('0xa1')]['Contacts'][0x0];}else{return db[_0xc462('0x76')][_0xc462('0x5e')](_[_0xc462('0x19')](_0x5b846a[_0xc462('0x5f')],{'firstName':_0x5b846a[_0xc462('0x5f')]['to'][0x0],'phone':_0x5b846a['body']['to'][0x0],'fax':_0x5b846a[_0xc462('0x5f')]['to'][0x0],'ListId':_0x377792[_0xc462('0x9b')]}));}}else{throw new Error(_0xc462('0xad'));}}else{throw new Error(_0xc462('0xae'));}})[_0xc462('0x22')](function(_0x149de1){if(_0x149de1){return db['FaxInteraction'][_0xc462('0x5d')]({'where':{'ContactId':_0x149de1['id'],'closed':![],'FaxAccountId':_0x377792['id']}})[_0xc462('0x22')](function(_0x3dc02d){if(_0x3dc02d){return[_0x3dc02d,![]];}return db['FaxInteraction'][_0xc462('0x5e')]({'UserId':_0x5b846a[_0xc462('0x60')]['id'],'ContactId':_0x149de1['id'],'FaxAccountId':_0x377792['id'],'fax':_0x5b846a[_0xc462('0x5f')]['to'][0x0],'firstMsgDirection':_0xc462('0xaf'),'Messages':[_['merge'](_0x5b846a[_0xc462('0x5f')],{'read':![],'body':_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][0x0][_0xc462('0xb0')],'FaxAccountId':_0x377792['id'],'UserId':_0x5b846a[_0xc462('0x60')]['id'],'ContactId':_0x149de1['id'],'AttachmentId':_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xc462('0xb1')}]})[_0xc462('0x22')](function(_0x1b5e9d){return[_0x1b5e9d,!![]];});});}else{throw new Error(_0xc462('0xb2'));}})['spread'](function(_0x4a09f,_0x35c59d){if(_0x35c59d){return _0x4a09f;}return db[_0xc462('0x9d')]['create']({'direction':'out','read':![],'body':_0x5b846a[_0xc462('0x5f')]['attachments'][0x0][_0xc462('0xb0')],'FaxAccountId':_0x377792['id'],'FaxInteractionId':_0x4a09f['id'],'UserId':_0x5b846a[_0xc462('0x60')]['id'],'ContactId':_0x4a09f[_0xc462('0xb3')],'AttachmentId':_0x5b846a[_0xc462('0x5f')]['attachments'][0x0]['id']})[_0xc462('0x22')](function(_0x251ba7){_0x4a09f[_0xc462('0xb4')][_0xc462('0xb1')]=[];_0x4a09f[_0xc462('0xb4')]['Messages'][_0xc462('0x8d')](_0x251ba7[_0xc462('0xb4')]);return _0x4a09f;});})[_0xc462('0x22')](function(_0x2fb5d9){respondWithRpcPromise('SendFax',_0xc462('0xb5'),{'FaxAccountId':_[_0xc462('0xa8')](_0x5b846a[_0xc462('0x5a')]['id'])?undefined:_0x5b846a['params']['id'],'path':_['isNil'](_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][0x0][_0xc462('0xa9')])?undefined:_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][0x0][_0xc462('0xa9')],'fax':_['isNil'](_0x5b846a['body']['to'][0x0])?undefined:_0x5b846a['body']['to'][0x0],'AttachmentId':_0x5b846a[_0xc462('0x5f')][_0xc462('0xa4')][0x0]['id']},client9002)[_0xc462('0x22')](function(_0x2c77e8){logger['info'](_0xc462('0xb6'),_0x2c77e8);})[_0xc462('0x2c')](function(_0x5f3c95){logger[_0xc462('0x23')](_0xc462('0xb6'),_0x5f3c95);});return _0x2fb5d9;})[_0xc462('0x22')](respondWithResult(_0x291425,null))[_0xc462('0x2c')](handleError(_0x291425,null));};exports[_0xc462('0xb7')]=function(_0x35dcd8,_0xf3c1b3,_0x203aba){return db[_0xc462('0x40')][_0xc462('0x5d')]({'where':{'id':_0x35dcd8[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0xf3c1b3,null))['then'](function(_0x4977c7){if(_0x4977c7){return _0x4977c7[_0xc462('0xb7')](_0x35dcd8[_0xc462('0x5f')][_0xc462('0x6d')],_[_0xc462('0x75')](_0x35dcd8[_0xc462('0x5f')],[_0xc462('0x6d'),'id'])||{})['spread'](function(_0x39d8d3){for(var _0x3ad969=0x0;_0x3ad969<_0x35dcd8[_0xc462('0x5f')][_0xc462('0x6d')]['length'];_0x3ad969+=0x1){socket['emit'](_0xc462('0xb8'),{'UserId':Number(_0x35dcd8['body']['ids'][_0x3ad969]),'FaxAccountId':Number(_0x35dcd8['params']['id'])});}return _0x39d8d3;});}})[_0xc462('0x22')](respondWithResult(_0xf3c1b3,null))[_0xc462('0x2c')](handleError(_0xf3c1b3,null));};exports[_0xc462('0xb9')]=function(_0x1741ae,_0x44cc2c,_0x310cda){return db[_0xc462('0x40')][_0xc462('0x5d')]({'where':{'id':_0x1741ae[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0x44cc2c,null))[_0xc462('0x22')](function(_0x4131f5){if(_0x4131f5){return _0x4131f5[_0xc462('0xb9')](_0x1741ae[_0xc462('0x46')][_0xc462('0x6d')])[_0xc462('0x22')](function(){if(_[_0xc462('0xba')](_0x1741ae[_0xc462('0x46')][_0xc462('0x6d')])){for(var _0x407e86=0x0;_0x407e86<_0x1741ae[_0xc462('0x46')][_0xc462('0x6d')]['length'];_0x407e86+=0x1){socket[_0xc462('0xbb')](_0xc462('0xbc'),{'UserId':Number(_0x1741ae[_0xc462('0x46')][_0xc462('0x6d')][_0x407e86]),'FaxAccountId':Number(_0x1741ae[_0xc462('0x5a')]['id'])});}}else{socket[_0xc462('0xbb')](_0xc462('0xbc'),{'UserId':Number(_0x1741ae[_0xc462('0x46')][_0xc462('0x6d')]),'FaxAccountId':Number(_0x1741ae[_0xc462('0x5a')]['id'])});}});}})[_0xc462('0x22')](respondWithStatusCode(_0x44cc2c,null))[_0xc462('0x2c')](handleError(_0x44cc2c,null));};exports[_0xc462('0xbd')]=function(_0x37bf68,_0xbe670d,_0x1aa7a5){var _0x1bab49={};var _0x4f4439={};var _0x574983;var _0x1c058a;return db['FaxAccount'][_0xc462('0x6b')]({'where':{'id':_0x37bf68[_0xc462('0x5a')]['id']}})[_0xc462('0x22')](handleEntityNotFound(_0xbe670d,null))[_0xc462('0x22')](function(_0x2f8531){if(_0x2f8531){_0x574983=_0x2f8531;_0x4f4439[_0xc462('0x44')]=_[_0xc462('0x5b')](db['User'][_0xc462('0x41')]);_0x4f4439['query']=_['keys'](_0x37bf68['query']);_0x4f4439[_0xc462('0x47')]=_[_0xc462('0x48')](_0x4f4439['model'],_0x4f4439['query']);_0x1bab49[_0xc462('0x49')]=_['intersection'](_0x4f4439[_0xc462('0x44')],qs['fields'](_0x37bf68['query'][_0xc462('0x4a')]));_0x1bab49[_0xc462('0x49')]=_0x1bab49['attributes'][_0xc462('0x5c')]?_0x1bab49[_0xc462('0x49')]:_0x4f4439[_0xc462('0x44')];_0x1bab49[_0xc462('0x4d')]=qs[_0xc462('0x4e')](_0x37bf68[_0xc462('0x46')][_0xc462('0x4e')]);_0x1bab49[_0xc462('0x4f')]=qs['filters'](_[_0xc462('0x50')](_0x37bf68[_0xc462('0x46')],_0x4f4439[_0xc462('0x47')]));if(_0x37bf68[_0xc462('0x46')][_0xc462('0x51')]){_0x1bab49['where']=_[_0xc462('0x52')](_0x1bab49['where'],{'$or':_[_0xc462('0x45')](_0x1bab49['attributes'],function(_0x448957){var _0x4472af={};_0x4472af[_0x448957]={'$like':'%'+_0x37bf68[_0xc462('0x46')][_0xc462('0x51')]+'%'};return _0x4472af;})});}_0x1bab49=_[_0xc462('0x52')]({},_0x1bab49,_0x37bf68['options']);return _0x574983[_0xc462('0xbd')](_0x1bab49);}})[_0xc462('0x22')](function(_0x2a626f){if(_0x2a626f){_0x1c058a=_0x2a626f[_0xc462('0x5c')];if(!_0x37bf68['query']['hasOwnProperty']('nolimit')){_0x1bab49[_0xc462('0x32')]=qs[_0xc462('0x32')](_0x37bf68[_0xc462('0x46')][_0xc462('0x32')]);_0x1bab49[_0xc462('0x30')]=qs[_0xc462('0x30')](_0x37bf68[_0xc462('0x46')][_0xc462('0x30')]);}return _0x574983[_0xc462('0xbd')](_0x1bab49);}})[_0xc462('0x22')](function(_0x2cacd1){if(_0x2cacd1){return _0x2cacd1?{'count':_0x1c058a,'rows':_0x2cacd1}:null;}})[_0xc462('0x22')](respondWithResult(_0xbe670d,null))[_0xc462('0x2c')](handleError(_0xbe670d,null));};
\ No newline at end of file
+var _0xd69a=['headerinfo','maxrate','minrate','modem','FAXOPT(','Wait','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','omit','tech','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','format','send','CmList','List','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','Contacts','CmContact','Send\x20Fax\x20failed','out','filename','Messages','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./faxAccount.socket','register','client','http','request','info','FaxAccount,\x20%s,\x20%s','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','index','Pause','mandatoryDispositionPause','FaxAccount','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','rows','show','rawAttributes','length','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','Disposition','getDispositions','findOne','hasOwnProperty','FaxAccountId','include','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addInteraction','FaxInteraction','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','Answer','push','CDR(type)=inbound-fax','Set','gateway'];(function(_0x4d2610,_0x4820ec){var _0x57511e=function(_0x3095e4){while(--_0x3095e4){_0x4d2610['push'](_0x4d2610['shift']());}};_0x57511e(++_0x4820ec);}(_0xd69a,0x1c8));var _0xad69=function(_0x1cc467,_0x4f8dde){_0x1cc467=_0x1cc467-0x0;var _0x1ae3cf=_0xd69a[_0x1cc467];return _0x1ae3cf;};'use strict';var emlformat=require(_0xad69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad69('0x1'));var jsonpatch=require(_0xad69('0x2'));var rp=require(_0xad69('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad69('0x4'));var util=require(_0xad69('0x5'));var path=require(_0xad69('0x6'));var sox=require(_0xad69('0x7'));var csv=require(_0xad69('0x8'));var ejs=require(_0xad69('0x9'));var fs=require('fs');var fs_extra=require(_0xad69('0xa'));var _=require(_0xad69('0xb'));var squel=require(_0xad69('0xc'));var crypto=require('crypto');var jsforce=require(_0xad69('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xad69('0x8'));var querystring=require(_0xad69('0xe'));var Papa=require(_0xad69('0xf'));var Redis=require(_0xad69('0x10'));var authService=require(_0xad69('0x11'));var qs=require(_0xad69('0x12'));var as=require(_0xad69('0x13'));var hardwareService=require(_0xad69('0x14'));var logger=require(_0xad69('0x15'))(_0xad69('0x16'));var utils=require('../../config/utils');var config=require(_0xad69('0x17'));var licenseUtil=require(_0xad69('0x18'));var db=require(_0xad69('0x19'))['db'];config['redis']=_[_0xad69('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xad69('0x1b'))(new Redis(config[_0xad69('0x1c')]));require(_0xad69('0x1d'))[_0xad69('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xad69('0x1f')][_0xad69('0x20')]({'port':0x232c});var client9002=jayson[_0xad69('0x1f')][_0xad69('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x1c74e6,_0x5809f4,_0x41f49c,_0xe50956){return new BPromise(function(_0x4e93a3,_0x19da65){var _0x19d359=_0xe50956||client;return _0x19d359[_0xad69('0x21')](_0x1c74e6,_0x41f49c)['then'](function(_0x408e5d){logger[_0xad69('0x22')](_0xad69('0x23'),_0x5809f4,'request\x20sent');logger['debug'](_0xad69('0x24'),_0x5809f4,_0xad69('0x25'),JSON[_0xad69('0x26')](_0x408e5d));if(_0x408e5d[_0xad69('0x27')]){if(_0x408e5d[_0xad69('0x27')][_0xad69('0x28')]===0x1f4){logger[_0xad69('0x27')](_0xad69('0x23'),_0x5809f4,_0x408e5d[_0xad69('0x27')]['message']);return _0x19da65(_0x408e5d['error'][_0xad69('0x29')]);}logger[_0xad69('0x27')](_0xad69('0x23'),_0x5809f4,_0x408e5d[_0xad69('0x27')]['message']);return _0x4e93a3(_0x408e5d[_0xad69('0x27')]['message']);}else{logger[_0xad69('0x22')](_0xad69('0x23'),_0x5809f4,'request\x20sent');_0x4e93a3(_0x408e5d[_0xad69('0x2a')][_0xad69('0x29')]);}})[_0xad69('0x2b')](function(_0x5a4ed0){logger[_0xad69('0x27')](_0xad69('0x23'),_0x5809f4,_0x5a4ed0);_0x19da65(_0x5a4ed0);});});}function respondWithStatusCode(_0x554a75,_0x1d852b){_0x1d852b=_0x1d852b||0xcc;return function(_0x3655e4){if(_0x3655e4){return _0x554a75['sendStatus'](_0x1d852b);}return _0x554a75[_0xad69('0x2c')](_0x1d852b)[_0xad69('0x2d')]();};}function respondWithResult(_0x819fc9,_0x2df3e3){_0x2df3e3=_0x2df3e3||0xc8;return function(_0x2b7ddf){if(_0x2b7ddf){return _0x819fc9['status'](_0x2df3e3)['json'](_0x2b7ddf);}};}function respondWithFilteredResult(_0x3822e9,_0x4762a8){return function(_0x294ca6){if(_0x294ca6){var _0x4cc9d6=typeof _0x4762a8['offset']===_0xad69('0x2e')&&typeof _0x4762a8[_0xad69('0x2f')]===_0xad69('0x2e');var _0x151ab8=_0x294ca6[_0xad69('0x30')];var _0x3c1f0e=_0x4cc9d6?0x0:_0x4762a8[_0xad69('0x31')];var _0x4df765=_0x4cc9d6?_0x294ca6[_0xad69('0x30')]:_0x4762a8[_0xad69('0x31')]+_0x4762a8['limit'];var _0xc00783;if(_0x4df765>=_0x151ab8){_0x4df765=_0x151ab8;_0xc00783=0xc8;}else{_0xc00783=0xce;}_0x3822e9[_0xad69('0x2c')](_0xc00783);return _0x3822e9['set'](_0xad69('0x32'),_0x3c1f0e+'-'+_0x4df765+'/'+_0x151ab8)['json'](_0x294ca6);}return null;};}function patchUpdates(_0x5d4508){return function(_0x500264){try{jsonpatch[_0xad69('0x33')](_0x500264,_0x5d4508,!![]);}catch(_0x48be4a){return BPromise[_0xad69('0x34')](_0x48be4a);}return _0x500264[_0xad69('0x35')]();};}function saveUpdates(_0x1452a2,_0x32de89){return function(_0x15a847){if(_0x15a847){return _0x15a847[_0xad69('0x36')](_0x1452a2)[_0xad69('0x37')](function(_0x915393){return _0x915393;});}return null;};}function removeEntity(_0x3e0f96,_0x5c3e75){return function(_0x4766c1){if(_0x4766c1){return _0x4766c1[_0xad69('0x38')]()[_0xad69('0x37')](function(){var _0x409f50=_0x4766c1[_0xad69('0x39')]({'plain':!![]});var _0x511bfc=_0xad69('0x3a');return db[_0xad69('0x3b')]['destroy']({'where':{'type':_0x511bfc,'resourceId':_0x409f50['id']}})[_0xad69('0x37')](function(){return _0x4766c1;});})['then'](function(){_0x3e0f96[_0xad69('0x2c')](0xcc)[_0xad69('0x2d')]();});}};}function handleEntityNotFound(_0x2ac456,_0x4dc445){return function(_0x4f7c28){if(!_0x4f7c28){_0x2ac456[_0xad69('0x3c')](0x194);}return _0x4f7c28;};}function handleError(_0x5cb4b3,_0x1cda27){_0x1cda27=_0x1cda27||0x1f4;return function(_0x446ddf){logger[_0xad69('0x27')](_0x446ddf[_0xad69('0x3d')]);if(_0x446ddf[_0xad69('0x3e')]){delete _0x446ddf[_0xad69('0x3e')];}_0x5cb4b3[_0xad69('0x2c')](_0x1cda27)['send'](_0x446ddf);};}exports[_0xad69('0x3f')]=function(_0x2fa823,_0x149624){var _0x854006={'include':[{'model':db[_0xad69('0x40')],'as':_0xad69('0x41')}]},_0xbb4294={},_0x4f0ebd={'count':0x0,'rows':[]};var _0xa5270b=_['map'](db[_0xad69('0x42')]['rawAttributes'],function(_0x3785b4){return{'name':_0x3785b4[_0xad69('0x43')],'type':_0x3785b4[_0xad69('0x44')][_0xad69('0x45')]};});_0xbb4294['model']=_[_0xad69('0x46')](_0xa5270b,_0xad69('0x3e'));_0xbb4294[_0xad69('0x47')]=_[_0xad69('0x48')](_0x2fa823['query']);_0xbb4294[_0xad69('0x49')]=_[_0xad69('0x4a')](_0xbb4294['model'],_0xbb4294[_0xad69('0x47')]);_0x854006[_0xad69('0x4b')]=_['intersection'](_0xbb4294[_0xad69('0x4c')],qs['fields'](_0x2fa823[_0xad69('0x47')][_0xad69('0x4d')]));_0x854006[_0xad69('0x4b')]=_0x854006['attributes']['length']?_0x854006[_0xad69('0x4b')]:_0xbb4294['model'];if(!_0x2fa823[_0xad69('0x47')]['hasOwnProperty'](_0xad69('0x4e'))){_0x854006[_0xad69('0x2f')]=qs['limit'](_0x2fa823[_0xad69('0x47')][_0xad69('0x2f')]);_0x854006[_0xad69('0x31')]=qs[_0xad69('0x31')](_0x2fa823[_0xad69('0x47')][_0xad69('0x31')]);}_0x854006[_0xad69('0x4f')]=qs['sort'](_0x2fa823[_0xad69('0x47')][_0xad69('0x50')]);_0x854006['where']=qs['filters'](_[_0xad69('0x51')](_0x2fa823[_0xad69('0x47')],_0xbb4294['filters']),_0xa5270b);if(_0x2fa823[_0xad69('0x47')][_0xad69('0x52')]){_0x854006['where']=_[_0xad69('0x53')](_0x854006[_0xad69('0x54')],{'$or':_['map'](_0xa5270b,function(_0x1173e4){if(_0x1173e4['type']!==_0xad69('0x55')){var _0x55ccd2={};_0x55ccd2[_0x1173e4['name']]={'$like':'%'+_0x2fa823['query'][_0xad69('0x52')]+'%'};return _0x55ccd2;}})});}_0x854006=_[_0xad69('0x53')]({},_0x854006,_0x2fa823[_0xad69('0x56')]);var _0xe4b969={'where':_0x854006[_0xad69('0x54')]};return db[_0xad69('0x42')]['count'](_0xe4b969)['then'](function(_0x4bf659){_0x4f0ebd['count']=_0x4bf659;if(_0x2fa823[_0xad69('0x47')][_0xad69('0x57')]){_0x854006['include']=[{'all':!![]}];}return db['FaxAccount'][_0xad69('0x58')](_0x854006);})[_0xad69('0x37')](function(_0x883e44){_0x4f0ebd[_0xad69('0x59')]=_0x883e44;return _0x4f0ebd;})['then'](respondWithFilteredResult(_0x149624,_0x854006))['catch'](handleError(_0x149624,null));};exports[_0xad69('0x5a')]=function(_0x41863a,_0x30602a){var _0x57afeb={'raw':![],'where':{'id':_0x41863a['params']['id']},'include':[{'model':db[_0xad69('0x40')],'as':_0xad69('0x41')}]},_0x3912e6={};_0x3912e6[_0xad69('0x4c')]=_[_0xad69('0x48')](db[_0xad69('0x42')][_0xad69('0x5b')]);_0x3912e6[_0xad69('0x47')]=_[_0xad69('0x48')](_0x41863a[_0xad69('0x47')]);_0x3912e6[_0xad69('0x49')]=_[_0xad69('0x4a')](_0x3912e6[_0xad69('0x4c')],_0x3912e6[_0xad69('0x47')]);_0x57afeb[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x3912e6['model'],qs[_0xad69('0x4d')](_0x41863a[_0xad69('0x47')][_0xad69('0x4d')]));_0x57afeb[_0xad69('0x4b')]=_0x57afeb['attributes'][_0xad69('0x5c')]?_0x57afeb[_0xad69('0x4b')]:_0x3912e6[_0xad69('0x4c')];if(_0x41863a[_0xad69('0x47')]['includeAll']){_0x57afeb['include']=[{'all':!![]}];}_0x57afeb=_[_0xad69('0x53')]({},_0x57afeb,_0x41863a[_0xad69('0x56')]);return db[_0xad69('0x42')][_0xad69('0x5d')](_0x57afeb)['then'](handleEntityNotFound(_0x30602a,null))[_0xad69('0x37')](respondWithResult(_0x30602a,null))['catch'](handleError(_0x30602a,null));};exports['create']=function(_0x1412dc,_0x1cf8a6){return db[_0xad69('0x42')]['create'](_0x1412dc[_0xad69('0x5e')],{})[_0xad69('0x37')](function(_0x5058d8){var _0x552243=_0x1412dc['user'][_0xad69('0x39')]({'plain':!![]});if(!_0x552243)throw new Error(_0xad69('0x5f'));if(_0x552243['role']===_0xad69('0x60')){var _0x47e017=_0x5058d8['get']({'plain':!![]});var _0x1aea8b=_0xad69('0x3a');return db['UserProfileSection'][_0xad69('0x5d')]({'where':{'name':_0x1aea8b,'userProfileId':_0x552243[_0xad69('0x61')]},'raw':!![]})[_0xad69('0x37')](function(_0x1b5ba2){if(_0x1b5ba2&&_0x1b5ba2[_0xad69('0x62')]===0x0){return db['UserProfileResource'][_0xad69('0x63')]({'name':_0x47e017[_0xad69('0x3e')],'resourceId':_0x47e017['id'],'type':_0x1b5ba2[_0xad69('0x3e')],'sectionId':_0x1b5ba2['id']},{})[_0xad69('0x37')](function(){return _0x5058d8;});}else{return _0x5058d8;}})[_0xad69('0x2b')](function(_0x281f0d){logger[_0xad69('0x27')](_0xad69('0x64'),_0x281f0d);throw _0x281f0d;});}return _0x5058d8;})['then'](respondWithResult(_0x1cf8a6,0xc9))[_0xad69('0x2b')](handleError(_0x1cf8a6,null));};exports[_0xad69('0x36')]=function(_0x1a6937,_0x38fc20){if(_0x1a6937[_0xad69('0x5e')]['id']){delete _0x1a6937[_0xad69('0x5e')]['id'];}return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x1a6937[_0xad69('0x65')]['id']},'include':[{'model':db['Pause'],'as':_0xad69('0x41')}]})[_0xad69('0x37')](handleEntityNotFound(_0x38fc20,null))[_0xad69('0x37')](saveUpdates(_0x1a6937[_0xad69('0x5e')],null))[_0xad69('0x37')](respondWithResult(_0x38fc20,null))[_0xad69('0x2b')](handleError(_0x38fc20,null));};exports['destroy']=function(_0x4e2471,_0x394660){return db['FaxAccount']['find']({'where':{'id':_0x4e2471[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x394660,null))['then'](removeEntity(_0x394660,null))[_0xad69('0x2b')](handleError(_0x394660,null));};exports['describe']=function(_0x8c95e2,_0x2c92c3){return db['FaxAccount'][_0xad69('0x66')]()[_0xad69('0x37')](respondWithResult(_0x2c92c3,null))['catch'](handleError(_0x2c92c3,null));};exports['addDisposition']=function(_0x400bc0,_0x3498aa,_0x74acd2){if(_0x400bc0[_0xad69('0x5e')]['id']){delete _0x400bc0[_0xad69('0x5e')]['id'];}return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x400bc0[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x3498aa,null))[_0xad69('0x37')](function(_0x5421d4){if(_0x5421d4){_0x400bc0[_0xad69('0x5e')]['FaxAccountId']=_0x5421d4['id'];return db[_0xad69('0x67')]['create'](_0x400bc0[_0xad69('0x5e')]);}})[_0xad69('0x37')](respondWithResult(_0x3498aa,null))[_0xad69('0x2b')](handleError(_0x3498aa,null));};exports[_0xad69('0x68')]=function(_0xc16a3,_0x1c4306,_0x1d178c){var _0xdfbafe={'raw':![],'where':{}};var _0x58b232={};var _0x33bba1={'count':0x0,'rows':[]};return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0xc16a3[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x1c4306,null))[_0xad69('0x37')](function(_0x4e3d7c){if(_0x4e3d7c){_0x58b232[_0xad69('0x4c')]=_['keys'](db[_0xad69('0x67')][_0xad69('0x5b')]);_0x58b232[_0xad69('0x47')]=_[_0xad69('0x48')](_0xc16a3['query']);_0x58b232[_0xad69('0x49')]=_['intersection'](_0x58b232[_0xad69('0x4c')],_0x58b232['query']);_0xdfbafe['attributes']=_[_0xad69('0x4a')](_0x58b232[_0xad69('0x4c')],qs['fields'](_0xc16a3[_0xad69('0x47')]['fields']));_0xdfbafe[_0xad69('0x4b')]=_0xdfbafe['attributes']['length']?_0xdfbafe[_0xad69('0x4b')]:_0x58b232[_0xad69('0x4c')];if(!_0xc16a3[_0xad69('0x47')][_0xad69('0x6a')]('nolimit')){_0xdfbafe[_0xad69('0x2f')]=qs[_0xad69('0x2f')](_0xc16a3['query'][_0xad69('0x2f')]);_0xdfbafe[_0xad69('0x31')]=qs[_0xad69('0x31')](_0xc16a3[_0xad69('0x47')][_0xad69('0x31')]);}_0xdfbafe[_0xad69('0x4f')]=qs[_0xad69('0x50')](_0xc16a3[_0xad69('0x47')][_0xad69('0x50')]);_0xdfbafe[_0xad69('0x54')]=qs[_0xad69('0x49')](_['pick'](_0xc16a3[_0xad69('0x47')],_0x58b232[_0xad69('0x49')]));_0xdfbafe[_0xad69('0x54')][_0xad69('0x6b')]=_0x4e3d7c['id'];if(_0xc16a3[_0xad69('0x47')][_0xad69('0x52')]){_0xdfbafe[_0xad69('0x54')]=_['merge'](_0xdfbafe[_0xad69('0x54')],{'$or':_['map'](_0xdfbafe['attributes'],function(_0x26ac05){var _0x416d0e={};_0x416d0e[_0x26ac05]={'$like':'%'+_0xc16a3[_0xad69('0x47')]['filter']+'%'};return _0x416d0e;})});}_0xdfbafe=_[_0xad69('0x53')]({},_0xdfbafe,_0xc16a3[_0xad69('0x56')]);return db[_0xad69('0x67')][_0xad69('0x30')]({'where':_0xdfbafe[_0xad69('0x54')]})[_0xad69('0x37')](function(_0x6dbd85){_0x33bba1[_0xad69('0x30')]=_0x6dbd85;if(_0xc16a3[_0xad69('0x47')]['includeAll']){_0xdfbafe[_0xad69('0x6c')]=[{'all':!![]}];}return db[_0xad69('0x67')][_0xad69('0x58')](_0xdfbafe);})[_0xad69('0x37')](function(_0x483bcd){_0x33bba1[_0xad69('0x59')]=_0x483bcd;return _0x33bba1;});}})['then'](respondWithFilteredResult(_0x1c4306,_0xdfbafe))['catch'](handleError(_0x1c4306,null));};exports[_0xad69('0x6d')]=function(_0x57b03d,_0x3837cc,_0xf90127){return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x57b03d[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x3837cc,null))['then'](function(_0x1bad9c){if(_0x1bad9c){return _0x1bad9c[_0xad69('0x6d')](_0x57b03d[_0xad69('0x47')][_0xad69('0x6e')]);}})[_0xad69('0x37')](respondWithStatusCode(_0x3837cc,null))[_0xad69('0x2b')](handleError(_0x3837cc,null));};exports[_0xad69('0x6f')]=function(_0x572779,_0x217216,_0x64fc3e){if(_0x572779[_0xad69('0x5e')]['id']){delete _0x572779[_0xad69('0x5e')]['id'];}return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x572779[_0xad69('0x65')]['id']}})['then'](handleEntityNotFound(_0x217216,null))['then'](function(_0x12a71c){if(_0x12a71c){_0x572779[_0xad69('0x5e')]['FaxAccountId']=_0x12a71c['id'];return db[_0xad69('0x70')]['create'](_0x572779['body']);}})['then'](respondWithResult(_0x217216,null))[_0xad69('0x2b')](handleError(_0x217216,null));};exports[_0xad69('0x71')]=function(_0x2952f8,_0x25eb73,_0x13dee7){var _0x20b0a0={'raw':![],'where':{}};var _0x37ebc3={};var _0x13bf34={'count':0x0,'rows':[]};return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0x2952f8[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x25eb73,null))['then'](function(_0x4dac43){if(_0x4dac43){_0x37ebc3[_0xad69('0x4c')]=_[_0xad69('0x48')](db['CannedAnswer']['rawAttributes']);_0x37ebc3[_0xad69('0x47')]=_[_0xad69('0x48')](_0x2952f8[_0xad69('0x47')]);_0x37ebc3[_0xad69('0x49')]=_[_0xad69('0x4a')](_0x37ebc3[_0xad69('0x4c')],_0x37ebc3[_0xad69('0x47')]);_0x20b0a0[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x37ebc3['model'],qs[_0xad69('0x4d')](_0x2952f8['query'][_0xad69('0x4d')]));_0x20b0a0[_0xad69('0x4b')]=_0x20b0a0[_0xad69('0x4b')][_0xad69('0x5c')]?_0x20b0a0[_0xad69('0x4b')]:_0x37ebc3['model'];if(!_0x2952f8[_0xad69('0x47')][_0xad69('0x6a')](_0xad69('0x4e'))){_0x20b0a0[_0xad69('0x2f')]=qs['limit'](_0x2952f8[_0xad69('0x47')][_0xad69('0x2f')]);_0x20b0a0[_0xad69('0x31')]=qs[_0xad69('0x31')](_0x2952f8[_0xad69('0x47')][_0xad69('0x31')]);}_0x20b0a0[_0xad69('0x4f')]=qs['sort'](_0x2952f8[_0xad69('0x47')][_0xad69('0x50')]);_0x20b0a0[_0xad69('0x54')]=qs[_0xad69('0x49')](_['pick'](_0x2952f8['query'],_0x37ebc3[_0xad69('0x49')]));_0x20b0a0['where']['FaxAccountId']=_0x4dac43['id'];if(_0x2952f8['query'][_0xad69('0x52')]){_0x20b0a0[_0xad69('0x54')]=_[_0xad69('0x53')](_0x20b0a0[_0xad69('0x54')],{'$or':_[_0xad69('0x46')](_0x20b0a0['attributes'],function(_0x5ae87b){var _0x1eabde={};_0x1eabde[_0x5ae87b]={'$like':'%'+_0x2952f8['query'][_0xad69('0x52')]+'%'};return _0x1eabde;})});}_0x20b0a0=_[_0xad69('0x53')]({},_0x20b0a0,_0x2952f8[_0xad69('0x56')]);return db['CannedAnswer'][_0xad69('0x30')]({'where':_0x20b0a0[_0xad69('0x54')]})['then'](function(_0x3a40db){_0x13bf34[_0xad69('0x30')]=_0x3a40db;if(_0x2952f8[_0xad69('0x47')][_0xad69('0x57')]){_0x20b0a0[_0xad69('0x6c')]=[{'all':!![]}];}return db[_0xad69('0x70')]['findAll'](_0x20b0a0);})[_0xad69('0x37')](function(_0x4a92b9){_0x13bf34[_0xad69('0x59')]=_0x4a92b9;return _0x13bf34;});}})[_0xad69('0x37')](respondWithFilteredResult(_0x25eb73,_0x20b0a0))['catch'](handleError(_0x25eb73,null));};exports['removeAnswers']=function(_0x353b19,_0x4920e0,_0x5ce0ff){return db['FaxAccount'][_0xad69('0x5d')]({'where':{'id':_0x353b19[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x4920e0,null))[_0xad69('0x37')](function(_0x3af2b1){if(_0x3af2b1){return _0x3af2b1['removeAnswers'](_0x353b19[_0xad69('0x47')][_0xad69('0x6e')]);}})[_0xad69('0x37')](respondWithStatusCode(_0x4920e0,null))['catch'](handleError(_0x4920e0,null));};exports[_0xad69('0x72')]=function(_0x14979b,_0x76c8af,_0x485aa6){return db[_0xad69('0x73')][_0xad69('0x5d')]({'where':{'id':_0x14979b[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x76c8af,null))['then'](function(_0x20498a){if(_0x20498a){return _0x20498a[_0xad69('0x72')](_0x14979b[_0xad69('0x5e')]['ids'],_['omit'](_0x14979b[_0xad69('0x5e')],[_0xad69('0x6e'),'id'])||{});}})[_0xad69('0x37')](respondWithResult(_0x76c8af,null))[_0xad69('0x2b')](handleError(_0x76c8af,null));};exports[_0xad69('0x74')]=function(_0x4c6842,_0x33a2bc,_0x5b5742){var _0x155490={'raw':![],'where':{}};var _0x5ecc5f={};var _0x423e10={'count':0x0,'rows':[]};return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0x4c6842[_0xad69('0x65')]['id']}})['then'](handleEntityNotFound(_0x33a2bc,null))[_0xad69('0x37')](function(_0x12583c){if(_0x12583c){_0x5ecc5f['model']=_[_0xad69('0x48')](db[_0xad69('0x73')][_0xad69('0x5b')]);_0x5ecc5f[_0xad69('0x47')]=_[_0xad69('0x48')](_0x4c6842[_0xad69('0x47')]);_0x5ecc5f[_0xad69('0x49')]=_[_0xad69('0x4a')](_0x5ecc5f[_0xad69('0x4c')],_0x5ecc5f['query']);_0x155490[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x5ecc5f[_0xad69('0x4c')],qs[_0xad69('0x4d')](_0x4c6842[_0xad69('0x47')]['fields']));_0x155490[_0xad69('0x4b')]=_0x155490['attributes'][_0xad69('0x5c')]?_0x155490[_0xad69('0x4b')]:_0x5ecc5f[_0xad69('0x4c')];if(!_0x4c6842[_0xad69('0x47')]['hasOwnProperty']('nolimit')){_0x155490[_0xad69('0x2f')]=qs[_0xad69('0x2f')](_0x4c6842[_0xad69('0x47')][_0xad69('0x2f')]);_0x155490[_0xad69('0x31')]=qs[_0xad69('0x31')](_0x4c6842[_0xad69('0x47')][_0xad69('0x31')]);}_0x155490[_0xad69('0x4f')]=qs[_0xad69('0x50')](_0x4c6842[_0xad69('0x47')]['sort']);_0x155490['where']=qs[_0xad69('0x49')](_[_0xad69('0x51')](_0x4c6842['query'],_0x5ecc5f[_0xad69('0x49')]));_0x155490[_0xad69('0x54')][_0xad69('0x6b')]=_0x12583c['id'];if(_0x4c6842[_0xad69('0x47')][_0xad69('0x52')]){_0x155490[_0xad69('0x54')]=_[_0xad69('0x53')](_0x155490[_0xad69('0x54')],{'$or':_[_0xad69('0x46')](_0x155490[_0xad69('0x4b')],function(_0x3ed075){var _0x29c0e2={};_0x29c0e2[_0x3ed075]={'$like':'%'+_0x4c6842[_0xad69('0x47')][_0xad69('0x52')]+'%'};return _0x29c0e2;})});}_0x155490=_[_0xad69('0x53')]({},_0x155490,_0x4c6842[_0xad69('0x56')]);return db[_0xad69('0x73')]['count']({'where':_0x155490[_0xad69('0x54')]})[_0xad69('0x37')](function(_0x29d6d5){_0x423e10[_0xad69('0x30')]=_0x29d6d5;if(_0x4c6842[_0xad69('0x47')][_0xad69('0x57')]){_0x155490[_0xad69('0x6c')]=[{'model':db['CmContact'],'as':_0xad69('0x75'),'required':![]},{'model':db[_0xad69('0x76')],'as':_0xad69('0x77'),'attributes':[_0xad69('0x3e'),_0xad69('0x78'),_0xad69('0x79')],'required':![]},{'model':db[_0xad69('0x7a')],'as':_0xad69('0x7b'),'attributes':['id',_0xad69('0x3e'),_0xad69('0x7c')],'where':_0x4c6842[_0xad69('0x47')][_0xad69('0x7d')]?{'id':_0x4c6842[_0xad69('0x47')][_0xad69('0x7d')]}:undefined,'required':_0x4c6842[_0xad69('0x47')][_0xad69('0x7d')]?!![]:![]}];}return db[_0xad69('0x73')]['findAll'](_0x155490);})[_0xad69('0x37')](function(_0x1518bb){_0x423e10['rows']=_0x1518bb;return _0x423e10;});}})['then'](respondWithFilteredResult(_0x33a2bc,_0x155490))[_0xad69('0x2b')](handleError(_0x33a2bc,null));};exports[_0xad69('0x7e')]=function(_0x278452,_0x56e74){var _0x403a68=_0x278452[_0xad69('0x65')]['id'];var _0x2de79f=_0x278452['body'];var _0x580de0=0xc8;var _0x4c81fe=null;return db[_0xad69('0x7f')][_0xad69('0x80')]({'isolationLevel':db[_0xad69('0x7f')][_0xad69('0x81')][_0xad69('0x82')]['READ_COMMITTED']},function(_0x363ffb){return db[_0xad69('0x42')]['findOne']({'where':{'id':_0x403a68},'transaction':_0x363ffb})[_0xad69('0x37')](function(_0x3ecdea){if(_0x3ecdea){return db[_0xad69('0x83')]['destroy']({'where':{'FaxAccountId':_0x403a68},'transaction':_0x363ffb})['then'](function(){var _0x10ecca=_['map'](_0x2de79f,function(_0x522c95){_0x522c95[_0xad69('0x6b')]=_0x403a68;return _0x522c95;});return db[_0xad69('0x83')][_0xad69('0x84')](_0x10ecca,{'transaction':_0x363ffb});});}else{_0x580de0=0x194;_0x4c81fe=[];}});})[_0xad69('0x37')](function(){if(_0x580de0!==0x194){return db[_0xad69('0x83')]['findAndCountAll']({'where':{'FaxAccountId':_0x403a68},'order':_0xad69('0x85')})['then'](function(_0x3a596e){_0x4c81fe=_0x3a596e;});}})[_0xad69('0x2b')](function(_0x187609){_0x580de0=0x1f4;logger[_0xad69('0x27')](_0x187609['stack']);if(_0x187609[_0xad69('0x3e')]){delete _0x187609[_0xad69('0x3e')];}_0x4c81fe=_0x187609;})[_0xad69('0x86')](function(){if(_0x4c81fe===null){_0x56e74[_0xad69('0x3c')](_0x580de0);}else{if(_0x580de0===0x1f4){_0x56e74[_0xad69('0x2c')](_0x580de0)['send'](_0x4c81fe);}else{_0x56e74[_0xad69('0x2c')](_0x580de0)['json'](_0x4c81fe);}}});};exports[_0xad69('0x87')]=function(_0xfacb98,_0xbc93e8,_0x1170ce){var _0x3680f0={};var _0x81a8f4={};var _0x5819d3;var _0xf9dedb;return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0xfacb98[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0xbc93e8,null))['then'](function(_0x35a588){if(_0x35a588){_0x5819d3=_0x35a588;_0x81a8f4[_0xad69('0x4c')]=_['keys'](db[_0xad69('0x83')]['rawAttributes']);_0x81a8f4[_0xad69('0x47')]=_['keys'](_0xfacb98[_0xad69('0x47')]);_0x81a8f4[_0xad69('0x49')]=_['intersection'](_0x81a8f4['model'],_0x81a8f4[_0xad69('0x47')]);_0x3680f0[_0xad69('0x4b')]=_['intersection'](_0x81a8f4[_0xad69('0x4c')],qs[_0xad69('0x4d')](_0xfacb98[_0xad69('0x47')][_0xad69('0x4d')]));_0x3680f0['attributes']=_0x3680f0[_0xad69('0x4b')]['length']?_0x3680f0[_0xad69('0x4b')]:_0x81a8f4[_0xad69('0x4c')];_0x3680f0[_0xad69('0x4f')]=qs[_0xad69('0x50')](_0xfacb98[_0xad69('0x47')][_0xad69('0x50')]);_0x3680f0[_0xad69('0x54')]=qs[_0xad69('0x49')](_[_0xad69('0x51')](_0xfacb98['query'],_0x81a8f4[_0xad69('0x49')]));if(_0xfacb98[_0xad69('0x47')][_0xad69('0x52')]){_0x3680f0[_0xad69('0x54')]=_[_0xad69('0x53')](_0x3680f0[_0xad69('0x54')],{'$or':_['map'](_0x3680f0[_0xad69('0x4b')],function(_0x5c6bcd){var _0x2ac800={};_0x2ac800[_0x5c6bcd]={'$like':'%'+_0xfacb98['query'][_0xad69('0x52')]+'%'};return _0x2ac800;})});}_0x3680f0=_[_0xad69('0x53')]({},_0x3680f0,_0xfacb98[_0xad69('0x56')]);return _0x5819d3[_0xad69('0x87')](_0x3680f0);}})[_0xad69('0x37')](function(_0x3c0247){if(_0x3c0247){_0xf9dedb=_0x3c0247[_0xad69('0x5c')];if(!_0xfacb98[_0xad69('0x47')][_0xad69('0x6a')](_0xad69('0x4e'))){_0x3680f0[_0xad69('0x2f')]=qs[_0xad69('0x2f')](_0xfacb98[_0xad69('0x47')]['limit']);_0x3680f0['offset']=qs[_0xad69('0x31')](_0xfacb98[_0xad69('0x47')]['offset']);}return _0x5819d3[_0xad69('0x87')](_0x3680f0);}})[_0xad69('0x37')](function(_0x17e6ba){if(_0x17e6ba){return _0x17e6ba?{'count':_0xf9dedb,'rows':_0x17e6ba}:null;}})[_0xad69('0x37')](respondWithResult(_0xbc93e8,null))[_0xad69('0x2b')](handleError(_0xbc93e8,null));};function Extension(_0x46161a,_0x1dcecd,_0x55f479,_0x537631){this[_0xad69('0x88')]=_0xad69('0x89');this[_0xad69('0x8a')]=_0x46161a[_0xad69('0x8b')];this[_0xad69('0x8c')]=_0x537631;this[_0xad69('0x44')]=_0xad69('0x8d');this[_0xad69('0x8e')]=_0xad69('0x8f');this[_0xad69('0x6b')]=_0x46161a['id'];this[_0xad69('0x85')]=_0x1dcecd;this[_0xad69('0x90')]=_0x55f479;}function createExtensionsReciveFax(_0x5240e2){var _0x5ebc9c=0x1;var _0xc76d75=[];_0xc76d75['push'](new Extension(_0x5240e2,_0x5ebc9c,'',_0xad69('0x91')));_0x5ebc9c+=0x1;_0xc76d75[_0xad69('0x92')](new Extension(_0x5240e2,_0x5ebc9c,_0xad69('0x93'),_0xad69('0x94')));_0x5ebc9c+=0x1;for(var _0x4a4baa in _0x5240e2){if(_0x5240e2[_0xad69('0x6a')](_0x4a4baa)&&(_0x4a4baa==='ecm'||_0x4a4baa==='localstationid'||_0x4a4baa===_0xad69('0x95')||_0x4a4baa==='faxdetect'||_0x4a4baa===_0xad69('0x96')||_0x4a4baa===_0xad69('0x97')||_0x4a4baa===_0xad69('0x98')||_0x4a4baa===_0xad69('0x99')||_0x4a4baa==='t38timeout')){_0xc76d75[_0xad69('0x92')](new Extension(_0x5240e2,_0x5ebc9c,_0xad69('0x9a')+_0x4a4baa+')='+_0x5240e2[_0x4a4baa],'Set'));_0x5ebc9c+=0x1;}}_0xc76d75[_0xad69('0x92')](new Extension(_0x5240e2,_0x5ebc9c,'6',_0xad69('0x9b')));_0x5ebc9c+=0x1;_0xc76d75[_0xad69('0x92')](new Extension(_0x5240e2,_0x5ebc9c,'/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d',_0xad69('0x9c')));_0x5ebc9c=0x0;return _0xc76d75;}exports[_0xad69('0x9d')]=function(_0x45d330,_0x2f90f7,_0x28b476){var _0x6f0060;return db['sequelize'][_0xad69('0x80')](function(_0x22565d){return db['FaxAccount'][_0xad69('0x63')](_0x45d330['body'],{'transaction':_0x22565d})['then'](function(_0x1dfd6d){_0x6f0060=_0x1dfd6d['get']({'plain':!![]});return db[_0xad69('0x9e')][_0xad69('0x84')](createExtensionsReciveFax(_0x6f0060),{'transaction':_0x22565d});});})[_0xad69('0x37')](function(){return _0x6f0060;})[_0xad69('0x37')](respondWithResult(_0x2f90f7,null))[_0xad69('0x2b')](handleError(_0x2f90f7,null));};exports[_0xad69('0x9f')]=function(_0x14ad5f,_0x15d186,_0x4016af){var _0xa11f3e;return db[_0xad69('0x7f')][_0xad69('0x80')](function(_0x1b0b60){return db[_0xad69('0x42')][_0xad69('0x36')](_0x14ad5f[_0xad69('0x5e')],{'where':{'id':_0x14ad5f['body']['id']},'transaction':_0x1b0b60})[_0xad69('0x37')](function(_0x14b057){return db[_0xad69('0x9e')][_0xad69('0x38')]({'where':{'FaxAccountId':_0x14ad5f[_0xad69('0x5e')]['id']},'transaction':_0x1b0b60})[_0xad69('0x37')](function(_0x3f3824){return db[_0xad69('0x9e')]['bulkCreate'](createExtensionsReciveFax(_[_0xad69('0xa0')](_0x14ad5f[_0xad69('0x5e')],[_0xad69('0xa1'),_0xad69('0x45'),_0xad69('0xa2'),_0xad69('0xa3'),_0xad69('0xa4'),_0xad69('0xa5')])),{'transaction':_0x1b0b60});});});})[_0xad69('0x37')](function(){return db[_0xad69('0x42')][_0xad69('0xa6')](_0x14ad5f[_0xad69('0x5e')]['id']);})[_0xad69('0x37')](respondWithResult(_0x15d186,null))['catch'](handleError(_0x15d186,null));};exports['getMessages']=function(_0x338c09,_0x29b7c4,_0x5e981c){var _0x505ce2={'raw':!![],'where':{}};var _0x21066f={};var _0x88fa22={'count':0x0,'rows':[]};return db[_0xad69('0x42')][_0xad69('0x69')]({'where':{'id':_0x338c09['params']['id']}})['then'](handleEntityNotFound(_0x29b7c4,null))['then'](function(_0x3288ed){if(_0x3288ed){_0x21066f[_0xad69('0x4c')]=_[_0xad69('0x48')](db[_0xad69('0xa7')]['rawAttributes']);_0x21066f[_0xad69('0x47')]=_['keys'](_0x338c09[_0xad69('0x47')]);_0x21066f[_0xad69('0x49')]=_[_0xad69('0x4a')](_0x21066f[_0xad69('0x4c')],_0x21066f[_0xad69('0x47')]);_0x505ce2[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x21066f[_0xad69('0x4c')],qs[_0xad69('0x4d')](_0x338c09[_0xad69('0x47')][_0xad69('0x4d')]));_0x505ce2['attributes']=_0x505ce2[_0xad69('0x4b')][_0xad69('0x5c')]?_0x505ce2[_0xad69('0x4b')]:_0x21066f[_0xad69('0x4c')];if(!_0x338c09[_0xad69('0x47')][_0xad69('0x6a')]('nolimit')){_0x505ce2[_0xad69('0x2f')]=qs[_0xad69('0x2f')](_0x338c09[_0xad69('0x47')][_0xad69('0x2f')]);_0x505ce2[_0xad69('0x31')]=qs[_0xad69('0x31')](_0x338c09[_0xad69('0x47')][_0xad69('0x31')]);}_0x505ce2['order']=qs[_0xad69('0x50')](_0x338c09['query'][_0xad69('0x50')]);_0x505ce2[_0xad69('0x54')]=qs[_0xad69('0x49')](_[_0xad69('0x51')](_0x338c09[_0xad69('0x47')],_0x21066f[_0xad69('0x49')]));_0x505ce2[_0xad69('0x54')][_0xad69('0x6b')]=_0x3288ed['id'];if(_0x338c09['query']['filter']){_0x505ce2['where']=_[_0xad69('0x53')](_0x505ce2['where'],{'$or':_[_0xad69('0x46')](_0x505ce2['attributes'],function(_0x2492fc){var _0x4d7b48={};_0x4d7b48[_0x2492fc]={'$like':'%'+_0x338c09['query'][_0xad69('0x52')]+'%'};return _0x4d7b48;})});}if(_0x338c09['query'][_0xad69('0xa8')]){var _0x2b33e9=_0x338c09[_0xad69('0x47')][_0xad69('0xa8')]['split'](',');var _0x51443c={};_0x51443c[_0x2b33e9[0x0]]={'$gte':moment(_0x2b33e9[0x1])[_0xad69('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x505ce2[_0xad69('0x54')]=_[_0xad69('0x53')](_0x505ce2[_0xad69('0x54')],_0x51443c);}_0x505ce2=_[_0xad69('0x53')]({},_0x505ce2,_0x338c09[_0xad69('0x56')]);return db[_0xad69('0xa7')][_0xad69('0x30')]({'where':_0x505ce2[_0xad69('0x54')]})[_0xad69('0x37')](function(_0x168fcd){_0x88fa22[_0xad69('0x30')]=_0x168fcd;if(_0x338c09['query'][_0xad69('0x57')]){_0x505ce2['include']=[{'all':!![]}];}return db[_0xad69('0xa7')]['findAll'](_0x505ce2);})[_0xad69('0x37')](function(_0x3a0dd1){_0x88fa22['rows']=_0x3a0dd1;return _0x88fa22;});}})[_0xad69('0x37')](respondWithFilteredResult(_0x29b7c4,_0x505ce2))['catch'](handleError(_0x29b7c4,null));};exports[_0xad69('0xaa')]=function(_0x43d550,_0x44e4c4,_0x4598a7){var _0x41e6e2,_0x5183be={},_0x5c9400;if(_0x43d550['body']['to']){_0x5c9400=_0x43d550[_0xad69('0x5e')]['to'][0x0];}return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x43d550[_0xad69('0x65')]['id']},'include':[{'model':db[_0xad69('0xab')],'as':_0xad69('0xac'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x5c9400},'limit':0x1,'order':[[_0xad69('0xa3'),_0xad69('0xad')]]}]}]})[_0xad69('0x37')](handleEntityNotFound(_0x44e4c4,null))[_0xad69('0x37')](function(_0x37fa54){_0x41e6e2=_0x37fa54;if(_0x43d550[_0xad69('0x5e')][_0xad69('0xae')]&&_0x43d550[_0xad69('0x5e')]['attachments'][_0xad69('0x5c')]){for(var _0x29b567=0x0;_0x29b567<_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][_0xad69('0x5c')];_0x29b567+=0x1){_0x43d550[_0xad69('0x5e')]['attachments'][_0x29b567]={'filename':_0x43d550[_0xad69('0x5e')]['attachments'][_0x29b567][_0xad69('0x3e')],'id':_0x43d550[_0xad69('0x5e')]['attachments'][_0x29b567]['id'],'path':path[_0xad69('0xaf')](config[_0xad69('0xb0')],_0xad69('0xb1'),_0x43d550['body']['attachments'][_0x29b567][_0xad69('0xb2')])};}}return respondWithRpcPromise('CheckAfterSend',_0xad69('0xb3'),{'FaxAccountId':_['isNil'](_0x43d550[_0xad69('0x65')]['id'])?undefined:_0x43d550[_0xad69('0x65')]['id'],'path':_[_0xad69('0xb4')](_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][0x0][_0xad69('0x6')])?undefined:_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][0x0][_0xad69('0x6')],'fax':_[_0xad69('0xb4')](_0x43d550[_0xad69('0x5e')]['to'][0x0])?undefined:_0x43d550[_0xad69('0x5e')]['to'][0x0]},client9002);})[_0xad69('0x37')](function(){if(_0x41e6e2){if(_['isNil'](_0x43d550[_0xad69('0x5e')][_0xad69('0xb5')])){_0x43d550[_0xad69('0x5e')]['from']=util[_0xad69('0xa9')](_0xad69('0xb6'),_0x41e6e2['name'],_0x41e6e2[_0xad69('0xb7')]);}if(_0x41e6e2[_0xad69('0xac')]){if(_0x41e6e2['List'][_0xad69('0xb8')][_0xad69('0x5c')]){return _0x41e6e2[_0xad69('0xac')]['Contacts'][0x0];}else{return db[_0xad69('0xb9')]['create'](_[_0xad69('0x1a')](_0x43d550[_0xad69('0x5e')],{'firstName':_0x43d550[_0xad69('0x5e')]['to'][0x0],'phone':_0x43d550[_0xad69('0x5e')]['to'][0x0],'fax':_0x43d550[_0xad69('0x5e')]['to'][0x0],'ListId':_0x41e6e2[_0xad69('0xa5')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xad69('0xba'));}})['then'](function(_0x4a065a){if(_0x4a065a){return db[_0xad69('0x73')]['find']({'where':{'ContactId':_0x4a065a['id'],'closed':![],'FaxAccountId':_0x41e6e2['id']}})[_0xad69('0x37')](function(_0x54faf3){if(_0x54faf3){return[_0x54faf3,![]];}return db[_0xad69('0x73')][_0xad69('0x63')]({'UserId':_0x43d550[_0xad69('0x60')]['id'],'ContactId':_0x4a065a['id'],'FaxAccountId':_0x41e6e2['id'],'fax':_0x43d550[_0xad69('0x5e')]['to'][0x0],'firstMsgDirection':_0xad69('0xbb'),'Messages':[_[_0xad69('0x53')](_0x43d550[_0xad69('0x5e')],{'read':![],'body':_0x43d550[_0xad69('0x5e')]['attachments'][0x0][_0xad69('0xbc')],'FaxAccountId':_0x41e6e2['id'],'UserId':_0x43d550[_0xad69('0x60')]['id'],'ContactId':_0x4a065a['id'],'AttachmentId':_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][0x0]['id']})]},{'include':[{'model':db[_0xad69('0xa7')],'as':_0xad69('0xbd')}]})[_0xad69('0x37')](function(_0x3c40cf){return[_0x3c40cf,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2c62bf,_0x58412e){if(_0x58412e){return _0x2c62bf;}return db[_0xad69('0xa7')][_0xad69('0x63')]({'direction':_0xad69('0xbb'),'read':![],'body':_0x43d550[_0xad69('0x5e')][_0xad69('0xae')][0x0]['filename'],'FaxAccountId':_0x41e6e2['id'],'FaxInteractionId':_0x2c62bf['id'],'UserId':_0x43d550['user']['id'],'ContactId':_0x2c62bf[_0xad69('0xbe')],'AttachmentId':_0x43d550[_0xad69('0x5e')]['attachments'][0x0]['id']})[_0xad69('0x37')](function(_0x26ee30){_0x2c62bf[_0xad69('0xbf')][_0xad69('0xbd')]=[];_0x2c62bf[_0xad69('0xbf')][_0xad69('0xbd')][_0xad69('0x92')](_0x26ee30[_0xad69('0xbf')]);return _0x2c62bf;});})['then'](function(_0x532a17){respondWithRpcPromise(_0xad69('0xc0'),_0xad69('0xc0'),{'FaxAccountId':_['isNil'](_0x43d550[_0xad69('0x65')]['id'])?undefined:_0x43d550['params']['id'],'path':_[_0xad69('0xb4')](_0x43d550[_0xad69('0x5e')]['attachments'][0x0][_0xad69('0x6')])?undefined:_0x43d550['body']['attachments'][0x0][_0xad69('0x6')],'fax':_[_0xad69('0xb4')](_0x43d550[_0xad69('0x5e')]['to'][0x0])?undefined:_0x43d550[_0xad69('0x5e')]['to'][0x0],'AttachmentId':_0x43d550[_0xad69('0x5e')]['attachments'][0x0]['id']},client9002)[_0xad69('0x37')](function(_0x24fbe1){logger['info'](_0xad69('0xc1'),_0x24fbe1);})[_0xad69('0x2b')](function(_0x3ea3f5){logger[_0xad69('0x22')]('SendFaxRpc,\x20%s',_0x3ea3f5);});return _0x532a17;})[_0xad69('0x37')](respondWithResult(_0x44e4c4,null))[_0xad69('0x2b')](handleError(_0x44e4c4,null));};exports['addAgents']=function(_0x29f668,_0x4b28ad,_0xc5fa6c){return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x29f668['params']['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x4b28ad,null))[_0xad69('0x37')](function(_0x4a1856){if(_0x4a1856){return _0x4a1856[_0xad69('0xc2')](_0x29f668[_0xad69('0x5e')]['ids'],_[_0xad69('0xa0')](_0x29f668['body'],['ids','id'])||{})[_0xad69('0xc3')](function(_0x3ac5df){for(var _0x5ef170=0x0;_0x5ef170<_0x29f668[_0xad69('0x5e')]['ids'][_0xad69('0x5c')];_0x5ef170+=0x1){socket[_0xad69('0xc4')](_0xad69('0xc5'),{'UserId':Number(_0x29f668[_0xad69('0x5e')][_0xad69('0x6e')][_0x5ef170]),'FaxAccountId':Number(_0x29f668['params']['id'])});}return _0x3ac5df;});}})['then'](respondWithResult(_0x4b28ad,null))[_0xad69('0x2b')](handleError(_0x4b28ad,null));};exports[_0xad69('0xc6')]=function(_0x10ee13,_0x55b6ad,_0x39efe8){return db[_0xad69('0x42')][_0xad69('0x5d')]({'where':{'id':_0x10ee13[_0xad69('0x65')]['id']}})[_0xad69('0x37')](handleEntityNotFound(_0x55b6ad,null))['then'](function(_0x4e073b){if(_0x4e073b){return _0x4e073b[_0xad69('0xc6')](_0x10ee13['query'][_0xad69('0x6e')])[_0xad69('0x37')](function(){if(_[_0xad69('0xc7')](_0x10ee13[_0xad69('0x47')][_0xad69('0x6e')])){for(var _0x47d467=0x0;_0x47d467<_0x10ee13[_0xad69('0x47')][_0xad69('0x6e')][_0xad69('0x5c')];_0x47d467+=0x1){socket['emit'](_0xad69('0xc8'),{'UserId':Number(_0x10ee13[_0xad69('0x47')][_0xad69('0x6e')][_0x47d467]),'FaxAccountId':Number(_0x10ee13[_0xad69('0x65')]['id'])});}}else{socket[_0xad69('0xc4')](_0xad69('0xc8'),{'UserId':Number(_0x10ee13[_0xad69('0x47')]['ids']),'FaxAccountId':Number(_0x10ee13[_0xad69('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x55b6ad,null))[_0xad69('0x2b')](handleError(_0x55b6ad,null));};exports['getAgents']=function(_0x3e3194,_0xc84963,_0x287778){var _0x28c8f0={};var _0x2fe1ad={};var _0x29d618;var _0x2d624;return db[_0xad69('0x42')]['findOne']({'where':{'id':_0x3e3194[_0xad69('0x65')]['id']}})['then'](handleEntityNotFound(_0xc84963,null))[_0xad69('0x37')](function(_0x9e4634){if(_0x9e4634){_0x29d618=_0x9e4634;_0x2fe1ad[_0xad69('0x4c')]=_[_0xad69('0x48')](db[_0xad69('0x76')]['rawAttributes']);_0x2fe1ad[_0xad69('0x47')]=_[_0xad69('0x48')](_0x3e3194[_0xad69('0x47')]);_0x2fe1ad[_0xad69('0x49')]=_['intersection'](_0x2fe1ad[_0xad69('0x4c')],_0x2fe1ad[_0xad69('0x47')]);_0x28c8f0[_0xad69('0x4b')]=_[_0xad69('0x4a')](_0x2fe1ad[_0xad69('0x4c')],qs['fields'](_0x3e3194['query'][_0xad69('0x4d')]));_0x28c8f0[_0xad69('0x4b')]=_0x28c8f0[_0xad69('0x4b')][_0xad69('0x5c')]?_0x28c8f0[_0xad69('0x4b')]:_0x2fe1ad[_0xad69('0x4c')];_0x28c8f0[_0xad69('0x4f')]=qs[_0xad69('0x50')](_0x3e3194[_0xad69('0x47')][_0xad69('0x50')]);_0x28c8f0[_0xad69('0x54')]=qs[_0xad69('0x49')](_[_0xad69('0x51')](_0x3e3194[_0xad69('0x47')],_0x2fe1ad['filters']));if(_0x3e3194[_0xad69('0x47')][_0xad69('0x52')]){_0x28c8f0['where']=_[_0xad69('0x53')](_0x28c8f0[_0xad69('0x54')],{'$or':_[_0xad69('0x46')](_0x28c8f0['attributes'],function(_0xa9ff19){var _0x37ae1c={};_0x37ae1c[_0xa9ff19]={'$like':'%'+_0x3e3194[_0xad69('0x47')][_0xad69('0x52')]+'%'};return _0x37ae1c;})});}_0x28c8f0=_[_0xad69('0x53')]({},_0x28c8f0,_0x3e3194[_0xad69('0x56')]);return _0x29d618[_0xad69('0xc9')](_0x28c8f0);}})['then'](function(_0x3513f6){if(_0x3513f6){_0x2d624=_0x3513f6[_0xad69('0x5c')];if(!_0x3e3194[_0xad69('0x47')][_0xad69('0x6a')](_0xad69('0x4e'))){_0x28c8f0['limit']=qs['limit'](_0x3e3194['query'][_0xad69('0x2f')]);_0x28c8f0['offset']=qs[_0xad69('0x31')](_0x3e3194['query'][_0xad69('0x31')]);}return _0x29d618[_0xad69('0xc9')](_0x28c8f0);}})[_0xad69('0x37')](function(_0x76a197){if(_0x76a197){return _0x76a197?{'count':_0x2d624,'rows':_0x76a197}:null;}})['then'](respondWithResult(_0xc84963,null))['catch'](handleError(_0xc84963,null));};
\ No newline at end of file
index 87a3655..6c1a12a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe864=['hook','../../mysqldb','FaxAccount','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x3ff5df,_0x50ef34){var _0x1284c0=function(_0x2ac0c8){while(--_0x2ac0c8){_0x3ff5df['push'](_0x3ff5df['shift']());}};_0x1284c0(++_0x50ef34);}(_0xe864,0x1c1));var _0x4e86=function(_0x3c3b05,_0x25a986){_0x3c3b05=_0x3c3b05-0x0;var _0x367c9c=_0xe864[_0x3c3b05];return _0x367c9c;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x4e86('0x0'))['db'][_0x4e86('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x4e86('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4e86('0x3'),'afterDestroy':_0x4e86('0x4')};function emitEvent(_0x123bbc){return function(_0x4a492f,_0x557fb8,_0x4bd77){FaxAccountEvents['emit'](_0x123bbc+':'+_0x4a492f['id'],_0x4a492f);FaxAccountEvents['emit'](_0x123bbc,_0x4a492f);_0x4bd77(null);};}for(var e in events){if(events[_0x4e86('0x5')](e)){var event=events[e];FaxAccount[_0x4e86('0x6')](e,emitEvent(event));}}module['exports']=FaxAccountEvents;
\ No newline at end of file
+var _0xd01c=['../../mysqldb','FaxAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x50aab5,_0x58761d){var _0x1a817a=function(_0x46b9ae){while(--_0x46b9ae){_0x50aab5['push'](_0x50aab5['shift']());}};_0x1a817a(++_0x58761d);}(_0xd01c,0xfb));var _0xcd01=function(_0x133918,_0x545ebd){_0x133918=_0x133918-0x0;var _0x137308=_0xd01c[_0x133918];return _0x137308;};'use strict';var EventEmitter=require(_0xcd01('0x0'));var FaxAccount=require(_0xcd01('0x1'))['db'][_0xcd01('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xcd01('0x3')](0x0);var events={'afterCreate':_0xcd01('0x4'),'afterUpdate':'update','afterDestroy':_0xcd01('0x5')};function emitEvent(_0x16466f){return function(_0x407055,_0x57fb31,_0x298492){FaxAccountEvents[_0xcd01('0x6')](_0x16466f+':'+_0x407055['id'],_0x407055);FaxAccountEvents[_0xcd01('0x6')](_0x16466f,_0x407055);_0x298492(null);};}for(var e in events){if(events[_0xcd01('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xcd01('0x8')]=FaxAccountEvents;
\ No newline at end of file
index 53b84c8..b183c9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc59=['define','fax_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xdc59,0x154));var _0x9dc5=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xdc59[_0x4b91c4];return _0x25cb80;};'use strict';var _=require(_0x9dc5('0x0'));var util=require(_0x9dc5('0x1'));var logger=require(_0x9dc5('0x2'))(_0x9dc5('0x3'));var moment=require(_0x9dc5('0x4'));var BPromise=require(_0x9dc5('0x5'));var rp=require(_0x9dc5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9dc5('0x7'));var config=require(_0x9dc5('0x8'));var attributes=require(_0x9dc5('0x9'));module[_0x9dc5('0xa')]=function(_0x1c53ef,_0x409343){return _0x1c53ef[_0x9dc5('0xb')]('FaxAccount',attributes,{'tableName':_0x9dc5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xce8a=['util','moment','bluebird','rimraf','../../config/environment','./faxAccount.attributes','define','FaxAccount','fax_accounts'];(function(_0x2cadb3,_0x42a762){var _0x4144b4=function(_0x44b69d){while(--_0x44b69d){_0x2cadb3['push'](_0x2cadb3['shift']());}};_0x4144b4(++_0x42a762);}(_0xce8a,0xfc));var _0xace8=function(_0x3968c4,_0xc70dd3){_0x3968c4=_0x3968c4-0x0;var _0x30ba6f=_0xce8a[_0x3968c4];return _0x30ba6f;};'use strict';var _=require('lodash');var util=require(_0xace8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xace8('0x1'));var BPromise=require(_0xace8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xace8('0x3'));var config=require(_0xace8('0x4'));var attributes=require(_0xace8('0x5'));module['exports']=function(_0x2be4b1,_0x2f0d49){return _0x2be4b1[_0xace8('0x6')](_0xace8('0x7'),attributes,{'tableName':_0xace8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 956b8a4..3641e79 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4bc4=['find','CmList','List','Contacts','FaxApplication','Applications','get','list','orderBy','applications','asc','account','length','create','contact','FaxInteraction','Contact\x20not\x20found','spread','unmanaged','*,*,*,*','created','interaction','FaxMessage','UserId','unshift','agent','name','waitForTheAssignedAgent','queueId','queue','Start','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','GetFaxAccount','FaxAccount','findAll','options','where','attributes','include','map','model','then','catch','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0x4bc4,0x173));var _0x44bc=function(_0x1230d8,_0x331591){_0x1230d8=_0x1230d8-0x0;var _0x1e17cf=_0x4bc4[_0x1230d8];return _0x1e17cf;};'use strict';var _=require('lodash');var util=require(_0x44bc('0x0'));var moment=require(_0x44bc('0x1'));var BPromise=require('bluebird');var rs=require(_0x44bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44bc('0x3'))['db'];var utils=require(_0x44bc('0x4'));var logger=require('../../config/logger')(_0x44bc('0x5'));var config=require('../../config/environment');var jayson=require(_0x44bc('0x6'));var client=jayson[_0x44bc('0x7')][_0x44bc('0x8')]({'port':0x232c});config[_0x44bc('0x9')]=_[_0x44bc('0xa')](config[_0x44bc('0x9')],{'host':_0x44bc('0xb'),'port':0x18eb});var socket=require(_0x44bc('0xc'))(new Redis(config[_0x44bc('0x9')]));require('./faxAccount.socket')[_0x44bc('0xd')](socket);function respondWithRpcPromise(_0x116f1e,_0x2d09e2,_0x5a1207){return new BPromise(function(_0x31c822,_0x43fd71){return client[_0x44bc('0xe')](_0x116f1e,_0x5a1207)['then'](function(_0x227a8b){logger[_0x44bc('0xf')]('FaxAccount,\x20%s,\x20%s',_0x2d09e2,_0x44bc('0x10'));logger[_0x44bc('0x11')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2d09e2,_0x44bc('0x10'),JSON[_0x44bc('0x12')](_0x227a8b));if(_0x227a8b[_0x44bc('0x13')]){if(_0x227a8b['error'][_0x44bc('0x14')]===0x1f4){logger[_0x44bc('0x13')](_0x44bc('0x15'),_0x2d09e2,_0x227a8b['error'][_0x44bc('0x16')]);return _0x43fd71(_0x227a8b[_0x44bc('0x13')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x2d09e2,_0x227a8b['error']['message']);return _0x31c822(_0x227a8b[_0x44bc('0x13')]['message']);}else{logger[_0x44bc('0xf')]('FaxAccount,\x20%s,\x20%s',_0x2d09e2,_0x44bc('0x10'));_0x31c822(_0x227a8b['result'][_0x44bc('0x16')]);}})['catch'](function(_0x3dea00){logger[_0x44bc('0x13')](_0x44bc('0x15'),_0x2d09e2,_0x3dea00);_0x43fd71(_0x3dea00);});});}exports[_0x44bc('0x17')]=function(_0x61c3d4){var _0x3b0141=this;return new Promise(function(_0x4eda1,_0x3c36a7){return db[_0x44bc('0x18')][_0x44bc('0x19')]({'raw':_0x61c3d4[_0x44bc('0x1a')]?_0x61c3d4['options']['raw']===undefined?!![]:![]:!![],'where':_0x61c3d4[_0x44bc('0x1a')]?_0x61c3d4[_0x44bc('0x1a')][_0x44bc('0x1b')]||null:null,'attributes':_0x61c3d4[_0x44bc('0x1a')]?_0x61c3d4[_0x44bc('0x1a')][_0x44bc('0x1c')]||null:null,'limit':_0x61c3d4[_0x44bc('0x1a')]?_0x61c3d4[_0x44bc('0x1a')]['limit']||null:null,'include':_0x61c3d4[_0x44bc('0x1a')]?_0x61c3d4[_0x44bc('0x1a')][_0x44bc('0x1d')]?_['map'](_0x61c3d4[_0x44bc('0x1a')][_0x44bc('0x1d')],function(_0x2c67fd){return{'model':db[_0x2c67fd['model']],'as':_0x2c67fd['as'],'attributes':_0x2c67fd['attributes'],'include':_0x2c67fd[_0x44bc('0x1d')]?_[_0x44bc('0x1e')](_0x2c67fd['include'],function(_0x552a6e){return{'model':db[_0x552a6e[_0x44bc('0x1f')]],'as':_0x552a6e['as'],'attributes':_0x552a6e[_0x44bc('0x1c')],'include':_0x552a6e[_0x44bc('0x1d')]?_[_0x44bc('0x1e')](_0x552a6e[_0x44bc('0x1d')],function(_0x1640da){return{'model':db[_0x1640da['model']],'as':_0x1640da['as'],'attributes':_0x1640da['attributes']};}):[]};}):[]};}):[]:[]})[_0x44bc('0x20')](function(_0x17ef47){logger[_0x44bc('0xf')](_0x44bc('0x17'),_0x61c3d4);logger[_0x44bc('0x11')](_0x44bc('0x17'),_0x61c3d4,JSON[_0x44bc('0x12')](_0x17ef47));_0x4eda1(_0x17ef47);})[_0x44bc('0x21')](function(_0x448de7){logger[_0x44bc('0x13')](_0x44bc('0x17'),_0x448de7[_0x44bc('0x16')],_0x61c3d4);_0x3c36a7(_0x3b0141['error'](0x1f4,_0x448de7[_0x44bc('0x16')]));});});};exports[_0x44bc('0x22')]=function(_0x3556a0,_0x5be152,_0x3f2c51){var _0x291240=this;return new Promise(function(_0x3401c8,_0x4ae028){var _0x7ba9e8={'body':_0x3556a0[_0x44bc('0x23')],'channel':_0x44bc('0x24')};var _0x25cb20=[];var _0x37a4e5=[];var _0x441786={};return db[_0x44bc('0x25')][_0x44bc('0x26')]()[_0x44bc('0x20')](function(_0x3b32bb){if(!_0x3b32bb){throw new db[(_0x44bc('0x27'))][(_0x44bc('0x28'))](_0x44bc('0x29'));}_0x25cb20=_[_0x44bc('0x2a')](_['keys'](_0x3b32bb),['createdAt',_0x44bc('0x2b')]);_0x37a4e5=_['difference'](_[_0x44bc('0x2c')](_0x3b32bb),['createdAt','updatedAt',_0x44bc('0x2d'),_0x44bc('0x2e')]);if(_0x3556a0[_0x44bc('0x23')]['id']){delete _0x3556a0[_0x44bc('0x23')]['id'];}if(_[_0x44bc('0x2f')](_0x3556a0['body'][_0x44bc('0x30')])){throw new db[(_0x44bc('0x27'))][(_0x44bc('0x28'))](_0x44bc('0x31'));}if(_[_0x44bc('0x2f')](_0x3556a0[_0x44bc('0x23')][_0x44bc('0x23')])||_0x3556a0['body'][_0x44bc('0x23')]===''){throw new db[(_0x44bc('0x27'))][(_0x44bc('0x28'))](_0x44bc('0x32'));}if(_[_0x44bc('0x2f')](_0x3556a0[_0x44bc('0x23')]['mapKey'])){throw new db['Sequelize'][(_0x44bc('0x28'))](_0x44bc('0x33')+_0x37a4e5);}if(!_[_0x44bc('0x34')](_0x37a4e5,_0x3556a0[_0x44bc('0x23')][_0x44bc('0x35')])){throw new db[(_0x44bc('0x27'))][(_0x44bc('0x28'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x37a4e5);}_0x441786[_0x3556a0[_0x44bc('0x23')][_0x44bc('0x35')]]=_0x3556a0[_0x44bc('0x23')]['from'];})[_0x44bc('0x20')](function(){return db[_0x44bc('0x18')][_0x44bc('0x36')]({'where':{'id':_0x3556a0['account']['id']},'include':[{'model':db[_0x44bc('0x37')],'as':_0x44bc('0x38'),'include':[{'model':db['CmContact'],'as':_0x44bc('0x39'),'where':_0x441786,'limit':0x1,'order':[[_0x44bc('0x2b'),'DESC']]}]},{'model':db[_0x44bc('0x3a')],'as':_0x44bc('0x3b')}]});})['then'](function(_0x4b4355){if(_0x4b4355&&_0x4b4355['List']){var _0x5aa4a0=_0x4b4355[_0x44bc('0x3c')]({'plain':!![]});_0x7ba9e8['account']=_0x5aa4a0;_0x7ba9e8['applications']=_0x5aa4a0[_0x44bc('0x3b')];_0x7ba9e8[_0x44bc('0x3d')]=_0x5aa4a0['List'];_0x7ba9e8['applications']=_[_0x44bc('0x3e')](_0x7ba9e8[_0x44bc('0x3f')],['priority'],[_0x44bc('0x40')]);if(_0x7ba9e8[_0x44bc('0x41')]['Applications']){delete _0x7ba9e8[_0x44bc('0x41')][_0x44bc('0x3b')];}if(_0x7ba9e8[_0x44bc('0x41')][_0x44bc('0x38')]&&_0x7ba9e8['account'][_0x44bc('0x38')]['Contacts'][_0x44bc('0x42')]){return _0x7ba9e8[_0x44bc('0x41')]['List'][_0x44bc('0x39')][0x0];}var _0x3db00f=_[_0x44bc('0xa')](_0x3556a0[_0x44bc('0x23')],{'firstName':_0x3556a0[_0x44bc('0x23')][_0x44bc('0x30')],'ListId':_0x5aa4a0[_0x44bc('0x2e')]});_0x3db00f[_0x3556a0['body'][_0x44bc('0x35')]]=_0x3556a0[_0x44bc('0x23')][_0x44bc('0x30')];return db[_0x44bc('0x25')][_0x44bc('0x43')](_0x3db00f,{'fields':_0x25cb20,'raw':!![]});}})[_0x44bc('0x20')](function(_0x56faa8){_0x7ba9e8[_0x44bc('0x44')]=_0x56faa8;if(_0x56faa8){var _0x2305cc={'ContactId':_0x56faa8['id'],'FaxAccountId':_0x3556a0['account']['id'],'fax':_0x56faa8[_0x44bc('0x24')]};return db[_0x44bc('0x45')][_0x44bc('0x36')]({'where':{'ContactId':_0x56faa8['id'],'closed':![],'FaxAccountId':_0x3556a0['account']['id']}})[_0x44bc('0x20')](function(_0xb0c153){if(_0xb0c153){return[_0xb0c153,![]];}return db[_0x44bc('0x45')][_0x44bc('0x43')](_0x2305cc)[_0x44bc('0x20')](function(_0x17139b){return[_0x17139b,!![]];});});}else{throw new Error(_0x44bc('0x46'));}})[_0x44bc('0x47')](function(_0x221843,_0x21435a){var _0x20af16=_0x221843[_0x44bc('0x3c')]({'plain':!![]});if(_0x21435a){if(_0x7ba9e8[_0x44bc('0x41')]['autoclose']){_0x7ba9e8[_0x44bc('0x3f')]['push']({'id':0x0,'priority':_0x7ba9e8[_0x44bc('0x3f')][_0x44bc('0x42')]+0x1,'app':'close','appdata':_0x44bc('0x48'),'interval':_0x44bc('0x49')});}_0x20af16[_0x44bc('0x4a')]=!![];}else{_0x20af16[_0x44bc('0x4a')]=![];}_0x7ba9e8[_0x44bc('0x4b')]=_0x20af16;return db[_0x44bc('0x4c')][_0x44bc('0x43')]({'body':_0x3556a0[_0x44bc('0x23')][_0x44bc('0x23')],'FaxAccountId':_0x3556a0[_0x44bc('0x41')]['id'],'FaxInteractionId':_0x221843['id'],'direction':'in','ContactId':_0x221843['ContactId'],'AttachmentId':_0x3556a0[_0x44bc('0x23')]['AttachmentId']});})[_0x44bc('0x20')](function(_0x2fa72d){_0x7ba9e8[_0x44bc('0x16')]=_0x2fa72d;if(!_0x7ba9e8[_0x44bc('0x4b')][_0x44bc('0x4d')])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x7ba9e8[_0x44bc('0x4b')][_0x44bc('0x4d')]}});})[_0x44bc('0x20')](function(_0x555c5c){if(_0x555c5c){_0x7ba9e8[_0x44bc('0x3f')][_0x44bc('0x4e')]({'id':0x0,'priority':0x0,'app':_0x44bc('0x4f'),'appdata':_0x555c5c[_0x44bc('0x50')]+','+(_0x7ba9e8[_0x44bc('0x41')][_0x44bc('0x51')]||0xa),'interval':_0x44bc('0x49')});}if(!_0x7ba9e8[_0x44bc('0x4b')]['queueId'])return;return db['FaxQueue'][_0x44bc('0x36')]({'attributes':['id','name'],'where':{'id':_0x7ba9e8[_0x44bc('0x4b')][_0x44bc('0x52')]}});})['then'](function(_0x2d3c45){if(_0x2d3c45){_0x7ba9e8[_0x44bc('0x3f')][_0x44bc('0x4e')]({'id':0x0,'priority':0x1,'app':_0x44bc('0x53'),'appdata':_0x2d3c45[_0x44bc('0x50')]+','+(_0x7ba9e8[_0x44bc('0x41')]['waitForTheAssignedQueue']||0x12c),'interval':_0x44bc('0x49')});}return respondWithRpcPromise(_0x44bc('0x54'),'startRouting',_0x7ba9e8);})[_0x44bc('0x20')](function(_0x197721){_0x3401c8(_0x197721);})[_0x44bc('0x21')](function(_0x3e30b7){_0x4ae028(_0x291240[_0x44bc('0x13')](0x1f4,_0x3e30b7[_0x44bc('0x16')]));});});};
\ No newline at end of file
+var _0xcb72=['queue','Start','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','FaxAccount','findAll','options','raw','attributes','include','map','model','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','CmContact','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','CompanyId','ListId','isNil','from','ValidationError','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','find','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','account','Contacts','length','defaults','create','contact','FaxInteraction','spread','autoclose','push','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','interaction','name','UserId','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue'];(function(_0x631b42,_0x1eabda){var _0x251d91=function(_0x196bc9){while(--_0x196bc9){_0x631b42['push'](_0x631b42['shift']());}};_0x251d91(++_0x1eabda);}(_0xcb72,0xbc));var _0x2cb7=function(_0x50bf2d,_0xb39881){_0x50bf2d=_0x50bf2d-0x0;var _0x340911=_0xcb72[_0x50bf2d];return _0x340911;};'use strict';var _=require(_0x2cb7('0x0'));var util=require(_0x2cb7('0x1'));var moment=require(_0x2cb7('0x2'));var BPromise=require(_0x2cb7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2cb7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2cb7('0x5'));var logger=require(_0x2cb7('0x6'))(_0x2cb7('0x7'));var config=require(_0x2cb7('0x8'));var jayson=require(_0x2cb7('0x9'));var client=jayson[_0x2cb7('0xa')]['http']({'port':0x232c});config[_0x2cb7('0xb')]=_['defaults'](config[_0x2cb7('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2cb7('0xb')]));require('./faxAccount.socket')['register'](socket);function respondWithRpcPromise(_0x1fa57a,_0x5e7292,_0x9ec6c4){return new BPromise(function(_0x295b7c,_0x9594c2){return client[_0x2cb7('0xc')](_0x1fa57a,_0x9ec6c4)[_0x2cb7('0xd')](function(_0xc7f77c){logger['info'](_0x2cb7('0xe'),_0x5e7292,_0x2cb7('0xf'));logger[_0x2cb7('0x10')](_0x2cb7('0x11'),_0x5e7292,'request\x20sent',JSON['stringify'](_0xc7f77c));if(_0xc7f77c[_0x2cb7('0x12')]){if(_0xc7f77c['error'][_0x2cb7('0x13')]===0x1f4){logger[_0x2cb7('0x12')](_0x2cb7('0xe'),_0x5e7292,_0xc7f77c[_0x2cb7('0x12')][_0x2cb7('0x14')]);return _0x9594c2(_0xc7f77c[_0x2cb7('0x12')][_0x2cb7('0x14')]);}logger[_0x2cb7('0x12')](_0x2cb7('0xe'),_0x5e7292,_0xc7f77c[_0x2cb7('0x12')][_0x2cb7('0x14')]);return _0x295b7c(_0xc7f77c[_0x2cb7('0x12')][_0x2cb7('0x14')]);}else{logger[_0x2cb7('0x15')]('FaxAccount,\x20%s,\x20%s',_0x5e7292,_0x2cb7('0xf'));_0x295b7c(_0xc7f77c[_0x2cb7('0x16')][_0x2cb7('0x14')]);}})[_0x2cb7('0x17')](function(_0x1c0ed8){logger[_0x2cb7('0x12')]('FaxAccount,\x20%s,\x20%s',_0x5e7292,_0x1c0ed8);_0x9594c2(_0x1c0ed8);});});}exports['GetFaxAccount']=function(_0x568474){var _0x4952de=this;return new Promise(function(_0x49d24f,_0x28f628){return db[_0x2cb7('0x18')][_0x2cb7('0x19')]({'raw':_0x568474[_0x2cb7('0x1a')]?_0x568474[_0x2cb7('0x1a')][_0x2cb7('0x1b')]===undefined?!![]:![]:!![],'where':_0x568474[_0x2cb7('0x1a')]?_0x568474['options']['where']||null:null,'attributes':_0x568474[_0x2cb7('0x1a')]?_0x568474[_0x2cb7('0x1a')][_0x2cb7('0x1c')]||null:null,'limit':_0x568474[_0x2cb7('0x1a')]?_0x568474[_0x2cb7('0x1a')]['limit']||null:null,'include':_0x568474[_0x2cb7('0x1a')]?_0x568474[_0x2cb7('0x1a')][_0x2cb7('0x1d')]?_[_0x2cb7('0x1e')](_0x568474[_0x2cb7('0x1a')][_0x2cb7('0x1d')],function(_0x1e5de7){return{'model':db[_0x1e5de7[_0x2cb7('0x1f')]],'as':_0x1e5de7['as'],'attributes':_0x1e5de7['attributes'],'include':_0x1e5de7['include']?_[_0x2cb7('0x1e')](_0x1e5de7[_0x2cb7('0x1d')],function(_0x415d43){return{'model':db[_0x415d43[_0x2cb7('0x1f')]],'as':_0x415d43['as'],'attributes':_0x415d43['attributes'],'include':_0x415d43[_0x2cb7('0x1d')]?_[_0x2cb7('0x1e')](_0x415d43[_0x2cb7('0x1d')],function(_0x540a3e){return{'model':db[_0x540a3e['model']],'as':_0x540a3e['as'],'attributes':_0x540a3e['attributes']};}):[]};}):[]};}):[]:[]})[_0x2cb7('0xd')](function(_0x2b56fe){logger['info'](_0x2cb7('0x20'),_0x568474);logger[_0x2cb7('0x10')](_0x2cb7('0x20'),_0x568474,JSON[_0x2cb7('0x21')](_0x2b56fe));_0x49d24f(_0x2b56fe);})['catch'](function(_0xead3fa){logger[_0x2cb7('0x12')](_0x2cb7('0x20'),_0xead3fa[_0x2cb7('0x14')],_0x568474);_0x28f628(_0x4952de[_0x2cb7('0x12')](0x1f4,_0xead3fa[_0x2cb7('0x14')]));});});};exports[_0x2cb7('0x22')]=function(_0x5e9469,_0x1c59f0,_0x3cf4ec){var _0x305908=this;return new Promise(function(_0x4c8335,_0x510c38){var _0x19f7e4={'body':_0x5e9469[_0x2cb7('0x23')],'channel':_0x2cb7('0x24')};var _0x4fcf80=[];var _0x1bd32a=[];var _0x4482a4={};return db[_0x2cb7('0x25')]['describe']()['then'](function(_0x17b6f8){if(!_0x17b6f8){throw new db['Sequelize']['ValidationError'](_0x2cb7('0x26'));}_0x4fcf80=_[_0x2cb7('0x27')](_[_0x2cb7('0x28')](_0x17b6f8),['createdAt',_0x2cb7('0x29')]);_0x1bd32a=_[_0x2cb7('0x27')](_['keys'](_0x17b6f8),[_0x2cb7('0x2a'),_0x2cb7('0x29'),_0x2cb7('0x2b'),_0x2cb7('0x2c')]);if(_0x5e9469[_0x2cb7('0x23')]['id']){delete _0x5e9469['body']['id'];}if(_[_0x2cb7('0x2d')](_0x5e9469['body'][_0x2cb7('0x2e')])){throw new db['Sequelize'][(_0x2cb7('0x2f'))](_0x2cb7('0x30'));}if(_[_0x2cb7('0x2d')](_0x5e9469[_0x2cb7('0x23')]['body'])||_0x5e9469['body']['body']===''){throw new db[(_0x2cb7('0x31'))][(_0x2cb7('0x2f'))](_0x2cb7('0x32'));}if(_['isNil'](_0x5e9469[_0x2cb7('0x23')]['mapKey'])){throw new db['Sequelize'][(_0x2cb7('0x2f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1bd32a);}if(!_[_0x2cb7('0x33')](_0x1bd32a,_0x5e9469['body']['mapKey'])){throw new db[(_0x2cb7('0x31'))]['ValidationError'](_0x2cb7('0x34')+_0x1bd32a);}_0x4482a4[_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x35')]]=_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x2e')];})[_0x2cb7('0xd')](function(){return db[_0x2cb7('0x18')][_0x2cb7('0x36')]({'where':{'id':_0x5e9469['account']['id']},'include':[{'model':db[_0x2cb7('0x37')],'as':_0x2cb7('0x38'),'include':[{'model':db[_0x2cb7('0x25')],'as':'Contacts','where':_0x4482a4,'limit':0x1,'order':[['updatedAt',_0x2cb7('0x39')]]}]},{'model':db[_0x2cb7('0x3a')],'as':_0x2cb7('0x3b')}]});})[_0x2cb7('0xd')](function(_0x218810){if(_0x218810&&_0x218810[_0x2cb7('0x38')]){var _0x293f3b=_0x218810[_0x2cb7('0x3c')]({'plain':!![]});_0x19f7e4['account']=_0x293f3b;_0x19f7e4[_0x2cb7('0x3d')]=_0x293f3b[_0x2cb7('0x3b')];_0x19f7e4[_0x2cb7('0x3e')]=_0x293f3b['List'];_0x19f7e4['applications']=_[_0x2cb7('0x3f')](_0x19f7e4[_0x2cb7('0x3d')],[_0x2cb7('0x40')],[_0x2cb7('0x41')]);if(_0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x3b')]){delete _0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x3b')];}if(_0x19f7e4['account'][_0x2cb7('0x38')]&&_0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x38')][_0x2cb7('0x43')][_0x2cb7('0x44')]){return _0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x38')][_0x2cb7('0x43')][0x0];}var _0x38223a=_[_0x2cb7('0x45')](_0x5e9469[_0x2cb7('0x23')],{'firstName':_0x5e9469['body'][_0x2cb7('0x2e')],'ListId':_0x293f3b[_0x2cb7('0x2c')]});_0x38223a[_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x35')]]=_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x2e')];return db[_0x2cb7('0x25')][_0x2cb7('0x46')](_0x38223a,{'fields':_0x4fcf80,'raw':!![]});}})[_0x2cb7('0xd')](function(_0x16abd5){_0x19f7e4[_0x2cb7('0x47')]=_0x16abd5;if(_0x16abd5){var _0x2539c9={'ContactId':_0x16abd5['id'],'FaxAccountId':_0x5e9469[_0x2cb7('0x42')]['id'],'fax':_0x16abd5[_0x2cb7('0x24')]};return db[_0x2cb7('0x48')][_0x2cb7('0x36')]({'where':{'ContactId':_0x16abd5['id'],'closed':![],'FaxAccountId':_0x5e9469[_0x2cb7('0x42')]['id']}})[_0x2cb7('0xd')](function(_0x509d2c){if(_0x509d2c){return[_0x509d2c,![]];}return db[_0x2cb7('0x48')]['create'](_0x2539c9)[_0x2cb7('0xd')](function(_0x4c1ed3){return[_0x4c1ed3,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x2cb7('0x49')](function(_0x3ed620,_0x38b29e){var _0x447aa7=_0x3ed620['get']({'plain':!![]});if(_0x38b29e){if(_0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x4a')]){_0x19f7e4['applications'][_0x2cb7('0x4b')]({'id':0x0,'priority':_0x19f7e4[_0x2cb7('0x3d')]['length']+0x1,'app':_0x2cb7('0x4c'),'appdata':_0x2cb7('0x4d'),'interval':_0x2cb7('0x4e')});}_0x447aa7[_0x2cb7('0x4f')]=!![];}else{_0x447aa7[_0x2cb7('0x4f')]=![];}_0x19f7e4['interaction']=_0x447aa7;return db[_0x2cb7('0x50')]['create']({'body':_0x5e9469['body'][_0x2cb7('0x23')],'FaxAccountId':_0x5e9469[_0x2cb7('0x42')]['id'],'FaxInteractionId':_0x3ed620['id'],'direction':'in','ContactId':_0x3ed620[_0x2cb7('0x51')],'AttachmentId':_0x5e9469[_0x2cb7('0x23')][_0x2cb7('0x52')]});})[_0x2cb7('0xd')](function(_0x113814){_0x19f7e4[_0x2cb7('0x14')]=_0x113814;if(!_0x19f7e4[_0x2cb7('0x53')]['UserId'])return;return db['User'][_0x2cb7('0x36')]({'attributes':['id',_0x2cb7('0x54')],'where':{'id':_0x19f7e4['interaction'][_0x2cb7('0x55')]}});})[_0x2cb7('0xd')](function(_0x472a8b){if(_0x472a8b){_0x19f7e4[_0x2cb7('0x3d')][_0x2cb7('0x56')]({'id':0x0,'priority':0x0,'app':_0x2cb7('0x57'),'appdata':_0x472a8b['name']+','+(_0x19f7e4[_0x2cb7('0x42')][_0x2cb7('0x58')]||0xa),'interval':_0x2cb7('0x4e')});}if(!_0x19f7e4[_0x2cb7('0x53')][_0x2cb7('0x59')])return;return db[_0x2cb7('0x5a')][_0x2cb7('0x36')]({'attributes':['id',_0x2cb7('0x54')],'where':{'id':_0x19f7e4[_0x2cb7('0x53')][_0x2cb7('0x59')]}});})[_0x2cb7('0xd')](function(_0x208eb8){if(_0x208eb8){_0x19f7e4['applications'][_0x2cb7('0x56')]({'id':0x0,'priority':0x1,'app':_0x2cb7('0x5b'),'appdata':_0x208eb8[_0x2cb7('0x54')]+','+(_0x19f7e4[_0x2cb7('0x42')]['waitForTheAssignedQueue']||0x12c),'interval':_0x2cb7('0x4e')});}return respondWithRpcPromise(_0x2cb7('0x5c'),'startRouting',_0x19f7e4);})['then'](function(_0x22d7c2){_0x4c8335(_0x22d7c2);})[_0x2cb7('0x17')](function(_0xcd3ae8){_0x510c38(_0x305908['error'](0x1f4,_0xcd3ae8[_0x2cb7('0x14')]));});});};
\ No newline at end of file
index d364ce7..a076219 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x04ba=['remove','update','emit','removeListener','length','faxAccount:','./faxAccount.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x04ba,0x66));var _0xa04b=function(_0x1d535f,_0x344191){_0x1d535f=_0x1d535f-0x0;var _0x1533d8=_0x04ba[_0x1d535f];return _0x1533d8;};'use strict';var FaxAccountEvents=require(_0xa04b('0x0'));var events=[_0xa04b('0x1'),_0xa04b('0x2'),_0xa04b('0x3')];function createListener(_0x24745a,_0x1f5ea8){return function(_0x1caef8){_0x1f5ea8[_0xa04b('0x4')](_0x24745a,_0x1caef8);};}function removeListener(_0x5069ba,_0x262da6){return function(){FaxAccountEvents[_0xa04b('0x5')](_0x5069ba,_0x262da6);};}exports['register']=function(_0x52d013){for(var _0x5a803a=0x0,_0x1a7355=events[_0xa04b('0x6')];_0x5a803a<_0x1a7355;_0x5a803a++){var _0x34b705=events[_0x5a803a];var _0x54f950=createListener(_0xa04b('0x7')+_0x34b705,_0x52d013);FaxAccountEvents['on'](_0x34b705,_0x54f950);}};
\ No newline at end of file
+var _0x0cea=['faxAccount:','./faxAccount.events','remove','emit','register','length'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0x0cea,0x85));var _0xa0ce=function(_0x380711,_0x274f90){_0x380711=_0x380711-0x0;var _0x23156e=_0x0cea[_0x380711];return _0x23156e;};'use strict';var FaxAccountEvents=require(_0xa0ce('0x0'));var events=['save',_0xa0ce('0x1'),'update'];function createListener(_0x2de8a3,_0x3c69b5){return function(_0x188d3d){_0x3c69b5[_0xa0ce('0x2')](_0x2de8a3,_0x188d3d);};}function removeListener(_0xb65036,_0xeaa33d){return function(){FaxAccountEvents['removeListener'](_0xb65036,_0xeaa33d);};}exports[_0xa0ce('0x3')]=function(_0x135945){for(var _0x7b4c1b=0x0,_0x41f6ec=events[_0xa0ce('0x4')];_0x7b4c1b<_0x41f6ec;_0x7b4c1b++){var _0x403bc3=events[_0x7b4c1b];var _0x1dfeba=createListener(_0xa0ce('0x5')+_0x403bc3,_0x135945);FaxAccountEvents['on'](_0x403bc3,_0x1dfeba);}};
\ No newline at end of file
index ded4494..169183d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e07=['/:id/interactions','/:id/applications','addApplications','/addaccountapplications','/updateaccountapplications','/:id/send','addAgents','put','destroy','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getInteractions','/:id/messages','/:id/users','getAgents','post','addDisposition','addAnswer'];(function(_0x3144eb,_0x28da1e){var _0x4267b6=function(_0x10df85){while(--_0x10df85){_0x3144eb['push'](_0x3144eb['shift']());}};_0x4267b6(++_0x28da1e);}(_0x3e07,0xcc));var _0x73e0=function(_0x55ea51,_0x9d5daf){_0x55ea51=_0x55ea51-0x0;var _0x40bb42=_0x3e07[_0x55ea51];return _0x40bb42;};'use strict';var multer=require(_0x73e0('0x0'));var util=require(_0x73e0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x73e0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x73e0('0x3'));var interaction=require(_0x73e0('0x4'));var config=require(_0x73e0('0x5'));var controller=require(_0x73e0('0x6'));router[_0x73e0('0x7')]('/',auth[_0x73e0('0x8')](),controller[_0x73e0('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x73e0('0xa')]);router['get'](_0x73e0('0xb'),auth['isAuthenticated'](),controller[_0x73e0('0xc')]);router[_0x73e0('0x7')](_0x73e0('0xd'),auth[_0x73e0('0x8')](),controller[_0x73e0('0xe')]);router[_0x73e0('0x7')](_0x73e0('0xf'),auth[_0x73e0('0x8')](),controller[_0x73e0('0x10')]);router[_0x73e0('0x7')]('/:id/interactions',auth[_0x73e0('0x8')](),controller[_0x73e0('0x11')]);router[_0x73e0('0x7')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0x73e0('0x7')](_0x73e0('0x12'),auth[_0x73e0('0x8')](),controller['getMessages']);router[_0x73e0('0x7')](_0x73e0('0x13'),auth[_0x73e0('0x8')](),controller[_0x73e0('0x14')]);router[_0x73e0('0x15')]('/',auth[_0x73e0('0x8')](),controller['create']);router[_0x73e0('0x15')](_0x73e0('0xd'),auth['isAuthenticated'](),controller[_0x73e0('0x16')]);router[_0x73e0('0x15')](_0x73e0('0xf'),auth['isAuthenticated'](),controller[_0x73e0('0x17')]);router[_0x73e0('0x15')](_0x73e0('0x18'),auth[_0x73e0('0x8')](),controller['addInteraction']);router[_0x73e0('0x15')](_0x73e0('0x19'),auth[_0x73e0('0x8')](),controller[_0x73e0('0x1a')]);router['post'](_0x73e0('0x1b'),auth[_0x73e0('0x8')](),controller['addAccountApplications']);router[_0x73e0('0x15')](_0x73e0('0x1c'),auth[_0x73e0('0x8')](),controller['updateAccountApplications']);router[_0x73e0('0x15')](_0x73e0('0x1d'),auth[_0x73e0('0x8')](),controller['send']);router['post'](_0x73e0('0x13'),auth[_0x73e0('0x8')](),controller[_0x73e0('0x1e')]);router[_0x73e0('0x1f')](_0x73e0('0xb'),auth[_0x73e0('0x8')](),controller['update']);router['delete'](_0x73e0('0xb'),auth[_0x73e0('0x8')](),controller[_0x73e0('0x20')]);router['delete'](_0x73e0('0xd'),auth[_0x73e0('0x8')](),controller[_0x73e0('0x21')]);router[_0x73e0('0x22')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x73e0('0x23')]);router[_0x73e0('0x22')](_0x73e0('0x13'),auth['isAuthenticated'](),controller[_0x73e0('0x24')]);module[_0x73e0('0x25')]=router;
\ No newline at end of file
+var _0x444e=['express','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAgents','multer','path'];(function(_0x70a8a5,_0x35a384){var _0x2b563b=function(_0x4bbb5b){while(--_0x4bbb5b){_0x70a8a5['push'](_0x70a8a5['shift']());}};_0x2b563b(++_0x35a384);}(_0x444e,0xe8));var _0xe444=function(_0x1fa74e,_0x164801){_0x1fa74e=_0x1fa74e-0x0;var _0x25da92=_0x444e[_0x1fa74e];return _0x25da92;};'use strict';var multer=require(_0xe444('0x0'));var util=require('util');var path=require(_0xe444('0x1'));var timeout=require('connect-timeout');var express=require(_0xe444('0x2'));var router=express['Router']();var fs_extra=require(_0xe444('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe444('0x4'));var config=require(_0xe444('0x5'));var controller=require(_0xe444('0x6'));router[_0xe444('0x7')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x9')]);router['get'](_0xe444('0xa'),auth['isAuthenticated'](),controller[_0xe444('0xb')]);router['get'](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0xd')]);router['get']('/:id/dispositions',auth[_0xe444('0x8')](),controller[_0xe444('0xe')]);router['get'](_0xe444('0xf'),auth['isAuthenticated'](),controller['getAnswers']);router[_0xe444('0x7')]('/:id/interactions',auth[_0xe444('0x8')](),controller[_0xe444('0x10')]);router['get'](_0xe444('0x11'),auth['isAuthenticated'](),controller['getApplications']);router[_0xe444('0x7')](_0xe444('0x12'),auth['isAuthenticated'](),controller[_0xe444('0x13')]);router['get'](_0xe444('0x14'),auth[_0xe444('0x8')](),controller[_0xe444('0x15')]);router[_0xe444('0x16')]('/',auth[_0xe444('0x8')](),controller[_0xe444('0x17')]);router[_0xe444('0x16')](_0xe444('0x18'),auth[_0xe444('0x8')](),controller[_0xe444('0x19')]);router[_0xe444('0x16')](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['addAnswer']);router[_0xe444('0x16')](_0xe444('0x1a'),auth[_0xe444('0x8')](),controller[_0xe444('0x1b')]);router['post'](_0xe444('0x11'),auth[_0xe444('0x8')](),controller[_0xe444('0x1c')]);router[_0xe444('0x16')](_0xe444('0x1d'),auth['isAuthenticated'](),controller[_0xe444('0x1e')]);router[_0xe444('0x16')]('/updateaccountapplications',auth[_0xe444('0x8')](),controller['updateAccountApplications']);router[_0xe444('0x16')](_0xe444('0x1f'),auth[_0xe444('0x8')](),controller[_0xe444('0x20')]);router[_0xe444('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xe444('0x21')]);router[_0xe444('0x22')](_0xe444('0xc'),auth[_0xe444('0x8')](),controller[_0xe444('0x23')]);router['delete'](_0xe444('0xc'),auth[_0xe444('0x8')](),controller['destroy']);router[_0xe444('0x24')](_0xe444('0x18'),auth[_0xe444('0x8')](),controller[_0xe444('0x25')]);router[_0xe444('0x24')](_0xe444('0xf'),auth[_0xe444('0x8')](),controller['removeAnswers']);router[_0xe444('0x24')](_0xe444('0x14'),auth[_0xe444('0x8')](),controller[_0xe444('0x26')]);module['exports']=router;
\ No newline at end of file
index 17cdc67..7936012 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8556=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x21824d,_0x22eb0f){var _0x42f299=function(_0x69c45b){while(--_0x69c45b){_0x21824d['push'](_0x21824d['shift']());}};_0x42f299(++_0x22eb0f);}(_0x8556,0x7a));var _0x6855=function(_0x41bd0d,_0x283017){_0x41bd0d=_0x41bd0d-0x0;var _0x5a4f5d=_0x8556[_0x41bd0d];return _0x5a4f5d;};'use strict';var Sequelize=require(_0x6855('0x0'));module[_0x6855('0x1')]={'priority':{'type':Sequelize[_0x6855('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6855('0x3')],'allowNull':![],'defaultValue':_0x6855('0x4')},'appdata':{'type':Sequelize[_0x6855('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x6855('0x3')],'defaultValue':_0x6855('0x6')}};
\ No newline at end of file
+var _0x4e5f=['STRING','sequelize','exports'];(function(_0xdc4f0c,_0x40a013){var _0x55e188=function(_0x3c821c){while(--_0x3c821c){_0xdc4f0c['push'](_0xdc4f0c['shift']());}};_0x55e188(++_0x40a013);}(_0x4e5f,0x196));var _0xf4e5=function(_0x570841,_0x3f3f68){_0x570841=_0x570841-0x0;var _0x3a6bf9=_0x4e5f[_0x570841];return _0x3a6bf9;};'use strict';var Sequelize=require(_0xf4e5('0x0'));module[_0xf4e5('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf4e5('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf4e5('0x2')]},'interval':{'type':Sequelize[_0xf4e5('0x2')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
index c317778..44ecb9c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e7f=['util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','FaxApplication','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x1800c3,_0x1a687c){var _0x86a6c5=function(_0x11d7e1){while(--_0x11d7e1){_0x1800c3['push'](_0x1800c3['shift']());}};_0x86a6c5(++_0x1a687c);}(_0x5e7f,0xdf));var _0xf5e7=function(_0x34ce2d,_0x26bb8d){_0x34ce2d=_0x34ce2d-0x0;var _0x7cfaec=_0x5e7f[_0x34ce2d];return _0x7cfaec;};'use strict';var emlformat=require(_0xf5e7('0x0'));var rimraf=require(_0xf5e7('0x1'));var zipdir=require(_0xf5e7('0x2'));var jsonpatch=require(_0xf5e7('0x3'));var rp=require(_0xf5e7('0x4'));var moment=require(_0xf5e7('0x5'));var BPromise=require(_0xf5e7('0x6'));var Mustache=require(_0xf5e7('0x7'));var util=require(_0xf5e7('0x8'));var path=require(_0xf5e7('0x9'));var sox=require(_0xf5e7('0xa'));var csv=require(_0xf5e7('0xb'));var ejs=require(_0xf5e7('0xc'));var fs=require('fs');var fs_extra=require(_0xf5e7('0xd'));var _=require('lodash');var squel=require(_0xf5e7('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf5e7('0xf'));var toCsv=require(_0xf5e7('0xb'));var querystring=require(_0xf5e7('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf5e7('0x11'));var qs=require(_0xf5e7('0x12'));var as=require(_0xf5e7('0x13'));var hardwareService=require(_0xf5e7('0x14'));var logger=require(_0xf5e7('0x15'))(_0xf5e7('0x16'));var utils=require(_0xf5e7('0x17'));var config=require(_0xf5e7('0x18'));var licenseUtil=require(_0xf5e7('0x19'));var db=require(_0xf5e7('0x1a'))['db'];function respondWithStatusCode(_0x410e62,_0x324a64){_0x324a64=_0x324a64||0xcc;return function(_0x6fa892){if(_0x6fa892){return _0x410e62[_0xf5e7('0x1b')](_0x324a64);}return _0x410e62['status'](_0x324a64)[_0xf5e7('0x1c')]();};}function respondWithResult(_0x186169,_0x428dd0){_0x428dd0=_0x428dd0||0xc8;return function(_0x3e5385){if(_0x3e5385){return _0x186169['status'](_0x428dd0)[_0xf5e7('0x1d')](_0x3e5385);}};}function respondWithFilteredResult(_0x5d8cf8,_0x328ab4){return function(_0x40ddb6){if(_0x40ddb6){var _0x4a87e5=typeof _0x328ab4[_0xf5e7('0x1e')]===_0xf5e7('0x1f')&&typeof _0x328ab4['limit']==='undefined';var _0x4a73fc=_0x40ddb6[_0xf5e7('0x20')];var _0x39abce=_0x4a87e5?0x0:_0x328ab4[_0xf5e7('0x1e')];var _0x3853bc=_0x4a87e5?_0x40ddb6[_0xf5e7('0x20')]:_0x328ab4[_0xf5e7('0x1e')]+_0x328ab4['limit'];var _0x60a73d;if(_0x3853bc>=_0x4a73fc){_0x3853bc=_0x4a73fc;_0x60a73d=0xc8;}else{_0x60a73d=0xce;}_0x5d8cf8[_0xf5e7('0x21')](_0x60a73d);return _0x5d8cf8[_0xf5e7('0x22')](_0xf5e7('0x23'),_0x39abce+'-'+_0x3853bc+'/'+_0x4a73fc)['json'](_0x40ddb6);}return null;};}function patchUpdates(_0x21486d){return function(_0x200bc2){try{jsonpatch[_0xf5e7('0x24')](_0x200bc2,_0x21486d,!![]);}catch(_0x590a6e){return BPromise[_0xf5e7('0x25')](_0x590a6e);}return _0x200bc2['save']();};}function saveUpdates(_0x42c82b,_0xf0bda8){return function(_0x3fd007){if(_0x3fd007){return _0x3fd007[_0xf5e7('0x26')](_0x42c82b)[_0xf5e7('0x27')](function(_0x522551){return _0x522551;});}return null;};}function removeEntity(_0x43bfa3,_0x113133){return function(_0x2a29a9){if(_0x2a29a9){return _0x2a29a9[_0xf5e7('0x28')]()[_0xf5e7('0x27')](function(){_0x43bfa3['status'](0xcc)[_0xf5e7('0x1c')]();});}};}function handleEntityNotFound(_0x1242fa,_0x195a25){return function(_0x491bca){if(!_0x491bca){_0x1242fa['sendStatus'](0x194);}return _0x491bca;};}function handleError(_0x477629,_0x41cbae){_0x41cbae=_0x41cbae||0x1f4;return function(_0x209dbb){logger['error'](_0x209dbb[_0xf5e7('0x29')]);if(_0x209dbb[_0xf5e7('0x2a')]){delete _0x209dbb[_0xf5e7('0x2a')];}_0x477629[_0xf5e7('0x21')](_0x41cbae)[_0xf5e7('0x2b')](_0x209dbb);};}exports[_0xf5e7('0x2c')]=function(_0x13eaf7,_0x2fb852){var _0x2ce09b={},_0xad249b={},_0xaba26a={'count':0x0,'rows':[]};var _0x298aa9=_[_0xf5e7('0x2d')](db[_0xf5e7('0x2e')]['rawAttributes'],function(_0x578568){return{'name':_0x578568[_0xf5e7('0x2f')],'type':_0x578568[_0xf5e7('0x30')][_0xf5e7('0x31')]};});_0xad249b[_0xf5e7('0x32')]=_[_0xf5e7('0x2d')](_0x298aa9,_0xf5e7('0x2a'));_0xad249b['query']=_['keys'](_0x13eaf7[_0xf5e7('0x33')]);_0xad249b['filters']=_['intersection'](_0xad249b['model'],_0xad249b['query']);_0x2ce09b[_0xf5e7('0x34')]=_[_0xf5e7('0x35')](_0xad249b[_0xf5e7('0x32')],qs['fields'](_0x13eaf7[_0xf5e7('0x33')][_0xf5e7('0x36')]));_0x2ce09b[_0xf5e7('0x34')]=_0x2ce09b[_0xf5e7('0x34')][_0xf5e7('0x37')]?_0x2ce09b[_0xf5e7('0x34')]:_0xad249b[_0xf5e7('0x32')];if(!_0x13eaf7[_0xf5e7('0x33')][_0xf5e7('0x38')]('nolimit')){_0x2ce09b['limit']=qs[_0xf5e7('0x39')](_0x13eaf7[_0xf5e7('0x33')]['limit']);_0x2ce09b[_0xf5e7('0x1e')]=qs[_0xf5e7('0x1e')](_0x13eaf7[_0xf5e7('0x33')]['offset']);}_0x2ce09b[_0xf5e7('0x3a')]=qs[_0xf5e7('0x3b')](_0x13eaf7[_0xf5e7('0x33')]['sort']);_0x2ce09b[_0xf5e7('0x3c')]=qs[_0xf5e7('0x3d')](_['pick'](_0x13eaf7[_0xf5e7('0x33')],_0xad249b[_0xf5e7('0x3d')]),_0x298aa9);if(_0x13eaf7[_0xf5e7('0x33')][_0xf5e7('0x3e')]){_0x2ce09b['where']=_[_0xf5e7('0x3f')](_0x2ce09b['where'],{'$or':_['map'](_0x298aa9,function(_0x5cf59e){if(_0x5cf59e[_0xf5e7('0x30')]!==_0xf5e7('0x40')){var _0x1c49d6={};_0x1c49d6[_0x5cf59e[_0xf5e7('0x2a')]]={'$like':'%'+_0x13eaf7[_0xf5e7('0x33')][_0xf5e7('0x3e')]+'%'};return _0x1c49d6;}})});}_0x2ce09b=_['merge']({},_0x2ce09b,_0x13eaf7['options']);var _0x6089c2={'where':_0x2ce09b['where']};return db[_0xf5e7('0x2e')][_0xf5e7('0x20')](_0x6089c2)['then'](function(_0x208cfe){_0xaba26a[_0xf5e7('0x20')]=_0x208cfe;if(_0x13eaf7['query'][_0xf5e7('0x41')]){_0x2ce09b[_0xf5e7('0x42')]=[{'all':!![]}];}return db[_0xf5e7('0x2e')][_0xf5e7('0x43')](_0x2ce09b);})[_0xf5e7('0x27')](function(_0x5916a0){_0xaba26a[_0xf5e7('0x44')]=_0x5916a0;return _0xaba26a;})['then'](respondWithFilteredResult(_0x2fb852,_0x2ce09b))[_0xf5e7('0x45')](handleError(_0x2fb852,null));};exports[_0xf5e7('0x46')]=function(_0x19b670,_0x54b226){var _0x410409={'raw':!![],'where':{'id':_0x19b670[_0xf5e7('0x47')]['id']}},_0x565055={};_0x565055['model']=_[_0xf5e7('0x48')](db['FaxApplication']['rawAttributes']);_0x565055[_0xf5e7('0x33')]=_['keys'](_0x19b670[_0xf5e7('0x33')]);_0x565055[_0xf5e7('0x3d')]=_['intersection'](_0x565055['model'],_0x565055[_0xf5e7('0x33')]);_0x410409[_0xf5e7('0x34')]=_[_0xf5e7('0x35')](_0x565055[_0xf5e7('0x32')],qs['fields'](_0x19b670['query'][_0xf5e7('0x36')]));_0x410409[_0xf5e7('0x34')]=_0x410409[_0xf5e7('0x34')]['length']?_0x410409[_0xf5e7('0x34')]:_0x565055[_0xf5e7('0x32')];if(_0x19b670[_0xf5e7('0x33')]['includeAll']){_0x410409[_0xf5e7('0x42')]=[{'all':!![]}];}_0x410409=_['merge']({},_0x410409,_0x19b670[_0xf5e7('0x49')]);return db[_0xf5e7('0x2e')][_0xf5e7('0x4a')](_0x410409)['then'](handleEntityNotFound(_0x54b226,null))['then'](respondWithResult(_0x54b226,null))[_0xf5e7('0x45')](handleError(_0x54b226,null));};exports[_0xf5e7('0x4b')]=function(_0x26ed25,_0xc06c2b){return db[_0xf5e7('0x2e')][_0xf5e7('0x4b')](_0x26ed25[_0xf5e7('0x4c')],{})[_0xf5e7('0x27')](respondWithResult(_0xc06c2b,0xc9))[_0xf5e7('0x45')](handleError(_0xc06c2b,null));};exports[_0xf5e7('0x26')]=function(_0x5690ad,_0x4df452){if(_0x5690ad['body']['id']){delete _0x5690ad[_0xf5e7('0x4c')]['id'];}return db['FaxApplication'][_0xf5e7('0x4a')]({'where':{'id':_0x5690ad[_0xf5e7('0x47')]['id']}})[_0xf5e7('0x27')](handleEntityNotFound(_0x4df452,null))[_0xf5e7('0x27')](saveUpdates(_0x5690ad[_0xf5e7('0x4c')],null))['then'](respondWithResult(_0x4df452,null))[_0xf5e7('0x45')](handleError(_0x4df452,null));};exports[_0xf5e7('0x28')]=function(_0x1014ee,_0x2837ad){return db[_0xf5e7('0x2e')][_0xf5e7('0x4a')]({'where':{'id':_0x1014ee[_0xf5e7('0x47')]['id']}})[_0xf5e7('0x27')](handleEntityNotFound(_0x2837ad,null))[_0xf5e7('0x27')](removeEntity(_0x2837ad,null))[_0xf5e7('0x45')](handleError(_0x2837ad,null));};
\ No newline at end of file
+var _0xe972=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','where','merge','type','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0xea813,_0x5ce85d){var _0x31fab5=function(_0x5357bc){while(--_0x5357bc){_0xea813['push'](_0xea813['shift']());}};_0x31fab5(++_0x5ce85d);}(_0xe972,0x15d));var _0x2e97=function(_0x2539e6,_0x595d36){_0x2539e6=_0x2539e6-0x0;var _0xe83570=_0xe972[_0x2539e6];return _0xe83570;};'use strict';var emlformat=require(_0x2e97('0x0'));var rimraf=require(_0x2e97('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e97('0x2'));var rp=require(_0x2e97('0x3'));var moment=require('moment');var BPromise=require(_0x2e97('0x4'));var Mustache=require(_0x2e97('0x5'));var util=require(_0x2e97('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x2e97('0x7'));var ejs=require(_0x2e97('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2e97('0x9'));var squel=require(_0x2e97('0xa'));var crypto=require(_0x2e97('0xb'));var jsforce=require(_0x2e97('0xc'));var deskjs=require(_0x2e97('0xd'));var toCsv=require(_0x2e97('0x7'));var querystring=require('querystring');var Papa=require(_0x2e97('0xe'));var Redis=require('ioredis');var authService=require(_0x2e97('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2e97('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e97('0x11'))(_0x2e97('0x12'));var utils=require(_0x2e97('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2e97('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f1468,_0x4484d1){_0x4484d1=_0x4484d1||0xcc;return function(_0x360b49){if(_0x360b49){return _0x2f1468[_0x2e97('0x15')](_0x4484d1);}return _0x2f1468[_0x2e97('0x16')](_0x4484d1)[_0x2e97('0x17')]();};}function respondWithResult(_0x57f4fa,_0x23c194){_0x23c194=_0x23c194||0xc8;return function(_0x55be40){if(_0x55be40){return _0x57f4fa['status'](_0x23c194)[_0x2e97('0x18')](_0x55be40);}};}function respondWithFilteredResult(_0x5524a3,_0x586d79){return function(_0x48e7d1){if(_0x48e7d1){var _0xaf6482=typeof _0x586d79['offset']===_0x2e97('0x19')&&typeof _0x586d79[_0x2e97('0x1a')]===_0x2e97('0x19');var _0x4d155b=_0x48e7d1[_0x2e97('0x1b')];var _0x433057=_0xaf6482?0x0:_0x586d79[_0x2e97('0x1c')];var _0xaa7015=_0xaf6482?_0x48e7d1[_0x2e97('0x1b')]:_0x586d79[_0x2e97('0x1c')]+_0x586d79['limit'];var _0x44dad6;if(_0xaa7015>=_0x4d155b){_0xaa7015=_0x4d155b;_0x44dad6=0xc8;}else{_0x44dad6=0xce;}_0x5524a3['status'](_0x44dad6);return _0x5524a3[_0x2e97('0x1d')](_0x2e97('0x1e'),_0x433057+'-'+_0xaa7015+'/'+_0x4d155b)[_0x2e97('0x18')](_0x48e7d1);}return null;};}function patchUpdates(_0x16bd95){return function(_0x321313){try{jsonpatch[_0x2e97('0x1f')](_0x321313,_0x16bd95,!![]);}catch(_0x138374){return BPromise[_0x2e97('0x20')](_0x138374);}return _0x321313[_0x2e97('0x21')]();};}function saveUpdates(_0x120369,_0x2c17fa){return function(_0x151423){if(_0x151423){return _0x151423[_0x2e97('0x22')](_0x120369)[_0x2e97('0x23')](function(_0x509cf2){return _0x509cf2;});}return null;};}function removeEntity(_0x119aec,_0x4c3e18){return function(_0x1a2bd1){if(_0x1a2bd1){return _0x1a2bd1['destroy']()[_0x2e97('0x23')](function(){_0x119aec['status'](0xcc)[_0x2e97('0x17')]();});}};}function handleEntityNotFound(_0x2df759,_0x489458){return function(_0x2d0010){if(!_0x2d0010){_0x2df759[_0x2e97('0x15')](0x194);}return _0x2d0010;};}function handleError(_0x3a25d4,_0x23527b){_0x23527b=_0x23527b||0x1f4;return function(_0x1040c4){logger[_0x2e97('0x24')](_0x1040c4[_0x2e97('0x25')]);if(_0x1040c4[_0x2e97('0x26')]){delete _0x1040c4[_0x2e97('0x26')];}_0x3a25d4['status'](_0x23527b)[_0x2e97('0x27')](_0x1040c4);};}exports[_0x2e97('0x28')]=function(_0x5ef7f7,_0x150587){var _0x31ac51={},_0x422124={},_0x1ae724={'count':0x0,'rows':[]};var _0x5d8abf=_[_0x2e97('0x29')](db[_0x2e97('0x2a')][_0x2e97('0x2b')],function(_0x28ec9c){return{'name':_0x28ec9c[_0x2e97('0x2c')],'type':_0x28ec9c['type'][_0x2e97('0x2d')]};});_0x422124[_0x2e97('0x2e')]=_[_0x2e97('0x29')](_0x5d8abf,_0x2e97('0x26'));_0x422124['query']=_[_0x2e97('0x2f')](_0x5ef7f7[_0x2e97('0x30')]);_0x422124[_0x2e97('0x31')]=_[_0x2e97('0x32')](_0x422124[_0x2e97('0x2e')],_0x422124['query']);_0x31ac51[_0x2e97('0x33')]=_[_0x2e97('0x32')](_0x422124['model'],qs['fields'](_0x5ef7f7[_0x2e97('0x30')][_0x2e97('0x34')]));_0x31ac51[_0x2e97('0x33')]=_0x31ac51[_0x2e97('0x33')][_0x2e97('0x35')]?_0x31ac51[_0x2e97('0x33')]:_0x422124[_0x2e97('0x2e')];if(!_0x5ef7f7['query'][_0x2e97('0x36')](_0x2e97('0x37'))){_0x31ac51[_0x2e97('0x1a')]=qs[_0x2e97('0x1a')](_0x5ef7f7['query'][_0x2e97('0x1a')]);_0x31ac51[_0x2e97('0x1c')]=qs['offset'](_0x5ef7f7[_0x2e97('0x30')][_0x2e97('0x1c')]);}_0x31ac51['order']=qs['sort'](_0x5ef7f7[_0x2e97('0x30')]['sort']);_0x31ac51['where']=qs[_0x2e97('0x31')](_[_0x2e97('0x38')](_0x5ef7f7[_0x2e97('0x30')],_0x422124[_0x2e97('0x31')]),_0x5d8abf);if(_0x5ef7f7[_0x2e97('0x30')]['filter']){_0x31ac51[_0x2e97('0x39')]=_[_0x2e97('0x3a')](_0x31ac51['where'],{'$or':_['map'](_0x5d8abf,function(_0x369034){if(_0x369034[_0x2e97('0x3b')]!=='VIRTUAL'){var _0x2a8034={};_0x2a8034[_0x369034['name']]={'$like':'%'+_0x5ef7f7['query'][_0x2e97('0x3c')]+'%'};return _0x2a8034;}})});}_0x31ac51=_[_0x2e97('0x3a')]({},_0x31ac51,_0x5ef7f7[_0x2e97('0x3d')]);var _0x3d2c31={'where':_0x31ac51[_0x2e97('0x39')]};return db[_0x2e97('0x2a')][_0x2e97('0x1b')](_0x3d2c31)[_0x2e97('0x23')](function(_0x53749b){_0x1ae724['count']=_0x53749b;if(_0x5ef7f7[_0x2e97('0x30')][_0x2e97('0x3e')]){_0x31ac51[_0x2e97('0x3f')]=[{'all':!![]}];}return db[_0x2e97('0x2a')][_0x2e97('0x40')](_0x31ac51);})['then'](function(_0x4ed358){_0x1ae724[_0x2e97('0x41')]=_0x4ed358;return _0x1ae724;})['then'](respondWithFilteredResult(_0x150587,_0x31ac51))[_0x2e97('0x42')](handleError(_0x150587,null));};exports[_0x2e97('0x43')]=function(_0x44505f,_0x27ff47){var _0x199dcf={'raw':!![],'where':{'id':_0x44505f[_0x2e97('0x44')]['id']}},_0x46e0a2={};_0x46e0a2[_0x2e97('0x2e')]=_[_0x2e97('0x2f')](db[_0x2e97('0x2a')][_0x2e97('0x2b')]);_0x46e0a2['query']=_[_0x2e97('0x2f')](_0x44505f[_0x2e97('0x30')]);_0x46e0a2[_0x2e97('0x31')]=_['intersection'](_0x46e0a2[_0x2e97('0x2e')],_0x46e0a2[_0x2e97('0x30')]);_0x199dcf[_0x2e97('0x33')]=_[_0x2e97('0x32')](_0x46e0a2[_0x2e97('0x2e')],qs[_0x2e97('0x34')](_0x44505f[_0x2e97('0x30')][_0x2e97('0x34')]));_0x199dcf[_0x2e97('0x33')]=_0x199dcf[_0x2e97('0x33')]['length']?_0x199dcf['attributes']:_0x46e0a2['model'];if(_0x44505f['query']['includeAll']){_0x199dcf['include']=[{'all':!![]}];}_0x199dcf=_['merge']({},_0x199dcf,_0x44505f['options']);return db['FaxApplication'][_0x2e97('0x45')](_0x199dcf)['then'](handleEntityNotFound(_0x27ff47,null))['then'](respondWithResult(_0x27ff47,null))[_0x2e97('0x42')](handleError(_0x27ff47,null));};exports['create']=function(_0x525a67,_0x557a1c){return db[_0x2e97('0x2a')][_0x2e97('0x46')](_0x525a67[_0x2e97('0x47')],{})[_0x2e97('0x23')](respondWithResult(_0x557a1c,0xc9))[_0x2e97('0x42')](handleError(_0x557a1c,null));};exports['update']=function(_0x3d4e52,_0x321655){if(_0x3d4e52[_0x2e97('0x47')]['id']){delete _0x3d4e52[_0x2e97('0x47')]['id'];}return db[_0x2e97('0x2a')][_0x2e97('0x45')]({'where':{'id':_0x3d4e52[_0x2e97('0x44')]['id']}})[_0x2e97('0x23')](handleEntityNotFound(_0x321655,null))[_0x2e97('0x23')](saveUpdates(_0x3d4e52[_0x2e97('0x47')],null))[_0x2e97('0x23')](respondWithResult(_0x321655,null))['catch'](handleError(_0x321655,null));};exports[_0x2e97('0x48')]=function(_0x224656,_0x116242){return db['FaxApplication'][_0x2e97('0x45')]({'where':{'id':_0x224656[_0x2e97('0x44')]['id']}})[_0x2e97('0x23')](handleEntityNotFound(_0x116242,null))[_0x2e97('0x23')](removeEntity(_0x116242,null))[_0x2e97('0x42')](handleError(_0x116242,null));};
\ No newline at end of file
index 0c2c742..50a45a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4868=['bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','moment'];(function(_0x59a73e,_0x5d044c){var _0x375f58=function(_0x319cf9){while(--_0x319cf9){_0x59a73e['push'](_0x59a73e['shift']());}};_0x375f58(++_0x5d044c);}(_0x4868,0x97));var _0x8486=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4868[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x8486('0x0'));var logger=require(_0x8486('0x1'))('api');var moment=require(_0x8486('0x2'));var BPromise=require(_0x8486('0x3'));var rp=require(_0x8486('0x4'));var fs=require('fs');var path=require(_0x8486('0x5'));var rimraf=require(_0x8486('0x6'));var config=require(_0x8486('0x7'));var attributes=require(_0x8486('0x8'));module[_0x8486('0x9')]=function(_0x42c980,_0x512cb8){return _0x42c980[_0x8486('0xa')](_0x8486('0xb'),attributes,{'tableName':_0x8486('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8486('0xd')});};
\ No newline at end of file
+var _0x143f=['./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x50fe6c,_0xbf5380){var _0x18175f=function(_0x19eb08){while(--_0x19eb08){_0x50fe6c['push'](_0x50fe6c['shift']());}};_0x18175f(++_0xbf5380);}(_0x143f,0x1aa));var _0xf143=function(_0x435c6a,_0x4599d7){_0x435c6a=_0x435c6a-0x0;var _0xb15be4=_0x143f[_0x435c6a];return _0xb15be4;};'use strict';var _=require('lodash');var util=require(_0xf143('0x0'));var logger=require(_0xf143('0x1'))(_0xf143('0x2'));var moment=require('moment');var BPromise=require(_0xf143('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf143('0x4'));var rimraf=require(_0xf143('0x5'));var config=require('../../config/environment');var attributes=require(_0xf143('0x6'));module['exports']=function(_0x279a90,_0x1365bd){return _0x279a90[_0xf143('0x7')](_0xf143('0x8'),attributes,{'tableName':_0xf143('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf143('0xa'),'collate':_0xf143('0xb')});};
\ No newline at end of file
index efa8e3d..a4126f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x843f=['request','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','FaxApplication,\x20%s,\x20%s','info','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','attributes','limit','then','util','moment','randomstring','ioredis','../../config/logger','jayson/promise','client'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x843f,0xd1));var _0xf843=function(_0x1db227,_0x250927){_0x1db227=_0x1db227-0x0;var _0x27af8c=_0x843f[_0x1db227];return _0x27af8c;};'use strict';var _=require('lodash');var util=require(_0xf843('0x0'));var moment=require(_0xf843('0x1'));var BPromise=require('bluebird');var rs=require(_0xf843('0x2'));var fs=require('fs');var Redis=require(_0xf843('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf843('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf843('0x5'));var client=jayson[_0xf843('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x955ffc,_0x3bb9e2,_0x2ff9a2){return new BPromise(function(_0x32bf86,_0x3dc57e){return client[_0xf843('0x7')](_0x955ffc,_0x2ff9a2)['then'](function(_0x5339ca){logger['info']('FaxApplication,\x20%s,\x20%s',_0x3bb9e2,_0xf843('0x8'));logger[_0xf843('0x9')](_0xf843('0xa'),_0x3bb9e2,'request\x20sent',JSON[_0xf843('0xb')](_0x5339ca));if(_0x5339ca[_0xf843('0xc')]){if(_0x5339ca[_0xf843('0xc')]['code']===0x1f4){logger[_0xf843('0xc')]('FaxApplication,\x20%s,\x20%s',_0x3bb9e2,_0x5339ca[_0xf843('0xc')]['message']);return _0x3dc57e(_0x5339ca[_0xf843('0xc')][_0xf843('0xd')]);}logger[_0xf843('0xc')](_0xf843('0xe'),_0x3bb9e2,_0x5339ca[_0xf843('0xc')][_0xf843('0xd')]);return _0x32bf86(_0x5339ca[_0xf843('0xc')][_0xf843('0xd')]);}else{logger[_0xf843('0xf')](_0xf843('0xe'),_0x3bb9e2,_0xf843('0x8'));_0x32bf86(_0x5339ca[_0xf843('0x10')][_0xf843('0xd')]);}})[_0xf843('0x11')](function(_0x4404cd){logger[_0xf843('0xc')](_0xf843('0xe'),_0x3bb9e2,_0x4404cd);_0x3dc57e(_0x4404cd);});});}exports[_0xf843('0x12')]=function(_0x34beba){var _0xd5ddcc=this;return new Promise(function(_0x8e9966,_0x487077){return db[_0xf843('0x13')][_0xf843('0x14')](_0x34beba[_0xf843('0x15')],{'raw':_0x34beba[_0xf843('0x16')]?_0x34beba['options'][_0xf843('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34beba[_0xf843('0x16')]?_0x34beba[_0xf843('0x16')]['where']||null:null,'attributes':_0x34beba[_0xf843('0x16')]?_0x34beba[_0xf843('0x16')][_0xf843('0x18')]||null:null,'limit':_0x34beba[_0xf843('0x16')]?_0x34beba['options'][_0xf843('0x19')]||null:null})[_0xf843('0x1a')](function(_0x156043){logger[_0xf843('0xf')](_0xf843('0x12'),_0x34beba);logger[_0xf843('0x9')](_0xf843('0x12'),_0x34beba,JSON[_0xf843('0xb')](_0x156043));_0x8e9966(_0x156043);})[_0xf843('0x11')](function(_0x4c0b33){logger[_0xf843('0xc')](_0xf843('0x12'),_0x4c0b33[_0xf843('0xd')],_0x34beba);_0x487077(_0xd5ddcc['error'](0x1f4,_0x4c0b33[_0xf843('0xd')]));});});};
\ No newline at end of file
+var _0x836d=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FaxApplication','update','body','raw','options','where','attributes','limit','then','UpdateFaxApplication','debug','lodash','util','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x836d,0x126));var _0xd836=function(_0xa7239,_0x5d230f){_0xa7239=_0xa7239-0x0;var _0xb3675e=_0x836d[_0xa7239];return _0xb3675e;};'use strict';var _=require(_0xd836('0x0'));var util=require(_0xd836('0x1'));var moment=require(_0xd836('0x2'));var BPromise=require(_0xd836('0x3'));var rs=require(_0xd836('0x4'));var fs=require('fs');var Redis=require(_0xd836('0x5'));var db=require(_0xd836('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xd836('0x7'))(_0xd836('0x8'));var config=require(_0xd836('0x9'));var jayson=require(_0xd836('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4534ef,_0x2da02d,_0x17a97c){return new BPromise(function(_0x83e235,_0x1ead58){return client[_0xd836('0xb')](_0x4534ef,_0x17a97c)['then'](function(_0x422358){logger[_0xd836('0xc')](_0xd836('0xd'),_0x2da02d,_0xd836('0xe'));logger['debug'](_0xd836('0xf'),_0x2da02d,_0xd836('0xe'),JSON[_0xd836('0x10')](_0x422358));if(_0x422358[_0xd836('0x11')]){if(_0x422358[_0xd836('0x11')][_0xd836('0x12')]===0x1f4){logger[_0xd836('0x11')](_0xd836('0xd'),_0x2da02d,_0x422358[_0xd836('0x11')][_0xd836('0x13')]);return _0x1ead58(_0x422358['error'][_0xd836('0x13')]);}logger[_0xd836('0x11')](_0xd836('0xd'),_0x2da02d,_0x422358['error'][_0xd836('0x13')]);return _0x83e235(_0x422358[_0xd836('0x11')]['message']);}else{logger['info'](_0xd836('0xd'),_0x2da02d,_0xd836('0xe'));_0x83e235(_0x422358[_0xd836('0x14')][_0xd836('0x13')]);}})[_0xd836('0x15')](function(_0x3de73e){logger[_0xd836('0x11')]('FaxApplication,\x20%s,\x20%s',_0x2da02d,_0x3de73e);_0x1ead58(_0x3de73e);});});}exports['UpdateFaxApplication']=function(_0x1adb34){var _0x481a60=this;return new Promise(function(_0x8d745a,_0x4ba018){return db[_0xd836('0x16')][_0xd836('0x17')](_0x1adb34[_0xd836('0x18')],{'raw':_0x1adb34['options']?_0x1adb34['options'][_0xd836('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1adb34[_0xd836('0x1a')]?_0x1adb34[_0xd836('0x1a')][_0xd836('0x1b')]||null:null,'attributes':_0x1adb34['options']?_0x1adb34[_0xd836('0x1a')][_0xd836('0x1c')]||null:null,'limit':_0x1adb34[_0xd836('0x1a')]?_0x1adb34['options'][_0xd836('0x1d')]||null:null})[_0xd836('0x1e')](function(_0x4329bc){logger[_0xd836('0xc')](_0xd836('0x1f'),_0x1adb34);logger[_0xd836('0x20')](_0xd836('0x1f'),_0x1adb34,JSON[_0xd836('0x10')](_0x4329bc));_0x8d745a(_0x4329bc);})[_0xd836('0x15')](function(_0x209013){logger[_0xd836('0x11')](_0xd836('0x1f'),_0x209013[_0xd836('0x13')],_0x1adb34);_0x4ba018(_0x481a60[_0xd836('0x11')](0x1f4,_0x209013[_0xd836('0x13')]));});});};
\ No newline at end of file
index 1ac5cf5..09debc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x56c179,_0x158bd0){var _0x56c490=function(_0x4ca2fa){while(--_0x4ca2fa){_0x56c179['push'](_0x56c179['shift']());}};_0x56c490(++_0x158bd0);}(_0x4024,0x89));var _0x4402=function(_0x387526,_0xfd1885){_0x387526=_0x387526-0x0;var _0x3b53d0=_0x4024[_0x387526];return _0x3b53d0;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router;
\ No newline at end of file
+var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x2ede90,_0x3b446b){var _0x3283ea=function(_0x344c6e){while(--_0x344c6e){_0x2ede90['push'](_0x2ede90['shift']());}};_0x3283ea(++_0x3b446b);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router;
\ No newline at end of file
index daefbd9..e70c50a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd4f=['sequelize','STRING','DATE','out','ENUM','INTEGER'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x256d32,_0x551f16){_0x256d32=_0x256d32-0x0;var _0x409dab=_0xdd4f[_0x256d32];return _0x409dab;};'use strict';var Sequelize=require(_0xfdd4('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfdd4('0x1')]},'secondDisposition':{'type':Sequelize[_0xfdd4('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xfdd4('0x1')]},'read1stAt':{'type':Sequelize[_0xfdd4('0x2')]},'fax':{'type':Sequelize[_0xfdd4('0x1')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfdd4('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xfdd4('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xfdd4('0x4')]('in',_0xfdd4('0x3')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xfdd4('0x5')]}};
\ No newline at end of file
+var _0xcaf2=['DATE','STRING','ENUM','out','INTEGER','sequelize','BOOLEAN'];(function(_0x30ed79,_0x5cdfdb){var _0x5a2f51=function(_0x1296c6){while(--_0x1296c6){_0x30ed79['push'](_0x30ed79['shift']());}};_0x5a2f51(++_0x5cdfdb);}(_0xcaf2,0x8a));var _0x2caf=function(_0x1d5677,_0x342d27){_0x1d5677=_0x1d5677-0x0;var _0x274227=_0xcaf2[_0x1d5677];return _0x274227;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x2caf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2caf('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x2caf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2caf('0x3')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x2caf('0x2')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x2caf('0x4')]('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2caf('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x2caf('0x5')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x2caf('0x6')]}};
\ No newline at end of file
index ee05846..fb0cf86 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b60=['./faxInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','name','send','index','map','FaxInteraction','rawAttributes','fieldName','getOptions','findAll','fax','query','user','show','model','keys','intersection','attributes','fields','length','includeAll','include','options','find','catch','create','body','params','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','unix','toString','server','tmp','join','root','files','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','basename','existsSync','createReadStream','pipe','createWriteStream','download','log','err','unlinkSync','rimraf','zip-dir','bluebird','path','lodash','../../components/interaction/service','../../config/logger','api','../../config/environment','redis','defaults','localhost'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x4b60,0x1e8));var _0x04b6=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4b60[_0xa464c9];return _0x3d73c4;};'use strict';var rimraf=require(_0x04b6('0x0'));var zipdir=require(_0x04b6('0x1'));var moment=require('moment');var BPromise=require(_0x04b6('0x2'));var util=require('util');var path=require(_0x04b6('0x3'));var fs=require('fs');var _=require(_0x04b6('0x4'));var Redis=require('ioredis');var interaction=require(_0x04b6('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x04b6('0x6'))(_0x04b6('0x7'));var config=require(_0x04b6('0x8'));var db=require('../../mysqldb')['db'];config[_0x04b6('0x9')]=_[_0x04b6('0xa')](config[_0x04b6('0x9')],{'host':_0x04b6('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x04b6('0x9')]));require(_0x04b6('0xc'))['register'](socket);function respondWithStatusCode(_0x1b2a15,_0x5a963a){_0x5a963a=_0x5a963a||0xcc;return function(_0x4aea95){if(_0x4aea95){return _0x1b2a15[_0x04b6('0xd')](_0x5a963a);}return _0x1b2a15[_0x04b6('0xe')](_0x5a963a)[_0x04b6('0xf')]();};}function respondWithResult(_0x1127b1,_0x13836d){_0x13836d=_0x13836d||0xc8;return function(_0x4703d9){if(_0x4703d9){return _0x1127b1[_0x04b6('0xe')](_0x13836d)[_0x04b6('0x10')](_0x4703d9);}};}function respondWithFilteredResult(_0x4eee95,_0x539ba6){return function(_0x22ecac){if(_0x22ecac){var _0x2708f3=typeof _0x539ba6[_0x04b6('0x11')]===_0x04b6('0x12')&&typeof _0x539ba6[_0x04b6('0x13')]===_0x04b6('0x12');var _0x5520cf=_0x22ecac[_0x04b6('0x14')];var _0x2f0975=_0x2708f3?0x0:_0x539ba6[_0x04b6('0x11')];var _0x458433=_0x2708f3?_0x22ecac[_0x04b6('0x14')]:_0x539ba6['offset']+_0x539ba6[_0x04b6('0x13')];var _0x2074b6;if(_0x458433>=_0x5520cf){_0x458433=_0x5520cf;_0x2074b6=0xc8;}else{_0x2074b6=0xce;}_0x4eee95['status'](_0x2074b6);return _0x4eee95[_0x04b6('0x15')](_0x04b6('0x16'),_0x2f0975+'-'+_0x458433+'/'+_0x5520cf)[_0x04b6('0x10')](_0x22ecac);}return null;};}function saveUpdates(_0xbdbeb6){return function(_0x1713ca){if(_0x1713ca){return _0x1713ca[_0x04b6('0x17')](_0xbdbeb6)[_0x04b6('0x18')](function(_0x406b8e){return _0x406b8e;});}return null;};}function removeEntity(_0x1a7852){return function(_0x26d844){if(_0x26d844){return _0x26d844[_0x04b6('0x19')]()[_0x04b6('0x18')](function(){_0x1a7852[_0x04b6('0xe')](0xcc)[_0x04b6('0xf')]();});}};}function handleEntityNotFound(_0x1954a8){return function(_0x4d0ae2){if(!_0x4d0ae2){_0x1954a8[_0x04b6('0xd')](0x194);}return _0x4d0ae2;};}function handleError(_0x5874ff,_0x42d388){_0x42d388=_0x42d388||0x1f4;return function(_0x41089e){logger['error'](_0x41089e['stack']);if(_0x41089e[_0x04b6('0x1a')]){delete _0x41089e[_0x04b6('0x1a')];}_0x5874ff['status'](_0x42d388)[_0x04b6('0x1b')](_0x41089e);};}exports[_0x04b6('0x1c')]=function(_0x30c584,_0x17076b){var _0x407565={};var _0x41e483=_[_0x04b6('0x1d')](db[_0x04b6('0x1e')][_0x04b6('0x1f')],function(_0x1e3357){return{'name':_0x1e3357[_0x04b6('0x20')],'type':_0x1e3357['type']['key']};});_0x407565=qs[_0x04b6('0x21')](_0x41e483,_0x30c584);return interaction[_0x04b6('0x22')](_0x04b6('0x23'),_0x30c584[_0x04b6('0x24')],_0x30c584[_0x04b6('0x25')],_0x407565,_0x41e483)[_0x04b6('0x18')](respondWithFilteredResult(_0x17076b,_0x407565))['catch'](handleError(_0x17076b,null));};exports[_0x04b6('0x26')]=function(_0x594381,_0x2618f0){var _0xff7bcf={'raw':![],'where':{'id':_0x594381['params']['id']}},_0x245c06={};_0x245c06[_0x04b6('0x27')]=_['keys'](db[_0x04b6('0x1e')]['rawAttributes']);_0x245c06[_0x04b6('0x24')]=_[_0x04b6('0x28')](_0x594381[_0x04b6('0x24')]);_0x245c06['filters']=_[_0x04b6('0x29')](_0x245c06[_0x04b6('0x27')],_0x245c06[_0x04b6('0x24')]);_0xff7bcf[_0x04b6('0x2a')]=_[_0x04b6('0x29')](_0x245c06[_0x04b6('0x27')],qs[_0x04b6('0x2b')](_0x594381[_0x04b6('0x24')]['fields']));_0xff7bcf[_0x04b6('0x2a')]=_0xff7bcf[_0x04b6('0x2a')][_0x04b6('0x2c')]?_0xff7bcf[_0x04b6('0x2a')]:_0x245c06[_0x04b6('0x27')];if(_0x594381['query'][_0x04b6('0x2d')]){_0xff7bcf[_0x04b6('0x2e')]=[{'all':!![]}];}_0xff7bcf=_['merge']({},_0xff7bcf,_0x594381[_0x04b6('0x2f')]);return db['FaxInteraction'][_0x04b6('0x30')](_0xff7bcf)[_0x04b6('0x18')](handleEntityNotFound(_0x2618f0,null))[_0x04b6('0x18')](respondWithResult(_0x2618f0,null))[_0x04b6('0x31')](handleError(_0x2618f0,null));};exports['create']=function(_0x338d84,_0x67c171){return db[_0x04b6('0x1e')][_0x04b6('0x32')](_0x338d84['body'],{})[_0x04b6('0x18')](respondWithResult(_0x67c171,0xc9))['catch'](handleError(_0x67c171,null));};exports[_0x04b6('0x17')]=function(_0x49590e,_0x5a2756){if(_0x49590e[_0x04b6('0x33')]['id']){delete _0x49590e[_0x04b6('0x33')]['id'];}return db['FaxInteraction'][_0x04b6('0x30')]({'where':{'id':_0x49590e[_0x04b6('0x34')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x5a2756,null))[_0x04b6('0x18')](saveUpdates(_0x49590e[_0x04b6('0x33')],null))[_0x04b6('0x18')](respondWithResult(_0x5a2756,null))[_0x04b6('0x31')](handleError(_0x5a2756,null));};exports[_0x04b6('0x19')]=function(_0x2aca25,_0x174eb1){return db['FaxInteraction'][_0x04b6('0x30')]({'where':{'id':_0x2aca25['params']['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x174eb1,null))[_0x04b6('0x18')](removeEntity(_0x174eb1,null))[_0x04b6('0x31')](handleError(_0x174eb1,null));};exports[_0x04b6('0x35')]=function(_0x3adf2d,_0x283daf){return db['FaxInteraction']['describe']()['then'](respondWithResult(_0x283daf,null))[_0x04b6('0x31')](handleError(_0x283daf,null));};exports[_0x04b6('0x36')]=function(_0x5b6cae,_0x238977){return db[_0x04b6('0x37')][_0x04b6('0x30')]({'where':{'id':_0x5b6cae['params']['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x238977,null))[_0x04b6('0x18')](function(_0x557805){if(_0x557805){return _0x557805[_0x04b6('0x36')](_0x5b6cae[_0x04b6('0x33')]['ids'],_[_0x04b6('0x38')](_0x5b6cae[_0x04b6('0x33')],[_0x04b6('0x39'),'id'])||{});}})[_0x04b6('0x18')](respondWithResult(_0x238977,null))[_0x04b6('0x31')](handleError(_0x238977,null));};exports[_0x04b6('0x3a')]=function(_0x10f8a5,_0x2fb532){var _0x1552ba={'raw':![],'where':{}};var _0x4a0a16={};var _0x1f4346={'count':0x0,'rows':[]};return db[_0x04b6('0x1e')][_0x04b6('0x3b')]({'where':{'id':_0x10f8a5['params']['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x2fb532,null))[_0x04b6('0x18')](function(_0x11771f){if(_0x11771f){_0x4a0a16[_0x04b6('0x27')]=_[_0x04b6('0x28')](db[_0x04b6('0x37')][_0x04b6('0x1f')]);_0x4a0a16[_0x04b6('0x24')]=_[_0x04b6('0x28')](_0x10f8a5[_0x04b6('0x24')]);_0x4a0a16['filters']=_[_0x04b6('0x29')](_0x4a0a16[_0x04b6('0x27')],_0x4a0a16[_0x04b6('0x24')]);_0x1552ba[_0x04b6('0x2a')]=_['intersection'](_0x4a0a16[_0x04b6('0x27')],qs[_0x04b6('0x2b')](_0x10f8a5['query'][_0x04b6('0x2b')]));_0x1552ba[_0x04b6('0x2a')]=_0x1552ba[_0x04b6('0x2a')]['length']?_0x1552ba[_0x04b6('0x2a')]:_0x4a0a16['model'];if(!_0x10f8a5[_0x04b6('0x24')][_0x04b6('0x3c')](_0x04b6('0x3d'))){_0x1552ba['limit']=qs[_0x04b6('0x13')](_0x10f8a5['query'][_0x04b6('0x13')]);_0x1552ba[_0x04b6('0x11')]=qs[_0x04b6('0x11')](_0x10f8a5[_0x04b6('0x24')][_0x04b6('0x11')]);}_0x1552ba[_0x04b6('0x3e')]=qs['sort'](_0x10f8a5[_0x04b6('0x24')][_0x04b6('0x3f')]);_0x1552ba[_0x04b6('0x40')]=qs[_0x04b6('0x41')](_[_0x04b6('0x42')](_0x10f8a5[_0x04b6('0x24')],_0x4a0a16['filters']));_0x1552ba['where']['FaxInteractionId']=_0x11771f['id'];if(_0x10f8a5[_0x04b6('0x24')][_0x04b6('0x43')]){_0x1552ba['where']=_[_0x04b6('0x44')](_0x1552ba[_0x04b6('0x40')],{'$or':_['map'](_0x1552ba['attributes'],function(_0x2c49e6){var _0x2d997a={};_0x2d997a[_0x2c49e6]={'$like':'%'+_0x10f8a5['query'][_0x04b6('0x43')]+'%'};return _0x2d997a;})});}if(_0x10f8a5[_0x04b6('0x24')][_0x04b6('0x45')]){var _0x3baa15=_0x10f8a5[_0x04b6('0x24')][_0x04b6('0x45')][_0x04b6('0x46')](',');var _0x309323={};_0x309323[_0x3baa15[0x0]]={'$gte':moment(_0x3baa15[0x1])['format'](_0x04b6('0x47'))};_0x1552ba[_0x04b6('0x40')]=_[_0x04b6('0x44')](_0x1552ba[_0x04b6('0x40')],_0x309323);}_0x1552ba=_['merge']({},_0x1552ba,_0x10f8a5['options']);return db[_0x04b6('0x37')][_0x04b6('0x14')]({'where':_0x1552ba[_0x04b6('0x40')]})[_0x04b6('0x18')](function(_0x5961a9){_0x1f4346[_0x04b6('0x14')]=_0x5961a9;if(_0x10f8a5[_0x04b6('0x24')]['includeAll']){_0x1552ba[_0x04b6('0x2e')]=[{'all':!![]}];}return db[_0x04b6('0x37')][_0x04b6('0x22')](_0x1552ba);})[_0x04b6('0x18')](function(_0x1cd3a4){_0x1f4346['rows']=_0x1cd3a4;return _0x1f4346;});}})['then'](respondWithFilteredResult(_0x2fb532,_0x1552ba))['catch'](handleError(_0x2fb532,null));};exports[_0x04b6('0x48')]=function(_0x332cb7,_0x29f9ce){return db[_0x04b6('0x1e')]['find']({'where':{'id':_0x332cb7[_0x04b6('0x34')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x29f9ce,null))['then'](function(_0x22982d){if(_0x22982d){return _0x22982d[_0x04b6('0x49')](_0x332cb7[_0x04b6('0x33')][_0x04b6('0x39')],_['omit'](_0x332cb7[_0x04b6('0x33')],[_0x04b6('0x39'),'id'])||{})[_0x04b6('0x4a')](function(){return db[_0x04b6('0x4b')][_0x04b6('0x22')]({'attributes':['id',_0x04b6('0x1a'),'color'],'where':{'id':_0x332cb7[_0x04b6('0x33')][_0x04b6('0x39')]}});})[_0x04b6('0x18')](function(_0x16e779){socket['emit']('faxInteractionTags:save',{'id':Number(_0x332cb7[_0x04b6('0x34')]['id']),'tags':_0x16e779||[]});return{'id':Number(_0x332cb7['params']['id']),'tags':_0x16e779||[]};});}})[_0x04b6('0x18')](respondWithResult(_0x29f9ce,null))[_0x04b6('0x31')](handleError(_0x29f9ce,null));};exports['removeTags']=function(_0x326ed5,_0x57871c){return db[_0x04b6('0x1e')]['find']({'where':{'id':_0x326ed5[_0x04b6('0x34')]['id']}})[_0x04b6('0x18')](handleEntityNotFound(_0x57871c,null))[_0x04b6('0x18')](function(_0x3f406a){if(_0x3f406a){return _0x3f406a['removeTags'](_0x326ed5['query'][_0x04b6('0x39')]);}})[_0x04b6('0x18')](respondWithStatusCode(_0x57871c,null))[_0x04b6('0x31')](handleError(_0x57871c,null));};exports['download']=function(_0x575fb4,_0x146e31){var _0x4c8996=moment()[_0x04b6('0x4c')]()[_0x04b6('0x4d')]();var _0x5e5ccd=path['join'](config['root'],_0x04b6('0x4e'),'files',_0x04b6('0x4f'));var _0x516dba=path[_0x04b6('0x50')](config[_0x04b6('0x51')],_0x04b6('0x4e'),_0x04b6('0x52'),_0x04b6('0x53'));var _0x217382=path[_0x04b6('0x50')](_0x5e5ccd,_0x4c8996);var _0x3ff9d6=util[_0x04b6('0x54')](_0x04b6('0x55'),_0x575fb4[_0x04b6('0x34')]['id'],_0x4c8996);var _0x4a2ded=path[_0x04b6('0x50')](_0x5e5ccd,_0x3ff9d6);var _0x377f46=[];_0x377f46[_0x04b6('0x56')]({'model':db[_0x04b6('0x57')],'as':_0x04b6('0x57'),'raw':!![]});var _0xb80093=[{'model':db[_0x04b6('0x37')],'as':_0x04b6('0x58'),'attributes':['id',_0x04b6('0x33'),_0x04b6('0x59')],'include':_0x377f46}];return db[_0x04b6('0x1e')][_0x04b6('0x30')]({'where':{'id':_0x575fb4['params']['id']},'include':_0xb80093})['then'](handleEntityNotFound(_0x146e31,null))[_0x04b6('0x18')](function(_0xd205d9){if(_0xd205d9&&_0xd205d9[_0x04b6('0x58')]){var _0x382ff3=_0xd205d9[_0x04b6('0x5a')]({'plain':!![]});fs['mkdirSync'](_0x217382);for(var _0x4ebbd8=0x0;_0x4ebbd8<_0x382ff3[_0x04b6('0x58')][_0x04b6('0x2c')];_0x4ebbd8++){var _0x408fc5=_0x382ff3[_0x04b6('0x58')][_0x4ebbd8][_0x04b6('0x57')];if(_0x408fc5){var _0x31a377=path['join'](_0x516dba,_0x408fc5[_0x04b6('0x5b')]);if(fs[_0x04b6('0x5c')](_0x31a377)){fs[_0x04b6('0x5d')](_0x31a377)[_0x04b6('0x5e')](fs[_0x04b6('0x5f')](path[_0x04b6('0x50')](_0x217382,_0x408fc5[_0x04b6('0x5b')])));}}}return BPromise['resolve']()[_0x04b6('0x18')](function(){return new BPromise(function(_0x5c06ad,_0x2c4143){zipdir(_0x217382,{'saveTo':_0x4a2ded},function(_0x4e7285,_0x353207){if(_0x4e7285)return _0x2c4143(_0x4e7285);return _0x5c06ad(_0x353207);});})['then'](function(){return new BPromise(function(_0x5550de,_0x1944e7){rimraf(_0x217382,function(_0x4a2a8a){if(_0x4a2a8a)_0x1944e7(_0x4a2a8a);return _0x5550de();});});})[_0x04b6('0x18')](function(){return _0x146e31[_0x04b6('0x60')](_0x4a2ded,_0x3ff9d6,function(_0x34c787){if(_0x34c787){console[_0x04b6('0x61')](_0x04b6('0x62'),_0x34c787);}else{fs[_0x04b6('0x63')](_0x4a2ded);}});});});}else{return _0x146e31[_0x04b6('0xd')](0xc8);}})[_0x04b6('0x31')](handleError(_0x146e31,null));};
\ No newline at end of file
+var _0xf502=['fieldName','type','key','getOptions','findAll','query','user','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','describe','addMessage','FaxMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','where','map','filter','format','rows','spread','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','attachments','transcript-%d-%s.zip','push','Messages','createdAt','get','mkdirSync','Attachment','basename','existsSync','createReadStream','pipe','createWriteStream','resolve','err','unlinkSync','rimraf','zip-dir','moment','util','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','offset','limit','count','set','Content-Range','json','update','destroy','then','error','stack','name','send','index','FaxInteraction','rawAttributes'];(function(_0x4b2251,_0x393f10){var _0x5d22fb=function(_0x10992c){while(--_0x10992c){_0x4b2251['push'](_0x4b2251['shift']());}};_0x5d22fb(++_0x393f10);}(_0xf502,0x104));var _0x2f50=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0xf502[_0x14476b];return _0x24e2e8;};'use strict';var rimraf=require(_0x2f50('0x0'));var zipdir=require(_0x2f50('0x1'));var moment=require(_0x2f50('0x2'));var BPromise=require('bluebird');var util=require(_0x2f50('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x2f50('0x4'));var Redis=require('ioredis');var interaction=require(_0x2f50('0x5'));var qs=require(_0x2f50('0x6'));var logger=require(_0x2f50('0x7'))(_0x2f50('0x8'));var config=require(_0x2f50('0x9'));var db=require(_0x2f50('0xa'))['db'];config[_0x2f50('0xb')]=_[_0x2f50('0xc')](config[_0x2f50('0xb')],{'host':_0x2f50('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2f50('0xb')]));require(_0x2f50('0xe'))[_0x2f50('0xf')](socket);function respondWithStatusCode(_0x21ea8f,_0xaa3365){_0xaa3365=_0xaa3365||0xcc;return function(_0x1e343e){if(_0x1e343e){return _0x21ea8f[_0x2f50('0x10')](_0xaa3365);}return _0x21ea8f[_0x2f50('0x11')](_0xaa3365)['end']();};}function respondWithResult(_0x418daf,_0x4aadb3){_0x4aadb3=_0x4aadb3||0xc8;return function(_0x5f5cac){if(_0x5f5cac){return _0x418daf['status'](_0x4aadb3)['json'](_0x5f5cac);}};}function respondWithFilteredResult(_0x397179,_0x4c185f){return function(_0x51672e){if(_0x51672e){var _0x4d27f0=typeof _0x4c185f[_0x2f50('0x12')]==='undefined'&&typeof _0x4c185f[_0x2f50('0x13')]==='undefined';var _0x1c449e=_0x51672e[_0x2f50('0x14')];var _0xa5ad2e=_0x4d27f0?0x0:_0x4c185f['offset'];var _0x22e635=_0x4d27f0?_0x51672e[_0x2f50('0x14')]:_0x4c185f[_0x2f50('0x12')]+_0x4c185f[_0x2f50('0x13')];var _0x2cb5e1;if(_0x22e635>=_0x1c449e){_0x22e635=_0x1c449e;_0x2cb5e1=0xc8;}else{_0x2cb5e1=0xce;}_0x397179['status'](_0x2cb5e1);return _0x397179[_0x2f50('0x15')](_0x2f50('0x16'),_0xa5ad2e+'-'+_0x22e635+'/'+_0x1c449e)[_0x2f50('0x17')](_0x51672e);}return null;};}function saveUpdates(_0xcc1fc4){return function(_0x4a43eb){if(_0x4a43eb){return _0x4a43eb[_0x2f50('0x18')](_0xcc1fc4)['then'](function(_0x496239){return _0x496239;});}return null;};}function removeEntity(_0x316040){return function(_0xf00f28){if(_0xf00f28){return _0xf00f28[_0x2f50('0x19')]()[_0x2f50('0x1a')](function(){_0x316040[_0x2f50('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415ce3){return function(_0x3008c1){if(!_0x3008c1){_0x415ce3[_0x2f50('0x10')](0x194);}return _0x3008c1;};}function handleError(_0x1ec791,_0x1ff488){_0x1ff488=_0x1ff488||0x1f4;return function(_0x2f8e88){logger[_0x2f50('0x1b')](_0x2f8e88[_0x2f50('0x1c')]);if(_0x2f8e88[_0x2f50('0x1d')]){delete _0x2f8e88['name'];}_0x1ec791[_0x2f50('0x11')](_0x1ff488)[_0x2f50('0x1e')](_0x2f8e88);};}exports[_0x2f50('0x1f')]=function(_0x40419f,_0x479a69){var _0x2bd32d={};var _0x41be10=_['map'](db[_0x2f50('0x20')][_0x2f50('0x21')],function(_0x1aff1d){return{'name':_0x1aff1d[_0x2f50('0x22')],'type':_0x1aff1d[_0x2f50('0x23')][_0x2f50('0x24')]};});_0x2bd32d=qs[_0x2f50('0x25')](_0x41be10,_0x40419f);return interaction[_0x2f50('0x26')]('fax',_0x40419f[_0x2f50('0x27')],_0x40419f[_0x2f50('0x28')],_0x2bd32d,_0x41be10)[_0x2f50('0x1a')](respondWithFilteredResult(_0x479a69,_0x2bd32d))[_0x2f50('0x29')](handleError(_0x479a69,null));};exports['show']=function(_0xb36827,_0x3e39c8){var _0x5b7f79={'raw':![],'where':{'id':_0xb36827[_0x2f50('0x2a')]['id']}},_0x1f60ee={};_0x1f60ee[_0x2f50('0x2b')]=_['keys'](db[_0x2f50('0x20')][_0x2f50('0x21')]);_0x1f60ee[_0x2f50('0x27')]=_[_0x2f50('0x2c')](_0xb36827[_0x2f50('0x27')]);_0x1f60ee[_0x2f50('0x2d')]=_[_0x2f50('0x2e')](_0x1f60ee[_0x2f50('0x2b')],_0x1f60ee[_0x2f50('0x27')]);_0x5b7f79[_0x2f50('0x2f')]=_['intersection'](_0x1f60ee['model'],qs[_0x2f50('0x30')](_0xb36827[_0x2f50('0x27')][_0x2f50('0x30')]));_0x5b7f79[_0x2f50('0x2f')]=_0x5b7f79['attributes'][_0x2f50('0x31')]?_0x5b7f79['attributes']:_0x1f60ee[_0x2f50('0x2b')];if(_0xb36827[_0x2f50('0x27')][_0x2f50('0x32')]){_0x5b7f79[_0x2f50('0x33')]=[{'all':!![]}];}_0x5b7f79=_[_0x2f50('0x34')]({},_0x5b7f79,_0xb36827[_0x2f50('0x35')]);return db[_0x2f50('0x20')][_0x2f50('0x36')](_0x5b7f79)[_0x2f50('0x1a')](handleEntityNotFound(_0x3e39c8,null))[_0x2f50('0x1a')](respondWithResult(_0x3e39c8,null))[_0x2f50('0x29')](handleError(_0x3e39c8,null));};exports['create']=function(_0x129801,_0x41ba05){return db[_0x2f50('0x20')][_0x2f50('0x37')](_0x129801[_0x2f50('0x38')],{})[_0x2f50('0x1a')](respondWithResult(_0x41ba05,0xc9))['catch'](handleError(_0x41ba05,null));};exports['update']=function(_0x113517,_0x5db194){if(_0x113517[_0x2f50('0x38')]['id']){delete _0x113517[_0x2f50('0x38')]['id'];}return db[_0x2f50('0x20')][_0x2f50('0x36')]({'where':{'id':_0x113517[_0x2f50('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5db194,null))[_0x2f50('0x1a')](saveUpdates(_0x113517[_0x2f50('0x38')],null))['then'](respondWithResult(_0x5db194,null))[_0x2f50('0x29')](handleError(_0x5db194,null));};exports[_0x2f50('0x19')]=function(_0x1b3217,_0x2053c5){return db['FaxInteraction'][_0x2f50('0x36')]({'where':{'id':_0x1b3217[_0x2f50('0x2a')]['id']}})[_0x2f50('0x1a')](handleEntityNotFound(_0x2053c5,null))['then'](removeEntity(_0x2053c5,null))['catch'](handleError(_0x2053c5,null));};exports[_0x2f50('0x39')]=function(_0x3610ef,_0x364e75){return db[_0x2f50('0x20')][_0x2f50('0x39')]()['then'](respondWithResult(_0x364e75,null))['catch'](handleError(_0x364e75,null));};exports[_0x2f50('0x3a')]=function(_0x3d206e,_0x58c0cf){return db[_0x2f50('0x3b')][_0x2f50('0x36')]({'where':{'id':_0x3d206e[_0x2f50('0x2a')]['id']}})[_0x2f50('0x1a')](handleEntityNotFound(_0x58c0cf,null))['then'](function(_0xcaddbf){if(_0xcaddbf){return _0xcaddbf[_0x2f50('0x3a')](_0x3d206e[_0x2f50('0x38')][_0x2f50('0x3c')],_[_0x2f50('0x3d')](_0x3d206e['body'],[_0x2f50('0x3c'),'id'])||{});}})[_0x2f50('0x1a')](respondWithResult(_0x58c0cf,null))[_0x2f50('0x29')](handleError(_0x58c0cf,null));};exports['getMessages']=function(_0x1d993c,_0x524471){var _0x15a245={'raw':![],'where':{}};var _0x903564={};var _0x769379={'count':0x0,'rows':[]};return db[_0x2f50('0x20')][_0x2f50('0x3e')]({'where':{'id':_0x1d993c[_0x2f50('0x2a')]['id']}})[_0x2f50('0x1a')](handleEntityNotFound(_0x524471,null))[_0x2f50('0x1a')](function(_0x2414d9){if(_0x2414d9){_0x903564[_0x2f50('0x2b')]=_[_0x2f50('0x2c')](db[_0x2f50('0x3b')][_0x2f50('0x21')]);_0x903564[_0x2f50('0x27')]=_[_0x2f50('0x2c')](_0x1d993c[_0x2f50('0x27')]);_0x903564[_0x2f50('0x2d')]=_[_0x2f50('0x2e')](_0x903564[_0x2f50('0x2b')],_0x903564['query']);_0x15a245[_0x2f50('0x2f')]=_[_0x2f50('0x2e')](_0x903564['model'],qs['fields'](_0x1d993c[_0x2f50('0x27')][_0x2f50('0x30')]));_0x15a245[_0x2f50('0x2f')]=_0x15a245['attributes'][_0x2f50('0x31')]?_0x15a245['attributes']:_0x903564[_0x2f50('0x2b')];if(!_0x1d993c[_0x2f50('0x27')][_0x2f50('0x3f')](_0x2f50('0x40'))){_0x15a245[_0x2f50('0x13')]=qs['limit'](_0x1d993c['query'][_0x2f50('0x13')]);_0x15a245[_0x2f50('0x12')]=qs[_0x2f50('0x12')](_0x1d993c[_0x2f50('0x27')]['offset']);}_0x15a245[_0x2f50('0x41')]=qs[_0x2f50('0x42')](_0x1d993c[_0x2f50('0x27')]['sort']);_0x15a245[_0x2f50('0x43')]=qs['filters'](_['pick'](_0x1d993c[_0x2f50('0x27')],_0x903564['filters']));_0x15a245[_0x2f50('0x43')]['FaxInteractionId']=_0x2414d9['id'];if(_0x1d993c[_0x2f50('0x27')]['filter']){_0x15a245[_0x2f50('0x43')]=_[_0x2f50('0x34')](_0x15a245[_0x2f50('0x43')],{'$or':_[_0x2f50('0x44')](_0x15a245[_0x2f50('0x2f')],function(_0xcbab4){var _0x3b1c4f={};_0x3b1c4f[_0xcbab4]={'$like':'%'+_0x1d993c[_0x2f50('0x27')][_0x2f50('0x45')]+'%'};return _0x3b1c4f;})});}if(_0x1d993c[_0x2f50('0x27')]['$gte']){var _0x21d623=_0x1d993c['query']['$gte']['split'](',');var _0x214723={};_0x214723[_0x21d623[0x0]]={'$gte':moment(_0x21d623[0x1])[_0x2f50('0x46')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15a245[_0x2f50('0x43')]=_['merge'](_0x15a245[_0x2f50('0x43')],_0x214723);}_0x15a245=_[_0x2f50('0x34')]({},_0x15a245,_0x1d993c[_0x2f50('0x35')]);return db[_0x2f50('0x3b')][_0x2f50('0x14')]({'where':_0x15a245['where']})[_0x2f50('0x1a')](function(_0x42dba9){_0x769379[_0x2f50('0x14')]=_0x42dba9;if(_0x1d993c[_0x2f50('0x27')][_0x2f50('0x32')]){_0x15a245[_0x2f50('0x33')]=[{'all':!![]}];}return db[_0x2f50('0x3b')][_0x2f50('0x26')](_0x15a245);})[_0x2f50('0x1a')](function(_0x3e4013){_0x769379[_0x2f50('0x47')]=_0x3e4013;return _0x769379;});}})[_0x2f50('0x1a')](respondWithFilteredResult(_0x524471,_0x15a245))[_0x2f50('0x29')](handleError(_0x524471,null));};exports['addTags']=function(_0x22916b,_0x249224){return db[_0x2f50('0x20')][_0x2f50('0x36')]({'where':{'id':_0x22916b[_0x2f50('0x2a')]['id']}})['then'](handleEntityNotFound(_0x249224,null))[_0x2f50('0x1a')](function(_0x1b0d59){if(_0x1b0d59){return _0x1b0d59['setTags'](_0x22916b['body']['ids'],_['omit'](_0x22916b[_0x2f50('0x38')],[_0x2f50('0x3c'),'id'])||{})[_0x2f50('0x48')](function(){return db['Tag'][_0x2f50('0x26')]({'attributes':['id',_0x2f50('0x1d'),'color'],'where':{'id':_0x22916b[_0x2f50('0x38')][_0x2f50('0x3c')]}});})['then'](function(_0x121ae1){socket['emit'](_0x2f50('0x49'),{'id':Number(_0x22916b[_0x2f50('0x2a')]['id']),'tags':_0x121ae1||[]});return{'id':Number(_0x22916b[_0x2f50('0x2a')]['id']),'tags':_0x121ae1||[]};});}})[_0x2f50('0x1a')](respondWithResult(_0x249224,null))[_0x2f50('0x29')](handleError(_0x249224,null));};exports[_0x2f50('0x4a')]=function(_0x2d722c,_0x2d48ae){return db[_0x2f50('0x20')]['find']({'where':{'id':_0x2d722c['params']['id']}})[_0x2f50('0x1a')](handleEntityNotFound(_0x2d48ae,null))[_0x2f50('0x1a')](function(_0x1827a9){if(_0x1827a9){return _0x1827a9[_0x2f50('0x4a')](_0x2d722c[_0x2f50('0x27')][_0x2f50('0x3c')]);}})[_0x2f50('0x1a')](respondWithStatusCode(_0x2d48ae,null))[_0x2f50('0x29')](handleError(_0x2d48ae,null));};exports[_0x2f50('0x4b')]=function(_0x52fc52,_0x10d1c2){var _0x4ea1d4=moment()[_0x2f50('0x4c')]()[_0x2f50('0x4d')]();var _0x43bdcf=path[_0x2f50('0x4e')](config[_0x2f50('0x4f')],_0x2f50('0x50'),'files',_0x2f50('0x51'));var _0x18b0d2=path[_0x2f50('0x4e')](config[_0x2f50('0x4f')],'server','files',_0x2f50('0x52'));var _0x141f08=path[_0x2f50('0x4e')](_0x43bdcf,_0x4ea1d4);var _0x214971=util[_0x2f50('0x46')](_0x2f50('0x53'),_0x52fc52[_0x2f50('0x2a')]['id'],_0x4ea1d4);var _0x1dd7a2=path['join'](_0x43bdcf,_0x214971);var _0x491f1c=[];_0x491f1c[_0x2f50('0x54')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x3a4580=[{'model':db[_0x2f50('0x3b')],'as':_0x2f50('0x55'),'attributes':['id',_0x2f50('0x38'),_0x2f50('0x56')],'include':_0x491f1c}];return db[_0x2f50('0x20')][_0x2f50('0x36')]({'where':{'id':_0x52fc52[_0x2f50('0x2a')]['id']},'include':_0x3a4580})[_0x2f50('0x1a')](handleEntityNotFound(_0x10d1c2,null))[_0x2f50('0x1a')](function(_0x87d462){if(_0x87d462&&_0x87d462[_0x2f50('0x55')]){var _0x2ee372=_0x87d462[_0x2f50('0x57')]({'plain':!![]});fs[_0x2f50('0x58')](_0x141f08);for(var _0x34b54e=0x0;_0x34b54e<_0x2ee372[_0x2f50('0x55')]['length'];_0x34b54e++){var _0x285712=_0x2ee372[_0x2f50('0x55')][_0x34b54e][_0x2f50('0x59')];if(_0x285712){var _0xc4c785=path[_0x2f50('0x4e')](_0x18b0d2,_0x285712[_0x2f50('0x5a')]);if(fs[_0x2f50('0x5b')](_0xc4c785)){fs[_0x2f50('0x5c')](_0xc4c785)[_0x2f50('0x5d')](fs[_0x2f50('0x5e')](path[_0x2f50('0x4e')](_0x141f08,_0x285712[_0x2f50('0x5a')])));}}}return BPromise[_0x2f50('0x5f')]()[_0x2f50('0x1a')](function(){return new BPromise(function(_0x5e99b0,_0x3312fd){zipdir(_0x141f08,{'saveTo':_0x1dd7a2},function(_0x24fe37,_0x3a637c){if(_0x24fe37)return _0x3312fd(_0x24fe37);return _0x5e99b0(_0x3a637c);});})[_0x2f50('0x1a')](function(){return new BPromise(function(_0x587561,_0x330b89){rimraf(_0x141f08,function(_0x389840){if(_0x389840)_0x330b89(_0x389840);return _0x587561();});});})['then'](function(){return _0x10d1c2['download'](_0x1dd7a2,_0x214971,function(_0x413b04){if(_0x413b04){console['log'](_0x2f50('0x60'),_0x413b04);}else{fs[_0x2f50('0x61')](_0x1dd7a2);}});});});}else{return _0x10d1c2[_0x2f50('0x10')](0xc8);}})['catch'](handleError(_0x10d1c2,null));};
\ No newline at end of file
index c6cd6b0..533d19e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5225=['exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit','catch','hook'];(function(_0x269e23,_0x14d11c){var _0x69ad53=function(_0x34066c){while(--_0x34066c){_0x269e23['push'](_0x269e23['shift']());}};_0x69ad53(++_0x14d11c);}(_0x5225,0x1c3));var _0x5522=function(_0x6942e0,_0x131e6d){_0x6942e0=_0x6942e0-0x0;var _0xb86490=_0x5225[_0x6942e0];return _0xb86490;};'use strict';var EventEmitter=require(_0x5522('0x0'));var FaxInteraction=require(_0x5522('0x1'))['db'][_0x5522('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x5522('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x5522('0x4')](0x0);var events={'afterCreate':_0x5522('0x5'),'afterUpdate':_0x5522('0x6'),'afterDestroy':_0x5522('0x7')};function emitEvent(_0x4bd29a){return function(_0xedb173,_0x2a296a,_0x5a03a9){_0xedb173[_0x5522('0x8')]({'attributes':['id'],'raw':!![]})[_0x5522('0x9')](function(_0x31e039){_0xedb173[_0x5522('0xa')](_0x5522('0xb'),_0x31e039['map'](function(_0x235ccc){return{'id':_0x235ccc['id']};}));return FaxMessage[_0x5522('0xc')]({'where':{'FaxInteractionId':_0xedb173['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5522('0x9')](function(_0x4339e3){_0xedb173[_0x5522('0xa')](_0x5522('0xd'),_0x4339e3['length']);FaxInteractionEvents[_0x5522('0xe')](_0x4bd29a+':'+_0xedb173['id'],_0xedb173);FaxInteractionEvents['emit'](_0x4bd29a,_0xedb173);_0x5a03a9(null);})[_0x5522('0xf')](_0x5a03a9(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x5522('0x10')](e,emitEvent(event));}}module[_0x5522('0x11')]=FaxInteractionEvents;
\ No newline at end of file
+var _0x3bd5=['getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','../../mysqldb','FaxInteraction','FaxMessage','save','update','remove'];(function(_0x333537,_0x46cc18){var _0x5dbca5=function(_0x767207){while(--_0x767207){_0x333537['push'](_0x333537['shift']());}};_0x5dbca5(++_0x46cc18);}(_0x3bd5,0x10a));var _0x53bd=function(_0x2796e7,_0x5caa4c){_0x2796e7=_0x2796e7-0x0;var _0x5498c5=_0x3bd5[_0x2796e7];return _0x5498c5;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x53bd('0x0'))['db'][_0x53bd('0x1')];var FaxMessage=require(_0x53bd('0x0'))['db'][_0x53bd('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x53bd('0x3'),'afterUpdate':_0x53bd('0x4'),'afterDestroy':_0x53bd('0x5')};function emitEvent(_0x4e563b){return function(_0x5f53d2,_0x2a3311,_0x5d221e){_0x5f53d2[_0x53bd('0x6')]({'attributes':['id'],'raw':!![]})[_0x53bd('0x7')](function(_0x483860){_0x5f53d2[_0x53bd('0x8')](_0x53bd('0x9'),_0x483860['map'](function(_0x473af4){return{'id':_0x473af4['id']};}));return FaxMessage[_0x53bd('0xa')]({'where':{'FaxInteractionId':_0x5f53d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0x53bd('0x7')](function(_0x5b80bc){_0x5f53d2[_0x53bd('0x8')]('unreadMessages',_0x5b80bc[_0x53bd('0xb')]);FaxInteractionEvents['emit'](_0x4e563b+':'+_0x5f53d2['id'],_0x5f53d2);FaxInteractionEvents[_0x53bd('0xc')](_0x4e563b,_0x5f53d2);_0x5d221e(null);})[_0x53bd('0xd')](_0x5d221e(null));};}for(var e in events){if(events[_0x53bd('0xe')](e)){var event=events[e];FaxInteraction[_0x53bd('0xf')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents;
\ No newline at end of file
index f591935..da82b62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6efd=['FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define'];(function(_0x23a8ba,_0xab5848){var _0x468389=function(_0x5ea5f4){while(--_0x5ea5f4){_0x23a8ba['push'](_0x23a8ba['shift']());}};_0x468389(++_0xab5848);}(_0x6efd,0x87));var _0xd6ef=function(_0x26569d,_0x5726b3){_0x26569d=_0x26569d-0x0;var _0x57ba55=_0x6efd[_0x26569d];return _0x57ba55;};'use strict';var _=require('lodash');var util=require(_0xd6ef('0x0'));var logger=require('../../config/logger')(_0xd6ef('0x1'));var moment=require('moment');var BPromise=require(_0xd6ef('0x2'));var rp=require(_0xd6ef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd6ef('0x4'));var config=require(_0xd6ef('0x5'));var attributes=require(_0xd6ef('0x6'));module[_0xd6ef('0x7')]=function(_0x30091,_0x2bfe5a){return _0x30091[_0xd6ef('0x8')](_0xd6ef('0x9'),attributes,{'tableName':_0xd6ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x363da4,_0x240a7f,_0x5a9755){if(_0x363da4[_0xd6ef('0xb')](_0xd6ef('0xc'))){_0x363da4[_0xd6ef('0xd')]=moment()[_0xd6ef('0xe')](_0xd6ef('0xf'));}_0x5a9755(null,_0x363da4);}}});};
\ No newline at end of file
+var _0x4049=['lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2d48fa,_0x103065){var _0x4645b7=function(_0x5c8751){while(--_0x5c8751){_0x2d48fa['push'](_0x2d48fa['shift']());}};_0x4645b7(++_0x103065);}(_0x4049,0x177));var _0x9404=function(_0xc569f3,_0x485552){_0xc569f3=_0xc569f3-0x0;var _0x152849=_0x4049[_0xc569f3];return _0x152849;};'use strict';var _=require(_0x9404('0x0'));var util=require(_0x9404('0x1'));var logger=require(_0x9404('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9404('0x3'));var rp=require(_0x9404('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9404('0x5'));var attributes=require('./faxInteraction.attributes');module[_0x9404('0x6')]=function(_0x60a82e,_0x2f42c7){return _0x60a82e[_0x9404('0x7')](_0x9404('0x8'),attributes,{'tableName':_0x9404('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x40d475,_0x3d15a6,_0x3b93a1){if(_0x40d475[_0x9404('0xa')](_0x9404('0xb'))){_0x40d475[_0x9404('0xc')]=moment()[_0x9404('0xd')](_0x9404('0xe'));}_0x3b93a1(null,_0x40d475);}}});};
\ No newline at end of file
index f6fd123..c7c97f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbdcc=['request\x20sent','stringify','error','code','message','result','catch','FaxInteraction','update','body','options','raw','where','attributes','UpdateFaxInteraction','debug','addTags','ids','omit','AddTags','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./faxInteraction.socket','register','then','info','FaxInteraction,\x20%s,\x20%s'];(function(_0x38841c,_0x1af0bf){var _0x500610=function(_0x225955){while(--_0x225955){_0x38841c['push'](_0x38841c['shift']());}};_0x500610(++_0x1af0bf);}(_0xbdcc,0x161));var _0xcbdc=function(_0x5df641,_0x425a85){_0x5df641=_0x5df641-0x0;var _0x5035d1=_0xbdcc[_0x5df641];return _0x5035d1;};'use strict';var _=require(_0xcbdc('0x0'));var util=require(_0xcbdc('0x1'));var moment=require(_0xcbdc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbdc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcbdc('0x4'));var logger=require('../../config/logger')(_0xcbdc('0x5'));var config=require(_0xcbdc('0x6'));var jayson=require(_0xcbdc('0x7'));var client=jayson[_0xcbdc('0x8')]['http']({'port':0x232a});config['redis']=_[_0xcbdc('0x9')](config[_0xcbdc('0xa')],{'host':_0xcbdc('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcbdc('0xa')]));require(_0xcbdc('0xc'))[_0xcbdc('0xd')](socket);function respondWithRpcPromise(_0xd72d9b,_0xd029be,_0x3f8b44){return new BPromise(function(_0x43ddab,_0x1986d0){return client['request'](_0xd72d9b,_0x3f8b44)[_0xcbdc('0xe')](function(_0x32ad50){logger[_0xcbdc('0xf')](_0xcbdc('0x10'),_0xd029be,_0xcbdc('0x11'));logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0xd029be,_0xcbdc('0x11'),JSON[_0xcbdc('0x12')](_0x32ad50));if(_0x32ad50[_0xcbdc('0x13')]){if(_0x32ad50[_0xcbdc('0x13')][_0xcbdc('0x14')]===0x1f4){logger['error'](_0xcbdc('0x10'),_0xd029be,_0x32ad50[_0xcbdc('0x13')]['message']);return _0x1986d0(_0x32ad50['error'][_0xcbdc('0x15')]);}logger[_0xcbdc('0x13')](_0xcbdc('0x10'),_0xd029be,_0x32ad50[_0xcbdc('0x13')][_0xcbdc('0x15')]);return _0x43ddab(_0x32ad50[_0xcbdc('0x13')][_0xcbdc('0x15')]);}else{logger[_0xcbdc('0xf')](_0xcbdc('0x10'),_0xd029be,_0xcbdc('0x11'));_0x43ddab(_0x32ad50[_0xcbdc('0x16')][_0xcbdc('0x15')]);}})[_0xcbdc('0x17')](function(_0x3b09bd){logger[_0xcbdc('0x13')](_0xcbdc('0x10'),_0xd029be,_0x3b09bd);_0x1986d0(_0x3b09bd);});});}exports['UpdateFaxInteraction']=function(_0x1f0f0c){var _0x506345=this;return new Promise(function(_0xd48656,_0x61bd7f){return db[_0xcbdc('0x18')][_0xcbdc('0x19')](_0x1f0f0c[_0xcbdc('0x1a')],{'raw':_0x1f0f0c['options']?_0x1f0f0c[_0xcbdc('0x1b')][_0xcbdc('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f0f0c['options']?_0x1f0f0c['options'][_0xcbdc('0x1d')]||null:null,'attributes':_0x1f0f0c['options']?_0x1f0f0c[_0xcbdc('0x1b')][_0xcbdc('0x1e')]||null:null,'limit':_0x1f0f0c[_0xcbdc('0x1b')]?_0x1f0f0c[_0xcbdc('0x1b')]['limit']||null:null})['then'](function(_0x1ee875){logger[_0xcbdc('0xf')](_0xcbdc('0x1f'),_0x1f0f0c);logger[_0xcbdc('0x20')]('UpdateFaxInteraction',_0x1f0f0c,JSON[_0xcbdc('0x12')](_0x1ee875));_0xd48656(_0x1ee875);})[_0xcbdc('0x17')](function(_0x598e5b){logger['error']('UpdateFaxInteraction',_0x598e5b[_0xcbdc('0x15')],_0x1f0f0c);_0x61bd7f(_0x506345['error'](0x1f4,_0x598e5b[_0xcbdc('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x11cc31){return new Promise(function(_0x5c7095,_0x562a6d){return db[_0xcbdc('0x18')]['find']({'where':_0x11cc31[_0xcbdc('0x1b')]?_0x11cc31[_0xcbdc('0x1b')][_0xcbdc('0x1d')]||null:null})[_0xcbdc('0xe')](function(_0x1ee2d1){if(_0x1ee2d1){return _0x1ee2d1[_0xcbdc('0x21')](_0x11cc31['body'][_0xcbdc('0x22')],_[_0xcbdc('0x23')](_0x11cc31[_0xcbdc('0x1a')],[_0xcbdc('0x22'),'id'])||{});}})['spread'](function(_0x35f774){logger[_0xcbdc('0xf')](_0xcbdc('0x24'),_0x11cc31);logger['debug'](_0xcbdc('0x24'),_0x11cc31,JSON['stringify'](_0x35f774));_0x5c7095(_0x35f774);})[_0xcbdc('0x17')](function(_0x32cf90){logger[_0xcbdc('0x13')](_0xcbdc('0x24'),_0x32cf90[_0xcbdc('0x15')],_0x11cc31);_0x562a6d(_this[_0xcbdc('0x13')](0x1f4,_0x32cf90[_0xcbdc('0x15')]));});});};
\ No newline at end of file
+var _0xa3d2=['rpc','client','http','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','request\x20sent','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','FaxInteraction,\x20%s,\x20%s','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','where','attributes','limit','debug','AddTagsToFaxInteraction','find','body','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa3d2,0x19b));var _0x2a3d=function(_0x151721,_0x20d5bc){_0x151721=_0x151721-0x0;var _0x2deaa7=_0xa3d2[_0x151721];return _0x2deaa7;};'use strict';var _=require(_0x2a3d('0x0'));var util=require(_0x2a3d('0x1'));var moment=require(_0x2a3d('0x2'));var BPromise=require(_0x2a3d('0x3'));var rs=require(_0x2a3d('0x4'));var fs=require('fs');var Redis=require(_0x2a3d('0x5'));var db=require(_0x2a3d('0x6'))['db'];var utils=require(_0x2a3d('0x7'));var logger=require(_0x2a3d('0x8'))(_0x2a3d('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2a3d('0xa')][_0x2a3d('0xb')]({'port':0x232a});config[_0x2a3d('0xc')]=_['defaults'](config['redis'],{'host':_0x2a3d('0xd'),'port':0x18eb});var socket=require(_0x2a3d('0xe'))(new Redis(config[_0x2a3d('0xc')]));require(_0x2a3d('0xf'))[_0x2a3d('0x10')](socket);function respondWithRpcPromise(_0xe4319d,_0x14044e,_0x1a21f9){return new BPromise(function(_0x27a38f,_0x45cf66){return client[_0x2a3d('0x11')](_0xe4319d,_0x1a21f9)[_0x2a3d('0x12')](function(_0x71b80c){logger[_0x2a3d('0x13')]('FaxInteraction,\x20%s,\x20%s',_0x14044e,_0x2a3d('0x14'));logger['debug'](_0x2a3d('0x15'),_0x14044e,_0x2a3d('0x14'),JSON[_0x2a3d('0x16')](_0x71b80c));if(_0x71b80c['error']){if(_0x71b80c['error'][_0x2a3d('0x17')]===0x1f4){logger[_0x2a3d('0x18')](_0x2a3d('0x19'),_0x14044e,_0x71b80c[_0x2a3d('0x18')][_0x2a3d('0x1a')]);return _0x45cf66(_0x71b80c[_0x2a3d('0x18')]['message']);}logger[_0x2a3d('0x18')](_0x2a3d('0x19'),_0x14044e,_0x71b80c[_0x2a3d('0x18')][_0x2a3d('0x1a')]);return _0x27a38f(_0x71b80c[_0x2a3d('0x18')]['message']);}else{logger['info'](_0x2a3d('0x19'),_0x14044e,_0x2a3d('0x14'));_0x27a38f(_0x71b80c['result'][_0x2a3d('0x1a')]);}})[_0x2a3d('0x1b')](function(_0x5f04cb){logger[_0x2a3d('0x18')](_0x2a3d('0x19'),_0x14044e,_0x5f04cb);_0x45cf66(_0x5f04cb);});});}exports[_0x2a3d('0x1c')]=function(_0x271574){var _0x119840=this;return new Promise(function(_0x3670be,_0x1575b9){return db[_0x2a3d('0x1d')][_0x2a3d('0x1e')](_0x271574['body'],{'raw':_0x271574[_0x2a3d('0x1f')]?_0x271574[_0x2a3d('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x271574[_0x2a3d('0x1f')]?_0x271574[_0x2a3d('0x1f')][_0x2a3d('0x20')]||null:null,'attributes':_0x271574[_0x2a3d('0x1f')]?_0x271574['options'][_0x2a3d('0x21')]||null:null,'limit':_0x271574[_0x2a3d('0x1f')]?_0x271574[_0x2a3d('0x1f')][_0x2a3d('0x22')]||null:null})[_0x2a3d('0x12')](function(_0x1d6b2d){logger[_0x2a3d('0x13')]('UpdateFaxInteraction',_0x271574);logger[_0x2a3d('0x23')](_0x2a3d('0x1c'),_0x271574,JSON['stringify'](_0x1d6b2d));_0x3670be(_0x1d6b2d);})['catch'](function(_0x311380){logger[_0x2a3d('0x18')]('UpdateFaxInteraction',_0x311380[_0x2a3d('0x1a')],_0x271574);_0x1575b9(_0x119840['error'](0x1f4,_0x311380[_0x2a3d('0x1a')]));});});};exports[_0x2a3d('0x24')]=function(_0x5c979b){return new Promise(function(_0x170844,_0x4d6a88){return db['FaxInteraction'][_0x2a3d('0x25')]({'where':_0x5c979b[_0x2a3d('0x1f')]?_0x5c979b[_0x2a3d('0x1f')][_0x2a3d('0x20')]||null:null})['then'](function(_0x3e8a7f){if(_0x3e8a7f){return _0x3e8a7f['addTags'](_0x5c979b[_0x2a3d('0x26')]['ids'],_[_0x2a3d('0x27')](_0x5c979b['body'],['ids','id'])||{});}})[_0x2a3d('0x28')](function(_0x42ebef){logger[_0x2a3d('0x13')](_0x2a3d('0x29'),_0x5c979b);logger['debug']('AddTags',_0x5c979b,JSON[_0x2a3d('0x16')](_0x42ebef));_0x170844(_0x42ebef);})[_0x2a3d('0x1b')](function(_0x1c8b2c){logger[_0x2a3d('0x18')]('AddTags',_0x1c8b2c[_0x2a3d('0x1a')],_0x5c979b);_0x4d6a88(_this['error'](0x1f4,_0x1c8b2c[_0x2a3d('0x1a')]));});});};
\ No newline at end of file
index 4599d52..44ad79c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf0c8=['save','remove','update','emit','removeListener','register','length','faxInteraction:'];(function(_0x2bfbf8,_0xf5adf7){var _0x3ec22e=function(_0xbb194d){while(--_0xbb194d){_0x2bfbf8['push'](_0x2bfbf8['shift']());}};_0x3ec22e(++_0xf5adf7);}(_0xf0c8,0x1a0));var _0x8f0c=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0xf0c8[_0x513545];return _0x18b7c5;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x8f0c('0x0'),_0x8f0c('0x1'),_0x8f0c('0x2')];function createListener(_0x572dae,_0x121bb8){return function(_0xa04803){_0x121bb8[_0x8f0c('0x3')](_0x572dae,_0xa04803);};}function removeListener(_0x2e4799,_0x1a09cf){return function(){FaxInteractionEvents[_0x8f0c('0x4')](_0x2e4799,_0x1a09cf);};}exports[_0x8f0c('0x5')]=function(_0xe39ad1){for(var _0x6fcfd3=0x0,_0x3cfb62=events[_0x8f0c('0x6')];_0x6fcfd3<_0x3cfb62;_0x6fcfd3++){var _0x26d400=events[_0x6fcfd3];var _0x3074f4=createListener(_0x8f0c('0x7')+_0x26d400,_0xe39ad1);FaxInteractionEvents['on'](_0x26d400,_0x3074f4);}};
\ No newline at end of file
+var _0xdd32=['emit','update'];(function(_0x3d4846,_0x2a43e7){var _0x471729=function(_0x344510){while(--_0x344510){_0x3d4846['push'](_0x3d4846['shift']());}};_0x471729(++_0x2a43e7);}(_0xdd32,0x107));var _0x2dd3=function(_0x2bd2be,_0x417ecd){_0x2bd2be=_0x2bd2be-0x0;var _0x3abc42=_0xdd32[_0x2bd2be];return _0x3abc42;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save','remove',_0x2dd3('0x0')];function createListener(_0x5997c2,_0x27c49e){return function(_0x16dc9f){_0x27c49e[_0x2dd3('0x1')](_0x5997c2,_0x16dc9f);};}function removeListener(_0x993063,_0x2dff5f){return function(){FaxInteractionEvents['removeListener'](_0x993063,_0x2dff5f);};}exports['register']=function(_0x1a5ddc){for(var _0x28a5d8=0x0,_0x4bf414=events['length'];_0x28a5d8<_0x4bf414;_0x28a5d8++){var _0x22eb0a=events[_0x28a5d8];var _0x5a8bcf=createListener('faxInteraction:'+_0x22eb0a,_0x1a5ddc);FaxInteractionEvents['on'](_0x22eb0a,_0x5a8bcf);}};
\ No newline at end of file
index 62dcc53..dd78d5c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13a6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','/:id/download','download','post','create','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','update','delete','faxinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express'];(function(_0x54d923,_0x6e55cc){var _0x4d5b0e=function(_0x97586d){while(--_0x97586d){_0x54d923['push'](_0x54d923['shift']());}};_0x4d5b0e(++_0x6e55cc);}(_0x13a6,0x9c));var _0x613a=function(_0x320aec,_0x265e48){_0x320aec=_0x320aec-0x0;var _0x454780=_0x13a6[_0x320aec];return _0x454780;};'use strict';var multer=require(_0x613a('0x0'));var util=require('util');var path=require(_0x613a('0x1'));var timeout=require(_0x613a('0x2'));var express=require(_0x613a('0x3'));var router=express[_0x613a('0x4')]();var fs_extra=require(_0x613a('0x5'));var auth=require(_0x613a('0x6'));var interaction=require(_0x613a('0x7'));var config=require(_0x613a('0x8'));var controller=require(_0x613a('0x9'));router[_0x613a('0xa')]('/',auth[_0x613a('0xb')](),controller[_0x613a('0xc')]);router[_0x613a('0xa')](_0x613a('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x613a('0xa')](_0x613a('0xe'),auth[_0x613a('0xb')](),controller[_0x613a('0xf')]);router['get'](_0x613a('0x10'),auth['isAuthenticated'](),controller['getMessages']);router[_0x613a('0xa')](_0x613a('0x11'),auth['isAuthenticated'](),controller[_0x613a('0x12')]);router[_0x613a('0x13')]('/',auth['isAuthenticated'](),controller[_0x613a('0x14')]);router[_0x613a('0x13')]('/:id/messages',auth[_0x613a('0xb')](),controller['addMessage']);router['post'](_0x613a('0x15'),auth[_0x613a('0xb')](),interaction[_0x613a('0x16')](_0x613a('0x17'),_0x613a('0x18')),controller[_0x613a('0x19')]);router['put'](_0x613a('0xe'),auth[_0x613a('0xb')](),interaction[_0x613a('0x16')](_0x613a('0x17'),'faxinteraction:update'),controller[_0x613a('0x1a')]);router[_0x613a('0x1b')](_0x613a('0xe'),auth['isAuthenticated'](),interaction[_0x613a('0x16')](_0x613a('0x17'),_0x613a('0x1c')),controller[_0x613a('0x1d')]);router[_0x613a('0x1b')](_0x613a('0x15'),auth['isAuthenticated'](),controller[_0x613a('0x1e')]);module[_0x613a('0x1f')]=router;
\ No newline at end of file
+var _0x0f44=['update','delete','faxinteraction:destroy','destroy','removeTags','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','isAuthenticated','describe','get','show','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','fax','addTags','put','/:id','tracked'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0f44,0x7d));var _0x40f4=function(_0x5763cc,_0x1cc8f4){_0x5763cc=_0x5763cc-0x0;var _0x3bbecd=_0x0f44[_0x5763cc];return _0x3bbecd;};'use strict';var multer=require(_0x40f4('0x0'));var util=require(_0x40f4('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x40f4('0x2'));var router=express[_0x40f4('0x3')]();var fs_extra=require(_0x40f4('0x4'));var auth=require(_0x40f4('0x5'));var interaction=require(_0x40f4('0x6'));var config=require(_0x40f4('0x7'));var controller=require(_0x40f4('0x8'));router['get']('/',auth[_0x40f4('0x9')](),controller['index']);router['get']('/describe',auth[_0x40f4('0x9')](),controller[_0x40f4('0xa')]);router[_0x40f4('0xb')]('/:id',auth[_0x40f4('0x9')](),controller[_0x40f4('0xc')]);router[_0x40f4('0xb')]('/:id/messages',auth[_0x40f4('0x9')](),controller[_0x40f4('0xd')]);router['get'](_0x40f4('0xe'),auth[_0x40f4('0x9')](),controller[_0x40f4('0xf')]);router[_0x40f4('0x10')]('/',auth[_0x40f4('0x9')](),controller[_0x40f4('0x11')]);router[_0x40f4('0x10')]('/:id/messages',auth[_0x40f4('0x9')](),controller[_0x40f4('0x12')]);router[_0x40f4('0x10')](_0x40f4('0x13'),auth[_0x40f4('0x9')](),interaction['tracked'](_0x40f4('0x14'),'faxinteraction:addtags'),controller[_0x40f4('0x15')]);router[_0x40f4('0x16')](_0x40f4('0x17'),auth[_0x40f4('0x9')](),interaction[_0x40f4('0x18')](_0x40f4('0x14'),'faxinteraction:update'),controller[_0x40f4('0x19')]);router[_0x40f4('0x1a')](_0x40f4('0x17'),auth['isAuthenticated'](),interaction[_0x40f4('0x18')]('fax',_0x40f4('0x1b')),controller[_0x40f4('0x1c')]);router[_0x40f4('0x1a')](_0x40f4('0x13'),auth[_0x40f4('0x9')](),controller[_0x40f4('0x1d')]);module['exports']=router;
\ No newline at end of file
index 630d177..3b336c0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe94a=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0xe94a,0x1c7));var _0xae94=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0xe94a[_0x2becba];return _0x90b5dd;};'use strict';var Sequelize=require(_0xae94('0x0'));module[_0xae94('0x1')]={'body':{'type':Sequelize[_0xae94('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xae94('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xae94('0x4')]('in',_0xae94('0x5')),'defaultValue':_0xae94('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xae94('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xae94('0x6')]}};
\ No newline at end of file
+var _0xb205=['out','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0xb205,0xf0));var _0x5b20=function(_0x5030ea,_0xc07510){_0x5030ea=_0x5030ea-0x0;var _0x322984=_0xb205[_0x5030ea];return _0x322984;};'use strict';var Sequelize=require(_0x5b20('0x0'));module[_0x5b20('0x1')]={'body':{'type':Sequelize[_0x5b20('0x2')](_0x5b20('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5b20('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x5b20('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x5b20('0x6')]}};
\ No newline at end of file
index 9158efe..2e5180c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe191=['YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','fullname','email','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','User','internal','rejectmessage','create','findOne','isNil','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','files','attachments','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','message','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','end','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','fax-interactions','accept','fax','read','readAt','format'];(function(_0x545c8f,_0x2decd6){var _0x87a522=function(_0x4850cb){while(--_0x4850cb){_0x545c8f['push'](_0x545c8f['shift']());}};_0x87a522(++_0x2decd6);}(_0xe191,0x1f1));var _0x1e19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe191[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x1e19('0x0'));var rimraf=require(_0x1e19('0x1'));var zipdir=require(_0x1e19('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e19('0x3'));var moment=require('moment');var BPromise=require(_0x1e19('0x4'));var Mustache=require(_0x1e19('0x5'));var util=require(_0x1e19('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1e19('0x7'));var fs=require('fs');var fs_extra=require(_0x1e19('0x8'));var _=require(_0x1e19('0x9'));var squel=require(_0x1e19('0xa'));var crypto=require('crypto');var jsforce=require(_0x1e19('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1e19('0xc'));var querystring=require(_0x1e19('0xd'));var Papa=require(_0x1e19('0xe'));var Redis=require(_0x1e19('0xf'));var authService=require(_0x1e19('0x10'));var qs=require(_0x1e19('0x11'));var as=require(_0x1e19('0x12'));var hardwareService=require(_0x1e19('0x13'));var logger=require(_0x1e19('0x14'))(_0x1e19('0x15'));var utils=require('../../config/utils');var config=require(_0x1e19('0x16'));var licenseUtil=require(_0x1e19('0x17'));var db=require(_0x1e19('0x18'))['db'];config[_0x1e19('0x19')]=_[_0x1e19('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1e19('0x1b'))(new Redis(config[_0x1e19('0x19')]));require(_0x1e19('0x1c'))[_0x1e19('0x1d')](socket);var jayson=require(_0x1e19('0x1e'));var client=jayson[_0x1e19('0x1f')][_0x1e19('0x20')]({'port':0x232c});var client9002=jayson[_0x1e19('0x1f')][_0x1e19('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x566a5d,_0xbd754e,_0x281a27,_0x4bffad){return new BPromise(function(_0x59a2cc,_0x39a640){var _0x10d6f7=_0x4bffad||client;return _0x10d6f7['request'](_0x566a5d,_0x281a27)[_0x1e19('0x21')](function(_0x2dedbe){logger[_0x1e19('0x22')](_0x1e19('0x23'),_0xbd754e,_0x1e19('0x24'));logger[_0x1e19('0x25')](_0x1e19('0x26'),_0xbd754e,_0x1e19('0x24'),JSON['stringify'](_0x2dedbe));if(_0x2dedbe[_0x1e19('0x27')]){if(_0x2dedbe[_0x1e19('0x27')][_0x1e19('0x28')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0xbd754e,_0x2dedbe[_0x1e19('0x27')]['message']);return _0x39a640(_0x2dedbe['error']['message']);}logger[_0x1e19('0x27')](_0x1e19('0x23'),_0xbd754e,_0x2dedbe[_0x1e19('0x27')][_0x1e19('0x29')]);return _0x59a2cc(_0x2dedbe[_0x1e19('0x27')][_0x1e19('0x29')]);}else{logger['info'](_0x1e19('0x23'),_0xbd754e,_0x1e19('0x24'));_0x59a2cc(_0x2dedbe['result'][_0x1e19('0x29')]);}})['catch'](function(_0x5d7d15){logger[_0x1e19('0x27')]('FaxMessage,\x20%s,\x20%s',_0xbd754e,_0x5d7d15);_0x39a640(_0x5d7d15);});});}function respondWithStatusCode(_0x2acc49,_0x262f47){_0x262f47=_0x262f47||0xcc;return function(_0x32a6e2){if(_0x32a6e2){return _0x2acc49[_0x1e19('0x2a')](_0x262f47);}return _0x2acc49[_0x1e19('0x2b')](_0x262f47)['end']();};}function respondWithResult(_0x3deba8,_0x56036d){_0x56036d=_0x56036d||0xc8;return function(_0x1a89e5){if(_0x1a89e5){return _0x3deba8['status'](_0x56036d)['json'](_0x1a89e5);}};}function respondWithFilteredResult(_0x207d86,_0x1243d9){return function(_0x149e16){if(_0x149e16){var _0x5d44a9=typeof _0x1243d9[_0x1e19('0x2c')]===_0x1e19('0x2d')&&typeof _0x1243d9['limit']===_0x1e19('0x2d');var _0x3f19ed=_0x149e16[_0x1e19('0x2e')];var _0x368fbf=_0x5d44a9?0x0:_0x1243d9[_0x1e19('0x2c')];var _0x5275ad=_0x5d44a9?_0x149e16[_0x1e19('0x2e')]:_0x1243d9[_0x1e19('0x2c')]+_0x1243d9[_0x1e19('0x2f')];var _0x1fb7b2;if(_0x5275ad>=_0x3f19ed){_0x5275ad=_0x3f19ed;_0x1fb7b2=0xc8;}else{_0x1fb7b2=0xce;}_0x207d86[_0x1e19('0x2b')](_0x1fb7b2);return _0x207d86[_0x1e19('0x30')]('Content-Range',_0x368fbf+'-'+_0x5275ad+'/'+_0x3f19ed)[_0x1e19('0x31')](_0x149e16);}return null;};}function patchUpdates(_0x3c9256){return function(_0x5a3f26){try{jsonpatch[_0x1e19('0x32')](_0x5a3f26,_0x3c9256,!![]);}catch(_0x3bd25d){return BPromise[_0x1e19('0x33')](_0x3bd25d);}return _0x5a3f26[_0x1e19('0x34')]();};}function saveUpdates(_0xda2ee9,_0x276cfb){return function(_0x403841){if(_0x403841){return _0x403841[_0x1e19('0x35')](_0xda2ee9)[_0x1e19('0x21')](function(_0x3d37e4){return _0x3d37e4;});}return null;};}function removeEntity(_0x24f654,_0x285efd){return function(_0x1a1655){if(_0x1a1655){return _0x1a1655[_0x1e19('0x36')]()[_0x1e19('0x21')](function(){_0x24f654['status'](0xcc)[_0x1e19('0x37')]();});}};}function handleEntityNotFound(_0x1e4877,_0x2f16b0){return function(_0x156653){if(!_0x156653){_0x1e4877[_0x1e19('0x2a')](0x194);}return _0x156653;};}function handleError(_0x4fefea,_0x1eb6ea){_0x1eb6ea=_0x1eb6ea||0x1f4;return function(_0x2e7ff8){logger[_0x1e19('0x27')](_0x2e7ff8[_0x1e19('0x38')]);if(_0x2e7ff8[_0x1e19('0x39')]){delete _0x2e7ff8[_0x1e19('0x39')];}_0x4fefea[_0x1e19('0x2b')](_0x1eb6ea)[_0x1e19('0x3a')](_0x2e7ff8);};}exports[_0x1e19('0x3b')]=function(_0x4fde06,_0x32d666){var _0x2560fc={},_0x44375e={},_0x5bdf0b={'count':0x0,'rows':[]};var _0x18f487=_['map'](db[_0x1e19('0x3c')][_0x1e19('0x3d')],function(_0x40c206){return{'name':_0x40c206['fieldName'],'type':_0x40c206[_0x1e19('0x3e')][_0x1e19('0x3f')]};});_0x44375e[_0x1e19('0x40')]=_[_0x1e19('0x41')](_0x18f487,'name');_0x44375e[_0x1e19('0x42')]=_[_0x1e19('0x43')](_0x4fde06[_0x1e19('0x42')]);_0x44375e[_0x1e19('0x44')]=_['intersection'](_0x44375e[_0x1e19('0x40')],_0x44375e[_0x1e19('0x42')]);_0x2560fc['attributes']=_[_0x1e19('0x45')](_0x44375e[_0x1e19('0x40')],qs[_0x1e19('0x46')](_0x4fde06[_0x1e19('0x42')][_0x1e19('0x46')]));_0x2560fc['attributes']=_0x2560fc['attributes'][_0x1e19('0x47')]?_0x2560fc[_0x1e19('0x48')]:_0x44375e[_0x1e19('0x40')];if(!_0x4fde06[_0x1e19('0x42')][_0x1e19('0x49')](_0x1e19('0x4a'))){_0x2560fc['limit']=qs[_0x1e19('0x2f')](_0x4fde06[_0x1e19('0x42')][_0x1e19('0x2f')]);_0x2560fc[_0x1e19('0x2c')]=qs['offset'](_0x4fde06[_0x1e19('0x42')][_0x1e19('0x2c')]);}_0x2560fc[_0x1e19('0x4b')]=qs['sort'](_0x4fde06[_0x1e19('0x42')][_0x1e19('0x4c')]);_0x2560fc[_0x1e19('0x4d')]=qs[_0x1e19('0x44')](_[_0x1e19('0x4e')](_0x4fde06['query'],_0x44375e[_0x1e19('0x44')]),_0x18f487);if(_0x4fde06[_0x1e19('0x42')][_0x1e19('0x4f')]){_0x2560fc[_0x1e19('0x4d')]=_[_0x1e19('0x50')](_0x2560fc[_0x1e19('0x4d')],{'$or':_[_0x1e19('0x41')](_0x18f487,function(_0x3a3913){if(_0x3a3913['type']!==_0x1e19('0x51')){var _0x3e73d2={};_0x3e73d2[_0x3a3913['name']]={'$like':'%'+_0x4fde06['query'][_0x1e19('0x4f')]+'%'};return _0x3e73d2;}})});}_0x2560fc=_[_0x1e19('0x50')]({},_0x2560fc,_0x4fde06[_0x1e19('0x52')]);var _0x4aebfd={'where':_0x2560fc[_0x1e19('0x4d')]};return db[_0x1e19('0x3c')]['count'](_0x4aebfd)[_0x1e19('0x21')](function(_0x70c67b){_0x5bdf0b['count']=_0x70c67b;if(_0x4fde06[_0x1e19('0x42')][_0x1e19('0x53')]){_0x2560fc[_0x1e19('0x54')]=[{'all':!![]}];}return db['FaxMessage'][_0x1e19('0x55')](_0x2560fc);})[_0x1e19('0x21')](function(_0x15706a){_0x5bdf0b[_0x1e19('0x56')]=_0x15706a;return _0x5bdf0b;})[_0x1e19('0x21')](respondWithFilteredResult(_0x32d666,_0x2560fc))[_0x1e19('0x57')](handleError(_0x32d666,null));};exports[_0x1e19('0x58')]=function(_0x5b4a60,_0xaf8160){var _0x58e182={'raw':!![],'where':{'id':_0x5b4a60[_0x1e19('0x59')]['id']}},_0x3a04af={};_0x3a04af[_0x1e19('0x40')]=_[_0x1e19('0x43')](db[_0x1e19('0x3c')][_0x1e19('0x3d')]);_0x3a04af[_0x1e19('0x42')]=_[_0x1e19('0x43')](_0x5b4a60['query']);_0x3a04af['filters']=_['intersection'](_0x3a04af[_0x1e19('0x40')],_0x3a04af['query']);_0x58e182[_0x1e19('0x48')]=_['intersection'](_0x3a04af[_0x1e19('0x40')],qs['fields'](_0x5b4a60[_0x1e19('0x42')][_0x1e19('0x46')]));_0x58e182[_0x1e19('0x48')]=_0x58e182[_0x1e19('0x48')][_0x1e19('0x47')]?_0x58e182['attributes']:_0x3a04af['model'];if(_0x5b4a60[_0x1e19('0x42')][_0x1e19('0x53')]){_0x58e182[_0x1e19('0x54')]=[{'all':!![]}];}_0x58e182=_[_0x1e19('0x50')]({},_0x58e182,_0x5b4a60[_0x1e19('0x52')]);return db[_0x1e19('0x3c')][_0x1e19('0x5a')](_0x58e182)[_0x1e19('0x21')](handleEntityNotFound(_0xaf8160,null))['then'](respondWithResult(_0xaf8160,null))['catch'](handleError(_0xaf8160,null));};exports[_0x1e19('0x35')]=function(_0x34d7dd,_0x5a361c){if(_0x34d7dd[_0x1e19('0x5b')]['id']){delete _0x34d7dd[_0x1e19('0x5b')]['id'];}return db[_0x1e19('0x3c')][_0x1e19('0x5a')]({'where':{'id':_0x34d7dd[_0x1e19('0x59')]['id']}})[_0x1e19('0x21')](handleEntityNotFound(_0x5a361c,null))[_0x1e19('0x21')](saveUpdates(_0x34d7dd['body'],null))['then'](respondWithResult(_0x5a361c,null))[_0x1e19('0x57')](handleError(_0x5a361c,null));};exports[_0x1e19('0x36')]=function(_0xa87d3e,_0x3611e3){return db[_0x1e19('0x3c')][_0x1e19('0x5a')]({'where':{'id':_0xa87d3e[_0x1e19('0x59')]['id']}})[_0x1e19('0x21')](handleEntityNotFound(_0x3611e3,null))['then'](removeEntity(_0x3611e3,null))['catch'](handleError(_0x3611e3,null));};exports['describe']=function(_0x344b47,_0x3246c8){return db[_0x1e19('0x3c')][_0x1e19('0x5c')]()[_0x1e19('0x21')](respondWithResult(_0x3246c8,null))['catch'](handleError(_0x3246c8,null));};var interaction_log=require(_0x1e19('0x14'))(_0x1e19('0x5d'));exports[_0x1e19('0x5e')]=function(_0xd0666a,_0x318b5c,_0x26bc50){var _0x1dd9e3={'agent':{},'channel':_0x1e19('0x5f')};if(_0xd0666a['body']['id']){delete _0xd0666a[_0x1e19('0x5b')]['id'];}_0xd0666a[_0x1e19('0x5b')][_0x1e19('0x60')]=!![];_0xd0666a[_0x1e19('0x5b')][_0x1e19('0x61')]=moment()[_0x1e19('0x62')](_0x1e19('0x63'));_0xd0666a[_0x1e19('0x5b')]['UserId']=_0xd0666a[_0x1e19('0x5b')][_0x1e19('0x64')]||_0xd0666a[_0x1e19('0x65')]['id'];_0x1dd9e3['agent']['id']=_0xd0666a[_0x1e19('0x5b')][_0x1e19('0x64')];return db[_0x1e19('0x3c')][_0x1e19('0x5a')]({'where':{'id':_0xd0666a['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x318b5c,null))['then'](saveUpdates(_0xd0666a['body'],null))[_0x1e19('0x21')](function(_0xaf9df5){if(_0xaf9df5){_0x1dd9e3[_0x1e19('0x29')]=_0xaf9df5[_0x1e19('0x66')]({'plain':!![]});return db[_0x1e19('0x67')][_0x1e19('0x5a')]({'where':{'id':_0xaf9df5[_0x1e19('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x318b5c,null))[_0x1e19('0x21')](function(_0x4367cf){if(_0x4367cf){return _0x4367cf[_0x1e19('0x35')]({'UserId':_0xd0666a[_0x1e19('0x5b')][_0x1e19('0x64')],'read1stAt':_['isNil'](_0x4367cf[_0x1e19('0x69')])?moment()[_0x1e19('0x62')](_0x1e19('0x63')):undefined});}return null;})[_0x1e19('0x21')](function(_0x5255c3){if(_0x5255c3){_0x1dd9e3[_0x1e19('0x6a')]=_0x5255c3['get']({'plain':!![]});interaction_log['info'](_0x1e19('0x6b'),_0xd0666a[_0x1e19('0x65')]['id'],_0xd0666a[_0x1e19('0x65')]['name'],_0xd0666a['user'][_0x1e19('0x6c')],_0x1dd9e3['interaction']['id'],_0xd0666a[_0x1e19('0x5b')]?JSON[_0x1e19('0x6d')](_0xd0666a[_0x1e19('0x5b')]):_0x1e19('0x6e'));return respondWithRpcPromise(_0x1e19('0x6f'),_0x1e19('0x70'),_0x1dd9e3);}return null;})[_0x1e19('0x21')](function(_0x384c3e){var _0x52501f=_0x1e19('0x71')+_0x384c3e[_0x1e19('0x29')]['ContactId'];return db[_0x1e19('0x72')][_0x1e19('0x42')](_0x52501f,{'type':db[_0x1e19('0x73')][_0x1e19('0x74')]['SELECT'],'raw':!![]})[_0x1e19('0x21')](function(_0xf608cf){return _0xf608cf;});})[_0x1e19('0x21')](function(_0x4e3104){if(_0x4e3104){_0x1dd9e3[_0x1e19('0x29')][_0x1e19('0x75')]=_0x4e3104[0x0];if(!_0xd0666a['body'][_0x1e19('0x64')])return;return db['User']['find']({'where':{'id':_0xd0666a['body']['UserId'],'role':'agent'},'attributes':['id',_0x1e19('0x39'),_0x1e19('0x76'),_0x1e19('0x77'),'internal'],'raw':!![]});}return null;})[_0x1e19('0x21')](function(_0x3b98d8){if(!_0x3b98d8)return null;_0x1dd9e3[_0x1e19('0x29')][_0x1e19('0x78')]=_0x3b98d8;return _0x1dd9e3;})[_0x1e19('0x21')](function(_0x25fbb7){if(_0x25fbb7){if(_0xd0666a[_0x1e19('0x5b')][_0x1e19('0x79')]){_0x1dd9e3['message'][_0x1e19('0x7a')]=util[_0x1e19('0x62')](_0x1e19('0x7b'),_0xd0666a['user'][_0x1e19('0x39')]);_0x1dd9e3[_0x1e19('0x29')]['channel']=_0x1dd9e3[_0x1e19('0x7c')];_0x1dd9e3[_0x1e19('0x29')][_0x1e19('0x7d')]=_0x1dd9e3['channel'];_0x1dd9e3['message'][_0x1e19('0x7e')]=_0x1e19('0x5e');return respondWithRpcPromise(_0x1e19('0x7f'),_0x1e19('0x7f'),{'event':_0x1e19('0x80'),'message':_0x1dd9e3['message']},client9002)['then'](function(){return _0x1dd9e3;});}return _0x1dd9e3;}return null;})[_0x1e19('0x21')](respondWithResult(_0x318b5c,null))[_0x1e19('0x57')](handleError(_0x318b5c,null));};var interaction_log=require('../../config/logger')(_0x1e19('0x5d'));exports[_0x1e19('0x33')]=function(_0x52cb9e,_0x371d91,_0x5e42e3){var _0x3fbc1a={'agent':{},'channel':_0x1e19('0x5f')};if(_0x52cb9e[_0x1e19('0x5b')]['id']){delete _0x52cb9e[_0x1e19('0x5b')]['id'];}_0x52cb9e['body'][_0x1e19('0x64')]=_0x52cb9e['body'][_0x1e19('0x64')]||_0x52cb9e['user']['id'];_0x3fbc1a[_0x1e19('0x78')]['id']=_0x52cb9e[_0x1e19('0x5b')][_0x1e19('0x64')];return db[_0x1e19('0x3c')]['find']({'where':{'id':_0x52cb9e[_0x1e19('0x59')]['id'],'UserId':null}})[_0x1e19('0x21')](handleEntityNotFound(_0x371d91,null))[_0x1e19('0x21')](function(_0x2d69f2){if(_0x2d69f2){_0x3fbc1a[_0x1e19('0x29')]=_0x2d69f2[_0x1e19('0x66')]({'plain':!![]});return db[_0x1e19('0x67')][_0x1e19('0x5a')]({'where':{'id':_0x2d69f2[_0x1e19('0x68')]}});}return null;})[_0x1e19('0x21')](handleEntityNotFound(_0x371d91,null))[_0x1e19('0x21')](function(_0x155c97){if(_0x155c97){_0x3fbc1a[_0x1e19('0x6a')]=_0x155c97[_0x1e19('0x66')]({'plain':!![]});interaction_log[_0x1e19('0x22')](_0x1e19('0x81'),_0x52cb9e[_0x1e19('0x65')]['id'],_0x52cb9e[_0x1e19('0x65')]['name'],_0x52cb9e['user'][_0x1e19('0x6c')],_0x3fbc1a[_0x1e19('0x6a')]['id'],_0x52cb9e[_0x1e19('0x5b')]?JSON[_0x1e19('0x6d')](_0x52cb9e[_0x1e19('0x5b')]):_0x1e19('0x6e'));return respondWithRpcPromise(_0x1e19('0x82'),_0x1e19('0x83'),_0x3fbc1a);}return null;})[_0x1e19('0x21')](function(_0x2eb933){var _0xa47333=_0x1e19('0x71')+_0x2eb933['message'][_0x1e19('0x84')];return db['sequelize'][_0x1e19('0x42')](_0xa47333,{'type':db[_0x1e19('0x73')]['QueryTypes'][_0x1e19('0x85')],'raw':!![]})[_0x1e19('0x21')](function(_0x1128fc){return _0x1128fc;});})['then'](function(_0x313cfb){if(_0x313cfb){_0x3fbc1a[_0x1e19('0x29')][_0x1e19('0x75')]=_0x313cfb[0x0];if(!_0x52cb9e['body'][_0x1e19('0x64')])return;return db[_0x1e19('0x86')][_0x1e19('0x5a')]({'where':{'id':_0x52cb9e[_0x1e19('0x5b')][_0x1e19('0x64')],'role':_0x1e19('0x78')},'attributes':['id',_0x1e19('0x39'),_0x1e19('0x76'),_0x1e19('0x77'),_0x1e19('0x87')],'raw':!![]});}return null;})[_0x1e19('0x21')](function(_0x35605e){if(!_0x35605e)return null;_0x3fbc1a[_0x1e19('0x29')][_0x1e19('0x78')]=_0x35605e;return _0x3fbc1a;})['then'](function(_0x48e3a){if(_0x48e3a){_0x48e3a[_0x1e19('0x29')][_0x1e19('0x7a')]=util[_0x1e19('0x62')](_0x1e19('0x7b'),_0x52cb9e[_0x1e19('0x65')]['name']);_0x48e3a[_0x1e19('0x29')]['channel']=_0x3fbc1a['channel'];_0x48e3a[_0x1e19('0x29')]['motionChannel']=_0x3fbc1a[_0x1e19('0x7c')];_0x48e3a[_0x1e19('0x29')]['event']='reject';respondWithRpcPromise('EventManager',_0x1e19('0x7f'),{'event':_0x1e19('0x88'),'message':_0x48e3a[_0x1e19('0x29')]},client9002);return _0x3fbc1a;}return null;})[_0x1e19('0x21')](respondWithResult(_0x371d91,null))[_0x1e19('0x57')](handleError(_0x371d91,null));};exports[_0x1e19('0x89')]=function(_0x3d0366,_0xe14484){var _0x4de201;return db[_0x1e19('0x3c')][_0x1e19('0x89')](_0x3d0366[_0x1e19('0x5b')],{})[_0x1e19('0x21')](function(_0x487c39){_0x4de201=_0x487c39;return db['CmContact'][_0x1e19('0x8a')]({'where':{'id':_0x4de201[_0x1e19('0x84')]}});})[_0x1e19('0x21')](function(_0x123ef6){if(_[_0x1e19('0x8b')](_0x123ef6)){return;}else{_0x4de201['fax']=_0x123ef6['fax'];return db['Attachment'][_0x1e19('0x8a')]({'where':{'id':_0x4de201[_0x1e19('0x8c')]}});}})[_0x1e19('0x21')](function(_0x26c71e){return respondWithRpcPromise(_0x1e19('0x8d'),_0x1e19('0x8d'),{'FaxAccountId':_[_0x1e19('0x8b')](_0x3d0366['body'])?undefined:_0x3d0366[_0x1e19('0x5b')]['FaxAccountId'],'path':_[_0x1e19('0x8b')](_0x26c71e)?undefined:util[_0x1e19('0x62')](_0x1e19('0x8e'),_0x26c71e[_0x1e19('0x8f')]),'fax':_[_0x1e19('0x8b')](_0x4de201[_0x1e19('0x5f')])?undefined:_0x4de201[_0x1e19('0x5f')],'AttachmentId':_0x4de201['AttachmentId']},client9002);})[_0x1e19('0x21')](respondWithResult(_0xe14484,0xc9))[_0x1e19('0x57')](handleError(_0xe14484,null));};exports[_0x1e19('0x90')]=function(_0x45d82a,_0x2df5b7){var _0x54adda=path[_0x1e19('0x91')](config[_0x1e19('0x92')],'server',_0x1e19('0x93'),_0x1e19('0x94'));return db[_0x1e19('0x3c')][_0x1e19('0x5a')]({'where':{'id':_0x45d82a[_0x1e19('0x59')]['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})[_0x1e19('0x21')](handleEntityNotFound(_0x2df5b7,null))['then'](function(_0x5c590c){if(_0x5c590c){return _0x2df5b7['download'](path[_0x1e19('0x91')](_0x54adda,_0x5c590c['Attachment'][_0x1e19('0x8f')]));}})[_0x1e19('0x57')](handleError(_0x2df5b7,null));};
\ No newline at end of file
+var _0x49b5=['SIP/%s','channel','EventManager','acceptmessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','internal','interface','motionChannel','event','rejectmessage','create','CmContact','Attachment','findOne','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','root','server','files','download','join','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','then','info','FaxMessage,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','destroy','sendStatus','stack','name','index','map','FaxMessage','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','include','rows','show','find','update','body','params','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x49b5,0x1c9));var _0x549b=function(_0x3595c0,_0x20c2ec){_0x3595c0=_0x3595c0-0x0;var _0x528865=_0x49b5[_0x3595c0];return _0x528865;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x549b('0x0'));var jsonpatch=require(_0x549b('0x1'));var rp=require(_0x549b('0x2'));var moment=require(_0x549b('0x3'));var BPromise=require(_0x549b('0x4'));var Mustache=require(_0x549b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x549b('0x6'));var csv=require(_0x549b('0x7'));var ejs=require(_0x549b('0x8'));var fs=require('fs');var fs_extra=require(_0x549b('0x9'));var _=require(_0x549b('0xa'));var squel=require(_0x549b('0xb'));var crypto=require(_0x549b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x549b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x549b('0xe'));var Papa=require('papaparse');var Redis=require(_0x549b('0xf'));var authService=require(_0x549b('0x10'));var qs=require(_0x549b('0x11'));var as=require(_0x549b('0x12'));var hardwareService=require(_0x549b('0x13'));var logger=require(_0x549b('0x14'))(_0x549b('0x15'));var utils=require(_0x549b('0x16'));var config=require(_0x549b('0x17'));var licenseUtil=require(_0x549b('0x18'));var db=require(_0x549b('0x19'))['db'];config['redis']=_['defaults'](config[_0x549b('0x1a')],{'host':_0x549b('0x1b'),'port':0x18eb});var socket=require(_0x549b('0x1c'))(new Redis(config['redis']));require(_0x549b('0x1d'))[_0x549b('0x1e')](socket);var jayson=require(_0x549b('0x1f'));var client=jayson[_0x549b('0x20')][_0x549b('0x21')]({'port':0x232c});var client9002=jayson[_0x549b('0x20')][_0x549b('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xd6cb5d,_0x4b64ae,_0x391697,_0x547481){return new BPromise(function(_0x479999,_0x126ab4){var _0x74442f=_0x547481||client;return _0x74442f['request'](_0xd6cb5d,_0x391697)[_0x549b('0x22')](function(_0x5effbc){logger[_0x549b('0x23')](_0x549b('0x24'),_0x4b64ae,'request\x20sent');logger[_0x549b('0x25')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x4b64ae,'request\x20sent',JSON[_0x549b('0x26')](_0x5effbc));if(_0x5effbc['error']){if(_0x5effbc[_0x549b('0x27')][_0x549b('0x28')]===0x1f4){logger[_0x549b('0x27')](_0x549b('0x24'),_0x4b64ae,_0x5effbc[_0x549b('0x27')][_0x549b('0x29')]);return _0x126ab4(_0x5effbc[_0x549b('0x27')][_0x549b('0x29')]);}logger[_0x549b('0x27')]('FaxMessage,\x20%s,\x20%s',_0x4b64ae,_0x5effbc['error'][_0x549b('0x29')]);return _0x479999(_0x5effbc['error']['message']);}else{logger[_0x549b('0x23')](_0x549b('0x24'),_0x4b64ae,_0x549b('0x2a'));_0x479999(_0x5effbc[_0x549b('0x2b')]['message']);}})[_0x549b('0x2c')](function(_0x2da5b3){logger['error'](_0x549b('0x24'),_0x4b64ae,_0x2da5b3);_0x126ab4(_0x2da5b3);});});}function respondWithStatusCode(_0x5e8ff6,_0x3bad26){_0x3bad26=_0x3bad26||0xcc;return function(_0x40259e){if(_0x40259e){return _0x5e8ff6['sendStatus'](_0x3bad26);}return _0x5e8ff6[_0x549b('0x2d')](_0x3bad26)[_0x549b('0x2e')]();};}function respondWithResult(_0x464b49,_0x41fa4){_0x41fa4=_0x41fa4||0xc8;return function(_0x24ea51){if(_0x24ea51){return _0x464b49[_0x549b('0x2d')](_0x41fa4)[_0x549b('0x2f')](_0x24ea51);}};}function respondWithFilteredResult(_0x5bd6c9,_0xb74488){return function(_0x9b6fbd){if(_0x9b6fbd){var _0x1052c8=typeof _0xb74488[_0x549b('0x30')]===_0x549b('0x31')&&typeof _0xb74488[_0x549b('0x32')]==='undefined';var _0x177206=_0x9b6fbd['count'];var _0x3948fc=_0x1052c8?0x0:_0xb74488[_0x549b('0x30')];var _0x454555=_0x1052c8?_0x9b6fbd['count']:_0xb74488[_0x549b('0x30')]+_0xb74488[_0x549b('0x32')];var _0x5ba9dc;if(_0x454555>=_0x177206){_0x454555=_0x177206;_0x5ba9dc=0xc8;}else{_0x5ba9dc=0xce;}_0x5bd6c9[_0x549b('0x2d')](_0x5ba9dc);return _0x5bd6c9['set'](_0x549b('0x33'),_0x3948fc+'-'+_0x454555+'/'+_0x177206)[_0x549b('0x2f')](_0x9b6fbd);}return null;};}function patchUpdates(_0x251fb8){return function(_0x424881){try{jsonpatch[_0x549b('0x34')](_0x424881,_0x251fb8,!![]);}catch(_0x3a1c02){return BPromise[_0x549b('0x35')](_0x3a1c02);}return _0x424881[_0x549b('0x36')]();};}function saveUpdates(_0x3a8d7b,_0x354dd9){return function(_0xe8855b){if(_0xe8855b){return _0xe8855b['update'](_0x3a8d7b)[_0x549b('0x22')](function(_0x212925){return _0x212925;});}return null;};}function removeEntity(_0x165c49,_0x4a764d){return function(_0xe3440b){if(_0xe3440b){return _0xe3440b[_0x549b('0x37')]()['then'](function(){_0x165c49[_0x549b('0x2d')](0xcc)[_0x549b('0x2e')]();});}};}function handleEntityNotFound(_0x36330c,_0x15c046){return function(_0x336c94){if(!_0x336c94){_0x36330c[_0x549b('0x38')](0x194);}return _0x336c94;};}function handleError(_0x427a31,_0x4ea210){_0x4ea210=_0x4ea210||0x1f4;return function(_0xa04747){logger['error'](_0xa04747[_0x549b('0x39')]);if(_0xa04747[_0x549b('0x3a')]){delete _0xa04747[_0x549b('0x3a')];}_0x427a31[_0x549b('0x2d')](_0x4ea210)['send'](_0xa04747);};}exports[_0x549b('0x3b')]=function(_0x576f22,_0x519f4e){var _0x249a56={},_0x33bed4={},_0x1a0c59={'count':0x0,'rows':[]};var _0x2946f9=_[_0x549b('0x3c')](db[_0x549b('0x3d')]['rawAttributes'],function(_0x23994e){return{'name':_0x23994e[_0x549b('0x3e')],'type':_0x23994e['type'][_0x549b('0x3f')]};});_0x33bed4[_0x549b('0x40')]=_[_0x549b('0x3c')](_0x2946f9,_0x549b('0x3a'));_0x33bed4[_0x549b('0x41')]=_[_0x549b('0x42')](_0x576f22[_0x549b('0x41')]);_0x33bed4[_0x549b('0x43')]=_[_0x549b('0x44')](_0x33bed4[_0x549b('0x40')],_0x33bed4['query']);_0x249a56['attributes']=_[_0x549b('0x44')](_0x33bed4[_0x549b('0x40')],qs[_0x549b('0x45')](_0x576f22[_0x549b('0x41')][_0x549b('0x45')]));_0x249a56['attributes']=_0x249a56[_0x549b('0x46')][_0x549b('0x47')]?_0x249a56[_0x549b('0x46')]:_0x33bed4[_0x549b('0x40')];if(!_0x576f22['query'][_0x549b('0x48')](_0x549b('0x49'))){_0x249a56['limit']=qs[_0x549b('0x32')](_0x576f22[_0x549b('0x41')][_0x549b('0x32')]);_0x249a56[_0x549b('0x30')]=qs[_0x549b('0x30')](_0x576f22[_0x549b('0x41')][_0x549b('0x30')]);}_0x249a56[_0x549b('0x4a')]=qs[_0x549b('0x4b')](_0x576f22[_0x549b('0x41')][_0x549b('0x4b')]);_0x249a56['where']=qs['filters'](_[_0x549b('0x4c')](_0x576f22[_0x549b('0x41')],_0x33bed4[_0x549b('0x43')]),_0x2946f9);if(_0x576f22[_0x549b('0x41')][_0x549b('0x4d')]){_0x249a56[_0x549b('0x4e')]=_[_0x549b('0x4f')](_0x249a56[_0x549b('0x4e')],{'$or':_[_0x549b('0x3c')](_0x2946f9,function(_0x3b929c){if(_0x3b929c['type']!==_0x549b('0x50')){var _0xbd833a={};_0xbd833a[_0x3b929c[_0x549b('0x3a')]]={'$like':'%'+_0x576f22[_0x549b('0x41')][_0x549b('0x4d')]+'%'};return _0xbd833a;}})});}_0x249a56=_[_0x549b('0x4f')]({},_0x249a56,_0x576f22[_0x549b('0x51')]);var _0x351c85={'where':_0x249a56['where']};return db['FaxMessage'][_0x549b('0x52')](_0x351c85)[_0x549b('0x22')](function(_0x4135da){_0x1a0c59['count']=_0x4135da;if(_0x576f22['query']['includeAll']){_0x249a56[_0x549b('0x53')]=[{'all':!![]}];}return db[_0x549b('0x3d')]['findAll'](_0x249a56);})['then'](function(_0x50001c){_0x1a0c59[_0x549b('0x54')]=_0x50001c;return _0x1a0c59;})['then'](respondWithFilteredResult(_0x519f4e,_0x249a56))[_0x549b('0x2c')](handleError(_0x519f4e,null));};exports[_0x549b('0x55')]=function(_0xc6645e,_0x215f8c){var _0x1aef45={'raw':!![],'where':{'id':_0xc6645e['params']['id']}},_0x32bdd2={};_0x32bdd2['model']=_[_0x549b('0x42')](db[_0x549b('0x3d')]['rawAttributes']);_0x32bdd2[_0x549b('0x41')]=_[_0x549b('0x42')](_0xc6645e['query']);_0x32bdd2['filters']=_[_0x549b('0x44')](_0x32bdd2[_0x549b('0x40')],_0x32bdd2[_0x549b('0x41')]);_0x1aef45[_0x549b('0x46')]=_[_0x549b('0x44')](_0x32bdd2[_0x549b('0x40')],qs[_0x549b('0x45')](_0xc6645e[_0x549b('0x41')][_0x549b('0x45')]));_0x1aef45[_0x549b('0x46')]=_0x1aef45['attributes'][_0x549b('0x47')]?_0x1aef45['attributes']:_0x32bdd2[_0x549b('0x40')];if(_0xc6645e[_0x549b('0x41')]['includeAll']){_0x1aef45[_0x549b('0x53')]=[{'all':!![]}];}_0x1aef45=_[_0x549b('0x4f')]({},_0x1aef45,_0xc6645e[_0x549b('0x51')]);return db[_0x549b('0x3d')][_0x549b('0x56')](_0x1aef45)[_0x549b('0x22')](handleEntityNotFound(_0x215f8c,null))[_0x549b('0x22')](respondWithResult(_0x215f8c,null))[_0x549b('0x2c')](handleError(_0x215f8c,null));};exports[_0x549b('0x57')]=function(_0x4a7aae,_0x1fb106){if(_0x4a7aae[_0x549b('0x58')]['id']){delete _0x4a7aae[_0x549b('0x58')]['id'];}return db[_0x549b('0x3d')][_0x549b('0x56')]({'where':{'id':_0x4a7aae[_0x549b('0x59')]['id']}})['then'](handleEntityNotFound(_0x1fb106,null))[_0x549b('0x22')](saveUpdates(_0x4a7aae[_0x549b('0x58')],null))['then'](respondWithResult(_0x1fb106,null))['catch'](handleError(_0x1fb106,null));};exports[_0x549b('0x37')]=function(_0x291d8f,_0x3cdc24){return db['FaxMessage'][_0x549b('0x56')]({'where':{'id':_0x291d8f[_0x549b('0x59')]['id']}})[_0x549b('0x22')](handleEntityNotFound(_0x3cdc24,null))[_0x549b('0x22')](removeEntity(_0x3cdc24,null))['catch'](handleError(_0x3cdc24,null));};exports[_0x549b('0x5a')]=function(_0x34966d,_0x1fb6fc){return db[_0x549b('0x3d')][_0x549b('0x5a')]()['then'](respondWithResult(_0x1fb6fc,null))['catch'](handleError(_0x1fb6fc,null));};var interaction_log=require(_0x549b('0x14'))(_0x549b('0x5b'));exports[_0x549b('0x5c')]=function(_0x617ece,_0x336aa4,_0x5ba865){var _0x11f00e={'agent':{},'channel':_0x549b('0x5d')};if(_0x617ece['body']['id']){delete _0x617ece[_0x549b('0x58')]['id'];}_0x617ece[_0x549b('0x58')][_0x549b('0x5e')]=!![];_0x617ece['body'][_0x549b('0x5f')]=moment()[_0x549b('0x60')]('YYYY-MM-DD\x20HH:mm:ss');_0x617ece[_0x549b('0x58')]['UserId']=_0x617ece[_0x549b('0x58')][_0x549b('0x61')]||_0x617ece[_0x549b('0x62')]['id'];_0x11f00e[_0x549b('0x63')]['id']=_0x617ece[_0x549b('0x58')][_0x549b('0x61')];return db[_0x549b('0x3d')][_0x549b('0x56')]({'where':{'id':_0x617ece[_0x549b('0x59')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x336aa4,null))['then'](saveUpdates(_0x617ece[_0x549b('0x58')],null))[_0x549b('0x22')](function(_0x32a6fc){if(_0x32a6fc){_0x11f00e[_0x549b('0x29')]=_0x32a6fc[_0x549b('0x64')]({'plain':!![]});return db[_0x549b('0x65')][_0x549b('0x56')]({'where':{'id':_0x32a6fc[_0x549b('0x66')]}});}return null;})[_0x549b('0x22')](handleEntityNotFound(_0x336aa4,null))[_0x549b('0x22')](function(_0x50914e){if(_0x50914e){return _0x50914e['update']({'UserId':_0x617ece[_0x549b('0x58')][_0x549b('0x61')],'read1stAt':_[_0x549b('0x67')](_0x50914e[_0x549b('0x68')])?moment()['format'](_0x549b('0x69')):undefined});}return null;})[_0x549b('0x22')](function(_0x5bb75e){if(_0x5bb75e){_0x11f00e[_0x549b('0x6a')]=_0x5bb75e[_0x549b('0x64')]({'plain':!![]});interaction_log[_0x549b('0x23')](_0x549b('0x6b'),_0x617ece['user']['id'],_0x617ece[_0x549b('0x62')][_0x549b('0x3a')],_0x617ece['user']['role'],_0x11f00e[_0x549b('0x6a')]['id'],_0x617ece[_0x549b('0x58')]?JSON['stringify'](_0x617ece[_0x549b('0x58')]):_0x549b('0x6c'));return respondWithRpcPromise(_0x549b('0x6d'),'acceptMessage',_0x11f00e);}return null;})[_0x549b('0x22')](function(_0x258077){var _0x55bde8='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x258077['message'][_0x549b('0x6e')];return db[_0x549b('0x6f')][_0x549b('0x41')](_0x55bde8,{'type':db['Sequelize'][_0x549b('0x70')][_0x549b('0x71')],'raw':!![]})[_0x549b('0x22')](function(_0x5a70eb){return _0x5a70eb;});})[_0x549b('0x22')](function(_0x446d79){if(_0x446d79){_0x11f00e['message'][_0x549b('0x72')]=_0x446d79[0x0];if(!_0x617ece[_0x549b('0x58')][_0x549b('0x61')])return;return db[_0x549b('0x73')][_0x549b('0x56')]({'where':{'id':_0x617ece[_0x549b('0x58')][_0x549b('0x61')],'role':_0x549b('0x63')},'attributes':['id',_0x549b('0x3a'),_0x549b('0x74'),_0x549b('0x75'),'internal'],'raw':!![]});}return null;})[_0x549b('0x22')](function(_0x12ba42){if(!_0x12ba42)return null;_0x11f00e[_0x549b('0x29')][_0x549b('0x63')]=_0x12ba42;return _0x11f00e;})['then'](function(_0x4a6a6b){if(_0x4a6a6b){if(_0x617ece[_0x549b('0x58')][_0x549b('0x76')]){_0x11f00e['message']['interface']=util[_0x549b('0x60')](_0x549b('0x77'),_0x617ece[_0x549b('0x62')][_0x549b('0x3a')]);_0x11f00e[_0x549b('0x29')][_0x549b('0x78')]=_0x11f00e[_0x549b('0x78')];_0x11f00e[_0x549b('0x29')]['motionChannel']=_0x11f00e[_0x549b('0x78')];_0x11f00e['message']['event']=_0x549b('0x5c');return respondWithRpcPromise(_0x549b('0x79'),_0x549b('0x79'),{'event':_0x549b('0x7a'),'message':_0x11f00e[_0x549b('0x29')]},client9002)[_0x549b('0x22')](function(){return _0x11f00e;});}return _0x11f00e;}return null;})['then'](respondWithResult(_0x336aa4,null))['catch'](handleError(_0x336aa4,null));};var interaction_log=require(_0x549b('0x14'))('fax-interactions');exports[_0x549b('0x35')]=function(_0x404e4f,_0x31afbf,_0x184cf8){var _0x361a9d={'agent':{},'channel':_0x549b('0x5d')};if(_0x404e4f['body']['id']){delete _0x404e4f['body']['id'];}_0x404e4f[_0x549b('0x58')][_0x549b('0x61')]=_0x404e4f[_0x549b('0x58')][_0x549b('0x61')]||_0x404e4f[_0x549b('0x62')]['id'];_0x361a9d['agent']['id']=_0x404e4f[_0x549b('0x58')][_0x549b('0x61')];return db[_0x549b('0x3d')][_0x549b('0x56')]({'where':{'id':_0x404e4f['params']['id'],'UserId':null}})[_0x549b('0x22')](handleEntityNotFound(_0x31afbf,null))[_0x549b('0x22')](function(_0x4d8a36){if(_0x4d8a36){_0x361a9d[_0x549b('0x29')]=_0x4d8a36[_0x549b('0x64')]({'plain':!![]});return db[_0x549b('0x65')][_0x549b('0x56')]({'where':{'id':_0x4d8a36[_0x549b('0x66')]}});}return null;})[_0x549b('0x22')](handleEntityNotFound(_0x31afbf,null))[_0x549b('0x22')](function(_0x2d0c98){if(_0x2d0c98){_0x361a9d[_0x549b('0x6a')]=_0x2d0c98[_0x549b('0x64')]({'plain':!![]});interaction_log[_0x549b('0x23')]('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x404e4f[_0x549b('0x62')]['id'],_0x404e4f['user'][_0x549b('0x3a')],_0x404e4f[_0x549b('0x62')]['role'],_0x361a9d['interaction']['id'],_0x404e4f[_0x549b('0x58')]?JSON[_0x549b('0x26')](_0x404e4f[_0x549b('0x58')]):_0x549b('0x6c'));return respondWithRpcPromise('RejectMessage',_0x549b('0x7b'),_0x361a9d);}return null;})[_0x549b('0x22')](function(_0x52dacd){var _0x28f4d2=_0x549b('0x7c')+_0x52dacd['message'][_0x549b('0x6e')];return db[_0x549b('0x6f')][_0x549b('0x41')](_0x28f4d2,{'type':db[_0x549b('0x7d')][_0x549b('0x70')]['SELECT'],'raw':!![]})[_0x549b('0x22')](function(_0x371a9f){return _0x371a9f;});})[_0x549b('0x22')](function(_0xe696c5){if(_0xe696c5){_0x361a9d[_0x549b('0x29')][_0x549b('0x72')]=_0xe696c5[0x0];if(!_0x404e4f[_0x549b('0x58')][_0x549b('0x61')])return;return db[_0x549b('0x73')]['find']({'where':{'id':_0x404e4f[_0x549b('0x58')][_0x549b('0x61')],'role':_0x549b('0x63')},'attributes':['id',_0x549b('0x3a'),'fullname',_0x549b('0x75'),_0x549b('0x7e')],'raw':!![]});}return null;})['then'](function(_0x2aa18a){if(!_0x2aa18a)return null;_0x361a9d[_0x549b('0x29')][_0x549b('0x63')]=_0x2aa18a;return _0x361a9d;})[_0x549b('0x22')](function(_0x5f4b4a){if(_0x5f4b4a){_0x5f4b4a[_0x549b('0x29')][_0x549b('0x7f')]=util[_0x549b('0x60')]('SIP/%s',_0x404e4f['user'][_0x549b('0x3a')]);_0x5f4b4a[_0x549b('0x29')][_0x549b('0x78')]=_0x361a9d[_0x549b('0x78')];_0x5f4b4a[_0x549b('0x29')][_0x549b('0x80')]=_0x361a9d[_0x549b('0x78')];_0x5f4b4a[_0x549b('0x29')][_0x549b('0x81')]=_0x549b('0x35');respondWithRpcPromise('EventManager',_0x549b('0x79'),{'event':_0x549b('0x82'),'message':_0x5f4b4a[_0x549b('0x29')]},client9002);return _0x361a9d;}return null;})[_0x549b('0x22')](respondWithResult(_0x31afbf,null))[_0x549b('0x2c')](handleError(_0x31afbf,null));};exports['create']=function(_0x42e0cf,_0x819127){var _0x14273c;return db['FaxMessage'][_0x549b('0x83')](_0x42e0cf[_0x549b('0x58')],{})[_0x549b('0x22')](function(_0x6d912f){_0x14273c=_0x6d912f;return db[_0x549b('0x84')]['findOne']({'where':{'id':_0x14273c[_0x549b('0x6e')]}});})[_0x549b('0x22')](function(_0x5c9235){if(_[_0x549b('0x67')](_0x5c9235)){return;}else{_0x14273c[_0x549b('0x5d')]=_0x5c9235[_0x549b('0x5d')];return db[_0x549b('0x85')][_0x549b('0x86')]({'where':{'id':_0x14273c['AttachmentId']}});}})[_0x549b('0x22')](function(_0x3b8217){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_[_0x549b('0x67')](_0x42e0cf[_0x549b('0x58')])?undefined:_0x42e0cf[_0x549b('0x58')][_0x549b('0x87')],'path':_[_0x549b('0x67')](_0x3b8217)?undefined:util[_0x549b('0x60')](_0x549b('0x88'),_0x3b8217[_0x549b('0x89')]),'fax':_[_0x549b('0x67')](_0x14273c['fax'])?undefined:_0x14273c['fax'],'AttachmentId':_0x14273c[_0x549b('0x8a')]},client9002);})[_0x549b('0x22')](respondWithResult(_0x819127,0xc9))['catch'](handleError(_0x819127,null));};exports['download']=function(_0x26252e,_0x1072f2){var _0xe79e2a=path['join'](config[_0x549b('0x8b')],_0x549b('0x8c'),_0x549b('0x8d'),'attachments');return db['FaxMessage'][_0x549b('0x56')]({'where':{'id':_0x26252e[_0x549b('0x59')]['id']},'include':[{'model':db[_0x549b('0x85')],'as':'Attachment'}]})[_0x549b('0x22')](handleEntityNotFound(_0x1072f2,null))['then'](function(_0x131449){if(_0x131449){return _0x1072f2[_0x549b('0x8e')](path[_0x549b('0x8f')](_0xe79e2a,_0x131449[_0x549b('0x85')][_0x549b('0x89')]));}})[_0x549b('0x2c')](handleError(_0x1072f2,null));};
\ No newline at end of file
index 264c6c1..5a897df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1967=['exports','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x35a1e1,_0x51b12e){var _0x43a29e=function(_0x35effa){while(--_0x35effa){_0x35a1e1['push'](_0x35a1e1['shift']());}};_0x43a29e(++_0x51b12e);}(_0x1967,0x173));var _0x7196=function(_0x5320d8,_0x3730ab){_0x5320d8=_0x5320d8-0x0;var _0x28e806=_0x1967[_0x5320d8];return _0x28e806;};'use strict';var EventEmitter=require('events');var FaxMessage=require(_0x7196('0x0'))['db'][_0x7196('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x7196('0x2')](0x0);var events={'afterCreate':_0x7196('0x3'),'afterUpdate':_0x7196('0x4'),'afterDestroy':_0x7196('0x5')};function emitEvent(_0x302f34){return function(_0x1aaddd,_0x458ae8,_0x3ae43f){FaxMessageEvents['emit'](_0x302f34+':'+_0x1aaddd['id'],_0x1aaddd);FaxMessageEvents[_0x7196('0x6')](_0x302f34,_0x1aaddd);_0x3ae43f(null);};}for(var e in events){if(events[_0x7196('0x7')](e)){var event=events[e];FaxMessage[_0x7196('0x8')](e,emitEvent(event));}}module[_0x7196('0x9')]=FaxMessageEvents;
\ No newline at end of file
+var _0xa24d=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x509c0b,_0x4d4553){var _0x5f0415=function(_0x4f9d10){while(--_0x4f9d10){_0x509c0b['push'](_0x509c0b['shift']());}};_0x5f0415(++_0x4d4553);}(_0xa24d,0x1c1));var _0xda24=function(_0x354404,_0x141542){_0x354404=_0x354404-0x0;var _0x1c10f8=_0xa24d[_0x354404];return _0x1c10f8;};'use strict';var EventEmitter=require(_0xda24('0x0'));var FaxMessage=require(_0xda24('0x1'))['db'][_0xda24('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xda24('0x3')](0x0);var events={'afterCreate':_0xda24('0x4'),'afterUpdate':_0xda24('0x5'),'afterDestroy':_0xda24('0x6')};function emitEvent(_0x501b16){return function(_0xcc2450,_0x2e6e4f,_0x24a908){FaxMessageEvents[_0xda24('0x7')](_0x501b16+':'+_0xcc2450['id'],_0xcc2450);FaxMessageEvents['emit'](_0x501b16,_0xcc2450);_0x24a908(null);};}for(var e in events){if(events[_0xda24('0x8')](e)){var event=events[e];FaxMessage[_0xda24('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents;
\ No newline at end of file
index a59a186..57d9a40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1463=['../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','get','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x344bd6,_0x226ccc){var _0x464eb1=function(_0x5daef1){while(--_0x5daef1){_0x344bd6['push'](_0x344bd6['shift']());}};_0x464eb1(++_0x226ccc);}(_0x1463,0xb6));var _0x3146=function(_0x404c50,_0x441977){_0x404c50=_0x404c50-0x0;var _0x2f8fc6=_0x1463[_0x404c50];return _0x2f8fc6;};'use strict';var _=require(_0x3146('0x0'));var util=require(_0x3146('0x1'));var logger=require(_0x3146('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3146('0x3'));var rp=require(_0x3146('0x4'));var fs=require('fs');var path=require(_0x3146('0x5'));var rimraf=require(_0x3146('0x6'));var config=require(_0x3146('0x7'));var attributes=require(_0x3146('0x8'));module[_0x3146('0x9')]=function(_0x30f2e4,_0x30b95b){return _0x30f2e4['define'](_0x3146('0xa'),attributes,{'tableName':_0x3146('0xb'),'paranoid':![],'indexes':[{'name':_0x3146('0xc'),'fields':[_0x3146('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a1371,_0x1778a5,_0x3e5811){var _0x30514e=_0x30f2e4['models'];var _0x27b1f1=_0x4a1371[_0x3146('0xe')]({'plain':!![]});if(_0x27b1f1[_0x3146('0xf')][_0x3146('0x10')]()==='in'||_0x27b1f1[_0x3146('0xf')]['toLowerCase']()===_0x3146('0x11')&&!_0x27b1f1[_0x3146('0x12')]&&!_[_0x3146('0x13')](_0x27b1f1[_0x3146('0x14')])){_0x30514e['FaxInteraction'][_0x3146('0x15')]({'where':{'id':_0x27b1f1['FaxInteractionId']}})[_0x3146('0x16')](function(_0x48f8c3){if(_0x48f8c3){_0x48f8c3[_0x3146('0x17')]({'lastMsgAt':_0x27b1f1[_0x3146('0x18')],'lastMsgDirection':_0x27b1f1[_0x3146('0xf')][_0x3146('0x10')]()});}})['catch'](function(_0x52a701){console[_0x3146('0x19')](_0x52a701);});}_0x3e5811();}},'charset':_0x3146('0x1a'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x9dfb=['isNil','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','FaxMessage','fax_messages','fti_fax_messages','get','direction','toLowerCase','out'];(function(_0x531465,_0x35196d){var _0x5c3aa2=function(_0x3f4dae){while(--_0x3f4dae){_0x531465['push'](_0x531465['shift']());}};_0x5c3aa2(++_0x35196d);}(_0x9dfb,0xc8));var _0xb9df=function(_0x3f1a25,_0x2c21e5){_0x3f1a25=_0x3f1a25-0x0;var _0x3fba4a=_0x9dfb[_0x3f1a25];return _0x3fba4a;};'use strict';var _=require('lodash');var util=require(_0xb9df('0x0'));var logger=require(_0xb9df('0x1'))(_0xb9df('0x2'));var moment=require(_0xb9df('0x3'));var BPromise=require(_0xb9df('0x4'));var rp=require(_0xb9df('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb9df('0x6'));var config=require(_0xb9df('0x7'));var attributes=require('./faxMessage.attributes');module[_0xb9df('0x8')]=function(_0x189928,_0x453995){return _0x189928['define'](_0xb9df('0x9'),attributes,{'tableName':_0xb9df('0xa'),'paranoid':![],'indexes':[{'name':_0xb9df('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3eb586,_0x17de58,_0x19883a){var _0x3a565=_0x189928['models'];var _0x129e30=_0x3eb586[_0xb9df('0xc')]({'plain':!![]});if(_0x129e30[_0xb9df('0xd')]['toLowerCase']()==='in'||_0x129e30['direction'][_0xb9df('0xe')]()===_0xb9df('0xf')&&!_0x129e30['secret']&&!_[_0xb9df('0x10')](_0x129e30['UserId'])){_0x3a565[_0xb9df('0x11')][_0xb9df('0x12')]({'where':{'id':_0x129e30[_0xb9df('0x13')]}})[_0xb9df('0x14')](function(_0x3d5470){if(_0x3d5470){_0x3d5470[_0xb9df('0x15')]({'lastMsgAt':_0x129e30[_0xb9df('0x16')],'lastMsgDirection':_0x129e30[_0xb9df('0xd')]['toLowerCase']()});}})[_0xb9df('0x17')](function(_0x3da722){console[_0xb9df('0x18')](_0x3da722);});}_0x19883a();}},'charset':_0xb9df('0x19'),'collate':_0xb9df('0x1a')});};
\ No newline at end of file
index ef5a853..6dbe394 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x22fb=['request','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','options','raw','then','debug','UpdateFaxMessage','update','body','attributes','limit','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x22fb,0x192));var _0xb22f=function(_0x3d5bba,_0xb5456e){_0x3d5bba=_0x3d5bba-0x0;var _0xe5db2=_0x22fb[_0x3d5bba];return _0xe5db2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb22f('0x0'));var BPromise=require('bluebird');var rs=require(_0xb22f('0x1'));var fs=require('fs');var Redis=require(_0xb22f('0x2'));var db=require(_0xb22f('0x3'))['db'];var utils=require(_0xb22f('0x4'));var logger=require(_0xb22f('0x5'))('rpc');var config=require(_0xb22f('0x6'));var jayson=require(_0xb22f('0x7'));var client=jayson[_0xb22f('0x8')][_0xb22f('0x9')]({'port':0x232a});config[_0xb22f('0xa')]=_[_0xb22f('0xb')](config['redis'],{'host':_0xb22f('0xc'),'port':0x18eb});var socket=require(_0xb22f('0xd'))(new Redis(config[_0xb22f('0xa')]));require(_0xb22f('0xe'))[_0xb22f('0xf')](socket);function respondWithRpcPromise(_0x3593fb,_0x188cea,_0x2ca6dd){return new BPromise(function(_0x26cf79,_0x2676f3){return client[_0xb22f('0x10')](_0x3593fb,_0x2ca6dd)['then'](function(_0x4b9e56){logger['info'](_0xb22f('0x11'),_0x188cea,'request\x20sent');logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'),JSON[_0xb22f('0x13')](_0x4b9e56));if(_0x4b9e56[_0xb22f('0x14')]){if(_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x15')]===0x1f4){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x4b9e56[_0xb22f('0x14')]['message']);return _0x2676f3(_0x4b9e56[_0xb22f('0x14')]['message']);}logger[_0xb22f('0x14')](_0xb22f('0x11'),_0x188cea,_0x4b9e56[_0xb22f('0x14')][_0xb22f('0x16')]);return _0x26cf79(_0x4b9e56[_0xb22f('0x14')]['message']);}else{logger[_0xb22f('0x17')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0xb22f('0x12'));_0x26cf79(_0x4b9e56[_0xb22f('0x18')][_0xb22f('0x16')]);}})[_0xb22f('0x19')](function(_0x139bb6){logger[_0xb22f('0x14')]('FaxMessage,\x20%s,\x20%s',_0x188cea,_0x139bb6);_0x2676f3(_0x139bb6);});});}exports[_0xb22f('0x1a')]=function(_0x4b4510){var _0x3e05ce=this;return new Promise(function(_0x3878d8,_0x316f11){return db[_0xb22f('0x1b')][_0xb22f('0x1c')](_0x4b4510['body'],{'raw':_0x4b4510['options']?_0x4b4510[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![]})[_0xb22f('0x1f')](function(_0x16e465){logger[_0xb22f('0x17')](_0xb22f('0x1a'),_0x4b4510);logger[_0xb22f('0x20')](_0xb22f('0x1a'),_0x4b4510,JSON['stringify'](_0x16e465));_0x3878d8(_0x16e465);})['catch'](function(_0x3ab1d8){logger[_0xb22f('0x14')]('CreateFaxMessage',_0x3ab1d8[_0xb22f('0x16')],_0x4b4510);_0x316f11(_0x3e05ce[_0xb22f('0x14')](0x1f4,_0x3ab1d8['message']));});});};exports[_0xb22f('0x21')]=function(_0x2918be){var _0x4dfb62=this;return new Promise(function(_0x3e471f,_0x2c4a9e){return db[_0xb22f('0x1b')][_0xb22f('0x22')](_0x2918be[_0xb22f('0x23')],{'raw':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2918be['options']?_0x2918be['options']['where']||null:null,'attributes':_0x2918be[_0xb22f('0x1d')]?_0x2918be['options'][_0xb22f('0x24')]||null:null,'limit':_0x2918be[_0xb22f('0x1d')]?_0x2918be[_0xb22f('0x1d')][_0xb22f('0x25')]||null:null})[_0xb22f('0x1f')](function(_0x5b2a42){logger['info'](_0xb22f('0x21'),_0x2918be);logger[_0xb22f('0x20')](_0xb22f('0x21'),_0x2918be,JSON[_0xb22f('0x13')](_0x5b2a42));_0x3e471f(_0x5b2a42);})['catch'](function(_0x176133){logger[_0xb22f('0x14')]('UpdateFaxMessage',_0x176133[_0xb22f('0x16')],_0x2918be);_0x2c4a9e(_0x4dfb62[_0xb22f('0x14')](0x1f4,_0x176133[_0xb22f('0x16')]));});});};
\ No newline at end of file
+var _0xbd50=['request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','options','raw','then','UpdateFaxMessage','FaxMessage','update','body','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','./faxMessage.socket','register'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xbd50,0x196));var _0x0bd5=function(_0x46b131,_0x5e44c9){_0x46b131=_0x46b131-0x0;var _0x4925a5=_0xbd50[_0x46b131];return _0x4925a5;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});config[_0x0bd5('0xa')]=_[_0x0bd5('0xb')](config[_0x0bd5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd5('0xa')]));require(_0x0bd5('0xc'))[_0x0bd5('0xd')](socket);function respondWithRpcPromise(_0x5f5a0c,_0xa98f54,_0x2fa7d1){return new BPromise(function(_0x519bc6,_0x210f45){return client[_0x0bd5('0xe')](_0x5f5a0c,_0x2fa7d1)['then'](function(_0x1ce7dd){logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,'request\x20sent');logger[_0x0bd5('0x11')](_0x0bd5('0x12'),_0xa98f54,_0x0bd5('0x13'),JSON[_0x0bd5('0x14')](_0x1ce7dd));if(_0x1ce7dd[_0x0bd5('0x15')]){if(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x16')]===0x1f4){logger[_0x0bd5('0x15')]('FaxMessage,\x20%s,\x20%s',_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);return _0x210f45(_0x1ce7dd['error'][_0x0bd5('0x17')]);}logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')]['message']);return _0x519bc6(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);}else{logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,_0x0bd5('0x13'));_0x519bc6(_0x1ce7dd[_0x0bd5('0x18')][_0x0bd5('0x17')]);}})[_0x0bd5('0x19')](function(_0x29fa4c){logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x29fa4c);_0x210f45(_0x29fa4c);});});}exports[_0x0bd5('0x1a')]=function(_0x4008bd){var _0x2dc1e5=this;return new Promise(function(_0x527c37,_0x5ba943){return db['FaxMessage']['create'](_0x4008bd['body'],{'raw':_0x4008bd[_0x0bd5('0x1b')]?_0x4008bd[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![]})[_0x0bd5('0x1d')](function(_0x6ee1a8){logger['info'](_0x0bd5('0x1a'),_0x4008bd);logger[_0x0bd5('0x11')](_0x0bd5('0x1a'),_0x4008bd,JSON['stringify'](_0x6ee1a8));_0x527c37(_0x6ee1a8);})[_0x0bd5('0x19')](function(_0x4a8787){logger['error'](_0x0bd5('0x1a'),_0x4a8787[_0x0bd5('0x17')],_0x4008bd);_0x5ba943(_0x2dc1e5[_0x0bd5('0x15')](0x1f4,_0x4a8787['message']));});});};exports[_0x0bd5('0x1e')]=function(_0x5eab3e){var _0x456e87=this;return new Promise(function(_0x3ffb08,_0x18cec3){return db[_0x0bd5('0x1f')][_0x0bd5('0x20')](_0x5eab3e[_0x0bd5('0x21')],{'raw':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x22')]||null:null,'attributes':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['attributes']||null:null,'limit':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['limit']||null:null})[_0x0bd5('0x1d')](function(_0x8eccc9){logger['info'](_0x0bd5('0x1e'),_0x5eab3e);logger[_0x0bd5('0x11')](_0x0bd5('0x1e'),_0x5eab3e,JSON[_0x0bd5('0x14')](_0x8eccc9));_0x3ffb08(_0x8eccc9);})['catch'](function(_0x440e69){logger[_0x0bd5('0x15')](_0x0bd5('0x1e'),_0x440e69[_0x0bd5('0x17')],_0x5eab3e);_0x18cec3(_0x456e87[_0x0bd5('0x15')](0x1f4,_0x440e69[_0x0bd5('0x17')]));});});};
\ No newline at end of file
index 5b76186..4d86a20 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x606b=['update','emit','removeListener','register','length','faxMessage:','save'];(function(_0x48cf65,_0x52156e){var _0x2e8413=function(_0x4fd842){while(--_0x4fd842){_0x48cf65['push'](_0x48cf65['shift']());}};_0x2e8413(++_0x52156e);}(_0x606b,0x156));var _0xb606=function(_0x177eb9,_0x489a4c){_0x177eb9=_0x177eb9-0x0;var _0x2b2f54=_0x606b[_0x177eb9];return _0x2b2f54;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=[_0xb606('0x0'),'remove',_0xb606('0x1')];function createListener(_0x1791b4,_0x5c9959){return function(_0x342873){_0x5c9959[_0xb606('0x2')](_0x1791b4,_0x342873);};}function removeListener(_0x5dfcab,_0x30e399){return function(){FaxMessageEvents[_0xb606('0x3')](_0x5dfcab,_0x30e399);};}exports[_0xb606('0x4')]=function(_0x4c57aa){for(var _0x5df9f4=0x0,_0x161d7e=events[_0xb606('0x5')];_0x5df9f4<_0x161d7e;_0x5df9f4++){var _0x308240=events[_0x5df9f4];var _0x138923=createListener(_0xb606('0x6')+_0x308240,_0x4c57aa);FaxMessageEvents['on'](_0x308240,_0x138923);}};
\ No newline at end of file
+var _0x0255=['register','length','faxMessage:','remove','update','removeListener'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x0255,0x11d));var _0x5025=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0255[_0x3dd15e];return _0x231fd0;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save',_0x5025('0x0'),_0x5025('0x1')];function createListener(_0x2e4330,_0xc57005){return function(_0xf05df0){_0xc57005['emit'](_0x2e4330,_0xf05df0);};}function removeListener(_0x49fabf,_0x25660b){return function(){FaxMessageEvents[_0x5025('0x2')](_0x49fabf,_0x25660b);};}exports[_0x5025('0x3')]=function(_0x4a422e){for(var _0x449e8d=0x0,_0x8e158b=events[_0x5025('0x4')];_0x449e8d<_0x8e158b;_0x449e8d++){var _0xe6544e=events[_0x449e8d];var _0x133f6e=createListener(_0x5025('0x5')+_0xe6544e,_0x4a422e);FaxMessageEvents['on'](_0xe6544e,_0x133f6e);}};
\ No newline at end of file
index ca110e9..56b19c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa74f=['/describe','isAuthenticated','describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','/:id','update','put','accept','/:id/reject','delete','destroy','exports','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','index','get'];(function(_0x22baab,_0x303fff){var _0x32e174=function(_0x3ea6d3){while(--_0x3ea6d3){_0x22baab['push'](_0x22baab['shift']());}};_0x32e174(++_0x303fff);}(_0xa74f,0x9a));var _0xfa74=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xa74f[_0x2f3794];return _0x1c9fbe;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfa74('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfa74('0x1')]();var fs_extra=require(_0xfa74('0x2'));var auth=require(_0xfa74('0x3'));var interaction=require(_0xfa74('0x4'));var config=require('../../config/environment');var controller=require(_0xfa74('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xfa74('0x6')]);router[_0xfa74('0x7')](_0xfa74('0x8'),auth[_0xfa74('0x9')](),controller[_0xfa74('0xa')]);router[_0xfa74('0x7')]('/:id',auth[_0xfa74('0x9')](),controller[_0xfa74('0xb')]);router[_0xfa74('0x7')](_0xfa74('0xc'),auth['isAuthenticated'](),controller[_0xfa74('0xd')]);router[_0xfa74('0xe')]('/',auth['isAuthenticated'](),interaction[_0xfa74('0xf')](_0xfa74('0x10'),_0xfa74('0x11')),controller[_0xfa74('0x12')]);router['put'](_0xfa74('0x13'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x14')]);router[_0xfa74('0x15')]('/:id/accept',auth[_0xfa74('0x9')](),controller[_0xfa74('0x16')]);router[_0xfa74('0x15')](_0xfa74('0x17'),auth[_0xfa74('0x9')](),controller['reject']);router[_0xfa74('0x18')](_0xfa74('0x13'),auth[_0xfa74('0x9')](),controller[_0xfa74('0x19')]);module[_0xfa74('0x1a')]=router;
\ No newline at end of file
+var _0x3f8c=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','/:id','show','/:id/download','post','tracked','fax','create','put'];(function(_0x4b4a4b,_0xf29d3b){var _0x8ca386=function(_0x257b1a){while(--_0x257b1a){_0x4b4a4b['push'](_0x4b4a4b['shift']());}};_0x8ca386(++_0xf29d3b);}(_0x3f8c,0x104));var _0xc3f8=function(_0x190b16,_0x35ac6d){_0x190b16=_0x190b16-0x0;var _0xe65f4b=_0x3f8c[_0x190b16];return _0xe65f4b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xc3f8('0x4')]('/',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x4')](_0xc3f8('0x7'),auth[_0xc3f8('0x5')](),controller['describe']);router[_0xc3f8('0x4')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);router[_0xc3f8('0x4')](_0xc3f8('0xa'),auth[_0xc3f8('0x5')](),controller['download']);router[_0xc3f8('0xb')]('/',auth[_0xc3f8('0x5')](),interaction[_0xc3f8('0xc')](_0xc3f8('0xd'),'faxmessage:create'),controller[_0xc3f8('0xe')]);router[_0xc3f8('0xf')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller['update']);router[_0xc3f8('0xf')](_0xc3f8('0x10'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x11')]);router[_0xc3f8('0xf')](_0xc3f8('0x12'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x13')]);router[_0xc3f8('0x14')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x15')]);module[_0xc3f8('0x16')]=router;
\ No newline at end of file
index ac066de..afd2193 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x40b6=['rrmemory','STRING','name','INTEGER','ENUM'];(function(_0x31dda2,_0x42a1f1){var _0x2650e5=function(_0x5abeee){while(--_0x5abeee){_0x31dda2['push'](_0x31dda2['shift']());}};_0x2650e5(++_0x42a1f1);}(_0x40b6,0x14b));var _0x640b=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x40b6[_0x41ee16];return _0x1f60de;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x640b('0x0')],'unique':_0x640b('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x640b('0x0')]},'timeout':{'type':Sequelize[_0x640b('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x640b('0x3')](_0x640b('0x4'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x640b('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x5430=['STRING','name','INTEGER','beepall','sequelize','exports'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0x5430,0x10c));var _0x0543=function(_0xf152b3,_0x31e32b){_0xf152b3=_0xf152b3-0x0;var _0x298017=_0x5430[_0xf152b3];return _0x298017;};'use strict';var Sequelize=require(_0x0543('0x0'));module[_0x0543('0x1')]={'name':{'type':Sequelize[_0x0543('0x2')],'unique':_0x0543('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x0543('0x2')]},'timeout':{'type':Sequelize[_0x0543('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x0543('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index a18f44e..bc84998 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96fd=['Agents','sequelize','forEach','emit','userFaxQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','every','includes','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','spread','isArray','util','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','update','then','destroy','get','UserProfileResource','stack','map','rawAttributes','fieldName','type','key','getOptions','where','FaxQueue','include','query','findAll','catch','show','model','keys','filters','intersection','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','FaxQueues','userProfileId','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','fields','hasOwnProperty','order','sort','pick','FaxQueueId','filter','UserFaxQueue','UserId','agent','createdAt','rows','format','faxPause','updatedAt','Team','nolimit','getTeams','addTeams','User','voicePause','interface'];(function(_0x45ebc0,_0x596819){var _0x392880=function(_0x2e9dd5){while(--_0x2e9dd5){_0x45ebc0['push'](_0x45ebc0['shift']());}};_0x392880(++_0x596819);}(_0x96fd,0x1e9));var _0xd96f=function(_0x36628b,_0x9e370a){_0x36628b=_0x36628b-0x0;var _0x5680fe=_0x96fd[_0x36628b];return _0x5680fe;};'use strict';var BPromise=require('bluebird');var util=require(_0xd96f('0x0'));var _=require('lodash');var squel=require(_0xd96f('0x1'));var Redis=require(_0xd96f('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xd96f('0x3'))(_0xd96f('0x4'));var config=require(_0xd96f('0x5'));var db=require(_0xd96f('0x6'))['db'];config['redis']=_[_0xd96f('0x7')](config[_0xd96f('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xd96f('0x9'))(new Redis(config[_0xd96f('0x8')]));require(_0xd96f('0xa'))[_0xd96f('0xb')](socket);function respondWithStatusCode(_0x10a4f3,_0x2eb3ae){_0x2eb3ae=_0x2eb3ae||0xcc;return function(_0x4400f8){if(_0x4400f8){return _0x10a4f3[_0xd96f('0xc')](_0x2eb3ae);}return _0x10a4f3[_0xd96f('0xd')](_0x2eb3ae)[_0xd96f('0xe')]();};}function respondWithResult(_0xd77bc5,_0x54c112){_0x54c112=_0x54c112||0xc8;return function(_0x37ac24){if(_0x37ac24){return _0xd77bc5[_0xd96f('0xd')](_0x54c112)[_0xd96f('0xf')](_0x37ac24);}};}function respondWithFilteredResult(_0x4d6aa,_0x2b2226){return function(_0x187274){if(_0x187274){var _0x4b9cfa=typeof _0x2b2226['offset']===_0xd96f('0x10')&&typeof _0x2b2226[_0xd96f('0x11')]==='undefined';var _0x5870cd=_0x187274[_0xd96f('0x12')];var _0x21e481=_0x4b9cfa?0x0:_0x2b2226[_0xd96f('0x13')];var _0x46332d=_0x4b9cfa?_0x187274[_0xd96f('0x12')]:_0x2b2226[_0xd96f('0x13')]+_0x2b2226[_0xd96f('0x11')];var _0x2533ec;if(_0x46332d>=_0x5870cd){_0x46332d=_0x5870cd;_0x2533ec=0xc8;}else{_0x2533ec=0xce;}_0x4d6aa[_0xd96f('0xd')](_0x2533ec);return _0x4d6aa[_0xd96f('0x14')]('Content-Range',_0x21e481+'-'+_0x46332d+'/'+_0x5870cd)[_0xd96f('0xf')](_0x187274);}return null;};}function saveUpdates(_0x569e1){return function(_0x47d17c){if(_0x47d17c){return _0x47d17c[_0xd96f('0x15')](_0x569e1)[_0xd96f('0x16')](function(_0x45c990){return _0x45c990;});}return null;};}function removeEntity(_0x15d2d5){return function(_0x7663e3){if(_0x7663e3){return _0x7663e3[_0xd96f('0x17')]()['then'](function(){var _0x1340b6=_0x7663e3[_0xd96f('0x18')]({'plain':!![]});var _0xffc2cf='FaxQueues';return db[_0xd96f('0x19')][_0xd96f('0x17')]({'where':{'type':_0xffc2cf,'resourceId':_0x1340b6['id']}})[_0xd96f('0x16')](function(){return _0x7663e3;});})[_0xd96f('0x16')](function(){_0x15d2d5[_0xd96f('0xd')](0xcc)[_0xd96f('0xe')]();});}};}function handleEntityNotFound(_0x318f36){return function(_0x57c396){if(!_0x57c396){_0x318f36[_0xd96f('0xc')](0x194);}return _0x57c396;};}function handleError(_0x224f72,_0x4de2ef){_0x4de2ef=_0x4de2ef||0x1f4;return function(_0x3ea026){logger['error'](_0x3ea026[_0xd96f('0x1a')]);if(_0x3ea026['name']){delete _0x3ea026['name'];}_0x224f72[_0xd96f('0xd')](_0x4de2ef)['send'](_0x3ea026);};}exports['index']=function(_0x4643e6,_0x33f036){var _0x1b4b26={};var _0x1a232d={'count':0x0,'rows':[]};var _0xd4cfa=_[_0xd96f('0x1b')](db['FaxQueue'][_0xd96f('0x1c')],function(_0x24d81a){return{'name':_0x24d81a[_0xd96f('0x1d')],'type':_0x24d81a[_0xd96f('0x1e')][_0xd96f('0x1f')]};});_0x1b4b26=qs[_0xd96f('0x20')](_0xd4cfa,_0x4643e6);var _0x2dd76b={'where':_0x1b4b26[_0xd96f('0x21')]};return db[_0xd96f('0x22')][_0xd96f('0x12')](_0x2dd76b)[_0xd96f('0x16')](function(_0x286caf){_0x1a232d[_0xd96f('0x12')]=_0x286caf;_0x1b4b26[_0xd96f('0x23')]=qs[_0xd96f('0x23')](_0x4643e6[_0xd96f('0x24')]);return db[_0xd96f('0x22')][_0xd96f('0x25')](_0x1b4b26);})[_0xd96f('0x16')](function(_0x1738dd){_0x1a232d['rows']=_0x1738dd;return _0x1a232d;})[_0xd96f('0x16')](respondWithFilteredResult(_0x33f036,_0x1b4b26))[_0xd96f('0x26')](handleError(_0x33f036,null));};exports[_0xd96f('0x27')]=function(_0x57f561,_0x1b0d9b){var _0x18c918={'raw':!![],'where':{'id':_0x57f561['params']['id']}},_0x1f1a0a={};_0x1f1a0a[_0xd96f('0x28')]=_['keys'](db[_0xd96f('0x22')]['rawAttributes']);_0x1f1a0a[_0xd96f('0x24')]=_[_0xd96f('0x29')](_0x57f561[_0xd96f('0x24')]);_0x1f1a0a[_0xd96f('0x2a')]=_[_0xd96f('0x2b')](_0x1f1a0a[_0xd96f('0x28')],_0x1f1a0a[_0xd96f('0x24')]);_0x18c918['attributes']=_['intersection'](_0x1f1a0a[_0xd96f('0x28')],qs['fields'](_0x57f561['query']['fields']));_0x18c918[_0xd96f('0x2c')]=_0x18c918[_0xd96f('0x2c')][_0xd96f('0x2d')]?_0x18c918[_0xd96f('0x2c')]:_0x1f1a0a['model'];if(_0x57f561[_0xd96f('0x24')][_0xd96f('0x2e')]){_0x18c918[_0xd96f('0x23')]=[{'all':!![]}];}_0x18c918=_[_0xd96f('0x2f')]({},_0x18c918,_0x57f561[_0xd96f('0x30')]);return db[_0xd96f('0x22')][_0xd96f('0x31')](_0x18c918)[_0xd96f('0x16')](handleEntityNotFound(_0x1b0d9b,null))[_0xd96f('0x16')](respondWithResult(_0x1b0d9b,null))[_0xd96f('0x26')](handleError(_0x1b0d9b,null));};exports[_0xd96f('0x32')]=function(_0x3bfcdb,_0x4b0573){return db[_0xd96f('0x22')][_0xd96f('0x32')](_0x3bfcdb[_0xd96f('0x33')],{})[_0xd96f('0x16')](function(_0x4e543a){var _0xaeab78=_0x3bfcdb[_0xd96f('0x34')][_0xd96f('0x18')]({'plain':!![]});if(!_0xaeab78)throw new Error(_0xd96f('0x35'));if(_0xaeab78['role']==='user'){var _0x24a2c5=_0x4e543a[_0xd96f('0x18')]({'plain':!![]});var _0xfaf6f1=_0xd96f('0x36');return db['UserProfileSection'][_0xd96f('0x31')]({'where':{'name':_0xfaf6f1,'userProfileId':_0xaeab78[_0xd96f('0x37')]},'raw':!![]})['then'](function(_0x1f23ab){if(_0x1f23ab&&_0x1f23ab[_0xd96f('0x38')]===0x0){return db[_0xd96f('0x19')][_0xd96f('0x32')]({'name':_0x24a2c5['name'],'resourceId':_0x24a2c5['id'],'type':_0x1f23ab[_0xd96f('0x39')],'sectionId':_0x1f23ab['id']},{})['then'](function(){return _0x4e543a;});}else{return _0x4e543a;}})[_0xd96f('0x26')](function(_0x1b6de2){logger[_0xd96f('0x3a')](_0xd96f('0x3b'),_0x1b6de2);throw _0x1b6de2;});}return _0x4e543a;})['then'](respondWithResult(_0x4b0573,0xc9))[_0xd96f('0x26')](handleError(_0x4b0573,null));};exports[_0xd96f('0x15')]=function(_0x18d756,_0x11f196){if(_0x18d756[_0xd96f('0x33')]['id']){delete _0x18d756[_0xd96f('0x33')]['id'];}return db[_0xd96f('0x22')][_0xd96f('0x31')]({'where':{'id':_0x18d756[_0xd96f('0x3c')]['id']}})[_0xd96f('0x16')](handleEntityNotFound(_0x11f196,null))[_0xd96f('0x16')](saveUpdates(_0x18d756[_0xd96f('0x33')],null))[_0xd96f('0x16')](respondWithResult(_0x11f196,null))[_0xd96f('0x26')](handleError(_0x11f196,null));};exports[_0xd96f('0x17')]=function(_0x1e25fb,_0x241bac){return db[_0xd96f('0x22')]['find']({'where':{'id':_0x1e25fb['params']['id']}})[_0xd96f('0x16')](handleEntityNotFound(_0x241bac,null))['then'](removeEntity(_0x241bac,null))['catch'](handleError(_0x241bac,null));};exports[_0xd96f('0x3d')]=function(_0x4f0ee4,_0x346fa7){return db[_0xd96f('0x22')][_0xd96f('0x3d')]()['then'](respondWithResult(_0x346fa7,null))[_0xd96f('0x26')](handleError(_0x346fa7,null));};exports[_0xd96f('0x3e')]=function(_0x373716,_0x4a4cb8){var _0x43a5df={'raw':!![],'where':{}},_0x7fc231={},_0x284214;return db[_0xd96f('0x22')][_0xd96f('0x3f')]({'where':{'id':_0x373716[_0xd96f('0x3c')]['id']}})[_0xd96f('0x16')](handleEntityNotFound(_0x4a4cb8,null))[_0xd96f('0x16')](function(_0x27721e){if(_0x27721e){_0x284214=_0x27721e[_0xd96f('0x18')]({'plain':!![]});_0x7fc231[_0xd96f('0x28')]=_[_0xd96f('0x29')](db['UserFaxQueue'][_0xd96f('0x1c')]);_0x7fc231[_0xd96f('0x24')]=_[_0xd96f('0x29')](_0x373716['query']);_0x7fc231[_0xd96f('0x2a')]=_['intersection'](_0x7fc231[_0xd96f('0x28')],_0x7fc231[_0xd96f('0x24')]);_0x43a5df[_0xd96f('0x2c')]=_[_0xd96f('0x2b')](_0x7fc231[_0xd96f('0x28')],qs[_0xd96f('0x40')](_0x373716[_0xd96f('0x24')][_0xd96f('0x40')]));_0x43a5df[_0xd96f('0x2c')]=_0x43a5df[_0xd96f('0x2c')][_0xd96f('0x2d')]?_0x43a5df[_0xd96f('0x2c')]:_0x7fc231[_0xd96f('0x28')];if(!_0x373716[_0xd96f('0x24')][_0xd96f('0x41')]('nolimit')){_0x43a5df[_0xd96f('0x11')]=qs[_0xd96f('0x11')](_0x373716[_0xd96f('0x24')][_0xd96f('0x11')]);_0x43a5df['offset']=qs[_0xd96f('0x13')](_0x373716['query'][_0xd96f('0x13')]);}_0x43a5df[_0xd96f('0x42')]=qs[_0xd96f('0x43')](_0x373716['query'][_0xd96f('0x43')]);_0x43a5df[_0xd96f('0x21')]=qs[_0xd96f('0x2a')](_[_0xd96f('0x44')](_0x373716['query'],_0x7fc231[_0xd96f('0x2a')]));_0x43a5df[_0xd96f('0x21')][_0xd96f('0x45')]=_0x27721e['id'];if(_0x373716[_0xd96f('0x24')][_0xd96f('0x46')]){_0x43a5df[_0xd96f('0x21')]=_[_0xd96f('0x2f')](_0x43a5df['where'],{'$or':_[_0xd96f('0x1b')](_0x43a5df['attributes'],function(_0x3a81d9){var _0x555e8e={};_0x555e8e[_0x3a81d9]={'$like':'%'+_0x373716[_0xd96f('0x24')][_0xd96f('0x46')]+'%'};return _0x555e8e;})});}_0x43a5df=_[_0xd96f('0x2f')]({},_0x43a5df,_0x373716[_0xd96f('0x30')]);return db[_0xd96f('0x47')][_0xd96f('0x25')](_0x43a5df);}})[_0xd96f('0x16')](function(_0x40d594){if(_0x40d594){return db['User']['findAndCountAll']({'where':{'id':_[_0xd96f('0x1b')](_0x40d594,_0xd96f('0x48')),'role':_0xd96f('0x49')},'attributes':['id',_0xd96f('0x39'),'faxPause','updatedAt',_0xd96f('0x4a')]});}})[_0xd96f('0x16')](function(_0x590c41){if(_0x590c41){return{'count':_0x590c41[_0xd96f('0x12')],'rows':_['map'](_0x590c41[_0xd96f('0x4b')],function(_0x406aae){return{'membername':_0x406aae['name'],'UserId':_0x406aae['id'],'queue_name':_0x284214[_0xd96f('0x39')],'FaxQueueId':_0x284214['id'],'interface':util[_0xd96f('0x4c')]('%s/%s','SIP',_0x406aae[_0xd96f('0x39')]),'penalty':0x0,'paused':_0x406aae[_0xd96f('0x4d')],'createdAt':_0x406aae[_0xd96f('0x4a')],'updatedAt':_0x406aae[_0xd96f('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4a4cb8,_0x43a5df))[_0xd96f('0x26')](handleError(_0x4a4cb8,null));};exports['getTeams']=function(_0x1be376,_0x2f1f67){var _0x165540={};var _0x53c62b={};var _0x39eead;var _0xf01dc8;return db[_0xd96f('0x22')][_0xd96f('0x3f')]({'where':{'id':_0x1be376[_0xd96f('0x3c')]['id']}})[_0xd96f('0x16')](handleEntityNotFound(_0x2f1f67,null))[_0xd96f('0x16')](function(_0x3a9226){if(_0x3a9226){_0x39eead=_0x3a9226;_0x53c62b[_0xd96f('0x28')]=_[_0xd96f('0x29')](db[_0xd96f('0x4f')][_0xd96f('0x1c')]);_0x53c62b[_0xd96f('0x24')]=_[_0xd96f('0x29')](_0x1be376[_0xd96f('0x24')]);_0x53c62b[_0xd96f('0x2a')]=_[_0xd96f('0x2b')](_0x53c62b['model'],_0x53c62b['query']);_0x165540[_0xd96f('0x2c')]=_[_0xd96f('0x2b')](_0x53c62b[_0xd96f('0x28')],qs[_0xd96f('0x40')](_0x1be376[_0xd96f('0x24')]['fields']));_0x165540[_0xd96f('0x2c')]=_0x165540['attributes']['length']?_0x165540[_0xd96f('0x2c')]:_0x53c62b[_0xd96f('0x28')];_0x165540[_0xd96f('0x42')]=qs[_0xd96f('0x43')](_0x1be376['query'][_0xd96f('0x43')]);_0x165540['where']=qs['filters'](_[_0xd96f('0x44')](_0x1be376['query'],_0x53c62b['filters']));if(_0x1be376['query'][_0xd96f('0x46')]){_0x165540[_0xd96f('0x21')]=_['merge'](_0x165540[_0xd96f('0x21')],{'$or':_[_0xd96f('0x1b')](_0x165540[_0xd96f('0x2c')],function(_0xf683d7){var _0x1063f3={};_0x1063f3[_0xf683d7]={'$like':'%'+_0x1be376[_0xd96f('0x24')][_0xd96f('0x46')]+'%'};return _0x1063f3;})});}_0x165540=_[_0xd96f('0x2f')]({},_0x165540,_0x1be376[_0xd96f('0x30')]);return _0x39eead['getTeams'](_0x165540);}})['then'](function(_0x249ca9){if(_0x249ca9){_0xf01dc8=_0x249ca9[_0xd96f('0x2d')];if(!_0x1be376[_0xd96f('0x24')][_0xd96f('0x41')](_0xd96f('0x50'))){_0x165540[_0xd96f('0x11')]=qs[_0xd96f('0x11')](_0x1be376[_0xd96f('0x24')][_0xd96f('0x11')]);_0x165540[_0xd96f('0x13')]=qs[_0xd96f('0x13')](_0x1be376[_0xd96f('0x24')][_0xd96f('0x13')]);}return _0x39eead[_0xd96f('0x51')](_0x165540);}})['then'](function(_0x365279){if(_0x365279){return _0x365279?{'count':_0xf01dc8,'rows':_0x365279}:null;}})[_0xd96f('0x16')](respondWithResult(_0x2f1f67,null))[_0xd96f('0x26')](handleError(_0x2f1f67,null));};exports[_0xd96f('0x52')]=function(_0x1fb7f8,_0x451bb5){var _0x494d19=_0x1fb7f8[_0xd96f('0x33')]['ids'];return db[_0xd96f('0x4f')][_0xd96f('0x25')]({'where':{'id':_0x494d19},'attributes':['id'],'include':[{'model':db[_0xd96f('0x53')],'as':'Agents','attributes':['id',_0xd96f('0x39'),'online',_0xd96f('0x54'),_0xd96f('0x55')],'raw':!![]}]})['then'](function(_0x4e6032){if(_0x4e6032){var _0x42cc36=_['flatMap'](_0x4e6032,function(_0x1e8894){var _0x583fba=_0x1e8894[_0xd96f('0x18')]({'plain':!![]});return _0x583fba[_0xd96f('0x56')];});return db['FaxQueue'][_0xd96f('0x31')]({'where':{'id':_0x1fb7f8[_0xd96f('0x3c')]['id']}})[_0xd96f('0x16')](function(_0x3ecfe4){return db[_0xd96f('0x57')]['transaction'](function(_0x267577){return _0x3ecfe4[_0xd96f('0x52')](_0x494d19,{'transaction':_0x267577})[_0xd96f('0x16')](function(){return BPromise['each'](_0x42cc36,function(_0x5a463c){return db[_0xd96f('0x47')]['findOrCreate']({'where':{'UserId':_0x5a463c['id'],'FaxQueueId':_0x1fb7f8[_0xd96f('0x3c')]['id']},'transaction':_0x267577});});})['then'](function(){_0x42cc36[_0xd96f('0x58')](function(_0x4edf97){socket[_0xd96f('0x59')](_0xd96f('0x5a'),{'UserId':_0x4edf97['id'],'FaxQueueId':_0x3ecfe4['id']});});});});});}})[_0xd96f('0x16')](respondWithStatusCode(_0x451bb5,null))[_0xd96f('0x26')](handleError(_0x451bb5,null));};exports[_0xd96f('0x5b')]=function(_0x5a62df,_0x3798fe){return db[_0xd96f('0x4f')][_0xd96f('0x25')]({'where':{'id':_0x5a62df[_0xd96f('0x24')][_0xd96f('0x5c')]},'attributes':['id'],'include':[{'model':db[_0xd96f('0x53')],'as':_0xd96f('0x56'),'attributes':['id'],'raw':!![]}]})[_0xd96f('0x16')](handleEntityNotFound(_0x3798fe,null))[_0xd96f('0x16')](function(_0x42f64b){var _0x3865a9=_[_0xd96f('0x1b')](_0x42f64b,'id');var _0x25664a=[];var _0x19dcef=[];var _0x463e65=squel['select']();_0x463e65[_0xd96f('0x5d')](_0xd96f('0x5e'))[_0xd96f('0x5f')](_0xd96f('0x60'),'tq')['join'](_0xd96f('0x61'),'ut',_0xd96f('0x62'))['where'](_0xd96f('0x63'),_0x5a62df['params']['id']);for(var _0x27e9ba=0x0;_0x27e9ba<_0x42f64b['length'];_0x27e9ba+=0x1){let _0x39f87a=_0x42f64b[_0x27e9ba];for(var _0x40b148=0x0;_0x40b148<_0x39f87a[_0xd96f('0x56')][_0xd96f('0x2d')];_0x40b148+=0x1){let _0xdd16c1=_0x39f87a[_0xd96f('0x56')][_0x40b148];var _0x3b3fb0=_0x463e65[_0xd96f('0x64')]();_0x3b3fb0[_0xd96f('0x21')](_0xd96f('0x65'),_0xdd16c1['id']);_0x19dcef['push'](db[_0xd96f('0x57')]['query'](_0x3b3fb0['toString'](),{'type':db[_0xd96f('0x57')][_0xd96f('0x66')][_0xd96f('0x67')]})[_0xd96f('0x16')](function(_0x490ee8){if(_0x490ee8['length']===0x1){return _0xdd16c1['id'];}else{var _0x50ced7=_[_0xd96f('0x68')](_[_0xd96f('0x1b')](_0x490ee8,'TeamId'),function(_0x53befc){return _[_0xd96f('0x69')](_0x3865a9,_0x53befc);});if(_0x50ced7){return _0xdd16c1['id'];}}}));}}return BPromise['all'](_0x19dcef)[_0xd96f('0x16')](function(_0x270e24){_0x25664a=_(_0x25664a)[_0xd96f('0x6a')](_0x270e24)[_0xd96f('0x6b')]()[_0xd96f('0x6c')]();return db[_0xd96f('0x22')]['find']({'where':{'id':_0x5a62df[_0xd96f('0x3c')]['id']}})[_0xd96f('0x16')](function(_0x514003){return db[_0xd96f('0x57')]['transaction'](function(_0x1c99bc){return _0x514003[_0xd96f('0x5b')](_0x5a62df[_0xd96f('0x24')][_0xd96f('0x5c')],{'transaction':_0x1c99bc})['then'](function(){if(!_[_0xd96f('0x6d')](_0x25664a)){return _0x514003[_0xd96f('0x6e')](_0x25664a,{'transaction':_0x1c99bc});}})[_0xd96f('0x16')](function(){_0x25664a[_0xd96f('0x58')](function(_0x47328d){socket['emit'](_0xd96f('0x6f'),{'UserId':_0x47328d,'FaxQueueId':_0x514003['id']});});});});});});})[_0xd96f('0x16')](respondWithStatusCode(_0x3798fe,null))[_0xd96f('0x26')](handleError(_0x3798fe,null));};exports[_0xd96f('0x70')]=function(_0xeb7031,_0x2bcf85){return db[_0xd96f('0x22')][_0xd96f('0x31')]({'where':{'id':_0xeb7031[_0xd96f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2bcf85,null))['then'](function(_0x4381d8){if(_0x4381d8){return _0x4381d8[_0xd96f('0x70')](_0xeb7031['body'][_0xd96f('0x5c')],_['omit'](_0xeb7031['body'],[_0xd96f('0x5c'),'id'])||{})[_0xd96f('0x71')](function(_0x4f5e77){for(var _0x4296c5=0x0;_0x4296c5<_0xeb7031[_0xd96f('0x33')]['ids'][_0xd96f('0x2d')];_0x4296c5+=0x1){socket[_0xd96f('0x59')](_0xd96f('0x5a'),{'UserId':Number(_0xeb7031[_0xd96f('0x33')][_0xd96f('0x5c')][_0x4296c5]),'FaxQueueId':Number(_0xeb7031[_0xd96f('0x3c')]['id'])});}return _0x4f5e77;});}})[_0xd96f('0x16')](respondWithResult(_0x2bcf85,null))[_0xd96f('0x26')](handleError(_0x2bcf85,null));};exports[_0xd96f('0x6e')]=function(_0x31df42,_0xd0647f){return db['FaxQueue'][_0xd96f('0x31')]({'where':{'id':_0x31df42['params']['id']}})['then'](handleEntityNotFound(_0xd0647f,null))[_0xd96f('0x16')](function(_0x105da9){if(_0x105da9){return _0x105da9[_0xd96f('0x6e')](_0x31df42[_0xd96f('0x24')][_0xd96f('0x5c')])['then'](function(){if(_[_0xd96f('0x72')](_0x31df42[_0xd96f('0x24')][_0xd96f('0x5c')])){for(var _0x40d42b=0x0;_0x40d42b<_0x31df42[_0xd96f('0x24')][_0xd96f('0x5c')][_0xd96f('0x2d')];_0x40d42b+=0x1){socket[_0xd96f('0x59')]('userFaxQueue:remove',{'UserId':Number(_0x31df42[_0xd96f('0x24')][_0xd96f('0x5c')][_0x40d42b]),'FaxQueueId':Number(_0x31df42['params']['id'])});}}else{socket[_0xd96f('0x59')]('userFaxQueue:remove',{'UserId':Number(_0x31df42[_0xd96f('0x24')][_0xd96f('0x5c')]),'FaxQueueId':Number(_0x31df42[_0xd96f('0x3c')]['id'])});}});}})[_0xd96f('0x16')](respondWithStatusCode(_0xd0647f,null))[_0xd96f('0x26')](handleError(_0xd0647f,null));};exports['getAgents']=function(_0x4c5579,_0x24e7ef){var _0x103738={};var _0x52eb44={};var _0xed201c;var _0x463c16;return db[_0xd96f('0x22')][_0xd96f('0x3f')]({'where':{'id':_0x4c5579[_0xd96f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x24e7ef,null))[_0xd96f('0x16')](function(_0x3df93e){if(_0x3df93e){_0xed201c=_0x3df93e;_0x52eb44[_0xd96f('0x28')]=_[_0xd96f('0x29')](db[_0xd96f('0x53')][_0xd96f('0x1c')]);_0x52eb44[_0xd96f('0x24')]=_[_0xd96f('0x29')](_0x4c5579[_0xd96f('0x24')]);_0x52eb44[_0xd96f('0x2a')]=_['intersection'](_0x52eb44['model'],_0x52eb44[_0xd96f('0x24')]);_0x103738[_0xd96f('0x2c')]=_[_0xd96f('0x2b')](_0x52eb44[_0xd96f('0x28')],qs[_0xd96f('0x40')](_0x4c5579[_0xd96f('0x24')][_0xd96f('0x40')]));_0x103738['attributes']=_0x103738['attributes'][_0xd96f('0x2d')]?_0x103738[_0xd96f('0x2c')]:_0x52eb44[_0xd96f('0x28')];_0x103738['order']=qs['sort'](_0x4c5579[_0xd96f('0x24')][_0xd96f('0x43')]);_0x103738[_0xd96f('0x21')]=qs[_0xd96f('0x2a')](_[_0xd96f('0x44')](_0x4c5579['query'],_0x52eb44[_0xd96f('0x2a')]));if(_0x4c5579[_0xd96f('0x24')][_0xd96f('0x46')]){_0x103738[_0xd96f('0x21')]=_['merge'](_0x103738[_0xd96f('0x21')],{'$or':_[_0xd96f('0x1b')](_0x103738[_0xd96f('0x2c')],function(_0x376f2e){var _0x4bdf48={};_0x4bdf48[_0x376f2e]={'$like':'%'+_0x4c5579[_0xd96f('0x24')][_0xd96f('0x46')]+'%'};return _0x4bdf48;})});}_0x103738=_[_0xd96f('0x2f')]({},_0x103738,_0x4c5579[_0xd96f('0x30')]);return _0xed201c['getAgents'](_0x103738);}})[_0xd96f('0x16')](function(_0x4f052a){if(_0x4f052a){_0x463c16=_0x4f052a['length'];if(!_0x4c5579[_0xd96f('0x24')]['hasOwnProperty'](_0xd96f('0x50'))){_0x103738[_0xd96f('0x11')]=qs[_0xd96f('0x11')](_0x4c5579['query'][_0xd96f('0x11')]);_0x103738[_0xd96f('0x13')]=qs[_0xd96f('0x13')](_0x4c5579['query'][_0xd96f('0x13')]);}return _0xed201c['getAgents'](_0x103738);}})[_0xd96f('0x16')](function(_0x33f526){if(_0x33f526){return _0x33f526?{'count':_0x463c16,'rows':_0x33f526}:null;}})['then'](respondWithResult(_0x24e7ef,null))['catch'](handleError(_0x24e7ef,null));};
\ No newline at end of file
+var _0xf072=['get','FaxQueues','UserProfileResource','error','stack','name','send','FaxQueue','fieldName','type','key','getOptions','where','include','query','rows','catch','show','params','keys','rawAttributes','filters','intersection','model','attributes','fields','includeAll','options','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','nolimit','order','sort','pick','FaxQueueId','filter','merge','User','findAndCountAll','map','agent','faxPause','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','findAll','Agents','online','flatMap','sequelize','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy'];(function(_0x3ea94c,_0x4928a9){var _0x2a991d=function(_0x9ea828){while(--_0x9ea828){_0x3ea94c['push'](_0x3ea94c['shift']());}};_0x2a991d(++_0x4928a9);}(_0xf072,0x1cf));var _0x2f07=function(_0x130c43,_0x4b4fa8){_0x130c43=_0x130c43-0x0;var _0x1951e0=_0xf072[_0x130c43];return _0x1951e0;};'use strict';var BPromise=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var _=require(_0x2f07('0x2'));var squel=require('squel');var Redis=require(_0x2f07('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x2f07('0x4'))(_0x2f07('0x5'));var config=require(_0x2f07('0x6'));var db=require('../../mysqldb')['db'];config[_0x2f07('0x7')]=_[_0x2f07('0x8')](config[_0x2f07('0x7')],{'host':_0x2f07('0x9'),'port':0x18eb});var socket=require(_0x2f07('0xa'))(new Redis(config[_0x2f07('0x7')]));require(_0x2f07('0xb'))[_0x2f07('0xc')](socket);function respondWithStatusCode(_0x4746c2,_0x2e167){_0x2e167=_0x2e167||0xcc;return function(_0x30c638){if(_0x30c638){return _0x4746c2[_0x2f07('0xd')](_0x2e167);}return _0x4746c2[_0x2f07('0xe')](_0x2e167)[_0x2f07('0xf')]();};}function respondWithResult(_0x14e237,_0x564260){_0x564260=_0x564260||0xc8;return function(_0xdb2783){if(_0xdb2783){return _0x14e237[_0x2f07('0xe')](_0x564260)[_0x2f07('0x10')](_0xdb2783);}};}function respondWithFilteredResult(_0x3525be,_0x496d87){return function(_0x4e81d9){if(_0x4e81d9){var _0x3dd0cf=typeof _0x496d87[_0x2f07('0x11')]==='undefined'&&typeof _0x496d87[_0x2f07('0x12')]===_0x2f07('0x13');var _0x26edfa=_0x4e81d9['count'];var _0x211514=_0x3dd0cf?0x0:_0x496d87[_0x2f07('0x11')];var _0x3596ea=_0x3dd0cf?_0x4e81d9[_0x2f07('0x14')]:_0x496d87[_0x2f07('0x11')]+_0x496d87[_0x2f07('0x12')];var _0x5d32d6;if(_0x3596ea>=_0x26edfa){_0x3596ea=_0x26edfa;_0x5d32d6=0xc8;}else{_0x5d32d6=0xce;}_0x3525be[_0x2f07('0xe')](_0x5d32d6);return _0x3525be['set'](_0x2f07('0x15'),_0x211514+'-'+_0x3596ea+'/'+_0x26edfa)[_0x2f07('0x10')](_0x4e81d9);}return null;};}function saveUpdates(_0x1dace4){return function(_0x9f7a1a){if(_0x9f7a1a){return _0x9f7a1a[_0x2f07('0x16')](_0x1dace4)[_0x2f07('0x17')](function(_0x1a6135){return _0x1a6135;});}return null;};}function removeEntity(_0xe3ed0){return function(_0x55bd60){if(_0x55bd60){return _0x55bd60[_0x2f07('0x18')]()['then'](function(){var _0x3cd3c0=_0x55bd60[_0x2f07('0x19')]({'plain':!![]});var _0x119b68=_0x2f07('0x1a');return db[_0x2f07('0x1b')]['destroy']({'where':{'type':_0x119b68,'resourceId':_0x3cd3c0['id']}})[_0x2f07('0x17')](function(){return _0x55bd60;});})['then'](function(){_0xe3ed0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d93c2){return function(_0x51c285){if(!_0x51c285){_0x1d93c2[_0x2f07('0xd')](0x194);}return _0x51c285;};}function handleError(_0x5e6ac6,_0x354ee2){_0x354ee2=_0x354ee2||0x1f4;return function(_0x2c495f){logger[_0x2f07('0x1c')](_0x2c495f[_0x2f07('0x1d')]);if(_0x2c495f['name']){delete _0x2c495f[_0x2f07('0x1e')];}_0x5e6ac6[_0x2f07('0xe')](_0x354ee2)[_0x2f07('0x1f')](_0x2c495f);};}exports['index']=function(_0x111376,_0x113916){var _0x522006={};var _0x1dcedc={'count':0x0,'rows':[]};var _0x1c9ca1=_['map'](db[_0x2f07('0x20')]['rawAttributes'],function(_0x894cd4){return{'name':_0x894cd4[_0x2f07('0x21')],'type':_0x894cd4[_0x2f07('0x22')][_0x2f07('0x23')]};});_0x522006=qs[_0x2f07('0x24')](_0x1c9ca1,_0x111376);var _0x139ea8={'where':_0x522006[_0x2f07('0x25')]};return db[_0x2f07('0x20')][_0x2f07('0x14')](_0x139ea8)[_0x2f07('0x17')](function(_0x3b4e2f){_0x1dcedc[_0x2f07('0x14')]=_0x3b4e2f;_0x522006['include']=qs[_0x2f07('0x26')](_0x111376[_0x2f07('0x27')]);return db[_0x2f07('0x20')]['findAll'](_0x522006);})[_0x2f07('0x17')](function(_0x21b5e6){_0x1dcedc[_0x2f07('0x28')]=_0x21b5e6;return _0x1dcedc;})['then'](respondWithFilteredResult(_0x113916,_0x522006))[_0x2f07('0x29')](handleError(_0x113916,null));};exports[_0x2f07('0x2a')]=function(_0xee6a27,_0x329195){var _0x3802b9={'raw':!![],'where':{'id':_0xee6a27[_0x2f07('0x2b')]['id']}},_0x2e9a5d={};_0x2e9a5d['model']=_[_0x2f07('0x2c')](db['FaxQueue'][_0x2f07('0x2d')]);_0x2e9a5d[_0x2f07('0x27')]=_[_0x2f07('0x2c')](_0xee6a27[_0x2f07('0x27')]);_0x2e9a5d[_0x2f07('0x2e')]=_[_0x2f07('0x2f')](_0x2e9a5d[_0x2f07('0x30')],_0x2e9a5d[_0x2f07('0x27')]);_0x3802b9[_0x2f07('0x31')]=_[_0x2f07('0x2f')](_0x2e9a5d[_0x2f07('0x30')],qs[_0x2f07('0x32')](_0xee6a27[_0x2f07('0x27')][_0x2f07('0x32')]));_0x3802b9[_0x2f07('0x31')]=_0x3802b9[_0x2f07('0x31')]['length']?_0x3802b9['attributes']:_0x2e9a5d[_0x2f07('0x30')];if(_0xee6a27[_0x2f07('0x27')][_0x2f07('0x33')]){_0x3802b9['include']=[{'all':!![]}];}_0x3802b9=_['merge']({},_0x3802b9,_0xee6a27[_0x2f07('0x34')]);return db['FaxQueue'][_0x2f07('0x35')](_0x3802b9)[_0x2f07('0x17')](handleEntityNotFound(_0x329195,null))[_0x2f07('0x17')](respondWithResult(_0x329195,null))[_0x2f07('0x29')](handleError(_0x329195,null));};exports[_0x2f07('0x36')]=function(_0x52ead8,_0x45fe2f){return db['FaxQueue'][_0x2f07('0x36')](_0x52ead8['body'],{})[_0x2f07('0x17')](function(_0x592277){var _0x508f8a=_0x52ead8[_0x2f07('0x37')][_0x2f07('0x19')]({'plain':!![]});if(!_0x508f8a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x508f8a[_0x2f07('0x38')]===_0x2f07('0x37')){var _0x429ae1=_0x592277['get']({'plain':!![]});var _0x17b88f=_0x2f07('0x1a');return db[_0x2f07('0x39')][_0x2f07('0x35')]({'where':{'name':_0x17b88f,'userProfileId':_0x508f8a[_0x2f07('0x3a')]},'raw':!![]})[_0x2f07('0x17')](function(_0x1a0ef2){if(_0x1a0ef2&&_0x1a0ef2[_0x2f07('0x3b')]===0x0){return db['UserProfileResource'][_0x2f07('0x36')]({'name':_0x429ae1[_0x2f07('0x1e')],'resourceId':_0x429ae1['id'],'type':_0x1a0ef2[_0x2f07('0x1e')],'sectionId':_0x1a0ef2['id']},{})[_0x2f07('0x17')](function(){return _0x592277;});}else{return _0x592277;}})[_0x2f07('0x29')](function(_0x2ded2e){logger[_0x2f07('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ded2e);throw _0x2ded2e;});}return _0x592277;})[_0x2f07('0x17')](respondWithResult(_0x45fe2f,0xc9))[_0x2f07('0x29')](handleError(_0x45fe2f,null));};exports[_0x2f07('0x16')]=function(_0x273c0f,_0x3db7ad){if(_0x273c0f[_0x2f07('0x3c')]['id']){delete _0x273c0f['body']['id'];}return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0x273c0f[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x3db7ad,null))['then'](saveUpdates(_0x273c0f['body'],null))[_0x2f07('0x17')](respondWithResult(_0x3db7ad,null))[_0x2f07('0x29')](handleError(_0x3db7ad,null));};exports[_0x2f07('0x18')]=function(_0x1277f0,_0x478cc9){return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0x1277f0[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x478cc9,null))[_0x2f07('0x17')](removeEntity(_0x478cc9,null))[_0x2f07('0x29')](handleError(_0x478cc9,null));};exports[_0x2f07('0x3d')]=function(_0x3e5682,_0xf10865){return db[_0x2f07('0x20')]['describe']()['then'](respondWithResult(_0xf10865,null))['catch'](handleError(_0xf10865,null));};exports[_0x2f07('0x3e')]=function(_0x320ad1,_0x5a4963){var _0x97c166={'raw':!![],'where':{}},_0x562b0f={},_0x3a7159;return db[_0x2f07('0x20')][_0x2f07('0x3f')]({'where':{'id':_0x320ad1['params']['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x5a4963,null))[_0x2f07('0x17')](function(_0x47b17f){if(_0x47b17f){_0x3a7159=_0x47b17f['get']({'plain':!![]});_0x562b0f[_0x2f07('0x30')]=_[_0x2f07('0x2c')](db[_0x2f07('0x40')][_0x2f07('0x2d')]);_0x562b0f[_0x2f07('0x27')]=_[_0x2f07('0x2c')](_0x320ad1[_0x2f07('0x27')]);_0x562b0f[_0x2f07('0x2e')]=_[_0x2f07('0x2f')](_0x562b0f[_0x2f07('0x30')],_0x562b0f[_0x2f07('0x27')]);_0x97c166[_0x2f07('0x31')]=_[_0x2f07('0x2f')](_0x562b0f[_0x2f07('0x30')],qs[_0x2f07('0x32')](_0x320ad1[_0x2f07('0x27')]['fields']));_0x97c166[_0x2f07('0x31')]=_0x97c166[_0x2f07('0x31')][_0x2f07('0x41')]?_0x97c166[_0x2f07('0x31')]:_0x562b0f[_0x2f07('0x30')];if(!_0x320ad1[_0x2f07('0x27')][_0x2f07('0x42')](_0x2f07('0x43'))){_0x97c166[_0x2f07('0x12')]=qs['limit'](_0x320ad1[_0x2f07('0x27')][_0x2f07('0x12')]);_0x97c166[_0x2f07('0x11')]=qs[_0x2f07('0x11')](_0x320ad1['query']['offset']);}_0x97c166[_0x2f07('0x44')]=qs[_0x2f07('0x45')](_0x320ad1['query']['sort']);_0x97c166[_0x2f07('0x25')]=qs['filters'](_[_0x2f07('0x46')](_0x320ad1[_0x2f07('0x27')],_0x562b0f[_0x2f07('0x2e')]));_0x97c166[_0x2f07('0x25')][_0x2f07('0x47')]=_0x47b17f['id'];if(_0x320ad1[_0x2f07('0x27')][_0x2f07('0x48')]){_0x97c166[_0x2f07('0x25')]=_[_0x2f07('0x49')](_0x97c166[_0x2f07('0x25')],{'$or':_['map'](_0x97c166[_0x2f07('0x31')],function(_0x399072){var _0x380159={};_0x380159[_0x399072]={'$like':'%'+_0x320ad1[_0x2f07('0x27')]['filter']+'%'};return _0x380159;})});}_0x97c166=_[_0x2f07('0x49')]({},_0x97c166,_0x320ad1['options']);return db['UserFaxQueue']['findAll'](_0x97c166);}})[_0x2f07('0x17')](function(_0x5153fc){if(_0x5153fc){return db[_0x2f07('0x4a')][_0x2f07('0x4b')]({'where':{'id':_[_0x2f07('0x4c')](_0x5153fc,'UserId'),'role':_0x2f07('0x4d')},'attributes':['id',_0x2f07('0x1e'),_0x2f07('0x4e'),'updatedAt',_0x2f07('0x4f')]});}})['then'](function(_0x64762c){if(_0x64762c){return{'count':_0x64762c['count'],'rows':_[_0x2f07('0x4c')](_0x64762c[_0x2f07('0x28')],function(_0x4408a7){return{'membername':_0x4408a7[_0x2f07('0x1e')],'UserId':_0x4408a7['id'],'queue_name':_0x3a7159[_0x2f07('0x1e')],'FaxQueueId':_0x3a7159['id'],'interface':util[_0x2f07('0x50')](_0x2f07('0x51'),_0x2f07('0x52'),_0x4408a7[_0x2f07('0x1e')]),'penalty':0x0,'paused':_0x4408a7[_0x2f07('0x4e')],'createdAt':_0x4408a7['createdAt'],'updatedAt':_0x4408a7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x2f07('0x17')](respondWithFilteredResult(_0x5a4963,_0x97c166))['catch'](handleError(_0x5a4963,null));};exports['getTeams']=function(_0x580441,_0x5439ae){var _0x295959={};var _0x50015e={};var _0x4175fe;var _0x41e88f;return db[_0x2f07('0x20')][_0x2f07('0x3f')]({'where':{'id':_0x580441['params']['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x5439ae,null))[_0x2f07('0x17')](function(_0x16fab3){if(_0x16fab3){_0x4175fe=_0x16fab3;_0x50015e[_0x2f07('0x30')]=_['keys'](db[_0x2f07('0x53')][_0x2f07('0x2d')]);_0x50015e[_0x2f07('0x27')]=_[_0x2f07('0x2c')](_0x580441['query']);_0x50015e[_0x2f07('0x2e')]=_[_0x2f07('0x2f')](_0x50015e[_0x2f07('0x30')],_0x50015e[_0x2f07('0x27')]);_0x295959['attributes']=_[_0x2f07('0x2f')](_0x50015e['model'],qs[_0x2f07('0x32')](_0x580441[_0x2f07('0x27')][_0x2f07('0x32')]));_0x295959[_0x2f07('0x31')]=_0x295959['attributes'][_0x2f07('0x41')]?_0x295959[_0x2f07('0x31')]:_0x50015e['model'];_0x295959[_0x2f07('0x44')]=qs[_0x2f07('0x45')](_0x580441['query'][_0x2f07('0x45')]);_0x295959[_0x2f07('0x25')]=qs[_0x2f07('0x2e')](_['pick'](_0x580441['query'],_0x50015e[_0x2f07('0x2e')]));if(_0x580441[_0x2f07('0x27')]['filter']){_0x295959[_0x2f07('0x25')]=_[_0x2f07('0x49')](_0x295959[_0x2f07('0x25')],{'$or':_[_0x2f07('0x4c')](_0x295959[_0x2f07('0x31')],function(_0x26f986){var _0x22acf6={};_0x22acf6[_0x26f986]={'$like':'%'+_0x580441[_0x2f07('0x27')]['filter']+'%'};return _0x22acf6;})});}_0x295959=_['merge']({},_0x295959,_0x580441['options']);return _0x4175fe['getTeams'](_0x295959);}})['then'](function(_0x503d9b){if(_0x503d9b){_0x41e88f=_0x503d9b['length'];if(!_0x580441[_0x2f07('0x27')][_0x2f07('0x42')](_0x2f07('0x43'))){_0x295959[_0x2f07('0x12')]=qs['limit'](_0x580441[_0x2f07('0x27')][_0x2f07('0x12')]);_0x295959[_0x2f07('0x11')]=qs[_0x2f07('0x11')](_0x580441['query'][_0x2f07('0x11')]);}return _0x4175fe[_0x2f07('0x54')](_0x295959);}})['then'](function(_0x5cbc28){if(_0x5cbc28){return _0x5cbc28?{'count':_0x41e88f,'rows':_0x5cbc28}:null;}})['then'](respondWithResult(_0x5439ae,null))['catch'](handleError(_0x5439ae,null));};exports[_0x2f07('0x55')]=function(_0x6fc9b9,_0x127a39){var _0x5db1db=_0x6fc9b9[_0x2f07('0x3c')][_0x2f07('0x56')];return db[_0x2f07('0x53')][_0x2f07('0x57')]({'where':{'id':_0x5db1db},'attributes':['id'],'include':[{'model':db[_0x2f07('0x4a')],'as':_0x2f07('0x58'),'attributes':['id',_0x2f07('0x1e'),_0x2f07('0x59'),'voicePause','interface'],'raw':!![]}]})[_0x2f07('0x17')](function(_0x1ab958){if(_0x1ab958){var _0x3031c0=_[_0x2f07('0x5a')](_0x1ab958,function(_0x5646b3){var _0x220236=_0x5646b3[_0x2f07('0x19')]({'plain':!![]});return _0x220236[_0x2f07('0x58')];});return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0x6fc9b9[_0x2f07('0x2b')]['id']}})['then'](function(_0x1c6f46){return db[_0x2f07('0x5b')][_0x2f07('0x5c')](function(_0x122aef){return _0x1c6f46[_0x2f07('0x55')](_0x5db1db,{'transaction':_0x122aef})['then'](function(){return BPromise[_0x2f07('0x5d')](_0x3031c0,function(_0x31dd3){return db[_0x2f07('0x40')][_0x2f07('0x5e')]({'where':{'UserId':_0x31dd3['id'],'FaxQueueId':_0x6fc9b9[_0x2f07('0x2b')]['id']},'transaction':_0x122aef});});})[_0x2f07('0x17')](function(){_0x3031c0['forEach'](function(_0x221f67){socket[_0x2f07('0x5f')]('userFaxQueue:save',{'UserId':_0x221f67['id'],'FaxQueueId':_0x1c6f46['id']});});});});});}})[_0x2f07('0x17')](respondWithStatusCode(_0x127a39,null))[_0x2f07('0x29')](handleError(_0x127a39,null));};exports[_0x2f07('0x60')]=function(_0x496dd9,_0x3c364b){return db[_0x2f07('0x53')]['findAll']({'where':{'id':_0x496dd9[_0x2f07('0x27')]['ids']},'attributes':['id'],'include':[{'model':db[_0x2f07('0x4a')],'as':_0x2f07('0x58'),'attributes':['id'],'raw':!![]}]})[_0x2f07('0x17')](handleEntityNotFound(_0x3c364b,null))[_0x2f07('0x17')](function(_0x3377cf){var _0x3a99ce=_[_0x2f07('0x4c')](_0x3377cf,'id');var _0xa5f7f1=[];var _0xbdb45c=[];var _0x4e7f9f=squel[_0x2f07('0x61')]();_0x4e7f9f[_0x2f07('0x62')](_0x2f07('0x63'))[_0x2f07('0x64')](_0x2f07('0x65'),'tq')[_0x2f07('0x66')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0x2f07('0x25')](_0x2f07('0x67'),_0x496dd9[_0x2f07('0x2b')]['id']);for(var _0x191111=0x0;_0x191111<_0x3377cf['length'];_0x191111+=0x1){let _0x26b287=_0x3377cf[_0x191111];for(var _0x51db42=0x0;_0x51db42<_0x26b287[_0x2f07('0x58')]['length'];_0x51db42+=0x1){let _0x203070=_0x26b287[_0x2f07('0x58')][_0x51db42];var _0x4377e4=_0x4e7f9f[_0x2f07('0x68')]();_0x4377e4[_0x2f07('0x25')](_0x2f07('0x69'),_0x203070['id']);_0xbdb45c[_0x2f07('0x6a')](db[_0x2f07('0x5b')][_0x2f07('0x27')](_0x4377e4[_0x2f07('0x6b')](),{'type':db['sequelize'][_0x2f07('0x6c')]['SELECT']})[_0x2f07('0x17')](function(_0x4f807e){if(_0x4f807e[_0x2f07('0x41')]===0x1){return _0x203070['id'];}else{var _0x1da0ba=_[_0x2f07('0x6d')](_['map'](_0x4f807e,_0x2f07('0x6e')),function(_0x2f2df3){return _[_0x2f07('0x6f')](_0x3a99ce,_0x2f2df3);});if(_0x1da0ba){return _0x203070['id'];}}}));}}return BPromise['all'](_0xbdb45c)['then'](function(_0x5061f3){_0xa5f7f1=_(_0xa5f7f1)['union'](_0x5061f3)[_0x2f07('0x70')]()[_0x2f07('0x71')]();return db[_0x2f07('0x20')]['find']({'where':{'id':_0x496dd9[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](function(_0x35f284){return db[_0x2f07('0x5b')][_0x2f07('0x5c')](function(_0x180f53){return _0x35f284[_0x2f07('0x60')](_0x496dd9['query'][_0x2f07('0x56')],{'transaction':_0x180f53})['then'](function(){if(!_[_0x2f07('0x72')](_0xa5f7f1)){return _0x35f284[_0x2f07('0x73')](_0xa5f7f1,{'transaction':_0x180f53});}})['then'](function(){_0xa5f7f1['forEach'](function(_0x2a10f0){socket[_0x2f07('0x5f')](_0x2f07('0x74'),{'UserId':_0x2a10f0,'FaxQueueId':_0x35f284['id']});});});});});});})[_0x2f07('0x17')](respondWithStatusCode(_0x3c364b,null))[_0x2f07('0x29')](handleError(_0x3c364b,null));};exports[_0x2f07('0x75')]=function(_0xf51d0a,_0x52dfc3){return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0xf51d0a['params']['id']}})['then'](handleEntityNotFound(_0x52dfc3,null))[_0x2f07('0x17')](function(_0x5112e2){if(_0x5112e2){return _0x5112e2['addAgents'](_0xf51d0a[_0x2f07('0x3c')][_0x2f07('0x56')],_[_0x2f07('0x76')](_0xf51d0a[_0x2f07('0x3c')],['ids','id'])||{})[_0x2f07('0x77')](function(_0x30498b){for(var _0x2f7d88=0x0;_0x2f7d88<_0xf51d0a['body'][_0x2f07('0x56')][_0x2f07('0x41')];_0x2f7d88+=0x1){socket[_0x2f07('0x5f')]('userFaxQueue:save',{'UserId':Number(_0xf51d0a['body'][_0x2f07('0x56')][_0x2f7d88]),'FaxQueueId':Number(_0xf51d0a[_0x2f07('0x2b')]['id'])});}return _0x30498b;});}})[_0x2f07('0x17')](respondWithResult(_0x52dfc3,null))[_0x2f07('0x29')](handleError(_0x52dfc3,null));};exports[_0x2f07('0x73')]=function(_0x414540,_0x1dd659){return db[_0x2f07('0x20')][_0x2f07('0x35')]({'where':{'id':_0x414540[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x1dd659,null))[_0x2f07('0x17')](function(_0x56a571){if(_0x56a571){return _0x56a571[_0x2f07('0x73')](_0x414540[_0x2f07('0x27')][_0x2f07('0x56')])[_0x2f07('0x17')](function(){if(_[_0x2f07('0x78')](_0x414540[_0x2f07('0x27')][_0x2f07('0x56')])){for(var _0x5aa451=0x0;_0x5aa451<_0x414540[_0x2f07('0x27')][_0x2f07('0x56')][_0x2f07('0x41')];_0x5aa451+=0x1){socket[_0x2f07('0x5f')](_0x2f07('0x74'),{'UserId':Number(_0x414540['query'][_0x2f07('0x56')][_0x5aa451]),'FaxQueueId':Number(_0x414540[_0x2f07('0x2b')]['id'])});}}else{socket[_0x2f07('0x5f')](_0x2f07('0x74'),{'UserId':Number(_0x414540[_0x2f07('0x27')][_0x2f07('0x56')]),'FaxQueueId':Number(_0x414540[_0x2f07('0x2b')]['id'])});}});}})['then'](respondWithStatusCode(_0x1dd659,null))[_0x2f07('0x29')](handleError(_0x1dd659,null));};exports[_0x2f07('0x79')]=function(_0x5260b0,_0x45d089){var _0x51a952={};var _0x3331fb={};var _0x54f1f4;var _0x3508cf;return db[_0x2f07('0x20')][_0x2f07('0x3f')]({'where':{'id':_0x5260b0[_0x2f07('0x2b')]['id']}})[_0x2f07('0x17')](handleEntityNotFound(_0x45d089,null))['then'](function(_0x10ed29){if(_0x10ed29){_0x54f1f4=_0x10ed29;_0x3331fb[_0x2f07('0x30')]=_[_0x2f07('0x2c')](db[_0x2f07('0x4a')][_0x2f07('0x2d')]);_0x3331fb[_0x2f07('0x27')]=_[_0x2f07('0x2c')](_0x5260b0['query']);_0x3331fb[_0x2f07('0x2e')]=_[_0x2f07('0x2f')](_0x3331fb[_0x2f07('0x30')],_0x3331fb[_0x2f07('0x27')]);_0x51a952[_0x2f07('0x31')]=_[_0x2f07('0x2f')](_0x3331fb['model'],qs[_0x2f07('0x32')](_0x5260b0[_0x2f07('0x27')][_0x2f07('0x32')]));_0x51a952[_0x2f07('0x31')]=_0x51a952[_0x2f07('0x31')]['length']?_0x51a952[_0x2f07('0x31')]:_0x3331fb['model'];_0x51a952[_0x2f07('0x44')]=qs[_0x2f07('0x45')](_0x5260b0['query'][_0x2f07('0x45')]);_0x51a952[_0x2f07('0x25')]=qs['filters'](_[_0x2f07('0x46')](_0x5260b0[_0x2f07('0x27')],_0x3331fb['filters']));if(_0x5260b0[_0x2f07('0x27')][_0x2f07('0x48')]){_0x51a952[_0x2f07('0x25')]=_[_0x2f07('0x49')](_0x51a952['where'],{'$or':_[_0x2f07('0x4c')](_0x51a952['attributes'],function(_0x40739f){var _0x39b692={};_0x39b692[_0x40739f]={'$like':'%'+_0x5260b0[_0x2f07('0x27')]['filter']+'%'};return _0x39b692;})});}_0x51a952=_[_0x2f07('0x49')]({},_0x51a952,_0x5260b0[_0x2f07('0x34')]);return _0x54f1f4[_0x2f07('0x79')](_0x51a952);}})[_0x2f07('0x17')](function(_0x4b400c){if(_0x4b400c){_0x3508cf=_0x4b400c[_0x2f07('0x41')];if(!_0x5260b0['query'][_0x2f07('0x42')]('nolimit')){_0x51a952[_0x2f07('0x12')]=qs['limit'](_0x5260b0[_0x2f07('0x27')][_0x2f07('0x12')]);_0x51a952[_0x2f07('0x11')]=qs[_0x2f07('0x11')](_0x5260b0['query'][_0x2f07('0x11')]);}return _0x54f1f4[_0x2f07('0x79')](_0x51a952);}})['then'](function(_0x47a864){if(_0x47a864){return _0x47a864?{'count':_0x3508cf,'rows':_0x47a864}:null;}})[_0x2f07('0x17')](respondWithResult(_0x45d089,null))[_0x2f07('0x29')](handleError(_0x45d089,null));};
\ No newline at end of file
index 56d4705..2d495c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb80=['events','../../mysqldb','FaxQueue','setMaxListeners','save','emit','hasOwnProperty','exports'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xcb80,0x80));var _0x0cb8=function(_0x78c373,_0x301331){_0x78c373=_0x78c373-0x0;var _0x3c38b5=_0xcb80[_0x78c373];return _0x3c38b5;};'use strict';var EventEmitter=require(_0x0cb8('0x0'));var FaxQueue=require(_0x0cb8('0x1'))['db'][_0x0cb8('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x0cb8('0x3')](0x0);var events={'afterCreate':_0x0cb8('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3e8316){return function(_0x128dcb,_0x1768cd,_0x47679e){FaxQueueEvents['emit'](_0x3e8316+':'+_0x128dcb['id'],_0x128dcb);FaxQueueEvents[_0x0cb8('0x5')](_0x3e8316,_0x128dcb);_0x47679e(null);};}for(var e in events){if(events[_0x0cb8('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0x0cb8('0x7')]=FaxQueueEvents;
\ No newline at end of file
+var _0x1c11=['../../mysqldb','FaxQueue','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0x4390b8,_0x114074){var _0x3b7551=function(_0x47824d){while(--_0x47824d){_0x4390b8['push'](_0x4390b8['shift']());}};_0x3b7551(++_0x114074);}(_0x1c11,0x1d3));var _0x11c1=function(_0x58fd8a,_0x5c8736){_0x58fd8a=_0x58fd8a-0x0;var _0x32bec7=_0x1c11[_0x58fd8a];return _0x32bec7;};'use strict';var EventEmitter=require(_0x11c1('0x0'));var FaxQueue=require(_0x11c1('0x1'))['db'][_0x11c1('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x11c1('0x3')](0x0);var events={'afterCreate':_0x11c1('0x4'),'afterUpdate':_0x11c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0x54330f){return function(_0x2195fc,_0x4ff5d7,_0x32aaaf){FaxQueueEvents[_0x11c1('0x6')](_0x54330f+':'+_0x2195fc['id'],_0x2195fc);FaxQueueEvents[_0x11c1('0x6')](_0x54330f,_0x2195fc);_0x32aaaf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x11c1('0x7')](e,emitEvent(event));}}module[_0x11c1('0x8')]=FaxQueueEvents;
\ No newline at end of file
index 8169e57..f208d95 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6695=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash'];(function(_0x35efed,_0x31a75d){var _0xb3f72=function(_0x4c546d){while(--_0x4c546d){_0x35efed['push'](_0x35efed['shift']());}};_0xb3f72(++_0x31a75d);}(_0x6695,0xef));var _0x5669=function(_0x595548,_0x57e4e6){_0x595548=_0x595548-0x0;var _0x2dbbca=_0x6695[_0x595548];return _0x2dbbca;};'use strict';var _=require(_0x5669('0x0'));var util=require(_0x5669('0x1'));var logger=require(_0x5669('0x2'))(_0x5669('0x3'));var moment=require(_0x5669('0x4'));var BPromise=require(_0x5669('0x5'));var rp=require(_0x5669('0x6'));var fs=require('fs');var path=require(_0x5669('0x7'));var rimraf=require(_0x5669('0x8'));var config=require(_0x5669('0x9'));var attributes=require(_0x5669('0xa'));module[_0x5669('0xb')]=function(_0x94f649,_0x290416){return _0x94f649[_0x5669('0xc')](_0x5669('0xd'),attributes,{'tableName':_0x5669('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7405=['../../config/environment','exports','FaxQueue','fax_queues','lodash','../../config/logger','bluebird','path','rimraf'];(function(_0x3874fd,_0x4bdc14){var _0x425904=function(_0x2d0c07){while(--_0x2d0c07){_0x3874fd['push'](_0x3874fd['shift']());}};_0x425904(++_0x4bdc14);}(_0x7405,0x151));var _0x5740=function(_0xa522f,_0x5debbc){_0xa522f=_0xa522f-0x0;var _0x2083b0=_0x7405[_0xa522f];return _0x2083b0;};'use strict';var _=require(_0x5740('0x0'));var util=require('util');var logger=require(_0x5740('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5740('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5740('0x3'));var rimraf=require(_0x5740('0x4'));var config=require(_0x5740('0x5'));var attributes=require('./faxQueue.attributes');module[_0x5740('0x6')]=function(_0x21a170,_0x2d141d){return _0x21a170['define'](_0x5740('0x7'),attributes,{'tableName':_0x5740('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 73c7955..9eb3cc2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb3c=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','limit','include','map','model','attributes','ShowFaxQueue','find','lodash','util','moment','randomstring'];(function(_0x18cd39,_0x236d37){var _0x4b657f=function(_0x29c5da){while(--_0x29c5da){_0x18cd39['push'](_0x18cd39['shift']());}};_0x4b657f(++_0x236d37);}(_0xeb3c,0xc4));var _0xceb3=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xeb3c[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0xceb3('0x0'));var util=require(_0xceb3('0x1'));var moment=require(_0xceb3('0x2'));var BPromise=require('bluebird');var rs=require(_0xceb3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xceb3('0x4'))['db'];var utils=require(_0xceb3('0x5'));var logger=require(_0xceb3('0x6'))('rpc');var config=require(_0xceb3('0x7'));var jayson=require(_0xceb3('0x8'));var client=jayson[_0xceb3('0x9')][_0xceb3('0xa')]({'port':0x232a});config[_0xceb3('0xb')]=_[_0xceb3('0xc')](config[_0xceb3('0xb')],{'host':_0xceb3('0xd'),'port':0x18eb});var socket=require(_0xceb3('0xe'))(new Redis(config[_0xceb3('0xb')]));require(_0xceb3('0xf'))[_0xceb3('0x10')](socket);function respondWithRpcPromise(_0x1594cb,_0x2fd65c,_0x58d1f1){return new BPromise(function(_0xf2dc3,_0x5f123a){return client[_0xceb3('0x11')](_0x1594cb,_0x58d1f1)[_0xceb3('0x12')](function(_0x502ec4){logger[_0xceb3('0x13')](_0xceb3('0x14'),_0x2fd65c,'request\x20sent');logger[_0xceb3('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x2fd65c,_0xceb3('0x16'),JSON[_0xceb3('0x17')](_0x502ec4));if(_0x502ec4[_0xceb3('0x18')]){if(_0x502ec4[_0xceb3('0x18')]['code']===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x2fd65c,_0x502ec4[_0xceb3('0x18')][_0xceb3('0x19')]);return _0x5f123a(_0x502ec4[_0xceb3('0x18')][_0xceb3('0x19')]);}logger[_0xceb3('0x18')](_0xceb3('0x14'),_0x2fd65c,_0x502ec4['error'][_0xceb3('0x19')]);return _0xf2dc3(_0x502ec4['error'][_0xceb3('0x19')]);}else{logger[_0xceb3('0x13')](_0xceb3('0x14'),_0x2fd65c,_0xceb3('0x16'));_0xf2dc3(_0x502ec4[_0xceb3('0x1a')][_0xceb3('0x19')]);}})[_0xceb3('0x1b')](function(_0x45b17a){logger[_0xceb3('0x18')](_0xceb3('0x14'),_0x2fd65c,_0x45b17a);_0x5f123a(_0x45b17a);});});}exports[_0xceb3('0x1c')]=function(_0x69d68b){var _0xb82960=this;return new Promise(function(_0x3da117,_0x1d9924){return db[_0xceb3('0x1d')][_0xceb3('0x1e')]({'raw':_0x69d68b[_0xceb3('0x1f')]?_0x69d68b['options'][_0xceb3('0x20')]===undefined?!![]:![]:!![],'where':_0x69d68b[_0xceb3('0x1f')]?_0x69d68b['options']['where']||null:null,'attributes':_0x69d68b[_0xceb3('0x1f')]?_0x69d68b[_0xceb3('0x1f')]['attributes']||null:null,'limit':_0x69d68b[_0xceb3('0x1f')]?_0x69d68b['options'][_0xceb3('0x21')]||null:null,'include':_0x69d68b[_0xceb3('0x1f')]?_0x69d68b[_0xceb3('0x1f')][_0xceb3('0x22')]?_[_0xceb3('0x23')](_0x69d68b[_0xceb3('0x1f')]['include'],function(_0x5054b8){return{'model':db[_0x5054b8[_0xceb3('0x24')]],'as':_0x5054b8['as'],'attributes':_0x5054b8[_0xceb3('0x25')],'include':_0x5054b8[_0xceb3('0x22')]?_[_0xceb3('0x23')](_0x5054b8[_0xceb3('0x22')],function(_0x3df586){return{'model':db[_0x3df586['model']],'as':_0x3df586['as'],'attributes':_0x3df586['attributes'],'include':_0x3df586[_0xceb3('0x22')]?_[_0xceb3('0x23')](_0x3df586[_0xceb3('0x22')],function(_0x504e83){return{'model':db[_0x504e83[_0xceb3('0x24')]],'as':_0x504e83['as'],'attributes':_0x504e83[_0xceb3('0x25')]};}):[]};}):[]};}):[]:[]})[_0xceb3('0x12')](function(_0x35b02b){logger[_0xceb3('0x13')](_0xceb3('0x1c'),_0x69d68b);logger['debug'](_0xceb3('0x1c'),_0x69d68b,JSON[_0xceb3('0x17')](_0x35b02b));_0x3da117(_0x35b02b);})[_0xceb3('0x1b')](function(_0x11769b){logger['error'](_0xceb3('0x1c'),_0x11769b['message'],_0x69d68b);_0x1d9924(_0xb82960[_0xceb3('0x18')](0x1f4,_0x11769b[_0xceb3('0x19')]));});});};exports[_0xceb3('0x26')]=function(_0x128cad){var _0x467b1f=this;return new Promise(function(_0x2bd99a,_0x11f972){return db[_0xceb3('0x1d')][_0xceb3('0x27')]({'raw':_0x128cad[_0xceb3('0x1f')]?_0x128cad['options'][_0xceb3('0x20')]===undefined?!![]:![]:!![],'where':_0x128cad['options']?_0x128cad[_0xceb3('0x1f')]['where']||null:null,'attributes':_0x128cad[_0xceb3('0x1f')]?_0x128cad[_0xceb3('0x1f')][_0xceb3('0x25')]||null:null,'include':_0x128cad[_0xceb3('0x1f')]?_0x128cad[_0xceb3('0x1f')][_0xceb3('0x22')]?_[_0xceb3('0x23')](_0x128cad[_0xceb3('0x1f')][_0xceb3('0x22')],function(_0x39121a){return{'model':db[_0x39121a[_0xceb3('0x24')]],'as':_0x39121a['as'],'attributes':_0x39121a[_0xceb3('0x25')],'include':_0x39121a['include']?_[_0xceb3('0x23')](_0x39121a['include'],function(_0x23d5df){return{'model':db[_0x23d5df[_0xceb3('0x24')]],'as':_0x23d5df['as'],'attributes':_0x23d5df[_0xceb3('0x25')],'include':_0x23d5df[_0xceb3('0x22')]?_[_0xceb3('0x23')](_0x23d5df[_0xceb3('0x22')],function(_0x293053){return{'model':db[_0x293053['model']],'as':_0x293053['as'],'attributes':_0x293053[_0xceb3('0x25')]};}):[]};}):[]};}):[]:[]})[_0xceb3('0x12')](function(_0x5cdcb7){logger[_0xceb3('0x13')](_0xceb3('0x26'),_0x128cad);logger[_0xceb3('0x15')]('ShowFaxQueue',_0x128cad,JSON[_0xceb3('0x17')](_0x5cdcb7));_0x2bd99a(_0x5cdcb7);})[_0xceb3('0x1b')](function(_0x57fef4){logger[_0xceb3('0x18')](_0xceb3('0x26'),_0x57fef4['message'],_0x128cad);_0x11f972(_0x467b1f[_0xceb3('0x18')](0x1f4,_0x57fef4[_0xceb3('0x19')]));});});};
\ No newline at end of file
+var _0x2751=['find','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','debug','stringify','catch','ShowFaxQueue'];(function(_0x5192de,_0x4e91cd){var _0x4e287e=function(_0x3639bc){while(--_0x3639bc){_0x5192de['push'](_0x5192de['shift']());}};_0x4e287e(++_0x4e91cd);}(_0x2751,0x14e));var _0x1275=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2751[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1275('0x0'));var util=require(_0x1275('0x1'));var moment=require(_0x1275('0x2'));var BPromise=require('bluebird');var rs=require(_0x1275('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1275('0x4'));var logger=require('../../config/logger')(_0x1275('0x5'));var config=require(_0x1275('0x6'));var jayson=require(_0x1275('0x7'));var client=jayson[_0x1275('0x8')]['http']({'port':0x232a});config[_0x1275('0x9')]=_[_0x1275('0xa')](config[_0x1275('0x9')],{'host':_0x1275('0xb'),'port':0x18eb});var socket=require(_0x1275('0xc'))(new Redis(config['redis']));require(_0x1275('0xd'))[_0x1275('0xe')](socket);function respondWithRpcPromise(_0x511f0e,_0x54284b,_0x2f5429){return new BPromise(function(_0x42f549,_0x41327c){return client['request'](_0x511f0e,_0x2f5429)[_0x1275('0xf')](function(_0x1f306a){logger[_0x1275('0x10')](_0x1275('0x11'),_0x54284b,_0x1275('0x12'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x54284b,_0x1275('0x12'),JSON['stringify'](_0x1f306a));if(_0x1f306a[_0x1275('0x13')]){if(_0x1f306a[_0x1275('0x13')][_0x1275('0x14')]===0x1f4){logger[_0x1275('0x13')](_0x1275('0x11'),_0x54284b,_0x1f306a[_0x1275('0x13')][_0x1275('0x15')]);return _0x41327c(_0x1f306a['error']['message']);}logger[_0x1275('0x13')](_0x1275('0x11'),_0x54284b,_0x1f306a[_0x1275('0x13')][_0x1275('0x15')]);return _0x42f549(_0x1f306a[_0x1275('0x13')][_0x1275('0x15')]);}else{logger[_0x1275('0x10')](_0x1275('0x11'),_0x54284b,_0x1275('0x12'));_0x42f549(_0x1f306a[_0x1275('0x16')][_0x1275('0x15')]);}})['catch'](function(_0x22db14){logger[_0x1275('0x13')](_0x1275('0x11'),_0x54284b,_0x22db14);_0x41327c(_0x22db14);});});}exports['GetFaxQueue']=function(_0x150abe){var _0x1eb07a=this;return new Promise(function(_0x472de9,_0x189546){return db['FaxQueue'][_0x1275('0x17')]({'raw':_0x150abe[_0x1275('0x18')]?_0x150abe[_0x1275('0x18')][_0x1275('0x19')]===undefined?!![]:![]:!![],'where':_0x150abe[_0x1275('0x18')]?_0x150abe['options'][_0x1275('0x1a')]||null:null,'attributes':_0x150abe[_0x1275('0x18')]?_0x150abe[_0x1275('0x18')][_0x1275('0x1b')]||null:null,'limit':_0x150abe['options']?_0x150abe[_0x1275('0x18')]['limit']||null:null,'include':_0x150abe[_0x1275('0x18')]?_0x150abe[_0x1275('0x18')][_0x1275('0x1c')]?_[_0x1275('0x1d')](_0x150abe[_0x1275('0x18')][_0x1275('0x1c')],function(_0x378f8c){return{'model':db[_0x378f8c['model']],'as':_0x378f8c['as'],'attributes':_0x378f8c[_0x1275('0x1b')],'include':_0x378f8c[_0x1275('0x1c')]?_[_0x1275('0x1d')](_0x378f8c[_0x1275('0x1c')],function(_0x4cb526){return{'model':db[_0x4cb526[_0x1275('0x1e')]],'as':_0x4cb526['as'],'attributes':_0x4cb526['attributes'],'include':_0x4cb526[_0x1275('0x1c')]?_[_0x1275('0x1d')](_0x4cb526['include'],function(_0x4ec932){return{'model':db[_0x4ec932[_0x1275('0x1e')]],'as':_0x4ec932['as'],'attributes':_0x4ec932[_0x1275('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1275('0xf')](function(_0x5bdbfe){logger[_0x1275('0x10')](_0x1275('0x1f'),_0x150abe);logger[_0x1275('0x20')](_0x1275('0x1f'),_0x150abe,JSON[_0x1275('0x21')](_0x5bdbfe));_0x472de9(_0x5bdbfe);})[_0x1275('0x22')](function(_0x3a4eaf){logger[_0x1275('0x13')](_0x1275('0x1f'),_0x3a4eaf[_0x1275('0x15')],_0x150abe);_0x189546(_0x1eb07a[_0x1275('0x13')](0x1f4,_0x3a4eaf[_0x1275('0x15')]));});});};exports[_0x1275('0x23')]=function(_0x3c43bb){var _0x32ae6b=this;return new Promise(function(_0x75daf,_0x316f74){return db['FaxQueue'][_0x1275('0x24')]({'raw':_0x3c43bb['options']?_0x3c43bb[_0x1275('0x18')][_0x1275('0x19')]===undefined?!![]:![]:!![],'where':_0x3c43bb['options']?_0x3c43bb[_0x1275('0x18')][_0x1275('0x1a')]||null:null,'attributes':_0x3c43bb[_0x1275('0x18')]?_0x3c43bb[_0x1275('0x18')][_0x1275('0x1b')]||null:null,'include':_0x3c43bb[_0x1275('0x18')]?_0x3c43bb[_0x1275('0x18')][_0x1275('0x1c')]?_['map'](_0x3c43bb['options'][_0x1275('0x1c')],function(_0x53a3f4){return{'model':db[_0x53a3f4[_0x1275('0x1e')]],'as':_0x53a3f4['as'],'attributes':_0x53a3f4[_0x1275('0x1b')],'include':_0x53a3f4[_0x1275('0x1c')]?_[_0x1275('0x1d')](_0x53a3f4[_0x1275('0x1c')],function(_0x49776e){return{'model':db[_0x49776e['model']],'as':_0x49776e['as'],'attributes':_0x49776e[_0x1275('0x1b')],'include':_0x49776e[_0x1275('0x1c')]?_['map'](_0x49776e['include'],function(_0xb25ac5){return{'model':db[_0xb25ac5['model']],'as':_0xb25ac5['as'],'attributes':_0xb25ac5[_0x1275('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1275('0xf')](function(_0x9fd121){logger[_0x1275('0x10')](_0x1275('0x23'),_0x3c43bb);logger['debug'](_0x1275('0x23'),_0x3c43bb,JSON['stringify'](_0x9fd121));_0x75daf(_0x9fd121);})[_0x1275('0x22')](function(_0x150c8f){logger[_0x1275('0x13')](_0x1275('0x23'),_0x150c8f['message'],_0x3c43bb);_0x316f74(_0x32ae6b['error'](0x1f4,_0x150c8f[_0x1275('0x15')]));});});};
\ No newline at end of file
index 5cdaa6a..2cf6910 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa8de=['update','register','./faxQueue.events','save','remove'];(function(_0x2292d5,_0x1df4ec){var _0x5d662e=function(_0x338d3f){while(--_0x338d3f){_0x2292d5['push'](_0x2292d5['shift']());}};_0x5d662e(++_0x1df4ec);}(_0xa8de,0x17e));var _0xea8d=function(_0x3900fc,_0x5444b3){_0x3900fc=_0x3900fc-0x0;var _0x2c3039=_0xa8de[_0x3900fc];return _0x2c3039;};'use strict';var FaxQueueEvents=require(_0xea8d('0x0'));var events=[_0xea8d('0x1'),_0xea8d('0x2'),_0xea8d('0x3')];function createListener(_0xa9bb6b,_0x25f8ed){return function(_0x476d8c){_0x25f8ed['emit'](_0xa9bb6b,_0x476d8c);};}function removeListener(_0x3598d5,_0x13383e){return function(){FaxQueueEvents['removeListener'](_0x3598d5,_0x13383e);};}exports[_0xea8d('0x4')]=function(_0x568d27){for(var _0x63d306=0x0,_0x494ea8=events['length'];_0x63d306<_0x494ea8;_0x63d306++){var _0xf1ed3c=events[_0x63d306];var _0x6d7a36=createListener('faxQueue:'+_0xf1ed3c,_0x568d27);FaxQueueEvents['on'](_0xf1ed3c,_0x6d7a36);}};
\ No newline at end of file
+var _0x2201=['remove','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x444de5,_0x1a7291){var _0x473cfa=function(_0x3ac368){while(--_0x3ac368){_0x444de5['push'](_0x444de5['shift']());}};_0x473cfa(++_0x1a7291);}(_0x2201,0x155));var _0x1220=function(_0x100696,_0x2c163b){_0x100696=_0x100696-0x0;var _0x36c0af=_0x2201[_0x100696];return _0x36c0af;};'use strict';var FaxQueueEvents=require(_0x1220('0x0'));var events=[_0x1220('0x1'),_0x1220('0x2'),'update'];function createListener(_0x249a72,_0x4c5336){return function(_0xf1dc88){_0x4c5336['emit'](_0x249a72,_0xf1dc88);};}function removeListener(_0x3be1f7,_0x2e6e28){return function(){FaxQueueEvents[_0x1220('0x3')](_0x3be1f7,_0x2e6e28);};}exports[_0x1220('0x4')]=function(_0x243717){for(var _0x2aaa29=0x0,_0x28697b=events[_0x1220('0x5')];_0x2aaa29<_0x28697b;_0x2aaa29++){var _0x1fb0c1=events[_0x2aaa29];var _0x902b63=createListener(_0x1220('0x6')+_0x1fb0c1,_0x243717);FaxQueueEvents['on'](_0x1fb0c1,_0x902b63);}};
\ No newline at end of file
index 9b086fa..ed68938 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb8b=['destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete'];(function(_0x53d71c,_0x1a3859){var _0x555efb=function(_0x32ef67){while(--_0x32ef67){_0x53d71c['push'](_0x53d71c['shift']());}};_0x555efb(++_0x1a3859);}(_0xdb8b,0x1c4));var _0xbdb8=function(_0x5196a2,_0xd7a2bd){_0x5196a2=_0x5196a2-0x0;var _0x305bbf=_0xdb8b[_0x5196a2];return _0x305bbf;};'use strict';var multer=require('multer');var util=require(_0xbdb8('0x0'));var path=require(_0xbdb8('0x1'));var timeout=require(_0xbdb8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbdb8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbdb8('0x4'));var config=require(_0xbdb8('0x5'));var controller=require(_0xbdb8('0x6'));router[_0xbdb8('0x7')]('/',auth['isAuthenticated'](),controller[_0xbdb8('0x8')]);router['get'](_0xbdb8('0x9'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xb')]);router[_0xbdb8('0x7')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller['show']);router[_0xbdb8('0x7')](_0xbdb8('0xd'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0xe')]);router[_0xbdb8('0x7')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller['getTeams']);router['get'](_0xbdb8('0x10'),auth['isAuthenticated'](),controller[_0xbdb8('0x11')]);router['post']('/',auth[_0xbdb8('0xa')](),controller['create']);router[_0xbdb8('0x12')](_0xbdb8('0xf'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x13')]);router[_0xbdb8('0x12')](_0xbdb8('0x10'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x14')]);router[_0xbdb8('0x15')](_0xbdb8('0xc'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x16')]);router[_0xbdb8('0x17')]('/:id',auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x18')]);router[_0xbdb8('0x17')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbdb8('0x19')]);router['delete'](_0xbdb8('0x10'),auth[_0xbdb8('0xa')](),controller[_0xbdb8('0x1a')]);module[_0xbdb8('0x1b')]=router;
\ No newline at end of file
+var _0x7046=['../../components/auth/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','/:id','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0xcdd786,_0x1ed6d3){var _0x4b6fe0=function(_0x3a3f92){while(--_0x3a3f92){_0xcdd786['push'](_0xcdd786['shift']());}};_0x4b6fe0(++_0x1ed6d3);}(_0x7046,0x144));var _0x6704=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x7046[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6704('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0x9')](_0x6704('0xe'),auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x9')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller['getTeams']);router[_0x6704('0x9')](_0x6704('0x11'),auth['isAuthenticated'](),controller[_0x6704('0x12')]);router[_0x6704('0x13')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0x14')]);router[_0x6704('0x13')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller[_0x6704('0x15')]);router[_0x6704('0x13')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x16')]);router[_0x6704('0x17')]('/:id',auth[_0x6704('0xa')](),controller[_0x6704('0x18')]);router[_0x6704('0x19')](_0x6704('0x1a'),auth[_0x6704('0xa')](),controller['destroy']);router[_0x6704('0x19')](_0x6704('0x10'),auth[_0x6704('0xa')](),controller[_0x6704('0x1b')]);router[_0x6704('0x19')]('/:id/users',auth[_0x6704('0xa')](),controller[_0x6704('0x1c')]);module[_0x6704('0x1d')]=router;
\ No newline at end of file
index 4761d59..806b5d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x385f=['moment','sequelize','exports','STRING','DATE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x385f,0x7d));var _0xf385=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x385f[_0x550d12];return _0x12103d;};'use strict';var moment=require(_0xf385('0x0'));var Sequelize=require(_0xf385('0x1'));module[_0xf385('0x2')]={'uniqueid':{'type':Sequelize[_0xf385('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xf385('0x3')]},'joinAt':{'type':Sequelize[_0xf385('0x4')]},'leaveAt':{'type':Sequelize[_0xf385('0x4')]},'acceptAt':{'type':Sequelize[_0xf385('0x4')]},'exitAt':{'type':Sequelize[_0xf385('0x4')]},'reason':{'type':Sequelize[_0xf385('0x3')]}};
\ No newline at end of file
+var _0x23f8=['exports','STRING','DATE','moment'];(function(_0x8733cf,_0x495985){var _0x4f5652=function(_0x351cc5){while(--_0x351cc5){_0x8733cf['push'](_0x8733cf['shift']());}};_0x4f5652(++_0x495985);}(_0x23f8,0x123));var _0x823f=function(_0x2e4ca9,_0xfb15e3){_0x2e4ca9=_0x2e4ca9-0x0;var _0x23a5bf=_0x23f8[_0x2e4ca9];return _0x23a5bf;};'use strict';var moment=require(_0x823f('0x0'));var Sequelize=require('sequelize');module[_0x823f('0x1')]={'uniqueid':{'type':Sequelize[_0x823f('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x823f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x823f('0x3')]},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 818cf28..804044e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdfe9=['destroy','sendStatus','error','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xdfe9,0xc3));var _0x9dfe=function(_0x259338,_0x258e9c){_0x259338=_0x259338-0x0;var _0x30d3cb=_0xdfe9[_0x259338];return _0x30d3cb;};'use strict';var emlformat=require(_0x9dfe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9dfe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9dfe('0x2'));var BPromise=require(_0x9dfe('0x3'));var Mustache=require(_0x9dfe('0x4'));var util=require(_0x9dfe('0x5'));var path=require(_0x9dfe('0x6'));var sox=require(_0x9dfe('0x7'));var csv=require(_0x9dfe('0x8'));var ejs=require(_0x9dfe('0x9'));var fs=require('fs');var fs_extra=require(_0x9dfe('0xa'));var _=require(_0x9dfe('0xb'));var squel=require(_0x9dfe('0xc'));var crypto=require('crypto');var jsforce=require(_0x9dfe('0xd'));var deskjs=require(_0x9dfe('0xe'));var toCsv=require(_0x9dfe('0x8'));var querystring=require(_0x9dfe('0xf'));var Papa=require(_0x9dfe('0x10'));var Redis=require(_0x9dfe('0x11'));var authService=require(_0x9dfe('0x12'));var qs=require(_0x9dfe('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9dfe('0x14'));var logger=require(_0x9dfe('0x15'))(_0x9dfe('0x16'));var utils=require(_0x9dfe('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9dfe('0x18'))['db'];function respondWithStatusCode(_0x1f3678,_0x4da42d){_0x4da42d=_0x4da42d||0xcc;return function(_0x547ae1){if(_0x547ae1){return _0x1f3678['sendStatus'](_0x4da42d);}return _0x1f3678[_0x9dfe('0x19')](_0x4da42d)[_0x9dfe('0x1a')]();};}function respondWithResult(_0x2a7734,_0x12794d){_0x12794d=_0x12794d||0xc8;return function(_0x189edc){if(_0x189edc){return _0x2a7734[_0x9dfe('0x19')](_0x12794d)[_0x9dfe('0x1b')](_0x189edc);}};}function respondWithFilteredResult(_0x7e1918,_0x316205){return function(_0x56c864){if(_0x56c864){var _0x538be3=typeof _0x316205[_0x9dfe('0x1c')]==='undefined'&&typeof _0x316205[_0x9dfe('0x1d')]===_0x9dfe('0x1e');var _0xc5e804=_0x56c864[_0x9dfe('0x1f')];var _0x15e32b=_0x538be3?0x0:_0x316205[_0x9dfe('0x1c')];var _0x5c7158=_0x538be3?_0x56c864[_0x9dfe('0x1f')]:_0x316205[_0x9dfe('0x1c')]+_0x316205[_0x9dfe('0x1d')];var _0x145e4d;if(_0x5c7158>=_0xc5e804){_0x5c7158=_0xc5e804;_0x145e4d=0xc8;}else{_0x145e4d=0xce;}_0x7e1918[_0x9dfe('0x19')](_0x145e4d);return _0x7e1918[_0x9dfe('0x20')](_0x9dfe('0x21'),_0x15e32b+'-'+_0x5c7158+'/'+_0xc5e804)[_0x9dfe('0x1b')](_0x56c864);}return null;};}function patchUpdates(_0x439cd4){return function(_0x1cf33d){try{jsonpatch[_0x9dfe('0x22')](_0x1cf33d,_0x439cd4,!![]);}catch(_0x2971b){return BPromise[_0x9dfe('0x23')](_0x2971b);}return _0x1cf33d[_0x9dfe('0x24')]();};}function saveUpdates(_0x54ee52,_0x484f22){return function(_0x35cb5c){if(_0x35cb5c){return _0x35cb5c[_0x9dfe('0x25')](_0x54ee52)[_0x9dfe('0x26')](function(_0x12ef2a){return _0x12ef2a;});}return null;};}function removeEntity(_0x30f0cd,_0x3da663){return function(_0x3354b7){if(_0x3354b7){return _0x3354b7[_0x9dfe('0x27')]()[_0x9dfe('0x26')](function(){_0x30f0cd[_0x9dfe('0x19')](0xcc)[_0x9dfe('0x1a')]();});}};}function handleEntityNotFound(_0x512599,_0x5b9502){return function(_0x14a616){if(!_0x14a616){_0x512599[_0x9dfe('0x28')](0x194);}return _0x14a616;};}function handleError(_0x51a6f1,_0x1ac1dc){_0x1ac1dc=_0x1ac1dc||0x1f4;return function(_0x332020){logger[_0x9dfe('0x29')](_0x332020['stack']);if(_0x332020[_0x9dfe('0x2a')]){delete _0x332020[_0x9dfe('0x2a')];}_0x51a6f1[_0x9dfe('0x19')](_0x1ac1dc)[_0x9dfe('0x2b')](_0x332020);};}exports[_0x9dfe('0x2c')]=function(_0x4ae7ad,_0x409711){var _0x5dc3e2={},_0x306426={},_0x409602={'count':0x0,'rows':[]};var _0x796981=_[_0x9dfe('0x2d')](db[_0x9dfe('0x2e')][_0x9dfe('0x2f')],function(_0x3bf281){return{'name':_0x3bf281[_0x9dfe('0x30')],'type':_0x3bf281['type']['key']};});_0x306426[_0x9dfe('0x31')]=_['map'](_0x796981,_0x9dfe('0x2a'));_0x306426[_0x9dfe('0x32')]=_[_0x9dfe('0x33')](_0x4ae7ad['query']);_0x306426[_0x9dfe('0x34')]=_[_0x9dfe('0x35')](_0x306426['model'],_0x306426['query']);_0x5dc3e2[_0x9dfe('0x36')]=_[_0x9dfe('0x35')](_0x306426[_0x9dfe('0x31')],qs[_0x9dfe('0x37')](_0x4ae7ad['query'][_0x9dfe('0x37')]));_0x5dc3e2[_0x9dfe('0x36')]=_0x5dc3e2[_0x9dfe('0x36')][_0x9dfe('0x38')]?_0x5dc3e2[_0x9dfe('0x36')]:_0x306426['model'];if(!_0x4ae7ad[_0x9dfe('0x32')][_0x9dfe('0x39')](_0x9dfe('0x3a'))){_0x5dc3e2[_0x9dfe('0x1d')]=qs[_0x9dfe('0x1d')](_0x4ae7ad[_0x9dfe('0x32')][_0x9dfe('0x1d')]);_0x5dc3e2['offset']=qs[_0x9dfe('0x1c')](_0x4ae7ad[_0x9dfe('0x32')][_0x9dfe('0x1c')]);}_0x5dc3e2[_0x9dfe('0x3b')]=qs[_0x9dfe('0x3c')](_0x4ae7ad['query'][_0x9dfe('0x3c')]);_0x5dc3e2[_0x9dfe('0x3d')]=qs['filters'](_[_0x9dfe('0x3e')](_0x4ae7ad['query'],_0x306426[_0x9dfe('0x34')]),_0x796981);if(_0x4ae7ad[_0x9dfe('0x32')][_0x9dfe('0x3f')]){_0x5dc3e2[_0x9dfe('0x3d')]=_[_0x9dfe('0x40')](_0x5dc3e2['where'],{'$or':_['map'](_0x796981,function(_0x23c330){if(_0x23c330[_0x9dfe('0x41')]!=='VIRTUAL'){var _0x2168c7={};_0x2168c7[_0x23c330['name']]={'$like':'%'+_0x4ae7ad[_0x9dfe('0x32')]['filter']+'%'};return _0x2168c7;}})});}_0x5dc3e2=_['merge']({},_0x5dc3e2,_0x4ae7ad['options']);var _0x28856f={'where':_0x5dc3e2['where']};return db['FaxQueueReport'][_0x9dfe('0x1f')](_0x28856f)['then'](function(_0x2bf463){_0x409602[_0x9dfe('0x1f')]=_0x2bf463;if(_0x4ae7ad[_0x9dfe('0x32')][_0x9dfe('0x42')]){_0x5dc3e2[_0x9dfe('0x43')]=[{'all':!![]}];}return db[_0x9dfe('0x2e')][_0x9dfe('0x44')](_0x5dc3e2);})[_0x9dfe('0x26')](function(_0x340f34){_0x409602[_0x9dfe('0x45')]=_0x340f34;return _0x409602;})[_0x9dfe('0x26')](respondWithFilteredResult(_0x409711,_0x5dc3e2))[_0x9dfe('0x46')](handleError(_0x409711,null));};exports[_0x9dfe('0x47')]=function(_0x42d51e,_0x2cd4c1){var _0x1350fa={'raw':!![],'where':{'id':_0x42d51e[_0x9dfe('0x48')]['id']}},_0x5dfa4b={};_0x5dfa4b[_0x9dfe('0x31')]=_[_0x9dfe('0x33')](db['FaxQueueReport']['rawAttributes']);_0x5dfa4b[_0x9dfe('0x32')]=_['keys'](_0x42d51e['query']);_0x5dfa4b[_0x9dfe('0x34')]=_[_0x9dfe('0x35')](_0x5dfa4b[_0x9dfe('0x31')],_0x5dfa4b[_0x9dfe('0x32')]);_0x1350fa[_0x9dfe('0x36')]=_[_0x9dfe('0x35')](_0x5dfa4b[_0x9dfe('0x31')],qs[_0x9dfe('0x37')](_0x42d51e[_0x9dfe('0x32')][_0x9dfe('0x37')]));_0x1350fa['attributes']=_0x1350fa[_0x9dfe('0x36')][_0x9dfe('0x38')]?_0x1350fa[_0x9dfe('0x36')]:_0x5dfa4b[_0x9dfe('0x31')];if(_0x42d51e[_0x9dfe('0x32')][_0x9dfe('0x42')]){_0x1350fa['include']=[{'all':!![]}];}_0x1350fa=_[_0x9dfe('0x40')]({},_0x1350fa,_0x42d51e[_0x9dfe('0x49')]);return db[_0x9dfe('0x2e')][_0x9dfe('0x4a')](_0x1350fa)[_0x9dfe('0x26')](handleEntityNotFound(_0x2cd4c1,null))[_0x9dfe('0x26')](respondWithResult(_0x2cd4c1,null))['catch'](handleError(_0x2cd4c1,null));};exports[_0x9dfe('0x4b')]=function(_0x427ec3,_0x37036d){return db[_0x9dfe('0x2e')][_0x9dfe('0x4b')](_0x427ec3[_0x9dfe('0x4c')],{})[_0x9dfe('0x26')](respondWithResult(_0x37036d,0xc9))[_0x9dfe('0x46')](handleError(_0x37036d,null));};exports[_0x9dfe('0x25')]=function(_0x36a433,_0xb597b1){if(_0x36a433[_0x9dfe('0x4c')]['id']){delete _0x36a433[_0x9dfe('0x4c')]['id'];}return db[_0x9dfe('0x2e')][_0x9dfe('0x4a')]({'where':{'id':_0x36a433['params']['id']}})[_0x9dfe('0x26')](handleEntityNotFound(_0xb597b1,null))[_0x9dfe('0x26')](saveUpdates(_0x36a433['body'],null))['then'](respondWithResult(_0xb597b1,null))[_0x9dfe('0x46')](handleError(_0xb597b1,null));};exports[_0x9dfe('0x27')]=function(_0x556309,_0x4caa6a){return db['FaxQueueReport'][_0x9dfe('0x4a')]({'where':{'id':_0x556309[_0x9dfe('0x48')]['id']}})[_0x9dfe('0x26')](handleEntityNotFound(_0x4caa6a,null))[_0x9dfe('0x26')](removeEntity(_0x4caa6a,null))['catch'](handleError(_0x4caa6a,null));};exports[_0x9dfe('0x4d')]=function(_0x3b6f0c,_0x1fa0e1){return db[_0x9dfe('0x2e')][_0x9dfe('0x4d')]()['then'](respondWithResult(_0x1fa0e1,null))[_0x9dfe('0x46')](handleError(_0x1fa0e1,null));};
\ No newline at end of file
+var _0xa446=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','filter','type','VIRTUAL','options','include','FaxQueueReport','findAll','rows','params','keys','includeAll','merge','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x11f460,_0x58f07f){var _0x4a4185=function(_0x38c0fe){while(--_0x38c0fe){_0x11f460['push'](_0x11f460['shift']());}};_0x4a4185(++_0x58f07f);}(_0xa446,0xc6));var _0x6a44=function(_0x37c040,_0x59bd64){_0x37c040=_0x37c040-0x0;var _0x5cf0ee=_0xa446[_0x37c040];return _0x5cf0ee;};'use strict';var emlformat=require(_0x6a44('0x0'));var rimraf=require(_0x6a44('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6a44('0x2'));var rp=require('request-promise');var moment=require(_0x6a44('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6a44('0x4'));var util=require('util');var path=require(_0x6a44('0x5'));var sox=require(_0x6a44('0x6'));var csv=require(_0x6a44('0x7'));var ejs=require(_0x6a44('0x8'));var fs=require('fs');var fs_extra=require(_0x6a44('0x9'));var _=require(_0x6a44('0xa'));var squel=require('squel');var crypto=require(_0x6a44('0xb'));var jsforce=require(_0x6a44('0xc'));var deskjs=require(_0x6a44('0xd'));var toCsv=require(_0x6a44('0x7'));var querystring=require(_0x6a44('0xe'));var Papa=require('papaparse');var Redis=require(_0x6a44('0xf'));var authService=require(_0x6a44('0x10'));var qs=require(_0x6a44('0x11'));var as=require(_0x6a44('0x12'));var hardwareService=require(_0x6a44('0x13'));var logger=require(_0x6a44('0x14'))(_0x6a44('0x15'));var utils=require('../../config/utils');var config=require(_0x6a44('0x16'));var licenseUtil=require(_0x6a44('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x131b39,_0x1e0639){_0x1e0639=_0x1e0639||0xcc;return function(_0x21ce4a){if(_0x21ce4a){return _0x131b39['sendStatus'](_0x1e0639);}return _0x131b39[_0x6a44('0x18')](_0x1e0639)[_0x6a44('0x19')]();};}function respondWithResult(_0x94be1,_0xb1d987){_0xb1d987=_0xb1d987||0xc8;return function(_0x156a27){if(_0x156a27){return _0x94be1[_0x6a44('0x18')](_0xb1d987)['json'](_0x156a27);}};}function respondWithFilteredResult(_0x52aa9c,_0x260be6){return function(_0x973938){if(_0x973938){var _0x577275=typeof _0x260be6[_0x6a44('0x1a')]===_0x6a44('0x1b')&&typeof _0x260be6[_0x6a44('0x1c')]===_0x6a44('0x1b');var _0x2ff2a0=_0x973938[_0x6a44('0x1d')];var _0x3dde7f=_0x577275?0x0:_0x260be6[_0x6a44('0x1a')];var _0xc0997e=_0x577275?_0x973938[_0x6a44('0x1d')]:_0x260be6[_0x6a44('0x1a')]+_0x260be6[_0x6a44('0x1c')];var _0x1b8920;if(_0xc0997e>=_0x2ff2a0){_0xc0997e=_0x2ff2a0;_0x1b8920=0xc8;}else{_0x1b8920=0xce;}_0x52aa9c[_0x6a44('0x18')](_0x1b8920);return _0x52aa9c['set']('Content-Range',_0x3dde7f+'-'+_0xc0997e+'/'+_0x2ff2a0)['json'](_0x973938);}return null;};}function patchUpdates(_0x2d279b){return function(_0x19410f){try{jsonpatch[_0x6a44('0x1e')](_0x19410f,_0x2d279b,!![]);}catch(_0x1a7990){return BPromise['reject'](_0x1a7990);}return _0x19410f[_0x6a44('0x1f')]();};}function saveUpdates(_0x24ba62,_0x528afe){return function(_0xebf7d6){if(_0xebf7d6){return _0xebf7d6[_0x6a44('0x20')](_0x24ba62)[_0x6a44('0x21')](function(_0x153a7a){return _0x153a7a;});}return null;};}function removeEntity(_0x21a25c,_0x12e6fb){return function(_0x178b35){if(_0x178b35){return _0x178b35[_0x6a44('0x22')]()[_0x6a44('0x21')](function(){_0x21a25c['status'](0xcc)[_0x6a44('0x19')]();});}};}function handleEntityNotFound(_0x99475e,_0x466c54){return function(_0x36b027){if(!_0x36b027){_0x99475e['sendStatus'](0x194);}return _0x36b027;};}function handleError(_0x14141d,_0x4ee88c){_0x4ee88c=_0x4ee88c||0x1f4;return function(_0x3ad23e){logger[_0x6a44('0x23')](_0x3ad23e[_0x6a44('0x24')]);if(_0x3ad23e[_0x6a44('0x25')]){delete _0x3ad23e[_0x6a44('0x25')];}_0x14141d[_0x6a44('0x18')](_0x4ee88c)[_0x6a44('0x26')](_0x3ad23e);};}exports[_0x6a44('0x27')]=function(_0x5a542b,_0x5b81ce){var _0x4a5eab={},_0x265f9d={},_0x5abc23={'count':0x0,'rows':[]};var _0xaef746=_['map'](db['FaxQueueReport'][_0x6a44('0x28')],function(_0xbe9fa1){return{'name':_0xbe9fa1[_0x6a44('0x29')],'type':_0xbe9fa1['type'][_0x6a44('0x2a')]};});_0x265f9d['model']=_[_0x6a44('0x2b')](_0xaef746,_0x6a44('0x25'));_0x265f9d['query']=_['keys'](_0x5a542b[_0x6a44('0x2c')]);_0x265f9d[_0x6a44('0x2d')]=_[_0x6a44('0x2e')](_0x265f9d['model'],_0x265f9d['query']);_0x4a5eab[_0x6a44('0x2f')]=_[_0x6a44('0x2e')](_0x265f9d[_0x6a44('0x30')],qs['fields'](_0x5a542b[_0x6a44('0x2c')][_0x6a44('0x31')]));_0x4a5eab[_0x6a44('0x2f')]=_0x4a5eab[_0x6a44('0x2f')][_0x6a44('0x32')]?_0x4a5eab[_0x6a44('0x2f')]:_0x265f9d[_0x6a44('0x30')];if(!_0x5a542b[_0x6a44('0x2c')][_0x6a44('0x33')](_0x6a44('0x34'))){_0x4a5eab[_0x6a44('0x1c')]=qs[_0x6a44('0x1c')](_0x5a542b['query'][_0x6a44('0x1c')]);_0x4a5eab['offset']=qs['offset'](_0x5a542b['query']['offset']);}_0x4a5eab[_0x6a44('0x35')]=qs['sort'](_0x5a542b[_0x6a44('0x2c')]['sort']);_0x4a5eab[_0x6a44('0x36')]=qs[_0x6a44('0x2d')](_['pick'](_0x5a542b['query'],_0x265f9d[_0x6a44('0x2d')]),_0xaef746);if(_0x5a542b[_0x6a44('0x2c')][_0x6a44('0x37')]){_0x4a5eab[_0x6a44('0x36')]=_['merge'](_0x4a5eab[_0x6a44('0x36')],{'$or':_[_0x6a44('0x2b')](_0xaef746,function(_0x3eee72){if(_0x3eee72[_0x6a44('0x38')]!==_0x6a44('0x39')){var _0x1b88d6={};_0x1b88d6[_0x3eee72['name']]={'$like':'%'+_0x5a542b[_0x6a44('0x2c')][_0x6a44('0x37')]+'%'};return _0x1b88d6;}})});}_0x4a5eab=_['merge']({},_0x4a5eab,_0x5a542b[_0x6a44('0x3a')]);var _0x4e3223={'where':_0x4a5eab[_0x6a44('0x36')]};return db['FaxQueueReport'][_0x6a44('0x1d')](_0x4e3223)[_0x6a44('0x21')](function(_0x1f32a2){_0x5abc23[_0x6a44('0x1d')]=_0x1f32a2;if(_0x5a542b[_0x6a44('0x2c')]['includeAll']){_0x4a5eab[_0x6a44('0x3b')]=[{'all':!![]}];}return db[_0x6a44('0x3c')][_0x6a44('0x3d')](_0x4a5eab);})['then'](function(_0x43eaca){_0x5abc23[_0x6a44('0x3e')]=_0x43eaca;return _0x5abc23;})['then'](respondWithFilteredResult(_0x5b81ce,_0x4a5eab))['catch'](handleError(_0x5b81ce,null));};exports['show']=function(_0x59c038,_0xea4abf){var _0xcdb39={'raw':!![],'where':{'id':_0x59c038[_0x6a44('0x3f')]['id']}},_0x21ba45={};_0x21ba45[_0x6a44('0x30')]=_['keys'](db['FaxQueueReport'][_0x6a44('0x28')]);_0x21ba45[_0x6a44('0x2c')]=_[_0x6a44('0x40')](_0x59c038['query']);_0x21ba45[_0x6a44('0x2d')]=_[_0x6a44('0x2e')](_0x21ba45[_0x6a44('0x30')],_0x21ba45['query']);_0xcdb39[_0x6a44('0x2f')]=_[_0x6a44('0x2e')](_0x21ba45[_0x6a44('0x30')],qs[_0x6a44('0x31')](_0x59c038[_0x6a44('0x2c')][_0x6a44('0x31')]));_0xcdb39[_0x6a44('0x2f')]=_0xcdb39[_0x6a44('0x2f')]['length']?_0xcdb39[_0x6a44('0x2f')]:_0x21ba45[_0x6a44('0x30')];if(_0x59c038[_0x6a44('0x2c')][_0x6a44('0x41')]){_0xcdb39[_0x6a44('0x3b')]=[{'all':!![]}];}_0xcdb39=_[_0x6a44('0x42')]({},_0xcdb39,_0x59c038[_0x6a44('0x3a')]);return db[_0x6a44('0x3c')][_0x6a44('0x43')](_0xcdb39)['then'](handleEntityNotFound(_0xea4abf,null))[_0x6a44('0x21')](respondWithResult(_0xea4abf,null))[_0x6a44('0x44')](handleError(_0xea4abf,null));};exports[_0x6a44('0x45')]=function(_0x3dc7ef,_0x620eb6){return db[_0x6a44('0x3c')][_0x6a44('0x45')](_0x3dc7ef[_0x6a44('0x46')],{})['then'](respondWithResult(_0x620eb6,0xc9))[_0x6a44('0x44')](handleError(_0x620eb6,null));};exports[_0x6a44('0x20')]=function(_0x59377e,_0x4dce0f){if(_0x59377e[_0x6a44('0x46')]['id']){delete _0x59377e['body']['id'];}return db['FaxQueueReport'][_0x6a44('0x43')]({'where':{'id':_0x59377e[_0x6a44('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4dce0f,null))['then'](saveUpdates(_0x59377e[_0x6a44('0x46')],null))[_0x6a44('0x21')](respondWithResult(_0x4dce0f,null))['catch'](handleError(_0x4dce0f,null));};exports[_0x6a44('0x22')]=function(_0x4d0a75,_0x18f09a){return db[_0x6a44('0x3c')][_0x6a44('0x43')]({'where':{'id':_0x4d0a75['params']['id']}})['then'](handleEntityNotFound(_0x18f09a,null))['then'](removeEntity(_0x18f09a,null))['catch'](handleError(_0x18f09a,null));};exports[_0x6a44('0x47')]=function(_0xa393fc,_0x428a08){return db[_0x6a44('0x3c')][_0x6a44('0x47')]()['then'](respondWithResult(_0x428a08,null))[_0x6a44('0x44')](handleError(_0x428a08,null));};
\ No newline at end of file
index 38b9348..1f2feb8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x565fee,_0x1928f){var _0x2a8a89=function(_0x8f6a84){while(--_0x8f6a84){_0x565fee['push'](_0x565fee['shift']());}};_0x2a8a89(++_0x1928f);}(_0x53ec,0x192));var _0xc53e=function(_0x8a2e9d,_0xa7a01c){_0x8a2e9d=_0x8a2e9d-0x0;var _0xf64cdd=_0x53ec[_0x8a2e9d];return _0xf64cdd;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./faxQueueReport.attributes','exports','define','report_fax_queue','uniqueid','lodash'];(function(_0x3cc301,_0x300427){var _0x5b2389=function(_0x443c7d){while(--_0x443c7d){_0x3cc301['push'](_0x3cc301['shift']());}};_0x5b2389(++_0x300427);}(_0x5fc3,0xa8));var _0x35fc=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x5fc3[_0x279d37];return _0x530173;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('FaxQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
index f44efa1..26e4bde 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8409=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FaxQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','FaxQueueReport','create','body','options','raw','then','CreateFaxQueueReport','update','where','attributes','limit','UpdateFaxQueueReport','lodash','moment'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x8409,0xa8));var _0x9840=function(_0x38ead5,_0x5b4fa2){_0x38ead5=_0x38ead5-0x0;var _0x4e40bc=_0x8409[_0x38ead5];return _0x4e40bc;};'use strict';var _=require(_0x9840('0x0'));var util=require('util');var moment=require(_0x9840('0x1'));var BPromise=require(_0x9840('0x2'));var rs=require(_0x9840('0x3'));var fs=require('fs');var Redis=require(_0x9840('0x4'));var db=require(_0x9840('0x5'))['db'];var utils=require(_0x9840('0x6'));var logger=require(_0x9840('0x7'))(_0x9840('0x8'));var config=require(_0x9840('0x9'));var jayson=require(_0x9840('0xa'));var client=jayson['client'][_0x9840('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19178b,_0x1d24b8,_0x644a60){return new BPromise(function(_0x270ca5,_0x4c0546){return client[_0x9840('0xc')](_0x19178b,_0x644a60)['then'](function(_0x40eaf0){logger[_0x9840('0xd')](_0x9840('0xe'),_0x1d24b8,'request\x20sent');logger[_0x9840('0xf')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1d24b8,'request\x20sent',JSON[_0x9840('0x10')](_0x40eaf0));if(_0x40eaf0[_0x9840('0x11')]){if(_0x40eaf0['error'][_0x9840('0x12')]===0x1f4){logger[_0x9840('0x11')](_0x9840('0xe'),_0x1d24b8,_0x40eaf0['error'][_0x9840('0x13')]);return _0x4c0546(_0x40eaf0['error'][_0x9840('0x13')]);}logger[_0x9840('0x11')](_0x9840('0xe'),_0x1d24b8,_0x40eaf0[_0x9840('0x11')][_0x9840('0x13')]);return _0x270ca5(_0x40eaf0[_0x9840('0x11')][_0x9840('0x13')]);}else{logger[_0x9840('0xd')](_0x9840('0xe'),_0x1d24b8,'request\x20sent');_0x270ca5(_0x40eaf0[_0x9840('0x14')]['message']);}})[_0x9840('0x15')](function(_0x3dd5ae){logger[_0x9840('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x1d24b8,_0x3dd5ae);_0x4c0546(_0x3dd5ae);});});}exports['CreateFaxQueueReport']=function(_0x25436a){var _0x4256d3=this;return new Promise(function(_0x1a4b06,_0x295024){return db[_0x9840('0x16')][_0x9840('0x17')](_0x25436a[_0x9840('0x18')],{'raw':_0x25436a['options']?_0x25436a[_0x9840('0x19')][_0x9840('0x1a')]===undefined?!![]:![]:!![]})[_0x9840('0x1b')](function(_0x584d38){logger[_0x9840('0xd')]('CreateFaxQueueReport',_0x25436a);logger[_0x9840('0xf')](_0x9840('0x1c'),_0x25436a,JSON[_0x9840('0x10')](_0x584d38));_0x1a4b06(_0x584d38);})[_0x9840('0x15')](function(_0x661b62){logger[_0x9840('0x11')](_0x9840('0x1c'),_0x661b62['message'],_0x25436a);_0x295024(_0x4256d3[_0x9840('0x11')](0x1f4,_0x661b62[_0x9840('0x13')]));});});};exports['UpdateFaxQueueReport']=function(_0x1ac77e){var _0x21b779=this;return new Promise(function(_0x5aafd3,_0x5377a2){return db[_0x9840('0x16')][_0x9840('0x1d')](_0x1ac77e[_0x9840('0x18')],{'raw':_0x1ac77e[_0x9840('0x19')]?_0x1ac77e[_0x9840('0x19')][_0x9840('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ac77e[_0x9840('0x19')]?_0x1ac77e[_0x9840('0x19')][_0x9840('0x1e')]||null:null,'attributes':_0x1ac77e[_0x9840('0x19')]?_0x1ac77e['options'][_0x9840('0x1f')]||null:null,'limit':_0x1ac77e['options']?_0x1ac77e[_0x9840('0x19')][_0x9840('0x20')]||null:null})[_0x9840('0x1b')](function(_0x55f1fc){logger[_0x9840('0xd')](_0x9840('0x21'),_0x1ac77e);logger[_0x9840('0xf')](_0x9840('0x21'),_0x1ac77e,JSON[_0x9840('0x10')](_0x55f1fc));_0x5aafd3(_0x55f1fc);})[_0x9840('0x15')](function(_0x8ba2e7){logger[_0x9840('0x11')](_0x9840('0x21'),_0x8ba2e7['message'],_0x1ac77e);_0x5377a2(_0x21b779[_0x9840('0x11')](0x1f4,_0x8ba2e7[_0x9840('0x13')]));});});};
\ No newline at end of file
+var _0xff35=['body','options','raw','CreateFaxQueueReport','catch','update','where','attributes','limit','UpdateFaxQueueReport','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','FaxQueueReport,\x20%s,\x20%s','message','info','result','create'];(function(_0x46c8ec,_0x52c7a6){var _0x26503b=function(_0x506f11){while(--_0x506f11){_0x46c8ec['push'](_0x46c8ec['shift']());}};_0x26503b(++_0x52c7a6);}(_0xff35,0x16a));var _0x5ff3=function(_0x43077b,_0x2e8274){_0x43077b=_0x43077b-0x0;var _0x429348=_0xff35[_0x43077b];return _0x429348;};'use strict';var _=require(_0x5ff3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5ff3('0x1'));var rs=require(_0x5ff3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5ff3('0x3'))['db'];var utils=require(_0x5ff3('0x4'));var logger=require(_0x5ff3('0x5'))(_0x5ff3('0x6'));var config=require(_0x5ff3('0x7'));var jayson=require(_0x5ff3('0x8'));var client=jayson[_0x5ff3('0x9')][_0x5ff3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4eafac,_0xb7f8f4,_0xd09a82){return new BPromise(function(_0x44bc9b,_0x1f8a2e){return client['request'](_0x4eafac,_0xd09a82)[_0x5ff3('0xb')](function(_0x146954){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0xb7f8f4,_0x5ff3('0xc'));logger[_0x5ff3('0xd')](_0x5ff3('0xe'),_0xb7f8f4,_0x5ff3('0xc'),JSON[_0x5ff3('0xf')](_0x146954));if(_0x146954['error']){if(_0x146954[_0x5ff3('0x10')]['code']===0x1f4){logger[_0x5ff3('0x10')](_0x5ff3('0x11'),_0xb7f8f4,_0x146954[_0x5ff3('0x10')][_0x5ff3('0x12')]);return _0x1f8a2e(_0x146954[_0x5ff3('0x10')]['message']);}logger[_0x5ff3('0x10')](_0x5ff3('0x11'),_0xb7f8f4,_0x146954[_0x5ff3('0x10')][_0x5ff3('0x12')]);return _0x44bc9b(_0x146954['error'][_0x5ff3('0x12')]);}else{logger[_0x5ff3('0x13')](_0x5ff3('0x11'),_0xb7f8f4,_0x5ff3('0xc'));_0x44bc9b(_0x146954[_0x5ff3('0x14')][_0x5ff3('0x12')]);}})['catch'](function(_0x2d7d36){logger[_0x5ff3('0x10')](_0x5ff3('0x11'),_0xb7f8f4,_0x2d7d36);_0x1f8a2e(_0x2d7d36);});});}exports['CreateFaxQueueReport']=function(_0x5d80ba){var _0x10e1d5=this;return new Promise(function(_0x5a1e37,_0x144192){return db['FaxQueueReport'][_0x5ff3('0x15')](_0x5d80ba[_0x5ff3('0x16')],{'raw':_0x5d80ba[_0x5ff3('0x17')]?_0x5d80ba['options'][_0x5ff3('0x18')]===undefined?!![]:![]:!![]})[_0x5ff3('0xb')](function(_0x42c513){logger['info'](_0x5ff3('0x19'),_0x5d80ba);logger[_0x5ff3('0xd')](_0x5ff3('0x19'),_0x5d80ba,JSON[_0x5ff3('0xf')](_0x42c513));_0x5a1e37(_0x42c513);})[_0x5ff3('0x1a')](function(_0x471081){logger[_0x5ff3('0x10')](_0x5ff3('0x19'),_0x471081[_0x5ff3('0x12')],_0x5d80ba);_0x144192(_0x10e1d5['error'](0x1f4,_0x471081[_0x5ff3('0x12')]));});});};exports['UpdateFaxQueueReport']=function(_0x3657ba){var _0x28b02f=this;return new Promise(function(_0x25503d,_0x380922){return db['FaxQueueReport'][_0x5ff3('0x1b')](_0x3657ba[_0x5ff3('0x16')],{'raw':_0x3657ba['options']?_0x3657ba[_0x5ff3('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3657ba[_0x5ff3('0x17')]?_0x3657ba['options'][_0x5ff3('0x1c')]||null:null,'attributes':_0x3657ba[_0x5ff3('0x17')]?_0x3657ba[_0x5ff3('0x17')][_0x5ff3('0x1d')]||null:null,'limit':_0x3657ba[_0x5ff3('0x17')]?_0x3657ba[_0x5ff3('0x17')][_0x5ff3('0x1e')]||null:null})[_0x5ff3('0xb')](function(_0x13c8fe){logger[_0x5ff3('0x13')](_0x5ff3('0x1f'),_0x3657ba);logger[_0x5ff3('0xd')](_0x5ff3('0x1f'),_0x3657ba,JSON[_0x5ff3('0xf')](_0x13c8fe));_0x25503d(_0x13c8fe);})[_0x5ff3('0x1a')](function(_0x399d04){logger['error']('UpdateFaxQueueReport',_0x399d04[_0x5ff3('0x12')],_0x3657ba);_0x380922(_0x28b02f[_0x5ff3('0x10')](0x1f4,_0x399d04['message']));});});};
\ No newline at end of file
index 5354010..eb9ceaa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe94a=['describe','/:id','show','create','put','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated'];(function(_0xafadef,_0x2a5075){var _0x2d6530=function(_0x2307a1){while(--_0x2307a1){_0xafadef['push'](_0xafadef['shift']());}};_0x2d6530(++_0x2a5075);}(_0xe94a,0x1a9));var _0xae94=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xe94a[_0x595013];return _0x2a29e3;};'use strict';var multer=require(_0xae94('0x0'));var util=require(_0xae94('0x1'));var path=require(_0xae94('0x2'));var timeout=require(_0xae94('0x3'));var express=require(_0xae94('0x4'));var router=express['Router']();var fs_extra=require(_0xae94('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xae94('0x6'));var config=require(_0xae94('0x7'));var controller=require('./faxQueueReport.controller');router[_0xae94('0x8')]('/',auth['isAuthenticated'](),controller[_0xae94('0x9')]);router[_0xae94('0x8')](_0xae94('0xa'),auth[_0xae94('0xb')](),controller[_0xae94('0xc')]);router['get'](_0xae94('0xd'),auth[_0xae94('0xb')](),controller[_0xae94('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xae94('0xf')]);router[_0xae94('0x10')](_0xae94('0xd'),auth[_0xae94('0xb')](),controller['update']);router[_0xae94('0x11')](_0xae94('0xd'),auth[_0xae94('0xb')](),controller[_0xae94('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0x27d2=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','put','update','delete','exports','multer','util'];(function(_0x2cb4ca,_0x383447){var _0x3647cf=function(_0x4c1c0d){while(--_0x4c1c0d){_0x2cb4ca['push'](_0x2cb4ca['shift']());}};_0x3647cf(++_0x383447);}(_0x27d2,0x139));var _0x227d=function(_0x39916a,_0x53e87a){_0x39916a=_0x39916a-0x0;var _0xa3d8ef=_0x27d2[_0x39916a];return _0xa3d8ef;};'use strict';var multer=require(_0x227d('0x0'));var util=require(_0x227d('0x1'));var path=require(_0x227d('0x2'));var timeout=require(_0x227d('0x3'));var express=require(_0x227d('0x4'));var router=express[_0x227d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x227d('0x6'));var interaction=require(_0x227d('0x7'));var config=require(_0x227d('0x8'));var controller=require(_0x227d('0x9'));router['get']('/',auth[_0x227d('0xa')](),controller[_0x227d('0xb')]);router[_0x227d('0xc')]('/describe',auth[_0x227d('0xa')](),controller[_0x227d('0xd')]);router[_0x227d('0xc')](_0x227d('0xe'),auth[_0x227d('0xa')](),controller[_0x227d('0xf')]);router[_0x227d('0x10')]('/',auth[_0x227d('0xa')](),controller['create']);router[_0x227d('0x11')](_0x227d('0xe'),auth[_0x227d('0xa')](),controller[_0x227d('0x12')]);router[_0x227d('0x13')](_0x227d('0xe'),auth[_0x227d('0xa')](),controller['destroy']);module[_0x227d('0x14')]=router;
\ No newline at end of file
index 7f2b6dc..44cb0a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x23563c,_0xc2f3c5){var _0xeddf50=function(_0x4d530c){while(--_0x4d530c){_0x23563c['push'](_0x23563c['shift']());}};_0xeddf50(++_0xc2f3c5);}(_0x34e8,0x12c));var _0x834e=function(_0xae9f8c,_0x1e7f02){_0xae9f8c=_0xae9f8c-0x0;var _0x49c898=_0x34e8[_0xae9f8c];return _0x49c898;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}};
\ No newline at end of file
+var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x367816,_0x35633c){var _0x2cdde2=function(_0x153253){while(--_0x153253){_0x367816['push'](_0x367816['shift']());}};_0x2cdde2(++_0x35633c);}(_0x54ef,0x112));var _0xf54e=function(_0xa2fe8e,_0x4bac59){_0xa2fe8e=_0xa2fe8e-0x0;var _0xae3a93=_0x54ef[_0xa2fe8e];return _0xae3a93;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}};
\ No newline at end of file
index 35575f8..3e4fba3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d8a=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','FaxTransferReport','includeAll','findAll','rows','catch','show','params','keys','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x1fbb4c,_0x58a456){var _0x187a8d=function(_0x4fd750){while(--_0x4fd750){_0x1fbb4c['push'](_0x1fbb4c['shift']());}};_0x187a8d(++_0x58a456);}(_0x5d8a,0xda));var _0xa5d8=function(_0x1f2dda,_0x539c5f){_0x1f2dda=_0x1f2dda-0x0;var _0x29b49e=_0x5d8a[_0x1f2dda];return _0x29b49e;};'use strict';var emlformat=require(_0xa5d8('0x0'));var rimraf=require(_0xa5d8('0x1'));var zipdir=require(_0xa5d8('0x2'));var jsonpatch=require(_0xa5d8('0x3'));var rp=require(_0xa5d8('0x4'));var moment=require(_0xa5d8('0x5'));var BPromise=require(_0xa5d8('0x6'));var Mustache=require(_0xa5d8('0x7'));var util=require(_0xa5d8('0x8'));var path=require(_0xa5d8('0x9'));var sox=require(_0xa5d8('0xa'));var csv=require(_0xa5d8('0xb'));var ejs=require(_0xa5d8('0xc'));var fs=require('fs');var fs_extra=require(_0xa5d8('0xd'));var _=require('lodash');var squel=require(_0xa5d8('0xe'));var crypto=require(_0xa5d8('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xa5d8('0x10'));var toCsv=require(_0xa5d8('0xb'));var querystring=require(_0xa5d8('0x11'));var Papa=require('papaparse');var Redis=require(_0xa5d8('0x12'));var authService=require(_0xa5d8('0x13'));var qs=require(_0xa5d8('0x14'));var as=require(_0xa5d8('0x15'));var hardwareService=require(_0xa5d8('0x16'));var logger=require(_0xa5d8('0x17'))(_0xa5d8('0x18'));var utils=require(_0xa5d8('0x19'));var config=require(_0xa5d8('0x1a'));var licenseUtil=require(_0xa5d8('0x1b'));var db=require(_0xa5d8('0x1c'))['db'];function respondWithStatusCode(_0xb71760,_0x1a1c14){_0x1a1c14=_0x1a1c14||0xcc;return function(_0x106ed8){if(_0x106ed8){return _0xb71760[_0xa5d8('0x1d')](_0x1a1c14);}return _0xb71760[_0xa5d8('0x1e')](_0x1a1c14)[_0xa5d8('0x1f')]();};}function respondWithResult(_0x4af824,_0x888fad){_0x888fad=_0x888fad||0xc8;return function(_0x59d616){if(_0x59d616){return _0x4af824[_0xa5d8('0x1e')](_0x888fad)[_0xa5d8('0x20')](_0x59d616);}};}function respondWithFilteredResult(_0x74de0e,_0x3aa1b3){return function(_0x1bebc2){if(_0x1bebc2){var _0x38b48b=typeof _0x3aa1b3[_0xa5d8('0x21')]===_0xa5d8('0x22')&&typeof _0x3aa1b3[_0xa5d8('0x23')]===_0xa5d8('0x22');var _0x2b2a39=_0x1bebc2[_0xa5d8('0x24')];var _0x1ef184=_0x38b48b?0x0:_0x3aa1b3[_0xa5d8('0x21')];var _0x3bbc5d=_0x38b48b?_0x1bebc2[_0xa5d8('0x24')]:_0x3aa1b3[_0xa5d8('0x21')]+_0x3aa1b3[_0xa5d8('0x23')];var _0xe9ddec;if(_0x3bbc5d>=_0x2b2a39){_0x3bbc5d=_0x2b2a39;_0xe9ddec=0xc8;}else{_0xe9ddec=0xce;}_0x74de0e[_0xa5d8('0x1e')](_0xe9ddec);return _0x74de0e[_0xa5d8('0x25')](_0xa5d8('0x26'),_0x1ef184+'-'+_0x3bbc5d+'/'+_0x2b2a39)[_0xa5d8('0x20')](_0x1bebc2);}return null;};}function patchUpdates(_0x5633f9){return function(_0x577c58){try{jsonpatch[_0xa5d8('0x27')](_0x577c58,_0x5633f9,!![]);}catch(_0x48564b){return BPromise['reject'](_0x48564b);}return _0x577c58[_0xa5d8('0x28')]();};}function saveUpdates(_0x214825,_0x304b17){return function(_0x17afa1){if(_0x17afa1){return _0x17afa1[_0xa5d8('0x29')](_0x214825)[_0xa5d8('0x2a')](function(_0x1f9424){return _0x1f9424;});}return null;};}function removeEntity(_0x55fd28,_0x10ca61){return function(_0x1eb662){if(_0x1eb662){return _0x1eb662[_0xa5d8('0x2b')]()[_0xa5d8('0x2a')](function(){_0x55fd28[_0xa5d8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x366e60,_0x1d160d){return function(_0x4c705b){if(!_0x4c705b){_0x366e60['sendStatus'](0x194);}return _0x4c705b;};}function handleError(_0x5c4098,_0x47c109){_0x47c109=_0x47c109||0x1f4;return function(_0xaaf09d){logger[_0xa5d8('0x2c')](_0xaaf09d[_0xa5d8('0x2d')]);if(_0xaaf09d[_0xa5d8('0x2e')]){delete _0xaaf09d['name'];}_0x5c4098[_0xa5d8('0x1e')](_0x47c109)[_0xa5d8('0x2f')](_0xaaf09d);};}exports['index']=function(_0x3cc779,_0x490e7c){var _0x41b626={},_0x1d3b2e={},_0x3b49b4={'count':0x0,'rows':[]};var _0x409a4d=_[_0xa5d8('0x30')](db['FaxTransferReport'][_0xa5d8('0x31')],function(_0x29c382){return{'name':_0x29c382[_0xa5d8('0x32')],'type':_0x29c382[_0xa5d8('0x33')][_0xa5d8('0x34')]};});_0x1d3b2e[_0xa5d8('0x35')]=_[_0xa5d8('0x30')](_0x409a4d,_0xa5d8('0x2e'));_0x1d3b2e[_0xa5d8('0x36')]=_['keys'](_0x3cc779[_0xa5d8('0x36')]);_0x1d3b2e[_0xa5d8('0x37')]=_[_0xa5d8('0x38')](_0x1d3b2e[_0xa5d8('0x35')],_0x1d3b2e[_0xa5d8('0x36')]);_0x41b626[_0xa5d8('0x39')]=_[_0xa5d8('0x38')](_0x1d3b2e['model'],qs[_0xa5d8('0x3a')](_0x3cc779['query'][_0xa5d8('0x3a')]));_0x41b626['attributes']=_0x41b626[_0xa5d8('0x39')][_0xa5d8('0x3b')]?_0x41b626[_0xa5d8('0x39')]:_0x1d3b2e[_0xa5d8('0x35')];if(!_0x3cc779[_0xa5d8('0x36')]['hasOwnProperty'](_0xa5d8('0x3c'))){_0x41b626[_0xa5d8('0x23')]=qs[_0xa5d8('0x23')](_0x3cc779[_0xa5d8('0x36')][_0xa5d8('0x23')]);_0x41b626['offset']=qs['offset'](_0x3cc779[_0xa5d8('0x36')][_0xa5d8('0x21')]);}_0x41b626[_0xa5d8('0x3d')]=qs[_0xa5d8('0x3e')](_0x3cc779[_0xa5d8('0x36')][_0xa5d8('0x3e')]);_0x41b626[_0xa5d8('0x3f')]=qs['filters'](_[_0xa5d8('0x40')](_0x3cc779[_0xa5d8('0x36')],_0x1d3b2e[_0xa5d8('0x37')]),_0x409a4d);if(_0x3cc779[_0xa5d8('0x36')][_0xa5d8('0x41')]){_0x41b626[_0xa5d8('0x3f')]=_[_0xa5d8('0x42')](_0x41b626[_0xa5d8('0x3f')],{'$or':_[_0xa5d8('0x30')](_0x409a4d,function(_0x4e494a){if(_0x4e494a['type']!=='VIRTUAL'){var _0x3b09de={};_0x3b09de[_0x4e494a[_0xa5d8('0x2e')]]={'$like':'%'+_0x3cc779[_0xa5d8('0x36')][_0xa5d8('0x41')]+'%'};return _0x3b09de;}})});}_0x41b626=_[_0xa5d8('0x42')]({},_0x41b626,_0x3cc779['options']);var _0x2fa956={'where':_0x41b626[_0xa5d8('0x3f')]};return db[_0xa5d8('0x43')][_0xa5d8('0x24')](_0x2fa956)['then'](function(_0x2017ee){_0x3b49b4['count']=_0x2017ee;if(_0x3cc779[_0xa5d8('0x36')][_0xa5d8('0x44')]){_0x41b626['include']=[{'all':!![]}];}return db['FaxTransferReport'][_0xa5d8('0x45')](_0x41b626);})['then'](function(_0x27883b){_0x3b49b4[_0xa5d8('0x46')]=_0x27883b;return _0x3b49b4;})[_0xa5d8('0x2a')](respondWithFilteredResult(_0x490e7c,_0x41b626))[_0xa5d8('0x47')](handleError(_0x490e7c,null));};exports[_0xa5d8('0x48')]=function(_0x5c74b3,_0x377ceb){var _0x3cea29={'raw':!![],'where':{'id':_0x5c74b3[_0xa5d8('0x49')]['id']}},_0x46a04b={};_0x46a04b[_0xa5d8('0x35')]=_[_0xa5d8('0x4a')](db[_0xa5d8('0x43')]['rawAttributes']);_0x46a04b[_0xa5d8('0x36')]=_['keys'](_0x5c74b3[_0xa5d8('0x36')]);_0x46a04b[_0xa5d8('0x37')]=_[_0xa5d8('0x38')](_0x46a04b[_0xa5d8('0x35')],_0x46a04b[_0xa5d8('0x36')]);_0x3cea29[_0xa5d8('0x39')]=_[_0xa5d8('0x38')](_0x46a04b[_0xa5d8('0x35')],qs[_0xa5d8('0x3a')](_0x5c74b3[_0xa5d8('0x36')]['fields']));_0x3cea29['attributes']=_0x3cea29[_0xa5d8('0x39')][_0xa5d8('0x3b')]?_0x3cea29[_0xa5d8('0x39')]:_0x46a04b[_0xa5d8('0x35')];if(_0x5c74b3[_0xa5d8('0x36')][_0xa5d8('0x44')]){_0x3cea29[_0xa5d8('0x4b')]=[{'all':!![]}];}_0x3cea29=_[_0xa5d8('0x42')]({},_0x3cea29,_0x5c74b3[_0xa5d8('0x4c')]);return db[_0xa5d8('0x43')][_0xa5d8('0x4d')](_0x3cea29)['then'](handleEntityNotFound(_0x377ceb,null))[_0xa5d8('0x2a')](respondWithResult(_0x377ceb,null))[_0xa5d8('0x47')](handleError(_0x377ceb,null));};exports[_0xa5d8('0x4e')]=function(_0x16e23e,_0x1afa00){return db[_0xa5d8('0x43')][_0xa5d8('0x4e')](_0x16e23e[_0xa5d8('0x4f')],{})['then'](respondWithResult(_0x1afa00,0xc9))['catch'](handleError(_0x1afa00,null));};exports[_0xa5d8('0x29')]=function(_0x2d5553,_0x3e67fa){if(_0x2d5553[_0xa5d8('0x4f')]['id']){delete _0x2d5553['body']['id'];}return db['FaxTransferReport'][_0xa5d8('0x4d')]({'where':{'id':_0x2d5553['params']['id']}})[_0xa5d8('0x2a')](handleEntityNotFound(_0x3e67fa,null))[_0xa5d8('0x2a')](saveUpdates(_0x2d5553[_0xa5d8('0x4f')],null))[_0xa5d8('0x2a')](respondWithResult(_0x3e67fa,null))[_0xa5d8('0x47')](handleError(_0x3e67fa,null));};exports[_0xa5d8('0x2b')]=function(_0x2e8695,_0xea3cec){return db[_0xa5d8('0x43')]['find']({'where':{'id':_0x2e8695['params']['id']}})['then'](handleEntityNotFound(_0xea3cec,null))['then'](removeEntity(_0xea3cec,null))[_0xa5d8('0x47')](handleError(_0xea3cec,null));};exports[_0xa5d8('0x50')]=function(_0x18da43,_0x523216){return db['FaxTransferReport'][_0xa5d8('0x50')]()[_0xa5d8('0x2a')](respondWithResult(_0x523216,null))[_0xa5d8('0x47')](handleError(_0x523216,null));};
\ No newline at end of file
+var _0xc8fc=['intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','options','FaxTransferReport','includeAll','include','findAll','rows','catch','show','params'];(function(_0x585d09,_0x1274bc){var _0x7d9a14=function(_0x343d4e){while(--_0x343d4e){_0x585d09['push'](_0x585d09['shift']());}};_0x7d9a14(++_0x1274bc);}(_0xc8fc,0x1d3));var _0xcc8f=function(_0x1b70ae,_0x221816){_0x1b70ae=_0x1b70ae-0x0;var _0x527b35=_0xc8fc[_0x1b70ae];return _0x527b35;};'use strict';var emlformat=require(_0xcc8f('0x0'));var rimraf=require(_0xcc8f('0x1'));var zipdir=require(_0xcc8f('0x2'));var jsonpatch=require(_0xcc8f('0x3'));var rp=require(_0xcc8f('0x4'));var moment=require(_0xcc8f('0x5'));var BPromise=require(_0xcc8f('0x6'));var Mustache=require(_0xcc8f('0x7'));var util=require(_0xcc8f('0x8'));var path=require(_0xcc8f('0x9'));var sox=require(_0xcc8f('0xa'));var csv=require(_0xcc8f('0xb'));var ejs=require(_0xcc8f('0xc'));var fs=require('fs');var fs_extra=require(_0xcc8f('0xd'));var _=require(_0xcc8f('0xe'));var squel=require('squel');var crypto=require(_0xcc8f('0xf'));var jsforce=require(_0xcc8f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc8f('0xb'));var querystring=require(_0xcc8f('0x11'));var Papa=require(_0xcc8f('0x12'));var Redis=require(_0xcc8f('0x13'));var authService=require(_0xcc8f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc8f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc8f('0x16'))(_0xcc8f('0x17'));var utils=require('../../config/utils');var config=require(_0xcc8f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xcc8f('0x19'))['db'];function respondWithStatusCode(_0x15bf3d,_0x37f235){_0x37f235=_0x37f235||0xcc;return function(_0x2c7e89){if(_0x2c7e89){return _0x15bf3d[_0xcc8f('0x1a')](_0x37f235);}return _0x15bf3d[_0xcc8f('0x1b')](_0x37f235)[_0xcc8f('0x1c')]();};}function respondWithResult(_0x2727ec,_0x2297bd){_0x2297bd=_0x2297bd||0xc8;return function(_0x4d92fd){if(_0x4d92fd){return _0x2727ec[_0xcc8f('0x1b')](_0x2297bd)['json'](_0x4d92fd);}};}function respondWithFilteredResult(_0x24af8a,_0x3dca19){return function(_0x566ed1){if(_0x566ed1){var _0x2f8e4a=typeof _0x3dca19[_0xcc8f('0x1d')]===_0xcc8f('0x1e')&&typeof _0x3dca19[_0xcc8f('0x1f')]===_0xcc8f('0x1e');var _0x53c408=_0x566ed1[_0xcc8f('0x20')];var _0x27d2f7=_0x2f8e4a?0x0:_0x3dca19[_0xcc8f('0x1d')];var _0x1b2fb9=_0x2f8e4a?_0x566ed1[_0xcc8f('0x20')]:_0x3dca19['offset']+_0x3dca19[_0xcc8f('0x1f')];var _0x210722;if(_0x1b2fb9>=_0x53c408){_0x1b2fb9=_0x53c408;_0x210722=0xc8;}else{_0x210722=0xce;}_0x24af8a['status'](_0x210722);return _0x24af8a[_0xcc8f('0x21')](_0xcc8f('0x22'),_0x27d2f7+'-'+_0x1b2fb9+'/'+_0x53c408)[_0xcc8f('0x23')](_0x566ed1);}return null;};}function patchUpdates(_0x68b9cc){return function(_0x3bb800){try{jsonpatch['apply'](_0x3bb800,_0x68b9cc,!![]);}catch(_0x3e2462){return BPromise['reject'](_0x3e2462);}return _0x3bb800[_0xcc8f('0x24')]();};}function saveUpdates(_0x3678b6,_0x2f4546){return function(_0x2b20ad){if(_0x2b20ad){return _0x2b20ad[_0xcc8f('0x25')](_0x3678b6)[_0xcc8f('0x26')](function(_0x2d8a34){return _0x2d8a34;});}return null;};}function removeEntity(_0x4cb9f7,_0xa0af80){return function(_0x100699){if(_0x100699){return _0x100699[_0xcc8f('0x27')]()[_0xcc8f('0x26')](function(){_0x4cb9f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ccf68,_0x193008){return function(_0x5bfc1d){if(!_0x5bfc1d){_0x1ccf68[_0xcc8f('0x1a')](0x194);}return _0x5bfc1d;};}function handleError(_0x477c47,_0x5a95e7){_0x5a95e7=_0x5a95e7||0x1f4;return function(_0x444a5d){logger[_0xcc8f('0x28')](_0x444a5d[_0xcc8f('0x29')]);if(_0x444a5d['name']){delete _0x444a5d[_0xcc8f('0x2a')];}_0x477c47['status'](_0x5a95e7)[_0xcc8f('0x2b')](_0x444a5d);};}exports[_0xcc8f('0x2c')]=function(_0x749f5a,_0x4ba0cc){var _0x56286e={},_0x41b395={},_0x2801ab={'count':0x0,'rows':[]};var _0x12d9dd=_['map'](db['FaxTransferReport'][_0xcc8f('0x2d')],function(_0x4bb6a4){return{'name':_0x4bb6a4[_0xcc8f('0x2e')],'type':_0x4bb6a4[_0xcc8f('0x2f')][_0xcc8f('0x30')]};});_0x41b395[_0xcc8f('0x31')]=_[_0xcc8f('0x32')](_0x12d9dd,_0xcc8f('0x2a'));_0x41b395[_0xcc8f('0x33')]=_[_0xcc8f('0x34')](_0x749f5a[_0xcc8f('0x33')]);_0x41b395['filters']=_['intersection'](_0x41b395[_0xcc8f('0x31')],_0x41b395[_0xcc8f('0x33')]);_0x56286e[_0xcc8f('0x35')]=_['intersection'](_0x41b395['model'],qs[_0xcc8f('0x36')](_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x36')]));_0x56286e[_0xcc8f('0x35')]=_0x56286e['attributes'][_0xcc8f('0x37')]?_0x56286e['attributes']:_0x41b395[_0xcc8f('0x31')];if(!_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x38')](_0xcc8f('0x39'))){_0x56286e[_0xcc8f('0x1f')]=qs[_0xcc8f('0x1f')](_0x749f5a[_0xcc8f('0x33')]['limit']);_0x56286e['offset']=qs['offset'](_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x1d')]);}_0x56286e['order']=qs[_0xcc8f('0x3a')](_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x3a')]);_0x56286e[_0xcc8f('0x3b')]=qs['filters'](_['pick'](_0x749f5a[_0xcc8f('0x33')],_0x41b395[_0xcc8f('0x3c')]),_0x12d9dd);if(_0x749f5a[_0xcc8f('0x33')]['filter']){_0x56286e['where']=_['merge'](_0x56286e[_0xcc8f('0x3b')],{'$or':_[_0xcc8f('0x32')](_0x12d9dd,function(_0x5c1d6a){if(_0x5c1d6a['type']!=='VIRTUAL'){var _0x3d3a9f={};_0x3d3a9f[_0x5c1d6a[_0xcc8f('0x2a')]]={'$like':'%'+_0x749f5a['query'][_0xcc8f('0x3d')]+'%'};return _0x3d3a9f;}})});}_0x56286e=_[_0xcc8f('0x3e')]({},_0x56286e,_0x749f5a[_0xcc8f('0x3f')]);var _0x56dcfb={'where':_0x56286e[_0xcc8f('0x3b')]};return db[_0xcc8f('0x40')][_0xcc8f('0x20')](_0x56dcfb)['then'](function(_0x42c70f){_0x2801ab['count']=_0x42c70f;if(_0x749f5a[_0xcc8f('0x33')][_0xcc8f('0x41')]){_0x56286e[_0xcc8f('0x42')]=[{'all':!![]}];}return db[_0xcc8f('0x40')][_0xcc8f('0x43')](_0x56286e);})[_0xcc8f('0x26')](function(_0x3895a0){_0x2801ab[_0xcc8f('0x44')]=_0x3895a0;return _0x2801ab;})[_0xcc8f('0x26')](respondWithFilteredResult(_0x4ba0cc,_0x56286e))[_0xcc8f('0x45')](handleError(_0x4ba0cc,null));};exports[_0xcc8f('0x46')]=function(_0x21c006,_0x5cee7c){var _0x4aea77={'raw':!![],'where':{'id':_0x21c006[_0xcc8f('0x47')]['id']}},_0x184c0f={};_0x184c0f['model']=_['keys'](db[_0xcc8f('0x40')]['rawAttributes']);_0x184c0f[_0xcc8f('0x33')]=_['keys'](_0x21c006['query']);_0x184c0f[_0xcc8f('0x3c')]=_['intersection'](_0x184c0f[_0xcc8f('0x31')],_0x184c0f[_0xcc8f('0x33')]);_0x4aea77[_0xcc8f('0x35')]=_[_0xcc8f('0x48')](_0x184c0f[_0xcc8f('0x31')],qs[_0xcc8f('0x36')](_0x21c006['query'][_0xcc8f('0x36')]));_0x4aea77[_0xcc8f('0x35')]=_0x4aea77['attributes'][_0xcc8f('0x37')]?_0x4aea77[_0xcc8f('0x35')]:_0x184c0f['model'];if(_0x21c006[_0xcc8f('0x33')]['includeAll']){_0x4aea77[_0xcc8f('0x42')]=[{'all':!![]}];}_0x4aea77=_['merge']({},_0x4aea77,_0x21c006[_0xcc8f('0x3f')]);return db[_0xcc8f('0x40')][_0xcc8f('0x49')](_0x4aea77)[_0xcc8f('0x26')](handleEntityNotFound(_0x5cee7c,null))[_0xcc8f('0x26')](respondWithResult(_0x5cee7c,null))[_0xcc8f('0x45')](handleError(_0x5cee7c,null));};exports[_0xcc8f('0x4a')]=function(_0x524ca4,_0x1d0e0e){return db[_0xcc8f('0x40')]['create'](_0x524ca4[_0xcc8f('0x4b')],{})['then'](respondWithResult(_0x1d0e0e,0xc9))[_0xcc8f('0x45')](handleError(_0x1d0e0e,null));};exports[_0xcc8f('0x25')]=function(_0x2f1c36,_0x588769){if(_0x2f1c36['body']['id']){delete _0x2f1c36[_0xcc8f('0x4b')]['id'];}return db[_0xcc8f('0x40')][_0xcc8f('0x49')]({'where':{'id':_0x2f1c36['params']['id']}})[_0xcc8f('0x26')](handleEntityNotFound(_0x588769,null))[_0xcc8f('0x26')](saveUpdates(_0x2f1c36['body'],null))[_0xcc8f('0x26')](respondWithResult(_0x588769,null))[_0xcc8f('0x45')](handleError(_0x588769,null));};exports[_0xcc8f('0x27')]=function(_0x3d2839,_0x18a929){return db[_0xcc8f('0x40')][_0xcc8f('0x49')]({'where':{'id':_0x3d2839[_0xcc8f('0x47')]['id']}})['then'](handleEntityNotFound(_0x18a929,null))[_0xcc8f('0x26')](removeEntity(_0x18a929,null))[_0xcc8f('0x45')](handleError(_0x18a929,null));};exports[_0xcc8f('0x4c')]=function(_0x2e85e6,_0x1533c4){return db[_0xcc8f('0x40')]['describe']()[_0xcc8f('0x26')](respondWithResult(_0x1533c4,null))[_0xcc8f('0x45')](handleError(_0x1533c4,null));};
\ No newline at end of file
index 26d18cc..eb8768d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9d53=['uniqueid','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x81f0fc,_0x2c5785){var _0xd4667d=function(_0x5c4849){while(--_0x5c4849){_0x81f0fc['push'](_0x81f0fc['shift']());}};_0xd4667d(++_0x2c5785);}(_0x9d53,0xf1));var _0x39d5=function(_0x3b8403,_0x91126d){_0x3b8403=_0x3b8403-0x0;var _0x2ec902=_0x9d53[_0x3b8403];return _0x2ec902;};'use strict';var _=require(_0x39d5('0x0'));var util=require('util');var logger=require(_0x39d5('0x1'))('api');var moment=require(_0x39d5('0x2'));var BPromise=require('bluebird');var rp=require(_0x39d5('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x39d5('0x4'));var config=require(_0x39d5('0x5'));var attributes=require(_0x39d5('0x6'));module[_0x39d5('0x7')]=function(_0x28c41e,_0x2d833c){return _0x28c41e[_0x39d5('0x8')](_0x39d5('0x9'),attributes,{'tableName':_0x39d5('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x39d5('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x792f=['rimraf','../../config/environment','exports','define','FaxTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','path'];(function(_0x5ddaac,_0x2697a8){var _0x2a9c58=function(_0x851032){while(--_0x851032){_0x5ddaac['push'](_0x5ddaac['shift']());}};_0x2a9c58(++_0x2697a8);}(_0x792f,0x10e));var _0xf792=function(_0xd39959,_0x302d09){_0xd39959=_0xd39959-0x0;var _0x1ff69c=_0x792f[_0xd39959];return _0x1ff69c;};'use strict';var _=require('lodash');var util=require(_0xf792('0x0'));var logger=require(_0xf792('0x1'))(_0xf792('0x2'));var moment=require(_0xf792('0x3'));var BPromise=require(_0xf792('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf792('0x5'));var rimraf=require(_0xf792('0x6'));var config=require(_0xf792('0x7'));var attributes=require('./faxTransferReport.attributes');module[_0xf792('0x8')]=function(_0x121909,_0x357d6e){return _0x121909[_0xf792('0x9')](_0xf792('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xf792('0xb'),'fields':[_0xf792('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 27d9b5b..25640ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3693=['jayson/promise','client','http','request','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0xc53f0f,_0x2331c2){var _0x35a63a=function(_0x36c048){while(--_0x36c048){_0xc53f0f['push'](_0xc53f0f['shift']());}};_0x35a63a(++_0x2331c2);}(_0x3693,0xaf));var _0x3369=function(_0x2779db,_0x2b755a){_0x2779db=_0x2779db-0x0;var _0x37cc58=_0x3693[_0x2779db];return _0x37cc58;};'use strict';var _=require('lodash');var util=require(_0x3369('0x0'));var moment=require(_0x3369('0x1'));var BPromise=require(_0x3369('0x2'));var rs=require(_0x3369('0x3'));var fs=require('fs');var Redis=require(_0x3369('0x4'));var db=require(_0x3369('0x5'))['db'];var utils=require(_0x3369('0x6'));var logger=require(_0x3369('0x7'))('rpc');var config=require(_0x3369('0x8'));var jayson=require(_0x3369('0x9'));var client=jayson[_0x3369('0xa')][_0x3369('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x26f03e,_0x427234,_0x2bb133){return new BPromise(function(_0x38c977,_0x4397c9){return client[_0x3369('0xc')](_0x26f03e,_0x2bb133)[_0x3369('0xd')](function(_0x14a3f2){logger[_0x3369('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x427234,_0x3369('0xf'));logger['debug'](_0x3369('0x10'),_0x427234,'request\x20sent',JSON[_0x3369('0x11')](_0x14a3f2));if(_0x14a3f2[_0x3369('0x12')]){if(_0x14a3f2[_0x3369('0x12')][_0x3369('0x13')]===0x1f4){logger[_0x3369('0x12')](_0x3369('0x14'),_0x427234,_0x14a3f2[_0x3369('0x12')]['message']);return _0x4397c9(_0x14a3f2['error'][_0x3369('0x15')]);}logger['error'](_0x3369('0x14'),_0x427234,_0x14a3f2[_0x3369('0x12')][_0x3369('0x15')]);return _0x38c977(_0x14a3f2[_0x3369('0x12')][_0x3369('0x15')]);}else{logger[_0x3369('0xe')](_0x3369('0x14'),_0x427234,_0x3369('0xf'));_0x38c977(_0x14a3f2['result'][_0x3369('0x15')]);}})[_0x3369('0x16')](function(_0x427b17){logger[_0x3369('0x12')](_0x3369('0x14'),_0x427234,_0x427b17);_0x4397c9(_0x427b17);});});}
\ No newline at end of file
+var _0x1107=['info','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x1107,0xcb));var _0x7110=function(_0x3fe1ba,_0x1a33c5){_0x3fe1ba=_0x3fe1ba-0x0;var _0x5df1b4=_0x1107[_0x3fe1ba];return _0x5df1b4;};'use strict';var _=require('lodash');var util=require(_0x7110('0x0'));var moment=require(_0x7110('0x1'));var BPromise=require(_0x7110('0x2'));var rs=require(_0x7110('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7110('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7110('0x5'))(_0x7110('0x6'));var config=require(_0x7110('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7110('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2aefa3,_0x48a160,_0x3038e8){return new BPromise(function(_0x579fd9,_0x3ebde7){return client[_0x7110('0x9')](_0x2aefa3,_0x3038e8)[_0x7110('0xa')](function(_0x208056){logger['info'](_0x7110('0xb'),_0x48a160,_0x7110('0xc'));logger[_0x7110('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x48a160,'request\x20sent',JSON['stringify'](_0x208056));if(_0x208056[_0x7110('0xe')]){if(_0x208056[_0x7110('0xe')][_0x7110('0xf')]===0x1f4){logger[_0x7110('0xe')]('FaxTransferReport,\x20%s,\x20%s',_0x48a160,_0x208056[_0x7110('0xe')][_0x7110('0x10')]);return _0x3ebde7(_0x208056[_0x7110('0xe')][_0x7110('0x10')]);}logger['error'](_0x7110('0xb'),_0x48a160,_0x208056[_0x7110('0xe')][_0x7110('0x10')]);return _0x579fd9(_0x208056[_0x7110('0xe')][_0x7110('0x10')]);}else{logger[_0x7110('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x48a160,'request\x20sent');_0x579fd9(_0x208056[_0x7110('0x12')][_0x7110('0x10')]);}})[_0x7110('0x13')](function(_0x15764b){logger['error'](_0x7110('0xb'),_0x48a160,_0x15764b);_0x3ebde7(_0x15764b);});});}
\ No newline at end of file
index 040f26b..0db2ab8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa82=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index'];(function(_0x54bf67,_0x5381e5){var _0x5f18a9=function(_0x5fea82){while(--_0x5fea82){_0x54bf67['push'](_0x54bf67['shift']());}};_0x5f18a9(++_0x5381e5);}(_0xaa82,0x184));var _0x2aa8=function(_0x2817c6,_0x2618f1){_0x2817c6=_0x2817c6-0x0;var _0x292da0=_0xaa82[_0x2817c6];return _0x292da0;};'use strict';var multer=require(_0x2aa8('0x0'));var util=require(_0x2aa8('0x1'));var path=require(_0x2aa8('0x2'));var timeout=require(_0x2aa8('0x3'));var express=require('express');var router=express[_0x2aa8('0x4')]();var fs_extra=require(_0x2aa8('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2aa8('0x6'));var controller=require(_0x2aa8('0x7'));router[_0x2aa8('0x8')]('/',auth[_0x2aa8('0x9')](),controller[_0x2aa8('0xa')]);router[_0x2aa8('0x8')](_0x2aa8('0xb'),auth[_0x2aa8('0x9')](),controller[_0x2aa8('0xc')]);router[_0x2aa8('0x8')](_0x2aa8('0xd'),auth[_0x2aa8('0x9')](),controller['show']);router[_0x2aa8('0xe')]('/',auth['isAuthenticated'](),controller[_0x2aa8('0xf')]);router[_0x2aa8('0x10')](_0x2aa8('0xd'),auth['isAuthenticated'](),controller[_0x2aa8('0x11')]);router[_0x2aa8('0x12')](_0x2aa8('0xd'),auth[_0x2aa8('0x9')](),controller[_0x2aa8('0x13')]);module[_0x2aa8('0x14')]=router;
\ No newline at end of file
+var _0xcc1e=['show','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2bd0d7,_0x158fb3){var _0x3f3d78=function(_0x204a96){while(--_0x204a96){_0x2bd0d7['push'](_0x2bd0d7['shift']());}};_0x3f3d78(++_0x158fb3);}(_0xcc1e,0x71));var _0xecc1=function(_0xea8272,_0x1bad50){_0xea8272=_0xea8272-0x0;var _0x117bd0=_0xcc1e[_0xea8272];return _0x117bd0;};'use strict';var multer=require(_0xecc1('0x0'));var util=require('util');var path=require(_0xecc1('0x1'));var timeout=require(_0xecc1('0x2'));var express=require(_0xecc1('0x3'));var router=express[_0xecc1('0x4')]();var fs_extra=require(_0xecc1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xecc1('0x6'));var config=require('../../config/environment');var controller=require(_0xecc1('0x7'));router[_0xecc1('0x8')]('/',auth[_0xecc1('0x9')](),controller[_0xecc1('0xa')]);router[_0xecc1('0x8')](_0xecc1('0xb'),auth[_0xecc1('0x9')](),controller[_0xecc1('0xc')]);router[_0xecc1('0x8')]('/:id',auth[_0xecc1('0x9')](),controller[_0xecc1('0xd')]);router[_0xecc1('0xe')]('/',auth[_0xecc1('0x9')](),controller['create']);router[_0xecc1('0xf')](_0xecc1('0x10'),auth['isAuthenticated'](),controller[_0xecc1('0x11')]);router[_0xecc1('0x12')](_0xecc1('0x10'),auth[_0xecc1('0x9')](),controller[_0xecc1('0x13')]);module[_0xecc1('0x14')]=router;
\ No newline at end of file
index e46f171..0cfbb8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27c1=['addConfiguration','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','/:id/fields','post','create','/:id/configurations'];(function(_0x331637,_0x171f5f){var _0x1ffc26=function(_0x548b7b){while(--_0x548b7b){_0x331637['push'](_0x331637['shift']());}};_0x1ffc26(++_0x171f5f);}(_0x27c1,0x98));var _0x127c=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x27c1[_0x4792c8];return _0x35edb1;};'use strict';var multer=require(_0x127c('0x0'));var util=require(_0x127c('0x1'));var path=require('path');var timeout=require(_0x127c('0x2'));var express=require(_0x127c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x127c('0x4'));var interaction=require(_0x127c('0x5'));var config=require(_0x127c('0x6'));var controller=require(_0x127c('0x7'));router[_0x127c('0x8')]('/',auth[_0x127c('0x9')](),controller[_0x127c('0xa')]);router[_0x127c('0x8')](_0x127c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x127c('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x127c('0x8')](_0x127c('0xc'),auth[_0x127c('0x9')](),controller['getFields']);router[_0x127c('0xd')]('/',auth[_0x127c('0x9')](),controller[_0x127c('0xe')]);router[_0x127c('0xd')](_0x127c('0xf'),auth['isAuthenticated'](),controller[_0x127c('0x10')]);router[_0x127c('0x11')]('/:id',auth[_0x127c('0x9')](),controller[_0x127c('0x12')]);router[_0x127c('0x13')]('/:id',auth[_0x127c('0x9')](),controller['destroy']);module[_0x127c('0x14')]=router;
\ No newline at end of file
+var _0x4431=['put','update','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4431,0x10c));var _0x1443=function(_0x140c76,_0x52ff6e){_0x140c76=_0x140c76-0x0;var _0x20b0fe=_0x4431[_0x140c76];return _0x20b0fe;};'use strict';var multer=require('multer');var util=require(_0x1443('0x0'));var path=require(_0x1443('0x1'));var timeout=require('connect-timeout');var express=require(_0x1443('0x2'));var router=express[_0x1443('0x3')]();var fs_extra=require(_0x1443('0x4'));var auth=require(_0x1443('0x5'));var interaction=require(_0x1443('0x6'));var config=require(_0x1443('0x7'));var controller=require(_0x1443('0x8'));router[_0x1443('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1443('0x9')](_0x1443('0xa'),auth[_0x1443('0xb')](),controller[_0x1443('0xc')]);router[_0x1443('0x9')]('/:id/configurations',auth[_0x1443('0xb')](),controller[_0x1443('0xd')]);router['get'](_0x1443('0xe'),auth[_0x1443('0xb')](),controller[_0x1443('0xf')]);router['post']('/',auth[_0x1443('0xb')](),controller[_0x1443('0x10')]);router[_0x1443('0x11')]('/:id/configurations',auth[_0x1443('0xb')](),controller['addConfiguration']);router[_0x1443('0x12')](_0x1443('0xa'),auth[_0x1443('0xb')](),controller[_0x1443('0x13')]);router[_0x1443('0x14')](_0x1443('0xa'),auth['isAuthenticated'](),controller[_0x1443('0x15')]);module['exports']=router;
\ No newline at end of file
index 94b6e58..cb2ffe1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf468=['STRING','ENUM','basic','integrationTab','sequelize','exports'];(function(_0x3f3bad,_0x193f06){var _0x4f0801=function(_0x5cfd32){while(--_0x5cfd32){_0x3f3bad['push'](_0x3f3bad['shift']());}};_0x4f0801(++_0x193f06);}(_0xf468,0x190));var _0x8f46=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xf468[_0x3899d1];return _0xeb4a7d;};'use strict';var Sequelize=require(_0x8f46('0x0'));module[_0x8f46('0x1')]={'name':{'type':Sequelize[_0x8f46('0x2')]},'description':{'type':Sequelize[_0x8f46('0x2')]},'username':{'type':Sequelize[_0x8f46('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x8f46('0x3')]('basic'),'defaultValue':_0x8f46('0x4')},'password':{'type':Sequelize[_0x8f46('0x2')]},'consumerKey':{'type':Sequelize[_0x8f46('0x2')]},'consumerSecret':{'type':Sequelize[_0x8f46('0x2')]},'token':{'type':Sequelize[_0x8f46('0x2')]},'tokenSecret':{'type':Sequelize[_0x8f46('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8f46('0x3')](_0x8f46('0x5'),'newTab'),'defaultValue':_0x8f46('0x5')}};
\ No newline at end of file
+var _0xaf66=['basic','integrationTab','sequelize','exports','STRING','ENUM'];(function(_0x482bc3,_0x3d5ab){var _0x458dbe=function(_0x9600eb){while(--_0x9600eb){_0x482bc3['push'](_0x482bc3['shift']());}};_0x458dbe(++_0x3d5ab);}(_0xaf66,0x19a));var _0x6af6=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0xaf66[_0x13ac10];return _0x28eda2;};'use strict';var Sequelize=require(_0x6af6('0x0'));module[_0x6af6('0x1')]={'name':{'type':Sequelize[_0x6af6('0x2')]},'description':{'type':Sequelize[_0x6af6('0x2')]},'username':{'type':Sequelize[_0x6af6('0x2')]},'remoteUri':{'type':Sequelize[_0x6af6('0x2')]},'authType':{'type':Sequelize[_0x6af6('0x3')](_0x6af6('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x6af6('0x2')]},'consumerKey':{'type':Sequelize[_0x6af6('0x2')]},'consumerSecret':{'type':Sequelize[_0x6af6('0x2')]},'token':{'type':Sequelize[_0x6af6('0x2')]},'tokenSecret':{'type':Sequelize[_0x6af6('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6af6('0x3')](_0x6af6('0x5'),'newTab'),'defaultValue':_0x6af6('0x5')}};
\ No newline at end of file
index afcb15e..b3ab726 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8565=['test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','sendStatus','error','name','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','then','catch','show','params','keys','find','create','body','update','getConfigurations','findOne','DeskConfiguration','length','AccountId','getSubjects','Descriptions','getDescriptions','channel','priority','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','lastIndexOf','GET','%s/custom_fields','application/json','authType','basic','headers','Authorization','format','Basic\x20%s','%s:%s','base64','concat','_embedded','active'];(function(_0x4c4c8e,_0xf52732){var _0x15ea39=function(_0x11d720){while(--_0x11d720){_0x4c4c8e['push'](_0x4c4c8e['shift']());}};_0x15ea39(++_0xf52732);}(_0x8565,0xe4));var _0x5856=function(_0x51789a,_0x46c0bb){_0x51789a=_0x51789a-0x0;var _0x122a01=_0x8565[_0x51789a];return _0x122a01;};'use strict';var emlformat=require(_0x5856('0x0'));var rimraf=require(_0x5856('0x1'));var zipdir=require(_0x5856('0x2'));var jsonpatch=require(_0x5856('0x3'));var rp=require(_0x5856('0x4'));var moment=require(_0x5856('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5856('0x6'));var util=require(_0x5856('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5856('0x8'));var _=require(_0x5856('0x9'));var squel=require(_0x5856('0xa'));var crypto=require('crypto');var jsforce=require(_0x5856('0xb'));var deskjs=require(_0x5856('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5856('0xd'));var Papa=require(_0x5856('0xe'));var Redis=require(_0x5856('0xf'));var authService=require(_0x5856('0x10'));var qs=require(_0x5856('0x11'));var as=require(_0x5856('0x12'));var hardwareService=require(_0x5856('0x13'));var logger=require(_0x5856('0x14'))(_0x5856('0x15'));var utils=require(_0x5856('0x16'));var config=require(_0x5856('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5856('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x921eb5,_0x4b48c6){_0x4b48c6=_0x4b48c6||0xcc;return function(_0x3f2b2d){if(_0x3f2b2d){return _0x921eb5['sendStatus'](_0x4b48c6);}return _0x921eb5['status'](_0x4b48c6)[_0x5856('0x19')]();};}function respondWithResult(_0x366f88,_0x2cbcb4){_0x2cbcb4=_0x2cbcb4||0xc8;return function(_0x1fea1a){if(_0x1fea1a){return _0x366f88[_0x5856('0x1a')](_0x2cbcb4)['json'](_0x1fea1a);}};}function respondWithFilteredResult(_0x1eafd8,_0x55dda3){return function(_0xcad855){if(_0xcad855){var _0x288a30=typeof _0x55dda3[_0x5856('0x1b')]===_0x5856('0x1c')&&typeof _0x55dda3[_0x5856('0x1d')]===_0x5856('0x1c');var _0x4085c0=_0xcad855[_0x5856('0x1e')];var _0xb6921f=_0x288a30?0x0:_0x55dda3['offset'];var _0x26f76f=_0x288a30?_0xcad855[_0x5856('0x1e')]:_0x55dda3['offset']+_0x55dda3['limit'];var _0x3a5835;if(_0x26f76f>=_0x4085c0){_0x26f76f=_0x4085c0;_0x3a5835=0xc8;}else{_0x3a5835=0xce;}_0x1eafd8[_0x5856('0x1a')](_0x3a5835);return _0x1eafd8[_0x5856('0x1f')](_0x5856('0x20'),_0xb6921f+'-'+_0x26f76f+'/'+_0x4085c0)['json'](_0xcad855);}return null;};}function patchUpdates(_0x5cba2a){return function(_0x4adbdd){try{jsonpatch[_0x5856('0x21')](_0x4adbdd,_0x5cba2a,!![]);}catch(_0x509ca0){return BPromise[_0x5856('0x22')](_0x509ca0);}return _0x4adbdd['save']();};}function saveUpdates(_0x2dc6b9,_0x1a07f3){return function(_0x3ae0a7){if(_0x3ae0a7){return _0x3ae0a7['update'](_0x2dc6b9)['then'](function(_0x4ec309){return _0x4ec309;});}return null;};}function removeEntity(_0x3ce60e,_0x18f8c3){return function(_0x26a52d){if(_0x26a52d){return _0x26a52d[_0x5856('0x23')]()['then'](function(){_0x3ce60e['status'](0xcc)[_0x5856('0x19')]();});}};}function handleEntityNotFound(_0x492bc0,_0x598330){return function(_0x595c2f){if(!_0x595c2f){_0x492bc0[_0x5856('0x24')](0x194);}return _0x595c2f;};}function handleError(_0xbb1e16,_0x3eca20){_0x3eca20=_0x3eca20||0x1f4;return function(_0x3ec39e){logger[_0x5856('0x25')](_0x3ec39e['stack']);if(_0x3ec39e['name']){delete _0x3ec39e[_0x5856('0x26')];}_0xbb1e16[_0x5856('0x1a')](_0x3eca20)['send'](_0x3ec39e);};}exports[_0x5856('0x27')]=function(_0x327a52,_0x21de65){var _0x39aaf4={},_0x16b9f1={},_0x199797={'count':0x0,'rows':[]};var _0xd5a2ac=_[_0x5856('0x28')](db[_0x5856('0x29')][_0x5856('0x2a')],function(_0x3cf6d7){return{'name':_0x3cf6d7[_0x5856('0x2b')],'type':_0x3cf6d7[_0x5856('0x2c')][_0x5856('0x2d')]};});_0x16b9f1[_0x5856('0x2e')]=_[_0x5856('0x28')](_0xd5a2ac,'name');_0x16b9f1[_0x5856('0x2f')]=_['keys'](_0x327a52['query']);_0x16b9f1[_0x5856('0x30')]=_['intersection'](_0x16b9f1['model'],_0x16b9f1[_0x5856('0x2f')]);_0x39aaf4[_0x5856('0x31')]=_[_0x5856('0x32')](_0x16b9f1['model'],qs[_0x5856('0x33')](_0x327a52[_0x5856('0x2f')]['fields']));_0x39aaf4[_0x5856('0x31')]=_0x39aaf4['attributes']['length']?_0x39aaf4[_0x5856('0x31')]:_0x16b9f1['model'];if(!_0x327a52[_0x5856('0x2f')]['hasOwnProperty'](_0x5856('0x34'))){_0x39aaf4[_0x5856('0x1d')]=qs[_0x5856('0x1d')](_0x327a52['query'][_0x5856('0x1d')]);_0x39aaf4[_0x5856('0x1b')]=qs[_0x5856('0x1b')](_0x327a52['query'][_0x5856('0x1b')]);}_0x39aaf4[_0x5856('0x35')]=qs[_0x5856('0x36')](_0x327a52['query'][_0x5856('0x36')]);_0x39aaf4['where']=qs[_0x5856('0x30')](_[_0x5856('0x37')](_0x327a52[_0x5856('0x2f')],_0x16b9f1[_0x5856('0x30')]),_0xd5a2ac);if(_0x327a52['query']['filter']){_0x39aaf4[_0x5856('0x38')]=_[_0x5856('0x39')](_0x39aaf4[_0x5856('0x38')],{'$or':_[_0x5856('0x28')](_0xd5a2ac,function(_0x59d26c){if(_0x59d26c[_0x5856('0x2c')]!==_0x5856('0x3a')){var _0xee6ceb={};_0xee6ceb[_0x59d26c[_0x5856('0x26')]]={'$like':'%'+_0x327a52[_0x5856('0x2f')][_0x5856('0x3b')]+'%'};return _0xee6ceb;}})});}_0x39aaf4=_[_0x5856('0x39')]({},_0x39aaf4,_0x327a52[_0x5856('0x3c')]);var _0x545137={'where':_0x39aaf4[_0x5856('0x38')]};return db[_0x5856('0x29')][_0x5856('0x1e')](_0x545137)['then'](function(_0x158d27){_0x199797[_0x5856('0x1e')]=_0x158d27;if(_0x327a52['query'][_0x5856('0x3d')]){_0x39aaf4[_0x5856('0x3e')]=[{'all':!![]}];}return db['DeskAccount'][_0x5856('0x3f')](_0x39aaf4);})['then'](function(_0x6d6800){_0x199797[_0x5856('0x40')]=_0x6d6800;return _0x199797;})[_0x5856('0x41')](respondWithFilteredResult(_0x21de65,_0x39aaf4))[_0x5856('0x42')](handleError(_0x21de65,null));};exports[_0x5856('0x43')]=function(_0x5e229c,_0x23fe77){var _0x12f686={'raw':![],'where':{'id':_0x5e229c[_0x5856('0x44')]['id']}},_0x388a01={};_0x388a01[_0x5856('0x2e')]=_[_0x5856('0x45')](db[_0x5856('0x29')][_0x5856('0x2a')]);_0x388a01[_0x5856('0x2f')]=_[_0x5856('0x45')](_0x5e229c[_0x5856('0x2f')]);_0x388a01['filters']=_['intersection'](_0x388a01[_0x5856('0x2e')],_0x388a01[_0x5856('0x2f')]);_0x12f686[_0x5856('0x31')]=_[_0x5856('0x32')](_0x388a01['model'],qs[_0x5856('0x33')](_0x5e229c[_0x5856('0x2f')][_0x5856('0x33')]));_0x12f686['attributes']=_0x12f686[_0x5856('0x31')]['length']?_0x12f686[_0x5856('0x31')]:_0x388a01[_0x5856('0x2e')];if(_0x5e229c[_0x5856('0x2f')][_0x5856('0x3d')]){_0x12f686[_0x5856('0x3e')]=[{'all':!![]}];}_0x12f686=_[_0x5856('0x39')]({},_0x12f686,_0x5e229c['options']);return db['DeskAccount'][_0x5856('0x46')](_0x12f686)[_0x5856('0x41')](handleEntityNotFound(_0x23fe77,null))[_0x5856('0x41')](respondWithResult(_0x23fe77,null))[_0x5856('0x42')](handleError(_0x23fe77,null));};exports[_0x5856('0x47')]=function(_0x3ae709,_0x745620){return db[_0x5856('0x29')][_0x5856('0x47')](_0x3ae709[_0x5856('0x48')],{})['then'](respondWithResult(_0x745620,0xc9))[_0x5856('0x42')](handleError(_0x745620,null));};exports[_0x5856('0x49')]=function(_0x29ff56,_0x10c6cc){if(_0x29ff56[_0x5856('0x48')]['id']){delete _0x29ff56[_0x5856('0x48')]['id'];}return db['DeskAccount'][_0x5856('0x46')]({'where':{'id':_0x29ff56[_0x5856('0x44')]['id']}})['then'](handleEntityNotFound(_0x10c6cc,null))[_0x5856('0x41')](saveUpdates(_0x29ff56['body'],null))['then'](respondWithResult(_0x10c6cc,null))['catch'](handleError(_0x10c6cc,null));};exports[_0x5856('0x23')]=function(_0x1f6366,_0x5747c8){return db[_0x5856('0x29')][_0x5856('0x46')]({'where':{'id':_0x1f6366[_0x5856('0x44')]['id']}})[_0x5856('0x41')](handleEntityNotFound(_0x5747c8,null))[_0x5856('0x41')](removeEntity(_0x5747c8,null))[_0x5856('0x42')](handleError(_0x5747c8,null));};exports[_0x5856('0x4a')]=function(_0x3ad9fd,_0x4a1d1f,_0x4a8197){var _0x324639={};var _0x14409f={};var _0x57ccba;var _0xac42be;return db[_0x5856('0x29')][_0x5856('0x4b')]({'where':{'id':_0x3ad9fd['params']['id']}})['then'](handleEntityNotFound(_0x4a1d1f,null))[_0x5856('0x41')](function(_0x3fa9df){if(_0x3fa9df){_0x57ccba=_0x3fa9df;_0x14409f[_0x5856('0x2e')]=_[_0x5856('0x45')](db[_0x5856('0x4c')][_0x5856('0x2a')]);_0x14409f[_0x5856('0x2f')]=_['keys'](_0x3ad9fd[_0x5856('0x2f')]);_0x14409f[_0x5856('0x30')]=_[_0x5856('0x32')](_0x14409f[_0x5856('0x2e')],_0x14409f[_0x5856('0x2f')]);_0x324639[_0x5856('0x31')]=_[_0x5856('0x32')](_0x14409f[_0x5856('0x2e')],qs[_0x5856('0x33')](_0x3ad9fd['query'][_0x5856('0x33')]));_0x324639[_0x5856('0x31')]=_0x324639[_0x5856('0x31')]['length']?_0x324639[_0x5856('0x31')]:_0x14409f[_0x5856('0x2e')];_0x324639[_0x5856('0x35')]=qs[_0x5856('0x36')](_0x3ad9fd[_0x5856('0x2f')][_0x5856('0x36')]);_0x324639[_0x5856('0x38')]=qs[_0x5856('0x30')](_[_0x5856('0x37')](_0x3ad9fd[_0x5856('0x2f')],_0x14409f[_0x5856('0x30')]));if(_0x3ad9fd[_0x5856('0x2f')]['filter']){_0x324639[_0x5856('0x38')]=_['merge'](_0x324639[_0x5856('0x38')],{'$or':_[_0x5856('0x28')](_0x324639[_0x5856('0x31')],function(_0x5057f3){var _0x31eb19={};_0x31eb19[_0x5057f3]={'$like':'%'+_0x3ad9fd[_0x5856('0x2f')][_0x5856('0x3b')]+'%'};return _0x31eb19;})});}_0x324639=_[_0x5856('0x39')]({},_0x324639,_0x3ad9fd[_0x5856('0x3c')]);return _0x57ccba[_0x5856('0x4a')](_0x324639);}})[_0x5856('0x41')](function(_0x517914){if(_0x517914){_0xac42be=_0x517914[_0x5856('0x4d')];if(!_0x3ad9fd['query']['hasOwnProperty'](_0x5856('0x34'))){_0x324639['limit']=qs[_0x5856('0x1d')](_0x3ad9fd[_0x5856('0x2f')]['limit']);_0x324639[_0x5856('0x1b')]=qs['offset'](_0x3ad9fd[_0x5856('0x2f')][_0x5856('0x1b')]);}return _0x57ccba['getConfigurations'](_0x324639);}})[_0x5856('0x41')](function(_0x4abc46){if(_0x4abc46){return _0x4abc46?{'count':_0xac42be,'rows':_0x4abc46}:null;}})[_0x5856('0x41')](respondWithResult(_0x4a1d1f,null))['catch'](handleError(_0x4a1d1f,null));};exports['addConfiguration']=function(_0x423389,_0x336745,_0x43bbff){if(_0x423389[_0x5856('0x48')]['id']){delete _0x423389[_0x5856('0x48')]['id'];}return db[_0x5856('0x29')][_0x5856('0x4b')]({'where':{'id':_0x423389['params']['id']}})[_0x5856('0x41')](handleEntityNotFound(_0x336745,null))[_0x5856('0x41')](function(_0xb14d9f){if(_0xb14d9f){_0x423389[_0x5856('0x48')][_0x5856('0x4e')]=_0xb14d9f['id'];_0x423389['body']['Subjects']=integrations[_0x5856('0x4f')](_0x423389['body']['channel'],_0x423389[_0x5856('0x48')][_0x5856('0x2c')]);_0x423389[_0x5856('0x48')][_0x5856('0x50')]=integrations[_0x5856('0x51')](_0x423389['body'][_0x5856('0x52')],_0x423389[_0x5856('0x48')][_0x5856('0x2c')]);return db[_0x5856('0x4c')][_0x5856('0x47')](_0x423389['body'],{'include':[{'model':db['DeskField'],'as':'Subjects'},{'model':db['DeskField'],'as':_0x5856('0x50')}]});}return null;})['then'](respondWithResult(_0x336745,null))['catch'](handleError(_0x336745,null));};exports['getFields']=function(_0x225739,_0x3a0603,_0x69d44b){var _0x1c032c=[{'name':_0x5856('0x53'),'label':_0x5856('0x53'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x58455e='';return db[_0x5856('0x29')][_0x5856('0x4b')]({'where':{'id':_0x225739[_0x5856('0x44')]['id']},'attributes':['id',_0x5856('0x54'),'authType','username',_0x5856('0x55'),_0x5856('0x56'),_0x5856('0x57'),_0x5856('0x58'),_0x5856('0x59')]})['then'](handleEntityNotFound(_0x3a0603,null))[_0x5856('0x41')](function(_0x29338d){if(_0x29338d){_0x58455e=_0x29338d['remoteUri'];var _0x3ca0c8=_0x58455e['slice'](-0x1);if(_0x3ca0c8==='/'){_0x58455e=_0x58455e['substring'](0x0,_0x58455e[_0x5856('0x5a')](_0x3ca0c8));}var _0x145f61={'method':_0x5856('0x5b'),'uri':util['format'](_0x5856('0x5c'),_0x58455e),'headers':{'Content-Type':_0x5856('0x5d'),'Accept':_0x5856('0x5d')},'json':!![]};if(_0x29338d[_0x5856('0x5e')]===_0x5856('0x5f')){_0x145f61[_0x5856('0x60')][_0x5856('0x61')]=util[_0x5856('0x62')](_0x5856('0x63'),new Buffer(util[_0x5856('0x62')](_0x5856('0x64'),_0x29338d['username'],_0x29338d['password']))['toString'](_0x5856('0x65')));}return rp(_0x145f61)[_0x5856('0x41')](function(_0x2e2e3b){return _0x1c032c[_0x5856('0x66')](_['map'](_0x2e2e3b[_0x5856('0x67')]['entries'],function(_0x1a3211){return{'id':_0x1a3211[_0x5856('0x26')],'name':_0x1a3211[_0x5856('0x26')],'type':_0x1a3211['type'],'active':_0x1a3211[_0x5856('0x68')],'label':_0x1a3211['label'],'custom':!![]};}));});}})[_0x5856('0x41')](function(_0x24cf21){return{'count':_0x24cf21[_0x5856('0x4d')],'rows':_0x24cf21};})[_0x5856('0x41')](respondWithResult(_0x3a0603,null))['catch'](function(_0x3548ba){var _0x27099e=_0x225739[_0x5856('0x2f')][_0x5856('0x69')]?0x1f4:_0x3548ba[_0x5856('0x6a')]||0x1f4;logger[_0x5856('0x25')](_0x5856('0x6b'),'getFields',_0x27099e,JSON[_0x5856('0x6c')](_0x3548ba));delete _0x3548ba[_0x5856('0x26')];if(_0x27099e===0x191){_0x27099e=0x190;}_0x3a0603['status'](_0x27099e)[_0x5856('0x6d')](_0x225739[_0x5856('0x2f')][_0x5856('0x69')]?{'message':_0x5856('0x6e'),'statusCode':_0x3548ba['statusCode']}:_0x3548ba);});};
\ No newline at end of file
+var _0x875a=['includeAll','include','findAll','rows','catch','show','create','body','find','params','findOne','DeskConfiguration','getConfigurations','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','priority','authType','username','consumerSecret','token','tokenSecret','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Basic\x20%s','%s:%s','password','base64','entries','active','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','index','DeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x10d820,_0x1ff879){var _0xd75692=function(_0x4cd207){while(--_0x4cd207){_0x10d820['push'](_0x10d820['shift']());}};_0xd75692(++_0x1ff879);}(_0x875a,0x187));var _0xa875=function(_0x135061,_0x54a184){_0x135061=_0x135061-0x0;var _0x3e58af=_0x875a[_0x135061];return _0x3e58af;};'use strict';var emlformat=require(_0xa875('0x0'));var rimraf=require(_0xa875('0x1'));var zipdir=require(_0xa875('0x2'));var jsonpatch=require(_0xa875('0x3'));var rp=require(_0xa875('0x4'));var moment=require(_0xa875('0x5'));var BPromise=require(_0xa875('0x6'));var Mustache=require('mustache');var util=require(_0xa875('0x7'));var path=require(_0xa875('0x8'));var sox=require(_0xa875('0x9'));var csv=require(_0xa875('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa875('0xb'));var crypto=require(_0xa875('0xc'));var jsforce=require(_0xa875('0xd'));var deskjs=require(_0xa875('0xe'));var toCsv=require(_0xa875('0xa'));var querystring=require(_0xa875('0xf'));var Papa=require(_0xa875('0x10'));var Redis=require('ioredis');var authService=require(_0xa875('0x11'));var qs=require(_0xa875('0x12'));var as=require(_0xa875('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa875('0x14'));var utils=require(_0xa875('0x15'));var config=require(_0xa875('0x16'));var licenseUtil=require(_0xa875('0x17'));var db=require(_0xa875('0x18'))['db'];var integrations=require(_0xa875('0x19'));function respondWithStatusCode(_0x2a100d,_0x3f08b5){_0x3f08b5=_0x3f08b5||0xcc;return function(_0x338860){if(_0x338860){return _0x2a100d[_0xa875('0x1a')](_0x3f08b5);}return _0x2a100d[_0xa875('0x1b')](_0x3f08b5)['end']();};}function respondWithResult(_0x841e93,_0x3b5a51){_0x3b5a51=_0x3b5a51||0xc8;return function(_0x111cbd){if(_0x111cbd){return _0x841e93['status'](_0x3b5a51)[_0xa875('0x1c')](_0x111cbd);}};}function respondWithFilteredResult(_0x51ae33,_0x4eb266){return function(_0x5ef83e){if(_0x5ef83e){var _0x226628=typeof _0x4eb266[_0xa875('0x1d')]==='undefined'&&typeof _0x4eb266[_0xa875('0x1e')]===_0xa875('0x1f');var _0x1f5edf=_0x5ef83e[_0xa875('0x20')];var _0x39b542=_0x226628?0x0:_0x4eb266[_0xa875('0x1d')];var _0x3cbe71=_0x226628?_0x5ef83e['count']:_0x4eb266['offset']+_0x4eb266[_0xa875('0x1e')];var _0xa4b805;if(_0x3cbe71>=_0x1f5edf){_0x3cbe71=_0x1f5edf;_0xa4b805=0xc8;}else{_0xa4b805=0xce;}_0x51ae33[_0xa875('0x1b')](_0xa4b805);return _0x51ae33[_0xa875('0x21')](_0xa875('0x22'),_0x39b542+'-'+_0x3cbe71+'/'+_0x1f5edf)[_0xa875('0x1c')](_0x5ef83e);}return null;};}function patchUpdates(_0x1d42a9){return function(_0x5b1f2e){try{jsonpatch['apply'](_0x5b1f2e,_0x1d42a9,!![]);}catch(_0x419469){return BPromise[_0xa875('0x23')](_0x419469);}return _0x5b1f2e[_0xa875('0x24')]();};}function saveUpdates(_0x3bfbba,_0x75eac7){return function(_0x5d7e2f){if(_0x5d7e2f){return _0x5d7e2f[_0xa875('0x25')](_0x3bfbba)[_0xa875('0x26')](function(_0x293b71){return _0x293b71;});}return null;};}function removeEntity(_0x22d801,_0x42dcef){return function(_0x5b31d4){if(_0x5b31d4){return _0x5b31d4[_0xa875('0x27')]()[_0xa875('0x26')](function(){_0x22d801['status'](0xcc)[_0xa875('0x28')]();});}};}function handleEntityNotFound(_0x18f0b6,_0x52df1f){return function(_0x1efe72){if(!_0x1efe72){_0x18f0b6[_0xa875('0x1a')](0x194);}return _0x1efe72;};}function handleError(_0x4107ea,_0xd01270){_0xd01270=_0xd01270||0x1f4;return function(_0x470667){logger[_0xa875('0x29')](_0x470667[_0xa875('0x2a')]);if(_0x470667[_0xa875('0x2b')]){delete _0x470667[_0xa875('0x2b')];}_0x4107ea[_0xa875('0x1b')](_0xd01270)['send'](_0x470667);};}exports[_0xa875('0x2c')]=function(_0x1afcd9,_0x1f5231){var _0x3f6454={},_0x1a21e4={},_0x2ae687={'count':0x0,'rows':[]};var _0x5c3ee2=_['map'](db[_0xa875('0x2d')][_0xa875('0x2e')],function(_0x6c1740){return{'name':_0x6c1740[_0xa875('0x2f')],'type':_0x6c1740['type'][_0xa875('0x30')]};});_0x1a21e4[_0xa875('0x31')]=_[_0xa875('0x32')](_0x5c3ee2,_0xa875('0x2b'));_0x1a21e4[_0xa875('0x33')]=_[_0xa875('0x34')](_0x1afcd9[_0xa875('0x33')]);_0x1a21e4[_0xa875('0x35')]=_['intersection'](_0x1a21e4[_0xa875('0x31')],_0x1a21e4[_0xa875('0x33')]);_0x3f6454[_0xa875('0x36')]=_[_0xa875('0x37')](_0x1a21e4['model'],qs['fields'](_0x1afcd9[_0xa875('0x33')][_0xa875('0x38')]));_0x3f6454[_0xa875('0x36')]=_0x3f6454[_0xa875('0x36')][_0xa875('0x39')]?_0x3f6454[_0xa875('0x36')]:_0x1a21e4['model'];if(!_0x1afcd9[_0xa875('0x33')][_0xa875('0x3a')](_0xa875('0x3b'))){_0x3f6454[_0xa875('0x1e')]=qs[_0xa875('0x1e')](_0x1afcd9[_0xa875('0x33')][_0xa875('0x1e')]);_0x3f6454['offset']=qs[_0xa875('0x1d')](_0x1afcd9[_0xa875('0x33')][_0xa875('0x1d')]);}_0x3f6454[_0xa875('0x3c')]=qs[_0xa875('0x3d')](_0x1afcd9[_0xa875('0x33')][_0xa875('0x3d')]);_0x3f6454[_0xa875('0x3e')]=qs[_0xa875('0x35')](_[_0xa875('0x3f')](_0x1afcd9[_0xa875('0x33')],_0x1a21e4['filters']),_0x5c3ee2);if(_0x1afcd9[_0xa875('0x33')][_0xa875('0x40')]){_0x3f6454[_0xa875('0x3e')]=_[_0xa875('0x41')](_0x3f6454[_0xa875('0x3e')],{'$or':_['map'](_0x5c3ee2,function(_0x3b5457){if(_0x3b5457[_0xa875('0x42')]!==_0xa875('0x43')){var _0x18e7ac={};_0x18e7ac[_0x3b5457[_0xa875('0x2b')]]={'$like':'%'+_0x1afcd9[_0xa875('0x33')][_0xa875('0x40')]+'%'};return _0x18e7ac;}})});}_0x3f6454=_[_0xa875('0x41')]({},_0x3f6454,_0x1afcd9[_0xa875('0x44')]);var _0x3358e5={'where':_0x3f6454['where']};return db['DeskAccount'][_0xa875('0x20')](_0x3358e5)['then'](function(_0x26c614){_0x2ae687['count']=_0x26c614;if(_0x1afcd9[_0xa875('0x33')][_0xa875('0x45')]){_0x3f6454[_0xa875('0x46')]=[{'all':!![]}];}return db[_0xa875('0x2d')][_0xa875('0x47')](_0x3f6454);})[_0xa875('0x26')](function(_0x30c06b){_0x2ae687[_0xa875('0x48')]=_0x30c06b;return _0x2ae687;})[_0xa875('0x26')](respondWithFilteredResult(_0x1f5231,_0x3f6454))[_0xa875('0x49')](handleError(_0x1f5231,null));};exports[_0xa875('0x4a')]=function(_0x52b616,_0x58f16a){var _0x3bdc48={'raw':![],'where':{'id':_0x52b616['params']['id']}},_0x5a6429={};_0x5a6429[_0xa875('0x31')]=_[_0xa875('0x34')](db[_0xa875('0x2d')][_0xa875('0x2e')]);_0x5a6429[_0xa875('0x33')]=_['keys'](_0x52b616[_0xa875('0x33')]);_0x5a6429[_0xa875('0x35')]=_['intersection'](_0x5a6429[_0xa875('0x31')],_0x5a6429[_0xa875('0x33')]);_0x3bdc48[_0xa875('0x36')]=_[_0xa875('0x37')](_0x5a6429[_0xa875('0x31')],qs[_0xa875('0x38')](_0x52b616[_0xa875('0x33')]['fields']));_0x3bdc48[_0xa875('0x36')]=_0x3bdc48[_0xa875('0x36')][_0xa875('0x39')]?_0x3bdc48[_0xa875('0x36')]:_0x5a6429[_0xa875('0x31')];if(_0x52b616['query']['includeAll']){_0x3bdc48[_0xa875('0x46')]=[{'all':!![]}];}_0x3bdc48=_['merge']({},_0x3bdc48,_0x52b616[_0xa875('0x44')]);return db[_0xa875('0x2d')]['find'](_0x3bdc48)[_0xa875('0x26')](handleEntityNotFound(_0x58f16a,null))['then'](respondWithResult(_0x58f16a,null))['catch'](handleError(_0x58f16a,null));};exports[_0xa875('0x4b')]=function(_0x24194d,_0x4f589a){return db[_0xa875('0x2d')]['create'](_0x24194d['body'],{})[_0xa875('0x26')](respondWithResult(_0x4f589a,0xc9))[_0xa875('0x49')](handleError(_0x4f589a,null));};exports[_0xa875('0x25')]=function(_0x3ec57b,_0x48257a){if(_0x3ec57b[_0xa875('0x4c')]['id']){delete _0x3ec57b[_0xa875('0x4c')]['id'];}return db[_0xa875('0x2d')][_0xa875('0x4d')]({'where':{'id':_0x3ec57b[_0xa875('0x4e')]['id']}})['then'](handleEntityNotFound(_0x48257a,null))[_0xa875('0x26')](saveUpdates(_0x3ec57b[_0xa875('0x4c')],null))['then'](respondWithResult(_0x48257a,null))[_0xa875('0x49')](handleError(_0x48257a,null));};exports[_0xa875('0x27')]=function(_0x1c25f0,_0x146480){return db[_0xa875('0x2d')][_0xa875('0x4d')]({'where':{'id':_0x1c25f0[_0xa875('0x4e')]['id']}})[_0xa875('0x26')](handleEntityNotFound(_0x146480,null))[_0xa875('0x26')](removeEntity(_0x146480,null))[_0xa875('0x49')](handleError(_0x146480,null));};exports['getConfigurations']=function(_0x528013,_0x1f63dc,_0xb1f7d4){var _0x3df49e={};var _0x44ae7f={};var _0x3e959f;var _0x2392a1;return db[_0xa875('0x2d')][_0xa875('0x4f')]({'where':{'id':_0x528013[_0xa875('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1f63dc,null))[_0xa875('0x26')](function(_0x2d8235){if(_0x2d8235){_0x3e959f=_0x2d8235;_0x44ae7f[_0xa875('0x31')]=_[_0xa875('0x34')](db[_0xa875('0x50')][_0xa875('0x2e')]);_0x44ae7f[_0xa875('0x33')]=_[_0xa875('0x34')](_0x528013[_0xa875('0x33')]);_0x44ae7f['filters']=_[_0xa875('0x37')](_0x44ae7f[_0xa875('0x31')],_0x44ae7f[_0xa875('0x33')]);_0x3df49e[_0xa875('0x36')]=_[_0xa875('0x37')](_0x44ae7f[_0xa875('0x31')],qs[_0xa875('0x38')](_0x528013[_0xa875('0x33')]['fields']));_0x3df49e['attributes']=_0x3df49e['attributes'][_0xa875('0x39')]?_0x3df49e[_0xa875('0x36')]:_0x44ae7f['model'];_0x3df49e[_0xa875('0x3c')]=qs[_0xa875('0x3d')](_0x528013[_0xa875('0x33')]['sort']);_0x3df49e['where']=qs[_0xa875('0x35')](_[_0xa875('0x3f')](_0x528013[_0xa875('0x33')],_0x44ae7f[_0xa875('0x35')]));if(_0x528013[_0xa875('0x33')]['filter']){_0x3df49e[_0xa875('0x3e')]=_[_0xa875('0x41')](_0x3df49e[_0xa875('0x3e')],{'$or':_[_0xa875('0x32')](_0x3df49e[_0xa875('0x36')],function(_0x3bfa1c){var _0x4b84ab={};_0x4b84ab[_0x3bfa1c]={'$like':'%'+_0x528013[_0xa875('0x33')][_0xa875('0x40')]+'%'};return _0x4b84ab;})});}_0x3df49e=_[_0xa875('0x41')]({},_0x3df49e,_0x528013[_0xa875('0x44')]);return _0x3e959f['getConfigurations'](_0x3df49e);}})[_0xa875('0x26')](function(_0x11782c){if(_0x11782c){_0x2392a1=_0x11782c[_0xa875('0x39')];if(!_0x528013[_0xa875('0x33')][_0xa875('0x3a')]('nolimit')){_0x3df49e[_0xa875('0x1e')]=qs[_0xa875('0x1e')](_0x528013['query'][_0xa875('0x1e')]);_0x3df49e['offset']=qs[_0xa875('0x1d')](_0x528013[_0xa875('0x33')][_0xa875('0x1d')]);}return _0x3e959f[_0xa875('0x51')](_0x3df49e);}})[_0xa875('0x26')](function(_0x2e95a5){if(_0x2e95a5){return _0x2e95a5?{'count':_0x2392a1,'rows':_0x2e95a5}:null;}})[_0xa875('0x26')](respondWithResult(_0x1f63dc,null))['catch'](handleError(_0x1f63dc,null));};exports['addConfiguration']=function(_0x18e16c,_0x10f701,_0x4d6d07){if(_0x18e16c[_0xa875('0x4c')]['id']){delete _0x18e16c['body']['id'];}return db[_0xa875('0x2d')][_0xa875('0x4f')]({'where':{'id':_0x18e16c[_0xa875('0x4e')]['id']}})[_0xa875('0x26')](handleEntityNotFound(_0x10f701,null))[_0xa875('0x26')](function(_0x54f7bd){if(_0x54f7bd){_0x18e16c[_0xa875('0x4c')]['AccountId']=_0x54f7bd['id'];_0x18e16c[_0xa875('0x4c')]['Subjects']=integrations[_0xa875('0x52')](_0x18e16c[_0xa875('0x4c')][_0xa875('0x53')],_0x18e16c['body'][_0xa875('0x42')]);_0x18e16c['body'][_0xa875('0x54')]=integrations[_0xa875('0x55')](_0x18e16c['body']['channel'],_0x18e16c[_0xa875('0x4c')]['type']);return db[_0xa875('0x50')]['create'](_0x18e16c[_0xa875('0x4c')],{'include':[{'model':db[_0xa875('0x56')],'as':_0xa875('0x57')},{'model':db['DeskField'],'as':_0xa875('0x54')}]});}return null;})[_0xa875('0x26')](respondWithResult(_0x10f701,null))[_0xa875('0x49')](handleError(_0x10f701,null));};exports['getFields']=function(_0x4c0531,_0x23fd67,_0x5baf0f){var _0x4e5500=[{'name':_0xa875('0x58'),'label':_0xa875('0x58'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x47bf3a='';return db[_0xa875('0x2d')]['findOne']({'where':{'id':_0x4c0531[_0xa875('0x4e')]['id']},'attributes':['id','remoteUri',_0xa875('0x59'),_0xa875('0x5a'),'password','consumerKey',_0xa875('0x5b'),_0xa875('0x5c'),_0xa875('0x5d')]})[_0xa875('0x26')](handleEntityNotFound(_0x23fd67,null))['then'](function(_0x3dc37c){if(_0x3dc37c){_0x47bf3a=_0x3dc37c['remoteUri'];var _0x39bbf3=_0x47bf3a['slice'](-0x1);if(_0x39bbf3==='/'){_0x47bf3a=_0x47bf3a[_0xa875('0x5e')](0x0,_0x47bf3a[_0xa875('0x5f')](_0x39bbf3));}var _0x2129c8={'method':_0xa875('0x60'),'uri':util[_0xa875('0x61')](_0xa875('0x62'),_0x47bf3a),'headers':{'Content-Type':_0xa875('0x63'),'Accept':_0xa875('0x63')},'json':!![]};if(_0x3dc37c[_0xa875('0x59')]===_0xa875('0x64')){_0x2129c8[_0xa875('0x65')]['Authorization']=util['format'](_0xa875('0x66'),new Buffer(util[_0xa875('0x61')](_0xa875('0x67'),_0x3dc37c[_0xa875('0x5a')],_0x3dc37c[_0xa875('0x68')]))['toString'](_0xa875('0x69')));}return rp(_0x2129c8)['then'](function(_0x2a5c7d){return _0x4e5500['concat'](_[_0xa875('0x32')](_0x2a5c7d['_embedded'][_0xa875('0x6a')],function(_0x3fc970){return{'id':_0x3fc970['name'],'name':_0x3fc970['name'],'type':_0x3fc970[_0xa875('0x42')],'active':_0x3fc970[_0xa875('0x6b')],'label':_0x3fc970['label'],'custom':!![]};}));});}})[_0xa875('0x26')](function(_0x95ed50){return{'count':_0x95ed50[_0xa875('0x39')],'rows':_0x95ed50};})['then'](respondWithResult(_0x23fd67,null))[_0xa875('0x49')](function(_0x522b5c){var _0x286e30=_0x4c0531[_0xa875('0x33')]['test']?0x1f4:_0x522b5c['statusCode']||0x1f4;logger['error'](_0xa875('0x6c'),_0xa875('0x6d'),_0x286e30,JSON[_0xa875('0x6e')](_0x522b5c));delete _0x522b5c[_0xa875('0x2b')];if(_0x286e30===0x191){_0x286e30=0x190;}_0x23fd67[_0xa875('0x1b')](_0x286e30)[_0xa875('0x6f')](_0x4c0531['query'][_0xa875('0x70')]?{'message':_0xa875('0x71'),'statusCode':_0x522b5c[_0xa875('0x72')]}:_0x522b5c);});};
\ No newline at end of file
index a28375f..cdb6d7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x32f1=['exports','define','DeskAccount','int_desk_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x10dcda,_0x5207af){var _0x27416e=function(_0x1907af){while(--_0x1907af){_0x10dcda['push'](_0x10dcda['shift']());}};_0x27416e(++_0x5207af);}(_0x32f1,0xc8));var _0x132f=function(_0x398a9a,_0xeda76a){_0x398a9a=_0x398a9a-0x0;var _0x1153fb=_0x32f1[_0x398a9a];return _0x1153fb;};'use strict';var _=require('lodash');var util=require(_0x132f('0x0'));var logger=require(_0x132f('0x1'))(_0x132f('0x2'));var moment=require(_0x132f('0x3'));var BPromise=require(_0x132f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x132f('0x5'));var rimraf=require(_0x132f('0x6'));var config=require(_0x132f('0x7'));var attributes=require(_0x132f('0x8'));var integrations=require(_0x132f('0x9'));module[_0x132f('0xa')]=function(_0x6330cd,_0x2dc9f2){return _0x6330cd[_0x132f('0xb')](_0x132f('0xc'),attributes,{'tableName':_0x132f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x031f=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x031f,0x104));var _0xf031=function(_0x349009,_0x2a1c8c){_0x349009=_0x349009-0x0;var _0x57a5b8=_0x031f[_0x349009];return _0x57a5b8;};'use strict';var _=require(_0xf031('0x0'));var util=require(_0xf031('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf031('0x2'));var BPromise=require('bluebird');var rp=require(_0xf031('0x3'));var fs=require('fs');var path=require(_0xf031('0x4'));var rimraf=require(_0xf031('0x5'));var config=require(_0xf031('0x6'));var attributes=require(_0xf031('0x7'));var integrations=require(_0xf031('0x8'));module[_0xf031('0x9')]=function(_0x13508d,_0xc23a6b){return _0x13508d[_0xf031('0xa')](_0xf031('0xb'),attributes,{'tableName':_0xf031('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2b3dc5d..3a62f73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88fb=['raw','where','limit','include','map','attributes','model','then','debug','catch','ShowDeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','GetDeskAccount','options'];(function(_0x32da50,_0x47c621){var _0x34bc54=function(_0x30d56c){while(--_0x30d56c){_0x32da50['push'](_0x32da50['shift']());}};_0x34bc54(++_0x47c621);}(_0x88fb,0x1d9));var _0xb88f=function(_0x35958d,_0x31dca3){_0x35958d=_0x35958d-0x0;var _0x3064f1=_0x88fb[_0x35958d];return _0x3064f1;};'use strict';var _=require(_0xb88f('0x0'));var util=require(_0xb88f('0x1'));var moment=require(_0xb88f('0x2'));var BPromise=require(_0xb88f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb88f('0x4'))['db'];var utils=require(_0xb88f('0x5'));var logger=require(_0xb88f('0x6'))(_0xb88f('0x7'));var config=require(_0xb88f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb88f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21c2d9,_0x9d938d,_0xc754f){return new BPromise(function(_0x229dce,_0x4c502c){return client[_0xb88f('0xa')](_0x21c2d9,_0xc754f)['then'](function(_0x44cc52){logger[_0xb88f('0xb')]('DeskAccount,\x20%s,\x20%s',_0x9d938d,_0xb88f('0xc'));logger['debug'](_0xb88f('0xd'),_0x9d938d,_0xb88f('0xc'),JSON[_0xb88f('0xe')](_0x44cc52));if(_0x44cc52['error']){if(_0x44cc52[_0xb88f('0xf')][_0xb88f('0x10')]===0x1f4){logger[_0xb88f('0xf')](_0xb88f('0x11'),_0x9d938d,_0x44cc52['error'][_0xb88f('0x12')]);return _0x4c502c(_0x44cc52[_0xb88f('0xf')][_0xb88f('0x12')]);}logger[_0xb88f('0xf')](_0xb88f('0x11'),_0x9d938d,_0x44cc52[_0xb88f('0xf')]['message']);return _0x229dce(_0x44cc52[_0xb88f('0xf')][_0xb88f('0x12')]);}else{logger[_0xb88f('0xb')](_0xb88f('0x11'),_0x9d938d,'request\x20sent');_0x229dce(_0x44cc52[_0xb88f('0x13')]['message']);}})['catch'](function(_0x16ac38){logger['error'](_0xb88f('0x11'),_0x9d938d,_0x16ac38);_0x4c502c(_0x16ac38);});});}exports[_0xb88f('0x14')]=function(_0x12f200){var _0x51f5c0=this;return new Promise(function(_0x461917,_0x3d47fb){return db['DeskAccount']['findAll']({'raw':_0x12f200['options']?_0x12f200[_0xb88f('0x15')][_0xb88f('0x16')]===undefined?!![]:![]:!![],'where':_0x12f200[_0xb88f('0x15')]?_0x12f200[_0xb88f('0x15')][_0xb88f('0x17')]||null:null,'attributes':_0x12f200[_0xb88f('0x15')]?_0x12f200[_0xb88f('0x15')]['attributes']||null:null,'limit':_0x12f200[_0xb88f('0x15')]?_0x12f200['options'][_0xb88f('0x18')]||null:null,'include':_0x12f200[_0xb88f('0x15')]?_0x12f200[_0xb88f('0x15')][_0xb88f('0x19')]?_[_0xb88f('0x1a')](_0x12f200[_0xb88f('0x15')][_0xb88f('0x19')],function(_0x5795e3){return{'model':db[_0x5795e3['model']],'as':_0x5795e3['as'],'attributes':_0x5795e3[_0xb88f('0x1b')],'include':_0x5795e3[_0xb88f('0x19')]?_['map'](_0x5795e3[_0xb88f('0x19')],function(_0x38e6e1){return{'model':db[_0x38e6e1[_0xb88f('0x1c')]],'as':_0x38e6e1['as'],'attributes':_0x38e6e1[_0xb88f('0x1b')],'include':_0x38e6e1['include']?_[_0xb88f('0x1a')](_0x38e6e1['include'],function(_0x1c1fb1){return{'model':db[_0x1c1fb1[_0xb88f('0x1c')]],'as':_0x1c1fb1['as'],'attributes':_0x1c1fb1[_0xb88f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb88f('0x1d')](function(_0x28246a){logger[_0xb88f('0xb')]('GetDeskAccount',_0x12f200);logger[_0xb88f('0x1e')](_0xb88f('0x14'),_0x12f200,JSON[_0xb88f('0xe')](_0x28246a));_0x461917(_0x28246a);})[_0xb88f('0x1f')](function(_0x1a48b4){logger['error']('GetDeskAccount',_0x1a48b4[_0xb88f('0x12')],_0x12f200);_0x3d47fb(_0x51f5c0[_0xb88f('0xf')](0x1f4,_0x1a48b4['message']));});});};exports[_0xb88f('0x20')]=function(_0x4119af){var _0x5267e1=this;return new Promise(function(_0x626d,_0x1c1100){return db['DeskAccount']['find']({'raw':_0x4119af[_0xb88f('0x15')]?_0x4119af[_0xb88f('0x15')][_0xb88f('0x16')]===undefined?!![]:![]:!![],'where':_0x4119af[_0xb88f('0x15')]?_0x4119af[_0xb88f('0x15')][_0xb88f('0x17')]||null:null,'attributes':_0x4119af['options']?_0x4119af[_0xb88f('0x15')][_0xb88f('0x1b')]||null:null,'include':_0x4119af[_0xb88f('0x15')]?_0x4119af[_0xb88f('0x15')]['include']?_[_0xb88f('0x1a')](_0x4119af['options'][_0xb88f('0x19')],function(_0x9b52f9){return{'model':db[_0x9b52f9[_0xb88f('0x1c')]],'as':_0x9b52f9['as'],'attributes':_0x9b52f9['attributes'],'include':_0x9b52f9['include']?_[_0xb88f('0x1a')](_0x9b52f9[_0xb88f('0x19')],function(_0x16f2e8){return{'model':db[_0x16f2e8['model']],'as':_0x16f2e8['as'],'attributes':_0x16f2e8['attributes'],'include':_0x16f2e8['include']?_[_0xb88f('0x1a')](_0x16f2e8[_0xb88f('0x19')],function(_0x4146c8){return{'model':db[_0x4146c8[_0xb88f('0x1c')]],'as':_0x4146c8['as'],'attributes':_0x4146c8[_0xb88f('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb88f('0x1d')](function(_0x7b9dc0){logger[_0xb88f('0xb')](_0xb88f('0x20'),_0x4119af);logger[_0xb88f('0x1e')](_0xb88f('0x20'),_0x4119af,JSON[_0xb88f('0xe')](_0x7b9dc0));_0x626d(_0x7b9dc0);})['catch'](function(_0x3ad230){logger[_0xb88f('0xf')]('ShowDeskAccount',_0x3ad230[_0xb88f('0x12')],_0x4119af);_0x1c1100(_0x5267e1['error'](0x1f4,_0x3ad230[_0xb88f('0x12')]));});});};
\ No newline at end of file
+var _0x04de=['debug','stringify','error','message','catch','DeskAccount','findAll','options','where','attributes','limit','map','include','model','GetDeskAccount','find','raw','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1d41a2,_0x33011b){var _0x241d1c=function(_0x1c8b0a){while(--_0x1c8b0a){_0x1d41a2['push'](_0x1d41a2['shift']());}};_0x241d1c(++_0x33011b);}(_0x04de,0x12a));var _0xe04d=function(_0x3eea86,_0x2eb677){_0x3eea86=_0x3eea86-0x0;var _0x4a8c08=_0x04de[_0x3eea86];return _0x4a8c08;};'use strict';var _=require(_0xe04d('0x0'));var util=require(_0xe04d('0x1'));var moment=require(_0xe04d('0x2'));var BPromise=require(_0xe04d('0x3'));var rs=require(_0xe04d('0x4'));var fs=require('fs');var Redis=require(_0xe04d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe04d('0x6'));var logger=require(_0xe04d('0x7'))(_0xe04d('0x8'));var config=require(_0xe04d('0x9'));var jayson=require(_0xe04d('0xa'));var client=jayson[_0xe04d('0xb')][_0xe04d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5c5ed8,_0x10fa56,_0x33ac8d){return new BPromise(function(_0x32fb32,_0x24cbbe){return client['request'](_0x5c5ed8,_0x33ac8d)[_0xe04d('0xd')](function(_0xa50019){logger[_0xe04d('0xe')](_0xe04d('0xf'),_0x10fa56,_0xe04d('0x10'));logger[_0xe04d('0x11')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x10fa56,_0xe04d('0x10'),JSON[_0xe04d('0x12')](_0xa50019));if(_0xa50019[_0xe04d('0x13')]){if(_0xa50019['error']['code']===0x1f4){logger['error'](_0xe04d('0xf'),_0x10fa56,_0xa50019[_0xe04d('0x13')][_0xe04d('0x14')]);return _0x24cbbe(_0xa50019[_0xe04d('0x13')][_0xe04d('0x14')]);}logger['error']('DeskAccount,\x20%s,\x20%s',_0x10fa56,_0xa50019[_0xe04d('0x13')][_0xe04d('0x14')]);return _0x32fb32(_0xa50019[_0xe04d('0x13')][_0xe04d('0x14')]);}else{logger[_0xe04d('0xe')]('DeskAccount,\x20%s,\x20%s',_0x10fa56,'request\x20sent');_0x32fb32(_0xa50019['result'][_0xe04d('0x14')]);}})[_0xe04d('0x15')](function(_0x5c9df8){logger[_0xe04d('0x13')]('DeskAccount,\x20%s,\x20%s',_0x10fa56,_0x5c9df8);_0x24cbbe(_0x5c9df8);});});}exports['GetDeskAccount']=function(_0x51d9ab){var _0x4b9885=this;return new Promise(function(_0x10fe34,_0xcbcca8){return db[_0xe04d('0x16')][_0xe04d('0x17')]({'raw':_0x51d9ab[_0xe04d('0x18')]?_0x51d9ab[_0xe04d('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x51d9ab[_0xe04d('0x18')]?_0x51d9ab[_0xe04d('0x18')][_0xe04d('0x19')]||null:null,'attributes':_0x51d9ab['options']?_0x51d9ab['options'][_0xe04d('0x1a')]||null:null,'limit':_0x51d9ab[_0xe04d('0x18')]?_0x51d9ab[_0xe04d('0x18')][_0xe04d('0x1b')]||null:null,'include':_0x51d9ab['options']?_0x51d9ab[_0xe04d('0x18')]['include']?_[_0xe04d('0x1c')](_0x51d9ab[_0xe04d('0x18')][_0xe04d('0x1d')],function(_0x502617){return{'model':db[_0x502617[_0xe04d('0x1e')]],'as':_0x502617['as'],'attributes':_0x502617['attributes'],'include':_0x502617[_0xe04d('0x1d')]?_[_0xe04d('0x1c')](_0x502617[_0xe04d('0x1d')],function(_0x17444d){return{'model':db[_0x17444d[_0xe04d('0x1e')]],'as':_0x17444d['as'],'attributes':_0x17444d[_0xe04d('0x1a')],'include':_0x17444d[_0xe04d('0x1d')]?_[_0xe04d('0x1c')](_0x17444d[_0xe04d('0x1d')],function(_0x1075cf){return{'model':db[_0x1075cf['model']],'as':_0x1075cf['as'],'attributes':_0x1075cf[_0xe04d('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4cd0fb){logger[_0xe04d('0xe')](_0xe04d('0x1f'),_0x51d9ab);logger['debug'](_0xe04d('0x1f'),_0x51d9ab,JSON[_0xe04d('0x12')](_0x4cd0fb));_0x10fe34(_0x4cd0fb);})[_0xe04d('0x15')](function(_0x4d164a){logger[_0xe04d('0x13')]('GetDeskAccount',_0x4d164a[_0xe04d('0x14')],_0x51d9ab);_0xcbcca8(_0x4b9885['error'](0x1f4,_0x4d164a[_0xe04d('0x14')]));});});};exports['ShowDeskAccount']=function(_0x3a538a){var _0x261e5a=this;return new Promise(function(_0x4c9ca7,_0x30534e){return db['DeskAccount'][_0xe04d('0x20')]({'raw':_0x3a538a['options']?_0x3a538a[_0xe04d('0x18')][_0xe04d('0x21')]===undefined?!![]:![]:!![],'where':_0x3a538a[_0xe04d('0x18')]?_0x3a538a['options'][_0xe04d('0x19')]||null:null,'attributes':_0x3a538a[_0xe04d('0x18')]?_0x3a538a[_0xe04d('0x18')][_0xe04d('0x1a')]||null:null,'include':_0x3a538a['options']?_0x3a538a['options'][_0xe04d('0x1d')]?_[_0xe04d('0x1c')](_0x3a538a[_0xe04d('0x18')][_0xe04d('0x1d')],function(_0x469f53){return{'model':db[_0x469f53['model']],'as':_0x469f53['as'],'attributes':_0x469f53[_0xe04d('0x1a')],'include':_0x469f53[_0xe04d('0x1d')]?_[_0xe04d('0x1c')](_0x469f53['include'],function(_0x13918f){return{'model':db[_0x13918f[_0xe04d('0x1e')]],'as':_0x13918f['as'],'attributes':_0x13918f['attributes'],'include':_0x13918f['include']?_[_0xe04d('0x1c')](_0x13918f['include'],function(_0x225ab6){return{'model':db[_0x225ab6[_0xe04d('0x1e')]],'as':_0x225ab6['as'],'attributes':_0x225ab6[_0xe04d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe04d('0xd')](function(_0x213ffa){logger[_0xe04d('0xe')](_0xe04d('0x22'),_0x3a538a);logger[_0xe04d('0x11')](_0xe04d('0x22'),_0x3a538a,JSON['stringify'](_0x213ffa));_0x4c9ca7(_0x213ffa);})[_0xe04d('0x15')](function(_0x58e30f){logger[_0xe04d('0x13')](_0xe04d('0x22'),_0x58e30f[_0xe04d('0x14')],_0x3a538a);_0x30534e(_0x261e5a[_0xe04d('0x13')](0x1f4,_0x58e30f[_0xe04d('0x14')]));});});};
\ No newline at end of file
index 4802903..17e02a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x1b6beb,_0x511bde){var _0x1d5d3e=function(_0x3d9802){while(--_0x3d9802){_0x1b6beb['push'](_0x1b6beb['shift']());}};_0x1d5d3e(++_0x511bde);}(_0xedd9,0xfc));var _0x9edd=function(_0x10d8c7,_0xa80d12){_0x10d8c7=_0x10d8c7-0x0;var _0x4105b9=_0xedd9[_0x10d8c7];return _0x4105b9;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router;
\ No newline at end of file
+var _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x11646a,_0xf8e0f5){var _0x4e30b6=function(_0x169f69){while(--_0x169f69){_0x11646a['push'](_0x11646a['shift']());}};_0x4e30b6(++_0xf8e0f5);}(_0x008c,0x188));var _0xc008=function(_0x2d98f1,_0x254499){_0x2d98f1=_0x2d98f1-0x0;var _0x5cbe38=_0x008c[_0x2d98f1];return _0x5cbe38;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router;
\ No newline at end of file
index 7c82335..b6f1d1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd70c=['STRING','sequelize','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd70c,0x11b));var _0xcd70=function(_0x1e735a,_0x1bfd31){_0x1e735a=_0x1e735a-0x0;var _0x438ba5=_0xd70c[_0x1e735a];return _0x438ba5;};'use strict';var Sequelize=require(_0xcd70('0x0'));module[_0xcd70('0x1')]={'name':{'type':Sequelize[_0xcd70('0x2')]},'description':{'type':Sequelize[_0xcd70('0x2')]}};
\ No newline at end of file
+var _0x3e47=['STRING','sequelize','exports'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x3e47,0x79));var _0x73e4=function(_0x1a151a,_0x44325f){_0x1a151a=_0x1a151a-0x0;var _0x3ce862=_0x3e47[_0x1a151a];return _0x3ce862;};'use strict';var Sequelize=require(_0x73e4('0x0'));module[_0x73e4('0x1')]={'name':{'type':Sequelize[_0x73e4('0x2')]},'description':{'type':Sequelize[_0x73e4('0x2')]}};
\ No newline at end of file
index d8bb341..2a7ba30 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa9d=['json','undefined','count','offset','limit','set','Content-Range','apply','save','then','destroy','stack','name','map','DeskConfiguration','rawAttributes','type','model','query','intersection','attributes','fields','length','nolimit','sort','filters','pick','where','merge','filter','options','includeAll','rows','catch','show','params','keys','include','find','create','body','findOne','DeskField','getFields','hasOwnProperty','order','getSubjects','getDescriptions','Tag','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x2f720b,_0x2a565f){_0x2f720b=_0x2f720b-0x0;var _0xc0463b=_0xaa9d[_0x2f720b];return _0xc0463b;};'use strict';var emlformat=require(_0xdaa9('0x0'));var rimraf=require(_0xdaa9('0x1'));var zipdir=require(_0xdaa9('0x2'));var jsonpatch=require(_0xdaa9('0x3'));var rp=require(_0xdaa9('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdaa9('0x5'));var sox=require(_0xdaa9('0x6'));var csv=require(_0xdaa9('0x7'));var ejs=require(_0xdaa9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdaa9('0x9'));var crypto=require(_0xdaa9('0xa'));var jsforce=require(_0xdaa9('0xb'));var deskjs=require(_0xdaa9('0xc'));var toCsv=require('to-csv');var querystring=require(_0xdaa9('0xd'));var Papa=require('papaparse');var Redis=require(_0xdaa9('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xdaa9('0xf'));var as=require(_0xdaa9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdaa9('0x11'))(_0xdaa9('0x12'));var utils=require(_0xdaa9('0x13'));var config=require(_0xdaa9('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32a2d1,_0x3dc18f){_0x3dc18f=_0x3dc18f||0xcc;return function(_0x516717){if(_0x516717){return _0x32a2d1[_0xdaa9('0x15')](_0x3dc18f);}return _0x32a2d1[_0xdaa9('0x16')](_0x3dc18f)[_0xdaa9('0x17')]();};}function respondWithResult(_0x3c2c5c,_0x3f74de){_0x3f74de=_0x3f74de||0xc8;return function(_0x5ae03f){if(_0x5ae03f){return _0x3c2c5c['status'](_0x3f74de)[_0xdaa9('0x18')](_0x5ae03f);}};}function respondWithFilteredResult(_0x1d2ed7,_0x11794c){return function(_0x45b214){if(_0x45b214){var _0x5a0d36=typeof _0x11794c['offset']===_0xdaa9('0x19')&&typeof _0x11794c['limit']==='undefined';var _0x5bd993=_0x45b214[_0xdaa9('0x1a')];var _0x4f7027=_0x5a0d36?0x0:_0x11794c['offset'];var _0x271967=_0x5a0d36?_0x45b214['count']:_0x11794c[_0xdaa9('0x1b')]+_0x11794c[_0xdaa9('0x1c')];var _0x5a755f;if(_0x271967>=_0x5bd993){_0x271967=_0x5bd993;_0x5a755f=0xc8;}else{_0x5a755f=0xce;}_0x1d2ed7['status'](_0x5a755f);return _0x1d2ed7[_0xdaa9('0x1d')](_0xdaa9('0x1e'),_0x4f7027+'-'+_0x271967+'/'+_0x5bd993)[_0xdaa9('0x18')](_0x45b214);}return null;};}function patchUpdates(_0x27d3ea){return function(_0x131dae){try{jsonpatch[_0xdaa9('0x1f')](_0x131dae,_0x27d3ea,!![]);}catch(_0x3b3d13){return BPromise['reject'](_0x3b3d13);}return _0x131dae[_0xdaa9('0x20')]();};}function saveUpdates(_0x1100d5,_0x510962){return function(_0x2470a2){if(_0x2470a2){return _0x2470a2['update'](_0x1100d5)[_0xdaa9('0x21')](function(_0x26c40f){return _0x26c40f;});}return null;};}function removeEntity(_0x1498c3,_0x13b09b){return function(_0x4e52b5){if(_0x4e52b5){return _0x4e52b5[_0xdaa9('0x22')]()[_0xdaa9('0x21')](function(){_0x1498c3[_0xdaa9('0x16')](0xcc)[_0xdaa9('0x17')]();});}};}function handleEntityNotFound(_0xf40065,_0x3a519a){return function(_0x18de36){if(!_0x18de36){_0xf40065['sendStatus'](0x194);}return _0x18de36;};}function handleError(_0x439d7e,_0x39d595){_0x39d595=_0x39d595||0x1f4;return function(_0x454d4e){logger['error'](_0x454d4e[_0xdaa9('0x23')]);if(_0x454d4e[_0xdaa9('0x24')]){delete _0x454d4e[_0xdaa9('0x24')];}_0x439d7e[_0xdaa9('0x16')](_0x39d595)['send'](_0x454d4e);};}exports['index']=function(_0x5c5cb6,_0x1c6402){var _0x4ac319={},_0x2c2930={},_0x5750cc={'count':0x0,'rows':[]};var _0x58d08c=_[_0xdaa9('0x25')](db[_0xdaa9('0x26')][_0xdaa9('0x27')],function(_0x1137d2){return{'name':_0x1137d2['fieldName'],'type':_0x1137d2[_0xdaa9('0x28')]['key']};});_0x2c2930[_0xdaa9('0x29')]=_[_0xdaa9('0x25')](_0x58d08c,_0xdaa9('0x24'));_0x2c2930[_0xdaa9('0x2a')]=_['keys'](_0x5c5cb6['query']);_0x2c2930['filters']=_[_0xdaa9('0x2b')](_0x2c2930[_0xdaa9('0x29')],_0x2c2930[_0xdaa9('0x2a')]);_0x4ac319[_0xdaa9('0x2c')]=_[_0xdaa9('0x2b')](_0x2c2930['model'],qs['fields'](_0x5c5cb6['query'][_0xdaa9('0x2d')]));_0x4ac319[_0xdaa9('0x2c')]=_0x4ac319[_0xdaa9('0x2c')][_0xdaa9('0x2e')]?_0x4ac319[_0xdaa9('0x2c')]:_0x2c2930[_0xdaa9('0x29')];if(!_0x5c5cb6[_0xdaa9('0x2a')]['hasOwnProperty'](_0xdaa9('0x2f'))){_0x4ac319[_0xdaa9('0x1c')]=qs['limit'](_0x5c5cb6[_0xdaa9('0x2a')]['limit']);_0x4ac319[_0xdaa9('0x1b')]=qs[_0xdaa9('0x1b')](_0x5c5cb6['query'][_0xdaa9('0x1b')]);}_0x4ac319['order']=qs[_0xdaa9('0x30')](_0x5c5cb6[_0xdaa9('0x2a')][_0xdaa9('0x30')]);_0x4ac319['where']=qs[_0xdaa9('0x31')](_[_0xdaa9('0x32')](_0x5c5cb6[_0xdaa9('0x2a')],_0x2c2930['filters']),_0x58d08c);if(_0x5c5cb6[_0xdaa9('0x2a')]['filter']){_0x4ac319[_0xdaa9('0x33')]=_[_0xdaa9('0x34')](_0x4ac319['where'],{'$or':_[_0xdaa9('0x25')](_0x58d08c,function(_0x27a781){if(_0x27a781[_0xdaa9('0x28')]!=='VIRTUAL'){var _0x241fd5={};_0x241fd5[_0x27a781['name']]={'$like':'%'+_0x5c5cb6[_0xdaa9('0x2a')][_0xdaa9('0x35')]+'%'};return _0x241fd5;}})});}_0x4ac319=_[_0xdaa9('0x34')]({},_0x4ac319,_0x5c5cb6[_0xdaa9('0x36')]);var _0x13722c={'where':_0x4ac319['where']};return db[_0xdaa9('0x26')]['count'](_0x13722c)[_0xdaa9('0x21')](function(_0x3246f9){_0x5750cc[_0xdaa9('0x1a')]=_0x3246f9;if(_0x5c5cb6[_0xdaa9('0x2a')][_0xdaa9('0x37')]){_0x4ac319['include']=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x4ac319);})['then'](function(_0x1f5374){_0x5750cc[_0xdaa9('0x38')]=_0x1f5374;return _0x5750cc;})[_0xdaa9('0x21')](respondWithFilteredResult(_0x1c6402,_0x4ac319))[_0xdaa9('0x39')](handleError(_0x1c6402,null));};exports[_0xdaa9('0x3a')]=function(_0x49e18f,_0x383b02){var _0x4e848f={'raw':![],'where':{'id':_0x49e18f[_0xdaa9('0x3b')]['id']}},_0x20be88={};_0x20be88[_0xdaa9('0x29')]=_['keys'](db['DeskConfiguration'][_0xdaa9('0x27')]);_0x20be88['query']=_[_0xdaa9('0x3c')](_0x49e18f[_0xdaa9('0x2a')]);_0x20be88[_0xdaa9('0x31')]=_['intersection'](_0x20be88['model'],_0x20be88['query']);_0x4e848f['attributes']=_[_0xdaa9('0x2b')](_0x20be88['model'],qs['fields'](_0x49e18f['query'][_0xdaa9('0x2d')]));_0x4e848f[_0xdaa9('0x2c')]=_0x4e848f[_0xdaa9('0x2c')]['length']?_0x4e848f[_0xdaa9('0x2c')]:_0x20be88['model'];if(_0x49e18f[_0xdaa9('0x2a')][_0xdaa9('0x37')]){_0x4e848f[_0xdaa9('0x3d')]=[{'all':!![]}];}_0x4e848f=_[_0xdaa9('0x34')]({},_0x4e848f,_0x49e18f[_0xdaa9('0x36')]);return db['DeskConfiguration'][_0xdaa9('0x3e')](_0x4e848f)['then'](handleEntityNotFound(_0x383b02,null))['then'](respondWithResult(_0x383b02,null))['catch'](handleError(_0x383b02,null));};exports['create']=function(_0x5ca391,_0x30ff7b){return db['DeskConfiguration'][_0xdaa9('0x3f')](_0x5ca391['body'],{})[_0xdaa9('0x21')](respondWithResult(_0x30ff7b,0xc9))[_0xdaa9('0x39')](handleError(_0x30ff7b,null));};exports['update']=function(_0x3bcb91,_0x18f319){if(_0x3bcb91[_0xdaa9('0x40')]['id']){delete _0x3bcb91[_0xdaa9('0x40')]['id'];}return db[_0xdaa9('0x26')]['find']({'where':{'id':_0x3bcb91[_0xdaa9('0x3b')]['id']}})[_0xdaa9('0x21')](handleEntityNotFound(_0x18f319,null))[_0xdaa9('0x21')](saveUpdates(_0x3bcb91[_0xdaa9('0x40')],null))['then'](respondWithResult(_0x18f319,null))['catch'](handleError(_0x18f319,null));};exports['destroy']=function(_0xc71c72,_0x284003){return db[_0xdaa9('0x26')][_0xdaa9('0x3e')]({'where':{'id':_0xc71c72['params']['id']}})[_0xdaa9('0x21')](handleEntityNotFound(_0x284003,null))[_0xdaa9('0x21')](removeEntity(_0x284003,null))[_0xdaa9('0x39')](handleError(_0x284003,null));};exports['getFields']=function(_0x30da08,_0x2d1c2c,_0x5e8f18){var _0x46a31e={};var _0x5ace54={};var _0x57b249;var _0x47b9a6;return db['DeskConfiguration'][_0xdaa9('0x41')]({'where':{'id':_0x30da08[_0xdaa9('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2d1c2c,null))['then'](function(_0x12e209){if(_0x12e209){_0x57b249=_0x12e209;_0x5ace54[_0xdaa9('0x29')]=_[_0xdaa9('0x3c')](db[_0xdaa9('0x42')]['rawAttributes']);_0x5ace54[_0xdaa9('0x2a')]=_[_0xdaa9('0x3c')](_0x30da08['query']);_0x5ace54[_0xdaa9('0x31')]=_[_0xdaa9('0x2b')](_0x5ace54[_0xdaa9('0x29')],_0x5ace54[_0xdaa9('0x2a')]);_0x46a31e[_0xdaa9('0x2c')]=_['intersection'](_0x5ace54['model'],qs[_0xdaa9('0x2d')](_0x30da08[_0xdaa9('0x2a')][_0xdaa9('0x2d')]));_0x46a31e['attributes']=_0x46a31e[_0xdaa9('0x2c')]['length']?_0x46a31e[_0xdaa9('0x2c')]:_0x5ace54[_0xdaa9('0x29')];_0x46a31e['order']=qs['sort'](_0x30da08[_0xdaa9('0x2a')][_0xdaa9('0x30')]);_0x46a31e[_0xdaa9('0x33')]=qs[_0xdaa9('0x31')](_[_0xdaa9('0x32')](_0x30da08[_0xdaa9('0x2a')],_0x5ace54[_0xdaa9('0x31')]));if(_0x30da08[_0xdaa9('0x2a')][_0xdaa9('0x35')]){_0x46a31e[_0xdaa9('0x33')]=_['merge'](_0x46a31e[_0xdaa9('0x33')],{'$or':_['map'](_0x46a31e[_0xdaa9('0x2c')],function(_0x496a62){var _0x47e5b7={};_0x47e5b7[_0x496a62]={'$like':'%'+_0x30da08[_0xdaa9('0x2a')][_0xdaa9('0x35')]+'%'};return _0x47e5b7;})});}_0x46a31e=_['merge']({},_0x46a31e,_0x30da08['options']);return _0x57b249[_0xdaa9('0x43')](_0x46a31e);}})[_0xdaa9('0x21')](function(_0x3e5deb){if(_0x3e5deb){_0x47b9a6=_0x3e5deb[_0xdaa9('0x2e')];if(!_0x30da08[_0xdaa9('0x2a')][_0xdaa9('0x44')]('nolimit')){_0x46a31e['limit']=qs[_0xdaa9('0x1c')](_0x30da08[_0xdaa9('0x2a')][_0xdaa9('0x1c')]);_0x46a31e['offset']=qs[_0xdaa9('0x1b')](_0x30da08['query'][_0xdaa9('0x1b')]);}return _0x57b249['getFields'](_0x46a31e);}})[_0xdaa9('0x21')](function(_0x443edb){if(_0x443edb){return _0x443edb?{'count':_0x47b9a6,'rows':_0x443edb}:null;}})[_0xdaa9('0x21')](respondWithResult(_0x2d1c2c,null))[_0xdaa9('0x39')](handleError(_0x2d1c2c,null));};exports['getSubjects']=function(_0x38e0f2,_0x4af38a,_0x98cea4){var _0x1cbf8a={};var _0x45ab7a={};var _0x4e7a5d;var _0x4d2573;return db[_0xdaa9('0x26')][_0xdaa9('0x41')]({'where':{'id':_0x38e0f2[_0xdaa9('0x3b')]['id']}})['then'](handleEntityNotFound(_0x4af38a,null))[_0xdaa9('0x21')](function(_0x1258b1){if(_0x1258b1){_0x4e7a5d=_0x1258b1;_0x45ab7a[_0xdaa9('0x29')]=_[_0xdaa9('0x3c')](db[_0xdaa9('0x42')][_0xdaa9('0x27')]);_0x45ab7a['query']=_[_0xdaa9('0x3c')](_0x38e0f2[_0xdaa9('0x2a')]);_0x45ab7a[_0xdaa9('0x31')]=_[_0xdaa9('0x2b')](_0x45ab7a['model'],_0x45ab7a[_0xdaa9('0x2a')]);_0x1cbf8a[_0xdaa9('0x2c')]=_[_0xdaa9('0x2b')](_0x45ab7a[_0xdaa9('0x29')],qs['fields'](_0x38e0f2[_0xdaa9('0x2a')][_0xdaa9('0x2d')]));_0x1cbf8a[_0xdaa9('0x2c')]=_0x1cbf8a[_0xdaa9('0x2c')][_0xdaa9('0x2e')]?_0x1cbf8a[_0xdaa9('0x2c')]:_0x45ab7a[_0xdaa9('0x29')];_0x1cbf8a[_0xdaa9('0x45')]=qs[_0xdaa9('0x30')](_0x38e0f2[_0xdaa9('0x2a')][_0xdaa9('0x30')]);_0x1cbf8a[_0xdaa9('0x33')]=qs[_0xdaa9('0x31')](_[_0xdaa9('0x32')](_0x38e0f2[_0xdaa9('0x2a')],_0x45ab7a[_0xdaa9('0x31')]));if(_0x38e0f2[_0xdaa9('0x2a')][_0xdaa9('0x35')]){_0x1cbf8a[_0xdaa9('0x33')]=_[_0xdaa9('0x34')](_0x1cbf8a['where'],{'$or':_[_0xdaa9('0x25')](_0x1cbf8a['attributes'],function(_0x51ceeb){var _0x3f064d={};_0x3f064d[_0x51ceeb]={'$like':'%'+_0x38e0f2[_0xdaa9('0x2a')][_0xdaa9('0x35')]+'%'};return _0x3f064d;})});}_0x1cbf8a=_[_0xdaa9('0x34')]({},_0x1cbf8a,_0x38e0f2[_0xdaa9('0x36')]);return _0x4e7a5d[_0xdaa9('0x46')](_0x1cbf8a);}})[_0xdaa9('0x21')](function(_0x4ec811){if(_0x4ec811){_0x4d2573=_0x4ec811[_0xdaa9('0x2e')];if(!_0x38e0f2['query'][_0xdaa9('0x44')](_0xdaa9('0x2f'))){_0x1cbf8a[_0xdaa9('0x1c')]=qs[_0xdaa9('0x1c')](_0x38e0f2['query'][_0xdaa9('0x1c')]);_0x1cbf8a[_0xdaa9('0x1b')]=qs['offset'](_0x38e0f2[_0xdaa9('0x2a')][_0xdaa9('0x1b')]);}return _0x4e7a5d['getSubjects'](_0x1cbf8a);}})[_0xdaa9('0x21')](function(_0x1d31ec){if(_0x1d31ec){return _0x1d31ec?{'count':_0x4d2573,'rows':_0x1d31ec}:null;}})['then'](respondWithResult(_0x4af38a,null))[_0xdaa9('0x39')](handleError(_0x4af38a,null));};exports[_0xdaa9('0x47')]=function(_0x5ec24a,_0x446371,_0x229f59){var _0x16d80b={};var _0x571a35={};var _0x48c186;var _0x292bef;return db[_0xdaa9('0x26')]['findOne']({'where':{'id':_0x5ec24a[_0xdaa9('0x3b')]['id']}})[_0xdaa9('0x21')](handleEntityNotFound(_0x446371,null))[_0xdaa9('0x21')](function(_0x146f75){if(_0x146f75){_0x48c186=_0x146f75;_0x571a35[_0xdaa9('0x29')]=_[_0xdaa9('0x3c')](db[_0xdaa9('0x42')][_0xdaa9('0x27')]);_0x571a35[_0xdaa9('0x2a')]=_['keys'](_0x5ec24a['query']);_0x571a35[_0xdaa9('0x31')]=_[_0xdaa9('0x2b')](_0x571a35[_0xdaa9('0x29')],_0x571a35[_0xdaa9('0x2a')]);_0x16d80b[_0xdaa9('0x2c')]=_[_0xdaa9('0x2b')](_0x571a35[_0xdaa9('0x29')],qs[_0xdaa9('0x2d')](_0x5ec24a[_0xdaa9('0x2a')][_0xdaa9('0x2d')]));_0x16d80b['attributes']=_0x16d80b['attributes'][_0xdaa9('0x2e')]?_0x16d80b[_0xdaa9('0x2c')]:_0x571a35[_0xdaa9('0x29')];_0x16d80b['order']=qs[_0xdaa9('0x30')](_0x5ec24a[_0xdaa9('0x2a')][_0xdaa9('0x30')]);_0x16d80b[_0xdaa9('0x33')]=qs['filters'](_[_0xdaa9('0x32')](_0x5ec24a[_0xdaa9('0x2a')],_0x571a35[_0xdaa9('0x31')]));if(_0x5ec24a['query'][_0xdaa9('0x35')]){_0x16d80b[_0xdaa9('0x33')]=_[_0xdaa9('0x34')](_0x16d80b[_0xdaa9('0x33')],{'$or':_[_0xdaa9('0x25')](_0x16d80b[_0xdaa9('0x2c')],function(_0x5e6ca0){var _0x17fc62={};_0x17fc62[_0x5e6ca0]={'$like':'%'+_0x5ec24a['query'][_0xdaa9('0x35')]+'%'};return _0x17fc62;})});}_0x16d80b=_[_0xdaa9('0x34')]({},_0x16d80b,_0x5ec24a[_0xdaa9('0x36')]);return _0x48c186[_0xdaa9('0x47')](_0x16d80b);}})[_0xdaa9('0x21')](function(_0x593d06){if(_0x593d06){_0x292bef=_0x593d06[_0xdaa9('0x2e')];if(!_0x5ec24a[_0xdaa9('0x2a')][_0xdaa9('0x44')](_0xdaa9('0x2f'))){_0x16d80b['limit']=qs[_0xdaa9('0x1c')](_0x5ec24a[_0xdaa9('0x2a')][_0xdaa9('0x1c')]);_0x16d80b['offset']=qs[_0xdaa9('0x1b')](_0x5ec24a[_0xdaa9('0x2a')][_0xdaa9('0x1b')]);}return _0x48c186[_0xdaa9('0x47')](_0x16d80b);}})[_0xdaa9('0x21')](function(_0x4d5347){if(_0x4d5347){return _0x4d5347?{'count':_0x292bef,'rows':_0x4d5347}:null;}})['then'](respondWithResult(_0x446371,null))[_0xdaa9('0x39')](handleError(_0x446371,null));};exports['getTags']=function(_0x2c43e7,_0x3255cd,_0x1cca01){var _0x4c592a={};var _0x2c7f78={};var _0x21d0ff;var _0x3ebba3;return db[_0xdaa9('0x26')][_0xdaa9('0x41')]({'where':{'id':_0x2c43e7[_0xdaa9('0x3b')]['id']}})[_0xdaa9('0x21')](handleEntityNotFound(_0x3255cd,null))['then'](function(_0x3350c4){if(_0x3350c4){_0x21d0ff=_0x3350c4;_0x2c7f78[_0xdaa9('0x29')]=_[_0xdaa9('0x3c')](db[_0xdaa9('0x48')][_0xdaa9('0x27')]);_0x2c7f78['query']=_[_0xdaa9('0x3c')](_0x2c43e7[_0xdaa9('0x2a')]);_0x2c7f78[_0xdaa9('0x31')]=_[_0xdaa9('0x2b')](_0x2c7f78[_0xdaa9('0x29')],_0x2c7f78[_0xdaa9('0x2a')]);_0x4c592a['attributes']=_['intersection'](_0x2c7f78[_0xdaa9('0x29')],qs[_0xdaa9('0x2d')](_0x2c43e7['query']['fields']));_0x4c592a[_0xdaa9('0x2c')]=_0x4c592a[_0xdaa9('0x2c')][_0xdaa9('0x2e')]?_0x4c592a[_0xdaa9('0x2c')]:_0x2c7f78['model'];_0x4c592a[_0xdaa9('0x45')]=qs[_0xdaa9('0x30')](_0x2c43e7[_0xdaa9('0x2a')]['sort']);_0x4c592a[_0xdaa9('0x33')]=qs[_0xdaa9('0x31')](_[_0xdaa9('0x32')](_0x2c43e7[_0xdaa9('0x2a')],_0x2c7f78[_0xdaa9('0x31')]));if(_0x2c43e7[_0xdaa9('0x2a')][_0xdaa9('0x35')]){_0x4c592a[_0xdaa9('0x33')]=_[_0xdaa9('0x34')](_0x4c592a[_0xdaa9('0x33')],{'$or':_[_0xdaa9('0x25')](_0x4c592a[_0xdaa9('0x2c')],function(_0x1e5b8f){var _0x3c9785={};_0x3c9785[_0x1e5b8f]={'$like':'%'+_0x2c43e7[_0xdaa9('0x2a')][_0xdaa9('0x35')]+'%'};return _0x3c9785;})});}_0x4c592a=_[_0xdaa9('0x34')]({},_0x4c592a,_0x2c43e7[_0xdaa9('0x36')]);return _0x21d0ff[_0xdaa9('0x49')](_0x4c592a);}})[_0xdaa9('0x21')](function(_0x8ea916){if(_0x8ea916){_0x3ebba3=_0x8ea916[_0xdaa9('0x2e')];if(!_0x2c43e7[_0xdaa9('0x2a')][_0xdaa9('0x44')](_0xdaa9('0x2f'))){_0x4c592a['limit']=qs['limit'](_0x2c43e7[_0xdaa9('0x2a')][_0xdaa9('0x1c')]);_0x4c592a['offset']=qs[_0xdaa9('0x1b')](_0x2c43e7[_0xdaa9('0x2a')]['offset']);}return _0x21d0ff[_0xdaa9('0x49')](_0x4c592a);}})[_0xdaa9('0x21')](function(_0x42bdda){if(_0x42bdda){return _0x42bdda?{'count':_0x3ebba3,'rows':_0x42bdda}:null;}})['then'](respondWithResult(_0x3255cd,null))[_0xdaa9('0x39')](handleError(_0x3255cd,null));};exports['setTags']=function(_0x2a6054,_0x2d30a3,_0x2f5d6b){if(_0x2a6054['body']['id']){delete _0x2a6054['body']['id'];}return db[_0xdaa9('0x26')][_0xdaa9('0x41')]({'where':{'id':_0x2a6054['params']['id']}})[_0xdaa9('0x21')](handleEntityNotFound(_0x2d30a3,null))[_0xdaa9('0x21')](function(_0x1e958e){if(_0x1e958e){return _0x1e958e[_0xdaa9('0x4a')](_0x2a6054['body']['ids']||[]);}return null;})[_0xdaa9('0x21')](respondWithResult(_0x2d30a3,null))[_0xdaa9('0x39')](handleError(_0x2d30a3,null));};
\ No newline at end of file
+var _0x98eb=['set','Content-Range','apply','reject','save','update','destroy','error','stack','name','index','map','DeskConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','then','params','length','catch','create','body','find','getFields','findOne','DeskField','order','nolimit','getSubjects','getDescriptions','getTags','Tag','hasOwnProperty','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','json','offset','limit','undefined','count','status'];(function(_0x24bfe2,_0x4ba64a){var _0x53d71d=function(_0x3f4dee){while(--_0x3f4dee){_0x24bfe2['push'](_0x24bfe2['shift']());}};_0x53d71d(++_0x4ba64a);}(_0x98eb,0x12d));var _0xb98e=function(_0x286bfb,_0x46ac3c){_0x286bfb=_0x286bfb-0x0;var _0x52b683=_0x98eb[_0x286bfb];return _0x52b683;};'use strict';var emlformat=require(_0xb98e('0x0'));var rimraf=require(_0xb98e('0x1'));var zipdir=require(_0xb98e('0x2'));var jsonpatch=require(_0xb98e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb98e('0x4'));var util=require(_0xb98e('0x5'));var path=require(_0xb98e('0x6'));var sox=require(_0xb98e('0x7'));var csv=require(_0xb98e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb98e('0x9'));var squel=require('squel');var crypto=require(_0xb98e('0xa'));var jsforce=require(_0xb98e('0xb'));var deskjs=require(_0xb98e('0xc'));var toCsv=require(_0xb98e('0x8'));var querystring=require(_0xb98e('0xd'));var Papa=require(_0xb98e('0xe'));var Redis=require(_0xb98e('0xf'));var authService=require(_0xb98e('0x10'));var qs=require(_0xb98e('0x11'));var as=require(_0xb98e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb98e('0x13'))('api');var utils=require(_0xb98e('0x14'));var config=require(_0xb98e('0x15'));var licenseUtil=require(_0xb98e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x361ba2,_0x5c6d8b){_0x5c6d8b=_0x5c6d8b||0xcc;return function(_0x1e3244){if(_0x1e3244){return _0x361ba2[_0xb98e('0x17')](_0x5c6d8b);}return _0x361ba2['status'](_0x5c6d8b)[_0xb98e('0x18')]();};}function respondWithResult(_0x45a3aa,_0x14ba57){_0x14ba57=_0x14ba57||0xc8;return function(_0x2868ef){if(_0x2868ef){return _0x45a3aa['status'](_0x14ba57)[_0xb98e('0x19')](_0x2868ef);}};}function respondWithFilteredResult(_0x276390,_0x18353f){return function(_0x2aa88a){if(_0x2aa88a){var _0x8edefd=typeof _0x18353f[_0xb98e('0x1a')]==='undefined'&&typeof _0x18353f[_0xb98e('0x1b')]===_0xb98e('0x1c');var _0x5e4159=_0x2aa88a[_0xb98e('0x1d')];var _0x54b621=_0x8edefd?0x0:_0x18353f[_0xb98e('0x1a')];var _0x16f180=_0x8edefd?_0x2aa88a[_0xb98e('0x1d')]:_0x18353f[_0xb98e('0x1a')]+_0x18353f[_0xb98e('0x1b')];var _0x4ecc1a;if(_0x16f180>=_0x5e4159){_0x16f180=_0x5e4159;_0x4ecc1a=0xc8;}else{_0x4ecc1a=0xce;}_0x276390[_0xb98e('0x1e')](_0x4ecc1a);return _0x276390[_0xb98e('0x1f')](_0xb98e('0x20'),_0x54b621+'-'+_0x16f180+'/'+_0x5e4159)[_0xb98e('0x19')](_0x2aa88a);}return null;};}function patchUpdates(_0x325b52){return function(_0x118d5d){try{jsonpatch[_0xb98e('0x21')](_0x118d5d,_0x325b52,!![]);}catch(_0x332bf7){return BPromise[_0xb98e('0x22')](_0x332bf7);}return _0x118d5d[_0xb98e('0x23')]();};}function saveUpdates(_0x46d99b,_0x2617f2){return function(_0x49837d){if(_0x49837d){return _0x49837d[_0xb98e('0x24')](_0x46d99b)['then'](function(_0x34e0f2){return _0x34e0f2;});}return null;};}function removeEntity(_0x1afe84,_0x3de9a2){return function(_0x35ded2){if(_0x35ded2){return _0x35ded2[_0xb98e('0x25')]()['then'](function(){_0x1afe84[_0xb98e('0x1e')](0xcc)[_0xb98e('0x18')]();});}};}function handleEntityNotFound(_0x5e6407,_0x213dcc){return function(_0x406efa){if(!_0x406efa){_0x5e6407[_0xb98e('0x17')](0x194);}return _0x406efa;};}function handleError(_0x282774,_0x569241){_0x569241=_0x569241||0x1f4;return function(_0x169255){logger[_0xb98e('0x26')](_0x169255[_0xb98e('0x27')]);if(_0x169255[_0xb98e('0x28')]){delete _0x169255[_0xb98e('0x28')];}_0x282774[_0xb98e('0x1e')](_0x569241)['send'](_0x169255);};}exports[_0xb98e('0x29')]=function(_0x356489,_0x3a9157){var _0x8a6f61={},_0x4f8856={},_0x541b12={'count':0x0,'rows':[]};var _0x514706=_[_0xb98e('0x2a')](db[_0xb98e('0x2b')][_0xb98e('0x2c')],function(_0x34e82c){return{'name':_0x34e82c[_0xb98e('0x2d')],'type':_0x34e82c[_0xb98e('0x2e')]['key']};});_0x4f8856['model']=_[_0xb98e('0x2a')](_0x514706,_0xb98e('0x28'));_0x4f8856[_0xb98e('0x2f')]=_[_0xb98e('0x30')](_0x356489[_0xb98e('0x2f')]);_0x4f8856[_0xb98e('0x31')]=_[_0xb98e('0x32')](_0x4f8856[_0xb98e('0x33')],_0x4f8856[_0xb98e('0x2f')]);_0x8a6f61[_0xb98e('0x34')]=_[_0xb98e('0x32')](_0x4f8856[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x356489[_0xb98e('0x2f')][_0xb98e('0x35')]));_0x8a6f61['attributes']=_0x8a6f61[_0xb98e('0x34')]['length']?_0x8a6f61[_0xb98e('0x34')]:_0x4f8856[_0xb98e('0x33')];if(!_0x356489['query']['hasOwnProperty']('nolimit')){_0x8a6f61[_0xb98e('0x1b')]=qs['limit'](_0x356489[_0xb98e('0x2f')][_0xb98e('0x1b')]);_0x8a6f61['offset']=qs[_0xb98e('0x1a')](_0x356489[_0xb98e('0x2f')][_0xb98e('0x1a')]);}_0x8a6f61['order']=qs[_0xb98e('0x36')](_0x356489['query'][_0xb98e('0x36')]);_0x8a6f61[_0xb98e('0x37')]=qs['filters'](_[_0xb98e('0x38')](_0x356489[_0xb98e('0x2f')],_0x4f8856[_0xb98e('0x31')]),_0x514706);if(_0x356489['query'][_0xb98e('0x39')]){_0x8a6f61['where']=_[_0xb98e('0x3a')](_0x8a6f61[_0xb98e('0x37')],{'$or':_[_0xb98e('0x2a')](_0x514706,function(_0x28678){if(_0x28678[_0xb98e('0x2e')]!==_0xb98e('0x3b')){var _0x3c3684={};_0x3c3684[_0x28678[_0xb98e('0x28')]]={'$like':'%'+_0x356489[_0xb98e('0x2f')][_0xb98e('0x39')]+'%'};return _0x3c3684;}})});}_0x8a6f61=_[_0xb98e('0x3a')]({},_0x8a6f61,_0x356489[_0xb98e('0x3c')]);var _0x17b723={'where':_0x8a6f61[_0xb98e('0x37')]};return db[_0xb98e('0x2b')]['count'](_0x17b723)['then'](function(_0x2e62d2){_0x541b12[_0xb98e('0x1d')]=_0x2e62d2;if(_0x356489[_0xb98e('0x2f')][_0xb98e('0x3d')]){_0x8a6f61[_0xb98e('0x3e')]=[{'all':!![]}];}return db[_0xb98e('0x2b')]['findAll'](_0x8a6f61);})['then'](function(_0x416757){_0x541b12[_0xb98e('0x3f')]=_0x416757;return _0x541b12;})[_0xb98e('0x40')](respondWithFilteredResult(_0x3a9157,_0x8a6f61))['catch'](handleError(_0x3a9157,null));};exports['show']=function(_0x28e1fa,_0x43ac32){var _0x4bbff0={'raw':![],'where':{'id':_0x28e1fa[_0xb98e('0x41')]['id']}},_0x36e4f1={};_0x36e4f1[_0xb98e('0x33')]=_[_0xb98e('0x30')](db[_0xb98e('0x2b')][_0xb98e('0x2c')]);_0x36e4f1['query']=_['keys'](_0x28e1fa[_0xb98e('0x2f')]);_0x36e4f1[_0xb98e('0x31')]=_[_0xb98e('0x32')](_0x36e4f1[_0xb98e('0x33')],_0x36e4f1[_0xb98e('0x2f')]);_0x4bbff0[_0xb98e('0x34')]=_[_0xb98e('0x32')](_0x36e4f1[_0xb98e('0x33')],qs['fields'](_0x28e1fa['query']['fields']));_0x4bbff0[_0xb98e('0x34')]=_0x4bbff0[_0xb98e('0x34')][_0xb98e('0x42')]?_0x4bbff0['attributes']:_0x36e4f1['model'];if(_0x28e1fa[_0xb98e('0x2f')][_0xb98e('0x3d')]){_0x4bbff0[_0xb98e('0x3e')]=[{'all':!![]}];}_0x4bbff0=_[_0xb98e('0x3a')]({},_0x4bbff0,_0x28e1fa[_0xb98e('0x3c')]);return db[_0xb98e('0x2b')]['find'](_0x4bbff0)['then'](handleEntityNotFound(_0x43ac32,null))[_0xb98e('0x40')](respondWithResult(_0x43ac32,null))[_0xb98e('0x43')](handleError(_0x43ac32,null));};exports[_0xb98e('0x44')]=function(_0x145c6c,_0x587cd9){return db[_0xb98e('0x2b')][_0xb98e('0x44')](_0x145c6c[_0xb98e('0x45')],{})[_0xb98e('0x40')](respondWithResult(_0x587cd9,0xc9))['catch'](handleError(_0x587cd9,null));};exports['update']=function(_0x42fe4e,_0x4a6e98){if(_0x42fe4e[_0xb98e('0x45')]['id']){delete _0x42fe4e[_0xb98e('0x45')]['id'];}return db[_0xb98e('0x2b')][_0xb98e('0x46')]({'where':{'id':_0x42fe4e[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x4a6e98,null))[_0xb98e('0x40')](saveUpdates(_0x42fe4e['body'],null))[_0xb98e('0x40')](respondWithResult(_0x4a6e98,null))[_0xb98e('0x43')](handleError(_0x4a6e98,null));};exports['destroy']=function(_0x23d36e,_0x5c249d){return db['DeskConfiguration'][_0xb98e('0x46')]({'where':{'id':_0x23d36e['params']['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x5c249d,null))['then'](removeEntity(_0x5c249d,null))[_0xb98e('0x43')](handleError(_0x5c249d,null));};exports[_0xb98e('0x47')]=function(_0x192936,_0x1cf1bd,_0x2bfb65){var _0x503bf8={};var _0x4c9a8e={};var _0x349cb3;var _0x203763;return db['DeskConfiguration'][_0xb98e('0x48')]({'where':{'id':_0x192936[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x1cf1bd,null))[_0xb98e('0x40')](function(_0x17b9be){if(_0x17b9be){_0x349cb3=_0x17b9be;_0x4c9a8e[_0xb98e('0x33')]=_[_0xb98e('0x30')](db[_0xb98e('0x49')]['rawAttributes']);_0x4c9a8e[_0xb98e('0x2f')]=_['keys'](_0x192936['query']);_0x4c9a8e[_0xb98e('0x31')]=_['intersection'](_0x4c9a8e[_0xb98e('0x33')],_0x4c9a8e['query']);_0x503bf8[_0xb98e('0x34')]=_[_0xb98e('0x32')](_0x4c9a8e[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x192936['query'][_0xb98e('0x35')]));_0x503bf8[_0xb98e('0x34')]=_0x503bf8[_0xb98e('0x34')][_0xb98e('0x42')]?_0x503bf8[_0xb98e('0x34')]:_0x4c9a8e[_0xb98e('0x33')];_0x503bf8[_0xb98e('0x4a')]=qs[_0xb98e('0x36')](_0x192936[_0xb98e('0x2f')][_0xb98e('0x36')]);_0x503bf8['where']=qs[_0xb98e('0x31')](_[_0xb98e('0x38')](_0x192936[_0xb98e('0x2f')],_0x4c9a8e['filters']));if(_0x192936['query'][_0xb98e('0x39')]){_0x503bf8[_0xb98e('0x37')]=_[_0xb98e('0x3a')](_0x503bf8['where'],{'$or':_[_0xb98e('0x2a')](_0x503bf8[_0xb98e('0x34')],function(_0x293f64){var _0xdd0077={};_0xdd0077[_0x293f64]={'$like':'%'+_0x192936['query'][_0xb98e('0x39')]+'%'};return _0xdd0077;})});}_0x503bf8=_['merge']({},_0x503bf8,_0x192936['options']);return _0x349cb3[_0xb98e('0x47')](_0x503bf8);}})['then'](function(_0x26035c){if(_0x26035c){_0x203763=_0x26035c[_0xb98e('0x42')];if(!_0x192936['query']['hasOwnProperty'](_0xb98e('0x4b'))){_0x503bf8[_0xb98e('0x1b')]=qs[_0xb98e('0x1b')](_0x192936[_0xb98e('0x2f')][_0xb98e('0x1b')]);_0x503bf8[_0xb98e('0x1a')]=qs[_0xb98e('0x1a')](_0x192936[_0xb98e('0x2f')][_0xb98e('0x1a')]);}return _0x349cb3[_0xb98e('0x47')](_0x503bf8);}})['then'](function(_0x4a11c8){if(_0x4a11c8){return _0x4a11c8?{'count':_0x203763,'rows':_0x4a11c8}:null;}})[_0xb98e('0x40')](respondWithResult(_0x1cf1bd,null))[_0xb98e('0x43')](handleError(_0x1cf1bd,null));};exports[_0xb98e('0x4c')]=function(_0x29b4ac,_0x257750,_0x4fe595){var _0x4a9384={};var _0x42658a={};var _0x556fe4;var _0x1c2968;return db[_0xb98e('0x2b')][_0xb98e('0x48')]({'where':{'id':_0x29b4ac['params']['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x257750,null))[_0xb98e('0x40')](function(_0x12c88f){if(_0x12c88f){_0x556fe4=_0x12c88f;_0x42658a[_0xb98e('0x33')]=_[_0xb98e('0x30')](db[_0xb98e('0x49')]['rawAttributes']);_0x42658a[_0xb98e('0x2f')]=_[_0xb98e('0x30')](_0x29b4ac['query']);_0x42658a['filters']=_['intersection'](_0x42658a[_0xb98e('0x33')],_0x42658a[_0xb98e('0x2f')]);_0x4a9384[_0xb98e('0x34')]=_[_0xb98e('0x32')](_0x42658a[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x29b4ac[_0xb98e('0x2f')][_0xb98e('0x35')]));_0x4a9384[_0xb98e('0x34')]=_0x4a9384[_0xb98e('0x34')]['length']?_0x4a9384[_0xb98e('0x34')]:_0x42658a[_0xb98e('0x33')];_0x4a9384[_0xb98e('0x4a')]=qs[_0xb98e('0x36')](_0x29b4ac[_0xb98e('0x2f')][_0xb98e('0x36')]);_0x4a9384['where']=qs[_0xb98e('0x31')](_['pick'](_0x29b4ac[_0xb98e('0x2f')],_0x42658a[_0xb98e('0x31')]));if(_0x29b4ac['query'][_0xb98e('0x39')]){_0x4a9384[_0xb98e('0x37')]=_[_0xb98e('0x3a')](_0x4a9384[_0xb98e('0x37')],{'$or':_[_0xb98e('0x2a')](_0x4a9384[_0xb98e('0x34')],function(_0x1e128d){var _0x42dcb0={};_0x42dcb0[_0x1e128d]={'$like':'%'+_0x29b4ac[_0xb98e('0x2f')][_0xb98e('0x39')]+'%'};return _0x42dcb0;})});}_0x4a9384=_[_0xb98e('0x3a')]({},_0x4a9384,_0x29b4ac[_0xb98e('0x3c')]);return _0x556fe4[_0xb98e('0x4c')](_0x4a9384);}})[_0xb98e('0x40')](function(_0x49ab0f){if(_0x49ab0f){_0x1c2968=_0x49ab0f[_0xb98e('0x42')];if(!_0x29b4ac[_0xb98e('0x2f')]['hasOwnProperty'](_0xb98e('0x4b'))){_0x4a9384[_0xb98e('0x1b')]=qs[_0xb98e('0x1b')](_0x29b4ac['query'][_0xb98e('0x1b')]);_0x4a9384[_0xb98e('0x1a')]=qs['offset'](_0x29b4ac[_0xb98e('0x2f')][_0xb98e('0x1a')]);}return _0x556fe4[_0xb98e('0x4c')](_0x4a9384);}})['then'](function(_0x55fa01){if(_0x55fa01){return _0x55fa01?{'count':_0x1c2968,'rows':_0x55fa01}:null;}})['then'](respondWithResult(_0x257750,null))[_0xb98e('0x43')](handleError(_0x257750,null));};exports[_0xb98e('0x4d')]=function(_0x1bde71,_0x41e083,_0x53c6f1){var _0x91e3bf={};var _0x33cd60={};var _0x5a9b37;var _0x150d95;return db[_0xb98e('0x2b')][_0xb98e('0x48')]({'where':{'id':_0x1bde71[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x41e083,null))[_0xb98e('0x40')](function(_0x19b843){if(_0x19b843){_0x5a9b37=_0x19b843;_0x33cd60['model']=_[_0xb98e('0x30')](db[_0xb98e('0x49')][_0xb98e('0x2c')]);_0x33cd60[_0xb98e('0x2f')]=_[_0xb98e('0x30')](_0x1bde71['query']);_0x33cd60['filters']=_[_0xb98e('0x32')](_0x33cd60['model'],_0x33cd60[_0xb98e('0x2f')]);_0x91e3bf[_0xb98e('0x34')]=_['intersection'](_0x33cd60[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x1bde71[_0xb98e('0x2f')][_0xb98e('0x35')]));_0x91e3bf['attributes']=_0x91e3bf['attributes'][_0xb98e('0x42')]?_0x91e3bf[_0xb98e('0x34')]:_0x33cd60[_0xb98e('0x33')];_0x91e3bf[_0xb98e('0x4a')]=qs[_0xb98e('0x36')](_0x1bde71[_0xb98e('0x2f')]['sort']);_0x91e3bf[_0xb98e('0x37')]=qs[_0xb98e('0x31')](_[_0xb98e('0x38')](_0x1bde71[_0xb98e('0x2f')],_0x33cd60[_0xb98e('0x31')]));if(_0x1bde71['query'][_0xb98e('0x39')]){_0x91e3bf[_0xb98e('0x37')]=_[_0xb98e('0x3a')](_0x91e3bf[_0xb98e('0x37')],{'$or':_['map'](_0x91e3bf[_0xb98e('0x34')],function(_0x419630){var _0x45389d={};_0x45389d[_0x419630]={'$like':'%'+_0x1bde71['query'][_0xb98e('0x39')]+'%'};return _0x45389d;})});}_0x91e3bf=_[_0xb98e('0x3a')]({},_0x91e3bf,_0x1bde71[_0xb98e('0x3c')]);return _0x5a9b37[_0xb98e('0x4d')](_0x91e3bf);}})[_0xb98e('0x40')](function(_0x2fe0c8){if(_0x2fe0c8){_0x150d95=_0x2fe0c8[_0xb98e('0x42')];if(!_0x1bde71[_0xb98e('0x2f')]['hasOwnProperty'](_0xb98e('0x4b'))){_0x91e3bf['limit']=qs[_0xb98e('0x1b')](_0x1bde71[_0xb98e('0x2f')]['limit']);_0x91e3bf['offset']=qs[_0xb98e('0x1a')](_0x1bde71[_0xb98e('0x2f')][_0xb98e('0x1a')]);}return _0x5a9b37[_0xb98e('0x4d')](_0x91e3bf);}})[_0xb98e('0x40')](function(_0x52b27e){if(_0x52b27e){return _0x52b27e?{'count':_0x150d95,'rows':_0x52b27e}:null;}})[_0xb98e('0x40')](respondWithResult(_0x41e083,null))[_0xb98e('0x43')](handleError(_0x41e083,null));};exports[_0xb98e('0x4e')]=function(_0x5cefdb,_0x3471c5,_0x18a209){var _0x2a8142={};var _0x10e3d0={};var _0x5ac302;var _0x2c6f4d;return db['DeskConfiguration'][_0xb98e('0x48')]({'where':{'id':_0x5cefdb[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x3471c5,null))[_0xb98e('0x40')](function(_0x37120d){if(_0x37120d){_0x5ac302=_0x37120d;_0x10e3d0['model']=_['keys'](db[_0xb98e('0x4f')][_0xb98e('0x2c')]);_0x10e3d0['query']=_[_0xb98e('0x30')](_0x5cefdb[_0xb98e('0x2f')]);_0x10e3d0[_0xb98e('0x31')]=_[_0xb98e('0x32')](_0x10e3d0[_0xb98e('0x33')],_0x10e3d0[_0xb98e('0x2f')]);_0x2a8142[_0xb98e('0x34')]=_['intersection'](_0x10e3d0[_0xb98e('0x33')],qs[_0xb98e('0x35')](_0x5cefdb['query'][_0xb98e('0x35')]));_0x2a8142[_0xb98e('0x34')]=_0x2a8142[_0xb98e('0x34')]['length']?_0x2a8142[_0xb98e('0x34')]:_0x10e3d0[_0xb98e('0x33')];_0x2a8142[_0xb98e('0x4a')]=qs[_0xb98e('0x36')](_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x36')]);_0x2a8142[_0xb98e('0x37')]=qs[_0xb98e('0x31')](_[_0xb98e('0x38')](_0x5cefdb[_0xb98e('0x2f')],_0x10e3d0[_0xb98e('0x31')]));if(_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x39')]){_0x2a8142[_0xb98e('0x37')]=_['merge'](_0x2a8142['where'],{'$or':_['map'](_0x2a8142[_0xb98e('0x34')],function(_0xf74a1){var _0x45ff2d={};_0x45ff2d[_0xf74a1]={'$like':'%'+_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x39')]+'%'};return _0x45ff2d;})});}_0x2a8142=_[_0xb98e('0x3a')]({},_0x2a8142,_0x5cefdb[_0xb98e('0x3c')]);return _0x5ac302[_0xb98e('0x4e')](_0x2a8142);}})['then'](function(_0x1746cd){if(_0x1746cd){_0x2c6f4d=_0x1746cd[_0xb98e('0x42')];if(!_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x50')](_0xb98e('0x4b'))){_0x2a8142['limit']=qs['limit'](_0x5cefdb['query'][_0xb98e('0x1b')]);_0x2a8142[_0xb98e('0x1a')]=qs[_0xb98e('0x1a')](_0x5cefdb[_0xb98e('0x2f')][_0xb98e('0x1a')]);}return _0x5ac302[_0xb98e('0x4e')](_0x2a8142);}})[_0xb98e('0x40')](function(_0xd1a810){if(_0xd1a810){return _0xd1a810?{'count':_0x2c6f4d,'rows':_0xd1a810}:null;}})[_0xb98e('0x40')](respondWithResult(_0x3471c5,null))[_0xb98e('0x43')](handleError(_0x3471c5,null));};exports[_0xb98e('0x51')]=function(_0x28883e,_0x640a5c,_0x4649e5){if(_0x28883e[_0xb98e('0x45')]['id']){delete _0x28883e[_0xb98e('0x45')]['id'];}return db[_0xb98e('0x2b')][_0xb98e('0x48')]({'where':{'id':_0x28883e[_0xb98e('0x41')]['id']}})[_0xb98e('0x40')](handleEntityNotFound(_0x640a5c,null))['then'](function(_0x5ed15b){if(_0x5ed15b){return _0x5ed15b[_0xb98e('0x51')](_0x28883e['body'][_0xb98e('0x52')]||[]);}return null;})[_0xb98e('0x40')](respondWithResult(_0x640a5c,null))[_0xb98e('0x43')](handleError(_0x640a5c,null));};
\ No newline at end of file
index b160fad..35003f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7e05=['../../config/environment','./intDeskConfiguration.attributes','exports','define','int_desk_configurations','lodash','util','api','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7e05,0x69));var _0x57e0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7e05[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x57e0('0x0'));var util=require(_0x57e0('0x1'));var logger=require('../../config/logger')(_0x57e0('0x2'));var moment=require('moment');var BPromise=require(_0x57e0('0x3'));var rp=require(_0x57e0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x57e0('0x5'));var attributes=require(_0x57e0('0x6'));module[_0x57e0('0x7')]=function(_0x327596,_0x5f4f7e){return _0x327596[_0x57e0('0x8')]('DeskConfiguration',attributes,{'tableName':_0x57e0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x196d=['util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define','DeskConfiguration','int_desk_configurations','lodash'];(function(_0x553183,_0x5479b4){var _0xfc0ebe=function(_0x4a2bbf){while(--_0x4a2bbf){_0x553183['push'](_0x553183['shift']());}};_0xfc0ebe(++_0x5479b4);}(_0x196d,0x112));var _0xd196=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x196d[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xd196('0x0'));var util=require(_0xd196('0x1'));var logger=require(_0xd196('0x2'))('api');var moment=require(_0xd196('0x3'));var BPromise=require('bluebird');var rp=require(_0xd196('0x4'));var fs=require('fs');var path=require(_0xd196('0x5'));var rimraf=require('rimraf');var config=require(_0xd196('0x6'));var attributes=require('./intDeskConfiguration.attributes');module[_0xd196('0x7')]=function(_0x4918d9,_0x268927){return _0x4918d9[_0xd196('0x8')](_0xd196('0x9'),attributes,{'tableName':_0xd196('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7f82e9b..ca7e812 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x391f=['DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1172aa,_0x12d652){var _0x21a7e0=function(_0x563a44){while(--_0x563a44){_0x1172aa['push'](_0x1172aa['shift']());}};_0x21a7e0(++_0x12d652);}(_0x391f,0x10c));var _0xf391=function(_0x1ba7e3,_0xcb6c74){_0x1ba7e3=_0x1ba7e3-0x0;var _0x4a72f3=_0x391f[_0x1ba7e3];return _0x4a72f3;};'use strict';var _=require(_0xf391('0x0'));var util=require(_0xf391('0x1'));var moment=require(_0xf391('0x2'));var BPromise=require(_0xf391('0x3'));var rs=require(_0xf391('0x4'));var fs=require('fs');var Redis=require(_0xf391('0x5'));var db=require(_0xf391('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf391('0x7'))(_0xf391('0x8'));var config=require(_0xf391('0x9'));var jayson=require(_0xf391('0xa'));var client=jayson[_0xf391('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x46eb7f,_0x3d0981,_0x25de03){return new BPromise(function(_0x202a8a,_0x976646){return client['request'](_0x46eb7f,_0x25de03)[_0xf391('0xc')](function(_0x228094){logger[_0xf391('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x3d0981,'request\x20sent');logger[_0xf391('0xe')](_0xf391('0xf'),_0x3d0981,'request\x20sent',JSON['stringify'](_0x228094));if(_0x228094[_0xf391('0x10')]){if(_0x228094['error'][_0xf391('0x11')]===0x1f4){logger[_0xf391('0x10')](_0xf391('0x12'),_0x3d0981,_0x228094['error'][_0xf391('0x13')]);return _0x976646(_0x228094[_0xf391('0x10')][_0xf391('0x13')]);}logger[_0xf391('0x10')](_0xf391('0x12'),_0x3d0981,_0x228094[_0xf391('0x10')]['message']);return _0x202a8a(_0x228094[_0xf391('0x10')][_0xf391('0x13')]);}else{logger['info'](_0xf391('0x12'),_0x3d0981,'request\x20sent');_0x202a8a(_0x228094[_0xf391('0x14')][_0xf391('0x13')]);}})[_0xf391('0x15')](function(_0x173850){logger[_0xf391('0x10')]('DeskConfiguration,\x20%s,\x20%s',_0x3d0981,_0x173850);_0x976646(_0x173850);});});}
\ No newline at end of file
+var _0x5eca=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','DeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x5f44cb,_0x564cc1){var _0x5ca561=function(_0x309f40){while(--_0x309f40){_0x5f44cb['push'](_0x5f44cb['shift']());}};_0x5ca561(++_0x564cc1);}(_0x5eca,0x10e));var _0xa5ec=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x5eca[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xa5ec('0x0'));var util=require(_0xa5ec('0x1'));var moment=require(_0xa5ec('0x2'));var BPromise=require(_0xa5ec('0x3'));var rs=require(_0xa5ec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa5ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa5ec('0x6'));var config=require(_0xa5ec('0x7'));var jayson=require(_0xa5ec('0x8'));var client=jayson[_0xa5ec('0x9')][_0xa5ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cdf5e,_0x127519,_0x5f314e){return new BPromise(function(_0x436828,_0x65aa33){return client['request'](_0x2cdf5e,_0x5f314e)[_0xa5ec('0xb')](function(_0x4e60cc){logger[_0xa5ec('0xc')](_0xa5ec('0xd'),_0x127519,_0xa5ec('0xe'));logger['debug'](_0xa5ec('0xf'),_0x127519,_0xa5ec('0xe'),JSON[_0xa5ec('0x10')](_0x4e60cc));if(_0x4e60cc[_0xa5ec('0x11')]){if(_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x12')]===0x1f4){logger[_0xa5ec('0x11')](_0xa5ec('0xd'),_0x127519,_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x13')]);return _0x65aa33(_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x13')]);}logger[_0xa5ec('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x127519,_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x13')]);return _0x436828(_0x4e60cc[_0xa5ec('0x11')][_0xa5ec('0x13')]);}else{logger[_0xa5ec('0xc')](_0xa5ec('0xd'),_0x127519,'request\x20sent');_0x436828(_0x4e60cc[_0xa5ec('0x14')]['message']);}})[_0xa5ec('0x15')](function(_0x35e4a7){logger[_0xa5ec('0x11')](_0xa5ec('0xd'),_0x127519,_0x35e4a7);_0x65aa33(_0x35e4a7);});});}
\ No newline at end of file
index bfd3a79..a4ed926 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b57=['create','put','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x449328,_0x403777){var _0x5f333d=function(_0x26e976){while(--_0x26e976){_0x449328['push'](_0x449328['shift']());}};_0x5f333d(++_0x403777);}(_0x3b57,0x103));var _0x73b5=function(_0x1008b9,_0x40b907){_0x1008b9=_0x1008b9-0x0;var _0x346f4a=_0x3b57[_0x1008b9];return _0x346f4a;};'use strict';var multer=require(_0x73b5('0x0'));var util=require('util');var path=require(_0x73b5('0x1'));var timeout=require(_0x73b5('0x2'));var express=require('express');var router=express[_0x73b5('0x3')]();var fs_extra=require(_0x73b5('0x4'));var auth=require(_0x73b5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x73b5('0x6'));var controller=require('./intDeskField.controller');router[_0x73b5('0x7')]('/',auth[_0x73b5('0x8')](),controller['index']);router['get'](_0x73b5('0x9'),auth[_0x73b5('0x8')](),controller[_0x73b5('0xa')]);router['post']('/',auth[_0x73b5('0x8')](),controller[_0x73b5('0xb')]);router[_0x73b5('0xc')](_0x73b5('0x9'),auth[_0x73b5('0x8')](),controller['update']);router[_0x73b5('0xd')]('/:id',auth[_0x73b5('0x8')](),controller[_0x73b5('0xe')]);module['exports']=router;
\ No newline at end of file
+var _0x48e3=['../../components/interaction/service','../../config/environment','./intDeskField.controller','isAuthenticated','index','get','post','/:id','exports','multer','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x48e3,0x1ea));var _0x348e=function(_0x1c5026,_0x44676f){_0x1c5026=_0x1c5026-0x0;var _0x2c65df=_0x48e3[_0x1c5026];return _0x2c65df;};'use strict';var multer=require(_0x348e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x348e('0x1'));var express=require(_0x348e('0x2'));var router=express[_0x348e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x348e('0x4'));var config=require(_0x348e('0x5'));var controller=require(_0x348e('0x6'));router['get']('/',auth[_0x348e('0x7')](),controller[_0x348e('0x8')]);router[_0x348e('0x9')]('/:id',auth[_0x348e('0x7')](),controller['show']);router[_0x348e('0xa')]('/',auth[_0x348e('0x7')](),controller['create']);router['put'](_0x348e('0xb'),auth[_0x348e('0x7')](),controller['update']);router['delete'](_0x348e('0xb'),auth[_0x348e('0x7')](),controller['destroy']);module[_0x348e('0xc')]=router;
\ No newline at end of file
index b7b2266..0eb2bd6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7294=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','keyValue'];(function(_0x219b9a,_0x3d675e){var _0x36e2f4=function(_0x33a491){while(--_0x33a491){_0x219b9a['push'](_0x219b9a['shift']());}};_0x36e2f4(++_0x3d675e);}(_0x7294,0x144));var _0x4729=function(_0x3d5504,_0x429293){_0x3d5504=_0x3d5504-0x0;var _0x52c2d9=_0x7294[_0x3d5504];return _0x52c2d9;};'use strict';var Sequelize=require(_0x4729('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x4729('0x1'),_0x4729('0x2'),'customVariable',_0x4729('0x3'),_0x4729('0x4')),'defaultValue':_0x4729('0x1')},'content':{'type':Sequelize[_0x4729('0x5')]},'key':{'type':Sequelize[_0x4729('0x5')]},'keyType':{'type':Sequelize[_0x4729('0x6')]('string',_0x4729('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x4729('0x5')]},'nameField':{'type':Sequelize[_0x4729('0x5')]},'customField':{'type':Sequelize[_0x4729('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4729('0x5')]}};
\ No newline at end of file
+var _0x5b93=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2dc5b7,_0x3837ba){var _0x4edb5b=function(_0x3ed644){while(--_0x3ed644){_0x2dc5b7['push'](_0x2dc5b7['shift']());}};_0x4edb5b(++_0x3837ba);}(_0x5b93,0x12c));var _0x35b9=function(_0x24a55c,_0x120790){_0x24a55c=_0x24a55c-0x0;var _0x9344e7=_0x5b93[_0x24a55c];return _0x9344e7;};'use strict';var Sequelize=require(_0x35b9('0x0'));module[_0x35b9('0x1')]={'type':{'type':Sequelize[_0x35b9('0x2')](_0x35b9('0x3'),_0x35b9('0x4'),_0x35b9('0x5'),_0x35b9('0x6'),_0x35b9('0x7')),'defaultValue':_0x35b9('0x3')},'content':{'type':Sequelize[_0x35b9('0x8')]},'key':{'type':Sequelize[_0x35b9('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x35b9('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x35b9('0x8')]},'idField':{'type':Sequelize[_0x35b9('0x8')]},'nameField':{'type':Sequelize[_0x35b9('0x8')]},'customField':{'type':Sequelize[_0x35b9('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x35b9('0x8')]}};
\ No newline at end of file
index 4096853..cf7eba7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5334=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','sendStatus','error','stack','name','send','map','DeskField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x2498b5,_0x514ddb){var _0x5c48d8=function(_0xee9bb5){while(--_0xee9bb5){_0x2498b5['push'](_0x2498b5['shift']());}};_0x5c48d8(++_0x514ddb);}(_0x5334,0x84));var _0x4533=function(_0x2224f0,_0x2ff7e1){_0x2224f0=_0x2224f0-0x0;var _0x5df99a=_0x5334[_0x2224f0];return _0x5df99a;};'use strict';var emlformat=require(_0x4533('0x0'));var rimraf=require(_0x4533('0x1'));var zipdir=require(_0x4533('0x2'));var jsonpatch=require(_0x4533('0x3'));var rp=require(_0x4533('0x4'));var moment=require('moment');var BPromise=require(_0x4533('0x5'));var Mustache=require('mustache');var util=require(_0x4533('0x6'));var path=require(_0x4533('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4533('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4533('0x9'));var deskjs=require(_0x4533('0xa'));var toCsv=require(_0x4533('0xb'));var querystring=require(_0x4533('0xc'));var Papa=require(_0x4533('0xd'));var Redis=require(_0x4533('0xe'));var authService=require(_0x4533('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4533('0x10'));var hardwareService=require(_0x4533('0x11'));var logger=require(_0x4533('0x12'))(_0x4533('0x13'));var utils=require('../../config/utils');var config=require(_0x4533('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4533('0x15'))['db'];function respondWithStatusCode(_0x439210,_0x45ba67){_0x45ba67=_0x45ba67||0xcc;return function(_0x19b74e){if(_0x19b74e){return _0x439210['sendStatus'](_0x45ba67);}return _0x439210[_0x4533('0x16')](_0x45ba67)[_0x4533('0x17')]();};}function respondWithResult(_0x187f05,_0x18d4f0){_0x18d4f0=_0x18d4f0||0xc8;return function(_0x533a26){if(_0x533a26){return _0x187f05[_0x4533('0x16')](_0x18d4f0)['json'](_0x533a26);}};}function respondWithFilteredResult(_0x4c703c,_0x466545){return function(_0x34dea9){if(_0x34dea9){var _0x5da8b8=typeof _0x466545[_0x4533('0x18')]===_0x4533('0x19')&&typeof _0x466545[_0x4533('0x1a')]==='undefined';var _0x3ed873=_0x34dea9['count'];var _0x3ddb36=_0x5da8b8?0x0:_0x466545[_0x4533('0x18')];var _0x56ab4f=_0x5da8b8?_0x34dea9[_0x4533('0x1b')]:_0x466545['offset']+_0x466545['limit'];var _0x1c5cdd;if(_0x56ab4f>=_0x3ed873){_0x56ab4f=_0x3ed873;_0x1c5cdd=0xc8;}else{_0x1c5cdd=0xce;}_0x4c703c[_0x4533('0x16')](_0x1c5cdd);return _0x4c703c['set']('Content-Range',_0x3ddb36+'-'+_0x56ab4f+'/'+_0x3ed873)[_0x4533('0x1c')](_0x34dea9);}return null;};}function patchUpdates(_0x3b18c1){return function(_0x3467ba){try{jsonpatch[_0x4533('0x1d')](_0x3467ba,_0x3b18c1,!![]);}catch(_0x6766eb){return BPromise[_0x4533('0x1e')](_0x6766eb);}return _0x3467ba[_0x4533('0x1f')]();};}function saveUpdates(_0x5c3abb,_0x231bae){return function(_0xd55c04){if(_0xd55c04){return _0xd55c04[_0x4533('0x20')](_0x5c3abb)['then'](function(_0x513011){return _0x513011;});}return null;};}function removeEntity(_0x138fd9,_0x11e93a){return function(_0x4c640c){if(_0x4c640c){return _0x4c640c['destroy']()[_0x4533('0x21')](function(){_0x138fd9[_0x4533('0x16')](0xcc)[_0x4533('0x17')]();});}};}function handleEntityNotFound(_0x4d8189,_0x44786f){return function(_0x39b261){if(!_0x39b261){_0x4d8189[_0x4533('0x22')](0x194);}return _0x39b261;};}function handleError(_0x3fba67,_0x19ab4d){_0x19ab4d=_0x19ab4d||0x1f4;return function(_0x3fc5b0){logger[_0x4533('0x23')](_0x3fc5b0[_0x4533('0x24')]);if(_0x3fc5b0[_0x4533('0x25')]){delete _0x3fc5b0['name'];}_0x3fba67['status'](_0x19ab4d)[_0x4533('0x26')](_0x3fc5b0);};}exports['index']=function(_0x3fd76a,_0x4e2b80){var _0x159fea={},_0x42ba2d={},_0x38706b={'count':0x0,'rows':[]};var _0x4300c1=_[_0x4533('0x27')](db[_0x4533('0x28')][_0x4533('0x29')],function(_0xa58dd1){return{'name':_0xa58dd1[_0x4533('0x2a')],'type':_0xa58dd1[_0x4533('0x2b')][_0x4533('0x2c')]};});_0x42ba2d[_0x4533('0x2d')]=_[_0x4533('0x27')](_0x4300c1,'name');_0x42ba2d[_0x4533('0x2e')]=_['keys'](_0x3fd76a[_0x4533('0x2e')]);_0x42ba2d[_0x4533('0x2f')]=_[_0x4533('0x30')](_0x42ba2d[_0x4533('0x2d')],_0x42ba2d[_0x4533('0x2e')]);_0x159fea[_0x4533('0x31')]=_[_0x4533('0x30')](_0x42ba2d[_0x4533('0x2d')],qs[_0x4533('0x32')](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x32')]));_0x159fea[_0x4533('0x31')]=_0x159fea['attributes'][_0x4533('0x33')]?_0x159fea[_0x4533('0x31')]:_0x42ba2d[_0x4533('0x2d')];if(!_0x3fd76a[_0x4533('0x2e')][_0x4533('0x34')]('nolimit')){_0x159fea[_0x4533('0x1a')]=qs[_0x4533('0x1a')](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x1a')]);_0x159fea[_0x4533('0x18')]=qs[_0x4533('0x18')](_0x3fd76a['query'][_0x4533('0x18')]);}_0x159fea[_0x4533('0x35')]=qs['sort'](_0x3fd76a[_0x4533('0x2e')][_0x4533('0x36')]);_0x159fea[_0x4533('0x37')]=qs[_0x4533('0x2f')](_[_0x4533('0x38')](_0x3fd76a[_0x4533('0x2e')],_0x42ba2d[_0x4533('0x2f')]),_0x4300c1);if(_0x3fd76a[_0x4533('0x2e')][_0x4533('0x39')]){_0x159fea[_0x4533('0x37')]=_['merge'](_0x159fea[_0x4533('0x37')],{'$or':_[_0x4533('0x27')](_0x4300c1,function(_0x296d31){if(_0x296d31[_0x4533('0x2b')]!==_0x4533('0x3a')){var _0x17af88={};_0x17af88[_0x296d31[_0x4533('0x25')]]={'$like':'%'+_0x3fd76a[_0x4533('0x2e')][_0x4533('0x39')]+'%'};return _0x17af88;}})});}_0x159fea=_[_0x4533('0x3b')]({},_0x159fea,_0x3fd76a[_0x4533('0x3c')]);var _0x2e49a1={'where':_0x159fea['where']};return db['DeskField'][_0x4533('0x1b')](_0x2e49a1)['then'](function(_0x4260e6){_0x38706b[_0x4533('0x1b')]=_0x4260e6;if(_0x3fd76a[_0x4533('0x2e')][_0x4533('0x3d')]){_0x159fea[_0x4533('0x3e')]=[{'all':!![]}];}return db[_0x4533('0x28')][_0x4533('0x3f')](_0x159fea);})[_0x4533('0x21')](function(_0x11bc6b){_0x38706b[_0x4533('0x40')]=_0x11bc6b;return _0x38706b;})[_0x4533('0x21')](respondWithFilteredResult(_0x4e2b80,_0x159fea))[_0x4533('0x41')](handleError(_0x4e2b80,null));};exports[_0x4533('0x42')]=function(_0x5c4a04,_0x1aaedc){var _0x556dd9={'raw':!![],'where':{'id':_0x5c4a04['params']['id']}},_0x57d7c3={};_0x57d7c3['model']=_[_0x4533('0x43')](db[_0x4533('0x28')][_0x4533('0x29')]);_0x57d7c3[_0x4533('0x2e')]=_['keys'](_0x5c4a04[_0x4533('0x2e')]);_0x57d7c3[_0x4533('0x2f')]=_[_0x4533('0x30')](_0x57d7c3[_0x4533('0x2d')],_0x57d7c3[_0x4533('0x2e')]);_0x556dd9[_0x4533('0x31')]=_[_0x4533('0x30')](_0x57d7c3['model'],qs[_0x4533('0x32')](_0x5c4a04['query']['fields']));_0x556dd9[_0x4533('0x31')]=_0x556dd9[_0x4533('0x31')][_0x4533('0x33')]?_0x556dd9[_0x4533('0x31')]:_0x57d7c3['model'];if(_0x5c4a04['query'][_0x4533('0x3d')]){_0x556dd9['include']=[{'all':!![]}];}_0x556dd9=_[_0x4533('0x3b')]({},_0x556dd9,_0x5c4a04[_0x4533('0x3c')]);return db['DeskField']['find'](_0x556dd9)['then'](handleEntityNotFound(_0x1aaedc,null))['then'](respondWithResult(_0x1aaedc,null))['catch'](handleError(_0x1aaedc,null));};exports[_0x4533('0x44')]=function(_0x4797a3,_0x429447){return db['DeskField'][_0x4533('0x44')](_0x4797a3['body'],{})['then'](respondWithResult(_0x429447,0xc9))[_0x4533('0x41')](handleError(_0x429447,null));};exports['update']=function(_0x1394cb,_0x59e358){if(_0x1394cb[_0x4533('0x45')]['id']){delete _0x1394cb[_0x4533('0x45')]['id'];}return db['DeskField'][_0x4533('0x46')]({'where':{'id':_0x1394cb[_0x4533('0x47')]['id']}})[_0x4533('0x21')](handleEntityNotFound(_0x59e358,null))[_0x4533('0x21')](saveUpdates(_0x1394cb[_0x4533('0x45')],null))['then'](respondWithResult(_0x59e358,null))[_0x4533('0x41')](handleError(_0x59e358,null));};exports[_0x4533('0x48')]=function(_0x5260e9,_0x2454ed){return db[_0x4533('0x28')][_0x4533('0x46')]({'where':{'id':_0x5260e9[_0x4533('0x47')]['id']}})[_0x4533('0x21')](handleEntityNotFound(_0x2454ed,null))[_0x4533('0x21')](removeEntity(_0x2454ed,null))[_0x4533('0x41')](handleError(_0x2454ed,null));};
\ No newline at end of file
+var _0x7374=['to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x3aac62,_0x370953){var _0x1e77f7=function(_0x487c16){while(--_0x487c16){_0x3aac62['push'](_0x3aac62['shift']());}};_0x1e77f7(++_0x370953);}(_0x7374,0x1b9));var _0x4737=function(_0x196957,_0x29331f){_0x196957=_0x196957-0x0;var _0x435a8d=_0x7374[_0x196957];return _0x435a8d;};'use strict';var emlformat=require(_0x4737('0x0'));var rimraf=require(_0x4737('0x1'));var zipdir=require(_0x4737('0x2'));var jsonpatch=require(_0x4737('0x3'));var rp=require(_0x4737('0x4'));var moment=require('moment');var BPromise=require(_0x4737('0x5'));var Mustache=require(_0x4737('0x6'));var util=require(_0x4737('0x7'));var path=require(_0x4737('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4737('0x9'));var fs=require('fs');var fs_extra=require(_0x4737('0xa'));var _=require(_0x4737('0xb'));var squel=require(_0x4737('0xc'));var crypto=require('crypto');var jsforce=require(_0x4737('0xd'));var deskjs=require(_0x4737('0xe'));var toCsv=require(_0x4737('0xf'));var querystring=require(_0x4737('0x10'));var Papa=require(_0x4737('0x11'));var Redis=require('ioredis');var authService=require(_0x4737('0x12'));var qs=require(_0x4737('0x13'));var as=require(_0x4737('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x4737('0x15'));var utils=require(_0x4737('0x16'));var config=require(_0x4737('0x17'));var licenseUtil=require(_0x4737('0x18'));var db=require(_0x4737('0x19'))['db'];function respondWithStatusCode(_0xe662e8,_0x438f1d){_0x438f1d=_0x438f1d||0xcc;return function(_0xa7c11){if(_0xa7c11){return _0xe662e8[_0x4737('0x1a')](_0x438f1d);}return _0xe662e8['status'](_0x438f1d)[_0x4737('0x1b')]();};}function respondWithResult(_0x301753,_0x69f87b){_0x69f87b=_0x69f87b||0xc8;return function(_0xc7fceb){if(_0xc7fceb){return _0x301753[_0x4737('0x1c')](_0x69f87b)['json'](_0xc7fceb);}};}function respondWithFilteredResult(_0x4c1a5a,_0xeb4aa2){return function(_0x48a8c3){if(_0x48a8c3){var _0x470ed4=typeof _0xeb4aa2[_0x4737('0x1d')]==='undefined'&&typeof _0xeb4aa2[_0x4737('0x1e')]===_0x4737('0x1f');var _0xef032a=_0x48a8c3['count'];var _0x2d2c32=_0x470ed4?0x0:_0xeb4aa2['offset'];var _0x37b74d=_0x470ed4?_0x48a8c3[_0x4737('0x20')]:_0xeb4aa2[_0x4737('0x1d')]+_0xeb4aa2[_0x4737('0x1e')];var _0x1b2183;if(_0x37b74d>=_0xef032a){_0x37b74d=_0xef032a;_0x1b2183=0xc8;}else{_0x1b2183=0xce;}_0x4c1a5a['status'](_0x1b2183);return _0x4c1a5a[_0x4737('0x21')](_0x4737('0x22'),_0x2d2c32+'-'+_0x37b74d+'/'+_0xef032a)[_0x4737('0x23')](_0x48a8c3);}return null;};}function patchUpdates(_0x354b71){return function(_0x54c899){try{jsonpatch[_0x4737('0x24')](_0x54c899,_0x354b71,!![]);}catch(_0x5d9ed4){return BPromise[_0x4737('0x25')](_0x5d9ed4);}return _0x54c899[_0x4737('0x26')]();};}function saveUpdates(_0x4c1292,_0x67fac){return function(_0x1c004f){if(_0x1c004f){return _0x1c004f[_0x4737('0x27')](_0x4c1292)[_0x4737('0x28')](function(_0x56d82f){return _0x56d82f;});}return null;};}function removeEntity(_0x116ef4,_0x2ce99e){return function(_0x49eddf){if(_0x49eddf){return _0x49eddf[_0x4737('0x29')]()['then'](function(){_0x116ef4[_0x4737('0x1c')](0xcc)[_0x4737('0x1b')]();});}};}function handleEntityNotFound(_0x3df6c5,_0x10685f){return function(_0xe8e844){if(!_0xe8e844){_0x3df6c5[_0x4737('0x1a')](0x194);}return _0xe8e844;};}function handleError(_0x542c14,_0x1cc0c7){_0x1cc0c7=_0x1cc0c7||0x1f4;return function(_0x52c764){logger[_0x4737('0x2a')](_0x52c764['stack']);if(_0x52c764[_0x4737('0x2b')]){delete _0x52c764[_0x4737('0x2b')];}_0x542c14[_0x4737('0x1c')](_0x1cc0c7)['send'](_0x52c764);};}exports['index']=function(_0x2d7486,_0x43d44a){var _0x14e4a2={},_0x2d587c={},_0x235f7b={'count':0x0,'rows':[]};var _0x5d6a2a=_[_0x4737('0x2c')](db[_0x4737('0x2d')][_0x4737('0x2e')],function(_0x31f2cd){return{'name':_0x31f2cd[_0x4737('0x2f')],'type':_0x31f2cd[_0x4737('0x30')][_0x4737('0x31')]};});_0x2d587c[_0x4737('0x32')]=_['map'](_0x5d6a2a,_0x4737('0x2b'));_0x2d587c[_0x4737('0x33')]=_[_0x4737('0x34')](_0x2d7486[_0x4737('0x33')]);_0x2d587c[_0x4737('0x35')]=_[_0x4737('0x36')](_0x2d587c[_0x4737('0x32')],_0x2d587c[_0x4737('0x33')]);_0x14e4a2[_0x4737('0x37')]=_['intersection'](_0x2d587c['model'],qs[_0x4737('0x38')](_0x2d7486[_0x4737('0x33')]['fields']));_0x14e4a2[_0x4737('0x37')]=_0x14e4a2[_0x4737('0x37')][_0x4737('0x39')]?_0x14e4a2[_0x4737('0x37')]:_0x2d587c[_0x4737('0x32')];if(!_0x2d7486[_0x4737('0x33')][_0x4737('0x3a')](_0x4737('0x3b'))){_0x14e4a2[_0x4737('0x1e')]=qs[_0x4737('0x1e')](_0x2d7486['query'][_0x4737('0x1e')]);_0x14e4a2[_0x4737('0x1d')]=qs[_0x4737('0x1d')](_0x2d7486[_0x4737('0x33')]['offset']);}_0x14e4a2['order']=qs[_0x4737('0x3c')](_0x2d7486['query'][_0x4737('0x3c')]);_0x14e4a2[_0x4737('0x3d')]=qs['filters'](_[_0x4737('0x3e')](_0x2d7486[_0x4737('0x33')],_0x2d587c[_0x4737('0x35')]),_0x5d6a2a);if(_0x2d7486[_0x4737('0x33')][_0x4737('0x3f')]){_0x14e4a2[_0x4737('0x3d')]=_[_0x4737('0x40')](_0x14e4a2['where'],{'$or':_[_0x4737('0x2c')](_0x5d6a2a,function(_0x133744){if(_0x133744[_0x4737('0x30')]!==_0x4737('0x41')){var _0x658ea3={};_0x658ea3[_0x133744[_0x4737('0x2b')]]={'$like':'%'+_0x2d7486['query'][_0x4737('0x3f')]+'%'};return _0x658ea3;}})});}_0x14e4a2=_[_0x4737('0x40')]({},_0x14e4a2,_0x2d7486[_0x4737('0x42')]);var _0x4bd105={'where':_0x14e4a2['where']};return db[_0x4737('0x2d')][_0x4737('0x20')](_0x4bd105)['then'](function(_0x27bc72){_0x235f7b[_0x4737('0x20')]=_0x27bc72;if(_0x2d7486[_0x4737('0x33')][_0x4737('0x43')]){_0x14e4a2[_0x4737('0x44')]=[{'all':!![]}];}return db[_0x4737('0x2d')][_0x4737('0x45')](_0x14e4a2);})[_0x4737('0x28')](function(_0x90fea6){_0x235f7b[_0x4737('0x46')]=_0x90fea6;return _0x235f7b;})[_0x4737('0x28')](respondWithFilteredResult(_0x43d44a,_0x14e4a2))[_0x4737('0x47')](handleError(_0x43d44a,null));};exports[_0x4737('0x48')]=function(_0x1d3620,_0x5eccca){var _0x28ca8a={'raw':!![],'where':{'id':_0x1d3620[_0x4737('0x49')]['id']}},_0xce2e64={};_0xce2e64[_0x4737('0x32')]=_[_0x4737('0x34')](db[_0x4737('0x2d')][_0x4737('0x2e')]);_0xce2e64[_0x4737('0x33')]=_[_0x4737('0x34')](_0x1d3620['query']);_0xce2e64[_0x4737('0x35')]=_[_0x4737('0x36')](_0xce2e64[_0x4737('0x32')],_0xce2e64['query']);_0x28ca8a[_0x4737('0x37')]=_[_0x4737('0x36')](_0xce2e64[_0x4737('0x32')],qs[_0x4737('0x38')](_0x1d3620[_0x4737('0x33')]['fields']));_0x28ca8a['attributes']=_0x28ca8a[_0x4737('0x37')][_0x4737('0x39')]?_0x28ca8a[_0x4737('0x37')]:_0xce2e64[_0x4737('0x32')];if(_0x1d3620[_0x4737('0x33')]['includeAll']){_0x28ca8a[_0x4737('0x44')]=[{'all':!![]}];}_0x28ca8a=_[_0x4737('0x40')]({},_0x28ca8a,_0x1d3620[_0x4737('0x42')]);return db[_0x4737('0x2d')][_0x4737('0x4a')](_0x28ca8a)[_0x4737('0x28')](handleEntityNotFound(_0x5eccca,null))[_0x4737('0x28')](respondWithResult(_0x5eccca,null))['catch'](handleError(_0x5eccca,null));};exports['create']=function(_0x4a78d,_0x2ba038){return db[_0x4737('0x2d')]['create'](_0x4a78d[_0x4737('0x4b')],{})['then'](respondWithResult(_0x2ba038,0xc9))[_0x4737('0x47')](handleError(_0x2ba038,null));};exports[_0x4737('0x27')]=function(_0x2f63d8,_0xffb923){if(_0x2f63d8[_0x4737('0x4b')]['id']){delete _0x2f63d8[_0x4737('0x4b')]['id'];}return db[_0x4737('0x2d')][_0x4737('0x4a')]({'where':{'id':_0x2f63d8[_0x4737('0x49')]['id']}})['then'](handleEntityNotFound(_0xffb923,null))[_0x4737('0x28')](saveUpdates(_0x2f63d8[_0x4737('0x4b')],null))[_0x4737('0x28')](respondWithResult(_0xffb923,null))['catch'](handleError(_0xffb923,null));};exports[_0x4737('0x29')]=function(_0x3608b2,_0x1ffd12){return db['DeskField'][_0x4737('0x4a')]({'where':{'id':_0x3608b2[_0x4737('0x49')]['id']}})[_0x4737('0x28')](handleEntityNotFound(_0x1ffd12,null))[_0x4737('0x28')](removeEntity(_0x1ffd12,null))[_0x4737('0x47')](handleError(_0x1ffd12,null));};
\ No newline at end of file
index 5537d8f..abac807 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70bd=['exports','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes'];(function(_0x45ff1b,_0x5bc3f5){var _0x5d4fbd=function(_0x52d082){while(--_0x52d082){_0x45ff1b['push'](_0x45ff1b['shift']());}};_0x5d4fbd(++_0x5bc3f5);}(_0x70bd,0x76));var _0xd70b=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x70bd[_0x411add];return _0x238242;};'use strict';var _=require('lodash');var util=require(_0xd70b('0x0'));var logger=require('../../config/logger')(_0xd70b('0x1'));var moment=require(_0xd70b('0x2'));var BPromise=require(_0xd70b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd70b('0x4'));var rimraf=require(_0xd70b('0x5'));var config=require(_0xd70b('0x6'));var attributes=require(_0xd70b('0x7'));module[_0xd70b('0x8')]=function(_0x998031,_0x127375){return _0x998031['define'](_0xd70b('0x9'),attributes,{'tableName':_0xd70b('0xa'),'paranoid':![],'indexes':[{'name':_0xd70b('0xb'),'fields':[_0xd70b('0xc'),_0xd70b('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x68c1=['request-promise','path','rimraf','./intDeskField.attributes','exports','define','int_desk_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x68c1,0x108));var _0x168c=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x68c1[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x168c('0x0'));var util=require(_0x168c('0x1'));var logger=require(_0x168c('0x2'))(_0x168c('0x3'));var moment=require(_0x168c('0x4'));var BPromise=require(_0x168c('0x5'));var rp=require(_0x168c('0x6'));var fs=require('fs');var path=require(_0x168c('0x7'));var rimraf=require(_0x168c('0x8'));var config=require('../../config/environment');var attributes=require(_0x168c('0x9'));module[_0x168c('0xa')]=function(_0x52e79d,_0x369d0c){return _0x52e79d[_0x168c('0xb')]('DeskField',attributes,{'tableName':_0x168c('0xc'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0x168c('0xd'),_0x168c('0xe')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 8853652..84b2abb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e8a=['code','DeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x1e9304,_0x47deec){var _0x4a4616=function(_0x56dbb2){while(--_0x56dbb2){_0x1e9304['push'](_0x1e9304['shift']());}};_0x4a4616(++_0x47deec);}(_0x0e8a,0x14f));var _0xa0e8=function(_0x409186,_0x4b8b73){_0x409186=_0x409186-0x0;var _0x3deb43=_0x0e8a[_0x409186];return _0x3deb43;};'use strict';var _=require(_0xa0e8('0x0'));var util=require(_0xa0e8('0x1'));var moment=require(_0xa0e8('0x2'));var BPromise=require(_0xa0e8('0x3'));var rs=require(_0xa0e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa0e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xa0e8('0x6'));var jayson=require(_0xa0e8('0x7'));var client=jayson[_0xa0e8('0x8')][_0xa0e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ca257,_0x397e3c,_0x17f8ca){return new BPromise(function(_0x4b7f2b,_0x17f9cc){return client[_0xa0e8('0xa')](_0x5ca257,_0x17f8ca)[_0xa0e8('0xb')](function(_0x3b44){logger[_0xa0e8('0xc')]('DeskField,\x20%s,\x20%s',_0x397e3c,_0xa0e8('0xd'));logger[_0xa0e8('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x397e3c,_0xa0e8('0xd'),JSON[_0xa0e8('0xf')](_0x3b44));if(_0x3b44[_0xa0e8('0x10')]){if(_0x3b44[_0xa0e8('0x10')][_0xa0e8('0x11')]===0x1f4){logger['error'](_0xa0e8('0x12'),_0x397e3c,_0x3b44[_0xa0e8('0x10')][_0xa0e8('0x13')]);return _0x17f9cc(_0x3b44[_0xa0e8('0x10')]['message']);}logger[_0xa0e8('0x10')](_0xa0e8('0x12'),_0x397e3c,_0x3b44['error']['message']);return _0x4b7f2b(_0x3b44[_0xa0e8('0x10')][_0xa0e8('0x13')]);}else{logger['info'](_0xa0e8('0x12'),_0x397e3c,'request\x20sent');_0x4b7f2b(_0x3b44[_0xa0e8('0x14')][_0xa0e8('0x13')]);}})[_0xa0e8('0x15')](function(_0x9ffd3a){logger['error'](_0xa0e8('0x12'),_0x397e3c,_0x9ffd3a);_0x17f9cc(_0x9ffd3a);});});}
\ No newline at end of file
+var _0x907e=['result','catch','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error','message','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x907e,0xa2));var _0xe907=function(_0x2b4448,_0x5bcc69){_0x2b4448=_0x2b4448-0x0;var _0xb4b465=_0x907e[_0x2b4448];return _0xb4b465;};'use strict';var _=require('lodash');var util=require(_0xe907('0x0'));var moment=require(_0xe907('0x1'));var BPromise=require(_0xe907('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe907('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe907('0x4'));var logger=require(_0xe907('0x5'))('rpc');var config=require(_0xe907('0x6'));var jayson=require(_0xe907('0x7'));var client=jayson['client'][_0xe907('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd6cd8c,_0x3fcb0d,_0xba925){return new BPromise(function(_0x1eabf2,_0x37f9ce){return client[_0xe907('0x9')](_0xd6cd8c,_0xba925)[_0xe907('0xa')](function(_0x3962b4){logger['info'](_0xe907('0xb'),_0x3fcb0d,_0xe907('0xc'));logger[_0xe907('0xd')](_0xe907('0xe'),_0x3fcb0d,_0xe907('0xc'),JSON['stringify'](_0x3962b4));if(_0x3962b4['error']){if(_0x3962b4['error']['code']===0x1f4){logger[_0xe907('0xf')](_0xe907('0xb'),_0x3fcb0d,_0x3962b4[_0xe907('0xf')][_0xe907('0x10')]);return _0x37f9ce(_0x3962b4[_0xe907('0xf')][_0xe907('0x10')]);}logger['error'](_0xe907('0xb'),_0x3fcb0d,_0x3962b4[_0xe907('0xf')]['message']);return _0x1eabf2(_0x3962b4[_0xe907('0xf')]['message']);}else{logger[_0xe907('0x11')]('DeskField,\x20%s,\x20%s',_0x3fcb0d,_0xe907('0xc'));_0x1eabf2(_0x3962b4[_0xe907('0x12')][_0xe907('0x10')]);}})[_0xe907('0x13')](function(_0x1c457d){logger[_0xe907('0xf')](_0xe907('0xb'),_0x3fcb0d,_0x1c457d);_0x37f9ce(_0x1c457d);});});}
\ No newline at end of file
index 8d17017..a22750d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd18=['get','isAuthenticated','index','/:id','show','/:id/configurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3c4b44,_0x1f4994){var _0xd6a408=function(_0x440421){while(--_0x440421){_0x3c4b44['push'](_0x3c4b44['shift']());}};_0xd6a408(++_0x1f4994);}(_0xdd18,0xff));var _0x8dd1=function(_0x3566de,_0x1bec4d){_0x3566de=_0x3566de-0x0;var _0x256439=_0xdd18[_0x3566de];return _0x256439;};'use strict';var multer=require(_0x8dd1('0x0'));var util=require(_0x8dd1('0x1'));var path=require(_0x8dd1('0x2'));var timeout=require(_0x8dd1('0x3'));var express=require(_0x8dd1('0x4'));var router=express[_0x8dd1('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8dd1('0x6'));var interaction=require(_0x8dd1('0x7'));var config=require(_0x8dd1('0x8'));var controller=require('./intDynamics365Account.controller');router[_0x8dd1('0x9')]('/',auth[_0x8dd1('0xa')](),controller[_0x8dd1('0xb')]);router[_0x8dd1('0x9')](_0x8dd1('0xc'),auth[_0x8dd1('0xa')](),controller[_0x8dd1('0xd')]);router[_0x8dd1('0x9')](_0x8dd1('0xe'),auth[_0x8dd1('0xa')](),controller['getConfigurations']);router[_0x8dd1('0x9')]('/:id/fields',auth[_0x8dd1('0xa')](),controller[_0x8dd1('0xf')]);router[_0x8dd1('0x10')]('/',auth[_0x8dd1('0xa')](),controller[_0x8dd1('0x11')]);router[_0x8dd1('0x10')](_0x8dd1('0xe'),auth['isAuthenticated'](),controller[_0x8dd1('0x12')]);router[_0x8dd1('0x13')](_0x8dd1('0xc'),auth[_0x8dd1('0xa')](),controller[_0x8dd1('0x14')]);router[_0x8dd1('0x15')](_0x8dd1('0xc'),auth['isAuthenticated'](),controller[_0x8dd1('0x16')]);module[_0x8dd1('0x17')]=router;
\ No newline at end of file
+var _0x51e6=['delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','index','isAuthenticated','/:id/configurations','post','create','addConfiguration','put','/:id','update'];(function(_0xf4129c,_0x44fcf1){var _0x426611=function(_0x3b5bcd){while(--_0x3b5bcd){_0xf4129c['push'](_0xf4129c['shift']());}};_0x426611(++_0x44fcf1);}(_0x51e6,0x71));var _0x651e=function(_0x25ad66,_0x46e4dc){_0x25ad66=_0x25ad66-0x0;var _0x141bc4=_0x51e6[_0x25ad66];return _0x141bc4;};'use strict';var multer=require(_0x651e('0x0'));var util=require(_0x651e('0x1'));var path=require('path');var timeout=require(_0x651e('0x2'));var express=require(_0x651e('0x3'));var router=express[_0x651e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x651e('0x5'));var interaction=require(_0x651e('0x6'));var config=require(_0x651e('0x7'));var controller=require(_0x651e('0x8'));router[_0x651e('0x9')]('/',auth['isAuthenticated'](),controller[_0x651e('0xa')]);router[_0x651e('0x9')]('/:id',auth[_0x651e('0xb')](),controller['show']);router[_0x651e('0x9')](_0x651e('0xc'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x651e('0x9')]('/:id/fields',auth[_0x651e('0xb')](),controller['getFields']);router[_0x651e('0xd')]('/',auth[_0x651e('0xb')](),controller[_0x651e('0xe')]);router[_0x651e('0xd')](_0x651e('0xc'),auth[_0x651e('0xb')](),controller[_0x651e('0xf')]);router[_0x651e('0x10')](_0x651e('0x11'),auth[_0x651e('0xb')](),controller[_0x651e('0x12')]);router[_0x651e('0x13')](_0x651e('0x11'),auth[_0x651e('0xb')](),controller[_0x651e('0x14')]);module[_0x651e('0x15')]=router;
\ No newline at end of file
index 5597d14..ba5523a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e8a=['STRING','sequelize','exports'];(function(_0x1f8999,_0x58ef02){var _0x4a4d99=function(_0x3ed847){while(--_0x3ed847){_0x1f8999['push'](_0x1f8999['shift']());}};_0x4a4d99(++_0x58ef02);}(_0x9e8a,0x112));var _0xa9e8=function(_0x14d7df,_0x3fe7aa){_0x14d7df=_0x14d7df-0x0;var _0x91dede=_0x9e8a[_0x14d7df];return _0x91dede;};'use strict';var Sequelize=require(_0xa9e8('0x0'));module[_0xa9e8('0x1')]={'name':{'type':Sequelize[_0xa9e8('0x2')]},'username':{'type':Sequelize[_0xa9e8('0x2')]},'password':{'type':Sequelize[_0xa9e8('0x2')]},'remoteUri':{'type':Sequelize[_0xa9e8('0x2')]},'tenantId':{'type':Sequelize[_0xa9e8('0x2')]},'clientId':{'type':Sequelize[_0xa9e8('0x2')]},'clientSecret':{'type':Sequelize[_0xa9e8('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}};
\ No newline at end of file
+var _0x16cc=['exports','STRING','BOOLEAN'];(function(_0x2d4cce,_0x15179f){var _0x8a9182=function(_0x535867){while(--_0x535867){_0x2d4cce['push'](_0x2d4cce['shift']());}};_0x8a9182(++_0x15179f);}(_0x16cc,0x120));var _0xc16c=function(_0x515a95,_0x16cfb0){_0x515a95=_0x515a95-0x0;var _0x43f7ac=_0x16cc[_0x515a95];return _0x43f7ac;};'use strict';var Sequelize=require('sequelize');module[_0xc16c('0x0')]={'name':{'type':Sequelize[_0xc16c('0x1')]},'username':{'type':Sequelize[_0xc16c('0x1')]},'password':{'type':Sequelize[_0xc16c('0x1')]},'remoteUri':{'type':Sequelize[_0xc16c('0x1')]},'tenantId':{'type':Sequelize[_0xc16c('0x1')]},'clientId':{'type':Sequelize[_0xc16c('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xc16c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc16c('0x1')]},'modernAuthentication':{'type':Sequelize[_0xc16c('0x2')],'defaultValue':!![]}};
\ No newline at end of file
index 06465c1..77ba45e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe29a=[')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','remove','includes','LogicalName','@odata.type','substring','PicklistAttributeMetadata','MetadataId','all','isNil','BooleanAttributeMetadata','push','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','error',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','forEach','Label','UserLocalizedLabel','Value','DisplayName',')/Attributes(','TrueOption','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','offset','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','Dynamics365Account','rawAttributes','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','params','intersection','find','create','body','getConfigurations','findOne','Dynamics365Configuration','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','lastIndexOf','getFields','ticketType','incident','title','description','customerid','ownerid','caseorigincode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridyominame','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','/oauth2/token','clientId','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','EntityDefinitions('];(function(_0x385276,_0x23aeed){var _0x277d60=function(_0x4ff819){while(--_0x4ff819){_0x385276['push'](_0x385276['shift']());}};_0x277d60(++_0x23aeed);}(_0xe29a,0x190));var _0xae29=function(_0x2cb99a,_0x31f089){_0x2cb99a=_0x2cb99a-0x0;var _0x5f2f38=_0xe29a[_0x2cb99a];return _0x5f2f38;};'use strict';var rp=require(_0xae29('0x0'));var util=require(_0xae29('0x1'));var _=require(_0xae29('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xae29('0x3'))(_0xae29('0x4'));var db=require(_0xae29('0x5'))['db'];var integrations=require(_0xae29('0x6'));function respondWithResult(_0x3c6dfd,_0x26c442){_0x26c442=_0x26c442||0xc8;return function(_0x2f0ccd){if(_0x2f0ccd){return _0x3c6dfd[_0xae29('0x7')](_0x26c442)['json'](_0x2f0ccd);}};}function respondWithFilteredResult(_0x693d87,_0x2b2ef4){return function(_0x168afc){if(_0x168afc){var _0x273aff=typeof _0x2b2ef4[_0xae29('0x8')]==='undefined'&&typeof _0x2b2ef4[_0xae29('0x9')]==='undefined';var _0x2dd312=_0x168afc[_0xae29('0xa')];var _0x1f5b3a=_0x273aff?0x0:_0x2b2ef4['offset'];var _0xa4e538=_0x273aff?_0x168afc[_0xae29('0xa')]:_0x2b2ef4[_0xae29('0x8')]+_0x2b2ef4[_0xae29('0x9')];var _0x1d3c85;if(_0xa4e538>=_0x2dd312){_0xa4e538=_0x2dd312;_0x1d3c85=0xc8;}else{_0x1d3c85=0xce;}_0x693d87['status'](_0x1d3c85);return _0x693d87[_0xae29('0xb')](_0xae29('0xc'),_0x1f5b3a+'-'+_0xa4e538+'/'+_0x2dd312)['json'](_0x168afc);}return null;};}function saveUpdates(_0xfebbf7){return function(_0x4f8e72){if(_0x4f8e72){return _0x4f8e72[_0xae29('0xd')](_0xfebbf7)[_0xae29('0xe')](function(_0x5e6bc9){return _0x5e6bc9;});}return null;};}function removeEntity(_0x3aab59){return function(_0x632429){if(_0x632429){return _0x632429[_0xae29('0xf')]()[_0xae29('0xe')](function(){_0x3aab59['status'](0xcc)[_0xae29('0x10')]();});}};}function handleEntityNotFound(_0x2a4542){return function(_0x26c98b){if(!_0x26c98b){_0x2a4542['sendStatus'](0x194);}return _0x26c98b;};}function handleError(_0x4c6872,_0x3e2070){_0x3e2070=_0x3e2070||0x1f4;return function(_0x456258){logger['error'](_0x456258[_0xae29('0x11')]);if(_0x456258[_0xae29('0x12')]){delete _0x456258[_0xae29('0x12')];}_0x4c6872['status'](_0x3e2070)[_0xae29('0x13')](_0x456258);};}exports[_0xae29('0x14')]=function(_0x28eb97,_0x2c7579){var _0x990bb9={},_0x44be11={},_0x24f428={'count':0x0,'rows':[]};var _0x2c6471=_[_0xae29('0x15')](db[_0xae29('0x16')][_0xae29('0x17')],function(_0x2b0289){return{'name':_0x2b0289['fieldName'],'type':_0x2b0289[_0xae29('0x18')][_0xae29('0x19')]};});_0x44be11[_0xae29('0x1a')]=_[_0xae29('0x15')](_0x2c6471,_0xae29('0x12'));_0x44be11[_0xae29('0x1b')]=_[_0xae29('0x1c')](_0x28eb97[_0xae29('0x1b')]);_0x44be11[_0xae29('0x1d')]=_['intersection'](_0x44be11[_0xae29('0x1a')],_0x44be11[_0xae29('0x1b')]);_0x990bb9['attributes']=_['intersection'](_0x44be11[_0xae29('0x1a')],qs[_0xae29('0x1e')](_0x28eb97[_0xae29('0x1b')][_0xae29('0x1e')]));_0x990bb9[_0xae29('0x1f')]=_0x990bb9[_0xae29('0x1f')][_0xae29('0x20')]?_0x990bb9[_0xae29('0x1f')]:_0x44be11[_0xae29('0x1a')];if(!_0x28eb97[_0xae29('0x1b')][_0xae29('0x21')](_0xae29('0x22'))){_0x990bb9['limit']=qs[_0xae29('0x9')](_0x28eb97[_0xae29('0x1b')]['limit']);_0x990bb9[_0xae29('0x8')]=qs[_0xae29('0x8')](_0x28eb97[_0xae29('0x1b')]['offset']);}_0x990bb9['order']=qs[_0xae29('0x23')](_0x28eb97[_0xae29('0x1b')][_0xae29('0x23')]);_0x990bb9['where']=qs[_0xae29('0x1d')](_[_0xae29('0x24')](_0x28eb97['query'],_0x44be11[_0xae29('0x1d')]),_0x2c6471);if(_0x28eb97[_0xae29('0x1b')]['filter']){_0x990bb9[_0xae29('0x25')]=_['merge'](_0x990bb9[_0xae29('0x25')],{'$or':_[_0xae29('0x15')](_0x2c6471,function(_0x37275e){if(_0x37275e['type']!==_0xae29('0x26')){var _0x593647={};_0x593647[_0x37275e[_0xae29('0x12')]]={'$like':'%'+_0x28eb97[_0xae29('0x1b')][_0xae29('0x27')]+'%'};return _0x593647;}})});}_0x990bb9=_[_0xae29('0x28')]({},_0x990bb9,_0x28eb97[_0xae29('0x29')]);var _0x2df327={'where':_0x990bb9[_0xae29('0x25')]};return db[_0xae29('0x16')][_0xae29('0xa')](_0x2df327)['then'](function(_0x255ad9){_0x24f428[_0xae29('0xa')]=_0x255ad9;if(_0x28eb97[_0xae29('0x1b')][_0xae29('0x2a')]){_0x990bb9[_0xae29('0x2b')]=[{'all':!![]}];}return db[_0xae29('0x16')]['findAll'](_0x990bb9);})[_0xae29('0xe')](function(_0x28af13){_0x24f428[_0xae29('0x2c')]=_0x28af13;return _0x24f428;})[_0xae29('0xe')](respondWithFilteredResult(_0x2c7579,_0x990bb9))[_0xae29('0x2d')](handleError(_0x2c7579,null));};exports['show']=function(_0x1893af,_0x2c12ea){var _0x32e927={'raw':![],'where':{'id':_0x1893af[_0xae29('0x2e')]['id']}},_0x2b8443={};_0x2b8443[_0xae29('0x1a')]=_['keys'](db[_0xae29('0x16')][_0xae29('0x17')]);_0x2b8443['query']=_[_0xae29('0x1c')](_0x1893af[_0xae29('0x1b')]);_0x2b8443[_0xae29('0x1d')]=_[_0xae29('0x2f')](_0x2b8443['model'],_0x2b8443[_0xae29('0x1b')]);_0x32e927[_0xae29('0x1f')]=_[_0xae29('0x2f')](_0x2b8443[_0xae29('0x1a')],qs['fields'](_0x1893af['query'][_0xae29('0x1e')]));_0x32e927['attributes']=_0x32e927[_0xae29('0x1f')][_0xae29('0x20')]?_0x32e927[_0xae29('0x1f')]:_0x2b8443[_0xae29('0x1a')];if(_0x1893af[_0xae29('0x1b')][_0xae29('0x2a')]){_0x32e927[_0xae29('0x2b')]=[{'all':!![]}];}_0x32e927=_['merge']({},_0x32e927,_0x1893af[_0xae29('0x29')]);return db['Dynamics365Account'][_0xae29('0x30')](_0x32e927)[_0xae29('0xe')](handleEntityNotFound(_0x2c12ea,null))[_0xae29('0xe')](respondWithResult(_0x2c12ea,null))[_0xae29('0x2d')](handleError(_0x2c12ea,null));};exports[_0xae29('0x31')]=function(_0x4c11f5,_0x530f69){return db[_0xae29('0x16')][_0xae29('0x31')](_0x4c11f5[_0xae29('0x32')],{})[_0xae29('0xe')](respondWithResult(_0x530f69,0xc9))[_0xae29('0x2d')](handleError(_0x530f69,null));};exports[_0xae29('0xd')]=function(_0x1961f5,_0x49ab3d){if(_0x1961f5[_0xae29('0x32')]['id']){delete _0x1961f5['body']['id'];}return db[_0xae29('0x16')]['find']({'where':{'id':_0x1961f5[_0xae29('0x2e')]['id']}})[_0xae29('0xe')](handleEntityNotFound(_0x49ab3d,null))[_0xae29('0xe')](saveUpdates(_0x1961f5[_0xae29('0x32')],null))[_0xae29('0xe')](respondWithResult(_0x49ab3d,null))[_0xae29('0x2d')](handleError(_0x49ab3d,null));};exports['destroy']=function(_0x6e0e6c,_0x4f43d4){return db[_0xae29('0x16')][_0xae29('0x30')]({'where':{'id':_0x6e0e6c[_0xae29('0x2e')]['id']}})[_0xae29('0xe')](handleEntityNotFound(_0x4f43d4,null))[_0xae29('0xe')](removeEntity(_0x4f43d4,null))[_0xae29('0x2d')](handleError(_0x4f43d4,null));};exports[_0xae29('0x33')]=function(_0x403def,_0x2fbc5c){var _0x559478={};var _0x591f25={};var _0x344c41;var _0x46dcb5;return db[_0xae29('0x16')][_0xae29('0x34')]({'where':{'id':_0x403def['params']['id']}})[_0xae29('0xe')](handleEntityNotFound(_0x2fbc5c,null))[_0xae29('0xe')](function(_0x3fc89a){if(_0x3fc89a){_0x344c41=_0x3fc89a;_0x591f25[_0xae29('0x1a')]=_[_0xae29('0x1c')](db[_0xae29('0x35')][_0xae29('0x17')]);_0x591f25[_0xae29('0x1b')]=_[_0xae29('0x1c')](_0x403def[_0xae29('0x1b')]);_0x591f25[_0xae29('0x1d')]=_['intersection'](_0x591f25[_0xae29('0x1a')],_0x591f25[_0xae29('0x1b')]);_0x559478[_0xae29('0x1f')]=_['intersection'](_0x591f25['model'],qs[_0xae29('0x1e')](_0x403def[_0xae29('0x1b')]['fields']));_0x559478[_0xae29('0x1f')]=_0x559478[_0xae29('0x1f')]['length']?_0x559478[_0xae29('0x1f')]:_0x591f25[_0xae29('0x1a')];_0x559478['order']=qs[_0xae29('0x23')](_0x403def['query'][_0xae29('0x23')]);_0x559478[_0xae29('0x25')]=qs[_0xae29('0x1d')](_[_0xae29('0x24')](_0x403def['query'],_0x591f25[_0xae29('0x1d')]));if(_0x403def[_0xae29('0x1b')][_0xae29('0x27')]){_0x559478[_0xae29('0x25')]=_[_0xae29('0x28')](_0x559478[_0xae29('0x25')],{'$or':_[_0xae29('0x15')](_0x559478['attributes'],function(_0x3ebf54){var _0x4f4096={};_0x4f4096[_0x3ebf54]={'$like':'%'+_0x403def[_0xae29('0x1b')]['filter']+'%'};return _0x4f4096;})});}_0x559478=_[_0xae29('0x28')]({},_0x559478,_0x403def['options']);return _0x344c41[_0xae29('0x33')](_0x559478);}})[_0xae29('0xe')](function(_0x462d42){if(_0x462d42){_0x46dcb5=_0x462d42[_0xae29('0x20')];if(!_0x403def['query'][_0xae29('0x21')](_0xae29('0x22'))){_0x559478[_0xae29('0x9')]=qs[_0xae29('0x9')](_0x403def[_0xae29('0x1b')][_0xae29('0x9')]);_0x559478[_0xae29('0x8')]=qs[_0xae29('0x8')](_0x403def['query'][_0xae29('0x8')]);}return _0x344c41[_0xae29('0x33')](_0x559478);}})[_0xae29('0xe')](function(_0xdb4985){if(_0xdb4985){return _0xdb4985?{'count':_0x46dcb5,'rows':_0xdb4985}:null;}})[_0xae29('0xe')](respondWithResult(_0x2fbc5c,null))[_0xae29('0x2d')](handleError(_0x2fbc5c,null));};exports['addConfiguration']=function(_0x167226,_0x49a4e4){if(_0x167226[_0xae29('0x32')]['id']){delete _0x167226[_0xae29('0x32')]['id'];}return db['Dynamics365Account'][_0xae29('0x34')]({'where':{'id':_0x167226['params']['id']}})[_0xae29('0xe')](handleEntityNotFound(_0x49a4e4,null))[_0xae29('0xe')](function(_0x287371){if(_0x287371){_0x167226[_0xae29('0x32')]['AccountId']=_0x287371['id'];_0x167226['body'][_0xae29('0x36')]=integrations[_0xae29('0x37')](_0x167226[_0xae29('0x32')][_0xae29('0x38')],_0x167226[_0xae29('0x32')][_0xae29('0x18')]);_0x167226[_0xae29('0x32')]['Descriptions']=integrations[_0xae29('0x39')](_0x167226[_0xae29('0x32')]['channel'],_0x167226[_0xae29('0x32')][_0xae29('0x18')]);return db[_0xae29('0x35')]['create'](_0x167226[_0xae29('0x32')],{'include':[{'model':db[_0xae29('0x3a')],'as':_0xae29('0x36')},{'model':db[_0xae29('0x3a')],'as':_0xae29('0x3b')}]});}return null;})[_0xae29('0xe')](respondWithResult(_0x49a4e4,null))['catch'](handleError(_0x49a4e4,null));};function sanitizeRemoteUri(_0x31a31e){var _0x2c3c3a=_0x31a31e[_0xae29('0x3c')](-0x1);if(_0x2c3c3a==='/')return _0x31a31e['substring'](0x0,_0x31a31e[_0xae29('0x3d')](_0x2c3c3a));return _0x31a31e;}function getWebApiUrl(_0x3e5b2a){return util['format']('%s/api/data/v9.0/',_0x3e5b2a);}exports[_0xae29('0x3e')]=function(_0x8607c5,_0x1befe4){var _0x286284=_0x8607c5['query'][_0xae29('0x3f')];var _0x124c17=_0x286284===_0xae29('0x40')?'Incident':'PhoneCall';var _0x54f5cd='';var _0x270ce8='';var _0x58fc12='';var _0x11fe5a='';var _0xa2d891='';var _0x31a306='';var _0x51607c='';var _0x525305='';var _0xb6bb29=[_0xae29('0x41'),_0xae29('0x42'),_0xae29('0x43'),_0xae29('0x44'),_0xae29('0x45'),'subject','phonenumber','regardingobjectid','directioncode',_0xae29('0x46')];var _0x32f8bd=[_0xae29('0x47'),_0xae29('0x48'),_0xae29('0x49'),_0xae29('0x4a'),'contactidname',_0xae29('0x4b'),_0xae29('0x4c'),_0xae29('0x4d'),_0xae29('0x4e'),_0xae29('0x4f'),'createdbyname',_0xae29('0x50'),_0xae29('0x51'),_0xae29('0x52'),_0xae29('0x53'),_0xae29('0x54'),_0xae29('0x55'),_0xae29('0x56'),_0xae29('0x57'),_0xae29('0x58'),'entityimage_timestamp',_0xae29('0x59'),'escalatedon',_0xae29('0x5a'),_0xae29('0x5b'),_0xae29('0x5c'),_0xae29('0x5d'),'influencescore','kbarticleidname',_0xae29('0x5e'),_0xae29('0x5f'),_0xae29('0x60'),'modifiedbyexternalpartyyominame',_0xae29('0x61'),_0xae29('0x62'),_0xae29('0x63'),_0xae29('0x64'),_0xae29('0x65'),_0xae29('0x66'),_0xae29('0x67'),_0xae29('0x68'),_0xae29('0x69'),_0xae29('0x6a'),_0xae29('0x6b'),'owneridtype',_0xae29('0x6c'),'parentcaseidname',_0xae29('0x6d'),'primarycontactidyominame',_0xae29('0x6e'),_0xae29('0x6f'),_0xae29('0x70'),_0xae29('0x71'),'resolvebykpiidname','responseby',_0xae29('0x72'),_0xae29('0x73'),'sentimentvalue',_0xae29('0x74'),_0xae29('0x75'),'socialprofileidname',_0xae29('0x76'),'statuscode',_0xae29('0x77'),_0xae29('0x78'),'timezoneruleversionnumber',_0xae29('0x79'),'traversedpath',_0xae29('0x7a'),_0xae29('0x7b')];var _0x3e1c92=_0xb6bb29['concat'](_0x32f8bd);return db['Dynamics365Account'][_0xae29('0x34')]({'where':{'id':_0x8607c5[_0xae29('0x2e')]['id']},'attributes':['id',_0xae29('0x7c'),_0xae29('0x7d'),_0xae29('0x7e'),_0xae29('0x7f'),'clientId',_0xae29('0x80'),_0xae29('0x81')],'include':[{'model':db[_0xae29('0x82')],'as':'CloudProvider','attributes':['id',_0xae29('0x83'),_0xae29('0x84')]}]})[_0xae29('0xe')](handleEntityNotFound(_0x1befe4,null))[_0xae29('0xe')](function(_0x3b59fb){if(_0x3b59fb){if(_0x3b59fb[_0xae29('0x81')]){_0x3b59fb[_0xae29('0x85')]=_0x3b59fb[_0xae29('0x82')][_0xae29('0x83')];_0x525305=sanitizeRemoteUri(_0x3b59fb[_0xae29('0x82')][_0xae29('0x84')]);_0x51607c=getWebApiUrl(_0x525305);return _0x3b59fb;}_0x525305=sanitizeRemoteUri(_0x3b59fb[_0xae29('0x7e')]);_0x51607c=getWebApiUrl(_0x525305);var _0x40bb3f={'method':_0xae29('0x86'),'uri':_0xae29('0x87')+_0x3b59fb['tenantId']+_0xae29('0x88'),'form':{'client_id':_0x3b59fb[_0xae29('0x89')],'resource':_0x525305,'username':_0x3b59fb['username'],'password':_0x3b59fb[_0xae29('0x7d')],'grant_type':_0xae29('0x7d'),'client_secret':_0x3b59fb[_0xae29('0x80')]},'json':!![]};return rp(_0x40bb3f);}})[_0xae29('0xe')](function(_0x51fd45){_0x31a306=_0x51fd45[_0xae29('0x85')];var _0x51d63f={'method':_0xae29('0x8a'),'uri':encodeURI(_0x51607c+_0xae29('0x8b')+_0x124c17+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x31a306,'If-None-Match':null,'OData-Version':_0xae29('0x8c')},'json':!![]};return rp(_0x51d63f);})[_0xae29('0xe')](function(_0x14a70b){var _0x30d03d=_0x14a70b[_0xae29('0x8d')][0x0];var _0x3b2b5b=_0x30d03d['MetadataId'];var _0x34da71={'method':_0xae29('0x8a'),'uri':_0x51607c+_0xae29('0x8e')+_0x3b2b5b+_0xae29('0x8f'),'headers':{'Authorization':_0xae29('0x90')+_0x31a306,'If-None-Match':null,'OData-Version':_0xae29('0x8c')},'json':!![]};return rp(_0x34da71);})[_0xae29('0xe')](function(_0x141280){_0x54f5cd=_0x141280;_0x270ce8=_0x54f5cd['Attributes'];_0x270ce8=_[_0xae29('0x91')](_0x270ce8,function(_0x8d279a){return!_0x3e1c92[_0xae29('0x92')](_0x8d279a[_0xae29('0x93')]);});var _0xd09109=[];var _0x1f5810=[];_0x270ce8['forEach'](function(_0x55167f){if(_0x55167f[_0xae29('0x94')]){var _0x49ae1a=_0x55167f[_0xae29('0x94')][_0xae29('0x95')](_0x55167f['@odata.type'][_0xae29('0x3d')]('.')+0x1);if(_0x49ae1a===_0xae29('0x96')){_0xd09109['push'](getSelectList(_0x51607c,_0x286284,_0x1f5810,_0x54f5cd[_0xae29('0x97')],_0x55167f[_0xae29('0x97')],_0x31a306));}}});return Promise[_0xae29('0x98')](_0xd09109);})[_0xae29('0xe')](function(_0x794bb8){_0x58fc12=_0x794bb8[0x0];var _0x2a26f6=[];var _0x643e02=[];_0x270ce8['forEach'](function(_0x223c32){if(!_[_0xae29('0x99')](_0x223c32[_0xae29('0x94')])){var _0x18f9c5=_0x223c32[_0xae29('0x94')][_0xae29('0x95')](_0x223c32[_0xae29('0x94')]['lastIndexOf']('.')+0x1);if(_0x18f9c5===_0xae29('0x9a')){_0x2a26f6[_0xae29('0x9b')](getBooleanList(_0x51607c,_0x286284,_0x643e02,_0x54f5cd[_0xae29('0x97')],_0x223c32[_0xae29('0x97')],_0x31a306));}}});return Promise[_0xae29('0x98')](_0x2a26f6);})['then'](function(_0x350f1f){_0x11fe5a=_0x350f1f[0x0];var _0x5c839a=[];var _0x343556=[];_0x270ce8['forEach'](function(_0xadef35){if(_0xadef35[_0xae29('0x94')]){var _0x6a8053=_0xadef35['@odata.type'][_0xae29('0x95')](_0xadef35[_0xae29('0x94')]['lastIndexOf']('.')+0x1);if(_0x6a8053==='StringAttributeMetadata'||_0x6a8053===_0xae29('0x9c')||_0x6a8053==='BigIntAttributeMetadata'||_0x6a8053===_0xae29('0x9d')||_0x6a8053===_0xae29('0x9e')||_0x6a8053===_0xae29('0x9f')||_0x6a8053===_0xae29('0xa0')||_0x6a8053===_0xae29('0xa1')||_0x6a8053==='StateAttributeMetadata'||_0x6a8053===_0xae29('0xa2')){_0x5c839a[_0xae29('0x9b')](getInputList(_0x51607c,_0x286284,_0x6a8053,_0x343556,_0x54f5cd[_0xae29('0x97')],_0xadef35['MetadataId'],_0x31a306));}}});return Promise['all'](_0x5c839a);})['then'](function(_0x3a5157){_0xa2d891=_0x3a5157[0x0];var _0x29be89=_0x58fc12[_0xae29('0xa3')](_0x11fe5a)[_0xae29('0xa3')](_0xa2d891);var _0x2cc50d={'count':_0x29be89[_0xae29('0x20')],'rows':_0x29be89};return _0x2cc50d;})[_0xae29('0xe')](respondWithResult(_0x1befe4,null))['catch'](function(_0x7da340){var _0x3c91bb=_0x8607c5['query'][_0xae29('0xa4')]?0x1f4:_0x7da340[_0xae29('0xa5')]||0x1f4;logger[_0xae29('0xa6')](_0x7da340[_0xae29('0x11')]);delete _0x7da340['name'];if(_0x3c91bb===0x191){_0x3c91bb=0x190;}_0x1befe4[_0xae29('0x7')](_0x3c91bb)[_0xae29('0x13')](_0x8607c5[_0xae29('0x1b')][_0xae29('0xa4')]?{'message':'Wrong\x20credentials','statusCode':_0x7da340['statusCode']}:_0x7da340);});};function getSelectList(_0x323cb2,_0x15ba3e,_0x1c406c,_0x251ada,_0x3694d3,_0x5e0466){var _0x3c6fd7={'method':_0xae29('0x8a'),'uri':_0x323cb2+_0xae29('0x8e')+_0x251ada+')/Attributes('+_0x3694d3+_0xae29('0xa7')+_0xae29('0xa8'),'headers':{'Authorization':_0xae29('0x90')+_0x5e0466,'If-None-Match':null,'OData-Version':_0xae29('0x8c')},'json':!![]};return rp(_0x3c6fd7)['then'](function(_0x3deb70){var _0x3205c4=[];var _0x298e85=_0x3deb70[_0xae29('0xa9')][_0xae29('0xaa')];_0x298e85[_0xae29('0xab')](function(_0x3a54ba){_0x3205c4['push']({'name':_0x3a54ba[_0xae29('0xac')][_0xae29('0xad')][_0xae29('0xac')],'value':String(_0x3a54ba[_0xae29('0xae')])});});var _0x222add={'id':_0x15ba3e+'_'+_0x3deb70[_0xae29('0x93')],'name':_0x3deb70[_0xae29('0xaf')][_0xae29('0xad')][_0xae29('0xac')],'custom':![],'options':_0x3205c4};_0x1c406c[_0xae29('0x9b')](_0x222add);return _0x1c406c;});}function getBooleanList(_0x256dfe,_0xa2562f,_0x22221c,_0x2b5843,_0x4f387e,_0x1cf3bf){var _0x48d0c4={'method':_0xae29('0x8a'),'uri':_0x256dfe+_0xae29('0x8e')+_0x2b5843+_0xae29('0xb0')+_0x4f387e+')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','headers':{'Authorization':_0xae29('0x90')+_0x1cf3bf,'If-None-Match':null,'OData-Version':_0xae29('0x8c')},'json':!![]};return rp(_0x48d0c4)[_0xae29('0xe')](function(_0x4ce38a){var _0x487693=[];_0x487693[_0xae29('0x9b')]({'name':_0x4ce38a['OptionSet'][_0xae29('0xb1')][_0xae29('0xac')][_0xae29('0xad')][_0xae29('0xac')],'value':_0xae29('0xb2')},{'name':_0x4ce38a[_0xae29('0xa9')]['FalseOption'][_0xae29('0xac')]['UserLocalizedLabel'][_0xae29('0xac')],'value':'false'});var _0x173fd3={'id':_0xa2562f+'_'+_0x4ce38a[_0xae29('0x93')],'name':_0x4ce38a['DisplayName'][_0xae29('0xad')]['Label'],'custom':![],'options':_0x487693};_0x22221c[_0xae29('0x9b')](_0x173fd3);return _0x22221c;});}function getInputList(_0x3b196d,_0x184878,_0x5474c3,_0x27390f,_0x3ec489,_0x1b75b0,_0x2b439c){var _0x124bf0={'method':_0xae29('0x8a'),'uri':_0x3b196d+_0xae29('0x8e')+_0x3ec489+')/Attributes('+_0x1b75b0+_0xae29('0xb3')+_0x5474c3+_0xae29('0xb4'),'headers':{'Authorization':_0xae29('0x90')+_0x2b439c,'If-None-Match':null,'OData-Version':_0xae29('0x8c')},'json':!![]};return rp(_0x124bf0)[_0xae29('0xe')](function(_0x30ad68){var _0x2cc0d3={'id':_0x184878+'_'+_0x30ad68['LogicalName'],'name':_0x30ad68[_0xae29('0xaf')][_0xae29('0xad')]?_0x30ad68['DisplayName'][_0xae29('0xad')][_0xae29('0xac')]:_0x30ad68[_0xae29('0x93')],'custom':![],'options':[]};_0x27390f[_0xae29('0x9b')](_0x2cc0d3);return _0x27390f;});}
\ No newline at end of file
+var _0x0abe=['DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','test','statusCode','Wrong\x20credentials','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','OptionSet','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','offset','undefined','limit','count','status','set','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','order','sort','pick','filter','merge','where','VIRTUAL','options','Dynamics365Account','includeAll','include','rows','show','params','keys','catch','create','body','destroy','find','getConfigurations','findOne','Dynamics365Configuration','length','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','primarycontactidyominame','prioritycodename','responseby','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientId','clientSecret','CloudProvider','data7','modernAuthentication','data5','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','GET','remove','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x0abe,0x188));var _0xe0ab=function(_0x255e7b,_0x595944){_0x255e7b=_0x255e7b-0x0;var _0x141623=_0x0abe[_0x255e7b];return _0x141623;};'use strict';var rp=require(_0xe0ab('0x0'));var util=require('util');var _=require(_0xe0ab('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xe0ab('0x2'))(_0xe0ab('0x3'));var db=require(_0xe0ab('0x4'))['db'];var integrations=require(_0xe0ab('0x5'));function respondWithResult(_0x1a7751,_0x25d0a3){_0x25d0a3=_0x25d0a3||0xc8;return function(_0xfd76cf){if(_0xfd76cf){return _0x1a7751['status'](_0x25d0a3)[_0xe0ab('0x6')](_0xfd76cf);}};}function respondWithFilteredResult(_0x442693,_0x4c45d6){return function(_0x576315){if(_0x576315){var _0x4c54ea=typeof _0x4c45d6[_0xe0ab('0x7')]===_0xe0ab('0x8')&&typeof _0x4c45d6[_0xe0ab('0x9')]==='undefined';var _0x1e4861=_0x576315[_0xe0ab('0xa')];var _0x1867f8=_0x4c54ea?0x0:_0x4c45d6[_0xe0ab('0x7')];var _0x186fc1=_0x4c54ea?_0x576315['count']:_0x4c45d6['offset']+_0x4c45d6[_0xe0ab('0x9')];var _0x47f404;if(_0x186fc1>=_0x1e4861){_0x186fc1=_0x1e4861;_0x47f404=0xc8;}else{_0x47f404=0xce;}_0x442693[_0xe0ab('0xb')](_0x47f404);return _0x442693[_0xe0ab('0xc')]('Content-Range',_0x1867f8+'-'+_0x186fc1+'/'+_0x1e4861)[_0xe0ab('0x6')](_0x576315);}return null;};}function saveUpdates(_0x5aa1dc){return function(_0x2d2812){if(_0x2d2812){return _0x2d2812[_0xe0ab('0xd')](_0x5aa1dc)[_0xe0ab('0xe')](function(_0x1a1a49){return _0x1a1a49;});}return null;};}function removeEntity(_0x14d5ad){return function(_0x5e0331){if(_0x5e0331){return _0x5e0331['destroy']()[_0xe0ab('0xe')](function(){_0x14d5ad[_0xe0ab('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10fe05){return function(_0x12cce8){if(!_0x12cce8){_0x10fe05['sendStatus'](0x194);}return _0x12cce8;};}function handleError(_0x232d3f,_0x21f813){_0x21f813=_0x21f813||0x1f4;return function(_0x4fc689){logger[_0xe0ab('0xf')](_0x4fc689[_0xe0ab('0x10')]);if(_0x4fc689[_0xe0ab('0x11')]){delete _0x4fc689[_0xe0ab('0x11')];}_0x232d3f[_0xe0ab('0xb')](_0x21f813)[_0xe0ab('0x12')](_0x4fc689);};}exports[_0xe0ab('0x13')]=function(_0x416d9d,_0x105074){var _0x10e882={},_0x55c3e2={},_0x3d5794={'count':0x0,'rows':[]};var _0xdc1a28=_[_0xe0ab('0x14')](db['Dynamics365Account'][_0xe0ab('0x15')],function(_0x2d6e56){return{'name':_0x2d6e56[_0xe0ab('0x16')],'type':_0x2d6e56[_0xe0ab('0x17')][_0xe0ab('0x18')]};});_0x55c3e2[_0xe0ab('0x19')]=_['map'](_0xdc1a28,_0xe0ab('0x11'));_0x55c3e2[_0xe0ab('0x1a')]=_['keys'](_0x416d9d[_0xe0ab('0x1a')]);_0x55c3e2[_0xe0ab('0x1b')]=_[_0xe0ab('0x1c')](_0x55c3e2['model'],_0x55c3e2['query']);_0x10e882['attributes']=_['intersection'](_0x55c3e2['model'],qs[_0xe0ab('0x1d')](_0x416d9d['query']['fields']));_0x10e882[_0xe0ab('0x1e')]=_0x10e882[_0xe0ab('0x1e')]['length']?_0x10e882['attributes']:_0x55c3e2[_0xe0ab('0x19')];if(!_0x416d9d[_0xe0ab('0x1a')]['hasOwnProperty']('nolimit')){_0x10e882[_0xe0ab('0x9')]=qs[_0xe0ab('0x9')](_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x9')]);_0x10e882[_0xe0ab('0x7')]=qs[_0xe0ab('0x7')](_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x7')]);}_0x10e882[_0xe0ab('0x1f')]=qs[_0xe0ab('0x20')](_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x20')]);_0x10e882['where']=qs[_0xe0ab('0x1b')](_[_0xe0ab('0x21')](_0x416d9d[_0xe0ab('0x1a')],_0x55c3e2[_0xe0ab('0x1b')]),_0xdc1a28);if(_0x416d9d['query'][_0xe0ab('0x22')]){_0x10e882['where']=_[_0xe0ab('0x23')](_0x10e882[_0xe0ab('0x24')],{'$or':_[_0xe0ab('0x14')](_0xdc1a28,function(_0x274366){if(_0x274366['type']!==_0xe0ab('0x25')){var _0x3cc202={};_0x3cc202[_0x274366[_0xe0ab('0x11')]]={'$like':'%'+_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x22')]+'%'};return _0x3cc202;}})});}_0x10e882=_[_0xe0ab('0x23')]({},_0x10e882,_0x416d9d[_0xe0ab('0x26')]);var _0x4f739e={'where':_0x10e882[_0xe0ab('0x24')]};return db[_0xe0ab('0x27')][_0xe0ab('0xa')](_0x4f739e)[_0xe0ab('0xe')](function(_0x82d8e4){_0x3d5794[_0xe0ab('0xa')]=_0x82d8e4;if(_0x416d9d[_0xe0ab('0x1a')][_0xe0ab('0x28')]){_0x10e882[_0xe0ab('0x29')]=[{'all':!![]}];}return db['Dynamics365Account']['findAll'](_0x10e882);})[_0xe0ab('0xe')](function(_0x5c041a){_0x3d5794[_0xe0ab('0x2a')]=_0x5c041a;return _0x3d5794;})['then'](respondWithFilteredResult(_0x105074,_0x10e882))['catch'](handleError(_0x105074,null));};exports[_0xe0ab('0x2b')]=function(_0x318ce6,_0x246307){var _0x4e5653={'raw':![],'where':{'id':_0x318ce6[_0xe0ab('0x2c')]['id']}},_0x406308={};_0x406308[_0xe0ab('0x19')]=_[_0xe0ab('0x2d')](db[_0xe0ab('0x27')][_0xe0ab('0x15')]);_0x406308[_0xe0ab('0x1a')]=_[_0xe0ab('0x2d')](_0x318ce6[_0xe0ab('0x1a')]);_0x406308[_0xe0ab('0x1b')]=_[_0xe0ab('0x1c')](_0x406308[_0xe0ab('0x19')],_0x406308['query']);_0x4e5653[_0xe0ab('0x1e')]=_[_0xe0ab('0x1c')](_0x406308[_0xe0ab('0x19')],qs[_0xe0ab('0x1d')](_0x318ce6[_0xe0ab('0x1a')][_0xe0ab('0x1d')]));_0x4e5653[_0xe0ab('0x1e')]=_0x4e5653['attributes']['length']?_0x4e5653[_0xe0ab('0x1e')]:_0x406308[_0xe0ab('0x19')];if(_0x318ce6['query'][_0xe0ab('0x28')]){_0x4e5653[_0xe0ab('0x29')]=[{'all':!![]}];}_0x4e5653=_['merge']({},_0x4e5653,_0x318ce6[_0xe0ab('0x26')]);return db[_0xe0ab('0x27')]['find'](_0x4e5653)[_0xe0ab('0xe')](handleEntityNotFound(_0x246307,null))[_0xe0ab('0xe')](respondWithResult(_0x246307,null))[_0xe0ab('0x2e')](handleError(_0x246307,null));};exports['create']=function(_0x2deead,_0x4d47e0){return db[_0xe0ab('0x27')][_0xe0ab('0x2f')](_0x2deead[_0xe0ab('0x30')],{})[_0xe0ab('0xe')](respondWithResult(_0x4d47e0,0xc9))[_0xe0ab('0x2e')](handleError(_0x4d47e0,null));};exports[_0xe0ab('0xd')]=function(_0x54f272,_0x4a048e){if(_0x54f272[_0xe0ab('0x30')]['id']){delete _0x54f272[_0xe0ab('0x30')]['id'];}return db['Dynamics365Account']['find']({'where':{'id':_0x54f272[_0xe0ab('0x2c')]['id']}})[_0xe0ab('0xe')](handleEntityNotFound(_0x4a048e,null))[_0xe0ab('0xe')](saveUpdates(_0x54f272[_0xe0ab('0x30')],null))[_0xe0ab('0xe')](respondWithResult(_0x4a048e,null))[_0xe0ab('0x2e')](handleError(_0x4a048e,null));};exports[_0xe0ab('0x31')]=function(_0xd1ea6c,_0x50ca45){return db[_0xe0ab('0x27')][_0xe0ab('0x32')]({'where':{'id':_0xd1ea6c[_0xe0ab('0x2c')]['id']}})[_0xe0ab('0xe')](handleEntityNotFound(_0x50ca45,null))['then'](removeEntity(_0x50ca45,null))[_0xe0ab('0x2e')](handleError(_0x50ca45,null));};exports[_0xe0ab('0x33')]=function(_0x252f59,_0x3fc118){var _0xc88d64={};var _0x379d3d={};var _0x24f044;var _0x1cc993;return db['Dynamics365Account'][_0xe0ab('0x34')]({'where':{'id':_0x252f59[_0xe0ab('0x2c')]['id']}})[_0xe0ab('0xe')](handleEntityNotFound(_0x3fc118,null))[_0xe0ab('0xe')](function(_0x2894d6){if(_0x2894d6){_0x24f044=_0x2894d6;_0x379d3d['model']=_['keys'](db[_0xe0ab('0x35')][_0xe0ab('0x15')]);_0x379d3d[_0xe0ab('0x1a')]=_[_0xe0ab('0x2d')](_0x252f59[_0xe0ab('0x1a')]);_0x379d3d['filters']=_[_0xe0ab('0x1c')](_0x379d3d[_0xe0ab('0x19')],_0x379d3d[_0xe0ab('0x1a')]);_0xc88d64[_0xe0ab('0x1e')]=_['intersection'](_0x379d3d[_0xe0ab('0x19')],qs[_0xe0ab('0x1d')](_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x1d')]));_0xc88d64[_0xe0ab('0x1e')]=_0xc88d64[_0xe0ab('0x1e')]['length']?_0xc88d64[_0xe0ab('0x1e')]:_0x379d3d[_0xe0ab('0x19')];_0xc88d64[_0xe0ab('0x1f')]=qs['sort'](_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x20')]);_0xc88d64[_0xe0ab('0x24')]=qs[_0xe0ab('0x1b')](_[_0xe0ab('0x21')](_0x252f59[_0xe0ab('0x1a')],_0x379d3d[_0xe0ab('0x1b')]));if(_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x22')]){_0xc88d64[_0xe0ab('0x24')]=_[_0xe0ab('0x23')](_0xc88d64[_0xe0ab('0x24')],{'$or':_[_0xe0ab('0x14')](_0xc88d64['attributes'],function(_0xa2fe9f){var _0x38aa4a={};_0x38aa4a[_0xa2fe9f]={'$like':'%'+_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x22')]+'%'};return _0x38aa4a;})});}_0xc88d64=_['merge']({},_0xc88d64,_0x252f59[_0xe0ab('0x26')]);return _0x24f044[_0xe0ab('0x33')](_0xc88d64);}})['then'](function(_0x542740){if(_0x542740){_0x1cc993=_0x542740[_0xe0ab('0x36')];if(!_0x252f59[_0xe0ab('0x1a')]['hasOwnProperty'](_0xe0ab('0x37'))){_0xc88d64[_0xe0ab('0x9')]=qs[_0xe0ab('0x9')](_0x252f59[_0xe0ab('0x1a')][_0xe0ab('0x9')]);_0xc88d64[_0xe0ab('0x7')]=qs[_0xe0ab('0x7')](_0x252f59['query'][_0xe0ab('0x7')]);}return _0x24f044[_0xe0ab('0x33')](_0xc88d64);}})[_0xe0ab('0xe')](function(_0x11daa4){if(_0x11daa4){return _0x11daa4?{'count':_0x1cc993,'rows':_0x11daa4}:null;}})[_0xe0ab('0xe')](respondWithResult(_0x3fc118,null))[_0xe0ab('0x2e')](handleError(_0x3fc118,null));};exports[_0xe0ab('0x38')]=function(_0x660e3,_0x4b213d){if(_0x660e3[_0xe0ab('0x30')]['id']){delete _0x660e3[_0xe0ab('0x30')]['id'];}return db[_0xe0ab('0x27')][_0xe0ab('0x34')]({'where':{'id':_0x660e3[_0xe0ab('0x2c')]['id']}})[_0xe0ab('0xe')](handleEntityNotFound(_0x4b213d,null))[_0xe0ab('0xe')](function(_0x50e953){if(_0x50e953){_0x660e3[_0xe0ab('0x30')][_0xe0ab('0x39')]=_0x50e953['id'];_0x660e3['body'][_0xe0ab('0x3a')]=integrations[_0xe0ab('0x3b')](_0x660e3['body'][_0xe0ab('0x3c')],_0x660e3['body'][_0xe0ab('0x17')]);_0x660e3[_0xe0ab('0x30')][_0xe0ab('0x3d')]=integrations[_0xe0ab('0x3e')](_0x660e3[_0xe0ab('0x30')][_0xe0ab('0x3c')],_0x660e3[_0xe0ab('0x30')][_0xe0ab('0x17')]);return db[_0xe0ab('0x35')][_0xe0ab('0x2f')](_0x660e3[_0xe0ab('0x30')],{'include':[{'model':db['Dynamics365Field'],'as':_0xe0ab('0x3a')},{'model':db[_0xe0ab('0x3f')],'as':_0xe0ab('0x3d')}]});}return null;})[_0xe0ab('0xe')](respondWithResult(_0x4b213d,null))[_0xe0ab('0x2e')](handleError(_0x4b213d,null));};function sanitizeRemoteUri(_0x35ea16){var _0x1643db=_0x35ea16[_0xe0ab('0x40')](-0x1);if(_0x1643db==='/')return _0x35ea16[_0xe0ab('0x41')](0x0,_0x35ea16[_0xe0ab('0x42')](_0x1643db));return _0x35ea16;}function getWebApiUrl(_0xffd75c){return util[_0xe0ab('0x43')](_0xe0ab('0x44'),_0xffd75c);}exports[_0xe0ab('0x45')]=function(_0x5140df,_0x51df60){var _0x28ad08=_0x5140df[_0xe0ab('0x1a')][_0xe0ab('0x46')];var _0x36a016=_0x28ad08===_0xe0ab('0x47')?_0xe0ab('0x48'):_0xe0ab('0x49');var _0xd3b8f8='';var _0x4c670d='';var _0x5b4071='';var _0x21162f='';var _0x173538='';var _0x10f3f0='';var _0x2b8895='';var _0x444823='';var _0x5f5bfe=[_0xe0ab('0x4a'),_0xe0ab('0x4b'),_0xe0ab('0x4c'),_0xe0ab('0x4d'),_0xe0ab('0x4e'),'subject',_0xe0ab('0x4f'),_0xe0ab('0x50'),'directioncode','phonecall_activity_parties'];var _0x818f6f=[_0xe0ab('0x51'),_0xe0ab('0x52'),_0xe0ab('0x53'),_0xe0ab('0x54'),_0xe0ab('0x55'),_0xe0ab('0x56'),'contractdetailidname',_0xe0ab('0x57'),'createdbyexternalpartyname',_0xe0ab('0x58'),_0xe0ab('0x59'),_0xe0ab('0x5a'),_0xe0ab('0x5b'),_0xe0ab('0x5c'),_0xe0ab('0x5d'),_0xe0ab('0x5e'),_0xe0ab('0x5f'),_0xe0ab('0x60'),_0xe0ab('0x61'),'entitlementidname','entityimage_timestamp',_0xe0ab('0x62'),_0xe0ab('0x63'),_0xe0ab('0x64'),_0xe0ab('0x65'),'followupby',_0xe0ab('0x66'),'influencescore',_0xe0ab('0x67'),'lastonholdtime',_0xe0ab('0x68'),_0xe0ab('0x69'),_0xe0ab('0x6a'),_0xe0ab('0x6b'),'modifiedbyyominame',_0xe0ab('0x6c'),'modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0xe0ab('0x6d'),_0xe0ab('0x6e'),_0xe0ab('0x6f'),_0xe0ab('0x70'),_0xe0ab('0x71'),_0xe0ab('0x72'),_0xe0ab('0x73'),'owneridyominame',_0xe0ab('0x74'),'primarycontactidname',_0xe0ab('0x75'),_0xe0ab('0x76'),'productidname','productserialnumber','resolveby','resolvebykpiidname',_0xe0ab('0x77'),'responsiblecontactidname',_0xe0ab('0x78'),'sentimentvalue',_0xe0ab('0x79'),_0xe0ab('0x7a'),_0xe0ab('0x7b'),_0xe0ab('0x7c'),'statuscode',_0xe0ab('0x7d'),_0xe0ab('0x7e'),'timezoneruleversionnumber',_0xe0ab('0x7f'),_0xe0ab('0x80'),_0xe0ab('0x81'),_0xe0ab('0x82')];var _0x3ac1b2=_0x5f5bfe[_0xe0ab('0x83')](_0x818f6f);return db['Dynamics365Account'][_0xe0ab('0x34')]({'where':{'id':_0x5140df[_0xe0ab('0x2c')]['id']},'attributes':['id',_0xe0ab('0x84'),_0xe0ab('0x85'),_0xe0ab('0x86'),_0xe0ab('0x87'),_0xe0ab('0x88'),_0xe0ab('0x89'),'modernAuthentication'],'include':[{'model':db['CloudProvider'],'as':_0xe0ab('0x8a'),'attributes':['id','data5',_0xe0ab('0x8b')]}]})[_0xe0ab('0xe')](handleEntityNotFound(_0x51df60,null))[_0xe0ab('0xe')](function(_0x48ef42){if(_0x48ef42){if(_0x48ef42[_0xe0ab('0x8c')]){_0x48ef42['access_token']=_0x48ef42['CloudProvider'][_0xe0ab('0x8d')];_0x444823=sanitizeRemoteUri(_0x48ef42[_0xe0ab('0x8a')][_0xe0ab('0x8b')]);_0x2b8895=getWebApiUrl(_0x444823);return _0x48ef42;}_0x444823=sanitizeRemoteUri(_0x48ef42[_0xe0ab('0x86')]);_0x2b8895=getWebApiUrl(_0x444823);var _0x35eb22={'method':'POST','uri':_0xe0ab('0x8e')+_0x48ef42['tenantId']+_0xe0ab('0x8f'),'form':{'client_id':_0x48ef42[_0xe0ab('0x88')],'resource':_0x444823,'username':_0x48ef42[_0xe0ab('0x84')],'password':_0x48ef42[_0xe0ab('0x85')],'grant_type':_0xe0ab('0x85'),'client_secret':_0x48ef42[_0xe0ab('0x89')]},'json':!![]};return rp(_0x35eb22);}})[_0xe0ab('0xe')](function(_0x4e2811){_0x10f3f0=_0x4e2811[_0xe0ab('0x90')];var _0x2f37c7={'method':'GET','uri':encodeURI(_0x2b8895+_0xe0ab('0x91')+_0x36a016+'\x27'),'headers':{'Authorization':_0xe0ab('0x92')+_0x10f3f0,'If-None-Match':null,'OData-Version':_0xe0ab('0x93')},'json':!![]};return rp(_0x2f37c7);})['then'](function(_0x5c9d21){var _0x28ccb9=_0x5c9d21[_0xe0ab('0x94')][0x0];var _0x24c94a=_0x28ccb9[_0xe0ab('0x95')];var _0x1cc560={'method':_0xe0ab('0x96'),'uri':_0x2b8895+'EntityDefinitions('+_0x24c94a+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':_0xe0ab('0x92')+_0x10f3f0,'If-None-Match':null,'OData-Version':_0xe0ab('0x93')},'json':!![]};return rp(_0x1cc560);})[_0xe0ab('0xe')](function(_0x343606){_0xd3b8f8=_0x343606;_0x4c670d=_0xd3b8f8['Attributes'];_0x4c670d=_[_0xe0ab('0x97')](_0x4c670d,function(_0x998f1f){return!_0x3ac1b2['includes'](_0x998f1f[_0xe0ab('0x98')]);});var _0x58398d=[];var _0x22ff8a=[];_0x4c670d[_0xe0ab('0x99')](function(_0x41be98){if(_0x41be98[_0xe0ab('0x9a')]){var _0x5dd47c=_0x41be98[_0xe0ab('0x9a')][_0xe0ab('0x41')](_0x41be98[_0xe0ab('0x9a')][_0xe0ab('0x42')]('.')+0x1);if(_0x5dd47c===_0xe0ab('0x9b')){_0x58398d[_0xe0ab('0x9c')](getSelectList(_0x2b8895,_0x28ad08,_0x22ff8a,_0xd3b8f8['MetadataId'],_0x41be98[_0xe0ab('0x95')],_0x10f3f0));}}});return Promise['all'](_0x58398d);})[_0xe0ab('0xe')](function(_0x5c0d07){_0x5b4071=_0x5c0d07[0x0];var _0x5da2cb=[];var _0x2d11be=[];_0x4c670d[_0xe0ab('0x99')](function(_0x48b564){if(!_['isNil'](_0x48b564[_0xe0ab('0x9a')])){var _0x664b40=_0x48b564[_0xe0ab('0x9a')][_0xe0ab('0x41')](_0x48b564[_0xe0ab('0x9a')][_0xe0ab('0x42')]('.')+0x1);if(_0x664b40===_0xe0ab('0x9d')){_0x5da2cb[_0xe0ab('0x9c')](getBooleanList(_0x2b8895,_0x28ad08,_0x2d11be,_0xd3b8f8[_0xe0ab('0x95')],_0x48b564[_0xe0ab('0x95')],_0x10f3f0));}}});return Promise[_0xe0ab('0x9e')](_0x5da2cb);})[_0xe0ab('0xe')](function(_0x2a76c6){_0x21162f=_0x2a76c6[0x0];var _0x523c51=[];var _0x2d930f=[];_0x4c670d['forEach'](function(_0x18da8e){if(_0x18da8e[_0xe0ab('0x9a')]){var _0x2780c6=_0x18da8e[_0xe0ab('0x9a')][_0xe0ab('0x41')](_0x18da8e[_0xe0ab('0x9a')][_0xe0ab('0x42')]('.')+0x1);if(_0x2780c6===_0xe0ab('0x9f')||_0x2780c6===_0xe0ab('0xa0')||_0x2780c6==='BigIntAttributeMetadata'||_0x2780c6===_0xe0ab('0xa1')||_0x2780c6===_0xe0ab('0xa2')||_0x2780c6===_0xe0ab('0xa3')||_0x2780c6===_0xe0ab('0xa4')||_0x2780c6===_0xe0ab('0xa5')||_0x2780c6===_0xe0ab('0xa6')||_0x2780c6==='DecimalAttributeMetadata'){_0x523c51[_0xe0ab('0x9c')](getInputList(_0x2b8895,_0x28ad08,_0x2780c6,_0x2d930f,_0xd3b8f8[_0xe0ab('0x95')],_0x18da8e[_0xe0ab('0x95')],_0x10f3f0));}}});return Promise[_0xe0ab('0x9e')](_0x523c51);})[_0xe0ab('0xe')](function(_0x1d3ae1){_0x173538=_0x1d3ae1[0x0];var _0x54f3a7=_0x5b4071['concat'](_0x21162f)['concat'](_0x173538);var _0x1435fa={'count':_0x54f3a7[_0xe0ab('0x36')],'rows':_0x54f3a7};return _0x1435fa;})['then'](respondWithResult(_0x51df60,null))[_0xe0ab('0x2e')](function(_0x339b18){var _0x39853f=_0x5140df[_0xe0ab('0x1a')][_0xe0ab('0xa7')]?0x1f4:_0x339b18[_0xe0ab('0xa8')]||0x1f4;logger[_0xe0ab('0xf')](_0x339b18[_0xe0ab('0x10')]);delete _0x339b18[_0xe0ab('0x11')];if(_0x39853f===0x191){_0x39853f=0x190;}_0x51df60[_0xe0ab('0xb')](_0x39853f)['send'](_0x5140df[_0xe0ab('0x1a')][_0xe0ab('0xa7')]?{'message':_0xe0ab('0xa9'),'statusCode':_0x339b18[_0xe0ab('0xa8')]}:_0x339b18);});};function getSelectList(_0xfd32c6,_0x107b40,_0x2e94ef,_0x1e0590,_0x54c64f,_0x9b278a){var _0x2a288b={'method':_0xe0ab('0x96'),'uri':_0xfd32c6+_0xe0ab('0xaa')+_0x1e0590+_0xe0ab('0xab')+_0x54c64f+_0xe0ab('0xac')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xe0ab('0x92')+_0x9b278a,'If-None-Match':null,'OData-Version':_0xe0ab('0x93')},'json':!![]};return rp(_0x2a288b)[_0xe0ab('0xe')](function(_0x1d07db){var _0x1d17a7=[];var _0x55223c=_0x1d07db['OptionSet'][_0xe0ab('0xad')];_0x55223c[_0xe0ab('0x99')](function(_0xe5b239){_0x1d17a7[_0xe0ab('0x9c')]({'name':_0xe5b239[_0xe0ab('0xae')][_0xe0ab('0xaf')]['Label'],'value':String(_0xe5b239[_0xe0ab('0xb0')])});});var _0x286dd5={'id':_0x107b40+'_'+_0x1d07db[_0xe0ab('0x98')],'name':_0x1d07db[_0xe0ab('0xb1')][_0xe0ab('0xaf')]['Label'],'custom':![],'options':_0x1d17a7};_0x2e94ef[_0xe0ab('0x9c')](_0x286dd5);return _0x2e94ef;});}function getBooleanList(_0xe9d977,_0x542a98,_0x476028,_0x571301,_0x3be384,_0x2e28fc){var _0x1b2d0c={'method':'GET','uri':_0xe9d977+'EntityDefinitions('+_0x571301+_0xe0ab('0xab')+_0x3be384+_0xe0ab('0xb2'),'headers':{'Authorization':_0xe0ab('0x92')+_0x2e28fc,'If-None-Match':null,'OData-Version':_0xe0ab('0x93')},'json':!![]};return rp(_0x1b2d0c)[_0xe0ab('0xe')](function(_0x412ee9){var _0x5b0eec=[];_0x5b0eec['push']({'name':_0x412ee9[_0xe0ab('0xb3')]['TrueOption'][_0xe0ab('0xae')][_0xe0ab('0xaf')][_0xe0ab('0xae')],'value':_0xe0ab('0xb4')},{'name':_0x412ee9['OptionSet'][_0xe0ab('0xb5')][_0xe0ab('0xae')][_0xe0ab('0xaf')][_0xe0ab('0xae')],'value':_0xe0ab('0xb6')});var _0x18aa3c={'id':_0x542a98+'_'+_0x412ee9[_0xe0ab('0x98')],'name':_0x412ee9[_0xe0ab('0xb1')][_0xe0ab('0xaf')][_0xe0ab('0xae')],'custom':![],'options':_0x5b0eec};_0x476028[_0xe0ab('0x9c')](_0x18aa3c);return _0x476028;});}function getInputList(_0x59ae54,_0x5caf52,_0x119506,_0x202b38,_0x46f72f,_0x3c4457,_0x32b5fc){var _0x291b48={'method':_0xe0ab('0x96'),'uri':_0x59ae54+'EntityDefinitions('+_0x46f72f+')/Attributes('+_0x3c4457+_0xe0ab('0xb7')+_0x119506+_0xe0ab('0xb8'),'headers':{'Authorization':_0xe0ab('0x92')+_0x32b5fc,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x291b48)[_0xe0ab('0xe')](function(_0x19bd87){var _0x9e3093={'id':_0x5caf52+'_'+_0x19bd87[_0xe0ab('0x98')],'name':_0x19bd87[_0xe0ab('0xb1')]['UserLocalizedLabel']?_0x19bd87[_0xe0ab('0xb1')][_0xe0ab('0xaf')][_0xe0ab('0xae')]:_0x19bd87['LogicalName'],'custom':![],'options':[]};_0x202b38[_0xe0ab('0x9c')](_0x9e3093);return _0x202b38;});}
\ No newline at end of file
index e0215eb..2bfb008 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x181193,_0x330ac8){var _0x31124e=function(_0x152063){while(--_0x152063){_0x181193['push'](_0x181193['shift']());}};_0x31124e(++_0x330ac8);}(_0x757a,0xde));var _0xa757=function(_0x1b15e3,_0x5bd29a){_0x1b15e3=_0x1b15e3-0x0;var _0x4d5e56=_0x757a[_0x1b15e3];return _0x4d5e56;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x462d1b,_0x394883){var _0x1b9b2f=function(_0x2b6cde){while(--_0x2b6cde){_0x462d1b['push'](_0x462d1b['shift']());}};_0x1b9b2f(++_0x394883);}(_0x757a,0xde));var _0xa757=function(_0x78d8bc,_0x11cc96){_0x78d8bc=_0x78d8bc-0x0;var _0x2fd985=_0x757a[_0x78d8bc];return _0x2fd985;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0e01bde..006b3fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9544=['where','attributes','limit','include','model','map','debug','stringify','ShowDynamics365Account','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw'];(function(_0x500ff5,_0xff6cac){var _0x46dfa3=function(_0x32f656){while(--_0x32f656){_0x500ff5['push'](_0x500ff5['shift']());}};_0x46dfa3(++_0xff6cac);}(_0x9544,0x18a));var _0x4954=function(_0x357496,_0x9f29af){_0x357496=_0x357496-0x0;var _0x1fe918=_0x9544[_0x357496];return _0x1fe918;};'use strict';var _=require(_0x4954('0x0'));var util=require(_0x4954('0x1'));var moment=require(_0x4954('0x2'));var BPromise=require(_0x4954('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4954('0x4'));var db=require(_0x4954('0x5'))['db'];var utils=require(_0x4954('0x6'));var logger=require(_0x4954('0x7'))(_0x4954('0x8'));var config=require(_0x4954('0x9'));var jayson=require(_0x4954('0xa'));var client=jayson[_0x4954('0xb')][_0x4954('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x40db32,_0x1c2416,_0x1a528d){return new BPromise(function(_0x23e289,_0x3e5791){return client['request'](_0x40db32,_0x1a528d)[_0x4954('0xd')](function(_0x7de175){logger[_0x4954('0xe')](_0x4954('0xf'),_0x1c2416,_0x4954('0x10'));logger['debug'](_0x4954('0x11'),_0x1c2416,_0x4954('0x10'),JSON['stringify'](_0x7de175));if(_0x7de175[_0x4954('0x12')]){if(_0x7de175['error']['code']===0x1f4){logger[_0x4954('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x1c2416,_0x7de175[_0x4954('0x12')][_0x4954('0x13')]);return _0x3e5791(_0x7de175['error'][_0x4954('0x13')]);}logger['error'](_0x4954('0xf'),_0x1c2416,_0x7de175[_0x4954('0x12')][_0x4954('0x13')]);return _0x23e289(_0x7de175[_0x4954('0x12')][_0x4954('0x13')]);}else{logger[_0x4954('0xe')]('Dynamics365Account,\x20%s,\x20%s',_0x1c2416,'request\x20sent');_0x23e289(_0x7de175[_0x4954('0x14')][_0x4954('0x13')]);}})[_0x4954('0x15')](function(_0x1edde7){logger[_0x4954('0x12')](_0x4954('0xf'),_0x1c2416,_0x1edde7);_0x3e5791(_0x1edde7);});});}exports[_0x4954('0x16')]=function(_0x47d1a1){var _0x1296b3=this;return new Promise(function(_0x3ef6cc,_0x49edce){return db[_0x4954('0x17')]['findAll']({'raw':_0x47d1a1[_0x4954('0x18')]?_0x47d1a1[_0x4954('0x18')][_0x4954('0x19')]===undefined?!![]:![]:!![],'where':_0x47d1a1[_0x4954('0x18')]?_0x47d1a1['options'][_0x4954('0x1a')]||null:null,'attributes':_0x47d1a1[_0x4954('0x18')]?_0x47d1a1[_0x4954('0x18')][_0x4954('0x1b')]||null:null,'limit':_0x47d1a1[_0x4954('0x18')]?_0x47d1a1['options'][_0x4954('0x1c')]||null:null,'include':_0x47d1a1[_0x4954('0x18')]?_0x47d1a1['options'][_0x4954('0x1d')]?_['map'](_0x47d1a1[_0x4954('0x18')]['include'],function(_0x31636a){return{'model':db[_0x31636a[_0x4954('0x1e')]],'as':_0x31636a['as'],'attributes':_0x31636a[_0x4954('0x1b')],'include':_0x31636a['include']?_[_0x4954('0x1f')](_0x31636a[_0x4954('0x1d')],function(_0x2d988c){return{'model':db[_0x2d988c[_0x4954('0x1e')]],'as':_0x2d988c['as'],'attributes':_0x2d988c['attributes'],'include':_0x2d988c[_0x4954('0x1d')]?_[_0x4954('0x1f')](_0x2d988c['include'],function(_0x4220d2){return{'model':db[_0x4220d2['model']],'as':_0x4220d2['as'],'attributes':_0x4220d2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x173317){logger[_0x4954('0xe')]('GetDynamics365Account',_0x47d1a1);logger[_0x4954('0x20')](_0x4954('0x16'),_0x47d1a1,JSON[_0x4954('0x21')](_0x173317));_0x3ef6cc(_0x173317);})['catch'](function(_0x395698){logger[_0x4954('0x12')]('GetDynamics365Account',_0x395698[_0x4954('0x13')],_0x47d1a1);_0x49edce(_0x1296b3[_0x4954('0x12')](0x1f4,_0x395698[_0x4954('0x13')]));});});};exports[_0x4954('0x22')]=function(_0x1156ac){var _0x37b9bc=this;return new Promise(function(_0x2c10d9,_0x4b4053){return db[_0x4954('0x17')]['find']({'raw':_0x1156ac['options']?_0x1156ac[_0x4954('0x18')][_0x4954('0x19')]===undefined?!![]:![]:!![],'where':_0x1156ac[_0x4954('0x18')]?_0x1156ac[_0x4954('0x18')]['where']||null:null,'attributes':_0x1156ac['options']?_0x1156ac[_0x4954('0x18')][_0x4954('0x1b')]||null:null,'include':_0x1156ac['options']?_0x1156ac['options'][_0x4954('0x1d')]?_[_0x4954('0x1f')](_0x1156ac['options'][_0x4954('0x1d')],function(_0x2cba5c){return{'model':db[_0x2cba5c[_0x4954('0x1e')]],'as':_0x2cba5c['as'],'attributes':_0x2cba5c[_0x4954('0x1b')],'include':_0x2cba5c[_0x4954('0x1d')]?_['map'](_0x2cba5c[_0x4954('0x1d')],function(_0xf5e71){return{'model':db[_0xf5e71[_0x4954('0x1e')]],'as':_0xf5e71['as'],'attributes':_0xf5e71[_0x4954('0x1b')],'include':_0xf5e71[_0x4954('0x1d')]?_[_0x4954('0x1f')](_0xf5e71[_0x4954('0x1d')],function(_0x18ca7a){return{'model':db[_0x18ca7a[_0x4954('0x1e')]],'as':_0x18ca7a['as'],'attributes':_0x18ca7a[_0x4954('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2782fb){logger[_0x4954('0xe')](_0x4954('0x22'),_0x1156ac);logger[_0x4954('0x20')](_0x4954('0x22'),_0x1156ac,JSON[_0x4954('0x21')](_0x2782fb));_0x2c10d9(_0x2782fb);})[_0x4954('0x15')](function(_0x4d289e){logger[_0x4954('0x12')](_0x4954('0x22'),_0x4d289e[_0x4954('0x13')],_0x1156ac);_0x4b4053(_0x37b9bc[_0x4954('0x12')](0x1f4,_0x4d289e[_0x4954('0x13')]));});});};
\ No newline at end of file
+var _0xb5d0=['catch','find','ShowDynamics365Account','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x2bb1fd,_0x5e674e){var _0x2bcab1=function(_0x29bb0d){while(--_0x29bb0d){_0x2bb1fd['push'](_0x2bb1fd['shift']());}};_0x2bcab1(++_0x5e674e);}(_0xb5d0,0x113));var _0x0b5d=function(_0x24f552,_0x46bdb8){_0x24f552=_0x24f552-0x0;var _0x3a0969=_0xb5d0[_0x24f552];return _0x3a0969;};'use strict';var _=require(_0x0b5d('0x0'));var util=require(_0x0b5d('0x1'));var moment=require('moment');var BPromise=require(_0x0b5d('0x2'));var rs=require(_0x0b5d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b5d('0x4'))['db'];var utils=require(_0x0b5d('0x5'));var logger=require(_0x0b5d('0x6'))('rpc');var config=require(_0x0b5d('0x7'));var jayson=require(_0x0b5d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2359ff,_0x184d7e,_0x1bf136){return new BPromise(function(_0x29b05b,_0x24eb79){return client['request'](_0x2359ff,_0x1bf136)[_0x0b5d('0x9')](function(_0x4151fd){logger[_0x0b5d('0xa')](_0x0b5d('0xb'),_0x184d7e,_0x0b5d('0xc'));logger[_0x0b5d('0xd')](_0x0b5d('0xe'),_0x184d7e,_0x0b5d('0xc'),JSON[_0x0b5d('0xf')](_0x4151fd));if(_0x4151fd[_0x0b5d('0x10')]){if(_0x4151fd[_0x0b5d('0x10')][_0x0b5d('0x11')]===0x1f4){logger[_0x0b5d('0x10')](_0x0b5d('0xb'),_0x184d7e,_0x4151fd[_0x0b5d('0x10')][_0x0b5d('0x12')]);return _0x24eb79(_0x4151fd[_0x0b5d('0x10')][_0x0b5d('0x12')]);}logger['error'](_0x0b5d('0xb'),_0x184d7e,_0x4151fd[_0x0b5d('0x10')][_0x0b5d('0x12')]);return _0x29b05b(_0x4151fd['error']['message']);}else{logger[_0x0b5d('0xa')](_0x0b5d('0xb'),_0x184d7e,_0x0b5d('0xc'));_0x29b05b(_0x4151fd[_0x0b5d('0x13')][_0x0b5d('0x12')]);}})['catch'](function(_0x4e43bc){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x184d7e,_0x4e43bc);_0x24eb79(_0x4e43bc);});});}exports[_0x0b5d('0x14')]=function(_0x47a7d6){var _0x38d982=this;return new Promise(function(_0x40a00,_0x1d6d50){return db[_0x0b5d('0x15')][_0x0b5d('0x16')]({'raw':_0x47a7d6[_0x0b5d('0x17')]?_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x18')]===undefined?!![]:![]:!![],'where':_0x47a7d6[_0x0b5d('0x17')]?_0x47a7d6['options'][_0x0b5d('0x19')]||null:null,'attributes':_0x47a7d6['options']?_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x1a')]||null:null,'limit':_0x47a7d6['options']?_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x1b')]||null:null,'include':_0x47a7d6[_0x0b5d('0x17')]?_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x1c')]?_[_0x0b5d('0x1d')](_0x47a7d6[_0x0b5d('0x17')][_0x0b5d('0x1c')],function(_0x3d7c81){return{'model':db[_0x3d7c81[_0x0b5d('0x1e')]],'as':_0x3d7c81['as'],'attributes':_0x3d7c81[_0x0b5d('0x1a')],'include':_0x3d7c81['include']?_[_0x0b5d('0x1d')](_0x3d7c81['include'],function(_0x24445d){return{'model':db[_0x24445d[_0x0b5d('0x1e')]],'as':_0x24445d['as'],'attributes':_0x24445d[_0x0b5d('0x1a')],'include':_0x24445d[_0x0b5d('0x1c')]?_[_0x0b5d('0x1d')](_0x24445d[_0x0b5d('0x1c')],function(_0x5b1b20){return{'model':db[_0x5b1b20['model']],'as':_0x5b1b20['as'],'attributes':_0x5b1b20[_0x0b5d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b5d('0x9')](function(_0x1bc7ee){logger[_0x0b5d('0xa')](_0x0b5d('0x14'),_0x47a7d6);logger[_0x0b5d('0xd')]('GetDynamics365Account',_0x47a7d6,JSON[_0x0b5d('0xf')](_0x1bc7ee));_0x40a00(_0x1bc7ee);})[_0x0b5d('0x1f')](function(_0xa2b26){logger[_0x0b5d('0x10')](_0x0b5d('0x14'),_0xa2b26['message'],_0x47a7d6);_0x1d6d50(_0x38d982[_0x0b5d('0x10')](0x1f4,_0xa2b26['message']));});});};exports['ShowDynamics365Account']=function(_0x26a836){var _0x4aefc3=this;return new Promise(function(_0x143707,_0x1ce8bb){return db[_0x0b5d('0x15')][_0x0b5d('0x20')]({'raw':_0x26a836['options']?_0x26a836[_0x0b5d('0x17')][_0x0b5d('0x18')]===undefined?!![]:![]:!![],'where':_0x26a836[_0x0b5d('0x17')]?_0x26a836[_0x0b5d('0x17')][_0x0b5d('0x19')]||null:null,'attributes':_0x26a836[_0x0b5d('0x17')]?_0x26a836[_0x0b5d('0x17')]['attributes']||null:null,'include':_0x26a836[_0x0b5d('0x17')]?_0x26a836[_0x0b5d('0x17')][_0x0b5d('0x1c')]?_[_0x0b5d('0x1d')](_0x26a836[_0x0b5d('0x17')][_0x0b5d('0x1c')],function(_0x3e441a){return{'model':db[_0x3e441a['model']],'as':_0x3e441a['as'],'attributes':_0x3e441a[_0x0b5d('0x1a')],'include':_0x3e441a['include']?_[_0x0b5d('0x1d')](_0x3e441a[_0x0b5d('0x1c')],function(_0x4650bf){return{'model':db[_0x4650bf[_0x0b5d('0x1e')]],'as':_0x4650bf['as'],'attributes':_0x4650bf[_0x0b5d('0x1a')],'include':_0x4650bf['include']?_['map'](_0x4650bf[_0x0b5d('0x1c')],function(_0x527328){return{'model':db[_0x527328['model']],'as':_0x527328['as'],'attributes':_0x527328[_0x0b5d('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0b5d('0x9')](function(_0x51ed94){logger[_0x0b5d('0xa')](_0x0b5d('0x21'),_0x26a836);logger[_0x0b5d('0xd')](_0x0b5d('0x21'),_0x26a836,JSON['stringify'](_0x51ed94));_0x143707(_0x51ed94);})[_0x0b5d('0x1f')](function(_0x5259f4){logger[_0x0b5d('0x10')](_0x0b5d('0x21'),_0x5259f4['message'],_0x26a836);_0x1ce8bb(_0x4aefc3[_0x0b5d('0x10')](0x1f4,_0x5259f4[_0x0b5d('0x12')]));});});};
\ No newline at end of file
index 236654c..50f72a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a9d=['get','isAuthenticated','index','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','update','delete','/:id','destroy','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a9d,0x16f));var _0xd1a9=function(_0xec7cc8,_0x3bf896){_0xec7cc8=_0xec7cc8-0x0;var _0x100902=_0x1a9d[_0xec7cc8];return _0x100902;};'use strict';var multer=require(_0xd1a9('0x0'));var util=require('util');var path=require(_0xd1a9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd1a9('0x2'));var router=express['Router']();var fs_extra=require(_0xd1a9('0x3'));var auth=require(_0xd1a9('0x4'));var interaction=require(_0xd1a9('0x5'));var config=require(_0xd1a9('0x6'));var controller=require('./intDynamics365Configuration.controller');router[_0xd1a9('0x7')]('/',auth[_0xd1a9('0x8')](),controller[_0xd1a9('0x9')]);router[_0xd1a9('0x7')]('/:id',auth[_0xd1a9('0x8')](),controller[_0xd1a9('0xa')]);router[_0xd1a9('0x7')]('/:id/fields',auth[_0xd1a9('0x8')](),controller[_0xd1a9('0xb')]);router[_0xd1a9('0x7')](_0xd1a9('0xc'),auth[_0xd1a9('0x8')](),controller['getSubjects']);router[_0xd1a9('0x7')](_0xd1a9('0xd'),auth[_0xd1a9('0x8')](),controller[_0xd1a9('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd1a9('0xf')]);router[_0xd1a9('0x10')]('/:id',auth[_0xd1a9('0x8')](),controller[_0xd1a9('0x11')]);router[_0xd1a9('0x12')](_0xd1a9('0x13'),auth[_0xd1a9('0x8')](),controller[_0xd1a9('0x14')]);module[_0xd1a9('0x15')]=router;
\ No newline at end of file
+var _0xff8d=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff8d,0x7d));var _0xdff8=function(_0x30ecb6,_0x4bcd0c){_0x30ecb6=_0x30ecb6-0x0;var _0x2e4833=_0xff8d[_0x30ecb6];return _0x2e4833;};'use strict';var multer=require('multer');var util=require(_0xdff8('0x0'));var path=require(_0xdff8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdff8('0x2')]();var fs_extra=require(_0xdff8('0x3'));var auth=require(_0xdff8('0x4'));var interaction=require(_0xdff8('0x5'));var config=require('../../config/environment');var controller=require(_0xdff8('0x6'));router[_0xdff8('0x7')]('/',auth[_0xdff8('0x8')](),controller[_0xdff8('0x9')]);router[_0xdff8('0x7')](_0xdff8('0xa'),auth[_0xdff8('0x8')](),controller[_0xdff8('0xb')]);router[_0xdff8('0x7')](_0xdff8('0xc'),auth[_0xdff8('0x8')](),controller[_0xdff8('0xd')]);router[_0xdff8('0x7')]('/:id/subjects',auth[_0xdff8('0x8')](),controller[_0xdff8('0xe')]);router[_0xdff8('0x7')](_0xdff8('0xf'),auth[_0xdff8('0x8')](),controller[_0xdff8('0x10')]);router[_0xdff8('0x11')]('/',auth[_0xdff8('0x8')](),controller[_0xdff8('0x12')]);router['put'](_0xdff8('0xa'),auth[_0xdff8('0x8')](),controller[_0xdff8('0x13')]);router[_0xdff8('0x14')](_0xdff8('0xa'),auth[_0xdff8('0x8')](),controller[_0xdff8('0x15')]);module[_0xdff8('0x16')]=router;
\ No newline at end of file
index 97c3ffe..dd3c66d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0eb2=['exports','ENUM','incident','phonecall','nothing','STRING','BOOLEAN'];(function(_0x46fcc6,_0x20aba3){var _0x35b01e=function(_0x53992c){while(--_0x53992c){_0x46fcc6['push'](_0x46fcc6['shift']());}};_0x35b01e(++_0x20aba3);}(_0x0eb2,0x7e));var _0x20eb=function(_0x28562a,_0x200c8a){_0x28562a=_0x28562a-0x0;var _0x33d715=_0x0eb2[_0x28562a];return _0x33d715;};'use strict';var Sequelize=require('sequelize');module[_0x20eb('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x20eb('0x1')](_0x20eb('0x2'),_0x20eb('0x3')),'defaultValue':_0x20eb('0x2')},'moduleCreate':{'type':Sequelize['ENUM']('contact',_0x20eb('0x4')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x20eb('0x5')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x20eb('0x6')],'defaultValue':!![]}};
\ No newline at end of file
+var _0xc2d9=['contact','nothing','BOOLEAN','sequelize','exports','STRING','ENUM','phonecall','incident'];(function(_0x574b74,_0x12d5fe){var _0x560c7c=function(_0x221f75){while(--_0x221f75){_0x574b74['push'](_0x574b74['shift']());}};_0x560c7c(++_0x12d5fe);}(_0xc2d9,0x9c));var _0x9c2d=function(_0x3f49c5,_0x2828db){_0x3f49c5=_0x3f49c5-0x0;var _0x34f3d2=_0xc2d9[_0x3f49c5];return _0x34f3d2;};'use strict';var Sequelize=require(_0x9c2d('0x0'));module[_0x9c2d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9c2d('0x2')]},'ticketType':{'type':Sequelize[_0x9c2d('0x3')]('incident',_0x9c2d('0x4')),'defaultValue':_0x9c2d('0x5')},'moduleCreate':{'type':Sequelize[_0x9c2d('0x3')](_0x9c2d('0x6'),_0x9c2d('0x7')),'defaultValue':_0x9c2d('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x9c2d('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x9c2d('0x8')],'defaultValue':!![]}};
\ No newline at end of file
index 2d44481..d75f572 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb00b=['then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','merge','where','type','VIRTUAL','filter','include','findAll','show','params','includeAll','options','catch','create','body','find','order','getFields','getSubjects','Dynamics365Field','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','update'];(function(_0x48d320,_0x4cad74){var _0x275deb=function(_0x18b614){while(--_0x18b614){_0x48d320['push'](_0x48d320['shift']());}};_0x275deb(++_0x4cad74);}(_0xb00b,0x11c));var _0xbb00=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xb00b[_0x2a6809];return _0x11c371;};'use strict';var emlformat=require(_0xbb00('0x0'));var rimraf=require(_0xbb00('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbb00('0x2'));var moment=require(_0xbb00('0x3'));var BPromise=require(_0xbb00('0x4'));var Mustache=require(_0xbb00('0x5'));var util=require(_0xbb00('0x6'));var path=require(_0xbb00('0x7'));var sox=require(_0xbb00('0x8'));var csv=require('to-csv');var ejs=require(_0xbb00('0x9'));var fs=require('fs');var fs_extra=require(_0xbb00('0xa'));var _=require('lodash');var squel=require(_0xbb00('0xb'));var crypto=require(_0xbb00('0xc'));var jsforce=require(_0xbb00('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbb00('0xe'));var Papa=require(_0xbb00('0xf'));var Redis=require('ioredis');var authService=require(_0xbb00('0x10'));var qs=require(_0xbb00('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb00('0x12'));var logger=require(_0xbb00('0x13'))(_0xbb00('0x14'));var utils=require(_0xbb00('0x15'));var config=require(_0xbb00('0x16'));var licenseUtil=require(_0xbb00('0x17'));var db=require(_0xbb00('0x18'))['db'];function respondWithStatusCode(_0x574719,_0x25806f){_0x25806f=_0x25806f||0xcc;return function(_0x1354f1){if(_0x1354f1){return _0x574719[_0xbb00('0x19')](_0x25806f);}return _0x574719[_0xbb00('0x1a')](_0x25806f)[_0xbb00('0x1b')]();};}function respondWithResult(_0x3a5304,_0x15123a){_0x15123a=_0x15123a||0xc8;return function(_0x154ca6){if(_0x154ca6){return _0x3a5304[_0xbb00('0x1a')](_0x15123a)[_0xbb00('0x1c')](_0x154ca6);}};}function respondWithFilteredResult(_0x32abfd,_0x1aed73){return function(_0x57f5c6){if(_0x57f5c6){var _0x5e9338=typeof _0x1aed73[_0xbb00('0x1d')]==='undefined'&&typeof _0x1aed73['limit']===_0xbb00('0x1e');var _0x4d787e=_0x57f5c6['count'];var _0x4bcc00=_0x5e9338?0x0:_0x1aed73[_0xbb00('0x1d')];var _0x24327f=_0x5e9338?_0x57f5c6[_0xbb00('0x1f')]:_0x1aed73[_0xbb00('0x1d')]+_0x1aed73['limit'];var _0xa21d87;if(_0x24327f>=_0x4d787e){_0x24327f=_0x4d787e;_0xa21d87=0xc8;}else{_0xa21d87=0xce;}_0x32abfd[_0xbb00('0x1a')](_0xa21d87);return _0x32abfd['set'](_0xbb00('0x20'),_0x4bcc00+'-'+_0x24327f+'/'+_0x4d787e)[_0xbb00('0x1c')](_0x57f5c6);}return null;};}function patchUpdates(_0x456669){return function(_0x102fdf){try{jsonpatch[_0xbb00('0x21')](_0x102fdf,_0x456669,!![]);}catch(_0x4de46b){return BPromise[_0xbb00('0x22')](_0x4de46b);}return _0x102fdf['save']();};}function saveUpdates(_0xe22189,_0x5228a6){return function(_0x4051b4){if(_0x4051b4){return _0x4051b4[_0xbb00('0x23')](_0xe22189)[_0xbb00('0x24')](function(_0x5e2823){return _0x5e2823;});}return null;};}function removeEntity(_0x170849,_0x1b169d){return function(_0x34a2d4){if(_0x34a2d4){return _0x34a2d4[_0xbb00('0x25')]()[_0xbb00('0x24')](function(){_0x170849[_0xbb00('0x1a')](0xcc)[_0xbb00('0x1b')]();});}};}function handleEntityNotFound(_0x2f2d99,_0x5e3926){return function(_0x48afa6){if(!_0x48afa6){_0x2f2d99['sendStatus'](0x194);}return _0x48afa6;};}function handleError(_0xbac8cd,_0x224821){_0x224821=_0x224821||0x1f4;return function(_0x5160a7){logger[_0xbb00('0x26')](_0x5160a7[_0xbb00('0x27')]);if(_0x5160a7[_0xbb00('0x28')]){delete _0x5160a7[_0xbb00('0x28')];}_0xbac8cd[_0xbb00('0x1a')](_0x224821)[_0xbb00('0x29')](_0x5160a7);};}exports[_0xbb00('0x2a')]=function(_0x416b53,_0x3c1f1f){var _0x35329d={},_0x3c29eb={},_0x1e82db={'count':0x0,'rows':[]};var _0x507b66=_[_0xbb00('0x2b')](db[_0xbb00('0x2c')][_0xbb00('0x2d')],function(_0x447522){return{'name':_0x447522['fieldName'],'type':_0x447522['type'][_0xbb00('0x2e')]};});_0x3c29eb[_0xbb00('0x2f')]=_[_0xbb00('0x2b')](_0x507b66,_0xbb00('0x28'));_0x3c29eb['query']=_[_0xbb00('0x30')](_0x416b53[_0xbb00('0x31')]);_0x3c29eb[_0xbb00('0x32')]=_[_0xbb00('0x33')](_0x3c29eb[_0xbb00('0x2f')],_0x3c29eb['query']);_0x35329d['attributes']=_[_0xbb00('0x33')](_0x3c29eb['model'],qs[_0xbb00('0x34')](_0x416b53[_0xbb00('0x31')][_0xbb00('0x34')]));_0x35329d[_0xbb00('0x35')]=_0x35329d[_0xbb00('0x35')][_0xbb00('0x36')]?_0x35329d[_0xbb00('0x35')]:_0x3c29eb['model'];if(!_0x416b53[_0xbb00('0x31')][_0xbb00('0x37')](_0xbb00('0x38'))){_0x35329d['limit']=qs[_0xbb00('0x39')](_0x416b53[_0xbb00('0x31')][_0xbb00('0x39')]);_0x35329d[_0xbb00('0x1d')]=qs['offset'](_0x416b53['query']['offset']);}_0x35329d['order']=qs[_0xbb00('0x3a')](_0x416b53[_0xbb00('0x31')][_0xbb00('0x3a')]);_0x35329d['where']=qs[_0xbb00('0x32')](_[_0xbb00('0x3b')](_0x416b53[_0xbb00('0x31')],_0x3c29eb[_0xbb00('0x32')]),_0x507b66);if(_0x416b53['query']['filter']){_0x35329d['where']=_[_0xbb00('0x3c')](_0x35329d[_0xbb00('0x3d')],{'$or':_[_0xbb00('0x2b')](_0x507b66,function(_0x20daf1){if(_0x20daf1[_0xbb00('0x3e')]!==_0xbb00('0x3f')){var _0x422cef={};_0x422cef[_0x20daf1[_0xbb00('0x28')]]={'$like':'%'+_0x416b53[_0xbb00('0x31')][_0xbb00('0x40')]+'%'};return _0x422cef;}})});}_0x35329d=_[_0xbb00('0x3c')]({},_0x35329d,_0x416b53['options']);var _0x19545d={'where':_0x35329d[_0xbb00('0x3d')]};return db[_0xbb00('0x2c')][_0xbb00('0x1f')](_0x19545d)[_0xbb00('0x24')](function(_0x3987e4){_0x1e82db[_0xbb00('0x1f')]=_0x3987e4;if(_0x416b53[_0xbb00('0x31')]['includeAll']){_0x35329d[_0xbb00('0x41')]=[{'all':!![]}];}return db[_0xbb00('0x2c')][_0xbb00('0x42')](_0x35329d);})[_0xbb00('0x24')](function(_0x578d00){_0x1e82db['rows']=_0x578d00;return _0x1e82db;})[_0xbb00('0x24')](respondWithFilteredResult(_0x3c1f1f,_0x35329d))['catch'](handleError(_0x3c1f1f,null));};exports[_0xbb00('0x43')]=function(_0x46563f,_0x4e686a){var _0x3702b8={'raw':![],'where':{'id':_0x46563f[_0xbb00('0x44')]['id']}},_0x3a1d41={};_0x3a1d41[_0xbb00('0x2f')]=_['keys'](db[_0xbb00('0x2c')][_0xbb00('0x2d')]);_0x3a1d41[_0xbb00('0x31')]=_[_0xbb00('0x30')](_0x46563f[_0xbb00('0x31')]);_0x3a1d41[_0xbb00('0x32')]=_[_0xbb00('0x33')](_0x3a1d41[_0xbb00('0x2f')],_0x3a1d41[_0xbb00('0x31')]);_0x3702b8[_0xbb00('0x35')]=_[_0xbb00('0x33')](_0x3a1d41[_0xbb00('0x2f')],qs[_0xbb00('0x34')](_0x46563f[_0xbb00('0x31')][_0xbb00('0x34')]));_0x3702b8[_0xbb00('0x35')]=_0x3702b8[_0xbb00('0x35')][_0xbb00('0x36')]?_0x3702b8[_0xbb00('0x35')]:_0x3a1d41[_0xbb00('0x2f')];if(_0x46563f[_0xbb00('0x31')][_0xbb00('0x45')]){_0x3702b8[_0xbb00('0x41')]=[{'all':!![]}];}_0x3702b8=_['merge']({},_0x3702b8,_0x46563f[_0xbb00('0x46')]);return db[_0xbb00('0x2c')]['find'](_0x3702b8)['then'](handleEntityNotFound(_0x4e686a,null))[_0xbb00('0x24')](respondWithResult(_0x4e686a,null))[_0xbb00('0x47')](handleError(_0x4e686a,null));};exports[_0xbb00('0x48')]=function(_0x23a9ad,_0x25db82){return db[_0xbb00('0x2c')][_0xbb00('0x48')](_0x23a9ad[_0xbb00('0x49')],{})[_0xbb00('0x24')](respondWithResult(_0x25db82,0xc9))[_0xbb00('0x47')](handleError(_0x25db82,null));};exports[_0xbb00('0x23')]=function(_0x59875f,_0x4c81b4){if(_0x59875f[_0xbb00('0x49')]['id']){delete _0x59875f[_0xbb00('0x49')]['id'];}return db[_0xbb00('0x2c')]['find']({'where':{'id':_0x59875f[_0xbb00('0x44')]['id']}})[_0xbb00('0x24')](handleEntityNotFound(_0x4c81b4,null))[_0xbb00('0x24')](saveUpdates(_0x59875f['body'],null))['then'](respondWithResult(_0x4c81b4,null))[_0xbb00('0x47')](handleError(_0x4c81b4,null));};exports[_0xbb00('0x25')]=function(_0x3444ab,_0x373005){return db['Dynamics365Configuration'][_0xbb00('0x4a')]({'where':{'id':_0x3444ab[_0xbb00('0x44')]['id']}})[_0xbb00('0x24')](handleEntityNotFound(_0x373005,null))[_0xbb00('0x24')](removeEntity(_0x373005,null))[_0xbb00('0x47')](handleError(_0x373005,null));};exports['getFields']=function(_0x12928a,_0x57ad62,_0x211d0f){var _0x3764c2={};var _0x49a123={};var _0x4659a4;var _0x143716;return db[_0xbb00('0x2c')]['findOne']({'where':{'id':_0x12928a[_0xbb00('0x44')]['id']}})[_0xbb00('0x24')](handleEntityNotFound(_0x57ad62,null))['then'](function(_0x173e18){if(_0x173e18){_0x4659a4=_0x173e18;_0x49a123['model']=_[_0xbb00('0x30')](db['Dynamics365Field'][_0xbb00('0x2d')]);_0x49a123[_0xbb00('0x31')]=_[_0xbb00('0x30')](_0x12928a[_0xbb00('0x31')]);_0x49a123[_0xbb00('0x32')]=_[_0xbb00('0x33')](_0x49a123[_0xbb00('0x2f')],_0x49a123[_0xbb00('0x31')]);_0x3764c2[_0xbb00('0x35')]=_[_0xbb00('0x33')](_0x49a123[_0xbb00('0x2f')],qs['fields'](_0x12928a[_0xbb00('0x31')]['fields']));_0x3764c2['attributes']=_0x3764c2[_0xbb00('0x35')][_0xbb00('0x36')]?_0x3764c2[_0xbb00('0x35')]:_0x49a123[_0xbb00('0x2f')];_0x3764c2[_0xbb00('0x4b')]=qs[_0xbb00('0x3a')](_0x12928a[_0xbb00('0x31')][_0xbb00('0x3a')]);_0x3764c2['where']=qs['filters'](_[_0xbb00('0x3b')](_0x12928a['query'],_0x49a123[_0xbb00('0x32')]));if(_0x12928a[_0xbb00('0x31')][_0xbb00('0x40')]){_0x3764c2['where']=_[_0xbb00('0x3c')](_0x3764c2[_0xbb00('0x3d')],{'$or':_['map'](_0x3764c2[_0xbb00('0x35')],function(_0x54ac84){var _0x3eb6c6={};_0x3eb6c6[_0x54ac84]={'$like':'%'+_0x12928a[_0xbb00('0x31')]['filter']+'%'};return _0x3eb6c6;})});}_0x3764c2=_['merge']({},_0x3764c2,_0x12928a[_0xbb00('0x46')]);return _0x4659a4[_0xbb00('0x4c')](_0x3764c2);}})[_0xbb00('0x24')](function(_0x570977){if(_0x570977){_0x143716=_0x570977['length'];if(!_0x12928a[_0xbb00('0x31')][_0xbb00('0x37')]('nolimit')){_0x3764c2[_0xbb00('0x39')]=qs[_0xbb00('0x39')](_0x12928a['query'][_0xbb00('0x39')]);_0x3764c2[_0xbb00('0x1d')]=qs[_0xbb00('0x1d')](_0x12928a['query'][_0xbb00('0x1d')]);}return _0x4659a4[_0xbb00('0x4c')](_0x3764c2);}})[_0xbb00('0x24')](function(_0x5ecc6d){if(_0x5ecc6d){return _0x5ecc6d?{'count':_0x143716,'rows':_0x5ecc6d}:null;}})[_0xbb00('0x24')](respondWithResult(_0x57ad62,null))['catch'](handleError(_0x57ad62,null));};exports[_0xbb00('0x4d')]=function(_0x21bf9d,_0x6b62ca,_0x43afe5){var _0x3a5d80={};var _0x5b9e75={};var _0x3456d7;var _0x31e9ea;return db[_0xbb00('0x2c')]['findOne']({'where':{'id':_0x21bf9d[_0xbb00('0x44')]['id']}})[_0xbb00('0x24')](handleEntityNotFound(_0x6b62ca,null))[_0xbb00('0x24')](function(_0x4b007d){if(_0x4b007d){_0x3456d7=_0x4b007d;_0x5b9e75['model']=_[_0xbb00('0x30')](db[_0xbb00('0x4e')][_0xbb00('0x2d')]);_0x5b9e75[_0xbb00('0x31')]=_[_0xbb00('0x30')](_0x21bf9d[_0xbb00('0x31')]);_0x5b9e75[_0xbb00('0x32')]=_[_0xbb00('0x33')](_0x5b9e75[_0xbb00('0x2f')],_0x5b9e75[_0xbb00('0x31')]);_0x3a5d80[_0xbb00('0x35')]=_[_0xbb00('0x33')](_0x5b9e75[_0xbb00('0x2f')],qs[_0xbb00('0x34')](_0x21bf9d[_0xbb00('0x31')][_0xbb00('0x34')]));_0x3a5d80[_0xbb00('0x35')]=_0x3a5d80[_0xbb00('0x35')][_0xbb00('0x36')]?_0x3a5d80[_0xbb00('0x35')]:_0x5b9e75[_0xbb00('0x2f')];_0x3a5d80['order']=qs[_0xbb00('0x3a')](_0x21bf9d[_0xbb00('0x31')]['sort']);_0x3a5d80[_0xbb00('0x3d')]=qs[_0xbb00('0x32')](_[_0xbb00('0x3b')](_0x21bf9d[_0xbb00('0x31')],_0x5b9e75[_0xbb00('0x32')]));if(_0x21bf9d['query'][_0xbb00('0x40')]){_0x3a5d80['where']=_['merge'](_0x3a5d80['where'],{'$or':_[_0xbb00('0x2b')](_0x3a5d80[_0xbb00('0x35')],function(_0x30f313){var _0x158cee={};_0x158cee[_0x30f313]={'$like':'%'+_0x21bf9d[_0xbb00('0x31')][_0xbb00('0x40')]+'%'};return _0x158cee;})});}_0x3a5d80=_[_0xbb00('0x3c')]({},_0x3a5d80,_0x21bf9d[_0xbb00('0x46')]);return _0x3456d7[_0xbb00('0x4d')](_0x3a5d80);}})[_0xbb00('0x24')](function(_0x290e99){if(_0x290e99){_0x31e9ea=_0x290e99['length'];if(!_0x21bf9d['query'][_0xbb00('0x37')]('nolimit')){_0x3a5d80['limit']=qs[_0xbb00('0x39')](_0x21bf9d[_0xbb00('0x31')][_0xbb00('0x39')]);_0x3a5d80[_0xbb00('0x1d')]=qs[_0xbb00('0x1d')](_0x21bf9d['query'][_0xbb00('0x1d')]);}return _0x3456d7[_0xbb00('0x4d')](_0x3a5d80);}})['then'](function(_0x6b5d9f){if(_0x6b5d9f){return _0x6b5d9f?{'count':_0x31e9ea,'rows':_0x6b5d9f}:null;}})['then'](respondWithResult(_0x6b62ca,null))['catch'](handleError(_0x6b62ca,null));};exports[_0xbb00('0x4f')]=function(_0x589d8f,_0x29400a,_0x433db9){var _0x1f8330={};var _0x45f976={};var _0x2b3fb0;var _0x5d813e;return db[_0xbb00('0x2c')]['findOne']({'where':{'id':_0x589d8f[_0xbb00('0x44')]['id']}})[_0xbb00('0x24')](handleEntityNotFound(_0x29400a,null))[_0xbb00('0x24')](function(_0x5847b1){if(_0x5847b1){_0x2b3fb0=_0x5847b1;_0x45f976[_0xbb00('0x2f')]=_[_0xbb00('0x30')](db[_0xbb00('0x4e')][_0xbb00('0x2d')]);_0x45f976[_0xbb00('0x31')]=_['keys'](_0x589d8f[_0xbb00('0x31')]);_0x45f976['filters']=_['intersection'](_0x45f976[_0xbb00('0x2f')],_0x45f976[_0xbb00('0x31')]);_0x1f8330[_0xbb00('0x35')]=_[_0xbb00('0x33')](_0x45f976[_0xbb00('0x2f')],qs[_0xbb00('0x34')](_0x589d8f['query'][_0xbb00('0x34')]));_0x1f8330[_0xbb00('0x35')]=_0x1f8330[_0xbb00('0x35')][_0xbb00('0x36')]?_0x1f8330[_0xbb00('0x35')]:_0x45f976[_0xbb00('0x2f')];_0x1f8330['order']=qs[_0xbb00('0x3a')](_0x589d8f[_0xbb00('0x31')][_0xbb00('0x3a')]);_0x1f8330[_0xbb00('0x3d')]=qs['filters'](_[_0xbb00('0x3b')](_0x589d8f[_0xbb00('0x31')],_0x45f976['filters']));if(_0x589d8f[_0xbb00('0x31')][_0xbb00('0x40')]){_0x1f8330[_0xbb00('0x3d')]=_[_0xbb00('0x3c')](_0x1f8330[_0xbb00('0x3d')],{'$or':_[_0xbb00('0x2b')](_0x1f8330[_0xbb00('0x35')],function(_0x332729){var _0x27a68c={};_0x27a68c[_0x332729]={'$like':'%'+_0x589d8f[_0xbb00('0x31')][_0xbb00('0x40')]+'%'};return _0x27a68c;})});}_0x1f8330=_[_0xbb00('0x3c')]({},_0x1f8330,_0x589d8f[_0xbb00('0x46')]);return _0x2b3fb0[_0xbb00('0x4f')](_0x1f8330);}})[_0xbb00('0x24')](function(_0xec7297){if(_0xec7297){_0x5d813e=_0xec7297[_0xbb00('0x36')];if(!_0x589d8f[_0xbb00('0x31')][_0xbb00('0x37')](_0xbb00('0x38'))){_0x1f8330[_0xbb00('0x39')]=qs[_0xbb00('0x39')](_0x589d8f[_0xbb00('0x31')][_0xbb00('0x39')]);_0x1f8330[_0xbb00('0x1d')]=qs[_0xbb00('0x1d')](_0x589d8f[_0xbb00('0x31')][_0xbb00('0x1d')]);}return _0x2b3fb0[_0xbb00('0x4f')](_0x1f8330);}})[_0xbb00('0x24')](function(_0x588081){if(_0x588081){return _0x588081?{'count':_0x5d813e,'rows':_0x588081}:null;}})[_0xbb00('0x24')](respondWithResult(_0x29400a,null))[_0xbb00('0x47')](handleError(_0x29400a,null));};
\ No newline at end of file
+var _0xea35=['merge','then','includeAll','include','params','options','find','catch','create','body','update','getFields','findOne','getSubjects','Dynamics365Field','order','getDescriptions','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','destroy','end','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','VIRTUAL','filter'];(function(_0x331298,_0x12341a){var _0x3824bc=function(_0x19449f){while(--_0x19449f){_0x331298['push'](_0x331298['shift']());}};_0x3824bc(++_0x12341a);}(_0xea35,0x1d4));var _0x5ea3=function(_0x1ada3a,_0x2661fc){_0x1ada3a=_0x1ada3a-0x0;var _0x317063=_0xea35[_0x1ada3a];return _0x317063;};'use strict';var emlformat=require(_0x5ea3('0x0'));var rimraf=require(_0x5ea3('0x1'));var zipdir=require(_0x5ea3('0x2'));var jsonpatch=require(_0x5ea3('0x3'));var rp=require(_0x5ea3('0x4'));var moment=require(_0x5ea3('0x5'));var BPromise=require(_0x5ea3('0x6'));var Mustache=require(_0x5ea3('0x7'));var util=require('util');var path=require(_0x5ea3('0x8'));var sox=require(_0x5ea3('0x9'));var csv=require('to-csv');var ejs=require(_0x5ea3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5ea3('0xb'));var squel=require('squel');var crypto=require(_0x5ea3('0xc'));var jsforce=require(_0x5ea3('0xd'));var deskjs=require(_0x5ea3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x5ea3('0xf'));var Papa=require('papaparse');var Redis=require(_0x5ea3('0x10'));var authService=require(_0x5ea3('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5ea3('0x12'));var logger=require('../../config/logger')(_0x5ea3('0x13'));var utils=require('../../config/utils');var config=require(_0x5ea3('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x245ccd,_0x55af13){_0x55af13=_0x55af13||0xcc;return function(_0x249f19){if(_0x249f19){return _0x245ccd['sendStatus'](_0x55af13);}return _0x245ccd[_0x5ea3('0x15')](_0x55af13)['end']();};}function respondWithResult(_0xfc26e2,_0x4bb7f0){_0x4bb7f0=_0x4bb7f0||0xc8;return function(_0x5c9b22){if(_0x5c9b22){return _0xfc26e2[_0x5ea3('0x15')](_0x4bb7f0)[_0x5ea3('0x16')](_0x5c9b22);}};}function respondWithFilteredResult(_0x4ebe03,_0x1f5347){return function(_0x5b4e58){if(_0x5b4e58){var _0x791f24=typeof _0x1f5347[_0x5ea3('0x17')]==='undefined'&&typeof _0x1f5347[_0x5ea3('0x18')]===_0x5ea3('0x19');var _0x402bed=_0x5b4e58[_0x5ea3('0x1a')];var _0x12819f=_0x791f24?0x0:_0x1f5347[_0x5ea3('0x17')];var _0x5ab4aa=_0x791f24?_0x5b4e58[_0x5ea3('0x1a')]:_0x1f5347[_0x5ea3('0x17')]+_0x1f5347[_0x5ea3('0x18')];var _0x2dc2ef;if(_0x5ab4aa>=_0x402bed){_0x5ab4aa=_0x402bed;_0x2dc2ef=0xc8;}else{_0x2dc2ef=0xce;}_0x4ebe03['status'](_0x2dc2ef);return _0x4ebe03[_0x5ea3('0x1b')](_0x5ea3('0x1c'),_0x12819f+'-'+_0x5ab4aa+'/'+_0x402bed)[_0x5ea3('0x16')](_0x5b4e58);}return null;};}function patchUpdates(_0x54d725){return function(_0x2a117e){try{jsonpatch['apply'](_0x2a117e,_0x54d725,!![]);}catch(_0x200783){return BPromise[_0x5ea3('0x1d')](_0x200783);}return _0x2a117e[_0x5ea3('0x1e')]();};}function saveUpdates(_0x40a1d5,_0x4fe0f8){return function(_0x35550c){if(_0x35550c){return _0x35550c['update'](_0x40a1d5)['then'](function(_0x1f2434){return _0x1f2434;});}return null;};}function removeEntity(_0x53f5c3,_0x3b734a){return function(_0x2d21ff){if(_0x2d21ff){return _0x2d21ff[_0x5ea3('0x1f')]()['then'](function(){_0x53f5c3[_0x5ea3('0x15')](0xcc)[_0x5ea3('0x20')]();});}};}function handleEntityNotFound(_0xc2cb4c,_0x352930){return function(_0x30c1d3){if(!_0x30c1d3){_0xc2cb4c['sendStatus'](0x194);}return _0x30c1d3;};}function handleError(_0x125cb5,_0x510c1a){_0x510c1a=_0x510c1a||0x1f4;return function(_0xe7ab2e){logger[_0x5ea3('0x21')](_0xe7ab2e['stack']);if(_0xe7ab2e['name']){delete _0xe7ab2e[_0x5ea3('0x22')];}_0x125cb5['status'](_0x510c1a)[_0x5ea3('0x23')](_0xe7ab2e);};}exports[_0x5ea3('0x24')]=function(_0x4c766c,_0x43805d){var _0xeb9dc8={},_0x24e885={},_0x335253={'count':0x0,'rows':[]};var _0x30c97b=_[_0x5ea3('0x25')](db[_0x5ea3('0x26')][_0x5ea3('0x27')],function(_0x38019e){return{'name':_0x38019e[_0x5ea3('0x28')],'type':_0x38019e[_0x5ea3('0x29')][_0x5ea3('0x2a')]};});_0x24e885[_0x5ea3('0x2b')]=_['map'](_0x30c97b,_0x5ea3('0x22'));_0x24e885[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x4c766c['query']);_0x24e885[_0x5ea3('0x2e')]=_[_0x5ea3('0x2f')](_0x24e885[_0x5ea3('0x2b')],_0x24e885['query']);_0xeb9dc8[_0x5ea3('0x30')]=_['intersection'](_0x24e885['model'],qs[_0x5ea3('0x31')](_0x4c766c['query'][_0x5ea3('0x31')]));_0xeb9dc8[_0x5ea3('0x30')]=_0xeb9dc8[_0x5ea3('0x30')][_0x5ea3('0x32')]?_0xeb9dc8[_0x5ea3('0x30')]:_0x24e885[_0x5ea3('0x2b')];if(!_0x4c766c[_0x5ea3('0x2c')]['hasOwnProperty'](_0x5ea3('0x33'))){_0xeb9dc8[_0x5ea3('0x18')]=qs[_0x5ea3('0x18')](_0x4c766c[_0x5ea3('0x2c')][_0x5ea3('0x18')]);_0xeb9dc8[_0x5ea3('0x17')]=qs[_0x5ea3('0x17')](_0x4c766c[_0x5ea3('0x2c')]['offset']);}_0xeb9dc8['order']=qs[_0x5ea3('0x34')](_0x4c766c[_0x5ea3('0x2c')]['sort']);_0xeb9dc8[_0x5ea3('0x35')]=qs[_0x5ea3('0x2e')](_[_0x5ea3('0x36')](_0x4c766c[_0x5ea3('0x2c')],_0x24e885['filters']),_0x30c97b);if(_0x4c766c['query']['filter']){_0xeb9dc8[_0x5ea3('0x35')]=_['merge'](_0xeb9dc8[_0x5ea3('0x35')],{'$or':_[_0x5ea3('0x25')](_0x30c97b,function(_0x403cf9){if(_0x403cf9[_0x5ea3('0x29')]!==_0x5ea3('0x37')){var _0x5181a7={};_0x5181a7[_0x403cf9[_0x5ea3('0x22')]]={'$like':'%'+_0x4c766c[_0x5ea3('0x2c')][_0x5ea3('0x38')]+'%'};return _0x5181a7;}})});}_0xeb9dc8=_[_0x5ea3('0x39')]({},_0xeb9dc8,_0x4c766c['options']);var _0x29b896={'where':_0xeb9dc8['where']};return db[_0x5ea3('0x26')]['count'](_0x29b896)[_0x5ea3('0x3a')](function(_0x3f8841){_0x335253['count']=_0x3f8841;if(_0x4c766c['query'][_0x5ea3('0x3b')]){_0xeb9dc8[_0x5ea3('0x3c')]=[{'all':!![]}];}return db['Dynamics365Configuration']['findAll'](_0xeb9dc8);})['then'](function(_0x156ac4){_0x335253['rows']=_0x156ac4;return _0x335253;})[_0x5ea3('0x3a')](respondWithFilteredResult(_0x43805d,_0xeb9dc8))['catch'](handleError(_0x43805d,null));};exports['show']=function(_0x495498,_0xe53ffa){var _0x55415d={'raw':![],'where':{'id':_0x495498[_0x5ea3('0x3d')]['id']}},_0x949c39={};_0x949c39[_0x5ea3('0x2b')]=_[_0x5ea3('0x2d')](db['Dynamics365Configuration']['rawAttributes']);_0x949c39[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x495498[_0x5ea3('0x2c')]);_0x949c39[_0x5ea3('0x2e')]=_[_0x5ea3('0x2f')](_0x949c39[_0x5ea3('0x2b')],_0x949c39[_0x5ea3('0x2c')]);_0x55415d[_0x5ea3('0x30')]=_[_0x5ea3('0x2f')](_0x949c39['model'],qs[_0x5ea3('0x31')](_0x495498[_0x5ea3('0x2c')][_0x5ea3('0x31')]));_0x55415d[_0x5ea3('0x30')]=_0x55415d['attributes']['length']?_0x55415d[_0x5ea3('0x30')]:_0x949c39['model'];if(_0x495498[_0x5ea3('0x2c')][_0x5ea3('0x3b')]){_0x55415d['include']=[{'all':!![]}];}_0x55415d=_[_0x5ea3('0x39')]({},_0x55415d,_0x495498[_0x5ea3('0x3e')]);return db[_0x5ea3('0x26')][_0x5ea3('0x3f')](_0x55415d)[_0x5ea3('0x3a')](handleEntityNotFound(_0xe53ffa,null))[_0x5ea3('0x3a')](respondWithResult(_0xe53ffa,null))[_0x5ea3('0x40')](handleError(_0xe53ffa,null));};exports['create']=function(_0x31c1a,_0x3047ac){return db[_0x5ea3('0x26')][_0x5ea3('0x41')](_0x31c1a[_0x5ea3('0x42')],{})['then'](respondWithResult(_0x3047ac,0xc9))['catch'](handleError(_0x3047ac,null));};exports[_0x5ea3('0x43')]=function(_0x1886a2,_0x3c4882){if(_0x1886a2[_0x5ea3('0x42')]['id']){delete _0x1886a2[_0x5ea3('0x42')]['id'];}return db['Dynamics365Configuration']['find']({'where':{'id':_0x1886a2['params']['id']}})[_0x5ea3('0x3a')](handleEntityNotFound(_0x3c4882,null))[_0x5ea3('0x3a')](saveUpdates(_0x1886a2['body'],null))[_0x5ea3('0x3a')](respondWithResult(_0x3c4882,null))[_0x5ea3('0x40')](handleError(_0x3c4882,null));};exports['destroy']=function(_0x3bb75d,_0x2d5bfe){return db[_0x5ea3('0x26')][_0x5ea3('0x3f')]({'where':{'id':_0x3bb75d['params']['id']}})['then'](handleEntityNotFound(_0x2d5bfe,null))['then'](removeEntity(_0x2d5bfe,null))[_0x5ea3('0x40')](handleError(_0x2d5bfe,null));};exports[_0x5ea3('0x44')]=function(_0x459597,_0x233ae1,_0x5acf25){var _0x10e8c0={};var _0x1dac34={};var _0x2ac5d4;var _0xd0ad5d;return db[_0x5ea3('0x26')][_0x5ea3('0x45')]({'where':{'id':_0x459597[_0x5ea3('0x3d')]['id']}})[_0x5ea3('0x3a')](handleEntityNotFound(_0x233ae1,null))[_0x5ea3('0x3a')](function(_0x32fd2e){if(_0x32fd2e){_0x2ac5d4=_0x32fd2e;_0x1dac34['model']=_[_0x5ea3('0x2d')](db['Dynamics365Field'][_0x5ea3('0x27')]);_0x1dac34[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x459597[_0x5ea3('0x2c')]);_0x1dac34[_0x5ea3('0x2e')]=_[_0x5ea3('0x2f')](_0x1dac34[_0x5ea3('0x2b')],_0x1dac34[_0x5ea3('0x2c')]);_0x10e8c0[_0x5ea3('0x30')]=_['intersection'](_0x1dac34['model'],qs[_0x5ea3('0x31')](_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x31')]));_0x10e8c0[_0x5ea3('0x30')]=_0x10e8c0[_0x5ea3('0x30')]['length']?_0x10e8c0[_0x5ea3('0x30')]:_0x1dac34['model'];_0x10e8c0['order']=qs['sort'](_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x34')]);_0x10e8c0[_0x5ea3('0x35')]=qs[_0x5ea3('0x2e')](_[_0x5ea3('0x36')](_0x459597[_0x5ea3('0x2c')],_0x1dac34[_0x5ea3('0x2e')]));if(_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x38')]){_0x10e8c0[_0x5ea3('0x35')]=_[_0x5ea3('0x39')](_0x10e8c0['where'],{'$or':_['map'](_0x10e8c0[_0x5ea3('0x30')],function(_0x3cfcac){var _0x584264={};_0x584264[_0x3cfcac]={'$like':'%'+_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x38')]+'%'};return _0x584264;})});}_0x10e8c0=_[_0x5ea3('0x39')]({},_0x10e8c0,_0x459597[_0x5ea3('0x3e')]);return _0x2ac5d4['getFields'](_0x10e8c0);}})[_0x5ea3('0x3a')](function(_0x3544ff){if(_0x3544ff){_0xd0ad5d=_0x3544ff['length'];if(!_0x459597['query']['hasOwnProperty'](_0x5ea3('0x33'))){_0x10e8c0[_0x5ea3('0x18')]=qs[_0x5ea3('0x18')](_0x459597['query'][_0x5ea3('0x18')]);_0x10e8c0[_0x5ea3('0x17')]=qs[_0x5ea3('0x17')](_0x459597[_0x5ea3('0x2c')][_0x5ea3('0x17')]);}return _0x2ac5d4[_0x5ea3('0x44')](_0x10e8c0);}})['then'](function(_0x50d75e){if(_0x50d75e){return _0x50d75e?{'count':_0xd0ad5d,'rows':_0x50d75e}:null;}})[_0x5ea3('0x3a')](respondWithResult(_0x233ae1,null))[_0x5ea3('0x40')](handleError(_0x233ae1,null));};exports[_0x5ea3('0x46')]=function(_0x42135a,_0x5791f0,_0x2569c7){var _0x54f426={};var _0x55b90d={};var _0x48b9f7;var _0x4fd84d;return db['Dynamics365Configuration'][_0x5ea3('0x45')]({'where':{'id':_0x42135a['params']['id']}})[_0x5ea3('0x3a')](handleEntityNotFound(_0x5791f0,null))['then'](function(_0x24dcb1){if(_0x24dcb1){_0x48b9f7=_0x24dcb1;_0x55b90d[_0x5ea3('0x2b')]=_[_0x5ea3('0x2d')](db[_0x5ea3('0x47')][_0x5ea3('0x27')]);_0x55b90d[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x42135a['query']);_0x55b90d[_0x5ea3('0x2e')]=_[_0x5ea3('0x2f')](_0x55b90d[_0x5ea3('0x2b')],_0x55b90d[_0x5ea3('0x2c')]);_0x54f426['attributes']=_[_0x5ea3('0x2f')](_0x55b90d['model'],qs[_0x5ea3('0x31')](_0x42135a[_0x5ea3('0x2c')]['fields']));_0x54f426[_0x5ea3('0x30')]=_0x54f426[_0x5ea3('0x30')][_0x5ea3('0x32')]?_0x54f426['attributes']:_0x55b90d[_0x5ea3('0x2b')];_0x54f426[_0x5ea3('0x48')]=qs[_0x5ea3('0x34')](_0x42135a[_0x5ea3('0x2c')][_0x5ea3('0x34')]);_0x54f426[_0x5ea3('0x35')]=qs[_0x5ea3('0x2e')](_[_0x5ea3('0x36')](_0x42135a[_0x5ea3('0x2c')],_0x55b90d['filters']));if(_0x42135a['query'][_0x5ea3('0x38')]){_0x54f426[_0x5ea3('0x35')]=_['merge'](_0x54f426[_0x5ea3('0x35')],{'$or':_[_0x5ea3('0x25')](_0x54f426['attributes'],function(_0x2d88a4){var _0x243d97={};_0x243d97[_0x2d88a4]={'$like':'%'+_0x42135a[_0x5ea3('0x2c')][_0x5ea3('0x38')]+'%'};return _0x243d97;})});}_0x54f426=_[_0x5ea3('0x39')]({},_0x54f426,_0x42135a['options']);return _0x48b9f7[_0x5ea3('0x46')](_0x54f426);}})[_0x5ea3('0x3a')](function(_0x22c43d){if(_0x22c43d){_0x4fd84d=_0x22c43d[_0x5ea3('0x32')];if(!_0x42135a[_0x5ea3('0x2c')]['hasOwnProperty'](_0x5ea3('0x33'))){_0x54f426[_0x5ea3('0x18')]=qs['limit'](_0x42135a['query'][_0x5ea3('0x18')]);_0x54f426['offset']=qs[_0x5ea3('0x17')](_0x42135a[_0x5ea3('0x2c')][_0x5ea3('0x17')]);}return _0x48b9f7[_0x5ea3('0x46')](_0x54f426);}})[_0x5ea3('0x3a')](function(_0x2a55f8){if(_0x2a55f8){return _0x2a55f8?{'count':_0x4fd84d,'rows':_0x2a55f8}:null;}})[_0x5ea3('0x3a')](respondWithResult(_0x5791f0,null))['catch'](handleError(_0x5791f0,null));};exports[_0x5ea3('0x49')]=function(_0x230c16,_0x5bd0f8,_0x5328f4){var _0x397e6f={};var _0x50f2f7={};var _0x142c29;var _0x4a73c3;return db[_0x5ea3('0x26')]['findOne']({'where':{'id':_0x230c16[_0x5ea3('0x3d')]['id']}})[_0x5ea3('0x3a')](handleEntityNotFound(_0x5bd0f8,null))[_0x5ea3('0x3a')](function(_0x1efbfe){if(_0x1efbfe){_0x142c29=_0x1efbfe;_0x50f2f7[_0x5ea3('0x2b')]=_[_0x5ea3('0x2d')](db[_0x5ea3('0x47')]['rawAttributes']);_0x50f2f7[_0x5ea3('0x2c')]=_[_0x5ea3('0x2d')](_0x230c16[_0x5ea3('0x2c')]);_0x50f2f7['filters']=_[_0x5ea3('0x2f')](_0x50f2f7[_0x5ea3('0x2b')],_0x50f2f7[_0x5ea3('0x2c')]);_0x397e6f['attributes']=_['intersection'](_0x50f2f7['model'],qs[_0x5ea3('0x31')](_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x31')]));_0x397e6f['attributes']=_0x397e6f['attributes'][_0x5ea3('0x32')]?_0x397e6f[_0x5ea3('0x30')]:_0x50f2f7['model'];_0x397e6f['order']=qs[_0x5ea3('0x34')](_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x34')]);_0x397e6f[_0x5ea3('0x35')]=qs[_0x5ea3('0x2e')](_[_0x5ea3('0x36')](_0x230c16[_0x5ea3('0x2c')],_0x50f2f7[_0x5ea3('0x2e')]));if(_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x38')]){_0x397e6f[_0x5ea3('0x35')]=_[_0x5ea3('0x39')](_0x397e6f[_0x5ea3('0x35')],{'$or':_[_0x5ea3('0x25')](_0x397e6f['attributes'],function(_0x15d23f){var _0x3deaeb={};_0x3deaeb[_0x15d23f]={'$like':'%'+_0x230c16['query'][_0x5ea3('0x38')]+'%'};return _0x3deaeb;})});}_0x397e6f=_[_0x5ea3('0x39')]({},_0x397e6f,_0x230c16[_0x5ea3('0x3e')]);return _0x142c29[_0x5ea3('0x49')](_0x397e6f);}})[_0x5ea3('0x3a')](function(_0x2d147b){if(_0x2d147b){_0x4a73c3=_0x2d147b['length'];if(!_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x4a')]('nolimit')){_0x397e6f[_0x5ea3('0x18')]=qs['limit'](_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x18')]);_0x397e6f[_0x5ea3('0x17')]=qs[_0x5ea3('0x17')](_0x230c16[_0x5ea3('0x2c')][_0x5ea3('0x17')]);}return _0x142c29[_0x5ea3('0x49')](_0x397e6f);}})[_0x5ea3('0x3a')](function(_0x279631){if(_0x279631){return _0x279631?{'count':_0x4a73c3,'rows':_0x279631}:null;}})['then'](respondWithResult(_0x5bd0f8,null))['catch'](handleError(_0x5bd0f8,null));};
\ No newline at end of file
index abed99d..55a78d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x262f0b,_0xba63c5){var _0x993ee3=function(_0xc422da){while(--_0xc422da){_0x262f0b['push'](_0x262f0b['shift']());}};_0x993ee3(++_0xba63c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x41ecab,_0x4f4f9e){var _0x3df461=function(_0x48a69a){while(--_0x48a69a){_0x41ecab['push'](_0x41ecab['shift']());}};_0x3df461(++_0x4f4f9e);}(_0xaa88,0x137));var _0x8aa8=function(_0x9b2bb0,_0x3965b1){_0x9b2bb0=_0x9b2bb0-0x0;var _0x2cdb3b=_0xaa88[_0x9b2bb0];return _0x2cdb3b;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6cfe17c..37f496b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe5c=['request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0xbe5c,0xfd));var _0xcbe5=function(_0x253248,_0x509f2b){_0x253248=_0x253248-0x0;var _0x3ef8c8=_0xbe5c[_0x253248];return _0x3ef8c8;};'use strict';var _=require(_0xcbe5('0x0'));var util=require('util');var moment=require(_0xcbe5('0x1'));var BPromise=require(_0xcbe5('0x2'));var rs=require(_0xcbe5('0x3'));var fs=require('fs');var Redis=require(_0xcbe5('0x4'));var db=require(_0xcbe5('0x5'))['db'];var utils=require(_0xcbe5('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xcbe5('0x7'));var jayson=require(_0xcbe5('0x8'));var client=jayson[_0xcbe5('0x9')][_0xcbe5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5743f9,_0x157bd2,_0x232685){return new BPromise(function(_0x1bc923,_0x152c18){return client[_0xcbe5('0xb')](_0x5743f9,_0x232685)[_0xcbe5('0xc')](function(_0x142757){logger[_0xcbe5('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x157bd2,_0xcbe5('0xe'));logger[_0xcbe5('0xf')](_0xcbe5('0x10'),_0x157bd2,_0xcbe5('0xe'),JSON[_0xcbe5('0x11')](_0x142757));if(_0x142757[_0xcbe5('0x12')]){if(_0x142757[_0xcbe5('0x12')][_0xcbe5('0x13')]===0x1f4){logger['error'](_0xcbe5('0x14'),_0x157bd2,_0x142757[_0xcbe5('0x12')][_0xcbe5('0x15')]);return _0x152c18(_0x142757['error'][_0xcbe5('0x15')]);}logger[_0xcbe5('0x12')](_0xcbe5('0x14'),_0x157bd2,_0x142757[_0xcbe5('0x12')][_0xcbe5('0x15')]);return _0x1bc923(_0x142757['error'][_0xcbe5('0x15')]);}else{logger[_0xcbe5('0xd')](_0xcbe5('0x14'),_0x157bd2,_0xcbe5('0xe'));_0x1bc923(_0x142757['result'][_0xcbe5('0x15')]);}})['catch'](function(_0x5e0a60){logger['error'](_0xcbe5('0x14'),_0x157bd2,_0x5e0a60);_0x152c18(_0x5e0a60);});});}
\ No newline at end of file
+var _0x9325=['stringify','error','code','message','Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x9325,0x13b));var _0x5932=function(_0x4c05b4,_0x18273a){_0x4c05b4=_0x4c05b4-0x0;var _0x1d4fdf=_0x9325[_0x4c05b4];return _0x1d4fdf;};'use strict';var _=require(_0x5932('0x0'));var util=require(_0x5932('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5932('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5932('0x3'))['db'];var utils=require(_0x5932('0x4'));var logger=require(_0x5932('0x5'))(_0x5932('0x6'));var config=require(_0x5932('0x7'));var jayson=require(_0x5932('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1bbbfc,_0x1d97ea,_0x1bdca4){return new BPromise(function(_0x4295bf,_0x27dffa){return client[_0x5932('0x9')](_0x1bbbfc,_0x1bdca4)[_0x5932('0xa')](function(_0x56376d){logger[_0x5932('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1d97ea,_0x5932('0xc'));logger[_0x5932('0xd')](_0x5932('0xe'),_0x1d97ea,_0x5932('0xc'),JSON[_0x5932('0xf')](_0x56376d));if(_0x56376d[_0x5932('0x10')]){if(_0x56376d[_0x5932('0x10')][_0x5932('0x11')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x1d97ea,_0x56376d[_0x5932('0x10')][_0x5932('0x12')]);return _0x27dffa(_0x56376d[_0x5932('0x10')][_0x5932('0x12')]);}logger[_0x5932('0x10')](_0x5932('0x13'),_0x1d97ea,_0x56376d[_0x5932('0x10')][_0x5932('0x12')]);return _0x4295bf(_0x56376d[_0x5932('0x10')][_0x5932('0x12')]);}else{logger[_0x5932('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1d97ea,_0x5932('0xc'));_0x4295bf(_0x56376d[_0x5932('0x14')][_0x5932('0x12')]);}})[_0x5932('0x15')](function(_0x1c69f5){logger[_0x5932('0x10')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1d97ea,_0x1c69f5);_0x27dffa(_0x1c69f5);});});}
\ No newline at end of file
index f9051cb..78513a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9d80=['show','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x38bdd1,_0x513da3){var _0x263b9c=function(_0x4df541){while(--_0x4df541){_0x38bdd1['push'](_0x38bdd1['shift']());}};_0x263b9c(++_0x513da3);}(_0x9d80,0x9f));var _0x09d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9d80[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x09d8('0x0'));var path=require(_0x09d8('0x1'));var timeout=require(_0x09d8('0x2'));var express=require(_0x09d8('0x3'));var router=express[_0x09d8('0x4')]();var fs_extra=require(_0x09d8('0x5'));var auth=require(_0x09d8('0x6'));var interaction=require(_0x09d8('0x7'));var config=require('../../config/environment');var controller=require('./intDynamics365Field.controller');router[_0x09d8('0x8')]('/',auth[_0x09d8('0x9')](),controller[_0x09d8('0xa')]);router[_0x09d8('0x8')](_0x09d8('0xb'),auth[_0x09d8('0x9')](),controller[_0x09d8('0xc')]);router[_0x09d8('0xd')]('/',auth[_0x09d8('0x9')](),controller[_0x09d8('0xe')]);router[_0x09d8('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x09d8('0x10')]);router['delete']('/:id',auth[_0x09d8('0x9')](),controller[_0x09d8('0x11')]);module[_0x09d8('0x12')]=router;
\ No newline at end of file
+var _0x0dd1=['../../config/environment','./intDynamics365Field.controller','isAuthenticated','get','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x11f75c,_0x2a4588){var _0x8f4a95=function(_0xe13eec){while(--_0xe13eec){_0x11f75c['push'](_0x11f75c['shift']());}};_0x8f4a95(++_0x2a4588);}(_0x0dd1,0x186));var _0x10dd=function(_0x58f370,_0x2036cf){_0x58f370=_0x58f370-0x0;var _0x47ac1b=_0x0dd1[_0x58f370];return _0x47ac1b;};'use strict';var multer=require(_0x10dd('0x0'));var util=require(_0x10dd('0x1'));var path=require(_0x10dd('0x2'));var timeout=require(_0x10dd('0x3'));var express=require('express');var router=express[_0x10dd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x10dd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x10dd('0x6'));var controller=require(_0x10dd('0x7'));router['get']('/',auth[_0x10dd('0x8')](),controller['index']);router[_0x10dd('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x10dd('0xa')]);router[_0x10dd('0xb')]('/',auth[_0x10dd('0x8')](),controller[_0x10dd('0xc')]);router[_0x10dd('0xd')](_0x10dd('0xe'),auth[_0x10dd('0x8')](),controller['update']);router[_0x10dd('0xf')](_0x10dd('0xe'),auth[_0x10dd('0x8')](),controller[_0x10dd('0x10')]);module[_0x10dd('0x11')]=router;
\ No newline at end of file
index 26bf9a6..050dd3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4290=['string','variable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x4a9053,_0x1856fb){var _0x475a0a=function(_0x289340){while(--_0x289340){_0x4a9053['push'](_0x4a9053['shift']());}};_0x475a0a(++_0x1856fb);}(_0x4290,0x16e));var _0x0429=function(_0x15a5c9,_0x23d599){_0x15a5c9=_0x15a5c9-0x0;var _0x467dff=_0x4290[_0x15a5c9];return _0x467dff;};'use strict';var Sequelize=require(_0x0429('0x0'));module[_0x0429('0x1')]={'type':{'type':Sequelize[_0x0429('0x2')](_0x0429('0x3'),_0x0429('0x4'),'customVariable',_0x0429('0x5'),_0x0429('0x6')),'defaultValue':_0x0429('0x3')},'content':{'type':Sequelize[_0x0429('0x7')]},'key':{'type':Sequelize[_0x0429('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x0429('0x3'),_0x0429('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x0429('0x7')]},'idField':{'type':Sequelize[_0x0429('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0429('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xe966=['picklist','STRING','variable','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x3231e8,_0x41df58){var _0x13a897=function(_0x5c01b5){while(--_0x5c01b5){_0x3231e8['push'](_0x3231e8['shift']());}};_0x13a897(++_0x41df58);}(_0xe966,0x175));var _0x6e96=function(_0x315350,_0x339cbc){_0x315350=_0x315350-0x0;var _0x3b46f6=_0xe966[_0x315350];return _0x3b46f6;};'use strict';var Sequelize=require('sequelize');module[_0x6e96('0x0')]={'type':{'type':Sequelize[_0x6e96('0x1')](_0x6e96('0x2'),'variable',_0x6e96('0x3'),_0x6e96('0x4'),_0x6e96('0x5')),'defaultValue':_0x6e96('0x2')},'content':{'type':Sequelize[_0x6e96('0x6')]},'key':{'type':Sequelize[_0x6e96('0x6')]},'keyType':{'type':Sequelize[_0x6e96('0x1')](_0x6e96('0x2'),_0x6e96('0x7'),_0x6e96('0x3'))},'keyContent':{'type':Sequelize[_0x6e96('0x6')]},'idField':{'type':Sequelize[_0x6e96('0x6')]},'nameField':{'type':Sequelize[_0x6e96('0x6')]},'customField':{'type':Sequelize[_0x6e96('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6e96('0x6')]}};
\ No newline at end of file
index ac742f2..08e2a84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x123a=['intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','sendStatus','error','name','send','index','Dynamics365Field','rawAttributes','type','key','model','query','keys','filters'];(function(_0x4600ad,_0x599a40){var _0x3ba8ef=function(_0x42f2d8){while(--_0x42f2d8){_0x4600ad['push'](_0x4600ad['shift']());}};_0x3ba8ef(++_0x599a40);}(_0x123a,0x189));var _0xa123=function(_0x17bc17,_0x4ae380){_0x17bc17=_0x17bc17-0x0;var _0x2d584d=_0x123a[_0x17bc17];return _0x2d584d;};'use strict';var emlformat=require(_0xa123('0x0'));var rimraf=require(_0xa123('0x1'));var zipdir=require(_0xa123('0x2'));var jsonpatch=require(_0xa123('0x3'));var rp=require(_0xa123('0x4'));var moment=require(_0xa123('0x5'));var BPromise=require(_0xa123('0x6'));var Mustache=require(_0xa123('0x7'));var util=require(_0xa123('0x8'));var path=require(_0xa123('0x9'));var sox=require('sox');var csv=require(_0xa123('0xa'));var ejs=require(_0xa123('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa123('0xc'));var squel=require('squel');var crypto=require(_0xa123('0xd'));var jsforce=require(_0xa123('0xe'));var deskjs=require(_0xa123('0xf'));var toCsv=require(_0xa123('0xa'));var querystring=require(_0xa123('0x10'));var Papa=require(_0xa123('0x11'));var Redis=require(_0xa123('0x12'));var authService=require(_0xa123('0x13'));var qs=require(_0xa123('0x14'));var as=require(_0xa123('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa123('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xa123('0x17'));var licenseUtil=require(_0xa123('0x18'));var db=require(_0xa123('0x19'))['db'];function respondWithStatusCode(_0x2cc996,_0x3af3d3){_0x3af3d3=_0x3af3d3||0xcc;return function(_0xbb146f){if(_0xbb146f){return _0x2cc996['sendStatus'](_0x3af3d3);}return _0x2cc996[_0xa123('0x1a')](_0x3af3d3)[_0xa123('0x1b')]();};}function respondWithResult(_0x4107ef,_0x50e840){_0x50e840=_0x50e840||0xc8;return function(_0x4cdcd5){if(_0x4cdcd5){return _0x4107ef[_0xa123('0x1a')](_0x50e840)[_0xa123('0x1c')](_0x4cdcd5);}};}function respondWithFilteredResult(_0x44af84,_0x318390){return function(_0x2fcf36){if(_0x2fcf36){var _0xf46918=typeof _0x318390[_0xa123('0x1d')]===_0xa123('0x1e')&&typeof _0x318390['limit']===_0xa123('0x1e');var _0x44c6bc=_0x2fcf36[_0xa123('0x1f')];var _0x4b9317=_0xf46918?0x0:_0x318390[_0xa123('0x1d')];var _0xf0615a=_0xf46918?_0x2fcf36['count']:_0x318390[_0xa123('0x1d')]+_0x318390['limit'];var _0x4de7bf;if(_0xf0615a>=_0x44c6bc){_0xf0615a=_0x44c6bc;_0x4de7bf=0xc8;}else{_0x4de7bf=0xce;}_0x44af84[_0xa123('0x1a')](_0x4de7bf);return _0x44af84[_0xa123('0x20')]('Content-Range',_0x4b9317+'-'+_0xf0615a+'/'+_0x44c6bc)[_0xa123('0x1c')](_0x2fcf36);}return null;};}function patchUpdates(_0x137513){return function(_0x269a57){try{jsonpatch[_0xa123('0x21')](_0x269a57,_0x137513,!![]);}catch(_0x3d8c0e){return BPromise[_0xa123('0x22')](_0x3d8c0e);}return _0x269a57[_0xa123('0x23')]();};}function saveUpdates(_0x44ad2f,_0x3a539d){return function(_0x427c1a){if(_0x427c1a){return _0x427c1a['update'](_0x44ad2f)[_0xa123('0x24')](function(_0x2c246f){return _0x2c246f;});}return null;};}function removeEntity(_0x348601,_0x7e8760){return function(_0x361eb4){if(_0x361eb4){return _0x361eb4[_0xa123('0x25')]()[_0xa123('0x24')](function(){_0x348601[_0xa123('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3603b2,_0x3cdb9a){return function(_0x3a93a6){if(!_0x3a93a6){_0x3603b2[_0xa123('0x26')](0x194);}return _0x3a93a6;};}function handleError(_0x13f0ce,_0x563bce){_0x563bce=_0x563bce||0x1f4;return function(_0x5f1a6a){logger[_0xa123('0x27')](_0x5f1a6a['stack']);if(_0x5f1a6a[_0xa123('0x28')]){delete _0x5f1a6a[_0xa123('0x28')];}_0x13f0ce[_0xa123('0x1a')](_0x563bce)[_0xa123('0x29')](_0x5f1a6a);};}exports[_0xa123('0x2a')]=function(_0x41918c,_0x4ebac7){var _0x5bea91={},_0x13caf0={},_0x4fd4e2={'count':0x0,'rows':[]};var _0xcf8140=_['map'](db[_0xa123('0x2b')][_0xa123('0x2c')],function(_0xfa096c){return{'name':_0xfa096c['fieldName'],'type':_0xfa096c[_0xa123('0x2d')][_0xa123('0x2e')]};});_0x13caf0[_0xa123('0x2f')]=_['map'](_0xcf8140,_0xa123('0x28'));_0x13caf0[_0xa123('0x30')]=_[_0xa123('0x31')](_0x41918c['query']);_0x13caf0[_0xa123('0x32')]=_[_0xa123('0x33')](_0x13caf0['model'],_0x13caf0[_0xa123('0x30')]);_0x5bea91['attributes']=_[_0xa123('0x33')](_0x13caf0[_0xa123('0x2f')],qs['fields'](_0x41918c[_0xa123('0x30')][_0xa123('0x34')]));_0x5bea91['attributes']=_0x5bea91[_0xa123('0x35')][_0xa123('0x36')]?_0x5bea91['attributes']:_0x13caf0[_0xa123('0x2f')];if(!_0x41918c[_0xa123('0x30')][_0xa123('0x37')](_0xa123('0x38'))){_0x5bea91['limit']=qs[_0xa123('0x39')](_0x41918c[_0xa123('0x30')][_0xa123('0x39')]);_0x5bea91[_0xa123('0x1d')]=qs[_0xa123('0x1d')](_0x41918c[_0xa123('0x30')][_0xa123('0x1d')]);}_0x5bea91[_0xa123('0x3a')]=qs[_0xa123('0x3b')](_0x41918c[_0xa123('0x30')][_0xa123('0x3b')]);_0x5bea91[_0xa123('0x3c')]=qs['filters'](_['pick'](_0x41918c['query'],_0x13caf0[_0xa123('0x32')]),_0xcf8140);if(_0x41918c[_0xa123('0x30')][_0xa123('0x3d')]){_0x5bea91[_0xa123('0x3c')]=_[_0xa123('0x3e')](_0x5bea91[_0xa123('0x3c')],{'$or':_['map'](_0xcf8140,function(_0x517181){if(_0x517181[_0xa123('0x2d')]!==_0xa123('0x3f')){var _0x11614f={};_0x11614f[_0x517181[_0xa123('0x28')]]={'$like':'%'+_0x41918c[_0xa123('0x30')][_0xa123('0x3d')]+'%'};return _0x11614f;}})});}_0x5bea91=_[_0xa123('0x3e')]({},_0x5bea91,_0x41918c[_0xa123('0x40')]);var _0x54f6b3={'where':_0x5bea91[_0xa123('0x3c')]};return db['Dynamics365Field'][_0xa123('0x1f')](_0x54f6b3)[_0xa123('0x24')](function(_0x47b5ef){_0x4fd4e2[_0xa123('0x1f')]=_0x47b5ef;if(_0x41918c[_0xa123('0x30')][_0xa123('0x41')]){_0x5bea91[_0xa123('0x42')]=[{'all':!![]}];}return db[_0xa123('0x2b')][_0xa123('0x43')](_0x5bea91);})[_0xa123('0x24')](function(_0x6ac5ca){_0x4fd4e2['rows']=_0x6ac5ca;return _0x4fd4e2;})[_0xa123('0x24')](respondWithFilteredResult(_0x4ebac7,_0x5bea91))[_0xa123('0x44')](handleError(_0x4ebac7,null));};exports[_0xa123('0x45')]=function(_0xe4227f,_0x44e9f2){var _0x31e442={'raw':!![],'where':{'id':_0xe4227f[_0xa123('0x46')]['id']}},_0x582d6a={};_0x582d6a[_0xa123('0x2f')]=_[_0xa123('0x31')](db[_0xa123('0x2b')][_0xa123('0x2c')]);_0x582d6a['query']=_[_0xa123('0x31')](_0xe4227f[_0xa123('0x30')]);_0x582d6a['filters']=_['intersection'](_0x582d6a['model'],_0x582d6a[_0xa123('0x30')]);_0x31e442[_0xa123('0x35')]=_[_0xa123('0x33')](_0x582d6a[_0xa123('0x2f')],qs[_0xa123('0x34')](_0xe4227f[_0xa123('0x30')][_0xa123('0x34')]));_0x31e442[_0xa123('0x35')]=_0x31e442[_0xa123('0x35')][_0xa123('0x36')]?_0x31e442[_0xa123('0x35')]:_0x582d6a[_0xa123('0x2f')];if(_0xe4227f[_0xa123('0x30')]['includeAll']){_0x31e442[_0xa123('0x42')]=[{'all':!![]}];}_0x31e442=_[_0xa123('0x3e')]({},_0x31e442,_0xe4227f[_0xa123('0x40')]);return db[_0xa123('0x2b')][_0xa123('0x47')](_0x31e442)['then'](handleEntityNotFound(_0x44e9f2,null))[_0xa123('0x24')](respondWithResult(_0x44e9f2,null))[_0xa123('0x44')](handleError(_0x44e9f2,null));};exports[_0xa123('0x48')]=function(_0x2b87b8,_0x1f3436){return db['Dynamics365Field'][_0xa123('0x48')](_0x2b87b8[_0xa123('0x49')],{})['then'](respondWithResult(_0x1f3436,0xc9))[_0xa123('0x44')](handleError(_0x1f3436,null));};exports['update']=function(_0x315a80,_0x234aeb){if(_0x315a80[_0xa123('0x49')]['id']){delete _0x315a80['body']['id'];}return db[_0xa123('0x2b')][_0xa123('0x47')]({'where':{'id':_0x315a80[_0xa123('0x46')]['id']}})[_0xa123('0x24')](handleEntityNotFound(_0x234aeb,null))[_0xa123('0x24')](saveUpdates(_0x315a80['body'],null))[_0xa123('0x24')](respondWithResult(_0x234aeb,null))[_0xa123('0x44')](handleError(_0x234aeb,null));};exports[_0xa123('0x25')]=function(_0x2365d2,_0x26d2bb){return db[_0xa123('0x2b')][_0xa123('0x47')]({'where':{'id':_0x2365d2[_0xa123('0x46')]['id']}})[_0xa123('0x24')](handleEntityNotFound(_0x26d2bb,null))[_0xa123('0x24')](removeEntity(_0x26d2bb,null))[_0xa123('0x44')](handleError(_0x26d2bb,null));};
\ No newline at end of file
+var _0xf3bd=['params','fields','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','destroy','end','stack','name','send','index','map','Dynamics365Field','fieldName','key','query','keys','filters','intersection','model','attributes','length','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show'];(function(_0x849f88,_0x558328){var _0x4862b8=function(_0x484af5){while(--_0x484af5){_0x849f88['push'](_0x849f88['shift']());}};_0x4862b8(++_0x558328);}(_0xf3bd,0x9b));var _0xdf3b=function(_0x2e658a,_0x571fc9){_0x2e658a=_0x2e658a-0x0;var _0x227d70=_0xf3bd[_0x2e658a];return _0x227d70;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdf3b('0x0'));var jsonpatch=require(_0xdf3b('0x1'));var rp=require(_0xdf3b('0x2'));var moment=require(_0xdf3b('0x3'));var BPromise=require(_0xdf3b('0x4'));var Mustache=require(_0xdf3b('0x5'));var util=require(_0xdf3b('0x6'));var path=require(_0xdf3b('0x7'));var sox=require(_0xdf3b('0x8'));var csv=require(_0xdf3b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf3b('0xa'));var _=require(_0xdf3b('0xb'));var squel=require(_0xdf3b('0xc'));var crypto=require(_0xdf3b('0xd'));var jsforce=require(_0xdf3b('0xe'));var deskjs=require(_0xdf3b('0xf'));var toCsv=require(_0xdf3b('0x9'));var querystring=require(_0xdf3b('0x10'));var Papa=require(_0xdf3b('0x11'));var Redis=require(_0xdf3b('0x12'));var authService=require(_0xdf3b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf3b('0x14'));var logger=require('../../config/logger')(_0xdf3b('0x15'));var utils=require(_0xdf3b('0x16'));var config=require(_0xdf3b('0x17'));var licenseUtil=require(_0xdf3b('0x18'));var db=require(_0xdf3b('0x19'))['db'];function respondWithStatusCode(_0x2d4a7f,_0xf61e4){_0xf61e4=_0xf61e4||0xcc;return function(_0x2117d8){if(_0x2117d8){return _0x2d4a7f[_0xdf3b('0x1a')](_0xf61e4);}return _0x2d4a7f['status'](_0xf61e4)['end']();};}function respondWithResult(_0x103a6d,_0x1f3024){_0x1f3024=_0x1f3024||0xc8;return function(_0x211cd5){if(_0x211cd5){return _0x103a6d[_0xdf3b('0x1b')](_0x1f3024)[_0xdf3b('0x1c')](_0x211cd5);}};}function respondWithFilteredResult(_0x19c10e,_0x23b88a){return function(_0x487cba){if(_0x487cba){var _0xd11fa5=typeof _0x23b88a['offset']===_0xdf3b('0x1d')&&typeof _0x23b88a[_0xdf3b('0x1e')]==='undefined';var _0x3be213=_0x487cba[_0xdf3b('0x1f')];var _0x459924=_0xd11fa5?0x0:_0x23b88a['offset'];var _0x22ae97=_0xd11fa5?_0x487cba['count']:_0x23b88a[_0xdf3b('0x20')]+_0x23b88a['limit'];var _0x364f5d;if(_0x22ae97>=_0x3be213){_0x22ae97=_0x3be213;_0x364f5d=0xc8;}else{_0x364f5d=0xce;}_0x19c10e[_0xdf3b('0x1b')](_0x364f5d);return _0x19c10e[_0xdf3b('0x21')](_0xdf3b('0x22'),_0x459924+'-'+_0x22ae97+'/'+_0x3be213)['json'](_0x487cba);}return null;};}function patchUpdates(_0x207688){return function(_0x3385d5){try{jsonpatch['apply'](_0x3385d5,_0x207688,!![]);}catch(_0x30133a){return BPromise[_0xdf3b('0x23')](_0x30133a);}return _0x3385d5['save']();};}function saveUpdates(_0x484542,_0x2328e2){return function(_0x4af998){if(_0x4af998){return _0x4af998[_0xdf3b('0x24')](_0x484542)[_0xdf3b('0x25')](function(_0x20a0fe){return _0x20a0fe;});}return null;};}function removeEntity(_0x169983,_0x540859){return function(_0x5483ef){if(_0x5483ef){return _0x5483ef[_0xdf3b('0x26')]()['then'](function(){_0x169983[_0xdf3b('0x1b')](0xcc)[_0xdf3b('0x27')]();});}};}function handleEntityNotFound(_0x1e671c,_0x3d6063){return function(_0x245b48){if(!_0x245b48){_0x1e671c['sendStatus'](0x194);}return _0x245b48;};}function handleError(_0x47eccc,_0x17d0e4){_0x17d0e4=_0x17d0e4||0x1f4;return function(_0x240844){logger['error'](_0x240844[_0xdf3b('0x28')]);if(_0x240844[_0xdf3b('0x29')]){delete _0x240844[_0xdf3b('0x29')];}_0x47eccc[_0xdf3b('0x1b')](_0x17d0e4)[_0xdf3b('0x2a')](_0x240844);};}exports[_0xdf3b('0x2b')]=function(_0x44e5b8,_0x46efbc){var _0x44b932={},_0x216021={},_0x72802={'count':0x0,'rows':[]};var _0x31df30=_[_0xdf3b('0x2c')](db[_0xdf3b('0x2d')]['rawAttributes'],function(_0xb9bc71){return{'name':_0xb9bc71[_0xdf3b('0x2e')],'type':_0xb9bc71['type'][_0xdf3b('0x2f')]};});_0x216021['model']=_['map'](_0x31df30,_0xdf3b('0x29'));_0x216021[_0xdf3b('0x30')]=_[_0xdf3b('0x31')](_0x44e5b8[_0xdf3b('0x30')]);_0x216021[_0xdf3b('0x32')]=_[_0xdf3b('0x33')](_0x216021[_0xdf3b('0x34')],_0x216021[_0xdf3b('0x30')]);_0x44b932[_0xdf3b('0x35')]=_[_0xdf3b('0x33')](_0x216021['model'],qs['fields'](_0x44e5b8[_0xdf3b('0x30')]['fields']));_0x44b932[_0xdf3b('0x35')]=_0x44b932[_0xdf3b('0x35')][_0xdf3b('0x36')]?_0x44b932[_0xdf3b('0x35')]:_0x216021[_0xdf3b('0x34')];if(!_0x44e5b8['query']['hasOwnProperty'](_0xdf3b('0x37'))){_0x44b932[_0xdf3b('0x1e')]=qs[_0xdf3b('0x1e')](_0x44e5b8[_0xdf3b('0x30')][_0xdf3b('0x1e')]);_0x44b932['offset']=qs[_0xdf3b('0x20')](_0x44e5b8['query']['offset']);}_0x44b932['order']=qs[_0xdf3b('0x38')](_0x44e5b8['query'][_0xdf3b('0x38')]);_0x44b932[_0xdf3b('0x39')]=qs[_0xdf3b('0x32')](_[_0xdf3b('0x3a')](_0x44e5b8[_0xdf3b('0x30')],_0x216021[_0xdf3b('0x32')]),_0x31df30);if(_0x44e5b8['query']['filter']){_0x44b932[_0xdf3b('0x39')]=_[_0xdf3b('0x3b')](_0x44b932[_0xdf3b('0x39')],{'$or':_[_0xdf3b('0x2c')](_0x31df30,function(_0x3b5fa9){if(_0x3b5fa9[_0xdf3b('0x3c')]!==_0xdf3b('0x3d')){var _0x381bb1={};_0x381bb1[_0x3b5fa9['name']]={'$like':'%'+_0x44e5b8[_0xdf3b('0x30')][_0xdf3b('0x3e')]+'%'};return _0x381bb1;}})});}_0x44b932=_['merge']({},_0x44b932,_0x44e5b8[_0xdf3b('0x3f')]);var _0x207bd1={'where':_0x44b932[_0xdf3b('0x39')]};return db[_0xdf3b('0x2d')][_0xdf3b('0x1f')](_0x207bd1)['then'](function(_0x16504b){_0x72802['count']=_0x16504b;if(_0x44e5b8['query'][_0xdf3b('0x40')]){_0x44b932[_0xdf3b('0x41')]=[{'all':!![]}];}return db[_0xdf3b('0x2d')][_0xdf3b('0x42')](_0x44b932);})['then'](function(_0x4a3b78){_0x72802[_0xdf3b('0x43')]=_0x4a3b78;return _0x72802;})['then'](respondWithFilteredResult(_0x46efbc,_0x44b932))[_0xdf3b('0x44')](handleError(_0x46efbc,null));};exports[_0xdf3b('0x45')]=function(_0x1468da,_0x2e9921){var _0x1e3802={'raw':!![],'where':{'id':_0x1468da[_0xdf3b('0x46')]['id']}},_0x130fbf={};_0x130fbf[_0xdf3b('0x34')]=_['keys'](db[_0xdf3b('0x2d')]['rawAttributes']);_0x130fbf[_0xdf3b('0x30')]=_['keys'](_0x1468da[_0xdf3b('0x30')]);_0x130fbf[_0xdf3b('0x32')]=_[_0xdf3b('0x33')](_0x130fbf[_0xdf3b('0x34')],_0x130fbf['query']);_0x1e3802['attributes']=_[_0xdf3b('0x33')](_0x130fbf[_0xdf3b('0x34')],qs[_0xdf3b('0x47')](_0x1468da[_0xdf3b('0x30')]['fields']));_0x1e3802['attributes']=_0x1e3802['attributes']['length']?_0x1e3802[_0xdf3b('0x35')]:_0x130fbf[_0xdf3b('0x34')];if(_0x1468da[_0xdf3b('0x30')]['includeAll']){_0x1e3802[_0xdf3b('0x41')]=[{'all':!![]}];}_0x1e3802=_[_0xdf3b('0x3b')]({},_0x1e3802,_0x1468da[_0xdf3b('0x3f')]);return db[_0xdf3b('0x2d')][_0xdf3b('0x48')](_0x1e3802)[_0xdf3b('0x25')](handleEntityNotFound(_0x2e9921,null))[_0xdf3b('0x25')](respondWithResult(_0x2e9921,null))['catch'](handleError(_0x2e9921,null));};exports[_0xdf3b('0x49')]=function(_0x38f8d0,_0x3e5da3){return db[_0xdf3b('0x2d')][_0xdf3b('0x49')](_0x38f8d0[_0xdf3b('0x4a')],{})[_0xdf3b('0x25')](respondWithResult(_0x3e5da3,0xc9))[_0xdf3b('0x44')](handleError(_0x3e5da3,null));};exports['update']=function(_0x263eaa,_0x4b7f57){if(_0x263eaa[_0xdf3b('0x4a')]['id']){delete _0x263eaa[_0xdf3b('0x4a')]['id'];}return db[_0xdf3b('0x2d')][_0xdf3b('0x48')]({'where':{'id':_0x263eaa['params']['id']}})[_0xdf3b('0x25')](handleEntityNotFound(_0x4b7f57,null))['then'](saveUpdates(_0x263eaa[_0xdf3b('0x4a')],null))[_0xdf3b('0x25')](respondWithResult(_0x4b7f57,null))['catch'](handleError(_0x4b7f57,null));};exports[_0xdf3b('0x26')]=function(_0x2d221b,_0x5c0223){return db[_0xdf3b('0x2d')][_0xdf3b('0x48')]({'where':{'id':_0x2d221b['params']['id']}})[_0xdf3b('0x25')](handleEntityNotFound(_0x5c0223,null))[_0xdf3b('0x25')](removeEntity(_0x5c0223,null))[_0xdf3b('0x44')](handleError(_0x5c0223,null));};
\ No newline at end of file
index 1696d7e..7186700 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f00=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField','lodash','../../config/logger','api','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f00,0xec));var _0x06f0=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x6f00[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x06f0('0x0'));var util=require('util');var logger=require(_0x06f0('0x1'))(_0x06f0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x06f0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06f0('0x4'));var config=require(_0x06f0('0x5'));var attributes=require(_0x06f0('0x6'));module[_0x06f0('0x7')]=function(_0x3989fd,_0x5e9888){return _0x3989fd[_0x06f0('0x8')](_0x06f0('0x9'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x06f0('0xa'),'fields':[_0x06f0('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xf688=['dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','exports','Dynamics365Field','int_dynamics365_fields'];(function(_0x1b833e,_0x2d356f){var _0x315218=function(_0x4c928a){while(--_0x4c928a){_0x1b833e['push'](_0x1b833e['shift']());}};_0x315218(++_0x2d356f);}(_0xf688,0x123));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8f68('0x0'));var util=require(_0x8f68('0x1'));var logger=require(_0x8f68('0x2'))(_0x8f68('0x3'));var moment=require(_0x8f68('0x4'));var BPromise=require(_0x8f68('0x5'));var rp=require(_0x8f68('0x6'));var fs=require('fs');var path=require(_0x8f68('0x7'));var rimraf=require('rimraf');var config=require(_0x8f68('0x8'));var attributes=require(_0x8f68('0x9'));module[_0x8f68('0xa')]=function(_0x35f553,_0x53889f){return _0x35f553['define'](_0x8f68('0xb'),attributes,{'tableName':_0x8f68('0xc'),'paranoid':![],'indexes':[{'name':_0x8f68('0xd'),'fields':[_0x8f68('0xe'),_0x8f68('0xf')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 9e50d23..05c7726 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94f2=['jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x57e3d7,_0x2d0777){var _0x405126=function(_0xe89bce){while(--_0xe89bce){_0x57e3d7['push'](_0x57e3d7['shift']());}};_0x405126(++_0x2d0777);}(_0x94f2,0x1bf));var _0x294f=function(_0x402903,_0x250e7b){_0x402903=_0x402903-0x0;var _0x399a7c=_0x94f2[_0x402903];return _0x399a7c;};'use strict';var _=require(_0x294f('0x0'));var util=require(_0x294f('0x1'));var moment=require(_0x294f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x294f('0x3'));var db=require(_0x294f('0x4'))['db'];var utils=require(_0x294f('0x5'));var logger=require(_0x294f('0x6'))(_0x294f('0x7'));var config=require(_0x294f('0x8'));var jayson=require(_0x294f('0x9'));var client=jayson[_0x294f('0xa')][_0x294f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c34b8,_0xa64d91,_0x49071f){return new BPromise(function(_0x701f32,_0x8aad2){return client[_0x294f('0xc')](_0x1c34b8,_0x49071f)[_0x294f('0xd')](function(_0x198ea5){logger[_0x294f('0xe')](_0x294f('0xf'),_0xa64d91,_0x294f('0x10'));logger[_0x294f('0x11')](_0x294f('0x12'),_0xa64d91,'request\x20sent',JSON['stringify'](_0x198ea5));if(_0x198ea5[_0x294f('0x13')]){if(_0x198ea5[_0x294f('0x13')][_0x294f('0x14')]===0x1f4){logger[_0x294f('0x13')](_0x294f('0xf'),_0xa64d91,_0x198ea5[_0x294f('0x13')][_0x294f('0x15')]);return _0x8aad2(_0x198ea5[_0x294f('0x13')][_0x294f('0x15')]);}logger[_0x294f('0x13')]('Dynamics365Field,\x20%s,\x20%s',_0xa64d91,_0x198ea5[_0x294f('0x13')]['message']);return _0x701f32(_0x198ea5[_0x294f('0x13')][_0x294f('0x15')]);}else{logger[_0x294f('0xe')](_0x294f('0xf'),_0xa64d91,'request\x20sent');_0x701f32(_0x198ea5[_0x294f('0x16')][_0x294f('0x15')]);}})[_0x294f('0x17')](function(_0x220ae1){logger[_0x294f('0x13')](_0x294f('0xf'),_0xa64d91,_0x220ae1);_0x8aad2(_0x220ae1);});});}
\ No newline at end of file
+var _0x22df=['client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0x22df,0x13a));var _0xf22d=function(_0x333523,_0x4a5286){_0x333523=_0x333523-0x0;var _0x4cf904=_0x22df[_0x333523];return _0x4cf904;};'use strict';var _=require(_0xf22d('0x0'));var util=require(_0xf22d('0x1'));var moment=require(_0xf22d('0x2'));var BPromise=require(_0xf22d('0x3'));var rs=require(_0xf22d('0x4'));var fs=require('fs');var Redis=require(_0xf22d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf22d('0x6'));var logger=require(_0xf22d('0x7'))(_0xf22d('0x8'));var config=require(_0xf22d('0x9'));var jayson=require(_0xf22d('0xa'));var client=jayson[_0xf22d('0xb')][_0xf22d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25c98e,_0x4b07bd,_0x708e86){return new BPromise(function(_0x21cf92,_0x57cc93){return client[_0xf22d('0xd')](_0x25c98e,_0x708e86)[_0xf22d('0xe')](function(_0xf40704){logger[_0xf22d('0xf')](_0xf22d('0x10'),_0x4b07bd,'request\x20sent');logger[_0xf22d('0x11')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x4b07bd,_0xf22d('0x12'),JSON[_0xf22d('0x13')](_0xf40704));if(_0xf40704[_0xf22d('0x14')]){if(_0xf40704[_0xf22d('0x14')][_0xf22d('0x15')]===0x1f4){logger[_0xf22d('0x14')](_0xf22d('0x10'),_0x4b07bd,_0xf40704[_0xf22d('0x14')][_0xf22d('0x16')]);return _0x57cc93(_0xf40704[_0xf22d('0x14')][_0xf22d('0x16')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x4b07bd,_0xf40704['error'][_0xf22d('0x16')]);return _0x21cf92(_0xf40704['error']['message']);}else{logger[_0xf22d('0xf')](_0xf22d('0x10'),_0x4b07bd,_0xf22d('0x12'));_0x21cf92(_0xf40704[_0xf22d('0x17')][_0xf22d('0x16')]);}})[_0xf22d('0x18')](function(_0x5db07f){logger[_0xf22d('0x14')]('Dynamics365Field,\x20%s,\x20%s',_0x4b07bd,_0x5db07f);_0x57cc93(_0x5db07f);});});}
\ No newline at end of file
index 8c5256a..788e29f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1664=['addConfiguration','put','update','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','show','/:id/configurations','isAuthenticated','post'];(function(_0x30bc3d,_0x32b7ad){var _0x3a1b60=function(_0x5f5775){while(--_0x5f5775){_0x30bc3d['push'](_0x30bc3d['shift']());}};_0x3a1b60(++_0x32b7ad);}(_0x1664,0x1c7));var _0x4166=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x1664[_0x4f9b18];return _0x29f20c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4166('0x0'));var express=require(_0x4166('0x1'));var router=express[_0x4166('0x2')]();var fs_extra=require(_0x4166('0x3'));var auth=require(_0x4166('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4166('0x5'));var controller=require('./intFreshdeskAccount.controller');router[_0x4166('0x6')]('/',auth['isAuthenticated'](),controller[_0x4166('0x7')]);router[_0x4166('0x6')](_0x4166('0x8'),auth['isAuthenticated'](),controller[_0x4166('0x9')]);router[_0x4166('0x6')](_0x4166('0xa'),auth[_0x4166('0xb')](),controller['getConfigurations']);router[_0x4166('0x6')]('/:id/fields',auth[_0x4166('0xb')](),controller['getFields']);router[_0x4166('0xc')]('/',auth[_0x4166('0xb')](),controller['create']);router[_0x4166('0xc')](_0x4166('0xa'),auth[_0x4166('0xb')](),controller[_0x4166('0xd')]);router[_0x4166('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x4166('0xf')]);router['delete'](_0x4166('0x8'),auth[_0x4166('0xb')](),controller[_0x4166('0x10')]);module[_0x4166('0x11')]=router;
\ No newline at end of file
+var _0x2366=['addConfiguration','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2366,0x11a));var _0x6236=function(_0x4969d0,_0x4a5788){_0x4969d0=_0x4969d0-0x0;var _0x754944=_0x2366[_0x4969d0];return _0x754944;};'use strict';var multer=require(_0x6236('0x0'));var util=require(_0x6236('0x1'));var path=require('path');var timeout=require(_0x6236('0x2'));var express=require(_0x6236('0x3'));var router=express['Router']();var fs_extra=require(_0x6236('0x4'));var auth=require(_0x6236('0x5'));var interaction=require(_0x6236('0x6'));var config=require(_0x6236('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0x6236('0x8')]('/',auth[_0x6236('0x9')](),controller[_0x6236('0xa')]);router[_0x6236('0x8')]('/:id',auth[_0x6236('0x9')](),controller[_0x6236('0xb')]);router[_0x6236('0x8')](_0x6236('0xc'),auth[_0x6236('0x9')](),controller[_0x6236('0xd')]);router[_0x6236('0x8')](_0x6236('0xe'),auth['isAuthenticated'](),controller[_0x6236('0xf')]);router[_0x6236('0x10')]('/',auth[_0x6236('0x9')](),controller['create']);router[_0x6236('0x10')](_0x6236('0xc'),auth[_0x6236('0x9')](),controller[_0x6236('0x11')]);router[_0x6236('0x12')](_0x6236('0x13'),auth[_0x6236('0x9')](),controller[_0x6236('0x14')]);router['delete'](_0x6236('0x13'),auth[_0x6236('0x9')](),controller[_0x6236('0x15')]);module[_0x6236('0x16')]=router;
\ No newline at end of file
index 8d6b4ec..cfd91f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5204=['exports','STRING','username','sequelize'];(function(_0x116c59,_0x4acdb9){var _0x84af22=function(_0x571dbc){while(--_0x571dbc){_0x116c59['push'](_0x116c59['shift']());}};_0x84af22(++_0x4acdb9);}(_0x5204,0xdf));var _0x4520=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5204[_0x13d07a];return _0x5ee0ee;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x7880=['exports','STRING','username','remoteUri'];(function(_0x466613,_0x56a7e3){var _0x13a954=function(_0x36f270){while(--_0x36f270){_0x466613['push'](_0x466613['shift']());}};_0x13a954(++_0x56a7e3);}(_0x7880,0x1f4));var _0x0788=function(_0x21310f,_0x2b178d){_0x21310f=_0x21310f-0x0;var _0x5bb5a3=_0x7880[_0x21310f];return _0x5bb5a3;};'use strict';var Sequelize=require('sequelize');module[_0x0788('0x0')]={'name':{'type':Sequelize[_0x0788('0x1')]},'description':{'type':Sequelize[_0x0788('0x1')]},'username':{'type':Sequelize[_0x0788('0x1')],'unique':_0x0788('0x2')},'apiKey':{'type':Sequelize[_0x0788('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x0788('0x3')},'serverUrl':{'type':Sequelize[_0x0788('0x1')],'allowNull':![]}};
\ No newline at end of file
index 250cc47..624e2f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34b7=['catch','show','includeAll','create','body','find','getConfigurations','findOne','params','FreshdeskConfiguration','length','order','options','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','lastIndexOf','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','subject','agent','priority','group','source','ticket_type','company','includes','default','custom_text','label','choices','capitalize','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','include','rows'];(function(_0x16e56e,_0x350063){var _0x2c1f04=function(_0x1f3bf2){while(--_0x1f3bf2){_0x16e56e['push'](_0x16e56e['shift']());}};_0x2c1f04(++_0x350063);}(_0x34b7,0x196));var _0x734b=function(_0x442ae6,_0x58743b){_0x442ae6=_0x442ae6-0x0;var _0x581317=_0x34b7[_0x442ae6];return _0x581317;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x734b('0x0'));var jsonpatch=require(_0x734b('0x1'));var rp=require(_0x734b('0x2'));var moment=require(_0x734b('0x3'));var BPromise=require(_0x734b('0x4'));var Mustache=require(_0x734b('0x5'));var util=require('util');var path=require('path');var sox=require(_0x734b('0x6'));var csv=require(_0x734b('0x7'));var ejs=require(_0x734b('0x8'));var fs=require('fs');var fs_extra=require(_0x734b('0x9'));var _=require(_0x734b('0xa'));var squel=require(_0x734b('0xb'));var crypto=require('crypto');var jsforce=require(_0x734b('0xc'));var deskjs=require(_0x734b('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x734b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x734b('0xf'));var as=require(_0x734b('0x10'));var hardwareService=require(_0x734b('0x11'));var logger=require(_0x734b('0x12'))(_0x734b('0x13'));var utils=require(_0x734b('0x14'));var config=require(_0x734b('0x15'));var licenseUtil=require(_0x734b('0x16'));var db=require(_0x734b('0x17'))['db'];var integrations=require(_0x734b('0x18'));function respondWithStatusCode(_0x189a82,_0xff9ddf){_0xff9ddf=_0xff9ddf||0xcc;return function(_0x145ec3){if(_0x145ec3){return _0x189a82[_0x734b('0x19')](_0xff9ddf);}return _0x189a82['status'](_0xff9ddf)[_0x734b('0x1a')]();};}function respondWithResult(_0x252510,_0x47791c){_0x47791c=_0x47791c||0xc8;return function(_0xd1ab2a){if(_0xd1ab2a){return _0x252510[_0x734b('0x1b')](_0x47791c)[_0x734b('0x1c')](_0xd1ab2a);}};}function respondWithFilteredResult(_0x2372bd,_0x2c03bd){return function(_0xa6d111){if(_0xa6d111){var _0x4b8c63=typeof _0x2c03bd[_0x734b('0x1d')]==='undefined'&&typeof _0x2c03bd[_0x734b('0x1e')]===_0x734b('0x1f');var _0xfb661a=_0xa6d111[_0x734b('0x20')];var _0x4d3b9c=_0x4b8c63?0x0:_0x2c03bd['offset'];var _0xcd12a1=_0x4b8c63?_0xa6d111[_0x734b('0x20')]:_0x2c03bd[_0x734b('0x1d')]+_0x2c03bd[_0x734b('0x1e')];var _0x1c605c;if(_0xcd12a1>=_0xfb661a){_0xcd12a1=_0xfb661a;_0x1c605c=0xc8;}else{_0x1c605c=0xce;}_0x2372bd[_0x734b('0x1b')](_0x1c605c);return _0x2372bd[_0x734b('0x21')](_0x734b('0x22'),_0x4d3b9c+'-'+_0xcd12a1+'/'+_0xfb661a)[_0x734b('0x1c')](_0xa6d111);}return null;};}function patchUpdates(_0x1d2b27){return function(_0x7060f8){try{jsonpatch[_0x734b('0x23')](_0x7060f8,_0x1d2b27,!![]);}catch(_0x477d6d){return BPromise[_0x734b('0x24')](_0x477d6d);}return _0x7060f8['save']();};}function saveUpdates(_0x1e4dcc,_0x7856d7){return function(_0x4f98a7){if(_0x4f98a7){return _0x4f98a7[_0x734b('0x25')](_0x1e4dcc)[_0x734b('0x26')](function(_0x1a7908){return _0x1a7908;});}return null;};}function removeEntity(_0x11fb8e,_0x46d432){return function(_0x26d118){if(_0x26d118){return _0x26d118[_0x734b('0x27')]()[_0x734b('0x26')](function(){_0x11fb8e[_0x734b('0x1b')](0xcc)[_0x734b('0x1a')]();});}};}function handleEntityNotFound(_0x44ffa9,_0x148abe){return function(_0x3bb651){if(!_0x3bb651){_0x44ffa9['sendStatus'](0x194);}return _0x3bb651;};}function handleError(_0x49732b,_0x13cc5a){_0x13cc5a=_0x13cc5a||0x1f4;return function(_0x3680a0){logger['error'](_0x3680a0[_0x734b('0x28')]);if(_0x3680a0[_0x734b('0x29')]){delete _0x3680a0[_0x734b('0x29')];}_0x49732b[_0x734b('0x1b')](_0x13cc5a)[_0x734b('0x2a')](_0x3680a0);};}exports[_0x734b('0x2b')]=function(_0x3ba39c,_0x5c6c5d){var _0x1f3652={},_0x436efe={},_0x42e9ae={'count':0x0,'rows':[]};var _0x241c89=_[_0x734b('0x2c')](db[_0x734b('0x2d')][_0x734b('0x2e')],function(_0x21ed3c){return{'name':_0x21ed3c[_0x734b('0x2f')],'type':_0x21ed3c[_0x734b('0x30')]['key']};});_0x436efe[_0x734b('0x31')]=_[_0x734b('0x2c')](_0x241c89,'name');_0x436efe[_0x734b('0x32')]=_[_0x734b('0x33')](_0x3ba39c[_0x734b('0x32')]);_0x436efe[_0x734b('0x34')]=_[_0x734b('0x35')](_0x436efe[_0x734b('0x31')],_0x436efe[_0x734b('0x32')]);_0x1f3652[_0x734b('0x36')]=_[_0x734b('0x35')](_0x436efe[_0x734b('0x31')],qs[_0x734b('0x37')](_0x3ba39c[_0x734b('0x32')][_0x734b('0x37')]));_0x1f3652[_0x734b('0x36')]=_0x1f3652[_0x734b('0x36')]['length']?_0x1f3652[_0x734b('0x36')]:_0x436efe['model'];if(!_0x3ba39c[_0x734b('0x32')][_0x734b('0x38')](_0x734b('0x39'))){_0x1f3652[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3ba39c[_0x734b('0x32')]['limit']);_0x1f3652['offset']=qs[_0x734b('0x1d')](_0x3ba39c['query'][_0x734b('0x1d')]);}_0x1f3652['order']=qs[_0x734b('0x3a')](_0x3ba39c['query'][_0x734b('0x3a')]);_0x1f3652['where']=qs[_0x734b('0x34')](_[_0x734b('0x3b')](_0x3ba39c[_0x734b('0x32')],_0x436efe[_0x734b('0x34')]),_0x241c89);if(_0x3ba39c[_0x734b('0x32')][_0x734b('0x3c')]){_0x1f3652[_0x734b('0x3d')]=_['merge'](_0x1f3652[_0x734b('0x3d')],{'$or':_[_0x734b('0x2c')](_0x241c89,function(_0x58db39){if(_0x58db39[_0x734b('0x30')]!==_0x734b('0x3e')){var _0x2bb422={};_0x2bb422[_0x58db39[_0x734b('0x29')]]={'$like':'%'+_0x3ba39c['query'][_0x734b('0x3c')]+'%'};return _0x2bb422;}})});}_0x1f3652=_[_0x734b('0x3f')]({},_0x1f3652,_0x3ba39c['options']);var _0x40674c={'where':_0x1f3652[_0x734b('0x3d')]};return db['FreshdeskAccount'][_0x734b('0x20')](_0x40674c)[_0x734b('0x26')](function(_0x2820f9){_0x42e9ae[_0x734b('0x20')]=_0x2820f9;if(_0x3ba39c['query']['includeAll']){_0x1f3652[_0x734b('0x40')]=[{'all':!![]}];}return db['FreshdeskAccount']['findAll'](_0x1f3652);})[_0x734b('0x26')](function(_0x50bde2){_0x42e9ae[_0x734b('0x41')]=_0x50bde2;return _0x42e9ae;})['then'](respondWithFilteredResult(_0x5c6c5d,_0x1f3652))[_0x734b('0x42')](handleError(_0x5c6c5d,null));};exports[_0x734b('0x43')]=function(_0xe4fe38,_0x4c3fdc){var _0x5cf3a0={'raw':![],'where':{'id':_0xe4fe38['params']['id']}},_0x2e1aa8={};_0x2e1aa8['model']=_[_0x734b('0x33')](db[_0x734b('0x2d')]['rawAttributes']);_0x2e1aa8[_0x734b('0x32')]=_['keys'](_0xe4fe38[_0x734b('0x32')]);_0x2e1aa8[_0x734b('0x34')]=_[_0x734b('0x35')](_0x2e1aa8['model'],_0x2e1aa8[_0x734b('0x32')]);_0x5cf3a0[_0x734b('0x36')]=_[_0x734b('0x35')](_0x2e1aa8[_0x734b('0x31')],qs['fields'](_0xe4fe38['query']['fields']));_0x5cf3a0[_0x734b('0x36')]=_0x5cf3a0['attributes']['length']?_0x5cf3a0[_0x734b('0x36')]:_0x2e1aa8['model'];if(_0xe4fe38[_0x734b('0x32')][_0x734b('0x44')]){_0x5cf3a0[_0x734b('0x40')]=[{'all':!![]}];}_0x5cf3a0=_[_0x734b('0x3f')]({},_0x5cf3a0,_0xe4fe38['options']);return db[_0x734b('0x2d')]['find'](_0x5cf3a0)[_0x734b('0x26')](handleEntityNotFound(_0x4c3fdc,null))[_0x734b('0x26')](respondWithResult(_0x4c3fdc,null))[_0x734b('0x42')](handleError(_0x4c3fdc,null));};exports['create']=function(_0x370326,_0x4c3efb){return db[_0x734b('0x2d')][_0x734b('0x45')](_0x370326['body'],{})[_0x734b('0x26')](respondWithResult(_0x4c3efb,0xc9))[_0x734b('0x42')](handleError(_0x4c3efb,null));};exports[_0x734b('0x25')]=function(_0x38125a,_0x21e127){if(_0x38125a['body']['id']){delete _0x38125a[_0x734b('0x46')]['id'];}return db['FreshdeskAccount'][_0x734b('0x47')]({'where':{'id':_0x38125a['params']['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x21e127,null))[_0x734b('0x26')](saveUpdates(_0x38125a[_0x734b('0x46')],null))[_0x734b('0x26')](respondWithResult(_0x21e127,null))[_0x734b('0x42')](handleError(_0x21e127,null));};exports['destroy']=function(_0x4c0378,_0x484156){return db[_0x734b('0x2d')][_0x734b('0x47')]({'where':{'id':_0x4c0378['params']['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x484156,null))[_0x734b('0x26')](removeEntity(_0x484156,null))['catch'](handleError(_0x484156,null));};exports[_0x734b('0x48')]=function(_0x3a9749,_0x44e6d2,_0x4d6501){var _0x2e95aa={};var _0x226f6c={};var _0x423b22;var _0xe605be;return db['FreshdeskAccount'][_0x734b('0x49')]({'where':{'id':_0x3a9749[_0x734b('0x4a')]['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x44e6d2,null))[_0x734b('0x26')](function(_0x4b65bf){if(_0x4b65bf){_0x423b22=_0x4b65bf;_0x226f6c[_0x734b('0x31')]=_['keys'](db[_0x734b('0x4b')][_0x734b('0x2e')]);_0x226f6c[_0x734b('0x32')]=_[_0x734b('0x33')](_0x3a9749['query']);_0x226f6c[_0x734b('0x34')]=_[_0x734b('0x35')](_0x226f6c['model'],_0x226f6c['query']);_0x2e95aa[_0x734b('0x36')]=_['intersection'](_0x226f6c[_0x734b('0x31')],qs[_0x734b('0x37')](_0x3a9749[_0x734b('0x32')]['fields']));_0x2e95aa[_0x734b('0x36')]=_0x2e95aa['attributes'][_0x734b('0x4c')]?_0x2e95aa[_0x734b('0x36')]:_0x226f6c[_0x734b('0x31')];_0x2e95aa[_0x734b('0x4d')]=qs['sort'](_0x3a9749[_0x734b('0x32')]['sort']);_0x2e95aa[_0x734b('0x3d')]=qs[_0x734b('0x34')](_[_0x734b('0x3b')](_0x3a9749['query'],_0x226f6c[_0x734b('0x34')]));if(_0x3a9749['query'][_0x734b('0x3c')]){_0x2e95aa[_0x734b('0x3d')]=_[_0x734b('0x3f')](_0x2e95aa[_0x734b('0x3d')],{'$or':_['map'](_0x2e95aa[_0x734b('0x36')],function(_0x48c613){var _0x44e876={};_0x44e876[_0x48c613]={'$like':'%'+_0x3a9749[_0x734b('0x32')][_0x734b('0x3c')]+'%'};return _0x44e876;})});}_0x2e95aa=_['merge']({},_0x2e95aa,_0x3a9749[_0x734b('0x4e')]);return _0x423b22[_0x734b('0x48')](_0x2e95aa);}})[_0x734b('0x26')](function(_0x3b16bb){if(_0x3b16bb){_0xe605be=_0x3b16bb[_0x734b('0x4c')];if(!_0x3a9749[_0x734b('0x32')][_0x734b('0x38')]('nolimit')){_0x2e95aa[_0x734b('0x1e')]=qs[_0x734b('0x1e')](_0x3a9749[_0x734b('0x32')]['limit']);_0x2e95aa['offset']=qs[_0x734b('0x1d')](_0x3a9749[_0x734b('0x32')][_0x734b('0x1d')]);}return _0x423b22[_0x734b('0x48')](_0x2e95aa);}})['then'](function(_0x565a2e){if(_0x565a2e){return _0x565a2e?{'count':_0xe605be,'rows':_0x565a2e}:null;}})['then'](respondWithResult(_0x44e6d2,null))[_0x734b('0x42')](handleError(_0x44e6d2,null));};exports[_0x734b('0x4f')]=function(_0x1f9cfe,_0x292c68,_0x1b57c5){if(_0x1f9cfe[_0x734b('0x46')]['id']){delete _0x1f9cfe[_0x734b('0x46')]['id'];}return db[_0x734b('0x2d')][_0x734b('0x49')]({'where':{'id':_0x1f9cfe[_0x734b('0x4a')]['id']}})[_0x734b('0x26')](handleEntityNotFound(_0x292c68,null))[_0x734b('0x26')](function(_0x43951a){if(_0x43951a){_0x1f9cfe[_0x734b('0x46')][_0x734b('0x50')]=_0x43951a['id'];_0x1f9cfe[_0x734b('0x46')][_0x734b('0x51')]=integrations[_0x734b('0x52')](_0x1f9cfe[_0x734b('0x46')][_0x734b('0x53')],_0x1f9cfe[_0x734b('0x46')]['type']);_0x1f9cfe[_0x734b('0x46')][_0x734b('0x54')]=integrations[_0x734b('0x55')](_0x1f9cfe[_0x734b('0x46')][_0x734b('0x53')],_0x1f9cfe['body'][_0x734b('0x30')]);return db[_0x734b('0x4b')][_0x734b('0x45')](_0x1f9cfe[_0x734b('0x46')],{'include':[{'model':db[_0x734b('0x56')],'as':_0x734b('0x51')},{'model':db['FreshdeskField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x292c68,null))['catch'](handleError(_0x292c68,null));};exports['getFields']=function(_0x3ce4bc,_0x30ffea,_0x16c9d2){var _0xb23b61='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0x3ce4bc[_0x734b('0x4a')]['id']},'attributes':['id',_0x734b('0x57'),_0x734b('0x58')]})[_0x734b('0x26')](handleEntityNotFound(_0x30ffea,null))['then'](function(_0x3b364c){if(_0x3b364c){_0xb23b61=_0x3b364c[_0x734b('0x57')];var _0x200f2d=_0xb23b61[_0x734b('0x59')](-0x1);if(_0x200f2d==='/'){_0xb23b61=_0xb23b61['substring'](0x0,_0xb23b61[_0x734b('0x5a')](_0x200f2d));}return rp({'method':'GET','uri':util[_0x734b('0x5b')](_0x734b('0x5c'),_0xb23b61,_0x734b('0x5d')),'headers':{'Authorization':util[_0x734b('0x5b')](_0x734b('0x5e'),new Buffer(util['format'](_0x734b('0x5f'),_0x3b364c[_0x734b('0x58')]))[_0x734b('0x60')](_0x734b('0x61')))},'json':!![]});}})[_0x734b('0x26')](function(_0x599ed1){if(_0x599ed1){var _0x475ecd=[_0x734b('0x62'),_0x734b('0x63'),_0x734b('0x64'),'description',_0x734b('0x1b'),_0x734b('0x65'),_0x734b('0x66'),_0x734b('0x67'),_0x734b('0x68'),'group',_0x734b('0x69')];_['remove'](_0x599ed1,function(_0x460868){return _0x475ecd[_0x734b('0x6a')](_0x460868[_0x734b('0x29')])||!_0x460868[_0x734b('0x6b')]&&_0x460868[_0x734b('0x30')]!==_0x734b('0x6c')&&_0x460868['type']!=='custom_dropdown';});return{'count':_0x599ed1['length'],'rows':_[_0x734b('0x2c')](_0x599ed1,function(_0x540ce8){return{'id':_0x540ce8[_0x734b('0x29')],'name':_0x540ce8[_0x734b('0x6d')],'custom':!_0x540ce8['default'],'options':_0x540ce8[_0x734b('0x6e')]?_[_0x734b('0x2c')](_0x540ce8[_0x734b('0x6e')],function(_0x2a3c8d){return{'name':_[_0x734b('0x6f')](_0x2a3c8d),'value':_0x2a3c8d};}):[]};})};}})[_0x734b('0x26')](respondWithResult(_0x30ffea,null))[_0x734b('0x42')](function(_0x45f05b){var _0x408625=_0x3ce4bc[_0x734b('0x32')]['test']?0x1f4:_0x45f05b[_0x734b('0x70')]||0x1f4;logger[_0x734b('0x71')](_0x734b('0x72'),'getFields',_0x408625,JSON[_0x734b('0x73')](_0x45f05b));delete _0x45f05b[_0x734b('0x29')];if(_0x408625===0x191){_0x408625=0x190;}_0x30ffea[_0x734b('0x1b')](_0x408625)[_0x734b('0x2a')](_0x3ce4bc[_0x734b('0x32')][_0x734b('0x74')]?{'message':_0x734b('0x75'),'statusCode':_0x45f05b[_0x734b('0x70')]}:_0x45f05b);});};
\ No newline at end of file
+var _0x3176=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','FreshdeskAccount','includeAll','include','catch','show','params','find','create','body','update','getConfigurations','findOne','FreshdeskConfiguration','pick','options','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','apiKey','substring','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','agent','description','priority','group','source','ticket_type','company','includes','default','custom_dropdown','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','statusCode'];(function(_0x81b35d,_0x1bb3cb){var _0x48ec0b=function(_0xad814f){while(--_0xad814f){_0x81b35d['push'](_0x81b35d['shift']());}};_0x48ec0b(++_0x1bb3cb);}(_0x3176,0x1d8));var _0x6317=function(_0x318dc3,_0x28abc0){_0x318dc3=_0x318dc3-0x0;var _0x42f814=_0x3176[_0x318dc3];return _0x42f814;};'use strict';var emlformat=require(_0x6317('0x0'));var rimraf=require(_0x6317('0x1'));var zipdir=require(_0x6317('0x2'));var jsonpatch=require(_0x6317('0x3'));var rp=require(_0x6317('0x4'));var moment=require(_0x6317('0x5'));var BPromise=require(_0x6317('0x6'));var Mustache=require(_0x6317('0x7'));var util=require(_0x6317('0x8'));var path=require(_0x6317('0x9'));var sox=require(_0x6317('0xa'));var csv=require(_0x6317('0xb'));var ejs=require(_0x6317('0xc'));var fs=require('fs');var fs_extra=require(_0x6317('0xd'));var _=require(_0x6317('0xe'));var squel=require(_0x6317('0xf'));var crypto=require('crypto');var jsforce=require(_0x6317('0x10'));var deskjs=require(_0x6317('0x11'));var toCsv=require(_0x6317('0xb'));var querystring=require('querystring');var Papa=require(_0x6317('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6317('0x13'));var as=require(_0x6317('0x14'));var hardwareService=require(_0x6317('0x15'));var logger=require(_0x6317('0x16'))(_0x6317('0x17'));var utils=require('../../config/utils');var config=require(_0x6317('0x18'));var licenseUtil=require(_0x6317('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6317('0x1a'));function respondWithStatusCode(_0x3f64fb,_0x4aa69f){_0x4aa69f=_0x4aa69f||0xcc;return function(_0x375498){if(_0x375498){return _0x3f64fb[_0x6317('0x1b')](_0x4aa69f);}return _0x3f64fb['status'](_0x4aa69f)[_0x6317('0x1c')]();};}function respondWithResult(_0x1fba31,_0x32ad4a){_0x32ad4a=_0x32ad4a||0xc8;return function(_0x42f2f8){if(_0x42f2f8){return _0x1fba31[_0x6317('0x1d')](_0x32ad4a)['json'](_0x42f2f8);}};}function respondWithFilteredResult(_0x54e857,_0x560b77){return function(_0x1b42b3){if(_0x1b42b3){var _0x55b86a=typeof _0x560b77['offset']===_0x6317('0x1e')&&typeof _0x560b77['limit']==='undefined';var _0x35caff=_0x1b42b3[_0x6317('0x1f')];var _0x4ad386=_0x55b86a?0x0:_0x560b77[_0x6317('0x20')];var _0x519851=_0x55b86a?_0x1b42b3[_0x6317('0x1f')]:_0x560b77[_0x6317('0x20')]+_0x560b77[_0x6317('0x21')];var _0x3e4332;if(_0x519851>=_0x35caff){_0x519851=_0x35caff;_0x3e4332=0xc8;}else{_0x3e4332=0xce;}_0x54e857['status'](_0x3e4332);return _0x54e857[_0x6317('0x22')](_0x6317('0x23'),_0x4ad386+'-'+_0x519851+'/'+_0x35caff)[_0x6317('0x24')](_0x1b42b3);}return null;};}function patchUpdates(_0x3687d1){return function(_0x18e081){try{jsonpatch[_0x6317('0x25')](_0x18e081,_0x3687d1,!![]);}catch(_0x8ba880){return BPromise[_0x6317('0x26')](_0x8ba880);}return _0x18e081[_0x6317('0x27')]();};}function saveUpdates(_0x1e9b7e,_0x4b8b11){return function(_0x2bb861){if(_0x2bb861){return _0x2bb861['update'](_0x1e9b7e)[_0x6317('0x28')](function(_0x4a2e3e){return _0x4a2e3e;});}return null;};}function removeEntity(_0x2b7669,_0x2a36ee){return function(_0x2ef902){if(_0x2ef902){return _0x2ef902[_0x6317('0x29')]()[_0x6317('0x28')](function(){_0x2b7669['status'](0xcc)[_0x6317('0x1c')]();});}};}function handleEntityNotFound(_0x14b136,_0x4db284){return function(_0x57739a){if(!_0x57739a){_0x14b136[_0x6317('0x1b')](0x194);}return _0x57739a;};}function handleError(_0x2b4416,_0x2ca4e7){_0x2ca4e7=_0x2ca4e7||0x1f4;return function(_0x329543){logger[_0x6317('0x2a')](_0x329543[_0x6317('0x2b')]);if(_0x329543[_0x6317('0x2c')]){delete _0x329543['name'];}_0x2b4416[_0x6317('0x1d')](_0x2ca4e7)[_0x6317('0x2d')](_0x329543);};}exports[_0x6317('0x2e')]=function(_0x5538d8,_0x343e56){var _0x1a3f96={},_0x5b3f8f={},_0x4e1a27={'count':0x0,'rows':[]};var _0x642246=_[_0x6317('0x2f')](db['FreshdeskAccount'][_0x6317('0x30')],function(_0x1fd2ff){return{'name':_0x1fd2ff[_0x6317('0x31')],'type':_0x1fd2ff[_0x6317('0x32')][_0x6317('0x33')]};});_0x5b3f8f[_0x6317('0x34')]=_[_0x6317('0x2f')](_0x642246,_0x6317('0x2c'));_0x5b3f8f[_0x6317('0x35')]=_[_0x6317('0x36')](_0x5538d8[_0x6317('0x35')]);_0x5b3f8f[_0x6317('0x37')]=_['intersection'](_0x5b3f8f[_0x6317('0x34')],_0x5b3f8f['query']);_0x1a3f96[_0x6317('0x38')]=_[_0x6317('0x39')](_0x5b3f8f[_0x6317('0x34')],qs[_0x6317('0x3a')](_0x5538d8[_0x6317('0x35')][_0x6317('0x3a')]));_0x1a3f96[_0x6317('0x38')]=_0x1a3f96[_0x6317('0x38')][_0x6317('0x3b')]?_0x1a3f96[_0x6317('0x38')]:_0x5b3f8f[_0x6317('0x34')];if(!_0x5538d8['query'][_0x6317('0x3c')](_0x6317('0x3d'))){_0x1a3f96[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x5538d8[_0x6317('0x35')][_0x6317('0x21')]);_0x1a3f96[_0x6317('0x20')]=qs[_0x6317('0x20')](_0x5538d8['query'][_0x6317('0x20')]);}_0x1a3f96[_0x6317('0x3e')]=qs['sort'](_0x5538d8[_0x6317('0x35')][_0x6317('0x3f')]);_0x1a3f96[_0x6317('0x40')]=qs[_0x6317('0x37')](_['pick'](_0x5538d8[_0x6317('0x35')],_0x5b3f8f[_0x6317('0x37')]),_0x642246);if(_0x5538d8['query'][_0x6317('0x41')]){_0x1a3f96[_0x6317('0x40')]=_[_0x6317('0x42')](_0x1a3f96[_0x6317('0x40')],{'$or':_[_0x6317('0x2f')](_0x642246,function(_0x2296a3){if(_0x2296a3[_0x6317('0x32')]!=='VIRTUAL'){var _0x5336bd={};_0x5336bd[_0x2296a3[_0x6317('0x2c')]]={'$like':'%'+_0x5538d8[_0x6317('0x35')][_0x6317('0x41')]+'%'};return _0x5336bd;}})});}_0x1a3f96=_[_0x6317('0x42')]({},_0x1a3f96,_0x5538d8['options']);var _0x155669={'where':_0x1a3f96[_0x6317('0x40')]};return db[_0x6317('0x43')][_0x6317('0x1f')](_0x155669)[_0x6317('0x28')](function(_0x4879e6){_0x4e1a27[_0x6317('0x1f')]=_0x4879e6;if(_0x5538d8[_0x6317('0x35')][_0x6317('0x44')]){_0x1a3f96[_0x6317('0x45')]=[{'all':!![]}];}return db[_0x6317('0x43')]['findAll'](_0x1a3f96);})[_0x6317('0x28')](function(_0x9fd484){_0x4e1a27['rows']=_0x9fd484;return _0x4e1a27;})[_0x6317('0x28')](respondWithFilteredResult(_0x343e56,_0x1a3f96))[_0x6317('0x46')](handleError(_0x343e56,null));};exports[_0x6317('0x47')]=function(_0x81bea6,_0x2d3690){var _0x282240={'raw':![],'where':{'id':_0x81bea6[_0x6317('0x48')]['id']}},_0x31a704={};_0x31a704[_0x6317('0x34')]=_[_0x6317('0x36')](db[_0x6317('0x43')]['rawAttributes']);_0x31a704[_0x6317('0x35')]=_['keys'](_0x81bea6[_0x6317('0x35')]);_0x31a704[_0x6317('0x37')]=_[_0x6317('0x39')](_0x31a704[_0x6317('0x34')],_0x31a704[_0x6317('0x35')]);_0x282240[_0x6317('0x38')]=_[_0x6317('0x39')](_0x31a704[_0x6317('0x34')],qs[_0x6317('0x3a')](_0x81bea6[_0x6317('0x35')][_0x6317('0x3a')]));_0x282240[_0x6317('0x38')]=_0x282240[_0x6317('0x38')][_0x6317('0x3b')]?_0x282240[_0x6317('0x38')]:_0x31a704[_0x6317('0x34')];if(_0x81bea6['query'][_0x6317('0x44')]){_0x282240[_0x6317('0x45')]=[{'all':!![]}];}_0x282240=_[_0x6317('0x42')]({},_0x282240,_0x81bea6['options']);return db['FreshdeskAccount'][_0x6317('0x49')](_0x282240)[_0x6317('0x28')](handleEntityNotFound(_0x2d3690,null))['then'](respondWithResult(_0x2d3690,null))[_0x6317('0x46')](handleError(_0x2d3690,null));};exports[_0x6317('0x4a')]=function(_0x6ff69c,_0x4b3efb){return db[_0x6317('0x43')][_0x6317('0x4a')](_0x6ff69c[_0x6317('0x4b')],{})[_0x6317('0x28')](respondWithResult(_0x4b3efb,0xc9))[_0x6317('0x46')](handleError(_0x4b3efb,null));};exports[_0x6317('0x4c')]=function(_0x238e59,_0x3fe735){if(_0x238e59['body']['id']){delete _0x238e59['body']['id'];}return db[_0x6317('0x43')][_0x6317('0x49')]({'where':{'id':_0x238e59['params']['id']}})['then'](handleEntityNotFound(_0x3fe735,null))['then'](saveUpdates(_0x238e59[_0x6317('0x4b')],null))[_0x6317('0x28')](respondWithResult(_0x3fe735,null))[_0x6317('0x46')](handleError(_0x3fe735,null));};exports[_0x6317('0x29')]=function(_0x37b673,_0x1403a4){return db[_0x6317('0x43')][_0x6317('0x49')]({'where':{'id':_0x37b673[_0x6317('0x48')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x1403a4,null))[_0x6317('0x28')](removeEntity(_0x1403a4,null))[_0x6317('0x46')](handleError(_0x1403a4,null));};exports[_0x6317('0x4d')]=function(_0x92e80d,_0x27db7b,_0x364700){var _0x3df23d={};var _0x4b2d79={};var _0x34fb93;var _0x55554b;return db[_0x6317('0x43')][_0x6317('0x4e')]({'where':{'id':_0x92e80d['params']['id']}})[_0x6317('0x28')](handleEntityNotFound(_0x27db7b,null))[_0x6317('0x28')](function(_0xdf561f){if(_0xdf561f){_0x34fb93=_0xdf561f;_0x4b2d79[_0x6317('0x34')]=_[_0x6317('0x36')](db[_0x6317('0x4f')]['rawAttributes']);_0x4b2d79['query']=_[_0x6317('0x36')](_0x92e80d[_0x6317('0x35')]);_0x4b2d79[_0x6317('0x37')]=_[_0x6317('0x39')](_0x4b2d79[_0x6317('0x34')],_0x4b2d79[_0x6317('0x35')]);_0x3df23d['attributes']=_['intersection'](_0x4b2d79['model'],qs[_0x6317('0x3a')](_0x92e80d['query'][_0x6317('0x3a')]));_0x3df23d['attributes']=_0x3df23d['attributes'][_0x6317('0x3b')]?_0x3df23d['attributes']:_0x4b2d79[_0x6317('0x34')];_0x3df23d[_0x6317('0x3e')]=qs['sort'](_0x92e80d[_0x6317('0x35')][_0x6317('0x3f')]);_0x3df23d[_0x6317('0x40')]=qs[_0x6317('0x37')](_[_0x6317('0x50')](_0x92e80d[_0x6317('0x35')],_0x4b2d79[_0x6317('0x37')]));if(_0x92e80d[_0x6317('0x35')][_0x6317('0x41')]){_0x3df23d['where']=_['merge'](_0x3df23d[_0x6317('0x40')],{'$or':_['map'](_0x3df23d[_0x6317('0x38')],function(_0x46581b){var _0x17c34c={};_0x17c34c[_0x46581b]={'$like':'%'+_0x92e80d[_0x6317('0x35')][_0x6317('0x41')]+'%'};return _0x17c34c;})});}_0x3df23d=_[_0x6317('0x42')]({},_0x3df23d,_0x92e80d[_0x6317('0x51')]);return _0x34fb93[_0x6317('0x4d')](_0x3df23d);}})[_0x6317('0x28')](function(_0x348265){if(_0x348265){_0x55554b=_0x348265[_0x6317('0x3b')];if(!_0x92e80d[_0x6317('0x35')][_0x6317('0x3c')](_0x6317('0x3d'))){_0x3df23d[_0x6317('0x21')]=qs[_0x6317('0x21')](_0x92e80d[_0x6317('0x35')][_0x6317('0x21')]);_0x3df23d[_0x6317('0x20')]=qs[_0x6317('0x20')](_0x92e80d[_0x6317('0x35')]['offset']);}return _0x34fb93[_0x6317('0x4d')](_0x3df23d);}})[_0x6317('0x28')](function(_0x90ebc){if(_0x90ebc){return _0x90ebc?{'count':_0x55554b,'rows':_0x90ebc}:null;}})[_0x6317('0x28')](respondWithResult(_0x27db7b,null))['catch'](handleError(_0x27db7b,null));};exports['addConfiguration']=function(_0x5f4b35,_0xd9ea92,_0x49df77){if(_0x5f4b35[_0x6317('0x4b')]['id']){delete _0x5f4b35[_0x6317('0x4b')]['id'];}return db['FreshdeskAccount'][_0x6317('0x4e')]({'where':{'id':_0x5f4b35[_0x6317('0x48')]['id']}})[_0x6317('0x28')](handleEntityNotFound(_0xd9ea92,null))[_0x6317('0x28')](function(_0x4c06cb){if(_0x4c06cb){_0x5f4b35[_0x6317('0x4b')][_0x6317('0x52')]=_0x4c06cb['id'];_0x5f4b35[_0x6317('0x4b')][_0x6317('0x53')]=integrations[_0x6317('0x54')](_0x5f4b35[_0x6317('0x4b')][_0x6317('0x55')],_0x5f4b35[_0x6317('0x4b')][_0x6317('0x32')]);_0x5f4b35[_0x6317('0x4b')]['Descriptions']=integrations[_0x6317('0x56')](_0x5f4b35['body'][_0x6317('0x55')],_0x5f4b35[_0x6317('0x4b')][_0x6317('0x32')]);return db[_0x6317('0x4f')][_0x6317('0x4a')](_0x5f4b35[_0x6317('0x4b')],{'include':[{'model':db[_0x6317('0x57')],'as':_0x6317('0x53')},{'model':db[_0x6317('0x57')],'as':_0x6317('0x58')}]});}return null;})[_0x6317('0x28')](respondWithResult(_0xd9ea92,null))[_0x6317('0x46')](handleError(_0xd9ea92,null));};exports[_0x6317('0x59')]=function(_0x52fada,_0x3b85b1,_0x4f0fea){var _0x460e20='';return db[_0x6317('0x43')]['findOne']({'where':{'id':_0x52fada[_0x6317('0x48')]['id']},'attributes':['id','remoteUri',_0x6317('0x5a')]})[_0x6317('0x28')](handleEntityNotFound(_0x3b85b1,null))[_0x6317('0x28')](function(_0x4495de){if(_0x4495de){_0x460e20=_0x4495de['remoteUri'];var _0x4c17c8=_0x460e20['slice'](-0x1);if(_0x4c17c8==='/'){_0x460e20=_0x460e20[_0x6317('0x5b')](0x0,_0x460e20[_0x6317('0x5c')](_0x4c17c8));}return rp({'method':_0x6317('0x5d'),'uri':util['format']('%s/%s',_0x460e20,_0x6317('0x5e')),'headers':{'Authorization':util[_0x6317('0x5f')](_0x6317('0x60'),new Buffer(util[_0x6317('0x5f')](_0x6317('0x61'),_0x4495de['apiKey']))[_0x6317('0x62')]('base64'))},'json':!![]});}})['then'](function(_0x1ea3b0){if(_0x1ea3b0){var _0x3bf3c0=[_0x6317('0x63'),_0x6317('0x64'),_0x6317('0x65'),_0x6317('0x66'),_0x6317('0x1d'),_0x6317('0x67'),_0x6317('0x68'),_0x6317('0x69'),_0x6317('0x6a'),'group',_0x6317('0x6b')];_['remove'](_0x1ea3b0,function(_0x245582){return _0x3bf3c0[_0x6317('0x6c')](_0x245582[_0x6317('0x2c')])||!_0x245582[_0x6317('0x6d')]&&_0x245582[_0x6317('0x32')]!=='custom_text'&&_0x245582[_0x6317('0x32')]!==_0x6317('0x6e');});return{'count':_0x1ea3b0[_0x6317('0x3b')],'rows':_[_0x6317('0x2f')](_0x1ea3b0,function(_0x396df1){return{'id':_0x396df1['name'],'name':_0x396df1[_0x6317('0x6f')],'custom':!_0x396df1[_0x6317('0x6d')],'options':_0x396df1[_0x6317('0x70')]?_[_0x6317('0x2f')](_0x396df1[_0x6317('0x70')],function(_0xf3fa70){return{'name':_[_0x6317('0x71')](_0xf3fa70),'value':_0xf3fa70};}):[]};})};}})['then'](respondWithResult(_0x3b85b1,null))[_0x6317('0x46')](function(_0x255905){var _0x58b01d=_0x52fada[_0x6317('0x35')]['test']?0x1f4:_0x255905['statusCode']||0x1f4;logger[_0x6317('0x2a')](_0x6317('0x72'),'getFields',_0x58b01d,JSON['stringify'](_0x255905));delete _0x255905[_0x6317('0x2c')];if(_0x58b01d===0x191){_0x58b01d=0x190;}_0x3b85b1[_0x6317('0x1d')](_0x58b01d)[_0x6317('0x2d')](_0x52fada[_0x6317('0x35')][_0x6317('0x73')]?{'message':_0x6317('0x74'),'statusCode':_0x255905[_0x6317('0x75')]}:_0x255905);});};
\ No newline at end of file
index 1c13c19..d55cee9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc607=['define','int_freshdesk_accounts','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','exports'];(function(_0x204adf,_0x2c42d9){var _0x47f606=function(_0x19f3df){while(--_0x19f3df){_0x204adf['push'](_0x204adf['shift']());}};_0x47f606(++_0x2c42d9);}(_0xc607,0x178));var _0x7c60=function(_0xb3af6c,_0x2f6628){_0xb3af6c=_0xb3af6c-0x0;var _0x36f13a=_0xc607[_0xb3af6c];return _0x36f13a;};'use strict';var _=require(_0x7c60('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7c60('0x1'));var BPromise=require(_0x7c60('0x2'));var rp=require(_0x7c60('0x3'));var fs=require('fs');var path=require(_0x7c60('0x4'));var rimraf=require(_0x7c60('0x5'));var config=require(_0x7c60('0x6'));var attributes=require(_0x7c60('0x7'));var integrations=require('../../components/integrations/configuration');module[_0x7c60('0x8')]=function(_0x2f5080,_0x42d9db){return _0x2f5080[_0x7c60('0x9')]('FreshdeskAccount',attributes,{'tableName':_0x7c60('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x678b=['moment','bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x48fab2,_0x234e78){var _0x5724c5=function(_0xb44095){while(--_0xb44095){_0x48fab2['push'](_0x48fab2['shift']());}};_0x5724c5(++_0x234e78);}(_0x678b,0x106));var _0xb678=function(_0x2caf3a,_0x1d65d6){_0x2caf3a=_0x2caf3a-0x0;var _0x34f044=_0x678b[_0x2caf3a];return _0x34f044;};'use strict';var _=require(_0xb678('0x0'));var util=require(_0xb678('0x1'));var logger=require(_0xb678('0x2'))(_0xb678('0x3'));var moment=require(_0xb678('0x4'));var BPromise=require(_0xb678('0x5'));var rp=require(_0xb678('0x6'));var fs=require('fs');var path=require(_0xb678('0x7'));var rimraf=require(_0xb678('0x8'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xb678('0x9'));module[_0xb678('0xa')]=function(_0x453020,_0x47fd36){return _0x453020[_0xb678('0xb')](_0xb678('0xc'),attributes,{'tableName':_0xb678('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ab623a1..5ba6281 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcbbf=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','stringify','find','ShowFreshdeskAccount','lodash'];(function(_0x31a3b5,_0x1cb976){var _0x252aa8=function(_0x2a2fa6){while(--_0x2a2fa6){_0x31a3b5['push'](_0x31a3b5['shift']());}};_0x252aa8(++_0x1cb976);}(_0xcbbf,0xdd));var _0xfcbb=function(_0x168920,_0x5a5a2a){_0x168920=_0x168920-0x0;var _0x55ed67=_0xcbbf[_0x168920];return _0x55ed67;};'use strict';var _=require(_0xfcbb('0x0'));var util=require(_0xfcbb('0x1'));var moment=require('moment');var BPromise=require(_0xfcbb('0x2'));var rs=require(_0xfcbb('0x3'));var fs=require('fs');var Redis=require(_0xfcbb('0x4'));var db=require(_0xfcbb('0x5'))['db'];var utils=require(_0xfcbb('0x6'));var logger=require('../../config/logger')(_0xfcbb('0x7'));var config=require(_0xfcbb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xfcbb('0x9')][_0xfcbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b7378,_0xfae687,_0x11e28c){return new BPromise(function(_0x127da3,_0x20ceb4){return client[_0xfcbb('0xb')](_0x3b7378,_0x11e28c)[_0xfcbb('0xc')](function(_0x459f15){logger[_0xfcbb('0xd')](_0xfcbb('0xe'),_0xfae687,_0xfcbb('0xf'));logger[_0xfcbb('0x10')](_0xfcbb('0x11'),_0xfae687,_0xfcbb('0xf'),JSON['stringify'](_0x459f15));if(_0x459f15[_0xfcbb('0x12')]){if(_0x459f15[_0xfcbb('0x12')][_0xfcbb('0x13')]===0x1f4){logger[_0xfcbb('0x12')](_0xfcbb('0xe'),_0xfae687,_0x459f15['error'][_0xfcbb('0x14')]);return _0x20ceb4(_0x459f15[_0xfcbb('0x12')][_0xfcbb('0x14')]);}logger[_0xfcbb('0x12')](_0xfcbb('0xe'),_0xfae687,_0x459f15[_0xfcbb('0x12')]['message']);return _0x127da3(_0x459f15['error'][_0xfcbb('0x14')]);}else{logger[_0xfcbb('0xd')](_0xfcbb('0xe'),_0xfae687,_0xfcbb('0xf'));_0x127da3(_0x459f15[_0xfcbb('0x15')][_0xfcbb('0x14')]);}})[_0xfcbb('0x16')](function(_0x45198e){logger[_0xfcbb('0x12')](_0xfcbb('0xe'),_0xfae687,_0x45198e);_0x20ceb4(_0x45198e);});});}exports['GetFreshdeskAccount']=function(_0x1cafb7){var _0x2ae906=this;return new Promise(function(_0x5b1f91,_0xc47e0){return db[_0xfcbb('0x17')][_0xfcbb('0x18')]({'raw':_0x1cafb7[_0xfcbb('0x19')]?_0x1cafb7['options'][_0xfcbb('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cafb7[_0xfcbb('0x19')]?_0x1cafb7['options'][_0xfcbb('0x1b')]||null:null,'attributes':_0x1cafb7[_0xfcbb('0x19')]?_0x1cafb7[_0xfcbb('0x19')][_0xfcbb('0x1c')]||null:null,'limit':_0x1cafb7[_0xfcbb('0x19')]?_0x1cafb7[_0xfcbb('0x19')][_0xfcbb('0x1d')]||null:null,'include':_0x1cafb7['options']?_0x1cafb7[_0xfcbb('0x19')][_0xfcbb('0x1e')]?_[_0xfcbb('0x1f')](_0x1cafb7[_0xfcbb('0x19')][_0xfcbb('0x1e')],function(_0x5eabc0){return{'model':db[_0x5eabc0[_0xfcbb('0x20')]],'as':_0x5eabc0['as'],'attributes':_0x5eabc0[_0xfcbb('0x1c')],'include':_0x5eabc0[_0xfcbb('0x1e')]?_[_0xfcbb('0x1f')](_0x5eabc0[_0xfcbb('0x1e')],function(_0x3ad864){return{'model':db[_0x3ad864[_0xfcbb('0x20')]],'as':_0x3ad864['as'],'attributes':_0x3ad864['attributes'],'include':_0x3ad864[_0xfcbb('0x1e')]?_[_0xfcbb('0x1f')](_0x3ad864['include'],function(_0x220755){return{'model':db[_0x220755[_0xfcbb('0x20')]],'as':_0x220755['as'],'attributes':_0x220755[_0xfcbb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfcbb('0xc')](function(_0x1dffd8){logger['info'](_0xfcbb('0x21'),_0x1cafb7);logger['debug']('GetFreshdeskAccount',_0x1cafb7,JSON[_0xfcbb('0x22')](_0x1dffd8));_0x5b1f91(_0x1dffd8);})[_0xfcbb('0x16')](function(_0x3087c3){logger[_0xfcbb('0x12')](_0xfcbb('0x21'),_0x3087c3[_0xfcbb('0x14')],_0x1cafb7);_0xc47e0(_0x2ae906[_0xfcbb('0x12')](0x1f4,_0x3087c3[_0xfcbb('0x14')]));});});};exports['ShowFreshdeskAccount']=function(_0xa862e7){var _0x38a4e3=this;return new Promise(function(_0x4591a5,_0x2aa03c){return db['FreshdeskAccount'][_0xfcbb('0x23')]({'raw':_0xa862e7[_0xfcbb('0x19')]?_0xa862e7['options'][_0xfcbb('0x1a')]===undefined?!![]:![]:!![],'where':_0xa862e7[_0xfcbb('0x19')]?_0xa862e7['options'][_0xfcbb('0x1b')]||null:null,'attributes':_0xa862e7[_0xfcbb('0x19')]?_0xa862e7[_0xfcbb('0x19')][_0xfcbb('0x1c')]||null:null,'include':_0xa862e7[_0xfcbb('0x19')]?_0xa862e7[_0xfcbb('0x19')][_0xfcbb('0x1e')]?_[_0xfcbb('0x1f')](_0xa862e7['options']['include'],function(_0x12eaa4){return{'model':db[_0x12eaa4['model']],'as':_0x12eaa4['as'],'attributes':_0x12eaa4['attributes'],'include':_0x12eaa4[_0xfcbb('0x1e')]?_[_0xfcbb('0x1f')](_0x12eaa4[_0xfcbb('0x1e')],function(_0x3cbee8){return{'model':db[_0x3cbee8[_0xfcbb('0x20')]],'as':_0x3cbee8['as'],'attributes':_0x3cbee8[_0xfcbb('0x1c')],'include':_0x3cbee8[_0xfcbb('0x1e')]?_['map'](_0x3cbee8['include'],function(_0x312c04){return{'model':db[_0x312c04[_0xfcbb('0x20')]],'as':_0x312c04['as'],'attributes':_0x312c04[_0xfcbb('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5db587){logger[_0xfcbb('0xd')](_0xfcbb('0x24'),_0xa862e7);logger[_0xfcbb('0x10')](_0xfcbb('0x24'),_0xa862e7,JSON[_0xfcbb('0x22')](_0x5db587));_0x4591a5(_0x5db587);})[_0xfcbb('0x16')](function(_0xf24b63){logger[_0xfcbb('0x12')](_0xfcbb('0x24'),_0xf24b63['message'],_0xa862e7);_0x2aa03c(_0x38a4e3[_0xfcbb('0x12')](0x1f4,_0xf24b63[_0xfcbb('0x14')]));});});};
\ No newline at end of file
+var _0xee35=['then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetFreshdeskAccount','FreshdeskAccount','findAll','options','where','attributes','include','map','model','debug','ShowFreshdeskAccount','find','raw','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x1958d2,_0x4249a6){var _0x5764cf=function(_0x3c9ae){while(--_0x3c9ae){_0x1958d2['push'](_0x1958d2['shift']());}};_0x5764cf(++_0x4249a6);}(_0xee35,0x1ba));var _0x5ee3=function(_0x5df780,_0x3460c8){_0x5df780=_0x5df780-0x0;var _0x535f5b=_0xee35[_0x5df780];return _0x535f5b;};'use strict';var _=require('lodash');var util=require(_0x5ee3('0x0'));var moment=require(_0x5ee3('0x1'));var BPromise=require(_0x5ee3('0x2'));var rs=require(_0x5ee3('0x3'));var fs=require('fs');var Redis=require(_0x5ee3('0x4'));var db=require(_0x5ee3('0x5'))['db'];var utils=require(_0x5ee3('0x6'));var logger=require(_0x5ee3('0x7'))(_0x5ee3('0x8'));var config=require(_0x5ee3('0x9'));var jayson=require(_0x5ee3('0xa'));var client=jayson[_0x5ee3('0xb')][_0x5ee3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xd17d33,_0x26d6b0,_0x5a63d7){return new BPromise(function(_0xde52d,_0x54b04c){return client['request'](_0xd17d33,_0x5a63d7)[_0x5ee3('0xd')](function(_0x2aef2c){logger[_0x5ee3('0xe')](_0x5ee3('0xf'),_0x26d6b0,_0x5ee3('0x10'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x26d6b0,_0x5ee3('0x10'),JSON[_0x5ee3('0x11')](_0x2aef2c));if(_0x2aef2c[_0x5ee3('0x12')]){if(_0x2aef2c[_0x5ee3('0x12')]['code']===0x1f4){logger['error'](_0x5ee3('0xf'),_0x26d6b0,_0x2aef2c[_0x5ee3('0x12')][_0x5ee3('0x13')]);return _0x54b04c(_0x2aef2c[_0x5ee3('0x12')][_0x5ee3('0x13')]);}logger[_0x5ee3('0x12')](_0x5ee3('0xf'),_0x26d6b0,_0x2aef2c[_0x5ee3('0x12')]['message']);return _0xde52d(_0x2aef2c[_0x5ee3('0x12')][_0x5ee3('0x13')]);}else{logger[_0x5ee3('0xe')](_0x5ee3('0xf'),_0x26d6b0,_0x5ee3('0x10'));_0xde52d(_0x2aef2c[_0x5ee3('0x14')][_0x5ee3('0x13')]);}})['catch'](function(_0x4cf664){logger[_0x5ee3('0x12')](_0x5ee3('0xf'),_0x26d6b0,_0x4cf664);_0x54b04c(_0x4cf664);});});}exports[_0x5ee3('0x15')]=function(_0x5d788d){var _0x3e948e=this;return new Promise(function(_0x5a132c,_0x38c73a){return db[_0x5ee3('0x16')][_0x5ee3('0x17')]({'raw':_0x5d788d['options']?_0x5d788d[_0x5ee3('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5d788d[_0x5ee3('0x18')]?_0x5d788d[_0x5ee3('0x18')][_0x5ee3('0x19')]||null:null,'attributes':_0x5d788d[_0x5ee3('0x18')]?_0x5d788d[_0x5ee3('0x18')][_0x5ee3('0x1a')]||null:null,'limit':_0x5d788d['options']?_0x5d788d[_0x5ee3('0x18')]['limit']||null:null,'include':_0x5d788d['options']?_0x5d788d[_0x5ee3('0x18')][_0x5ee3('0x1b')]?_['map'](_0x5d788d[_0x5ee3('0x18')][_0x5ee3('0x1b')],function(_0x56d7ff){return{'model':db[_0x56d7ff['model']],'as':_0x56d7ff['as'],'attributes':_0x56d7ff['attributes'],'include':_0x56d7ff[_0x5ee3('0x1b')]?_[_0x5ee3('0x1c')](_0x56d7ff[_0x5ee3('0x1b')],function(_0x2109d7){return{'model':db[_0x2109d7['model']],'as':_0x2109d7['as'],'attributes':_0x2109d7[_0x5ee3('0x1a')],'include':_0x2109d7[_0x5ee3('0x1b')]?_[_0x5ee3('0x1c')](_0x2109d7[_0x5ee3('0x1b')],function(_0x330d17){return{'model':db[_0x330d17[_0x5ee3('0x1d')]],'as':_0x330d17['as'],'attributes':_0x330d17[_0x5ee3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ee3('0xd')](function(_0xbfa99f){logger['info'](_0x5ee3('0x15'),_0x5d788d);logger[_0x5ee3('0x1e')](_0x5ee3('0x15'),_0x5d788d,JSON[_0x5ee3('0x11')](_0xbfa99f));_0x5a132c(_0xbfa99f);})['catch'](function(_0x3ac7a9){logger[_0x5ee3('0x12')](_0x5ee3('0x15'),_0x3ac7a9['message'],_0x5d788d);_0x38c73a(_0x3e948e[_0x5ee3('0x12')](0x1f4,_0x3ac7a9[_0x5ee3('0x13')]));});});};exports[_0x5ee3('0x1f')]=function(_0x9bfc92){var _0x598a9e=this;return new Promise(function(_0x30651e,_0x478f29){return db[_0x5ee3('0x16')][_0x5ee3('0x20')]({'raw':_0x9bfc92['options']?_0x9bfc92[_0x5ee3('0x18')][_0x5ee3('0x21')]===undefined?!![]:![]:!![],'where':_0x9bfc92[_0x5ee3('0x18')]?_0x9bfc92[_0x5ee3('0x18')][_0x5ee3('0x19')]||null:null,'attributes':_0x9bfc92[_0x5ee3('0x18')]?_0x9bfc92[_0x5ee3('0x18')][_0x5ee3('0x1a')]||null:null,'include':_0x9bfc92[_0x5ee3('0x18')]?_0x9bfc92[_0x5ee3('0x18')]['include']?_['map'](_0x9bfc92['options'][_0x5ee3('0x1b')],function(_0x27ab8f){return{'model':db[_0x27ab8f[_0x5ee3('0x1d')]],'as':_0x27ab8f['as'],'attributes':_0x27ab8f[_0x5ee3('0x1a')],'include':_0x27ab8f[_0x5ee3('0x1b')]?_[_0x5ee3('0x1c')](_0x27ab8f[_0x5ee3('0x1b')],function(_0x4c5a1e){return{'model':db[_0x4c5a1e[_0x5ee3('0x1d')]],'as':_0x4c5a1e['as'],'attributes':_0x4c5a1e['attributes'],'include':_0x4c5a1e[_0x5ee3('0x1b')]?_[_0x5ee3('0x1c')](_0x4c5a1e[_0x5ee3('0x1b')],function(_0x171660){return{'model':db[_0x171660[_0x5ee3('0x1d')]],'as':_0x171660['as'],'attributes':_0x171660[_0x5ee3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x5ee3('0xd')](function(_0xfb50df){logger['info']('ShowFreshdeskAccount',_0x9bfc92);logger[_0x5ee3('0x1e')](_0x5ee3('0x1f'),_0x9bfc92,JSON['stringify'](_0xfb50df));_0x30651e(_0xfb50df);})[_0x5ee3('0x22')](function(_0x1732cf){logger[_0x5ee3('0x12')](_0x5ee3('0x1f'),_0x1732cf[_0x5ee3('0x13')],_0x9bfc92);_0x478f29(_0x598a9e[_0x5ee3('0x12')](0x1f4,_0x1732cf[_0x5ee3('0x13')]));});});};
\ No newline at end of file
index d7aed68..6eee9b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbd1=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields'];(function(_0x254ea3,_0x3c229c){var _0x3f9014=function(_0x1163e1){while(--_0x1163e1){_0x254ea3['push'](_0x254ea3['shift']());}};_0x3f9014(++_0x3c229c);}(_0xbbd1,0x100));var _0x1bbd=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xbbd1[_0x1203f];return _0x365f0a;};'use strict';var multer=require(_0x1bbd('0x0'));var util=require(_0x1bbd('0x1'));var path=require('path');var timeout=require(_0x1bbd('0x2'));var express=require('express');var router=express[_0x1bbd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1bbd('0x4'));var interaction=require(_0x1bbd('0x5'));var config=require(_0x1bbd('0x6'));var controller=require(_0x1bbd('0x7'));router[_0x1bbd('0x8')]('/',auth['isAuthenticated'](),controller[_0x1bbd('0x9')]);router[_0x1bbd('0x8')](_0x1bbd('0xa'),auth[_0x1bbd('0xb')](),controller[_0x1bbd('0xc')]);router[_0x1bbd('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x1bbd('0xd')]);router['get'](_0x1bbd('0xe'),auth['isAuthenticated'](),controller[_0x1bbd('0xf')]);router[_0x1bbd('0x8')](_0x1bbd('0x10'),auth['isAuthenticated'](),controller[_0x1bbd('0x11')]);router['get'](_0x1bbd('0x12'),auth['isAuthenticated'](),controller[_0x1bbd('0x13')]);router[_0x1bbd('0x14')]('/',auth[_0x1bbd('0xb')](),controller[_0x1bbd('0x15')]);router[_0x1bbd('0x14')](_0x1bbd('0x12'),auth[_0x1bbd('0xb')](),controller['setTags']);router[_0x1bbd('0x16')](_0x1bbd('0xa'),auth[_0x1bbd('0xb')](),controller[_0x1bbd('0x17')]);router[_0x1bbd('0x18')]('/:id',auth[_0x1bbd('0xb')](),controller[_0x1bbd('0x19')]);module[_0x1bbd('0x1a')]=router;
\ No newline at end of file
+var _0xf61b=['connect-timeout','express','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','util','path'];(function(_0x10eeb3,_0x250b99){var _0x2d4f2e=function(_0x57a428){while(--_0x57a428){_0x10eeb3['push'](_0x10eeb3['shift']());}};_0x2d4f2e(++_0x250b99);}(_0xf61b,0x106));var _0xbf61=function(_0x8cb31b,_0x509016){_0x8cb31b=_0x8cb31b-0x0;var _0x2ce32e=_0xf61b[_0x8cb31b];return _0x2ce32e;};'use strict';var multer=require('multer');var util=require(_0xbf61('0x0'));var path=require(_0xbf61('0x1'));var timeout=require(_0xbf61('0x2'));var express=require(_0xbf61('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf61('0x4'));var controller=require(_0xbf61('0x5'));router[_0xbf61('0x6')]('/',auth[_0xbf61('0x7')](),controller['index']);router[_0xbf61('0x6')](_0xbf61('0x8'),auth[_0xbf61('0x7')](),controller['show']);router['get'](_0xbf61('0x9'),auth[_0xbf61('0x7')](),controller['getFields']);router[_0xbf61('0x6')](_0xbf61('0xa'),auth[_0xbf61('0x7')](),controller[_0xbf61('0xb')]);router[_0xbf61('0x6')](_0xbf61('0xc'),auth[_0xbf61('0x7')](),controller['getDescriptions']);router[_0xbf61('0x6')](_0xbf61('0xd'),auth[_0xbf61('0x7')](),controller[_0xbf61('0xe')]);router[_0xbf61('0xf')]('/',auth['isAuthenticated'](),controller[_0xbf61('0x10')]);router['post']('/:id/tags',auth[_0xbf61('0x7')](),controller[_0xbf61('0x11')]);router[_0xbf61('0x12')](_0xbf61('0x8'),auth['isAuthenticated'](),controller[_0xbf61('0x13')]);router[_0xbf61('0x14')](_0xbf61('0x8'),auth[_0xbf61('0x7')](),controller['destroy']);module[_0xbf61('0x15')]=router;
\ No newline at end of file
index c8a703c..6e74371 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x26cf=['STRING','sequelize','exports'];(function(_0x5b3b77,_0x2253a2){var _0x2d052e=function(_0x3755ed){while(--_0x3755ed){_0x5b3b77['push'](_0x5b3b77['shift']());}};_0x2d052e(++_0x2253a2);}(_0x26cf,0x1cf));var _0xf26c=function(_0x507007,_0x4876c6){_0x507007=_0x507007-0x0;var _0x160f08=_0x26cf[_0x507007];return _0x160f08;};'use strict';var Sequelize=require(_0xf26c('0x0'));module[_0xf26c('0x1')]={'name':{'type':Sequelize[_0xf26c('0x2')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xb3cf=['STRING','exports'];(function(_0x5ccf64,_0x34e890){var _0x4eb91a=function(_0x45404d){while(--_0x45404d){_0x5ccf64['push'](_0x5ccf64['shift']());}};_0x4eb91a(++_0x34e890);}(_0xb3cf,0x1ed));var _0xfb3c=function(_0x2e5cc1,_0x2dc83b){_0x2e5cc1=_0x2e5cc1-0x0;var _0x17d36b=_0xb3cf[_0x2e5cc1];return _0x17d36b;};'use strict';var Sequelize=require('sequelize');module[_0xfb3c('0x0')]={'name':{'type':Sequelize[_0xfb3c('0x1')]},'description':{'type':Sequelize[_0xfb3c('0x1')]}};
\ No newline at end of file
index eb1c3bd..a5c8d69 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e0c=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','rawAttributes','getSubjects','getDescriptions','getTags','Tag','setTags','ids','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','index','map','FreshdeskConfiguration','fieldName','type','key','model','keys','query','filters'];(function(_0x1e6db1,_0xb90700){var _0x55e924=function(_0x353c27){while(--_0x353c27){_0x1e6db1['push'](_0x1e6db1['shift']());}};_0x55e924(++_0xb90700);}(_0x4e0c,0x11c));var _0xc4e0=function(_0xdefbc3,_0x1ea49a){_0xdefbc3=_0xdefbc3-0x0;var _0x367798=_0x4e0c[_0xdefbc3];return _0x367798;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc4e0('0x0'));var jsonpatch=require(_0xc4e0('0x1'));var rp=require(_0xc4e0('0x2'));var moment=require(_0xc4e0('0x3'));var BPromise=require(_0xc4e0('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xc4e0('0x5'));var sox=require(_0xc4e0('0x6'));var csv=require(_0xc4e0('0x7'));var ejs=require(_0xc4e0('0x8'));var fs=require('fs');var fs_extra=require(_0xc4e0('0x9'));var _=require(_0xc4e0('0xa'));var squel=require(_0xc4e0('0xb'));var crypto=require(_0xc4e0('0xc'));var jsforce=require(_0xc4e0('0xd'));var deskjs=require(_0xc4e0('0xe'));var toCsv=require(_0xc4e0('0x7'));var querystring=require(_0xc4e0('0xf'));var Papa=require(_0xc4e0('0x10'));var Redis=require(_0xc4e0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc4e0('0x12'));var as=require(_0xc4e0('0x13'));var hardwareService=require(_0xc4e0('0x14'));var logger=require(_0xc4e0('0x15'))('api');var utils=require(_0xc4e0('0x16'));var config=require(_0xc4e0('0x17'));var licenseUtil=require(_0xc4e0('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23e9d7,_0xba2cd9){_0xba2cd9=_0xba2cd9||0xcc;return function(_0x5f46df){if(_0x5f46df){return _0x23e9d7[_0xc4e0('0x19')](_0xba2cd9);}return _0x23e9d7[_0xc4e0('0x1a')](_0xba2cd9)[_0xc4e0('0x1b')]();};}function respondWithResult(_0x1afdc8,_0x1ab370){_0x1ab370=_0x1ab370||0xc8;return function(_0x36812d){if(_0x36812d){return _0x1afdc8[_0xc4e0('0x1a')](_0x1ab370)['json'](_0x36812d);}};}function respondWithFilteredResult(_0xff86df,_0x2bc58d){return function(_0x205335){if(_0x205335){var _0x258b4c=typeof _0x2bc58d[_0xc4e0('0x1c')]===_0xc4e0('0x1d')&&typeof _0x2bc58d['limit']===_0xc4e0('0x1d');var _0x21a13a=_0x205335[_0xc4e0('0x1e')];var _0x27aa33=_0x258b4c?0x0:_0x2bc58d['offset'];var _0x1698f3=_0x258b4c?_0x205335['count']:_0x2bc58d['offset']+_0x2bc58d[_0xc4e0('0x1f')];var _0x4e9859;if(_0x1698f3>=_0x21a13a){_0x1698f3=_0x21a13a;_0x4e9859=0xc8;}else{_0x4e9859=0xce;}_0xff86df[_0xc4e0('0x1a')](_0x4e9859);return _0xff86df[_0xc4e0('0x20')](_0xc4e0('0x21'),_0x27aa33+'-'+_0x1698f3+'/'+_0x21a13a)[_0xc4e0('0x22')](_0x205335);}return null;};}function patchUpdates(_0x1d2ffc){return function(_0x3a839){try{jsonpatch[_0xc4e0('0x23')](_0x3a839,_0x1d2ffc,!![]);}catch(_0x5a7f5b){return BPromise[_0xc4e0('0x24')](_0x5a7f5b);}return _0x3a839['save']();};}function saveUpdates(_0x415b2a,_0x228e66){return function(_0x1ac529){if(_0x1ac529){return _0x1ac529[_0xc4e0('0x25')](_0x415b2a)[_0xc4e0('0x26')](function(_0x5b9931){return _0x5b9931;});}return null;};}function removeEntity(_0x58ea83,_0x426107){return function(_0x42fa4b){if(_0x42fa4b){return _0x42fa4b[_0xc4e0('0x27')]()[_0xc4e0('0x26')](function(){_0x58ea83[_0xc4e0('0x1a')](0xcc)[_0xc4e0('0x1b')]();});}};}function handleEntityNotFound(_0x167f26,_0x2a30d9){return function(_0x5e441b){if(!_0x5e441b){_0x167f26[_0xc4e0('0x19')](0x194);}return _0x5e441b;};}function handleError(_0x3dec82,_0x42e68c){_0x42e68c=_0x42e68c||0x1f4;return function(_0x1d31dd){logger['error'](_0x1d31dd[_0xc4e0('0x28')]);if(_0x1d31dd[_0xc4e0('0x29')]){delete _0x1d31dd[_0xc4e0('0x29')];}_0x3dec82[_0xc4e0('0x1a')](_0x42e68c)['send'](_0x1d31dd);};}exports[_0xc4e0('0x2a')]=function(_0x538a0c,_0x13ba70){var _0x43ba89={},_0x570d97={},_0x5e61a3={'count':0x0,'rows':[]};var _0x14a1fa=_[_0xc4e0('0x2b')](db[_0xc4e0('0x2c')]['rawAttributes'],function(_0x139654){return{'name':_0x139654[_0xc4e0('0x2d')],'type':_0x139654[_0xc4e0('0x2e')][_0xc4e0('0x2f')]};});_0x570d97[_0xc4e0('0x30')]=_[_0xc4e0('0x2b')](_0x14a1fa,'name');_0x570d97['query']=_[_0xc4e0('0x31')](_0x538a0c[_0xc4e0('0x32')]);_0x570d97[_0xc4e0('0x33')]=_['intersection'](_0x570d97[_0xc4e0('0x30')],_0x570d97[_0xc4e0('0x32')]);_0x43ba89['attributes']=_[_0xc4e0('0x34')](_0x570d97[_0xc4e0('0x30')],qs[_0xc4e0('0x35')](_0x538a0c[_0xc4e0('0x32')]['fields']));_0x43ba89[_0xc4e0('0x36')]=_0x43ba89[_0xc4e0('0x36')][_0xc4e0('0x37')]?_0x43ba89[_0xc4e0('0x36')]:_0x570d97[_0xc4e0('0x30')];if(!_0x538a0c[_0xc4e0('0x32')][_0xc4e0('0x38')](_0xc4e0('0x39'))){_0x43ba89[_0xc4e0('0x1f')]=qs['limit'](_0x538a0c[_0xc4e0('0x32')]['limit']);_0x43ba89[_0xc4e0('0x1c')]=qs['offset'](_0x538a0c[_0xc4e0('0x32')][_0xc4e0('0x1c')]);}_0x43ba89[_0xc4e0('0x3a')]=qs[_0xc4e0('0x3b')](_0x538a0c[_0xc4e0('0x32')][_0xc4e0('0x3b')]);_0x43ba89[_0xc4e0('0x3c')]=qs[_0xc4e0('0x33')](_[_0xc4e0('0x3d')](_0x538a0c[_0xc4e0('0x32')],_0x570d97['filters']),_0x14a1fa);if(_0x538a0c[_0xc4e0('0x32')][_0xc4e0('0x3e')]){_0x43ba89['where']=_['merge'](_0x43ba89[_0xc4e0('0x3c')],{'$or':_[_0xc4e0('0x2b')](_0x14a1fa,function(_0xa97418){if(_0xa97418[_0xc4e0('0x2e')]!==_0xc4e0('0x3f')){var _0x45f7ad={};_0x45f7ad[_0xa97418['name']]={'$like':'%'+_0x538a0c['query']['filter']+'%'};return _0x45f7ad;}})});}_0x43ba89=_[_0xc4e0('0x40')]({},_0x43ba89,_0x538a0c[_0xc4e0('0x41')]);var _0x900dad={'where':_0x43ba89[_0xc4e0('0x3c')]};return db[_0xc4e0('0x2c')]['count'](_0x900dad)[_0xc4e0('0x26')](function(_0xb066ae){_0x5e61a3[_0xc4e0('0x1e')]=_0xb066ae;if(_0x538a0c['query']['includeAll']){_0x43ba89['include']=[{'all':!![]}];}return db[_0xc4e0('0x2c')][_0xc4e0('0x42')](_0x43ba89);})['then'](function(_0x308ff5){_0x5e61a3[_0xc4e0('0x43')]=_0x308ff5;return _0x5e61a3;})[_0xc4e0('0x26')](respondWithFilteredResult(_0x13ba70,_0x43ba89))[_0xc4e0('0x44')](handleError(_0x13ba70,null));};exports[_0xc4e0('0x45')]=function(_0x3689f0,_0xc09948){var _0x3af1f6={'raw':![],'where':{'id':_0x3689f0[_0xc4e0('0x46')]['id']}},_0x15cefe={};_0x15cefe[_0xc4e0('0x30')]=_[_0xc4e0('0x31')](db['FreshdeskConfiguration']['rawAttributes']);_0x15cefe[_0xc4e0('0x32')]=_[_0xc4e0('0x31')](_0x3689f0[_0xc4e0('0x32')]);_0x15cefe[_0xc4e0('0x33')]=_[_0xc4e0('0x34')](_0x15cefe[_0xc4e0('0x30')],_0x15cefe[_0xc4e0('0x32')]);_0x3af1f6[_0xc4e0('0x36')]=_['intersection'](_0x15cefe['model'],qs[_0xc4e0('0x35')](_0x3689f0[_0xc4e0('0x32')][_0xc4e0('0x35')]));_0x3af1f6[_0xc4e0('0x36')]=_0x3af1f6[_0xc4e0('0x36')]['length']?_0x3af1f6[_0xc4e0('0x36')]:_0x15cefe['model'];if(_0x3689f0[_0xc4e0('0x32')][_0xc4e0('0x47')]){_0x3af1f6['include']=[{'all':!![]}];}_0x3af1f6=_[_0xc4e0('0x40')]({},_0x3af1f6,_0x3689f0[_0xc4e0('0x41')]);return db[_0xc4e0('0x2c')][_0xc4e0('0x48')](_0x3af1f6)[_0xc4e0('0x26')](handleEntityNotFound(_0xc09948,null))[_0xc4e0('0x26')](respondWithResult(_0xc09948,null))['catch'](handleError(_0xc09948,null));};exports[_0xc4e0('0x49')]=function(_0x159a4d,_0x1c4354){return db[_0xc4e0('0x2c')][_0xc4e0('0x49')](_0x159a4d[_0xc4e0('0x4a')],{})[_0xc4e0('0x26')](respondWithResult(_0x1c4354,0xc9))['catch'](handleError(_0x1c4354,null));};exports[_0xc4e0('0x25')]=function(_0x7afeb8,_0x48e24d){if(_0x7afeb8['body']['id']){delete _0x7afeb8[_0xc4e0('0x4a')]['id'];}return db['FreshdeskConfiguration'][_0xc4e0('0x48')]({'where':{'id':_0x7afeb8[_0xc4e0('0x46')]['id']}})[_0xc4e0('0x26')](handleEntityNotFound(_0x48e24d,null))[_0xc4e0('0x26')](saveUpdates(_0x7afeb8[_0xc4e0('0x4a')],null))[_0xc4e0('0x26')](respondWithResult(_0x48e24d,null))[_0xc4e0('0x44')](handleError(_0x48e24d,null));};exports[_0xc4e0('0x27')]=function(_0x370207,_0x58bfa6){return db[_0xc4e0('0x2c')][_0xc4e0('0x48')]({'where':{'id':_0x370207[_0xc4e0('0x46')]['id']}})[_0xc4e0('0x26')](handleEntityNotFound(_0x58bfa6,null))[_0xc4e0('0x26')](removeEntity(_0x58bfa6,null))[_0xc4e0('0x44')](handleError(_0x58bfa6,null));};exports[_0xc4e0('0x4b')]=function(_0x1fd848,_0x4a49dd,_0x5cc13e){var _0x56511e={};var _0x1cbf6f={};var _0x246677;var _0x3fd94e;return db[_0xc4e0('0x2c')][_0xc4e0('0x4c')]({'where':{'id':_0x1fd848[_0xc4e0('0x46')]['id']}})[_0xc4e0('0x26')](handleEntityNotFound(_0x4a49dd,null))[_0xc4e0('0x26')](function(_0x570725){if(_0x570725){_0x246677=_0x570725;_0x1cbf6f[_0xc4e0('0x30')]=_['keys'](db['FreshdeskField'][_0xc4e0('0x4d')]);_0x1cbf6f['query']=_[_0xc4e0('0x31')](_0x1fd848['query']);_0x1cbf6f['filters']=_[_0xc4e0('0x34')](_0x1cbf6f[_0xc4e0('0x30')],_0x1cbf6f['query']);_0x56511e[_0xc4e0('0x36')]=_[_0xc4e0('0x34')](_0x1cbf6f['model'],qs[_0xc4e0('0x35')](_0x1fd848[_0xc4e0('0x32')][_0xc4e0('0x35')]));_0x56511e[_0xc4e0('0x36')]=_0x56511e[_0xc4e0('0x36')]['length']?_0x56511e[_0xc4e0('0x36')]:_0x1cbf6f[_0xc4e0('0x30')];_0x56511e['order']=qs['sort'](_0x1fd848[_0xc4e0('0x32')][_0xc4e0('0x3b')]);_0x56511e[_0xc4e0('0x3c')]=qs[_0xc4e0('0x33')](_['pick'](_0x1fd848['query'],_0x1cbf6f['filters']));if(_0x1fd848['query'][_0xc4e0('0x3e')]){_0x56511e[_0xc4e0('0x3c')]=_[_0xc4e0('0x40')](_0x56511e[_0xc4e0('0x3c')],{'$or':_[_0xc4e0('0x2b')](_0x56511e['attributes'],function(_0x39f5f3){var _0x3efeae={};_0x3efeae[_0x39f5f3]={'$like':'%'+_0x1fd848[_0xc4e0('0x32')][_0xc4e0('0x3e')]+'%'};return _0x3efeae;})});}_0x56511e=_[_0xc4e0('0x40')]({},_0x56511e,_0x1fd848[_0xc4e0('0x41')]);return _0x246677[_0xc4e0('0x4b')](_0x56511e);}})[_0xc4e0('0x26')](function(_0x1a7c98){if(_0x1a7c98){_0x3fd94e=_0x1a7c98['length'];if(!_0x1fd848[_0xc4e0('0x32')][_0xc4e0('0x38')]('nolimit')){_0x56511e[_0xc4e0('0x1f')]=qs[_0xc4e0('0x1f')](_0x1fd848[_0xc4e0('0x32')][_0xc4e0('0x1f')]);_0x56511e['offset']=qs[_0xc4e0('0x1c')](_0x1fd848[_0xc4e0('0x32')][_0xc4e0('0x1c')]);}return _0x246677['getFields'](_0x56511e);}})[_0xc4e0('0x26')](function(_0x144662){if(_0x144662){return _0x144662?{'count':_0x3fd94e,'rows':_0x144662}:null;}})[_0xc4e0('0x26')](respondWithResult(_0x4a49dd,null))[_0xc4e0('0x44')](handleError(_0x4a49dd,null));};exports[_0xc4e0('0x4e')]=function(_0x51e42a,_0x4b1812,_0x588b7a){var _0x5df182={};var _0x23391b={};var _0x10c312;var _0x57fb51;return db['FreshdeskConfiguration'][_0xc4e0('0x4c')]({'where':{'id':_0x51e42a[_0xc4e0('0x46')]['id']}})[_0xc4e0('0x26')](handleEntityNotFound(_0x4b1812,null))['then'](function(_0x3ed21f){if(_0x3ed21f){_0x10c312=_0x3ed21f;_0x23391b['model']=_[_0xc4e0('0x31')](db['FreshdeskField'][_0xc4e0('0x4d')]);_0x23391b['query']=_[_0xc4e0('0x31')](_0x51e42a[_0xc4e0('0x32')]);_0x23391b['filters']=_[_0xc4e0('0x34')](_0x23391b['model'],_0x23391b[_0xc4e0('0x32')]);_0x5df182[_0xc4e0('0x36')]=_['intersection'](_0x23391b['model'],qs[_0xc4e0('0x35')](_0x51e42a[_0xc4e0('0x32')][_0xc4e0('0x35')]));_0x5df182[_0xc4e0('0x36')]=_0x5df182[_0xc4e0('0x36')][_0xc4e0('0x37')]?_0x5df182[_0xc4e0('0x36')]:_0x23391b[_0xc4e0('0x30')];_0x5df182[_0xc4e0('0x3a')]=qs['sort'](_0x51e42a['query'][_0xc4e0('0x3b')]);_0x5df182['where']=qs['filters'](_['pick'](_0x51e42a[_0xc4e0('0x32')],_0x23391b[_0xc4e0('0x33')]));if(_0x51e42a[_0xc4e0('0x32')][_0xc4e0('0x3e')]){_0x5df182[_0xc4e0('0x3c')]=_[_0xc4e0('0x40')](_0x5df182[_0xc4e0('0x3c')],{'$or':_[_0xc4e0('0x2b')](_0x5df182[_0xc4e0('0x36')],function(_0x147708){var _0xea1dfa={};_0xea1dfa[_0x147708]={'$like':'%'+_0x51e42a[_0xc4e0('0x32')]['filter']+'%'};return _0xea1dfa;})});}_0x5df182=_[_0xc4e0('0x40')]({},_0x5df182,_0x51e42a[_0xc4e0('0x41')]);return _0x10c312[_0xc4e0('0x4e')](_0x5df182);}})[_0xc4e0('0x26')](function(_0x1e2bfc){if(_0x1e2bfc){_0x57fb51=_0x1e2bfc['length'];if(!_0x51e42a[_0xc4e0('0x32')][_0xc4e0('0x38')]('nolimit')){_0x5df182[_0xc4e0('0x1f')]=qs[_0xc4e0('0x1f')](_0x51e42a[_0xc4e0('0x32')][_0xc4e0('0x1f')]);_0x5df182[_0xc4e0('0x1c')]=qs[_0xc4e0('0x1c')](_0x51e42a[_0xc4e0('0x32')][_0xc4e0('0x1c')]);}return _0x10c312[_0xc4e0('0x4e')](_0x5df182);}})[_0xc4e0('0x26')](function(_0x494d5c){if(_0x494d5c){return _0x494d5c?{'count':_0x57fb51,'rows':_0x494d5c}:null;}})[_0xc4e0('0x26')](respondWithResult(_0x4b1812,null))[_0xc4e0('0x44')](handleError(_0x4b1812,null));};exports[_0xc4e0('0x4f')]=function(_0x855902,_0x40e62e,_0x3835a3){var _0x6cedef={};var _0x1a0e08={};var _0x19f3c5;var _0x5e1217;return db[_0xc4e0('0x2c')][_0xc4e0('0x4c')]({'where':{'id':_0x855902[_0xc4e0('0x46')]['id']}})[_0xc4e0('0x26')](handleEntityNotFound(_0x40e62e,null))['then'](function(_0x29c5fc){if(_0x29c5fc){_0x19f3c5=_0x29c5fc;_0x1a0e08[_0xc4e0('0x30')]=_[_0xc4e0('0x31')](db['FreshdeskField']['rawAttributes']);_0x1a0e08[_0xc4e0('0x32')]=_['keys'](_0x855902['query']);_0x1a0e08[_0xc4e0('0x33')]=_[_0xc4e0('0x34')](_0x1a0e08[_0xc4e0('0x30')],_0x1a0e08['query']);_0x6cedef['attributes']=_[_0xc4e0('0x34')](_0x1a0e08[_0xc4e0('0x30')],qs[_0xc4e0('0x35')](_0x855902[_0xc4e0('0x32')]['fields']));_0x6cedef[_0xc4e0('0x36')]=_0x6cedef[_0xc4e0('0x36')][_0xc4e0('0x37')]?_0x6cedef[_0xc4e0('0x36')]:_0x1a0e08[_0xc4e0('0x30')];_0x6cedef[_0xc4e0('0x3a')]=qs[_0xc4e0('0x3b')](_0x855902[_0xc4e0('0x32')]['sort']);_0x6cedef[_0xc4e0('0x3c')]=qs[_0xc4e0('0x33')](_[_0xc4e0('0x3d')](_0x855902[_0xc4e0('0x32')],_0x1a0e08[_0xc4e0('0x33')]));if(_0x855902[_0xc4e0('0x32')]['filter']){_0x6cedef[_0xc4e0('0x3c')]=_[_0xc4e0('0x40')](_0x6cedef[_0xc4e0('0x3c')],{'$or':_[_0xc4e0('0x2b')](_0x6cedef[_0xc4e0('0x36')],function(_0x3f2879){var _0x378a92={};_0x378a92[_0x3f2879]={'$like':'%'+_0x855902[_0xc4e0('0x32')][_0xc4e0('0x3e')]+'%'};return _0x378a92;})});}_0x6cedef=_[_0xc4e0('0x40')]({},_0x6cedef,_0x855902['options']);return _0x19f3c5[_0xc4e0('0x4f')](_0x6cedef);}})['then'](function(_0x1f1ace){if(_0x1f1ace){_0x5e1217=_0x1f1ace[_0xc4e0('0x37')];if(!_0x855902['query'][_0xc4e0('0x38')](_0xc4e0('0x39'))){_0x6cedef[_0xc4e0('0x1f')]=qs[_0xc4e0('0x1f')](_0x855902[_0xc4e0('0x32')]['limit']);_0x6cedef[_0xc4e0('0x1c')]=qs['offset'](_0x855902['query']['offset']);}return _0x19f3c5[_0xc4e0('0x4f')](_0x6cedef);}})[_0xc4e0('0x26')](function(_0x79ef85){if(_0x79ef85){return _0x79ef85?{'count':_0x5e1217,'rows':_0x79ef85}:null;}})['then'](respondWithResult(_0x40e62e,null))[_0xc4e0('0x44')](handleError(_0x40e62e,null));};exports[_0xc4e0('0x50')]=function(_0x4721c5,_0x2887aa,_0x31d37f){var _0x2fb405={};var _0x3f5d54={};var _0x2d7d29;var _0x46a443;return db[_0xc4e0('0x2c')][_0xc4e0('0x4c')]({'where':{'id':_0x4721c5[_0xc4e0('0x46')]['id']}})['then'](handleEntityNotFound(_0x2887aa,null))['then'](function(_0x1dc34b){if(_0x1dc34b){_0x2d7d29=_0x1dc34b;_0x3f5d54[_0xc4e0('0x30')]=_[_0xc4e0('0x31')](db[_0xc4e0('0x51')][_0xc4e0('0x4d')]);_0x3f5d54[_0xc4e0('0x32')]=_[_0xc4e0('0x31')](_0x4721c5[_0xc4e0('0x32')]);_0x3f5d54['filters']=_[_0xc4e0('0x34')](_0x3f5d54[_0xc4e0('0x30')],_0x3f5d54[_0xc4e0('0x32')]);_0x2fb405[_0xc4e0('0x36')]=_['intersection'](_0x3f5d54[_0xc4e0('0x30')],qs['fields'](_0x4721c5[_0xc4e0('0x32')][_0xc4e0('0x35')]));_0x2fb405[_0xc4e0('0x36')]=_0x2fb405[_0xc4e0('0x36')]['length']?_0x2fb405['attributes']:_0x3f5d54['model'];_0x2fb405[_0xc4e0('0x3a')]=qs[_0xc4e0('0x3b')](_0x4721c5[_0xc4e0('0x32')][_0xc4e0('0x3b')]);_0x2fb405[_0xc4e0('0x3c')]=qs[_0xc4e0('0x33')](_[_0xc4e0('0x3d')](_0x4721c5[_0xc4e0('0x32')],_0x3f5d54[_0xc4e0('0x33')]));if(_0x4721c5[_0xc4e0('0x32')][_0xc4e0('0x3e')]){_0x2fb405[_0xc4e0('0x3c')]=_['merge'](_0x2fb405['where'],{'$or':_['map'](_0x2fb405['attributes'],function(_0x575a1a){var _0x12c384={};_0x12c384[_0x575a1a]={'$like':'%'+_0x4721c5[_0xc4e0('0x32')][_0xc4e0('0x3e')]+'%'};return _0x12c384;})});}_0x2fb405=_[_0xc4e0('0x40')]({},_0x2fb405,_0x4721c5[_0xc4e0('0x41')]);return _0x2d7d29[_0xc4e0('0x50')](_0x2fb405);}})[_0xc4e0('0x26')](function(_0xcf8ac4){if(_0xcf8ac4){_0x46a443=_0xcf8ac4['length'];if(!_0x4721c5[_0xc4e0('0x32')][_0xc4e0('0x38')](_0xc4e0('0x39'))){_0x2fb405['limit']=qs[_0xc4e0('0x1f')](_0x4721c5[_0xc4e0('0x32')][_0xc4e0('0x1f')]);_0x2fb405['offset']=qs['offset'](_0x4721c5[_0xc4e0('0x32')]['offset']);}return _0x2d7d29[_0xc4e0('0x50')](_0x2fb405);}})[_0xc4e0('0x26')](function(_0xd384cc){if(_0xd384cc){return _0xd384cc?{'count':_0x46a443,'rows':_0xd384cc}:null;}})[_0xc4e0('0x26')](respondWithResult(_0x2887aa,null))[_0xc4e0('0x44')](handleError(_0x2887aa,null));};exports['setTags']=function(_0x432c52,_0x3d8e92,_0x1b6d03){if(_0x432c52[_0xc4e0('0x4a')]['id']){delete _0x432c52['body']['id'];}return db['FreshdeskConfiguration'][_0xc4e0('0x4c')]({'where':{'id':_0x432c52[_0xc4e0('0x46')]['id']}})[_0xc4e0('0x26')](handleEntityNotFound(_0x3d8e92,null))[_0xc4e0('0x26')](function(_0x3f5134){if(_0x3f5134){return _0x3f5134[_0xc4e0('0x52')](_0x432c52[_0xc4e0('0x4a')][_0xc4e0('0x53')]||[]);}return null;})[_0xc4e0('0x26')](respondWithResult(_0x3d8e92,null))[_0xc4e0('0x44')](handleError(_0x3d8e92,null));};
\ No newline at end of file
+var _0x58e4=['name','send','index','map','fieldName','type','key','keys','filters','intersection','model','attributes','fields','length','query','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','includeAll','include','rows','catch','params','find','create','body','getFields','findOne','FreshdeskField','rawAttributes','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','json','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3a7298,_0x27058){var _0x2504e8=function(_0x1932ec){while(--_0x1932ec){_0x3a7298['push'](_0x3a7298['shift']());}};_0x2504e8(++_0x27058);}(_0x58e4,0x128));var _0x458e=function(_0x12b8ec,_0x1655be){_0x12b8ec=_0x12b8ec-0x0;var _0x21af77=_0x58e4[_0x12b8ec];return _0x21af77;};'use strict';var emlformat=require(_0x458e('0x0'));var rimraf=require(_0x458e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x458e('0x2'));var rp=require(_0x458e('0x3'));var moment=require('moment');var BPromise=require(_0x458e('0x4'));var Mustache=require('mustache');var util=require(_0x458e('0x5'));var path=require(_0x458e('0x6'));var sox=require('sox');var csv=require(_0x458e('0x7'));var ejs=require(_0x458e('0x8'));var fs=require('fs');var fs_extra=require(_0x458e('0x9'));var _=require(_0x458e('0xa'));var squel=require(_0x458e('0xb'));var crypto=require('crypto');var jsforce=require(_0x458e('0xc'));var deskjs=require(_0x458e('0xd'));var toCsv=require(_0x458e('0x7'));var querystring=require(_0x458e('0xe'));var Papa=require('papaparse');var Redis=require(_0x458e('0xf'));var authService=require(_0x458e('0x10'));var qs=require(_0x458e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x458e('0x12'));var logger=require('../../config/logger')(_0x458e('0x13'));var utils=require('../../config/utils');var config=require(_0x458e('0x14'));var licenseUtil=require(_0x458e('0x15'));var db=require(_0x458e('0x16'))['db'];function respondWithStatusCode(_0x228f8c,_0x3d0071){_0x3d0071=_0x3d0071||0xcc;return function(_0x122011){if(_0x122011){return _0x228f8c[_0x458e('0x17')](_0x3d0071);}return _0x228f8c['status'](_0x3d0071)[_0x458e('0x18')]();};}function respondWithResult(_0x10f7bf,_0x3d7d19){_0x3d7d19=_0x3d7d19||0xc8;return function(_0x4f1b06){if(_0x4f1b06){return _0x10f7bf['status'](_0x3d7d19)['json'](_0x4f1b06);}};}function respondWithFilteredResult(_0x42ce68,_0x534a1f){return function(_0x4c5330){if(_0x4c5330){var _0x571357=typeof _0x534a1f['offset']===_0x458e('0x19')&&typeof _0x534a1f[_0x458e('0x1a')]===_0x458e('0x19');var _0x13ba00=_0x4c5330[_0x458e('0x1b')];var _0x444593=_0x571357?0x0:_0x534a1f['offset'];var _0x2d407d=_0x571357?_0x4c5330[_0x458e('0x1b')]:_0x534a1f[_0x458e('0x1c')]+_0x534a1f[_0x458e('0x1a')];var _0x2447c7;if(_0x2d407d>=_0x13ba00){_0x2d407d=_0x13ba00;_0x2447c7=0xc8;}else{_0x2447c7=0xce;}_0x42ce68[_0x458e('0x1d')](_0x2447c7);return _0x42ce68[_0x458e('0x1e')]('Content-Range',_0x444593+'-'+_0x2d407d+'/'+_0x13ba00)[_0x458e('0x1f')](_0x4c5330);}return null;};}function patchUpdates(_0x2f8b3e){return function(_0x1a8e68){try{jsonpatch[_0x458e('0x20')](_0x1a8e68,_0x2f8b3e,!![]);}catch(_0x43893e){return BPromise[_0x458e('0x21')](_0x43893e);}return _0x1a8e68[_0x458e('0x22')]();};}function saveUpdates(_0xe91672,_0x1ae495){return function(_0x5b062c){if(_0x5b062c){return _0x5b062c[_0x458e('0x23')](_0xe91672)[_0x458e('0x24')](function(_0x22bbed){return _0x22bbed;});}return null;};}function removeEntity(_0x9586e0,_0x442420){return function(_0x16b996){if(_0x16b996){return _0x16b996[_0x458e('0x25')]()[_0x458e('0x24')](function(){_0x9586e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbaf4df,_0x451ec5){return function(_0x245416){if(!_0x245416){_0xbaf4df[_0x458e('0x17')](0x194);}return _0x245416;};}function handleError(_0x2ae330,_0x47093d){_0x47093d=_0x47093d||0x1f4;return function(_0x30923c){logger[_0x458e('0x26')](_0x30923c[_0x458e('0x27')]);if(_0x30923c[_0x458e('0x28')]){delete _0x30923c['name'];}_0x2ae330[_0x458e('0x1d')](_0x47093d)[_0x458e('0x29')](_0x30923c);};}exports[_0x458e('0x2a')]=function(_0x17a123,_0x34cd76){var _0x3afb3a={},_0x3cea37={},_0x548403={'count':0x0,'rows':[]};var _0x53cc1f=_[_0x458e('0x2b')](db['FreshdeskConfiguration']['rawAttributes'],function(_0x2b34a7){return{'name':_0x2b34a7[_0x458e('0x2c')],'type':_0x2b34a7[_0x458e('0x2d')][_0x458e('0x2e')]};});_0x3cea37['model']=_[_0x458e('0x2b')](_0x53cc1f,_0x458e('0x28'));_0x3cea37['query']=_[_0x458e('0x2f')](_0x17a123['query']);_0x3cea37[_0x458e('0x30')]=_[_0x458e('0x31')](_0x3cea37[_0x458e('0x32')],_0x3cea37['query']);_0x3afb3a[_0x458e('0x33')]=_[_0x458e('0x31')](_0x3cea37[_0x458e('0x32')],qs['fields'](_0x17a123['query'][_0x458e('0x34')]));_0x3afb3a['attributes']=_0x3afb3a[_0x458e('0x33')][_0x458e('0x35')]?_0x3afb3a[_0x458e('0x33')]:_0x3cea37[_0x458e('0x32')];if(!_0x17a123[_0x458e('0x36')][_0x458e('0x37')]('nolimit')){_0x3afb3a[_0x458e('0x1a')]=qs[_0x458e('0x1a')](_0x17a123['query']['limit']);_0x3afb3a[_0x458e('0x1c')]=qs[_0x458e('0x1c')](_0x17a123[_0x458e('0x36')][_0x458e('0x1c')]);}_0x3afb3a[_0x458e('0x38')]=qs[_0x458e('0x39')](_0x17a123[_0x458e('0x36')]['sort']);_0x3afb3a[_0x458e('0x3a')]=qs['filters'](_[_0x458e('0x3b')](_0x17a123[_0x458e('0x36')],_0x3cea37[_0x458e('0x30')]),_0x53cc1f);if(_0x17a123[_0x458e('0x36')][_0x458e('0x3c')]){_0x3afb3a['where']=_[_0x458e('0x3d')](_0x3afb3a[_0x458e('0x3a')],{'$or':_[_0x458e('0x2b')](_0x53cc1f,function(_0x3969d2){if(_0x3969d2[_0x458e('0x2d')]!==_0x458e('0x3e')){var _0x1edc8f={};_0x1edc8f[_0x3969d2[_0x458e('0x28')]]={'$like':'%'+_0x17a123[_0x458e('0x36')][_0x458e('0x3c')]+'%'};return _0x1edc8f;}})});}_0x3afb3a=_[_0x458e('0x3d')]({},_0x3afb3a,_0x17a123[_0x458e('0x3f')]);var _0x3db191={'where':_0x3afb3a[_0x458e('0x3a')]};return db[_0x458e('0x40')][_0x458e('0x1b')](_0x3db191)[_0x458e('0x24')](function(_0x57a65e){_0x548403[_0x458e('0x1b')]=_0x57a65e;if(_0x17a123['query'][_0x458e('0x41')]){_0x3afb3a[_0x458e('0x42')]=[{'all':!![]}];}return db[_0x458e('0x40')]['findAll'](_0x3afb3a);})[_0x458e('0x24')](function(_0x68158e){_0x548403[_0x458e('0x43')]=_0x68158e;return _0x548403;})[_0x458e('0x24')](respondWithFilteredResult(_0x34cd76,_0x3afb3a))[_0x458e('0x44')](handleError(_0x34cd76,null));};exports['show']=function(_0x288b77,_0x40c61d){var _0x541e7b={'raw':![],'where':{'id':_0x288b77[_0x458e('0x45')]['id']}},_0x364e28={};_0x364e28['model']=_[_0x458e('0x2f')](db[_0x458e('0x40')]['rawAttributes']);_0x364e28[_0x458e('0x36')]=_['keys'](_0x288b77['query']);_0x364e28[_0x458e('0x30')]=_[_0x458e('0x31')](_0x364e28[_0x458e('0x32')],_0x364e28[_0x458e('0x36')]);_0x541e7b['attributes']=_[_0x458e('0x31')](_0x364e28[_0x458e('0x32')],qs[_0x458e('0x34')](_0x288b77[_0x458e('0x36')][_0x458e('0x34')]));_0x541e7b[_0x458e('0x33')]=_0x541e7b[_0x458e('0x33')][_0x458e('0x35')]?_0x541e7b[_0x458e('0x33')]:_0x364e28[_0x458e('0x32')];if(_0x288b77[_0x458e('0x36')]['includeAll']){_0x541e7b['include']=[{'all':!![]}];}_0x541e7b=_[_0x458e('0x3d')]({},_0x541e7b,_0x288b77[_0x458e('0x3f')]);return db['FreshdeskConfiguration'][_0x458e('0x46')](_0x541e7b)[_0x458e('0x24')](handleEntityNotFound(_0x40c61d,null))[_0x458e('0x24')](respondWithResult(_0x40c61d,null))['catch'](handleError(_0x40c61d,null));};exports[_0x458e('0x47')]=function(_0x432495,_0x176a60){return db[_0x458e('0x40')][_0x458e('0x47')](_0x432495[_0x458e('0x48')],{})[_0x458e('0x24')](respondWithResult(_0x176a60,0xc9))[_0x458e('0x44')](handleError(_0x176a60,null));};exports[_0x458e('0x23')]=function(_0x5b485c,_0x3d8062){if(_0x5b485c[_0x458e('0x48')]['id']){delete _0x5b485c[_0x458e('0x48')]['id'];}return db['FreshdeskConfiguration'][_0x458e('0x46')]({'where':{'id':_0x5b485c['params']['id']}})[_0x458e('0x24')](handleEntityNotFound(_0x3d8062,null))['then'](saveUpdates(_0x5b485c[_0x458e('0x48')],null))[_0x458e('0x24')](respondWithResult(_0x3d8062,null))[_0x458e('0x44')](handleError(_0x3d8062,null));};exports[_0x458e('0x25')]=function(_0x4836bd,_0x2b3092){return db['FreshdeskConfiguration'][_0x458e('0x46')]({'where':{'id':_0x4836bd[_0x458e('0x45')]['id']}})[_0x458e('0x24')](handleEntityNotFound(_0x2b3092,null))[_0x458e('0x24')](removeEntity(_0x2b3092,null))[_0x458e('0x44')](handleError(_0x2b3092,null));};exports[_0x458e('0x49')]=function(_0x5a52f8,_0x474cd9,_0x197c8c){var _0x4fda38={};var _0xda47c6={};var _0x118325;var _0x3502c8;return db[_0x458e('0x40')][_0x458e('0x4a')]({'where':{'id':_0x5a52f8[_0x458e('0x45')]['id']}})['then'](handleEntityNotFound(_0x474cd9,null))['then'](function(_0x1abb1e){if(_0x1abb1e){_0x118325=_0x1abb1e;_0xda47c6['model']=_[_0x458e('0x2f')](db[_0x458e('0x4b')][_0x458e('0x4c')]);_0xda47c6[_0x458e('0x36')]=_[_0x458e('0x2f')](_0x5a52f8['query']);_0xda47c6['filters']=_[_0x458e('0x31')](_0xda47c6[_0x458e('0x32')],_0xda47c6['query']);_0x4fda38[_0x458e('0x33')]=_['intersection'](_0xda47c6['model'],qs[_0x458e('0x34')](_0x5a52f8[_0x458e('0x36')]['fields']));_0x4fda38['attributes']=_0x4fda38[_0x458e('0x33')][_0x458e('0x35')]?_0x4fda38['attributes']:_0xda47c6[_0x458e('0x32')];_0x4fda38[_0x458e('0x38')]=qs[_0x458e('0x39')](_0x5a52f8[_0x458e('0x36')][_0x458e('0x39')]);_0x4fda38[_0x458e('0x3a')]=qs[_0x458e('0x30')](_['pick'](_0x5a52f8['query'],_0xda47c6[_0x458e('0x30')]));if(_0x5a52f8[_0x458e('0x36')][_0x458e('0x3c')]){_0x4fda38[_0x458e('0x3a')]=_[_0x458e('0x3d')](_0x4fda38[_0x458e('0x3a')],{'$or':_['map'](_0x4fda38[_0x458e('0x33')],function(_0x4f3802){var _0xdf152a={};_0xdf152a[_0x4f3802]={'$like':'%'+_0x5a52f8[_0x458e('0x36')]['filter']+'%'};return _0xdf152a;})});}_0x4fda38=_[_0x458e('0x3d')]({},_0x4fda38,_0x5a52f8[_0x458e('0x3f')]);return _0x118325[_0x458e('0x49')](_0x4fda38);}})['then'](function(_0x1fa452){if(_0x1fa452){_0x3502c8=_0x1fa452[_0x458e('0x35')];if(!_0x5a52f8['query'][_0x458e('0x37')](_0x458e('0x4d'))){_0x4fda38[_0x458e('0x1a')]=qs[_0x458e('0x1a')](_0x5a52f8[_0x458e('0x36')][_0x458e('0x1a')]);_0x4fda38[_0x458e('0x1c')]=qs[_0x458e('0x1c')](_0x5a52f8[_0x458e('0x36')][_0x458e('0x1c')]);}return _0x118325[_0x458e('0x49')](_0x4fda38);}})[_0x458e('0x24')](function(_0x11509a){if(_0x11509a){return _0x11509a?{'count':_0x3502c8,'rows':_0x11509a}:null;}})[_0x458e('0x24')](respondWithResult(_0x474cd9,null))[_0x458e('0x44')](handleError(_0x474cd9,null));};exports[_0x458e('0x4e')]=function(_0x4e6615,_0x4d21dc,_0x21c325){var _0x1b6e63={};var _0xb959a3={};var _0x247cc4;var _0x147094;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x4e6615[_0x458e('0x45')]['id']}})[_0x458e('0x24')](handleEntityNotFound(_0x4d21dc,null))[_0x458e('0x24')](function(_0x5477ee){if(_0x5477ee){_0x247cc4=_0x5477ee;_0xb959a3[_0x458e('0x32')]=_[_0x458e('0x2f')](db[_0x458e('0x4b')][_0x458e('0x4c')]);_0xb959a3[_0x458e('0x36')]=_['keys'](_0x4e6615[_0x458e('0x36')]);_0xb959a3[_0x458e('0x30')]=_[_0x458e('0x31')](_0xb959a3[_0x458e('0x32')],_0xb959a3[_0x458e('0x36')]);_0x1b6e63[_0x458e('0x33')]=_[_0x458e('0x31')](_0xb959a3[_0x458e('0x32')],qs[_0x458e('0x34')](_0x4e6615[_0x458e('0x36')]['fields']));_0x1b6e63['attributes']=_0x1b6e63[_0x458e('0x33')][_0x458e('0x35')]?_0x1b6e63[_0x458e('0x33')]:_0xb959a3[_0x458e('0x32')];_0x1b6e63[_0x458e('0x38')]=qs['sort'](_0x4e6615[_0x458e('0x36')][_0x458e('0x39')]);_0x1b6e63['where']=qs[_0x458e('0x30')](_[_0x458e('0x3b')](_0x4e6615['query'],_0xb959a3['filters']));if(_0x4e6615[_0x458e('0x36')]['filter']){_0x1b6e63[_0x458e('0x3a')]=_[_0x458e('0x3d')](_0x1b6e63[_0x458e('0x3a')],{'$or':_['map'](_0x1b6e63[_0x458e('0x33')],function(_0x24e27d){var _0x32d6e0={};_0x32d6e0[_0x24e27d]={'$like':'%'+_0x4e6615[_0x458e('0x36')]['filter']+'%'};return _0x32d6e0;})});}_0x1b6e63=_[_0x458e('0x3d')]({},_0x1b6e63,_0x4e6615[_0x458e('0x3f')]);return _0x247cc4[_0x458e('0x4e')](_0x1b6e63);}})[_0x458e('0x24')](function(_0x5da54c){if(_0x5da54c){_0x147094=_0x5da54c['length'];if(!_0x4e6615[_0x458e('0x36')][_0x458e('0x37')](_0x458e('0x4d'))){_0x1b6e63[_0x458e('0x1a')]=qs[_0x458e('0x1a')](_0x4e6615[_0x458e('0x36')]['limit']);_0x1b6e63[_0x458e('0x1c')]=qs[_0x458e('0x1c')](_0x4e6615[_0x458e('0x36')][_0x458e('0x1c')]);}return _0x247cc4[_0x458e('0x4e')](_0x1b6e63);}})[_0x458e('0x24')](function(_0x3ac60c){if(_0x3ac60c){return _0x3ac60c?{'count':_0x147094,'rows':_0x3ac60c}:null;}})['then'](respondWithResult(_0x4d21dc,null))['catch'](handleError(_0x4d21dc,null));};exports[_0x458e('0x4f')]=function(_0x59e550,_0x440dbe,_0x25b26c){var _0x50aeb5={};var _0x16684c={};var _0x2114f4;var _0x1bdc11;return db[_0x458e('0x40')]['findOne']({'where':{'id':_0x59e550[_0x458e('0x45')]['id']}})['then'](handleEntityNotFound(_0x440dbe,null))[_0x458e('0x24')](function(_0x2bdafd){if(_0x2bdafd){_0x2114f4=_0x2bdafd;_0x16684c['model']=_[_0x458e('0x2f')](db[_0x458e('0x4b')][_0x458e('0x4c')]);_0x16684c[_0x458e('0x36')]=_[_0x458e('0x2f')](_0x59e550['query']);_0x16684c[_0x458e('0x30')]=_['intersection'](_0x16684c['model'],_0x16684c['query']);_0x50aeb5[_0x458e('0x33')]=_[_0x458e('0x31')](_0x16684c['model'],qs[_0x458e('0x34')](_0x59e550['query'][_0x458e('0x34')]));_0x50aeb5[_0x458e('0x33')]=_0x50aeb5[_0x458e('0x33')][_0x458e('0x35')]?_0x50aeb5[_0x458e('0x33')]:_0x16684c[_0x458e('0x32')];_0x50aeb5[_0x458e('0x38')]=qs[_0x458e('0x39')](_0x59e550[_0x458e('0x36')][_0x458e('0x39')]);_0x50aeb5['where']=qs['filters'](_[_0x458e('0x3b')](_0x59e550[_0x458e('0x36')],_0x16684c['filters']));if(_0x59e550['query']['filter']){_0x50aeb5[_0x458e('0x3a')]=_[_0x458e('0x3d')](_0x50aeb5[_0x458e('0x3a')],{'$or':_[_0x458e('0x2b')](_0x50aeb5['attributes'],function(_0xe89dd1){var _0x4b7a63={};_0x4b7a63[_0xe89dd1]={'$like':'%'+_0x59e550['query']['filter']+'%'};return _0x4b7a63;})});}_0x50aeb5=_[_0x458e('0x3d')]({},_0x50aeb5,_0x59e550['options']);return _0x2114f4['getDescriptions'](_0x50aeb5);}})[_0x458e('0x24')](function(_0x339b3e){if(_0x339b3e){_0x1bdc11=_0x339b3e[_0x458e('0x35')];if(!_0x59e550[_0x458e('0x36')][_0x458e('0x37')](_0x458e('0x4d'))){_0x50aeb5[_0x458e('0x1a')]=qs['limit'](_0x59e550['query']['limit']);_0x50aeb5[_0x458e('0x1c')]=qs[_0x458e('0x1c')](_0x59e550['query']['offset']);}return _0x2114f4['getDescriptions'](_0x50aeb5);}})[_0x458e('0x24')](function(_0x22a2f9){if(_0x22a2f9){return _0x22a2f9?{'count':_0x1bdc11,'rows':_0x22a2f9}:null;}})['then'](respondWithResult(_0x440dbe,null))[_0x458e('0x44')](handleError(_0x440dbe,null));};exports[_0x458e('0x50')]=function(_0x1217bb,_0x2fa34c,_0x32f552){var _0x1818a1={};var _0x47a1ab={};var _0x25e884;var _0x106a1c;return db[_0x458e('0x40')]['findOne']({'where':{'id':_0x1217bb[_0x458e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2fa34c,null))[_0x458e('0x24')](function(_0xc67825){if(_0xc67825){_0x25e884=_0xc67825;_0x47a1ab[_0x458e('0x32')]=_[_0x458e('0x2f')](db[_0x458e('0x51')][_0x458e('0x4c')]);_0x47a1ab['query']=_['keys'](_0x1217bb[_0x458e('0x36')]);_0x47a1ab[_0x458e('0x30')]=_[_0x458e('0x31')](_0x47a1ab[_0x458e('0x32')],_0x47a1ab[_0x458e('0x36')]);_0x1818a1[_0x458e('0x33')]=_['intersection'](_0x47a1ab['model'],qs[_0x458e('0x34')](_0x1217bb[_0x458e('0x36')]['fields']));_0x1818a1[_0x458e('0x33')]=_0x1818a1[_0x458e('0x33')][_0x458e('0x35')]?_0x1818a1[_0x458e('0x33')]:_0x47a1ab[_0x458e('0x32')];_0x1818a1[_0x458e('0x38')]=qs[_0x458e('0x39')](_0x1217bb[_0x458e('0x36')][_0x458e('0x39')]);_0x1818a1[_0x458e('0x3a')]=qs[_0x458e('0x30')](_[_0x458e('0x3b')](_0x1217bb['query'],_0x47a1ab[_0x458e('0x30')]));if(_0x1217bb[_0x458e('0x36')]['filter']){_0x1818a1['where']=_[_0x458e('0x3d')](_0x1818a1['where'],{'$or':_[_0x458e('0x2b')](_0x1818a1['attributes'],function(_0x3e4ce6){var _0x14cf8f={};_0x14cf8f[_0x3e4ce6]={'$like':'%'+_0x1217bb['query'][_0x458e('0x3c')]+'%'};return _0x14cf8f;})});}_0x1818a1=_[_0x458e('0x3d')]({},_0x1818a1,_0x1217bb['options']);return _0x25e884['getTags'](_0x1818a1);}})[_0x458e('0x24')](function(_0x468bf2){if(_0x468bf2){_0x106a1c=_0x468bf2[_0x458e('0x35')];if(!_0x1217bb[_0x458e('0x36')]['hasOwnProperty'](_0x458e('0x4d'))){_0x1818a1[_0x458e('0x1a')]=qs[_0x458e('0x1a')](_0x1217bb[_0x458e('0x36')]['limit']);_0x1818a1['offset']=qs[_0x458e('0x1c')](_0x1217bb['query'][_0x458e('0x1c')]);}return _0x25e884[_0x458e('0x50')](_0x1818a1);}})['then'](function(_0x5231e4){if(_0x5231e4){return _0x5231e4?{'count':_0x106a1c,'rows':_0x5231e4}:null;}})[_0x458e('0x24')](respondWithResult(_0x2fa34c,null))[_0x458e('0x44')](handleError(_0x2fa34c,null));};exports[_0x458e('0x52')]=function(_0x283451,_0x3c0eaa,_0x23514a){if(_0x283451[_0x458e('0x48')]['id']){delete _0x283451[_0x458e('0x48')]['id'];}return db[_0x458e('0x40')][_0x458e('0x4a')]({'where':{'id':_0x283451[_0x458e('0x45')]['id']}})[_0x458e('0x24')](handleEntityNotFound(_0x3c0eaa,null))[_0x458e('0x24')](function(_0x56e98d){if(_0x56e98d){return _0x56e98d[_0x458e('0x52')](_0x283451['body'][_0x458e('0x53')]||[]);}return null;})[_0x458e('0x24')](respondWithResult(_0x3c0eaa,null))['catch'](handleError(_0x3c0eaa,null));};
\ No newline at end of file
index b191a36..c731cf3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2e33=['int_freshdesk_configurations','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration'];(function(_0x11273e,_0x3821a6){var _0x1e8616=function(_0x439d86){while(--_0x439d86){_0x11273e['push'](_0x11273e['shift']());}};_0x1e8616(++_0x3821a6);}(_0x2e33,0x79));var _0x32e3=function(_0x5411b9,_0x2726ba){_0x5411b9=_0x5411b9-0x0;var _0x30a7fd=_0x2e33[_0x5411b9];return _0x30a7fd;};'use strict';var _=require(_0x32e3('0x0'));var util=require(_0x32e3('0x1'));var logger=require('../../config/logger')(_0x32e3('0x2'));var moment=require(_0x32e3('0x3'));var BPromise=require('bluebird');var rp=require(_0x32e3('0x4'));var fs=require('fs');var path=require(_0x32e3('0x5'));var rimraf=require(_0x32e3('0x6'));var config=require(_0x32e3('0x7'));var attributes=require(_0x32e3('0x8'));module['exports']=function(_0x34631a,_0x3c7f6c){return _0x34631a[_0x32e3('0x9')](_0x32e3('0xa'),attributes,{'tableName':_0x32e3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa8ce=['../../config/environment','./intFreshdeskConfiguration.attributes','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8ce,0x171));var _0xea8c=function(_0x3cc916,_0x4b1a3c){_0x3cc916=_0x3cc916-0x0;var _0x21a1ee=_0xa8ce[_0x3cc916];return _0x21a1ee;};'use strict';var _=require(_0xea8c('0x0'));var util=require(_0xea8c('0x1'));var logger=require(_0xea8c('0x2'))(_0xea8c('0x3'));var moment=require(_0xea8c('0x4'));var BPromise=require('bluebird');var rp=require(_0xea8c('0x5'));var fs=require('fs');var path=require(_0xea8c('0x6'));var rimraf=require(_0xea8c('0x7'));var config=require(_0xea8c('0x8'));var attributes=require(_0xea8c('0x9'));module['exports']=function(_0x3c4bed,_0xcf1cf3){return _0x3c4bed[_0xea8c('0xa')](_0xea8c('0xb'),attributes,{'tableName':_0xea8c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8924ac8..d7660e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0de0=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x481c5e,_0x5f03bf){var _0x2d3ea0=function(_0x11cf2b){while(--_0x11cf2b){_0x481c5e['push'](_0x481c5e['shift']());}};_0x2d3ea0(++_0x5f03bf);}(_0x0de0,0xc6));var _0x00de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0de0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x00de('0x0'));var util=require('util');var moment=require(_0x00de('0x1'));var BPromise=require(_0x00de('0x2'));var rs=require(_0x00de('0x3'));var fs=require('fs');var Redis=require(_0x00de('0x4'));var db=require(_0x00de('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x00de('0x6'))(_0x00de('0x7'));var config=require(_0x00de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x00de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x190455,_0x492da9,_0xe79ef8){return new BPromise(function(_0x4bf2be,_0x572054){return client['request'](_0x190455,_0xe79ef8)[_0x00de('0xa')](function(_0xbbf6f9){logger[_0x00de('0xb')](_0x00de('0xc'),_0x492da9,_0x00de('0xd'));logger[_0x00de('0xe')](_0x00de('0xf'),_0x492da9,_0x00de('0xd'),JSON[_0x00de('0x10')](_0xbbf6f9));if(_0xbbf6f9[_0x00de('0x11')]){if(_0xbbf6f9[_0x00de('0x11')][_0x00de('0x12')]===0x1f4){logger['error'](_0x00de('0xc'),_0x492da9,_0xbbf6f9['error'][_0x00de('0x13')]);return _0x572054(_0xbbf6f9[_0x00de('0x11')][_0x00de('0x13')]);}logger[_0x00de('0x11')](_0x00de('0xc'),_0x492da9,_0xbbf6f9[_0x00de('0x11')][_0x00de('0x13')]);return _0x4bf2be(_0xbbf6f9[_0x00de('0x11')][_0x00de('0x13')]);}else{logger[_0x00de('0xb')](_0x00de('0xc'),_0x492da9,'request\x20sent');_0x4bf2be(_0xbbf6f9[_0x00de('0x14')][_0x00de('0x13')]);}})[_0x00de('0x15')](function(_0x48e761){logger[_0x00de('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x492da9,_0x48e761);_0x572054(_0x48e761);});});}
\ No newline at end of file
+var _0xd9c5=['request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x514530,_0x56ed87){var _0x5a2045=function(_0x2c359f){while(--_0x2c359f){_0x514530['push'](_0x514530['shift']());}};_0x5a2045(++_0x56ed87);}(_0xd9c5,0xf4));var _0x5d9c=function(_0x5e6d44,_0x21b4f1){_0x5e6d44=_0x5e6d44-0x0;var _0x32c80c=_0xd9c5[_0x5e6d44];return _0x32c80c;};'use strict';var _=require('lodash');var util=require(_0x5d9c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5d9c('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x5d9c('0x2'));var logger=require('../../config/logger')(_0x5d9c('0x3'));var config=require(_0x5d9c('0x4'));var jayson=require(_0x5d9c('0x5'));var client=jayson[_0x5d9c('0x6')][_0x5d9c('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1475c5,_0x2d573c,_0x5374f5){return new BPromise(function(_0x49f6ea,_0x348ae7){return client[_0x5d9c('0x8')](_0x1475c5,_0x5374f5)[_0x5d9c('0x9')](function(_0x3848cc){logger[_0x5d9c('0xa')](_0x5d9c('0xb'),_0x2d573c,_0x5d9c('0xc'));logger['debug'](_0x5d9c('0xd'),_0x2d573c,_0x5d9c('0xc'),JSON[_0x5d9c('0xe')](_0x3848cc));if(_0x3848cc['error']){if(_0x3848cc[_0x5d9c('0xf')]['code']===0x1f4){logger[_0x5d9c('0xf')](_0x5d9c('0xb'),_0x2d573c,_0x3848cc[_0x5d9c('0xf')]['message']);return _0x348ae7(_0x3848cc[_0x5d9c('0xf')]['message']);}logger['error'](_0x5d9c('0xb'),_0x2d573c,_0x3848cc[_0x5d9c('0xf')][_0x5d9c('0x10')]);return _0x49f6ea(_0x3848cc[_0x5d9c('0xf')][_0x5d9c('0x10')]);}else{logger['info'](_0x5d9c('0xb'),_0x2d573c,_0x5d9c('0xc'));_0x49f6ea(_0x3848cc[_0x5d9c('0x11')][_0x5d9c('0x10')]);}})['catch'](function(_0x2d10ff){logger[_0x5d9c('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2d573c,_0x2d10ff);_0x348ae7(_0x2d10ff);});});}
\ No newline at end of file
index 3a4ee6d..0160f8d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x239d=['create','put','update','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','isAuthenticated','index','/:id','show','post'];(function(_0x2b5dbe,_0x1447f9){var _0x2e0e12=function(_0x7fbba6){while(--_0x7fbba6){_0x2b5dbe['push'](_0x2b5dbe['shift']());}};_0x2e0e12(++_0x1447f9);}(_0x239d,0x89));var _0xd239=function(_0x29c49c,_0x3f4dbf){_0x29c49c=_0x29c49c-0x0;var _0x5658a5=_0x239d[_0x29c49c];return _0x5658a5;};'use strict';var multer=require(_0xd239('0x0'));var util=require(_0xd239('0x1'));var path=require(_0xd239('0x2'));var timeout=require(_0xd239('0x3'));var express=require(_0xd239('0x4'));var router=express['Router']();var fs_extra=require(_0xd239('0x5'));var auth=require(_0xd239('0x6'));var interaction=require(_0xd239('0x7'));var config=require(_0xd239('0x8'));var controller=require(_0xd239('0x9'));router['get']('/',auth[_0xd239('0xa')](),controller[_0xd239('0xb')]);router['get'](_0xd239('0xc'),auth[_0xd239('0xa')](),controller[_0xd239('0xd')]);router[_0xd239('0xe')]('/',auth[_0xd239('0xa')](),controller[_0xd239('0xf')]);router[_0xd239('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd239('0x11')]);router['delete'](_0xd239('0xc'),auth['isAuthenticated'](),controller[_0xd239('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0xb0de=['put','isAuthenticated','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','get','/:id','show','create'];(function(_0xb3e53,_0x2583db){var _0x385233=function(_0x444fe8){while(--_0x444fe8){_0xb3e53['push'](_0xb3e53['shift']());}};_0x385233(++_0x2583db);}(_0xb0de,0x198));var _0xeb0d=function(_0x116201,_0x1d3f76){_0x116201=_0x116201-0x0;var _0x2794d8=_0xb0de[_0x116201];return _0x2794d8;};'use strict';var multer=require(_0xeb0d('0x0'));var util=require(_0xeb0d('0x1'));var path=require(_0xeb0d('0x2'));var timeout=require(_0xeb0d('0x3'));var express=require(_0xeb0d('0x4'));var router=express['Router']();var fs_extra=require(_0xeb0d('0x5'));var auth=require(_0xeb0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xeb0d('0x7'));var controller=require('./intFreshdeskField.controller');router[_0xeb0d('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeb0d('0x8')](_0xeb0d('0x9'),auth['isAuthenticated'](),controller[_0xeb0d('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0xeb0d('0xb')]);router[_0xeb0d('0xc')](_0xeb0d('0x9'),auth[_0xeb0d('0xd')](),controller['update']);router['delete'](_0xeb0d('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xeb0d('0xe')]=router;
\ No newline at end of file
index cee0de5..68f60e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1433=['sequelize','exports','ENUM','variable','customVariable','picklist','STRING','string','BOOLEAN'];(function(_0x174a2d,_0x44cf92){var _0x3a58c3=function(_0x43afaf){while(--_0x43afaf){_0x174a2d['push'](_0x174a2d['shift']());}};_0x3a58c3(++_0x44cf92);}(_0x1433,0x120));var _0x3143=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1433[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x3143('0x0'));module[_0x3143('0x1')]={'type':{'type':Sequelize[_0x3143('0x2')]('string',_0x3143('0x3'),_0x3143('0x4'),'keyValue',_0x3143('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3143('0x6')]},'key':{'type':Sequelize[_0x3143('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x3143('0x7'),_0x3143('0x3'),_0x3143('0x4'))},'keyContent':{'type':Sequelize[_0x3143('0x6')]},'idField':{'type':Sequelize[_0x3143('0x6')]},'nameField':{'type':Sequelize[_0x3143('0x6')]},'customField':{'type':Sequelize[_0x3143('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3143('0x6')]}};
\ No newline at end of file
+var _0xc367=['sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN'];(function(_0x46e2d0,_0x4f1d11){var _0x1c7c01=function(_0x3472d8){while(--_0x3472d8){_0x46e2d0['push'](_0x46e2d0['shift']());}};_0x1c7c01(++_0x4f1d11);}(_0xc367,0x1ef));var _0x7c36=function(_0x2bb556,_0x202392){_0x2bb556=_0x2bb556-0x0;var _0xd6d2b8=_0xc367[_0x2bb556];return _0xd6d2b8;};'use strict';var Sequelize=require(_0x7c36('0x0'));module[_0x7c36('0x1')]={'type':{'type':Sequelize[_0x7c36('0x2')]('string',_0x7c36('0x3'),_0x7c36('0x4'),_0x7c36('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x7c36('0x6'),'variable',_0x7c36('0x4'))},'keyContent':{'type':Sequelize[_0x7c36('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7c36('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7c36('0x7')]}};
\ No newline at end of file
index c9834e5..a303d78 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1339=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','Content-Range','then','destroy','end','sendStatus','error','name','send','index','map','FreshdeskField','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','keys','rawAttributes','create','body','update','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x43576f,_0x1356ed){var _0x4d2466=function(_0x865deb){while(--_0x865deb){_0x43576f['push'](_0x43576f['shift']());}};_0x4d2466(++_0x1356ed);}(_0x1339,0x1ed));var _0x9133=function(_0x1853e2,_0x5ab6a6){_0x1853e2=_0x1853e2-0x0;var _0x7e0bc6=_0x1339[_0x1853e2];return _0x7e0bc6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9133('0x0'));var jsonpatch=require(_0x9133('0x1'));var rp=require(_0x9133('0x2'));var moment=require(_0x9133('0x3'));var BPromise=require(_0x9133('0x4'));var Mustache=require(_0x9133('0x5'));var util=require(_0x9133('0x6'));var path=require(_0x9133('0x7'));var sox=require('sox');var csv=require(_0x9133('0x8'));var ejs=require(_0x9133('0x9'));var fs=require('fs');var fs_extra=require(_0x9133('0xa'));var _=require('lodash');var squel=require(_0x9133('0xb'));var crypto=require(_0x9133('0xc'));var jsforce=require(_0x9133('0xd'));var deskjs=require(_0x9133('0xe'));var toCsv=require(_0x9133('0x8'));var querystring=require(_0x9133('0xf'));var Papa=require(_0x9133('0x10'));var Redis=require(_0x9133('0x11'));var authService=require(_0x9133('0x12'));var qs=require(_0x9133('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9133('0x14'));var logger=require(_0x9133('0x15'))(_0x9133('0x16'));var utils=require(_0x9133('0x17'));var config=require(_0x9133('0x18'));var licenseUtil=require(_0x9133('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb64550,_0x7cc59e){_0x7cc59e=_0x7cc59e||0xcc;return function(_0x4bbfdc){if(_0x4bbfdc){return _0xb64550['sendStatus'](_0x7cc59e);}return _0xb64550[_0x9133('0x1a')](_0x7cc59e)['end']();};}function respondWithResult(_0x22132a,_0x439e1a){_0x439e1a=_0x439e1a||0xc8;return function(_0x17dfd1){if(_0x17dfd1){return _0x22132a[_0x9133('0x1a')](_0x439e1a)[_0x9133('0x1b')](_0x17dfd1);}};}function respondWithFilteredResult(_0x4327b3,_0x49cc5d){return function(_0x13f8fc){if(_0x13f8fc){var _0x1e23ce=typeof _0x49cc5d['offset']===_0x9133('0x1c')&&typeof _0x49cc5d[_0x9133('0x1d')]===_0x9133('0x1c');var _0x427663=_0x13f8fc['count'];var _0x1f3484=_0x1e23ce?0x0:_0x49cc5d['offset'];var _0x3c48ef=_0x1e23ce?_0x13f8fc['count']:_0x49cc5d[_0x9133('0x1e')]+_0x49cc5d[_0x9133('0x1d')];var _0x5e8620;if(_0x3c48ef>=_0x427663){_0x3c48ef=_0x427663;_0x5e8620=0xc8;}else{_0x5e8620=0xce;}_0x4327b3[_0x9133('0x1a')](_0x5e8620);return _0x4327b3['set'](_0x9133('0x1f'),_0x1f3484+'-'+_0x3c48ef+'/'+_0x427663)['json'](_0x13f8fc);}return null;};}function patchUpdates(_0x5e4f0c){return function(_0x2f7354){try{jsonpatch['apply'](_0x2f7354,_0x5e4f0c,!![]);}catch(_0x12c2d4){return BPromise['reject'](_0x12c2d4);}return _0x2f7354['save']();};}function saveUpdates(_0x4c846e,_0x2e99a1){return function(_0x2dcfb8){if(_0x2dcfb8){return _0x2dcfb8['update'](_0x4c846e)[_0x9133('0x20')](function(_0x3f5d0e){return _0x3f5d0e;});}return null;};}function removeEntity(_0xff08d5,_0x26190c){return function(_0x4f26e8){if(_0x4f26e8){return _0x4f26e8[_0x9133('0x21')]()['then'](function(){_0xff08d5[_0x9133('0x1a')](0xcc)[_0x9133('0x22')]();});}};}function handleEntityNotFound(_0x3f278d,_0x14c1cb){return function(_0x4483ef){if(!_0x4483ef){_0x3f278d[_0x9133('0x23')](0x194);}return _0x4483ef;};}function handleError(_0x294332,_0x313d43){_0x313d43=_0x313d43||0x1f4;return function(_0x1b6b3e){logger[_0x9133('0x24')](_0x1b6b3e['stack']);if(_0x1b6b3e['name']){delete _0x1b6b3e[_0x9133('0x25')];}_0x294332[_0x9133('0x1a')](_0x313d43)[_0x9133('0x26')](_0x1b6b3e);};}exports[_0x9133('0x27')]=function(_0x4de894,_0x4ecd9e){var _0x3e2404={},_0x45966d={},_0x188c49={'count':0x0,'rows':[]};var _0x26d351=_[_0x9133('0x28')](db[_0x9133('0x29')]['rawAttributes'],function(_0x58afe0){return{'name':_0x58afe0['fieldName'],'type':_0x58afe0[_0x9133('0x2a')]['key']};});_0x45966d[_0x9133('0x2b')]=_[_0x9133('0x28')](_0x26d351,'name');_0x45966d[_0x9133('0x2c')]=_['keys'](_0x4de894[_0x9133('0x2c')]);_0x45966d[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x45966d['model'],_0x45966d[_0x9133('0x2c')]);_0x3e2404[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x45966d['model'],qs[_0x9133('0x30')](_0x4de894[_0x9133('0x2c')][_0x9133('0x30')]));_0x3e2404['attributes']=_0x3e2404[_0x9133('0x2f')][_0x9133('0x31')]?_0x3e2404[_0x9133('0x2f')]:_0x45966d[_0x9133('0x2b')];if(!_0x4de894['query'][_0x9133('0x32')](_0x9133('0x33'))){_0x3e2404['limit']=qs[_0x9133('0x1d')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1d')]);_0x3e2404[_0x9133('0x1e')]=qs[_0x9133('0x1e')](_0x4de894[_0x9133('0x2c')][_0x9133('0x1e')]);}_0x3e2404[_0x9133('0x34')]=qs[_0x9133('0x35')](_0x4de894[_0x9133('0x2c')][_0x9133('0x35')]);_0x3e2404['where']=qs[_0x9133('0x2d')](_[_0x9133('0x36')](_0x4de894['query'],_0x45966d[_0x9133('0x2d')]),_0x26d351);if(_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]){_0x3e2404[_0x9133('0x38')]=_[_0x9133('0x39')](_0x3e2404[_0x9133('0x38')],{'$or':_['map'](_0x26d351,function(_0x4e16d2){if(_0x4e16d2[_0x9133('0x2a')]!==_0x9133('0x3a')){var _0x156905={};_0x156905[_0x4e16d2[_0x9133('0x25')]]={'$like':'%'+_0x4de894[_0x9133('0x2c')][_0x9133('0x37')]+'%'};return _0x156905;}})});}_0x3e2404=_[_0x9133('0x39')]({},_0x3e2404,_0x4de894[_0x9133('0x3b')]);var _0x720048={'where':_0x3e2404['where']};return db[_0x9133('0x29')][_0x9133('0x3c')](_0x720048)[_0x9133('0x20')](function(_0x199ae9){_0x188c49[_0x9133('0x3c')]=_0x199ae9;if(_0x4de894['query'][_0x9133('0x3d')]){_0x3e2404[_0x9133('0x3e')]=[{'all':!![]}];}return db[_0x9133('0x29')][_0x9133('0x3f')](_0x3e2404);})['then'](function(_0x146734){_0x188c49[_0x9133('0x40')]=_0x146734;return _0x188c49;})[_0x9133('0x20')](respondWithFilteredResult(_0x4ecd9e,_0x3e2404))[_0x9133('0x41')](handleError(_0x4ecd9e,null));};exports[_0x9133('0x42')]=function(_0x338049,_0x3b2287){var _0x4ca1a3={'raw':!![],'where':{'id':_0x338049['params']['id']}},_0x7f6cd9={};_0x7f6cd9['model']=_[_0x9133('0x43')](db[_0x9133('0x29')][_0x9133('0x44')]);_0x7f6cd9[_0x9133('0x2c')]=_[_0x9133('0x43')](_0x338049[_0x9133('0x2c')]);_0x7f6cd9[_0x9133('0x2d')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],_0x7f6cd9['query']);_0x4ca1a3[_0x9133('0x2f')]=_[_0x9133('0x2e')](_0x7f6cd9[_0x9133('0x2b')],qs['fields'](_0x338049['query'][_0x9133('0x30')]));_0x4ca1a3[_0x9133('0x2f')]=_0x4ca1a3['attributes'][_0x9133('0x31')]?_0x4ca1a3[_0x9133('0x2f')]:_0x7f6cd9[_0x9133('0x2b')];if(_0x338049[_0x9133('0x2c')][_0x9133('0x3d')]){_0x4ca1a3['include']=[{'all':!![]}];}_0x4ca1a3=_[_0x9133('0x39')]({},_0x4ca1a3,_0x338049[_0x9133('0x3b')]);return db[_0x9133('0x29')]['find'](_0x4ca1a3)[_0x9133('0x20')](handleEntityNotFound(_0x3b2287,null))[_0x9133('0x20')](respondWithResult(_0x3b2287,null))['catch'](handleError(_0x3b2287,null));};exports['create']=function(_0x42c188,_0x2cd935){return db[_0x9133('0x29')][_0x9133('0x45')](_0x42c188[_0x9133('0x46')],{})[_0x9133('0x20')](respondWithResult(_0x2cd935,0xc9))[_0x9133('0x41')](handleError(_0x2cd935,null));};exports[_0x9133('0x47')]=function(_0x23f134,_0xf07fbb){if(_0x23f134[_0x9133('0x46')]['id']){delete _0x23f134[_0x9133('0x46')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x23f134[_0x9133('0x48')]['id']}})['then'](handleEntityNotFound(_0xf07fbb,null))[_0x9133('0x20')](saveUpdates(_0x23f134[_0x9133('0x46')],null))[_0x9133('0x20')](respondWithResult(_0xf07fbb,null))[_0x9133('0x41')](handleError(_0xf07fbb,null));};exports['destroy']=function(_0x2a3848,_0x25750f){return db[_0x9133('0x29')]['find']({'where':{'id':_0x2a3848[_0x9133('0x48')]['id']}})[_0x9133('0x20')](handleEntityNotFound(_0x25750f,null))[_0x9133('0x20')](removeEntity(_0x25750f,null))['catch'](handleError(_0x25750f,null));};
\ No newline at end of file
+var _0x80df=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring'];(function(_0xbe6469,_0xc80a1f){var _0x24bdaa=function(_0x4aaf7d){while(--_0x4aaf7d){_0xbe6469['push'](_0xbe6469['shift']());}};_0x24bdaa(++_0xc80a1f);}(_0x80df,0x17e));var _0xf80d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x80df[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf80d('0x0'));var rimraf=require(_0xf80d('0x1'));var zipdir=require(_0xf80d('0x2'));var jsonpatch=require(_0xf80d('0x3'));var rp=require('request-promise');var moment=require(_0xf80d('0x4'));var BPromise=require(_0xf80d('0x5'));var Mustache=require(_0xf80d('0x6'));var util=require(_0xf80d('0x7'));var path=require(_0xf80d('0x8'));var sox=require(_0xf80d('0x9'));var csv=require(_0xf80d('0xa'));var ejs=require(_0xf80d('0xb'));var fs=require('fs');var fs_extra=require(_0xf80d('0xc'));var _=require(_0xf80d('0xd'));var squel=require('squel');var crypto=require(_0xf80d('0xe'));var jsforce=require(_0xf80d('0xf'));var deskjs=require(_0xf80d('0x10'));var toCsv=require(_0xf80d('0xa'));var querystring=require(_0xf80d('0x11'));var Papa=require(_0xf80d('0x12'));var Redis=require(_0xf80d('0x13'));var authService=require(_0xf80d('0x14'));var qs=require(_0xf80d('0x15'));var as=require(_0xf80d('0x16'));var hardwareService=require(_0xf80d('0x17'));var logger=require(_0xf80d('0x18'))(_0xf80d('0x19'));var utils=require(_0xf80d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf80d('0x1b'))['db'];function respondWithStatusCode(_0x74ce36,_0x489bdf){_0x489bdf=_0x489bdf||0xcc;return function(_0x34e130){if(_0x34e130){return _0x74ce36['sendStatus'](_0x489bdf);}return _0x74ce36[_0xf80d('0x1c')](_0x489bdf)['end']();};}function respondWithResult(_0x4285de,_0x50c968){_0x50c968=_0x50c968||0xc8;return function(_0x3be9a9){if(_0x3be9a9){return _0x4285de[_0xf80d('0x1c')](_0x50c968)[_0xf80d('0x1d')](_0x3be9a9);}};}function respondWithFilteredResult(_0x1e1b08,_0x2098d6){return function(_0x45751c){if(_0x45751c){var _0x482043=typeof _0x2098d6[_0xf80d('0x1e')]===_0xf80d('0x1f')&&typeof _0x2098d6[_0xf80d('0x20')]===_0xf80d('0x1f');var _0x27b2ea=_0x45751c[_0xf80d('0x21')];var _0x1d104a=_0x482043?0x0:_0x2098d6[_0xf80d('0x1e')];var _0x2ea2c1=_0x482043?_0x45751c[_0xf80d('0x21')]:_0x2098d6[_0xf80d('0x1e')]+_0x2098d6[_0xf80d('0x20')];var _0x5392c5;if(_0x2ea2c1>=_0x27b2ea){_0x2ea2c1=_0x27b2ea;_0x5392c5=0xc8;}else{_0x5392c5=0xce;}_0x1e1b08[_0xf80d('0x1c')](_0x5392c5);return _0x1e1b08[_0xf80d('0x22')]('Content-Range',_0x1d104a+'-'+_0x2ea2c1+'/'+_0x27b2ea)[_0xf80d('0x1d')](_0x45751c);}return null;};}function patchUpdates(_0x539c80){return function(_0x3f3a2a){try{jsonpatch[_0xf80d('0x23')](_0x3f3a2a,_0x539c80,!![]);}catch(_0x2d5e46){return BPromise[_0xf80d('0x24')](_0x2d5e46);}return _0x3f3a2a[_0xf80d('0x25')]();};}function saveUpdates(_0x25d031,_0x446153){return function(_0x269859){if(_0x269859){return _0x269859[_0xf80d('0x26')](_0x25d031)[_0xf80d('0x27')](function(_0x33d58c){return _0x33d58c;});}return null;};}function removeEntity(_0x739968,_0x570c99){return function(_0x32ad42){if(_0x32ad42){return _0x32ad42[_0xf80d('0x28')]()['then'](function(){_0x739968[_0xf80d('0x1c')](0xcc)[_0xf80d('0x29')]();});}};}function handleEntityNotFound(_0x323540,_0x947bb){return function(_0x4986ad){if(!_0x4986ad){_0x323540[_0xf80d('0x2a')](0x194);}return _0x4986ad;};}function handleError(_0x14399e,_0xf4c3af){_0xf4c3af=_0xf4c3af||0x1f4;return function(_0x2a4597){logger[_0xf80d('0x2b')](_0x2a4597[_0xf80d('0x2c')]);if(_0x2a4597[_0xf80d('0x2d')]){delete _0x2a4597[_0xf80d('0x2d')];}_0x14399e[_0xf80d('0x1c')](_0xf4c3af)['send'](_0x2a4597);};}exports[_0xf80d('0x2e')]=function(_0x1603a4,_0x3e2c8c){var _0x368865={},_0x3ce924={},_0x5eab42={'count':0x0,'rows':[]};var _0x401cfb=_['map'](db[_0xf80d('0x2f')][_0xf80d('0x30')],function(_0x214bff){return{'name':_0x214bff[_0xf80d('0x31')],'type':_0x214bff['type']['key']};});_0x3ce924[_0xf80d('0x32')]=_['map'](_0x401cfb,_0xf80d('0x2d'));_0x3ce924[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x1603a4['query']);_0x3ce924[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x3ce924['model'],_0x3ce924[_0xf80d('0x33')]);_0x368865[_0xf80d('0x37')]=_[_0xf80d('0x36')](_0x3ce924['model'],qs[_0xf80d('0x38')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x38')]));_0x368865[_0xf80d('0x37')]=_0x368865[_0xf80d('0x37')]['length']?_0x368865[_0xf80d('0x37')]:_0x3ce924['model'];if(!_0x1603a4[_0xf80d('0x33')][_0xf80d('0x39')](_0xf80d('0x3a'))){_0x368865[_0xf80d('0x20')]=qs['limit'](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x20')]);_0x368865[_0xf80d('0x1e')]=qs[_0xf80d('0x1e')](_0x1603a4['query'][_0xf80d('0x1e')]);}_0x368865[_0xf80d('0x3b')]=qs[_0xf80d('0x3c')](_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3c')]);_0x368865[_0xf80d('0x3d')]=qs[_0xf80d('0x35')](_[_0xf80d('0x3e')](_0x1603a4['query'],_0x3ce924[_0xf80d('0x35')]),_0x401cfb);if(_0x1603a4[_0xf80d('0x33')][_0xf80d('0x3f')]){_0x368865['where']=_[_0xf80d('0x40')](_0x368865['where'],{'$or':_[_0xf80d('0x41')](_0x401cfb,function(_0x1a4ab7){if(_0x1a4ab7[_0xf80d('0x42')]!==_0xf80d('0x43')){var _0x4a3c5e={};_0x4a3c5e[_0x1a4ab7['name']]={'$like':'%'+_0x1603a4['query'][_0xf80d('0x3f')]+'%'};return _0x4a3c5e;}})});}_0x368865=_[_0xf80d('0x40')]({},_0x368865,_0x1603a4[_0xf80d('0x44')]);var _0x4b9f1d={'where':_0x368865[_0xf80d('0x3d')]};return db[_0xf80d('0x2f')]['count'](_0x4b9f1d)[_0xf80d('0x27')](function(_0x511310){_0x5eab42[_0xf80d('0x21')]=_0x511310;if(_0x1603a4['query'][_0xf80d('0x45')]){_0x368865['include']=[{'all':!![]}];}return db[_0xf80d('0x2f')][_0xf80d('0x46')](_0x368865);})[_0xf80d('0x27')](function(_0x2cd371){_0x5eab42[_0xf80d('0x47')]=_0x2cd371;return _0x5eab42;})[_0xf80d('0x27')](respondWithFilteredResult(_0x3e2c8c,_0x368865))[_0xf80d('0x48')](handleError(_0x3e2c8c,null));};exports[_0xf80d('0x49')]=function(_0x99e531,_0x80f24a){var _0x1fcbad={'raw':!![],'where':{'id':_0x99e531[_0xf80d('0x4a')]['id']}},_0x437e44={};_0x437e44[_0xf80d('0x32')]=_[_0xf80d('0x34')](db[_0xf80d('0x2f')][_0xf80d('0x30')]);_0x437e44[_0xf80d('0x33')]=_[_0xf80d('0x34')](_0x99e531[_0xf80d('0x33')]);_0x437e44[_0xf80d('0x35')]=_[_0xf80d('0x36')](_0x437e44[_0xf80d('0x32')],_0x437e44[_0xf80d('0x33')]);_0x1fcbad[_0xf80d('0x37')]=_['intersection'](_0x437e44[_0xf80d('0x32')],qs[_0xf80d('0x38')](_0x99e531[_0xf80d('0x33')][_0xf80d('0x38')]));_0x1fcbad[_0xf80d('0x37')]=_0x1fcbad['attributes'][_0xf80d('0x4b')]?_0x1fcbad[_0xf80d('0x37')]:_0x437e44[_0xf80d('0x32')];if(_0x99e531[_0xf80d('0x33')][_0xf80d('0x45')]){_0x1fcbad[_0xf80d('0x4c')]=[{'all':!![]}];}_0x1fcbad=_[_0xf80d('0x40')]({},_0x1fcbad,_0x99e531[_0xf80d('0x44')]);return db[_0xf80d('0x2f')][_0xf80d('0x4d')](_0x1fcbad)[_0xf80d('0x27')](handleEntityNotFound(_0x80f24a,null))[_0xf80d('0x27')](respondWithResult(_0x80f24a,null))[_0xf80d('0x48')](handleError(_0x80f24a,null));};exports[_0xf80d('0x4e')]=function(_0x3a420d,_0x10d5b5){return db[_0xf80d('0x2f')]['create'](_0x3a420d[_0xf80d('0x4f')],{})[_0xf80d('0x27')](respondWithResult(_0x10d5b5,0xc9))[_0xf80d('0x48')](handleError(_0x10d5b5,null));};exports['update']=function(_0x3e5cf6,_0x1088ca){if(_0x3e5cf6['body']['id']){delete _0x3e5cf6['body']['id'];}return db[_0xf80d('0x2f')]['find']({'where':{'id':_0x3e5cf6[_0xf80d('0x4a')]['id']}})[_0xf80d('0x27')](handleEntityNotFound(_0x1088ca,null))[_0xf80d('0x27')](saveUpdates(_0x3e5cf6[_0xf80d('0x4f')],null))[_0xf80d('0x27')](respondWithResult(_0x1088ca,null))[_0xf80d('0x48')](handleError(_0x1088ca,null));};exports[_0xf80d('0x28')]=function(_0x114132,_0x115d1f){return db[_0xf80d('0x2f')][_0xf80d('0x4d')]({'where':{'id':_0x114132[_0xf80d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x115d1f,null))[_0xf80d('0x27')](removeEntity(_0x115d1f,null))[_0xf80d('0x48')](handleError(_0x115d1f,null));};
\ No newline at end of file
index 33a5f2f..6a1216c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfaa1=['util','api','moment','request-promise','path','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash'];(function(_0x4a4325,_0x5d548e){var _0x553eaf=function(_0x2e75c9){while(--_0x2e75c9){_0x4a4325['push'](_0x4a4325['shift']());}};_0x553eaf(++_0x5d548e);}(_0xfaa1,0x110));var _0x1faa=function(_0x1c70a5,_0x2c005e){_0x1c70a5=_0x1c70a5-0x0;var _0x409fc5=_0xfaa1[_0x1c70a5];return _0x409fc5;};'use strict';var _=require(_0x1faa('0x0'));var util=require(_0x1faa('0x1'));var logger=require('../../config/logger')(_0x1faa('0x2'));var moment=require(_0x1faa('0x3'));var BPromise=require('bluebird');var rp=require(_0x1faa('0x4'));var fs=require('fs');var path=require(_0x1faa('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1faa('0x6'));module[_0x1faa('0x7')]=function(_0x4cf115,_0x1d4d4d){return _0x4cf115[_0x1faa('0x8')](_0x1faa('0x9'),attributes,{'tableName':_0x1faa('0xa'),'paranoid':![],'indexes':[{'name':_0x1faa('0xb'),'fields':['idField',_0x1faa('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x552c=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','exports','define','FreshdeskField'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x552c,0x66));var _0xc552=function(_0x1ad992,_0x5ddc63){_0x1ad992=_0x1ad992-0x0;var _0x535234=_0x552c[_0x1ad992];return _0x535234;};'use strict';var _=require(_0xc552('0x0'));var util=require(_0xc552('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xc552('0x2'));var BPromise=require(_0xc552('0x3'));var rp=require(_0xc552('0x4'));var fs=require('fs');var path=require(_0xc552('0x5'));var rimraf=require(_0xc552('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskField.attributes');module[_0xc552('0x7')]=function(_0x41f2c7,_0x504ebc){return _0x41f2c7[_0xc552('0x8')](_0xc552('0x9'),attributes,{'tableName':_0xc552('0xa'),'paranoid':![],'indexes':[{'name':_0xc552('0xb'),'fields':[_0xc552('0xc'),_0xc552('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 3222fd1..1702a68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3116=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x3116,0x199));var _0x6311=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x3116[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6311('0x0'));var util=require(_0x6311('0x1'));var moment=require(_0x6311('0x2'));var BPromise=require(_0x6311('0x3'));var rs=require(_0x6311('0x4'));var fs=require('fs');var Redis=require(_0x6311('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6311('0x6'));var logger=require(_0x6311('0x7'))(_0x6311('0x8'));var config=require(_0x6311('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6311('0xa')][_0x6311('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19288c,_0x2c6c02,_0xd0e30c){return new BPromise(function(_0x44180a,_0x5546fd){return client[_0x6311('0xc')](_0x19288c,_0xd0e30c)[_0x6311('0xd')](function(_0x1c67d4){logger['info'](_0x6311('0xe'),_0x2c6c02,_0x6311('0xf'));logger[_0x6311('0x10')](_0x6311('0x11'),_0x2c6c02,_0x6311('0xf'),JSON[_0x6311('0x12')](_0x1c67d4));if(_0x1c67d4[_0x6311('0x13')]){if(_0x1c67d4[_0x6311('0x13')][_0x6311('0x14')]===0x1f4){logger[_0x6311('0x13')](_0x6311('0xe'),_0x2c6c02,_0x1c67d4[_0x6311('0x13')][_0x6311('0x15')]);return _0x5546fd(_0x1c67d4['error']['message']);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x2c6c02,_0x1c67d4[_0x6311('0x13')][_0x6311('0x15')]);return _0x44180a(_0x1c67d4['error']['message']);}else{logger[_0x6311('0x16')](_0x6311('0xe'),_0x2c6c02,_0x6311('0xf'));_0x44180a(_0x1c67d4[_0x6311('0x17')][_0x6311('0x15')]);}})[_0x6311('0x18')](function(_0x5241e6){logger['error'](_0x6311('0xe'),_0x2c6c02,_0x5241e6);_0x5546fd(_0x5241e6);});});}
\ No newline at end of file
+var _0x830a=['then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x830a,0x159));var _0xa830=function(_0x5e1eb5,_0x7591c2){_0x5e1eb5=_0x5e1eb5-0x0;var _0x30f73c=_0x830a[_0x5e1eb5];return _0x30f73c;};'use strict';var _=require(_0xa830('0x0'));var util=require(_0xa830('0x1'));var moment=require(_0xa830('0x2'));var BPromise=require(_0xa830('0x3'));var rs=require(_0xa830('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa830('0x5'));var logger=require('../../config/logger')(_0xa830('0x6'));var config=require(_0xa830('0x7'));var jayson=require(_0xa830('0x8'));var client=jayson[_0xa830('0x9')][_0xa830('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x110e5e,_0x3230a1,_0x3e0c17){return new BPromise(function(_0x2ca9cd,_0x3c496c){return client[_0xa830('0xb')](_0x110e5e,_0x3e0c17)[_0xa830('0xc')](function(_0x4f8554){logger[_0xa830('0xd')](_0xa830('0xe'),_0x3230a1,_0xa830('0xf'));logger[_0xa830('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x3230a1,_0xa830('0xf'),JSON[_0xa830('0x11')](_0x4f8554));if(_0x4f8554[_0xa830('0x12')]){if(_0x4f8554[_0xa830('0x12')][_0xa830('0x13')]===0x1f4){logger[_0xa830('0x12')](_0xa830('0xe'),_0x3230a1,_0x4f8554[_0xa830('0x12')]['message']);return _0x3c496c(_0x4f8554[_0xa830('0x12')][_0xa830('0x14')]);}logger[_0xa830('0x12')](_0xa830('0xe'),_0x3230a1,_0x4f8554['error'][_0xa830('0x14')]);return _0x2ca9cd(_0x4f8554['error'][_0xa830('0x14')]);}else{logger[_0xa830('0xd')](_0xa830('0xe'),_0x3230a1,_0xa830('0xf'));_0x2ca9cd(_0x4f8554['result'][_0xa830('0x14')]);}})['catch'](function(_0x5e3326){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x3230a1,_0x5e3326);_0x3c496c(_0x5e3326);});});}
\ No newline at end of file
index a307b82..fa16ebd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5eb8=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1ee9fe,_0x24b25b){var _0xfbcca7=function(_0xe09f35){while(--_0xe09f35){_0x1ee9fe['push'](_0x1ee9fe['shift']());}};_0xfbcca7(++_0x24b25b);}(_0x5eb8,0xb0));var _0x85eb=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x5eb8[_0x5d2803];return _0xdcad2c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x85eb('0x0'));var timeout=require(_0x85eb('0x1'));var express=require(_0x85eb('0x2'));var router=express[_0x85eb('0x3')]();var fs_extra=require(_0x85eb('0x4'));var auth=require(_0x85eb('0x5'));var interaction=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var controller=require(_0x85eb('0x8'));router[_0x85eb('0x9')]('/',auth[_0x85eb('0xa')](),controller[_0x85eb('0xb')]);router['get'](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller[_0x85eb('0xd')]);router['get'](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0xf')]);router[_0x85eb('0x9')](_0x85eb('0x10'),auth[_0x85eb('0xa')](),controller[_0x85eb('0x11')]);router[_0x85eb('0x12')]('/',auth[_0x85eb('0xa')](),controller['create']);router[_0x85eb('0x12')](_0x85eb('0xe'),auth['isAuthenticated'](),controller[_0x85eb('0x13')]);router[_0x85eb('0x14')](_0x85eb('0xc'),auth[_0x85eb('0xa')](),controller['update']);router['delete'](_0x85eb('0xc'),auth['isAuthenticated'](),controller[_0x85eb('0x15')]);module[_0x85eb('0x16')]=router;
\ No newline at end of file
+var _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x9d4544,_0x4f8a51){var _0x53e6c2=function(_0x176439){while(--_0x176439){_0x9d4544['push'](_0x9d4544['shift']());}};_0x53e6c2(++_0x4f8a51);}(_0xa478,0x136));var _0x8a47=function(_0x11a741,_0x1e7097){_0x11a741=_0x11a741-0x0;var _0xa466f6=_0xa478[_0x11a741];return _0xa466f6;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router;
\ No newline at end of file
index 18c3e20..54e9be0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x524e=['username','remoteUri','STRING'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0x524e,0x15e));var _0xe524=function(_0x4eae62,_0xd23a10){_0x4eae62=_0x4eae62-0x0;var _0x3ee9d9=_0x524e[_0x4eae62];return _0x3ee9d9;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'apiKey':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]}};
\ No newline at end of file
+var _0x1399=['exports','STRING','username','remoteUri','sequelize'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0x1399,0x16c));var _0x9139=function(_0x1b27ff,_0x34070b){_0x1b27ff=_0x1b27ff-0x0;var _0x1ff114=_0x1399[_0x1b27ff];return _0x1ff114;};'use strict';var Sequelize=require(_0x9139('0x0'));module[_0x9139('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9139('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x9139('0x3')},'apiKey':{'type':Sequelize[_0x9139('0x2')]},'remoteUri':{'type':Sequelize[_0x9139('0x2')],'unique':_0x9139('0x4')},'serverUrl':{'type':Sequelize[_0x9139('0x2')],'allowNull':![]}};
\ No newline at end of file
index 9978ab8..b861e8d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c9d=['../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','then','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','create','body','find','destroy','FreshsalesConfiguration','getConfigurations','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x4c9d,0x127));var _0xd4c9=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x4c9d[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xd4c9('0x0'));var rimraf=require(_0xd4c9('0x1'));var zipdir=require(_0xd4c9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd4c9('0x3'));var BPromise=require(_0xd4c9('0x4'));var Mustache=require(_0xd4c9('0x5'));var util=require(_0xd4c9('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd4c9('0x7'));var fs=require('fs');var fs_extra=require(_0xd4c9('0x8'));var _=require('lodash');var squel=require(_0xd4c9('0x9'));var crypto=require('crypto');var jsforce=require(_0xd4c9('0xa'));var deskjs=require(_0xd4c9('0xb'));var toCsv=require(_0xd4c9('0xc'));var querystring=require(_0xd4c9('0xd'));var Papa=require(_0xd4c9('0xe'));var Redis=require('ioredis');var authService=require(_0xd4c9('0xf'));var qs=require(_0xd4c9('0x10'));var as=require(_0xd4c9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4c9('0x12'));var config=require(_0xd4c9('0x13'));var licenseUtil=require(_0xd4c9('0x14'));var db=require(_0xd4c9('0x15'))['db'];var integrations=require(_0xd4c9('0x16'));function respondWithStatusCode(_0x41794d,_0x431014){_0x431014=_0x431014||0xcc;return function(_0x3a76f1){if(_0x3a76f1){return _0x41794d[_0xd4c9('0x17')](_0x431014);}return _0x41794d[_0xd4c9('0x18')](_0x431014)[_0xd4c9('0x19')]();};}function respondWithResult(_0x6e3b02,_0x429e8a){_0x429e8a=_0x429e8a||0xc8;return function(_0x20ef24){if(_0x20ef24){return _0x6e3b02['status'](_0x429e8a)[_0xd4c9('0x1a')](_0x20ef24);}};}function respondWithFilteredResult(_0x2f7d12,_0x4bb629){return function(_0x4f3267){if(_0x4f3267){var _0x51ad09=typeof _0x4bb629[_0xd4c9('0x1b')]==='undefined'&&typeof _0x4bb629['limit']===_0xd4c9('0x1c');var _0x12b562=_0x4f3267[_0xd4c9('0x1d')];var _0x339372=_0x51ad09?0x0:_0x4bb629['offset'];var _0x591477=_0x51ad09?_0x4f3267[_0xd4c9('0x1d')]:_0x4bb629[_0xd4c9('0x1b')]+_0x4bb629[_0xd4c9('0x1e')];var _0x465221;if(_0x591477>=_0x12b562){_0x591477=_0x12b562;_0x465221=0xc8;}else{_0x465221=0xce;}_0x2f7d12[_0xd4c9('0x18')](_0x465221);return _0x2f7d12[_0xd4c9('0x1f')](_0xd4c9('0x20'),_0x339372+'-'+_0x591477+'/'+_0x12b562)['json'](_0x4f3267);}return null;};}function patchUpdates(_0x239037){return function(_0x5f4def){try{jsonpatch['apply'](_0x5f4def,_0x239037,!![]);}catch(_0x4b954c){return BPromise[_0xd4c9('0x21')](_0x4b954c);}return _0x5f4def[_0xd4c9('0x22')]();};}function saveUpdates(_0x540162,_0x3acf3a){return function(_0x355bed){if(_0x355bed){return _0x355bed['update'](_0x540162)[_0xd4c9('0x23')](function(_0xe0f1d8){return _0xe0f1d8;});}return null;};}function removeEntity(_0x777f12,_0x46feac){return function(_0x5e5dde){if(_0x5e5dde){return _0x5e5dde['destroy']()[_0xd4c9('0x23')](function(){_0x777f12[_0xd4c9('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ad776,_0x469b2a){return function(_0x5d9616){if(!_0x5d9616){_0x5ad776['sendStatus'](0x194);}return _0x5d9616;};}function handleError(_0xf6fc82,_0x3abcd2){_0x3abcd2=_0x3abcd2||0x1f4;return function(_0x16e031){logger['error'](_0x16e031[_0xd4c9('0x24')]);if(_0x16e031['name']){delete _0x16e031[_0xd4c9('0x25')];}_0xf6fc82[_0xd4c9('0x18')](_0x3abcd2)[_0xd4c9('0x26')](_0x16e031);};}exports[_0xd4c9('0x27')]=function(_0x42c91f,_0x420b1b){var _0x5fa839={},_0x5d7945={},_0x4a0594={'count':0x0,'rows':[]};var _0x4205fa=_[_0xd4c9('0x28')](db[_0xd4c9('0x29')][_0xd4c9('0x2a')],function(_0x310f7a){return{'name':_0x310f7a[_0xd4c9('0x2b')],'type':_0x310f7a[_0xd4c9('0x2c')][_0xd4c9('0x2d')]};});_0x5d7945[_0xd4c9('0x2e')]=_[_0xd4c9('0x28')](_0x4205fa,_0xd4c9('0x25'));_0x5d7945['query']=_[_0xd4c9('0x2f')](_0x42c91f[_0xd4c9('0x30')]);_0x5d7945['filters']=_[_0xd4c9('0x31')](_0x5d7945['model'],_0x5d7945[_0xd4c9('0x30')]);_0x5fa839[_0xd4c9('0x32')]=_['intersection'](_0x5d7945[_0xd4c9('0x2e')],qs[_0xd4c9('0x33')](_0x42c91f['query'][_0xd4c9('0x33')]));_0x5fa839[_0xd4c9('0x32')]=_0x5fa839[_0xd4c9('0x32')][_0xd4c9('0x34')]?_0x5fa839[_0xd4c9('0x32')]:_0x5d7945[_0xd4c9('0x2e')];if(!_0x42c91f[_0xd4c9('0x30')][_0xd4c9('0x35')](_0xd4c9('0x36'))){_0x5fa839[_0xd4c9('0x1e')]=qs[_0xd4c9('0x1e')](_0x42c91f['query']['limit']);_0x5fa839[_0xd4c9('0x1b')]=qs[_0xd4c9('0x1b')](_0x42c91f[_0xd4c9('0x30')][_0xd4c9('0x1b')]);}_0x5fa839[_0xd4c9('0x37')]=qs['sort'](_0x42c91f[_0xd4c9('0x30')][_0xd4c9('0x38')]);_0x5fa839[_0xd4c9('0x39')]=qs[_0xd4c9('0x3a')](_[_0xd4c9('0x3b')](_0x42c91f[_0xd4c9('0x30')],_0x5d7945[_0xd4c9('0x3a')]),_0x4205fa);if(_0x42c91f[_0xd4c9('0x30')]['filter']){_0x5fa839[_0xd4c9('0x39')]=_[_0xd4c9('0x3c')](_0x5fa839[_0xd4c9('0x39')],{'$or':_['map'](_0x4205fa,function(_0x5e1352){if(_0x5e1352['type']!==_0xd4c9('0x3d')){var _0x56bd69={};_0x56bd69[_0x5e1352[_0xd4c9('0x25')]]={'$like':'%'+_0x42c91f[_0xd4c9('0x30')][_0xd4c9('0x3e')]+'%'};return _0x56bd69;}})});}_0x5fa839=_[_0xd4c9('0x3c')]({},_0x5fa839,_0x42c91f[_0xd4c9('0x3f')]);var _0x5a24c0={'where':_0x5fa839[_0xd4c9('0x39')]};return db[_0xd4c9('0x29')][_0xd4c9('0x1d')](_0x5a24c0)[_0xd4c9('0x23')](function(_0x200ca9){_0x4a0594[_0xd4c9('0x1d')]=_0x200ca9;if(_0x42c91f[_0xd4c9('0x30')][_0xd4c9('0x40')]){_0x5fa839[_0xd4c9('0x41')]=[{'all':!![]}];}return db[_0xd4c9('0x29')]['findAll'](_0x5fa839);})[_0xd4c9('0x23')](function(_0x42b71c){_0x4a0594[_0xd4c9('0x42')]=_0x42b71c;return _0x4a0594;})[_0xd4c9('0x23')](respondWithFilteredResult(_0x420b1b,_0x5fa839))[_0xd4c9('0x43')](handleError(_0x420b1b,null));};exports[_0xd4c9('0x44')]=function(_0x1355da,_0x5a915d){var _0x4e95af={'raw':![],'where':{'id':_0x1355da[_0xd4c9('0x45')]['id']}},_0x2aea50={};_0x2aea50['model']=_[_0xd4c9('0x2f')](db[_0xd4c9('0x29')][_0xd4c9('0x2a')]);_0x2aea50[_0xd4c9('0x30')]=_[_0xd4c9('0x2f')](_0x1355da[_0xd4c9('0x30')]);_0x2aea50['filters']=_['intersection'](_0x2aea50[_0xd4c9('0x2e')],_0x2aea50['query']);_0x4e95af['attributes']=_['intersection'](_0x2aea50['model'],qs[_0xd4c9('0x33')](_0x1355da[_0xd4c9('0x30')][_0xd4c9('0x33')]));_0x4e95af[_0xd4c9('0x32')]=_0x4e95af[_0xd4c9('0x32')][_0xd4c9('0x34')]?_0x4e95af['attributes']:_0x2aea50['model'];if(_0x1355da[_0xd4c9('0x30')][_0xd4c9('0x40')]){_0x4e95af[_0xd4c9('0x41')]=[{'all':!![]}];}_0x4e95af=_['merge']({},_0x4e95af,_0x1355da['options']);return db['FreshsalesAccount']['find'](_0x4e95af)[_0xd4c9('0x23')](handleEntityNotFound(_0x5a915d,null))[_0xd4c9('0x23')](respondWithResult(_0x5a915d,null))[_0xd4c9('0x43')](handleError(_0x5a915d,null));};exports['create']=function(_0x12487c,_0x1f5106){return db['FreshsalesAccount'][_0xd4c9('0x46')](_0x12487c[_0xd4c9('0x47')],{})['then'](respondWithResult(_0x1f5106,0xc9))[_0xd4c9('0x43')](handleError(_0x1f5106,null));};exports['update']=function(_0x5802c6,_0x32637a){if(_0x5802c6[_0xd4c9('0x47')]['id']){delete _0x5802c6[_0xd4c9('0x47')]['id'];}return db[_0xd4c9('0x29')][_0xd4c9('0x48')]({'where':{'id':_0x5802c6['params']['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x32637a,null))[_0xd4c9('0x23')](saveUpdates(_0x5802c6[_0xd4c9('0x47')],null))[_0xd4c9('0x23')](respondWithResult(_0x32637a,null))[_0xd4c9('0x43')](handleError(_0x32637a,null));};exports[_0xd4c9('0x49')]=function(_0x5419bf,_0xdd355f){return db[_0xd4c9('0x29')]['find']({'where':{'id':_0x5419bf['params']['id']}})['then'](handleEntityNotFound(_0xdd355f,null))['then'](removeEntity(_0xdd355f,null))[_0xd4c9('0x43')](handleError(_0xdd355f,null));};exports['getConfigurations']=function(_0x17cc87,_0x2df8ca,_0x1aae7a){var _0x13f73c={};var _0x18e546={};var _0x63201d;var _0x3ba1f4;return db[_0xd4c9('0x29')]['findOne']({'where':{'id':_0x17cc87[_0xd4c9('0x45')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x2df8ca,null))[_0xd4c9('0x23')](function(_0xe0eaa7){if(_0xe0eaa7){_0x63201d=_0xe0eaa7;_0x18e546[_0xd4c9('0x2e')]=_[_0xd4c9('0x2f')](db[_0xd4c9('0x4a')][_0xd4c9('0x2a')]);_0x18e546[_0xd4c9('0x30')]=_['keys'](_0x17cc87[_0xd4c9('0x30')]);_0x18e546[_0xd4c9('0x3a')]=_[_0xd4c9('0x31')](_0x18e546[_0xd4c9('0x2e')],_0x18e546['query']);_0x13f73c[_0xd4c9('0x32')]=_[_0xd4c9('0x31')](_0x18e546['model'],qs[_0xd4c9('0x33')](_0x17cc87[_0xd4c9('0x30')][_0xd4c9('0x33')]));_0x13f73c['attributes']=_0x13f73c['attributes'][_0xd4c9('0x34')]?_0x13f73c[_0xd4c9('0x32')]:_0x18e546[_0xd4c9('0x2e')];_0x13f73c[_0xd4c9('0x37')]=qs[_0xd4c9('0x38')](_0x17cc87[_0xd4c9('0x30')]['sort']);_0x13f73c[_0xd4c9('0x39')]=qs[_0xd4c9('0x3a')](_[_0xd4c9('0x3b')](_0x17cc87[_0xd4c9('0x30')],_0x18e546[_0xd4c9('0x3a')]));if(_0x17cc87[_0xd4c9('0x30')][_0xd4c9('0x3e')]){_0x13f73c[_0xd4c9('0x39')]=_[_0xd4c9('0x3c')](_0x13f73c['where'],{'$or':_[_0xd4c9('0x28')](_0x13f73c[_0xd4c9('0x32')],function(_0x531f95){var _0x351108={};_0x351108[_0x531f95]={'$like':'%'+_0x17cc87[_0xd4c9('0x30')]['filter']+'%'};return _0x351108;})});}_0x13f73c=_[_0xd4c9('0x3c')]({},_0x13f73c,_0x17cc87[_0xd4c9('0x3f')]);return _0x63201d[_0xd4c9('0x4b')](_0x13f73c);}})[_0xd4c9('0x23')](function(_0x16fd95){if(_0x16fd95){_0x3ba1f4=_0x16fd95[_0xd4c9('0x34')];if(!_0x17cc87[_0xd4c9('0x30')]['hasOwnProperty'](_0xd4c9('0x36'))){_0x13f73c[_0xd4c9('0x1e')]=qs['limit'](_0x17cc87[_0xd4c9('0x30')][_0xd4c9('0x1e')]);_0x13f73c[_0xd4c9('0x1b')]=qs[_0xd4c9('0x1b')](_0x17cc87[_0xd4c9('0x30')][_0xd4c9('0x1b')]);}return _0x63201d['getConfigurations'](_0x13f73c);}})[_0xd4c9('0x23')](function(_0x47c52d){if(_0x47c52d){return _0x47c52d?{'count':_0x3ba1f4,'rows':_0x47c52d}:null;}})[_0xd4c9('0x23')](respondWithResult(_0x2df8ca,null))[_0xd4c9('0x43')](handleError(_0x2df8ca,null));};exports['addConfiguration']=function(_0x34a1e5,_0x1bfc55,_0xc15e0f){if(_0x34a1e5[_0xd4c9('0x47')]['id']){delete _0x34a1e5[_0xd4c9('0x47')]['id'];}return db['FreshsalesAccount'][_0xd4c9('0x4c')]({'where':{'id':_0x34a1e5[_0xd4c9('0x45')]['id']}})[_0xd4c9('0x23')](handleEntityNotFound(_0x1bfc55,null))[_0xd4c9('0x23')](function(_0x438cfc){if(_0x438cfc){_0x34a1e5[_0xd4c9('0x47')][_0xd4c9('0x4d')]=_0x438cfc['id'];_0x34a1e5['body'][_0xd4c9('0x4e')]=integrations[_0xd4c9('0x4f')](_0x34a1e5[_0xd4c9('0x47')][_0xd4c9('0x50')],_0x34a1e5[_0xd4c9('0x47')][_0xd4c9('0x2c')]);_0x34a1e5['body'][_0xd4c9('0x51')]=integrations[_0xd4c9('0x52')](_0x34a1e5['body'][_0xd4c9('0x50')],_0x34a1e5[_0xd4c9('0x47')]['type']);return db[_0xd4c9('0x4a')][_0xd4c9('0x46')](_0x34a1e5['body'],{'include':[{'model':db[_0xd4c9('0x53')],'as':_0xd4c9('0x4e')},{'model':db['FreshsalesField'],'as':_0xd4c9('0x51')}]});}return null;})[_0xd4c9('0x23')](respondWithResult(_0x1bfc55,null))[_0xd4c9('0x43')](handleError(_0x1bfc55,null));};exports[_0xd4c9('0x54')]=function(_0x227041,_0x4a3b3b,_0x4925be){var _0x178a3f='';var _0x290848='';return db[_0xd4c9('0x29')]['findOne']({'where':{'id':_0x227041['params']['id']},'attributes':['id',_0xd4c9('0x55'),'remoteUri',_0xd4c9('0x56')]})[_0xd4c9('0x23')](handleEntityNotFound(_0x4a3b3b,null))['then'](function(_0x2bcd61){if(_0x2bcd61){_0x290848=_0x2bcd61[_0xd4c9('0x55')];_0x178a3f=_0x2bcd61[_0xd4c9('0x57')];var _0x14a4f8=_0x2bcd61[_0xd4c9('0x57')][_0xd4c9('0x58')](-0x1);if(_0x14a4f8==='/'){_0x178a3f=_0x178a3f[_0xd4c9('0x59')](0x0,_0x178a3f[_0xd4c9('0x5a')](_0x14a4f8));}return rp({'method':_0xd4c9('0x5b'),'uri':util[_0xd4c9('0x5c')](_0xd4c9('0x5d'),_0x178a3f,_0xd4c9('0x5e')),'headers':{'Authorization':_0xd4c9('0x5f')+_0x2bcd61[_0xd4c9('0x56')]},'json':!![]});}})[_0xd4c9('0x23')](function(_0x298eee){if(_0x298eee){var _0x3b8e1d=_0x298eee[_0xd4c9('0x60')];var _0x5eb16d=![];var _0x39a13c=null;for(_0x39a13c=0x0;_0x39a13c<_0x3b8e1d[_0xd4c9('0x34')];_0x39a13c++){if(_0x3b8e1d[_0x39a13c]['email']===_0x290848){_0x5eb16d=!![];}}if(_0x5eb16d){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xd4c9('0x61')});}}})['then'](respondWithResult(_0x4a3b3b,null))['catch'](function(_0xc1a6c){var _0x3894cc=_0x227041['query'][_0xd4c9('0x62')]?0x1f4:_0xc1a6c[_0xd4c9('0x63')]||0x1f4;logger[_0xd4c9('0x64')](_0xd4c9('0x65'),_0xd4c9('0x54'),_0x3894cc,JSON[_0xd4c9('0x66')](_0xc1a6c));delete _0xc1a6c['name'];if(_0x3894cc===0x191){_0x3894cc=0x190;}_0x4a3b3b[_0xd4c9('0x18')](_0x3894cc)[_0xd4c9('0x26')](_0x227041[_0xd4c9('0x30')][_0xd4c9('0x62')]?{'message':_0xd4c9('0x67'),'statusCode':_0xc1a6c[_0xd4c9('0x63')]}:_0xc1a6c);});};
\ No newline at end of file
+var _0x8134=['error','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','options','includeAll','findAll','show','params','include','merge','create','body','find','getConfigurations','findOne','FreshsalesConfiguration','catch','addConfiguration','AccountId','getSubjects','channel','getDescriptions','FreshsalesField','Subjects','Descriptions','getFields','username','remoteUri','apiKey','lastIndexOf','format','%s%s','users','email','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','apply','save','then','destroy'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x8134,0xf5));var _0x4813=function(_0x496915,_0x426cce){_0x496915=_0x496915-0x0;var _0x54085e=_0x8134[_0x496915];return _0x54085e;};'use strict';var emlformat=require(_0x4813('0x0'));var rimraf=require(_0x4813('0x1'));var zipdir=require(_0x4813('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4813('0x3'));var moment=require(_0x4813('0x4'));var BPromise=require(_0x4813('0x5'));var Mustache=require('mustache');var util=require(_0x4813('0x6'));var path=require('path');var sox=require(_0x4813('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4813('0x8'));var squel=require('squel');var crypto=require(_0x4813('0x9'));var jsforce=require(_0x4813('0xa'));var deskjs=require(_0x4813('0xb'));var toCsv=require(_0x4813('0xc'));var querystring=require(_0x4813('0xd'));var Papa=require(_0x4813('0xe'));var Redis=require(_0x4813('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4813('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4813('0x11'));var logger=require('../../config/logger')(_0x4813('0x12'));var utils=require('../../config/utils');var config=require(_0x4813('0x13'));var licenseUtil=require(_0x4813('0x14'));var db=require(_0x4813('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3fe30f,_0x1ec7d2){_0x1ec7d2=_0x1ec7d2||0xcc;return function(_0x19d226){if(_0x19d226){return _0x3fe30f[_0x4813('0x16')](_0x1ec7d2);}return _0x3fe30f[_0x4813('0x17')](_0x1ec7d2)[_0x4813('0x18')]();};}function respondWithResult(_0x2ee706,_0x43bc5a){_0x43bc5a=_0x43bc5a||0xc8;return function(_0x3029bf){if(_0x3029bf){return _0x2ee706[_0x4813('0x17')](_0x43bc5a)['json'](_0x3029bf);}};}function respondWithFilteredResult(_0x45c04a,_0x255c5d){return function(_0x861ef2){if(_0x861ef2){var _0x2685b8=typeof _0x255c5d['offset']==='undefined'&&typeof _0x255c5d[_0x4813('0x19')]===_0x4813('0x1a');var _0x573ae2=_0x861ef2[_0x4813('0x1b')];var _0x5b5ca5=_0x2685b8?0x0:_0x255c5d[_0x4813('0x1c')];var _0x9972d9=_0x2685b8?_0x861ef2['count']:_0x255c5d['offset']+_0x255c5d['limit'];var _0x2f6e73;if(_0x9972d9>=_0x573ae2){_0x9972d9=_0x573ae2;_0x2f6e73=0xc8;}else{_0x2f6e73=0xce;}_0x45c04a[_0x4813('0x17')](_0x2f6e73);return _0x45c04a['set'](_0x4813('0x1d'),_0x5b5ca5+'-'+_0x9972d9+'/'+_0x573ae2)['json'](_0x861ef2);}return null;};}function patchUpdates(_0x33029b){return function(_0x56fc9e){try{jsonpatch[_0x4813('0x1e')](_0x56fc9e,_0x33029b,!![]);}catch(_0x147a0f){return BPromise['reject'](_0x147a0f);}return _0x56fc9e[_0x4813('0x1f')]();};}function saveUpdates(_0xa5a1a3,_0x1f7cf2){return function(_0x27f260){if(_0x27f260){return _0x27f260['update'](_0xa5a1a3)[_0x4813('0x20')](function(_0xfc4a86){return _0xfc4a86;});}return null;};}function removeEntity(_0x3f3433,_0x34c5dc){return function(_0x4fc03b){if(_0x4fc03b){return _0x4fc03b[_0x4813('0x21')]()[_0x4813('0x20')](function(){_0x3f3433[_0x4813('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ae848,_0x58d2a4){return function(_0x2bb5a4){if(!_0x2bb5a4){_0x5ae848[_0x4813('0x16')](0x194);}return _0x2bb5a4;};}function handleError(_0x41ce25,_0x50a58c){_0x50a58c=_0x50a58c||0x1f4;return function(_0x4366f3){logger[_0x4813('0x22')](_0x4366f3['stack']);if(_0x4366f3[_0x4813('0x23')]){delete _0x4366f3['name'];}_0x41ce25[_0x4813('0x17')](_0x50a58c)[_0x4813('0x24')](_0x4366f3);};}exports[_0x4813('0x25')]=function(_0x5112f9,_0x25576c){var _0x5d53ba={},_0x4bc0b8={},_0x39d28c={'count':0x0,'rows':[]};var _0x3f4bed=_[_0x4813('0x26')](db[_0x4813('0x27')][_0x4813('0x28')],function(_0x14fbaf){return{'name':_0x14fbaf[_0x4813('0x29')],'type':_0x14fbaf[_0x4813('0x2a')]['key']};});_0x4bc0b8[_0x4813('0x2b')]=_[_0x4813('0x26')](_0x3f4bed,'name');_0x4bc0b8[_0x4813('0x2c')]=_[_0x4813('0x2d')](_0x5112f9[_0x4813('0x2c')]);_0x4bc0b8[_0x4813('0x2e')]=_['intersection'](_0x4bc0b8['model'],_0x4bc0b8[_0x4813('0x2c')]);_0x5d53ba[_0x4813('0x2f')]=_[_0x4813('0x30')](_0x4bc0b8['model'],qs['fields'](_0x5112f9[_0x4813('0x2c')][_0x4813('0x31')]));_0x5d53ba[_0x4813('0x2f')]=_0x5d53ba['attributes'][_0x4813('0x32')]?_0x5d53ba[_0x4813('0x2f')]:_0x4bc0b8[_0x4813('0x2b')];if(!_0x5112f9[_0x4813('0x2c')][_0x4813('0x33')](_0x4813('0x34'))){_0x5d53ba[_0x4813('0x19')]=qs[_0x4813('0x19')](_0x5112f9[_0x4813('0x2c')][_0x4813('0x19')]);_0x5d53ba[_0x4813('0x1c')]=qs[_0x4813('0x1c')](_0x5112f9[_0x4813('0x2c')][_0x4813('0x1c')]);}_0x5d53ba[_0x4813('0x35')]=qs['sort'](_0x5112f9[_0x4813('0x2c')][_0x4813('0x36')]);_0x5d53ba['where']=qs['filters'](_[_0x4813('0x37')](_0x5112f9['query'],_0x4bc0b8[_0x4813('0x2e')]),_0x3f4bed);if(_0x5112f9['query']['filter']){_0x5d53ba['where']=_['merge'](_0x5d53ba[_0x4813('0x38')],{'$or':_['map'](_0x3f4bed,function(_0x41a9cb){if(_0x41a9cb['type']!==_0x4813('0x39')){var _0x3cc4b6={};_0x3cc4b6[_0x41a9cb[_0x4813('0x23')]]={'$like':'%'+_0x5112f9[_0x4813('0x2c')][_0x4813('0x3a')]+'%'};return _0x3cc4b6;}})});}_0x5d53ba=_['merge']({},_0x5d53ba,_0x5112f9[_0x4813('0x3b')]);var _0x57d0af={'where':_0x5d53ba[_0x4813('0x38')]};return db[_0x4813('0x27')][_0x4813('0x1b')](_0x57d0af)[_0x4813('0x20')](function(_0x413966){_0x39d28c[_0x4813('0x1b')]=_0x413966;if(_0x5112f9[_0x4813('0x2c')][_0x4813('0x3c')]){_0x5d53ba['include']=[{'all':!![]}];}return db[_0x4813('0x27')][_0x4813('0x3d')](_0x5d53ba);})[_0x4813('0x20')](function(_0x480288){_0x39d28c['rows']=_0x480288;return _0x39d28c;})[_0x4813('0x20')](respondWithFilteredResult(_0x25576c,_0x5d53ba))['catch'](handleError(_0x25576c,null));};exports[_0x4813('0x3e')]=function(_0x15fa8c,_0x478138){var _0x5d67ec={'raw':![],'where':{'id':_0x15fa8c[_0x4813('0x3f')]['id']}},_0x1b40fa={};_0x1b40fa[_0x4813('0x2b')]=_[_0x4813('0x2d')](db[_0x4813('0x27')][_0x4813('0x28')]);_0x1b40fa[_0x4813('0x2c')]=_['keys'](_0x15fa8c[_0x4813('0x2c')]);_0x1b40fa['filters']=_[_0x4813('0x30')](_0x1b40fa[_0x4813('0x2b')],_0x1b40fa['query']);_0x5d67ec[_0x4813('0x2f')]=_[_0x4813('0x30')](_0x1b40fa['model'],qs[_0x4813('0x31')](_0x15fa8c[_0x4813('0x2c')][_0x4813('0x31')]));_0x5d67ec[_0x4813('0x2f')]=_0x5d67ec[_0x4813('0x2f')]['length']?_0x5d67ec[_0x4813('0x2f')]:_0x1b40fa['model'];if(_0x15fa8c[_0x4813('0x2c')][_0x4813('0x3c')]){_0x5d67ec[_0x4813('0x40')]=[{'all':!![]}];}_0x5d67ec=_[_0x4813('0x41')]({},_0x5d67ec,_0x15fa8c[_0x4813('0x3b')]);return db[_0x4813('0x27')]['find'](_0x5d67ec)[_0x4813('0x20')](handleEntityNotFound(_0x478138,null))['then'](respondWithResult(_0x478138,null))['catch'](handleError(_0x478138,null));};exports[_0x4813('0x42')]=function(_0x1d93e0,_0x21bdc0){return db['FreshsalesAccount'][_0x4813('0x42')](_0x1d93e0['body'],{})[_0x4813('0x20')](respondWithResult(_0x21bdc0,0xc9))['catch'](handleError(_0x21bdc0,null));};exports['update']=function(_0x3e05ff,_0x3ca0af){if(_0x3e05ff[_0x4813('0x43')]['id']){delete _0x3e05ff[_0x4813('0x43')]['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x3e05ff[_0x4813('0x3f')]['id']}})[_0x4813('0x20')](handleEntityNotFound(_0x3ca0af,null))[_0x4813('0x20')](saveUpdates(_0x3e05ff[_0x4813('0x43')],null))[_0x4813('0x20')](respondWithResult(_0x3ca0af,null))['catch'](handleError(_0x3ca0af,null));};exports[_0x4813('0x21')]=function(_0x3b0a72,_0x496f83){return db[_0x4813('0x27')][_0x4813('0x44')]({'where':{'id':_0x3b0a72[_0x4813('0x3f')]['id']}})['then'](handleEntityNotFound(_0x496f83,null))[_0x4813('0x20')](removeEntity(_0x496f83,null))['catch'](handleError(_0x496f83,null));};exports[_0x4813('0x45')]=function(_0x36e9f6,_0x44c221,_0x56a90b){var _0x5dfd1c={};var _0x141058={};var _0x27770e;var _0x40407b;return db['FreshsalesAccount'][_0x4813('0x46')]({'where':{'id':_0x36e9f6[_0x4813('0x3f')]['id']}})[_0x4813('0x20')](handleEntityNotFound(_0x44c221,null))[_0x4813('0x20')](function(_0x42d06d){if(_0x42d06d){_0x27770e=_0x42d06d;_0x141058[_0x4813('0x2b')]=_[_0x4813('0x2d')](db[_0x4813('0x47')][_0x4813('0x28')]);_0x141058['query']=_[_0x4813('0x2d')](_0x36e9f6[_0x4813('0x2c')]);_0x141058['filters']=_[_0x4813('0x30')](_0x141058[_0x4813('0x2b')],_0x141058['query']);_0x5dfd1c[_0x4813('0x2f')]=_[_0x4813('0x30')](_0x141058[_0x4813('0x2b')],qs[_0x4813('0x31')](_0x36e9f6[_0x4813('0x2c')][_0x4813('0x31')]));_0x5dfd1c['attributes']=_0x5dfd1c[_0x4813('0x2f')][_0x4813('0x32')]?_0x5dfd1c[_0x4813('0x2f')]:_0x141058['model'];_0x5dfd1c['order']=qs[_0x4813('0x36')](_0x36e9f6[_0x4813('0x2c')][_0x4813('0x36')]);_0x5dfd1c[_0x4813('0x38')]=qs[_0x4813('0x2e')](_['pick'](_0x36e9f6[_0x4813('0x2c')],_0x141058[_0x4813('0x2e')]));if(_0x36e9f6['query']['filter']){_0x5dfd1c[_0x4813('0x38')]=_[_0x4813('0x41')](_0x5dfd1c['where'],{'$or':_[_0x4813('0x26')](_0x5dfd1c[_0x4813('0x2f')],function(_0x4fe49f){var _0x354445={};_0x354445[_0x4fe49f]={'$like':'%'+_0x36e9f6[_0x4813('0x2c')]['filter']+'%'};return _0x354445;})});}_0x5dfd1c=_[_0x4813('0x41')]({},_0x5dfd1c,_0x36e9f6[_0x4813('0x3b')]);return _0x27770e['getConfigurations'](_0x5dfd1c);}})['then'](function(_0x24b57e){if(_0x24b57e){_0x40407b=_0x24b57e[_0x4813('0x32')];if(!_0x36e9f6[_0x4813('0x2c')][_0x4813('0x33')](_0x4813('0x34'))){_0x5dfd1c[_0x4813('0x19')]=qs['limit'](_0x36e9f6[_0x4813('0x2c')][_0x4813('0x19')]);_0x5dfd1c[_0x4813('0x1c')]=qs[_0x4813('0x1c')](_0x36e9f6[_0x4813('0x2c')][_0x4813('0x1c')]);}return _0x27770e[_0x4813('0x45')](_0x5dfd1c);}})['then'](function(_0x5b3996){if(_0x5b3996){return _0x5b3996?{'count':_0x40407b,'rows':_0x5b3996}:null;}})[_0x4813('0x20')](respondWithResult(_0x44c221,null))[_0x4813('0x48')](handleError(_0x44c221,null));};exports[_0x4813('0x49')]=function(_0x156444,_0x2c7b3c,_0x3035a5){if(_0x156444[_0x4813('0x43')]['id']){delete _0x156444['body']['id'];}return db[_0x4813('0x27')][_0x4813('0x46')]({'where':{'id':_0x156444[_0x4813('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c7b3c,null))[_0x4813('0x20')](function(_0x354b6a){if(_0x354b6a){_0x156444[_0x4813('0x43')][_0x4813('0x4a')]=_0x354b6a['id'];_0x156444[_0x4813('0x43')]['Subjects']=integrations[_0x4813('0x4b')](_0x156444[_0x4813('0x43')][_0x4813('0x4c')],_0x156444[_0x4813('0x43')][_0x4813('0x2a')]);_0x156444[_0x4813('0x43')]['Descriptions']=integrations[_0x4813('0x4d')](_0x156444['body'][_0x4813('0x4c')],_0x156444[_0x4813('0x43')][_0x4813('0x2a')]);return db[_0x4813('0x47')][_0x4813('0x42')](_0x156444['body'],{'include':[{'model':db[_0x4813('0x4e')],'as':_0x4813('0x4f')},{'model':db[_0x4813('0x4e')],'as':_0x4813('0x50')}]});}return null;})['then'](respondWithResult(_0x2c7b3c,null))[_0x4813('0x48')](handleError(_0x2c7b3c,null));};exports[_0x4813('0x51')]=function(_0x26306e,_0x4d3ffc,_0x4ecc51){var _0x522fc6='';var _0x314ea8='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x26306e[_0x4813('0x3f')]['id']},'attributes':['id',_0x4813('0x52'),_0x4813('0x53'),_0x4813('0x54')]})[_0x4813('0x20')](handleEntityNotFound(_0x4d3ffc,null))[_0x4813('0x20')](function(_0x3cc258){if(_0x3cc258){_0x314ea8=_0x3cc258[_0x4813('0x52')];_0x522fc6=_0x3cc258[_0x4813('0x53')];var _0x4311dc=_0x3cc258[_0x4813('0x53')]['slice'](-0x1);if(_0x4311dc==='/'){_0x522fc6=_0x522fc6['substring'](0x0,_0x522fc6[_0x4813('0x55')](_0x4311dc));}return rp({'method':'GET','uri':util[_0x4813('0x56')](_0x4813('0x57'),_0x522fc6,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x3cc258[_0x4813('0x54')]},'json':!![]});}})[_0x4813('0x20')](function(_0xf9edf7){if(_0xf9edf7){var _0x3cc482=_0xf9edf7[_0x4813('0x58')];var _0x216868=![];var _0x3a4589=null;for(_0x3a4589=0x0;_0x3a4589<_0x3cc482[_0x4813('0x32')];_0x3a4589++){if(_0x3cc482[_0x3a4589][_0x4813('0x59')]===_0x314ea8){_0x216868=!![];}}if(_0x216868){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x4813('0x20')](respondWithResult(_0x4d3ffc,null))[_0x4813('0x48')](function(_0x16e414){var _0x54ff26=_0x26306e[_0x4813('0x2c')][_0x4813('0x5a')]?0x1f4:_0x16e414[_0x4813('0x5b')]||0x1f4;logger[_0x4813('0x22')](_0x4813('0x5c'),_0x4813('0x51'),_0x54ff26,JSON['stringify'](_0x16e414));delete _0x16e414['name'];if(_0x54ff26===0x191){_0x54ff26=0x190;}_0x4d3ffc[_0x4813('0x17')](_0x54ff26)[_0x4813('0x24')](_0x26306e[_0x4813('0x2c')][_0x4813('0x5a')]?{'message':'Wrong\x20credentials','statusCode':_0x16e414['statusCode']}:_0x16e414);});};
\ No newline at end of file
index 7629403..a7b66c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbff5=['FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../components/integrations/configuration','exports','define'];(function(_0x2f3a89,_0x957295){var _0x5c1315=function(_0x21d8d6){while(--_0x21d8d6){_0x2f3a89['push'](_0x2f3a89['shift']());}};_0x5c1315(++_0x957295);}(_0xbff5,0x1bc));var _0x5bff=function(_0x1cded4,_0x5543f4){_0x1cded4=_0x1cded4-0x0;var _0x204c0c=_0xbff5[_0x1cded4];return _0x204c0c;};'use strict';var _=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var logger=require(_0x5bff('0x2'))(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var rp=require(_0x5bff('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bff('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x5bff('0x8'));module[_0x5bff('0x9')]=function(_0x151add,_0xa54c57){return _0x151add[_0x5bff('0xa')](_0x5bff('0xb'),attributes,{'tableName':_0x5bff('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd117=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x81f6fa,_0x47177b){var _0x36cdb5=function(_0x17377e){while(--_0x17377e){_0x81f6fa['push'](_0x81f6fa['shift']());}};_0x36cdb5(++_0x47177b);}(_0xd117,0x182));var _0x7d11=function(_0xe4d6c6,_0x3bdbf2){_0xe4d6c6=_0xe4d6c6-0x0;var _0x3a8935=_0xd117[_0xe4d6c6];return _0x3a8935;};'use strict';var _=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var logger=require(_0x7d11('0x2'))(_0x7d11('0x3'));var moment=require(_0x7d11('0x4'));var BPromise=require(_0x7d11('0x5'));var rp=require(_0x7d11('0x6'));var fs=require('fs');var path=require(_0x7d11('0x7'));var rimraf=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var attributes=require(_0x7d11('0xa'));var integrations=require(_0x7d11('0xb'));module[_0x7d11('0xc')]=function(_0x40c3c4,_0x345602){return _0x40c3c4[_0x7d11('0xd')]('FreshsalesAccount',attributes,{'tableName':_0x7d11('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d33eff5..27c8b60 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4745=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','attributes','limit','include','map','model','then','raw','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0x4745,0x1e7));var _0x5474=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x4745[_0x110c3d];return _0x226d67;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var BPromise=require(_0x5474('0x3'));var rs=require(_0x5474('0x4'));var fs=require('fs');var Redis=require(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var utils=require(_0x5474('0x7'));var logger=require(_0x5474('0x8'))(_0x5474('0x9'));var config=require(_0x5474('0xa'));var jayson=require(_0x5474('0xb'));var client=jayson['client'][_0x5474('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x431f81,_0x57add7,_0x13929f){return new BPromise(function(_0x5d778b,_0x902ba8){return client[_0x5474('0xd')](_0x431f81,_0x13929f)['then'](function(_0xf876f8){logger[_0x5474('0xe')](_0x5474('0xf'),_0x57add7,_0x5474('0x10'));logger[_0x5474('0x11')](_0x5474('0x12'),_0x57add7,_0x5474('0x10'),JSON[_0x5474('0x13')](_0xf876f8));if(_0xf876f8['error']){if(_0xf876f8[_0x5474('0x14')][_0x5474('0x15')]===0x1f4){logger[_0x5474('0x14')](_0x5474('0xf'),_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x902ba8(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}logger[_0x5474('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x5d778b(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x57add7,'request\x20sent');_0x5d778b(_0xf876f8['result'][_0x5474('0x16')]);}})[_0x5474('0x17')](function(_0x2da774){logger['error'](_0x5474('0xf'),_0x57add7,_0x2da774);_0x902ba8(_0x2da774);});});}exports[_0x5474('0x18')]=function(_0x56dbfa){var _0x22b37d=this;return new Promise(function(_0x198fc8,_0x18b0fe){return db[_0x5474('0x19')][_0x5474('0x1a')]({'raw':_0x56dbfa['options']?_0x56dbfa[_0x5474('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')]['where']||null:null,'attributes':_0x56dbfa['options']?_0x56dbfa['options'][_0x5474('0x1c')]||null:null,'limit':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1d')]||null:null,'include':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1e')],function(_0x542d1f){return{'model':db[_0x542d1f['model']],'as':_0x542d1f['as'],'attributes':_0x542d1f[_0x5474('0x1c')],'include':_0x542d1f[_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x542d1f['include'],function(_0x24997a){return{'model':db[_0x24997a['model']],'as':_0x24997a['as'],'attributes':_0x24997a[_0x5474('0x1c')],'include':_0x24997a[_0x5474('0x1e')]?_['map'](_0x24997a[_0x5474('0x1e')],function(_0x5d4cd7){return{'model':db[_0x5d4cd7[_0x5474('0x20')]],'as':_0x5d4cd7['as'],'attributes':_0x5d4cd7['attributes']};}):[]};}):[]};}):[]:[]})[_0x5474('0x21')](function(_0x1384e4){logger[_0x5474('0xe')]('GetFreshsalesAccount',_0x56dbfa);logger[_0x5474('0x11')](_0x5474('0x18'),_0x56dbfa,JSON['stringify'](_0x1384e4));_0x198fc8(_0x1384e4);})['catch'](function(_0x5d2381){logger['error'](_0x5474('0x18'),_0x5d2381[_0x5474('0x16')],_0x56dbfa);_0x18b0fe(_0x22b37d['error'](0x1f4,_0x5d2381[_0x5474('0x16')]));});});};exports['ShowFreshsalesAccount']=function(_0xc1e0ce){var _0x58f27a=this;return new Promise(function(_0x70774f,_0x530cdb){return db[_0x5474('0x19')]['find']({'raw':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce[_0x5474('0x1b')][_0x5474('0x22')]===undefined?!![]:![]:!![],'where':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce['options']['where']||null:null,'attributes':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce[_0x5474('0x1b')][_0x5474('0x1c')]||null:null,'include':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce['options']['include']?_[_0x5474('0x1f')](_0xc1e0ce[_0x5474('0x1b')]['include'],function(_0x3ce359){return{'model':db[_0x3ce359[_0x5474('0x20')]],'as':_0x3ce359['as'],'attributes':_0x3ce359[_0x5474('0x1c')],'include':_0x3ce359[_0x5474('0x1e')]?_['map'](_0x3ce359[_0x5474('0x1e')],function(_0x409111){return{'model':db[_0x409111[_0x5474('0x20')]],'as':_0x409111['as'],'attributes':_0x409111['attributes'],'include':_0x409111[_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x409111[_0x5474('0x1e')],function(_0x2f4589){return{'model':db[_0x2f4589['model']],'as':_0x2f4589['as'],'attributes':_0x2f4589['attributes']};}):[]};}):[]};}):[]:[]})[_0x5474('0x21')](function(_0x3eccef){logger[_0x5474('0xe')](_0x5474('0x23'),_0xc1e0ce);logger['debug'](_0x5474('0x23'),_0xc1e0ce,JSON[_0x5474('0x13')](_0x3eccef));_0x70774f(_0x3eccef);})[_0x5474('0x17')](function(_0x22009e){logger['error']('ShowFreshsalesAccount',_0x22009e['message'],_0xc1e0ce);_0x530cdb(_0x58f27a[_0x5474('0x14')](0x1f4,_0x22009e['message']));});});};
\ No newline at end of file
+var _0xef0f=['FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','where','include','model','attributes','map','ShowFreshsalesAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x47746e,_0x5e6ee3){var _0x5d0860=function(_0x5bbd83){while(--_0x5bbd83){_0x47746e['push'](_0x47746e['shift']());}};_0x5d0860(++_0x5e6ee3);}(_0xef0f,0x168));var _0xfef0=function(_0x10b253,_0x5acad5){_0x10b253=_0x10b253-0x0;var _0x5c08fb=_0xef0f[_0x10b253];return _0x5c08fb;};'use strict';var _=require(_0xfef0('0x0'));var util=require('util');var moment=require(_0xfef0('0x1'));var BPromise=require(_0xfef0('0x2'));var rs=require(_0xfef0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfef0('0x4'))['db'];var utils=require(_0xfef0('0x5'));var logger=require(_0xfef0('0x6'))('rpc');var config=require(_0xfef0('0x7'));var jayson=require(_0xfef0('0x8'));var client=jayson[_0xfef0('0x9')][_0xfef0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xad43e,_0x11dfd7,_0x5130bd){return new BPromise(function(_0x41ec94,_0x58cf6d){return client[_0xfef0('0xb')](_0xad43e,_0x5130bd)[_0xfef0('0xc')](function(_0x3a81cc){logger[_0xfef0('0xd')](_0xfef0('0xe'),_0x11dfd7,_0xfef0('0xf'));logger[_0xfef0('0x10')](_0xfef0('0x11'),_0x11dfd7,_0xfef0('0xf'),JSON[_0xfef0('0x12')](_0x3a81cc));if(_0x3a81cc[_0xfef0('0x13')]){if(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x14')]===0x1f4){logger[_0xfef0('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);return _0x58cf6d(_0x3a81cc[_0xfef0('0x13')][_0xfef0('0x15')]);}logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x3a81cc[_0xfef0('0x13')]['message']);return _0x41ec94(_0x3a81cc[_0xfef0('0x13')]['message']);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x11dfd7,_0xfef0('0xf'));_0x41ec94(_0x3a81cc[_0xfef0('0x16')][_0xfef0('0x15')]);}})[_0xfef0('0x17')](function(_0x2a96d9){logger[_0xfef0('0x13')](_0xfef0('0xe'),_0x11dfd7,_0x2a96d9);_0x58cf6d(_0x2a96d9);});});}exports[_0xfef0('0x18')]=function(_0x581459){var _0xd60678=this;return new Promise(function(_0x1642cd,_0x1577fa){return db[_0xfef0('0x19')][_0xfef0('0x1a')]({'raw':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x581459['options']?_0x581459[_0xfef0('0x1b')]['attributes']||null:null,'limit':_0x581459[_0xfef0('0x1b')]?_0x581459[_0xfef0('0x1b')]['limit']||null:null,'include':_0x581459['options']?_0x581459['options'][_0xfef0('0x1d')]?_['map'](_0x581459[_0xfef0('0x1b')][_0xfef0('0x1d')],function(_0x1a8d66){return{'model':db[_0x1a8d66[_0xfef0('0x1e')]],'as':_0x1a8d66['as'],'attributes':_0x1a8d66[_0xfef0('0x1f')],'include':_0x1a8d66[_0xfef0('0x1d')]?_['map'](_0x1a8d66['include'],function(_0x316e20){return{'model':db[_0x316e20[_0xfef0('0x1e')]],'as':_0x316e20['as'],'attributes':_0x316e20[_0xfef0('0x1f')],'include':_0x316e20[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x316e20[_0xfef0('0x1d')],function(_0x5df04f){return{'model':db[_0x5df04f[_0xfef0('0x1e')]],'as':_0x5df04f['as'],'attributes':_0x5df04f[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1a6758){logger[_0xfef0('0xd')](_0xfef0('0x18'),_0x581459);logger[_0xfef0('0x10')](_0xfef0('0x18'),_0x581459,JSON[_0xfef0('0x12')](_0x1a6758));_0x1642cd(_0x1a6758);})[_0xfef0('0x17')](function(_0x3e026a){logger[_0xfef0('0x13')](_0xfef0('0x18'),_0x3e026a[_0xfef0('0x15')],_0x581459);_0x1577fa(_0xd60678[_0xfef0('0x13')](0x1f4,_0x3e026a['message']));});});};exports[_0xfef0('0x21')]=function(_0x5806bd){var _0x4eaf74=this;return new Promise(function(_0x7d1692,_0x2ae54a){return db['FreshsalesAccount']['find']({'raw':_0x5806bd['options']?_0x5806bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd[_0xfef0('0x1b')][_0xfef0('0x1c')]||null:null,'attributes':_0x5806bd['options']?_0x5806bd['options']['attributes']||null:null,'include':_0x5806bd[_0xfef0('0x1b')]?_0x5806bd['options'][_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x5806bd[_0xfef0('0x1b')]['include'],function(_0x3cad13){return{'model':db[_0x3cad13['model']],'as':_0x3cad13['as'],'attributes':_0x3cad13[_0xfef0('0x1f')],'include':_0x3cad13[_0xfef0('0x1d')]?_[_0xfef0('0x20')](_0x3cad13[_0xfef0('0x1d')],function(_0x3e1a64){return{'model':db[_0x3e1a64[_0xfef0('0x1e')]],'as':_0x3e1a64['as'],'attributes':_0x3e1a64[_0xfef0('0x1f')],'include':_0x3e1a64[_0xfef0('0x1d')]?_['map'](_0x3e1a64[_0xfef0('0x1d')],function(_0xea09ec){return{'model':db[_0xea09ec[_0xfef0('0x1e')]],'as':_0xea09ec['as'],'attributes':_0xea09ec[_0xfef0('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xfef0('0xc')](function(_0x262341){logger[_0xfef0('0xd')](_0xfef0('0x21'),_0x5806bd);logger[_0xfef0('0x10')](_0xfef0('0x21'),_0x5806bd,JSON[_0xfef0('0x12')](_0x262341));_0x7d1692(_0x262341);})[_0xfef0('0x17')](function(_0x366667){logger['error'](_0xfef0('0x21'),_0x366667['message'],_0x5806bd);_0x2ae54a(_0x4eaf74[_0xfef0('0x13')](0x1f4,_0x366667[_0xfef0('0x15')]));});});};
\ No newline at end of file
index 22e1069..dd2f812 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e51=['/:id/descriptions','getDescriptions','/:id/fields','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects'];(function(_0x272f68,_0x2d7f74){var _0x35796b=function(_0x585f44){while(--_0x585f44){_0x272f68['push'](_0x272f68['shift']());}};_0x35796b(++_0x2d7f74);}(_0x3e51,0xa5));var _0x13e5=function(_0x19e8f1,_0x22558b){_0x19e8f1=_0x19e8f1-0x0;var _0x2559db=_0x3e51[_0x19e8f1];return _0x2559db;};'use strict';var multer=require(_0x13e5('0x0'));var util=require(_0x13e5('0x1'));var path=require(_0x13e5('0x2'));var timeout=require(_0x13e5('0x3'));var express=require(_0x13e5('0x4'));var router=express[_0x13e5('0x5')]();var fs_extra=require(_0x13e5('0x6'));var auth=require(_0x13e5('0x7'));var interaction=require(_0x13e5('0x8'));var config=require(_0x13e5('0x9'));var controller=require(_0x13e5('0xa'));router[_0x13e5('0xb')]('/',auth[_0x13e5('0xc')](),controller[_0x13e5('0xd')]);router['get'](_0x13e5('0xe'),auth[_0x13e5('0xc')](),controller['show']);router[_0x13e5('0xb')](_0x13e5('0xf'),auth['isAuthenticated'](),controller[_0x13e5('0x10')]);router[_0x13e5('0xb')](_0x13e5('0x11'),auth[_0x13e5('0xc')](),controller[_0x13e5('0x12')]);router[_0x13e5('0xb')](_0x13e5('0x13'),auth[_0x13e5('0xc')](),controller['getFields']);router[_0x13e5('0x14')]('/',auth[_0x13e5('0xc')](),controller[_0x13e5('0x15')]);router[_0x13e5('0x16')](_0x13e5('0xe'),auth[_0x13e5('0xc')](),controller['update']);router[_0x13e5('0x17')](_0x13e5('0xe'),auth[_0x13e5('0xc')](),controller[_0x13e5('0x18')]);module[_0x13e5('0x19')]=router;
\ No newline at end of file
+var _0xb8b9=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy'];(function(_0x475b88,_0x3e3588){var _0x52081b=function(_0x30f208){while(--_0x30f208){_0x475b88['push'](_0x475b88['shift']());}};_0x52081b(++_0x3e3588);}(_0xb8b9,0x1aa));var _0x9b8b=function(_0x458686,_0x336f6a){_0x458686=_0x458686-0x0;var _0x15e073=_0xb8b9[_0x458686];return _0x15e073;};'use strict';var multer=require(_0x9b8b('0x0'));var util=require(_0x9b8b('0x1'));var path=require(_0x9b8b('0x2'));var timeout=require(_0x9b8b('0x3'));var express=require('express');var router=express[_0x9b8b('0x4')]();var fs_extra=require(_0x9b8b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9b8b('0x6'));var config=require(_0x9b8b('0x7'));var controller=require(_0x9b8b('0x8'));router[_0x9b8b('0x9')]('/',auth[_0x9b8b('0xa')](),controller[_0x9b8b('0xb')]);router[_0x9b8b('0x9')](_0x9b8b('0xc'),auth[_0x9b8b('0xa')](),controller['show']);router['get'](_0x9b8b('0xd'),auth['isAuthenticated'](),controller[_0x9b8b('0xe')]);router['get'](_0x9b8b('0xf'),auth[_0x9b8b('0xa')](),controller['getDescriptions']);router[_0x9b8b('0x9')](_0x9b8b('0x10'),auth[_0x9b8b('0xa')](),controller[_0x9b8b('0x11')]);router[_0x9b8b('0x12')]('/',auth[_0x9b8b('0xa')](),controller[_0x9b8b('0x13')]);router[_0x9b8b('0x14')](_0x9b8b('0xc'),auth[_0x9b8b('0xa')](),controller[_0x9b8b('0x15')]);router[_0x9b8b('0x16')](_0x9b8b('0xc'),auth[_0x9b8b('0xa')](),controller[_0x9b8b('0x17')]);module[_0x9b8b('0x18')]=router;
\ No newline at end of file
index 131b1b4..fe7f1c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c6d=['exports','STRING','sequelize'];(function(_0x174373,_0x2dc406){var _0x14831e=function(_0x465328){while(--_0x465328){_0x174373['push'](_0x174373['shift']());}};_0x14831e(++_0x2dc406);}(_0x5c6d,0x1c4));var _0xd5c6=function(_0x59bd52,_0x37993b){_0x59bd52=_0x59bd52-0x0;var _0x1595e1=_0x5c6d[_0x59bd52];return _0x1595e1;};'use strict';var Sequelize=require(_0xd5c6('0x0'));module[_0xd5c6('0x1')]={'name':{'type':Sequelize[_0xd5c6('0x2')]},'description':{'type':Sequelize[_0xd5c6('0x2')]}};
\ No newline at end of file
+var _0x81bd=['sequelize','exports','STRING'];(function(_0x5e68f0,_0x181383){var _0x320008=function(_0x5cf8ac){while(--_0x5cf8ac){_0x5e68f0['push'](_0x5e68f0['shift']());}};_0x320008(++_0x181383);}(_0x81bd,0x183));var _0xd81b=function(_0x49d7ca,_0x514fc4){_0x49d7ca=_0x49d7ca-0x0;var _0x12422f=_0x81bd[_0x49d7ca];return _0x12422f;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd81b('0x2')]}};
\ No newline at end of file
index 533d6c6..125f2fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f20=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','FreshsalesConfiguration','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','getSubjects','findOne','FreshsalesField','sort','getDescriptions','pick','getFields','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x3c4f1f,_0x20d3ec){var _0x19cb69=function(_0x2e04bc){while(--_0x2e04bc){_0x3c4f1f['push'](_0x3c4f1f['shift']());}};_0x19cb69(++_0x20d3ec);}(_0x3f20,0x137));var _0x03f2=function(_0x12a02e,_0x3b226c){_0x12a02e=_0x12a02e-0x0;var _0x49a3a3=_0x3f20[_0x12a02e];return _0x49a3a3;};'use strict';var emlformat=require(_0x03f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x03f2('0x1'));var jsonpatch=require(_0x03f2('0x2'));var rp=require(_0x03f2('0x3'));var moment=require(_0x03f2('0x4'));var BPromise=require(_0x03f2('0x5'));var Mustache=require('mustache');var util=require(_0x03f2('0x6'));var path=require(_0x03f2('0x7'));var sox=require(_0x03f2('0x8'));var csv=require(_0x03f2('0x9'));var ejs=require(_0x03f2('0xa'));var fs=require('fs');var fs_extra=require(_0x03f2('0xb'));var _=require(_0x03f2('0xc'));var squel=require(_0x03f2('0xd'));var crypto=require('crypto');var jsforce=require(_0x03f2('0xe'));var deskjs=require(_0x03f2('0xf'));var toCsv=require(_0x03f2('0x9'));var querystring=require(_0x03f2('0x10'));var Papa=require(_0x03f2('0x11'));var Redis=require(_0x03f2('0x12'));var authService=require(_0x03f2('0x13'));var qs=require(_0x03f2('0x14'));var as=require(_0x03f2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x03f2('0x16'))(_0x03f2('0x17'));var utils=require(_0x03f2('0x18'));var config=require(_0x03f2('0x19'));var licenseUtil=require(_0x03f2('0x1a'));var db=require(_0x03f2('0x1b'))['db'];function respondWithStatusCode(_0x5c4aa2,_0x9971f7){_0x9971f7=_0x9971f7||0xcc;return function(_0x261193){if(_0x261193){return _0x5c4aa2['sendStatus'](_0x9971f7);}return _0x5c4aa2[_0x03f2('0x1c')](_0x9971f7)[_0x03f2('0x1d')]();};}function respondWithResult(_0x132815,_0x281c02){_0x281c02=_0x281c02||0xc8;return function(_0x364580){if(_0x364580){return _0x132815[_0x03f2('0x1c')](_0x281c02)[_0x03f2('0x1e')](_0x364580);}};}function respondWithFilteredResult(_0x2c1fea,_0x2d732c){return function(_0x5a346a){if(_0x5a346a){var _0x1ac4a8=typeof _0x2d732c[_0x03f2('0x1f')]===_0x03f2('0x20')&&typeof _0x2d732c[_0x03f2('0x21')]===_0x03f2('0x20');var _0x3d22f8=_0x5a346a[_0x03f2('0x22')];var _0x34a8f2=_0x1ac4a8?0x0:_0x2d732c[_0x03f2('0x1f')];var _0x42233a=_0x1ac4a8?_0x5a346a[_0x03f2('0x22')]:_0x2d732c[_0x03f2('0x1f')]+_0x2d732c[_0x03f2('0x21')];var _0xd9117c;if(_0x42233a>=_0x3d22f8){_0x42233a=_0x3d22f8;_0xd9117c=0xc8;}else{_0xd9117c=0xce;}_0x2c1fea[_0x03f2('0x1c')](_0xd9117c);return _0x2c1fea[_0x03f2('0x23')](_0x03f2('0x24'),_0x34a8f2+'-'+_0x42233a+'/'+_0x3d22f8)[_0x03f2('0x1e')](_0x5a346a);}return null;};}function patchUpdates(_0x28c58f){return function(_0x4244a7){try{jsonpatch[_0x03f2('0x25')](_0x4244a7,_0x28c58f,!![]);}catch(_0x2033a1){return BPromise[_0x03f2('0x26')](_0x2033a1);}return _0x4244a7[_0x03f2('0x27')]();};}function saveUpdates(_0x2dd6ed,_0x507050){return function(_0x5c52af){if(_0x5c52af){return _0x5c52af[_0x03f2('0x28')](_0x2dd6ed)[_0x03f2('0x29')](function(_0x28e320){return _0x28e320;});}return null;};}function removeEntity(_0x2e4779,_0x27957e){return function(_0x9ee19a){if(_0x9ee19a){return _0x9ee19a[_0x03f2('0x2a')]()[_0x03f2('0x29')](function(){_0x2e4779['status'](0xcc)[_0x03f2('0x1d')]();});}};}function handleEntityNotFound(_0x4886c1,_0x55717e){return function(_0x2b44d9){if(!_0x2b44d9){_0x4886c1['sendStatus'](0x194);}return _0x2b44d9;};}function handleError(_0x23a513,_0x5c122b){_0x5c122b=_0x5c122b||0x1f4;return function(_0x2d2f3e){logger['error'](_0x2d2f3e[_0x03f2('0x2b')]);if(_0x2d2f3e['name']){delete _0x2d2f3e[_0x03f2('0x2c')];}_0x23a513[_0x03f2('0x1c')](_0x5c122b)[_0x03f2('0x2d')](_0x2d2f3e);};}exports['index']=function(_0x1b8973,_0x4740a4){var _0x37b520={},_0x370fa8={},_0x44bc17={'count':0x0,'rows':[]};var _0x23c762=_[_0x03f2('0x2e')](db[_0x03f2('0x2f')]['rawAttributes'],function(_0x56aba6){return{'name':_0x56aba6[_0x03f2('0x30')],'type':_0x56aba6[_0x03f2('0x31')][_0x03f2('0x32')]};});_0x370fa8[_0x03f2('0x33')]=_[_0x03f2('0x2e')](_0x23c762,_0x03f2('0x2c'));_0x370fa8[_0x03f2('0x34')]=_[_0x03f2('0x35')](_0x1b8973[_0x03f2('0x34')]);_0x370fa8['filters']=_['intersection'](_0x370fa8[_0x03f2('0x33')],_0x370fa8[_0x03f2('0x34')]);_0x37b520['attributes']=_[_0x03f2('0x36')](_0x370fa8[_0x03f2('0x33')],qs[_0x03f2('0x37')](_0x1b8973[_0x03f2('0x34')][_0x03f2('0x37')]));_0x37b520[_0x03f2('0x38')]=_0x37b520[_0x03f2('0x38')][_0x03f2('0x39')]?_0x37b520[_0x03f2('0x38')]:_0x370fa8[_0x03f2('0x33')];if(!_0x1b8973['query'][_0x03f2('0x3a')](_0x03f2('0x3b'))){_0x37b520['limit']=qs[_0x03f2('0x21')](_0x1b8973[_0x03f2('0x34')][_0x03f2('0x21')]);_0x37b520[_0x03f2('0x1f')]=qs['offset'](_0x1b8973[_0x03f2('0x34')][_0x03f2('0x1f')]);}_0x37b520[_0x03f2('0x3c')]=qs['sort'](_0x1b8973[_0x03f2('0x34')]['sort']);_0x37b520[_0x03f2('0x3d')]=qs[_0x03f2('0x3e')](_['pick'](_0x1b8973[_0x03f2('0x34')],_0x370fa8[_0x03f2('0x3e')]),_0x23c762);if(_0x1b8973[_0x03f2('0x34')][_0x03f2('0x3f')]){_0x37b520[_0x03f2('0x3d')]=_['merge'](_0x37b520[_0x03f2('0x3d')],{'$or':_[_0x03f2('0x2e')](_0x23c762,function(_0x92a837){if(_0x92a837['type']!=='VIRTUAL'){var _0x1c5132={};_0x1c5132[_0x92a837['name']]={'$like':'%'+_0x1b8973['query'][_0x03f2('0x3f')]+'%'};return _0x1c5132;}})});}_0x37b520=_[_0x03f2('0x40')]({},_0x37b520,_0x1b8973[_0x03f2('0x41')]);var _0x189f2b={'where':_0x37b520[_0x03f2('0x3d')]};return db[_0x03f2('0x2f')][_0x03f2('0x22')](_0x189f2b)[_0x03f2('0x29')](function(_0x384cc9){_0x44bc17[_0x03f2('0x22')]=_0x384cc9;if(_0x1b8973[_0x03f2('0x34')]['includeAll']){_0x37b520[_0x03f2('0x42')]=[{'all':!![]}];}return db[_0x03f2('0x2f')][_0x03f2('0x43')](_0x37b520);})[_0x03f2('0x29')](function(_0x279e89){_0x44bc17[_0x03f2('0x44')]=_0x279e89;return _0x44bc17;})[_0x03f2('0x29')](respondWithFilteredResult(_0x4740a4,_0x37b520))['catch'](handleError(_0x4740a4,null));};exports[_0x03f2('0x45')]=function(_0x10920b,_0x1e3797){var _0x3bb28e={'raw':![],'where':{'id':_0x10920b[_0x03f2('0x46')]['id']}},_0x5d23d9={};_0x5d23d9[_0x03f2('0x33')]=_[_0x03f2('0x35')](db[_0x03f2('0x2f')][_0x03f2('0x47')]);_0x5d23d9[_0x03f2('0x34')]=_[_0x03f2('0x35')](_0x10920b['query']);_0x5d23d9[_0x03f2('0x3e')]=_[_0x03f2('0x36')](_0x5d23d9[_0x03f2('0x33')],_0x5d23d9['query']);_0x3bb28e['attributes']=_[_0x03f2('0x36')](_0x5d23d9[_0x03f2('0x33')],qs[_0x03f2('0x37')](_0x10920b['query'][_0x03f2('0x37')]));_0x3bb28e[_0x03f2('0x38')]=_0x3bb28e[_0x03f2('0x38')][_0x03f2('0x39')]?_0x3bb28e[_0x03f2('0x38')]:_0x5d23d9[_0x03f2('0x33')];if(_0x10920b[_0x03f2('0x34')][_0x03f2('0x48')]){_0x3bb28e[_0x03f2('0x42')]=[{'all':!![]}];}_0x3bb28e=_['merge']({},_0x3bb28e,_0x10920b[_0x03f2('0x41')]);return db[_0x03f2('0x2f')][_0x03f2('0x49')](_0x3bb28e)[_0x03f2('0x29')](handleEntityNotFound(_0x1e3797,null))[_0x03f2('0x29')](respondWithResult(_0x1e3797,null))[_0x03f2('0x4a')](handleError(_0x1e3797,null));};exports[_0x03f2('0x4b')]=function(_0x380580,_0x15243c){return db['FreshsalesConfiguration']['create'](_0x380580['body'],{})[_0x03f2('0x29')](respondWithResult(_0x15243c,0xc9))['catch'](handleError(_0x15243c,null));};exports[_0x03f2('0x28')]=function(_0x570a8f,_0x420336){if(_0x570a8f[_0x03f2('0x4c')]['id']){delete _0x570a8f[_0x03f2('0x4c')]['id'];}return db['FreshsalesConfiguration'][_0x03f2('0x49')]({'where':{'id':_0x570a8f[_0x03f2('0x46')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x420336,null))[_0x03f2('0x29')](saveUpdates(_0x570a8f[_0x03f2('0x4c')],null))['then'](respondWithResult(_0x420336,null))[_0x03f2('0x4a')](handleError(_0x420336,null));};exports[_0x03f2('0x2a')]=function(_0x2fe0ab,_0x35934c){return db[_0x03f2('0x2f')][_0x03f2('0x49')]({'where':{'id':_0x2fe0ab[_0x03f2('0x46')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x35934c,null))[_0x03f2('0x29')](removeEntity(_0x35934c,null))[_0x03f2('0x4a')](handleError(_0x35934c,null));};exports[_0x03f2('0x4d')]=function(_0x49bb11,_0x2203e7,_0x43a13d){var _0x54abf4={};var _0x773537={};var _0x520f1c;var _0x23bb74;return db['FreshsalesConfiguration'][_0x03f2('0x4e')]({'where':{'id':_0x49bb11['params']['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x2203e7,null))['then'](function(_0x1c2928){if(_0x1c2928){_0x520f1c=_0x1c2928;_0x773537[_0x03f2('0x33')]=_[_0x03f2('0x35')](db[_0x03f2('0x4f')][_0x03f2('0x47')]);_0x773537['query']=_[_0x03f2('0x35')](_0x49bb11[_0x03f2('0x34')]);_0x773537[_0x03f2('0x3e')]=_[_0x03f2('0x36')](_0x773537[_0x03f2('0x33')],_0x773537['query']);_0x54abf4[_0x03f2('0x38')]=_[_0x03f2('0x36')](_0x773537[_0x03f2('0x33')],qs[_0x03f2('0x37')](_0x49bb11[_0x03f2('0x34')]['fields']));_0x54abf4[_0x03f2('0x38')]=_0x54abf4[_0x03f2('0x38')][_0x03f2('0x39')]?_0x54abf4['attributes']:_0x773537['model'];_0x54abf4[_0x03f2('0x3c')]=qs['sort'](_0x49bb11[_0x03f2('0x34')][_0x03f2('0x50')]);_0x54abf4['where']=qs[_0x03f2('0x3e')](_['pick'](_0x49bb11[_0x03f2('0x34')],_0x773537[_0x03f2('0x3e')]));if(_0x49bb11[_0x03f2('0x34')][_0x03f2('0x3f')]){_0x54abf4[_0x03f2('0x3d')]=_[_0x03f2('0x40')](_0x54abf4[_0x03f2('0x3d')],{'$or':_['map'](_0x54abf4[_0x03f2('0x38')],function(_0x2427d3){var _0x16e187={};_0x16e187[_0x2427d3]={'$like':'%'+_0x49bb11[_0x03f2('0x34')][_0x03f2('0x3f')]+'%'};return _0x16e187;})});}_0x54abf4=_['merge']({},_0x54abf4,_0x49bb11[_0x03f2('0x41')]);return _0x520f1c[_0x03f2('0x4d')](_0x54abf4);}})['then'](function(_0x217b9e){if(_0x217b9e){_0x23bb74=_0x217b9e[_0x03f2('0x39')];if(!_0x49bb11[_0x03f2('0x34')][_0x03f2('0x3a')]('nolimit')){_0x54abf4[_0x03f2('0x21')]=qs[_0x03f2('0x21')](_0x49bb11['query'][_0x03f2('0x21')]);_0x54abf4['offset']=qs[_0x03f2('0x1f')](_0x49bb11['query'][_0x03f2('0x1f')]);}return _0x520f1c[_0x03f2('0x4d')](_0x54abf4);}})[_0x03f2('0x29')](function(_0xfd5b31){if(_0xfd5b31){return _0xfd5b31?{'count':_0x23bb74,'rows':_0xfd5b31}:null;}})[_0x03f2('0x29')](respondWithResult(_0x2203e7,null))[_0x03f2('0x4a')](handleError(_0x2203e7,null));};exports[_0x03f2('0x51')]=function(_0x12bc6c,_0x284725,_0x19e563){var _0x232121={};var _0x57dea4={};var _0x5579eb;var _0x2f6a62;return db[_0x03f2('0x2f')]['findOne']({'where':{'id':_0x12bc6c[_0x03f2('0x46')]['id']}})[_0x03f2('0x29')](handleEntityNotFound(_0x284725,null))[_0x03f2('0x29')](function(_0x323a2a){if(_0x323a2a){_0x5579eb=_0x323a2a;_0x57dea4['model']=_[_0x03f2('0x35')](db[_0x03f2('0x4f')]['rawAttributes']);_0x57dea4[_0x03f2('0x34')]=_[_0x03f2('0x35')](_0x12bc6c['query']);_0x57dea4[_0x03f2('0x3e')]=_[_0x03f2('0x36')](_0x57dea4['model'],_0x57dea4[_0x03f2('0x34')]);_0x232121[_0x03f2('0x38')]=_[_0x03f2('0x36')](_0x57dea4[_0x03f2('0x33')],qs['fields'](_0x12bc6c['query']['fields']));_0x232121[_0x03f2('0x38')]=_0x232121[_0x03f2('0x38')]['length']?_0x232121[_0x03f2('0x38')]:_0x57dea4['model'];_0x232121[_0x03f2('0x3c')]=qs['sort'](_0x12bc6c['query'][_0x03f2('0x50')]);_0x232121[_0x03f2('0x3d')]=qs[_0x03f2('0x3e')](_[_0x03f2('0x52')](_0x12bc6c[_0x03f2('0x34')],_0x57dea4[_0x03f2('0x3e')]));if(_0x12bc6c['query']['filter']){_0x232121[_0x03f2('0x3d')]=_['merge'](_0x232121[_0x03f2('0x3d')],{'$or':_[_0x03f2('0x2e')](_0x232121['attributes'],function(_0x218250){var _0x48714c={};_0x48714c[_0x218250]={'$like':'%'+_0x12bc6c[_0x03f2('0x34')][_0x03f2('0x3f')]+'%'};return _0x48714c;})});}_0x232121=_['merge']({},_0x232121,_0x12bc6c[_0x03f2('0x41')]);return _0x5579eb['getDescriptions'](_0x232121);}})[_0x03f2('0x29')](function(_0x371409){if(_0x371409){_0x2f6a62=_0x371409[_0x03f2('0x39')];if(!_0x12bc6c[_0x03f2('0x34')][_0x03f2('0x3a')](_0x03f2('0x3b'))){_0x232121['limit']=qs[_0x03f2('0x21')](_0x12bc6c[_0x03f2('0x34')][_0x03f2('0x21')]);_0x232121[_0x03f2('0x1f')]=qs[_0x03f2('0x1f')](_0x12bc6c[_0x03f2('0x34')][_0x03f2('0x1f')]);}return _0x5579eb[_0x03f2('0x51')](_0x232121);}})[_0x03f2('0x29')](function(_0x5227c9){if(_0x5227c9){return _0x5227c9?{'count':_0x2f6a62,'rows':_0x5227c9}:null;}})[_0x03f2('0x29')](respondWithResult(_0x284725,null))[_0x03f2('0x4a')](handleError(_0x284725,null));};exports['getFields']=function(_0x4dd2ed,_0x48541d,_0xc5d446){var _0x2878e4={};var _0xb5f372={};var _0x5866b0;var _0x4cf5cc;return db[_0x03f2('0x2f')][_0x03f2('0x4e')]({'where':{'id':_0x4dd2ed['params']['id']}})['then'](handleEntityNotFound(_0x48541d,null))[_0x03f2('0x29')](function(_0x26b5b3){if(_0x26b5b3){_0x5866b0=_0x26b5b3;_0xb5f372[_0x03f2('0x33')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0xb5f372[_0x03f2('0x34')]=_[_0x03f2('0x35')](_0x4dd2ed[_0x03f2('0x34')]);_0xb5f372[_0x03f2('0x3e')]=_[_0x03f2('0x36')](_0xb5f372['model'],_0xb5f372[_0x03f2('0x34')]);_0x2878e4[_0x03f2('0x38')]=_[_0x03f2('0x36')](_0xb5f372[_0x03f2('0x33')],qs[_0x03f2('0x37')](_0x4dd2ed[_0x03f2('0x34')][_0x03f2('0x37')]));_0x2878e4[_0x03f2('0x38')]=_0x2878e4[_0x03f2('0x38')][_0x03f2('0x39')]?_0x2878e4[_0x03f2('0x38')]:_0xb5f372[_0x03f2('0x33')];_0x2878e4[_0x03f2('0x3c')]=qs[_0x03f2('0x50')](_0x4dd2ed[_0x03f2('0x34')][_0x03f2('0x50')]);_0x2878e4[_0x03f2('0x3d')]=qs['filters'](_[_0x03f2('0x52')](_0x4dd2ed['query'],_0xb5f372[_0x03f2('0x3e')]));if(_0x4dd2ed['query']['filter']){_0x2878e4[_0x03f2('0x3d')]=_[_0x03f2('0x40')](_0x2878e4[_0x03f2('0x3d')],{'$or':_[_0x03f2('0x2e')](_0x2878e4[_0x03f2('0x38')],function(_0x5ce7b0){var _0x54b388={};_0x54b388[_0x5ce7b0]={'$like':'%'+_0x4dd2ed['query'][_0x03f2('0x3f')]+'%'};return _0x54b388;})});}_0x2878e4=_['merge']({},_0x2878e4,_0x4dd2ed[_0x03f2('0x41')]);return _0x5866b0[_0x03f2('0x53')](_0x2878e4);}})['then'](function(_0x537555){if(_0x537555){_0x4cf5cc=_0x537555[_0x03f2('0x39')];if(!_0x4dd2ed[_0x03f2('0x34')]['hasOwnProperty'](_0x03f2('0x3b'))){_0x2878e4[_0x03f2('0x21')]=qs['limit'](_0x4dd2ed[_0x03f2('0x34')][_0x03f2('0x21')]);_0x2878e4[_0x03f2('0x1f')]=qs[_0x03f2('0x1f')](_0x4dd2ed[_0x03f2('0x34')][_0x03f2('0x1f')]);}return _0x5866b0[_0x03f2('0x53')](_0x2878e4);}})[_0x03f2('0x29')](function(_0x57bf75){if(_0x57bf75){return _0x57bf75?{'count':_0x4cf5cc,'rows':_0x57bf75}:null;}})[_0x03f2('0x29')](respondWithResult(_0x48541d,null))[_0x03f2('0x4a')](handleError(_0x48541d,null));};
\ No newline at end of file
+var _0xe6c1=['querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','name','send','index','map','rawAttributes','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','FreshsalesConfiguration','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','options','getFields','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xe6c1,0xd7));var _0x1e6c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe6c1[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x1e6c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1e6c('0x1'));var rp=require(_0x1e6c('0x2'));var moment=require(_0x1e6c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1e6c('0x4'));var util=require(_0x1e6c('0x5'));var path=require(_0x1e6c('0x6'));var sox=require(_0x1e6c('0x7'));var csv=require(_0x1e6c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1e6c('0x9'));var squel=require(_0x1e6c('0xa'));var crypto=require('crypto');var jsforce=require(_0x1e6c('0xb'));var deskjs=require(_0x1e6c('0xc'));var toCsv=require(_0x1e6c('0x8'));var querystring=require(_0x1e6c('0xd'));var Papa=require(_0x1e6c('0xe'));var Redis=require('ioredis');var authService=require(_0x1e6c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1e6c('0x10'));var hardwareService=require(_0x1e6c('0x11'));var logger=require(_0x1e6c('0x12'))(_0x1e6c('0x13'));var utils=require(_0x1e6c('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x1e6c('0x15'));var db=require(_0x1e6c('0x16'))['db'];function respondWithStatusCode(_0x2cb648,_0x515e4f){_0x515e4f=_0x515e4f||0xcc;return function(_0x56405e){if(_0x56405e){return _0x2cb648[_0x1e6c('0x17')](_0x515e4f);}return _0x2cb648[_0x1e6c('0x18')](_0x515e4f)[_0x1e6c('0x19')]();};}function respondWithResult(_0x423c90,_0x2494cb){_0x2494cb=_0x2494cb||0xc8;return function(_0x52e8e4){if(_0x52e8e4){return _0x423c90[_0x1e6c('0x18')](_0x2494cb)['json'](_0x52e8e4);}};}function respondWithFilteredResult(_0x18b014,_0x5c3d54){return function(_0x493373){if(_0x493373){var _0x474153=typeof _0x5c3d54[_0x1e6c('0x1a')]===_0x1e6c('0x1b')&&typeof _0x5c3d54[_0x1e6c('0x1c')]==='undefined';var _0x2d1f49=_0x493373[_0x1e6c('0x1d')];var _0x1bdca8=_0x474153?0x0:_0x5c3d54[_0x1e6c('0x1a')];var _0x27ea7c=_0x474153?_0x493373[_0x1e6c('0x1d')]:_0x5c3d54[_0x1e6c('0x1a')]+_0x5c3d54['limit'];var _0x2d0360;if(_0x27ea7c>=_0x2d1f49){_0x27ea7c=_0x2d1f49;_0x2d0360=0xc8;}else{_0x2d0360=0xce;}_0x18b014['status'](_0x2d0360);return _0x18b014[_0x1e6c('0x1e')](_0x1e6c('0x1f'),_0x1bdca8+'-'+_0x27ea7c+'/'+_0x2d1f49)['json'](_0x493373);}return null;};}function patchUpdates(_0x54ecd9){return function(_0x369c12){try{jsonpatch['apply'](_0x369c12,_0x54ecd9,!![]);}catch(_0x432189){return BPromise[_0x1e6c('0x20')](_0x432189);}return _0x369c12['save']();};}function saveUpdates(_0xcc6e47,_0x510bc9){return function(_0x4b0bac){if(_0x4b0bac){return _0x4b0bac[_0x1e6c('0x21')](_0xcc6e47)[_0x1e6c('0x22')](function(_0x49c665){return _0x49c665;});}return null;};}function removeEntity(_0x59ba11,_0x555c5b){return function(_0x1a3b40){if(_0x1a3b40){return _0x1a3b40[_0x1e6c('0x23')]()['then'](function(){_0x59ba11[_0x1e6c('0x18')](0xcc)[_0x1e6c('0x19')]();});}};}function handleEntityNotFound(_0x33ad14,_0x45566f){return function(_0x51e4f0){if(!_0x51e4f0){_0x33ad14[_0x1e6c('0x17')](0x194);}return _0x51e4f0;};}function handleError(_0x4197d5,_0x530b94){_0x530b94=_0x530b94||0x1f4;return function(_0x307627){logger['error'](_0x307627['stack']);if(_0x307627[_0x1e6c('0x24')]){delete _0x307627[_0x1e6c('0x24')];}_0x4197d5['status'](_0x530b94)[_0x1e6c('0x25')](_0x307627);};}exports[_0x1e6c('0x26')]=function(_0x4a01e5,_0x26055f){var _0x5119d9={},_0x1c9761={},_0x5017d6={'count':0x0,'rows':[]};var _0x422b21=_[_0x1e6c('0x27')](db['FreshsalesConfiguration'][_0x1e6c('0x28')],function(_0x385701){return{'name':_0x385701['fieldName'],'type':_0x385701[_0x1e6c('0x29')]['key']};});_0x1c9761[_0x1e6c('0x2a')]=_[_0x1e6c('0x27')](_0x422b21,_0x1e6c('0x24'));_0x1c9761[_0x1e6c('0x2b')]=_['keys'](_0x4a01e5[_0x1e6c('0x2b')]);_0x1c9761[_0x1e6c('0x2c')]=_['intersection'](_0x1c9761[_0x1e6c('0x2a')],_0x1c9761[_0x1e6c('0x2b')]);_0x5119d9['attributes']=_[_0x1e6c('0x2d')](_0x1c9761['model'],qs['fields'](_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x2e')]));_0x5119d9[_0x1e6c('0x2f')]=_0x5119d9[_0x1e6c('0x2f')][_0x1e6c('0x30')]?_0x5119d9['attributes']:_0x1c9761[_0x1e6c('0x2a')];if(!_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x31')](_0x1e6c('0x32'))){_0x5119d9[_0x1e6c('0x1c')]=qs[_0x1e6c('0x1c')](_0x4a01e5['query']['limit']);_0x5119d9[_0x1e6c('0x1a')]=qs['offset'](_0x4a01e5['query']['offset']);}_0x5119d9[_0x1e6c('0x33')]=qs[_0x1e6c('0x34')](_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x34')]);_0x5119d9['where']=qs['filters'](_[_0x1e6c('0x35')](_0x4a01e5[_0x1e6c('0x2b')],_0x1c9761[_0x1e6c('0x2c')]),_0x422b21);if(_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x36')]){_0x5119d9[_0x1e6c('0x37')]=_[_0x1e6c('0x38')](_0x5119d9['where'],{'$or':_[_0x1e6c('0x27')](_0x422b21,function(_0x4ecdea){if(_0x4ecdea['type']!==_0x1e6c('0x39')){var _0x53f471={};_0x53f471[_0x4ecdea[_0x1e6c('0x24')]]={'$like':'%'+_0x4a01e5['query']['filter']+'%'};return _0x53f471;}})});}_0x5119d9=_[_0x1e6c('0x38')]({},_0x5119d9,_0x4a01e5['options']);var _0x3f3dab={'where':_0x5119d9['where']};return db[_0x1e6c('0x3a')]['count'](_0x3f3dab)[_0x1e6c('0x22')](function(_0x56af44){_0x5017d6[_0x1e6c('0x1d')]=_0x56af44;if(_0x4a01e5[_0x1e6c('0x2b')][_0x1e6c('0x3b')]){_0x5119d9[_0x1e6c('0x3c')]=[{'all':!![]}];}return db[_0x1e6c('0x3a')][_0x1e6c('0x3d')](_0x5119d9);})['then'](function(_0x20fad2){_0x5017d6[_0x1e6c('0x3e')]=_0x20fad2;return _0x5017d6;})[_0x1e6c('0x22')](respondWithFilteredResult(_0x26055f,_0x5119d9))[_0x1e6c('0x3f')](handleError(_0x26055f,null));};exports[_0x1e6c('0x40')]=function(_0x54d8f0,_0x2c87e8){var _0x182453={'raw':![],'where':{'id':_0x54d8f0[_0x1e6c('0x41')]['id']}},_0x5c8a5a={};_0x5c8a5a[_0x1e6c('0x2a')]=_[_0x1e6c('0x42')](db[_0x1e6c('0x3a')][_0x1e6c('0x28')]);_0x5c8a5a[_0x1e6c('0x2b')]=_['keys'](_0x54d8f0[_0x1e6c('0x2b')]);_0x5c8a5a[_0x1e6c('0x2c')]=_[_0x1e6c('0x2d')](_0x5c8a5a[_0x1e6c('0x2a')],_0x5c8a5a[_0x1e6c('0x2b')]);_0x182453[_0x1e6c('0x2f')]=_[_0x1e6c('0x2d')](_0x5c8a5a[_0x1e6c('0x2a')],qs[_0x1e6c('0x2e')](_0x54d8f0[_0x1e6c('0x2b')][_0x1e6c('0x2e')]));_0x182453['attributes']=_0x182453[_0x1e6c('0x2f')]['length']?_0x182453[_0x1e6c('0x2f')]:_0x5c8a5a[_0x1e6c('0x2a')];if(_0x54d8f0[_0x1e6c('0x2b')][_0x1e6c('0x3b')]){_0x182453[_0x1e6c('0x3c')]=[{'all':!![]}];}_0x182453=_[_0x1e6c('0x38')]({},_0x182453,_0x54d8f0['options']);return db[_0x1e6c('0x3a')][_0x1e6c('0x43')](_0x182453)[_0x1e6c('0x22')](handleEntityNotFound(_0x2c87e8,null))[_0x1e6c('0x22')](respondWithResult(_0x2c87e8,null))[_0x1e6c('0x3f')](handleError(_0x2c87e8,null));};exports[_0x1e6c('0x44')]=function(_0x480b87,_0x350091){return db[_0x1e6c('0x3a')][_0x1e6c('0x44')](_0x480b87[_0x1e6c('0x45')],{})[_0x1e6c('0x22')](respondWithResult(_0x350091,0xc9))[_0x1e6c('0x3f')](handleError(_0x350091,null));};exports[_0x1e6c('0x21')]=function(_0x86989d,_0x2cd6bb){if(_0x86989d[_0x1e6c('0x45')]['id']){delete _0x86989d[_0x1e6c('0x45')]['id'];}return db[_0x1e6c('0x3a')]['find']({'where':{'id':_0x86989d[_0x1e6c('0x41')]['id']}})['then'](handleEntityNotFound(_0x2cd6bb,null))[_0x1e6c('0x22')](saveUpdates(_0x86989d[_0x1e6c('0x45')],null))['then'](respondWithResult(_0x2cd6bb,null))[_0x1e6c('0x3f')](handleError(_0x2cd6bb,null));};exports['destroy']=function(_0x2cbc32,_0x59f3e4){return db[_0x1e6c('0x3a')][_0x1e6c('0x43')]({'where':{'id':_0x2cbc32[_0x1e6c('0x41')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x59f3e4,null))['then'](removeEntity(_0x59f3e4,null))['catch'](handleError(_0x59f3e4,null));};exports[_0x1e6c('0x46')]=function(_0x106243,_0xc7b95b,_0xcb1152){var _0x1dbed8={};var _0x10db6c={};var _0x4eef70;var _0x26d5cb;return db['FreshsalesConfiguration'][_0x1e6c('0x47')]({'where':{'id':_0x106243[_0x1e6c('0x41')]['id']}})['then'](handleEntityNotFound(_0xc7b95b,null))[_0x1e6c('0x22')](function(_0x317ebc){if(_0x317ebc){_0x4eef70=_0x317ebc;_0x10db6c[_0x1e6c('0x2a')]=_['keys'](db[_0x1e6c('0x48')][_0x1e6c('0x28')]);_0x10db6c[_0x1e6c('0x2b')]=_[_0x1e6c('0x42')](_0x106243[_0x1e6c('0x2b')]);_0x10db6c[_0x1e6c('0x2c')]=_[_0x1e6c('0x2d')](_0x10db6c[_0x1e6c('0x2a')],_0x10db6c[_0x1e6c('0x2b')]);_0x1dbed8[_0x1e6c('0x2f')]=_[_0x1e6c('0x2d')](_0x10db6c[_0x1e6c('0x2a')],qs['fields'](_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x2e')]));_0x1dbed8[_0x1e6c('0x2f')]=_0x1dbed8[_0x1e6c('0x2f')][_0x1e6c('0x30')]?_0x1dbed8[_0x1e6c('0x2f')]:_0x10db6c[_0x1e6c('0x2a')];_0x1dbed8[_0x1e6c('0x33')]=qs[_0x1e6c('0x34')](_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x34')]);_0x1dbed8[_0x1e6c('0x37')]=qs[_0x1e6c('0x2c')](_[_0x1e6c('0x35')](_0x106243['query'],_0x10db6c['filters']));if(_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x36')]){_0x1dbed8[_0x1e6c('0x37')]=_[_0x1e6c('0x38')](_0x1dbed8[_0x1e6c('0x37')],{'$or':_[_0x1e6c('0x27')](_0x1dbed8['attributes'],function(_0x7e4259){var _0x2ea16f={};_0x2ea16f[_0x7e4259]={'$like':'%'+_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x36')]+'%'};return _0x2ea16f;})});}_0x1dbed8=_[_0x1e6c('0x38')]({},_0x1dbed8,_0x106243['options']);return _0x4eef70['getSubjects'](_0x1dbed8);}})[_0x1e6c('0x22')](function(_0x2d7ea4){if(_0x2d7ea4){_0x26d5cb=_0x2d7ea4[_0x1e6c('0x30')];if(!_0x106243[_0x1e6c('0x2b')][_0x1e6c('0x31')](_0x1e6c('0x32'))){_0x1dbed8[_0x1e6c('0x1c')]=qs[_0x1e6c('0x1c')](_0x106243[_0x1e6c('0x2b')]['limit']);_0x1dbed8['offset']=qs[_0x1e6c('0x1a')](_0x106243[_0x1e6c('0x2b')]['offset']);}return _0x4eef70[_0x1e6c('0x46')](_0x1dbed8);}})['then'](function(_0x30acbd){if(_0x30acbd){return _0x30acbd?{'count':_0x26d5cb,'rows':_0x30acbd}:null;}})[_0x1e6c('0x22')](respondWithResult(_0xc7b95b,null))[_0x1e6c('0x3f')](handleError(_0xc7b95b,null));};exports[_0x1e6c('0x49')]=function(_0x3dd012,_0x1ca77d,_0x5c8e10){var _0x34b273={};var _0x2a763a={};var _0x4eda55;var _0x3f5f8b;return db[_0x1e6c('0x3a')][_0x1e6c('0x47')]({'where':{'id':_0x3dd012[_0x1e6c('0x41')]['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x1ca77d,null))[_0x1e6c('0x22')](function(_0x47a9b2){if(_0x47a9b2){_0x4eda55=_0x47a9b2;_0x2a763a['model']=_['keys'](db[_0x1e6c('0x48')][_0x1e6c('0x28')]);_0x2a763a[_0x1e6c('0x2b')]=_[_0x1e6c('0x42')](_0x3dd012['query']);_0x2a763a['filters']=_[_0x1e6c('0x2d')](_0x2a763a[_0x1e6c('0x2a')],_0x2a763a[_0x1e6c('0x2b')]);_0x34b273['attributes']=_[_0x1e6c('0x2d')](_0x2a763a['model'],qs[_0x1e6c('0x2e')](_0x3dd012['query']['fields']));_0x34b273[_0x1e6c('0x2f')]=_0x34b273[_0x1e6c('0x2f')]['length']?_0x34b273[_0x1e6c('0x2f')]:_0x2a763a[_0x1e6c('0x2a')];_0x34b273[_0x1e6c('0x33')]=qs['sort'](_0x3dd012['query'][_0x1e6c('0x34')]);_0x34b273[_0x1e6c('0x37')]=qs[_0x1e6c('0x2c')](_[_0x1e6c('0x35')](_0x3dd012[_0x1e6c('0x2b')],_0x2a763a['filters']));if(_0x3dd012[_0x1e6c('0x2b')][_0x1e6c('0x36')]){_0x34b273[_0x1e6c('0x37')]=_['merge'](_0x34b273[_0x1e6c('0x37')],{'$or':_['map'](_0x34b273['attributes'],function(_0x104fa1){var _0x1ae417={};_0x1ae417[_0x104fa1]={'$like':'%'+_0x3dd012[_0x1e6c('0x2b')][_0x1e6c('0x36')]+'%'};return _0x1ae417;})});}_0x34b273=_['merge']({},_0x34b273,_0x3dd012[_0x1e6c('0x4a')]);return _0x4eda55[_0x1e6c('0x49')](_0x34b273);}})[_0x1e6c('0x22')](function(_0x2fb548){if(_0x2fb548){_0x3f5f8b=_0x2fb548[_0x1e6c('0x30')];if(!_0x3dd012['query'][_0x1e6c('0x31')]('nolimit')){_0x34b273[_0x1e6c('0x1c')]=qs['limit'](_0x3dd012[_0x1e6c('0x2b')][_0x1e6c('0x1c')]);_0x34b273['offset']=qs[_0x1e6c('0x1a')](_0x3dd012[_0x1e6c('0x2b')][_0x1e6c('0x1a')]);}return _0x4eda55[_0x1e6c('0x49')](_0x34b273);}})[_0x1e6c('0x22')](function(_0x5a2c78){if(_0x5a2c78){return _0x5a2c78?{'count':_0x3f5f8b,'rows':_0x5a2c78}:null;}})[_0x1e6c('0x22')](respondWithResult(_0x1ca77d,null))[_0x1e6c('0x3f')](handleError(_0x1ca77d,null));};exports[_0x1e6c('0x4b')]=function(_0x1b28ee,_0x608973,_0x572af5){var _0x226c27={};var _0x131b36={};var _0x49c9d8;var _0x5e3589;return db[_0x1e6c('0x3a')][_0x1e6c('0x47')]({'where':{'id':_0x1b28ee['params']['id']}})[_0x1e6c('0x22')](handleEntityNotFound(_0x608973,null))['then'](function(_0x481a08){if(_0x481a08){_0x49c9d8=_0x481a08;_0x131b36[_0x1e6c('0x2a')]=_[_0x1e6c('0x42')](db[_0x1e6c('0x48')]['rawAttributes']);_0x131b36[_0x1e6c('0x2b')]=_[_0x1e6c('0x42')](_0x1b28ee[_0x1e6c('0x2b')]);_0x131b36[_0x1e6c('0x2c')]=_[_0x1e6c('0x2d')](_0x131b36[_0x1e6c('0x2a')],_0x131b36[_0x1e6c('0x2b')]);_0x226c27[_0x1e6c('0x2f')]=_[_0x1e6c('0x2d')](_0x131b36[_0x1e6c('0x2a')],qs['fields'](_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x2e')]));_0x226c27[_0x1e6c('0x2f')]=_0x226c27[_0x1e6c('0x2f')][_0x1e6c('0x30')]?_0x226c27[_0x1e6c('0x2f')]:_0x131b36['model'];_0x226c27[_0x1e6c('0x33')]=qs[_0x1e6c('0x34')](_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x34')]);_0x226c27[_0x1e6c('0x37')]=qs[_0x1e6c('0x2c')](_['pick'](_0x1b28ee[_0x1e6c('0x2b')],_0x131b36[_0x1e6c('0x2c')]));if(_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x36')]){_0x226c27[_0x1e6c('0x37')]=_[_0x1e6c('0x38')](_0x226c27['where'],{'$or':_[_0x1e6c('0x27')](_0x226c27[_0x1e6c('0x2f')],function(_0x46b514){var _0x3fab51={};_0x3fab51[_0x46b514]={'$like':'%'+_0x1b28ee[_0x1e6c('0x2b')]['filter']+'%'};return _0x3fab51;})});}_0x226c27=_[_0x1e6c('0x38')]({},_0x226c27,_0x1b28ee[_0x1e6c('0x4a')]);return _0x49c9d8[_0x1e6c('0x4b')](_0x226c27);}})['then'](function(_0xe4adf9){if(_0xe4adf9){_0x5e3589=_0xe4adf9['length'];if(!_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x31')](_0x1e6c('0x32'))){_0x226c27['limit']=qs[_0x1e6c('0x1c')](_0x1b28ee[_0x1e6c('0x2b')]['limit']);_0x226c27[_0x1e6c('0x1a')]=qs[_0x1e6c('0x1a')](_0x1b28ee[_0x1e6c('0x2b')][_0x1e6c('0x1a')]);}return _0x49c9d8[_0x1e6c('0x4b')](_0x226c27);}})['then'](function(_0x5460a4){if(_0x5460a4){return _0x5460a4?{'count':_0x5e3589,'rows':_0x5460a4}:null;}})[_0x1e6c('0x22')](respondWithResult(_0x608973,null))['catch'](handleError(_0x608973,null));};
\ No newline at end of file
index 6b057dd..738fa7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3355=['int_freshsales_configurations','moment','bluebird','request-promise','path','rimraf','./intFreshsalesConfiguration.attributes','exports','define'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x3355,0x18d));var _0x5335=function(_0x451d30,_0x813771){_0x451d30=_0x451d30-0x0;var _0x23ebc3=_0x3355[_0x451d30];return _0x23ebc3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5335('0x0'));var BPromise=require(_0x5335('0x1'));var rp=require(_0x5335('0x2'));var fs=require('fs');var path=require(_0x5335('0x3'));var rimraf=require(_0x5335('0x4'));var config=require('../../config/environment');var attributes=require(_0x5335('0x5'));module[_0x5335('0x6')]=function(_0x3d8cb4,_0xd03dc6){return _0x3d8cb4[_0x5335('0x7')]('FreshsalesConfiguration',attributes,{'tableName':_0x5335('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5309=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','lodash','util','../../config/logger'];(function(_0x2760f9,_0xefbe99){var _0x42f596=function(_0xd6f282){while(--_0xd6f282){_0x2760f9['push'](_0x2760f9['shift']());}};_0x42f596(++_0xefbe99);}(_0x5309,0x1aa));var _0x9530=function(_0x315aea,_0x318a80){_0x315aea=_0x315aea-0x0;var _0x4a4bdb=_0x5309[_0x315aea];return _0x4a4bdb;};'use strict';var _=require(_0x9530('0x0'));var util=require(_0x9530('0x1'));var logger=require(_0x9530('0x2'))(_0x9530('0x3'));var moment=require(_0x9530('0x4'));var BPromise=require(_0x9530('0x5'));var rp=require(_0x9530('0x6'));var fs=require('fs');var path=require(_0x9530('0x7'));var rimraf=require(_0x9530('0x8'));var config=require(_0x9530('0x9'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x1cb512,_0x187678){return _0x1cb512[_0x9530('0xa')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2871d97..16bd019 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x21ff=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1a0f4b,_0x423e15){var _0x3f0d93=function(_0x456670){while(--_0x456670){_0x1a0f4b['push'](_0x1a0f4b['shift']());}};_0x3f0d93(++_0x423e15);}(_0x21ff,0x6f));var _0xf21f=function(_0x2a558d,_0x2df0ff){_0x2a558d=_0x2a558d-0x0;var _0xa7bc9c=_0x21ff[_0x2a558d];return _0xa7bc9c;};'use strict';var _=require(_0xf21f('0x0'));var util=require(_0xf21f('0x1'));var moment=require(_0xf21f('0x2'));var BPromise=require(_0xf21f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf21f('0x4'))['db'];var utils=require(_0xf21f('0x5'));var logger=require(_0xf21f('0x6'))('rpc');var config=require(_0xf21f('0x7'));var jayson=require(_0xf21f('0x8'));var client=jayson[_0xf21f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d49a9,_0x59342e,_0x585d8b){return new BPromise(function(_0x2fb7ec,_0x1e5545){return client['request'](_0x2d49a9,_0x585d8b)[_0xf21f('0xa')](function(_0x4828f4){logger[_0xf21f('0xb')](_0xf21f('0xc'),_0x59342e,_0xf21f('0xd'));logger[_0xf21f('0xe')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x59342e,_0xf21f('0xd'),JSON[_0xf21f('0xf')](_0x4828f4));if(_0x4828f4[_0xf21f('0x10')]){if(_0x4828f4[_0xf21f('0x10')][_0xf21f('0x11')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x59342e,_0x4828f4['error']['message']);return _0x1e5545(_0x4828f4[_0xf21f('0x10')][_0xf21f('0x12')]);}logger[_0xf21f('0x10')](_0xf21f('0xc'),_0x59342e,_0x4828f4[_0xf21f('0x10')][_0xf21f('0x12')]);return _0x2fb7ec(_0x4828f4[_0xf21f('0x10')][_0xf21f('0x12')]);}else{logger[_0xf21f('0xb')](_0xf21f('0xc'),_0x59342e,'request\x20sent');_0x2fb7ec(_0x4828f4[_0xf21f('0x13')][_0xf21f('0x12')]);}})[_0xf21f('0x14')](function(_0x1e2c06){logger[_0xf21f('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x59342e,_0x1e2c06);_0x1e5545(_0x1e2c06);});});}
\ No newline at end of file
+var _0x8913=['client','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','info','result','message','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x2779f4,_0x14f8c4){var _0x388da4=function(_0x201070){while(--_0x201070){_0x2779f4['push'](_0x2779f4['shift']());}};_0x388da4(++_0x14f8c4);}(_0x8913,0xdf));var _0x3891=function(_0x4e6e36,_0x207701){_0x4e6e36=_0x4e6e36-0x0;var _0x46da84=_0x8913[_0x4e6e36];return _0x46da84;};'use strict';var _=require(_0x3891('0x0'));var util=require('util');var moment=require(_0x3891('0x1'));var BPromise=require(_0x3891('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3891('0x3'));var db=require(_0x3891('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3891('0x5'));var config=require(_0x3891('0x6'));var jayson=require(_0x3891('0x7'));var client=jayson[_0x3891('0x8')][_0x3891('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x534f20,_0x19306d,_0x35a381){return new BPromise(function(_0x23a10c,_0x5c000a){return client[_0x3891('0xa')](_0x534f20,_0x35a381)[_0x3891('0xb')](function(_0x503197){logger['info'](_0x3891('0xc'),_0x19306d,_0x3891('0xd'));logger['debug'](_0x3891('0xe'),_0x19306d,_0x3891('0xd'),JSON['stringify'](_0x503197));if(_0x503197[_0x3891('0xf')]){if(_0x503197[_0x3891('0xf')][_0x3891('0x10')]===0x1f4){logger[_0x3891('0xf')](_0x3891('0xc'),_0x19306d,_0x503197['error']['message']);return _0x5c000a(_0x503197[_0x3891('0xf')]['message']);}logger[_0x3891('0xf')](_0x3891('0xc'),_0x19306d,_0x503197[_0x3891('0xf')]['message']);return _0x23a10c(_0x503197[_0x3891('0xf')]['message']);}else{logger[_0x3891('0x11')](_0x3891('0xc'),_0x19306d,_0x3891('0xd'));_0x23a10c(_0x503197[_0x3891('0x12')][_0x3891('0x13')]);}})[_0x3891('0x14')](function(_0x2ad13f){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x19306d,_0x2ad13f);_0x5c000a(_0x2ad13f);});});}
\ No newline at end of file
index c282d65..dc24a81 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1542=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','exports','multer','util'];(function(_0x26e2b7,_0x2a02c5){var _0x3fe391=function(_0x20494f){while(--_0x20494f){_0x26e2b7['push'](_0x26e2b7['shift']());}};_0x3fe391(++_0x2a02c5);}(_0x1542,0x116));var _0x2154=function(_0xfe5403,_0x1628b1){_0xfe5403=_0xfe5403-0x0;var _0x2d1e48=_0x1542[_0xfe5403];return _0x2d1e48;};'use strict';var multer=require(_0x2154('0x0'));var util=require(_0x2154('0x1'));var path=require(_0x2154('0x2'));var timeout=require(_0x2154('0x3'));var express=require(_0x2154('0x4'));var router=express['Router']();var fs_extra=require(_0x2154('0x5'));var auth=require(_0x2154('0x6'));var interaction=require(_0x2154('0x7'));var config=require('../../config/environment');var controller=require(_0x2154('0x8'));router[_0x2154('0x9')]('/',auth['isAuthenticated'](),controller[_0x2154('0xa')]);router[_0x2154('0x9')](_0x2154('0xb'),auth[_0x2154('0xc')](),controller[_0x2154('0xd')]);router[_0x2154('0xe')]('/',auth[_0x2154('0xc')](),controller[_0x2154('0xf')]);router[_0x2154('0x10')](_0x2154('0xb'),auth['isAuthenticated'](),controller[_0x2154('0x11')]);router[_0x2154('0x12')](_0x2154('0xb'),auth[_0x2154('0xc')](),controller['destroy']);module[_0x2154('0x13')]=router;
\ No newline at end of file
+var _0xc041=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc041,0x1ea));var _0x1c04=function(_0x29cd14,_0x245c40){_0x29cd14=_0x29cd14-0x0;var _0x4229d1=_0xc041[_0x29cd14];return _0x4229d1;};'use strict';var multer=require(_0x1c04('0x0'));var util=require(_0x1c04('0x1'));var path=require('path');var timeout=require(_0x1c04('0x2'));var express=require('express');var router=express[_0x1c04('0x3')]();var fs_extra=require(_0x1c04('0x4'));var auth=require(_0x1c04('0x5'));var interaction=require(_0x1c04('0x6'));var config=require(_0x1c04('0x7'));var controller=require(_0x1c04('0x8'));router['get']('/',auth[_0x1c04('0x9')](),controller['index']);router['get'](_0x1c04('0xa'),auth[_0x1c04('0x9')](),controller[_0x1c04('0xb')]);router[_0x1c04('0xc')]('/',auth[_0x1c04('0x9')](),controller['create']);router['put'](_0x1c04('0xa'),auth[_0x1c04('0x9')](),controller[_0x1c04('0xd')]);router[_0x1c04('0xe')](_0x1c04('0xa'),auth[_0x1c04('0x9')](),controller[_0x1c04('0xf')]);module[_0x1c04('0x10')]=router;
\ No newline at end of file
index f583395..bd57b4d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8588=['keyValue','picklist','STRING','ENUM','BOOLEAN','exports','string','variable','customVariable'];(function(_0x4d3865,_0x122854){var _0x16a011=function(_0x31475b){while(--_0x31475b){_0x4d3865['push'](_0x4d3865['shift']());}};_0x16a011(++_0x122854);}(_0x8588,0xc2));var _0x8858=function(_0x581d2b,_0x20089a){_0x581d2b=_0x581d2b-0x0;var _0x54f5ed=_0x8588[_0x581d2b];return _0x54f5ed;};'use strict';var Sequelize=require('sequelize');module[_0x8858('0x0')]={'type':{'type':Sequelize['ENUM'](_0x8858('0x1'),_0x8858('0x2'),_0x8858('0x3'),_0x8858('0x4'),_0x8858('0x5')),'defaultValue':_0x8858('0x1')},'content':{'type':Sequelize[_0x8858('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x8858('0x7')](_0x8858('0x1'),_0x8858('0x2'),_0x8858('0x3'))},'keyContent':{'type':Sequelize[_0x8858('0x6')]},'idField':{'type':Sequelize[_0x8858('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8858('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8858('0x6')]}};
\ No newline at end of file
+var _0xb90f=['customVariable','keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable'];(function(_0x3df9dd,_0x26f5cd){var _0x4f11e4=function(_0x1993fe){while(--_0x1993fe){_0x3df9dd['push'](_0x3df9dd['shift']());}};_0x4f11e4(++_0x26f5cd);}(_0xb90f,0xd4));var _0xfb90=function(_0x1f64c1,_0x24e1ed){_0x1f64c1=_0x1f64c1-0x0;var _0x3651bb=_0xb90f[_0x1f64c1];return _0x3651bb;};'use strict';var Sequelize=require('sequelize');module[_0xfb90('0x0')]={'type':{'type':Sequelize[_0xfb90('0x1')](_0xfb90('0x2'),_0xfb90('0x3'),_0xfb90('0x4'),_0xfb90('0x5'),_0xfb90('0x6')),'defaultValue':_0xfb90('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xfb90('0x2'),_0xfb90('0x3'),_0xfb90('0x4'))},'keyContent':{'type':Sequelize[_0xfb90('0x7')]},'idField':{'type':Sequelize[_0xfb90('0x7')]},'nameField':{'type':Sequelize[_0xfb90('0x7')]},'customField':{'type':Sequelize[_0xfb90('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfb90('0x7')]}};
\ No newline at end of file
index 57427de..098c84c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f41=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','reject','save','update','then','destroy','end','error','name','send','index','map','FreshsalesField','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f41,0x98));var _0x19f4=function(_0x529f36,_0x537390){_0x529f36=_0x529f36-0x0;var _0x36e904=_0x9f41[_0x529f36];return _0x36e904;};'use strict';var emlformat=require(_0x19f4('0x0'));var rimraf=require(_0x19f4('0x1'));var zipdir=require(_0x19f4('0x2'));var jsonpatch=require(_0x19f4('0x3'));var rp=require(_0x19f4('0x4'));var moment=require(_0x19f4('0x5'));var BPromise=require(_0x19f4('0x6'));var Mustache=require(_0x19f4('0x7'));var util=require(_0x19f4('0x8'));var path=require(_0x19f4('0x9'));var sox=require(_0x19f4('0xa'));var csv=require(_0x19f4('0xb'));var ejs=require(_0x19f4('0xc'));var fs=require('fs');var fs_extra=require(_0x19f4('0xd'));var _=require(_0x19f4('0xe'));var squel=require(_0x19f4('0xf'));var crypto=require(_0x19f4('0x10'));var jsforce=require(_0x19f4('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x19f4('0xb'));var querystring=require('querystring');var Papa=require(_0x19f4('0x12'));var Redis=require(_0x19f4('0x13'));var authService=require(_0x19f4('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x19f4('0x15'));var hardwareService=require(_0x19f4('0x16'));var logger=require(_0x19f4('0x17'))(_0x19f4('0x18'));var utils=require('../../config/utils');var config=require(_0x19f4('0x19'));var licenseUtil=require(_0x19f4('0x1a'));var db=require(_0x19f4('0x1b'))['db'];function respondWithStatusCode(_0x5c92ec,_0x3fcfce){_0x3fcfce=_0x3fcfce||0xcc;return function(_0x2760a6){if(_0x2760a6){return _0x5c92ec[_0x19f4('0x1c')](_0x3fcfce);}return _0x5c92ec[_0x19f4('0x1d')](_0x3fcfce)['end']();};}function respondWithResult(_0x2dad20,_0x3b4e6d){_0x3b4e6d=_0x3b4e6d||0xc8;return function(_0x29fafb){if(_0x29fafb){return _0x2dad20[_0x19f4('0x1d')](_0x3b4e6d)[_0x19f4('0x1e')](_0x29fafb);}};}function respondWithFilteredResult(_0x5826e9,_0xb5851b){return function(_0xb8c369){if(_0xb8c369){var _0x3c5585=typeof _0xb5851b[_0x19f4('0x1f')]==='undefined'&&typeof _0xb5851b[_0x19f4('0x20')]===_0x19f4('0x21');var _0x5d1008=_0xb8c369[_0x19f4('0x22')];var _0x126f60=_0x3c5585?0x0:_0xb5851b[_0x19f4('0x1f')];var _0x1450f6=_0x3c5585?_0xb8c369[_0x19f4('0x22')]:_0xb5851b[_0x19f4('0x1f')]+_0xb5851b[_0x19f4('0x20')];var _0x3fd9ab;if(_0x1450f6>=_0x5d1008){_0x1450f6=_0x5d1008;_0x3fd9ab=0xc8;}else{_0x3fd9ab=0xce;}_0x5826e9[_0x19f4('0x1d')](_0x3fd9ab);return _0x5826e9[_0x19f4('0x23')]('Content-Range',_0x126f60+'-'+_0x1450f6+'/'+_0x5d1008)[_0x19f4('0x1e')](_0xb8c369);}return null;};}function patchUpdates(_0x2ce943){return function(_0x12cb8c){try{jsonpatch['apply'](_0x12cb8c,_0x2ce943,!![]);}catch(_0x4c454d){return BPromise[_0x19f4('0x24')](_0x4c454d);}return _0x12cb8c[_0x19f4('0x25')]();};}function saveUpdates(_0x5c9f40,_0x54d131){return function(_0x49cfcd){if(_0x49cfcd){return _0x49cfcd[_0x19f4('0x26')](_0x5c9f40)[_0x19f4('0x27')](function(_0x1d66e5){return _0x1d66e5;});}return null;};}function removeEntity(_0x113cc2,_0x3d0985){return function(_0x3eb1a5){if(_0x3eb1a5){return _0x3eb1a5[_0x19f4('0x28')]()[_0x19f4('0x27')](function(){_0x113cc2['status'](0xcc)[_0x19f4('0x29')]();});}};}function handleEntityNotFound(_0x52b5da,_0x3c834d){return function(_0x405ca8){if(!_0x405ca8){_0x52b5da[_0x19f4('0x1c')](0x194);}return _0x405ca8;};}function handleError(_0x55928b,_0x418fae){_0x418fae=_0x418fae||0x1f4;return function(_0x46eeda){logger[_0x19f4('0x2a')](_0x46eeda['stack']);if(_0x46eeda[_0x19f4('0x2b')]){delete _0x46eeda[_0x19f4('0x2b')];}_0x55928b['status'](_0x418fae)[_0x19f4('0x2c')](_0x46eeda);};}exports[_0x19f4('0x2d')]=function(_0x12a99a,_0x3ea4c0){var _0x48de02={},_0x1fdadb={},_0xd8c4f6={'count':0x0,'rows':[]};var _0x36cd5f=_[_0x19f4('0x2e')](db[_0x19f4('0x2f')]['rawAttributes'],function(_0x46090d){return{'name':_0x46090d[_0x19f4('0x30')],'type':_0x46090d[_0x19f4('0x31')]['key']};});_0x1fdadb[_0x19f4('0x32')]=_['map'](_0x36cd5f,_0x19f4('0x2b'));_0x1fdadb['query']=_['keys'](_0x12a99a[_0x19f4('0x33')]);_0x1fdadb[_0x19f4('0x34')]=_['intersection'](_0x1fdadb[_0x19f4('0x32')],_0x1fdadb[_0x19f4('0x33')]);_0x48de02['attributes']=_[_0x19f4('0x35')](_0x1fdadb[_0x19f4('0x32')],qs[_0x19f4('0x36')](_0x12a99a[_0x19f4('0x33')]['fields']));_0x48de02[_0x19f4('0x37')]=_0x48de02[_0x19f4('0x37')][_0x19f4('0x38')]?_0x48de02['attributes']:_0x1fdadb['model'];if(!_0x12a99a[_0x19f4('0x33')][_0x19f4('0x39')](_0x19f4('0x3a'))){_0x48de02[_0x19f4('0x20')]=qs[_0x19f4('0x20')](_0x12a99a[_0x19f4('0x33')]['limit']);_0x48de02[_0x19f4('0x1f')]=qs[_0x19f4('0x1f')](_0x12a99a['query']['offset']);}_0x48de02['order']=qs[_0x19f4('0x3b')](_0x12a99a[_0x19f4('0x33')]['sort']);_0x48de02[_0x19f4('0x3c')]=qs[_0x19f4('0x34')](_[_0x19f4('0x3d')](_0x12a99a['query'],_0x1fdadb[_0x19f4('0x34')]),_0x36cd5f);if(_0x12a99a[_0x19f4('0x33')][_0x19f4('0x3e')]){_0x48de02[_0x19f4('0x3c')]=_['merge'](_0x48de02[_0x19f4('0x3c')],{'$or':_[_0x19f4('0x2e')](_0x36cd5f,function(_0x3615b0){if(_0x3615b0[_0x19f4('0x31')]!==_0x19f4('0x3f')){var _0x14df45={};_0x14df45[_0x3615b0[_0x19f4('0x2b')]]={'$like':'%'+_0x12a99a['query'][_0x19f4('0x3e')]+'%'};return _0x14df45;}})});}_0x48de02=_[_0x19f4('0x40')]({},_0x48de02,_0x12a99a[_0x19f4('0x41')]);var _0x572d5f={'where':_0x48de02[_0x19f4('0x3c')]};return db[_0x19f4('0x2f')][_0x19f4('0x22')](_0x572d5f)[_0x19f4('0x27')](function(_0x8bd4e6){_0xd8c4f6[_0x19f4('0x22')]=_0x8bd4e6;if(_0x12a99a['query'][_0x19f4('0x42')]){_0x48de02[_0x19f4('0x43')]=[{'all':!![]}];}return db[_0x19f4('0x2f')][_0x19f4('0x44')](_0x48de02);})[_0x19f4('0x27')](function(_0xacf520){_0xd8c4f6[_0x19f4('0x45')]=_0xacf520;return _0xd8c4f6;})[_0x19f4('0x27')](respondWithFilteredResult(_0x3ea4c0,_0x48de02))['catch'](handleError(_0x3ea4c0,null));};exports[_0x19f4('0x46')]=function(_0x2cb5e9,_0x29f510){var _0xb4bc1e={'raw':!![],'where':{'id':_0x2cb5e9[_0x19f4('0x47')]['id']}},_0x35bbaf={};_0x35bbaf[_0x19f4('0x32')]=_[_0x19f4('0x48')](db[_0x19f4('0x2f')][_0x19f4('0x49')]);_0x35bbaf[_0x19f4('0x33')]=_[_0x19f4('0x48')](_0x2cb5e9['query']);_0x35bbaf[_0x19f4('0x34')]=_[_0x19f4('0x35')](_0x35bbaf['model'],_0x35bbaf[_0x19f4('0x33')]);_0xb4bc1e['attributes']=_[_0x19f4('0x35')](_0x35bbaf[_0x19f4('0x32')],qs[_0x19f4('0x36')](_0x2cb5e9[_0x19f4('0x33')][_0x19f4('0x36')]));_0xb4bc1e['attributes']=_0xb4bc1e[_0x19f4('0x37')]['length']?_0xb4bc1e[_0x19f4('0x37')]:_0x35bbaf['model'];if(_0x2cb5e9[_0x19f4('0x33')][_0x19f4('0x42')]){_0xb4bc1e[_0x19f4('0x43')]=[{'all':!![]}];}_0xb4bc1e=_['merge']({},_0xb4bc1e,_0x2cb5e9[_0x19f4('0x41')]);return db['FreshsalesField'][_0x19f4('0x4a')](_0xb4bc1e)['then'](handleEntityNotFound(_0x29f510,null))[_0x19f4('0x27')](respondWithResult(_0x29f510,null))[_0x19f4('0x4b')](handleError(_0x29f510,null));};exports[_0x19f4('0x4c')]=function(_0x49c8c4,_0x4a72b8){return db[_0x19f4('0x2f')][_0x19f4('0x4c')](_0x49c8c4[_0x19f4('0x4d')],{})['then'](respondWithResult(_0x4a72b8,0xc9))[_0x19f4('0x4b')](handleError(_0x4a72b8,null));};exports['update']=function(_0x4d6b94,_0x3e936b){if(_0x4d6b94[_0x19f4('0x4d')]['id']){delete _0x4d6b94['body']['id'];}return db[_0x19f4('0x2f')][_0x19f4('0x4a')]({'where':{'id':_0x4d6b94['params']['id']}})[_0x19f4('0x27')](handleEntityNotFound(_0x3e936b,null))[_0x19f4('0x27')](saveUpdates(_0x4d6b94[_0x19f4('0x4d')],null))[_0x19f4('0x27')](respondWithResult(_0x3e936b,null))[_0x19f4('0x4b')](handleError(_0x3e936b,null));};exports[_0x19f4('0x28')]=function(_0x22a700,_0x50d75d){return db[_0x19f4('0x2f')]['find']({'where':{'id':_0x22a700[_0x19f4('0x47')]['id']}})[_0x19f4('0x27')](handleEntityNotFound(_0x50d75d,null))[_0x19f4('0x27')](removeEntity(_0x50d75d,null))['catch'](handleError(_0x50d75d,null));};
\ No newline at end of file
+var _0x733a=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','include','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x733a,0x162));var _0xa733=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x733a[_0x36ed3c];return _0x52a2e0;};'use strict';var emlformat=require(_0xa733('0x0'));var rimraf=require(_0xa733('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa733('0x2'));var rp=require(_0xa733('0x3'));var moment=require(_0xa733('0x4'));var BPromise=require(_0xa733('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa733('0x6'));var sox=require(_0xa733('0x7'));var csv=require('to-csv');var ejs=require(_0xa733('0x8'));var fs=require('fs');var fs_extra=require(_0xa733('0x9'));var _=require(_0xa733('0xa'));var squel=require(_0xa733('0xb'));var crypto=require('crypto');var jsforce=require(_0xa733('0xc'));var deskjs=require(_0xa733('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa733('0xe'));var Redis=require(_0xa733('0xf'));var authService=require(_0xa733('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa733('0x11'));var hardwareService=require(_0xa733('0x12'));var logger=require(_0xa733('0x13'))(_0xa733('0x14'));var utils=require(_0xa733('0x15'));var config=require(_0xa733('0x16'));var licenseUtil=require(_0xa733('0x17'));var db=require(_0xa733('0x18'))['db'];function respondWithStatusCode(_0x2e6c98,_0x26faa8){_0x26faa8=_0x26faa8||0xcc;return function(_0x373ed0){if(_0x373ed0){return _0x2e6c98[_0xa733('0x19')](_0x26faa8);}return _0x2e6c98[_0xa733('0x1a')](_0x26faa8)[_0xa733('0x1b')]();};}function respondWithResult(_0xc173a4,_0x571520){_0x571520=_0x571520||0xc8;return function(_0x9dd7ed){if(_0x9dd7ed){return _0xc173a4[_0xa733('0x1a')](_0x571520)[_0xa733('0x1c')](_0x9dd7ed);}};}function respondWithFilteredResult(_0x29132d,_0x22b92a){return function(_0x21fdaf){if(_0x21fdaf){var _0x2c9e5e=typeof _0x22b92a['offset']===_0xa733('0x1d')&&typeof _0x22b92a[_0xa733('0x1e')]===_0xa733('0x1d');var _0x510c16=_0x21fdaf[_0xa733('0x1f')];var _0x1db4fd=_0x2c9e5e?0x0:_0x22b92a[_0xa733('0x20')];var _0x495473=_0x2c9e5e?_0x21fdaf[_0xa733('0x1f')]:_0x22b92a['offset']+_0x22b92a['limit'];var _0x39551c;if(_0x495473>=_0x510c16){_0x495473=_0x510c16;_0x39551c=0xc8;}else{_0x39551c=0xce;}_0x29132d[_0xa733('0x1a')](_0x39551c);return _0x29132d[_0xa733('0x21')](_0xa733('0x22'),_0x1db4fd+'-'+_0x495473+'/'+_0x510c16)[_0xa733('0x1c')](_0x21fdaf);}return null;};}function patchUpdates(_0xe938b3){return function(_0x2cdd3d){try{jsonpatch[_0xa733('0x23')](_0x2cdd3d,_0xe938b3,!![]);}catch(_0x432f92){return BPromise[_0xa733('0x24')](_0x432f92);}return _0x2cdd3d['save']();};}function saveUpdates(_0x3d6368,_0x1d3ca6){return function(_0x507c91){if(_0x507c91){return _0x507c91['update'](_0x3d6368)[_0xa733('0x25')](function(_0x1f4da4){return _0x1f4da4;});}return null;};}function removeEntity(_0x5ad80d,_0x228fb8){return function(_0x28e5a9){if(_0x28e5a9){return _0x28e5a9[_0xa733('0x26')]()['then'](function(){_0x5ad80d[_0xa733('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x19102c,_0x4982e0){return function(_0xb55448){if(!_0xb55448){_0x19102c[_0xa733('0x19')](0x194);}return _0xb55448;};}function handleError(_0x43d50d,_0x4c8b75){_0x4c8b75=_0x4c8b75||0x1f4;return function(_0x37c071){logger['error'](_0x37c071[_0xa733('0x27')]);if(_0x37c071[_0xa733('0x28')]){delete _0x37c071[_0xa733('0x28')];}_0x43d50d[_0xa733('0x1a')](_0x4c8b75)[_0xa733('0x29')](_0x37c071);};}exports[_0xa733('0x2a')]=function(_0x40c541,_0x580e27){var _0x18021d={},_0x11d428={},_0x12a2f2={'count':0x0,'rows':[]};var _0x56346d=_[_0xa733('0x2b')](db[_0xa733('0x2c')][_0xa733('0x2d')],function(_0x5f3e68){return{'name':_0x5f3e68[_0xa733('0x2e')],'type':_0x5f3e68['type'][_0xa733('0x2f')]};});_0x11d428[_0xa733('0x30')]=_['map'](_0x56346d,_0xa733('0x28'));_0x11d428['query']=_[_0xa733('0x31')](_0x40c541[_0xa733('0x32')]);_0x11d428[_0xa733('0x33')]=_[_0xa733('0x34')](_0x11d428[_0xa733('0x30')],_0x11d428['query']);_0x18021d['attributes']=_[_0xa733('0x34')](_0x11d428[_0xa733('0x30')],qs[_0xa733('0x35')](_0x40c541[_0xa733('0x32')][_0xa733('0x35')]));_0x18021d[_0xa733('0x36')]=_0x18021d[_0xa733('0x36')][_0xa733('0x37')]?_0x18021d[_0xa733('0x36')]:_0x11d428[_0xa733('0x30')];if(!_0x40c541['query']['hasOwnProperty'](_0xa733('0x38'))){_0x18021d['limit']=qs['limit'](_0x40c541['query'][_0xa733('0x1e')]);_0x18021d[_0xa733('0x20')]=qs[_0xa733('0x20')](_0x40c541['query'][_0xa733('0x20')]);}_0x18021d[_0xa733('0x39')]=qs[_0xa733('0x3a')](_0x40c541[_0xa733('0x32')]['sort']);_0x18021d[_0xa733('0x3b')]=qs[_0xa733('0x33')](_['pick'](_0x40c541[_0xa733('0x32')],_0x11d428[_0xa733('0x33')]),_0x56346d);if(_0x40c541[_0xa733('0x32')][_0xa733('0x3c')]){_0x18021d[_0xa733('0x3b')]=_[_0xa733('0x3d')](_0x18021d[_0xa733('0x3b')],{'$or':_[_0xa733('0x2b')](_0x56346d,function(_0x3243d8){if(_0x3243d8['type']!==_0xa733('0x3e')){var _0x32ce1e={};_0x32ce1e[_0x3243d8['name']]={'$like':'%'+_0x40c541['query'][_0xa733('0x3c')]+'%'};return _0x32ce1e;}})});}_0x18021d=_[_0xa733('0x3d')]({},_0x18021d,_0x40c541[_0xa733('0x3f')]);var _0x50cd28={'where':_0x18021d[_0xa733('0x3b')]};return db[_0xa733('0x2c')][_0xa733('0x1f')](_0x50cd28)['then'](function(_0x2d993c){_0x12a2f2['count']=_0x2d993c;if(_0x40c541['query'][_0xa733('0x40')]){_0x18021d['include']=[{'all':!![]}];}return db[_0xa733('0x2c')][_0xa733('0x41')](_0x18021d);})[_0xa733('0x25')](function(_0x1e3f97){_0x12a2f2[_0xa733('0x42')]=_0x1e3f97;return _0x12a2f2;})[_0xa733('0x25')](respondWithFilteredResult(_0x580e27,_0x18021d))[_0xa733('0x43')](handleError(_0x580e27,null));};exports[_0xa733('0x44')]=function(_0xcad084,_0x381080){var _0x470ecf={'raw':!![],'where':{'id':_0xcad084['params']['id']}},_0x299255={};_0x299255[_0xa733('0x30')]=_[_0xa733('0x31')](db[_0xa733('0x2c')][_0xa733('0x2d')]);_0x299255[_0xa733('0x32')]=_[_0xa733('0x31')](_0xcad084['query']);_0x299255[_0xa733('0x33')]=_[_0xa733('0x34')](_0x299255[_0xa733('0x30')],_0x299255['query']);_0x470ecf[_0xa733('0x36')]=_['intersection'](_0x299255[_0xa733('0x30')],qs['fields'](_0xcad084[_0xa733('0x32')][_0xa733('0x35')]));_0x470ecf[_0xa733('0x36')]=_0x470ecf[_0xa733('0x36')]['length']?_0x470ecf[_0xa733('0x36')]:_0x299255[_0xa733('0x30')];if(_0xcad084[_0xa733('0x32')][_0xa733('0x40')]){_0x470ecf[_0xa733('0x45')]=[{'all':!![]}];}_0x470ecf=_[_0xa733('0x3d')]({},_0x470ecf,_0xcad084[_0xa733('0x3f')]);return db[_0xa733('0x2c')]['find'](_0x470ecf)[_0xa733('0x25')](handleEntityNotFound(_0x381080,null))[_0xa733('0x25')](respondWithResult(_0x381080,null))['catch'](handleError(_0x381080,null));};exports[_0xa733('0x46')]=function(_0x101f8f,_0x47889f){return db['FreshsalesField'][_0xa733('0x46')](_0x101f8f[_0xa733('0x47')],{})[_0xa733('0x25')](respondWithResult(_0x47889f,0xc9))[_0xa733('0x43')](handleError(_0x47889f,null));};exports[_0xa733('0x48')]=function(_0x1a40a6,_0x23d8a3){if(_0x1a40a6[_0xa733('0x47')]['id']){delete _0x1a40a6[_0xa733('0x47')]['id'];}return db[_0xa733('0x2c')]['find']({'where':{'id':_0x1a40a6['params']['id']}})[_0xa733('0x25')](handleEntityNotFound(_0x23d8a3,null))[_0xa733('0x25')](saveUpdates(_0x1a40a6[_0xa733('0x47')],null))[_0xa733('0x25')](respondWithResult(_0x23d8a3,null))[_0xa733('0x43')](handleError(_0x23d8a3,null));};exports[_0xa733('0x26')]=function(_0x34201d,_0x598d6a){return db[_0xa733('0x2c')]['find']({'where':{'id':_0x34201d[_0xa733('0x49')]['id']}})['then'](handleEntityNotFound(_0x598d6a,null))[_0xa733('0x25')](removeEntity(_0x598d6a,null))[_0xa733('0x43')](handleError(_0x598d6a,null));};
\ No newline at end of file
index 5e5f093..af05ab6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5af=['freshsales_unique_index','idField','util','../../config/logger','moment','bluebird','request-promise','rimraf','exports','FreshsalesField','int_freshsales_fields'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe5af,0x9c));var _0xfe5a=function(_0x290d35,_0x1b9f38){_0x290d35=_0x290d35-0x0;var _0x1c655b=_0xe5af[_0x290d35];return _0x1c655b;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var logger=require(_0xfe5a('0x1'))('api');var moment=require(_0xfe5a('0x2'));var BPromise=require(_0xfe5a('0x3'));var rp=require(_0xfe5a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfe5a('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module[_0xfe5a('0x6')]=function(_0x2039cd,_0x4e418f){return _0x2039cd['define'](_0xfe5a('0x7'),attributes,{'tableName':_0xfe5a('0x8'),'paranoid':![],'indexes':[{'name':_0xfe5a('0x9'),'fields':[_0xfe5a('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xd732=['bluebird','request-promise','../../config/environment','exports','FreshsalesField','freshsales_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0xd732,0x18e));var _0x2d73=function(_0x7191d0,_0x521e2e){_0x7191d0=_0x7191d0-0x0;var _0x1c3a12=_0xd732[_0x7191d0];return _0x1c3a12;};'use strict';var _=require(_0x2d73('0x0'));var util=require('util');var logger=require(_0x2d73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x2d73('0x2'));var rp=require(_0x2d73('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2d73('0x4'));var attributes=require('./intFreshsalesField.attributes');module[_0x2d73('0x5')]=function(_0x11aa83,_0x47d40d){return _0x11aa83['define'](_0x2d73('0x6'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x2d73('0x7'),'fields':[_0x2d73('0x8'),_0x2d73('0x9')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index b46f192..3bf0fb7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8fb=['info','FreshsalesField,\x20%s,\x20%s','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http'];(function(_0xaf4af7,_0x6a8b6f){var _0x596009=function(_0x563e6f){while(--_0x563e6f){_0xaf4af7['push'](_0xaf4af7['shift']());}};_0x596009(++_0x6a8b6f);}(_0xd8fb,0x99));var _0xbd8f=function(_0x541512,_0x2069ce){_0x541512=_0x541512-0x0;var _0x219848=_0xd8fb[_0x541512];return _0x219848;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var moment=require(_0xbd8f('0x2'));var BPromise=require(_0xbd8f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbd8f('0x4'));var logger=require(_0xbd8f('0x5'))('rpc');var config=require(_0xbd8f('0x6'));var jayson=require(_0xbd8f('0x7'));var client=jayson['client'][_0xbd8f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e97cf,_0xf503c4,_0x578499){return new BPromise(function(_0x197827,_0x403edc){return client['request'](_0x4e97cf,_0x578499)['then'](function(_0x3caa93){logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,'request\x20sent');logger[_0xbd8f('0xb')](_0xbd8f('0xc'),_0xf503c4,'request\x20sent',JSON['stringify'](_0x3caa93));if(_0x3caa93[_0xbd8f('0xd')]){if(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xe')]===0x1f4){logger['error'](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x403edc(_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);}logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x3caa93[_0xbd8f('0xd')][_0xbd8f('0xf')]);return _0x197827(_0x3caa93['error'][_0xbd8f('0xf')]);}else{logger[_0xbd8f('0x9')](_0xbd8f('0xa'),_0xf503c4,_0xbd8f('0x10'));_0x197827(_0x3caa93['result'][_0xbd8f('0xf')]);}})[_0xbd8f('0x11')](function(_0x5ebf8b){logger[_0xbd8f('0xd')](_0xbd8f('0xa'),_0xf503c4,_0x5ebf8b);_0x403edc(_0x5ebf8b);});});}
\ No newline at end of file
+var _0x6d38=['request','then','FreshsalesField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1820ed,_0x2c6616){var _0x47f934=function(_0x38559f){while(--_0x38559f){_0x1820ed['push'](_0x1820ed['shift']());}};_0x47f934(++_0x2c6616);}(_0x6d38,0x1ef));var _0x86d3=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x6d38[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});}
\ No newline at end of file
index dd4d622..806ce29 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1edb7c,_0x1519ec){var _0xa9dbee=function(_0xdc1728){while(--_0xdc1728){_0x1edb7c['push'](_0x1edb7c['shift']());}};_0xa9dbee(++_0x1519ec);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router;
\ No newline at end of file
+var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x27c12b,_0x3ff1e7){var _0x3c2f20=function(_0x2a4804){while(--_0x2a4804){_0x27c12b['push'](_0x27c12b['shift']());}};_0x3c2f20(++_0x3ff1e7);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router;
\ No newline at end of file
index c04b019..893206c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd3c8=['exports','STRING','ENUM','integrationTab','newTab','sequelize'];(function(_0x1af98d,_0x3c608e){var _0x3553ea=function(_0x5668a4){while(--_0x5668a4){_0x1af98d['push'](_0x1af98d['shift']());}};_0x3553ea(++_0x3c608e);}(_0xd3c8,0x161));var _0x8d3c=function(_0x2d7eae,_0x2a9158){_0x2d7eae=_0x2d7eae-0x0;var _0x106b7f=_0xd3c8[_0x2d7eae];return _0x106b7f;};'use strict';var Sequelize=require(_0x8d3c('0x0'));module[_0x8d3c('0x1')]={'name':{'type':Sequelize[_0x8d3c('0x2')]},'description':{'type':Sequelize[_0x8d3c('0x2')]},'username':{'type':Sequelize[_0x8d3c('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x8d3c('0x2')]},'password':{'type':Sequelize[_0x8d3c('0x2')]},'clientId':{'type':Sequelize[_0x8d3c('0x2')]},'clientSecret':{'type':Sequelize[_0x8d3c('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8d3c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x8d3c('0x3')](_0x8d3c('0x4'),_0x8d3c('0x5')),'defaultValue':_0x8d3c('0x4')}};
\ No newline at end of file
+var _0xe77c=['exports','STRING','username','integrationTab','sequelize'];(function(_0x3ed328,_0x2d2bb9){var _0x4043dc=function(_0x2652c2){while(--_0x2652c2){_0x3ed328['push'](_0x3ed328['shift']());}};_0x4043dc(++_0x2d2bb9);}(_0xe77c,0x176));var _0xce77=function(_0x17dab8,_0x19d0ec){_0x17dab8=_0x17dab8-0x0;var _0x336fb5=_0xe77c[_0x17dab8];return _0x336fb5;};'use strict';var Sequelize=require(_0xce77('0x0'));module[_0xce77('0x1')]={'name':{'type':Sequelize[_0xce77('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xce77('0x2')],'unique':_0xce77('0x3')},'remoteUri':{'type':Sequelize[_0xce77('0x2')]},'password':{'type':Sequelize[_0xce77('0x2')]},'clientId':{'type':Sequelize[_0xce77('0x2')]},'clientSecret':{'type':Sequelize[_0xce77('0x2')]},'securityToken':{'type':Sequelize[_0xce77('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xce77('0x4'),'newTab'),'defaultValue':_0xce77('0x4')}};
\ No newline at end of file
index a1a1e8f..2a1f375 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x322e=['apply','reject','save','update','then','end','sendStatus','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','findAll','rows','show','params','include','options','find','catch','create','body','destroy','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','Subjects','getSubjects','channel','Descriptions','SalesforceField','getFields','Task','username','securityToken','substring','lastIndexOf','clientId','clientSecret','password','concat','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','Description','string','int','email','textarea','phone','remove','includes','label','picklistValues','value','boolean','True','true','False','test','statusCode','error','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x382353,_0x1ece1e){var _0xf42fa9=function(_0x399b28){while(--_0x399b28){_0x382353['push'](_0x382353['shift']());}};_0xf42fa9(++_0x1ece1e);}(_0x322e,0xd6));var _0xe322=function(_0x5d320d,_0x2d52c7){_0x5d320d=_0x5d320d-0x0;var _0xb42c9d=_0x322e[_0x5d320d];return _0xb42c9d;};'use strict';var emlformat=require(_0xe322('0x0'));var rimraf=require(_0xe322('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe322('0x2'));var rp=require(_0xe322('0x3'));var moment=require(_0xe322('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe322('0x5'));var util=require(_0xe322('0x6'));var path=require('path');var sox=require(_0xe322('0x7'));var csv=require(_0xe322('0x8'));var ejs=require(_0xe322('0x9'));var fs=require('fs');var fs_extra=require(_0xe322('0xa'));var _=require(_0xe322('0xb'));var squel=require(_0xe322('0xc'));var crypto=require(_0xe322('0xd'));var jsforce=require(_0xe322('0xe'));var deskjs=require(_0xe322('0xf'));var toCsv=require(_0xe322('0x8'));var querystring=require(_0xe322('0x10'));var Papa=require(_0xe322('0x11'));var Redis=require(_0xe322('0x12'));var authService=require(_0xe322('0x13'));var qs=require(_0xe322('0x14'));var as=require(_0xe322('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe322('0x16'));var utils=require(_0xe322('0x17'));var config=require(_0xe322('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe322('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x55626d,_0x4a9abd){_0x4a9abd=_0x4a9abd||0xcc;return function(_0x6a26a8){if(_0x6a26a8){return _0x55626d['sendStatus'](_0x4a9abd);}return _0x55626d[_0xe322('0x1a')](_0x4a9abd)['end']();};}function respondWithResult(_0x7e002,_0x112382){_0x112382=_0x112382||0xc8;return function(_0xaa78d0){if(_0xaa78d0){return _0x7e002[_0xe322('0x1a')](_0x112382)[_0xe322('0x1b')](_0xaa78d0);}};}function respondWithFilteredResult(_0x563f8e,_0x39fabb){return function(_0x1194ff){if(_0x1194ff){var _0x1da688=typeof _0x39fabb[_0xe322('0x1c')]===_0xe322('0x1d')&&typeof _0x39fabb[_0xe322('0x1e')]==='undefined';var _0xc9945f=_0x1194ff[_0xe322('0x1f')];var _0x121efe=_0x1da688?0x0:_0x39fabb[_0xe322('0x1c')];var _0xaec3c2=_0x1da688?_0x1194ff[_0xe322('0x1f')]:_0x39fabb[_0xe322('0x1c')]+_0x39fabb['limit'];var _0x2a87ec;if(_0xaec3c2>=_0xc9945f){_0xaec3c2=_0xc9945f;_0x2a87ec=0xc8;}else{_0x2a87ec=0xce;}_0x563f8e[_0xe322('0x1a')](_0x2a87ec);return _0x563f8e[_0xe322('0x20')](_0xe322('0x21'),_0x121efe+'-'+_0xaec3c2+'/'+_0xc9945f)[_0xe322('0x1b')](_0x1194ff);}return null;};}function patchUpdates(_0x3b8e4a){return function(_0x1eae4f){try{jsonpatch[_0xe322('0x22')](_0x1eae4f,_0x3b8e4a,!![]);}catch(_0x1e0b0e){return BPromise[_0xe322('0x23')](_0x1e0b0e);}return _0x1eae4f[_0xe322('0x24')]();};}function saveUpdates(_0x764682,_0x13692d){return function(_0x51ec00){if(_0x51ec00){return _0x51ec00[_0xe322('0x25')](_0x764682)[_0xe322('0x26')](function(_0xaadba0){return _0xaadba0;});}return null;};}function removeEntity(_0x1b9397,_0x534ab4){return function(_0x4d0667){if(_0x4d0667){return _0x4d0667['destroy']()[_0xe322('0x26')](function(){_0x1b9397[_0xe322('0x1a')](0xcc)[_0xe322('0x27')]();});}};}function handleEntityNotFound(_0x5d50ac,_0x1d0eb8){return function(_0x299d31){if(!_0x299d31){_0x5d50ac[_0xe322('0x28')](0x194);}return _0x299d31;};}function handleError(_0xba3e7e,_0x2ec61a){_0x2ec61a=_0x2ec61a||0x1f4;return function(_0x5551b4){logger['error'](_0x5551b4[_0xe322('0x29')]);if(_0x5551b4[_0xe322('0x2a')]){delete _0x5551b4[_0xe322('0x2a')];}_0xba3e7e[_0xe322('0x1a')](_0x2ec61a)[_0xe322('0x2b')](_0x5551b4);};}exports[_0xe322('0x2c')]=function(_0x648108,_0x28a0c4){var _0x3a8466={},_0x486316={},_0x80573a={'count':0x0,'rows':[]};var _0x44fc02=_[_0xe322('0x2d')](db[_0xe322('0x2e')][_0xe322('0x2f')],function(_0x46a641){return{'name':_0x46a641['fieldName'],'type':_0x46a641[_0xe322('0x30')][_0xe322('0x31')]};});_0x486316[_0xe322('0x32')]=_[_0xe322('0x2d')](_0x44fc02,_0xe322('0x2a'));_0x486316[_0xe322('0x33')]=_[_0xe322('0x34')](_0x648108[_0xe322('0x33')]);_0x486316['filters']=_[_0xe322('0x35')](_0x486316['model'],_0x486316[_0xe322('0x33')]);_0x3a8466[_0xe322('0x36')]=_[_0xe322('0x35')](_0x486316['model'],qs[_0xe322('0x37')](_0x648108['query'][_0xe322('0x37')]));_0x3a8466[_0xe322('0x36')]=_0x3a8466['attributes'][_0xe322('0x38')]?_0x3a8466[_0xe322('0x36')]:_0x486316[_0xe322('0x32')];if(!_0x648108[_0xe322('0x33')][_0xe322('0x39')](_0xe322('0x3a'))){_0x3a8466['limit']=qs['limit'](_0x648108[_0xe322('0x33')][_0xe322('0x1e')]);_0x3a8466['offset']=qs[_0xe322('0x1c')](_0x648108['query'][_0xe322('0x1c')]);}_0x3a8466[_0xe322('0x3b')]=qs[_0xe322('0x3c')](_0x648108[_0xe322('0x33')][_0xe322('0x3c')]);_0x3a8466['where']=qs[_0xe322('0x3d')](_[_0xe322('0x3e')](_0x648108[_0xe322('0x33')],_0x486316[_0xe322('0x3d')]),_0x44fc02);if(_0x648108[_0xe322('0x33')][_0xe322('0x3f')]){_0x3a8466[_0xe322('0x40')]=_[_0xe322('0x41')](_0x3a8466[_0xe322('0x40')],{'$or':_[_0xe322('0x2d')](_0x44fc02,function(_0x2a98eb){if(_0x2a98eb['type']!==_0xe322('0x42')){var _0x26eb41={};_0x26eb41[_0x2a98eb[_0xe322('0x2a')]]={'$like':'%'+_0x648108['query']['filter']+'%'};return _0x26eb41;}})});}_0x3a8466=_[_0xe322('0x41')]({},_0x3a8466,_0x648108['options']);var _0x2bcd3c={'where':_0x3a8466[_0xe322('0x40')]};return db['SalesforceAccount'][_0xe322('0x1f')](_0x2bcd3c)[_0xe322('0x26')](function(_0x5208fe){_0x80573a['count']=_0x5208fe;if(_0x648108[_0xe322('0x33')]['includeAll']){_0x3a8466['include']=[{'all':!![]}];}return db[_0xe322('0x2e')][_0xe322('0x43')](_0x3a8466);})[_0xe322('0x26')](function(_0x2873a0){_0x80573a[_0xe322('0x44')]=_0x2873a0;return _0x80573a;})['then'](respondWithFilteredResult(_0x28a0c4,_0x3a8466))['catch'](handleError(_0x28a0c4,null));};exports[_0xe322('0x45')]=function(_0x515780,_0x345672){var _0x53712e={'raw':![],'where':{'id':_0x515780[_0xe322('0x46')]['id']}},_0x289b4c={};_0x289b4c[_0xe322('0x32')]=_['keys'](db['SalesforceAccount'][_0xe322('0x2f')]);_0x289b4c[_0xe322('0x33')]=_['keys'](_0x515780[_0xe322('0x33')]);_0x289b4c[_0xe322('0x3d')]=_[_0xe322('0x35')](_0x289b4c['model'],_0x289b4c[_0xe322('0x33')]);_0x53712e[_0xe322('0x36')]=_[_0xe322('0x35')](_0x289b4c[_0xe322('0x32')],qs[_0xe322('0x37')](_0x515780[_0xe322('0x33')][_0xe322('0x37')]));_0x53712e['attributes']=_0x53712e[_0xe322('0x36')]['length']?_0x53712e[_0xe322('0x36')]:_0x289b4c[_0xe322('0x32')];if(_0x515780[_0xe322('0x33')]['includeAll']){_0x53712e[_0xe322('0x47')]=[{'all':!![]}];}_0x53712e=_[_0xe322('0x41')]({},_0x53712e,_0x515780[_0xe322('0x48')]);return db[_0xe322('0x2e')][_0xe322('0x49')](_0x53712e)['then'](handleEntityNotFound(_0x345672,null))[_0xe322('0x26')](respondWithResult(_0x345672,null))[_0xe322('0x4a')](handleError(_0x345672,null));};exports['create']=function(_0x3fcaa3,_0x19e56e){return db[_0xe322('0x2e')][_0xe322('0x4b')](_0x3fcaa3[_0xe322('0x4c')],{})[_0xe322('0x26')](respondWithResult(_0x19e56e,0xc9))[_0xe322('0x4a')](handleError(_0x19e56e,null));};exports['update']=function(_0x475731,_0x431ec9){if(_0x475731[_0xe322('0x4c')]['id']){delete _0x475731[_0xe322('0x4c')]['id'];}return db[_0xe322('0x2e')]['find']({'where':{'id':_0x475731[_0xe322('0x46')]['id']}})['then'](handleEntityNotFound(_0x431ec9,null))[_0xe322('0x26')](saveUpdates(_0x475731['body'],null))[_0xe322('0x26')](respondWithResult(_0x431ec9,null))['catch'](handleError(_0x431ec9,null));};exports[_0xe322('0x4d')]=function(_0x42a03b,_0x4df9da){return db[_0xe322('0x2e')]['find']({'where':{'id':_0x42a03b[_0xe322('0x46')]['id']}})[_0xe322('0x26')](handleEntityNotFound(_0x4df9da,null))['then'](removeEntity(_0x4df9da,null))[_0xe322('0x4a')](handleError(_0x4df9da,null));};exports[_0xe322('0x4e')]=function(_0x1392c9,_0x47bc97,_0xc3ce6c){var _0x378561={};var _0x4aea1b={};var _0x4dae5a;var _0x2288ed;return db['SalesforceAccount'][_0xe322('0x4f')]({'where':{'id':_0x1392c9[_0xe322('0x46')]['id']}})['then'](handleEntityNotFound(_0x47bc97,null))[_0xe322('0x26')](function(_0x893451){if(_0x893451){_0x4dae5a=_0x893451;_0x4aea1b[_0xe322('0x32')]=_[_0xe322('0x34')](db[_0xe322('0x50')]['rawAttributes']);_0x4aea1b[_0xe322('0x33')]=_['keys'](_0x1392c9[_0xe322('0x33')]);_0x4aea1b['filters']=_[_0xe322('0x35')](_0x4aea1b[_0xe322('0x32')],_0x4aea1b[_0xe322('0x33')]);_0x378561[_0xe322('0x36')]=_['intersection'](_0x4aea1b['model'],qs[_0xe322('0x37')](_0x1392c9[_0xe322('0x33')][_0xe322('0x37')]));_0x378561[_0xe322('0x36')]=_0x378561[_0xe322('0x36')][_0xe322('0x38')]?_0x378561[_0xe322('0x36')]:_0x4aea1b[_0xe322('0x32')];_0x378561[_0xe322('0x3b')]=qs[_0xe322('0x3c')](_0x1392c9[_0xe322('0x33')][_0xe322('0x3c')]);_0x378561[_0xe322('0x40')]=qs[_0xe322('0x3d')](_[_0xe322('0x3e')](_0x1392c9[_0xe322('0x33')],_0x4aea1b[_0xe322('0x3d')]));if(_0x1392c9[_0xe322('0x33')][_0xe322('0x3f')]){_0x378561[_0xe322('0x40')]=_['merge'](_0x378561[_0xe322('0x40')],{'$or':_[_0xe322('0x2d')](_0x378561[_0xe322('0x36')],function(_0x3f9849){var _0x293569={};_0x293569[_0x3f9849]={'$like':'%'+_0x1392c9[_0xe322('0x33')][_0xe322('0x3f')]+'%'};return _0x293569;})});}_0x378561=_['merge']({},_0x378561,_0x1392c9[_0xe322('0x48')]);return _0x4dae5a['getConfigurations'](_0x378561);}})[_0xe322('0x26')](function(_0x30ce21){if(_0x30ce21){_0x2288ed=_0x30ce21['length'];if(!_0x1392c9[_0xe322('0x33')][_0xe322('0x39')](_0xe322('0x3a'))){_0x378561[_0xe322('0x1e')]=qs[_0xe322('0x1e')](_0x1392c9[_0xe322('0x33')][_0xe322('0x1e')]);_0x378561[_0xe322('0x1c')]=qs[_0xe322('0x1c')](_0x1392c9['query'][_0xe322('0x1c')]);}return _0x4dae5a[_0xe322('0x4e')](_0x378561);}})[_0xe322('0x26')](function(_0x404da8){if(_0x404da8){return _0x404da8?{'count':_0x2288ed,'rows':_0x404da8}:null;}})['then'](respondWithResult(_0x47bc97,null))[_0xe322('0x4a')](handleError(_0x47bc97,null));};exports[_0xe322('0x51')]=function(_0x4d3145,_0x4f47bc,_0x25c5b6){if(_0x4d3145[_0xe322('0x4c')]['id']){delete _0x4d3145['body']['id'];}return db[_0xe322('0x2e')][_0xe322('0x4f')]({'where':{'id':_0x4d3145[_0xe322('0x46')]['id']}})[_0xe322('0x26')](handleEntityNotFound(_0x4f47bc,null))[_0xe322('0x26')](function(_0x2296f0){if(_0x2296f0){_0x4d3145[_0xe322('0x4c')]['AccountId']=_0x2296f0['id'];_0x4d3145[_0xe322('0x4c')][_0xe322('0x52')]=integrations[_0xe322('0x53')](_0x4d3145[_0xe322('0x4c')][_0xe322('0x54')],_0x4d3145[_0xe322('0x4c')]['type']);_0x4d3145[_0xe322('0x4c')][_0xe322('0x55')]=integrations['getDescriptions'](_0x4d3145[_0xe322('0x4c')]['channel'],_0x4d3145[_0xe322('0x4c')][_0xe322('0x30')]);return db[_0xe322('0x50')]['create'](_0x4d3145[_0xe322('0x4c')],{'include':[{'model':db[_0xe322('0x56')],'as':_0xe322('0x52')},{'model':db[_0xe322('0x56')],'as':_0xe322('0x55')}]});}return null;})[_0xe322('0x26')](respondWithResult(_0x4f47bc,null))[_0xe322('0x4a')](handleError(_0x4f47bc,null));};exports[_0xe322('0x57')]=function(_0x226cdd,_0x19df91,_0x2fed20){var _0x81d046;var _0x4b8791='';var _0x2f1fd1=_0xe322('0x58');return db[_0xe322('0x2e')][_0xe322('0x4f')]({'where':{'id':_0x226cdd[_0xe322('0x46')]['id']},'attributes':['id','remoteUri','clientId','clientSecret',_0xe322('0x59'),'password',_0xe322('0x5a')]})[_0xe322('0x26')](handleEntityNotFound(_0x19df91,null))[_0xe322('0x26')](function(_0x22d62b){if(_0x22d62b){_0x4b8791=_0x22d62b['remoteUri'];var _0x602de6=_0x4b8791['slice'](-0x1);if(_0x602de6==='/'){_0x4b8791=_0x4b8791[_0xe322('0x5b')](0x0,_0x4b8791[_0xe322('0x5c')](_0x602de6));}_0x81d046=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4b8791,'clientId':_0x22d62b[_0xe322('0x5d')],'clientSecret':_0x22d62b[_0xe322('0x5e')]}});return _0x81d046['login'](_0x22d62b[_0xe322('0x59')],_0x22d62b[_0xe322('0x5f')][_0xe322('0x60')](_0x22d62b[_0xe322('0x5a')]));}})[_0xe322('0x26')](function(_0x4973a0){if(_0x4973a0){if(!_[_0xe322('0x61')](_0x226cdd[_0xe322('0x33')][_0xe322('0x62')])){_0x2f1fd1=_0x226cdd[_0xe322('0x33')][_0xe322('0x62')];}return _0x81d046[_0xe322('0x63')](_0x2f1fd1)[_0xe322('0x64')]();}})[_0xe322('0x26')](function(_0x191bf9){var _0x3bbd06=[_0xe322('0x65'),'ActivityDate',_0xe322('0x66'),_0xe322('0x67'),_0xe322('0x68'),_0xe322('0x69')];var _0x5c8fe4=[_0xe322('0x6a'),_0xe322('0x6b'),'picklist','boolean',_0xe322('0x6c'),_0xe322('0x6d'),_0xe322('0x6e')];if(_0x191bf9){_[_0xe322('0x6f')](_0x191bf9[_0xe322('0x37')],function(_0x338c93){return _0x3bbd06['includes'](_0x338c93[_0xe322('0x2a')])||!_0x5c8fe4[_0xe322('0x70')](_0x338c93[_0xe322('0x30')]);});return{'count':_0x191bf9[_0xe322('0x37')]['length'],'rows':_[_0xe322('0x2d')](_0x191bf9[_0xe322('0x37')],function(_0x7173b9){return{'id':_0x7173b9[_0xe322('0x2a')],'name':_0x7173b9[_0xe322('0x71')],'custom':_0x7173b9['custom'],'options':_0x7173b9[_0xe322('0x72')][_0xe322('0x38')]>0x0?_[_0xe322('0x2d')](_0x7173b9[_0xe322('0x72')],function(_0x3cf6b7){return{'name':_0x3cf6b7[_0xe322('0x71')],'value':_0x3cf6b7[_0xe322('0x73')]};}):_0x7173b9['type']==_0xe322('0x74')?[{'name':_0xe322('0x75'),'value':_0xe322('0x76')},{'name':_0xe322('0x77'),'value':'false'}]:[]};})};}})[_0xe322('0x26')](respondWithResult(_0x19df91,null))[_0xe322('0x4a')](function(_0x13ab47){var _0x332b07=_0x226cdd[_0xe322('0x33')][_0xe322('0x78')]?0x1f4:_0x13ab47[_0xe322('0x79')]||0x1f4;logger[_0xe322('0x7a')]('getFields,\x20%s,\x20%s,\x20%s',_0xe322('0x57'),_0x332b07,JSON['stringify'](_0x13ab47));delete _0x13ab47['name'];if(_0x332b07===0x191){_0x332b07=0x190;}_0x19df91[_0xe322('0x1a')](_0x332b07)[_0xe322('0x2b')](_0x226cdd['query'][_0xe322('0x78')]?{'message':_0xe322('0x7b'),'statusCode':_0x13ab47[_0xe322('0x79')]}:_0x13ab47);});};
\ No newline at end of file
+var _0x6cb3=['IsRecurrence','Subject','Description','string','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','then','end','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','getConfigurations','findOne','SalesforceConfiguration','options','addConfiguration','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','username','password','securityToken','slice','substring','lastIndexOf','Connection','clientId','login','concat','isNil','ticketType','describe','OwnerId','ActivityDate'];(function(_0x1af482,_0x1af5b7){var _0x7e7580=function(_0x5ed4a7){while(--_0x5ed4a7){_0x1af482['push'](_0x1af482['shift']());}};_0x7e7580(++_0x1af5b7);}(_0x6cb3,0x94));var _0x36cb=function(_0x343229,_0x1ecd24){_0x343229=_0x343229-0x0;var _0x51f5b1=_0x6cb3[_0x343229];return _0x51f5b1;};'use strict';var emlformat=require(_0x36cb('0x0'));var rimraf=require(_0x36cb('0x1'));var zipdir=require(_0x36cb('0x2'));var jsonpatch=require(_0x36cb('0x3'));var rp=require(_0x36cb('0x4'));var moment=require(_0x36cb('0x5'));var BPromise=require(_0x36cb('0x6'));var Mustache=require(_0x36cb('0x7'));var util=require(_0x36cb('0x8'));var path=require(_0x36cb('0x9'));var sox=require(_0x36cb('0xa'));var csv=require(_0x36cb('0xb'));var ejs=require(_0x36cb('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x36cb('0xd'));var squel=require(_0x36cb('0xe'));var crypto=require('crypto');var jsforce=require(_0x36cb('0xf'));var deskjs=require(_0x36cb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x36cb('0x11'));var Papa=require('papaparse');var Redis=require(_0x36cb('0x12'));var authService=require(_0x36cb('0x13'));var qs=require(_0x36cb('0x14'));var as=require(_0x36cb('0x15'));var hardwareService=require(_0x36cb('0x16'));var logger=require(_0x36cb('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x36cb('0x18'));var licenseUtil=require(_0x36cb('0x19'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x13f62c,_0xbb9a09){_0xbb9a09=_0xbb9a09||0xcc;return function(_0x29b579){if(_0x29b579){return _0x13f62c[_0x36cb('0x1a')](_0xbb9a09);}return _0x13f62c[_0x36cb('0x1b')](_0xbb9a09)['end']();};}function respondWithResult(_0x7137c0,_0x24b20c){_0x24b20c=_0x24b20c||0xc8;return function(_0x53281d){if(_0x53281d){return _0x7137c0['status'](_0x24b20c)[_0x36cb('0x1c')](_0x53281d);}};}function respondWithFilteredResult(_0x3e4615,_0x35dec9){return function(_0x3abba5){if(_0x3abba5){var _0xc4c604=typeof _0x35dec9[_0x36cb('0x1d')]===_0x36cb('0x1e')&&typeof _0x35dec9[_0x36cb('0x1f')]===_0x36cb('0x1e');var _0x4b5750=_0x3abba5['count'];var _0x176e99=_0xc4c604?0x0:_0x35dec9['offset'];var _0x198f83=_0xc4c604?_0x3abba5[_0x36cb('0x20')]:_0x35dec9[_0x36cb('0x1d')]+_0x35dec9['limit'];var _0x328e81;if(_0x198f83>=_0x4b5750){_0x198f83=_0x4b5750;_0x328e81=0xc8;}else{_0x328e81=0xce;}_0x3e4615[_0x36cb('0x1b')](_0x328e81);return _0x3e4615[_0x36cb('0x21')](_0x36cb('0x22'),_0x176e99+'-'+_0x198f83+'/'+_0x4b5750)[_0x36cb('0x1c')](_0x3abba5);}return null;};}function patchUpdates(_0x3debed){return function(_0xfb6ffc){try{jsonpatch[_0x36cb('0x23')](_0xfb6ffc,_0x3debed,!![]);}catch(_0xb75356){return BPromise['reject'](_0xb75356);}return _0xfb6ffc[_0x36cb('0x24')]();};}function saveUpdates(_0x199e41,_0x2d9c4e){return function(_0x5052b4){if(_0x5052b4){return _0x5052b4[_0x36cb('0x25')](_0x199e41)['then'](function(_0x5e594b){return _0x5e594b;});}return null;};}function removeEntity(_0x41849b,_0x5e04a0){return function(_0x1b600f){if(_0x1b600f){return _0x1b600f[_0x36cb('0x26')]()[_0x36cb('0x27')](function(){_0x41849b[_0x36cb('0x1b')](0xcc)[_0x36cb('0x28')]();});}};}function handleEntityNotFound(_0x29d58e,_0x4d423a){return function(_0x2c1b87){if(!_0x2c1b87){_0x29d58e[_0x36cb('0x1a')](0x194);}return _0x2c1b87;};}function handleError(_0x5d0f98,_0x398df9){_0x398df9=_0x398df9||0x1f4;return function(_0x358739){logger[_0x36cb('0x29')](_0x358739[_0x36cb('0x2a')]);if(_0x358739[_0x36cb('0x2b')]){delete _0x358739[_0x36cb('0x2b')];}_0x5d0f98[_0x36cb('0x1b')](_0x398df9)[_0x36cb('0x2c')](_0x358739);};}exports[_0x36cb('0x2d')]=function(_0x12b0d4,_0x4ad313){var _0x3d17c6={},_0x2c846d={},_0x3361ec={'count':0x0,'rows':[]};var _0x1e39c3=_[_0x36cb('0x2e')](db[_0x36cb('0x2f')][_0x36cb('0x30')],function(_0x39887b){return{'name':_0x39887b['fieldName'],'type':_0x39887b[_0x36cb('0x31')][_0x36cb('0x32')]};});_0x2c846d[_0x36cb('0x33')]=_[_0x36cb('0x2e')](_0x1e39c3,'name');_0x2c846d[_0x36cb('0x34')]=_[_0x36cb('0x35')](_0x12b0d4[_0x36cb('0x34')]);_0x2c846d[_0x36cb('0x36')]=_[_0x36cb('0x37')](_0x2c846d[_0x36cb('0x33')],_0x2c846d['query']);_0x3d17c6[_0x36cb('0x38')]=_[_0x36cb('0x37')](_0x2c846d[_0x36cb('0x33')],qs['fields'](_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x39')]));_0x3d17c6[_0x36cb('0x38')]=_0x3d17c6['attributes'][_0x36cb('0x3a')]?_0x3d17c6['attributes']:_0x2c846d[_0x36cb('0x33')];if(!_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x3b')](_0x36cb('0x3c'))){_0x3d17c6[_0x36cb('0x1f')]=qs['limit'](_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x1f')]);_0x3d17c6['offset']=qs[_0x36cb('0x1d')](_0x12b0d4['query'][_0x36cb('0x1d')]);}_0x3d17c6[_0x36cb('0x3d')]=qs[_0x36cb('0x3e')](_0x12b0d4[_0x36cb('0x34')]['sort']);_0x3d17c6[_0x36cb('0x3f')]=qs[_0x36cb('0x36')](_['pick'](_0x12b0d4[_0x36cb('0x34')],_0x2c846d[_0x36cb('0x36')]),_0x1e39c3);if(_0x12b0d4[_0x36cb('0x34')]['filter']){_0x3d17c6[_0x36cb('0x3f')]=_['merge'](_0x3d17c6[_0x36cb('0x3f')],{'$or':_[_0x36cb('0x2e')](_0x1e39c3,function(_0x3dd9dd){if(_0x3dd9dd[_0x36cb('0x31')]!==_0x36cb('0x40')){var _0x116e5f={};_0x116e5f[_0x3dd9dd['name']]={'$like':'%'+_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x41')]+'%'};return _0x116e5f;}})});}_0x3d17c6=_['merge']({},_0x3d17c6,_0x12b0d4['options']);var _0xe7d90f={'where':_0x3d17c6[_0x36cb('0x3f')]};return db[_0x36cb('0x2f')]['count'](_0xe7d90f)[_0x36cb('0x27')](function(_0x502de2){_0x3361ec[_0x36cb('0x20')]=_0x502de2;if(_0x12b0d4[_0x36cb('0x34')][_0x36cb('0x42')]){_0x3d17c6[_0x36cb('0x43')]=[{'all':!![]}];}return db[_0x36cb('0x2f')][_0x36cb('0x44')](_0x3d17c6);})[_0x36cb('0x27')](function(_0x4d9650){_0x3361ec[_0x36cb('0x45')]=_0x4d9650;return _0x3361ec;})[_0x36cb('0x27')](respondWithFilteredResult(_0x4ad313,_0x3d17c6))[_0x36cb('0x46')](handleError(_0x4ad313,null));};exports[_0x36cb('0x47')]=function(_0x12ea77,_0x590ab4){var _0x2353b1={'raw':![],'where':{'id':_0x12ea77[_0x36cb('0x48')]['id']}},_0x5ccb02={};_0x5ccb02['model']=_['keys'](db[_0x36cb('0x2f')][_0x36cb('0x30')]);_0x5ccb02[_0x36cb('0x34')]=_[_0x36cb('0x35')](_0x12ea77[_0x36cb('0x34')]);_0x5ccb02[_0x36cb('0x36')]=_[_0x36cb('0x37')](_0x5ccb02[_0x36cb('0x33')],_0x5ccb02[_0x36cb('0x34')]);_0x2353b1[_0x36cb('0x38')]=_[_0x36cb('0x37')](_0x5ccb02[_0x36cb('0x33')],qs[_0x36cb('0x39')](_0x12ea77['query'][_0x36cb('0x39')]));_0x2353b1[_0x36cb('0x38')]=_0x2353b1['attributes']['length']?_0x2353b1[_0x36cb('0x38')]:_0x5ccb02[_0x36cb('0x33')];if(_0x12ea77[_0x36cb('0x34')][_0x36cb('0x42')]){_0x2353b1[_0x36cb('0x43')]=[{'all':!![]}];}_0x2353b1=_[_0x36cb('0x49')]({},_0x2353b1,_0x12ea77['options']);return db[_0x36cb('0x2f')][_0x36cb('0x4a')](_0x2353b1)[_0x36cb('0x27')](handleEntityNotFound(_0x590ab4,null))['then'](respondWithResult(_0x590ab4,null))[_0x36cb('0x46')](handleError(_0x590ab4,null));};exports[_0x36cb('0x4b')]=function(_0x2f26ed,_0x8cc821){return db['SalesforceAccount']['create'](_0x2f26ed[_0x36cb('0x4c')],{})[_0x36cb('0x27')](respondWithResult(_0x8cc821,0xc9))[_0x36cb('0x46')](handleError(_0x8cc821,null));};exports[_0x36cb('0x25')]=function(_0x5a732d,_0x18f21b){if(_0x5a732d[_0x36cb('0x4c')]['id']){delete _0x5a732d['body']['id'];}return db[_0x36cb('0x2f')]['find']({'where':{'id':_0x5a732d[_0x36cb('0x48')]['id']}})[_0x36cb('0x27')](handleEntityNotFound(_0x18f21b,null))[_0x36cb('0x27')](saveUpdates(_0x5a732d['body'],null))[_0x36cb('0x27')](respondWithResult(_0x18f21b,null))[_0x36cb('0x46')](handleError(_0x18f21b,null));};exports[_0x36cb('0x26')]=function(_0xd9c32d,_0x33cbd1){return db[_0x36cb('0x2f')]['find']({'where':{'id':_0xd9c32d[_0x36cb('0x48')]['id']}})['then'](handleEntityNotFound(_0x33cbd1,null))[_0x36cb('0x27')](removeEntity(_0x33cbd1,null))['catch'](handleError(_0x33cbd1,null));};exports[_0x36cb('0x4d')]=function(_0x341d31,_0x54615f,_0x16bb2c){var _0xd2761a={};var _0xd38028={};var _0x9b96fc;var _0x2dbcc9;return db[_0x36cb('0x2f')][_0x36cb('0x4e')]({'where':{'id':_0x341d31[_0x36cb('0x48')]['id']}})[_0x36cb('0x27')](handleEntityNotFound(_0x54615f,null))[_0x36cb('0x27')](function(_0x346e94){if(_0x346e94){_0x9b96fc=_0x346e94;_0xd38028[_0x36cb('0x33')]=_[_0x36cb('0x35')](db[_0x36cb('0x4f')][_0x36cb('0x30')]);_0xd38028[_0x36cb('0x34')]=_[_0x36cb('0x35')](_0x341d31['query']);_0xd38028[_0x36cb('0x36')]=_[_0x36cb('0x37')](_0xd38028[_0x36cb('0x33')],_0xd38028['query']);_0xd2761a[_0x36cb('0x38')]=_[_0x36cb('0x37')](_0xd38028[_0x36cb('0x33')],qs[_0x36cb('0x39')](_0x341d31[_0x36cb('0x34')][_0x36cb('0x39')]));_0xd2761a['attributes']=_0xd2761a[_0x36cb('0x38')][_0x36cb('0x3a')]?_0xd2761a[_0x36cb('0x38')]:_0xd38028[_0x36cb('0x33')];_0xd2761a[_0x36cb('0x3d')]=qs[_0x36cb('0x3e')](_0x341d31[_0x36cb('0x34')][_0x36cb('0x3e')]);_0xd2761a[_0x36cb('0x3f')]=qs[_0x36cb('0x36')](_['pick'](_0x341d31['query'],_0xd38028[_0x36cb('0x36')]));if(_0x341d31[_0x36cb('0x34')][_0x36cb('0x41')]){_0xd2761a[_0x36cb('0x3f')]=_[_0x36cb('0x49')](_0xd2761a['where'],{'$or':_[_0x36cb('0x2e')](_0xd2761a[_0x36cb('0x38')],function(_0x461178){var _0x264e1d={};_0x264e1d[_0x461178]={'$like':'%'+_0x341d31[_0x36cb('0x34')][_0x36cb('0x41')]+'%'};return _0x264e1d;})});}_0xd2761a=_[_0x36cb('0x49')]({},_0xd2761a,_0x341d31[_0x36cb('0x50')]);return _0x9b96fc['getConfigurations'](_0xd2761a);}})[_0x36cb('0x27')](function(_0x251d17){if(_0x251d17){_0x2dbcc9=_0x251d17[_0x36cb('0x3a')];if(!_0x341d31[_0x36cb('0x34')]['hasOwnProperty'](_0x36cb('0x3c'))){_0xd2761a[_0x36cb('0x1f')]=qs[_0x36cb('0x1f')](_0x341d31[_0x36cb('0x34')][_0x36cb('0x1f')]);_0xd2761a[_0x36cb('0x1d')]=qs['offset'](_0x341d31[_0x36cb('0x34')][_0x36cb('0x1d')]);}return _0x9b96fc[_0x36cb('0x4d')](_0xd2761a);}})['then'](function(_0x1f59a0){if(_0x1f59a0){return _0x1f59a0?{'count':_0x2dbcc9,'rows':_0x1f59a0}:null;}})[_0x36cb('0x27')](respondWithResult(_0x54615f,null))[_0x36cb('0x46')](handleError(_0x54615f,null));};exports[_0x36cb('0x51')]=function(_0x2b4c0a,_0x27d7ed,_0x33400b){if(_0x2b4c0a[_0x36cb('0x4c')]['id']){delete _0x2b4c0a[_0x36cb('0x4c')]['id'];}return db['SalesforceAccount'][_0x36cb('0x4e')]({'where':{'id':_0x2b4c0a['params']['id']}})[_0x36cb('0x27')](handleEntityNotFound(_0x27d7ed,null))['then'](function(_0x13734b){if(_0x13734b){_0x2b4c0a[_0x36cb('0x4c')]['AccountId']=_0x13734b['id'];_0x2b4c0a[_0x36cb('0x4c')][_0x36cb('0x52')]=integrations[_0x36cb('0x53')](_0x2b4c0a['body'][_0x36cb('0x54')],_0x2b4c0a[_0x36cb('0x4c')][_0x36cb('0x31')]);_0x2b4c0a[_0x36cb('0x4c')][_0x36cb('0x55')]=integrations[_0x36cb('0x56')](_0x2b4c0a[_0x36cb('0x4c')][_0x36cb('0x54')],_0x2b4c0a['body']['type']);return db[_0x36cb('0x4f')]['create'](_0x2b4c0a['body'],{'include':[{'model':db['SalesforceField'],'as':_0x36cb('0x52')},{'model':db[_0x36cb('0x57')],'as':'Descriptions'}]});}return null;})[_0x36cb('0x27')](respondWithResult(_0x27d7ed,null))[_0x36cb('0x46')](handleError(_0x27d7ed,null));};exports[_0x36cb('0x58')]=function(_0xbf9871,_0x573b82,_0x4d722c){var _0x3e9260;var _0x17d516='';var _0x13afc3=_0x36cb('0x59');return db[_0x36cb('0x2f')][_0x36cb('0x4e')]({'where':{'id':_0xbf9871[_0x36cb('0x48')]['id']},'attributes':['id',_0x36cb('0x5a'),'clientId','clientSecret',_0x36cb('0x5b'),_0x36cb('0x5c'),_0x36cb('0x5d')]})[_0x36cb('0x27')](handleEntityNotFound(_0x573b82,null))[_0x36cb('0x27')](function(_0x201222){if(_0x201222){_0x17d516=_0x201222[_0x36cb('0x5a')];var _0x400c37=_0x17d516[_0x36cb('0x5e')](-0x1);if(_0x400c37==='/'){_0x17d516=_0x17d516[_0x36cb('0x5f')](0x0,_0x17d516[_0x36cb('0x60')](_0x400c37));}_0x3e9260=new jsforce[(_0x36cb('0x61'))]({'oauth2':{'loginUrl':_0x17d516,'clientId':_0x201222[_0x36cb('0x62')],'clientSecret':_0x201222['clientSecret']}});return _0x3e9260[_0x36cb('0x63')](_0x201222[_0x36cb('0x5b')],_0x201222[_0x36cb('0x5c')][_0x36cb('0x64')](_0x201222['securityToken']));}})[_0x36cb('0x27')](function(_0x5d6b76){if(_0x5d6b76){if(!_[_0x36cb('0x65')](_0xbf9871[_0x36cb('0x34')][_0x36cb('0x66')])){_0x13afc3=_0xbf9871[_0x36cb('0x34')][_0x36cb('0x66')];}return _0x3e9260['sobject'](_0x13afc3)[_0x36cb('0x67')]();}})[_0x36cb('0x27')](function(_0x136b5a){var _0x9564b1=[_0x36cb('0x68'),_0x36cb('0x69'),'IsReminderSet',_0x36cb('0x6a'),_0x36cb('0x6b'),_0x36cb('0x6c')];var _0x24bfbb=[_0x36cb('0x6d'),'int','picklist','boolean',_0x36cb('0x6e'),_0x36cb('0x6f'),_0x36cb('0x70')];if(_0x136b5a){_[_0x36cb('0x71')](_0x136b5a[_0x36cb('0x39')],function(_0x2b20bb){return _0x9564b1[_0x36cb('0x72')](_0x2b20bb[_0x36cb('0x2b')])||!_0x24bfbb[_0x36cb('0x72')](_0x2b20bb[_0x36cb('0x31')]);});return{'count':_0x136b5a[_0x36cb('0x39')][_0x36cb('0x3a')],'rows':_['map'](_0x136b5a[_0x36cb('0x39')],function(_0x4e30ed){return{'id':_0x4e30ed[_0x36cb('0x2b')],'name':_0x4e30ed[_0x36cb('0x73')],'custom':_0x4e30ed[_0x36cb('0x74')],'options':_0x4e30ed[_0x36cb('0x75')][_0x36cb('0x3a')]>0x0?_[_0x36cb('0x2e')](_0x4e30ed['picklistValues'],function(_0x2aed56){return{'name':_0x2aed56[_0x36cb('0x73')],'value':_0x2aed56[_0x36cb('0x76')]};}):_0x4e30ed['type']=='boolean'?[{'name':_0x36cb('0x77'),'value':_0x36cb('0x78')},{'name':_0x36cb('0x79'),'value':_0x36cb('0x7a')}]:[]};})};}})[_0x36cb('0x27')](respondWithResult(_0x573b82,null))[_0x36cb('0x46')](function(_0x24e9c6){var _0x2b3ec9=_0xbf9871[_0x36cb('0x34')][_0x36cb('0x7b')]?0x1f4:_0x24e9c6[_0x36cb('0x7c')]||0x1f4;logger[_0x36cb('0x29')](_0x36cb('0x7d'),_0x36cb('0x58'),_0x2b3ec9,JSON[_0x36cb('0x7e')](_0x24e9c6));delete _0x24e9c6[_0x36cb('0x2b')];if(_0x2b3ec9===0x191){_0x2b3ec9=0x190;}_0x573b82['status'](_0x2b3ec9)['send'](_0xbf9871['query'][_0x36cb('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x24e9c6[_0x36cb('0x7c')]}:_0x24e9c6);});};
\ No newline at end of file
index 2de6c41..b61b322 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc524=['bluebird','request-promise','path','rimraf','../../components/integrations/configuration','exports','int_salesforce_accounts','../../config/logger','api','moment'];(function(_0x392bd3,_0x1308d8){var _0x36c7c8=function(_0x1f652c){while(--_0x1f652c){_0x392bd3['push'](_0x392bd3['shift']());}};_0x36c7c8(++_0x1308d8);}(_0xc524,0x1bf));var _0x4c52=function(_0x5edc34,_0x90976f){_0x5edc34=_0x5edc34-0x0;var _0x5f4b6a=_0xc524[_0x5edc34];return _0x5f4b6a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4c52('0x0'))(_0x4c52('0x1'));var moment=require(_0x4c52('0x2'));var BPromise=require(_0x4c52('0x3'));var rp=require(_0x4c52('0x4'));var fs=require('fs');var path=require(_0x4c52('0x5'));var rimraf=require(_0x4c52('0x6'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x4c52('0x7'));module[_0x4c52('0x8')]=function(_0x72d0ec,_0x4756e3){return _0x72d0ec['define']('SalesforceAccount',attributes,{'tableName':_0x4c52('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0eec=['../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd30042,_0x1b7b1c){var _0x1bccaa=function(_0x53d1e3){while(--_0x53d1e3){_0xd30042['push'](_0xd30042['shift']());}};_0x1bccaa(++_0x1b7b1c);}(_0x0eec,0xac));var _0xc0ee=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0eec[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc0ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc0ee('0x1'));var moment=require(_0xc0ee('0x2'));var BPromise=require(_0xc0ee('0x3'));var rp=require(_0xc0ee('0x4'));var fs=require('fs');var path=require(_0xc0ee('0x5'));var rimraf=require(_0xc0ee('0x6'));var config=require(_0xc0ee('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0xc0ee('0x8'));module['exports']=function(_0x218797,_0x39022a){return _0x218797[_0xc0ee('0x9')](_0xc0ee('0xa'),attributes,{'tableName':_0xc0ee('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 81b5667..4845057 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a0b=['request','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','attributes','include','model','map','ShowSalesforceAccount','find','where','then','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x4c58d2,_0x56f6c3){var _0x8ed39c=function(_0x54c7ae){while(--_0x54c7ae){_0x4c58d2['push'](_0x4c58d2['shift']());}};_0x8ed39c(++_0x56f6c3);}(_0x7a0b,0x85));var _0xb7a0=function(_0x6b8c30,_0x41e61a){_0x6b8c30=_0x6b8c30-0x0;var _0x2dd085=_0x7a0b[_0x6b8c30];return _0x2dd085;};'use strict';var _=require(_0xb7a0('0x0'));var util=require(_0xb7a0('0x1'));var moment=require(_0xb7a0('0x2'));var BPromise=require('bluebird');var rs=require(_0xb7a0('0x3'));var fs=require('fs');var Redis=require(_0xb7a0('0x4'));var db=require(_0xb7a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7a0('0x6'))(_0xb7a0('0x7'));var config=require(_0xb7a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb7a0('0x9')][_0xb7a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39176b,_0x2e7f81,_0x4e0a5f){return new BPromise(function(_0x4c128a,_0x226de4){return client[_0xb7a0('0xb')](_0x39176b,_0x4e0a5f)['then'](function(_0x3f78ec){logger[_0xb7a0('0xc')](_0xb7a0('0xd'),_0x2e7f81,_0xb7a0('0xe'));logger[_0xb7a0('0xf')](_0xb7a0('0x10'),_0x2e7f81,_0xb7a0('0xe'),JSON['stringify'](_0x3f78ec));if(_0x3f78ec[_0xb7a0('0x11')]){if(_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x12')]===0x1f4){logger[_0xb7a0('0x11')](_0xb7a0('0xd'),_0x2e7f81,_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x13')]);return _0x226de4(_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x13')]);}logger[_0xb7a0('0x11')](_0xb7a0('0xd'),_0x2e7f81,_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x13')]);return _0x4c128a(_0x3f78ec[_0xb7a0('0x11')][_0xb7a0('0x13')]);}else{logger[_0xb7a0('0xc')](_0xb7a0('0xd'),_0x2e7f81,'request\x20sent');_0x4c128a(_0x3f78ec[_0xb7a0('0x14')][_0xb7a0('0x13')]);}})[_0xb7a0('0x15')](function(_0x3494dd){logger['error'](_0xb7a0('0xd'),_0x2e7f81,_0x3494dd);_0x226de4(_0x3494dd);});});}exports[_0xb7a0('0x16')]=function(_0x18d253){var _0x1f4e25=this;return new Promise(function(_0xa3a377,_0x2c7738){return db[_0xb7a0('0x17')][_0xb7a0('0x18')]({'raw':_0x18d253[_0xb7a0('0x19')]?_0x18d253[_0xb7a0('0x19')][_0xb7a0('0x1a')]===undefined?!![]:![]:!![],'where':_0x18d253[_0xb7a0('0x19')]?_0x18d253['options']['where']||null:null,'attributes':_0x18d253[_0xb7a0('0x19')]?_0x18d253[_0xb7a0('0x19')][_0xb7a0('0x1b')]||null:null,'limit':_0x18d253[_0xb7a0('0x19')]?_0x18d253[_0xb7a0('0x19')]['limit']||null:null,'include':_0x18d253[_0xb7a0('0x19')]?_0x18d253[_0xb7a0('0x19')][_0xb7a0('0x1c')]?_['map'](_0x18d253[_0xb7a0('0x19')][_0xb7a0('0x1c')],function(_0x161df4){return{'model':db[_0x161df4['model']],'as':_0x161df4['as'],'attributes':_0x161df4['attributes'],'include':_0x161df4['include']?_['map'](_0x161df4[_0xb7a0('0x1c')],function(_0x581bb4){return{'model':db[_0x581bb4[_0xb7a0('0x1d')]],'as':_0x581bb4['as'],'attributes':_0x581bb4['attributes'],'include':_0x581bb4[_0xb7a0('0x1c')]?_[_0xb7a0('0x1e')](_0x581bb4['include'],function(_0x34c8c8){return{'model':db[_0x34c8c8[_0xb7a0('0x1d')]],'as':_0x34c8c8['as'],'attributes':_0x34c8c8['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x76a129){logger[_0xb7a0('0xc')]('GetSalesforceAccount',_0x18d253);logger[_0xb7a0('0xf')]('GetSalesforceAccount',_0x18d253,JSON['stringify'](_0x76a129));_0xa3a377(_0x76a129);})[_0xb7a0('0x15')](function(_0x531093){logger[_0xb7a0('0x11')](_0xb7a0('0x16'),_0x531093[_0xb7a0('0x13')],_0x18d253);_0x2c7738(_0x1f4e25['error'](0x1f4,_0x531093['message']));});});};exports[_0xb7a0('0x1f')]=function(_0x503848){var _0x147fe3=this;return new Promise(function(_0x5600eb,_0x2dbedb){return db[_0xb7a0('0x17')][_0xb7a0('0x20')]({'raw':_0x503848[_0xb7a0('0x19')]?_0x503848[_0xb7a0('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x503848[_0xb7a0('0x19')]?_0x503848['options'][_0xb7a0('0x21')]||null:null,'attributes':_0x503848['options']?_0x503848[_0xb7a0('0x19')][_0xb7a0('0x1b')]||null:null,'include':_0x503848[_0xb7a0('0x19')]?_0x503848[_0xb7a0('0x19')]['include']?_[_0xb7a0('0x1e')](_0x503848[_0xb7a0('0x19')][_0xb7a0('0x1c')],function(_0x487a7a){return{'model':db[_0x487a7a[_0xb7a0('0x1d')]],'as':_0x487a7a['as'],'attributes':_0x487a7a[_0xb7a0('0x1b')],'include':_0x487a7a['include']?_[_0xb7a0('0x1e')](_0x487a7a[_0xb7a0('0x1c')],function(_0x55ba75){return{'model':db[_0x55ba75[_0xb7a0('0x1d')]],'as':_0x55ba75['as'],'attributes':_0x55ba75[_0xb7a0('0x1b')],'include':_0x55ba75[_0xb7a0('0x1c')]?_[_0xb7a0('0x1e')](_0x55ba75[_0xb7a0('0x1c')],function(_0x3b350c){return{'model':db[_0x3b350c[_0xb7a0('0x1d')]],'as':_0x3b350c['as'],'attributes':_0x3b350c[_0xb7a0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb7a0('0x22')](function(_0x467316){logger['info'](_0xb7a0('0x1f'),_0x503848);logger[_0xb7a0('0xf')](_0xb7a0('0x1f'),_0x503848,JSON[_0xb7a0('0x23')](_0x467316));_0x5600eb(_0x467316);})[_0xb7a0('0x15')](function(_0x10c34d){logger[_0xb7a0('0x11')](_0xb7a0('0x1f'),_0x10c34d[_0xb7a0('0x13')],_0x503848);_0x2dbedb(_0x147fe3[_0xb7a0('0x11')](0x1f4,_0x10c34d[_0xb7a0('0x13')]));});});};
\ No newline at end of file
+var _0x05e5=['stringify','ShowSalesforceAccount','SalesforceAccount','find','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','GetSalesforceAccount','findAll','options','attributes','limit','map','include','model'];(function(_0x2419f5,_0x409a26){var _0x464efb=function(_0x20c7aa){while(--_0x20c7aa){_0x2419f5['push'](_0x2419f5['shift']());}};_0x464efb(++_0x409a26);}(_0x05e5,0x17b));var _0x505e=function(_0x1e9c70,_0x368b6b){_0x1e9c70=_0x1e9c70-0x0;var _0x517ec3=_0x05e5[_0x1e9c70];return _0x517ec3;};'use strict';var _=require(_0x505e('0x0'));var util=require(_0x505e('0x1'));var moment=require('moment');var BPromise=require(_0x505e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x505e('0x3'));var db=require(_0x505e('0x4'))['db'];var utils=require(_0x505e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x505e('0x6'));var jayson=require(_0x505e('0x7'));var client=jayson[_0x505e('0x8')][_0x505e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3583ad,_0x1af01,_0x3b9b19){return new BPromise(function(_0x247c5f,_0x27b0e2){return client['request'](_0x3583ad,_0x3b9b19)[_0x505e('0xa')](function(_0x2f1865){logger[_0x505e('0xb')](_0x505e('0xc'),_0x1af01,_0x505e('0xd'));logger[_0x505e('0xe')](_0x505e('0xf'),_0x1af01,'request\x20sent',JSON['stringify'](_0x2f1865));if(_0x2f1865['error']){if(_0x2f1865['error'][_0x505e('0x10')]===0x1f4){logger['error'](_0x505e('0xc'),_0x1af01,_0x2f1865[_0x505e('0x11')]['message']);return _0x27b0e2(_0x2f1865[_0x505e('0x11')][_0x505e('0x12')]);}logger[_0x505e('0x11')](_0x505e('0xc'),_0x1af01,_0x2f1865[_0x505e('0x11')][_0x505e('0x12')]);return _0x247c5f(_0x2f1865['error'][_0x505e('0x12')]);}else{logger[_0x505e('0xb')](_0x505e('0xc'),_0x1af01,_0x505e('0xd'));_0x247c5f(_0x2f1865[_0x505e('0x13')][_0x505e('0x12')]);}})[_0x505e('0x14')](function(_0x2db0ae){logger['error'](_0x505e('0xc'),_0x1af01,_0x2db0ae);_0x27b0e2(_0x2db0ae);});});}exports[_0x505e('0x15')]=function(_0x40c958){var _0x4892f8=this;return new Promise(function(_0x8564d,_0x5c202d){return db['SalesforceAccount'][_0x505e('0x16')]({'raw':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')]['where']||null:null,'attributes':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')][_0x505e('0x18')]||null:null,'limit':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')][_0x505e('0x19')]||null:null,'include':_0x40c958[_0x505e('0x17')]?_0x40c958[_0x505e('0x17')]['include']?_[_0x505e('0x1a')](_0x40c958[_0x505e('0x17')]['include'],function(_0xccd660){return{'model':db[_0xccd660['model']],'as':_0xccd660['as'],'attributes':_0xccd660[_0x505e('0x18')],'include':_0xccd660['include']?_[_0x505e('0x1a')](_0xccd660[_0x505e('0x1b')],function(_0x2b1f83){return{'model':db[_0x2b1f83[_0x505e('0x1c')]],'as':_0x2b1f83['as'],'attributes':_0x2b1f83[_0x505e('0x18')],'include':_0x2b1f83['include']?_[_0x505e('0x1a')](_0x2b1f83['include'],function(_0xc9d21){return{'model':db[_0xc9d21[_0x505e('0x1c')]],'as':_0xc9d21['as'],'attributes':_0xc9d21[_0x505e('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1673a9){logger[_0x505e('0xb')](_0x505e('0x15'),_0x40c958);logger[_0x505e('0xe')](_0x505e('0x15'),_0x40c958,JSON[_0x505e('0x1d')](_0x1673a9));_0x8564d(_0x1673a9);})[_0x505e('0x14')](function(_0x580fe6){logger[_0x505e('0x11')](_0x505e('0x15'),_0x580fe6[_0x505e('0x12')],_0x40c958);_0x5c202d(_0x4892f8[_0x505e('0x11')](0x1f4,_0x580fe6[_0x505e('0x12')]));});});};exports[_0x505e('0x1e')]=function(_0xc6b6ea){var _0x176ac8=this;return new Promise(function(_0xb3d461,_0x887c28){return db[_0x505e('0x1f')][_0x505e('0x20')]({'raw':_0xc6b6ea[_0x505e('0x17')]?_0xc6b6ea[_0x505e('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xc6b6ea[_0x505e('0x17')]?_0xc6b6ea['options'][_0x505e('0x21')]||null:null,'attributes':_0xc6b6ea[_0x505e('0x17')]?_0xc6b6ea[_0x505e('0x17')][_0x505e('0x18')]||null:null,'include':_0xc6b6ea[_0x505e('0x17')]?_0xc6b6ea[_0x505e('0x17')][_0x505e('0x1b')]?_[_0x505e('0x1a')](_0xc6b6ea[_0x505e('0x17')][_0x505e('0x1b')],function(_0x273f7e){return{'model':db[_0x273f7e['model']],'as':_0x273f7e['as'],'attributes':_0x273f7e[_0x505e('0x18')],'include':_0x273f7e[_0x505e('0x1b')]?_['map'](_0x273f7e[_0x505e('0x1b')],function(_0x5bbd61){return{'model':db[_0x5bbd61[_0x505e('0x1c')]],'as':_0x5bbd61['as'],'attributes':_0x5bbd61[_0x505e('0x18')],'include':_0x5bbd61[_0x505e('0x1b')]?_['map'](_0x5bbd61[_0x505e('0x1b')],function(_0x4a9e4f){return{'model':db[_0x4a9e4f[_0x505e('0x1c')]],'as':_0x4a9e4f['as'],'attributes':_0x4a9e4f[_0x505e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x505e('0xa')](function(_0x4553b5){logger[_0x505e('0xb')](_0x505e('0x1e'),_0xc6b6ea);logger[_0x505e('0xe')](_0x505e('0x1e'),_0xc6b6ea,JSON[_0x505e('0x1d')](_0x4553b5));_0xb3d461(_0x4553b5);})[_0x505e('0x14')](function(_0x1a34c5){logger['error'](_0x505e('0x1e'),_0x1a34c5[_0x505e('0x12')],_0xc6b6ea);_0x887c28(_0x176ac8['error'](0x1f4,_0x1a34c5[_0x505e('0x12')]));});});};
\ No newline at end of file
index 1ebdcdf..3af3086 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','delete','destroy','exports','multer','util'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xdb28,0x106));var _0x8db2=function(_0x1aeace,_0x48cf05){_0x1aeace=_0x1aeace-0x0;var _0x2a929e=_0xdb28[_0x1aeace];return _0x2a929e;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./intSalesforceConfiguration.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getDescriptions']);router[_0x8db2('0x12')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x14')](_0x8db2('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x8db2('0x15')](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);module[_0x8db2('0x17')]=router;
\ No newline at end of file
+var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x4bfdf0,_0x4dfc5b){var _0xe5f7a6=function(_0x13d91c){while(--_0x13d91c){_0x4bfdf0['push'](_0x4bfdf0['shift']());}};_0xe5f7a6(++_0x4dfc5b);}(_0xadb5,0xad));var _0x5adb=function(_0x5df6ae,_0x348af1){_0x5df6ae=_0x5df6ae-0x0;var _0x131655=_0xadb5[_0x5df6ae];return _0x131655;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router;
\ No newline at end of file
index 9dab125..f3c2e7a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x40b6=['Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING','ENUM','Task'];(function(_0xda6b23,_0x280f43){var _0x24f68b=function(_0x1bd6ba){while(--_0x1bd6ba){_0xda6b23['push'](_0xda6b23['shift']());}};_0x24f68b(++_0x280f43);}(_0x40b6,0xa3));var _0x640b=function(_0x903228,_0x42c429){_0x903228=_0x903228-0x0;var _0xcec81d=_0x40b6[_0x903228];return _0xcec81d;};'use strict';var Sequelize=require(_0x640b('0x0'));module[_0x640b('0x1')]={'name':{'type':Sequelize[_0x640b('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x640b('0x3')](_0x640b('0x4'),_0x640b('0x5')),'defaultValue':_0x640b('0x4')},'moduleSearch':{'type':Sequelize['ENUM'](_0x640b('0x6'),_0x640b('0x7'),_0x640b('0x8'),_0x640b('0x9'),_0x640b('0xa')),'defaultValue':_0x640b('0x6')},'moduleCreate':{'type':Sequelize[_0x640b('0x3')](_0x640b('0xb'),_0x640b('0x7'),_0x640b('0x8'),_0x640b('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0x640b('0x2')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x640b('0x2')]}};
\ No newline at end of file
+var _0x6c11=['contact','lead','account','sequelize','STRING','ENUM','Task','contact_lead'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x6c11,0xe3));var _0x16c1=function(_0x32bf73,_0x724874){_0x32bf73=_0x32bf73-0x0;var _0x3325a1=_0x6c11[_0x32bf73];return _0x3325a1;};'use strict';var Sequelize=require(_0x16c1('0x0'));module['exports']={'name':{'type':Sequelize[_0x16c1('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x16c1('0x2')](_0x16c1('0x3'),'Case'),'defaultValue':_0x16c1('0x3')},'moduleSearch':{'type':Sequelize[_0x16c1('0x2')](_0x16c1('0x4'),_0x16c1('0x5'),_0x16c1('0x6'),'account_contact_lead',_0x16c1('0x7')),'defaultValue':_0x16c1('0x4')},'moduleCreate':{'type':Sequelize[_0x16c1('0x2')]('nothing',_0x16c1('0x5'),_0x16c1('0x6'),_0x16c1('0x7')),'defaultValue':_0x16c1('0x6')},'leadId':{'type':Sequelize[_0x16c1('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x16c1('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x16c1('0x1')]}};
\ No newline at end of file
index 89f419f..7c3c92c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd57=['reject','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','nolimit','getSubjects','SalesforceField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','apply'];(function(_0x1028e2,_0x5c9594){var _0xb58046=function(_0x5c4fff){while(--_0x5c4fff){_0x1028e2['push'](_0x1028e2['shift']());}};_0xb58046(++_0x5c9594);}(_0xcd57,0x1ae));var _0x7cd5=function(_0x1863be,_0x3fb18f){_0x1863be=_0x1863be-0x0;var _0x5835e1=_0xcd57[_0x1863be];return _0x5835e1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7cd5('0x0'));var zipdir=require(_0x7cd5('0x1'));var jsonpatch=require(_0x7cd5('0x2'));var rp=require(_0x7cd5('0x3'));var moment=require(_0x7cd5('0x4'));var BPromise=require(_0x7cd5('0x5'));var Mustache=require('mustache');var util=require(_0x7cd5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x7cd5('0x7'));var ejs=require(_0x7cd5('0x8'));var fs=require('fs');var fs_extra=require(_0x7cd5('0x9'));var _=require(_0x7cd5('0xa'));var squel=require(_0x7cd5('0xb'));var crypto=require('crypto');var jsforce=require(_0x7cd5('0xc'));var deskjs=require(_0x7cd5('0xd'));var toCsv=require(_0x7cd5('0x7'));var querystring=require('querystring');var Papa=require(_0x7cd5('0xe'));var Redis=require(_0x7cd5('0xf'));var authService=require(_0x7cd5('0x10'));var qs=require(_0x7cd5('0x11'));var as=require(_0x7cd5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7cd5('0x13'))(_0x7cd5('0x14'));var utils=require('../../config/utils');var config=require(_0x7cd5('0x15'));var licenseUtil=require(_0x7cd5('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x465c13,_0x279c96){_0x279c96=_0x279c96||0xcc;return function(_0x7d6675){if(_0x7d6675){return _0x465c13[_0x7cd5('0x17')](_0x279c96);}return _0x465c13[_0x7cd5('0x18')](_0x279c96)[_0x7cd5('0x19')]();};}function respondWithResult(_0x107a59,_0x4203b7){_0x4203b7=_0x4203b7||0xc8;return function(_0x1562fc){if(_0x1562fc){return _0x107a59[_0x7cd5('0x18')](_0x4203b7)['json'](_0x1562fc);}};}function respondWithFilteredResult(_0xdf46b3,_0x36b8ba){return function(_0x282ccb){if(_0x282ccb){var _0x22feec=typeof _0x36b8ba[_0x7cd5('0x1a')]==='undefined'&&typeof _0x36b8ba[_0x7cd5('0x1b')]===_0x7cd5('0x1c');var _0x5c5538=_0x282ccb[_0x7cd5('0x1d')];var _0x461095=_0x22feec?0x0:_0x36b8ba[_0x7cd5('0x1a')];var _0x1ed48a=_0x22feec?_0x282ccb['count']:_0x36b8ba['offset']+_0x36b8ba[_0x7cd5('0x1b')];var _0x250a80;if(_0x1ed48a>=_0x5c5538){_0x1ed48a=_0x5c5538;_0x250a80=0xc8;}else{_0x250a80=0xce;}_0xdf46b3[_0x7cd5('0x18')](_0x250a80);return _0xdf46b3['set'](_0x7cd5('0x1e'),_0x461095+'-'+_0x1ed48a+'/'+_0x5c5538)['json'](_0x282ccb);}return null;};}function patchUpdates(_0x49881f){return function(_0x27930b){try{jsonpatch[_0x7cd5('0x1f')](_0x27930b,_0x49881f,!![]);}catch(_0x1d214d){return BPromise[_0x7cd5('0x20')](_0x1d214d);}return _0x27930b['save']();};}function saveUpdates(_0x4e1769,_0x2ff33f){return function(_0x2d6c5b){if(_0x2d6c5b){return _0x2d6c5b[_0x7cd5('0x21')](_0x4e1769)[_0x7cd5('0x22')](function(_0x1fad57){return _0x1fad57;});}return null;};}function removeEntity(_0x5452ed,_0x5287f5){return function(_0x395814){if(_0x395814){return _0x395814[_0x7cd5('0x23')]()[_0x7cd5('0x22')](function(){_0x5452ed[_0x7cd5('0x18')](0xcc)[_0x7cd5('0x19')]();});}};}function handleEntityNotFound(_0x8b7dc6,_0x28b792){return function(_0x13166b){if(!_0x13166b){_0x8b7dc6[_0x7cd5('0x17')](0x194);}return _0x13166b;};}function handleError(_0x164915,_0x397c54){_0x397c54=_0x397c54||0x1f4;return function(_0x86580f){logger[_0x7cd5('0x24')](_0x86580f['stack']);if(_0x86580f[_0x7cd5('0x25')]){delete _0x86580f[_0x7cd5('0x25')];}_0x164915['status'](_0x397c54)[_0x7cd5('0x26')](_0x86580f);};}exports[_0x7cd5('0x27')]=function(_0x3ea8a7,_0x4ff65c){var _0x37008e={},_0x10e22b={},_0x3dc60f={'count':0x0,'rows':[]};var _0x37a05a=_[_0x7cd5('0x28')](db[_0x7cd5('0x29')][_0x7cd5('0x2a')],function(_0xa50ace){return{'name':_0xa50ace[_0x7cd5('0x2b')],'type':_0xa50ace[_0x7cd5('0x2c')][_0x7cd5('0x2d')]};});_0x10e22b[_0x7cd5('0x2e')]=_[_0x7cd5('0x28')](_0x37a05a,_0x7cd5('0x25'));_0x10e22b['query']=_[_0x7cd5('0x2f')](_0x3ea8a7[_0x7cd5('0x30')]);_0x10e22b[_0x7cd5('0x31')]=_[_0x7cd5('0x32')](_0x10e22b[_0x7cd5('0x2e')],_0x10e22b[_0x7cd5('0x30')]);_0x37008e['attributes']=_[_0x7cd5('0x32')](_0x10e22b[_0x7cd5('0x2e')],qs[_0x7cd5('0x33')](_0x3ea8a7[_0x7cd5('0x30')]['fields']));_0x37008e['attributes']=_0x37008e[_0x7cd5('0x34')][_0x7cd5('0x35')]?_0x37008e['attributes']:_0x10e22b['model'];if(!_0x3ea8a7['query'][_0x7cd5('0x36')]('nolimit')){_0x37008e[_0x7cd5('0x1b')]=qs['limit'](_0x3ea8a7[_0x7cd5('0x30')]['limit']);_0x37008e['offset']=qs[_0x7cd5('0x1a')](_0x3ea8a7[_0x7cd5('0x30')]['offset']);}_0x37008e[_0x7cd5('0x37')]=qs[_0x7cd5('0x38')](_0x3ea8a7[_0x7cd5('0x30')][_0x7cd5('0x38')]);_0x37008e[_0x7cd5('0x39')]=qs[_0x7cd5('0x31')](_[_0x7cd5('0x3a')](_0x3ea8a7[_0x7cd5('0x30')],_0x10e22b[_0x7cd5('0x31')]),_0x37a05a);if(_0x3ea8a7['query'][_0x7cd5('0x3b')]){_0x37008e[_0x7cd5('0x39')]=_[_0x7cd5('0x3c')](_0x37008e['where'],{'$or':_['map'](_0x37a05a,function(_0x3da01c){if(_0x3da01c[_0x7cd5('0x2c')]!=='VIRTUAL'){var _0x98ae68={};_0x98ae68[_0x3da01c[_0x7cd5('0x25')]]={'$like':'%'+_0x3ea8a7[_0x7cd5('0x30')][_0x7cd5('0x3b')]+'%'};return _0x98ae68;}})});}_0x37008e=_[_0x7cd5('0x3c')]({},_0x37008e,_0x3ea8a7[_0x7cd5('0x3d')]);var _0x4a6074={'where':_0x37008e['where']};return db[_0x7cd5('0x29')][_0x7cd5('0x1d')](_0x4a6074)[_0x7cd5('0x22')](function(_0x3c8c5c){_0x3dc60f[_0x7cd5('0x1d')]=_0x3c8c5c;if(_0x3ea8a7['query'][_0x7cd5('0x3e')]){_0x37008e[_0x7cd5('0x3f')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x7cd5('0x40')](_0x37008e);})['then'](function(_0x3d1def){_0x3dc60f[_0x7cd5('0x41')]=_0x3d1def;return _0x3dc60f;})['then'](respondWithFilteredResult(_0x4ff65c,_0x37008e))[_0x7cd5('0x42')](handleError(_0x4ff65c,null));};exports['show']=function(_0x1cfc20,_0x5043e7){var _0x136d6a={'raw':![],'where':{'id':_0x1cfc20[_0x7cd5('0x43')]['id']}},_0x558cb3={};_0x558cb3[_0x7cd5('0x2e')]=_[_0x7cd5('0x2f')](db[_0x7cd5('0x29')][_0x7cd5('0x2a')]);_0x558cb3[_0x7cd5('0x30')]=_[_0x7cd5('0x2f')](_0x1cfc20[_0x7cd5('0x30')]);_0x558cb3[_0x7cd5('0x31')]=_['intersection'](_0x558cb3[_0x7cd5('0x2e')],_0x558cb3[_0x7cd5('0x30')]);_0x136d6a['attributes']=_[_0x7cd5('0x32')](_0x558cb3[_0x7cd5('0x2e')],qs[_0x7cd5('0x33')](_0x1cfc20[_0x7cd5('0x30')][_0x7cd5('0x33')]));_0x136d6a[_0x7cd5('0x34')]=_0x136d6a[_0x7cd5('0x34')][_0x7cd5('0x35')]?_0x136d6a[_0x7cd5('0x34')]:_0x558cb3[_0x7cd5('0x2e')];if(_0x1cfc20['query'][_0x7cd5('0x3e')]){_0x136d6a[_0x7cd5('0x3f')]=[{'all':!![]}];}_0x136d6a=_[_0x7cd5('0x3c')]({},_0x136d6a,_0x1cfc20[_0x7cd5('0x3d')]);return db[_0x7cd5('0x29')][_0x7cd5('0x44')](_0x136d6a)['then'](handleEntityNotFound(_0x5043e7,null))['then'](respondWithResult(_0x5043e7,null))[_0x7cd5('0x42')](handleError(_0x5043e7,null));};exports[_0x7cd5('0x45')]=function(_0x484ac2,_0x384602){return db[_0x7cd5('0x29')][_0x7cd5('0x45')](_0x484ac2[_0x7cd5('0x46')],{})[_0x7cd5('0x22')](respondWithResult(_0x384602,0xc9))[_0x7cd5('0x42')](handleError(_0x384602,null));};exports[_0x7cd5('0x21')]=function(_0x3a5361,_0x8f35bd){if(_0x3a5361[_0x7cd5('0x46')]['id']){delete _0x3a5361[_0x7cd5('0x46')]['id'];}return db['SalesforceConfiguration'][_0x7cd5('0x44')]({'where':{'id':_0x3a5361[_0x7cd5('0x43')]['id']}})[_0x7cd5('0x22')](handleEntityNotFound(_0x8f35bd,null))[_0x7cd5('0x22')](saveUpdates(_0x3a5361[_0x7cd5('0x46')],null))[_0x7cd5('0x22')](respondWithResult(_0x8f35bd,null))['catch'](handleError(_0x8f35bd,null));};exports[_0x7cd5('0x23')]=function(_0x233990,_0x4169c9){return db['SalesforceConfiguration'][_0x7cd5('0x44')]({'where':{'id':_0x233990[_0x7cd5('0x43')]['id']}})[_0x7cd5('0x22')](handleEntityNotFound(_0x4169c9,null))[_0x7cd5('0x22')](removeEntity(_0x4169c9,null))['catch'](handleError(_0x4169c9,null));};exports[_0x7cd5('0x47')]=function(_0x394e02,_0x4ec6dc,_0x2d9d72){var _0x5240f3={};var _0x18f02b={};var _0x3f343e;var _0x79e6ff;return db['SalesforceConfiguration'][_0x7cd5('0x48')]({'where':{'id':_0x394e02['params']['id']}})['then'](handleEntityNotFound(_0x4ec6dc,null))[_0x7cd5('0x22')](function(_0x5e6ed6){if(_0x5e6ed6){_0x3f343e=_0x5e6ed6;_0x18f02b['model']=_['keys'](db['SalesforceField'][_0x7cd5('0x2a')]);_0x18f02b['query']=_[_0x7cd5('0x2f')](_0x394e02[_0x7cd5('0x30')]);_0x18f02b['filters']=_[_0x7cd5('0x32')](_0x18f02b[_0x7cd5('0x2e')],_0x18f02b[_0x7cd5('0x30')]);_0x5240f3[_0x7cd5('0x34')]=_[_0x7cd5('0x32')](_0x18f02b[_0x7cd5('0x2e')],qs['fields'](_0x394e02[_0x7cd5('0x30')][_0x7cd5('0x33')]));_0x5240f3[_0x7cd5('0x34')]=_0x5240f3[_0x7cd5('0x34')]['length']?_0x5240f3[_0x7cd5('0x34')]:_0x18f02b['model'];_0x5240f3[_0x7cd5('0x37')]=qs[_0x7cd5('0x38')](_0x394e02[_0x7cd5('0x30')][_0x7cd5('0x38')]);_0x5240f3['where']=qs[_0x7cd5('0x31')](_[_0x7cd5('0x3a')](_0x394e02['query'],_0x18f02b['filters']));if(_0x394e02[_0x7cd5('0x30')][_0x7cd5('0x3b')]){_0x5240f3['where']=_['merge'](_0x5240f3[_0x7cd5('0x39')],{'$or':_[_0x7cd5('0x28')](_0x5240f3[_0x7cd5('0x34')],function(_0x43a7d8){var _0xbe9d17={};_0xbe9d17[_0x43a7d8]={'$like':'%'+_0x394e02[_0x7cd5('0x30')][_0x7cd5('0x3b')]+'%'};return _0xbe9d17;})});}_0x5240f3=_[_0x7cd5('0x3c')]({},_0x5240f3,_0x394e02[_0x7cd5('0x3d')]);return _0x3f343e[_0x7cd5('0x47')](_0x5240f3);}})[_0x7cd5('0x22')](function(_0x11500f){if(_0x11500f){_0x79e6ff=_0x11500f[_0x7cd5('0x35')];if(!_0x394e02[_0x7cd5('0x30')][_0x7cd5('0x36')](_0x7cd5('0x49'))){_0x5240f3[_0x7cd5('0x1b')]=qs[_0x7cd5('0x1b')](_0x394e02['query'][_0x7cd5('0x1b')]);_0x5240f3[_0x7cd5('0x1a')]=qs[_0x7cd5('0x1a')](_0x394e02[_0x7cd5('0x30')][_0x7cd5('0x1a')]);}return _0x3f343e[_0x7cd5('0x47')](_0x5240f3);}})[_0x7cd5('0x22')](function(_0x31393a){if(_0x31393a){return _0x31393a?{'count':_0x79e6ff,'rows':_0x31393a}:null;}})['then'](respondWithResult(_0x4ec6dc,null))[_0x7cd5('0x42')](handleError(_0x4ec6dc,null));};exports[_0x7cd5('0x4a')]=function(_0x59948f,_0x5a49aa,_0x3f73e4){var _0x2dee38={};var _0x4a694b={};var _0x17b158;var _0x46f9b7;return db[_0x7cd5('0x29')][_0x7cd5('0x48')]({'where':{'id':_0x59948f[_0x7cd5('0x43')]['id']}})[_0x7cd5('0x22')](handleEntityNotFound(_0x5a49aa,null))[_0x7cd5('0x22')](function(_0x4e1c34){if(_0x4e1c34){_0x17b158=_0x4e1c34;_0x4a694b['model']=_['keys'](db[_0x7cd5('0x4b')][_0x7cd5('0x2a')]);_0x4a694b[_0x7cd5('0x30')]=_['keys'](_0x59948f['query']);_0x4a694b[_0x7cd5('0x31')]=_[_0x7cd5('0x32')](_0x4a694b[_0x7cd5('0x2e')],_0x4a694b['query']);_0x2dee38['attributes']=_[_0x7cd5('0x32')](_0x4a694b[_0x7cd5('0x2e')],qs[_0x7cd5('0x33')](_0x59948f['query'][_0x7cd5('0x33')]));_0x2dee38[_0x7cd5('0x34')]=_0x2dee38[_0x7cd5('0x34')][_0x7cd5('0x35')]?_0x2dee38[_0x7cd5('0x34')]:_0x4a694b['model'];_0x2dee38['order']=qs['sort'](_0x59948f[_0x7cd5('0x30')][_0x7cd5('0x38')]);_0x2dee38['where']=qs[_0x7cd5('0x31')](_['pick'](_0x59948f[_0x7cd5('0x30')],_0x4a694b[_0x7cd5('0x31')]));if(_0x59948f['query']['filter']){_0x2dee38[_0x7cd5('0x39')]=_[_0x7cd5('0x3c')](_0x2dee38[_0x7cd5('0x39')],{'$or':_['map'](_0x2dee38[_0x7cd5('0x34')],function(_0x25d2cc){var _0x57d6b5={};_0x57d6b5[_0x25d2cc]={'$like':'%'+_0x59948f[_0x7cd5('0x30')][_0x7cd5('0x3b')]+'%'};return _0x57d6b5;})});}_0x2dee38=_['merge']({},_0x2dee38,_0x59948f['options']);return _0x17b158[_0x7cd5('0x4a')](_0x2dee38);}})[_0x7cd5('0x22')](function(_0x453a44){if(_0x453a44){_0x46f9b7=_0x453a44['length'];if(!_0x59948f['query'][_0x7cd5('0x36')](_0x7cd5('0x49'))){_0x2dee38[_0x7cd5('0x1b')]=qs[_0x7cd5('0x1b')](_0x59948f['query'][_0x7cd5('0x1b')]);_0x2dee38['offset']=qs['offset'](_0x59948f[_0x7cd5('0x30')][_0x7cd5('0x1a')]);}return _0x17b158['getSubjects'](_0x2dee38);}})[_0x7cd5('0x22')](function(_0x3055ca){if(_0x3055ca){return _0x3055ca?{'count':_0x46f9b7,'rows':_0x3055ca}:null;}})['then'](respondWithResult(_0x5a49aa,null))[_0x7cd5('0x42')](handleError(_0x5a49aa,null));};exports[_0x7cd5('0x4c')]=function(_0x52eb0b,_0x1000d5,_0x247d7e){var _0x285414={};var _0x844607={};var _0x5709e2;var _0x38090f;return db[_0x7cd5('0x29')][_0x7cd5('0x48')]({'where':{'id':_0x52eb0b[_0x7cd5('0x43')]['id']}})['then'](handleEntityNotFound(_0x1000d5,null))['then'](function(_0x5f3115){if(_0x5f3115){_0x5709e2=_0x5f3115;_0x844607['model']=_[_0x7cd5('0x2f')](db[_0x7cd5('0x4b')]['rawAttributes']);_0x844607['query']=_[_0x7cd5('0x2f')](_0x52eb0b[_0x7cd5('0x30')]);_0x844607[_0x7cd5('0x31')]=_['intersection'](_0x844607['model'],_0x844607[_0x7cd5('0x30')]);_0x285414[_0x7cd5('0x34')]=_[_0x7cd5('0x32')](_0x844607[_0x7cd5('0x2e')],qs[_0x7cd5('0x33')](_0x52eb0b['query'][_0x7cd5('0x33')]));_0x285414[_0x7cd5('0x34')]=_0x285414[_0x7cd5('0x34')][_0x7cd5('0x35')]?_0x285414['attributes']:_0x844607['model'];_0x285414['order']=qs[_0x7cd5('0x38')](_0x52eb0b['query'][_0x7cd5('0x38')]);_0x285414[_0x7cd5('0x39')]=qs[_0x7cd5('0x31')](_[_0x7cd5('0x3a')](_0x52eb0b[_0x7cd5('0x30')],_0x844607[_0x7cd5('0x31')]));if(_0x52eb0b[_0x7cd5('0x30')]['filter']){_0x285414['where']=_[_0x7cd5('0x3c')](_0x285414[_0x7cd5('0x39')],{'$or':_[_0x7cd5('0x28')](_0x285414['attributes'],function(_0x454c08){var _0x42277a={};_0x42277a[_0x454c08]={'$like':'%'+_0x52eb0b[_0x7cd5('0x30')][_0x7cd5('0x3b')]+'%'};return _0x42277a;})});}_0x285414=_[_0x7cd5('0x3c')]({},_0x285414,_0x52eb0b[_0x7cd5('0x3d')]);return _0x5709e2[_0x7cd5('0x4c')](_0x285414);}})[_0x7cd5('0x22')](function(_0x392b72){if(_0x392b72){_0x38090f=_0x392b72[_0x7cd5('0x35')];if(!_0x52eb0b[_0x7cd5('0x30')]['hasOwnProperty'](_0x7cd5('0x49'))){_0x285414[_0x7cd5('0x1b')]=qs[_0x7cd5('0x1b')](_0x52eb0b[_0x7cd5('0x30')][_0x7cd5('0x1b')]);_0x285414[_0x7cd5('0x1a')]=qs[_0x7cd5('0x1a')](_0x52eb0b[_0x7cd5('0x30')][_0x7cd5('0x1a')]);}return _0x5709e2[_0x7cd5('0x4c')](_0x285414);}})['then'](function(_0x519b8d){if(_0x519b8d){return _0x519b8d?{'count':_0x38090f,'rows':_0x519b8d}:null;}})[_0x7cd5('0x22')](respondWithResult(_0x1000d5,null))[_0x7cd5('0x42')](handleError(_0x1000d5,null));};
\ No newline at end of file
+var _0xba64=['find','create','body','getFields','findOne','pick','getSubjects','SalesforceField','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','destroy','then','end','stack','name','send','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x1c11c0,_0x46ea36){var _0x169b05=function(_0x41a646){while(--_0x41a646){_0x1c11c0['push'](_0x1c11c0['shift']());}};_0x169b05(++_0x46ea36);}(_0xba64,0x1ef));var _0x4ba6=function(_0x593464,_0x342a27){_0x593464=_0x593464-0x0;var _0x3536b1=_0xba64[_0x593464];return _0x3536b1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ba6('0x0'));var zipdir=require(_0x4ba6('0x1'));var jsonpatch=require(_0x4ba6('0x2'));var rp=require(_0x4ba6('0x3'));var moment=require('moment');var BPromise=require(_0x4ba6('0x4'));var Mustache=require(_0x4ba6('0x5'));var util=require('util');var path=require(_0x4ba6('0x6'));var sox=require(_0x4ba6('0x7'));var csv=require(_0x4ba6('0x8'));var ejs=require(_0x4ba6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4ba6('0xa'));var crypto=require(_0x4ba6('0xb'));var jsforce=require(_0x4ba6('0xc'));var deskjs=require(_0x4ba6('0xd'));var toCsv=require(_0x4ba6('0x8'));var querystring=require(_0x4ba6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4ba6('0xf'));var qs=require(_0x4ba6('0x10'));var as=require(_0x4ba6('0x11'));var hardwareService=require(_0x4ba6('0x12'));var logger=require(_0x4ba6('0x13'))(_0x4ba6('0x14'));var utils=require(_0x4ba6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba6('0x16'));var db=require(_0x4ba6('0x17'))['db'];function respondWithStatusCode(_0x303ff0,_0x1fc891){_0x1fc891=_0x1fc891||0xcc;return function(_0x2a2cf6){if(_0x2a2cf6){return _0x303ff0[_0x4ba6('0x18')](_0x1fc891);}return _0x303ff0[_0x4ba6('0x19')](_0x1fc891)['end']();};}function respondWithResult(_0xaa8888,_0x1d118d){_0x1d118d=_0x1d118d||0xc8;return function(_0x136027){if(_0x136027){return _0xaa8888[_0x4ba6('0x19')](_0x1d118d)['json'](_0x136027);}};}function respondWithFilteredResult(_0x26c50d,_0x3bbe47){return function(_0x546b91){if(_0x546b91){var _0x542571=typeof _0x3bbe47[_0x4ba6('0x1a')]===_0x4ba6('0x1b')&&typeof _0x3bbe47[_0x4ba6('0x1c')]===_0x4ba6('0x1b');var _0x446028=_0x546b91['count'];var _0xc16001=_0x542571?0x0:_0x3bbe47['offset'];var _0x1d64b3=_0x542571?_0x546b91[_0x4ba6('0x1d')]:_0x3bbe47[_0x4ba6('0x1a')]+_0x3bbe47[_0x4ba6('0x1c')];var _0x121a3e;if(_0x1d64b3>=_0x446028){_0x1d64b3=_0x446028;_0x121a3e=0xc8;}else{_0x121a3e=0xce;}_0x26c50d['status'](_0x121a3e);return _0x26c50d[_0x4ba6('0x1e')](_0x4ba6('0x1f'),_0xc16001+'-'+_0x1d64b3+'/'+_0x446028)[_0x4ba6('0x20')](_0x546b91);}return null;};}function patchUpdates(_0x35f1ab){return function(_0x2febf9){try{jsonpatch['apply'](_0x2febf9,_0x35f1ab,!![]);}catch(_0x1d716d){return BPromise[_0x4ba6('0x21')](_0x1d716d);}return _0x2febf9[_0x4ba6('0x22')]();};}function saveUpdates(_0x3cbbca,_0x2a3a8f){return function(_0x19da88){if(_0x19da88){return _0x19da88[_0x4ba6('0x23')](_0x3cbbca)['then'](function(_0x477a92){return _0x477a92;});}return null;};}function removeEntity(_0x2c26cf,_0xc32955){return function(_0x38c341){if(_0x38c341){return _0x38c341[_0x4ba6('0x24')]()[_0x4ba6('0x25')](function(){_0x2c26cf[_0x4ba6('0x19')](0xcc)[_0x4ba6('0x26')]();});}};}function handleEntityNotFound(_0x247e9d,_0x6b8d22){return function(_0x562eab){if(!_0x562eab){_0x247e9d[_0x4ba6('0x18')](0x194);}return _0x562eab;};}function handleError(_0xa20158,_0x596ae5){_0x596ae5=_0x596ae5||0x1f4;return function(_0x163439){logger['error'](_0x163439[_0x4ba6('0x27')]);if(_0x163439[_0x4ba6('0x28')]){delete _0x163439[_0x4ba6('0x28')];}_0xa20158['status'](_0x596ae5)[_0x4ba6('0x29')](_0x163439);};}exports['index']=function(_0x502021,_0x2a295b){var _0x471217={},_0x57a26e={},_0x4b1f67={'count':0x0,'rows':[]};var _0x4e195b=_[_0x4ba6('0x2a')](db[_0x4ba6('0x2b')][_0x4ba6('0x2c')],function(_0xd9ce6e){return{'name':_0xd9ce6e[_0x4ba6('0x2d')],'type':_0xd9ce6e[_0x4ba6('0x2e')][_0x4ba6('0x2f')]};});_0x57a26e[_0x4ba6('0x30')]=_[_0x4ba6('0x2a')](_0x4e195b,_0x4ba6('0x28'));_0x57a26e[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x502021[_0x4ba6('0x31')]);_0x57a26e['filters']=_[_0x4ba6('0x33')](_0x57a26e['model'],_0x57a26e[_0x4ba6('0x31')]);_0x471217[_0x4ba6('0x34')]=_['intersection'](_0x57a26e[_0x4ba6('0x30')],qs['fields'](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x35')]));_0x471217[_0x4ba6('0x34')]=_0x471217[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x471217['attributes']:_0x57a26e[_0x4ba6('0x30')];if(!_0x502021[_0x4ba6('0x31')][_0x4ba6('0x37')](_0x4ba6('0x38'))){_0x471217[_0x4ba6('0x1c')]=qs[_0x4ba6('0x1c')](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x1c')]);_0x471217[_0x4ba6('0x1a')]=qs['offset'](_0x502021[_0x4ba6('0x31')][_0x4ba6('0x1a')]);}_0x471217[_0x4ba6('0x39')]=qs[_0x4ba6('0x3a')](_0x502021['query']['sort']);_0x471217[_0x4ba6('0x3b')]=qs[_0x4ba6('0x3c')](_['pick'](_0x502021['query'],_0x57a26e['filters']),_0x4e195b);if(_0x502021[_0x4ba6('0x31')][_0x4ba6('0x3d')]){_0x471217['where']=_['merge'](_0x471217[_0x4ba6('0x3b')],{'$or':_[_0x4ba6('0x2a')](_0x4e195b,function(_0x1b6a2c){if(_0x1b6a2c[_0x4ba6('0x2e')]!==_0x4ba6('0x3e')){var _0x4a2b45={};_0x4a2b45[_0x1b6a2c[_0x4ba6('0x28')]]={'$like':'%'+_0x502021[_0x4ba6('0x31')][_0x4ba6('0x3d')]+'%'};return _0x4a2b45;}})});}_0x471217=_[_0x4ba6('0x3f')]({},_0x471217,_0x502021[_0x4ba6('0x40')]);var _0x143ba3={'where':_0x471217['where']};return db[_0x4ba6('0x2b')]['count'](_0x143ba3)[_0x4ba6('0x25')](function(_0xd7eeb6){_0x4b1f67[_0x4ba6('0x1d')]=_0xd7eeb6;if(_0x502021[_0x4ba6('0x31')][_0x4ba6('0x41')]){_0x471217[_0x4ba6('0x42')]=[{'all':!![]}];}return db[_0x4ba6('0x2b')][_0x4ba6('0x43')](_0x471217);})[_0x4ba6('0x25')](function(_0x1d76d2){_0x4b1f67[_0x4ba6('0x44')]=_0x1d76d2;return _0x4b1f67;})[_0x4ba6('0x25')](respondWithFilteredResult(_0x2a295b,_0x471217))[_0x4ba6('0x45')](handleError(_0x2a295b,null));};exports[_0x4ba6('0x46')]=function(_0x32e903,_0x5c7aba){var _0x2b02ec={'raw':![],'where':{'id':_0x32e903[_0x4ba6('0x47')]['id']}},_0x4e6bcf={};_0x4e6bcf['model']=_[_0x4ba6('0x32')](db[_0x4ba6('0x2b')]['rawAttributes']);_0x4e6bcf[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x32e903[_0x4ba6('0x31')]);_0x4e6bcf[_0x4ba6('0x3c')]=_[_0x4ba6('0x33')](_0x4e6bcf[_0x4ba6('0x30')],_0x4e6bcf['query']);_0x2b02ec[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0x4e6bcf[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x32e903[_0x4ba6('0x31')][_0x4ba6('0x35')]));_0x2b02ec['attributes']=_0x2b02ec[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x2b02ec[_0x4ba6('0x34')]:_0x4e6bcf['model'];if(_0x32e903[_0x4ba6('0x31')][_0x4ba6('0x41')]){_0x2b02ec[_0x4ba6('0x42')]=[{'all':!![]}];}_0x2b02ec=_[_0x4ba6('0x3f')]({},_0x2b02ec,_0x32e903[_0x4ba6('0x40')]);return db[_0x4ba6('0x2b')][_0x4ba6('0x48')](_0x2b02ec)['then'](handleEntityNotFound(_0x5c7aba,null))['then'](respondWithResult(_0x5c7aba,null))[_0x4ba6('0x45')](handleError(_0x5c7aba,null));};exports[_0x4ba6('0x49')]=function(_0x1cff0a,_0x519fae){return db[_0x4ba6('0x2b')][_0x4ba6('0x49')](_0x1cff0a[_0x4ba6('0x4a')],{})['then'](respondWithResult(_0x519fae,0xc9))['catch'](handleError(_0x519fae,null));};exports['update']=function(_0x2e9390,_0x2eec3a){if(_0x2e9390['body']['id']){delete _0x2e9390[_0x4ba6('0x4a')]['id'];}return db['SalesforceConfiguration'][_0x4ba6('0x48')]({'where':{'id':_0x2e9390[_0x4ba6('0x47')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x2eec3a,null))[_0x4ba6('0x25')](saveUpdates(_0x2e9390[_0x4ba6('0x4a')],null))[_0x4ba6('0x25')](respondWithResult(_0x2eec3a,null))[_0x4ba6('0x45')](handleError(_0x2eec3a,null));};exports[_0x4ba6('0x24')]=function(_0x53c608,_0x5559e5){return db['SalesforceConfiguration'][_0x4ba6('0x48')]({'where':{'id':_0x53c608[_0x4ba6('0x47')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x5559e5,null))['then'](removeEntity(_0x5559e5,null))[_0x4ba6('0x45')](handleError(_0x5559e5,null));};exports[_0x4ba6('0x4b')]=function(_0x1de430,_0x3d3d2d,_0xbd35bf){var _0xa41a08={};var _0xb76e22={};var _0x5a9524;var _0x58c2b2;return db['SalesforceConfiguration'][_0x4ba6('0x4c')]({'where':{'id':_0x1de430['params']['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x3d3d2d,null))[_0x4ba6('0x25')](function(_0x27c6db){if(_0x27c6db){_0x5a9524=_0x27c6db;_0xb76e22['model']=_[_0x4ba6('0x32')](db['SalesforceField'][_0x4ba6('0x2c')]);_0xb76e22[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x1de430[_0x4ba6('0x31')]);_0xb76e22[_0x4ba6('0x3c')]=_['intersection'](_0xb76e22[_0x4ba6('0x30')],_0xb76e22[_0x4ba6('0x31')]);_0xa41a08[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0xb76e22[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x1de430[_0x4ba6('0x31')]['fields']));_0xa41a08[_0x4ba6('0x34')]=_0xa41a08['attributes'][_0x4ba6('0x36')]?_0xa41a08['attributes']:_0xb76e22['model'];_0xa41a08[_0x4ba6('0x39')]=qs['sort'](_0x1de430[_0x4ba6('0x31')][_0x4ba6('0x3a')]);_0xa41a08[_0x4ba6('0x3b')]=qs[_0x4ba6('0x3c')](_[_0x4ba6('0x4d')](_0x1de430['query'],_0xb76e22[_0x4ba6('0x3c')]));if(_0x1de430[_0x4ba6('0x31')][_0x4ba6('0x3d')]){_0xa41a08[_0x4ba6('0x3b')]=_[_0x4ba6('0x3f')](_0xa41a08[_0x4ba6('0x3b')],{'$or':_[_0x4ba6('0x2a')](_0xa41a08[_0x4ba6('0x34')],function(_0x110b47){var _0x2d9045={};_0x2d9045[_0x110b47]={'$like':'%'+_0x1de430['query'][_0x4ba6('0x3d')]+'%'};return _0x2d9045;})});}_0xa41a08=_['merge']({},_0xa41a08,_0x1de430[_0x4ba6('0x40')]);return _0x5a9524[_0x4ba6('0x4b')](_0xa41a08);}})[_0x4ba6('0x25')](function(_0x1f00c9){if(_0x1f00c9){_0x58c2b2=_0x1f00c9[_0x4ba6('0x36')];if(!_0x1de430[_0x4ba6('0x31')][_0x4ba6('0x37')]('nolimit')){_0xa41a08[_0x4ba6('0x1c')]=qs['limit'](_0x1de430[_0x4ba6('0x31')]['limit']);_0xa41a08[_0x4ba6('0x1a')]=qs[_0x4ba6('0x1a')](_0x1de430[_0x4ba6('0x31')]['offset']);}return _0x5a9524[_0x4ba6('0x4b')](_0xa41a08);}})[_0x4ba6('0x25')](function(_0x44355d){if(_0x44355d){return _0x44355d?{'count':_0x58c2b2,'rows':_0x44355d}:null;}})['then'](respondWithResult(_0x3d3d2d,null))[_0x4ba6('0x45')](handleError(_0x3d3d2d,null));};exports[_0x4ba6('0x4e')]=function(_0x2bd9e1,_0x217e0b,_0x256154){var _0x278dd5={};var _0xe77243={};var _0x5e98b5;var _0x78587e;return db[_0x4ba6('0x2b')][_0x4ba6('0x4c')]({'where':{'id':_0x2bd9e1['params']['id']}})['then'](handleEntityNotFound(_0x217e0b,null))[_0x4ba6('0x25')](function(_0x2b4e74){if(_0x2b4e74){_0x5e98b5=_0x2b4e74;_0xe77243[_0x4ba6('0x30')]=_[_0x4ba6('0x32')](db[_0x4ba6('0x4f')][_0x4ba6('0x2c')]);_0xe77243[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x2bd9e1[_0x4ba6('0x31')]);_0xe77243[_0x4ba6('0x3c')]=_[_0x4ba6('0x33')](_0xe77243[_0x4ba6('0x30')],_0xe77243[_0x4ba6('0x31')]);_0x278dd5[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0xe77243[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x2bd9e1['query'][_0x4ba6('0x35')]));_0x278dd5[_0x4ba6('0x34')]=_0x278dd5[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x278dd5['attributes']:_0xe77243[_0x4ba6('0x30')];_0x278dd5[_0x4ba6('0x39')]=qs['sort'](_0x2bd9e1[_0x4ba6('0x31')][_0x4ba6('0x3a')]);_0x278dd5['where']=qs[_0x4ba6('0x3c')](_['pick'](_0x2bd9e1['query'],_0xe77243['filters']));if(_0x2bd9e1['query'][_0x4ba6('0x3d')]){_0x278dd5[_0x4ba6('0x3b')]=_[_0x4ba6('0x3f')](_0x278dd5['where'],{'$or':_[_0x4ba6('0x2a')](_0x278dd5['attributes'],function(_0x44e5d5){var _0x161149={};_0x161149[_0x44e5d5]={'$like':'%'+_0x2bd9e1['query']['filter']+'%'};return _0x161149;})});}_0x278dd5=_[_0x4ba6('0x3f')]({},_0x278dd5,_0x2bd9e1[_0x4ba6('0x40')]);return _0x5e98b5[_0x4ba6('0x4e')](_0x278dd5);}})['then'](function(_0x546116){if(_0x546116){_0x78587e=_0x546116['length'];if(!_0x2bd9e1['query'][_0x4ba6('0x37')](_0x4ba6('0x38'))){_0x278dd5['limit']=qs['limit'](_0x2bd9e1[_0x4ba6('0x31')][_0x4ba6('0x1c')]);_0x278dd5[_0x4ba6('0x1a')]=qs[_0x4ba6('0x1a')](_0x2bd9e1['query'][_0x4ba6('0x1a')]);}return _0x5e98b5[_0x4ba6('0x4e')](_0x278dd5);}})['then'](function(_0x4f85bf){if(_0x4f85bf){return _0x4f85bf?{'count':_0x78587e,'rows':_0x4f85bf}:null;}})['then'](respondWithResult(_0x217e0b,null))[_0x4ba6('0x45')](handleError(_0x217e0b,null));};exports[_0x4ba6('0x50')]=function(_0x1d9e80,_0x2c6aad,_0x133bc5){var _0x14b291={};var _0xd8d7ec={};var _0x297724;var _0x37a6c4;return db[_0x4ba6('0x2b')][_0x4ba6('0x4c')]({'where':{'id':_0x1d9e80[_0x4ba6('0x47')]['id']}})[_0x4ba6('0x25')](handleEntityNotFound(_0x2c6aad,null))[_0x4ba6('0x25')](function(_0x4bac16){if(_0x4bac16){_0x297724=_0x4bac16;_0xd8d7ec['model']=_[_0x4ba6('0x32')](db[_0x4ba6('0x4f')][_0x4ba6('0x2c')]);_0xd8d7ec[_0x4ba6('0x31')]=_[_0x4ba6('0x32')](_0x1d9e80[_0x4ba6('0x31')]);_0xd8d7ec[_0x4ba6('0x3c')]=_['intersection'](_0xd8d7ec[_0x4ba6('0x30')],_0xd8d7ec['query']);_0x14b291[_0x4ba6('0x34')]=_[_0x4ba6('0x33')](_0xd8d7ec[_0x4ba6('0x30')],qs[_0x4ba6('0x35')](_0x1d9e80[_0x4ba6('0x31')][_0x4ba6('0x35')]));_0x14b291[_0x4ba6('0x34')]=_0x14b291[_0x4ba6('0x34')][_0x4ba6('0x36')]?_0x14b291[_0x4ba6('0x34')]:_0xd8d7ec[_0x4ba6('0x30')];_0x14b291[_0x4ba6('0x39')]=qs[_0x4ba6('0x3a')](_0x1d9e80[_0x4ba6('0x31')]['sort']);_0x14b291['where']=qs[_0x4ba6('0x3c')](_[_0x4ba6('0x4d')](_0x1d9e80['query'],_0xd8d7ec['filters']));if(_0x1d9e80[_0x4ba6('0x31')][_0x4ba6('0x3d')]){_0x14b291[_0x4ba6('0x3b')]=_['merge'](_0x14b291[_0x4ba6('0x3b')],{'$or':_[_0x4ba6('0x2a')](_0x14b291[_0x4ba6('0x34')],function(_0x1d30e7){var _0x124c71={};_0x124c71[_0x1d30e7]={'$like':'%'+_0x1d9e80[_0x4ba6('0x31')]['filter']+'%'};return _0x124c71;})});}_0x14b291=_[_0x4ba6('0x3f')]({},_0x14b291,_0x1d9e80[_0x4ba6('0x40')]);return _0x297724[_0x4ba6('0x50')](_0x14b291);}})[_0x4ba6('0x25')](function(_0x1cab07){if(_0x1cab07){_0x37a6c4=_0x1cab07[_0x4ba6('0x36')];if(!_0x1d9e80[_0x4ba6('0x31')]['hasOwnProperty']('nolimit')){_0x14b291[_0x4ba6('0x1c')]=qs[_0x4ba6('0x1c')](_0x1d9e80[_0x4ba6('0x31')][_0x4ba6('0x1c')]);_0x14b291[_0x4ba6('0x1a')]=qs[_0x4ba6('0x1a')](_0x1d9e80['query'][_0x4ba6('0x1a')]);}return _0x297724[_0x4ba6('0x50')](_0x14b291);}})[_0x4ba6('0x25')](function(_0x9fbae5){if(_0x9fbae5){return _0x9fbae5?{'count':_0x37a6c4,'rows':_0x9fbae5}:null;}})[_0x4ba6('0x25')](respondWithResult(_0x2c6aad,null))[_0x4ba6('0x45')](handleError(_0x2c6aad,null));};
\ No newline at end of file
index f9370a8..fa01f99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd90b=['../../config/environment','exports','define','int_salesforce_configurations','lodash','util','api','moment','path','rimraf'];(function(_0x1313f9,_0x37c37a){var _0x583c0d=function(_0x3299ea){while(--_0x3299ea){_0x1313f9['push'](_0x1313f9['shift']());}};_0x583c0d(++_0x37c37a);}(_0xd90b,0x144));var _0xbd90=function(_0xd9a584,_0x4da5e6){_0xd9a584=_0xd9a584-0x0;var _0xf2f541=_0xd90b[_0xd9a584];return _0xf2f541;};'use strict';var _=require(_0xbd90('0x0'));var util=require(_0xbd90('0x1'));var logger=require('../../config/logger')(_0xbd90('0x2'));var moment=require(_0xbd90('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd90('0x4'));var rimraf=require(_0xbd90('0x5'));var config=require(_0xbd90('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xbd90('0x7')]=function(_0x592113,_0x443806){return _0x592113[_0xbd90('0x8')]('SalesforceConfiguration',attributes,{'tableName':_0xbd90('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x5ad0=['exports','SalesforceConfiguration','int_salesforce_configurations','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes'];(function(_0x2b7764,_0x2606f1){var _0x848dcb=function(_0x1ae85b){while(--_0x1ae85b){_0x2b7764['push'](_0x2b7764['shift']());}};_0x848dcb(++_0x2606f1);}(_0x5ad0,0x12f));var _0x05ad=function(_0x4eb59e,_0x4746d9){_0x4eb59e=_0x4eb59e-0x0;var _0x473892=_0x5ad0[_0x4eb59e];return _0x473892;};'use strict';var _=require(_0x05ad('0x0'));var util=require(_0x05ad('0x1'));var logger=require(_0x05ad('0x2'))('api');var moment=require(_0x05ad('0x3'));var BPromise=require(_0x05ad('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x05ad('0x5'));var rimraf=require(_0x05ad('0x6'));var config=require(_0x05ad('0x7'));var attributes=require(_0x05ad('0x8'));module[_0x05ad('0x9')]=function(_0x311324,_0x3b1824){return _0x311324['define'](_0x05ad('0xa'),attributes,{'tableName':_0x05ad('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index bda396b..31485e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x083a=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug'];(function(_0x3eb331,_0x3fad53){var _0x4ac0af=function(_0xcf7093){while(--_0xcf7093){_0x3eb331['push'](_0x3eb331['shift']());}};_0x4ac0af(++_0x3fad53);}(_0x083a,0x118));var _0xa083=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x083a[_0x58afd5];return _0x3e503b;};'use strict';var _=require(_0xa083('0x0'));var util=require(_0xa083('0x1'));var moment=require(_0xa083('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa083('0x3'));var db=require(_0xa083('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa083('0x5'))(_0xa083('0x6'));var config=require(_0xa083('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa083('0x8')][_0xa083('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bffee,_0x124453,_0x1f3152){return new BPromise(function(_0x87b4b,_0x5e1739){return client['request'](_0x3bffee,_0x1f3152)[_0xa083('0xa')](function(_0x3f1a13){logger[_0xa083('0xb')](_0xa083('0xc'),_0x124453,'request\x20sent');logger[_0xa083('0xd')](_0xa083('0xe'),_0x124453,_0xa083('0xf'),JSON[_0xa083('0x10')](_0x3f1a13));if(_0x3f1a13[_0xa083('0x11')]){if(_0x3f1a13['error']['code']===0x1f4){logger[_0xa083('0x11')](_0xa083('0xc'),_0x124453,_0x3f1a13[_0xa083('0x11')][_0xa083('0x12')]);return _0x5e1739(_0x3f1a13[_0xa083('0x11')][_0xa083('0x12')]);}logger[_0xa083('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x124453,_0x3f1a13[_0xa083('0x11')][_0xa083('0x12')]);return _0x87b4b(_0x3f1a13['error'][_0xa083('0x12')]);}else{logger['info'](_0xa083('0xc'),_0x124453,'request\x20sent');_0x87b4b(_0x3f1a13[_0xa083('0x13')]['message']);}})[_0xa083('0x14')](function(_0x44ded0){logger[_0xa083('0x11')](_0xa083('0xc'),_0x124453,_0x44ded0);_0x5e1739(_0x44ded0);});});}
\ No newline at end of file
+var _0xdc7f=['rpc','../../config/environment','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1a014b,_0x48acae){var _0x462258=function(_0x1473be){while(--_0x1473be){_0x1a014b['push'](_0x1a014b['shift']());}};_0x462258(++_0x48acae);}(_0xdc7f,0x19c));var _0xfdc7=function(_0x25a19a,_0x536079){_0x25a19a=_0x25a19a-0x0;var _0x9d8a38=_0xdc7f[_0x25a19a];return _0x9d8a38;};'use strict';var _=require('lodash');var util=require(_0xfdc7('0x0'));var moment=require(_0xfdc7('0x1'));var BPromise=require(_0xfdc7('0x2'));var rs=require(_0xfdc7('0x3'));var fs=require('fs');var Redis=require(_0xfdc7('0x4'));var db=require(_0xfdc7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfdc7('0x6'));var config=require(_0xfdc7('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x586618,_0x213ea0,_0x259f5b){return new BPromise(function(_0x55b2d9,_0x244434){return client[_0xfdc7('0x8')](_0x586618,_0x259f5b)[_0xfdc7('0x9')](function(_0x55790e){logger[_0xfdc7('0xa')](_0xfdc7('0xb'),_0x213ea0,_0xfdc7('0xc'));logger['debug'](_0xfdc7('0xd'),_0x213ea0,_0xfdc7('0xc'),JSON[_0xfdc7('0xe')](_0x55790e));if(_0x55790e[_0xfdc7('0xf')]){if(_0x55790e['error'][_0xfdc7('0x10')]===0x1f4){logger['error'](_0xfdc7('0xb'),_0x213ea0,_0x55790e[_0xfdc7('0xf')][_0xfdc7('0x11')]);return _0x244434(_0x55790e[_0xfdc7('0xf')][_0xfdc7('0x11')]);}logger[_0xfdc7('0xf')](_0xfdc7('0xb'),_0x213ea0,_0x55790e['error']['message']);return _0x55b2d9(_0x55790e[_0xfdc7('0xf')][_0xfdc7('0x11')]);}else{logger[_0xfdc7('0xa')](_0xfdc7('0xb'),_0x213ea0,_0xfdc7('0xc'));_0x55b2d9(_0x55790e[_0xfdc7('0x12')][_0xfdc7('0x11')]);}})['catch'](function(_0x22ac9f){logger[_0xfdc7('0xf')](_0xfdc7('0xb'),_0x213ea0,_0x22ac9f);_0x244434(_0x22ac9f);});});}
\ No newline at end of file
index d308ac8..148587f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x397a=['post','create','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x5ab20a,_0x9677a0){var _0x2414c4=function(_0x4374ec){while(--_0x4374ec){_0x5ab20a['push'](_0x5ab20a['shift']());}};_0x2414c4(++_0x9677a0);}(_0x397a,0xd7));var _0xa397=function(_0x4810f7,_0x8d1c8a){_0x4810f7=_0x4810f7-0x0;var _0x31f387=_0x397a[_0x4810f7];return _0x31f387;};'use strict';var multer=require(_0xa397('0x0'));var util=require(_0xa397('0x1'));var path=require(_0xa397('0x2'));var timeout=require(_0xa397('0x3'));var express=require(_0xa397('0x4'));var router=express[_0xa397('0x5')]();var fs_extra=require(_0xa397('0x6'));var auth=require(_0xa397('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa397('0x8'));var controller=require('./intSalesforceField.controller');router[_0xa397('0x9')]('/',auth[_0xa397('0xa')](),controller[_0xa397('0xb')]);router['get']('/:id',auth[_0xa397('0xa')](),controller[_0xa397('0xc')]);router[_0xa397('0xd')]('/',auth['isAuthenticated'](),controller[_0xa397('0xe')]);router[_0xa397('0xf')](_0xa397('0x10'),auth[_0xa397('0xa')](),controller[_0xa397('0x11')]);router['delete'](_0xa397('0x10'),auth['isAuthenticated'](),controller[_0xa397('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0xf5e9=['destroy','multer','path','express','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','/:id','show','post','isAuthenticated','create','put','update'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xf5e9,0xc1));var _0x9f5e=function(_0x45b190,_0x6297da){_0x45b190=_0x45b190-0x0;var _0x46234d=_0xf5e9[_0x45b190];return _0x46234d;};'use strict';var multer=require(_0x9f5e('0x0'));var util=require('util');var path=require(_0x9f5e('0x1'));var timeout=require('connect-timeout');var express=require(_0x9f5e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9f5e('0x3'));var config=require(_0x9f5e('0x4'));var controller=require(_0x9f5e('0x5'));router[_0x9f5e('0x6')]('/',auth['isAuthenticated'](),controller[_0x9f5e('0x7')]);router[_0x9f5e('0x6')](_0x9f5e('0x8'),auth['isAuthenticated'](),controller[_0x9f5e('0x9')]);router[_0x9f5e('0xa')]('/',auth[_0x9f5e('0xb')](),controller[_0x9f5e('0xc')]);router[_0x9f5e('0xd')](_0x9f5e('0x8'),auth[_0x9f5e('0xb')](),controller[_0x9f5e('0xe')]);router['delete'](_0x9f5e('0x8'),auth['isAuthenticated'](),controller[_0x9f5e('0xf')]);module['exports']=router;
\ No newline at end of file
index 29d7164..1fa542a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x685d=['STRING','sequelize','exports','ENUM','string','customVariable','picklist','variable'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x685d,0x159));var _0xd685=function(_0x56e9ed,_0xa8b0ec){_0x56e9ed=_0x56e9ed-0x0;var _0x4fdcee=_0x685d[_0x56e9ed];return _0x4fdcee;};'use strict';var Sequelize=require(_0xd685('0x0'));module[_0xd685('0x1')]={'type':{'type':Sequelize[_0xd685('0x2')](_0xd685('0x3'),'variable',_0xd685('0x4'),'keyValue',_0xd685('0x5')),'defaultValue':_0xd685('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd685('0x2')](_0xd685('0x3'),_0xd685('0x6'),_0xd685('0x4'))},'keyContent':{'type':Sequelize[_0xd685('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xd685('0x7')]}};
\ No newline at end of file
+var _0xa62b=['keyValue','picklist','string','STRING','customVariable','sequelize','ENUM','variable'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xa62b,0xd5));var _0xba62=function(_0x28054d,_0x4ab7b0){_0x28054d=_0x28054d-0x0;var _0x57482f=_0xa62b[_0x28054d];return _0x57482f;};'use strict';var Sequelize=require(_0xba62('0x0'));module['exports']={'type':{'type':Sequelize[_0xba62('0x1')]('string',_0xba62('0x2'),'customVariable',_0xba62('0x3'),_0xba62('0x4')),'defaultValue':_0xba62('0x5')},'content':{'type':Sequelize[_0xba62('0x6')]},'key':{'type':Sequelize[_0xba62('0x6')]},'keyType':{'type':Sequelize[_0xba62('0x1')](_0xba62('0x5'),_0xba62('0x2'),_0xba62('0x7'))},'keyContent':{'type':Sequelize[_0xba62('0x6')]},'idField':{'type':Sequelize[_0xba62('0x6')]},'variableName':{'type':Sequelize[_0xba62('0x6')]}};
\ No newline at end of file
index 4dafbf0..6210230 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb2c=['include','findAll','rows','show','params','options','catch','body','find','destroy','eml-format','rimraf','fast-json-patch','moment','bluebird','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','reject','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','SalesforceField','includeAll'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xbb2c,0x94));var _0xcbb2=function(_0x2289b8,_0x428a32){_0x2289b8=_0x2289b8-0x0;var _0x257cb2=_0xbb2c[_0x2289b8];return _0x257cb2;};'use strict';var emlformat=require(_0xcbb2('0x0'));var rimraf=require(_0xcbb2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcbb2('0x2'));var rp=require('request-promise');var moment=require(_0xcbb2('0x3'));var BPromise=require(_0xcbb2('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcbb2('0x5'));var sox=require('sox');var csv=require(_0xcbb2('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcbb2('0x7'));var _=require(_0xcbb2('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcbb2('0x9'));var deskjs=require(_0xcbb2('0xa'));var toCsv=require(_0xcbb2('0x6'));var querystring=require(_0xcbb2('0xb'));var Papa=require(_0xcbb2('0xc'));var Redis=require(_0xcbb2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xcbb2('0xe'));var as=require(_0xcbb2('0xf'));var hardwareService=require(_0xcbb2('0x10'));var logger=require(_0xcbb2('0x11'))(_0xcbb2('0x12'));var utils=require(_0xcbb2('0x13'));var config=require(_0xcbb2('0x14'));var licenseUtil=require(_0xcbb2('0x15'));var db=require(_0xcbb2('0x16'))['db'];function respondWithStatusCode(_0x32ca53,_0x4331ce){_0x4331ce=_0x4331ce||0xcc;return function(_0x144089){if(_0x144089){return _0x32ca53['sendStatus'](_0x4331ce);}return _0x32ca53[_0xcbb2('0x17')](_0x4331ce)[_0xcbb2('0x18')]();};}function respondWithResult(_0x2de72e,_0x3472d1){_0x3472d1=_0x3472d1||0xc8;return function(_0x47f83d){if(_0x47f83d){return _0x2de72e['status'](_0x3472d1)[_0xcbb2('0x19')](_0x47f83d);}};}function respondWithFilteredResult(_0x4fc031,_0x131df4){return function(_0x359dd6){if(_0x359dd6){var _0x404849=typeof _0x131df4[_0xcbb2('0x1a')]===_0xcbb2('0x1b')&&typeof _0x131df4['limit']===_0xcbb2('0x1b');var _0x4fa744=_0x359dd6[_0xcbb2('0x1c')];var _0x233c3e=_0x404849?0x0:_0x131df4[_0xcbb2('0x1a')];var _0xec1bb5=_0x404849?_0x359dd6['count']:_0x131df4['offset']+_0x131df4['limit'];var _0x568794;if(_0xec1bb5>=_0x4fa744){_0xec1bb5=_0x4fa744;_0x568794=0xc8;}else{_0x568794=0xce;}_0x4fc031[_0xcbb2('0x17')](_0x568794);return _0x4fc031[_0xcbb2('0x1d')]('Content-Range',_0x233c3e+'-'+_0xec1bb5+'/'+_0x4fa744)[_0xcbb2('0x19')](_0x359dd6);}return null;};}function patchUpdates(_0x44f2d5){return function(_0x1ce4b0){try{jsonpatch['apply'](_0x1ce4b0,_0x44f2d5,!![]);}catch(_0x209c69){return BPromise[_0xcbb2('0x1e')](_0x209c69);}return _0x1ce4b0['save']();};}function saveUpdates(_0x4ff3d5,_0x5d7f71){return function(_0x5268a8){if(_0x5268a8){return _0x5268a8[_0xcbb2('0x1f')](_0x4ff3d5)[_0xcbb2('0x20')](function(_0x13dcd1){return _0x13dcd1;});}return null;};}function removeEntity(_0xf8d057,_0x30ec51){return function(_0x513dc9){if(_0x513dc9){return _0x513dc9['destroy']()[_0xcbb2('0x20')](function(){_0xf8d057[_0xcbb2('0x17')](0xcc)[_0xcbb2('0x18')]();});}};}function handleEntityNotFound(_0x321680,_0x41b226){return function(_0x895cf4){if(!_0x895cf4){_0x321680['sendStatus'](0x194);}return _0x895cf4;};}function handleError(_0x4f6d1a,_0x616613){_0x616613=_0x616613||0x1f4;return function(_0x271c37){logger[_0xcbb2('0x21')](_0x271c37['stack']);if(_0x271c37[_0xcbb2('0x22')]){delete _0x271c37['name'];}_0x4f6d1a[_0xcbb2('0x17')](_0x616613)[_0xcbb2('0x23')](_0x271c37);};}exports['index']=function(_0x4f3983,_0x25b2c5){var _0x5a372c={},_0x18a621={},_0x38f656={'count':0x0,'rows':[]};var _0x1e70f4=_[_0xcbb2('0x24')](db['SalesforceField'][_0xcbb2('0x25')],function(_0x297a3d){return{'name':_0x297a3d[_0xcbb2('0x26')],'type':_0x297a3d[_0xcbb2('0x27')][_0xcbb2('0x28')]};});_0x18a621[_0xcbb2('0x29')]=_[_0xcbb2('0x24')](_0x1e70f4,_0xcbb2('0x22'));_0x18a621[_0xcbb2('0x2a')]=_[_0xcbb2('0x2b')](_0x4f3983[_0xcbb2('0x2a')]);_0x18a621[_0xcbb2('0x2c')]=_[_0xcbb2('0x2d')](_0x18a621[_0xcbb2('0x29')],_0x18a621[_0xcbb2('0x2a')]);_0x5a372c[_0xcbb2('0x2e')]=_['intersection'](_0x18a621[_0xcbb2('0x29')],qs['fields'](_0x4f3983[_0xcbb2('0x2a')][_0xcbb2('0x2f')]));_0x5a372c[_0xcbb2('0x2e')]=_0x5a372c[_0xcbb2('0x2e')][_0xcbb2('0x30')]?_0x5a372c[_0xcbb2('0x2e')]:_0x18a621[_0xcbb2('0x29')];if(!_0x4f3983[_0xcbb2('0x2a')]['hasOwnProperty'](_0xcbb2('0x31'))){_0x5a372c[_0xcbb2('0x32')]=qs[_0xcbb2('0x32')](_0x4f3983['query'][_0xcbb2('0x32')]);_0x5a372c[_0xcbb2('0x1a')]=qs[_0xcbb2('0x1a')](_0x4f3983['query'][_0xcbb2('0x1a')]);}_0x5a372c['order']=qs['sort'](_0x4f3983[_0xcbb2('0x2a')][_0xcbb2('0x33')]);_0x5a372c[_0xcbb2('0x34')]=qs['filters'](_[_0xcbb2('0x35')](_0x4f3983[_0xcbb2('0x2a')],_0x18a621[_0xcbb2('0x2c')]),_0x1e70f4);if(_0x4f3983['query'][_0xcbb2('0x36')]){_0x5a372c[_0xcbb2('0x34')]=_[_0xcbb2('0x37')](_0x5a372c[_0xcbb2('0x34')],{'$or':_[_0xcbb2('0x24')](_0x1e70f4,function(_0x391984){if(_0x391984[_0xcbb2('0x27')]!==_0xcbb2('0x38')){var _0x273911={};_0x273911[_0x391984[_0xcbb2('0x22')]]={'$like':'%'+_0x4f3983[_0xcbb2('0x2a')][_0xcbb2('0x36')]+'%'};return _0x273911;}})});}_0x5a372c=_[_0xcbb2('0x37')]({},_0x5a372c,_0x4f3983['options']);var _0x5d4e8c={'where':_0x5a372c[_0xcbb2('0x34')]};return db[_0xcbb2('0x39')][_0xcbb2('0x1c')](_0x5d4e8c)['then'](function(_0x5431d6){_0x38f656[_0xcbb2('0x1c')]=_0x5431d6;if(_0x4f3983[_0xcbb2('0x2a')][_0xcbb2('0x3a')]){_0x5a372c[_0xcbb2('0x3b')]=[{'all':!![]}];}return db[_0xcbb2('0x39')][_0xcbb2('0x3c')](_0x5a372c);})[_0xcbb2('0x20')](function(_0x2ac4cb){_0x38f656[_0xcbb2('0x3d')]=_0x2ac4cb;return _0x38f656;})[_0xcbb2('0x20')](respondWithFilteredResult(_0x25b2c5,_0x5a372c))['catch'](handleError(_0x25b2c5,null));};exports[_0xcbb2('0x3e')]=function(_0x4259d7,_0x128f8b){var _0x21dbab={'raw':!![],'where':{'id':_0x4259d7[_0xcbb2('0x3f')]['id']}},_0x8a646d={};_0x8a646d[_0xcbb2('0x29')]=_['keys'](db['SalesforceField'][_0xcbb2('0x25')]);_0x8a646d[_0xcbb2('0x2a')]=_['keys'](_0x4259d7[_0xcbb2('0x2a')]);_0x8a646d['filters']=_['intersection'](_0x8a646d[_0xcbb2('0x29')],_0x8a646d[_0xcbb2('0x2a')]);_0x21dbab[_0xcbb2('0x2e')]=_[_0xcbb2('0x2d')](_0x8a646d[_0xcbb2('0x29')],qs['fields'](_0x4259d7[_0xcbb2('0x2a')]['fields']));_0x21dbab['attributes']=_0x21dbab['attributes']['length']?_0x21dbab[_0xcbb2('0x2e')]:_0x8a646d['model'];if(_0x4259d7['query'][_0xcbb2('0x3a')]){_0x21dbab[_0xcbb2('0x3b')]=[{'all':!![]}];}_0x21dbab=_[_0xcbb2('0x37')]({},_0x21dbab,_0x4259d7[_0xcbb2('0x40')]);return db[_0xcbb2('0x39')]['find'](_0x21dbab)['then'](handleEntityNotFound(_0x128f8b,null))[_0xcbb2('0x20')](respondWithResult(_0x128f8b,null))[_0xcbb2('0x41')](handleError(_0x128f8b,null));};exports['create']=function(_0x3d5ef3,_0x1116d3){return db[_0xcbb2('0x39')]['create'](_0x3d5ef3[_0xcbb2('0x42')],{})[_0xcbb2('0x20')](respondWithResult(_0x1116d3,0xc9))[_0xcbb2('0x41')](handleError(_0x1116d3,null));};exports[_0xcbb2('0x1f')]=function(_0x341c15,_0x54535a){if(_0x341c15[_0xcbb2('0x42')]['id']){delete _0x341c15['body']['id'];}return db['SalesforceField'][_0xcbb2('0x43')]({'where':{'id':_0x341c15[_0xcbb2('0x3f')]['id']}})[_0xcbb2('0x20')](handleEntityNotFound(_0x54535a,null))['then'](saveUpdates(_0x341c15[_0xcbb2('0x42')],null))[_0xcbb2('0x20')](respondWithResult(_0x54535a,null))[_0xcbb2('0x41')](handleError(_0x54535a,null));};exports[_0xcbb2('0x44')]=function(_0x3523b1,_0x5d3c18){return db[_0xcbb2('0x39')][_0xcbb2('0x43')]({'where':{'id':_0x3523b1['params']['id']}})[_0xcbb2('0x20')](handleEntityNotFound(_0x5d3c18,null))['then'](removeEntity(_0x5d3c18,null))[_0xcbb2('0x41')](handleError(_0x5d3c18,null));};
\ No newline at end of file
+var _0xd61c=['model','keys','filters','intersection','attributes','query','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','index','map','SalesforceField','rawAttributes','key'];(function(_0x2fcf7f,_0x13024f){var _0x2678eb=function(_0x48fa2f){while(--_0x48fa2f){_0x2fcf7f['push'](_0x2fcf7f['shift']());}};_0x2678eb(++_0x13024f);}(_0xd61c,0xb1));var _0xcd61=function(_0x5b3361,_0x369662){_0x5b3361=_0x5b3361-0x0;var _0x22a2b3=_0xd61c[_0x5b3361];return _0x22a2b3;};'use strict';var emlformat=require(_0xcd61('0x0'));var rimraf=require(_0xcd61('0x1'));var zipdir=require(_0xcd61('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcd61('0x3'));var moment=require('moment');var BPromise=require(_0xcd61('0x4'));var Mustache=require(_0xcd61('0x5'));var util=require(_0xcd61('0x6'));var path=require(_0xcd61('0x7'));var sox=require(_0xcd61('0x8'));var csv=require(_0xcd61('0x9'));var ejs=require(_0xcd61('0xa'));var fs=require('fs');var fs_extra=require(_0xcd61('0xb'));var _=require(_0xcd61('0xc'));var squel=require(_0xcd61('0xd'));var crypto=require('crypto');var jsforce=require(_0xcd61('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcd61('0x9'));var querystring=require(_0xcd61('0xf'));var Papa=require(_0xcd61('0x10'));var Redis=require('ioredis');var authService=require(_0xcd61('0x11'));var qs=require(_0xcd61('0x12'));var as=require(_0xcd61('0x13'));var hardwareService=require(_0xcd61('0x14'));var logger=require(_0xcd61('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xcd61('0x16'));var licenseUtil=require(_0xcd61('0x17'));var db=require(_0xcd61('0x18'))['db'];function respondWithStatusCode(_0x4c1f7f,_0xb6d8d9){_0xb6d8d9=_0xb6d8d9||0xcc;return function(_0x48ba0c){if(_0x48ba0c){return _0x4c1f7f['sendStatus'](_0xb6d8d9);}return _0x4c1f7f['status'](_0xb6d8d9)[_0xcd61('0x19')]();};}function respondWithResult(_0x36aa69,_0x14674c){_0x14674c=_0x14674c||0xc8;return function(_0x2d438d){if(_0x2d438d){return _0x36aa69[_0xcd61('0x1a')](_0x14674c)[_0xcd61('0x1b')](_0x2d438d);}};}function respondWithFilteredResult(_0xa30220,_0x11d8ed){return function(_0x3c2f0c){if(_0x3c2f0c){var _0x45933e=typeof _0x11d8ed[_0xcd61('0x1c')]===_0xcd61('0x1d')&&typeof _0x11d8ed[_0xcd61('0x1e')]===_0xcd61('0x1d');var _0x589c8b=_0x3c2f0c[_0xcd61('0x1f')];var _0x23d042=_0x45933e?0x0:_0x11d8ed[_0xcd61('0x1c')];var _0x3ee36b=_0x45933e?_0x3c2f0c[_0xcd61('0x1f')]:_0x11d8ed['offset']+_0x11d8ed[_0xcd61('0x1e')];var _0x4ebfd6;if(_0x3ee36b>=_0x589c8b){_0x3ee36b=_0x589c8b;_0x4ebfd6=0xc8;}else{_0x4ebfd6=0xce;}_0xa30220[_0xcd61('0x1a')](_0x4ebfd6);return _0xa30220[_0xcd61('0x20')](_0xcd61('0x21'),_0x23d042+'-'+_0x3ee36b+'/'+_0x589c8b)['json'](_0x3c2f0c);}return null;};}function patchUpdates(_0x312c03){return function(_0x585fd3){try{jsonpatch[_0xcd61('0x22')](_0x585fd3,_0x312c03,!![]);}catch(_0x4b8914){return BPromise[_0xcd61('0x23')](_0x4b8914);}return _0x585fd3[_0xcd61('0x24')]();};}function saveUpdates(_0xe330d8,_0x13b86e){return function(_0x4f2409){if(_0x4f2409){return _0x4f2409['update'](_0xe330d8)[_0xcd61('0x25')](function(_0x5c52c5){return _0x5c52c5;});}return null;};}function removeEntity(_0x5b9cac,_0x2c9774){return function(_0x30b37d){if(_0x30b37d){return _0x30b37d[_0xcd61('0x26')]()[_0xcd61('0x25')](function(){_0x5b9cac[_0xcd61('0x1a')](0xcc)[_0xcd61('0x19')]();});}};}function handleEntityNotFound(_0x2ed1d3,_0x363689){return function(_0x426f5c){if(!_0x426f5c){_0x2ed1d3[_0xcd61('0x27')](0x194);}return _0x426f5c;};}function handleError(_0x3b4073,_0x2d81b6){_0x2d81b6=_0x2d81b6||0x1f4;return function(_0x1a0d82){logger[_0xcd61('0x28')](_0x1a0d82[_0xcd61('0x29')]);if(_0x1a0d82[_0xcd61('0x2a')]){delete _0x1a0d82[_0xcd61('0x2a')];}_0x3b4073[_0xcd61('0x1a')](_0x2d81b6)['send'](_0x1a0d82);};}exports[_0xcd61('0x2b')]=function(_0x418ece,_0x2e525b){var _0x504206={},_0x5a849b={},_0x96d4ff={'count':0x0,'rows':[]};var _0x4363a7=_[_0xcd61('0x2c')](db[_0xcd61('0x2d')][_0xcd61('0x2e')],function(_0x547e59){return{'name':_0x547e59['fieldName'],'type':_0x547e59['type'][_0xcd61('0x2f')]};});_0x5a849b[_0xcd61('0x30')]=_[_0xcd61('0x2c')](_0x4363a7,_0xcd61('0x2a'));_0x5a849b['query']=_[_0xcd61('0x31')](_0x418ece['query']);_0x5a849b[_0xcd61('0x32')]=_[_0xcd61('0x33')](_0x5a849b[_0xcd61('0x30')],_0x5a849b['query']);_0x504206[_0xcd61('0x34')]=_[_0xcd61('0x33')](_0x5a849b[_0xcd61('0x30')],qs['fields'](_0x418ece[_0xcd61('0x35')][_0xcd61('0x36')]));_0x504206[_0xcd61('0x34')]=_0x504206[_0xcd61('0x34')][_0xcd61('0x37')]?_0x504206['attributes']:_0x5a849b['model'];if(!_0x418ece['query']['hasOwnProperty'](_0xcd61('0x38'))){_0x504206[_0xcd61('0x1e')]=qs[_0xcd61('0x1e')](_0x418ece['query'][_0xcd61('0x1e')]);_0x504206['offset']=qs['offset'](_0x418ece['query']['offset']);}_0x504206[_0xcd61('0x39')]=qs[_0xcd61('0x3a')](_0x418ece['query'][_0xcd61('0x3a')]);_0x504206[_0xcd61('0x3b')]=qs[_0xcd61('0x32')](_['pick'](_0x418ece['query'],_0x5a849b[_0xcd61('0x32')]),_0x4363a7);if(_0x418ece[_0xcd61('0x35')][_0xcd61('0x3c')]){_0x504206[_0xcd61('0x3b')]=_[_0xcd61('0x3d')](_0x504206[_0xcd61('0x3b')],{'$or':_[_0xcd61('0x2c')](_0x4363a7,function(_0x474095){if(_0x474095[_0xcd61('0x3e')]!==_0xcd61('0x3f')){var _0x5b663f={};_0x5b663f[_0x474095[_0xcd61('0x2a')]]={'$like':'%'+_0x418ece[_0xcd61('0x35')][_0xcd61('0x3c')]+'%'};return _0x5b663f;}})});}_0x504206=_[_0xcd61('0x3d')]({},_0x504206,_0x418ece[_0xcd61('0x40')]);var _0x2beb26={'where':_0x504206[_0xcd61('0x3b')]};return db[_0xcd61('0x2d')]['count'](_0x2beb26)[_0xcd61('0x25')](function(_0x48f2a4){_0x96d4ff[_0xcd61('0x1f')]=_0x48f2a4;if(_0x418ece[_0xcd61('0x35')][_0xcd61('0x41')]){_0x504206[_0xcd61('0x42')]=[{'all':!![]}];}return db[_0xcd61('0x2d')]['findAll'](_0x504206);})['then'](function(_0x436ece){_0x96d4ff[_0xcd61('0x43')]=_0x436ece;return _0x96d4ff;})[_0xcd61('0x25')](respondWithFilteredResult(_0x2e525b,_0x504206))[_0xcd61('0x44')](handleError(_0x2e525b,null));};exports[_0xcd61('0x45')]=function(_0x41287c,_0x144b56){var _0x5af86c={'raw':!![],'where':{'id':_0x41287c[_0xcd61('0x46')]['id']}},_0x39e1ef={};_0x39e1ef[_0xcd61('0x30')]=_[_0xcd61('0x31')](db['SalesforceField'][_0xcd61('0x2e')]);_0x39e1ef['query']=_[_0xcd61('0x31')](_0x41287c['query']);_0x39e1ef[_0xcd61('0x32')]=_[_0xcd61('0x33')](_0x39e1ef['model'],_0x39e1ef[_0xcd61('0x35')]);_0x5af86c[_0xcd61('0x34')]=_[_0xcd61('0x33')](_0x39e1ef[_0xcd61('0x30')],qs[_0xcd61('0x36')](_0x41287c[_0xcd61('0x35')][_0xcd61('0x36')]));_0x5af86c[_0xcd61('0x34')]=_0x5af86c[_0xcd61('0x34')][_0xcd61('0x37')]?_0x5af86c[_0xcd61('0x34')]:_0x39e1ef[_0xcd61('0x30')];if(_0x41287c[_0xcd61('0x35')][_0xcd61('0x41')]){_0x5af86c[_0xcd61('0x42')]=[{'all':!![]}];}_0x5af86c=_[_0xcd61('0x3d')]({},_0x5af86c,_0x41287c[_0xcd61('0x40')]);return db['SalesforceField'][_0xcd61('0x47')](_0x5af86c)['then'](handleEntityNotFound(_0x144b56,null))[_0xcd61('0x25')](respondWithResult(_0x144b56,null))[_0xcd61('0x44')](handleError(_0x144b56,null));};exports[_0xcd61('0x48')]=function(_0x15936e,_0xa710e0){return db[_0xcd61('0x2d')][_0xcd61('0x48')](_0x15936e[_0xcd61('0x49')],{})[_0xcd61('0x25')](respondWithResult(_0xa710e0,0xc9))[_0xcd61('0x44')](handleError(_0xa710e0,null));};exports[_0xcd61('0x4a')]=function(_0x446a1e,_0x2d1b25){if(_0x446a1e[_0xcd61('0x49')]['id']){delete _0x446a1e[_0xcd61('0x49')]['id'];}return db[_0xcd61('0x2d')][_0xcd61('0x47')]({'where':{'id':_0x446a1e[_0xcd61('0x46')]['id']}})[_0xcd61('0x25')](handleEntityNotFound(_0x2d1b25,null))['then'](saveUpdates(_0x446a1e[_0xcd61('0x49')],null))[_0xcd61('0x25')](respondWithResult(_0x2d1b25,null))[_0xcd61('0x44')](handleError(_0x2d1b25,null));};exports[_0xcd61('0x26')]=function(_0x346723,_0x1805f4){return db[_0xcd61('0x2d')][_0xcd61('0x47')]({'where':{'id':_0x346723['params']['id']}})[_0xcd61('0x25')](handleEntityNotFound(_0x1805f4,null))[_0xcd61('0x25')](removeEntity(_0x1805f4,null))[_0xcd61('0x44')](handleError(_0x1805f4,null));};
\ No newline at end of file
index 96c65cc..ca7be68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x20d9=['moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x2803d1,_0x4e6d0d){var _0x990e12=function(_0x1913a4){while(--_0x1913a4){_0x2803d1['push'](_0x2803d1['shift']());}};_0x990e12(++_0x4e6d0d);}(_0x20d9,0x193));var _0x920d=function(_0x3c61ab,_0x4f5ac3){_0x3c61ab=_0x3c61ab-0x0;var _0x406218=_0x20d9[_0x3c61ab];return _0x406218;};'use strict';var _=require('lodash');var util=require(_0x920d('0x0'));var logger=require(_0x920d('0x1'))(_0x920d('0x2'));var moment=require(_0x920d('0x3'));var BPromise=require(_0x920d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x920d('0x5'));var rimraf=require(_0x920d('0x6'));var config=require(_0x920d('0x7'));var attributes=require(_0x920d('0x8'));module['exports']=function(_0xf7471f,_0x1ec893){return _0xf7471f[_0x920d('0x9')]('SalesforceField',attributes,{'tableName':_0x920d('0xa'),'paranoid':![],'indexes':[{'name':_0x920d('0xb'),'fields':[_0x920d('0xc'),_0x920d('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xc77a=['api','./intSalesforceField.attributes','exports','define','SalesforceField','salesforce_unique_index','FieldId','util','../../config/logger'];(function(_0xc31f04,_0x165cac){var _0x2cde7b=function(_0x4373b1){while(--_0x4373b1){_0xc31f04['push'](_0xc31f04['shift']());}};_0x2cde7b(++_0x165cac);}(_0xc77a,0xd6));var _0xac77=function(_0x3c5cc7,_0x447374){_0x3c5cc7=_0x3c5cc7-0x0;var _0x2aef2a=_0xc77a[_0x3c5cc7];return _0x2aef2a;};'use strict';var _=require('lodash');var util=require(_0xac77('0x0'));var logger=require(_0xac77('0x1'))(_0xac77('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xac77('0x3'));module[_0xac77('0x4')]=function(_0x5b53a5,_0x10eb4c){return _0x5b53a5[_0xac77('0x5')](_0xac77('0x6'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xac77('0x7'),'fields':['idField',_0xac77('0x8')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 3285c7f..861e0d3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25de=['result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x402dd0,_0x5077ec){var _0x505845=function(_0x2d7665){while(--_0x2d7665){_0x402dd0['push'](_0x402dd0['shift']());}};_0x505845(++_0x5077ec);}(_0x25de,0x15b));var _0xe25d=function(_0x4392af,_0xec5afe){_0x4392af=_0x4392af-0x0;var _0x9fa8eb=_0x25de[_0x4392af];return _0x9fa8eb;};'use strict';var _=require(_0xe25d('0x0'));var util=require(_0xe25d('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe25d('0x2'));var db=require(_0xe25d('0x3'))['db'];var utils=require(_0xe25d('0x4'));var logger=require(_0xe25d('0x5'))(_0xe25d('0x6'));var config=require(_0xe25d('0x7'));var jayson=require(_0xe25d('0x8'));var client=jayson['client'][_0xe25d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x56de8f,_0xd350a2,_0xb9d25d){return new BPromise(function(_0x53531d,_0x41706f){return client[_0xe25d('0xa')](_0x56de8f,_0xb9d25d)[_0xe25d('0xb')](function(_0x3fb24e){logger[_0xe25d('0xc')](_0xe25d('0xd'),_0xd350a2,_0xe25d('0xe'));logger[_0xe25d('0xf')](_0xe25d('0x10'),_0xd350a2,'request\x20sent',JSON[_0xe25d('0x11')](_0x3fb24e));if(_0x3fb24e[_0xe25d('0x12')]){if(_0x3fb24e['error'][_0xe25d('0x13')]===0x1f4){logger[_0xe25d('0x12')](_0xe25d('0xd'),_0xd350a2,_0x3fb24e[_0xe25d('0x12')][_0xe25d('0x14')]);return _0x41706f(_0x3fb24e[_0xe25d('0x12')]['message']);}logger[_0xe25d('0x12')]('SalesforceField,\x20%s,\x20%s',_0xd350a2,_0x3fb24e['error'][_0xe25d('0x14')]);return _0x53531d(_0x3fb24e[_0xe25d('0x12')][_0xe25d('0x14')]);}else{logger['info'](_0xe25d('0xd'),_0xd350a2,'request\x20sent');_0x53531d(_0x3fb24e[_0xe25d('0x15')][_0xe25d('0x14')]);}})[_0xe25d('0x16')](function(_0x1eda5e){logger['error'](_0xe25d('0xd'),_0xd350a2,_0x1eda5e);_0x41706f(_0x1eda5e);});});}
\ No newline at end of file
+var _0x5eef=['info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then'];(function(_0x4024f4,_0x44c360){var _0x137ded=function(_0x5b680e){while(--_0x5b680e){_0x4024f4['push'](_0x4024f4['shift']());}};_0x137ded(++_0x44c360);}(_0x5eef,0x1a3));var _0xf5ee=function(_0x3bc50a,_0x4d881b){_0x3bc50a=_0x3bc50a-0x0;var _0x441d84=_0x5eef[_0x3bc50a];return _0x441d84;};'use strict';var _=require(_0xf5ee('0x0'));var util=require(_0xf5ee('0x1'));var moment=require(_0xf5ee('0x2'));var BPromise=require(_0xf5ee('0x3'));var rs=require(_0xf5ee('0x4'));var fs=require('fs');var Redis=require(_0xf5ee('0x5'));var db=require(_0xf5ee('0x6'))['db'];var utils=require(_0xf5ee('0x7'));var logger=require('../../config/logger')(_0xf5ee('0x8'));var config=require(_0xf5ee('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf5ee('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34f26f,_0xcd7704,_0x571629){return new BPromise(function(_0x32253e,_0x509175){return client[_0xf5ee('0xb')](_0x34f26f,_0x571629)[_0xf5ee('0xc')](function(_0x3e8062){logger[_0xf5ee('0xd')](_0xf5ee('0xe'),_0xcd7704,_0xf5ee('0xf'));logger[_0xf5ee('0x10')](_0xf5ee('0x11'),_0xcd7704,_0xf5ee('0xf'),JSON[_0xf5ee('0x12')](_0x3e8062));if(_0x3e8062[_0xf5ee('0x13')]){if(_0x3e8062[_0xf5ee('0x13')][_0xf5ee('0x14')]===0x1f4){logger[_0xf5ee('0x13')](_0xf5ee('0xe'),_0xcd7704,_0x3e8062[_0xf5ee('0x13')][_0xf5ee('0x15')]);return _0x509175(_0x3e8062[_0xf5ee('0x13')][_0xf5ee('0x15')]);}logger[_0xf5ee('0x13')](_0xf5ee('0xe'),_0xcd7704,_0x3e8062[_0xf5ee('0x13')]['message']);return _0x32253e(_0x3e8062[_0xf5ee('0x13')][_0xf5ee('0x15')]);}else{logger['info'](_0xf5ee('0xe'),_0xcd7704,_0xf5ee('0xf'));_0x32253e(_0x3e8062[_0xf5ee('0x16')]['message']);}})[_0xf5ee('0x17')](function(_0x555f24){logger['error'](_0xf5ee('0xe'),_0xcd7704,_0x555f24);_0x509175(_0x555f24);});});}
\ No newline at end of file
index 2c56609..a540362 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d73=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x7d73,0xe3));var _0x37d7=function(_0x58efa6,_0x2c00bd){_0x58efa6=_0x58efa6-0x0;var _0x5d643c=_0x7d73[_0x58efa6];return _0x5d643c;};'use strict';var multer=require(_0x37d7('0x0'));var util=require(_0x37d7('0x1'));var path=require(_0x37d7('0x2'));var timeout=require(_0x37d7('0x3'));var express=require(_0x37d7('0x4'));var router=express[_0x37d7('0x5')]();var fs_extra=require(_0x37d7('0x6'));var auth=require(_0x37d7('0x7'));var interaction=require(_0x37d7('0x8'));var config=require(_0x37d7('0x9'));var controller=require(_0x37d7('0xa'));router[_0x37d7('0xb')]('/',auth[_0x37d7('0xc')](),controller['index']);router[_0x37d7('0xb')](_0x37d7('0xd'),auth[_0x37d7('0xc')](),controller[_0x37d7('0xe')]);router['get'](_0x37d7('0xf'),auth['isAuthenticated'](),controller[_0x37d7('0x10')]);router['get'](_0x37d7('0x11'),auth[_0x37d7('0xc')](),controller[_0x37d7('0x12')]);router[_0x37d7('0x13')]('/',auth['isAuthenticated'](),controller[_0x37d7('0x14')]);router['post'](_0x37d7('0xf'),auth[_0x37d7('0xc')](),controller['addConfiguration']);router[_0x37d7('0x15')](_0x37d7('0xd'),auth['isAuthenticated'](),controller[_0x37d7('0x16')]);router[_0x37d7('0x17')](_0x37d7('0xd'),auth['isAuthenticated'](),controller[_0x37d7('0x18')]);module[_0x37d7('0x19')]=router;
\ No newline at end of file
+var _0x4e14=['isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','/:id'];(function(_0x107a68,_0x184059){var _0x488994=function(_0x4d25c6){while(--_0x4d25c6){_0x107a68['push'](_0x107a68['shift']());}};_0x488994(++_0x184059);}(_0x4e14,0x10c));var _0x44e1=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4e14[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x44e1('0x0'));var util=require(_0x44e1('0x1'));var path=require(_0x44e1('0x2'));var timeout=require(_0x44e1('0x3'));var express=require(_0x44e1('0x4'));var router=express[_0x44e1('0x5')]();var fs_extra=require(_0x44e1('0x6'));var auth=require(_0x44e1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x44e1('0x8'));var controller=require(_0x44e1('0x9'));router[_0x44e1('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x44e1('0xa')](_0x44e1('0xb'),auth[_0x44e1('0xc')](),controller['show']);router[_0x44e1('0xa')](_0x44e1('0xd'),auth[_0x44e1('0xc')](),controller[_0x44e1('0xe')]);router[_0x44e1('0xa')]('/:id/fields',auth[_0x44e1('0xc')](),controller[_0x44e1('0xf')]);router[_0x44e1('0x10')]('/',auth[_0x44e1('0xc')](),controller[_0x44e1('0x11')]);router[_0x44e1('0x10')](_0x44e1('0xd'),auth[_0x44e1('0xc')](),controller['addConfiguration']);router['put'](_0x44e1('0xb'),auth[_0x44e1('0xc')](),controller['update']);router[_0x44e1('0x12')](_0x44e1('0xb'),auth[_0x44e1('0xc')](),controller[_0x44e1('0x13')]);module['exports']=router;
\ No newline at end of file
index 0169d0c..2847f81 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc251=['STRING','username','remoteUri','sequelize','exports'];(function(_0x1a72f3,_0x217011){var _0x57ef47=function(_0x20123d){while(--_0x20123d){_0x1a72f3['push'](_0x1a72f3['shift']());}};_0x57ef47(++_0x217011);}(_0xc251,0xd0));var _0x1c25=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xc251[_0xbd08b4];return _0x314f1e;};'use strict';var Sequelize=require(_0x1c25('0x0'));module[_0x1c25('0x1')]={'name':{'type':Sequelize[_0x1c25('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1c25('0x2')],'unique':_0x1c25('0x3')},'password':{'type':Sequelize[_0x1c25('0x2')]},'email':{'type':Sequelize[_0x1c25('0x2')]},'remoteUri':{'type':Sequelize[_0x1c25('0x2')],'unique':_0x1c25('0x4')},'serverUrl':{'type':Sequelize[_0x1c25('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x45a7=['remoteUri','sequelize','exports','STRING','username'];(function(_0xeb0459,_0x5d9b1c){var _0x431bd2=function(_0x65ca08){while(--_0x65ca08){_0xeb0459['push'](_0xeb0459['shift']());}};_0x431bd2(++_0x5d9b1c);}(_0x45a7,0x173));var _0x745a=function(_0x5869f5,_0x176fd5){_0x5869f5=_0x5869f5-0x0;var _0x6beba1=_0x45a7[_0x5869f5];return _0x6beba1;};'use strict';var Sequelize=require(_0x745a('0x0'));module[_0x745a('0x1')]={'name':{'type':Sequelize[_0x745a('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x745a('0x2')],'unique':_0x745a('0x3')},'password':{'type':Sequelize[_0x745a('0x2')]},'email':{'type':Sequelize[_0x745a('0x2')]},'remoteUri':{'type':Sequelize[_0x745a('0x2')],'unique':_0x745a('0x4')},'serverUrl':{'type':Sequelize[_0x745a('0x2')],'allowNull':![]}};
\ No newline at end of file
index b40942a..ddedf7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49e8=['Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','notify','incident_state','category','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','group_list','work_end','resolved_at','approval_set','work_notes','short_description','close_code','delivery_task','work_start','assignment_group','additional_assignee_list','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','company','activity_due','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','rimraf','zip-dir','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','order','sort','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','params','create','body','find','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel'];(function(_0x259cae,_0x41b1aa){var _0x2e0ea9=function(_0x618881){while(--_0x618881){_0x259cae['push'](_0x259cae['shift']());}};_0x2e0ea9(++_0x41b1aa);}(_0x49e8,0x128));var _0x849e=function(_0x35116d,_0x30c8c7){_0x35116d=_0x35116d-0x0;var _0x16b2ab=_0x49e8[_0x35116d];return _0x16b2ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x849e('0x0'));var zipdir=require(_0x849e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x849e('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x849e('0x3'));var path=require(_0x849e('0x4'));var sox=require('sox');var csv=require(_0x849e('0x5'));var ejs=require(_0x849e('0x6'));var fs=require('fs');var fs_extra=require(_0x849e('0x7'));var _=require(_0x849e('0x8'));var squel=require(_0x849e('0x9'));var crypto=require(_0x849e('0xa'));var jsforce=require(_0x849e('0xb'));var deskjs=require(_0x849e('0xc'));var toCsv=require(_0x849e('0x5'));var querystring=require(_0x849e('0xd'));var Papa=require(_0x849e('0xe'));var Redis=require(_0x849e('0xf'));var authService=require(_0x849e('0x10'));var qs=require(_0x849e('0x11'));var as=require(_0x849e('0x12'));var hardwareService=require(_0x849e('0x13'));var logger=require(_0x849e('0x14'))(_0x849e('0x15'));var utils=require(_0x849e('0x16'));var config=require(_0x849e('0x17'));var licenseUtil=require(_0x849e('0x18'));var db=require(_0x849e('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3aeaf7,_0x4bfac4){_0x4bfac4=_0x4bfac4||0xcc;return function(_0x385aea){if(_0x385aea){return _0x3aeaf7['sendStatus'](_0x4bfac4);}return _0x3aeaf7[_0x849e('0x1a')](_0x4bfac4)[_0x849e('0x1b')]();};}function respondWithResult(_0x283b75,_0x47a119){_0x47a119=_0x47a119||0xc8;return function(_0x4afba0){if(_0x4afba0){return _0x283b75[_0x849e('0x1a')](_0x47a119)[_0x849e('0x1c')](_0x4afba0);}};}function respondWithFilteredResult(_0x18abee,_0x17be66){return function(_0x156551){if(_0x156551){var _0x18de7f=typeof _0x17be66[_0x849e('0x1d')]===_0x849e('0x1e')&&typeof _0x17be66[_0x849e('0x1f')]===_0x849e('0x1e');var _0x187dc0=_0x156551['count'];var _0x3110f6=_0x18de7f?0x0:_0x17be66[_0x849e('0x1d')];var _0x201f07=_0x18de7f?_0x156551['count']:_0x17be66[_0x849e('0x1d')]+_0x17be66[_0x849e('0x1f')];var _0x2a6268;if(_0x201f07>=_0x187dc0){_0x201f07=_0x187dc0;_0x2a6268=0xc8;}else{_0x2a6268=0xce;}_0x18abee['status'](_0x2a6268);return _0x18abee['set'](_0x849e('0x20'),_0x3110f6+'-'+_0x201f07+'/'+_0x187dc0)[_0x849e('0x1c')](_0x156551);}return null;};}function patchUpdates(_0x13fabd){return function(_0x575eca){try{jsonpatch[_0x849e('0x21')](_0x575eca,_0x13fabd,!![]);}catch(_0x45ac26){return BPromise[_0x849e('0x22')](_0x45ac26);}return _0x575eca[_0x849e('0x23')]();};}function saveUpdates(_0x216eef,_0x414dc3){return function(_0x26c463){if(_0x26c463){return _0x26c463[_0x849e('0x24')](_0x216eef)[_0x849e('0x25')](function(_0xdf6676){return _0xdf6676;});}return null;};}function removeEntity(_0x5c2b63,_0xd871ba){return function(_0xfd1eb4){if(_0xfd1eb4){return _0xfd1eb4['destroy']()[_0x849e('0x25')](function(){_0x5c2b63[_0x849e('0x1a')](0xcc)[_0x849e('0x1b')]();});}};}function handleEntityNotFound(_0x4f7920,_0xfa5140){return function(_0x4ca3f3){if(!_0x4ca3f3){_0x4f7920['sendStatus'](0x194);}return _0x4ca3f3;};}function handleError(_0x1f7567,_0x513bd2){_0x513bd2=_0x513bd2||0x1f4;return function(_0x1b61ff){logger[_0x849e('0x26')](_0x1b61ff[_0x849e('0x27')]);if(_0x1b61ff[_0x849e('0x28')]){delete _0x1b61ff[_0x849e('0x28')];}_0x1f7567[_0x849e('0x1a')](_0x513bd2)[_0x849e('0x29')](_0x1b61ff);};}exports[_0x849e('0x2a')]=function(_0xa753c,_0x1acf01){var _0x365ef4={},_0x5a800b={},_0x56bd5b={'count':0x0,'rows':[]};var _0x44cfa2=_[_0x849e('0x2b')](db[_0x849e('0x2c')][_0x849e('0x2d')],function(_0x444b46){return{'name':_0x444b46[_0x849e('0x2e')],'type':_0x444b46[_0x849e('0x2f')][_0x849e('0x30')]};});_0x5a800b[_0x849e('0x31')]=_[_0x849e('0x2b')](_0x44cfa2,_0x849e('0x28'));_0x5a800b['query']=_[_0x849e('0x32')](_0xa753c['query']);_0x5a800b[_0x849e('0x33')]=_[_0x849e('0x34')](_0x5a800b[_0x849e('0x31')],_0x5a800b[_0x849e('0x35')]);_0x365ef4[_0x849e('0x36')]=_[_0x849e('0x34')](_0x5a800b['model'],qs[_0x849e('0x37')](_0xa753c['query'][_0x849e('0x37')]));_0x365ef4[_0x849e('0x36')]=_0x365ef4[_0x849e('0x36')][_0x849e('0x38')]?_0x365ef4['attributes']:_0x5a800b['model'];if(!_0xa753c[_0x849e('0x35')]['hasOwnProperty']('nolimit')){_0x365ef4['limit']=qs[_0x849e('0x1f')](_0xa753c[_0x849e('0x35')]['limit']);_0x365ef4[_0x849e('0x1d')]=qs[_0x849e('0x1d')](_0xa753c[_0x849e('0x35')][_0x849e('0x1d')]);}_0x365ef4[_0x849e('0x39')]=qs[_0x849e('0x3a')](_0xa753c[_0x849e('0x35')]['sort']);_0x365ef4[_0x849e('0x3b')]=qs[_0x849e('0x33')](_['pick'](_0xa753c[_0x849e('0x35')],_0x5a800b['filters']),_0x44cfa2);if(_0xa753c[_0x849e('0x35')][_0x849e('0x3c')]){_0x365ef4[_0x849e('0x3b')]=_[_0x849e('0x3d')](_0x365ef4[_0x849e('0x3b')],{'$or':_[_0x849e('0x2b')](_0x44cfa2,function(_0x26a6c2){if(_0x26a6c2['type']!=='VIRTUAL'){var _0x5b497a={};_0x5b497a[_0x26a6c2[_0x849e('0x28')]]={'$like':'%'+_0xa753c[_0x849e('0x35')][_0x849e('0x3c')]+'%'};return _0x5b497a;}})});}_0x365ef4=_[_0x849e('0x3d')]({},_0x365ef4,_0xa753c[_0x849e('0x3e')]);var _0x4ca453={'where':_0x365ef4[_0x849e('0x3b')]};return db[_0x849e('0x2c')][_0x849e('0x3f')](_0x4ca453)[_0x849e('0x25')](function(_0x19962e){_0x56bd5b[_0x849e('0x3f')]=_0x19962e;if(_0xa753c['query'][_0x849e('0x40')]){_0x365ef4[_0x849e('0x41')]=[{'all':!![]}];}return db[_0x849e('0x2c')][_0x849e('0x42')](_0x365ef4);})['then'](function(_0x21d3bd){_0x56bd5b[_0x849e('0x43')]=_0x21d3bd;return _0x56bd5b;})[_0x849e('0x25')](respondWithFilteredResult(_0x1acf01,_0x365ef4))[_0x849e('0x44')](handleError(_0x1acf01,null));};exports['show']=function(_0x47de84,_0x49728a){var _0x3f103a={'raw':![],'where':{'id':_0x47de84[_0x849e('0x45')]['id']}},_0x2dd45c={};_0x2dd45c[_0x849e('0x31')]=_[_0x849e('0x32')](db[_0x849e('0x2c')]['rawAttributes']);_0x2dd45c['query']=_[_0x849e('0x32')](_0x47de84[_0x849e('0x35')]);_0x2dd45c[_0x849e('0x33')]=_[_0x849e('0x34')](_0x2dd45c[_0x849e('0x31')],_0x2dd45c['query']);_0x3f103a[_0x849e('0x36')]=_[_0x849e('0x34')](_0x2dd45c[_0x849e('0x31')],qs[_0x849e('0x37')](_0x47de84[_0x849e('0x35')]['fields']));_0x3f103a[_0x849e('0x36')]=_0x3f103a['attributes']['length']?_0x3f103a[_0x849e('0x36')]:_0x2dd45c['model'];if(_0x47de84[_0x849e('0x35')]['includeAll']){_0x3f103a[_0x849e('0x41')]=[{'all':!![]}];}_0x3f103a=_[_0x849e('0x3d')]({},_0x3f103a,_0x47de84[_0x849e('0x3e')]);return db[_0x849e('0x2c')]['find'](_0x3f103a)['then'](handleEntityNotFound(_0x49728a,null))['then'](respondWithResult(_0x49728a,null))[_0x849e('0x44')](handleError(_0x49728a,null));};exports[_0x849e('0x46')]=function(_0x32bf54,_0xe6a19d){return db['ServicenowAccount'][_0x849e('0x46')](_0x32bf54['body'],{})[_0x849e('0x25')](respondWithResult(_0xe6a19d,0xc9))[_0x849e('0x44')](handleError(_0xe6a19d,null));};exports[_0x849e('0x24')]=function(_0x5a421f,_0x191b68){if(_0x5a421f['body']['id']){delete _0x5a421f[_0x849e('0x47')]['id'];}return db[_0x849e('0x2c')][_0x849e('0x48')]({'where':{'id':_0x5a421f['params']['id']}})[_0x849e('0x25')](handleEntityNotFound(_0x191b68,null))['then'](saveUpdates(_0x5a421f[_0x849e('0x47')],null))[_0x849e('0x25')](respondWithResult(_0x191b68,null))['catch'](handleError(_0x191b68,null));};exports['destroy']=function(_0x552f6d,_0x42d5b1){return db[_0x849e('0x2c')][_0x849e('0x48')]({'where':{'id':_0x552f6d[_0x849e('0x45')]['id']}})[_0x849e('0x25')](handleEntityNotFound(_0x42d5b1,null))[_0x849e('0x25')](removeEntity(_0x42d5b1,null))['catch'](handleError(_0x42d5b1,null));};exports[_0x849e('0x49')]=function(_0x62ff34,_0x23f141,_0x140846){var _0x387163={};var _0x565336={};var _0x379cf3;var _0x4d9df9;return db[_0x849e('0x2c')][_0x849e('0x4a')]({'where':{'id':_0x62ff34[_0x849e('0x45')]['id']}})[_0x849e('0x25')](handleEntityNotFound(_0x23f141,null))[_0x849e('0x25')](function(_0x1f50b4){if(_0x1f50b4){_0x379cf3=_0x1f50b4;_0x565336[_0x849e('0x31')]=_['keys'](db[_0x849e('0x4b')][_0x849e('0x2d')]);_0x565336['query']=_[_0x849e('0x32')](_0x62ff34['query']);_0x565336[_0x849e('0x33')]=_[_0x849e('0x34')](_0x565336[_0x849e('0x31')],_0x565336[_0x849e('0x35')]);_0x387163[_0x849e('0x36')]=_[_0x849e('0x34')](_0x565336[_0x849e('0x31')],qs[_0x849e('0x37')](_0x62ff34['query'][_0x849e('0x37')]));_0x387163[_0x849e('0x36')]=_0x387163[_0x849e('0x36')][_0x849e('0x38')]?_0x387163['attributes']:_0x565336['model'];_0x387163['order']=qs[_0x849e('0x3a')](_0x62ff34[_0x849e('0x35')][_0x849e('0x3a')]);_0x387163[_0x849e('0x3b')]=qs['filters'](_['pick'](_0x62ff34[_0x849e('0x35')],_0x565336[_0x849e('0x33')]));if(_0x62ff34[_0x849e('0x35')][_0x849e('0x3c')]){_0x387163[_0x849e('0x3b')]=_[_0x849e('0x3d')](_0x387163[_0x849e('0x3b')],{'$or':_[_0x849e('0x2b')](_0x387163[_0x849e('0x36')],function(_0x5ba72f){var _0x482d60={};_0x482d60[_0x5ba72f]={'$like':'%'+_0x62ff34[_0x849e('0x35')][_0x849e('0x3c')]+'%'};return _0x482d60;})});}_0x387163=_['merge']({},_0x387163,_0x62ff34['options']);return _0x379cf3[_0x849e('0x49')](_0x387163);}})[_0x849e('0x25')](function(_0x48bcf5){if(_0x48bcf5){_0x4d9df9=_0x48bcf5[_0x849e('0x38')];if(!_0x62ff34['query'][_0x849e('0x4c')]('nolimit')){_0x387163['limit']=qs['limit'](_0x62ff34[_0x849e('0x35')][_0x849e('0x1f')]);_0x387163[_0x849e('0x1d')]=qs[_0x849e('0x1d')](_0x62ff34['query'][_0x849e('0x1d')]);}return _0x379cf3['getConfigurations'](_0x387163);}})[_0x849e('0x25')](function(_0x92784c){if(_0x92784c){return _0x92784c?{'count':_0x4d9df9,'rows':_0x92784c}:null;}})['then'](respondWithResult(_0x23f141,null))[_0x849e('0x44')](handleError(_0x23f141,null));};exports[_0x849e('0x4d')]=function(_0xffbe11,_0x3096da,_0x13bf64){if(_0xffbe11[_0x849e('0x47')]['id']){delete _0xffbe11[_0x849e('0x47')]['id'];}return db['ServicenowAccount'][_0x849e('0x4a')]({'where':{'id':_0xffbe11[_0x849e('0x45')]['id']}})[_0x849e('0x25')](handleEntityNotFound(_0x3096da,null))[_0x849e('0x25')](function(_0x26d336){if(_0x26d336){_0xffbe11[_0x849e('0x47')][_0x849e('0x4e')]=_0x26d336['id'];_0xffbe11['body'][_0x849e('0x4f')]=integrations[_0x849e('0x50')](_0xffbe11[_0x849e('0x47')][_0x849e('0x51')],_0xffbe11[_0x849e('0x47')]['type']);_0xffbe11['body'][_0x849e('0x52')]=integrations[_0x849e('0x53')](_0xffbe11[_0x849e('0x47')][_0x849e('0x51')],_0xffbe11[_0x849e('0x47')][_0x849e('0x2f')]);return db[_0x849e('0x4b')][_0x849e('0x46')](_0xffbe11[_0x849e('0x47')],{'include':[{'model':db[_0x849e('0x54')],'as':_0x849e('0x4f')},{'model':db['ServicenowField'],'as':_0x849e('0x52')}]});}return null;})[_0x849e('0x25')](respondWithResult(_0x3096da,null))[_0x849e('0x44')](handleError(_0x3096da,null));};exports[_0x849e('0x55')]=function(_0x170d3e,_0x29e5fe,_0x174311){var _0x52fffc=[_0x849e('0x56'),_0x849e('0x57'),_0x849e('0x58'),_0x849e('0x59'),'close_code',_0x849e('0x5a'),_0x849e('0x5b'),'severity',_0x849e('0x5c')];var _0x3530fb=['parent',_0x849e('0x56'),'caused_by',_0x849e('0x5d'),_0x849e('0x5e'),_0x849e('0x5f'),_0x849e('0x60'),_0x849e('0x57'),_0x849e('0x61'),_0x849e('0x62'),_0x849e('0x63'),_0x849e('0x64'),_0x849e('0x65'),_0x849e('0x66'),_0x849e('0x67'),_0x849e('0x68'),_0x849e('0x69'),_0x849e('0x6a'),'knowledge',_0x849e('0x39'),_0x849e('0x6b'),_0x849e('0x6c'),_0x849e('0x6d'),_0x849e('0x6e'),_0x849e('0x6f'),_0x849e('0x70'),_0x849e('0x71'),_0x849e('0x72'),_0x849e('0x73'),_0x849e('0x74'),_0x849e('0x75'),_0x849e('0x76'),_0x849e('0x77'),_0x849e('0x78'),'business_duration',_0x849e('0x79'),_0x849e('0x7a'),'reopened_time',_0x849e('0x7b'),'caller_id',_0x849e('0x7c'),_0x849e('0x59'),_0x849e('0x7d'),_0x849e('0x7e'),_0x849e('0x7f'),'correlation_display',_0x849e('0x80'),_0x849e('0x81'),_0x849e('0x82'),'business_stc',_0x849e('0x83'),'description','calendar_duration',_0x849e('0x5a'),_0x849e('0x84'),_0x849e('0x85'),_0x849e('0x86'),_0x849e('0x87'),'parent_incident',_0x849e('0x88'),_0x849e('0x89'),_0x849e('0x8a'),_0x849e('0x5b'),_0x849e('0x8b'),'problem_id',_0x849e('0x8c'),'reassignment_count',_0x849e('0x8d'),'assigned_to',_0x849e('0x8e'),_0x849e('0x8f'),_0x849e('0x90'),_0x849e('0x91'),_0x849e('0x92'),_0x849e('0x93'),_0x849e('0x94'),_0x849e('0x95'),_0x849e('0x96'),_0x849e('0x97'),_0x849e('0x98'),_0x849e('0x99'),_0x849e('0x9a'),_0x849e('0x5c')];var _0x529955='';var _0x5d6114='';var _0x3c7712=[];var _0x9857a1='';var _0x12bd22='';var _0x5d722b=[];var _0xf66004='';var _0x33b3a4='';var _0x4baa23={};var _0xb0e4f9='';return db['ServicenowAccount'][_0x849e('0x4a')]({'where':{'id':_0x170d3e[_0x849e('0x45')]['id']},'attributes':['id',_0x849e('0x9b'),_0x849e('0x9c'),'email',_0x849e('0x9d'),'serverUrl']})[_0x849e('0x25')](handleEntityNotFound(_0x29e5fe,null))[_0x849e('0x25')](function(_0x4a7b27){if(_0x4a7b27){_0xb0e4f9=_0x4a7b27['remoteUri'];var _0x5f0aa7=_0xb0e4f9[_0x849e('0x9e')](-0x1);if(_0x5f0aa7==='/'){_0xb0e4f9=_0xb0e4f9[_0x849e('0x9f')](0x0,_0xb0e4f9[_0x849e('0xa0')](_0x5f0aa7));}_0x33b3a4=util[_0x849e('0xa1')](_0x849e('0xa2'),_0xb0e4f9);_0xf66004=util['format'](_0x849e('0xa3'),_0xb0e4f9);_0x4baa23={'user':_0x4a7b27[_0x849e('0x9b')],'pass':_0x4a7b27[_0x849e('0x9c')]};var _0xdfa915={'method':_0x849e('0xa4'),'uri':_0x33b3a4+_0x849e('0xa5'),'auth':_0x4baa23,'json':!![]};return rp(_0xdfa915);}})[_0x849e('0x25')](function(_0x5d82ab){if(_0x5d82ab[_0x849e('0xa6')][_0x849e('0x38')]>0x0){_0x529955=_0x5d82ab[_0x849e('0xa6')];}console[_0x849e('0xa7')](_0x849e('0xa8'),_0x529955);_0x5d722b=[];_0x5d6114=Object[_0x849e('0xa9')]([],_0x529955);_[_0x849e('0xaa')](_0x5d6114,function(_0x148647){return!_0x52fffc[_0x849e('0xab')](_0x148647[_0x849e('0x28')]);});_0x5d6114[_0x849e('0xac')](function(_0x5aebe2){var _0x159054=createFieldObject(_0xf66004,_0x4baa23,_0x5aebe2[_0x849e('0xad')],_0x5aebe2[_0x849e('0x28')],_0x5aebe2[_0x849e('0xae')],![]);_0x5d722b[_0x849e('0xaf')](_0x159054);});return Promise[_0x849e('0xb0')](_0x5d722b);})[_0x849e('0x25')](function(_0x2ebd18){_0x3c7712=_0x2ebd18;_0x9857a1=Object['assign']([],_0x529955);console[_0x849e('0xa7')](_0x849e('0xb1'),_0x529955);_[_0x849e('0xaa')](_0x9857a1,function(_0x35c85b){return _0x3530fb['includes'](_0x35c85b[_0x849e('0x28')]);});console[_0x849e('0xa7')](_0x849e('0xb2'),_0x9857a1);_0x5d722b=[];_0x9857a1[_0x849e('0xac')](function(_0x1171de){var _0x3dff71=createFieldObject(_0xf66004,_0x4baa23,_0x1171de[_0x849e('0xad')],_0x1171de[_0x849e('0x28')],_0x1171de[_0x849e('0xae')],!![]);_0x5d722b['push'](_0x3dff71);});return Promise[_0x849e('0xb0')](_0x5d722b);})[_0x849e('0x25')](function(_0x3d5fc0){_0x12bd22=_0x3d5fc0;var _0x5aa43c=_0x3c7712[_0x849e('0xb3')](_0x12bd22);return{'count':_0x5aa43c[_0x849e('0x38')],'rows':_0x5aa43c};})[_0x849e('0x25')](respondWithResult(_0x29e5fe,null))[_0x849e('0x44')](function(_0x597e82){console[_0x849e('0xa7')](_0x849e('0xb4')+_0x597e82);var _0x5cdc96=_0x170d3e[_0x849e('0x35')][_0x849e('0xb5')]?0x1f4:_0x597e82[_0x849e('0xb6')]||0x1f4;logger[_0x849e('0x26')](_0x597e82[_0x849e('0x27')]);delete _0x597e82[_0x849e('0x28')];if(_0x5cdc96===0x191){_0x5cdc96=0x190;}_0x29e5fe[_0x849e('0x1a')](_0x5cdc96)['send'](_0x170d3e[_0x849e('0x35')][_0x849e('0xb5')]?{'message':_0x849e('0xb7'),'statusCode':_0x597e82[_0x849e('0xb6')]}:_0x597e82);});};function createFieldObject(_0x1a97bd,_0x49edda,_0x2b9afc,_0x433132,_0x37c228,_0x192def){return new Promise(function(_0x42ac24,_0x38268b){var _0x31cb71={'id':_0x433132,'name':_0x37c228,'custom':_0x192def};if(_0x2b9afc==='boolean'){_0x31cb71[_0x849e('0x3e')]=[{'name':'True','value':_0x849e('0xb8')},{'name':_0x849e('0xb9'),'value':_0x849e('0xba')}];_0x42ac24(_0x31cb71);}else{var _0x37610b={'method':_0x849e('0xa4'),'uri':_0x1a97bd+_0x849e('0xbb')+_0x433132,'auth':_0x49edda,'json':!![]};return rp(_0x37610b)[_0x849e('0x25')](function(_0x214551){var _0x1bbdda=[];if(_0x214551['result']['length']>0x0){_0x214551['result'][_0x849e('0xac')](function(_0x40c833){if(_0x40c833['inactive']==='false'){var _0x2921f8={'name':_0x40c833[_0x849e('0xae')],'value':_0x40c833[_0x849e('0xbc')]};_0x1bbdda[_0x849e('0xaf')](_0x2921f8);}});}_0x31cb71[_0x849e('0x3e')]=_0x1bbdda;if(_0x31cb71[_0x849e('0x3e')][_0x849e('0x38')]>0x0){_0x42ac24(_0x31cb71);}else{if(_0x192def==![]){_0x42ac24();}else{_0x42ac24(_0x31cb71);}}});}});}
\ No newline at end of file
+var _0x90bf=['calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','incident_state','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','email','remoteUri','slice','substring','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','includes','forEach','internalType','label','all','log','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','test','statusCode','Wrong\x20credentials','boolean','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','set','reject','save','then','destroy','end','error','stack','name','send','index','map','ServicenowAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','options','include','rows','show','params','includeAll','catch','create','body','update','find','getConfigurations','findOne','ServicenowConfiguration','rawAttributes','hasOwnProperty','AccountId','Subjects','getSubjects','channel','ServicenowField','Descriptions','getFields','made_sla','knowledge','subcategory','close_code','notify','severity','category','watch_list','upon_reject','sys_updated_on','hold_reason','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','short_description','assignment_group','additional_assignee_list','description'];(function(_0x46ee2e,_0x4d9b0e){var _0x4550eb=function(_0x8b4a21){while(--_0x8b4a21){_0x46ee2e['push'](_0x46ee2e['shift']());}};_0x4550eb(++_0x4d9b0e);}(_0x90bf,0x1ba));var _0xf90b=function(_0x1c5cda,_0x3ef6e4){_0x1c5cda=_0x1c5cda-0x0;var _0x8780db=_0x90bf[_0x1c5cda];return _0x8780db;};'use strict';var emlformat=require(_0xf90b('0x0'));var rimraf=require(_0xf90b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf90b('0x2'));var rp=require(_0xf90b('0x3'));var moment=require(_0xf90b('0x4'));var BPromise=require(_0xf90b('0x5'));var Mustache=require(_0xf90b('0x6'));var util=require(_0xf90b('0x7'));var path=require(_0xf90b('0x8'));var sox=require(_0xf90b('0x9'));var csv=require(_0xf90b('0xa'));var ejs=require(_0xf90b('0xb'));var fs=require('fs');var fs_extra=require(_0xf90b('0xc'));var _=require(_0xf90b('0xd'));var squel=require('squel');var crypto=require(_0xf90b('0xe'));var jsforce=require(_0xf90b('0xf'));var deskjs=require(_0xf90b('0x10'));var toCsv=require(_0xf90b('0xa'));var querystring=require(_0xf90b('0x11'));var Papa=require(_0xf90b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf90b('0x13'));var as=require(_0xf90b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf90b('0x15'))(_0xf90b('0x16'));var utils=require(_0xf90b('0x17'));var config=require(_0xf90b('0x18'));var licenseUtil=require(_0xf90b('0x19'));var db=require(_0xf90b('0x1a'))['db'];var integrations=require(_0xf90b('0x1b'));function respondWithStatusCode(_0x6953f4,_0x5da747){_0x5da747=_0x5da747||0xcc;return function(_0x54132d){if(_0x54132d){return _0x6953f4[_0xf90b('0x1c')](_0x5da747);}return _0x6953f4[_0xf90b('0x1d')](_0x5da747)['end']();};}function respondWithResult(_0x11c3fb,_0x4acdbf){_0x4acdbf=_0x4acdbf||0xc8;return function(_0xacc98c){if(_0xacc98c){return _0x11c3fb[_0xf90b('0x1d')](_0x4acdbf)[_0xf90b('0x1e')](_0xacc98c);}};}function respondWithFilteredResult(_0x2f0111,_0x45e101){return function(_0x2322ce){if(_0x2322ce){var _0x3de401=typeof _0x45e101[_0xf90b('0x1f')]===_0xf90b('0x20')&&typeof _0x45e101['limit']===_0xf90b('0x20');var _0x4ad122=_0x2322ce[_0xf90b('0x21')];var _0x518e58=_0x3de401?0x0:_0x45e101[_0xf90b('0x1f')];var _0x5dd41f=_0x3de401?_0x2322ce['count']:_0x45e101[_0xf90b('0x1f')]+_0x45e101['limit'];var _0x61b7d3;if(_0x5dd41f>=_0x4ad122){_0x5dd41f=_0x4ad122;_0x61b7d3=0xc8;}else{_0x61b7d3=0xce;}_0x2f0111[_0xf90b('0x1d')](_0x61b7d3);return _0x2f0111[_0xf90b('0x22')]('Content-Range',_0x518e58+'-'+_0x5dd41f+'/'+_0x4ad122)[_0xf90b('0x1e')](_0x2322ce);}return null;};}function patchUpdates(_0x519c9a){return function(_0x476865){try{jsonpatch['apply'](_0x476865,_0x519c9a,!![]);}catch(_0xae8f36){return BPromise[_0xf90b('0x23')](_0xae8f36);}return _0x476865[_0xf90b('0x24')]();};}function saveUpdates(_0x1ea613,_0x27a0c4){return function(_0x202b53){if(_0x202b53){return _0x202b53['update'](_0x1ea613)[_0xf90b('0x25')](function(_0xcb9cd0){return _0xcb9cd0;});}return null;};}function removeEntity(_0x9d67a2,_0x5390f4){return function(_0x3ef976){if(_0x3ef976){return _0x3ef976[_0xf90b('0x26')]()[_0xf90b('0x25')](function(){_0x9d67a2['status'](0xcc)[_0xf90b('0x27')]();});}};}function handleEntityNotFound(_0x2ab48f,_0x1deaef){return function(_0x13c3d6){if(!_0x13c3d6){_0x2ab48f[_0xf90b('0x1c')](0x194);}return _0x13c3d6;};}function handleError(_0x5afb4c,_0x260730){_0x260730=_0x260730||0x1f4;return function(_0x207a8f){logger[_0xf90b('0x28')](_0x207a8f[_0xf90b('0x29')]);if(_0x207a8f[_0xf90b('0x2a')]){delete _0x207a8f[_0xf90b('0x2a')];}_0x5afb4c[_0xf90b('0x1d')](_0x260730)[_0xf90b('0x2b')](_0x207a8f);};}exports[_0xf90b('0x2c')]=function(_0x1c234f,_0x3e29eb){var _0x455514={},_0x4a510d={},_0x21a97c={'count':0x0,'rows':[]};var _0x4a252=_[_0xf90b('0x2d')](db[_0xf90b('0x2e')]['rawAttributes'],function(_0x564663){return{'name':_0x564663[_0xf90b('0x2f')],'type':_0x564663[_0xf90b('0x30')][_0xf90b('0x31')]};});_0x4a510d[_0xf90b('0x32')]=_[_0xf90b('0x2d')](_0x4a252,'name');_0x4a510d[_0xf90b('0x33')]=_[_0xf90b('0x34')](_0x1c234f[_0xf90b('0x33')]);_0x4a510d[_0xf90b('0x35')]=_[_0xf90b('0x36')](_0x4a510d[_0xf90b('0x32')],_0x4a510d['query']);_0x455514[_0xf90b('0x37')]=_[_0xf90b('0x36')](_0x4a510d[_0xf90b('0x32')],qs[_0xf90b('0x38')](_0x1c234f[_0xf90b('0x33')][_0xf90b('0x38')]));_0x455514[_0xf90b('0x37')]=_0x455514[_0xf90b('0x37')][_0xf90b('0x39')]?_0x455514[_0xf90b('0x37')]:_0x4a510d[_0xf90b('0x32')];if(!_0x1c234f['query']['hasOwnProperty'](_0xf90b('0x3a'))){_0x455514[_0xf90b('0x3b')]=qs[_0xf90b('0x3b')](_0x1c234f[_0xf90b('0x33')][_0xf90b('0x3b')]);_0x455514[_0xf90b('0x1f')]=qs['offset'](_0x1c234f[_0xf90b('0x33')][_0xf90b('0x1f')]);}_0x455514[_0xf90b('0x3c')]=qs[_0xf90b('0x3d')](_0x1c234f['query']['sort']);_0x455514['where']=qs[_0xf90b('0x35')](_[_0xf90b('0x3e')](_0x1c234f['query'],_0x4a510d[_0xf90b('0x35')]),_0x4a252);if(_0x1c234f[_0xf90b('0x33')][_0xf90b('0x3f')]){_0x455514[_0xf90b('0x40')]=_[_0xf90b('0x41')](_0x455514[_0xf90b('0x40')],{'$or':_['map'](_0x4a252,function(_0x262113){if(_0x262113[_0xf90b('0x30')]!=='VIRTUAL'){var _0x223d4c={};_0x223d4c[_0x262113['name']]={'$like':'%'+_0x1c234f[_0xf90b('0x33')][_0xf90b('0x3f')]+'%'};return _0x223d4c;}})});}_0x455514=_[_0xf90b('0x41')]({},_0x455514,_0x1c234f[_0xf90b('0x42')]);var _0x37a883={'where':_0x455514[_0xf90b('0x40')]};return db[_0xf90b('0x2e')]['count'](_0x37a883)['then'](function(_0xfa8f7e){_0x21a97c[_0xf90b('0x21')]=_0xfa8f7e;if(_0x1c234f['query']['includeAll']){_0x455514[_0xf90b('0x43')]=[{'all':!![]}];}return db[_0xf90b('0x2e')]['findAll'](_0x455514);})['then'](function(_0xa268b3){_0x21a97c[_0xf90b('0x44')]=_0xa268b3;return _0x21a97c;})[_0xf90b('0x25')](respondWithFilteredResult(_0x3e29eb,_0x455514))['catch'](handleError(_0x3e29eb,null));};exports[_0xf90b('0x45')]=function(_0x3f0d5d,_0x482e63){var _0x2d7d5c={'raw':![],'where':{'id':_0x3f0d5d[_0xf90b('0x46')]['id']}},_0x11a70b={};_0x11a70b[_0xf90b('0x32')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0x11a70b[_0xf90b('0x33')]=_[_0xf90b('0x34')](_0x3f0d5d['query']);_0x11a70b[_0xf90b('0x35')]=_[_0xf90b('0x36')](_0x11a70b[_0xf90b('0x32')],_0x11a70b[_0xf90b('0x33')]);_0x2d7d5c[_0xf90b('0x37')]=_[_0xf90b('0x36')](_0x11a70b[_0xf90b('0x32')],qs[_0xf90b('0x38')](_0x3f0d5d[_0xf90b('0x33')][_0xf90b('0x38')]));_0x2d7d5c[_0xf90b('0x37')]=_0x2d7d5c[_0xf90b('0x37')]['length']?_0x2d7d5c[_0xf90b('0x37')]:_0x11a70b[_0xf90b('0x32')];if(_0x3f0d5d[_0xf90b('0x33')][_0xf90b('0x47')]){_0x2d7d5c[_0xf90b('0x43')]=[{'all':!![]}];}_0x2d7d5c=_[_0xf90b('0x41')]({},_0x2d7d5c,_0x3f0d5d[_0xf90b('0x42')]);return db[_0xf90b('0x2e')]['find'](_0x2d7d5c)['then'](handleEntityNotFound(_0x482e63,null))[_0xf90b('0x25')](respondWithResult(_0x482e63,null))[_0xf90b('0x48')](handleError(_0x482e63,null));};exports[_0xf90b('0x49')]=function(_0x1dc79d,_0x57c0be){return db[_0xf90b('0x2e')][_0xf90b('0x49')](_0x1dc79d[_0xf90b('0x4a')],{})[_0xf90b('0x25')](respondWithResult(_0x57c0be,0xc9))[_0xf90b('0x48')](handleError(_0x57c0be,null));};exports[_0xf90b('0x4b')]=function(_0x353aa6,_0x529316){if(_0x353aa6[_0xf90b('0x4a')]['id']){delete _0x353aa6[_0xf90b('0x4a')]['id'];}return db[_0xf90b('0x2e')][_0xf90b('0x4c')]({'where':{'id':_0x353aa6[_0xf90b('0x46')]['id']}})[_0xf90b('0x25')](handleEntityNotFound(_0x529316,null))['then'](saveUpdates(_0x353aa6[_0xf90b('0x4a')],null))[_0xf90b('0x25')](respondWithResult(_0x529316,null))[_0xf90b('0x48')](handleError(_0x529316,null));};exports[_0xf90b('0x26')]=function(_0x2ce21f,_0x19b166){return db[_0xf90b('0x2e')][_0xf90b('0x4c')]({'where':{'id':_0x2ce21f['params']['id']}})[_0xf90b('0x25')](handleEntityNotFound(_0x19b166,null))[_0xf90b('0x25')](removeEntity(_0x19b166,null))[_0xf90b('0x48')](handleError(_0x19b166,null));};exports[_0xf90b('0x4d')]=function(_0x2af440,_0x2cd110,_0x10ea06){var _0x55dff3={};var _0x4d8e83={};var _0x4c234c;var _0x2a790;return db[_0xf90b('0x2e')][_0xf90b('0x4e')]({'where':{'id':_0x2af440[_0xf90b('0x46')]['id']}})[_0xf90b('0x25')](handleEntityNotFound(_0x2cd110,null))[_0xf90b('0x25')](function(_0x4cf571){if(_0x4cf571){_0x4c234c=_0x4cf571;_0x4d8e83[_0xf90b('0x32')]=_[_0xf90b('0x34')](db[_0xf90b('0x4f')][_0xf90b('0x50')]);_0x4d8e83[_0xf90b('0x33')]=_['keys'](_0x2af440[_0xf90b('0x33')]);_0x4d8e83[_0xf90b('0x35')]=_['intersection'](_0x4d8e83[_0xf90b('0x32')],_0x4d8e83[_0xf90b('0x33')]);_0x55dff3[_0xf90b('0x37')]=_[_0xf90b('0x36')](_0x4d8e83[_0xf90b('0x32')],qs[_0xf90b('0x38')](_0x2af440[_0xf90b('0x33')][_0xf90b('0x38')]));_0x55dff3[_0xf90b('0x37')]=_0x55dff3[_0xf90b('0x37')]['length']?_0x55dff3[_0xf90b('0x37')]:_0x4d8e83[_0xf90b('0x32')];_0x55dff3[_0xf90b('0x3c')]=qs['sort'](_0x2af440['query'][_0xf90b('0x3d')]);_0x55dff3['where']=qs['filters'](_['pick'](_0x2af440[_0xf90b('0x33')],_0x4d8e83[_0xf90b('0x35')]));if(_0x2af440[_0xf90b('0x33')][_0xf90b('0x3f')]){_0x55dff3[_0xf90b('0x40')]=_[_0xf90b('0x41')](_0x55dff3[_0xf90b('0x40')],{'$or':_[_0xf90b('0x2d')](_0x55dff3[_0xf90b('0x37')],function(_0x1e8e1e){var _0x296410={};_0x296410[_0x1e8e1e]={'$like':'%'+_0x2af440['query'][_0xf90b('0x3f')]+'%'};return _0x296410;})});}_0x55dff3=_[_0xf90b('0x41')]({},_0x55dff3,_0x2af440[_0xf90b('0x42')]);return _0x4c234c[_0xf90b('0x4d')](_0x55dff3);}})['then'](function(_0x2604df){if(_0x2604df){_0x2a790=_0x2604df[_0xf90b('0x39')];if(!_0x2af440[_0xf90b('0x33')][_0xf90b('0x51')](_0xf90b('0x3a'))){_0x55dff3[_0xf90b('0x3b')]=qs[_0xf90b('0x3b')](_0x2af440[_0xf90b('0x33')][_0xf90b('0x3b')]);_0x55dff3[_0xf90b('0x1f')]=qs[_0xf90b('0x1f')](_0x2af440[_0xf90b('0x33')][_0xf90b('0x1f')]);}return _0x4c234c['getConfigurations'](_0x55dff3);}})['then'](function(_0x36baa7){if(_0x36baa7){return _0x36baa7?{'count':_0x2a790,'rows':_0x36baa7}:null;}})['then'](respondWithResult(_0x2cd110,null))[_0xf90b('0x48')](handleError(_0x2cd110,null));};exports['addConfiguration']=function(_0x4741b4,_0x21e8fd,_0x307d87){if(_0x4741b4[_0xf90b('0x4a')]['id']){delete _0x4741b4[_0xf90b('0x4a')]['id'];}return db[_0xf90b('0x2e')][_0xf90b('0x4e')]({'where':{'id':_0x4741b4[_0xf90b('0x46')]['id']}})[_0xf90b('0x25')](handleEntityNotFound(_0x21e8fd,null))[_0xf90b('0x25')](function(_0x1061c7){if(_0x1061c7){_0x4741b4[_0xf90b('0x4a')][_0xf90b('0x52')]=_0x1061c7['id'];_0x4741b4['body'][_0xf90b('0x53')]=integrations[_0xf90b('0x54')](_0x4741b4[_0xf90b('0x4a')][_0xf90b('0x55')],_0x4741b4[_0xf90b('0x4a')]['type']);_0x4741b4[_0xf90b('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x4741b4[_0xf90b('0x4a')]['channel'],_0x4741b4[_0xf90b('0x4a')]['type']);return db['ServicenowConfiguration'][_0xf90b('0x49')](_0x4741b4[_0xf90b('0x4a')],{'include':[{'model':db[_0xf90b('0x56')],'as':_0xf90b('0x53')},{'model':db[_0xf90b('0x56')],'as':_0xf90b('0x57')}]});}return null;})[_0xf90b('0x25')](respondWithResult(_0x21e8fd,null))[_0xf90b('0x48')](handleError(_0x21e8fd,null));};exports[_0xf90b('0x58')]=function(_0x261ff9,_0x206bf5,_0x34f203){var _0x471b4c=[_0xf90b('0x59'),'hold_reason',_0xf90b('0x5a'),_0xf90b('0x5b'),_0xf90b('0x5c'),_0xf90b('0x5d'),'incident_state',_0xf90b('0x5e'),_0xf90b('0x5f')];var _0x25d71e=['parent',_0xf90b('0x59'),'caused_by',_0xf90b('0x60'),_0xf90b('0x61'),_0xf90b('0x62'),'child_incidents',_0xf90b('0x63'),_0xf90b('0x64'),_0xf90b('0x65'),_0xf90b('0x66'),_0xf90b('0x67'),_0xf90b('0x68'),_0xf90b('0x69'),_0xf90b('0x6a'),_0xf90b('0x6b'),_0xf90b('0x6c'),_0xf90b('0x6d'),_0xf90b('0x5a'),_0xf90b('0x3c'),_0xf90b('0x6e'),_0xf90b('0x6f'),_0xf90b('0x70'),_0xf90b('0x71'),_0xf90b('0x72'),_0xf90b('0x73'),_0xf90b('0x74'),_0xf90b('0x75'),_0xf90b('0x76'),'sys_domain_path',_0xf90b('0x77'),_0xf90b('0x78'),_0xf90b('0x79'),_0xf90b('0x7a'),_0xf90b('0x7b'),_0xf90b('0x7c'),_0xf90b('0x7d'),_0xf90b('0x7e'),_0xf90b('0x7f'),_0xf90b('0x80'),_0xf90b('0x81'),_0xf90b('0x5b'),'work_notes',_0xf90b('0x82'),_0xf90b('0x5c'),'correlation_display','delivery_task','work_start',_0xf90b('0x83'),'business_stc',_0xf90b('0x84'),_0xf90b('0x85'),_0xf90b('0x86'),_0xf90b('0x5d'),'sys_class_name',_0xf90b('0x87'),_0xf90b('0x88'),_0xf90b('0x89'),_0xf90b('0x8a'),_0xf90b('0x8b'),_0xf90b('0x8c'),'reopened_by',_0xf90b('0x8d'),_0xf90b('0x8e'),_0xf90b('0x8f'),_0xf90b('0x90'),_0xf90b('0x91'),_0xf90b('0x92'),_0xf90b('0x93'),_0xf90b('0x5e'),_0xf90b('0x94'),_0xf90b('0x95'),_0xf90b('0x96'),_0xf90b('0x97'),_0xf90b('0x98'),_0xf90b('0x99'),_0xf90b('0x9a'),_0xf90b('0x9b'),_0xf90b('0x9c'),_0xf90b('0x9d'),_0xf90b('0x9e'),_0xf90b('0x9f'),_0xf90b('0x5f')];var _0xe21fa9='';var _0x17530a='';var _0x50963e=[];var _0x5415f0='';var _0x5b5212='';var _0x40c1b3=[];var _0x566a01='';var _0x3cdef2='';var _0x1feb04={};var _0x1e7fe9='';return db['ServicenowAccount'][_0xf90b('0x4e')]({'where':{'id':_0x261ff9[_0xf90b('0x46')]['id']},'attributes':['id',_0xf90b('0xa0'),'password',_0xf90b('0xa1'),_0xf90b('0xa2'),'serverUrl']})[_0xf90b('0x25')](handleEntityNotFound(_0x206bf5,null))[_0xf90b('0x25')](function(_0x43e6f9){if(_0x43e6f9){_0x1e7fe9=_0x43e6f9[_0xf90b('0xa2')];var _0x3343dd=_0x1e7fe9[_0xf90b('0xa3')](-0x1);if(_0x3343dd==='/'){_0x1e7fe9=_0x1e7fe9[_0xf90b('0xa4')](0x0,_0x1e7fe9['lastIndexOf'](_0x3343dd));}_0x3cdef2=util[_0xf90b('0xa5')](_0xf90b('0xa6'),_0x1e7fe9);_0x566a01=util[_0xf90b('0xa5')](_0xf90b('0xa7'),_0x1e7fe9);_0x1feb04={'user':_0x43e6f9['username'],'pass':_0x43e6f9['password']};var _0x4a4497={'method':_0xf90b('0xa8'),'uri':_0x3cdef2+_0xf90b('0xa9'),'auth':_0x1feb04,'json':!![]};return rp(_0x4a4497);}})[_0xf90b('0x25')](function(_0xa6c1da){if(_0xa6c1da[_0xf90b('0xaa')][_0xf90b('0x39')]>0x0){_0xe21fa9=_0xa6c1da[_0xf90b('0xaa')];}console['log'](_0xf90b('0xab'),_0xe21fa9);_0x40c1b3=[];_0x17530a=Object[_0xf90b('0xac')]([],_0xe21fa9);_['remove'](_0x17530a,function(_0x5667c5){return!_0x471b4c[_0xf90b('0xad')](_0x5667c5[_0xf90b('0x2a')]);});_0x17530a[_0xf90b('0xae')](function(_0xfe29ae){var _0x5845ab=createFieldObject(_0x566a01,_0x1feb04,_0xfe29ae[_0xf90b('0xaf')],_0xfe29ae['name'],_0xfe29ae[_0xf90b('0xb0')],![]);_0x40c1b3['push'](_0x5845ab);});return Promise[_0xf90b('0xb1')](_0x40c1b3);})[_0xf90b('0x25')](function(_0x36ef60){_0x50963e=_0x36ef60;_0x5415f0=Object[_0xf90b('0xac')]([],_0xe21fa9);console[_0xf90b('0xb2')](_0xf90b('0xb3'),_0xe21fa9);_[_0xf90b('0xb4')](_0x5415f0,function(_0x5cb2a8){return _0x25d71e[_0xf90b('0xad')](_0x5cb2a8['name']);});console[_0xf90b('0xb2')](_0xf90b('0xb5'),_0x5415f0);_0x40c1b3=[];_0x5415f0[_0xf90b('0xae')](function(_0x1bc476){var _0x56fc80=createFieldObject(_0x566a01,_0x1feb04,_0x1bc476[_0xf90b('0xaf')],_0x1bc476[_0xf90b('0x2a')],_0x1bc476[_0xf90b('0xb0')],!![]);_0x40c1b3[_0xf90b('0xb6')](_0x56fc80);});return Promise[_0xf90b('0xb1')](_0x40c1b3);})[_0xf90b('0x25')](function(_0x1ac3e2){_0x5b5212=_0x1ac3e2;var _0x3f83d8=_0x50963e[_0xf90b('0xb7')](_0x5b5212);return{'count':_0x3f83d8['length'],'rows':_0x3f83d8};})[_0xf90b('0x25')](respondWithResult(_0x206bf5,null))[_0xf90b('0x48')](function(_0x2363bb){console['log']('ServiceNow\x20error:\x20'+_0x2363bb);var _0x120b05=_0x261ff9['query'][_0xf90b('0xb8')]?0x1f4:_0x2363bb[_0xf90b('0xb9')]||0x1f4;logger[_0xf90b('0x28')](_0x2363bb[_0xf90b('0x29')]);delete _0x2363bb['name'];if(_0x120b05===0x191){_0x120b05=0x190;}_0x206bf5[_0xf90b('0x1d')](_0x120b05)['send'](_0x261ff9[_0xf90b('0x33')][_0xf90b('0xb8')]?{'message':_0xf90b('0xba'),'statusCode':_0x2363bb[_0xf90b('0xb9')]}:_0x2363bb);});};function createFieldObject(_0x2e637e,_0x4832e6,_0x217173,_0x5d1ad7,_0x3f5ae3,_0x438931){return new Promise(function(_0x371f13,_0x200d3d){var _0x5e643d={'id':_0x5d1ad7,'name':_0x3f5ae3,'custom':_0x438931};if(_0x217173===_0xf90b('0xbb')){_0x5e643d[_0xf90b('0x42')]=[{'name':'True','value':'true'},{'name':_0xf90b('0xbc'),'value':_0xf90b('0xbd')}];_0x371f13(_0x5e643d);}else{var _0x4aeebc={'method':_0xf90b('0xa8'),'uri':_0x2e637e+_0xf90b('0xbe')+_0x5d1ad7,'auth':_0x4832e6,'json':!![]};return rp(_0x4aeebc)[_0xf90b('0x25')](function(_0x87f0a7){var _0x30a132=[];if(_0x87f0a7[_0xf90b('0xaa')][_0xf90b('0x39')]>0x0){_0x87f0a7[_0xf90b('0xaa')]['forEach'](function(_0x1b8f17){if(_0x1b8f17['inactive']==='false'){var _0x4a308c={'name':_0x1b8f17[_0xf90b('0xb0')],'value':_0x1b8f17[_0xf90b('0xbf')]};_0x30a132[_0xf90b('0xb6')](_0x4a308c);}});}_0x5e643d[_0xf90b('0x42')]=_0x30a132;if(_0x5e643d['options']['length']>0x0){_0x371f13(_0x5e643d);}else{if(_0x438931==![]){_0x371f13();}else{_0x371f13(_0x5e643d);}}});}});}
\ No newline at end of file
index 0f7d5ac..7174f3d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x5f5947,_0x3bd405){_0x5f5947=_0x5f5947-0x0;var _0x5f20b0=_0x3f8a[_0x5f5947];return _0x5f20b0;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','lodash','util'];(function(_0x274f6e,_0x4756ce){var _0x21ba1c=function(_0x505be8){while(--_0x505be8){_0x274f6e['push'](_0x274f6e['shift']());}};_0x21ba1c(++_0x4756ce);}(_0x814b,0x1a2));var _0xb814=function(_0x5f382f,_0x3f1432){_0x5f382f=_0x5f382f-0x0;var _0x3bb11b=_0x814b[_0x5f382f];return _0x3bb11b;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));var integrations=require(_0xb814('0xa'));module[_0xb814('0xb')]=function(_0x53e507,_0x3b0829){return _0x53e507[_0xb814('0xc')]('ServicenowAccount',attributes,{'tableName':_0xb814('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0fe6884..dcc6313 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f08=['ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowServicenowAccount','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','GetServicenowAccount'];(function(_0x43b584,_0x20a6bd){var _0x48f27b=function(_0x1eeb77){while(--_0x1eeb77){_0x43b584['push'](_0x43b584['shift']());}};_0x48f27b(++_0x20a6bd);}(_0x0f08,0x109));var _0x80f0=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x0f08[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0x80f0('0x0'));var util=require(_0x80f0('0x1'));var moment=require(_0x80f0('0x2'));var BPromise=require(_0x80f0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80f0('0x4'));var db=require(_0x80f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x80f0('0x6'))(_0x80f0('0x7'));var config=require('../../config/environment');var jayson=require(_0x80f0('0x8'));var client=jayson[_0x80f0('0x9')][_0x80f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa28f4c,_0x3abf04,_0x191f01){return new BPromise(function(_0x5c47b2,_0x19ddbb){return client[_0x80f0('0xb')](_0xa28f4c,_0x191f01)[_0x80f0('0xc')](function(_0x3cb976){logger['info'](_0x80f0('0xd'),_0x3abf04,_0x80f0('0xe'));logger[_0x80f0('0xf')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x3abf04,_0x80f0('0xe'),JSON['stringify'](_0x3cb976));if(_0x3cb976[_0x80f0('0x10')]){if(_0x3cb976['error'][_0x80f0('0x11')]===0x1f4){logger[_0x80f0('0x10')](_0x80f0('0xd'),_0x3abf04,_0x3cb976[_0x80f0('0x10')][_0x80f0('0x12')]);return _0x19ddbb(_0x3cb976[_0x80f0('0x10')][_0x80f0('0x12')]);}logger[_0x80f0('0x10')](_0x80f0('0xd'),_0x3abf04,_0x3cb976['error'][_0x80f0('0x12')]);return _0x5c47b2(_0x3cb976['error']['message']);}else{logger[_0x80f0('0x13')](_0x80f0('0xd'),_0x3abf04,_0x80f0('0xe'));_0x5c47b2(_0x3cb976[_0x80f0('0x14')]['message']);}})[_0x80f0('0x15')](function(_0x87aadb){logger[_0x80f0('0x10')](_0x80f0('0xd'),_0x3abf04,_0x87aadb);_0x19ddbb(_0x87aadb);});});}exports[_0x80f0('0x16')]=function(_0x5b9b62){var _0x5959ba=this;return new Promise(function(_0x52fad0,_0x53ea9b){return db[_0x80f0('0x17')][_0x80f0('0x18')]({'raw':_0x5b9b62['options']?_0x5b9b62[_0x80f0('0x19')][_0x80f0('0x1a')]===undefined?!![]:![]:!![],'where':_0x5b9b62[_0x80f0('0x19')]?_0x5b9b62['options'][_0x80f0('0x1b')]||null:null,'attributes':_0x5b9b62['options']?_0x5b9b62['options'][_0x80f0('0x1c')]||null:null,'limit':_0x5b9b62[_0x80f0('0x19')]?_0x5b9b62[_0x80f0('0x19')][_0x80f0('0x1d')]||null:null,'include':_0x5b9b62[_0x80f0('0x19')]?_0x5b9b62['options'][_0x80f0('0x1e')]?_[_0x80f0('0x1f')](_0x5b9b62[_0x80f0('0x19')][_0x80f0('0x1e')],function(_0xb2eab6){return{'model':db[_0xb2eab6[_0x80f0('0x20')]],'as':_0xb2eab6['as'],'attributes':_0xb2eab6[_0x80f0('0x1c')],'include':_0xb2eab6[_0x80f0('0x1e')]?_[_0x80f0('0x1f')](_0xb2eab6['include'],function(_0x5f8357){return{'model':db[_0x5f8357[_0x80f0('0x20')]],'as':_0x5f8357['as'],'attributes':_0x5f8357[_0x80f0('0x1c')],'include':_0x5f8357[_0x80f0('0x1e')]?_[_0x80f0('0x1f')](_0x5f8357['include'],function(_0x5b0874){return{'model':db[_0x5b0874[_0x80f0('0x20')]],'as':_0x5b0874['as'],'attributes':_0x5b0874[_0x80f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x80f0('0xc')](function(_0xd0778f){logger[_0x80f0('0x13')](_0x80f0('0x16'),_0x5b9b62);logger[_0x80f0('0xf')](_0x80f0('0x16'),_0x5b9b62,JSON[_0x80f0('0x21')](_0xd0778f));_0x52fad0(_0xd0778f);})[_0x80f0('0x15')](function(_0x12d60a){logger['error'](_0x80f0('0x16'),_0x12d60a[_0x80f0('0x12')],_0x5b9b62);_0x53ea9b(_0x5959ba[_0x80f0('0x10')](0x1f4,_0x12d60a[_0x80f0('0x12')]));});});};exports[_0x80f0('0x22')]=function(_0x2c9b5c){var _0x50b842=this;return new Promise(function(_0x15d693,_0x4aaa2f){return db['ServicenowAccount'][_0x80f0('0x23')]({'raw':_0x2c9b5c[_0x80f0('0x19')]?_0x2c9b5c['options']['raw']===undefined?!![]:![]:!![],'where':_0x2c9b5c[_0x80f0('0x19')]?_0x2c9b5c[_0x80f0('0x19')]['where']||null:null,'attributes':_0x2c9b5c[_0x80f0('0x19')]?_0x2c9b5c[_0x80f0('0x19')]['attributes']||null:null,'include':_0x2c9b5c[_0x80f0('0x19')]?_0x2c9b5c['options'][_0x80f0('0x1e')]?_[_0x80f0('0x1f')](_0x2c9b5c[_0x80f0('0x19')][_0x80f0('0x1e')],function(_0x20e880){return{'model':db[_0x20e880['model']],'as':_0x20e880['as'],'attributes':_0x20e880[_0x80f0('0x1c')],'include':_0x20e880[_0x80f0('0x1e')]?_[_0x80f0('0x1f')](_0x20e880[_0x80f0('0x1e')],function(_0x4ef051){return{'model':db[_0x4ef051[_0x80f0('0x20')]],'as':_0x4ef051['as'],'attributes':_0x4ef051[_0x80f0('0x1c')],'include':_0x4ef051[_0x80f0('0x1e')]?_['map'](_0x4ef051[_0x80f0('0x1e')],function(_0x4c5671){return{'model':db[_0x4c5671[_0x80f0('0x20')]],'as':_0x4c5671['as'],'attributes':_0x4c5671[_0x80f0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x80f0('0xc')](function(_0x4439e3){logger[_0x80f0('0x13')]('ShowServicenowAccount',_0x2c9b5c);logger[_0x80f0('0xf')](_0x80f0('0x22'),_0x2c9b5c,JSON[_0x80f0('0x21')](_0x4439e3));_0x15d693(_0x4439e3);})[_0x80f0('0x15')](function(_0x21099b){logger[_0x80f0('0x10')](_0x80f0('0x22'),_0x21099b[_0x80f0('0x12')],_0x2c9b5c);_0x4aaa2f(_0x50b842[_0x80f0('0x10')](0x1f4,_0x21099b[_0x80f0('0x12')]));});});};
\ No newline at end of file
+var _0xf395=['find','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetServicenowAccount','options','attributes','limit','include','map','model','catch','ShowServicenowAccount','ServicenowAccount'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xf395,0x1ec));var _0x5f39=function(_0x2e6c1f,_0x241d49){_0x2e6c1f=_0x2e6c1f-0x0;var _0xa23058=_0xf395[_0x2e6c1f];return _0xa23058;};'use strict';var _=require('lodash');var util=require(_0x5f39('0x0'));var moment=require(_0x5f39('0x1'));var BPromise=require(_0x5f39('0x2'));var rs=require(_0x5f39('0x3'));var fs=require('fs');var Redis=require(_0x5f39('0x4'));var db=require(_0x5f39('0x5'))['db'];var utils=require(_0x5f39('0x6'));var logger=require('../../config/logger')(_0x5f39('0x7'));var config=require('../../config/environment');var jayson=require(_0x5f39('0x8'));var client=jayson[_0x5f39('0x9')][_0x5f39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9d64a3,_0x320364,_0x506ec6){return new BPromise(function(_0x27ddb6,_0x28cd96){return client[_0x5f39('0xb')](_0x9d64a3,_0x506ec6)[_0x5f39('0xc')](function(_0x40651d){logger['info'](_0x5f39('0xd'),_0x320364,_0x5f39('0xe'));logger[_0x5f39('0xf')](_0x5f39('0x10'),_0x320364,'request\x20sent',JSON[_0x5f39('0x11')](_0x40651d));if(_0x40651d['error']){if(_0x40651d[_0x5f39('0x12')][_0x5f39('0x13')]===0x1f4){logger[_0x5f39('0x12')](_0x5f39('0xd'),_0x320364,_0x40651d['error']['message']);return _0x28cd96(_0x40651d[_0x5f39('0x12')]['message']);}logger[_0x5f39('0x12')](_0x5f39('0xd'),_0x320364,_0x40651d['error'][_0x5f39('0x14')]);return _0x27ddb6(_0x40651d[_0x5f39('0x12')][_0x5f39('0x14')]);}else{logger[_0x5f39('0x15')](_0x5f39('0xd'),_0x320364,'request\x20sent');_0x27ddb6(_0x40651d[_0x5f39('0x16')][_0x5f39('0x14')]);}})['catch'](function(_0x54a562){logger[_0x5f39('0x12')](_0x5f39('0xd'),_0x320364,_0x54a562);_0x28cd96(_0x54a562);});});}exports[_0x5f39('0x17')]=function(_0x38caad){var _0x356a87=this;return new Promise(function(_0x20dee1,_0x2b524c){return db['ServicenowAccount']['findAll']({'raw':_0x38caad[_0x5f39('0x18')]?_0x38caad[_0x5f39('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x38caad[_0x5f39('0x18')]?_0x38caad[_0x5f39('0x18')]['where']||null:null,'attributes':_0x38caad[_0x5f39('0x18')]?_0x38caad[_0x5f39('0x18')][_0x5f39('0x19')]||null:null,'limit':_0x38caad[_0x5f39('0x18')]?_0x38caad['options'][_0x5f39('0x1a')]||null:null,'include':_0x38caad['options']?_0x38caad['options'][_0x5f39('0x1b')]?_[_0x5f39('0x1c')](_0x38caad[_0x5f39('0x18')][_0x5f39('0x1b')],function(_0x4e38f8){return{'model':db[_0x4e38f8[_0x5f39('0x1d')]],'as':_0x4e38f8['as'],'attributes':_0x4e38f8[_0x5f39('0x19')],'include':_0x4e38f8['include']?_[_0x5f39('0x1c')](_0x4e38f8['include'],function(_0x91614a){return{'model':db[_0x91614a['model']],'as':_0x91614a['as'],'attributes':_0x91614a['attributes'],'include':_0x91614a['include']?_['map'](_0x91614a[_0x5f39('0x1b')],function(_0x43121f){return{'model':db[_0x43121f[_0x5f39('0x1d')]],'as':_0x43121f['as'],'attributes':_0x43121f[_0x5f39('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5f39('0xc')](function(_0x392bf1){logger['info'](_0x5f39('0x17'),_0x38caad);logger[_0x5f39('0xf')](_0x5f39('0x17'),_0x38caad,JSON[_0x5f39('0x11')](_0x392bf1));_0x20dee1(_0x392bf1);})[_0x5f39('0x1e')](function(_0xf14224){logger[_0x5f39('0x12')](_0x5f39('0x17'),_0xf14224[_0x5f39('0x14')],_0x38caad);_0x2b524c(_0x356a87['error'](0x1f4,_0xf14224[_0x5f39('0x14')]));});});};exports[_0x5f39('0x1f')]=function(_0x100ce2){var _0x187db3=this;return new Promise(function(_0xb6682b,_0x15ed05){return db[_0x5f39('0x20')][_0x5f39('0x21')]({'raw':_0x100ce2['options']?_0x100ce2[_0x5f39('0x18')][_0x5f39('0x22')]===undefined?!![]:![]:!![],'where':_0x100ce2[_0x5f39('0x18')]?_0x100ce2[_0x5f39('0x18')]['where']||null:null,'attributes':_0x100ce2[_0x5f39('0x18')]?_0x100ce2[_0x5f39('0x18')][_0x5f39('0x19')]||null:null,'include':_0x100ce2['options']?_0x100ce2[_0x5f39('0x18')]['include']?_[_0x5f39('0x1c')](_0x100ce2[_0x5f39('0x18')][_0x5f39('0x1b')],function(_0x478904){return{'model':db[_0x478904['model']],'as':_0x478904['as'],'attributes':_0x478904[_0x5f39('0x19')],'include':_0x478904[_0x5f39('0x1b')]?_[_0x5f39('0x1c')](_0x478904['include'],function(_0x48d218){return{'model':db[_0x48d218['model']],'as':_0x48d218['as'],'attributes':_0x48d218[_0x5f39('0x19')],'include':_0x48d218[_0x5f39('0x1b')]?_[_0x5f39('0x1c')](_0x48d218['include'],function(_0x5885ac){return{'model':db[_0x5885ac['model']],'as':_0x5885ac['as'],'attributes':_0x5885ac[_0x5f39('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5f39('0xc')](function(_0x38a1b5){logger[_0x5f39('0x15')](_0x5f39('0x1f'),_0x100ce2);logger[_0x5f39('0xf')](_0x5f39('0x1f'),_0x100ce2,JSON[_0x5f39('0x11')](_0x38a1b5));_0xb6682b(_0x38a1b5);})[_0x5f39('0x1e')](function(_0x3d3cf7){logger[_0x5f39('0x12')](_0x5f39('0x1f'),_0x3d3cf7[_0x5f39('0x14')],_0x100ce2);_0x15ed05(_0x187db3['error'](0x1f4,_0x3d3cf7[_0x5f39('0x14')]));});});};
\ No newline at end of file
index e0257e4..d63a233 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e1b=['get','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','post','create','/:id','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','isAuthenticated'];(function(_0x24c6ee,_0x13bacb){var _0x5ae84c=function(_0x2d6232){while(--_0x2d6232){_0x24c6ee['push'](_0x24c6ee['shift']());}};_0x5ae84c(++_0x13bacb);}(_0x6e1b,0x1ab));var _0xb6e1=function(_0x59d6d1,_0x215ade){_0x59d6d1=_0x59d6d1-0x0;var _0x45cb3c=_0x6e1b[_0x59d6d1];return _0x45cb3c;};'use strict';var multer=require('multer');var util=require(_0xb6e1('0x0'));var path=require(_0xb6e1('0x1'));var timeout=require('connect-timeout');var express=require(_0xb6e1('0x2'));var router=express[_0xb6e1('0x3')]();var fs_extra=require(_0xb6e1('0x4'));var auth=require(_0xb6e1('0x5'));var interaction=require(_0xb6e1('0x6'));var config=require(_0xb6e1('0x7'));var controller=require(_0xb6e1('0x8'));router['get']('/',auth[_0xb6e1('0x9')](),controller['index']);router[_0xb6e1('0xa')]('/:id',auth[_0xb6e1('0x9')](),controller[_0xb6e1('0xb')]);router[_0xb6e1('0xa')](_0xb6e1('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xb6e1('0xa')]('/:id/subjects',auth[_0xb6e1('0x9')](),controller[_0xb6e1('0xd')]);router[_0xb6e1('0xa')](_0xb6e1('0xe'),auth[_0xb6e1('0x9')](),controller[_0xb6e1('0xf')]);router[_0xb6e1('0x10')]('/',auth['isAuthenticated'](),controller[_0xb6e1('0x11')]);router['put'](_0xb6e1('0x12'),auth[_0xb6e1('0x9')](),controller[_0xb6e1('0x13')]);router[_0xb6e1('0x14')](_0xb6e1('0x12'),auth[_0xb6e1('0x9')](),controller[_0xb6e1('0x15')]);module[_0xb6e1('0x16')]=router;
\ No newline at end of file
+var _0x753f=['destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x753f,0xd0));var _0xf753=function(_0x122cfa,_0x2d6da9){_0x122cfa=_0x122cfa-0x0;var _0x308aff=_0x753f[_0x122cfa];return _0x308aff;};'use strict';var multer=require(_0xf753('0x0'));var util=require('util');var path=require(_0xf753('0x1'));var timeout=require(_0xf753('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf753('0x3'));var auth=require(_0xf753('0x4'));var interaction=require(_0xf753('0x5'));var config=require(_0xf753('0x6'));var controller=require(_0xf753('0x7'));router[_0xf753('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf753('0x8')](_0xf753('0x9'),auth[_0xf753('0xa')](),controller[_0xf753('0xb')]);router[_0xf753('0x8')](_0xf753('0xc'),auth['isAuthenticated'](),controller[_0xf753('0xd')]);router['get']('/:id/subjects',auth[_0xf753('0xa')](),controller[_0xf753('0xe')]);router[_0xf753('0x8')](_0xf753('0xf'),auth['isAuthenticated'](),controller[_0xf753('0x10')]);router[_0xf753('0x11')]('/',auth[_0xf753('0xa')](),controller[_0xf753('0x12')]);router[_0xf753('0x13')](_0xf753('0x9'),auth['isAuthenticated'](),controller[_0xf753('0x14')]);router[_0xf753('0x15')](_0xf753('0x9'),auth[_0xf753('0xa')](),controller[_0xf753('0x16')]);module['exports']=router;
\ No newline at end of file
index 13cb057..83269a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2eaa=['STRING','sequelize','exports'];(function(_0x559e35,_0x32b2c8){var _0x1dad09=function(_0x76f90e){while(--_0x76f90e){_0x559e35['push'](_0x559e35['shift']());}};_0x1dad09(++_0x32b2c8);}(_0x2eaa,0x17e));var _0xa2ea=function(_0x52d942,_0x458d91){_0x52d942=_0x52d942-0x0;var _0x40da52=_0x2eaa[_0x52d942];return _0x40da52;};'use strict';var Sequelize=require(_0xa2ea('0x0'));module[_0xa2ea('0x1')]={'name':{'type':Sequelize[_0xa2ea('0x2')]},'description':{'type':Sequelize[_0xa2ea('0x2')]}};
\ No newline at end of file
+var _0x9adb=['exports','STRING','sequelize'];(function(_0x2b3f26,_0x468e98){var _0x1b1733=function(_0x2d30){while(--_0x2d30){_0x2b3f26['push'](_0x2b3f26['shift']());}};_0x1b1733(++_0x468e98);}(_0x9adb,0x8c));var _0xb9ad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9adb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb9ad('0x0'));module[_0xb9ad('0x1')]={'name':{'type':Sequelize[_0xb9ad('0x2')]},'description':{'type':Sequelize[_0xb9ad('0x2')]}};
\ No newline at end of file
index 06fc2e2..959e0b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x662b=['find','destroy','getFields','findOne','ServicenowField','hasOwnProperty','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','error','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','intersection','includeAll','create','body'];(function(_0x2942ec,_0x30597e){var _0x192ec9=function(_0x39264b){while(--_0x39264b){_0x2942ec['push'](_0x2942ec['shift']());}};_0x192ec9(++_0x30597e);}(_0x662b,0x150));var _0xb662=function(_0x3d404f,_0x364ce4){_0x3d404f=_0x3d404f-0x0;var _0x1a93ba=_0x662b[_0x3d404f];return _0x1a93ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb662('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb662('0x1'));var rp=require(_0xb662('0x2'));var moment=require(_0xb662('0x3'));var BPromise=require(_0xb662('0x4'));var Mustache=require(_0xb662('0x5'));var util=require(_0xb662('0x6'));var path=require(_0xb662('0x7'));var sox=require('sox');var csv=require(_0xb662('0x8'));var ejs=require(_0xb662('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb662('0xa'));var squel=require(_0xb662('0xb'));var crypto=require(_0xb662('0xc'));var jsforce=require(_0xb662('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb662('0xe'));var Redis=require(_0xb662('0xf'));var authService=require(_0xb662('0x10'));var qs=require(_0xb662('0x11'));var as=require(_0xb662('0x12'));var hardwareService=require(_0xb662('0x13'));var logger=require(_0xb662('0x14'))(_0xb662('0x15'));var utils=require(_0xb662('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb662('0x17'));var db=require(_0xb662('0x18'))['db'];function respondWithStatusCode(_0x28e3c4,_0x579465){_0x579465=_0x579465||0xcc;return function(_0x2c635a){if(_0x2c635a){return _0x28e3c4[_0xb662('0x19')](_0x579465);}return _0x28e3c4[_0xb662('0x1a')](_0x579465)[_0xb662('0x1b')]();};}function respondWithResult(_0xdedfc9,_0x4eac6b){_0x4eac6b=_0x4eac6b||0xc8;return function(_0x1adc82){if(_0x1adc82){return _0xdedfc9[_0xb662('0x1a')](_0x4eac6b)[_0xb662('0x1c')](_0x1adc82);}};}function respondWithFilteredResult(_0x594549,_0x5de3f6){return function(_0x4d7dd6){if(_0x4d7dd6){var _0x401b14=typeof _0x5de3f6[_0xb662('0x1d')]===_0xb662('0x1e')&&typeof _0x5de3f6['limit']===_0xb662('0x1e');var _0x211bd8=_0x4d7dd6[_0xb662('0x1f')];var _0x40cfc2=_0x401b14?0x0:_0x5de3f6[_0xb662('0x1d')];var _0xc5f396=_0x401b14?_0x4d7dd6[_0xb662('0x1f')]:_0x5de3f6[_0xb662('0x1d')]+_0x5de3f6[_0xb662('0x20')];var _0x11ff10;if(_0xc5f396>=_0x211bd8){_0xc5f396=_0x211bd8;_0x11ff10=0xc8;}else{_0x11ff10=0xce;}_0x594549[_0xb662('0x1a')](_0x11ff10);return _0x594549['set'](_0xb662('0x21'),_0x40cfc2+'-'+_0xc5f396+'/'+_0x211bd8)[_0xb662('0x1c')](_0x4d7dd6);}return null;};}function patchUpdates(_0x12aef7){return function(_0x2ed075){try{jsonpatch[_0xb662('0x22')](_0x2ed075,_0x12aef7,!![]);}catch(_0x49b1e6){return BPromise['reject'](_0x49b1e6);}return _0x2ed075[_0xb662('0x23')]();};}function saveUpdates(_0x5707be,_0x556bdf){return function(_0x13d095){if(_0x13d095){return _0x13d095[_0xb662('0x24')](_0x5707be)[_0xb662('0x25')](function(_0x528d3d){return _0x528d3d;});}return null;};}function removeEntity(_0x50ac99,_0x25fe75){return function(_0x33f000){if(_0x33f000){return _0x33f000['destroy']()[_0xb662('0x25')](function(){_0x50ac99['status'](0xcc)[_0xb662('0x1b')]();});}};}function handleEntityNotFound(_0x3ddc44,_0x30d58a){return function(_0x1af2de){if(!_0x1af2de){_0x3ddc44[_0xb662('0x19')](0x194);}return _0x1af2de;};}function handleError(_0x3a849a,_0x230c2f){_0x230c2f=_0x230c2f||0x1f4;return function(_0x908c88){logger[_0xb662('0x26')](_0x908c88[_0xb662('0x27')]);if(_0x908c88['name']){delete _0x908c88[_0xb662('0x28')];}_0x3a849a[_0xb662('0x1a')](_0x230c2f)[_0xb662('0x29')](_0x908c88);};}exports['index']=function(_0x4b9af0,_0x25786b){var _0x1802c3={},_0x318132={},_0x28a833={'count':0x0,'rows':[]};var _0x1c2feb=_['map'](db[_0xb662('0x2a')][_0xb662('0x2b')],function(_0x30cc3b){return{'name':_0x30cc3b[_0xb662('0x2c')],'type':_0x30cc3b['type'][_0xb662('0x2d')]};});_0x318132[_0xb662('0x2e')]=_['map'](_0x1c2feb,_0xb662('0x28'));_0x318132[_0xb662('0x2f')]=_[_0xb662('0x30')](_0x4b9af0[_0xb662('0x2f')]);_0x318132[_0xb662('0x31')]=_['intersection'](_0x318132[_0xb662('0x2e')],_0x318132['query']);_0x1802c3[_0xb662('0x32')]=_['intersection'](_0x318132[_0xb662('0x2e')],qs[_0xb662('0x33')](_0x4b9af0[_0xb662('0x2f')][_0xb662('0x33')]));_0x1802c3['attributes']=_0x1802c3['attributes'][_0xb662('0x34')]?_0x1802c3[_0xb662('0x32')]:_0x318132[_0xb662('0x2e')];if(!_0x4b9af0[_0xb662('0x2f')]['hasOwnProperty'](_0xb662('0x35'))){_0x1802c3[_0xb662('0x20')]=qs[_0xb662('0x20')](_0x4b9af0[_0xb662('0x2f')]['limit']);_0x1802c3[_0xb662('0x1d')]=qs['offset'](_0x4b9af0['query'][_0xb662('0x1d')]);}_0x1802c3[_0xb662('0x36')]=qs[_0xb662('0x37')](_0x4b9af0['query']['sort']);_0x1802c3[_0xb662('0x38')]=qs[_0xb662('0x31')](_[_0xb662('0x39')](_0x4b9af0[_0xb662('0x2f')],_0x318132[_0xb662('0x31')]),_0x1c2feb);if(_0x4b9af0['query']['filter']){_0x1802c3[_0xb662('0x38')]=_[_0xb662('0x3a')](_0x1802c3[_0xb662('0x38')],{'$or':_[_0xb662('0x3b')](_0x1c2feb,function(_0x2e535b){if(_0x2e535b[_0xb662('0x3c')]!==_0xb662('0x3d')){var _0x548137={};_0x548137[_0x2e535b[_0xb662('0x28')]]={'$like':'%'+_0x4b9af0[_0xb662('0x2f')][_0xb662('0x3e')]+'%'};return _0x548137;}})});}_0x1802c3=_[_0xb662('0x3a')]({},_0x1802c3,_0x4b9af0[_0xb662('0x3f')]);var _0x44b703={'where':_0x1802c3[_0xb662('0x38')]};return db[_0xb662('0x2a')]['count'](_0x44b703)[_0xb662('0x25')](function(_0x368c63){_0x28a833['count']=_0x368c63;if(_0x4b9af0[_0xb662('0x2f')]['includeAll']){_0x1802c3[_0xb662('0x40')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xb662('0x41')](_0x1802c3);})[_0xb662('0x25')](function(_0x3ba7ab){_0x28a833[_0xb662('0x42')]=_0x3ba7ab;return _0x28a833;})[_0xb662('0x25')](respondWithFilteredResult(_0x25786b,_0x1802c3))[_0xb662('0x43')](handleError(_0x25786b,null));};exports[_0xb662('0x44')]=function(_0x36d420,_0x5c61a9){var _0xc66534={'raw':![],'where':{'id':_0x36d420[_0xb662('0x45')]['id']}},_0x41d1c3={};_0x41d1c3[_0xb662('0x2e')]=_[_0xb662('0x30')](db[_0xb662('0x2a')]['rawAttributes']);_0x41d1c3[_0xb662('0x2f')]=_[_0xb662('0x30')](_0x36d420[_0xb662('0x2f')]);_0x41d1c3[_0xb662('0x31')]=_['intersection'](_0x41d1c3['model'],_0x41d1c3[_0xb662('0x2f')]);_0xc66534[_0xb662('0x32')]=_[_0xb662('0x46')](_0x41d1c3['model'],qs[_0xb662('0x33')](_0x36d420[_0xb662('0x2f')][_0xb662('0x33')]));_0xc66534['attributes']=_0xc66534[_0xb662('0x32')]['length']?_0xc66534[_0xb662('0x32')]:_0x41d1c3[_0xb662('0x2e')];if(_0x36d420[_0xb662('0x2f')][_0xb662('0x47')]){_0xc66534['include']=[{'all':!![]}];}_0xc66534=_[_0xb662('0x3a')]({},_0xc66534,_0x36d420[_0xb662('0x3f')]);return db[_0xb662('0x2a')]['find'](_0xc66534)[_0xb662('0x25')](handleEntityNotFound(_0x5c61a9,null))[_0xb662('0x25')](respondWithResult(_0x5c61a9,null))[_0xb662('0x43')](handleError(_0x5c61a9,null));};exports['create']=function(_0x27de72,_0x130e00){return db[_0xb662('0x2a')][_0xb662('0x48')](_0x27de72[_0xb662('0x49')],{})[_0xb662('0x25')](respondWithResult(_0x130e00,0xc9))[_0xb662('0x43')](handleError(_0x130e00,null));};exports[_0xb662('0x24')]=function(_0x2d646f,_0x504e1b){if(_0x2d646f['body']['id']){delete _0x2d646f[_0xb662('0x49')]['id'];}return db[_0xb662('0x2a')][_0xb662('0x4a')]({'where':{'id':_0x2d646f[_0xb662('0x45')]['id']}})['then'](handleEntityNotFound(_0x504e1b,null))[_0xb662('0x25')](saveUpdates(_0x2d646f['body'],null))[_0xb662('0x25')](respondWithResult(_0x504e1b,null))[_0xb662('0x43')](handleError(_0x504e1b,null));};exports[_0xb662('0x4b')]=function(_0x5bdee0,_0x2d4925){return db['ServicenowConfiguration'][_0xb662('0x4a')]({'where':{'id':_0x5bdee0[_0xb662('0x45')]['id']}})[_0xb662('0x25')](handleEntityNotFound(_0x2d4925,null))[_0xb662('0x25')](removeEntity(_0x2d4925,null))[_0xb662('0x43')](handleError(_0x2d4925,null));};exports[_0xb662('0x4c')]=function(_0x133ea4,_0x49a41f,_0x3520d0){var _0x289a72={};var _0x659451={};var _0x2a8782;var _0x1803d4;return db[_0xb662('0x2a')][_0xb662('0x4d')]({'where':{'id':_0x133ea4[_0xb662('0x45')]['id']}})['then'](handleEntityNotFound(_0x49a41f,null))[_0xb662('0x25')](function(_0x52f6ec){if(_0x52f6ec){_0x2a8782=_0x52f6ec;_0x659451['model']=_[_0xb662('0x30')](db[_0xb662('0x4e')][_0xb662('0x2b')]);_0x659451[_0xb662('0x2f')]=_[_0xb662('0x30')](_0x133ea4['query']);_0x659451[_0xb662('0x31')]=_[_0xb662('0x46')](_0x659451[_0xb662('0x2e')],_0x659451[_0xb662('0x2f')]);_0x289a72[_0xb662('0x32')]=_[_0xb662('0x46')](_0x659451[_0xb662('0x2e')],qs[_0xb662('0x33')](_0x133ea4[_0xb662('0x2f')][_0xb662('0x33')]));_0x289a72[_0xb662('0x32')]=_0x289a72[_0xb662('0x32')]['length']?_0x289a72[_0xb662('0x32')]:_0x659451[_0xb662('0x2e')];_0x289a72[_0xb662('0x36')]=qs[_0xb662('0x37')](_0x133ea4[_0xb662('0x2f')][_0xb662('0x37')]);_0x289a72['where']=qs[_0xb662('0x31')](_[_0xb662('0x39')](_0x133ea4[_0xb662('0x2f')],_0x659451[_0xb662('0x31')]));if(_0x133ea4[_0xb662('0x2f')]['filter']){_0x289a72['where']=_[_0xb662('0x3a')](_0x289a72[_0xb662('0x38')],{'$or':_[_0xb662('0x3b')](_0x289a72['attributes'],function(_0x3dd12b){var _0xb27b9f={};_0xb27b9f[_0x3dd12b]={'$like':'%'+_0x133ea4[_0xb662('0x2f')][_0xb662('0x3e')]+'%'};return _0xb27b9f;})});}_0x289a72=_[_0xb662('0x3a')]({},_0x289a72,_0x133ea4['options']);return _0x2a8782[_0xb662('0x4c')](_0x289a72);}})[_0xb662('0x25')](function(_0x237949){if(_0x237949){_0x1803d4=_0x237949[_0xb662('0x34')];if(!_0x133ea4[_0xb662('0x2f')][_0xb662('0x4f')]('nolimit')){_0x289a72[_0xb662('0x20')]=qs[_0xb662('0x20')](_0x133ea4['query'][_0xb662('0x20')]);_0x289a72[_0xb662('0x1d')]=qs[_0xb662('0x1d')](_0x133ea4[_0xb662('0x2f')][_0xb662('0x1d')]);}return _0x2a8782['getFields'](_0x289a72);}})['then'](function(_0x551f6e){if(_0x551f6e){return _0x551f6e?{'count':_0x1803d4,'rows':_0x551f6e}:null;}})['then'](respondWithResult(_0x49a41f,null))[_0xb662('0x43')](handleError(_0x49a41f,null));};exports['getSubjects']=function(_0x32eb50,_0x306061,_0x27bc62){var _0x3aba1e={};var _0x5a8671={};var _0x2dddf3;var _0x419423;return db['ServicenowConfiguration'][_0xb662('0x4d')]({'where':{'id':_0x32eb50[_0xb662('0x45')]['id']}})[_0xb662('0x25')](handleEntityNotFound(_0x306061,null))[_0xb662('0x25')](function(_0x929a39){if(_0x929a39){_0x2dddf3=_0x929a39;_0x5a8671['model']=_[_0xb662('0x30')](db['ServicenowField'][_0xb662('0x2b')]);_0x5a8671['query']=_[_0xb662('0x30')](_0x32eb50[_0xb662('0x2f')]);_0x5a8671[_0xb662('0x31')]=_[_0xb662('0x46')](_0x5a8671[_0xb662('0x2e')],_0x5a8671[_0xb662('0x2f')]);_0x3aba1e[_0xb662('0x32')]=_[_0xb662('0x46')](_0x5a8671['model'],qs[_0xb662('0x33')](_0x32eb50[_0xb662('0x2f')][_0xb662('0x33')]));_0x3aba1e[_0xb662('0x32')]=_0x3aba1e[_0xb662('0x32')]['length']?_0x3aba1e[_0xb662('0x32')]:_0x5a8671[_0xb662('0x2e')];_0x3aba1e['order']=qs[_0xb662('0x37')](_0x32eb50[_0xb662('0x2f')]['sort']);_0x3aba1e[_0xb662('0x38')]=qs[_0xb662('0x31')](_[_0xb662('0x39')](_0x32eb50[_0xb662('0x2f')],_0x5a8671['filters']));if(_0x32eb50[_0xb662('0x2f')]['filter']){_0x3aba1e[_0xb662('0x38')]=_['merge'](_0x3aba1e[_0xb662('0x38')],{'$or':_[_0xb662('0x3b')](_0x3aba1e[_0xb662('0x32')],function(_0x44a501){var _0x2d2582={};_0x2d2582[_0x44a501]={'$like':'%'+_0x32eb50[_0xb662('0x2f')][_0xb662('0x3e')]+'%'};return _0x2d2582;})});}_0x3aba1e=_[_0xb662('0x3a')]({},_0x3aba1e,_0x32eb50[_0xb662('0x3f')]);return _0x2dddf3[_0xb662('0x50')](_0x3aba1e);}})['then'](function(_0x589cfe){if(_0x589cfe){_0x419423=_0x589cfe['length'];if(!_0x32eb50[_0xb662('0x2f')][_0xb662('0x4f')](_0xb662('0x35'))){_0x3aba1e[_0xb662('0x20')]=qs[_0xb662('0x20')](_0x32eb50['query'][_0xb662('0x20')]);_0x3aba1e['offset']=qs[_0xb662('0x1d')](_0x32eb50[_0xb662('0x2f')][_0xb662('0x1d')]);}return _0x2dddf3[_0xb662('0x50')](_0x3aba1e);}})[_0xb662('0x25')](function(_0x57d273){if(_0x57d273){return _0x57d273?{'count':_0x419423,'rows':_0x57d273}:null;}})[_0xb662('0x25')](respondWithResult(_0x306061,null))[_0xb662('0x43')](handleError(_0x306061,null));};exports[_0xb662('0x51')]=function(_0x586a5e,_0x32f573,_0x30c780){var _0x39f123={};var _0x5bd0ad={};var _0x137b01;var _0x288af4;return db[_0xb662('0x2a')][_0xb662('0x4d')]({'where':{'id':_0x586a5e['params']['id']}})[_0xb662('0x25')](handleEntityNotFound(_0x32f573,null))[_0xb662('0x25')](function(_0x4fecb3){if(_0x4fecb3){_0x137b01=_0x4fecb3;_0x5bd0ad[_0xb662('0x2e')]=_[_0xb662('0x30')](db[_0xb662('0x4e')]['rawAttributes']);_0x5bd0ad[_0xb662('0x2f')]=_[_0xb662('0x30')](_0x586a5e['query']);_0x5bd0ad[_0xb662('0x31')]=_[_0xb662('0x46')](_0x5bd0ad[_0xb662('0x2e')],_0x5bd0ad['query']);_0x39f123['attributes']=_[_0xb662('0x46')](_0x5bd0ad[_0xb662('0x2e')],qs['fields'](_0x586a5e['query'][_0xb662('0x33')]));_0x39f123[_0xb662('0x32')]=_0x39f123[_0xb662('0x32')][_0xb662('0x34')]?_0x39f123[_0xb662('0x32')]:_0x5bd0ad[_0xb662('0x2e')];_0x39f123[_0xb662('0x36')]=qs[_0xb662('0x37')](_0x586a5e['query'][_0xb662('0x37')]);_0x39f123[_0xb662('0x38')]=qs[_0xb662('0x31')](_['pick'](_0x586a5e[_0xb662('0x2f')],_0x5bd0ad['filters']));if(_0x586a5e[_0xb662('0x2f')]['filter']){_0x39f123[_0xb662('0x38')]=_[_0xb662('0x3a')](_0x39f123['where'],{'$or':_[_0xb662('0x3b')](_0x39f123[_0xb662('0x32')],function(_0x31fad2){var _0x3c5895={};_0x3c5895[_0x31fad2]={'$like':'%'+_0x586a5e[_0xb662('0x2f')][_0xb662('0x3e')]+'%'};return _0x3c5895;})});}_0x39f123=_['merge']({},_0x39f123,_0x586a5e[_0xb662('0x3f')]);return _0x137b01[_0xb662('0x51')](_0x39f123);}})['then'](function(_0x204153){if(_0x204153){_0x288af4=_0x204153[_0xb662('0x34')];if(!_0x586a5e[_0xb662('0x2f')][_0xb662('0x4f')](_0xb662('0x35'))){_0x39f123['limit']=qs[_0xb662('0x20')](_0x586a5e[_0xb662('0x2f')][_0xb662('0x20')]);_0x39f123['offset']=qs[_0xb662('0x1d')](_0x586a5e[_0xb662('0x2f')][_0xb662('0x1d')]);}return _0x137b01['getDescriptions'](_0x39f123);}})[_0xb662('0x25')](function(_0x524b2d){if(_0x524b2d){return _0x524b2d?{'count':_0x288af4,'rows':_0x524b2d}:null;}})[_0xb662('0x25')](respondWithResult(_0x32f573,null))[_0xb662('0x43')](handleError(_0x32f573,null));};
\ No newline at end of file
+var _0x494c=['ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ServicenowConfiguration','findAll','rows','catch','params','includeAll','include','find','create','body','getFields','findOne','ServicenowField','getSubjects','getDescriptions','rimraf','fast-json-patch','request-promise','bluebird','sox'];(function(_0xd9e15f,_0x23f21f){var _0x551355=function(_0x4dca13){while(--_0x4dca13){_0xd9e15f['push'](_0xd9e15f['shift']());}};_0x551355(++_0x23f21f);}(_0x494c,0xe2));var _0xc494=function(_0x233379,_0x2790f8){_0x233379=_0x233379-0x0;var _0x562ec1=_0x494c[_0x233379];return _0x562ec1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc494('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc494('0x1'));var rp=require(_0xc494('0x2'));var moment=require('moment');var BPromise=require(_0xc494('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc494('0x4'));var csv=require('to-csv');var ejs=require(_0xc494('0x5'));var fs=require('fs');var fs_extra=require(_0xc494('0x6'));var _=require(_0xc494('0x7'));var squel=require(_0xc494('0x8'));var crypto=require('crypto');var jsforce=require(_0xc494('0x9'));var deskjs=require(_0xc494('0xa'));var toCsv=require(_0xc494('0xb'));var querystring=require(_0xc494('0xc'));var Papa=require(_0xc494('0xd'));var Redis=require('ioredis');var authService=require(_0xc494('0xe'));var qs=require(_0xc494('0xf'));var as=require(_0xc494('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc494('0x11'));var utils=require(_0xc494('0x12'));var config=require(_0xc494('0x13'));var licenseUtil=require(_0xc494('0x14'));var db=require(_0xc494('0x15'))['db'];function respondWithStatusCode(_0x272be6,_0x13b4db){_0x13b4db=_0x13b4db||0xcc;return function(_0xa65f4a){if(_0xa65f4a){return _0x272be6[_0xc494('0x16')](_0x13b4db);}return _0x272be6['status'](_0x13b4db)['end']();};}function respondWithResult(_0x36cdcd,_0x4ab3dc){_0x4ab3dc=_0x4ab3dc||0xc8;return function(_0x4b49b2){if(_0x4b49b2){return _0x36cdcd[_0xc494('0x17')](_0x4ab3dc)[_0xc494('0x18')](_0x4b49b2);}};}function respondWithFilteredResult(_0x375efd,_0x525512){return function(_0xd4c13d){if(_0xd4c13d){var _0x20d011=typeof _0x525512[_0xc494('0x19')]===_0xc494('0x1a')&&typeof _0x525512[_0xc494('0x1b')]===_0xc494('0x1a');var _0x55854a=_0xd4c13d[_0xc494('0x1c')];var _0x39db94=_0x20d011?0x0:_0x525512[_0xc494('0x19')];var _0x50346c=_0x20d011?_0xd4c13d[_0xc494('0x1c')]:_0x525512[_0xc494('0x19')]+_0x525512['limit'];var _0x254995;if(_0x50346c>=_0x55854a){_0x50346c=_0x55854a;_0x254995=0xc8;}else{_0x254995=0xce;}_0x375efd[_0xc494('0x17')](_0x254995);return _0x375efd[_0xc494('0x1d')](_0xc494('0x1e'),_0x39db94+'-'+_0x50346c+'/'+_0x55854a)[_0xc494('0x18')](_0xd4c13d);}return null;};}function patchUpdates(_0x5c71da){return function(_0x2fd633){try{jsonpatch[_0xc494('0x1f')](_0x2fd633,_0x5c71da,!![]);}catch(_0x226637){return BPromise[_0xc494('0x20')](_0x226637);}return _0x2fd633[_0xc494('0x21')]();};}function saveUpdates(_0x14a680,_0x226060){return function(_0x3f7f01){if(_0x3f7f01){return _0x3f7f01[_0xc494('0x22')](_0x14a680)[_0xc494('0x23')](function(_0x1af272){return _0x1af272;});}return null;};}function removeEntity(_0x34bb2a,_0x304385){return function(_0xa6a72){if(_0xa6a72){return _0xa6a72[_0xc494('0x24')]()[_0xc494('0x23')](function(){_0x34bb2a[_0xc494('0x17')](0xcc)[_0xc494('0x25')]();});}};}function handleEntityNotFound(_0x72812e,_0x40a167){return function(_0x1bc4c2){if(!_0x1bc4c2){_0x72812e['sendStatus'](0x194);}return _0x1bc4c2;};}function handleError(_0x32dd86,_0x15b061){_0x15b061=_0x15b061||0x1f4;return function(_0x34e8bd){logger['error'](_0x34e8bd['stack']);if(_0x34e8bd[_0xc494('0x26')]){delete _0x34e8bd[_0xc494('0x26')];}_0x32dd86[_0xc494('0x17')](_0x15b061)[_0xc494('0x27')](_0x34e8bd);};}exports['index']=function(_0x390c6c,_0xff6dab){var _0x1ad1b5={},_0x5d06fc={},_0xd94eff={'count':0x0,'rows':[]};var _0x4abd24=_[_0xc494('0x28')](db['ServicenowConfiguration'][_0xc494('0x29')],function(_0xc080b2){return{'name':_0xc080b2[_0xc494('0x2a')],'type':_0xc080b2[_0xc494('0x2b')]['key']};});_0x5d06fc[_0xc494('0x2c')]=_[_0xc494('0x28')](_0x4abd24,_0xc494('0x26'));_0x5d06fc[_0xc494('0x2d')]=_[_0xc494('0x2e')](_0x390c6c[_0xc494('0x2d')]);_0x5d06fc[_0xc494('0x2f')]=_['intersection'](_0x5d06fc[_0xc494('0x2c')],_0x5d06fc[_0xc494('0x2d')]);_0x1ad1b5['attributes']=_[_0xc494('0x30')](_0x5d06fc[_0xc494('0x2c')],qs[_0xc494('0x31')](_0x390c6c[_0xc494('0x2d')][_0xc494('0x31')]));_0x1ad1b5[_0xc494('0x32')]=_0x1ad1b5[_0xc494('0x32')][_0xc494('0x33')]?_0x1ad1b5[_0xc494('0x32')]:_0x5d06fc['model'];if(!_0x390c6c[_0xc494('0x2d')][_0xc494('0x34')](_0xc494('0x35'))){_0x1ad1b5[_0xc494('0x1b')]=qs[_0xc494('0x1b')](_0x390c6c[_0xc494('0x2d')][_0xc494('0x1b')]);_0x1ad1b5[_0xc494('0x19')]=qs['offset'](_0x390c6c[_0xc494('0x2d')][_0xc494('0x19')]);}_0x1ad1b5[_0xc494('0x36')]=qs[_0xc494('0x37')](_0x390c6c[_0xc494('0x2d')]['sort']);_0x1ad1b5[_0xc494('0x38')]=qs[_0xc494('0x2f')](_[_0xc494('0x39')](_0x390c6c['query'],_0x5d06fc[_0xc494('0x2f')]),_0x4abd24);if(_0x390c6c[_0xc494('0x2d')][_0xc494('0x3a')]){_0x1ad1b5['where']=_[_0xc494('0x3b')](_0x1ad1b5['where'],{'$or':_[_0xc494('0x28')](_0x4abd24,function(_0x26535e){if(_0x26535e['type']!==_0xc494('0x3c')){var _0x307515={};_0x307515[_0x26535e['name']]={'$like':'%'+_0x390c6c[_0xc494('0x2d')][_0xc494('0x3a')]+'%'};return _0x307515;}})});}_0x1ad1b5=_['merge']({},_0x1ad1b5,_0x390c6c[_0xc494('0x3d')]);var _0x3bec58={'where':_0x1ad1b5[_0xc494('0x38')]};return db[_0xc494('0x3e')][_0xc494('0x1c')](_0x3bec58)[_0xc494('0x23')](function(_0x403e1b){_0xd94eff['count']=_0x403e1b;if(_0x390c6c[_0xc494('0x2d')]['includeAll']){_0x1ad1b5['include']=[{'all':!![]}];}return db[_0xc494('0x3e')][_0xc494('0x3f')](_0x1ad1b5);})[_0xc494('0x23')](function(_0xc064cd){_0xd94eff[_0xc494('0x40')]=_0xc064cd;return _0xd94eff;})['then'](respondWithFilteredResult(_0xff6dab,_0x1ad1b5))[_0xc494('0x41')](handleError(_0xff6dab,null));};exports['show']=function(_0x4153f7,_0x271121){var _0x3a057a={'raw':![],'where':{'id':_0x4153f7[_0xc494('0x42')]['id']}},_0x4532c8={};_0x4532c8['model']=_[_0xc494('0x2e')](db[_0xc494('0x3e')][_0xc494('0x29')]);_0x4532c8[_0xc494('0x2d')]=_[_0xc494('0x2e')](_0x4153f7[_0xc494('0x2d')]);_0x4532c8[_0xc494('0x2f')]=_[_0xc494('0x30')](_0x4532c8[_0xc494('0x2c')],_0x4532c8[_0xc494('0x2d')]);_0x3a057a[_0xc494('0x32')]=_[_0xc494('0x30')](_0x4532c8[_0xc494('0x2c')],qs[_0xc494('0x31')](_0x4153f7[_0xc494('0x2d')]['fields']));_0x3a057a[_0xc494('0x32')]=_0x3a057a[_0xc494('0x32')][_0xc494('0x33')]?_0x3a057a[_0xc494('0x32')]:_0x4532c8[_0xc494('0x2c')];if(_0x4153f7[_0xc494('0x2d')][_0xc494('0x43')]){_0x3a057a[_0xc494('0x44')]=[{'all':!![]}];}_0x3a057a=_['merge']({},_0x3a057a,_0x4153f7[_0xc494('0x3d')]);return db['ServicenowConfiguration'][_0xc494('0x45')](_0x3a057a)[_0xc494('0x23')](handleEntityNotFound(_0x271121,null))[_0xc494('0x23')](respondWithResult(_0x271121,null))[_0xc494('0x41')](handleError(_0x271121,null));};exports[_0xc494('0x46')]=function(_0x1fb8f7,_0x579bb8){return db[_0xc494('0x3e')]['create'](_0x1fb8f7[_0xc494('0x47')],{})[_0xc494('0x23')](respondWithResult(_0x579bb8,0xc9))[_0xc494('0x41')](handleError(_0x579bb8,null));};exports['update']=function(_0x26c357,_0x287ad2){if(_0x26c357['body']['id']){delete _0x26c357['body']['id'];}return db[_0xc494('0x3e')][_0xc494('0x45')]({'where':{'id':_0x26c357['params']['id']}})[_0xc494('0x23')](handleEntityNotFound(_0x287ad2,null))['then'](saveUpdates(_0x26c357[_0xc494('0x47')],null))['then'](respondWithResult(_0x287ad2,null))[_0xc494('0x41')](handleError(_0x287ad2,null));};exports[_0xc494('0x24')]=function(_0x4f78a1,_0x3077ad){return db[_0xc494('0x3e')][_0xc494('0x45')]({'where':{'id':_0x4f78a1[_0xc494('0x42')]['id']}})[_0xc494('0x23')](handleEntityNotFound(_0x3077ad,null))[_0xc494('0x23')](removeEntity(_0x3077ad,null))[_0xc494('0x41')](handleError(_0x3077ad,null));};exports[_0xc494('0x48')]=function(_0x186552,_0x482c36,_0x4f77d1){var _0x1bac03={};var _0x44681d={};var _0x7f1445;var _0x3fb2ff;return db['ServicenowConfiguration'][_0xc494('0x49')]({'where':{'id':_0x186552['params']['id']}})['then'](handleEntityNotFound(_0x482c36,null))[_0xc494('0x23')](function(_0x57bb90){if(_0x57bb90){_0x7f1445=_0x57bb90;_0x44681d[_0xc494('0x2c')]=_['keys'](db[_0xc494('0x4a')][_0xc494('0x29')]);_0x44681d[_0xc494('0x2d')]=_[_0xc494('0x2e')](_0x186552[_0xc494('0x2d')]);_0x44681d[_0xc494('0x2f')]=_[_0xc494('0x30')](_0x44681d[_0xc494('0x2c')],_0x44681d['query']);_0x1bac03[_0xc494('0x32')]=_['intersection'](_0x44681d[_0xc494('0x2c')],qs['fields'](_0x186552[_0xc494('0x2d')][_0xc494('0x31')]));_0x1bac03[_0xc494('0x32')]=_0x1bac03[_0xc494('0x32')]['length']?_0x1bac03['attributes']:_0x44681d[_0xc494('0x2c')];_0x1bac03[_0xc494('0x36')]=qs[_0xc494('0x37')](_0x186552['query'][_0xc494('0x37')]);_0x1bac03[_0xc494('0x38')]=qs['filters'](_['pick'](_0x186552[_0xc494('0x2d')],_0x44681d['filters']));if(_0x186552[_0xc494('0x2d')]['filter']){_0x1bac03[_0xc494('0x38')]=_['merge'](_0x1bac03['where'],{'$or':_[_0xc494('0x28')](_0x1bac03[_0xc494('0x32')],function(_0x453092){var _0x59d02e={};_0x59d02e[_0x453092]={'$like':'%'+_0x186552[_0xc494('0x2d')][_0xc494('0x3a')]+'%'};return _0x59d02e;})});}_0x1bac03=_[_0xc494('0x3b')]({},_0x1bac03,_0x186552[_0xc494('0x3d')]);return _0x7f1445[_0xc494('0x48')](_0x1bac03);}})[_0xc494('0x23')](function(_0x5cf7ee){if(_0x5cf7ee){_0x3fb2ff=_0x5cf7ee[_0xc494('0x33')];if(!_0x186552[_0xc494('0x2d')][_0xc494('0x34')](_0xc494('0x35'))){_0x1bac03['limit']=qs[_0xc494('0x1b')](_0x186552['query']['limit']);_0x1bac03['offset']=qs[_0xc494('0x19')](_0x186552[_0xc494('0x2d')]['offset']);}return _0x7f1445['getFields'](_0x1bac03);}})[_0xc494('0x23')](function(_0x146fcb){if(_0x146fcb){return _0x146fcb?{'count':_0x3fb2ff,'rows':_0x146fcb}:null;}})['then'](respondWithResult(_0x482c36,null))[_0xc494('0x41')](handleError(_0x482c36,null));};exports[_0xc494('0x4b')]=function(_0x50dfe6,_0x188aec,_0x264601){var _0x45fb91={};var _0x3ee8ec={};var _0x2c9ffa;var _0x4102bf;return db[_0xc494('0x3e')][_0xc494('0x49')]({'where':{'id':_0x50dfe6['params']['id']}})[_0xc494('0x23')](handleEntityNotFound(_0x188aec,null))['then'](function(_0x39e9be){if(_0x39e9be){_0x2c9ffa=_0x39e9be;_0x3ee8ec['model']=_[_0xc494('0x2e')](db[_0xc494('0x4a')][_0xc494('0x29')]);_0x3ee8ec[_0xc494('0x2d')]=_[_0xc494('0x2e')](_0x50dfe6[_0xc494('0x2d')]);_0x3ee8ec['filters']=_['intersection'](_0x3ee8ec['model'],_0x3ee8ec['query']);_0x45fb91[_0xc494('0x32')]=_[_0xc494('0x30')](_0x3ee8ec['model'],qs[_0xc494('0x31')](_0x50dfe6['query'][_0xc494('0x31')]));_0x45fb91[_0xc494('0x32')]=_0x45fb91['attributes'][_0xc494('0x33')]?_0x45fb91[_0xc494('0x32')]:_0x3ee8ec['model'];_0x45fb91[_0xc494('0x36')]=qs[_0xc494('0x37')](_0x50dfe6[_0xc494('0x2d')][_0xc494('0x37')]);_0x45fb91[_0xc494('0x38')]=qs['filters'](_[_0xc494('0x39')](_0x50dfe6[_0xc494('0x2d')],_0x3ee8ec[_0xc494('0x2f')]));if(_0x50dfe6['query'][_0xc494('0x3a')]){_0x45fb91[_0xc494('0x38')]=_[_0xc494('0x3b')](_0x45fb91[_0xc494('0x38')],{'$or':_[_0xc494('0x28')](_0x45fb91[_0xc494('0x32')],function(_0x49fdb5){var _0x1d0b72={};_0x1d0b72[_0x49fdb5]={'$like':'%'+_0x50dfe6[_0xc494('0x2d')][_0xc494('0x3a')]+'%'};return _0x1d0b72;})});}_0x45fb91=_[_0xc494('0x3b')]({},_0x45fb91,_0x50dfe6[_0xc494('0x3d')]);return _0x2c9ffa[_0xc494('0x4b')](_0x45fb91);}})['then'](function(_0x413bf0){if(_0x413bf0){_0x4102bf=_0x413bf0[_0xc494('0x33')];if(!_0x50dfe6[_0xc494('0x2d')][_0xc494('0x34')](_0xc494('0x35'))){_0x45fb91[_0xc494('0x1b')]=qs['limit'](_0x50dfe6['query'][_0xc494('0x1b')]);_0x45fb91[_0xc494('0x19')]=qs['offset'](_0x50dfe6['query'][_0xc494('0x19')]);}return _0x2c9ffa[_0xc494('0x4b')](_0x45fb91);}})['then'](function(_0x351eef){if(_0x351eef){return _0x351eef?{'count':_0x4102bf,'rows':_0x351eef}:null;}})[_0xc494('0x23')](respondWithResult(_0x188aec,null))[_0xc494('0x41')](handleError(_0x188aec,null));};exports[_0xc494('0x4c')]=function(_0x381eaa,_0x5617e8,_0x578aa4){var _0x3d8a7b={};var _0x3441c9={};var _0x2aaf01;var _0x83f525;return db['ServicenowConfiguration'][_0xc494('0x49')]({'where':{'id':_0x381eaa[_0xc494('0x42')]['id']}})[_0xc494('0x23')](handleEntityNotFound(_0x5617e8,null))[_0xc494('0x23')](function(_0x4ab3e7){if(_0x4ab3e7){_0x2aaf01=_0x4ab3e7;_0x3441c9[_0xc494('0x2c')]=_['keys'](db[_0xc494('0x4a')][_0xc494('0x29')]);_0x3441c9['query']=_['keys'](_0x381eaa[_0xc494('0x2d')]);_0x3441c9[_0xc494('0x2f')]=_[_0xc494('0x30')](_0x3441c9['model'],_0x3441c9[_0xc494('0x2d')]);_0x3d8a7b[_0xc494('0x32')]=_['intersection'](_0x3441c9[_0xc494('0x2c')],qs[_0xc494('0x31')](_0x381eaa[_0xc494('0x2d')][_0xc494('0x31')]));_0x3d8a7b[_0xc494('0x32')]=_0x3d8a7b['attributes']['length']?_0x3d8a7b[_0xc494('0x32')]:_0x3441c9[_0xc494('0x2c')];_0x3d8a7b[_0xc494('0x36')]=qs['sort'](_0x381eaa[_0xc494('0x2d')][_0xc494('0x37')]);_0x3d8a7b['where']=qs[_0xc494('0x2f')](_[_0xc494('0x39')](_0x381eaa['query'],_0x3441c9[_0xc494('0x2f')]));if(_0x381eaa[_0xc494('0x2d')][_0xc494('0x3a')]){_0x3d8a7b['where']=_[_0xc494('0x3b')](_0x3d8a7b['where'],{'$or':_[_0xc494('0x28')](_0x3d8a7b[_0xc494('0x32')],function(_0x3ad1d7){var _0x202b3f={};_0x202b3f[_0x3ad1d7]={'$like':'%'+_0x381eaa[_0xc494('0x2d')]['filter']+'%'};return _0x202b3f;})});}_0x3d8a7b=_['merge']({},_0x3d8a7b,_0x381eaa[_0xc494('0x3d')]);return _0x2aaf01['getDescriptions'](_0x3d8a7b);}})[_0xc494('0x23')](function(_0x3947cb){if(_0x3947cb){_0x83f525=_0x3947cb[_0xc494('0x33')];if(!_0x381eaa[_0xc494('0x2d')][_0xc494('0x34')]('nolimit')){_0x3d8a7b[_0xc494('0x1b')]=qs[_0xc494('0x1b')](_0x381eaa[_0xc494('0x2d')][_0xc494('0x1b')]);_0x3d8a7b[_0xc494('0x19')]=qs[_0xc494('0x19')](_0x381eaa[_0xc494('0x2d')][_0xc494('0x19')]);}return _0x2aaf01['getDescriptions'](_0x3d8a7b);}})[_0xc494('0x23')](function(_0x49117b){if(_0x49117b){return _0x49117b?{'count':_0x83f525,'rows':_0x49117b}:null;}})[_0xc494('0x23')](respondWithResult(_0x5617e8,null))[_0xc494('0x41')](handleError(_0x5617e8,null));};
\ No newline at end of file
index 6df887b..4ebf1e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5800=['ServicenowConfiguration','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x3e3bee,_0x4f91fe){var _0x3ae14c=function(_0x3861a0){while(--_0x3861a0){_0x3e3bee['push'](_0x3e3bee['shift']());}};_0x3ae14c(++_0x4f91fe);}(_0x5800,0x1b9));var _0x0580=function(_0x2a776d,_0x3afa70){_0x2a776d=_0x2a776d-0x0;var _0x4e4aba=_0x5800[_0x2a776d];return _0x4e4aba;};'use strict';var _=require('lodash');var util=require(_0x0580('0x0'));var logger=require(_0x0580('0x1'))(_0x0580('0x2'));var moment=require(_0x0580('0x3'));var BPromise=require('bluebird');var rp=require(_0x0580('0x4'));var fs=require('fs');var path=require(_0x0580('0x5'));var rimraf=require('rimraf');var config=require(_0x0580('0x6'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x36e61e,_0xe05a43){return _0x36e61e['define'](_0x0580('0x7'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa149=['exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes'];(function(_0x21d943,_0x18d218){var _0x53d10b=function(_0x262521){while(--_0x262521){_0x21d943['push'](_0x21d943['shift']());}};_0x53d10b(++_0x18d218);}(_0xa149,0x18c));var _0x9a14=function(_0x5f457d,_0xcaefe1){_0x5f457d=_0x5f457d-0x0;var _0x24187a=_0xa149[_0x5f457d];return _0x24187a;};'use strict';var _=require(_0x9a14('0x0'));var util=require(_0x9a14('0x1'));var logger=require(_0x9a14('0x2'))(_0x9a14('0x3'));var moment=require(_0x9a14('0x4'));var BPromise=require(_0x9a14('0x5'));var rp=require(_0x9a14('0x6'));var fs=require('fs');var path=require(_0x9a14('0x7'));var rimraf=require(_0x9a14('0x8'));var config=require('../../config/environment');var attributes=require(_0x9a14('0x9'));module[_0x9a14('0xa')]=function(_0x5abb12,_0x417648){return _0x5abb12[_0x9a14('0xb')](_0x9a14('0xc'),attributes,{'tableName':_0x9a14('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ff30386..b4627ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf62d=['request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x352eca,_0x3f5a47){var _0x94ec9a=function(_0x772bd4){while(--_0x772bd4){_0x352eca['push'](_0x352eca['shift']());}};_0x94ec9a(++_0x3f5a47);}(_0xf62d,0x1c0));var _0xdf62=function(_0x4ce613,_0x1884ce){_0x4ce613=_0x4ce613-0x0;var _0x413bbf=_0xf62d[_0x4ce613];return _0x413bbf;};'use strict';var _=require(_0xdf62('0x0'));var util=require(_0xdf62('0x1'));var moment=require('moment');var BPromise=require(_0xdf62('0x2'));var rs=require(_0xdf62('0x3'));var fs=require('fs');var Redis=require(_0xdf62('0x4'));var db=require(_0xdf62('0x5'))['db'];var utils=require(_0xdf62('0x6'));var logger=require(_0xdf62('0x7'))(_0xdf62('0x8'));var config=require(_0xdf62('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x300ef4,_0x5e7e30,_0x36d742){return new BPromise(function(_0x100182,_0xfcbcc1){return client[_0xdf62('0xa')](_0x300ef4,_0x36d742)[_0xdf62('0xb')](function(_0x2b7ab1){logger[_0xdf62('0xc')](_0xdf62('0xd'),_0x5e7e30,_0xdf62('0xe'));logger['debug'](_0xdf62('0xf'),_0x5e7e30,'request\x20sent',JSON[_0xdf62('0x10')](_0x2b7ab1));if(_0x2b7ab1['error']){if(_0x2b7ab1[_0xdf62('0x11')][_0xdf62('0x12')]===0x1f4){logger[_0xdf62('0x11')](_0xdf62('0xd'),_0x5e7e30,_0x2b7ab1[_0xdf62('0x11')][_0xdf62('0x13')]);return _0xfcbcc1(_0x2b7ab1['error'][_0xdf62('0x13')]);}logger[_0xdf62('0x11')](_0xdf62('0xd'),_0x5e7e30,_0x2b7ab1[_0xdf62('0x11')]['message']);return _0x100182(_0x2b7ab1['error'][_0xdf62('0x13')]);}else{logger['info'](_0xdf62('0xd'),_0x5e7e30,_0xdf62('0xe'));_0x100182(_0x2b7ab1[_0xdf62('0x14')][_0xdf62('0x13')]);}})['catch'](function(_0x47cb3a){logger[_0xdf62('0x11')](_0xdf62('0xd'),_0x5e7e30,_0x47cb3a);_0xfcbcc1(_0x47cb3a);});});}
\ No newline at end of file
+var _0x803f=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x401fb4,_0x104039){var _0x425b3=function(_0x17d707){while(--_0x17d707){_0x401fb4['push'](_0x401fb4['shift']());}};_0x425b3(++_0x104039);}(_0x803f,0x144));var _0xf803=function(_0x365f51,_0x3535a0){_0x365f51=_0x365f51-0x0;var _0x3faced=_0x803f[_0x365f51];return _0x3faced;};'use strict';var _=require('lodash');var util=require(_0xf803('0x0'));var moment=require(_0xf803('0x1'));var BPromise=require(_0xf803('0x2'));var rs=require(_0xf803('0x3'));var fs=require('fs');var Redis=require(_0xf803('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf803('0x5'));var logger=require(_0xf803('0x6'))(_0xf803('0x7'));var config=require(_0xf803('0x8'));var jayson=require(_0xf803('0x9'));var client=jayson[_0xf803('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5413,_0x4291f2,_0x43ea35){return new BPromise(function(_0x38ebfe,_0x56ab14){return client['request'](_0x2b5413,_0x43ea35)[_0xf803('0xb')](function(_0x58620e){logger[_0xf803('0xc')](_0xf803('0xd'),_0x4291f2,'request\x20sent');logger[_0xf803('0xe')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4291f2,_0xf803('0xf'),JSON['stringify'](_0x58620e));if(_0x58620e['error']){if(_0x58620e[_0xf803('0x10')]['code']===0x1f4){logger['error'](_0xf803('0xd'),_0x4291f2,_0x58620e[_0xf803('0x10')][_0xf803('0x11')]);return _0x56ab14(_0x58620e['error'][_0xf803('0x11')]);}logger[_0xf803('0x10')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4291f2,_0x58620e['error'][_0xf803('0x11')]);return _0x38ebfe(_0x58620e[_0xf803('0x10')][_0xf803('0x11')]);}else{logger[_0xf803('0xc')](_0xf803('0xd'),_0x4291f2,_0xf803('0xf'));_0x38ebfe(_0x58620e['result'][_0xf803('0x11')]);}})['catch'](function(_0x27338a){logger[_0xf803('0x10')](_0xf803('0xd'),_0x4291f2,_0x27338a);_0x56ab14(_0x27338a);});});}
\ No newline at end of file
index ea575f2..648cdfb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7a1=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','show','put','isAuthenticated'];(function(_0x3a59b7,_0x1d807d){var _0x54ccbf=function(_0x54c870){while(--_0x54c870){_0x3a59b7['push'](_0x3a59b7['shift']());}};_0x54ccbf(++_0x1d807d);}(_0xd7a1,0xe8));var _0x1d7a=function(_0xc2d873,_0x4d39da){_0xc2d873=_0xc2d873-0x0;var _0x40bf3e=_0xd7a1[_0xc2d873];return _0x40bf3e;};'use strict';var multer=require(_0x1d7a('0x0'));var util=require(_0x1d7a('0x1'));var path=require(_0x1d7a('0x2'));var timeout=require(_0x1d7a('0x3'));var express=require(_0x1d7a('0x4'));var router=express['Router']();var fs_extra=require(_0x1d7a('0x5'));var auth=require(_0x1d7a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1d7a('0x7'));var controller=require(_0x1d7a('0x8'));router[_0x1d7a('0x9')]('/',auth['isAuthenticated'](),controller[_0x1d7a('0xa')]);router[_0x1d7a('0x9')](_0x1d7a('0xb'),auth['isAuthenticated'](),controller[_0x1d7a('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1d7a('0xd')](_0x1d7a('0xb'),auth[_0x1d7a('0xe')](),controller[_0x1d7a('0xf')]);router[_0x1d7a('0x10')](_0x1d7a('0xb'),auth[_0x1d7a('0xe')](),controller[_0x1d7a('0x11')]);module[_0x1d7a('0x12')]=router;
\ No newline at end of file
+var _0x1e7a=['multer','util','path','Router','fs-extra','../../components/auth/service','./intServicenowField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x3dfd88,_0x5b3996){var _0x4ee798=function(_0x3c8e46){while(--_0x3c8e46){_0x3dfd88['push'](_0x3dfd88['shift']());}};_0x4ee798(++_0x5b3996);}(_0x1e7a,0x17c));var _0xa1e7=function(_0x1ef80e,_0x31b114){_0x1ef80e=_0x1ef80e-0x0;var _0x4e3b06=_0x1e7a[_0x1ef80e];return _0x4e3b06;};'use strict';var multer=require(_0xa1e7('0x0'));var util=require(_0xa1e7('0x1'));var path=require(_0xa1e7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa1e7('0x3')]();var fs_extra=require(_0xa1e7('0x4'));var auth=require(_0xa1e7('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa1e7('0x6'));router['get']('/',auth[_0xa1e7('0x7')](),controller[_0xa1e7('0x8')]);router[_0xa1e7('0x9')](_0xa1e7('0xa'),auth[_0xa1e7('0x7')](),controller[_0xa1e7('0xb')]);router[_0xa1e7('0xc')]('/',auth[_0xa1e7('0x7')](),controller[_0xa1e7('0xd')]);router[_0xa1e7('0xe')](_0xa1e7('0xa'),auth[_0xa1e7('0x7')](),controller[_0xa1e7('0xf')]);router[_0xa1e7('0x10')]('/:id',auth[_0xa1e7('0x7')](),controller[_0xa1e7('0x11')]);module[_0xa1e7('0x12')]=router;
\ No newline at end of file
index 12301c5..81f1888 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2a84=['string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable','keyValue','picklist'];(function(_0x4bed05,_0x3823c7){var _0x5e5f7f=function(_0x7714b0){while(--_0x7714b0){_0x4bed05['push'](_0x4bed05['shift']());}};_0x5e5f7f(++_0x3823c7);}(_0x2a84,0xae));var _0x42a8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x2a84[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x42a8('0x0'));module[_0x42a8('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x42a8('0x2'),_0x42a8('0x3'),_0x42a8('0x4'),_0x42a8('0x5')),'defaultValue':_0x42a8('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x42a8('0x7')]},'keyType':{'type':Sequelize[_0x42a8('0x8')]('string',_0x42a8('0x2'),_0x42a8('0x3'))},'keyContent':{'type':Sequelize[_0x42a8('0x7')]},'idField':{'type':Sequelize[_0x42a8('0x7')]},'nameField':{'type':Sequelize[_0x42a8('0x7')]},'customField':{'type':Sequelize[_0x42a8('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x42a8('0x7')]}};
\ No newline at end of file
+var _0xd47d=['picklist','STRING','ENUM','exports','string','customVariable','keyValue'];(function(_0x4eaf72,_0x306e55){var _0x595136=function(_0x72a57b){while(--_0x72a57b){_0x4eaf72['push'](_0x4eaf72['shift']());}};_0x595136(++_0x306e55);}(_0xd47d,0x1c3));var _0xdd47=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xd47d[_0x2b5eae];return _0x5f3ac9;};'use strict';var Sequelize=require('sequelize');module[_0xdd47('0x0')]={'type':{'type':Sequelize['ENUM'](_0xdd47('0x1'),'variable',_0xdd47('0x2'),_0xdd47('0x3'),_0xdd47('0x4')),'defaultValue':_0xdd47('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdd47('0x5')]},'keyType':{'type':Sequelize[_0xdd47('0x6')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xdd47('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdd47('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdd47('0x5')]}};
\ No newline at end of file
index 4d89a01..c6a8b79 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0728=['merge','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','includeAll','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','map','ServicenowField','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter'];(function(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x0728,0xa7));var _0x8072=function(_0x371ce8,_0x43dee3){_0x371ce8=_0x371ce8-0x0;var _0x1c242c=_0x0728[_0x371ce8];return _0x1c242c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8072('0x0'));var zipdir=require(_0x8072('0x1'));var jsonpatch=require(_0x8072('0x2'));var rp=require(_0x8072('0x3'));var moment=require('moment');var BPromise=require(_0x8072('0x4'));var Mustache=require(_0x8072('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8072('0x6'));var csv=require(_0x8072('0x7'));var ejs=require(_0x8072('0x8'));var fs=require('fs');var fs_extra=require(_0x8072('0x9'));var _=require(_0x8072('0xa'));var squel=require(_0x8072('0xb'));var crypto=require(_0x8072('0xc'));var jsforce=require(_0x8072('0xd'));var deskjs=require(_0x8072('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8072('0xf'));var Papa=require(_0x8072('0x10'));var Redis=require(_0x8072('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8072('0x12'));var as=require(_0x8072('0x13'));var hardwareService=require(_0x8072('0x14'));var logger=require(_0x8072('0x15'))('api');var utils=require(_0x8072('0x16'));var config=require(_0x8072('0x17'));var licenseUtil=require(_0x8072('0x18'));var db=require(_0x8072('0x19'))['db'];function respondWithStatusCode(_0x44e379,_0xa77ef2){_0xa77ef2=_0xa77ef2||0xcc;return function(_0x43d8a8){if(_0x43d8a8){return _0x44e379[_0x8072('0x1a')](_0xa77ef2);}return _0x44e379[_0x8072('0x1b')](_0xa77ef2)[_0x8072('0x1c')]();};}function respondWithResult(_0x4508b9,_0x29cab2){_0x29cab2=_0x29cab2||0xc8;return function(_0x3d9049){if(_0x3d9049){return _0x4508b9[_0x8072('0x1b')](_0x29cab2)[_0x8072('0x1d')](_0x3d9049);}};}function respondWithFilteredResult(_0x371247,_0x1e0dff){return function(_0x37db6f){if(_0x37db6f){var _0x59bf56=typeof _0x1e0dff[_0x8072('0x1e')]===_0x8072('0x1f')&&typeof _0x1e0dff['limit']===_0x8072('0x1f');var _0x4f6d27=_0x37db6f[_0x8072('0x20')];var _0xf97430=_0x59bf56?0x0:_0x1e0dff[_0x8072('0x1e')];var _0x581a27=_0x59bf56?_0x37db6f['count']:_0x1e0dff[_0x8072('0x1e')]+_0x1e0dff[_0x8072('0x21')];var _0x37bd03;if(_0x581a27>=_0x4f6d27){_0x581a27=_0x4f6d27;_0x37bd03=0xc8;}else{_0x37bd03=0xce;}_0x371247['status'](_0x37bd03);return _0x371247[_0x8072('0x22')](_0x8072('0x23'),_0xf97430+'-'+_0x581a27+'/'+_0x4f6d27)['json'](_0x37db6f);}return null;};}function patchUpdates(_0x3df626){return function(_0x15e73f){try{jsonpatch[_0x8072('0x24')](_0x15e73f,_0x3df626,!![]);}catch(_0x21b90b){return BPromise[_0x8072('0x25')](_0x21b90b);}return _0x15e73f[_0x8072('0x26')]();};}function saveUpdates(_0x597123,_0x394f3f){return function(_0x4daaf3){if(_0x4daaf3){return _0x4daaf3[_0x8072('0x27')](_0x597123)[_0x8072('0x28')](function(_0x4f682d){return _0x4f682d;});}return null;};}function removeEntity(_0x5b0711,_0x403b4a){return function(_0x23a230){if(_0x23a230){return _0x23a230['destroy']()['then'](function(){_0x5b0711[_0x8072('0x1b')](0xcc)[_0x8072('0x1c')]();});}};}function handleEntityNotFound(_0x2b0e35,_0x517168){return function(_0x460fee){if(!_0x460fee){_0x2b0e35[_0x8072('0x1a')](0x194);}return _0x460fee;};}function handleError(_0x488344,_0x242550){_0x242550=_0x242550||0x1f4;return function(_0x428951){logger[_0x8072('0x29')](_0x428951['stack']);if(_0x428951['name']){delete _0x428951[_0x8072('0x2a')];}_0x488344['status'](_0x242550)['send'](_0x428951);};}exports[_0x8072('0x2b')]=function(_0x4dcc9a,_0x5e1dd0){var _0x3684a0={},_0x2fc803={},_0x122781={'count':0x0,'rows':[]};var _0xc7b870=_[_0x8072('0x2c')](db[_0x8072('0x2d')]['rawAttributes'],function(_0x47d95d){return{'name':_0x47d95d['fieldName'],'type':_0x47d95d[_0x8072('0x2e')][_0x8072('0x2f')]};});_0x2fc803[_0x8072('0x30')]=_[_0x8072('0x2c')](_0xc7b870,'name');_0x2fc803['query']=_[_0x8072('0x31')](_0x4dcc9a['query']);_0x2fc803[_0x8072('0x32')]=_[_0x8072('0x33')](_0x2fc803['model'],_0x2fc803[_0x8072('0x34')]);_0x3684a0[_0x8072('0x35')]=_['intersection'](_0x2fc803[_0x8072('0x30')],qs[_0x8072('0x36')](_0x4dcc9a[_0x8072('0x34')]['fields']));_0x3684a0[_0x8072('0x35')]=_0x3684a0[_0x8072('0x35')]['length']?_0x3684a0[_0x8072('0x35')]:_0x2fc803[_0x8072('0x30')];if(!_0x4dcc9a[_0x8072('0x34')][_0x8072('0x37')](_0x8072('0x38'))){_0x3684a0['limit']=qs[_0x8072('0x21')](_0x4dcc9a[_0x8072('0x34')][_0x8072('0x21')]);_0x3684a0[_0x8072('0x1e')]=qs[_0x8072('0x1e')](_0x4dcc9a[_0x8072('0x34')][_0x8072('0x1e')]);}_0x3684a0['order']=qs['sort'](_0x4dcc9a[_0x8072('0x34')][_0x8072('0x39')]);_0x3684a0[_0x8072('0x3a')]=qs['filters'](_[_0x8072('0x3b')](_0x4dcc9a[_0x8072('0x34')],_0x2fc803[_0x8072('0x32')]),_0xc7b870);if(_0x4dcc9a[_0x8072('0x34')][_0x8072('0x3c')]){_0x3684a0['where']=_[_0x8072('0x3d')](_0x3684a0['where'],{'$or':_[_0x8072('0x2c')](_0xc7b870,function(_0x16dddb){if(_0x16dddb['type']!==_0x8072('0x3e')){var _0x562230={};_0x562230[_0x16dddb[_0x8072('0x2a')]]={'$like':'%'+_0x4dcc9a[_0x8072('0x34')][_0x8072('0x3c')]+'%'};return _0x562230;}})});}_0x3684a0=_[_0x8072('0x3d')]({},_0x3684a0,_0x4dcc9a[_0x8072('0x3f')]);var _0xab3462={'where':_0x3684a0[_0x8072('0x3a')]};return db['ServicenowField'][_0x8072('0x20')](_0xab3462)['then'](function(_0x13889d){_0x122781[_0x8072('0x20')]=_0x13889d;if(_0x4dcc9a[_0x8072('0x34')]['includeAll']){_0x3684a0[_0x8072('0x40')]=[{'all':!![]}];}return db[_0x8072('0x2d')][_0x8072('0x41')](_0x3684a0);})[_0x8072('0x28')](function(_0x5bbbca){_0x122781[_0x8072('0x42')]=_0x5bbbca;return _0x122781;})[_0x8072('0x28')](respondWithFilteredResult(_0x5e1dd0,_0x3684a0))[_0x8072('0x43')](handleError(_0x5e1dd0,null));};exports[_0x8072('0x44')]=function(_0x52c25c,_0x51a6b4){var _0x48fa80={'raw':!![],'where':{'id':_0x52c25c['params']['id']}},_0xb1fbd4={};_0xb1fbd4[_0x8072('0x30')]=_['keys'](db[_0x8072('0x2d')][_0x8072('0x45')]);_0xb1fbd4[_0x8072('0x34')]=_[_0x8072('0x31')](_0x52c25c['query']);_0xb1fbd4[_0x8072('0x32')]=_['intersection'](_0xb1fbd4[_0x8072('0x30')],_0xb1fbd4[_0x8072('0x34')]);_0x48fa80[_0x8072('0x35')]=_[_0x8072('0x33')](_0xb1fbd4['model'],qs[_0x8072('0x36')](_0x52c25c[_0x8072('0x34')][_0x8072('0x36')]));_0x48fa80['attributes']=_0x48fa80['attributes']['length']?_0x48fa80[_0x8072('0x35')]:_0xb1fbd4[_0x8072('0x30')];if(_0x52c25c[_0x8072('0x34')][_0x8072('0x46')]){_0x48fa80['include']=[{'all':!![]}];}_0x48fa80=_[_0x8072('0x3d')]({},_0x48fa80,_0x52c25c[_0x8072('0x3f')]);return db[_0x8072('0x2d')][_0x8072('0x47')](_0x48fa80)[_0x8072('0x28')](handleEntityNotFound(_0x51a6b4,null))[_0x8072('0x28')](respondWithResult(_0x51a6b4,null))[_0x8072('0x43')](handleError(_0x51a6b4,null));};exports[_0x8072('0x48')]=function(_0x8b2f6f,_0x517f43){return db[_0x8072('0x2d')][_0x8072('0x48')](_0x8b2f6f['body'],{})[_0x8072('0x28')](respondWithResult(_0x517f43,0xc9))[_0x8072('0x43')](handleError(_0x517f43,null));};exports['update']=function(_0x404deb,_0x1eef8a){if(_0x404deb[_0x8072('0x49')]['id']){delete _0x404deb[_0x8072('0x49')]['id'];}return db['ServicenowField'][_0x8072('0x47')]({'where':{'id':_0x404deb[_0x8072('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1eef8a,null))['then'](saveUpdates(_0x404deb[_0x8072('0x49')],null))[_0x8072('0x28')](respondWithResult(_0x1eef8a,null))['catch'](handleError(_0x1eef8a,null));};exports[_0x8072('0x4b')]=function(_0x53e3a4,_0x36ed2c){return db[_0x8072('0x2d')][_0x8072('0x47')]({'where':{'id':_0x53e3a4['params']['id']}})[_0x8072('0x28')](handleEntityNotFound(_0x36ed2c,null))['then'](removeEntity(_0x36ed2c,null))[_0x8072('0x43')](handleError(_0x36ed2c,null));};
\ No newline at end of file
+var _0x2de2=['json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','ServicenowField','includeAll','include','findAll','catch','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x2de2,0x1ea));var _0x22de=function(_0x24fadb,_0x44f4a5){_0x24fadb=_0x24fadb-0x0;var _0x20c332=_0x2de2[_0x24fadb];return _0x20c332;};'use strict';var emlformat=require(_0x22de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x22de('0x1'));var rp=require(_0x22de('0x2'));var moment=require(_0x22de('0x3'));var BPromise=require(_0x22de('0x4'));var Mustache=require(_0x22de('0x5'));var util=require('util');var path=require(_0x22de('0x6'));var sox=require('sox');var csv=require(_0x22de('0x7'));var ejs=require(_0x22de('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x22de('0x9'));var squel=require(_0x22de('0xa'));var crypto=require(_0x22de('0xb'));var jsforce=require(_0x22de('0xc'));var deskjs=require(_0x22de('0xd'));var toCsv=require(_0x22de('0x7'));var querystring=require(_0x22de('0xe'));var Papa=require('papaparse');var Redis=require(_0x22de('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x22de('0x10'));var as=require(_0x22de('0x11'));var hardwareService=require(_0x22de('0x12'));var logger=require(_0x22de('0x13'))(_0x22de('0x14'));var utils=require(_0x22de('0x15'));var config=require(_0x22de('0x16'));var licenseUtil=require(_0x22de('0x17'));var db=require(_0x22de('0x18'))['db'];function respondWithStatusCode(_0x209f15,_0x2135c1){_0x2135c1=_0x2135c1||0xcc;return function(_0x349a88){if(_0x349a88){return _0x209f15[_0x22de('0x19')](_0x2135c1);}return _0x209f15['status'](_0x2135c1)[_0x22de('0x1a')]();};}function respondWithResult(_0x40dfb6,_0x37060c){_0x37060c=_0x37060c||0xc8;return function(_0x40f8a7){if(_0x40f8a7){return _0x40dfb6[_0x22de('0x1b')](_0x37060c)[_0x22de('0x1c')](_0x40f8a7);}};}function respondWithFilteredResult(_0x2eaff3,_0x4dd5b2){return function(_0x3e7580){if(_0x3e7580){var _0x33a01d=typeof _0x4dd5b2[_0x22de('0x1d')]===_0x22de('0x1e')&&typeof _0x4dd5b2[_0x22de('0x1f')]===_0x22de('0x1e');var _0x21f0d5=_0x3e7580['count'];var _0x2e7ec7=_0x33a01d?0x0:_0x4dd5b2[_0x22de('0x1d')];var _0x1b82f9=_0x33a01d?_0x3e7580[_0x22de('0x20')]:_0x4dd5b2[_0x22de('0x1d')]+_0x4dd5b2[_0x22de('0x1f')];var _0x2392cd;if(_0x1b82f9>=_0x21f0d5){_0x1b82f9=_0x21f0d5;_0x2392cd=0xc8;}else{_0x2392cd=0xce;}_0x2eaff3[_0x22de('0x1b')](_0x2392cd);return _0x2eaff3[_0x22de('0x21')](_0x22de('0x22'),_0x2e7ec7+'-'+_0x1b82f9+'/'+_0x21f0d5)[_0x22de('0x1c')](_0x3e7580);}return null;};}function patchUpdates(_0x25c46f){return function(_0x29397a){try{jsonpatch['apply'](_0x29397a,_0x25c46f,!![]);}catch(_0x493897){return BPromise[_0x22de('0x23')](_0x493897);}return _0x29397a[_0x22de('0x24')]();};}function saveUpdates(_0x18fb6f,_0x196acd){return function(_0x40d6a5){if(_0x40d6a5){return _0x40d6a5[_0x22de('0x25')](_0x18fb6f)[_0x22de('0x26')](function(_0x531403){return _0x531403;});}return null;};}function removeEntity(_0x4303ce,_0x5aaff8){return function(_0xf656a5){if(_0xf656a5){return _0xf656a5[_0x22de('0x27')]()[_0x22de('0x26')](function(){_0x4303ce['status'](0xcc)[_0x22de('0x1a')]();});}};}function handleEntityNotFound(_0x444e1a,_0x5973c4){return function(_0x340343){if(!_0x340343){_0x444e1a['sendStatus'](0x194);}return _0x340343;};}function handleError(_0x14d068,_0x9e2d2c){_0x9e2d2c=_0x9e2d2c||0x1f4;return function(_0x55f551){logger[_0x22de('0x28')](_0x55f551[_0x22de('0x29')]);if(_0x55f551[_0x22de('0x2a')]){delete _0x55f551[_0x22de('0x2a')];}_0x14d068[_0x22de('0x1b')](_0x9e2d2c)[_0x22de('0x2b')](_0x55f551);};}exports['index']=function(_0xa78361,_0x4c1d5b){var _0x346ee2={},_0x26670c={},_0x4e220b={'count':0x0,'rows':[]};var _0x1676fa=_[_0x22de('0x2c')](db['ServicenowField'][_0x22de('0x2d')],function(_0x2da20e){return{'name':_0x2da20e[_0x22de('0x2e')],'type':_0x2da20e[_0x22de('0x2f')][_0x22de('0x30')]};});_0x26670c[_0x22de('0x31')]=_[_0x22de('0x2c')](_0x1676fa,'name');_0x26670c[_0x22de('0x32')]=_[_0x22de('0x33')](_0xa78361[_0x22de('0x32')]);_0x26670c[_0x22de('0x34')]=_[_0x22de('0x35')](_0x26670c[_0x22de('0x31')],_0x26670c[_0x22de('0x32')]);_0x346ee2[_0x22de('0x36')]=_['intersection'](_0x26670c[_0x22de('0x31')],qs[_0x22de('0x37')](_0xa78361[_0x22de('0x32')][_0x22de('0x37')]));_0x346ee2[_0x22de('0x36')]=_0x346ee2[_0x22de('0x36')][_0x22de('0x38')]?_0x346ee2['attributes']:_0x26670c[_0x22de('0x31')];if(!_0xa78361[_0x22de('0x32')][_0x22de('0x39')](_0x22de('0x3a'))){_0x346ee2['limit']=qs[_0x22de('0x1f')](_0xa78361[_0x22de('0x32')][_0x22de('0x1f')]);_0x346ee2['offset']=qs['offset'](_0xa78361[_0x22de('0x32')]['offset']);}_0x346ee2[_0x22de('0x3b')]=qs[_0x22de('0x3c')](_0xa78361[_0x22de('0x32')]['sort']);_0x346ee2['where']=qs['filters'](_[_0x22de('0x3d')](_0xa78361['query'],_0x26670c[_0x22de('0x34')]),_0x1676fa);if(_0xa78361[_0x22de('0x32')][_0x22de('0x3e')]){_0x346ee2[_0x22de('0x3f')]=_[_0x22de('0x40')](_0x346ee2[_0x22de('0x3f')],{'$or':_[_0x22de('0x2c')](_0x1676fa,function(_0x4debd1){if(_0x4debd1['type']!=='VIRTUAL'){var _0x312667={};_0x312667[_0x4debd1[_0x22de('0x2a')]]={'$like':'%'+_0xa78361[_0x22de('0x32')][_0x22de('0x3e')]+'%'};return _0x312667;}})});}_0x346ee2=_[_0x22de('0x40')]({},_0x346ee2,_0xa78361[_0x22de('0x41')]);var _0x17f9f3={'where':_0x346ee2['where']};return db[_0x22de('0x42')][_0x22de('0x20')](_0x17f9f3)[_0x22de('0x26')](function(_0x4fdfd9){_0x4e220b[_0x22de('0x20')]=_0x4fdfd9;if(_0xa78361['query'][_0x22de('0x43')]){_0x346ee2[_0x22de('0x44')]=[{'all':!![]}];}return db[_0x22de('0x42')][_0x22de('0x45')](_0x346ee2);})[_0x22de('0x26')](function(_0x32034a){_0x4e220b['rows']=_0x32034a;return _0x4e220b;})[_0x22de('0x26')](respondWithFilteredResult(_0x4c1d5b,_0x346ee2))[_0x22de('0x46')](handleError(_0x4c1d5b,null));};exports['show']=function(_0x18aa3d,_0x711631){var _0x1556d7={'raw':!![],'where':{'id':_0x18aa3d['params']['id']}},_0x500f58={};_0x500f58[_0x22de('0x31')]=_['keys'](db[_0x22de('0x42')][_0x22de('0x2d')]);_0x500f58[_0x22de('0x32')]=_[_0x22de('0x33')](_0x18aa3d[_0x22de('0x32')]);_0x500f58['filters']=_['intersection'](_0x500f58[_0x22de('0x31')],_0x500f58[_0x22de('0x32')]);_0x1556d7[_0x22de('0x36')]=_[_0x22de('0x35')](_0x500f58[_0x22de('0x31')],qs[_0x22de('0x37')](_0x18aa3d[_0x22de('0x32')]['fields']));_0x1556d7['attributes']=_0x1556d7[_0x22de('0x36')]['length']?_0x1556d7[_0x22de('0x36')]:_0x500f58[_0x22de('0x31')];if(_0x18aa3d[_0x22de('0x32')][_0x22de('0x43')]){_0x1556d7[_0x22de('0x44')]=[{'all':!![]}];}_0x1556d7=_['merge']({},_0x1556d7,_0x18aa3d['options']);return db['ServicenowField']['find'](_0x1556d7)[_0x22de('0x26')](handleEntityNotFound(_0x711631,null))[_0x22de('0x26')](respondWithResult(_0x711631,null))[_0x22de('0x46')](handleError(_0x711631,null));};exports[_0x22de('0x47')]=function(_0x4b9f56,_0x58e3e4){return db[_0x22de('0x42')][_0x22de('0x47')](_0x4b9f56['body'],{})[_0x22de('0x26')](respondWithResult(_0x58e3e4,0xc9))['catch'](handleError(_0x58e3e4,null));};exports[_0x22de('0x25')]=function(_0x5e279a,_0x176a75){if(_0x5e279a[_0x22de('0x48')]['id']){delete _0x5e279a[_0x22de('0x48')]['id'];}return db['ServicenowField'][_0x22de('0x49')]({'where':{'id':_0x5e279a['params']['id']}})[_0x22de('0x26')](handleEntityNotFound(_0x176a75,null))['then'](saveUpdates(_0x5e279a[_0x22de('0x48')],null))['then'](respondWithResult(_0x176a75,null))['catch'](handleError(_0x176a75,null));};exports[_0x22de('0x27')]=function(_0x485bfd,_0x5ec97b){return db[_0x22de('0x42')]['find']({'where':{'id':_0x485bfd['params']['id']}})[_0x22de('0x26')](handleEntityNotFound(_0x5ec97b,null))[_0x22de('0x26')](removeEntity(_0x5ec97b,null))[_0x22de('0x46')](handleError(_0x5ec97b,null));};
\ No newline at end of file
index f8123a2..34a41a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4bd0=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','servicenow_unique_index','idField','lodash','../../config/logger'];(function(_0x1a4c27,_0x5a4b45){var _0x578d9=function(_0x10b6df){while(--_0x10b6df){_0x1a4c27['push'](_0x1a4c27['shift']());}};_0x578d9(++_0x5a4b45);}(_0x4bd0,0x15d));var _0x04bd=function(_0x29b974,_0x4d7e73){_0x29b974=_0x29b974-0x0;var _0x33e066=_0x4bd0[_0x29b974];return _0x33e066;};'use strict';var _=require(_0x04bd('0x0'));var util=require('util');var logger=require(_0x04bd('0x1'))(_0x04bd('0x2'));var moment=require(_0x04bd('0x3'));var BPromise=require(_0x04bd('0x4'));var rp=require(_0x04bd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x04bd('0x6'));var config=require(_0x04bd('0x7'));var attributes=require(_0x04bd('0x8'));module['exports']=function(_0x1dcf13,_0x585d43){return _0x1dcf13[_0x04bd('0x9')](_0x04bd('0xa'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x04bd('0xb'),'fields':[_0x04bd('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x6aaa=['request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5ed09b,_0x450339){var _0x5b0d7e=function(_0xa57214){while(--_0xa57214){_0x5ed09b['push'](_0x5ed09b['shift']());}};_0x5b0d7e(++_0x450339);}(_0x6aaa,0x95));var _0xa6aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6aaa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa6aa('0x0'));var util=require('util');var logger=require(_0xa6aa('0x1'))(_0xa6aa('0x2'));var moment=require(_0xa6aa('0x3'));var BPromise=require(_0xa6aa('0x4'));var rp=require(_0xa6aa('0x5'));var fs=require('fs');var path=require(_0xa6aa('0x6'));var rimraf=require(_0xa6aa('0x7'));var config=require(_0xa6aa('0x8'));var attributes=require(_0xa6aa('0x9'));module['exports']=function(_0xe9a812,_0x567e71){return _0xe9a812['define'](_0xa6aa('0xa'),attributes,{'tableName':_0xa6aa('0xb'),'paranoid':![],'indexes':[{'name':_0xa6aa('0xc'),'fields':[_0xa6aa('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 772d376..3e6d9a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ffd=['ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','debug'];(function(_0x545e3a,_0x10081a){var _0x1036b4=function(_0x282b5f){while(--_0x282b5f){_0x545e3a['push'](_0x545e3a['shift']());}};_0x1036b4(++_0x10081a);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x52fb99,_0x4273c3){_0x52fb99=_0x52fb99-0x0;var _0x47edd4=_0x9ffd[_0x52fb99];return _0x47edd4;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var moment=require(_0xd9ff('0x2'));var BPromise=require('bluebird');var rs=require(_0xd9ff('0x3'));var fs=require('fs');var Redis=require(_0xd9ff('0x4'));var db=require(_0xd9ff('0x5'))['db'];var utils=require(_0xd9ff('0x6'));var logger=require('../../config/logger')(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd9ff('0x9')][_0xd9ff('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13ea8c,_0x270eb2,_0x45c60a){return new BPromise(function(_0x66282d,_0x13954e){return client[_0xd9ff('0xb')](_0x13ea8c,_0x45c60a)[_0xd9ff('0xc')](function(_0x58e728){logger['info']('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');logger[_0xd9ff('0xd')](_0xd9ff('0xe'),_0x270eb2,_0xd9ff('0xf'),JSON[_0xd9ff('0x10')](_0x58e728));if(_0x58e728[_0xd9ff('0x11')]){if(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x12')]===0x1f4){logger[_0xd9ff('0x11')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x13954e(_0x58e728[_0xd9ff('0x11')][_0xd9ff('0x13')]);}logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x58e728['error'][_0xd9ff('0x13')]);return _0x66282d(_0x58e728[_0xd9ff('0x11')]['message']);}else{logger[_0xd9ff('0x15')]('ServicenowField,\x20%s,\x20%s',_0x270eb2,'request\x20sent');_0x66282d(_0x58e728['result']['message']);}})[_0xd9ff('0x16')](function(_0x4f9d6d){logger[_0xd9ff('0x11')](_0xd9ff('0x14'),_0x270eb2,_0x4f9d6d);_0x13954e(_0x4f9d6d);});});}
\ No newline at end of file
+var _0x70e0=['code','ServicenowField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2e8c25,_0x3cb7bf){var _0x7b2bb8=function(_0x4dbe7c){while(--_0x4dbe7c){_0x2e8c25['push'](_0x2e8c25['shift']());}};_0x7b2bb8(++_0x3cb7bf);}(_0x70e0,0x17b));var _0x070e=function(_0x41f0a8,_0x353ac9){_0x41f0a8=_0x41f0a8-0x0;var _0x2ba36e=_0x70e0[_0x41f0a8];return _0x2ba36e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});}
\ No newline at end of file
index e887a09..49f767f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x579d63,_0x54fd81){var _0x22d9ab=function(_0x56fcec){while(--_0x56fcec){_0x579d63['push'](_0x579d63['shift']());}};_0x22d9ab(++_0x54fd81);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router;
\ No newline at end of file
+var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x1d7265,_0x3c4c51){var _0x22ef7f=function(_0x5bfad8){while(--_0x5bfad8){_0x1d7265['push'](_0x1d7265['shift']());}};_0x22ef7f(++_0x3c4c51);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router;
\ No newline at end of file
index 197ae02..63ba32e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x4e007f,_0x336b77){var _0x469968=function(_0x178e25){while(--_0x178e25){_0x4e007f['push'](_0x4e007f['shift']());}};_0x469968(++_0x336b77);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3c5426,_0x36dc83){var _0x356e36=function(_0x1e874c){while(--_0x1e874c){_0x3c5426['push'](_0x3c5426['shift']());}};_0x356e36(++_0x36dc83);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}};
\ No newline at end of file
index be3082d..22b9a9b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d45=['apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','SugarcrmAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','filter','merge','map','VIRTUAL','options','findAll','rows','catch','show','params','keys','includeAll','include','create','body','find','getConfigurations','SugarcrmConfiguration','sort','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','created_by','description','duration_hours','duration_minutes','parent_id','parent_name','direction','findOne','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count'];(function(_0x1bf3a5,_0xecfdcb){var _0x2b8735=function(_0x4b9b2f){while(--_0x4b9b2f){_0x1bf3a5['push'](_0x1bf3a5['shift']());}};_0x2b8735(++_0xecfdcb);}(_0x6d45,0xd0));var _0x56d4=function(_0x48e72b,_0x3eac48){_0x48e72b=_0x48e72b-0x0;var _0xdafda1=_0x6d45[_0x48e72b];return _0xdafda1;};'use strict';var emlformat=require(_0x56d4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x56d4('0x1'));var jsonpatch=require(_0x56d4('0x2'));var rp=require(_0x56d4('0x3'));var moment=require(_0x56d4('0x4'));var BPromise=require(_0x56d4('0x5'));var Mustache=require(_0x56d4('0x6'));var util=require(_0x56d4('0x7'));var path=require(_0x56d4('0x8'));var sox=require(_0x56d4('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x56d4('0xa'));var crypto=require(_0x56d4('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56d4('0xc'));var Redis=require(_0x56d4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x56d4('0xe'));var as=require(_0x56d4('0xf'));var hardwareService=require(_0x56d4('0x10'));var logger=require(_0x56d4('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x56d4('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x56d4('0x13'))['db'];var integrations=require(_0x56d4('0x14'));function respondWithStatusCode(_0x1bea5b,_0x128201){_0x128201=_0x128201||0xcc;return function(_0x10a571){if(_0x10a571){return _0x1bea5b['sendStatus'](_0x128201);}return _0x1bea5b[_0x56d4('0x15')](_0x128201)[_0x56d4('0x16')]();};}function respondWithResult(_0x3baf8f,_0x3464c3){_0x3464c3=_0x3464c3||0xc8;return function(_0x1b7aff){if(_0x1b7aff){return _0x3baf8f[_0x56d4('0x15')](_0x3464c3)[_0x56d4('0x17')](_0x1b7aff);}};}function respondWithFilteredResult(_0x1d5d50,_0x27915c){return function(_0x4c63a5){if(_0x4c63a5){var _0x191f5f=typeof _0x27915c[_0x56d4('0x18')]===_0x56d4('0x19')&&typeof _0x27915c[_0x56d4('0x1a')]===_0x56d4('0x19');var _0x4e22aa=_0x4c63a5[_0x56d4('0x1b')];var _0x18aee7=_0x191f5f?0x0:_0x27915c[_0x56d4('0x18')];var _0x18c622=_0x191f5f?_0x4c63a5[_0x56d4('0x1b')]:_0x27915c[_0x56d4('0x18')]+_0x27915c[_0x56d4('0x1a')];var _0x3a7607;if(_0x18c622>=_0x4e22aa){_0x18c622=_0x4e22aa;_0x3a7607=0xc8;}else{_0x3a7607=0xce;}_0x1d5d50[_0x56d4('0x15')](_0x3a7607);return _0x1d5d50['set']('Content-Range',_0x18aee7+'-'+_0x18c622+'/'+_0x4e22aa)[_0x56d4('0x17')](_0x4c63a5);}return null;};}function patchUpdates(_0x150a3c){return function(_0x4bd2c7){try{jsonpatch[_0x56d4('0x1c')](_0x4bd2c7,_0x150a3c,!![]);}catch(_0x407580){return BPromise[_0x56d4('0x1d')](_0x407580);}return _0x4bd2c7[_0x56d4('0x1e')]();};}function saveUpdates(_0x512e61,_0x51bf5c){return function(_0x20d9f4){if(_0x20d9f4){return _0x20d9f4[_0x56d4('0x1f')](_0x512e61)[_0x56d4('0x20')](function(_0x37ea7c){return _0x37ea7c;});}return null;};}function removeEntity(_0x52f2b4,_0x5299a4){return function(_0x1d2266){if(_0x1d2266){return _0x1d2266[_0x56d4('0x21')]()['then'](function(){_0x52f2b4[_0x56d4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x490121,_0x12d3fe){return function(_0x86f56d){if(!_0x86f56d){_0x490121[_0x56d4('0x22')](0x194);}return _0x86f56d;};}function handleError(_0x491e9a,_0xd19ba){_0xd19ba=_0xd19ba||0x1f4;return function(_0x4846a5){logger['error'](_0x4846a5[_0x56d4('0x23')]);if(_0x4846a5[_0x56d4('0x24')]){delete _0x4846a5[_0x56d4('0x24')];}_0x491e9a[_0x56d4('0x15')](_0xd19ba)[_0x56d4('0x25')](_0x4846a5);};}exports[_0x56d4('0x26')]=function(_0x469a26,_0x5d2c3b){var _0x30c899={},_0x4327fd={},_0x23bf6b={'count':0x0,'rows':[]};var _0x59d019=_['map'](db[_0x56d4('0x27')][_0x56d4('0x28')],function(_0x45e6b6){return{'name':_0x45e6b6['fieldName'],'type':_0x45e6b6[_0x56d4('0x29')][_0x56d4('0x2a')]};});_0x4327fd[_0x56d4('0x2b')]=_['map'](_0x59d019,_0x56d4('0x24'));_0x4327fd[_0x56d4('0x2c')]=_['keys'](_0x469a26[_0x56d4('0x2c')]);_0x4327fd['filters']=_[_0x56d4('0x2d')](_0x4327fd[_0x56d4('0x2b')],_0x4327fd['query']);_0x30c899[_0x56d4('0x2e')]=_['intersection'](_0x4327fd[_0x56d4('0x2b')],qs[_0x56d4('0x2f')](_0x469a26['query'][_0x56d4('0x2f')]));_0x30c899['attributes']=_0x30c899[_0x56d4('0x2e')][_0x56d4('0x30')]?_0x30c899['attributes']:_0x4327fd[_0x56d4('0x2b')];if(!_0x469a26[_0x56d4('0x2c')][_0x56d4('0x31')](_0x56d4('0x32'))){_0x30c899['limit']=qs['limit'](_0x469a26['query']['limit']);_0x30c899[_0x56d4('0x18')]=qs['offset'](_0x469a26[_0x56d4('0x2c')][_0x56d4('0x18')]);}_0x30c899[_0x56d4('0x33')]=qs['sort'](_0x469a26[_0x56d4('0x2c')]['sort']);_0x30c899[_0x56d4('0x34')]=qs['filters'](_['pick'](_0x469a26[_0x56d4('0x2c')],_0x4327fd[_0x56d4('0x35')]),_0x59d019);if(_0x469a26[_0x56d4('0x2c')][_0x56d4('0x36')]){_0x30c899['where']=_[_0x56d4('0x37')](_0x30c899['where'],{'$or':_[_0x56d4('0x38')](_0x59d019,function(_0x46059d){if(_0x46059d[_0x56d4('0x29')]!==_0x56d4('0x39')){var _0x5df1e9={};_0x5df1e9[_0x46059d[_0x56d4('0x24')]]={'$like':'%'+_0x469a26[_0x56d4('0x2c')][_0x56d4('0x36')]+'%'};return _0x5df1e9;}})});}_0x30c899=_[_0x56d4('0x37')]({},_0x30c899,_0x469a26[_0x56d4('0x3a')]);var _0x4782b4={'where':_0x30c899[_0x56d4('0x34')]};return db[_0x56d4('0x27')][_0x56d4('0x1b')](_0x4782b4)[_0x56d4('0x20')](function(_0x4a7cf7){_0x23bf6b['count']=_0x4a7cf7;if(_0x469a26['query']['includeAll']){_0x30c899['include']=[{'all':!![]}];}return db[_0x56d4('0x27')][_0x56d4('0x3b')](_0x30c899);})[_0x56d4('0x20')](function(_0x1ce853){_0x23bf6b[_0x56d4('0x3c')]=_0x1ce853;return _0x23bf6b;})[_0x56d4('0x20')](respondWithFilteredResult(_0x5d2c3b,_0x30c899))[_0x56d4('0x3d')](handleError(_0x5d2c3b,null));};exports[_0x56d4('0x3e')]=function(_0x16f5fa,_0xbd0f13){var _0x59bf26={'raw':![],'where':{'id':_0x16f5fa[_0x56d4('0x3f')]['id']}},_0x2542ab={};_0x2542ab[_0x56d4('0x2b')]=_[_0x56d4('0x40')](db['SugarcrmAccount'][_0x56d4('0x28')]);_0x2542ab[_0x56d4('0x2c')]=_['keys'](_0x16f5fa[_0x56d4('0x2c')]);_0x2542ab[_0x56d4('0x35')]=_[_0x56d4('0x2d')](_0x2542ab[_0x56d4('0x2b')],_0x2542ab['query']);_0x59bf26[_0x56d4('0x2e')]=_[_0x56d4('0x2d')](_0x2542ab[_0x56d4('0x2b')],qs[_0x56d4('0x2f')](_0x16f5fa[_0x56d4('0x2c')]['fields']));_0x59bf26[_0x56d4('0x2e')]=_0x59bf26[_0x56d4('0x2e')]['length']?_0x59bf26[_0x56d4('0x2e')]:_0x2542ab['model'];if(_0x16f5fa[_0x56d4('0x2c')][_0x56d4('0x41')]){_0x59bf26[_0x56d4('0x42')]=[{'all':!![]}];}_0x59bf26=_[_0x56d4('0x37')]({},_0x59bf26,_0x16f5fa['options']);return db['SugarcrmAccount']['find'](_0x59bf26)['then'](handleEntityNotFound(_0xbd0f13,null))[_0x56d4('0x20')](respondWithResult(_0xbd0f13,null))[_0x56d4('0x3d')](handleError(_0xbd0f13,null));};exports[_0x56d4('0x43')]=function(_0x212785,_0x1f274c){return db[_0x56d4('0x27')][_0x56d4('0x43')](_0x212785['body'],{})['then'](respondWithResult(_0x1f274c,0xc9))[_0x56d4('0x3d')](handleError(_0x1f274c,null));};exports[_0x56d4('0x1f')]=function(_0x55b0ea,_0x367b1c){if(_0x55b0ea[_0x56d4('0x44')]['id']){delete _0x55b0ea[_0x56d4('0x44')]['id'];}return db[_0x56d4('0x27')][_0x56d4('0x45')]({'where':{'id':_0x55b0ea[_0x56d4('0x3f')]['id']}})[_0x56d4('0x20')](handleEntityNotFound(_0x367b1c,null))['then'](saveUpdates(_0x55b0ea[_0x56d4('0x44')],null))[_0x56d4('0x20')](respondWithResult(_0x367b1c,null))[_0x56d4('0x3d')](handleError(_0x367b1c,null));};exports[_0x56d4('0x21')]=function(_0x1db316,_0x16a928){return db['SugarcrmAccount'][_0x56d4('0x45')]({'where':{'id':_0x1db316['params']['id']}})[_0x56d4('0x20')](handleEntityNotFound(_0x16a928,null))[_0x56d4('0x20')](removeEntity(_0x16a928,null))[_0x56d4('0x3d')](handleError(_0x16a928,null));};exports[_0x56d4('0x46')]=function(_0x8a4f58,_0x341ce1,_0x4696dc){var _0xbcc6ca={};var _0x4cb63f={};var _0x3b394d;var _0x1b964c;return db[_0x56d4('0x27')]['findOne']({'where':{'id':_0x8a4f58[_0x56d4('0x3f')]['id']}})[_0x56d4('0x20')](handleEntityNotFound(_0x341ce1,null))['then'](function(_0x51413a){if(_0x51413a){_0x3b394d=_0x51413a;_0x4cb63f[_0x56d4('0x2b')]=_[_0x56d4('0x40')](db[_0x56d4('0x47')][_0x56d4('0x28')]);_0x4cb63f[_0x56d4('0x2c')]=_['keys'](_0x8a4f58['query']);_0x4cb63f['filters']=_[_0x56d4('0x2d')](_0x4cb63f[_0x56d4('0x2b')],_0x4cb63f[_0x56d4('0x2c')]);_0xbcc6ca['attributes']=_[_0x56d4('0x2d')](_0x4cb63f['model'],qs[_0x56d4('0x2f')](_0x8a4f58[_0x56d4('0x2c')]['fields']));_0xbcc6ca[_0x56d4('0x2e')]=_0xbcc6ca[_0x56d4('0x2e')][_0x56d4('0x30')]?_0xbcc6ca[_0x56d4('0x2e')]:_0x4cb63f[_0x56d4('0x2b')];_0xbcc6ca[_0x56d4('0x33')]=qs['sort'](_0x8a4f58[_0x56d4('0x2c')][_0x56d4('0x48')]);_0xbcc6ca[_0x56d4('0x34')]=qs[_0x56d4('0x35')](_[_0x56d4('0x49')](_0x8a4f58[_0x56d4('0x2c')],_0x4cb63f[_0x56d4('0x35')]));if(_0x8a4f58[_0x56d4('0x2c')][_0x56d4('0x36')]){_0xbcc6ca[_0x56d4('0x34')]=_['merge'](_0xbcc6ca[_0x56d4('0x34')],{'$or':_[_0x56d4('0x38')](_0xbcc6ca[_0x56d4('0x2e')],function(_0x4083ac){var _0x936ed9={};_0x936ed9[_0x4083ac]={'$like':'%'+_0x8a4f58[_0x56d4('0x2c')][_0x56d4('0x36')]+'%'};return _0x936ed9;})});}_0xbcc6ca=_[_0x56d4('0x37')]({},_0xbcc6ca,_0x8a4f58[_0x56d4('0x3a')]);return _0x3b394d[_0x56d4('0x46')](_0xbcc6ca);}})[_0x56d4('0x20')](function(_0x131653){if(_0x131653){_0x1b964c=_0x131653[_0x56d4('0x30')];if(!_0x8a4f58[_0x56d4('0x2c')]['hasOwnProperty']('nolimit')){_0xbcc6ca['limit']=qs['limit'](_0x8a4f58[_0x56d4('0x2c')][_0x56d4('0x1a')]);_0xbcc6ca[_0x56d4('0x18')]=qs[_0x56d4('0x18')](_0x8a4f58[_0x56d4('0x2c')]['offset']);}return _0x3b394d[_0x56d4('0x46')](_0xbcc6ca);}})[_0x56d4('0x20')](function(_0x18ef8e){if(_0x18ef8e){return _0x18ef8e?{'count':_0x1b964c,'rows':_0x18ef8e}:null;}})[_0x56d4('0x20')](respondWithResult(_0x341ce1,null))[_0x56d4('0x3d')](handleError(_0x341ce1,null));};exports[_0x56d4('0x4a')]=function(_0x25fddf,_0x602348,_0x15d02c){if(_0x25fddf[_0x56d4('0x44')]['id']){delete _0x25fddf[_0x56d4('0x44')]['id'];}return db[_0x56d4('0x27')]['findOne']({'where':{'id':_0x25fddf[_0x56d4('0x3f')]['id']}})[_0x56d4('0x20')](handleEntityNotFound(_0x602348,null))['then'](function(_0x4c8435){if(_0x4c8435){_0x25fddf[_0x56d4('0x44')][_0x56d4('0x4b')]=_0x4c8435['id'];_0x25fddf[_0x56d4('0x44')][_0x56d4('0x4c')]=integrations[_0x56d4('0x4d')](_0x25fddf[_0x56d4('0x44')][_0x56d4('0x4e')],_0x25fddf[_0x56d4('0x44')][_0x56d4('0x29')]);_0x25fddf[_0x56d4('0x44')]['Descriptions']=integrations[_0x56d4('0x4f')](_0x25fddf[_0x56d4('0x44')][_0x56d4('0x4e')],_0x25fddf[_0x56d4('0x44')][_0x56d4('0x29')]);return db[_0x56d4('0x47')][_0x56d4('0x43')](_0x25fddf['body'],{'include':[{'model':db[_0x56d4('0x50')],'as':_0x56d4('0x4c')},{'model':db[_0x56d4('0x50')],'as':'Descriptions'}]});}return null;})[_0x56d4('0x20')](respondWithResult(_0x602348,null))[_0x56d4('0x3d')](handleError(_0x602348,null));};exports['getFields']=function(_0x46448c,_0x24b5f0,_0x5a6a10){var _0x4f7ca6='';var _0x3bd96e=['id',_0x56d4('0x24'),'assigned_user_id',_0x56d4('0x51'),_0x56d4('0x52'),'date_start',_0x56d4('0x53'),_0x56d4('0x54'),_0x56d4('0x55'),'parent_type',_0x56d4('0x56'),_0x56d4('0x57')];return db[_0x56d4('0x27')][_0x56d4('0x58')]({'where':{'id':_0x46448c['params']['id']},'attributes':['id',_0x56d4('0x59'),_0x56d4('0x5a'),_0x56d4('0x5b')]})[_0x56d4('0x20')](handleEntityNotFound(_0x24b5f0,null))[_0x56d4('0x20')](function(_0x2b89da){if(_0x2b89da){_0x4f7ca6=_0x2b89da[_0x56d4('0x5b')];var _0x604a68=_0x4f7ca6[_0x56d4('0x5c')](-0x1);if(_0x604a68==='/'){_0x4f7ca6=_0x4f7ca6[_0x56d4('0x5d')](0x0,_0x4f7ca6[_0x56d4('0x5e')](_0x604a68));}return rp({'method':_0x56d4('0x5f'),'uri':util[_0x56d4('0x60')]('%s%s',_0x4f7ca6,'/service/v4_1/rest.php'),'json':!![],'form':{'method':'login','input_type':_0x56d4('0x61'),'response_type':_0x56d4('0x61'),'rest_data':JSON[_0x56d4('0x62')]({'user_auth':{'user_name':_0x2b89da[_0x56d4('0x59')],'password':_0x2b89da[_0x56d4('0x5a')],'encryption':_0x56d4('0x63')},'application':_0x56d4('0x64')})}});}})[_0x56d4('0x20')](function(_0x10e69d){if(_0x10e69d&&_0x10e69d['name']!==_0x56d4('0x65')&&_0x10e69d[_0x56d4('0x24')]!==_0x56d4('0x66')){return rp({'method':_0x56d4('0x5f'),'uri':util[_0x56d4('0x60')]('%s%s',_0x4f7ca6,_0x56d4('0x67')),'json':!![],'form':{'method':_0x56d4('0x68'),'input_type':_0x56d4('0x61'),'response_type':'JSON','rest_data':JSON[_0x56d4('0x62')]({'session':_0x10e69d['id'],'module_name':_0x56d4('0x69')})}})[_0x56d4('0x20')](function(_0x321922){if(_0x321922){var _0x4990dd=_[_0x56d4('0x6a')](_0x321922[_0x56d4('0x6b')]);_[_0x56d4('0x6c')](_0x4990dd,function(_0x174cb9){return _0x3bd96e[_0x56d4('0x6d')](_0x174cb9[_0x56d4('0x24')]);});return{'count':_0x4990dd[_0x56d4('0x30')],'rows':_[_0x56d4('0x38')](_0x4990dd,function(_0xc12262){return{'id':_0xc12262['name'],'name':_0xc12262[_0x56d4('0x6e')],'custom':_[_0x56d4('0x6f')](_0xc12262[_0x56d4('0x24')],'_c')?!![]:![],'options':_0xc12262['options']?_['map'](_[_0x56d4('0x6a')](_0xc12262[_0x56d4('0x3a')]),function(_0x3d448c){return{'name':_0x3d448c[_0x56d4('0x70')],'value':_0x3d448c[_0x56d4('0x24')]};}):[]};})};}})['then'](respondWithResult(_0x24b5f0,null))[_0x56d4('0x3d')](function(_0x525470){var _0x426b8d=_0x46448c[_0x56d4('0x2c')]['test']?0x1f4:_0x525470[_0x56d4('0x71')]||0x1f4;logger['error'](_0x56d4('0x72'),_0x56d4('0x73'),_0x426b8d,JSON['stringify'](_0x525470));delete _0x525470[_0x56d4('0x24')];if(_0x426b8d===0x191){_0x426b8d=0x190;}_0x24b5f0['status'](_0x426b8d)[_0x56d4('0x25')](_0x46448c[_0x56d4('0x2c')][_0x56d4('0x74')]?{'message':_0x56d4('0x75'),'statusCode':_0x525470[_0x56d4('0x71')]}:_0x525470);});}else{var _0x291994=0x1f4;_0x24b5f0[_0x56d4('0x15')](_0x291994)['send']({'message':_0x56d4('0x75'),'statusCode':0x190});}});};
\ No newline at end of file
+var _0x0e2b=['include','findAll','catch','show','merge','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','rawAttributes','addConfiguration','Descriptions','getDescriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','Calls','values','module_fields','remove','includes','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','index','SugarcrmAccount','fieldName','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','options','includeAll'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x0e2b,0x122));var _0xb0e2=function(_0x11ede2,_0x47c7b0){_0x11ede2=_0x11ede2-0x0;var _0x3d937b=_0x0e2b[_0x11ede2];return _0x3d937b;};'use strict';var emlformat=require(_0xb0e2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0e2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb0e2('0x2'));var moment=require(_0xb0e2('0x3'));var BPromise=require(_0xb0e2('0x4'));var Mustache=require(_0xb0e2('0x5'));var util=require('util');var path=require(_0xb0e2('0x6'));var sox=require('sox');var csv=require(_0xb0e2('0x7'));var ejs=require(_0xb0e2('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb0e2('0x9'));var crypto=require(_0xb0e2('0xa'));var jsforce=require(_0xb0e2('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xb0e2('0x7'));var querystring=require(_0xb0e2('0xc'));var Papa=require(_0xb0e2('0xd'));var Redis=require('ioredis');var authService=require(_0xb0e2('0xe'));var qs=require(_0xb0e2('0xf'));var as=require(_0xb0e2('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb0e2('0x11'));var utils=require(_0xb0e2('0x12'));var config=require(_0xb0e2('0x13'));var licenseUtil=require(_0xb0e2('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb0e2('0x15'));function respondWithStatusCode(_0x1b5a00,_0x18d96c){_0x18d96c=_0x18d96c||0xcc;return function(_0x8809d2){if(_0x8809d2){return _0x1b5a00[_0xb0e2('0x16')](_0x18d96c);}return _0x1b5a00[_0xb0e2('0x17')](_0x18d96c)['end']();};}function respondWithResult(_0x2ff7f9,_0x31289e){_0x31289e=_0x31289e||0xc8;return function(_0xba180f){if(_0xba180f){return _0x2ff7f9[_0xb0e2('0x17')](_0x31289e)[_0xb0e2('0x18')](_0xba180f);}};}function respondWithFilteredResult(_0x3a31f0,_0x16b7d6){return function(_0x3e0244){if(_0x3e0244){var _0x229426=typeof _0x16b7d6[_0xb0e2('0x19')]===_0xb0e2('0x1a')&&typeof _0x16b7d6[_0xb0e2('0x1b')]===_0xb0e2('0x1a');var _0x53323f=_0x3e0244[_0xb0e2('0x1c')];var _0x38b3fa=_0x229426?0x0:_0x16b7d6[_0xb0e2('0x19')];var _0x4e2406=_0x229426?_0x3e0244['count']:_0x16b7d6[_0xb0e2('0x19')]+_0x16b7d6[_0xb0e2('0x1b')];var _0x35547d;if(_0x4e2406>=_0x53323f){_0x4e2406=_0x53323f;_0x35547d=0xc8;}else{_0x35547d=0xce;}_0x3a31f0[_0xb0e2('0x17')](_0x35547d);return _0x3a31f0[_0xb0e2('0x1d')](_0xb0e2('0x1e'),_0x38b3fa+'-'+_0x4e2406+'/'+_0x53323f)['json'](_0x3e0244);}return null;};}function patchUpdates(_0x5240a2){return function(_0x48129d){try{jsonpatch['apply'](_0x48129d,_0x5240a2,!![]);}catch(_0x2d2101){return BPromise[_0xb0e2('0x1f')](_0x2d2101);}return _0x48129d['save']();};}function saveUpdates(_0x53581f,_0x2b1b7c){return function(_0x5aab81){if(_0x5aab81){return _0x5aab81[_0xb0e2('0x20')](_0x53581f)[_0xb0e2('0x21')](function(_0x46a2e3){return _0x46a2e3;});}return null;};}function removeEntity(_0x2f34ba,_0x3ea606){return function(_0xd75a78){if(_0xd75a78){return _0xd75a78[_0xb0e2('0x22')]()[_0xb0e2('0x21')](function(){_0x2f34ba[_0xb0e2('0x17')](0xcc)[_0xb0e2('0x23')]();});}};}function handleEntityNotFound(_0x3c92b4,_0x30a99e){return function(_0x203f43){if(!_0x203f43){_0x3c92b4[_0xb0e2('0x16')](0x194);}return _0x203f43;};}function handleError(_0x35b7dc,_0x24911f){_0x24911f=_0x24911f||0x1f4;return function(_0x172d6d){logger[_0xb0e2('0x24')](_0x172d6d[_0xb0e2('0x25')]);if(_0x172d6d[_0xb0e2('0x26')]){delete _0x172d6d[_0xb0e2('0x26')];}_0x35b7dc[_0xb0e2('0x17')](_0x24911f)['send'](_0x172d6d);};}exports[_0xb0e2('0x27')]=function(_0xaece48,_0x26c5ab){var _0x2895a4={},_0x3b1253={},_0x36dd47={'count':0x0,'rows':[]};var _0x22f2f2=_['map'](db[_0xb0e2('0x28')]['rawAttributes'],function(_0x681f37){return{'name':_0x681f37[_0xb0e2('0x29')],'type':_0x681f37['type']['key']};});_0x3b1253['model']=_[_0xb0e2('0x2a')](_0x22f2f2,_0xb0e2('0x26'));_0x3b1253[_0xb0e2('0x2b')]=_[_0xb0e2('0x2c')](_0xaece48[_0xb0e2('0x2b')]);_0x3b1253[_0xb0e2('0x2d')]=_['intersection'](_0x3b1253[_0xb0e2('0x2e')],_0x3b1253[_0xb0e2('0x2b')]);_0x2895a4[_0xb0e2('0x2f')]=_[_0xb0e2('0x30')](_0x3b1253[_0xb0e2('0x2e')],qs[_0xb0e2('0x31')](_0xaece48[_0xb0e2('0x2b')]['fields']));_0x2895a4[_0xb0e2('0x2f')]=_0x2895a4[_0xb0e2('0x2f')][_0xb0e2('0x32')]?_0x2895a4[_0xb0e2('0x2f')]:_0x3b1253['model'];if(!_0xaece48[_0xb0e2('0x2b')][_0xb0e2('0x33')](_0xb0e2('0x34'))){_0x2895a4[_0xb0e2('0x1b')]=qs[_0xb0e2('0x1b')](_0xaece48[_0xb0e2('0x2b')][_0xb0e2('0x1b')]);_0x2895a4['offset']=qs['offset'](_0xaece48[_0xb0e2('0x2b')]['offset']);}_0x2895a4[_0xb0e2('0x35')]=qs['sort'](_0xaece48['query'][_0xb0e2('0x36')]);_0x2895a4[_0xb0e2('0x37')]=qs[_0xb0e2('0x2d')](_[_0xb0e2('0x38')](_0xaece48[_0xb0e2('0x2b')],_0x3b1253[_0xb0e2('0x2d')]),_0x22f2f2);if(_0xaece48[_0xb0e2('0x2b')][_0xb0e2('0x39')]){_0x2895a4['where']=_['merge'](_0x2895a4[_0xb0e2('0x37')],{'$or':_[_0xb0e2('0x2a')](_0x22f2f2,function(_0x348edc){if(_0x348edc[_0xb0e2('0x3a')]!=='VIRTUAL'){var _0x5acaef={};_0x5acaef[_0x348edc[_0xb0e2('0x26')]]={'$like':'%'+_0xaece48['query'][_0xb0e2('0x39')]+'%'};return _0x5acaef;}})});}_0x2895a4=_['merge']({},_0x2895a4,_0xaece48[_0xb0e2('0x3b')]);var _0x1b2952={'where':_0x2895a4[_0xb0e2('0x37')]};return db['SugarcrmAccount'][_0xb0e2('0x1c')](_0x1b2952)[_0xb0e2('0x21')](function(_0x2dd6b3){_0x36dd47[_0xb0e2('0x1c')]=_0x2dd6b3;if(_0xaece48[_0xb0e2('0x2b')][_0xb0e2('0x3c')]){_0x2895a4[_0xb0e2('0x3d')]=[{'all':!![]}];}return db[_0xb0e2('0x28')][_0xb0e2('0x3e')](_0x2895a4);})[_0xb0e2('0x21')](function(_0x34dfdf){_0x36dd47['rows']=_0x34dfdf;return _0x36dd47;})['then'](respondWithFilteredResult(_0x26c5ab,_0x2895a4))[_0xb0e2('0x3f')](handleError(_0x26c5ab,null));};exports[_0xb0e2('0x40')]=function(_0x4de242,_0x2c5788){var _0x505aa3={'raw':![],'where':{'id':_0x4de242['params']['id']}},_0x5003f3={};_0x5003f3['model']=_[_0xb0e2('0x2c')](db['SugarcrmAccount']['rawAttributes']);_0x5003f3['query']=_['keys'](_0x4de242[_0xb0e2('0x2b')]);_0x5003f3[_0xb0e2('0x2d')]=_[_0xb0e2('0x30')](_0x5003f3[_0xb0e2('0x2e')],_0x5003f3[_0xb0e2('0x2b')]);_0x505aa3[_0xb0e2('0x2f')]=_['intersection'](_0x5003f3[_0xb0e2('0x2e')],qs[_0xb0e2('0x31')](_0x4de242['query']['fields']));_0x505aa3[_0xb0e2('0x2f')]=_0x505aa3[_0xb0e2('0x2f')]['length']?_0x505aa3[_0xb0e2('0x2f')]:_0x5003f3[_0xb0e2('0x2e')];if(_0x4de242[_0xb0e2('0x2b')]['includeAll']){_0x505aa3['include']=[{'all':!![]}];}_0x505aa3=_[_0xb0e2('0x41')]({},_0x505aa3,_0x4de242[_0xb0e2('0x3b')]);return db[_0xb0e2('0x28')][_0xb0e2('0x42')](_0x505aa3)[_0xb0e2('0x21')](handleEntityNotFound(_0x2c5788,null))[_0xb0e2('0x21')](respondWithResult(_0x2c5788,null))[_0xb0e2('0x3f')](handleError(_0x2c5788,null));};exports[_0xb0e2('0x43')]=function(_0x1c8f0c,_0x26b36a){return db[_0xb0e2('0x28')]['create'](_0x1c8f0c[_0xb0e2('0x44')],{})[_0xb0e2('0x21')](respondWithResult(_0x26b36a,0xc9))[_0xb0e2('0x3f')](handleError(_0x26b36a,null));};exports[_0xb0e2('0x20')]=function(_0x1603a9,_0x46aba7){if(_0x1603a9['body']['id']){delete _0x1603a9[_0xb0e2('0x44')]['id'];}return db[_0xb0e2('0x28')][_0xb0e2('0x42')]({'where':{'id':_0x1603a9[_0xb0e2('0x45')]['id']}})[_0xb0e2('0x21')](handleEntityNotFound(_0x46aba7,null))['then'](saveUpdates(_0x1603a9[_0xb0e2('0x44')],null))['then'](respondWithResult(_0x46aba7,null))[_0xb0e2('0x3f')](handleError(_0x46aba7,null));};exports['destroy']=function(_0x5ba9e0,_0x3daa0f){return db[_0xb0e2('0x28')][_0xb0e2('0x42')]({'where':{'id':_0x5ba9e0['params']['id']}})['then'](handleEntityNotFound(_0x3daa0f,null))['then'](removeEntity(_0x3daa0f,null))[_0xb0e2('0x3f')](handleError(_0x3daa0f,null));};exports[_0xb0e2('0x46')]=function(_0x3181de,_0x4e14d3,_0x40a9a3){var _0x509b4d={};var _0x11a95e={};var _0x4ad98a;var _0x4b4472;return db[_0xb0e2('0x28')][_0xb0e2('0x47')]({'where':{'id':_0x3181de['params']['id']}})['then'](handleEntityNotFound(_0x4e14d3,null))[_0xb0e2('0x21')](function(_0x37e49c){if(_0x37e49c){_0x4ad98a=_0x37e49c;_0x11a95e['model']=_[_0xb0e2('0x2c')](db[_0xb0e2('0x48')][_0xb0e2('0x49')]);_0x11a95e[_0xb0e2('0x2b')]=_[_0xb0e2('0x2c')](_0x3181de['query']);_0x11a95e[_0xb0e2('0x2d')]=_['intersection'](_0x11a95e[_0xb0e2('0x2e')],_0x11a95e[_0xb0e2('0x2b')]);_0x509b4d[_0xb0e2('0x2f')]=_[_0xb0e2('0x30')](_0x11a95e[_0xb0e2('0x2e')],qs['fields'](_0x3181de[_0xb0e2('0x2b')][_0xb0e2('0x31')]));_0x509b4d[_0xb0e2('0x2f')]=_0x509b4d[_0xb0e2('0x2f')][_0xb0e2('0x32')]?_0x509b4d[_0xb0e2('0x2f')]:_0x11a95e[_0xb0e2('0x2e')];_0x509b4d[_0xb0e2('0x35')]=qs['sort'](_0x3181de['query'][_0xb0e2('0x36')]);_0x509b4d[_0xb0e2('0x37')]=qs['filters'](_[_0xb0e2('0x38')](_0x3181de[_0xb0e2('0x2b')],_0x11a95e[_0xb0e2('0x2d')]));if(_0x3181de['query'][_0xb0e2('0x39')]){_0x509b4d[_0xb0e2('0x37')]=_[_0xb0e2('0x41')](_0x509b4d[_0xb0e2('0x37')],{'$or':_[_0xb0e2('0x2a')](_0x509b4d[_0xb0e2('0x2f')],function(_0x1e922c){var _0x744751={};_0x744751[_0x1e922c]={'$like':'%'+_0x3181de[_0xb0e2('0x2b')][_0xb0e2('0x39')]+'%'};return _0x744751;})});}_0x509b4d=_[_0xb0e2('0x41')]({},_0x509b4d,_0x3181de['options']);return _0x4ad98a[_0xb0e2('0x46')](_0x509b4d);}})['then'](function(_0x344e05){if(_0x344e05){_0x4b4472=_0x344e05[_0xb0e2('0x32')];if(!_0x3181de[_0xb0e2('0x2b')][_0xb0e2('0x33')]('nolimit')){_0x509b4d[_0xb0e2('0x1b')]=qs['limit'](_0x3181de[_0xb0e2('0x2b')][_0xb0e2('0x1b')]);_0x509b4d[_0xb0e2('0x19')]=qs[_0xb0e2('0x19')](_0x3181de['query'][_0xb0e2('0x19')]);}return _0x4ad98a[_0xb0e2('0x46')](_0x509b4d);}})[_0xb0e2('0x21')](function(_0x5dc96c){if(_0x5dc96c){return _0x5dc96c?{'count':_0x4b4472,'rows':_0x5dc96c}:null;}})[_0xb0e2('0x21')](respondWithResult(_0x4e14d3,null))[_0xb0e2('0x3f')](handleError(_0x4e14d3,null));};exports[_0xb0e2('0x4a')]=function(_0x1530f1,_0xe1de64,_0x3cfdcb){if(_0x1530f1[_0xb0e2('0x44')]['id']){delete _0x1530f1[_0xb0e2('0x44')]['id'];}return db[_0xb0e2('0x28')][_0xb0e2('0x47')]({'where':{'id':_0x1530f1[_0xb0e2('0x45')]['id']}})[_0xb0e2('0x21')](handleEntityNotFound(_0xe1de64,null))[_0xb0e2('0x21')](function(_0x3a1213){if(_0x3a1213){_0x1530f1[_0xb0e2('0x44')]['AccountId']=_0x3a1213['id'];_0x1530f1[_0xb0e2('0x44')]['Subjects']=integrations['getSubjects'](_0x1530f1[_0xb0e2('0x44')]['channel'],_0x1530f1[_0xb0e2('0x44')][_0xb0e2('0x3a')]);_0x1530f1[_0xb0e2('0x44')][_0xb0e2('0x4b')]=integrations[_0xb0e2('0x4c')](_0x1530f1['body']['channel'],_0x1530f1[_0xb0e2('0x44')][_0xb0e2('0x3a')]);return db[_0xb0e2('0x48')][_0xb0e2('0x43')](_0x1530f1[_0xb0e2('0x44')],{'include':[{'model':db[_0xb0e2('0x4d')],'as':_0xb0e2('0x4e')},{'model':db['SugarcrmField'],'as':_0xb0e2('0x4b')}]});}return null;})[_0xb0e2('0x21')](respondWithResult(_0xe1de64,null))[_0xb0e2('0x3f')](handleError(_0xe1de64,null));};exports['getFields']=function(_0x5bee44,_0x91cde5,_0x2c3db6){var _0x558b4d='';var _0x5255c1=['id',_0xb0e2('0x26'),_0xb0e2('0x4f'),_0xb0e2('0x50'),_0xb0e2('0x51'),_0xb0e2('0x52'),_0xb0e2('0x53'),_0xb0e2('0x54'),_0xb0e2('0x55'),_0xb0e2('0x56'),_0xb0e2('0x57'),'direction'];return db[_0xb0e2('0x28')][_0xb0e2('0x47')]({'where':{'id':_0x5bee44['params']['id']},'attributes':['id','username',_0xb0e2('0x58'),_0xb0e2('0x59')]})[_0xb0e2('0x21')](handleEntityNotFound(_0x91cde5,null))[_0xb0e2('0x21')](function(_0x45255e){if(_0x45255e){_0x558b4d=_0x45255e[_0xb0e2('0x59')];var _0x1c62c2=_0x558b4d[_0xb0e2('0x5a')](-0x1);if(_0x1c62c2==='/'){_0x558b4d=_0x558b4d[_0xb0e2('0x5b')](0x0,_0x558b4d[_0xb0e2('0x5c')](_0x1c62c2));}return rp({'method':_0xb0e2('0x5d'),'uri':util[_0xb0e2('0x5e')](_0xb0e2('0x5f'),_0x558b4d,_0xb0e2('0x60')),'json':!![],'form':{'method':_0xb0e2('0x61'),'input_type':_0xb0e2('0x62'),'response_type':'JSON','rest_data':JSON[_0xb0e2('0x63')]({'user_auth':{'user_name':_0x45255e['username'],'password':_0x45255e[_0xb0e2('0x58')],'encryption':_0xb0e2('0x64')},'application':_0xb0e2('0x65')})}});}})[_0xb0e2('0x21')](function(_0x9d2aea){if(_0x9d2aea&&_0x9d2aea['name']!==_0xb0e2('0x66')&&_0x9d2aea['name']!==_0xb0e2('0x67')){return rp({'method':'POST','uri':util[_0xb0e2('0x5e')](_0xb0e2('0x5f'),_0x558b4d,_0xb0e2('0x60')),'json':!![],'form':{'method':'get_module_fields','input_type':_0xb0e2('0x62'),'response_type':_0xb0e2('0x62'),'rest_data':JSON['stringify']({'session':_0x9d2aea['id'],'module_name':_0xb0e2('0x68')})}})[_0xb0e2('0x21')](function(_0x5191f2){if(_0x5191f2){var _0x31484=_[_0xb0e2('0x69')](_0x5191f2[_0xb0e2('0x6a')]);_[_0xb0e2('0x6b')](_0x31484,function(_0x300f8a){return _0x5255c1[_0xb0e2('0x6c')](_0x300f8a[_0xb0e2('0x26')]);});return{'count':_0x31484[_0xb0e2('0x32')],'rows':_['map'](_0x31484,function(_0x28293a){return{'id':_0x28293a[_0xb0e2('0x26')],'name':_0x28293a['label'],'custom':_[_0xb0e2('0x6d')](_0x28293a[_0xb0e2('0x26')],'_c')?!![]:![],'options':_0x28293a['options']?_[_0xb0e2('0x2a')](_[_0xb0e2('0x69')](_0x28293a[_0xb0e2('0x3b')]),function(_0x534c14){return{'name':_0x534c14[_0xb0e2('0x6e')],'value':_0x534c14[_0xb0e2('0x26')]};}):[]};})};}})[_0xb0e2('0x21')](respondWithResult(_0x91cde5,null))['catch'](function(_0x21fcf5){var _0x2572ab=_0x5bee44[_0xb0e2('0x2b')][_0xb0e2('0x6f')]?0x1f4:_0x21fcf5[_0xb0e2('0x70')]||0x1f4;logger[_0xb0e2('0x24')](_0xb0e2('0x71'),_0xb0e2('0x72'),_0x2572ab,JSON[_0xb0e2('0x63')](_0x21fcf5));delete _0x21fcf5['name'];if(_0x2572ab===0x191){_0x2572ab=0x190;}_0x91cde5[_0xb0e2('0x17')](_0x2572ab)[_0xb0e2('0x73')](_0x5bee44[_0xb0e2('0x2b')][_0xb0e2('0x6f')]?{'message':_0xb0e2('0x74'),'statusCode':_0x21fcf5['statusCode']}:_0x21fcf5);});}else{var _0x4235ac=0x1f4;_0x91cde5[_0xb0e2('0x17')](_0x4235ac)[_0xb0e2('0x73')]({'message':'Wrong\x20credentials','statusCode':0x190});}});};
\ No newline at end of file
index 435dfee..c057860 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd11c=['../../components/integrations/configuration','exports','define','SugarcrmAccount','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./intSugarcrmAccount.attributes'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xd11c,0x64));var _0xcd11=function(_0x262852,_0x3c8944){_0x262852=_0x262852-0x0;var _0x223499=_0xd11c[_0x262852];return _0x223499;};'use strict';var _=require(_0xcd11('0x0'));var util=require(_0xcd11('0x1'));var logger=require(_0xcd11('0x2'))(_0xcd11('0x3'));var moment=require('moment');var BPromise=require(_0xcd11('0x4'));var rp=require(_0xcd11('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd11('0x6'));var config=require('../../config/environment');var attributes=require(_0xcd11('0x7'));var integrations=require(_0xcd11('0x8'));module[_0xcd11('0x9')]=function(_0x34ecb8,_0x54c958){return _0x34ecb8[_0xcd11('0xa')](_0xcd11('0xb'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2c64=['int_sugarcrm_accounts','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','define','SugarcrmAccount'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0x2c64,0x181));var _0x42c6=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x2c64[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x42c6('0x0'));var util=require(_0x42c6('0x1'));var logger=require('../../config/logger')(_0x42c6('0x2'));var moment=require(_0x42c6('0x3'));var BPromise=require(_0x42c6('0x4'));var rp=require(_0x42c6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x42c6('0x6'));var attributes=require(_0x42c6('0x7'));var integrations=require(_0x42c6('0x8'));module['exports']=function(_0x553bd9,_0x58d2d0){return _0x553bd9[_0x42c6('0x9')](_0x42c6('0xa'),attributes,{'tableName':_0x42c6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a1a255c..0e6459d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c8d=['catch','ShowSugarcrmAccount','SugarcrmAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','stringify','error','SugarcrmAccount,\x20%s,\x20%s','message','result','GetSugarcrmAccount','findAll','options','raw','where','attributes','map','include','model'];(function(_0x4eab11,_0x420bfb){var _0x417a63=function(_0x35f378){while(--_0x35f378){_0x4eab11['push'](_0x4eab11['shift']());}};_0x417a63(++_0x420bfb);}(_0x7c8d,0x6b));var _0xd7c8=function(_0x457bdf,_0xa7fd08){_0x457bdf=_0x457bdf-0x0;var _0xcd434a=_0x7c8d[_0x457bdf];return _0xcd434a;};'use strict';var _=require(_0xd7c8('0x0'));var util=require(_0xd7c8('0x1'));var moment=require(_0xd7c8('0x2'));var BPromise=require(_0xd7c8('0x3'));var rs=require(_0xd7c8('0x4'));var fs=require('fs');var Redis=require(_0xd7c8('0x5'));var db=require(_0xd7c8('0x6'))['db'];var utils=require(_0xd7c8('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xd7c8('0x8'));var jayson=require(_0xd7c8('0x9'));var client=jayson[_0xd7c8('0xa')][_0xd7c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45eb4a,_0x1e31e0,_0x145381){return new BPromise(function(_0x11141d,_0x1ff017){return client['request'](_0x45eb4a,_0x145381)[_0xd7c8('0xc')](function(_0x12f6ab){logger[_0xd7c8('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x1e31e0,'request\x20sent');logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x1e31e0,_0xd7c8('0xe'),JSON[_0xd7c8('0xf')](_0x12f6ab));if(_0x12f6ab['error']){if(_0x12f6ab[_0xd7c8('0x10')]['code']===0x1f4){logger[_0xd7c8('0x10')](_0xd7c8('0x11'),_0x1e31e0,_0x12f6ab['error']['message']);return _0x1ff017(_0x12f6ab[_0xd7c8('0x10')][_0xd7c8('0x12')]);}logger[_0xd7c8('0x10')](_0xd7c8('0x11'),_0x1e31e0,_0x12f6ab[_0xd7c8('0x10')][_0xd7c8('0x12')]);return _0x11141d(_0x12f6ab['error'][_0xd7c8('0x12')]);}else{logger[_0xd7c8('0xd')](_0xd7c8('0x11'),_0x1e31e0,_0xd7c8('0xe'));_0x11141d(_0x12f6ab[_0xd7c8('0x13')][_0xd7c8('0x12')]);}})['catch'](function(_0x338759){logger[_0xd7c8('0x10')](_0xd7c8('0x11'),_0x1e31e0,_0x338759);_0x1ff017(_0x338759);});});}exports[_0xd7c8('0x14')]=function(_0x196b29){var _0x310f58=this;return new Promise(function(_0x20344a,_0x5304a5){return db['SugarcrmAccount'][_0xd7c8('0x15')]({'raw':_0x196b29[_0xd7c8('0x16')]?_0x196b29['options'][_0xd7c8('0x17')]===undefined?!![]:![]:!![],'where':_0x196b29[_0xd7c8('0x16')]?_0x196b29[_0xd7c8('0x16')][_0xd7c8('0x18')]||null:null,'attributes':_0x196b29[_0xd7c8('0x16')]?_0x196b29[_0xd7c8('0x16')][_0xd7c8('0x19')]||null:null,'limit':_0x196b29['options']?_0x196b29[_0xd7c8('0x16')]['limit']||null:null,'include':_0x196b29[_0xd7c8('0x16')]?_0x196b29['options']['include']?_[_0xd7c8('0x1a')](_0x196b29[_0xd7c8('0x16')][_0xd7c8('0x1b')],function(_0x3122d3){return{'model':db[_0x3122d3[_0xd7c8('0x1c')]],'as':_0x3122d3['as'],'attributes':_0x3122d3[_0xd7c8('0x19')],'include':_0x3122d3[_0xd7c8('0x1b')]?_['map'](_0x3122d3['include'],function(_0x26f381){return{'model':db[_0x26f381['model']],'as':_0x26f381['as'],'attributes':_0x26f381[_0xd7c8('0x19')],'include':_0x26f381[_0xd7c8('0x1b')]?_['map'](_0x26f381['include'],function(_0x278cc9){return{'model':db[_0x278cc9[_0xd7c8('0x1c')]],'as':_0x278cc9['as'],'attributes':_0x278cc9['attributes']};}):[]};}):[]};}):[]:[]})[_0xd7c8('0xc')](function(_0x1e33d1){logger[_0xd7c8('0xd')](_0xd7c8('0x14'),_0x196b29);logger['debug'](_0xd7c8('0x14'),_0x196b29,JSON['stringify'](_0x1e33d1));_0x20344a(_0x1e33d1);})[_0xd7c8('0x1d')](function(_0x8aad8e){logger[_0xd7c8('0x10')]('GetSugarcrmAccount',_0x8aad8e[_0xd7c8('0x12')],_0x196b29);_0x5304a5(_0x310f58['error'](0x1f4,_0x8aad8e[_0xd7c8('0x12')]));});});};exports[_0xd7c8('0x1e')]=function(_0x16f1cc){var _0x4c196a=this;return new Promise(function(_0x27e518,_0x49c613){return db[_0xd7c8('0x1f')][_0xd7c8('0x20')]({'raw':_0x16f1cc[_0xd7c8('0x16')]?_0x16f1cc[_0xd7c8('0x16')][_0xd7c8('0x17')]===undefined?!![]:![]:!![],'where':_0x16f1cc[_0xd7c8('0x16')]?_0x16f1cc[_0xd7c8('0x16')][_0xd7c8('0x18')]||null:null,'attributes':_0x16f1cc[_0xd7c8('0x16')]?_0x16f1cc[_0xd7c8('0x16')][_0xd7c8('0x19')]||null:null,'include':_0x16f1cc['options']?_0x16f1cc[_0xd7c8('0x16')]['include']?_['map'](_0x16f1cc[_0xd7c8('0x16')][_0xd7c8('0x1b')],function(_0xd1023c){return{'model':db[_0xd1023c[_0xd7c8('0x1c')]],'as':_0xd1023c['as'],'attributes':_0xd1023c[_0xd7c8('0x19')],'include':_0xd1023c[_0xd7c8('0x1b')]?_[_0xd7c8('0x1a')](_0xd1023c['include'],function(_0x1facdd){return{'model':db[_0x1facdd[_0xd7c8('0x1c')]],'as':_0x1facdd['as'],'attributes':_0x1facdd['attributes'],'include':_0x1facdd[_0xd7c8('0x1b')]?_[_0xd7c8('0x1a')](_0x1facdd['include'],function(_0x1a6191){return{'model':db[_0x1a6191[_0xd7c8('0x1c')]],'as':_0x1a6191['as'],'attributes':_0x1a6191[_0xd7c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd7c8('0xc')](function(_0x257895){logger[_0xd7c8('0xd')](_0xd7c8('0x1e'),_0x16f1cc);logger[_0xd7c8('0x21')](_0xd7c8('0x1e'),_0x16f1cc,JSON[_0xd7c8('0xf')](_0x257895));_0x27e518(_0x257895);})['catch'](function(_0x382387){logger[_0xd7c8('0x10')](_0xd7c8('0x1e'),_0x382387['message'],_0x16f1cc);_0x49c613(_0x4c196a[_0xd7c8('0x10')](0x1f4,_0x382387[_0xd7c8('0x12')]));});});};
\ No newline at end of file
+var _0x8be5=['message','info','result','catch','options','where','attributes','limit','include','map','model','then','debug','GetSugarcrmAccount','ShowSugarcrmAccount','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8be5,0xba));var _0x58be=function(_0x2ab392,_0x25b98f){_0x2ab392=_0x2ab392-0x0;var _0x2c1a96=_0x8be5[_0x2ab392];return _0x2c1a96;};'use strict';var _=require(_0x58be('0x0'));var util=require(_0x58be('0x1'));var moment=require('moment');var BPromise=require(_0x58be('0x2'));var rs=require(_0x58be('0x3'));var fs=require('fs');var Redis=require(_0x58be('0x4'));var db=require(_0x58be('0x5'))['db'];var utils=require(_0x58be('0x6'));var logger=require(_0x58be('0x7'))(_0x58be('0x8'));var config=require(_0x58be('0x9'));var jayson=require(_0x58be('0xa'));var client=jayson['client'][_0x58be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x574d9c,_0x5251ff,_0x3ffbec){return new BPromise(function(_0x228745,_0x3c55ff){return client['request'](_0x574d9c,_0x3ffbec)['then'](function(_0x46240e){logger['info'](_0x58be('0xc'),_0x5251ff,_0x58be('0xd'));logger['debug'](_0x58be('0xe'),_0x5251ff,'request\x20sent',JSON[_0x58be('0xf')](_0x46240e));if(_0x46240e['error']){if(_0x46240e[_0x58be('0x10')][_0x58be('0x11')]===0x1f4){logger[_0x58be('0x10')](_0x58be('0xc'),_0x5251ff,_0x46240e[_0x58be('0x10')]['message']);return _0x3c55ff(_0x46240e[_0x58be('0x10')][_0x58be('0x12')]);}logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5251ff,_0x46240e[_0x58be('0x10')][_0x58be('0x12')]);return _0x228745(_0x46240e['error'][_0x58be('0x12')]);}else{logger[_0x58be('0x13')](_0x58be('0xc'),_0x5251ff,_0x58be('0xd'));_0x228745(_0x46240e[_0x58be('0x14')][_0x58be('0x12')]);}})[_0x58be('0x15')](function(_0x3975e2){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x5251ff,_0x3975e2);_0x3c55ff(_0x3975e2);});});}exports['GetSugarcrmAccount']=function(_0x2a1b05){var _0xe73bb5=this;return new Promise(function(_0x8a3aa0,_0x346ef4){return db['SugarcrmAccount']['findAll']({'raw':_0x2a1b05['options']?_0x2a1b05[_0x58be('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x2a1b05[_0x58be('0x16')]?_0x2a1b05[_0x58be('0x16')][_0x58be('0x17')]||null:null,'attributes':_0x2a1b05['options']?_0x2a1b05[_0x58be('0x16')][_0x58be('0x18')]||null:null,'limit':_0x2a1b05[_0x58be('0x16')]?_0x2a1b05['options'][_0x58be('0x19')]||null:null,'include':_0x2a1b05[_0x58be('0x16')]?_0x2a1b05['options'][_0x58be('0x1a')]?_[_0x58be('0x1b')](_0x2a1b05['options'][_0x58be('0x1a')],function(_0x44a2e9){return{'model':db[_0x44a2e9['model']],'as':_0x44a2e9['as'],'attributes':_0x44a2e9[_0x58be('0x18')],'include':_0x44a2e9[_0x58be('0x1a')]?_[_0x58be('0x1b')](_0x44a2e9['include'],function(_0x43a047){return{'model':db[_0x43a047[_0x58be('0x1c')]],'as':_0x43a047['as'],'attributes':_0x43a047[_0x58be('0x18')],'include':_0x43a047['include']?_['map'](_0x43a047[_0x58be('0x1a')],function(_0x960814){return{'model':db[_0x960814[_0x58be('0x1c')]],'as':_0x960814['as'],'attributes':_0x960814[_0x58be('0x18')]};}):[]};}):[]};}):[]:[]})[_0x58be('0x1d')](function(_0x284451){logger[_0x58be('0x13')]('GetSugarcrmAccount',_0x2a1b05);logger[_0x58be('0x1e')](_0x58be('0x1f'),_0x2a1b05,JSON[_0x58be('0xf')](_0x284451));_0x8a3aa0(_0x284451);})[_0x58be('0x15')](function(_0x1f633c){logger[_0x58be('0x10')](_0x58be('0x1f'),_0x1f633c[_0x58be('0x12')],_0x2a1b05);_0x346ef4(_0xe73bb5[_0x58be('0x10')](0x1f4,_0x1f633c[_0x58be('0x12')]));});});};exports[_0x58be('0x20')]=function(_0x5eee9d){var _0xc88be9=this;return new Promise(function(_0x415d26,_0x1a3233){return db['SugarcrmAccount']['find']({'raw':_0x5eee9d['options']?_0x5eee9d[_0x58be('0x16')][_0x58be('0x21')]===undefined?!![]:![]:!![],'where':_0x5eee9d['options']?_0x5eee9d[_0x58be('0x16')][_0x58be('0x17')]||null:null,'attributes':_0x5eee9d[_0x58be('0x16')]?_0x5eee9d[_0x58be('0x16')]['attributes']||null:null,'include':_0x5eee9d[_0x58be('0x16')]?_0x5eee9d[_0x58be('0x16')][_0x58be('0x1a')]?_[_0x58be('0x1b')](_0x5eee9d['options']['include'],function(_0x41eac2){return{'model':db[_0x41eac2[_0x58be('0x1c')]],'as':_0x41eac2['as'],'attributes':_0x41eac2[_0x58be('0x18')],'include':_0x41eac2[_0x58be('0x1a')]?_['map'](_0x41eac2[_0x58be('0x1a')],function(_0x3cb7f6){return{'model':db[_0x3cb7f6[_0x58be('0x1c')]],'as':_0x3cb7f6['as'],'attributes':_0x3cb7f6[_0x58be('0x18')],'include':_0x3cb7f6[_0x58be('0x1a')]?_[_0x58be('0x1b')](_0x3cb7f6[_0x58be('0x1a')],function(_0xf2fd63){return{'model':db[_0xf2fd63[_0x58be('0x1c')]],'as':_0xf2fd63['as'],'attributes':_0xf2fd63['attributes']};}):[]};}):[]};}):[]:[]})[_0x58be('0x1d')](function(_0x240001){logger[_0x58be('0x13')](_0x58be('0x20'),_0x5eee9d);logger['debug'](_0x58be('0x20'),_0x5eee9d,JSON[_0x58be('0xf')](_0x240001));_0x415d26(_0x240001);})[_0x58be('0x15')](function(_0x39460c){logger['error'](_0x58be('0x20'),_0x39460c[_0x58be('0x12')],_0x5eee9d);_0x1a3233(_0xc88be9['error'](0x1f4,_0x39460c[_0x58be('0x12')]));});});};
\ No newline at end of file
index f051b11..dd3547a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x50ac=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/subjects'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x50ac,0x1ed));var _0xc50a=function(_0x1fe11b,_0x141289){_0x1fe11b=_0x1fe11b-0x0;var _0x2070c4=_0x50ac[_0x1fe11b];return _0x2070c4;};'use strict';var multer=require('multer');var util=require(_0xc50a('0x0'));var path=require('path');var timeout=require(_0xc50a('0x1'));var express=require('express');var router=express[_0xc50a('0x2')]();var fs_extra=require(_0xc50a('0x3'));var auth=require(_0xc50a('0x4'));var interaction=require(_0xc50a('0x5'));var config=require(_0xc50a('0x6'));var controller=require(_0xc50a('0x7'));router[_0xc50a('0x8')]('/',auth[_0xc50a('0x9')](),controller['index']);router[_0xc50a('0x8')](_0xc50a('0xa'),auth[_0xc50a('0x9')](),controller[_0xc50a('0xb')]);router[_0xc50a('0x8')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0xc50a('0x8')](_0xc50a('0xc'),auth['isAuthenticated'](),controller[_0xc50a('0xd')]);router[_0xc50a('0x8')](_0xc50a('0xe'),auth[_0xc50a('0x9')](),controller[_0xc50a('0xf')]);router[_0xc50a('0x10')]('/',auth[_0xc50a('0x9')](),controller[_0xc50a('0x11')]);router[_0xc50a('0x12')]('/:id',auth[_0xc50a('0x9')](),controller[_0xc50a('0x13')]);router[_0xc50a('0x14')](_0xc50a('0xa'),auth[_0xc50a('0x9')](),controller[_0xc50a('0x15')]);module[_0xc50a('0x16')]=router;
\ No newline at end of file
+var _0xdcfd=['create','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x402187,_0x35d3ef){var _0x17e718=function(_0x4877cc){while(--_0x4877cc){_0x402187['push'](_0x402187['shift']());}};_0x17e718(++_0x35d3ef);}(_0xdcfd,0x101));var _0xddcf=function(_0x49c68e,_0x1c1673){_0x49c68e=_0x49c68e-0x0;var _0x33032b=_0xdcfd[_0x49c68e];return _0x33032b;};'use strict';var multer=require(_0xddcf('0x0'));var util=require(_0xddcf('0x1'));var path=require(_0xddcf('0x2'));var timeout=require('connect-timeout');var express=require(_0xddcf('0x3'));var router=express[_0xddcf('0x4')]();var fs_extra=require(_0xddcf('0x5'));var auth=require(_0xddcf('0x6'));var interaction=require(_0xddcf('0x7'));var config=require('../../config/environment');var controller=require(_0xddcf('0x8'));router[_0xddcf('0x9')]('/',auth[_0xddcf('0xa')](),controller[_0xddcf('0xb')]);router[_0xddcf('0x9')](_0xddcf('0xc'),auth[_0xddcf('0xa')](),controller['show']);router[_0xddcf('0x9')]('/:id/fields',auth[_0xddcf('0xa')](),controller[_0xddcf('0xd')]);router[_0xddcf('0x9')](_0xddcf('0xe'),auth['isAuthenticated'](),controller[_0xddcf('0xf')]);router[_0xddcf('0x9')](_0xddcf('0x10'),auth['isAuthenticated'](),controller[_0xddcf('0x11')]);router[_0xddcf('0x12')]('/',auth['isAuthenticated'](),controller[_0xddcf('0x13')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xddcf('0x14')]);router[_0xddcf('0x15')](_0xddcf('0xc'),auth[_0xddcf('0xa')](),controller['destroy']);module[_0xddcf('0x16')]=router;
\ No newline at end of file
index cbdc7b2..dc0af36 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf759=['sequelize','exports','STRING'];(function(_0x2f1114,_0x4561f1){var _0x2fe856=function(_0x8397f8){while(--_0x8397f8){_0x2f1114['push'](_0x2f1114['shift']());}};_0x2fe856(++_0x4561f1);}(_0xf759,0xb4));var _0x9f75=function(_0x29b8c3,_0x1c508b){_0x29b8c3=_0x29b8c3-0x0;var _0x2d5712=_0xf759[_0x29b8c3];return _0x2d5712;};'use strict';var Sequelize=require(_0x9f75('0x0'));module[_0x9f75('0x1')]={'name':{'type':Sequelize[_0x9f75('0x2')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x096c=['sequelize','STRING'];(function(_0x2d1cb0,_0x33b695){var _0x150a96=function(_0x44b77a){while(--_0x44b77a){_0x2d1cb0['push'](_0x2d1cb0['shift']());}};_0x150a96(++_0x33b695);}(_0x096c,0x164));var _0xc096=function(_0x4a2936,_0x42d86c){_0x4a2936=_0x4a2936-0x0;var _0x15ffb4=_0x096c[_0x4a2936];return _0x15ffb4;};'use strict';var Sequelize=require(_0xc096('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc096('0x1')]}};
\ No newline at end of file
index ac01c42..b1f34d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x23eb=['where','pick','filter','VIRTUAL','merge','options','SugarcrmConfiguration','count','includeAll','findAll','catch','show','params','include','find','create','body','destroy','getFields','findOne','SugarcrmField','getSubjects','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x393cfc,_0x476fec){var _0x5715b6=function(_0x21b0cb){while(--_0x21b0cb){_0x393cfc['push'](_0x393cfc['shift']());}};_0x5715b6(++_0x476fec);}(_0x23eb,0xb6));var _0xb23e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x23eb[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xb23e('0x0'));var rimraf=require(_0xb23e('0x1'));var zipdir=require(_0xb23e('0x2'));var jsonpatch=require(_0xb23e('0x3'));var rp=require('request-promise');var moment=require(_0xb23e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb23e('0x5'));var util=require(_0xb23e('0x6'));var path=require(_0xb23e('0x7'));var sox=require(_0xb23e('0x8'));var csv=require(_0xb23e('0x9'));var ejs=require(_0xb23e('0xa'));var fs=require('fs');var fs_extra=require(_0xb23e('0xb'));var _=require(_0xb23e('0xc'));var squel=require(_0xb23e('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb23e('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb23e('0xf'));var Redis=require('ioredis');var authService=require(_0xb23e('0x10'));var qs=require(_0xb23e('0x11'));var as=require(_0xb23e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb23e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xb23e('0x14'));var licenseUtil=require(_0xb23e('0x15'));var db=require(_0xb23e('0x16'))['db'];function respondWithStatusCode(_0x325812,_0x2ac4e1){_0x2ac4e1=_0x2ac4e1||0xcc;return function(_0x431e0c){if(_0x431e0c){return _0x325812['sendStatus'](_0x2ac4e1);}return _0x325812[_0xb23e('0x17')](_0x2ac4e1)['end']();};}function respondWithResult(_0x4f8c31,_0x20b8f9){_0x20b8f9=_0x20b8f9||0xc8;return function(_0x329278){if(_0x329278){return _0x4f8c31[_0xb23e('0x17')](_0x20b8f9)[_0xb23e('0x18')](_0x329278);}};}function respondWithFilteredResult(_0x24108a,_0x4815ae){return function(_0x3ed9ed){if(_0x3ed9ed){var _0x992756=typeof _0x4815ae['offset']===_0xb23e('0x19')&&typeof _0x4815ae[_0xb23e('0x1a')]===_0xb23e('0x19');var _0x34ff60=_0x3ed9ed['count'];var _0x30753f=_0x992756?0x0:_0x4815ae[_0xb23e('0x1b')];var _0x6b97f3=_0x992756?_0x3ed9ed['count']:_0x4815ae[_0xb23e('0x1b')]+_0x4815ae['limit'];var _0x11f900;if(_0x6b97f3>=_0x34ff60){_0x6b97f3=_0x34ff60;_0x11f900=0xc8;}else{_0x11f900=0xce;}_0x24108a['status'](_0x11f900);return _0x24108a[_0xb23e('0x1c')](_0xb23e('0x1d'),_0x30753f+'-'+_0x6b97f3+'/'+_0x34ff60)[_0xb23e('0x18')](_0x3ed9ed);}return null;};}function patchUpdates(_0x5a0f2e){return function(_0x282ed3){try{jsonpatch[_0xb23e('0x1e')](_0x282ed3,_0x5a0f2e,!![]);}catch(_0x23bdaa){return BPromise[_0xb23e('0x1f')](_0x23bdaa);}return _0x282ed3[_0xb23e('0x20')]();};}function saveUpdates(_0x44ff21,_0x454963){return function(_0x3d0808){if(_0x3d0808){return _0x3d0808[_0xb23e('0x21')](_0x44ff21)['then'](function(_0x5a72d8){return _0x5a72d8;});}return null;};}function removeEntity(_0x1c3c44,_0x4a0afc){return function(_0x391464){if(_0x391464){return _0x391464['destroy']()[_0xb23e('0x22')](function(){_0x1c3c44[_0xb23e('0x17')](0xcc)[_0xb23e('0x23')]();});}};}function handleEntityNotFound(_0x2ce870,_0x4a387d){return function(_0x55b483){if(!_0x55b483){_0x2ce870[_0xb23e('0x24')](0x194);}return _0x55b483;};}function handleError(_0x4ccad1,_0x348f24){_0x348f24=_0x348f24||0x1f4;return function(_0x5f524b){logger[_0xb23e('0x25')](_0x5f524b[_0xb23e('0x26')]);if(_0x5f524b[_0xb23e('0x27')]){delete _0x5f524b[_0xb23e('0x27')];}_0x4ccad1[_0xb23e('0x17')](_0x348f24)[_0xb23e('0x28')](_0x5f524b);};}exports[_0xb23e('0x29')]=function(_0x427802,_0x16ac03){var _0x1bd691={},_0x44efb5={},_0x1b800c={'count':0x0,'rows':[]};var _0x22237f=_[_0xb23e('0x2a')](db['SugarcrmConfiguration'][_0xb23e('0x2b')],function(_0x37f936){return{'name':_0x37f936[_0xb23e('0x2c')],'type':_0x37f936[_0xb23e('0x2d')]['key']};});_0x44efb5[_0xb23e('0x2e')]=_['map'](_0x22237f,_0xb23e('0x27'));_0x44efb5[_0xb23e('0x2f')]=_[_0xb23e('0x30')](_0x427802[_0xb23e('0x2f')]);_0x44efb5[_0xb23e('0x31')]=_['intersection'](_0x44efb5['model'],_0x44efb5['query']);_0x1bd691[_0xb23e('0x32')]=_[_0xb23e('0x33')](_0x44efb5['model'],qs['fields'](_0x427802['query'][_0xb23e('0x34')]));_0x1bd691['attributes']=_0x1bd691[_0xb23e('0x32')][_0xb23e('0x35')]?_0x1bd691['attributes']:_0x44efb5['model'];if(!_0x427802[_0xb23e('0x2f')][_0xb23e('0x36')](_0xb23e('0x37'))){_0x1bd691[_0xb23e('0x1a')]=qs['limit'](_0x427802[_0xb23e('0x2f')][_0xb23e('0x1a')]);_0x1bd691[_0xb23e('0x1b')]=qs[_0xb23e('0x1b')](_0x427802['query'][_0xb23e('0x1b')]);}_0x1bd691[_0xb23e('0x38')]=qs[_0xb23e('0x39')](_0x427802[_0xb23e('0x2f')][_0xb23e('0x39')]);_0x1bd691[_0xb23e('0x3a')]=qs[_0xb23e('0x31')](_[_0xb23e('0x3b')](_0x427802['query'],_0x44efb5[_0xb23e('0x31')]),_0x22237f);if(_0x427802[_0xb23e('0x2f')][_0xb23e('0x3c')]){_0x1bd691[_0xb23e('0x3a')]=_['merge'](_0x1bd691[_0xb23e('0x3a')],{'$or':_[_0xb23e('0x2a')](_0x22237f,function(_0x28495d){if(_0x28495d[_0xb23e('0x2d')]!==_0xb23e('0x3d')){var _0x378601={};_0x378601[_0x28495d[_0xb23e('0x27')]]={'$like':'%'+_0x427802[_0xb23e('0x2f')][_0xb23e('0x3c')]+'%'};return _0x378601;}})});}_0x1bd691=_[_0xb23e('0x3e')]({},_0x1bd691,_0x427802[_0xb23e('0x3f')]);var _0x115c2a={'where':_0x1bd691[_0xb23e('0x3a')]};return db[_0xb23e('0x40')][_0xb23e('0x41')](_0x115c2a)[_0xb23e('0x22')](function(_0x23976f){_0x1b800c[_0xb23e('0x41')]=_0x23976f;if(_0x427802[_0xb23e('0x2f')][_0xb23e('0x42')]){_0x1bd691['include']=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xb23e('0x43')](_0x1bd691);})[_0xb23e('0x22')](function(_0x33572e){_0x1b800c['rows']=_0x33572e;return _0x1b800c;})['then'](respondWithFilteredResult(_0x16ac03,_0x1bd691))[_0xb23e('0x44')](handleError(_0x16ac03,null));};exports[_0xb23e('0x45')]=function(_0x851d4a,_0x49b637){var _0x258792={'raw':![],'where':{'id':_0x851d4a[_0xb23e('0x46')]['id']}},_0x378c7c={};_0x378c7c[_0xb23e('0x2e')]=_[_0xb23e('0x30')](db[_0xb23e('0x40')][_0xb23e('0x2b')]);_0x378c7c[_0xb23e('0x2f')]=_['keys'](_0x851d4a['query']);_0x378c7c['filters']=_[_0xb23e('0x33')](_0x378c7c[_0xb23e('0x2e')],_0x378c7c[_0xb23e('0x2f')]);_0x258792['attributes']=_['intersection'](_0x378c7c[_0xb23e('0x2e')],qs['fields'](_0x851d4a[_0xb23e('0x2f')][_0xb23e('0x34')]));_0x258792[_0xb23e('0x32')]=_0x258792[_0xb23e('0x32')][_0xb23e('0x35')]?_0x258792[_0xb23e('0x32')]:_0x378c7c[_0xb23e('0x2e')];if(_0x851d4a[_0xb23e('0x2f')][_0xb23e('0x42')]){_0x258792[_0xb23e('0x47')]=[{'all':!![]}];}_0x258792=_[_0xb23e('0x3e')]({},_0x258792,_0x851d4a[_0xb23e('0x3f')]);return db[_0xb23e('0x40')][_0xb23e('0x48')](_0x258792)[_0xb23e('0x22')](handleEntityNotFound(_0x49b637,null))[_0xb23e('0x22')](respondWithResult(_0x49b637,null))[_0xb23e('0x44')](handleError(_0x49b637,null));};exports[_0xb23e('0x49')]=function(_0x2c95db,_0x3b2cff){return db[_0xb23e('0x40')][_0xb23e('0x49')](_0x2c95db[_0xb23e('0x4a')],{})[_0xb23e('0x22')](respondWithResult(_0x3b2cff,0xc9))['catch'](handleError(_0x3b2cff,null));};exports[_0xb23e('0x21')]=function(_0x41a7c3,_0x114e11){if(_0x41a7c3['body']['id']){delete _0x41a7c3['body']['id'];}return db[_0xb23e('0x40')]['find']({'where':{'id':_0x41a7c3[_0xb23e('0x46')]['id']}})[_0xb23e('0x22')](handleEntityNotFound(_0x114e11,null))[_0xb23e('0x22')](saveUpdates(_0x41a7c3[_0xb23e('0x4a')],null))[_0xb23e('0x22')](respondWithResult(_0x114e11,null))[_0xb23e('0x44')](handleError(_0x114e11,null));};exports[_0xb23e('0x4b')]=function(_0x5dc71b,_0x54c394){return db[_0xb23e('0x40')]['find']({'where':{'id':_0x5dc71b['params']['id']}})[_0xb23e('0x22')](handleEntityNotFound(_0x54c394,null))[_0xb23e('0x22')](removeEntity(_0x54c394,null))['catch'](handleError(_0x54c394,null));};exports[_0xb23e('0x4c')]=function(_0x41ff23,_0x4580f7,_0x229791){var _0x35ae1c={};var _0x548b83={};var _0x49fd1f;var _0x480ca8;return db['SugarcrmConfiguration'][_0xb23e('0x4d')]({'where':{'id':_0x41ff23[_0xb23e('0x46')]['id']}})['then'](handleEntityNotFound(_0x4580f7,null))['then'](function(_0x209646){if(_0x209646){_0x49fd1f=_0x209646;_0x548b83[_0xb23e('0x2e')]=_[_0xb23e('0x30')](db[_0xb23e('0x4e')][_0xb23e('0x2b')]);_0x548b83[_0xb23e('0x2f')]=_['keys'](_0x41ff23[_0xb23e('0x2f')]);_0x548b83[_0xb23e('0x31')]=_[_0xb23e('0x33')](_0x548b83['model'],_0x548b83[_0xb23e('0x2f')]);_0x35ae1c[_0xb23e('0x32')]=_[_0xb23e('0x33')](_0x548b83[_0xb23e('0x2e')],qs[_0xb23e('0x34')](_0x41ff23['query']['fields']));_0x35ae1c[_0xb23e('0x32')]=_0x35ae1c[_0xb23e('0x32')][_0xb23e('0x35')]?_0x35ae1c[_0xb23e('0x32')]:_0x548b83[_0xb23e('0x2e')];_0x35ae1c[_0xb23e('0x38')]=qs[_0xb23e('0x39')](_0x41ff23[_0xb23e('0x2f')][_0xb23e('0x39')]);_0x35ae1c[_0xb23e('0x3a')]=qs[_0xb23e('0x31')](_[_0xb23e('0x3b')](_0x41ff23[_0xb23e('0x2f')],_0x548b83['filters']));if(_0x41ff23[_0xb23e('0x2f')][_0xb23e('0x3c')]){_0x35ae1c[_0xb23e('0x3a')]=_['merge'](_0x35ae1c[_0xb23e('0x3a')],{'$or':_[_0xb23e('0x2a')](_0x35ae1c['attributes'],function(_0x550ed1){var _0x5a610a={};_0x5a610a[_0x550ed1]={'$like':'%'+_0x41ff23[_0xb23e('0x2f')][_0xb23e('0x3c')]+'%'};return _0x5a610a;})});}_0x35ae1c=_['merge']({},_0x35ae1c,_0x41ff23[_0xb23e('0x3f')]);return _0x49fd1f[_0xb23e('0x4c')](_0x35ae1c);}})[_0xb23e('0x22')](function(_0x3ba8d9){if(_0x3ba8d9){_0x480ca8=_0x3ba8d9[_0xb23e('0x35')];if(!_0x41ff23[_0xb23e('0x2f')][_0xb23e('0x36')](_0xb23e('0x37'))){_0x35ae1c[_0xb23e('0x1a')]=qs[_0xb23e('0x1a')](_0x41ff23['query'][_0xb23e('0x1a')]);_0x35ae1c[_0xb23e('0x1b')]=qs[_0xb23e('0x1b')](_0x41ff23[_0xb23e('0x2f')]['offset']);}return _0x49fd1f[_0xb23e('0x4c')](_0x35ae1c);}})[_0xb23e('0x22')](function(_0x2a7c2f){if(_0x2a7c2f){return _0x2a7c2f?{'count':_0x480ca8,'rows':_0x2a7c2f}:null;}})['then'](respondWithResult(_0x4580f7,null))[_0xb23e('0x44')](handleError(_0x4580f7,null));};exports[_0xb23e('0x4f')]=function(_0x27c357,_0x4ace56,_0x4d2476){var _0x138747={};var _0x50182c={};var _0xd0623e;var _0x3d557e;return db[_0xb23e('0x40')][_0xb23e('0x4d')]({'where':{'id':_0x27c357['params']['id']}})['then'](handleEntityNotFound(_0x4ace56,null))[_0xb23e('0x22')](function(_0x27f2e7){if(_0x27f2e7){_0xd0623e=_0x27f2e7;_0x50182c['model']=_[_0xb23e('0x30')](db[_0xb23e('0x4e')]['rawAttributes']);_0x50182c['query']=_['keys'](_0x27c357['query']);_0x50182c[_0xb23e('0x31')]=_['intersection'](_0x50182c[_0xb23e('0x2e')],_0x50182c[_0xb23e('0x2f')]);_0x138747[_0xb23e('0x32')]=_[_0xb23e('0x33')](_0x50182c[_0xb23e('0x2e')],qs[_0xb23e('0x34')](_0x27c357[_0xb23e('0x2f')][_0xb23e('0x34')]));_0x138747[_0xb23e('0x32')]=_0x138747[_0xb23e('0x32')]['length']?_0x138747[_0xb23e('0x32')]:_0x50182c['model'];_0x138747['order']=qs[_0xb23e('0x39')](_0x27c357['query'][_0xb23e('0x39')]);_0x138747[_0xb23e('0x3a')]=qs[_0xb23e('0x31')](_[_0xb23e('0x3b')](_0x27c357[_0xb23e('0x2f')],_0x50182c[_0xb23e('0x31')]));if(_0x27c357[_0xb23e('0x2f')][_0xb23e('0x3c')]){_0x138747[_0xb23e('0x3a')]=_[_0xb23e('0x3e')](_0x138747[_0xb23e('0x3a')],{'$or':_[_0xb23e('0x2a')](_0x138747['attributes'],function(_0xf28949){var _0xe10cdb={};_0xe10cdb[_0xf28949]={'$like':'%'+_0x27c357[_0xb23e('0x2f')][_0xb23e('0x3c')]+'%'};return _0xe10cdb;})});}_0x138747=_[_0xb23e('0x3e')]({},_0x138747,_0x27c357[_0xb23e('0x3f')]);return _0xd0623e['getSubjects'](_0x138747);}})[_0xb23e('0x22')](function(_0x39017e){if(_0x39017e){_0x3d557e=_0x39017e['length'];if(!_0x27c357['query']['hasOwnProperty'](_0xb23e('0x37'))){_0x138747[_0xb23e('0x1a')]=qs[_0xb23e('0x1a')](_0x27c357['query']['limit']);_0x138747[_0xb23e('0x1b')]=qs[_0xb23e('0x1b')](_0x27c357['query'][_0xb23e('0x1b')]);}return _0xd0623e[_0xb23e('0x4f')](_0x138747);}})[_0xb23e('0x22')](function(_0x5ccbd7){if(_0x5ccbd7){return _0x5ccbd7?{'count':_0x3d557e,'rows':_0x5ccbd7}:null;}})['then'](respondWithResult(_0x4ace56,null))[_0xb23e('0x44')](handleError(_0x4ace56,null));};exports['getDescriptions']=function(_0xc907b9,_0x373687,_0x1c6bf2){var _0x441bfc={};var _0x2cc986={};var _0x2912e0;var _0xfbfa3e;return db[_0xb23e('0x40')][_0xb23e('0x4d')]({'where':{'id':_0xc907b9[_0xb23e('0x46')]['id']}})[_0xb23e('0x22')](handleEntityNotFound(_0x373687,null))[_0xb23e('0x22')](function(_0x1357cd){if(_0x1357cd){_0x2912e0=_0x1357cd;_0x2cc986[_0xb23e('0x2e')]=_['keys'](db[_0xb23e('0x4e')][_0xb23e('0x2b')]);_0x2cc986[_0xb23e('0x2f')]=_['keys'](_0xc907b9[_0xb23e('0x2f')]);_0x2cc986[_0xb23e('0x31')]=_[_0xb23e('0x33')](_0x2cc986[_0xb23e('0x2e')],_0x2cc986[_0xb23e('0x2f')]);_0x441bfc[_0xb23e('0x32')]=_[_0xb23e('0x33')](_0x2cc986['model'],qs[_0xb23e('0x34')](_0xc907b9[_0xb23e('0x2f')]['fields']));_0x441bfc[_0xb23e('0x32')]=_0x441bfc[_0xb23e('0x32')][_0xb23e('0x35')]?_0x441bfc[_0xb23e('0x32')]:_0x2cc986[_0xb23e('0x2e')];_0x441bfc[_0xb23e('0x38')]=qs[_0xb23e('0x39')](_0xc907b9['query'][_0xb23e('0x39')]);_0x441bfc[_0xb23e('0x3a')]=qs[_0xb23e('0x31')](_[_0xb23e('0x3b')](_0xc907b9[_0xb23e('0x2f')],_0x2cc986[_0xb23e('0x31')]));if(_0xc907b9['query'][_0xb23e('0x3c')]){_0x441bfc[_0xb23e('0x3a')]=_[_0xb23e('0x3e')](_0x441bfc[_0xb23e('0x3a')],{'$or':_[_0xb23e('0x2a')](_0x441bfc[_0xb23e('0x32')],function(_0x1af2e5){var _0x3d0dbd={};_0x3d0dbd[_0x1af2e5]={'$like':'%'+_0xc907b9[_0xb23e('0x2f')][_0xb23e('0x3c')]+'%'};return _0x3d0dbd;})});}_0x441bfc=_['merge']({},_0x441bfc,_0xc907b9[_0xb23e('0x3f')]);return _0x2912e0['getDescriptions'](_0x441bfc);}})[_0xb23e('0x22')](function(_0x4804f3){if(_0x4804f3){_0xfbfa3e=_0x4804f3[_0xb23e('0x35')];if(!_0xc907b9[_0xb23e('0x2f')][_0xb23e('0x36')](_0xb23e('0x37'))){_0x441bfc['limit']=qs[_0xb23e('0x1a')](_0xc907b9[_0xb23e('0x2f')][_0xb23e('0x1a')]);_0x441bfc[_0xb23e('0x1b')]=qs[_0xb23e('0x1b')](_0xc907b9[_0xb23e('0x2f')]['offset']);}return _0x2912e0['getDescriptions'](_0x441bfc);}})[_0xb23e('0x22')](function(_0x159caf){if(_0x159caf){return _0x159caf?{'count':_0xfbfa3e,'rows':_0x159caf}:null;}})[_0xb23e('0x22')](respondWithResult(_0x373687,null))[_0xb23e('0x44')](handleError(_0x373687,null));};
\ No newline at end of file
+var _0x9a61=['length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','findAll','rows','show','params','include','merge','find','create','body','catch','getFields','findOne','keys','SugarcrmField','order','getSubjects','options','getDescriptions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','save','update','then','destroy','sendStatus','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields'];(function(_0xf91841,_0x182ae3){var _0x4b9c44=function(_0x2e216e){while(--_0x2e216e){_0xf91841['push'](_0xf91841['shift']());}};_0x4b9c44(++_0x182ae3);}(_0x9a61,0x1e8));var _0x19a6=function(_0x3e98dd,_0x27da76){_0x3e98dd=_0x3e98dd-0x0;var _0xfea9f4=_0x9a61[_0x3e98dd];return _0xfea9f4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x19a6('0x0'));var zipdir=require(_0x19a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x19a6('0x2'));var moment=require(_0x19a6('0x3'));var BPromise=require(_0x19a6('0x4'));var Mustache=require(_0x19a6('0x5'));var util=require(_0x19a6('0x6'));var path=require(_0x19a6('0x7'));var sox=require(_0x19a6('0x8'));var csv=require(_0x19a6('0x9'));var ejs=require(_0x19a6('0xa'));var fs=require('fs');var fs_extra=require(_0x19a6('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x19a6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x19a6('0xd'));var toCsv=require(_0x19a6('0x9'));var querystring=require(_0x19a6('0xe'));var Papa=require(_0x19a6('0xf'));var Redis=require(_0x19a6('0x10'));var authService=require(_0x19a6('0x11'));var qs=require(_0x19a6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x19a6('0x13'))(_0x19a6('0x14'));var utils=require(_0x19a6('0x15'));var config=require(_0x19a6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x19a6('0x17'))['db'];function respondWithStatusCode(_0x515909,_0x45eb5){_0x45eb5=_0x45eb5||0xcc;return function(_0x554623){if(_0x554623){return _0x515909['sendStatus'](_0x45eb5);}return _0x515909[_0x19a6('0x18')](_0x45eb5)[_0x19a6('0x19')]();};}function respondWithResult(_0x5278a6,_0x3a6afb){_0x3a6afb=_0x3a6afb||0xc8;return function(_0x51d167){if(_0x51d167){return _0x5278a6[_0x19a6('0x18')](_0x3a6afb)[_0x19a6('0x1a')](_0x51d167);}};}function respondWithFilteredResult(_0x3405c9,_0x65c1a9){return function(_0x378568){if(_0x378568){var _0x2ac31a=typeof _0x65c1a9[_0x19a6('0x1b')]===_0x19a6('0x1c')&&typeof _0x65c1a9[_0x19a6('0x1d')]===_0x19a6('0x1c');var _0xe01784=_0x378568[_0x19a6('0x1e')];var _0x4b887f=_0x2ac31a?0x0:_0x65c1a9[_0x19a6('0x1b')];var _0x1d4f3b=_0x2ac31a?_0x378568[_0x19a6('0x1e')]:_0x65c1a9[_0x19a6('0x1b')]+_0x65c1a9['limit'];var _0x17a863;if(_0x1d4f3b>=_0xe01784){_0x1d4f3b=_0xe01784;_0x17a863=0xc8;}else{_0x17a863=0xce;}_0x3405c9[_0x19a6('0x18')](_0x17a863);return _0x3405c9[_0x19a6('0x1f')]('Content-Range',_0x4b887f+'-'+_0x1d4f3b+'/'+_0xe01784)['json'](_0x378568);}return null;};}function patchUpdates(_0x49427d){return function(_0xcf0e29){try{jsonpatch['apply'](_0xcf0e29,_0x49427d,!![]);}catch(_0x6d698d){return BPromise['reject'](_0x6d698d);}return _0xcf0e29[_0x19a6('0x20')]();};}function saveUpdates(_0x2b97ba,_0x506afb){return function(_0x44868a){if(_0x44868a){return _0x44868a[_0x19a6('0x21')](_0x2b97ba)[_0x19a6('0x22')](function(_0x547f4a){return _0x547f4a;});}return null;};}function removeEntity(_0x29d6b9,_0x28018a){return function(_0x2bc5b6){if(_0x2bc5b6){return _0x2bc5b6[_0x19a6('0x23')]()[_0x19a6('0x22')](function(){_0x29d6b9[_0x19a6('0x18')](0xcc)[_0x19a6('0x19')]();});}};}function handleEntityNotFound(_0x2ff180,_0x12bb3b){return function(_0x120847){if(!_0x120847){_0x2ff180[_0x19a6('0x24')](0x194);}return _0x120847;};}function handleError(_0x913711,_0x287a68){_0x287a68=_0x287a68||0x1f4;return function(_0x58e2a8){logger['error'](_0x58e2a8['stack']);if(_0x58e2a8[_0x19a6('0x25')]){delete _0x58e2a8[_0x19a6('0x25')];}_0x913711['status'](_0x287a68)[_0x19a6('0x26')](_0x58e2a8);};}exports[_0x19a6('0x27')]=function(_0x4a3403,_0x142aa0){var _0x363f05={},_0x597ee7={},_0x29abc0={'count':0x0,'rows':[]};var _0x109e9b=_[_0x19a6('0x28')](db[_0x19a6('0x29')][_0x19a6('0x2a')],function(_0x30a27a){return{'name':_0x30a27a[_0x19a6('0x2b')],'type':_0x30a27a[_0x19a6('0x2c')]['key']};});_0x597ee7[_0x19a6('0x2d')]=_['map'](_0x109e9b,_0x19a6('0x25'));_0x597ee7[_0x19a6('0x2e')]=_['keys'](_0x4a3403[_0x19a6('0x2e')]);_0x597ee7[_0x19a6('0x2f')]=_[_0x19a6('0x30')](_0x597ee7[_0x19a6('0x2d')],_0x597ee7[_0x19a6('0x2e')]);_0x363f05[_0x19a6('0x31')]=_['intersection'](_0x597ee7[_0x19a6('0x2d')],qs[_0x19a6('0x32')](_0x4a3403[_0x19a6('0x2e')][_0x19a6('0x32')]));_0x363f05[_0x19a6('0x31')]=_0x363f05[_0x19a6('0x31')][_0x19a6('0x33')]?_0x363f05[_0x19a6('0x31')]:_0x597ee7[_0x19a6('0x2d')];if(!_0x4a3403[_0x19a6('0x2e')][_0x19a6('0x34')](_0x19a6('0x35'))){_0x363f05[_0x19a6('0x1d')]=qs['limit'](_0x4a3403[_0x19a6('0x2e')][_0x19a6('0x1d')]);_0x363f05[_0x19a6('0x1b')]=qs['offset'](_0x4a3403['query']['offset']);}_0x363f05['order']=qs[_0x19a6('0x36')](_0x4a3403['query']['sort']);_0x363f05[_0x19a6('0x37')]=qs[_0x19a6('0x2f')](_[_0x19a6('0x38')](_0x4a3403[_0x19a6('0x2e')],_0x597ee7[_0x19a6('0x2f')]),_0x109e9b);if(_0x4a3403['query'][_0x19a6('0x39')]){_0x363f05[_0x19a6('0x37')]=_['merge'](_0x363f05[_0x19a6('0x37')],{'$or':_[_0x19a6('0x28')](_0x109e9b,function(_0x5665c1){if(_0x5665c1[_0x19a6('0x2c')]!==_0x19a6('0x3a')){var _0x2cfc2b={};_0x2cfc2b[_0x5665c1[_0x19a6('0x25')]]={'$like':'%'+_0x4a3403[_0x19a6('0x2e')]['filter']+'%'};return _0x2cfc2b;}})});}_0x363f05=_['merge']({},_0x363f05,_0x4a3403['options']);var _0x4b2d6b={'where':_0x363f05[_0x19a6('0x37')]};return db[_0x19a6('0x29')]['count'](_0x4b2d6b)[_0x19a6('0x22')](function(_0x434266){_0x29abc0[_0x19a6('0x1e')]=_0x434266;if(_0x4a3403[_0x19a6('0x2e')]['includeAll']){_0x363f05['include']=[{'all':!![]}];}return db[_0x19a6('0x29')][_0x19a6('0x3b')](_0x363f05);})['then'](function(_0x4621b6){_0x29abc0[_0x19a6('0x3c')]=_0x4621b6;return _0x29abc0;})[_0x19a6('0x22')](respondWithFilteredResult(_0x142aa0,_0x363f05))['catch'](handleError(_0x142aa0,null));};exports[_0x19a6('0x3d')]=function(_0x2275c5,_0x4b7079){var _0x3d0fb4={'raw':![],'where':{'id':_0x2275c5[_0x19a6('0x3e')]['id']}},_0x1d1ede={};_0x1d1ede[_0x19a6('0x2d')]=_['keys'](db['SugarcrmConfiguration'][_0x19a6('0x2a')]);_0x1d1ede['query']=_['keys'](_0x2275c5[_0x19a6('0x2e')]);_0x1d1ede[_0x19a6('0x2f')]=_[_0x19a6('0x30')](_0x1d1ede['model'],_0x1d1ede[_0x19a6('0x2e')]);_0x3d0fb4[_0x19a6('0x31')]=_['intersection'](_0x1d1ede[_0x19a6('0x2d')],qs[_0x19a6('0x32')](_0x2275c5['query'][_0x19a6('0x32')]));_0x3d0fb4[_0x19a6('0x31')]=_0x3d0fb4[_0x19a6('0x31')][_0x19a6('0x33')]?_0x3d0fb4[_0x19a6('0x31')]:_0x1d1ede[_0x19a6('0x2d')];if(_0x2275c5['query']['includeAll']){_0x3d0fb4[_0x19a6('0x3f')]=[{'all':!![]}];}_0x3d0fb4=_[_0x19a6('0x40')]({},_0x3d0fb4,_0x2275c5['options']);return db[_0x19a6('0x29')][_0x19a6('0x41')](_0x3d0fb4)['then'](handleEntityNotFound(_0x4b7079,null))[_0x19a6('0x22')](respondWithResult(_0x4b7079,null))['catch'](handleError(_0x4b7079,null));};exports[_0x19a6('0x42')]=function(_0x2224c9,_0x126fee){return db[_0x19a6('0x29')][_0x19a6('0x42')](_0x2224c9[_0x19a6('0x43')],{})[_0x19a6('0x22')](respondWithResult(_0x126fee,0xc9))['catch'](handleError(_0x126fee,null));};exports['update']=function(_0x5c25b8,_0x48ea98){if(_0x5c25b8[_0x19a6('0x43')]['id']){delete _0x5c25b8[_0x19a6('0x43')]['id'];}return db[_0x19a6('0x29')][_0x19a6('0x41')]({'where':{'id':_0x5c25b8[_0x19a6('0x3e')]['id']}})[_0x19a6('0x22')](handleEntityNotFound(_0x48ea98,null))[_0x19a6('0x22')](saveUpdates(_0x5c25b8[_0x19a6('0x43')],null))[_0x19a6('0x22')](respondWithResult(_0x48ea98,null))[_0x19a6('0x44')](handleError(_0x48ea98,null));};exports[_0x19a6('0x23')]=function(_0x3cbf20,_0x3c83cc){return db[_0x19a6('0x29')][_0x19a6('0x41')]({'where':{'id':_0x3cbf20[_0x19a6('0x3e')]['id']}})[_0x19a6('0x22')](handleEntityNotFound(_0x3c83cc,null))[_0x19a6('0x22')](removeEntity(_0x3c83cc,null))[_0x19a6('0x44')](handleError(_0x3c83cc,null));};exports[_0x19a6('0x45')]=function(_0x34dbb0,_0x548fc7,_0x3b70ed){var _0x432e90={};var _0x131d30={};var _0x3b4735;var _0x54b9d8;return db['SugarcrmConfiguration'][_0x19a6('0x46')]({'where':{'id':_0x34dbb0[_0x19a6('0x3e')]['id']}})[_0x19a6('0x22')](handleEntityNotFound(_0x548fc7,null))[_0x19a6('0x22')](function(_0x46bf0c){if(_0x46bf0c){_0x3b4735=_0x46bf0c;_0x131d30['model']=_[_0x19a6('0x47')](db[_0x19a6('0x48')][_0x19a6('0x2a')]);_0x131d30['query']=_[_0x19a6('0x47')](_0x34dbb0[_0x19a6('0x2e')]);_0x131d30['filters']=_[_0x19a6('0x30')](_0x131d30[_0x19a6('0x2d')],_0x131d30[_0x19a6('0x2e')]);_0x432e90[_0x19a6('0x31')]=_[_0x19a6('0x30')](_0x131d30['model'],qs[_0x19a6('0x32')](_0x34dbb0['query'][_0x19a6('0x32')]));_0x432e90[_0x19a6('0x31')]=_0x432e90[_0x19a6('0x31')][_0x19a6('0x33')]?_0x432e90[_0x19a6('0x31')]:_0x131d30[_0x19a6('0x2d')];_0x432e90[_0x19a6('0x49')]=qs[_0x19a6('0x36')](_0x34dbb0['query'][_0x19a6('0x36')]);_0x432e90[_0x19a6('0x37')]=qs[_0x19a6('0x2f')](_['pick'](_0x34dbb0[_0x19a6('0x2e')],_0x131d30[_0x19a6('0x2f')]));if(_0x34dbb0[_0x19a6('0x2e')][_0x19a6('0x39')]){_0x432e90['where']=_[_0x19a6('0x40')](_0x432e90['where'],{'$or':_[_0x19a6('0x28')](_0x432e90[_0x19a6('0x31')],function(_0x259121){var _0x577f03={};_0x577f03[_0x259121]={'$like':'%'+_0x34dbb0[_0x19a6('0x2e')][_0x19a6('0x39')]+'%'};return _0x577f03;})});}_0x432e90=_[_0x19a6('0x40')]({},_0x432e90,_0x34dbb0['options']);return _0x3b4735['getFields'](_0x432e90);}})['then'](function(_0x4cb13a){if(_0x4cb13a){_0x54b9d8=_0x4cb13a[_0x19a6('0x33')];if(!_0x34dbb0[_0x19a6('0x2e')][_0x19a6('0x34')](_0x19a6('0x35'))){_0x432e90['limit']=qs[_0x19a6('0x1d')](_0x34dbb0['query'][_0x19a6('0x1d')]);_0x432e90[_0x19a6('0x1b')]=qs[_0x19a6('0x1b')](_0x34dbb0[_0x19a6('0x2e')][_0x19a6('0x1b')]);}return _0x3b4735[_0x19a6('0x45')](_0x432e90);}})[_0x19a6('0x22')](function(_0x1e92a7){if(_0x1e92a7){return _0x1e92a7?{'count':_0x54b9d8,'rows':_0x1e92a7}:null;}})[_0x19a6('0x22')](respondWithResult(_0x548fc7,null))[_0x19a6('0x44')](handleError(_0x548fc7,null));};exports[_0x19a6('0x4a')]=function(_0x12d535,_0xedd0e7,_0x3c92c8){var _0x10dabd={};var _0x188f9d={};var _0x59fb04;var _0x21a6ba;return db[_0x19a6('0x29')]['findOne']({'where':{'id':_0x12d535[_0x19a6('0x3e')]['id']}})[_0x19a6('0x22')](handleEntityNotFound(_0xedd0e7,null))[_0x19a6('0x22')](function(_0x2ce162){if(_0x2ce162){_0x59fb04=_0x2ce162;_0x188f9d[_0x19a6('0x2d')]=_[_0x19a6('0x47')](db[_0x19a6('0x48')][_0x19a6('0x2a')]);_0x188f9d[_0x19a6('0x2e')]=_[_0x19a6('0x47')](_0x12d535[_0x19a6('0x2e')]);_0x188f9d[_0x19a6('0x2f')]=_['intersection'](_0x188f9d[_0x19a6('0x2d')],_0x188f9d[_0x19a6('0x2e')]);_0x10dabd[_0x19a6('0x31')]=_['intersection'](_0x188f9d[_0x19a6('0x2d')],qs[_0x19a6('0x32')](_0x12d535[_0x19a6('0x2e')]['fields']));_0x10dabd[_0x19a6('0x31')]=_0x10dabd[_0x19a6('0x31')][_0x19a6('0x33')]?_0x10dabd[_0x19a6('0x31')]:_0x188f9d[_0x19a6('0x2d')];_0x10dabd[_0x19a6('0x49')]=qs[_0x19a6('0x36')](_0x12d535[_0x19a6('0x2e')][_0x19a6('0x36')]);_0x10dabd[_0x19a6('0x37')]=qs['filters'](_[_0x19a6('0x38')](_0x12d535[_0x19a6('0x2e')],_0x188f9d[_0x19a6('0x2f')]));if(_0x12d535['query'][_0x19a6('0x39')]){_0x10dabd['where']=_['merge'](_0x10dabd['where'],{'$or':_['map'](_0x10dabd[_0x19a6('0x31')],function(_0xfda308){var _0x4d5c28={};_0x4d5c28[_0xfda308]={'$like':'%'+_0x12d535['query']['filter']+'%'};return _0x4d5c28;})});}_0x10dabd=_[_0x19a6('0x40')]({},_0x10dabd,_0x12d535[_0x19a6('0x4b')]);return _0x59fb04[_0x19a6('0x4a')](_0x10dabd);}})[_0x19a6('0x22')](function(_0x429d80){if(_0x429d80){_0x21a6ba=_0x429d80[_0x19a6('0x33')];if(!_0x12d535[_0x19a6('0x2e')][_0x19a6('0x34')](_0x19a6('0x35'))){_0x10dabd['limit']=qs[_0x19a6('0x1d')](_0x12d535[_0x19a6('0x2e')][_0x19a6('0x1d')]);_0x10dabd['offset']=qs[_0x19a6('0x1b')](_0x12d535[_0x19a6('0x2e')]['offset']);}return _0x59fb04[_0x19a6('0x4a')](_0x10dabd);}})[_0x19a6('0x22')](function(_0x58b517){if(_0x58b517){return _0x58b517?{'count':_0x21a6ba,'rows':_0x58b517}:null;}})[_0x19a6('0x22')](respondWithResult(_0xedd0e7,null))[_0x19a6('0x44')](handleError(_0xedd0e7,null));};exports[_0x19a6('0x4c')]=function(_0xc1c2f0,_0x5eb85a,_0x51af14){var _0x4fa1a1={};var _0x585773={};var _0x2a632e;var _0x447407;return db['SugarcrmConfiguration'][_0x19a6('0x46')]({'where':{'id':_0xc1c2f0[_0x19a6('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5eb85a,null))['then'](function(_0x12163b){if(_0x12163b){_0x2a632e=_0x12163b;_0x585773['model']=_[_0x19a6('0x47')](db[_0x19a6('0x48')][_0x19a6('0x2a')]);_0x585773[_0x19a6('0x2e')]=_[_0x19a6('0x47')](_0xc1c2f0[_0x19a6('0x2e')]);_0x585773[_0x19a6('0x2f')]=_['intersection'](_0x585773['model'],_0x585773[_0x19a6('0x2e')]);_0x4fa1a1['attributes']=_[_0x19a6('0x30')](_0x585773[_0x19a6('0x2d')],qs[_0x19a6('0x32')](_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x32')]));_0x4fa1a1[_0x19a6('0x31')]=_0x4fa1a1[_0x19a6('0x31')][_0x19a6('0x33')]?_0x4fa1a1['attributes']:_0x585773[_0x19a6('0x2d')];_0x4fa1a1['order']=qs[_0x19a6('0x36')](_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x36')]);_0x4fa1a1['where']=qs[_0x19a6('0x2f')](_[_0x19a6('0x38')](_0xc1c2f0['query'],_0x585773[_0x19a6('0x2f')]));if(_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x39')]){_0x4fa1a1[_0x19a6('0x37')]=_[_0x19a6('0x40')](_0x4fa1a1[_0x19a6('0x37')],{'$or':_[_0x19a6('0x28')](_0x4fa1a1[_0x19a6('0x31')],function(_0x2006ee){var _0x3bee87={};_0x3bee87[_0x2006ee]={'$like':'%'+_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x39')]+'%'};return _0x3bee87;})});}_0x4fa1a1=_[_0x19a6('0x40')]({},_0x4fa1a1,_0xc1c2f0[_0x19a6('0x4b')]);return _0x2a632e[_0x19a6('0x4c')](_0x4fa1a1);}})['then'](function(_0x172eff){if(_0x172eff){_0x447407=_0x172eff[_0x19a6('0x33')];if(!_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x34')](_0x19a6('0x35'))){_0x4fa1a1[_0x19a6('0x1d')]=qs[_0x19a6('0x1d')](_0xc1c2f0[_0x19a6('0x2e')]['limit']);_0x4fa1a1[_0x19a6('0x1b')]=qs[_0x19a6('0x1b')](_0xc1c2f0[_0x19a6('0x2e')][_0x19a6('0x1b')]);}return _0x2a632e[_0x19a6('0x4c')](_0x4fa1a1);}})[_0x19a6('0x22')](function(_0x1f413e){if(_0x1f413e){return _0x1f413e?{'count':_0x447407,'rows':_0x1f413e}:null;}})[_0x19a6('0x22')](respondWithResult(_0x5eb85a,null))[_0x19a6('0x44')](handleError(_0x5eb85a,null));};
\ No newline at end of file
index 02ea223..9d1bf09 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a86=['./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a86,0xf6));var _0x67a8=function(_0x12f8bf,_0x1ac821){_0x12f8bf=_0x12f8bf-0x0;var _0x43fdfa=_0x7a86[_0x12f8bf];return _0x43fdfa;};'use strict';var _=require(_0x67a8('0x0'));var util=require(_0x67a8('0x1'));var logger=require('../../config/logger')(_0x67a8('0x2'));var moment=require('moment');var BPromise=require(_0x67a8('0x3'));var rp=require(_0x67a8('0x4'));var fs=require('fs');var path=require(_0x67a8('0x5'));var rimraf=require(_0x67a8('0x6'));var config=require('../../config/environment');var attributes=require(_0x67a8('0x7'));module[_0x67a8('0x8')]=function(_0xb28f39,_0x5a8f7b){return _0xb28f39[_0x67a8('0x9')]('SugarcrmConfiguration',attributes,{'tableName':_0x67a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x21a7=['int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define'];(function(_0x46266b,_0x29c9a4){var _0x1f08d6=function(_0x39760d){while(--_0x39760d){_0x46266b['push'](_0x46266b['shift']());}};_0x1f08d6(++_0x29c9a4);}(_0x21a7,0xd1));var _0x721a=function(_0x1db75c,_0x58a560){_0x1db75c=_0x1db75c-0x0;var _0x16542a=_0x21a7[_0x1db75c];return _0x16542a;};'use strict';var _=require(_0x721a('0x0'));var util=require(_0x721a('0x1'));var logger=require(_0x721a('0x2'))(_0x721a('0x3'));var moment=require(_0x721a('0x4'));var BPromise=require(_0x721a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x721a('0x6'));var rimraf=require(_0x721a('0x7'));var config=require(_0x721a('0x8'));var attributes=require(_0x721a('0x9'));module[_0x721a('0xa')]=function(_0x3ecd42,_0x359eac){return _0x3ecd42[_0x721a('0xb')]('SugarcrmConfiguration',attributes,{'tableName':_0x721a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9666e56..81d267a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd9f=['../../config/utils','rpc','../../config/environment','client','http','request','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x408e5c,_0x26327d){var _0x4ba8d0=function(_0x481bcb){while(--_0x481bcb){_0x408e5c['push'](_0x408e5c['shift']());}};_0x4ba8d0(++_0x26327d);}(_0xfd9f,0x1b3));var _0xffd9=function(_0x6a4c0,_0x33a4e0){_0x6a4c0=_0x6a4c0-0x0;var _0x3413e4=_0xfd9f[_0x6a4c0];return _0x3413e4;};'use strict';var _=require(_0xffd9('0x0'));var util=require('util');var moment=require(_0xffd9('0x1'));var BPromise=require(_0xffd9('0x2'));var rs=require(_0xffd9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffd9('0x4'))['db'];var utils=require(_0xffd9('0x5'));var logger=require('../../config/logger')(_0xffd9('0x6'));var config=require(_0xffd9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xffd9('0x8')][_0xffd9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x23626f,_0x3e0dd1,_0x47d641){return new BPromise(function(_0x2c37bb,_0xadfd00){return client[_0xffd9('0xa')](_0x23626f,_0x47d641)['then'](function(_0x1641da){logger['info'](_0xffd9('0xb'),_0x3e0dd1,_0xffd9('0xc'));logger['debug'](_0xffd9('0xd'),_0x3e0dd1,'request\x20sent',JSON[_0xffd9('0xe')](_0x1641da));if(_0x1641da['error']){if(_0x1641da[_0xffd9('0xf')]['code']===0x1f4){logger[_0xffd9('0xf')](_0xffd9('0xb'),_0x3e0dd1,_0x1641da[_0xffd9('0xf')][_0xffd9('0x10')]);return _0xadfd00(_0x1641da[_0xffd9('0xf')][_0xffd9('0x10')]);}logger[_0xffd9('0xf')](_0xffd9('0xb'),_0x3e0dd1,_0x1641da[_0xffd9('0xf')][_0xffd9('0x10')]);return _0x2c37bb(_0x1641da[_0xffd9('0xf')][_0xffd9('0x10')]);}else{logger[_0xffd9('0x11')](_0xffd9('0xb'),_0x3e0dd1,_0xffd9('0xc'));_0x2c37bb(_0x1641da[_0xffd9('0x12')][_0xffd9('0x10')]);}})[_0xffd9('0x13')](function(_0x5dcef0){logger[_0xffd9('0xf')](_0xffd9('0xb'),_0x3e0dd1,_0x5dcef0);_0xadfd00(_0x5dcef0);});});}
\ No newline at end of file
+var _0x2db5=['code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x488b31,_0x3b3519){var _0x3822a3=function(_0x50d890){while(--_0x50d890){_0x488b31['push'](_0x488b31['shift']());}};_0x3822a3(++_0x3b3519);}(_0x2db5,0x191));var _0x52db=function(_0x2b9d5c,_0x173518){_0x2b9d5c=_0x2b9d5c-0x0;var _0x37bb93=_0x2db5[_0x2b9d5c];return _0x37bb93;};'use strict';var _=require(_0x52db('0x0'));var util=require(_0x52db('0x1'));var moment=require(_0x52db('0x2'));var BPromise=require(_0x52db('0x3'));var rs=require(_0x52db('0x4'));var fs=require('fs');var Redis=require(_0x52db('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x52db('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x52db('0x7'));var jayson=require(_0x52db('0x8'));var client=jayson[_0x52db('0x9')][_0x52db('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b990f,_0xf790b7,_0xb3bf3){return new BPromise(function(_0x5e8149,_0x381b5b){return client[_0x52db('0xb')](_0x5b990f,_0xb3bf3)[_0x52db('0xc')](function(_0x298f55){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0xf790b7,'request\x20sent');logger['debug'](_0x52db('0xd'),_0xf790b7,_0x52db('0xe'),JSON[_0x52db('0xf')](_0x298f55));if(_0x298f55[_0x52db('0x10')]){if(_0x298f55[_0x52db('0x10')][_0x52db('0x11')]===0x1f4){logger[_0x52db('0x10')](_0x52db('0x12'),_0xf790b7,_0x298f55[_0x52db('0x10')]['message']);return _0x381b5b(_0x298f55[_0x52db('0x10')][_0x52db('0x13')]);}logger[_0x52db('0x10')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xf790b7,_0x298f55[_0x52db('0x10')][_0x52db('0x13')]);return _0x5e8149(_0x298f55[_0x52db('0x10')][_0x52db('0x13')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0xf790b7,_0x52db('0xe'));_0x5e8149(_0x298f55[_0x52db('0x14')][_0x52db('0x13')]);}})[_0x52db('0x15')](function(_0x19d29e){logger[_0x52db('0x10')](_0x52db('0x12'),_0xf790b7,_0x19d29e);_0x381b5b(_0x19d29e);});});}
\ No newline at end of file
index 0bf4c04..b1b6f76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7ee6=['update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x3e377c,_0x264895){var _0x50ed20=function(_0x12e24f){while(--_0x12e24f){_0x3e377c['push'](_0x3e377c['shift']());}};_0x50ed20(++_0x264895);}(_0x7ee6,0xa3));var _0x67ee=function(_0x2de2ba,_0x3cd038){_0x2de2ba=_0x2de2ba-0x0;var _0x30284d=_0x7ee6[_0x2de2ba];return _0x30284d;};'use strict';var multer=require(_0x67ee('0x0'));var util=require(_0x67ee('0x1'));var path=require(_0x67ee('0x2'));var timeout=require(_0x67ee('0x3'));var express=require(_0x67ee('0x4'));var router=express['Router']();var fs_extra=require(_0x67ee('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x67ee('0x6'));var config=require(_0x67ee('0x7'));var controller=require(_0x67ee('0x8'));router[_0x67ee('0x9')]('/',auth[_0x67ee('0xa')](),controller[_0x67ee('0xb')]);router[_0x67ee('0x9')](_0x67ee('0xc'),auth[_0x67ee('0xa')](),controller[_0x67ee('0xd')]);router[_0x67ee('0xe')]('/',auth[_0x67ee('0xa')](),controller[_0x67ee('0xf')]);router[_0x67ee('0x10')](_0x67ee('0xc'),auth[_0x67ee('0xa')](),controller[_0x67ee('0x11')]);router[_0x67ee('0x12')](_0x67ee('0xc'),auth[_0x67ee('0xa')](),controller[_0x67ee('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x02eb=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','show','create'];(function(_0x355193,_0x394d3e){var _0x1e6904=function(_0x26db84){while(--_0x26db84){_0x355193['push'](_0x355193['shift']());}};_0x1e6904(++_0x394d3e);}(_0x02eb,0xe2));var _0xb02e=function(_0x53c02a,_0x1c906b){_0x53c02a=_0x53c02a-0x0;var _0x1e9ac9=_0x02eb[_0x53c02a];return _0x1e9ac9;};'use strict';var multer=require(_0xb02e('0x0'));var util=require(_0xb02e('0x1'));var path=require(_0xb02e('0x2'));var timeout=require(_0xb02e('0x3'));var express=require(_0xb02e('0x4'));var router=express[_0xb02e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb02e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb02e('0x7'));var controller=require(_0xb02e('0x8'));router[_0xb02e('0x9')]('/',auth[_0xb02e('0xa')](),controller[_0xb02e('0xb')]);router[_0xb02e('0x9')]('/:id',auth[_0xb02e('0xa')](),controller[_0xb02e('0xc')]);router['post']('/',auth[_0xb02e('0xa')](),controller[_0xb02e('0xd')]);router[_0xb02e('0xe')](_0xb02e('0xf'),auth[_0xb02e('0xa')](),controller[_0xb02e('0x10')]);router[_0xb02e('0x11')](_0xb02e('0xf'),auth[_0xb02e('0xa')](),controller[_0xb02e('0x12')]);module[_0xb02e('0x13')]=router;
\ No newline at end of file
index d24ade8..080fb87 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe925=['customVariable','sequelize','string','variable','keyValue','picklist','STRING','ENUM'];(function(_0x4d8ae7,_0x1438a9){var _0x3841d8=function(_0x35a1a7){while(--_0x35a1a7){_0x4d8ae7['push'](_0x4d8ae7['shift']());}};_0x3841d8(++_0x1438a9);}(_0xe925,0x159));var _0x5e92=function(_0x3af524,_0x3e46b1){_0x3af524=_0x3af524-0x0;var _0x3e82d8=_0xe925[_0x3af524];return _0x3e82d8;};'use strict';var Sequelize=require(_0x5e92('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x5e92('0x1'),_0x5e92('0x2'),'customVariable',_0x5e92('0x3'),_0x5e92('0x4')),'defaultValue':_0x5e92('0x1')},'content':{'type':Sequelize[_0x5e92('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x5e92('0x6')](_0x5e92('0x1'),_0x5e92('0x2'),_0x5e92('0x7'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5e92('0x5')]},'nameField':{'type':Sequelize[_0x5e92('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5e92('0x5')]}};
\ No newline at end of file
+var _0x5149=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x17cafc,_0x2b3019){var _0x3b32d3=function(_0x5a8fa5){while(--_0x5a8fa5){_0x17cafc['push'](_0x17cafc['shift']());}};_0x3b32d3(++_0x2b3019);}(_0x5149,0x1cc));var _0x9514=function(_0x2a9479,_0x394989){_0x2a9479=_0x2a9479-0x0;var _0x472b13=_0x5149[_0x2a9479];return _0x472b13;};'use strict';var Sequelize=require(_0x9514('0x0'));module[_0x9514('0x1')]={'type':{'type':Sequelize[_0x9514('0x2')](_0x9514('0x3'),'variable',_0x9514('0x4'),_0x9514('0x5'),_0x9514('0x6')),'defaultValue':_0x9514('0x3')},'content':{'type':Sequelize[_0x9514('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x9514('0x2')](_0x9514('0x3'),_0x9514('0x8'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x9514('0x7')]},'nameField':{'type':Sequelize[_0x9514('0x7')]},'customField':{'type':Sequelize[_0x9514('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9514('0x7')]}};
\ No newline at end of file
index c528f76..c27374a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0079=['attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','options','SugarcrmField','include','findAll','catch','includeAll','find','body','params','eml-format','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','fieldName','type','key','model','query','keys'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0079,0x1ad));var _0x9007=function(_0x3df721,_0x3e4551){_0x3df721=_0x3df721-0x0;var _0x507265=_0x0079[_0x3df721];return _0x507265;};'use strict';var emlformat=require(_0x9007('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9007('0x1'));var moment=require('moment');var BPromise=require(_0x9007('0x2'));var Mustache=require('mustache');var util=require(_0x9007('0x3'));var path=require(_0x9007('0x4'));var sox=require(_0x9007('0x5'));var csv=require(_0x9007('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9007('0x7'));var squel=require(_0x9007('0x8'));var crypto=require(_0x9007('0x9'));var jsforce=require(_0x9007('0xa'));var deskjs=require(_0x9007('0xb'));var toCsv=require(_0x9007('0x6'));var querystring=require(_0x9007('0xc'));var Papa=require(_0x9007('0xd'));var Redis=require(_0x9007('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x9007('0xf'));var as=require(_0x9007('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9007('0x11'))(_0x9007('0x12'));var utils=require('../../config/utils');var config=require(_0x9007('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x9007('0x14'))['db'];function respondWithStatusCode(_0x33b2c2,_0x17e07b){_0x17e07b=_0x17e07b||0xcc;return function(_0x13af91){if(_0x13af91){return _0x33b2c2[_0x9007('0x15')](_0x17e07b);}return _0x33b2c2['status'](_0x17e07b)[_0x9007('0x16')]();};}function respondWithResult(_0x4c9f5e,_0x4c1aae){_0x4c1aae=_0x4c1aae||0xc8;return function(_0x11bcda){if(_0x11bcda){return _0x4c9f5e[_0x9007('0x17')](_0x4c1aae)[_0x9007('0x18')](_0x11bcda);}};}function respondWithFilteredResult(_0x6faa40,_0x2550c7){return function(_0x1a8583){if(_0x1a8583){var _0x4b8456=typeof _0x2550c7[_0x9007('0x19')]===_0x9007('0x1a')&&typeof _0x2550c7['limit']===_0x9007('0x1a');var _0x5ebdbd=_0x1a8583[_0x9007('0x1b')];var _0x5f26e8=_0x4b8456?0x0:_0x2550c7['offset'];var _0x1fc1ed=_0x4b8456?_0x1a8583[_0x9007('0x1b')]:_0x2550c7['offset']+_0x2550c7[_0x9007('0x1c')];var _0x997617;if(_0x1fc1ed>=_0x5ebdbd){_0x1fc1ed=_0x5ebdbd;_0x997617=0xc8;}else{_0x997617=0xce;}_0x6faa40[_0x9007('0x17')](_0x997617);return _0x6faa40[_0x9007('0x1d')](_0x9007('0x1e'),_0x5f26e8+'-'+_0x1fc1ed+'/'+_0x5ebdbd)[_0x9007('0x18')](_0x1a8583);}return null;};}function patchUpdates(_0x33e646){return function(_0x4ee355){try{jsonpatch[_0x9007('0x1f')](_0x4ee355,_0x33e646,!![]);}catch(_0x18e672){return BPromise[_0x9007('0x20')](_0x18e672);}return _0x4ee355[_0x9007('0x21')]();};}function saveUpdates(_0x34d10c,_0x300944){return function(_0x17eb6d){if(_0x17eb6d){return _0x17eb6d[_0x9007('0x22')](_0x34d10c)[_0x9007('0x23')](function(_0xe295b2){return _0xe295b2;});}return null;};}function removeEntity(_0xdb3567,_0x1dd6d5){return function(_0x4434b6){if(_0x4434b6){return _0x4434b6[_0x9007('0x24')]()[_0x9007('0x23')](function(){_0xdb3567[_0x9007('0x17')](0xcc)[_0x9007('0x16')]();});}};}function handleEntityNotFound(_0x26ee11,_0x27e46c){return function(_0x2f97a6){if(!_0x2f97a6){_0x26ee11[_0x9007('0x15')](0x194);}return _0x2f97a6;};}function handleError(_0x41ec3c,_0x323be7){_0x323be7=_0x323be7||0x1f4;return function(_0x4c0ceb){logger['error'](_0x4c0ceb['stack']);if(_0x4c0ceb[_0x9007('0x25')]){delete _0x4c0ceb['name'];}_0x41ec3c[_0x9007('0x17')](_0x323be7)[_0x9007('0x26')](_0x4c0ceb);};}exports[_0x9007('0x27')]=function(_0x5a013d,_0x317a97){var _0x206290={},_0x1c6585={},_0x102924={'count':0x0,'rows':[]};var _0xaf9acf=_[_0x9007('0x28')](db['SugarcrmField']['rawAttributes'],function(_0x46d083){return{'name':_0x46d083[_0x9007('0x29')],'type':_0x46d083[_0x9007('0x2a')][_0x9007('0x2b')]};});_0x1c6585[_0x9007('0x2c')]=_['map'](_0xaf9acf,_0x9007('0x25'));_0x1c6585[_0x9007('0x2d')]=_[_0x9007('0x2e')](_0x5a013d[_0x9007('0x2d')]);_0x1c6585['filters']=_['intersection'](_0x1c6585[_0x9007('0x2c')],_0x1c6585[_0x9007('0x2d')]);_0x206290[_0x9007('0x2f')]=_[_0x9007('0x30')](_0x1c6585[_0x9007('0x2c')],qs[_0x9007('0x31')](_0x5a013d['query'][_0x9007('0x31')]));_0x206290[_0x9007('0x2f')]=_0x206290['attributes'][_0x9007('0x32')]?_0x206290[_0x9007('0x2f')]:_0x1c6585[_0x9007('0x2c')];if(!_0x5a013d['query']['hasOwnProperty'](_0x9007('0x33'))){_0x206290['limit']=qs[_0x9007('0x1c')](_0x5a013d[_0x9007('0x2d')][_0x9007('0x1c')]);_0x206290[_0x9007('0x19')]=qs[_0x9007('0x19')](_0x5a013d[_0x9007('0x2d')]['offset']);}_0x206290[_0x9007('0x34')]=qs[_0x9007('0x35')](_0x5a013d['query'][_0x9007('0x35')]);_0x206290[_0x9007('0x36')]=qs[_0x9007('0x37')](_[_0x9007('0x38')](_0x5a013d[_0x9007('0x2d')],_0x1c6585[_0x9007('0x37')]),_0xaf9acf);if(_0x5a013d['query'][_0x9007('0x39')]){_0x206290['where']=_['merge'](_0x206290[_0x9007('0x36')],{'$or':_['map'](_0xaf9acf,function(_0x264182){if(_0x264182[_0x9007('0x2a')]!=='VIRTUAL'){var _0x578c0b={};_0x578c0b[_0x264182['name']]={'$like':'%'+_0x5a013d[_0x9007('0x2d')][_0x9007('0x39')]+'%'};return _0x578c0b;}})});}_0x206290=_[_0x9007('0x3a')]({},_0x206290,_0x5a013d[_0x9007('0x3b')]);var _0x4bbb30={'where':_0x206290['where']};return db[_0x9007('0x3c')][_0x9007('0x1b')](_0x4bbb30)[_0x9007('0x23')](function(_0x463d1e){_0x102924['count']=_0x463d1e;if(_0x5a013d[_0x9007('0x2d')]['includeAll']){_0x206290[_0x9007('0x3d')]=[{'all':!![]}];}return db['SugarcrmField'][_0x9007('0x3e')](_0x206290);})[_0x9007('0x23')](function(_0x18936c){_0x102924['rows']=_0x18936c;return _0x102924;})[_0x9007('0x23')](respondWithFilteredResult(_0x317a97,_0x206290))[_0x9007('0x3f')](handleError(_0x317a97,null));};exports['show']=function(_0x448e60,_0x4b99b6){var _0x268cb5={'raw':!![],'where':{'id':_0x448e60['params']['id']}},_0x2e9b02={};_0x2e9b02['model']=_[_0x9007('0x2e')](db[_0x9007('0x3c')]['rawAttributes']);_0x2e9b02[_0x9007('0x2d')]=_[_0x9007('0x2e')](_0x448e60[_0x9007('0x2d')]);_0x2e9b02[_0x9007('0x37')]=_[_0x9007('0x30')](_0x2e9b02[_0x9007('0x2c')],_0x2e9b02[_0x9007('0x2d')]);_0x268cb5[_0x9007('0x2f')]=_[_0x9007('0x30')](_0x2e9b02[_0x9007('0x2c')],qs[_0x9007('0x31')](_0x448e60[_0x9007('0x2d')][_0x9007('0x31')]));_0x268cb5[_0x9007('0x2f')]=_0x268cb5[_0x9007('0x2f')][_0x9007('0x32')]?_0x268cb5[_0x9007('0x2f')]:_0x2e9b02[_0x9007('0x2c')];if(_0x448e60[_0x9007('0x2d')][_0x9007('0x40')]){_0x268cb5[_0x9007('0x3d')]=[{'all':!![]}];}_0x268cb5=_[_0x9007('0x3a')]({},_0x268cb5,_0x448e60[_0x9007('0x3b')]);return db[_0x9007('0x3c')][_0x9007('0x41')](_0x268cb5)[_0x9007('0x23')](handleEntityNotFound(_0x4b99b6,null))[_0x9007('0x23')](respondWithResult(_0x4b99b6,null))[_0x9007('0x3f')](handleError(_0x4b99b6,null));};exports['create']=function(_0xdf3c5f,_0x1134be){return db[_0x9007('0x3c')]['create'](_0xdf3c5f['body'],{})['then'](respondWithResult(_0x1134be,0xc9))['catch'](handleError(_0x1134be,null));};exports[_0x9007('0x22')]=function(_0x159884,_0x24bd05){if(_0x159884[_0x9007('0x42')]['id']){delete _0x159884[_0x9007('0x42')]['id'];}return db[_0x9007('0x3c')][_0x9007('0x41')]({'where':{'id':_0x159884[_0x9007('0x43')]['id']}})[_0x9007('0x23')](handleEntityNotFound(_0x24bd05,null))[_0x9007('0x23')](saveUpdates(_0x159884['body'],null))[_0x9007('0x23')](respondWithResult(_0x24bd05,null))[_0x9007('0x3f')](handleError(_0x24bd05,null));};exports[_0x9007('0x24')]=function(_0x21c22f,_0x53d313){return db[_0x9007('0x3c')]['find']({'where':{'id':_0x21c22f[_0x9007('0x43')]['id']}})[_0x9007('0x23')](handleEntityNotFound(_0x53d313,null))['then'](removeEntity(_0x53d313,null))[_0x9007('0x3f')](handleError(_0x53d313,null));};
\ No newline at end of file
+var _0x6335=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SugarcrmField','count','findAll','rows','catch','show','params','filters','include','create','body','find','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring'];(function(_0x53497d,_0x530a14){var _0x5dfe2a=function(_0x354661){while(--_0x354661){_0x53497d['push'](_0x53497d['shift']());}};_0x5dfe2a(++_0x530a14);}(_0x6335,0xcf));var _0x5633=function(_0x2b2142,_0x9a4580){_0x2b2142=_0x2b2142-0x0;var _0x23f060=_0x6335[_0x2b2142];return _0x23f060;};'use strict';var emlformat=require(_0x5633('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5633('0x1'));var rp=require(_0x5633('0x2'));var moment=require(_0x5633('0x3'));var BPromise=require(_0x5633('0x4'));var Mustache=require(_0x5633('0x5'));var util=require(_0x5633('0x6'));var path=require(_0x5633('0x7'));var sox=require(_0x5633('0x8'));var csv=require(_0x5633('0x9'));var ejs=require(_0x5633('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5633('0xb'));var crypto=require(_0x5633('0xc'));var jsforce=require(_0x5633('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5633('0x9'));var querystring=require(_0x5633('0xe'));var Papa=require(_0x5633('0xf'));var Redis=require(_0x5633('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5633('0x11'));var as=require(_0x5633('0x12'));var hardwareService=require(_0x5633('0x13'));var logger=require(_0x5633('0x14'))(_0x5633('0x15'));var utils=require(_0x5633('0x16'));var config=require(_0x5633('0x17'));var licenseUtil=require(_0x5633('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x486757,_0x24308c){_0x24308c=_0x24308c||0xcc;return function(_0x474093){if(_0x474093){return _0x486757[_0x5633('0x19')](_0x24308c);}return _0x486757[_0x5633('0x1a')](_0x24308c)[_0x5633('0x1b')]();};}function respondWithResult(_0x16fe6e,_0x3cb8bd){_0x3cb8bd=_0x3cb8bd||0xc8;return function(_0x173dc5){if(_0x173dc5){return _0x16fe6e[_0x5633('0x1a')](_0x3cb8bd)[_0x5633('0x1c')](_0x173dc5);}};}function respondWithFilteredResult(_0x468dec,_0x30e8a1){return function(_0x9d9995){if(_0x9d9995){var _0x4b194e=typeof _0x30e8a1[_0x5633('0x1d')]===_0x5633('0x1e')&&typeof _0x30e8a1[_0x5633('0x1f')]===_0x5633('0x1e');var _0x26dbdc=_0x9d9995['count'];var _0x46f4b8=_0x4b194e?0x0:_0x30e8a1[_0x5633('0x1d')];var _0x37a14c=_0x4b194e?_0x9d9995['count']:_0x30e8a1[_0x5633('0x1d')]+_0x30e8a1['limit'];var _0x86752c;if(_0x37a14c>=_0x26dbdc){_0x37a14c=_0x26dbdc;_0x86752c=0xc8;}else{_0x86752c=0xce;}_0x468dec[_0x5633('0x1a')](_0x86752c);return _0x468dec[_0x5633('0x20')](_0x5633('0x21'),_0x46f4b8+'-'+_0x37a14c+'/'+_0x26dbdc)['json'](_0x9d9995);}return null;};}function patchUpdates(_0x236c51){return function(_0x46df72){try{jsonpatch[_0x5633('0x22')](_0x46df72,_0x236c51,!![]);}catch(_0x5b56b8){return BPromise[_0x5633('0x23')](_0x5b56b8);}return _0x46df72[_0x5633('0x24')]();};}function saveUpdates(_0x111bf6,_0x2feb10){return function(_0x1af652){if(_0x1af652){return _0x1af652[_0x5633('0x25')](_0x111bf6)[_0x5633('0x26')](function(_0x54ec7d){return _0x54ec7d;});}return null;};}function removeEntity(_0x57f47b,_0x582ac9){return function(_0x107b47){if(_0x107b47){return _0x107b47[_0x5633('0x27')]()[_0x5633('0x26')](function(){_0x57f47b['status'](0xcc)[_0x5633('0x1b')]();});}};}function handleEntityNotFound(_0x4015cd,_0x4f7e54){return function(_0x552f73){if(!_0x552f73){_0x4015cd['sendStatus'](0x194);}return _0x552f73;};}function handleError(_0x5bcb82,_0x5e024b){_0x5e024b=_0x5e024b||0x1f4;return function(_0x3d2b8d){logger[_0x5633('0x28')](_0x3d2b8d[_0x5633('0x29')]);if(_0x3d2b8d[_0x5633('0x2a')]){delete _0x3d2b8d['name'];}_0x5bcb82['status'](_0x5e024b)['send'](_0x3d2b8d);};}exports[_0x5633('0x2b')]=function(_0x884df9,_0x1b24e9){var _0x466a28={},_0x59b149={},_0x5c0ef6={'count':0x0,'rows':[]};var _0x1ef061=_[_0x5633('0x2c')](db['SugarcrmField'][_0x5633('0x2d')],function(_0x1e9182){return{'name':_0x1e9182['fieldName'],'type':_0x1e9182['type']['key']};});_0x59b149[_0x5633('0x2e')]=_['map'](_0x1ef061,_0x5633('0x2a'));_0x59b149['query']=_[_0x5633('0x2f')](_0x884df9[_0x5633('0x30')]);_0x59b149['filters']=_['intersection'](_0x59b149[_0x5633('0x2e')],_0x59b149[_0x5633('0x30')]);_0x466a28['attributes']=_[_0x5633('0x31')](_0x59b149[_0x5633('0x2e')],qs[_0x5633('0x32')](_0x884df9[_0x5633('0x30')][_0x5633('0x32')]));_0x466a28[_0x5633('0x33')]=_0x466a28['attributes'][_0x5633('0x34')]?_0x466a28[_0x5633('0x33')]:_0x59b149[_0x5633('0x2e')];if(!_0x884df9[_0x5633('0x30')][_0x5633('0x35')](_0x5633('0x36'))){_0x466a28[_0x5633('0x1f')]=qs[_0x5633('0x1f')](_0x884df9[_0x5633('0x30')][_0x5633('0x1f')]);_0x466a28[_0x5633('0x1d')]=qs[_0x5633('0x1d')](_0x884df9[_0x5633('0x30')][_0x5633('0x1d')]);}_0x466a28[_0x5633('0x37')]=qs[_0x5633('0x38')](_0x884df9['query'][_0x5633('0x38')]);_0x466a28[_0x5633('0x39')]=qs['filters'](_['pick'](_0x884df9['query'],_0x59b149['filters']),_0x1ef061);if(_0x884df9[_0x5633('0x30')][_0x5633('0x3a')]){_0x466a28[_0x5633('0x39')]=_[_0x5633('0x3b')](_0x466a28['where'],{'$or':_[_0x5633('0x2c')](_0x1ef061,function(_0x3074e4){if(_0x3074e4['type']!==_0x5633('0x3c')){var _0x5f168b={};_0x5f168b[_0x3074e4[_0x5633('0x2a')]]={'$like':'%'+_0x884df9['query'][_0x5633('0x3a')]+'%'};return _0x5f168b;}})});}_0x466a28=_[_0x5633('0x3b')]({},_0x466a28,_0x884df9[_0x5633('0x3d')]);var _0x4ce229={'where':_0x466a28[_0x5633('0x39')]};return db[_0x5633('0x3e')][_0x5633('0x3f')](_0x4ce229)[_0x5633('0x26')](function(_0x4aae32){_0x5c0ef6['count']=_0x4aae32;if(_0x884df9[_0x5633('0x30')]['includeAll']){_0x466a28['include']=[{'all':!![]}];}return db[_0x5633('0x3e')][_0x5633('0x40')](_0x466a28);})[_0x5633('0x26')](function(_0x438f58){_0x5c0ef6[_0x5633('0x41')]=_0x438f58;return _0x5c0ef6;})['then'](respondWithFilteredResult(_0x1b24e9,_0x466a28))[_0x5633('0x42')](handleError(_0x1b24e9,null));};exports[_0x5633('0x43')]=function(_0x962e30,_0x4fe878){var _0x4a1206={'raw':!![],'where':{'id':_0x962e30[_0x5633('0x44')]['id']}},_0x50ffb3={};_0x50ffb3['model']=_[_0x5633('0x2f')](db['SugarcrmField'][_0x5633('0x2d')]);_0x50ffb3[_0x5633('0x30')]=_[_0x5633('0x2f')](_0x962e30[_0x5633('0x30')]);_0x50ffb3[_0x5633('0x45')]=_['intersection'](_0x50ffb3[_0x5633('0x2e')],_0x50ffb3[_0x5633('0x30')]);_0x4a1206[_0x5633('0x33')]=_[_0x5633('0x31')](_0x50ffb3[_0x5633('0x2e')],qs[_0x5633('0x32')](_0x962e30['query'][_0x5633('0x32')]));_0x4a1206[_0x5633('0x33')]=_0x4a1206['attributes'][_0x5633('0x34')]?_0x4a1206[_0x5633('0x33')]:_0x50ffb3[_0x5633('0x2e')];if(_0x962e30[_0x5633('0x30')]['includeAll']){_0x4a1206[_0x5633('0x46')]=[{'all':!![]}];}_0x4a1206=_['merge']({},_0x4a1206,_0x962e30['options']);return db[_0x5633('0x3e')]['find'](_0x4a1206)[_0x5633('0x26')](handleEntityNotFound(_0x4fe878,null))[_0x5633('0x26')](respondWithResult(_0x4fe878,null))['catch'](handleError(_0x4fe878,null));};exports['create']=function(_0x20b85a,_0x3e38be){return db[_0x5633('0x3e')][_0x5633('0x47')](_0x20b85a[_0x5633('0x48')],{})[_0x5633('0x26')](respondWithResult(_0x3e38be,0xc9))[_0x5633('0x42')](handleError(_0x3e38be,null));};exports[_0x5633('0x25')]=function(_0x4dd32b,_0x348014){if(_0x4dd32b[_0x5633('0x48')]['id']){delete _0x4dd32b[_0x5633('0x48')]['id'];}return db[_0x5633('0x3e')][_0x5633('0x49')]({'where':{'id':_0x4dd32b[_0x5633('0x44')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x348014,null))[_0x5633('0x26')](saveUpdates(_0x4dd32b['body'],null))[_0x5633('0x26')](respondWithResult(_0x348014,null))[_0x5633('0x42')](handleError(_0x348014,null));};exports['destroy']=function(_0x30d7b9,_0x24af2a){return db[_0x5633('0x3e')]['find']({'where':{'id':_0x30d7b9[_0x5633('0x44')]['id']}})[_0x5633('0x26')](handleEntityNotFound(_0x24af2a,null))[_0x5633('0x26')](removeEntity(_0x24af2a,null))[_0x5633('0x42')](handleError(_0x24af2a,null));};
\ No newline at end of file
index 6413dd4..9909a9b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdcab=['request-promise','rimraf','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','idField','FieldId','util','api','moment','bluebird'];(function(_0x3240ae,_0x5a632e){var _0x4b9f31=function(_0x5c3f7c){while(--_0x5c3f7c){_0x3240ae['push'](_0x3240ae['shift']());}};_0x4b9f31(++_0x5a632e);}(_0xdcab,0x134));var _0xbdca=function(_0x49e9f7,_0x2f1c59){_0x49e9f7=_0x49e9f7-0x0;var _0x1e3033=_0xdcab[_0x49e9f7];return _0x1e3033;};'use strict';var _=require('lodash');var util=require(_0xbdca('0x0'));var logger=require('../../config/logger')(_0xbdca('0x1'));var moment=require(_0xbdca('0x2'));var BPromise=require(_0xbdca('0x3'));var rp=require(_0xbdca('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbdca('0x5'));var config=require('../../config/environment');var attributes=require(_0xbdca('0x6'));module[_0xbdca('0x7')]=function(_0x4738dc,_0x593fff){return _0x4738dc[_0xbdca('0x8')](_0xbdca('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xbdca('0xa'),'fields':[_0xbdca('0xb'),_0xbdca('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x423e=['idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x18c2dc,_0xb9441d){var _0x48fb3d=function(_0x401cc8){while(--_0x401cc8){_0x18c2dc['push'](_0x18c2dc['shift']());}};_0x48fb3d(++_0xb9441d);}(_0x423e,0x14c));var _0xe423=function(_0x6fabdb,_0x168fcd){_0x6fabdb=_0x6fabdb-0x0;var _0x58c0c2=_0x423e[_0x6fabdb];return _0x58c0c2;};'use strict';var _=require('lodash');var util=require(_0xe423('0x0'));var logger=require(_0xe423('0x1'))(_0xe423('0x2'));var moment=require(_0xe423('0x3'));var BPromise=require(_0xe423('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe423('0x5'));var rimraf=require(_0xe423('0x6'));var config=require(_0xe423('0x7'));var attributes=require('./intSugarcrmField.attributes');module[_0xe423('0x8')]=function(_0x5d0010,_0x4ffd0f){return _0x5d0010[_0xe423('0x9')](_0xe423('0xa'),attributes,{'tableName':_0xe423('0xb'),'paranoid':![],'indexes':[{'name':_0xe423('0xc'),'fields':[_0xe423('0xd'),_0xe423('0xe')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 9447ddf..d67343e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa6a6=['info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','SugarcrmField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa6a6,0x1ba));var _0x6a6a=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xa6a6[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x6a6a('0x0'));var util=require(_0x6a6a('0x1'));var moment=require(_0x6a6a('0x2'));var BPromise=require(_0x6a6a('0x3'));var rs=require(_0x6a6a('0x4'));var fs=require('fs');var Redis=require(_0x6a6a('0x5'));var db=require(_0x6a6a('0x6'))['db'];var utils=require(_0x6a6a('0x7'));var logger=require('../../config/logger')(_0x6a6a('0x8'));var config=require(_0x6a6a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6a6a('0xa')][_0x6a6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x310bbc,_0x1ac243,_0x594f50){return new BPromise(function(_0x4a66e7,_0x3f95de){return client[_0x6a6a('0xc')](_0x310bbc,_0x594f50)[_0x6a6a('0xd')](function(_0xec3a3c){logger[_0x6a6a('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x1ac243,_0x6a6a('0xf'));logger[_0x6a6a('0x10')](_0x6a6a('0x11'),_0x1ac243,_0x6a6a('0xf'),JSON[_0x6a6a('0x12')](_0xec3a3c));if(_0xec3a3c[_0x6a6a('0x13')]){if(_0xec3a3c[_0x6a6a('0x13')]['code']===0x1f4){logger[_0x6a6a('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x1ac243,_0xec3a3c[_0x6a6a('0x13')][_0x6a6a('0x14')]);return _0x3f95de(_0xec3a3c[_0x6a6a('0x13')][_0x6a6a('0x14')]);}logger['error'](_0x6a6a('0x15'),_0x1ac243,_0xec3a3c['error'][_0x6a6a('0x14')]);return _0x4a66e7(_0xec3a3c[_0x6a6a('0x13')][_0x6a6a('0x14')]);}else{logger[_0x6a6a('0xe')](_0x6a6a('0x15'),_0x1ac243,'request\x20sent');_0x4a66e7(_0xec3a3c[_0x6a6a('0x16')][_0x6a6a('0x14')]);}})[_0x6a6a('0x17')](function(_0x4118e0){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x1ac243,_0x4118e0);_0x3f95de(_0x4118e0);});});}
\ No newline at end of file
+var _0x9d24=['SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug'];(function(_0x5e9c99,_0x5bca7c){var _0x549562=function(_0x12b23f){while(--_0x12b23f){_0x5e9c99['push'](_0x5e9c99['shift']());}};_0x549562(++_0x5bca7c);}(_0x9d24,0x175));var _0x49d2=function(_0x5e3a1b,_0x3226c3){_0x5e3a1b=_0x5e3a1b-0x0;var _0x21bf76=_0x9d24[_0x5e3a1b];return _0x21bf76;};'use strict';var _=require(_0x49d2('0x0'));var util=require(_0x49d2('0x1'));var moment=require(_0x49d2('0x2'));var BPromise=require(_0x49d2('0x3'));var rs=require(_0x49d2('0x4'));var fs=require('fs');var Redis=require(_0x49d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x49d2('0x6'));var logger=require(_0x49d2('0x7'))(_0x49d2('0x8'));var config=require(_0x49d2('0x9'));var jayson=require(_0x49d2('0xa'));var client=jayson[_0x49d2('0xb')][_0x49d2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x597b3f,_0x35b638,_0x2baf49){return new BPromise(function(_0xb1dac6,_0x217c50){return client[_0x49d2('0xd')](_0x597b3f,_0x2baf49)[_0x49d2('0xe')](function(_0x462365){logger[_0x49d2('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x35b638,'request\x20sent');logger[_0x49d2('0x10')](_0x49d2('0x11'),_0x35b638,_0x49d2('0x12'),JSON[_0x49d2('0x13')](_0x462365));if(_0x462365[_0x49d2('0x14')]){if(_0x462365[_0x49d2('0x14')][_0x49d2('0x15')]===0x1f4){logger['error'](_0x49d2('0x16'),_0x35b638,_0x462365[_0x49d2('0x14')][_0x49d2('0x17')]);return _0x217c50(_0x462365[_0x49d2('0x14')]['message']);}logger[_0x49d2('0x14')](_0x49d2('0x16'),_0x35b638,_0x462365['error']['message']);return _0xb1dac6(_0x462365[_0x49d2('0x14')][_0x49d2('0x17')]);}else{logger[_0x49d2('0xf')](_0x49d2('0x16'),_0x35b638,_0x49d2('0x12'));_0xb1dac6(_0x462365[_0x49d2('0x18')]['message']);}})[_0x49d2('0x19')](function(_0x1d04b5){logger[_0x49d2('0x14')](_0x49d2('0x16'),_0x35b638,_0x1d04b5);_0x217c50(_0x1d04b5);});});}
\ No newline at end of file
index bf40df6..46b29d6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe74d=['/:id/fields','create','post','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x4fba4a,_0x1be590){var _0x22cf7a=function(_0x16e68b){while(--_0x16e68b){_0x4fba4a['push'](_0x4fba4a['shift']());}};_0x22cf7a(++_0x1be590);}(_0xe74d,0x16e));var _0xde74=function(_0x30f020,_0x7d2cfa){_0x30f020=_0x30f020-0x0;var _0x3933c0=_0xe74d[_0x30f020];return _0x3933c0;};'use strict';var multer=require(_0xde74('0x0'));var util=require(_0xde74('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xde74('0x2'));var router=express[_0xde74('0x3')]();var fs_extra=require(_0xde74('0x4'));var auth=require(_0xde74('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xde74('0x6'));var controller=require(_0xde74('0x7'));router[_0xde74('0x8')]('/',auth[_0xde74('0x9')](),controller['index']);router[_0xde74('0x8')](_0xde74('0xa'),auth[_0xde74('0x9')](),controller[_0xde74('0xb')]);router[_0xde74('0x8')](_0xde74('0xc'),auth[_0xde74('0x9')](),controller[_0xde74('0xd')]);router[_0xde74('0x8')](_0xde74('0xe'),auth[_0xde74('0x9')](),controller['getFields']);router['post']('/',auth[_0xde74('0x9')](),controller[_0xde74('0xf')]);router[_0xde74('0x10')]('/:id/configurations',auth[_0xde74('0x9')](),controller['addConfiguration']);router['put'](_0xde74('0xa'),auth[_0xde74('0x9')](),controller[_0xde74('0x11')]);router['delete'](_0xde74('0xa'),auth[_0xde74('0x9')](),controller[_0xde74('0x12')]);module[_0xde74('0x13')]=router;
\ No newline at end of file
+var _0x70e9=['post','create','addConfiguration','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x2fd2c6,_0x50553b){var _0x20cc81=function(_0x192be3){while(--_0x192be3){_0x2fd2c6['push'](_0x2fd2c6['shift']());}};_0x20cc81(++_0x50553b);}(_0x70e9,0x193));var _0x970e=function(_0x43b757,_0x2274ef){_0x43b757=_0x43b757-0x0;var _0x556af2=_0x70e9[_0x43b757];return _0x556af2;};'use strict';var multer=require('multer');var util=require(_0x970e('0x0'));var path=require(_0x970e('0x1'));var timeout=require('connect-timeout');var express=require(_0x970e('0x2'));var router=express[_0x970e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x970e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x970e('0x5'));var controller=require(_0x970e('0x6'));router[_0x970e('0x7')]('/',auth[_0x970e('0x8')](),controller[_0x970e('0x9')]);router[_0x970e('0x7')](_0x970e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x970e('0x7')](_0x970e('0xb'),auth['isAuthenticated'](),controller[_0x970e('0xc')]);router[_0x970e('0x7')](_0x970e('0xd'),auth['isAuthenticated'](),controller[_0x970e('0xe')]);router[_0x970e('0xf')]('/',auth[_0x970e('0x8')](),controller[_0x970e('0x10')]);router[_0x970e('0xf')](_0x970e('0xb'),auth['isAuthenticated'](),controller[_0x970e('0x11')]);router[_0x970e('0x12')](_0x970e('0xa'),auth[_0x970e('0x8')](),controller[_0x970e('0x13')]);router[_0x970e('0x14')](_0x970e('0xa'),auth[_0x970e('0x8')](),controller['destroy']);module[_0x970e('0x15')]=router;
\ No newline at end of file
index 06303dd..efd3744 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a2e=['sequelize','exports','STRING'];(function(_0x32f2ce,_0x21434f){var _0x3e24af=function(_0x30d1a4){while(--_0x30d1a4){_0x32f2ce['push'](_0x32f2ce['shift']());}};_0x3e24af(++_0x21434f);}(_0x8a2e,0xf9));var _0xe8a2=function(_0x1668a9,_0x478d00){_0x1668a9=_0x1668a9-0x0;var _0x4d8dc2=_0x8a2e[_0x1668a9];return _0x4d8dc2;};'use strict';var Sequelize=require(_0xe8a2('0x0'));module[_0xe8a2('0x1')]={'name':{'type':Sequelize[_0xe8a2('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xe8a2('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe8a2('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe8a2('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x62bc=['HelpDesk','exports','STRING'];(function(_0x4b8cd6,_0x1ca27f){var _0x58126e=function(_0x24c099){while(--_0x24c099){_0x4b8cd6['push'](_0x4b8cd6['shift']());}};_0x58126e(++_0x1ca27f);}(_0x62bc,0x19f));var _0xc62b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x62bc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc62b('0x0')]={'name':{'type':Sequelize[_0xc62b('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xc62b('0x1')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xc62b('0x1')],'allowNull':![],'defaultValue':_0xc62b('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0xc62b('0x1')],'allowNull':![]}};
\ No newline at end of file
index 4b6b95e..52644d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac33=['key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','include','catch','create','body','find','VtigerConfiguration','order','pick','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','VtigerField','Descriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','result','token','success','sessionName','autogenerated','reference','owner','remove','includes','editable','false','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','reject','update','then','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type'];(function(_0x136a09,_0x3e00e9){var _0x17dfbd=function(_0x2116a3){while(--_0x2116a3){_0x136a09['push'](_0x136a09['shift']());}};_0x17dfbd(++_0x3e00e9);}(_0xac33,0x1ac));var _0x3ac3=function(_0x53f1b3,_0x1976da){_0x53f1b3=_0x53f1b3-0x0;var _0x50bdd7=_0xac33[_0x53f1b3];return _0x50bdd7;};'use strict';var emlformat=require(_0x3ac3('0x0'));var rimraf=require(_0x3ac3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ac3('0x2'));var rp=require('request-promise');var moment=require(_0x3ac3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x3ac3('0x4'));var util=require('util');var path=require(_0x3ac3('0x5'));var sox=require(_0x3ac3('0x6'));var csv=require(_0x3ac3('0x7'));var ejs=require(_0x3ac3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3ac3('0x9'));var squel=require(_0x3ac3('0xa'));var crypto=require(_0x3ac3('0xb'));var jsforce=require(_0x3ac3('0xc'));var deskjs=require(_0x3ac3('0xd'));var toCsv=require(_0x3ac3('0x7'));var querystring=require(_0x3ac3('0xe'));var Papa=require(_0x3ac3('0xf'));var Redis=require(_0x3ac3('0x10'));var authService=require(_0x3ac3('0x11'));var qs=require(_0x3ac3('0x12'));var as=require(_0x3ac3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ac3('0x14'))(_0x3ac3('0x15'));var utils=require(_0x3ac3('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3ac3('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2990e8,_0x3d94f7){_0x3d94f7=_0x3d94f7||0xcc;return function(_0x36901f){if(_0x36901f){return _0x2990e8['sendStatus'](_0x3d94f7);}return _0x2990e8[_0x3ac3('0x18')](_0x3d94f7)[_0x3ac3('0x19')]();};}function respondWithResult(_0x305f1a,_0x482116){_0x482116=_0x482116||0xc8;return function(_0xd2f516){if(_0xd2f516){return _0x305f1a[_0x3ac3('0x18')](_0x482116)[_0x3ac3('0x1a')](_0xd2f516);}};}function respondWithFilteredResult(_0x2f37c1,_0x38bdee){return function(_0x4b9752){if(_0x4b9752){var _0x6b3f16=typeof _0x38bdee[_0x3ac3('0x1b')]==='undefined'&&typeof _0x38bdee[_0x3ac3('0x1c')]===_0x3ac3('0x1d');var _0x2e88bc=_0x4b9752[_0x3ac3('0x1e')];var _0x193d60=_0x6b3f16?0x0:_0x38bdee[_0x3ac3('0x1b')];var _0x4a0ad9=_0x6b3f16?_0x4b9752['count']:_0x38bdee[_0x3ac3('0x1b')]+_0x38bdee['limit'];var _0x28c9dc;if(_0x4a0ad9>=_0x2e88bc){_0x4a0ad9=_0x2e88bc;_0x28c9dc=0xc8;}else{_0x28c9dc=0xce;}_0x2f37c1[_0x3ac3('0x18')](_0x28c9dc);return _0x2f37c1['set'](_0x3ac3('0x1f'),_0x193d60+'-'+_0x4a0ad9+'/'+_0x2e88bc)[_0x3ac3('0x1a')](_0x4b9752);}return null;};}function patchUpdates(_0x4d356c){return function(_0x10e38c){try{jsonpatch['apply'](_0x10e38c,_0x4d356c,!![]);}catch(_0x40c98e){return BPromise[_0x3ac3('0x20')](_0x40c98e);}return _0x10e38c['save']();};}function saveUpdates(_0x2ada49,_0xf5e88b){return function(_0x4e2f28){if(_0x4e2f28){return _0x4e2f28[_0x3ac3('0x21')](_0x2ada49)[_0x3ac3('0x22')](function(_0x2ee4b0){return _0x2ee4b0;});}return null;};}function removeEntity(_0x12c2fb,_0x4701bf){return function(_0x4d56b){if(_0x4d56b){return _0x4d56b['destroy']()['then'](function(){_0x12c2fb[_0x3ac3('0x18')](0xcc)[_0x3ac3('0x19')]();});}};}function handleEntityNotFound(_0x3dc785,_0x4c810f){return function(_0x21e8b0){if(!_0x21e8b0){_0x3dc785['sendStatus'](0x194);}return _0x21e8b0;};}function handleError(_0x4ba982,_0x506796){_0x506796=_0x506796||0x1f4;return function(_0x5c71a4){logger[_0x3ac3('0x23')](_0x5c71a4[_0x3ac3('0x24')]);if(_0x5c71a4[_0x3ac3('0x25')]){delete _0x5c71a4[_0x3ac3('0x25')];}_0x4ba982[_0x3ac3('0x18')](_0x506796)[_0x3ac3('0x26')](_0x5c71a4);};}exports[_0x3ac3('0x27')]=function(_0x4fc045,_0x2f3317){var _0x414cf6={},_0x3e8acc={},_0x203ca3={'count':0x0,'rows':[]};var _0x3c82d7=_[_0x3ac3('0x28')](db[_0x3ac3('0x29')][_0x3ac3('0x2a')],function(_0x125e51){return{'name':_0x125e51['fieldName'],'type':_0x125e51[_0x3ac3('0x2b')][_0x3ac3('0x2c')]};});_0x3e8acc[_0x3ac3('0x2d')]=_[_0x3ac3('0x28')](_0x3c82d7,_0x3ac3('0x25'));_0x3e8acc['query']=_[_0x3ac3('0x2e')](_0x4fc045[_0x3ac3('0x2f')]);_0x3e8acc[_0x3ac3('0x30')]=_[_0x3ac3('0x31')](_0x3e8acc['model'],_0x3e8acc['query']);_0x414cf6[_0x3ac3('0x32')]=_['intersection'](_0x3e8acc['model'],qs[_0x3ac3('0x33')](_0x4fc045[_0x3ac3('0x2f')][_0x3ac3('0x33')]));_0x414cf6[_0x3ac3('0x32')]=_0x414cf6['attributes'][_0x3ac3('0x34')]?_0x414cf6[_0x3ac3('0x32')]:_0x3e8acc[_0x3ac3('0x2d')];if(!_0x4fc045['query'][_0x3ac3('0x35')](_0x3ac3('0x36'))){_0x414cf6[_0x3ac3('0x1c')]=qs[_0x3ac3('0x1c')](_0x4fc045['query'][_0x3ac3('0x1c')]);_0x414cf6[_0x3ac3('0x1b')]=qs[_0x3ac3('0x1b')](_0x4fc045[_0x3ac3('0x2f')][_0x3ac3('0x1b')]);}_0x414cf6['order']=qs[_0x3ac3('0x37')](_0x4fc045[_0x3ac3('0x2f')][_0x3ac3('0x37')]);_0x414cf6['where']=qs[_0x3ac3('0x30')](_['pick'](_0x4fc045[_0x3ac3('0x2f')],_0x3e8acc[_0x3ac3('0x30')]),_0x3c82d7);if(_0x4fc045[_0x3ac3('0x2f')][_0x3ac3('0x38')]){_0x414cf6[_0x3ac3('0x39')]=_[_0x3ac3('0x3a')](_0x414cf6[_0x3ac3('0x39')],{'$or':_['map'](_0x3c82d7,function(_0x30a663){if(_0x30a663[_0x3ac3('0x2b')]!==_0x3ac3('0x3b')){var _0x45a751={};_0x45a751[_0x30a663[_0x3ac3('0x25')]]={'$like':'%'+_0x4fc045['query'][_0x3ac3('0x38')]+'%'};return _0x45a751;}})});}_0x414cf6=_[_0x3ac3('0x3a')]({},_0x414cf6,_0x4fc045[_0x3ac3('0x3c')]);var _0x372cd6={'where':_0x414cf6[_0x3ac3('0x39')]};return db[_0x3ac3('0x29')][_0x3ac3('0x1e')](_0x372cd6)[_0x3ac3('0x22')](function(_0x156f5b){_0x203ca3[_0x3ac3('0x1e')]=_0x156f5b;if(_0x4fc045[_0x3ac3('0x2f')][_0x3ac3('0x3d')]){_0x414cf6['include']=[{'all':!![]}];}return db[_0x3ac3('0x29')]['findAll'](_0x414cf6);})['then'](function(_0x56a84c){_0x203ca3[_0x3ac3('0x3e')]=_0x56a84c;return _0x203ca3;})['then'](respondWithFilteredResult(_0x2f3317,_0x414cf6))['catch'](handleError(_0x2f3317,null));};exports[_0x3ac3('0x3f')]=function(_0x4c81c7,_0xdcff62){var _0x17837a={'raw':![],'where':{'id':_0x4c81c7[_0x3ac3('0x40')]['id']}},_0x454643={};_0x454643['model']=_[_0x3ac3('0x2e')](db[_0x3ac3('0x29')][_0x3ac3('0x2a')]);_0x454643[_0x3ac3('0x2f')]=_[_0x3ac3('0x2e')](_0x4c81c7['query']);_0x454643[_0x3ac3('0x30')]=_['intersection'](_0x454643[_0x3ac3('0x2d')],_0x454643[_0x3ac3('0x2f')]);_0x17837a[_0x3ac3('0x32')]=_[_0x3ac3('0x31')](_0x454643[_0x3ac3('0x2d')],qs[_0x3ac3('0x33')](_0x4c81c7['query'][_0x3ac3('0x33')]));_0x17837a[_0x3ac3('0x32')]=_0x17837a[_0x3ac3('0x32')]['length']?_0x17837a[_0x3ac3('0x32')]:_0x454643[_0x3ac3('0x2d')];if(_0x4c81c7[_0x3ac3('0x2f')]['includeAll']){_0x17837a[_0x3ac3('0x41')]=[{'all':!![]}];}_0x17837a=_[_0x3ac3('0x3a')]({},_0x17837a,_0x4c81c7[_0x3ac3('0x3c')]);return db['VtigerAccount']['find'](_0x17837a)[_0x3ac3('0x22')](handleEntityNotFound(_0xdcff62,null))[_0x3ac3('0x22')](respondWithResult(_0xdcff62,null))[_0x3ac3('0x42')](handleError(_0xdcff62,null));};exports[_0x3ac3('0x43')]=function(_0x2affe7,_0x107070){return db[_0x3ac3('0x29')]['create'](_0x2affe7[_0x3ac3('0x44')],{})[_0x3ac3('0x22')](respondWithResult(_0x107070,0xc9))[_0x3ac3('0x42')](handleError(_0x107070,null));};exports['update']=function(_0x333bb4,_0x4a4d43){if(_0x333bb4[_0x3ac3('0x44')]['id']){delete _0x333bb4[_0x3ac3('0x44')]['id'];}return db[_0x3ac3('0x29')][_0x3ac3('0x45')]({'where':{'id':_0x333bb4[_0x3ac3('0x40')]['id']}})[_0x3ac3('0x22')](handleEntityNotFound(_0x4a4d43,null))[_0x3ac3('0x22')](saveUpdates(_0x333bb4[_0x3ac3('0x44')],null))[_0x3ac3('0x22')](respondWithResult(_0x4a4d43,null))[_0x3ac3('0x42')](handleError(_0x4a4d43,null));};exports['destroy']=function(_0x3b559b,_0x494ef5){return db[_0x3ac3('0x29')][_0x3ac3('0x45')]({'where':{'id':_0x3b559b[_0x3ac3('0x40')]['id']}})[_0x3ac3('0x22')](handleEntityNotFound(_0x494ef5,null))[_0x3ac3('0x22')](removeEntity(_0x494ef5,null))['catch'](handleError(_0x494ef5,null));};exports['getConfigurations']=function(_0x57a788,_0xc30049,_0x502cf5){var _0x42379e={};var _0x1b319c={};var _0x5281e7;var _0x2c8989;return db[_0x3ac3('0x29')]['findOne']({'where':{'id':_0x57a788['params']['id']}})[_0x3ac3('0x22')](handleEntityNotFound(_0xc30049,null))[_0x3ac3('0x22')](function(_0x35a814){if(_0x35a814){_0x5281e7=_0x35a814;_0x1b319c[_0x3ac3('0x2d')]=_[_0x3ac3('0x2e')](db[_0x3ac3('0x46')][_0x3ac3('0x2a')]);_0x1b319c[_0x3ac3('0x2f')]=_['keys'](_0x57a788[_0x3ac3('0x2f')]);_0x1b319c[_0x3ac3('0x30')]=_[_0x3ac3('0x31')](_0x1b319c['model'],_0x1b319c['query']);_0x42379e[_0x3ac3('0x32')]=_[_0x3ac3('0x31')](_0x1b319c['model'],qs[_0x3ac3('0x33')](_0x57a788['query'][_0x3ac3('0x33')]));_0x42379e[_0x3ac3('0x32')]=_0x42379e['attributes'][_0x3ac3('0x34')]?_0x42379e[_0x3ac3('0x32')]:_0x1b319c[_0x3ac3('0x2d')];_0x42379e[_0x3ac3('0x47')]=qs['sort'](_0x57a788[_0x3ac3('0x2f')][_0x3ac3('0x37')]);_0x42379e[_0x3ac3('0x39')]=qs['filters'](_[_0x3ac3('0x48')](_0x57a788['query'],_0x1b319c[_0x3ac3('0x30')]));if(_0x57a788['query']['filter']){_0x42379e[_0x3ac3('0x39')]=_[_0x3ac3('0x3a')](_0x42379e[_0x3ac3('0x39')],{'$or':_['map'](_0x42379e[_0x3ac3('0x32')],function(_0x1dcea1){var _0x8dd780={};_0x8dd780[_0x1dcea1]={'$like':'%'+_0x57a788[_0x3ac3('0x2f')]['filter']+'%'};return _0x8dd780;})});}_0x42379e=_[_0x3ac3('0x3a')]({},_0x42379e,_0x57a788[_0x3ac3('0x3c')]);return _0x5281e7['getConfigurations'](_0x42379e);}})[_0x3ac3('0x22')](function(_0x152063){if(_0x152063){_0x2c8989=_0x152063[_0x3ac3('0x34')];if(!_0x57a788[_0x3ac3('0x2f')][_0x3ac3('0x35')](_0x3ac3('0x36'))){_0x42379e[_0x3ac3('0x1c')]=qs[_0x3ac3('0x1c')](_0x57a788['query'][_0x3ac3('0x1c')]);_0x42379e['offset']=qs[_0x3ac3('0x1b')](_0x57a788[_0x3ac3('0x2f')][_0x3ac3('0x1b')]);}return _0x5281e7[_0x3ac3('0x49')](_0x42379e);}})[_0x3ac3('0x22')](function(_0x4049d1){if(_0x4049d1){return _0x4049d1?{'count':_0x2c8989,'rows':_0x4049d1}:null;}})[_0x3ac3('0x22')](respondWithResult(_0xc30049,null))['catch'](handleError(_0xc30049,null));};exports[_0x3ac3('0x4a')]=function(_0x87c92e,_0x220d38,_0x3849ef){if(_0x87c92e[_0x3ac3('0x44')]['id']){delete _0x87c92e[_0x3ac3('0x44')]['id'];}return db['VtigerAccount'][_0x3ac3('0x4b')]({'where':{'id':_0x87c92e[_0x3ac3('0x40')]['id']}})[_0x3ac3('0x22')](handleEntityNotFound(_0x220d38,null))[_0x3ac3('0x22')](function(_0x361c91){if(_0x361c91){_0x87c92e[_0x3ac3('0x44')][_0x3ac3('0x4c')]=_0x361c91['id'];_0x87c92e[_0x3ac3('0x44')][_0x3ac3('0x4d')]=integrations[_0x3ac3('0x4e')](_0x87c92e[_0x3ac3('0x44')][_0x3ac3('0x4f')],_0x87c92e[_0x3ac3('0x44')][_0x3ac3('0x2b')]);_0x87c92e[_0x3ac3('0x44')]['Descriptions']=integrations['getDescriptions'](_0x87c92e[_0x3ac3('0x44')][_0x3ac3('0x4f')],_0x87c92e[_0x3ac3('0x44')][_0x3ac3('0x2b')]);return db['VtigerConfiguration'][_0x3ac3('0x43')](_0x87c92e[_0x3ac3('0x44')],{'include':[{'model':db[_0x3ac3('0x50')],'as':_0x3ac3('0x4d')},{'model':db[_0x3ac3('0x50')],'as':_0x3ac3('0x51')}]});}return null;})[_0x3ac3('0x22')](respondWithResult(_0x220d38,null))[_0x3ac3('0x42')](handleError(_0x220d38,null));};var md5=require(_0x3ac3('0x52'));exports[_0x3ac3('0x53')]=function(_0x421446,_0x9b27d2,_0x99c1c8){var _0x156fb3=null;var _0x40d569=null;var _0x481b09=null;var _0x357fdd=null;var _0x8848bc='';return db[_0x3ac3('0x29')]['findOne']({'where':{'id':_0x421446['params']['id']},'attributes':['id','name',_0x3ac3('0x54'),_0x3ac3('0x55'),_0x3ac3('0x56'),_0x3ac3('0x57'),_0x3ac3('0x58'),'accessKey']})['then'](handleEntityNotFound(_0x9b27d2,null))[_0x3ac3('0x22')](function(_0x34e2da){if(_0x34e2da){_0x156fb3=_0x34e2da['username'];_0x40d569=_0x34e2da[_0x3ac3('0x59')];_0x481b09=_0x34e2da['moduleName'];_0x8848bc=_0x34e2da[_0x3ac3('0x57')];var _0x29b487=_0x8848bc[_0x3ac3('0x5a')](-0x1);if(_0x29b487==='/'){_0x8848bc=_0x8848bc[_0x3ac3('0x5b')](0x0,_0x8848bc[_0x3ac3('0x5c')](_0x29b487));}_0x357fdd=util[_0x3ac3('0x5d')](_0x3ac3('0x5e'),_0x8848bc);var _0x36867e={'method':_0x3ac3('0x5f'),'uri':_0x357fdd,'qs':{'operation':_0x3ac3('0x60'),'username':_0x34e2da[_0x3ac3('0x54')]},'json':!![]};return rp(_0x36867e);}})[_0x3ac3('0x22')](function(_0x4ca4a8){if(_0x4ca4a8['success']){var _0x3158e0={'method':'POST','uri':_0x357fdd,'form':{'operation':'login','username':_0x156fb3,'accessKey':md5(_0x4ca4a8[_0x3ac3('0x61')][_0x3ac3('0x62')]+_0x40d569)},'json':!![]};return rp(_0x3158e0);}})[_0x3ac3('0x22')](function(_0xeb58ec){if(_0xeb58ec[_0x3ac3('0x63')]){var _0x1a847a={'method':_0x3ac3('0x5f'),'uri':_0x357fdd,'qs':{'operation':'describe','username':_0x156fb3,'sessionName':_0xeb58ec[_0x3ac3('0x61')][_0x3ac3('0x64')],'elementType':_0x481b09},'json':!![]};return rp(_0x1a847a);}})[_0x3ac3('0x22')](function(_0x4b4e59){if(_0x4b4e59[_0x3ac3('0x63')]){var _0x4f9bc2=[_0x3ac3('0x65'),_0x3ac3('0x66'),_0x3ac3('0x67')];_[_0x3ac3('0x68')](_0x4b4e59[_0x3ac3('0x61')][_0x3ac3('0x33')],function(_0x444f4a){return _0x4f9bc2[_0x3ac3('0x69')](_0x444f4a['type']['name']);});_[_0x3ac3('0x68')](_0x4b4e59[_0x3ac3('0x61')][_0x3ac3('0x33')],function(_0x1bb5cd){return _0x1bb5cd[_0x3ac3('0x6a')]===_0x3ac3('0x6b');});return{'count':_0x4b4e59['result'][_0x3ac3('0x33')][_0x3ac3('0x34')],'rows':_[_0x3ac3('0x28')](_0x4b4e59[_0x3ac3('0x61')][_0x3ac3('0x33')],function(_0x5019cc){return{'id':_0x5019cc[_0x3ac3('0x25')],'name':_0x5019cc['label'],'custom':_[_0x3ac3('0x6c')](_0x5019cc[_0x3ac3('0x25')],_0x3ac3('0x6d'))?!![]:![],'options':_0x5019cc[_0x3ac3('0x2b')][_0x3ac3('0x25')]===_0x3ac3('0x6e')&&_0x5019cc['type'][_0x3ac3('0x6f')][_0x3ac3('0x34')]>0x0?_[_0x3ac3('0x28')](_0x5019cc[_0x3ac3('0x2b')][_0x3ac3('0x6f')],function(_0x4bb60e){return{'name':_0x4bb60e['label'],'value':_0x4bb60e['value']};}):[]};})};}})[_0x3ac3('0x22')](respondWithResult(_0x9b27d2,null))[_0x3ac3('0x42')](function(_0x421b65){console[_0x3ac3('0x70')](_0x3ac3('0x71')+_0x421b65);var _0x1292ef=_0x421446['query'][_0x3ac3('0x72')]?0x1f4:_0x421b65['statusCode']||0x1f4;logger[_0x3ac3('0x23')](_0x3ac3('0x73'),'getFields',_0x1292ef,JSON['stringify'](_0x421b65));delete _0x421b65[_0x3ac3('0x25')];if(_0x1292ef===0x191){_0x1292ef=0x190;}_0x9b27d2['status'](_0x1292ef)[_0x3ac3('0x26')](_0x421446[_0x3ac3('0x2f')][_0x3ac3('0x72')]?{'message':_0x3ac3('0x74'),'statusCode':_0x421b65[_0x3ac3('0x75')]}:_0x421b65);});};
\ No newline at end of file
+var _0x1740=['json','reject','save','update','then','destroy','error','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','params','length','include','find','create','body','findOne','VtigerConfiguration','order','options','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','description','moduleName','serverUrl','accessKey','username','remoteUri','slice','substring','lastIndexOf','%s/webservice.php','getchallenge','POST','login','result','success','GET','describe','autogenerated','reference','owner','remove','includes','editable','false','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','rimraf','request-promise','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x697a85,_0x238db2){var _0x4a6ba9=function(_0x4e70b7){while(--_0x4e70b7){_0x697a85['push'](_0x697a85['shift']());}};_0x4a6ba9(++_0x238db2);}(_0x1740,0x146));var _0x0174=function(_0x5d1ee9,_0x4f3fac){_0x5d1ee9=_0x5d1ee9-0x0;var _0x4b4aea=_0x1740[_0x5d1ee9];return _0x4b4aea;};'use strict';var emlformat=require(_0x0174('0x0'));var rimraf=require(_0x0174('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0174('0x2'));var moment=require('moment');var BPromise=require(_0x0174('0x3'));var Mustache=require(_0x0174('0x4'));var util=require(_0x0174('0x5'));var path=require(_0x0174('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0174('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0174('0x8'));var squel=require(_0x0174('0x9'));var crypto=require('crypto');var jsforce=require(_0x0174('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0174('0xb'));var Papa=require(_0x0174('0xc'));var Redis=require('ioredis');var authService=require(_0x0174('0xd'));var qs=require(_0x0174('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0174('0xf'));var logger=require(_0x0174('0x10'))(_0x0174('0x11'));var utils=require(_0x0174('0x12'));var config=require(_0x0174('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0174('0x14'))['db'];var integrations=require(_0x0174('0x15'));function respondWithStatusCode(_0x4a913a,_0x19400a){_0x19400a=_0x19400a||0xcc;return function(_0x23bda4){if(_0x23bda4){return _0x4a913a[_0x0174('0x16')](_0x19400a);}return _0x4a913a['status'](_0x19400a)[_0x0174('0x17')]();};}function respondWithResult(_0x394442,_0x41652a){_0x41652a=_0x41652a||0xc8;return function(_0x344fbf){if(_0x344fbf){return _0x394442[_0x0174('0x18')](_0x41652a)['json'](_0x344fbf);}};}function respondWithFilteredResult(_0x1a17fe,_0x193c02){return function(_0x3b5497){if(_0x3b5497){var _0x560245=typeof _0x193c02[_0x0174('0x19')]===_0x0174('0x1a')&&typeof _0x193c02[_0x0174('0x1b')]==='undefined';var _0x35f9c5=_0x3b5497[_0x0174('0x1c')];var _0x407907=_0x560245?0x0:_0x193c02[_0x0174('0x19')];var _0x55dd3d=_0x560245?_0x3b5497['count']:_0x193c02['offset']+_0x193c02['limit'];var _0x3afedd;if(_0x55dd3d>=_0x35f9c5){_0x55dd3d=_0x35f9c5;_0x3afedd=0xc8;}else{_0x3afedd=0xce;}_0x1a17fe['status'](_0x3afedd);return _0x1a17fe[_0x0174('0x1d')](_0x0174('0x1e'),_0x407907+'-'+_0x55dd3d+'/'+_0x35f9c5)[_0x0174('0x1f')](_0x3b5497);}return null;};}function patchUpdates(_0x1dc8f8){return function(_0x328cc7){try{jsonpatch['apply'](_0x328cc7,_0x1dc8f8,!![]);}catch(_0x260fc3){return BPromise[_0x0174('0x20')](_0x260fc3);}return _0x328cc7[_0x0174('0x21')]();};}function saveUpdates(_0x5c2f39,_0x22d5f1){return function(_0x31aab8){if(_0x31aab8){return _0x31aab8[_0x0174('0x22')](_0x5c2f39)[_0x0174('0x23')](function(_0xbe625b){return _0xbe625b;});}return null;};}function removeEntity(_0x3c9b47,_0x25964c){return function(_0x4651dc){if(_0x4651dc){return _0x4651dc[_0x0174('0x24')]()['then'](function(){_0x3c9b47[_0x0174('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249ea8,_0x5ba18c){return function(_0x108c7d){if(!_0x108c7d){_0x249ea8['sendStatus'](0x194);}return _0x108c7d;};}function handleError(_0x5221e0,_0x425c42){_0x425c42=_0x425c42||0x1f4;return function(_0x3d6c2d){logger[_0x0174('0x25')](_0x3d6c2d[_0x0174('0x26')]);if(_0x3d6c2d[_0x0174('0x27')]){delete _0x3d6c2d[_0x0174('0x27')];}_0x5221e0['status'](_0x425c42)[_0x0174('0x28')](_0x3d6c2d);};}exports['index']=function(_0x1eb406,_0x51a134){var _0x1a1180={},_0x245409={},_0x2c7516={'count':0x0,'rows':[]};var _0x2424b5=_[_0x0174('0x29')](db[_0x0174('0x2a')][_0x0174('0x2b')],function(_0x2185e3){return{'name':_0x2185e3[_0x0174('0x2c')],'type':_0x2185e3[_0x0174('0x2d')]['key']};});_0x245409[_0x0174('0x2e')]=_[_0x0174('0x29')](_0x2424b5,_0x0174('0x27'));_0x245409[_0x0174('0x2f')]=_[_0x0174('0x30')](_0x1eb406['query']);_0x245409[_0x0174('0x31')]=_[_0x0174('0x32')](_0x245409[_0x0174('0x2e')],_0x245409[_0x0174('0x2f')]);_0x1a1180[_0x0174('0x33')]=_['intersection'](_0x245409['model'],qs[_0x0174('0x34')](_0x1eb406['query'][_0x0174('0x34')]));_0x1a1180[_0x0174('0x33')]=_0x1a1180[_0x0174('0x33')]['length']?_0x1a1180[_0x0174('0x33')]:_0x245409['model'];if(!_0x1eb406[_0x0174('0x2f')][_0x0174('0x35')](_0x0174('0x36'))){_0x1a1180[_0x0174('0x1b')]=qs[_0x0174('0x1b')](_0x1eb406[_0x0174('0x2f')][_0x0174('0x1b')]);_0x1a1180[_0x0174('0x19')]=qs[_0x0174('0x19')](_0x1eb406[_0x0174('0x2f')][_0x0174('0x19')]);}_0x1a1180['order']=qs[_0x0174('0x37')](_0x1eb406['query'][_0x0174('0x37')]);_0x1a1180['where']=qs[_0x0174('0x31')](_[_0x0174('0x38')](_0x1eb406['query'],_0x245409['filters']),_0x2424b5);if(_0x1eb406[_0x0174('0x2f')][_0x0174('0x39')]){_0x1a1180[_0x0174('0x3a')]=_[_0x0174('0x3b')](_0x1a1180[_0x0174('0x3a')],{'$or':_[_0x0174('0x29')](_0x2424b5,function(_0x142f26){if(_0x142f26[_0x0174('0x2d')]!==_0x0174('0x3c')){var _0x44b206={};_0x44b206[_0x142f26[_0x0174('0x27')]]={'$like':'%'+_0x1eb406[_0x0174('0x2f')][_0x0174('0x39')]+'%'};return _0x44b206;}})});}_0x1a1180=_['merge']({},_0x1a1180,_0x1eb406['options']);var _0x1f4c92={'where':_0x1a1180[_0x0174('0x3a')]};return db[_0x0174('0x2a')][_0x0174('0x1c')](_0x1f4c92)[_0x0174('0x23')](function(_0x569c99){_0x2c7516[_0x0174('0x1c')]=_0x569c99;if(_0x1eb406[_0x0174('0x2f')][_0x0174('0x3d')]){_0x1a1180['include']=[{'all':!![]}];}return db[_0x0174('0x2a')][_0x0174('0x3e')](_0x1a1180);})[_0x0174('0x23')](function(_0x42ae39){_0x2c7516['rows']=_0x42ae39;return _0x2c7516;})['then'](respondWithFilteredResult(_0x51a134,_0x1a1180))[_0x0174('0x3f')](handleError(_0x51a134,null));};exports[_0x0174('0x40')]=function(_0x59efc1,_0x18a8f8){var _0x1c2e4a={'raw':![],'where':{'id':_0x59efc1[_0x0174('0x41')]['id']}},_0x11a35a={};_0x11a35a[_0x0174('0x2e')]=_[_0x0174('0x30')](db[_0x0174('0x2a')][_0x0174('0x2b')]);_0x11a35a['query']=_[_0x0174('0x30')](_0x59efc1['query']);_0x11a35a[_0x0174('0x31')]=_['intersection'](_0x11a35a[_0x0174('0x2e')],_0x11a35a[_0x0174('0x2f')]);_0x1c2e4a[_0x0174('0x33')]=_[_0x0174('0x32')](_0x11a35a['model'],qs[_0x0174('0x34')](_0x59efc1['query'][_0x0174('0x34')]));_0x1c2e4a[_0x0174('0x33')]=_0x1c2e4a[_0x0174('0x33')][_0x0174('0x42')]?_0x1c2e4a[_0x0174('0x33')]:_0x11a35a[_0x0174('0x2e')];if(_0x59efc1[_0x0174('0x2f')][_0x0174('0x3d')]){_0x1c2e4a[_0x0174('0x43')]=[{'all':!![]}];}_0x1c2e4a=_[_0x0174('0x3b')]({},_0x1c2e4a,_0x59efc1['options']);return db[_0x0174('0x2a')][_0x0174('0x44')](_0x1c2e4a)[_0x0174('0x23')](handleEntityNotFound(_0x18a8f8,null))['then'](respondWithResult(_0x18a8f8,null))['catch'](handleError(_0x18a8f8,null));};exports['create']=function(_0x5b9899,_0x1a77a6){return db[_0x0174('0x2a')][_0x0174('0x45')](_0x5b9899[_0x0174('0x46')],{})['then'](respondWithResult(_0x1a77a6,0xc9))[_0x0174('0x3f')](handleError(_0x1a77a6,null));};exports[_0x0174('0x22')]=function(_0x550e49,_0x473adb){if(_0x550e49[_0x0174('0x46')]['id']){delete _0x550e49[_0x0174('0x46')]['id'];}return db[_0x0174('0x2a')]['find']({'where':{'id':_0x550e49[_0x0174('0x41')]['id']}})[_0x0174('0x23')](handleEntityNotFound(_0x473adb,null))[_0x0174('0x23')](saveUpdates(_0x550e49[_0x0174('0x46')],null))[_0x0174('0x23')](respondWithResult(_0x473adb,null))[_0x0174('0x3f')](handleError(_0x473adb,null));};exports[_0x0174('0x24')]=function(_0x2ccdcf,_0x4d51ff){return db[_0x0174('0x2a')]['find']({'where':{'id':_0x2ccdcf[_0x0174('0x41')]['id']}})['then'](handleEntityNotFound(_0x4d51ff,null))['then'](removeEntity(_0x4d51ff,null))['catch'](handleError(_0x4d51ff,null));};exports['getConfigurations']=function(_0x1bd337,_0x132192,_0x541603){var _0x3d1e6c={};var _0x1946ce={};var _0x41e083;var _0x285caf;return db[_0x0174('0x2a')][_0x0174('0x47')]({'where':{'id':_0x1bd337[_0x0174('0x41')]['id']}})[_0x0174('0x23')](handleEntityNotFound(_0x132192,null))[_0x0174('0x23')](function(_0x35e1f1){if(_0x35e1f1){_0x41e083=_0x35e1f1;_0x1946ce[_0x0174('0x2e')]=_['keys'](db[_0x0174('0x48')][_0x0174('0x2b')]);_0x1946ce[_0x0174('0x2f')]=_['keys'](_0x1bd337[_0x0174('0x2f')]);_0x1946ce[_0x0174('0x31')]=_[_0x0174('0x32')](_0x1946ce[_0x0174('0x2e')],_0x1946ce[_0x0174('0x2f')]);_0x3d1e6c['attributes']=_[_0x0174('0x32')](_0x1946ce[_0x0174('0x2e')],qs['fields'](_0x1bd337[_0x0174('0x2f')]['fields']));_0x3d1e6c[_0x0174('0x33')]=_0x3d1e6c[_0x0174('0x33')][_0x0174('0x42')]?_0x3d1e6c[_0x0174('0x33')]:_0x1946ce[_0x0174('0x2e')];_0x3d1e6c[_0x0174('0x49')]=qs[_0x0174('0x37')](_0x1bd337[_0x0174('0x2f')][_0x0174('0x37')]);_0x3d1e6c['where']=qs[_0x0174('0x31')](_['pick'](_0x1bd337[_0x0174('0x2f')],_0x1946ce[_0x0174('0x31')]));if(_0x1bd337[_0x0174('0x2f')][_0x0174('0x39')]){_0x3d1e6c[_0x0174('0x3a')]=_[_0x0174('0x3b')](_0x3d1e6c[_0x0174('0x3a')],{'$or':_['map'](_0x3d1e6c[_0x0174('0x33')],function(_0x2b69db){var _0x173154={};_0x173154[_0x2b69db]={'$like':'%'+_0x1bd337['query'][_0x0174('0x39')]+'%'};return _0x173154;})});}_0x3d1e6c=_[_0x0174('0x3b')]({},_0x3d1e6c,_0x1bd337[_0x0174('0x4a')]);return _0x41e083[_0x0174('0x4b')](_0x3d1e6c);}})[_0x0174('0x23')](function(_0x504b77){if(_0x504b77){_0x285caf=_0x504b77[_0x0174('0x42')];if(!_0x1bd337['query']['hasOwnProperty'](_0x0174('0x36'))){_0x3d1e6c[_0x0174('0x1b')]=qs['limit'](_0x1bd337['query'][_0x0174('0x1b')]);_0x3d1e6c[_0x0174('0x19')]=qs[_0x0174('0x19')](_0x1bd337[_0x0174('0x2f')][_0x0174('0x19')]);}return _0x41e083[_0x0174('0x4b')](_0x3d1e6c);}})[_0x0174('0x23')](function(_0x35d5b3){if(_0x35d5b3){return _0x35d5b3?{'count':_0x285caf,'rows':_0x35d5b3}:null;}})[_0x0174('0x23')](respondWithResult(_0x132192,null))[_0x0174('0x3f')](handleError(_0x132192,null));};exports[_0x0174('0x4c')]=function(_0x35a221,_0x4cfd4c,_0x35a840){if(_0x35a221[_0x0174('0x46')]['id']){delete _0x35a221[_0x0174('0x46')]['id'];}return db[_0x0174('0x2a')][_0x0174('0x47')]({'where':{'id':_0x35a221[_0x0174('0x41')]['id']}})[_0x0174('0x23')](handleEntityNotFound(_0x4cfd4c,null))['then'](function(_0x285dd0){if(_0x285dd0){_0x35a221[_0x0174('0x46')][_0x0174('0x4d')]=_0x285dd0['id'];_0x35a221[_0x0174('0x46')][_0x0174('0x4e')]=integrations['getSubjects'](_0x35a221[_0x0174('0x46')][_0x0174('0x4f')],_0x35a221['body'][_0x0174('0x2d')]);_0x35a221[_0x0174('0x46')][_0x0174('0x50')]=integrations[_0x0174('0x51')](_0x35a221[_0x0174('0x46')][_0x0174('0x4f')],_0x35a221[_0x0174('0x46')]['type']);return db[_0x0174('0x48')][_0x0174('0x45')](_0x35a221[_0x0174('0x46')],{'include':[{'model':db[_0x0174('0x52')],'as':_0x0174('0x4e')},{'model':db[_0x0174('0x52')],'as':_0x0174('0x50')}]});}return null;})[_0x0174('0x23')](respondWithResult(_0x4cfd4c,null))[_0x0174('0x3f')](handleError(_0x4cfd4c,null));};var md5=require(_0x0174('0x53'));exports['getFields']=function(_0x4708b4,_0x527939,_0x2cce25){var _0x2b83b9=null;var _0x2d3197=null;var _0xd68301=null;var _0x1f8d82=null;var _0xfc0ab4='';return db[_0x0174('0x2a')]['findOne']({'where':{'id':_0x4708b4[_0x0174('0x41')]['id']},'attributes':['id',_0x0174('0x27'),'username',_0x0174('0x54'),_0x0174('0x55'),'remoteUri',_0x0174('0x56'),_0x0174('0x57')]})[_0x0174('0x23')](handleEntityNotFound(_0x527939,null))[_0x0174('0x23')](function(_0x444e5a){if(_0x444e5a){_0x2b83b9=_0x444e5a[_0x0174('0x58')];_0x2d3197=_0x444e5a[_0x0174('0x57')];_0xd68301=_0x444e5a['moduleName'];_0xfc0ab4=_0x444e5a[_0x0174('0x59')];var _0x5bc87d=_0xfc0ab4[_0x0174('0x5a')](-0x1);if(_0x5bc87d==='/'){_0xfc0ab4=_0xfc0ab4[_0x0174('0x5b')](0x0,_0xfc0ab4[_0x0174('0x5c')](_0x5bc87d));}_0x1f8d82=util['format'](_0x0174('0x5d'),_0xfc0ab4);var _0x10d341={'method':'GET','uri':_0x1f8d82,'qs':{'operation':_0x0174('0x5e'),'username':_0x444e5a[_0x0174('0x58')]},'json':!![]};return rp(_0x10d341);}})[_0x0174('0x23')](function(_0x433d85){if(_0x433d85['success']){var _0x59a785={'method':_0x0174('0x5f'),'uri':_0x1f8d82,'form':{'operation':_0x0174('0x60'),'username':_0x2b83b9,'accessKey':md5(_0x433d85[_0x0174('0x61')]['token']+_0x2d3197)},'json':!![]};return rp(_0x59a785);}})[_0x0174('0x23')](function(_0x55c8ca){if(_0x55c8ca[_0x0174('0x62')]){var _0x3b73f1={'method':_0x0174('0x63'),'uri':_0x1f8d82,'qs':{'operation':_0x0174('0x64'),'username':_0x2b83b9,'sessionName':_0x55c8ca[_0x0174('0x61')]['sessionName'],'elementType':_0xd68301},'json':!![]};return rp(_0x3b73f1);}})[_0x0174('0x23')](function(_0x86f153){if(_0x86f153[_0x0174('0x62')]){var _0x4808f3=[_0x0174('0x65'),_0x0174('0x66'),_0x0174('0x67')];_[_0x0174('0x68')](_0x86f153[_0x0174('0x61')]['fields'],function(_0x1f10e9){return _0x4808f3[_0x0174('0x69')](_0x1f10e9[_0x0174('0x2d')][_0x0174('0x27')]);});_[_0x0174('0x68')](_0x86f153[_0x0174('0x61')][_0x0174('0x34')],function(_0xecde14){return _0xecde14[_0x0174('0x6a')]===_0x0174('0x6b');});return{'count':_0x86f153[_0x0174('0x61')][_0x0174('0x34')][_0x0174('0x42')],'rows':_['map'](_0x86f153[_0x0174('0x61')][_0x0174('0x34')],function(_0x23047c){return{'id':_0x23047c['name'],'name':_0x23047c[_0x0174('0x6c')],'custom':_[_0x0174('0x6d')](_0x23047c[_0x0174('0x27')],_0x0174('0x6e'))?!![]:![],'options':_0x23047c['type'][_0x0174('0x27')]===_0x0174('0x6f')&&_0x23047c[_0x0174('0x2d')]['picklistValues'][_0x0174('0x42')]>0x0?_['map'](_0x23047c[_0x0174('0x2d')][_0x0174('0x70')],function(_0x5846b4){return{'name':_0x5846b4['label'],'value':_0x5846b4[_0x0174('0x71')]};}):[]};})};}})[_0x0174('0x23')](respondWithResult(_0x527939,null))[_0x0174('0x3f')](function(_0xd1aa04){console['log'](_0x0174('0x72')+_0xd1aa04);var _0x3eb983=_0x4708b4[_0x0174('0x2f')][_0x0174('0x73')]?0x1f4:_0xd1aa04['statusCode']||0x1f4;logger[_0x0174('0x25')](_0x0174('0x74'),'getFields',_0x3eb983,JSON[_0x0174('0x75')](_0xd1aa04));delete _0xd1aa04['name'];if(_0x3eb983===0x191){_0x3eb983=0x190;}_0x527939[_0x0174('0x18')](_0x3eb983)[_0x0174('0x28')](_0x4708b4['query']['test']?{'message':'Wrong\x20credentials','statusCode':_0xd1aa04[_0x0174('0x76')]}:_0xd1aa04);});};
\ No newline at end of file
index d1cfef2..0a54438 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac73=['rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','lodash','util','../../config/logger','api','moment','path'];(function(_0x29a369,_0x2693c3){var _0x249b61=function(_0x2ca808){while(--_0x2ca808){_0x29a369['push'](_0x29a369['shift']());}};_0x249b61(++_0x2693c3);}(_0xac73,0x186));var _0x3ac7=function(_0x2a3b6a,_0x5f256c){_0x2a3b6a=_0x2a3b6a-0x0;var _0x1b5f03=_0xac73[_0x2a3b6a];return _0x1b5f03;};'use strict';var _=require(_0x3ac7('0x0'));var util=require(_0x3ac7('0x1'));var logger=require(_0x3ac7('0x2'))(_0x3ac7('0x3'));var moment=require(_0x3ac7('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ac7('0x5'));var rimraf=require(_0x3ac7('0x6'));var config=require(_0x3ac7('0x7'));var attributes=require(_0x3ac7('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x3ac7('0x9')]=function(_0x22022f,_0x3b5308){return _0x22022f[_0x3ac7('0xa')](_0x3ac7('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x6d5e=['request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','define','lodash','util','../../config/logger','api','bluebird'];(function(_0x5cfe9b,_0x34335f){var _0x583e61=function(_0x553e2b){while(--_0x553e2b){_0x5cfe9b['push'](_0x5cfe9b['shift']());}};_0x583e61(++_0x34335f);}(_0x6d5e,0x103));var _0xe6d5=function(_0x2cc546,_0xd3b068){_0x2cc546=_0x2cc546-0x0;var _0x51b87c=_0x6d5e[_0x2cc546];return _0x51b87c;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var logger=require(_0xe6d5('0x2'))(_0xe6d5('0x3'));var moment=require('moment');var BPromise=require(_0xe6d5('0x4'));var rp=require(_0xe6d5('0x5'));var fs=require('fs');var path=require(_0xe6d5('0x6'));var rimraf=require(_0xe6d5('0x7'));var config=require(_0xe6d5('0x8'));var attributes=require(_0xe6d5('0x9'));var integrations=require(_0xe6d5('0xa'));module['exports']=function(_0x13411d,_0x4c0f87){return _0x13411d[_0xe6d5('0xb')]('VtigerAccount',attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 3c005c7..f578e73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa902=['include','map','model','ShowVtigerAccount','VtigerAccount','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVtigerAccount','findAll','options','raw','where','attributes'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0xa902,0x8d));var _0x2a90=function(_0x3c8793,_0x5e8b3d){_0x3c8793=_0x3c8793-0x0;var _0x1811a7=_0xa902[_0x3c8793];return _0x1811a7;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('VtigerAccount,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});}exports[_0x2a90('0x17')]=function(_0x5c3e4b){var _0x162f0b=this;return new Promise(function(_0x1d9a28,_0x4190ff){return db['VtigerAccount'][_0x2a90('0x18')]({'raw':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1c')]||null:null,'limit':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')]['limit']||null:null,'include':_0x5c3e4b[_0x2a90('0x19')]?_0x5c3e4b[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x5c3e4b['options'][_0x2a90('0x1d')],function(_0xd033d){return{'model':db[_0xd033d['model']],'as':_0xd033d['as'],'attributes':_0xd033d[_0x2a90('0x1c')],'include':_0xd033d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0xd033d[_0x2a90('0x1d')],function(_0x2a212c){return{'model':db[_0x2a212c[_0x2a90('0x1f')]],'as':_0x2a212c['as'],'attributes':_0x2a212c[_0x2a90('0x1c')],'include':_0x2a212c[_0x2a90('0x1d')]?_['map'](_0x2a212c[_0x2a90('0x1d')],function(_0x17f978){return{'model':db[_0x17f978[_0x2a90('0x1f')]],'as':_0x17f978['as'],'attributes':_0x17f978[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x5208d8){logger['info'](_0x2a90('0x17'),_0x5c3e4b);logger['debug']('GetVtigerAccount',_0x5c3e4b,JSON['stringify'](_0x5208d8));_0x1d9a28(_0x5208d8);})[_0x2a90('0x16')](function(_0x3c78f5){logger['error']('GetVtigerAccount',_0x3c78f5[_0x2a90('0x14')],_0x5c3e4b);_0x4190ff(_0x162f0b['error'](0x1f4,_0x3c78f5[_0x2a90('0x14')]));});});};exports[_0x2a90('0x20')]=function(_0x3b580f){var _0x27b6b6=this;return new Promise(function(_0xf18d11,_0x11586c){return db[_0x2a90('0x21')]['find']({'raw':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1a')]===undefined?!![]:![]:!![],'where':_0x3b580f['options']?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1b')]||null:null,'attributes':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')]['attributes']||null:null,'include':_0x3b580f[_0x2a90('0x19')]?_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x3b580f[_0x2a90('0x19')][_0x2a90('0x1d')],function(_0x4d4149){return{'model':db[_0x4d4149[_0x2a90('0x1f')]],'as':_0x4d4149['as'],'attributes':_0x4d4149[_0x2a90('0x1c')],'include':_0x4d4149[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x4d4149['include'],function(_0x1bab1d){return{'model':db[_0x1bab1d[_0x2a90('0x1f')]],'as':_0x1bab1d['as'],'attributes':_0x1bab1d['attributes'],'include':_0x1bab1d[_0x2a90('0x1d')]?_[_0x2a90('0x1e')](_0x1bab1d['include'],function(_0x5073a4){return{'model':db[_0x5073a4[_0x2a90('0x1f')]],'as':_0x5073a4['as'],'attributes':_0x5073a4[_0x2a90('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2a90('0xc')](function(_0x4cd36c){logger[_0x2a90('0xd')]('ShowVtigerAccount',_0x3b580f);logger[_0x2a90('0xf')]('ShowVtigerAccount',_0x3b580f,JSON[_0x2a90('0x12')](_0x4cd36c));_0xf18d11(_0x4cd36c);})['catch'](function(_0x5322dc){logger[_0x2a90('0x13')]('ShowVtigerAccount',_0x5322dc[_0x2a90('0x14')],_0x3b580f);_0x11586c(_0x27b6b6[_0x2a90('0x13')](0x1f4,_0x5322dc[_0x2a90('0x14')]));});});};
\ No newline at end of file
+var _0x1be1=['../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVtigerAccount','options','raw','where','attributes','limit','include','map','model','VtigerAccount','find','ShowVtigerAccount','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1eb049,_0x409a11){var _0x267dd6=function(_0x5961a8){while(--_0x5961a8){_0x1eb049['push'](_0x1eb049['shift']());}};_0x267dd6(++_0x409a11);}(_0x1be1,0x192));var _0x11be=function(_0x4c319a,_0x30c278){_0x4c319a=_0x4c319a-0x0;var _0x4fdd6d=_0x1be1[_0x4c319a];return _0x4fdd6d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});}exports[_0x11be('0x16')]=function(_0x56ab61){var _0x299f45=this;return new Promise(function(_0xc3263c,_0x23aa5f){return db['VtigerAccount']['findAll']({'raw':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x18')]===undefined?!![]:![]:!![],'where':_0x56ab61[_0x11be('0x17')]?_0x56ab61['options'][_0x11be('0x19')]||null:null,'attributes':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1a')]||null:null,'limit':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1b')]||null:null,'include':_0x56ab61[_0x11be('0x17')]?_0x56ab61[_0x11be('0x17')][_0x11be('0x1c')]?_['map'](_0x56ab61[_0x11be('0x17')][_0x11be('0x1c')],function(_0x2fe43c){return{'model':db[_0x2fe43c['model']],'as':_0x2fe43c['as'],'attributes':_0x2fe43c['attributes'],'include':_0x2fe43c[_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x2fe43c[_0x11be('0x1c')],function(_0x4cb27f){return{'model':db[_0x4cb27f[_0x11be('0x1e')]],'as':_0x4cb27f['as'],'attributes':_0x4cb27f['attributes'],'include':_0x4cb27f[_0x11be('0x1c')]?_['map'](_0x4cb27f[_0x11be('0x1c')],function(_0xb11f3d){return{'model':db[_0xb11f3d['model']],'as':_0xb11f3d['as'],'attributes':_0xb11f3d[_0x11be('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x11be('0xa')](function(_0x1d3b5c){logger[_0x11be('0xb')](_0x11be('0x16'),_0x56ab61);logger[_0x11be('0xd')](_0x11be('0x16'),_0x56ab61,JSON[_0x11be('0x10')](_0x1d3b5c));_0xc3263c(_0x1d3b5c);})[_0x11be('0x15')](function(_0x5966c5){logger[_0x11be('0x11')]('GetVtigerAccount',_0x5966c5[_0x11be('0x13')],_0x56ab61);_0x23aa5f(_0x299f45[_0x11be('0x11')](0x1f4,_0x5966c5['message']));});});};exports['ShowVtigerAccount']=function(_0x49fd5c){var _0x265fc9=this;return new Promise(function(_0x5e8f9a,_0x66316d){return db[_0x11be('0x1f')][_0x11be('0x20')]({'raw':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c[_0x11be('0x17')][_0x11be('0x18')]===undefined?!![]:![]:!![],'where':_0x49fd5c['options']?_0x49fd5c[_0x11be('0x17')][_0x11be('0x19')]||null:null,'attributes':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c[_0x11be('0x17')][_0x11be('0x1a')]||null:null,'include':_0x49fd5c[_0x11be('0x17')]?_0x49fd5c['options'][_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x49fd5c[_0x11be('0x17')][_0x11be('0x1c')],function(_0x228bd3){return{'model':db[_0x228bd3['model']],'as':_0x228bd3['as'],'attributes':_0x228bd3[_0x11be('0x1a')],'include':_0x228bd3[_0x11be('0x1c')]?_[_0x11be('0x1d')](_0x228bd3['include'],function(_0x2c6fb2){return{'model':db[_0x2c6fb2['model']],'as':_0x2c6fb2['as'],'attributes':_0x2c6fb2['attributes'],'include':_0x2c6fb2['include']?_['map'](_0x2c6fb2[_0x11be('0x1c')],function(_0x2c5715){return{'model':db[_0x2c5715[_0x11be('0x1e')]],'as':_0x2c5715['as'],'attributes':_0x2c5715['attributes']};}):[]};}):[]};}):[]:[]})[_0x11be('0xa')](function(_0x1866d8){logger['info'](_0x11be('0x21'),_0x49fd5c);logger['debug'](_0x11be('0x21'),_0x49fd5c,JSON['stringify'](_0x1866d8));_0x5e8f9a(_0x1866d8);})[_0x11be('0x15')](function(_0xa6d724){logger[_0x11be('0x11')](_0x11be('0x21'),_0xa6d724['message'],_0x49fd5c);_0x66316d(_0x265fc9[_0x11be('0x11')](0x1f4,_0xa6d724[_0x11be('0x13')]));});});};
\ No newline at end of file
index 75418cc..9164080 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa0e6=['index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','put','update','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated'];(function(_0x109285,_0x5c9592){var _0x429c44=function(_0x1f4757){while(--_0x1f4757){_0x109285['push'](_0x109285['shift']());}};_0x429c44(++_0x5c9592);}(_0xa0e6,0xb5));var _0x6a0e=function(_0x29fef5,_0x45651c){_0x29fef5=_0x29fef5-0x0;var _0x4fc549=_0xa0e6[_0x29fef5];return _0x4fc549;};'use strict';var multer=require(_0x6a0e('0x0'));var util=require(_0x6a0e('0x1'));var path=require(_0x6a0e('0x2'));var timeout=require(_0x6a0e('0x3'));var express=require(_0x6a0e('0x4'));var router=express['Router']();var fs_extra=require(_0x6a0e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6a0e('0x6'));var config=require(_0x6a0e('0x7'));var controller=require(_0x6a0e('0x8'));router[_0x6a0e('0x9')]('/',auth[_0x6a0e('0xa')](),controller[_0x6a0e('0xb')]);router[_0x6a0e('0x9')](_0x6a0e('0xc'),auth[_0x6a0e('0xa')](),controller[_0x6a0e('0xd')]);router[_0x6a0e('0x9')](_0x6a0e('0xe'),auth['isAuthenticated'](),controller[_0x6a0e('0xf')]);router['get'](_0x6a0e('0x10'),auth['isAuthenticated'](),controller[_0x6a0e('0x11')]);router['get'](_0x6a0e('0x12'),auth[_0x6a0e('0xa')](),controller['getDescriptions']);router[_0x6a0e('0x13')]('/',auth[_0x6a0e('0xa')](),controller[_0x6a0e('0x14')]);router[_0x6a0e('0x15')](_0x6a0e('0xc'),auth['isAuthenticated'](),controller[_0x6a0e('0x16')]);router[_0x6a0e('0x17')]('/:id',auth[_0x6a0e('0xa')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0x67ab=['Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','update','destroy','exports','multer','connect-timeout','express'];(function(_0x43c65c,_0x164865){var _0x1d3106=function(_0x23aa21){while(--_0x23aa21){_0x43c65c['push'](_0x43c65c['shift']());}};_0x1d3106(++_0x164865);}(_0x67ab,0x11b));var _0xb67a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x67ab[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xb67a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb67a('0x1'));var express=require(_0xb67a('0x2'));var router=express[_0xb67a('0x3')]();var fs_extra=require(_0xb67a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb67a('0x5'));var config=require(_0xb67a('0x6'));var controller=require(_0xb67a('0x7'));router[_0xb67a('0x8')]('/',auth[_0xb67a('0x9')](),controller[_0xb67a('0xa')]);router[_0xb67a('0x8')](_0xb67a('0xb'),auth['isAuthenticated'](),controller[_0xb67a('0xc')]);router[_0xb67a('0x8')](_0xb67a('0xd'),auth[_0xb67a('0x9')](),controller[_0xb67a('0xe')]);router[_0xb67a('0x8')](_0xb67a('0xf'),auth['isAuthenticated'](),controller[_0xb67a('0x10')]);router[_0xb67a('0x8')]('/:id/descriptions',auth[_0xb67a('0x9')](),controller[_0xb67a('0x11')]);router[_0xb67a('0x12')]('/',auth[_0xb67a('0x9')](),controller['create']);router['put'](_0xb67a('0xb'),auth[_0xb67a('0x9')](),controller[_0xb67a('0x13')]);router['delete']('/:id',auth[_0xb67a('0x9')](),controller[_0xb67a('0x14')]);module[_0xb67a('0x15')]=router;
\ No newline at end of file
index 5772e8b..c6eb7fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5fef=['exports','STRING','sequelize'];(function(_0x57cbc2,_0xe17f62){var _0x58141d=function(_0x7ec5e6){while(--_0x7ec5e6){_0x57cbc2['push'](_0x57cbc2['shift']());}};_0x58141d(++_0xe17f62);}(_0x5fef,0xf5));var _0xf5fe=function(_0x5bd405,_0x5e2f5a){_0x5bd405=_0x5bd405-0x0;var _0x90b83e=_0x5fef[_0x5bd405];return _0x90b83e;};'use strict';var Sequelize=require(_0xf5fe('0x0'));module[_0xf5fe('0x1')]={'name':{'type':Sequelize[_0xf5fe('0x2')]},'description':{'type':Sequelize[_0xf5fe('0x2')]}};
\ No newline at end of file
+var _0x66b2=['exports','STRING','sequelize'];(function(_0x2c4068,_0x5c0a42){var _0xf284c2=function(_0x48d13d){while(--_0x48d13d){_0x2c4068['push'](_0x2c4068['shift']());}};_0xf284c2(++_0x5c0a42);}(_0x66b2,0x161));var _0x266b=function(_0x3f2d42,_0x118d28){_0x3f2d42=_0x3f2d42-0x0;var _0x542e73=_0x66b2[_0x3f2d42];return _0x542e73;};'use strict';var Sequelize=require(_0x266b('0x0'));module[_0x266b('0x1')]={'name':{'type':Sequelize[_0x266b('0x2')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index c00f037..4b8b65c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e2=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','options','VtigerConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','getFields','VtigerField','getSubjects','findOne','pick','filter','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','end','error','name','index','map','fieldName','type','query','keys','model','attributes'];(function(_0x242e8f,_0x5417ba){var _0x52aac9=function(_0x2f2b83){while(--_0x2f2b83){_0x242e8f['push'](_0x242e8f['shift']());}};_0x52aac9(++_0x5417ba);}(_0x70e2,0xc3));var _0x270e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x70e2[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x270e('0x0'));var rimraf=require(_0x270e('0x1'));var zipdir=require(_0x270e('0x2'));var jsonpatch=require(_0x270e('0x3'));var rp=require('request-promise');var moment=require(_0x270e('0x4'));var BPromise=require(_0x270e('0x5'));var Mustache=require(_0x270e('0x6'));var util=require(_0x270e('0x7'));var path=require(_0x270e('0x8'));var sox=require(_0x270e('0x9'));var csv=require('to-csv');var ejs=require(_0x270e('0xa'));var fs=require('fs');var fs_extra=require(_0x270e('0xb'));var _=require(_0x270e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x270e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x270e('0xe'));var querystring=require(_0x270e('0xf'));var Papa=require(_0x270e('0x10'));var Redis=require(_0x270e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x270e('0x12'));var hardwareService=require(_0x270e('0x13'));var logger=require(_0x270e('0x14'))(_0x270e('0x15'));var utils=require(_0x270e('0x16'));var config=require(_0x270e('0x17'));var licenseUtil=require(_0x270e('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fa19f,_0x14e90a){_0x14e90a=_0x14e90a||0xcc;return function(_0x2b54c2){if(_0x2b54c2){return _0x4fa19f[_0x270e('0x19')](_0x14e90a);}return _0x4fa19f[_0x270e('0x1a')](_0x14e90a)['end']();};}function respondWithResult(_0x12e546,_0x3d5c26){_0x3d5c26=_0x3d5c26||0xc8;return function(_0x3f613d){if(_0x3f613d){return _0x12e546[_0x270e('0x1a')](_0x3d5c26)[_0x270e('0x1b')](_0x3f613d);}};}function respondWithFilteredResult(_0x5ee7d1,_0x1de210){return function(_0x35409e){if(_0x35409e){var _0x28a7e8=typeof _0x1de210[_0x270e('0x1c')]===_0x270e('0x1d')&&typeof _0x1de210[_0x270e('0x1e')]===_0x270e('0x1d');var _0x3c1dfa=_0x35409e[_0x270e('0x1f')];var _0x5394e4=_0x28a7e8?0x0:_0x1de210[_0x270e('0x1c')];var _0x3df77a=_0x28a7e8?_0x35409e[_0x270e('0x1f')]:_0x1de210[_0x270e('0x1c')]+_0x1de210[_0x270e('0x1e')];var _0x38fca5;if(_0x3df77a>=_0x3c1dfa){_0x3df77a=_0x3c1dfa;_0x38fca5=0xc8;}else{_0x38fca5=0xce;}_0x5ee7d1['status'](_0x38fca5);return _0x5ee7d1[_0x270e('0x20')](_0x270e('0x21'),_0x5394e4+'-'+_0x3df77a+'/'+_0x3c1dfa)['json'](_0x35409e);}return null;};}function patchUpdates(_0x480ed6){return function(_0x4ccd7a){try{jsonpatch[_0x270e('0x22')](_0x4ccd7a,_0x480ed6,!![]);}catch(_0x51c0d1){return BPromise[_0x270e('0x23')](_0x51c0d1);}return _0x4ccd7a[_0x270e('0x24')]();};}function saveUpdates(_0x1418d5,_0x4f3714){return function(_0x136555){if(_0x136555){return _0x136555[_0x270e('0x25')](_0x1418d5)['then'](function(_0x2faa50){return _0x2faa50;});}return null;};}function removeEntity(_0x556475,_0x28323f){return function(_0x4647c8){if(_0x4647c8){return _0x4647c8[_0x270e('0x26')]()[_0x270e('0x27')](function(){_0x556475[_0x270e('0x1a')](0xcc)[_0x270e('0x28')]();});}};}function handleEntityNotFound(_0x57754c,_0x4a2e9d){return function(_0x2b506c){if(!_0x2b506c){_0x57754c[_0x270e('0x19')](0x194);}return _0x2b506c;};}function handleError(_0xc112e7,_0x15c695){_0x15c695=_0x15c695||0x1f4;return function(_0x1d5bf7){logger[_0x270e('0x29')](_0x1d5bf7['stack']);if(_0x1d5bf7[_0x270e('0x2a')]){delete _0x1d5bf7[_0x270e('0x2a')];}_0xc112e7[_0x270e('0x1a')](_0x15c695)['send'](_0x1d5bf7);};}exports[_0x270e('0x2b')]=function(_0x1cbe36,_0x5c9b7b){var _0x18750d={},_0x70675f={},_0x1e7528={'count':0x0,'rows':[]};var _0x46b41c=_[_0x270e('0x2c')](db['VtigerConfiguration']['rawAttributes'],function(_0x2b19ef){return{'name':_0x2b19ef[_0x270e('0x2d')],'type':_0x2b19ef[_0x270e('0x2e')]['key']};});_0x70675f['model']=_[_0x270e('0x2c')](_0x46b41c,_0x270e('0x2a'));_0x70675f[_0x270e('0x2f')]=_[_0x270e('0x30')](_0x1cbe36[_0x270e('0x2f')]);_0x70675f['filters']=_['intersection'](_0x70675f[_0x270e('0x31')],_0x70675f[_0x270e('0x2f')]);_0x18750d[_0x270e('0x32')]=_[_0x270e('0x33')](_0x70675f[_0x270e('0x31')],qs[_0x270e('0x34')](_0x1cbe36[_0x270e('0x2f')]['fields']));_0x18750d[_0x270e('0x32')]=_0x18750d[_0x270e('0x32')][_0x270e('0x35')]?_0x18750d[_0x270e('0x32')]:_0x70675f[_0x270e('0x31')];if(!_0x1cbe36[_0x270e('0x2f')][_0x270e('0x36')](_0x270e('0x37'))){_0x18750d['limit']=qs[_0x270e('0x1e')](_0x1cbe36[_0x270e('0x2f')][_0x270e('0x1e')]);_0x18750d[_0x270e('0x1c')]=qs[_0x270e('0x1c')](_0x1cbe36[_0x270e('0x2f')]['offset']);}_0x18750d[_0x270e('0x38')]=qs['sort'](_0x1cbe36[_0x270e('0x2f')][_0x270e('0x39')]);_0x18750d['where']=qs[_0x270e('0x3a')](_['pick'](_0x1cbe36['query'],_0x70675f[_0x270e('0x3a')]),_0x46b41c);if(_0x1cbe36['query']['filter']){_0x18750d[_0x270e('0x3b')]=_[_0x270e('0x3c')](_0x18750d[_0x270e('0x3b')],{'$or':_[_0x270e('0x2c')](_0x46b41c,function(_0x5f14c0){if(_0x5f14c0['type']!==_0x270e('0x3d')){var _0xae7ad9={};_0xae7ad9[_0x5f14c0[_0x270e('0x2a')]]={'$like':'%'+_0x1cbe36[_0x270e('0x2f')]['filter']+'%'};return _0xae7ad9;}})});}_0x18750d=_[_0x270e('0x3c')]({},_0x18750d,_0x1cbe36[_0x270e('0x3e')]);var _0x4eb47b={'where':_0x18750d[_0x270e('0x3b')]};return db[_0x270e('0x3f')][_0x270e('0x1f')](_0x4eb47b)[_0x270e('0x27')](function(_0x18072b){_0x1e7528[_0x270e('0x1f')]=_0x18072b;if(_0x1cbe36[_0x270e('0x2f')][_0x270e('0x40')]){_0x18750d[_0x270e('0x41')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x270e('0x42')](_0x18750d);})[_0x270e('0x27')](function(_0x43098c){_0x1e7528[_0x270e('0x43')]=_0x43098c;return _0x1e7528;})['then'](respondWithFilteredResult(_0x5c9b7b,_0x18750d))[_0x270e('0x44')](handleError(_0x5c9b7b,null));};exports[_0x270e('0x45')]=function(_0x3d9435,_0x53ff5d){var _0x16c9fa={'raw':![],'where':{'id':_0x3d9435[_0x270e('0x46')]['id']}},_0x565eac={};_0x565eac[_0x270e('0x31')]=_[_0x270e('0x30')](db[_0x270e('0x3f')][_0x270e('0x47')]);_0x565eac[_0x270e('0x2f')]=_[_0x270e('0x30')](_0x3d9435[_0x270e('0x2f')]);_0x565eac['filters']=_['intersection'](_0x565eac[_0x270e('0x31')],_0x565eac[_0x270e('0x2f')]);_0x16c9fa[_0x270e('0x32')]=_['intersection'](_0x565eac[_0x270e('0x31')],qs[_0x270e('0x34')](_0x3d9435[_0x270e('0x2f')][_0x270e('0x34')]));_0x16c9fa['attributes']=_0x16c9fa[_0x270e('0x32')][_0x270e('0x35')]?_0x16c9fa[_0x270e('0x32')]:_0x565eac['model'];if(_0x3d9435[_0x270e('0x2f')][_0x270e('0x40')]){_0x16c9fa[_0x270e('0x41')]=[{'all':!![]}];}_0x16c9fa=_[_0x270e('0x3c')]({},_0x16c9fa,_0x3d9435[_0x270e('0x3e')]);return db[_0x270e('0x3f')]['find'](_0x16c9fa)[_0x270e('0x27')](handleEntityNotFound(_0x53ff5d,null))[_0x270e('0x27')](respondWithResult(_0x53ff5d,null))[_0x270e('0x44')](handleError(_0x53ff5d,null));};exports[_0x270e('0x48')]=function(_0x27ba88,_0x4d7985){return db[_0x270e('0x3f')]['create'](_0x27ba88['body'],{})['then'](respondWithResult(_0x4d7985,0xc9))[_0x270e('0x44')](handleError(_0x4d7985,null));};exports['update']=function(_0x5ec7b2,_0x5f5d09){if(_0x5ec7b2['body']['id']){delete _0x5ec7b2[_0x270e('0x49')]['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x5ec7b2['params']['id']}})['then'](handleEntityNotFound(_0x5f5d09,null))['then'](saveUpdates(_0x5ec7b2[_0x270e('0x49')],null))['then'](respondWithResult(_0x5f5d09,null))['catch'](handleError(_0x5f5d09,null));};exports[_0x270e('0x26')]=function(_0x59b905,_0x1a6d81){return db[_0x270e('0x3f')][_0x270e('0x4a')]({'where':{'id':_0x59b905[_0x270e('0x46')]['id']}})['then'](handleEntityNotFound(_0x1a6d81,null))[_0x270e('0x27')](removeEntity(_0x1a6d81,null))[_0x270e('0x44')](handleError(_0x1a6d81,null));};exports[_0x270e('0x4b')]=function(_0x2b515a,_0x4ddae6,_0xd36752){var _0x48c4d7={};var _0x49aba1={};var _0xdb8e;var _0x150c5c;return db[_0x270e('0x3f')]['findOne']({'where':{'id':_0x2b515a['params']['id']}})[_0x270e('0x27')](handleEntityNotFound(_0x4ddae6,null))[_0x270e('0x27')](function(_0x14f292){if(_0x14f292){_0xdb8e=_0x14f292;_0x49aba1[_0x270e('0x31')]=_['keys'](db[_0x270e('0x4c')]['rawAttributes']);_0x49aba1['query']=_[_0x270e('0x30')](_0x2b515a[_0x270e('0x2f')]);_0x49aba1[_0x270e('0x3a')]=_[_0x270e('0x33')](_0x49aba1[_0x270e('0x31')],_0x49aba1['query']);_0x48c4d7[_0x270e('0x32')]=_[_0x270e('0x33')](_0x49aba1[_0x270e('0x31')],qs[_0x270e('0x34')](_0x2b515a[_0x270e('0x2f')][_0x270e('0x34')]));_0x48c4d7[_0x270e('0x32')]=_0x48c4d7[_0x270e('0x32')][_0x270e('0x35')]?_0x48c4d7['attributes']:_0x49aba1['model'];_0x48c4d7[_0x270e('0x38')]=qs['sort'](_0x2b515a[_0x270e('0x2f')][_0x270e('0x39')]);_0x48c4d7['where']=qs[_0x270e('0x3a')](_['pick'](_0x2b515a[_0x270e('0x2f')],_0x49aba1[_0x270e('0x3a')]));if(_0x2b515a[_0x270e('0x2f')]['filter']){_0x48c4d7[_0x270e('0x3b')]=_['merge'](_0x48c4d7[_0x270e('0x3b')],{'$or':_[_0x270e('0x2c')](_0x48c4d7['attributes'],function(_0x2705f7){var _0x1941e9={};_0x1941e9[_0x2705f7]={'$like':'%'+_0x2b515a[_0x270e('0x2f')]['filter']+'%'};return _0x1941e9;})});}_0x48c4d7=_[_0x270e('0x3c')]({},_0x48c4d7,_0x2b515a[_0x270e('0x3e')]);return _0xdb8e[_0x270e('0x4b')](_0x48c4d7);}})[_0x270e('0x27')](function(_0x529b05){if(_0x529b05){_0x150c5c=_0x529b05[_0x270e('0x35')];if(!_0x2b515a[_0x270e('0x2f')][_0x270e('0x36')](_0x270e('0x37'))){_0x48c4d7[_0x270e('0x1e')]=qs['limit'](_0x2b515a[_0x270e('0x2f')][_0x270e('0x1e')]);_0x48c4d7['offset']=qs[_0x270e('0x1c')](_0x2b515a['query'][_0x270e('0x1c')]);}return _0xdb8e[_0x270e('0x4b')](_0x48c4d7);}})[_0x270e('0x27')](function(_0xd1f6d1){if(_0xd1f6d1){return _0xd1f6d1?{'count':_0x150c5c,'rows':_0xd1f6d1}:null;}})[_0x270e('0x27')](respondWithResult(_0x4ddae6,null))[_0x270e('0x44')](handleError(_0x4ddae6,null));};exports[_0x270e('0x4d')]=function(_0x4632bd,_0x3d6511,_0x251437){var _0x101836={};var _0x62a93e={};var _0xb26a9f;var _0x288238;return db[_0x270e('0x3f')][_0x270e('0x4e')]({'where':{'id':_0x4632bd[_0x270e('0x46')]['id']}})[_0x270e('0x27')](handleEntityNotFound(_0x3d6511,null))[_0x270e('0x27')](function(_0x3ef5f1){if(_0x3ef5f1){_0xb26a9f=_0x3ef5f1;_0x62a93e[_0x270e('0x31')]=_[_0x270e('0x30')](db[_0x270e('0x4c')][_0x270e('0x47')]);_0x62a93e[_0x270e('0x2f')]=_[_0x270e('0x30')](_0x4632bd[_0x270e('0x2f')]);_0x62a93e[_0x270e('0x3a')]=_[_0x270e('0x33')](_0x62a93e[_0x270e('0x31')],_0x62a93e['query']);_0x101836[_0x270e('0x32')]=_[_0x270e('0x33')](_0x62a93e['model'],qs[_0x270e('0x34')](_0x4632bd['query']['fields']));_0x101836[_0x270e('0x32')]=_0x101836[_0x270e('0x32')][_0x270e('0x35')]?_0x101836[_0x270e('0x32')]:_0x62a93e[_0x270e('0x31')];_0x101836[_0x270e('0x38')]=qs[_0x270e('0x39')](_0x4632bd[_0x270e('0x2f')]['sort']);_0x101836[_0x270e('0x3b')]=qs[_0x270e('0x3a')](_[_0x270e('0x4f')](_0x4632bd['query'],_0x62a93e[_0x270e('0x3a')]));if(_0x4632bd[_0x270e('0x2f')][_0x270e('0x50')]){_0x101836[_0x270e('0x3b')]=_[_0x270e('0x3c')](_0x101836[_0x270e('0x3b')],{'$or':_[_0x270e('0x2c')](_0x101836[_0x270e('0x32')],function(_0x2c0cfc){var _0x24d271={};_0x24d271[_0x2c0cfc]={'$like':'%'+_0x4632bd['query'][_0x270e('0x50')]+'%'};return _0x24d271;})});}_0x101836=_[_0x270e('0x3c')]({},_0x101836,_0x4632bd[_0x270e('0x3e')]);return _0xb26a9f[_0x270e('0x4d')](_0x101836);}})['then'](function(_0x4ec03e){if(_0x4ec03e){_0x288238=_0x4ec03e[_0x270e('0x35')];if(!_0x4632bd['query'][_0x270e('0x36')](_0x270e('0x37'))){_0x101836[_0x270e('0x1e')]=qs[_0x270e('0x1e')](_0x4632bd[_0x270e('0x2f')]['limit']);_0x101836[_0x270e('0x1c')]=qs[_0x270e('0x1c')](_0x4632bd[_0x270e('0x2f')]['offset']);}return _0xb26a9f[_0x270e('0x4d')](_0x101836);}})[_0x270e('0x27')](function(_0x166929){if(_0x166929){return _0x166929?{'count':_0x288238,'rows':_0x166929}:null;}})['then'](respondWithResult(_0x3d6511,null))[_0x270e('0x44')](handleError(_0x3d6511,null));};exports[_0x270e('0x51')]=function(_0x4c034a,_0x557c35,_0x8b1957){var _0x224fae={};var _0x20d5a3={};var _0x29eaab;var _0x26758b;return db[_0x270e('0x3f')]['findOne']({'where':{'id':_0x4c034a[_0x270e('0x46')]['id']}})[_0x270e('0x27')](handleEntityNotFound(_0x557c35,null))['then'](function(_0x1c76a1){if(_0x1c76a1){_0x29eaab=_0x1c76a1;_0x20d5a3[_0x270e('0x31')]=_[_0x270e('0x30')](db['VtigerField'][_0x270e('0x47')]);_0x20d5a3[_0x270e('0x2f')]=_[_0x270e('0x30')](_0x4c034a[_0x270e('0x2f')]);_0x20d5a3[_0x270e('0x3a')]=_[_0x270e('0x33')](_0x20d5a3[_0x270e('0x31')],_0x20d5a3[_0x270e('0x2f')]);_0x224fae[_0x270e('0x32')]=_[_0x270e('0x33')](_0x20d5a3[_0x270e('0x31')],qs[_0x270e('0x34')](_0x4c034a[_0x270e('0x2f')]['fields']));_0x224fae[_0x270e('0x32')]=_0x224fae['attributes'][_0x270e('0x35')]?_0x224fae['attributes']:_0x20d5a3[_0x270e('0x31')];_0x224fae[_0x270e('0x38')]=qs[_0x270e('0x39')](_0x4c034a[_0x270e('0x2f')][_0x270e('0x39')]);_0x224fae[_0x270e('0x3b')]=qs[_0x270e('0x3a')](_[_0x270e('0x4f')](_0x4c034a[_0x270e('0x2f')],_0x20d5a3['filters']));if(_0x4c034a['query'][_0x270e('0x50')]){_0x224fae[_0x270e('0x3b')]=_[_0x270e('0x3c')](_0x224fae[_0x270e('0x3b')],{'$or':_[_0x270e('0x2c')](_0x224fae[_0x270e('0x32')],function(_0xce3527){var _0x5f0085={};_0x5f0085[_0xce3527]={'$like':'%'+_0x4c034a[_0x270e('0x2f')]['filter']+'%'};return _0x5f0085;})});}_0x224fae=_[_0x270e('0x3c')]({},_0x224fae,_0x4c034a['options']);return _0x29eaab[_0x270e('0x51')](_0x224fae);}})[_0x270e('0x27')](function(_0xf20d6e){if(_0xf20d6e){_0x26758b=_0xf20d6e['length'];if(!_0x4c034a[_0x270e('0x2f')][_0x270e('0x36')]('nolimit')){_0x224fae[_0x270e('0x1e')]=qs[_0x270e('0x1e')](_0x4c034a[_0x270e('0x2f')][_0x270e('0x1e')]);_0x224fae[_0x270e('0x1c')]=qs['offset'](_0x4c034a[_0x270e('0x2f')][_0x270e('0x1c')]);}return _0x29eaab[_0x270e('0x51')](_0x224fae);}})['then'](function(_0x169e9c){if(_0x169e9c){return _0x169e9c?{'count':_0x26758b,'rows':_0x169e9c}:null;}})[_0x270e('0x27')](respondWithResult(_0x557c35,null))[_0x270e('0x44')](handleError(_0x557c35,null));};
\ No newline at end of file
+var _0x5a93=['catch','update','find','destroy','getFields','findOne','VtigerField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','sendStatus','stack','name','send','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','show','params','options','create','body'];(function(_0x23c8ba,_0x2d8652){var _0x1a33e6=function(_0x102394){while(--_0x102394){_0x23c8ba['push'](_0x23c8ba['shift']());}};_0x1a33e6(++_0x2d8652);}(_0x5a93,0x149));var _0x35a9=function(_0x466238,_0x113f96){_0x466238=_0x466238-0x0;var _0x4b7821=_0x5a93[_0x466238];return _0x4b7821;};'use strict';var emlformat=require(_0x35a9('0x0'));var rimraf=require(_0x35a9('0x1'));var zipdir=require(_0x35a9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x35a9('0x3'));var moment=require(_0x35a9('0x4'));var BPromise=require(_0x35a9('0x5'));var Mustache=require('mustache');var util=require(_0x35a9('0x6'));var path=require('path');var sox=require(_0x35a9('0x7'));var csv=require('to-csv');var ejs=require(_0x35a9('0x8'));var fs=require('fs');var fs_extra=require(_0x35a9('0x9'));var _=require(_0x35a9('0xa'));var squel=require(_0x35a9('0xb'));var crypto=require('crypto');var jsforce=require(_0x35a9('0xc'));var deskjs=require(_0x35a9('0xd'));var toCsv=require(_0x35a9('0xe'));var querystring=require('querystring');var Papa=require(_0x35a9('0xf'));var Redis=require(_0x35a9('0x10'));var authService=require(_0x35a9('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x35a9('0x12'));var hardwareService=require(_0x35a9('0x13'));var logger=require(_0x35a9('0x14'))(_0x35a9('0x15'));var utils=require(_0x35a9('0x16'));var config=require(_0x35a9('0x17'));var licenseUtil=require(_0x35a9('0x18'));var db=require(_0x35a9('0x19'))['db'];function respondWithStatusCode(_0x2aba08,_0x2e4ab6){_0x2e4ab6=_0x2e4ab6||0xcc;return function(_0xa23b23){if(_0xa23b23){return _0x2aba08['sendStatus'](_0x2e4ab6);}return _0x2aba08[_0x35a9('0x1a')](_0x2e4ab6)[_0x35a9('0x1b')]();};}function respondWithResult(_0x3a58a1,_0x2f5586){_0x2f5586=_0x2f5586||0xc8;return function(_0x4bf82a){if(_0x4bf82a){return _0x3a58a1['status'](_0x2f5586)[_0x35a9('0x1c')](_0x4bf82a);}};}function respondWithFilteredResult(_0x301a93,_0x1eba84){return function(_0x52a7aa){if(_0x52a7aa){var _0x2ede49=typeof _0x1eba84[_0x35a9('0x1d')]===_0x35a9('0x1e')&&typeof _0x1eba84[_0x35a9('0x1f')]===_0x35a9('0x1e');var _0x3df8c3=_0x52a7aa[_0x35a9('0x20')];var _0x1fe6a5=_0x2ede49?0x0:_0x1eba84['offset'];var _0x5b49f3=_0x2ede49?_0x52a7aa[_0x35a9('0x20')]:_0x1eba84[_0x35a9('0x1d')]+_0x1eba84[_0x35a9('0x1f')];var _0x2a6366;if(_0x5b49f3>=_0x3df8c3){_0x5b49f3=_0x3df8c3;_0x2a6366=0xc8;}else{_0x2a6366=0xce;}_0x301a93[_0x35a9('0x1a')](_0x2a6366);return _0x301a93[_0x35a9('0x21')](_0x35a9('0x22'),_0x1fe6a5+'-'+_0x5b49f3+'/'+_0x3df8c3)[_0x35a9('0x1c')](_0x52a7aa);}return null;};}function patchUpdates(_0x56dec1){return function(_0x3c2808){try{jsonpatch[_0x35a9('0x23')](_0x3c2808,_0x56dec1,!![]);}catch(_0x582796){return BPromise['reject'](_0x582796);}return _0x3c2808[_0x35a9('0x24')]();};}function saveUpdates(_0xdee143,_0x1a7ac6){return function(_0x566bd3){if(_0x566bd3){return _0x566bd3['update'](_0xdee143)[_0x35a9('0x25')](function(_0x4affbb){return _0x4affbb;});}return null;};}function removeEntity(_0x429348,_0x33673a){return function(_0x1e59ab){if(_0x1e59ab){return _0x1e59ab['destroy']()['then'](function(){_0x429348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x571124,_0x4c5eb3){return function(_0x3248e0){if(!_0x3248e0){_0x571124[_0x35a9('0x26')](0x194);}return _0x3248e0;};}function handleError(_0x12ecf5,_0x1947c3){_0x1947c3=_0x1947c3||0x1f4;return function(_0x369fe9){logger['error'](_0x369fe9[_0x35a9('0x27')]);if(_0x369fe9[_0x35a9('0x28')]){delete _0x369fe9[_0x35a9('0x28')];}_0x12ecf5[_0x35a9('0x1a')](_0x1947c3)[_0x35a9('0x29')](_0x369fe9);};}exports['index']=function(_0x2ae748,_0xcecabc){var _0x22676e={},_0x3cfa8b={},_0x2a29ee={'count':0x0,'rows':[]};var _0x3f9bda=_['map'](db[_0x35a9('0x2a')][_0x35a9('0x2b')],function(_0x2c23fa){return{'name':_0x2c23fa[_0x35a9('0x2c')],'type':_0x2c23fa['type'][_0x35a9('0x2d')]};});_0x3cfa8b[_0x35a9('0x2e')]=_[_0x35a9('0x2f')](_0x3f9bda,_0x35a9('0x28'));_0x3cfa8b[_0x35a9('0x30')]=_[_0x35a9('0x31')](_0x2ae748[_0x35a9('0x30')]);_0x3cfa8b[_0x35a9('0x32')]=_['intersection'](_0x3cfa8b['model'],_0x3cfa8b[_0x35a9('0x30')]);_0x22676e[_0x35a9('0x33')]=_[_0x35a9('0x34')](_0x3cfa8b[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x2ae748['query']['fields']));_0x22676e[_0x35a9('0x33')]=_0x22676e[_0x35a9('0x33')][_0x35a9('0x36')]?_0x22676e[_0x35a9('0x33')]:_0x3cfa8b[_0x35a9('0x2e')];if(!_0x2ae748[_0x35a9('0x30')][_0x35a9('0x37')](_0x35a9('0x38'))){_0x22676e[_0x35a9('0x1f')]=qs[_0x35a9('0x1f')](_0x2ae748[_0x35a9('0x30')][_0x35a9('0x1f')]);_0x22676e[_0x35a9('0x1d')]=qs['offset'](_0x2ae748[_0x35a9('0x30')][_0x35a9('0x1d')]);}_0x22676e[_0x35a9('0x39')]=qs[_0x35a9('0x3a')](_0x2ae748['query'][_0x35a9('0x3a')]);_0x22676e[_0x35a9('0x3b')]=qs['filters'](_[_0x35a9('0x3c')](_0x2ae748[_0x35a9('0x30')],_0x3cfa8b[_0x35a9('0x32')]),_0x3f9bda);if(_0x2ae748[_0x35a9('0x30')][_0x35a9('0x3d')]){_0x22676e[_0x35a9('0x3b')]=_[_0x35a9('0x3e')](_0x22676e['where'],{'$or':_['map'](_0x3f9bda,function(_0x4620c7){if(_0x4620c7[_0x35a9('0x3f')]!=='VIRTUAL'){var _0x55455d={};_0x55455d[_0x4620c7[_0x35a9('0x28')]]={'$like':'%'+_0x2ae748[_0x35a9('0x30')]['filter']+'%'};return _0x55455d;}})});}_0x22676e=_[_0x35a9('0x3e')]({},_0x22676e,_0x2ae748['options']);var _0x13faec={'where':_0x22676e[_0x35a9('0x3b')]};return db['VtigerConfiguration']['count'](_0x13faec)['then'](function(_0x1c4c1b){_0x2a29ee['count']=_0x1c4c1b;if(_0x2ae748['query'][_0x35a9('0x40')]){_0x22676e[_0x35a9('0x41')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x22676e);})[_0x35a9('0x25')](function(_0x229601){_0x2a29ee['rows']=_0x229601;return _0x2a29ee;})[_0x35a9('0x25')](respondWithFilteredResult(_0xcecabc,_0x22676e))['catch'](handleError(_0xcecabc,null));};exports[_0x35a9('0x42')]=function(_0x45377b,_0x17532a){var _0x1abfa4={'raw':![],'where':{'id':_0x45377b[_0x35a9('0x43')]['id']}},_0x287571={};_0x287571[_0x35a9('0x2e')]=_[_0x35a9('0x31')](db[_0x35a9('0x2a')][_0x35a9('0x2b')]);_0x287571['query']=_['keys'](_0x45377b[_0x35a9('0x30')]);_0x287571[_0x35a9('0x32')]=_[_0x35a9('0x34')](_0x287571[_0x35a9('0x2e')],_0x287571[_0x35a9('0x30')]);_0x1abfa4[_0x35a9('0x33')]=_[_0x35a9('0x34')](_0x287571[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x45377b['query'][_0x35a9('0x35')]));_0x1abfa4[_0x35a9('0x33')]=_0x1abfa4['attributes'][_0x35a9('0x36')]?_0x1abfa4[_0x35a9('0x33')]:_0x287571['model'];if(_0x45377b[_0x35a9('0x30')][_0x35a9('0x40')]){_0x1abfa4[_0x35a9('0x41')]=[{'all':!![]}];}_0x1abfa4=_[_0x35a9('0x3e')]({},_0x1abfa4,_0x45377b[_0x35a9('0x44')]);return db[_0x35a9('0x2a')]['find'](_0x1abfa4)['then'](handleEntityNotFound(_0x17532a,null))[_0x35a9('0x25')](respondWithResult(_0x17532a,null))['catch'](handleError(_0x17532a,null));};exports[_0x35a9('0x45')]=function(_0x5a11e7,_0x458e26){return db[_0x35a9('0x2a')][_0x35a9('0x45')](_0x5a11e7[_0x35a9('0x46')],{})[_0x35a9('0x25')](respondWithResult(_0x458e26,0xc9))[_0x35a9('0x47')](handleError(_0x458e26,null));};exports[_0x35a9('0x48')]=function(_0xf765b1,_0x550c83){if(_0xf765b1[_0x35a9('0x46')]['id']){delete _0xf765b1[_0x35a9('0x46')]['id'];}return db['VtigerConfiguration'][_0x35a9('0x49')]({'where':{'id':_0xf765b1[_0x35a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x550c83,null))[_0x35a9('0x25')](saveUpdates(_0xf765b1[_0x35a9('0x46')],null))['then'](respondWithResult(_0x550c83,null))[_0x35a9('0x47')](handleError(_0x550c83,null));};exports[_0x35a9('0x4a')]=function(_0x207ece,_0x2052e0){return db[_0x35a9('0x2a')][_0x35a9('0x49')]({'where':{'id':_0x207ece[_0x35a9('0x43')]['id']}})[_0x35a9('0x25')](handleEntityNotFound(_0x2052e0,null))[_0x35a9('0x25')](removeEntity(_0x2052e0,null))[_0x35a9('0x47')](handleError(_0x2052e0,null));};exports[_0x35a9('0x4b')]=function(_0x44717d,_0x6d1bfa,_0x8c33a6){var _0x4f8a77={};var _0x5cc1b0={};var _0x4a2cd5;var _0x99cc66;return db[_0x35a9('0x2a')][_0x35a9('0x4c')]({'where':{'id':_0x44717d[_0x35a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x6d1bfa,null))[_0x35a9('0x25')](function(_0x4ec3b3){if(_0x4ec3b3){_0x4a2cd5=_0x4ec3b3;_0x5cc1b0[_0x35a9('0x2e')]=_[_0x35a9('0x31')](db[_0x35a9('0x4d')]['rawAttributes']);_0x5cc1b0['query']=_[_0x35a9('0x31')](_0x44717d['query']);_0x5cc1b0[_0x35a9('0x32')]=_['intersection'](_0x5cc1b0[_0x35a9('0x2e')],_0x5cc1b0[_0x35a9('0x30')]);_0x4f8a77['attributes']=_[_0x35a9('0x34')](_0x5cc1b0[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x44717d['query'][_0x35a9('0x35')]));_0x4f8a77[_0x35a9('0x33')]=_0x4f8a77['attributes'][_0x35a9('0x36')]?_0x4f8a77[_0x35a9('0x33')]:_0x5cc1b0[_0x35a9('0x2e')];_0x4f8a77[_0x35a9('0x39')]=qs[_0x35a9('0x3a')](_0x44717d['query']['sort']);_0x4f8a77[_0x35a9('0x3b')]=qs['filters'](_[_0x35a9('0x3c')](_0x44717d[_0x35a9('0x30')],_0x5cc1b0[_0x35a9('0x32')]));if(_0x44717d['query'][_0x35a9('0x3d')]){_0x4f8a77['where']=_[_0x35a9('0x3e')](_0x4f8a77['where'],{'$or':_[_0x35a9('0x2f')](_0x4f8a77['attributes'],function(_0x3d9e31){var _0x33b220={};_0x33b220[_0x3d9e31]={'$like':'%'+_0x44717d[_0x35a9('0x30')][_0x35a9('0x3d')]+'%'};return _0x33b220;})});}_0x4f8a77=_[_0x35a9('0x3e')]({},_0x4f8a77,_0x44717d[_0x35a9('0x44')]);return _0x4a2cd5['getFields'](_0x4f8a77);}})[_0x35a9('0x25')](function(_0x1884d5){if(_0x1884d5){_0x99cc66=_0x1884d5[_0x35a9('0x36')];if(!_0x44717d['query']['hasOwnProperty']('nolimit')){_0x4f8a77[_0x35a9('0x1f')]=qs['limit'](_0x44717d[_0x35a9('0x30')][_0x35a9('0x1f')]);_0x4f8a77['offset']=qs[_0x35a9('0x1d')](_0x44717d[_0x35a9('0x30')][_0x35a9('0x1d')]);}return _0x4a2cd5[_0x35a9('0x4b')](_0x4f8a77);}})['then'](function(_0x1a5fda){if(_0x1a5fda){return _0x1a5fda?{'count':_0x99cc66,'rows':_0x1a5fda}:null;}})[_0x35a9('0x25')](respondWithResult(_0x6d1bfa,null))[_0x35a9('0x47')](handleError(_0x6d1bfa,null));};exports[_0x35a9('0x4e')]=function(_0x2030f8,_0x10290b,_0x182880){var _0x261b4d={};var _0x3c9eff={};var _0x144d74;var _0x195dcc;return db[_0x35a9('0x2a')][_0x35a9('0x4c')]({'where':{'id':_0x2030f8[_0x35a9('0x43')]['id']}})[_0x35a9('0x25')](handleEntityNotFound(_0x10290b,null))[_0x35a9('0x25')](function(_0x3824f4){if(_0x3824f4){_0x144d74=_0x3824f4;_0x3c9eff[_0x35a9('0x2e')]=_[_0x35a9('0x31')](db['VtigerField']['rawAttributes']);_0x3c9eff[_0x35a9('0x30')]=_[_0x35a9('0x31')](_0x2030f8[_0x35a9('0x30')]);_0x3c9eff[_0x35a9('0x32')]=_['intersection'](_0x3c9eff[_0x35a9('0x2e')],_0x3c9eff[_0x35a9('0x30')]);_0x261b4d[_0x35a9('0x33')]=_[_0x35a9('0x34')](_0x3c9eff[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x2030f8[_0x35a9('0x30')][_0x35a9('0x35')]));_0x261b4d['attributes']=_0x261b4d[_0x35a9('0x33')][_0x35a9('0x36')]?_0x261b4d[_0x35a9('0x33')]:_0x3c9eff[_0x35a9('0x2e')];_0x261b4d[_0x35a9('0x39')]=qs['sort'](_0x2030f8[_0x35a9('0x30')]['sort']);_0x261b4d['where']=qs[_0x35a9('0x32')](_[_0x35a9('0x3c')](_0x2030f8[_0x35a9('0x30')],_0x3c9eff[_0x35a9('0x32')]));if(_0x2030f8['query'][_0x35a9('0x3d')]){_0x261b4d['where']=_[_0x35a9('0x3e')](_0x261b4d[_0x35a9('0x3b')],{'$or':_[_0x35a9('0x2f')](_0x261b4d[_0x35a9('0x33')],function(_0x183a43){var _0x15cb63={};_0x15cb63[_0x183a43]={'$like':'%'+_0x2030f8['query'][_0x35a9('0x3d')]+'%'};return _0x15cb63;})});}_0x261b4d=_[_0x35a9('0x3e')]({},_0x261b4d,_0x2030f8['options']);return _0x144d74[_0x35a9('0x4e')](_0x261b4d);}})[_0x35a9('0x25')](function(_0x11af82){if(_0x11af82){_0x195dcc=_0x11af82[_0x35a9('0x36')];if(!_0x2030f8['query']['hasOwnProperty'](_0x35a9('0x38'))){_0x261b4d['limit']=qs[_0x35a9('0x1f')](_0x2030f8[_0x35a9('0x30')][_0x35a9('0x1f')]);_0x261b4d['offset']=qs['offset'](_0x2030f8[_0x35a9('0x30')][_0x35a9('0x1d')]);}return _0x144d74[_0x35a9('0x4e')](_0x261b4d);}})['then'](function(_0x1a4468){if(_0x1a4468){return _0x1a4468?{'count':_0x195dcc,'rows':_0x1a4468}:null;}})['then'](respondWithResult(_0x10290b,null))[_0x35a9('0x47')](handleError(_0x10290b,null));};exports[_0x35a9('0x4f')]=function(_0x415ec6,_0x536be3,_0x553a4d){var _0x3940fa={};var _0x25913b={};var _0x36ce84;var _0x3e9188;return db['VtigerConfiguration'][_0x35a9('0x4c')]({'where':{'id':_0x415ec6[_0x35a9('0x43')]['id']}})['then'](handleEntityNotFound(_0x536be3,null))[_0x35a9('0x25')](function(_0x1feb21){if(_0x1feb21){_0x36ce84=_0x1feb21;_0x25913b[_0x35a9('0x2e')]=_[_0x35a9('0x31')](db[_0x35a9('0x4d')][_0x35a9('0x2b')]);_0x25913b[_0x35a9('0x30')]=_[_0x35a9('0x31')](_0x415ec6['query']);_0x25913b['filters']=_['intersection'](_0x25913b[_0x35a9('0x2e')],_0x25913b['query']);_0x3940fa[_0x35a9('0x33')]=_['intersection'](_0x25913b[_0x35a9('0x2e')],qs[_0x35a9('0x35')](_0x415ec6[_0x35a9('0x30')]['fields']));_0x3940fa[_0x35a9('0x33')]=_0x3940fa[_0x35a9('0x33')][_0x35a9('0x36')]?_0x3940fa['attributes']:_0x25913b[_0x35a9('0x2e')];_0x3940fa[_0x35a9('0x39')]=qs[_0x35a9('0x3a')](_0x415ec6[_0x35a9('0x30')]['sort']);_0x3940fa[_0x35a9('0x3b')]=qs[_0x35a9('0x32')](_[_0x35a9('0x3c')](_0x415ec6['query'],_0x25913b[_0x35a9('0x32')]));if(_0x415ec6[_0x35a9('0x30')][_0x35a9('0x3d')]){_0x3940fa[_0x35a9('0x3b')]=_['merge'](_0x3940fa[_0x35a9('0x3b')],{'$or':_[_0x35a9('0x2f')](_0x3940fa[_0x35a9('0x33')],function(_0x1d0d6a){var _0x2633d1={};_0x2633d1[_0x1d0d6a]={'$like':'%'+_0x415ec6[_0x35a9('0x30')][_0x35a9('0x3d')]+'%'};return _0x2633d1;})});}_0x3940fa=_['merge']({},_0x3940fa,_0x415ec6[_0x35a9('0x44')]);return _0x36ce84[_0x35a9('0x4f')](_0x3940fa);}})['then'](function(_0x834a57){if(_0x834a57){_0x3e9188=_0x834a57[_0x35a9('0x36')];if(!_0x415ec6[_0x35a9('0x30')]['hasOwnProperty'](_0x35a9('0x38'))){_0x3940fa['limit']=qs['limit'](_0x415ec6[_0x35a9('0x30')][_0x35a9('0x1f')]);_0x3940fa[_0x35a9('0x1d')]=qs['offset'](_0x415ec6['query'][_0x35a9('0x1d')]);}return _0x36ce84[_0x35a9('0x4f')](_0x3940fa);}})[_0x35a9('0x25')](function(_0x486654){if(_0x486654){return _0x486654?{'count':_0x3e9188,'rows':_0x486654}:null;}})['then'](respondWithResult(_0x536be3,null))[_0x35a9('0x47')](handleError(_0x536be3,null));};
\ No newline at end of file
index 387554c..e87ec03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc5b0=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','VtigerConfiguration','int_vtiger_configurations','lodash','util'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc5b0,0x15c));var _0x0c5b=function(_0x2eb333,_0x511476){_0x2eb333=_0x2eb333-0x0;var _0x3a9ce2=_0xc5b0[_0x2eb333];return _0x3a9ce2;};'use strict';var _=require(_0x0c5b('0x0'));var util=require(_0x0c5b('0x1'));var logger=require(_0x0c5b('0x2'))(_0x0c5b('0x3'));var moment=require(_0x0c5b('0x4'));var BPromise=require(_0x0c5b('0x5'));var rp=require(_0x0c5b('0x6'));var fs=require('fs');var path=require(_0x0c5b('0x7'));var rimraf=require(_0x0c5b('0x8'));var config=require(_0x0c5b('0x9'));var attributes=require('./intVtigerConfiguration.attributes');module[_0x0c5b('0xa')]=function(_0xc635ae,_0x4aea4e){return _0xc635ae[_0x0c5b('0xb')](_0x0c5b('0xc'),attributes,{'tableName':_0x0c5b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4bf7=['api','moment','bluebird','path','rimraf','../../config/environment','lodash','util','../../config/logger'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0x4bf7,0x1c8));var _0x74bf=function(_0x13236f,_0x3db392){_0x13236f=_0x13236f-0x0;var _0x53b19c=_0x4bf7[_0x13236f];return _0x53b19c;};'use strict';var _=require(_0x74bf('0x0'));var util=require(_0x74bf('0x1'));var logger=require(_0x74bf('0x2'))(_0x74bf('0x3'));var moment=require(_0x74bf('0x4'));var BPromise=require(_0x74bf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74bf('0x6'));var rimraf=require(_0x74bf('0x7'));var config=require(_0x74bf('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x57bd78,_0x133157){return _0x57bd78['define']('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d2b7017..e6f6fcf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x29bf=['request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','http','then','info','VtigerConfiguration,\x20%s,\x20%s'];(function(_0x2254a0,_0x41f33e){var _0x35cd31=function(_0x5242d5){while(--_0x5242d5){_0x2254a0['push'](_0x2254a0['shift']());}};_0x35cd31(++_0x41f33e);}(_0x29bf,0x104));var _0xf29b=function(_0x48d7f4,_0x21e5ef){_0x48d7f4=_0x48d7f4-0x0;var _0x19b6a6=_0x29bf[_0x48d7f4];return _0x19b6a6;};'use strict';var _=require(_0xf29b('0x0'));var util=require('util');var moment=require(_0xf29b('0x1'));var BPromise=require(_0xf29b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf29b('0x3'));var logger=require(_0xf29b('0x4'))(_0xf29b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf29b('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53ace1,_0x494649,_0x15de4b){return new BPromise(function(_0x39bd2d,_0x436ccc){return client['request'](_0x53ace1,_0x15de4b)[_0xf29b('0x7')](function(_0x540a50){logger[_0xf29b('0x8')](_0xf29b('0x9'),_0x494649,_0xf29b('0xa'));logger['debug'](_0xf29b('0xb'),_0x494649,_0xf29b('0xa'),JSON[_0xf29b('0xc')](_0x540a50));if(_0x540a50[_0xf29b('0xd')]){if(_0x540a50[_0xf29b('0xd')][_0xf29b('0xe')]===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x494649,_0x540a50[_0xf29b('0xd')][_0xf29b('0xf')]);return _0x436ccc(_0x540a50[_0xf29b('0xd')][_0xf29b('0xf')]);}logger[_0xf29b('0xd')](_0xf29b('0x9'),_0x494649,_0x540a50[_0xf29b('0xd')][_0xf29b('0xf')]);return _0x39bd2d(_0x540a50['error'][_0xf29b('0xf')]);}else{logger['info'](_0xf29b('0x9'),_0x494649,_0xf29b('0xa'));_0x39bd2d(_0x540a50[_0xf29b('0x10')][_0xf29b('0xf')]);}})[_0xf29b('0x11')](function(_0x4405db){logger['error'](_0xf29b('0x9'),_0x494649,_0x4405db);_0x436ccc(_0x4405db);});});}
\ No newline at end of file
+var _0xaeb8=['catch','lodash','moment','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x2f80b3,_0x2d672b){var _0x3355fe=function(_0xb4685e){while(--_0xb4685e){_0x2f80b3['push'](_0x2f80b3['shift']());}};_0x3355fe(++_0x2d672b);}(_0xaeb8,0xc9));var _0x8aeb=function(_0x2a0183,_0x3fc93c){_0x2a0183=_0x2a0183-0x0;var _0x158c3a=_0xaeb8[_0x2a0183];return _0x158c3a;};'use strict';var _=require(_0x8aeb('0x0'));var util=require('util');var moment=require(_0x8aeb('0x1'));var BPromise=require('bluebird');var rs=require(_0x8aeb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8aeb('0x3'))(_0x8aeb('0x4'));var config=require('../../config/environment');var jayson=require(_0x8aeb('0x5'));var client=jayson[_0x8aeb('0x6')][_0x8aeb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x437935,_0x2c1c24,_0x559dd9){return new BPromise(function(_0x315af9,_0x4446f4){return client[_0x8aeb('0x8')](_0x437935,_0x559dd9)[_0x8aeb('0x9')](function(_0x53db9f){logger['info'](_0x8aeb('0xa'),_0x2c1c24,'request\x20sent');logger[_0x8aeb('0xb')](_0x8aeb('0xc'),_0x2c1c24,_0x8aeb('0xd'),JSON['stringify'](_0x53db9f));if(_0x53db9f[_0x8aeb('0xe')]){if(_0x53db9f[_0x8aeb('0xe')][_0x8aeb('0xf')]===0x1f4){logger[_0x8aeb('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c1c24,_0x53db9f[_0x8aeb('0xe')][_0x8aeb('0x10')]);return _0x4446f4(_0x53db9f[_0x8aeb('0xe')][_0x8aeb('0x10')]);}logger[_0x8aeb('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c1c24,_0x53db9f[_0x8aeb('0xe')][_0x8aeb('0x10')]);return _0x315af9(_0x53db9f[_0x8aeb('0xe')]['message']);}else{logger[_0x8aeb('0x11')](_0x8aeb('0xa'),_0x2c1c24,_0x8aeb('0xd'));_0x315af9(_0x53db9f[_0x8aeb('0x12')][_0x8aeb('0x10')]);}})[_0x8aeb('0x13')](function(_0x44eb81){logger[_0x8aeb('0xe')]('VtigerConfiguration,\x20%s,\x20%s',_0x2c1c24,_0x44eb81);_0x4446f4(_0x44eb81);});});}
\ No newline at end of file
index 202d70c..6924b55 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa3e=['/:id','update','delete','destroy','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','show','create'];(function(_0x3cdf65,_0x5d21db){var _0x1b6943=function(_0x48b550){while(--_0x48b550){_0x3cdf65['push'](_0x3cdf65['shift']());}};_0x1b6943(++_0x5d21db);}(_0xaa3e,0x17f));var _0xeaa3=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xaa3e[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0xeaa3('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xeaa3('0x1'));var router=express[_0xeaa3('0x2')]();var fs_extra=require(_0xeaa3('0x3'));var auth=require(_0xeaa3('0x4'));var interaction=require(_0xeaa3('0x5'));var config=require(_0xeaa3('0x6'));var controller=require(_0xeaa3('0x7'));router[_0xeaa3('0x8')]('/',auth[_0xeaa3('0x9')](),controller[_0xeaa3('0xa')]);router[_0xeaa3('0x8')]('/:id',auth[_0xeaa3('0x9')](),controller[_0xeaa3('0xb')]);router['post']('/',auth[_0xeaa3('0x9')](),controller[_0xeaa3('0xc')]);router['put'](_0xeaa3('0xd'),auth[_0xeaa3('0x9')](),controller[_0xeaa3('0xe')]);router[_0xeaa3('0xf')](_0xeaa3('0xd'),auth[_0xeaa3('0x9')](),controller[_0xeaa3('0x10')]);module[_0xeaa3('0x11')]=router;
\ No newline at end of file
+var _0x53f3=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','multer','path','connect-timeout','express','fs-extra'];(function(_0x525eb3,_0x549ee6){var _0x395c23=function(_0x48bc4d){while(--_0x48bc4d){_0x525eb3['push'](_0x525eb3['shift']());}};_0x395c23(++_0x549ee6);}(_0x53f3,0xb9));var _0x353f=function(_0x319df2,_0x4085fb){_0x319df2=_0x319df2-0x0;var _0x41f9df=_0x53f3[_0x319df2];return _0x41f9df;};'use strict';var multer=require(_0x353f('0x0'));var util=require('util');var path=require(_0x353f('0x1'));var timeout=require(_0x353f('0x2'));var express=require(_0x353f('0x3'));var router=express['Router']();var fs_extra=require(_0x353f('0x4'));var auth=require(_0x353f('0x5'));var interaction=require(_0x353f('0x6'));var config=require(_0x353f('0x7'));var controller=require(_0x353f('0x8'));router[_0x353f('0x9')]('/',auth['isAuthenticated'](),controller[_0x353f('0xa')]);router['get'](_0x353f('0xb'),auth[_0x353f('0xc')](),controller[_0x353f('0xd')]);router[_0x353f('0xe')]('/',auth['isAuthenticated'](),controller[_0x353f('0xf')]);router[_0x353f('0x10')](_0x353f('0xb'),auth[_0x353f('0xc')](),controller[_0x353f('0x11')]);router[_0x353f('0x12')](_0x353f('0xb'),auth[_0x353f('0xc')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index c769e24..361a074 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cd7=['sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN'];(function(_0x398542,_0x551b12){var _0x4ad2ab=function(_0x1fe3eb){while(--_0x1fe3eb){_0x398542['push'](_0x398542['shift']());}};_0x4ad2ab(++_0x551b12);}(_0x4cd7,0x154));var _0x74cd=function(_0x3ae13b,_0x3ef75d){_0x3ae13b=_0x3ae13b-0x0;var _0x1dc379=_0x4cd7[_0x3ae13b];return _0x1dc379;};'use strict';var Sequelize=require(_0x74cd('0x0'));module[_0x74cd('0x1')]={'type':{'type':Sequelize['ENUM'](_0x74cd('0x2'),_0x74cd('0x3'),'customVariable',_0x74cd('0x4'),_0x74cd('0x5')),'defaultValue':_0x74cd('0x2')},'content':{'type':Sequelize[_0x74cd('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x74cd('0x7')]('string','variable',_0x74cd('0x8'))},'keyContent':{'type':Sequelize[_0x74cd('0x6')]},'idField':{'type':Sequelize[_0x74cd('0x6')]},'nameField':{'type':Sequelize[_0x74cd('0x6')]},'customField':{'type':Sequelize[_0x74cd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x74cd('0x6')]}};
\ No newline at end of file
+var _0x5063=['string','customVariable','picklist','STRING','BOOLEAN','sequelize','ENUM'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x5063,0x1be));var _0x3506=function(_0x464c9b,_0x3d1eff){_0x464c9b=_0x464c9b-0x0;var _0x444434=_0x5063[_0x464c9b];return _0x444434;};'use strict';var Sequelize=require(_0x3506('0x0'));module['exports']={'type':{'type':Sequelize[_0x3506('0x1')](_0x3506('0x2'),'variable',_0x3506('0x3'),'keyValue',_0x3506('0x4')),'defaultValue':_0x3506('0x2')},'content':{'type':Sequelize[_0x3506('0x5')]},'key':{'type':Sequelize[_0x3506('0x5')]},'keyType':{'type':Sequelize[_0x3506('0x1')]('string','variable',_0x3506('0x3'))},'keyContent':{'type':Sequelize[_0x3506('0x5')]},'idField':{'type':Sequelize[_0x3506('0x5')]},'nameField':{'type':Sequelize[_0x3506('0x5')]},'customField':{'type':Sequelize[_0x3506('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}};
\ No newline at end of file
index cd9c71c..13d0c5f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x520e=['filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','update','body','destroy','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','then','error','stack','send','map','VtigerField','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','nolimit','sort','where'];(function(_0x2fbb45,_0x1b2c7f){var _0x526325=function(_0x3dcf40){while(--_0x3dcf40){_0x2fbb45['push'](_0x2fbb45['shift']());}};_0x526325(++_0x1b2c7f);}(_0x520e,0x1a7));var _0xe520=function(_0x4099ee,_0x38495a){_0x4099ee=_0x4099ee-0x0;var _0x1b7bfc=_0x520e[_0x4099ee];return _0x1b7bfc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe520('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe520('0x1'));var rp=require(_0xe520('0x2'));var moment=require('moment');var BPromise=require(_0xe520('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe520('0x4'));var sox=require(_0xe520('0x5'));var csv=require(_0xe520('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe520('0x7'));var _=require('lodash');var squel=require(_0xe520('0x8'));var crypto=require(_0xe520('0x9'));var jsforce=require(_0xe520('0xa'));var deskjs=require(_0xe520('0xb'));var toCsv=require(_0xe520('0x6'));var querystring=require(_0xe520('0xc'));var Papa=require('papaparse');var Redis=require(_0xe520('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe520('0xe'));var as=require(_0xe520('0xf'));var hardwareService=require(_0xe520('0x10'));var logger=require(_0xe520('0x11'))(_0xe520('0x12'));var utils=require(_0xe520('0x13'));var config=require(_0xe520('0x14'));var licenseUtil=require(_0xe520('0x15'));var db=require(_0xe520('0x16'))['db'];function respondWithStatusCode(_0x314a39,_0x7767c6){_0x7767c6=_0x7767c6||0xcc;return function(_0x1e422a){if(_0x1e422a){return _0x314a39[_0xe520('0x17')](_0x7767c6);}return _0x314a39[_0xe520('0x18')](_0x7767c6)[_0xe520('0x19')]();};}function respondWithResult(_0x24e04a,_0x1bf679){_0x1bf679=_0x1bf679||0xc8;return function(_0x58d9f2){if(_0x58d9f2){return _0x24e04a[_0xe520('0x18')](_0x1bf679)[_0xe520('0x1a')](_0x58d9f2);}};}function respondWithFilteredResult(_0x77e1b2,_0x10ff8e){return function(_0x59c0d7){if(_0x59c0d7){var _0x468dcd=typeof _0x10ff8e[_0xe520('0x1b')]===_0xe520('0x1c')&&typeof _0x10ff8e[_0xe520('0x1d')]===_0xe520('0x1c');var _0x1154d6=_0x59c0d7[_0xe520('0x1e')];var _0x3ee94d=_0x468dcd?0x0:_0x10ff8e[_0xe520('0x1b')];var _0x31473d=_0x468dcd?_0x59c0d7[_0xe520('0x1e')]:_0x10ff8e[_0xe520('0x1b')]+_0x10ff8e[_0xe520('0x1d')];var _0x13547f;if(_0x31473d>=_0x1154d6){_0x31473d=_0x1154d6;_0x13547f=0xc8;}else{_0x13547f=0xce;}_0x77e1b2[_0xe520('0x18')](_0x13547f);return _0x77e1b2['set']('Content-Range',_0x3ee94d+'-'+_0x31473d+'/'+_0x1154d6)[_0xe520('0x1a')](_0x59c0d7);}return null;};}function patchUpdates(_0x30f70d){return function(_0x4e701a){try{jsonpatch['apply'](_0x4e701a,_0x30f70d,!![]);}catch(_0x44918f){return BPromise[_0xe520('0x1f')](_0x44918f);}return _0x4e701a[_0xe520('0x20')]();};}function saveUpdates(_0x1bfcab,_0x29b6a6){return function(_0xb0c390){if(_0xb0c390){return _0xb0c390['update'](_0x1bfcab)[_0xe520('0x21')](function(_0x12f11d){return _0x12f11d;});}return null;};}function removeEntity(_0x2152b7,_0x5481fe){return function(_0x3a4c08){if(_0x3a4c08){return _0x3a4c08['destroy']()[_0xe520('0x21')](function(){_0x2152b7[_0xe520('0x18')](0xcc)[_0xe520('0x19')]();});}};}function handleEntityNotFound(_0x3178eb,_0x60161a){return function(_0x2a08bd){if(!_0x2a08bd){_0x3178eb[_0xe520('0x17')](0x194);}return _0x2a08bd;};}function handleError(_0x521e94,_0x15d9b5){_0x15d9b5=_0x15d9b5||0x1f4;return function(_0xe49b42){logger[_0xe520('0x22')](_0xe49b42[_0xe520('0x23')]);if(_0xe49b42['name']){delete _0xe49b42['name'];}_0x521e94[_0xe520('0x18')](_0x15d9b5)[_0xe520('0x24')](_0xe49b42);};}exports['index']=function(_0x5bf07d,_0x48cfe7){var _0x4aba4e={},_0xb48fef={},_0x21cf45={'count':0x0,'rows':[]};var _0x52264b=_[_0xe520('0x25')](db[_0xe520('0x26')][_0xe520('0x27')],function(_0x3909e3){return{'name':_0x3909e3[_0xe520('0x28')],'type':_0x3909e3[_0xe520('0x29')]['key']};});_0xb48fef[_0xe520('0x2a')]=_[_0xe520('0x25')](_0x52264b,_0xe520('0x2b'));_0xb48fef[_0xe520('0x2c')]=_[_0xe520('0x2d')](_0x5bf07d[_0xe520('0x2c')]);_0xb48fef[_0xe520('0x2e')]=_[_0xe520('0x2f')](_0xb48fef[_0xe520('0x2a')],_0xb48fef['query']);_0x4aba4e[_0xe520('0x30')]=_[_0xe520('0x2f')](_0xb48fef['model'],qs[_0xe520('0x31')](_0x5bf07d['query'][_0xe520('0x31')]));_0x4aba4e[_0xe520('0x30')]=_0x4aba4e[_0xe520('0x30')]['length']?_0x4aba4e[_0xe520('0x30')]:_0xb48fef['model'];if(!_0x5bf07d[_0xe520('0x2c')]['hasOwnProperty'](_0xe520('0x32'))){_0x4aba4e[_0xe520('0x1d')]=qs[_0xe520('0x1d')](_0x5bf07d[_0xe520('0x2c')]['limit']);_0x4aba4e[_0xe520('0x1b')]=qs[_0xe520('0x1b')](_0x5bf07d[_0xe520('0x2c')]['offset']);}_0x4aba4e['order']=qs[_0xe520('0x33')](_0x5bf07d['query'][_0xe520('0x33')]);_0x4aba4e[_0xe520('0x34')]=qs[_0xe520('0x2e')](_['pick'](_0x5bf07d[_0xe520('0x2c')],_0xb48fef[_0xe520('0x2e')]),_0x52264b);if(_0x5bf07d[_0xe520('0x2c')][_0xe520('0x35')]){_0x4aba4e[_0xe520('0x34')]=_[_0xe520('0x36')](_0x4aba4e[_0xe520('0x34')],{'$or':_[_0xe520('0x25')](_0x52264b,function(_0x596ed1){if(_0x596ed1[_0xe520('0x29')]!==_0xe520('0x37')){var _0x43f267={};_0x43f267[_0x596ed1['name']]={'$like':'%'+_0x5bf07d[_0xe520('0x2c')][_0xe520('0x35')]+'%'};return _0x43f267;}})});}_0x4aba4e=_[_0xe520('0x36')]({},_0x4aba4e,_0x5bf07d[_0xe520('0x38')]);var _0x361f16={'where':_0x4aba4e[_0xe520('0x34')]};return db['VtigerField'][_0xe520('0x1e')](_0x361f16)[_0xe520('0x21')](function(_0x4faaab){_0x21cf45[_0xe520('0x1e')]=_0x4faaab;if(_0x5bf07d[_0xe520('0x2c')][_0xe520('0x39')]){_0x4aba4e[_0xe520('0x3a')]=[{'all':!![]}];}return db[_0xe520('0x26')]['findAll'](_0x4aba4e);})[_0xe520('0x21')](function(_0x287e0f){_0x21cf45[_0xe520('0x3b')]=_0x287e0f;return _0x21cf45;})[_0xe520('0x21')](respondWithFilteredResult(_0x48cfe7,_0x4aba4e))[_0xe520('0x3c')](handleError(_0x48cfe7,null));};exports[_0xe520('0x3d')]=function(_0x397af2,_0x43b6bf){var _0x44247a={'raw':!![],'where':{'id':_0x397af2[_0xe520('0x3e')]['id']}},_0x4ebf7d={};_0x4ebf7d[_0xe520('0x2a')]=_['keys'](db['VtigerField'][_0xe520('0x27')]);_0x4ebf7d[_0xe520('0x2c')]=_[_0xe520('0x2d')](_0x397af2[_0xe520('0x2c')]);_0x4ebf7d[_0xe520('0x2e')]=_['intersection'](_0x4ebf7d['model'],_0x4ebf7d[_0xe520('0x2c')]);_0x44247a[_0xe520('0x30')]=_[_0xe520('0x2f')](_0x4ebf7d['model'],qs[_0xe520('0x31')](_0x397af2[_0xe520('0x2c')]['fields']));_0x44247a[_0xe520('0x30')]=_0x44247a['attributes']['length']?_0x44247a[_0xe520('0x30')]:_0x4ebf7d[_0xe520('0x2a')];if(_0x397af2['query'][_0xe520('0x39')]){_0x44247a[_0xe520('0x3a')]=[{'all':!![]}];}_0x44247a=_[_0xe520('0x36')]({},_0x44247a,_0x397af2[_0xe520('0x38')]);return db[_0xe520('0x26')][_0xe520('0x3f')](_0x44247a)[_0xe520('0x21')](handleEntityNotFound(_0x43b6bf,null))[_0xe520('0x21')](respondWithResult(_0x43b6bf,null))['catch'](handleError(_0x43b6bf,null));};exports[_0xe520('0x40')]=function(_0x272e6d,_0x4ac525){return db[_0xe520('0x26')][_0xe520('0x40')](_0x272e6d['body'],{})[_0xe520('0x21')](respondWithResult(_0x4ac525,0xc9))[_0xe520('0x3c')](handleError(_0x4ac525,null));};exports[_0xe520('0x41')]=function(_0x2a3d76,_0x360819){if(_0x2a3d76[_0xe520('0x42')]['id']){delete _0x2a3d76[_0xe520('0x42')]['id'];}return db[_0xe520('0x26')][_0xe520('0x3f')]({'where':{'id':_0x2a3d76[_0xe520('0x3e')]['id']}})[_0xe520('0x21')](handleEntityNotFound(_0x360819,null))['then'](saveUpdates(_0x2a3d76['body'],null))['then'](respondWithResult(_0x360819,null))['catch'](handleError(_0x360819,null));};exports[_0xe520('0x43')]=function(_0x17c6bf,_0x24c84c){return db[_0xe520('0x26')][_0xe520('0x3f')]({'where':{'id':_0x17c6bf[_0xe520('0x3e')]['id']}})['then'](handleEntityNotFound(_0x24c84c,null))[_0xe520('0x21')](removeEntity(_0x24c84c,null))[_0xe520('0x3c')](handleError(_0x24c84c,null));};
\ No newline at end of file
+var _0x272a=['sort','filters','pick','where','merge','VIRTUAL','filter','options','findAll','params','intersection','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','fs-extra','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','map','VtigerField','rawAttributes','type','keys','query','model','fields','attributes','hasOwnProperty','nolimit','order'];(function(_0xc6d35,_0x445827){var _0x41a7cb=function(_0x2b2039){while(--_0x2b2039){_0xc6d35['push'](_0xc6d35['shift']());}};_0x41a7cb(++_0x445827);}(_0x272a,0x124));var _0xa272=function(_0x568069,_0x6e813f){_0x568069=_0x568069-0x0;var _0x99f063=_0x272a[_0x568069];return _0x99f063;};'use strict';var emlformat=require(_0xa272('0x0'));var rimraf=require(_0xa272('0x1'));var zipdir=require(_0xa272('0x2'));var jsonpatch=require(_0xa272('0x3'));var rp=require('request-promise');var moment=require(_0xa272('0x4'));var BPromise=require(_0xa272('0x5'));var Mustache=require('mustache');var util=require(_0xa272('0x6'));var path=require('path');var sox=require(_0xa272('0x7'));var csv=require(_0xa272('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa272('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa272('0xa'));var Papa=require(_0xa272('0xb'));var Redis=require(_0xa272('0xc'));var authService=require(_0xa272('0xd'));var qs=require(_0xa272('0xe'));var as=require(_0xa272('0xf'));var hardwareService=require(_0xa272('0x10'));var logger=require(_0xa272('0x11'))(_0xa272('0x12'));var utils=require(_0xa272('0x13'));var config=require(_0xa272('0x14'));var licenseUtil=require(_0xa272('0x15'));var db=require(_0xa272('0x16'))['db'];function respondWithStatusCode(_0xc14cb4,_0xf68f6e){_0xf68f6e=_0xf68f6e||0xcc;return function(_0x2a14a9){if(_0x2a14a9){return _0xc14cb4[_0xa272('0x17')](_0xf68f6e);}return _0xc14cb4[_0xa272('0x18')](_0xf68f6e)[_0xa272('0x19')]();};}function respondWithResult(_0x34afb6,_0x42863f){_0x42863f=_0x42863f||0xc8;return function(_0x4323f1){if(_0x4323f1){return _0x34afb6[_0xa272('0x18')](_0x42863f)[_0xa272('0x1a')](_0x4323f1);}};}function respondWithFilteredResult(_0x6107a3,_0x89a58a){return function(_0x1feb36){if(_0x1feb36){var _0x3e616b=typeof _0x89a58a['offset']===_0xa272('0x1b')&&typeof _0x89a58a[_0xa272('0x1c')]===_0xa272('0x1b');var _0x2f17a4=_0x1feb36[_0xa272('0x1d')];var _0x433fe3=_0x3e616b?0x0:_0x89a58a[_0xa272('0x1e')];var _0x4a1ee8=_0x3e616b?_0x1feb36[_0xa272('0x1d')]:_0x89a58a[_0xa272('0x1e')]+_0x89a58a['limit'];var _0x46fdf1;if(_0x4a1ee8>=_0x2f17a4){_0x4a1ee8=_0x2f17a4;_0x46fdf1=0xc8;}else{_0x46fdf1=0xce;}_0x6107a3[_0xa272('0x18')](_0x46fdf1);return _0x6107a3[_0xa272('0x1f')](_0xa272('0x20'),_0x433fe3+'-'+_0x4a1ee8+'/'+_0x2f17a4)[_0xa272('0x1a')](_0x1feb36);}return null;};}function patchUpdates(_0x3e1385){return function(_0x432a41){try{jsonpatch[_0xa272('0x21')](_0x432a41,_0x3e1385,!![]);}catch(_0x423094){return BPromise[_0xa272('0x22')](_0x423094);}return _0x432a41[_0xa272('0x23')]();};}function saveUpdates(_0x5b1265,_0x3dddd5){return function(_0x2ea06a){if(_0x2ea06a){return _0x2ea06a[_0xa272('0x24')](_0x5b1265)[_0xa272('0x25')](function(_0x8bfdc0){return _0x8bfdc0;});}return null;};}function removeEntity(_0x3b5e32,_0x4e2716){return function(_0x2ac675){if(_0x2ac675){return _0x2ac675[_0xa272('0x26')]()[_0xa272('0x25')](function(){_0x3b5e32[_0xa272('0x18')](0xcc)[_0xa272('0x19')]();});}};}function handleEntityNotFound(_0x32fbdd,_0x223fbd){return function(_0x1b8761){if(!_0x1b8761){_0x32fbdd[_0xa272('0x17')](0x194);}return _0x1b8761;};}function handleError(_0x39e91d,_0x35c92b){_0x35c92b=_0x35c92b||0x1f4;return function(_0x5404a1){logger['error'](_0x5404a1['stack']);if(_0x5404a1[_0xa272('0x27')]){delete _0x5404a1['name'];}_0x39e91d['status'](_0x35c92b)[_0xa272('0x28')](_0x5404a1);};}exports['index']=function(_0xe0c5bb,_0x48da9a){var _0x1d3ac2={},_0x40b578={},_0x44bf6a={'count':0x0,'rows':[]};var _0x169bac=_[_0xa272('0x29')](db[_0xa272('0x2a')][_0xa272('0x2b')],function(_0x52d574){return{'name':_0x52d574['fieldName'],'type':_0x52d574[_0xa272('0x2c')]['key']};});_0x40b578['model']=_[_0xa272('0x29')](_0x169bac,_0xa272('0x27'));_0x40b578['query']=_[_0xa272('0x2d')](_0xe0c5bb[_0xa272('0x2e')]);_0x40b578['filters']=_['intersection'](_0x40b578[_0xa272('0x2f')],_0x40b578[_0xa272('0x2e')]);_0x1d3ac2['attributes']=_['intersection'](_0x40b578[_0xa272('0x2f')],qs[_0xa272('0x30')](_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x30')]));_0x1d3ac2[_0xa272('0x31')]=_0x1d3ac2[_0xa272('0x31')]['length']?_0x1d3ac2['attributes']:_0x40b578['model'];if(!_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x32')](_0xa272('0x33'))){_0x1d3ac2[_0xa272('0x1c')]=qs[_0xa272('0x1c')](_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x1c')]);_0x1d3ac2['offset']=qs[_0xa272('0x1e')](_0xe0c5bb['query'][_0xa272('0x1e')]);}_0x1d3ac2[_0xa272('0x34')]=qs[_0xa272('0x35')](_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x35')]);_0x1d3ac2['where']=qs[_0xa272('0x36')](_[_0xa272('0x37')](_0xe0c5bb[_0xa272('0x2e')],_0x40b578['filters']),_0x169bac);if(_0xe0c5bb['query']['filter']){_0x1d3ac2[_0xa272('0x38')]=_[_0xa272('0x39')](_0x1d3ac2[_0xa272('0x38')],{'$or':_[_0xa272('0x29')](_0x169bac,function(_0xd78d22){if(_0xd78d22[_0xa272('0x2c')]!==_0xa272('0x3a')){var _0x3492bb={};_0x3492bb[_0xd78d22[_0xa272('0x27')]]={'$like':'%'+_0xe0c5bb[_0xa272('0x2e')][_0xa272('0x3b')]+'%'};return _0x3492bb;}})});}_0x1d3ac2=_[_0xa272('0x39')]({},_0x1d3ac2,_0xe0c5bb[_0xa272('0x3c')]);var _0x8fd158={'where':_0x1d3ac2['where']};return db[_0xa272('0x2a')][_0xa272('0x1d')](_0x8fd158)['then'](function(_0x13d236){_0x44bf6a['count']=_0x13d236;if(_0xe0c5bb[_0xa272('0x2e')]['includeAll']){_0x1d3ac2['include']=[{'all':!![]}];}return db[_0xa272('0x2a')][_0xa272('0x3d')](_0x1d3ac2);})[_0xa272('0x25')](function(_0x5be236){_0x44bf6a['rows']=_0x5be236;return _0x44bf6a;})[_0xa272('0x25')](respondWithFilteredResult(_0x48da9a,_0x1d3ac2))['catch'](handleError(_0x48da9a,null));};exports['show']=function(_0x5f1781,_0x484e9a){var _0x2eb03a={'raw':!![],'where':{'id':_0x5f1781[_0xa272('0x3e')]['id']}},_0x1b2fb9={};_0x1b2fb9[_0xa272('0x2f')]=_[_0xa272('0x2d')](db[_0xa272('0x2a')]['rawAttributes']);_0x1b2fb9[_0xa272('0x2e')]=_[_0xa272('0x2d')](_0x5f1781[_0xa272('0x2e')]);_0x1b2fb9[_0xa272('0x36')]=_[_0xa272('0x3f')](_0x1b2fb9[_0xa272('0x2f')],_0x1b2fb9[_0xa272('0x2e')]);_0x2eb03a[_0xa272('0x31')]=_['intersection'](_0x1b2fb9[_0xa272('0x2f')],qs[_0xa272('0x30')](_0x5f1781[_0xa272('0x2e')]['fields']));_0x2eb03a[_0xa272('0x31')]=_0x2eb03a[_0xa272('0x31')][_0xa272('0x40')]?_0x2eb03a[_0xa272('0x31')]:_0x1b2fb9[_0xa272('0x2f')];if(_0x5f1781[_0xa272('0x2e')]['includeAll']){_0x2eb03a['include']=[{'all':!![]}];}_0x2eb03a=_['merge']({},_0x2eb03a,_0x5f1781['options']);return db['VtigerField'][_0xa272('0x41')](_0x2eb03a)['then'](handleEntityNotFound(_0x484e9a,null))[_0xa272('0x25')](respondWithResult(_0x484e9a,null))[_0xa272('0x42')](handleError(_0x484e9a,null));};exports[_0xa272('0x43')]=function(_0x399ff5,_0x3ba212){return db['VtigerField'][_0xa272('0x43')](_0x399ff5[_0xa272('0x44')],{})['then'](respondWithResult(_0x3ba212,0xc9))[_0xa272('0x42')](handleError(_0x3ba212,null));};exports[_0xa272('0x24')]=function(_0x1d7375,_0x24d9c7){if(_0x1d7375[_0xa272('0x44')]['id']){delete _0x1d7375[_0xa272('0x44')]['id'];}return db[_0xa272('0x2a')][_0xa272('0x41')]({'where':{'id':_0x1d7375[_0xa272('0x3e')]['id']}})['then'](handleEntityNotFound(_0x24d9c7,null))[_0xa272('0x25')](saveUpdates(_0x1d7375['body'],null))['then'](respondWithResult(_0x24d9c7,null))[_0xa272('0x42')](handleError(_0x24d9c7,null));};exports['destroy']=function(_0x4b72d4,_0x353ed8){return db[_0xa272('0x2a')][_0xa272('0x41')]({'where':{'id':_0x4b72d4[_0xa272('0x3e')]['id']}})[_0xa272('0x25')](handleEntityNotFound(_0x353ed8,null))[_0xa272('0x25')](removeEntity(_0x353ed8,null))[_0xa272('0x42')](handleError(_0x353ed8,null));};
\ No newline at end of file
index bb8abd0..3eca4d3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e07=['vtiger_unique_index','idField','lodash','bluebird','rimraf','./intVtigerField.attributes','exports','define','int_vtiger_fields'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x0e07,0x17c));var _0x70e0=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0e07[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x70e0('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x70e0('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x70e0('0x2'));var config=require('../../config/environment');var attributes=require(_0x70e0('0x3'));module[_0x70e0('0x4')]=function(_0x3fdb4c,_0x332ba2){return _0x3fdb4c[_0x70e0('0x5')]('VtigerField',attributes,{'tableName':_0x70e0('0x6'),'paranoid':![],'indexes':[{'name':_0x70e0('0x7'),'fields':[_0x70e0('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xef04=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerField.attributes','VtigerField','int_vtiger_fields','idField','FieldId','lodash','api','moment'];(function(_0xaac579,_0x58085a){var _0x2f601f=function(_0x2212e4){while(--_0x2212e4){_0xaac579['push'](_0xaac579['shift']());}};_0x2f601f(++_0x58085a);}(_0xef04,0xe7));var _0x4ef0=function(_0x2ae9ec,_0x16daf3){_0x2ae9ec=_0x2ae9ec-0x0;var _0x1dbab7=_0xef04[_0x2ae9ec];return _0x1dbab7;};'use strict';var _=require(_0x4ef0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4ef0('0x1'));var moment=require(_0x4ef0('0x2'));var BPromise=require(_0x4ef0('0x3'));var rp=require(_0x4ef0('0x4'));var fs=require('fs');var path=require(_0x4ef0('0x5'));var rimraf=require(_0x4ef0('0x6'));var config=require(_0x4ef0('0x7'));var attributes=require(_0x4ef0('0x8'));module['exports']=function(_0x404351,_0x2fb7a3){return _0x404351['define'](_0x4ef0('0x9'),attributes,{'tableName':_0x4ef0('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x4ef0('0xb'),_0x4ef0('0xc')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 1557af3..a9b3843 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcabe=['../../config/logger','../../config/environment','jayson/promise','client','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcabe,0x1da));var _0xecab=function(_0x384cfe,_0x19caaf){_0x384cfe=_0x384cfe-0x0;var _0x198321=_0xcabe[_0x384cfe];return _0x198321;};'use strict';var _=require(_0xecab('0x0'));var util=require(_0xecab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xecab('0x2'));var fs=require('fs');var Redis=require(_0xecab('0x3'));var db=require(_0xecab('0x4'))['db'];var utils=require(_0xecab('0x5'));var logger=require(_0xecab('0x6'))('rpc');var config=require(_0xecab('0x7'));var jayson=require(_0xecab('0x8'));var client=jayson[_0xecab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e8ff9,_0x1bda82,_0xff9969){return new BPromise(function(_0x40da44,_0x12dc22){return client['request'](_0x5e8ff9,_0xff9969)['then'](function(_0x6dcf3){logger[_0xecab('0xa')](_0xecab('0xb'),_0x1bda82,_0xecab('0xc'));logger[_0xecab('0xd')](_0xecab('0xe'),_0x1bda82,_0xecab('0xc'),JSON[_0xecab('0xf')](_0x6dcf3));if(_0x6dcf3[_0xecab('0x10')]){if(_0x6dcf3['error'][_0xecab('0x11')]===0x1f4){logger[_0xecab('0x10')](_0xecab('0xb'),_0x1bda82,_0x6dcf3['error']['message']);return _0x12dc22(_0x6dcf3[_0xecab('0x10')][_0xecab('0x12')]);}logger[_0xecab('0x10')](_0xecab('0xb'),_0x1bda82,_0x6dcf3[_0xecab('0x10')][_0xecab('0x12')]);return _0x40da44(_0x6dcf3[_0xecab('0x10')]['message']);}else{logger[_0xecab('0xa')](_0xecab('0xb'),_0x1bda82,_0xecab('0xc'));_0x40da44(_0x6dcf3['result'][_0xecab('0x12')]);}})[_0xecab('0x13')](function(_0x1a35c5){logger['error'](_0xecab('0xb'),_0x1bda82,_0x1a35c5);_0x12dc22(_0x1a35c5);});});}
\ No newline at end of file
+var _0x7100=['stringify','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7100,0x13e));var _0x0710=function(_0x43d79c,_0x531a55){_0x43d79c=_0x43d79c-0x0;var _0x4866b0=_0x7100[_0x43d79c];return _0x4866b0;};'use strict';var _=require('lodash');var util=require(_0x0710('0x0'));var moment=require(_0x0710('0x1'));var BPromise=require('bluebird');var rs=require(_0x0710('0x2'));var fs=require('fs');var Redis=require(_0x0710('0x3'));var db=require(_0x0710('0x4'))['db'];var utils=require(_0x0710('0x5'));var logger=require(_0x0710('0x6'))(_0x0710('0x7'));var config=require(_0x0710('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0710('0x9')][_0x0710('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265574,_0x1b0f54,_0x424d20){return new BPromise(function(_0x2aab86,_0x39f8d2){return client[_0x0710('0xb')](_0x265574,_0x424d20)[_0x0710('0xc')](function(_0x20ee60){logger[_0x0710('0xd')](_0x0710('0xe'),_0x1b0f54,_0x0710('0xf'));logger[_0x0710('0x10')](_0x0710('0x11'),_0x1b0f54,_0x0710('0xf'),JSON[_0x0710('0x12')](_0x20ee60));if(_0x20ee60[_0x0710('0x13')]){if(_0x20ee60[_0x0710('0x13')][_0x0710('0x14')]===0x1f4){logger[_0x0710('0x13')]('VtigerField,\x20%s,\x20%s',_0x1b0f54,_0x20ee60[_0x0710('0x13')][_0x0710('0x15')]);return _0x39f8d2(_0x20ee60['error'][_0x0710('0x15')]);}logger['error'](_0x0710('0xe'),_0x1b0f54,_0x20ee60[_0x0710('0x13')][_0x0710('0x15')]);return _0x2aab86(_0x20ee60[_0x0710('0x13')]['message']);}else{logger['info'](_0x0710('0xe'),_0x1b0f54,'request\x20sent');_0x2aab86(_0x20ee60[_0x0710('0x16')][_0x0710('0x15')]);}})[_0x0710('0x17')](function(_0x666ad7){logger[_0x0710('0x13')](_0x0710('0xe'),_0x1b0f54,_0x666ad7);_0x39f8d2(_0x666ad7);});});}
\ No newline at end of file
index d59fce3..9f6ce84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0f9=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','path'];(function(_0x226c11,_0x14c0a4){var _0x4dc73e=function(_0x17e242){while(--_0x17e242){_0x226c11['push'](_0x226c11['shift']());}};_0x4dc73e(++_0x14c0a4);}(_0xc0f9,0xc5));var _0x9c0f=function(_0x22d1ef,_0x4a5152){_0x22d1ef=_0x22d1ef-0x0;var _0x47c5a3=_0xc0f9[_0x22d1ef];return _0x47c5a3;};'use strict';var multer=require(_0x9c0f('0x0'));var util=require(_0x9c0f('0x1'));var path=require(_0x9c0f('0x2'));var timeout=require(_0x9c0f('0x3'));var express=require(_0x9c0f('0x4'));var router=express[_0x9c0f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9c0f('0x6'));var interaction=require(_0x9c0f('0x7'));var config=require(_0x9c0f('0x8'));var controller=require('./intZendeskAccount.controller');router[_0x9c0f('0x9')]('/',auth[_0x9c0f('0xa')](),controller[_0x9c0f('0xb')]);router[_0x9c0f('0x9')]('/:id',auth[_0x9c0f('0xa')](),controller[_0x9c0f('0xc')]);router[_0x9c0f('0x9')](_0x9c0f('0xd'),auth['isAuthenticated'](),controller[_0x9c0f('0xe')]);router[_0x9c0f('0x9')]('/:id/fields',auth[_0x9c0f('0xa')](),controller[_0x9c0f('0xf')]);router[_0x9c0f('0x10')]('/',auth[_0x9c0f('0xa')](),controller[_0x9c0f('0x11')]);router[_0x9c0f('0x10')](_0x9c0f('0xd'),auth['isAuthenticated'](),controller[_0x9c0f('0x12')]);router[_0x9c0f('0x13')](_0x9c0f('0x14'),auth[_0x9c0f('0xa')](),controller[_0x9c0f('0x15')]);router[_0x9c0f('0x16')](_0x9c0f('0x14'),auth[_0x9c0f('0xa')](),controller[_0x9c0f('0x17')]);module[_0x9c0f('0x18')]=router;
\ No newline at end of file
+var _0xbf11=['../../components/interaction/service','../../config/environment','get','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','connect-timeout','../../components/auth/service'];(function(_0x251eed,_0x328654){var _0x13db86=function(_0x391a9c){while(--_0x391a9c){_0x251eed['push'](_0x251eed['shift']());}};_0x13db86(++_0x328654);}(_0xbf11,0x14d));var _0x1bf1=function(_0x2976de,_0x4c546d){_0x2976de=_0x2976de-0x0;var _0xecbf51=_0xbf11[_0x2976de];return _0xecbf51;};'use strict';var multer=require('multer');var util=require(_0x1bf1('0x0'));var path=require('path');var timeout=require(_0x1bf1('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1bf1('0x2'));var interaction=require(_0x1bf1('0x3'));var config=require(_0x1bf1('0x4'));var controller=require('./intZendeskAccount.controller');router[_0x1bf1('0x5')]('/',auth[_0x1bf1('0x6')](),controller['index']);router[_0x1bf1('0x5')]('/:id',auth[_0x1bf1('0x6')](),controller[_0x1bf1('0x7')]);router[_0x1bf1('0x5')](_0x1bf1('0x8'),auth['isAuthenticated'](),controller[_0x1bf1('0x9')]);router[_0x1bf1('0x5')](_0x1bf1('0xa'),auth['isAuthenticated'](),controller[_0x1bf1('0xb')]);router[_0x1bf1('0xc')]('/',auth[_0x1bf1('0x6')](),controller[_0x1bf1('0xd')]);router[_0x1bf1('0xc')](_0x1bf1('0x8'),auth[_0x1bf1('0x6')](),controller[_0x1bf1('0xe')]);router[_0x1bf1('0xf')](_0x1bf1('0x10'),auth[_0x1bf1('0x6')](),controller[_0x1bf1('0x11')]);router[_0x1bf1('0x12')]('/:id',auth[_0x1bf1('0x6')](),controller[_0x1bf1('0x13')]);module[_0x1bf1('0x14')]=router;
\ No newline at end of file
index b9e6e91..e707c7b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7919=['newTab','sequelize','exports','STRING','username','remoteUri','password','token','ENUM'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x7919,0xeb));var _0x9791=function(_0x2f6cfa,_0xd04457){_0x2f6cfa=_0x2f6cfa-0x0;var _0x4fe131=_0x7919[_0x2f6cfa];return _0x4fe131;};'use strict';var Sequelize=require(_0x9791('0x0'));module[_0x9791('0x1')]={'name':{'type':Sequelize[_0x9791('0x2')]},'description':{'type':Sequelize[_0x9791('0x2')]},'username':{'type':Sequelize[_0x9791('0x2')],'unique':_0x9791('0x3')},'password':{'type':Sequelize[_0x9791('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x9791('0x2')],'unique':_0x9791('0x4')},'authType':{'type':Sequelize['ENUM'](_0x9791('0x5'),_0x9791('0x6')),'defaultValue':_0x9791('0x5')},'serverUrl':{'type':Sequelize[_0x9791('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9791('0x7')]('integrationTab',_0x9791('0x8')),'defaultValue':'integrationTab'}};
\ No newline at end of file
+var _0x8a9a=['ENUM','password','token','integrationTab','newTab','exports','STRING','username','remoteUri'];(function(_0x1b2ef5,_0x490449){var _0x517665=function(_0x328285){while(--_0x328285){_0x1b2ef5['push'](_0x1b2ef5['shift']());}};_0x517665(++_0x490449);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x8a9a[_0x209941];return _0x1e8729;};'use strict';var Sequelize=require('sequelize');module[_0xa8a9('0x0')]={'name':{'type':Sequelize[_0xa8a9('0x1')]},'description':{'type':Sequelize[_0xa8a9('0x1')]},'username':{'type':Sequelize[_0xa8a9('0x1')],'unique':_0xa8a9('0x2')},'password':{'type':Sequelize[_0xa8a9('0x1')]},'token':{'type':Sequelize[_0xa8a9('0x1')]},'remoteUri':{'type':Sequelize[_0xa8a9('0x1')],'unique':_0xa8a9('0x3')},'authType':{'type':Sequelize[_0xa8a9('0x4')](_0xa8a9('0x5'),_0xa8a9('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0xa8a9('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xa8a9('0x7'),_0xa8a9('0x8')),'defaultValue':_0xa8a9('0x7')}};
\ No newline at end of file
index 5c0172a..99f77fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x69d3=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZendeskAccount','includeAll','include','findAll','rows','show','keys','find','catch','create','update','body','params','getConfigurations','findOne','ZendeskConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','token','remoteUri','slice','lastIndexOf','format','ticket_fields','authType','password','Basic\x20%s','%s:%s','base64','headers','%s/token:%s','toString','Unknown\x20authentication\x20type','subject','description','assignee','remove','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service'];(function(_0x48f83b,_0x1d8092){var _0x287378=function(_0x4568bc){while(--_0x4568bc){_0x48f83b['push'](_0x48f83b['shift']());}};_0x287378(++_0x1d8092);}(_0x69d3,0xda));var _0x369d=function(_0x23e17a,_0x5a89c4){_0x23e17a=_0x23e17a-0x0;var _0x9e78f5=_0x69d3[_0x23e17a];return _0x9e78f5;};'use strict';var emlformat=require(_0x369d('0x0'));var rimraf=require(_0x369d('0x1'));var zipdir=require(_0x369d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x369d('0x3'));var moment=require(_0x369d('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x369d('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x369d('0x6'));var ejs=require(_0x369d('0x7'));var fs=require('fs');var fs_extra=require(_0x369d('0x8'));var _=require(_0x369d('0x9'));var squel=require(_0x369d('0xa'));var crypto=require(_0x369d('0xb'));var jsforce=require(_0x369d('0xc'));var deskjs=require(_0x369d('0xd'));var toCsv=require(_0x369d('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x369d('0xe'));var authService=require(_0x369d('0xf'));var qs=require(_0x369d('0x10'));var as=require(_0x369d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x369d('0x12'));var utils=require(_0x369d('0x13'));var config=require(_0x369d('0x14'));var licenseUtil=require(_0x369d('0x15'));var db=require(_0x369d('0x16'))['db'];var integrations=require(_0x369d('0x17'));function respondWithStatusCode(_0x52c126,_0x15b417){_0x15b417=_0x15b417||0xcc;return function(_0x9d016){if(_0x9d016){return _0x52c126[_0x369d('0x18')](_0x15b417);}return _0x52c126[_0x369d('0x19')](_0x15b417)[_0x369d('0x1a')]();};}function respondWithResult(_0x539536,_0x5cd4c3){_0x5cd4c3=_0x5cd4c3||0xc8;return function(_0x5485a1){if(_0x5485a1){return _0x539536[_0x369d('0x19')](_0x5cd4c3)[_0x369d('0x1b')](_0x5485a1);}};}function respondWithFilteredResult(_0x389c43,_0x5b4f55){return function(_0x2c1a4a){if(_0x2c1a4a){var _0x29c1fe=typeof _0x5b4f55[_0x369d('0x1c')]==='undefined'&&typeof _0x5b4f55[_0x369d('0x1d')]===_0x369d('0x1e');var _0x4ea6c2=_0x2c1a4a['count'];var _0x597b67=_0x29c1fe?0x0:_0x5b4f55[_0x369d('0x1c')];var _0x4494b3=_0x29c1fe?_0x2c1a4a[_0x369d('0x1f')]:_0x5b4f55['offset']+_0x5b4f55[_0x369d('0x1d')];var _0x24dfff;if(_0x4494b3>=_0x4ea6c2){_0x4494b3=_0x4ea6c2;_0x24dfff=0xc8;}else{_0x24dfff=0xce;}_0x389c43[_0x369d('0x19')](_0x24dfff);return _0x389c43[_0x369d('0x20')](_0x369d('0x21'),_0x597b67+'-'+_0x4494b3+'/'+_0x4ea6c2)['json'](_0x2c1a4a);}return null;};}function patchUpdates(_0x5c9fdd){return function(_0x448e6e){try{jsonpatch[_0x369d('0x22')](_0x448e6e,_0x5c9fdd,!![]);}catch(_0x11ac1d){return BPromise[_0x369d('0x23')](_0x11ac1d);}return _0x448e6e[_0x369d('0x24')]();};}function saveUpdates(_0x15fbef,_0x1b262a){return function(_0x54a42e){if(_0x54a42e){return _0x54a42e['update'](_0x15fbef)[_0x369d('0x25')](function(_0xed16e){return _0xed16e;});}return null;};}function removeEntity(_0xf7bc3a,_0xcae58){return function(_0x30e7c5){if(_0x30e7c5){return _0x30e7c5[_0x369d('0x26')]()[_0x369d('0x25')](function(){_0xf7bc3a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16145e,_0x46de2b){return function(_0x15cd81){if(!_0x15cd81){_0x16145e[_0x369d('0x18')](0x194);}return _0x15cd81;};}function handleError(_0x8aa521,_0x41e0cf){_0x41e0cf=_0x41e0cf||0x1f4;return function(_0x8090b0){logger['error'](_0x8090b0[_0x369d('0x27')]);if(_0x8090b0[_0x369d('0x28')]){delete _0x8090b0[_0x369d('0x28')];}_0x8aa521[_0x369d('0x19')](_0x41e0cf)[_0x369d('0x29')](_0x8090b0);};}exports[_0x369d('0x2a')]=function(_0x3d1ce0,_0x4d42ea){var _0x157291={},_0x56efb1={},_0x57b94c={'count':0x0,'rows':[]};var _0x38feda=_[_0x369d('0x2b')](db['ZendeskAccount'][_0x369d('0x2c')],function(_0x5a14ce){return{'name':_0x5a14ce[_0x369d('0x2d')],'type':_0x5a14ce[_0x369d('0x2e')][_0x369d('0x2f')]};});_0x56efb1[_0x369d('0x30')]=_[_0x369d('0x2b')](_0x38feda,_0x369d('0x28'));_0x56efb1[_0x369d('0x31')]=_['keys'](_0x3d1ce0[_0x369d('0x31')]);_0x56efb1[_0x369d('0x32')]=_[_0x369d('0x33')](_0x56efb1[_0x369d('0x30')],_0x56efb1[_0x369d('0x31')]);_0x157291[_0x369d('0x34')]=_[_0x369d('0x33')](_0x56efb1[_0x369d('0x30')],qs['fields'](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x35')]));_0x157291[_0x369d('0x34')]=_0x157291[_0x369d('0x34')][_0x369d('0x36')]?_0x157291['attributes']:_0x56efb1[_0x369d('0x30')];if(!_0x3d1ce0[_0x369d('0x31')][_0x369d('0x37')](_0x369d('0x38'))){_0x157291[_0x369d('0x1d')]=qs[_0x369d('0x1d')](_0x3d1ce0['query'][_0x369d('0x1d')]);_0x157291[_0x369d('0x1c')]=qs[_0x369d('0x1c')](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x1c')]);}_0x157291[_0x369d('0x39')]=qs[_0x369d('0x3a')](_0x3d1ce0[_0x369d('0x31')][_0x369d('0x3a')]);_0x157291[_0x369d('0x3b')]=qs[_0x369d('0x32')](_[_0x369d('0x3c')](_0x3d1ce0[_0x369d('0x31')],_0x56efb1[_0x369d('0x32')]),_0x38feda);if(_0x3d1ce0[_0x369d('0x31')][_0x369d('0x3d')]){_0x157291[_0x369d('0x3b')]=_[_0x369d('0x3e')](_0x157291[_0x369d('0x3b')],{'$or':_[_0x369d('0x2b')](_0x38feda,function(_0x10c5b6){if(_0x10c5b6[_0x369d('0x2e')]!==_0x369d('0x3f')){var _0xd58366={};_0xd58366[_0x10c5b6['name']]={'$like':'%'+_0x3d1ce0['query'][_0x369d('0x3d')]+'%'};return _0xd58366;}})});}_0x157291=_[_0x369d('0x3e')]({},_0x157291,_0x3d1ce0[_0x369d('0x40')]);var _0x401bc7={'where':_0x157291[_0x369d('0x3b')]};return db[_0x369d('0x41')][_0x369d('0x1f')](_0x401bc7)[_0x369d('0x25')](function(_0x46c940){_0x57b94c['count']=_0x46c940;if(_0x3d1ce0[_0x369d('0x31')][_0x369d('0x42')]){_0x157291[_0x369d('0x43')]=[{'all':!![]}];}return db[_0x369d('0x41')][_0x369d('0x44')](_0x157291);})[_0x369d('0x25')](function(_0x28803c){_0x57b94c[_0x369d('0x45')]=_0x28803c;return _0x57b94c;})['then'](respondWithFilteredResult(_0x4d42ea,_0x157291))['catch'](handleError(_0x4d42ea,null));};exports[_0x369d('0x46')]=function(_0x3222ce,_0x30909a){var _0x4dad71={'raw':![],'where':{'id':_0x3222ce['params']['id']}},_0x4d07ac={};_0x4d07ac[_0x369d('0x30')]=_[_0x369d('0x47')](db['ZendeskAccount'][_0x369d('0x2c')]);_0x4d07ac[_0x369d('0x31')]=_[_0x369d('0x47')](_0x3222ce[_0x369d('0x31')]);_0x4d07ac['filters']=_[_0x369d('0x33')](_0x4d07ac['model'],_0x4d07ac[_0x369d('0x31')]);_0x4dad71['attributes']=_[_0x369d('0x33')](_0x4d07ac[_0x369d('0x30')],qs[_0x369d('0x35')](_0x3222ce['query']['fields']));_0x4dad71[_0x369d('0x34')]=_0x4dad71[_0x369d('0x34')][_0x369d('0x36')]?_0x4dad71['attributes']:_0x4d07ac[_0x369d('0x30')];if(_0x3222ce[_0x369d('0x31')][_0x369d('0x42')]){_0x4dad71[_0x369d('0x43')]=[{'all':!![]}];}_0x4dad71=_[_0x369d('0x3e')]({},_0x4dad71,_0x3222ce[_0x369d('0x40')]);return db[_0x369d('0x41')][_0x369d('0x48')](_0x4dad71)[_0x369d('0x25')](handleEntityNotFound(_0x30909a,null))['then'](respondWithResult(_0x30909a,null))[_0x369d('0x49')](handleError(_0x30909a,null));};exports[_0x369d('0x4a')]=function(_0xcc1465,_0x257c3d){return db[_0x369d('0x41')][_0x369d('0x4a')](_0xcc1465['body'],{})[_0x369d('0x25')](respondWithResult(_0x257c3d,0xc9))[_0x369d('0x49')](handleError(_0x257c3d,null));};exports[_0x369d('0x4b')]=function(_0x44a357,_0x1b04d9){if(_0x44a357[_0x369d('0x4c')]['id']){delete _0x44a357[_0x369d('0x4c')]['id'];}return db[_0x369d('0x41')][_0x369d('0x48')]({'where':{'id':_0x44a357[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x1b04d9,null))[_0x369d('0x25')](saveUpdates(_0x44a357['body'],null))[_0x369d('0x25')](respondWithResult(_0x1b04d9,null))[_0x369d('0x49')](handleError(_0x1b04d9,null));};exports[_0x369d('0x26')]=function(_0x85edd6,_0x648a0d){return db['ZendeskAccount'][_0x369d('0x48')]({'where':{'id':_0x85edd6['params']['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x648a0d,null))[_0x369d('0x25')](removeEntity(_0x648a0d,null))[_0x369d('0x49')](handleError(_0x648a0d,null));};exports[_0x369d('0x4e')]=function(_0x46c62c,_0x1bd31c,_0x22e2d4){var _0x418cab={};var _0x1cdeca={};var _0x9f1544;var _0x4d582a;return db['ZendeskAccount'][_0x369d('0x4f')]({'where':{'id':_0x46c62c[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x1bd31c,null))[_0x369d('0x25')](function(_0x347df4){if(_0x347df4){_0x9f1544=_0x347df4;_0x1cdeca['model']=_['keys'](db[_0x369d('0x50')][_0x369d('0x2c')]);_0x1cdeca['query']=_[_0x369d('0x47')](_0x46c62c['query']);_0x1cdeca[_0x369d('0x32')]=_[_0x369d('0x33')](_0x1cdeca[_0x369d('0x30')],_0x1cdeca['query']);_0x418cab[_0x369d('0x34')]=_[_0x369d('0x33')](_0x1cdeca[_0x369d('0x30')],qs[_0x369d('0x35')](_0x46c62c['query']['fields']));_0x418cab[_0x369d('0x34')]=_0x418cab[_0x369d('0x34')][_0x369d('0x36')]?_0x418cab['attributes']:_0x1cdeca[_0x369d('0x30')];_0x418cab[_0x369d('0x39')]=qs[_0x369d('0x3a')](_0x46c62c['query']['sort']);_0x418cab[_0x369d('0x3b')]=qs[_0x369d('0x32')](_[_0x369d('0x3c')](_0x46c62c[_0x369d('0x31')],_0x1cdeca['filters']));if(_0x46c62c[_0x369d('0x31')][_0x369d('0x3d')]){_0x418cab[_0x369d('0x3b')]=_[_0x369d('0x3e')](_0x418cab[_0x369d('0x3b')],{'$or':_['map'](_0x418cab[_0x369d('0x34')],function(_0x304a9e){var _0x28b752={};_0x28b752[_0x304a9e]={'$like':'%'+_0x46c62c['query'][_0x369d('0x3d')]+'%'};return _0x28b752;})});}_0x418cab=_['merge']({},_0x418cab,_0x46c62c[_0x369d('0x40')]);return _0x9f1544['getConfigurations'](_0x418cab);}})['then'](function(_0x5f440e){if(_0x5f440e){_0x4d582a=_0x5f440e['length'];if(!_0x46c62c[_0x369d('0x31')]['hasOwnProperty'](_0x369d('0x38'))){_0x418cab['limit']=qs[_0x369d('0x1d')](_0x46c62c[_0x369d('0x31')][_0x369d('0x1d')]);_0x418cab['offset']=qs[_0x369d('0x1c')](_0x46c62c[_0x369d('0x31')][_0x369d('0x1c')]);}return _0x9f1544[_0x369d('0x4e')](_0x418cab);}})[_0x369d('0x25')](function(_0xe63e0f){if(_0xe63e0f){return _0xe63e0f?{'count':_0x4d582a,'rows':_0xe63e0f}:null;}})['then'](respondWithResult(_0x1bd31c,null))[_0x369d('0x49')](handleError(_0x1bd31c,null));};exports['addConfiguration']=function(_0x5706be,_0x56c98e,_0x36e990){if(_0x5706be[_0x369d('0x4c')]['id']){delete _0x5706be[_0x369d('0x4c')]['id'];}return db[_0x369d('0x41')][_0x369d('0x4f')]({'where':{'id':_0x5706be[_0x369d('0x4d')]['id']}})[_0x369d('0x25')](handleEntityNotFound(_0x56c98e,null))[_0x369d('0x25')](function(_0x1c9683){if(_0x1c9683){_0x5706be[_0x369d('0x4c')][_0x369d('0x51')]=_0x1c9683['id'];_0x5706be[_0x369d('0x4c')][_0x369d('0x52')]=integrations[_0x369d('0x53')](_0x5706be[_0x369d('0x4c')][_0x369d('0x54')],_0x5706be['body'][_0x369d('0x2e')]);_0x5706be['body'][_0x369d('0x55')]=integrations[_0x369d('0x56')](_0x5706be[_0x369d('0x4c')][_0x369d('0x54')],_0x5706be[_0x369d('0x4c')]['type']);return db[_0x369d('0x50')]['create'](_0x5706be['body'],{'include':[{'model':db[_0x369d('0x57')],'as':_0x369d('0x52')},{'model':db[_0x369d('0x57')],'as':_0x369d('0x55')}]});}return null;})[_0x369d('0x25')](respondWithResult(_0x56c98e,null))[_0x369d('0x49')](handleError(_0x56c98e,null));};exports[_0x369d('0x58')]=function(_0x11ac7d,_0x55a811,_0x461782){var _0x24e70d='';return db['ZendeskAccount'][_0x369d('0x4f')]({'where':{'id':_0x11ac7d[_0x369d('0x4d')]['id']},'attributes':['id',_0x369d('0x59'),'password',_0x369d('0x5a'),'authType',_0x369d('0x5b')]})[_0x369d('0x25')](handleEntityNotFound(_0x55a811,null))[_0x369d('0x25')](function(_0x369199){if(_0x369199){_0x24e70d=_0x369199[_0x369d('0x5b')];var _0x1a9a01=_0x24e70d[_0x369d('0x5c')](-0x1);if(_0x1a9a01==='/'){_0x24e70d=_0x24e70d['substring'](0x0,_0x24e70d[_0x369d('0x5d')](_0x1a9a01));}var _0x7e8d08={'method':'GET','uri':util[_0x369d('0x5e')]('%s/%s',_0x24e70d,_0x369d('0x5f')),'json':!![]};switch(_0x369199[_0x369d('0x60')]){case _0x369d('0x61'):_0x7e8d08['headers']={'Authorization':util[_0x369d('0x5e')](_0x369d('0x62'),new Buffer(util['format'](_0x369d('0x63'),_0x369199[_0x369d('0x59')],_0x369199[_0x369d('0x61')]))['toString'](_0x369d('0x64')))};break;case _0x369d('0x5a'):_0x7e8d08[_0x369d('0x65')]={'Authorization':util[_0x369d('0x5e')](_0x369d('0x62'),new Buffer(util['format'](_0x369d('0x66'),_0x369199[_0x369d('0x59')],_0x369199[_0x369d('0x5a')]))[_0x369d('0x67')](_0x369d('0x64')))};break;default:throw new db['Sequelize']['ValidationError'](_0x369d('0x68'));}return rp(_0x7e8d08);}})[_0x369d('0x25')](function(_0x2307fc){if(_0x2307fc){var _0x11b348=[_0x369d('0x69'),_0x369d('0x6a'),'group',_0x369d('0x6b')];_[_0x369d('0x6c')](_0x2307fc['ticket_fields'],function(_0x6c8235){return _0x11b348['includes'](_0x6c8235[_0x369d('0x2e')]);});return{'count':_0x2307fc['ticket_fields'][_0x369d('0x36')],'rows':_[_0x369d('0x2b')](_0x2307fc['ticket_fields'],function(_0x4148a9){return{'id':_0x4148a9['id'],'name':_0x4148a9['position']>0x7?_0x4148a9[_0x369d('0x6d')]:_0x4148a9['type'],'custom':_0x4148a9['position']>0x7?!![]:![],'options':_0x4148a9[_0x369d('0x6e')]?_0x4148a9[_0x369d('0x6e')]:_0x4148a9[_0x369d('0x6f')]?_0x4148a9[_0x369d('0x6f')]:[]};})};}})[_0x369d('0x25')](respondWithResult(_0x55a811,null))['catch'](function(_0x28ec32){var _0xaff7cc=_0x11ac7d[_0x369d('0x31')][_0x369d('0x70')]?0x1f4:_0x28ec32[_0x369d('0x71')]||0x1f4;logger[_0x369d('0x72')](_0x369d('0x73'),_0x369d('0x58'),_0xaff7cc,JSON[_0x369d('0x74')](_0x28ec32));delete _0x28ec32['name'];if(_0xaff7cc===0x191){_0xaff7cc=0x190;}_0x55a811[_0x369d('0x19')](_0xaff7cc)[_0x369d('0x29')](_0x11ac7d[_0x369d('0x31')][_0x369d('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x28ec32[_0x369d('0x71')]}:_0x28ec32);});};
\ No newline at end of file
+var _0xed3c=['ZendeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','then','includeAll','include','findAll','rows','show','params','create','body','catch','find','getConfigurations','ZendeskConfiguration','order','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','remoteUri','slice','substring','lastIndexOf','GET','format','ticket_fields','headers','Basic\x20%s','%s:%s','base64','%s/token:%s','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','position','title','system_field_options','custom_field_options','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','name','send','index','map'];(function(_0x43d2c5,_0x119ecd){var _0x380d7d=function(_0x35c416){while(--_0x35c416){_0x43d2c5['push'](_0x43d2c5['shift']());}};_0x380d7d(++_0x119ecd);}(_0xed3c,0x1a6));var _0xced3=function(_0x282916,_0x29c453){_0x282916=_0x282916-0x0;var _0x317b39=_0xed3c[_0x282916];return _0x317b39;};'use strict';var emlformat=require(_0xced3('0x0'));var rimraf=require(_0xced3('0x1'));var zipdir=require(_0xced3('0x2'));var jsonpatch=require(_0xced3('0x3'));var rp=require('request-promise');var moment=require(_0xced3('0x4'));var BPromise=require(_0xced3('0x5'));var Mustache=require(_0xced3('0x6'));var util=require('util');var path=require('path');var sox=require(_0xced3('0x7'));var csv=require(_0xced3('0x8'));var ejs=require(_0xced3('0x9'));var fs=require('fs');var fs_extra=require(_0xced3('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xced3('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xced3('0xc'));var Redis=require(_0xced3('0xd'));var authService=require(_0xced3('0xe'));var qs=require(_0xced3('0xf'));var as=require(_0xced3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xced3('0x11'))(_0xced3('0x12'));var utils=require(_0xced3('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xced3('0x14'));var db=require(_0xced3('0x15'))['db'];var integrations=require(_0xced3('0x16'));function respondWithStatusCode(_0x3b2ac4,_0x457caf){_0x457caf=_0x457caf||0xcc;return function(_0x45d9fc){if(_0x45d9fc){return _0x3b2ac4[_0xced3('0x17')](_0x457caf);}return _0x3b2ac4['status'](_0x457caf)[_0xced3('0x18')]();};}function respondWithResult(_0x5e186e,_0xf2db6f){_0xf2db6f=_0xf2db6f||0xc8;return function(_0x435616){if(_0x435616){return _0x5e186e[_0xced3('0x19')](_0xf2db6f)[_0xced3('0x1a')](_0x435616);}};}function respondWithFilteredResult(_0x4dd4c3,_0x146a21){return function(_0x322c2d){if(_0x322c2d){var _0x4acae6=typeof _0x146a21[_0xced3('0x1b')]===_0xced3('0x1c')&&typeof _0x146a21[_0xced3('0x1d')]===_0xced3('0x1c');var _0x55dbd5=_0x322c2d[_0xced3('0x1e')];var _0x4a3afe=_0x4acae6?0x0:_0x146a21[_0xced3('0x1b')];var _0x4480a6=_0x4acae6?_0x322c2d[_0xced3('0x1e')]:_0x146a21[_0xced3('0x1b')]+_0x146a21[_0xced3('0x1d')];var _0x688c97;if(_0x4480a6>=_0x55dbd5){_0x4480a6=_0x55dbd5;_0x688c97=0xc8;}else{_0x688c97=0xce;}_0x4dd4c3[_0xced3('0x19')](_0x688c97);return _0x4dd4c3[_0xced3('0x1f')](_0xced3('0x20'),_0x4a3afe+'-'+_0x4480a6+'/'+_0x55dbd5)[_0xced3('0x1a')](_0x322c2d);}return null;};}function patchUpdates(_0x2008f2){return function(_0x59dc83){try{jsonpatch['apply'](_0x59dc83,_0x2008f2,!![]);}catch(_0x5e8c44){return BPromise[_0xced3('0x21')](_0x5e8c44);}return _0x59dc83[_0xced3('0x22')]();};}function saveUpdates(_0x21e074,_0x4bf915){return function(_0x19d15c){if(_0x19d15c){return _0x19d15c[_0xced3('0x23')](_0x21e074)['then'](function(_0x559fa2){return _0x559fa2;});}return null;};}function removeEntity(_0x3adf14,_0x101708){return function(_0x219fa8){if(_0x219fa8){return _0x219fa8[_0xced3('0x24')]()['then'](function(){_0x3adf14[_0xced3('0x19')](0xcc)[_0xced3('0x18')]();});}};}function handleEntityNotFound(_0x4fc285,_0x3fb4f9){return function(_0x4da7ce){if(!_0x4da7ce){_0x4fc285[_0xced3('0x17')](0x194);}return _0x4da7ce;};}function handleError(_0x4123ba,_0x3b728d){_0x3b728d=_0x3b728d||0x1f4;return function(_0x23a570){logger[_0xced3('0x25')](_0x23a570['stack']);if(_0x23a570['name']){delete _0x23a570[_0xced3('0x26')];}_0x4123ba['status'](_0x3b728d)[_0xced3('0x27')](_0x23a570);};}exports[_0xced3('0x28')]=function(_0x4a8e85,_0x3db664){var _0x4024fa={},_0x196956={},_0x1032d6={'count':0x0,'rows':[]};var _0x4389f8=_[_0xced3('0x29')](db[_0xced3('0x2a')][_0xced3('0x2b')],function(_0x116cc7){return{'name':_0x116cc7['fieldName'],'type':_0x116cc7[_0xced3('0x2c')][_0xced3('0x2d')]};});_0x196956[_0xced3('0x2e')]=_[_0xced3('0x29')](_0x4389f8,_0xced3('0x26'));_0x196956[_0xced3('0x2f')]=_[_0xced3('0x30')](_0x4a8e85[_0xced3('0x2f')]);_0x196956[_0xced3('0x31')]=_[_0xced3('0x32')](_0x196956[_0xced3('0x2e')],_0x196956[_0xced3('0x2f')]);_0x4024fa[_0xced3('0x33')]=_[_0xced3('0x32')](_0x196956[_0xced3('0x2e')],qs[_0xced3('0x34')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x34')]));_0x4024fa[_0xced3('0x33')]=_0x4024fa[_0xced3('0x33')][_0xced3('0x35')]?_0x4024fa['attributes']:_0x196956[_0xced3('0x2e')];if(!_0x4a8e85['query'][_0xced3('0x36')](_0xced3('0x37'))){_0x4024fa[_0xced3('0x1d')]=qs[_0xced3('0x1d')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x1d')]);_0x4024fa[_0xced3('0x1b')]=qs[_0xced3('0x1b')](_0x4a8e85[_0xced3('0x2f')][_0xced3('0x1b')]);}_0x4024fa['order']=qs[_0xced3('0x38')](_0x4a8e85[_0xced3('0x2f')]['sort']);_0x4024fa[_0xced3('0x39')]=qs[_0xced3('0x31')](_[_0xced3('0x3a')](_0x4a8e85['query'],_0x196956['filters']),_0x4389f8);if(_0x4a8e85[_0xced3('0x2f')]['filter']){_0x4024fa[_0xced3('0x39')]=_[_0xced3('0x3b')](_0x4024fa['where'],{'$or':_[_0xced3('0x29')](_0x4389f8,function(_0x15ca03){if(_0x15ca03[_0xced3('0x2c')]!=='VIRTUAL'){var _0x21c0fa={};_0x21c0fa[_0x15ca03['name']]={'$like':'%'+_0x4a8e85['query'][_0xced3('0x3c')]+'%'};return _0x21c0fa;}})});}_0x4024fa=_[_0xced3('0x3b')]({},_0x4024fa,_0x4a8e85[_0xced3('0x3d')]);var _0x4e6926={'where':_0x4024fa[_0xced3('0x39')]};return db[_0xced3('0x2a')][_0xced3('0x1e')](_0x4e6926)[_0xced3('0x3e')](function(_0x28506e){_0x1032d6[_0xced3('0x1e')]=_0x28506e;if(_0x4a8e85[_0xced3('0x2f')][_0xced3('0x3f')]){_0x4024fa[_0xced3('0x40')]=[{'all':!![]}];}return db[_0xced3('0x2a')][_0xced3('0x41')](_0x4024fa);})[_0xced3('0x3e')](function(_0x16b2c7){_0x1032d6[_0xced3('0x42')]=_0x16b2c7;return _0x1032d6;})[_0xced3('0x3e')](respondWithFilteredResult(_0x3db664,_0x4024fa))['catch'](handleError(_0x3db664,null));};exports[_0xced3('0x43')]=function(_0x2ec0ad,_0x44ff72){var _0x1a6c1f={'raw':![],'where':{'id':_0x2ec0ad[_0xced3('0x44')]['id']}},_0x1de086={};_0x1de086[_0xced3('0x2e')]=_[_0xced3('0x30')](db[_0xced3('0x2a')]['rawAttributes']);_0x1de086[_0xced3('0x2f')]=_['keys'](_0x2ec0ad[_0xced3('0x2f')]);_0x1de086[_0xced3('0x31')]=_[_0xced3('0x32')](_0x1de086['model'],_0x1de086[_0xced3('0x2f')]);_0x1a6c1f[_0xced3('0x33')]=_[_0xced3('0x32')](_0x1de086[_0xced3('0x2e')],qs['fields'](_0x2ec0ad[_0xced3('0x2f')][_0xced3('0x34')]));_0x1a6c1f[_0xced3('0x33')]=_0x1a6c1f[_0xced3('0x33')][_0xced3('0x35')]?_0x1a6c1f['attributes']:_0x1de086[_0xced3('0x2e')];if(_0x2ec0ad[_0xced3('0x2f')][_0xced3('0x3f')]){_0x1a6c1f[_0xced3('0x40')]=[{'all':!![]}];}_0x1a6c1f=_[_0xced3('0x3b')]({},_0x1a6c1f,_0x2ec0ad[_0xced3('0x3d')]);return db[_0xced3('0x2a')]['find'](_0x1a6c1f)[_0xced3('0x3e')](handleEntityNotFound(_0x44ff72,null))[_0xced3('0x3e')](respondWithResult(_0x44ff72,null))['catch'](handleError(_0x44ff72,null));};exports['create']=function(_0x140df2,_0x59b586){return db[_0xced3('0x2a')][_0xced3('0x45')](_0x140df2[_0xced3('0x46')],{})[_0xced3('0x3e')](respondWithResult(_0x59b586,0xc9))[_0xced3('0x47')](handleError(_0x59b586,null));};exports[_0xced3('0x23')]=function(_0x3700ed,_0x10cc6c){if(_0x3700ed[_0xced3('0x46')]['id']){delete _0x3700ed['body']['id'];}return db[_0xced3('0x2a')][_0xced3('0x48')]({'where':{'id':_0x3700ed[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x10cc6c,null))[_0xced3('0x3e')](saveUpdates(_0x3700ed[_0xced3('0x46')],null))['then'](respondWithResult(_0x10cc6c,null))[_0xced3('0x47')](handleError(_0x10cc6c,null));};exports[_0xced3('0x24')]=function(_0x74f70,_0x409da0){return db[_0xced3('0x2a')][_0xced3('0x48')]({'where':{'id':_0x74f70[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x409da0,null))[_0xced3('0x3e')](removeEntity(_0x409da0,null))[_0xced3('0x47')](handleError(_0x409da0,null));};exports[_0xced3('0x49')]=function(_0x3e2a19,_0x4a9111,_0x1c69df){var _0x4bd3cb={};var _0x466ffb={};var _0x27ce0b;var _0xc93e05;return db['ZendeskAccount']['findOne']({'where':{'id':_0x3e2a19[_0xced3('0x44')]['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x4a9111,null))['then'](function(_0x3f41cc){if(_0x3f41cc){_0x27ce0b=_0x3f41cc;_0x466ffb['model']=_[_0xced3('0x30')](db[_0xced3('0x4a')]['rawAttributes']);_0x466ffb[_0xced3('0x2f')]=_[_0xced3('0x30')](_0x3e2a19[_0xced3('0x2f')]);_0x466ffb['filters']=_[_0xced3('0x32')](_0x466ffb['model'],_0x466ffb[_0xced3('0x2f')]);_0x4bd3cb[_0xced3('0x33')]=_[_0xced3('0x32')](_0x466ffb[_0xced3('0x2e')],qs[_0xced3('0x34')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x34')]));_0x4bd3cb[_0xced3('0x33')]=_0x4bd3cb[_0xced3('0x33')][_0xced3('0x35')]?_0x4bd3cb[_0xced3('0x33')]:_0x466ffb['model'];_0x4bd3cb[_0xced3('0x4b')]=qs[_0xced3('0x38')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x38')]);_0x4bd3cb[_0xced3('0x39')]=qs[_0xced3('0x31')](_['pick'](_0x3e2a19[_0xced3('0x2f')],_0x466ffb[_0xced3('0x31')]));if(_0x3e2a19[_0xced3('0x2f')][_0xced3('0x3c')]){_0x4bd3cb[_0xced3('0x39')]=_[_0xced3('0x3b')](_0x4bd3cb['where'],{'$or':_[_0xced3('0x29')](_0x4bd3cb['attributes'],function(_0xc0cd87){var _0x5d9813={};_0x5d9813[_0xc0cd87]={'$like':'%'+_0x3e2a19[_0xced3('0x2f')][_0xced3('0x3c')]+'%'};return _0x5d9813;})});}_0x4bd3cb=_['merge']({},_0x4bd3cb,_0x3e2a19[_0xced3('0x3d')]);return _0x27ce0b[_0xced3('0x49')](_0x4bd3cb);}})[_0xced3('0x3e')](function(_0x3bb7d5){if(_0x3bb7d5){_0xc93e05=_0x3bb7d5[_0xced3('0x35')];if(!_0x3e2a19[_0xced3('0x2f')][_0xced3('0x36')](_0xced3('0x37'))){_0x4bd3cb[_0xced3('0x1d')]=qs[_0xced3('0x1d')](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x1d')]);_0x4bd3cb[_0xced3('0x1b')]=qs['offset'](_0x3e2a19[_0xced3('0x2f')][_0xced3('0x1b')]);}return _0x27ce0b[_0xced3('0x49')](_0x4bd3cb);}})[_0xced3('0x3e')](function(_0x4f8a3f){if(_0x4f8a3f){return _0x4f8a3f?{'count':_0xc93e05,'rows':_0x4f8a3f}:null;}})[_0xced3('0x3e')](respondWithResult(_0x4a9111,null))[_0xced3('0x47')](handleError(_0x4a9111,null));};exports[_0xced3('0x4c')]=function(_0x373f31,_0x2a62f5,_0x13643c){if(_0x373f31[_0xced3('0x46')]['id']){delete _0x373f31['body']['id'];}return db[_0xced3('0x2a')][_0xced3('0x4d')]({'where':{'id':_0x373f31['params']['id']}})[_0xced3('0x3e')](handleEntityNotFound(_0x2a62f5,null))[_0xced3('0x3e')](function(_0x3a9dac){if(_0x3a9dac){_0x373f31[_0xced3('0x46')]['AccountId']=_0x3a9dac['id'];_0x373f31[_0xced3('0x46')][_0xced3('0x4e')]=integrations[_0xced3('0x4f')](_0x373f31[_0xced3('0x46')][_0xced3('0x50')],_0x373f31[_0xced3('0x46')][_0xced3('0x2c')]);_0x373f31[_0xced3('0x46')][_0xced3('0x51')]=integrations[_0xced3('0x52')](_0x373f31['body'][_0xced3('0x50')],_0x373f31[_0xced3('0x46')]['type']);return db['ZendeskConfiguration'][_0xced3('0x45')](_0x373f31['body'],{'include':[{'model':db[_0xced3('0x53')],'as':_0xced3('0x4e')},{'model':db['ZendeskField'],'as':_0xced3('0x51')}]});}return null;})[_0xced3('0x3e')](respondWithResult(_0x2a62f5,null))['catch'](handleError(_0x2a62f5,null));};exports[_0xced3('0x54')]=function(_0x52ab35,_0x39eead,_0x58b66b){var _0xf8ccc6='';return db[_0xced3('0x2a')][_0xced3('0x4d')]({'where':{'id':_0x52ab35['params']['id']},'attributes':['id',_0xced3('0x55'),_0xced3('0x56'),_0xced3('0x57'),'authType',_0xced3('0x58')]})[_0xced3('0x3e')](handleEntityNotFound(_0x39eead,null))[_0xced3('0x3e')](function(_0x227ec5){if(_0x227ec5){_0xf8ccc6=_0x227ec5['remoteUri'];var _0x4a1624=_0xf8ccc6[_0xced3('0x59')](-0x1);if(_0x4a1624==='/'){_0xf8ccc6=_0xf8ccc6[_0xced3('0x5a')](0x0,_0xf8ccc6[_0xced3('0x5b')](_0x4a1624));}var _0xcddb37={'method':_0xced3('0x5c'),'uri':util[_0xced3('0x5d')]('%s/%s',_0xf8ccc6,_0xced3('0x5e')),'json':!![]};switch(_0x227ec5['authType']){case _0xced3('0x56'):_0xcddb37[_0xced3('0x5f')]={'Authorization':util[_0xced3('0x5d')](_0xced3('0x60'),new Buffer(util['format'](_0xced3('0x61'),_0x227ec5[_0xced3('0x55')],_0x227ec5['password']))['toString'](_0xced3('0x62')))};break;case _0xced3('0x57'):_0xcddb37[_0xced3('0x5f')]={'Authorization':util[_0xced3('0x5d')](_0xced3('0x60'),new Buffer(util['format'](_0xced3('0x63'),_0x227ec5[_0xced3('0x55')],_0x227ec5[_0xced3('0x57')]))[_0xced3('0x64')]('base64'))};break;default:throw new db[(_0xced3('0x65'))][(_0xced3('0x66'))](_0xced3('0x67'));}return rp(_0xcddb37);}})[_0xced3('0x3e')](function(_0x9183af){if(_0x9183af){var _0x275c7e=[_0xced3('0x68'),_0xced3('0x69'),_0xced3('0x6a'),_0xced3('0x6b')];_['remove'](_0x9183af[_0xced3('0x5e')],function(_0x1e7ff1){return _0x275c7e['includes'](_0x1e7ff1[_0xced3('0x2c')]);});return{'count':_0x9183af[_0xced3('0x5e')][_0xced3('0x35')],'rows':_[_0xced3('0x29')](_0x9183af[_0xced3('0x5e')],function(_0x5c2302){return{'id':_0x5c2302['id'],'name':_0x5c2302[_0xced3('0x6c')]>0x7?_0x5c2302[_0xced3('0x6d')]:_0x5c2302['type'],'custom':_0x5c2302[_0xced3('0x6c')]>0x7?!![]:![],'options':_0x5c2302[_0xced3('0x6e')]?_0x5c2302[_0xced3('0x6e')]:_0x5c2302[_0xced3('0x6f')]?_0x5c2302[_0xced3('0x6f')]:[]};})};}})[_0xced3('0x3e')](respondWithResult(_0x39eead,null))['catch'](function(_0x2d9a57){var _0x3d2547=_0x52ab35[_0xced3('0x2f')][_0xced3('0x70')]?0x1f4:_0x2d9a57[_0xced3('0x71')]||0x1f4;logger[_0xced3('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x3d2547,JSON[_0xced3('0x72')](_0x2d9a57));delete _0x2d9a57[_0xced3('0x26')];if(_0x3d2547===0x191){_0x3d2547=0x190;}_0x39eead[_0xced3('0x19')](_0x3d2547)[_0xced3('0x27')](_0x52ab35[_0xced3('0x2f')][_0xced3('0x70')]?{'message':_0xced3('0x73'),'statusCode':_0x2d9a57['statusCode']}:_0x2d9a57);});};
\ No newline at end of file
index 815f336..0d2c94f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24e9=['moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','../../config/logger','api'];(function(_0x2a7b65,_0x5f18aa){var _0x285667=function(_0x307880){while(--_0x307880){_0x2a7b65['push'](_0x2a7b65['shift']());}};_0x285667(++_0x5f18aa);}(_0x24e9,0x159));var _0x924e=function(_0x2a5099,_0x329e92){_0x2a5099=_0x2a5099-0x0;var _0x2802f1=_0x24e9[_0x2a5099];return _0x2802f1;};'use strict';var _=require(_0x924e('0x0'));var util=require('util');var logger=require(_0x924e('0x1'))(_0x924e('0x2'));var moment=require(_0x924e('0x3'));var BPromise=require(_0x924e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x924e('0x5'));var rimraf=require(_0x924e('0x6'));var config=require(_0x924e('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0x924e('0x8'));module[_0x924e('0x9')]=function(_0x566eb5,_0x369637){return _0x566eb5[_0x924e('0xa')](_0x924e('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc1e4=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x30af2b,_0x1676d6){var _0x2c5c94=function(_0x2a4c9d){while(--_0x2a4c9d){_0x30af2b['push'](_0x30af2b['shift']());}};_0x2c5c94(++_0x1676d6);}(_0xc1e4,0x17a));var _0x4c1e=function(_0x12eb0e,_0x30f40a){_0x12eb0e=_0x12eb0e-0x0;var _0x5c0b7b=_0xc1e4[_0x12eb0e];return _0x5c0b7b;};'use strict';var _=require(_0x4c1e('0x0'));var util=require('util');var logger=require(_0x4c1e('0x1'))(_0x4c1e('0x2'));var moment=require('moment');var BPromise=require(_0x4c1e('0x3'));var rp=require(_0x4c1e('0x4'));var fs=require('fs');var path=require(_0x4c1e('0x5'));var rimraf=require(_0x4c1e('0x6'));var config=require(_0x4c1e('0x7'));var attributes=require(_0x4c1e('0x8'));var integrations=require(_0x4c1e('0x9'));module[_0x4c1e('0xa')]=function(_0x5d1641,_0x1a9f85){return _0x5d1641[_0x4c1e('0xb')](_0x4c1e('0xc'),attributes,{'tableName':_0x4c1e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9dab686..e4d2c28 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd636=['request\x20sent','debug','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','include','map','model','attributes','stringify','catch','ShowZendeskAccount','find','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x37cc0d,_0x20935f){var _0x2dea4f=function(_0x5265ec){while(--_0x5265ec){_0x37cc0d['push'](_0x37cc0d['shift']());}};_0x2dea4f(++_0x20935f);}(_0xd636,0x1c1));var _0x6d63=function(_0xaf76db,_0x4eface){_0xaf76db=_0xaf76db-0x0;var _0x4176f6=_0xd636[_0xaf76db];return _0x4176f6;};'use strict';var _=require(_0x6d63('0x0'));var util=require(_0x6d63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6d63('0x2'));var fs=require('fs');var Redis=require(_0x6d63('0x3'));var db=require(_0x6d63('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d63('0x5'))(_0x6d63('0x6'));var config=require(_0x6d63('0x7'));var jayson=require(_0x6d63('0x8'));var client=jayson[_0x6d63('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44a2cd,_0x20d4a9,_0x58b69f){return new BPromise(function(_0x275bee,_0x2ee026){return client[_0x6d63('0xa')](_0x44a2cd,_0x58b69f)[_0x6d63('0xb')](function(_0x1987b5){logger[_0x6d63('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x20d4a9,_0x6d63('0xd'));logger[_0x6d63('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x20d4a9,_0x6d63('0xd'),JSON['stringify'](_0x1987b5));if(_0x1987b5['error']){if(_0x1987b5[_0x6d63('0xf')][_0x6d63('0x10')]===0x1f4){logger[_0x6d63('0xf')](_0x6d63('0x11'),_0x20d4a9,_0x1987b5['error'][_0x6d63('0x12')]);return _0x2ee026(_0x1987b5[_0x6d63('0xf')][_0x6d63('0x12')]);}logger[_0x6d63('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x20d4a9,_0x1987b5[_0x6d63('0xf')]['message']);return _0x275bee(_0x1987b5['error'][_0x6d63('0x12')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x20d4a9,_0x6d63('0xd'));_0x275bee(_0x1987b5[_0x6d63('0x13')][_0x6d63('0x12')]);}})['catch'](function(_0xb4a9cb){logger[_0x6d63('0xf')]('ZendeskAccount,\x20%s,\x20%s',_0x20d4a9,_0xb4a9cb);_0x2ee026(_0xb4a9cb);});});}exports[_0x6d63('0x14')]=function(_0x2c18e9){var _0x3b5366=this;return new Promise(function(_0x43402b,_0x332400){return db[_0x6d63('0x15')][_0x6d63('0x16')]({'raw':_0x2c18e9[_0x6d63('0x17')]?_0x2c18e9['options'][_0x6d63('0x18')]===undefined?!![]:![]:!![],'where':_0x2c18e9[_0x6d63('0x17')]?_0x2c18e9['options']['where']||null:null,'attributes':_0x2c18e9['options']?_0x2c18e9[_0x6d63('0x17')]['attributes']||null:null,'limit':_0x2c18e9[_0x6d63('0x17')]?_0x2c18e9[_0x6d63('0x17')]['limit']||null:null,'include':_0x2c18e9[_0x6d63('0x17')]?_0x2c18e9[_0x6d63('0x17')][_0x6d63('0x19')]?_[_0x6d63('0x1a')](_0x2c18e9[_0x6d63('0x17')]['include'],function(_0x4cdab6){return{'model':db[_0x4cdab6[_0x6d63('0x1b')]],'as':_0x4cdab6['as'],'attributes':_0x4cdab6[_0x6d63('0x1c')],'include':_0x4cdab6[_0x6d63('0x19')]?_[_0x6d63('0x1a')](_0x4cdab6[_0x6d63('0x19')],function(_0x136bce){return{'model':db[_0x136bce[_0x6d63('0x1b')]],'as':_0x136bce['as'],'attributes':_0x136bce[_0x6d63('0x1c')],'include':_0x136bce['include']?_[_0x6d63('0x1a')](_0x136bce['include'],function(_0x3effa1){return{'model':db[_0x3effa1[_0x6d63('0x1b')]],'as':_0x3effa1['as'],'attributes':_0x3effa1['attributes']};}):[]};}):[]};}):[]:[]})[_0x6d63('0xb')](function(_0x1f9e46){logger[_0x6d63('0xc')](_0x6d63('0x14'),_0x2c18e9);logger['debug']('GetZendeskAccount',_0x2c18e9,JSON[_0x6d63('0x1d')](_0x1f9e46));_0x43402b(_0x1f9e46);})[_0x6d63('0x1e')](function(_0x3b0d6f){logger[_0x6d63('0xf')](_0x6d63('0x14'),_0x3b0d6f[_0x6d63('0x12')],_0x2c18e9);_0x332400(_0x3b5366[_0x6d63('0xf')](0x1f4,_0x3b0d6f[_0x6d63('0x12')]));});});};exports[_0x6d63('0x1f')]=function(_0x2583ef){var _0x1b189b=this;return new Promise(function(_0x5669c3,_0x1f713d){return db[_0x6d63('0x15')][_0x6d63('0x20')]({'raw':_0x2583ef[_0x6d63('0x17')]?_0x2583ef['options'][_0x6d63('0x18')]===undefined?!![]:![]:!![],'where':_0x2583ef[_0x6d63('0x17')]?_0x2583ef[_0x6d63('0x17')]['where']||null:null,'attributes':_0x2583ef[_0x6d63('0x17')]?_0x2583ef[_0x6d63('0x17')][_0x6d63('0x1c')]||null:null,'include':_0x2583ef[_0x6d63('0x17')]?_0x2583ef['options'][_0x6d63('0x19')]?_[_0x6d63('0x1a')](_0x2583ef[_0x6d63('0x17')][_0x6d63('0x19')],function(_0x83037b){return{'model':db[_0x83037b[_0x6d63('0x1b')]],'as':_0x83037b['as'],'attributes':_0x83037b[_0x6d63('0x1c')],'include':_0x83037b['include']?_[_0x6d63('0x1a')](_0x83037b[_0x6d63('0x19')],function(_0x3842ee){return{'model':db[_0x3842ee[_0x6d63('0x1b')]],'as':_0x3842ee['as'],'attributes':_0x3842ee[_0x6d63('0x1c')],'include':_0x3842ee[_0x6d63('0x19')]?_[_0x6d63('0x1a')](_0x3842ee[_0x6d63('0x19')],function(_0x59008d){return{'model':db[_0x59008d[_0x6d63('0x1b')]],'as':_0x59008d['as'],'attributes':_0x59008d[_0x6d63('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6d63('0xb')](function(_0x278659){logger[_0x6d63('0xc')](_0x6d63('0x1f'),_0x2583ef);logger[_0x6d63('0xe')](_0x6d63('0x1f'),_0x2583ef,JSON[_0x6d63('0x1d')](_0x278659));_0x5669c3(_0x278659);})['catch'](function(_0x3c32ae){logger['error'](_0x6d63('0x1f'),_0x3c32ae[_0x6d63('0x12')],_0x2583ef);_0x1f713d(_0x1b189b['error'](0x1f4,_0x3c32ae['message']));});});};
\ No newline at end of file
+var _0x3725=['where','attributes','limit','include','map','model','ShowZendeskAccount','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options'];(function(_0x4bd950,_0x184ed5){var _0x5dc59a=function(_0x6ff30f){while(--_0x6ff30f){_0x4bd950['push'](_0x4bd950['shift']());}};_0x5dc59a(++_0x184ed5);}(_0x3725,0xc1));var _0x5372=function(_0x1994dd,_0x5cf6e7){_0x1994dd=_0x1994dd-0x0;var _0x7cc9bc=_0x3725[_0x1994dd];return _0x7cc9bc;};'use strict';var _=require(_0x5372('0x0'));var util=require(_0x5372('0x1'));var moment=require(_0x5372('0x2'));var BPromise=require(_0x5372('0x3'));var rs=require(_0x5372('0x4'));var fs=require('fs');var Redis=require(_0x5372('0x5'));var db=require(_0x5372('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5372('0x7'));var config=require(_0x5372('0x8'));var jayson=require(_0x5372('0x9'));var client=jayson[_0x5372('0xa')][_0x5372('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xf922f,_0x25ec57,_0x393fca){return new BPromise(function(_0x30c9cd,_0xadd416){return client[_0x5372('0xc')](_0xf922f,_0x393fca)[_0x5372('0xd')](function(_0x44ab92){logger[_0x5372('0xe')]('ZendeskAccount,\x20%s,\x20%s',_0x25ec57,_0x5372('0xf'));logger[_0x5372('0x10')](_0x5372('0x11'),_0x25ec57,'request\x20sent',JSON[_0x5372('0x12')](_0x44ab92));if(_0x44ab92[_0x5372('0x13')]){if(_0x44ab92[_0x5372('0x13')][_0x5372('0x14')]===0x1f4){logger[_0x5372('0x13')](_0x5372('0x15'),_0x25ec57,_0x44ab92[_0x5372('0x13')][_0x5372('0x16')]);return _0xadd416(_0x44ab92[_0x5372('0x13')][_0x5372('0x16')]);}logger[_0x5372('0x13')](_0x5372('0x15'),_0x25ec57,_0x44ab92[_0x5372('0x13')][_0x5372('0x16')]);return _0x30c9cd(_0x44ab92[_0x5372('0x13')]['message']);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x25ec57,'request\x20sent');_0x30c9cd(_0x44ab92[_0x5372('0x17')][_0x5372('0x16')]);}})[_0x5372('0x18')](function(_0x5632d1){logger[_0x5372('0x13')](_0x5372('0x15'),_0x25ec57,_0x5632d1);_0xadd416(_0x5632d1);});});}exports[_0x5372('0x19')]=function(_0x6b67b3){var _0x4bdcfa=this;return new Promise(function(_0x5390f3,_0x4970e6){return db[_0x5372('0x1a')][_0x5372('0x1b')]({'raw':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3[_0x5372('0x1c')][_0x5372('0x1d')]||null:null,'attributes':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3[_0x5372('0x1c')][_0x5372('0x1e')]||null:null,'limit':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3['options'][_0x5372('0x1f')]||null:null,'include':_0x6b67b3[_0x5372('0x1c')]?_0x6b67b3[_0x5372('0x1c')][_0x5372('0x20')]?_[_0x5372('0x21')](_0x6b67b3[_0x5372('0x1c')][_0x5372('0x20')],function(_0x3553ae){return{'model':db[_0x3553ae[_0x5372('0x22')]],'as':_0x3553ae['as'],'attributes':_0x3553ae[_0x5372('0x1e')],'include':_0x3553ae['include']?_[_0x5372('0x21')](_0x3553ae[_0x5372('0x20')],function(_0x2413da){return{'model':db[_0x2413da[_0x5372('0x22')]],'as':_0x2413da['as'],'attributes':_0x2413da[_0x5372('0x1e')],'include':_0x2413da[_0x5372('0x20')]?_['map'](_0x2413da[_0x5372('0x20')],function(_0x11e57d){return{'model':db[_0x11e57d['model']],'as':_0x11e57d['as'],'attributes':_0x11e57d[_0x5372('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c1ae7){logger[_0x5372('0xe')]('GetZendeskAccount',_0x6b67b3);logger[_0x5372('0x10')](_0x5372('0x19'),_0x6b67b3,JSON[_0x5372('0x12')](_0x3c1ae7));_0x5390f3(_0x3c1ae7);})[_0x5372('0x18')](function(_0x3309a7){logger['error'](_0x5372('0x19'),_0x3309a7[_0x5372('0x16')],_0x6b67b3);_0x4970e6(_0x4bdcfa[_0x5372('0x13')](0x1f4,_0x3309a7[_0x5372('0x16')]));});});};exports[_0x5372('0x23')]=function(_0x44d4d0){var _0x434a91=this;return new Promise(function(_0x59c032,_0x54e6b7){return db[_0x5372('0x1a')]['find']({'raw':_0x44d4d0[_0x5372('0x1c')]?_0x44d4d0[_0x5372('0x1c')][_0x5372('0x24')]===undefined?!![]:![]:!![],'where':_0x44d4d0['options']?_0x44d4d0['options'][_0x5372('0x1d')]||null:null,'attributes':_0x44d4d0[_0x5372('0x1c')]?_0x44d4d0[_0x5372('0x1c')][_0x5372('0x1e')]||null:null,'include':_0x44d4d0[_0x5372('0x1c')]?_0x44d4d0[_0x5372('0x1c')]['include']?_[_0x5372('0x21')](_0x44d4d0['options'][_0x5372('0x20')],function(_0xab51ef){return{'model':db[_0xab51ef['model']],'as':_0xab51ef['as'],'attributes':_0xab51ef[_0x5372('0x1e')],'include':_0xab51ef[_0x5372('0x20')]?_[_0x5372('0x21')](_0xab51ef[_0x5372('0x20')],function(_0x18adfe){return{'model':db[_0x18adfe[_0x5372('0x22')]],'as':_0x18adfe['as'],'attributes':_0x18adfe[_0x5372('0x1e')],'include':_0x18adfe[_0x5372('0x20')]?_[_0x5372('0x21')](_0x18adfe['include'],function(_0x5a6801){return{'model':db[_0x5a6801[_0x5372('0x22')]],'as':_0x5a6801['as'],'attributes':_0x5a6801['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xadec0){logger[_0x5372('0xe')](_0x5372('0x23'),_0x44d4d0);logger[_0x5372('0x10')](_0x5372('0x23'),_0x44d4d0,JSON['stringify'](_0xadec0));_0x59c032(_0xadec0);})['catch'](function(_0x5b1e66){logger[_0x5372('0x13')](_0x5372('0x23'),_0x5b1e66[_0x5372('0x16')],_0x44d4d0);_0x54e6b7(_0x434a91['error'](0x1f4,_0x5b1e66[_0x5372('0x16')]));});});};
\ No newline at end of file
index 1218fe2..9cd26e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea28=['Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x49481d,_0xd95b74){var _0x27dd6e=function(_0xee3740){while(--_0xee3740){_0x49481d['push'](_0x49481d['shift']());}};_0x27dd6e(++_0xd95b74);}(_0xea28,0x13a));var _0x8ea2=function(_0x1f8d49,_0x2eea94){_0x1f8d49=_0x1f8d49-0x0;var _0x527381=_0xea28[_0x1f8d49];return _0x527381;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require(_0x8ea2('0x3'));var express=require(_0x8ea2('0x4'));var router=express[_0x8ea2('0x5')]();var fs_extra=require(_0x8ea2('0x6'));var auth=require(_0x8ea2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8ea2('0x8'));var controller=require(_0x8ea2('0x9'));router[_0x8ea2('0xa')]('/',auth['isAuthenticated'](),controller[_0x8ea2('0xb')]);router[_0x8ea2('0xa')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xa')](_0x8ea2('0xf'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0xa')](_0x8ea2('0x11'),auth[_0x8ea2('0xd')](),controller['getSubjects']);router['get'](_0x8ea2('0x12'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x13')]);router['get'](_0x8ea2('0x14'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x15')]);router[_0x8ea2('0x16')]('/',auth[_0x8ea2('0xd')](),controller['create']);router[_0x8ea2('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8ea2('0x17')]);router[_0x8ea2('0x18')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x19')]);router[_0x8ea2('0x1a')](_0x8ea2('0xc'),auth[_0x8ea2('0xd')](),controller[_0x8ea2('0x1b')]);module[_0x8ea2('0x1c')]=router;
\ No newline at end of file
+var _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x2dc87f,_0x559c7f){var _0x3282fe=function(_0x1ec9c5){while(--_0x1ec9c5){_0x2dc87f['push'](_0x2dc87f['shift']());}};_0x3282fe(++_0x559c7f);}(_0x4fc2,0x111));var _0x24fc=function(_0x23d927,_0x2102d1){_0x23d927=_0x23d927-0x0;var _0x1ba1b9=_0x4fc2[_0x23d927];return _0x1ba1b9;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router;
\ No newline at end of file
index 93bafc6..06eacac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96f1=['exports','STRING','sequelize'];(function(_0x36488b,_0xcdbf7d){var _0x3370ba=function(_0x1c12fc){while(--_0x1c12fc){_0x36488b['push'](_0x36488b['shift']());}};_0x3370ba(++_0xcdbf7d);}(_0x96f1,0x101));var _0x196f=function(_0x541f24,_0x442a24){_0x541f24=_0x541f24-0x0;var _0x41aee2=_0x96f1[_0x541f24];return _0x41aee2;};'use strict';var Sequelize=require(_0x196f('0x0'));module[_0x196f('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x196f('0x2')]}};
\ No newline at end of file
+var _0xb5fe=['STRING','exports'];(function(_0x47690d,_0x5cc6d8){var _0x3d199e=function(_0x241741){while(--_0x241741){_0x47690d['push'](_0x47690d['shift']());}};_0x3d199e(++_0x5cc6d8);}(_0xb5fe,0x1df));var _0xeb5f=function(_0x38b948,_0x392056){_0x38b948=_0x38b948-0x0;var _0x373000=_0xb5fe[_0x38b948];return _0x373000;};'use strict';var Sequelize=require('sequelize');module[_0xeb5f('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xeb5f('0x1')]}};
\ No newline at end of file
index 2407e5e..fa4ebf6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa043=['name','index','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','include','findAll','rows','catch','params','options','find','create','body','findOne','ZendeskField','order','getFields','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0xcf0946,_0x25d6d5){var _0x3de8c0=function(_0xa1a592){while(--_0xa1a592){_0xcf0946['push'](_0xcf0946['shift']());}};_0x3de8c0(++_0x25d6d5);}(_0xa043,0x7f));var _0x3a04=function(_0x5bca27,_0x3d4898){_0x5bca27=_0x5bca27-0x0;var _0xb3ce67=_0xa043[_0x5bca27];return _0xb3ce67;};'use strict';var emlformat=require(_0x3a04('0x0'));var rimraf=require(_0x3a04('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a04('0x2'));var rp=require('request-promise');var moment=require(_0x3a04('0x3'));var BPromise=require(_0x3a04('0x4'));var Mustache=require(_0x3a04('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3a04('0x6'));var ejs=require(_0x3a04('0x7'));var fs=require('fs');var fs_extra=require(_0x3a04('0x8'));var _=require(_0x3a04('0x9'));var squel=require(_0x3a04('0xa'));var crypto=require('crypto');var jsforce=require(_0x3a04('0xb'));var deskjs=require(_0x3a04('0xc'));var toCsv=require(_0x3a04('0x6'));var querystring=require(_0x3a04('0xd'));var Papa=require(_0x3a04('0xe'));var Redis=require(_0x3a04('0xf'));var authService=require(_0x3a04('0x10'));var qs=require(_0x3a04('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3a04('0x12'));var logger=require(_0x3a04('0x13'))(_0x3a04('0x14'));var utils=require(_0x3a04('0x15'));var config=require(_0x3a04('0x16'));var licenseUtil=require(_0x3a04('0x17'));var db=require(_0x3a04('0x18'))['db'];function respondWithStatusCode(_0x4d2d4e,_0xf95731){_0xf95731=_0xf95731||0xcc;return function(_0x152a59){if(_0x152a59){return _0x4d2d4e[_0x3a04('0x19')](_0xf95731);}return _0x4d2d4e[_0x3a04('0x1a')](_0xf95731)[_0x3a04('0x1b')]();};}function respondWithResult(_0xed5df2,_0x1c2d37){_0x1c2d37=_0x1c2d37||0xc8;return function(_0x20979d){if(_0x20979d){return _0xed5df2[_0x3a04('0x1a')](_0x1c2d37)[_0x3a04('0x1c')](_0x20979d);}};}function respondWithFilteredResult(_0x1a684b,_0x42d432){return function(_0x152e3f){if(_0x152e3f){var _0x5ab9e8=typeof _0x42d432[_0x3a04('0x1d')]===_0x3a04('0x1e')&&typeof _0x42d432[_0x3a04('0x1f')]===_0x3a04('0x1e');var _0x1e5274=_0x152e3f[_0x3a04('0x20')];var _0xaa8f45=_0x5ab9e8?0x0:_0x42d432[_0x3a04('0x1d')];var _0x4377af=_0x5ab9e8?_0x152e3f[_0x3a04('0x20')]:_0x42d432[_0x3a04('0x1d')]+_0x42d432['limit'];var _0x5bfdb6;if(_0x4377af>=_0x1e5274){_0x4377af=_0x1e5274;_0x5bfdb6=0xc8;}else{_0x5bfdb6=0xce;}_0x1a684b['status'](_0x5bfdb6);return _0x1a684b['set'](_0x3a04('0x21'),_0xaa8f45+'-'+_0x4377af+'/'+_0x1e5274)[_0x3a04('0x1c')](_0x152e3f);}return null;};}function patchUpdates(_0x1a937d){return function(_0x17eff9){try{jsonpatch[_0x3a04('0x22')](_0x17eff9,_0x1a937d,!![]);}catch(_0x18b053){return BPromise[_0x3a04('0x23')](_0x18b053);}return _0x17eff9[_0x3a04('0x24')]();};}function saveUpdates(_0x51be6c,_0x7f33c1){return function(_0x74ca51){if(_0x74ca51){return _0x74ca51['update'](_0x51be6c)[_0x3a04('0x25')](function(_0x3eabbd){return _0x3eabbd;});}return null;};}function removeEntity(_0x9c54c5,_0x1c14ae){return function(_0x3da32f){if(_0x3da32f){return _0x3da32f[_0x3a04('0x26')]()[_0x3a04('0x25')](function(){_0x9c54c5[_0x3a04('0x1a')](0xcc)[_0x3a04('0x1b')]();});}};}function handleEntityNotFound(_0x5d6ff9,_0x37adee){return function(_0x37ea03){if(!_0x37ea03){_0x5d6ff9[_0x3a04('0x19')](0x194);}return _0x37ea03;};}function handleError(_0x5a6376,_0x5be5ba){_0x5be5ba=_0x5be5ba||0x1f4;return function(_0x3bbf15){logger[_0x3a04('0x27')](_0x3bbf15[_0x3a04('0x28')]);if(_0x3bbf15[_0x3a04('0x29')]){delete _0x3bbf15[_0x3a04('0x29')];}_0x5a6376[_0x3a04('0x1a')](_0x5be5ba)['send'](_0x3bbf15);};}exports[_0x3a04('0x2a')]=function(_0xd09e0d,_0x4ec891){var _0x15f058={},_0x35d464={},_0x55a997={'count':0x0,'rows':[]};var _0x4a8dfc=_['map'](db[_0x3a04('0x2b')][_0x3a04('0x2c')],function(_0x2fbd6b){return{'name':_0x2fbd6b[_0x3a04('0x2d')],'type':_0x2fbd6b[_0x3a04('0x2e')][_0x3a04('0x2f')]};});_0x35d464[_0x3a04('0x30')]=_[_0x3a04('0x31')](_0x4a8dfc,_0x3a04('0x29'));_0x35d464[_0x3a04('0x32')]=_[_0x3a04('0x33')](_0xd09e0d[_0x3a04('0x32')]);_0x35d464[_0x3a04('0x34')]=_[_0x3a04('0x35')](_0x35d464['model'],_0x35d464[_0x3a04('0x32')]);_0x15f058['attributes']=_['intersection'](_0x35d464[_0x3a04('0x30')],qs[_0x3a04('0x36')](_0xd09e0d['query'][_0x3a04('0x36')]));_0x15f058[_0x3a04('0x37')]=_0x15f058['attributes'][_0x3a04('0x38')]?_0x15f058[_0x3a04('0x37')]:_0x35d464[_0x3a04('0x30')];if(!_0xd09e0d[_0x3a04('0x32')][_0x3a04('0x39')](_0x3a04('0x3a'))){_0x15f058[_0x3a04('0x1f')]=qs[_0x3a04('0x1f')](_0xd09e0d[_0x3a04('0x32')][_0x3a04('0x1f')]);_0x15f058[_0x3a04('0x1d')]=qs['offset'](_0xd09e0d[_0x3a04('0x32')]['offset']);}_0x15f058['order']=qs[_0x3a04('0x3b')](_0xd09e0d['query'][_0x3a04('0x3b')]);_0x15f058[_0x3a04('0x3c')]=qs[_0x3a04('0x34')](_[_0x3a04('0x3d')](_0xd09e0d[_0x3a04('0x32')],_0x35d464[_0x3a04('0x34')]),_0x4a8dfc);if(_0xd09e0d[_0x3a04('0x32')]['filter']){_0x15f058[_0x3a04('0x3c')]=_[_0x3a04('0x3e')](_0x15f058['where'],{'$or':_[_0x3a04('0x31')](_0x4a8dfc,function(_0x2f5f0a){if(_0x2f5f0a[_0x3a04('0x2e')]!==_0x3a04('0x3f')){var _0x3ed91c={};_0x3ed91c[_0x2f5f0a[_0x3a04('0x29')]]={'$like':'%'+_0xd09e0d[_0x3a04('0x32')][_0x3a04('0x40')]+'%'};return _0x3ed91c;}})});}_0x15f058=_[_0x3a04('0x3e')]({},_0x15f058,_0xd09e0d['options']);var _0xe5349f={'where':_0x15f058['where']};return db['ZendeskConfiguration'][_0x3a04('0x20')](_0xe5349f)['then'](function(_0x1ef31d){_0x55a997[_0x3a04('0x20')]=_0x1ef31d;if(_0xd09e0d[_0x3a04('0x32')]['includeAll']){_0x15f058[_0x3a04('0x41')]=[{'all':!![]}];}return db[_0x3a04('0x2b')][_0x3a04('0x42')](_0x15f058);})[_0x3a04('0x25')](function(_0x33203d){_0x55a997[_0x3a04('0x43')]=_0x33203d;return _0x55a997;})[_0x3a04('0x25')](respondWithFilteredResult(_0x4ec891,_0x15f058))[_0x3a04('0x44')](handleError(_0x4ec891,null));};exports['show']=function(_0x265f4b,_0x97488d){var _0x189f26={'raw':![],'where':{'id':_0x265f4b[_0x3a04('0x45')]['id']}},_0xb55585={};_0xb55585[_0x3a04('0x30')]=_[_0x3a04('0x33')](db['ZendeskConfiguration']['rawAttributes']);_0xb55585[_0x3a04('0x32')]=_[_0x3a04('0x33')](_0x265f4b[_0x3a04('0x32')]);_0xb55585[_0x3a04('0x34')]=_[_0x3a04('0x35')](_0xb55585['model'],_0xb55585[_0x3a04('0x32')]);_0x189f26[_0x3a04('0x37')]=_['intersection'](_0xb55585[_0x3a04('0x30')],qs[_0x3a04('0x36')](_0x265f4b['query'][_0x3a04('0x36')]));_0x189f26['attributes']=_0x189f26['attributes'][_0x3a04('0x38')]?_0x189f26[_0x3a04('0x37')]:_0xb55585[_0x3a04('0x30')];if(_0x265f4b[_0x3a04('0x32')]['includeAll']){_0x189f26[_0x3a04('0x41')]=[{'all':!![]}];}_0x189f26=_[_0x3a04('0x3e')]({},_0x189f26,_0x265f4b[_0x3a04('0x46')]);return db[_0x3a04('0x2b')][_0x3a04('0x47')](_0x189f26)[_0x3a04('0x25')](handleEntityNotFound(_0x97488d,null))[_0x3a04('0x25')](respondWithResult(_0x97488d,null))['catch'](handleError(_0x97488d,null));};exports[_0x3a04('0x48')]=function(_0x33d281,_0x41d2c3){return db[_0x3a04('0x2b')][_0x3a04('0x48')](_0x33d281[_0x3a04('0x49')],{})[_0x3a04('0x25')](respondWithResult(_0x41d2c3,0xc9))['catch'](handleError(_0x41d2c3,null));};exports['update']=function(_0x5e5d85,_0xe73488){if(_0x5e5d85['body']['id']){delete _0x5e5d85['body']['id'];}return db[_0x3a04('0x2b')][_0x3a04('0x47')]({'where':{'id':_0x5e5d85[_0x3a04('0x45')]['id']}})[_0x3a04('0x25')](handleEntityNotFound(_0xe73488,null))[_0x3a04('0x25')](saveUpdates(_0x5e5d85[_0x3a04('0x49')],null))[_0x3a04('0x25')](respondWithResult(_0xe73488,null))[_0x3a04('0x44')](handleError(_0xe73488,null));};exports[_0x3a04('0x26')]=function(_0x288952,_0x2d2661){return db[_0x3a04('0x2b')][_0x3a04('0x47')]({'where':{'id':_0x288952[_0x3a04('0x45')]['id']}})[_0x3a04('0x25')](handleEntityNotFound(_0x2d2661,null))['then'](removeEntity(_0x2d2661,null))[_0x3a04('0x44')](handleError(_0x2d2661,null));};exports['getFields']=function(_0x5dbe17,_0x1ebf23,_0x3b72d6){var _0x2f87d2={};var _0x8dc0f5={};var _0x2b7068;var _0x32b04a;return db['ZendeskConfiguration'][_0x3a04('0x4a')]({'where':{'id':_0x5dbe17['params']['id']}})['then'](handleEntityNotFound(_0x1ebf23,null))['then'](function(_0x1a820a){if(_0x1a820a){_0x2b7068=_0x1a820a;_0x8dc0f5[_0x3a04('0x30')]=_[_0x3a04('0x33')](db[_0x3a04('0x4b')][_0x3a04('0x2c')]);_0x8dc0f5[_0x3a04('0x32')]=_['keys'](_0x5dbe17['query']);_0x8dc0f5[_0x3a04('0x34')]=_[_0x3a04('0x35')](_0x8dc0f5[_0x3a04('0x30')],_0x8dc0f5[_0x3a04('0x32')]);_0x2f87d2[_0x3a04('0x37')]=_[_0x3a04('0x35')](_0x8dc0f5[_0x3a04('0x30')],qs[_0x3a04('0x36')](_0x5dbe17[_0x3a04('0x32')][_0x3a04('0x36')]));_0x2f87d2[_0x3a04('0x37')]=_0x2f87d2['attributes'][_0x3a04('0x38')]?_0x2f87d2[_0x3a04('0x37')]:_0x8dc0f5[_0x3a04('0x30')];_0x2f87d2[_0x3a04('0x4c')]=qs[_0x3a04('0x3b')](_0x5dbe17[_0x3a04('0x32')][_0x3a04('0x3b')]);_0x2f87d2[_0x3a04('0x3c')]=qs[_0x3a04('0x34')](_[_0x3a04('0x3d')](_0x5dbe17['query'],_0x8dc0f5[_0x3a04('0x34')]));if(_0x5dbe17['query'][_0x3a04('0x40')]){_0x2f87d2['where']=_['merge'](_0x2f87d2[_0x3a04('0x3c')],{'$or':_[_0x3a04('0x31')](_0x2f87d2[_0x3a04('0x37')],function(_0x1d9b4c){var _0x3b8fa5={};_0x3b8fa5[_0x1d9b4c]={'$like':'%'+_0x5dbe17['query']['filter']+'%'};return _0x3b8fa5;})});}_0x2f87d2=_[_0x3a04('0x3e')]({},_0x2f87d2,_0x5dbe17[_0x3a04('0x46')]);return _0x2b7068['getFields'](_0x2f87d2);}})['then'](function(_0x371caa){if(_0x371caa){_0x32b04a=_0x371caa[_0x3a04('0x38')];if(!_0x5dbe17[_0x3a04('0x32')]['hasOwnProperty'](_0x3a04('0x3a'))){_0x2f87d2[_0x3a04('0x1f')]=qs['limit'](_0x5dbe17[_0x3a04('0x32')]['limit']);_0x2f87d2[_0x3a04('0x1d')]=qs[_0x3a04('0x1d')](_0x5dbe17[_0x3a04('0x32')][_0x3a04('0x1d')]);}return _0x2b7068[_0x3a04('0x4d')](_0x2f87d2);}})['then'](function(_0x1d992a){if(_0x1d992a){return _0x1d992a?{'count':_0x32b04a,'rows':_0x1d992a}:null;}})[_0x3a04('0x25')](respondWithResult(_0x1ebf23,null))['catch'](handleError(_0x1ebf23,null));};exports[_0x3a04('0x4e')]=function(_0x50bb7e,_0x112146,_0x55d988){var _0x2ed831={};var _0x5dfbde={};var _0x186e72;var _0x93d66a;return db[_0x3a04('0x2b')][_0x3a04('0x4a')]({'where':{'id':_0x50bb7e[_0x3a04('0x45')]['id']}})['then'](handleEntityNotFound(_0x112146,null))[_0x3a04('0x25')](function(_0x4e4581){if(_0x4e4581){_0x186e72=_0x4e4581;_0x5dfbde[_0x3a04('0x30')]=_[_0x3a04('0x33')](db[_0x3a04('0x4b')][_0x3a04('0x2c')]);_0x5dfbde[_0x3a04('0x32')]=_[_0x3a04('0x33')](_0x50bb7e[_0x3a04('0x32')]);_0x5dfbde[_0x3a04('0x34')]=_[_0x3a04('0x35')](_0x5dfbde[_0x3a04('0x30')],_0x5dfbde[_0x3a04('0x32')]);_0x2ed831[_0x3a04('0x37')]=_['intersection'](_0x5dfbde[_0x3a04('0x30')],qs[_0x3a04('0x36')](_0x50bb7e[_0x3a04('0x32')][_0x3a04('0x36')]));_0x2ed831[_0x3a04('0x37')]=_0x2ed831[_0x3a04('0x37')]['length']?_0x2ed831[_0x3a04('0x37')]:_0x5dfbde[_0x3a04('0x30')];_0x2ed831[_0x3a04('0x4c')]=qs[_0x3a04('0x3b')](_0x50bb7e[_0x3a04('0x32')]['sort']);_0x2ed831[_0x3a04('0x3c')]=qs[_0x3a04('0x34')](_[_0x3a04('0x3d')](_0x50bb7e[_0x3a04('0x32')],_0x5dfbde[_0x3a04('0x34')]));if(_0x50bb7e[_0x3a04('0x32')][_0x3a04('0x40')]){_0x2ed831[_0x3a04('0x3c')]=_[_0x3a04('0x3e')](_0x2ed831[_0x3a04('0x3c')],{'$or':_[_0x3a04('0x31')](_0x2ed831[_0x3a04('0x37')],function(_0x4bc3aa){var _0x36bdb2={};_0x36bdb2[_0x4bc3aa]={'$like':'%'+_0x50bb7e[_0x3a04('0x32')][_0x3a04('0x40')]+'%'};return _0x36bdb2;})});}_0x2ed831=_[_0x3a04('0x3e')]({},_0x2ed831,_0x50bb7e[_0x3a04('0x46')]);return _0x186e72[_0x3a04('0x4e')](_0x2ed831);}})['then'](function(_0x156c5e){if(_0x156c5e){_0x93d66a=_0x156c5e[_0x3a04('0x38')];if(!_0x50bb7e[_0x3a04('0x32')][_0x3a04('0x39')](_0x3a04('0x3a'))){_0x2ed831[_0x3a04('0x1f')]=qs[_0x3a04('0x1f')](_0x50bb7e[_0x3a04('0x32')]['limit']);_0x2ed831[_0x3a04('0x1d')]=qs[_0x3a04('0x1d')](_0x50bb7e['query'][_0x3a04('0x1d')]);}return _0x186e72[_0x3a04('0x4e')](_0x2ed831);}})[_0x3a04('0x25')](function(_0x343684){if(_0x343684){return _0x343684?{'count':_0x93d66a,'rows':_0x343684}:null;}})[_0x3a04('0x25')](respondWithResult(_0x112146,null))[_0x3a04('0x44')](handleError(_0x112146,null));};exports[_0x3a04('0x4f')]=function(_0x25e613,_0xe2cff1,_0x363a2c){var _0x2ab20a={};var _0x26c705={};var _0x2afcac;var _0xaffc9c;return db['ZendeskConfiguration'][_0x3a04('0x4a')]({'where':{'id':_0x25e613['params']['id']}})[_0x3a04('0x25')](handleEntityNotFound(_0xe2cff1,null))[_0x3a04('0x25')](function(_0x4173f2){if(_0x4173f2){_0x2afcac=_0x4173f2;_0x26c705[_0x3a04('0x30')]=_[_0x3a04('0x33')](db[_0x3a04('0x4b')][_0x3a04('0x2c')]);_0x26c705[_0x3a04('0x32')]=_[_0x3a04('0x33')](_0x25e613[_0x3a04('0x32')]);_0x26c705['filters']=_['intersection'](_0x26c705[_0x3a04('0x30')],_0x26c705[_0x3a04('0x32')]);_0x2ab20a[_0x3a04('0x37')]=_[_0x3a04('0x35')](_0x26c705[_0x3a04('0x30')],qs['fields'](_0x25e613[_0x3a04('0x32')][_0x3a04('0x36')]));_0x2ab20a[_0x3a04('0x37')]=_0x2ab20a[_0x3a04('0x37')]['length']?_0x2ab20a['attributes']:_0x26c705[_0x3a04('0x30')];_0x2ab20a[_0x3a04('0x4c')]=qs['sort'](_0x25e613[_0x3a04('0x32')]['sort']);_0x2ab20a[_0x3a04('0x3c')]=qs[_0x3a04('0x34')](_[_0x3a04('0x3d')](_0x25e613['query'],_0x26c705['filters']));if(_0x25e613['query'][_0x3a04('0x40')]){_0x2ab20a['where']=_[_0x3a04('0x3e')](_0x2ab20a['where'],{'$or':_[_0x3a04('0x31')](_0x2ab20a[_0x3a04('0x37')],function(_0xbc883a){var _0x4e0722={};_0x4e0722[_0xbc883a]={'$like':'%'+_0x25e613['query'][_0x3a04('0x40')]+'%'};return _0x4e0722;})});}_0x2ab20a=_[_0x3a04('0x3e')]({},_0x2ab20a,_0x25e613[_0x3a04('0x46')]);return _0x2afcac[_0x3a04('0x4f')](_0x2ab20a);}})[_0x3a04('0x25')](function(_0x117406){if(_0x117406){_0xaffc9c=_0x117406[_0x3a04('0x38')];if(!_0x25e613[_0x3a04('0x32')][_0x3a04('0x39')](_0x3a04('0x3a'))){_0x2ab20a['limit']=qs[_0x3a04('0x1f')](_0x25e613[_0x3a04('0x32')][_0x3a04('0x1f')]);_0x2ab20a[_0x3a04('0x1d')]=qs[_0x3a04('0x1d')](_0x25e613[_0x3a04('0x32')][_0x3a04('0x1d')]);}return _0x2afcac[_0x3a04('0x4f')](_0x2ab20a);}})[_0x3a04('0x25')](function(_0x5de7ac){if(_0x5de7ac){return _0x5de7ac?{'count':_0xaffc9c,'rows':_0x5de7ac}:null;}})['then'](respondWithResult(_0xe2cff1,null))[_0x3a04('0x44')](handleError(_0xe2cff1,null));};exports['getTags']=function(_0x29759b,_0x2f4cd8,_0xbbbfe6){var _0x43da67={};var _0x3967f6={};var _0x29ba47;var _0x6a3a51;return db['ZendeskConfiguration'][_0x3a04('0x4a')]({'where':{'id':_0x29759b[_0x3a04('0x45')]['id']}})[_0x3a04('0x25')](handleEntityNotFound(_0x2f4cd8,null))['then'](function(_0x38bef){if(_0x38bef){_0x29ba47=_0x38bef;_0x3967f6[_0x3a04('0x30')]=_[_0x3a04('0x33')](db[_0x3a04('0x50')][_0x3a04('0x2c')]);_0x3967f6['query']=_[_0x3a04('0x33')](_0x29759b[_0x3a04('0x32')]);_0x3967f6['filters']=_[_0x3a04('0x35')](_0x3967f6['model'],_0x3967f6[_0x3a04('0x32')]);_0x43da67[_0x3a04('0x37')]=_[_0x3a04('0x35')](_0x3967f6[_0x3a04('0x30')],qs[_0x3a04('0x36')](_0x29759b[_0x3a04('0x32')]['fields']));_0x43da67['attributes']=_0x43da67[_0x3a04('0x37')][_0x3a04('0x38')]?_0x43da67[_0x3a04('0x37')]:_0x3967f6[_0x3a04('0x30')];_0x43da67['order']=qs[_0x3a04('0x3b')](_0x29759b[_0x3a04('0x32')][_0x3a04('0x3b')]);_0x43da67[_0x3a04('0x3c')]=qs[_0x3a04('0x34')](_[_0x3a04('0x3d')](_0x29759b[_0x3a04('0x32')],_0x3967f6['filters']));if(_0x29759b['query'][_0x3a04('0x40')]){_0x43da67[_0x3a04('0x3c')]=_['merge'](_0x43da67['where'],{'$or':_[_0x3a04('0x31')](_0x43da67['attributes'],function(_0x5710b3){var _0x1b622a={};_0x1b622a[_0x5710b3]={'$like':'%'+_0x29759b[_0x3a04('0x32')]['filter']+'%'};return _0x1b622a;})});}_0x43da67=_['merge']({},_0x43da67,_0x29759b[_0x3a04('0x46')]);return _0x29ba47['getTags'](_0x43da67);}})[_0x3a04('0x25')](function(_0x4f70b7){if(_0x4f70b7){_0x6a3a51=_0x4f70b7['length'];if(!_0x29759b['query'][_0x3a04('0x39')]('nolimit')){_0x43da67[_0x3a04('0x1f')]=qs['limit'](_0x29759b[_0x3a04('0x32')][_0x3a04('0x1f')]);_0x43da67[_0x3a04('0x1d')]=qs['offset'](_0x29759b[_0x3a04('0x32')][_0x3a04('0x1d')]);}return _0x29ba47[_0x3a04('0x51')](_0x43da67);}})[_0x3a04('0x25')](function(_0x59d1eb){if(_0x59d1eb){return _0x59d1eb?{'count':_0x6a3a51,'rows':_0x59d1eb}:null;}})[_0x3a04('0x25')](respondWithResult(_0x2f4cd8,null))[_0x3a04('0x44')](handleError(_0x2f4cd8,null));};exports[_0x3a04('0x52')]=function(_0x585146,_0x706967,_0x1470b7){if(_0x585146[_0x3a04('0x49')]['id']){delete _0x585146[_0x3a04('0x49')]['id'];}return db[_0x3a04('0x2b')][_0x3a04('0x4a')]({'where':{'id':_0x585146[_0x3a04('0x45')]['id']}})[_0x3a04('0x25')](handleEntityNotFound(_0x706967,null))[_0x3a04('0x25')](function(_0x39221e){if(_0x39221e){return _0x39221e[_0x3a04('0x52')](_0x585146[_0x3a04('0x49')][_0x3a04('0x53')]||[]);}return null;})[_0x3a04('0x25')](respondWithResult(_0x706967,null))[_0x3a04('0x44')](handleError(_0x706967,null));};
\ No newline at end of file
+var _0xae84=['save','update','destroy','then','error','stack','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','findOne','ZendeskField','filter','limit','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','undefined','count','offset','set','Content-Range','apply'];(function(_0x3b8fb7,_0x1918d8){var _0x56eaca=function(_0x4c1ddb){while(--_0x4c1ddb){_0x3b8fb7['push'](_0x3b8fb7['shift']());}};_0x56eaca(++_0x1918d8);}(_0xae84,0x132));var _0x4ae8=function(_0x354642,_0x58fe5f){_0x354642=_0x354642-0x0;var _0x46a64e=_0xae84[_0x354642];return _0x46a64e;};'use strict';var emlformat=require(_0x4ae8('0x0'));var rimraf=require(_0x4ae8('0x1'));var zipdir=require(_0x4ae8('0x2'));var jsonpatch=require(_0x4ae8('0x3'));var rp=require(_0x4ae8('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4ae8('0x5'));var util=require(_0x4ae8('0x6'));var path=require('path');var sox=require(_0x4ae8('0x7'));var csv=require(_0x4ae8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ae8('0x9'));var _=require(_0x4ae8('0xa'));var squel=require(_0x4ae8('0xb'));var crypto=require(_0x4ae8('0xc'));var jsforce=require(_0x4ae8('0xd'));var deskjs=require(_0x4ae8('0xe'));var toCsv=require(_0x4ae8('0x8'));var querystring=require(_0x4ae8('0xf'));var Papa=require('papaparse');var Redis=require(_0x4ae8('0x10'));var authService=require(_0x4ae8('0x11'));var qs=require(_0x4ae8('0x12'));var as=require(_0x4ae8('0x13'));var hardwareService=require(_0x4ae8('0x14'));var logger=require('../../config/logger')(_0x4ae8('0x15'));var utils=require(_0x4ae8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x4ae8('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43d26e,_0x16f0d7){_0x16f0d7=_0x16f0d7||0xcc;return function(_0x2a0c6f){if(_0x2a0c6f){return _0x43d26e[_0x4ae8('0x18')](_0x16f0d7);}return _0x43d26e['status'](_0x16f0d7)[_0x4ae8('0x19')]();};}function respondWithResult(_0x2a8e32,_0x40d5cb){_0x40d5cb=_0x40d5cb||0xc8;return function(_0x1bf202){if(_0x1bf202){return _0x2a8e32[_0x4ae8('0x1a')](_0x40d5cb)[_0x4ae8('0x1b')](_0x1bf202);}};}function respondWithFilteredResult(_0x319483,_0x543afb){return function(_0x5bc666){if(_0x5bc666){var _0x53dccb=typeof _0x543afb['offset']===_0x4ae8('0x1c')&&typeof _0x543afb['limit']==='undefined';var _0x37d18a=_0x5bc666[_0x4ae8('0x1d')];var _0x6b9b7=_0x53dccb?0x0:_0x543afb[_0x4ae8('0x1e')];var _0x4765a6=_0x53dccb?_0x5bc666[_0x4ae8('0x1d')]:_0x543afb['offset']+_0x543afb['limit'];var _0x3f6db3;if(_0x4765a6>=_0x37d18a){_0x4765a6=_0x37d18a;_0x3f6db3=0xc8;}else{_0x3f6db3=0xce;}_0x319483['status'](_0x3f6db3);return _0x319483[_0x4ae8('0x1f')](_0x4ae8('0x20'),_0x6b9b7+'-'+_0x4765a6+'/'+_0x37d18a)[_0x4ae8('0x1b')](_0x5bc666);}return null;};}function patchUpdates(_0x16a5e4){return function(_0x28dd54){try{jsonpatch[_0x4ae8('0x21')](_0x28dd54,_0x16a5e4,!![]);}catch(_0x305423){return BPromise['reject'](_0x305423);}return _0x28dd54[_0x4ae8('0x22')]();};}function saveUpdates(_0x314fe0,_0x3e9b6b){return function(_0x4f0ca5){if(_0x4f0ca5){return _0x4f0ca5[_0x4ae8('0x23')](_0x314fe0)['then'](function(_0x17b4d6){return _0x17b4d6;});}return null;};}function removeEntity(_0x530b2c,_0x184253){return function(_0x39936e){if(_0x39936e){return _0x39936e[_0x4ae8('0x24')]()[_0x4ae8('0x25')](function(){_0x530b2c[_0x4ae8('0x1a')](0xcc)[_0x4ae8('0x19')]();});}};}function handleEntityNotFound(_0x7b25dc,_0xafc5e7){return function(_0x392701){if(!_0x392701){_0x7b25dc['sendStatus'](0x194);}return _0x392701;};}function handleError(_0x14a161,_0x213f0a){_0x213f0a=_0x213f0a||0x1f4;return function(_0x1249bb){logger[_0x4ae8('0x26')](_0x1249bb[_0x4ae8('0x27')]);if(_0x1249bb['name']){delete _0x1249bb['name'];}_0x14a161[_0x4ae8('0x1a')](_0x213f0a)[_0x4ae8('0x28')](_0x1249bb);};}exports[_0x4ae8('0x29')]=function(_0x2c241e,_0x3fc518){var _0x174050={},_0x50d627={},_0x26124e={'count':0x0,'rows':[]};var _0x53f62e=_[_0x4ae8('0x2a')](db[_0x4ae8('0x2b')][_0x4ae8('0x2c')],function(_0x35b6a0){return{'name':_0x35b6a0[_0x4ae8('0x2d')],'type':_0x35b6a0[_0x4ae8('0x2e')][_0x4ae8('0x2f')]};});_0x50d627[_0x4ae8('0x30')]=_[_0x4ae8('0x2a')](_0x53f62e,'name');_0x50d627[_0x4ae8('0x31')]=_[_0x4ae8('0x32')](_0x2c241e[_0x4ae8('0x31')]);_0x50d627['filters']=_[_0x4ae8('0x33')](_0x50d627[_0x4ae8('0x30')],_0x50d627[_0x4ae8('0x31')]);_0x174050[_0x4ae8('0x34')]=_['intersection'](_0x50d627[_0x4ae8('0x30')],qs['fields'](_0x2c241e[_0x4ae8('0x31')][_0x4ae8('0x35')]));_0x174050['attributes']=_0x174050[_0x4ae8('0x34')][_0x4ae8('0x36')]?_0x174050['attributes']:_0x50d627[_0x4ae8('0x30')];if(!_0x2c241e['query'][_0x4ae8('0x37')](_0x4ae8('0x38'))){_0x174050['limit']=qs['limit'](_0x2c241e[_0x4ae8('0x31')]['limit']);_0x174050[_0x4ae8('0x1e')]=qs[_0x4ae8('0x1e')](_0x2c241e['query'][_0x4ae8('0x1e')]);}_0x174050[_0x4ae8('0x39')]=qs['sort'](_0x2c241e[_0x4ae8('0x31')][_0x4ae8('0x3a')]);_0x174050[_0x4ae8('0x3b')]=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0x2c241e[_0x4ae8('0x31')],_0x50d627[_0x4ae8('0x3c')]),_0x53f62e);if(_0x2c241e[_0x4ae8('0x31')]['filter']){_0x174050['where']=_[_0x4ae8('0x3e')](_0x174050[_0x4ae8('0x3b')],{'$or':_[_0x4ae8('0x2a')](_0x53f62e,function(_0x41dd78){if(_0x41dd78[_0x4ae8('0x2e')]!==_0x4ae8('0x3f')){var _0x311421={};_0x311421[_0x41dd78[_0x4ae8('0x40')]]={'$like':'%'+_0x2c241e[_0x4ae8('0x31')]['filter']+'%'};return _0x311421;}})});}_0x174050=_['merge']({},_0x174050,_0x2c241e[_0x4ae8('0x41')]);var _0x31bd20={'where':_0x174050['where']};return db[_0x4ae8('0x2b')][_0x4ae8('0x1d')](_0x31bd20)[_0x4ae8('0x25')](function(_0x4628d7){_0x26124e[_0x4ae8('0x1d')]=_0x4628d7;if(_0x2c241e[_0x4ae8('0x31')][_0x4ae8('0x42')]){_0x174050[_0x4ae8('0x43')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x4ae8('0x44')](_0x174050);})[_0x4ae8('0x25')](function(_0x29ea7c){_0x26124e[_0x4ae8('0x45')]=_0x29ea7c;return _0x26124e;})['then'](respondWithFilteredResult(_0x3fc518,_0x174050))[_0x4ae8('0x46')](handleError(_0x3fc518,null));};exports['show']=function(_0x312249,_0x3e8e9f){var _0xff6506={'raw':![],'where':{'id':_0x312249[_0x4ae8('0x47')]['id']}},_0x65e15f={};_0x65e15f[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db['ZendeskConfiguration'][_0x4ae8('0x2c')]);_0x65e15f['query']=_[_0x4ae8('0x32')](_0x312249[_0x4ae8('0x31')]);_0x65e15f[_0x4ae8('0x3c')]=_[_0x4ae8('0x33')](_0x65e15f[_0x4ae8('0x30')],_0x65e15f[_0x4ae8('0x31')]);_0xff6506['attributes']=_[_0x4ae8('0x33')](_0x65e15f[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0x312249[_0x4ae8('0x31')][_0x4ae8('0x35')]));_0xff6506[_0x4ae8('0x34')]=_0xff6506['attributes'][_0x4ae8('0x36')]?_0xff6506[_0x4ae8('0x34')]:_0x65e15f[_0x4ae8('0x30')];if(_0x312249[_0x4ae8('0x31')][_0x4ae8('0x42')]){_0xff6506['include']=[{'all':!![]}];}_0xff6506=_[_0x4ae8('0x3e')]({},_0xff6506,_0x312249[_0x4ae8('0x41')]);return db[_0x4ae8('0x2b')][_0x4ae8('0x48')](_0xff6506)['then'](handleEntityNotFound(_0x3e8e9f,null))[_0x4ae8('0x25')](respondWithResult(_0x3e8e9f,null))[_0x4ae8('0x46')](handleError(_0x3e8e9f,null));};exports['create']=function(_0x421268,_0x3415ce){return db[_0x4ae8('0x2b')][_0x4ae8('0x49')](_0x421268[_0x4ae8('0x4a')],{})[_0x4ae8('0x25')](respondWithResult(_0x3415ce,0xc9))[_0x4ae8('0x46')](handleError(_0x3415ce,null));};exports[_0x4ae8('0x23')]=function(_0x35b76d,_0x1164e){if(_0x35b76d[_0x4ae8('0x4a')]['id']){delete _0x35b76d[_0x4ae8('0x4a')]['id'];}return db[_0x4ae8('0x2b')][_0x4ae8('0x48')]({'where':{'id':_0x35b76d[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x1164e,null))['then'](saveUpdates(_0x35b76d['body'],null))['then'](respondWithResult(_0x1164e,null))[_0x4ae8('0x46')](handleError(_0x1164e,null));};exports[_0x4ae8('0x24')]=function(_0x3fdeea,_0x54eda3){return db[_0x4ae8('0x2b')][_0x4ae8('0x48')]({'where':{'id':_0x3fdeea['params']['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x54eda3,null))[_0x4ae8('0x25')](removeEntity(_0x54eda3,null))['catch'](handleError(_0x54eda3,null));};exports[_0x4ae8('0x4b')]=function(_0x32753b,_0x34f501,_0x2ac4e8){var _0x54e794={};var _0x4ba1db={};var _0x4796b7;var _0x51e9f7;return db[_0x4ae8('0x2b')][_0x4ae8('0x4c')]({'where':{'id':_0x32753b[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x34f501,null))[_0x4ae8('0x25')](function(_0x31e2fb){if(_0x31e2fb){_0x4796b7=_0x31e2fb;_0x4ba1db[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db[_0x4ae8('0x4d')]['rawAttributes']);_0x4ba1db[_0x4ae8('0x31')]=_[_0x4ae8('0x32')](_0x32753b[_0x4ae8('0x31')]);_0x4ba1db[_0x4ae8('0x3c')]=_['intersection'](_0x4ba1db[_0x4ae8('0x30')],_0x4ba1db[_0x4ae8('0x31')]);_0x54e794[_0x4ae8('0x34')]=_[_0x4ae8('0x33')](_0x4ba1db[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0x32753b['query'][_0x4ae8('0x35')]));_0x54e794[_0x4ae8('0x34')]=_0x54e794['attributes'][_0x4ae8('0x36')]?_0x54e794[_0x4ae8('0x34')]:_0x4ba1db['model'];_0x54e794['order']=qs[_0x4ae8('0x3a')](_0x32753b[_0x4ae8('0x31')]['sort']);_0x54e794[_0x4ae8('0x3b')]=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0x32753b['query'],_0x4ba1db[_0x4ae8('0x3c')]));if(_0x32753b[_0x4ae8('0x31')][_0x4ae8('0x4e')]){_0x54e794[_0x4ae8('0x3b')]=_[_0x4ae8('0x3e')](_0x54e794['where'],{'$or':_[_0x4ae8('0x2a')](_0x54e794[_0x4ae8('0x34')],function(_0x3293e5){var _0x279a53={};_0x279a53[_0x3293e5]={'$like':'%'+_0x32753b[_0x4ae8('0x31')][_0x4ae8('0x4e')]+'%'};return _0x279a53;})});}_0x54e794=_[_0x4ae8('0x3e')]({},_0x54e794,_0x32753b[_0x4ae8('0x41')]);return _0x4796b7['getFields'](_0x54e794);}})['then'](function(_0x528ba4){if(_0x528ba4){_0x51e9f7=_0x528ba4[_0x4ae8('0x36')];if(!_0x32753b['query']['hasOwnProperty'](_0x4ae8('0x38'))){_0x54e794['limit']=qs['limit'](_0x32753b[_0x4ae8('0x31')][_0x4ae8('0x4f')]);_0x54e794['offset']=qs['offset'](_0x32753b['query'][_0x4ae8('0x1e')]);}return _0x4796b7['getFields'](_0x54e794);}})['then'](function(_0x3832a7){if(_0x3832a7){return _0x3832a7?{'count':_0x51e9f7,'rows':_0x3832a7}:null;}})[_0x4ae8('0x25')](respondWithResult(_0x34f501,null))[_0x4ae8('0x46')](handleError(_0x34f501,null));};exports['getSubjects']=function(_0xaf87fa,_0x175dce,_0xeeb5c2){var _0x5369b2={};var _0x93da16={};var _0x2096c2;var _0x253e36;return db[_0x4ae8('0x2b')]['findOne']({'where':{'id':_0xaf87fa['params']['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x175dce,null))[_0x4ae8('0x25')](function(_0x5854df){if(_0x5854df){_0x2096c2=_0x5854df;_0x93da16[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db['ZendeskField'][_0x4ae8('0x2c')]);_0x93da16[_0x4ae8('0x31')]=_['keys'](_0xaf87fa['query']);_0x93da16[_0x4ae8('0x3c')]=_[_0x4ae8('0x33')](_0x93da16[_0x4ae8('0x30')],_0x93da16[_0x4ae8('0x31')]);_0x5369b2[_0x4ae8('0x34')]=_[_0x4ae8('0x33')](_0x93da16[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0xaf87fa['query'][_0x4ae8('0x35')]));_0x5369b2[_0x4ae8('0x34')]=_0x5369b2[_0x4ae8('0x34')]['length']?_0x5369b2[_0x4ae8('0x34')]:_0x93da16[_0x4ae8('0x30')];_0x5369b2[_0x4ae8('0x39')]=qs[_0x4ae8('0x3a')](_0xaf87fa['query'][_0x4ae8('0x3a')]);_0x5369b2['where']=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0xaf87fa['query'],_0x93da16[_0x4ae8('0x3c')]));if(_0xaf87fa[_0x4ae8('0x31')][_0x4ae8('0x4e')]){_0x5369b2[_0x4ae8('0x3b')]=_['merge'](_0x5369b2[_0x4ae8('0x3b')],{'$or':_[_0x4ae8('0x2a')](_0x5369b2[_0x4ae8('0x34')],function(_0x5a5c98){var _0x2cc0cc={};_0x2cc0cc[_0x5a5c98]={'$like':'%'+_0xaf87fa['query'][_0x4ae8('0x4e')]+'%'};return _0x2cc0cc;})});}_0x5369b2=_[_0x4ae8('0x3e')]({},_0x5369b2,_0xaf87fa[_0x4ae8('0x41')]);return _0x2096c2[_0x4ae8('0x50')](_0x5369b2);}})['then'](function(_0x69ec05){if(_0x69ec05){_0x253e36=_0x69ec05['length'];if(!_0xaf87fa[_0x4ae8('0x31')][_0x4ae8('0x37')](_0x4ae8('0x38'))){_0x5369b2[_0x4ae8('0x4f')]=qs[_0x4ae8('0x4f')](_0xaf87fa['query']['limit']);_0x5369b2[_0x4ae8('0x1e')]=qs[_0x4ae8('0x1e')](_0xaf87fa[_0x4ae8('0x31')][_0x4ae8('0x1e')]);}return _0x2096c2['getSubjects'](_0x5369b2);}})['then'](function(_0x25b7cd){if(_0x25b7cd){return _0x25b7cd?{'count':_0x253e36,'rows':_0x25b7cd}:null;}})['then'](respondWithResult(_0x175dce,null))[_0x4ae8('0x46')](handleError(_0x175dce,null));};exports[_0x4ae8('0x51')]=function(_0x18c5a1,_0x231ff1,_0x562295){var _0x5c1630={};var _0x381862={};var _0x5c4a5a;var _0x181ffd;return db[_0x4ae8('0x2b')][_0x4ae8('0x4c')]({'where':{'id':_0x18c5a1[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x231ff1,null))[_0x4ae8('0x25')](function(_0x3e0184){if(_0x3e0184){_0x5c4a5a=_0x3e0184;_0x381862[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db['ZendeskField'][_0x4ae8('0x2c')]);_0x381862['query']=_[_0x4ae8('0x32')](_0x18c5a1[_0x4ae8('0x31')]);_0x381862[_0x4ae8('0x3c')]=_[_0x4ae8('0x33')](_0x381862[_0x4ae8('0x30')],_0x381862[_0x4ae8('0x31')]);_0x5c1630['attributes']=_[_0x4ae8('0x33')](_0x381862[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0x18c5a1[_0x4ae8('0x31')][_0x4ae8('0x35')]));_0x5c1630[_0x4ae8('0x34')]=_0x5c1630[_0x4ae8('0x34')]['length']?_0x5c1630['attributes']:_0x381862[_0x4ae8('0x30')];_0x5c1630[_0x4ae8('0x39')]=qs[_0x4ae8('0x3a')](_0x18c5a1['query'][_0x4ae8('0x3a')]);_0x5c1630[_0x4ae8('0x3b')]=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0x18c5a1['query'],_0x381862[_0x4ae8('0x3c')]));if(_0x18c5a1[_0x4ae8('0x31')][_0x4ae8('0x4e')]){_0x5c1630[_0x4ae8('0x3b')]=_['merge'](_0x5c1630[_0x4ae8('0x3b')],{'$or':_[_0x4ae8('0x2a')](_0x5c1630[_0x4ae8('0x34')],function(_0x1b31bb){var _0x3f2586={};_0x3f2586[_0x1b31bb]={'$like':'%'+_0x18c5a1['query'][_0x4ae8('0x4e')]+'%'};return _0x3f2586;})});}_0x5c1630=_[_0x4ae8('0x3e')]({},_0x5c1630,_0x18c5a1[_0x4ae8('0x41')]);return _0x5c4a5a['getDescriptions'](_0x5c1630);}})[_0x4ae8('0x25')](function(_0x587a65){if(_0x587a65){_0x181ffd=_0x587a65[_0x4ae8('0x36')];if(!_0x18c5a1[_0x4ae8('0x31')][_0x4ae8('0x37')](_0x4ae8('0x38'))){_0x5c1630[_0x4ae8('0x4f')]=qs[_0x4ae8('0x4f')](_0x18c5a1['query'][_0x4ae8('0x4f')]);_0x5c1630[_0x4ae8('0x1e')]=qs[_0x4ae8('0x1e')](_0x18c5a1['query'][_0x4ae8('0x1e')]);}return _0x5c4a5a[_0x4ae8('0x51')](_0x5c1630);}})[_0x4ae8('0x25')](function(_0x52d2bb){if(_0x52d2bb){return _0x52d2bb?{'count':_0x181ffd,'rows':_0x52d2bb}:null;}})[_0x4ae8('0x25')](respondWithResult(_0x231ff1,null))[_0x4ae8('0x46')](handleError(_0x231ff1,null));};exports['getTags']=function(_0x3b09dd,_0x266366,_0x5e696e){var _0x3ff3b8={};var _0x5d4243={};var _0xcd5e7c;var _0x1301d3;return db['ZendeskConfiguration'][_0x4ae8('0x4c')]({'where':{'id':_0x3b09dd[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x266366,null))[_0x4ae8('0x25')](function(_0x4ec2cb){if(_0x4ec2cb){_0xcd5e7c=_0x4ec2cb;_0x5d4243[_0x4ae8('0x30')]=_[_0x4ae8('0x32')](db['Tag'][_0x4ae8('0x2c')]);_0x5d4243[_0x4ae8('0x31')]=_[_0x4ae8('0x32')](_0x3b09dd[_0x4ae8('0x31')]);_0x5d4243[_0x4ae8('0x3c')]=_['intersection'](_0x5d4243[_0x4ae8('0x30')],_0x5d4243[_0x4ae8('0x31')]);_0x3ff3b8['attributes']=_[_0x4ae8('0x33')](_0x5d4243[_0x4ae8('0x30')],qs[_0x4ae8('0x35')](_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x35')]));_0x3ff3b8['attributes']=_0x3ff3b8[_0x4ae8('0x34')]['length']?_0x3ff3b8[_0x4ae8('0x34')]:_0x5d4243['model'];_0x3ff3b8[_0x4ae8('0x39')]=qs['sort'](_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x3a')]);_0x3ff3b8[_0x4ae8('0x3b')]=qs[_0x4ae8('0x3c')](_[_0x4ae8('0x3d')](_0x3b09dd[_0x4ae8('0x31')],_0x5d4243[_0x4ae8('0x3c')]));if(_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x4e')]){_0x3ff3b8['where']=_['merge'](_0x3ff3b8['where'],{'$or':_['map'](_0x3ff3b8[_0x4ae8('0x34')],function(_0xbaa1c4){var _0x3ad4fa={};_0x3ad4fa[_0xbaa1c4]={'$like':'%'+_0x3b09dd[_0x4ae8('0x31')]['filter']+'%'};return _0x3ad4fa;})});}_0x3ff3b8=_[_0x4ae8('0x3e')]({},_0x3ff3b8,_0x3b09dd[_0x4ae8('0x41')]);return _0xcd5e7c[_0x4ae8('0x52')](_0x3ff3b8);}})[_0x4ae8('0x25')](function(_0x4aff62){if(_0x4aff62){_0x1301d3=_0x4aff62[_0x4ae8('0x36')];if(!_0x3b09dd[_0x4ae8('0x31')]['hasOwnProperty']('nolimit')){_0x3ff3b8[_0x4ae8('0x4f')]=qs[_0x4ae8('0x4f')](_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x4f')]);_0x3ff3b8[_0x4ae8('0x1e')]=qs[_0x4ae8('0x1e')](_0x3b09dd[_0x4ae8('0x31')][_0x4ae8('0x1e')]);}return _0xcd5e7c['getTags'](_0x3ff3b8);}})[_0x4ae8('0x25')](function(_0x25d02a){if(_0x25d02a){return _0x25d02a?{'count':_0x1301d3,'rows':_0x25d02a}:null;}})[_0x4ae8('0x25')](respondWithResult(_0x266366,null))[_0x4ae8('0x46')](handleError(_0x266366,null));};exports[_0x4ae8('0x53')]=function(_0x3d5374,_0x3d77b3,_0x374c02){if(_0x3d5374[_0x4ae8('0x4a')]['id']){delete _0x3d5374[_0x4ae8('0x4a')]['id'];}return db[_0x4ae8('0x2b')]['findOne']({'where':{'id':_0x3d5374[_0x4ae8('0x47')]['id']}})[_0x4ae8('0x25')](handleEntityNotFound(_0x3d77b3,null))['then'](function(_0x375b43){if(_0x375b43){return _0x375b43['setTags'](_0x3d5374['body'][_0x4ae8('0x54')]||[]);}return null;})[_0x4ae8('0x25')](respondWithResult(_0x3d77b3,null))['catch'](handleError(_0x3d77b3,null));};
\ No newline at end of file
index 8482024..47ba59c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x58a4=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x4907b1,_0x46d5d3){var _0x54ca69=function(_0x21b50d){while(--_0x21b50d){_0x4907b1['push'](_0x4907b1['shift']());}};_0x54ca69(++_0x46d5d3);}(_0x58a4,0xbf));var _0x458a=function(_0x4a489f,_0x5402ab){_0x4a489f=_0x4a489f-0x0;var _0x4a4137=_0x58a4[_0x4a489f];return _0x4a4137;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var logger=require(_0x458a('0x2'))(_0x458a('0x3'));var moment=require(_0x458a('0x4'));var BPromise=require(_0x458a('0x5'));var rp=require(_0x458a('0x6'));var fs=require('fs');var path=require(_0x458a('0x7'));var rimraf=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var attributes=require(_0x458a('0xa'));module[_0x458a('0xb')]=function(_0x2f5d44,_0x57de3c){return _0x2f5d44['define'](_0x458a('0xc'),attributes,{'tableName':_0x458a('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf7b4=['path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash','api','moment'];(function(_0x3b53eb,_0xa95976){var _0x4166ce=function(_0x4a2a3d){while(--_0x4a2a3d){_0x3b53eb['push'](_0x3b53eb['shift']());}};_0x4166ce(++_0xa95976);}(_0xf7b4,0x152));var _0x4f7b=function(_0x4d95d9,_0x278833){_0x4d95d9=_0x4d95d9-0x0;var _0x4685e6=_0xf7b4[_0x4d95d9];return _0x4685e6;};'use strict';var _=require(_0x4f7b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4f7b('0x1'));var moment=require(_0x4f7b('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f7b('0x3'));var rimraf=require(_0x4f7b('0x4'));var config=require(_0x4f7b('0x5'));var attributes=require(_0x4f7b('0x6'));module[_0x4f7b('0x7')]=function(_0x2637f0,_0x427f8b){return _0x2637f0[_0x4f7b('0x8')](_0x4f7b('0x9'),attributes,{'tableName':_0x4f7b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index d72f414..1e23edd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbcd0=['request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','ZendeskConfiguration,\x20%s,\x20%s','message','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xbcd0,0x1d0));var _0x0bcd=function(_0x260941,_0x3981a7){_0x260941=_0x260941-0x0;var _0x43f913=_0xbcd0[_0x260941];return _0x43f913;};'use strict';var _=require(_0x0bcd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0bcd('0x1'));var rs=require(_0x0bcd('0x2'));var fs=require('fs');var Redis=require(_0x0bcd('0x3'));var db=require(_0x0bcd('0x4'))['db'];var utils=require(_0x0bcd('0x5'));var logger=require(_0x0bcd('0x6'))('rpc');var config=require(_0x0bcd('0x7'));var jayson=require(_0x0bcd('0x8'));var client=jayson[_0x0bcd('0x9')][_0x0bcd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa15fb7,_0x3e157c,_0x9b3f9d){return new BPromise(function(_0x55c8c0,_0x1c3ce8){return client[_0x0bcd('0xb')](_0xa15fb7,_0x9b3f9d)[_0x0bcd('0xc')](function(_0x2f7e8b){logger[_0x0bcd('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3e157c,_0x0bcd('0xe'));logger['debug'](_0x0bcd('0xf'),_0x3e157c,'request\x20sent',JSON['stringify'](_0x2f7e8b));if(_0x2f7e8b[_0x0bcd('0x10')]){if(_0x2f7e8b[_0x0bcd('0x10')]['code']===0x1f4){logger[_0x0bcd('0x10')](_0x0bcd('0x11'),_0x3e157c,_0x2f7e8b[_0x0bcd('0x10')]['message']);return _0x1c3ce8(_0x2f7e8b[_0x0bcd('0x10')]['message']);}logger['error'](_0x0bcd('0x11'),_0x3e157c,_0x2f7e8b[_0x0bcd('0x10')][_0x0bcd('0x12')]);return _0x55c8c0(_0x2f7e8b[_0x0bcd('0x10')][_0x0bcd('0x12')]);}else{logger[_0x0bcd('0xd')](_0x0bcd('0x11'),_0x3e157c,_0x0bcd('0xe'));_0x55c8c0(_0x2f7e8b['result'][_0x0bcd('0x12')]);}})['catch'](function(_0x2dfc2e){logger[_0x0bcd('0x10')](_0x0bcd('0x11'),_0x3e157c,_0x2dfc2e);_0x1c3ce8(_0x2dfc2e);});});}
\ No newline at end of file
+var _0xa526=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1b5b2c,_0x959245){var _0x5e9e5f=function(_0x347508){while(--_0x347508){_0x1b5b2c['push'](_0x1b5b2c['shift']());}};_0x5e9e5f(++_0x959245);}(_0xa526,0x143));var _0x6a52=function(_0x2543d6,_0x3a5e78){_0x2543d6=_0x2543d6-0x0;var _0x55213c=_0xa526[_0x2543d6];return _0x55213c;};'use strict';var _=require(_0x6a52('0x0'));var util=require(_0x6a52('0x1'));var moment=require(_0x6a52('0x2'));var BPromise=require(_0x6a52('0x3'));var rs=require(_0x6a52('0x4'));var fs=require('fs');var Redis=require(_0x6a52('0x5'));var db=require(_0x6a52('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6a52('0x7'))(_0x6a52('0x8'));var config=require(_0x6a52('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ccd74,_0x55dac6,_0x55a63b){return new BPromise(function(_0x49b8ff,_0x1bfcbd){return client[_0x6a52('0xa')](_0x3ccd74,_0x55a63b)['then'](function(_0x514918){logger[_0x6a52('0xb')](_0x6a52('0xc'),_0x55dac6,_0x6a52('0xd'));logger[_0x6a52('0xe')](_0x6a52('0xf'),_0x55dac6,_0x6a52('0xd'),JSON[_0x6a52('0x10')](_0x514918));if(_0x514918['error']){if(_0x514918['error']['code']===0x1f4){logger[_0x6a52('0x11')](_0x6a52('0xc'),_0x55dac6,_0x514918['error'][_0x6a52('0x12')]);return _0x1bfcbd(_0x514918[_0x6a52('0x11')][_0x6a52('0x12')]);}logger['error'](_0x6a52('0xc'),_0x55dac6,_0x514918[_0x6a52('0x11')][_0x6a52('0x12')]);return _0x49b8ff(_0x514918[_0x6a52('0x11')]['message']);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x55dac6,_0x6a52('0xd'));_0x49b8ff(_0x514918['result'][_0x6a52('0x12')]);}})[_0x6a52('0x13')](function(_0x4db80e){logger[_0x6a52('0x11')](_0x6a52('0xc'),_0x55dac6,_0x4db80e);_0x1bfcbd(_0x4db80e);});});}
\ No newline at end of file
index a149ced..2efd464 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x47c8=['get','/:id','show','post','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index'];(function(_0x4f2066,_0x3b1368){var _0x29f80b=function(_0x3fba33){while(--_0x3fba33){_0x4f2066['push'](_0x4f2066['shift']());}};_0x29f80b(++_0x3b1368);}(_0x47c8,0xcd));var _0x847c=function(_0xf42e72,_0x72da7c){_0xf42e72=_0xf42e72-0x0;var _0x5cbb68=_0x47c8[_0xf42e72];return _0x5cbb68;};'use strict';var multer=require(_0x847c('0x0'));var util=require(_0x847c('0x1'));var path=require(_0x847c('0x2'));var timeout=require(_0x847c('0x3'));var express=require(_0x847c('0x4'));var router=express[_0x847c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x847c('0x6'));var interaction=require(_0x847c('0x7'));var config=require(_0x847c('0x8'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x847c('0x9')](),controller[_0x847c('0xa')]);router[_0x847c('0xb')](_0x847c('0xc'),auth['isAuthenticated'](),controller[_0x847c('0xd')]);router[_0x847c('0xe')]('/',auth[_0x847c('0x9')](),controller['create']);router['put'](_0x847c('0xc'),auth[_0x847c('0x9')](),controller[_0x847c('0xf')]);router[_0x847c('0x10')](_0x847c('0xc'),auth[_0x847c('0x9')](),controller['destroy']);module[_0x847c('0x11')]=router;
\ No newline at end of file
+var _0x18de=['isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','show','post','/:id'];(function(_0x2e4f89,_0xd6044){var _0x527fa1=function(_0x32b8de){while(--_0x32b8de){_0x2e4f89['push'](_0x2e4f89['shift']());}};_0x527fa1(++_0xd6044);}(_0x18de,0x1eb));var _0xe18d=function(_0x57b128,_0x15bf85){_0x57b128=_0x57b128-0x0;var _0x8fe81f=_0x18de[_0x57b128];return _0x8fe81f;};'use strict';var multer=require(_0xe18d('0x0'));var util=require(_0xe18d('0x1'));var path=require(_0xe18d('0x2'));var timeout=require(_0xe18d('0x3'));var express=require(_0xe18d('0x4'));var router=express['Router']();var fs_extra=require(_0xe18d('0x5'));var auth=require(_0xe18d('0x6'));var interaction=require(_0xe18d('0x7'));var config=require(_0xe18d('0x8'));var controller=require('./intZendeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe18d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe18d('0xa')]);router[_0xe18d('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe18d('0xc'),auth[_0xe18d('0xd')](),controller[_0xe18d('0xe')]);router[_0xe18d('0xf')]('/:id',auth[_0xe18d('0xd')](),controller[_0xe18d('0x10')]);module[_0xe18d('0x11')]=router;
\ No newline at end of file
index 06c4d7e..1f63fdf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0d0=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','picklist','customVariable'];(function(_0x20d3f6,_0x1bba34){var _0x548c81=function(_0x305fd2){while(--_0x305fd2){_0x20d3f6['push'](_0x20d3f6['shift']());}};_0x548c81(++_0x1bba34);}(_0xe0d0,0x1df));var _0x0e0d=function(_0x4c3108,_0x4d9de2){_0x4c3108=_0x4c3108-0x0;var _0x31a718=_0xe0d0[_0x4c3108];return _0x31a718;};'use strict';var Sequelize=require(_0x0e0d('0x0'));module[_0x0e0d('0x1')]={'type':{'type':Sequelize[_0x0e0d('0x2')](_0x0e0d('0x3'),_0x0e0d('0x4'),'customVariable','keyValue',_0x0e0d('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x0e0d('0x3'),_0x0e0d('0x4'),_0x0e0d('0x6'))},'keyContent':{'type':Sequelize[_0x0e0d('0x7')]},'idField':{'type':Sequelize[_0x0e0d('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x0e0d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0e0d('0x7')]}};
\ No newline at end of file
+var _0x5fd8=['customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x5fd8,0xcd));var _0x85fd=function(_0x1593bb,_0x49383e){_0x1593bb=_0x1593bb-0x0;var _0x4acf02=_0x5fd8[_0x1593bb];return _0x4acf02;};'use strict';var Sequelize=require(_0x85fd('0x0'));module[_0x85fd('0x1')]={'type':{'type':Sequelize[_0x85fd('0x2')](_0x85fd('0x3'),_0x85fd('0x4'),_0x85fd('0x5'),_0x85fd('0x6'),_0x85fd('0x7')),'defaultValue':_0x85fd('0x3')},'content':{'type':Sequelize[_0x85fd('0x8')]},'key':{'type':Sequelize[_0x85fd('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x85fd('0x3'),_0x85fd('0x4'),_0x85fd('0x5'))},'keyContent':{'type':Sequelize[_0x85fd('0x8')]},'idField':{'type':Sequelize[_0x85fd('0x8')]},'nameField':{'type':Sequelize[_0x85fd('0x8')]},'customField':{'type':Sequelize[_0x85fd('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x85fd('0x8')]}};
\ No newline at end of file
index 39d1de8..0b49b03 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9546=['create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','update','destroy','error','stack','name','send','ZendeskField','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','filter','options','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9546,0x1c4));var _0x6954=function(_0x9bff8f,_0x1bb74b){_0x9bff8f=_0x9bff8f-0x0;var _0x5a5594=_0x9546[_0x9bff8f];return _0x5a5594;};'use strict';var emlformat=require(_0x6954('0x0'));var rimraf=require(_0x6954('0x1'));var zipdir=require(_0x6954('0x2'));var jsonpatch=require(_0x6954('0x3'));var rp=require(_0x6954('0x4'));var moment=require(_0x6954('0x5'));var BPromise=require(_0x6954('0x6'));var Mustache=require(_0x6954('0x7'));var util=require(_0x6954('0x8'));var path=require(_0x6954('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6954('0xa'));var squel=require(_0x6954('0xb'));var crypto=require(_0x6954('0xc'));var jsforce=require(_0x6954('0xd'));var deskjs=require(_0x6954('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6954('0xf'));var Papa=require(_0x6954('0x10'));var Redis=require(_0x6954('0x11'));var authService=require(_0x6954('0x12'));var qs=require(_0x6954('0x13'));var as=require(_0x6954('0x14'));var hardwareService=require(_0x6954('0x15'));var logger=require(_0x6954('0x16'))(_0x6954('0x17'));var utils=require(_0x6954('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6954('0x19'))['db'];function respondWithStatusCode(_0x4f6b6b,_0xdeb16f){_0xdeb16f=_0xdeb16f||0xcc;return function(_0x1c27e4){if(_0x1c27e4){return _0x4f6b6b[_0x6954('0x1a')](_0xdeb16f);}return _0x4f6b6b[_0x6954('0x1b')](_0xdeb16f)[_0x6954('0x1c')]();};}function respondWithResult(_0x27f7f6,_0x4c43db){_0x4c43db=_0x4c43db||0xc8;return function(_0x503bfc){if(_0x503bfc){return _0x27f7f6[_0x6954('0x1b')](_0x4c43db)[_0x6954('0x1d')](_0x503bfc);}};}function respondWithFilteredResult(_0x719cf1,_0x5d4adf){return function(_0x25dd00){if(_0x25dd00){var _0x4f1e73=typeof _0x5d4adf[_0x6954('0x1e')]===_0x6954('0x1f')&&typeof _0x5d4adf[_0x6954('0x20')]===_0x6954('0x1f');var _0x384212=_0x25dd00['count'];var _0x46bc57=_0x4f1e73?0x0:_0x5d4adf[_0x6954('0x1e')];var _0x3aa953=_0x4f1e73?_0x25dd00[_0x6954('0x21')]:_0x5d4adf[_0x6954('0x1e')]+_0x5d4adf[_0x6954('0x20')];var _0x37e1d0;if(_0x3aa953>=_0x384212){_0x3aa953=_0x384212;_0x37e1d0=0xc8;}else{_0x37e1d0=0xce;}_0x719cf1[_0x6954('0x1b')](_0x37e1d0);return _0x719cf1['set'](_0x6954('0x22'),_0x46bc57+'-'+_0x3aa953+'/'+_0x384212)[_0x6954('0x1d')](_0x25dd00);}return null;};}function patchUpdates(_0xc2b4f5){return function(_0x3fa2f9){try{jsonpatch[_0x6954('0x23')](_0x3fa2f9,_0xc2b4f5,!![]);}catch(_0x4d3877){return BPromise['reject'](_0x4d3877);}return _0x3fa2f9['save']();};}function saveUpdates(_0x3bab9b,_0x5a9337){return function(_0x31c1f9){if(_0x31c1f9){return _0x31c1f9[_0x6954('0x24')](_0x3bab9b)['then'](function(_0x3ce6d6){return _0x3ce6d6;});}return null;};}function removeEntity(_0x3c2315,_0x224022){return function(_0x49fce0){if(_0x49fce0){return _0x49fce0[_0x6954('0x25')]()['then'](function(){_0x3c2315[_0x6954('0x1b')](0xcc)[_0x6954('0x1c')]();});}};}function handleEntityNotFound(_0x1fe4a5,_0x59d1f8){return function(_0x100d6f){if(!_0x100d6f){_0x1fe4a5['sendStatus'](0x194);}return _0x100d6f;};}function handleError(_0x3bd559,_0x311568){_0x311568=_0x311568||0x1f4;return function(_0x27ccf6){logger[_0x6954('0x26')](_0x27ccf6[_0x6954('0x27')]);if(_0x27ccf6[_0x6954('0x28')]){delete _0x27ccf6[_0x6954('0x28')];}_0x3bd559[_0x6954('0x1b')](_0x311568)[_0x6954('0x29')](_0x27ccf6);};}exports['index']=function(_0x28c5f4,_0xdf552d){var _0x32200c={},_0x526059={},_0x3e90e5={'count':0x0,'rows':[]};var _0x57bc36=_['map'](db[_0x6954('0x2a')]['rawAttributes'],function(_0x2543f4){return{'name':_0x2543f4[_0x6954('0x2b')],'type':_0x2543f4[_0x6954('0x2c')][_0x6954('0x2d')]};});_0x526059['model']=_[_0x6954('0x2e')](_0x57bc36,_0x6954('0x28'));_0x526059[_0x6954('0x2f')]=_[_0x6954('0x30')](_0x28c5f4['query']);_0x526059['filters']=_[_0x6954('0x31')](_0x526059[_0x6954('0x32')],_0x526059[_0x6954('0x2f')]);_0x32200c['attributes']=_[_0x6954('0x31')](_0x526059[_0x6954('0x32')],qs[_0x6954('0x33')](_0x28c5f4['query'][_0x6954('0x33')]));_0x32200c[_0x6954('0x34')]=_0x32200c[_0x6954('0x34')][_0x6954('0x35')]?_0x32200c[_0x6954('0x34')]:_0x526059[_0x6954('0x32')];if(!_0x28c5f4[_0x6954('0x2f')][_0x6954('0x36')](_0x6954('0x37'))){_0x32200c[_0x6954('0x20')]=qs[_0x6954('0x20')](_0x28c5f4[_0x6954('0x2f')][_0x6954('0x20')]);_0x32200c[_0x6954('0x1e')]=qs[_0x6954('0x1e')](_0x28c5f4['query']['offset']);}_0x32200c['order']=qs['sort'](_0x28c5f4['query']['sort']);_0x32200c[_0x6954('0x38')]=qs[_0x6954('0x39')](_[_0x6954('0x3a')](_0x28c5f4[_0x6954('0x2f')],_0x526059[_0x6954('0x39')]),_0x57bc36);if(_0x28c5f4[_0x6954('0x2f')]['filter']){_0x32200c[_0x6954('0x38')]=_[_0x6954('0x3b')](_0x32200c[_0x6954('0x38')],{'$or':_[_0x6954('0x2e')](_0x57bc36,function(_0x5ccbf3){if(_0x5ccbf3['type']!==_0x6954('0x3c')){var _0xa6dea4={};_0xa6dea4[_0x5ccbf3[_0x6954('0x28')]]={'$like':'%'+_0x28c5f4[_0x6954('0x2f')][_0x6954('0x3d')]+'%'};return _0xa6dea4;}})});}_0x32200c=_[_0x6954('0x3b')]({},_0x32200c,_0x28c5f4[_0x6954('0x3e')]);var _0x4e0dc2={'where':_0x32200c[_0x6954('0x38')]};return db[_0x6954('0x2a')][_0x6954('0x21')](_0x4e0dc2)[_0x6954('0x3f')](function(_0x4e5fed){_0x3e90e5[_0x6954('0x21')]=_0x4e5fed;if(_0x28c5f4[_0x6954('0x2f')][_0x6954('0x40')]){_0x32200c[_0x6954('0x41')]=[{'all':!![]}];}return db[_0x6954('0x2a')][_0x6954('0x42')](_0x32200c);})['then'](function(_0x2428f0){_0x3e90e5[_0x6954('0x43')]=_0x2428f0;return _0x3e90e5;})[_0x6954('0x3f')](respondWithFilteredResult(_0xdf552d,_0x32200c))[_0x6954('0x44')](handleError(_0xdf552d,null));};exports[_0x6954('0x45')]=function(_0x2e3b80,_0x3bacb7){var _0x1eda22={'raw':!![],'where':{'id':_0x2e3b80[_0x6954('0x46')]['id']}},_0x2ac1d4={};_0x2ac1d4['model']=_['keys'](db[_0x6954('0x2a')][_0x6954('0x47')]);_0x2ac1d4[_0x6954('0x2f')]=_[_0x6954('0x30')](_0x2e3b80[_0x6954('0x2f')]);_0x2ac1d4[_0x6954('0x39')]=_['intersection'](_0x2ac1d4[_0x6954('0x32')],_0x2ac1d4[_0x6954('0x2f')]);_0x1eda22[_0x6954('0x34')]=_['intersection'](_0x2ac1d4[_0x6954('0x32')],qs[_0x6954('0x33')](_0x2e3b80[_0x6954('0x2f')][_0x6954('0x33')]));_0x1eda22[_0x6954('0x34')]=_0x1eda22[_0x6954('0x34')]['length']?_0x1eda22[_0x6954('0x34')]:_0x2ac1d4[_0x6954('0x32')];if(_0x2e3b80[_0x6954('0x2f')][_0x6954('0x40')]){_0x1eda22[_0x6954('0x41')]=[{'all':!![]}];}_0x1eda22=_[_0x6954('0x3b')]({},_0x1eda22,_0x2e3b80[_0x6954('0x3e')]);return db[_0x6954('0x2a')][_0x6954('0x48')](_0x1eda22)['then'](handleEntityNotFound(_0x3bacb7,null))[_0x6954('0x3f')](respondWithResult(_0x3bacb7,null))[_0x6954('0x44')](handleError(_0x3bacb7,null));};exports['create']=function(_0x21b996,_0x2ef843){return db[_0x6954('0x2a')][_0x6954('0x49')](_0x21b996['body'],{})[_0x6954('0x3f')](respondWithResult(_0x2ef843,0xc9))[_0x6954('0x44')](handleError(_0x2ef843,null));};exports[_0x6954('0x24')]=function(_0x25a75d,_0x2b69ee){if(_0x25a75d[_0x6954('0x4a')]['id']){delete _0x25a75d['body']['id'];}return db[_0x6954('0x2a')][_0x6954('0x48')]({'where':{'id':_0x25a75d[_0x6954('0x46')]['id']}})[_0x6954('0x3f')](handleEntityNotFound(_0x2b69ee,null))[_0x6954('0x3f')](saveUpdates(_0x25a75d[_0x6954('0x4a')],null))[_0x6954('0x3f')](respondWithResult(_0x2b69ee,null))[_0x6954('0x44')](handleError(_0x2b69ee,null));};exports[_0x6954('0x25')]=function(_0xdd8cec,_0x325280){return db[_0x6954('0x2a')][_0x6954('0x48')]({'where':{'id':_0xdd8cec[_0x6954('0x46')]['id']}})[_0x6954('0x3f')](handleEntityNotFound(_0x325280,null))['then'](removeEntity(_0x325280,null))[_0x6954('0x44')](handleError(_0x325280,null));};
\ No newline at end of file
+var _0xbacf=['intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','sendStatus','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbacf,0xf9));var _0xfbac=function(_0x1b1f88,_0x3fe1cb){_0x1b1f88=_0x1b1f88-0x0;var _0x5045b9=_0xbacf[_0x1b1f88];return _0x5045b9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfbac('0x0'));var zipdir=require(_0xfbac('0x1'));var jsonpatch=require(_0xfbac('0x2'));var rp=require(_0xfbac('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xfbac('0x4'));var path=require(_0xfbac('0x5'));var sox=require(_0xfbac('0x6'));var csv=require(_0xfbac('0x7'));var ejs=require(_0xfbac('0x8'));var fs=require('fs');var fs_extra=require(_0xfbac('0x9'));var _=require(_0xfbac('0xa'));var squel=require(_0xfbac('0xb'));var crypto=require('crypto');var jsforce=require(_0xfbac('0xc'));var deskjs=require(_0xfbac('0xd'));var toCsv=require(_0xfbac('0x7'));var querystring=require(_0xfbac('0xe'));var Papa=require(_0xfbac('0xf'));var Redis=require(_0xfbac('0x10'));var authService=require(_0xfbac('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfbac('0x12'));var hardwareService=require(_0xfbac('0x13'));var logger=require(_0xfbac('0x14'))(_0xfbac('0x15'));var utils=require(_0xfbac('0x16'));var config=require(_0xfbac('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xfbac('0x18'))['db'];function respondWithStatusCode(_0x4a064f,_0x428383){_0x428383=_0x428383||0xcc;return function(_0x32eb83){if(_0x32eb83){return _0x4a064f['sendStatus'](_0x428383);}return _0x4a064f[_0xfbac('0x19')](_0x428383)['end']();};}function respondWithResult(_0x3d6a2a,_0x352949){_0x352949=_0x352949||0xc8;return function(_0x4bca33){if(_0x4bca33){return _0x3d6a2a[_0xfbac('0x19')](_0x352949)[_0xfbac('0x1a')](_0x4bca33);}};}function respondWithFilteredResult(_0x332f65,_0x5e33b6){return function(_0x47677e){if(_0x47677e){var _0x2ff9f0=typeof _0x5e33b6[_0xfbac('0x1b')]===_0xfbac('0x1c')&&typeof _0x5e33b6[_0xfbac('0x1d')]===_0xfbac('0x1c');var _0x599308=_0x47677e['count'];var _0x102efe=_0x2ff9f0?0x0:_0x5e33b6['offset'];var _0x204e08=_0x2ff9f0?_0x47677e[_0xfbac('0x1e')]:_0x5e33b6[_0xfbac('0x1b')]+_0x5e33b6['limit'];var _0xf00f57;if(_0x204e08>=_0x599308){_0x204e08=_0x599308;_0xf00f57=0xc8;}else{_0xf00f57=0xce;}_0x332f65[_0xfbac('0x19')](_0xf00f57);return _0x332f65[_0xfbac('0x1f')](_0xfbac('0x20'),_0x102efe+'-'+_0x204e08+'/'+_0x599308)[_0xfbac('0x1a')](_0x47677e);}return null;};}function patchUpdates(_0xbd964){return function(_0x15dbb8){try{jsonpatch['apply'](_0x15dbb8,_0xbd964,!![]);}catch(_0x2b17b8){return BPromise['reject'](_0x2b17b8);}return _0x15dbb8[_0xfbac('0x21')]();};}function saveUpdates(_0x1219bd,_0x12e56b){return function(_0x30ffa5){if(_0x30ffa5){return _0x30ffa5['update'](_0x1219bd)[_0xfbac('0x22')](function(_0x415eb3){return _0x415eb3;});}return null;};}function removeEntity(_0x4c535c,_0x15ac9a){return function(_0x27cf5e){if(_0x27cf5e){return _0x27cf5e[_0xfbac('0x23')]()[_0xfbac('0x22')](function(){_0x4c535c[_0xfbac('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1fc2fc,_0x4b3ef2){return function(_0x57f276){if(!_0x57f276){_0x1fc2fc[_0xfbac('0x24')](0x194);}return _0x57f276;};}function handleError(_0x486108,_0x52a31e){_0x52a31e=_0x52a31e||0x1f4;return function(_0x18831c){logger['error'](_0x18831c[_0xfbac('0x25')]);if(_0x18831c[_0xfbac('0x26')]){delete _0x18831c[_0xfbac('0x26')];}_0x486108['status'](_0x52a31e)[_0xfbac('0x27')](_0x18831c);};}exports[_0xfbac('0x28')]=function(_0x30dd0b,_0x44ffeb){var _0x17b7a9={},_0x470bbc={},_0x34224d={'count':0x0,'rows':[]};var _0x3c806b=_[_0xfbac('0x29')](db[_0xfbac('0x2a')][_0xfbac('0x2b')],function(_0xf008e7){return{'name':_0xf008e7[_0xfbac('0x2c')],'type':_0xf008e7[_0xfbac('0x2d')][_0xfbac('0x2e')]};});_0x470bbc[_0xfbac('0x2f')]=_['map'](_0x3c806b,'name');_0x470bbc[_0xfbac('0x30')]=_['keys'](_0x30dd0b[_0xfbac('0x30')]);_0x470bbc[_0xfbac('0x31')]=_['intersection'](_0x470bbc[_0xfbac('0x2f')],_0x470bbc[_0xfbac('0x30')]);_0x17b7a9[_0xfbac('0x32')]=_[_0xfbac('0x33')](_0x470bbc['model'],qs['fields'](_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x34')]));_0x17b7a9['attributes']=_0x17b7a9[_0xfbac('0x32')][_0xfbac('0x35')]?_0x17b7a9[_0xfbac('0x32')]:_0x470bbc[_0xfbac('0x2f')];if(!_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x36')](_0xfbac('0x37'))){_0x17b7a9[_0xfbac('0x1d')]=qs[_0xfbac('0x1d')](_0x30dd0b[_0xfbac('0x30')]['limit']);_0x17b7a9[_0xfbac('0x1b')]=qs['offset'](_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x1b')]);}_0x17b7a9[_0xfbac('0x38')]=qs[_0xfbac('0x39')](_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x39')]);_0x17b7a9[_0xfbac('0x3a')]=qs[_0xfbac('0x31')](_['pick'](_0x30dd0b[_0xfbac('0x30')],_0x470bbc[_0xfbac('0x31')]),_0x3c806b);if(_0x30dd0b[_0xfbac('0x30')]['filter']){_0x17b7a9[_0xfbac('0x3a')]=_[_0xfbac('0x3b')](_0x17b7a9[_0xfbac('0x3a')],{'$or':_[_0xfbac('0x29')](_0x3c806b,function(_0x348273){if(_0x348273[_0xfbac('0x2d')]!==_0xfbac('0x3c')){var _0x2ac26f={};_0x2ac26f[_0x348273[_0xfbac('0x26')]]={'$like':'%'+_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x3d')]+'%'};return _0x2ac26f;}})});}_0x17b7a9=_[_0xfbac('0x3b')]({},_0x17b7a9,_0x30dd0b[_0xfbac('0x3e')]);var _0x4ff06f={'where':_0x17b7a9['where']};return db['ZendeskField']['count'](_0x4ff06f)[_0xfbac('0x22')](function(_0x59a133){_0x34224d[_0xfbac('0x1e')]=_0x59a133;if(_0x30dd0b[_0xfbac('0x30')][_0xfbac('0x3f')]){_0x17b7a9[_0xfbac('0x40')]=[{'all':!![]}];}return db[_0xfbac('0x2a')][_0xfbac('0x41')](_0x17b7a9);})[_0xfbac('0x22')](function(_0x2e65d4){_0x34224d[_0xfbac('0x42')]=_0x2e65d4;return _0x34224d;})[_0xfbac('0x22')](respondWithFilteredResult(_0x44ffeb,_0x17b7a9))[_0xfbac('0x43')](handleError(_0x44ffeb,null));};exports[_0xfbac('0x44')]=function(_0x389e79,_0x51ef58){var _0x3b4c98={'raw':!![],'where':{'id':_0x389e79[_0xfbac('0x45')]['id']}},_0x21c3d1={};_0x21c3d1[_0xfbac('0x2f')]=_[_0xfbac('0x46')](db[_0xfbac('0x2a')][_0xfbac('0x2b')]);_0x21c3d1[_0xfbac('0x30')]=_[_0xfbac('0x46')](_0x389e79['query']);_0x21c3d1['filters']=_[_0xfbac('0x33')](_0x21c3d1[_0xfbac('0x2f')],_0x21c3d1[_0xfbac('0x30')]);_0x3b4c98[_0xfbac('0x32')]=_[_0xfbac('0x33')](_0x21c3d1[_0xfbac('0x2f')],qs[_0xfbac('0x34')](_0x389e79['query'][_0xfbac('0x34')]));_0x3b4c98['attributes']=_0x3b4c98[_0xfbac('0x32')][_0xfbac('0x35')]?_0x3b4c98[_0xfbac('0x32')]:_0x21c3d1[_0xfbac('0x2f')];if(_0x389e79['query'][_0xfbac('0x3f')]){_0x3b4c98[_0xfbac('0x40')]=[{'all':!![]}];}_0x3b4c98=_['merge']({},_0x3b4c98,_0x389e79['options']);return db['ZendeskField'][_0xfbac('0x47')](_0x3b4c98)[_0xfbac('0x22')](handleEntityNotFound(_0x51ef58,null))[_0xfbac('0x22')](respondWithResult(_0x51ef58,null))['catch'](handleError(_0x51ef58,null));};exports[_0xfbac('0x48')]=function(_0x1a2cc6,_0x1fd953){return db[_0xfbac('0x2a')][_0xfbac('0x48')](_0x1a2cc6[_0xfbac('0x49')],{})['then'](respondWithResult(_0x1fd953,0xc9))[_0xfbac('0x43')](handleError(_0x1fd953,null));};exports[_0xfbac('0x4a')]=function(_0x2e8296,_0x10e573){if(_0x2e8296[_0xfbac('0x49')]['id']){delete _0x2e8296[_0xfbac('0x49')]['id'];}return db[_0xfbac('0x2a')][_0xfbac('0x47')]({'where':{'id':_0x2e8296['params']['id']}})['then'](handleEntityNotFound(_0x10e573,null))['then'](saveUpdates(_0x2e8296[_0xfbac('0x49')],null))[_0xfbac('0x22')](respondWithResult(_0x10e573,null))['catch'](handleError(_0x10e573,null));};exports[_0xfbac('0x23')]=function(_0xfda925,_0x1e01e6){return db[_0xfbac('0x2a')][_0xfbac('0x47')]({'where':{'id':_0xfda925[_0xfbac('0x45')]['id']}})[_0xfbac('0x22')](handleEntityNotFound(_0x1e01e6,null))[_0xfbac('0x22')](removeEntity(_0x1e01e6,null))[_0xfbac('0x43')](handleError(_0x1e01e6,null));};
\ No newline at end of file
index 78c1a6e..9f038a5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe967=['FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define','zendesk_unique_index','idField'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe967,0x81));var _0x7e96=function(_0x5cfa6a,_0x4d69e8){_0x5cfa6a=_0x5cfa6a-0x0;var _0x204e10=_0xe967[_0x5cfa6a];return _0x204e10;};'use strict';var _=require(_0x7e96('0x0'));var util=require(_0x7e96('0x1'));var logger=require(_0x7e96('0x2'))(_0x7e96('0x3'));var moment=require(_0x7e96('0x4'));var BPromise=require(_0x7e96('0x5'));var rp=require(_0x7e96('0x6'));var fs=require('fs');var path=require(_0x7e96('0x7'));var rimraf=require(_0x7e96('0x8'));var config=require(_0x7e96('0x9'));var attributes=require(_0x7e96('0xa'));module[_0x7e96('0xb')]=function(_0x2d4298,_0x583926){return _0x2d4298[_0x7e96('0xc')]('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x7e96('0xd'),'fields':[_0x7e96('0xe'),_0x7e96('0xf')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa15c=['moment','bluebird','request-promise','path','../../config/environment','./intZendeskField.attributes','exports','ZendeskField','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','api'];(function(_0x22cf62,_0x538a68){var _0x2e47ae=function(_0x307542){while(--_0x307542){_0x22cf62['push'](_0x22cf62['shift']());}};_0x2e47ae(++_0x538a68);}(_0xa15c,0x6d));var _0xca15=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa15c[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xca15('0x0'));var util=require('util');var logger=require(_0xca15('0x1'))(_0xca15('0x2'));var moment=require(_0xca15('0x3'));var BPromise=require(_0xca15('0x4'));var rp=require(_0xca15('0x5'));var fs=require('fs');var path=require(_0xca15('0x6'));var rimraf=require('rimraf');var config=require(_0xca15('0x7'));var attributes=require(_0xca15('0x8'));module[_0xca15('0x9')]=function(_0x4b8f85,_0x48e680){return _0x4b8f85['define'](_0xca15('0xa'),attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0xca15('0xb'),'fields':[_0xca15('0xc'),_0xca15('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 21ad70c..b708b06 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba52=['jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x5cabac,_0x5ccb08){var _0x5f47b8=function(_0x1e478b){while(--_0x1e478b){_0x5cabac['push'](_0x5cabac['shift']());}};_0x5f47b8(++_0x5ccb08);}(_0xba52,0x143));var _0x2ba5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xba52[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x2ba5('0x0'));var moment=require(_0x2ba5('0x1'));var BPromise=require(_0x2ba5('0x2'));var rs=require(_0x2ba5('0x3'));var fs=require('fs');var Redis=require(_0x2ba5('0x4'));var db=require(_0x2ba5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ba5('0x6'));var jayson=require(_0x2ba5('0x7'));var client=jayson[_0x2ba5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22a954,_0x40d193,_0x2f98d0){return new BPromise(function(_0x3e93e9,_0xf812a6){return client[_0x2ba5('0x9')](_0x22a954,_0x2f98d0)[_0x2ba5('0xa')](function(_0x4264dc){logger[_0x2ba5('0xb')](_0x2ba5('0xc'),_0x40d193,'request\x20sent');logger[_0x2ba5('0xd')](_0x2ba5('0xe'),_0x40d193,_0x2ba5('0xf'),JSON[_0x2ba5('0x10')](_0x4264dc));if(_0x4264dc[_0x2ba5('0x11')]){if(_0x4264dc[_0x2ba5('0x11')][_0x2ba5('0x12')]===0x1f4){logger['error'](_0x2ba5('0xc'),_0x40d193,_0x4264dc[_0x2ba5('0x11')][_0x2ba5('0x13')]);return _0xf812a6(_0x4264dc[_0x2ba5('0x11')][_0x2ba5('0x13')]);}logger['error'](_0x2ba5('0xc'),_0x40d193,_0x4264dc['error']['message']);return _0x3e93e9(_0x4264dc['error']['message']);}else{logger[_0x2ba5('0xb')]('ZendeskField,\x20%s,\x20%s',_0x40d193,'request\x20sent');_0x3e93e9(_0x4264dc[_0x2ba5('0x14')][_0x2ba5('0x13')]);}})[_0x2ba5('0x15')](function(_0x10f6ae){logger[_0x2ba5('0x11')](_0x2ba5('0xc'),_0x40d193,_0x10f6ae);_0xf812a6(_0x10f6ae);});});}
\ No newline at end of file
+var _0x093e=['../../config/logger','jayson/promise','client','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5565da,_0x43315c){var _0x1d36c=function(_0x54b5b9){while(--_0x54b5b9){_0x5565da['push'](_0x5565da['shift']());}};_0x1d36c(++_0x43315c);}(_0x093e,0x1a8));var _0xe093=function(_0x30932d,_0x16928f){_0x30932d=_0x30932d-0x0;var _0x28a227=_0x093e[_0x30932d];return _0x28a227;};'use strict';var _=require(_0xe093('0x0'));var util=require(_0xe093('0x1'));var moment=require(_0xe093('0x2'));var BPromise=require(_0xe093('0x3'));var rs=require(_0xe093('0x4'));var fs=require('fs');var Redis=require(_0xe093('0x5'));var db=require(_0xe093('0x6'))['db'];var utils=require(_0xe093('0x7'));var logger=require(_0xe093('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe093('0x9'));var client=jayson[_0xe093('0xa')][_0xe093('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bb81a,_0x54d0b9,_0x3e3ca0){return new BPromise(function(_0xffb82e,_0x1e04dd){return client[_0xe093('0xc')](_0x3bb81a,_0x3e3ca0)[_0xe093('0xd')](function(_0x51b8cb){logger[_0xe093('0xe')](_0xe093('0xf'),_0x54d0b9,_0xe093('0x10'));logger[_0xe093('0x11')](_0xe093('0x12'),_0x54d0b9,'request\x20sent',JSON[_0xe093('0x13')](_0x51b8cb));if(_0x51b8cb[_0xe093('0x14')]){if(_0x51b8cb[_0xe093('0x14')]['code']===0x1f4){logger[_0xe093('0x14')](_0xe093('0xf'),_0x54d0b9,_0x51b8cb[_0xe093('0x14')][_0xe093('0x15')]);return _0x1e04dd(_0x51b8cb['error'][_0xe093('0x15')]);}logger[_0xe093('0x14')](_0xe093('0xf'),_0x54d0b9,_0x51b8cb[_0xe093('0x14')][_0xe093('0x15')]);return _0xffb82e(_0x51b8cb[_0xe093('0x14')][_0xe093('0x15')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x54d0b9,_0xe093('0x10'));_0xffb82e(_0x51b8cb[_0xe093('0x16')][_0xe093('0x15')]);}})[_0xe093('0x17')](function(_0x57d6c4){logger[_0xe093('0x14')](_0xe093('0xf'),_0x54d0b9,_0x57d6c4);_0x1e04dd(_0x57d6c4);});});}
\ No newline at end of file
index f1e8458..a576e2c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f2b=['isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1d75dc,_0x333bdd){var _0x8375ad=function(_0x571550){while(--_0x571550){_0x1d75dc['push'](_0x1d75dc['shift']());}};_0x8375ad(++_0x333bdd);}(_0x3f2b,0x13c));var _0xb3f2=function(_0x1bc41f,_0x2e6cd7){_0x1bc41f=_0x1bc41f-0x0;var _0x1f7025=_0x3f2b[_0x1bc41f];return _0x1f7025;};'use strict';var multer=require(_0xb3f2('0x0'));var util=require(_0xb3f2('0x1'));var path=require(_0xb3f2('0x2'));var timeout=require(_0xb3f2('0x3'));var express=require(_0xb3f2('0x4'));var router=express[_0xb3f2('0x5')]();var fs_extra=require(_0xb3f2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb3f2('0x7'));var config=require(_0xb3f2('0x8'));var controller=require('./intZohoAccount.controller');router['get']('/',auth[_0xb3f2('0x9')](),controller[_0xb3f2('0xa')]);router[_0xb3f2('0xb')](_0xb3f2('0xc'),auth[_0xb3f2('0x9')](),controller[_0xb3f2('0xd')]);router[_0xb3f2('0xb')]('/:id/configurations',auth[_0xb3f2('0x9')](),controller[_0xb3f2('0xe')]);router[_0xb3f2('0xb')](_0xb3f2('0xf'),auth[_0xb3f2('0x9')](),controller[_0xb3f2('0x10')]);router[_0xb3f2('0x11')]('/',auth[_0xb3f2('0x9')](),controller[_0xb3f2('0x12')]);router[_0xb3f2('0x11')](_0xb3f2('0x13'),auth[_0xb3f2('0x9')](),controller[_0xb3f2('0x14')]);router[_0xb3f2('0x15')](_0xb3f2('0xc'),auth[_0xb3f2('0x9')](),controller[_0xb3f2('0x16')]);router[_0xb3f2('0x17')]('/:id',auth[_0xb3f2('0x9')](),controller[_0xb3f2('0x18')]);module['exports']=router;
\ No newline at end of file
+var _0xca2d=['show','/:id/configurations','isAuthenticated','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoAccount.controller','index','get','/:id'];(function(_0x5293b5,_0x46a867){var _0x146ea5=function(_0x1e9a60){while(--_0x1e9a60){_0x5293b5['push'](_0x5293b5['shift']());}};_0x146ea5(++_0x46a867);}(_0xca2d,0x12d));var _0xdca2=function(_0x5a47de,_0x57a87c){_0x5a47de=_0x5a47de-0x0;var _0x400ee6=_0xca2d[_0x5a47de];return _0x400ee6;};'use strict';var multer=require(_0xdca2('0x0'));var util=require(_0xdca2('0x1'));var path=require('path');var timeout=require(_0xdca2('0x2'));var express=require(_0xdca2('0x3'));var router=express[_0xdca2('0x4')]();var fs_extra=require(_0xdca2('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdca2('0x6'));var controller=require(_0xdca2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xdca2('0x8')]);router[_0xdca2('0x9')](_0xdca2('0xa'),auth['isAuthenticated'](),controller[_0xdca2('0xb')]);router[_0xdca2('0x9')](_0xdca2('0xc'),auth[_0xdca2('0xd')](),controller[_0xdca2('0xe')]);router[_0xdca2('0x9')](_0xdca2('0xf'),auth[_0xdca2('0xd')](),controller[_0xdca2('0x10')]);router[_0xdca2('0x11')]('/',auth[_0xdca2('0xd')](),controller[_0xdca2('0x12')]);router[_0xdca2('0x11')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xdca2('0x13')]);router[_0xdca2('0x14')](_0xdca2('0xa'),auth[_0xdca2('0xd')](),controller[_0xdca2('0x15')]);router['delete']('/:id',auth[_0xdca2('0xd')](),controller[_0xdca2('0x16')]);module[_0xdca2('0x17')]=router;
\ No newline at end of file
index e6608c1..a84d638 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0bb=['exports','STRING','sequelize'];(function(_0x485feb,_0x4687f9){var _0x3013fd=function(_0x247283){while(--_0x247283){_0x485feb['push'](_0x485feb['shift']());}};_0x3013fd(++_0x4687f9);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x27188e,_0x2cb7b7){_0x27188e=_0x27188e-0x0;var _0x466456=_0xd0bb[_0x27188e];return _0x466456;};'use strict';var Sequelize=require(_0xbd0b('0x0'));module[_0xbd0b('0x1')]={'name':{'type':Sequelize[_0xbd0b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd0b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xbd0b('0x2')]},'clientSecret':{'type':Sequelize[_0xbd0b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xbd0b('0x2')]},'refreshToken':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xee5b=['sequelize','STRING'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3f7c57,_0x1cdc14){_0x3f7c57=_0x3f7c57-0x0;var _0x4795c6=_0xee5b[_0x3f7c57];return _0x4795c6;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xbee5('0x1')]},'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbee5('0x1')]},'clientId':{'type':Sequelize[_0xbee5('0x1')]},'clientSecret':{'type':Sequelize[_0xbee5('0x1')]},'serverUrl':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}};
\ No newline at end of file
index a5ed88a..ca278a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb137=['Call_Start_Time','remove','includes','api_name','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','limit','count','Content-Range','json','apply','reject','destroy','then','error','stack','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','name','ZohoAccount','includeAll','include','findAll','rows','catch','options','create','body','update','params','find','getConfigurations','findOne','ZohoConfiguration','filter','hasOwnProperty','AccountId','getSubjects','channel','getDescriptions','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientSecret','serverUrl','zoho.eu','com','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Subject','Description','WhoId','Call_Duration','Call_Result'];(function(_0x4ae01d,_0x555e0f){var _0x21eca0=function(_0x2e03e8){while(--_0x2e03e8){_0x4ae01d['push'](_0x4ae01d['shift']());}};_0x21eca0(++_0x555e0f);}(_0xb137,0x114));var _0x7b13=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0xb137[_0x59befa];return _0x1dd63d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7b13('0x0'));var zipdir=require(_0x7b13('0x1'));var jsonpatch=require(_0x7b13('0x2'));var rp=require(_0x7b13('0x3'));var moment=require('moment');var BPromise=require(_0x7b13('0x4'));var Mustache=require('mustache');var util=require(_0x7b13('0x5'));var path=require(_0x7b13('0x6'));var sox=require(_0x7b13('0x7'));var csv=require(_0x7b13('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7b13('0x9'));var squel=require(_0x7b13('0xa'));var crypto=require(_0x7b13('0xb'));var jsforce=require(_0x7b13('0xc'));var deskjs=require(_0x7b13('0xd'));var toCsv=require(_0x7b13('0x8'));var querystring=require(_0x7b13('0xe'));var Papa=require(_0x7b13('0xf'));var Redis=require(_0x7b13('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7b13('0x11'));var hardwareService=require(_0x7b13('0x12'));var logger=require(_0x7b13('0x13'))(_0x7b13('0x14'));var utils=require(_0x7b13('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7b13('0x16'));var db=require(_0x7b13('0x17'))['db'];var integrations=require(_0x7b13('0x18'));function respondWithStatusCode(_0x2a6b8d,_0x3eea62){_0x3eea62=_0x3eea62||0xcc;return function(_0x233b53){if(_0x233b53){return _0x2a6b8d[_0x7b13('0x19')](_0x3eea62);}return _0x2a6b8d[_0x7b13('0x1a')](_0x3eea62)[_0x7b13('0x1b')]();};}function respondWithResult(_0x4a231c,_0x59549e){_0x59549e=_0x59549e||0xc8;return function(_0x1fab2c){if(_0x1fab2c){return _0x4a231c[_0x7b13('0x1a')](_0x59549e)['json'](_0x1fab2c);}};}function respondWithFilteredResult(_0x325b65,_0x150a40){return function(_0x3f06f9){if(_0x3f06f9){var _0x193ddd=typeof _0x150a40['offset']===_0x7b13('0x1c')&&typeof _0x150a40[_0x7b13('0x1d')]===_0x7b13('0x1c');var _0x12b60d=_0x3f06f9[_0x7b13('0x1e')];var _0x1cde23=_0x193ddd?0x0:_0x150a40['offset'];var _0x8ec8c8=_0x193ddd?_0x3f06f9[_0x7b13('0x1e')]:_0x150a40['offset']+_0x150a40['limit'];var _0x539bd9;if(_0x8ec8c8>=_0x12b60d){_0x8ec8c8=_0x12b60d;_0x539bd9=0xc8;}else{_0x539bd9=0xce;}_0x325b65[_0x7b13('0x1a')](_0x539bd9);return _0x325b65['set'](_0x7b13('0x1f'),_0x1cde23+'-'+_0x8ec8c8+'/'+_0x12b60d)[_0x7b13('0x20')](_0x3f06f9);}return null;};}function patchUpdates(_0x2ee4e1){return function(_0x4cdbc4){try{jsonpatch[_0x7b13('0x21')](_0x4cdbc4,_0x2ee4e1,!![]);}catch(_0x4b6f01){return BPromise[_0x7b13('0x22')](_0x4b6f01);}return _0x4cdbc4['save']();};}function saveUpdates(_0xb3e089,_0x4a7052){return function(_0x418c10){if(_0x418c10){return _0x418c10['update'](_0xb3e089)['then'](function(_0x64bdd3){return _0x64bdd3;});}return null;};}function removeEntity(_0x18f6f6,_0x347224){return function(_0x342587){if(_0x342587){return _0x342587[_0x7b13('0x23')]()[_0x7b13('0x24')](function(){_0x18f6f6[_0x7b13('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31cf45,_0x1fb94f){return function(_0x2a0511){if(!_0x2a0511){_0x31cf45[_0x7b13('0x19')](0x194);}return _0x2a0511;};}function handleError(_0x2235ce,_0x3a20c4){_0x3a20c4=_0x3a20c4||0x1f4;return function(_0x3a9dc3){logger[_0x7b13('0x25')](_0x3a9dc3[_0x7b13('0x26')]);if(_0x3a9dc3['name']){delete _0x3a9dc3['name'];}_0x2235ce[_0x7b13('0x1a')](_0x3a20c4)[_0x7b13('0x27')](_0x3a9dc3);};}exports['index']=function(_0x4ac81e,_0x390d9f){var _0x4d0ab9={},_0x430c0f={},_0x22d786={'count':0x0,'rows':[]};var _0x52dab7=_[_0x7b13('0x28')](db['ZohoAccount'][_0x7b13('0x29')],function(_0x4140f9){return{'name':_0x4140f9[_0x7b13('0x2a')],'type':_0x4140f9[_0x7b13('0x2b')][_0x7b13('0x2c')]};});_0x430c0f[_0x7b13('0x2d')]=_['map'](_0x52dab7,'name');_0x430c0f[_0x7b13('0x2e')]=_[_0x7b13('0x2f')](_0x4ac81e[_0x7b13('0x2e')]);_0x430c0f[_0x7b13('0x30')]=_[_0x7b13('0x31')](_0x430c0f[_0x7b13('0x2d')],_0x430c0f[_0x7b13('0x2e')]);_0x4d0ab9[_0x7b13('0x32')]=_['intersection'](_0x430c0f[_0x7b13('0x2d')],qs['fields'](_0x4ac81e[_0x7b13('0x2e')][_0x7b13('0x33')]));_0x4d0ab9[_0x7b13('0x32')]=_0x4d0ab9['attributes'][_0x7b13('0x34')]?_0x4d0ab9['attributes']:_0x430c0f[_0x7b13('0x2d')];if(!_0x4ac81e[_0x7b13('0x2e')]['hasOwnProperty'](_0x7b13('0x35'))){_0x4d0ab9[_0x7b13('0x1d')]=qs[_0x7b13('0x1d')](_0x4ac81e[_0x7b13('0x2e')][_0x7b13('0x1d')]);_0x4d0ab9[_0x7b13('0x36')]=qs['offset'](_0x4ac81e[_0x7b13('0x2e')][_0x7b13('0x36')]);}_0x4d0ab9[_0x7b13('0x37')]=qs[_0x7b13('0x38')](_0x4ac81e[_0x7b13('0x2e')][_0x7b13('0x38')]);_0x4d0ab9[_0x7b13('0x39')]=qs[_0x7b13('0x30')](_[_0x7b13('0x3a')](_0x4ac81e[_0x7b13('0x2e')],_0x430c0f[_0x7b13('0x30')]),_0x52dab7);if(_0x4ac81e[_0x7b13('0x2e')]['filter']){_0x4d0ab9['where']=_[_0x7b13('0x3b')](_0x4d0ab9[_0x7b13('0x39')],{'$or':_[_0x7b13('0x28')](_0x52dab7,function(_0xa3690f){if(_0xa3690f[_0x7b13('0x2b')]!==_0x7b13('0x3c')){var _0xfc3bdb={};_0xfc3bdb[_0xa3690f[_0x7b13('0x3d')]]={'$like':'%'+_0x4ac81e[_0x7b13('0x2e')]['filter']+'%'};return _0xfc3bdb;}})});}_0x4d0ab9=_[_0x7b13('0x3b')]({},_0x4d0ab9,_0x4ac81e['options']);var _0x33a99d={'where':_0x4d0ab9['where']};return db[_0x7b13('0x3e')][_0x7b13('0x1e')](_0x33a99d)[_0x7b13('0x24')](function(_0x3e8937){_0x22d786[_0x7b13('0x1e')]=_0x3e8937;if(_0x4ac81e[_0x7b13('0x2e')][_0x7b13('0x3f')]){_0x4d0ab9[_0x7b13('0x40')]=[{'all':!![]}];}return db['ZohoAccount'][_0x7b13('0x41')](_0x4d0ab9);})[_0x7b13('0x24')](function(_0x22e057){_0x22d786[_0x7b13('0x42')]=_0x22e057;return _0x22d786;})[_0x7b13('0x24')](respondWithFilteredResult(_0x390d9f,_0x4d0ab9))[_0x7b13('0x43')](handleError(_0x390d9f,null));};exports['show']=function(_0x5adc2b,_0x1fac2c){var _0x1e2190={'raw':![],'where':{'id':_0x5adc2b['params']['id']}},_0x1b6bea={};_0x1b6bea['model']=_[_0x7b13('0x2f')](db[_0x7b13('0x3e')]['rawAttributes']);_0x1b6bea[_0x7b13('0x2e')]=_[_0x7b13('0x2f')](_0x5adc2b[_0x7b13('0x2e')]);_0x1b6bea[_0x7b13('0x30')]=_[_0x7b13('0x31')](_0x1b6bea[_0x7b13('0x2d')],_0x1b6bea[_0x7b13('0x2e')]);_0x1e2190[_0x7b13('0x32')]=_[_0x7b13('0x31')](_0x1b6bea['model'],qs['fields'](_0x5adc2b[_0x7b13('0x2e')]['fields']));_0x1e2190[_0x7b13('0x32')]=_0x1e2190['attributes']['length']?_0x1e2190[_0x7b13('0x32')]:_0x1b6bea[_0x7b13('0x2d')];if(_0x5adc2b[_0x7b13('0x2e')]['includeAll']){_0x1e2190['include']=[{'all':!![]}];}_0x1e2190=_[_0x7b13('0x3b')]({},_0x1e2190,_0x5adc2b[_0x7b13('0x44')]);return db[_0x7b13('0x3e')]['find'](_0x1e2190)[_0x7b13('0x24')](handleEntityNotFound(_0x1fac2c,null))[_0x7b13('0x24')](respondWithResult(_0x1fac2c,null))['catch'](handleError(_0x1fac2c,null));};exports['create']=function(_0x556e7f,_0x5c96a2){return db[_0x7b13('0x3e')][_0x7b13('0x45')](_0x556e7f[_0x7b13('0x46')],{})[_0x7b13('0x24')](respondWithResult(_0x5c96a2,0xc9))[_0x7b13('0x43')](handleError(_0x5c96a2,null));};exports[_0x7b13('0x47')]=function(_0x16eaf7,_0x5da566){if(_0x16eaf7[_0x7b13('0x46')]['id']){delete _0x16eaf7[_0x7b13('0x46')]['id'];}return db[_0x7b13('0x3e')]['find']({'where':{'id':_0x16eaf7[_0x7b13('0x48')]['id']}})[_0x7b13('0x24')](handleEntityNotFound(_0x5da566,null))[_0x7b13('0x24')](saveUpdates(_0x16eaf7[_0x7b13('0x46')],null))[_0x7b13('0x24')](respondWithResult(_0x5da566,null))[_0x7b13('0x43')](handleError(_0x5da566,null));};exports['destroy']=function(_0x4e112a,_0x330f7a){return db['ZohoAccount'][_0x7b13('0x49')]({'where':{'id':_0x4e112a[_0x7b13('0x48')]['id']}})[_0x7b13('0x24')](handleEntityNotFound(_0x330f7a,null))['then'](removeEntity(_0x330f7a,null))[_0x7b13('0x43')](handleError(_0x330f7a,null));};exports[_0x7b13('0x4a')]=function(_0x48db4b,_0x4651f4,_0x5b369a){var _0x2be170={};var _0x87babd={};var _0x29baf9;var _0x3a0a73;return db[_0x7b13('0x3e')][_0x7b13('0x4b')]({'where':{'id':_0x48db4b['params']['id']}})[_0x7b13('0x24')](handleEntityNotFound(_0x4651f4,null))[_0x7b13('0x24')](function(_0x3c60ff){if(_0x3c60ff){_0x29baf9=_0x3c60ff;_0x87babd['model']=_['keys'](db[_0x7b13('0x4c')][_0x7b13('0x29')]);_0x87babd['query']=_['keys'](_0x48db4b[_0x7b13('0x2e')]);_0x87babd[_0x7b13('0x30')]=_[_0x7b13('0x31')](_0x87babd[_0x7b13('0x2d')],_0x87babd[_0x7b13('0x2e')]);_0x2be170[_0x7b13('0x32')]=_['intersection'](_0x87babd['model'],qs[_0x7b13('0x33')](_0x48db4b[_0x7b13('0x2e')][_0x7b13('0x33')]));_0x2be170[_0x7b13('0x32')]=_0x2be170[_0x7b13('0x32')][_0x7b13('0x34')]?_0x2be170[_0x7b13('0x32')]:_0x87babd[_0x7b13('0x2d')];_0x2be170[_0x7b13('0x37')]=qs['sort'](_0x48db4b[_0x7b13('0x2e')][_0x7b13('0x38')]);_0x2be170[_0x7b13('0x39')]=qs[_0x7b13('0x30')](_[_0x7b13('0x3a')](_0x48db4b[_0x7b13('0x2e')],_0x87babd[_0x7b13('0x30')]));if(_0x48db4b[_0x7b13('0x2e')][_0x7b13('0x4d')]){_0x2be170[_0x7b13('0x39')]=_['merge'](_0x2be170[_0x7b13('0x39')],{'$or':_[_0x7b13('0x28')](_0x2be170['attributes'],function(_0x4680f1){var _0x468822={};_0x468822[_0x4680f1]={'$like':'%'+_0x48db4b[_0x7b13('0x2e')][_0x7b13('0x4d')]+'%'};return _0x468822;})});}_0x2be170=_[_0x7b13('0x3b')]({},_0x2be170,_0x48db4b[_0x7b13('0x44')]);return _0x29baf9[_0x7b13('0x4a')](_0x2be170);}})[_0x7b13('0x24')](function(_0xbddc4c){if(_0xbddc4c){_0x3a0a73=_0xbddc4c['length'];if(!_0x48db4b[_0x7b13('0x2e')][_0x7b13('0x4e')](_0x7b13('0x35'))){_0x2be170[_0x7b13('0x1d')]=qs['limit'](_0x48db4b[_0x7b13('0x2e')][_0x7b13('0x1d')]);_0x2be170['offset']=qs[_0x7b13('0x36')](_0x48db4b['query'][_0x7b13('0x36')]);}return _0x29baf9['getConfigurations'](_0x2be170);}})[_0x7b13('0x24')](function(_0x3abe31){if(_0x3abe31){return _0x3abe31?{'count':_0x3a0a73,'rows':_0x3abe31}:null;}})[_0x7b13('0x24')](respondWithResult(_0x4651f4,null))[_0x7b13('0x43')](handleError(_0x4651f4,null));};exports['addConfiguration']=function(_0x1f336d,_0x32b0dd,_0x498dea){if(_0x1f336d[_0x7b13('0x46')]['id']){delete _0x1f336d[_0x7b13('0x46')]['id'];}return db['ZohoAccount'][_0x7b13('0x4b')]({'where':{'id':_0x1f336d[_0x7b13('0x48')]['id']}})[_0x7b13('0x24')](handleEntityNotFound(_0x32b0dd,null))[_0x7b13('0x24')](function(_0x59741f){if(_0x59741f){_0x1f336d[_0x7b13('0x46')][_0x7b13('0x4f')]=_0x59741f['id'];_0x1f336d['body']['Subjects']=integrations[_0x7b13('0x50')](_0x1f336d['body'][_0x7b13('0x51')],_0x1f336d[_0x7b13('0x46')][_0x7b13('0x2b')]);_0x1f336d[_0x7b13('0x46')]['Descriptions']=integrations[_0x7b13('0x52')](_0x1f336d[_0x7b13('0x46')][_0x7b13('0x51')],_0x1f336d[_0x7b13('0x46')][_0x7b13('0x2b')]);return db[_0x7b13('0x4c')]['create'](_0x1f336d[_0x7b13('0x46')],{'include':[{'model':db[_0x7b13('0x53')],'as':_0x7b13('0x54')},{'model':db[_0x7b13('0x53')],'as':_0x7b13('0x55')}]});}return null;})[_0x7b13('0x24')](respondWithResult(_0x32b0dd,null))[_0x7b13('0x43')](handleError(_0x32b0dd,null));};function getAccessToken(_0x440a46){return new Promise(function(_0x3dbcfc,_0x3db513){var _0x33f2a5;switch(_0x440a46[_0x7b13('0x56')]){case'US':_0x33f2a5=_0x7b13('0x57');break;case'AU':_0x33f2a5=_0x7b13('0x58');break;case'EU':_0x33f2a5=_0x7b13('0x59');break;case'IN':_0x33f2a5=_0x7b13('0x5a');break;case'CN':_0x33f2a5=_0x7b13('0x5b');break;default:_0x33f2a5=_0x7b13('0x59');break;}var _0x538ecb={'method':_0x7b13('0x5c'),'uri':_0x33f2a5+_0x7b13('0x5d'),'qs':{'refresh_token':_0x440a46[_0x7b13('0x5e')],'client_id':_0x440a46[_0x7b13('0x5f')],'client_secret':_0x440a46['clientSecret'],'grant_type':_0x7b13('0x60')},'json':!![]};return rp(_0x538ecb)[_0x7b13('0x24')](function(_0x544553){if(_0x544553[_0x7b13('0x61')]){_0x3dbcfc(_0x544553['access_token']);}else{_0x3db513(_0x7b13('0x62'));}})['catch'](function(_0x2afc79){_0x3db513(_0x2afc79);});});}exports[_0x7b13('0x63')]=function(_0x27e6ad,_0x491fbc,_0x21fd9e){var _0x5bc74d,_0x465c84,_0x2c2da4,_0x93154b,_0x3b1aaf;return db[_0x7b13('0x3e')][_0x7b13('0x4b')]({'where':{'id':_0x27e6ad['params']['id']},'attributes':['id',_0x7b13('0x64'),_0x7b13('0x56'),_0x7b13('0x5f'),_0x7b13('0x65'),_0x7b13('0x66'),'code',_0x7b13('0x5e')]})['then'](handleEntityNotFound(_0x491fbc,null))['then'](function(_0x4cde52){_0x3b1aaf=_0x4cde52;_0x5bc74d=_0x3b1aaf['host'];_0x465c84=_0x5bc74d===_0x7b13('0x67')?'eu':_0x7b13('0x68');_0x2c2da4=_0x3b1aaf[_0x7b13('0x66')];var _0x377abe=_0x2c2da4['slice'](-0x1);if(_0x377abe==='/'||_0x377abe==='\x5c'||_0x377abe===':'){_0x2c2da4=_0x2c2da4['substring'](0x0,_0x2c2da4[_0x7b13('0x69')](_0x377abe));}if(!_0x3b1aaf['refreshToken']){throw new Error(_0x7b13('0x6a'));}return getAccessToken(_0x3b1aaf);})[_0x7b13('0x24')](function(_0x80173b){if(_0x80173b){return rp({'method':_0x7b13('0x6b'),'uri':util[_0x7b13('0x6c')](_0x7b13('0x6d'),_0x465c84),'qs':{'module':'Calls'},'headers':{'Authorization':_0x7b13('0x6e')+_0x80173b},'json':!![]});}})[_0x7b13('0x24')](function(_0x4cdb75){if(_0x4cdb75){if(_0x4cdb75['response']&&_0x4cdb75[_0x7b13('0x6f')]['error']){throw new Error(_0x4cdb75[_0x7b13('0x6f')][_0x7b13('0x25')]['message']);}var _0x3f4540=[];var _0x378935=[];var _0x21b48a=['Owner',_0x7b13('0x70'),_0x7b13('0x71'),_0x7b13('0x72'),_0x7b13('0x73'),_0x7b13('0x74'),_0x7b13('0x75'),'Call_Type'];_0x378935=_[_0x7b13('0x76')](_0x4cdb75[_0x7b13('0x33')],function(_0x3d9a10){return _0x21b48a[_0x7b13('0x77')](_0x3d9a10[_0x7b13('0x78')]);});for(var _0x30f554=0x0;_0x30f554<_0x378935['length'];_0x30f554++){if(_0x378935[_0x30f554]['system_mandatory']===![]){_0x3f4540[_0x7b13('0x79')]({'id':_0x378935[_0x30f554]['id'],'name':_0x378935[_0x30f554][_0x7b13('0x7a')],'custom':_0x378935[_0x30f554][_0x7b13('0x7b')],'options':_0x378935[_0x30f554][_0x7b13('0x7c')]===_0x7b13('0x7d')&&_0x378935[_0x30f554]['pick_list_values'][_0x7b13('0x34')]>-0x1?_[_0x7b13('0x28')](_0x378935[_0x30f554][_0x7b13('0x7e')],function(_0x410302){return{'name':_0x410302,'value':_0x410302};}):[]});}}return{'count':_0x3f4540[_0x7b13('0x34')],'rows':_0x3f4540};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x491fbc,null))[_0x7b13('0x43')](function(_0x5c0fba){var _0x4cabc1=_0x27e6ad['query'][_0x7b13('0x7f')]?0x1f4:_0x5c0fba[_0x7b13('0x80')]||0x1f4;logger[_0x7b13('0x25')](_0x7b13('0x81'),_0x7b13('0x63'),_0x4cabc1,JSON[_0x7b13('0x82')](_0x5c0fba));delete _0x5c0fba['name'];if(_0x4cabc1===0x191){_0x4cabc1=0x190;}_0x491fbc[_0x7b13('0x1a')](_0x4cabc1)[_0x7b13('0x27')](_0x27e6ad[_0x7b13('0x2e')][_0x7b13('0x7f')]?{'message':'Wrong\x20credentials','statusCode':_0x5c0fba[_0x7b13('0x80')]}:_0x5c0fba);});};
\ No newline at end of file
+var _0x55c7=['/oauth/v2/token','clientId','refresh_token','access_token','getFields','host','clientSecret','serverUrl','refreshToken','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Call_Duration','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','data_type','picklist','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','zip-dir','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','update','then','end','stack','name','index','map','rawAttributes','fieldName','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','ZohoAccount','findAll','catch','show','params','keys','fields','includeAll','find','body','destroy','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','create','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x55c7,0x1a3));var _0x755c=function(_0x400131,_0x49e447){_0x400131=_0x400131-0x0;var _0x2a3a2f=_0x55c7[_0x400131];return _0x2a3a2f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x755c('0x0'));var zipdir=require(_0x755c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x755c('0x2'));var Mustache=require(_0x755c('0x3'));var util=require('util');var path=require(_0x755c('0x4'));var sox=require(_0x755c('0x5'));var csv=require('to-csv');var ejs=require(_0x755c('0x6'));var fs=require('fs');var fs_extra=require(_0x755c('0x7'));var _=require(_0x755c('0x8'));var squel=require(_0x755c('0x9'));var crypto=require(_0x755c('0xa'));var jsforce=require(_0x755c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x755c('0xc'));var querystring=require('querystring');var Papa=require(_0x755c('0xd'));var Redis=require('ioredis');var authService=require(_0x755c('0xe'));var qs=require(_0x755c('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x755c('0x10'))('api');var utils=require(_0x755c('0x11'));var config=require(_0x755c('0x12'));var licenseUtil=require(_0x755c('0x13'));var db=require(_0x755c('0x14'))['db'];var integrations=require(_0x755c('0x15'));function respondWithStatusCode(_0x3daed7,_0x382f2c){_0x382f2c=_0x382f2c||0xcc;return function(_0x4afd80){if(_0x4afd80){return _0x3daed7[_0x755c('0x16')](_0x382f2c);}return _0x3daed7[_0x755c('0x17')](_0x382f2c)['end']();};}function respondWithResult(_0x2b7395,_0x17b508){_0x17b508=_0x17b508||0xc8;return function(_0x33c952){if(_0x33c952){return _0x2b7395[_0x755c('0x17')](_0x17b508)['json'](_0x33c952);}};}function respondWithFilteredResult(_0x22525e,_0x477b9f){return function(_0x4362d6){if(_0x4362d6){var _0x3de53e=typeof _0x477b9f[_0x755c('0x18')]===_0x755c('0x19')&&typeof _0x477b9f[_0x755c('0x1a')]===_0x755c('0x19');var _0x4638a1=_0x4362d6[_0x755c('0x1b')];var _0x4c36c8=_0x3de53e?0x0:_0x477b9f[_0x755c('0x18')];var _0xb32c01=_0x3de53e?_0x4362d6['count']:_0x477b9f[_0x755c('0x18')]+_0x477b9f[_0x755c('0x1a')];var _0x5cf47b;if(_0xb32c01>=_0x4638a1){_0xb32c01=_0x4638a1;_0x5cf47b=0xc8;}else{_0x5cf47b=0xce;}_0x22525e[_0x755c('0x17')](_0x5cf47b);return _0x22525e[_0x755c('0x1c')](_0x755c('0x1d'),_0x4c36c8+'-'+_0xb32c01+'/'+_0x4638a1)['json'](_0x4362d6);}return null;};}function patchUpdates(_0x4307cc){return function(_0x3bff9d){try{jsonpatch[_0x755c('0x1e')](_0x3bff9d,_0x4307cc,!![]);}catch(_0x5f32d7){return BPromise['reject'](_0x5f32d7);}return _0x3bff9d['save']();};}function saveUpdates(_0x43cf32,_0x24d711){return function(_0x5297a6){if(_0x5297a6){return _0x5297a6[_0x755c('0x1f')](_0x43cf32)[_0x755c('0x20')](function(_0x40a638){return _0x40a638;});}return null;};}function removeEntity(_0x15038b,_0x410867){return function(_0x2bb68b){if(_0x2bb68b){return _0x2bb68b['destroy']()[_0x755c('0x20')](function(){_0x15038b['status'](0xcc)[_0x755c('0x21')]();});}};}function handleEntityNotFound(_0x12e0aa,_0x54d2a1){return function(_0x1e7a5c){if(!_0x1e7a5c){_0x12e0aa[_0x755c('0x16')](0x194);}return _0x1e7a5c;};}function handleError(_0x4c5979,_0x2c367d){_0x2c367d=_0x2c367d||0x1f4;return function(_0x22f524){logger['error'](_0x22f524[_0x755c('0x22')]);if(_0x22f524['name']){delete _0x22f524[_0x755c('0x23')];}_0x4c5979[_0x755c('0x17')](_0x2c367d)['send'](_0x22f524);};}exports[_0x755c('0x24')]=function(_0x4dc1aa,_0x194118){var _0x4b9110={},_0xef5644={},_0xbd3da6={'count':0x0,'rows':[]};var _0x3fcdc3=_[_0x755c('0x25')](db['ZohoAccount'][_0x755c('0x26')],function(_0x55b1f1){return{'name':_0x55b1f1[_0x755c('0x27')],'type':_0x55b1f1['type']['key']};});_0xef5644['model']=_['map'](_0x3fcdc3,'name');_0xef5644[_0x755c('0x28')]=_['keys'](_0x4dc1aa['query']);_0xef5644[_0x755c('0x29')]=_[_0x755c('0x2a')](_0xef5644[_0x755c('0x2b')],_0xef5644[_0x755c('0x28')]);_0x4b9110[_0x755c('0x2c')]=_[_0x755c('0x2a')](_0xef5644[_0x755c('0x2b')],qs['fields'](_0x4dc1aa[_0x755c('0x28')]['fields']));_0x4b9110['attributes']=_0x4b9110[_0x755c('0x2c')][_0x755c('0x2d')]?_0x4b9110[_0x755c('0x2c')]:_0xef5644[_0x755c('0x2b')];if(!_0x4dc1aa[_0x755c('0x28')][_0x755c('0x2e')](_0x755c('0x2f'))){_0x4b9110['limit']=qs['limit'](_0x4dc1aa[_0x755c('0x28')]['limit']);_0x4b9110['offset']=qs[_0x755c('0x18')](_0x4dc1aa[_0x755c('0x28')]['offset']);}_0x4b9110[_0x755c('0x30')]=qs[_0x755c('0x31')](_0x4dc1aa['query'][_0x755c('0x31')]);_0x4b9110[_0x755c('0x32')]=qs[_0x755c('0x29')](_[_0x755c('0x33')](_0x4dc1aa[_0x755c('0x28')],_0xef5644[_0x755c('0x29')]),_0x3fcdc3);if(_0x4dc1aa[_0x755c('0x28')][_0x755c('0x34')]){_0x4b9110[_0x755c('0x32')]=_[_0x755c('0x35')](_0x4b9110[_0x755c('0x32')],{'$or':_[_0x755c('0x25')](_0x3fcdc3,function(_0xf852f3){if(_0xf852f3[_0x755c('0x36')]!==_0x755c('0x37')){var _0x1dffaf={};_0x1dffaf[_0xf852f3[_0x755c('0x23')]]={'$like':'%'+_0x4dc1aa[_0x755c('0x28')][_0x755c('0x34')]+'%'};return _0x1dffaf;}})});}_0x4b9110=_[_0x755c('0x35')]({},_0x4b9110,_0x4dc1aa[_0x755c('0x38')]);var _0x323863={'where':_0x4b9110[_0x755c('0x32')]};return db[_0x755c('0x39')]['count'](_0x323863)[_0x755c('0x20')](function(_0x23308d){_0xbd3da6['count']=_0x23308d;if(_0x4dc1aa[_0x755c('0x28')]['includeAll']){_0x4b9110['include']=[{'all':!![]}];}return db[_0x755c('0x39')][_0x755c('0x3a')](_0x4b9110);})[_0x755c('0x20')](function(_0x1bf696){_0xbd3da6['rows']=_0x1bf696;return _0xbd3da6;})[_0x755c('0x20')](respondWithFilteredResult(_0x194118,_0x4b9110))[_0x755c('0x3b')](handleError(_0x194118,null));};exports[_0x755c('0x3c')]=function(_0x4fb9ce,_0x31fada){var _0x85601={'raw':![],'where':{'id':_0x4fb9ce[_0x755c('0x3d')]['id']}},_0x18779c={};_0x18779c['model']=_['keys'](db[_0x755c('0x39')]['rawAttributes']);_0x18779c[_0x755c('0x28')]=_[_0x755c('0x3e')](_0x4fb9ce[_0x755c('0x28')]);_0x18779c[_0x755c('0x29')]=_['intersection'](_0x18779c[_0x755c('0x2b')],_0x18779c['query']);_0x85601[_0x755c('0x2c')]=_['intersection'](_0x18779c['model'],qs['fields'](_0x4fb9ce[_0x755c('0x28')][_0x755c('0x3f')]));_0x85601[_0x755c('0x2c')]=_0x85601['attributes']['length']?_0x85601[_0x755c('0x2c')]:_0x18779c[_0x755c('0x2b')];if(_0x4fb9ce[_0x755c('0x28')][_0x755c('0x40')]){_0x85601['include']=[{'all':!![]}];}_0x85601=_[_0x755c('0x35')]({},_0x85601,_0x4fb9ce[_0x755c('0x38')]);return db[_0x755c('0x39')][_0x755c('0x41')](_0x85601)[_0x755c('0x20')](handleEntityNotFound(_0x31fada,null))[_0x755c('0x20')](respondWithResult(_0x31fada,null))[_0x755c('0x3b')](handleError(_0x31fada,null));};exports['create']=function(_0x69c3d1,_0x3f93fe){return db[_0x755c('0x39')]['create'](_0x69c3d1[_0x755c('0x42')],{})[_0x755c('0x20')](respondWithResult(_0x3f93fe,0xc9))[_0x755c('0x3b')](handleError(_0x3f93fe,null));};exports[_0x755c('0x1f')]=function(_0xab832,_0x5313cd){if(_0xab832[_0x755c('0x42')]['id']){delete _0xab832[_0x755c('0x42')]['id'];}return db['ZohoAccount'][_0x755c('0x41')]({'where':{'id':_0xab832['params']['id']}})[_0x755c('0x20')](handleEntityNotFound(_0x5313cd,null))[_0x755c('0x20')](saveUpdates(_0xab832['body'],null))[_0x755c('0x20')](respondWithResult(_0x5313cd,null))[_0x755c('0x3b')](handleError(_0x5313cd,null));};exports[_0x755c('0x43')]=function(_0x583323,_0x3309da){return db[_0x755c('0x39')][_0x755c('0x41')]({'where':{'id':_0x583323['params']['id']}})['then'](handleEntityNotFound(_0x3309da,null))[_0x755c('0x20')](removeEntity(_0x3309da,null))[_0x755c('0x3b')](handleError(_0x3309da,null));};exports['getConfigurations']=function(_0x4f3271,_0x564557,_0x5bdd15){var _0x59c7a7={};var _0x280c4b={};var _0xda5bf5;var _0xbb6d38;return db[_0x755c('0x39')][_0x755c('0x44')]({'where':{'id':_0x4f3271[_0x755c('0x3d')]['id']}})[_0x755c('0x20')](handleEntityNotFound(_0x564557,null))[_0x755c('0x20')](function(_0x1b9bec){if(_0x1b9bec){_0xda5bf5=_0x1b9bec;_0x280c4b[_0x755c('0x2b')]=_[_0x755c('0x3e')](db[_0x755c('0x45')][_0x755c('0x26')]);_0x280c4b[_0x755c('0x28')]=_[_0x755c('0x3e')](_0x4f3271[_0x755c('0x28')]);_0x280c4b[_0x755c('0x29')]=_[_0x755c('0x2a')](_0x280c4b[_0x755c('0x2b')],_0x280c4b[_0x755c('0x28')]);_0x59c7a7['attributes']=_[_0x755c('0x2a')](_0x280c4b[_0x755c('0x2b')],qs[_0x755c('0x3f')](_0x4f3271[_0x755c('0x28')][_0x755c('0x3f')]));_0x59c7a7[_0x755c('0x2c')]=_0x59c7a7[_0x755c('0x2c')]['length']?_0x59c7a7[_0x755c('0x2c')]:_0x280c4b[_0x755c('0x2b')];_0x59c7a7['order']=qs['sort'](_0x4f3271[_0x755c('0x28')][_0x755c('0x31')]);_0x59c7a7[_0x755c('0x32')]=qs[_0x755c('0x29')](_[_0x755c('0x33')](_0x4f3271[_0x755c('0x28')],_0x280c4b[_0x755c('0x29')]));if(_0x4f3271[_0x755c('0x28')]['filter']){_0x59c7a7[_0x755c('0x32')]=_[_0x755c('0x35')](_0x59c7a7[_0x755c('0x32')],{'$or':_[_0x755c('0x25')](_0x59c7a7[_0x755c('0x2c')],function(_0x214701){var _0x3ebd55={};_0x3ebd55[_0x214701]={'$like':'%'+_0x4f3271['query'][_0x755c('0x34')]+'%'};return _0x3ebd55;})});}_0x59c7a7=_[_0x755c('0x35')]({},_0x59c7a7,_0x4f3271[_0x755c('0x38')]);return _0xda5bf5['getConfigurations'](_0x59c7a7);}})[_0x755c('0x20')](function(_0x1f5c96){if(_0x1f5c96){_0xbb6d38=_0x1f5c96['length'];if(!_0x4f3271[_0x755c('0x28')][_0x755c('0x2e')](_0x755c('0x2f'))){_0x59c7a7['limit']=qs[_0x755c('0x1a')](_0x4f3271['query'][_0x755c('0x1a')]);_0x59c7a7[_0x755c('0x18')]=qs[_0x755c('0x18')](_0x4f3271[_0x755c('0x28')]['offset']);}return _0xda5bf5[_0x755c('0x46')](_0x59c7a7);}})[_0x755c('0x20')](function(_0x3b8395){if(_0x3b8395){return _0x3b8395?{'count':_0xbb6d38,'rows':_0x3b8395}:null;}})[_0x755c('0x20')](respondWithResult(_0x564557,null))['catch'](handleError(_0x564557,null));};exports[_0x755c('0x47')]=function(_0x271d5e,_0x748f45,_0xedf0e0){if(_0x271d5e[_0x755c('0x42')]['id']){delete _0x271d5e[_0x755c('0x42')]['id'];}return db[_0x755c('0x39')][_0x755c('0x44')]({'where':{'id':_0x271d5e[_0x755c('0x3d')]['id']}})[_0x755c('0x20')](handleEntityNotFound(_0x748f45,null))[_0x755c('0x20')](function(_0x5a40f9){if(_0x5a40f9){_0x271d5e['body'][_0x755c('0x48')]=_0x5a40f9['id'];_0x271d5e['body'][_0x755c('0x49')]=integrations[_0x755c('0x4a')](_0x271d5e[_0x755c('0x42')]['channel'],_0x271d5e[_0x755c('0x42')][_0x755c('0x36')]);_0x271d5e[_0x755c('0x42')][_0x755c('0x4b')]=integrations[_0x755c('0x4c')](_0x271d5e[_0x755c('0x42')][_0x755c('0x4d')],_0x271d5e[_0x755c('0x42')][_0x755c('0x36')]);return db[_0x755c('0x45')][_0x755c('0x4e')](_0x271d5e[_0x755c('0x42')],{'include':[{'model':db[_0x755c('0x4f')],'as':'Subjects'},{'model':db[_0x755c('0x4f')],'as':_0x755c('0x4b')}]});}return null;})[_0x755c('0x20')](respondWithResult(_0x748f45,null))['catch'](handleError(_0x748f45,null));};function getAccessToken(_0x1cdeec){return new Promise(function(_0x586e6b,_0x11dc5c){var _0x3f5462;switch(_0x1cdeec[_0x755c('0x50')]){case'US':_0x3f5462=_0x755c('0x51');break;case'AU':_0x3f5462='https://accounts.zoho.com.au';break;case'EU':_0x3f5462=_0x755c('0x52');break;case'IN':_0x3f5462='https://accounts.zoho.in';break;case'CN':_0x3f5462=_0x755c('0x53');break;default:_0x3f5462=_0x755c('0x52');break;}var _0x5bee16={'method':_0x755c('0x54'),'uri':_0x3f5462+_0x755c('0x55'),'qs':{'refresh_token':_0x1cdeec['refreshToken'],'client_id':_0x1cdeec[_0x755c('0x56')],'client_secret':_0x1cdeec['clientSecret'],'grant_type':_0x755c('0x57')},'json':!![]};return rp(_0x5bee16)[_0x755c('0x20')](function(_0x2a1b09){if(_0x2a1b09[_0x755c('0x58')]){_0x586e6b(_0x2a1b09[_0x755c('0x58')]);}else{_0x11dc5c('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x755c('0x3b')](function(_0x5e39c4){_0x11dc5c(_0x5e39c4);});});}exports[_0x755c('0x59')]=function(_0x5cfde4,_0x1e70e4,_0x27ac19){var _0x1fdcab,_0x2bd928,_0x4ecbae,_0x19e88d,_0x1951b2;return db['ZohoAccount'][_0x755c('0x44')]({'where':{'id':_0x5cfde4['params']['id']},'attributes':['id',_0x755c('0x5a'),_0x755c('0x50'),_0x755c('0x56'),_0x755c('0x5b'),_0x755c('0x5c'),'code',_0x755c('0x5d')]})['then'](handleEntityNotFound(_0x1e70e4,null))['then'](function(_0x186c08){_0x1951b2=_0x186c08;_0x1fdcab=_0x1951b2['host'];_0x2bd928=_0x1fdcab===_0x755c('0x5e')?'eu':_0x755c('0x5f');_0x4ecbae=_0x1951b2[_0x755c('0x5c')];var _0x17e1c7=_0x4ecbae[_0x755c('0x60')](-0x1);if(_0x17e1c7==='/'||_0x17e1c7==='\x5c'||_0x17e1c7===':'){_0x4ecbae=_0x4ecbae[_0x755c('0x61')](0x0,_0x4ecbae[_0x755c('0x62')](_0x17e1c7));}if(!_0x1951b2['refreshToken']){throw new Error(_0x755c('0x63'));}return getAccessToken(_0x1951b2);})['then'](function(_0x7101fe){if(_0x7101fe){return rp({'method':_0x755c('0x64'),'uri':util[_0x755c('0x65')](_0x755c('0x66'),_0x2bd928),'qs':{'module':_0x755c('0x67')},'headers':{'Authorization':_0x755c('0x68')+_0x7101fe},'json':!![]});}})[_0x755c('0x20')](function(_0x5697c3){if(_0x5697c3){if(_0x5697c3[_0x755c('0x69')]&&_0x5697c3[_0x755c('0x69')][_0x755c('0x6a')]){throw new Error(_0x5697c3[_0x755c('0x69')][_0x755c('0x6a')][_0x755c('0x6b')]);}var _0x496776=[];var _0x1452ad=[];var _0x4b0a97=[_0x755c('0x6c'),_0x755c('0x6d'),'Description','WhoId',_0x755c('0x6e'),_0x755c('0x6f'),'Call_Start_Time',_0x755c('0x70')];_0x1452ad=_[_0x755c('0x71')](_0x5697c3[_0x755c('0x3f')],function(_0x2c3067){return _0x4b0a97['includes'](_0x2c3067[_0x755c('0x72')]);});for(var _0x1b07b2=0x0;_0x1b07b2<_0x1452ad[_0x755c('0x2d')];_0x1b07b2++){if(_0x1452ad[_0x1b07b2][_0x755c('0x73')]===![]){_0x496776[_0x755c('0x74')]({'id':_0x1452ad[_0x1b07b2]['id'],'name':_0x1452ad[_0x1b07b2][_0x755c('0x75')],'custom':_0x1452ad[_0x1b07b2]['custom_field'],'options':_0x1452ad[_0x1b07b2][_0x755c('0x76')]===_0x755c('0x77')&&_0x1452ad[_0x1b07b2]['pick_list_values'][_0x755c('0x2d')]>-0x1?_[_0x755c('0x25')](_0x1452ad[_0x1b07b2]['pick_list_values'],function(_0x4682da){return{'name':_0x4682da,'value':_0x4682da};}):[]});}}return{'count':_0x496776[_0x755c('0x2d')],'rows':_0x496776};}else{return{'count':0x0,'rows':[]};}})[_0x755c('0x20')](respondWithResult(_0x1e70e4,null))['catch'](function(_0x1407ff){var _0x22b75b=_0x5cfde4[_0x755c('0x28')][_0x755c('0x78')]?0x1f4:_0x1407ff[_0x755c('0x79')]||0x1f4;logger['error'](_0x755c('0x7a'),_0x755c('0x59'),_0x22b75b,JSON[_0x755c('0x7b')](_0x1407ff));delete _0x1407ff[_0x755c('0x23')];if(_0x22b75b===0x191){_0x22b75b=0x190;}_0x1e70e4[_0x755c('0x17')](_0x22b75b)[_0x755c('0x7c')](_0x5cfde4[_0x755c('0x28')][_0x755c('0x78')]?{'message':_0x755c('0x7d'),'statusCode':_0x1407ff[_0x755c('0x79')]}:_0x1407ff);});};
\ No newline at end of file
index 4ad3830..3bb2233 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf5bb=['refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','substring','https://accounts.zoho.com.cn','refresh_token','catch','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','host','lastIndexOf','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','code','application/x-www-form-urlencoded','then'];(function(_0x23b84c,_0x2d96c6){var _0x5af3f1=function(_0x2844de){while(--_0x2844de){_0x23b84c['push'](_0x23b84c['shift']());}};_0x5af3f1(++_0x2d96c6);}(_0xf5bb,0xde));var _0xbf5b=function(_0x38eb30,_0x85c5d2){_0x38eb30=_0x38eb30-0x0;var _0x4d56cb=_0xf5bb[_0x38eb30];return _0x4d56cb;};'use strict';var _=require('lodash');var util=require(_0xbf5b('0x0'));var logger=require(_0xbf5b('0x1'))('api');var moment=require(_0xbf5b('0x2'));var BPromise=require(_0xbf5b('0x3'));var rp=require(_0xbf5b('0x4'));var fs=require('fs');var path=require(_0xbf5b('0x5'));var rimraf=require(_0xbf5b('0x6'));var config=require(_0xbf5b('0x7'));var attributes=require(_0xbf5b('0x8'));var integrations=require(_0xbf5b('0x9'));module[_0xbf5b('0xa')]=function(_0x485f1e,_0x2deee0){return _0x485f1e[_0xbf5b('0xb')](_0xbf5b('0xc'),attributes,{'tableName':_0xbf5b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2bde75,_0x41782a,_0x3eaeb8){if(_0x2bde75[_0xbf5b('0xe')]('zone')||_0x2bde75[_0xbf5b('0xe')](_0xbf5b('0xf'))||_0x2bde75[_0xbf5b('0xe')](_0xbf5b('0x10'))||_0x2bde75[_0xbf5b('0xe')](_0xbf5b('0x11'))||_0x2bde75[_0xbf5b('0xe')]('code')||_0x2bde75[_0xbf5b('0xe')](_0xbf5b('0x12'))){var _0x312b85,_0x275c98;_0x312b85=_0x2bde75[_0xbf5b('0xf')];var _0x23725f=_0x312b85['slice'](-0x1);if(_0x23725f==='/'||_0x23725f==='\x5c'||_0x23725f===':'){_0x312b85=_0x312b85['substring'](0x0,_0x312b85[_0xbf5b('0x13')](_0x23725f));}switch(_0x2bde75[_0xbf5b('0x14')]){case'US':_0x275c98='https://accounts.zoho.com';break;case'AU':_0x275c98=_0xbf5b('0x15');break;case'IN':_0x275c98=_0xbf5b('0x16');break;case'CN':_0x275c98='https://accounts.zoho.com.cn';break;default:_0x275c98=_0xbf5b('0x17');break;}var _0x3b8986={'method':_0xbf5b('0x18'),'uri':_0x275c98+_0xbf5b('0x19'),'form':{'grant_type':_0xbf5b('0x1a'),'client_id':_0x2bde75[_0xbf5b('0x10')],'client_secret':_0x2bde75[_0xbf5b('0x11')],'redirect_uri':_0x2bde75[_0xbf5b('0xf')],'code':_0x2bde75[_0xbf5b('0x1b')]},'headers':{'Content-Type':_0xbf5b('0x1c')}};return rp(_0x3b8986)[_0xbf5b('0x1d')](function(_0x461460){var _0x4e7b5a=JSON['parse'](_0x461460);if(_0x4e7b5a['refresh_token']){_0x2bde75[_0xbf5b('0x1e')]=_0x4e7b5a['refresh_token'];logger[_0xbf5b('0x1f')](util[_0xbf5b('0x20')](_0xbf5b('0x21'),_0x2bde75[_0xbf5b('0x22')],_0x2bde75['id']));}else{logger[_0xbf5b('0x23')](util[_0xbf5b('0x20')](_0xbf5b('0x24'),_0x2bde75[_0xbf5b('0x22')],_0x2bde75['id']),util['inspect'](_0x4e7b5a,{'showHidden':![],'depth':null}));}return _0x3eaeb8(null,_0x41782a);})['catch'](function(_0x1b4a58){logger[_0xbf5b('0x23')](util[_0xbf5b('0x20')](_0xbf5b('0x24'),_0x2bde75[_0xbf5b('0x22')],_0x2bde75['id']),util[_0xbf5b('0x25')](parsedResult,{'showHidden':![],'depth':null}));return _0x3eaeb8(_0x1b4a58);});}else{return _0x3eaeb8(null,_0x41782a);}},'beforeUpdate':function(_0x3b5db1,_0x4752c0,_0x1c1431){if(_0x3b5db1['changed']('zone')||_0x3b5db1[_0xbf5b('0xe')](_0xbf5b('0xf'))||_0x3b5db1[_0xbf5b('0xe')]('clientId')||_0x3b5db1['changed']('clientSecret')||_0x3b5db1[_0xbf5b('0xe')]('code')||_0x3b5db1['changed'](_0xbf5b('0x12'))){var _0x49da6c,_0x3caba5;_0x49da6c=_0x3b5db1['serverUrl'];var _0x47f7a1=_0x49da6c['slice'](-0x1);if(_0x47f7a1==='/'||_0x47f7a1==='\x5c'||_0x47f7a1===':'){_0x49da6c=_0x49da6c[_0xbf5b('0x26')](0x0,_0x49da6c[_0xbf5b('0x13')](_0x47f7a1));}switch(_0x3b5db1['zone']){case'US':_0x3caba5='https://accounts.zoho.com';break;case'AU':_0x3caba5=_0xbf5b('0x15');break;case'IN':_0x3caba5=_0xbf5b('0x16');break;case'CN':_0x3caba5=_0xbf5b('0x27');break;default:_0x3caba5=_0xbf5b('0x17');break;}var _0x4b6a21={'method':_0xbf5b('0x18'),'uri':_0x3caba5+_0xbf5b('0x19'),'form':{'grant_type':_0xbf5b('0x1a'),'client_id':_0x3b5db1['clientId'],'client_secret':_0x3b5db1[_0xbf5b('0x11')],'redirect_uri':_0x3b5db1[_0xbf5b('0xf')],'code':_0x3b5db1[_0xbf5b('0x1b')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x4b6a21)['then'](function(_0x574ca7){var _0x4bbfe8=JSON['parse'](_0x574ca7);if(_0x4bbfe8[_0xbf5b('0x28')]){_0x3b5db1[_0xbf5b('0x1e')]=_0x4bbfe8[_0xbf5b('0x28')];logger[_0xbf5b('0x1f')](util[_0xbf5b('0x20')](_0xbf5b('0x21'),_0x3b5db1['name'],_0x3b5db1['id']));}else{logger[_0xbf5b('0x23')](util[_0xbf5b('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3b5db1[_0xbf5b('0x22')],_0x3b5db1['id']),util[_0xbf5b('0x25')](_0x4bbfe8,{'showHidden':![],'depth':null}));}return _0x1c1431(null,_0x4752c0);})[_0xbf5b('0x29')](function(_0x1529a9){logger['error'](util[_0xbf5b('0x20')](_0xbf5b('0x24'),_0x3b5db1[_0xbf5b('0x22')],_0x3b5db1['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1c1431(_0x1529a9);});}else{return _0x1c1431(null,_0x4752c0);}}}});};
\ No newline at end of file
+var _0xf788=['authorization_code','application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','serverUrl','host','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','exports','define','ZohoAccount','int_zoho_accounts','changed','clientId','clientSecret','code','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token'];(function(_0x14def5,_0x45ad02){var _0x23f6fd=function(_0x45bb35){while(--_0x45bb35){_0x14def5['push'](_0x14def5['shift']());}};_0x23f6fd(++_0x45ad02);}(_0xf788,0x195));var _0x8f78=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xf788[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x8f78('0x0'));var util=require(_0x8f78('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8f78('0x2'));var BPromise=require(_0x8f78('0x3'));var rp=require(_0x8f78('0x4'));var fs=require('fs');var path=require(_0x8f78('0x5'));var rimraf=require(_0x8f78('0x6'));var config=require(_0x8f78('0x7'));var attributes=require(_0x8f78('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x8f78('0x9')]=function(_0x149c2e,_0x55921e){return _0x149c2e[_0x8f78('0xa')](_0x8f78('0xb'),attributes,{'tableName':_0x8f78('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4b3e03,_0x4b61d6,_0x379c5a){if(_0x4b3e03['changed']('zone')||_0x4b3e03[_0x8f78('0xd')]('serverUrl')||_0x4b3e03['changed'](_0x8f78('0xe'))||_0x4b3e03['changed'](_0x8f78('0xf'))||_0x4b3e03['changed'](_0x8f78('0x10'))||_0x4b3e03[_0x8f78('0xd')]('host')){var _0x3805be,_0x14fba5;_0x3805be=_0x4b3e03['serverUrl'];var _0x385fce=_0x3805be[_0x8f78('0x11')](-0x1);if(_0x385fce==='/'||_0x385fce==='\x5c'||_0x385fce===':'){_0x3805be=_0x3805be[_0x8f78('0x12')](0x0,_0x3805be[_0x8f78('0x13')](_0x385fce));}switch(_0x4b3e03['zone']){case'US':_0x14fba5=_0x8f78('0x14');break;case'AU':_0x14fba5='https://accounts.zoho.com.au';break;case'IN':_0x14fba5='https://accounts.zoho.in';break;case'CN':_0x14fba5=_0x8f78('0x15');break;default:_0x14fba5=_0x8f78('0x16');break;}var _0xad0496={'method':_0x8f78('0x17'),'uri':_0x14fba5+_0x8f78('0x18'),'form':{'grant_type':_0x8f78('0x19'),'client_id':_0x4b3e03[_0x8f78('0xe')],'client_secret':_0x4b3e03[_0x8f78('0xf')],'redirect_uri':_0x4b3e03['serverUrl'],'code':_0x4b3e03['code']},'headers':{'Content-Type':_0x8f78('0x1a')}};return rp(_0xad0496)[_0x8f78('0x1b')](function(_0x1666f4){var _0x181747=JSON[_0x8f78('0x1c')](_0x1666f4);if(_0x181747[_0x8f78('0x1d')]){_0x4b3e03[_0x8f78('0x1e')]=_0x181747[_0x8f78('0x1d')];logger[_0x8f78('0x1f')](util[_0x8f78('0x20')](_0x8f78('0x21'),_0x4b3e03[_0x8f78('0x22')],_0x4b3e03['id']));}else{logger[_0x8f78('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4b3e03[_0x8f78('0x22')],_0x4b3e03['id']),util[_0x8f78('0x24')](_0x181747,{'showHidden':![],'depth':null}));}return _0x379c5a(null,_0x4b61d6);})['catch'](function(_0x3121d0){logger[_0x8f78('0x23')](util[_0x8f78('0x20')](_0x8f78('0x25'),_0x4b3e03[_0x8f78('0x22')],_0x4b3e03['id']),util[_0x8f78('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x379c5a(_0x3121d0);});}else{return _0x379c5a(null,_0x4b61d6);}},'beforeUpdate':function(_0x304e0c,_0x30c2be,_0x105f4c){if(_0x304e0c[_0x8f78('0xd')]('zone')||_0x304e0c['changed'](_0x8f78('0x26'))||_0x304e0c['changed'](_0x8f78('0xe'))||_0x304e0c[_0x8f78('0xd')](_0x8f78('0xf'))||_0x304e0c[_0x8f78('0xd')](_0x8f78('0x10'))||_0x304e0c['changed'](_0x8f78('0x27'))){var _0x4f0970,_0x4f4e34;_0x4f0970=_0x304e0c[_0x8f78('0x26')];var _0x347971=_0x4f0970[_0x8f78('0x11')](-0x1);if(_0x347971==='/'||_0x347971==='\x5c'||_0x347971===':'){_0x4f0970=_0x4f0970['substring'](0x0,_0x4f0970[_0x8f78('0x13')](_0x347971));}switch(_0x304e0c[_0x8f78('0x28')]){case'US':_0x4f4e34=_0x8f78('0x14');break;case'AU':_0x4f4e34=_0x8f78('0x29');break;case'IN':_0x4f4e34=_0x8f78('0x2a');break;case'CN':_0x4f4e34='https://accounts.zoho.com.cn';break;default:_0x4f4e34='https://accounts.zoho.eu';break;}var _0x511c03={'method':'POST','uri':_0x4f4e34+_0x8f78('0x18'),'form':{'grant_type':'authorization_code','client_id':_0x304e0c[_0x8f78('0xe')],'client_secret':_0x304e0c[_0x8f78('0xf')],'redirect_uri':_0x304e0c['serverUrl'],'code':_0x304e0c[_0x8f78('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x511c03)[_0x8f78('0x1b')](function(_0xcc4c8e){var _0x559fb6=JSON[_0x8f78('0x1c')](_0xcc4c8e);if(_0x559fb6[_0x8f78('0x1d')]){_0x304e0c['refreshToken']=_0x559fb6['refresh_token'];logger[_0x8f78('0x1f')](util[_0x8f78('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x304e0c['name'],_0x304e0c['id']));}else{logger[_0x8f78('0x23')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x304e0c[_0x8f78('0x22')],_0x304e0c['id']),util['inspect'](_0x559fb6,{'showHidden':![],'depth':null}));}return _0x105f4c(null,_0x30c2be);})['catch'](function(_0x3594b9){logger[_0x8f78('0x23')](util[_0x8f78('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x304e0c[_0x8f78('0x22')],_0x304e0c['id']),util[_0x8f78('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x105f4c(_0x3594b9);});}else{return _0x105f4c(null,_0x30c2be);}}}});};
\ No newline at end of file
index 498ee2f..02aca5a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6257=['attributes','stringify','catch','find','raw','ShowZohoAccount','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','code','message','error','ZohoAccount,\x20%s,\x20%s','result','GetZohoAccount','ZohoAccount','options','limit','include','map','model'];(function(_0x374fa3,_0x186490){var _0x5909d4=function(_0x15a099){while(--_0x15a099){_0x374fa3['push'](_0x374fa3['shift']());}};_0x5909d4(++_0x186490);}(_0x6257,0x1d4));var _0x7625=function(_0x32e127,_0x11d276){_0x32e127=_0x32e127-0x0;var _0x267fdf=_0x6257[_0x32e127];return _0x267fdf;};'use strict';var _=require(_0x7625('0x0'));var util=require('util');var moment=require(_0x7625('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7625('0x2'));var db=require(_0x7625('0x3'))['db'];var utils=require(_0x7625('0x4'));var logger=require(_0x7625('0x5'))(_0x7625('0x6'));var config=require(_0x7625('0x7'));var jayson=require(_0x7625('0x8'));var client=jayson[_0x7625('0x9')][_0x7625('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427050,_0x5cf7a8,_0x4b790d){return new BPromise(function(_0x287434,_0x1a02de){return client['request'](_0x427050,_0x4b790d)[_0x7625('0xb')](function(_0x2a2625){logger[_0x7625('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'));logger[_0x7625('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x5cf7a8,_0x7625('0xd'),JSON['stringify'](_0x2a2625));if(_0x2a2625['error']){if(_0x2a2625['error'][_0x7625('0xf')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5cf7a8,_0x2a2625['error'][_0x7625('0x10')]);return _0x1a02de(_0x2a2625[_0x7625('0x11')][_0x7625('0x10')]);}logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x2a2625[_0x7625('0x11')]['message']);return _0x287434(_0x2a2625['error'][_0x7625('0x10')]);}else{logger['info'](_0x7625('0x12'),_0x5cf7a8,_0x7625('0xd'));_0x287434(_0x2a2625[_0x7625('0x13')]['message']);}})['catch'](function(_0x43206e){logger[_0x7625('0x11')](_0x7625('0x12'),_0x5cf7a8,_0x43206e);_0x1a02de(_0x43206e);});});}exports[_0x7625('0x14')]=function(_0x6ca44e){var _0x2c8013=this;return new Promise(function(_0x34e594,_0x57ab0c){return db[_0x7625('0x15')]['findAll']({'raw':_0x6ca44e[_0x7625('0x16')]?_0x6ca44e['options']['raw']===undefined?!![]:![]:!![],'where':_0x6ca44e[_0x7625('0x16')]?_0x6ca44e['options']['where']||null:null,'attributes':_0x6ca44e[_0x7625('0x16')]?_0x6ca44e[_0x7625('0x16')]['attributes']||null:null,'limit':_0x6ca44e[_0x7625('0x16')]?_0x6ca44e[_0x7625('0x16')][_0x7625('0x17')]||null:null,'include':_0x6ca44e['options']?_0x6ca44e[_0x7625('0x16')][_0x7625('0x18')]?_[_0x7625('0x19')](_0x6ca44e[_0x7625('0x16')][_0x7625('0x18')],function(_0xc8b3ae){return{'model':db[_0xc8b3ae[_0x7625('0x1a')]],'as':_0xc8b3ae['as'],'attributes':_0xc8b3ae[_0x7625('0x1b')],'include':_0xc8b3ae[_0x7625('0x18')]?_['map'](_0xc8b3ae['include'],function(_0x562fe1){return{'model':db[_0x562fe1['model']],'as':_0x562fe1['as'],'attributes':_0x562fe1['attributes'],'include':_0x562fe1[_0x7625('0x18')]?_[_0x7625('0x19')](_0x562fe1['include'],function(_0xdb65a3){return{'model':db[_0xdb65a3['model']],'as':_0xdb65a3['as'],'attributes':_0xdb65a3[_0x7625('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7625('0xb')](function(_0x4a34b8){logger[_0x7625('0xc')]('GetZohoAccount',_0x6ca44e);logger[_0x7625('0xe')]('GetZohoAccount',_0x6ca44e,JSON[_0x7625('0x1c')](_0x4a34b8));_0x34e594(_0x4a34b8);})[_0x7625('0x1d')](function(_0x29e7bb){logger[_0x7625('0x11')](_0x7625('0x14'),_0x29e7bb[_0x7625('0x10')],_0x6ca44e);_0x57ab0c(_0x2c8013[_0x7625('0x11')](0x1f4,_0x29e7bb[_0x7625('0x10')]));});});};exports['ShowZohoAccount']=function(_0x5ef7eb){var _0x461664=this;return new Promise(function(_0xc7aa53,_0x5ea946){return db[_0x7625('0x15')][_0x7625('0x1e')]({'raw':_0x5ef7eb[_0x7625('0x16')]?_0x5ef7eb[_0x7625('0x16')][_0x7625('0x1f')]===undefined?!![]:![]:!![],'where':_0x5ef7eb[_0x7625('0x16')]?_0x5ef7eb[_0x7625('0x16')]['where']||null:null,'attributes':_0x5ef7eb[_0x7625('0x16')]?_0x5ef7eb['options'][_0x7625('0x1b')]||null:null,'include':_0x5ef7eb[_0x7625('0x16')]?_0x5ef7eb[_0x7625('0x16')][_0x7625('0x18')]?_[_0x7625('0x19')](_0x5ef7eb[_0x7625('0x16')][_0x7625('0x18')],function(_0x43389f){return{'model':db[_0x43389f[_0x7625('0x1a')]],'as':_0x43389f['as'],'attributes':_0x43389f[_0x7625('0x1b')],'include':_0x43389f[_0x7625('0x18')]?_[_0x7625('0x19')](_0x43389f[_0x7625('0x18')],function(_0x3f122b){return{'model':db[_0x3f122b[_0x7625('0x1a')]],'as':_0x3f122b['as'],'attributes':_0x3f122b[_0x7625('0x1b')],'include':_0x3f122b['include']?_['map'](_0x3f122b[_0x7625('0x18')],function(_0x5b860d){return{'model':db[_0x5b860d['model']],'as':_0x5b860d['as'],'attributes':_0x5b860d[_0x7625('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7625('0xb')](function(_0x4a298d){logger[_0x7625('0xc')](_0x7625('0x20'),_0x5ef7eb);logger[_0x7625('0xe')](_0x7625('0x20'),_0x5ef7eb,JSON[_0x7625('0x1c')](_0x4a298d));_0xc7aa53(_0x4a298d);})[_0x7625('0x1d')](function(_0x49a173){logger['error'](_0x7625('0x20'),_0x49a173['message'],_0x5ef7eb);_0x5ea946(_0x461664['error'](0x1f4,_0x49a173[_0x7625('0x10')]));});});};
\ No newline at end of file
+var _0x4d68=['randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetZohoAccount','ZohoAccount','findAll','options','limit','include','attributes','map','model','ShowZohoAccount','find','raw','then','lodash','util','moment','bluebird'];(function(_0x108a9b,_0x4a7f9f){var _0x309b64=function(_0x8a9d5b){while(--_0x8a9d5b){_0x108a9b['push'](_0x108a9b['shift']());}};_0x309b64(++_0x4a7f9f);}(_0x4d68,0x1c3));var _0x84d6=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x4d68[_0x59befa];return _0x1dd63d;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var moment=require(_0x84d6('0x2'));var BPromise=require(_0x84d6('0x3'));var rs=require(_0x84d6('0x4'));var fs=require('fs');var Redis=require(_0x84d6('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x84d6('0x6'));var logger=require('../../config/logger')(_0x84d6('0x7'));var config=require('../../config/environment');var jayson=require(_0x84d6('0x8'));var client=jayson[_0x84d6('0x9')][_0x84d6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539e34,_0x561dd8,_0x218daf){return new BPromise(function(_0xa64ed3,_0x260859){return client[_0x84d6('0xb')](_0x539e34,_0x218daf)['then'](function(_0x411c7f){logger['info'](_0x84d6('0xc'),_0x561dd8,_0x84d6('0xd'));logger[_0x84d6('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x561dd8,'request\x20sent',JSON[_0x84d6('0xf')](_0x411c7f));if(_0x411c7f['error']){if(_0x411c7f[_0x84d6('0x10')][_0x84d6('0x11')]===0x1f4){logger[_0x84d6('0x10')](_0x84d6('0xc'),_0x561dd8,_0x411c7f[_0x84d6('0x10')]['message']);return _0x260859(_0x411c7f[_0x84d6('0x10')]['message']);}logger[_0x84d6('0x10')](_0x84d6('0xc'),_0x561dd8,_0x411c7f[_0x84d6('0x10')][_0x84d6('0x12')]);return _0xa64ed3(_0x411c7f[_0x84d6('0x10')][_0x84d6('0x12')]);}else{logger[_0x84d6('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x561dd8,_0x84d6('0xd'));_0xa64ed3(_0x411c7f[_0x84d6('0x14')][_0x84d6('0x12')]);}})[_0x84d6('0x15')](function(_0x385e2b){logger['error'](_0x84d6('0xc'),_0x561dd8,_0x385e2b);_0x260859(_0x385e2b);});});}exports[_0x84d6('0x16')]=function(_0x579aa8){var _0x1bd84a=this;return new Promise(function(_0x47a884,_0x309f26){return db[_0x84d6('0x17')][_0x84d6('0x18')]({'raw':_0x579aa8[_0x84d6('0x19')]?_0x579aa8[_0x84d6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x579aa8[_0x84d6('0x19')]?_0x579aa8[_0x84d6('0x19')]['where']||null:null,'attributes':_0x579aa8['options']?_0x579aa8[_0x84d6('0x19')]['attributes']||null:null,'limit':_0x579aa8['options']?_0x579aa8[_0x84d6('0x19')][_0x84d6('0x1a')]||null:null,'include':_0x579aa8[_0x84d6('0x19')]?_0x579aa8['options'][_0x84d6('0x1b')]?_['map'](_0x579aa8['options'][_0x84d6('0x1b')],function(_0x1b86f2){return{'model':db[_0x1b86f2['model']],'as':_0x1b86f2['as'],'attributes':_0x1b86f2[_0x84d6('0x1c')],'include':_0x1b86f2[_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x1b86f2[_0x84d6('0x1b')],function(_0x5deaa5){return{'model':db[_0x5deaa5[_0x84d6('0x1e')]],'as':_0x5deaa5['as'],'attributes':_0x5deaa5['attributes'],'include':_0x5deaa5[_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x5deaa5['include'],function(_0x500a81){return{'model':db[_0x500a81[_0x84d6('0x1e')]],'as':_0x500a81['as'],'attributes':_0x500a81['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x14eec8){logger['info'](_0x84d6('0x16'),_0x579aa8);logger['debug'](_0x84d6('0x16'),_0x579aa8,JSON[_0x84d6('0xf')](_0x14eec8));_0x47a884(_0x14eec8);})[_0x84d6('0x15')](function(_0x37adf9){logger[_0x84d6('0x10')](_0x84d6('0x16'),_0x37adf9[_0x84d6('0x12')],_0x579aa8);_0x309f26(_0x1bd84a[_0x84d6('0x10')](0x1f4,_0x37adf9[_0x84d6('0x12')]));});});};exports[_0x84d6('0x1f')]=function(_0x20c27b){var _0x1fa278=this;return new Promise(function(_0x56bc23,_0x2f60f1){return db[_0x84d6('0x17')][_0x84d6('0x20')]({'raw':_0x20c27b[_0x84d6('0x19')]?_0x20c27b[_0x84d6('0x19')][_0x84d6('0x21')]===undefined?!![]:![]:!![],'where':_0x20c27b[_0x84d6('0x19')]?_0x20c27b[_0x84d6('0x19')]['where']||null:null,'attributes':_0x20c27b[_0x84d6('0x19')]?_0x20c27b['options'][_0x84d6('0x1c')]||null:null,'include':_0x20c27b[_0x84d6('0x19')]?_0x20c27b['options'][_0x84d6('0x1b')]?_[_0x84d6('0x1d')](_0x20c27b['options'][_0x84d6('0x1b')],function(_0x6c3a2a){return{'model':db[_0x6c3a2a[_0x84d6('0x1e')]],'as':_0x6c3a2a['as'],'attributes':_0x6c3a2a[_0x84d6('0x1c')],'include':_0x6c3a2a[_0x84d6('0x1b')]?_['map'](_0x6c3a2a[_0x84d6('0x1b')],function(_0xf8d313){return{'model':db[_0xf8d313[_0x84d6('0x1e')]],'as':_0xf8d313['as'],'attributes':_0xf8d313['attributes'],'include':_0xf8d313[_0x84d6('0x1b')]?_['map'](_0xf8d313[_0x84d6('0x1b')],function(_0x525b56){return{'model':db[_0x525b56['model']],'as':_0x525b56['as'],'attributes':_0x525b56[_0x84d6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x84d6('0x22')](function(_0x45b55f){logger['info'](_0x84d6('0x1f'),_0x20c27b);logger[_0x84d6('0xe')](_0x84d6('0x1f'),_0x20c27b,JSON['stringify'](_0x45b55f));_0x56bc23(_0x45b55f);})['catch'](function(_0x531a49){logger[_0x84d6('0x10')](_0x84d6('0x1f'),_0x531a49[_0x84d6('0x12')],_0x20c27b);_0x2f60f1(_0x1fa278[_0x84d6('0x10')](0x1f4,_0x531a49[_0x84d6('0x12')]));});});};
\ No newline at end of file
index 41617e4..c9c7cec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b76=['getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x7b76,0x64));var _0x67b7=function(_0xe45b6d,_0x443cac){_0xe45b6d=_0xe45b6d-0x0;var _0x4d6f47=_0x7b76[_0xe45b6d];return _0x4d6f47;};'use strict';var multer=require(_0x67b7('0x0'));var util=require('util');var path=require(_0x67b7('0x1'));var timeout=require(_0x67b7('0x2'));var express=require(_0x67b7('0x3'));var router=express['Router']();var fs_extra=require(_0x67b7('0x4'));var auth=require(_0x67b7('0x5'));var interaction=require(_0x67b7('0x6'));var config=require(_0x67b7('0x7'));var controller=require(_0x67b7('0x8'));router[_0x67b7('0x9')]('/',auth[_0x67b7('0xa')](),controller[_0x67b7('0xb')]);router[_0x67b7('0x9')](_0x67b7('0xc'),auth[_0x67b7('0xa')](),controller[_0x67b7('0xd')]);router['get'](_0x67b7('0xe'),auth[_0x67b7('0xa')](),controller[_0x67b7('0xf')]);router[_0x67b7('0x9')](_0x67b7('0x10'),auth[_0x67b7('0xa')](),controller['getSubjects']);router[_0x67b7('0x9')](_0x67b7('0x11'),auth['isAuthenticated'](),controller[_0x67b7('0x12')]);router[_0x67b7('0x13')]('/',auth[_0x67b7('0xa')](),controller[_0x67b7('0x14')]);router['put']('/:id',auth[_0x67b7('0xa')](),controller[_0x67b7('0x15')]);router['delete'](_0x67b7('0xc'),auth[_0x67b7('0xa')](),controller[_0x67b7('0x16')]);module['exports']=router;
\ No newline at end of file
+var _0x7e74=['/:id/subjects','/:id/descriptions','create','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','index','/:id','isAuthenticated','show','get','getFields'];(function(_0x2ba36d,_0x5a7d92){var _0x53e49d=function(_0x2c200b){while(--_0x2c200b){_0x2ba36d['push'](_0x2ba36d['shift']());}};_0x53e49d(++_0x5a7d92);}(_0x7e74,0x16e));var _0x47e7=function(_0xc788db,_0x135a58){_0xc788db=_0xc788db-0x0;var _0x48c197=_0x7e74[_0xc788db];return _0x48c197;};'use strict';var multer=require(_0x47e7('0x0'));var util=require('util');var path=require(_0x47e7('0x1'));var timeout=require(_0x47e7('0x2'));var express=require(_0x47e7('0x3'));var router=express['Router']();var fs_extra=require(_0x47e7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x47e7('0x5'));var config=require(_0x47e7('0x6'));var controller=require(_0x47e7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x47e7('0x8')]);router['get'](_0x47e7('0x9'),auth[_0x47e7('0xa')](),controller[_0x47e7('0xb')]);router[_0x47e7('0xc')]('/:id/fields',auth[_0x47e7('0xa')](),controller[_0x47e7('0xd')]);router['get'](_0x47e7('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x47e7('0xc')](_0x47e7('0xf'),auth['isAuthenticated'](),controller['getDescriptions']);router['post']('/',auth[_0x47e7('0xa')](),controller[_0x47e7('0x10')]);router['put']('/:id',auth[_0x47e7('0xa')](),controller[_0x47e7('0x11')]);router['delete']('/:id',auth[_0x47e7('0xa')](),controller[_0x47e7('0x12')]);module[_0x47e7('0x13')]=router;
\ No newline at end of file
index e82fd78..c9d2d4e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4119=['STRING','ENUM','lead','contact','contact_lead','sequelize','exports'];(function(_0x5c34c1,_0x1ab0e8){var _0x24e811=function(_0x3e5de1){while(--_0x3e5de1){_0x5c34c1['push'](_0x5c34c1['shift']());}};_0x24e811(++_0x1ab0e8);}(_0x4119,0xfa));var _0x9411=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4119[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x9411('0x0'));module[_0x9411('0x1')]={'name':{'type':Sequelize[_0x9411('0x2')]},'moduleCreate':{'type':Sequelize[_0x9411('0x3')](_0x9411('0x4'),_0x9411('0x5'),'nothing'),'defaultValue':_0x9411('0x4')},'moduleSearch':{'type':Sequelize[_0x9411('0x3')]('contact_lead',_0x9411('0x5'),_0x9411('0x4')),'defaultValue':_0x9411('0x6')},'description':{'type':Sequelize[_0x9411('0x2')]}};
\ No newline at end of file
+var _0x41ba=['lead','sequelize','exports','STRING','ENUM','contact','nothing'];(function(_0x15adce,_0x841de0){var _0x371421=function(_0x217997){while(--_0x217997){_0x15adce['push'](_0x15adce['shift']());}};_0x371421(++_0x841de0);}(_0x41ba,0x6a));var _0xa41b=function(_0x4f448b,_0x438246){_0x4f448b=_0x4f448b-0x0;var _0x3c4a8b=_0x41ba[_0x4f448b];return _0x3c4a8b;};'use strict';var Sequelize=require(_0xa41b('0x0'));module[_0xa41b('0x1')]={'name':{'type':Sequelize[_0xa41b('0x2')]},'moduleCreate':{'type':Sequelize[_0xa41b('0x3')]('lead',_0xa41b('0x4'),_0xa41b('0x5')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xa41b('0x3')]('contact_lead',_0xa41b('0x4'),_0xa41b('0x6')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xa41b('0x2')]}};
\ No newline at end of file
index 2435259..955e131 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0106=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','merge','options','ZohoConfiguration','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','findOne','ZohoField','order','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','json','undefined','limit','count','offset'];(function(_0x1e2d53,_0x1e508b){var _0x5db88b=function(_0x2379e8){while(--_0x2379e8){_0x1e2d53['push'](_0x1e2d53['shift']());}};_0x5db88b(++_0x1e508b);}(_0x0106,0x1ed));var _0x6010=function(_0x5e31b7,_0x43b8b5){_0x5e31b7=_0x5e31b7-0x0;var _0x5bdfde=_0x0106[_0x5e31b7];return _0x5bdfde;};'use strict';var emlformat=require(_0x6010('0x0'));var rimraf=require(_0x6010('0x1'));var zipdir=require(_0x6010('0x2'));var jsonpatch=require(_0x6010('0x3'));var rp=require(_0x6010('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x6010('0x5'));var sox=require(_0x6010('0x6'));var csv=require(_0x6010('0x7'));var ejs=require(_0x6010('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6010('0x9'));var deskjs=require(_0x6010('0xa'));var toCsv=require(_0x6010('0x7'));var querystring=require(_0x6010('0xb'));var Papa=require(_0x6010('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6010('0xd'));var hardwareService=require(_0x6010('0xe'));var logger=require(_0x6010('0xf'))(_0x6010('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6010('0x11'))['db'];function respondWithStatusCode(_0x3a0585,_0x42a2de){_0x42a2de=_0x42a2de||0xcc;return function(_0x52d9fc){if(_0x52d9fc){return _0x3a0585['sendStatus'](_0x42a2de);}return _0x3a0585['status'](_0x42a2de)[_0x6010('0x12')]();};}function respondWithResult(_0xc1d3ab,_0x3c368c){_0x3c368c=_0x3c368c||0xc8;return function(_0x5813d9){if(_0x5813d9){return _0xc1d3ab[_0x6010('0x13')](_0x3c368c)[_0x6010('0x14')](_0x5813d9);}};}function respondWithFilteredResult(_0x49a9b5,_0x3a7e49){return function(_0x259820){if(_0x259820){var _0x557908=typeof _0x3a7e49['offset']===_0x6010('0x15')&&typeof _0x3a7e49[_0x6010('0x16')]===_0x6010('0x15');var _0x5b28b1=_0x259820[_0x6010('0x17')];var _0x39f31d=_0x557908?0x0:_0x3a7e49[_0x6010('0x18')];var _0x7a23ba=_0x557908?_0x259820['count']:_0x3a7e49['offset']+_0x3a7e49[_0x6010('0x16')];var _0x575219;if(_0x7a23ba>=_0x5b28b1){_0x7a23ba=_0x5b28b1;_0x575219=0xc8;}else{_0x575219=0xce;}_0x49a9b5[_0x6010('0x13')](_0x575219);return _0x49a9b5['set'](_0x6010('0x19'),_0x39f31d+'-'+_0x7a23ba+'/'+_0x5b28b1)[_0x6010('0x14')](_0x259820);}return null;};}function patchUpdates(_0x526efa){return function(_0x5772a2){try{jsonpatch[_0x6010('0x1a')](_0x5772a2,_0x526efa,!![]);}catch(_0x152ba5){return BPromise[_0x6010('0x1b')](_0x152ba5);}return _0x5772a2[_0x6010('0x1c')]();};}function saveUpdates(_0x161a0c,_0x3bae92){return function(_0x31fd0a){if(_0x31fd0a){return _0x31fd0a[_0x6010('0x1d')](_0x161a0c)[_0x6010('0x1e')](function(_0x326068){return _0x326068;});}return null;};}function removeEntity(_0x2fc82d,_0x289ee3){return function(_0x4c09fc){if(_0x4c09fc){return _0x4c09fc[_0x6010('0x1f')]()['then'](function(){_0x2fc82d[_0x6010('0x13')](0xcc)[_0x6010('0x12')]();});}};}function handleEntityNotFound(_0x4aac2d,_0x2c5121){return function(_0x53334d){if(!_0x53334d){_0x4aac2d[_0x6010('0x20')](0x194);}return _0x53334d;};}function handleError(_0x8dc5a1,_0x1f2303){_0x1f2303=_0x1f2303||0x1f4;return function(_0x7aef56){logger['error'](_0x7aef56[_0x6010('0x21')]);if(_0x7aef56['name']){delete _0x7aef56[_0x6010('0x22')];}_0x8dc5a1[_0x6010('0x13')](_0x1f2303)[_0x6010('0x23')](_0x7aef56);};}exports[_0x6010('0x24')]=function(_0x4b454c,_0x10b154){var _0x1cbdaa={},_0xa1bb33={},_0x466f64={'count':0x0,'rows':[]};var _0x520c8f=_['map'](db['ZohoConfiguration'][_0x6010('0x25')],function(_0x575a64){return{'name':_0x575a64[_0x6010('0x26')],'type':_0x575a64[_0x6010('0x27')]['key']};});_0xa1bb33[_0x6010('0x28')]=_[_0x6010('0x29')](_0x520c8f,'name');_0xa1bb33[_0x6010('0x2a')]=_[_0x6010('0x2b')](_0x4b454c['query']);_0xa1bb33[_0x6010('0x2c')]=_[_0x6010('0x2d')](_0xa1bb33['model'],_0xa1bb33[_0x6010('0x2a')]);_0x1cbdaa[_0x6010('0x2e')]=_[_0x6010('0x2d')](_0xa1bb33['model'],qs[_0x6010('0x2f')](_0x4b454c[_0x6010('0x2a')][_0x6010('0x2f')]));_0x1cbdaa[_0x6010('0x2e')]=_0x1cbdaa[_0x6010('0x2e')][_0x6010('0x30')]?_0x1cbdaa[_0x6010('0x2e')]:_0xa1bb33[_0x6010('0x28')];if(!_0x4b454c['query'][_0x6010('0x31')]('nolimit')){_0x1cbdaa[_0x6010('0x16')]=qs[_0x6010('0x16')](_0x4b454c[_0x6010('0x2a')][_0x6010('0x16')]);_0x1cbdaa[_0x6010('0x18')]=qs['offset'](_0x4b454c['query'][_0x6010('0x18')]);}_0x1cbdaa['order']=qs[_0x6010('0x32')](_0x4b454c[_0x6010('0x2a')][_0x6010('0x32')]);_0x1cbdaa['where']=qs['filters'](_[_0x6010('0x33')](_0x4b454c[_0x6010('0x2a')],_0xa1bb33[_0x6010('0x2c')]),_0x520c8f);if(_0x4b454c[_0x6010('0x2a')][_0x6010('0x34')]){_0x1cbdaa[_0x6010('0x35')]=_['merge'](_0x1cbdaa[_0x6010('0x35')],{'$or':_[_0x6010('0x29')](_0x520c8f,function(_0x1c9e37){if(_0x1c9e37[_0x6010('0x27')]!=='VIRTUAL'){var _0x5710c9={};_0x5710c9[_0x1c9e37[_0x6010('0x22')]]={'$like':'%'+_0x4b454c[_0x6010('0x2a')][_0x6010('0x34')]+'%'};return _0x5710c9;}})});}_0x1cbdaa=_[_0x6010('0x36')]({},_0x1cbdaa,_0x4b454c[_0x6010('0x37')]);var _0x373f1f={'where':_0x1cbdaa[_0x6010('0x35')]};return db[_0x6010('0x38')][_0x6010('0x17')](_0x373f1f)[_0x6010('0x1e')](function(_0x55d5cd){_0x466f64[_0x6010('0x17')]=_0x55d5cd;if(_0x4b454c[_0x6010('0x2a')][_0x6010('0x39')]){_0x1cbdaa[_0x6010('0x3a')]=[{'all':!![]}];}return db[_0x6010('0x38')][_0x6010('0x3b')](_0x1cbdaa);})[_0x6010('0x1e')](function(_0x9e66f){_0x466f64[_0x6010('0x3c')]=_0x9e66f;return _0x466f64;})[_0x6010('0x1e')](respondWithFilteredResult(_0x10b154,_0x1cbdaa))[_0x6010('0x3d')](handleError(_0x10b154,null));};exports[_0x6010('0x3e')]=function(_0xf7a16,_0x5164d9){var _0x2fed36={'raw':![],'where':{'id':_0xf7a16[_0x6010('0x3f')]['id']}},_0x5995aa={};_0x5995aa['model']=_[_0x6010('0x2b')](db['ZohoConfiguration'][_0x6010('0x25')]);_0x5995aa[_0x6010('0x2a')]=_[_0x6010('0x2b')](_0xf7a16[_0x6010('0x2a')]);_0x5995aa['filters']=_[_0x6010('0x2d')](_0x5995aa[_0x6010('0x28')],_0x5995aa['query']);_0x2fed36['attributes']=_[_0x6010('0x2d')](_0x5995aa[_0x6010('0x28')],qs[_0x6010('0x2f')](_0xf7a16[_0x6010('0x2a')][_0x6010('0x2f')]));_0x2fed36[_0x6010('0x2e')]=_0x2fed36[_0x6010('0x2e')]['length']?_0x2fed36[_0x6010('0x2e')]:_0x5995aa[_0x6010('0x28')];if(_0xf7a16[_0x6010('0x2a')][_0x6010('0x39')]){_0x2fed36[_0x6010('0x3a')]=[{'all':!![]}];}_0x2fed36=_['merge']({},_0x2fed36,_0xf7a16[_0x6010('0x37')]);return db['ZohoConfiguration']['find'](_0x2fed36)[_0x6010('0x1e')](handleEntityNotFound(_0x5164d9,null))[_0x6010('0x1e')](respondWithResult(_0x5164d9,null))[_0x6010('0x3d')](handleError(_0x5164d9,null));};exports[_0x6010('0x40')]=function(_0x41000e,_0xf6e2b8){return db['ZohoConfiguration'][_0x6010('0x40')](_0x41000e[_0x6010('0x41')],{})[_0x6010('0x1e')](respondWithResult(_0xf6e2b8,0xc9))[_0x6010('0x3d')](handleError(_0xf6e2b8,null));};exports[_0x6010('0x1d')]=function(_0x34f9f3,_0x235db9){if(_0x34f9f3[_0x6010('0x41')]['id']){delete _0x34f9f3[_0x6010('0x41')]['id'];}return db[_0x6010('0x38')][_0x6010('0x42')]({'where':{'id':_0x34f9f3[_0x6010('0x3f')]['id']}})['then'](handleEntityNotFound(_0x235db9,null))['then'](saveUpdates(_0x34f9f3[_0x6010('0x41')],null))[_0x6010('0x1e')](respondWithResult(_0x235db9,null))[_0x6010('0x3d')](handleError(_0x235db9,null));};exports[_0x6010('0x1f')]=function(_0x4b9937,_0x51f45d){return db['ZohoConfiguration'][_0x6010('0x42')]({'where':{'id':_0x4b9937[_0x6010('0x3f')]['id']}})[_0x6010('0x1e')](handleEntityNotFound(_0x51f45d,null))[_0x6010('0x1e')](removeEntity(_0x51f45d,null))[_0x6010('0x3d')](handleError(_0x51f45d,null));};exports[_0x6010('0x43')]=function(_0x26e3ca,_0x4b975c,_0x3afdca){var _0x1669e9={};var _0x4999cd={};var _0x320f5b;var _0x54e672;return db[_0x6010('0x38')][_0x6010('0x44')]({'where':{'id':_0x26e3ca[_0x6010('0x3f')]['id']}})[_0x6010('0x1e')](handleEntityNotFound(_0x4b975c,null))['then'](function(_0x36f102){if(_0x36f102){_0x320f5b=_0x36f102;_0x4999cd['model']=_[_0x6010('0x2b')](db[_0x6010('0x45')][_0x6010('0x25')]);_0x4999cd[_0x6010('0x2a')]=_[_0x6010('0x2b')](_0x26e3ca[_0x6010('0x2a')]);_0x4999cd[_0x6010('0x2c')]=_[_0x6010('0x2d')](_0x4999cd[_0x6010('0x28')],_0x4999cd[_0x6010('0x2a')]);_0x1669e9['attributes']=_[_0x6010('0x2d')](_0x4999cd['model'],qs[_0x6010('0x2f')](_0x26e3ca[_0x6010('0x2a')][_0x6010('0x2f')]));_0x1669e9[_0x6010('0x2e')]=_0x1669e9[_0x6010('0x2e')][_0x6010('0x30')]?_0x1669e9[_0x6010('0x2e')]:_0x4999cd['model'];_0x1669e9[_0x6010('0x46')]=qs[_0x6010('0x32')](_0x26e3ca[_0x6010('0x2a')][_0x6010('0x32')]);_0x1669e9[_0x6010('0x35')]=qs[_0x6010('0x2c')](_[_0x6010('0x33')](_0x26e3ca[_0x6010('0x2a')],_0x4999cd[_0x6010('0x2c')]));if(_0x26e3ca[_0x6010('0x2a')][_0x6010('0x34')]){_0x1669e9[_0x6010('0x35')]=_[_0x6010('0x36')](_0x1669e9[_0x6010('0x35')],{'$or':_[_0x6010('0x29')](_0x1669e9[_0x6010('0x2e')],function(_0x4a9ae4){var _0x426cb4={};_0x426cb4[_0x4a9ae4]={'$like':'%'+_0x26e3ca[_0x6010('0x2a')][_0x6010('0x34')]+'%'};return _0x426cb4;})});}_0x1669e9=_[_0x6010('0x36')]({},_0x1669e9,_0x26e3ca[_0x6010('0x37')]);return _0x320f5b['getFields'](_0x1669e9);}})['then'](function(_0xeaa472){if(_0xeaa472){_0x54e672=_0xeaa472[_0x6010('0x30')];if(!_0x26e3ca[_0x6010('0x2a')][_0x6010('0x31')](_0x6010('0x47'))){_0x1669e9[_0x6010('0x16')]=qs[_0x6010('0x16')](_0x26e3ca[_0x6010('0x2a')][_0x6010('0x16')]);_0x1669e9[_0x6010('0x18')]=qs[_0x6010('0x18')](_0x26e3ca['query'][_0x6010('0x18')]);}return _0x320f5b[_0x6010('0x43')](_0x1669e9);}})['then'](function(_0x57028a){if(_0x57028a){return _0x57028a?{'count':_0x54e672,'rows':_0x57028a}:null;}})['then'](respondWithResult(_0x4b975c,null))['catch'](handleError(_0x4b975c,null));};exports[_0x6010('0x48')]=function(_0xcf0034,_0x16c92c,_0x4eb1dd){var _0x7198a4={};var _0xa6b985={};var _0x30717f;var _0x44735a;return db[_0x6010('0x38')][_0x6010('0x44')]({'where':{'id':_0xcf0034['params']['id']}})['then'](handleEntityNotFound(_0x16c92c,null))[_0x6010('0x1e')](function(_0x2a5ac1){if(_0x2a5ac1){_0x30717f=_0x2a5ac1;_0xa6b985[_0x6010('0x28')]=_[_0x6010('0x2b')](db[_0x6010('0x45')][_0x6010('0x25')]);_0xa6b985[_0x6010('0x2a')]=_['keys'](_0xcf0034[_0x6010('0x2a')]);_0xa6b985[_0x6010('0x2c')]=_[_0x6010('0x2d')](_0xa6b985[_0x6010('0x28')],_0xa6b985[_0x6010('0x2a')]);_0x7198a4[_0x6010('0x2e')]=_[_0x6010('0x2d')](_0xa6b985[_0x6010('0x28')],qs[_0x6010('0x2f')](_0xcf0034[_0x6010('0x2a')][_0x6010('0x2f')]));_0x7198a4['attributes']=_0x7198a4['attributes'][_0x6010('0x30')]?_0x7198a4[_0x6010('0x2e')]:_0xa6b985[_0x6010('0x28')];_0x7198a4[_0x6010('0x46')]=qs['sort'](_0xcf0034[_0x6010('0x2a')][_0x6010('0x32')]);_0x7198a4[_0x6010('0x35')]=qs[_0x6010('0x2c')](_['pick'](_0xcf0034['query'],_0xa6b985['filters']));if(_0xcf0034[_0x6010('0x2a')][_0x6010('0x34')]){_0x7198a4[_0x6010('0x35')]=_[_0x6010('0x36')](_0x7198a4[_0x6010('0x35')],{'$or':_['map'](_0x7198a4[_0x6010('0x2e')],function(_0x5d7e5b){var _0xf7781e={};_0xf7781e[_0x5d7e5b]={'$like':'%'+_0xcf0034[_0x6010('0x2a')][_0x6010('0x34')]+'%'};return _0xf7781e;})});}_0x7198a4=_['merge']({},_0x7198a4,_0xcf0034[_0x6010('0x37')]);return _0x30717f[_0x6010('0x48')](_0x7198a4);}})[_0x6010('0x1e')](function(_0x5e4170){if(_0x5e4170){_0x44735a=_0x5e4170[_0x6010('0x30')];if(!_0xcf0034[_0x6010('0x2a')][_0x6010('0x31')]('nolimit')){_0x7198a4['limit']=qs[_0x6010('0x16')](_0xcf0034['query']['limit']);_0x7198a4[_0x6010('0x18')]=qs[_0x6010('0x18')](_0xcf0034['query'][_0x6010('0x18')]);}return _0x30717f[_0x6010('0x48')](_0x7198a4);}})[_0x6010('0x1e')](function(_0x3bc485){if(_0x3bc485){return _0x3bc485?{'count':_0x44735a,'rows':_0x3bc485}:null;}})[_0x6010('0x1e')](respondWithResult(_0x16c92c,null))[_0x6010('0x3d')](handleError(_0x16c92c,null));};exports[_0x6010('0x49')]=function(_0x344fac,_0x24b454,_0x17fef5){var _0x626706={};var _0x85ea9={};var _0x1ad833;var _0x2fbcfd;return db[_0x6010('0x38')]['findOne']({'where':{'id':_0x344fac['params']['id']}})[_0x6010('0x1e')](handleEntityNotFound(_0x24b454,null))['then'](function(_0x48e8c0){if(_0x48e8c0){_0x1ad833=_0x48e8c0;_0x85ea9[_0x6010('0x28')]=_[_0x6010('0x2b')](db['ZohoField'][_0x6010('0x25')]);_0x85ea9['query']=_[_0x6010('0x2b')](_0x344fac[_0x6010('0x2a')]);_0x85ea9['filters']=_[_0x6010('0x2d')](_0x85ea9[_0x6010('0x28')],_0x85ea9[_0x6010('0x2a')]);_0x626706['attributes']=_['intersection'](_0x85ea9['model'],qs[_0x6010('0x2f')](_0x344fac[_0x6010('0x2a')]['fields']));_0x626706[_0x6010('0x2e')]=_0x626706['attributes']['length']?_0x626706[_0x6010('0x2e')]:_0x85ea9['model'];_0x626706['order']=qs[_0x6010('0x32')](_0x344fac[_0x6010('0x2a')]['sort']);_0x626706['where']=qs['filters'](_[_0x6010('0x33')](_0x344fac[_0x6010('0x2a')],_0x85ea9[_0x6010('0x2c')]));if(_0x344fac[_0x6010('0x2a')][_0x6010('0x34')]){_0x626706[_0x6010('0x35')]=_[_0x6010('0x36')](_0x626706[_0x6010('0x35')],{'$or':_[_0x6010('0x29')](_0x626706[_0x6010('0x2e')],function(_0x5623a7){var _0x2bc1c1={};_0x2bc1c1[_0x5623a7]={'$like':'%'+_0x344fac[_0x6010('0x2a')][_0x6010('0x34')]+'%'};return _0x2bc1c1;})});}_0x626706=_[_0x6010('0x36')]({},_0x626706,_0x344fac[_0x6010('0x37')]);return _0x1ad833[_0x6010('0x49')](_0x626706);}})[_0x6010('0x1e')](function(_0x565027){if(_0x565027){_0x2fbcfd=_0x565027[_0x6010('0x30')];if(!_0x344fac[_0x6010('0x2a')]['hasOwnProperty']('nolimit')){_0x626706[_0x6010('0x16')]=qs[_0x6010('0x16')](_0x344fac['query'][_0x6010('0x16')]);_0x626706[_0x6010('0x18')]=qs['offset'](_0x344fac[_0x6010('0x2a')][_0x6010('0x18')]);}return _0x1ad833[_0x6010('0x49')](_0x626706);}})[_0x6010('0x1e')](function(_0x1f3672){if(_0x1f3672){return _0x1f3672?{'count':_0x2fbcfd,'rows':_0x1f3672}:null;}})['then'](respondWithResult(_0x24b454,null))[_0x6010('0x3d')](handleError(_0x24b454,null));};
\ No newline at end of file
+var _0xeb7d=['find','findOne','ZohoField','getFields','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','include','params','catch','create','body'];(function(_0x3c81b5,_0x3f5ed7){var _0x5888c4=function(_0x4e65b0){while(--_0x4e65b0){_0x3c81b5['push'](_0x3c81b5['shift']());}};_0x5888c4(++_0x3f5ed7);}(_0xeb7d,0xf3));var _0xdeb7=function(_0x2997d1,_0x37a166){_0x2997d1=_0x2997d1-0x0;var _0x77f916=_0xeb7d[_0x2997d1];return _0x77f916;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdeb7('0x0'));var zipdir=require(_0xdeb7('0x1'));var jsonpatch=require(_0xdeb7('0x2'));var rp=require(_0xdeb7('0x3'));var moment=require(_0xdeb7('0x4'));var BPromise=require(_0xdeb7('0x5'));var Mustache=require(_0xdeb7('0x6'));var util=require(_0xdeb7('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0xdeb7('0x8'));var ejs=require(_0xdeb7('0x9'));var fs=require('fs');var fs_extra=require(_0xdeb7('0xa'));var _=require(_0xdeb7('0xb'));var squel=require(_0xdeb7('0xc'));var crypto=require(_0xdeb7('0xd'));var jsforce=require(_0xdeb7('0xe'));var deskjs=require(_0xdeb7('0xf'));var toCsv=require(_0xdeb7('0x8'));var querystring=require(_0xdeb7('0x10'));var Papa=require('papaparse');var Redis=require(_0xdeb7('0x11'));var authService=require(_0xdeb7('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdeb7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdeb7('0x14'))('api');var utils=require(_0xdeb7('0x15'));var config=require(_0xdeb7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xdeb7('0x17'))['db'];function respondWithStatusCode(_0x5cffae,_0x432ec4){_0x432ec4=_0x432ec4||0xcc;return function(_0x50fdc6){if(_0x50fdc6){return _0x5cffae[_0xdeb7('0x18')](_0x432ec4);}return _0x5cffae['status'](_0x432ec4)['end']();};}function respondWithResult(_0x1a5225,_0x85e6c5){_0x85e6c5=_0x85e6c5||0xc8;return function(_0x3fa1e9){if(_0x3fa1e9){return _0x1a5225[_0xdeb7('0x19')](_0x85e6c5)[_0xdeb7('0x1a')](_0x3fa1e9);}};}function respondWithFilteredResult(_0xa1c533,_0x2bfb67){return function(_0x3684ec){if(_0x3684ec){var _0x1445a3=typeof _0x2bfb67[_0xdeb7('0x1b')]===_0xdeb7('0x1c')&&typeof _0x2bfb67[_0xdeb7('0x1d')]===_0xdeb7('0x1c');var _0x135727=_0x3684ec[_0xdeb7('0x1e')];var _0x5f2838=_0x1445a3?0x0:_0x2bfb67[_0xdeb7('0x1b')];var _0x244c9b=_0x1445a3?_0x3684ec[_0xdeb7('0x1e')]:_0x2bfb67[_0xdeb7('0x1b')]+_0x2bfb67[_0xdeb7('0x1d')];var _0x441cf5;if(_0x244c9b>=_0x135727){_0x244c9b=_0x135727;_0x441cf5=0xc8;}else{_0x441cf5=0xce;}_0xa1c533[_0xdeb7('0x19')](_0x441cf5);return _0xa1c533['set'](_0xdeb7('0x1f'),_0x5f2838+'-'+_0x244c9b+'/'+_0x135727)[_0xdeb7('0x1a')](_0x3684ec);}return null;};}function patchUpdates(_0x4d409d){return function(_0x3d5528){try{jsonpatch[_0xdeb7('0x20')](_0x3d5528,_0x4d409d,!![]);}catch(_0x9ec081){return BPromise[_0xdeb7('0x21')](_0x9ec081);}return _0x3d5528[_0xdeb7('0x22')]();};}function saveUpdates(_0x17e034,_0x58701f){return function(_0x2927af){if(_0x2927af){return _0x2927af[_0xdeb7('0x23')](_0x17e034)['then'](function(_0x16d52a){return _0x16d52a;});}return null;};}function removeEntity(_0x45023f,_0xae11dc){return function(_0x2aba66){if(_0x2aba66){return _0x2aba66[_0xdeb7('0x24')]()[_0xdeb7('0x25')](function(){_0x45023f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x223b5b,_0x1119a6){return function(_0x28bf4c){if(!_0x28bf4c){_0x223b5b[_0xdeb7('0x18')](0x194);}return _0x28bf4c;};}function handleError(_0x53fa64,_0x3505d2){_0x3505d2=_0x3505d2||0x1f4;return function(_0x179b7b){logger[_0xdeb7('0x26')](_0x179b7b[_0xdeb7('0x27')]);if(_0x179b7b[_0xdeb7('0x28')]){delete _0x179b7b[_0xdeb7('0x28')];}_0x53fa64[_0xdeb7('0x19')](_0x3505d2)[_0xdeb7('0x29')](_0x179b7b);};}exports[_0xdeb7('0x2a')]=function(_0x24d85b,_0x19a7c9){var _0x238316={},_0x29e673={},_0x3404ec={'count':0x0,'rows':[]};var _0x2d5156=_[_0xdeb7('0x2b')](db['ZohoConfiguration'][_0xdeb7('0x2c')],function(_0x20d6f7){return{'name':_0x20d6f7[_0xdeb7('0x2d')],'type':_0x20d6f7[_0xdeb7('0x2e')][_0xdeb7('0x2f')]};});_0x29e673['model']=_[_0xdeb7('0x2b')](_0x2d5156,'name');_0x29e673[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x24d85b[_0xdeb7('0x30')]);_0x29e673[_0xdeb7('0x32')]=_[_0xdeb7('0x33')](_0x29e673[_0xdeb7('0x34')],_0x29e673[_0xdeb7('0x30')]);_0x238316[_0xdeb7('0x35')]=_[_0xdeb7('0x33')](_0x29e673[_0xdeb7('0x34')],qs[_0xdeb7('0x36')](_0x24d85b[_0xdeb7('0x30')]['fields']));_0x238316[_0xdeb7('0x35')]=_0x238316['attributes'][_0xdeb7('0x37')]?_0x238316[_0xdeb7('0x35')]:_0x29e673[_0xdeb7('0x34')];if(!_0x24d85b[_0xdeb7('0x30')][_0xdeb7('0x38')](_0xdeb7('0x39'))){_0x238316[_0xdeb7('0x1d')]=qs[_0xdeb7('0x1d')](_0x24d85b[_0xdeb7('0x30')][_0xdeb7('0x1d')]);_0x238316['offset']=qs['offset'](_0x24d85b[_0xdeb7('0x30')]['offset']);}_0x238316[_0xdeb7('0x3a')]=qs[_0xdeb7('0x3b')](_0x24d85b[_0xdeb7('0x30')][_0xdeb7('0x3b')]);_0x238316[_0xdeb7('0x3c')]=qs[_0xdeb7('0x32')](_[_0xdeb7('0x3d')](_0x24d85b['query'],_0x29e673['filters']),_0x2d5156);if(_0x24d85b['query'][_0xdeb7('0x3e')]){_0x238316[_0xdeb7('0x3c')]=_[_0xdeb7('0x3f')](_0x238316['where'],{'$or':_['map'](_0x2d5156,function(_0x4445ba){if(_0x4445ba[_0xdeb7('0x2e')]!==_0xdeb7('0x40')){var _0x1cd006={};_0x1cd006[_0x4445ba['name']]={'$like':'%'+_0x24d85b['query'][_0xdeb7('0x3e')]+'%'};return _0x1cd006;}})});}_0x238316=_[_0xdeb7('0x3f')]({},_0x238316,_0x24d85b[_0xdeb7('0x41')]);var _0x1df444={'where':_0x238316[_0xdeb7('0x3c')]};return db[_0xdeb7('0x42')][_0xdeb7('0x1e')](_0x1df444)['then'](function(_0x3ef5f0){_0x3404ec[_0xdeb7('0x1e')]=_0x3ef5f0;if(_0x24d85b[_0xdeb7('0x30')][_0xdeb7('0x43')]){_0x238316[_0xdeb7('0x44')]=[{'all':!![]}];}return db[_0xdeb7('0x42')]['findAll'](_0x238316);})[_0xdeb7('0x25')](function(_0x91c8a3){_0x3404ec['rows']=_0x91c8a3;return _0x3404ec;})['then'](respondWithFilteredResult(_0x19a7c9,_0x238316))['catch'](handleError(_0x19a7c9,null));};exports['show']=function(_0x8ef822,_0x491069){var _0x38110d={'raw':![],'where':{'id':_0x8ef822[_0xdeb7('0x45')]['id']}},_0x5dfe9b={};_0x5dfe9b['model']=_[_0xdeb7('0x31')](db[_0xdeb7('0x42')][_0xdeb7('0x2c')]);_0x5dfe9b[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x8ef822['query']);_0x5dfe9b[_0xdeb7('0x32')]=_[_0xdeb7('0x33')](_0x5dfe9b[_0xdeb7('0x34')],_0x5dfe9b[_0xdeb7('0x30')]);_0x38110d[_0xdeb7('0x35')]=_[_0xdeb7('0x33')](_0x5dfe9b[_0xdeb7('0x34')],qs[_0xdeb7('0x36')](_0x8ef822[_0xdeb7('0x30')][_0xdeb7('0x36')]));_0x38110d['attributes']=_0x38110d['attributes']['length']?_0x38110d[_0xdeb7('0x35')]:_0x5dfe9b['model'];if(_0x8ef822['query']['includeAll']){_0x38110d[_0xdeb7('0x44')]=[{'all':!![]}];}_0x38110d=_[_0xdeb7('0x3f')]({},_0x38110d,_0x8ef822[_0xdeb7('0x41')]);return db['ZohoConfiguration']['find'](_0x38110d)[_0xdeb7('0x25')](handleEntityNotFound(_0x491069,null))[_0xdeb7('0x25')](respondWithResult(_0x491069,null))[_0xdeb7('0x46')](handleError(_0x491069,null));};exports[_0xdeb7('0x47')]=function(_0x22630f,_0x5fbde1){return db['ZohoConfiguration'][_0xdeb7('0x47')](_0x22630f['body'],{})[_0xdeb7('0x25')](respondWithResult(_0x5fbde1,0xc9))[_0xdeb7('0x46')](handleError(_0x5fbde1,null));};exports[_0xdeb7('0x23')]=function(_0x4a5e8b,_0x55025f){if(_0x4a5e8b['body']['id']){delete _0x4a5e8b[_0xdeb7('0x48')]['id'];}return db[_0xdeb7('0x42')][_0xdeb7('0x49')]({'where':{'id':_0x4a5e8b[_0xdeb7('0x45')]['id']}})[_0xdeb7('0x25')](handleEntityNotFound(_0x55025f,null))[_0xdeb7('0x25')](saveUpdates(_0x4a5e8b[_0xdeb7('0x48')],null))[_0xdeb7('0x25')](respondWithResult(_0x55025f,null))[_0xdeb7('0x46')](handleError(_0x55025f,null));};exports[_0xdeb7('0x24')]=function(_0x4049e2,_0x24c881){return db['ZohoConfiguration']['find']({'where':{'id':_0x4049e2['params']['id']}})[_0xdeb7('0x25')](handleEntityNotFound(_0x24c881,null))[_0xdeb7('0x25')](removeEntity(_0x24c881,null))[_0xdeb7('0x46')](handleError(_0x24c881,null));};exports['getFields']=function(_0x114dc8,_0x3666a4,_0x130f0c){var _0x5394e7={};var _0x2ff524={};var _0x2fd91a;var _0x2f5b2a;return db['ZohoConfiguration'][_0xdeb7('0x4a')]({'where':{'id':_0x114dc8[_0xdeb7('0x45')]['id']}})['then'](handleEntityNotFound(_0x3666a4,null))[_0xdeb7('0x25')](function(_0x25e3d6){if(_0x25e3d6){_0x2fd91a=_0x25e3d6;_0x2ff524[_0xdeb7('0x34')]=_['keys'](db[_0xdeb7('0x4b')][_0xdeb7('0x2c')]);_0x2ff524[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x114dc8[_0xdeb7('0x30')]);_0x2ff524[_0xdeb7('0x32')]=_[_0xdeb7('0x33')](_0x2ff524[_0xdeb7('0x34')],_0x2ff524[_0xdeb7('0x30')]);_0x5394e7[_0xdeb7('0x35')]=_['intersection'](_0x2ff524['model'],qs[_0xdeb7('0x36')](_0x114dc8[_0xdeb7('0x30')][_0xdeb7('0x36')]));_0x5394e7[_0xdeb7('0x35')]=_0x5394e7['attributes'][_0xdeb7('0x37')]?_0x5394e7['attributes']:_0x2ff524[_0xdeb7('0x34')];_0x5394e7[_0xdeb7('0x3a')]=qs[_0xdeb7('0x3b')](_0x114dc8[_0xdeb7('0x30')]['sort']);_0x5394e7[_0xdeb7('0x3c')]=qs[_0xdeb7('0x32')](_[_0xdeb7('0x3d')](_0x114dc8[_0xdeb7('0x30')],_0x2ff524[_0xdeb7('0x32')]));if(_0x114dc8[_0xdeb7('0x30')][_0xdeb7('0x3e')]){_0x5394e7[_0xdeb7('0x3c')]=_['merge'](_0x5394e7[_0xdeb7('0x3c')],{'$or':_[_0xdeb7('0x2b')](_0x5394e7['attributes'],function(_0x4b19a6){var _0x5836f7={};_0x5836f7[_0x4b19a6]={'$like':'%'+_0x114dc8[_0xdeb7('0x30')]['filter']+'%'};return _0x5836f7;})});}_0x5394e7=_[_0xdeb7('0x3f')]({},_0x5394e7,_0x114dc8['options']);return _0x2fd91a[_0xdeb7('0x4c')](_0x5394e7);}})[_0xdeb7('0x25')](function(_0x42a725){if(_0x42a725){_0x2f5b2a=_0x42a725[_0xdeb7('0x37')];if(!_0x114dc8[_0xdeb7('0x30')][_0xdeb7('0x38')](_0xdeb7('0x39'))){_0x5394e7[_0xdeb7('0x1d')]=qs['limit'](_0x114dc8[_0xdeb7('0x30')][_0xdeb7('0x1d')]);_0x5394e7['offset']=qs[_0xdeb7('0x1b')](_0x114dc8['query'][_0xdeb7('0x1b')]);}return _0x2fd91a['getFields'](_0x5394e7);}})[_0xdeb7('0x25')](function(_0x39e59b){if(_0x39e59b){return _0x39e59b?{'count':_0x2f5b2a,'rows':_0x39e59b}:null;}})['then'](respondWithResult(_0x3666a4,null))[_0xdeb7('0x46')](handleError(_0x3666a4,null));};exports['getSubjects']=function(_0x4d652a,_0x420e25,_0x812cd){var _0x2945ac={};var _0xa0d037={};var _0x242e10;var _0x4b6292;return db[_0xdeb7('0x42')]['findOne']({'where':{'id':_0x4d652a[_0xdeb7('0x45')]['id']}})[_0xdeb7('0x25')](handleEntityNotFound(_0x420e25,null))[_0xdeb7('0x25')](function(_0x59bad3){if(_0x59bad3){_0x242e10=_0x59bad3;_0xa0d037[_0xdeb7('0x34')]=_[_0xdeb7('0x31')](db[_0xdeb7('0x4b')][_0xdeb7('0x2c')]);_0xa0d037[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x4d652a['query']);_0xa0d037[_0xdeb7('0x32')]=_['intersection'](_0xa0d037[_0xdeb7('0x34')],_0xa0d037[_0xdeb7('0x30')]);_0x2945ac[_0xdeb7('0x35')]=_[_0xdeb7('0x33')](_0xa0d037[_0xdeb7('0x34')],qs[_0xdeb7('0x36')](_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x36')]));_0x2945ac[_0xdeb7('0x35')]=_0x2945ac[_0xdeb7('0x35')][_0xdeb7('0x37')]?_0x2945ac['attributes']:_0xa0d037[_0xdeb7('0x34')];_0x2945ac[_0xdeb7('0x3a')]=qs[_0xdeb7('0x3b')](_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x3b')]);_0x2945ac[_0xdeb7('0x3c')]=qs['filters'](_[_0xdeb7('0x3d')](_0x4d652a['query'],_0xa0d037[_0xdeb7('0x32')]));if(_0x4d652a[_0xdeb7('0x30')]['filter']){_0x2945ac[_0xdeb7('0x3c')]=_[_0xdeb7('0x3f')](_0x2945ac[_0xdeb7('0x3c')],{'$or':_[_0xdeb7('0x2b')](_0x2945ac[_0xdeb7('0x35')],function(_0x15c30f){var _0x46ad69={};_0x46ad69[_0x15c30f]={'$like':'%'+_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x3e')]+'%'};return _0x46ad69;})});}_0x2945ac=_[_0xdeb7('0x3f')]({},_0x2945ac,_0x4d652a[_0xdeb7('0x41')]);return _0x242e10[_0xdeb7('0x4d')](_0x2945ac);}})['then'](function(_0x186027){if(_0x186027){_0x4b6292=_0x186027[_0xdeb7('0x37')];if(!_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x38')]('nolimit')){_0x2945ac[_0xdeb7('0x1d')]=qs['limit'](_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x1d')]);_0x2945ac[_0xdeb7('0x1b')]=qs[_0xdeb7('0x1b')](_0x4d652a[_0xdeb7('0x30')][_0xdeb7('0x1b')]);}return _0x242e10[_0xdeb7('0x4d')](_0x2945ac);}})['then'](function(_0x245187){if(_0x245187){return _0x245187?{'count':_0x4b6292,'rows':_0x245187}:null;}})[_0xdeb7('0x25')](respondWithResult(_0x420e25,null))[_0xdeb7('0x46')](handleError(_0x420e25,null));};exports[_0xdeb7('0x4e')]=function(_0x2a6ded,_0x55136c,_0x37c010){var _0xfaaa5c={};var _0x35a5f3={};var _0x33b477;var _0x5d930b;return db[_0xdeb7('0x42')][_0xdeb7('0x4a')]({'where':{'id':_0x2a6ded[_0xdeb7('0x45')]['id']}})['then'](handleEntityNotFound(_0x55136c,null))[_0xdeb7('0x25')](function(_0x578b3a){if(_0x578b3a){_0x33b477=_0x578b3a;_0x35a5f3[_0xdeb7('0x34')]=_['keys'](db[_0xdeb7('0x4b')][_0xdeb7('0x2c')]);_0x35a5f3[_0xdeb7('0x30')]=_[_0xdeb7('0x31')](_0x2a6ded[_0xdeb7('0x30')]);_0x35a5f3[_0xdeb7('0x32')]=_[_0xdeb7('0x33')](_0x35a5f3[_0xdeb7('0x34')],_0x35a5f3['query']);_0xfaaa5c['attributes']=_['intersection'](_0x35a5f3[_0xdeb7('0x34')],qs[_0xdeb7('0x36')](_0x2a6ded[_0xdeb7('0x30')]['fields']));_0xfaaa5c[_0xdeb7('0x35')]=_0xfaaa5c[_0xdeb7('0x35')][_0xdeb7('0x37')]?_0xfaaa5c[_0xdeb7('0x35')]:_0x35a5f3[_0xdeb7('0x34')];_0xfaaa5c[_0xdeb7('0x3a')]=qs['sort'](_0x2a6ded['query'][_0xdeb7('0x3b')]);_0xfaaa5c[_0xdeb7('0x3c')]=qs['filters'](_[_0xdeb7('0x3d')](_0x2a6ded[_0xdeb7('0x30')],_0x35a5f3[_0xdeb7('0x32')]));if(_0x2a6ded[_0xdeb7('0x30')][_0xdeb7('0x3e')]){_0xfaaa5c[_0xdeb7('0x3c')]=_[_0xdeb7('0x3f')](_0xfaaa5c[_0xdeb7('0x3c')],{'$or':_[_0xdeb7('0x2b')](_0xfaaa5c[_0xdeb7('0x35')],function(_0x6120bc){var _0x32b533={};_0x32b533[_0x6120bc]={'$like':'%'+_0x2a6ded['query']['filter']+'%'};return _0x32b533;})});}_0xfaaa5c=_[_0xdeb7('0x3f')]({},_0xfaaa5c,_0x2a6ded[_0xdeb7('0x41')]);return _0x33b477['getDescriptions'](_0xfaaa5c);}})[_0xdeb7('0x25')](function(_0x3deaff){if(_0x3deaff){_0x5d930b=_0x3deaff['length'];if(!_0x2a6ded[_0xdeb7('0x30')][_0xdeb7('0x38')](_0xdeb7('0x39'))){_0xfaaa5c[_0xdeb7('0x1d')]=qs[_0xdeb7('0x1d')](_0x2a6ded['query'][_0xdeb7('0x1d')]);_0xfaaa5c[_0xdeb7('0x1b')]=qs[_0xdeb7('0x1b')](_0x2a6ded[_0xdeb7('0x30')][_0xdeb7('0x1b')]);}return _0x33b477[_0xdeb7('0x4e')](_0xfaaa5c);}})[_0xdeb7('0x25')](function(_0x5b95f5){if(_0x5b95f5){return _0x5b95f5?{'count':_0x5d930b,'rows':_0x5b95f5}:null;}})[_0xdeb7('0x25')](respondWithResult(_0x55136c,null))[_0xdeb7('0x46')](handleError(_0x55136c,null));};
\ No newline at end of file
index 584fa3f..a296407 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x91cf=['./intZohoConfiguration.attributes','define','util','api','moment','bluebird','rimraf'];(function(_0x447356,_0x81daf5){var _0x1105c0=function(_0x39b739){while(--_0x39b739){_0x447356['push'](_0x447356['shift']());}};_0x1105c0(++_0x81daf5);}(_0x91cf,0x191));var _0xf91c=function(_0x4a8812,_0x430080){_0x4a8812=_0x4a8812-0x0;var _0x55a784=_0x91cf[_0x4a8812];return _0x55a784;};'use strict';var _=require('lodash');var util=require(_0xf91c('0x0'));var logger=require('../../config/logger')(_0xf91c('0x1'));var moment=require(_0xf91c('0x2'));var BPromise=require(_0xf91c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf91c('0x4'));var config=require('../../config/environment');var attributes=require(_0xf91c('0x5'));module['exports']=function(_0x14512b,_0x36cd02){return _0x14512b[_0xf91c('0x6')]('ZohoConfiguration',attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd008=['exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./intZohoConfiguration.attributes'];(function(_0x59e834,_0x471eea){var _0x4e87d1=function(_0x3ee07b){while(--_0x3ee07b){_0x59e834['push'](_0x59e834['shift']());}};_0x4e87d1(++_0x471eea);}(_0xd008,0x1f2));var _0x8d00=function(_0x1d0a8f,_0x5be26e){_0x1d0a8f=_0x1d0a8f-0x0;var _0x95a168=_0xd008[_0x1d0a8f];return _0x95a168;};'use strict';var _=require(_0x8d00('0x0'));var util=require(_0x8d00('0x1'));var logger=require(_0x8d00('0x2'))(_0x8d00('0x3'));var moment=require(_0x8d00('0x4'));var BPromise=require(_0x8d00('0x5'));var rp=require(_0x8d00('0x6'));var fs=require('fs');var path=require(_0x8d00('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8d00('0x8'));module[_0x8d00('0x9')]=function(_0x4946b4,_0x4fb09c){return _0x4946b4[_0x8d00('0xa')](_0x8d00('0xb'),attributes,{'tableName':_0x8d00('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 441ff85..3b1a897 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39d1=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x503c6b,_0x5f3a8){var _0x1634f7=function(_0x484ddd){while(--_0x484ddd){_0x503c6b['push'](_0x503c6b['shift']());}};_0x1634f7(++_0x5f3a8);}(_0x39d1,0x14f));var _0x139d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x39d1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x139d('0x0'));var util=require(_0x139d('0x1'));var moment=require(_0x139d('0x2'));var BPromise=require(_0x139d('0x3'));var rs=require(_0x139d('0x4'));var fs=require('fs');var Redis=require(_0x139d('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x139d('0x6'));var logger=require('../../config/logger')(_0x139d('0x7'));var config=require(_0x139d('0x8'));var jayson=require(_0x139d('0x9'));var client=jayson[_0x139d('0xa')][_0x139d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fd1e0,_0xdf7139,_0x59f996){return new BPromise(function(_0x1ccd39,_0x18b176){return client[_0x139d('0xc')](_0x2fd1e0,_0x59f996)[_0x139d('0xd')](function(_0x41c21d){logger[_0x139d('0xe')](_0x139d('0xf'),_0xdf7139,_0x139d('0x10'));logger[_0x139d('0x11')](_0x139d('0x12'),_0xdf7139,_0x139d('0x10'),JSON['stringify'](_0x41c21d));if(_0x41c21d[_0x139d('0x13')]){if(_0x41c21d['error']['code']===0x1f4){logger[_0x139d('0x13')](_0x139d('0xf'),_0xdf7139,_0x41c21d['error'][_0x139d('0x14')]);return _0x18b176(_0x41c21d[_0x139d('0x13')][_0x139d('0x14')]);}logger['error'](_0x139d('0xf'),_0xdf7139,_0x41c21d[_0x139d('0x13')][_0x139d('0x14')]);return _0x1ccd39(_0x41c21d[_0x139d('0x13')][_0x139d('0x14')]);}else{logger[_0x139d('0xe')](_0x139d('0xf'),_0xdf7139,'request\x20sent');_0x1ccd39(_0x41c21d[_0x139d('0x15')][_0x139d('0x14')]);}})['catch'](function(_0x5ccf8a){logger[_0x139d('0x13')](_0x139d('0xf'),_0xdf7139,_0x5ccf8a);_0x18b176(_0x5ccf8a);});});}
\ No newline at end of file
+var _0xf7b0=['ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request','request\x20sent','debug','error','ZohoConfiguration,\x20%s,\x20%s','message','info','result','lodash','util','bluebird'];(function(_0x3d7ec4,_0x55a465){var _0x2ada8d=function(_0x402c31){while(--_0x402c31){_0x3d7ec4['push'](_0x3d7ec4['shift']());}};_0x2ada8d(++_0x55a465);}(_0xf7b0,0xbd));var _0x0f7b=function(_0x25510b,_0x35c068){_0x25510b=_0x25510b-0x0;var _0xfd10f=_0xf7b0[_0x25510b];return _0xfd10f;};'use strict';var _=require(_0x0f7b('0x0'));var util=require(_0x0f7b('0x1'));var moment=require('moment');var BPromise=require(_0x0f7b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f7b('0x3'));var db=require(_0x0f7b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0f7b('0x5'))('rpc');var config=require(_0x0f7b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0f7b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7e0892,_0x2d2dba,_0x1b2ed0){return new BPromise(function(_0x3eb24e,_0x32a45d){return client[_0x0f7b('0x8')](_0x7e0892,_0x1b2ed0)['then'](function(_0x588386){logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x2d2dba,_0x0f7b('0x9'));logger[_0x0f7b('0xa')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x2d2dba,_0x0f7b('0x9'),JSON['stringify'](_0x588386));if(_0x588386[_0x0f7b('0xb')]){if(_0x588386[_0x0f7b('0xb')]['code']===0x1f4){logger[_0x0f7b('0xb')](_0x0f7b('0xc'),_0x2d2dba,_0x588386[_0x0f7b('0xb')][_0x0f7b('0xd')]);return _0x32a45d(_0x588386['error'][_0x0f7b('0xd')]);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2d2dba,_0x588386[_0x0f7b('0xb')]['message']);return _0x3eb24e(_0x588386[_0x0f7b('0xb')][_0x0f7b('0xd')]);}else{logger[_0x0f7b('0xe')](_0x0f7b('0xc'),_0x2d2dba,_0x0f7b('0x9'));_0x3eb24e(_0x588386[_0x0f7b('0xf')][_0x0f7b('0xd')]);}})['catch'](function(_0xef9c81){logger[_0x0f7b('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x2d2dba,_0xef9c81);_0x32a45d(_0xef9c81);});});}
\ No newline at end of file
index 1b5f440..f7c5ecd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0fb1=['isAuthenticated','post','create','put','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','index','/:id'];(function(_0x492af6,_0x2ccca0){var _0x49cf4c=function(_0x1af216){while(--_0x1af216){_0x492af6['push'](_0x492af6['shift']());}};_0x49cf4c(++_0x2ccca0);}(_0x0fb1,0x96));var _0x10fb=function(_0x2a57c2,_0x293b05){_0x2a57c2=_0x2a57c2-0x0;var _0x43fb9c=_0x0fb1[_0x2a57c2];return _0x43fb9c;};'use strict';var multer=require(_0x10fb('0x0'));var util=require('util');var path=require(_0x10fb('0x1'));var timeout=require(_0x10fb('0x2'));var express=require(_0x10fb('0x3'));var router=express['Router']();var fs_extra=require(_0x10fb('0x4'));var auth=require(_0x10fb('0x5'));var interaction=require(_0x10fb('0x6'));var config=require(_0x10fb('0x7'));var controller=require(_0x10fb('0x8'));router[_0x10fb('0x9')]('/',auth['isAuthenticated'](),controller[_0x10fb('0xa')]);router['get'](_0x10fb('0xb'),auth[_0x10fb('0xc')](),controller['show']);router[_0x10fb('0xd')]('/',auth[_0x10fb('0xc')](),controller[_0x10fb('0xe')]);router[_0x10fb('0xf')]('/:id',auth[_0x10fb('0xc')](),controller['update']);router[_0x10fb('0x10')](_0x10fb('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x10fb('0x11')]=router;
\ No newline at end of file
+var _0xcce4=['post','create','delete','exports','util','express','Router','fs-extra','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcce4,0x1a8));var _0x4cce=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xcce4[_0x12d812];return _0x3711ab;};'use strict';var multer=require('multer');var util=require(_0x4cce('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4cce('0x1'));var router=express[_0x4cce('0x2')]();var fs_extra=require(_0x4cce('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4cce('0x4'));var controller=require(_0x4cce('0x5'));router[_0x4cce('0x6')]('/',auth[_0x4cce('0x7')](),controller[_0x4cce('0x8')]);router['get'](_0x4cce('0x9'),auth[_0x4cce('0x7')](),controller[_0x4cce('0xa')]);router[_0x4cce('0xb')]('/',auth[_0x4cce('0x7')](),controller[_0x4cce('0xc')]);router['put']('/:id',auth[_0x4cce('0x7')](),controller['update']);router[_0x4cce('0xd')](_0x4cce('0x9'),auth[_0x4cce('0x7')](),controller['destroy']);module[_0x4cce('0xe')]=router;
\ No newline at end of file
index 2ef5a54..26bf5fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb11a=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','string','variable','customVariable'];(function(_0x19a23e,_0x283526){var _0x5e12e8=function(_0x5bbbaa){while(--_0x5bbbaa){_0x19a23e['push'](_0x19a23e['shift']());}};_0x5e12e8(++_0x283526);}(_0xb11a,0x17e));var _0xab11=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xb11a[_0x3ff085];return _0x2b68c3;};'use strict';var Sequelize=require(_0xab11('0x0'));module[_0xab11('0x1')]={'type':{'type':Sequelize['ENUM'](_0xab11('0x2'),_0xab11('0x3'),_0xab11('0x4'),_0xab11('0x5'),_0xab11('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xab11('0x7')]},'key':{'type':Sequelize[_0xab11('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xab11('0x2'),_0xab11('0x3'),_0xab11('0x4'))},'keyContent':{'type':Sequelize[_0xab11('0x7')]},'idField':{'type':Sequelize[_0xab11('0x7')]},'nameField':{'type':Sequelize[_0xab11('0x7')]},'customField':{'type':Sequelize[_0xab11('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xab11('0x7')]}};
\ No newline at end of file
+var _0xc19d=['keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string','variable'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xc19d,0x8b));var _0xdc19=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xc19d[_0x616290];return _0x453879;};'use strict';var Sequelize=require(_0xdc19('0x0'));module[_0xdc19('0x1')]={'type':{'type':Sequelize[_0xdc19('0x2')](_0xdc19('0x3'),_0xdc19('0x4'),'customVariable',_0xdc19('0x5'),_0xdc19('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xdc19('0x7')]},'key':{'type':Sequelize[_0xdc19('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xdc19('0x3'),'variable',_0xdc19('0x8'))},'keyContent':{'type':Sequelize[_0xdc19('0x7')]},'idField':{'type':Sequelize[_0xdc19('0x7')]},'nameField':{'type':Sequelize[_0xdc19('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdc19('0x7')]}};
\ No newline at end of file
index 99423fe..531c26f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88ab=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','ZohoField','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','catch','params','find','create','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0x41a8af,_0x58b9d8){var _0x316bd7=function(_0x3880d9){while(--_0x3880d9){_0x41a8af['push'](_0x41a8af['shift']());}};_0x316bd7(++_0x58b9d8);}(_0x88ab,0x82));var _0xb88a=function(_0x611cc8,_0x4b06a8){_0x611cc8=_0x611cc8-0x0;var _0x4287f7=_0x88ab[_0x611cc8];return _0x4287f7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb88a('0x0'));var zipdir=require(_0xb88a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb88a('0x2'));var moment=require(_0xb88a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb88a('0x4'));var util=require(_0xb88a('0x5'));var path=require(_0xb88a('0x6'));var sox=require(_0xb88a('0x7'));var csv=require(_0xb88a('0x8'));var ejs=require(_0xb88a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb88a('0xa'));var squel=require(_0xb88a('0xb'));var crypto=require(_0xb88a('0xc'));var jsforce=require(_0xb88a('0xd'));var deskjs=require(_0xb88a('0xe'));var toCsv=require(_0xb88a('0x8'));var querystring=require(_0xb88a('0xf'));var Papa=require(_0xb88a('0x10'));var Redis=require(_0xb88a('0x11'));var authService=require(_0xb88a('0x12'));var qs=require(_0xb88a('0x13'));var as=require(_0xb88a('0x14'));var hardwareService=require(_0xb88a('0x15'));var logger=require('../../config/logger')(_0xb88a('0x16'));var utils=require('../../config/utils');var config=require(_0xb88a('0x17'));var licenseUtil=require(_0xb88a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ba437,_0x1d02ca){_0x1d02ca=_0x1d02ca||0xcc;return function(_0x580b44){if(_0x580b44){return _0x5ba437[_0xb88a('0x19')](_0x1d02ca);}return _0x5ba437[_0xb88a('0x1a')](_0x1d02ca)[_0xb88a('0x1b')]();};}function respondWithResult(_0x3563f9,_0x3dae44){_0x3dae44=_0x3dae44||0xc8;return function(_0x11da52){if(_0x11da52){return _0x3563f9[_0xb88a('0x1a')](_0x3dae44)['json'](_0x11da52);}};}function respondWithFilteredResult(_0x9907bf,_0x338b65){return function(_0x336afa){if(_0x336afa){var _0x56d513=typeof _0x338b65['offset']===_0xb88a('0x1c')&&typeof _0x338b65[_0xb88a('0x1d')]===_0xb88a('0x1c');var _0x4bc2c8=_0x336afa[_0xb88a('0x1e')];var _0x5dc223=_0x56d513?0x0:_0x338b65[_0xb88a('0x1f')];var _0x17729e=_0x56d513?_0x336afa[_0xb88a('0x1e')]:_0x338b65['offset']+_0x338b65['limit'];var _0x130b5d;if(_0x17729e>=_0x4bc2c8){_0x17729e=_0x4bc2c8;_0x130b5d=0xc8;}else{_0x130b5d=0xce;}_0x9907bf[_0xb88a('0x1a')](_0x130b5d);return _0x9907bf['set']('Content-Range',_0x5dc223+'-'+_0x17729e+'/'+_0x4bc2c8)[_0xb88a('0x20')](_0x336afa);}return null;};}function patchUpdates(_0x3fdc42){return function(_0x55aae2){try{jsonpatch[_0xb88a('0x21')](_0x55aae2,_0x3fdc42,!![]);}catch(_0x106c13){return BPromise[_0xb88a('0x22')](_0x106c13);}return _0x55aae2[_0xb88a('0x23')]();};}function saveUpdates(_0x3222d0,_0x656cab){return function(_0x298924){if(_0x298924){return _0x298924[_0xb88a('0x24')](_0x3222d0)[_0xb88a('0x25')](function(_0x2f1e4b){return _0x2f1e4b;});}return null;};}function removeEntity(_0x373135,_0x42ca42){return function(_0x5dbb00){if(_0x5dbb00){return _0x5dbb00[_0xb88a('0x26')]()['then'](function(){_0x373135[_0xb88a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d62c1,_0x388402){return function(_0x3a6f1a){if(!_0x3a6f1a){_0x2d62c1['sendStatus'](0x194);}return _0x3a6f1a;};}function handleError(_0x4b18a3,_0x441e0f){_0x441e0f=_0x441e0f||0x1f4;return function(_0x5b7fd5){logger['error'](_0x5b7fd5[_0xb88a('0x27')]);if(_0x5b7fd5[_0xb88a('0x28')]){delete _0x5b7fd5[_0xb88a('0x28')];}_0x4b18a3[_0xb88a('0x1a')](_0x441e0f)[_0xb88a('0x29')](_0x5b7fd5);};}exports[_0xb88a('0x2a')]=function(_0x3de3a7,_0x512bba){var _0x1747b2={},_0x2099ad={},_0x9c3d72={'count':0x0,'rows':[]};var _0x1b3e1b=_[_0xb88a('0x2b')](db[_0xb88a('0x2c')][_0xb88a('0x2d')],function(_0x4c5613){return{'name':_0x4c5613['fieldName'],'type':_0x4c5613[_0xb88a('0x2e')][_0xb88a('0x2f')]};});_0x2099ad[_0xb88a('0x30')]=_[_0xb88a('0x2b')](_0x1b3e1b,_0xb88a('0x28'));_0x2099ad[_0xb88a('0x31')]=_[_0xb88a('0x32')](_0x3de3a7[_0xb88a('0x31')]);_0x2099ad['filters']=_[_0xb88a('0x33')](_0x2099ad[_0xb88a('0x30')],_0x2099ad['query']);_0x1747b2['attributes']=_[_0xb88a('0x33')](_0x2099ad[_0xb88a('0x30')],qs[_0xb88a('0x34')](_0x3de3a7[_0xb88a('0x31')][_0xb88a('0x34')]));_0x1747b2[_0xb88a('0x35')]=_0x1747b2[_0xb88a('0x35')][_0xb88a('0x36')]?_0x1747b2[_0xb88a('0x35')]:_0x2099ad[_0xb88a('0x30')];if(!_0x3de3a7[_0xb88a('0x31')][_0xb88a('0x37')](_0xb88a('0x38'))){_0x1747b2[_0xb88a('0x1d')]=qs[_0xb88a('0x1d')](_0x3de3a7[_0xb88a('0x31')]['limit']);_0x1747b2[_0xb88a('0x1f')]=qs[_0xb88a('0x1f')](_0x3de3a7['query']['offset']);}_0x1747b2[_0xb88a('0x39')]=qs[_0xb88a('0x3a')](_0x3de3a7[_0xb88a('0x31')][_0xb88a('0x3a')]);_0x1747b2[_0xb88a('0x3b')]=qs[_0xb88a('0x3c')](_[_0xb88a('0x3d')](_0x3de3a7['query'],_0x2099ad[_0xb88a('0x3c')]),_0x1b3e1b);if(_0x3de3a7[_0xb88a('0x31')]['filter']){_0x1747b2[_0xb88a('0x3b')]=_['merge'](_0x1747b2['where'],{'$or':_[_0xb88a('0x2b')](_0x1b3e1b,function(_0x157cbe){if(_0x157cbe['type']!=='VIRTUAL'){var _0x48d537={};_0x48d537[_0x157cbe[_0xb88a('0x28')]]={'$like':'%'+_0x3de3a7['query'][_0xb88a('0x3e')]+'%'};return _0x48d537;}})});}_0x1747b2=_[_0xb88a('0x3f')]({},_0x1747b2,_0x3de3a7[_0xb88a('0x40')]);var _0x4729d8={'where':_0x1747b2['where']};return db[_0xb88a('0x2c')][_0xb88a('0x1e')](_0x4729d8)['then'](function(_0xd23d4c){_0x9c3d72['count']=_0xd23d4c;if(_0x3de3a7[_0xb88a('0x31')]['includeAll']){_0x1747b2[_0xb88a('0x41')]=[{'all':!![]}];}return db[_0xb88a('0x2c')]['findAll'](_0x1747b2);})[_0xb88a('0x25')](function(_0x325a4){_0x9c3d72['rows']=_0x325a4;return _0x9c3d72;})['then'](respondWithFilteredResult(_0x512bba,_0x1747b2))[_0xb88a('0x42')](handleError(_0x512bba,null));};exports['show']=function(_0x514346,_0xe4c81e){var _0x24926c={'raw':!![],'where':{'id':_0x514346[_0xb88a('0x43')]['id']}},_0x4fa2de={};_0x4fa2de['model']=_['keys'](db[_0xb88a('0x2c')]['rawAttributes']);_0x4fa2de['query']=_[_0xb88a('0x32')](_0x514346[_0xb88a('0x31')]);_0x4fa2de[_0xb88a('0x3c')]=_[_0xb88a('0x33')](_0x4fa2de[_0xb88a('0x30')],_0x4fa2de['query']);_0x24926c[_0xb88a('0x35')]=_[_0xb88a('0x33')](_0x4fa2de[_0xb88a('0x30')],qs[_0xb88a('0x34')](_0x514346['query'][_0xb88a('0x34')]));_0x24926c[_0xb88a('0x35')]=_0x24926c[_0xb88a('0x35')]['length']?_0x24926c[_0xb88a('0x35')]:_0x4fa2de[_0xb88a('0x30')];if(_0x514346[_0xb88a('0x31')]['includeAll']){_0x24926c[_0xb88a('0x41')]=[{'all':!![]}];}_0x24926c=_[_0xb88a('0x3f')]({},_0x24926c,_0x514346[_0xb88a('0x40')]);return db['ZohoField'][_0xb88a('0x44')](_0x24926c)[_0xb88a('0x25')](handleEntityNotFound(_0xe4c81e,null))['then'](respondWithResult(_0xe4c81e,null))['catch'](handleError(_0xe4c81e,null));};exports[_0xb88a('0x45')]=function(_0x341a3f,_0x5c0dc4){return db[_0xb88a('0x2c')][_0xb88a('0x45')](_0x341a3f[_0xb88a('0x46')],{})[_0xb88a('0x25')](respondWithResult(_0x5c0dc4,0xc9))[_0xb88a('0x42')](handleError(_0x5c0dc4,null));};exports[_0xb88a('0x24')]=function(_0x5c7450,_0x422395){if(_0x5c7450[_0xb88a('0x46')]['id']){delete _0x5c7450[_0xb88a('0x46')]['id'];}return db[_0xb88a('0x2c')]['find']({'where':{'id':_0x5c7450['params']['id']}})[_0xb88a('0x25')](handleEntityNotFound(_0x422395,null))[_0xb88a('0x25')](saveUpdates(_0x5c7450[_0xb88a('0x46')],null))[_0xb88a('0x25')](respondWithResult(_0x422395,null))[_0xb88a('0x42')](handleError(_0x422395,null));};exports[_0xb88a('0x26')]=function(_0x4c5fc7,_0x4857a9){return db[_0xb88a('0x2c')]['find']({'where':{'id':_0x4c5fc7[_0xb88a('0x43')]['id']}})['then'](handleEntityNotFound(_0x4857a9,null))['then'](removeEntity(_0x4857a9,null))[_0xb88a('0x42')](handleError(_0x4857a9,null));};
\ No newline at end of file
+var _0x7508=['../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','count','set','apply','save','update','destroy','sendStatus','error','stack','name','send','index','map','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','then','rows','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x4dac30,_0x3d42c8){var _0x52a5ad=function(_0x328f9b){while(--_0x328f9b){_0x4dac30['push'](_0x4dac30['shift']());}};_0x52a5ad(++_0x3d42c8);}(_0x7508,0xc3));var _0x8750=function(_0x262cd9,_0x154022){_0x262cd9=_0x262cd9-0x0;var _0x53a896=_0x7508[_0x262cd9];return _0x53a896;};'use strict';var emlformat=require(_0x8750('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8750('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8750('0x2'));var moment=require('moment');var BPromise=require(_0x8750('0x3'));var Mustache=require('mustache');var util=require(_0x8750('0x4'));var path=require(_0x8750('0x5'));var sox=require('sox');var csv=require(_0x8750('0x6'));var ejs=require(_0x8750('0x7'));var fs=require('fs');var fs_extra=require(_0x8750('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8750('0x9'));var deskjs=require(_0x8750('0xa'));var toCsv=require(_0x8750('0x6'));var querystring=require(_0x8750('0xb'));var Papa=require(_0x8750('0xc'));var Redis=require('ioredis');var authService=require(_0x8750('0xd'));var qs=require(_0x8750('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8750('0xf'));var logger=require('../../config/logger')(_0x8750('0x10'));var utils=require(_0x8750('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x8750('0x12'));var db=require(_0x8750('0x13'))['db'];function respondWithStatusCode(_0x31eb34,_0x41737f){_0x41737f=_0x41737f||0xcc;return function(_0x363c35){if(_0x363c35){return _0x31eb34['sendStatus'](_0x41737f);}return _0x31eb34['status'](_0x41737f)[_0x8750('0x14')]();};}function respondWithResult(_0x1401f5,_0x7d8c61){_0x7d8c61=_0x7d8c61||0xc8;return function(_0x4bf024){if(_0x4bf024){return _0x1401f5[_0x8750('0x15')](_0x7d8c61)[_0x8750('0x16')](_0x4bf024);}};}function respondWithFilteredResult(_0x4ce091,_0x4e6de6){return function(_0x1c44bd){if(_0x1c44bd){var _0x2459fd=typeof _0x4e6de6[_0x8750('0x17')]==='undefined'&&typeof _0x4e6de6[_0x8750('0x18')]===_0x8750('0x19');var _0x37d6b6=_0x1c44bd['count'];var _0x8fb3ce=_0x2459fd?0x0:_0x4e6de6[_0x8750('0x17')];var _0x4837df=_0x2459fd?_0x1c44bd[_0x8750('0x1a')]:_0x4e6de6[_0x8750('0x17')]+_0x4e6de6[_0x8750('0x18')];var _0x16e4d9;if(_0x4837df>=_0x37d6b6){_0x4837df=_0x37d6b6;_0x16e4d9=0xc8;}else{_0x16e4d9=0xce;}_0x4ce091[_0x8750('0x15')](_0x16e4d9);return _0x4ce091[_0x8750('0x1b')]('Content-Range',_0x8fb3ce+'-'+_0x4837df+'/'+_0x37d6b6)[_0x8750('0x16')](_0x1c44bd);}return null;};}function patchUpdates(_0x37e6ce){return function(_0x4e4e10){try{jsonpatch[_0x8750('0x1c')](_0x4e4e10,_0x37e6ce,!![]);}catch(_0x11486f){return BPromise['reject'](_0x11486f);}return _0x4e4e10[_0x8750('0x1d')]();};}function saveUpdates(_0x50f9f0,_0x5dc08e){return function(_0x898d13){if(_0x898d13){return _0x898d13[_0x8750('0x1e')](_0x50f9f0)['then'](function(_0x1a3c2f){return _0x1a3c2f;});}return null;};}function removeEntity(_0x366828,_0x4d278){return function(_0x3c5376){if(_0x3c5376){return _0x3c5376[_0x8750('0x1f')]()['then'](function(){_0x366828[_0x8750('0x15')](0xcc)[_0x8750('0x14')]();});}};}function handleEntityNotFound(_0x190481,_0x59a490){return function(_0x3ee596){if(!_0x3ee596){_0x190481[_0x8750('0x20')](0x194);}return _0x3ee596;};}function handleError(_0x34a841,_0x4c5199){_0x4c5199=_0x4c5199||0x1f4;return function(_0x410e58){logger[_0x8750('0x21')](_0x410e58[_0x8750('0x22')]);if(_0x410e58[_0x8750('0x23')]){delete _0x410e58[_0x8750('0x23')];}_0x34a841[_0x8750('0x15')](_0x4c5199)[_0x8750('0x24')](_0x410e58);};}exports[_0x8750('0x25')]=function(_0x1c0d4d,_0x55a90e){var _0x551f4e={},_0x4168d8={},_0x3d15ec={'count':0x0,'rows':[]};var _0x48886e=_[_0x8750('0x26')](db[_0x8750('0x27')][_0x8750('0x28')],function(_0x5c94e8){return{'name':_0x5c94e8[_0x8750('0x29')],'type':_0x5c94e8[_0x8750('0x2a')][_0x8750('0x2b')]};});_0x4168d8[_0x8750('0x2c')]=_['map'](_0x48886e,'name');_0x4168d8[_0x8750('0x2d')]=_['keys'](_0x1c0d4d[_0x8750('0x2d')]);_0x4168d8[_0x8750('0x2e')]=_['intersection'](_0x4168d8['model'],_0x4168d8[_0x8750('0x2d')]);_0x551f4e[_0x8750('0x2f')]=_[_0x8750('0x30')](_0x4168d8[_0x8750('0x2c')],qs['fields'](_0x1c0d4d['query'][_0x8750('0x31')]));_0x551f4e[_0x8750('0x2f')]=_0x551f4e['attributes']['length']?_0x551f4e[_0x8750('0x2f')]:_0x4168d8[_0x8750('0x2c')];if(!_0x1c0d4d[_0x8750('0x2d')][_0x8750('0x32')](_0x8750('0x33'))){_0x551f4e[_0x8750('0x18')]=qs[_0x8750('0x18')](_0x1c0d4d[_0x8750('0x2d')]['limit']);_0x551f4e['offset']=qs[_0x8750('0x17')](_0x1c0d4d[_0x8750('0x2d')][_0x8750('0x17')]);}_0x551f4e[_0x8750('0x34')]=qs[_0x8750('0x35')](_0x1c0d4d[_0x8750('0x2d')][_0x8750('0x35')]);_0x551f4e[_0x8750('0x36')]=qs[_0x8750('0x2e')](_[_0x8750('0x37')](_0x1c0d4d[_0x8750('0x2d')],_0x4168d8[_0x8750('0x2e')]),_0x48886e);if(_0x1c0d4d['query'][_0x8750('0x38')]){_0x551f4e[_0x8750('0x36')]=_[_0x8750('0x39')](_0x551f4e[_0x8750('0x36')],{'$or':_['map'](_0x48886e,function(_0x219e46){if(_0x219e46[_0x8750('0x2a')]!==_0x8750('0x3a')){var _0x100168={};_0x100168[_0x219e46['name']]={'$like':'%'+_0x1c0d4d[_0x8750('0x2d')]['filter']+'%'};return _0x100168;}})});}_0x551f4e=_[_0x8750('0x39')]({},_0x551f4e,_0x1c0d4d[_0x8750('0x3b')]);var _0x5e4e81={'where':_0x551f4e[_0x8750('0x36')]};return db[_0x8750('0x27')][_0x8750('0x1a')](_0x5e4e81)['then'](function(_0x9cef8c){_0x3d15ec[_0x8750('0x1a')]=_0x9cef8c;if(_0x1c0d4d[_0x8750('0x2d')][_0x8750('0x3c')]){_0x551f4e['include']=[{'all':!![]}];}return db[_0x8750('0x27')]['findAll'](_0x551f4e);})[_0x8750('0x3d')](function(_0x1a43e9){_0x3d15ec[_0x8750('0x3e')]=_0x1a43e9;return _0x3d15ec;})[_0x8750('0x3d')](respondWithFilteredResult(_0x55a90e,_0x551f4e))[_0x8750('0x3f')](handleError(_0x55a90e,null));};exports[_0x8750('0x40')]=function(_0xd52036,_0x2aac1a){var _0x173ce2={'raw':!![],'where':{'id':_0xd52036[_0x8750('0x41')]['id']}},_0x59ae6f={};_0x59ae6f[_0x8750('0x2c')]=_[_0x8750('0x42')](db['ZohoField'][_0x8750('0x28')]);_0x59ae6f[_0x8750('0x2d')]=_[_0x8750('0x42')](_0xd52036[_0x8750('0x2d')]);_0x59ae6f[_0x8750('0x2e')]=_['intersection'](_0x59ae6f['model'],_0x59ae6f['query']);_0x173ce2['attributes']=_[_0x8750('0x30')](_0x59ae6f['model'],qs['fields'](_0xd52036[_0x8750('0x2d')]['fields']));_0x173ce2[_0x8750('0x2f')]=_0x173ce2[_0x8750('0x2f')]['length']?_0x173ce2[_0x8750('0x2f')]:_0x59ae6f[_0x8750('0x2c')];if(_0xd52036[_0x8750('0x2d')][_0x8750('0x3c')]){_0x173ce2[_0x8750('0x43')]=[{'all':!![]}];}_0x173ce2=_[_0x8750('0x39')]({},_0x173ce2,_0xd52036[_0x8750('0x3b')]);return db[_0x8750('0x27')][_0x8750('0x44')](_0x173ce2)['then'](handleEntityNotFound(_0x2aac1a,null))[_0x8750('0x3d')](respondWithResult(_0x2aac1a,null))[_0x8750('0x3f')](handleError(_0x2aac1a,null));};exports[_0x8750('0x45')]=function(_0x1c09a8,_0x45709e){return db['ZohoField']['create'](_0x1c09a8['body'],{})[_0x8750('0x3d')](respondWithResult(_0x45709e,0xc9))[_0x8750('0x3f')](handleError(_0x45709e,null));};exports[_0x8750('0x1e')]=function(_0x8b1a90,_0x350634){if(_0x8b1a90['body']['id']){delete _0x8b1a90[_0x8750('0x46')]['id'];}return db[_0x8750('0x27')]['find']({'where':{'id':_0x8b1a90[_0x8750('0x41')]['id']}})[_0x8750('0x3d')](handleEntityNotFound(_0x350634,null))[_0x8750('0x3d')](saveUpdates(_0x8b1a90[_0x8750('0x46')],null))[_0x8750('0x3d')](respondWithResult(_0x350634,null))[_0x8750('0x3f')](handleError(_0x350634,null));};exports[_0x8750('0x1f')]=function(_0x6031d9,_0x2c4e3d){return db[_0x8750('0x27')]['find']({'where':{'id':_0x6031d9[_0x8750('0x41')]['id']}})[_0x8750('0x3d')](handleEntityNotFound(_0x2c4e3d,null))[_0x8750('0x3d')](removeEntity(_0x2c4e3d,null))['catch'](handleError(_0x2c4e3d,null));};
\ No newline at end of file
index 5a62d68..9c734ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['ZohoField','int_zoho_fields','zoho_unique_index','idField','FieldId','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xadb5,0xad));var _0x5adb=function(_0xe3d254,_0x1c8813){_0xe3d254=_0xe3d254-0x0;var _0x5edea6=_0xadb5[_0xe3d254];return _0x5edea6;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var logger=require('../../config/logger')(_0x5adb('0x1'));var moment=require(_0x5adb('0x2'));var BPromise=require(_0x5adb('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5adb('0x4'));var rimraf=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var attributes=require('./intZohoField.attributes');module[_0x5adb('0x7')]=function(_0x168d89,_0x3e2555){return _0x168d89[_0x5adb('0x8')](_0x5adb('0x9'),attributes,{'tableName':_0x5adb('0xa'),'paranoid':![],'indexes':[{'name':_0x5adb('0xb'),'fields':[_0x5adb('0xc'),_0x5adb('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x5204=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','lodash'];(function(_0x499238,_0x226523){var _0x5613f7=function(_0x33cd11){while(--_0x33cd11){_0x499238['push'](_0x499238['shift']());}};_0x5613f7(++_0x226523);}(_0x5204,0xdf));var _0x4520=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x5204[_0x845505];return _0x2513b9;};'use strict';var _=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var logger=require('../../config/logger')(_0x4520('0x2'));var moment=require(_0x4520('0x3'));var BPromise=require(_0x4520('0x4'));var rp=require(_0x4520('0x5'));var fs=require('fs');var path=require(_0x4520('0x6'));var rimraf=require('rimraf');var config=require(_0x4520('0x7'));var attributes=require('./intZohoField.attributes');module[_0x4520('0x8')]=function(_0x209381,_0xe0a256){return _0x209381[_0x4520('0x9')](_0x4520('0xa'),attributes,{'tableName':_0x4520('0xb'),'paranoid':![],'indexes':[{'name':_0x4520('0xc'),'fields':['idField',_0x4520('0xd')],'unique':!![]}],'timestamps':!![]});};
\ No newline at end of file
index 6822a2b..2762954 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x76e0=['info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x242818,_0x381098){var _0x3a52bc=function(_0x261db6){while(--_0x261db6){_0x242818['push'](_0x242818['shift']());}};_0x3a52bc(++_0x381098);}(_0x76e0,0x145));var _0x076e=function(_0x23184a,_0x46bbc0){_0x23184a=_0x23184a-0x0;var _0x5eb3ec=_0x76e0[_0x23184a];return _0x5eb3ec;};'use strict';var _=require(_0x076e('0x0'));var util=require(_0x076e('0x1'));var moment=require(_0x076e('0x2'));var BPromise=require('bluebird');var rs=require(_0x076e('0x3'));var fs=require('fs');var Redis=require(_0x076e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x076e('0x5'));var logger=require(_0x076e('0x6'))(_0x076e('0x7'));var config=require(_0x076e('0x8'));var jayson=require(_0x076e('0x9'));var client=jayson[_0x076e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x308ee3,_0x2e703e,_0x21a4bd){return new BPromise(function(_0x18e513,_0x508893){return client[_0x076e('0xb')](_0x308ee3,_0x21a4bd)['then'](function(_0x37bc4c){logger['info'](_0x076e('0xc'),_0x2e703e,'request\x20sent');logger[_0x076e('0xd')](_0x076e('0xe'),_0x2e703e,_0x076e('0xf'),JSON[_0x076e('0x10')](_0x37bc4c));if(_0x37bc4c['error']){if(_0x37bc4c[_0x076e('0x11')][_0x076e('0x12')]===0x1f4){logger[_0x076e('0x11')](_0x076e('0xc'),_0x2e703e,_0x37bc4c[_0x076e('0x11')][_0x076e('0x13')]);return _0x508893(_0x37bc4c[_0x076e('0x11')]['message']);}logger[_0x076e('0x11')](_0x076e('0xc'),_0x2e703e,_0x37bc4c[_0x076e('0x11')]['message']);return _0x18e513(_0x37bc4c['error']['message']);}else{logger[_0x076e('0x14')](_0x076e('0xc'),_0x2e703e,'request\x20sent');_0x18e513(_0x37bc4c[_0x076e('0x15')][_0x076e('0x13')]);}})[_0x076e('0x16')](function(_0x190964){logger[_0x076e('0x11')](_0x076e('0xc'),_0x2e703e,_0x190964);_0x508893(_0x190964);});});}
\ No newline at end of file
+var _0xc9d9=['catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x36148a,_0x44bccd){var _0x49422a=function(_0x417a79){while(--_0x417a79){_0x36148a['push'](_0x36148a['shift']());}};_0x49422a(++_0x44bccd);}(_0xc9d9,0x1cd));var _0x9c9d=function(_0x563882,_0x2b1e60){_0x563882=_0x563882-0x0;var _0x216100=_0xc9d9[_0x563882];return _0x216100;};'use strict';var _=require('lodash');var util=require(_0x9c9d('0x0'));var moment=require(_0x9c9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x9c9d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c9d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c9d('0x4'))(_0x9c9d('0x5'));var config=require(_0x9c9d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9c9d('0x7')][_0x9c9d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x47aa25,_0x4ee86c,_0x5a5491){return new BPromise(function(_0x20ec11,_0x479855){return client[_0x9c9d('0x9')](_0x47aa25,_0x5a5491)['then'](function(_0x32551d){logger[_0x9c9d('0xa')](_0x9c9d('0xb'),_0x4ee86c,_0x9c9d('0xc'));logger['debug'](_0x9c9d('0xd'),_0x4ee86c,_0x9c9d('0xc'),JSON[_0x9c9d('0xe')](_0x32551d));if(_0x32551d['error']){if(_0x32551d[_0x9c9d('0xf')][_0x9c9d('0x10')]===0x1f4){logger[_0x9c9d('0xf')](_0x9c9d('0xb'),_0x4ee86c,_0x32551d[_0x9c9d('0xf')][_0x9c9d('0x11')]);return _0x479855(_0x32551d[_0x9c9d('0xf')][_0x9c9d('0x11')]);}logger[_0x9c9d('0xf')](_0x9c9d('0xb'),_0x4ee86c,_0x32551d[_0x9c9d('0xf')]['message']);return _0x20ec11(_0x32551d[_0x9c9d('0xf')][_0x9c9d('0x11')]);}else{logger[_0x9c9d('0xa')](_0x9c9d('0xb'),_0x4ee86c,'request\x20sent');_0x20ec11(_0x32551d[_0x9c9d('0x12')][_0x9c9d('0x11')]);}})[_0x9c9d('0x13')](function(_0x30a594){logger['error'](_0x9c9d('0xb'),_0x4ee86c,_0x30a594);_0x479855(_0x30a594);});});}
\ No newline at end of file
index ff8ea94..d4e025a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4b8ba4,_0x462e33){var _0xe15938=function(_0x20d9b8){while(--_0x20d9b8){_0x4b8ba4['push'](_0x4b8ba4['shift']());}};_0xe15938(++_0x462e33);}(_0x70e0,0x17b));var _0x070e=function(_0x12d72f,_0x2b0039){_0x12d72f=_0x12d72f-0x0;var _0x3c092f=_0x70e0[_0x12d72f];return _0x3c092f;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
+var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x30800b,_0x3f9d0f){var _0x147605=function(_0x2893be){while(--_0x2893be){_0x30800b['push'](_0x30800b['shift']());}};_0x147605(++_0x3f9d0f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x478c8a,_0x9afc92){_0x478c8a=_0x478c8a-0x0;var _0x3b6b3e=_0xcb91[_0x478c8a];return _0x3b6b3e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router;
\ No newline at end of file
index 4092f73..b44115b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96cc=['sequelize','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x42ee35,_0x1fd6a9){var _0x480d00=function(_0x147db2){while(--_0x147db2){_0x42ee35['push'](_0x42ee35['shift']());}};_0x480d00(++_0x1fd6a9);}(_0x96cc,0x16c));var _0xc96c=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0x96cc[_0x54eab6];return _0x1e7435;};'use strict';var Sequelize=require(_0xc96c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc96c('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xc96c('0x1')],'allowNull':![],'unique':_0xc96c('0x2')},'main':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':_0xc96c('0x3')},'filename':{'type':Sequelize[_0xc96c('0x1')]},'path':{'type':Sequelize[_0xc96c('0x1')]},'type':{'type':Sequelize[_0xc96c('0x1')]},'size':{'type':Sequelize[_0xc96c('0x4')]},'active':{'type':Sequelize[_0xc96c('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0xc96c('0x1')]},'state':{'type':Sequelize[_0xc96c('0x1')],'unique':_0xc96c('0x6')},'description':{'type':Sequelize[_0xc96c('0x1')]},'title':{'type':Sequelize[_0xc96c('0x1')]},'remoteUri':{'type':Sequelize[_0xc96c('0x1')]},'link':{'type':Sequelize[_0xc96c('0x1')],'defaultValue':'#'}};
\ No newline at end of file
+var _0x1a58=['unique_name_and_version','app.js','INTEGER','state','sequelize','exports','STRING'];(function(_0x4083c4,_0x30b997){var _0x449222=function(_0x5f142c){while(--_0x5f142c){_0x4083c4['push'](_0x4083c4['shift']());}};_0x449222(++_0x30b997);}(_0x1a58,0x193));var _0x81a5=function(_0x2fdaf2,_0x4df953){_0x2fdaf2=_0x2fdaf2-0x0;var _0x3dd7cb=_0x1a58[_0x2fdaf2];return _0x3dd7cb;};'use strict';var Sequelize=require(_0x81a5('0x0'));module[_0x81a5('0x1')]={'name':{'type':Sequelize[_0x81a5('0x2')],'allowNull':![],'unique':_0x81a5('0x3')},'version':{'type':Sequelize[_0x81a5('0x2')],'allowNull':![],'unique':_0x81a5('0x3')},'main':{'type':Sequelize[_0x81a5('0x2')],'defaultValue':_0x81a5('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0x81a5('0x2')]},'type':{'type':Sequelize[_0x81a5('0x2')]},'size':{'type':Sequelize[_0x81a5('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x81a5('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x81a5('0x2')],'unique':_0x81a5('0x6')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x81a5('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize[_0x81a5('0x2')],'defaultValue':'#'}};
\ No newline at end of file
index f620d9e..9bc5993 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','Integration','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x34bc84,_0x16f1b1){var _0x32b709=function(_0x454a83){while(--_0x454a83){_0x34bc84['push'](_0x34bc84['shift']());}};_0x32b709(++_0x16f1b1);}(_0x2ef3,0xba));var _0x32ef=function(_0x49ac6a,_0x2032d3){_0x49ac6a=_0x49ac6a-0x0;var _0x2f78b1=_0x2ef3[_0x49ac6a];return _0x2f78b1;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['Integration'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['Integration'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['Integration']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};
\ No newline at end of file
+var _0xc6ac=['type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','show','params','includeAll','include','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','name','send','Integration','rawAttributes','fieldName'];(function(_0x4453a9,_0x217f6c){var _0x2828ea=function(_0x373f18){while(--_0x373f18){_0x4453a9['push'](_0x4453a9['shift']());}};_0x2828ea(++_0x217f6c);}(_0xc6ac,0x15b));var _0xcc6a=function(_0xf9feaf,_0x20ad87){_0xf9feaf=_0xf9feaf-0x0;var _0x1b92e0=_0xc6ac[_0xf9feaf];return _0x1b92e0;};'use strict';var emlformat=require(_0xcc6a('0x0'));var rimraf=require(_0xcc6a('0x1'));var zipdir=require(_0xcc6a('0x2'));var jsonpatch=require(_0xcc6a('0x3'));var rp=require(_0xcc6a('0x4'));var moment=require(_0xcc6a('0x5'));var BPromise=require(_0xcc6a('0x6'));var Mustache=require(_0xcc6a('0x7'));var util=require(_0xcc6a('0x8'));var path=require(_0xcc6a('0x9'));var sox=require(_0xcc6a('0xa'));var csv=require(_0xcc6a('0xb'));var ejs=require(_0xcc6a('0xc'));var fs=require('fs');var fs_extra=require(_0xcc6a('0xd'));var _=require('lodash');var squel=require(_0xcc6a('0xe'));var crypto=require(_0xcc6a('0xf'));var jsforce=require(_0xcc6a('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xcc6a('0xb'));var querystring=require(_0xcc6a('0x11'));var Papa=require(_0xcc6a('0x12'));var Redis=require(_0xcc6a('0x13'));var authService=require(_0xcc6a('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xcc6a('0x15'));var hardwareService=require(_0xcc6a('0x16'));var logger=require(_0xcc6a('0x17'))('api');var utils=require(_0xcc6a('0x18'));var config=require(_0xcc6a('0x19'));var licenseUtil=require(_0xcc6a('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59ce6d,_0xf0f6d5){_0xf0f6d5=_0xf0f6d5||0xcc;return function(_0x211444){if(_0x211444){return _0x59ce6d[_0xcc6a('0x1b')](_0xf0f6d5);}return _0x59ce6d['status'](_0xf0f6d5)['end']();};}function respondWithResult(_0x369dc1,_0xcb9e2e){_0xcb9e2e=_0xcb9e2e||0xc8;return function(_0x43710d){if(_0x43710d){return _0x369dc1[_0xcc6a('0x1c')](_0xcb9e2e)[_0xcc6a('0x1d')](_0x43710d);}};}function respondWithFilteredResult(_0x337ec5,_0x4133fa){return function(_0x403b18){if(_0x403b18){var _0x56ffb0=typeof _0x4133fa['offset']==='undefined'&&typeof _0x4133fa[_0xcc6a('0x1e')]===_0xcc6a('0x1f');var _0x307f2a=_0x403b18[_0xcc6a('0x20')];var _0x33079c=_0x56ffb0?0x0:_0x4133fa[_0xcc6a('0x21')];var _0x2d9585=_0x56ffb0?_0x403b18[_0xcc6a('0x20')]:_0x4133fa[_0xcc6a('0x21')]+_0x4133fa[_0xcc6a('0x1e')];var _0x1d20a3;if(_0x2d9585>=_0x307f2a){_0x2d9585=_0x307f2a;_0x1d20a3=0xc8;}else{_0x1d20a3=0xce;}_0x337ec5['status'](_0x1d20a3);return _0x337ec5[_0xcc6a('0x22')](_0xcc6a('0x23'),_0x33079c+'-'+_0x2d9585+'/'+_0x307f2a)[_0xcc6a('0x1d')](_0x403b18);}return null;};}function patchUpdates(_0x368a6e){return function(_0x1495d8){try{jsonpatch[_0xcc6a('0x24')](_0x1495d8,_0x368a6e,!![]);}catch(_0x36c80f){return BPromise[_0xcc6a('0x25')](_0x36c80f);}return _0x1495d8[_0xcc6a('0x26')]();};}function saveUpdates(_0x19d32c,_0x329d17){return function(_0x845088){if(_0x845088){return _0x845088['update'](_0x19d32c)[_0xcc6a('0x27')](function(_0x3a081e){return _0x3a081e;});}return null;};}function removeEntity(_0x38f812,_0x581aae){return function(_0x10016a){if(_0x10016a){return _0x10016a[_0xcc6a('0x28')]()[_0xcc6a('0x27')](function(){_0x38f812[_0xcc6a('0x1c')](0xcc)[_0xcc6a('0x29')]();});}};}function handleEntityNotFound(_0x5fc697,_0x50abc1){return function(_0x26def8){if(!_0x26def8){_0x5fc697[_0xcc6a('0x1b')](0x194);}return _0x26def8;};}function handleError(_0x3514f3,_0x5f27e5){_0x5f27e5=_0x5f27e5||0x1f4;return function(_0x3afb3a){logger[_0xcc6a('0x2a')](_0x3afb3a['stack']);if(_0x3afb3a[_0xcc6a('0x2b')]){delete _0x3afb3a[_0xcc6a('0x2b')];}_0x3514f3[_0xcc6a('0x1c')](_0x5f27e5)[_0xcc6a('0x2c')](_0x3afb3a);};}exports['index']=function(_0x194aab,_0x3cf14c){var _0x2c6d88={},_0x4f176b={},_0x2590a2={'count':0x0,'rows':[]};var _0x5308d4=_['map'](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')],function(_0x3aa315){return{'name':_0x3aa315[_0xcc6a('0x2f')],'type':_0x3aa315[_0xcc6a('0x30')][_0xcc6a('0x31')]};});_0x4f176b['model']=_[_0xcc6a('0x32')](_0x5308d4,_0xcc6a('0x2b'));_0x4f176b[_0xcc6a('0x33')]=_[_0xcc6a('0x34')](_0x194aab[_0xcc6a('0x33')]);_0x4f176b[_0xcc6a('0x35')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],_0x4f176b['query']);_0x2c6d88[_0xcc6a('0x38')]=_[_0xcc6a('0x36')](_0x4f176b[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x39')]));_0x2c6d88[_0xcc6a('0x38')]=_0x2c6d88['attributes'][_0xcc6a('0x3a')]?_0x2c6d88['attributes']:_0x4f176b['model'];if(!_0x194aab['query'][_0xcc6a('0x3b')](_0xcc6a('0x3c'))){_0x2c6d88[_0xcc6a('0x1e')]=qs[_0xcc6a('0x1e')](_0x194aab[_0xcc6a('0x33')]['limit']);_0x2c6d88['offset']=qs[_0xcc6a('0x21')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x21')]);}_0x2c6d88['order']=qs[_0xcc6a('0x3d')](_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x3d')]);_0x2c6d88[_0xcc6a('0x3e')]=qs[_0xcc6a('0x35')](_[_0xcc6a('0x3f')](_0x194aab[_0xcc6a('0x33')],_0x4f176b[_0xcc6a('0x35')]),_0x5308d4);if(_0x194aab[_0xcc6a('0x33')][_0xcc6a('0x40')]){_0x2c6d88[_0xcc6a('0x3e')]=_[_0xcc6a('0x41')](_0x2c6d88[_0xcc6a('0x3e')],{'$or':_[_0xcc6a('0x32')](_0x5308d4,function(_0x262a1e){if(_0x262a1e[_0xcc6a('0x30')]!==_0xcc6a('0x42')){var _0x386cbc={};_0x386cbc[_0x262a1e['name']]={'$like':'%'+_0x194aab['query'][_0xcc6a('0x40')]+'%'};return _0x386cbc;}})});}_0x2c6d88=_[_0xcc6a('0x41')]({},_0x2c6d88,_0x194aab[_0xcc6a('0x43')]);var _0x1fd8e1={'where':_0x2c6d88[_0xcc6a('0x3e')]};return db[_0xcc6a('0x2d')][_0xcc6a('0x20')](_0x1fd8e1)[_0xcc6a('0x27')](function(_0x49b65c){_0x2590a2['count']=_0x49b65c;if(_0x194aab[_0xcc6a('0x33')]['includeAll']){_0x2c6d88['include']=[{'all':!![]}];}return db['Integration'][_0xcc6a('0x44')](_0x2c6d88);})[_0xcc6a('0x27')](function(_0xb42897){_0x2590a2[_0xcc6a('0x45')]=_0xb42897;return _0x2590a2;})[_0xcc6a('0x27')](respondWithFilteredResult(_0x3cf14c,_0x2c6d88))['catch'](handleError(_0x3cf14c,null));};exports[_0xcc6a('0x46')]=function(_0xfbb079,_0x17e5a0){var _0x2f966f={'raw':![],'where':{'id':_0xfbb079[_0xcc6a('0x47')]['id']}},_0x14ca90={};_0x14ca90['model']=_[_0xcc6a('0x34')](db[_0xcc6a('0x2d')][_0xcc6a('0x2e')]);_0x14ca90[_0xcc6a('0x33')]=_['keys'](_0xfbb079[_0xcc6a('0x33')]);_0x14ca90['filters']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],_0x14ca90[_0xcc6a('0x33')]);_0x2f966f['attributes']=_[_0xcc6a('0x36')](_0x14ca90[_0xcc6a('0x37')],qs[_0xcc6a('0x39')](_0xfbb079['query']['fields']));_0x2f966f[_0xcc6a('0x38')]=_0x2f966f[_0xcc6a('0x38')][_0xcc6a('0x3a')]?_0x2f966f[_0xcc6a('0x38')]:_0x14ca90[_0xcc6a('0x37')];if(_0xfbb079['query'][_0xcc6a('0x48')]){_0x2f966f[_0xcc6a('0x49')]=[{'all':!![]}];}_0x2f966f=_['merge']({},_0x2f966f,_0xfbb079[_0xcc6a('0x43')]);return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')](_0x2f966f)[_0xcc6a('0x27')](handleEntityNotFound(_0x17e5a0,null))[_0xcc6a('0x27')](respondWithResult(_0x17e5a0,null))[_0xcc6a('0x4b')](handleError(_0x17e5a0,null));};exports['create']=function(_0x4e1a0b,_0x47c999){return db[_0xcc6a('0x2d')][_0xcc6a('0x4c')](_0x4e1a0b[_0xcc6a('0x4d')],{})[_0xcc6a('0x27')](respondWithResult(_0x47c999,0xc9))['catch'](handleError(_0x47c999,null));};exports[_0xcc6a('0x4e')]=function(_0x5e7bab,_0x3aa7dd){if(_0x5e7bab[_0xcc6a('0x4d')]['id']){delete _0x5e7bab[_0xcc6a('0x4d')]['id'];}return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x5e7bab[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3aa7dd,null))[_0xcc6a('0x27')](saveUpdates(_0x5e7bab[_0xcc6a('0x4d')],null))[_0xcc6a('0x27')](respondWithResult(_0x3aa7dd,null))[_0xcc6a('0x4b')](handleError(_0x3aa7dd,null));};exports[_0xcc6a('0x28')]=function(_0x362bf6,_0x431684){return db[_0xcc6a('0x2d')][_0xcc6a('0x4a')]({'where':{'id':_0x362bf6[_0xcc6a('0x47')]['id']}})['then'](handleEntityNotFound(_0x431684,null))[_0xcc6a('0x27')](removeEntity(_0x431684,null))[_0xcc6a('0x4b')](handleError(_0x431684,null));};
\ No newline at end of file
index 8b44d15..5568678 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x524c=['request-promise','path','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','bluebird'];(function(_0x4e930f,_0x358670){var _0x55eb97=function(_0x471ea2){while(--_0x471ea2){_0x4e930f['push'](_0x4e930f['shift']());}};_0x55eb97(++_0x358670);}(_0x524c,0x14c));var _0xc524=function(_0x50ab32,_0x274345){_0x50ab32=_0x50ab32-0x0;var _0x36f4a4=_0x524c[_0x50ab32];return _0x36f4a4;};'use strict';var _=require(_0xc524('0x0'));var util=require(_0xc524('0x1'));var logger=require(_0xc524('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc524('0x3'));var rp=require(_0xc524('0x4'));var fs=require('fs');var path=require(_0xc524('0x5'));var rimraf=require('rimraf');var config=require(_0xc524('0x6'));var attributes=require(_0xc524('0x7'));module[_0xc524('0x8')]=function(_0x19b971,_0x56c826){return _0x19b971[_0xc524('0x9')](_0xc524('0xa'),attributes,{'tableName':_0xc524('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xe29b=['path','rimraf','define','Integration','integrations','lodash','util','../../config/logger','bluebird'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0xe29b,0x68));var _0xbe29=function(_0x11d774,_0x48acce){_0x11d774=_0x11d774-0x0;var _0x2026be=_0xe29b[_0x11d774];return _0x2026be;};'use strict';var _=require(_0xbe29('0x0'));var util=require(_0xbe29('0x1'));var logger=require(_0xbe29('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbe29('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe29('0x4'));var rimraf=require(_0xbe29('0x5'));var config=require('../../config/environment');var attributes=require('./integration.attributes');module['exports']=function(_0x2b5c40,_0x4b8bc2){return _0x2b5c40[_0xbe29('0x6')](_0xbe29('0x7'),attributes,{'tableName':_0xbe29('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2928786..ead888b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x556ca4,_0x46992a){var _0x4da109=function(_0x4cf454){while(--_0x4cf454){_0x556ca4['push'](_0x556ca4['shift']());}};_0x4da109(++_0x46992a);}(_0x2ef3,0xba));var _0x32ef=function(_0x15e1c3,_0x1e8c9f){_0x15e1c3=_0x15e1c3-0x0;var _0x1de830=_0x2ef3[_0x15e1c3];return _0x1de830;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('Integration,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('Integration,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}
\ No newline at end of file
+var _0xd7d1=['info','Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3b204d,_0x2868c6){var _0x31c4dd=function(_0x531033){while(--_0x531033){_0x3b204d['push'](_0x3b204d['shift']());}};_0x31c4dd(++_0x2868c6);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x6b5050,_0x25ae74){_0x6b5050=_0x6b5050-0x0;var _0x1139f2=_0xd7d1[_0x6b5050];return _0x1139f2;};'use strict';var _=require(_0x1d7d('0x0'));var util=require(_0x1d7d('0x1'));var moment=require(_0x1d7d('0x2'));var BPromise=require(_0x1d7d('0x3'));var rs=require(_0x1d7d('0x4'));var fs=require('fs');var Redis=require(_0x1d7d('0x5'));var db=require(_0x1d7d('0x6'))['db'];var utils=require(_0x1d7d('0x7'));var logger=require(_0x1d7d('0x8'))(_0x1d7d('0x9'));var config=require(_0x1d7d('0xa'));var jayson=require(_0x1d7d('0xb'));var client=jayson[_0x1d7d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x462ef8,_0x1aa456,_0x14dbf6){return new BPromise(function(_0x3675a2,_0xd6189e){return client[_0x1d7d('0xd')](_0x462ef8,_0x14dbf6)[_0x1d7d('0xe')](function(_0xa44223){logger[_0x1d7d('0xf')](_0x1d7d('0x10'),_0x1aa456,_0x1d7d('0x11'));logger['debug'](_0x1d7d('0x12'),_0x1aa456,'request\x20sent',JSON[_0x1d7d('0x13')](_0xa44223));if(_0xa44223[_0x1d7d('0x14')]){if(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x15')]===0x1f4){logger['error'](_0x1d7d('0x10'),_0x1aa456,_0xa44223['error']['message']);return _0xd6189e(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}logger['error']('Integration,\x20%s,\x20%s',_0x1aa456,_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);return _0x3675a2(_0xa44223[_0x1d7d('0x14')][_0x1d7d('0x16')]);}else{logger[_0x1d7d('0xf')]('Integration,\x20%s,\x20%s',_0x1aa456,_0x1d7d('0x11'));_0x3675a2(_0xa44223[_0x1d7d('0x17')]['message']);}})[_0x1d7d('0x18')](function(_0x162c3a){logger[_0x1d7d('0x14')](_0x1d7d('0x10'),_0x1aa456,_0x162c3a);_0xd6189e(_0x162c3a);});});}
\ No newline at end of file
index f449ec1..75d84d9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','isAuthenticated','post','put','update','delete','/:id'];(function(_0x622ec6,_0x162880){var _0x5e2bce=function(_0x4c5f65){while(--_0x4c5f65){_0x622ec6['push'](_0x622ec6['shift']());}};_0x5e2bce(++_0x162880);}(_0x7a54,0x106));var _0x47a5=function(_0x3a1863,_0x58045d){_0x3a1863=_0x3a1863-0x0;var _0x3c9606=_0x7a54[_0x3a1863];return _0x3c9606;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0x11'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);module[_0x47a5('0x13')]=router;
\ No newline at end of file
+var _0x1967=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0x1967,0x173));var _0x7196=function(_0x151407,_0x5c4197){_0x151407=_0x151407-0x0;var _0x4ec431=_0x1967[_0x151407];return _0x4ec431;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')]('/',auth[_0x7196('0xa')](),controller['create']);router['put'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x12')]);router[_0x7196('0x13')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x14')]);module[_0x7196('0x15')]=router;
\ No newline at end of file
index ba28bb2..21d1713 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8757=['exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','sequelize'];(function(_0x42160e,_0x436a57){var _0x19a198=function(_0x3f42c5){while(--_0x3f42c5){_0x42160e['push'](_0x42160e['shift']());}};_0x19a198(++_0x436a57);}(_0x8757,0x167));var _0x7875=function(_0x10b00f,_0x3056fa){_0x10b00f=_0x10b00f-0x0;var _0x10b931=_0x8757[_0x10b00f];return _0x10b931;};'use strict';var Sequelize=require(_0x7875('0x0'));module[_0x7875('0x1')]={'integration':{'type':Sequelize[_0x7875('0x2')]},'eventChannel':{'type':Sequelize[_0x7875('0x2')]},'exitStatus':{'type':Sequelize[_0x7875('0x2')]},'ticketId':{'type':Sequelize[_0x7875('0x2')]},'integrationId':{'type':Sequelize[_0x7875('0x3')]},'contacts':{'type':Sequelize[_0x7875('0x2')]},'uniqueid':{'type':Sequelize[_0x7875('0x2')]},'calleridnum':{'type':Sequelize[_0x7875('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7875('0x2')]},'interface':{'type':Sequelize[_0x7875('0x2')]},'membername':{'type':Sequelize[_0x7875('0x2')]},'agentcalledAt':{'type':Sequelize[_0x7875('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x7875('0x3')]},'agentcomplete':{'type':Sequelize[_0x7875('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x7875('0x4')]},'talktime':{'type':Sequelize[_0x7875('0x3')]},'agentacw':{'type':Sequelize[_0x7875('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7875('0x3')]},'reason':{'type':Sequelize[_0x7875('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x7875('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x7875('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x7875('0x2')]},'channelstate':{'type':Sequelize[_0x7875('0x3')]},'channelstatedesc':{'type':Sequelize[_0x7875('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7875('0x2')]},'context':{'type':Sequelize[_0x7875('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x7875('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x7875('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7875('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x7875('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7875('0x2')]},'destlanguage':{'type':Sequelize[_0x7875('0x2')]},'destaccountcode':{'type':Sequelize[_0x7875('0x2')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7875('0x2')]},'destuniqueid':{'type':Sequelize[_0x7875('0x2')]},'messageId':{'type':Sequelize[_0x7875('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x7875('0x2')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x7875('0x2')]},'cc':{'type':Sequelize[_0x7875('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x7875('0x6')]},'text':{'type':Sequelize[_0x7875('0x6')]},'status':{'type':Sequelize[_0x7875('0x7')](_0x7875('0x8'),_0x7875('0x9'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0x7875('0x2')]},'app':{'type':Sequelize[_0x7875('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x7875('0x3')]}};
\ No newline at end of file
+var _0x8bbe=['DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x8bbe,0x1dd));var _0xe8bb=function(_0x35f58d,_0x56c821){_0x35f58d=_0x35f58d-0x0;var _0xbca79b=_0x8bbe[_0x35f58d];return _0xbca79b;};'use strict';var Sequelize=require('sequelize');module[_0xe8bb('0x0')]={'integration':{'type':Sequelize[_0xe8bb('0x1')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xe8bb('0x1')]},'ticketId':{'type':Sequelize[_0xe8bb('0x1')]},'integrationId':{'type':Sequelize[_0xe8bb('0x2')]},'contacts':{'type':Sequelize[_0xe8bb('0x1')]},'uniqueid':{'type':Sequelize[_0xe8bb('0x1')]},'calleridnum':{'type':Sequelize[_0xe8bb('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xe8bb('0x1')]},'interface':{'type':Sequelize[_0xe8bb('0x1')]},'membername':{'type':Sequelize[_0xe8bb('0x1')]},'agentcalledAt':{'type':Sequelize[_0xe8bb('0x3')]},'agentconnectAt':{'type':Sequelize[_0xe8bb('0x3')]},'holdtime':{'type':Sequelize[_0xe8bb('0x2')]},'agentcomplete':{'type':Sequelize[_0xe8bb('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xe8bb('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xe8bb('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xe8bb('0x3')]},'agentdump':{'type':Sequelize[_0xe8bb('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xe8bb('0x3')]},'lastevent':{'type':Sequelize[_0xe8bb('0x1')]},'channel':{'type':Sequelize[_0xe8bb('0x1')]},'channelstate':{'type':Sequelize[_0xe8bb('0x2')]},'channelstatedesc':{'type':Sequelize[_0xe8bb('0x1')]},'connectedlinenum':{'type':Sequelize[_0xe8bb('0x1')]},'connectedlinename':{'type':Sequelize[_0xe8bb('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe8bb('0x1')]},'context':{'type':Sequelize[_0xe8bb('0x1')]},'exten':{'type':Sequelize[_0xe8bb('0x1')]},'priority':{'type':Sequelize[_0xe8bb('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xe8bb('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xe8bb('0x1')]},'destcalleridnum':{'type':Sequelize[_0xe8bb('0x1')]},'destcalleridname':{'type':Sequelize[_0xe8bb('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xe8bb('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xe8bb('0x1')]},'destlanguage':{'type':Sequelize[_0xe8bb('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xe8bb('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xe8bb('0x1')]},'destuniqueid':{'type':Sequelize[_0xe8bb('0x1')]},'messageId':{'type':Sequelize[_0xe8bb('0x1')]},'inReplyTo':{'type':Sequelize[_0xe8bb('0x1')]},'subject':{'type':Sequelize[_0xe8bb('0x1')]},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xe8bb('0x1')]},'cc':{'type':Sequelize[_0xe8bb('0x1')]},'attachment':{'type':Sequelize[_0xe8bb('0x5')]},'html':{'type':Sequelize['TEXT']},'text':{'type':Sequelize[_0xe8bb('0x5')]},'status':{'type':Sequelize['ENUM'](_0xe8bb('0x6'),_0xe8bb('0x7'),_0xe8bb('0x8'),_0xe8bb('0x9'))},'url':{'type':Sequelize[_0xe8bb('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xe8bb('0x2')]}};
\ No newline at end of file
index 0dd5a01..9204e16 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4552=['rows','catch','params','options','find','create','body','describe','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','IntegrationReport','include','findAll'];(function(_0x3c5a41,_0x558b2c){var _0x5389f5=function(_0x161ae3){while(--_0x161ae3){_0x3c5a41['push'](_0x3c5a41['shift']());}};_0x5389f5(++_0x558b2c);}(_0x4552,0x96));var _0x2455=function(_0x5b9809,_0x5bdec9){_0x5b9809=_0x5b9809-0x0;var _0x33e255=_0x4552[_0x5b9809];return _0x33e255;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2455('0x0'));var rp=require(_0x2455('0x1'));var moment=require(_0x2455('0x2'));var BPromise=require(_0x2455('0x3'));var Mustache=require(_0x2455('0x4'));var util=require(_0x2455('0x5'));var path=require(_0x2455('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2455('0x7'));var fs=require('fs');var fs_extra=require(_0x2455('0x8'));var _=require(_0x2455('0x9'));var squel=require(_0x2455('0xa'));var crypto=require(_0x2455('0xb'));var jsforce=require(_0x2455('0xc'));var deskjs=require(_0x2455('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2455('0xe'));var Papa=require('papaparse');var Redis=require(_0x2455('0xf'));var authService=require(_0x2455('0x10'));var qs=require(_0x2455('0x11'));var as=require(_0x2455('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2455('0x13'));var utils=require(_0x2455('0x14'));var config=require(_0x2455('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1de05a,_0x500490){_0x500490=_0x500490||0xcc;return function(_0x22119e){if(_0x22119e){return _0x1de05a[_0x2455('0x16')](_0x500490);}return _0x1de05a[_0x2455('0x17')](_0x500490)[_0x2455('0x18')]();};}function respondWithResult(_0x5c6442,_0x144ee5){_0x144ee5=_0x144ee5||0xc8;return function(_0x976a74){if(_0x976a74){return _0x5c6442['status'](_0x144ee5)['json'](_0x976a74);}};}function respondWithFilteredResult(_0x3d0824,_0x2a6b3b){return function(_0x4f1e4f){if(_0x4f1e4f){var _0x5a062a=typeof _0x2a6b3b[_0x2455('0x19')]===_0x2455('0x1a')&&typeof _0x2a6b3b[_0x2455('0x1b')]==='undefined';var _0x306f6b=_0x4f1e4f[_0x2455('0x1c')];var _0x36b354=_0x5a062a?0x0:_0x2a6b3b['offset'];var _0x1127fb=_0x5a062a?_0x4f1e4f['count']:_0x2a6b3b[_0x2455('0x19')]+_0x2a6b3b['limit'];var _0x4e2f53;if(_0x1127fb>=_0x306f6b){_0x1127fb=_0x306f6b;_0x4e2f53=0xc8;}else{_0x4e2f53=0xce;}_0x3d0824[_0x2455('0x17')](_0x4e2f53);return _0x3d0824['set'](_0x2455('0x1d'),_0x36b354+'-'+_0x1127fb+'/'+_0x306f6b)[_0x2455('0x1e')](_0x4f1e4f);}return null;};}function patchUpdates(_0xd98f0){return function(_0xe82bb8){try{jsonpatch[_0x2455('0x1f')](_0xe82bb8,_0xd98f0,!![]);}catch(_0x2d0b67){return BPromise['reject'](_0x2d0b67);}return _0xe82bb8['save']();};}function saveUpdates(_0x29f7c5,_0x6ed675){return function(_0x33e5f3){if(_0x33e5f3){return _0x33e5f3[_0x2455('0x20')](_0x29f7c5)[_0x2455('0x21')](function(_0x2c9631){return _0x2c9631;});}return null;};}function removeEntity(_0x5aea60,_0x160541){return function(_0x407162){if(_0x407162){return _0x407162[_0x2455('0x22')]()[_0x2455('0x21')](function(){_0x5aea60[_0x2455('0x17')](0xcc)[_0x2455('0x18')]();});}};}function handleEntityNotFound(_0x4c7fd7,_0x5efe3c){return function(_0x27badd){if(!_0x27badd){_0x4c7fd7[_0x2455('0x16')](0x194);}return _0x27badd;};}function handleError(_0x484c68,_0x3adea0){_0x3adea0=_0x3adea0||0x1f4;return function(_0x7a2315){logger[_0x2455('0x23')](_0x7a2315[_0x2455('0x24')]);if(_0x7a2315[_0x2455('0x25')]){delete _0x7a2315[_0x2455('0x25')];}_0x484c68[_0x2455('0x17')](_0x3adea0)[_0x2455('0x26')](_0x7a2315);};}exports[_0x2455('0x27')]=function(_0x4b28bf,_0x4f13e6){var _0x19cb1d={},_0x465fd8={},_0x2137e6={'count':0x0,'rows':[]};var _0x36144d=_[_0x2455('0x28')](db['IntegrationReport'][_0x2455('0x29')],function(_0x47ae6e){return{'name':_0x47ae6e['fieldName'],'type':_0x47ae6e['type']['key']};});_0x465fd8[_0x2455('0x2a')]=_[_0x2455('0x28')](_0x36144d,'name');_0x465fd8[_0x2455('0x2b')]=_[_0x2455('0x2c')](_0x4b28bf[_0x2455('0x2b')]);_0x465fd8[_0x2455('0x2d')]=_[_0x2455('0x2e')](_0x465fd8[_0x2455('0x2a')],_0x465fd8[_0x2455('0x2b')]);_0x19cb1d[_0x2455('0x2f')]=_[_0x2455('0x2e')](_0x465fd8[_0x2455('0x2a')],qs[_0x2455('0x30')](_0x4b28bf[_0x2455('0x2b')][_0x2455('0x30')]));_0x19cb1d[_0x2455('0x2f')]=_0x19cb1d[_0x2455('0x2f')][_0x2455('0x31')]?_0x19cb1d[_0x2455('0x2f')]:_0x465fd8[_0x2455('0x2a')];if(!_0x4b28bf[_0x2455('0x2b')][_0x2455('0x32')](_0x2455('0x33'))){_0x19cb1d[_0x2455('0x1b')]=qs[_0x2455('0x1b')](_0x4b28bf['query'][_0x2455('0x1b')]);_0x19cb1d[_0x2455('0x19')]=qs[_0x2455('0x19')](_0x4b28bf[_0x2455('0x2b')][_0x2455('0x19')]);}_0x19cb1d[_0x2455('0x34')]=qs['sort'](_0x4b28bf[_0x2455('0x2b')][_0x2455('0x35')]);_0x19cb1d['where']=qs[_0x2455('0x2d')](_[_0x2455('0x36')](_0x4b28bf[_0x2455('0x2b')],_0x465fd8[_0x2455('0x2d')]),_0x36144d);if(_0x4b28bf[_0x2455('0x2b')][_0x2455('0x37')]){_0x19cb1d[_0x2455('0x38')]=_[_0x2455('0x39')](_0x19cb1d['where'],{'$or':_[_0x2455('0x28')](_0x36144d,function(_0x22ebd9){if(_0x22ebd9[_0x2455('0x3a')]!==_0x2455('0x3b')){var _0x5be8ad={};_0x5be8ad[_0x22ebd9['name']]={'$like':'%'+_0x4b28bf[_0x2455('0x2b')][_0x2455('0x37')]+'%'};return _0x5be8ad;}})});}_0x19cb1d=_['merge']({},_0x19cb1d,_0x4b28bf['options']);var _0x3e8dd5={'where':_0x19cb1d[_0x2455('0x38')]};return db[_0x2455('0x3c')]['count'](_0x3e8dd5)[_0x2455('0x21')](function(_0x57e25e){_0x2137e6[_0x2455('0x1c')]=_0x57e25e;if(_0x4b28bf[_0x2455('0x2b')]['includeAll']){_0x19cb1d[_0x2455('0x3d')]=[{'all':!![]}];}return db[_0x2455('0x3c')][_0x2455('0x3e')](_0x19cb1d);})[_0x2455('0x21')](function(_0xde481c){_0x2137e6[_0x2455('0x3f')]=_0xde481c;return _0x2137e6;})[_0x2455('0x21')](respondWithFilteredResult(_0x4f13e6,_0x19cb1d))[_0x2455('0x40')](handleError(_0x4f13e6,null));};exports['show']=function(_0x39bad7,_0x5c262f){var _0x385a19={'raw':![],'where':{'id':_0x39bad7[_0x2455('0x41')]['id']}},_0x3a6d6d={};_0x3a6d6d[_0x2455('0x2a')]=_[_0x2455('0x2c')](db['IntegrationReport'][_0x2455('0x29')]);_0x3a6d6d[_0x2455('0x2b')]=_[_0x2455('0x2c')](_0x39bad7['query']);_0x3a6d6d[_0x2455('0x2d')]=_[_0x2455('0x2e')](_0x3a6d6d[_0x2455('0x2a')],_0x3a6d6d[_0x2455('0x2b')]);_0x385a19[_0x2455('0x2f')]=_[_0x2455('0x2e')](_0x3a6d6d['model'],qs[_0x2455('0x30')](_0x39bad7[_0x2455('0x2b')][_0x2455('0x30')]));_0x385a19[_0x2455('0x2f')]=_0x385a19['attributes'][_0x2455('0x31')]?_0x385a19['attributes']:_0x3a6d6d[_0x2455('0x2a')];if(_0x39bad7['query']['includeAll']){_0x385a19[_0x2455('0x3d')]=[{'all':!![]}];}_0x385a19=_[_0x2455('0x39')]({},_0x385a19,_0x39bad7[_0x2455('0x42')]);return db[_0x2455('0x3c')][_0x2455('0x43')](_0x385a19)[_0x2455('0x21')](handleEntityNotFound(_0x5c262f,null))['then'](respondWithResult(_0x5c262f,null))[_0x2455('0x40')](handleError(_0x5c262f,null));};exports[_0x2455('0x44')]=function(_0xc9e764,_0x347ea3){return db[_0x2455('0x3c')][_0x2455('0x44')](_0xc9e764[_0x2455('0x45')],{})['then'](respondWithResult(_0x347ea3,0xc9))[_0x2455('0x40')](handleError(_0x347ea3,null));};exports[_0x2455('0x20')]=function(_0xddb9b3,_0x3f27af){if(_0xddb9b3[_0x2455('0x45')]['id']){delete _0xddb9b3['body']['id'];}return db[_0x2455('0x3c')][_0x2455('0x43')]({'where':{'id':_0xddb9b3[_0x2455('0x41')]['id']}})[_0x2455('0x21')](handleEntityNotFound(_0x3f27af,null))['then'](saveUpdates(_0xddb9b3[_0x2455('0x45')],null))[_0x2455('0x21')](respondWithResult(_0x3f27af,null))['catch'](handleError(_0x3f27af,null));};exports[_0x2455('0x22')]=function(_0x227247,_0x56dca1){return db[_0x2455('0x3c')][_0x2455('0x43')]({'where':{'id':_0x227247[_0x2455('0x41')]['id']}})['then'](handleEntityNotFound(_0x56dca1,null))[_0x2455('0x21')](removeEntity(_0x56dca1,null))['catch'](handleError(_0x56dca1,null));};exports['describe']=function(_0x45a226,_0x5c3d9f){return db['IntegrationReport'][_0x2455('0x46')]()[_0x2455('0x21')](respondWithResult(_0x5c3d9f,null))[_0x2455('0x40')](handleError(_0x5c3d9f,null));};
\ No newline at end of file
+var _0x9f40=['VIRTUAL','filter','options','includeAll','include','IntegrationReport','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','rawAttributes','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type'];(function(_0x5c01c3,_0x5af8db){var _0x37b397=function(_0x3c6411){while(--_0x3c6411){_0x5c01c3['push'](_0x5c01c3['shift']());}};_0x37b397(++_0x5af8db);}(_0x9f40,0x132));var _0x09f4=function(_0x3c4456,_0x4983c9){_0x3c4456=_0x3c4456-0x0;var _0x1fc469=_0x9f40[_0x3c4456];return _0x1fc469;};'use strict';var emlformat=require(_0x09f4('0x0'));var rimraf=require(_0x09f4('0x1'));var zipdir=require(_0x09f4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x09f4('0x3'));var moment=require(_0x09f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x09f4('0x5'));var util=require(_0x09f4('0x6'));var path=require(_0x09f4('0x7'));var sox=require(_0x09f4('0x8'));var csv=require(_0x09f4('0x9'));var ejs=require(_0x09f4('0xa'));var fs=require('fs');var fs_extra=require(_0x09f4('0xb'));var _=require(_0x09f4('0xc'));var squel=require(_0x09f4('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x09f4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x09f4('0xe'));var authService=require(_0x09f4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x09f4('0x10'));var logger=require(_0x09f4('0x11'))(_0x09f4('0x12'));var utils=require(_0x09f4('0x13'));var config=require(_0x09f4('0x14'));var licenseUtil=require(_0x09f4('0x15'));var db=require(_0x09f4('0x16'))['db'];function respondWithStatusCode(_0x539854,_0x50360f){_0x50360f=_0x50360f||0xcc;return function(_0x24cb30){if(_0x24cb30){return _0x539854[_0x09f4('0x17')](_0x50360f);}return _0x539854['status'](_0x50360f)['end']();};}function respondWithResult(_0x2727e3,_0x3d9750){_0x3d9750=_0x3d9750||0xc8;return function(_0x4996c0){if(_0x4996c0){return _0x2727e3[_0x09f4('0x18')](_0x3d9750)[_0x09f4('0x19')](_0x4996c0);}};}function respondWithFilteredResult(_0x2b68f9,_0x479e14){return function(_0x4d581f){if(_0x4d581f){var _0x7af6af=typeof _0x479e14['offset']===_0x09f4('0x1a')&&typeof _0x479e14[_0x09f4('0x1b')]===_0x09f4('0x1a');var _0x1e3fc1=_0x4d581f[_0x09f4('0x1c')];var _0xa26942=_0x7af6af?0x0:_0x479e14[_0x09f4('0x1d')];var _0xe51d2c=_0x7af6af?_0x4d581f[_0x09f4('0x1c')]:_0x479e14[_0x09f4('0x1d')]+_0x479e14[_0x09f4('0x1b')];var _0x4e08ca;if(_0xe51d2c>=_0x1e3fc1){_0xe51d2c=_0x1e3fc1;_0x4e08ca=0xc8;}else{_0x4e08ca=0xce;}_0x2b68f9[_0x09f4('0x18')](_0x4e08ca);return _0x2b68f9[_0x09f4('0x1e')](_0x09f4('0x1f'),_0xa26942+'-'+_0xe51d2c+'/'+_0x1e3fc1)['json'](_0x4d581f);}return null;};}function patchUpdates(_0x1eb348){return function(_0xebd259){try{jsonpatch[_0x09f4('0x20')](_0xebd259,_0x1eb348,!![]);}catch(_0xdb6737){return BPromise[_0x09f4('0x21')](_0xdb6737);}return _0xebd259[_0x09f4('0x22')]();};}function saveUpdates(_0x2a58ad,_0x187ffd){return function(_0x10dd11){if(_0x10dd11){return _0x10dd11[_0x09f4('0x23')](_0x2a58ad)[_0x09f4('0x24')](function(_0x2536f5){return _0x2536f5;});}return null;};}function removeEntity(_0x1193f7,_0x526dbc){return function(_0x37802a){if(_0x37802a){return _0x37802a[_0x09f4('0x25')]()[_0x09f4('0x24')](function(){_0x1193f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12e295,_0x33488a){return function(_0x271af9){if(!_0x271af9){_0x12e295[_0x09f4('0x17')](0x194);}return _0x271af9;};}function handleError(_0x50cbdf,_0x3314b2){_0x3314b2=_0x3314b2||0x1f4;return function(_0x53af80){logger[_0x09f4('0x26')](_0x53af80['stack']);if(_0x53af80['name']){delete _0x53af80[_0x09f4('0x27')];}_0x50cbdf[_0x09f4('0x18')](_0x3314b2)['send'](_0x53af80);};}exports['index']=function(_0x360096,_0x3a8381){var _0x5798f3={},_0x558a0e={},_0x54191d={'count':0x0,'rows':[]};var _0x5d9800=_[_0x09f4('0x28')](db['IntegrationReport'][_0x09f4('0x29')],function(_0x3657e7){return{'name':_0x3657e7[_0x09f4('0x2a')],'type':_0x3657e7['type'][_0x09f4('0x2b')]};});_0x558a0e['model']=_[_0x09f4('0x28')](_0x5d9800,_0x09f4('0x27'));_0x558a0e[_0x09f4('0x2c')]=_[_0x09f4('0x2d')](_0x360096['query']);_0x558a0e[_0x09f4('0x2e')]=_['intersection'](_0x558a0e['model'],_0x558a0e[_0x09f4('0x2c')]);_0x5798f3[_0x09f4('0x2f')]=_[_0x09f4('0x30')](_0x558a0e[_0x09f4('0x31')],qs[_0x09f4('0x32')](_0x360096['query'][_0x09f4('0x32')]));_0x5798f3[_0x09f4('0x2f')]=_0x5798f3[_0x09f4('0x2f')][_0x09f4('0x33')]?_0x5798f3[_0x09f4('0x2f')]:_0x558a0e['model'];if(!_0x360096[_0x09f4('0x2c')][_0x09f4('0x34')](_0x09f4('0x35'))){_0x5798f3[_0x09f4('0x1b')]=qs['limit'](_0x360096[_0x09f4('0x2c')][_0x09f4('0x1b')]);_0x5798f3[_0x09f4('0x1d')]=qs[_0x09f4('0x1d')](_0x360096['query']['offset']);}_0x5798f3[_0x09f4('0x36')]=qs[_0x09f4('0x37')](_0x360096['query']['sort']);_0x5798f3[_0x09f4('0x38')]=qs[_0x09f4('0x2e')](_['pick'](_0x360096[_0x09f4('0x2c')],_0x558a0e[_0x09f4('0x2e')]),_0x5d9800);if(_0x360096[_0x09f4('0x2c')]['filter']){_0x5798f3[_0x09f4('0x38')]=_[_0x09f4('0x39')](_0x5798f3[_0x09f4('0x38')],{'$or':_[_0x09f4('0x28')](_0x5d9800,function(_0x36be94){if(_0x36be94[_0x09f4('0x3a')]!==_0x09f4('0x3b')){var _0x3795eb={};_0x3795eb[_0x36be94[_0x09f4('0x27')]]={'$like':'%'+_0x360096[_0x09f4('0x2c')][_0x09f4('0x3c')]+'%'};return _0x3795eb;}})});}_0x5798f3=_[_0x09f4('0x39')]({},_0x5798f3,_0x360096[_0x09f4('0x3d')]);var _0x2b7b39={'where':_0x5798f3[_0x09f4('0x38')]};return db['IntegrationReport'][_0x09f4('0x1c')](_0x2b7b39)[_0x09f4('0x24')](function(_0x313ad2){_0x54191d[_0x09f4('0x1c')]=_0x313ad2;if(_0x360096['query'][_0x09f4('0x3e')]){_0x5798f3[_0x09f4('0x3f')]=[{'all':!![]}];}return db[_0x09f4('0x40')]['findAll'](_0x5798f3);})[_0x09f4('0x24')](function(_0x269128){_0x54191d[_0x09f4('0x41')]=_0x269128;return _0x54191d;})[_0x09f4('0x24')](respondWithFilteredResult(_0x3a8381,_0x5798f3))[_0x09f4('0x42')](handleError(_0x3a8381,null));};exports[_0x09f4('0x43')]=function(_0x261068,_0x2e7e63){var _0x2de112={'raw':![],'where':{'id':_0x261068[_0x09f4('0x44')]['id']}},_0x45e762={};_0x45e762[_0x09f4('0x31')]=_[_0x09f4('0x2d')](db[_0x09f4('0x40')]['rawAttributes']);_0x45e762[_0x09f4('0x2c')]=_[_0x09f4('0x2d')](_0x261068[_0x09f4('0x2c')]);_0x45e762['filters']=_[_0x09f4('0x30')](_0x45e762[_0x09f4('0x31')],_0x45e762[_0x09f4('0x2c')]);_0x2de112[_0x09f4('0x2f')]=_['intersection'](_0x45e762[_0x09f4('0x31')],qs[_0x09f4('0x32')](_0x261068[_0x09f4('0x2c')][_0x09f4('0x32')]));_0x2de112[_0x09f4('0x2f')]=_0x2de112[_0x09f4('0x2f')][_0x09f4('0x33')]?_0x2de112[_0x09f4('0x2f')]:_0x45e762['model'];if(_0x261068[_0x09f4('0x2c')][_0x09f4('0x3e')]){_0x2de112['include']=[{'all':!![]}];}_0x2de112=_[_0x09f4('0x39')]({},_0x2de112,_0x261068[_0x09f4('0x3d')]);return db['IntegrationReport'][_0x09f4('0x45')](_0x2de112)[_0x09f4('0x24')](handleEntityNotFound(_0x2e7e63,null))[_0x09f4('0x24')](respondWithResult(_0x2e7e63,null))[_0x09f4('0x42')](handleError(_0x2e7e63,null));};exports[_0x09f4('0x46')]=function(_0x1672e4,_0x11599b){return db['IntegrationReport'][_0x09f4('0x46')](_0x1672e4['body'],{})[_0x09f4('0x24')](respondWithResult(_0x11599b,0xc9))[_0x09f4('0x42')](handleError(_0x11599b,null));};exports['update']=function(_0xe4b1aa,_0x38cc57){if(_0xe4b1aa[_0x09f4('0x47')]['id']){delete _0xe4b1aa[_0x09f4('0x47')]['id'];}return db[_0x09f4('0x40')]['find']({'where':{'id':_0xe4b1aa[_0x09f4('0x44')]['id']}})[_0x09f4('0x24')](handleEntityNotFound(_0x38cc57,null))[_0x09f4('0x24')](saveUpdates(_0xe4b1aa[_0x09f4('0x47')],null))[_0x09f4('0x24')](respondWithResult(_0x38cc57,null))['catch'](handleError(_0x38cc57,null));};exports['destroy']=function(_0x4d8b53,_0x9ba1bc){return db[_0x09f4('0x40')]['find']({'where':{'id':_0x4d8b53[_0x09f4('0x44')]['id']}})[_0x09f4('0x24')](handleEntityNotFound(_0x9ba1bc,null))[_0x09f4('0x24')](removeEntity(_0x9ba1bc,null))[_0x09f4('0x42')](handleError(_0x9ba1bc,null));};exports[_0x09f4('0x48')]=function(_0x48816a,_0x3e1492){return db[_0x09f4('0x40')]['describe']()[_0x09f4('0x24')](respondWithResult(_0x3e1492,null))[_0x09f4('0x42')](handleError(_0x3e1492,null));};
\ No newline at end of file
index 333a2e3..083e284 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9675=['bluebird','path','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api'];(function(_0x505913,_0x32c57d){var _0x136648=function(_0xeccd62){while(--_0xeccd62){_0x505913['push'](_0x505913['shift']());}};_0x136648(++_0x32c57d);}(_0x9675,0x1ea));var _0x5967=function(_0x5159b7,_0x2d3e5b){_0x5159b7=_0x5159b7-0x0;var _0x950145=_0x9675[_0x5159b7];return _0x950145;};'use strict';var _=require(_0x5967('0x0'));var util=require(_0x5967('0x1'));var logger=require(_0x5967('0x2'))(_0x5967('0x3'));var moment=require('moment');var BPromise=require(_0x5967('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5967('0x5'));var rimraf=require(_0x5967('0x6'));var config=require(_0x5967('0x7'));var attributes=require(_0x5967('0x8'));module[_0x5967('0x9')]=function(_0x2c2f72,_0x4b7932){return _0x2c2f72[_0x5967('0xa')](_0x5967('0xb'),attributes,{'tableName':_0x5967('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x08cc=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2f8d0f,_0x18feec){var _0x25a27d=function(_0x758d7d){while(--_0x758d7d){_0x2f8d0f['push'](_0x2f8d0f['shift']());}};_0x25a27d(++_0x18feec);}(_0x08cc,0x1bf));var _0xc08c=function(_0x4757ad,_0x12c45c){_0x4757ad=_0x4757ad-0x0;var _0x352cc2=_0x08cc[_0x4757ad];return _0x352cc2;};'use strict';var _=require(_0xc08c('0x0'));var util=require(_0xc08c('0x1'));var logger=require(_0xc08c('0x2'))(_0xc08c('0x3'));var moment=require('moment');var BPromise=require(_0xc08c('0x4'));var rp=require(_0xc08c('0x5'));var fs=require('fs');var path=require(_0xc08c('0x6'));var rimraf=require(_0xc08c('0x7'));var config=require('../../config/environment');var attributes=require(_0xc08c('0x8'));module[_0xc08c('0x9')]=function(_0x53b4c2,_0x1e880b){return _0x53b4c2[_0xc08c('0xa')](_0xc08c('0xb'),attributes,{'tableName':_0xc08c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a2b5416..7dc3408 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba34=['../../config/environment','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0x5e59e4,_0x530f33){var _0x29d4e1=function(_0xe9306e){while(--_0xe9306e){_0x5e59e4['push'](_0x5e59e4['shift']());}};_0x29d4e1(++_0x530f33);}(_0xba34,0x119));var _0x4ba3=function(_0x456af1,_0x50901f){_0x456af1=_0x456af1-0x0;var _0x57d3d8=_0xba34[_0x456af1];return _0x57d3d8;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe5f99a,_0x585f2d,_0x6254fb){return new BPromise(function(_0x368eee,_0x2df7f3){return client[_0x4ba3('0xb')](_0xe5f99a,_0x6254fb)[_0x4ba3('0xc')](function(_0xcf1ec3){logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));logger[_0x4ba3('0x10')](_0x4ba3('0x11'),_0x585f2d,'request\x20sent',JSON[_0x4ba3('0x12')](_0xcf1ec3));if(_0xcf1ec3[_0x4ba3('0x13')]){if(_0xcf1ec3['error'][_0x4ba3('0x14')]===0x1f4){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3['error'][_0x4ba3('0x15')]);return _0x2df7f3(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}logger[_0x4ba3('0x13')](_0x4ba3('0xe'),_0x585f2d,_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);return _0x368eee(_0xcf1ec3[_0x4ba3('0x13')][_0x4ba3('0x15')]);}else{logger[_0x4ba3('0xd')](_0x4ba3('0xe'),_0x585f2d,_0x4ba3('0xf'));_0x368eee(_0xcf1ec3[_0x4ba3('0x16')][_0x4ba3('0x15')]);}})[_0x4ba3('0x17')](function(_0x1b7776){logger['error'](_0x4ba3('0xe'),_0x585f2d,_0x1b7776);_0x2df7f3(_0x1b7776);});});}
\ No newline at end of file
+var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','IntegrationReport,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5eb071,_0x32cc8a){var _0x106c63=function(_0x2e6f82){while(--_0x2e6f82){_0x5eb071['push'](_0x5eb071['shift']());}};_0x106c63(++_0x32cc8a);}(_0x5fab,0x177));var _0xb5fa=function(_0x3c40f4,_0x500b8a){_0x3c40f4=_0x3c40f4-0x0;var _0x1209d=_0x5fab[_0x3c40f4];return _0x1209d;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('IntegrationReport,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});}
\ No newline at end of file
index f3fc01d..c5f9e91 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe4d4=['addIntervals','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many'];(function(_0x1e2604,_0xf08d07){var _0x3c7085=function(_0x3d9206){while(--_0x3d9206){_0x1e2604['push'](_0x1e2604['shift']());}};_0x3c7085(++_0xf08d07);}(_0xe4d4,0x184));var _0x4e4d=function(_0x97ca17,_0x3d3d36){_0x97ca17=_0x97ca17-0x0;var _0x34f6cd=_0xe4d4[_0x97ca17];return _0x34f6cd;};'use strict';var multer=require(_0x4e4d('0x0'));var util=require(_0x4e4d('0x1'));var path=require(_0x4e4d('0x2'));var timeout=require(_0x4e4d('0x3'));var express=require('express');var router=express[_0x4e4d('0x4')]();var fs_extra=require(_0x4e4d('0x5'));var auth=require(_0x4e4d('0x6'));var interaction=require(_0x4e4d('0x7'));var config=require(_0x4e4d('0x8'));var controller=require(_0x4e4d('0x9'));router[_0x4e4d('0xa')]('/',auth[_0x4e4d('0xb')](),controller[_0x4e4d('0xc')]);router[_0x4e4d('0xa')](_0x4e4d('0xd'),auth[_0x4e4d('0xb')](),controller['show']);router[_0x4e4d('0xa')](_0x4e4d('0xe'),auth[_0x4e4d('0xb')](),controller[_0x4e4d('0xf')]);router['post']('/',auth[_0x4e4d('0xb')](),controller[_0x4e4d('0x10')]);router[_0x4e4d('0x11')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x4e4d('0x12')]);router[_0x4e4d('0x11')](_0x4e4d('0x13'),auth[_0x4e4d('0xb')](),controller[_0x4e4d('0x14')]);router['put'](_0x4e4d('0xd'),auth[_0x4e4d('0xb')](),controller[_0x4e4d('0x15')]);router['delete'](_0x4e4d('0xd'),auth['isAuthenticated'](),controller[_0x4e4d('0x16')]);module[_0x4e4d('0x17')]=router;
\ No newline at end of file
+var _0x1be0=['show','/:id/sub_intervals','getIntervals','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x594627,_0x35fe2d){var _0x424d78=function(_0x51698f){while(--_0x51698f){_0x594627['push'](_0x594627['shift']());}};_0x424d78(++_0x35fe2d);}(_0x1be0,0x16b));var _0x01be=function(_0x508298,_0x35b62f){_0x508298=_0x508298-0x0;var _0x462dca=_0x1be0[_0x508298];return _0x462dca;};'use strict';var multer=require('multer');var util=require(_0x01be('0x0'));var path=require(_0x01be('0x1'));var timeout=require(_0x01be('0x2'));var express=require(_0x01be('0x3'));var router=express['Router']();var fs_extra=require(_0x01be('0x4'));var auth=require(_0x01be('0x5'));var interaction=require(_0x01be('0x6'));var config=require(_0x01be('0x7'));var controller=require('./interval.controller');router[_0x01be('0x8')]('/',auth[_0x01be('0x9')](),controller['index']);router['get'](_0x01be('0xa'),auth[_0x01be('0x9')](),controller[_0x01be('0xb')]);router['get'](_0x01be('0xc'),auth[_0x01be('0x9')](),controller[_0x01be('0xd')]);router[_0x01be('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x01be('0xc'),auth[_0x01be('0x9')](),controller[_0x01be('0xf')]);router[_0x01be('0xe')](_0x01be('0x10'),auth[_0x01be('0x9')](),controller[_0x01be('0x11')]);router[_0x01be('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x01be('0x13')]);router[_0x01be('0x14')]('/:id',auth[_0x01be('0x9')](),controller['destroy']);module[_0x01be('0x15')]=router;
\ No newline at end of file
index 0b541d3..d6ee0de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x037c=['exports','STRING','sequelize'];(function(_0x374c7e,_0x339130){var _0x2efe47=function(_0x149bbf){while(--_0x149bbf){_0x374c7e['push'](_0x374c7e['shift']());}};_0x2efe47(++_0x339130);}(_0x037c,0x1b2));var _0xc037=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x037c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc037('0x0'));module[_0xc037('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc037('0x2')],'allowNull':!![]}};
\ No newline at end of file
+var _0xf71a=['STRING','sequelize','exports'];(function(_0x54545e,_0x5220e4){var _0x610536=function(_0x2ecedc){while(--_0x2ecedc){_0x54545e['push'](_0x54545e['shift']());}};_0x610536(++_0x5220e4);}(_0xf71a,0x190));var _0xaf71=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf71a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xaf71('0x0'));module[_0xaf71('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xaf71('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}};
\ No newline at end of file
index 65614ee..3f79af5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe97d=['params','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','order','addIntervals','sequelize','transaction','bulkCreate','findAll','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','Intervals','UserProfileResource','end','error','stack','name','send','map','Interval','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','rows','catch','show'];(function(_0x3fdd4f,_0x539d4a){var _0x50ea3a=function(_0x49db9d){while(--_0x49db9d){_0x3fdd4f['push'](_0x3fdd4f['shift']());}};_0x50ea3a(++_0x539d4a);}(_0xe97d,0x76));var _0xde97=function(_0x42e495,_0x49d9da){_0x42e495=_0x42e495-0x0;var _0x595da1=_0xe97d[_0x42e495];return _0x595da1;};'use strict';var emlformat=require(_0xde97('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xde97('0x1'));var jsonpatch=require(_0xde97('0x2'));var rp=require(_0xde97('0x3'));var moment=require(_0xde97('0x4'));var BPromise=require(_0xde97('0x5'));var Mustache=require(_0xde97('0x6'));var util=require(_0xde97('0x7'));var path=require('path');var sox=require(_0xde97('0x8'));var csv=require(_0xde97('0x9'));var ejs=require(_0xde97('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xde97('0xb'));var squel=require('squel');var crypto=require(_0xde97('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xde97('0xd'));var toCsv=require(_0xde97('0x9'));var querystring=require(_0xde97('0xe'));var Papa=require(_0xde97('0xf'));var Redis=require(_0xde97('0x10'));var authService=require(_0xde97('0x11'));var qs=require(_0xde97('0x12'));var as=require(_0xde97('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde97('0x14'))(_0xde97('0x15'));var utils=require(_0xde97('0x16'));var config=require(_0xde97('0x17'));var licenseUtil=require(_0xde97('0x18'));var db=require(_0xde97('0x19'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x5dc1d3,_0x29ead5){_0x29ead5=_0x29ead5||0xcc;return function(_0x3e7a14){if(_0x3e7a14){return _0x5dc1d3[_0xde97('0x1a')](_0x29ead5);}return _0x5dc1d3[_0xde97('0x1b')](_0x29ead5)['end']();};}function respondWithResult(_0x3b8094,_0x514056){_0x514056=_0x514056||0xc8;return function(_0x52f056){if(_0x52f056){return _0x3b8094[_0xde97('0x1b')](_0x514056)[_0xde97('0x1c')](_0x52f056);}};}function respondWithFilteredResult(_0x24af0e,_0x5894da){return function(_0xc01535){if(_0xc01535){var _0x49e6b5=typeof _0x5894da[_0xde97('0x1d')]===_0xde97('0x1e')&&typeof _0x5894da[_0xde97('0x1f')]===_0xde97('0x1e');var _0x1d87a5=_0xc01535[_0xde97('0x20')];var _0x31b887=_0x49e6b5?0x0:_0x5894da['offset'];var _0x1b73cb=_0x49e6b5?_0xc01535[_0xde97('0x20')]:_0x5894da[_0xde97('0x1d')]+_0x5894da[_0xde97('0x1f')];var _0x15b301;if(_0x1b73cb>=_0x1d87a5){_0x1b73cb=_0x1d87a5;_0x15b301=0xc8;}else{_0x15b301=0xce;}_0x24af0e[_0xde97('0x1b')](_0x15b301);return _0x24af0e[_0xde97('0x21')](_0xde97('0x22'),_0x31b887+'-'+_0x1b73cb+'/'+_0x1d87a5)['json'](_0xc01535);}return null;};}function patchUpdates(_0x357823){return function(_0x20158b){try{jsonpatch['apply'](_0x20158b,_0x357823,!![]);}catch(_0x17ba19){return BPromise[_0xde97('0x23')](_0x17ba19);}return _0x20158b[_0xde97('0x24')]();};}function saveUpdates(_0x2332f7,_0x495050){return function(_0x34a5dc){if(_0x34a5dc){return _0x34a5dc[_0xde97('0x25')](_0x2332f7)[_0xde97('0x26')](function(_0x3fa633){return _0x3fa633;});}return null;};}function removeEntity(_0x11b98f,_0x17d17a){return function(_0x5a8959){if(_0x5a8959){return _0x5a8959[_0xde97('0x27')]()[_0xde97('0x26')](function(){var _0x354ab5=_0x5a8959['get']({'plain':!![]});var _0x1ae4db=_0xde97('0x28');return db[_0xde97('0x29')][_0xde97('0x27')]({'where':{'type':_0x1ae4db,'resourceId':_0x354ab5['id']}})[_0xde97('0x26')](function(){return _0x5a8959;});})['then'](function(){_0x11b98f['status'](0xcc)[_0xde97('0x2a')]();});}};}function handleEntityNotFound(_0x2d61db,_0x57028b){return function(_0x1a0641){if(!_0x1a0641){_0x2d61db[_0xde97('0x1a')](0x194);}return _0x1a0641;};}function handleError(_0x1b5cc1,_0x31e36e){_0x31e36e=_0x31e36e||0x1f4;return function(_0x6d8b1a){logger[_0xde97('0x2b')](_0x6d8b1a[_0xde97('0x2c')]);if(_0x6d8b1a[_0xde97('0x2d')]){delete _0x6d8b1a[_0xde97('0x2d')];}_0x1b5cc1[_0xde97('0x1b')](_0x31e36e)[_0xde97('0x2e')](_0x6d8b1a);};}exports['index']=function(_0x146a98,_0x40a34f){var _0x3497c6={},_0x4e9f12={},_0x29d749={'count':0x0,'rows':[]};var _0xa7bd72=_[_0xde97('0x2f')](db[_0xde97('0x30')][_0xde97('0x31')],function(_0x339148){return{'name':_0x339148[_0xde97('0x32')],'type':_0x339148[_0xde97('0x33')][_0xde97('0x34')]};});_0x4e9f12['model']=_['map'](_0xa7bd72,'name');_0x4e9f12[_0xde97('0x35')]=_[_0xde97('0x36')](_0x146a98[_0xde97('0x35')]);_0x4e9f12['filters']=_[_0xde97('0x37')](_0x4e9f12['model'],_0x4e9f12[_0xde97('0x35')]);_0x3497c6[_0xde97('0x38')]=_[_0xde97('0x37')](_0x4e9f12['model'],qs[_0xde97('0x39')](_0x146a98[_0xde97('0x35')][_0xde97('0x39')]));_0x3497c6[_0xde97('0x38')]=_0x3497c6[_0xde97('0x38')][_0xde97('0x3a')]?_0x3497c6[_0xde97('0x38')]:_0x4e9f12[_0xde97('0x3b')];if(!_0x146a98[_0xde97('0x35')][_0xde97('0x3c')](_0xde97('0x3d'))){_0x3497c6[_0xde97('0x1f')]=qs[_0xde97('0x1f')](_0x146a98['query'][_0xde97('0x1f')]);_0x3497c6['offset']=qs[_0xde97('0x1d')](_0x146a98[_0xde97('0x35')][_0xde97('0x1d')]);}_0x3497c6['order']=qs[_0xde97('0x3e')](_0x146a98['query'][_0xde97('0x3e')]);_0x3497c6[_0xde97('0x3f')]=qs['filters'](_[_0xde97('0x40')](_0x146a98['query'],_0x4e9f12[_0xde97('0x41')]),_0xa7bd72);if(_0x146a98[_0xde97('0x35')][_0xde97('0x42')]){_0x3497c6[_0xde97('0x3f')]=_[_0xde97('0x43')](_0x3497c6[_0xde97('0x3f')],{'$or':_[_0xde97('0x2f')](_0xa7bd72,function(_0x32afde){if(_0x32afde[_0xde97('0x33')]!==_0xde97('0x44')){var _0x336f9f={};_0x336f9f[_0x32afde[_0xde97('0x2d')]]={'$like':'%'+_0x146a98[_0xde97('0x35')]['filter']+'%'};return _0x336f9f;}})});}_0x3497c6=_[_0xde97('0x43')]({},_0x3497c6,_0x146a98['options']);var _0x5a1044={'where':_0x3497c6[_0xde97('0x3f')]};return db['Interval'][_0xde97('0x20')](_0x5a1044)['then'](function(_0x3ba51d){_0x29d749[_0xde97('0x20')]=_0x3ba51d;if(_0x146a98[_0xde97('0x35')][_0xde97('0x45')]){_0x3497c6[_0xde97('0x46')]=[{'all':!![]}];}return db[_0xde97('0x30')]['findAll'](_0x3497c6);})[_0xde97('0x26')](function(_0x3e28de){_0x29d749[_0xde97('0x47')]=_0x3e28de;return _0x29d749;})['then'](respondWithFilteredResult(_0x40a34f,_0x3497c6))[_0xde97('0x48')](handleError(_0x40a34f,null));};exports[_0xde97('0x49')]=function(_0x3ac2c5,_0x5c456f){var _0x50fe92={'raw':!![],'where':{'id':_0x3ac2c5[_0xde97('0x4a')]['id']}},_0x359e88={};_0x359e88['model']=_['keys'](db[_0xde97('0x30')][_0xde97('0x31')]);_0x359e88[_0xde97('0x35')]=_['keys'](_0x3ac2c5['query']);_0x359e88['filters']=_['intersection'](_0x359e88[_0xde97('0x3b')],_0x359e88[_0xde97('0x35')]);_0x50fe92[_0xde97('0x38')]=_[_0xde97('0x37')](_0x359e88[_0xde97('0x3b')],qs[_0xde97('0x39')](_0x3ac2c5[_0xde97('0x35')]['fields']));_0x50fe92[_0xde97('0x38')]=_0x50fe92[_0xde97('0x38')][_0xde97('0x3a')]?_0x50fe92['attributes']:_0x359e88['model'];if(_0x3ac2c5['query']['includeAll']){_0x50fe92['include']=[{'all':!![]}];}_0x50fe92=_[_0xde97('0x43')]({},_0x50fe92,_0x3ac2c5[_0xde97('0x4b')]);return db['Interval'][_0xde97('0x4c')](_0x50fe92)[_0xde97('0x26')](handleEntityNotFound(_0x5c456f,null))[_0xde97('0x26')](respondWithResult(_0x5c456f,null))[_0xde97('0x48')](handleError(_0x5c456f,null));};exports[_0xde97('0x4d')]=function(_0x3673e3,_0x9a9c21){return db[_0xde97('0x30')][_0xde97('0x4d')](_0x3673e3[_0xde97('0x4e')],{})['then'](function(_0x24d000){var _0x4e9cc0=_0x3673e3[_0xde97('0x4f')][_0xde97('0x50')]({'plain':!![]});if(!_0x4e9cc0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4e9cc0[_0xde97('0x51')]===_0xde97('0x4f')){var _0x1342f8=_0x24d000[_0xde97('0x50')]({'plain':!![]});var _0x38ca73=_0xde97('0x28');return db[_0xde97('0x52')]['find']({'where':{'name':_0x38ca73,'userProfileId':_0x4e9cc0[_0xde97('0x53')]},'raw':!![]})[_0xde97('0x26')](function(_0x1c83e3){if(_0x1c83e3&&_0x1c83e3[_0xde97('0x54')]===0x0){return db['UserProfileResource'][_0xde97('0x4d')]({'name':_0x1342f8[_0xde97('0x2d')],'resourceId':_0x1342f8['id'],'type':_0x1c83e3[_0xde97('0x2d')],'sectionId':_0x1c83e3['id']},{})[_0xde97('0x26')](function(){return _0x24d000;});}else{return _0x24d000;}})[_0xde97('0x48')](function(_0x196993){logger[_0xde97('0x2b')](_0xde97('0x55'),_0x196993);throw _0x196993;});}return _0x24d000;})[_0xde97('0x26')](respondWithResult(_0x9a9c21,0xc9))[_0xde97('0x48')](handleError(_0x9a9c21,null));};exports[_0xde97('0x25')]=function(_0x3d685b,_0x58908b){if(_0x3d685b[_0xde97('0x4e')]['id']){delete _0x3d685b['body']['id'];}return db['Interval'][_0xde97('0x4c')]({'where':{'id':_0x3d685b[_0xde97('0x4a')]['id']}})[_0xde97('0x26')](handleEntityNotFound(_0x58908b,null))[_0xde97('0x26')](saveUpdates(_0x3d685b['body'],null))['then'](respondWithResult(_0x58908b,null))['catch'](handleError(_0x58908b,null));};exports['destroy']=function(_0x38c000,_0x52277f){return db[_0xde97('0x30')][_0xde97('0x4c')]({'where':{'id':_0x38c000[_0xde97('0x4a')]['id']}})[_0xde97('0x26')](handleEntityNotFound(_0x52277f,null))['then'](removeEntity(_0x52277f,null))[_0xde97('0x48')](handleError(_0x52277f,null));};exports[_0xde97('0x56')]=function(_0x164c5a,_0x1de4bc,_0x585f14){if(_0x164c5a['body']['id']){delete _0x164c5a['body']['id'];}return db['Interval'][_0xde97('0x4c')]({'where':{'id':_0x164c5a['params']['id']}})[_0xde97('0x26')](handleEntityNotFound(_0x1de4bc,null))[_0xde97('0x26')](function(_0x2701a2){if(_0x2701a2){_0x164c5a[_0xde97('0x4e')][_0xde97('0x57')]=_0x2701a2['id'];return db[_0xde97('0x30')]['create'](_0x164c5a['body']);}})['then'](respondWithResult(_0x1de4bc,null))[_0xde97('0x48')](handleError(_0x1de4bc,null));};exports[_0xde97('0x58')]=function(_0x3924ee,_0x50ca9b,_0x4420c8){var _0x16a30d={};var _0x56f77c={};var _0x3c7e4d;var _0x45dd39;return db[_0xde97('0x30')][_0xde97('0x59')]({'where':{'id':_0x3924ee[_0xde97('0x4a')]['id']}})[_0xde97('0x26')](handleEntityNotFound(_0x50ca9b,null))[_0xde97('0x26')](function(_0x1c9811){if(_0x1c9811){_0x3c7e4d=_0x1c9811;_0x56f77c['model']=_[_0xde97('0x36')](db[_0xde97('0x30')][_0xde97('0x31')]);_0x56f77c['query']=_[_0xde97('0x36')](_0x3924ee[_0xde97('0x35')]);_0x56f77c[_0xde97('0x41')]=_['intersection'](_0x56f77c['model'],_0x56f77c[_0xde97('0x35')]);_0x16a30d[_0xde97('0x38')]=_[_0xde97('0x37')](_0x56f77c['model'],qs['fields'](_0x3924ee[_0xde97('0x35')][_0xde97('0x39')]));_0x16a30d[_0xde97('0x38')]=_0x16a30d[_0xde97('0x38')][_0xde97('0x3a')]?_0x16a30d[_0xde97('0x38')]:_0x56f77c['model'];_0x16a30d[_0xde97('0x5a')]=qs['sort'](_0x3924ee[_0xde97('0x35')][_0xde97('0x3e')]);_0x16a30d['where']=qs[_0xde97('0x41')](_[_0xde97('0x40')](_0x3924ee['query'],_0x56f77c['filters']));if(_0x3924ee[_0xde97('0x35')][_0xde97('0x42')]){_0x16a30d['where']=_[_0xde97('0x43')](_0x16a30d[_0xde97('0x3f')],{'$or':_[_0xde97('0x2f')](_0x16a30d[_0xde97('0x38')],function(_0x4c0c1c){var _0x369765={};_0x369765[_0x4c0c1c]={'$like':'%'+_0x3924ee[_0xde97('0x35')][_0xde97('0x42')]+'%'};return _0x369765;})});}_0x16a30d=_['merge']({},_0x16a30d,_0x3924ee['options']);return _0x3c7e4d[_0xde97('0x58')](_0x16a30d);}})[_0xde97('0x26')](function(_0x135b48){if(_0x135b48){_0x45dd39=_0x135b48['length'];if(!_0x3924ee[_0xde97('0x35')][_0xde97('0x3c')](_0xde97('0x3d'))){_0x16a30d[_0xde97('0x1f')]=qs[_0xde97('0x1f')](_0x3924ee[_0xde97('0x35')][_0xde97('0x1f')]);_0x16a30d[_0xde97('0x1d')]=qs[_0xde97('0x1d')](_0x3924ee['query'][_0xde97('0x1d')]);}return _0x3c7e4d['getIntervals'](_0x16a30d);}})[_0xde97('0x26')](function(_0x594cdb){if(_0x594cdb){return _0x594cdb?{'count':_0x45dd39,'rows':_0x594cdb}:null;}})['then'](respondWithResult(_0x50ca9b,null))['catch'](handleError(_0x50ca9b,null));};exports[_0xde97('0x5b')]=function(_0x5c4b71,_0x309a54,_0x500bc4){return db[_0xde97('0x30')][_0xde97('0x59')]({'where':{'id':_0x5c4b71[_0xde97('0x4a')]['id']}})[_0xde97('0x26')](handleEntityNotFound(_0x309a54,null))[_0xde97('0x26')](function(_0x321286){if(_0x321286){return db[_0xde97('0x5c')][_0xde97('0x5d')](function(_0x2b55af){return db[_0xde97('0x30')]['destroy']({'where':{'IntervalId':_0x5c4b71[_0xde97('0x4a')]['id']},'transaction':_0x2b55af})[_0xde97('0x26')](function(_0x2f84b1){var _0x282dea=_[_0xde97('0x2f')](_0x5c4b71[_0xde97('0x4e')],function(_0x580e51){delete _0x580e51['id'];_0x580e51[_0xde97('0x57')]=_0x5c4b71[_0xde97('0x4a')]['id'];return _0x580e51;});return db[_0xde97('0x30')][_0xde97('0x5e')](_0x282dea,{'transaction':_0x2b55af});});})[_0xde97('0x26')](function(){return db[_0xde97('0x30')][_0xde97('0x5f')]({'where':{'IntervalId':_0x5c4b71[_0xde97('0x4a')]['id']}});});}})['then'](respondWithResult(_0x309a54,null))[_0xde97('0x48')](handleError(_0x309a54,null));};
\ No newline at end of file
+var _0xf903=['papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','Intervals','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','Interval','includeAll','findAll','rows','params','include','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','create','getIntervals','findOne','order','addIntervals','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring'];(function(_0x458624,_0x1f7435){var _0x29a003=function(_0x24ec83){while(--_0x24ec83){_0x458624['push'](_0x458624['shift']());}};_0x29a003(++_0x1f7435);}(_0xf903,0x150));var _0x3f90=function(_0x2e15c0,_0x1d4e79){_0x2e15c0=_0x2e15c0-0x0;var _0x385d1b=_0xf903[_0x2e15c0];return _0x385d1b;};'use strict';var emlformat=require(_0x3f90('0x0'));var rimraf=require(_0x3f90('0x1'));var zipdir=require(_0x3f90('0x2'));var jsonpatch=require(_0x3f90('0x3'));var rp=require(_0x3f90('0x4'));var moment=require(_0x3f90('0x5'));var BPromise=require(_0x3f90('0x6'));var Mustache=require(_0x3f90('0x7'));var util=require('util');var path=require(_0x3f90('0x8'));var sox=require('sox');var csv=require(_0x3f90('0x9'));var ejs=require(_0x3f90('0xa'));var fs=require('fs');var fs_extra=require(_0x3f90('0xb'));var _=require('lodash');var squel=require(_0x3f90('0xc'));var crypto=require('crypto');var jsforce=require(_0x3f90('0xd'));var deskjs=require(_0x3f90('0xe'));var toCsv=require(_0x3f90('0x9'));var querystring=require(_0x3f90('0xf'));var Papa=require(_0x3f90('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3f90('0x11'));var as=require(_0x3f90('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3f90('0x13'));var utils=require(_0x3f90('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3f90('0x15'));var db=require(_0x3f90('0x16'))['db'];var extensions=require(_0x3f90('0x17'));function respondWithStatusCode(_0x33a1f3,_0x16bff5){_0x16bff5=_0x16bff5||0xcc;return function(_0x11622b){if(_0x11622b){return _0x33a1f3[_0x3f90('0x18')](_0x16bff5);}return _0x33a1f3[_0x3f90('0x19')](_0x16bff5)[_0x3f90('0x1a')]();};}function respondWithResult(_0x3eb3cd,_0xfd23e7){_0xfd23e7=_0xfd23e7||0xc8;return function(_0x1a3c17){if(_0x1a3c17){return _0x3eb3cd[_0x3f90('0x19')](_0xfd23e7)[_0x3f90('0x1b')](_0x1a3c17);}};}function respondWithFilteredResult(_0x363a8e,_0x536210){return function(_0x2482b2){if(_0x2482b2){var _0x40ce5e=typeof _0x536210[_0x3f90('0x1c')]===_0x3f90('0x1d')&&typeof _0x536210[_0x3f90('0x1e')]===_0x3f90('0x1d');var _0x38b80d=_0x2482b2[_0x3f90('0x1f')];var _0x45b741=_0x40ce5e?0x0:_0x536210[_0x3f90('0x1c')];var _0x5b1a04=_0x40ce5e?_0x2482b2['count']:_0x536210[_0x3f90('0x1c')]+_0x536210[_0x3f90('0x1e')];var _0x2ed09e;if(_0x5b1a04>=_0x38b80d){_0x5b1a04=_0x38b80d;_0x2ed09e=0xc8;}else{_0x2ed09e=0xce;}_0x363a8e['status'](_0x2ed09e);return _0x363a8e[_0x3f90('0x20')](_0x3f90('0x21'),_0x45b741+'-'+_0x5b1a04+'/'+_0x38b80d)[_0x3f90('0x1b')](_0x2482b2);}return null;};}function patchUpdates(_0x5d138e){return function(_0x96a2af){try{jsonpatch[_0x3f90('0x22')](_0x96a2af,_0x5d138e,!![]);}catch(_0x9566db){return BPromise[_0x3f90('0x23')](_0x9566db);}return _0x96a2af['save']();};}function saveUpdates(_0x191040,_0x3c7f4c){return function(_0x541c93){if(_0x541c93){return _0x541c93[_0x3f90('0x24')](_0x191040)[_0x3f90('0x25')](function(_0x28f37f){return _0x28f37f;});}return null;};}function removeEntity(_0x8a7514,_0x1fb925){return function(_0x5dc002){if(_0x5dc002){return _0x5dc002[_0x3f90('0x26')]()[_0x3f90('0x25')](function(){var _0x1a4b0e=_0x5dc002[_0x3f90('0x27')]({'plain':!![]});var _0x7ac5=_0x3f90('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x7ac5,'resourceId':_0x1a4b0e['id']}})[_0x3f90('0x25')](function(){return _0x5dc002;});})[_0x3f90('0x25')](function(){_0x8a7514['status'](0xcc)[_0x3f90('0x1a')]();});}};}function handleEntityNotFound(_0x51f09e,_0x38cff5){return function(_0x4a2aef){if(!_0x4a2aef){_0x51f09e['sendStatus'](0x194);}return _0x4a2aef;};}function handleError(_0x5e7976,_0x165203){_0x165203=_0x165203||0x1f4;return function(_0x15f2f0){logger[_0x3f90('0x29')](_0x15f2f0['stack']);if(_0x15f2f0[_0x3f90('0x2a')]){delete _0x15f2f0[_0x3f90('0x2a')];}_0x5e7976[_0x3f90('0x19')](_0x165203)['send'](_0x15f2f0);};}exports[_0x3f90('0x2b')]=function(_0x3aeb90,_0x3ac22e){var _0x3a3f85={},_0x3faa4b={},_0x5ec997={'count':0x0,'rows':[]};var _0xa740a4=_[_0x3f90('0x2c')](db['Interval'][_0x3f90('0x2d')],function(_0x1b036d){return{'name':_0x1b036d[_0x3f90('0x2e')],'type':_0x1b036d['type'][_0x3f90('0x2f')]};});_0x3faa4b[_0x3f90('0x30')]=_[_0x3f90('0x2c')](_0xa740a4,'name');_0x3faa4b[_0x3f90('0x31')]=_[_0x3f90('0x32')](_0x3aeb90[_0x3f90('0x31')]);_0x3faa4b[_0x3f90('0x33')]=_[_0x3f90('0x34')](_0x3faa4b[_0x3f90('0x30')],_0x3faa4b[_0x3f90('0x31')]);_0x3a3f85[_0x3f90('0x35')]=_['intersection'](_0x3faa4b[_0x3f90('0x30')],qs[_0x3f90('0x36')](_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x36')]));_0x3a3f85['attributes']=_0x3a3f85[_0x3f90('0x35')][_0x3f90('0x37')]?_0x3a3f85['attributes']:_0x3faa4b[_0x3f90('0x30')];if(!_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x38')](_0x3f90('0x39'))){_0x3a3f85[_0x3f90('0x1e')]=qs[_0x3f90('0x1e')](_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x1e')]);_0x3a3f85[_0x3f90('0x1c')]=qs[_0x3f90('0x1c')](_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x1c')]);}_0x3a3f85['order']=qs[_0x3f90('0x3a')](_0x3aeb90['query'][_0x3f90('0x3a')]);_0x3a3f85['where']=qs[_0x3f90('0x33')](_[_0x3f90('0x3b')](_0x3aeb90['query'],_0x3faa4b['filters']),_0xa740a4);if(_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x3c')]){_0x3a3f85['where']=_['merge'](_0x3a3f85[_0x3f90('0x3d')],{'$or':_['map'](_0xa740a4,function(_0x16037d){if(_0x16037d['type']!==_0x3f90('0x3e')){var _0x42fcf6={};_0x42fcf6[_0x16037d['name']]={'$like':'%'+_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x3c')]+'%'};return _0x42fcf6;}})});}_0x3a3f85=_[_0x3f90('0x3f')]({},_0x3a3f85,_0x3aeb90[_0x3f90('0x40')]);var _0x4ac877={'where':_0x3a3f85['where']};return db[_0x3f90('0x41')][_0x3f90('0x1f')](_0x4ac877)[_0x3f90('0x25')](function(_0x4d9c68){_0x5ec997['count']=_0x4d9c68;if(_0x3aeb90[_0x3f90('0x31')][_0x3f90('0x42')]){_0x3a3f85['include']=[{'all':!![]}];}return db['Interval'][_0x3f90('0x43')](_0x3a3f85);})[_0x3f90('0x25')](function(_0x11b244){_0x5ec997[_0x3f90('0x44')]=_0x11b244;return _0x5ec997;})[_0x3f90('0x25')](respondWithFilteredResult(_0x3ac22e,_0x3a3f85))['catch'](handleError(_0x3ac22e,null));};exports['show']=function(_0x5d74e8,_0x5cb818){var _0x2b41f8={'raw':!![],'where':{'id':_0x5d74e8[_0x3f90('0x45')]['id']}},_0x4e033f={};_0x4e033f[_0x3f90('0x30')]=_[_0x3f90('0x32')](db[_0x3f90('0x41')][_0x3f90('0x2d')]);_0x4e033f['query']=_[_0x3f90('0x32')](_0x5d74e8[_0x3f90('0x31')]);_0x4e033f[_0x3f90('0x33')]=_[_0x3f90('0x34')](_0x4e033f[_0x3f90('0x30')],_0x4e033f[_0x3f90('0x31')]);_0x2b41f8['attributes']=_[_0x3f90('0x34')](_0x4e033f[_0x3f90('0x30')],qs[_0x3f90('0x36')](_0x5d74e8['query']['fields']));_0x2b41f8[_0x3f90('0x35')]=_0x2b41f8[_0x3f90('0x35')][_0x3f90('0x37')]?_0x2b41f8[_0x3f90('0x35')]:_0x4e033f[_0x3f90('0x30')];if(_0x5d74e8[_0x3f90('0x31')][_0x3f90('0x42')]){_0x2b41f8[_0x3f90('0x46')]=[{'all':!![]}];}_0x2b41f8=_[_0x3f90('0x3f')]({},_0x2b41f8,_0x5d74e8['options']);return db[_0x3f90('0x41')][_0x3f90('0x47')](_0x2b41f8)[_0x3f90('0x25')](handleEntityNotFound(_0x5cb818,null))[_0x3f90('0x25')](respondWithResult(_0x5cb818,null))[_0x3f90('0x48')](handleError(_0x5cb818,null));};exports['create']=function(_0x32364f,_0xcbba4b){return db['Interval']['create'](_0x32364f[_0x3f90('0x49')],{})[_0x3f90('0x25')](function(_0x39c510){var _0x40cbd5=_0x32364f[_0x3f90('0x4a')][_0x3f90('0x27')]({'plain':!![]});if(!_0x40cbd5)throw new Error(_0x3f90('0x4b'));if(_0x40cbd5['role']===_0x3f90('0x4a')){var _0x1077a7=_0x39c510[_0x3f90('0x27')]({'plain':!![]});var _0x1762b1=_0x3f90('0x28');return db['UserProfileSection'][_0x3f90('0x47')]({'where':{'name':_0x1762b1,'userProfileId':_0x40cbd5[_0x3f90('0x4c')]},'raw':!![]})[_0x3f90('0x25')](function(_0x106a1a){if(_0x106a1a&&_0x106a1a[_0x3f90('0x4d')]===0x0){return db[_0x3f90('0x4e')]['create']({'name':_0x1077a7['name'],'resourceId':_0x1077a7['id'],'type':_0x106a1a[_0x3f90('0x2a')],'sectionId':_0x106a1a['id']},{})[_0x3f90('0x25')](function(){return _0x39c510;});}else{return _0x39c510;}})[_0x3f90('0x48')](function(_0x4ec196){logger[_0x3f90('0x29')](_0x3f90('0x4f'),_0x4ec196);throw _0x4ec196;});}return _0x39c510;})[_0x3f90('0x25')](respondWithResult(_0xcbba4b,0xc9))['catch'](handleError(_0xcbba4b,null));};exports[_0x3f90('0x24')]=function(_0x2fb327,_0x2e13e7){if(_0x2fb327['body']['id']){delete _0x2fb327[_0x3f90('0x49')]['id'];}return db[_0x3f90('0x41')][_0x3f90('0x47')]({'where':{'id':_0x2fb327['params']['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x2e13e7,null))[_0x3f90('0x25')](saveUpdates(_0x2fb327['body'],null))[_0x3f90('0x25')](respondWithResult(_0x2e13e7,null))[_0x3f90('0x48')](handleError(_0x2e13e7,null));};exports[_0x3f90('0x26')]=function(_0x501589,_0x35431e){return db['Interval'][_0x3f90('0x47')]({'where':{'id':_0x501589['params']['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x35431e,null))['then'](removeEntity(_0x35431e,null))['catch'](handleError(_0x35431e,null));};exports['addInterval']=function(_0x205443,_0x311f89,_0x5ca295){if(_0x205443['body']['id']){delete _0x205443[_0x3f90('0x49')]['id'];}return db['Interval']['find']({'where':{'id':_0x205443[_0x3f90('0x45')]['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x311f89,null))[_0x3f90('0x25')](function(_0xec3414){if(_0xec3414){_0x205443[_0x3f90('0x49')][_0x3f90('0x50')]=_0xec3414['id'];return db[_0x3f90('0x41')][_0x3f90('0x51')](_0x205443[_0x3f90('0x49')]);}})[_0x3f90('0x25')](respondWithResult(_0x311f89,null))[_0x3f90('0x48')](handleError(_0x311f89,null));};exports[_0x3f90('0x52')]=function(_0x314a6f,_0xfb1f21,_0x133374){var _0x4efa1e={};var _0x2f41b3={};var _0x159f49;var _0x563390;return db[_0x3f90('0x41')][_0x3f90('0x53')]({'where':{'id':_0x314a6f[_0x3f90('0x45')]['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0xfb1f21,null))[_0x3f90('0x25')](function(_0x1ca1e5){if(_0x1ca1e5){_0x159f49=_0x1ca1e5;_0x2f41b3['model']=_[_0x3f90('0x32')](db[_0x3f90('0x41')][_0x3f90('0x2d')]);_0x2f41b3[_0x3f90('0x31')]=_[_0x3f90('0x32')](_0x314a6f[_0x3f90('0x31')]);_0x2f41b3[_0x3f90('0x33')]=_['intersection'](_0x2f41b3[_0x3f90('0x30')],_0x2f41b3['query']);_0x4efa1e['attributes']=_[_0x3f90('0x34')](_0x2f41b3[_0x3f90('0x30')],qs[_0x3f90('0x36')](_0x314a6f[_0x3f90('0x31')]['fields']));_0x4efa1e['attributes']=_0x4efa1e[_0x3f90('0x35')][_0x3f90('0x37')]?_0x4efa1e[_0x3f90('0x35')]:_0x2f41b3[_0x3f90('0x30')];_0x4efa1e[_0x3f90('0x54')]=qs[_0x3f90('0x3a')](_0x314a6f[_0x3f90('0x31')][_0x3f90('0x3a')]);_0x4efa1e[_0x3f90('0x3d')]=qs[_0x3f90('0x33')](_[_0x3f90('0x3b')](_0x314a6f[_0x3f90('0x31')],_0x2f41b3[_0x3f90('0x33')]));if(_0x314a6f['query'][_0x3f90('0x3c')]){_0x4efa1e['where']=_[_0x3f90('0x3f')](_0x4efa1e[_0x3f90('0x3d')],{'$or':_[_0x3f90('0x2c')](_0x4efa1e['attributes'],function(_0x7b9c64){var _0x295bd6={};_0x295bd6[_0x7b9c64]={'$like':'%'+_0x314a6f[_0x3f90('0x31')][_0x3f90('0x3c')]+'%'};return _0x295bd6;})});}_0x4efa1e=_[_0x3f90('0x3f')]({},_0x4efa1e,_0x314a6f[_0x3f90('0x40')]);return _0x159f49[_0x3f90('0x52')](_0x4efa1e);}})[_0x3f90('0x25')](function(_0x56f856){if(_0x56f856){_0x563390=_0x56f856[_0x3f90('0x37')];if(!_0x314a6f[_0x3f90('0x31')]['hasOwnProperty'](_0x3f90('0x39'))){_0x4efa1e['limit']=qs[_0x3f90('0x1e')](_0x314a6f[_0x3f90('0x31')][_0x3f90('0x1e')]);_0x4efa1e[_0x3f90('0x1c')]=qs[_0x3f90('0x1c')](_0x314a6f[_0x3f90('0x31')]['offset']);}return _0x159f49[_0x3f90('0x52')](_0x4efa1e);}})[_0x3f90('0x25')](function(_0x21e29d){if(_0x21e29d){return _0x21e29d?{'count':_0x563390,'rows':_0x21e29d}:null;}})[_0x3f90('0x25')](respondWithResult(_0xfb1f21,null))[_0x3f90('0x48')](handleError(_0xfb1f21,null));};exports[_0x3f90('0x55')]=function(_0x2a9b54,_0x3011c5,_0x352a54){return db['Interval'][_0x3f90('0x53')]({'where':{'id':_0x2a9b54[_0x3f90('0x45')]['id']}})[_0x3f90('0x25')](handleEntityNotFound(_0x3011c5,null))[_0x3f90('0x25')](function(_0xc28f5e){if(_0xc28f5e){return db['sequelize'][_0x3f90('0x56')](function(_0x320863){return db[_0x3f90('0x41')][_0x3f90('0x26')]({'where':{'IntervalId':_0x2a9b54['params']['id']},'transaction':_0x320863})[_0x3f90('0x25')](function(_0x5c3c9f){var _0x3f0d5a=_[_0x3f90('0x2c')](_0x2a9b54[_0x3f90('0x49')],function(_0x5d12fa){delete _0x5d12fa['id'];_0x5d12fa[_0x3f90('0x50')]=_0x2a9b54[_0x3f90('0x45')]['id'];return _0x5d12fa;});return db[_0x3f90('0x41')][_0x3f90('0x57')](_0x3f0d5a,{'transaction':_0x320863});});})[_0x3f90('0x25')](function(){return db[_0x3f90('0x41')][_0x3f90('0x43')]({'where':{'IntervalId':_0x2a9b54[_0x3f90('0x45')]['id']}});});}})['then'](respondWithResult(_0x3011c5,null))['catch'](handleError(_0x3011c5,null));};
\ No newline at end of file
index bcafea1..0871cd1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa4e3=['all','map','ifTime','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite','getIntervals','then'];(function(_0x272fa4,_0xf712d1){var _0x25ec85=function(_0x2be21c){while(--_0x2be21c){_0x272fa4['push'](_0x272fa4['shift']());}};_0x25ec85(++_0xf712d1);}(_0xa4e3,0xc3));var _0x3a4e=function(_0x2398eb,_0x48dae4){_0x2398eb=_0x2398eb-0x0;var _0x112615=_0xa4e3[_0x2398eb];return _0x112615;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0x3a4e('0x0'));var iftime=require(_0x3a4e('0x1'))[_0x3a4e('0x2')];module[_0x3a4e('0x3')]=function(_0x54031d){return _0x54031d['define'](_0x3a4e('0x4'),attributes,{'tableName':_0x3a4e('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fc5b6){extensions[_0x3a4e('0x6')](_0x54031d,_0x3fc5b6);},'afterBulkCreate':function(_0x2c2151,_0x306851,_0x5db3b6){_0x5db3b6();extensions[_0x3a4e('0x6')](_0x54031d,_0x2c2151[0x0]);},'afterUpdate':function(_0x13fb95){extensions[_0x3a4e('0x6')](_0x54031d,_0x13fb95);},'afterDestroy':function(_0x49a80f){extensions[_0x3a4e('0x6')](_0x54031d,_0x49a80f);}},'instanceMethods':{'ifTime':function(_0x1e0f6b=undefined,_0x123f6d=new Date()){if(typeof this['interval']==='string'){return iftime(this['interval'],_0x1e0f6b,_0x123f6d);}else{return this[_0x3a4e('0x7')]()[_0x3a4e('0x8')](function(_0x56d736){return Promise[_0x3a4e('0x9')](_0x56d736[_0x3a4e('0xa')](function(_0x457b01){return _0x457b01[_0x3a4e('0xb')](_0x1e0f6b,_0x123f6d);}));})[_0x3a4e('0x8')](function(_0x4e028f){return _0x4e028f['reduce'](function(_0x9f3686,_0x49b4d1){return _0x9f3686||_0x49b4d1;},![]);});}}}});};
\ No newline at end of file
+var _0xe7d0=['map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','iftime','exports','Interval','tools_intervals','rewrite','interval','string','all'];(function(_0x4b68b1,_0x1b5de1){var _0x392e50=function(_0x1ccd57){while(--_0x1ccd57){_0x4b68b1['push'](_0x4b68b1['shift']());}};_0x392e50(++_0x1b5de1);}(_0xe7d0,0x1c4));var _0x0e7d=function(_0x558c4e,_0x5f57f8){_0x558c4e=_0x558c4e-0x0;var _0x3ccaba=_0xe7d0[_0x558c4e];return _0x3ccaba;};'use strict';var attributes=require(_0x0e7d('0x0'));var extensions=require(_0x0e7d('0x1'));var iftime=require('../../utils/iftime')[_0x0e7d('0x2')];module[_0x0e7d('0x3')]=function(_0xe051e1){return _0xe051e1['define'](_0x0e7d('0x4'),attributes,{'tableName':_0x0e7d('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x7e2cf9){extensions['rewrite'](_0xe051e1,_0x7e2cf9);},'afterBulkCreate':function(_0x2720f7,_0x14e279,_0x387ec0){_0x387ec0();extensions[_0x0e7d('0x6')](_0xe051e1,_0x2720f7[0x0]);},'afterUpdate':function(_0x3d7c2d){extensions['rewrite'](_0xe051e1,_0x3d7c2d);},'afterDestroy':function(_0x1b32d8){extensions[_0x0e7d('0x6')](_0xe051e1,_0x1b32d8);}},'instanceMethods':{'ifTime':function(_0x468eb8=undefined,_0x1d831d=new Date()){if(typeof this[_0x0e7d('0x7')]===_0x0e7d('0x8')){return iftime(this[_0x0e7d('0x7')],_0x468eb8,_0x1d831d);}else{return this['getIntervals']()['then'](function(_0x40eed3){return Promise[_0x0e7d('0x9')](_0x40eed3[_0x0e7d('0xa')](function(_0x662427){return _0x662427[_0x0e7d('0xb')](_0x468eb8,_0x1d831d);}));})[_0x0e7d('0xc')](function(_0x441b68){return _0x441b68[_0x0e7d('0xd')](function(_0x21b139,_0xa9160f){return _0x21b139||_0xa9160f;},![]);});}}}});};
\ No newline at end of file
index 324bba0..0c09253 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6313=['limit','model','map','include','then','error','message','find','info','ShowInterval','debug','stringify','catch','Interval','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','isArray','reduce','lodash','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','where','attributes'];(function(_0x22447a,_0x980846){var _0x203ec5=function(_0x5f3975){while(--_0x5f3975){_0x22447a['push'](_0x22447a['shift']());}};_0x203ec5(++_0x980846);}(_0x6313,0xcc));var _0x3631=function(_0x5bee28,_0x1dc7e2){_0x5bee28=_0x5bee28-0x0;var _0x395d1d=_0x6313[_0x5bee28];return _0x395d1d;};'use strict';var _=require(_0x3631('0x0'));var util=require('util');var db=require(_0x3631('0x1'))['db'];var iftime=require(_0x3631('0x2'))[_0x3631('0x3')];var logger=require(_0x3631('0x4'))(_0x3631('0x5'));exports[_0x3631('0x6')]=function(_0x2ab375){var _0x5c468a=this;return new Promise(function(_0x33f12b,_0x3bfe49){return db['Interval'][_0x3631('0x7')]({'raw':_0x2ab375[_0x3631('0x8')]?_0x2ab375[_0x3631('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x2ab375[_0x3631('0x8')]?_0x2ab375[_0x3631('0x8')][_0x3631('0x9')]||null:null,'attributes':_0x2ab375[_0x3631('0x8')]?_0x2ab375['options'][_0x3631('0xa')]||null:null,'limit':_0x2ab375[_0x3631('0x8')]?_0x2ab375[_0x3631('0x8')][_0x3631('0xb')]||null:null,'include':_0x2ab375[_0x3631('0x8')]?_0x2ab375[_0x3631('0x8')]['include']?_['map'](_0x2ab375['options']['include'],function(_0x21e315){return{'model':db[_0x21e315[_0x3631('0xc')]],'as':_0x21e315['as'],'attributes':_0x21e315[_0x3631('0xa')],'include':_0x21e315['include']?_[_0x3631('0xd')](_0x21e315[_0x3631('0xe')],function(_0x51be25){return{'model':db[_0x51be25['model']],'as':_0x51be25['as'],'attributes':_0x51be25['attributes'],'include':_0x51be25[_0x3631('0xe')]?_[_0x3631('0xd')](_0x51be25[_0x3631('0xe')],function(_0x25c1cb){return{'model':db[_0x25c1cb[_0x3631('0xc')]],'as':_0x25c1cb['as'],'attributes':_0x25c1cb[_0x3631('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3631('0xf')](function(_0x210e49){logger['info'](_0x3631('0x6'),_0x2ab375);logger['debug'](_0x3631('0x6'),_0x2ab375,JSON['stringify'](_0x210e49));_0x33f12b(_0x210e49);})['catch'](function(_0x37d87d){logger[_0x3631('0x10')](_0x3631('0x6'),_0x37d87d[_0x3631('0x11')],_0x2ab375);_0x3bfe49(_0x5c468a[_0x3631('0x10')](0x1f4,_0x37d87d[_0x3631('0x11')]));});});};exports['ShowInterval']=function(_0x4d06d6){var _0x33de84=this;return new Promise(function(_0x3d1d36,_0x138813){return db['Interval'][_0x3631('0x12')]({'raw':_0x4d06d6[_0x3631('0x8')]?_0x4d06d6['options']['raw']===undefined?!![]:![]:!![],'where':_0x4d06d6['options']?_0x4d06d6[_0x3631('0x8')][_0x3631('0x9')]||null:null,'attributes':_0x4d06d6[_0x3631('0x8')]?_0x4d06d6[_0x3631('0x8')][_0x3631('0xa')]||null:null,'include':_0x4d06d6[_0x3631('0x8')]?_0x4d06d6['options'][_0x3631('0xe')]?_[_0x3631('0xd')](_0x4d06d6[_0x3631('0x8')][_0x3631('0xe')],function(_0x490477){return{'model':db[_0x490477['model']],'as':_0x490477['as'],'attributes':_0x490477[_0x3631('0xa')],'include':_0x490477[_0x3631('0xe')]?_[_0x3631('0xd')](_0x490477[_0x3631('0xe')],function(_0x24534e){return{'model':db[_0x24534e['model']],'as':_0x24534e['as'],'attributes':_0x24534e['attributes'],'include':_0x24534e[_0x3631('0xe')]?_[_0x3631('0xd')](_0x24534e['include'],function(_0x42e822){return{'model':db[_0x42e822[_0x3631('0xc')]],'as':_0x42e822['as'],'attributes':_0x42e822[_0x3631('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x48513d){logger[_0x3631('0x13')](_0x3631('0x14'),_0x4d06d6);logger[_0x3631('0x15')](_0x3631('0x14'),_0x4d06d6,JSON[_0x3631('0x16')](_0x48513d));_0x3d1d36(_0x48513d);})[_0x3631('0x17')](function(_0x27bbb0){logger[_0x3631('0x10')](_0x3631('0x14'),_0x27bbb0[_0x3631('0x11')],_0x4d06d6);_0x138813(_0x33de84[_0x3631('0x10')](0x1f4,_0x27bbb0[_0x3631('0x11')]));});});};function checkArrayOfIntervals(_0x365fb9,_0x3ff676){var _0x3024e7=[];return db[_0x3631('0x18')]['findAll']({'where':{'id':_0x365fb9}})['then'](function(_0x99df58){_0x3024e7=_0x99df58;return Promise[_0x3631('0x19')](_0x3024e7[_0x3631('0xd')](function(_0x159174){return _0x159174[_0x3631('0x1a')](_0x3ff676);}));})[_0x3631('0xf')](function(_0xa2a5c4){var _0x2abe4b=_0xa2a5c4['reduce'](function(_0x2dc8de,_0x3465e1){return _0x2dc8de||_0x3465e1;},![]);logger[_0x3631('0x13')](util[_0x3631('0x1b')](_0x3631('0x1c'),_0x3024e7[_0x3631('0xd')](function(_0x360a03){return _0x360a03['name'];})['join'](',\x20'),_0x3024e7[_0x3631('0xd')](function(_0x3b5487){return _0x3b5487['id'];})[_0x3631('0x1d')](',\x20')));return _0x2abe4b;});}function checkSingleInterval(_0x266af3,_0x33c59e){return db['Interval']['findById'](_0x266af3)[_0x3631('0xf')](function(_0x3f86ac){if(_0x3f86ac){logger[_0x3631('0x13')](util['format'](_0x3631('0x1e'),_0x3f86ac['name'],_0x3f86ac['id']));return _0x3f86ac[_0x3631('0x1a')](_0x33c59e);}});}exports[_0x3631('0x1f')]=function(_0xaf9e7c){var _0x3d5657=_0xaf9e7c[_0x3631('0x20')];var _0x3c6800=Array['isArray'](_0xaf9e7c['intervals'])?_0xaf9e7c[_0x3631('0x21')]:typeof _0xaf9e7c['intervals']===_0x3631('0x22')?[_0xaf9e7c[_0x3631('0x21')]]:[];var _0x4f998a=_0xaf9e7c[_0x3631('0x23')]||undefined;var _0x3ae292=![];if(_0x3c6800['length']){logger[_0x3631('0x13')](util[_0x3631('0x1b')](_0x3631('0x24'),_0x3c6800[_0x3631('0x1d')](';\x20')));}if(_0x4f998a){logger[_0x3631('0x13')](util[_0x3631('0x1b')](_0x3631('0x25'),_0x4f998a));}logger['debug'](_0x3631('0x26'),_0x3ae292);logger[_0x3631('0x27')](_0x3631('0x1f'),_0xaf9e7c);return Promise[_0x3631('0x28')]()['then'](function(){if(Array[_0x3631('0x29')](_0x3d5657)){return checkArrayOfIntervals(_0x3d5657,_0x4f998a);}else if(_0x3d5657){return checkSingleInterval(_0x3d5657,_0x4f998a);}})[_0x3631('0xf')](function(_0x46e0d6){var _0x3e2d22=_0x3c6800[_0x3631('0x2a')](function(_0x41f4f4,_0x22d92b){return _0x41f4f4||iftime(_0x22d92b,_0x4f998a);},![]);_0x3ae292=_0x46e0d6||_0x3e2d22;return _0x3ae292;})[_0x3631('0x17')](function(_0x1d33eb){logger[_0x3631('0x10')](_0x3631('0x1f'),_0xaf9e7c,_0x1d33eb);throw this[_0x3631('0x10')](0x1f4,_0x1d33eb[_0x3631('0x11')]);});};
\ No newline at end of file
+var _0x30c1=['util','../../mysqldb','../../config/logger','rpc','options','raw','where','attributes','limit','include','map','model','info','GetInterval','debug','stringify','catch','error','message','ShowInterval','Interval','find','then','all','reduce','format','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','intervalIds','isArray','intervals','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','join','IntervalIftime:\x20timezone\x20=\x20%s','IntervalIftime','resolve','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30c1,0x9b));var _0x130c=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x30c1[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0x130c('0x0'));var util=require(_0x130c('0x1'));var db=require(_0x130c('0x2'))['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x130c('0x3'))(_0x130c('0x4'));exports['GetInterval']=function(_0x57fbf2){var _0xadee42=this;return new Promise(function(_0x361d0c,_0x457065){return db['Interval']['findAll']({'raw':_0x57fbf2[_0x130c('0x5')]?_0x57fbf2[_0x130c('0x5')][_0x130c('0x6')]===undefined?!![]:![]:!![],'where':_0x57fbf2[_0x130c('0x5')]?_0x57fbf2['options'][_0x130c('0x7')]||null:null,'attributes':_0x57fbf2[_0x130c('0x5')]?_0x57fbf2[_0x130c('0x5')][_0x130c('0x8')]||null:null,'limit':_0x57fbf2['options']?_0x57fbf2['options'][_0x130c('0x9')]||null:null,'include':_0x57fbf2[_0x130c('0x5')]?_0x57fbf2['options'][_0x130c('0xa')]?_[_0x130c('0xb')](_0x57fbf2[_0x130c('0x5')]['include'],function(_0x5223f3){return{'model':db[_0x5223f3['model']],'as':_0x5223f3['as'],'attributes':_0x5223f3[_0x130c('0x8')],'include':_0x5223f3[_0x130c('0xa')]?_['map'](_0x5223f3[_0x130c('0xa')],function(_0x3b1c6e){return{'model':db[_0x3b1c6e[_0x130c('0xc')]],'as':_0x3b1c6e['as'],'attributes':_0x3b1c6e[_0x130c('0x8')],'include':_0x3b1c6e[_0x130c('0xa')]?_['map'](_0x3b1c6e[_0x130c('0xa')],function(_0x186881){return{'model':db[_0x186881[_0x130c('0xc')]],'as':_0x186881['as'],'attributes':_0x186881['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2a0e16){logger[_0x130c('0xd')](_0x130c('0xe'),_0x57fbf2);logger[_0x130c('0xf')](_0x130c('0xe'),_0x57fbf2,JSON[_0x130c('0x10')](_0x2a0e16));_0x361d0c(_0x2a0e16);})[_0x130c('0x11')](function(_0x47ff5d){logger[_0x130c('0x12')](_0x130c('0xe'),_0x47ff5d[_0x130c('0x13')],_0x57fbf2);_0x457065(_0xadee42[_0x130c('0x12')](0x1f4,_0x47ff5d[_0x130c('0x13')]));});});};exports[_0x130c('0x14')]=function(_0xe953c6){var _0x2c3f8e=this;return new Promise(function(_0x322860,_0x2b848d){return db[_0x130c('0x15')][_0x130c('0x16')]({'raw':_0xe953c6[_0x130c('0x5')]?_0xe953c6[_0x130c('0x5')][_0x130c('0x6')]===undefined?!![]:![]:!![],'where':_0xe953c6[_0x130c('0x5')]?_0xe953c6[_0x130c('0x5')][_0x130c('0x7')]||null:null,'attributes':_0xe953c6[_0x130c('0x5')]?_0xe953c6[_0x130c('0x5')]['attributes']||null:null,'include':_0xe953c6[_0x130c('0x5')]?_0xe953c6['options']['include']?_[_0x130c('0xb')](_0xe953c6[_0x130c('0x5')][_0x130c('0xa')],function(_0x4273db){return{'model':db[_0x4273db[_0x130c('0xc')]],'as':_0x4273db['as'],'attributes':_0x4273db[_0x130c('0x8')],'include':_0x4273db[_0x130c('0xa')]?_[_0x130c('0xb')](_0x4273db[_0x130c('0xa')],function(_0x1734d8){return{'model':db[_0x1734d8[_0x130c('0xc')]],'as':_0x1734d8['as'],'attributes':_0x1734d8[_0x130c('0x8')],'include':_0x1734d8[_0x130c('0xa')]?_['map'](_0x1734d8['include'],function(_0x234055){return{'model':db[_0x234055[_0x130c('0xc')]],'as':_0x234055['as'],'attributes':_0x234055[_0x130c('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3416a4){logger[_0x130c('0xd')](_0x130c('0x14'),_0xe953c6);logger['debug'](_0x130c('0x14'),_0xe953c6,JSON[_0x130c('0x10')](_0x3416a4));_0x322860(_0x3416a4);})[_0x130c('0x11')](function(_0x5265bc){logger[_0x130c('0x12')](_0x130c('0x14'),_0x5265bc['message'],_0xe953c6);_0x2b848d(_0x2c3f8e[_0x130c('0x12')](0x1f4,_0x5265bc[_0x130c('0x13')]));});});};function checkArrayOfIntervals(_0x5cb86e,_0x556d9a){var _0x478680=[];return db['Interval']['findAll']({'where':{'id':_0x5cb86e}})[_0x130c('0x17')](function(_0x1df0a6){_0x478680=_0x1df0a6;return Promise[_0x130c('0x18')](_0x478680['map'](function(_0x2d83e8){return _0x2d83e8['ifTime'](_0x556d9a);}));})[_0x130c('0x17')](function(_0x32b09c){var _0x38238f=_0x32b09c[_0x130c('0x19')](function(_0x2bed03,_0x4c303a){return _0x2bed03||_0x4c303a;},![]);logger[_0x130c('0xd')](util[_0x130c('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x478680['map'](function(_0x2dde6c){return _0x2dde6c['name'];})['join'](',\x20'),_0x478680[_0x130c('0xb')](function(_0x4e5c14){return _0x4e5c14['id'];})['join'](',\x20')));return _0x38238f;});}function checkSingleInterval(_0x2c8f23,_0x4f0acc){return db[_0x130c('0x15')][_0x130c('0x1b')](_0x2c8f23)['then'](function(_0x514308){if(_0x514308){logger['info'](util['format'](_0x130c('0x1c'),_0x514308[_0x130c('0x1d')],_0x514308['id']));return _0x514308['ifTime'](_0x4f0acc);}});}exports['IntervalIftime']=function(_0x1f2330){var _0x473885=_0x1f2330[_0x130c('0x1e')];var _0x35f9f3=Array[_0x130c('0x1f')](_0x1f2330[_0x130c('0x20')])?_0x1f2330[_0x130c('0x20')]:typeof _0x1f2330[_0x130c('0x20')]==='string'?[_0x1f2330[_0x130c('0x20')]]:[];var _0x5dbc2d=_0x1f2330['timezone']||undefined;var _0x485ed5=![];if(_0x35f9f3[_0x130c('0x21')]){logger[_0x130c('0xd')](util[_0x130c('0x1a')](_0x130c('0x22'),_0x35f9f3[_0x130c('0x23')](';\x20')));}if(_0x5dbc2d){logger[_0x130c('0xd')](util[_0x130c('0x1a')](_0x130c('0x24'),_0x5dbc2d));}logger[_0x130c('0xf')]('Iftime',_0x485ed5);logger['silly'](_0x130c('0x25'),_0x1f2330);return Promise[_0x130c('0x26')]()[_0x130c('0x17')](function(){if(Array[_0x130c('0x1f')](_0x473885)){return checkArrayOfIntervals(_0x473885,_0x5dbc2d);}else if(_0x473885){return checkSingleInterval(_0x473885,_0x5dbc2d);}})[_0x130c('0x17')](function(_0x100550){var _0x72a1ac=_0x35f9f3[_0x130c('0x19')](function(_0x50b1ef,_0x4c4f8c){return _0x50b1ef||iftime(_0x4c4f8c,_0x5dbc2d);},![]);_0x485ed5=_0x100550||_0x72a1ac;return _0x485ed5;})[_0x130c('0x11')](function(_0x1263de){logger[_0x130c('0x12')]('IntervalIftime',_0x1f2330,_0x1263de);throw this['error'](0x1f4,_0x1263de[_0x130c('0x13')]);});};
\ No newline at end of file
index 9a93eff..0eeafe9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x236ba1,_0x41915a){var _0x479634=function(_0x11c489){while(--_0x11c489){_0x236ba1['push'](_0x236ba1['shift']());}};_0x479634(++_0x41915a);}(_0xadb5,0xad));var _0x5adb=function(_0x2692d9,_0x5a612a){_0x2692d9=_0x2692d9-0x0;var _0x5704a8=_0xadb5[_0x2692d9];return _0x5704a8;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router;
\ No newline at end of file
+var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x4aba15,_0x4e90aa){var _0x1c8122=function(_0x568dba){while(--_0x568dba){_0x4aba15['push'](_0x4aba15['shift']());}};_0x1c8122(++_0x4e90aa);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router;
\ No newline at end of file
index b469d1d..a8cefff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x63b6=['track.xcallymotion.com','POST','application/json','Basic\x20','base64','utf8','data','end','status','statusCode','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','openIssue','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','summary','Report','\x20from\x20','description','stringify','fields','customfield_11500','oldToken','newToken','customfield_11503','name','customfield_11504','customfield_10102'];(function(_0x4e2dae,_0x476a92){var _0x5c2cb7=function(_0x2374bc){while(--_0x2374bc){_0x4e2dae['push'](_0x4e2dae['shift']());}};_0x5c2cb7(++_0x476a92);}(_0x63b6,0x14c));var _0x663b=function(_0x48ada8,_0x578d35){_0x48ada8=_0x48ada8-0x0;var _0x178ad1=_0x63b6[_0x48ada8];return _0x178ad1;};'use strict';var BPromise=require(_0x663b('0x0'));var https=require(_0x663b('0x1'));var logger=require(_0x663b('0x2'))(_0x663b('0x3'));var USERNAME=_0x663b('0x4');var PASSWORD=_0x663b('0x5');function openIssue(_0x57e091,_0x481f60){var _0x19d576={'fields':{'project':{'key':_0x57e091['key']||'MOTGUI'},'summary':(_0x57e091[_0x663b('0x6')]||_0x663b('0x7'))+_0x663b('0x8')+_0x57e091['ip'],'description':_0x57e091[_0x663b('0x9')]||JSON[_0x663b('0xa')](_0x57e091),'issuetype':{'name':_0x57e091['issuetype']||'Bug'}}};_0x19d576[_0x663b('0xb')][_0x663b('0xc')]=_0x57e091['email'];_0x19d576[_0x663b('0xb')]['customfield_11501']=_0x57e091[_0x663b('0xd')];_0x19d576[_0x663b('0xb')]['customfield_11502']=_0x57e091[_0x663b('0xe')];_0x19d576[_0x663b('0xb')][_0x663b('0xf')]=_0x57e091[_0x663b('0x10')];_0x19d576[_0x663b('0xb')][_0x663b('0x11')]=_0x57e091['reason'];_0x19d576[_0x663b('0xb')][_0x663b('0x12')]=_0x57e091['ip'];var _0x15bc4e={'host':_0x663b('0x13'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0x663b('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0x663b('0x15'),'Authorization':_0x663b('0x16')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x663b('0x17'))}};var _0xa086da=JSON[_0x663b('0xa')](_0x19d576);var _0x4e5d73=https['request'](_0x15bc4e,function(_0x555c8b){_0x555c8b['setEncoding'](_0x663b('0x18'));var _0x38c8cc='';_0x555c8b['on'](_0x663b('0x19'),function(_0x10e3e8){_0x38c8cc+=_0x10e3e8;});_0x555c8b['on'](_0x663b('0x1a'),function(){if(_0x481f60){return _0x481f60[_0x663b('0x1b')](_0x555c8b[_0x663b('0x1c')])['json'](JSON[_0x663b('0x1d')](_0x38c8cc));}});});_0x4e5d73['on'](_0x663b('0x1e'),function(_0x9c241b){if(_0x481f60){return _0x481f60['status'](0x1f4)[_0x663b('0x1f')]({'errors':[{'message':_0x663b('0x20'),'type':'api.jira'}]});}});_0x4e5d73['write'](_0xa086da);_0x4e5d73[_0x663b('0x1a')]();}exports[_0x663b('0x21')]=openIssue;exports['send']=function(_0x570b0e,_0x536740){_0x570b0e['body']['ip']=_0x570b0e[_0x663b('0x22')][_0x663b('0x23')]||_0x570b0e[_0x663b('0x24')][_0x663b('0x25')]||_0x570b0e[_0x663b('0x26')][_0x663b('0x25')]||_0x570b0e[_0x663b('0x24')][_0x663b('0x26')][_0x663b('0x25')];return openIssue(_0x570b0e['body'],_0x536740);};
\ No newline at end of file
+var _0xc510=['base64','request','setEncoding','utf8','end','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','MOTGUI','Report','description','stringify','issuetype','Bug','fields','customfield_11501','oldToken','newToken','name','customfield_11504','reason','/rest/api/2/issue','POST','application/json','toString'];(function(_0x4ef916,_0xb5e076){var _0x22633d=function(_0x1c136a){while(--_0x1c136a){_0x4ef916['push'](_0x4ef916['shift']());}};_0x22633d(++_0xb5e076);}(_0xc510,0xfc));var _0x0c51=function(_0x2c28fb,_0x527fc8){_0x2c28fb=_0x2c28fb-0x0;var _0x141b8c=_0xc510[_0x2c28fb];return _0x141b8c;};'use strict';var BPromise=require(_0x0c51('0x0'));var https=require(_0x0c51('0x1'));var logger=require(_0x0c51('0x2'))(_0x0c51('0x3'));var USERNAME='support';var PASSWORD='3eAmWpBVP0';function openIssue(_0x5b1120,_0x1c7750){var _0x5cdd9f={'fields':{'project':{'key':_0x5b1120['key']||_0x0c51('0x4')},'summary':(_0x5b1120['summary']||_0x0c51('0x5'))+'\x20from\x20'+_0x5b1120['ip'],'description':_0x5b1120[_0x0c51('0x6')]||JSON[_0x0c51('0x7')](_0x5b1120),'issuetype':{'name':_0x5b1120[_0x0c51('0x8')]||_0x0c51('0x9')}}};_0x5cdd9f[_0x0c51('0xa')]['customfield_11500']=_0x5b1120['email'];_0x5cdd9f[_0x0c51('0xa')][_0x0c51('0xb')]=_0x5b1120[_0x0c51('0xc')];_0x5cdd9f['fields']['customfield_11502']=_0x5b1120[_0x0c51('0xd')];_0x5cdd9f[_0x0c51('0xa')]['customfield_11503']=_0x5b1120[_0x0c51('0xe')];_0x5cdd9f[_0x0c51('0xa')][_0x0c51('0xf')]=_0x5b1120[_0x0c51('0x10')];_0x5cdd9f[_0x0c51('0xa')]['customfield_10102']=_0x5b1120['ip'];var _0x127577={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x0c51('0x11'),'method':_0x0c51('0x12'),'timeout':0x4e20,'headers':{'Content-Type':_0x0c51('0x13'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0x0c51('0x14')](_0x0c51('0x15'))}};var _0x1ba66f=JSON[_0x0c51('0x7')](_0x5cdd9f);var _0x37a85c=https[_0x0c51('0x16')](_0x127577,function(_0x120041){_0x120041[_0x0c51('0x17')](_0x0c51('0x18'));var _0x3639fb='';_0x120041['on']('data',function(_0x4b7fb3){_0x3639fb+=_0x4b7fb3;});_0x120041['on'](_0x0c51('0x19'),function(){if(_0x1c7750){return _0x1c7750['status'](_0x120041['statusCode'])[_0x0c51('0x1a')](JSON[_0x0c51('0x1b')](_0x3639fb));}});});_0x37a85c['on'](_0x0c51('0x1c'),function(_0x5129e0){if(_0x1c7750){return _0x1c7750[_0x0c51('0x1d')](0x1f4)[_0x0c51('0x1a')]({'errors':[{'message':_0x0c51('0x1e'),'type':_0x0c51('0x1f')}]});}});_0x37a85c['write'](_0x1ba66f);_0x37a85c[_0x0c51('0x19')]();}exports['openIssue']=openIssue;exports[_0x0c51('0x20')]=function(_0x589029,_0xdcdf5a){_0x589029[_0x0c51('0x21')]['ip']=_0x589029[_0x0c51('0x22')][_0x0c51('0x23')]||_0x589029[_0x0c51('0x24')][_0x0c51('0x25')]||_0x589029[_0x0c51('0x26')][_0x0c51('0x25')]||_0x589029['connection'][_0x0c51('0x26')][_0x0c51('0x25')];return openIssue(_0x589029['body'],_0xdcdf5a);};
\ No newline at end of file
index ec5d1d6..99b02e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf3cd=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','create','put','/:id','update'];(function(_0x2ee9f8,_0x4ca586){var _0x34c88f=function(_0x1af260){while(--_0x1af260){_0x2ee9f8['push'](_0x2ee9f8['shift']());}};_0x34c88f(++_0x4ca586);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0xf3cd[_0x1e2080];return _0x260111;};'use strict';var multer=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var path=require(_0xdf3c('0x2'));var timeout=require(_0xdf3c('0x3'));var express=require(_0xdf3c('0x4'));var router=express[_0xdf3c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xdf3c('0x6'));var interaction=require(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var controller=require('./jscriptyAnswerReport.controller');router[_0xdf3c('0x9')]('/',auth[_0xdf3c('0xa')](),controller[_0xdf3c('0xb')]);router[_0xdf3c('0x9')](_0xdf3c('0xc'),auth[_0xdf3c('0xa')](),controller['describe']);router[_0xdf3c('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0xe')]('/',auth['isAuthenticated'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x10')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller[_0xdf3c('0x12')]);router[_0xdf3c('0x13')](_0xdf3c('0x11'),auth[_0xdf3c('0xa')](),controller['destroy']);module[_0xdf3c('0x14')]=router;
\ No newline at end of file
+var _0x9f62=['../../config/environment','./jscriptyAnswerReport.controller','get','index','/describe','isAuthenticated','describe','post','/:id','delete','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x2a3b3e,_0x415238){var _0x3bb5f6=function(_0x26a88a){while(--_0x26a88a){_0x2a3b3e['push'](_0x2a3b3e['shift']());}};_0x3bb5f6(++_0x415238);}(_0x9f62,0x154));var _0x29f6=function(_0x4c37f6,_0x6cd9d9){_0x4c37f6=_0x4c37f6-0x0;var _0x2c0d38=_0x9f62[_0x4c37f6];return _0x2c0d38;};'use strict';var multer=require('multer');var util=require(_0x29f6('0x0'));var path=require('path');var timeout=require(_0x29f6('0x1'));var express=require(_0x29f6('0x2'));var router=express[_0x29f6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var controller=require(_0x29f6('0x6'));router[_0x29f6('0x7')]('/',auth['isAuthenticated'](),controller[_0x29f6('0x8')]);router[_0x29f6('0x7')](_0x29f6('0x9'),auth[_0x29f6('0xa')](),controller[_0x29f6('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x29f6('0xc')]('/',auth[_0x29f6('0xa')](),controller['create']);router['put'](_0x29f6('0xd'),auth[_0x29f6('0xa')](),controller['update']);router[_0x29f6('0xe')](_0x29f6('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index b6857dc..a2e9b55 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x7a54,0x106));var _0x47a5=function(_0x494e3f,_0x20c7ca){_0x494e3f=_0x494e3f-0x0;var _0x55c523=_0x7a54[_0x494e3f];return _0x55c523;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
+var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x50e82c,_0x34f7a2){_0x50e82c=_0x50e82c-0x0;var _0x5c40b7=_0x7a54[_0x50e82c];return _0x5c40b7;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
index ab3663d..410c27f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16cc=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x16cc,0x120));var _0xc16c=function(_0x1394d7,_0x1937c5){_0x1394d7=_0x1394d7-0x0;var _0x403313=_0x16cc[_0x1394d7];return _0x403313;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc16c('0x0'));var zipdir=require(_0xc16c('0x1'));var jsonpatch=require(_0xc16c('0x2'));var rp=require(_0xc16c('0x3'));var moment=require(_0xc16c('0x4'));var BPromise=require(_0xc16c('0x5'));var Mustache=require(_0xc16c('0x6'));var util=require('util');var path=require(_0xc16c('0x7'));var sox=require(_0xc16c('0x8'));var csv=require(_0xc16c('0x9'));var ejs=require(_0xc16c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc16c('0xb'));var squel=require('squel');var crypto=require(_0xc16c('0xc'));var jsforce=require(_0xc16c('0xd'));var deskjs=require(_0xc16c('0xe'));var toCsv=require(_0xc16c('0x9'));var querystring=require('querystring');var Papa=require(_0xc16c('0xf'));var Redis=require(_0xc16c('0x10'));var authService=require(_0xc16c('0x11'));var qs=require(_0xc16c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc16c('0x13'));var logger=require(_0xc16c('0x14'))(_0xc16c('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc16c('0x16'));var db=require(_0xc16c('0x17'))['db'];function respondWithStatusCode(_0x62b43c,_0x5265f7){_0x5265f7=_0x5265f7||0xcc;return function(_0x4cc531){if(_0x4cc531){return _0x62b43c['sendStatus'](_0x5265f7);}return _0x62b43c[_0xc16c('0x18')](_0x5265f7)[_0xc16c('0x19')]();};}function respondWithResult(_0x440d6e,_0x21d788){_0x21d788=_0x21d788||0xc8;return function(_0xb85faf){if(_0xb85faf){return _0x440d6e[_0xc16c('0x18')](_0x21d788)[_0xc16c('0x1a')](_0xb85faf);}};}function respondWithFilteredResult(_0x32b7cd,_0x200ec0){return function(_0x304303){if(_0x304303){var _0x244e4c=typeof _0x200ec0[_0xc16c('0x1b')]===_0xc16c('0x1c')&&typeof _0x200ec0[_0xc16c('0x1d')]===_0xc16c('0x1c');var _0x5535ee=_0x304303['count'];var _0x9017b2=_0x244e4c?0x0:_0x200ec0[_0xc16c('0x1b')];var _0x300787=_0x244e4c?_0x304303[_0xc16c('0x1e')]:_0x200ec0[_0xc16c('0x1b')]+_0x200ec0[_0xc16c('0x1d')];var _0x6cf644;if(_0x300787>=_0x5535ee){_0x300787=_0x5535ee;_0x6cf644=0xc8;}else{_0x6cf644=0xce;}_0x32b7cd[_0xc16c('0x18')](_0x6cf644);return _0x32b7cd['set'](_0xc16c('0x1f'),_0x9017b2+'-'+_0x300787+'/'+_0x5535ee)[_0xc16c('0x1a')](_0x304303);}return null;};}function patchUpdates(_0x121da2){return function(_0x290e9){try{jsonpatch[_0xc16c('0x20')](_0x290e9,_0x121da2,!![]);}catch(_0x13284f){return BPromise[_0xc16c('0x21')](_0x13284f);}return _0x290e9[_0xc16c('0x22')]();};}function saveUpdates(_0x41f7c3,_0x4112d3){return function(_0x1650c0){if(_0x1650c0){return _0x1650c0[_0xc16c('0x23')](_0x41f7c3)[_0xc16c('0x24')](function(_0x3a8b0f){return _0x3a8b0f;});}return null;};}function removeEntity(_0x2d6727,_0x534a87){return function(_0x565d36){if(_0x565d36){return _0x565d36[_0xc16c('0x25')]()['then'](function(){_0x2d6727[_0xc16c('0x18')](0xcc)[_0xc16c('0x19')]();});}};}function handleEntityNotFound(_0x5a09bf,_0x2643b5){return function(_0x4eb194){if(!_0x4eb194){_0x5a09bf[_0xc16c('0x26')](0x194);}return _0x4eb194;};}function handleError(_0x1103ae,_0x5c57d4){_0x5c57d4=_0x5c57d4||0x1f4;return function(_0xf41dcf){logger[_0xc16c('0x27')](_0xf41dcf[_0xc16c('0x28')]);if(_0xf41dcf['name']){delete _0xf41dcf[_0xc16c('0x29')];}_0x1103ae[_0xc16c('0x18')](_0x5c57d4)['send'](_0xf41dcf);};}exports[_0xc16c('0x2a')]=function(_0x1457d4,_0x4c25c7){var _0x558d79={},_0x2185dc={},_0x4dd804={'count':0x0,'rows':[]};var _0x3a500e=_[_0xc16c('0x2b')](db[_0xc16c('0x2c')]['rawAttributes'],function(_0x1fb298){return{'name':_0x1fb298[_0xc16c('0x2d')],'type':_0x1fb298[_0xc16c('0x2e')][_0xc16c('0x2f')]};});_0x2185dc[_0xc16c('0x30')]=_[_0xc16c('0x2b')](_0x3a500e,_0xc16c('0x29'));_0x2185dc[_0xc16c('0x31')]=_[_0xc16c('0x32')](_0x1457d4[_0xc16c('0x31')]);_0x2185dc[_0xc16c('0x33')]=_[_0xc16c('0x34')](_0x2185dc[_0xc16c('0x30')],_0x2185dc[_0xc16c('0x31')]);_0x558d79['attributes']=_[_0xc16c('0x34')](_0x2185dc[_0xc16c('0x30')],qs[_0xc16c('0x35')](_0x1457d4['query']['fields']));_0x558d79['attributes']=_0x558d79[_0xc16c('0x36')][_0xc16c('0x37')]?_0x558d79[_0xc16c('0x36')]:_0x2185dc[_0xc16c('0x30')];if(!_0x1457d4[_0xc16c('0x31')][_0xc16c('0x38')](_0xc16c('0x39'))){_0x558d79[_0xc16c('0x1d')]=qs[_0xc16c('0x1d')](_0x1457d4['query']['limit']);_0x558d79[_0xc16c('0x1b')]=qs[_0xc16c('0x1b')](_0x1457d4[_0xc16c('0x31')][_0xc16c('0x1b')]);}_0x558d79[_0xc16c('0x3a')]=qs[_0xc16c('0x3b')](_0x1457d4['query'][_0xc16c('0x3b')]);_0x558d79[_0xc16c('0x3c')]=qs[_0xc16c('0x33')](_[_0xc16c('0x3d')](_0x1457d4['query'],_0x2185dc[_0xc16c('0x33')]),_0x3a500e);if(_0x1457d4[_0xc16c('0x31')][_0xc16c('0x3e')]){_0x558d79[_0xc16c('0x3c')]=_[_0xc16c('0x3f')](_0x558d79[_0xc16c('0x3c')],{'$or':_['map'](_0x3a500e,function(_0x1d25a8){if(_0x1d25a8[_0xc16c('0x2e')]!==_0xc16c('0x40')){var _0x3e28d7={};_0x3e28d7[_0x1d25a8[_0xc16c('0x29')]]={'$like':'%'+_0x1457d4[_0xc16c('0x31')][_0xc16c('0x3e')]+'%'};return _0x3e28d7;}})});}_0x558d79=_[_0xc16c('0x3f')]({},_0x558d79,_0x1457d4[_0xc16c('0x41')]);var _0x274d87={'where':_0x558d79[_0xc16c('0x3c')]};return db[_0xc16c('0x2c')][_0xc16c('0x1e')](_0x274d87)[_0xc16c('0x24')](function(_0x215056){_0x4dd804[_0xc16c('0x1e')]=_0x215056;if(_0x1457d4[_0xc16c('0x31')][_0xc16c('0x42')]){_0x558d79['include']=[{'all':!![]}];}return db[_0xc16c('0x2c')][_0xc16c('0x43')](_0x558d79);})[_0xc16c('0x24')](function(_0x5ed04c){_0x4dd804[_0xc16c('0x44')]=_0x5ed04c;return _0x4dd804;})[_0xc16c('0x24')](respondWithFilteredResult(_0x4c25c7,_0x558d79))[_0xc16c('0x45')](handleError(_0x4c25c7,null));};exports['show']=function(_0x269185,_0x529a26){var _0xd5f0f9={'raw':!![],'where':{'id':_0x269185[_0xc16c('0x46')]['id']}},_0x2ce604={};_0x2ce604[_0xc16c('0x30')]=_[_0xc16c('0x32')](db[_0xc16c('0x2c')]['rawAttributes']);_0x2ce604[_0xc16c('0x31')]=_['keys'](_0x269185[_0xc16c('0x31')]);_0x2ce604['filters']=_[_0xc16c('0x34')](_0x2ce604['model'],_0x2ce604[_0xc16c('0x31')]);_0xd5f0f9[_0xc16c('0x36')]=_[_0xc16c('0x34')](_0x2ce604['model'],qs[_0xc16c('0x35')](_0x269185[_0xc16c('0x31')][_0xc16c('0x35')]));_0xd5f0f9[_0xc16c('0x36')]=_0xd5f0f9[_0xc16c('0x36')][_0xc16c('0x37')]?_0xd5f0f9[_0xc16c('0x36')]:_0x2ce604['model'];if(_0x269185['query'][_0xc16c('0x42')]){_0xd5f0f9['include']=[{'all':!![]}];}_0xd5f0f9=_[_0xc16c('0x3f')]({},_0xd5f0f9,_0x269185[_0xc16c('0x41')]);return db['JscriptyAnswerReport'][_0xc16c('0x47')](_0xd5f0f9)['then'](handleEntityNotFound(_0x529a26,null))[_0xc16c('0x24')](respondWithResult(_0x529a26,null))[_0xc16c('0x45')](handleError(_0x529a26,null));};exports[_0xc16c('0x48')]=function(_0x1b47d3,_0x378aca){return db[_0xc16c('0x2c')]['create'](_0x1b47d3[_0xc16c('0x49')],{})['then'](respondWithResult(_0x378aca,0xc9))[_0xc16c('0x45')](handleError(_0x378aca,null));};exports['update']=function(_0x4f2f2b,_0x15ff96){if(_0x4f2f2b[_0xc16c('0x49')]['id']){delete _0x4f2f2b['body']['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x4f2f2b['params']['id']}})[_0xc16c('0x24')](handleEntityNotFound(_0x15ff96,null))[_0xc16c('0x24')](saveUpdates(_0x4f2f2b[_0xc16c('0x49')],null))['then'](respondWithResult(_0x15ff96,null))[_0xc16c('0x45')](handleError(_0x15ff96,null));};exports[_0xc16c('0x25')]=function(_0x256eae,_0xe3ce74){return db[_0xc16c('0x2c')]['find']({'where':{'id':_0x256eae[_0xc16c('0x46')]['id']}})['then'](handleEntityNotFound(_0xe3ce74,null))['then'](removeEntity(_0xe3ce74,null))[_0xc16c('0x45')](handleError(_0xe3ce74,null));};exports[_0xc16c('0x4a')]=function(_0x17f4f5,_0x32d9d3){return db[_0xc16c('0x2c')][_0xc16c('0x4a')]()['then'](respondWithResult(_0x32d9d3,null))[_0xc16c('0x45')](handleError(_0x32d9d3,null));};
\ No newline at end of file
+var _0xa751=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','status','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util'];(function(_0x211de7,_0x2e6f69){var _0x2b29e0=function(_0xf2306){while(--_0xf2306){_0x211de7['push'](_0x211de7['shift']());}};_0x2b29e0(++_0x2e6f69);}(_0xa751,0x175));var _0x1a75=function(_0xfe0869,_0xfba371){_0xfe0869=_0xfe0869-0x0;var _0x13f61d=_0xa751[_0xfe0869];return _0x13f61d;};'use strict';var emlformat=require(_0x1a75('0x0'));var rimraf=require(_0x1a75('0x1'));var zipdir=require(_0x1a75('0x2'));var jsonpatch=require(_0x1a75('0x3'));var rp=require('request-promise');var moment=require(_0x1a75('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a75('0x5'));var util=require(_0x1a75('0x6'));var path=require(_0x1a75('0x7'));var sox=require('sox');var csv=require(_0x1a75('0x8'));var ejs=require(_0x1a75('0x9'));var fs=require('fs');var fs_extra=require(_0x1a75('0xa'));var _=require(_0x1a75('0xb'));var squel=require(_0x1a75('0xc'));var crypto=require(_0x1a75('0xd'));var jsforce=require(_0x1a75('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1a75('0xf'));var Redis=require(_0x1a75('0x10'));var authService=require(_0x1a75('0x11'));var qs=require(_0x1a75('0x12'));var as=require(_0x1a75('0x13'));var hardwareService=require(_0x1a75('0x14'));var logger=require(_0x1a75('0x15'))(_0x1a75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1a75('0x17'))['db'];function respondWithStatusCode(_0x24e8dc,_0xae1af0){_0xae1af0=_0xae1af0||0xcc;return function(_0x1220e4){if(_0x1220e4){return _0x24e8dc['sendStatus'](_0xae1af0);}return _0x24e8dc['status'](_0xae1af0)[_0x1a75('0x18')]();};}function respondWithResult(_0xf4a616,_0x48577b){_0x48577b=_0x48577b||0xc8;return function(_0x1c84d3){if(_0x1c84d3){return _0xf4a616[_0x1a75('0x19')](_0x48577b)['json'](_0x1c84d3);}};}function respondWithFilteredResult(_0x1f3c38,_0xb4a245){return function(_0x15a1ec){if(_0x15a1ec){var _0x5883df=typeof _0xb4a245['offset']==='undefined'&&typeof _0xb4a245[_0x1a75('0x1a')]===_0x1a75('0x1b');var _0x2b6f3d=_0x15a1ec[_0x1a75('0x1c')];var _0x1b1af2=_0x5883df?0x0:_0xb4a245[_0x1a75('0x1d')];var _0x47f384=_0x5883df?_0x15a1ec[_0x1a75('0x1c')]:_0xb4a245['offset']+_0xb4a245['limit'];var _0x42df2c;if(_0x47f384>=_0x2b6f3d){_0x47f384=_0x2b6f3d;_0x42df2c=0xc8;}else{_0x42df2c=0xce;}_0x1f3c38[_0x1a75('0x19')](_0x42df2c);return _0x1f3c38['set'](_0x1a75('0x1e'),_0x1b1af2+'-'+_0x47f384+'/'+_0x2b6f3d)['json'](_0x15a1ec);}return null;};}function patchUpdates(_0x4699c9){return function(_0x3e3549){try{jsonpatch[_0x1a75('0x1f')](_0x3e3549,_0x4699c9,!![]);}catch(_0x340750){return BPromise[_0x1a75('0x20')](_0x340750);}return _0x3e3549[_0x1a75('0x21')]();};}function saveUpdates(_0x5a0ad7,_0x3ed5e9){return function(_0x4dc595){if(_0x4dc595){return _0x4dc595[_0x1a75('0x22')](_0x5a0ad7)[_0x1a75('0x23')](function(_0x320413){return _0x320413;});}return null;};}function removeEntity(_0x59e3da,_0x443ff8){return function(_0x5e6617){if(_0x5e6617){return _0x5e6617[_0x1a75('0x24')]()[_0x1a75('0x23')](function(){_0x59e3da[_0x1a75('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9fe9fe,_0x126f40){return function(_0x4dec82){if(!_0x4dec82){_0x9fe9fe[_0x1a75('0x25')](0x194);}return _0x4dec82;};}function handleError(_0x399dae,_0x5a6acc){_0x5a6acc=_0x5a6acc||0x1f4;return function(_0x168e06){logger[_0x1a75('0x26')](_0x168e06[_0x1a75('0x27')]);if(_0x168e06[_0x1a75('0x28')]){delete _0x168e06['name'];}_0x399dae[_0x1a75('0x19')](_0x5a6acc)[_0x1a75('0x29')](_0x168e06);};}exports[_0x1a75('0x2a')]=function(_0x2f5ac9,_0xf33870){var _0x9e66b9={},_0x3b6e1d={},_0x38e885={'count':0x0,'rows':[]};var _0x5518ed=_['map'](db[_0x1a75('0x2b')][_0x1a75('0x2c')],function(_0x1a0359){return{'name':_0x1a0359[_0x1a75('0x2d')],'type':_0x1a0359[_0x1a75('0x2e')][_0x1a75('0x2f')]};});_0x3b6e1d[_0x1a75('0x30')]=_[_0x1a75('0x31')](_0x5518ed,'name');_0x3b6e1d['query']=_['keys'](_0x2f5ac9[_0x1a75('0x32')]);_0x3b6e1d[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x3b6e1d[_0x1a75('0x30')],_0x3b6e1d['query']);_0x9e66b9['attributes']=_['intersection'](_0x3b6e1d[_0x1a75('0x30')],qs[_0x1a75('0x35')](_0x2f5ac9['query']['fields']));_0x9e66b9[_0x1a75('0x36')]=_0x9e66b9['attributes'][_0x1a75('0x37')]?_0x9e66b9[_0x1a75('0x36')]:_0x3b6e1d[_0x1a75('0x30')];if(!_0x2f5ac9['query']['hasOwnProperty'](_0x1a75('0x38'))){_0x9e66b9[_0x1a75('0x1a')]=qs[_0x1a75('0x1a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1a')]);_0x9e66b9[_0x1a75('0x1d')]=qs[_0x1a75('0x1d')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x1d')]);}_0x9e66b9[_0x1a75('0x39')]=qs[_0x1a75('0x3a')](_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3a')]);_0x9e66b9[_0x1a75('0x3b')]=qs[_0x1a75('0x33')](_[_0x1a75('0x3c')](_0x2f5ac9['query'],_0x3b6e1d[_0x1a75('0x33')]),_0x5518ed);if(_0x2f5ac9['query']['filter']){_0x9e66b9[_0x1a75('0x3b')]=_[_0x1a75('0x3d')](_0x9e66b9[_0x1a75('0x3b')],{'$or':_[_0x1a75('0x31')](_0x5518ed,function(_0x2842d4){if(_0x2842d4['type']!==_0x1a75('0x3e')){var _0xc88c40={};_0xc88c40[_0x2842d4[_0x1a75('0x28')]]={'$like':'%'+_0x2f5ac9[_0x1a75('0x32')][_0x1a75('0x3f')]+'%'};return _0xc88c40;}})});}_0x9e66b9=_['merge']({},_0x9e66b9,_0x2f5ac9[_0x1a75('0x40')]);var _0x481bfe={'where':_0x9e66b9[_0x1a75('0x3b')]};return db[_0x1a75('0x2b')][_0x1a75('0x1c')](_0x481bfe)[_0x1a75('0x23')](function(_0x269ed6){_0x38e885[_0x1a75('0x1c')]=_0x269ed6;if(_0x2f5ac9[_0x1a75('0x32')]['includeAll']){_0x9e66b9['include']=[{'all':!![]}];}return db[_0x1a75('0x2b')]['findAll'](_0x9e66b9);})[_0x1a75('0x23')](function(_0x14abcf){_0x38e885[_0x1a75('0x41')]=_0x14abcf;return _0x38e885;})['then'](respondWithFilteredResult(_0xf33870,_0x9e66b9))[_0x1a75('0x42')](handleError(_0xf33870,null));};exports[_0x1a75('0x43')]=function(_0x21bfae,_0x5a2c51){var _0x292cbc={'raw':!![],'where':{'id':_0x21bfae[_0x1a75('0x44')]['id']}},_0x15fe49={};_0x15fe49[_0x1a75('0x30')]=_[_0x1a75('0x45')](db[_0x1a75('0x2b')][_0x1a75('0x2c')]);_0x15fe49['query']=_[_0x1a75('0x45')](_0x21bfae[_0x1a75('0x32')]);_0x15fe49[_0x1a75('0x33')]=_[_0x1a75('0x34')](_0x15fe49[_0x1a75('0x30')],_0x15fe49['query']);_0x292cbc[_0x1a75('0x36')]=_[_0x1a75('0x34')](_0x15fe49['model'],qs[_0x1a75('0x35')](_0x21bfae['query'][_0x1a75('0x35')]));_0x292cbc['attributes']=_0x292cbc[_0x1a75('0x36')][_0x1a75('0x37')]?_0x292cbc[_0x1a75('0x36')]:_0x15fe49[_0x1a75('0x30')];if(_0x21bfae[_0x1a75('0x32')][_0x1a75('0x46')]){_0x292cbc[_0x1a75('0x47')]=[{'all':!![]}];}_0x292cbc=_['merge']({},_0x292cbc,_0x21bfae[_0x1a75('0x40')]);return db['JscriptyAnswerReport'][_0x1a75('0x48')](_0x292cbc)[_0x1a75('0x23')](handleEntityNotFound(_0x5a2c51,null))[_0x1a75('0x23')](respondWithResult(_0x5a2c51,null))[_0x1a75('0x42')](handleError(_0x5a2c51,null));};exports[_0x1a75('0x49')]=function(_0x1bf8a0,_0x2cfacf){return db[_0x1a75('0x2b')]['create'](_0x1bf8a0[_0x1a75('0x4a')],{})[_0x1a75('0x23')](respondWithResult(_0x2cfacf,0xc9))[_0x1a75('0x42')](handleError(_0x2cfacf,null));};exports[_0x1a75('0x22')]=function(_0x385382,_0x1b76d){if(_0x385382[_0x1a75('0x4a')]['id']){delete _0x385382[_0x1a75('0x4a')]['id'];}return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0x385382[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1b76d,null))[_0x1a75('0x23')](saveUpdates(_0x385382[_0x1a75('0x4a')],null))[_0x1a75('0x23')](respondWithResult(_0x1b76d,null))['catch'](handleError(_0x1b76d,null));};exports[_0x1a75('0x24')]=function(_0xa20c25,_0x1ae0cb){return db[_0x1a75('0x2b')][_0x1a75('0x48')]({'where':{'id':_0xa20c25[_0x1a75('0x44')]['id']}})[_0x1a75('0x23')](handleEntityNotFound(_0x1ae0cb,null))[_0x1a75('0x23')](removeEntity(_0x1ae0cb,null))['catch'](handleError(_0x1ae0cb,null));};exports[_0x1a75('0x4b')]=function(_0x5f44e3,_0x40e643){return db[_0x1a75('0x2b')][_0x1a75('0x4b')]()['then'](respondWithResult(_0x40e643,null))['catch'](handleError(_0x40e643,null));};
\ No newline at end of file
index cb9f489..afc341b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98ae=['exports','define','report_jscripty_answers','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2b2c53,_0x4bcf9b){var _0x311ec2=function(_0x4a8e72){while(--_0x4a8e72){_0x2b2c53['push'](_0x2b2c53['shift']());}};_0x311ec2(++_0x4bcf9b);}(_0x98ae,0xc3));var _0xe98a=function(_0x2801ab,_0x4fc7c3){_0x2801ab=_0x2801ab-0x0;var _0x352953=_0x98ae[_0x2801ab];return _0x352953;};'use strict';var _=require(_0xe98a('0x0'));var util=require(_0xe98a('0x1'));var logger=require(_0xe98a('0x2'))('api');var moment=require(_0xe98a('0x3'));var BPromise=require(_0xe98a('0x4'));var rp=require(_0xe98a('0x5'));var fs=require('fs');var path=require(_0xe98a('0x6'));var rimraf=require(_0xe98a('0x7'));var config=require(_0xe98a('0x8'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0xe98a('0x9')]=function(_0x11a868,_0x270fe0){return _0x11a868[_0xe98a('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xe98a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x22c8=['JscriptyAnswerReport','report_jscripty_answers','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x10a7b2,_0x37587c){var _0x5cf00e=function(_0x69b0b9){while(--_0x69b0b9){_0x10a7b2['push'](_0x10a7b2['shift']());}};_0x5cf00e(++_0x37587c);}(_0x22c8,0x178));var _0x822c=function(_0x25c988,_0xce8221){_0x25c988=_0x25c988-0x0;var _0x45fcc2=_0x22c8[_0x25c988];return _0x45fcc2;};'use strict';var _=require(_0x822c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x822c('0x1'));var moment=require(_0x822c('0x2'));var BPromise=require(_0x822c('0x3'));var rp=require(_0x822c('0x4'));var fs=require('fs');var path=require(_0x822c('0x5'));var rimraf=require(_0x822c('0x6'));var config=require(_0x822c('0x7'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x822c('0x8')]=function(_0x3895d9,_0x42e342){return _0x3895d9['define'](_0x822c('0x9'),attributes,{'tableName':_0x822c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 18f2571..73326a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xccbf=['request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','code','JscriptyAnswerReport,\x20%s,\x20%s','error','message','info','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','request','then'];(function(_0x1d64a4,_0x4e52b2){var _0x3c1e7b=function(_0x2941a8){while(--_0x2941a8){_0x1d64a4['push'](_0x1d64a4['shift']());}};_0x3c1e7b(++_0x4e52b2);}(_0xccbf,0xb4));var _0xfccb=function(_0x1ab15e,_0x2ddcaf){_0x1ab15e=_0x1ab15e-0x0;var _0x30b9fa=_0xccbf[_0x1ab15e];return _0x30b9fa;};'use strict';var _=require(_0xfccb('0x0'));var util=require(_0xfccb('0x1'));var moment=require('moment');var BPromise=require(_0xfccb('0x2'));var rs=require(_0xfccb('0x3'));var fs=require('fs');var Redis=require(_0xfccb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfccb('0x5'))(_0xfccb('0x6'));var config=require(_0xfccb('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5c1289,_0x138150,_0x1eef59){return new BPromise(function(_0x285cca,_0x416d03){return client[_0xfccb('0x8')](_0x5c1289,_0x1eef59)[_0xfccb('0x9')](function(_0x431741){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x138150,_0xfccb('0xa'));logger[_0xfccb('0xb')](_0xfccb('0xc'),_0x138150,_0xfccb('0xa'),JSON[_0xfccb('0xd')](_0x431741));if(_0x431741['error']){if(_0x431741['error'][_0xfccb('0xe')]===0x1f4){logger['error'](_0xfccb('0xf'),_0x138150,_0x431741[_0xfccb('0x10')][_0xfccb('0x11')]);return _0x416d03(_0x431741[_0xfccb('0x10')][_0xfccb('0x11')]);}logger[_0xfccb('0x10')](_0xfccb('0xf'),_0x138150,_0x431741['error'][_0xfccb('0x11')]);return _0x285cca(_0x431741[_0xfccb('0x10')]['message']);}else{logger[_0xfccb('0x12')](_0xfccb('0xf'),_0x138150,_0xfccb('0xa'));_0x285cca(_0x431741['result'][_0xfccb('0x11')]);}})['catch'](function(_0x329e72){logger[_0xfccb('0x10')](_0xfccb('0xf'),_0x138150,_0x329e72);_0x416d03(_0x329e72);});});}
\ No newline at end of file
+var _0x2464=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','message','JscriptyAnswerReport,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x22e353,_0xa91666){var _0x50fd8d=function(_0x17072b){while(--_0x17072b){_0x22e353['push'](_0x22e353['shift']());}};_0x50fd8d(++_0xa91666);}(_0x2464,0x1c0));var _0x4246=function(_0x10f463,_0x9f382c){_0x10f463=_0x10f463-0x0;var _0x299e90=_0x2464[_0x10f463];return _0x299e90;};'use strict';var _=require(_0x4246('0x0'));var util=require(_0x4246('0x1'));var moment=require(_0x4246('0x2'));var BPromise=require(_0x4246('0x3'));var rs=require(_0x4246('0x4'));var fs=require('fs');var Redis=require(_0x4246('0x5'));var db=require(_0x4246('0x6'))['db'];var utils=require(_0x4246('0x7'));var logger=require('../../config/logger')(_0x4246('0x8'));var config=require(_0x4246('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4246('0xa')][_0x4246('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23aa5e,_0x5b9e54,_0x26639a){return new BPromise(function(_0x4c59cc,_0x36b825){return client[_0x4246('0xc')](_0x23aa5e,_0x26639a)[_0x4246('0xd')](function(_0x578efd){logger[_0x4246('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b9e54,_0x4246('0xf'));logger[_0x4246('0x10')](_0x4246('0x11'),_0x5b9e54,_0x4246('0xf'),JSON[_0x4246('0x12')](_0x578efd));if(_0x578efd['error']){if(_0x578efd[_0x4246('0x13')]['code']===0x1f4){logger[_0x4246('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b9e54,_0x578efd['error']['message']);return _0x36b825(_0x578efd[_0x4246('0x13')][_0x4246('0x14')]);}logger[_0x4246('0x13')](_0x4246('0x15'),_0x5b9e54,_0x578efd[_0x4246('0x13')][_0x4246('0x14')]);return _0x4c59cc(_0x578efd[_0x4246('0x13')][_0x4246('0x14')]);}else{logger['info'](_0x4246('0x15'),_0x5b9e54,_0x4246('0xf'));_0x4c59cc(_0x578efd[_0x4246('0x16')][_0x4246('0x14')]);}})[_0x4246('0x17')](function(_0x5adae6){logger[_0x4246('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5b9e54,_0x5adae6);_0x36b825(_0x5adae6);});});}
\ No newline at end of file
index 3e55043..3029d71 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2292=['/:id/answers','getAnswers','/:id/summary','create','/:id/clone','put','update','delete','destroy','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','show','/:id/sessions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2292,0xf9));var _0x2229=function(_0x3ccac1,_0x5cc7ea){_0x3ccac1=_0x3ccac1-0x0;var _0x10b20b=_0x2292[_0x3ccac1];return _0x10b20b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2229('0x0'));var express=require(_0x2229('0x1'));var router=express['Router']();var fs_extra=require(_0x2229('0x2'));var auth=require(_0x2229('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2229('0x4'));var controller=require(_0x2229('0x5'));router[_0x2229('0x6')]('/',auth[_0x2229('0x7')](),controller['index']);router[_0x2229('0x6')](_0x2229('0x8'),auth['isAuthenticated'](),controller[_0x2229('0x9')]);router[_0x2229('0x6')](_0x2229('0xa'),auth[_0x2229('0x7')](),controller['getSessions']);router[_0x2229('0x6')](_0x2229('0xb'),auth['isAuthenticated'](),controller[_0x2229('0xc')]);router['get'](_0x2229('0xd'),auth[_0x2229('0x7')](),timeout('30s'),controller['getSummary']);router['post']('/',auth[_0x2229('0x7')](),controller[_0x2229('0xe')]);router['post'](_0x2229('0xf'),auth[_0x2229('0x7')](),controller['clone']);router[_0x2229('0x10')]('/:id',auth[_0x2229('0x7')](),controller[_0x2229('0x11')]);router[_0x2229('0x12')]('/:id',auth[_0x2229('0x7')](),controller[_0x2229('0x13')]);module['exports']=router;
\ No newline at end of file
+var _0x2f6b=['exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy'];(function(_0x1ce575,_0xbcf48f){var _0x20118a=function(_0x2a44e4){while(--_0x2a44e4){_0x1ce575['push'](_0x1ce575['shift']());}};_0x20118a(++_0xbcf48f);}(_0x2f6b,0x151));var _0xb2f6=function(_0x79cd47,_0x16102d){_0x79cd47=_0x79cd47-0x0;var _0x3b9484=_0x2f6b[_0x79cd47];return _0x3b9484;};'use strict';var multer=require(_0xb2f6('0x0'));var util=require('util');var path=require(_0xb2f6('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2f6('0x2'));var router=express[_0xb2f6('0x3')]();var fs_extra=require(_0xb2f6('0x4'));var auth=require(_0xb2f6('0x5'));var interaction=require(_0xb2f6('0x6'));var config=require(_0xb2f6('0x7'));var controller=require(_0xb2f6('0x8'));router[_0xb2f6('0x9')]('/',auth['isAuthenticated'](),controller[_0xb2f6('0xa')]);router[_0xb2f6('0x9')](_0xb2f6('0xb'),auth[_0xb2f6('0xc')](),controller[_0xb2f6('0xd')]);router[_0xb2f6('0x9')](_0xb2f6('0xe'),auth[_0xb2f6('0xc')](),controller[_0xb2f6('0xf')]);router['get']('/:id/answers',auth[_0xb2f6('0xc')](),controller['getAnswers']);router[_0xb2f6('0x9')](_0xb2f6('0x10'),auth[_0xb2f6('0xc')](),timeout(_0xb2f6('0x11')),controller[_0xb2f6('0x12')]);router[_0xb2f6('0x13')]('/',auth[_0xb2f6('0xc')](),controller[_0xb2f6('0x14')]);router[_0xb2f6('0x13')](_0xb2f6('0x15'),auth['isAuthenticated'](),controller[_0xb2f6('0x16')]);router[_0xb2f6('0x17')]('/:id',auth[_0xb2f6('0xc')](),controller[_0xb2f6('0x18')]);router[_0xb2f6('0x19')](_0xb2f6('0xb'),auth[_0xb2f6('0xc')](),controller[_0xb2f6('0x1a')]);module[_0xb2f6('0x1b')]=router;
\ No newline at end of file
index e762685..a6f261e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5de4=['util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x433388,_0x141ce2){var _0x5c742d=function(_0x55df37){while(--_0x55df37){_0x433388['push'](_0x433388['shift']());}};_0x5c742d(++_0x141ce2);}(_0x5de4,0x152));var _0x45de=function(_0x2b96c4,_0x11143f){_0x2b96c4=_0x2b96c4-0x0;var _0x45b3f6=_0x5de4[_0x2b96c4];return _0x45b3f6;};'use strict';var Sequelize=require(_0x45de('0x0'));var _=require(_0x45de('0x1'));var util=require(_0x45de('0x2'));module[_0x45de('0x3')]={'name':{'type':Sequelize[_0x45de('0x4')],'unique':_0x45de('0x5')},'description':{'type':Sequelize[_0x45de('0x4')]},'formData':{'type':Sequelize[_0x45de('0x6')](_0x45de('0x7')),'set':function(_0x32e33d){if(_[_0x45de('0x8')](_0x32e33d)){this[_0x45de('0x9')]('formData',JSON[_0x45de('0xa')](_0x32e33d));}else if(_[_0x45de('0xb')](_0x32e33d)){this[_0x45de('0x9')](_0x45de('0xc'),_0x32e33d);}else{this[_0x45de('0x9')](_0x45de('0xc'),util['format'](_0x45de('0xd'),this[_0x45de('0xe')](_0x45de('0x5'))||'',this['getDataValue'](_0x45de('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x45de('0x10')],'defaultValue':![]}};
\ No newline at end of file
+var _0x6981=['setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long','isObjectLike'];(function(_0x29da9f,_0x3626e2){var _0x293252=function(_0x978302){while(--_0x978302){_0x29da9f['push'](_0x29da9f['shift']());}};_0x293252(++_0x3626e2);}(_0x6981,0x1e4));var _0x1698=function(_0x24e183,_0xc70683){_0x24e183=_0x24e183-0x0;var _0x2e31dc=_0x6981[_0x24e183];return _0x2e31dc;};'use strict';var Sequelize=require(_0x1698('0x0'));var _=require(_0x1698('0x1'));var util=require(_0x1698('0x2'));module[_0x1698('0x3')]={'name':{'type':Sequelize[_0x1698('0x4')],'unique':_0x1698('0x5')},'description':{'type':Sequelize[_0x1698('0x4')]},'formData':{'type':Sequelize[_0x1698('0x6')](_0x1698('0x7')),'set':function(_0x2a5d67){if(_[_0x1698('0x8')](_0x2a5d67)){this[_0x1698('0x9')](_0x1698('0xa'),JSON[_0x1698('0xb')](_0x2a5d67));}else if(_['isString'](_0x2a5d67)){this[_0x1698('0x9')](_0x1698('0xa'),_0x2a5d67);}else{this['setDataValue'](_0x1698('0xa'),util[_0x1698('0xc')](_0x1698('0xd'),this[_0x1698('0xe')](_0x1698('0x5'))||'',this['getDataValue'](_0x1698('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x1698('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index 79b7161..7e38f57 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c1a=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','offset','Content-Range','apply','reject','update','then','destroy','Projects','error','stack','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','clone','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getSessions','JscriptySessionReport','ProjectId','rows','getAnswers','findOne','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','parse','JscriptyQuestionReport','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','hasOwnProperty','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','attachment;\x20filename=','format','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../config/logger','api','../../config/utils'];(function(_0x23490f,_0x456320){var _0x2ec6c6=function(_0x587094){while(--_0x587094){_0x23490f['push'](_0x23490f['shift']());}};_0x2ec6c6(++_0x456320);}(_0x3c1a,0xda));var _0xa3c1=function(_0x1f7413,_0x3388c3){_0x1f7413=_0x1f7413-0x0;var _0x2d2775=_0x3c1a[_0x1f7413];return _0x2d2775;};'use strict';var emlformat=require(_0xa3c1('0x0'));var rimraf=require(_0xa3c1('0x1'));var zipdir=require(_0xa3c1('0x2'));var jsonpatch=require(_0xa3c1('0x3'));var rp=require(_0xa3c1('0x4'));var moment=require(_0xa3c1('0x5'));var BPromise=require(_0xa3c1('0x6'));var Mustache=require('mustache');var util=require(_0xa3c1('0x7'));var path=require('path');var sox=require(_0xa3c1('0x8'));var csv=require(_0xa3c1('0x9'));var ejs=require(_0xa3c1('0xa'));var fs=require('fs');var fs_extra=require(_0xa3c1('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xa3c1('0xc'));var jsforce=require(_0xa3c1('0xd'));var deskjs=require(_0xa3c1('0xe'));var toCsv=require(_0xa3c1('0x9'));var querystring=require(_0xa3c1('0xf'));var Papa=require('papaparse');var Redis=require(_0xa3c1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa3c1('0x11'))(_0xa3c1('0x12'));var utils=require(_0xa3c1('0x13'));var config=require(_0xa3c1('0x14'));var licenseUtil=require(_0xa3c1('0x15'));var db=require(_0xa3c1('0x16'))['db'];function respondWithStatusCode(_0x1ece52,_0x52adac){_0x52adac=_0x52adac||0xcc;return function(_0x2d2499){if(_0x2d2499){return _0x1ece52[_0xa3c1('0x17')](_0x52adac);}return _0x1ece52[_0xa3c1('0x18')](_0x52adac)[_0xa3c1('0x19')]();};}function respondWithResult(_0x17d82a,_0x5af0fa){_0x5af0fa=_0x5af0fa||0xc8;return function(_0x1d3837){if(_0x1d3837){return _0x17d82a['status'](_0x5af0fa)[_0xa3c1('0x1a')](_0x1d3837);}};}function respondWithFilteredResult(_0x344798,_0x53a5df){return function(_0x261ac7){if(_0x261ac7){var _0x19d4d1=typeof _0x53a5df['offset']==='undefined'&&typeof _0x53a5df[_0xa3c1('0x1b')]==='undefined';var _0x1d0077=_0x261ac7['count'];var _0x56e976=_0x19d4d1?0x0:_0x53a5df[_0xa3c1('0x1c')];var _0x4c64f8=_0x19d4d1?_0x261ac7['count']:_0x53a5df[_0xa3c1('0x1c')]+_0x53a5df[_0xa3c1('0x1b')];var _0x4c0b39;if(_0x4c64f8>=_0x1d0077){_0x4c64f8=_0x1d0077;_0x4c0b39=0xc8;}else{_0x4c0b39=0xce;}_0x344798['status'](_0x4c0b39);return _0x344798['set'](_0xa3c1('0x1d'),_0x56e976+'-'+_0x4c64f8+'/'+_0x1d0077)[_0xa3c1('0x1a')](_0x261ac7);}return null;};}function patchUpdates(_0x27e5f3){return function(_0x2f94b8){try{jsonpatch[_0xa3c1('0x1e')](_0x2f94b8,_0x27e5f3,!![]);}catch(_0x50257b){return BPromise[_0xa3c1('0x1f')](_0x50257b);}return _0x2f94b8['save']();};}function saveUpdates(_0x5b8a54,_0x5ec5cf){return function(_0x4f86f7){if(_0x4f86f7){return _0x4f86f7[_0xa3c1('0x20')](_0x5b8a54)[_0xa3c1('0x21')](function(_0x1400e0){return _0x1400e0;});}return null;};}function removeEntity(_0x321ae8,_0x558713){return function(_0x1f04be){if(_0x1f04be){return _0x1f04be[_0xa3c1('0x22')]()[_0xa3c1('0x21')](function(){var _0xe77418=_0x1f04be['get']({'plain':!![]});var _0x4c4b49=_0xa3c1('0x23');return db['UserProfileResource'][_0xa3c1('0x22')]({'where':{'type':_0x4c4b49,'resourceId':_0xe77418['id']}})[_0xa3c1('0x21')](function(){return _0x1f04be;});})[_0xa3c1('0x21')](function(){_0x321ae8[_0xa3c1('0x18')](0xcc)[_0xa3c1('0x19')]();});}};}function handleEntityNotFound(_0x57f1e0,_0x11d226){return function(_0x1680b0){if(!_0x1680b0){_0x57f1e0['sendStatus'](0x194);}return _0x1680b0;};}function handleError(_0x14d229,_0x27d5fc){_0x27d5fc=_0x27d5fc||0x1f4;return function(_0x5dd531){logger[_0xa3c1('0x24')](_0x5dd531[_0xa3c1('0x25')]);if(_0x5dd531[_0xa3c1('0x26')]){delete _0x5dd531[_0xa3c1('0x26')];}_0x14d229[_0xa3c1('0x18')](_0x27d5fc)[_0xa3c1('0x27')](_0x5dd531);};}exports[_0xa3c1('0x28')]=function(_0x172fe7,_0x38fe18){var _0x11526f={},_0x257afe={},_0x15660c={'count':0x0,'rows':[]};var _0x4cde8c=_[_0xa3c1('0x29')](db[_0xa3c1('0x2a')][_0xa3c1('0x2b')],function(_0x3761fc){return{'name':_0x3761fc[_0xa3c1('0x2c')],'type':_0x3761fc[_0xa3c1('0x2d')][_0xa3c1('0x2e')]};});_0x257afe[_0xa3c1('0x2f')]=_[_0xa3c1('0x29')](_0x4cde8c,'name');_0x257afe[_0xa3c1('0x30')]=_[_0xa3c1('0x31')](_0x172fe7[_0xa3c1('0x30')]);_0x257afe[_0xa3c1('0x32')]=_[_0xa3c1('0x33')](_0x257afe[_0xa3c1('0x2f')],_0x257afe[_0xa3c1('0x30')]);_0x11526f[_0xa3c1('0x34')]=_[_0xa3c1('0x33')](_0x257afe[_0xa3c1('0x2f')],qs[_0xa3c1('0x35')](_0x172fe7[_0xa3c1('0x30')][_0xa3c1('0x35')]));_0x11526f['attributes']=_0x11526f[_0xa3c1('0x34')][_0xa3c1('0x36')]?_0x11526f['attributes']:_0x257afe[_0xa3c1('0x2f')];if(!_0x172fe7['query']['hasOwnProperty'](_0xa3c1('0x37'))){_0x11526f[_0xa3c1('0x1b')]=qs['limit'](_0x172fe7[_0xa3c1('0x30')]['limit']);_0x11526f['offset']=qs['offset'](_0x172fe7[_0xa3c1('0x30')]['offset']);}_0x11526f[_0xa3c1('0x38')]=qs[_0xa3c1('0x39')](_0x172fe7['query']['sort']);_0x11526f[_0xa3c1('0x3a')]=qs[_0xa3c1('0x32')](_[_0xa3c1('0x3b')](_0x172fe7['query'],_0x257afe[_0xa3c1('0x32')]),_0x4cde8c);if(_0x172fe7[_0xa3c1('0x30')][_0xa3c1('0x3c')]){_0x11526f[_0xa3c1('0x3a')]=_['merge'](_0x11526f[_0xa3c1('0x3a')],{'$or':_[_0xa3c1('0x29')](_0x4cde8c,function(_0x1300b4){if(_0x1300b4[_0xa3c1('0x2d')]!==_0xa3c1('0x3d')){var _0x107d43={};_0x107d43[_0x1300b4['name']]={'$like':'%'+_0x172fe7[_0xa3c1('0x30')]['filter']+'%'};return _0x107d43;}})});}_0x11526f=_[_0xa3c1('0x3e')]({},_0x11526f,_0x172fe7[_0xa3c1('0x3f')]);var _0x3d94d5={'where':_0x11526f[_0xa3c1('0x3a')]};return db[_0xa3c1('0x2a')][_0xa3c1('0x40')](_0x3d94d5)[_0xa3c1('0x21')](function(_0x4e205a){_0x15660c[_0xa3c1('0x40')]=_0x4e205a;if(_0x172fe7[_0xa3c1('0x30')][_0xa3c1('0x41')]){_0x11526f[_0xa3c1('0x42')]=[{'all':!![]}];}return db[_0xa3c1('0x2a')][_0xa3c1('0x43')](_0x11526f);})[_0xa3c1('0x21')](function(_0x44135a){_0x15660c['rows']=_0x44135a;return _0x15660c;})['then'](respondWithFilteredResult(_0x38fe18,_0x11526f))[_0xa3c1('0x44')](handleError(_0x38fe18,null));};exports[_0xa3c1('0x45')]=function(_0x26955b,_0x1b3c18){var _0x251dbc={'raw':![],'where':{'id':_0x26955b['params']['id']}},_0x9845bf={};_0x9845bf[_0xa3c1('0x2f')]=_[_0xa3c1('0x31')](db[_0xa3c1('0x2a')][_0xa3c1('0x2b')]);_0x9845bf[_0xa3c1('0x30')]=_[_0xa3c1('0x31')](_0x26955b[_0xa3c1('0x30')]);_0x9845bf[_0xa3c1('0x32')]=_[_0xa3c1('0x33')](_0x9845bf[_0xa3c1('0x2f')],_0x9845bf[_0xa3c1('0x30')]);_0x251dbc[_0xa3c1('0x34')]=_[_0xa3c1('0x33')](_0x9845bf[_0xa3c1('0x2f')],qs['fields'](_0x26955b[_0xa3c1('0x30')][_0xa3c1('0x35')]));_0x251dbc[_0xa3c1('0x34')]=_0x251dbc[_0xa3c1('0x34')][_0xa3c1('0x36')]?_0x251dbc[_0xa3c1('0x34')]:_0x9845bf['model'];if(_0x26955b['query']['includeAll']){_0x251dbc['include']=[{'all':!![]}];}_0x251dbc=_[_0xa3c1('0x3e')]({},_0x251dbc,_0x26955b[_0xa3c1('0x3f')]);return db[_0xa3c1('0x2a')][_0xa3c1('0x46')](_0x251dbc)['then'](handleEntityNotFound(_0x1b3c18,null))[_0xa3c1('0x21')](respondWithResult(_0x1b3c18,null))[_0xa3c1('0x44')](handleError(_0x1b3c18,null));};exports[_0xa3c1('0x47')]=function(_0x3c068e,_0x448127){return db[_0xa3c1('0x2a')][_0xa3c1('0x47')](_0x3c068e[_0xa3c1('0x48')],{})[_0xa3c1('0x21')](function(_0xd75821){var _0x39005b=_0x3c068e[_0xa3c1('0x49')][_0xa3c1('0x4a')]({'plain':!![]});if(!_0x39005b)throw new Error(_0xa3c1('0x4b'));if(_0x39005b[_0xa3c1('0x4c')]===_0xa3c1('0x49')){var _0x5d78ef=_0xd75821[_0xa3c1('0x4a')]({'plain':!![]});var _0x1adf35=_0xa3c1('0x23');return db[_0xa3c1('0x4d')][_0xa3c1('0x46')]({'where':{'name':_0x1adf35,'userProfileId':_0x39005b[_0xa3c1('0x4e')]},'raw':!![]})[_0xa3c1('0x21')](function(_0x47ffd3){if(_0x47ffd3&&_0x47ffd3[_0xa3c1('0x4f')]===0x0){return db[_0xa3c1('0x50')][_0xa3c1('0x47')]({'name':_0x5d78ef[_0xa3c1('0x26')],'resourceId':_0x5d78ef['id'],'type':_0x47ffd3[_0xa3c1('0x26')],'sectionId':_0x47ffd3['id']},{})[_0xa3c1('0x21')](function(){return _0xd75821;});}else{return _0xd75821;}})['catch'](function(_0x1e8a29){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e8a29);throw _0x1e8a29;});}return _0xd75821;})[_0xa3c1('0x21')](respondWithResult(_0x448127,0xc9))[_0xa3c1('0x44')](handleError(_0x448127,null));};exports[_0xa3c1('0x51')]=function(_0xdcd002,_0x3a9d4d){var _0x3c38d8={'where':{'id':_0xdcd002['params']['id']}},_0x1a062f={};_0x1a062f[_0xa3c1('0x2f')]=_[_0xa3c1('0x31')](db[_0xa3c1('0x2a')][_0xa3c1('0x2b')]);_0x3c38d8[_0xa3c1('0x34')]=_[_0xa3c1('0x33')](_0x1a062f[_0xa3c1('0x2f')],qs[_0xa3c1('0x35')](_0xdcd002['query'][_0xa3c1('0x35')]));_0x3c38d8[_0xa3c1('0x34')]=_0x3c38d8[_0xa3c1('0x34')][_0xa3c1('0x36')]?_0x3c38d8[_0xa3c1('0x34')]:_0x1a062f[_0xa3c1('0x2f')];if(_0xdcd002['query'][_0xa3c1('0x41')]){_0x3c38d8[_0xa3c1('0x42')]=[{'all':!![]}];}_0x3c38d8=_['merge']({},_0x3c38d8,_0xdcd002[_0xa3c1('0x3f')]);return db['JscriptyProject'][_0xa3c1('0x46')](_0x3c38d8)['then'](handleEntityNotFound(_0x3a9d4d,null))[_0xa3c1('0x21')](function(_0x11e033){if(_0x11e033){var _0x193e9b=_0x11e033[_0xa3c1('0x4a')]({'plain':!![]});_0x193e9b=qs[_0xa3c1('0x52')](_0x193e9b,['id',_0xa3c1('0x53'),_0xa3c1('0x54')]);_0xdcd002['body']=_[_0xa3c1('0x52')](_0xdcd002[_0xa3c1('0x48')],['id',_0xa3c1('0x53'),_0xa3c1('0x54')]);return db[_0xa3c1('0x2a')][_0xa3c1('0x47')](_[_0xa3c1('0x3e')](_0x193e9b,_0xdcd002['body']),{'include':_0xdcd002[_0xa3c1('0x30')][_0xa3c1('0x41')]?[{'all':!![]}]:undefined})[_0xa3c1('0x21')](function(_0x114e13){var _0x1032ba=_0xdcd002[_0xa3c1('0x49')][_0xa3c1('0x4a')]({'plain':!![]});if(!_0x1032ba)throw new Error(_0xa3c1('0x4b'));if(_0x1032ba['role']==='user'){var _0x4075f4=_0x114e13[_0xa3c1('0x4a')]({'plain':!![]});var _0x59cd04='Projects';return db[_0xa3c1('0x4d')][_0xa3c1('0x46')]({'where':{'name':_0x59cd04,'userProfileId':_0x1032ba[_0xa3c1('0x4e')]},'raw':!![]})[_0xa3c1('0x21')](function(_0xf59cf2){if(_0xf59cf2&&_0xf59cf2[_0xa3c1('0x4f')]===0x0){return db['UserProfileResource']['create']({'name':_0x4075f4[_0xa3c1('0x26')],'resourceId':_0x4075f4['id'],'type':_0xf59cf2[_0xa3c1('0x26')],'sectionId':_0xf59cf2['id']},{})[_0xa3c1('0x21')](function(){return _0x114e13;});}else{return _0x114e13;}})[_0xa3c1('0x44')](function(_0x4b0496){logger[_0xa3c1('0x24')](_0xa3c1('0x55'),_0x4b0496);throw _0x4b0496;});}return _0x114e13;});}})[_0xa3c1('0x21')](respondWithResult(_0x3a9d4d,0xc9))[_0xa3c1('0x44')](handleError(_0x3a9d4d,null));};exports[_0xa3c1('0x20')]=function(_0x1ddcb3,_0x481a63){if(_0x1ddcb3[_0xa3c1('0x48')]['id']){delete _0x1ddcb3['body']['id'];}return db['JscriptyProject'][_0xa3c1('0x46')]({'where':{'id':_0x1ddcb3[_0xa3c1('0x56')]['id']}})[_0xa3c1('0x21')](handleEntityNotFound(_0x481a63,null))[_0xa3c1('0x21')](saveUpdates(_0x1ddcb3[_0xa3c1('0x48')],null))[_0xa3c1('0x21')](respondWithResult(_0x481a63,null))[_0xa3c1('0x44')](handleError(_0x481a63,null));};exports[_0xa3c1('0x22')]=function(_0x9a3b35,_0x233994){return db['JscriptyProject'][_0xa3c1('0x46')]({'where':{'id':_0x9a3b35['params']['id']}})[_0xa3c1('0x21')](handleEntityNotFound(_0x233994,null))[_0xa3c1('0x21')](removeEntity(_0x233994,null))[_0xa3c1('0x44')](handleError(_0x233994,null));};exports[_0xa3c1('0x57')]=function(_0x4a9c9b,_0x41a93c,_0x3f5ee2){var _0x12cb20={'raw':!![],'where':{}};var _0x3e8164={};var _0x1e878b={'count':0x0,'rows':[]};return db[_0xa3c1('0x2a')]['findOne']({'where':{'id':_0x4a9c9b[_0xa3c1('0x56')]['id']}})[_0xa3c1('0x21')](handleEntityNotFound(_0x41a93c,null))['then'](function(_0xb83e32){if(_0xb83e32){_0x3e8164[_0xa3c1('0x2f')]=_['keys'](db[_0xa3c1('0x58')]['rawAttributes']);_0x3e8164[_0xa3c1('0x30')]=_['keys'](_0x4a9c9b[_0xa3c1('0x30')]);_0x3e8164[_0xa3c1('0x32')]=_[_0xa3c1('0x33')](_0x3e8164[_0xa3c1('0x2f')],_0x3e8164[_0xa3c1('0x30')]);_0x12cb20['attributes']=_[_0xa3c1('0x33')](_0x3e8164[_0xa3c1('0x2f')],qs[_0xa3c1('0x35')](_0x4a9c9b[_0xa3c1('0x30')][_0xa3c1('0x35')]));_0x12cb20[_0xa3c1('0x34')]=_0x12cb20[_0xa3c1('0x34')]['length']?_0x12cb20[_0xa3c1('0x34')]:_0x3e8164[_0xa3c1('0x2f')];if(!_0x4a9c9b['query']['hasOwnProperty'](_0xa3c1('0x37'))){_0x12cb20[_0xa3c1('0x1b')]=qs['limit'](_0x4a9c9b[_0xa3c1('0x30')][_0xa3c1('0x1b')]);_0x12cb20[_0xa3c1('0x1c')]=qs[_0xa3c1('0x1c')](_0x4a9c9b[_0xa3c1('0x30')][_0xa3c1('0x1c')]);}_0x12cb20['order']=qs['sort'](_0x4a9c9b[_0xa3c1('0x30')][_0xa3c1('0x39')]);_0x12cb20[_0xa3c1('0x3a')]=qs[_0xa3c1('0x32')](_['pick'](_0x4a9c9b['query'],_0x3e8164[_0xa3c1('0x32')]));_0x12cb20[_0xa3c1('0x3a')][_0xa3c1('0x59')]=_0xb83e32['id'];if(_0x4a9c9b[_0xa3c1('0x30')][_0xa3c1('0x3c')]){_0x12cb20[_0xa3c1('0x3a')]=_['merge'](_0x12cb20[_0xa3c1('0x3a')],{'$or':_[_0xa3c1('0x29')](_0x12cb20[_0xa3c1('0x34')],function(_0x438a07){var _0x546d4a={};_0x546d4a[_0x438a07]={'$like':'%'+_0x4a9c9b[_0xa3c1('0x30')][_0xa3c1('0x3c')]+'%'};return _0x546d4a;})});}_0x12cb20=_[_0xa3c1('0x3e')]({},_0x12cb20,_0x4a9c9b[_0xa3c1('0x3f')]);return db[_0xa3c1('0x58')][_0xa3c1('0x40')]({'where':_0x12cb20[_0xa3c1('0x3a')]})[_0xa3c1('0x21')](function(_0x2eb7a1){_0x1e878b[_0xa3c1('0x40')]=_0x2eb7a1;if(_0x4a9c9b[_0xa3c1('0x30')][_0xa3c1('0x41')]){_0x12cb20[_0xa3c1('0x42')]=[{'all':!![]}];}return db[_0xa3c1('0x58')][_0xa3c1('0x43')](_0x12cb20);})[_0xa3c1('0x21')](function(_0x518a9d){_0x1e878b[_0xa3c1('0x5a')]=_0x518a9d;return _0x1e878b;});}})[_0xa3c1('0x21')](respondWithFilteredResult(_0x41a93c,_0x12cb20))['catch'](handleError(_0x41a93c,null));};exports[_0xa3c1('0x5b')]=function(_0x2269f4,_0x23a318,_0xac96f4){var _0x438498={'raw':!![],'where':{}};var _0x17e4c1={};var _0x57ab82={'count':0x0,'rows':[]};return db[_0xa3c1('0x2a')][_0xa3c1('0x5c')]({'where':{'id':_0x2269f4[_0xa3c1('0x56')]['id']}})[_0xa3c1('0x21')](handleEntityNotFound(_0x23a318,null))[_0xa3c1('0x21')](function(_0x388288){if(_0x388288){_0x17e4c1[_0xa3c1('0x2f')]=_[_0xa3c1('0x31')](db['JscriptyAnswerReport'][_0xa3c1('0x2b')]);_0x17e4c1[_0xa3c1('0x30')]=_[_0xa3c1('0x31')](_0x2269f4[_0xa3c1('0x30')]);_0x17e4c1['filters']=_[_0xa3c1('0x33')](_0x17e4c1[_0xa3c1('0x2f')],_0x17e4c1[_0xa3c1('0x30')]);_0x438498[_0xa3c1('0x34')]=_[_0xa3c1('0x33')](_0x17e4c1[_0xa3c1('0x2f')],qs[_0xa3c1('0x35')](_0x2269f4[_0xa3c1('0x30')][_0xa3c1('0x35')]));_0x438498[_0xa3c1('0x34')]=_0x438498[_0xa3c1('0x34')]['length']?_0x438498[_0xa3c1('0x34')]:_0x17e4c1['model'];if(!_0x2269f4[_0xa3c1('0x30')]['hasOwnProperty'](_0xa3c1('0x37'))){_0x438498[_0xa3c1('0x1b')]=qs[_0xa3c1('0x1b')](_0x2269f4[_0xa3c1('0x30')]['limit']);_0x438498['offset']=qs['offset'](_0x2269f4[_0xa3c1('0x30')][_0xa3c1('0x1c')]);}_0x438498['order']=qs[_0xa3c1('0x39')](_0x2269f4[_0xa3c1('0x30')][_0xa3c1('0x39')]);_0x438498[_0xa3c1('0x3a')]=qs[_0xa3c1('0x32')](_[_0xa3c1('0x3b')](_0x2269f4[_0xa3c1('0x30')],_0x17e4c1[_0xa3c1('0x32')]));_0x438498[_0xa3c1('0x3a')][_0xa3c1('0x59')]=_0x388288['id'];if(_0x2269f4['query'][_0xa3c1('0x3c')]){_0x438498[_0xa3c1('0x3a')]=_[_0xa3c1('0x3e')](_0x438498[_0xa3c1('0x3a')],{'$or':_[_0xa3c1('0x29')](_0x438498[_0xa3c1('0x34')],function(_0x3cfc8b){var _0x17c60b={};_0x17c60b[_0x3cfc8b]={'$like':'%'+_0x2269f4[_0xa3c1('0x30')][_0xa3c1('0x3c')]+'%'};return _0x17c60b;})});}_0x438498=_[_0xa3c1('0x3e')]({},_0x438498,_0x2269f4[_0xa3c1('0x3f')]);return db[_0xa3c1('0x5d')][_0xa3c1('0x40')]({'where':_0x438498[_0xa3c1('0x3a')]})[_0xa3c1('0x21')](function(_0x4447db){_0x57ab82['count']=_0x4447db;if(_0x2269f4['query'][_0xa3c1('0x41')]){_0x438498['include']=[{'all':!![]}];}return db[_0xa3c1('0x5d')][_0xa3c1('0x43')](_0x438498);})['then'](function(_0x533bdb){_0x57ab82[_0xa3c1('0x5a')]=_0x533bdb;return _0x57ab82;});}})[_0xa3c1('0x21')](respondWithFilteredResult(_0x23a318,_0x438498))['catch'](handleError(_0x23a318,null));};function char(_0x3bf0f2){return _0xa3c1('0x5e')===typeof _0x3bf0f2?String[_0xa3c1('0x5f')]['apply'](null,arguments):_0x3bf0f2;}function needsEncapsulation(_0x428534){return!!_0x428534&&(_0x428534[_0xa3c1('0x60')]()[_0xa3c1('0x61')](char(0xd))>=0x0||_0x428534[_0xa3c1('0x60')]()['indexOf'](char(0xa))>=0x0||_0x428534[_0xa3c1('0x60')]()[_0xa3c1('0x61')](char(0x2c))>=0x0||_0x428534['toString']()[_0xa3c1('0x61')](char(0x22))>=0x0);}function encapsulate(_0x4665e9){var _0xf5e73a=char(0x22),_0x5bc5ec='\x5c'+char(0x22),_0x145e6e=_0x4665e9[_0xa3c1('0x60')]()[_0xa3c1('0x62')](new RegExp(_0xf5e73a,'g'),_0x5bc5ec);return _0xf5e73a+_0x145e6e+_0xf5e73a;}exports[_0xa3c1('0x63')]=function(_0x572ad6,_0x4be0de,_0x3dd1c1){var _0x216482,_0x86bd6a;var _0x44208e={'where':{'ProjectId':_0x572ad6[_0xa3c1('0x56')]['id']}};if(_0x572ad6['query'][_0xa3c1('0x64')]){_0x44208e[_0xa3c1('0x3a')]['starttime']=JSON[_0xa3c1('0x65')](_0x572ad6[_0xa3c1('0x30')]['startTime']);}return db[_0xa3c1('0x58')][_0xa3c1('0x43')](_0x44208e)[_0xa3c1('0x21')](handleEntityNotFound(_0x4be0de,null))[_0xa3c1('0x21')](function(_0x5ca512){if(_0x5ca512){_0x216482=_0x5ca512;return db[_0xa3c1('0x66')]['findAll']({'where':{'SessionId':{'$in':_[_0xa3c1('0x29')](_0x216482,'id')},'ProjectId':_0x572ad6[_0xa3c1('0x56')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x4be0de,null))[_0xa3c1('0x21')](function(_0x240988){if(_0x240988){_0x86bd6a=_0x240988;var _0x2161da={};for(var _0x22d001=0x0,_0x2fbcfd=_0x86bd6a[_0xa3c1('0x36')];_0x22d001<_0x2fbcfd;_0x22d001++){if(!_0x2161da['hasOwnProperty'](_0x86bd6a[_0x22d001][_0xa3c1('0x67')])){_0x2161da[_0x86bd6a[_0x22d001][_0xa3c1('0x67')]]=needsEncapsulation(_0x86bd6a[_0x22d001][_0xa3c1('0x68')])?encapsulate(_0x86bd6a[_0x22d001][_0xa3c1('0x68')]):_0x86bd6a[_0x22d001]['question'];}}var _0x365769=[],_0x30ab57={};for(var _0x465034=0x0,_0x3b0a64=_0x216482[_0xa3c1('0x36')];_0x465034<_0x3b0a64;_0x465034++){_0x30ab57={'ProjectId':_0x572ad6[_0xa3c1('0x56')]['id'],'SessionId':_0x216482[_0x465034]['id'],'StartTime':moment(_0x216482[_0x465034]['starttime'])['format'](_0xa3c1('0x69'))};for(var _0x155017=0x0,_0x23b9c5=_0x86bd6a[_0xa3c1('0x36')];_0x155017<_0x23b9c5;_0x155017++){if(_0x86bd6a[_0x155017][_0xa3c1('0x6a')]==_0x216482[_0x465034]['id']&&_0x2161da[_0xa3c1('0x6b')](_0x86bd6a[_0x155017]['questionId'])){_0x30ab57[_0x2161da[_0x86bd6a[_0x155017][_0xa3c1('0x67')]]]=_0x86bd6a[_0x155017][_0xa3c1('0x6c')];}}for(var _0x30a090 in _0x2161da){if(!_0x30ab57[_0xa3c1('0x6b')](_0x2161da[_0x30a090])){_0x30ab57[_0x2161da[_0x30a090]]=null;}}_0x365769[_0xa3c1('0x6d')](_0x30ab57);}return _0x365769;}})['then'](function(_0x9c8ee2){if(!_[_0xa3c1('0x6e')](_0x9c8ee2)){var _0x1d16c9=toCsv(_0x9c8ee2);var _0x48964a=Date[_0xa3c1('0x6f')]();fs[_0xa3c1('0x70')](util['format'](_0xa3c1('0x71'),_0x572ad6[_0xa3c1('0x56')]['id'],_0x48964a),_0x1d16c9);_0x4be0de['setHeader']('Content-disposition',_0xa3c1('0x72')+util[_0xa3c1('0x73')](_0xa3c1('0x74'),_0x572ad6[_0xa3c1('0x56')]['id'],_0x48964a));_0x4be0de['setHeader']('Content-type',_0xa3c1('0x75'));return _0x4be0de[_0xa3c1('0x76')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x572ad6[_0xa3c1('0x56')]['id'],_0x48964a));}else{return _0x4be0de[_0xa3c1('0x17')](0xcc);}})[_0xa3c1('0x44')](handleError(_0x4be0de,null));};
\ No newline at end of file
+var _0x1a05=['lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','set','Content-Range','json','apply','reject','then','Projects','UserProfileResource','error','stack','name','send','index','JscriptyProject','rawAttributes','type','key','map','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','catch','show','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getSessions','ProjectId','JscriptySessionReport','rows','getAnswers','findOne','JscriptyAnswerReport','hasOwnProperty','fromCharCode','toString','indexOf','replace','getSummary','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','setHeader','Content-disposition','Content-type','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra'];(function(_0x4e4a88,_0x3b5f23){var _0x482ec6=function(_0x2a4ca7){while(--_0x2a4ca7){_0x4e4a88['push'](_0x4e4a88['shift']());}};_0x482ec6(++_0x3b5f23);}(_0x1a05,0x153));var _0x51a0=function(_0xe1075e,_0x23a2fc){_0xe1075e=_0xe1075e-0x0;var _0x1eba9f=_0x1a05[_0xe1075e];return _0x1eba9f;};'use strict';var emlformat=require(_0x51a0('0x0'));var rimraf=require(_0x51a0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x51a0('0x2'));var rp=require(_0x51a0('0x3'));var moment=require(_0x51a0('0x4'));var BPromise=require(_0x51a0('0x5'));var Mustache=require(_0x51a0('0x6'));var util=require(_0x51a0('0x7'));var path=require(_0x51a0('0x8'));var sox=require(_0x51a0('0x9'));var csv=require(_0x51a0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x51a0('0xb'));var _=require(_0x51a0('0xc'));var squel=require(_0x51a0('0xd'));var crypto=require(_0x51a0('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x51a0('0xf'));var toCsv=require(_0x51a0('0xa'));var querystring=require('querystring');var Papa=require(_0x51a0('0x10'));var Redis=require(_0x51a0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x51a0('0x12'));var as=require(_0x51a0('0x13'));var hardwareService=require(_0x51a0('0x14'));var logger=require(_0x51a0('0x15'))(_0x51a0('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x51a0('0x17'))['db'];function respondWithStatusCode(_0x1c41cf,_0x2870d7){_0x2870d7=_0x2870d7||0xcc;return function(_0x37a682){if(_0x37a682){return _0x1c41cf[_0x51a0('0x18')](_0x2870d7);}return _0x1c41cf['status'](_0x2870d7)[_0x51a0('0x19')]();};}function respondWithResult(_0x522f78,_0x350c6b){_0x350c6b=_0x350c6b||0xc8;return function(_0x29e1ce){if(_0x29e1ce){return _0x522f78['status'](_0x350c6b)['json'](_0x29e1ce);}};}function respondWithFilteredResult(_0x3c1866,_0x29589e){return function(_0x5a6449){if(_0x5a6449){var _0x275e90=typeof _0x29589e['offset']===_0x51a0('0x1a')&&typeof _0x29589e[_0x51a0('0x1b')]===_0x51a0('0x1a');var _0x152553=_0x5a6449[_0x51a0('0x1c')];var _0x31a9e7=_0x275e90?0x0:_0x29589e[_0x51a0('0x1d')];var _0x356aa1=_0x275e90?_0x5a6449[_0x51a0('0x1c')]:_0x29589e[_0x51a0('0x1d')]+_0x29589e[_0x51a0('0x1b')];var _0x5e1bbe;if(_0x356aa1>=_0x152553){_0x356aa1=_0x152553;_0x5e1bbe=0xc8;}else{_0x5e1bbe=0xce;}_0x3c1866[_0x51a0('0x1e')](_0x5e1bbe);return _0x3c1866[_0x51a0('0x1f')](_0x51a0('0x20'),_0x31a9e7+'-'+_0x356aa1+'/'+_0x152553)[_0x51a0('0x21')](_0x5a6449);}return null;};}function patchUpdates(_0x5f06ae){return function(_0x4f2458){try{jsonpatch[_0x51a0('0x22')](_0x4f2458,_0x5f06ae,!![]);}catch(_0x545e20){return BPromise[_0x51a0('0x23')](_0x545e20);}return _0x4f2458['save']();};}function saveUpdates(_0x485e61,_0x2ffba4){return function(_0x5922c7){if(_0x5922c7){return _0x5922c7['update'](_0x485e61)[_0x51a0('0x24')](function(_0x4bd85e){return _0x4bd85e;});}return null;};}function removeEntity(_0x4af6ff,_0x616fbb){return function(_0x5f3c45){if(_0x5f3c45){return _0x5f3c45['destroy']()[_0x51a0('0x24')](function(){var _0x1dbb57=_0x5f3c45['get']({'plain':!![]});var _0x3f6d52=_0x51a0('0x25');return db[_0x51a0('0x26')]['destroy']({'where':{'type':_0x3f6d52,'resourceId':_0x1dbb57['id']}})[_0x51a0('0x24')](function(){return _0x5f3c45;});})[_0x51a0('0x24')](function(){_0x4af6ff[_0x51a0('0x1e')](0xcc)[_0x51a0('0x19')]();});}};}function handleEntityNotFound(_0x4e338b,_0x22b1e0){return function(_0xd56778){if(!_0xd56778){_0x4e338b[_0x51a0('0x18')](0x194);}return _0xd56778;};}function handleError(_0x1de7ba,_0x4defe2){_0x4defe2=_0x4defe2||0x1f4;return function(_0x1f4627){logger[_0x51a0('0x27')](_0x1f4627[_0x51a0('0x28')]);if(_0x1f4627[_0x51a0('0x29')]){delete _0x1f4627[_0x51a0('0x29')];}_0x1de7ba['status'](_0x4defe2)[_0x51a0('0x2a')](_0x1f4627);};}exports[_0x51a0('0x2b')]=function(_0x5eadfb,_0x357850){var _0x4d8141={},_0x11cf4a={},_0x37e85c={'count':0x0,'rows':[]};var _0x47a50a=_['map'](db[_0x51a0('0x2c')][_0x51a0('0x2d')],function(_0x47cc8a){return{'name':_0x47cc8a['fieldName'],'type':_0x47cc8a[_0x51a0('0x2e')][_0x51a0('0x2f')]};});_0x11cf4a['model']=_[_0x51a0('0x30')](_0x47a50a,_0x51a0('0x29'));_0x11cf4a[_0x51a0('0x31')]=_['keys'](_0x5eadfb['query']);_0x11cf4a['filters']=_[_0x51a0('0x32')](_0x11cf4a[_0x51a0('0x33')],_0x11cf4a[_0x51a0('0x31')]);_0x4d8141[_0x51a0('0x34')]=_[_0x51a0('0x32')](_0x11cf4a[_0x51a0('0x33')],qs[_0x51a0('0x35')](_0x5eadfb[_0x51a0('0x31')]['fields']));_0x4d8141[_0x51a0('0x34')]=_0x4d8141[_0x51a0('0x34')][_0x51a0('0x36')]?_0x4d8141[_0x51a0('0x34')]:_0x11cf4a['model'];if(!_0x5eadfb[_0x51a0('0x31')]['hasOwnProperty'](_0x51a0('0x37'))){_0x4d8141[_0x51a0('0x1b')]=qs['limit'](_0x5eadfb[_0x51a0('0x31')][_0x51a0('0x1b')]);_0x4d8141[_0x51a0('0x1d')]=qs[_0x51a0('0x1d')](_0x5eadfb[_0x51a0('0x31')][_0x51a0('0x1d')]);}_0x4d8141[_0x51a0('0x38')]=qs[_0x51a0('0x39')](_0x5eadfb[_0x51a0('0x31')]['sort']);_0x4d8141[_0x51a0('0x3a')]=qs['filters'](_['pick'](_0x5eadfb['query'],_0x11cf4a[_0x51a0('0x3b')]),_0x47a50a);if(_0x5eadfb['query']['filter']){_0x4d8141[_0x51a0('0x3a')]=_[_0x51a0('0x3c')](_0x4d8141[_0x51a0('0x3a')],{'$or':_[_0x51a0('0x30')](_0x47a50a,function(_0x4a3133){if(_0x4a3133[_0x51a0('0x2e')]!==_0x51a0('0x3d')){var _0x46c88c={};_0x46c88c[_0x4a3133[_0x51a0('0x29')]]={'$like':'%'+_0x5eadfb[_0x51a0('0x31')][_0x51a0('0x3e')]+'%'};return _0x46c88c;}})});}_0x4d8141=_['merge']({},_0x4d8141,_0x5eadfb['options']);var _0x3facd9={'where':_0x4d8141[_0x51a0('0x3a')]};return db[_0x51a0('0x2c')][_0x51a0('0x1c')](_0x3facd9)[_0x51a0('0x24')](function(_0x303844){_0x37e85c[_0x51a0('0x1c')]=_0x303844;if(_0x5eadfb[_0x51a0('0x31')][_0x51a0('0x3f')]){_0x4d8141[_0x51a0('0x40')]=[{'all':!![]}];}return db[_0x51a0('0x2c')][_0x51a0('0x41')](_0x4d8141);})['then'](function(_0x251c5a){_0x37e85c['rows']=_0x251c5a;return _0x37e85c;})[_0x51a0('0x24')](respondWithFilteredResult(_0x357850,_0x4d8141))[_0x51a0('0x42')](handleError(_0x357850,null));};exports[_0x51a0('0x43')]=function(_0x17aa2c,_0x2583fa){var _0xb479d8={'raw':![],'where':{'id':_0x17aa2c['params']['id']}},_0x55ed10={};_0x55ed10[_0x51a0('0x33')]=_[_0x51a0('0x44')](db[_0x51a0('0x2c')][_0x51a0('0x2d')]);_0x55ed10[_0x51a0('0x31')]=_[_0x51a0('0x44')](_0x17aa2c[_0x51a0('0x31')]);_0x55ed10[_0x51a0('0x3b')]=_[_0x51a0('0x32')](_0x55ed10[_0x51a0('0x33')],_0x55ed10[_0x51a0('0x31')]);_0xb479d8[_0x51a0('0x34')]=_[_0x51a0('0x32')](_0x55ed10['model'],qs[_0x51a0('0x35')](_0x17aa2c[_0x51a0('0x31')][_0x51a0('0x35')]));_0xb479d8[_0x51a0('0x34')]=_0xb479d8['attributes']['length']?_0xb479d8['attributes']:_0x55ed10[_0x51a0('0x33')];if(_0x17aa2c[_0x51a0('0x31')]['includeAll']){_0xb479d8['include']=[{'all':!![]}];}_0xb479d8=_[_0x51a0('0x3c')]({},_0xb479d8,_0x17aa2c[_0x51a0('0x45')]);return db['JscriptyProject'][_0x51a0('0x46')](_0xb479d8)[_0x51a0('0x24')](handleEntityNotFound(_0x2583fa,null))[_0x51a0('0x24')](respondWithResult(_0x2583fa,null))[_0x51a0('0x42')](handleError(_0x2583fa,null));};exports[_0x51a0('0x47')]=function(_0x5a25ce,_0x10690d){return db[_0x51a0('0x2c')][_0x51a0('0x47')](_0x5a25ce[_0x51a0('0x48')],{})[_0x51a0('0x24')](function(_0x13bcbe){var _0x3d29f2=_0x5a25ce[_0x51a0('0x49')][_0x51a0('0x4a')]({'plain':!![]});if(!_0x3d29f2)throw new Error(_0x51a0('0x4b'));if(_0x3d29f2[_0x51a0('0x4c')]===_0x51a0('0x49')){var _0x3677a6=_0x13bcbe[_0x51a0('0x4a')]({'plain':!![]});var _0xf2c3bc=_0x51a0('0x25');return db[_0x51a0('0x4d')][_0x51a0('0x46')]({'where':{'name':_0xf2c3bc,'userProfileId':_0x3d29f2[_0x51a0('0x4e')]},'raw':!![]})[_0x51a0('0x24')](function(_0x4dcf12){if(_0x4dcf12&&_0x4dcf12[_0x51a0('0x4f')]===0x0){return db[_0x51a0('0x26')][_0x51a0('0x47')]({'name':_0x3677a6[_0x51a0('0x29')],'resourceId':_0x3677a6['id'],'type':_0x4dcf12[_0x51a0('0x29')],'sectionId':_0x4dcf12['id']},{})[_0x51a0('0x24')](function(){return _0x13bcbe;});}else{return _0x13bcbe;}})[_0x51a0('0x42')](function(_0x4b838e){logger[_0x51a0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b838e);throw _0x4b838e;});}return _0x13bcbe;})['then'](respondWithResult(_0x10690d,0xc9))[_0x51a0('0x42')](handleError(_0x10690d,null));};exports['clone']=function(_0x53ab81,_0x48a54b){var _0x25485d={'where':{'id':_0x53ab81[_0x51a0('0x50')]['id']}},_0x11b0a0={};_0x11b0a0[_0x51a0('0x33')]=_[_0x51a0('0x44')](db[_0x51a0('0x2c')][_0x51a0('0x2d')]);_0x25485d['attributes']=_[_0x51a0('0x32')](_0x11b0a0[_0x51a0('0x33')],qs[_0x51a0('0x35')](_0x53ab81[_0x51a0('0x31')][_0x51a0('0x35')]));_0x25485d[_0x51a0('0x34')]=_0x25485d[_0x51a0('0x34')][_0x51a0('0x36')]?_0x25485d['attributes']:_0x11b0a0['model'];if(_0x53ab81['query'][_0x51a0('0x3f')]){_0x25485d['include']=[{'all':!![]}];}_0x25485d=_['merge']({},_0x25485d,_0x53ab81[_0x51a0('0x45')]);return db['JscriptyProject'][_0x51a0('0x46')](_0x25485d)[_0x51a0('0x24')](handleEntityNotFound(_0x48a54b,null))['then'](function(_0x5416bf){if(_0x5416bf){var _0x50b339=_0x5416bf[_0x51a0('0x4a')]({'plain':!![]});_0x50b339=qs[_0x51a0('0x51')](_0x50b339,['id',_0x51a0('0x52'),_0x51a0('0x53')]);_0x53ab81['body']=_[_0x51a0('0x51')](_0x53ab81['body'],['id','createdAt',_0x51a0('0x53')]);return db[_0x51a0('0x2c')][_0x51a0('0x47')](_[_0x51a0('0x3c')](_0x50b339,_0x53ab81['body']),{'include':_0x53ab81[_0x51a0('0x31')]['includeAll']?[{'all':!![]}]:undefined})[_0x51a0('0x24')](function(_0x13d549){var _0xa9cc04=_0x53ab81[_0x51a0('0x49')][_0x51a0('0x4a')]({'plain':!![]});if(!_0xa9cc04)throw new Error(_0x51a0('0x4b'));if(_0xa9cc04[_0x51a0('0x4c')]===_0x51a0('0x49')){var _0x2ef0fd=_0x13d549[_0x51a0('0x4a')]({'plain':!![]});var _0x2b4196=_0x51a0('0x25');return db[_0x51a0('0x4d')]['find']({'where':{'name':_0x2b4196,'userProfileId':_0xa9cc04['userProfileId']},'raw':!![]})[_0x51a0('0x24')](function(_0x52d0a8){if(_0x52d0a8&&_0x52d0a8[_0x51a0('0x4f')]===0x0){return db[_0x51a0('0x26')]['create']({'name':_0x2ef0fd[_0x51a0('0x29')],'resourceId':_0x2ef0fd['id'],'type':_0x52d0a8[_0x51a0('0x29')],'sectionId':_0x52d0a8['id']},{})[_0x51a0('0x24')](function(){return _0x13d549;});}else{return _0x13d549;}})['catch'](function(_0x3660a1){logger[_0x51a0('0x27')](_0x51a0('0x54'),_0x3660a1);throw _0x3660a1;});}return _0x13d549;});}})['then'](respondWithResult(_0x48a54b,0xc9))['catch'](handleError(_0x48a54b,null));};exports[_0x51a0('0x55')]=function(_0x19314c,_0x1e373c){if(_0x19314c[_0x51a0('0x48')]['id']){delete _0x19314c['body']['id'];}return db['JscriptyProject'][_0x51a0('0x46')]({'where':{'id':_0x19314c['params']['id']}})[_0x51a0('0x24')](handleEntityNotFound(_0x1e373c,null))[_0x51a0('0x24')](saveUpdates(_0x19314c[_0x51a0('0x48')],null))['then'](respondWithResult(_0x1e373c,null))['catch'](handleError(_0x1e373c,null));};exports['destroy']=function(_0x58309d,_0xc39008){return db[_0x51a0('0x2c')][_0x51a0('0x46')]({'where':{'id':_0x58309d[_0x51a0('0x50')]['id']}})['then'](handleEntityNotFound(_0xc39008,null))['then'](removeEntity(_0xc39008,null))[_0x51a0('0x42')](handleError(_0xc39008,null));};exports[_0x51a0('0x56')]=function(_0x4479b2,_0x43ac24,_0x480a86){var _0xca9d0a={'raw':!![],'where':{}};var _0x565eab={};var _0x33c17c={'count':0x0,'rows':[]};return db[_0x51a0('0x2c')]['findOne']({'where':{'id':_0x4479b2['params']['id']}})[_0x51a0('0x24')](handleEntityNotFound(_0x43ac24,null))[_0x51a0('0x24')](function(_0x3aad25){if(_0x3aad25){_0x565eab[_0x51a0('0x33')]=_[_0x51a0('0x44')](db['JscriptySessionReport']['rawAttributes']);_0x565eab[_0x51a0('0x31')]=_[_0x51a0('0x44')](_0x4479b2[_0x51a0('0x31')]);_0x565eab[_0x51a0('0x3b')]=_[_0x51a0('0x32')](_0x565eab[_0x51a0('0x33')],_0x565eab[_0x51a0('0x31')]);_0xca9d0a[_0x51a0('0x34')]=_[_0x51a0('0x32')](_0x565eab['model'],qs[_0x51a0('0x35')](_0x4479b2[_0x51a0('0x31')][_0x51a0('0x35')]));_0xca9d0a[_0x51a0('0x34')]=_0xca9d0a['attributes'][_0x51a0('0x36')]?_0xca9d0a[_0x51a0('0x34')]:_0x565eab['model'];if(!_0x4479b2[_0x51a0('0x31')]['hasOwnProperty'](_0x51a0('0x37'))){_0xca9d0a['limit']=qs[_0x51a0('0x1b')](_0x4479b2[_0x51a0('0x31')][_0x51a0('0x1b')]);_0xca9d0a[_0x51a0('0x1d')]=qs[_0x51a0('0x1d')](_0x4479b2[_0x51a0('0x31')][_0x51a0('0x1d')]);}_0xca9d0a[_0x51a0('0x38')]=qs[_0x51a0('0x39')](_0x4479b2[_0x51a0('0x31')][_0x51a0('0x39')]);_0xca9d0a['where']=qs[_0x51a0('0x3b')](_['pick'](_0x4479b2['query'],_0x565eab[_0x51a0('0x3b')]));_0xca9d0a['where'][_0x51a0('0x57')]=_0x3aad25['id'];if(_0x4479b2[_0x51a0('0x31')][_0x51a0('0x3e')]){_0xca9d0a['where']=_[_0x51a0('0x3c')](_0xca9d0a['where'],{'$or':_[_0x51a0('0x30')](_0xca9d0a['attributes'],function(_0x19883d){var _0x909ada={};_0x909ada[_0x19883d]={'$like':'%'+_0x4479b2[_0x51a0('0x31')][_0x51a0('0x3e')]+'%'};return _0x909ada;})});}_0xca9d0a=_[_0x51a0('0x3c')]({},_0xca9d0a,_0x4479b2[_0x51a0('0x45')]);return db['JscriptySessionReport'][_0x51a0('0x1c')]({'where':_0xca9d0a[_0x51a0('0x3a')]})[_0x51a0('0x24')](function(_0x349d8e){_0x33c17c[_0x51a0('0x1c')]=_0x349d8e;if(_0x4479b2[_0x51a0('0x31')][_0x51a0('0x3f')]){_0xca9d0a[_0x51a0('0x40')]=[{'all':!![]}];}return db[_0x51a0('0x58')][_0x51a0('0x41')](_0xca9d0a);})[_0x51a0('0x24')](function(_0x2280b6){_0x33c17c[_0x51a0('0x59')]=_0x2280b6;return _0x33c17c;});}})[_0x51a0('0x24')](respondWithFilteredResult(_0x43ac24,_0xca9d0a))[_0x51a0('0x42')](handleError(_0x43ac24,null));};exports[_0x51a0('0x5a')]=function(_0x3264e4,_0x43bb2b,_0x5f30da){var _0x2d5a6e={'raw':!![],'where':{}};var _0x178a3b={};var _0x3aa43c={'count':0x0,'rows':[]};return db[_0x51a0('0x2c')][_0x51a0('0x5b')]({'where':{'id':_0x3264e4[_0x51a0('0x50')]['id']}})[_0x51a0('0x24')](handleEntityNotFound(_0x43bb2b,null))['then'](function(_0x3a3bca){if(_0x3a3bca){_0x178a3b['model']=_[_0x51a0('0x44')](db[_0x51a0('0x5c')][_0x51a0('0x2d')]);_0x178a3b[_0x51a0('0x31')]=_[_0x51a0('0x44')](_0x3264e4[_0x51a0('0x31')]);_0x178a3b[_0x51a0('0x3b')]=_[_0x51a0('0x32')](_0x178a3b[_0x51a0('0x33')],_0x178a3b[_0x51a0('0x31')]);_0x2d5a6e[_0x51a0('0x34')]=_['intersection'](_0x178a3b[_0x51a0('0x33')],qs[_0x51a0('0x35')](_0x3264e4[_0x51a0('0x31')]['fields']));_0x2d5a6e[_0x51a0('0x34')]=_0x2d5a6e['attributes'][_0x51a0('0x36')]?_0x2d5a6e[_0x51a0('0x34')]:_0x178a3b[_0x51a0('0x33')];if(!_0x3264e4[_0x51a0('0x31')][_0x51a0('0x5d')](_0x51a0('0x37'))){_0x2d5a6e[_0x51a0('0x1b')]=qs[_0x51a0('0x1b')](_0x3264e4[_0x51a0('0x31')]['limit']);_0x2d5a6e[_0x51a0('0x1d')]=qs['offset'](_0x3264e4[_0x51a0('0x31')][_0x51a0('0x1d')]);}_0x2d5a6e[_0x51a0('0x38')]=qs[_0x51a0('0x39')](_0x3264e4[_0x51a0('0x31')][_0x51a0('0x39')]);_0x2d5a6e[_0x51a0('0x3a')]=qs['filters'](_['pick'](_0x3264e4[_0x51a0('0x31')],_0x178a3b['filters']));_0x2d5a6e[_0x51a0('0x3a')]['ProjectId']=_0x3a3bca['id'];if(_0x3264e4['query'][_0x51a0('0x3e')]){_0x2d5a6e[_0x51a0('0x3a')]=_['merge'](_0x2d5a6e[_0x51a0('0x3a')],{'$or':_[_0x51a0('0x30')](_0x2d5a6e[_0x51a0('0x34')],function(_0x242659){var _0x2e0ab2={};_0x2e0ab2[_0x242659]={'$like':'%'+_0x3264e4['query'][_0x51a0('0x3e')]+'%'};return _0x2e0ab2;})});}_0x2d5a6e=_['merge']({},_0x2d5a6e,_0x3264e4[_0x51a0('0x45')]);return db['JscriptyAnswerReport'][_0x51a0('0x1c')]({'where':_0x2d5a6e[_0x51a0('0x3a')]})[_0x51a0('0x24')](function(_0x1dbf83){_0x3aa43c['count']=_0x1dbf83;if(_0x3264e4[_0x51a0('0x31')][_0x51a0('0x3f')]){_0x2d5a6e[_0x51a0('0x40')]=[{'all':!![]}];}return db[_0x51a0('0x5c')]['findAll'](_0x2d5a6e);})['then'](function(_0x4ab238){_0x3aa43c[_0x51a0('0x59')]=_0x4ab238;return _0x3aa43c;});}})[_0x51a0('0x24')](respondWithFilteredResult(_0x43bb2b,_0x2d5a6e))[_0x51a0('0x42')](handleError(_0x43bb2b,null));};function char(_0x5d1ae2){return'number'===typeof _0x5d1ae2?String[_0x51a0('0x5e')][_0x51a0('0x22')](null,arguments):_0x5d1ae2;}function needsEncapsulation(_0x210d61){return!!_0x210d61&&(_0x210d61[_0x51a0('0x5f')]()[_0x51a0('0x60')](char(0xd))>=0x0||_0x210d61[_0x51a0('0x5f')]()[_0x51a0('0x60')](char(0xa))>=0x0||_0x210d61[_0x51a0('0x5f')]()[_0x51a0('0x60')](char(0x2c))>=0x0||_0x210d61[_0x51a0('0x5f')]()[_0x51a0('0x60')](char(0x22))>=0x0);}function encapsulate(_0x5f3031){var _0x938fe9=char(0x22),_0x3ff93e='\x5c'+char(0x22),_0x128ac1=_0x5f3031[_0x51a0('0x5f')]()[_0x51a0('0x61')](new RegExp(_0x938fe9,'g'),_0x3ff93e);return _0x938fe9+_0x128ac1+_0x938fe9;}exports[_0x51a0('0x62')]=function(_0x1efbd7,_0x43703b,_0x46c045){var _0x3fc348,_0x5eb1c4;var _0x1172bf={'where':{'ProjectId':_0x1efbd7[_0x51a0('0x50')]['id']}};if(_0x1efbd7[_0x51a0('0x31')][_0x51a0('0x63')]){_0x1172bf['where']['starttime']=JSON['parse'](_0x1efbd7[_0x51a0('0x31')]['startTime']);}return db[_0x51a0('0x58')][_0x51a0('0x41')](_0x1172bf)[_0x51a0('0x24')](handleEntityNotFound(_0x43703b,null))[_0x51a0('0x24')](function(_0x35e740){if(_0x35e740){_0x3fc348=_0x35e740;return db[_0x51a0('0x64')]['findAll']({'where':{'SessionId':{'$in':_['map'](_0x3fc348,'id')},'ProjectId':_0x1efbd7[_0x51a0('0x50')]['id']},'order':_0x51a0('0x65')});}})['then'](handleEntityNotFound(_0x43703b,null))[_0x51a0('0x24')](function(_0xdbe9c3){if(_0xdbe9c3){_0x5eb1c4=_0xdbe9c3;var _0x52f910={};for(var _0x1985fb=0x0,_0x1c5361=_0x5eb1c4[_0x51a0('0x36')];_0x1985fb<_0x1c5361;_0x1985fb++){if(!_0x52f910[_0x51a0('0x5d')](_0x5eb1c4[_0x1985fb]['questionId'])){_0x52f910[_0x5eb1c4[_0x1985fb][_0x51a0('0x66')]]=needsEncapsulation(_0x5eb1c4[_0x1985fb][_0x51a0('0x67')])?encapsulate(_0x5eb1c4[_0x1985fb]['question']):_0x5eb1c4[_0x1985fb][_0x51a0('0x67')];}}var _0x534b5a=[],_0x5c97c1={};for(var _0x30820d=0x0,_0x1192e4=_0x3fc348[_0x51a0('0x36')];_0x30820d<_0x1192e4;_0x30820d++){_0x5c97c1={'ProjectId':_0x1efbd7[_0x51a0('0x50')]['id'],'SessionId':_0x3fc348[_0x30820d]['id'],'StartTime':moment(_0x3fc348[_0x30820d][_0x51a0('0x68')])[_0x51a0('0x69')](_0x51a0('0x6a'))};for(var _0x549f3b=0x0,_0x16e11d=_0x5eb1c4['length'];_0x549f3b<_0x16e11d;_0x549f3b++){if(_0x5eb1c4[_0x549f3b][_0x51a0('0x6b')]==_0x3fc348[_0x30820d]['id']&&_0x52f910[_0x51a0('0x5d')](_0x5eb1c4[_0x549f3b][_0x51a0('0x66')])){_0x5c97c1[_0x52f910[_0x5eb1c4[_0x549f3b][_0x51a0('0x66')]]]=_0x5eb1c4[_0x549f3b][_0x51a0('0x6c')];}}for(var _0x4e7e92 in _0x52f910){if(!_0x5c97c1[_0x51a0('0x5d')](_0x52f910[_0x4e7e92])){_0x5c97c1[_0x52f910[_0x4e7e92]]=null;}}_0x534b5a[_0x51a0('0x6d')](_0x5c97c1);}return _0x534b5a;}})[_0x51a0('0x24')](function(_0x3c8c16){if(!_[_0x51a0('0x6e')](_0x3c8c16)){var _0xac0009=toCsv(_0x3c8c16);var _0x4fceee=Date[_0x51a0('0x6f')]();fs['writeFileSync'](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1efbd7['params']['id'],_0x4fceee),_0xac0009);_0x43703b[_0x51a0('0x70')](_0x51a0('0x71'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x1efbd7[_0x51a0('0x50')]['id'],_0x4fceee));_0x43703b[_0x51a0('0x70')](_0x51a0('0x72'),'text/csv');return _0x43703b[_0x51a0('0x73')](util[_0x51a0('0x69')](_0x51a0('0x74'),_0x1efbd7[_0x51a0('0x50')]['id'],_0x4fceee));}else{return _0x43703b[_0x51a0('0x18')](0xcc);}})[_0x51a0('0x42')](handleError(_0x43703b,null));};
\ No newline at end of file
index f9ad07a..b345d73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25ad=['JscriptyProject','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define'];(function(_0x47a940,_0x50c7bc){var _0x408cc8=function(_0x3ce7fe){while(--_0x3ce7fe){_0x47a940['push'](_0x47a940['shift']());}};_0x408cc8(++_0x50c7bc);}(_0x25ad,0x1b1));var _0xd25a=function(_0x21a8b7,_0x2c1c49){_0x21a8b7=_0x21a8b7-0x0;var _0xbceb86=_0x25ad[_0x21a8b7];return _0xbceb86;};'use strict';var _=require(_0xd25a('0x0'));var util=require('util');var logger=require(_0xd25a('0x1'))(_0xd25a('0x2'));var moment=require(_0xd25a('0x3'));var BPromise=require('bluebird');var rp=require(_0xd25a('0x4'));var fs=require('fs');var path=require(_0xd25a('0x5'));var rimraf=require(_0xd25a('0x6'));var config=require(_0xd25a('0x7'));var attributes=require(_0xd25a('0x8'));module[_0xd25a('0x9')]=function(_0x544053,_0x4ca0db){return _0x544053[_0xd25a('0xa')](_0xd25a('0xb'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4d61=['./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x19cd5e,_0x79d45d){var _0x21f6be=function(_0x24ea0b){while(--_0x24ea0b){_0x19cd5e['push'](_0x19cd5e['shift']());}};_0x21f6be(++_0x79d45d);}(_0x4d61,0x147));var _0x14d6=function(_0x539cf6,_0x7466a2){_0x539cf6=_0x539cf6-0x0;var _0x4216b8=_0x4d61[_0x539cf6];return _0x4216b8;};'use strict';var _=require(_0x14d6('0x0'));var util=require(_0x14d6('0x1'));var logger=require(_0x14d6('0x2'))(_0x14d6('0x3'));var moment=require(_0x14d6('0x4'));var BPromise=require(_0x14d6('0x5'));var rp=require(_0x14d6('0x6'));var fs=require('fs');var path=require(_0x14d6('0x7'));var rimraf=require(_0x14d6('0x8'));var config=require('../../config/environment');var attributes=require(_0x14d6('0x9'));module[_0x14d6('0xa')]=function(_0x2920fe,_0x11b2c0){return _0x2920fe[_0x14d6('0xb')](_0x14d6('0xc'),attributes,{'tableName':_0x14d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index bd1f6d1..eda34ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbdb7=['request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','JscriptyProject,\x20%s,\x20%s'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x58836f,_0x5351e2){_0x58836f=_0x58836f-0x0;var _0x28f9b1=_0xbdb7[_0x58836f];return _0x28f9b1;};'use strict';var _=require(_0x7bdb('0x0'));var util=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var BPromise=require(_0x7bdb('0x3'));var rs=require(_0x7bdb('0x4'));var fs=require('fs');var Redis=require(_0x7bdb('0x5'));var db=require(_0x7bdb('0x6'))['db'];var utils=require(_0x7bdb('0x7'));var logger=require(_0x7bdb('0x8'))('rpc');var config=require(_0x7bdb('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7bdb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e23a3,_0x493bde,_0x513cba){return new BPromise(function(_0x468041,_0x11a877){return client['request'](_0x1e23a3,_0x513cba)['then'](function(_0xdc2ffc){logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));logger[_0x7bdb('0xe')](_0x7bdb('0xf'),_0x493bde,_0x7bdb('0xd'),JSON[_0x7bdb('0x10')](_0xdc2ffc));if(_0xdc2ffc['error']){if(_0xdc2ffc['error']['code']===0x1f4){logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error'][_0x7bdb('0x12')]);return _0x11a877(_0xdc2ffc['error']['message']);}logger[_0x7bdb('0x11')](_0x7bdb('0xc'),_0x493bde,_0xdc2ffc['error']['message']);return _0x468041(_0xdc2ffc['error'][_0x7bdb('0x12')]);}else{logger[_0x7bdb('0xb')](_0x7bdb('0xc'),_0x493bde,_0x7bdb('0xd'));_0x468041(_0xdc2ffc[_0x7bdb('0x13')][_0x7bdb('0x12')]);}})[_0x7bdb('0x14')](function(_0x1b2d9b){logger['error'](_0x7bdb('0xc'),_0x493bde,_0x1b2d9b);_0x11a877(_0x1b2d9b);});});}
\ No newline at end of file
+var _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x31b53f,_0x26cced){var _0x395050=function(_0x3d5eb9){while(--_0x3d5eb9){_0x31b53f['push'](_0x31b53f['shift']());}};_0x395050(++_0x26cced);}(_0x70e0,0x17b));var _0x070e=function(_0x2cb0d3,_0x5699a8){_0x2cb0d3=_0x2cb0d3-0x0;var _0x2d1a62=_0x70e0[_0x2cb0d3];return _0x2d1a62;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});}
\ No newline at end of file
index 1877a9a..1f44e44 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe7e7=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/describe','describe','/:id','show','create','put','destroy','exports'];(function(_0x18e9a3,_0x276495){var _0x214569=function(_0x16ba45){while(--_0x16ba45){_0x18e9a3['push'](_0x18e9a3['shift']());}};_0x214569(++_0x276495);}(_0xe7e7,0x144));var _0x7e7e=function(_0x34be6a,_0x1eeaa7){_0x34be6a=_0x34be6a-0x0;var _0x2522b7=_0xe7e7[_0x34be6a];return _0x2522b7;};'use strict';var multer=require('multer');var util=require(_0x7e7e('0x0'));var path=require(_0x7e7e('0x1'));var timeout=require(_0x7e7e('0x2'));var express=require(_0x7e7e('0x3'));var router=express[_0x7e7e('0x4')]();var fs_extra=require(_0x7e7e('0x5'));var auth=require(_0x7e7e('0x6'));var interaction=require(_0x7e7e('0x7'));var config=require('../../config/environment');var controller=require('./jscriptyQuestionReport.controller');router['get']('/',auth[_0x7e7e('0x8')](),controller[_0x7e7e('0x9')]);router['get'](_0x7e7e('0xa'),auth['isAuthenticated'](),controller[_0x7e7e('0xb')]);router['get'](_0x7e7e('0xc'),auth[_0x7e7e('0x8')](),controller[_0x7e7e('0xd')]);router['post']('/',auth[_0x7e7e('0x8')](),controller[_0x7e7e('0xe')]);router[_0x7e7e('0xf')](_0x7e7e('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7e7e('0xc'),auth['isAuthenticated'](),controller[_0x7e7e('0x10')]);module[_0x7e7e('0x11')]=router;
\ No newline at end of file
+var _0x6b21=['./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x33b986,_0x40da5f){var _0x4ddaca=function(_0x27cd7a){while(--_0x27cd7a){_0x33b986['push'](_0x33b986['shift']());}};_0x4ddaca(++_0x40da5f);}(_0x6b21,0x156));var _0x16b2=function(_0x4ad947,_0x528c8d){_0x4ad947=_0x4ad947-0x0;var _0x45a249=_0x6b21[_0x4ad947];return _0x45a249;};'use strict';var multer=require(_0x16b2('0x0'));var util=require(_0x16b2('0x1'));var path=require(_0x16b2('0x2'));var timeout=require(_0x16b2('0x3'));var express=require(_0x16b2('0x4'));var router=express[_0x16b2('0x5')]();var fs_extra=require(_0x16b2('0x6'));var auth=require(_0x16b2('0x7'));var interaction=require(_0x16b2('0x8'));var config=require(_0x16b2('0x9'));var controller=require(_0x16b2('0xa'));router[_0x16b2('0xb')]('/',auth[_0x16b2('0xc')](),controller[_0x16b2('0xd')]);router[_0x16b2('0xb')](_0x16b2('0xe'),auth[_0x16b2('0xc')](),controller['describe']);router[_0x16b2('0xb')](_0x16b2('0xf'),auth['isAuthenticated'](),controller[_0x16b2('0x10')]);router[_0x16b2('0x11')]('/',auth['isAuthenticated'](),controller[_0x16b2('0x12')]);router[_0x16b2('0x13')](_0x16b2('0xf'),auth['isAuthenticated'](),controller[_0x16b2('0x14')]);router[_0x16b2('0x15')](_0x16b2('0xf'),auth[_0x16b2('0xc')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 5cb264e..81af524 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x504485,_0x5b93cf){_0x504485=_0x504485-0x0;var _0xa4e31a=_0x7a54[_0x504485];return _0xa4e31a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
+var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x2e4cf6,_0x4fadf4){_0x2e4cf6=_0x2e4cf6-0x0;var _0x5cf41a=_0x7a54[_0x2e4cf6];return _0x5cf41a;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}};
\ No newline at end of file
index d7dfd27..0d9e113 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f63=['include','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','apply','save','update','then','destroy','error','stack','name','send','index','map','JscriptyQuestionReport','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9f63,0x125));var _0x39f6=function(_0x4e7fcd,_0x5eaa94){_0x4e7fcd=_0x4e7fcd-0x0;var _0x1cded2=_0x9f63[_0x4e7fcd];return _0x1cded2;};'use strict';var emlformat=require(_0x39f6('0x0'));var rimraf=require(_0x39f6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x39f6('0x2'));var rp=require(_0x39f6('0x3'));var moment=require(_0x39f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x39f6('0x5'));var util=require(_0x39f6('0x6'));var path=require('path');var sox=require(_0x39f6('0x7'));var csv=require(_0x39f6('0x8'));var ejs=require(_0x39f6('0x9'));var fs=require('fs');var fs_extra=require(_0x39f6('0xa'));var _=require(_0x39f6('0xb'));var squel=require(_0x39f6('0xc'));var crypto=require('crypto');var jsforce=require(_0x39f6('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x39f6('0x8'));var querystring=require(_0x39f6('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x39f6('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x39f6('0x10'))(_0x39f6('0x11'));var utils=require(_0x39f6('0x12'));var config=require(_0x39f6('0x13'));var licenseUtil=require(_0x39f6('0x14'));var db=require(_0x39f6('0x15'))['db'];function respondWithStatusCode(_0x5a1b7e,_0x1cda0b){_0x1cda0b=_0x1cda0b||0xcc;return function(_0x4e274f){if(_0x4e274f){return _0x5a1b7e[_0x39f6('0x16')](_0x1cda0b);}return _0x5a1b7e['status'](_0x1cda0b)[_0x39f6('0x17')]();};}function respondWithResult(_0x61d8f5,_0xc68058){_0xc68058=_0xc68058||0xc8;return function(_0x180706){if(_0x180706){return _0x61d8f5['status'](_0xc68058)[_0x39f6('0x18')](_0x180706);}};}function respondWithFilteredResult(_0x1f428b,_0xd45b29){return function(_0x36fd4b){if(_0x36fd4b){var _0x4f2847=typeof _0xd45b29[_0x39f6('0x19')]===_0x39f6('0x1a')&&typeof _0xd45b29[_0x39f6('0x1b')]===_0x39f6('0x1a');var _0x5b03f4=_0x36fd4b[_0x39f6('0x1c')];var _0x5301b8=_0x4f2847?0x0:_0xd45b29[_0x39f6('0x19')];var _0x5aaa56=_0x4f2847?_0x36fd4b[_0x39f6('0x1c')]:_0xd45b29[_0x39f6('0x19')]+_0xd45b29['limit'];var _0x4e8585;if(_0x5aaa56>=_0x5b03f4){_0x5aaa56=_0x5b03f4;_0x4e8585=0xc8;}else{_0x4e8585=0xce;}_0x1f428b[_0x39f6('0x1d')](_0x4e8585);return _0x1f428b[_0x39f6('0x1e')]('Content-Range',_0x5301b8+'-'+_0x5aaa56+'/'+_0x5b03f4)[_0x39f6('0x18')](_0x36fd4b);}return null;};}function patchUpdates(_0x2371ea){return function(_0x128a2d){try{jsonpatch[_0x39f6('0x1f')](_0x128a2d,_0x2371ea,!![]);}catch(_0x3dd5fd){return BPromise['reject'](_0x3dd5fd);}return _0x128a2d[_0x39f6('0x20')]();};}function saveUpdates(_0xcef244,_0x192c67){return function(_0x154909){if(_0x154909){return _0x154909[_0x39f6('0x21')](_0xcef244)[_0x39f6('0x22')](function(_0x2c5ad1){return _0x2c5ad1;});}return null;};}function removeEntity(_0x38a597,_0x16728e){return function(_0x332274){if(_0x332274){return _0x332274[_0x39f6('0x23')]()['then'](function(){_0x38a597[_0x39f6('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3b737c,_0x15f2c0){return function(_0x33f485){if(!_0x33f485){_0x3b737c[_0x39f6('0x16')](0x194);}return _0x33f485;};}function handleError(_0x472de2,_0x22511c){_0x22511c=_0x22511c||0x1f4;return function(_0x5d4b48){logger[_0x39f6('0x24')](_0x5d4b48[_0x39f6('0x25')]);if(_0x5d4b48[_0x39f6('0x26')]){delete _0x5d4b48[_0x39f6('0x26')];}_0x472de2[_0x39f6('0x1d')](_0x22511c)[_0x39f6('0x27')](_0x5d4b48);};}exports[_0x39f6('0x28')]=function(_0x190381,_0x16035a){var _0x21c2f1={},_0x3ac4e1={},_0x3e5137={'count':0x0,'rows':[]};var _0x46920c=_[_0x39f6('0x29')](db[_0x39f6('0x2a')]['rawAttributes'],function(_0x2ada52){return{'name':_0x2ada52['fieldName'],'type':_0x2ada52[_0x39f6('0x2b')][_0x39f6('0x2c')]};});_0x3ac4e1['model']=_[_0x39f6('0x29')](_0x46920c,_0x39f6('0x26'));_0x3ac4e1[_0x39f6('0x2d')]=_['keys'](_0x190381[_0x39f6('0x2d')]);_0x3ac4e1[_0x39f6('0x2e')]=_['intersection'](_0x3ac4e1['model'],_0x3ac4e1['query']);_0x21c2f1[_0x39f6('0x2f')]=_[_0x39f6('0x30')](_0x3ac4e1[_0x39f6('0x31')],qs[_0x39f6('0x32')](_0x190381[_0x39f6('0x2d')][_0x39f6('0x32')]));_0x21c2f1[_0x39f6('0x2f')]=_0x21c2f1['attributes'][_0x39f6('0x33')]?_0x21c2f1[_0x39f6('0x2f')]:_0x3ac4e1[_0x39f6('0x31')];if(!_0x190381[_0x39f6('0x2d')][_0x39f6('0x34')](_0x39f6('0x35'))){_0x21c2f1[_0x39f6('0x1b')]=qs[_0x39f6('0x1b')](_0x190381[_0x39f6('0x2d')][_0x39f6('0x1b')]);_0x21c2f1['offset']=qs[_0x39f6('0x19')](_0x190381[_0x39f6('0x2d')][_0x39f6('0x19')]);}_0x21c2f1['order']=qs[_0x39f6('0x36')](_0x190381[_0x39f6('0x2d')]['sort']);_0x21c2f1[_0x39f6('0x37')]=qs[_0x39f6('0x2e')](_[_0x39f6('0x38')](_0x190381[_0x39f6('0x2d')],_0x3ac4e1['filters']),_0x46920c);if(_0x190381[_0x39f6('0x2d')][_0x39f6('0x39')]){_0x21c2f1[_0x39f6('0x37')]=_[_0x39f6('0x3a')](_0x21c2f1[_0x39f6('0x37')],{'$or':_['map'](_0x46920c,function(_0x567dff){if(_0x567dff[_0x39f6('0x2b')]!==_0x39f6('0x3b')){var _0x51a311={};_0x51a311[_0x567dff[_0x39f6('0x26')]]={'$like':'%'+_0x190381[_0x39f6('0x2d')][_0x39f6('0x39')]+'%'};return _0x51a311;}})});}_0x21c2f1=_['merge']({},_0x21c2f1,_0x190381[_0x39f6('0x3c')]);var _0x427e4d={'where':_0x21c2f1[_0x39f6('0x37')]};return db[_0x39f6('0x2a')][_0x39f6('0x1c')](_0x427e4d)[_0x39f6('0x22')](function(_0x2f6097){_0x3e5137['count']=_0x2f6097;if(_0x190381[_0x39f6('0x2d')][_0x39f6('0x3d')]){_0x21c2f1['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x39f6('0x3e')](_0x21c2f1);})[_0x39f6('0x22')](function(_0x36a17b){_0x3e5137[_0x39f6('0x3f')]=_0x36a17b;return _0x3e5137;})[_0x39f6('0x22')](respondWithFilteredResult(_0x16035a,_0x21c2f1))[_0x39f6('0x40')](handleError(_0x16035a,null));};exports['show']=function(_0xcc109f,_0x1fa9d2){var _0x8f7ac0={'raw':!![],'where':{'id':_0xcc109f[_0x39f6('0x41')]['id']}},_0x2dc886={};_0x2dc886[_0x39f6('0x31')]=_['keys'](db[_0x39f6('0x2a')]['rawAttributes']);_0x2dc886[_0x39f6('0x2d')]=_[_0x39f6('0x42')](_0xcc109f[_0x39f6('0x2d')]);_0x2dc886[_0x39f6('0x2e')]=_['intersection'](_0x2dc886['model'],_0x2dc886[_0x39f6('0x2d')]);_0x8f7ac0[_0x39f6('0x2f')]=_[_0x39f6('0x30')](_0x2dc886[_0x39f6('0x31')],qs[_0x39f6('0x32')](_0xcc109f['query'][_0x39f6('0x32')]));_0x8f7ac0['attributes']=_0x8f7ac0['attributes'][_0x39f6('0x33')]?_0x8f7ac0[_0x39f6('0x2f')]:_0x2dc886['model'];if(_0xcc109f[_0x39f6('0x2d')]['includeAll']){_0x8f7ac0[_0x39f6('0x43')]=[{'all':!![]}];}_0x8f7ac0=_[_0x39f6('0x3a')]({},_0x8f7ac0,_0xcc109f[_0x39f6('0x3c')]);return db[_0x39f6('0x2a')][_0x39f6('0x44')](_0x8f7ac0)[_0x39f6('0x22')](handleEntityNotFound(_0x1fa9d2,null))['then'](respondWithResult(_0x1fa9d2,null))[_0x39f6('0x40')](handleError(_0x1fa9d2,null));};exports[_0x39f6('0x45')]=function(_0x5ba289,_0x2a4d7a){return db[_0x39f6('0x2a')][_0x39f6('0x45')](_0x5ba289[_0x39f6('0x46')],{})['then'](respondWithResult(_0x2a4d7a,0xc9))['catch'](handleError(_0x2a4d7a,null));};exports[_0x39f6('0x21')]=function(_0x52de7b,_0x1ef637){if(_0x52de7b[_0x39f6('0x46')]['id']){delete _0x52de7b[_0x39f6('0x46')]['id'];}return db[_0x39f6('0x2a')][_0x39f6('0x44')]({'where':{'id':_0x52de7b[_0x39f6('0x41')]['id']}})[_0x39f6('0x22')](handleEntityNotFound(_0x1ef637,null))['then'](saveUpdates(_0x52de7b['body'],null))[_0x39f6('0x22')](respondWithResult(_0x1ef637,null))[_0x39f6('0x40')](handleError(_0x1ef637,null));};exports[_0x39f6('0x23')]=function(_0x14bd8e,_0x266a4e){return db[_0x39f6('0x2a')][_0x39f6('0x44')]({'where':{'id':_0x14bd8e[_0x39f6('0x41')]['id']}})[_0x39f6('0x22')](handleEntityNotFound(_0x266a4e,null))['then'](removeEntity(_0x266a4e,null))[_0x39f6('0x40')](handleError(_0x266a4e,null));};exports['describe']=function(_0x55a27d,_0x21f6f2){return db[_0x39f6('0x2a')][_0x39f6('0x47')]()[_0x39f6('0x22')](respondWithResult(_0x21f6f2,null))[_0x39f6('0x40')](handleError(_0x21f6f2,null));};
\ No newline at end of file
+var _0x2b20=['length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','JscriptyQuestionReport','findAll','rows','show','params','keys','rawAttributes','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','fieldName','model','query','intersection','attributes','fields'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x2b20,0xb3));var _0x02b2=function(_0x885754,_0x1894eb){_0x885754=_0x885754-0x0;var _0x14c93a=_0x2b20[_0x885754];return _0x14c93a;};'use strict';var emlformat=require(_0x02b2('0x0'));var rimraf=require(_0x02b2('0x1'));var zipdir=require(_0x02b2('0x2'));var jsonpatch=require(_0x02b2('0x3'));var rp=require(_0x02b2('0x4'));var moment=require(_0x02b2('0x5'));var BPromise=require(_0x02b2('0x6'));var Mustache=require('mustache');var util=require(_0x02b2('0x7'));var path=require(_0x02b2('0x8'));var sox=require(_0x02b2('0x9'));var csv=require(_0x02b2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x02b2('0xb'));var _=require(_0x02b2('0xc'));var squel=require('squel');var crypto=require(_0x02b2('0xd'));var jsforce=require(_0x02b2('0xe'));var deskjs=require(_0x02b2('0xf'));var toCsv=require('to-csv');var querystring=require(_0x02b2('0x10'));var Papa=require(_0x02b2('0x11'));var Redis=require('ioredis');var authService=require(_0x02b2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x02b2('0x13'));var hardwareService=require(_0x02b2('0x14'));var logger=require(_0x02b2('0x15'))(_0x02b2('0x16'));var utils=require(_0x02b2('0x17'));var config=require(_0x02b2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x02b2('0x19'))['db'];function respondWithStatusCode(_0x1000a8,_0x4282e5){_0x4282e5=_0x4282e5||0xcc;return function(_0x562ccb){if(_0x562ccb){return _0x1000a8[_0x02b2('0x1a')](_0x4282e5);}return _0x1000a8[_0x02b2('0x1b')](_0x4282e5)[_0x02b2('0x1c')]();};}function respondWithResult(_0x523851,_0x264cb2){_0x264cb2=_0x264cb2||0xc8;return function(_0x5209ed){if(_0x5209ed){return _0x523851[_0x02b2('0x1b')](_0x264cb2)['json'](_0x5209ed);}};}function respondWithFilteredResult(_0x2cb9da,_0x2ed8d3){return function(_0x1ca434){if(_0x1ca434){var _0x43bd8a=typeof _0x2ed8d3[_0x02b2('0x1d')]===_0x02b2('0x1e')&&typeof _0x2ed8d3[_0x02b2('0x1f')]===_0x02b2('0x1e');var _0x4f5139=_0x1ca434['count'];var _0x151b68=_0x43bd8a?0x0:_0x2ed8d3['offset'];var _0x249573=_0x43bd8a?_0x1ca434[_0x02b2('0x20')]:_0x2ed8d3[_0x02b2('0x1d')]+_0x2ed8d3[_0x02b2('0x1f')];var _0x3c921a;if(_0x249573>=_0x4f5139){_0x249573=_0x4f5139;_0x3c921a=0xc8;}else{_0x3c921a=0xce;}_0x2cb9da['status'](_0x3c921a);return _0x2cb9da[_0x02b2('0x21')](_0x02b2('0x22'),_0x151b68+'-'+_0x249573+'/'+_0x4f5139)['json'](_0x1ca434);}return null;};}function patchUpdates(_0x23531c){return function(_0x52278f){try{jsonpatch[_0x02b2('0x23')](_0x52278f,_0x23531c,!![]);}catch(_0x5c392d){return BPromise[_0x02b2('0x24')](_0x5c392d);}return _0x52278f[_0x02b2('0x25')]();};}function saveUpdates(_0x368b60,_0x3b9785){return function(_0x573016){if(_0x573016){return _0x573016[_0x02b2('0x26')](_0x368b60)[_0x02b2('0x27')](function(_0x4e05e2){return _0x4e05e2;});}return null;};}function removeEntity(_0x53fd86,_0x1010be){return function(_0x3ee3fa){if(_0x3ee3fa){return _0x3ee3fa[_0x02b2('0x28')]()[_0x02b2('0x27')](function(){_0x53fd86['status'](0xcc)[_0x02b2('0x1c')]();});}};}function handleEntityNotFound(_0xadbb0,_0x56974a){return function(_0x3b311c){if(!_0x3b311c){_0xadbb0[_0x02b2('0x1a')](0x194);}return _0x3b311c;};}function handleError(_0x37f16b,_0x44bbd6){_0x44bbd6=_0x44bbd6||0x1f4;return function(_0x3b6037){logger[_0x02b2('0x29')](_0x3b6037['stack']);if(_0x3b6037[_0x02b2('0x2a')]){delete _0x3b6037[_0x02b2('0x2a')];}_0x37f16b['status'](_0x44bbd6)[_0x02b2('0x2b')](_0x3b6037);};}exports[_0x02b2('0x2c')]=function(_0x23751d,_0x2f7b4d){var _0x46cda6={},_0x3c4a27={},_0x1827f2={'count':0x0,'rows':[]};var _0x4a3b87=_[_0x02b2('0x2d')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x3996e0){return{'name':_0x3996e0[_0x02b2('0x2e')],'type':_0x3996e0['type']['key']};});_0x3c4a27[_0x02b2('0x2f')]=_[_0x02b2('0x2d')](_0x4a3b87,_0x02b2('0x2a'));_0x3c4a27['query']=_['keys'](_0x23751d[_0x02b2('0x30')]);_0x3c4a27['filters']=_[_0x02b2('0x31')](_0x3c4a27[_0x02b2('0x2f')],_0x3c4a27[_0x02b2('0x30')]);_0x46cda6[_0x02b2('0x32')]=_[_0x02b2('0x31')](_0x3c4a27['model'],qs['fields'](_0x23751d['query'][_0x02b2('0x33')]));_0x46cda6[_0x02b2('0x32')]=_0x46cda6['attributes'][_0x02b2('0x34')]?_0x46cda6[_0x02b2('0x32')]:_0x3c4a27[_0x02b2('0x2f')];if(!_0x23751d[_0x02b2('0x30')][_0x02b2('0x35')](_0x02b2('0x36'))){_0x46cda6['limit']=qs[_0x02b2('0x1f')](_0x23751d['query'][_0x02b2('0x1f')]);_0x46cda6[_0x02b2('0x1d')]=qs[_0x02b2('0x1d')](_0x23751d['query']['offset']);}_0x46cda6[_0x02b2('0x37')]=qs[_0x02b2('0x38')](_0x23751d[_0x02b2('0x30')]['sort']);_0x46cda6[_0x02b2('0x39')]=qs[_0x02b2('0x3a')](_[_0x02b2('0x3b')](_0x23751d[_0x02b2('0x30')],_0x3c4a27[_0x02b2('0x3a')]),_0x4a3b87);if(_0x23751d[_0x02b2('0x30')][_0x02b2('0x3c')]){_0x46cda6[_0x02b2('0x39')]=_[_0x02b2('0x3d')](_0x46cda6[_0x02b2('0x39')],{'$or':_[_0x02b2('0x2d')](_0x4a3b87,function(_0x1e700){if(_0x1e700[_0x02b2('0x3e')]!==_0x02b2('0x3f')){var _0x1eac50={};_0x1eac50[_0x1e700[_0x02b2('0x2a')]]={'$like':'%'+_0x23751d[_0x02b2('0x30')]['filter']+'%'};return _0x1eac50;}})});}_0x46cda6=_[_0x02b2('0x3d')]({},_0x46cda6,_0x23751d['options']);var _0x4c2e96={'where':_0x46cda6[_0x02b2('0x39')]};return db[_0x02b2('0x40')][_0x02b2('0x20')](_0x4c2e96)[_0x02b2('0x27')](function(_0x436f57){_0x1827f2['count']=_0x436f57;if(_0x23751d['query']['includeAll']){_0x46cda6['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x02b2('0x41')](_0x46cda6);})['then'](function(_0x44164d){_0x1827f2[_0x02b2('0x42')]=_0x44164d;return _0x1827f2;})['then'](respondWithFilteredResult(_0x2f7b4d,_0x46cda6))['catch'](handleError(_0x2f7b4d,null));};exports[_0x02b2('0x43')]=function(_0x2f0944,_0x1a362f){var _0x65432d={'raw':!![],'where':{'id':_0x2f0944[_0x02b2('0x44')]['id']}},_0x2cae02={};_0x2cae02[_0x02b2('0x2f')]=_[_0x02b2('0x45')](db['JscriptyQuestionReport'][_0x02b2('0x46')]);_0x2cae02['query']=_[_0x02b2('0x45')](_0x2f0944['query']);_0x2cae02[_0x02b2('0x3a')]=_[_0x02b2('0x31')](_0x2cae02['model'],_0x2cae02[_0x02b2('0x30')]);_0x65432d[_0x02b2('0x32')]=_[_0x02b2('0x31')](_0x2cae02[_0x02b2('0x2f')],qs[_0x02b2('0x33')](_0x2f0944[_0x02b2('0x30')]['fields']));_0x65432d['attributes']=_0x65432d[_0x02b2('0x32')][_0x02b2('0x34')]?_0x65432d[_0x02b2('0x32')]:_0x2cae02[_0x02b2('0x2f')];if(_0x2f0944[_0x02b2('0x30')]['includeAll']){_0x65432d['include']=[{'all':!![]}];}_0x65432d=_[_0x02b2('0x3d')]({},_0x65432d,_0x2f0944[_0x02b2('0x47')]);return db[_0x02b2('0x40')][_0x02b2('0x48')](_0x65432d)[_0x02b2('0x27')](handleEntityNotFound(_0x1a362f,null))['then'](respondWithResult(_0x1a362f,null))[_0x02b2('0x49')](handleError(_0x1a362f,null));};exports['create']=function(_0x99e01a,_0x5b4e64){return db['JscriptyQuestionReport'][_0x02b2('0x4a')](_0x99e01a[_0x02b2('0x4b')],{})[_0x02b2('0x27')](respondWithResult(_0x5b4e64,0xc9))[_0x02b2('0x49')](handleError(_0x5b4e64,null));};exports[_0x02b2('0x26')]=function(_0x936a0a,_0x4abf54){if(_0x936a0a[_0x02b2('0x4b')]['id']){delete _0x936a0a[_0x02b2('0x4b')]['id'];}return db[_0x02b2('0x40')]['find']({'where':{'id':_0x936a0a[_0x02b2('0x44')]['id']}})[_0x02b2('0x27')](handleEntityNotFound(_0x4abf54,null))[_0x02b2('0x27')](saveUpdates(_0x936a0a[_0x02b2('0x4b')],null))[_0x02b2('0x27')](respondWithResult(_0x4abf54,null))[_0x02b2('0x49')](handleError(_0x4abf54,null));};exports[_0x02b2('0x28')]=function(_0x13032b,_0x3bbb02){return db[_0x02b2('0x40')][_0x02b2('0x48')]({'where':{'id':_0x13032b['params']['id']}})[_0x02b2('0x27')](handleEntityNotFound(_0x3bbb02,null))[_0x02b2('0x27')](removeEntity(_0x3bbb02,null))[_0x02b2('0x49')](handleError(_0x3bbb02,null));};exports['describe']=function(_0x1009b7,_0x50f1a7){return db['JscriptyQuestionReport'][_0x02b2('0x4c')]()['then'](respondWithResult(_0x50f1a7,null))[_0x02b2('0x49')](handleError(_0x50f1a7,null));};
\ No newline at end of file
index 504cba8..8e48cf9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb0eb=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x5e8c32,_0x1b1f3f){var _0x595f7b=function(_0x38840e){while(--_0x38840e){_0x5e8c32['push'](_0x5e8c32['shift']());}};_0x595f7b(++_0x1b1f3f);}(_0xb0eb,0x1f2));var _0xbb0e=function(_0x367b10,_0x5d1233){_0x367b10=_0x367b10-0x0;var _0x558138=_0xb0eb[_0x367b10];return _0x558138;};'use strict';var _=require(_0xbb0e('0x0'));var util=require(_0xbb0e('0x1'));var logger=require(_0xbb0e('0x2'))('api');var moment=require(_0xbb0e('0x3'));var BPromise=require(_0xbb0e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb0e('0x5'));var rimraf=require(_0xbb0e('0x6'));var config=require(_0xbb0e('0x7'));var attributes=require(_0xbb0e('0x8'));module[_0xbb0e('0x9')]=function(_0x536a56,_0x4e8fc2){return _0x536a56[_0xbb0e('0xa')](_0xbb0e('0xb'),attributes,{'tableName':_0xbb0e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x713b=['bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x713b,0xd9));var _0xb713=function(_0x152678,_0x11e0ac){_0x152678=_0x152678-0x0;var _0x311a9=_0x713b[_0x152678];return _0x311a9;};'use strict';var _=require('lodash');var util=require(_0xb713('0x0'));var logger=require(_0xb713('0x1'))(_0xb713('0x2'));var moment=require(_0xb713('0x3'));var BPromise=require(_0xb713('0x4'));var rp=require(_0xb713('0x5'));var fs=require('fs');var path=require(_0xb713('0x6'));var rimraf=require(_0xb713('0x7'));var config=require(_0xb713('0x8'));var attributes=require(_0xb713('0x9'));module[_0xb713('0xa')]=function(_0x5d37d3,_0x5ecf69){return _0x5d37d3[_0xb713('0xb')](_0xb713('0xc'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 6b31f10..d9fbf2f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa8cc=['result','catch','lodash','util','randomstring','ioredis','../../config/utils','rpc','client','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x27ddbe,_0x3c4317){var _0x169b3b=function(_0x5d07e2){while(--_0x5d07e2){_0x27ddbe['push'](_0x27ddbe['shift']());}};_0x169b3b(++_0x3c4317);}(_0xa8cc,0xe6));var _0xca8c=function(_0x2a5241,_0x5d802f){_0x2a5241=_0x2a5241-0x0;var _0x371ed1=_0xa8cc[_0x2a5241];return _0x371ed1;};'use strict';var _=require(_0xca8c('0x0'));var util=require(_0xca8c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xca8c('0x2'));var fs=require('fs');var Redis=require(_0xca8c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xca8c('0x4'));var logger=require('../../config/logger')(_0xca8c('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xca8c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cad4f,_0x51c15e,_0x5cc4ea){return new BPromise(function(_0x296652,_0xe59df4){return client[_0xca8c('0x7')](_0x3cad4f,_0x5cc4ea)['then'](function(_0x3eaba4){logger[_0xca8c('0x8')](_0xca8c('0x9'),_0x51c15e,_0xca8c('0xa'));logger[_0xca8c('0xb')](_0xca8c('0xc'),_0x51c15e,_0xca8c('0xa'),JSON[_0xca8c('0xd')](_0x3eaba4));if(_0x3eaba4[_0xca8c('0xe')]){if(_0x3eaba4[_0xca8c('0xe')][_0xca8c('0xf')]===0x1f4){logger[_0xca8c('0xe')](_0xca8c('0x9'),_0x51c15e,_0x3eaba4[_0xca8c('0xe')][_0xca8c('0x10')]);return _0xe59df4(_0x3eaba4['error'][_0xca8c('0x10')]);}logger[_0xca8c('0xe')](_0xca8c('0x9'),_0x51c15e,_0x3eaba4['error']['message']);return _0x296652(_0x3eaba4[_0xca8c('0xe')]['message']);}else{logger[_0xca8c('0x8')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x51c15e,_0xca8c('0xa'));_0x296652(_0x3eaba4[_0xca8c('0x11')][_0xca8c('0x10')]);}})[_0xca8c('0x12')](function(_0x167fec){logger[_0xca8c('0xe')](_0xca8c('0x9'),_0x51c15e,_0x167fec);_0xe59df4(_0x167fec);});});}
\ No newline at end of file
+var _0xf411=['then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','../../mysqldb','jayson/promise','http','request'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf411,0x139));var _0x1f41=function(_0x2b7480,_0x46d376){_0x2b7480=_0x2b7480-0x0;var _0x22c70c=_0xf411[_0x2b7480];return _0x22c70c;};'use strict';var _=require(_0x1f41('0x0'));var util=require(_0x1f41('0x1'));var moment=require('moment');var BPromise=require(_0x1f41('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f41('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1f41('0x4'));var client=jayson['client'][_0x1f41('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1c3f30,_0x397c10,_0x1a30ef){return new BPromise(function(_0x4fbef4,_0x54fffd){return client[_0x1f41('0x6')](_0x1c3f30,_0x1a30ef)[_0x1f41('0x7')](function(_0x48ef6b){logger[_0x1f41('0x8')](_0x1f41('0x9'),_0x397c10,_0x1f41('0xa'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x397c10,'request\x20sent',JSON[_0x1f41('0xb')](_0x48ef6b));if(_0x48ef6b[_0x1f41('0xc')]){if(_0x48ef6b[_0x1f41('0xc')]['code']===0x1f4){logger[_0x1f41('0xc')](_0x1f41('0x9'),_0x397c10,_0x48ef6b[_0x1f41('0xc')][_0x1f41('0xd')]);return _0x54fffd(_0x48ef6b[_0x1f41('0xc')][_0x1f41('0xd')]);}logger[_0x1f41('0xc')](_0x1f41('0x9'),_0x397c10,_0x48ef6b[_0x1f41('0xc')]['message']);return _0x4fbef4(_0x48ef6b[_0x1f41('0xc')][_0x1f41('0xd')]);}else{logger[_0x1f41('0x8')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x397c10,'request\x20sent');_0x4fbef4(_0x48ef6b[_0x1f41('0xe')]['message']);}})[_0x1f41('0xf')](function(_0xb81c42){logger[_0x1f41('0xc')](_0x1f41('0x9'),_0x397c10,_0xb81c42);_0x54fffd(_0xb81c42);});});}
\ No newline at end of file
index 1db7659..8d08995 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa867=['post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','show','/:id/questions','getQuestions'];(function(_0x55d9ad,_0x3f05ef){var _0x227611=function(_0xb6e120){while(--_0xb6e120){_0x55d9ad['push'](_0x55d9ad['shift']());}};_0x227611(++_0x3f05ef);}(_0xa867,0x79));var _0x7a86=function(_0x5f3773,_0x2212ae){_0x5f3773=_0x5f3773-0x0;var _0x440894=_0xa867[_0x5f3773];return _0x440894;};'use strict';var multer=require(_0x7a86('0x0'));var util=require(_0x7a86('0x1'));var path=require(_0x7a86('0x2'));var timeout=require(_0x7a86('0x3'));var express=require(_0x7a86('0x4'));var router=express[_0x7a86('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7a86('0x6'));var config=require(_0x7a86('0x7'));var controller=require(_0x7a86('0x8'));router['get']('/',auth[_0x7a86('0x9')](),controller[_0x7a86('0xa')]);router[_0x7a86('0xb')](_0x7a86('0xc'),auth[_0x7a86('0x9')](),controller[_0x7a86('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x7a86('0xe')]);router[_0x7a86('0xb')](_0x7a86('0xf'),auth[_0x7a86('0x9')](),controller[_0x7a86('0x10')]);router[_0x7a86('0x11')]('/',auth[_0x7a86('0x9')](),controller['create']);router[_0x7a86('0x12')](_0x7a86('0x13'),auth[_0x7a86('0x9')](),controller['update']);router[_0x7a86('0x14')](_0x7a86('0x13'),auth[_0x7a86('0x9')](),controller[_0x7a86('0x15')]);module[_0x7a86('0x16')]=router;
\ No newline at end of file
+var _0x433d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','describe','/:id','show','getQuestions','post','create','put','update'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x433d,0xb2));var _0xd433=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0x433d[_0x1fc84d];return _0x2658fa;};'use strict';var multer=require(_0xd433('0x0'));var util=require(_0xd433('0x1'));var path=require(_0xd433('0x2'));var timeout=require(_0xd433('0x3'));var express=require(_0xd433('0x4'));var router=express[_0xd433('0x5')]();var fs_extra=require(_0xd433('0x6'));var auth=require(_0xd433('0x7'));var interaction=require(_0xd433('0x8'));var config=require(_0xd433('0x9'));var controller=require(_0xd433('0xa'));router[_0xd433('0xb')]('/',auth[_0xd433('0xc')](),controller[_0xd433('0xd')]);router[_0xd433('0xb')]('/describe',auth[_0xd433('0xc')](),controller[_0xd433('0xe')]);router[_0xd433('0xb')](_0xd433('0xf'),auth[_0xd433('0xc')](),controller[_0xd433('0x10')]);router['get']('/:id/questions',auth[_0xd433('0xc')](),controller[_0xd433('0x11')]);router[_0xd433('0x12')]('/',auth['isAuthenticated'](),controller[_0xd433('0x13')]);router[_0xd433('0x14')](_0xd433('0xf'),auth['isAuthenticated'](),controller[_0xd433('0x15')]);router[_0xd433('0x16')](_0xd433('0xf'),auth[_0xd433('0xc')](),controller[_0xd433('0x17')]);module[_0xd433('0x18')]=router;
\ No newline at end of file
index 929494a..5ec91ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ef0=['sequelize','exports','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x2a8b2f,_0x53ff93){var _0x620e6f=function(_0x509b6d){while(--_0x509b6d){_0x2a8b2f['push'](_0x2a8b2f['shift']());}};_0x620e6f(++_0x53ff93);}(_0x0ef0,0xdb));var _0x00ef=function(_0x1cfe2e,_0x1ebbcd){_0x1cfe2e=_0x1cfe2e-0x0;var _0x39233f=_0x0ef0[_0x1cfe2e];return _0x39233f;};'use strict';var moment=require(_0x00ef('0x0'));var Sequelize=require(_0x00ef('0x1'));module[_0x00ef('0x2')]={'starttime':{'type':Sequelize[_0x00ef('0x3')],'set':function(_0x4ce169){this[_0x00ef('0x4')](_0x00ef('0x5'),_0x4ce169);this[_0x00ef('0x4')]('endtime',moment()[_0x00ef('0x6')](_0x00ef('0x7')));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x00ef('0x8')]},'queue':{'type':Sequelize[_0x00ef('0x8')]},'uniqueid':{'type':Sequelize[_0x00ef('0x8')]},'calleridname':{'type':Sequelize[_0x00ef('0x8')]},'calleridnum':{'type':Sequelize[_0x00ef('0x8')]},'completed':{'type':Sequelize[_0x00ef('0x9')],'defaultValue':![]}};
\ No newline at end of file
+var _0x6a57=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x1c6bff,_0x52389b){var _0x304fa8=function(_0x5eb4ce){while(--_0x5eb4ce){_0x1c6bff['push'](_0x1c6bff['shift']());}};_0x304fa8(++_0x52389b);}(_0x6a57,0x75));var _0x76a5=function(_0x1dc2b4,_0x573a04){_0x1dc2b4=_0x1dc2b4-0x0;var _0x18af92=_0x6a57[_0x1dc2b4];return _0x18af92;};'use strict';var moment=require(_0x76a5('0x0'));var Sequelize=require(_0x76a5('0x1'));module[_0x76a5('0x2')]={'starttime':{'type':Sequelize[_0x76a5('0x3')],'set':function(_0x46a9b9){this[_0x76a5('0x4')](_0x76a5('0x5'),_0x46a9b9);this[_0x76a5('0x4')](_0x76a5('0x6'),moment()[_0x76a5('0x7')](_0x76a5('0x8')));}},'endtime':{'type':Sequelize[_0x76a5('0x3')]},'membername':{'type':Sequelize[_0x76a5('0x9')]},'projectname':{'type':Sequelize[_0x76a5('0x9')]},'queue':{'type':Sequelize[_0x76a5('0x9')]},'uniqueid':{'type':Sequelize[_0x76a5('0x9')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x76a5('0xa')],'defaultValue':![]}};
\ No newline at end of file
index 4135298..c9fd0a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x72de=['request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','reject','update','then','stack','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','catch','params','length','options','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x17ddb3,_0x18787a){var _0x5803b4=function(_0x2445ce){while(--_0x2445ce){_0x17ddb3['push'](_0x17ddb3['shift']());}};_0x5803b4(++_0x18787a);}(_0x72de,0x13c));var _0xe72d=function(_0x637f25,_0x4b4836){_0x637f25=_0x637f25-0x0;var _0x35f21a=_0x72de[_0x637f25];return _0x35f21a;};'use strict';var emlformat=require(_0xe72d('0x0'));var rimraf=require(_0xe72d('0x1'));var zipdir=require(_0xe72d('0x2'));var jsonpatch=require(_0xe72d('0x3'));var rp=require(_0xe72d('0x4'));var moment=require(_0xe72d('0x5'));var BPromise=require(_0xe72d('0x6'));var Mustache=require(_0xe72d('0x7'));var util=require(_0xe72d('0x8'));var path=require(_0xe72d('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe72d('0xa'));var fs=require('fs');var fs_extra=require(_0xe72d('0xb'));var _=require('lodash');var squel=require(_0xe72d('0xc'));var crypto=require(_0xe72d('0xd'));var jsforce=require(_0xe72d('0xe'));var deskjs=require(_0xe72d('0xf'));var toCsv=require(_0xe72d('0x10'));var querystring=require(_0xe72d('0x11'));var Papa=require(_0xe72d('0x12'));var Redis=require(_0xe72d('0x13'));var authService=require(_0xe72d('0x14'));var qs=require(_0xe72d('0x15'));var as=require(_0xe72d('0x16'));var hardwareService=require(_0xe72d('0x17'));var logger=require('../../config/logger')(_0xe72d('0x18'));var utils=require(_0xe72d('0x19'));var config=require(_0xe72d('0x1a'));var licenseUtil=require(_0xe72d('0x1b'));var db=require(_0xe72d('0x1c'))['db'];function respondWithStatusCode(_0x97f56d,_0x5967b5){_0x5967b5=_0x5967b5||0xcc;return function(_0x5b501f){if(_0x5b501f){return _0x97f56d[_0xe72d('0x1d')](_0x5967b5);}return _0x97f56d['status'](_0x5967b5)[_0xe72d('0x1e')]();};}function respondWithResult(_0x3d3d1d,_0x59fb7c){_0x59fb7c=_0x59fb7c||0xc8;return function(_0x91d68e){if(_0x91d68e){return _0x3d3d1d['status'](_0x59fb7c)[_0xe72d('0x1f')](_0x91d68e);}};}function respondWithFilteredResult(_0x15ba9f,_0x57b0c2){return function(_0x2bce0d){if(_0x2bce0d){var _0x395b02=typeof _0x57b0c2[_0xe72d('0x20')]===_0xe72d('0x21')&&typeof _0x57b0c2[_0xe72d('0x22')]===_0xe72d('0x21');var _0x1da51f=_0x2bce0d[_0xe72d('0x23')];var _0x50cbc7=_0x395b02?0x0:_0x57b0c2[_0xe72d('0x20')];var _0x59f4f1=_0x395b02?_0x2bce0d[_0xe72d('0x23')]:_0x57b0c2['offset']+_0x57b0c2[_0xe72d('0x22')];var _0x2e6dd8;if(_0x59f4f1>=_0x1da51f){_0x59f4f1=_0x1da51f;_0x2e6dd8=0xc8;}else{_0x2e6dd8=0xce;}_0x15ba9f[_0xe72d('0x24')](_0x2e6dd8);return _0x15ba9f['set']('Content-Range',_0x50cbc7+'-'+_0x59f4f1+'/'+_0x1da51f)[_0xe72d('0x1f')](_0x2bce0d);}return null;};}function patchUpdates(_0x41e964){return function(_0x22c0e3){try{jsonpatch['apply'](_0x22c0e3,_0x41e964,!![]);}catch(_0x1f766b){return BPromise[_0xe72d('0x25')](_0x1f766b);}return _0x22c0e3['save']();};}function saveUpdates(_0x32b0af,_0x44875e){return function(_0x22be76){if(_0x22be76){return _0x22be76[_0xe72d('0x26')](_0x32b0af)[_0xe72d('0x27')](function(_0x2a3d47){return _0x2a3d47;});}return null;};}function removeEntity(_0x182cd3,_0x45a23c){return function(_0x166fe3){if(_0x166fe3){return _0x166fe3['destroy']()[_0xe72d('0x27')](function(){_0x182cd3[_0xe72d('0x24')](0xcc)[_0xe72d('0x1e')]();});}};}function handleEntityNotFound(_0x5a8783,_0x57493e){return function(_0x4e5628){if(!_0x4e5628){_0x5a8783[_0xe72d('0x1d')](0x194);}return _0x4e5628;};}function handleError(_0x3225ed,_0x5c5844){_0x5c5844=_0x5c5844||0x1f4;return function(_0x3c23a5){logger['error'](_0x3c23a5[_0xe72d('0x28')]);if(_0x3c23a5['name']){delete _0x3c23a5['name'];}_0x3225ed[_0xe72d('0x24')](_0x5c5844)[_0xe72d('0x29')](_0x3c23a5);};}exports[_0xe72d('0x2a')]=function(_0x4e4a6a,_0x5a7e60){var _0x25a411={},_0x3902a9={},_0x550972={'count':0x0,'rows':[]};var _0x4148b4=_[_0xe72d('0x2b')](db[_0xe72d('0x2c')][_0xe72d('0x2d')],function(_0x3dd99a){return{'name':_0x3dd99a[_0xe72d('0x2e')],'type':_0x3dd99a[_0xe72d('0x2f')][_0xe72d('0x30')]};});_0x3902a9[_0xe72d('0x31')]=_[_0xe72d('0x2b')](_0x4148b4,_0xe72d('0x32'));_0x3902a9[_0xe72d('0x33')]=_[_0xe72d('0x34')](_0x4e4a6a['query']);_0x3902a9[_0xe72d('0x35')]=_[_0xe72d('0x36')](_0x3902a9[_0xe72d('0x31')],_0x3902a9[_0xe72d('0x33')]);_0x25a411[_0xe72d('0x37')]=_['intersection'](_0x3902a9[_0xe72d('0x31')],qs['fields'](_0x4e4a6a[_0xe72d('0x33')][_0xe72d('0x38')]));_0x25a411[_0xe72d('0x37')]=_0x25a411[_0xe72d('0x37')]['length']?_0x25a411[_0xe72d('0x37')]:_0x3902a9[_0xe72d('0x31')];if(!_0x4e4a6a[_0xe72d('0x33')][_0xe72d('0x39')](_0xe72d('0x3a'))){_0x25a411[_0xe72d('0x22')]=qs['limit'](_0x4e4a6a['query'][_0xe72d('0x22')]);_0x25a411[_0xe72d('0x20')]=qs[_0xe72d('0x20')](_0x4e4a6a[_0xe72d('0x33')]['offset']);}_0x25a411[_0xe72d('0x3b')]=qs['sort'](_0x4e4a6a[_0xe72d('0x33')][_0xe72d('0x3c')]);_0x25a411[_0xe72d('0x3d')]=qs[_0xe72d('0x35')](_[_0xe72d('0x3e')](_0x4e4a6a[_0xe72d('0x33')],_0x3902a9[_0xe72d('0x35')]),_0x4148b4);if(_0x4e4a6a[_0xe72d('0x33')]['filter']){_0x25a411[_0xe72d('0x3d')]=_[_0xe72d('0x3f')](_0x25a411['where'],{'$or':_['map'](_0x4148b4,function(_0x24f240){if(_0x24f240[_0xe72d('0x2f')]!==_0xe72d('0x40')){var _0x2c5734={};_0x2c5734[_0x24f240['name']]={'$like':'%'+_0x4e4a6a[_0xe72d('0x33')][_0xe72d('0x41')]+'%'};return _0x2c5734;}})});}_0x25a411=_[_0xe72d('0x3f')]({},_0x25a411,_0x4e4a6a['options']);var _0x10b55e={'where':_0x25a411['where']};return db[_0xe72d('0x2c')][_0xe72d('0x23')](_0x10b55e)[_0xe72d('0x27')](function(_0x4dd0e3){_0x550972[_0xe72d('0x23')]=_0x4dd0e3;if(_0x4e4a6a[_0xe72d('0x33')][_0xe72d('0x42')]){_0x25a411[_0xe72d('0x43')]=[{'all':!![]}];}return db[_0xe72d('0x2c')][_0xe72d('0x44')](_0x25a411);})[_0xe72d('0x27')](function(_0x434cb7){_0x550972['rows']=_0x434cb7;return _0x550972;})[_0xe72d('0x27')](respondWithFilteredResult(_0x5a7e60,_0x25a411))[_0xe72d('0x45')](handleError(_0x5a7e60,null));};exports['show']=function(_0x1b37b9,_0x484796){var _0x481d77={'raw':!![],'where':{'id':_0x1b37b9[_0xe72d('0x46')]['id']}},_0x4ce898={};_0x4ce898['model']=_[_0xe72d('0x34')](db[_0xe72d('0x2c')]['rawAttributes']);_0x4ce898[_0xe72d('0x33')]=_[_0xe72d('0x34')](_0x1b37b9[_0xe72d('0x33')]);_0x4ce898['filters']=_[_0xe72d('0x36')](_0x4ce898[_0xe72d('0x31')],_0x4ce898[_0xe72d('0x33')]);_0x481d77[_0xe72d('0x37')]=_[_0xe72d('0x36')](_0x4ce898[_0xe72d('0x31')],qs['fields'](_0x1b37b9[_0xe72d('0x33')][_0xe72d('0x38')]));_0x481d77[_0xe72d('0x37')]=_0x481d77[_0xe72d('0x37')][_0xe72d('0x47')]?_0x481d77['attributes']:_0x4ce898[_0xe72d('0x31')];if(_0x1b37b9[_0xe72d('0x33')][_0xe72d('0x42')]){_0x481d77['include']=[{'all':!![]}];}_0x481d77=_[_0xe72d('0x3f')]({},_0x481d77,_0x1b37b9[_0xe72d('0x48')]);return db[_0xe72d('0x2c')][_0xe72d('0x49')](_0x481d77)[_0xe72d('0x27')](handleEntityNotFound(_0x484796,null))[_0xe72d('0x27')](respondWithResult(_0x484796,null))[_0xe72d('0x45')](handleError(_0x484796,null));};exports[_0xe72d('0x4a')]=function(_0x2be69a,_0x595b5c){return db[_0xe72d('0x2c')][_0xe72d('0x4a')](_0x2be69a[_0xe72d('0x4b')],{})[_0xe72d('0x27')](respondWithResult(_0x595b5c,0xc9))[_0xe72d('0x45')](handleError(_0x595b5c,null));};exports[_0xe72d('0x26')]=function(_0x1a67b4,_0x527059){if(_0x1a67b4[_0xe72d('0x4b')]['id']){delete _0x1a67b4[_0xe72d('0x4b')]['id'];}return db[_0xe72d('0x2c')][_0xe72d('0x49')]({'where':{'id':_0x1a67b4[_0xe72d('0x46')]['id']}})[_0xe72d('0x27')](handleEntityNotFound(_0x527059,null))[_0xe72d('0x27')](saveUpdates(_0x1a67b4['body'],null))['then'](respondWithResult(_0x527059,null))['catch'](handleError(_0x527059,null));};exports['destroy']=function(_0x1b2988,_0x38e8a7){return db[_0xe72d('0x2c')][_0xe72d('0x49')]({'where':{'id':_0x1b2988['params']['id']}})[_0xe72d('0x27')](handleEntityNotFound(_0x38e8a7,null))[_0xe72d('0x27')](removeEntity(_0x38e8a7,null))[_0xe72d('0x45')](handleError(_0x38e8a7,null));};exports[_0xe72d('0x4c')]=function(_0x4eb33e,_0x4f79ce){return db[_0xe72d('0x2c')][_0xe72d('0x4c')]()['then'](respondWithResult(_0x4f79ce,null))[_0xe72d('0x45')](handleError(_0x4f79ce,null));};exports[_0xe72d('0x4d')]=function(_0x5af0b1,_0x5b91ea,_0x96e6f7){var _0x58a909={'raw':!![],'where':{}};var _0x11b881={};var _0x36f26c={'count':0x0,'rows':[]};return db[_0xe72d('0x2c')][_0xe72d('0x4e')]({'where':{'id':_0x5af0b1['params']['id']}})[_0xe72d('0x27')](handleEntityNotFound(_0x5b91ea,null))[_0xe72d('0x27')](function(_0x4b7d12){if(_0x4b7d12){_0x11b881[_0xe72d('0x31')]=_[_0xe72d('0x34')](db['JscriptyQuestionReport'][_0xe72d('0x2d')]);_0x11b881[_0xe72d('0x33')]=_[_0xe72d('0x34')](_0x5af0b1[_0xe72d('0x33')]);_0x11b881[_0xe72d('0x35')]=_[_0xe72d('0x36')](_0x11b881[_0xe72d('0x31')],_0x11b881['query']);_0x58a909[_0xe72d('0x37')]=_[_0xe72d('0x36')](_0x11b881[_0xe72d('0x31')],qs[_0xe72d('0x38')](_0x5af0b1[_0xe72d('0x33')][_0xe72d('0x38')]));_0x58a909['attributes']=_0x58a909[_0xe72d('0x37')][_0xe72d('0x47')]?_0x58a909[_0xe72d('0x37')]:_0x11b881[_0xe72d('0x31')];if(!_0x5af0b1[_0xe72d('0x33')][_0xe72d('0x39')](_0xe72d('0x3a'))){_0x58a909['limit']=qs['limit'](_0x5af0b1[_0xe72d('0x33')][_0xe72d('0x22')]);_0x58a909[_0xe72d('0x20')]=qs['offset'](_0x5af0b1[_0xe72d('0x33')][_0xe72d('0x20')]);}_0x58a909[_0xe72d('0x3b')]=qs[_0xe72d('0x3c')](_0x5af0b1[_0xe72d('0x33')][_0xe72d('0x3c')]);_0x58a909[_0xe72d('0x3d')]=qs[_0xe72d('0x35')](_[_0xe72d('0x3e')](_0x5af0b1[_0xe72d('0x33')],_0x11b881['filters']));_0x58a909[_0xe72d('0x3d')]['SessionId']=_0x4b7d12['id'];if(_0x5af0b1['query']['filter']){_0x58a909[_0xe72d('0x3d')]=_[_0xe72d('0x3f')](_0x58a909[_0xe72d('0x3d')],{'$or':_['map'](_0x58a909['attributes'],function(_0xaa722c){var _0x3aeab9={};_0x3aeab9[_0xaa722c]={'$like':'%'+_0x5af0b1['query']['filter']+'%'};return _0x3aeab9;})});}_0x58a909=_[_0xe72d('0x3f')]({},_0x58a909,_0x5af0b1[_0xe72d('0x48')]);return db[_0xe72d('0x4f')][_0xe72d('0x23')]({'where':_0x58a909[_0xe72d('0x3d')]})[_0xe72d('0x27')](function(_0x2f39d9){_0x36f26c['count']=_0x2f39d9;if(_0x5af0b1['query'][_0xe72d('0x42')]){_0x58a909[_0xe72d('0x43')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xe72d('0x44')](_0x58a909);})[_0xe72d('0x27')](function(_0x49d565){_0x36f26c['rows']=_0x49d565;return _0x36f26c;});}})[_0xe72d('0x27')](respondWithFilteredResult(_0x5b91ea,_0x58a909))[_0xe72d('0x45')](handleError(_0x5b91ea,null));};
\ No newline at end of file
+var _0x73bf=['describe','getQuestions','findOne','JscriptyQuestionReport','sort','SessionId','findAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','JscriptySessionReport','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filters','filter','merge','type','VIRTUAL','options','include','rows','catch','show','params','rawAttributes','includeAll','create','body','find'];(function(_0x5354d1,_0x746d70){var _0x4d74b0=function(_0x15ac84){while(--_0x15ac84){_0x5354d1['push'](_0x5354d1['shift']());}};_0x4d74b0(++_0x746d70);}(_0x73bf,0x1e7));var _0xf73b=function(_0x19ea9d,_0x582bea){_0x19ea9d=_0x19ea9d-0x0;var _0x496114=_0x73bf[_0x19ea9d];return _0x496114;};'use strict';var emlformat=require(_0xf73b('0x0'));var rimraf=require(_0xf73b('0x1'));var zipdir=require(_0xf73b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf73b('0x3'));var moment=require(_0xf73b('0x4'));var BPromise=require(_0xf73b('0x5'));var Mustache=require(_0xf73b('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf73b('0x7'));var csv=require('to-csv');var ejs=require(_0xf73b('0x8'));var fs=require('fs');var fs_extra=require(_0xf73b('0x9'));var _=require(_0xf73b('0xa'));var squel=require(_0xf73b('0xb'));var crypto=require(_0xf73b('0xc'));var jsforce=require(_0xf73b('0xd'));var deskjs=require(_0xf73b('0xe'));var toCsv=require(_0xf73b('0xf'));var querystring=require(_0xf73b('0x10'));var Papa=require(_0xf73b('0x11'));var Redis=require('ioredis');var authService=require(_0xf73b('0x12'));var qs=require(_0xf73b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf73b('0x14'))('api');var utils=require(_0xf73b('0x15'));var config=require(_0xf73b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf73b('0x17'))['db'];function respondWithStatusCode(_0x2532a6,_0x56fdae){_0x56fdae=_0x56fdae||0xcc;return function(_0x572b70){if(_0x572b70){return _0x2532a6['sendStatus'](_0x56fdae);}return _0x2532a6[_0xf73b('0x18')](_0x56fdae)[_0xf73b('0x19')]();};}function respondWithResult(_0x49a0b8,_0x30d1a0){_0x30d1a0=_0x30d1a0||0xc8;return function(_0x53fdd0){if(_0x53fdd0){return _0x49a0b8['status'](_0x30d1a0)[_0xf73b('0x1a')](_0x53fdd0);}};}function respondWithFilteredResult(_0x555ca5,_0x2dde97){return function(_0x322d32){if(_0x322d32){var _0xd9c901=typeof _0x2dde97[_0xf73b('0x1b')]==='undefined'&&typeof _0x2dde97[_0xf73b('0x1c')]===_0xf73b('0x1d');var _0x5768ce=_0x322d32[_0xf73b('0x1e')];var _0x3780c0=_0xd9c901?0x0:_0x2dde97[_0xf73b('0x1b')];var _0x592018=_0xd9c901?_0x322d32['count']:_0x2dde97[_0xf73b('0x1b')]+_0x2dde97[_0xf73b('0x1c')];var _0x1f300e;if(_0x592018>=_0x5768ce){_0x592018=_0x5768ce;_0x1f300e=0xc8;}else{_0x1f300e=0xce;}_0x555ca5[_0xf73b('0x18')](_0x1f300e);return _0x555ca5[_0xf73b('0x1f')](_0xf73b('0x20'),_0x3780c0+'-'+_0x592018+'/'+_0x5768ce)[_0xf73b('0x1a')](_0x322d32);}return null;};}function patchUpdates(_0x2c4233){return function(_0x16a185){try{jsonpatch['apply'](_0x16a185,_0x2c4233,!![]);}catch(_0x41a3dd){return BPromise[_0xf73b('0x21')](_0x41a3dd);}return _0x16a185[_0xf73b('0x22')]();};}function saveUpdates(_0x37706f,_0x44c6c0){return function(_0x47d904){if(_0x47d904){return _0x47d904[_0xf73b('0x23')](_0x37706f)[_0xf73b('0x24')](function(_0x32d954){return _0x32d954;});}return null;};}function removeEntity(_0x53bf78,_0x496a9a){return function(_0x3b0e12){if(_0x3b0e12){return _0x3b0e12[_0xf73b('0x25')]()[_0xf73b('0x24')](function(){_0x53bf78['status'](0xcc)[_0xf73b('0x19')]();});}};}function handleEntityNotFound(_0x4e1959,_0x1ccc68){return function(_0x1397af){if(!_0x1397af){_0x4e1959['sendStatus'](0x194);}return _0x1397af;};}function handleError(_0x5e5372,_0x5241e8){_0x5241e8=_0x5241e8||0x1f4;return function(_0x1b89b6){logger[_0xf73b('0x26')](_0x1b89b6[_0xf73b('0x27')]);if(_0x1b89b6['name']){delete _0x1b89b6[_0xf73b('0x28')];}_0x5e5372['status'](_0x5241e8)['send'](_0x1b89b6);};}exports[_0xf73b('0x29')]=function(_0x2fb375,_0x185c4e){var _0x405f61={},_0x31088f={},_0x72ae0d={'count':0x0,'rows':[]};var _0x4ed20b=_[_0xf73b('0x2a')](db[_0xf73b('0x2b')]['rawAttributes'],function(_0x25783c){return{'name':_0x25783c[_0xf73b('0x2c')],'type':_0x25783c['type'][_0xf73b('0x2d')]};});_0x31088f[_0xf73b('0x2e')]=_[_0xf73b('0x2a')](_0x4ed20b,_0xf73b('0x28'));_0x31088f[_0xf73b('0x2f')]=_[_0xf73b('0x30')](_0x2fb375[_0xf73b('0x2f')]);_0x31088f['filters']=_['intersection'](_0x31088f[_0xf73b('0x2e')],_0x31088f[_0xf73b('0x2f')]);_0x405f61[_0xf73b('0x31')]=_[_0xf73b('0x32')](_0x31088f[_0xf73b('0x2e')],qs[_0xf73b('0x33')](_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x33')]));_0x405f61[_0xf73b('0x31')]=_0x405f61[_0xf73b('0x31')][_0xf73b('0x34')]?_0x405f61[_0xf73b('0x31')]:_0x31088f[_0xf73b('0x2e')];if(!_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x35')](_0xf73b('0x36'))){_0x405f61[_0xf73b('0x1c')]=qs['limit'](_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x1c')]);_0x405f61[_0xf73b('0x1b')]=qs[_0xf73b('0x1b')](_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x1b')]);}_0x405f61['order']=qs['sort'](_0x2fb375[_0xf73b('0x2f')]['sort']);_0x405f61[_0xf73b('0x37')]=qs['filters'](_[_0xf73b('0x38')](_0x2fb375[_0xf73b('0x2f')],_0x31088f[_0xf73b('0x39')]),_0x4ed20b);if(_0x2fb375[_0xf73b('0x2f')][_0xf73b('0x3a')]){_0x405f61[_0xf73b('0x37')]=_[_0xf73b('0x3b')](_0x405f61[_0xf73b('0x37')],{'$or':_[_0xf73b('0x2a')](_0x4ed20b,function(_0x11c070){if(_0x11c070[_0xf73b('0x3c')]!==_0xf73b('0x3d')){var _0x4344f6={};_0x4344f6[_0x11c070[_0xf73b('0x28')]]={'$like':'%'+_0x2fb375[_0xf73b('0x2f')]['filter']+'%'};return _0x4344f6;}})});}_0x405f61=_[_0xf73b('0x3b')]({},_0x405f61,_0x2fb375[_0xf73b('0x3e')]);var _0x2d46fa={'where':_0x405f61[_0xf73b('0x37')]};return db[_0xf73b('0x2b')]['count'](_0x2d46fa)['then'](function(_0x4ca990){_0x72ae0d[_0xf73b('0x1e')]=_0x4ca990;if(_0x2fb375['query']['includeAll']){_0x405f61[_0xf73b('0x3f')]=[{'all':!![]}];}return db[_0xf73b('0x2b')]['findAll'](_0x405f61);})[_0xf73b('0x24')](function(_0x25d58d){_0x72ae0d[_0xf73b('0x40')]=_0x25d58d;return _0x72ae0d;})[_0xf73b('0x24')](respondWithFilteredResult(_0x185c4e,_0x405f61))[_0xf73b('0x41')](handleError(_0x185c4e,null));};exports[_0xf73b('0x42')]=function(_0x39c496,_0x3df798){var _0x4480d2={'raw':!![],'where':{'id':_0x39c496[_0xf73b('0x43')]['id']}},_0xde6d86={};_0xde6d86[_0xf73b('0x2e')]=_[_0xf73b('0x30')](db[_0xf73b('0x2b')][_0xf73b('0x44')]);_0xde6d86['query']=_[_0xf73b('0x30')](_0x39c496[_0xf73b('0x2f')]);_0xde6d86[_0xf73b('0x39')]=_[_0xf73b('0x32')](_0xde6d86[_0xf73b('0x2e')],_0xde6d86[_0xf73b('0x2f')]);_0x4480d2[_0xf73b('0x31')]=_[_0xf73b('0x32')](_0xde6d86['model'],qs[_0xf73b('0x33')](_0x39c496['query'][_0xf73b('0x33')]));_0x4480d2[_0xf73b('0x31')]=_0x4480d2['attributes'][_0xf73b('0x34')]?_0x4480d2[_0xf73b('0x31')]:_0xde6d86[_0xf73b('0x2e')];if(_0x39c496['query'][_0xf73b('0x45')]){_0x4480d2[_0xf73b('0x3f')]=[{'all':!![]}];}_0x4480d2=_[_0xf73b('0x3b')]({},_0x4480d2,_0x39c496[_0xf73b('0x3e')]);return db[_0xf73b('0x2b')]['find'](_0x4480d2)[_0xf73b('0x24')](handleEntityNotFound(_0x3df798,null))[_0xf73b('0x24')](respondWithResult(_0x3df798,null))[_0xf73b('0x41')](handleError(_0x3df798,null));};exports[_0xf73b('0x46')]=function(_0x23970b,_0x126996){return db[_0xf73b('0x2b')][_0xf73b('0x46')](_0x23970b[_0xf73b('0x47')],{})[_0xf73b('0x24')](respondWithResult(_0x126996,0xc9))[_0xf73b('0x41')](handleError(_0x126996,null));};exports[_0xf73b('0x23')]=function(_0x834c23,_0x50cbe8){if(_0x834c23['body']['id']){delete _0x834c23[_0xf73b('0x47')]['id'];}return db[_0xf73b('0x2b')]['find']({'where':{'id':_0x834c23['params']['id']}})[_0xf73b('0x24')](handleEntityNotFound(_0x50cbe8,null))[_0xf73b('0x24')](saveUpdates(_0x834c23['body'],null))[_0xf73b('0x24')](respondWithResult(_0x50cbe8,null))[_0xf73b('0x41')](handleError(_0x50cbe8,null));};exports[_0xf73b('0x25')]=function(_0x4e3493,_0x963b5e){return db[_0xf73b('0x2b')][_0xf73b('0x48')]({'where':{'id':_0x4e3493[_0xf73b('0x43')]['id']}})[_0xf73b('0x24')](handleEntityNotFound(_0x963b5e,null))[_0xf73b('0x24')](removeEntity(_0x963b5e,null))[_0xf73b('0x41')](handleError(_0x963b5e,null));};exports[_0xf73b('0x49')]=function(_0x1cc820,_0x2268f6){return db[_0xf73b('0x2b')][_0xf73b('0x49')]()[_0xf73b('0x24')](respondWithResult(_0x2268f6,null))[_0xf73b('0x41')](handleError(_0x2268f6,null));};exports[_0xf73b('0x4a')]=function(_0x5c42fc,_0x35e1f1,_0x15bd4a){var _0x2a0c2d={'raw':!![],'where':{}};var _0x33f9b2={};var _0x298e53={'count':0x0,'rows':[]};return db[_0xf73b('0x2b')][_0xf73b('0x4b')]({'where':{'id':_0x5c42fc['params']['id']}})[_0xf73b('0x24')](handleEntityNotFound(_0x35e1f1,null))[_0xf73b('0x24')](function(_0x4d5328){if(_0x4d5328){_0x33f9b2[_0xf73b('0x2e')]=_['keys'](db[_0xf73b('0x4c')][_0xf73b('0x44')]);_0x33f9b2['query']=_[_0xf73b('0x30')](_0x5c42fc[_0xf73b('0x2f')]);_0x33f9b2[_0xf73b('0x39')]=_[_0xf73b('0x32')](_0x33f9b2[_0xf73b('0x2e')],_0x33f9b2[_0xf73b('0x2f')]);_0x2a0c2d[_0xf73b('0x31')]=_[_0xf73b('0x32')](_0x33f9b2[_0xf73b('0x2e')],qs[_0xf73b('0x33')](_0x5c42fc[_0xf73b('0x2f')]['fields']));_0x2a0c2d['attributes']=_0x2a0c2d['attributes'][_0xf73b('0x34')]?_0x2a0c2d[_0xf73b('0x31')]:_0x33f9b2['model'];if(!_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x35')](_0xf73b('0x36'))){_0x2a0c2d[_0xf73b('0x1c')]=qs[_0xf73b('0x1c')](_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x1c')]);_0x2a0c2d['offset']=qs[_0xf73b('0x1b')](_0x5c42fc['query'][_0xf73b('0x1b')]);}_0x2a0c2d['order']=qs[_0xf73b('0x4d')](_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x4d')]);_0x2a0c2d[_0xf73b('0x37')]=qs[_0xf73b('0x39')](_[_0xf73b('0x38')](_0x5c42fc[_0xf73b('0x2f')],_0x33f9b2[_0xf73b('0x39')]));_0x2a0c2d[_0xf73b('0x37')][_0xf73b('0x4e')]=_0x4d5328['id'];if(_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x3a')]){_0x2a0c2d['where']=_[_0xf73b('0x3b')](_0x2a0c2d[_0xf73b('0x37')],{'$or':_['map'](_0x2a0c2d[_0xf73b('0x31')],function(_0x3dbbe5){var _0x1ff0e0={};_0x1ff0e0[_0x3dbbe5]={'$like':'%'+_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x3a')]+'%'};return _0x1ff0e0;})});}_0x2a0c2d=_['merge']({},_0x2a0c2d,_0x5c42fc[_0xf73b('0x3e')]);return db[_0xf73b('0x4c')][_0xf73b('0x1e')]({'where':_0x2a0c2d[_0xf73b('0x37')]})[_0xf73b('0x24')](function(_0x3f3d87){_0x298e53['count']=_0x3f3d87;if(_0x5c42fc[_0xf73b('0x2f')][_0xf73b('0x45')]){_0x2a0c2d[_0xf73b('0x3f')]=[{'all':!![]}];}return db[_0xf73b('0x4c')][_0xf73b('0x4f')](_0x2a0c2d);})[_0xf73b('0x24')](function(_0x10a806){_0x298e53['rows']=_0x10a806;return _0x298e53;});}})[_0xf73b('0x24')](respondWithFilteredResult(_0x35e1f1,_0x2a0c2d))[_0xf73b('0x41')](handleError(_0x35e1f1,null));};
\ No newline at end of file
index c60b873..a601003 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x46ed=['lodash','util','api','moment','bluebird','path','rimraf','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0x28669c,_0x1f62c4){var _0x4a3af6=function(_0x3e25d5){while(--_0x3e25d5){_0x28669c['push'](_0x28669c['shift']());}};_0x4a3af6(++_0x1f62c4);}(_0x46ed,0x168));var _0xd46e=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x46ed[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var logger=require('../../config/logger')(_0xd46e('0x2'));var moment=require(_0xd46e('0x3'));var BPromise=require(_0xd46e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd46e('0x5'));var rimraf=require(_0xd46e('0x6'));var config=require('../../config/environment');var attributes=require(_0xd46e('0x7'));module[_0xd46e('0x8')]=function(_0x160bcf,_0x25cf78){return _0x160bcf[_0xd46e('0x9')](_0xd46e('0xa'),attributes,{'tableName':_0xd46e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd8fb=['lodash','util','../../config/logger','api','path','rimraf','./jscriptySessionReport.attributes','exports','JscriptySessionReport'];(function(_0x3a93e9,_0xd77f26){var _0xd4e34=function(_0x2255c8){while(--_0x2255c8){_0x3a93e9['push'](_0x3a93e9['shift']());}};_0xd4e34(++_0xd77f26);}(_0xd8fb,0x99));var _0xbd8f=function(_0x51a3c2,_0x3b6604){_0x51a3c2=_0x51a3c2-0x0;var _0x19526f=_0xd8fb[_0x51a3c2];return _0x19526f;};'use strict';var _=require(_0xbd8f('0x0'));var util=require(_0xbd8f('0x1'));var logger=require(_0xbd8f('0x2'))(_0xbd8f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbd8f('0x4'));var rimraf=require(_0xbd8f('0x5'));var config=require('../../config/environment');var attributes=require(_0xbd8f('0x6'));module[_0xbd8f('0x7')]=function(_0x5543b2,_0x33d541){return _0x5543b2['define'](_0xbd8f('0x8'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 39481ae..5b6729e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5af=['jayson/promise','client','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x142d3e,_0x353e86){var _0x493084=function(_0x14aa15){while(--_0x14aa15){_0x142d3e['push'](_0x142d3e['shift']());}};_0x493084(++_0x353e86);}(_0xe5af,0x9c));var _0xfe5a=function(_0x2799e4,_0x275478){_0x2799e4=_0x2799e4-0x0;var _0x88ae9b=_0xe5af[_0x2799e4];return _0x88ae9b;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5eea2e,_0x356c69,_0x106492){return new BPromise(function(_0xfb4357,_0x3e683c){return client['request'](_0x5eea2e,_0x106492)[_0xfe5a('0x8')](function(_0x5a48ff){logger['info'](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));logger['debug'](_0xfe5a('0xb'),_0x356c69,_0xfe5a('0xa'),JSON[_0xfe5a('0xc')](_0x5a48ff));if(_0x5a48ff[_0xfe5a('0xd')]){if(_0x5a48ff[_0xfe5a('0xd')]['code']===0x1f4){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0x3e683c(_0x5a48ff[_0xfe5a('0xd')]['message']);}logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);return _0xfb4357(_0x5a48ff[_0xfe5a('0xd')][_0xfe5a('0xe')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x9'),_0x356c69,_0xfe5a('0xa'));_0xfb4357(_0x5a48ff[_0xfe5a('0x10')][_0xfe5a('0xe')]);}})[_0xfe5a('0x11')](function(_0x22afa7){logger[_0xfe5a('0xd')](_0xfe5a('0x9'),_0x356c69,_0x22afa7);_0x3e683c(_0x22afa7);});});}
\ No newline at end of file
+var _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0xfcf0,0x138));var _0x0fcf=function(_0x406e46,_0x5799cb){_0x406e46=_0x406e46-0x0;var _0x4a3742=_0xfcf0[_0x406e46];return _0x4a3742;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}
\ No newline at end of file
index 1d515dd..fa0c3da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3776=['fs-extra','../../components/interaction/service','../../config/environment','./license.controller','index','put','isAuthenticated','update','get','/download_log_file','downloadLogFile','multer','util','path','Router'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x3776,0xce));var _0x6377=function(_0x31acc7,_0x168431){_0x31acc7=_0x31acc7-0x0;var _0x10d549=_0x3776[_0x31acc7];return _0x10d549;};'use strict';var multer=require(_0x6377('0x0'));var util=require(_0x6377('0x1'));var path=require(_0x6377('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6377('0x3')]();var fs_extra=require(_0x6377('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6377('0x5'));var config=require(_0x6377('0x6'));var controller=require(_0x6377('0x7'));router['get']('/',controller[_0x6377('0x8')]);router[_0x6377('0x9')]('/:id',auth[_0x6377('0xa')](),controller[_0x6377('0xb')]);router[_0x6377('0xc')](_0x6377('0xd'),auth[_0x6377('0xa')](),controller[_0x6377('0xe')]);module['exports']=router;
\ No newline at end of file
+var _0xc9a8=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./license.controller','get','put','/:id','update','/download_log_file','downloadLogFile','multer','path'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc9a8,0x1da));var _0x8c9a=function(_0x580647,_0x43d2c3){_0x580647=_0x580647-0x0;var _0x5f0792=_0xc9a8[_0x580647];return _0x5f0792;};'use strict';var multer=require(_0x8c9a('0x0'));var util=require('util');var path=require(_0x8c9a('0x1'));var timeout=require(_0x8c9a('0x2'));var express=require(_0x8c9a('0x3'));var router=express[_0x8c9a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8c9a('0x5'));var config=require(_0x8c9a('0x6'));var controller=require(_0x8c9a('0x7'));router[_0x8c9a('0x8')]('/',controller['index']);router[_0x8c9a('0x9')](_0x8c9a('0xa'),auth['isAuthenticated'](),controller[_0x8c9a('0xb')]);router[_0x8c9a('0x8')](_0x8c9a('0xc'),auth['isAuthenticated'](),controller[_0x8c9a('0xd')]);module['exports']=router;
\ No newline at end of file
index e30455d..3866f2f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9702=['exports','TEXT','STRING'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x9702,0x1b6));var _0x2970=function(_0x5e2a26,_0x52d4bc){_0x5e2a26=_0x5e2a26-0x0;var _0x3760a3=_0x9702[_0x5e2a26];return _0x3760a3;};'use strict';var Sequelize=require('sequelize');module[_0x2970('0x0')]={'license':{'type':Sequelize[_0x2970('0x1')]},'data1':{'type':Sequelize[_0x2970('0x2')]},'data2':{'type':Sequelize[_0x2970('0x2')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0x0091=['STRING','INTEGER','sequelize','TEXT'];(function(_0x14d307,_0x512e11){var _0x51d629=function(_0x1b8ed6){while(--_0x1b8ed6){_0x14d307['push'](_0x14d307['shift']());}};_0x51d629(++_0x512e11);}(_0x0091,0x12a));var _0x1009=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x0091[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x1009('0x0'));module['exports']={'license':{'type':Sequelize[_0x1009('0x1')]},'data1':{'type':Sequelize[_0x1009('0x2')]},'data2':{'type':Sequelize[_0x1009('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x1009('0x3')],'defaultValue':0x0}};
\ No newline at end of file
index 44bd94b..7a7d236 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1263=['rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','name','index','keys','License','rawAttributes','query','filters','intersection','model','attributes','fields','length','merge','body','find','params','get','checkLicense','demo','catch','downloadLogFile','license-info.log','join','/var','log','xcally','attachment;\x20filename=','set','Content-Type','download','eml-format'];(function(_0x301475,_0x5bba26){var _0x3a35ab=function(_0xcfacfd){while(--_0xcfacfd){_0x301475['push'](_0x301475['shift']());}};_0x3a35ab(++_0x5bba26);}(_0x1263,0x113));var _0x3126=function(_0x20fe8c,_0x5ea302){_0x20fe8c=_0x20fe8c-0x0;var _0x2030c3=_0x1263[_0x20fe8c];return _0x2030c3;};'use strict';var emlformat=require(_0x3126('0x0'));var rimraf=require(_0x3126('0x1'));var zipdir=require(_0x3126('0x2'));var jsonpatch=require(_0x3126('0x3'));var rp=require(_0x3126('0x4'));var moment=require('moment');var BPromise=require(_0x3126('0x5'));var Mustache=require('mustache');var util=require(_0x3126('0x6'));var path=require(_0x3126('0x7'));var sox=require(_0x3126('0x8'));var csv=require(_0x3126('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3126('0xa'));var _=require(_0x3126('0xb'));var squel=require(_0x3126('0xc'));var crypto=require(_0x3126('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3126('0x9'));var querystring=require(_0x3126('0xe'));var Papa=require('papaparse');var Redis=require(_0x3126('0xf'));var authService=require(_0x3126('0x10'));var qs=require(_0x3126('0x11'));var as=require(_0x3126('0x12'));var hardwareService=require(_0x3126('0x13'));var logger=require(_0x3126('0x14'))(_0x3126('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3126('0x16'));var db=require(_0x3126('0x17'))['db'];function respondWithStatusCode(_0x3cf268,_0x422220){_0x422220=_0x422220||0xcc;return function(_0x2576db){if(_0x2576db){return _0x3cf268[_0x3126('0x18')](_0x422220);}return _0x3cf268[_0x3126('0x19')](_0x422220)[_0x3126('0x1a')]();};}function respondWithResult(_0x5dadcc,_0x47e48a){_0x47e48a=_0x47e48a||0xc8;return function(_0x30b44c){if(_0x30b44c){return _0x5dadcc[_0x3126('0x19')](_0x47e48a)[_0x3126('0x1b')](_0x30b44c);}};}function respondWithFilteredResult(_0x337f3c,_0x1a3a57){return function(_0x4e4e58){if(_0x4e4e58){var _0xe84233=typeof _0x1a3a57[_0x3126('0x1c')]===_0x3126('0x1d')&&typeof _0x1a3a57[_0x3126('0x1e')]===_0x3126('0x1d');var _0xde06f9=_0x4e4e58[_0x3126('0x1f')];var _0x5affd6=_0xe84233?0x0:_0x1a3a57['offset'];var _0x3e639a=_0xe84233?_0x4e4e58['count']:_0x1a3a57['offset']+_0x1a3a57[_0x3126('0x1e')];var _0x1315fa;if(_0x3e639a>=_0xde06f9){_0x3e639a=_0xde06f9;_0x1315fa=0xc8;}else{_0x1315fa=0xce;}_0x337f3c[_0x3126('0x19')](_0x1315fa);return _0x337f3c['set'](_0x3126('0x20'),_0x5affd6+'-'+_0x3e639a+'/'+_0xde06f9)[_0x3126('0x1b')](_0x4e4e58);}return null;};}function patchUpdates(_0x5f2da1){return function(_0x3d1936){try{jsonpatch[_0x3126('0x21')](_0x3d1936,_0x5f2da1,!![]);}catch(_0x6e5c8){return BPromise[_0x3126('0x22')](_0x6e5c8);}return _0x3d1936[_0x3126('0x23')]();};}function saveUpdates(_0x59b0b5,_0x63271f){return function(_0x54f124){if(_0x54f124){return _0x54f124[_0x3126('0x24')](_0x59b0b5)[_0x3126('0x25')](function(_0x298559){return _0x298559;});}return null;};}function removeEntity(_0x5147cf,_0x113cf4){return function(_0x377e49){if(_0x377e49){return _0x377e49[_0x3126('0x26')]()['then'](function(){_0x5147cf[_0x3126('0x19')](0xcc)[_0x3126('0x1a')]();});}};}function handleEntityNotFound(_0x4db826,_0xd1565c){return function(_0x42cac0){if(!_0x42cac0){_0x4db826[_0x3126('0x18')](0x194);}return _0x42cac0;};}function handleError(_0x551762,_0x2b4e90){_0x2b4e90=_0x2b4e90||0x1f4;return function(_0x5b277d){logger['error'](_0x5b277d['stack']);if(_0x5b277d['name']){delete _0x5b277d[_0x3126('0x27')];}_0x551762[_0x3126('0x19')](_0x2b4e90)['send'](_0x5b277d);};}var utilLicense=require(_0x3126('0x16'));exports[_0x3126('0x28')]=function(_0x342396,_0x4738b0){var _0x4c8e1d={'raw':!![],'where':{'id':0x1}},_0x43306f={};_0x43306f['model']=_[_0x3126('0x29')](db[_0x3126('0x2a')][_0x3126('0x2b')]);_0x43306f['query']=_[_0x3126('0x29')](_0x342396[_0x3126('0x2c')]);_0x43306f[_0x3126('0x2d')]=_[_0x3126('0x2e')](_0x43306f[_0x3126('0x2f')],_0x43306f[_0x3126('0x2c')]);_0x4c8e1d[_0x3126('0x30')]=_[_0x3126('0x2e')](_0x43306f[_0x3126('0x2f')],qs['fields'](_0x342396[_0x3126('0x2c')][_0x3126('0x31')]));_0x4c8e1d[_0x3126('0x30')]=_0x4c8e1d[_0x3126('0x30')][_0x3126('0x32')]?_0x4c8e1d[_0x3126('0x30')]:_0x43306f['model'];_0x4c8e1d=_[_0x3126('0x33')]({},_0x4c8e1d,_0x342396['options']);return utilLicense['getLicense'](_0x4c8e1d)['then'](respondWithResult(_0x4738b0,null))['catch'](handleError(_0x4738b0,null));};exports[_0x3126('0x24')]=function(_0x8f42c8,_0x429da6){if(_0x8f42c8[_0x3126('0x34')]['id']){delete _0x8f42c8[_0x3126('0x34')]['id'];}return db[_0x3126('0x2a')][_0x3126('0x35')]({'where':{'id':_0x8f42c8[_0x3126('0x36')]['id']}})[_0x3126('0x25')](handleEntityNotFound(_0x429da6,null))[_0x3126('0x25')](function(_0x296bf2){var _0x5d6425=_0x296bf2[_0x3126('0x37')]({'plain':!![]});return utilLicense[_0x3126('0x38')](_0x5d6425,_0x8f42c8[_0x3126('0x34')]['key']);})[_0x3126('0x25')](function(_0x6d432){if(!_0x6d432[_0x3126('0x39')]){return saveUpdates(_0x8f42c8[_0x3126('0x34')],null);}return _0x6d432;})[_0x3126('0x25')](respondWithResult(_0x429da6,null))[_0x3126('0x3a')](handleError(_0x429da6,null));};exports[_0x3126('0x3b')]=function(_0x2f9391,_0x15e814){var _0x4328d8=_0x3126('0x3c');var _0x23ecac=path[_0x3126('0x3d')](_0x3126('0x3e'),_0x3126('0x3f'),_0x3126('0x40'),_0x4328d8);_0x15e814['setHeader']('Content-disposition',_0x3126('0x41')+_0x4328d8);_0x15e814[_0x3126('0x42')](_0x3126('0x43'),'text/plain');_0x15e814[_0x3126('0x44')](_0x23ecac);};
\ No newline at end of file
+var _0x4223=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','../../config/license/util','index','keys','License','query','intersection','model','attributes','fields','length','merge','options','getLicense','catch','body','find','params','get','checkLicense','key','demo','downloadLogFile','join','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x17357f,_0xe5ae66){var _0x283ab9=function(_0x49013c){while(--_0x49013c){_0x17357f['push'](_0x17357f['shift']());}};_0x283ab9(++_0xe5ae66);}(_0x4223,0x1bc));var _0x3422=function(_0x2e2efa,_0x170000){_0x2e2efa=_0x2e2efa-0x0;var _0x299cc7=_0x4223[_0x2e2efa];return _0x299cc7;};'use strict';var emlformat=require(_0x3422('0x0'));var rimraf=require(_0x3422('0x1'));var zipdir=require(_0x3422('0x2'));var jsonpatch=require(_0x3422('0x3'));var rp=require(_0x3422('0x4'));var moment=require(_0x3422('0x5'));var BPromise=require(_0x3422('0x6'));var Mustache=require(_0x3422('0x7'));var util=require(_0x3422('0x8'));var path=require(_0x3422('0x9'));var sox=require(_0x3422('0xa'));var csv=require(_0x3422('0xb'));var ejs=require(_0x3422('0xc'));var fs=require('fs');var fs_extra=require(_0x3422('0xd'));var _=require(_0x3422('0xe'));var squel=require('squel');var crypto=require(_0x3422('0xf'));var jsforce=require(_0x3422('0x10'));var deskjs=require(_0x3422('0x11'));var toCsv=require(_0x3422('0xb'));var querystring=require(_0x3422('0x12'));var Papa=require(_0x3422('0x13'));var Redis=require(_0x3422('0x14'));var authService=require(_0x3422('0x15'));var qs=require(_0x3422('0x16'));var as=require(_0x3422('0x17'));var hardwareService=require(_0x3422('0x18'));var logger=require('../../config/logger')(_0x3422('0x19'));var utils=require(_0x3422('0x1a'));var config=require(_0x3422('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x3422('0x1c'))['db'];function respondWithStatusCode(_0x57723b,_0x1314c7){_0x1314c7=_0x1314c7||0xcc;return function(_0x1d3bd8){if(_0x1d3bd8){return _0x57723b[_0x3422('0x1d')](_0x1314c7);}return _0x57723b[_0x3422('0x1e')](_0x1314c7)[_0x3422('0x1f')]();};}function respondWithResult(_0x56b558,_0x2d9768){_0x2d9768=_0x2d9768||0xc8;return function(_0x35ed51){if(_0x35ed51){return _0x56b558['status'](_0x2d9768)[_0x3422('0x20')](_0x35ed51);}};}function respondWithFilteredResult(_0x3114a3,_0x260d0f){return function(_0x35c5c1){if(_0x35c5c1){var _0x2c9ead=typeof _0x260d0f[_0x3422('0x21')]===_0x3422('0x22')&&typeof _0x260d0f[_0x3422('0x23')]===_0x3422('0x22');var _0x4c478e=_0x35c5c1[_0x3422('0x24')];var _0x58ca42=_0x2c9ead?0x0:_0x260d0f[_0x3422('0x21')];var _0x27ae0b=_0x2c9ead?_0x35c5c1[_0x3422('0x24')]:_0x260d0f[_0x3422('0x21')]+_0x260d0f[_0x3422('0x23')];var _0x2fc26a;if(_0x27ae0b>=_0x4c478e){_0x27ae0b=_0x4c478e;_0x2fc26a=0xc8;}else{_0x2fc26a=0xce;}_0x3114a3[_0x3422('0x1e')](_0x2fc26a);return _0x3114a3[_0x3422('0x25')](_0x3422('0x26'),_0x58ca42+'-'+_0x27ae0b+'/'+_0x4c478e)[_0x3422('0x20')](_0x35c5c1);}return null;};}function patchUpdates(_0x3ba0f5){return function(_0x32b981){try{jsonpatch['apply'](_0x32b981,_0x3ba0f5,!![]);}catch(_0x55738e){return BPromise[_0x3422('0x27')](_0x55738e);}return _0x32b981[_0x3422('0x28')]();};}function saveUpdates(_0x135eea,_0x4c8490){return function(_0x33878c){if(_0x33878c){return _0x33878c[_0x3422('0x29')](_0x135eea)[_0x3422('0x2a')](function(_0x333b8f){return _0x333b8f;});}return null;};}function removeEntity(_0x1350c6,_0x413012){return function(_0x24971c){if(_0x24971c){return _0x24971c[_0x3422('0x2b')]()[_0x3422('0x2a')](function(){_0x1350c6[_0x3422('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51da62,_0x2b7676){return function(_0x243c90){if(!_0x243c90){_0x51da62[_0x3422('0x1d')](0x194);}return _0x243c90;};}function handleError(_0x4f9218,_0xd1dd52){_0xd1dd52=_0xd1dd52||0x1f4;return function(_0x4c05d9){logger['error'](_0x4c05d9[_0x3422('0x2c')]);if(_0x4c05d9['name']){delete _0x4c05d9[_0x3422('0x2d')];}_0x4f9218[_0x3422('0x1e')](_0xd1dd52)[_0x3422('0x2e')](_0x4c05d9);};}var utilLicense=require(_0x3422('0x2f'));exports[_0x3422('0x30')]=function(_0x8db738,_0x30e076){var _0x5d5218={'raw':!![],'where':{'id':0x1}},_0x57e4e3={};_0x57e4e3['model']=_[_0x3422('0x31')](db[_0x3422('0x32')]['rawAttributes']);_0x57e4e3[_0x3422('0x33')]=_[_0x3422('0x31')](_0x8db738[_0x3422('0x33')]);_0x57e4e3['filters']=_[_0x3422('0x34')](_0x57e4e3[_0x3422('0x35')],_0x57e4e3[_0x3422('0x33')]);_0x5d5218[_0x3422('0x36')]=_[_0x3422('0x34')](_0x57e4e3[_0x3422('0x35')],qs['fields'](_0x8db738[_0x3422('0x33')][_0x3422('0x37')]));_0x5d5218['attributes']=_0x5d5218['attributes'][_0x3422('0x38')]?_0x5d5218[_0x3422('0x36')]:_0x57e4e3['model'];_0x5d5218=_[_0x3422('0x39')]({},_0x5d5218,_0x8db738[_0x3422('0x3a')]);return utilLicense[_0x3422('0x3b')](_0x5d5218)[_0x3422('0x2a')](respondWithResult(_0x30e076,null))[_0x3422('0x3c')](handleError(_0x30e076,null));};exports[_0x3422('0x29')]=function(_0x1cfc46,_0x524eb7){if(_0x1cfc46[_0x3422('0x3d')]['id']){delete _0x1cfc46[_0x3422('0x3d')]['id'];}return db[_0x3422('0x32')][_0x3422('0x3e')]({'where':{'id':_0x1cfc46[_0x3422('0x3f')]['id']}})[_0x3422('0x2a')](handleEntityNotFound(_0x524eb7,null))['then'](function(_0x324961){var _0x2ef30f=_0x324961[_0x3422('0x40')]({'plain':!![]});return utilLicense[_0x3422('0x41')](_0x2ef30f,_0x1cfc46[_0x3422('0x3d')][_0x3422('0x42')]);})[_0x3422('0x2a')](function(_0x32d6ce){if(!_0x32d6ce[_0x3422('0x43')]){return saveUpdates(_0x1cfc46[_0x3422('0x3d')],null);}return _0x32d6ce;})[_0x3422('0x2a')](respondWithResult(_0x524eb7,null))[_0x3422('0x3c')](handleError(_0x524eb7,null));};exports[_0x3422('0x44')]=function(_0x80a1f7,_0x37c1a7){var _0x46fca1='license-info.log';var _0x1f2cd2=path[_0x3422('0x45')]('/var',_0x3422('0x46'),_0x3422('0x47'),_0x46fca1);_0x37c1a7[_0x3422('0x48')](_0x3422('0x49'),_0x3422('0x4a')+_0x46fca1);_0x37c1a7[_0x3422('0x25')](_0x3422('0x4b'),_0x3422('0x4c'));_0x37c1a7[_0x3422('0x4d')](_0x1f2cd2);};
\ No newline at end of file
index 86db2e5..ba9c368 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb3c5=['define','License','license','../../config/logger','api','moment','path','rimraf','../../config/environment','./license.attributes','exports'];(function(_0x3b1a92,_0x53f1c2){var _0x883ec3=function(_0x552435){while(--_0x552435){_0x3b1a92['push'](_0x3b1a92['shift']());}};_0x883ec3(++_0x53f1c2);}(_0xb3c5,0x66));var _0x5b3c=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xb3c5[_0x5b78e8];return _0xf2c321;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5b3c('0x0'))(_0x5b3c('0x1'));var moment=require(_0x5b3c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b3c('0x3'));var rimraf=require(_0x5b3c('0x4'));var config=require(_0x5b3c('0x5'));var attributes=require(_0x5b3c('0x6'));module[_0x5b3c('0x7')]=function(_0x553563,_0x112835){return _0x553563[_0x5b3c('0x8')](_0x5b3c('0x9'),attributes,{'tableName':_0x5b3c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x2118=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash'];(function(_0x4fa92b,_0x7d972){var _0x2a6579=function(_0x1642a3){while(--_0x1642a3){_0x4fa92b['push'](_0x4fa92b['shift']());}};_0x2a6579(++_0x7d972);}(_0x2118,0x15e));var _0x8211=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x2118[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x8211('0x0'));var util=require('util');var logger=require(_0x8211('0x1'))(_0x8211('0x2'));var moment=require(_0x8211('0x3'));var BPromise=require('bluebird');var rp=require(_0x8211('0x4'));var fs=require('fs');var path=require(_0x8211('0x5'));var rimraf=require(_0x8211('0x6'));var config=require(_0x8211('0x7'));var attributes=require(_0x8211('0x8'));module[_0x8211('0x9')]=function(_0x400b2d,_0x509ec6){return _0x400b2d[_0x8211('0xa')](_0x8211('0xb'),attributes,{'tableName':_0x8211('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 90c4555..06616ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xafea=['client','request','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x207811,_0x3420a6){var _0x170d56=function(_0x4340b7){while(--_0x4340b7){_0x207811['push'](_0x207811['shift']());}};_0x170d56(++_0x3420a6);}(_0xafea,0x187));var _0xaafe=function(_0x23cf8b,_0x354422){_0x23cf8b=_0x23cf8b-0x0;var _0x25d0c4=_0xafea[_0x23cf8b];return _0x25d0c4;};'use strict';var _=require('lodash');var util=require(_0xaafe('0x0'));var moment=require(_0xaafe('0x1'));var BPromise=require(_0xaafe('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaafe('0x3'))['db'];var utils=require(_0xaafe('0x4'));var logger=require(_0xaafe('0x5'))(_0xaafe('0x6'));var config=require('../../config/environment');var jayson=require(_0xaafe('0x7'));var client=jayson[_0xaafe('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5e42e4,_0x29c4cd,_0x112c54){return new BPromise(function(_0x87764a,_0x13819a){return client[_0xaafe('0x9')](_0x5e42e4,_0x112c54)['then'](function(_0x33138c){logger[_0xaafe('0xa')](_0xaafe('0xb'),_0x29c4cd,'request\x20sent');logger[_0xaafe('0xc')](_0xaafe('0xd'),_0x29c4cd,_0xaafe('0xe'),JSON[_0xaafe('0xf')](_0x33138c));if(_0x33138c[_0xaafe('0x10')]){if(_0x33138c[_0xaafe('0x10')][_0xaafe('0x11')]===0x1f4){logger[_0xaafe('0x10')](_0xaafe('0xb'),_0x29c4cd,_0x33138c[_0xaafe('0x10')][_0xaafe('0x12')]);return _0x13819a(_0x33138c[_0xaafe('0x10')]['message']);}logger[_0xaafe('0x10')](_0xaafe('0xb'),_0x29c4cd,_0x33138c[_0xaafe('0x10')][_0xaafe('0x12')]);return _0x87764a(_0x33138c[_0xaafe('0x10')][_0xaafe('0x12')]);}else{logger[_0xaafe('0xa')](_0xaafe('0xb'),_0x29c4cd,_0xaafe('0xe'));_0x87764a(_0x33138c[_0xaafe('0x13')][_0xaafe('0x12')]);}})[_0xaafe('0x14')](function(_0x42cd39){logger[_0xaafe('0x10')](_0xaafe('0xb'),_0x29c4cd,_0x42cd39);_0x13819a(_0x42cd39);});});}
\ No newline at end of file
+var _0x89ef=['rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','License,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2e78d8,_0x36ecc4){var _0x223dd7=function(_0x1a3c1b){while(--_0x1a3c1b){_0x2e78d8['push'](_0x2e78d8['shift']());}};_0x223dd7(++_0x36ecc4);}(_0x89ef,0x1ba));var _0xf89e=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x89ef[_0x261e29];return _0x25ef43;};'use strict';var _=require(_0xf89e('0x0'));var util=require(_0xf89e('0x1'));var moment=require(_0xf89e('0x2'));var BPromise=require(_0xf89e('0x3'));var rs=require(_0xf89e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf89e('0x5'))['db'];var utils=require(_0xf89e('0x6'));var logger=require(_0xf89e('0x7'))(_0xf89e('0x8'));var config=require(_0xf89e('0x9'));var jayson=require(_0xf89e('0xa'));var client=jayson[_0xf89e('0xb')][_0xf89e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x173738,_0x33bf8b,_0x17db91){return new BPromise(function(_0x20ab99,_0x4d9f1f){return client[_0xf89e('0xd')](_0x173738,_0x17db91)['then'](function(_0x87f30c){logger[_0xf89e('0xe')]('License,\x20%s,\x20%s',_0x33bf8b,_0xf89e('0xf'));logger[_0xf89e('0x10')](_0xf89e('0x11'),_0x33bf8b,'request\x20sent',JSON[_0xf89e('0x12')](_0x87f30c));if(_0x87f30c[_0xf89e('0x13')]){if(_0x87f30c['error'][_0xf89e('0x14')]===0x1f4){logger[_0xf89e('0x13')]('License,\x20%s,\x20%s',_0x33bf8b,_0x87f30c[_0xf89e('0x13')][_0xf89e('0x15')]);return _0x4d9f1f(_0x87f30c[_0xf89e('0x13')]['message']);}logger['error'](_0xf89e('0x16'),_0x33bf8b,_0x87f30c[_0xf89e('0x13')][_0xf89e('0x15')]);return _0x20ab99(_0x87f30c[_0xf89e('0x13')]['message']);}else{logger[_0xf89e('0xe')](_0xf89e('0x16'),_0x33bf8b,_0xf89e('0xf'));_0x20ab99(_0x87f30c[_0xf89e('0x17')][_0xf89e('0x15')]);}})[_0xf89e('0x18')](function(_0x350c78){logger[_0xf89e('0x13')]('License,\x20%s,\x20%s',_0x33bf8b,_0x350c78);_0x4d9f1f(_0x350c78);});});}
\ No newline at end of file
index 8452340..15856b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94a3=['verifySmtp','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addAnswer','create','/:id/out_servers','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','destroy','removeAgents','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','/:id/canned_answers','/:id/in_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/verify'];(function(_0x208505,_0x241a77){var _0x1a985f=function(_0x4a5110){while(--_0x4a5110){_0x208505['push'](_0x208505['shift']());}};_0x1a985f(++_0x241a77);}(_0x94a3,0x1a6));var _0x394a=function(_0x47a999,_0x557bd3){_0x47a999=_0x47a999-0x0;var _0x41fe56=_0x94a3[_0x47a999];return _0x41fe56;};'use strict';var multer=require('multer');var util=require(_0x394a('0x0'));var path=require(_0x394a('0x1'));var timeout=require('connect-timeout');var express=require(_0x394a('0x2'));var router=express[_0x394a('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x394a('0x4'));var config=require(_0x394a('0x5'));var controller=require('./mailAccount.controller');router[_0x394a('0x6')]('/',auth[_0x394a('0x7')](),controller[_0x394a('0x8')]);router[_0x394a('0x6')](_0x394a('0x9'),auth[_0x394a('0x7')](),controller['describe']);router[_0x394a('0x6')](_0x394a('0xa'),auth[_0x394a('0x7')](),controller['show']);router[_0x394a('0x6')]('/:id/dispositions',auth[_0x394a('0x7')](),controller['getDispositions']);router[_0x394a('0x6')](_0x394a('0xb'),auth[_0x394a('0x7')](),controller['getAnswers']);router[_0x394a('0x6')](_0x394a('0xc'),auth[_0x394a('0x7')](),controller['getImap']);router[_0x394a('0x6')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x394a('0xd')]);router[_0x394a('0x6')](_0x394a('0xe'),auth[_0x394a('0x7')](),controller['getInteractions']);router[_0x394a('0x6')](_0x394a('0xf'),auth[_0x394a('0x7')](),controller[_0x394a('0x10')]);router[_0x394a('0x6')]('/:id/messages',auth[_0x394a('0x7')](),controller['getMessages']);router[_0x394a('0x6')](_0x394a('0x11'),auth[_0x394a('0x7')](),controller[_0x394a('0x12')]);router[_0x394a('0x6')](_0x394a('0x13'),auth[_0x394a('0x7')](),controller[_0x394a('0x14')]);router[_0x394a('0x15')](_0x394a('0x16'),auth[_0x394a('0x7')](),controller[_0x394a('0x17')]);router[_0x394a('0x15')](_0x394a('0xb'),auth[_0x394a('0x7')](),controller[_0x394a('0x18')]);router[_0x394a('0x15')]('/',auth['isAuthenticated'](),controller[_0x394a('0x19')]);router[_0x394a('0x15')]('/:id/in_servers',auth['isAuthenticated'](),controller['addImap']);router[_0x394a('0x15')](_0x394a('0x1a'),auth['isAuthenticated'](),controller['addSmtp']);router[_0x394a('0x15')](_0x394a('0xe'),auth[_0x394a('0x7')](),controller[_0x394a('0x1b')]);router[_0x394a('0x15')](_0x394a('0xf'),auth['isAuthenticated'](),controller[_0x394a('0x1c')]);router['post'](_0x394a('0x1d'),auth['isAuthenticated'](),controller[_0x394a('0x1e')]);router['post'](_0x394a('0x13'),auth[_0x394a('0x7')](),controller[_0x394a('0x1f')]);router[_0x394a('0x20')](_0x394a('0xa'),auth[_0x394a('0x7')](),controller[_0x394a('0x21')]);router[_0x394a('0x22')](_0x394a('0x16'),auth[_0x394a('0x7')](),controller[_0x394a('0x23')]);router['delete'](_0x394a('0xb'),auth[_0x394a('0x7')](),controller[_0x394a('0x24')]);router[_0x394a('0x22')](_0x394a('0xc'),auth['isAuthenticated'](),controller[_0x394a('0x25')]);router[_0x394a('0x22')](_0x394a('0x1a'),auth[_0x394a('0x7')](),controller['removeSmtp']);router[_0x394a('0x22')](_0x394a('0xa'),auth[_0x394a('0x7')](),controller[_0x394a('0x26')]);router[_0x394a('0x22')](_0x394a('0x13'),auth[_0x394a('0x7')](),controller[_0x394a('0x27')]);module['exports']=router;
\ No newline at end of file
+var _0xbac7=['../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','/:id/canned_answers','create','addSmtp','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x54ed1d,_0x32a01c){var _0x1494ac=function(_0x37b56e){while(--_0x37b56e){_0x54ed1d['push'](_0x54ed1d['shift']());}};_0x1494ac(++_0x32a01c);}(_0xbac7,0x149));var _0x7bac=function(_0x5e84ad,_0x1189ec){_0x5e84ad=_0x5e84ad-0x0;var _0x5a88e5=_0xbac7[_0x5e84ad];return _0x5a88e5;};'use strict';var multer=require(_0x7bac('0x0'));var util=require(_0x7bac('0x1'));var path=require(_0x7bac('0x2'));var timeout=require(_0x7bac('0x3'));var express=require(_0x7bac('0x4'));var router=express['Router']();var fs_extra=require(_0x7bac('0x5'));var auth=require(_0x7bac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7bac('0x7'));var controller=require(_0x7bac('0x8'));router[_0x7bac('0x9')]('/',auth[_0x7bac('0xa')](),controller[_0x7bac('0xb')]);router[_0x7bac('0x9')](_0x7bac('0xc'),auth[_0x7bac('0xa')](),controller['describe']);router['get'](_0x7bac('0xd'),auth[_0x7bac('0xa')](),controller[_0x7bac('0xe')]);router[_0x7bac('0x9')](_0x7bac('0xf'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x10')]);router[_0x7bac('0x9')]('/:id/canned_answers',auth[_0x7bac('0xa')](),controller[_0x7bac('0x11')]);router[_0x7bac('0x9')](_0x7bac('0x12'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x13')]);router['get'](_0x7bac('0x14'),auth[_0x7bac('0xa')](),controller['getSmtp']);router[_0x7bac('0x9')](_0x7bac('0x15'),auth['isAuthenticated'](),controller[_0x7bac('0x16')]);router[_0x7bac('0x9')](_0x7bac('0x17'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x18')]);router['get'](_0x7bac('0x19'),auth[_0x7bac('0xa')](),controller['getMessages']);router[_0x7bac('0x9')](_0x7bac('0x1a'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x1b')]);router[_0x7bac('0x9')](_0x7bac('0x1c'),auth[_0x7bac('0xa')](),controller['getAgents']);router[_0x7bac('0x1d')]('/:id/dispositions',auth[_0x7bac('0xa')](),controller[_0x7bac('0x1e')]);router[_0x7bac('0x1d')](_0x7bac('0x1f'),auth['isAuthenticated'](),controller['addAnswer']);router['post']('/',auth[_0x7bac('0xa')](),controller[_0x7bac('0x20')]);router[_0x7bac('0x1d')]('/:id/in_servers',auth[_0x7bac('0xa')](),controller['addImap']);router[_0x7bac('0x1d')](_0x7bac('0x14'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x21')]);router[_0x7bac('0x1d')](_0x7bac('0x15'),auth['isAuthenticated'](),controller[_0x7bac('0x22')]);router[_0x7bac('0x1d')](_0x7bac('0x17'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x23')]);router['post'](_0x7bac('0x24'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x25')]);router[_0x7bac('0x1d')]('/:id/users',auth[_0x7bac('0xa')](),controller[_0x7bac('0x26')]);router[_0x7bac('0x27')](_0x7bac('0xd'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x28')]);router[_0x7bac('0x29')](_0x7bac('0xf'),auth['isAuthenticated'](),controller[_0x7bac('0x2a')]);router[_0x7bac('0x29')](_0x7bac('0x1f'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x2b')]);router[_0x7bac('0x29')](_0x7bac('0x12'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x2c')]);router[_0x7bac('0x29')]('/:id/out_servers',auth[_0x7bac('0xa')](),controller[_0x7bac('0x2d')]);router['delete']('/:id',auth[_0x7bac('0xa')](),controller['destroy']);router[_0x7bac('0x29')](_0x7bac('0x1c'),auth[_0x7bac('0xa')](),controller[_0x7bac('0x2e')]);module[_0x7bac('0x2f')]=router;
\ No newline at end of file
index 5298a21..850a997 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10bd=['Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}<br/>Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x10bd,0x148));var _0xd10b=function(_0xc6ae32,_0x1d6e5a){_0xc6ae32=_0xc6ae32-0x0;var _0x3e3690=_0x10bd[_0xc6ae32];return _0x3e3690;};'use strict';var Sequelize=require(_0xd10b('0x0'));module[_0xd10b('0x1')]={'description':{'type':Sequelize[_0xd10b('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0xd10b('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd10b('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0xd10b('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xd10b('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xd10b('0x2')],'allowNull':![],'defaultValue':_0xd10b('0x5')},'fontSize':{'type':Sequelize[_0xd10b('0x6')](0x2)[_0xd10b('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd10b('0x8');}},'notificationSound':{'type':Sequelize[_0xd10b('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd10b('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd10b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd10b('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd10b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd10b('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd10b('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd10b('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xd10b('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xd10b('0x3')],'defaultValue':![],'comment':_0xd10b('0xa'),'set':function(_0x19ec96){if(!_0x19ec96)this[_0xd10b('0xb')](_0xd10b('0xc'),null);this[_0xd10b('0xb')](_0xd10b('0xd'),_0x19ec96);}},'provider':{'type':Sequelize[_0xd10b('0xe')](_0xd10b('0xf'),'hotmail',_0xd10b('0x10'),_0xd10b('0x11')),'defaultValue':null,'get':function(){if(!this[_0xd10b('0x12')](_0xd10b('0x13')))return _0xd10b('0x14');return this['getDataValue'](_0xd10b('0x13'));},'set':function(_0x37c64a){if(_0x37c64a===_0xd10b('0x14'))_0x37c64a=null;return this[_0xd10b('0xb')](_0xd10b('0x13'),_0x37c64a);}}};
\ No newline at end of file
+var _0xcc69=['TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}<br/>Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcc69,0x7a));var _0x9cc6=function(_0x1f2b50,_0x20b570){_0x1f2b50=_0x1f2b50-0x0;var _0x5675c1=_0xcc69[_0x1f2b50];return _0x5675c1;};'use strict';var Sequelize=require(_0x9cc6('0x0'));module[_0x9cc6('0x1')]={'description':{'type':Sequelize[_0x9cc6('0x2')]},'name':{'type':Sequelize[_0x9cc6('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9cc6('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x9cc6('0x4')]},'markAsUnread':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9cc6('0x5')},'fontSize':{'type':Sequelize[_0x9cc6('0x6')](0x2)[_0x9cc6('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9cc6('0x4')],'defaultValue':function(){return _0x9cc6('0x8');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9cc6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9cc6('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9cc6('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x9cc6('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9cc6('0xa'),'set':function(_0x330529){if(!_0x330529)this[_0x9cc6('0xb')](_0x9cc6('0xc'),null);this[_0x9cc6('0xb')]('mandatoryDisposition',_0x330529);}},'provider':{'type':Sequelize[_0x9cc6('0xd')](_0x9cc6('0xe'),_0x9cc6('0xf'),_0x9cc6('0x10'),_0x9cc6('0x11')),'defaultValue':null,'get':function(){if(!this[_0x9cc6('0x12')](_0x9cc6('0x13')))return _0x9cc6('0x14');return this[_0x9cc6('0x12')](_0x9cc6('0x13'));},'set':function(_0x55351c){if(_0x55351c==='custom')_0x55351c=null;return this[_0x9cc6('0xb')](_0x9cc6('0x13'),_0x55351c);}}};
\ No newline at end of file
index 06bae53..d646c74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4530=['MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','messageId','subject','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','ValidationError','addAgents','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','User','getAgents','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','update','destroy','get','UserProfileResource','stack','name','gmail','imap.gmail.com','imap.mail.yahoo.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp.office365.com','user','username','pass','password','modernAuthentication','CloudProviderId','host','secure','service','authentication','Imap','port','Smtp','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','MailAccount','includeAll','rows','show','params','MailServerIn','include','body','provider','find','Mail\x20Account\x20not\x20found','describe','addDisposition','create','getDispositions','findOne','Disposition','order','pick','MailAccountId','options','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','setImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','Owner','fullname','internal','Tag','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS'];(function(_0x1f3244,_0x23cd4f){var _0x14c9c0=function(_0x2b87b2){while(--_0x2b87b2){_0x1f3244['push'](_0x1f3244['shift']());}};_0x14c9c0(++_0x23cd4f);}(_0x4530,0xed));var _0x0453=function(_0x244edc,_0x5f18ce){_0x244edc=_0x244edc-0x0;var _0x1b7811=_0x4530[_0x244edc];return _0x1b7811;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require('util');var path=require('path');var _=require(_0x0453('0x0'));var juice=require(_0x0453('0x1'));var Redis=require(_0x0453('0x2'));var qs=require(_0x0453('0x3'));var logger=require(_0x0453('0x4'))(_0x0453('0x5'));var config=require(_0x0453('0x6'));var db=require('../../mysqldb')['db'];config[_0x0453('0x7')]=_[_0x0453('0x8')](config[_0x0453('0x7')],{'host':_0x0453('0x9'),'port':0x18eb});var socket=require(_0x0453('0xa'))(new Redis(config[_0x0453('0x7')]));require(_0x0453('0xb'))[_0x0453('0xc')](socket);var jayson=require(_0x0453('0xd'));var client=jayson['client'][_0x0453('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x4e0c81,_0x2d1477,_0x11015d,_0xd5d743){return new BPromise(function(_0x50151,_0x18489a){var _0x42626b=_0xd5d743||client;return _0x42626b['request'](_0x4e0c81,_0x11015d)[_0x0453('0xf')](function(_0x1f3327){logger['info'](_0x0453('0x10'),_0x2d1477,_0x0453('0x11'));logger[_0x0453('0x12')](_0x0453('0x13'),_0x2d1477,_0x0453('0x11'),JSON[_0x0453('0x14')](_0x1f3327));if(_0x1f3327[_0x0453('0x15')]){if(_0x1f3327[_0x0453('0x15')][_0x0453('0x16')]===0x1f4){logger[_0x0453('0x15')](_0x0453('0x10'),_0x2d1477,_0x1f3327[_0x0453('0x15')]['message']);return _0x18489a(_0x1f3327[_0x0453('0x15')][_0x0453('0x17')]);}logger[_0x0453('0x15')]('MailAccount,\x20%s,\x20%s',_0x2d1477,_0x1f3327['error'][_0x0453('0x17')]);return _0x50151(_0x1f3327['error'][_0x0453('0x17')]);}else{logger[_0x0453('0x18')](_0x0453('0x10'),_0x2d1477,_0x0453('0x11'));_0x50151(_0x1f3327['result'][_0x0453('0x17')]);}})[_0x0453('0x19')](function(_0x4a05cc){logger['error'](_0x0453('0x10'),_0x2d1477,_0x4a05cc);_0x18489a(_0x4a05cc);});});}function respondWithStatusCode(_0x40f9b0,_0x94c625){_0x94c625=_0x94c625||0xcc;return function(_0x294b09){if(_0x294b09){return _0x40f9b0[_0x0453('0x1a')](_0x94c625);}return _0x40f9b0[_0x0453('0x1b')](_0x94c625)[_0x0453('0x1c')]();};}function respondWithResult(_0x3e6f8a,_0x2938a0){_0x2938a0=_0x2938a0||0xc8;return function(_0x44b00){if(_0x44b00){return _0x3e6f8a['status'](_0x2938a0)[_0x0453('0x1d')](_0x44b00);}};}function respondWithFilteredResult(_0x3871ff,_0x372c8c){return function(_0x91415){if(_0x91415){var _0x444d8f=typeof _0x372c8c['offset']===_0x0453('0x1e')&&typeof _0x372c8c[_0x0453('0x1f')]===_0x0453('0x1e');var _0x3b042a=_0x91415[_0x0453('0x20')];var _0x2c0673=_0x444d8f?0x0:_0x372c8c[_0x0453('0x21')];var _0x2c2672=_0x444d8f?_0x91415[_0x0453('0x20')]:_0x372c8c[_0x0453('0x21')]+_0x372c8c[_0x0453('0x1f')];var _0x108634;if(_0x2c2672>=_0x3b042a){_0x2c2672=_0x3b042a;_0x108634=0xc8;}else{_0x108634=0xce;}_0x3871ff[_0x0453('0x1b')](_0x108634);return _0x3871ff[_0x0453('0x22')]('Content-Range',_0x2c0673+'-'+_0x2c2672+'/'+_0x3b042a)[_0x0453('0x1d')](_0x91415);}return null;};}function saveUpdates(_0x3c21ba){return function(_0x4642c0){if(_0x4642c0){return _0x4642c0[_0x0453('0x23')](_0x3c21ba)['then'](function(_0x452edd){return _0x452edd;});}return null;};}function removeEntity(_0x501007){return function(_0x5b310e){if(_0x5b310e){return _0x5b310e[_0x0453('0x24')]()[_0x0453('0xf')](function(){var _0x4d8ccb=_0x5b310e[_0x0453('0x25')]({'plain':!![]});var _0xc027c2='MailAccounts';return db[_0x0453('0x26')][_0x0453('0x24')]({'where':{'type':_0xc027c2,'resourceId':_0x4d8ccb['id']}})[_0x0453('0xf')](function(){return _0x5b310e;});})[_0x0453('0xf')](function(){_0x501007[_0x0453('0x1b')](0xcc)[_0x0453('0x1c')]();});}};}function handleEntityNotFound(_0x1a0eb3){return function(_0x12994d){if(!_0x12994d){_0x1a0eb3[_0x0453('0x1a')](0x194);}return _0x12994d;};}function handleError(_0x5d356f,_0x55fe25){_0x55fe25=_0x55fe25||0x1f4;return function(_0x570a3c){logger['error'](_0x570a3c[_0x0453('0x27')]);if(_0x570a3c[_0x0453('0x28')]){delete _0x570a3c[_0x0453('0x28')];}_0x5d356f['status'](_0x55fe25)['send'](_0x570a3c);};}function getImapHost(_0x50ac20){switch(_0x50ac20){case _0x0453('0x29'):return _0x0453('0x2a');case'yahoo':return _0x0453('0x2b');case'hotmail':return'imap-mail.outlook.com';case _0x0453('0x2c'):return _0x0453('0x2d');}throw new Error(_0x0453('0x2e'),_0x50ac20);}function getSmtpHost(_0xee8d94){switch(_0xee8d94){case _0x0453('0x29'):return _0x0453('0x2f');case'yahoo':return _0x0453('0x30');case'hotmail':return'smtp-mail.outlook.com';case _0x0453('0x2c'):return _0x0453('0x31');}throw new Error('Unknown\x20email\x20service\x20provider',_0xee8d94);}function getAuthenticationOptions(_0x107777,_0x54e8d8){var _0x21b12d={};var _0x24f4e9={};if(_0x107777){_0x21b12d[_0x0453('0x32')]=_0x24f4e9[_0x0453('0x32')]=_0x54e8d8[_0x0453('0x33')];_0x21b12d['password']=_0x24f4e9[_0x0453('0x34')]=_0x54e8d8[_0x0453('0x35')];if(_0x54e8d8['modernAuthentication']){_0x21b12d[_0x0453('0x36')]=_0x24f4e9['modernAuthentication']=!![];_0x21b12d[_0x0453('0x37')]=_0x24f4e9[_0x0453('0x37')]=_0x54e8d8[_0x0453('0x37')];_0x21b12d[_0x0453('0x35')]=_0x24f4e9[_0x0453('0x34')]=null;}else{_0x21b12d[_0x0453('0x37')]=_0x24f4e9[_0x0453('0x37')]=null;}_0x21b12d[_0x0453('0x38')]=getImapHost(_0x107777);_0x21b12d['port']=0x3e1;_0x24f4e9[_0x0453('0x38')]=getSmtpHost(_0x107777);_0x24f4e9['port']=0x24b;_0x24f4e9[_0x0453('0x39')]=![];_0x21b12d[_0x0453('0x3a')]=_0x24f4e9[_0x0453('0x3a')]=null;}else{if(_0x54e8d8[_0x0453('0x3b')]){_0x21b12d[_0x0453('0x32')]=_0x24f4e9[_0x0453('0x32')]=_0x54e8d8['username'];_0x21b12d[_0x0453('0x35')]=_0x24f4e9['pass']=_0x54e8d8['password'];}else{_0x21b12d[_0x0453('0x3b')]=_0x24f4e9[_0x0453('0x3b')]=![];_0x21b12d[_0x0453('0x32')]=_0x24f4e9['user']=null;_0x21b12d[_0x0453('0x35')]=_0x24f4e9[_0x0453('0x34')]=null;}_0x21b12d[_0x0453('0x38')]=_0x54e8d8[_0x0453('0x3c')][_0x0453('0x38')];_0x21b12d['port']=_0x54e8d8['Imap'][_0x0453('0x3d')];_0x24f4e9[_0x0453('0x38')]=_0x54e8d8[_0x0453('0x3e')][_0x0453('0x38')];_0x24f4e9[_0x0453('0x3d')]=_0x54e8d8[_0x0453('0x3e')][_0x0453('0x3d')];}return{'Imap':_0x21b12d,'Smtp':_0x24f4e9};}exports['index']=function(_0x2789b7,_0xeae8f6){var _0x52f8f9={'include':[{'model':db['MailServerIn'],'as':_0x0453('0x3c')},{'model':db[_0x0453('0x3f')],'as':'Smtp'},{'model':db[_0x0453('0x40')],'as':_0x0453('0x41')}]},_0x488553={},_0x512ec1={'count':0x0,'rows':[]};var _0x16e457=_[_0x0453('0x42')](db['MailAccount'][_0x0453('0x43')],function(_0x139273){return{'name':_0x139273[_0x0453('0x44')],'type':_0x139273[_0x0453('0x45')][_0x0453('0x46')]};});_0x488553[_0x0453('0x47')]=_[_0x0453('0x42')](_0x16e457,_0x0453('0x28'));_0x488553[_0x0453('0x48')]=_[_0x0453('0x49')](_0x2789b7[_0x0453('0x48')]);_0x488553[_0x0453('0x4a')]=_[_0x0453('0x4b')](_0x488553['model'],_0x488553[_0x0453('0x48')]);_0x52f8f9[_0x0453('0x4c')]=_[_0x0453('0x4b')](_0x488553[_0x0453('0x47')],qs['fields'](_0x2789b7['query'][_0x0453('0x4d')]));_0x52f8f9['attributes']=_0x52f8f9[_0x0453('0x4c')][_0x0453('0x4e')]?_0x52f8f9[_0x0453('0x4c')]:_0x488553[_0x0453('0x47')];if(!_0x2789b7[_0x0453('0x48')][_0x0453('0x4f')](_0x0453('0x50'))){_0x52f8f9[_0x0453('0x1f')]=qs[_0x0453('0x1f')](_0x2789b7[_0x0453('0x48')]['limit']);_0x52f8f9[_0x0453('0x21')]=qs['offset'](_0x2789b7[_0x0453('0x48')][_0x0453('0x21')]);}_0x52f8f9['order']=qs[_0x0453('0x51')](_0x2789b7['query']['sort']);_0x52f8f9[_0x0453('0x52')]=qs['filters'](_['pick'](_0x2789b7[_0x0453('0x48')],_0x488553[_0x0453('0x4a')]),_0x16e457);if(_0x2789b7['query'][_0x0453('0x53')]){_0x52f8f9[_0x0453('0x52')]=_[_0x0453('0x54')](_0x52f8f9[_0x0453('0x52')],{'$or':_['map'](_0x16e457,function(_0x34b356){if(_0x34b356[_0x0453('0x45')]!=='VIRTUAL'){var _0x595f9f={};_0x595f9f[_0x34b356[_0x0453('0x28')]]={'$like':'%'+_0x2789b7[_0x0453('0x48')][_0x0453('0x53')]+'%'};return _0x595f9f;}})});}_0x52f8f9=_[_0x0453('0x54')]({},_0x52f8f9,_0x2789b7['options']);var _0x5e6977={'where':_0x52f8f9[_0x0453('0x52')]};return db[_0x0453('0x55')]['count'](_0x5e6977)['then'](function(_0x46954d){_0x512ec1[_0x0453('0x20')]=_0x46954d;if(_0x2789b7[_0x0453('0x48')][_0x0453('0x56')]){_0x52f8f9['include']=[{'all':!![]}];}return db[_0x0453('0x55')]['findAll'](_0x52f8f9);})['then'](function(_0x3060f2){_0x512ec1[_0x0453('0x57')]=_0x3060f2;return _0x512ec1;})[_0x0453('0xf')](respondWithFilteredResult(_0xeae8f6,_0x52f8f9))[_0x0453('0x19')](handleError(_0xeae8f6,null));};exports[_0x0453('0x58')]=function(_0x271f79,_0x4ed35f){var _0x3dd1d7={'raw':![],'where':{'id':_0x271f79[_0x0453('0x59')]['id']},'include':[{'model':db[_0x0453('0x5a')],'as':_0x0453('0x3c')},{'model':db[_0x0453('0x3f')],'as':'Smtp'},{'model':db[_0x0453('0x40')],'as':_0x0453('0x41')}]},_0x1bad1f={};_0x1bad1f['model']=_[_0x0453('0x49')](db[_0x0453('0x55')][_0x0453('0x43')]);_0x1bad1f[_0x0453('0x48')]=_[_0x0453('0x49')](_0x271f79[_0x0453('0x48')]);_0x1bad1f[_0x0453('0x4a')]=_[_0x0453('0x4b')](_0x1bad1f[_0x0453('0x47')],_0x1bad1f['query']);_0x3dd1d7[_0x0453('0x4c')]=_[_0x0453('0x4b')](_0x1bad1f[_0x0453('0x47')],qs[_0x0453('0x4d')](_0x271f79['query'][_0x0453('0x4d')]));_0x3dd1d7[_0x0453('0x4c')]=_0x3dd1d7['attributes'][_0x0453('0x4e')]?_0x3dd1d7[_0x0453('0x4c')]:_0x1bad1f['model'];if(_0x271f79['query'][_0x0453('0x56')]){_0x3dd1d7[_0x0453('0x5b')]=[{'all':!![]}];}_0x3dd1d7=_['merge']({},_0x3dd1d7,_0x271f79['options']);return db[_0x0453('0x55')]['find'](_0x3dd1d7)['then'](handleEntityNotFound(_0x4ed35f,null))[_0x0453('0xf')](respondWithResult(_0x4ed35f,null))[_0x0453('0x19')](handleError(_0x4ed35f,null));};exports[_0x0453('0x23')]=function(_0x546447,_0x43e6f2){if(_0x546447[_0x0453('0x5c')]['id']){delete _0x546447['body']['id'];}var _0x32b0e5=_0x546447[_0x0453('0x5c')][_0x0453('0x5d')]==='custom'?null:_0x546447[_0x0453('0x5c')]['provider'];var _0x43723d=_0x546447['body'][_0x0453('0x3c')]||{};var _0x383c91=_0x546447[_0x0453('0x5c')][_0x0453('0x3e')]||{};if(_0x32b0e5){_0x43723d[_0x0453('0x38')]=getImapHost(_0x32b0e5);_0x43723d['port']=0x3e1;_0x383c91[_0x0453('0x38')]=getSmtpHost(_0x32b0e5);_0x383c91[_0x0453('0x3d')]=0x24b;_0x383c91[_0x0453('0x39')]=![];}if(_0x383c91[_0x0453('0x36')]){_0x383c91[_0x0453('0x39')]=![];}else{_0x383c91[_0x0453('0x37')]=null;}if(!_0x43723d['modernAuthentication'])_0x43723d[_0x0453('0x37')]=null;_0x546447[_0x0453('0x5c')][_0x0453('0x3c')]=_0x43723d;_0x546447[_0x0453('0x5c')][_0x0453('0x3e')]=_0x383c91;return db[_0x0453('0x55')][_0x0453('0x5e')]({'where':{'id':_0x546447['params']['id']},'include':[{'model':db[_0x0453('0x5a')],'as':'Imap'},{'model':db[_0x0453('0x3f')],'as':_0x0453('0x3e')},{'model':db[_0x0453('0x40')],'as':_0x0453('0x41')}]})[_0x0453('0xf')](handleEntityNotFound(_0x43e6f2,null))[_0x0453('0xf')](function(_0x4289fe){if(!_0x4289fe)throw new Error(_0x0453('0x5f'));if(_0x4289fe[_0x0453('0x3a')])delete _0x546447[_0x0453('0x5c')][_0x0453('0x3c')];return _0x4289fe;})[_0x0453('0xf')](saveUpdates(_0x546447[_0x0453('0x5c')],null))[_0x0453('0xf')](function(_0x32a15c){if(!_0x546447[_0x0453('0x5c')][_0x0453('0x3c')])return _0x32a15c;return db[_0x0453('0x5a')]['update'](_0x546447[_0x0453('0x5c')]['Imap'],{'where':{'MailAccountId':_0x32a15c['id']}})[_0x0453('0xf')](function(){return _0x32a15c;});})[_0x0453('0xf')](function(_0x49f71e){if(!_0x546447[_0x0453('0x5c')][_0x0453('0x3e')])return _0x49f71e;return db[_0x0453('0x3f')][_0x0453('0x23')](_0x546447[_0x0453('0x5c')][_0x0453('0x3e')],{'where':{'MailAccountId':_0x49f71e['id']}})[_0x0453('0xf')](function(){return _0x49f71e;});})['then'](respondWithResult(_0x43e6f2,null))[_0x0453('0x19')](handleError(_0x43e6f2,null));};exports[_0x0453('0x60')]=function(_0x5978a6,_0x533d64){return db[_0x0453('0x55')]['describe']()[_0x0453('0xf')](respondWithResult(_0x533d64,null))[_0x0453('0x19')](handleError(_0x533d64,null));};exports[_0x0453('0x61')]=function(_0x4f2f61,_0x5a4933){if(_0x4f2f61['body']['id']){delete _0x4f2f61['body']['id'];}return db['MailAccount'][_0x0453('0x5e')]({'where':{'id':_0x4f2f61['params']['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x5a4933,null))[_0x0453('0xf')](function(_0x3d8b70){if(_0x3d8b70){_0x4f2f61['body']['MailAccountId']=_0x3d8b70['id'];return db['Disposition'][_0x0453('0x62')](_0x4f2f61[_0x0453('0x5c')]);}})['then'](respondWithResult(_0x5a4933,null))[_0x0453('0x19')](handleError(_0x5a4933,null));};exports[_0x0453('0x63')]=function(_0x570d4d,_0x2a52cc){var _0x21be5b={'raw':![],'where':{}};var _0x4cc821={};var _0x4c2208={'count':0x0,'rows':[]};return db[_0x0453('0x55')][_0x0453('0x64')]({'where':{'id':_0x570d4d[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x2a52cc,null))['then'](function(_0x3e5762){if(_0x3e5762){_0x4cc821[_0x0453('0x47')]=_[_0x0453('0x49')](db[_0x0453('0x65')][_0x0453('0x43')]);_0x4cc821[_0x0453('0x48')]=_[_0x0453('0x49')](_0x570d4d[_0x0453('0x48')]);_0x4cc821[_0x0453('0x4a')]=_[_0x0453('0x4b')](_0x4cc821[_0x0453('0x47')],_0x4cc821[_0x0453('0x48')]);_0x21be5b[_0x0453('0x4c')]=_[_0x0453('0x4b')](_0x4cc821['model'],qs[_0x0453('0x4d')](_0x570d4d['query']['fields']));_0x21be5b[_0x0453('0x4c')]=_0x21be5b[_0x0453('0x4c')][_0x0453('0x4e')]?_0x21be5b[_0x0453('0x4c')]:_0x4cc821[_0x0453('0x47')];if(!_0x570d4d[_0x0453('0x48')][_0x0453('0x4f')]('nolimit')){_0x21be5b[_0x0453('0x1f')]=qs['limit'](_0x570d4d[_0x0453('0x48')][_0x0453('0x1f')]);_0x21be5b[_0x0453('0x21')]=qs['offset'](_0x570d4d[_0x0453('0x48')][_0x0453('0x21')]);}_0x21be5b[_0x0453('0x66')]=qs[_0x0453('0x51')](_0x570d4d[_0x0453('0x48')][_0x0453('0x51')]);_0x21be5b['where']=qs[_0x0453('0x4a')](_[_0x0453('0x67')](_0x570d4d['query'],_0x4cc821[_0x0453('0x4a')]));_0x21be5b[_0x0453('0x52')][_0x0453('0x68')]=_0x3e5762['id'];if(_0x570d4d[_0x0453('0x48')][_0x0453('0x53')]){_0x21be5b['where']=_[_0x0453('0x54')](_0x21be5b[_0x0453('0x52')],{'$or':_[_0x0453('0x42')](_0x21be5b[_0x0453('0x4c')],function(_0x5f06e8){var _0x4550a0={};_0x4550a0[_0x5f06e8]={'$like':'%'+_0x570d4d[_0x0453('0x48')][_0x0453('0x53')]+'%'};return _0x4550a0;})});}_0x21be5b=_['merge']({},_0x21be5b,_0x570d4d[_0x0453('0x69')]);return db[_0x0453('0x65')][_0x0453('0x20')]({'where':_0x21be5b[_0x0453('0x52')]})[_0x0453('0xf')](function(_0x4f45e4){_0x4c2208[_0x0453('0x20')]=_0x4f45e4;if(_0x570d4d['query']['includeAll']){_0x21be5b[_0x0453('0x5b')]=[{'all':!![]}];}return db[_0x0453('0x65')][_0x0453('0x6a')](_0x21be5b);})[_0x0453('0xf')](function(_0x473785){_0x4c2208[_0x0453('0x57')]=_0x473785;return _0x4c2208;});}})[_0x0453('0xf')](respondWithFilteredResult(_0x2a52cc,_0x21be5b))[_0x0453('0x19')](handleError(_0x2a52cc,null));};exports['removeDispositions']=function(_0xaf7fc0,_0x255c56){return db[_0x0453('0x55')]['find']({'where':{'id':_0xaf7fc0[_0x0453('0x59')]['id']}})['then'](handleEntityNotFound(_0x255c56,null))[_0x0453('0xf')](function(_0x2c5f10){if(_0x2c5f10){return _0x2c5f10[_0x0453('0x6b')](_0xaf7fc0['query'][_0x0453('0x6c')]);}})[_0x0453('0xf')](respondWithStatusCode(_0x255c56,null))[_0x0453('0x19')](handleError(_0x255c56,null));};exports[_0x0453('0x6d')]=function(_0x12b54b,_0x23a3d5){if(_0x12b54b[_0x0453('0x5c')]['id']){delete _0x12b54b[_0x0453('0x5c')]['id'];}return db[_0x0453('0x55')][_0x0453('0x5e')]({'where':{'id':_0x12b54b[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x23a3d5,null))[_0x0453('0xf')](function(_0x22c36a){if(_0x22c36a){_0x12b54b['body'][_0x0453('0x68')]=_0x22c36a['id'];return db[_0x0453('0x6e')][_0x0453('0x62')](_0x12b54b[_0x0453('0x5c')]);}})['then'](respondWithResult(_0x23a3d5,null))[_0x0453('0x19')](handleError(_0x23a3d5,null));};exports[_0x0453('0x6f')]=function(_0x5b0869,_0xc2e408){var _0xd0efbc={'raw':![],'where':{}};var _0x5343bd={};var _0x136a35={'count':0x0,'rows':[]};return db[_0x0453('0x55')][_0x0453('0x64')]({'where':{'id':_0x5b0869[_0x0453('0x59')]['id']}})['then'](handleEntityNotFound(_0xc2e408,null))[_0x0453('0xf')](function(_0xe9a8f6){if(_0xe9a8f6){_0x5343bd[_0x0453('0x47')]=_['keys'](db['CannedAnswer'][_0x0453('0x43')]);_0x5343bd[_0x0453('0x48')]=_[_0x0453('0x49')](_0x5b0869[_0x0453('0x48')]);_0x5343bd[_0x0453('0x4a')]=_['intersection'](_0x5343bd['model'],_0x5343bd[_0x0453('0x48')]);_0xd0efbc['attributes']=_['intersection'](_0x5343bd[_0x0453('0x47')],qs[_0x0453('0x4d')](_0x5b0869['query'][_0x0453('0x4d')]));_0xd0efbc[_0x0453('0x4c')]=_0xd0efbc[_0x0453('0x4c')]['length']?_0xd0efbc[_0x0453('0x4c')]:_0x5343bd[_0x0453('0x47')];if(!_0x5b0869[_0x0453('0x48')]['hasOwnProperty'](_0x0453('0x50'))){_0xd0efbc[_0x0453('0x1f')]=qs[_0x0453('0x1f')](_0x5b0869[_0x0453('0x48')][_0x0453('0x1f')]);_0xd0efbc[_0x0453('0x21')]=qs[_0x0453('0x21')](_0x5b0869[_0x0453('0x48')]['offset']);}_0xd0efbc[_0x0453('0x66')]=qs[_0x0453('0x51')](_0x5b0869[_0x0453('0x48')][_0x0453('0x51')]);_0xd0efbc[_0x0453('0x52')]=qs[_0x0453('0x4a')](_[_0x0453('0x67')](_0x5b0869[_0x0453('0x48')],_0x5343bd[_0x0453('0x4a')]));_0xd0efbc[_0x0453('0x52')][_0x0453('0x68')]=_0xe9a8f6['id'];if(_0x5b0869[_0x0453('0x48')][_0x0453('0x53')]){_0xd0efbc['where']=_[_0x0453('0x54')](_0xd0efbc[_0x0453('0x52')],{'$or':_['map'](_0xd0efbc[_0x0453('0x4c')],function(_0x22cbf0){var _0x454f68={};_0x454f68[_0x22cbf0]={'$like':'%'+_0x5b0869[_0x0453('0x48')][_0x0453('0x53')]+'%'};return _0x454f68;})});}_0xd0efbc=_[_0x0453('0x54')]({},_0xd0efbc,_0x5b0869['options']);return db[_0x0453('0x6e')][_0x0453('0x20')]({'where':_0xd0efbc['where']})[_0x0453('0xf')](function(_0x2a0fd6){_0x136a35[_0x0453('0x20')]=_0x2a0fd6;if(_0x5b0869[_0x0453('0x48')][_0x0453('0x56')]){_0xd0efbc[_0x0453('0x5b')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0xd0efbc);})['then'](function(_0x229d5b){_0x136a35[_0x0453('0x57')]=_0x229d5b;return _0x136a35;});}})[_0x0453('0xf')](respondWithFilteredResult(_0xc2e408,_0xd0efbc))[_0x0453('0x19')](handleError(_0xc2e408,null));};exports[_0x0453('0x70')]=function(_0x75a344,_0x40316f){return db[_0x0453('0x55')]['find']({'where':{'id':_0x75a344[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x40316f,null))['then'](function(_0x2b8560){if(_0x2b8560){return _0x2b8560['removeAnswers'](_0x75a344['query']['ids']);}})['then'](respondWithStatusCode(_0x40316f,null))[_0x0453('0x19')](handleError(_0x40316f,null));};exports[_0x0453('0x62')]=function(_0x1f5e10,_0x309dec){var _0x468ef3={'name':_0x1f5e10[_0x0453('0x5c')][_0x0453('0x28')],'key':_0x1f5e10[_0x0453('0x5c')]['key'],'provider':_0x1f5e10[_0x0453('0x5c')][_0x0453('0x5d')]===_0x0453('0x71')?null:_0x1f5e10['body'][_0x0453('0x5d')],'email':_0x1f5e10[_0x0453('0x5c')][_0x0453('0x72')],'ListId':_0x1f5e10[_0x0453('0x5c')][_0x0453('0x73')],'active':!_[_0x0453('0x74')](_0x1f5e10[_0x0453('0x5c')][_0x0453('0x75')])?_0x1f5e10[_0x0453('0x5c')][_0x0453('0x75')]:!![],'description':_0x1f5e10[_0x0453('0x5c')][_0x0453('0x76')]||null};var _0x2389f5=getAuthenticationOptions(_0x468ef3['provider'],_0x1f5e10[_0x0453('0x5c')]);_0x468ef3[_0x0453('0x3c')]=_0x2389f5[_0x0453('0x3c')];_0x468ef3['Smtp']=_0x2389f5['Smtp'];return db[_0x0453('0x55')]['create'](_0x468ef3,{'include':[{'model':db[_0x0453('0x3f')],'as':_0x0453('0x3e')},{'model':db[_0x0453('0x5a')],'as':'Imap'}]})['then'](function(_0x280f61){var _0x1c3647=_0x1f5e10['user'][_0x0453('0x25')]({'plain':!![]});if(!_0x1c3647)throw new Error(_0x0453('0x77'));if(_0x1c3647[_0x0453('0x78')]===_0x0453('0x32')){var _0x3fd54e=_0x280f61['get']({'plain':!![]});return db[_0x0453('0x79')][_0x0453('0x5e')]({'where':{'name':'MailAccounts','userProfileId':_0x1c3647['userProfileId']},'raw':!![]})['then'](function(_0x416489){if(_0x416489&&_0x416489[_0x0453('0x7a')]===0x0){return db[_0x0453('0x26')][_0x0453('0x62')]({'name':_0x3fd54e['name'],'resourceId':_0x3fd54e['id'],'type':_0x416489['name'],'sectionId':_0x416489['id']},{})[_0x0453('0xf')](function(){return _0x280f61;});}else{return _0x280f61;}})[_0x0453('0x19')](function(_0x44feef){logger[_0x0453('0x15')](_0x0453('0x7b'),_0x44feef);throw _0x44feef;});}return _0x280f61;})['then'](respondWithResult(_0x309dec,0xc9))[_0x0453('0x19')](handleError(_0x309dec,null));};exports[_0x0453('0x7c')]=function(_0x214544,_0x346e27){return db['MailAccount']['findOne']({'where':{'id':_0x214544['params']['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x346e27,null))['then'](function(_0x74c755){if(_0x74c755){return _0x74c755[_0x0453('0x7c')]();}return null;})[_0x0453('0xf')](respondWithResult(_0x346e27,null))['catch'](handleError(_0x346e27,null));};exports[_0x0453('0x7d')]=function(_0x91e49d,_0x1cc8c2){if(_0x91e49d[_0x0453('0x5c')]['id']){delete _0x91e49d[_0x0453('0x5c')]['id'];}return db[_0x0453('0x55')][_0x0453('0x5e')]({'where':{'id':_0x91e49d['params']['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x1cc8c2,null))[_0x0453('0xf')](function(_0x13563c){if(_0x13563c){_0x91e49d['body'][_0x0453('0x68')]=_0x13563c['id'];return db[_0x0453('0x5a')][_0x0453('0x62')](_0x91e49d[_0x0453('0x5c')]);}})[_0x0453('0xf')](respondWithResult(_0x1cc8c2,null))[_0x0453('0x19')](handleError(_0x1cc8c2,null));};exports['removeImap']=function(_0x4ecd7d,_0xca1507){return db[_0x0453('0x55')][_0x0453('0x64')]({'where':{'id':_0x4ecd7d[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0xca1507,null))[_0x0453('0xf')](function(_0x33aade){if(_0x33aade){return _0x33aade[_0x0453('0x7e')](null);}return null;})['then'](respondWithStatusCode(_0xca1507,null))['catch'](handleError(_0xca1507,null));};exports['getSmtp']=function(_0x145b49,_0x320150){return db[_0x0453('0x55')][_0x0453('0x64')]({'where':{'id':_0x145b49[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x320150,null))[_0x0453('0xf')](function(_0x429cc6){if(_0x429cc6){return _0x429cc6[_0x0453('0x7f')]();}return null;})['then'](respondWithResult(_0x320150,null))[_0x0453('0x19')](handleError(_0x320150,null));};exports['addSmtp']=function(_0x374f50,_0x52d087){if(_0x374f50[_0x0453('0x5c')]['id']){delete _0x374f50['body']['id'];}return db[_0x0453('0x55')]['find']({'where':{'id':_0x374f50['params']['id']}})['then'](handleEntityNotFound(_0x52d087,null))[_0x0453('0xf')](function(_0x40a666){if(_0x40a666){_0x374f50['body'][_0x0453('0x68')]=_0x40a666['id'];return db[_0x0453('0x3f')][_0x0453('0x62')](_0x374f50[_0x0453('0x5c')]);}})[_0x0453('0xf')](respondWithResult(_0x52d087,null))[_0x0453('0x19')](handleError(_0x52d087,null));};exports['removeSmtp']=function(_0x13ac31,_0x2076d0){return db[_0x0453('0x55')][_0x0453('0x64')]({'where':{'id':_0x13ac31['params']['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x2076d0,null))[_0x0453('0xf')](function(_0x21cec4){if(_0x21cec4){return _0x21cec4[_0x0453('0x80')](null);}return null;})['then'](respondWithStatusCode(_0x2076d0,null))['catch'](handleError(_0x2076d0,null));};exports[_0x0453('0x81')]=function(_0x3c8469,_0x3c26ee){return db[_0x0453('0x82')][_0x0453('0x5e')]({'where':{'id':_0x3c8469[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x3c26ee,null))[_0x0453('0xf')](function(_0x324957){if(_0x324957){return _0x324957[_0x0453('0x81')](_0x3c8469[_0x0453('0x5c')][_0x0453('0x6c')],_[_0x0453('0x83')](_0x3c8469['body'],[_0x0453('0x6c'),'id'])||{});}})[_0x0453('0xf')](respondWithResult(_0x3c26ee,null))[_0x0453('0x19')](handleError(_0x3c26ee,null));};exports['getInteractions']=function(_0x3b5332,_0x5cd488){var _0x19f26b={'raw':![],'where':{}};var _0xbb44ad={};var _0x547d94={'count':0x0,'rows':[]};return db[_0x0453('0x55')]['findOne']({'where':{'id':_0x3b5332['params']['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x5cd488,null))[_0x0453('0xf')](function(_0x9eb0ac){if(_0x9eb0ac){_0xbb44ad[_0x0453('0x47')]=_['keys'](db[_0x0453('0x82')][_0x0453('0x43')]);_0xbb44ad[_0x0453('0x48')]=_[_0x0453('0x49')](_0x3b5332[_0x0453('0x48')]);_0xbb44ad[_0x0453('0x4a')]=_[_0x0453('0x4b')](_0xbb44ad[_0x0453('0x47')],_0xbb44ad['query']);_0x19f26b['attributes']=_[_0x0453('0x4b')](_0xbb44ad['model'],qs[_0x0453('0x4d')](_0x3b5332['query']['fields']));_0x19f26b['attributes']=_0x19f26b[_0x0453('0x4c')][_0x0453('0x4e')]?_0x19f26b[_0x0453('0x4c')]:_0xbb44ad[_0x0453('0x47')];if(!_0x3b5332['query'][_0x0453('0x4f')](_0x0453('0x50'))){_0x19f26b[_0x0453('0x1f')]=qs[_0x0453('0x1f')](_0x3b5332[_0x0453('0x48')][_0x0453('0x1f')]);_0x19f26b['offset']=qs[_0x0453('0x21')](_0x3b5332[_0x0453('0x48')]['offset']);}_0x19f26b['order']=qs['sort'](_0x3b5332[_0x0453('0x48')]['sort']);_0x19f26b[_0x0453('0x52')]=qs[_0x0453('0x4a')](_['pick'](_0x3b5332['query'],_0xbb44ad[_0x0453('0x4a')]));_0x19f26b['where'][_0x0453('0x68')]=_0x9eb0ac['id'];if(_0x3b5332[_0x0453('0x48')]['filter']){_0x19f26b[_0x0453('0x52')]=_[_0x0453('0x54')](_0x19f26b['where'],{'$or':_[_0x0453('0x42')](_0x19f26b[_0x0453('0x4c')],function(_0x17414e){var _0xd50a22={};_0xd50a22[_0x17414e]={'$like':'%'+_0x3b5332[_0x0453('0x48')][_0x0453('0x53')]+'%'};return _0xd50a22;})});}_0x19f26b=_[_0x0453('0x54')]({},_0x19f26b,_0x3b5332[_0x0453('0x69')]);return db[_0x0453('0x82')][_0x0453('0x20')]({'where':_0x19f26b['where']})[_0x0453('0xf')](function(_0xe702e1){_0x547d94[_0x0453('0x20')]=_0xe702e1;if(_0x3b5332[_0x0453('0x48')]['includeAll']){_0x19f26b[_0x0453('0x5b')]=[{'model':db[_0x0453('0x84')],'as':_0x0453('0x85'),'required':![]},{'model':db['User'],'as':_0x0453('0x86'),'attributes':[_0x0453('0x28'),_0x0453('0x87'),_0x0453('0x88')],'required':![]},{'model':db[_0x0453('0x89')],'as':_0x0453('0x8a'),'attributes':['id',_0x0453('0x28'),'color'],'where':_0x3b5332[_0x0453('0x48')][_0x0453('0x8b')]?{'id':_0x3b5332[_0x0453('0x48')]['tag']}:undefined,'required':_0x3b5332[_0x0453('0x48')][_0x0453('0x8b')]?!![]:![]}];}return db[_0x0453('0x82')]['findAll'](_0x19f26b);})['then'](function(_0x5c42d7){_0x547d94['rows']=_0x5c42d7;return _0x547d94;});}})['then'](respondWithFilteredResult(_0x5cd488,_0x19f26b))[_0x0453('0x19')](handleError(_0x5cd488,null));};exports[_0x0453('0x8c')]=function addApplications(_0xdf39f8,_0x1ab93e){var _0xda73c3=_0xdf39f8[_0x0453('0x59')]['id'];var _0x2c4552=_0xdf39f8[_0x0453('0x5c')];var _0x4d22fa=0xc8;var _0x2dc118=null;return db[_0x0453('0x8d')][_0x0453('0x8e')]({'isolationLevel':db[_0x0453('0x8d')][_0x0453('0x8f')][_0x0453('0x90')]['READ_COMMITTED']},function(_0x5bab6f){return db['MailAccount'][_0x0453('0x64')]({'where':{'id':_0xda73c3},'transaction':_0x5bab6f})[_0x0453('0xf')](function(_0xffd677){if(_0xffd677){return db[_0x0453('0x91')][_0x0453('0x24')]({'where':{'MailAccountId':_0xda73c3},'transaction':_0x5bab6f})[_0x0453('0xf')](function(){var _0x19768b=_[_0x0453('0x42')](_0x2c4552,function(_0x34fb9f){_0x34fb9f['MailAccountId']=_0xda73c3;return _0x34fb9f;});return db[_0x0453('0x91')][_0x0453('0x92')](_0x19768b,{'transaction':_0x5bab6f});});}else{_0x4d22fa=0x194;_0x2dc118=[];}});})['then'](function(){if(_0x4d22fa!==0x194){return db['MailApplication'][_0x0453('0x93')]({'where':{'MailAccountId':_0xda73c3},'order':_0x0453('0x94')})[_0x0453('0xf')](function(_0x52c650){_0x2dc118=_0x52c650;});}})[_0x0453('0x19')](function(_0x59b8be){_0x4d22fa=0x1f4;logger[_0x0453('0x15')](_0x59b8be[_0x0453('0x27')]);if(_0x59b8be['name']){delete _0x59b8be[_0x0453('0x28')];}_0x2dc118=_0x59b8be;})[_0x0453('0x95')](function(){if(_0x2dc118===null){_0x1ab93e[_0x0453('0x1a')](_0x4d22fa);}else{if(_0x4d22fa===0x1f4){_0x1ab93e[_0x0453('0x1b')](_0x4d22fa)[_0x0453('0x96')](_0x2dc118);}else{_0x1ab93e['status'](_0x4d22fa)[_0x0453('0x1d')](_0x2dc118);}}});};exports[_0x0453('0x97')]=function(_0xae3aac,_0x213f25){var _0x49e69f={};var _0x81b21={};var _0x122d05;var _0x13808f;return db[_0x0453('0x55')][_0x0453('0x64')]({'where':{'id':_0xae3aac[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x213f25,null))[_0x0453('0xf')](function(_0x56e9bf){if(_0x56e9bf){_0x122d05=_0x56e9bf;_0x81b21[_0x0453('0x47')]=_['keys'](db[_0x0453('0x91')][_0x0453('0x43')]);_0x81b21[_0x0453('0x48')]=_[_0x0453('0x49')](_0xae3aac[_0x0453('0x48')]);_0x81b21[_0x0453('0x4a')]=_[_0x0453('0x4b')](_0x81b21[_0x0453('0x47')],_0x81b21[_0x0453('0x48')]);_0x49e69f['attributes']=_[_0x0453('0x4b')](_0x81b21['model'],qs[_0x0453('0x4d')](_0xae3aac[_0x0453('0x48')][_0x0453('0x4d')]));_0x49e69f[_0x0453('0x4c')]=_0x49e69f[_0x0453('0x4c')][_0x0453('0x4e')]?_0x49e69f[_0x0453('0x4c')]:_0x81b21[_0x0453('0x47')];_0x49e69f[_0x0453('0x66')]=qs[_0x0453('0x51')](_0xae3aac[_0x0453('0x48')][_0x0453('0x51')]);_0x49e69f[_0x0453('0x52')]=qs[_0x0453('0x4a')](_[_0x0453('0x67')](_0xae3aac[_0x0453('0x48')],_0x81b21['filters']));if(_0xae3aac['query'][_0x0453('0x53')]){_0x49e69f[_0x0453('0x52')]=_[_0x0453('0x54')](_0x49e69f[_0x0453('0x52')],{'$or':_[_0x0453('0x42')](_0x49e69f['attributes'],function(_0x68306){var _0xae359f={};_0xae359f[_0x68306]={'$like':'%'+_0xae3aac[_0x0453('0x48')][_0x0453('0x53')]+'%'};return _0xae359f;})});}_0x49e69f=_[_0x0453('0x54')]({},_0x49e69f,_0xae3aac[_0x0453('0x69')]);return _0x122d05['getApplications'](_0x49e69f);}})[_0x0453('0xf')](function(_0x19b357){if(_0x19b357){_0x13808f=_0x19b357[_0x0453('0x4e')];if(!_0xae3aac['query']['hasOwnProperty'](_0x0453('0x50'))){_0x49e69f[_0x0453('0x1f')]=qs[_0x0453('0x1f')](_0xae3aac[_0x0453('0x48')][_0x0453('0x1f')]);_0x49e69f[_0x0453('0x21')]=qs[_0x0453('0x21')](_0xae3aac['query']['offset']);}return _0x122d05[_0x0453('0x97')](_0x49e69f);}})[_0x0453('0xf')](function(_0x5f2135){if(_0x5f2135){return _0x5f2135?{'count':_0x13808f,'rows':_0x5f2135}:null;}})[_0x0453('0xf')](respondWithResult(_0x213f25,null))[_0x0453('0x19')](handleError(_0x213f25,null));};exports[_0x0453('0x98')]=function(_0x35ccc5,_0x34278c){var _0x21b77a={'raw':!![],'where':{}};var _0x31e08b={};var _0x3082f0={'count':0x0,'rows':[]};return db['MailAccount'][_0x0453('0x64')]({'where':{'id':_0x35ccc5[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x34278c,null))[_0x0453('0xf')](function(_0x268412){if(_0x268412){_0x31e08b['model']=_[_0x0453('0x49')](db[_0x0453('0x99')][_0x0453('0x43')]);_0x31e08b[_0x0453('0x48')]=_['keys'](_0x35ccc5[_0x0453('0x48')]);_0x31e08b['filters']=_[_0x0453('0x4b')](_0x31e08b[_0x0453('0x47')],_0x31e08b[_0x0453('0x48')]);_0x21b77a[_0x0453('0x4c')]=_[_0x0453('0x4b')](_0x31e08b['model'],qs[_0x0453('0x4d')](_0x35ccc5[_0x0453('0x48')]['fields']));_0x21b77a[_0x0453('0x4c')]=_0x21b77a[_0x0453('0x4c')][_0x0453('0x4e')]?_0x21b77a[_0x0453('0x4c')]:_0x31e08b[_0x0453('0x47')];if(!_0x35ccc5['query']['hasOwnProperty'](_0x0453('0x50'))){_0x21b77a['limit']=qs[_0x0453('0x1f')](_0x35ccc5[_0x0453('0x48')][_0x0453('0x1f')]);_0x21b77a[_0x0453('0x21')]=qs[_0x0453('0x21')](_0x35ccc5[_0x0453('0x48')][_0x0453('0x21')]);}_0x21b77a['order']=qs[_0x0453('0x51')](_0x35ccc5[_0x0453('0x48')]['sort']);_0x21b77a['where']=qs[_0x0453('0x4a')](_[_0x0453('0x67')](_0x35ccc5[_0x0453('0x48')],_0x31e08b[_0x0453('0x4a')]));_0x21b77a[_0x0453('0x52')][_0x0453('0x68')]=_0x268412['id'];if(_0x35ccc5[_0x0453('0x48')]['filter']){_0x21b77a['where']=_[_0x0453('0x54')](_0x21b77a[_0x0453('0x52')],{'$or':_['map'](_0x21b77a[_0x0453('0x4c')],function(_0x401f4e){var _0x4b44a1={};_0x4b44a1[_0x401f4e]={'$like':'%'+_0x35ccc5['query']['filter']+'%'};return _0x4b44a1;})});}if(_0x35ccc5[_0x0453('0x48')]['$gte']){var _0x4d1ae7=_0x35ccc5[_0x0453('0x48')][_0x0453('0x9a')][_0x0453('0x9b')](',');var _0x53ebdf={};_0x53ebdf[_0x4d1ae7[0x0]]={'$gte':moment(_0x4d1ae7[0x1])[_0x0453('0x9c')](_0x0453('0x9d'))};_0x21b77a[_0x0453('0x52')]=_[_0x0453('0x54')](_0x21b77a[_0x0453('0x52')],_0x53ebdf);}_0x21b77a=_['merge']({},_0x21b77a,_0x35ccc5[_0x0453('0x69')]);return db[_0x0453('0x99')][_0x0453('0x20')]({'where':_0x21b77a['where']})[_0x0453('0xf')](function(_0xe3a9ed){_0x3082f0[_0x0453('0x20')]=_0xe3a9ed;if(_0x35ccc5[_0x0453('0x48')][_0x0453('0x56')]){_0x21b77a[_0x0453('0x5b')]=[{'all':!![]}];}return db[_0x0453('0x99')]['findAll'](_0x21b77a);})['then'](function(_0x2c5c5d){if(_0x35ccc5[_0x0453('0x48')][_0x0453('0x9e')]===_0x0453('0x9f')){for(var _0x229744=0x0;_0x229744<_0x2c5c5d[_0x0453('0x4e')];_0x229744++){_0x2c5c5d[_0x229744][_0x0453('0x5c')]=juice(_0x2c5c5d[_0x229744]['body']);}}_0x3082f0['rows']=_0x2c5c5d;return _0x3082f0;});}})[_0x0453('0xf')](respondWithFilteredResult(_0x34278c,_0x21b77a))[_0x0453('0x19')](handleError(_0x34278c,null));};exports['send']=function(_0x5e3ec1,_0x1d1abf){var _0x16dd3b,_0x3fde7d={},_0x58bb16;if(_0x5e3ec1[_0x0453('0x5c')]['to']){_0x58bb16=_0x5e3ec1[_0x0453('0x5c')]['to'][_0x0453('0x9b')](',')[0x0];}return db[_0x0453('0x55')][_0x0453('0x5e')]({'where':{'id':_0x5e3ec1[_0x0453('0x59')]['id']},'include':[{'model':db[_0x0453('0xa0')],'as':_0x0453('0xa1'),'include':[{'model':db['CmContact'],'as':_0x0453('0xa2'),'where':{'email':_0x58bb16},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailServerOut'],'as':_0x0453('0x3e'),'raw':!![],'include':[{'model':db[_0x0453('0xa3')],'as':_0x0453('0xa3'),'raw':!![]}]}]})[_0x0453('0xf')](handleEntityNotFound(_0x1d1abf,null))[_0x0453('0xf')](function(_0xdeca6){if(!_0xdeca6)return;_0x16dd3b=_0xdeca6;if(!_0xdeca6[_0x0453('0x3e')])throw new Error(_0x0453('0xa4'));if(_[_0x0453('0x74')](_0x5e3ec1[_0x0453('0x5c')][_0x0453('0xa5')])){_0x5e3ec1[_0x0453('0x5c')]['from']=util[_0x0453('0x9c')](_0x0453('0xa6'),_0xdeca6[_0x0453('0x28')],_0xdeca6[_0x0453('0x72')]||_0xdeca6['Smtp'][_0x0453('0x32')]);}if(_0x5e3ec1[_0x0453('0x5c')]['attachments']&&_0x5e3ec1[_0x0453('0x5c')][_0x0453('0xa7')][_0x0453('0x4e')]){for(var _0x3b503e=0x0;_0x3b503e<_0x5e3ec1['body'][_0x0453('0xa7')][_0x0453('0x4e')];_0x3b503e+=0x1){_0x5e3ec1[_0x0453('0x5c')][_0x0453('0xa7')][_0x3b503e]={'filename':_0x5e3ec1[_0x0453('0x5c')][_0x0453('0xa7')][_0x3b503e][_0x0453('0x28')],'path':path[_0x0453('0xa8')](config[_0x0453('0xa9')],_0x0453('0xaa'),_0x5e3ec1[_0x0453('0x5c')][_0x0453('0xa7')][_0x3b503e][_0x0453('0xab')])};}}var _0x3fb82f=_0xdeca6[_0x0453('0xac')]();return respondWithRpcPromise(_0x0453('0xad'),_0x0453('0xae'),{'account':_0x3fb82f,'message':_0x5e3ec1[_0x0453('0x5c')]});})['then'](function(_0x4eeca0){if(!_0x4eeca0)return;_0x3fde7d=_0x4eeca0;if(!_0x16dd3b['List'])throw new Error('List\x20not\x20found');if(_0x16dd3b['List']['Contacts'][_0x0453('0x4e')])return _0x16dd3b[_0x0453('0xa1')][_0x0453('0xa2')][0x0];return db[_0x0453('0x84')][_0x0453('0x62')](_[_0x0453('0x8')](_0x5e3ec1[_0x0453('0x5c')],{'firstName':_0x5e3ec1[_0x0453('0x5c')]['to'],'email':_0x5e3ec1[_0x0453('0x5c')]['to'],'phone':_0x5e3ec1[_0x0453('0x5c')]['to'],'ListId':_0x16dd3b['ListId']}));})['then'](function(_0x4199b2){if(!_0x4199b2)return;var _0x5d0401={'UserId':_0x5e3ec1[_0x0453('0x32')]['id'],'ContactId':_0x4199b2['id'],'MailAccountId':_0x16dd3b['id'],'inReplyTo':_0x3fde7d[_0x0453('0xaf')],'to':_0x5e3ec1[_0x0453('0x5c')]['from'],'cc':_0x5e3ec1[_0x0453('0x5c')]['cc'],'subject':_0x5e3ec1['body'][_0x0453('0xb0')],'attach':_0x5e3ec1[_0x0453('0x5c')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()[_0x0453('0x9c')](_0x0453('0x9d')),'lastMsgDirection':'out','Messages':[_['merge'](_0x5e3ec1['body'],{'messageId':_0x3fde7d[_0x0453('0xaf')],'sentAt':moment()[_0x0453('0x9c')](_0x0453('0x9d')),'read':!![],'MailAccountId':_0x16dd3b['id'],'UserId':_0x5e3ec1['user']['id'],'ContactId':_0x4199b2['id']})]};if(_0x5e3ec1[_0x0453('0x5c')][_0x0453('0xb1')]){_0x5d0401=_[_0x0453('0x54')](_0x5d0401,_0x5e3ec1[_0x0453('0x5c')][_0x0453('0xb1')]);}return db[_0x0453('0x82')][_0x0453('0x62')](_0x5d0401,{'include':[{'model':db['MailMessage'],'as':_0x0453('0xb2')}]});})['then'](respondWithResult(_0x1d1abf,null))[_0x0453('0x19')](handleError(_0x1d1abf,null));};exports[_0x0453('0xb3')]=function(_0x2077d6,_0x5f086d){return db['MailAccount'][_0x0453('0x5e')]({'where':{'id':_0x2077d6[_0x0453('0x59')]['id']},'include':[{'model':db[_0x0453('0x3f')],'as':_0x0453('0x3e'),'raw':!![],'include':[{'model':db[_0x0453('0xa3')],'as':_0x0453('0xa3'),'raw':!![]}]}]})[_0x0453('0xf')](handleEntityNotFound(_0x5f086d,null))[_0x0453('0xf')](function(_0x742d0b){if(!_0x742d0b[_0x0453('0x3e')])return;var _0x9d0611=_0x742d0b[_0x0453('0xac')]();return respondWithRpcPromise(_0x0453('0xb4'),'verifySmtp',{'account':_0x9d0611});})[_0x0453('0xf')](respondWithResult(_0x5f086d,null))[_0x0453('0x19')](handleError(_0x5f086d,null));};exports[_0x0453('0x24')]=function(_0x8301cf,_0x16eb3b){return db[_0x0453('0x55')][_0x0453('0x5e')]({'where':{'id':_0x8301cf[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x16eb3b,null))[_0x0453('0xf')](function(_0x38e7c3){if(_0x38e7c3&&_0x38e7c3[_0x0453('0x3a')]){throw new db[(_0x0453('0xb5'))][(_0x0453('0xb6'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x38e7c3;})[_0x0453('0xf')](removeEntity(_0x16eb3b,null))[_0x0453('0x19')](handleError(_0x16eb3b,null));};exports[_0x0453('0xb7')]=function(_0x459b70,_0x2ea574){return db[_0x0453('0x55')]['find']({'where':{'id':_0x459b70[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x2ea574,null))['then'](function(_0x289e4c){if(_0x289e4c){return _0x289e4c[_0x0453('0xb7')](_0x459b70[_0x0453('0x5c')][_0x0453('0x6c')],_[_0x0453('0x83')](_0x459b70[_0x0453('0x5c')],[_0x0453('0x6c'),'id'])||{})['spread'](function(_0xbd5600){for(var _0x3a07f7=0x0;_0x3a07f7<_0x459b70[_0x0453('0x5c')][_0x0453('0x6c')][_0x0453('0x4e')];_0x3a07f7+=0x1){socket[_0x0453('0xb8')](_0x0453('0xb9'),{'UserId':Number(_0x459b70[_0x0453('0x5c')][_0x0453('0x6c')][_0x3a07f7]),'MailAccountId':Number(_0x459b70['params']['id'])});}return _0xbd5600;});}})[_0x0453('0xf')](respondWithResult(_0x2ea574,null))['catch'](handleError(_0x2ea574,null));};exports[_0x0453('0xba')]=function(_0x347801,_0x384ab8){return db[_0x0453('0x55')][_0x0453('0x5e')]({'where':{'id':_0x347801[_0x0453('0x59')]['id']}})[_0x0453('0xf')](handleEntityNotFound(_0x384ab8,null))['then'](function(_0x4839ea){if(_0x4839ea){return _0x4839ea['removeAgents'](_0x347801[_0x0453('0x48')][_0x0453('0x6c')])['then'](function(){if(_[_0x0453('0xbb')](_0x347801[_0x0453('0x48')][_0x0453('0x6c')])){for(var _0x392d3d=0x0;_0x392d3d<_0x347801[_0x0453('0x48')][_0x0453('0x6c')]['length'];_0x392d3d+=0x1){socket['emit'](_0x0453('0xbc'),{'UserId':Number(_0x347801['query']['ids'][_0x392d3d]),'MailAccountId':Number(_0x347801[_0x0453('0x59')]['id'])});}}else{socket[_0x0453('0xb8')](_0x0453('0xbc'),{'UserId':Number(_0x347801[_0x0453('0x48')][_0x0453('0x6c')]),'MailAccountId':Number(_0x347801[_0x0453('0x59')]['id'])});}});}})[_0x0453('0xf')](respondWithStatusCode(_0x384ab8,null))[_0x0453('0x19')](handleError(_0x384ab8,null));};exports['getAgents']=function(_0x5dd426,_0x189b6f){var _0x181895={};var _0xd48860={};var _0x322a02;var _0x3b8fa7;return db[_0x0453('0x55')][_0x0453('0x64')]({'where':{'id':_0x5dd426[_0x0453('0x59')]['id']}})['then'](handleEntityNotFound(_0x189b6f,null))[_0x0453('0xf')](function(_0x15713a){if(_0x15713a){_0x322a02=_0x15713a;_0xd48860[_0x0453('0x47')]=_[_0x0453('0x49')](db[_0x0453('0xbd')][_0x0453('0x43')]);_0xd48860[_0x0453('0x48')]=_['keys'](_0x5dd426[_0x0453('0x48')]);_0xd48860['filters']=_[_0x0453('0x4b')](_0xd48860[_0x0453('0x47')],_0xd48860[_0x0453('0x48')]);_0x181895[_0x0453('0x4c')]=_[_0x0453('0x4b')](_0xd48860[_0x0453('0x47')],qs[_0x0453('0x4d')](_0x5dd426[_0x0453('0x48')][_0x0453('0x4d')]));_0x181895[_0x0453('0x4c')]=_0x181895[_0x0453('0x4c')][_0x0453('0x4e')]?_0x181895[_0x0453('0x4c')]:_0xd48860['model'];_0x181895[_0x0453('0x66')]=qs[_0x0453('0x51')](_0x5dd426[_0x0453('0x48')]['sort']);_0x181895[_0x0453('0x52')]=qs[_0x0453('0x4a')](_[_0x0453('0x67')](_0x5dd426[_0x0453('0x48')],_0xd48860['filters']));if(_0x5dd426[_0x0453('0x48')]['filter']){_0x181895[_0x0453('0x52')]=_[_0x0453('0x54')](_0x181895[_0x0453('0x52')],{'$or':_[_0x0453('0x42')](_0x181895[_0x0453('0x4c')],function(_0xb3ca00){var _0x31864a={};_0x31864a[_0xb3ca00]={'$like':'%'+_0x5dd426[_0x0453('0x48')][_0x0453('0x53')]+'%'};return _0x31864a;})});}_0x181895=_['merge']({},_0x181895,_0x5dd426[_0x0453('0x69')]);return _0x322a02[_0x0453('0xbe')](_0x181895);}})[_0x0453('0xf')](function(_0x37fa4b){if(_0x37fa4b){_0x3b8fa7=_0x37fa4b[_0x0453('0x4e')];if(!_0x5dd426[_0x0453('0x48')][_0x0453('0x4f')](_0x0453('0x50'))){_0x181895[_0x0453('0x1f')]=qs[_0x0453('0x1f')](_0x5dd426[_0x0453('0x48')][_0x0453('0x1f')]);_0x181895['offset']=qs[_0x0453('0x21')](_0x5dd426[_0x0453('0x48')][_0x0453('0x21')]);}return _0x322a02['getAgents'](_0x181895);}})[_0x0453('0xf')](function(_0x5d18db){if(_0x5d18db){return _0x5d18db?{'count':_0x3b8fa7,'rows':_0x5d18db}:null;}})[_0x0453('0xf')](respondWithResult(_0x189b6f,null))['catch'](handleError(_0x189b6f,null));};
\ No newline at end of file
+var _0x2aca=['service','authentication','Imap','Smtp','MailServerIn','map','MailAccount','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','MailServerOut','mandatoryDispositionPause','keys','find','body','provider','custom','Pause','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','omit','CmContact','User','Owner','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','finally','getApplications','getMessages','MailMessage','$gte','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','List','Contacts','updatedAt','CloudProvider','from','format','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','sendMail','subject','attach','out','Interaction','verifySmtp','Sequelize','ValidationError','addAgents','emit','isArray','userMailAccount:remove','getAgents','util','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','client','http','request','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','get','MailAccounts','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp-mail.outlook.com','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','pass','port','host','secure'];(function(_0x55abd3,_0x47e49e){var _0x4fc1dd=function(_0x18c8c){while(--_0x18c8c){_0x55abd3['push'](_0x55abd3['shift']());}};_0x4fc1dd(++_0x47e49e);}(_0x2aca,0x7c));var _0xa2ac=function(_0x3d3f94,_0x51239d){_0x3d3f94=_0x3d3f94-0x0;var _0x328bbb=_0x2aca[_0x3d3f94];return _0x328bbb;};'use strict';var moment=require('moment');var BPromise=require('bluebird');var util=require(_0xa2ac('0x0'));var path=require('path');var _=require(_0xa2ac('0x1'));var juice=require(_0xa2ac('0x2'));var Redis=require(_0xa2ac('0x3'));var qs=require(_0xa2ac('0x4'));var logger=require(_0xa2ac('0x5'))(_0xa2ac('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xa2ac('0x7')]=_[_0xa2ac('0x8')](config[_0xa2ac('0x7')],{'host':_0xa2ac('0x9'),'port':0x18eb});var socket=require(_0xa2ac('0xa'))(new Redis(config[_0xa2ac('0x7')]));require(_0xa2ac('0xb'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xa2ac('0xc')][_0xa2ac('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x4f8f47,_0x3032be,_0x4f2576,_0x4c1e9f){return new BPromise(function(_0x147fa2,_0x51f86e){var _0x407d23=_0x4c1e9f||client;return _0x407d23[_0xa2ac('0xe')](_0x4f8f47,_0x4f2576)['then'](function(_0x1294df){logger[_0xa2ac('0xf')](_0xa2ac('0x10'),_0x3032be,'request\x20sent');logger[_0xa2ac('0x11')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x3032be,'request\x20sent',JSON[_0xa2ac('0x12')](_0x1294df));if(_0x1294df[_0xa2ac('0x13')]){if(_0x1294df['error'][_0xa2ac('0x14')]===0x1f4){logger[_0xa2ac('0x13')](_0xa2ac('0x10'),_0x3032be,_0x1294df[_0xa2ac('0x13')][_0xa2ac('0x15')]);return _0x51f86e(_0x1294df[_0xa2ac('0x13')]['message']);}logger['error'](_0xa2ac('0x10'),_0x3032be,_0x1294df[_0xa2ac('0x13')][_0xa2ac('0x15')]);return _0x147fa2(_0x1294df[_0xa2ac('0x13')][_0xa2ac('0x15')]);}else{logger[_0xa2ac('0xf')](_0xa2ac('0x10'),_0x3032be,_0xa2ac('0x16'));_0x147fa2(_0x1294df[_0xa2ac('0x17')][_0xa2ac('0x15')]);}})[_0xa2ac('0x18')](function(_0x5a83b9){logger[_0xa2ac('0x13')]('MailAccount,\x20%s,\x20%s',_0x3032be,_0x5a83b9);_0x51f86e(_0x5a83b9);});});}function respondWithStatusCode(_0x6fdc9e,_0x3b52ab){_0x3b52ab=_0x3b52ab||0xcc;return function(_0x315bd2){if(_0x315bd2){return _0x6fdc9e[_0xa2ac('0x19')](_0x3b52ab);}return _0x6fdc9e[_0xa2ac('0x1a')](_0x3b52ab)[_0xa2ac('0x1b')]();};}function respondWithResult(_0x3a5218,_0x28753a){_0x28753a=_0x28753a||0xc8;return function(_0x5ddff2){if(_0x5ddff2){return _0x3a5218[_0xa2ac('0x1a')](_0x28753a)[_0xa2ac('0x1c')](_0x5ddff2);}};}function respondWithFilteredResult(_0xacba65,_0x37331c){return function(_0xde11ab){if(_0xde11ab){var _0x1551e8=typeof _0x37331c[_0xa2ac('0x1d')]===_0xa2ac('0x1e')&&typeof _0x37331c[_0xa2ac('0x1f')]===_0xa2ac('0x1e');var _0x4fe956=_0xde11ab[_0xa2ac('0x20')];var _0x3ceb74=_0x1551e8?0x0:_0x37331c[_0xa2ac('0x1d')];var _0x189be3=_0x1551e8?_0xde11ab[_0xa2ac('0x20')]:_0x37331c['offset']+_0x37331c[_0xa2ac('0x1f')];var _0x1fef33;if(_0x189be3>=_0x4fe956){_0x189be3=_0x4fe956;_0x1fef33=0xc8;}else{_0x1fef33=0xce;}_0xacba65[_0xa2ac('0x1a')](_0x1fef33);return _0xacba65[_0xa2ac('0x21')]('Content-Range',_0x3ceb74+'-'+_0x189be3+'/'+_0x4fe956)[_0xa2ac('0x1c')](_0xde11ab);}return null;};}function saveUpdates(_0x15a5bf){return function(_0x49c1ed){if(_0x49c1ed){return _0x49c1ed[_0xa2ac('0x22')](_0x15a5bf)['then'](function(_0x3d80ba){return _0x3d80ba;});}return null;};}function removeEntity(_0x2c927b){return function(_0x594171){if(_0x594171){return _0x594171[_0xa2ac('0x23')]()[_0xa2ac('0x24')](function(){var _0xed9034=_0x594171[_0xa2ac('0x25')]({'plain':!![]});var _0x481afc=_0xa2ac('0x26');return db['UserProfileResource'][_0xa2ac('0x23')]({'where':{'type':_0x481afc,'resourceId':_0xed9034['id']}})[_0xa2ac('0x24')](function(){return _0x594171;});})[_0xa2ac('0x24')](function(){_0x2c927b['status'](0xcc)[_0xa2ac('0x1b')]();});}};}function handleEntityNotFound(_0x2c4b8e){return function(_0x5ba077){if(!_0x5ba077){_0x2c4b8e[_0xa2ac('0x19')](0x194);}return _0x5ba077;};}function handleError(_0x5d39e6,_0x3b1bae){_0x3b1bae=_0x3b1bae||0x1f4;return function(_0x34c3cf){logger['error'](_0x34c3cf[_0xa2ac('0x27')]);if(_0x34c3cf[_0xa2ac('0x28')]){delete _0x34c3cf[_0xa2ac('0x28')];}_0x5d39e6[_0xa2ac('0x1a')](_0x3b1bae)[_0xa2ac('0x29')](_0x34c3cf);};}function getImapHost(_0x5a792d){switch(_0x5a792d){case _0xa2ac('0x2a'):return _0xa2ac('0x2b');case _0xa2ac('0x2c'):return _0xa2ac('0x2d');case _0xa2ac('0x2e'):return'imap-mail.outlook.com';case _0xa2ac('0x2f'):return _0xa2ac('0x30');}throw new Error(_0xa2ac('0x31'),_0x5a792d);}function getSmtpHost(_0x1f3bf5){switch(_0x1f3bf5){case _0xa2ac('0x2a'):return _0xa2ac('0x32');case _0xa2ac('0x2c'):return'smtp.mail.yahoo.com';case _0xa2ac('0x2e'):return _0xa2ac('0x33');case _0xa2ac('0x2f'):return _0xa2ac('0x34');}throw new Error(_0xa2ac('0x31'),_0x1f3bf5);}function getAuthenticationOptions(_0x56b160,_0xa2db19){var _0x13802e={};var _0x2bb652={};if(_0x56b160){_0x13802e[_0xa2ac('0x35')]=_0x2bb652[_0xa2ac('0x35')]=_0xa2db19['username'];_0x13802e[_0xa2ac('0x36')]=_0x2bb652['pass']=_0xa2db19[_0xa2ac('0x36')];if(_0xa2db19[_0xa2ac('0x37')]){_0x13802e[_0xa2ac('0x37')]=_0x2bb652['modernAuthentication']=!![];_0x13802e[_0xa2ac('0x38')]=_0x2bb652[_0xa2ac('0x38')]=_0xa2db19[_0xa2ac('0x38')];_0x13802e[_0xa2ac('0x36')]=_0x2bb652[_0xa2ac('0x39')]=null;}else{_0x13802e[_0xa2ac('0x38')]=_0x2bb652[_0xa2ac('0x38')]=null;}_0x13802e['host']=getImapHost(_0x56b160);_0x13802e[_0xa2ac('0x3a')]=0x3e1;_0x2bb652[_0xa2ac('0x3b')]=getSmtpHost(_0x56b160);_0x2bb652['port']=0x24b;_0x2bb652[_0xa2ac('0x3c')]=![];_0x13802e[_0xa2ac('0x3d')]=_0x2bb652[_0xa2ac('0x3d')]=null;}else{if(_0xa2db19['authentication']){_0x13802e[_0xa2ac('0x35')]=_0x2bb652[_0xa2ac('0x35')]=_0xa2db19['username'];_0x13802e[_0xa2ac('0x36')]=_0x2bb652[_0xa2ac('0x39')]=_0xa2db19[_0xa2ac('0x36')];}else{_0x13802e[_0xa2ac('0x3e')]=_0x2bb652[_0xa2ac('0x3e')]=![];_0x13802e[_0xa2ac('0x35')]=_0x2bb652['user']=null;_0x13802e[_0xa2ac('0x36')]=_0x2bb652['pass']=null;}_0x13802e['host']=_0xa2db19['Imap']['host'];_0x13802e[_0xa2ac('0x3a')]=_0xa2db19[_0xa2ac('0x3f')][_0xa2ac('0x3a')];_0x2bb652['host']=_0xa2db19[_0xa2ac('0x40')]['host'];_0x2bb652[_0xa2ac('0x3a')]=_0xa2db19[_0xa2ac('0x40')]['port'];}return{'Imap':_0x13802e,'Smtp':_0x2bb652};}exports['index']=function(_0x49b164,_0x4284b6){var _0x2a009b={'include':[{'model':db[_0xa2ac('0x41')],'as':_0xa2ac('0x3f')},{'model':db['MailServerOut'],'as':_0xa2ac('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x4ca3a1={},_0x11684f={'count':0x0,'rows':[]};var _0x5252ba=_[_0xa2ac('0x42')](db[_0xa2ac('0x43')][_0xa2ac('0x44')],function(_0x4efd54){return{'name':_0x4efd54[_0xa2ac('0x45')],'type':_0x4efd54[_0xa2ac('0x46')]['key']};});_0x4ca3a1[_0xa2ac('0x47')]=_[_0xa2ac('0x42')](_0x5252ba,'name');_0x4ca3a1[_0xa2ac('0x48')]=_['keys'](_0x49b164[_0xa2ac('0x48')]);_0x4ca3a1[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0x4ca3a1[_0xa2ac('0x47')],_0x4ca3a1[_0xa2ac('0x48')]);_0x2a009b['attributes']=_['intersection'](_0x4ca3a1[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x49b164['query'][_0xa2ac('0x4b')]));_0x2a009b[_0xa2ac('0x4c')]=_0x2a009b[_0xa2ac('0x4c')][_0xa2ac('0x4d')]?_0x2a009b[_0xa2ac('0x4c')]:_0x4ca3a1[_0xa2ac('0x47')];if(!_0x49b164[_0xa2ac('0x48')]['hasOwnProperty'](_0xa2ac('0x4e'))){_0x2a009b['limit']=qs[_0xa2ac('0x1f')](_0x49b164[_0xa2ac('0x48')]['limit']);_0x2a009b[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x49b164['query'][_0xa2ac('0x1d')]);}_0x2a009b[_0xa2ac('0x4f')]=qs[_0xa2ac('0x50')](_0x49b164[_0xa2ac('0x48')][_0xa2ac('0x50')]);_0x2a009b['where']=qs[_0xa2ac('0x49')](_[_0xa2ac('0x51')](_0x49b164[_0xa2ac('0x48')],_0x4ca3a1[_0xa2ac('0x49')]),_0x5252ba);if(_0x49b164[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0x2a009b[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0x2a009b[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x5252ba,function(_0x5afc7d){if(_0x5afc7d[_0xa2ac('0x46')]!==_0xa2ac('0x55')){var _0x2fa7b8={};_0x2fa7b8[_0x5afc7d[_0xa2ac('0x28')]]={'$like':'%'+_0x49b164[_0xa2ac('0x48')][_0xa2ac('0x52')]+'%'};return _0x2fa7b8;}})});}_0x2a009b=_['merge']({},_0x2a009b,_0x49b164[_0xa2ac('0x56')]);var _0x24d353={'where':_0x2a009b[_0xa2ac('0x53')]};return db[_0xa2ac('0x43')]['count'](_0x24d353)[_0xa2ac('0x24')](function(_0x116f5e){_0x11684f[_0xa2ac('0x20')]=_0x116f5e;if(_0x49b164[_0xa2ac('0x48')][_0xa2ac('0x57')]){_0x2a009b[_0xa2ac('0x58')]=[{'all':!![]}];}return db[_0xa2ac('0x43')][_0xa2ac('0x59')](_0x2a009b);})[_0xa2ac('0x24')](function(_0xd3f8e0){_0x11684f['rows']=_0xd3f8e0;return _0x11684f;})['then'](respondWithFilteredResult(_0x4284b6,_0x2a009b))['catch'](handleError(_0x4284b6,null));};exports[_0xa2ac('0x5a')]=function(_0x5f486d,_0x32b2e1){var _0x59601c={'raw':![],'where':{'id':_0x5f486d[_0xa2ac('0x5b')]['id']},'include':[{'model':db[_0xa2ac('0x41')],'as':_0xa2ac('0x3f')},{'model':db[_0xa2ac('0x5c')],'as':_0xa2ac('0x40')},{'model':db['Pause'],'as':_0xa2ac('0x5d')}]},_0xc472de={};_0xc472de[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x43')][_0xa2ac('0x44')]);_0xc472de['query']=_['keys'](_0x5f486d[_0xa2ac('0x48')]);_0xc472de[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0xc472de[_0xa2ac('0x47')],_0xc472de['query']);_0x59601c[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0xc472de[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x5f486d[_0xa2ac('0x48')][_0xa2ac('0x4b')]));_0x59601c['attributes']=_0x59601c['attributes'][_0xa2ac('0x4d')]?_0x59601c[_0xa2ac('0x4c')]:_0xc472de[_0xa2ac('0x47')];if(_0x5f486d[_0xa2ac('0x48')][_0xa2ac('0x57')]){_0x59601c[_0xa2ac('0x58')]=[{'all':!![]}];}_0x59601c=_['merge']({},_0x59601c,_0x5f486d[_0xa2ac('0x56')]);return db[_0xa2ac('0x43')][_0xa2ac('0x5f')](_0x59601c)[_0xa2ac('0x24')](handleEntityNotFound(_0x32b2e1,null))[_0xa2ac('0x24')](respondWithResult(_0x32b2e1,null))[_0xa2ac('0x18')](handleError(_0x32b2e1,null));};exports[_0xa2ac('0x22')]=function(_0xcd1bb3,_0x5796fd){if(_0xcd1bb3[_0xa2ac('0x60')]['id']){delete _0xcd1bb3['body']['id'];}var _0x22dfb6=_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x61')]===_0xa2ac('0x62')?null:_0xcd1bb3['body']['provider'];var _0x23011e=_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x3f')]||{};var _0x43bbde=_0xcd1bb3[_0xa2ac('0x60')]['Smtp']||{};if(_0x22dfb6){_0x23011e[_0xa2ac('0x3b')]=getImapHost(_0x22dfb6);_0x23011e['port']=0x3e1;_0x43bbde[_0xa2ac('0x3b')]=getSmtpHost(_0x22dfb6);_0x43bbde[_0xa2ac('0x3a')]=0x24b;_0x43bbde[_0xa2ac('0x3c')]=![];}if(_0x43bbde[_0xa2ac('0x37')]){_0x43bbde[_0xa2ac('0x3c')]=![];}else{_0x43bbde['CloudProviderId']=null;}if(!_0x23011e[_0xa2ac('0x37')])_0x23011e[_0xa2ac('0x38')]=null;_0xcd1bb3[_0xa2ac('0x60')]['Imap']=_0x23011e;_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x40')]=_0x43bbde;return db['MailAccount'][_0xa2ac('0x5f')]({'where':{'id':_0xcd1bb3[_0xa2ac('0x5b')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xa2ac('0x40')},{'model':db[_0xa2ac('0x63')],'as':_0xa2ac('0x5d')}]})[_0xa2ac('0x24')](handleEntityNotFound(_0x5796fd,null))[_0xa2ac('0x24')](function(_0x2a7c46){if(!_0x2a7c46)throw new Error(_0xa2ac('0x64'));if(_0x2a7c46[_0xa2ac('0x3d')])delete _0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x3f')];return _0x2a7c46;})[_0xa2ac('0x24')](saveUpdates(_0xcd1bb3[_0xa2ac('0x60')],null))['then'](function(_0x41c6b0){if(!_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x3f')])return _0x41c6b0;return db[_0xa2ac('0x41')][_0xa2ac('0x22')](_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x3f')],{'where':{'MailAccountId':_0x41c6b0['id']}})['then'](function(){return _0x41c6b0;});})[_0xa2ac('0x24')](function(_0x457f38){if(!_0xcd1bb3['body']['Smtp'])return _0x457f38;return db[_0xa2ac('0x5c')][_0xa2ac('0x22')](_0xcd1bb3[_0xa2ac('0x60')][_0xa2ac('0x40')],{'where':{'MailAccountId':_0x457f38['id']}})[_0xa2ac('0x24')](function(){return _0x457f38;});})[_0xa2ac('0x24')](respondWithResult(_0x5796fd,null))['catch'](handleError(_0x5796fd,null));};exports[_0xa2ac('0x65')]=function(_0x2ec952,_0x390c3c){return db[_0xa2ac('0x43')]['describe']()[_0xa2ac('0x24')](respondWithResult(_0x390c3c,null))['catch'](handleError(_0x390c3c,null));};exports[_0xa2ac('0x66')]=function(_0x1b99c7,_0x362bc7){if(_0x1b99c7[_0xa2ac('0x60')]['id']){delete _0x1b99c7[_0xa2ac('0x60')]['id'];}return db[_0xa2ac('0x43')]['find']({'where':{'id':_0x1b99c7['params']['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x362bc7,null))[_0xa2ac('0x24')](function(_0x59824f){if(_0x59824f){_0x1b99c7['body'][_0xa2ac('0x67')]=_0x59824f['id'];return db[_0xa2ac('0x68')][_0xa2ac('0x69')](_0x1b99c7[_0xa2ac('0x60')]);}})[_0xa2ac('0x24')](respondWithResult(_0x362bc7,null))[_0xa2ac('0x18')](handleError(_0x362bc7,null));};exports['getDispositions']=function(_0x82073c,_0x5879aa){var _0xf84e1b={'raw':![],'where':{}};var _0x21fed5={};var _0x54327e={'count':0x0,'rows':[]};return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x82073c[_0xa2ac('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5879aa,null))[_0xa2ac('0x24')](function(_0x3957a9){if(_0x3957a9){_0x21fed5[_0xa2ac('0x47')]=_['keys'](db['Disposition'][_0xa2ac('0x44')]);_0x21fed5[_0xa2ac('0x48')]=_[_0xa2ac('0x5e')](_0x82073c[_0xa2ac('0x48')]);_0x21fed5[_0xa2ac('0x49')]=_['intersection'](_0x21fed5['model'],_0x21fed5[_0xa2ac('0x48')]);_0xf84e1b[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x21fed5[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x4b')]));_0xf84e1b[_0xa2ac('0x4c')]=_0xf84e1b[_0xa2ac('0x4c')][_0xa2ac('0x4d')]?_0xf84e1b[_0xa2ac('0x4c')]:_0x21fed5[_0xa2ac('0x47')];if(!_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x6b')](_0xa2ac('0x4e'))){_0xf84e1b[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0xf84e1b[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}_0xf84e1b[_0xa2ac('0x4f')]=qs[_0xa2ac('0x50')](_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x50')]);_0xf84e1b[_0xa2ac('0x53')]=qs[_0xa2ac('0x49')](_[_0xa2ac('0x51')](_0x82073c['query'],_0x21fed5[_0xa2ac('0x49')]));_0xf84e1b['where'][_0xa2ac('0x67')]=_0x3957a9['id'];if(_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0xf84e1b[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0xf84e1b[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0xf84e1b[_0xa2ac('0x4c')],function(_0x3ec3a0){var _0x5cb336={};_0x5cb336[_0x3ec3a0]={'$like':'%'+_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x52')]+'%'};return _0x5cb336;})});}_0xf84e1b=_['merge']({},_0xf84e1b,_0x82073c[_0xa2ac('0x56')]);return db['Disposition']['count']({'where':_0xf84e1b[_0xa2ac('0x53')]})[_0xa2ac('0x24')](function(_0x39afe5){_0x54327e[_0xa2ac('0x20')]=_0x39afe5;if(_0x82073c[_0xa2ac('0x48')][_0xa2ac('0x57')]){_0xf84e1b[_0xa2ac('0x58')]=[{'all':!![]}];}return db[_0xa2ac('0x68')]['findAll'](_0xf84e1b);})['then'](function(_0x5665ce){_0x54327e[_0xa2ac('0x6c')]=_0x5665ce;return _0x54327e;});}})[_0xa2ac('0x24')](respondWithFilteredResult(_0x5879aa,_0xf84e1b))[_0xa2ac('0x18')](handleError(_0x5879aa,null));};exports[_0xa2ac('0x6d')]=function(_0x477562,_0xf38d23){return db['MailAccount'][_0xa2ac('0x5f')]({'where':{'id':_0x477562[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0xf38d23,null))[_0xa2ac('0x24')](function(_0x567f83){if(_0x567f83){return _0x567f83[_0xa2ac('0x6d')](_0x477562[_0xa2ac('0x48')][_0xa2ac('0x6e')]);}})[_0xa2ac('0x24')](respondWithStatusCode(_0xf38d23,null))['catch'](handleError(_0xf38d23,null));};exports[_0xa2ac('0x6f')]=function(_0x742bc5,_0x3b0531){if(_0x742bc5[_0xa2ac('0x60')]['id']){delete _0x742bc5['body']['id'];}return db[_0xa2ac('0x43')]['find']({'where':{'id':_0x742bc5['params']['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x3b0531,null))[_0xa2ac('0x24')](function(_0x718153){if(_0x718153){_0x742bc5[_0xa2ac('0x60')][_0xa2ac('0x67')]=_0x718153['id'];return db[_0xa2ac('0x70')]['create'](_0x742bc5[_0xa2ac('0x60')]);}})[_0xa2ac('0x24')](respondWithResult(_0x3b0531,null))[_0xa2ac('0x18')](handleError(_0x3b0531,null));};exports['getAnswers']=function(_0x52e104,_0x38fd89){var _0x149afc={'raw':![],'where':{}};var _0x377ae8={};var _0x338bd3={'count':0x0,'rows':[]};return db['MailAccount'][_0xa2ac('0x6a')]({'where':{'id':_0x52e104[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x38fd89,null))[_0xa2ac('0x24')](function(_0x37a889){if(_0x37a889){_0x377ae8[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x70')]['rawAttributes']);_0x377ae8[_0xa2ac('0x48')]=_[_0xa2ac('0x5e')](_0x52e104[_0xa2ac('0x48')]);_0x377ae8[_0xa2ac('0x49')]=_['intersection'](_0x377ae8[_0xa2ac('0x47')],_0x377ae8[_0xa2ac('0x48')]);_0x149afc[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x377ae8[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x52e104[_0xa2ac('0x48')]['fields']));_0x149afc['attributes']=_0x149afc[_0xa2ac('0x4c')][_0xa2ac('0x4d')]?_0x149afc[_0xa2ac('0x4c')]:_0x377ae8[_0xa2ac('0x47')];if(!_0x52e104['query'][_0xa2ac('0x6b')](_0xa2ac('0x4e'))){_0x149afc[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x52e104[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0x149afc[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x52e104[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}_0x149afc['order']=qs['sort'](_0x52e104[_0xa2ac('0x48')]['sort']);_0x149afc[_0xa2ac('0x53')]=qs['filters'](_['pick'](_0x52e104[_0xa2ac('0x48')],_0x377ae8[_0xa2ac('0x49')]));_0x149afc[_0xa2ac('0x53')][_0xa2ac('0x67')]=_0x37a889['id'];if(_0x52e104[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0x149afc[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0x149afc[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x149afc[_0xa2ac('0x4c')],function(_0x11c1df){var _0x2d976b={};_0x2d976b[_0x11c1df]={'$like':'%'+_0x52e104[_0xa2ac('0x48')][_0xa2ac('0x52')]+'%'};return _0x2d976b;})});}_0x149afc=_[_0xa2ac('0x54')]({},_0x149afc,_0x52e104[_0xa2ac('0x56')]);return db[_0xa2ac('0x70')]['count']({'where':_0x149afc['where']})[_0xa2ac('0x24')](function(_0x52e078){_0x338bd3[_0xa2ac('0x20')]=_0x52e078;if(_0x52e104[_0xa2ac('0x48')]['includeAll']){_0x149afc[_0xa2ac('0x58')]=[{'all':!![]}];}return db[_0xa2ac('0x70')]['findAll'](_0x149afc);})[_0xa2ac('0x24')](function(_0x3fa70a){_0x338bd3['rows']=_0x3fa70a;return _0x338bd3;});}})['then'](respondWithFilteredResult(_0x38fd89,_0x149afc))[_0xa2ac('0x18')](handleError(_0x38fd89,null));};exports[_0xa2ac('0x71')]=function(_0x53e7a0,_0x2e299b){return db[_0xa2ac('0x43')]['find']({'where':{'id':_0x53e7a0[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x2e299b,null))['then'](function(_0x1f2ef8){if(_0x1f2ef8){return _0x1f2ef8[_0xa2ac('0x71')](_0x53e7a0[_0xa2ac('0x48')][_0xa2ac('0x6e')]);}})['then'](respondWithStatusCode(_0x2e299b,null))[_0xa2ac('0x18')](handleError(_0x2e299b,null));};exports[_0xa2ac('0x69')]=function(_0x26a900,_0x2659b0){var _0x286de9={'name':_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x28')],'key':_0x26a900['body']['key'],'provider':_0x26a900['body'][_0xa2ac('0x61')]===_0xa2ac('0x62')?null:_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x61')],'email':_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x72')],'ListId':_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x73')],'active':!_[_0xa2ac('0x74')](_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x75')])?_0x26a900[_0xa2ac('0x60')]['active']:!![],'description':_0x26a900[_0xa2ac('0x60')][_0xa2ac('0x76')]||null};var _0x27a60b=getAuthenticationOptions(_0x286de9[_0xa2ac('0x61')],_0x26a900[_0xa2ac('0x60')]);_0x286de9['Imap']=_0x27a60b[_0xa2ac('0x3f')];_0x286de9[_0xa2ac('0x40')]=_0x27a60b[_0xa2ac('0x40')];return db[_0xa2ac('0x43')][_0xa2ac('0x69')](_0x286de9,{'include':[{'model':db[_0xa2ac('0x5c')],'as':_0xa2ac('0x40')},{'model':db[_0xa2ac('0x41')],'as':_0xa2ac('0x3f')}]})[_0xa2ac('0x24')](function(_0x3dfc61){var _0x2b66ae=_0x26a900[_0xa2ac('0x35')][_0xa2ac('0x25')]({'plain':!![]});if(!_0x2b66ae)throw new Error(_0xa2ac('0x77'));if(_0x2b66ae[_0xa2ac('0x78')]===_0xa2ac('0x35')){var _0x29ca1b=_0x3dfc61[_0xa2ac('0x25')]({'plain':!![]});return db[_0xa2ac('0x79')][_0xa2ac('0x5f')]({'where':{'name':_0xa2ac('0x26'),'userProfileId':_0x2b66ae['userProfileId']},'raw':!![]})['then'](function(_0x46c501){if(_0x46c501&&_0x46c501[_0xa2ac('0x7a')]===0x0){return db[_0xa2ac('0x7b')]['create']({'name':_0x29ca1b['name'],'resourceId':_0x29ca1b['id'],'type':_0x46c501[_0xa2ac('0x28')],'sectionId':_0x46c501['id']},{})[_0xa2ac('0x24')](function(){return _0x3dfc61;});}else{return _0x3dfc61;}})[_0xa2ac('0x18')](function(_0x1075b1){logger[_0xa2ac('0x13')](_0xa2ac('0x7c'),_0x1075b1);throw _0x1075b1;});}return _0x3dfc61;})[_0xa2ac('0x24')](respondWithResult(_0x2659b0,0xc9))[_0xa2ac('0x18')](handleError(_0x2659b0,null));};exports[_0xa2ac('0x7d')]=function(_0x5e2249,_0x4e6487){return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x5e2249[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x4e6487,null))['then'](function(_0x1a669e){if(_0x1a669e){return _0x1a669e[_0xa2ac('0x7d')]();}return null;})[_0xa2ac('0x24')](respondWithResult(_0x4e6487,null))[_0xa2ac('0x18')](handleError(_0x4e6487,null));};exports['addImap']=function(_0x4f6111,_0x1cba91){if(_0x4f6111[_0xa2ac('0x60')]['id']){delete _0x4f6111[_0xa2ac('0x60')]['id'];}return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0x4f6111[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x1cba91,null))[_0xa2ac('0x24')](function(_0xa1aa97){if(_0xa1aa97){_0x4f6111['body'][_0xa2ac('0x67')]=_0xa1aa97['id'];return db['MailServerIn'][_0xa2ac('0x69')](_0x4f6111[_0xa2ac('0x60')]);}})['then'](respondWithResult(_0x1cba91,null))['catch'](handleError(_0x1cba91,null));};exports[_0xa2ac('0x7e')]=function(_0x4c14a8,_0x4f791f){return db[_0xa2ac('0x43')]['findOne']({'where':{'id':_0x4c14a8[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x4f791f,null))['then'](function(_0x4fe486){if(_0x4fe486){return _0x4fe486[_0xa2ac('0x7f')](null);}return null;})[_0xa2ac('0x24')](respondWithStatusCode(_0x4f791f,null))[_0xa2ac('0x18')](handleError(_0x4f791f,null));};exports[_0xa2ac('0x80')]=function(_0x2a32cb,_0x2b4eb7){return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x2a32cb[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x2b4eb7,null))['then'](function(_0x4c5901){if(_0x4c5901){return _0x4c5901[_0xa2ac('0x80')]();}return null;})[_0xa2ac('0x24')](respondWithResult(_0x2b4eb7,null))[_0xa2ac('0x18')](handleError(_0x2b4eb7,null));};exports[_0xa2ac('0x81')]=function(_0xefd4bd,_0x2f5435){if(_0xefd4bd[_0xa2ac('0x60')]['id']){delete _0xefd4bd[_0xa2ac('0x60')]['id'];}return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0xefd4bd[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x2f5435,null))[_0xa2ac('0x24')](function(_0xbde5c9){if(_0xbde5c9){_0xefd4bd['body'][_0xa2ac('0x67')]=_0xbde5c9['id'];return db[_0xa2ac('0x5c')][_0xa2ac('0x69')](_0xefd4bd[_0xa2ac('0x60')]);}})[_0xa2ac('0x24')](respondWithResult(_0x2f5435,null))[_0xa2ac('0x18')](handleError(_0x2f5435,null));};exports[_0xa2ac('0x82')]=function(_0x51df59,_0x14cc03){return db['MailAccount']['findOne']({'where':{'id':_0x51df59['params']['id']}})['then'](handleEntityNotFound(_0x14cc03,null))[_0xa2ac('0x24')](function(_0x43d3ea){if(_0x43d3ea){return _0x43d3ea[_0xa2ac('0x83')](null);}return null;})[_0xa2ac('0x24')](respondWithStatusCode(_0x14cc03,null))[_0xa2ac('0x18')](handleError(_0x14cc03,null));};exports['addInteraction']=function(_0x1f3378,_0x258878){return db[_0xa2ac('0x84')][_0xa2ac('0x5f')]({'where':{'id':_0x1f3378[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x258878,null))[_0xa2ac('0x24')](function(_0x11ac8e){if(_0x11ac8e){return _0x11ac8e['addInteraction'](_0x1f3378[_0xa2ac('0x60')][_0xa2ac('0x6e')],_[_0xa2ac('0x85')](_0x1f3378[_0xa2ac('0x60')],[_0xa2ac('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x258878,null))[_0xa2ac('0x18')](handleError(_0x258878,null));};exports['getInteractions']=function(_0xc106df,_0x3737e5){var _0x2b0ecb={'raw':![],'where':{}};var _0x2d2c69={};var _0x5a25fa={'count':0x0,'rows':[]};return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0xc106df[_0xa2ac('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3737e5,null))['then'](function(_0x3feecc){if(_0x3feecc){_0x2d2c69[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x84')][_0xa2ac('0x44')]);_0x2d2c69[_0xa2ac('0x48')]=_[_0xa2ac('0x5e')](_0xc106df['query']);_0x2d2c69[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0x2d2c69[_0xa2ac('0x47')],_0x2d2c69[_0xa2ac('0x48')]);_0x2b0ecb['attributes']=_['intersection'](_0x2d2c69[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x4b')]));_0x2b0ecb[_0xa2ac('0x4c')]=_0x2b0ecb[_0xa2ac('0x4c')][_0xa2ac('0x4d')]?_0x2b0ecb[_0xa2ac('0x4c')]:_0x2d2c69[_0xa2ac('0x47')];if(!_0xc106df['query']['hasOwnProperty'](_0xa2ac('0x4e'))){_0x2b0ecb[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0x2b0ecb[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}_0x2b0ecb[_0xa2ac('0x4f')]=qs[_0xa2ac('0x50')](_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x50')]);_0x2b0ecb['where']=qs['filters'](_[_0xa2ac('0x51')](_0xc106df[_0xa2ac('0x48')],_0x2d2c69['filters']));_0x2b0ecb[_0xa2ac('0x53')][_0xa2ac('0x67')]=_0x3feecc['id'];if(_0xc106df[_0xa2ac('0x48')]['filter']){_0x2b0ecb[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0x2b0ecb[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x2b0ecb[_0xa2ac('0x4c')],function(_0x15dee5){var _0x53f19a={};_0x53f19a[_0x15dee5]={'$like':'%'+_0xc106df['query'][_0xa2ac('0x52')]+'%'};return _0x53f19a;})});}_0x2b0ecb=_[_0xa2ac('0x54')]({},_0x2b0ecb,_0xc106df[_0xa2ac('0x56')]);return db['MailInteraction'][_0xa2ac('0x20')]({'where':_0x2b0ecb[_0xa2ac('0x53')]})[_0xa2ac('0x24')](function(_0x4bc4c8){_0x5a25fa[_0xa2ac('0x20')]=_0x4bc4c8;if(_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x57')]){_0x2b0ecb['include']=[{'model':db[_0xa2ac('0x86')],'as':'Contact','required':![]},{'model':db[_0xa2ac('0x87')],'as':_0xa2ac('0x88'),'attributes':[_0xa2ac('0x28'),'fullname',_0xa2ac('0x89')],'required':![]},{'model':db[_0xa2ac('0x8a')],'as':_0xa2ac('0x8b'),'attributes':['id','name',_0xa2ac('0x8c')],'where':_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x8d')]?{'id':_0xc106df['query']['tag']}:undefined,'required':_0xc106df[_0xa2ac('0x48')][_0xa2ac('0x8d')]?!![]:![]}];}return db['MailInteraction'][_0xa2ac('0x59')](_0x2b0ecb);})['then'](function(_0x2848b5){_0x5a25fa[_0xa2ac('0x6c')]=_0x2848b5;return _0x5a25fa;});}})[_0xa2ac('0x24')](respondWithFilteredResult(_0x3737e5,_0x2b0ecb))[_0xa2ac('0x18')](handleError(_0x3737e5,null));};exports[_0xa2ac('0x8e')]=function addApplications(_0x44e4d5,_0x311d1a){var _0x430c07=_0x44e4d5['params']['id'];var _0x1c0e1a=_0x44e4d5['body'];var _0x1cfdb3=0xc8;var _0x39a107=null;return db[_0xa2ac('0x8f')][_0xa2ac('0x90')]({'isolationLevel':db['sequelize'][_0xa2ac('0x91')][_0xa2ac('0x92')][_0xa2ac('0x93')]},function(_0x3c4aee){return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x430c07},'transaction':_0x3c4aee})['then'](function(_0x37e8ed){if(_0x37e8ed){return db[_0xa2ac('0x94')][_0xa2ac('0x23')]({'where':{'MailAccountId':_0x430c07},'transaction':_0x3c4aee})[_0xa2ac('0x24')](function(){var _0x5ee328=_[_0xa2ac('0x42')](_0x1c0e1a,function(_0x4709ce){_0x4709ce[_0xa2ac('0x67')]=_0x430c07;return _0x4709ce;});return db[_0xa2ac('0x94')][_0xa2ac('0x95')](_0x5ee328,{'transaction':_0x3c4aee});});}else{_0x1cfdb3=0x194;_0x39a107=[];}});})['then'](function(){if(_0x1cfdb3!==0x194){return db['MailApplication'][_0xa2ac('0x96')]({'where':{'MailAccountId':_0x430c07},'order':'priority'})[_0xa2ac('0x24')](function(_0xfe4653){_0x39a107=_0xfe4653;});}})[_0xa2ac('0x18')](function(_0x364e08){_0x1cfdb3=0x1f4;logger['error'](_0x364e08[_0xa2ac('0x27')]);if(_0x364e08['name']){delete _0x364e08[_0xa2ac('0x28')];}_0x39a107=_0x364e08;})[_0xa2ac('0x97')](function(){if(_0x39a107===null){_0x311d1a[_0xa2ac('0x19')](_0x1cfdb3);}else{if(_0x1cfdb3===0x1f4){_0x311d1a[_0xa2ac('0x1a')](_0x1cfdb3)[_0xa2ac('0x29')](_0x39a107);}else{_0x311d1a[_0xa2ac('0x1a')](_0x1cfdb3)['json'](_0x39a107);}}});};exports['getApplications']=function(_0x2875ab,_0x55affb){var _0x521d84={};var _0x39c5a1={};var _0x4825c4;var _0x3035a4;return db[_0xa2ac('0x43')]['findOne']({'where':{'id':_0x2875ab[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x55affb,null))['then'](function(_0x51aa2d){if(_0x51aa2d){_0x4825c4=_0x51aa2d;_0x39c5a1[_0xa2ac('0x47')]=_['keys'](db[_0xa2ac('0x94')][_0xa2ac('0x44')]);_0x39c5a1['query']=_[_0xa2ac('0x5e')](_0x2875ab[_0xa2ac('0x48')]);_0x39c5a1['filters']=_[_0xa2ac('0x4a')](_0x39c5a1[_0xa2ac('0x47')],_0x39c5a1[_0xa2ac('0x48')]);_0x521d84[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x39c5a1[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x2875ab[_0xa2ac('0x48')][_0xa2ac('0x4b')]));_0x521d84[_0xa2ac('0x4c')]=_0x521d84['attributes'][_0xa2ac('0x4d')]?_0x521d84[_0xa2ac('0x4c')]:_0x39c5a1['model'];_0x521d84[_0xa2ac('0x4f')]=qs['sort'](_0x2875ab[_0xa2ac('0x48')]['sort']);_0x521d84[_0xa2ac('0x53')]=qs[_0xa2ac('0x49')](_[_0xa2ac('0x51')](_0x2875ab[_0xa2ac('0x48')],_0x39c5a1[_0xa2ac('0x49')]));if(_0x2875ab['query']['filter']){_0x521d84[_0xa2ac('0x53')]=_[_0xa2ac('0x54')](_0x521d84[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x521d84[_0xa2ac('0x4c')],function(_0x3986a0){var _0x2ccd25={};_0x2ccd25[_0x3986a0]={'$like':'%'+_0x2875ab[_0xa2ac('0x48')]['filter']+'%'};return _0x2ccd25;})});}_0x521d84=_[_0xa2ac('0x54')]({},_0x521d84,_0x2875ab['options']);return _0x4825c4[_0xa2ac('0x98')](_0x521d84);}})[_0xa2ac('0x24')](function(_0x472b11){if(_0x472b11){_0x3035a4=_0x472b11['length'];if(!_0x2875ab['query']['hasOwnProperty'](_0xa2ac('0x4e'))){_0x521d84['limit']=qs[_0xa2ac('0x1f')](_0x2875ab['query'][_0xa2ac('0x1f')]);_0x521d84[_0xa2ac('0x1d')]=qs['offset'](_0x2875ab[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}return _0x4825c4[_0xa2ac('0x98')](_0x521d84);}})[_0xa2ac('0x24')](function(_0x47dcb2){if(_0x47dcb2){return _0x47dcb2?{'count':_0x3035a4,'rows':_0x47dcb2}:null;}})[_0xa2ac('0x24')](respondWithResult(_0x55affb,null))['catch'](handleError(_0x55affb,null));};exports[_0xa2ac('0x99')]=function(_0x480776,_0x385d75){var _0x1679c9={'raw':!![],'where':{}};var _0x2e3d3f={};var _0x534f37={'count':0x0,'rows':[]};return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x480776[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x385d75,null))[_0xa2ac('0x24')](function(_0x7ab205){if(_0x7ab205){_0x2e3d3f[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x9a')][_0xa2ac('0x44')]);_0x2e3d3f[_0xa2ac('0x48')]=_[_0xa2ac('0x5e')](_0x480776[_0xa2ac('0x48')]);_0x2e3d3f[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0x2e3d3f[_0xa2ac('0x47')],_0x2e3d3f[_0xa2ac('0x48')]);_0x1679c9[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x2e3d3f[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x480776[_0xa2ac('0x48')]['fields']));_0x1679c9[_0xa2ac('0x4c')]=_0x1679c9[_0xa2ac('0x4c')]['length']?_0x1679c9[_0xa2ac('0x4c')]:_0x2e3d3f[_0xa2ac('0x47')];if(!_0x480776[_0xa2ac('0x48')][_0xa2ac('0x6b')]('nolimit')){_0x1679c9[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x480776[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0x1679c9[_0xa2ac('0x1d')]=qs[_0xa2ac('0x1d')](_0x480776[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}_0x1679c9['order']=qs[_0xa2ac('0x50')](_0x480776[_0xa2ac('0x48')][_0xa2ac('0x50')]);_0x1679c9[_0xa2ac('0x53')]=qs['filters'](_[_0xa2ac('0x51')](_0x480776[_0xa2ac('0x48')],_0x2e3d3f[_0xa2ac('0x49')]));_0x1679c9['where'][_0xa2ac('0x67')]=_0x7ab205['id'];if(_0x480776[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0x1679c9['where']=_[_0xa2ac('0x54')](_0x1679c9[_0xa2ac('0x53')],{'$or':_[_0xa2ac('0x42')](_0x1679c9[_0xa2ac('0x4c')],function(_0x664757){var _0x13b761={};_0x13b761[_0x664757]={'$like':'%'+_0x480776['query'][_0xa2ac('0x52')]+'%'};return _0x13b761;})});}if(_0x480776[_0xa2ac('0x48')][_0xa2ac('0x9b')]){var _0x1f8cb6=_0x480776['query'][_0xa2ac('0x9b')]['split'](',');var _0xff2dea={};_0xff2dea[_0x1f8cb6[0x0]]={'$gte':moment(_0x1f8cb6[0x1])['format'](_0xa2ac('0x9c'))};_0x1679c9['where']=_['merge'](_0x1679c9['where'],_0xff2dea);}_0x1679c9=_[_0xa2ac('0x54')]({},_0x1679c9,_0x480776['options']);return db[_0xa2ac('0x9a')][_0xa2ac('0x20')]({'where':_0x1679c9[_0xa2ac('0x53')]})['then'](function(_0x3ec2e1){_0x534f37[_0xa2ac('0x20')]=_0x3ec2e1;if(_0x480776['query']['includeAll']){_0x1679c9[_0xa2ac('0x58')]=[{'all':!![]}];}return db['MailMessage'][_0xa2ac('0x59')](_0x1679c9);})[_0xa2ac('0x24')](function(_0x58bb65){if(_0x480776[_0xa2ac('0x48')][_0xa2ac('0x9d')]===_0xa2ac('0x9e')){for(var _0x1a44fe=0x0;_0x1a44fe<_0x58bb65[_0xa2ac('0x4d')];_0x1a44fe++){_0x58bb65[_0x1a44fe][_0xa2ac('0x60')]=juice(_0x58bb65[_0x1a44fe]['body']);}}_0x534f37[_0xa2ac('0x6c')]=_0x58bb65;return _0x534f37;});}})[_0xa2ac('0x24')](respondWithFilteredResult(_0x385d75,_0x1679c9))[_0xa2ac('0x18')](handleError(_0x385d75,null));};exports[_0xa2ac('0x29')]=function(_0x4c9990,_0x4164be){var _0x4a466f,_0x104458={},_0x2ef3dd;if(_0x4c9990[_0xa2ac('0x60')]['to']){_0x2ef3dd=_0x4c9990['body']['to']['split'](',')[0x0];}return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0x4c9990[_0xa2ac('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xa2ac('0x9f'),'include':[{'model':db['CmContact'],'as':_0xa2ac('0xa0'),'where':{'email':_0x2ef3dd},'limit':0x1,'order':[[_0xa2ac('0xa1'),'DESC']]}]},{'model':db[_0xa2ac('0x5c')],'as':_0xa2ac('0x40'),'raw':!![],'include':[{'model':db[_0xa2ac('0xa2')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x4164be,null))['then'](function(_0x27da81){if(!_0x27da81)return;_0x4a466f=_0x27da81;if(!_0x27da81[_0xa2ac('0x40')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0xa2ac('0x74')](_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa3')])){_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa3')]=util[_0xa2ac('0xa4')](_0xa2ac('0xa5'),_0x27da81['name'],_0x27da81[_0xa2ac('0x72')]||_0x27da81[_0xa2ac('0x40')][_0xa2ac('0x35')]);}if(_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')]&&_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')][_0xa2ac('0x4d')]){for(var _0x2b6060=0x0;_0x2b6060<_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')]['length'];_0x2b6060+=0x1){_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')][_0x2b6060]={'filename':_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')][_0x2b6060][_0xa2ac('0x28')],'path':path[_0xa2ac('0xa7')](config[_0xa2ac('0xa8')],_0xa2ac('0xa9'),_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xa6')][_0x2b6060][_0xa2ac('0xaa')])};}}var _0x25ca9c=_0x27da81[_0xa2ac('0xab')]();return respondWithRpcPromise('SendMail',_0xa2ac('0xac'),{'account':_0x25ca9c,'message':_0x4c9990[_0xa2ac('0x60')]});})['then'](function(_0x402c21){if(!_0x402c21)return;_0x104458=_0x402c21;if(!_0x4a466f[_0xa2ac('0x9f')])throw new Error('List\x20not\x20found');if(_0x4a466f[_0xa2ac('0x9f')][_0xa2ac('0xa0')]['length'])return _0x4a466f[_0xa2ac('0x9f')][_0xa2ac('0xa0')][0x0];return db['CmContact']['create'](_['defaults'](_0x4c9990[_0xa2ac('0x60')],{'firstName':_0x4c9990[_0xa2ac('0x60')]['to'],'email':_0x4c9990[_0xa2ac('0x60')]['to'],'phone':_0x4c9990[_0xa2ac('0x60')]['to'],'ListId':_0x4a466f[_0xa2ac('0x73')]}));})[_0xa2ac('0x24')](function(_0x308125){if(!_0x308125)return;var _0x3d0170={'UserId':_0x4c9990[_0xa2ac('0x35')]['id'],'ContactId':_0x308125['id'],'MailAccountId':_0x4a466f['id'],'inReplyTo':_0x104458['messageId'],'to':_0x4c9990[_0xa2ac('0x60')]['from'],'cc':_0x4c9990['body']['cc'],'subject':_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xad')],'attach':_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xae')],'firstMsgDirection':_0xa2ac('0xaf'),'lastMsgAt':moment()['format'](_0xa2ac('0x9c')),'lastMsgDirection':_0xa2ac('0xaf'),'Messages':[_[_0xa2ac('0x54')](_0x4c9990['body'],{'messageId':_0x104458['messageId'],'sentAt':moment()[_0xa2ac('0xa4')](_0xa2ac('0x9c')),'read':!![],'MailAccountId':_0x4a466f['id'],'UserId':_0x4c9990[_0xa2ac('0x35')]['id'],'ContactId':_0x308125['id']})]};if(_0x4c9990['body'][_0xa2ac('0xb0')]){_0x3d0170=_[_0xa2ac('0x54')](_0x3d0170,_0x4c9990[_0xa2ac('0x60')][_0xa2ac('0xb0')]);}return db['MailInteraction'][_0xa2ac('0x69')](_0x3d0170,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0xa2ac('0x24')](respondWithResult(_0x4164be,null))['catch'](handleError(_0x4164be,null));};exports[_0xa2ac('0xb1')]=function(_0x5df2ca,_0x39fab7){return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0x5df2ca[_0xa2ac('0x5b')]['id']},'include':[{'model':db[_0xa2ac('0x5c')],'as':_0xa2ac('0x40'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa2ac('0xa2'),'raw':!![]}]}]})[_0xa2ac('0x24')](handleEntityNotFound(_0x39fab7,null))[_0xa2ac('0x24')](function(_0x163911){if(!_0x163911[_0xa2ac('0x40')])return;var _0x562e4f=_0x163911[_0xa2ac('0xab')]();return respondWithRpcPromise('VerifySmtp',_0xa2ac('0xb1'),{'account':_0x562e4f});})[_0xa2ac('0x24')](respondWithResult(_0x39fab7,null))[_0xa2ac('0x18')](handleError(_0x39fab7,null));};exports[_0xa2ac('0x23')]=function(_0x14a497,_0x4b429a){return db[_0xa2ac('0x43')][_0xa2ac('0x5f')]({'where':{'id':_0x14a497[_0xa2ac('0x5b')]['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x4b429a,null))[_0xa2ac('0x24')](function(_0x3592db){if(_0x3592db&&_0x3592db[_0xa2ac('0x3d')]){throw new db[(_0xa2ac('0xb2'))][(_0xa2ac('0xb3'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3592db;})[_0xa2ac('0x24')](removeEntity(_0x4b429a,null))[_0xa2ac('0x18')](handleError(_0x4b429a,null));};exports[_0xa2ac('0xb4')]=function(_0x1977a9,_0x4d82ec){return db['MailAccount'][_0xa2ac('0x5f')]({'where':{'id':_0x1977a9['params']['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x4d82ec,null))['then'](function(_0x211981){if(_0x211981){return _0x211981[_0xa2ac('0xb4')](_0x1977a9[_0xa2ac('0x60')][_0xa2ac('0x6e')],_[_0xa2ac('0x85')](_0x1977a9['body'],['ids','id'])||{})['spread'](function(_0x343737){for(var _0x33c89f=0x0;_0x33c89f<_0x1977a9['body'][_0xa2ac('0x6e')][_0xa2ac('0x4d')];_0x33c89f+=0x1){socket[_0xa2ac('0xb5')]('userMailAccount:save',{'UserId':Number(_0x1977a9[_0xa2ac('0x60')]['ids'][_0x33c89f]),'MailAccountId':Number(_0x1977a9[_0xa2ac('0x5b')]['id'])});}return _0x343737;});}})['then'](respondWithResult(_0x4d82ec,null))[_0xa2ac('0x18')](handleError(_0x4d82ec,null));};exports['removeAgents']=function(_0x2efc9a,_0x372156){return db['MailAccount']['find']({'where':{'id':_0x2efc9a['params']['id']}})['then'](handleEntityNotFound(_0x372156,null))['then'](function(_0x176267){if(_0x176267){return _0x176267['removeAgents'](_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')])['then'](function(){if(_[_0xa2ac('0xb6')](_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')])){for(var _0x39f96=0x0;_0x39f96<_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')][_0xa2ac('0x4d')];_0x39f96+=0x1){socket[_0xa2ac('0xb5')](_0xa2ac('0xb7'),{'UserId':Number(_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')][_0x39f96]),'MailAccountId':Number(_0x2efc9a[_0xa2ac('0x5b')]['id'])});}}else{socket[_0xa2ac('0xb5')]('userMailAccount:remove',{'UserId':Number(_0x2efc9a[_0xa2ac('0x48')][_0xa2ac('0x6e')]),'MailAccountId':Number(_0x2efc9a[_0xa2ac('0x5b')]['id'])});}});}})[_0xa2ac('0x24')](respondWithStatusCode(_0x372156,null))[_0xa2ac('0x18')](handleError(_0x372156,null));};exports[_0xa2ac('0xb8')]=function(_0x3a774e,_0x43a78c){var _0x5a7f03={};var _0x40b8cd={};var _0x1c1f70;var _0x2d8799;return db[_0xa2ac('0x43')][_0xa2ac('0x6a')]({'where':{'id':_0x3a774e['params']['id']}})[_0xa2ac('0x24')](handleEntityNotFound(_0x43a78c,null))[_0xa2ac('0x24')](function(_0x38dacf){if(_0x38dacf){_0x1c1f70=_0x38dacf;_0x40b8cd[_0xa2ac('0x47')]=_[_0xa2ac('0x5e')](db[_0xa2ac('0x87')]['rawAttributes']);_0x40b8cd['query']=_[_0xa2ac('0x5e')](_0x3a774e[_0xa2ac('0x48')]);_0x40b8cd[_0xa2ac('0x49')]=_[_0xa2ac('0x4a')](_0x40b8cd['model'],_0x40b8cd['query']);_0x5a7f03[_0xa2ac('0x4c')]=_[_0xa2ac('0x4a')](_0x40b8cd[_0xa2ac('0x47')],qs[_0xa2ac('0x4b')](_0x3a774e[_0xa2ac('0x48')]['fields']));_0x5a7f03[_0xa2ac('0x4c')]=_0x5a7f03['attributes'][_0xa2ac('0x4d')]?_0x5a7f03['attributes']:_0x40b8cd[_0xa2ac('0x47')];_0x5a7f03[_0xa2ac('0x4f')]=qs[_0xa2ac('0x50')](_0x3a774e[_0xa2ac('0x48')]['sort']);_0x5a7f03[_0xa2ac('0x53')]=qs[_0xa2ac('0x49')](_[_0xa2ac('0x51')](_0x3a774e['query'],_0x40b8cd[_0xa2ac('0x49')]));if(_0x3a774e[_0xa2ac('0x48')][_0xa2ac('0x52')]){_0x5a7f03['where']=_['merge'](_0x5a7f03[_0xa2ac('0x53')],{'$or':_['map'](_0x5a7f03[_0xa2ac('0x4c')],function(_0x281b72){var _0x17c1bb={};_0x17c1bb[_0x281b72]={'$like':'%'+_0x3a774e['query'][_0xa2ac('0x52')]+'%'};return _0x17c1bb;})});}_0x5a7f03=_[_0xa2ac('0x54')]({},_0x5a7f03,_0x3a774e[_0xa2ac('0x56')]);return _0x1c1f70[_0xa2ac('0xb8')](_0x5a7f03);}})[_0xa2ac('0x24')](function(_0x128d72){if(_0x128d72){_0x2d8799=_0x128d72[_0xa2ac('0x4d')];if(!_0x3a774e[_0xa2ac('0x48')][_0xa2ac('0x6b')](_0xa2ac('0x4e'))){_0x5a7f03[_0xa2ac('0x1f')]=qs[_0xa2ac('0x1f')](_0x3a774e[_0xa2ac('0x48')][_0xa2ac('0x1f')]);_0x5a7f03[_0xa2ac('0x1d')]=qs['offset'](_0x3a774e[_0xa2ac('0x48')][_0xa2ac('0x1d')]);}return _0x1c1f70[_0xa2ac('0xb8')](_0x5a7f03);}})[_0xa2ac('0x24')](function(_0x1604f2){if(_0x1604f2){return _0x1604f2?{'count':_0x2d8799,'rows':_0x1604f2}:null;}})[_0xa2ac('0x24')](respondWithResult(_0x43a78c,null))['catch'](handleError(_0x43a78c,null));};
\ No newline at end of file
index 472520e..34f14c4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5a6=['events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x312c08,_0x19600e){var _0x108dd=function(_0x118769){while(--_0x118769){_0x312c08['push'](_0x312c08['shift']());}};_0x108dd(++_0x19600e);}(_0xe5a6,0x104));var _0x6e5a=function(_0x55b460,_0x497077){_0x55b460=_0x55b460-0x0;var _0x3ac537=_0xe5a6[_0x55b460];return _0x3ac537;};'use strict';var EventEmitter=require(_0x6e5a('0x0'));var MailAccount=require(_0x6e5a('0x1'))['db'][_0x6e5a('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6e5a('0x3')](0x0);var events={'afterCreate':_0x6e5a('0x4'),'afterUpdate':_0x6e5a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3123e6){return function(_0x4195c1,_0x51944b,_0x34a9ff){MailAccountEvents[_0x6e5a('0x6')](_0x3123e6+':'+_0x4195c1['id'],_0x4195c1);MailAccountEvents[_0x6e5a('0x6')](_0x3123e6,_0x4195c1);_0x34a9ff(null);};}for(var e in events){if(events[_0x6e5a('0x7')](e)){var event=events[e];MailAccount[_0x6e5a('0x8')](e,emitEvent(event));}}module[_0x6e5a('0x9')]=MailAccountEvents;
\ No newline at end of file
+var _0xafc4=['update','remove','emit','hasOwnProperty','hook','exports','events','MailAccount','save'];(function(_0x223c0d,_0x3ec04d){var _0x207827=function(_0x39d240){while(--_0x39d240){_0x223c0d['push'](_0x223c0d['shift']());}};_0x207827(++_0x3ec04d);}(_0xafc4,0x69));var _0x4afc=function(_0x8aba1a,_0x106e8a){_0x8aba1a=_0x8aba1a-0x0;var _0x4dca9a=_0xafc4[_0x8aba1a];return _0x4dca9a;};'use strict';var EventEmitter=require(_0x4afc('0x0'));var MailAccount=require('../../mysqldb')['db'][_0x4afc('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4afc('0x2'),'afterUpdate':_0x4afc('0x3'),'afterDestroy':_0x4afc('0x4')};function emitEvent(_0x237ea0){return function(_0x4d9dbd,_0x49f417,_0x5378e5){MailAccountEvents[_0x4afc('0x5')](_0x237ea0+':'+_0x4d9dbd['id'],_0x4d9dbd);MailAccountEvents[_0x4afc('0x5')](_0x237ea0,_0x4d9dbd);_0x5378e5(null);};}for(var e in events){if(events[_0x4afc('0x6')](e)){var event=events[e];MailAccount[_0x4afc('0x7')](e,emitEvent(event));}}module[_0x4afc('0x8')]=MailAccountEvents;
\ No newline at end of file
index c25064d..66dafa5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f3a=['exports','mail_accounts','provider','custom','service','host','Smtp','port','modernAuthentication','user','CloudProvider','data5','auth','pass','./mailAccount.attributes'];(function(_0x47b5e0,_0x273723){var _0x128d60=function(_0x5dc543){while(--_0x5dc543){_0x47b5e0['push'](_0x47b5e0['shift']());}};_0x128d60(++_0x273723);}(_0x0f3a,0x12b));var _0xa0f3=function(_0x247168,_0x4fbebb){_0x247168=_0x247168-0x0;var _0x4df64d=_0x0f3a[_0x247168];return _0x4df64d;};'use strict';var attributes=require(_0xa0f3('0x0'));module[_0xa0f3('0x1')]=function(_0x2c47d8){return _0x2c47d8['define']('MailAccount',attributes,{'tableName':_0xa0f3('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x19c876=this;var _0x13bd85={'id':_0x19c876['id'],'tls':{'rejectUnauthorized':![]}};if(_0x19c876[_0xa0f3('0x3')]!==_0xa0f3('0x4')){_0x13bd85[_0xa0f3('0x5')]=_0x19c876[_0xa0f3('0x3')];}else{_0x13bd85[_0xa0f3('0x6')]=_0x19c876[_0xa0f3('0x7')]['host'];_0x13bd85[_0xa0f3('0x8')]=_0x19c876[_0xa0f3('0x7')][_0xa0f3('0x8')];_0x13bd85['secure']=_0x19c876[_0xa0f3('0x7')]['secure'];}if(_0x19c876['Smtp']['authentication']){if(_0x19c876['Smtp'][_0xa0f3('0x9')]){if(!_0x19c876[_0xa0f3('0x7')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x13bd85['auth']={'type':'OAuth2','user':_0x19c876[_0xa0f3('0x7')][_0xa0f3('0xa')],'accessToken':_0x19c876['Smtp'][_0xa0f3('0xb')][_0xa0f3('0xc')]};}else{_0x13bd85[_0xa0f3('0xd')]={'user':_0x19c876['Smtp'][_0xa0f3('0xa')],'pass':_0x19c876[_0xa0f3('0x7')][_0xa0f3('0xe')]};}}return _0x13bd85;}}});};
\ No newline at end of file
+var _0x2841=['./mailAccount.attributes','exports','define','MailAccount','custom','service','provider','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','user','data5','auth','pass'];(function(_0x2a5f11,_0x24988a){var _0xc4133b=function(_0x1e06cb){while(--_0x1e06cb){_0x2a5f11['push'](_0x2a5f11['shift']());}};_0xc4133b(++_0x24988a);}(_0x2841,0xd1));var _0x1284=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0x2841[_0x239b31];return _0x41c8be;};'use strict';var attributes=require(_0x1284('0x0'));module[_0x1284('0x1')]=function(_0x3a0dad){return _0x3a0dad[_0x1284('0x2')](_0x1284('0x3'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xca4f2f=this;var _0x36be64={'id':_0xca4f2f['id'],'tls':{'rejectUnauthorized':![]}};if(_0xca4f2f['provider']!==_0x1284('0x4')){_0x36be64[_0x1284('0x5')]=_0xca4f2f[_0x1284('0x6')];}else{_0x36be64[_0x1284('0x7')]=_0xca4f2f[_0x1284('0x8')][_0x1284('0x7')];_0x36be64[_0x1284('0x9')]=_0xca4f2f[_0x1284('0x8')]['port'];_0x36be64[_0x1284('0xa')]=_0xca4f2f[_0x1284('0x8')][_0x1284('0xa')];}if(_0xca4f2f['Smtp'][_0x1284('0xb')]){if(_0xca4f2f['Smtp'][_0x1284('0xc')]){if(!_0xca4f2f[_0x1284('0x8')][_0x1284('0xd')])throw new Error(_0x1284('0xe'));_0x36be64['auth']={'type':'OAuth2','user':_0xca4f2f[_0x1284('0x8')][_0x1284('0xf')],'accessToken':_0xca4f2f[_0x1284('0x8')][_0x1284('0xd')][_0x1284('0x10')]};}else{_0x36be64[_0x1284('0x11')]={'user':_0xca4f2f[_0x1284('0x8')]['user'],'pass':_0xca4f2f['Smtp'][_0x1284('0x12')]};}}return _0x36be64;}}});};
\ No newline at end of file
index 791dc26..4acc7bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6eed=['ListId','List\x20not\x20found','messageId','generate','subject','attach','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','format','interaction','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','client','http','redis','defaults','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','MailAccount','options','raw','where','limit','include','map','attributes','model','GetMailAccount','ShowMailAccount','find','smtpOptions','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList','List','Contacts','updatedAt','DESC','MailApplication','Applications','Smtp','CloudProvider','get','omit','applications','list','priority','autoclose','push','close','*,*,*,*','length'];(function(_0x528962,_0x46222b){var _0x3ea5d8=function(_0x104920){while(--_0x104920){_0x528962['push'](_0x528962['shift']());}};_0x3ea5d8(++_0x46222b);}(_0x6eed,0xff));var _0xd6ee=function(_0x2575d8,_0x30d5ac){_0x2575d8=_0x2575d8-0x0;var _0x19e6c8=_0x6eed[_0x2575d8];return _0x19e6c8;};'use strict';var _=require(_0xd6ee('0x0'));var moment=require(_0xd6ee('0x1'));var BPromise=require(_0xd6ee('0x2'));var rs=require(_0xd6ee('0x3'));var Redis=require(_0xd6ee('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xd6ee('0x5'))(_0xd6ee('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd6ee('0x7')][_0xd6ee('0x8')]({'port':0x232c});config[_0xd6ee('0x9')]=_[_0xd6ee('0xa')](config[_0xd6ee('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6ee('0x9')]));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x5edcd3,_0x2c4f23,_0x213396){return new BPromise(function(_0x5c3c61,_0x24385c){return client[_0xd6ee('0xb')](_0x5edcd3,_0x213396)[_0xd6ee('0xc')](function(_0x2f7ec1){logger['info'](_0xd6ee('0xd'),_0x2c4f23,_0xd6ee('0xe'));logger[_0xd6ee('0xf')](_0xd6ee('0x10'),_0x2c4f23,_0xd6ee('0xe'),JSON[_0xd6ee('0x11')](_0x2f7ec1));if(_0x2f7ec1['error']){if(_0x2f7ec1[_0xd6ee('0x12')][_0xd6ee('0x13')]===0x1f4){logger['error'](_0xd6ee('0xd'),_0x2c4f23,_0x2f7ec1[_0xd6ee('0x12')][_0xd6ee('0x14')]);return _0x24385c(_0x2f7ec1[_0xd6ee('0x12')][_0xd6ee('0x14')]);}logger[_0xd6ee('0x12')]('MailAccount,\x20%s,\x20%s',_0x2c4f23,_0x2f7ec1[_0xd6ee('0x12')][_0xd6ee('0x14')]);return _0x5c3c61(_0x2f7ec1[_0xd6ee('0x12')]['message']);}else{logger[_0xd6ee('0x15')]('MailAccount,\x20%s,\x20%s',_0x2c4f23,_0xd6ee('0xe'));_0x5c3c61(_0x2f7ec1[_0xd6ee('0x16')][_0xd6ee('0x14')]);}})['catch'](function(_0x8a2718){logger['error'](_0xd6ee('0xd'),_0x2c4f23,_0x8a2718);_0x24385c(_0x8a2718);});});}exports['GetMailAccount']=function(_0x31ae0f){var _0x28cf1c=this;return new Promise(function(_0x23ff1f,_0x2888ef){return db[_0xd6ee('0x17')]['findAll']({'raw':_0x31ae0f[_0xd6ee('0x18')]?_0x31ae0f['options'][_0xd6ee('0x19')]===undefined?!![]:![]:!![],'where':_0x31ae0f[_0xd6ee('0x18')]?_0x31ae0f[_0xd6ee('0x18')][_0xd6ee('0x1a')]||null:null,'attributes':_0x31ae0f[_0xd6ee('0x18')]?_0x31ae0f['options']['attributes']||null:null,'limit':_0x31ae0f[_0xd6ee('0x18')]?_0x31ae0f['options'][_0xd6ee('0x1b')]||null:null,'include':_0x31ae0f['options']?_0x31ae0f[_0xd6ee('0x18')][_0xd6ee('0x1c')]?_[_0xd6ee('0x1d')](_0x31ae0f[_0xd6ee('0x18')][_0xd6ee('0x1c')],function(_0x5476f2){return{'model':db[_0x5476f2['model']],'as':_0x5476f2['as'],'attributes':_0x5476f2[_0xd6ee('0x1e')],'include':_0x5476f2[_0xd6ee('0x1c')]?_['map'](_0x5476f2[_0xd6ee('0x1c')],function(_0xa1e700){return{'model':db[_0xa1e700[_0xd6ee('0x1f')]],'as':_0xa1e700['as'],'attributes':_0xa1e700[_0xd6ee('0x1e')],'include':_0xa1e700[_0xd6ee('0x1c')]?_[_0xd6ee('0x1d')](_0xa1e700[_0xd6ee('0x1c')],function(_0x5f33d5){return{'model':db[_0x5f33d5[_0xd6ee('0x1f')]],'as':_0x5f33d5['as'],'attributes':_0x5f33d5[_0xd6ee('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bcdd6){logger[_0xd6ee('0x15')](_0xd6ee('0x20'),_0x31ae0f);logger[_0xd6ee('0xf')](_0xd6ee('0x20'),_0x31ae0f,JSON[_0xd6ee('0x11')](_0x5bcdd6));_0x23ff1f(_0x5bcdd6);})['catch'](function(_0x414015){logger[_0xd6ee('0x12')](_0xd6ee('0x20'),_0x414015['message'],_0x31ae0f);_0x2888ef(_0x28cf1c[_0xd6ee('0x12')](0x1f4,_0x414015[_0xd6ee('0x14')]));});});};exports[_0xd6ee('0x21')]=function(_0x54d471){var _0x119c4a=this;return new Promise(function(_0x23b43f,_0x1f659a){return db[_0xd6ee('0x17')][_0xd6ee('0x22')]({'raw':_0x54d471[_0xd6ee('0x18')]?_0x54d471['options'][_0xd6ee('0x19')]===undefined?!![]:![]:!![],'where':_0x54d471[_0xd6ee('0x18')]?_0x54d471[_0xd6ee('0x18')][_0xd6ee('0x1a')]||null:null,'attributes':_0x54d471['options']?_0x54d471[_0xd6ee('0x18')][_0xd6ee('0x1e')]||null:null,'include':_0x54d471[_0xd6ee('0x18')]?_0x54d471['options']['include']?_[_0xd6ee('0x1d')](_0x54d471[_0xd6ee('0x18')][_0xd6ee('0x1c')],function(_0x139a15){return{'model':db[_0x139a15[_0xd6ee('0x1f')]],'as':_0x139a15['as'],'attributes':_0x139a15[_0xd6ee('0x1e')],'include':_0x139a15[_0xd6ee('0x1c')]?_[_0xd6ee('0x1d')](_0x139a15[_0xd6ee('0x1c')],function(_0x1e9f94){return{'model':db[_0x1e9f94[_0xd6ee('0x1f')]],'as':_0x1e9f94['as'],'attributes':_0x1e9f94[_0xd6ee('0x1e')],'include':_0x1e9f94[_0xd6ee('0x1c')]?_[_0xd6ee('0x1d')](_0x1e9f94[_0xd6ee('0x1c')],function(_0x4a755a){return{'model':db[_0x4a755a[_0xd6ee('0x1f')]],'as':_0x4a755a['as'],'attributes':_0x4a755a[_0xd6ee('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd6ee('0xc')](function(_0x533273){if(_0x54d471['options']['smtp']===!![])_0x533273['setDataValue'](_0xd6ee('0x23'),_0x533273[_0xd6ee('0x24')]());logger[_0xd6ee('0x15')](_0xd6ee('0x21'),_0x54d471);logger[_0xd6ee('0xf')](_0xd6ee('0x21'),_0x54d471,JSON[_0xd6ee('0x11')](_0x533273));_0x23b43f(_0x533273);})['catch'](function(_0x158d31){logger[_0xd6ee('0x12')](_0xd6ee('0x21'),_0x158d31[_0xd6ee('0x14')],_0x54d471);_0x1f659a(_0x119c4a[_0xd6ee('0x12')](0x1f4,_0x158d31[_0xd6ee('0x14')]));});});};exports[_0xd6ee('0x25')]=function(_0xdccf56){var _0x13ef37=this;return new Promise(function(_0x24a7cb,_0x49383c){var _0x5365d9={'body':_0xdccf56['body'],'channel':_0xd6ee('0x26')};var _0x4ed7d6=_[_0xd6ee('0x27')](_[_0xd6ee('0x28')](db[_0xd6ee('0x29')][_0xd6ee('0x2a')]),[_0xd6ee('0x2b'),'updatedAt','CompanyId','ListId']);var _0x557936=![];if(_0xdccf56[_0xd6ee('0x2c')]['id']){delete _0xdccf56[_0xd6ee('0x2c')]['id'];}if(_[_0xd6ee('0x2d')](_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x2e')])){return _0x49383c(_0x13ef37[_0xd6ee('0x12')](0x1f4,_0xd6ee('0x2f')));}if(_[_0xd6ee('0x2d')](_0xdccf56[_0xd6ee('0x2c')]['body'])||_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x2c')]===''){return _0x49383c(_0x13ef37['error'](0x1f4,_0xd6ee('0x30')));}if(_['isNil'](_0xdccf56['body'][_0xd6ee('0x31')])){return _0x49383c(_0x13ef37[_0xd6ee('0x12')](0x1f4,_0xd6ee('0x32')+_0x4ed7d6));}if(!_[_0xd6ee('0x33')](_0x4ed7d6,_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x31')])){return _0x49383c(_0x13ef37['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ed7d6));}var _0x7e551b={};_0x7e551b[_0xdccf56[_0xd6ee('0x2c')]['mapKey']]=_0xdccf56[_0xd6ee('0x2c')]['from'];return db[_0xd6ee('0x17')][_0xd6ee('0x22')]({'where':{'id':_0xdccf56[_0xd6ee('0x34')]['id']},'include':[{'model':db[_0xd6ee('0x35')],'as':_0xd6ee('0x36'),'include':[{'model':db[_0xd6ee('0x29')],'as':_0xd6ee('0x37'),'where':_0x7e551b,'limit':0x1,'order':[[_0xd6ee('0x38'),_0xd6ee('0x39')]]}]},{'model':db[_0xd6ee('0x3a')],'as':_0xd6ee('0x3b')},{'model':db['MailServerOut'],'as':_0xd6ee('0x3c'),'include':[{'model':db[_0xd6ee('0x3d')],'as':_0xd6ee('0x3d')}]}]})[_0xd6ee('0xc')](function(_0x418680){if(_0x418680&&_0x418680[_0xd6ee('0x36')]){var _0x1c3088=_0x418680[_0xd6ee('0x3e')]({'plain':!![]});_0x5365d9[_0xd6ee('0x34')]=_[_0xd6ee('0x3f')](_0x1c3088,[_0xd6ee('0x3b'),_0xd6ee('0x36')]);_0x5365d9['account'][_0xd6ee('0x23')]=_0x418680[_0xd6ee('0x24')]();_0x5365d9[_0xd6ee('0x40')]=_0x1c3088['Applications'];_0x5365d9[_0xd6ee('0x41')]=_0x1c3088['List'];_0x5365d9[_0xd6ee('0x40')]=_['orderBy'](_0x5365d9[_0xd6ee('0x40')],[_0xd6ee('0x42')],['asc']);if(_0x5365d9[_0xd6ee('0x34')]&&_0x5365d9[_0xd6ee('0x34')][_0xd6ee('0x43')]){_0x5365d9['applications'][_0xd6ee('0x44')]({'id':0x0,'priority':_0x5365d9[_0xd6ee('0x40')]['length']+0x1,'app':_0xd6ee('0x45'),'appdata':'autoclose','interval':_0xd6ee('0x46')});}if(_0x5365d9[_0xd6ee('0x34')][_0xd6ee('0x3b')]){delete _0x5365d9[_0xd6ee('0x34')]['Applications'];}if(_0x5365d9[_0xd6ee('0x34')]['List']){delete _0x5365d9[_0xd6ee('0x34')][_0xd6ee('0x36')];}if(_0x1c3088['List'][_0xd6ee('0x37')][_0xd6ee('0x47')]){return _0x1c3088[_0xd6ee('0x36')][_0xd6ee('0x37')][0x0];}var _0x249aab=_[_0xd6ee('0xa')](_0xdccf56[_0xd6ee('0x2c')],{'firstName':_0xdccf56[_0xd6ee('0x2c')]['from'],'ListId':_0x1c3088[_0xd6ee('0x48')]});_0x249aab[_0xdccf56['body'][_0xd6ee('0x31')]]=_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x2e')];return db[_0xd6ee('0x29')]['create'](_0x249aab);}else{throw new Error(_0xd6ee('0x49'));}})['then'](function(_0x4df2ce){_0x5365d9['contact']=_0x4df2ce;if(_0x4df2ce){if(!_0xdccf56[_0xd6ee('0x2c')]['message'][_0xd6ee('0x4a')]){_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x4a')]=rs[_0xd6ee('0x4b')]()+'\x20'+_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x2e')];}var _0x1e0b07={'ContactId':_0x4df2ce['id'],'MailAccountId':_0xdccf56['account']['id'],'inReplyTo':_0xdccf56[_0xd6ee('0x2c')]['message'][_0xd6ee('0x4a')],'to':_0xdccf56[_0xd6ee('0x2c')]['message']['from'],'cc':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')]['cc'],'subject':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x4c')],'attach':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x4d')],'lastMsgAt':moment()['format'](_0xd6ee('0x4e')),'lastMsgDirection':'in'};return db[_0xd6ee('0x4f')]['find']({'where':{'closed':![],'MailAccountId':_0xdccf56[_0xd6ee('0x34')]['id']},'include':[{'model':db[_0xd6ee('0x50')],'as':_0xd6ee('0x51'),'attributes':[_0xd6ee('0x4a')],'where':{'messageId':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x52')]}}]})[_0xd6ee('0xc')](function(_0x372231){if(_0x372231){return[_0x372231,![]];}return db[_0xd6ee('0x4f')][_0xd6ee('0x53')](_0x1e0b07)['then'](function(_0x27d5d0){return[_0x27d5d0,!![]];});});}else{throw new Error(_0xd6ee('0x54'));}})['spread'](function(_0x163c7d,_0x18c951){if(_0x163c7d){_0x557936=_0x18c951;if(!_0x18c951){return _0x163c7d['update']({'inReplyTo':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')]['messageId'],'to':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')]['from'],'cc':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')]['cc'],'subject':_0xdccf56['body']['message']['subject'],'attach':_0x163c7d['attach']?_0x163c7d[_0xd6ee('0x4d')]:_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x4d')],'substatus':null,'substatusAt':moment()[_0xd6ee('0x55')](_0xd6ee('0x4e')),'lastMsgAt':moment()[_0xd6ee('0x55')](_0xd6ee('0x4e')),'lastMsgDirection':'in'});}else{return _0x163c7d;}}})[_0xd6ee('0xc')](function(_0x33ee97){_0x5365d9[_0xd6ee('0x56')]=_0x33ee97[_0xd6ee('0x3e')]({'plain':!![]});_0x5365d9[_0xd6ee('0x56')]['created']=_0x557936;return db[_0xd6ee('0x50')][_0xd6ee('0x53')]({'body':_0xdccf56['body']['body'],'MailAccountId':_0xdccf56[_0xd6ee('0x34')]['id'],'MailInteractionId':_0x33ee97['id'],'direction':'in','ContactId':_0x5365d9['contact']['id'],'messageId':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x4a')],'from':_0xdccf56['body']['message'][_0xd6ee('0x2e')],'to':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')]['to'],'cc':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')]['cc'],'subject':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x4c')],'attach':_0xdccf56['body'][_0xd6ee('0x14')][_0xd6ee('0x4d')],'Attachments':_0xdccf56['body'][_0xd6ee('0x14')][_0xd6ee('0x57')],'originTo':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x58')],'originCc':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')][_0xd6ee('0x59')],'bcc':_0xdccf56['body'][_0xd6ee('0x14')][_0xd6ee('0x5a')],'ChatWebsiteId':_0xdccf56[_0xd6ee('0x2c')][_0xd6ee('0x14')]['ChatWebsiteId']||null,'originChannel':_0xdccf56['body'][_0xd6ee('0x14')][_0xd6ee('0x5b')]||_0xd6ee('0x5c'),'ChatOfflineMessageId':_0xdccf56[_0xd6ee('0x2c')]['message'][_0xd6ee('0x5d')]||null},{'include':[{'model':db[_0xd6ee('0x5e')],'as':_0xd6ee('0x5f')}]});})[_0xd6ee('0xc')](function(_0xab4139){_0x5365d9['message']=_0xab4139;if(!_0x5365d9[_0xd6ee('0x56')][_0xd6ee('0x60')]){return;}return db[_0xd6ee('0x61')][_0xd6ee('0x22')]({'attributes':['id',_0xd6ee('0x62')],'where':{'id':_0x5365d9[_0xd6ee('0x56')][_0xd6ee('0x60')]}});})[_0xd6ee('0xc')](function(_0x24bc38){if(_0x24bc38){_0x5365d9[_0xd6ee('0x40')][_0xd6ee('0x63')]({'id':0x0,'priority':0x0,'app':_0xd6ee('0x64'),'appdata':_0x24bc38[_0xd6ee('0x62')]+','+(_0x5365d9[_0xd6ee('0x34')][_0xd6ee('0x65')]||0xa),'interval':'*,*,*,*'});}if(!_0x5365d9['interaction']['queueId']){return;}return db[_0xd6ee('0x66')][_0xd6ee('0x22')]({'attributes':['id',_0xd6ee('0x62')],'where':{'id':_0x5365d9[_0xd6ee('0x56')][_0xd6ee('0x67')]}});})[_0xd6ee('0xc')](function(_0x1e7d7c){if(_0x1e7d7c){_0x5365d9['applications'][_0xd6ee('0x63')]({'id':0x0,'priority':0x1,'app':_0xd6ee('0x68'),'appdata':_0x1e7d7c[_0xd6ee('0x62')]+','+(_0x5365d9[_0xd6ee('0x34')][_0xd6ee('0x69')]||0x12c),'interval':_0xd6ee('0x46')});}return respondWithRpcPromise(_0xd6ee('0x6a'),_0xd6ee('0x6b'),_0x5365d9);})[_0xd6ee('0xc')](function(_0x37a744){_0x24a7cb(_0x37a744);})[_0xd6ee('0x6c')](function(_0x1621dd){_0x49383c(_0x13ef37[_0xd6ee('0x12')](0x1f4,_0x1621dd['message']));});});};
\ No newline at end of file
+var _0xe14b=['autoclose','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','inReplyTo','spread','update','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','name','UserId','unshift','waitForTheAssignedAgent','MailQueue','queueId','queue','waitForTheAssignedQueue','Start','startRouting','lodash','moment','ioredis','../../mysqldb','rpc','client','http','redis','defaults','localhost','socket.io-emitter','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','map','include','model','ShowMailAccount','find','where','smtp','setDataValue','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','account','List','updatedAt','DESC','MailApplication','Applications','CloudProvider','get','omit','smtpOptions','getSmtpOptions','applications','list','orderBy','priority','asc','push'];(function(_0x193ddf,_0x6f30bb){var _0x5bc6df=function(_0x70fd9e){while(--_0x70fd9e){_0x193ddf['push'](_0x193ddf['shift']());}};_0x5bc6df(++_0x6f30bb);}(_0xe14b,0x93));var _0xbe14=function(_0x3aac17,_0x514374){_0x3aac17=_0x3aac17-0x0;var _0x5dd94e=_0xe14b[_0x3aac17];return _0x5dd94e;};'use strict';var _=require(_0xbe14('0x0'));var moment=require(_0xbe14('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0xbe14('0x2'));var db=require(_0xbe14('0x3'))['db'];var logger=require('../../config/logger')(_0xbe14('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbe14('0x5')][_0xbe14('0x6')]({'port':0x232c});config[_0xbe14('0x7')]=_[_0xbe14('0x8')](config[_0xbe14('0x7')],{'host':_0xbe14('0x9'),'port':0x18eb});var socket=require(_0xbe14('0xa'))(new Redis(config['redis']));require('./mailAccount.socket')['register'](socket);function respondWithRpcPromise(_0x30c355,_0x6fceff,_0xd68cd7){return new BPromise(function(_0x90b4f,_0x53c7ea){return client['request'](_0x30c355,_0xd68cd7)[_0xbe14('0xb')](function(_0x3f70cb){logger['info'](_0xbe14('0xc'),_0x6fceff,_0xbe14('0xd'));logger[_0xbe14('0xe')](_0xbe14('0xf'),_0x6fceff,_0xbe14('0xd'),JSON[_0xbe14('0x10')](_0x3f70cb));if(_0x3f70cb[_0xbe14('0x11')]){if(_0x3f70cb[_0xbe14('0x11')][_0xbe14('0x12')]===0x1f4){logger[_0xbe14('0x11')](_0xbe14('0xc'),_0x6fceff,_0x3f70cb[_0xbe14('0x11')][_0xbe14('0x13')]);return _0x53c7ea(_0x3f70cb['error']['message']);}logger[_0xbe14('0x11')](_0xbe14('0xc'),_0x6fceff,_0x3f70cb[_0xbe14('0x11')][_0xbe14('0x13')]);return _0x90b4f(_0x3f70cb['error'][_0xbe14('0x13')]);}else{logger[_0xbe14('0x14')](_0xbe14('0xc'),_0x6fceff,_0xbe14('0xd'));_0x90b4f(_0x3f70cb[_0xbe14('0x15')][_0xbe14('0x13')]);}})[_0xbe14('0x16')](function(_0x5ea1f8){logger[_0xbe14('0x11')](_0xbe14('0xc'),_0x6fceff,_0x5ea1f8);_0x53c7ea(_0x5ea1f8);});});}exports[_0xbe14('0x17')]=function(_0x433459){var _0x3249da=this;return new Promise(function(_0x37e4c1,_0x59a9e3){return db[_0xbe14('0x18')][_0xbe14('0x19')]({'raw':_0x433459[_0xbe14('0x1a')]?_0x433459[_0xbe14('0x1a')][_0xbe14('0x1b')]===undefined?!![]:![]:!![],'where':_0x433459['options']?_0x433459[_0xbe14('0x1a')]['where']||null:null,'attributes':_0x433459[_0xbe14('0x1a')]?_0x433459['options'][_0xbe14('0x1c')]||null:null,'limit':_0x433459['options']?_0x433459[_0xbe14('0x1a')][_0xbe14('0x1d')]||null:null,'include':_0x433459['options']?_0x433459[_0xbe14('0x1a')]['include']?_[_0xbe14('0x1e')](_0x433459['options'][_0xbe14('0x1f')],function(_0x5fa043){return{'model':db[_0x5fa043[_0xbe14('0x20')]],'as':_0x5fa043['as'],'attributes':_0x5fa043[_0xbe14('0x1c')],'include':_0x5fa043[_0xbe14('0x1f')]?_[_0xbe14('0x1e')](_0x5fa043['include'],function(_0x1822e0){return{'model':db[_0x1822e0[_0xbe14('0x20')]],'as':_0x1822e0['as'],'attributes':_0x1822e0[_0xbe14('0x1c')],'include':_0x1822e0[_0xbe14('0x1f')]?_['map'](_0x1822e0[_0xbe14('0x1f')],function(_0x29fc64){return{'model':db[_0x29fc64['model']],'as':_0x29fc64['as'],'attributes':_0x29fc64[_0xbe14('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe14('0xb')](function(_0x1c7cc7){logger[_0xbe14('0x14')](_0xbe14('0x17'),_0x433459);logger[_0xbe14('0xe')](_0xbe14('0x17'),_0x433459,JSON[_0xbe14('0x10')](_0x1c7cc7));_0x37e4c1(_0x1c7cc7);})[_0xbe14('0x16')](function(_0x16a159){logger[_0xbe14('0x11')](_0xbe14('0x17'),_0x16a159[_0xbe14('0x13')],_0x433459);_0x59a9e3(_0x3249da[_0xbe14('0x11')](0x1f4,_0x16a159[_0xbe14('0x13')]));});});};exports[_0xbe14('0x21')]=function(_0x6ba36c){var _0x2ff48e=this;return new Promise(function(_0x29e76a,_0x14e7c4){return db['MailAccount'][_0xbe14('0x22')]({'raw':_0x6ba36c['options']?_0x6ba36c['options'][_0xbe14('0x1b')]===undefined?!![]:![]:!![],'where':_0x6ba36c['options']?_0x6ba36c[_0xbe14('0x1a')][_0xbe14('0x23')]||null:null,'attributes':_0x6ba36c['options']?_0x6ba36c['options']['attributes']||null:null,'include':_0x6ba36c[_0xbe14('0x1a')]?_0x6ba36c[_0xbe14('0x1a')]['include']?_[_0xbe14('0x1e')](_0x6ba36c[_0xbe14('0x1a')][_0xbe14('0x1f')],function(_0x1aa849){return{'model':db[_0x1aa849[_0xbe14('0x20')]],'as':_0x1aa849['as'],'attributes':_0x1aa849['attributes'],'include':_0x1aa849['include']?_[_0xbe14('0x1e')](_0x1aa849['include'],function(_0x5dd7aa){return{'model':db[_0x5dd7aa['model']],'as':_0x5dd7aa['as'],'attributes':_0x5dd7aa[_0xbe14('0x1c')],'include':_0x5dd7aa[_0xbe14('0x1f')]?_[_0xbe14('0x1e')](_0x5dd7aa[_0xbe14('0x1f')],function(_0x172e79){return{'model':db[_0x172e79[_0xbe14('0x20')]],'as':_0x172e79['as'],'attributes':_0x172e79[_0xbe14('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xbe14('0xb')](function(_0x2d9c12){if(_0x6ba36c[_0xbe14('0x1a')][_0xbe14('0x24')]===!![])_0x2d9c12[_0xbe14('0x25')]('smtpOptions',_0x2d9c12['getSmtpOptions']());logger[_0xbe14('0x14')](_0xbe14('0x21'),_0x6ba36c);logger[_0xbe14('0xe')]('ShowMailAccount',_0x6ba36c,JSON[_0xbe14('0x10')](_0x2d9c12));_0x29e76a(_0x2d9c12);})[_0xbe14('0x16')](function(_0xeda70e){logger[_0xbe14('0x11')](_0xbe14('0x21'),_0xeda70e[_0xbe14('0x13')],_0x6ba36c);_0x14e7c4(_0x2ff48e[_0xbe14('0x11')](0x1f4,_0xeda70e[_0xbe14('0x13')]));});});};exports[_0xbe14('0x26')]=function(_0x5255ff){var _0xe51424=this;return new Promise(function(_0x841b71,_0x3463c4){var _0x1b3118={'body':_0x5255ff[_0xbe14('0x27')],'channel':_0xbe14('0x28')};var _0x548d17=_[_0xbe14('0x29')](_[_0xbe14('0x2a')](db[_0xbe14('0x2b')][_0xbe14('0x2c')]),['createdAt','updatedAt',_0xbe14('0x2d'),_0xbe14('0x2e')]);var _0x3272ae=![];if(_0x5255ff['body']['id']){delete _0x5255ff['body']['id'];}if(_[_0xbe14('0x2f')](_0x5255ff['body']['from'])){return _0x3463c4(_0xe51424[_0xbe14('0x11')](0x1f4,_0xbe14('0x30')));}if(_[_0xbe14('0x2f')](_0x5255ff['body']['body'])||_0x5255ff['body'][_0xbe14('0x27')]===''){return _0x3463c4(_0xe51424[_0xbe14('0x11')](0x1f4,_0xbe14('0x31')));}if(_['isNil'](_0x5255ff[_0xbe14('0x27')][_0xbe14('0x32')])){return _0x3463c4(_0xe51424[_0xbe14('0x11')](0x1f4,_0xbe14('0x33')+_0x548d17));}if(!_['includes'](_0x548d17,_0x5255ff['body'][_0xbe14('0x32')])){return _0x3463c4(_0xe51424[_0xbe14('0x11')](0x1f4,_0xbe14('0x34')+_0x548d17));}var _0xb2b285={};_0xb2b285[_0x5255ff[_0xbe14('0x27')]['mapKey']]=_0x5255ff['body'][_0xbe14('0x35')];return db[_0xbe14('0x18')][_0xbe14('0x22')]({'where':{'id':_0x5255ff[_0xbe14('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0xbe14('0x37'),'include':[{'model':db[_0xbe14('0x2b')],'as':'Contacts','where':_0xb2b285,'limit':0x1,'order':[[_0xbe14('0x38'),_0xbe14('0x39')]]}]},{'model':db[_0xbe14('0x3a')],'as':_0xbe14('0x3b')},{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xbe14('0x3c')],'as':_0xbe14('0x3c')}]}]})['then'](function(_0x5acf90){if(_0x5acf90&&_0x5acf90[_0xbe14('0x37')]){var _0x5d3726=_0x5acf90[_0xbe14('0x3d')]({'plain':!![]});_0x1b3118[_0xbe14('0x36')]=_[_0xbe14('0x3e')](_0x5d3726,[_0xbe14('0x3b'),_0xbe14('0x37')]);_0x1b3118['account'][_0xbe14('0x3f')]=_0x5acf90[_0xbe14('0x40')]();_0x1b3118[_0xbe14('0x41')]=_0x5d3726[_0xbe14('0x3b')];_0x1b3118[_0xbe14('0x42')]=_0x5d3726['List'];_0x1b3118[_0xbe14('0x41')]=_[_0xbe14('0x43')](_0x1b3118[_0xbe14('0x41')],[_0xbe14('0x44')],[_0xbe14('0x45')]);if(_0x1b3118[_0xbe14('0x36')]&&_0x1b3118['account']['autoclose']){_0x1b3118[_0xbe14('0x41')][_0xbe14('0x46')]({'id':0x0,'priority':_0x1b3118[_0xbe14('0x41')]['length']+0x1,'app':'close','appdata':_0xbe14('0x47'),'interval':_0xbe14('0x48')});}if(_0x1b3118['account'][_0xbe14('0x3b')]){delete _0x1b3118[_0xbe14('0x36')]['Applications'];}if(_0x1b3118[_0xbe14('0x36')]['List']){delete _0x1b3118[_0xbe14('0x36')][_0xbe14('0x37')];}if(_0x5d3726[_0xbe14('0x37')]['Contacts'][_0xbe14('0x49')]){return _0x5d3726[_0xbe14('0x37')]['Contacts'][0x0];}var _0x27f24b=_[_0xbe14('0x8')](_0x5255ff[_0xbe14('0x27')],{'firstName':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x35')],'ListId':_0x5d3726['ListId']});_0x27f24b[_0x5255ff[_0xbe14('0x27')][_0xbe14('0x32')]]=_0x5255ff[_0xbe14('0x27')][_0xbe14('0x35')];return db[_0xbe14('0x2b')][_0xbe14('0x4a')](_0x27f24b);}else{throw new Error(_0xbe14('0x4b'));}})['then'](function(_0x72c875){_0x1b3118[_0xbe14('0x4c')]=_0x72c875;if(_0x72c875){if(!_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4d')]){_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4d')]=rs[_0xbe14('0x4e')]()+'\x20'+_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['from'];}var _0x56bcd3={'ContactId':_0x72c875['id'],'MailAccountId':_0x5255ff['account']['id'],'inReplyTo':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4d')],'to':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x35')],'cc':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['cc'],'subject':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4f')],'attach':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x50')],'lastMsgAt':moment()[_0xbe14('0x51')](_0xbe14('0x52')),'lastMsgDirection':'in'};return db[_0xbe14('0x53')][_0xbe14('0x22')]({'where':{'closed':![],'MailAccountId':_0x5255ff[_0xbe14('0x36')]['id']},'include':[{'model':db[_0xbe14('0x54')],'as':'Messages','attributes':[_0xbe14('0x4d')],'where':{'messageId':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x55')]}}]})[_0xbe14('0xb')](function(_0x222944){if(_0x222944){return[_0x222944,![]];}return db[_0xbe14('0x53')][_0xbe14('0x4a')](_0x56bcd3)[_0xbe14('0xb')](function(_0x100d43){return[_0x100d43,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xbe14('0x56')](function(_0x442ec4,_0x2d4dd4){if(_0x442ec4){_0x3272ae=_0x2d4dd4;if(!_0x2d4dd4){return _0x442ec4[_0xbe14('0x57')]({'inReplyTo':_0x5255ff[_0xbe14('0x27')]['message'][_0xbe14('0x4d')],'to':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x35')],'cc':_0x5255ff[_0xbe14('0x27')]['message']['cc'],'subject':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4f')],'attach':_0x442ec4[_0xbe14('0x50')]?_0x442ec4[_0xbe14('0x50')]:_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x50')],'substatus':null,'substatusAt':moment()['format'](_0xbe14('0x52')),'lastMsgAt':moment()[_0xbe14('0x51')](_0xbe14('0x52')),'lastMsgDirection':'in'});}else{return _0x442ec4;}}})[_0xbe14('0xb')](function(_0x5982b7){_0x1b3118[_0xbe14('0x58')]=_0x5982b7[_0xbe14('0x3d')]({'plain':!![]});_0x1b3118['interaction']['created']=_0x3272ae;return db[_0xbe14('0x54')][_0xbe14('0x4a')]({'body':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x27')],'MailAccountId':_0x5255ff[_0xbe14('0x36')]['id'],'MailInteractionId':_0x5982b7['id'],'direction':'in','ContactId':_0x1b3118[_0xbe14('0x4c')]['id'],'messageId':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['messageId'],'from':_0x5255ff['body'][_0xbe14('0x13')][_0xbe14('0x35')],'to':_0x5255ff[_0xbe14('0x27')]['message']['to'],'cc':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['cc'],'subject':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x4f')],'attach':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')]['attach'],'Attachments':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x59')],'originTo':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x5a')],'originCc':_0x5255ff[_0xbe14('0x27')]['message'][_0xbe14('0x5b')],'bcc':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x5c')],'ChatWebsiteId':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x5d')]||null,'originChannel':_0x5255ff[_0xbe14('0x27')]['message'][_0xbe14('0x5e')]||_0xbe14('0x5f'),'ChatOfflineMessageId':_0x5255ff[_0xbe14('0x27')][_0xbe14('0x13')][_0xbe14('0x60')]||null},{'include':[{'model':db[_0xbe14('0x61')],'as':'Attachments'}]});})[_0xbe14('0xb')](function(_0x175213){_0x1b3118[_0xbe14('0x13')]=_0x175213;if(!_0x1b3118[_0xbe14('0x58')]['UserId']){return;}return db[_0xbe14('0x62')][_0xbe14('0x22')]({'attributes':['id',_0xbe14('0x63')],'where':{'id':_0x1b3118[_0xbe14('0x58')][_0xbe14('0x64')]}});})[_0xbe14('0xb')](function(_0x3b0828){if(_0x3b0828){_0x1b3118['applications'][_0xbe14('0x65')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x3b0828[_0xbe14('0x63')]+','+(_0x1b3118['account'][_0xbe14('0x66')]||0xa),'interval':_0xbe14('0x48')});}if(!_0x1b3118[_0xbe14('0x58')]['queueId']){return;}return db[_0xbe14('0x67')][_0xbe14('0x22')]({'attributes':['id',_0xbe14('0x63')],'where':{'id':_0x1b3118['interaction'][_0xbe14('0x68')]}});})[_0xbe14('0xb')](function(_0x1737a8){if(_0x1737a8){_0x1b3118[_0xbe14('0x41')]['unshift']({'id':0x0,'priority':0x1,'app':_0xbe14('0x69'),'appdata':_0x1737a8[_0xbe14('0x63')]+','+(_0x1b3118[_0xbe14('0x36')][_0xbe14('0x6a')]||0x12c),'interval':_0xbe14('0x48')});}return respondWithRpcPromise(_0xbe14('0x6b'),_0xbe14('0x6c'),_0x1b3118);})['then'](function(_0x2ff94c){_0x841b71(_0x2ff94c);})[_0xbe14('0x16')](function(_0x2137d5){_0x3463c4(_0xe51424['error'](0x1f4,_0x2137d5[_0xbe14('0x13')]));});});};
\ No newline at end of file
index bb581d0..6aa7087 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ae9=['register','length','mailAccount:','./mailAccount.events','update','emit'];(function(_0x4e4531,_0x258c73){var _0x322315=function(_0x3f3432){while(--_0x3f3432){_0x4e4531['push'](_0x4e4531['shift']());}};_0x322315(++_0x258c73);}(_0x5ae9,0x19b));var _0x95ae=function(_0x31172e,_0xa59e5){_0x31172e=_0x31172e-0x0;var _0x414ada=_0x5ae9[_0x31172e];return _0x414ada;};'use strict';var MailAccountEvents=require(_0x95ae('0x0'));var events=['save','remove',_0x95ae('0x1')];function createListener(_0x39dedc,_0x4e8950){return function(_0x23690b){_0x4e8950[_0x95ae('0x2')](_0x39dedc,_0x23690b);};}function removeListener(_0x559cb2,_0x22469d){return function(){MailAccountEvents['removeListener'](_0x559cb2,_0x22469d);};}exports[_0x95ae('0x3')]=function(_0x3c4464){for(var _0xa51307=0x0,_0xec2c41=events[_0x95ae('0x4')];_0xa51307<_0xec2c41;_0xa51307++){var _0x4df142=events[_0xa51307];var _0x588bab=createListener(_0x95ae('0x5')+_0x4df142,_0x3c4464);MailAccountEvents['on'](_0x4df142,_0x588bab);}};
\ No newline at end of file
+var _0x1beb=['./mailAccount.events','save','update','emit','removeListener','register','length'];(function(_0x2c74e2,_0x20e402){var _0x35cdfc=function(_0x23aafa){while(--_0x23aafa){_0x2c74e2['push'](_0x2c74e2['shift']());}};_0x35cdfc(++_0x20e402);}(_0x1beb,0x165));var _0xb1be=function(_0x4a29dd,_0x156130){_0x4a29dd=_0x4a29dd-0x0;var _0x4fec31=_0x1beb[_0x4a29dd];return _0x4fec31;};'use strict';var MailAccountEvents=require(_0xb1be('0x0'));var events=[_0xb1be('0x1'),'remove',_0xb1be('0x2')];function createListener(_0x402425,_0x3beaaf){return function(_0x55259c){_0x3beaaf[_0xb1be('0x3')](_0x402425,_0x55259c);};}function removeListener(_0xe463e1,_0x5b6000){return function(){MailAccountEvents[_0xb1be('0x4')](_0xe463e1,_0x5b6000);};}exports[_0xb1be('0x5')]=function(_0x116394){for(var _0xe36555=0x0,_0x1b548a=events[_0xb1be('0x6')];_0xe36555<_0x1b548a;_0xe36555++){var _0x42014d=events[_0xe36555];var _0x1c8f2e=createListener('mailAccount:'+_0x42014d,_0x116394);MailAccountEvents['on'](_0x42014d,_0x1c8f2e);}};
\ No newline at end of file
index 0c2536b..9fc3a22 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7de=['exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','put','update','delete','destroy'];(function(_0x2b5147,_0xac4b90){var _0x402965=function(_0x4e40e0){while(--_0x4e40e0){_0x2b5147['push'](_0x2b5147['shift']());}};_0x402965(++_0xac4b90);}(_0xf7de,0x131));var _0xef7d=function(_0x2afbb1,_0x5c79e7){_0x2afbb1=_0x2afbb1-0x0;var _0x5b0408=_0xf7de[_0x2afbb1];return _0x5b0408;};'use strict';var multer=require('multer');var util=require(_0xef7d('0x0'));var path=require(_0xef7d('0x1'));var timeout=require('connect-timeout');var express=require(_0xef7d('0x2'));var router=express[_0xef7d('0x3')]();var fs_extra=require(_0xef7d('0x4'));var auth=require(_0xef7d('0x5'));var interaction=require(_0xef7d('0x6'));var config=require(_0xef7d('0x7'));var controller=require('./mailApplication.controller');router[_0xef7d('0x8')](_0xef7d('0x9'),auth[_0xef7d('0xa')](),controller['show']);router[_0xef7d('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xef7d('0xc')]);router[_0xef7d('0xd')](_0xef7d('0x9'),auth[_0xef7d('0xa')](),controller[_0xef7d('0xe')]);module[_0xef7d('0xf')]=router;
\ No newline at end of file
+var _0x6240=['delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./mailApplication.controller','/:id','show','put','update'];(function(_0x4ea1c6,_0x59718b){var _0x90813e=function(_0x241a9f){while(--_0x241a9f){_0x4ea1c6['push'](_0x4ea1c6['shift']());}};_0x90813e(++_0x59718b);}(_0x6240,0x1d3));var _0x0624=function(_0x59efdf,_0x329a92){_0x59efdf=_0x59efdf-0x0;var _0x4bc3a5=_0x6240[_0x59efdf];return _0x4bc3a5;};'use strict';var multer=require(_0x0624('0x0'));var util=require(_0x0624('0x1'));var path=require(_0x0624('0x2'));var timeout=require(_0x0624('0x3'));var express=require(_0x0624('0x4'));var router=express[_0x0624('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0624('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0624('0x7'));var controller=require(_0x0624('0x8'));router['get'](_0x0624('0x9'),auth['isAuthenticated'](),controller[_0x0624('0xa')]);router[_0x0624('0xb')](_0x0624('0x9'),auth['isAuthenticated'](),controller[_0x0624('0xc')]);router[_0x0624('0xd')](_0x0624('0x9'),auth['isAuthenticated'](),controller[_0x0624('0xe')]);module['exports']=router;
\ No newline at end of file
index 20f7209..d1026e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4544=['sequelize','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x326d35,_0x4f65b3){var _0xd3f8f3=function(_0x1fbbaf){while(--_0x1fbbaf){_0x326d35['push'](_0x326d35['shift']());}};_0xd3f8f3(++_0x4f65b3);}(_0x4544,0xf0));var _0x4454=function(_0x82129b,_0x484ae9){_0x82129b=_0x82129b-0x0;var _0x2ae5dc=_0x4544[_0x82129b];return _0x2ae5dc;};'use strict';var Sequelize=require(_0x4454('0x0'));module['exports']={'priority':{'type':Sequelize[_0x4454('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x4454('0x2')],'allowNull':![],'defaultValue':_0x4454('0x3')},'appdata':{'type':Sequelize[_0x4454('0x4')]()},'description':{'type':Sequelize[_0x4454('0x2')]},'interval':{'type':Sequelize[_0x4454('0x2')],'defaultValue':_0x4454('0x5')}};
\ No newline at end of file
+var _0xddeb=['STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x171f58,_0x35d977){var _0x3e05e2=function(_0x1fbe46){while(--_0x1fbe46){_0x171f58['push'](_0x171f58['shift']());}};_0x3e05e2(++_0x35d977);}(_0xddeb,0xcc));var _0xbdde=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0xddeb[_0x36bfe3];return _0x9b0436;};'use strict';var Sequelize=require(_0xbdde('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xbdde('0x1')],'allowNull':![],'defaultValue':_0xbdde('0x2')},'appdata':{'type':Sequelize[_0xbdde('0x3')]()},'description':{'type':Sequelize[_0xbdde('0x1')]},'interval':{'type':Sequelize[_0xbdde('0x1')],'defaultValue':_0xbdde('0x4')}};
\ No newline at end of file
index b099aed..d15fdca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa88=['limit','count','set','apply','reject','then','stack','name','send','params','model','keys','MailApplication','query','filters','intersection','attributes','fields','length','include','merge','options','find','update','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaa88,0x137));var _0x8aa8=function(_0x51e79c,_0x51485e){_0x51e79c=_0x51e79c-0x0;var _0x2467be=_0xaa88[_0x51e79c];return _0x2467be;};'use strict';var emlformat=require(_0x8aa8('0x0'));var rimraf=require(_0x8aa8('0x1'));var zipdir=require(_0x8aa8('0x2'));var jsonpatch=require(_0x8aa8('0x3'));var rp=require('request-promise');var moment=require(_0x8aa8('0x4'));var BPromise=require(_0x8aa8('0x5'));var Mustache=require(_0x8aa8('0x6'));var util=require(_0x8aa8('0x7'));var path=require(_0x8aa8('0x8'));var sox=require(_0x8aa8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8aa8('0xa'));var _=require('lodash');var squel=require(_0x8aa8('0xb'));var crypto=require(_0x8aa8('0xc'));var jsforce=require(_0x8aa8('0xd'));var deskjs=require(_0x8aa8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8aa8('0xf'));var Papa=require(_0x8aa8('0x10'));var Redis=require(_0x8aa8('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8aa8('0x12'));var as=require(_0x8aa8('0x13'));var hardwareService=require(_0x8aa8('0x14'));var logger=require(_0x8aa8('0x15'))('api');var utils=require(_0x8aa8('0x16'));var config=require(_0x8aa8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x8aa8('0x18'))['db'];function respondWithStatusCode(_0xa691d6,_0x28132f){_0x28132f=_0x28132f||0xcc;return function(_0x535aa0){if(_0x535aa0){return _0xa691d6[_0x8aa8('0x19')](_0x28132f);}return _0xa691d6[_0x8aa8('0x1a')](_0x28132f)[_0x8aa8('0x1b')]();};}function respondWithResult(_0x4b686e,_0x391642){_0x391642=_0x391642||0xc8;return function(_0x4af534){if(_0x4af534){return _0x4b686e['status'](_0x391642)[_0x8aa8('0x1c')](_0x4af534);}};}function respondWithFilteredResult(_0x200662,_0xae81a0){return function(_0xa6c2af){if(_0xa6c2af){var _0x42a6a4=typeof _0xae81a0[_0x8aa8('0x1d')]===_0x8aa8('0x1e')&&typeof _0xae81a0[_0x8aa8('0x1f')]===_0x8aa8('0x1e');var _0x4e8ce3=_0xa6c2af['count'];var _0x2c1b9a=_0x42a6a4?0x0:_0xae81a0['offset'];var _0x557adc=_0x42a6a4?_0xa6c2af[_0x8aa8('0x20')]:_0xae81a0['offset']+_0xae81a0[_0x8aa8('0x1f')];var _0x41092b;if(_0x557adc>=_0x4e8ce3){_0x557adc=_0x4e8ce3;_0x41092b=0xc8;}else{_0x41092b=0xce;}_0x200662[_0x8aa8('0x1a')](_0x41092b);return _0x200662[_0x8aa8('0x21')]('Content-Range',_0x2c1b9a+'-'+_0x557adc+'/'+_0x4e8ce3)[_0x8aa8('0x1c')](_0xa6c2af);}return null;};}function patchUpdates(_0x36c445){return function(_0x2825fd){try{jsonpatch[_0x8aa8('0x22')](_0x2825fd,_0x36c445,!![]);}catch(_0x4c754e){return BPromise[_0x8aa8('0x23')](_0x4c754e);}return _0x2825fd['save']();};}function saveUpdates(_0x26cf63,_0x4cc455){return function(_0x1fdadd){if(_0x1fdadd){return _0x1fdadd['update'](_0x26cf63)[_0x8aa8('0x24')](function(_0x557e4e){return _0x557e4e;});}return null;};}function removeEntity(_0x65945b,_0x40adb5){return function(_0x3ca7dc){if(_0x3ca7dc){return _0x3ca7dc['destroy']()[_0x8aa8('0x24')](function(){_0x65945b[_0x8aa8('0x1a')](0xcc)[_0x8aa8('0x1b')]();});}};}function handleEntityNotFound(_0x547a7b,_0x57acd2){return function(_0x2d1508){if(!_0x2d1508){_0x547a7b[_0x8aa8('0x19')](0x194);}return _0x2d1508;};}function handleError(_0x2f91f3,_0x3a3c7a){_0x3a3c7a=_0x3a3c7a||0x1f4;return function(_0x24143e){logger['error'](_0x24143e[_0x8aa8('0x25')]);if(_0x24143e['name']){delete _0x24143e[_0x8aa8('0x26')];}_0x2f91f3[_0x8aa8('0x1a')](_0x3a3c7a)[_0x8aa8('0x27')](_0x24143e);};}exports['show']=function(_0x4c5c5c,_0x10810d){var _0x5e96c9={'raw':!![],'where':{'id':_0x4c5c5c[_0x8aa8('0x28')]['id']}},_0x385208={};_0x385208[_0x8aa8('0x29')]=_[_0x8aa8('0x2a')](db[_0x8aa8('0x2b')]['rawAttributes']);_0x385208[_0x8aa8('0x2c')]=_[_0x8aa8('0x2a')](_0x4c5c5c['query']);_0x385208[_0x8aa8('0x2d')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],_0x385208['query']);_0x5e96c9[_0x8aa8('0x2f')]=_[_0x8aa8('0x2e')](_0x385208[_0x8aa8('0x29')],qs[_0x8aa8('0x30')](_0x4c5c5c[_0x8aa8('0x2c')][_0x8aa8('0x30')]));_0x5e96c9[_0x8aa8('0x2f')]=_0x5e96c9[_0x8aa8('0x2f')][_0x8aa8('0x31')]?_0x5e96c9[_0x8aa8('0x2f')]:_0x385208[_0x8aa8('0x29')];if(_0x4c5c5c['query']['includeAll']){_0x5e96c9[_0x8aa8('0x32')]=[{'all':!![]}];}_0x5e96c9=_[_0x8aa8('0x33')]({},_0x5e96c9,_0x4c5c5c[_0x8aa8('0x34')]);return db[_0x8aa8('0x2b')][_0x8aa8('0x35')](_0x5e96c9)[_0x8aa8('0x24')](handleEntityNotFound(_0x10810d,null))['then'](respondWithResult(_0x10810d,null))['catch'](handleError(_0x10810d,null));};exports[_0x8aa8('0x36')]=function(_0x5755b5,_0x24997c){if(_0x5755b5[_0x8aa8('0x37')]['id']){delete _0x5755b5[_0x8aa8('0x37')]['id'];}return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x5755b5[_0x8aa8('0x28')]['id']}})[_0x8aa8('0x24')](handleEntityNotFound(_0x24997c,null))['then'](saveUpdates(_0x5755b5['body'],null))[_0x8aa8('0x24')](respondWithResult(_0x24997c,null))[_0x8aa8('0x38')](handleError(_0x24997c,null));};exports['destroy']=function(_0x24eb18,_0x2e1f52){return db['MailApplication'][_0x8aa8('0x35')]({'where':{'id':_0x24eb18['params']['id']}})['then'](handleEntityNotFound(_0x2e1f52,null))[_0x8aa8('0x24')](removeEntity(_0x2e1f52,null))['catch'](handleError(_0x2e1f52,null));};
\ No newline at end of file
+var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x5cef48,_0x4f4b95){var _0x2486c6=function(_0x4acbe3){while(--_0x4acbe3){_0x5cef48['push'](_0x5cef48['shift']());}};_0x2486c6(++_0x4f4b95);}(_0xe706,0xa3));var _0x6e70=function(_0x262baa,_0x283058){_0x262baa=_0x262baa-0x0;var _0x4f2257=_0xe706[_0x262baa];return _0x4f2257;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));};
\ No newline at end of file
index 8ab8f4f..aa2e9c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d82=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci'];(function(_0x2a4246,_0x1fac66){var _0x31be07=function(_0x40598b){while(--_0x40598b){_0x2a4246['push'](_0x2a4246['shift']());}};_0x31be07(++_0x1fac66);}(_0x6d82,0x1b2));var _0x26d8=function(_0x3a8bcb,_0x312b4a){_0x3a8bcb=_0x3a8bcb-0x0;var _0xcc16c8=_0x6d82[_0x3a8bcb];return _0xcc16c8;};'use strict';var _=require(_0x26d8('0x0'));var util=require('util');var logger=require(_0x26d8('0x1'))(_0x26d8('0x2'));var moment=require('moment');var BPromise=require(_0x26d8('0x3'));var rp=require(_0x26d8('0x4'));var fs=require('fs');var path=require(_0x26d8('0x5'));var rimraf=require(_0x26d8('0x6'));var config=require(_0x26d8('0x7'));var attributes=require(_0x26d8('0x8'));module[_0x26d8('0x9')]=function(_0x35ddc5,_0x558c6a){return _0x35ddc5[_0x26d8('0xa')](_0x26d8('0xb'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x26d8('0xc'),'collate':_0x26d8('0xd')});};
\ No newline at end of file
+var _0xe15f=['exports','define','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xe15f,0x1f4));var _0xfe15=function(_0x546f2b,_0x2e12ce){_0x546f2b=_0x546f2b-0x0;var _0xecd1bd=_0xe15f[_0x546f2b];return _0xecd1bd;};'use strict';var _=require(_0xfe15('0x0'));var util=require(_0xfe15('0x1'));var logger=require(_0xfe15('0x2'))(_0xfe15('0x3'));var moment=require(_0xfe15('0x4'));var BPromise=require(_0xfe15('0x5'));var rp=require(_0xfe15('0x6'));var fs=require('fs');var path=require(_0xfe15('0x7'));var rimraf=require(_0xfe15('0x8'));var config=require(_0xfe15('0x9'));var attributes=require('./mailApplication.attributes');module[_0xfe15('0xa')]=function(_0x54c577,_0x44d11f){return _0x54c577[_0xfe15('0xb')]('MailApplication',attributes,{'tableName':_0xfe15('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfe15('0xd'),'collate':_0xfe15('0xe')});};
\ No newline at end of file
index e51b399..5a3c778 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2142=['catch','UpdateMailApplication','MailApplication','update','options','raw','attributes','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x2e8421,_0x1d932c){var _0x18fd04=function(_0x37821d){while(--_0x37821d){_0x2e8421['push'](_0x2e8421['shift']());}};_0x18fd04(++_0x1d932c);}(_0x2142,0xbc));var _0x2214=function(_0x36f6fd,_0x4ac52d){_0x36f6fd=_0x36f6fd-0x0;var _0x192ce2=_0x2142[_0x36f6fd];return _0x192ce2;};'use strict';var _=require(_0x2214('0x0'));var util=require('util');var moment=require(_0x2214('0x1'));var BPromise=require('bluebird');var rs=require(_0x2214('0x2'));var fs=require('fs');var Redis=require(_0x2214('0x3'));var db=require(_0x2214('0x4'))['db'];var utils=require(_0x2214('0x5'));var logger=require(_0x2214('0x6'))('rpc');var config=require(_0x2214('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2214('0x8')][_0x2214('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x261624,_0x4259fb,_0x885214){return new BPromise(function(_0x32456f,_0x8157f){return client[_0x2214('0xa')](_0x261624,_0x885214)[_0x2214('0xb')](function(_0x85909d){logger['info'](_0x2214('0xc'),_0x4259fb,_0x2214('0xd'));logger[_0x2214('0xe')](_0x2214('0xf'),_0x4259fb,'request\x20sent',JSON[_0x2214('0x10')](_0x85909d));if(_0x85909d['error']){if(_0x85909d[_0x2214('0x11')][_0x2214('0x12')]===0x1f4){logger[_0x2214('0x11')](_0x2214('0xc'),_0x4259fb,_0x85909d[_0x2214('0x11')][_0x2214('0x13')]);return _0x8157f(_0x85909d['error'][_0x2214('0x13')]);}logger[_0x2214('0x11')](_0x2214('0xc'),_0x4259fb,_0x85909d[_0x2214('0x11')][_0x2214('0x13')]);return _0x32456f(_0x85909d[_0x2214('0x11')][_0x2214('0x13')]);}else{logger[_0x2214('0x14')](_0x2214('0xc'),_0x4259fb,_0x2214('0xd'));_0x32456f(_0x85909d[_0x2214('0x15')][_0x2214('0x13')]);}})[_0x2214('0x16')](function(_0x3e1de2){logger['error']('MailApplication,\x20%s,\x20%s',_0x4259fb,_0x3e1de2);_0x8157f(_0x3e1de2);});});}exports[_0x2214('0x17')]=function(_0x1a2492){var _0x4b14e2=this;return new Promise(function(_0x366cb3,_0x4aa9b3){return db[_0x2214('0x18')][_0x2214('0x19')](_0x1a2492['body'],{'raw':_0x1a2492[_0x2214('0x1a')]?_0x1a2492[_0x2214('0x1a')][_0x2214('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a2492[_0x2214('0x1a')]?_0x1a2492['options']['where']||null:null,'attributes':_0x1a2492['options']?_0x1a2492[_0x2214('0x1a')][_0x2214('0x1c')]||null:null,'limit':_0x1a2492[_0x2214('0x1a')]?_0x1a2492['options'][_0x2214('0x1d')]||null:null})[_0x2214('0xb')](function(_0x1edb27){logger[_0x2214('0x14')](_0x2214('0x17'),_0x1a2492);logger[_0x2214('0xe')](_0x2214('0x17'),_0x1a2492,JSON['stringify'](_0x1edb27));_0x366cb3(_0x1edb27);})[_0x2214('0x16')](function(_0x415686){logger[_0x2214('0x11')](_0x2214('0x17'),_0x415686[_0x2214('0x13')],_0x1a2492);_0x4aa9b3(_0x4b14e2[_0x2214('0x11')](0x1f4,_0x415686[_0x2214('0x13')]));});});};
\ No newline at end of file
+var _0xb5b8=['then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','MailApplication,\x20%s,\x20%s','info','result','catch','UpdateMailApplication','MailApplication','update','body','options','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http'];(function(_0x16af88,_0x1c6a15){var _0x376ddd=function(_0x13300f){while(--_0x13300f){_0x16af88['push'](_0x16af88['shift']());}};_0x376ddd(++_0x1c6a15);}(_0xb5b8,0x102));var _0x8b5b=function(_0x51e0b9,_0x44c9c0){_0x51e0b9=_0x51e0b9-0x0;var _0x2202dd=_0xb5b8[_0x51e0b9];return _0x2202dd;};'use strict';var _=require(_0x8b5b('0x0'));var util=require(_0x8b5b('0x1'));var moment=require(_0x8b5b('0x2'));var BPromise=require(_0x8b5b('0x3'));var rs=require(_0x8b5b('0x4'));var fs=require('fs');var Redis=require(_0x8b5b('0x5'));var db=require(_0x8b5b('0x6'))['db'];var utils=require(_0x8b5b('0x7'));var logger=require('../../config/logger')(_0x8b5b('0x8'));var config=require(_0x8b5b('0x9'));var jayson=require(_0x8b5b('0xa'));var client=jayson['client'][_0x8b5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cb1ff,_0x31a088,_0x255c6e){return new BPromise(function(_0x13e7a3,_0x1ae646){return client['request'](_0x4cb1ff,_0x255c6e)[_0x8b5b('0xc')](function(_0x490e56){logger['info']('MailApplication,\x20%s,\x20%s',_0x31a088,_0x8b5b('0xd'));logger[_0x8b5b('0xe')](_0x8b5b('0xf'),_0x31a088,'request\x20sent',JSON[_0x8b5b('0x10')](_0x490e56));if(_0x490e56[_0x8b5b('0x11')]){if(_0x490e56[_0x8b5b('0x11')]['code']===0x1f4){logger[_0x8b5b('0x11')]('MailApplication,\x20%s,\x20%s',_0x31a088,_0x490e56['error'][_0x8b5b('0x12')]);return _0x1ae646(_0x490e56[_0x8b5b('0x11')][_0x8b5b('0x12')]);}logger['error'](_0x8b5b('0x13'),_0x31a088,_0x490e56['error'][_0x8b5b('0x12')]);return _0x13e7a3(_0x490e56[_0x8b5b('0x11')][_0x8b5b('0x12')]);}else{logger[_0x8b5b('0x14')]('MailApplication,\x20%s,\x20%s',_0x31a088,'request\x20sent');_0x13e7a3(_0x490e56[_0x8b5b('0x15')][_0x8b5b('0x12')]);}})[_0x8b5b('0x16')](function(_0x428d32){logger[_0x8b5b('0x11')](_0x8b5b('0x13'),_0x31a088,_0x428d32);_0x1ae646(_0x428d32);});});}exports[_0x8b5b('0x17')]=function(_0x15f70e){var _0x58a8fe=this;return new Promise(function(_0x11611b,_0x5ab201){return db[_0x8b5b('0x18')][_0x8b5b('0x19')](_0x15f70e[_0x8b5b('0x1a')],{'raw':_0x15f70e['options']?_0x15f70e[_0x8b5b('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x15f70e[_0x8b5b('0x1b')]?_0x15f70e[_0x8b5b('0x1b')][_0x8b5b('0x1c')]||null:null,'attributes':_0x15f70e[_0x8b5b('0x1b')]?_0x15f70e[_0x8b5b('0x1b')]['attributes']||null:null,'limit':_0x15f70e['options']?_0x15f70e[_0x8b5b('0x1b')][_0x8b5b('0x1d')]||null:null})[_0x8b5b('0xc')](function(_0x3c86a5){logger[_0x8b5b('0x14')](_0x8b5b('0x17'),_0x15f70e);logger[_0x8b5b('0xe')]('UpdateMailApplication',_0x15f70e,JSON['stringify'](_0x3c86a5));_0x11611b(_0x3c86a5);})[_0x8b5b('0x16')](function(_0x314d1b){logger[_0x8b5b('0x11')]('UpdateMailApplication',_0x314d1b[_0x8b5b('0x12')],_0x15f70e);_0x5ab201(_0x58a8fe[_0x8b5b('0x11')](0x1f4,_0x314d1b['message']));});});};
\ No newline at end of file
index 395e6f2..4a50db4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3a23=['describe','/:id','show','/:id/messages','/:id/download','download','post','create','addMessage','tracked','mailinteraction:addtags','put','mailinteraction:update','update','delete','mail','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','get','/describe','isAuthenticated'];(function(_0xe54809,_0x1f8247){var _0x1d4f4b=function(_0x3134eb){while(--_0x3134eb){_0xe54809['push'](_0xe54809['shift']());}};_0x1d4f4b(++_0x1f8247);}(_0x3a23,0xb0));var _0x33a2=function(_0x153f73,_0x505abc){_0x153f73=_0x153f73-0x0;var _0x30dd6a=_0x3a23[_0x153f73];return _0x30dd6a;};'use strict';var express=require(_0x33a2('0x0'));var router=express[_0x33a2('0x1')]();var auth=require(_0x33a2('0x2'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0x33a2('0x3')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x33a2('0x4'),auth[_0x33a2('0x5')](),controller[_0x33a2('0x6')]);router['get'](_0x33a2('0x7'),auth['isAuthenticated'](),controller[_0x33a2('0x8')]);router[_0x33a2('0x3')](_0x33a2('0x9'),auth['isAuthenticated'](),controller['getMessages']);router[_0x33a2('0x3')](_0x33a2('0xa'),auth[_0x33a2('0x5')](),controller[_0x33a2('0xb')]);router[_0x33a2('0xc')]('/',auth[_0x33a2('0x5')](),controller[_0x33a2('0xd')]);router[_0x33a2('0xc')](_0x33a2('0x9'),auth[_0x33a2('0x5')](),controller[_0x33a2('0xe')]);router['post']('/:id/tags',auth[_0x33a2('0x5')](),interaction[_0x33a2('0xf')]('mail',_0x33a2('0x10')),controller['addTags']);router[_0x33a2('0x11')]('/:id',auth['isAuthenticated'](),interaction[_0x33a2('0xf')]('mail',_0x33a2('0x12')),controller[_0x33a2('0x13')]);router[_0x33a2('0x14')](_0x33a2('0x7'),auth[_0x33a2('0x5')](),interaction[_0x33a2('0xf')](_0x33a2('0x15'),_0x33a2('0x16')),controller[_0x33a2('0x17')]);router[_0x33a2('0x14')]('/:id/tags',auth[_0x33a2('0x5')](),controller[_0x33a2('0x18')]);module[_0x33a2('0x19')]=router;
\ No newline at end of file
+var _0xbd3d=['destroy','removeTags','exports','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','getMessages','/:id/download','download','post','create','/:id/messages','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','delete','mailinteraction:destroy'];(function(_0x1f44e4,_0x22d9fd){var _0x591989=function(_0x3aeb88){while(--_0x3aeb88){_0x1f44e4['push'](_0x1f44e4['shift']());}};_0x591989(++_0x22d9fd);}(_0xbd3d,0x155));var _0xdbd3=function(_0x1d76e1,_0x43ed78){_0x1d76e1=_0x1d76e1-0x0;var _0x3a9450=_0xbd3d[_0x1d76e1];return _0x3a9450;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xdbd3('0x0'));var interaction=require(_0xdbd3('0x1'));var controller=require(_0xdbd3('0x2'));router[_0xdbd3('0x3')]('/',auth[_0xdbd3('0x4')](),controller[_0xdbd3('0x5')]);router['get'](_0xdbd3('0x6'),auth['isAuthenticated'](),controller[_0xdbd3('0x7')]);router[_0xdbd3('0x3')]('/:id',auth[_0xdbd3('0x4')](),controller['show']);router[_0xdbd3('0x3')]('/:id/messages',auth[_0xdbd3('0x4')](),controller[_0xdbd3('0x8')]);router[_0xdbd3('0x3')](_0xdbd3('0x9'),auth['isAuthenticated'](),controller[_0xdbd3('0xa')]);router[_0xdbd3('0xb')]('/',auth[_0xdbd3('0x4')](),controller[_0xdbd3('0xc')]);router[_0xdbd3('0xb')](_0xdbd3('0xd'),auth['isAuthenticated'](),controller['addMessage']);router[_0xdbd3('0xb')](_0xdbd3('0xe'),auth['isAuthenticated'](),interaction[_0xdbd3('0xf')](_0xdbd3('0x10'),_0xdbd3('0x11')),controller[_0xdbd3('0x12')]);router[_0xdbd3('0x13')](_0xdbd3('0x14'),auth[_0xdbd3('0x4')](),interaction[_0xdbd3('0xf')](_0xdbd3('0x10'),'mailinteraction:update'),controller['update']);router[_0xdbd3('0x15')](_0xdbd3('0x14'),auth[_0xdbd3('0x4')](),interaction[_0xdbd3('0xf')](_0xdbd3('0x10'),_0xdbd3('0x16')),controller[_0xdbd3('0x17')]);router[_0xdbd3('0x15')]('/:id/tags',auth[_0xdbd3('0x4')](),controller[_0xdbd3('0x18')]);module[_0xdbd3('0x19')]=router;
\ No newline at end of file
index 665b493..7c78ec9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa696=['STRING','long','TEXT','BOOLEAN','ENUM','out','INTEGER','sequelize','iconv','exports','DATE'];(function(_0x346188,_0x39557d){var _0x1d66a5=function(_0x374d97){while(--_0x374d97){_0x346188['push'](_0x346188['shift']());}};_0x1d66a5(++_0x39557d);}(_0xa696,0x193));var _0x6a69=function(_0x3a1ea5,_0x349f01){_0x3a1ea5=_0x3a1ea5-0x0;var _0xfac9b2=_0xa696[_0x3a1ea5];return _0xfac9b2;};'use strict';var Sequelize=require(_0x6a69('0x0'));var iconv=require(_0x6a69('0x1'));module[_0x6a69('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6a69('0x3')]},'disposition':{'type':Sequelize[_0x6a69('0x4')]},'secondDisposition':{'type':Sequelize[_0x6a69('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6a69('0x4')]},'inReplyTo':{'type':Sequelize[_0x6a69('0x4')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT'](_0x6a69('0x5'))},'subject':{'type':Sequelize[_0x6a69('0x6')]()},'attach':{'type':Sequelize[_0x6a69('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x6a69('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x6a69('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6a69('0x8')]('in',_0x6a69('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6a69('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6a69('0x8')]('in',_0x6a69('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x6a69('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x6a69('0xa')]}};
\ No newline at end of file
+var _0xa77e=['BOOLEAN','DATE','STRING','TEXT','long','ENUM','INTEGER','sequelize'];(function(_0x3c1aec,_0xbbd08e){var _0x41aacb=function(_0x186481){while(--_0x186481){_0x3c1aec['push'](_0x3c1aec['shift']());}};_0x41aacb(++_0xbbd08e);}(_0xa77e,0x1df));var _0xea77=function(_0x29e0f8,_0x2f35a9){_0x29e0f8=_0x29e0f8-0x0;var _0x1c1479=_0xa77e[_0x29e0f8];return _0x1c1479;};'use strict';var Sequelize=require(_0xea77('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0xea77('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xea77('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xea77('0x3')]},'thirdDisposition':{'type':Sequelize[_0xea77('0x3')]},'note':{'type':Sequelize[_0xea77('0x3')]},'inReplyTo':{'type':Sequelize[_0xea77('0x3')](0x1fe)},'to':{'type':Sequelize[_0xea77('0x3')]},'cc':{'type':Sequelize[_0xea77('0x4')](_0xea77('0x5'))},'subject':{'type':Sequelize[_0xea77('0x4')]()},'attach':{'type':Sequelize[_0xea77('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xea77('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xea77('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xea77('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xea77('0x7')]}};
\ No newline at end of file
index 496eaa4..fe98b13 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8706=['map','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','user','catch','show','params','model','MailInteraction','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','ids','omit','getMessages','length','hasOwnProperty','nolimit','order','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','files','join','root','server','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','writeFileSync','message%d.eml','download','unlinkSync','eml-format','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','send','index'];(function(_0x50e9f0,_0x406d29){var _0x436b1f=function(_0x1e7b23){while(--_0x1e7b23){_0x50e9f0['push'](_0x50e9f0['shift']());}};_0x436b1f(++_0x406d29);}(_0x8706,0x13c));var _0x6870=function(_0x3e2a18,_0x3029dd){_0x3e2a18=_0x3e2a18-0x0;var _0x6ce6ba=_0x8706[_0x3e2a18];return _0x6ce6ba;};'use strict';var emlformat=require(_0x6870('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6870('0x1'));var moment=require(_0x6870('0x2'));var BPromise=require(_0x6870('0x3'));var util=require(_0x6870('0x4'));var path=require(_0x6870('0x5'));var fs=require('fs');var _=require(_0x6870('0x6'));var juice=require('juice');var Redis=require(_0x6870('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x6870('0x8'));var logger=require(_0x6870('0x9'))(_0x6870('0xa'));var config=require(_0x6870('0xb'));var db=require(_0x6870('0xc'))['db'];var htmlEntities=require('html-entities');config[_0x6870('0xd')]=_[_0x6870('0xe')](config['redis'],{'host':_0x6870('0xf'),'port':0x18eb});var socket=require(_0x6870('0x10'))(new Redis(config[_0x6870('0xd')]));require(_0x6870('0x11'))['register'](socket);function respondWithStatusCode(_0x5c896f,_0x2d5a8a){_0x2d5a8a=_0x2d5a8a||0xcc;return function(_0x20665c){if(_0x20665c){return _0x5c896f[_0x6870('0x12')](_0x2d5a8a);}return _0x5c896f[_0x6870('0x13')](_0x2d5a8a)[_0x6870('0x14')]();};}function respondWithResult(_0x515072,_0x459977){_0x459977=_0x459977||0xc8;return function(_0x48a4ea){if(_0x48a4ea){return _0x515072[_0x6870('0x13')](_0x459977)['json'](_0x48a4ea);}};}function respondWithFilteredResult(_0x419a15,_0x7625da){return function(_0x4d944b){if(_0x4d944b){var _0x87fa2=typeof _0x7625da[_0x6870('0x15')]===_0x6870('0x16')&&typeof _0x7625da[_0x6870('0x17')]===_0x6870('0x16');var _0x5dd477=_0x4d944b[_0x6870('0x18')];var _0x44dedb=_0x87fa2?0x0:_0x7625da[_0x6870('0x15')];var _0x529f65=_0x87fa2?_0x4d944b[_0x6870('0x18')]:_0x7625da['offset']+_0x7625da['limit'];var _0x2a918b;if(_0x529f65>=_0x5dd477){_0x529f65=_0x5dd477;_0x2a918b=0xc8;}else{_0x2a918b=0xce;}_0x419a15['status'](_0x2a918b);return _0x419a15[_0x6870('0x19')]('Content-Range',_0x44dedb+'-'+_0x529f65+'/'+_0x5dd477)[_0x6870('0x1a')](_0x4d944b);}return null;};}function saveUpdates(_0x1111d9){return function(_0x102d9d){if(_0x102d9d){return _0x102d9d[_0x6870('0x1b')](_0x1111d9)[_0x6870('0x1c')](function(_0x5765e7){return _0x5765e7;});}return null;};}function removeEntity(_0x4a933d){return function(_0xb67d02){if(_0xb67d02){return _0xb67d02[_0x6870('0x1d')]()[_0x6870('0x1c')](function(){_0x4a933d[_0x6870('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ef014){return function(_0x148cb6){if(!_0x148cb6){_0x5ef014[_0x6870('0x12')](0x194);}return _0x148cb6;};}function handleError(_0x1d26e9,_0x29e217){_0x29e217=_0x29e217||0x1f4;return function(_0x2e3963){logger[_0x6870('0x1e')](_0x2e3963[_0x6870('0x1f')]);if(_0x2e3963['name']){delete _0x2e3963[_0x6870('0x20')];}_0x1d26e9['status'](_0x29e217)[_0x6870('0x21')](_0x2e3963);};}exports[_0x6870('0x22')]=function(_0x25977e,_0x53731b){var _0x19874f={};var _0x59ca08=_[_0x6870('0x23')](db['MailInteraction'][_0x6870('0x24')],function(_0x2bd169){return{'name':_0x2bd169[_0x6870('0x25')],'type':_0x2bd169[_0x6870('0x26')][_0x6870('0x27')]};});_0x19874f=qs[_0x6870('0x28')](_0x59ca08,_0x25977e);return interaction[_0x6870('0x29')](_0x6870('0x2a'),_0x25977e[_0x6870('0x2b')],_0x25977e[_0x6870('0x2c')],_0x19874f,_0x59ca08)[_0x6870('0x1c')](respondWithFilteredResult(_0x53731b,_0x19874f))[_0x6870('0x2d')](handleError(_0x53731b,null));};exports[_0x6870('0x2e')]=function(_0x56afeb,_0x12ef48){var _0x192705={'raw':![],'where':{'id':_0x56afeb[_0x6870('0x2f')]['id']}},_0x1eed8a={};_0x1eed8a[_0x6870('0x30')]=_['keys'](db[_0x6870('0x31')][_0x6870('0x24')]);_0x1eed8a[_0x6870('0x2b')]=_[_0x6870('0x32')](_0x56afeb[_0x6870('0x2b')]);_0x1eed8a[_0x6870('0x33')]=_[_0x6870('0x34')](_0x1eed8a['model'],_0x1eed8a[_0x6870('0x2b')]);_0x192705[_0x6870('0x35')]=_['intersection'](_0x1eed8a[_0x6870('0x30')],qs[_0x6870('0x36')](_0x56afeb['query'][_0x6870('0x36')]));_0x192705[_0x6870('0x35')]=_0x192705['attributes']['length']?_0x192705[_0x6870('0x35')]:_0x1eed8a[_0x6870('0x30')];if(_0x56afeb['query'][_0x6870('0x37')]){_0x192705[_0x6870('0x38')]=[{'all':!![]}];}_0x192705=_[_0x6870('0x39')]({},_0x192705,_0x56afeb[_0x6870('0x3a')]);return db[_0x6870('0x31')][_0x6870('0x3b')](_0x192705)['then'](handleEntityNotFound(_0x12ef48,null))[_0x6870('0x1c')](respondWithResult(_0x12ef48,null))[_0x6870('0x2d')](handleError(_0x12ef48,null));};exports[_0x6870('0x3c')]=function(_0x56560e,_0x1c79fc){return db['MailInteraction'][_0x6870('0x3c')](_0x56560e[_0x6870('0x3d')],{})[_0x6870('0x1c')](respondWithResult(_0x1c79fc,0xc9))[_0x6870('0x2d')](handleError(_0x1c79fc,null));};exports[_0x6870('0x1b')]=function(_0x5ad06e,_0x54f431){if(_0x5ad06e['body']['id']){delete _0x5ad06e[_0x6870('0x3d')]['id'];}return db[_0x6870('0x31')]['find']({'where':{'id':_0x5ad06e[_0x6870('0x2f')]['id']}})['then'](handleEntityNotFound(_0x54f431,null))[_0x6870('0x1c')](saveUpdates(_0x5ad06e[_0x6870('0x3d')],null))[_0x6870('0x1c')](respondWithResult(_0x54f431,null))[_0x6870('0x2d')](handleError(_0x54f431,null));};exports[_0x6870('0x1d')]=function(_0x335b00,_0x23c26c){return db[_0x6870('0x31')]['find']({'where':{'id':_0x335b00[_0x6870('0x2f')]['id']}})[_0x6870('0x1c')](handleEntityNotFound(_0x23c26c,null))[_0x6870('0x1c')](removeEntity(_0x23c26c,null))[_0x6870('0x2d')](handleError(_0x23c26c,null));};exports[_0x6870('0x3e')]=function(_0x51a94d,_0x554f38){return db[_0x6870('0x31')][_0x6870('0x3e')]()[_0x6870('0x1c')](respondWithResult(_0x554f38,null))[_0x6870('0x2d')](handleError(_0x554f38,null));};exports[_0x6870('0x3f')]=function(_0x4507bc,_0x40943b){return db['MailMessage'][_0x6870('0x3b')]({'where':{'id':_0x4507bc['params']['id']}})['then'](handleEntityNotFound(_0x40943b,null))[_0x6870('0x1c')](function(_0x8dd715){if(_0x8dd715){return _0x8dd715[_0x6870('0x3f')](_0x4507bc[_0x6870('0x3d')][_0x6870('0x40')],_[_0x6870('0x41')](_0x4507bc[_0x6870('0x3d')],[_0x6870('0x40'),'id'])||{});}})['then'](respondWithResult(_0x40943b,null))[_0x6870('0x2d')](handleError(_0x40943b,null));};exports[_0x6870('0x42')]=function(_0x311b0d,_0x344a60){var _0x338e1c={'raw':![],'where':{}};var _0x33e79e={};var _0x3ee844={'count':0x0,'rows':[]};return db[_0x6870('0x31')]['findOne']({'where':{'id':_0x311b0d[_0x6870('0x2f')]['id']}})[_0x6870('0x1c')](handleEntityNotFound(_0x344a60,null))['then'](function(_0x26191b){if(_0x26191b){_0x33e79e[_0x6870('0x30')]=_[_0x6870('0x32')](db['MailMessage'][_0x6870('0x24')]);_0x33e79e[_0x6870('0x2b')]=_[_0x6870('0x32')](_0x311b0d[_0x6870('0x2b')]);_0x33e79e[_0x6870('0x33')]=_[_0x6870('0x34')](_0x33e79e[_0x6870('0x30')],_0x33e79e['query']);_0x338e1c['attributes']=_['intersection'](_0x33e79e['model'],qs[_0x6870('0x36')](_0x311b0d[_0x6870('0x2b')][_0x6870('0x36')]));_0x338e1c[_0x6870('0x35')]=_0x338e1c[_0x6870('0x35')][_0x6870('0x43')]?_0x338e1c[_0x6870('0x35')]:_0x33e79e[_0x6870('0x30')];if(!_0x311b0d['query'][_0x6870('0x44')](_0x6870('0x45'))){_0x338e1c[_0x6870('0x17')]=qs[_0x6870('0x17')](_0x311b0d['query']['limit']);_0x338e1c[_0x6870('0x15')]=qs[_0x6870('0x15')](_0x311b0d['query']['offset']);}_0x338e1c[_0x6870('0x46')]=qs[_0x6870('0x47')](_0x311b0d['query']['sort']);_0x338e1c[_0x6870('0x48')]=qs[_0x6870('0x33')](_['pick'](_0x311b0d['query'],_0x33e79e[_0x6870('0x33')]));_0x338e1c['where'][_0x6870('0x49')]=_0x26191b['id'];if(_0x311b0d['query']['filter']){_0x338e1c[_0x6870('0x48')]=_[_0x6870('0x39')](_0x338e1c['where'],{'$or':_[_0x6870('0x23')](_0x338e1c[_0x6870('0x35')],function(_0x444352){var _0x57aadd={};_0x57aadd[_0x444352]={'$like':'%'+_0x311b0d[_0x6870('0x2b')][_0x6870('0x4a')]+'%'};return _0x57aadd;})});}if(_0x311b0d['query'][_0x6870('0x4b')]){var _0x31e775=_0x311b0d[_0x6870('0x2b')]['$gte'][_0x6870('0x4c')](',');var _0x8f89a5={};_0x8f89a5[_0x31e775[0x0]]={'$gte':moment(_0x31e775[0x1])[_0x6870('0x4d')](_0x6870('0x4e'))};_0x338e1c[_0x6870('0x48')]=_['merge'](_0x338e1c[_0x6870('0x48')],_0x8f89a5);}_0x338e1c=_[_0x6870('0x39')]({},_0x338e1c,_0x311b0d['options']);return db[_0x6870('0x4f')][_0x6870('0x18')]({'where':_0x338e1c[_0x6870('0x48')]})[_0x6870('0x1c')](function(_0x51cb40){_0x3ee844[_0x6870('0x18')]=_0x51cb40;if(_0x311b0d[_0x6870('0x2b')][_0x6870('0x37')]){_0x338e1c[_0x6870('0x38')]=[{'all':!![]}];}return db[_0x6870('0x4f')]['findAll'](_0x338e1c);})[_0x6870('0x1c')](function(_0x325c4e){if(_0x311b0d[_0x6870('0x2b')][_0x6870('0x50')]===_0x6870('0x51')){for(var _0x253f41=0x0;_0x253f41<_0x325c4e['length'];_0x253f41++){_0x325c4e[_0x253f41]['body']=juice(_0x325c4e[_0x253f41][_0x6870('0x3d')]);}}_0x3ee844['rows']=_0x325c4e;return _0x3ee844;});}})[_0x6870('0x1c')](respondWithFilteredResult(_0x344a60,_0x338e1c))[_0x6870('0x2d')](handleError(_0x344a60,null));};exports['addTags']=function(_0x238c12,_0x3804e4){return db[_0x6870('0x31')]['find']({'where':{'id':_0x238c12[_0x6870('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3804e4,null))[_0x6870('0x1c')](function(_0x5f7167){if(_0x5f7167){return _0x5f7167[_0x6870('0x52')](_0x238c12[_0x6870('0x3d')][_0x6870('0x40')],_[_0x6870('0x41')](_0x238c12[_0x6870('0x3d')],[_0x6870('0x40'),'id'])||{})[_0x6870('0x53')](function(){return db[_0x6870('0x54')]['findAll']({'attributes':['id',_0x6870('0x20'),_0x6870('0x55')],'where':{'id':_0x238c12['body'][_0x6870('0x40')]}});})[_0x6870('0x1c')](function(_0x4531b0){socket[_0x6870('0x56')](_0x6870('0x57'),{'id':Number(_0x238c12[_0x6870('0x2f')]['id']),'tags':_0x4531b0||[]});return{'id':Number(_0x238c12[_0x6870('0x2f')]['id']),'tags':_0x4531b0||[]};});}})[_0x6870('0x1c')](respondWithResult(_0x3804e4,null))[_0x6870('0x2d')](handleError(_0x3804e4,null));};exports['removeTags']=function(_0x40f584,_0x5ea17b){return db[_0x6870('0x31')][_0x6870('0x3b')]({'where':{'id':_0x40f584[_0x6870('0x2f')]['id']}})[_0x6870('0x1c')](handleEntityNotFound(_0x5ea17b,null))[_0x6870('0x1c')](function(_0x218516){if(_0x218516){return _0x218516[_0x6870('0x58')](_0x40f584[_0x6870('0x2b')][_0x6870('0x40')]);}})['then'](respondWithStatusCode(_0x5ea17b,null))[_0x6870('0x2d')](handleError(_0x5ea17b,null));};exports['download']=function(_0x1cf537,_0x303823){var _0x26b39b=moment()[_0x6870('0x59')]()[_0x6870('0x5a')]();var _0x16af29=path['join'](config['root'],'server',_0x6870('0x5b'),'tmp');var _0x25233b=path[_0x6870('0x5c')](config[_0x6870('0x5d')],_0x6870('0x5e'),'files',_0x6870('0x5f'));var _0x5eee09=path['join'](_0x16af29,_0x26b39b);var _0x39edf9=util[_0x6870('0x4d')](_0x6870('0x60'),_0x1cf537['params']['id'],_0x26b39b);var _0x222a78=path[_0x6870('0x5c')](_0x16af29,_0x39edf9);var _0x539e9a=[];if(_0x1cf537[_0x6870('0x2b')][_0x6870('0x5f')]){_0x539e9a['push']({'model':db[_0x6870('0x61')],'as':_0x6870('0x62'),'raw':!![]});}var _0x36107c=[{'model':db[_0x6870('0x4f')],'as':_0x6870('0x63'),'attributes':['id','body',_0x6870('0x64'),'to','cc',_0x6870('0x65'),_0x6870('0x66'),_0x6870('0x67')],'where':{'secret':![]},'order':qs[_0x6870('0x47')]('id'),'include':_0x539e9a}];return db[_0x6870('0x31')][_0x6870('0x3b')]({'where':{'id':_0x1cf537[_0x6870('0x2f')]['id']},'include':_0x36107c})[_0x6870('0x1c')](handleEntityNotFound(_0x303823,null))[_0x6870('0x1c')](function(_0x5887d9){if(_0x5887d9&&_0x5887d9[_0x6870('0x63')]){var _0x2af195=_0x5887d9[_0x6870('0x68')]({'plain':!![]});fs[_0x6870('0x69')](_0x5eee09);return BPromise['each'](_0x2af195[_0x6870('0x63')],function(_0x5513aa,_0x27bb0f){var _0x363a47={'from':_0x5513aa[_0x6870('0x64')],'to':_0x5513aa['to']||_0x6870('0x6a'),'subject':_0x5513aa[_0x6870('0x66')],'html':htmlEntities[_0x6870('0x6b')](_0x5513aa['body']),'headers':{'Date':moment(_0x5513aa[_0x6870('0x67')])[_0x6870('0x4d')](_0x6870('0x6c'))},'attachments':[]};if(_0x5513aa['cc']){_0x363a47[_0x6870('0x6d')]['Cc']=_0x5513aa['cc'];}if(_0x5513aa[_0x6870('0x65')]){_0x363a47['headers']['Bcc']=_0x5513aa[_0x6870('0x65')];}return new BPromise(function(_0x5ba735,_0x229e24){if(_0x5513aa[_0x6870('0x62')]){for(var _0x41ded8=0x0;_0x41ded8<_0x5513aa[_0x6870('0x62')]['length'];_0x41ded8++){var _0xcdcd87=_0x5513aa[_0x6870('0x62')][_0x41ded8];var _0x13a70c=path[_0x6870('0x5c')](_0x25233b,_0xcdcd87['basename']);if(fs[_0x6870('0x6e')](_0x13a70c)){_0x363a47[_0x6870('0x5f')][_0x6870('0x6f')]({'name':_0xcdcd87[_0x6870('0x20')],'contentType':_0xcdcd87[_0x6870('0x26')],'data':fs[_0x6870('0x70')](_0x13a70c)});}}}emlformat['build'](_0x363a47,function(_0x3befa9,_0x4c6d4d){if(_0x3befa9)return _0x229e24(_0x3befa9);fs[_0x6870('0x71')](path[_0x6870('0x5c')](_0x5eee09,util[_0x6870('0x4d')](_0x6870('0x72'),_0x27bb0f)),_0x4c6d4d);return _0x5ba735(_0x4c6d4d);});});})['then'](function(){return new BPromise(function(_0x355fa8,_0x580d60){zipdir(_0x5eee09,{'saveTo':_0x222a78},function(_0x5c246e,_0x2f4576){if(_0x5c246e)return _0x580d60(_0x5c246e);return _0x355fa8(_0x2f4576);});})[_0x6870('0x1c')](function(){return new BPromise(function(_0x40c7da,_0x1a43ed){rimraf(_0x5eee09,function(_0xace5b9){if(_0xace5b9)_0x1a43ed(_0xace5b9);return _0x40c7da();});});})['then'](function(){return _0x303823[_0x6870('0x73')](_0x222a78,_0x39edf9,function(_0x31d559){if(!_0x31d559)fs[_0x6870('0x74')](_0x222a78);});});});}else{return _0x303823['sendStatus'](0xc8);}})[_0x6870('0x2d')](handleError(_0x303823,null));};
\ No newline at end of file
+var _0x723d=['missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','destroy','then','error','stack','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','body','describe','addMessage','ids','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Messages','from','bcc','subject','createdAt','get','mkdirSync','each'];(function(_0x37d6e1,_0x522cfe){var _0xbb46db=function(_0x404aef){while(--_0x404aef){_0x37d6e1['push'](_0x37d6e1['shift']());}};_0xbb46db(++_0x522cfe);}(_0x723d,0x15c));var _0xd723=function(_0x4fd75e,_0x219e4a){_0x4fd75e=_0x4fd75e-0x0;var _0x5b6338=_0x723d[_0x4fd75e];return _0x5b6338;};'use strict';var emlformat=require(_0xd723('0x0'));var rimraf=require(_0xd723('0x1'));var zipdir=require(_0xd723('0x2'));var moment=require(_0xd723('0x3'));var BPromise=require(_0xd723('0x4'));var util=require(_0xd723('0x5'));var path=require(_0xd723('0x6'));var fs=require('fs');var _=require(_0xd723('0x7'));var juice=require('juice');var Redis=require(_0xd723('0x8'));var interaction=require(_0xd723('0x9'));var qs=require(_0xd723('0xa'));var logger=require(_0xd723('0xb'))(_0xd723('0xc'));var config=require(_0xd723('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0xd723('0xe')]=_['defaults'](config['redis'],{'host':_0xd723('0xf'),'port':0x18eb});var socket=require(_0xd723('0x10'))(new Redis(config[_0xd723('0xe')]));require(_0xd723('0x11'))[_0xd723('0x12')](socket);function respondWithStatusCode(_0x328f51,_0x321a41){_0x321a41=_0x321a41||0xcc;return function(_0x220ea7){if(_0x220ea7){return _0x328f51[_0xd723('0x13')](_0x321a41);}return _0x328f51['status'](_0x321a41)[_0xd723('0x14')]();};}function respondWithResult(_0x2675c4,_0x25364b){_0x25364b=_0x25364b||0xc8;return function(_0xc03b40){if(_0xc03b40){return _0x2675c4['status'](_0x25364b)[_0xd723('0x15')](_0xc03b40);}};}function respondWithFilteredResult(_0x431405,_0x465738){return function(_0x4bb608){if(_0x4bb608){var _0x1bb688=typeof _0x465738[_0xd723('0x16')]===_0xd723('0x17')&&typeof _0x465738[_0xd723('0x18')]===_0xd723('0x17');var _0x43b25b=_0x4bb608[_0xd723('0x19')];var _0x10b2dd=_0x1bb688?0x0:_0x465738[_0xd723('0x16')];var _0x3faab3=_0x1bb688?_0x4bb608[_0xd723('0x19')]:_0x465738[_0xd723('0x16')]+_0x465738[_0xd723('0x18')];var _0x47faa6;if(_0x3faab3>=_0x43b25b){_0x3faab3=_0x43b25b;_0x47faa6=0xc8;}else{_0x47faa6=0xce;}_0x431405[_0xd723('0x1a')](_0x47faa6);return _0x431405[_0xd723('0x1b')](_0xd723('0x1c'),_0x10b2dd+'-'+_0x3faab3+'/'+_0x43b25b)[_0xd723('0x15')](_0x4bb608);}return null;};}function saveUpdates(_0x35bea2){return function(_0x1860d2){if(_0x1860d2){return _0x1860d2[_0xd723('0x1d')](_0x35bea2)['then'](function(_0x9d7c01){return _0x9d7c01;});}return null;};}function removeEntity(_0x5e6e79){return function(_0x50d7bc){if(_0x50d7bc){return _0x50d7bc[_0xd723('0x1e')]()[_0xd723('0x1f')](function(){_0x5e6e79[_0xd723('0x1a')](0xcc)[_0xd723('0x14')]();});}};}function handleEntityNotFound(_0x177a64){return function(_0x1dd93a){if(!_0x1dd93a){_0x177a64[_0xd723('0x13')](0x194);}return _0x1dd93a;};}function handleError(_0x3b4303,_0x1d1afd){_0x1d1afd=_0x1d1afd||0x1f4;return function(_0x2624ad){logger[_0xd723('0x20')](_0x2624ad[_0xd723('0x21')]);if(_0x2624ad[_0xd723('0x22')]){delete _0x2624ad[_0xd723('0x22')];}_0x3b4303['status'](_0x1d1afd)[_0xd723('0x23')](_0x2624ad);};}exports['index']=function(_0xa365b1,_0x345b16){var _0x12303e={};var _0x1bc1ce=_[_0xd723('0x24')](db[_0xd723('0x25')][_0xd723('0x26')],function(_0x6d041a){return{'name':_0x6d041a[_0xd723('0x27')],'type':_0x6d041a[_0xd723('0x28')][_0xd723('0x29')]};});_0x12303e=qs[_0xd723('0x2a')](_0x1bc1ce,_0xa365b1);return interaction[_0xd723('0x2b')]('mail',_0xa365b1[_0xd723('0x2c')],_0xa365b1['user'],_0x12303e,_0x1bc1ce)[_0xd723('0x1f')](respondWithFilteredResult(_0x345b16,_0x12303e))[_0xd723('0x2d')](handleError(_0x345b16,null));};exports[_0xd723('0x2e')]=function(_0x4fd40d,_0x1eab2a){var _0x306ba7={'raw':![],'where':{'id':_0x4fd40d[_0xd723('0x2f')]['id']}},_0x412bdd={};_0x412bdd[_0xd723('0x30')]=_[_0xd723('0x31')](db[_0xd723('0x25')][_0xd723('0x26')]);_0x412bdd[_0xd723('0x2c')]=_['keys'](_0x4fd40d[_0xd723('0x2c')]);_0x412bdd[_0xd723('0x32')]=_[_0xd723('0x33')](_0x412bdd[_0xd723('0x30')],_0x412bdd['query']);_0x306ba7[_0xd723('0x34')]=_[_0xd723('0x33')](_0x412bdd[_0xd723('0x30')],qs[_0xd723('0x35')](_0x4fd40d[_0xd723('0x2c')]['fields']));_0x306ba7[_0xd723('0x34')]=_0x306ba7['attributes'][_0xd723('0x36')]?_0x306ba7[_0xd723('0x34')]:_0x412bdd['model'];if(_0x4fd40d[_0xd723('0x2c')][_0xd723('0x37')]){_0x306ba7[_0xd723('0x38')]=[{'all':!![]}];}_0x306ba7=_[_0xd723('0x39')]({},_0x306ba7,_0x4fd40d[_0xd723('0x3a')]);return db[_0xd723('0x25')][_0xd723('0x3b')](_0x306ba7)[_0xd723('0x1f')](handleEntityNotFound(_0x1eab2a,null))[_0xd723('0x1f')](respondWithResult(_0x1eab2a,null))[_0xd723('0x2d')](handleError(_0x1eab2a,null));};exports['create']=function(_0x3a94dc,_0x852016){return db[_0xd723('0x25')]['create'](_0x3a94dc['body'],{})[_0xd723('0x1f')](respondWithResult(_0x852016,0xc9))[_0xd723('0x2d')](handleError(_0x852016,null));};exports['update']=function(_0x1a695a,_0x30481d){if(_0x1a695a[_0xd723('0x3c')]['id']){delete _0x1a695a[_0xd723('0x3c')]['id'];}return db[_0xd723('0x25')][_0xd723('0x3b')]({'where':{'id':_0x1a695a[_0xd723('0x2f')]['id']}})[_0xd723('0x1f')](handleEntityNotFound(_0x30481d,null))[_0xd723('0x1f')](saveUpdates(_0x1a695a['body'],null))['then'](respondWithResult(_0x30481d,null))[_0xd723('0x2d')](handleError(_0x30481d,null));};exports[_0xd723('0x1e')]=function(_0x1da855,_0xcedd0){return db['MailInteraction'][_0xd723('0x3b')]({'where':{'id':_0x1da855['params']['id']}})[_0xd723('0x1f')](handleEntityNotFound(_0xcedd0,null))[_0xd723('0x1f')](removeEntity(_0xcedd0,null))['catch'](handleError(_0xcedd0,null));};exports[_0xd723('0x3d')]=function(_0x3f4bf0,_0x560116){return db['MailInteraction'][_0xd723('0x3d')]()[_0xd723('0x1f')](respondWithResult(_0x560116,null))[_0xd723('0x2d')](handleError(_0x560116,null));};exports[_0xd723('0x3e')]=function(_0x4b57fa,_0x5aab59){return db['MailMessage'][_0xd723('0x3b')]({'where':{'id':_0x4b57fa[_0xd723('0x2f')]['id']}})[_0xd723('0x1f')](handleEntityNotFound(_0x5aab59,null))['then'](function(_0x2000d4){if(_0x2000d4){return _0x2000d4['addMessage'](_0x4b57fa[_0xd723('0x3c')][_0xd723('0x3f')],_[_0xd723('0x40')](_0x4b57fa[_0xd723('0x3c')],['ids','id'])||{});}})[_0xd723('0x1f')](respondWithResult(_0x5aab59,null))['catch'](handleError(_0x5aab59,null));};exports[_0xd723('0x41')]=function(_0x35f67b,_0x47cb66){var _0x31672d={'raw':![],'where':{}};var _0x40cad6={};var _0x460c99={'count':0x0,'rows':[]};return db[_0xd723('0x25')]['findOne']({'where':{'id':_0x35f67b[_0xd723('0x2f')]['id']}})['then'](handleEntityNotFound(_0x47cb66,null))[_0xd723('0x1f')](function(_0x5ba00a){if(_0x5ba00a){_0x40cad6[_0xd723('0x30')]=_['keys'](db['MailMessage']['rawAttributes']);_0x40cad6[_0xd723('0x2c')]=_[_0xd723('0x31')](_0x35f67b[_0xd723('0x2c')]);_0x40cad6[_0xd723('0x32')]=_[_0xd723('0x33')](_0x40cad6['model'],_0x40cad6[_0xd723('0x2c')]);_0x31672d[_0xd723('0x34')]=_[_0xd723('0x33')](_0x40cad6[_0xd723('0x30')],qs['fields'](_0x35f67b['query'][_0xd723('0x35')]));_0x31672d[_0xd723('0x34')]=_0x31672d['attributes'][_0xd723('0x36')]?_0x31672d[_0xd723('0x34')]:_0x40cad6[_0xd723('0x30')];if(!_0x35f67b['query'][_0xd723('0x42')](_0xd723('0x43'))){_0x31672d[_0xd723('0x18')]=qs[_0xd723('0x18')](_0x35f67b[_0xd723('0x2c')][_0xd723('0x18')]);_0x31672d[_0xd723('0x16')]=qs[_0xd723('0x16')](_0x35f67b[_0xd723('0x2c')][_0xd723('0x16')]);}_0x31672d[_0xd723('0x44')]=qs[_0xd723('0x45')](_0x35f67b[_0xd723('0x2c')]['sort']);_0x31672d[_0xd723('0x46')]=qs[_0xd723('0x32')](_['pick'](_0x35f67b['query'],_0x40cad6[_0xd723('0x32')]));_0x31672d['where']['MailInteractionId']=_0x5ba00a['id'];if(_0x35f67b[_0xd723('0x2c')][_0xd723('0x47')]){_0x31672d[_0xd723('0x46')]=_[_0xd723('0x39')](_0x31672d[_0xd723('0x46')],{'$or':_[_0xd723('0x24')](_0x31672d[_0xd723('0x34')],function(_0x3ef09c){var _0x4674f6={};_0x4674f6[_0x3ef09c]={'$like':'%'+_0x35f67b[_0xd723('0x2c')][_0xd723('0x47')]+'%'};return _0x4674f6;})});}if(_0x35f67b[_0xd723('0x2c')]['$gte']){var _0x10eb68=_0x35f67b[_0xd723('0x2c')][_0xd723('0x48')]['split'](',');var _0x453a40={};_0x453a40[_0x10eb68[0x0]]={'$gte':moment(_0x10eb68[0x1])[_0xd723('0x49')](_0xd723('0x4a'))};_0x31672d['where']=_[_0xd723('0x39')](_0x31672d[_0xd723('0x46')],_0x453a40);}_0x31672d=_['merge']({},_0x31672d,_0x35f67b[_0xd723('0x3a')]);return db[_0xd723('0x4b')][_0xd723('0x19')]({'where':_0x31672d['where']})[_0xd723('0x1f')](function(_0x57a459){_0x460c99[_0xd723('0x19')]=_0x57a459;if(_0x35f67b['query'][_0xd723('0x37')]){_0x31672d[_0xd723('0x38')]=[{'all':!![]}];}return db['MailMessage'][_0xd723('0x2b')](_0x31672d);})['then'](function(_0x4097b0){if(_0x35f67b[_0xd723('0x2c')][_0xd723('0x4c')]===_0xd723('0x4d')){for(var _0x328d3c=0x0;_0x328d3c<_0x4097b0['length'];_0x328d3c++){_0x4097b0[_0x328d3c][_0xd723('0x3c')]=juice(_0x4097b0[_0x328d3c][_0xd723('0x3c')]);}}_0x460c99[_0xd723('0x4e')]=_0x4097b0;return _0x460c99;});}})['then'](respondWithFilteredResult(_0x47cb66,_0x31672d))[_0xd723('0x2d')](handleError(_0x47cb66,null));};exports[_0xd723('0x4f')]=function(_0x5ed15b,_0x3f7191){return db[_0xd723('0x25')][_0xd723('0x3b')]({'where':{'id':_0x5ed15b[_0xd723('0x2f')]['id']}})['then'](handleEntityNotFound(_0x3f7191,null))[_0xd723('0x1f')](function(_0x11453d){if(_0x11453d){return _0x11453d[_0xd723('0x50')](_0x5ed15b['body'][_0xd723('0x3f')],_[_0xd723('0x40')](_0x5ed15b['body'],[_0xd723('0x3f'),'id'])||{})[_0xd723('0x51')](function(){return db[_0xd723('0x52')][_0xd723('0x2b')]({'attributes':['id',_0xd723('0x22'),_0xd723('0x53')],'where':{'id':_0x5ed15b[_0xd723('0x3c')][_0xd723('0x3f')]}});})['then'](function(_0x451935){socket['emit'](_0xd723('0x54'),{'id':Number(_0x5ed15b['params']['id']),'tags':_0x451935||[]});return{'id':Number(_0x5ed15b[_0xd723('0x2f')]['id']),'tags':_0x451935||[]};});}})[_0xd723('0x1f')](respondWithResult(_0x3f7191,null))[_0xd723('0x2d')](handleError(_0x3f7191,null));};exports[_0xd723('0x55')]=function(_0x37185a,_0x33cca5){return db[_0xd723('0x25')]['find']({'where':{'id':_0x37185a['params']['id']}})[_0xd723('0x1f')](handleEntityNotFound(_0x33cca5,null))[_0xd723('0x1f')](function(_0x18396f){if(_0x18396f){return _0x18396f['removeTags'](_0x37185a[_0xd723('0x2c')][_0xd723('0x3f')]);}})['then'](respondWithStatusCode(_0x33cca5,null))[_0xd723('0x2d')](handleError(_0x33cca5,null));};exports[_0xd723('0x56')]=function(_0x3414a9,_0x111fb1){var _0x2d59f3=moment()['unix']()[_0xd723('0x57')]();var _0x5c8a2c=path[_0xd723('0x58')](config[_0xd723('0x59')],_0xd723('0x5a'),_0xd723('0x5b'),_0xd723('0x5c'));var _0x53ad09=path[_0xd723('0x58')](config[_0xd723('0x59')],'server',_0xd723('0x5b'),_0xd723('0x5d'));var _0x5dcaa5=path[_0xd723('0x58')](_0x5c8a2c,_0x2d59f3);var _0x2a1628=util[_0xd723('0x49')](_0xd723('0x5e'),_0x3414a9[_0xd723('0x2f')]['id'],_0x2d59f3);var _0x3ef0b6=path['join'](_0x5c8a2c,_0x2a1628);var _0x5509fe=[];if(_0x3414a9[_0xd723('0x2c')][_0xd723('0x5d')]){_0x5509fe[_0xd723('0x5f')]({'model':db['Attachment'],'as':'Attachments','raw':!![]});}var _0x4800cd=[{'model':db['MailMessage'],'as':_0xd723('0x60'),'attributes':['id',_0xd723('0x3c'),_0xd723('0x61'),'to','cc',_0xd723('0x62'),_0xd723('0x63'),_0xd723('0x64')],'where':{'secret':![]},'order':qs[_0xd723('0x45')]('id'),'include':_0x5509fe}];return db[_0xd723('0x25')]['find']({'where':{'id':_0x3414a9['params']['id']},'include':_0x4800cd})[_0xd723('0x1f')](handleEntityNotFound(_0x111fb1,null))[_0xd723('0x1f')](function(_0x17b318){if(_0x17b318&&_0x17b318[_0xd723('0x60')]){var _0x4d5575=_0x17b318[_0xd723('0x65')]({'plain':!![]});fs[_0xd723('0x66')](_0x5dcaa5);return BPromise[_0xd723('0x67')](_0x4d5575[_0xd723('0x60')],function(_0x2c8069,_0x4c01b8){var _0x242ac7={'from':_0x2c8069[_0xd723('0x61')],'to':_0x2c8069['to']||_0xd723('0x68'),'subject':_0x2c8069[_0xd723('0x63')],'html':htmlEntities['decode'](_0x2c8069[_0xd723('0x3c')]),'headers':{'Date':moment(_0x2c8069[_0xd723('0x64')])[_0xd723('0x49')](_0xd723('0x69'))},'attachments':[]};if(_0x2c8069['cc']){_0x242ac7[_0xd723('0x6a')]['Cc']=_0x2c8069['cc'];}if(_0x2c8069[_0xd723('0x62')]){_0x242ac7['headers'][_0xd723('0x6b')]=_0x2c8069[_0xd723('0x62')];}return new BPromise(function(_0x405ef8,_0x30613a){if(_0x2c8069['Attachments']){for(var _0x379a57=0x0;_0x379a57<_0x2c8069['Attachments'][_0xd723('0x36')];_0x379a57++){var _0x34a92f=_0x2c8069[_0xd723('0x6c')][_0x379a57];var _0x1c975a=path[_0xd723('0x58')](_0x53ad09,_0x34a92f['basename']);if(fs[_0xd723('0x6d')](_0x1c975a)){_0x242ac7[_0xd723('0x5d')][_0xd723('0x5f')]({'name':_0x34a92f[_0xd723('0x22')],'contentType':_0x34a92f[_0xd723('0x28')],'data':fs[_0xd723('0x6e')](_0x1c975a)});}}}emlformat[_0xd723('0x6f')](_0x242ac7,function(_0x329255,_0x28776e){if(_0x329255)return _0x30613a(_0x329255);fs['writeFileSync'](path['join'](_0x5dcaa5,util['format']('message%d.eml',_0x4c01b8)),_0x28776e);return _0x405ef8(_0x28776e);});});})[_0xd723('0x1f')](function(){return new BPromise(function(_0x2776f0,_0x1f47cd){zipdir(_0x5dcaa5,{'saveTo':_0x3ef0b6},function(_0x533c19,_0x3fefa3){if(_0x533c19)return _0x1f47cd(_0x533c19);return _0x2776f0(_0x3fefa3);});})['then'](function(){return new BPromise(function(_0x3de7a7,_0x26c5a9){rimraf(_0x5dcaa5,function(_0x195ba0){if(_0x195ba0)_0x26c5a9(_0x195ba0);return _0x3de7a7();});});})[_0xd723('0x1f')](function(){return _0x111fb1[_0xd723('0x56')](_0x3ef0b6,_0x2a1628,function(_0x5c42dc){if(!_0x5c42dc)fs[_0xd723('0x70')](_0x3ef0b6);});});});}else{return _0x111fb1[_0xd723('0x13')](0xc8);}})['catch'](handleError(_0x111fb1,null));};
\ No newline at end of file
index f3628b9..e085a39 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b19=['catch','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','findAll','unreadMessages','emit'];(function(_0x5c7a85,_0x41dd19){var _0x35290f=function(_0x26215b){while(--_0x26215b){_0x5c7a85['push'](_0x5c7a85['shift']());}};_0x35290f(++_0x41dd19);}(_0x0b19,0x190));var _0x90b1=function(_0x25bb2f,_0x21c4ff){_0x25bb2f=_0x25bb2f-0x0;var _0x208b06=_0x0b19[_0x25bb2f];return _0x208b06;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0x90b1('0x0'))['db'][_0x90b1('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x90b1('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x90b1('0x3')](0x0);var events={'afterCreate':_0x90b1('0x4'),'afterUpdate':_0x90b1('0x5'),'afterDestroy':_0x90b1('0x6')};function emitEvent(_0x5052fd){return function(_0x2de5e1,_0x1f1402,_0x48ee31){_0x2de5e1[_0x90b1('0x7')]({'attributes':['id'],'raw':!![]})[_0x90b1('0x8')](function(_0x5d5661){_0x2de5e1[_0x90b1('0x9')](_0x90b1('0xa'),_0x5d5661['map'](function(_0x361e3b){return{'id':_0x361e3b['id']};}));return MailMessage[_0x90b1('0xb')]({'where':{'MailInteractionId':_0x2de5e1['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3e0177){_0x2de5e1['setDataValue'](_0x90b1('0xc'),_0x3e0177['length']);MailInteractionEvents[_0x90b1('0xd')](_0x5052fd+':'+_0x2de5e1['id'],_0x2de5e1);MailInteractionEvents[_0x90b1('0xd')](_0x5052fd,_0x2de5e1);_0x48ee31(null);})[_0x90b1('0xe')](_0x48ee31(null));};}for(var e in events){if(events[_0x90b1('0xf')](e)){var event=events[e];MailInteraction[_0x90b1('0x10')](e,emitEvent(event));}}module[_0x90b1('0x11')]=MailInteractionEvents;
\ No newline at end of file
+var _0x9714=['getUsers','then','setDataValue','map','emit','hasOwnProperty','exports','events','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x13992d,_0x3029ea){var _0x3d15bf=function(_0x3444f7){while(--_0x3444f7){_0x13992d['push'](_0x13992d['shift']());}};_0x3d15bf(++_0x3029ea);}(_0x9714,0x11b));var _0x4971=function(_0x2d9c6a,_0x59393d){_0x2d9c6a=_0x2d9c6a-0x0;var _0xf3c918=_0x9714[_0x2d9c6a];return _0xf3c918;};'use strict';var EventEmitter=require(_0x4971('0x0'));var MailInteraction=require(_0x4971('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x4971('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4971('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4971('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e2d96){return function(_0x572d83,_0xeec5bc,_0x5bbff9){_0x572d83[_0x4971('0x5')]({'attributes':['id'],'raw':!![]})[_0x4971('0x6')](function(_0x12ae09){_0x572d83[_0x4971('0x7')]('Users',_0x12ae09[_0x4971('0x8')](function(_0x2528e2){return{'id':_0x2528e2['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x572d83['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4c16ba){_0x572d83['setDataValue']('unreadMessages',_0x4c16ba['length']);MailInteractionEvents['emit'](_0x3e2d96+':'+_0x572d83['id'],_0x572d83);MailInteractionEvents[_0x4971('0x9')](_0x3e2d96,_0x572d83);_0x5bbff9(null);})['catch'](_0x5bbff9(null));};}for(var e in events){if(events[_0x4971('0xa')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x4971('0xb')]=MailInteractionEvents;
\ No newline at end of file
index f5e6f4f..e57cabe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcfe1=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','closedAt','changed','YYYY-MM-DD\x20HH:mm:ss','models','get','MailMessage','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xcfe1,0x71));var _0x1cfe=function(_0x4fa109,_0x35c3c1){_0x4fa109=_0x4fa109-0x0;var _0x48e5f6=_0xcfe1[_0x4fa109];return _0x48e5f6;};'use strict';var _=require(_0x1cfe('0x0'));var util=require(_0x1cfe('0x1'));var logger=require(_0x1cfe('0x2'))(_0x1cfe('0x3'));var moment=require(_0x1cfe('0x4'));var BPromise=require(_0x1cfe('0x5'));var rp=require(_0x1cfe('0x6'));var fs=require('fs');var path=require(_0x1cfe('0x7'));var rimraf=require('rimraf');var config=require(_0x1cfe('0x8'));var attributes=require('./mailInteraction.attributes');module[_0x1cfe('0x9')]=function(_0x59e380,_0x13fffc){return _0x59e380[_0x1cfe('0xa')](_0x1cfe('0xb'),attributes,{'tableName':_0x1cfe('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x1cfe('0xd'),'to'],'type':_0x1cfe('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2d6491,_0x305075,_0x5bcb29){if(_0x2d6491[_0x1cfe('0xf')]){_0x2d6491[_0x1cfe('0x10')]=moment()[_0x1cfe('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2d6491[_0x1cfe('0x12')]){_0x2d6491[_0x1cfe('0x13')]=moment()[_0x1cfe('0x11')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5bcb29(null,_0x305075);},'beforeUpdate':function(_0x462f86,_0x4b9bdb,_0x1e4d78){if(_0x462f86[_0x1cfe('0x14')]('substatus')){_0x462f86[_0x1cfe('0x10')]=_0x462f86[_0x1cfe('0xf')]?moment()[_0x1cfe('0x11')](_0x1cfe('0x15')):null;}if(_0x462f86[_0x1cfe('0x14')]('closed')){_0x462f86[_0x1cfe('0x13')]=moment()[_0x1cfe('0x11')](_0x1cfe('0x15'));_0x462f86[_0x1cfe('0xf')]=null;_0x462f86['substatusAt']=null;}_0x1e4d78(null,_0x462f86);},'afterUpdate':function(_0x5e565c,_0x24e766,_0x171252){var _0x1022c8=_0x59e380[_0x1cfe('0x16')];var _0x227ae3=_0x5e565c[_0x1cfe('0x17')]({'plain':!![]});if(_0x227ae3['closed']){return _0x1022c8[_0x1cfe('0x18')][_0x1cfe('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x227ae3['id']}})['then'](function(){_0x171252();})[_0x1cfe('0x1a')](function(_0x274159){_0x171252(_0x274159);});}else{_0x171252();}}},'charset':_0x1cfe('0x1b'),'collate':_0x1cfe('0x1c')});};
\ No newline at end of file
+var _0x3bb4=['substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT'];(function(_0x24a234,_0x504c09){var _0xbc39b8=function(_0x1a5566){while(--_0x1a5566){_0x24a234['push'](_0x24a234['shift']());}};_0xbc39b8(++_0x504c09);}(_0x3bb4,0x8b));var _0x43bb=function(_0x2628b0,_0xa51fc9){_0x2628b0=_0x2628b0-0x0;var _0x44c69a=_0x3bb4[_0x2628b0];return _0x44c69a;};'use strict';var _=require(_0x43bb('0x0'));var util=require('util');var logger=require(_0x43bb('0x1'))(_0x43bb('0x2'));var moment=require(_0x43bb('0x3'));var BPromise=require(_0x43bb('0x4'));var rp=require(_0x43bb('0x5'));var fs=require('fs');var path=require(_0x43bb('0x6'));var rimraf=require(_0x43bb('0x7'));var config=require(_0x43bb('0x8'));var attributes=require(_0x43bb('0x9'));module[_0x43bb('0xa')]=function(_0x586700,_0x83e6d6){return _0x586700['define'](_0x43bb('0xb'),attributes,{'tableName':_0x43bb('0xc'),'paranoid':![],'indexes':[{'name':_0x43bb('0xd'),'fields':[_0x43bb('0xe'),'to'],'type':_0x43bb('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18661c,_0x365570,_0x5912b4){if(_0x18661c[_0x43bb('0x10')]){_0x18661c[_0x43bb('0x11')]=moment()[_0x43bb('0x12')](_0x43bb('0x13'));}if(_0x18661c[_0x43bb('0x14')]){_0x18661c[_0x43bb('0x15')]=moment()[_0x43bb('0x12')](_0x43bb('0x13'));}_0x5912b4(null,_0x365570);},'beforeUpdate':function(_0x156df9,_0x4cecb5,_0x139ce8){if(_0x156df9[_0x43bb('0x16')]('substatus')){_0x156df9[_0x43bb('0x11')]=_0x156df9[_0x43bb('0x10')]?moment()[_0x43bb('0x12')](_0x43bb('0x13')):null;}if(_0x156df9[_0x43bb('0x16')]('closed')){_0x156df9['closedAt']=moment()[_0x43bb('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x156df9[_0x43bb('0x10')]=null;_0x156df9['substatusAt']=null;}_0x139ce8(null,_0x156df9);},'afterUpdate':function(_0x4811c6,_0xa48103,_0x27ed8d){var _0x1a3436=_0x586700[_0x43bb('0x17')];var _0x2ec0f2=_0x4811c6[_0x43bb('0x18')]({'plain':!![]});if(_0x2ec0f2[_0x43bb('0x14')]){return _0x1a3436[_0x43bb('0x19')][_0x43bb('0x1a')]({'read':!![]},{'where':{'MailInteractionId':_0x2ec0f2['id']}})[_0x43bb('0x1b')](function(){_0x27ed8d();})[_0x43bb('0x1c')](function(_0x58009c){_0x27ed8d(_0x58009c);});}else{_0x27ed8d();}}},'charset':_0x43bb('0x1d'),'collate':_0x43bb('0x1e')});};
\ No newline at end of file
index 58f8ba2..4257fa3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2f7=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToMailInteraction','addTags','omit','ids','spread','AddTags','lodash'];(function(_0x12bae4,_0x3e7e58){var _0x53dadb=function(_0x11060e){while(--_0x11060e){_0x12bae4['push'](_0x12bae4['shift']());}};_0x53dadb(++_0x3e7e58);}(_0xf2f7,0xa3));var _0x7f2f=function(_0x1d2d8c,_0x4f7149){_0x1d2d8c=_0x1d2d8c-0x0;var _0x138064=_0xf2f7[_0x1d2d8c];return _0x138064;};'use strict';var _=require(_0x7f2f('0x0'));var util=require('util');var moment=require(_0x7f2f('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7f2f('0x2'));var db=require(_0x7f2f('0x3'))['db'];var utils=require(_0x7f2f('0x4'));var logger=require(_0x7f2f('0x5'))(_0x7f2f('0x6'));var config=require(_0x7f2f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7f2f('0x8')]({'port':0x232a});config[_0x7f2f('0x9')]=_[_0x7f2f('0xa')](config['redis'],{'host':_0x7f2f('0xb'),'port':0x18eb});var socket=require(_0x7f2f('0xc'))(new Redis(config[_0x7f2f('0x9')]));require(_0x7f2f('0xd'))['register'](socket);function respondWithRpcPromise(_0x2a86bf,_0x5e6b05,_0x435373){return new BPromise(function(_0x2268e8,_0x2a4673){return client['request'](_0x2a86bf,_0x435373)[_0x7f2f('0xe')](function(_0x321a31){logger['info'](_0x7f2f('0xf'),_0x5e6b05,_0x7f2f('0x10'));logger['debug'](_0x7f2f('0x11'),_0x5e6b05,'request\x20sent',JSON[_0x7f2f('0x12')](_0x321a31));if(_0x321a31[_0x7f2f('0x13')]){if(_0x321a31[_0x7f2f('0x13')][_0x7f2f('0x14')]===0x1f4){logger[_0x7f2f('0x13')](_0x7f2f('0xf'),_0x5e6b05,_0x321a31[_0x7f2f('0x13')][_0x7f2f('0x15')]);return _0x2a4673(_0x321a31[_0x7f2f('0x13')]['message']);}logger['error'](_0x7f2f('0xf'),_0x5e6b05,_0x321a31[_0x7f2f('0x13')][_0x7f2f('0x15')]);return _0x2268e8(_0x321a31[_0x7f2f('0x13')]['message']);}else{logger[_0x7f2f('0x16')](_0x7f2f('0xf'),_0x5e6b05,_0x7f2f('0x10'));_0x2268e8(_0x321a31[_0x7f2f('0x17')][_0x7f2f('0x15')]);}})[_0x7f2f('0x18')](function(_0xfdfb41){logger['error'](_0x7f2f('0xf'),_0x5e6b05,_0xfdfb41);_0x2a4673(_0xfdfb41);});});}exports[_0x7f2f('0x19')]=function(_0x1aca12){var _0x5dd754=this;return new Promise(function(_0x2ccb65,_0x1ca790){return db[_0x7f2f('0x1a')][_0x7f2f('0x1b')](_0x1aca12[_0x7f2f('0x1c')],{'raw':_0x1aca12['options']?_0x1aca12[_0x7f2f('0x1d')][_0x7f2f('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1aca12[_0x7f2f('0x1d')]?_0x1aca12['options'][_0x7f2f('0x1f')]||null:null,'attributes':_0x1aca12[_0x7f2f('0x1d')]?_0x1aca12['options'][_0x7f2f('0x20')]||null:null,'limit':_0x1aca12['options']?_0x1aca12[_0x7f2f('0x1d')][_0x7f2f('0x21')]||null:null})[_0x7f2f('0xe')](function(_0x26ae2c){logger[_0x7f2f('0x16')](_0x7f2f('0x19'),_0x1aca12);logger[_0x7f2f('0x22')](_0x7f2f('0x19'),_0x1aca12,JSON['stringify'](_0x26ae2c));_0x2ccb65(_0x26ae2c);})[_0x7f2f('0x18')](function(_0x435368){logger[_0x7f2f('0x13')](_0x7f2f('0x19'),_0x435368[_0x7f2f('0x15')],_0x1aca12);_0x1ca790(_0x5dd754[_0x7f2f('0x13')](0x1f4,_0x435368[_0x7f2f('0x15')]));});});};exports[_0x7f2f('0x23')]=function(_0x1d4380){return new Promise(function(_0x58c4df,_0x259451){return db[_0x7f2f('0x1a')]['find']({'where':_0x1d4380[_0x7f2f('0x1d')]?_0x1d4380[_0x7f2f('0x1d')][_0x7f2f('0x1f')]||null:null})[_0x7f2f('0xe')](function(_0x48e003){if(_0x48e003){return _0x48e003[_0x7f2f('0x24')](_0x1d4380[_0x7f2f('0x1c')]['ids'],_[_0x7f2f('0x25')](_0x1d4380[_0x7f2f('0x1c')],[_0x7f2f('0x26'),'id'])||{});}})[_0x7f2f('0x27')](function(_0x258cef){logger[_0x7f2f('0x16')]('AddTags',_0x1d4380);logger[_0x7f2f('0x22')]('AddTags',_0x1d4380,JSON[_0x7f2f('0x12')](_0x258cef));_0x58c4df(_0x258cef);})[_0x7f2f('0x18')](function(_0x1b2904){logger[_0x7f2f('0x13')](_0x7f2f('0x28'),_0x1b2904[_0x7f2f('0x15')],_0x1d4380);_0x259451(_this['error'](0x1f4,_0x1b2904['message']));});});};
\ No newline at end of file
+var _0xbc37=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateMailInteraction','MailInteraction','update','body','options','where','attributes','limit','debug','AddTagsToMailInteraction','find','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis'];(function(_0x15a9cb,_0x2c5d45){var _0x4036e4=function(_0x4a97cf){while(--_0x4a97cf){_0x15a9cb['push'](_0x15a9cb['shift']());}};_0x4036e4(++_0x2c5d45);}(_0xbc37,0x11a));var _0x7bc3=function(_0x1e2b3b,_0x5e76b3){_0x1e2b3b=_0x1e2b3b-0x0;var _0x15e047=_0xbc37[_0x1e2b3b];return _0x15e047;};'use strict';var _=require(_0x7bc3('0x0'));var util=require(_0x7bc3('0x1'));var moment=require('moment');var BPromise=require(_0x7bc3('0x2'));var rs=require(_0x7bc3('0x3'));var fs=require('fs');var Redis=require(_0x7bc3('0x4'));var db=require(_0x7bc3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bc3('0x6'))(_0x7bc3('0x7'));var config=require(_0x7bc3('0x8'));var jayson=require(_0x7bc3('0x9'));var client=jayson['client'][_0x7bc3('0xa')]({'port':0x232a});config['redis']=_[_0x7bc3('0xb')](config[_0x7bc3('0xc')],{'host':_0x7bc3('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7bc3('0xc')]));require(_0x7bc3('0xe'))[_0x7bc3('0xf')](socket);function respondWithRpcPromise(_0x399883,_0x5bc8cd,_0x508dc0){return new BPromise(function(_0xf68a4,_0x1f4b40){return client[_0x7bc3('0x10')](_0x399883,_0x508dc0)[_0x7bc3('0x11')](function(_0x20c4a3){logger[_0x7bc3('0x12')](_0x7bc3('0x13'),_0x5bc8cd,'request\x20sent');logger['debug'](_0x7bc3('0x14'),_0x5bc8cd,_0x7bc3('0x15'),JSON[_0x7bc3('0x16')](_0x20c4a3));if(_0x20c4a3[_0x7bc3('0x17')]){if(_0x20c4a3[_0x7bc3('0x17')]['code']===0x1f4){logger[_0x7bc3('0x17')](_0x7bc3('0x13'),_0x5bc8cd,_0x20c4a3[_0x7bc3('0x17')][_0x7bc3('0x18')]);return _0x1f4b40(_0x20c4a3[_0x7bc3('0x17')][_0x7bc3('0x18')]);}logger['error'](_0x7bc3('0x13'),_0x5bc8cd,_0x20c4a3[_0x7bc3('0x17')][_0x7bc3('0x18')]);return _0xf68a4(_0x20c4a3[_0x7bc3('0x17')]['message']);}else{logger[_0x7bc3('0x12')](_0x7bc3('0x13'),_0x5bc8cd,_0x7bc3('0x15'));_0xf68a4(_0x20c4a3['result'][_0x7bc3('0x18')]);}})[_0x7bc3('0x19')](function(_0xf5ebe6){logger[_0x7bc3('0x17')]('MailInteraction,\x20%s,\x20%s',_0x5bc8cd,_0xf5ebe6);_0x1f4b40(_0xf5ebe6);});});}exports[_0x7bc3('0x1a')]=function(_0x7d01eb){var _0x545938=this;return new Promise(function(_0x37ddd7,_0x1aaba7){return db[_0x7bc3('0x1b')][_0x7bc3('0x1c')](_0x7d01eb[_0x7bc3('0x1d')],{'raw':_0x7d01eb[_0x7bc3('0x1e')]?_0x7d01eb['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x7d01eb[_0x7bc3('0x1e')]?_0x7d01eb[_0x7bc3('0x1e')][_0x7bc3('0x1f')]||null:null,'attributes':_0x7d01eb[_0x7bc3('0x1e')]?_0x7d01eb[_0x7bc3('0x1e')][_0x7bc3('0x20')]||null:null,'limit':_0x7d01eb[_0x7bc3('0x1e')]?_0x7d01eb['options'][_0x7bc3('0x21')]||null:null})[_0x7bc3('0x11')](function(_0x2d84f6){logger[_0x7bc3('0x12')](_0x7bc3('0x1a'),_0x7d01eb);logger[_0x7bc3('0x22')](_0x7bc3('0x1a'),_0x7d01eb,JSON[_0x7bc3('0x16')](_0x2d84f6));_0x37ddd7(_0x2d84f6);})['catch'](function(_0xa599c3){logger[_0x7bc3('0x17')](_0x7bc3('0x1a'),_0xa599c3[_0x7bc3('0x18')],_0x7d01eb);_0x1aaba7(_0x545938['error'](0x1f4,_0xa599c3[_0x7bc3('0x18')]));});});};exports[_0x7bc3('0x23')]=function(_0x3eb9db){return new Promise(function(_0xd74d45,_0x446f6a){return db[_0x7bc3('0x1b')][_0x7bc3('0x24')]({'where':_0x3eb9db[_0x7bc3('0x1e')]?_0x3eb9db[_0x7bc3('0x1e')][_0x7bc3('0x1f')]||null:null})[_0x7bc3('0x11')](function(_0x2be622){if(_0x2be622){return _0x2be622[_0x7bc3('0x25')](_0x3eb9db['body'][_0x7bc3('0x26')],_['omit'](_0x3eb9db['body'],[_0x7bc3('0x26'),'id'])||{});}})[_0x7bc3('0x27')](function(_0x53f727){logger['info'](_0x7bc3('0x28'),_0x3eb9db);logger[_0x7bc3('0x22')](_0x7bc3('0x28'),_0x3eb9db,JSON[_0x7bc3('0x16')](_0x53f727));_0xd74d45(_0x53f727);})[_0x7bc3('0x19')](function(_0x53f3ab){logger[_0x7bc3('0x17')](_0x7bc3('0x28'),_0x53f3ab[_0x7bc3('0x18')],_0x3eb9db);_0x446f6a(_this['error'](0x1f4,_0x53f3ab[_0x7bc3('0x18')]));});});};
\ No newline at end of file
index 41c0bae..f0bcf74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x090c=['register','length','mailInteraction:','save','remove','update','emit'];(function(_0x122e2f,_0x2f753d){var _0x1a2a04=function(_0x3fc6e8){while(--_0x3fc6e8){_0x122e2f['push'](_0x122e2f['shift']());}};_0x1a2a04(++_0x2f753d);}(_0x090c,0x129));var _0xc090=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x090c[_0x1da527];return _0x40fc7c;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=[_0xc090('0x0'),_0xc090('0x1'),_0xc090('0x2')];function createListener(_0x630ad4,_0x24ef94){return function(_0x9741f4){_0x24ef94[_0xc090('0x3')](_0x630ad4,_0x9741f4);};}function removeListener(_0x37c3ce,_0x1d3a23){return function(){MailInteractionEvents['removeListener'](_0x37c3ce,_0x1d3a23);};}exports[_0xc090('0x4')]=function(_0x5899c0){for(var _0x260aed=0x0,_0x2ecfd6=events[_0xc090('0x5')];_0x260aed<_0x2ecfd6;_0x260aed++){var _0x453709=events[_0x260aed];var _0x2becb7=createListener(_0xc090('0x6')+_0x453709,_0x5899c0);MailInteractionEvents['on'](_0x453709,_0x2becb7);}};
\ No newline at end of file
+var _0x0802=['remove','update','removeListener','register','length','./mailInteraction.events','save'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x0802,0x124));var _0x2080=function(_0x2d47d7,_0x54092e){_0x2d47d7=_0x2d47d7-0x0;var _0x146f0b=_0x0802[_0x2d47d7];return _0x146f0b;};'use strict';var MailInteractionEvents=require(_0x2080('0x0'));var events=[_0x2080('0x1'),_0x2080('0x2'),_0x2080('0x3')];function createListener(_0x3f2ef6,_0x225a60){return function(_0x191006){_0x225a60['emit'](_0x3f2ef6,_0x191006);};}function removeListener(_0x415e87,_0x2aa729){return function(){MailInteractionEvents[_0x2080('0x4')](_0x415e87,_0x2aa729);};}exports[_0x2080('0x5')]=function(_0x2fd8ab){for(var _0x26e952=0x0,_0x1c5a84=events[_0x2080('0x6')];_0x26e952<_0x1c5a84;_0x26e952++){var _0x22a286=events[_0x26e952];var _0x4873b4=createListener('mailInteraction:'+_0x22a286,_0x2fd8ab);MailInteractionEvents['on'](_0x22a286,_0x4873b4);}};
\ No newline at end of file
index a13a5d5..49e610c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7117=['path','connect-timeout','Router','fs-extra','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','mail','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','multer','util'];(function(_0x1e7fb1,_0x2e46f9){var _0x1762d5=function(_0x103cf5){while(--_0x103cf5){_0x1e7fb1['push'](_0x1e7fb1['shift']());}};_0x1762d5(++_0x2e46f9);}(_0x7117,0x1ec));var _0x7711=function(_0x379c99,_0x4146dc){_0x379c99=_0x379c99-0x0;var _0x8999ba=_0x7117[_0x379c99];return _0x8999ba;};'use strict';var multer=require(_0x7711('0x0'));var util=require(_0x7711('0x1'));var path=require(_0x7711('0x2'));var timeout=require(_0x7711('0x3'));var express=require('express');var router=express[_0x7711('0x4')]();var fs_extra=require(_0x7711('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7711('0x6'));var config=require('../../config/environment');var controller=require(_0x7711('0x7'));router[_0x7711('0x8')]('/',auth[_0x7711('0x9')](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x7711('0xa')]);router[_0x7711('0x8')](_0x7711('0xb'),auth[_0x7711('0x9')](),controller['show']);router[_0x7711('0x8')](_0x7711('0xc'),auth[_0x7711('0x9')](),controller[_0x7711('0xd')]);router[_0x7711('0xe')]('/',auth['isAuthenticated'](),interaction[_0x7711('0xf')](_0x7711('0x10'),'mailmessage:create'),controller[_0x7711('0x11')]);router[_0x7711('0x12')](_0x7711('0xb'),auth[_0x7711('0x9')](),controller[_0x7711('0x13')]);router[_0x7711('0x12')]('/:id/accept',auth[_0x7711('0x9')](),controller[_0x7711('0x14')]);router[_0x7711('0x12')](_0x7711('0x15'),auth['isAuthenticated'](),controller[_0x7711('0x16')]);router[_0x7711('0x17')](_0x7711('0xb'),auth[_0x7711('0x9')](),controller[_0x7711('0x18')]);module[_0x7711('0x19')]=router;
\ No newline at end of file
+var _0x586b=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','download','post','tracked','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x95975e,_0x51412c){var _0x5d4933=function(_0x1cb2da){while(--_0x1cb2da){_0x95975e['push'](_0x95975e['shift']());}};_0x5d4933(++_0x51412c);}(_0x586b,0x1bb));var _0xb586=function(_0x438f1f,_0x6c1d55){_0x438f1f=_0x438f1f-0x0;var _0x500b58=_0x586b[_0x438f1f];return _0x500b58;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb586('0x0'));var timeout=require(_0xb586('0x1'));var express=require(_0xb586('0x2'));var router=express[_0xb586('0x3')]();var fs_extra=require(_0xb586('0x4'));var auth=require(_0xb586('0x5'));var interaction=require(_0xb586('0x6'));var config=require(_0xb586('0x7'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0xb586('0x8')](),controller[_0xb586('0x9')]);router[_0xb586('0xa')](_0xb586('0xb'),auth[_0xb586('0x8')](),controller[_0xb586('0xc')]);router['get'](_0xb586('0xd'),auth[_0xb586('0x8')](),controller[_0xb586('0xe')]);router[_0xb586('0xa')](_0xb586('0xf'),auth[_0xb586('0x8')](),controller[_0xb586('0x10')]);router[_0xb586('0x11')]('/',auth['isAuthenticated'](),interaction[_0xb586('0x12')]('mail',_0xb586('0x13')),controller[_0xb586('0x14')]);router[_0xb586('0x15')]('/:id',auth[_0xb586('0x8')](),controller[_0xb586('0x16')]);router[_0xb586('0x15')](_0xb586('0x17'),auth['isAuthenticated'](),controller[_0xb586('0x18')]);router['put'](_0xb586('0x19'),auth[_0xb586('0x8')](),controller[_0xb586('0x1a')]);router[_0xb586('0x1b')](_0xb586('0xd'),auth[_0xb586('0x8')](),controller[_0xb586('0x1c')]);module[_0xb586('0x1d')]=router;
\ No newline at end of file
index 94c3da7..1b92d9d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x43d5=['Email','sequelize','lodash','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER'];(function(_0x2e14aa,_0x5dd4a1){var _0x51e555=function(_0x55d479){while(--_0x55d479){_0x2e14aa['push'](_0x2e14aa['shift']());}};_0x51e555(++_0x5dd4a1);}(_0x43d5,0xcd));var _0x543d=function(_0x59e174,_0x43a286){_0x59e174=_0x59e174-0x0;var _0x2d581f=_0x43d5[_0x59e174];return _0x2d581f;};'use strict';var Sequelize=require(_0x543d('0x0'));var _=require(_0x543d('0x1'));module['exports']={'body':{'type':Sequelize[_0x543d('0x2')](_0x543d('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x543d('0x4'))},'read':{'type':Sequelize[_0x543d('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x543d('0x6')]('in',_0x543d('0x7')),'defaultValue':_0x543d('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x543d('0x8')](0x1fe)},'from':{'type':Sequelize[_0x543d('0x8')]},'to':{'type':Sequelize[_0x543d('0x2')](_0x543d('0x3'))},'cc':{'type':Sequelize[_0x543d('0x2')]('long')},'bcc':{'type':Sequelize[_0x543d('0x2')](_0x543d('0x3'))},'subject':{'type':Sequelize[_0x543d('0x2')]},'sentAt':{'type':Sequelize[_0x543d('0x9')]},'attach':{'type':Sequelize[_0x543d('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x543d('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x543d('0x9')]},'originTo':{'type':Sequelize[_0x543d('0x2')]('long')},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0x543d('0x6')]('Email','Chat'),'defaultValue':_0x543d('0xb'),'allowNull':![]}};
\ No newline at end of file
+var _0xfff1=['lodash','TEXT','long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize'];(function(_0x383494,_0x2070d2){var _0x2485e5=function(_0x37c52e){while(--_0x37c52e){_0x383494['push'](_0x383494['shift']());}};_0x2485e5(++_0x2070d2);}(_0xfff1,0xe9));var _0x1fff=function(_0x3144d7,_0x550484){_0x3144d7=_0x3144d7-0x0;var _0x354237=_0xfff1[_0x3144d7];return _0x354237;};'use strict';var Sequelize=require(_0x1fff('0x0'));var _=require(_0x1fff('0x1'));module['exports']={'body':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x1fff('0x4'))},'read':{'type':Sequelize[_0x1fff('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1fff('0x6')]('in',_0x1fff('0x7')),'defaultValue':_0x1fff('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1fff('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3'))},'cc':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3'))},'bcc':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3'))},'subject':{'type':Sequelize[_0x1fff('0x2')]},'sentAt':{'type':Sequelize[_0x1fff('0x9')]},'attach':{'type':Sequelize[_0x1fff('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x1fff('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x1fff('0x9')]},'originTo':{'type':Sequelize[_0x1fff('0x2')](_0x1fff('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x1fff('0x3'))},'originChannel':{'type':Sequelize[_0x1fff('0x6')](_0x1fff('0xb'),_0x1fff('0xc')),'defaultValue':_0x1fff('0xb'),'allowNull':![]}};
\ No newline at end of file
index b4974f6..71d5182 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb6c2=['show','params','merge','catch','body','find','describe','create','direction','out','secret','split','MailAccount','MailAccountId','List','CmContact','Contacts','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','Sequelize','fromString','rejectmessage','unix','tmp','from','bcc','subject','createdAt','Attachment','Attachments','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','util','path','lodash','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','defaults','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','json','offset','undefined','limit','status','update','then','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','MailMessage','count','includeAll','include','findAll','rows'];(function(_0xc84695,_0x5e17e3){var _0x310f79=function(_0x1343a9){while(--_0x1343a9){_0xc84695['push'](_0xc84695['shift']());}};_0x310f79(++_0x5e17e3);}(_0xb6c2,0xf5));var _0x2b6c=function(_0x5b8743,_0x537619){_0x5b8743=_0x5b8743-0x0;var _0x263786=_0xb6c2[_0x5b8743];return _0x263786;};'use strict';var emlformat=require(_0x2b6c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var util=require(_0x2b6c('0x1'));var path=require(_0x2b6c('0x2'));var fs=require('fs');var _=require(_0x2b6c('0x3'));var Redis=require('ioredis');var htmlToText=require(_0x2b6c('0x4'));var qs=require(_0x2b6c('0x5'));var logger=require(_0x2b6c('0x6'))(_0x2b6c('0x7'));var interaction_log=require(_0x2b6c('0x6'))(_0x2b6c('0x8'));var config=require(_0x2b6c('0x9'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x2b6c('0xa')](config[_0x2b6c('0xb')],{'host':_0x2b6c('0xc'),'port':0x18eb});var socket=require(_0x2b6c('0xd'))(new Redis(config[_0x2b6c('0xb')]));var htmlEntities=require(_0x2b6c('0xe'));require(_0x2b6c('0xf'))[_0x2b6c('0x10')](socket);var jayson=require(_0x2b6c('0x11'));var client=jayson[_0x2b6c('0x12')][_0x2b6c('0x13')]({'port':0x232c});var client9003=jayson[_0x2b6c('0x12')][_0x2b6c('0x13')]({'port':0x232b});var client9002=jayson[_0x2b6c('0x12')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc3f0ee,_0x479833,_0x313fc7,_0x17e740){return new BPromise(function(_0x10e13d,_0x4d4f1b){var _0x3cf588=_0x17e740||client;return _0x3cf588['request'](_0xc3f0ee,_0x313fc7)['then'](function(_0x4a5aa0){logger[_0x2b6c('0x14')](_0x2b6c('0x15'),_0x479833,_0x2b6c('0x16'));logger['debug'](_0x2b6c('0x17'),_0x479833,_0x2b6c('0x16'),JSON[_0x2b6c('0x18')](_0x4a5aa0));if(_0x4a5aa0[_0x2b6c('0x19')]){if(_0x4a5aa0[_0x2b6c('0x19')][_0x2b6c('0x1a')]===0x1f4){logger[_0x2b6c('0x19')]('MailMessage,\x20%s,\x20%s',_0x479833,_0x4a5aa0['error']['message']);return _0x4d4f1b(_0x4a5aa0[_0x2b6c('0x19')][_0x2b6c('0x1b')]);}logger[_0x2b6c('0x19')](_0x2b6c('0x15'),_0x479833,_0x4a5aa0[_0x2b6c('0x19')][_0x2b6c('0x1b')]);return _0x10e13d(_0x4a5aa0[_0x2b6c('0x19')][_0x2b6c('0x1b')]);}else{logger[_0x2b6c('0x14')](_0x2b6c('0x15'),_0x479833,_0x2b6c('0x16'));_0x10e13d(_0x4a5aa0[_0x2b6c('0x1c')][_0x2b6c('0x1b')]);}})['catch'](function(_0x14fdb3){logger['error'](_0x2b6c('0x15'),_0x479833,_0x14fdb3);_0x4d4f1b(_0x14fdb3);});});}function respondWithResult(_0x5c2d47,_0x22a0fe){_0x22a0fe=_0x22a0fe||0xc8;return function(_0x31b15c){if(_0x31b15c){return _0x5c2d47['status'](_0x22a0fe)[_0x2b6c('0x1d')](_0x31b15c);}};}function respondWithFilteredResult(_0x159ffc,_0x1780d8){return function(_0x484f2e){if(_0x484f2e){var _0x57f80d=typeof _0x1780d8[_0x2b6c('0x1e')]===_0x2b6c('0x1f')&&typeof _0x1780d8[_0x2b6c('0x20')]===_0x2b6c('0x1f');var _0x52f2b9=_0x484f2e['count'];var _0x2a8e89=_0x57f80d?0x0:_0x1780d8[_0x2b6c('0x1e')];var _0x4f605d=_0x57f80d?_0x484f2e['count']:_0x1780d8[_0x2b6c('0x1e')]+_0x1780d8['limit'];var _0x6628f6;if(_0x4f605d>=_0x52f2b9){_0x4f605d=_0x52f2b9;_0x6628f6=0xc8;}else{_0x6628f6=0xce;}_0x159ffc[_0x2b6c('0x21')](_0x6628f6);return _0x159ffc['set']('Content-Range',_0x2a8e89+'-'+_0x4f605d+'/'+_0x52f2b9)[_0x2b6c('0x1d')](_0x484f2e);}return null;};}function saveUpdates(_0x1e9acb){return function(_0x8fd17){if(_0x8fd17){return _0x8fd17[_0x2b6c('0x22')](_0x1e9acb)[_0x2b6c('0x23')](function(_0x2c42f1){return _0x2c42f1;});}return null;};}function removeEntity(_0x4fa07c){return function(_0x4f0229){if(_0x4f0229){return _0x4f0229[_0x2b6c('0x24')]()[_0x2b6c('0x23')](function(){_0x4fa07c[_0x2b6c('0x21')](0xcc)[_0x2b6c('0x25')]();});}};}function handleEntityNotFound(_0x22830f){return function(_0x268f21){if(!_0x268f21){_0x22830f[_0x2b6c('0x26')](0x194);}return _0x268f21;};}function handleError(_0x39de19,_0x4bb157){_0x4bb157=_0x4bb157||0x1f4;return function(_0x5297ab){logger[_0x2b6c('0x19')](_0x5297ab[_0x2b6c('0x27')]);if(_0x5297ab[_0x2b6c('0x28')]){delete _0x5297ab[_0x2b6c('0x28')];}_0x39de19['status'](_0x4bb157)[_0x2b6c('0x29')](_0x5297ab);};}exports[_0x2b6c('0x2a')]=function(_0x4ac136,_0x5ba100){var _0x1ecf8f={},_0x5329d9={},_0x275bcd={'count':0x0,'rows':[]};var _0x2ee97=_['map'](db['MailMessage'][_0x2b6c('0x2b')],function(_0x19a58e){return{'name':_0x19a58e[_0x2b6c('0x2c')],'type':_0x19a58e[_0x2b6c('0x2d')][_0x2b6c('0x2e')]};});_0x5329d9['model']=_[_0x2b6c('0x2f')](_0x2ee97,_0x2b6c('0x28'));_0x5329d9[_0x2b6c('0x30')]=_[_0x2b6c('0x31')](_0x4ac136[_0x2b6c('0x30')]);_0x5329d9[_0x2b6c('0x32')]=_[_0x2b6c('0x33')](_0x5329d9['model'],_0x5329d9[_0x2b6c('0x30')]);_0x1ecf8f[_0x2b6c('0x34')]=_['intersection'](_0x5329d9['model'],qs['fields'](_0x4ac136[_0x2b6c('0x30')][_0x2b6c('0x35')]));_0x1ecf8f[_0x2b6c('0x34')]=_0x1ecf8f[_0x2b6c('0x34')][_0x2b6c('0x36')]?_0x1ecf8f[_0x2b6c('0x34')]:_0x5329d9[_0x2b6c('0x37')];if(!_0x4ac136[_0x2b6c('0x30')][_0x2b6c('0x38')](_0x2b6c('0x39'))){_0x1ecf8f[_0x2b6c('0x20')]=qs['limit'](_0x4ac136[_0x2b6c('0x30')][_0x2b6c('0x20')]);_0x1ecf8f[_0x2b6c('0x1e')]=qs[_0x2b6c('0x1e')](_0x4ac136[_0x2b6c('0x30')]['offset']);}_0x1ecf8f[_0x2b6c('0x3a')]=qs[_0x2b6c('0x3b')](_0x4ac136[_0x2b6c('0x30')][_0x2b6c('0x3b')]);_0x1ecf8f[_0x2b6c('0x3c')]=qs['filters'](_[_0x2b6c('0x3d')](_0x4ac136['query'],_0x5329d9[_0x2b6c('0x32')]),_0x2ee97);if(_0x4ac136['query']['filter']){_0x1ecf8f[_0x2b6c('0x3c')]=_['merge'](_0x1ecf8f[_0x2b6c('0x3c')],{'$or':_['map'](_0x2ee97,function(_0x3b0dab){if(_0x3b0dab[_0x2b6c('0x2d')]!==_0x2b6c('0x3e')){var _0x568771={};_0x568771[_0x3b0dab['name']]={'$like':'%'+_0x4ac136['query'][_0x2b6c('0x3f')]+'%'};return _0x568771;}})});}_0x1ecf8f=_['merge']({},_0x1ecf8f,_0x4ac136[_0x2b6c('0x40')]);var _0xa804a2={'where':_0x1ecf8f[_0x2b6c('0x3c')]};return db[_0x2b6c('0x41')][_0x2b6c('0x42')](_0xa804a2)[_0x2b6c('0x23')](function(_0x3dbc32){_0x275bcd[_0x2b6c('0x42')]=_0x3dbc32;if(_0x4ac136[_0x2b6c('0x30')][_0x2b6c('0x43')]){_0x1ecf8f[_0x2b6c('0x44')]=[{'all':!![]}];}return db['MailMessage'][_0x2b6c('0x45')](_0x1ecf8f);})[_0x2b6c('0x23')](function(_0x52df56){_0x275bcd[_0x2b6c('0x46')]=_0x52df56;return _0x275bcd;})[_0x2b6c('0x23')](respondWithFilteredResult(_0x5ba100,_0x1ecf8f))['catch'](handleError(_0x5ba100,null));};exports[_0x2b6c('0x47')]=function(_0x3443bc,_0xf05e26){var _0x544670={'raw':!![],'where':{'id':_0x3443bc[_0x2b6c('0x48')]['id']}},_0x39d855={};_0x39d855[_0x2b6c('0x37')]=_[_0x2b6c('0x31')](db[_0x2b6c('0x41')]['rawAttributes']);_0x39d855[_0x2b6c('0x30')]=_[_0x2b6c('0x31')](_0x3443bc['query']);_0x39d855[_0x2b6c('0x32')]=_['intersection'](_0x39d855[_0x2b6c('0x37')],_0x39d855[_0x2b6c('0x30')]);_0x544670[_0x2b6c('0x34')]=_[_0x2b6c('0x33')](_0x39d855[_0x2b6c('0x37')],qs[_0x2b6c('0x35')](_0x3443bc['query'][_0x2b6c('0x35')]));_0x544670[_0x2b6c('0x34')]=_0x544670['attributes']['length']?_0x544670[_0x2b6c('0x34')]:_0x39d855[_0x2b6c('0x37')];if(_0x3443bc[_0x2b6c('0x30')][_0x2b6c('0x43')]){_0x544670[_0x2b6c('0x44')]=[{'all':!![]}];}_0x544670=_[_0x2b6c('0x49')]({},_0x544670,_0x3443bc[_0x2b6c('0x40')]);return db['MailMessage']['find'](_0x544670)[_0x2b6c('0x23')](handleEntityNotFound(_0xf05e26,null))[_0x2b6c('0x23')](respondWithResult(_0xf05e26,null))[_0x2b6c('0x4a')](handleError(_0xf05e26,null));};exports[_0x2b6c('0x22')]=function(_0x1cb2f6,_0x136ea7){if(_0x1cb2f6[_0x2b6c('0x4b')]['id']){delete _0x1cb2f6[_0x2b6c('0x4b')]['id'];}return db[_0x2b6c('0x41')][_0x2b6c('0x4c')]({'where':{'id':_0x1cb2f6[_0x2b6c('0x48')]['id']}})[_0x2b6c('0x23')](handleEntityNotFound(_0x136ea7,null))['then'](saveUpdates(_0x1cb2f6[_0x2b6c('0x4b')],null))[_0x2b6c('0x23')](respondWithResult(_0x136ea7,null))[_0x2b6c('0x4a')](handleError(_0x136ea7,null));};exports[_0x2b6c('0x24')]=function(_0x588cd8,_0x32a865){return db[_0x2b6c('0x41')][_0x2b6c('0x4c')]({'where':{'id':_0x588cd8[_0x2b6c('0x48')]['id']}})['then'](handleEntityNotFound(_0x32a865,null))[_0x2b6c('0x23')](removeEntity(_0x32a865,null))[_0x2b6c('0x4a')](handleError(_0x32a865,null));};exports[_0x2b6c('0x4d')]=function(_0x3d0954,_0x56fce9){return db[_0x2b6c('0x41')][_0x2b6c('0x4d')]()[_0x2b6c('0x23')](respondWithResult(_0x56fce9,null))['catch'](handleError(_0x56fce9,null));};exports['create']=function(_0x44fa8a,_0x22c792){return db[_0x2b6c('0x41')][_0x2b6c('0x4e')](_0x44fa8a[_0x2b6c('0x4b')])['then'](function(_0x3426f3){if(_0x3426f3){if(_0x3426f3[_0x2b6c('0x4f')]===_0x2b6c('0x50')&&!_0x3426f3[_0x2b6c('0x51')]){var _0x314abd,_0x8d8e0f,_0x2c6232;if(_0x44fa8a[_0x2b6c('0x4b')]['to']){_0x8d8e0f=_0x44fa8a[_0x2b6c('0x4b')]['to'][_0x2b6c('0x52')](',')[0x0];}return db[_0x2b6c('0x53')]['findOne']({'where':{'id':_0x3426f3[_0x2b6c('0x54')]},'include':[{'model':db['CmList'],'as':_0x2b6c('0x55'),'include':[{'model':db[_0x2b6c('0x56')],'as':_0x2b6c('0x57'),'where':{'email':_0x8d8e0f},'limit':0x1,'order':[['updatedAt',_0x2b6c('0x58')]]}]},{'model':db[_0x2b6c('0x59')],'as':_0x2b6c('0x5a'),'raw':!![],'include':[{'model':db[_0x2b6c('0x5b')],'as':_0x2b6c('0x5b'),'raw':!![]}]}]})['then'](function(_0x4e2edf){_0x314abd=_0x4e2edf;if(!_0x314abd||!_0x314abd[_0x2b6c('0x5a')])return;var _0x53fdc5=_0x314abd[_0x2b6c('0x5c')]();if(_0x44fa8a[_0x2b6c('0x4b')][_0x2b6c('0x5d')]&&_0x44fa8a[_0x2b6c('0x4b')][_0x2b6c('0x5d')][_0x2b6c('0x36')]){for(var _0x2e805b=0x0;_0x2e805b<_0x44fa8a[_0x2b6c('0x4b')][_0x2b6c('0x5d')][_0x2b6c('0x36')];_0x2e805b+=0x1){_0x44fa8a[_0x2b6c('0x4b')][_0x2b6c('0x5d')][_0x2e805b]={'filename':_0x44fa8a['body']['attachments'][_0x2e805b][_0x2b6c('0x28')],'path':path[_0x2b6c('0x5e')](config[_0x2b6c('0x5f')],_0x2b6c('0x60'),_0x44fa8a[_0x2b6c('0x4b')][_0x2b6c('0x5d')][_0x2e805b][_0x2b6c('0x61')])};}}_0x2c6232={'account':_0x53fdc5,'message':_0x44fa8a['body']};return;})[_0x2b6c('0x23')](function(){if(_0x314abd[_0x2b6c('0x55')]){if(_0x314abd[_0x2b6c('0x55')][_0x2b6c('0x57')]['length']){return _0x314abd['List']['Contacts'][0x0];}else{return db['CmContact'][_0x2b6c('0x4e')](_[_0x2b6c('0xa')](_0x44fa8a['body'],{'firstName':_0x44fa8a[_0x2b6c('0x4b')]['to'],'email':_0x44fa8a[_0x2b6c('0x4b')]['to'],'phone':_0x44fa8a[_0x2b6c('0x4b')]['to'],'ListId':_0x314abd[_0x2b6c('0x62')]}));}}else{throw new Error(_0x2b6c('0x63'));}})[_0x2b6c('0x23')](function(){if(_0x2c6232){return respondWithRpcPromise('SendMail','sendMail',_0x2c6232,client9003)[_0x2b6c('0x23')](function(_0x5454c1){return _0x3426f3[_0x2b6c('0x22')]({'read':!![],'messageId':_0x5454c1[_0x2b6c('0x64')],'sentAt':moment()[_0x2b6c('0x65')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2b6c('0x4a')](function(_0x478ed1){logger['error']('%s',JSON[_0x2b6c('0x18')](_0x478ed1));return _0x3426f3;});}return _0x3426f3;});}return _0x3426f3;}})[_0x2b6c('0x23')](respondWithResult(_0x22c792,0xc9))[_0x2b6c('0x4a')](handleError(_0x22c792,null));};exports[_0x2b6c('0x66')]=function(_0x1c22d3,_0x4cec90){var _0x514cd6={'agent':{},'channel':_0x2b6c('0x67')};if(_0x1c22d3[_0x2b6c('0x4b')]['id']){delete _0x1c22d3[_0x2b6c('0x4b')]['id'];}_0x1c22d3[_0x2b6c('0x4b')][_0x2b6c('0x68')]=!![];_0x1c22d3[_0x2b6c('0x4b')][_0x2b6c('0x69')]=moment()[_0x2b6c('0x65')](_0x2b6c('0x6a'));_0x1c22d3['body']['UserId']=_0x1c22d3[_0x2b6c('0x4b')][_0x2b6c('0x6b')]||_0x1c22d3[_0x2b6c('0x6c')]['id'];_0x514cd6[_0x2b6c('0x6d')]['id']=_0x1c22d3[_0x2b6c('0x4b')][_0x2b6c('0x6b')];return db[_0x2b6c('0x41')]['find']({'where':{'id':_0x1c22d3[_0x2b6c('0x48')]['id'],'UserId':null}})[_0x2b6c('0x23')](handleEntityNotFound(_0x4cec90,null))['then'](saveUpdates(_0x1c22d3[_0x2b6c('0x4b')],null))[_0x2b6c('0x23')](function(_0x114d08){if(_0x114d08){_0x514cd6[_0x2b6c('0x1b')]=_0x114d08[_0x2b6c('0x6e')]({'plain':!![]});return db[_0x2b6c('0x6f')][_0x2b6c('0x4c')]({'where':{'id':_0x114d08['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4cec90,null))[_0x2b6c('0x23')](function(_0xfc4da3){if(_0xfc4da3){return _0xfc4da3[_0x2b6c('0x22')]({'UserId':_0x1c22d3[_0x2b6c('0x4b')]['UserId'],'read1stAt':_[_0x2b6c('0x70')](_0xfc4da3[_0x2b6c('0x71')])?moment()[_0x2b6c('0x65')](_0x2b6c('0x6a')):undefined});}return null;})['then'](function(_0x243979){if(_0x243979){_0x514cd6[_0x2b6c('0x72')]=_0x243979[_0x2b6c('0x6e')]({'plain':!![]});interaction_log[_0x2b6c('0x14')](_0x2b6c('0x73'),_0x1c22d3[_0x2b6c('0x6c')]['id'],_0x1c22d3[_0x2b6c('0x6c')][_0x2b6c('0x28')],_0x1c22d3['user'][_0x2b6c('0x74')],_0x514cd6[_0x2b6c('0x72')]['id'],_0x1c22d3[_0x2b6c('0x4b')]?JSON[_0x2b6c('0x18')](_0x1c22d3[_0x2b6c('0x4b')]):_0x2b6c('0x75'));return respondWithRpcPromise(_0x2b6c('0x76'),'acceptMessage',_0x514cd6);}return null;})[_0x2b6c('0x23')](function(_0x20567b){var _0x4490ad=_0x2b6c('0x77')+_0x20567b[_0x2b6c('0x1b')][_0x2b6c('0x78')];return db[_0x2b6c('0x79')]['query'](_0x4490ad,{'type':db['Sequelize'][_0x2b6c('0x7a')][_0x2b6c('0x7b')],'raw':!![]})[_0x2b6c('0x23')](function(_0x2002ca){return _0x2002ca;});})[_0x2b6c('0x23')](function(_0x59cf7a){if(_0x59cf7a){_0x514cd6[_0x2b6c('0x1b')][_0x2b6c('0x7c')]=_0x59cf7a[0x0];if(!_0x1c22d3[_0x2b6c('0x4b')][_0x2b6c('0x6b')])return;return db[_0x2b6c('0x7d')][_0x2b6c('0x4c')]({'where':{'id':_0x1c22d3[_0x2b6c('0x4b')]['UserId'],'role':_0x2b6c('0x6d')},'attributes':['id',_0x2b6c('0x28'),'fullname',_0x2b6c('0x7e'),_0x2b6c('0x7f')],'raw':!![]});}return null;})[_0x2b6c('0x23')](function(_0x212725){if(!_0x212725)return null;_0x514cd6[_0x2b6c('0x1b')][_0x2b6c('0x6d')]=_0x212725;return _0x514cd6;})[_0x2b6c('0x23')](function(_0x30d908){if(_0x30d908){if(_0x1c22d3[_0x2b6c('0x4b')][_0x2b6c('0x80')]){_0x514cd6[_0x2b6c('0x1b')][_0x2b6c('0x81')]=util[_0x2b6c('0x65')](_0x2b6c('0x82'),_0x1c22d3[_0x2b6c('0x6c')][_0x2b6c('0x28')]);_0x514cd6[_0x2b6c('0x1b')][_0x2b6c('0x83')]=_0x514cd6[_0x2b6c('0x83')];_0x514cd6[_0x2b6c('0x1b')][_0x2b6c('0x84')]=_0x514cd6['channel'];_0x514cd6[_0x2b6c('0x1b')][_0x2b6c('0x85')]=_0x2b6c('0x66');_0x514cd6[_0x2b6c('0x1b')]['body']=htmlToText['fromString'](_0x514cd6[_0x2b6c('0x1b')]['body']);return respondWithRpcPromise(_0x2b6c('0x86'),_0x2b6c('0x86'),{'event':_0x2b6c('0x87'),'message':_0x514cd6[_0x2b6c('0x1b')]},client9002)[_0x2b6c('0x23')](function(){return _0x514cd6;});}return _0x514cd6;}return null;})[_0x2b6c('0x23')](respondWithResult(_0x4cec90,null))['catch'](handleError(_0x4cec90,null));};exports[_0x2b6c('0x88')]=function(_0xa2ddea,_0x30ddeb){var _0x403513={'agent':{},'channel':'mail'};if(_0xa2ddea[_0x2b6c('0x4b')]['id']){delete _0xa2ddea['body']['id'];}_0xa2ddea['body'][_0x2b6c('0x6b')]=_0xa2ddea['body'][_0x2b6c('0x6b')]||_0xa2ddea['user']['id'];_0x403513[_0x2b6c('0x6d')]['id']=_0xa2ddea[_0x2b6c('0x4b')][_0x2b6c('0x6b')];return db['MailMessage'][_0x2b6c('0x4c')]({'where':{'id':_0xa2ddea[_0x2b6c('0x48')]['id'],'UserId':null}})[_0x2b6c('0x23')](handleEntityNotFound(_0x30ddeb,null))[_0x2b6c('0x23')](function(_0xdf5d5d){if(_0xdf5d5d){_0x403513[_0x2b6c('0x1b')]=_0xdf5d5d['get']({'plain':!![]});return db['MailInteraction'][_0x2b6c('0x4c')]({'where':{'id':_0xdf5d5d[_0x2b6c('0x89')]}});}return null;})[_0x2b6c('0x23')](handleEntityNotFound(_0x30ddeb,null))[_0x2b6c('0x23')](function(_0x29ca37){if(_0x29ca37){_0x403513[_0x2b6c('0x72')]=_0x29ca37[_0x2b6c('0x6e')]({'plain':!![]});interaction_log[_0x2b6c('0x14')](_0x2b6c('0x8a'),_0xa2ddea['user']['id'],_0xa2ddea[_0x2b6c('0x6c')][_0x2b6c('0x28')],_0xa2ddea[_0x2b6c('0x6c')]['role'],_0x403513[_0x2b6c('0x72')]['id'],_0xa2ddea['body']?JSON[_0x2b6c('0x18')](_0xa2ddea['body']):_0x2b6c('0x75'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0x403513);}return null;})[_0x2b6c('0x23')](function(_0x5ce6ed){var _0x44b229=_0x2b6c('0x77')+_0x5ce6ed[_0x2b6c('0x1b')][_0x2b6c('0x78')];return db[_0x2b6c('0x79')][_0x2b6c('0x30')](_0x44b229,{'type':db[_0x2b6c('0x8b')][_0x2b6c('0x7a')][_0x2b6c('0x7b')],'raw':!![]})[_0x2b6c('0x23')](function(_0x1368d7){return _0x1368d7;});})[_0x2b6c('0x23')](function(_0x1c6f45){if(_0x1c6f45){_0x403513[_0x2b6c('0x1b')][_0x2b6c('0x7c')]=_0x1c6f45[0x0];if(!_0xa2ddea[_0x2b6c('0x4b')][_0x2b6c('0x6b')])return;return db[_0x2b6c('0x7d')][_0x2b6c('0x4c')]({'where':{'id':_0xa2ddea[_0x2b6c('0x4b')][_0x2b6c('0x6b')],'role':_0x2b6c('0x6d')},'attributes':['id',_0x2b6c('0x28'),'fullname',_0x2b6c('0x7e'),_0x2b6c('0x7f')],'raw':!![]});}return null;})[_0x2b6c('0x23')](function(_0x18f052){if(!_0x18f052)return null;_0x403513[_0x2b6c('0x1b')][_0x2b6c('0x6d')]=_0x18f052;return _0x403513;})[_0x2b6c('0x23')](function(_0x302193){if(_0x302193){_0x302193[_0x2b6c('0x1b')][_0x2b6c('0x81')]=util[_0x2b6c('0x65')](_0x2b6c('0x82'),_0xa2ddea[_0x2b6c('0x6c')][_0x2b6c('0x28')]);_0x302193[_0x2b6c('0x1b')][_0x2b6c('0x83')]=_0x403513[_0x2b6c('0x83')];_0x302193[_0x2b6c('0x1b')][_0x2b6c('0x84')]=_0x403513[_0x2b6c('0x83')];_0x302193[_0x2b6c('0x1b')][_0x2b6c('0x85')]=_0x2b6c('0x88');_0x302193[_0x2b6c('0x1b')][_0x2b6c('0x4b')]=htmlToText[_0x2b6c('0x8c')](_0x403513[_0x2b6c('0x1b')][_0x2b6c('0x4b')]);respondWithRpcPromise(_0x2b6c('0x86'),'EventManager',{'event':_0x2b6c('0x8d'),'message':_0x302193[_0x2b6c('0x1b')]},client9002);return _0x403513;}return null;})['then'](respondWithResult(_0x30ddeb,null))['catch'](handleError(_0x30ddeb,null));};exports['download']=function(_0x86f789,_0x1eacc4){var _0x3c9b9c=moment()[_0x2b6c('0x8e')]()['toString']();var _0x432446=path[_0x2b6c('0x5e')](config[_0x2b6c('0x5f')],'server','files',_0x2b6c('0x8f'));var _0x5c8606=path[_0x2b6c('0x5e')](config[_0x2b6c('0x5f')],'server','files','attachments');var _0xcdc869=util[_0x2b6c('0x65')]('message-%s.eml',_0x3c9b9c);return db[_0x2b6c('0x41')]['find']({'where':{'id':_0x86f789['params']['id']},'attributes':['id',_0x2b6c('0x4b'),_0x2b6c('0x90'),'to','cc',_0x2b6c('0x91'),_0x2b6c('0x92'),_0x2b6c('0x93')],'include':_0x86f789[_0x2b6c('0x30')]['attachments']?[{'model':db[_0x2b6c('0x94')],'as':_0x2b6c('0x95')}]:undefined})[_0x2b6c('0x23')](handleEntityNotFound(_0x1eacc4,null))[_0x2b6c('0x23')](function(_0x40eb73){if(_0x40eb73){var _0xe7a7a2=_0x40eb73;var _0x5c8693={'from':_0xe7a7a2[_0x2b6c('0x90')],'to':_0xe7a7a2['to'],'subject':_0xe7a7a2[_0x2b6c('0x92')],'html':htmlEntities['decode'](_0xe7a7a2['body']),'headers':{'Date':moment(_0xe7a7a2[_0x2b6c('0x93')])[_0x2b6c('0x65')](_0x2b6c('0x96'))},'attachments':[]};if(_0x40eb73['cc']){_0x5c8693[_0x2b6c('0x97')]['Cc']=_0x40eb73['cc'];}if(_0x40eb73[_0x2b6c('0x91')]){_0x5c8693[_0x2b6c('0x97')][_0x2b6c('0x98')]=_0x40eb73[_0x2b6c('0x91')];}return new BPromise(function(_0x463590,_0x148b82){if(_0x40eb73[_0x2b6c('0x95')]){for(var _0xfddd2c=0x0;_0xfddd2c<_0x40eb73[_0x2b6c('0x95')]['length'];_0xfddd2c++){var _0x50d68f=_0x40eb73[_0x2b6c('0x95')][_0xfddd2c];var _0x13e130=path[_0x2b6c('0x5e')](_0x5c8606,_0x50d68f[_0x2b6c('0x61')]);if(fs['existsSync'](_0x13e130)){_0x5c8693[_0x2b6c('0x5d')][_0x2b6c('0x99')]({'name':_0x50d68f[_0x2b6c('0x28')],'contentType':_0x50d68f[_0x2b6c('0x2d')],'data':fs[_0x2b6c('0x9a')](_0x13e130)});}}}emlformat[_0x2b6c('0x9b')](_0x5c8693,function(_0x2b5294,_0x1d6026){if(_0x2b5294)return _0x148b82(_0x2b5294);fs[_0x2b6c('0x9c')](path['join'](_0x432446,_0xcdc869),_0x1d6026);return _0x463590(_0x1d6026);});});}})['then'](function(_0x38a638){if(_0x38a638){return _0x1eacc4['download'](path[_0x2b6c('0x5e')](_0x432446,_0xcdc869),_0xcdc869,function(_0x37e415){if(!_0x37e415)fs[_0x2b6c('0x9d')](path['join'](_0x432446,_0xcdc869));});}})[_0x2b6c('0x4a')](handleError(_0x1eacc4,null));};
\ No newline at end of file
+var _0xdcd7=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','update','body','destroy','describe','direction','secret','split','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','List','create','List\x20not\x20found','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','UserId','user','get','MailInteraction','MailInteractionId','isNil','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','SELECT','contact','User','agent','fullname','email','manual','interface','SIP/%s','channel','event','accept','fromString','EventManager','reject','mail','RejectMessage','QueryTypes','internal','motionChannel','download','unix','toString','server','files','message-%s.eml','bcc','subject','Attachments','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','type','build','writeFileSync','eml-format','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','json','offset','limit','undefined','count','status','Content-Range','end','sendStatus','name','send','index','MailMessage','rawAttributes','fieldName','model','map','keys','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters'];(function(_0x4d1f7f,_0x3c69e2){var _0xa7967b=function(_0x31c9f5){while(--_0x31c9f5){_0x4d1f7f['push'](_0x4d1f7f['shift']());}};_0xa7967b(++_0x3c69e2);}(_0xdcd7,0xf3));var _0x7dcd=function(_0xb368e7,_0x9f553){_0xb368e7=_0xb368e7-0x0;var _0x43e0cd=_0xdcd7[_0xb368e7];return _0x43e0cd;};'use strict';var emlformat=require(_0x7dcd('0x0'));var moment=require('moment');var BPromise=require(_0x7dcd('0x1'));var util=require(_0x7dcd('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x7dcd('0x3'));var Redis=require(_0x7dcd('0x4'));var htmlToText=require(_0x7dcd('0x5'));var qs=require(_0x7dcd('0x6'));var logger=require('../../config/logger')(_0x7dcd('0x7'));var interaction_log=require(_0x7dcd('0x8'))('mail-interactions');var config=require(_0x7dcd('0x9'));var db=require(_0x7dcd('0xa'))['db'];config[_0x7dcd('0xb')]=_[_0x7dcd('0xc')](config[_0x7dcd('0xb')],{'host':_0x7dcd('0xd'),'port':0x18eb});var socket=require(_0x7dcd('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x7dcd('0xf'));require(_0x7dcd('0x10'))[_0x7dcd('0x11')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7dcd('0x12')][_0x7dcd('0x13')]({'port':0x232c});var client9003=jayson[_0x7dcd('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x7dcd('0x12')][_0x7dcd('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x14ba85,_0x23ff3a,_0x2d36f8,_0x22bed1){return new BPromise(function(_0x28ee7c,_0xa20895){var _0x1f1df1=_0x22bed1||client;return _0x1f1df1['request'](_0x14ba85,_0x2d36f8)[_0x7dcd('0x14')](function(_0x1d28c1){logger[_0x7dcd('0x15')](_0x7dcd('0x16'),_0x23ff3a,_0x7dcd('0x17'));logger[_0x7dcd('0x18')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x23ff3a,'request\x20sent',JSON[_0x7dcd('0x19')](_0x1d28c1));if(_0x1d28c1['error']){if(_0x1d28c1['error'][_0x7dcd('0x1a')]===0x1f4){logger[_0x7dcd('0x1b')](_0x7dcd('0x16'),_0x23ff3a,_0x1d28c1[_0x7dcd('0x1b')]['message']);return _0xa20895(_0x1d28c1[_0x7dcd('0x1b')][_0x7dcd('0x1c')]);}logger['error'](_0x7dcd('0x16'),_0x23ff3a,_0x1d28c1[_0x7dcd('0x1b')][_0x7dcd('0x1c')]);return _0x28ee7c(_0x1d28c1[_0x7dcd('0x1b')][_0x7dcd('0x1c')]);}else{logger['info'](_0x7dcd('0x16'),_0x23ff3a,'request\x20sent');_0x28ee7c(_0x1d28c1[_0x7dcd('0x1d')][_0x7dcd('0x1c')]);}})[_0x7dcd('0x1e')](function(_0x52f10e){logger[_0x7dcd('0x1b')](_0x7dcd('0x16'),_0x23ff3a,_0x52f10e);_0xa20895(_0x52f10e);});});}function respondWithResult(_0x12f10c,_0x2aae4d){_0x2aae4d=_0x2aae4d||0xc8;return function(_0x19e091){if(_0x19e091){return _0x12f10c['status'](_0x2aae4d)[_0x7dcd('0x1f')](_0x19e091);}};}function respondWithFilteredResult(_0x34b64d,_0x5393a7){return function(_0x40fc52){if(_0x40fc52){var _0x110293=typeof _0x5393a7[_0x7dcd('0x20')]==='undefined'&&typeof _0x5393a7[_0x7dcd('0x21')]===_0x7dcd('0x22');var _0x2d9a79=_0x40fc52[_0x7dcd('0x23')];var _0x224c63=_0x110293?0x0:_0x5393a7['offset'];var _0x27eb66=_0x110293?_0x40fc52['count']:_0x5393a7[_0x7dcd('0x20')]+_0x5393a7[_0x7dcd('0x21')];var _0x7c1067;if(_0x27eb66>=_0x2d9a79){_0x27eb66=_0x2d9a79;_0x7c1067=0xc8;}else{_0x7c1067=0xce;}_0x34b64d[_0x7dcd('0x24')](_0x7c1067);return _0x34b64d['set'](_0x7dcd('0x25'),_0x224c63+'-'+_0x27eb66+'/'+_0x2d9a79)['json'](_0x40fc52);}return null;};}function saveUpdates(_0x59a98a){return function(_0xda738a){if(_0xda738a){return _0xda738a['update'](_0x59a98a)[_0x7dcd('0x14')](function(_0x4fbfeb){return _0x4fbfeb;});}return null;};}function removeEntity(_0x2033a9){return function(_0x2a4e50){if(_0x2a4e50){return _0x2a4e50['destroy']()[_0x7dcd('0x14')](function(){_0x2033a9['status'](0xcc)[_0x7dcd('0x26')]();});}};}function handleEntityNotFound(_0x1393cb){return function(_0xa1046a){if(!_0xa1046a){_0x1393cb[_0x7dcd('0x27')](0x194);}return _0xa1046a;};}function handleError(_0x41f5d3,_0x569b93){_0x569b93=_0x569b93||0x1f4;return function(_0x505db8){logger[_0x7dcd('0x1b')](_0x505db8['stack']);if(_0x505db8[_0x7dcd('0x28')]){delete _0x505db8[_0x7dcd('0x28')];}_0x41f5d3[_0x7dcd('0x24')](_0x569b93)[_0x7dcd('0x29')](_0x505db8);};}exports[_0x7dcd('0x2a')]=function(_0x23a078,_0x26fd97){var _0x1afea8={},_0x51fb38={},_0x29c629={'count':0x0,'rows':[]};var _0x2c0ec7=_['map'](db[_0x7dcd('0x2b')][_0x7dcd('0x2c')],function(_0x51cfa7){return{'name':_0x51cfa7[_0x7dcd('0x2d')],'type':_0x51cfa7['type']['key']};});_0x51fb38[_0x7dcd('0x2e')]=_[_0x7dcd('0x2f')](_0x2c0ec7,'name');_0x51fb38['query']=_[_0x7dcd('0x30')](_0x23a078[_0x7dcd('0x31')]);_0x51fb38['filters']=_['intersection'](_0x51fb38[_0x7dcd('0x2e')],_0x51fb38[_0x7dcd('0x31')]);_0x1afea8['attributes']=_[_0x7dcd('0x32')](_0x51fb38['model'],qs[_0x7dcd('0x33')](_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x33')]));_0x1afea8[_0x7dcd('0x34')]=_0x1afea8[_0x7dcd('0x34')][_0x7dcd('0x35')]?_0x1afea8['attributes']:_0x51fb38[_0x7dcd('0x2e')];if(!_0x23a078['query']['hasOwnProperty'](_0x7dcd('0x36'))){_0x1afea8['limit']=qs[_0x7dcd('0x21')](_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x21')]);_0x1afea8[_0x7dcd('0x20')]=qs[_0x7dcd('0x20')](_0x23a078[_0x7dcd('0x31')]['offset']);}_0x1afea8[_0x7dcd('0x37')]=qs['sort'](_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x38')]);_0x1afea8[_0x7dcd('0x39')]=qs[_0x7dcd('0x3a')](_[_0x7dcd('0x3b')](_0x23a078[_0x7dcd('0x31')],_0x51fb38['filters']),_0x2c0ec7);if(_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x3c')]){_0x1afea8[_0x7dcd('0x39')]=_[_0x7dcd('0x3d')](_0x1afea8['where'],{'$or':_[_0x7dcd('0x2f')](_0x2c0ec7,function(_0x1d61c5){if(_0x1d61c5['type']!==_0x7dcd('0x3e')){var _0x579fa5={};_0x579fa5[_0x1d61c5[_0x7dcd('0x28')]]={'$like':'%'+_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x3c')]+'%'};return _0x579fa5;}})});}_0x1afea8=_[_0x7dcd('0x3d')]({},_0x1afea8,_0x23a078[_0x7dcd('0x3f')]);var _0x1ac8ca={'where':_0x1afea8[_0x7dcd('0x39')]};return db[_0x7dcd('0x2b')][_0x7dcd('0x23')](_0x1ac8ca)[_0x7dcd('0x14')](function(_0x1450fd){_0x29c629[_0x7dcd('0x23')]=_0x1450fd;if(_0x23a078[_0x7dcd('0x31')][_0x7dcd('0x40')]){_0x1afea8[_0x7dcd('0x41')]=[{'all':!![]}];}return db['MailMessage'][_0x7dcd('0x42')](_0x1afea8);})['then'](function(_0x6d28fa){_0x29c629[_0x7dcd('0x43')]=_0x6d28fa;return _0x29c629;})[_0x7dcd('0x14')](respondWithFilteredResult(_0x26fd97,_0x1afea8))[_0x7dcd('0x1e')](handleError(_0x26fd97,null));};exports['show']=function(_0x3d0440,_0x296874){var _0x2dc417={'raw':!![],'where':{'id':_0x3d0440[_0x7dcd('0x44')]['id']}},_0x3b2bd9={};_0x3b2bd9['model']=_['keys'](db['MailMessage'][_0x7dcd('0x2c')]);_0x3b2bd9[_0x7dcd('0x31')]=_[_0x7dcd('0x30')](_0x3d0440[_0x7dcd('0x31')]);_0x3b2bd9[_0x7dcd('0x3a')]=_[_0x7dcd('0x32')](_0x3b2bd9[_0x7dcd('0x2e')],_0x3b2bd9['query']);_0x2dc417[_0x7dcd('0x34')]=_['intersection'](_0x3b2bd9[_0x7dcd('0x2e')],qs[_0x7dcd('0x33')](_0x3d0440[_0x7dcd('0x31')][_0x7dcd('0x33')]));_0x2dc417[_0x7dcd('0x34')]=_0x2dc417[_0x7dcd('0x34')][_0x7dcd('0x35')]?_0x2dc417[_0x7dcd('0x34')]:_0x3b2bd9['model'];if(_0x3d0440[_0x7dcd('0x31')][_0x7dcd('0x40')]){_0x2dc417[_0x7dcd('0x41')]=[{'all':!![]}];}_0x2dc417=_[_0x7dcd('0x3d')]({},_0x2dc417,_0x3d0440[_0x7dcd('0x3f')]);return db[_0x7dcd('0x2b')][_0x7dcd('0x45')](_0x2dc417)[_0x7dcd('0x14')](handleEntityNotFound(_0x296874,null))[_0x7dcd('0x14')](respondWithResult(_0x296874,null))[_0x7dcd('0x1e')](handleError(_0x296874,null));};exports[_0x7dcd('0x46')]=function(_0x44b21a,_0x36a30f){if(_0x44b21a['body']['id']){delete _0x44b21a[_0x7dcd('0x47')]['id'];}return db['MailMessage'][_0x7dcd('0x45')]({'where':{'id':_0x44b21a['params']['id']}})[_0x7dcd('0x14')](handleEntityNotFound(_0x36a30f,null))[_0x7dcd('0x14')](saveUpdates(_0x44b21a[_0x7dcd('0x47')],null))[_0x7dcd('0x14')](respondWithResult(_0x36a30f,null))[_0x7dcd('0x1e')](handleError(_0x36a30f,null));};exports[_0x7dcd('0x48')]=function(_0x5adc4e,_0x5bcb1b){return db[_0x7dcd('0x2b')][_0x7dcd('0x45')]({'where':{'id':_0x5adc4e[_0x7dcd('0x44')]['id']}})[_0x7dcd('0x14')](handleEntityNotFound(_0x5bcb1b,null))[_0x7dcd('0x14')](removeEntity(_0x5bcb1b,null))[_0x7dcd('0x1e')](handleError(_0x5bcb1b,null));};exports[_0x7dcd('0x49')]=function(_0x4c53a1,_0x57ec9b){return db[_0x7dcd('0x2b')][_0x7dcd('0x49')]()['then'](respondWithResult(_0x57ec9b,null))['catch'](handleError(_0x57ec9b,null));};exports['create']=function(_0x1f3570,_0x4c4455){return db['MailMessage']['create'](_0x1f3570['body'])[_0x7dcd('0x14')](function(_0x2e6020){if(_0x2e6020){if(_0x2e6020[_0x7dcd('0x4a')]==='out'&&!_0x2e6020[_0x7dcd('0x4b')]){var _0x3a1a57,_0x1cdd73,_0x1c2d09;if(_0x1f3570[_0x7dcd('0x47')]['to']){_0x1cdd73=_0x1f3570[_0x7dcd('0x47')]['to'][_0x7dcd('0x4c')](',')[0x0];}return db['MailAccount'][_0x7dcd('0x4d')]({'where':{'id':_0x2e6020[_0x7dcd('0x4e')]},'include':[{'model':db[_0x7dcd('0x4f')],'as':'List','include':[{'model':db[_0x7dcd('0x50')],'as':_0x7dcd('0x51'),'where':{'email':_0x1cdd73},'limit':0x1,'order':[[_0x7dcd('0x52'),_0x7dcd('0x53')]]}]},{'model':db[_0x7dcd('0x54')],'as':_0x7dcd('0x55'),'raw':!![],'include':[{'model':db[_0x7dcd('0x56')],'as':_0x7dcd('0x56'),'raw':!![]}]}]})[_0x7dcd('0x14')](function(_0xf7e596){_0x3a1a57=_0xf7e596;if(!_0x3a1a57||!_0x3a1a57[_0x7dcd('0x55')])return;var _0x493907=_0x3a1a57[_0x7dcd('0x57')]();if(_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')]&&_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')][_0x7dcd('0x35')]){for(var _0x33f2f6=0x0;_0x33f2f6<_0x1f3570['body'][_0x7dcd('0x58')][_0x7dcd('0x35')];_0x33f2f6+=0x1){_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')][_0x33f2f6]={'filename':_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')][_0x33f2f6]['name'],'path':path[_0x7dcd('0x59')](config[_0x7dcd('0x5a')],_0x7dcd('0x5b'),_0x1f3570[_0x7dcd('0x47')][_0x7dcd('0x58')][_0x33f2f6][_0x7dcd('0x5c')])};}}_0x1c2d09={'account':_0x493907,'message':_0x1f3570[_0x7dcd('0x47')]};return;})['then'](function(){if(_0x3a1a57['List']){if(_0x3a1a57[_0x7dcd('0x5d')][_0x7dcd('0x51')][_0x7dcd('0x35')]){return _0x3a1a57[_0x7dcd('0x5d')][_0x7dcd('0x51')][0x0];}else{return db['CmContact'][_0x7dcd('0x5e')](_[_0x7dcd('0xc')](_0x1f3570[_0x7dcd('0x47')],{'firstName':_0x1f3570[_0x7dcd('0x47')]['to'],'email':_0x1f3570[_0x7dcd('0x47')]['to'],'phone':_0x1f3570[_0x7dcd('0x47')]['to'],'ListId':_0x3a1a57['ListId']}));}}else{throw new Error(_0x7dcd('0x5f'));}})[_0x7dcd('0x14')](function(){if(_0x1c2d09){return respondWithRpcPromise('SendMail',_0x7dcd('0x60'),_0x1c2d09,client9003)['then'](function(_0x2fcad1){return _0x2e6020[_0x7dcd('0x46')]({'read':!![],'messageId':_0x2fcad1[_0x7dcd('0x61')],'sentAt':moment()[_0x7dcd('0x62')](_0x7dcd('0x63'))});})[_0x7dcd('0x1e')](function(_0x59bac0){logger['error']('%s',JSON[_0x7dcd('0x19')](_0x59bac0));return _0x2e6020;});}return _0x2e6020;});}return _0x2e6020;}})[_0x7dcd('0x14')](respondWithResult(_0x4c4455,0xc9))[_0x7dcd('0x1e')](handleError(_0x4c4455,null));};exports['accept']=function(_0x3dee93,_0x1aed63){var _0x1f2a20={'agent':{},'channel':'mail'};if(_0x3dee93[_0x7dcd('0x47')]['id']){delete _0x3dee93['body']['id'];}_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x64')]=!![];_0x3dee93['body']['readAt']=moment()[_0x7dcd('0x62')](_0x7dcd('0x63'));_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x65')]=_0x3dee93['body'][_0x7dcd('0x65')]||_0x3dee93[_0x7dcd('0x66')]['id'];_0x1f2a20['agent']['id']=_0x3dee93[_0x7dcd('0x47')]['UserId'];return db[_0x7dcd('0x2b')]['find']({'where':{'id':_0x3dee93[_0x7dcd('0x44')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1aed63,null))['then'](saveUpdates(_0x3dee93[_0x7dcd('0x47')],null))['then'](function(_0x441825){if(_0x441825){_0x1f2a20[_0x7dcd('0x1c')]=_0x441825[_0x7dcd('0x67')]({'plain':!![]});return db[_0x7dcd('0x68')][_0x7dcd('0x45')]({'where':{'id':_0x441825[_0x7dcd('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x1aed63,null))['then'](function(_0x414b32){if(_0x414b32){return _0x414b32[_0x7dcd('0x46')]({'UserId':_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x65')],'read1stAt':_[_0x7dcd('0x6a')](_0x414b32['read1stAt'])?moment()[_0x7dcd('0x62')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x40f4a9){if(_0x40f4a9){_0x1f2a20['interaction']=_0x40f4a9[_0x7dcd('0x67')]({'plain':!![]});interaction_log[_0x7dcd('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3dee93[_0x7dcd('0x66')]['id'],_0x3dee93['user']['name'],_0x3dee93[_0x7dcd('0x66')][_0x7dcd('0x6b')],_0x1f2a20[_0x7dcd('0x6c')]['id'],_0x3dee93[_0x7dcd('0x47')]?JSON[_0x7dcd('0x19')](_0x3dee93[_0x7dcd('0x47')]):_0x7dcd('0x6d'));return respondWithRpcPromise(_0x7dcd('0x6e'),_0x7dcd('0x6f'),_0x1f2a20);}return null;})[_0x7dcd('0x14')](function(_0x109ee8){var _0x89c196=_0x7dcd('0x70')+_0x109ee8[_0x7dcd('0x1c')][_0x7dcd('0x71')];return db['sequelize'][_0x7dcd('0x31')](_0x89c196,{'type':db[_0x7dcd('0x72')]['QueryTypes'][_0x7dcd('0x73')],'raw':!![]})[_0x7dcd('0x14')](function(_0x355c9d){return _0x355c9d;});})[_0x7dcd('0x14')](function(_0x535390){if(_0x535390){_0x1f2a20['message'][_0x7dcd('0x74')]=_0x535390[0x0];if(!_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x65')])return;return db[_0x7dcd('0x75')]['find']({'where':{'id':_0x3dee93['body'][_0x7dcd('0x65')],'role':_0x7dcd('0x76')},'attributes':['id',_0x7dcd('0x28'),_0x7dcd('0x77'),_0x7dcd('0x78'),'internal'],'raw':!![]});}return null;})[_0x7dcd('0x14')](function(_0x107367){if(!_0x107367)return null;_0x1f2a20[_0x7dcd('0x1c')][_0x7dcd('0x76')]=_0x107367;return _0x1f2a20;})['then'](function(_0x5a30f6){if(_0x5a30f6){if(_0x3dee93[_0x7dcd('0x47')][_0x7dcd('0x79')]){_0x1f2a20[_0x7dcd('0x1c')][_0x7dcd('0x7a')]=util[_0x7dcd('0x62')](_0x7dcd('0x7b'),_0x3dee93[_0x7dcd('0x66')][_0x7dcd('0x28')]);_0x1f2a20['message'][_0x7dcd('0x7c')]=_0x1f2a20[_0x7dcd('0x7c')];_0x1f2a20[_0x7dcd('0x1c')]['motionChannel']=_0x1f2a20[_0x7dcd('0x7c')];_0x1f2a20[_0x7dcd('0x1c')][_0x7dcd('0x7d')]=_0x7dcd('0x7e');_0x1f2a20[_0x7dcd('0x1c')][_0x7dcd('0x47')]=htmlToText[_0x7dcd('0x7f')](_0x1f2a20[_0x7dcd('0x1c')]['body']);return respondWithRpcPromise(_0x7dcd('0x80'),_0x7dcd('0x80'),{'event':'acceptmessage','message':_0x1f2a20[_0x7dcd('0x1c')]},client9002)[_0x7dcd('0x14')](function(){return _0x1f2a20;});}return _0x1f2a20;}return null;})[_0x7dcd('0x14')](respondWithResult(_0x1aed63,null))['catch'](handleError(_0x1aed63,null));};exports[_0x7dcd('0x81')]=function(_0x13d4ba,_0x42ac63){var _0x395e84={'agent':{},'channel':_0x7dcd('0x82')};if(_0x13d4ba[_0x7dcd('0x47')]['id']){delete _0x13d4ba[_0x7dcd('0x47')]['id'];}_0x13d4ba[_0x7dcd('0x47')][_0x7dcd('0x65')]=_0x13d4ba['body'][_0x7dcd('0x65')]||_0x13d4ba[_0x7dcd('0x66')]['id'];_0x395e84[_0x7dcd('0x76')]['id']=_0x13d4ba['body'][_0x7dcd('0x65')];return db['MailMessage'][_0x7dcd('0x45')]({'where':{'id':_0x13d4ba[_0x7dcd('0x44')]['id'],'UserId':null}})[_0x7dcd('0x14')](handleEntityNotFound(_0x42ac63,null))[_0x7dcd('0x14')](function(_0x4a6620){if(_0x4a6620){_0x395e84[_0x7dcd('0x1c')]=_0x4a6620[_0x7dcd('0x67')]({'plain':!![]});return db[_0x7dcd('0x68')]['find']({'where':{'id':_0x4a6620[_0x7dcd('0x69')]}});}return null;})[_0x7dcd('0x14')](handleEntityNotFound(_0x42ac63,null))[_0x7dcd('0x14')](function(_0x136cd2){if(_0x136cd2){_0x395e84[_0x7dcd('0x6c')]=_0x136cd2[_0x7dcd('0x67')]({'plain':!![]});interaction_log[_0x7dcd('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13d4ba[_0x7dcd('0x66')]['id'],_0x13d4ba[_0x7dcd('0x66')][_0x7dcd('0x28')],_0x13d4ba[_0x7dcd('0x66')][_0x7dcd('0x6b')],_0x395e84[_0x7dcd('0x6c')]['id'],_0x13d4ba[_0x7dcd('0x47')]?JSON[_0x7dcd('0x19')](_0x13d4ba[_0x7dcd('0x47')]):_0x7dcd('0x6d'));return respondWithRpcPromise(_0x7dcd('0x83'),'rejectMessage',_0x395e84);}return null;})[_0x7dcd('0x14')](function(_0x4d7076){var _0x56c2c0=_0x7dcd('0x70')+_0x4d7076['message'][_0x7dcd('0x71')];return db['sequelize']['query'](_0x56c2c0,{'type':db['Sequelize'][_0x7dcd('0x84')][_0x7dcd('0x73')],'raw':!![]})['then'](function(_0xc9bdbe){return _0xc9bdbe;});})[_0x7dcd('0x14')](function(_0x13f9da){if(_0x13f9da){_0x395e84[_0x7dcd('0x1c')][_0x7dcd('0x74')]=_0x13f9da[0x0];if(!_0x13d4ba['body'][_0x7dcd('0x65')])return;return db[_0x7dcd('0x75')][_0x7dcd('0x45')]({'where':{'id':_0x13d4ba[_0x7dcd('0x47')]['UserId'],'role':_0x7dcd('0x76')},'attributes':['id',_0x7dcd('0x28'),_0x7dcd('0x77'),_0x7dcd('0x78'),_0x7dcd('0x85')],'raw':!![]});}return null;})[_0x7dcd('0x14')](function(_0x183868){if(!_0x183868)return null;_0x395e84[_0x7dcd('0x1c')][_0x7dcd('0x76')]=_0x183868;return _0x395e84;})[_0x7dcd('0x14')](function(_0x32d49e){if(_0x32d49e){_0x32d49e['message'][_0x7dcd('0x7a')]=util[_0x7dcd('0x62')]('SIP/%s',_0x13d4ba['user'][_0x7dcd('0x28')]);_0x32d49e['message'][_0x7dcd('0x7c')]=_0x395e84[_0x7dcd('0x7c')];_0x32d49e[_0x7dcd('0x1c')][_0x7dcd('0x86')]=_0x395e84[_0x7dcd('0x7c')];_0x32d49e['message'][_0x7dcd('0x7d')]='reject';_0x32d49e[_0x7dcd('0x1c')][_0x7dcd('0x47')]=htmlToText['fromString'](_0x395e84['message']['body']);respondWithRpcPromise('EventManager',_0x7dcd('0x80'),{'event':'rejectmessage','message':_0x32d49e['message']},client9002);return _0x395e84;}return null;})[_0x7dcd('0x14')](respondWithResult(_0x42ac63,null))[_0x7dcd('0x1e')](handleError(_0x42ac63,null));};exports[_0x7dcd('0x87')]=function(_0xcb848c,_0x2b2060){var _0x183b50=moment()[_0x7dcd('0x88')]()[_0x7dcd('0x89')]();var _0x914362=path['join'](config[_0x7dcd('0x5a')],_0x7dcd('0x8a'),_0x7dcd('0x8b'),'tmp');var _0x3ef253=path[_0x7dcd('0x59')](config[_0x7dcd('0x5a')],'server',_0x7dcd('0x8b'),_0x7dcd('0x58'));var _0x58c515=util[_0x7dcd('0x62')](_0x7dcd('0x8c'),_0x183b50);return db[_0x7dcd('0x2b')][_0x7dcd('0x45')]({'where':{'id':_0xcb848c[_0x7dcd('0x44')]['id']},'attributes':['id',_0x7dcd('0x47'),'from','to','cc',_0x7dcd('0x8d'),_0x7dcd('0x8e'),'createdAt'],'include':_0xcb848c[_0x7dcd('0x31')][_0x7dcd('0x58')]?[{'model':db['Attachment'],'as':_0x7dcd('0x8f')}]:undefined})[_0x7dcd('0x14')](handleEntityNotFound(_0x2b2060,null))[_0x7dcd('0x14')](function(_0x2e94f9){if(_0x2e94f9){var _0x299f7a=_0x2e94f9;var _0x41789c={'from':_0x299f7a['from'],'to':_0x299f7a['to'],'subject':_0x299f7a[_0x7dcd('0x8e')],'html':htmlEntities[_0x7dcd('0x90')](_0x299f7a['body']),'headers':{'Date':moment(_0x299f7a[_0x7dcd('0x91')])[_0x7dcd('0x62')](_0x7dcd('0x92'))},'attachments':[]};if(_0x2e94f9['cc']){_0x41789c[_0x7dcd('0x93')]['Cc']=_0x2e94f9['cc'];}if(_0x2e94f9[_0x7dcd('0x8d')]){_0x41789c[_0x7dcd('0x93')]['Bcc']=_0x2e94f9['bcc'];}return new BPromise(function(_0x1a8cdb,_0x52f557){if(_0x2e94f9[_0x7dcd('0x8f')]){for(var _0x3acdf1=0x0;_0x3acdf1<_0x2e94f9['Attachments']['length'];_0x3acdf1++){var _0x34f429=_0x2e94f9[_0x7dcd('0x8f')][_0x3acdf1];var _0x40e210=path['join'](_0x3ef253,_0x34f429[_0x7dcd('0x5c')]);if(fs['existsSync'](_0x40e210)){_0x41789c[_0x7dcd('0x58')]['push']({'name':_0x34f429[_0x7dcd('0x28')],'contentType':_0x34f429[_0x7dcd('0x94')],'data':fs['readFileSync'](_0x40e210)});}}}emlformat[_0x7dcd('0x95')](_0x41789c,function(_0xc9c212,_0x154062){if(_0xc9c212)return _0x52f557(_0xc9c212);fs[_0x7dcd('0x96')](path[_0x7dcd('0x59')](_0x914362,_0x58c515),_0x154062);return _0x1a8cdb(_0x154062);});});}})[_0x7dcd('0x14')](function(_0x1c75ea){if(_0x1c75ea){return _0x2b2060[_0x7dcd('0x87')](path['join'](_0x914362,_0x58c515),_0x58c515,function(_0x5ceeb0){if(!_0x5ceeb0)fs['unlinkSync'](path[_0x7dcd('0x59')](_0x914362,_0x58c515));});}})[_0x7dcd('0x1e')](handleError(_0x2b2060,null));};
\ No newline at end of file
index 2c2af0e..97ce0b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08e4=['exports','events','MailMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x550e29,_0x35df59){var _0x275428=function(_0x33c0a5){while(--_0x33c0a5){_0x550e29['push'](_0x550e29['shift']());}};_0x275428(++_0x35df59);}(_0x08e4,0xd9));var _0x408e=function(_0x256449,_0x57ee7){_0x256449=_0x256449-0x0;var _0xf857b2=_0x08e4[_0x256449];return _0xf857b2;};'use strict';var EventEmitter=require(_0x408e('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x408e('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x408e('0x2')](0x0);var events={'afterCreate':_0x408e('0x3'),'afterUpdate':_0x408e('0x4'),'afterDestroy':_0x408e('0x5')};function emitEvent(_0x2631b4){return function(_0x24fe32,_0x22e369,_0x539bb1){MailMessageEvents[_0x408e('0x6')](_0x2631b4+':'+_0x24fe32['id'],_0x24fe32);MailMessageEvents[_0x408e('0x6')](_0x2631b4,_0x24fe32);_0x539bb1(null);};}for(var e in events){if(events[_0x408e('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x408e('0x8')]=MailMessageEvents;
\ No newline at end of file
+var _0xf40a=['save','update','hook','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0xf40a,0x123));var _0xaf40=function(_0x4fcd70,_0x109348){_0x4fcd70=_0x4fcd70-0x0;var _0x336588=_0xf40a[_0x4fcd70];return _0x336588;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xaf40('0x0'))['db'][_0xaf40('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xaf40('0x2')](0x0);var events={'afterCreate':_0xaf40('0x3'),'afterUpdate':_0xaf40('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1477f1){return function(_0x4bbe24,_0x1c9516,_0x3aba31){MailMessageEvents['emit'](_0x1477f1+':'+_0x4bbe24['id'],_0x4bbe24);MailMessageEvents['emit'](_0x1477f1,_0x4bbe24);_0x3aba31(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0xaf40('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents;
\ No newline at end of file
index 1f593b5..96771de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8625=['MailInteractionId','then','createdAt','error','utf8mb4','utf8mb4_unicode_ci','api','bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','define','MailMessage','mail_messages','fti_mail_messages','body','plainBody','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x229e13,_0x541287){var _0x363e95=function(_0x2321f9){while(--_0x2321f9){_0x229e13['push'](_0x229e13['shift']());}};_0x363e95(++_0x541287);}(_0x8625,0x1c0));var _0x5862=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0x8625[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x5862('0x0'));var moment=require('moment');var BPromise=require(_0x5862('0x1'));var rp=require(_0x5862('0x2'));var htmlToText=require(_0x5862('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5862('0x4'));var config=require(_0x5862('0x5'));var attributes=require('./mailMessage.attributes');module[_0x5862('0x6')]=function(_0x4ee688,_0x56b20e){return _0x4ee688[_0x5862('0x7')](_0x5862('0x8'),attributes,{'tableName':_0x5862('0x9'),'paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0x5862('0xa'),'fields':['plainBody','subject'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3c855d,_0x3a7ab6,_0x36bb28){if(_0x3c855d[_0x5862('0xb')]){_0x3c855d[_0x5862('0xc')]=htmlToText['fromString'](_0x3c855d['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x36bb28(null,_0x3a7ab6);},'afterCreate':function(_0x6687dc,_0x542ee1,_0x148e94){var _0x360424=_0x4ee688[_0x5862('0xd')];var _0x24aad9=_0x6687dc[_0x5862('0xe')]({'plain':!![]});if(_0x24aad9[_0x5862('0xf')][_0x5862('0x10')]()==='in'||_0x24aad9[_0x5862('0xf')][_0x5862('0x10')]()===_0x5862('0x11')&&!_0x24aad9[_0x5862('0x12')]&&!_[_0x5862('0x13')](_0x24aad9['UserId'])){_0x360424['MailInteraction']['findOne']({'where':{'id':_0x24aad9[_0x5862('0x14')]}})[_0x5862('0x15')](function(_0x472de8){if(_0x472de8){_0x472de8['update']({'lastMsgAt':_0x24aad9[_0x5862('0x16')],'lastMsgDirection':_0x24aad9['direction'][_0x5862('0x10')]()});}})['catch'](function(_0x232be1){console[_0x5862('0x17')](_0x232be1);});}_0x148e94();}},'charset':_0x5862('0x18'),'collate':_0x5862('0x19')});};
\ No newline at end of file
+var _0x30b9=['MailInteraction','MailInteractionId','then','update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','isNil'];(function(_0xd72a25,_0x37edf2){var _0x535d90=function(_0x8e516e){while(--_0x8e516e){_0xd72a25['push'](_0xd72a25['shift']());}};_0x535d90(++_0x37edf2);}(_0x30b9,0x152));var _0x930b=function(_0x1bca6c,_0x95d210){_0x1bca6c=_0x1bca6c-0x0;var _0x5dbcb5=_0x30b9[_0x1bca6c];return _0x5dbcb5;};'use strict';var _=require(_0x930b('0x0'));var util=require(_0x930b('0x1'));var logger=require('../../config/logger')(_0x930b('0x2'));var moment=require(_0x930b('0x3'));var BPromise=require(_0x930b('0x4'));var rp=require('request-promise');var htmlToText=require(_0x930b('0x5'));var fs=require('fs');var path=require(_0x930b('0x6'));var rimraf=require('rimraf');var config=require(_0x930b('0x7'));var attributes=require(_0x930b('0x8'));module[_0x930b('0x9')]=function(_0x39869e,_0x39e33c){return _0x39869e['define'](_0x930b('0xa'),attributes,{'tableName':_0x930b('0xb'),'paranoid':![],'indexes':[{'name':_0x930b('0xc'),'fields':[_0x930b('0xc')]},{'name':_0x930b('0xd'),'fields':[_0x930b('0xe'),_0x930b('0xf')],'type':_0x930b('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a9144,_0x10011b,_0x2c45bb){if(_0x3a9144[_0x930b('0x11')]){_0x3a9144['plainBody']=htmlToText[_0x930b('0x12')](_0x3a9144[_0x930b('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x2c45bb(null,_0x10011b);},'afterCreate':function(_0x53a2a3,_0x100a9a,_0x59ef1c){var _0xd3555=_0x39869e['models'];var _0x1d5c05=_0x53a2a3[_0x930b('0x13')]({'plain':!![]});if(_0x1d5c05[_0x930b('0x14')]['toLowerCase']()==='in'||_0x1d5c05[_0x930b('0x14')][_0x930b('0x15')]()===_0x930b('0x16')&&!_0x1d5c05[_0x930b('0x17')]&&!_[_0x930b('0x18')](_0x1d5c05['UserId'])){_0xd3555[_0x930b('0x19')]['findOne']({'where':{'id':_0x1d5c05[_0x930b('0x1a')]}})[_0x930b('0x1b')](function(_0x4a006d){if(_0x4a006d){_0x4a006d[_0x930b('0x1c')]({'lastMsgAt':_0x1d5c05[_0x930b('0x1d')],'lastMsgDirection':_0x1d5c05[_0x930b('0x14')][_0x930b('0x15')]()});}})[_0x930b('0x1e')](function(_0x18eea6){console['error'](_0x18eea6);});}_0x59ef1c();}},'charset':_0x930b('0x1f'),'collate':_0x930b('0x20')});};
\ No newline at end of file
index 16aad60..2943b60 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3de3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','CreateMailMessage','MailMessage','create','options','catch','lodash','moment','bluebird'];(function(_0xae0b99,_0xe2da0){var _0x3236fa=function(_0x24097b){while(--_0x24097b){_0xae0b99['push'](_0xae0b99['shift']());}};_0x3236fa(++_0xe2da0);}(_0x3de3,0x1ce));var _0x33de=function(_0x53241b,_0x350fc1){_0x53241b=_0x53241b-0x0;var _0x262d28=_0x3de3[_0x53241b];return _0x262d28;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});config['redis']=_[_0x33de('0xa')](config[_0x33de('0xb')],{'host':_0x33de('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x33de('0xb')]));require(_0x33de('0xd'))[_0x33de('0xe')](socket);function respondWithRpcPromise(_0x5e1be7,_0x2cbf35,_0x348720){return new BPromise(function(_0x8b655d,_0x241211){return client[_0x33de('0xf')](_0x5e1be7,_0x348720)[_0x33de('0x10')](function(_0x8dfa3b){logger[_0x33de('0x11')](_0x33de('0x12'),_0x2cbf35,_0x33de('0x13'));logger[_0x33de('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2cbf35,_0x33de('0x13'),JSON[_0x33de('0x15')](_0x8dfa3b));if(_0x8dfa3b['error']){if(_0x8dfa3b['error'][_0x33de('0x16')]===0x1f4){logger[_0x33de('0x17')](_0x33de('0x12'),_0x2cbf35,_0x8dfa3b[_0x33de('0x17')]['message']);return _0x241211(_0x8dfa3b[_0x33de('0x17')][_0x33de('0x18')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2cbf35,_0x8dfa3b[_0x33de('0x17')][_0x33de('0x18')]);return _0x8b655d(_0x8dfa3b[_0x33de('0x17')]['message']);}else{logger[_0x33de('0x11')](_0x33de('0x12'),_0x2cbf35,'request\x20sent');_0x8b655d(_0x8dfa3b[_0x33de('0x19')][_0x33de('0x18')]);}})['catch'](function(_0x5bb74e){logger[_0x33de('0x17')]('MailMessage,\x20%s,\x20%s',_0x2cbf35,_0x5bb74e);_0x241211(_0x5bb74e);});});}exports[_0x33de('0x1a')]=function(_0x2f0529){var _0x3810b5=this;return new Promise(function(_0x315c9b,_0xc4f1a4){return db[_0x33de('0x1b')][_0x33de('0x1c')](_0x2f0529['body'],{'raw':_0x2f0529['options']?_0x2f0529[_0x33de('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x33de('0x10')](function(_0x4cd8db){logger[_0x33de('0x11')](_0x33de('0x1a'),_0x2f0529);logger['debug'](_0x33de('0x1a'),_0x2f0529,JSON['stringify'](_0x4cd8db));_0x315c9b(_0x4cd8db);})[_0x33de('0x1e')](function(_0x5c602d){logger[_0x33de('0x17')](_0x33de('0x1a'),_0x5c602d[_0x33de('0x18')],_0x2f0529);_0xc4f1a4(_0x3810b5['error'](0x1f4,_0x5c602d[_0x33de('0x18')]));});});};
\ No newline at end of file
+var _0x958a=['./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x16d31d,_0x42290a){var _0x2b137e=function(_0x5b4cb7){while(--_0x5b4cb7){_0x16d31d['push'](_0x16d31d['shift']());}};_0x2b137e(++_0x42290a);}(_0x958a,0x128));var _0xa958=function(_0x284918,_0x36c13a){_0x284918=_0x284918-0x0;var _0x30b343=_0x958a[_0x284918];return _0x30b343;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});config[_0xa958('0xb')]=_[_0xa958('0xc')](config[_0xa958('0xb')],{'host':_0xa958('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa958('0xe'))[_0xa958('0xf')](socket);function respondWithRpcPromise(_0x11f090,_0x44b66e,_0x37afa0){return new BPromise(function(_0x94caac,_0xebb1c6){return client[_0xa958('0x10')](_0x11f090,_0x37afa0)[_0xa958('0x11')](function(_0x250999){logger[_0xa958('0x12')](_0xa958('0x13'),_0x44b66e,_0xa958('0x14'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x44b66e,'request\x20sent',JSON[_0xa958('0x15')](_0x250999));if(_0x250999[_0xa958('0x16')]){if(_0x250999[_0xa958('0x16')]['code']===0x1f4){logger[_0xa958('0x16')]('MailMessage,\x20%s,\x20%s',_0x44b66e,_0x250999['error']['message']);return _0xebb1c6(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0x250999[_0xa958('0x16')][_0xa958('0x17')]);return _0x94caac(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}else{logger['info'](_0xa958('0x13'),_0x44b66e,'request\x20sent');_0x94caac(_0x250999[_0xa958('0x18')][_0xa958('0x17')]);}})['catch'](function(_0xe4129a){logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0xe4129a);_0xebb1c6(_0xe4129a);});});}exports[_0xa958('0x19')]=function(_0x2759ad){var _0x1f82aa=this;return new Promise(function(_0x56314b,_0x4a90c2){return db[_0xa958('0x1a')][_0xa958('0x1b')](_0x2759ad[_0xa958('0x1c')],{'raw':_0x2759ad['options']?_0x2759ad[_0xa958('0x1d')][_0xa958('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x28cf12){logger[_0xa958('0x12')]('CreateMailMessage',_0x2759ad);logger['debug'](_0xa958('0x19'),_0x2759ad,JSON[_0xa958('0x15')](_0x28cf12));_0x56314b(_0x28cf12);})['catch'](function(_0x25f461){logger[_0xa958('0x16')](_0xa958('0x19'),_0x25f461[_0xa958('0x17')],_0x2759ad);_0x4a90c2(_0x1f82aa[_0xa958('0x16')](0x1f4,_0x25f461[_0xa958('0x17')]));});});};
\ No newline at end of file
index ad975be..0a9a4f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec2f=['remove','register','mailMessage:','./mailMessage.events','save'];(function(_0x1d1918,_0x9b060b){var _0x40242b=function(_0x357e6d){while(--_0x357e6d){_0x1d1918['push'](_0x1d1918['shift']());}};_0x40242b(++_0x9b060b);}(_0xec2f,0xa8));var _0xfec2=function(_0x4537cf,_0x5bd246){_0x4537cf=_0x4537cf-0x0;var _0x773ac5=_0xec2f[_0x4537cf];return _0x773ac5;};'use strict';var MailMessageEvents=require(_0xfec2('0x0'));var events=[_0xfec2('0x1'),_0xfec2('0x2'),'update'];function createListener(_0x467b1e,_0xb7a6dc){return function(_0x579195){_0xb7a6dc['emit'](_0x467b1e,_0x579195);};}function removeListener(_0x2aa854,_0x682c77){return function(){MailMessageEvents['removeListener'](_0x2aa854,_0x682c77);};}exports[_0xfec2('0x3')]=function(_0x5ab50e){for(var _0x256aa3=0x0,_0x25690e=events['length'];_0x256aa3<_0x25690e;_0x256aa3++){var _0x472fa6=events[_0x256aa3];var _0x1aa147=createListener(_0xfec2('0x4')+_0x472fa6,_0x5ab50e);MailMessageEvents['on'](_0x472fa6,_0x1aa147);}};
\ No newline at end of file
+var _0x55e0=['emit','removeListener','register','mailMessage:','./mailMessage.events','save','remove','update'];(function(_0x3dc6f4,_0x362e2a){var _0x3b18e9=function(_0x5bf19e){while(--_0x5bf19e){_0x3dc6f4['push'](_0x3dc6f4['shift']());}};_0x3b18e9(++_0x362e2a);}(_0x55e0,0xdc));var _0x055e=function(_0x210da8,_0x3fe0e1){_0x210da8=_0x210da8-0x0;var _0x4455f7=_0x55e0[_0x210da8];return _0x4455f7;};'use strict';var MailMessageEvents=require(_0x055e('0x0'));var events=[_0x055e('0x1'),_0x055e('0x2'),_0x055e('0x3')];function createListener(_0x5b82b9,_0x578882){return function(_0x3a2ee6){_0x578882[_0x055e('0x4')](_0x5b82b9,_0x3a2ee6);};}function removeListener(_0x33cd7b,_0x2773e4){return function(){MailMessageEvents[_0x055e('0x5')](_0x33cd7b,_0x2773e4);};}exports[_0x055e('0x6')]=function(_0x490ee1){for(var _0x5239f6=0x0,_0x4384ff=events['length'];_0x5239f6<_0x4384ff;_0x5239f6++){var _0x8e7824=events[_0x5239f6];var _0x3c4cf=createListener(_0x055e('0x7')+_0x8e7824,_0x490ee1);MailMessageEvents['on'](_0x8e7824,_0x3c4cf);}};
\ No newline at end of file
index 2117254..ee514cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7d0=['getMembers','getTeams','/:id/users','post','/:id/teams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/members'];(function(_0x2c89d9,_0x58cfcd){var _0x1e2506=function(_0x3f01ca){while(--_0x3f01ca){_0x2c89d9['push'](_0x2c89d9['shift']());}};_0x1e2506(++_0x58cfcd);}(_0xf7d0,0x186));var _0x0f7d=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xf7d0[_0x4b7895];return _0x264180;};'use strict';var multer=require('multer');var util=require(_0x0f7d('0x0'));var path=require(_0x0f7d('0x1'));var timeout=require(_0x0f7d('0x2'));var express=require(_0x0f7d('0x3'));var router=express['Router']();var fs_extra=require(_0x0f7d('0x4'));var auth=require(_0x0f7d('0x5'));var interaction=require(_0x0f7d('0x6'));var config=require(_0x0f7d('0x7'));var controller=require('./mailQueue.controller');router[_0x0f7d('0x8')]('/',auth[_0x0f7d('0x9')](),controller[_0x0f7d('0xa')]);router[_0x0f7d('0x8')]('/describe',auth[_0x0f7d('0x9')](),controller[_0x0f7d('0xb')]);router['get'](_0x0f7d('0xc'),auth[_0x0f7d('0x9')](),controller[_0x0f7d('0xd')]);router[_0x0f7d('0x8')](_0x0f7d('0xe'),auth[_0x0f7d('0x9')](),controller[_0x0f7d('0xf')]);router['get']('/:id/teams',auth[_0x0f7d('0x9')](),controller[_0x0f7d('0x10')]);router[_0x0f7d('0x8')](_0x0f7d('0x11'),auth[_0x0f7d('0x9')](),controller['getAgents']);router[_0x0f7d('0x12')]('/',auth[_0x0f7d('0x9')](),controller['create']);router['post'](_0x0f7d('0x13'),auth[_0x0f7d('0x9')](),controller['addTeams']);router[_0x0f7d('0x12')](_0x0f7d('0x11'),auth['isAuthenticated'](),controller[_0x0f7d('0x14')]);router[_0x0f7d('0x15')](_0x0f7d('0xc'),auth[_0x0f7d('0x9')](),controller['update']);router[_0x0f7d('0x16')](_0x0f7d('0xc'),auth['isAuthenticated'](),controller[_0x0f7d('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x0f7d('0x18')]);router['delete'](_0x0f7d('0x11'),auth['isAuthenticated'](),controller[_0x0f7d('0x19')]);module[_0x0f7d('0x1a')]=router;
\ No newline at end of file
+var _0x9ad2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','describe','getMembers','/:id/teams','getTeams','getAgents','create','post','addTeams','put','/:id','update','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9ad2,0xb4));var _0x29ad=function(_0x11508d,_0x2f54c2){_0x11508d=_0x11508d-0x0;var _0x4f85fa=_0x9ad2[_0x11508d];return _0x4f85fa;};'use strict';var multer=require(_0x29ad('0x0'));var util=require(_0x29ad('0x1'));var path=require(_0x29ad('0x2'));var timeout=require(_0x29ad('0x3'));var express=require(_0x29ad('0x4'));var router=express[_0x29ad('0x5')]();var fs_extra=require(_0x29ad('0x6'));var auth=require(_0x29ad('0x7'));var interaction=require(_0x29ad('0x8'));var config=require(_0x29ad('0x9'));var controller=require(_0x29ad('0xa'));router[_0x29ad('0xb')]('/',auth[_0x29ad('0xc')](),controller[_0x29ad('0xd')]);router['get']('/describe',auth[_0x29ad('0xc')](),controller[_0x29ad('0xe')]);router[_0x29ad('0xb')]('/:id',auth[_0x29ad('0xc')](),controller['show']);router[_0x29ad('0xb')]('/:id/members',auth[_0x29ad('0xc')](),controller[_0x29ad('0xf')]);router[_0x29ad('0xb')](_0x29ad('0x10'),auth[_0x29ad('0xc')](),controller[_0x29ad('0x11')]);router['get']('/:id/users',auth['isAuthenticated'](),controller[_0x29ad('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0x29ad('0x13')]);router[_0x29ad('0x14')]('/:id/teams',auth[_0x29ad('0xc')](),controller[_0x29ad('0x15')]);router[_0x29ad('0x14')]('/:id/users',auth[_0x29ad('0xc')](),controller['addAgents']);router[_0x29ad('0x16')](_0x29ad('0x17'),auth[_0x29ad('0xc')](),controller[_0x29ad('0x18')]);router[_0x29ad('0x19')](_0x29ad('0x17'),auth[_0x29ad('0xc')](),controller[_0x29ad('0x1a')]);router[_0x29ad('0x19')](_0x29ad('0x10'),auth[_0x29ad('0xc')](),controller[_0x29ad('0x1b')]);router[_0x29ad('0x19')](_0x29ad('0x1c'),auth['isAuthenticated'](),controller[_0x29ad('0x1d')]);module[_0x29ad('0x1e')]=router;
\ No newline at end of file
index f9e85a7..65d3ffc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeff2=['INTEGER','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x19b987,_0x5b3b44){var _0x391a67=function(_0x4023d9){while(--_0x4023d9){_0x19b987['push'](_0x19b987['shift']());}};_0x391a67(++_0x5b3b44);}(_0xeff2,0xc7));var _0x2eff=function(_0x27fd12,_0x3e31c8){_0x27fd12=_0x27fd12-0x0;var _0x4be30b=_0xeff2[_0x27fd12];return _0x4be30b;};'use strict';var Sequelize=require(_0x2eff('0x0'));module[_0x2eff('0x1')]={'name':{'type':Sequelize[_0x2eff('0x2')],'unique':_0x2eff('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2eff('0x2')]},'timeout':{'type':Sequelize[_0x2eff('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2eff('0x5'),'beepall',_0x2eff('0x6'))}};
\ No newline at end of file
+var _0x2a98=['INTEGER','ENUM','rrmemory','sequelize','exports','STRING'];(function(_0x1e6111,_0x1ea521){var _0x5098c2=function(_0x3430f6){while(--_0x3430f6){_0x1e6111['push'](_0x1e6111['shift']());}};_0x5098c2(++_0x1ea521);}(_0x2a98,0x189));var _0x82a9=function(_0x15be0f,_0x3302d3){_0x15be0f=_0x15be0f-0x0;var _0x4345a7=_0x2a98[_0x15be0f];return _0x4345a7;};'use strict';var Sequelize=require(_0x82a9('0x0'));module[_0x82a9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x82a9('0x2')]},'timeout':{'type':Sequelize[_0x82a9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x82a9('0x4')](_0x82a9('0x5'),'beepall','roundrobin')}};
\ No newline at end of file
index c46f78b..095b55e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb88=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserMailQueue','intersection','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','map','options','findAll','User','findAndCountAll','UserId','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','each','forEach','emit','userMailQueue:save','removeTeams','select','field','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','compact','transaction','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','get','MailQueues','stack','name','send','index','MailQueue','fieldName','type','key','getOptions','where','include','show','params','model','keys','rawAttributes','query','filters','attributes','fields','length','includeAll','merge','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation'];(function(_0x3308a0,_0x5a71c4){var _0x3adbf3=function(_0xc259aa){while(--_0xc259aa){_0x3308a0['push'](_0x3308a0['shift']());}};_0x3adbf3(++_0x5a71c4);}(_0xeb88,0x1c0));var _0x8eb8=function(_0x4aca13,_0x13ff10){_0x4aca13=_0x4aca13-0x0;var _0x2b217d=_0xeb88[_0x4aca13];return _0x2b217d;};'use strict';var BPromise=require(_0x8eb8('0x0'));var util=require(_0x8eb8('0x1'));var _=require(_0x8eb8('0x2'));var squel=require('squel');var Redis=require(_0x8eb8('0x3'));var qs=require(_0x8eb8('0x4'));var logger=require(_0x8eb8('0x5'))(_0x8eb8('0x6'));var config=require(_0x8eb8('0x7'));var db=require(_0x8eb8('0x8'))['db'];config[_0x8eb8('0x9')]=_[_0x8eb8('0xa')](config[_0x8eb8('0x9')],{'host':_0x8eb8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8eb8('0x9')]));require(_0x8eb8('0xc'))[_0x8eb8('0xd')](socket);function respondWithStatusCode(_0x13f200,_0x47b426){_0x47b426=_0x47b426||0xcc;return function(_0x1b9700){if(_0x1b9700){return _0x13f200[_0x8eb8('0xe')](_0x47b426);}return _0x13f200[_0x8eb8('0xf')](_0x47b426)[_0x8eb8('0x10')]();};}function respondWithResult(_0x2c95a2,_0x5a29d5){_0x5a29d5=_0x5a29d5||0xc8;return function(_0x4b3472){if(_0x4b3472){return _0x2c95a2[_0x8eb8('0xf')](_0x5a29d5)[_0x8eb8('0x11')](_0x4b3472);}};}function respondWithFilteredResult(_0x48d795,_0x23fe08){return function(_0x5874d6){if(_0x5874d6){var _0x247133=typeof _0x23fe08[_0x8eb8('0x12')]===_0x8eb8('0x13')&&typeof _0x23fe08['limit']==='undefined';var _0x5392ed=_0x5874d6[_0x8eb8('0x14')];var _0x242871=_0x247133?0x0:_0x23fe08[_0x8eb8('0x12')];var _0x3bec95=_0x247133?_0x5874d6['count']:_0x23fe08[_0x8eb8('0x12')]+_0x23fe08[_0x8eb8('0x15')];var _0x254fef;if(_0x3bec95>=_0x5392ed){_0x3bec95=_0x5392ed;_0x254fef=0xc8;}else{_0x254fef=0xce;}_0x48d795['status'](_0x254fef);return _0x48d795[_0x8eb8('0x16')](_0x8eb8('0x17'),_0x242871+'-'+_0x3bec95+'/'+_0x5392ed)[_0x8eb8('0x11')](_0x5874d6);}return null;};}function saveUpdates(_0x1b0cc){return function(_0x35fd3f){if(_0x35fd3f){return _0x35fd3f[_0x8eb8('0x18')](_0x1b0cc)[_0x8eb8('0x19')](function(_0x3ec3ce){return _0x3ec3ce;});}return null;};}function removeEntity(_0x14a014){return function(_0x10ea96){if(_0x10ea96){return _0x10ea96['destroy']()[_0x8eb8('0x19')](function(){var _0x278b24=_0x10ea96[_0x8eb8('0x1a')]({'plain':!![]});var _0x17e289=_0x8eb8('0x1b');return db['UserProfileResource']['destroy']({'where':{'type':_0x17e289,'resourceId':_0x278b24['id']}})[_0x8eb8('0x19')](function(){return _0x10ea96;});})[_0x8eb8('0x19')](function(){_0x14a014[_0x8eb8('0xf')](0xcc)[_0x8eb8('0x10')]();});}};}function handleEntityNotFound(_0x5de662){return function(_0x417356){if(!_0x417356){_0x5de662['sendStatus'](0x194);}return _0x417356;};}function handleError(_0x519636,_0x29baee){_0x29baee=_0x29baee||0x1f4;return function(_0x5efa84){logger['error'](_0x5efa84[_0x8eb8('0x1c')]);if(_0x5efa84[_0x8eb8('0x1d')]){delete _0x5efa84[_0x8eb8('0x1d')];}_0x519636[_0x8eb8('0xf')](_0x29baee)[_0x8eb8('0x1e')](_0x5efa84);};}exports[_0x8eb8('0x1f')]=function(_0x378047,_0x38b1c9){var _0x5c2922={};var _0x47ba63={'count':0x0,'rows':[]};var _0x375637=_['map'](db[_0x8eb8('0x20')]['rawAttributes'],function(_0x45bad1){return{'name':_0x45bad1[_0x8eb8('0x21')],'type':_0x45bad1[_0x8eb8('0x22')][_0x8eb8('0x23')]};});_0x5c2922=qs[_0x8eb8('0x24')](_0x375637,_0x378047);var _0x27b517={'where':_0x5c2922[_0x8eb8('0x25')]};return db[_0x8eb8('0x20')][_0x8eb8('0x14')](_0x27b517)[_0x8eb8('0x19')](function(_0x2bb1ad){_0x47ba63[_0x8eb8('0x14')]=_0x2bb1ad;_0x5c2922['include']=qs[_0x8eb8('0x26')](_0x378047['query']);return db[_0x8eb8('0x20')]['findAll'](_0x5c2922);})[_0x8eb8('0x19')](function(_0x4a8e00){_0x47ba63['rows']=_0x4a8e00;return _0x47ba63;})[_0x8eb8('0x19')](respondWithFilteredResult(_0x38b1c9,_0x5c2922))['catch'](handleError(_0x38b1c9,null));};exports[_0x8eb8('0x27')]=function(_0x2413bd,_0x156e62){var _0x4bc1cd={'raw':!![],'where':{'id':_0x2413bd[_0x8eb8('0x28')]['id']}},_0x308fc6={};_0x308fc6[_0x8eb8('0x29')]=_[_0x8eb8('0x2a')](db[_0x8eb8('0x20')][_0x8eb8('0x2b')]);_0x308fc6['query']=_[_0x8eb8('0x2a')](_0x2413bd[_0x8eb8('0x2c')]);_0x308fc6[_0x8eb8('0x2d')]=_['intersection'](_0x308fc6[_0x8eb8('0x29')],_0x308fc6[_0x8eb8('0x2c')]);_0x4bc1cd[_0x8eb8('0x2e')]=_['intersection'](_0x308fc6[_0x8eb8('0x29')],qs[_0x8eb8('0x2f')](_0x2413bd[_0x8eb8('0x2c')][_0x8eb8('0x2f')]));_0x4bc1cd[_0x8eb8('0x2e')]=_0x4bc1cd[_0x8eb8('0x2e')][_0x8eb8('0x30')]?_0x4bc1cd[_0x8eb8('0x2e')]:_0x308fc6[_0x8eb8('0x29')];if(_0x2413bd[_0x8eb8('0x2c')][_0x8eb8('0x31')]){_0x4bc1cd[_0x8eb8('0x26')]=[{'all':!![]}];}_0x4bc1cd=_[_0x8eb8('0x32')]({},_0x4bc1cd,_0x2413bd['options']);return db['MailQueue'][_0x8eb8('0x33')](_0x4bc1cd)[_0x8eb8('0x19')](handleEntityNotFound(_0x156e62,null))[_0x8eb8('0x19')](respondWithResult(_0x156e62,null))[_0x8eb8('0x34')](handleError(_0x156e62,null));};exports[_0x8eb8('0x35')]=function(_0x1c1178,_0x39df53){return db[_0x8eb8('0x20')][_0x8eb8('0x35')](_0x1c1178[_0x8eb8('0x36')],{})[_0x8eb8('0x19')](function(_0x4c5944){var _0x2eb138=_0x1c1178['user'][_0x8eb8('0x1a')]({'plain':!![]});if(!_0x2eb138)throw new Error(_0x8eb8('0x37'));if(_0x2eb138[_0x8eb8('0x38')]==='user'){var _0x47217d=_0x4c5944[_0x8eb8('0x1a')]({'plain':!![]});var _0x4b633d=_0x8eb8('0x1b');return db[_0x8eb8('0x39')][_0x8eb8('0x33')]({'where':{'name':_0x4b633d,'userProfileId':_0x2eb138[_0x8eb8('0x3a')]},'raw':!![]})[_0x8eb8('0x19')](function(_0x28bd03){if(_0x28bd03&&_0x28bd03[_0x8eb8('0x3b')]===0x0){return db['UserProfileResource'][_0x8eb8('0x35')]({'name':_0x47217d['name'],'resourceId':_0x47217d['id'],'type':_0x28bd03['name'],'sectionId':_0x28bd03['id']},{})['then'](function(){return _0x4c5944;});}else{return _0x4c5944;}})['catch'](function(_0x4d7695){logger['error'](_0x8eb8('0x3c'),_0x4d7695);throw _0x4d7695;});}return _0x4c5944;})[_0x8eb8('0x19')](respondWithResult(_0x39df53,0xc9))['catch'](handleError(_0x39df53,null));};exports[_0x8eb8('0x18')]=function(_0x39a274,_0x431ea2){if(_0x39a274[_0x8eb8('0x36')]['id']){delete _0x39a274[_0x8eb8('0x36')]['id'];}return db['MailQueue'][_0x8eb8('0x33')]({'where':{'id':_0x39a274['params']['id']}})['then'](handleEntityNotFound(_0x431ea2,null))[_0x8eb8('0x19')](saveUpdates(_0x39a274[_0x8eb8('0x36')],null))[_0x8eb8('0x19')](respondWithResult(_0x431ea2,null))['catch'](handleError(_0x431ea2,null));};exports[_0x8eb8('0x3d')]=function(_0x45ef0f,_0x74aa94){return db[_0x8eb8('0x20')]['find']({'where':{'id':_0x45ef0f[_0x8eb8('0x28')]['id']}})[_0x8eb8('0x19')](handleEntityNotFound(_0x74aa94,null))[_0x8eb8('0x19')](removeEntity(_0x74aa94,null))['catch'](handleError(_0x74aa94,null));};exports[_0x8eb8('0x3e')]=function(_0x873f7e,_0x30ee3a){return db[_0x8eb8('0x20')]['describe']()[_0x8eb8('0x19')](respondWithResult(_0x30ee3a,null))[_0x8eb8('0x34')](handleError(_0x30ee3a,null));};exports[_0x8eb8('0x3f')]=function(_0x4f81f7,_0x2f69f8){var _0x4ff36f={'raw':!![],'where':{}},_0x4ab832={},_0x20d8cf;return db[_0x8eb8('0x20')][_0x8eb8('0x40')]({'where':{'id':_0x4f81f7[_0x8eb8('0x28')]['id']}})[_0x8eb8('0x19')](handleEntityNotFound(_0x2f69f8,null))['then'](function(_0x202171){if(_0x202171){_0x20d8cf=_0x202171[_0x8eb8('0x1a')]({'plain':!![]});_0x4ab832[_0x8eb8('0x29')]=_[_0x8eb8('0x2a')](db[_0x8eb8('0x41')][_0x8eb8('0x2b')]);_0x4ab832[_0x8eb8('0x2c')]=_[_0x8eb8('0x2a')](_0x4f81f7['query']);_0x4ab832['filters']=_[_0x8eb8('0x42')](_0x4ab832[_0x8eb8('0x29')],_0x4ab832[_0x8eb8('0x2c')]);_0x4ff36f[_0x8eb8('0x2e')]=_[_0x8eb8('0x42')](_0x4ab832[_0x8eb8('0x29')],qs[_0x8eb8('0x2f')](_0x4f81f7[_0x8eb8('0x2c')][_0x8eb8('0x2f')]));_0x4ff36f[_0x8eb8('0x2e')]=_0x4ff36f[_0x8eb8('0x2e')][_0x8eb8('0x30')]?_0x4ff36f['attributes']:_0x4ab832['model'];if(!_0x4f81f7[_0x8eb8('0x2c')][_0x8eb8('0x43')](_0x8eb8('0x44'))){_0x4ff36f[_0x8eb8('0x15')]=qs[_0x8eb8('0x15')](_0x4f81f7[_0x8eb8('0x2c')][_0x8eb8('0x15')]);_0x4ff36f[_0x8eb8('0x12')]=qs['offset'](_0x4f81f7[_0x8eb8('0x2c')][_0x8eb8('0x12')]);}_0x4ff36f[_0x8eb8('0x45')]=qs[_0x8eb8('0x46')](_0x4f81f7[_0x8eb8('0x2c')]['sort']);_0x4ff36f[_0x8eb8('0x25')]=qs[_0x8eb8('0x2d')](_[_0x8eb8('0x47')](_0x4f81f7[_0x8eb8('0x2c')],_0x4ab832[_0x8eb8('0x2d')]));_0x4ff36f['where'][_0x8eb8('0x48')]=_0x202171['id'];if(_0x4f81f7['query'][_0x8eb8('0x49')]){_0x4ff36f[_0x8eb8('0x25')]=_['merge'](_0x4ff36f[_0x8eb8('0x25')],{'$or':_[_0x8eb8('0x4a')](_0x4ff36f[_0x8eb8('0x2e')],function(_0x5c4ed5){var _0x49e2d2={};_0x49e2d2[_0x5c4ed5]={'$like':'%'+_0x4f81f7[_0x8eb8('0x2c')]['filter']+'%'};return _0x49e2d2;})});}_0x4ff36f=_['merge']({},_0x4ff36f,_0x4f81f7[_0x8eb8('0x4b')]);return db[_0x8eb8('0x41')][_0x8eb8('0x4c')](_0x4ff36f);}})[_0x8eb8('0x19')](function(_0x2fb796){if(_0x2fb796){return db[_0x8eb8('0x4d')][_0x8eb8('0x4e')]({'where':{'id':_['map'](_0x2fb796,_0x8eb8('0x4f')),'role':_0x8eb8('0x50')},'attributes':['id',_0x8eb8('0x1d'),_0x8eb8('0x51'),_0x8eb8('0x52'),_0x8eb8('0x53')]});}})['then'](function(_0x5da685){if(_0x5da685){return{'count':_0x5da685[_0x8eb8('0x14')],'rows':_[_0x8eb8('0x4a')](_0x5da685[_0x8eb8('0x54')],function(_0xde2092){return{'membername':_0xde2092[_0x8eb8('0x1d')],'UserId':_0xde2092['id'],'queue_name':_0x20d8cf[_0x8eb8('0x1d')],'MailQueueId':_0x20d8cf['id'],'interface':util[_0x8eb8('0x55')](_0x8eb8('0x56'),_0x8eb8('0x57'),_0xde2092[_0x8eb8('0x1d')]),'penalty':0x0,'paused':_0xde2092['mailPause'],'createdAt':_0xde2092[_0x8eb8('0x53')],'updatedAt':_0xde2092['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f69f8,_0x4ff36f))['catch'](handleError(_0x2f69f8,null));};exports[_0x8eb8('0x58')]=function(_0x330352,_0x2f66a6){var _0x5e26b8={};var _0x516722={};var _0x3989e5;var _0x29a842;return db['MailQueue'][_0x8eb8('0x40')]({'where':{'id':_0x330352[_0x8eb8('0x28')]['id']}})['then'](handleEntityNotFound(_0x2f66a6,null))['then'](function(_0x564537){if(_0x564537){_0x3989e5=_0x564537;_0x516722['model']=_[_0x8eb8('0x2a')](db[_0x8eb8('0x59')][_0x8eb8('0x2b')]);_0x516722[_0x8eb8('0x2c')]=_[_0x8eb8('0x2a')](_0x330352['query']);_0x516722[_0x8eb8('0x2d')]=_[_0x8eb8('0x42')](_0x516722[_0x8eb8('0x29')],_0x516722['query']);_0x5e26b8['attributes']=_['intersection'](_0x516722[_0x8eb8('0x29')],qs['fields'](_0x330352['query']['fields']));_0x5e26b8[_0x8eb8('0x2e')]=_0x5e26b8[_0x8eb8('0x2e')]['length']?_0x5e26b8[_0x8eb8('0x2e')]:_0x516722[_0x8eb8('0x29')];_0x5e26b8['order']=qs[_0x8eb8('0x46')](_0x330352[_0x8eb8('0x2c')][_0x8eb8('0x46')]);_0x5e26b8[_0x8eb8('0x25')]=qs[_0x8eb8('0x2d')](_[_0x8eb8('0x47')](_0x330352['query'],_0x516722['filters']));if(_0x330352[_0x8eb8('0x2c')]['filter']){_0x5e26b8[_0x8eb8('0x25')]=_[_0x8eb8('0x32')](_0x5e26b8['where'],{'$or':_[_0x8eb8('0x4a')](_0x5e26b8[_0x8eb8('0x2e')],function(_0x42fde2){var _0x4d07b9={};_0x4d07b9[_0x42fde2]={'$like':'%'+_0x330352[_0x8eb8('0x2c')][_0x8eb8('0x49')]+'%'};return _0x4d07b9;})});}_0x5e26b8=_[_0x8eb8('0x32')]({},_0x5e26b8,_0x330352[_0x8eb8('0x4b')]);return _0x3989e5[_0x8eb8('0x58')](_0x5e26b8);}})[_0x8eb8('0x19')](function(_0x5aa453){if(_0x5aa453){_0x29a842=_0x5aa453[_0x8eb8('0x30')];if(!_0x330352[_0x8eb8('0x2c')]['hasOwnProperty']('nolimit')){_0x5e26b8['limit']=qs[_0x8eb8('0x15')](_0x330352[_0x8eb8('0x2c')][_0x8eb8('0x15')]);_0x5e26b8[_0x8eb8('0x12')]=qs[_0x8eb8('0x12')](_0x330352[_0x8eb8('0x2c')]['offset']);}return _0x3989e5[_0x8eb8('0x58')](_0x5e26b8);}})[_0x8eb8('0x19')](function(_0x484f0c){if(_0x484f0c){return _0x484f0c?{'count':_0x29a842,'rows':_0x484f0c}:null;}})[_0x8eb8('0x19')](respondWithResult(_0x2f66a6,null))['catch'](handleError(_0x2f66a6,null));};exports[_0x8eb8('0x5a')]=function(_0x1fa901,_0x32ebf9){var _0x2dc125=_0x1fa901[_0x8eb8('0x36')][_0x8eb8('0x5b')];return db[_0x8eb8('0x59')]['findAll']({'where':{'id':_0x2dc125},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8eb8('0x5c'),'attributes':['id',_0x8eb8('0x1d'),_0x8eb8('0x5d'),_0x8eb8('0x5e'),_0x8eb8('0x5f')],'raw':!![]}]})[_0x8eb8('0x19')](function(_0x129fe7){if(_0x129fe7){var _0x5daee1=_[_0x8eb8('0x60')](_0x129fe7,function(_0xbfc83){var _0x2f872a=_0xbfc83[_0x8eb8('0x1a')]({'plain':!![]});return _0x2f872a[_0x8eb8('0x5c')];});return db[_0x8eb8('0x20')][_0x8eb8('0x33')]({'where':{'id':_0x1fa901[_0x8eb8('0x28')]['id']}})[_0x8eb8('0x19')](function(_0x30af5b){return db[_0x8eb8('0x61')]['transaction'](function(_0x4388de){return _0x30af5b[_0x8eb8('0x5a')](_0x2dc125,{'transaction':_0x4388de})['then'](function(){return BPromise[_0x8eb8('0x62')](_0x5daee1,function(_0x24f86f){return db[_0x8eb8('0x41')]['findOrCreate']({'where':{'UserId':_0x24f86f['id'],'MailQueueId':_0x1fa901['params']['id']},'transaction':_0x4388de});});})[_0x8eb8('0x19')](function(){_0x5daee1[_0x8eb8('0x63')](function(_0x42af02){socket[_0x8eb8('0x64')](_0x8eb8('0x65'),{'UserId':_0x42af02['id'],'MailQueueId':_0x30af5b['id']});});});});});}})[_0x8eb8('0x19')](respondWithStatusCode(_0x32ebf9,null))[_0x8eb8('0x34')](handleError(_0x32ebf9,null));};exports[_0x8eb8('0x66')]=function(_0x4196ec,_0x49d44b){return db[_0x8eb8('0x59')][_0x8eb8('0x4c')]({'where':{'id':_0x4196ec[_0x8eb8('0x2c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x8eb8('0x4d')],'as':_0x8eb8('0x5c'),'attributes':['id'],'raw':!![]}]})[_0x8eb8('0x19')](handleEntityNotFound(_0x49d44b,null))[_0x8eb8('0x19')](function(_0x460644){var _0xb06ce0=_['map'](_0x460644,'id');var _0x24023d=[];var _0x2661a2=[];var _0x5ae87b=squel[_0x8eb8('0x67')]();_0x5ae87b[_0x8eb8('0x68')]('tq.TeamId')[_0x8eb8('0x69')](_0x8eb8('0x6a'),'tq')[_0x8eb8('0x6b')](_0x8eb8('0x6c'),'ut',_0x8eb8('0x6d'))[_0x8eb8('0x25')](_0x8eb8('0x6e'),_0x4196ec['params']['id']);for(var _0x56bc65=0x0;_0x56bc65<_0x460644['length'];_0x56bc65+=0x1){let _0x4708e5=_0x460644[_0x56bc65];for(var _0x4dea2a=0x0;_0x4dea2a<_0x4708e5[_0x8eb8('0x5c')][_0x8eb8('0x30')];_0x4dea2a+=0x1){let _0x585684=_0x4708e5[_0x8eb8('0x5c')][_0x4dea2a];var _0x32f703=_0x5ae87b[_0x8eb8('0x6f')]();_0x32f703[_0x8eb8('0x25')](_0x8eb8('0x70'),_0x585684['id']);_0x2661a2[_0x8eb8('0x71')](db[_0x8eb8('0x61')][_0x8eb8('0x2c')](_0x32f703[_0x8eb8('0x72')](),{'type':db[_0x8eb8('0x61')][_0x8eb8('0x73')][_0x8eb8('0x74')]})[_0x8eb8('0x19')](function(_0x398b16){if(_0x398b16[_0x8eb8('0x30')]===0x1){return _0x585684['id'];}else{var _0x3bf06d=_['every'](_[_0x8eb8('0x4a')](_0x398b16,_0x8eb8('0x75')),function(_0x3726e4){return _['includes'](_0xb06ce0,_0x3726e4);});if(_0x3bf06d){return _0x585684['id'];}}}));}}return BPromise['all'](_0x2661a2)[_0x8eb8('0x19')](function(_0x571e6b){_0x24023d=_(_0x24023d)[_0x8eb8('0x76')](_0x571e6b)[_0x8eb8('0x77')]()['value']();return db['MailQueue'][_0x8eb8('0x33')]({'where':{'id':_0x4196ec[_0x8eb8('0x28')]['id']}})[_0x8eb8('0x19')](function(_0x55b6c0){return db[_0x8eb8('0x61')][_0x8eb8('0x78')](function(_0x2d0564){return _0x55b6c0[_0x8eb8('0x66')](_0x4196ec[_0x8eb8('0x2c')][_0x8eb8('0x5b')],{'transaction':_0x2d0564})[_0x8eb8('0x19')](function(){if(!_[_0x8eb8('0x79')](_0x24023d)){return _0x55b6c0[_0x8eb8('0x7a')](_0x24023d,{'transaction':_0x2d0564});}})['then'](function(){_0x24023d[_0x8eb8('0x63')](function(_0x47f3a9){socket[_0x8eb8('0x64')](_0x8eb8('0x7b'),{'UserId':_0x47f3a9,'MailQueueId':_0x55b6c0['id']});});});});});});})[_0x8eb8('0x19')](respondWithStatusCode(_0x49d44b,null))[_0x8eb8('0x34')](handleError(_0x49d44b,null));};exports[_0x8eb8('0x7c')]=function(_0x42f734,_0x2aeb61){return db[_0x8eb8('0x20')]['find']({'where':{'id':_0x42f734[_0x8eb8('0x28')]['id']}})[_0x8eb8('0x19')](handleEntityNotFound(_0x2aeb61,null))['then'](function(_0x17a096){if(_0x17a096){return _0x17a096[_0x8eb8('0x7c')](_0x42f734[_0x8eb8('0x36')][_0x8eb8('0x5b')],_['omit'](_0x42f734[_0x8eb8('0x36')],['ids','id'])||{})[_0x8eb8('0x7d')](function(_0x660d9f){for(var _0x4b390b=0x0;_0x4b390b<_0x42f734[_0x8eb8('0x36')][_0x8eb8('0x5b')][_0x8eb8('0x30')];_0x4b390b+=0x1){socket[_0x8eb8('0x64')](_0x8eb8('0x65'),{'UserId':Number(_0x42f734[_0x8eb8('0x36')][_0x8eb8('0x5b')][_0x4b390b]),'MailQueueId':Number(_0x42f734['params']['id'])});}return _0x660d9f;});}})[_0x8eb8('0x19')](respondWithResult(_0x2aeb61,null))[_0x8eb8('0x34')](handleError(_0x2aeb61,null));};exports['removeAgents']=function(_0x406ddb,_0x6dac53){return db[_0x8eb8('0x20')]['find']({'where':{'id':_0x406ddb[_0x8eb8('0x28')]['id']}})[_0x8eb8('0x19')](handleEntityNotFound(_0x6dac53,null))[_0x8eb8('0x19')](function(_0x584cee){if(_0x584cee){return _0x584cee['removeAgents'](_0x406ddb[_0x8eb8('0x2c')][_0x8eb8('0x5b')])[_0x8eb8('0x19')](function(){if(_['isArray'](_0x406ddb[_0x8eb8('0x2c')][_0x8eb8('0x5b')])){for(var _0x51a67d=0x0;_0x51a67d<_0x406ddb['query'][_0x8eb8('0x5b')][_0x8eb8('0x30')];_0x51a67d+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x406ddb[_0x8eb8('0x2c')][_0x8eb8('0x5b')][_0x51a67d]),'MailQueueId':Number(_0x406ddb[_0x8eb8('0x28')]['id'])});}}else{socket[_0x8eb8('0x64')](_0x8eb8('0x7b'),{'UserId':Number(_0x406ddb[_0x8eb8('0x2c')][_0x8eb8('0x5b')]),'MailQueueId':Number(_0x406ddb[_0x8eb8('0x28')]['id'])});}});}})[_0x8eb8('0x19')](respondWithStatusCode(_0x6dac53,null))[_0x8eb8('0x34')](handleError(_0x6dac53,null));};exports['getAgents']=function(_0x2ff714,_0x23d2d8){var _0x121433={};var _0xde55c7={};var _0xfc54d7;var _0x6d1b6a;return db['MailQueue'][_0x8eb8('0x40')]({'where':{'id':_0x2ff714['params']['id']}})[_0x8eb8('0x19')](handleEntityNotFound(_0x23d2d8,null))[_0x8eb8('0x19')](function(_0x4366d7){if(_0x4366d7){_0xfc54d7=_0x4366d7;_0xde55c7[_0x8eb8('0x29')]=_[_0x8eb8('0x2a')](db[_0x8eb8('0x4d')][_0x8eb8('0x2b')]);_0xde55c7[_0x8eb8('0x2c')]=_[_0x8eb8('0x2a')](_0x2ff714[_0x8eb8('0x2c')]);_0xde55c7[_0x8eb8('0x2d')]=_[_0x8eb8('0x42')](_0xde55c7['model'],_0xde55c7['query']);_0x121433[_0x8eb8('0x2e')]=_[_0x8eb8('0x42')](_0xde55c7['model'],qs[_0x8eb8('0x2f')](_0x2ff714[_0x8eb8('0x2c')][_0x8eb8('0x2f')]));_0x121433['attributes']=_0x121433[_0x8eb8('0x2e')][_0x8eb8('0x30')]?_0x121433[_0x8eb8('0x2e')]:_0xde55c7['model'];_0x121433[_0x8eb8('0x45')]=qs[_0x8eb8('0x46')](_0x2ff714[_0x8eb8('0x2c')][_0x8eb8('0x46')]);_0x121433[_0x8eb8('0x25')]=qs[_0x8eb8('0x2d')](_[_0x8eb8('0x47')](_0x2ff714[_0x8eb8('0x2c')],_0xde55c7['filters']));if(_0x2ff714[_0x8eb8('0x2c')][_0x8eb8('0x49')]){_0x121433[_0x8eb8('0x25')]=_['merge'](_0x121433['where'],{'$or':_[_0x8eb8('0x4a')](_0x121433[_0x8eb8('0x2e')],function(_0x4ec797){var _0x1e2cf1={};_0x1e2cf1[_0x4ec797]={'$like':'%'+_0x2ff714[_0x8eb8('0x2c')]['filter']+'%'};return _0x1e2cf1;})});}_0x121433=_[_0x8eb8('0x32')]({},_0x121433,_0x2ff714[_0x8eb8('0x4b')]);return _0xfc54d7['getAgents'](_0x121433);}})['then'](function(_0x2fbec2){if(_0x2fbec2){_0x6d1b6a=_0x2fbec2['length'];if(!_0x2ff714['query'][_0x8eb8('0x43')](_0x8eb8('0x44'))){_0x121433['limit']=qs[_0x8eb8('0x15')](_0x2ff714['query'][_0x8eb8('0x15')]);_0x121433['offset']=qs[_0x8eb8('0x12')](_0x2ff714['query'][_0x8eb8('0x12')]);}return _0xfc54d7[_0x8eb8('0x7e')](_0x121433);}})[_0x8eb8('0x19')](function(_0x2488aa){if(_0x2488aa){return _0x2488aa?{'count':_0x6d1b6a,'rows':_0x2488aa}:null;}})[_0x8eb8('0x19')](respondWithResult(_0x23d2d8,null))[_0x8eb8('0x34')](handleError(_0x23d2d8,null));};
\ No newline at end of file
+var _0xabc7=['user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','isEmpty','emit','userMailQueue:remove','addAgents','omit','removeAgents','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','limit','count','set','Content-Range','then','destroy','get','MailQueues','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','MailQueue','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','createdAt','rows','format','SIP','updatedAt','getTeams','Team','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','userMailQueue:save','removeTeams','select','from','join'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xabc7,0x182));var _0x7abc=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0xabc7[_0x4d8ed9];return _0x1e2140;};'use strict';var BPromise=require(_0x7abc('0x0'));var util=require(_0x7abc('0x1'));var _=require(_0x7abc('0x2'));var squel=require(_0x7abc('0x3'));var Redis=require('ioredis');var qs=require(_0x7abc('0x4'));var logger=require(_0x7abc('0x5'))(_0x7abc('0x6'));var config=require(_0x7abc('0x7'));var db=require('../../mysqldb')['db'];config[_0x7abc('0x8')]=_[_0x7abc('0x9')](config['redis'],{'host':_0x7abc('0xa'),'port':0x18eb});var socket=require(_0x7abc('0xb'))(new Redis(config[_0x7abc('0x8')]));require('./mailQueue.socket')['register'](socket);function respondWithStatusCode(_0x3dffe8,_0x104388){_0x104388=_0x104388||0xcc;return function(_0x16640f){if(_0x16640f){return _0x3dffe8[_0x7abc('0xc')](_0x104388);}return _0x3dffe8['status'](_0x104388)[_0x7abc('0xd')]();};}function respondWithResult(_0x195065,_0x3ac03b){_0x3ac03b=_0x3ac03b||0xc8;return function(_0x4e1416){if(_0x4e1416){return _0x195065[_0x7abc('0xe')](_0x3ac03b)[_0x7abc('0xf')](_0x4e1416);}};}function respondWithFilteredResult(_0x3877ba,_0x2f3df3){return function(_0x2ba529){if(_0x2ba529){var _0x44009f=typeof _0x2f3df3[_0x7abc('0x10')]==='undefined'&&typeof _0x2f3df3[_0x7abc('0x11')]==='undefined';var _0x3894fa=_0x2ba529[_0x7abc('0x12')];var _0x769e92=_0x44009f?0x0:_0x2f3df3['offset'];var _0x30729f=_0x44009f?_0x2ba529['count']:_0x2f3df3[_0x7abc('0x10')]+_0x2f3df3['limit'];var _0xc7c37f;if(_0x30729f>=_0x3894fa){_0x30729f=_0x3894fa;_0xc7c37f=0xc8;}else{_0xc7c37f=0xce;}_0x3877ba['status'](_0xc7c37f);return _0x3877ba[_0x7abc('0x13')](_0x7abc('0x14'),_0x769e92+'-'+_0x30729f+'/'+_0x3894fa)[_0x7abc('0xf')](_0x2ba529);}return null;};}function saveUpdates(_0x3b334b){return function(_0x3f70a2){if(_0x3f70a2){return _0x3f70a2['update'](_0x3b334b)[_0x7abc('0x15')](function(_0x35a505){return _0x35a505;});}return null;};}function removeEntity(_0x51c8c0){return function(_0x122ea7){if(_0x122ea7){return _0x122ea7[_0x7abc('0x16')]()[_0x7abc('0x15')](function(){var _0x2038ca=_0x122ea7[_0x7abc('0x17')]({'plain':!![]});var _0x35e0dc=_0x7abc('0x18');return db['UserProfileResource'][_0x7abc('0x16')]({'where':{'type':_0x35e0dc,'resourceId':_0x2038ca['id']}})[_0x7abc('0x15')](function(){return _0x122ea7;});})[_0x7abc('0x15')](function(){_0x51c8c0[_0x7abc('0xe')](0xcc)[_0x7abc('0xd')]();});}};}function handleEntityNotFound(_0xfc901b){return function(_0x49cb68){if(!_0x49cb68){_0xfc901b[_0x7abc('0xc')](0x194);}return _0x49cb68;};}function handleError(_0x507695,_0x26fdfb){_0x26fdfb=_0x26fdfb||0x1f4;return function(_0x158120){logger['error'](_0x158120['stack']);if(_0x158120[_0x7abc('0x19')]){delete _0x158120['name'];}_0x507695['status'](_0x26fdfb)[_0x7abc('0x1a')](_0x158120);};}exports[_0x7abc('0x1b')]=function(_0x1a3536,_0x28a868){var _0x479197={};var _0x3d6b8f={'count':0x0,'rows':[]};var _0x4a361c=_[_0x7abc('0x1c')](db['MailQueue'][_0x7abc('0x1d')],function(_0x5d8453){return{'name':_0x5d8453[_0x7abc('0x1e')],'type':_0x5d8453[_0x7abc('0x1f')][_0x7abc('0x20')]};});_0x479197=qs[_0x7abc('0x21')](_0x4a361c,_0x1a3536);var _0x18955c={'where':_0x479197[_0x7abc('0x22')]};return db[_0x7abc('0x23')][_0x7abc('0x12')](_0x18955c)['then'](function(_0x25858b){_0x3d6b8f['count']=_0x25858b;_0x479197[_0x7abc('0x24')]=qs[_0x7abc('0x24')](_0x1a3536[_0x7abc('0x25')]);return db['MailQueue'][_0x7abc('0x26')](_0x479197);})[_0x7abc('0x15')](function(_0x226f95){_0x3d6b8f['rows']=_0x226f95;return _0x3d6b8f;})[_0x7abc('0x15')](respondWithFilteredResult(_0x28a868,_0x479197))[_0x7abc('0x27')](handleError(_0x28a868,null));};exports[_0x7abc('0x28')]=function(_0x4b4e41,_0x474b43){var _0x178cb1={'raw':!![],'where':{'id':_0x4b4e41[_0x7abc('0x29')]['id']}},_0x2a64cf={};_0x2a64cf[_0x7abc('0x2a')]=_[_0x7abc('0x2b')](db[_0x7abc('0x23')][_0x7abc('0x1d')]);_0x2a64cf[_0x7abc('0x25')]=_[_0x7abc('0x2b')](_0x4b4e41['query']);_0x2a64cf[_0x7abc('0x2c')]=_[_0x7abc('0x2d')](_0x2a64cf['model'],_0x2a64cf[_0x7abc('0x25')]);_0x178cb1[_0x7abc('0x2e')]=_[_0x7abc('0x2d')](_0x2a64cf[_0x7abc('0x2a')],qs[_0x7abc('0x2f')](_0x4b4e41[_0x7abc('0x25')][_0x7abc('0x2f')]));_0x178cb1[_0x7abc('0x2e')]=_0x178cb1[_0x7abc('0x2e')][_0x7abc('0x30')]?_0x178cb1['attributes']:_0x2a64cf[_0x7abc('0x2a')];if(_0x4b4e41[_0x7abc('0x25')][_0x7abc('0x31')]){_0x178cb1[_0x7abc('0x24')]=[{'all':!![]}];}_0x178cb1=_[_0x7abc('0x32')]({},_0x178cb1,_0x4b4e41[_0x7abc('0x33')]);return db[_0x7abc('0x23')][_0x7abc('0x34')](_0x178cb1)['then'](handleEntityNotFound(_0x474b43,null))[_0x7abc('0x15')](respondWithResult(_0x474b43,null))[_0x7abc('0x27')](handleError(_0x474b43,null));};exports[_0x7abc('0x35')]=function(_0x3acaac,_0x2a9e69){return db['MailQueue']['create'](_0x3acaac['body'],{})[_0x7abc('0x15')](function(_0x3e85b8){var _0x30f493=_0x3acaac[_0x7abc('0x36')]['get']({'plain':!![]});if(!_0x30f493)throw new Error(_0x7abc('0x37'));if(_0x30f493[_0x7abc('0x38')]===_0x7abc('0x36')){var _0x186749=_0x3e85b8[_0x7abc('0x17')]({'plain':!![]});var _0x293484='MailQueues';return db[_0x7abc('0x39')][_0x7abc('0x34')]({'where':{'name':_0x293484,'userProfileId':_0x30f493[_0x7abc('0x3a')]},'raw':!![]})[_0x7abc('0x15')](function(_0x5d1581){if(_0x5d1581&&_0x5d1581[_0x7abc('0x3b')]===0x0){return db[_0x7abc('0x3c')][_0x7abc('0x35')]({'name':_0x186749[_0x7abc('0x19')],'resourceId':_0x186749['id'],'type':_0x5d1581[_0x7abc('0x19')],'sectionId':_0x5d1581['id']},{})[_0x7abc('0x15')](function(){return _0x3e85b8;});}else{return _0x3e85b8;}})['catch'](function(_0x46427f){logger[_0x7abc('0x3d')](_0x7abc('0x3e'),_0x46427f);throw _0x46427f;});}return _0x3e85b8;})['then'](respondWithResult(_0x2a9e69,0xc9))[_0x7abc('0x27')](handleError(_0x2a9e69,null));};exports[_0x7abc('0x3f')]=function(_0xac293,_0x448d72){if(_0xac293[_0x7abc('0x40')]['id']){delete _0xac293[_0x7abc('0x40')]['id'];}return db[_0x7abc('0x23')][_0x7abc('0x34')]({'where':{'id':_0xac293[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](handleEntityNotFound(_0x448d72,null))[_0x7abc('0x15')](saveUpdates(_0xac293[_0x7abc('0x40')],null))[_0x7abc('0x15')](respondWithResult(_0x448d72,null))[_0x7abc('0x27')](handleError(_0x448d72,null));};exports['destroy']=function(_0x451e06,_0x42cffc){return db[_0x7abc('0x23')]['find']({'where':{'id':_0x451e06[_0x7abc('0x29')]['id']}})['then'](handleEntityNotFound(_0x42cffc,null))['then'](removeEntity(_0x42cffc,null))[_0x7abc('0x27')](handleError(_0x42cffc,null));};exports[_0x7abc('0x41')]=function(_0xa22643,_0x52d1ca){return db['MailQueue'][_0x7abc('0x41')]()[_0x7abc('0x15')](respondWithResult(_0x52d1ca,null))[_0x7abc('0x27')](handleError(_0x52d1ca,null));};exports['getMembers']=function(_0x1ad3c4,_0x326fea){var _0xab63b8={'raw':!![],'where':{}},_0x53158b={},_0x3d0041;return db[_0x7abc('0x23')][_0x7abc('0x42')]({'where':{'id':_0x1ad3c4[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](handleEntityNotFound(_0x326fea,null))['then'](function(_0x52b886){if(_0x52b886){_0x3d0041=_0x52b886[_0x7abc('0x17')]({'plain':!![]});_0x53158b['model']=_[_0x7abc('0x2b')](db['UserMailQueue']['rawAttributes']);_0x53158b[_0x7abc('0x25')]=_[_0x7abc('0x2b')](_0x1ad3c4[_0x7abc('0x25')]);_0x53158b[_0x7abc('0x2c')]=_[_0x7abc('0x2d')](_0x53158b[_0x7abc('0x2a')],_0x53158b['query']);_0xab63b8[_0x7abc('0x2e')]=_['intersection'](_0x53158b[_0x7abc('0x2a')],qs[_0x7abc('0x2f')](_0x1ad3c4['query'][_0x7abc('0x2f')]));_0xab63b8[_0x7abc('0x2e')]=_0xab63b8[_0x7abc('0x2e')][_0x7abc('0x30')]?_0xab63b8[_0x7abc('0x2e')]:_0x53158b[_0x7abc('0x2a')];if(!_0x1ad3c4[_0x7abc('0x25')][_0x7abc('0x43')](_0x7abc('0x44'))){_0xab63b8[_0x7abc('0x11')]=qs[_0x7abc('0x11')](_0x1ad3c4[_0x7abc('0x25')]['limit']);_0xab63b8[_0x7abc('0x10')]=qs[_0x7abc('0x10')](_0x1ad3c4[_0x7abc('0x25')]['offset']);}_0xab63b8[_0x7abc('0x45')]=qs[_0x7abc('0x46')](_0x1ad3c4['query'][_0x7abc('0x46')]);_0xab63b8[_0x7abc('0x22')]=qs['filters'](_[_0x7abc('0x47')](_0x1ad3c4[_0x7abc('0x25')],_0x53158b[_0x7abc('0x2c')]));_0xab63b8[_0x7abc('0x22')][_0x7abc('0x48')]=_0x52b886['id'];if(_0x1ad3c4[_0x7abc('0x25')][_0x7abc('0x49')]){_0xab63b8[_0x7abc('0x22')]=_[_0x7abc('0x32')](_0xab63b8[_0x7abc('0x22')],{'$or':_[_0x7abc('0x1c')](_0xab63b8[_0x7abc('0x2e')],function(_0x56853f){var _0x1bdb39={};_0x1bdb39[_0x56853f]={'$like':'%'+_0x1ad3c4[_0x7abc('0x25')][_0x7abc('0x49')]+'%'};return _0x1bdb39;})});}_0xab63b8=_[_0x7abc('0x32')]({},_0xab63b8,_0x1ad3c4[_0x7abc('0x33')]);return db[_0x7abc('0x4a')]['findAll'](_0xab63b8);}})[_0x7abc('0x15')](function(_0x2cf0fe){if(_0x2cf0fe){return db[_0x7abc('0x4b')][_0x7abc('0x4c')]({'where':{'id':_[_0x7abc('0x1c')](_0x2cf0fe,_0x7abc('0x4d')),'role':_0x7abc('0x4e')},'attributes':['id',_0x7abc('0x19'),_0x7abc('0x4f'),'updatedAt',_0x7abc('0x50')]});}})[_0x7abc('0x15')](function(_0x38d699){if(_0x38d699){return{'count':_0x38d699['count'],'rows':_[_0x7abc('0x1c')](_0x38d699[_0x7abc('0x51')],function(_0x1a4ef1){return{'membername':_0x1a4ef1[_0x7abc('0x19')],'UserId':_0x1a4ef1['id'],'queue_name':_0x3d0041[_0x7abc('0x19')],'MailQueueId':_0x3d0041['id'],'interface':util[_0x7abc('0x52')]('%s/%s',_0x7abc('0x53'),_0x1a4ef1[_0x7abc('0x19')]),'penalty':0x0,'paused':_0x1a4ef1[_0x7abc('0x4f')],'createdAt':_0x1a4ef1[_0x7abc('0x50')],'updatedAt':_0x1a4ef1[_0x7abc('0x54')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7abc('0x15')](respondWithFilteredResult(_0x326fea,_0xab63b8))[_0x7abc('0x27')](handleError(_0x326fea,null));};exports[_0x7abc('0x55')]=function(_0x39636c,_0xc1235e){var _0x2415aa={};var _0x4d4ad8={};var _0x59d5c8;var _0x838bd5;return db[_0x7abc('0x23')][_0x7abc('0x42')]({'where':{'id':_0x39636c['params']['id']}})['then'](handleEntityNotFound(_0xc1235e,null))[_0x7abc('0x15')](function(_0x24c156){if(_0x24c156){_0x59d5c8=_0x24c156;_0x4d4ad8[_0x7abc('0x2a')]=_[_0x7abc('0x2b')](db[_0x7abc('0x56')]['rawAttributes']);_0x4d4ad8[_0x7abc('0x25')]=_[_0x7abc('0x2b')](_0x39636c[_0x7abc('0x25')]);_0x4d4ad8['filters']=_['intersection'](_0x4d4ad8[_0x7abc('0x2a')],_0x4d4ad8[_0x7abc('0x25')]);_0x2415aa[_0x7abc('0x2e')]=_[_0x7abc('0x2d')](_0x4d4ad8[_0x7abc('0x2a')],qs[_0x7abc('0x2f')](_0x39636c[_0x7abc('0x25')]['fields']));_0x2415aa[_0x7abc('0x2e')]=_0x2415aa[_0x7abc('0x2e')][_0x7abc('0x30')]?_0x2415aa[_0x7abc('0x2e')]:_0x4d4ad8[_0x7abc('0x2a')];_0x2415aa[_0x7abc('0x45')]=qs[_0x7abc('0x46')](_0x39636c['query'][_0x7abc('0x46')]);_0x2415aa[_0x7abc('0x22')]=qs['filters'](_[_0x7abc('0x47')](_0x39636c[_0x7abc('0x25')],_0x4d4ad8[_0x7abc('0x2c')]));if(_0x39636c[_0x7abc('0x25')][_0x7abc('0x49')]){_0x2415aa[_0x7abc('0x22')]=_[_0x7abc('0x32')](_0x2415aa[_0x7abc('0x22')],{'$or':_['map'](_0x2415aa[_0x7abc('0x2e')],function(_0xfdde0c){var _0x504661={};_0x504661[_0xfdde0c]={'$like':'%'+_0x39636c['query'][_0x7abc('0x49')]+'%'};return _0x504661;})});}_0x2415aa=_['merge']({},_0x2415aa,_0x39636c[_0x7abc('0x33')]);return _0x59d5c8['getTeams'](_0x2415aa);}})[_0x7abc('0x15')](function(_0x33f367){if(_0x33f367){_0x838bd5=_0x33f367[_0x7abc('0x30')];if(!_0x39636c[_0x7abc('0x25')][_0x7abc('0x43')]('nolimit')){_0x2415aa[_0x7abc('0x11')]=qs['limit'](_0x39636c[_0x7abc('0x25')][_0x7abc('0x11')]);_0x2415aa['offset']=qs[_0x7abc('0x10')](_0x39636c[_0x7abc('0x25')][_0x7abc('0x10')]);}return _0x59d5c8[_0x7abc('0x55')](_0x2415aa);}})['then'](function(_0x59dc3f){if(_0x59dc3f){return _0x59dc3f?{'count':_0x838bd5,'rows':_0x59dc3f}:null;}})[_0x7abc('0x15')](respondWithResult(_0xc1235e,null))[_0x7abc('0x27')](handleError(_0xc1235e,null));};exports[_0x7abc('0x57')]=function(_0x5be033,_0x4b3a7a){var _0x49c0ae=_0x5be033[_0x7abc('0x40')][_0x7abc('0x58')];return db[_0x7abc('0x56')][_0x7abc('0x26')]({'where':{'id':_0x49c0ae},'attributes':['id'],'include':[{'model':db[_0x7abc('0x4b')],'as':_0x7abc('0x59'),'attributes':['id',_0x7abc('0x19'),'online',_0x7abc('0x5a'),_0x7abc('0x5b')],'raw':!![]}]})[_0x7abc('0x15')](function(_0x439c5d){if(_0x439c5d){var _0x32e3ad=_[_0x7abc('0x5c')](_0x439c5d,function(_0x4c9f26){var _0x18d54b=_0x4c9f26['get']({'plain':!![]});return _0x18d54b[_0x7abc('0x59')];});return db[_0x7abc('0x23')]['find']({'where':{'id':_0x5be033[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](function(_0x53422a){return db[_0x7abc('0x5d')][_0x7abc('0x5e')](function(_0x428fb1){return _0x53422a['addTeams'](_0x49c0ae,{'transaction':_0x428fb1})['then'](function(){return BPromise[_0x7abc('0x5f')](_0x32e3ad,function(_0x245f5c){return db[_0x7abc('0x4a')][_0x7abc('0x60')]({'where':{'UserId':_0x245f5c['id'],'MailQueueId':_0x5be033[_0x7abc('0x29')]['id']},'transaction':_0x428fb1});});})[_0x7abc('0x15')](function(){_0x32e3ad['forEach'](function(_0x3ed9d9){socket['emit'](_0x7abc('0x61'),{'UserId':_0x3ed9d9['id'],'MailQueueId':_0x53422a['id']});});});});});}})[_0x7abc('0x15')](respondWithStatusCode(_0x4b3a7a,null))[_0x7abc('0x27')](handleError(_0x4b3a7a,null));};exports[_0x7abc('0x62')]=function(_0x298c8b,_0x21f6f3){return db['Team'][_0x7abc('0x26')]({'where':{'id':_0x298c8b[_0x7abc('0x25')][_0x7abc('0x58')]},'attributes':['id'],'include':[{'model':db[_0x7abc('0x4b')],'as':_0x7abc('0x59'),'attributes':['id'],'raw':!![]}]})[_0x7abc('0x15')](handleEntityNotFound(_0x21f6f3,null))['then'](function(_0x15dcaa){var _0x342862=_[_0x7abc('0x1c')](_0x15dcaa,'id');var _0x51ee0d=[];var _0x4b12be=[];var _0x4a173e=squel[_0x7abc('0x63')]();_0x4a173e['field']('tq.TeamId')[_0x7abc('0x64')]('team_has_mail_queues','tq')[_0x7abc('0x65')](_0x7abc('0x66'),'ut',_0x7abc('0x67'))[_0x7abc('0x22')](_0x7abc('0x68'),_0x298c8b[_0x7abc('0x29')]['id']);for(var _0x3dc8b8=0x0;_0x3dc8b8<_0x15dcaa['length'];_0x3dc8b8+=0x1){let _0x490ff6=_0x15dcaa[_0x3dc8b8];for(var _0x434034=0x0;_0x434034<_0x490ff6[_0x7abc('0x59')][_0x7abc('0x30')];_0x434034+=0x1){let _0x3967e8=_0x490ff6[_0x7abc('0x59')][_0x434034];var _0x11647d=_0x4a173e['clone']();_0x11647d[_0x7abc('0x22')](_0x7abc('0x69'),_0x3967e8['id']);_0x4b12be[_0x7abc('0x6a')](db[_0x7abc('0x5d')][_0x7abc('0x25')](_0x11647d['toString'](),{'type':db[_0x7abc('0x5d')][_0x7abc('0x6b')][_0x7abc('0x6c')]})[_0x7abc('0x15')](function(_0x2ae291){if(_0x2ae291[_0x7abc('0x30')]===0x1){return _0x3967e8['id'];}else{var _0x437122=_[_0x7abc('0x6d')](_[_0x7abc('0x1c')](_0x2ae291,_0x7abc('0x6e')),function(_0x19f93b){return _[_0x7abc('0x6f')](_0x342862,_0x19f93b);});if(_0x437122){return _0x3967e8['id'];}}}));}}return BPromise[_0x7abc('0x70')](_0x4b12be)[_0x7abc('0x15')](function(_0x44ea0d){_0x51ee0d=_(_0x51ee0d)[_0x7abc('0x71')](_0x44ea0d)['compact']()['value']();return db['MailQueue'][_0x7abc('0x34')]({'where':{'id':_0x298c8b[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](function(_0x552d3d){return db[_0x7abc('0x5d')][_0x7abc('0x5e')](function(_0x5ed941){return _0x552d3d[_0x7abc('0x62')](_0x298c8b[_0x7abc('0x25')][_0x7abc('0x58')],{'transaction':_0x5ed941})['then'](function(){if(!_[_0x7abc('0x72')](_0x51ee0d)){return _0x552d3d['removeAgents'](_0x51ee0d,{'transaction':_0x5ed941});}})[_0x7abc('0x15')](function(){_0x51ee0d['forEach'](function(_0x54ef28){socket[_0x7abc('0x73')](_0x7abc('0x74'),{'UserId':_0x54ef28,'MailQueueId':_0x552d3d['id']});});});});});});})[_0x7abc('0x15')](respondWithStatusCode(_0x21f6f3,null))[_0x7abc('0x27')](handleError(_0x21f6f3,null));};exports['addAgents']=function(_0x4397c7,_0x168696){return db['MailQueue']['find']({'where':{'id':_0x4397c7[_0x7abc('0x29')]['id']}})['then'](handleEntityNotFound(_0x168696,null))[_0x7abc('0x15')](function(_0x17f252){if(_0x17f252){return _0x17f252[_0x7abc('0x75')](_0x4397c7['body']['ids'],_[_0x7abc('0x76')](_0x4397c7['body'],[_0x7abc('0x58'),'id'])||{})['spread'](function(_0x3bec94){for(var _0x17bd32=0x0;_0x17bd32<_0x4397c7[_0x7abc('0x40')][_0x7abc('0x58')][_0x7abc('0x30')];_0x17bd32+=0x1){socket['emit'](_0x7abc('0x61'),{'UserId':Number(_0x4397c7[_0x7abc('0x40')][_0x7abc('0x58')][_0x17bd32]),'MailQueueId':Number(_0x4397c7[_0x7abc('0x29')]['id'])});}return _0x3bec94;});}})[_0x7abc('0x15')](respondWithResult(_0x168696,null))[_0x7abc('0x27')](handleError(_0x168696,null));};exports[_0x7abc('0x77')]=function(_0x5401cd,_0x34ca6f){return db[_0x7abc('0x23')]['find']({'where':{'id':_0x5401cd['params']['id']}})[_0x7abc('0x15')](handleEntityNotFound(_0x34ca6f,null))[_0x7abc('0x15')](function(_0x528ca5){if(_0x528ca5){return _0x528ca5['removeAgents'](_0x5401cd['query'][_0x7abc('0x58')])[_0x7abc('0x15')](function(){if(_[_0x7abc('0x78')](_0x5401cd[_0x7abc('0x25')][_0x7abc('0x58')])){for(var _0x3c963f=0x0;_0x3c963f<_0x5401cd[_0x7abc('0x25')]['ids'][_0x7abc('0x30')];_0x3c963f+=0x1){socket[_0x7abc('0x73')](_0x7abc('0x74'),{'UserId':Number(_0x5401cd[_0x7abc('0x25')][_0x7abc('0x58')][_0x3c963f]),'MailQueueId':Number(_0x5401cd[_0x7abc('0x29')]['id'])});}}else{socket[_0x7abc('0x73')](_0x7abc('0x74'),{'UserId':Number(_0x5401cd[_0x7abc('0x25')]['ids']),'MailQueueId':Number(_0x5401cd[_0x7abc('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x34ca6f,null))[_0x7abc('0x27')](handleError(_0x34ca6f,null));};exports[_0x7abc('0x79')]=function(_0x55414f,_0x569c39){var _0x377335={};var _0x248ff5={};var _0x3bdd1e;var _0x202cee;return db['MailQueue'][_0x7abc('0x42')]({'where':{'id':_0x55414f[_0x7abc('0x29')]['id']}})[_0x7abc('0x15')](handleEntityNotFound(_0x569c39,null))[_0x7abc('0x15')](function(_0x42188d){if(_0x42188d){_0x3bdd1e=_0x42188d;_0x248ff5[_0x7abc('0x2a')]=_[_0x7abc('0x2b')](db[_0x7abc('0x4b')][_0x7abc('0x1d')]);_0x248ff5[_0x7abc('0x25')]=_[_0x7abc('0x2b')](_0x55414f[_0x7abc('0x25')]);_0x248ff5[_0x7abc('0x2c')]=_[_0x7abc('0x2d')](_0x248ff5[_0x7abc('0x2a')],_0x248ff5[_0x7abc('0x25')]);_0x377335[_0x7abc('0x2e')]=_[_0x7abc('0x2d')](_0x248ff5[_0x7abc('0x2a')],qs['fields'](_0x55414f[_0x7abc('0x25')][_0x7abc('0x2f')]));_0x377335[_0x7abc('0x2e')]=_0x377335[_0x7abc('0x2e')][_0x7abc('0x30')]?_0x377335[_0x7abc('0x2e')]:_0x248ff5[_0x7abc('0x2a')];_0x377335[_0x7abc('0x45')]=qs[_0x7abc('0x46')](_0x55414f[_0x7abc('0x25')][_0x7abc('0x46')]);_0x377335[_0x7abc('0x22')]=qs[_0x7abc('0x2c')](_['pick'](_0x55414f[_0x7abc('0x25')],_0x248ff5[_0x7abc('0x2c')]));if(_0x55414f[_0x7abc('0x25')][_0x7abc('0x49')]){_0x377335[_0x7abc('0x22')]=_[_0x7abc('0x32')](_0x377335[_0x7abc('0x22')],{'$or':_[_0x7abc('0x1c')](_0x377335[_0x7abc('0x2e')],function(_0x488a57){var _0x4532fe={};_0x4532fe[_0x488a57]={'$like':'%'+_0x55414f['query']['filter']+'%'};return _0x4532fe;})});}_0x377335=_[_0x7abc('0x32')]({},_0x377335,_0x55414f['options']);return _0x3bdd1e[_0x7abc('0x79')](_0x377335);}})['then'](function(_0x18906f){if(_0x18906f){_0x202cee=_0x18906f[_0x7abc('0x30')];if(!_0x55414f['query'][_0x7abc('0x43')](_0x7abc('0x44'))){_0x377335[_0x7abc('0x11')]=qs['limit'](_0x55414f[_0x7abc('0x25')][_0x7abc('0x11')]);_0x377335[_0x7abc('0x10')]=qs[_0x7abc('0x10')](_0x55414f[_0x7abc('0x25')][_0x7abc('0x10')]);}return _0x3bdd1e[_0x7abc('0x79')](_0x377335);}})['then'](function(_0x112883){if(_0x112883){return _0x112883?{'count':_0x202cee,'rows':_0x112883}:null;}})[_0x7abc('0x15')](respondWithResult(_0x569c39,null))[_0x7abc('0x27')](handleError(_0x569c39,null));};
\ No newline at end of file
index ba6c3ae..7bba8c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x092d=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','remove','emit'];(function(_0x4d07cc,_0x587613){var _0x42de3b=function(_0x201f78){while(--_0x201f78){_0x4d07cc['push'](_0x4d07cc['shift']());}};_0x42de3b(++_0x587613);}(_0x092d,0x137));var _0xd092=function(_0x13062b,_0x285d7d){_0x13062b=_0x13062b-0x0;var _0x564586=_0x092d[_0x13062b];return _0x564586;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xd092('0x0'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xd092('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd092('0x2')};function emitEvent(_0x1d58c0){return function(_0x4e45b1,_0x353cc0,_0x208a25){MailQueueEvents[_0xd092('0x3')](_0x1d58c0+':'+_0x4e45b1['id'],_0x4e45b1);MailQueueEvents[_0xd092('0x3')](_0x1d58c0,_0x4e45b1);_0x208a25(null);};}for(var e in events){if(events[_0xd092('0x4')](e)){var event=events[e];MailQueue[_0xd092('0x5')](e,emitEvent(event));}}module[_0xd092('0x6')]=MailQueueEvents;
\ No newline at end of file
+var _0x3aea=['save','remove','emit','hasOwnProperty','hook'];(function(_0x545720,_0x3a398d){var _0x26b171=function(_0x49990c){while(--_0x49990c){_0x545720['push'](_0x545720['shift']());}};_0x26b171(++_0x3a398d);}(_0x3aea,0x140));var _0xa3ae=function(_0x4b56ac,_0x2f1d0b){_0x4b56ac=_0x4b56ac-0x0;var _0x5e995a=_0x3aea[_0x4b56ac];return _0x5e995a;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa3ae('0x0'),'afterUpdate':'update','afterDestroy':_0xa3ae('0x1')};function emitEvent(_0x37de7f){return function(_0x1bf508,_0x1392e1,_0x2fce5f){MailQueueEvents[_0xa3ae('0x2')](_0x37de7f+':'+_0x1bf508['id'],_0x1bf508);MailQueueEvents[_0xa3ae('0x2')](_0x37de7f,_0x1bf508);_0x2fce5f(null);};}for(var e in events){if(events[_0xa3ae('0x3')](e)){var event=events[e];MailQueue[_0xa3ae('0x4')](e,emitEvent(event));}}module['exports']=MailQueueEvents;
\ No newline at end of file
index 64ca0f2..8ff4a31 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9fe3=['request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fe3,0x156));var _0x39fe=function(_0x466bc5,_0x3a0f2a){_0x466bc5=_0x466bc5-0x0;var _0x138952=_0x9fe3[_0x466bc5];return _0x138952;};'use strict';var _=require(_0x39fe('0x0'));var util=require(_0x39fe('0x1'));var logger=require(_0x39fe('0x2'))(_0x39fe('0x3'));var moment=require(_0x39fe('0x4'));var BPromise=require(_0x39fe('0x5'));var rp=require(_0x39fe('0x6'));var fs=require('fs');var path=require(_0x39fe('0x7'));var rimraf=require(_0x39fe('0x8'));var config=require(_0x39fe('0x9'));var attributes=require(_0x39fe('0xa'));module['exports']=function(_0x30c999,_0x1bfb45){return _0x30c999[_0x39fe('0xb')]('MailQueue',attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8264=['bluebird','path','rimraf','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','util','../../config/logger','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8264,0x1d1));var _0x4826=function(_0x3d2d6f,_0x368872){_0x3d2d6f=_0x3d2d6f-0x0;var _0x5c0022=_0x8264[_0x3d2d6f];return _0x5c0022;};'use strict';var _=require('lodash');var util=require(_0x4826('0x0'));var logger=require(_0x4826('0x1'))('api');var moment=require(_0x4826('0x2'));var BPromise=require(_0x4826('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4826('0x4'));var rimraf=require(_0x4826('0x5'));var config=require(_0x4826('0x6'));var attributes=require(_0x4826('0x7'));module[_0x4826('0x8')]=function(_0x3d67a1,_0x1bde53){return _0x3d67a1[_0x4826('0x9')](_0x4826('0xa'),attributes,{'tableName':_0x4826('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4afcb72..05f9d81 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c70=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','debug','request\x20sent','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','where','attributes','limit','include','map','model','ShowMailQueue','find','raw'];(function(_0x46e735,_0x5207a4){var _0x3cd288=function(_0x36eeaa){while(--_0x36eeaa){_0x46e735['push'](_0x46e735['shift']());}};_0x3cd288(++_0x5207a4);}(_0x5c70,0x102));var _0x05c7=function(_0xf670c7,_0x252e78){_0xf670c7=_0xf670c7-0x0;var _0x3aefa7=_0x5c70[_0xf670c7];return _0x3aefa7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x05c7('0x0'));var BPromise=require(_0x05c7('0x1'));var rs=require(_0x05c7('0x2'));var fs=require('fs');var Redis=require(_0x05c7('0x3'));var db=require(_0x05c7('0x4'))['db'];var utils=require(_0x05c7('0x5'));var logger=require(_0x05c7('0x6'))(_0x05c7('0x7'));var config=require(_0x05c7('0x8'));var jayson=require(_0x05c7('0x9'));var client=jayson[_0x05c7('0xa')][_0x05c7('0xb')]({'port':0x232a});config[_0x05c7('0xc')]=_[_0x05c7('0xd')](config['redis'],{'host':_0x05c7('0xe'),'port':0x18eb});var socket=require(_0x05c7('0xf'))(new Redis(config[_0x05c7('0xc')]));require(_0x05c7('0x10'))[_0x05c7('0x11')](socket);function respondWithRpcPromise(_0x26b9d8,_0x2e331b,_0x355053){return new BPromise(function(_0x2ea087,_0x2b6c28){return client[_0x05c7('0x12')](_0x26b9d8,_0x355053)[_0x05c7('0x13')](function(_0x4ccd02){logger['info']('MailQueue,\x20%s,\x20%s',_0x2e331b,'request\x20sent');logger[_0x05c7('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x2e331b,_0x05c7('0x15'),JSON[_0x05c7('0x16')](_0x4ccd02));if(_0x4ccd02[_0x05c7('0x17')]){if(_0x4ccd02[_0x05c7('0x17')][_0x05c7('0x18')]===0x1f4){logger[_0x05c7('0x17')](_0x05c7('0x19'),_0x2e331b,_0x4ccd02[_0x05c7('0x17')][_0x05c7('0x1a')]);return _0x2b6c28(_0x4ccd02[_0x05c7('0x17')][_0x05c7('0x1a')]);}logger['error'](_0x05c7('0x19'),_0x2e331b,_0x4ccd02[_0x05c7('0x17')][_0x05c7('0x1a')]);return _0x2ea087(_0x4ccd02[_0x05c7('0x17')][_0x05c7('0x1a')]);}else{logger[_0x05c7('0x1b')](_0x05c7('0x19'),_0x2e331b,_0x05c7('0x15'));_0x2ea087(_0x4ccd02[_0x05c7('0x1c')][_0x05c7('0x1a')]);}})[_0x05c7('0x1d')](function(_0x42608e){logger['error'](_0x05c7('0x19'),_0x2e331b,_0x42608e);_0x2b6c28(_0x42608e);});});}exports[_0x05c7('0x1e')]=function(_0x650270){var _0x561b9d=this;return new Promise(function(_0x21ed11,_0x1091f4){return db[_0x05c7('0x1f')][_0x05c7('0x20')]({'raw':_0x650270[_0x05c7('0x21')]?_0x650270[_0x05c7('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x650270[_0x05c7('0x21')]?_0x650270[_0x05c7('0x21')][_0x05c7('0x22')]||null:null,'attributes':_0x650270[_0x05c7('0x21')]?_0x650270[_0x05c7('0x21')][_0x05c7('0x23')]||null:null,'limit':_0x650270['options']?_0x650270[_0x05c7('0x21')][_0x05c7('0x24')]||null:null,'include':_0x650270[_0x05c7('0x21')]?_0x650270[_0x05c7('0x21')][_0x05c7('0x25')]?_[_0x05c7('0x26')](_0x650270[_0x05c7('0x21')]['include'],function(_0x2abc92){return{'model':db[_0x2abc92[_0x05c7('0x27')]],'as':_0x2abc92['as'],'attributes':_0x2abc92[_0x05c7('0x23')],'include':_0x2abc92[_0x05c7('0x25')]?_['map'](_0x2abc92[_0x05c7('0x25')],function(_0x33b885){return{'model':db[_0x33b885[_0x05c7('0x27')]],'as':_0x33b885['as'],'attributes':_0x33b885[_0x05c7('0x23')],'include':_0x33b885[_0x05c7('0x25')]?_[_0x05c7('0x26')](_0x33b885[_0x05c7('0x25')],function(_0x4c27bc){return{'model':db[_0x4c27bc[_0x05c7('0x27')]],'as':_0x4c27bc['as'],'attributes':_0x4c27bc[_0x05c7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x05c7('0x13')](function(_0x588975){logger[_0x05c7('0x1b')](_0x05c7('0x1e'),_0x650270);logger[_0x05c7('0x14')]('GetMailQueue',_0x650270,JSON['stringify'](_0x588975));_0x21ed11(_0x588975);})[_0x05c7('0x1d')](function(_0x3e3df2){logger[_0x05c7('0x17')](_0x05c7('0x1e'),_0x3e3df2[_0x05c7('0x1a')],_0x650270);_0x1091f4(_0x561b9d[_0x05c7('0x17')](0x1f4,_0x3e3df2[_0x05c7('0x1a')]));});});};exports[_0x05c7('0x28')]=function(_0x2daf79){var _0x1bd05c=this;return new Promise(function(_0x312222,_0x24a160){return db[_0x05c7('0x1f')][_0x05c7('0x29')]({'raw':_0x2daf79[_0x05c7('0x21')]?_0x2daf79[_0x05c7('0x21')][_0x05c7('0x2a')]===undefined?!![]:![]:!![],'where':_0x2daf79[_0x05c7('0x21')]?_0x2daf79['options'][_0x05c7('0x22')]||null:null,'attributes':_0x2daf79['options']?_0x2daf79['options'][_0x05c7('0x23')]||null:null,'include':_0x2daf79[_0x05c7('0x21')]?_0x2daf79[_0x05c7('0x21')][_0x05c7('0x25')]?_['map'](_0x2daf79[_0x05c7('0x21')][_0x05c7('0x25')],function(_0x5dd100){return{'model':db[_0x5dd100['model']],'as':_0x5dd100['as'],'attributes':_0x5dd100['attributes'],'include':_0x5dd100[_0x05c7('0x25')]?_[_0x05c7('0x26')](_0x5dd100[_0x05c7('0x25')],function(_0x5c10ae){return{'model':db[_0x5c10ae[_0x05c7('0x27')]],'as':_0x5c10ae['as'],'attributes':_0x5c10ae[_0x05c7('0x23')],'include':_0x5c10ae['include']?_[_0x05c7('0x26')](_0x5c10ae[_0x05c7('0x25')],function(_0x3ed66e){return{'model':db[_0x3ed66e[_0x05c7('0x27')]],'as':_0x3ed66e['as'],'attributes':_0x3ed66e[_0x05c7('0x23')]};}):[]};}):[]};}):[]:[]})[_0x05c7('0x13')](function(_0x1e5183){logger[_0x05c7('0x1b')]('ShowMailQueue',_0x2daf79);logger['debug'](_0x05c7('0x28'),_0x2daf79,JSON[_0x05c7('0x16')](_0x1e5183));_0x312222(_0x1e5183);})['catch'](function(_0x2c3587){logger['error'](_0x05c7('0x28'),_0x2c3587[_0x05c7('0x1a')],_0x2daf79);_0x24a160(_0x1bd05c['error'](0x1f4,_0x2c3587[_0x05c7('0x1a')]));});});};
\ No newline at end of file
+var _0xf692=['info','result','catch','GetMailQueue','options','raw','where','attributes','limit','model','include','map','ShowMailQueue','MailQueue','find','lodash','bluebird','randomstring','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5a5a88,_0x5d0b5b){var _0x2c7efb=function(_0x3cf2d6){while(--_0x3cf2d6){_0x5a5a88['push'](_0x5a5a88['shift']());}};_0x2c7efb(++_0x5d0b5b);}(_0xf692,0x1f0));var _0x2f69=function(_0x17725e,_0x5dddf0){_0x17725e=_0x17725e-0x0;var _0x56a392=_0xf692[_0x17725e];return _0x56a392;};'use strict';var _=require(_0x2f69('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2f69('0x1'));var rs=require(_0x2f69('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2f69('0x3'));var logger=require('../../config/logger')(_0x2f69('0x4'));var config=require(_0x2f69('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2f69('0x6')]['http']({'port':0x232a});config[_0x2f69('0x7')]=_[_0x2f69('0x8')](config[_0x2f69('0x7')],{'host':_0x2f69('0x9'),'port':0x18eb});var socket=require(_0x2f69('0xa'))(new Redis(config['redis']));require(_0x2f69('0xb'))[_0x2f69('0xc')](socket);function respondWithRpcPromise(_0x257366,_0x1da749,_0x874734){return new BPromise(function(_0x5883e7,_0x59e928){return client['request'](_0x257366,_0x874734)[_0x2f69('0xd')](function(_0x123b96){logger['info'](_0x2f69('0xe'),_0x1da749,_0x2f69('0xf'));logger[_0x2f69('0x10')](_0x2f69('0x11'),_0x1da749,_0x2f69('0xf'),JSON[_0x2f69('0x12')](_0x123b96));if(_0x123b96[_0x2f69('0x13')]){if(_0x123b96[_0x2f69('0x13')][_0x2f69('0x14')]===0x1f4){logger[_0x2f69('0x13')](_0x2f69('0xe'),_0x1da749,_0x123b96[_0x2f69('0x13')][_0x2f69('0x15')]);return _0x59e928(_0x123b96[_0x2f69('0x13')]['message']);}logger[_0x2f69('0x13')](_0x2f69('0xe'),_0x1da749,_0x123b96[_0x2f69('0x13')][_0x2f69('0x15')]);return _0x5883e7(_0x123b96[_0x2f69('0x13')][_0x2f69('0x15')]);}else{logger[_0x2f69('0x16')]('MailQueue,\x20%s,\x20%s',_0x1da749,_0x2f69('0xf'));_0x5883e7(_0x123b96[_0x2f69('0x17')][_0x2f69('0x15')]);}})[_0x2f69('0x18')](function(_0x3a6bb6){logger['error'](_0x2f69('0xe'),_0x1da749,_0x3a6bb6);_0x59e928(_0x3a6bb6);});});}exports[_0x2f69('0x19')]=function(_0x474316){var _0x27d7e1=this;return new Promise(function(_0x2efea4,_0x373462){return db['MailQueue']['findAll']({'raw':_0x474316[_0x2f69('0x1a')]?_0x474316[_0x2f69('0x1a')][_0x2f69('0x1b')]===undefined?!![]:![]:!![],'where':_0x474316['options']?_0x474316[_0x2f69('0x1a')][_0x2f69('0x1c')]||null:null,'attributes':_0x474316[_0x2f69('0x1a')]?_0x474316[_0x2f69('0x1a')][_0x2f69('0x1d')]||null:null,'limit':_0x474316[_0x2f69('0x1a')]?_0x474316[_0x2f69('0x1a')][_0x2f69('0x1e')]||null:null,'include':_0x474316[_0x2f69('0x1a')]?_0x474316[_0x2f69('0x1a')]['include']?_['map'](_0x474316['options']['include'],function(_0x3bf950){return{'model':db[_0x3bf950[_0x2f69('0x1f')]],'as':_0x3bf950['as'],'attributes':_0x3bf950[_0x2f69('0x1d')],'include':_0x3bf950[_0x2f69('0x20')]?_['map'](_0x3bf950[_0x2f69('0x20')],function(_0xe7a8d3){return{'model':db[_0xe7a8d3[_0x2f69('0x1f')]],'as':_0xe7a8d3['as'],'attributes':_0xe7a8d3['attributes'],'include':_0xe7a8d3[_0x2f69('0x20')]?_[_0x2f69('0x21')](_0xe7a8d3['include'],function(_0x4499b6){return{'model':db[_0x4499b6[_0x2f69('0x1f')]],'as':_0x4499b6['as'],'attributes':_0x4499b6[_0x2f69('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2f69('0xd')](function(_0x46772e){logger['info']('GetMailQueue',_0x474316);logger[_0x2f69('0x10')](_0x2f69('0x19'),_0x474316,JSON[_0x2f69('0x12')](_0x46772e));_0x2efea4(_0x46772e);})[_0x2f69('0x18')](function(_0x2787e7){logger[_0x2f69('0x13')](_0x2f69('0x19'),_0x2787e7['message'],_0x474316);_0x373462(_0x27d7e1[_0x2f69('0x13')](0x1f4,_0x2787e7['message']));});});};exports[_0x2f69('0x22')]=function(_0x2afb11){var _0x3a4242=this;return new Promise(function(_0x214d18,_0x490b6b){return db[_0x2f69('0x23')][_0x2f69('0x24')]({'raw':_0x2afb11['options']?_0x2afb11['options']['raw']===undefined?!![]:![]:!![],'where':_0x2afb11[_0x2f69('0x1a')]?_0x2afb11[_0x2f69('0x1a')][_0x2f69('0x1c')]||null:null,'attributes':_0x2afb11[_0x2f69('0x1a')]?_0x2afb11[_0x2f69('0x1a')]['attributes']||null:null,'include':_0x2afb11[_0x2f69('0x1a')]?_0x2afb11[_0x2f69('0x1a')]['include']?_[_0x2f69('0x21')](_0x2afb11[_0x2f69('0x1a')]['include'],function(_0x437dfd){return{'model':db[_0x437dfd['model']],'as':_0x437dfd['as'],'attributes':_0x437dfd[_0x2f69('0x1d')],'include':_0x437dfd[_0x2f69('0x20')]?_[_0x2f69('0x21')](_0x437dfd[_0x2f69('0x20')],function(_0x3879f1){return{'model':db[_0x3879f1[_0x2f69('0x1f')]],'as':_0x3879f1['as'],'attributes':_0x3879f1[_0x2f69('0x1d')],'include':_0x3879f1[_0x2f69('0x20')]?_['map'](_0x3879f1['include'],function(_0x1650e2){return{'model':db[_0x1650e2[_0x2f69('0x1f')]],'as':_0x1650e2['as'],'attributes':_0x1650e2[_0x2f69('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fb4d9){logger[_0x2f69('0x16')](_0x2f69('0x22'),_0x2afb11);logger['debug']('ShowMailQueue',_0x2afb11,JSON[_0x2f69('0x12')](_0x3fb4d9));_0x214d18(_0x3fb4d9);})[_0x2f69('0x18')](function(_0x47f305){logger[_0x2f69('0x13')](_0x2f69('0x22'),_0x47f305[_0x2f69('0x15')],_0x2afb11);_0x490b6b(_0x3a4242[_0x2f69('0x13')](0x1f4,_0x47f305['message']));});});};
\ No newline at end of file
index 4c80619..374f2dc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b97=['remove','update','removeListener','length'];(function(_0xdb951d,_0x1dc42b){var _0x5e789e=function(_0x1056cd){while(--_0x1056cd){_0xdb951d['push'](_0xdb951d['shift']());}};_0x5e789e(++_0x1dc42b);}(_0x5b97,0xac));var _0x75b9=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0x5b97[_0x6c0123];return _0x5a87d2;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0x75b9('0x0'),_0x75b9('0x1')];function createListener(_0x2399f9,_0x411019){return function(_0x52fcee){_0x411019['emit'](_0x2399f9,_0x52fcee);};}function removeListener(_0x192a86,_0x11287d){return function(){MailQueueEvents[_0x75b9('0x2')](_0x192a86,_0x11287d);};}exports['register']=function(_0x4a3774){for(var _0x4c070e=0x0,_0x44184c=events[_0x75b9('0x3')];_0x4c070e<_0x44184c;_0x4c070e++){var _0xfc59d4=events[_0x4c070e];var _0x4296ac=createListener('mailQueue:'+_0xfc59d4,_0x4a3774);MailQueueEvents['on'](_0xfc59d4,_0x4296ac);}};
\ No newline at end of file
+var _0x1a95=['emit','removeListener','register','mailQueue:','./mailQueue.events','remove'];(function(_0x4c542e,_0x5e37c1){var _0x156631=function(_0x583045){while(--_0x583045){_0x4c542e['push'](_0x4c542e['shift']());}};_0x156631(++_0x5e37c1);}(_0x1a95,0x130));var _0x51a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1a95[_0x321bb2];return _0x9c12ed;};'use strict';var MailQueueEvents=require(_0x51a9('0x0'));var events=['save',_0x51a9('0x1'),'update'];function createListener(_0x381d20,_0x465452){return function(_0x5a2470){_0x465452[_0x51a9('0x2')](_0x381d20,_0x5a2470);};}function removeListener(_0xc84688,_0x440cdc){return function(){MailQueueEvents[_0x51a9('0x3')](_0xc84688,_0x440cdc);};}exports[_0x51a9('0x4')]=function(_0x207e40){for(var _0x432df4=0x0,_0x4bd836=events['length'];_0x432df4<_0x4bd836;_0x432df4++){var _0x425950=events[_0x432df4];var _0x257001=createListener(_0x51a9('0x5')+_0x425950,_0x207e40);MailQueueEvents['on'](_0x425950,_0x257001);}};
\ No newline at end of file
index 0466d8b..a6c833b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3481=['../../config/environment','./mailQueueReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','update','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service'];(function(_0x59e821,_0x86c723){var _0x5333f6=function(_0x5dc2c9){while(--_0x5dc2c9){_0x59e821['push'](_0x59e821['shift']());}};_0x5333f6(++_0x86c723);}(_0x3481,0x13d));var _0x1348=function(_0xd3768e,_0x2d963d){_0xd3768e=_0xd3768e-0x0;var _0xe9aa5e=_0x3481[_0xd3768e];return _0xe9aa5e;};'use strict';var multer=require(_0x1348('0x0'));var util=require(_0x1348('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1348('0x2'));var router=express[_0x1348('0x3')]();var fs_extra=require(_0x1348('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1348('0x5'));var config=require(_0x1348('0x6'));var controller=require(_0x1348('0x7'));router[_0x1348('0x8')]('/',auth['isAuthenticated'](),controller[_0x1348('0x9')]);router[_0x1348('0x8')](_0x1348('0xa'),auth['isAuthenticated'](),controller[_0x1348('0xb')]);router['get'](_0x1348('0xc'),auth[_0x1348('0xd')](),controller[_0x1348('0xe')]);router[_0x1348('0xf')]('/',auth[_0x1348('0xd')](),controller['create']);router['put']('/:id',auth[_0x1348('0xd')](),controller[_0x1348('0x10')]);router[_0x1348('0x11')](_0x1348('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x1348('0x12')]=router;
\ No newline at end of file
+var _0x9090=['multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9090,0x1e0));var _0x0909=function(_0x52d22a,_0x461b49){_0x52d22a=_0x52d22a-0x0;var _0x5cbde6=_0x9090[_0x52d22a];return _0x5cbde6;};'use strict';var multer=require(_0x0909('0x0'));var util=require('util');var path=require(_0x0909('0x1'));var timeout=require(_0x0909('0x2'));var express=require('express');var router=express[_0x0909('0x3')]();var fs_extra=require(_0x0909('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0909('0x5'));var config=require(_0x0909('0x6'));var controller=require('./mailQueueReport.controller');router[_0x0909('0x7')]('/',auth[_0x0909('0x8')](),controller[_0x0909('0x9')]);router[_0x0909('0x7')](_0x0909('0xa'),auth[_0x0909('0x8')](),controller[_0x0909('0xb')]);router['get'](_0x0909('0xc'),auth[_0x0909('0x8')](),controller[_0x0909('0xd')]);router[_0x0909('0xe')]('/',auth[_0x0909('0x8')](),controller[_0x0909('0xf')]);router['put'](_0x0909('0xc'),auth[_0x0909('0x8')](),controller[_0x0909('0x10')]);router[_0x0909('0x11')](_0x0909('0xc'),auth[_0x0909('0x8')](),controller[_0x0909('0x12')]);module[_0x0909('0x13')]=router;
\ No newline at end of file
index 920fea3..130389d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x61c7=['STRING','DATE','exports'];(function(_0x3dd98a,_0xfd3c6){var _0x404ef2=function(_0x4e659b){while(--_0x4e659b){_0x3dd98a['push'](_0x3dd98a['shift']());}};_0x404ef2(++_0xfd3c6);}(_0x61c7,0x176));var _0x761c=function(_0x604fc6,_0x35e640){_0x604fc6=_0x604fc6-0x0;var _0xdaa9ba=_0x61c7[_0x604fc6];return _0xdaa9ba;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x761c('0x0')]={'uniqueid':{'type':Sequelize[_0x761c('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x761c('0x2')]},'leaveAt':{'type':Sequelize[_0x761c('0x2')]},'acceptAt':{'type':Sequelize[_0x761c('0x2')]},'exitAt':{'type':Sequelize[_0x761c('0x2')]},'reason':{'type':Sequelize[_0x761c('0x1')]}};
\ No newline at end of file
+var _0x044c=['moment','sequelize','exports','STRING','DATE'];(function(_0x17de77,_0x3c6b3f){var _0x55b344=function(_0x15957e){while(--_0x15957e){_0x17de77['push'](_0x17de77['shift']());}};_0x55b344(++_0x3c6b3f);}(_0x044c,0x1d1));var _0xc044=function(_0x5a1709,_0x341348){_0x5a1709=_0x5a1709-0x0;var _0xf0bbb=_0x044c[_0x5a1709];return _0xf0bbb;};'use strict';var moment=require(_0xc044('0x0'));var Sequelize=require(_0xc044('0x1'));module[_0xc044('0x2')]={'uniqueid':{'type':Sequelize[_0xc044('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc044('0x3')]},'joinAt':{'type':Sequelize[_0xc044('0x4')]},'leaveAt':{'type':Sequelize[_0xc044('0x4')]},'acceptAt':{'type':Sequelize[_0xc044('0x4')]},'exitAt':{'type':Sequelize[_0xc044('0x4')]},'reason':{'type':Sequelize[_0xc044('0x3')]}};
\ No newline at end of file
index 8304579..5bf34e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x1bc5b7,_0x3c81b9){var _0x981305=function(_0xbf75b0){while(--_0xbf75b0){_0x1bc5b7['push'](_0x1bc5b7['shift']());}};_0x981305(++_0x3c81b9);}(_0x2542,0x169));var _0x2254=function(_0x39588a,_0x412a1e){_0x39588a=_0x39588a-0x0;var _0x194687=_0x2542[_0x39588a];return _0x194687;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':!![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['MailQueueReport'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));};
\ No newline at end of file
+var _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','MailQueueReport','rawAttributes','type','key','model','query'];(function(_0x2f83fa,_0x4877dd){var _0x175109=function(_0x4c3282){while(--_0x4c3282){_0x2f83fa['push'](_0x2f83fa['shift']());}};_0x175109(++_0x4877dd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x3c19ec,_0x308740){_0x3c19ec=_0x3c19ec-0x0;var _0x201da6=_0xc1c6[_0x3c19ec];return _0x201da6;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['MailQueueReport']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['MailQueueReport'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['MailQueueReport']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['MailQueueReport'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));};
\ No newline at end of file
index a40c08c..273ae08 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b65=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue'];(function(_0x1759c0,_0x5d3b6a){var _0x6afa87=function(_0x573f0a){while(--_0x573f0a){_0x1759c0['push'](_0x1759c0['shift']());}};_0x6afa87(++_0x5d3b6a);}(_0x1b65,0x1b4));var _0x51b6=function(_0x4ed579,_0x2ea2d2){_0x4ed579=_0x4ed579-0x0;var _0x5ad91d=_0x1b65[_0x4ed579];return _0x5ad91d;};'use strict';var _=require(_0x51b6('0x0'));var util=require(_0x51b6('0x1'));var logger=require(_0x51b6('0x2'))(_0x51b6('0x3'));var moment=require('moment');var BPromise=require(_0x51b6('0x4'));var rp=require(_0x51b6('0x5'));var fs=require('fs');var path=require(_0x51b6('0x6'));var rimraf=require(_0x51b6('0x7'));var config=require(_0x51b6('0x8'));var attributes=require(_0x51b6('0x9'));module[_0x51b6('0xa')]=function(_0x578b6a,_0x466a60){return _0x578b6a[_0x51b6('0xb')](_0x51b6('0xc'),attributes,{'tableName':_0x51b6('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x51b6('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa6e6=['../../config/logger','api','moment','request-promise','path','rimraf','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xa6e6,0x173));var _0x6a6e=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0xa6e6[_0x48b810];return _0x23c17d;};'use strict';var _=require(_0x6a6e('0x0'));var util=require('util');var logger=require(_0x6a6e('0x1'))(_0x6a6e('0x2'));var moment=require(_0x6a6e('0x3'));var BPromise=require('bluebird');var rp=require(_0x6a6e('0x4'));var fs=require('fs');var path=require(_0x6a6e('0x5'));var rimraf=require(_0x6a6e('0x6'));var config=require('../../config/environment');var attributes=require(_0x6a6e('0x7'));module[_0x6a6e('0x8')]=function(_0xea9286,_0x1b3a78){return _0xea9286[_0x6a6e('0x9')](_0x6a6e('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x6a6e('0xb'),'fields':[_0x6a6e('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 72d4a9c..2196923 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1dcdce,_0x3057b3){var _0x14047e=function(_0x11da26){while(--_0x11da26){_0x1dcdce['push'](_0x1dcdce['shift']());}};_0x14047e(++_0x3057b3);}(_0x326f,0xd1));var _0xf326=function(_0x4b8a7c,_0x23d0b8){_0x4b8a7c=_0x4b8a7c-0x0;var _0x2cb0fd=_0x326f[_0x4b8a7c];return _0x2cb0fd;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});};
\ No newline at end of file
+var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x58fdc5,_0x5986a){var _0x121190=function(_0x28bd5c){while(--_0x28bd5c){_0x58fdc5['push'](_0x58fdc5['shift']());}};_0x121190(++_0x5986a);}(_0x2ef3,0xba));var _0x32ef=function(_0x48f87a,_0x70eb45){_0x48f87a=_0x48f87a-0x0;var _0x2e7302=_0x2ef3[_0x48f87a];return _0x2e7302;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});};
\ No newline at end of file
index c377ccb..d007dbc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x56acd3,_0x52fcc5){var _0x920a32=function(_0x16dc60){while(--_0x16dc60){_0x56acd3['push'](_0x56acd3['shift']());}};_0x920a32(++_0x52fcc5);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x4e8dc2,_0x1cc1e5){var _0x3b3fd1=function(_0x858f49){while(--_0x858f49){_0x4e8dc2['push'](_0x4e8dc2['shift']());}};_0x3b3fd1(++_0x1cc1e5);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router;
\ No newline at end of file
index 7120827..185b174 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0505=['BOOLEAN','INTEGER','INBOX','STRING'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x0505,0x13f));var _0x5050=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x0505[_0x3511d3];return _0x5d6321;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x5050('0x0')]},'authentication':{'type':Sequelize[_0x5050('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x5050('0x0')]},'password':{'type':Sequelize[_0x5050('0x0')]},'port':{'type':Sequelize[_0x5050('0x2')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x5050('0x3')},'connTimeout':{'type':Sequelize[_0x5050('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x5050('0x0')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0x8e7e=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x1f5a63,_0x511504){var _0x30bb7a=function(_0x476310){while(--_0x476310){_0x1f5a63['push'](_0x1f5a63['shift']());}};_0x30bb7a(++_0x511504);}(_0x8e7e,0xf5));var _0xe8e7=function(_0x597702,_0x1e3d0e){_0x597702=_0x597702-0x0;var _0x5bfdba=_0x8e7e[_0x597702];return _0x5bfdba;};'use strict';var Sequelize=require(_0xe8e7('0x0'));module[_0xe8e7('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xe8e7('0x2')]},'authentication':{'type':Sequelize[_0xe8e7('0x3')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xe8e7('0x2')]},'port':{'type':Sequelize[_0xe8e7('0x4')]},'tls':{'type':Sequelize[_0xe8e7('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xe8e7('0x5')},'connTimeout':{'type':Sequelize[_0xe8e7('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0xe8e7('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index 96fe2ae..9e5fa2e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7eb=['api','moment','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','lodash','util','../../config/logger'];(function(_0x31ead7,_0x2e9a7c){var _0x3516f0=function(_0x47fa36){while(--_0x47fa36){_0x31ead7['push'](_0x31ead7['shift']());}};_0x3516f0(++_0x2e9a7c);}(_0xc7eb,0x189));var _0xbc7e=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xc7eb[_0x236d24];return _0x1574cf;};'use strict';var _=require(_0xbc7e('0x0'));var util=require(_0xbc7e('0x1'));var logger=require(_0xbc7e('0x2'))(_0xbc7e('0x3'));var moment=require(_0xbc7e('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xbc7e('0x5'));var rimraf=require(_0xbc7e('0x6'));var config=require(_0xbc7e('0x7'));var attributes=require(_0xbc7e('0x8'));module['exports']=function(_0x4d53d4,_0x2078f4){return _0x4d53d4[_0xbc7e('0x9')](_0xbc7e('0xa'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x610f=['exports','define','mail_servers_in','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes'];(function(_0x1b8bda,_0x43ad31){var _0x1f7050=function(_0x1d8dc6){while(--_0x1d8dc6){_0x1b8bda['push'](_0x1b8bda['shift']());}};_0x1f7050(++_0x43ad31);}(_0x610f,0x19b));var _0xf610=function(_0x701c5d,_0x47a566){_0x701c5d=_0x701c5d-0x0;var _0x617b08=_0x610f[_0x701c5d];return _0x617b08;};'use strict';var _=require(_0xf610('0x0'));var util=require(_0xf610('0x1'));var logger=require(_0xf610('0x2'))('api');var moment=require(_0xf610('0x3'));var BPromise=require('bluebird');var rp=require(_0xf610('0x4'));var fs=require('fs');var path=require(_0xf610('0x5'));var rimraf=require(_0xf610('0x6'));var config=require(_0xf610('0x7'));var attributes=require(_0xf610('0x8'));module[_0xf610('0x9')]=function(_0x561405,_0x196e0b){return _0x561405[_0xf610('0xa')]('MailServerIn',attributes,{'tableName':_0xf610('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c94c2a8..8ae64c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49f2=['moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','limit','include','map','model','lodash','util'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0x49f2,0x86));var _0x249f=function(_0x2b0d43,_0x3370e2){_0x2b0d43=_0x2b0d43-0x0;var _0x3afd2b=_0x49f2[_0x2b0d43];return _0x3afd2b;};'use strict';var _=require(_0x249f('0x0'));var util=require(_0x249f('0x1'));var moment=require(_0x249f('0x2'));var BPromise=require('bluebird');var rs=require(_0x249f('0x3'));var fs=require('fs');var Redis=require(_0x249f('0x4'));var db=require(_0x249f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x249f('0x6'))(_0x249f('0x7'));var config=require(_0x249f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x249f('0x9')][_0x249f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4308ec,_0x47b9c4,_0x50dc6b){return new BPromise(function(_0x2d81e8,_0x3d266d){return client[_0x249f('0xb')](_0x4308ec,_0x50dc6b)[_0x249f('0xc')](function(_0x5a9eb8){logger[_0x249f('0xd')]('MailServerIn,\x20%s,\x20%s',_0x47b9c4,_0x249f('0xe'));logger[_0x249f('0xf')](_0x249f('0x10'),_0x47b9c4,_0x249f('0xe'),JSON[_0x249f('0x11')](_0x5a9eb8));if(_0x5a9eb8[_0x249f('0x12')]){if(_0x5a9eb8[_0x249f('0x12')][_0x249f('0x13')]===0x1f4){logger['error'](_0x249f('0x14'),_0x47b9c4,_0x5a9eb8['error']['message']);return _0x3d266d(_0x5a9eb8[_0x249f('0x12')][_0x249f('0x15')]);}logger[_0x249f('0x12')](_0x249f('0x14'),_0x47b9c4,_0x5a9eb8[_0x249f('0x12')][_0x249f('0x15')]);return _0x2d81e8(_0x5a9eb8[_0x249f('0x12')][_0x249f('0x15')]);}else{logger[_0x249f('0xd')](_0x249f('0x14'),_0x47b9c4,_0x249f('0xe'));_0x2d81e8(_0x5a9eb8[_0x249f('0x16')][_0x249f('0x15')]);}})[_0x249f('0x17')](function(_0x527f64){logger[_0x249f('0x12')](_0x249f('0x14'),_0x47b9c4,_0x527f64);_0x3d266d(_0x527f64);});});}exports[_0x249f('0x18')]=function(_0x392ed3){var _0x5e6395=this;return new Promise(function(_0x3820c5,_0x4f61b9){return db[_0x249f('0x19')]['findAll']({'raw':_0x392ed3[_0x249f('0x1a')]?_0x392ed3['options'][_0x249f('0x1b')]===undefined?!![]:![]:!![],'where':_0x392ed3['options']?_0x392ed3[_0x249f('0x1a')][_0x249f('0x1c')]||null:null,'attributes':_0x392ed3[_0x249f('0x1a')]?_0x392ed3[_0x249f('0x1a')][_0x249f('0x1d')]||null:null,'limit':_0x392ed3[_0x249f('0x1a')]?_0x392ed3[_0x249f('0x1a')][_0x249f('0x1e')]||null:null,'include':_0x392ed3['options']?_0x392ed3[_0x249f('0x1a')][_0x249f('0x1f')]?_[_0x249f('0x20')](_0x392ed3[_0x249f('0x1a')]['include'],function(_0x5ebdd1){return{'model':db[_0x5ebdd1[_0x249f('0x21')]],'as':_0x5ebdd1['as'],'attributes':_0x5ebdd1['attributes'],'include':_0x5ebdd1[_0x249f('0x1f')]?_[_0x249f('0x20')](_0x5ebdd1['include'],function(_0x1f1ca3){return{'model':db[_0x1f1ca3[_0x249f('0x21')]],'as':_0x1f1ca3['as'],'attributes':_0x1f1ca3[_0x249f('0x1d')],'include':_0x1f1ca3['include']?_[_0x249f('0x20')](_0x1f1ca3[_0x249f('0x1f')],function(_0x4f2d8a){return{'model':db[_0x4f2d8a[_0x249f('0x21')]],'as':_0x4f2d8a['as'],'attributes':_0x4f2d8a[_0x249f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x249f('0xc')](function(_0x3de798){logger[_0x249f('0xd')](_0x249f('0x18'),_0x392ed3);logger[_0x249f('0xf')](_0x249f('0x18'),_0x392ed3,JSON[_0x249f('0x11')](_0x3de798));_0x3820c5(_0x3de798);})[_0x249f('0x17')](function(_0xfa7e9f){logger[_0x249f('0x12')](_0x249f('0x18'),_0xfa7e9f[_0x249f('0x15')],_0x392ed3);_0x4f61b9(_0x5e6395[_0x249f('0x12')](0x1f4,_0xfa7e9f[_0x249f('0x15')]));});});};
\ No newline at end of file
+var _0xacdf=['../../config/environment','jayson/promise','client','request','info','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','MailServerIn,\x20%s,\x20%s','message','result','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','include','map','model','then','lodash','bluebird','randomstring'];(function(_0x4d6dfc,_0x4930f8){var _0x5de503=function(_0x21788d){while(--_0x21788d){_0x4d6dfc['push'](_0x4d6dfc['shift']());}};_0x5de503(++_0x4930f8);}(_0xacdf,0x69));var _0xfacd=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xacdf[_0x44bcb0];return _0xfaf881;};'use strict';var _=require(_0xfacd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfacd('0x1'));var rs=require(_0xfacd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xfacd('0x3'));var jayson=require(_0xfacd('0x4'));var client=jayson[_0xfacd('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b043b,_0x3f0f95,_0x259613){return new BPromise(function(_0x4a0109,_0xdaa112){return client[_0xfacd('0x6')](_0x3b043b,_0x259613)['then'](function(_0x42a267){logger[_0xfacd('0x7')]('MailServerIn,\x20%s,\x20%s',_0x3f0f95,_0xfacd('0x8'));logger['debug'](_0xfacd('0x9'),_0x3f0f95,_0xfacd('0x8'),JSON[_0xfacd('0xa')](_0x42a267));if(_0x42a267['error']){if(_0x42a267[_0xfacd('0xb')][_0xfacd('0xc')]===0x1f4){logger['error'](_0xfacd('0xd'),_0x3f0f95,_0x42a267[_0xfacd('0xb')][_0xfacd('0xe')]);return _0xdaa112(_0x42a267[_0xfacd('0xb')][_0xfacd('0xe')]);}logger['error'](_0xfacd('0xd'),_0x3f0f95,_0x42a267[_0xfacd('0xb')][_0xfacd('0xe')]);return _0x4a0109(_0x42a267[_0xfacd('0xb')]['message']);}else{logger[_0xfacd('0x7')](_0xfacd('0xd'),_0x3f0f95,_0xfacd('0x8'));_0x4a0109(_0x42a267[_0xfacd('0xf')][_0xfacd('0xe')]);}})[_0xfacd('0x10')](function(_0x4fac48){logger[_0xfacd('0xb')]('MailServerIn,\x20%s,\x20%s',_0x3f0f95,_0x4fac48);_0xdaa112(_0x4fac48);});});}exports[_0xfacd('0x11')]=function(_0x553153){var _0xa8efe=this;return new Promise(function(_0x7bd55a,_0x2b30d2){return db[_0xfacd('0x12')]['findAll']({'raw':_0x553153[_0xfacd('0x13')]?_0x553153['options'][_0xfacd('0x14')]===undefined?!![]:![]:!![],'where':_0x553153[_0xfacd('0x13')]?_0x553153[_0xfacd('0x13')][_0xfacd('0x15')]||null:null,'attributes':_0x553153['options']?_0x553153['options'][_0xfacd('0x16')]||null:null,'limit':_0x553153[_0xfacd('0x13')]?_0x553153[_0xfacd('0x13')]['limit']||null:null,'include':_0x553153[_0xfacd('0x13')]?_0x553153[_0xfacd('0x13')]['include']?_['map'](_0x553153['options'][_0xfacd('0x17')],function(_0x35bd94){return{'model':db[_0x35bd94['model']],'as':_0x35bd94['as'],'attributes':_0x35bd94[_0xfacd('0x16')],'include':_0x35bd94[_0xfacd('0x17')]?_[_0xfacd('0x18')](_0x35bd94[_0xfacd('0x17')],function(_0x334bac){return{'model':db[_0x334bac[_0xfacd('0x19')]],'as':_0x334bac['as'],'attributes':_0x334bac[_0xfacd('0x16')],'include':_0x334bac[_0xfacd('0x17')]?_[_0xfacd('0x18')](_0x334bac['include'],function(_0x207f52){return{'model':db[_0x207f52['model']],'as':_0x207f52['as'],'attributes':_0x207f52['attributes']};}):[]};}):[]};}):[]:[]})[_0xfacd('0x1a')](function(_0x55c48c){logger['info'](_0xfacd('0x11'),_0x553153);logger['debug'](_0xfacd('0x11'),_0x553153,JSON[_0xfacd('0xa')](_0x55c48c));_0x7bd55a(_0x55c48c);})[_0xfacd('0x10')](function(_0x574285){logger[_0xfacd('0xb')]('GetMailServerIn',_0x574285['message'],_0x553153);_0x2b30d2(_0xa8efe[_0xfacd('0xb')](0x1f4,_0x574285[_0xfacd('0xe')]));});});};
\ No newline at end of file
index e4305ed..b7576c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router;
\ No newline at end of file
+var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x75c06e,_0x4d2240){_0x75c06e=_0x75c06e-0x0;var _0x54ab06=_0x7a54[_0x75c06e];return _0x54ab06;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router;
\ No newline at end of file
index e0bf352..8eb0947 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e81=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x4e81,0x1bc));var _0x14e8=function(_0x3ba924,_0x3b99f0){_0x3ba924=_0x3ba924-0x0;var _0x4cc1df=_0x4e81[_0x3ba924];return _0x4cc1df;};'use strict';var Sequelize=require(_0x14e8('0x0'));module[_0x14e8('0x1')]={'description':{'type':Sequelize[_0x14e8('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x14e8('0x3')]},'secure':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x14e8('0x2')]},'authentication':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x14e8('0x4')],'defaultValue':![]}};
\ No newline at end of file
+var _0x2e54=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x1c2343,_0x30894a){var _0x5072c9=function(_0x5cae2b){while(--_0x5cae2b){_0x1c2343['push'](_0x1c2343['shift']());}};_0x5072c9(++_0x30894a);}(_0x2e54,0x1dd));var _0x42e5=function(_0x1acbfb,_0x2a9a44){_0x1acbfb=_0x1acbfb-0x0;var _0x1acd55=_0x2e54[_0x1acbfb];return _0x1acd55;};'use strict';var Sequelize=require(_0x42e5('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x42e5('0x1')]},'user':{'type':Sequelize[_0x42e5('0x1')]},'pass':{'type':Sequelize[_0x42e5('0x1')]},'port':{'type':Sequelize[_0x42e5('0x2')]},'secure':{'type':Sequelize[_0x42e5('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x42e5('0x1')]},'authentication':{'type':Sequelize[_0x42e5('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index 2b608a1..45b4d68 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8617=['filters','intersection','query','attributes','model','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','find','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','apply','then','stack','name','index','map','MailServerOut','rawAttributes','type','key','keys'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0x8617,0x181));var _0x7861=function(_0x345c89,_0x286018){_0x345c89=_0x345c89-0x0;var _0xe5cfd6=_0x8617[_0x345c89];return _0xe5cfd6;};'use strict';var emlformat=require(_0x7861('0x0'));var rimraf=require(_0x7861('0x1'));var zipdir=require(_0x7861('0x2'));var jsonpatch=require(_0x7861('0x3'));var rp=require(_0x7861('0x4'));var moment=require(_0x7861('0x5'));var BPromise=require(_0x7861('0x6'));var Mustache=require(_0x7861('0x7'));var util=require(_0x7861('0x8'));var path=require(_0x7861('0x9'));var sox=require(_0x7861('0xa'));var csv=require(_0x7861('0xb'));var ejs=require(_0x7861('0xc'));var fs=require('fs');var fs_extra=require(_0x7861('0xd'));var _=require(_0x7861('0xe'));var squel=require('squel');var crypto=require(_0x7861('0xf'));var jsforce=require(_0x7861('0x10'));var deskjs=require(_0x7861('0x11'));var toCsv=require(_0x7861('0xb'));var querystring=require('querystring');var Papa=require(_0x7861('0x12'));var Redis=require('ioredis');var authService=require(_0x7861('0x13'));var qs=require(_0x7861('0x14'));var as=require(_0x7861('0x15'));var hardwareService=require(_0x7861('0x16'));var logger=require(_0x7861('0x17'))(_0x7861('0x18'));var utils=require(_0x7861('0x19'));var config=require(_0x7861('0x1a'));var licenseUtil=require(_0x7861('0x1b'));var db=require(_0x7861('0x1c'))['db'];function respondWithStatusCode(_0x3e45f6,_0x3a8c83){_0x3a8c83=_0x3a8c83||0xcc;return function(_0xde9539){if(_0xde9539){return _0x3e45f6[_0x7861('0x1d')](_0x3a8c83);}return _0x3e45f6['status'](_0x3a8c83)[_0x7861('0x1e')]();};}function respondWithResult(_0x579847,_0x41e734){_0x41e734=_0x41e734||0xc8;return function(_0x5eb6eb){if(_0x5eb6eb){return _0x579847[_0x7861('0x1f')](_0x41e734)[_0x7861('0x20')](_0x5eb6eb);}};}function respondWithFilteredResult(_0x1b3ec6,_0x37c8ff){return function(_0x35505f){if(_0x35505f){var _0x711c8d=typeof _0x37c8ff[_0x7861('0x21')]==='undefined'&&typeof _0x37c8ff[_0x7861('0x22')]==='undefined';var _0x2f0b2f=_0x35505f['count'];var _0x325888=_0x711c8d?0x0:_0x37c8ff['offset'];var _0x3b3e19=_0x711c8d?_0x35505f[_0x7861('0x23')]:_0x37c8ff[_0x7861('0x21')]+_0x37c8ff[_0x7861('0x22')];var _0x2cd175;if(_0x3b3e19>=_0x2f0b2f){_0x3b3e19=_0x2f0b2f;_0x2cd175=0xc8;}else{_0x2cd175=0xce;}_0x1b3ec6[_0x7861('0x1f')](_0x2cd175);return _0x1b3ec6['set']('Content-Range',_0x325888+'-'+_0x3b3e19+'/'+_0x2f0b2f)[_0x7861('0x20')](_0x35505f);}return null;};}function patchUpdates(_0x5b8a99){return function(_0x394bba){try{jsonpatch[_0x7861('0x24')](_0x394bba,_0x5b8a99,!![]);}catch(_0x47140c){return BPromise['reject'](_0x47140c);}return _0x394bba['save']();};}function saveUpdates(_0x23b6c0,_0x25b556){return function(_0x41b6c5){if(_0x41b6c5){return _0x41b6c5['update'](_0x23b6c0)['then'](function(_0x19c0db){return _0x19c0db;});}return null;};}function removeEntity(_0x56ab2a,_0x391c7a){return function(_0x207c87){if(_0x207c87){return _0x207c87['destroy']()[_0x7861('0x25')](function(){_0x56ab2a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ac41c,_0x509108){return function(_0x11e3f0){if(!_0x11e3f0){_0x2ac41c['sendStatus'](0x194);}return _0x11e3f0;};}function handleError(_0x597d3c,_0x3da37b){_0x3da37b=_0x3da37b||0x1f4;return function(_0x119472){logger['error'](_0x119472[_0x7861('0x26')]);if(_0x119472[_0x7861('0x27')]){delete _0x119472[_0x7861('0x27')];}_0x597d3c['status'](_0x3da37b)['send'](_0x119472);};}exports[_0x7861('0x28')]=function(_0x39d6e1,_0x4ce937){var _0x19805e={},_0x12b592={},_0x354f13={'count':0x0,'rows':[]};var _0x172dc4=_[_0x7861('0x29')](db[_0x7861('0x2a')][_0x7861('0x2b')],function(_0x1f5d4f){return{'name':_0x1f5d4f['fieldName'],'type':_0x1f5d4f[_0x7861('0x2c')][_0x7861('0x2d')]};});_0x12b592['model']=_[_0x7861('0x29')](_0x172dc4,'name');_0x12b592['query']=_[_0x7861('0x2e')](_0x39d6e1['query']);_0x12b592[_0x7861('0x2f')]=_[_0x7861('0x30')](_0x12b592['model'],_0x12b592[_0x7861('0x31')]);_0x19805e[_0x7861('0x32')]=_[_0x7861('0x30')](_0x12b592[_0x7861('0x33')],qs[_0x7861('0x34')](_0x39d6e1[_0x7861('0x31')][_0x7861('0x34')]));_0x19805e[_0x7861('0x32')]=_0x19805e['attributes']['length']?_0x19805e['attributes']:_0x12b592[_0x7861('0x33')];if(!_0x39d6e1[_0x7861('0x31')]['hasOwnProperty'](_0x7861('0x35'))){_0x19805e[_0x7861('0x22')]=qs[_0x7861('0x22')](_0x39d6e1['query'][_0x7861('0x22')]);_0x19805e[_0x7861('0x21')]=qs[_0x7861('0x21')](_0x39d6e1[_0x7861('0x31')][_0x7861('0x21')]);}_0x19805e[_0x7861('0x36')]=qs[_0x7861('0x37')](_0x39d6e1[_0x7861('0x31')][_0x7861('0x37')]);_0x19805e[_0x7861('0x38')]=qs[_0x7861('0x2f')](_[_0x7861('0x39')](_0x39d6e1[_0x7861('0x31')],_0x12b592[_0x7861('0x2f')]),_0x172dc4);if(_0x39d6e1['query'][_0x7861('0x3a')]){_0x19805e[_0x7861('0x38')]=_[_0x7861('0x3b')](_0x19805e['where'],{'$or':_[_0x7861('0x29')](_0x172dc4,function(_0x32dd62){if(_0x32dd62['type']!==_0x7861('0x3c')){var _0x1ba2d6={};_0x1ba2d6[_0x32dd62['name']]={'$like':'%'+_0x39d6e1['query'][_0x7861('0x3a')]+'%'};return _0x1ba2d6;}})});}_0x19805e=_['merge']({},_0x19805e,_0x39d6e1['options']);var _0x3e399a={'where':_0x19805e[_0x7861('0x38')]};return db['MailServerOut'][_0x7861('0x23')](_0x3e399a)[_0x7861('0x25')](function(_0x65c7f9){_0x354f13[_0x7861('0x23')]=_0x65c7f9;if(_0x39d6e1[_0x7861('0x31')][_0x7861('0x3d')]){_0x19805e[_0x7861('0x3e')]=[{'all':!![]}];}return db[_0x7861('0x2a')][_0x7861('0x3f')](_0x19805e);})[_0x7861('0x25')](function(_0x47773e){_0x354f13[_0x7861('0x40')]=_0x47773e;return _0x354f13;})[_0x7861('0x25')](respondWithFilteredResult(_0x4ce937,_0x19805e))[_0x7861('0x41')](handleError(_0x4ce937,null));};exports['show']=function(_0x36019f,_0x59807e){var _0x353316={'raw':!![],'where':{'id':_0x36019f[_0x7861('0x42')]['id']}},_0x37236b={};_0x37236b['model']=_['keys'](db['MailServerOut'][_0x7861('0x2b')]);_0x37236b['query']=_['keys'](_0x36019f[_0x7861('0x31')]);_0x37236b[_0x7861('0x2f')]=_['intersection'](_0x37236b[_0x7861('0x33')],_0x37236b[_0x7861('0x31')]);_0x353316[_0x7861('0x32')]=_['intersection'](_0x37236b[_0x7861('0x33')],qs[_0x7861('0x34')](_0x36019f[_0x7861('0x31')][_0x7861('0x34')]));_0x353316[_0x7861('0x32')]=_0x353316['attributes']['length']?_0x353316['attributes']:_0x37236b[_0x7861('0x33')];if(_0x36019f[_0x7861('0x31')]['includeAll']){_0x353316[_0x7861('0x3e')]=[{'all':!![]}];}_0x353316=_[_0x7861('0x3b')]({},_0x353316,_0x36019f['options']);return db[_0x7861('0x2a')][_0x7861('0x43')](_0x353316)[_0x7861('0x25')](handleEntityNotFound(_0x59807e,null))[_0x7861('0x25')](respondWithResult(_0x59807e,null))[_0x7861('0x41')](handleError(_0x59807e,null));};exports[_0x7861('0x44')]=function(_0x48914f,_0x1a7133){return db[_0x7861('0x2a')][_0x7861('0x44')](_0x48914f[_0x7861('0x45')],{})[_0x7861('0x25')](respondWithResult(_0x1a7133,0xc9))[_0x7861('0x41')](handleError(_0x1a7133,null));};exports[_0x7861('0x46')]=function(_0x31ab97,_0x19dc3d){if(_0x31ab97[_0x7861('0x45')]['id']){delete _0x31ab97[_0x7861('0x45')]['id'];}return db[_0x7861('0x2a')]['find']({'where':{'id':_0x31ab97[_0x7861('0x42')]['id']}})[_0x7861('0x25')](handleEntityNotFound(_0x19dc3d,null))[_0x7861('0x25')](saveUpdates(_0x31ab97['body'],null))[_0x7861('0x25')](respondWithResult(_0x19dc3d,null))[_0x7861('0x41')](handleError(_0x19dc3d,null));};exports[_0x7861('0x47')]=function(_0x11aa00,_0x4aa9cf){return db[_0x7861('0x2a')]['find']({'where':{'id':_0x11aa00[_0x7861('0x42')]['id']}})[_0x7861('0x25')](handleEntityNotFound(_0x4aa9cf,null))[_0x7861('0x25')](removeEntity(_0x4aa9cf,null))[_0x7861('0x41')](handleError(_0x4aa9cf,null));};
\ No newline at end of file
+var _0xd445=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','then','includeAll','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','apply','reject','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type'];(function(_0x1b0e86,_0x33ec39){var _0xd85844=function(_0x3282ae){while(--_0x3282ae){_0x1b0e86['push'](_0x1b0e86['shift']());}};_0xd85844(++_0x33ec39);}(_0xd445,0x12e));var _0x5d44=function(_0x1bca3d,_0x142d89){_0x1bca3d=_0x1bca3d-0x0;var _0x3e0a34=_0xd445[_0x1bca3d];return _0x3e0a34;};'use strict';var emlformat=require(_0x5d44('0x0'));var rimraf=require(_0x5d44('0x1'));var zipdir=require(_0x5d44('0x2'));var jsonpatch=require(_0x5d44('0x3'));var rp=require(_0x5d44('0x4'));var moment=require(_0x5d44('0x5'));var BPromise=require(_0x5d44('0x6'));var Mustache=require('mustache');var util=require(_0x5d44('0x7'));var path=require(_0x5d44('0x8'));var sox=require(_0x5d44('0x9'));var csv=require('to-csv');var ejs=require(_0x5d44('0xa'));var fs=require('fs');var fs_extra=require(_0x5d44('0xb'));var _=require(_0x5d44('0xc'));var squel=require(_0x5d44('0xd'));var crypto=require(_0x5d44('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x5d44('0xf'));var toCsv=require(_0x5d44('0x10'));var querystring=require(_0x5d44('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5d44('0x12'))(_0x5d44('0x13'));var utils=require(_0x5d44('0x14'));var config=require(_0x5d44('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ef54b,_0x565edc){_0x565edc=_0x565edc||0xcc;return function(_0x4ba389){if(_0x4ba389){return _0x2ef54b['sendStatus'](_0x565edc);}return _0x2ef54b[_0x5d44('0x16')](_0x565edc)[_0x5d44('0x17')]();};}function respondWithResult(_0x464b1f,_0x4b037a){_0x4b037a=_0x4b037a||0xc8;return function(_0x1b7fb5){if(_0x1b7fb5){return _0x464b1f[_0x5d44('0x16')](_0x4b037a)[_0x5d44('0x18')](_0x1b7fb5);}};}function respondWithFilteredResult(_0x2bbe72,_0x5f0c45){return function(_0x5210d0){if(_0x5210d0){var _0x1c171a=typeof _0x5f0c45[_0x5d44('0x19')]==='undefined'&&typeof _0x5f0c45[_0x5d44('0x1a')]===_0x5d44('0x1b');var _0x4dc81d=_0x5210d0[_0x5d44('0x1c')];var _0x14e1de=_0x1c171a?0x0:_0x5f0c45[_0x5d44('0x19')];var _0xc33703=_0x1c171a?_0x5210d0[_0x5d44('0x1c')]:_0x5f0c45[_0x5d44('0x19')]+_0x5f0c45[_0x5d44('0x1a')];var _0x366f8d;if(_0xc33703>=_0x4dc81d){_0xc33703=_0x4dc81d;_0x366f8d=0xc8;}else{_0x366f8d=0xce;}_0x2bbe72[_0x5d44('0x16')](_0x366f8d);return _0x2bbe72[_0x5d44('0x1d')]('Content-Range',_0x14e1de+'-'+_0xc33703+'/'+_0x4dc81d)[_0x5d44('0x18')](_0x5210d0);}return null;};}function patchUpdates(_0x55dfeb){return function(_0x26dcb9){try{jsonpatch[_0x5d44('0x1e')](_0x26dcb9,_0x55dfeb,!![]);}catch(_0x157bfb){return BPromise[_0x5d44('0x1f')](_0x157bfb);}return _0x26dcb9['save']();};}function saveUpdates(_0x12855b,_0x6b63e1){return function(_0x55bbcf){if(_0x55bbcf){return _0x55bbcf['update'](_0x12855b)['then'](function(_0x16afe2){return _0x16afe2;});}return null;};}function removeEntity(_0x313afa,_0x173445){return function(_0x5e686a){if(_0x5e686a){return _0x5e686a[_0x5d44('0x20')]()['then'](function(){_0x313afa[_0x5d44('0x16')](0xcc)[_0x5d44('0x17')]();});}};}function handleEntityNotFound(_0x52687a,_0x48305b){return function(_0x20d4c3){if(!_0x20d4c3){_0x52687a['sendStatus'](0x194);}return _0x20d4c3;};}function handleError(_0x19c7ad,_0x55f1d5){_0x55f1d5=_0x55f1d5||0x1f4;return function(_0x4a101b){logger[_0x5d44('0x21')](_0x4a101b[_0x5d44('0x22')]);if(_0x4a101b['name']){delete _0x4a101b[_0x5d44('0x23')];}_0x19c7ad[_0x5d44('0x16')](_0x55f1d5)[_0x5d44('0x24')](_0x4a101b);};}exports[_0x5d44('0x25')]=function(_0x28b414,_0x485aa6){var _0x1f6bcf={},_0x2cf8b0={},_0x4a9890={'count':0x0,'rows':[]};var _0x5c87bd=_[_0x5d44('0x26')](db[_0x5d44('0x27')][_0x5d44('0x28')],function(_0x5ad86f){return{'name':_0x5ad86f[_0x5d44('0x29')],'type':_0x5ad86f[_0x5d44('0x2a')]['key']};});_0x2cf8b0[_0x5d44('0x2b')]=_[_0x5d44('0x26')](_0x5c87bd,_0x5d44('0x23'));_0x2cf8b0[_0x5d44('0x2c')]=_[_0x5d44('0x2d')](_0x28b414[_0x5d44('0x2c')]);_0x2cf8b0['filters']=_[_0x5d44('0x2e')](_0x2cf8b0[_0x5d44('0x2b')],_0x2cf8b0[_0x5d44('0x2c')]);_0x1f6bcf[_0x5d44('0x2f')]=_[_0x5d44('0x2e')](_0x2cf8b0[_0x5d44('0x2b')],qs['fields'](_0x28b414[_0x5d44('0x2c')][_0x5d44('0x30')]));_0x1f6bcf['attributes']=_0x1f6bcf[_0x5d44('0x2f')][_0x5d44('0x31')]?_0x1f6bcf[_0x5d44('0x2f')]:_0x2cf8b0[_0x5d44('0x2b')];if(!_0x28b414[_0x5d44('0x2c')][_0x5d44('0x32')]('nolimit')){_0x1f6bcf[_0x5d44('0x1a')]=qs[_0x5d44('0x1a')](_0x28b414[_0x5d44('0x2c')][_0x5d44('0x1a')]);_0x1f6bcf[_0x5d44('0x19')]=qs[_0x5d44('0x19')](_0x28b414[_0x5d44('0x2c')]['offset']);}_0x1f6bcf[_0x5d44('0x33')]=qs[_0x5d44('0x34')](_0x28b414[_0x5d44('0x2c')][_0x5d44('0x34')]);_0x1f6bcf[_0x5d44('0x35')]=qs['filters'](_['pick'](_0x28b414['query'],_0x2cf8b0[_0x5d44('0x36')]),_0x5c87bd);if(_0x28b414[_0x5d44('0x2c')][_0x5d44('0x37')]){_0x1f6bcf[_0x5d44('0x35')]=_['merge'](_0x1f6bcf[_0x5d44('0x35')],{'$or':_[_0x5d44('0x26')](_0x5c87bd,function(_0x157b1f){if(_0x157b1f['type']!==_0x5d44('0x38')){var _0x53fdf9={};_0x53fdf9[_0x157b1f[_0x5d44('0x23')]]={'$like':'%'+_0x28b414[_0x5d44('0x2c')]['filter']+'%'};return _0x53fdf9;}})});}_0x1f6bcf=_[_0x5d44('0x39')]({},_0x1f6bcf,_0x28b414[_0x5d44('0x3a')]);var _0x518b84={'where':_0x1f6bcf[_0x5d44('0x35')]};return db[_0x5d44('0x27')][_0x5d44('0x1c')](_0x518b84)[_0x5d44('0x3b')](function(_0x57234b){_0x4a9890[_0x5d44('0x1c')]=_0x57234b;if(_0x28b414[_0x5d44('0x2c')][_0x5d44('0x3c')]){_0x1f6bcf['include']=[{'all':!![]}];}return db[_0x5d44('0x27')][_0x5d44('0x3d')](_0x1f6bcf);})[_0x5d44('0x3b')](function(_0x4223ae){_0x4a9890[_0x5d44('0x3e')]=_0x4223ae;return _0x4a9890;})[_0x5d44('0x3b')](respondWithFilteredResult(_0x485aa6,_0x1f6bcf))[_0x5d44('0x3f')](handleError(_0x485aa6,null));};exports[_0x5d44('0x40')]=function(_0x5c555f,_0x16d89f){var _0x4cec48={'raw':!![],'where':{'id':_0x5c555f[_0x5d44('0x41')]['id']}},_0x13ac85={};_0x13ac85[_0x5d44('0x2b')]=_[_0x5d44('0x2d')](db[_0x5d44('0x27')]['rawAttributes']);_0x13ac85[_0x5d44('0x2c')]=_[_0x5d44('0x2d')](_0x5c555f[_0x5d44('0x2c')]);_0x13ac85['filters']=_[_0x5d44('0x2e')](_0x13ac85[_0x5d44('0x2b')],_0x13ac85[_0x5d44('0x2c')]);_0x4cec48[_0x5d44('0x2f')]=_[_0x5d44('0x2e')](_0x13ac85[_0x5d44('0x2b')],qs[_0x5d44('0x30')](_0x5c555f[_0x5d44('0x2c')][_0x5d44('0x30')]));_0x4cec48[_0x5d44('0x2f')]=_0x4cec48[_0x5d44('0x2f')][_0x5d44('0x31')]?_0x4cec48['attributes']:_0x13ac85[_0x5d44('0x2b')];if(_0x5c555f['query']['includeAll']){_0x4cec48['include']=[{'all':!![]}];}_0x4cec48=_[_0x5d44('0x39')]({},_0x4cec48,_0x5c555f[_0x5d44('0x3a')]);return db[_0x5d44('0x27')][_0x5d44('0x42')](_0x4cec48)[_0x5d44('0x3b')](handleEntityNotFound(_0x16d89f,null))[_0x5d44('0x3b')](respondWithResult(_0x16d89f,null))[_0x5d44('0x3f')](handleError(_0x16d89f,null));};exports[_0x5d44('0x43')]=function(_0x4ed527,_0xdbab07){return db[_0x5d44('0x27')][_0x5d44('0x43')](_0x4ed527[_0x5d44('0x44')],{})[_0x5d44('0x3b')](respondWithResult(_0xdbab07,0xc9))[_0x5d44('0x3f')](handleError(_0xdbab07,null));};exports['update']=function(_0x1f2e3d,_0x1c8b54){if(_0x1f2e3d[_0x5d44('0x44')]['id']){delete _0x1f2e3d[_0x5d44('0x44')]['id'];}return db[_0x5d44('0x27')][_0x5d44('0x42')]({'where':{'id':_0x1f2e3d[_0x5d44('0x41')]['id']}})[_0x5d44('0x3b')](handleEntityNotFound(_0x1c8b54,null))[_0x5d44('0x3b')](saveUpdates(_0x1f2e3d[_0x5d44('0x44')],null))['then'](respondWithResult(_0x1c8b54,null))[_0x5d44('0x3f')](handleError(_0x1c8b54,null));};exports[_0x5d44('0x20')]=function(_0x575da1,_0x565836){return db['MailServerOut'][_0x5d44('0x42')]({'where':{'id':_0x575da1[_0x5d44('0x41')]['id']}})[_0x5d44('0x3b')](handleEntityNotFound(_0x565836,null))[_0x5d44('0x3b')](removeEntity(_0x565836,null))[_0x5d44('0x3f')](handleError(_0x565836,null));};
\ No newline at end of file
index 400ab74..7547787 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa264=['rimraf','../../config/environment','exports','define','MailServerOut','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x808794,_0x573181){var _0x5bda91=function(_0x547bbb){while(--_0x547bbb){_0x808794['push'](_0x808794['shift']());}};_0x5bda91(++_0x573181);}(_0xa264,0xc0));var _0x4a26=function(_0x55677b,_0x3e5655){_0x55677b=_0x55677b-0x0;var _0x104b88=_0xa264[_0x55677b];return _0x104b88;};'use strict';var _=require(_0x4a26('0x0'));var util=require(_0x4a26('0x1'));var logger=require(_0x4a26('0x2'))('api');var moment=require(_0x4a26('0x3'));var BPromise=require('bluebird');var rp=require(_0x4a26('0x4'));var fs=require('fs');var path=require(_0x4a26('0x5'));var rimraf=require(_0x4a26('0x6'));var config=require(_0x4a26('0x7'));var attributes=require('./mailServerOut.attributes');module[_0x4a26('0x8')]=function(_0x22705c,_0x2ce5d7){return _0x22705c[_0x4a26('0x9')](_0x4a26('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xaf01=['MailServerOut','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define'];(function(_0x7ddaad,_0x3e215b){var _0x3daa27=function(_0x1a6c9b){while(--_0x1a6c9b){_0x7ddaad['push'](_0x7ddaad['shift']());}};_0x3daa27(++_0x3e215b);}(_0xaf01,0x161));var _0x1af0=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xaf01[_0x1cc8fe];return _0x230054;};'use strict';var _=require('lodash');var util=require(_0x1af0('0x0'));var logger=require(_0x1af0('0x1'))(_0x1af0('0x2'));var moment=require('moment');var BPromise=require(_0x1af0('0x3'));var rp=require(_0x1af0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1af0('0x5'));var config=require(_0x1af0('0x6'));var attributes=require(_0x1af0('0x7'));module[_0x1af0('0x8')]=function(_0x57974b,_0x2d6a2d){return _0x57974b[_0x1af0('0x9')](_0x1af0('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ecf2914..25ce4bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4b06b4,_0x1eb02f){var _0x1e5cda=function(_0x3239e5){while(--_0x3239e5){_0x4b06b4['push'](_0x4b06b4['shift']());}};_0x1e5cda(++_0x1eb02f);}(_0x1261,0x144));var _0x1126=function(_0x58ee96,_0x5affd5){_0x58ee96=_0x58ee96-0x0;var _0xb346aa=_0x1261[_0x58ee96];return _0xb346aa;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}
\ No newline at end of file
+var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailServerOut,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x1e0ce5,_0xd284b0){var _0x5196d4=function(_0x371f48){while(--_0x371f48){_0x1e0ce5['push'](_0x1e0ce5['shift']());}};_0x5196d4(++_0xd284b0);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2a2591,_0x958577){_0x2a2591=_0x2a2591-0x0;var _0x45bde5=_0x5f2f[_0x2a2591];return _0x45bde5;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}
\ No newline at end of file
index df7aaa4..f3c5d45 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f0e=['post','create','put','delete','util','express','fs-extra','../../components/auth/service','../../config/environment','./mailSubstatus.controller','index','get','isAuthenticated','describe','/:id','show'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x0f0e,0x1c4));var _0xe0f0=function(_0xd38590,_0x5709f1){_0xd38590=_0xd38590-0x0;var _0x4b9dc3=_0x0f0e[_0xd38590];return _0x4b9dc3;};'use strict';var multer=require('multer');var util=require(_0xe0f0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe0f0('0x1'));var router=express['Router']();var fs_extra=require(_0xe0f0('0x2'));var auth=require(_0xe0f0('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xe0f0('0x4'));var controller=require(_0xe0f0('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xe0f0('0x6')]);router[_0xe0f0('0x7')]('/describe',auth[_0xe0f0('0x8')](),controller[_0xe0f0('0x9')]);router[_0xe0f0('0x7')](_0xe0f0('0xa'),auth[_0xe0f0('0x8')](),controller[_0xe0f0('0xb')]);router[_0xe0f0('0xc')]('/',auth['isAuthenticated'](),controller[_0xe0f0('0xd')]);router[_0xe0f0('0xe')](_0xe0f0('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xe0f0('0xf')](_0xe0f0('0xa'),auth[_0xe0f0('0x8')](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xc310=['/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated'];(function(_0x11946c,_0x12152c){var _0x383935=function(_0x61fce2){while(--_0x61fce2){_0x11946c['push'](_0x11946c['shift']());}};_0x383935(++_0x12152c);}(_0xc310,0x1ea));var _0x0c31=function(_0x293f09,_0x357af5){_0x293f09=_0x293f09-0x0;var _0x588bd3=_0xc310[_0x293f09];return _0x588bd3;};'use strict';var multer=require(_0x0c31('0x0'));var util=require('util');var path=require(_0x0c31('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c31('0x2'));var router=express[_0x0c31('0x3')]();var fs_extra=require(_0x0c31('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0c31('0x5'));var config=require(_0x0c31('0x6'));var controller=require(_0x0c31('0x7'));router[_0x0c31('0x8')]('/',auth[_0x0c31('0x9')](),controller['index']);router[_0x0c31('0x8')](_0x0c31('0xa'),auth[_0x0c31('0x9')](),controller[_0x0c31('0xb')]);router[_0x0c31('0x8')](_0x0c31('0xc'),auth[_0x0c31('0x9')](),controller['show']);router[_0x0c31('0xd')]('/',auth[_0x0c31('0x9')](),controller[_0x0c31('0xe')]);router[_0x0c31('0xf')](_0x0c31('0xc'),auth[_0x0c31('0x9')](),controller[_0x0c31('0x10')]);router[_0x0c31('0x11')](_0x0c31('0xc'),auth[_0x0c31('0x9')](),controller[_0x0c31('0x12')]);module[_0x0c31('0x13')]=router;
\ No newline at end of file
index ab6977d..15fc10c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39e6=['sequelize','STRING'];(function(_0x5a7539,_0x4140f1){var _0x42961c=function(_0x464288){while(--_0x464288){_0x5a7539['push'](_0x5a7539['shift']());}};_0x42961c(++_0x4140f1);}(_0x39e6,0x9e));var _0x639e=function(_0x13a0c9,_0x4fc739){_0x13a0c9=_0x13a0c9-0x0;var _0x3f52ca=_0x39e6[_0x13a0c9];return _0x3f52ca;};'use strict';var Sequelize=require(_0x639e('0x0'));module['exports']={'name':{'type':Sequelize[_0x639e('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x01d9=['sequelize','exports','STRING','name'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x901d('0x0'));module[_0x901d('0x1')]={'name':{'type':Sequelize[_0x901d('0x2')],'unique':_0x901d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 4847038..6cd53f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3890=['sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','findAll','catch','show','params','length','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3890,0x123));var _0x0389=function(_0x1ce235,_0x2f51d6){_0x1ce235=_0x1ce235-0x0;var _0x6910eb=_0x3890[_0x1ce235];return _0x6910eb;};'use strict';var emlformat=require(_0x0389('0x0'));var rimraf=require(_0x0389('0x1'));var zipdir=require(_0x0389('0x2'));var jsonpatch=require(_0x0389('0x3'));var rp=require(_0x0389('0x4'));var moment=require('moment');var BPromise=require(_0x0389('0x5'));var Mustache=require(_0x0389('0x6'));var util=require(_0x0389('0x7'));var path=require(_0x0389('0x8'));var sox=require(_0x0389('0x9'));var csv=require(_0x0389('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0389('0xb'));var squel=require(_0x0389('0xc'));var crypto=require(_0x0389('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0389('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0389('0xf'));var authService=require(_0x0389('0x10'));var qs=require(_0x0389('0x11'));var as=require(_0x0389('0x12'));var hardwareService=require(_0x0389('0x13'));var logger=require(_0x0389('0x14'))(_0x0389('0x15'));var utils=require('../../config/utils');var config=require(_0x0389('0x16'));var licenseUtil=require(_0x0389('0x17'));var db=require(_0x0389('0x18'))['db'];function respondWithStatusCode(_0x2377b4,_0x3875ab){_0x3875ab=_0x3875ab||0xcc;return function(_0x479233){if(_0x479233){return _0x2377b4[_0x0389('0x19')](_0x3875ab);}return _0x2377b4[_0x0389('0x1a')](_0x3875ab)['end']();};}function respondWithResult(_0x4dc6ee,_0xf12a0){_0xf12a0=_0xf12a0||0xc8;return function(_0x41aaf5){if(_0x41aaf5){return _0x4dc6ee[_0x0389('0x1a')](_0xf12a0)[_0x0389('0x1b')](_0x41aaf5);}};}function respondWithFilteredResult(_0x251cc8,_0x5e9556){return function(_0x234d7d){if(_0x234d7d){var _0x1e7ac6=typeof _0x5e9556[_0x0389('0x1c')]===_0x0389('0x1d')&&typeof _0x5e9556[_0x0389('0x1e')]===_0x0389('0x1d');var _0x2af087=_0x234d7d[_0x0389('0x1f')];var _0x3f1a40=_0x1e7ac6?0x0:_0x5e9556['offset'];var _0xc117ec=_0x1e7ac6?_0x234d7d[_0x0389('0x1f')]:_0x5e9556['offset']+_0x5e9556[_0x0389('0x1e')];var _0x1d3877;if(_0xc117ec>=_0x2af087){_0xc117ec=_0x2af087;_0x1d3877=0xc8;}else{_0x1d3877=0xce;}_0x251cc8[_0x0389('0x1a')](_0x1d3877);return _0x251cc8[_0x0389('0x20')](_0x0389('0x21'),_0x3f1a40+'-'+_0xc117ec+'/'+_0x2af087)[_0x0389('0x1b')](_0x234d7d);}return null;};}function patchUpdates(_0x493f21){return function(_0x3c33a7){try{jsonpatch[_0x0389('0x22')](_0x3c33a7,_0x493f21,!![]);}catch(_0x3bc0f4){return BPromise[_0x0389('0x23')](_0x3bc0f4);}return _0x3c33a7[_0x0389('0x24')]();};}function saveUpdates(_0x142cdd,_0x43f055){return function(_0x2926b4){if(_0x2926b4){return _0x2926b4[_0x0389('0x25')](_0x142cdd)[_0x0389('0x26')](function(_0x36f4ec){return _0x36f4ec;});}return null;};}function removeEntity(_0x94cb01,_0x4a95e7){return function(_0x2bfcf7){if(_0x2bfcf7){return _0x2bfcf7[_0x0389('0x27')]()['then'](function(){_0x94cb01[_0x0389('0x1a')](0xcc)[_0x0389('0x28')]();});}};}function handleEntityNotFound(_0x479c98,_0x223baa){return function(_0x5bdfed){if(!_0x5bdfed){_0x479c98[_0x0389('0x19')](0x194);}return _0x5bdfed;};}function handleError(_0x46106e,_0x2efe67){_0x2efe67=_0x2efe67||0x1f4;return function(_0x19f54f){logger['error'](_0x19f54f[_0x0389('0x29')]);if(_0x19f54f[_0x0389('0x2a')]){delete _0x19f54f[_0x0389('0x2a')];}_0x46106e['status'](_0x2efe67)['send'](_0x19f54f);};}exports[_0x0389('0x2b')]=function(_0x27fdbe,_0x30a9a7){var _0x3a291d={},_0x8b1e61={},_0x2f0427={'count':0x0,'rows':[]};var _0xb9c35=_[_0x0389('0x2c')](db[_0x0389('0x2d')][_0x0389('0x2e')],function(_0x35c82d){return{'name':_0x35c82d[_0x0389('0x2f')],'type':_0x35c82d[_0x0389('0x30')]['key']};});_0x8b1e61[_0x0389('0x31')]=_[_0x0389('0x2c')](_0xb9c35,_0x0389('0x2a'));_0x8b1e61[_0x0389('0x32')]=_[_0x0389('0x33')](_0x27fdbe[_0x0389('0x32')]);_0x8b1e61[_0x0389('0x34')]=_[_0x0389('0x35')](_0x8b1e61[_0x0389('0x31')],_0x8b1e61[_0x0389('0x32')]);_0x3a291d[_0x0389('0x36')]=_['intersection'](_0x8b1e61[_0x0389('0x31')],qs[_0x0389('0x37')](_0x27fdbe[_0x0389('0x32')][_0x0389('0x37')]));_0x3a291d[_0x0389('0x36')]=_0x3a291d[_0x0389('0x36')]['length']?_0x3a291d['attributes']:_0x8b1e61[_0x0389('0x31')];if(!_0x27fdbe[_0x0389('0x32')][_0x0389('0x38')](_0x0389('0x39'))){_0x3a291d[_0x0389('0x1e')]=qs[_0x0389('0x1e')](_0x27fdbe[_0x0389('0x32')][_0x0389('0x1e')]);_0x3a291d[_0x0389('0x1c')]=qs[_0x0389('0x1c')](_0x27fdbe['query']['offset']);}_0x3a291d['order']=qs[_0x0389('0x3a')](_0x27fdbe[_0x0389('0x32')][_0x0389('0x3a')]);_0x3a291d['where']=qs['filters'](_[_0x0389('0x3b')](_0x27fdbe[_0x0389('0x32')],_0x8b1e61[_0x0389('0x34')]),_0xb9c35);if(_0x27fdbe[_0x0389('0x32')][_0x0389('0x3c')]){_0x3a291d[_0x0389('0x3d')]=_[_0x0389('0x3e')](_0x3a291d[_0x0389('0x3d')],{'$or':_['map'](_0xb9c35,function(_0x5c7907){if(_0x5c7907[_0x0389('0x30')]!=='VIRTUAL'){var _0x2186a6={};_0x2186a6[_0x5c7907[_0x0389('0x2a')]]={'$like':'%'+_0x27fdbe[_0x0389('0x32')]['filter']+'%'};return _0x2186a6;}})});}_0x3a291d=_['merge']({},_0x3a291d,_0x27fdbe[_0x0389('0x3f')]);var _0x2a9a9a={'where':_0x3a291d[_0x0389('0x3d')]};return db[_0x0389('0x2d')][_0x0389('0x1f')](_0x2a9a9a)[_0x0389('0x26')](function(_0x1f00f3){_0x2f0427[_0x0389('0x1f')]=_0x1f00f3;if(_0x27fdbe[_0x0389('0x32')][_0x0389('0x40')]){_0x3a291d['include']=[{'all':!![]}];}return db[_0x0389('0x2d')][_0x0389('0x41')](_0x3a291d);})[_0x0389('0x26')](function(_0x2a6bfa){_0x2f0427['rows']=_0x2a6bfa;return _0x2f0427;})[_0x0389('0x26')](respondWithFilteredResult(_0x30a9a7,_0x3a291d))[_0x0389('0x42')](handleError(_0x30a9a7,null));};exports[_0x0389('0x43')]=function(_0xf14728,_0x19c35a){var _0x58e879={'raw':!![],'where':{'id':_0xf14728[_0x0389('0x44')]['id']}},_0x274dfc={};_0x274dfc[_0x0389('0x31')]=_[_0x0389('0x33')](db[_0x0389('0x2d')][_0x0389('0x2e')]);_0x274dfc['query']=_[_0x0389('0x33')](_0xf14728[_0x0389('0x32')]);_0x274dfc[_0x0389('0x34')]=_[_0x0389('0x35')](_0x274dfc[_0x0389('0x31')],_0x274dfc[_0x0389('0x32')]);_0x58e879[_0x0389('0x36')]=_['intersection'](_0x274dfc['model'],qs[_0x0389('0x37')](_0xf14728['query'][_0x0389('0x37')]));_0x58e879[_0x0389('0x36')]=_0x58e879[_0x0389('0x36')][_0x0389('0x45')]?_0x58e879['attributes']:_0x274dfc[_0x0389('0x31')];if(_0xf14728[_0x0389('0x32')]['includeAll']){_0x58e879[_0x0389('0x46')]=[{'all':!![]}];}_0x58e879=_[_0x0389('0x3e')]({},_0x58e879,_0xf14728[_0x0389('0x3f')]);return db[_0x0389('0x2d')]['find'](_0x58e879)[_0x0389('0x26')](handleEntityNotFound(_0x19c35a,null))['then'](respondWithResult(_0x19c35a,null))[_0x0389('0x42')](handleError(_0x19c35a,null));};exports[_0x0389('0x47')]=function(_0x53abf9,_0x8cf0c3){return db[_0x0389('0x2d')]['create'](_0x53abf9['body'],{})['then'](respondWithResult(_0x8cf0c3,0xc9))[_0x0389('0x42')](handleError(_0x8cf0c3,null));};exports['update']=function(_0x218018,_0x12c10f){if(_0x218018[_0x0389('0x48')]['id']){delete _0x218018['body']['id'];}return db['MailSubstatus'][_0x0389('0x49')]({'where':{'id':_0x218018[_0x0389('0x44')]['id']}})[_0x0389('0x26')](handleEntityNotFound(_0x12c10f,null))['then'](saveUpdates(_0x218018[_0x0389('0x48')],null))[_0x0389('0x26')](respondWithResult(_0x12c10f,null))[_0x0389('0x42')](handleError(_0x12c10f,null));};exports[_0x0389('0x27')]=function(_0x38fca9,_0x22ed33){return db[_0x0389('0x2d')][_0x0389('0x49')]({'where':{'id':_0x38fca9[_0x0389('0x44')]['id']}})[_0x0389('0x26')](handleEntityNotFound(_0x22ed33,null))[_0x0389('0x26')](removeEntity(_0x22ed33,null))[_0x0389('0x42')](handleError(_0x22ed33,null));};exports[_0x0389('0x4a')]=function(_0x182582,_0xa0fd89){return db[_0x0389('0x2d')]['describe']()['then'](respondWithResult(_0xa0fd89,null))['catch'](handleError(_0xa0fd89,null));};
\ No newline at end of file
+var _0xcb7c=['end','json','offset','undefined','count','limit','reject','update','then','stack','name','index','MailSubstatus','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','params','find','catch','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x5eb2be,_0x293748){var _0xe503ef=function(_0x4724d0){while(--_0x4724d0){_0x5eb2be['push'](_0x5eb2be['shift']());}};_0xe503ef(++_0x293748);}(_0xcb7c,0x76));var _0xccb7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb7c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xccb7('0x0'));var rimraf=require(_0xccb7('0x1'));var zipdir=require(_0xccb7('0x2'));var jsonpatch=require(_0xccb7('0x3'));var rp=require(_0xccb7('0x4'));var moment=require(_0xccb7('0x5'));var BPromise=require(_0xccb7('0x6'));var Mustache=require('mustache');var util=require(_0xccb7('0x7'));var path=require(_0xccb7('0x8'));var sox=require(_0xccb7('0x9'));var csv=require(_0xccb7('0xa'));var ejs=require(_0xccb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xccb7('0xc'));var squel=require(_0xccb7('0xd'));var crypto=require(_0xccb7('0xe'));var jsforce=require(_0xccb7('0xf'));var deskjs=require(_0xccb7('0x10'));var toCsv=require(_0xccb7('0xa'));var querystring=require('querystring');var Papa=require(_0xccb7('0x11'));var Redis=require(_0xccb7('0x12'));var authService=require(_0xccb7('0x13'));var qs=require(_0xccb7('0x14'));var as=require(_0xccb7('0x15'));var hardwareService=require(_0xccb7('0x16'));var logger=require('../../config/logger')(_0xccb7('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xccb7('0x18'));var db=require(_0xccb7('0x19'))['db'];function respondWithStatusCode(_0x257cad,_0x169eb0){_0x169eb0=_0x169eb0||0xcc;return function(_0x35480b){if(_0x35480b){return _0x257cad[_0xccb7('0x1a')](_0x169eb0);}return _0x257cad[_0xccb7('0x1b')](_0x169eb0)[_0xccb7('0x1c')]();};}function respondWithResult(_0x2abefc,_0x130abc){_0x130abc=_0x130abc||0xc8;return function(_0x577f5b){if(_0x577f5b){return _0x2abefc[_0xccb7('0x1b')](_0x130abc)[_0xccb7('0x1d')](_0x577f5b);}};}function respondWithFilteredResult(_0x54f2db,_0x3483cc){return function(_0x250c02){if(_0x250c02){var _0xa067ee=typeof _0x3483cc[_0xccb7('0x1e')]===_0xccb7('0x1f')&&typeof _0x3483cc['limit']===_0xccb7('0x1f');var _0xb5e5d1=_0x250c02['count'];var _0x32ee61=_0xa067ee?0x0:_0x3483cc['offset'];var _0x20a996=_0xa067ee?_0x250c02[_0xccb7('0x20')]:_0x3483cc[_0xccb7('0x1e')]+_0x3483cc[_0xccb7('0x21')];var _0x355e07;if(_0x20a996>=_0xb5e5d1){_0x20a996=_0xb5e5d1;_0x355e07=0xc8;}else{_0x355e07=0xce;}_0x54f2db[_0xccb7('0x1b')](_0x355e07);return _0x54f2db['set']('Content-Range',_0x32ee61+'-'+_0x20a996+'/'+_0xb5e5d1)[_0xccb7('0x1d')](_0x250c02);}return null;};}function patchUpdates(_0x1d6d65){return function(_0x5d0395){try{jsonpatch['apply'](_0x5d0395,_0x1d6d65,!![]);}catch(_0x1d7b4b){return BPromise[_0xccb7('0x22')](_0x1d7b4b);}return _0x5d0395['save']();};}function saveUpdates(_0x47673c,_0x2b58a5){return function(_0x548051){if(_0x548051){return _0x548051[_0xccb7('0x23')](_0x47673c)['then'](function(_0x2b35cd){return _0x2b35cd;});}return null;};}function removeEntity(_0x47113d,_0x209437){return function(_0xedf19b){if(_0xedf19b){return _0xedf19b['destroy']()[_0xccb7('0x24')](function(){_0x47113d[_0xccb7('0x1b')](0xcc)[_0xccb7('0x1c')]();});}};}function handleEntityNotFound(_0x578e56,_0x252f03){return function(_0x567369){if(!_0x567369){_0x578e56[_0xccb7('0x1a')](0x194);}return _0x567369;};}function handleError(_0x4dad7f,_0x222e2d){_0x222e2d=_0x222e2d||0x1f4;return function(_0x126aec){logger['error'](_0x126aec[_0xccb7('0x25')]);if(_0x126aec[_0xccb7('0x26')]){delete _0x126aec[_0xccb7('0x26')];}_0x4dad7f['status'](_0x222e2d)['send'](_0x126aec);};}exports[_0xccb7('0x27')]=function(_0x48fd01,_0x29f7b9){var _0x46f87e={},_0x2ebbdb={},_0x132c36={'count':0x0,'rows':[]};var _0x360b33=_['map'](db[_0xccb7('0x28')][_0xccb7('0x29')],function(_0x113126){return{'name':_0x113126[_0xccb7('0x2a')],'type':_0x113126['type'][_0xccb7('0x2b')]};});_0x2ebbdb[_0xccb7('0x2c')]=_['map'](_0x360b33,_0xccb7('0x26'));_0x2ebbdb[_0xccb7('0x2d')]=_[_0xccb7('0x2e')](_0x48fd01['query']);_0x2ebbdb[_0xccb7('0x2f')]=_[_0xccb7('0x30')](_0x2ebbdb[_0xccb7('0x2c')],_0x2ebbdb[_0xccb7('0x2d')]);_0x46f87e[_0xccb7('0x31')]=_[_0xccb7('0x30')](_0x2ebbdb[_0xccb7('0x2c')],qs[_0xccb7('0x32')](_0x48fd01['query'][_0xccb7('0x32')]));_0x46f87e['attributes']=_0x46f87e[_0xccb7('0x31')][_0xccb7('0x33')]?_0x46f87e[_0xccb7('0x31')]:_0x2ebbdb[_0xccb7('0x2c')];if(!_0x48fd01[_0xccb7('0x2d')][_0xccb7('0x34')](_0xccb7('0x35'))){_0x46f87e[_0xccb7('0x21')]=qs[_0xccb7('0x21')](_0x48fd01[_0xccb7('0x2d')]['limit']);_0x46f87e[_0xccb7('0x1e')]=qs[_0xccb7('0x1e')](_0x48fd01[_0xccb7('0x2d')]['offset']);}_0x46f87e[_0xccb7('0x36')]=qs[_0xccb7('0x37')](_0x48fd01[_0xccb7('0x2d')][_0xccb7('0x37')]);_0x46f87e[_0xccb7('0x38')]=qs['filters'](_[_0xccb7('0x39')](_0x48fd01['query'],_0x2ebbdb[_0xccb7('0x2f')]),_0x360b33);if(_0x48fd01[_0xccb7('0x2d')][_0xccb7('0x3a')]){_0x46f87e['where']=_[_0xccb7('0x3b')](_0x46f87e[_0xccb7('0x38')],{'$or':_[_0xccb7('0x3c')](_0x360b33,function(_0x536ed9){if(_0x536ed9['type']!==_0xccb7('0x3d')){var _0x260e0e={};_0x260e0e[_0x536ed9[_0xccb7('0x26')]]={'$like':'%'+_0x48fd01[_0xccb7('0x2d')][_0xccb7('0x3a')]+'%'};return _0x260e0e;}})});}_0x46f87e=_[_0xccb7('0x3b')]({},_0x46f87e,_0x48fd01[_0xccb7('0x3e')]);var _0x52d896={'where':_0x46f87e[_0xccb7('0x38')]};return db[_0xccb7('0x28')][_0xccb7('0x20')](_0x52d896)['then'](function(_0x9f8eea){_0x132c36[_0xccb7('0x20')]=_0x9f8eea;if(_0x48fd01[_0xccb7('0x2d')]['includeAll']){_0x46f87e[_0xccb7('0x3f')]=[{'all':!![]}];}return db['MailSubstatus'][_0xccb7('0x40')](_0x46f87e);})[_0xccb7('0x24')](function(_0x42033f){_0x132c36[_0xccb7('0x41')]=_0x42033f;return _0x132c36;})[_0xccb7('0x24')](respondWithFilteredResult(_0x29f7b9,_0x46f87e))['catch'](handleError(_0x29f7b9,null));};exports['show']=function(_0x36f731,_0x1e618a){var _0x40ec03={'raw':!![],'where':{'id':_0x36f731[_0xccb7('0x42')]['id']}},_0x3d38ff={};_0x3d38ff[_0xccb7('0x2c')]=_[_0xccb7('0x2e')](db[_0xccb7('0x28')]['rawAttributes']);_0x3d38ff['query']=_['keys'](_0x36f731[_0xccb7('0x2d')]);_0x3d38ff[_0xccb7('0x2f')]=_[_0xccb7('0x30')](_0x3d38ff[_0xccb7('0x2c')],_0x3d38ff[_0xccb7('0x2d')]);_0x40ec03[_0xccb7('0x31')]=_[_0xccb7('0x30')](_0x3d38ff[_0xccb7('0x2c')],qs[_0xccb7('0x32')](_0x36f731[_0xccb7('0x2d')][_0xccb7('0x32')]));_0x40ec03[_0xccb7('0x31')]=_0x40ec03['attributes'][_0xccb7('0x33')]?_0x40ec03['attributes']:_0x3d38ff[_0xccb7('0x2c')];if(_0x36f731[_0xccb7('0x2d')]['includeAll']){_0x40ec03['include']=[{'all':!![]}];}_0x40ec03=_[_0xccb7('0x3b')]({},_0x40ec03,_0x36f731[_0xccb7('0x3e')]);return db[_0xccb7('0x28')][_0xccb7('0x43')](_0x40ec03)[_0xccb7('0x24')](handleEntityNotFound(_0x1e618a,null))[_0xccb7('0x24')](respondWithResult(_0x1e618a,null))[_0xccb7('0x44')](handleError(_0x1e618a,null));};exports[_0xccb7('0x45')]=function(_0x569595,_0x3c9777){return db['MailSubstatus'][_0xccb7('0x45')](_0x569595[_0xccb7('0x46')],{})['then'](respondWithResult(_0x3c9777,0xc9))[_0xccb7('0x44')](handleError(_0x3c9777,null));};exports[_0xccb7('0x23')]=function(_0x1ebd51,_0xb12a1e){if(_0x1ebd51['body']['id']){delete _0x1ebd51['body']['id'];}return db['MailSubstatus'][_0xccb7('0x43')]({'where':{'id':_0x1ebd51[_0xccb7('0x42')]['id']}})['then'](handleEntityNotFound(_0xb12a1e,null))[_0xccb7('0x24')](saveUpdates(_0x1ebd51[_0xccb7('0x46')],null))[_0xccb7('0x24')](respondWithResult(_0xb12a1e,null))[_0xccb7('0x44')](handleError(_0xb12a1e,null));};exports[_0xccb7('0x47')]=function(_0x270b2c,_0x1dff96){return db[_0xccb7('0x28')][_0xccb7('0x43')]({'where':{'id':_0x270b2c[_0xccb7('0x42')]['id']}})[_0xccb7('0x24')](handleEntityNotFound(_0x1dff96,null))[_0xccb7('0x24')](removeEntity(_0x1dff96,null))[_0xccb7('0x44')](handleError(_0x1dff96,null));};exports[_0xccb7('0x48')]=function(_0x5f0c97,_0x48d649){return db['MailSubstatus']['describe']()[_0xccb7('0x24')](respondWithResult(_0x48d649,null))[_0xccb7('0x44')](handleError(_0x48d649,null));};
\ No newline at end of file
index 49d7336..f97eb91 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5439=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3b4c09,_0x52d03d){var _0x2c5349=function(_0x2a75a2){while(--_0x2a75a2){_0x3b4c09['push'](_0x3b4c09['shift']());}};_0x2c5349(++_0x52d03d);}(_0x5439,0x7b));var _0x9543=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5439[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x9543('0x0'));var MailSubstatus=require(_0x9543('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x9543('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x72cbfa){return function(_0x14b4da,_0x200ec4,_0x18cf3a){MailSubstatusEvents[_0x9543('0x3')](_0x72cbfa+':'+_0x14b4da['id'],_0x14b4da);MailSubstatusEvents[_0x9543('0x3')](_0x72cbfa,_0x14b4da);_0x18cf3a(null);};}for(var e in events){if(events[_0x9543('0x4')](e)){var event=events[e];MailSubstatus[_0x9543('0x5')](e,emitEvent(event));}}module[_0x9543('0x6')]=MailSubstatusEvents;
\ No newline at end of file
+var _0x2f96=['events','../../mysqldb','MailSubstatus','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x418a4d,_0x58f45c){var _0x395457=function(_0x4fd659){while(--_0x4fd659){_0x418a4d['push'](_0x418a4d['shift']());}};_0x395457(++_0x58f45c);}(_0x2f96,0x168));var _0x62f9=function(_0x43f614,_0x208d0b){_0x43f614=_0x43f614-0x0;var _0x4cc742=_0x2f96[_0x43f614];return _0x4cc742;};'use strict';var EventEmitter=require(_0x62f9('0x0'));var MailSubstatus=require(_0x62f9('0x1'))['db'][_0x62f9('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x62f9('0x3')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x2d1fad){return function(_0x2dbe97,_0x49eee8,_0x4336ff){MailSubstatusEvents[_0x62f9('0x4')](_0x2d1fad+':'+_0x2dbe97['id'],_0x2dbe97);MailSubstatusEvents[_0x62f9('0x4')](_0x2d1fad,_0x2dbe97);_0x4336ff(null);};}for(var e in events){if(events[_0x62f9('0x5')](e)){var event=events[e];MailSubstatus[_0x62f9('0x6')](e,emitEvent(event));}}module[_0x62f9('0x7')]=MailSubstatusEvents;
\ No newline at end of file
index 723456c..a29cb2a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3fe4=['define','MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','_previousDataValues','then','catch','./mailSubstatus.attributes','exports'];(function(_0x109e39,_0x27f91c){var _0x3b142f=function(_0xec4d82){while(--_0xec4d82){_0x109e39['push'](_0x109e39['shift']());}};_0x3b142f(++_0x27f91c);}(_0x3fe4,0xee));var _0x43fe=function(_0x5e82f1,_0x59a5f8){_0x5e82f1=_0x5e82f1-0x0;var _0x1c7f80=_0x3fe4[_0x5e82f1];return _0x1c7f80;};'use strict';var attributes=require(_0x43fe('0x0'));module[_0x43fe('0x1')]=function(_0x192fb1){var _0x2d3a38=_0x192fb1['models'];return _0x192fb1[_0x43fe('0x2')](_0x43fe('0x3'),attributes,{'tableName':_0x43fe('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x2b67f2,_0x121ae1,_0x4ca1df){return _0x2d3a38[_0x43fe('0x5')][_0x43fe('0x6')]({'value':_0x2b67f2[_0x43fe('0x7')]},{'where':{'field':_0x43fe('0x8'),'value':_0x2b67f2[_0x43fe('0x9')][_0x43fe('0x7')]}})[_0x43fe('0xa')](function(){_0x4ca1df();})[_0x43fe('0xb')](function(_0x10f222){_0x4ca1df(_0x10f222);});}}});};
\ No newline at end of file
+var _0x7d18=['mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','models','define','MailSubstatus','Condition','update','name'];(function(_0x2a7a21,_0x2ba5a5){var _0x21de6e=function(_0x56957b){while(--_0x56957b){_0x2a7a21['push'](_0x2a7a21['shift']());}};_0x21de6e(++_0x2ba5a5);}(_0x7d18,0xa3));var _0x87d1=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x7d18[_0x54a2e4];return _0x4742d0;};'use strict';var attributes=require(_0x87d1('0x0'));module['exports']=function(_0x4efe9a){var _0x303516=_0x4efe9a[_0x87d1('0x1')];return _0x4efe9a[_0x87d1('0x2')](_0x87d1('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xc60832,_0xb4e125,_0x21948f){return _0x303516[_0x87d1('0x4')][_0x87d1('0x5')]({'value':_0xc60832[_0x87d1('0x6')]},{'where':{'field':_0x87d1('0x7'),'value':_0xc60832[_0x87d1('0x8')][_0x87d1('0x6')]}})[_0x87d1('0x9')](function(){_0x21948f();})['catch'](function(_0x3ccb20){_0x21948f(_0x3ccb20);});}}});};
\ No newline at end of file
index d551573..c804a14 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b57=['then','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x583b14,_0x59fe86){var _0x8214dc=function(_0x5954a2){while(--_0x5954a2){_0x583b14['push'](_0x583b14['shift']());}};_0x8214dc(++_0x59fe86);}(_0x5b57,0x14a));var _0x75b5=function(_0x142c92,_0x210b00){_0x142c92=_0x142c92-0x0;var _0x205cf9=_0x5b57[_0x142c92];return _0x205cf9;};'use strict';var _=require('lodash');var util=require(_0x75b5('0x0'));var moment=require('moment');var BPromise=require(_0x75b5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x75b5('0x2'));var db=require(_0x75b5('0x3'))['db'];var utils=require(_0x75b5('0x4'));var logger=require(_0x75b5('0x5'))(_0x75b5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x75b5('0x7')][_0x75b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3dbbf8,_0x3e6fed,_0x321239){return new BPromise(function(_0xd0fc19,_0x5b523f){return client[_0x75b5('0x9')](_0x3dbbf8,_0x321239)[_0x75b5('0xa')](function(_0x41af1c){logger['info'](_0x75b5('0xb'),_0x3e6fed,'request\x20sent');logger[_0x75b5('0xc')](_0x75b5('0xd'),_0x3e6fed,'request\x20sent',JSON[_0x75b5('0xe')](_0x41af1c));if(_0x41af1c[_0x75b5('0xf')]){if(_0x41af1c[_0x75b5('0xf')]['code']===0x1f4){logger[_0x75b5('0xf')](_0x75b5('0xb'),_0x3e6fed,_0x41af1c[_0x75b5('0xf')][_0x75b5('0x10')]);return _0x5b523f(_0x41af1c['error'][_0x75b5('0x10')]);}logger['error'](_0x75b5('0xb'),_0x3e6fed,_0x41af1c[_0x75b5('0xf')][_0x75b5('0x10')]);return _0xd0fc19(_0x41af1c['error'][_0x75b5('0x10')]);}else{logger[_0x75b5('0x11')](_0x75b5('0xb'),_0x3e6fed,_0x75b5('0x12'));_0xd0fc19(_0x41af1c[_0x75b5('0x13')][_0x75b5('0x10')]);}})['catch'](function(_0x42aebc){logger[_0x75b5('0xf')](_0x75b5('0xb'),_0x3e6fed,_0x42aebc);_0x5b523f(_0x42aebc);});});}
\ No newline at end of file
+var _0xee49=['util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x4342f0,_0x3009c8){var _0x5ce9f0=function(_0x576eed){while(--_0x576eed){_0x4342f0['push'](_0x4342f0['shift']());}};_0x5ce9f0(++_0x3009c8);}(_0xee49,0x158));var _0x9ee4=function(_0x3661ca,_0xc9273e){_0x3661ca=_0x3661ca-0x0;var _0xf22108=_0xee49[_0x3661ca];return _0xf22108;};'use strict';var _=require(_0x9ee4('0x0'));var util=require(_0x9ee4('0x1'));var moment=require(_0x9ee4('0x2'));var BPromise=require('bluebird');var rs=require(_0x9ee4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ee4('0x4'))['db'];var utils=require(_0x9ee4('0x5'));var logger=require(_0x9ee4('0x6'))('rpc');var config=require(_0x9ee4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9ee4('0x8')][_0x9ee4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fc98f,_0x2aee2a,_0x18c455){return new BPromise(function(_0x1a711b,_0x4cb117){return client[_0x9ee4('0xa')](_0x4fc98f,_0x18c455)[_0x9ee4('0xb')](function(_0x110f86){logger['info'](_0x9ee4('0xc'),_0x2aee2a,_0x9ee4('0xd'));logger[_0x9ee4('0xe')](_0x9ee4('0xf'),_0x2aee2a,_0x9ee4('0xd'),JSON[_0x9ee4('0x10')](_0x110f86));if(_0x110f86[_0x9ee4('0x11')]){if(_0x110f86[_0x9ee4('0x11')][_0x9ee4('0x12')]===0x1f4){logger[_0x9ee4('0x11')](_0x9ee4('0xc'),_0x2aee2a,_0x110f86[_0x9ee4('0x11')][_0x9ee4('0x13')]);return _0x4cb117(_0x110f86[_0x9ee4('0x11')]['message']);}logger[_0x9ee4('0x11')](_0x9ee4('0xc'),_0x2aee2a,_0x110f86[_0x9ee4('0x11')][_0x9ee4('0x13')]);return _0x1a711b(_0x110f86[_0x9ee4('0x11')][_0x9ee4('0x13')]);}else{logger[_0x9ee4('0x14')](_0x9ee4('0xc'),_0x2aee2a,'request\x20sent');_0x1a711b(_0x110f86[_0x9ee4('0x15')][_0x9ee4('0x13')]);}})[_0x9ee4('0x16')](function(_0x1b6334){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x2aee2a,_0x1b6334);_0x4cb117(_0x1b6334);});});}
\ No newline at end of file
index af640c3..ca3a41e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbe1=['create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x5cc81b,_0x178c2b){var _0x20a130=function(_0x4242b3){while(--_0x4242b3){_0x5cc81b['push'](_0x5cc81b['shift']());}};_0x20a130(++_0x178c2b);}(_0xbbe1,0x130));var _0x1bbe=function(_0x24d61f,_0x38cebb){_0x24d61f=_0x24d61f-0x0;var _0x29ae79=_0xbbe1[_0x24d61f];return _0x29ae79;};'use strict';var multer=require(_0x1bbe('0x0'));var util=require(_0x1bbe('0x1'));var path=require(_0x1bbe('0x2'));var timeout=require(_0x1bbe('0x3'));var express=require('express');var router=express[_0x1bbe('0x4')]();var fs_extra=require(_0x1bbe('0x5'));var auth=require(_0x1bbe('0x6'));var interaction=require(_0x1bbe('0x7'));var config=require(_0x1bbe('0x8'));var controller=require(_0x1bbe('0x9'));router[_0x1bbe('0xa')]('/',auth[_0x1bbe('0xb')](),controller[_0x1bbe('0xc')]);router[_0x1bbe('0xa')](_0x1bbe('0xd'),auth[_0x1bbe('0xb')](),controller[_0x1bbe('0xe')]);router[_0x1bbe('0xa')](_0x1bbe('0xf'),auth[_0x1bbe('0xb')](),controller[_0x1bbe('0x10')]);router[_0x1bbe('0x11')]('/',auth[_0x1bbe('0xb')](),controller[_0x1bbe('0x12')]);router[_0x1bbe('0x13')]('/:id',auth[_0x1bbe('0xb')](),controller[_0x1bbe('0x14')]);router[_0x1bbe('0x15')](_0x1bbe('0xf'),auth['isAuthenticated'](),controller[_0x1bbe('0x16')]);module['exports']=router;
\ No newline at end of file
+var _0x32da=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','/describe','isAuthenticated','get','show','post','create'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x32da,0x1e8));var _0xa32d=function(_0x229a31,_0x5802b7){_0x229a31=_0x229a31-0x0;var _0x42799d=_0x32da[_0x229a31];return _0x42799d;};'use strict';var multer=require(_0xa32d('0x0'));var util=require(_0xa32d('0x1'));var path=require(_0xa32d('0x2'));var timeout=require(_0xa32d('0x3'));var express=require(_0xa32d('0x4'));var router=express[_0xa32d('0x5')]();var fs_extra=require(_0xa32d('0x6'));var auth=require(_0xa32d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa32d('0x8'));var controller=require('./mailTransferReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xa32d('0x9')]);router['get'](_0xa32d('0xa'),auth[_0xa32d('0xb')](),controller['describe']);router[_0xa32d('0xc')]('/:id',auth[_0xa32d('0xb')](),controller[_0xa32d('0xd')]);router[_0xa32d('0xe')]('/',auth['isAuthenticated'](),controller[_0xa32d('0xf')]);router['put'](_0xa32d('0x10'),auth['isAuthenticated'](),controller[_0xa32d('0x11')]);router[_0xa32d('0x12')]('/:id',auth[_0xa32d('0xb')](),controller[_0xa32d('0x13')]);module[_0xa32d('0x14')]=router;
\ No newline at end of file
index ab5d951..f86cc32 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2842cd,_0x311d01){var _0x5bfe3b=function(_0x1df838){while(--_0x1df838){_0x2842cd['push'](_0x2842cd['shift']());}};_0x5bfe3b(++_0x311d01);}(_0x00bb,0x1d8));var _0xb00b=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x00bb[_0x411add];return _0x238242;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}};
\ No newline at end of file
+var _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x2cd889,_0x287917){var _0x37d1d0=function(_0x5e3562){while(--_0x5e3562){_0x2cd889['push'](_0x2cd889['shift']());}};_0x37d1d0(++_0x287917);}(_0xf4eb,0xec));var _0xbf4e=function(_0x48007a,_0xa484d4){_0x48007a=_0x48007a-0x0;var _0x301b72=_0xf4eb[_0x48007a];return _0x301b72;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}};
\ No newline at end of file
index ae62eb3..fa2a243 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6884=['fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','find','create','body','params','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','MailTransferReport','rawAttributes'];(function(_0x26220d,_0x4069ec){var _0x32f50c=function(_0x245e9a){while(--_0x245e9a){_0x26220d['push'](_0x26220d['shift']());}};_0x32f50c(++_0x4069ec);}(_0x6884,0xf0));var _0x4688=function(_0x5db7b2,_0x5f38c3){_0x5db7b2=_0x5db7b2-0x0;var _0x35d2e9=_0x6884[_0x5db7b2];return _0x35d2e9;};'use strict';var emlformat=require(_0x4688('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4688('0x1'));var rp=require(_0x4688('0x2'));var moment=require(_0x4688('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4688('0x4'));var util=require(_0x4688('0x5'));var path=require(_0x4688('0x6'));var sox=require(_0x4688('0x7'));var csv=require(_0x4688('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4688('0x9'));var _=require(_0x4688('0xa'));var squel=require(_0x4688('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4688('0xc'));var toCsv=require(_0x4688('0x8'));var querystring=require(_0x4688('0xd'));var Papa=require(_0x4688('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4688('0xf'));var as=require(_0x4688('0x10'));var hardwareService=require(_0x4688('0x11'));var logger=require(_0x4688('0x12'))(_0x4688('0x13'));var utils=require('../../config/utils');var config=require(_0x4688('0x14'));var licenseUtil=require(_0x4688('0x15'));var db=require(_0x4688('0x16'))['db'];function respondWithStatusCode(_0x42e303,_0x307373){_0x307373=_0x307373||0xcc;return function(_0x595cc3){if(_0x595cc3){return _0x42e303['sendStatus'](_0x307373);}return _0x42e303[_0x4688('0x17')](_0x307373)[_0x4688('0x18')]();};}function respondWithResult(_0x5bdd66,_0x378826){_0x378826=_0x378826||0xc8;return function(_0x3c2ce2){if(_0x3c2ce2){return _0x5bdd66[_0x4688('0x17')](_0x378826)[_0x4688('0x19')](_0x3c2ce2);}};}function respondWithFilteredResult(_0x5044fc,_0x18b490){return function(_0x25c812){if(_0x25c812){var _0x3fd182=typeof _0x18b490[_0x4688('0x1a')]===_0x4688('0x1b')&&typeof _0x18b490[_0x4688('0x1c')]===_0x4688('0x1b');var _0x5e68a7=_0x25c812['count'];var _0x4d54a9=_0x3fd182?0x0:_0x18b490[_0x4688('0x1a')];var _0x378d71=_0x3fd182?_0x25c812[_0x4688('0x1d')]:_0x18b490[_0x4688('0x1a')]+_0x18b490[_0x4688('0x1c')];var _0xa4861e;if(_0x378d71>=_0x5e68a7){_0x378d71=_0x5e68a7;_0xa4861e=0xc8;}else{_0xa4861e=0xce;}_0x5044fc['status'](_0xa4861e);return _0x5044fc['set'](_0x4688('0x1e'),_0x4d54a9+'-'+_0x378d71+'/'+_0x5e68a7)['json'](_0x25c812);}return null;};}function patchUpdates(_0x3bc3b2){return function(_0xc5e3f8){try{jsonpatch[_0x4688('0x1f')](_0xc5e3f8,_0x3bc3b2,!![]);}catch(_0x517522){return BPromise['reject'](_0x517522);}return _0xc5e3f8[_0x4688('0x20')]();};}function saveUpdates(_0x2e7b33,_0x170ef9){return function(_0x6827fd){if(_0x6827fd){return _0x6827fd[_0x4688('0x21')](_0x2e7b33)['then'](function(_0x594282){return _0x594282;});}return null;};}function removeEntity(_0x1be9f6,_0x2cdee7){return function(_0x687335){if(_0x687335){return _0x687335[_0x4688('0x22')]()[_0x4688('0x23')](function(){_0x1be9f6[_0x4688('0x17')](0xcc)[_0x4688('0x18')]();});}};}function handleEntityNotFound(_0x108ff3,_0xf8675c){return function(_0x1770a8){if(!_0x1770a8){_0x108ff3[_0x4688('0x24')](0x194);}return _0x1770a8;};}function handleError(_0x478b70,_0x249922){_0x249922=_0x249922||0x1f4;return function(_0x2e060f){logger[_0x4688('0x25')](_0x2e060f['stack']);if(_0x2e060f[_0x4688('0x26')]){delete _0x2e060f[_0x4688('0x26')];}_0x478b70[_0x4688('0x17')](_0x249922)[_0x4688('0x27')](_0x2e060f);};}exports[_0x4688('0x28')]=function(_0x35d7c2,_0x56f6ed){var _0x36c1ce={},_0x1b07cf={},_0x4432a3={'count':0x0,'rows':[]};var _0x4bc33f=_[_0x4688('0x29')](db[_0x4688('0x2a')][_0x4688('0x2b')],function(_0x53165a){return{'name':_0x53165a[_0x4688('0x2c')],'type':_0x53165a[_0x4688('0x2d')]['key']};});_0x1b07cf[_0x4688('0x2e')]=_[_0x4688('0x29')](_0x4bc33f,_0x4688('0x26'));_0x1b07cf[_0x4688('0x2f')]=_[_0x4688('0x30')](_0x35d7c2[_0x4688('0x2f')]);_0x1b07cf[_0x4688('0x31')]=_[_0x4688('0x32')](_0x1b07cf[_0x4688('0x2e')],_0x1b07cf[_0x4688('0x2f')]);_0x36c1ce[_0x4688('0x33')]=_[_0x4688('0x32')](_0x1b07cf[_0x4688('0x2e')],qs['fields'](_0x35d7c2[_0x4688('0x2f')][_0x4688('0x34')]));_0x36c1ce[_0x4688('0x33')]=_0x36c1ce[_0x4688('0x33')][_0x4688('0x35')]?_0x36c1ce[_0x4688('0x33')]:_0x1b07cf['model'];if(!_0x35d7c2['query'][_0x4688('0x36')](_0x4688('0x37'))){_0x36c1ce['limit']=qs[_0x4688('0x1c')](_0x35d7c2[_0x4688('0x2f')]['limit']);_0x36c1ce[_0x4688('0x1a')]=qs[_0x4688('0x1a')](_0x35d7c2[_0x4688('0x2f')][_0x4688('0x1a')]);}_0x36c1ce[_0x4688('0x38')]=qs['sort'](_0x35d7c2[_0x4688('0x2f')]['sort']);_0x36c1ce['where']=qs['filters'](_['pick'](_0x35d7c2[_0x4688('0x2f')],_0x1b07cf[_0x4688('0x31')]),_0x4bc33f);if(_0x35d7c2[_0x4688('0x2f')]['filter']){_0x36c1ce[_0x4688('0x39')]=_[_0x4688('0x3a')](_0x36c1ce[_0x4688('0x39')],{'$or':_[_0x4688('0x29')](_0x4bc33f,function(_0x21a5a7){if(_0x21a5a7[_0x4688('0x2d')]!==_0x4688('0x3b')){var _0x3b892d={};_0x3b892d[_0x21a5a7[_0x4688('0x26')]]={'$like':'%'+_0x35d7c2[_0x4688('0x2f')]['filter']+'%'};return _0x3b892d;}})});}_0x36c1ce=_[_0x4688('0x3a')]({},_0x36c1ce,_0x35d7c2[_0x4688('0x3c')]);var _0x395fd5={'where':_0x36c1ce[_0x4688('0x39')]};return db[_0x4688('0x2a')][_0x4688('0x1d')](_0x395fd5)[_0x4688('0x23')](function(_0x40faad){_0x4432a3[_0x4688('0x1d')]=_0x40faad;if(_0x35d7c2[_0x4688('0x2f')][_0x4688('0x3d')]){_0x36c1ce[_0x4688('0x3e')]=[{'all':!![]}];}return db[_0x4688('0x2a')]['findAll'](_0x36c1ce);})['then'](function(_0x4bc9fa){_0x4432a3[_0x4688('0x3f')]=_0x4bc9fa;return _0x4432a3;})[_0x4688('0x23')](respondWithFilteredResult(_0x56f6ed,_0x36c1ce))[_0x4688('0x40')](handleError(_0x56f6ed,null));};exports[_0x4688('0x41')]=function(_0x1a9101,_0x171dfd){var _0x3cd172={'raw':!![],'where':{'id':_0x1a9101['params']['id']}},_0x7acf5d={};_0x7acf5d[_0x4688('0x2e')]=_[_0x4688('0x30')](db[_0x4688('0x2a')][_0x4688('0x2b')]);_0x7acf5d['query']=_[_0x4688('0x30')](_0x1a9101[_0x4688('0x2f')]);_0x7acf5d[_0x4688('0x31')]=_[_0x4688('0x32')](_0x7acf5d[_0x4688('0x2e')],_0x7acf5d[_0x4688('0x2f')]);_0x3cd172[_0x4688('0x33')]=_[_0x4688('0x32')](_0x7acf5d[_0x4688('0x2e')],qs['fields'](_0x1a9101[_0x4688('0x2f')][_0x4688('0x34')]));_0x3cd172[_0x4688('0x33')]=_0x3cd172[_0x4688('0x33')][_0x4688('0x35')]?_0x3cd172['attributes']:_0x7acf5d['model'];if(_0x1a9101[_0x4688('0x2f')][_0x4688('0x3d')]){_0x3cd172[_0x4688('0x3e')]=[{'all':!![]}];}_0x3cd172=_[_0x4688('0x3a')]({},_0x3cd172,_0x1a9101['options']);return db[_0x4688('0x2a')][_0x4688('0x42')](_0x3cd172)[_0x4688('0x23')](handleEntityNotFound(_0x171dfd,null))[_0x4688('0x23')](respondWithResult(_0x171dfd,null))['catch'](handleError(_0x171dfd,null));};exports[_0x4688('0x43')]=function(_0x22548a,_0x30e656){return db[_0x4688('0x2a')][_0x4688('0x43')](_0x22548a[_0x4688('0x44')],{})[_0x4688('0x23')](respondWithResult(_0x30e656,0xc9))['catch'](handleError(_0x30e656,null));};exports['update']=function(_0x1d78f3,_0x4351bc){if(_0x1d78f3['body']['id']){delete _0x1d78f3[_0x4688('0x44')]['id'];}return db[_0x4688('0x2a')][_0x4688('0x42')]({'where':{'id':_0x1d78f3[_0x4688('0x45')]['id']}})[_0x4688('0x23')](handleEntityNotFound(_0x4351bc,null))[_0x4688('0x23')](saveUpdates(_0x1d78f3[_0x4688('0x44')],null))['then'](respondWithResult(_0x4351bc,null))[_0x4688('0x40')](handleError(_0x4351bc,null));};exports[_0x4688('0x22')]=function(_0x424d5c,_0x35caeb){return db[_0x4688('0x2a')][_0x4688('0x42')]({'where':{'id':_0x424d5c[_0x4688('0x45')]['id']}})['then'](handleEntityNotFound(_0x35caeb,null))[_0x4688('0x23')](removeEntity(_0x35caeb,null))['catch'](handleError(_0x35caeb,null));};exports[_0x4688('0x46')]=function(_0x23a20f,_0x4cd665){return db[_0x4688('0x2a')][_0x4688('0x46')]()[_0x4688('0x23')](respondWithResult(_0x4cd665,null))[_0x4688('0x40')](handleError(_0x4cd665,null));};
\ No newline at end of file
+var _0x63ea=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','rows','catch','params','MailTransferReport','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','keys','filters','intersection','attributes','model','fields','query','length'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0x63ea,0x13b));var _0xa63e=function(_0x1f16ea,_0x6f65e3){_0x1f16ea=_0x1f16ea-0x0;var _0x19777f=_0x63ea[_0x1f16ea];return _0x19777f;};'use strict';var emlformat=require(_0xa63e('0x0'));var rimraf=require(_0xa63e('0x1'));var zipdir=require(_0xa63e('0x2'));var jsonpatch=require(_0xa63e('0x3'));var rp=require(_0xa63e('0x4'));var moment=require(_0xa63e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa63e('0x6'));var util=require(_0xa63e('0x7'));var path=require('path');var sox=require(_0xa63e('0x8'));var csv=require(_0xa63e('0x9'));var ejs=require(_0xa63e('0xa'));var fs=require('fs');var fs_extra=require(_0xa63e('0xb'));var _=require('lodash');var squel=require(_0xa63e('0xc'));var crypto=require(_0xa63e('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa63e('0xe'));var Papa=require(_0xa63e('0xf'));var Redis=require(_0xa63e('0x10'));var authService=require(_0xa63e('0x11'));var qs=require(_0xa63e('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa63e('0x13'))('api');var utils=require(_0xa63e('0x14'));var config=require(_0xa63e('0x15'));var licenseUtil=require(_0xa63e('0x16'));var db=require(_0xa63e('0x17'))['db'];function respondWithStatusCode(_0x1e9243,_0x25a907){_0x25a907=_0x25a907||0xcc;return function(_0xf11523){if(_0xf11523){return _0x1e9243['sendStatus'](_0x25a907);}return _0x1e9243[_0xa63e('0x18')](_0x25a907)[_0xa63e('0x19')]();};}function respondWithResult(_0xb6a318,_0x2ba831){_0x2ba831=_0x2ba831||0xc8;return function(_0x39fc00){if(_0x39fc00){return _0xb6a318[_0xa63e('0x18')](_0x2ba831)['json'](_0x39fc00);}};}function respondWithFilteredResult(_0x1bdf32,_0x40275c){return function(_0xb97687){if(_0xb97687){var _0x569e74=typeof _0x40275c[_0xa63e('0x1a')]===_0xa63e('0x1b')&&typeof _0x40275c[_0xa63e('0x1c')]===_0xa63e('0x1b');var _0xfbea3f=_0xb97687[_0xa63e('0x1d')];var _0x39742c=_0x569e74?0x0:_0x40275c[_0xa63e('0x1a')];var _0xb652f8=_0x569e74?_0xb97687[_0xa63e('0x1d')]:_0x40275c[_0xa63e('0x1a')]+_0x40275c[_0xa63e('0x1c')];var _0xb51afa;if(_0xb652f8>=_0xfbea3f){_0xb652f8=_0xfbea3f;_0xb51afa=0xc8;}else{_0xb51afa=0xce;}_0x1bdf32[_0xa63e('0x18')](_0xb51afa);return _0x1bdf32[_0xa63e('0x1e')](_0xa63e('0x1f'),_0x39742c+'-'+_0xb652f8+'/'+_0xfbea3f)[_0xa63e('0x20')](_0xb97687);}return null;};}function patchUpdates(_0x3b69ae){return function(_0x45c72e){try{jsonpatch[_0xa63e('0x21')](_0x45c72e,_0x3b69ae,!![]);}catch(_0x16170e){return BPromise['reject'](_0x16170e);}return _0x45c72e['save']();};}function saveUpdates(_0x5e0740,_0x221d6c){return function(_0x1c8975){if(_0x1c8975){return _0x1c8975[_0xa63e('0x22')](_0x5e0740)[_0xa63e('0x23')](function(_0xb4069e){return _0xb4069e;});}return null;};}function removeEntity(_0xfc61a9,_0xda127f){return function(_0x2f5ff2){if(_0x2f5ff2){return _0x2f5ff2[_0xa63e('0x24')]()['then'](function(){_0xfc61a9[_0xa63e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50a1e8,_0x57f223){return function(_0x661aac){if(!_0x661aac){_0x50a1e8[_0xa63e('0x25')](0x194);}return _0x661aac;};}function handleError(_0x363cf8,_0x4fafc5){_0x4fafc5=_0x4fafc5||0x1f4;return function(_0x146f4d){logger[_0xa63e('0x26')](_0x146f4d[_0xa63e('0x27')]);if(_0x146f4d[_0xa63e('0x28')]){delete _0x146f4d[_0xa63e('0x28')];}_0x363cf8[_0xa63e('0x18')](_0x4fafc5)[_0xa63e('0x29')](_0x146f4d);};}exports[_0xa63e('0x2a')]=function(_0x21d7a2,_0xc50ef7){var _0x562f2f={},_0x14a7c7={},_0x297750={'count':0x0,'rows':[]};var _0x4a6039=_[_0xa63e('0x2b')](db['MailTransferReport']['rawAttributes'],function(_0x2ac359){return{'name':_0x2ac359[_0xa63e('0x2c')],'type':_0x2ac359[_0xa63e('0x2d')][_0xa63e('0x2e')]};});_0x14a7c7['model']=_[_0xa63e('0x2b')](_0x4a6039,_0xa63e('0x28'));_0x14a7c7['query']=_[_0xa63e('0x2f')](_0x21d7a2['query']);_0x14a7c7[_0xa63e('0x30')]=_[_0xa63e('0x31')](_0x14a7c7['model'],_0x14a7c7['query']);_0x562f2f[_0xa63e('0x32')]=_[_0xa63e('0x31')](_0x14a7c7[_0xa63e('0x33')],qs[_0xa63e('0x34')](_0x21d7a2[_0xa63e('0x35')][_0xa63e('0x34')]));_0x562f2f[_0xa63e('0x32')]=_0x562f2f[_0xa63e('0x32')][_0xa63e('0x36')]?_0x562f2f[_0xa63e('0x32')]:_0x14a7c7[_0xa63e('0x33')];if(!_0x21d7a2['query'][_0xa63e('0x37')](_0xa63e('0x38'))){_0x562f2f['limit']=qs[_0xa63e('0x1c')](_0x21d7a2[_0xa63e('0x35')][_0xa63e('0x1c')]);_0x562f2f[_0xa63e('0x1a')]=qs[_0xa63e('0x1a')](_0x21d7a2[_0xa63e('0x35')][_0xa63e('0x1a')]);}_0x562f2f['order']=qs[_0xa63e('0x39')](_0x21d7a2[_0xa63e('0x35')][_0xa63e('0x39')]);_0x562f2f[_0xa63e('0x3a')]=qs['filters'](_[_0xa63e('0x3b')](_0x21d7a2[_0xa63e('0x35')],_0x14a7c7[_0xa63e('0x30')]),_0x4a6039);if(_0x21d7a2['query'][_0xa63e('0x3c')]){_0x562f2f['where']=_[_0xa63e('0x3d')](_0x562f2f['where'],{'$or':_[_0xa63e('0x2b')](_0x4a6039,function(_0x4b1aed){if(_0x4b1aed[_0xa63e('0x2d')]!=='VIRTUAL'){var _0x5ac74={};_0x5ac74[_0x4b1aed[_0xa63e('0x28')]]={'$like':'%'+_0x21d7a2['query'][_0xa63e('0x3c')]+'%'};return _0x5ac74;}})});}_0x562f2f=_[_0xa63e('0x3d')]({},_0x562f2f,_0x21d7a2[_0xa63e('0x3e')]);var _0x1a69f2={'where':_0x562f2f[_0xa63e('0x3a')]};return db['MailTransferReport']['count'](_0x1a69f2)[_0xa63e('0x23')](function(_0x1cac5b){_0x297750[_0xa63e('0x1d')]=_0x1cac5b;if(_0x21d7a2[_0xa63e('0x35')]['includeAll']){_0x562f2f[_0xa63e('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0xa63e('0x40')](_0x562f2f);})[_0xa63e('0x23')](function(_0x4069b5){_0x297750[_0xa63e('0x41')]=_0x4069b5;return _0x297750;})[_0xa63e('0x23')](respondWithFilteredResult(_0xc50ef7,_0x562f2f))[_0xa63e('0x42')](handleError(_0xc50ef7,null));};exports['show']=function(_0x3af5da,_0x29e05e){var _0x29fcbc={'raw':!![],'where':{'id':_0x3af5da[_0xa63e('0x43')]['id']}},_0x5dc0c5={};_0x5dc0c5[_0xa63e('0x33')]=_[_0xa63e('0x2f')](db[_0xa63e('0x44')][_0xa63e('0x45')]);_0x5dc0c5['query']=_[_0xa63e('0x2f')](_0x3af5da[_0xa63e('0x35')]);_0x5dc0c5['filters']=_[_0xa63e('0x31')](_0x5dc0c5['model'],_0x5dc0c5[_0xa63e('0x35')]);_0x29fcbc['attributes']=_[_0xa63e('0x31')](_0x5dc0c5['model'],qs['fields'](_0x3af5da[_0xa63e('0x35')][_0xa63e('0x34')]));_0x29fcbc['attributes']=_0x29fcbc[_0xa63e('0x32')][_0xa63e('0x36')]?_0x29fcbc[_0xa63e('0x32')]:_0x5dc0c5[_0xa63e('0x33')];if(_0x3af5da[_0xa63e('0x35')]['includeAll']){_0x29fcbc[_0xa63e('0x3f')]=[{'all':!![]}];}_0x29fcbc=_['merge']({},_0x29fcbc,_0x3af5da[_0xa63e('0x3e')]);return db['MailTransferReport'][_0xa63e('0x46')](_0x29fcbc)['then'](handleEntityNotFound(_0x29e05e,null))[_0xa63e('0x23')](respondWithResult(_0x29e05e,null))[_0xa63e('0x42')](handleError(_0x29e05e,null));};exports[_0xa63e('0x47')]=function(_0x19c6eb,_0xa57b11){return db[_0xa63e('0x44')][_0xa63e('0x47')](_0x19c6eb[_0xa63e('0x48')],{})[_0xa63e('0x23')](respondWithResult(_0xa57b11,0xc9))[_0xa63e('0x42')](handleError(_0xa57b11,null));};exports[_0xa63e('0x22')]=function(_0x285b00,_0x22bcd7){if(_0x285b00['body']['id']){delete _0x285b00[_0xa63e('0x48')]['id'];}return db[_0xa63e('0x44')][_0xa63e('0x46')]({'where':{'id':_0x285b00['params']['id']}})['then'](handleEntityNotFound(_0x22bcd7,null))['then'](saveUpdates(_0x285b00[_0xa63e('0x48')],null))[_0xa63e('0x23')](respondWithResult(_0x22bcd7,null))[_0xa63e('0x42')](handleError(_0x22bcd7,null));};exports[_0xa63e('0x24')]=function(_0x487208,_0x38af13){return db['MailTransferReport'][_0xa63e('0x46')]({'where':{'id':_0x487208[_0xa63e('0x43')]['id']}})[_0xa63e('0x23')](handleEntityNotFound(_0x38af13,null))[_0xa63e('0x23')](removeEntity(_0x38af13,null))['catch'](handleError(_0x38af13,null));};exports[_0xa63e('0x49')]=function(_0x425707,_0x31b46b){return db['MailTransferReport'][_0xa63e('0x49')]()[_0xa63e('0x23')](respondWithResult(_0x31b46b,null))[_0xa63e('0x42')](handleError(_0x31b46b,null));};
\ No newline at end of file
index 60552a2..957e85d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbcbe=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','MailTransferReport','report_mail_transfer'];(function(_0x55879b,_0x14821a){var _0x90e09c=function(_0x190681){while(--_0x190681){_0x55879b['push'](_0x55879b['shift']());}};_0x90e09c(++_0x14821a);}(_0xbcbe,0x1bd));var _0xebcb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbcbe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xebcb('0x0'));var util=require(_0xebcb('0x1'));var logger=require(_0xebcb('0x2'))(_0xebcb('0x3'));var moment=require(_0xebcb('0x4'));var BPromise=require(_0xebcb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xebcb('0x6'));var config=require(_0xebcb('0x7'));var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x11948f,_0x12d0d1){return _0x11948f[_0xebcb('0x8')](_0xebcb('0x9'),attributes,{'tableName':_0xebcb('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xebcb('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x5395=['lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5395,0x150));var _0x5539=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x5395[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x5539('0x0'));var util=require('util');var logger=require(_0x5539('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5539('0x2'));var rp=require(_0x5539('0x3'));var fs=require('fs');var path=require(_0x5539('0x4'));var rimraf=require('rimraf');var config=require(_0x5539('0x5'));var attributes=require(_0x5539('0x6'));module[_0x5539('0x7')]=function(_0x751919,_0x99948d){return _0x751919[_0x5539('0x8')](_0x5539('0x9'),attributes,{'tableName':_0x5539('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5539('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 0dbe87b..eba4b90 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4228=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4228,0x1c9));var _0x8422=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4228[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8422('0x0'));var util=require(_0x8422('0x1'));var moment=require(_0x8422('0x2'));var BPromise=require('bluebird');var rs=require(_0x8422('0x3'));var fs=require('fs');var Redis=require(_0x8422('0x4'));var db=require(_0x8422('0x5'))['db'];var utils=require(_0x8422('0x6'));var logger=require(_0x8422('0x7'))(_0x8422('0x8'));var config=require(_0x8422('0x9'));var jayson=require(_0x8422('0xa'));var client=jayson[_0x8422('0xb')][_0x8422('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59aafb,_0x1d8849,_0x4e587c){return new BPromise(function(_0x4feb13,_0x566502){return client[_0x8422('0xd')](_0x59aafb,_0x4e587c)[_0x8422('0xe')](function(_0x538d48){logger[_0x8422('0xf')](_0x8422('0x10'),_0x1d8849,_0x8422('0x11'));logger['debug'](_0x8422('0x12'),_0x1d8849,_0x8422('0x11'),JSON['stringify'](_0x538d48));if(_0x538d48[_0x8422('0x13')]){if(_0x538d48[_0x8422('0x13')][_0x8422('0x14')]===0x1f4){logger[_0x8422('0x13')](_0x8422('0x10'),_0x1d8849,_0x538d48[_0x8422('0x13')]['message']);return _0x566502(_0x538d48['error'][_0x8422('0x15')]);}logger[_0x8422('0x13')](_0x8422('0x10'),_0x1d8849,_0x538d48[_0x8422('0x13')][_0x8422('0x15')]);return _0x4feb13(_0x538d48[_0x8422('0x13')][_0x8422('0x15')]);}else{logger[_0x8422('0xf')](_0x8422('0x10'),_0x1d8849,_0x8422('0x11'));_0x4feb13(_0x538d48['result'][_0x8422('0x15')]);}})[_0x8422('0x16')](function(_0xf5fe60){logger['error'](_0x8422('0x10'),_0x1d8849,_0xf5fe60);_0x566502(_0xf5fe60);});});}
\ No newline at end of file
+var _0x0a45=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then'];(function(_0x26d204,_0x2b7a35){var _0x59ffa8=function(_0x323e3a){while(--_0x323e3a){_0x26d204['push'](_0x26d204['shift']());}};_0x59ffa8(++_0x2b7a35);}(_0x0a45,0xb5));var _0x50a4=function(_0x4ab59c,_0x30046e){_0x4ab59c=_0x4ab59c-0x0;var _0x263f08=_0x0a45[_0x4ab59c];return _0x263f08;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x50a4('0x0'));var fs=require('fs');var Redis=require(_0x50a4('0x1'));var db=require(_0x50a4('0x2'))['db'];var utils=require(_0x50a4('0x3'));var logger=require('../../config/logger')(_0x50a4('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x50a4('0x5')][_0x50a4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x12a99d,_0x390bce,_0x145f1a){return new BPromise(function(_0x116dc4,_0x31b61e){return client[_0x50a4('0x7')](_0x12a99d,_0x145f1a)[_0x50a4('0x8')](function(_0x59ee0a){logger[_0x50a4('0x9')](_0x50a4('0xa'),_0x390bce,_0x50a4('0xb'));logger[_0x50a4('0xc')](_0x50a4('0xd'),_0x390bce,_0x50a4('0xb'),JSON[_0x50a4('0xe')](_0x59ee0a));if(_0x59ee0a[_0x50a4('0xf')]){if(_0x59ee0a[_0x50a4('0xf')]['code']===0x1f4){logger[_0x50a4('0xf')](_0x50a4('0xa'),_0x390bce,_0x59ee0a[_0x50a4('0xf')][_0x50a4('0x10')]);return _0x31b61e(_0x59ee0a['error'][_0x50a4('0x10')]);}logger[_0x50a4('0xf')](_0x50a4('0xa'),_0x390bce,_0x59ee0a['error'][_0x50a4('0x10')]);return _0x116dc4(_0x59ee0a[_0x50a4('0xf')][_0x50a4('0x10')]);}else{logger[_0x50a4('0x9')](_0x50a4('0xa'),_0x390bce,_0x50a4('0xb'));_0x116dc4(_0x59ee0a[_0x50a4('0x11')][_0x50a4('0x10')]);}})[_0x50a4('0x12')](function(_0x2046a9){logger['error'](_0x50a4('0xa'),_0x390bce,_0x2046a9);_0x31b61e(_0x2046a9);});});}
\ No newline at end of file
index d08a3c3..9561566 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb732=['Router','fs-extra','./memberReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express'];(function(_0x5c8628,_0x2fc5f5){var _0xcbd50e=function(_0x4e8bf1){while(--_0x4e8bf1){_0x5c8628['push'](_0x5c8628['shift']());}};_0xcbd50e(++_0x2fc5f5);}(_0xb732,0x1dc));var _0x2b73=function(_0x53736a,_0x264306){_0x53736a=_0x53736a-0x0;var _0x3a6756=_0xb732[_0x53736a];return _0x3a6756;};'use strict';var multer=require(_0x2b73('0x0'));var util=require(_0x2b73('0x1'));var path=require(_0x2b73('0x2'));var timeout=require('connect-timeout');var express=require(_0x2b73('0x3'));var router=express[_0x2b73('0x4')]();var fs_extra=require(_0x2b73('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2b73('0x6'));router[_0x2b73('0x7')]('/',auth['isAuthenticated'](),controller[_0x2b73('0x8')]);router[_0x2b73('0x7')](_0x2b73('0x9'),auth[_0x2b73('0xa')](),controller[_0x2b73('0xb')]);router['get'](_0x2b73('0xc'),auth[_0x2b73('0xa')](),controller[_0x2b73('0xd')]);router[_0x2b73('0xe')]('/',auth[_0x2b73('0xa')](),controller[_0x2b73('0xf')]);router['put'](_0x2b73('0xc'),auth[_0x2b73('0xa')](),controller[_0x2b73('0x10')]);router[_0x2b73('0x11')](_0x2b73('0xc'),auth[_0x2b73('0xa')](),controller[_0x2b73('0x12')]);module[_0x2b73('0x13')]=router;
\ No newline at end of file
+var _0xf496=['show','post','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x2f62aa,_0x108e95){var _0x1a341f=function(_0x3aedcf){while(--_0x3aedcf){_0x2f62aa['push'](_0x2f62aa['shift']());}};_0x1a341f(++_0x108e95);}(_0xf496,0xe9));var _0x6f49=function(_0x513fa1,_0xd57322){_0x513fa1=_0x513fa1-0x0;var _0x58174d=_0xf496[_0x513fa1];return _0x58174d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x6f49('0x0'));var timeout=require(_0x6f49('0x1'));var express=require(_0x6f49('0x2'));var router=express[_0x6f49('0x3')]();var fs_extra=require(_0x6f49('0x4'));var auth=require(_0x6f49('0x5'));var interaction=require(_0x6f49('0x6'));var config=require(_0x6f49('0x7'));var controller=require(_0x6f49('0x8'));router[_0x6f49('0x9')]('/',auth[_0x6f49('0xa')](),controller['index']);router[_0x6f49('0x9')](_0x6f49('0xb'),auth[_0x6f49('0xa')](),controller[_0x6f49('0xc')]);router[_0x6f49('0x9')](_0x6f49('0xd'),auth[_0x6f49('0xa')](),controller[_0x6f49('0xe')]);router[_0x6f49('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6f49('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x6f49('0x10')](_0x6f49('0xd'),auth[_0x6f49('0xa')](),controller[_0x6f49('0x11')]);module[_0x6f49('0x12')]=router;
\ No newline at end of file
index b898ece..f7ee5d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd46e=['getDataValue','enterAt','setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','talk:[queue]','sequelize','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE'];(function(_0x572d83,_0x47a472){var _0x259656=function(_0x4ea209){while(--_0x4ea209){_0x572d83['push'](_0x572d83['shift']());}};_0x259656(++_0x47a472);}(_0xd46e,0x19f));var _0xed46=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0xd46e[_0x15c421];return _0x5e5ed5;};'use strict';var Sequelize=require(_0xed46('0x0'));var moment=require('moment');module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xed46('0x1')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xed46('0x2')},'duration':{'type':Sequelize[_0xed46('0x3')]},'enterAt':{'type':Sequelize[_0xed46('0x4')]},'exitAt':{'type':Sequelize[_0xed46('0x4')],'set':function(_0x539b36){var _0x4dcf74=moment(_0x539b36);var _0x4ffeef=moment(this[_0xed46('0x5')](_0xed46('0x6')));var _0x202b2b=_0x4dcf74['diff'](_0x4ffeef,'seconds');this[_0xed46('0x7')](_0xed46('0x8'),_0x539b36);this[_0xed46('0x7')](_0xed46('0x9'),_0x202b2b>=0x0?_0x202b2b:null);}},'data1':{'type':Sequelize[_0xed46('0x1')],'comment':_0xed46('0xa')},'data2':{'type':Sequelize[_0xed46('0x1')],'comment':_0xed46('0xb')},'data3':{'type':Sequelize['STRING'],'comment':'talk:[destination]'},'data4':{'type':Sequelize['STRING'],'comment':_0xed46('0xc')},'data5':{'type':Sequelize[_0xed46('0x1')],'comment':_0xed46('0xd')},'role':{'type':Sequelize[_0xed46('0x1')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xe7e8=['setDataValue','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0xe7e8,0x1a9));var _0x8e7e=function(_0x27ddf5,_0x5a3e18){_0x27ddf5=_0x27ddf5-0x0;var _0x26e74a=_0xe7e8[_0x27ddf5];return _0x26e74a;};'use strict';var Sequelize=require(_0x8e7e('0x0'));var moment=require(_0x8e7e('0x1'));module[_0x8e7e('0x2')]={'channel':{'type':Sequelize[_0x8e7e('0x3')]},'membername':{'type':Sequelize[_0x8e7e('0x3')]},'interface':{'type':Sequelize[_0x8e7e('0x3')]},'type':{'type':Sequelize[_0x8e7e('0x3')],'defaultValue':_0x8e7e('0x4'),'comment':_0x8e7e('0x5')},'duration':{'type':Sequelize[_0x8e7e('0x6')]},'enterAt':{'type':Sequelize[_0x8e7e('0x7')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x8ebba8){var _0x2f5668=moment(_0x8ebba8);var _0xa17322=moment(this[_0x8e7e('0x8')](_0x8e7e('0x9')));var _0x1b89f4=_0x2f5668[_0x8e7e('0xa')](_0xa17322,_0x8e7e('0xb'));this[_0x8e7e('0xc')](_0x8e7e('0xd'),_0x8ebba8);this[_0x8e7e('0xc')](_0x8e7e('0xe'),_0x1b89f4>=0x0?_0x1b89f4:null);}},'data1':{'type':Sequelize['STRING'],'comment':_0x8e7e('0xf')},'data2':{'type':Sequelize[_0x8e7e('0x3')],'comment':_0x8e7e('0x10')},'data3':{'type':Sequelize['STRING'],'comment':_0x8e7e('0x11')},'data4':{'type':Sequelize[_0x8e7e('0x3')],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x8e7e('0x3')],'comment':_0x8e7e('0x12')},'role':{'type':Sequelize[_0x8e7e('0x3')]},'internal':{'type':Sequelize[_0x8e7e('0x6')]},'uniqueid':{'type':Sequelize[_0x8e7e('0x3')]}};
\ No newline at end of file
index 1bc9ea2..e95f136 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x55ca,0x126));var _0xa55c=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x55ca[_0x2ab365];return _0x49fef3;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));};
\ No newline at end of file
+var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x198249,_0x5e12bc){var _0x354928=function(_0x15429c){while(--_0x15429c){_0x198249['push'](_0x198249['shift']());}};_0x354928(++_0x5e12bc);}(_0x9c44,0x178));var _0x49c4=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x9c44[_0x565c49];return _0x20ca34;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));};
\ No newline at end of file
index f7fe108..ba10263 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb98d=['interface','util','moment','bluebird','request-promise','path','../../config/environment','exports','define','MemberReport','report_member','membername'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xb98d,0x1c9));var _0xdb98=function(_0x2b6a06,_0x43df66){_0x2b6a06=_0x2b6a06-0x0;var _0xcdac20=_0xb98d[_0x2b6a06];return _0xcdac20;};'use strict';var _=require('lodash');var util=require(_0xdb98('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdb98('0x1'));var BPromise=require(_0xdb98('0x2'));var rp=require(_0xdb98('0x3'));var fs=require('fs');var path=require(_0xdb98('0x4'));var rimraf=require('rimraf');var config=require(_0xdb98('0x5'));var attributes=require('./memberReport.attributes');module[_0xdb98('0x6')]=function(_0x224ed3,_0x337c3e){return _0x224ed3[_0xdb98('0x7')](_0xdb98('0x8'),attributes,{'tableName':_0xdb98('0x9'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xdb98('0xa'),_0xdb98('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xe0bf=['api','moment','bluebird','path','../../config/environment','exports','define','MemberReport','report_member','membername_interface','membername','util'];(function(_0x37842d,_0x197e1){var _0x2a3354=function(_0x7787a){while(--_0x7787a){_0x37842d['push'](_0x37842d['shift']());}};_0x2a3354(++_0x197e1);}(_0xe0bf,0xa7));var _0xfe0b=function(_0xd9e9de,_0x1feb25){_0xd9e9de=_0xd9e9de-0x0;var _0x51646c=_0xe0bf[_0xd9e9de];return _0x51646c;};'use strict';var _=require('lodash');var util=require(_0xfe0b('0x0'));var logger=require('../../config/logger')(_0xfe0b('0x1'));var moment=require(_0xfe0b('0x2'));var BPromise=require(_0xfe0b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfe0b('0x4'));var rimraf=require('rimraf');var config=require(_0xfe0b('0x5'));var attributes=require('./memberReport.attributes');module[_0xfe0b('0x6')]=function(_0x180407,_0x1d75ee){return _0x180407[_0xfe0b('0x7')](_0xfe0b('0x8'),attributes,{'tableName':_0xfe0b('0x9'),'paranoid':![],'indexes':[{'name':_0xfe0b('0xa'),'fields':[_0xfe0b('0xb'),'interface']}],'timestamps':!![]});};
\ No newline at end of file
index 50c6e98..fd5d871 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f7b=['result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit','include','model','map','then','CreateMemberReport','create','UpdateMemberReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6f7b,0x168));var _0xb6f7=function(_0x17d2c5,_0x37c5a0){_0x17d2c5=_0x17d2c5-0x0;var _0xcc13d9=_0x6f7b[_0x17d2c5];return _0xcc13d9;};'use strict';var _=require('lodash');var util=require(_0xb6f7('0x0'));var moment=require(_0xb6f7('0x1'));var BPromise=require(_0xb6f7('0x2'));var rs=require(_0xb6f7('0x3'));var fs=require('fs');var Redis=require(_0xb6f7('0x4'));var db=require(_0xb6f7('0x5'))['db'];var utils=require(_0xb6f7('0x6'));var logger=require('../../config/logger')(_0xb6f7('0x7'));var config=require('../../config/environment');var jayson=require(_0xb6f7('0x8'));var client=jayson[_0xb6f7('0x9')][_0xb6f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11eefa,_0x53868c,_0x26b4cb){return new BPromise(function(_0x10cbc1,_0x167f2d){return client['request'](_0x11eefa,_0x26b4cb)['then'](function(_0x5d1c1e){logger[_0xb6f7('0xb')](_0xb6f7('0xc'),_0x53868c,_0xb6f7('0xd'));logger[_0xb6f7('0xe')](_0xb6f7('0xf'),_0x53868c,_0xb6f7('0xd'),JSON[_0xb6f7('0x10')](_0x5d1c1e));if(_0x5d1c1e[_0xb6f7('0x11')]){if(_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x12')]===0x1f4){logger[_0xb6f7('0x11')](_0xb6f7('0xc'),_0x53868c,_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x13')]);return _0x167f2d(_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x13')]);}logger[_0xb6f7('0x11')](_0xb6f7('0xc'),_0x53868c,_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x13')]);return _0x10cbc1(_0x5d1c1e[_0xb6f7('0x11')][_0xb6f7('0x13')]);}else{logger[_0xb6f7('0xb')](_0xb6f7('0xc'),_0x53868c,'request\x20sent');_0x10cbc1(_0x5d1c1e[_0xb6f7('0x14')][_0xb6f7('0x13')]);}})[_0xb6f7('0x15')](function(_0x2bb47a){logger['error'](_0xb6f7('0xc'),_0x53868c,_0x2bb47a);_0x167f2d(_0x2bb47a);});});}exports[_0xb6f7('0x16')]=function(_0x148b87){var _0x58b345=this;return new Promise(function(_0x220951,_0x15b7ab){return db[_0xb6f7('0x17')][_0xb6f7('0x18')]({'raw':_0x148b87[_0xb6f7('0x19')]?_0x148b87[_0xb6f7('0x19')][_0xb6f7('0x1a')]===undefined?!![]:![]:!![],'where':_0x148b87[_0xb6f7('0x19')]?_0x148b87['options'][_0xb6f7('0x1b')]||null:null,'attributes':_0x148b87['options']?_0x148b87[_0xb6f7('0x19')][_0xb6f7('0x1c')]||null:null,'limit':_0x148b87['options']?_0x148b87[_0xb6f7('0x19')][_0xb6f7('0x1d')]||null:null,'include':_0x148b87[_0xb6f7('0x19')]?_0x148b87[_0xb6f7('0x19')][_0xb6f7('0x1e')]?_['map'](_0x148b87[_0xb6f7('0x19')][_0xb6f7('0x1e')],function(_0xc9d994){return{'model':db[_0xc9d994[_0xb6f7('0x1f')]],'as':_0xc9d994['as'],'attributes':_0xc9d994[_0xb6f7('0x1c')],'include':_0xc9d994[_0xb6f7('0x1e')]?_[_0xb6f7('0x20')](_0xc9d994['include'],function(_0x2968a7){return{'model':db[_0x2968a7[_0xb6f7('0x1f')]],'as':_0x2968a7['as'],'attributes':_0x2968a7[_0xb6f7('0x1c')],'include':_0x2968a7['include']?_[_0xb6f7('0x20')](_0x2968a7[_0xb6f7('0x1e')],function(_0x48eded){return{'model':db[_0x48eded[_0xb6f7('0x1f')]],'as':_0x48eded['as'],'attributes':_0x48eded[_0xb6f7('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb6f7('0x21')](function(_0x269587){logger[_0xb6f7('0xb')](_0xb6f7('0x16'),_0x148b87);logger[_0xb6f7('0xe')]('GetMemberReport',_0x148b87,JSON['stringify'](_0x269587));_0x220951(_0x269587);})[_0xb6f7('0x15')](function(_0x539587){logger['error'](_0xb6f7('0x16'),_0x539587[_0xb6f7('0x13')],_0x148b87);_0x15b7ab(_0x58b345[_0xb6f7('0x11')](0x1f4,_0x539587['message']));});});};exports[_0xb6f7('0x22')]=function(_0x55aa98){var _0x2f4bb4=this;return new Promise(function(_0x17c513,_0x2901fd){return db['MemberReport'][_0xb6f7('0x23')](_0x55aa98['body'],{'raw':_0x55aa98[_0xb6f7('0x19')]?_0x55aa98[_0xb6f7('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xb6f7('0x21')](function(_0xc407af){logger[_0xb6f7('0xb')]('CreateMemberReport',_0x55aa98);logger[_0xb6f7('0xe')]('CreateMemberReport',_0x55aa98,JSON[_0xb6f7('0x10')](_0xc407af));_0x17c513(_0xc407af);})[_0xb6f7('0x15')](function(_0x3f6a2d){logger[_0xb6f7('0x11')](_0xb6f7('0x22'),_0x3f6a2d[_0xb6f7('0x13')],_0x55aa98);_0x2901fd(_0x2f4bb4[_0xb6f7('0x11')](0x1f4,_0x3f6a2d[_0xb6f7('0x13')]));});});};exports[_0xb6f7('0x24')]=function(_0x462678){var _0x573b89=this;return new Promise(function(_0x3084c1,_0x3c7787){return db[_0xb6f7('0x17')][_0xb6f7('0x25')](_0x462678['body'],{'raw':_0x462678[_0xb6f7('0x19')]?_0x462678[_0xb6f7('0x19')][_0xb6f7('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x462678['options']?_0x462678[_0xb6f7('0x19')][_0xb6f7('0x1b')]||null:null,'attributes':_0x462678[_0xb6f7('0x19')]?_0x462678[_0xb6f7('0x19')][_0xb6f7('0x1c')]||null:null,'limit':_0x462678[_0xb6f7('0x19')]?_0x462678[_0xb6f7('0x19')][_0xb6f7('0x1d')]||null:null})[_0xb6f7('0x21')](function(_0x551376){logger[_0xb6f7('0xb')](_0xb6f7('0x24'),_0x462678);logger[_0xb6f7('0xe')](_0xb6f7('0x24'),_0x462678,JSON[_0xb6f7('0x10')](_0x551376));_0x3084c1(_0x551376);})[_0xb6f7('0x15')](function(_0x4031bc){logger[_0xb6f7('0x11')](_0xb6f7('0x24'),_0x4031bc[_0xb6f7('0x13')],_0x462678);_0x3c7787(_0x573b89[_0xb6f7('0x11')](0x1f4,_0x4031bc['message']));});});};
\ No newline at end of file
+var _0x6bfc=['body','raw','CreateMemberReport','catch','UpdateMemberReport','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','GetMemberReport','findAll','options','attributes','limit','map','include','model','MemberReport','create'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x6bfc,0x159));var _0xc6bf=function(_0x1da0c1,_0x14ff83){_0x1da0c1=_0x1da0c1-0x0;var _0x31302b=_0x6bfc[_0x1da0c1];return _0x31302b;};'use strict';var _=require('lodash');var util=require(_0xc6bf('0x0'));var moment=require(_0xc6bf('0x1'));var BPromise=require(_0xc6bf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc6bf('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc6bf('0x4'));var logger=require('../../config/logger')(_0xc6bf('0x5'));var config=require(_0xc6bf('0x6'));var jayson=require(_0xc6bf('0x7'));var client=jayson['client'][_0xc6bf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c9049,_0x47039a,_0x28d218){return new BPromise(function(_0x250311,_0x3b2815){return client[_0xc6bf('0x9')](_0x2c9049,_0x28d218)[_0xc6bf('0xa')](function(_0x52dac0){logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));logger[_0xc6bf('0xe')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x47039a,'request\x20sent',JSON[_0xc6bf('0xf')](_0x52dac0));if(_0x52dac0[_0xc6bf('0x10')]){if(_0x52dac0['error']['code']===0x1f4){logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error'][_0xc6bf('0x11')]);return _0x3b2815(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}logger[_0xc6bf('0x10')](_0xc6bf('0xc'),_0x47039a,_0x52dac0['error']['message']);return _0x250311(_0x52dac0[_0xc6bf('0x10')][_0xc6bf('0x11')]);}else{logger[_0xc6bf('0xb')](_0xc6bf('0xc'),_0x47039a,_0xc6bf('0xd'));_0x250311(_0x52dac0[_0xc6bf('0x12')][_0xc6bf('0x11')]);}})['catch'](function(_0x23498a){logger['error']('MemberReport,\x20%s,\x20%s',_0x47039a,_0x23498a);_0x3b2815(_0x23498a);});});}exports[_0xc6bf('0x13')]=function(_0x23a9e9){var _0x5bdc69=this;return new Promise(function(_0x370150,_0x1079db){return db['MemberReport'][_0xc6bf('0x14')]({'raw':_0x23a9e9['options']?_0x23a9e9['options']['raw']===undefined?!![]:![]:!![],'where':_0x23a9e9[_0xc6bf('0x15')]?_0x23a9e9[_0xc6bf('0x15')]['where']||null:null,'attributes':_0x23a9e9['options']?_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x16')]||null:null,'limit':_0x23a9e9['options']?_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x17')]||null:null,'include':_0x23a9e9[_0xc6bf('0x15')]?_0x23a9e9[_0xc6bf('0x15')]['include']?_[_0xc6bf('0x18')](_0x23a9e9[_0xc6bf('0x15')][_0xc6bf('0x19')],function(_0x1a0a50){return{'model':db[_0x1a0a50[_0xc6bf('0x1a')]],'as':_0x1a0a50['as'],'attributes':_0x1a0a50[_0xc6bf('0x16')],'include':_0x1a0a50[_0xc6bf('0x19')]?_[_0xc6bf('0x18')](_0x1a0a50['include'],function(_0x312138){return{'model':db[_0x312138[_0xc6bf('0x1a')]],'as':_0x312138['as'],'attributes':_0x312138[_0xc6bf('0x16')],'include':_0x312138['include']?_[_0xc6bf('0x18')](_0x312138[_0xc6bf('0x19')],function(_0x412e61){return{'model':db[_0x412e61[_0xc6bf('0x1a')]],'as':_0x412e61['as'],'attributes':_0x412e61[_0xc6bf('0x16')]};}):[]};}):[]};}):[]:[]})[_0xc6bf('0xa')](function(_0x5abf52){logger['info'](_0xc6bf('0x13'),_0x23a9e9);logger['debug'](_0xc6bf('0x13'),_0x23a9e9,JSON['stringify'](_0x5abf52));_0x370150(_0x5abf52);})['catch'](function(_0x2806e6){logger[_0xc6bf('0x10')](_0xc6bf('0x13'),_0x2806e6[_0xc6bf('0x11')],_0x23a9e9);_0x1079db(_0x5bdc69['error'](0x1f4,_0x2806e6['message']));});});};exports['CreateMemberReport']=function(_0x4f0234){var _0x32407b=this;return new Promise(function(_0xf49ed7,_0x1d46bd){return db[_0xc6bf('0x1b')][_0xc6bf('0x1c')](_0x4f0234[_0xc6bf('0x1d')],{'raw':_0x4f0234[_0xc6bf('0x15')]?_0x4f0234[_0xc6bf('0x15')][_0xc6bf('0x1e')]===undefined?!![]:![]:!![]})[_0xc6bf('0xa')](function(_0x2ec79e){logger[_0xc6bf('0xb')](_0xc6bf('0x1f'),_0x4f0234);logger[_0xc6bf('0xe')](_0xc6bf('0x1f'),_0x4f0234,JSON['stringify'](_0x2ec79e));_0xf49ed7(_0x2ec79e);})[_0xc6bf('0x20')](function(_0x1245d7){logger[_0xc6bf('0x10')](_0xc6bf('0x1f'),_0x1245d7['message'],_0x4f0234);_0x1d46bd(_0x32407b['error'](0x1f4,_0x1245d7[_0xc6bf('0x11')]));});});};exports[_0xc6bf('0x21')]=function(_0x11de46){var _0x3e3d15=this;return new Promise(function(_0x2e8363,_0x5ec7ce){return db[_0xc6bf('0x1b')]['update'](_0x11de46['body'],{'raw':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')][_0xc6bf('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')]['where']||null:null,'attributes':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')]['attributes']||null:null,'limit':_0x11de46[_0xc6bf('0x15')]?_0x11de46[_0xc6bf('0x15')][_0xc6bf('0x17')]||null:null})['then'](function(_0x5d1dbd){logger['info'](_0xc6bf('0x21'),_0x11de46);logger[_0xc6bf('0xe')](_0xc6bf('0x21'),_0x11de46,JSON['stringify'](_0x5d1dbd));_0x2e8363(_0x5d1dbd);})[_0xc6bf('0x20')](function(_0x559eb3){logger['error'](_0xc6bf('0x21'),_0x559eb3[_0xc6bf('0x11')],_0x11de46);_0x5ec7ce(_0x3e3d15[_0xc6bf('0x10')](0x1f4,_0x559eb3['message']));});});};
\ No newline at end of file
index 30b7f4e..c85d6ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x131c=['../../components/interaction/service','get','exports','util','../../components/auth/service'];(function(_0x7d2e4d,_0x559479){var _0x31d2cd=function(_0x1cf672){while(--_0x1cf672){_0x7d2e4d['push'](_0x7d2e4d['shift']());}};_0x31d2cd(++_0x559479);}(_0x131c,0x1e8));var _0xc131=function(_0x29239b,_0x114fdf){_0x29239b=_0x29239b-0x0;var _0x4f1c69=_0x131c[_0x29239b];return _0x4f1c69;};'use strict';var multer=require('multer');var util=require(_0xc131('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc131('0x1'));var interaction=require(_0xc131('0x2'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0xc131('0x3')]('/',controller['index']);module[_0xc131('0x4')]=router;
\ No newline at end of file
+var _0x872a=['get','index','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x24096e,_0x56e8ec){var _0x391afb=function(_0x15dfd5){while(--_0x15dfd5){_0x24096e['push'](_0x24096e['shift']());}};_0x391afb(++_0x56e8ec);}(_0x872a,0x100));var _0xa872=function(_0x450c7e,_0x59840f){_0x450c7e=_0x450c7e-0x0;var _0x1842cc=_0x872a[_0x450c7e];return _0x1842cc;};'use strict';var multer=require(_0xa872('0x0'));var util=require(_0xa872('0x1'));var path=require(_0xa872('0x2'));var timeout=require(_0xa872('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa872('0x4'));var interaction=require(_0xa872('0x5'));var config=require(_0xa872('0x6'));var controller=require(_0xa872('0x7'));router[_0xa872('0x8')]('/',controller[_0xa872('0x9')]);module[_0xa872('0xa')]=router;
\ No newline at end of file
index 466c8ff..a8f4df8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x002e=['STRING','version','sequelize','exports'];(function(_0x307a1a,_0x499c57){var _0x4fc88c=function(_0x332029){while(--_0x332029){_0x307a1a['push'](_0x307a1a['shift']());}};_0x4fc88c(++_0x499c57);}(_0x002e,0x142));var _0xe002=function(_0x151381,_0x97b314){_0x151381=_0x151381-0x0;var _0x2afab6=_0x002e[_0x151381];return _0x2afab6;};'use strict';var Sequelize=require(_0xe002('0x0'));module[_0xe002('0x1')]={'version':{'type':Sequelize[_0xe002('0x2')],'unique':_0xe002('0x3')}};
\ No newline at end of file
+var _0x580a=['STRING'];(function(_0x54c877,_0x17ba52){var _0x281de3=function(_0x57dca1){while(--_0x57dca1){_0x54c877['push'](_0x54c877['shift']());}};_0x281de3(++_0x17ba52);}(_0x580a,0x1b7));var _0xa580=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x580a[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module['exports']={'version':{'type':Sequelize[_0xa580('0x0')],'unique':'version'}};
\ No newline at end of file
index ee28e2b..717f525 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf017=['filter','merge','VIRTUAL','options','includeAll','rows','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','index','map','Migration','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4cfad5,_0x366063){var _0xb65774=function(_0x4551b7){while(--_0x4551b7){_0x4cfad5['push'](_0x4cfad5['shift']());}};_0xb65774(++_0x366063);}(_0xf017,0x14c));var _0x7f01=function(_0x4ce7aa,_0x1f563e){_0x4ce7aa=_0x4ce7aa-0x0;var _0x276392=_0xf017[_0x4ce7aa];return _0x276392;};'use strict';var emlformat=require(_0x7f01('0x0'));var rimraf=require(_0x7f01('0x1'));var zipdir=require(_0x7f01('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7f01('0x3'));var moment=require(_0x7f01('0x4'));var BPromise=require(_0x7f01('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7f01('0x6'));var sox=require(_0x7f01('0x7'));var csv=require(_0x7f01('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f01('0x9'));var _=require(_0x7f01('0xa'));var squel=require(_0x7f01('0xb'));var crypto=require(_0x7f01('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7f01('0x8'));var querystring=require(_0x7f01('0xd'));var Papa=require(_0x7f01('0xe'));var Redis=require(_0x7f01('0xf'));var authService=require(_0x7f01('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7f01('0x11'));var hardwareService=require(_0x7f01('0x12'));var logger=require(_0x7f01('0x13'))(_0x7f01('0x14'));var utils=require('../../config/utils');var config=require(_0x7f01('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7f01('0x16'))['db'];function respondWithStatusCode(_0x3b3c36,_0xe90a36){_0xe90a36=_0xe90a36||0xcc;return function(_0x33500c){if(_0x33500c){return _0x3b3c36[_0x7f01('0x17')](_0xe90a36);}return _0x3b3c36[_0x7f01('0x18')](_0xe90a36)[_0x7f01('0x19')]();};}function respondWithResult(_0x4988dd,_0xfae399){_0xfae399=_0xfae399||0xc8;return function(_0x5e12b7){if(_0x5e12b7){return _0x4988dd[_0x7f01('0x18')](_0xfae399)[_0x7f01('0x1a')](_0x5e12b7);}};}function respondWithFilteredResult(_0x4c64ad,_0x2bae7c){return function(_0x3a1064){if(_0x3a1064){var _0x54e2ff=typeof _0x2bae7c[_0x7f01('0x1b')]===_0x7f01('0x1c')&&typeof _0x2bae7c[_0x7f01('0x1d')]==='undefined';var _0x5d8171=_0x3a1064['count'];var _0x195aa0=_0x54e2ff?0x0:_0x2bae7c[_0x7f01('0x1b')];var _0x3a9cd7=_0x54e2ff?_0x3a1064[_0x7f01('0x1e')]:_0x2bae7c[_0x7f01('0x1b')]+_0x2bae7c['limit'];var _0x40f7fd;if(_0x3a9cd7>=_0x5d8171){_0x3a9cd7=_0x5d8171;_0x40f7fd=0xc8;}else{_0x40f7fd=0xce;}_0x4c64ad[_0x7f01('0x18')](_0x40f7fd);return _0x4c64ad[_0x7f01('0x1f')](_0x7f01('0x20'),_0x195aa0+'-'+_0x3a9cd7+'/'+_0x5d8171)[_0x7f01('0x1a')](_0x3a1064);}return null;};}function patchUpdates(_0x22ca9c){return function(_0x12c2b6){try{jsonpatch[_0x7f01('0x21')](_0x12c2b6,_0x22ca9c,!![]);}catch(_0x21a086){return BPromise[_0x7f01('0x22')](_0x21a086);}return _0x12c2b6[_0x7f01('0x23')]();};}function saveUpdates(_0x289779,_0x11ce4a){return function(_0x4be54c){if(_0x4be54c){return _0x4be54c['update'](_0x289779)[_0x7f01('0x24')](function(_0x1425a0){return _0x1425a0;});}return null;};}function removeEntity(_0x219dd1,_0x235ff5){return function(_0x36231d){if(_0x36231d){return _0x36231d['destroy']()[_0x7f01('0x24')](function(){_0x219dd1[_0x7f01('0x18')](0xcc)[_0x7f01('0x19')]();});}};}function handleEntityNotFound(_0x5dc5e1,_0x1b80e6){return function(_0xfa2be7){if(!_0xfa2be7){_0x5dc5e1[_0x7f01('0x17')](0x194);}return _0xfa2be7;};}function handleError(_0x3f5b8d,_0x1c54e1){_0x1c54e1=_0x1c54e1||0x1f4;return function(_0xfab714){logger[_0x7f01('0x25')](_0xfab714['stack']);if(_0xfab714['name']){delete _0xfab714[_0x7f01('0x26')];}_0x3f5b8d[_0x7f01('0x18')](_0x1c54e1)['send'](_0xfab714);};}exports[_0x7f01('0x27')]=function(_0x200d48,_0x5cade2){var _0x4775c4={},_0x4a4d59={},_0x5c96a7={'count':0x0,'rows':[]};var _0x36753c=_[_0x7f01('0x28')](db[_0x7f01('0x29')][_0x7f01('0x2a')],function(_0x3fd5c3){return{'name':_0x3fd5c3[_0x7f01('0x2b')],'type':_0x3fd5c3[_0x7f01('0x2c')][_0x7f01('0x2d')]};});_0x4a4d59[_0x7f01('0x2e')]=_['map'](_0x36753c,_0x7f01('0x26'));_0x4a4d59[_0x7f01('0x2f')]=_[_0x7f01('0x30')](_0x200d48['query']);_0x4a4d59[_0x7f01('0x31')]=_['intersection'](_0x4a4d59['model'],_0x4a4d59[_0x7f01('0x2f')]);_0x4775c4[_0x7f01('0x32')]=_['intersection'](_0x4a4d59[_0x7f01('0x2e')],qs[_0x7f01('0x33')](_0x200d48[_0x7f01('0x2f')][_0x7f01('0x33')]));_0x4775c4[_0x7f01('0x32')]=_0x4775c4[_0x7f01('0x32')][_0x7f01('0x34')]?_0x4775c4['attributes']:_0x4a4d59[_0x7f01('0x2e')];if(!_0x200d48[_0x7f01('0x2f')][_0x7f01('0x35')](_0x7f01('0x36'))){_0x4775c4[_0x7f01('0x1d')]=qs[_0x7f01('0x1d')](_0x200d48[_0x7f01('0x2f')][_0x7f01('0x1d')]);_0x4775c4[_0x7f01('0x1b')]=qs['offset'](_0x200d48[_0x7f01('0x2f')]['offset']);}_0x4775c4[_0x7f01('0x37')]=qs[_0x7f01('0x38')](_0x200d48[_0x7f01('0x2f')][_0x7f01('0x38')]);_0x4775c4[_0x7f01('0x39')]=qs[_0x7f01('0x31')](_['pick'](_0x200d48['query'],_0x4a4d59[_0x7f01('0x31')]),_0x36753c);if(_0x200d48['query'][_0x7f01('0x3a')]){_0x4775c4[_0x7f01('0x39')]=_[_0x7f01('0x3b')](_0x4775c4[_0x7f01('0x39')],{'$or':_[_0x7f01('0x28')](_0x36753c,function(_0x338a27){if(_0x338a27[_0x7f01('0x2c')]!==_0x7f01('0x3c')){var _0x4d3b82={};_0x4d3b82[_0x338a27['name']]={'$like':'%'+_0x200d48[_0x7f01('0x2f')][_0x7f01('0x3a')]+'%'};return _0x4d3b82;}})});}_0x4775c4=_[_0x7f01('0x3b')]({},_0x4775c4,_0x200d48[_0x7f01('0x3d')]);var _0x4ede71={'where':_0x4775c4[_0x7f01('0x39')]};return db[_0x7f01('0x29')]['count'](_0x4ede71)['then'](function(_0x560cc6){_0x5c96a7[_0x7f01('0x1e')]=_0x560cc6;if(_0x200d48[_0x7f01('0x2f')][_0x7f01('0x3e')]){_0x4775c4['include']=[{'all':!![]}];}return db[_0x7f01('0x29')]['findAll'](_0x4775c4);})['then'](function(_0x27b3a7){_0x5c96a7[_0x7f01('0x3f')]=_0x27b3a7;return _0x5c96a7;})[_0x7f01('0x24')](respondWithFilteredResult(_0x5cade2,_0x4775c4))[_0x7f01('0x40')](handleError(_0x5cade2,null));};
\ No newline at end of file
+var _0x0d83=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','Migration','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xa121d2,_0x53bf78){var _0x4fd840=function(_0x2a0092){while(--_0x2a0092){_0xa121d2['push'](_0xa121d2['shift']());}};_0x4fd840(++_0x53bf78);}(_0x0d83,0xc2));var _0x30d8=function(_0x5a1de0,_0x15030b){_0x5a1de0=_0x5a1de0-0x0;var _0x5a741a=_0x0d83[_0x5a1de0];return _0x5a741a;};'use strict';var emlformat=require(_0x30d8('0x0'));var rimraf=require(_0x30d8('0x1'));var zipdir=require(_0x30d8('0x2'));var jsonpatch=require(_0x30d8('0x3'));var rp=require(_0x30d8('0x4'));var moment=require('moment');var BPromise=require(_0x30d8('0x5'));var Mustache=require(_0x30d8('0x6'));var util=require(_0x30d8('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x30d8('0x8'));var ejs=require(_0x30d8('0x9'));var fs=require('fs');var fs_extra=require(_0x30d8('0xa'));var _=require('lodash');var squel=require(_0x30d8('0xb'));var crypto=require(_0x30d8('0xc'));var jsforce=require(_0x30d8('0xd'));var deskjs=require(_0x30d8('0xe'));var toCsv=require(_0x30d8('0x8'));var querystring=require(_0x30d8('0xf'));var Papa=require(_0x30d8('0x10'));var Redis=require(_0x30d8('0x11'));var authService=require(_0x30d8('0x12'));var qs=require(_0x30d8('0x13'));var as=require(_0x30d8('0x14'));var hardwareService=require(_0x30d8('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x30d8('0x16'));var config=require(_0x30d8('0x17'));var licenseUtil=require(_0x30d8('0x18'));var db=require(_0x30d8('0x19'))['db'];function respondWithStatusCode(_0x4abc0e,_0xc665c){_0xc665c=_0xc665c||0xcc;return function(_0x5612a8){if(_0x5612a8){return _0x4abc0e[_0x30d8('0x1a')](_0xc665c);}return _0x4abc0e[_0x30d8('0x1b')](_0xc665c)[_0x30d8('0x1c')]();};}function respondWithResult(_0x291ce2,_0x393a8c){_0x393a8c=_0x393a8c||0xc8;return function(_0x429628){if(_0x429628){return _0x291ce2[_0x30d8('0x1b')](_0x393a8c)['json'](_0x429628);}};}function respondWithFilteredResult(_0x54627f,_0x56193e){return function(_0x4e6df7){if(_0x4e6df7){var _0x746040=typeof _0x56193e[_0x30d8('0x1d')]==='undefined'&&typeof _0x56193e[_0x30d8('0x1e')]===_0x30d8('0x1f');var _0x43a1cd=_0x4e6df7['count'];var _0x3565cd=_0x746040?0x0:_0x56193e[_0x30d8('0x1d')];var _0x1ed2bf=_0x746040?_0x4e6df7[_0x30d8('0x20')]:_0x56193e[_0x30d8('0x1d')]+_0x56193e['limit'];var _0x43f5f2;if(_0x1ed2bf>=_0x43a1cd){_0x1ed2bf=_0x43a1cd;_0x43f5f2=0xc8;}else{_0x43f5f2=0xce;}_0x54627f[_0x30d8('0x1b')](_0x43f5f2);return _0x54627f[_0x30d8('0x21')](_0x30d8('0x22'),_0x3565cd+'-'+_0x1ed2bf+'/'+_0x43a1cd)[_0x30d8('0x23')](_0x4e6df7);}return null;};}function patchUpdates(_0x483670){return function(_0x283815){try{jsonpatch[_0x30d8('0x24')](_0x283815,_0x483670,!![]);}catch(_0x5a50d3){return BPromise[_0x30d8('0x25')](_0x5a50d3);}return _0x283815[_0x30d8('0x26')]();};}function saveUpdates(_0x51facc,_0x12c52c){return function(_0x300500){if(_0x300500){return _0x300500[_0x30d8('0x27')](_0x51facc)[_0x30d8('0x28')](function(_0x5eb038){return _0x5eb038;});}return null;};}function removeEntity(_0xc8f73f,_0xf113c3){return function(_0x38c324){if(_0x38c324){return _0x38c324['destroy']()[_0x30d8('0x28')](function(){_0xc8f73f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x146382,_0x1edff5){return function(_0x510476){if(!_0x510476){_0x146382[_0x30d8('0x1a')](0x194);}return _0x510476;};}function handleError(_0x208627,_0x1654cb){_0x1654cb=_0x1654cb||0x1f4;return function(_0x5d38a9){logger[_0x30d8('0x29')](_0x5d38a9[_0x30d8('0x2a')]);if(_0x5d38a9[_0x30d8('0x2b')]){delete _0x5d38a9['name'];}_0x208627[_0x30d8('0x1b')](_0x1654cb)[_0x30d8('0x2c')](_0x5d38a9);};}exports[_0x30d8('0x2d')]=function(_0x57048b,_0x101184){var _0x66d46f={},_0x4e0b9f={},_0x16e16f={'count':0x0,'rows':[]};var _0x5c7cfb=_[_0x30d8('0x2e')](db[_0x30d8('0x2f')]['rawAttributes'],function(_0x1c96e){return{'name':_0x1c96e[_0x30d8('0x30')],'type':_0x1c96e['type'][_0x30d8('0x31')]};});_0x4e0b9f[_0x30d8('0x32')]=_[_0x30d8('0x2e')](_0x5c7cfb,_0x30d8('0x2b'));_0x4e0b9f[_0x30d8('0x33')]=_[_0x30d8('0x34')](_0x57048b[_0x30d8('0x33')]);_0x4e0b9f[_0x30d8('0x35')]=_['intersection'](_0x4e0b9f['model'],_0x4e0b9f[_0x30d8('0x33')]);_0x66d46f['attributes']=_[_0x30d8('0x36')](_0x4e0b9f['model'],qs[_0x30d8('0x37')](_0x57048b[_0x30d8('0x33')][_0x30d8('0x37')]));_0x66d46f[_0x30d8('0x38')]=_0x66d46f[_0x30d8('0x38')][_0x30d8('0x39')]?_0x66d46f[_0x30d8('0x38')]:_0x4e0b9f[_0x30d8('0x32')];if(!_0x57048b['query'][_0x30d8('0x3a')](_0x30d8('0x3b'))){_0x66d46f[_0x30d8('0x1e')]=qs['limit'](_0x57048b['query'][_0x30d8('0x1e')]);_0x66d46f[_0x30d8('0x1d')]=qs[_0x30d8('0x1d')](_0x57048b[_0x30d8('0x33')][_0x30d8('0x1d')]);}_0x66d46f[_0x30d8('0x3c')]=qs[_0x30d8('0x3d')](_0x57048b[_0x30d8('0x33')][_0x30d8('0x3d')]);_0x66d46f['where']=qs[_0x30d8('0x35')](_['pick'](_0x57048b[_0x30d8('0x33')],_0x4e0b9f['filters']),_0x5c7cfb);if(_0x57048b['query']['filter']){_0x66d46f[_0x30d8('0x3e')]=_['merge'](_0x66d46f[_0x30d8('0x3e')],{'$or':_[_0x30d8('0x2e')](_0x5c7cfb,function(_0x3073e5){if(_0x3073e5[_0x30d8('0x3f')]!==_0x30d8('0x40')){var _0x49cc90={};_0x49cc90[_0x3073e5[_0x30d8('0x2b')]]={'$like':'%'+_0x57048b[_0x30d8('0x33')][_0x30d8('0x41')]+'%'};return _0x49cc90;}})});}_0x66d46f=_[_0x30d8('0x42')]({},_0x66d46f,_0x57048b[_0x30d8('0x43')]);var _0x1bb21b={'where':_0x66d46f[_0x30d8('0x3e')]};return db[_0x30d8('0x2f')][_0x30d8('0x20')](_0x1bb21b)[_0x30d8('0x28')](function(_0x3d098c){_0x16e16f['count']=_0x3d098c;if(_0x57048b[_0x30d8('0x33')][_0x30d8('0x44')]){_0x66d46f[_0x30d8('0x45')]=[{'all':!![]}];}return db[_0x30d8('0x2f')]['findAll'](_0x66d46f);})[_0x30d8('0x28')](function(_0x48fe0d){_0x16e16f[_0x30d8('0x46')]=_0x48fe0d;return _0x16e16f;})[_0x30d8('0x28')](respondWithFilteredResult(_0x101184,_0x66d46f))['catch'](handleError(_0x101184,null));};
\ No newline at end of file
index b855e39..7276397 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbce2=['exports','define','lodash','util','../../config/logger','bluebird','path','rimraf','./migration.attributes'];(function(_0x3ecc08,_0x4ab9c7){var _0x18926c=function(_0x4a9669){while(--_0x4a9669){_0x3ecc08['push'](_0x3ecc08['shift']());}};_0x18926c(++_0x4ab9c7);}(_0xbce2,0x173));var _0x2bce=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xbce2[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x2bce('0x0'));var util=require(_0x2bce('0x1'));var logger=require(_0x2bce('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2bce('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2bce('0x4'));var rimraf=require(_0x2bce('0x5'));var config=require('../../config/environment');var attributes=require(_0x2bce('0x6'));module[_0x2bce('0x7')]=function(_0x4c753b,_0x3a2791){return _0x4c753b[_0x2bce('0x8')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9cde=['moment','bluebird','path','../../config/environment','migrations','lodash','util','../../config/logger'];(function(_0x47b8af,_0x3867a4){var _0x3a8e63=function(_0x3a90de){while(--_0x3a90de){_0x47b8af['push'](_0x47b8af['shift']());}};_0x3a8e63(++_0x3867a4);}(_0x9cde,0x15d));var _0xe9cd=function(_0x5252a1,_0x32b917){_0x5252a1=_0x5252a1-0x0;var _0x39973f=_0x9cde[_0x5252a1];return _0x39973f;};'use strict';var _=require(_0xe9cd('0x0'));var util=require(_0xe9cd('0x1'));var logger=require(_0xe9cd('0x2'))('api');var moment=require(_0xe9cd('0x3'));var BPromise=require(_0xe9cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9cd('0x5'));var rimraf=require('rimraf');var config=require(_0xe9cd('0x6'));var attributes=require('./migration.attributes');module['exports']=function(_0x18b78b,_0x4b9c39){return _0x18b78b['define']('Migration',attributes,{'tableName':_0xe9cd('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2f04875..4d8b81a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x10b8=['debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x5b9c34,_0x409661){var _0x5f4611=function(_0x22926c){while(--_0x22926c){_0x5b9c34['push'](_0x5b9c34['shift']());}};_0x5f4611(++_0x409661);}(_0x10b8,0x166));var _0x810b=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x10b8[_0xaa1b3e];return _0x454d7d;};'use strict';var _=require(_0x810b('0x0'));var util=require(_0x810b('0x1'));var moment=require(_0x810b('0x2'));var BPromise=require(_0x810b('0x3'));var rs=require(_0x810b('0x4'));var fs=require('fs');var Redis=require(_0x810b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x810b('0x6'));var logger=require(_0x810b('0x7'))(_0x810b('0x8'));var config=require('../../config/environment');var jayson=require(_0x810b('0x9'));var client=jayson[_0x810b('0xa')][_0x810b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33b73f,_0x4688ab,_0x3c5f12){return new BPromise(function(_0x43e6ed,_0x567a99){return client[_0x810b('0xc')](_0x33b73f,_0x3c5f12)['then'](function(_0x2afe3e){logger[_0x810b('0xd')](_0x810b('0xe'),_0x4688ab,_0x810b('0xf'));logger[_0x810b('0x10')]('Migration,\x20%s,\x20%s,\x20%s',_0x4688ab,_0x810b('0xf'),JSON[_0x810b('0x11')](_0x2afe3e));if(_0x2afe3e[_0x810b('0x12')]){if(_0x2afe3e[_0x810b('0x12')]['code']===0x1f4){logger[_0x810b('0x12')](_0x810b('0xe'),_0x4688ab,_0x2afe3e[_0x810b('0x12')][_0x810b('0x13')]);return _0x567a99(_0x2afe3e[_0x810b('0x12')][_0x810b('0x13')]);}logger[_0x810b('0x12')](_0x810b('0xe'),_0x4688ab,_0x2afe3e[_0x810b('0x12')][_0x810b('0x13')]);return _0x43e6ed(_0x2afe3e['error']['message']);}else{logger[_0x810b('0xd')](_0x810b('0xe'),_0x4688ab,_0x810b('0xf'));_0x43e6ed(_0x2afe3e[_0x810b('0x14')][_0x810b('0x13')]);}})[_0x810b('0x15')](function(_0x6370c){logger[_0x810b('0x12')](_0x810b('0xe'),_0x4688ab,_0x6370c);_0x567a99(_0x6370c);});});}
\ No newline at end of file
+var _0xb458=['info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x273b8e,_0x48961e){var _0x33731e=function(_0x1c096b){while(--_0x1c096b){_0x273b8e['push'](_0x273b8e['shift']());}};_0x33731e(++_0x48961e);}(_0xb458,0xca));var _0x8b45=function(_0x47d804,_0x5cc88f){_0x47d804=_0x47d804-0x0;var _0x284c47=_0xb458[_0x47d804];return _0x284c47;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require(_0x8b45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x4'));var db=require(_0x8b45('0x5'))['db'];var utils=require(_0x8b45('0x6'));var logger=require(_0x8b45('0x7'))(_0x8b45('0x8'));var config=require(_0x8b45('0x9'));var jayson=require(_0x8b45('0xa'));var client=jayson[_0x8b45('0xb')][_0x8b45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x114de0,_0x15dcf4,_0x2f0c9e){return new BPromise(function(_0x1386a4,_0x54f299){return client[_0x8b45('0xd')](_0x114de0,_0x2f0c9e)['then'](function(_0x4a1617){logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));logger['debug'](_0x8b45('0x11'),_0x15dcf4,'request\x20sent',JSON[_0x8b45('0x12')](_0x4a1617));if(_0x4a1617[_0x8b45('0x13')]){if(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x14')]===0x1f4){logger[_0x8b45('0x13')]('Migration,\x20%s,\x20%s',_0x15dcf4,_0x4a1617['error'][_0x8b45('0x15')]);return _0x54f299(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}logger[_0x8b45('0x13')](_0x8b45('0xf'),_0x15dcf4,_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);return _0x1386a4(_0x4a1617[_0x8b45('0x13')][_0x8b45('0x15')]);}else{logger[_0x8b45('0xe')](_0x8b45('0xf'),_0x15dcf4,_0x8b45('0x10'));_0x1386a4(_0x4a1617[_0x8b45('0x16')][_0x8b45('0x15')]);}})[_0x8b45('0x17')](function(_0x59547e){logger['error'](_0x8b45('0xf'),_0x15dcf4,_0x59547e);_0x54f299(_0x59547e);});});}
\ No newline at end of file
index 152d6ca..a648191 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x43a2=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','post','create','put','/:id','destroy','exports','util','path'];(function(_0x5a72c4,_0x53e202){var _0x224a81=function(_0x3ff6e1){while(--_0x3ff6e1){_0x5a72c4['push'](_0x5a72c4['shift']());}};_0x224a81(++_0x53e202);}(_0x43a2,0xd0));var _0x243a=function(_0xa84983,_0x244a23){_0xa84983=_0xa84983-0x0;var _0x2f1ce6=_0x43a2[_0xa84983];return _0x2f1ce6;};'use strict';var multer=require('multer');var util=require(_0x243a('0x0'));var path=require(_0x243a('0x1'));var timeout=require(_0x243a('0x2'));var express=require('express');var router=express[_0x243a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x243a('0x4'));var interaction=require(_0x243a('0x5'));var config=require(_0x243a('0x6'));var controller=require(_0x243a('0x7'));router['get']('/',auth[_0x243a('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x243a('0x9')]('/',auth[_0x243a('0x8')](),controller[_0x243a('0xa')]);router[_0x243a('0xb')](_0x243a('0xc'),auth[_0x243a('0x8')](),controller['update']);router['delete'](_0x243a('0xc'),auth[_0x243a('0x8')](),controller[_0x243a('0xd')]);module[_0x243a('0xe')]=router;
\ No newline at end of file
+var _0x5bd7=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./network.controller','get','isAuthenticated','/:id','show','post','create','delete','exports','util','path'];(function(_0x1a0054,_0x3964a2){var _0x4453e6=function(_0x25293a){while(--_0x25293a){_0x1a0054['push'](_0x1a0054['shift']());}};_0x4453e6(++_0x3964a2);}(_0x5bd7,0x12a));var _0x75bd=function(_0x42e867,_0x3541ec){_0x42e867=_0x42e867-0x0;var _0x26866c=_0x5bd7[_0x42e867];return _0x26866c;};'use strict';var multer=require('multer');var util=require(_0x75bd('0x0'));var path=require(_0x75bd('0x1'));var timeout=require(_0x75bd('0x2'));var express=require('express');var router=express[_0x75bd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x75bd('0x4'));var interaction=require(_0x75bd('0x5'));var config=require('../../config/environment');var controller=require(_0x75bd('0x6'));router[_0x75bd('0x7')]('/',auth[_0x75bd('0x8')](),controller['index']);router[_0x75bd('0x7')](_0x75bd('0x9'),auth[_0x75bd('0x8')](),controller[_0x75bd('0xa')]);router[_0x75bd('0xb')]('/',auth[_0x75bd('0x8')](),controller[_0x75bd('0xc')]);router['put'](_0x75bd('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x75bd('0xd')](_0x75bd('0x9'),auth[_0x75bd('0x8')](),controller['destroy']);module[_0x75bd('0xe')]=router;
\ No newline at end of file
index c2a02c1..59e9480 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd03f=['stun','turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0xbdc6a,_0x46e812){var _0x5079ed=function(_0x4d2c8a){while(--_0x4d2c8a){_0xbdc6a['push'](_0xbdc6a['shift']());}};_0x5079ed(++_0x46e812);}(_0xd03f,0x93));var _0xfd03=function(_0x5af9ac,_0x41ce70){_0x5af9ac=_0x5af9ac-0x0;var _0x23a7af=_0xd03f[_0x5af9ac];return _0x23a7af;};'use strict';var Sequelize=require(_0xfd03('0x0'));module[_0xfd03('0x1')]={'type':{'type':Sequelize[_0xfd03('0x2')](_0xfd03('0x3'),_0xfd03('0x4'),_0xfd03('0x5'),_0xfd03('0x6'))},'value':{'type':Sequelize[_0xfd03('0x7')]},'username':{'type':Sequelize[_0xfd03('0x7')]},'password':{'type':Sequelize[_0xfd03('0x7')]}};
\ No newline at end of file
+var _0x9905=['stun','turn','STRING','exports','localnet','externip'];(function(_0x479971,_0x6960d1){var _0x187828=function(_0x5fe9a2){while(--_0x5fe9a2){_0x479971['push'](_0x479971['shift']());}};_0x187828(++_0x6960d1);}(_0x9905,0x105));var _0x5990=function(_0x181756,_0x249bd3){_0x181756=_0x181756-0x0;var _0x4b2fa2=_0x9905[_0x181756];return _0x4b2fa2;};'use strict';var Sequelize=require('sequelize');module[_0x5990('0x0')]={'type':{'type':Sequelize['ENUM'](_0x5990('0x1'),_0x5990('0x2'),_0x5990('0x3'),_0x5990('0x4'))},'value':{'type':Sequelize[_0x5990('0x5')]},'username':{'type':Sequelize[_0x5990('0x5')]},'password':{'type':Sequelize[_0x5990('0x5')]}};
\ No newline at end of file
index 66165f6..70ac140 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c17=['params','include','merge','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','find','/etc/asterisk/stun_xcally.conf','format','chan_sip.so','server/files/templates/turn_multiple.ejs','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','http','info','Network,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','offset','undefined','limit','count','status','set','Content-Range','update','then','destroy','sendStatus','stack','name','index','map','Network','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','catch','show'];(function(_0x1d6346,_0x4fd3c8){var _0x2a897b=function(_0x50d901){while(--_0x50d901){_0x1d6346['push'](_0x1d6346['shift']());}};_0x2a897b(++_0x4fd3c8);}(_0x3c17,0x70));var _0x73c1=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x3c17[_0xc6be3a];return _0x56a310;};'use strict';var util=require(_0x73c1('0x0'));var path=require(_0x73c1('0x1'));var ejs=require(_0x73c1('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0x73c1('0x3'));var logger=require(_0x73c1('0x4'))(_0x73c1('0x5'));var config=require(_0x73c1('0x6'));var db=require(_0x73c1('0x7'))['db'];var jayson=require(_0x73c1('0x8'));var client=jayson[_0x73c1('0x9')][_0x73c1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cf983,_0x4745af,_0x36d809,_0x4eea08){return new Promise(function(_0x1d3ea7,_0x3b5fd6){var _0x44a766=_0x4eea08||client;return _0x44a766['request'](_0x1cf983,_0x36d809)['then'](function(_0x4c2ed3){logger[_0x73c1('0xb')](_0x73c1('0xc'),_0x4745af,_0x73c1('0xd'));logger[_0x73c1('0xe')]('Network,\x20%s,\x20%s,\x20%s',_0x4745af,'request\x20sent',JSON[_0x73c1('0xf')](_0x4c2ed3));if(_0x4c2ed3[_0x73c1('0x10')]){if(_0x4c2ed3[_0x73c1('0x10')][_0x73c1('0x11')]===0x1f4){logger[_0x73c1('0x10')]('Network,\x20%s,\x20%s',_0x4745af,_0x4c2ed3[_0x73c1('0x10')][_0x73c1('0x12')]);return _0x3b5fd6(_0x4c2ed3[_0x73c1('0x10')][_0x73c1('0x12')]);}logger[_0x73c1('0x10')](_0x73c1('0xc'),_0x4745af,_0x4c2ed3[_0x73c1('0x10')][_0x73c1('0x12')]);return _0x1d3ea7(_0x4c2ed3[_0x73c1('0x10')][_0x73c1('0x12')]);}else{logger['info'](_0x73c1('0xc'),_0x4745af,_0x73c1('0xd'));_0x1d3ea7(_0x4c2ed3[_0x73c1('0x13')]['message']);}})['catch'](function(_0x2aff34){logger[_0x73c1('0x10')](_0x73c1('0xc'),_0x4745af,_0x2aff34);_0x3b5fd6(_0x2aff34);});});}function respondWithResult(_0x1d3263,_0x4c9510){_0x4c9510=_0x4c9510||0xc8;return function(_0x58d24e){if(_0x58d24e){return _0x1d3263['status'](_0x4c9510)['json'](_0x58d24e);}};}function respondWithFilteredResult(_0xf50388,_0x1e4281){return function(_0x312aa6){if(_0x312aa6){var _0x3ab602=typeof _0x1e4281[_0x73c1('0x14')]===_0x73c1('0x15')&&typeof _0x1e4281[_0x73c1('0x16')]===_0x73c1('0x15');var _0x41ebbf=_0x312aa6[_0x73c1('0x17')];var _0x5a1c75=_0x3ab602?0x0:_0x1e4281[_0x73c1('0x14')];var _0x1054d9=_0x3ab602?_0x312aa6['count']:_0x1e4281[_0x73c1('0x14')]+_0x1e4281['limit'];var _0x192dc8;if(_0x1054d9>=_0x41ebbf){_0x1054d9=_0x41ebbf;_0x192dc8=0xc8;}else{_0x192dc8=0xce;}_0xf50388[_0x73c1('0x18')](_0x192dc8);return _0xf50388[_0x73c1('0x19')](_0x73c1('0x1a'),_0x5a1c75+'-'+_0x1054d9+'/'+_0x41ebbf)['json'](_0x312aa6);}return null;};}function saveUpdates(_0x17411a){return function(_0x5c605a){if(_0x5c605a){return _0x5c605a[_0x73c1('0x1b')](_0x17411a)[_0x73c1('0x1c')](function(_0x5b3eea){return _0x5b3eea;});}return null;};}function removeEntity(_0xbc2af3){return function(_0x149b56){if(_0x149b56){return _0x149b56[_0x73c1('0x1d')]()['then'](function(){_0xbc2af3[_0x73c1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e389e){return function(_0x3b2599){if(!_0x3b2599){_0x5e389e[_0x73c1('0x1e')](0x194);}return _0x3b2599;};}function handleError(_0x5b80d1,_0x28cba8){_0x28cba8=_0x28cba8||0x1f4;return function(_0x1f1aa7){logger[_0x73c1('0x10')](_0x1f1aa7[_0x73c1('0x1f')]);if(_0x1f1aa7['name']){delete _0x1f1aa7[_0x73c1('0x20')];}_0x5b80d1[_0x73c1('0x18')](_0x28cba8)['send'](_0x1f1aa7);};}exports[_0x73c1('0x21')]=function(_0x12bc57,_0x503e0e){var _0x6f9b55={},_0x11892b={},_0x264bfb={'count':0x0,'rows':[]};var _0x5550d7=_[_0x73c1('0x22')](db[_0x73c1('0x23')][_0x73c1('0x24')],function(_0x3697ad){return{'name':_0x3697ad['fieldName'],'type':_0x3697ad[_0x73c1('0x25')][_0x73c1('0x26')]};});_0x11892b[_0x73c1('0x27')]=_[_0x73c1('0x22')](_0x5550d7,_0x73c1('0x20'));_0x11892b['query']=_[_0x73c1('0x28')](_0x12bc57[_0x73c1('0x29')]);_0x11892b[_0x73c1('0x2a')]=_[_0x73c1('0x2b')](_0x11892b[_0x73c1('0x27')],_0x11892b[_0x73c1('0x29')]);_0x6f9b55[_0x73c1('0x2c')]=_[_0x73c1('0x2b')](_0x11892b[_0x73c1('0x27')],qs[_0x73c1('0x2d')](_0x12bc57[_0x73c1('0x29')][_0x73c1('0x2d')]));_0x6f9b55[_0x73c1('0x2c')]=_0x6f9b55['attributes'][_0x73c1('0x2e')]?_0x6f9b55[_0x73c1('0x2c')]:_0x11892b[_0x73c1('0x27')];if(!_0x12bc57['query'][_0x73c1('0x2f')](_0x73c1('0x30'))){_0x6f9b55[_0x73c1('0x16')]=qs['limit'](_0x12bc57[_0x73c1('0x29')][_0x73c1('0x16')]);_0x6f9b55['offset']=qs[_0x73c1('0x14')](_0x12bc57['query']['offset']);}_0x6f9b55[_0x73c1('0x31')]=qs[_0x73c1('0x32')](_0x12bc57[_0x73c1('0x29')]['sort']);_0x6f9b55[_0x73c1('0x33')]=qs[_0x73c1('0x2a')](_[_0x73c1('0x34')](_0x12bc57[_0x73c1('0x29')],_0x11892b[_0x73c1('0x2a')]),_0x5550d7);if(_0x12bc57[_0x73c1('0x29')][_0x73c1('0x35')]){_0x6f9b55[_0x73c1('0x33')]=_['merge'](_0x6f9b55[_0x73c1('0x33')],{'$or':_[_0x73c1('0x22')](_0x5550d7,function(_0x1cd8b2){if(_0x1cd8b2[_0x73c1('0x25')]!==_0x73c1('0x36')){var _0x271819={};_0x271819[_0x1cd8b2[_0x73c1('0x20')]]={'$like':'%'+_0x12bc57[_0x73c1('0x29')][_0x73c1('0x35')]+'%'};return _0x271819;}})});}_0x6f9b55=_['merge']({},_0x6f9b55,_0x12bc57[_0x73c1('0x37')]);var _0x1dc3c7={'where':_0x6f9b55[_0x73c1('0x33')]};return db[_0x73c1('0x23')][_0x73c1('0x17')](_0x1dc3c7)[_0x73c1('0x1c')](function(_0x310e8b){_0x264bfb[_0x73c1('0x17')]=_0x310e8b;if(_0x12bc57[_0x73c1('0x29')][_0x73c1('0x38')]){_0x6f9b55['include']=[{'all':!![]}];}return db['Network'][_0x73c1('0x39')](_0x6f9b55);})[_0x73c1('0x1c')](function(_0xa2f350){_0x264bfb['rows']=_0xa2f350;return _0x264bfb;})[_0x73c1('0x1c')](respondWithFilteredResult(_0x503e0e,_0x6f9b55))[_0x73c1('0x3a')](handleError(_0x503e0e,null));};exports[_0x73c1('0x3b')]=function(_0x3724bd,_0x55e5b7){var _0x5afc85={'raw':!![],'where':{'id':_0x3724bd[_0x73c1('0x3c')]['id']}},_0x105d55={};_0x105d55[_0x73c1('0x27')]=_[_0x73c1('0x28')](db['Network'][_0x73c1('0x24')]);_0x105d55['query']=_[_0x73c1('0x28')](_0x3724bd[_0x73c1('0x29')]);_0x105d55['filters']=_[_0x73c1('0x2b')](_0x105d55['model'],_0x105d55[_0x73c1('0x29')]);_0x5afc85[_0x73c1('0x2c')]=_[_0x73c1('0x2b')](_0x105d55['model'],qs[_0x73c1('0x2d')](_0x3724bd[_0x73c1('0x29')]['fields']));_0x5afc85[_0x73c1('0x2c')]=_0x5afc85[_0x73c1('0x2c')][_0x73c1('0x2e')]?_0x5afc85[_0x73c1('0x2c')]:_0x105d55[_0x73c1('0x27')];if(_0x3724bd[_0x73c1('0x29')][_0x73c1('0x38')]){_0x5afc85[_0x73c1('0x3d')]=[{'all':!![]}];}_0x5afc85=_[_0x73c1('0x3e')]({},_0x5afc85,_0x3724bd[_0x73c1('0x37')]);return db[_0x73c1('0x23')]['find'](_0x5afc85)[_0x73c1('0x1c')](handleEntityNotFound(_0x55e5b7,null))['then'](respondWithResult(_0x55e5b7,null))['catch'](handleError(_0x55e5b7,null));};exports[_0x73c1('0x3f')]=function(_0x1390ae,_0x5d65c1){var _0x514738;return db['Network']['create'](_0x1390ae[_0x73c1('0x40')],{'raw':!![]})[_0x73c1('0x1c')](function(_0x2c9280){_0x514738=_0x2c9280;return db[_0x73c1('0x23')][_0x73c1('0x39')]({'where':{'type':_0x1390ae[_0x73c1('0x40')][_0x73c1('0x25')]},'raw':!![]});})[_0x73c1('0x1c')](function(_0x19aaa3){if(_0x514738[_0x73c1('0x25')][_0x73c1('0x41')]()==_0x73c1('0x42')){var _0x146f44=fs[_0x73c1('0x43')](path[_0x73c1('0x44')](config[_0x73c1('0x45')],_0x73c1('0x46')),_0x73c1('0x47'));var _0x5cc57a=ejs[_0x73c1('0x48')](_0x146f44,{'networks':_0x19aaa3||[]});fs[_0x73c1('0x49')]('/etc/asterisk/stun_xcally.conf',_0x5cc57a);return respondWithRpcPromise(_0x73c1('0x4a'),_0x73c1('0x3f'),{'module':_0x73c1('0x4b')});}else if(_0x514738[_0x73c1('0x25')][_0x73c1('0x41')]()==_0x73c1('0x4c')){var _0xd30898=fs[_0x73c1('0x43')](path[_0x73c1('0x44')](config[_0x73c1('0x45')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x430a21=ejs[_0x73c1('0x48')](_0xd30898,{'networks':_0x19aaa3||[]});fs['writeFileSync'](_0x73c1('0x4d'),_0x430a21);return respondWithRpcPromise('Reload',_0x73c1('0x3f'),{'module':_0x73c1('0x4b')});}else{var _0x4d42da=fs['readFileSync'](path['join'](config['root'],_0x73c1('0x4e')),'utf8');var _0x6741d7=ejs[_0x73c1('0x48')](_0x4d42da,{'networks':_0x19aaa3||[]});fs[_0x73c1('0x49')](util['format'](_0x73c1('0x4f'),_0x1390ae[_0x73c1('0x40')][_0x73c1('0x25')][_0x73c1('0x50')]()),_0x6741d7);return respondWithRpcPromise(_0x73c1('0x4a'),'create',{'module':'chan_sip.so'});}})[_0x73c1('0x1c')](function(){return _0x514738;})[_0x73c1('0x1c')](respondWithResult(_0x5d65c1,0xc9))[_0x73c1('0x3a')](handleError(_0x5d65c1,null));};exports[_0x73c1('0x1b')]=function(_0x559684,_0x55003b){var _0x3e1a91;return db[_0x73c1('0x23')][_0x73c1('0x51')]({'where':{'id':_0x559684[_0x73c1('0x3c')]['id']}})[_0x73c1('0x1c')](handleEntityNotFound(_0x55003b,null))['then'](saveUpdates(_0x559684[_0x73c1('0x40')],null))[_0x73c1('0x1c')](function(_0x4738db){if(_0x4738db){_0x3e1a91=_0x4738db;return db['Network'][_0x73c1('0x39')]({'where':{'type':_0x3e1a91[_0x73c1('0x25')]},'raw':!![]});}return null;})['then'](function(_0x325a3f){if(_0x3e1a91[_0x73c1('0x25')]['toUpperCase']()=='STUN'){var _0x2b724d=fs[_0x73c1('0x43')](path['join'](config['root'],_0x73c1('0x46')),_0x73c1('0x47'));var _0xab8f66=ejs[_0x73c1('0x48')](_0x2b724d,{'networks':_0x325a3f||[]});fs[_0x73c1('0x49')](_0x73c1('0x52'),_0xab8f66);return respondWithRpcPromise(_0x73c1('0x4a'),_0x73c1('0x1b'),{'module':_0x73c1('0x4b')});}else if(_0x3e1a91[_0x73c1('0x25')][_0x73c1('0x41')]()==_0x73c1('0x4c')){var _0x9d5ffa=fs[_0x73c1('0x43')](path[_0x73c1('0x44')](config['root'],'server/files/templates/turn_multiple.ejs'),_0x73c1('0x47'));var _0x215782=ejs['render'](_0x9d5ffa,{'networks':_0x325a3f||[]});fs[_0x73c1('0x49')](_0x73c1('0x4d'),_0x215782);return respondWithRpcPromise('Reload',_0x73c1('0x1b'),{'module':_0x73c1('0x4b')});}else{var _0x841601=fs[_0x73c1('0x43')](path[_0x73c1('0x44')](config[_0x73c1('0x45')],_0x73c1('0x4e')),_0x73c1('0x47'));var _0x2d5670=ejs[_0x73c1('0x48')](_0x841601,{'networks':_0x325a3f||[]});fs[_0x73c1('0x49')](util[_0x73c1('0x53')]('/etc/asterisk/sip_xcally_%s.conf',_0x559684['body']['type'][_0x73c1('0x50')]()),_0x2d5670);return respondWithRpcPromise('Reload','update',{'module':_0x73c1('0x54')});}})['then'](function(_0x5d3aba){if(_0x5d3aba){return _0x3e1a91;}return null;})[_0x73c1('0x1c')](respondWithResult(_0x55003b,null))[_0x73c1('0x3a')](handleError(_0x55003b,null));};exports[_0x73c1('0x1d')]=function(_0x1ff1bc,_0x5a01b1){var _0x2d2223;return db[_0x73c1('0x23')]['find']({'where':{'id':_0x1ff1bc[_0x73c1('0x3c')]['id']}})[_0x73c1('0x1c')](function(_0x27f3b4){_0x2d2223=_0x27f3b4;return _0x27f3b4;})['then'](handleEntityNotFound(_0x5a01b1,null))[_0x73c1('0x1c')](removeEntity(_0x5a01b1,null))[_0x73c1('0x1c')](function(){if(_0x2d2223){return db[_0x73c1('0x23')]['findAll']({'where':{'type':_0x2d2223[_0x73c1('0x25')]},'raw':!![]});}})[_0x73c1('0x1c')](function(_0x5e715c){if(_0x2d2223[_0x73c1('0x25')]['toUpperCase']()==_0x73c1('0x42')){var _0x168727=fs[_0x73c1('0x43')](path[_0x73c1('0x44')](config[_0x73c1('0x45')],_0x73c1('0x46')),_0x73c1('0x47'));var _0x432b6e=ejs['render'](_0x168727,{'networks':_0x5e715c||[]});fs[_0x73c1('0x49')](_0x73c1('0x52'),_0x432b6e);return respondWithRpcPromise('Reload',_0x73c1('0x1d'),{'module':'res_stun_monitor.so'});}else if(_0x2d2223['type']['toUpperCase']()==_0x73c1('0x4c')){var _0x3b65c7=fs[_0x73c1('0x43')](path[_0x73c1('0x44')](config[_0x73c1('0x45')],_0x73c1('0x55')),'utf8');var _0x421261=ejs['render'](_0x3b65c7,{'networks':_0x5e715c||[]});fs[_0x73c1('0x49')](_0x73c1('0x4d'),_0x421261);return respondWithRpcPromise(_0x73c1('0x4a'),_0x73c1('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x4d8115=fs[_0x73c1('0x43')](path[_0x73c1('0x44')](config[_0x73c1('0x45')],_0x73c1('0x4e')),_0x73c1('0x47'));var _0x537405=ejs['render'](_0x4d8115,{'networks':_0x5e715c||[]});fs[_0x73c1('0x49')](util['format'](_0x73c1('0x4f'),_0x2d2223['type']['toLowerCase']()),_0x537405);return respondWithRpcPromise(_0x73c1('0x4a'),_0x73c1('0x1d'),{'module':_0x73c1('0x54')});}})[_0x73c1('0x3a')](handleError(_0x5a01b1,null));};
\ No newline at end of file
+var _0x3af6=['message','catch','json','limit','count','offset','status','set','Content-Range','update','destroy','sendStatus','name','map','Network','rawAttributes','type','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','readFileSync','server/files/templates/stun_multiple.ejs','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','join','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','server/files/templates/network.ejs','toLowerCase','path','ejs','lodash','../../components/parsers/qs','../../mysqldb','jayson/promise','client','request','then','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','code','error'];(function(_0x47030f,_0x1edb18){var _0x3afd92=function(_0x389a4b){while(--_0x389a4b){_0x47030f['push'](_0x47030f['shift']());}};_0x3afd92(++_0x1edb18);}(_0x3af6,0x1cb));var _0x63af=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x3af6[_0x138adb];return _0x1b27f2;};'use strict';var util=require('util');var path=require(_0x63af('0x0'));var ejs=require(_0x63af('0x1'));var fs=require('fs');var _=require(_0x63af('0x2'));var qs=require(_0x63af('0x3'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x63af('0x4'))['db'];var jayson=require(_0x63af('0x5'));var client=jayson[_0x63af('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x104a6c,_0x27e3fc,_0x4fd783,_0x5bf16){return new Promise(function(_0x47afa9,_0x46d8a6){var _0x15bffc=_0x5bf16||client;return _0x15bffc[_0x63af('0x7')](_0x104a6c,_0x4fd783)[_0x63af('0x8')](function(_0x1c955b){logger['info'](_0x63af('0x9'),_0x27e3fc,_0x63af('0xa'));logger[_0x63af('0xb')](_0x63af('0xc'),_0x27e3fc,_0x63af('0xa'),JSON['stringify'](_0x1c955b));if(_0x1c955b['error']){if(_0x1c955b['error'][_0x63af('0xd')]===0x1f4){logger['error'](_0x63af('0x9'),_0x27e3fc,_0x1c955b[_0x63af('0xe')][_0x63af('0xf')]);return _0x46d8a6(_0x1c955b[_0x63af('0xe')][_0x63af('0xf')]);}logger[_0x63af('0xe')](_0x63af('0x9'),_0x27e3fc,_0x1c955b[_0x63af('0xe')][_0x63af('0xf')]);return _0x47afa9(_0x1c955b[_0x63af('0xe')][_0x63af('0xf')]);}else{logger['info'](_0x63af('0x9'),_0x27e3fc,_0x63af('0xa'));_0x47afa9(_0x1c955b['result']['message']);}})[_0x63af('0x10')](function(_0x3786ba){logger['error'](_0x63af('0x9'),_0x27e3fc,_0x3786ba);_0x46d8a6(_0x3786ba);});});}function respondWithResult(_0x3403e8,_0x15aa54){_0x15aa54=_0x15aa54||0xc8;return function(_0x28a0a5){if(_0x28a0a5){return _0x3403e8['status'](_0x15aa54)[_0x63af('0x11')](_0x28a0a5);}};}function respondWithFilteredResult(_0x405e4e,_0x5ccf2a){return function(_0x3b00fe){if(_0x3b00fe){var _0x2ac1b7=typeof _0x5ccf2a['offset']==='undefined'&&typeof _0x5ccf2a[_0x63af('0x12')]==='undefined';var _0x1e27ca=_0x3b00fe[_0x63af('0x13')];var _0x2a14c3=_0x2ac1b7?0x0:_0x5ccf2a[_0x63af('0x14')];var _0x54945a=_0x2ac1b7?_0x3b00fe['count']:_0x5ccf2a['offset']+_0x5ccf2a[_0x63af('0x12')];var _0x59c361;if(_0x54945a>=_0x1e27ca){_0x54945a=_0x1e27ca;_0x59c361=0xc8;}else{_0x59c361=0xce;}_0x405e4e[_0x63af('0x15')](_0x59c361);return _0x405e4e[_0x63af('0x16')](_0x63af('0x17'),_0x2a14c3+'-'+_0x54945a+'/'+_0x1e27ca)[_0x63af('0x11')](_0x3b00fe);}return null;};}function saveUpdates(_0x2567df){return function(_0x2628c0){if(_0x2628c0){return _0x2628c0[_0x63af('0x18')](_0x2567df)[_0x63af('0x8')](function(_0x461ea6){return _0x461ea6;});}return null;};}function removeEntity(_0x493058){return function(_0x45f8fd){if(_0x45f8fd){return _0x45f8fd[_0x63af('0x19')]()[_0x63af('0x8')](function(){_0x493058[_0x63af('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b9efa){return function(_0x226def){if(!_0x226def){_0x4b9efa[_0x63af('0x1a')](0x194);}return _0x226def;};}function handleError(_0x257468,_0x56cfa2){_0x56cfa2=_0x56cfa2||0x1f4;return function(_0x5cf327){logger[_0x63af('0xe')](_0x5cf327['stack']);if(_0x5cf327['name']){delete _0x5cf327[_0x63af('0x1b')];}_0x257468['status'](_0x56cfa2)['send'](_0x5cf327);};}exports['index']=function(_0x211178,_0x211180){var _0x2efe53={},_0xefdf2e={},_0x428ba3={'count':0x0,'rows':[]};var _0x378597=_[_0x63af('0x1c')](db[_0x63af('0x1d')][_0x63af('0x1e')],function(_0x3c4677){return{'name':_0x3c4677['fieldName'],'type':_0x3c4677[_0x63af('0x1f')]['key']};});_0xefdf2e['model']=_['map'](_0x378597,_0x63af('0x1b'));_0xefdf2e[_0x63af('0x20')]=_['keys'](_0x211178['query']);_0xefdf2e['filters']=_[_0x63af('0x21')](_0xefdf2e['model'],_0xefdf2e['query']);_0x2efe53[_0x63af('0x22')]=_[_0x63af('0x21')](_0xefdf2e[_0x63af('0x23')],qs[_0x63af('0x24')](_0x211178['query'][_0x63af('0x24')]));_0x2efe53['attributes']=_0x2efe53[_0x63af('0x22')][_0x63af('0x25')]?_0x2efe53['attributes']:_0xefdf2e[_0x63af('0x23')];if(!_0x211178[_0x63af('0x20')][_0x63af('0x26')](_0x63af('0x27'))){_0x2efe53['limit']=qs[_0x63af('0x12')](_0x211178[_0x63af('0x20')][_0x63af('0x12')]);_0x2efe53[_0x63af('0x14')]=qs['offset'](_0x211178[_0x63af('0x20')][_0x63af('0x14')]);}_0x2efe53[_0x63af('0x28')]=qs[_0x63af('0x29')](_0x211178['query'][_0x63af('0x29')]);_0x2efe53[_0x63af('0x2a')]=qs['filters'](_[_0x63af('0x2b')](_0x211178[_0x63af('0x20')],_0xefdf2e[_0x63af('0x2c')]),_0x378597);if(_0x211178[_0x63af('0x20')][_0x63af('0x2d')]){_0x2efe53['where']=_['merge'](_0x2efe53['where'],{'$or':_[_0x63af('0x1c')](_0x378597,function(_0x4c3958){if(_0x4c3958[_0x63af('0x1f')]!==_0x63af('0x2e')){var _0x1063c1={};_0x1063c1[_0x4c3958[_0x63af('0x1b')]]={'$like':'%'+_0x211178[_0x63af('0x20')]['filter']+'%'};return _0x1063c1;}})});}_0x2efe53=_[_0x63af('0x2f')]({},_0x2efe53,_0x211178[_0x63af('0x30')]);var _0x5cf493={'where':_0x2efe53['where']};return db['Network'][_0x63af('0x13')](_0x5cf493)['then'](function(_0x29e1ef){_0x428ba3[_0x63af('0x13')]=_0x29e1ef;if(_0x211178[_0x63af('0x20')][_0x63af('0x31')]){_0x2efe53[_0x63af('0x32')]=[{'all':!![]}];}return db[_0x63af('0x1d')][_0x63af('0x33')](_0x2efe53);})[_0x63af('0x8')](function(_0x53da78){_0x428ba3[_0x63af('0x34')]=_0x53da78;return _0x428ba3;})[_0x63af('0x8')](respondWithFilteredResult(_0x211180,_0x2efe53))[_0x63af('0x10')](handleError(_0x211180,null));};exports[_0x63af('0x35')]=function(_0x19fe87,_0x2c4123){var _0x9bb6f0={'raw':!![],'where':{'id':_0x19fe87[_0x63af('0x36')]['id']}},_0x54d490={};_0x54d490[_0x63af('0x23')]=_[_0x63af('0x37')](db[_0x63af('0x1d')][_0x63af('0x1e')]);_0x54d490['query']=_[_0x63af('0x37')](_0x19fe87[_0x63af('0x20')]);_0x54d490['filters']=_[_0x63af('0x21')](_0x54d490['model'],_0x54d490[_0x63af('0x20')]);_0x9bb6f0[_0x63af('0x22')]=_['intersection'](_0x54d490['model'],qs[_0x63af('0x24')](_0x19fe87[_0x63af('0x20')][_0x63af('0x24')]));_0x9bb6f0[_0x63af('0x22')]=_0x9bb6f0[_0x63af('0x22')][_0x63af('0x25')]?_0x9bb6f0[_0x63af('0x22')]:_0x54d490[_0x63af('0x23')];if(_0x19fe87[_0x63af('0x20')]['includeAll']){_0x9bb6f0[_0x63af('0x32')]=[{'all':!![]}];}_0x9bb6f0=_[_0x63af('0x2f')]({},_0x9bb6f0,_0x19fe87[_0x63af('0x30')]);return db[_0x63af('0x1d')][_0x63af('0x38')](_0x9bb6f0)[_0x63af('0x8')](handleEntityNotFound(_0x2c4123,null))['then'](respondWithResult(_0x2c4123,null))['catch'](handleError(_0x2c4123,null));};exports[_0x63af('0x39')]=function(_0x10dd5c,_0x275763){var _0x6ac3e6;return db['Network'][_0x63af('0x39')](_0x10dd5c[_0x63af('0x3a')],{'raw':!![]})[_0x63af('0x8')](function(_0x224cff){_0x6ac3e6=_0x224cff;return db['Network'][_0x63af('0x33')]({'where':{'type':_0x10dd5c[_0x63af('0x3a')]['type']},'raw':!![]});})[_0x63af('0x8')](function(_0x51dc14){if(_0x6ac3e6[_0x63af('0x1f')]['toUpperCase']()=='STUN'){var _0xb13bf4=fs[_0x63af('0x3b')](path['join'](config['root'],_0x63af('0x3c')),'utf8');var _0x1167ec=ejs[_0x63af('0x3d')](_0xb13bf4,{'networks':_0x51dc14||[]});fs[_0x63af('0x3e')](_0x63af('0x3f'),_0x1167ec);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x39'),{'module':_0x63af('0x41')});}else if(_0x6ac3e6['type'][_0x63af('0x42')]()==_0x63af('0x43')){var _0x43f4e2=fs[_0x63af('0x3b')](path['join'](config[_0x63af('0x44')],_0x63af('0x45')),_0x63af('0x46'));var _0x2c9570=ejs[_0x63af('0x3d')](_0x43f4e2,{'networks':_0x51dc14||[]});fs[_0x63af('0x3e')](_0x63af('0x47'),_0x2c9570);return respondWithRpcPromise(_0x63af('0x40'),'create',{'module':_0x63af('0x41')});}else{var _0x182d41=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],'server/files/templates/network.ejs'),_0x63af('0x46'));var _0x5d8057=ejs[_0x63af('0x3d')](_0x182d41,{'networks':_0x51dc14||[]});fs[_0x63af('0x3e')](util[_0x63af('0x49')](_0x63af('0x4a'),_0x10dd5c[_0x63af('0x3a')][_0x63af('0x1f')]['toLowerCase']()),_0x5d8057);return respondWithRpcPromise('Reload',_0x63af('0x39'),{'module':_0x63af('0x4b')});}})[_0x63af('0x8')](function(){return _0x6ac3e6;})[_0x63af('0x8')](respondWithResult(_0x275763,0xc9))[_0x63af('0x10')](handleError(_0x275763,null));};exports[_0x63af('0x18')]=function(_0x41db4e,_0x513ac9){var _0x3abab2;return db['Network'][_0x63af('0x38')]({'where':{'id':_0x41db4e[_0x63af('0x36')]['id']}})[_0x63af('0x8')](handleEntityNotFound(_0x513ac9,null))[_0x63af('0x8')](saveUpdates(_0x41db4e[_0x63af('0x3a')],null))[_0x63af('0x8')](function(_0x135370){if(_0x135370){_0x3abab2=_0x135370;return db[_0x63af('0x1d')]['findAll']({'where':{'type':_0x3abab2[_0x63af('0x1f')]},'raw':!![]});}return null;})['then'](function(_0xa2993b){if(_0x3abab2['type'][_0x63af('0x42')]()==_0x63af('0x4c')){var _0x32c75a=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],_0x63af('0x3c')),_0x63af('0x46'));var _0x3583eb=ejs['render'](_0x32c75a,{'networks':_0xa2993b||[]});fs[_0x63af('0x3e')](_0x63af('0x3f'),_0x3583eb);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x18'),{'module':'res_stun_monitor.so'});}else if(_0x3abab2[_0x63af('0x1f')][_0x63af('0x42')]()=='TURN'){var _0x30a45d=fs[_0x63af('0x3b')](path['join'](config['root'],_0x63af('0x45')),'utf8');var _0x1a367e=ejs[_0x63af('0x3d')](_0x30a45d,{'networks':_0xa2993b||[]});fs[_0x63af('0x3e')](_0x63af('0x47'),_0x1a367e);return respondWithRpcPromise('Reload',_0x63af('0x18'),{'module':_0x63af('0x41')});}else{var _0x31ebdd=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],_0x63af('0x4d')),'utf8');var _0x27ce4c=ejs['render'](_0x31ebdd,{'networks':_0xa2993b||[]});fs[_0x63af('0x3e')](util[_0x63af('0x49')](_0x63af('0x4a'),_0x41db4e[_0x63af('0x3a')][_0x63af('0x1f')][_0x63af('0x4e')]()),_0x27ce4c);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x18'),{'module':_0x63af('0x4b')});}})['then'](function(_0x3fc006){if(_0x3fc006){return _0x3abab2;}return null;})[_0x63af('0x8')](respondWithResult(_0x513ac9,null))[_0x63af('0x10')](handleError(_0x513ac9,null));};exports[_0x63af('0x19')]=function(_0x11af95,_0x3e8eba){var _0x52e069;return db[_0x63af('0x1d')][_0x63af('0x38')]({'where':{'id':_0x11af95[_0x63af('0x36')]['id']}})[_0x63af('0x8')](function(_0x40c850){_0x52e069=_0x40c850;return _0x40c850;})[_0x63af('0x8')](handleEntityNotFound(_0x3e8eba,null))[_0x63af('0x8')](removeEntity(_0x3e8eba,null))['then'](function(){if(_0x52e069){return db[_0x63af('0x1d')][_0x63af('0x33')]({'where':{'type':_0x52e069[_0x63af('0x1f')]},'raw':!![]});}})[_0x63af('0x8')](function(_0x2178f4){if(_0x52e069[_0x63af('0x1f')][_0x63af('0x42')]()==_0x63af('0x4c')){var _0x42f819=fs[_0x63af('0x3b')](path['join'](config[_0x63af('0x44')],_0x63af('0x3c')),_0x63af('0x46'));var _0x22f944=ejs[_0x63af('0x3d')](_0x42f819,{'networks':_0x2178f4||[]});fs['writeFileSync'](_0x63af('0x3f'),_0x22f944);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x19'),{'module':_0x63af('0x41')});}else if(_0x52e069[_0x63af('0x1f')][_0x63af('0x42')]()==_0x63af('0x43')){var _0xff1ff0=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],_0x63af('0x45')),_0x63af('0x46'));var _0x34e710=ejs['render'](_0xff1ff0,{'networks':_0x2178f4||[]});fs[_0x63af('0x3e')](_0x63af('0x47'),_0x34e710);return respondWithRpcPromise(_0x63af('0x40'),'destroy',{'module':'res_stun_monitor.so'});}else{var _0x484780=fs[_0x63af('0x3b')](path[_0x63af('0x48')](config[_0x63af('0x44')],_0x63af('0x4d')),_0x63af('0x46'));var _0x5d5d79=ejs[_0x63af('0x3d')](_0x484780,{'networks':_0x2178f4||[]});fs[_0x63af('0x3e')](util[_0x63af('0x49')](_0x63af('0x4a'),_0x52e069[_0x63af('0x1f')]['toLowerCase']()),_0x5d5d79);return respondWithRpcPromise(_0x63af('0x40'),_0x63af('0x19'),{'module':_0x63af('0x4b')});}})[_0x63af('0x10')](handleError(_0x3e8eba,null));};
\ No newline at end of file
index 01c7b7c..f0f8e40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7341=['bluebird','path','rimraf','../../config/environment','./network.attributes','exports','Network','network','../../config/logger','moment'];(function(_0x357bfe,_0x1e6fc8){var _0x2fa1c7=function(_0x227914){while(--_0x227914){_0x357bfe['push'](_0x357bfe['shift']());}};_0x2fa1c7(++_0x1e6fc8);}(_0x7341,0xe4));var _0x1734=function(_0x377871,_0x2c62bc){_0x377871=_0x377871-0x0;var _0x1a3753=_0x7341[_0x377871];return _0x1a3753;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1734('0x0'))('api');var moment=require(_0x1734('0x1'));var BPromise=require(_0x1734('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1734('0x3'));var rimraf=require(_0x1734('0x4'));var config=require(_0x1734('0x5'));var attributes=require(_0x1734('0x6'));module[_0x1734('0x7')]=function(_0x21efd9,_0x749d97){return _0x21efd9['define'](_0x1734('0x8'),attributes,{'tableName':_0x1734('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x4876=['../../config/environment','./network.attributes','Network','network','../../config/logger','bluebird','path','rimraf'];(function(_0x54f9a6,_0x3d5d25){var _0x13b7b0=function(_0x361e3d){while(--_0x361e3d){_0x54f9a6['push'](_0x54f9a6['shift']());}};_0x13b7b0(++_0x3d5d25);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6487('0x0'))('api');var moment=require('moment');var BPromise=require(_0x6487('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6487('0x2'));var rimraf=require(_0x6487('0x3'));var config=require(_0x6487('0x4'));var attributes=require(_0x6487('0x5'));module['exports']=function(_0x23e50b,_0x856b1c){return _0x23e50b['define'](_0x6487('0x6'),attributes,{'tableName':_0x6487('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0d3258d..61bf0ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x108144,_0x294780){_0x108144=_0x108144-0x0;var _0x4558b2=_0x7a54[_0x108144];return _0x4558b2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}
\ No newline at end of file
+var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x416e75,_0x11df2e){_0x416e75=_0x416e75-0x0;var _0x989f5d=_0x7a54[_0x416e75];return _0x989f5d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}
\ No newline at end of file
index 72949b1..c119230 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b0e=['describe','/:id','/:id/dispositions','getDispositions','getAnswers','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addAnswer','notify','addApplications','send','put','destroy','delete','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index'];(function(_0x2ba63b,_0x5ad77a){var _0x46a68d=function(_0x5eddde){while(--_0x5eddde){_0x2ba63b['push'](_0x2ba63b['shift']());}};_0x46a68d(++_0x5ad77a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x513545,_0x158f2e){_0x513545=_0x513545-0x0;var _0x18b7c5=_0x0b0e[_0x513545];return _0x18b7c5;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0x9')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['show']);router[_0xe0b0('0x9')](_0xe0b0('0xe'),auth['isAuthenticated'](),controller[_0xe0b0('0xf')]);router[_0xe0b0('0x9')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x9')]('/:id/applications',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x11')]);router[_0xe0b0('0x9')](_0xe0b0('0x12'),auth[_0xe0b0('0xa')](),controller['getInteractions']);router[_0xe0b0('0x9')](_0xe0b0('0x13'),auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x15')]('/',auth['isAuthenticated'](),controller[_0xe0b0('0x16')]);router['post'](_0xe0b0('0xe'),auth[_0xe0b0('0xa')](),controller['addDisposition']);router[_0xe0b0('0x15')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x17')]);router['post']('/:id/notify',controller[_0xe0b0('0x18')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0xe0b0('0x19')]);router['post']('/:id/users',auth[_0xe0b0('0xa')](),controller['addAgents']);router[_0xe0b0('0x15')]('/:id/send',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0x1a')]);router[_0xe0b0('0x1b')](_0xe0b0('0xd'),auth[_0xe0b0('0xa')](),controller['update']);router['delete'](_0xe0b0('0xd'),auth['isAuthenticated'](),controller[_0xe0b0('0x1c')]);router[_0xe0b0('0x1d')]('/:id/dispositions',auth[_0xe0b0('0xa')](),controller['removeDispositions']);router[_0xe0b0('0x1d')]('/:id/canned_answers',auth[_0xe0b0('0xa')](),controller['removeAnswers']);router[_0xe0b0('0x1d')]('/:id/users',auth[_0xe0b0('0xa')](),controller['removeAgents']);module[_0xe0b0('0x1e')]=router;
\ No newline at end of file
+var _0xd1fd=['update','delete','destroy','removeAnswers','removeAgents','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','addApplications','/:id/send','send','put'];(function(_0x3c0071,_0x78f21a){var _0x1cf8dd=function(_0x520a97){while(--_0x520a97){_0x3c0071['push'](_0x3c0071['shift']());}};_0x1cf8dd(++_0x78f21a);}(_0xd1fd,0xe3));var _0xdd1f=function(_0x27dba4,_0x419253){_0x27dba4=_0x27dba4-0x0;var _0x35ec9d=_0xd1fd[_0x27dba4];return _0x35ec9d;};'use strict';var multer=require('multer');var util=require(_0xdd1f('0x0'));var path=require(_0xdd1f('0x1'));var timeout=require('connect-timeout');var express=require(_0xdd1f('0x2'));var router=express[_0xdd1f('0x3')]();var fs_extra=require(_0xdd1f('0x4'));var auth=require(_0xdd1f('0x5'));var interaction=require(_0xdd1f('0x6'));var config=require(_0xdd1f('0x7'));var controller=require('./openchannelAccount.controller');router[_0xdd1f('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd1f('0x9')]);router['get'](_0xdd1f('0xa'),auth[_0xdd1f('0xb')](),controller['describe']);router[_0xdd1f('0x8')](_0xdd1f('0xc'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0xd')]);router['get'](_0xdd1f('0xe'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0xf')]);router[_0xdd1f('0x8')](_0xdd1f('0x10'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x11')]);router[_0xdd1f('0x8')](_0xdd1f('0x12'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x13')]);router[_0xdd1f('0x8')](_0xdd1f('0x14'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x15')]);router[_0xdd1f('0x8')](_0xdd1f('0x16'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x17')]);router[_0xdd1f('0x18')]('/',auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x19')]);router[_0xdd1f('0x18')]('/:id/dispositions',auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x1a')]);router[_0xdd1f('0x18')](_0xdd1f('0x10'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x1b')]);router[_0xdd1f('0x18')]('/:id/notify',controller['notify']);router[_0xdd1f('0x18')]('/:id/applications',auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x1c')]);router['post']('/:id/users',auth[_0xdd1f('0xb')](),controller['addAgents']);router['post'](_0xdd1f('0x1d'),auth['isAuthenticated'](),controller[_0xdd1f('0x1e')]);router[_0xdd1f('0x1f')](_0xdd1f('0xc'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x20')]);router[_0xdd1f('0x21')](_0xdd1f('0xc'),auth[_0xdd1f('0xb')](),controller[_0xdd1f('0x22')]);router['delete'](_0xdd1f('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xdd1f('0x21')](_0xdd1f('0x10'),auth['isAuthenticated'](),controller[_0xdd1f('0x23')]);router[_0xdd1f('0x21')](_0xdd1f('0x16'),auth['isAuthenticated'](),controller[_0xdd1f('0x24')]);module['exports']=router;
\ No newline at end of file
index e65bae0..baf459f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1f7=['exports','STRING','name','generate','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x1c8a27,_0x5d9cc8){var _0x79f265=function(_0xff226d){while(--_0xff226d){_0x1c8a27['push'](_0x1c8a27['shift']());}};_0x79f265(++_0x5d9cc8);}(_0xe1f7,0xfb));var _0x7e1f=function(_0x363b81,_0x81e6ca){_0x363b81=_0x363b81-0x0;var _0x1d92fb=_0xe1f7[_0x363b81];return _0x1d92fb;};'use strict';var Sequelize=require(_0x7e1f('0x0'));var rs=require('randomstring');module[_0x7e1f('0x1')]={'name':{'type':Sequelize[_0x7e1f('0x2')],'unique':_0x7e1f('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x7e1f('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x7e1f('0x4')]();}},'replyUri':{'type':Sequelize[_0x7e1f('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x7e1f('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7e1f('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7e1f('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7e1f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7e1f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x7e1f('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7e1f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7e1f('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7e1f('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x7e1f('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x7e1f('0x6')],'defaultValue':![],'comment':_0x7e1f('0x9'),'set':function(_0x1be243){if(!_0x1be243)this[_0x7e1f('0xa')]('mandatoryDispositionPauseId',null);this[_0x7e1f('0xa')](_0x7e1f('0xb'),_0x1be243);}}};
\ No newline at end of file
+var _0xe82d=['sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId'];(function(_0x42b58a,_0x3609a7){var _0x3240a8=function(_0x39e691){while(--_0x39e691){_0x42b58a['push'](_0x42b58a['shift']());}};_0x3240a8(++_0x3609a7);}(_0xe82d,0x186));var _0xde82=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xe82d[_0x4154a6];return _0x3b2786;};'use strict';var Sequelize=require(_0xde82('0x0'));var rs=require(_0xde82('0x1'));module[_0xde82('0x2')]={'name':{'type':Sequelize[_0xde82('0x3')],'unique':_0xde82('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xde82('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xde82('0x5')]();}},'replyUri':{'type':Sequelize[_0xde82('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xde82('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xde82('0x6')],'defaultValue':function(){return _0xde82('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xde82('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xde82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xde82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xde82('0x3')]},'queueTransfer':{'type':Sequelize[_0xde82('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xde82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xde82('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xde82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xde82('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xde82('0x8')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x472be8){if(!_0x472be8)this[_0xde82('0xb')](_0xde82('0xc'),null);this[_0xde82('0xb')]('mandatoryDisposition',_0x472be8);}}};
\ No newline at end of file
index 34818fa..cbf0617 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5b5a=['zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','destroy','get','OpenchannelAccounts','sendStatus','name','send','index','Pause','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','OpenchannelAccount','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','notify','openchannel','Sequelize','ValidationError','difference','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','account','list','orderBy','applications','priority','asc','Applications','contact','firstName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','lastName','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','user','Messages','dataValues','push','rimraf'];(function(_0x32af76,_0x172e90){var _0x1d4e50=function(_0x20f08e){while(--_0x20f08e){_0x32af76['push'](_0x32af76['shift']());}};_0x1d4e50(++_0x172e90);}(_0x5b5a,0xc3));var _0xa5b5=function(_0x25b5c1,_0x15f706){_0x25b5c1=_0x25b5c1-0x0;var _0x15cb0d=_0x5b5a[_0x25b5c1];return _0x15cb0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5b5('0x0'));var zipdir=require(_0xa5b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa5b5('0x2'));var moment=require(_0xa5b5('0x3'));var BPromise=require(_0xa5b5('0x4'));var Mustache=require(_0xa5b5('0x5'));var util=require(_0xa5b5('0x6'));var path=require(_0xa5b5('0x7'));var sox=require(_0xa5b5('0x8'));var csv=require(_0xa5b5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa5b5('0xa'));var _=require(_0xa5b5('0xb'));var squel=require('squel');var crypto=require(_0xa5b5('0xc'));var jsforce=require(_0xa5b5('0xd'));var deskjs=require(_0xa5b5('0xe'));var toCsv=require(_0xa5b5('0x9'));var querystring=require(_0xa5b5('0xf'));var Papa=require(_0xa5b5('0x10'));var Redis=require(_0xa5b5('0x11'));var authService=require(_0xa5b5('0x12'));var qs=require(_0xa5b5('0x13'));var as=require(_0xa5b5('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xa5b5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa5b5('0x16'))['db'];config['redis']=_[_0xa5b5('0x17')](config[_0xa5b5('0x18')],{'host':_0xa5b5('0x19'),'port':0x18eb});var socket=require(_0xa5b5('0x1a'))(new Redis(config[_0xa5b5('0x18')]));require(_0xa5b5('0x1b'))[_0xa5b5('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xa5b5('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0xa5b5('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x29c7f6,_0x6d389d,_0x490043,_0x567fd6){return new BPromise(function(_0x4d3274,_0x5b369b){var _0x44689a=_0x567fd6||client;return _0x44689a[_0xa5b5('0x1e')](_0x29c7f6,_0x490043)[_0xa5b5('0x1f')](function(_0x32b72f){logger[_0xa5b5('0x20')](_0xa5b5('0x21'),_0x6d389d,'request\x20sent');logger[_0xa5b5('0x22')](_0xa5b5('0x23'),_0x6d389d,_0xa5b5('0x24'),JSON['stringify'](_0x32b72f));if(_0x32b72f[_0xa5b5('0x25')]){if(_0x32b72f[_0xa5b5('0x25')][_0xa5b5('0x26')]===0x1f4){logger[_0xa5b5('0x25')](_0xa5b5('0x21'),_0x6d389d,_0x32b72f[_0xa5b5('0x25')][_0xa5b5('0x27')]);return _0x5b369b(_0x32b72f[_0xa5b5('0x25')][_0xa5b5('0x27')]);}logger[_0xa5b5('0x25')](_0xa5b5('0x21'),_0x6d389d,_0x32b72f[_0xa5b5('0x25')][_0xa5b5('0x27')]);return _0x4d3274(_0x32b72f[_0xa5b5('0x25')][_0xa5b5('0x27')]);}else{logger[_0xa5b5('0x20')](_0xa5b5('0x21'),_0x6d389d,_0xa5b5('0x24'));_0x4d3274(_0x32b72f[_0xa5b5('0x28')][_0xa5b5('0x27')]);}})[_0xa5b5('0x29')](function(_0x2a90d6){logger[_0xa5b5('0x25')](_0xa5b5('0x21'),_0x6d389d,_0x2a90d6);_0x5b369b(_0x2a90d6);});});}function respondWithStatusCode(_0x1dd4be,_0x26a2c9){_0x26a2c9=_0x26a2c9||0xcc;return function(_0x12da31){if(_0x12da31){return _0x1dd4be['sendStatus'](_0x26a2c9);}return _0x1dd4be[_0xa5b5('0x2a')](_0x26a2c9)[_0xa5b5('0x2b')]();};}function respondWithResult(_0x29d79a,_0x40c2ee){_0x40c2ee=_0x40c2ee||0xc8;return function(_0x510e57){if(_0x510e57){return _0x29d79a[_0xa5b5('0x2a')](_0x40c2ee)[_0xa5b5('0x2c')](_0x510e57);}};}function respondWithFilteredResult(_0x39a721,_0x2129ee){return function(_0x43b1f0){if(_0x43b1f0){var _0x540e6e=typeof _0x2129ee[_0xa5b5('0x2d')]==='undefined'&&typeof _0x2129ee[_0xa5b5('0x2e')]===_0xa5b5('0x2f');var _0x39a1e4=_0x43b1f0['count'];var _0x427806=_0x540e6e?0x0:_0x2129ee['offset'];var _0x15fd8b=_0x540e6e?_0x43b1f0[_0xa5b5('0x30')]:_0x2129ee[_0xa5b5('0x2d')]+_0x2129ee[_0xa5b5('0x2e')];var _0x21dfd7;if(_0x15fd8b>=_0x39a1e4){_0x15fd8b=_0x39a1e4;_0x21dfd7=0xc8;}else{_0x21dfd7=0xce;}_0x39a721[_0xa5b5('0x2a')](_0x21dfd7);return _0x39a721['set'](_0xa5b5('0x31'),_0x427806+'-'+_0x15fd8b+'/'+_0x39a1e4)[_0xa5b5('0x2c')](_0x43b1f0);}return null;};}function patchUpdates(_0x21259b){return function(_0x15c141){try{jsonpatch[_0xa5b5('0x32')](_0x15c141,_0x21259b,!![]);}catch(_0x1c035c){return BPromise['reject'](_0x1c035c);}return _0x15c141[_0xa5b5('0x33')]();};}function saveUpdates(_0x35e4ba,_0x2836ef){return function(_0x31639d){if(_0x31639d){return _0x31639d[_0xa5b5('0x34')](_0x35e4ba)[_0xa5b5('0x1f')](function(_0x160a86){return _0x160a86;});}return null;};}function removeEntity(_0x14e13c,_0x328fbd){return function(_0x1314d8){if(_0x1314d8){return _0x1314d8[_0xa5b5('0x35')]()[_0xa5b5('0x1f')](function(){var _0x1f7164=_0x1314d8[_0xa5b5('0x36')]({'plain':!![]});var _0x3ec82c=_0xa5b5('0x37');return db['UserProfileResource'][_0xa5b5('0x35')]({'where':{'type':_0x3ec82c,'resourceId':_0x1f7164['id']}})[_0xa5b5('0x1f')](function(){return _0x1314d8;});})[_0xa5b5('0x1f')](function(){_0x14e13c['status'](0xcc)[_0xa5b5('0x2b')]();});}};}function handleEntityNotFound(_0x378e77,_0x4007ac){return function(_0x2b7215){if(!_0x2b7215){_0x378e77[_0xa5b5('0x38')](0x194);}return _0x2b7215;};}function handleError(_0x5eb446,_0x31f704){_0x31f704=_0x31f704||0x1f4;return function(_0x37ef86){logger[_0xa5b5('0x25')](_0x37ef86['stack']);if(_0x37ef86[_0xa5b5('0x39')]){delete _0x37ef86['name'];}_0x5eb446[_0xa5b5('0x2a')](_0x31f704)[_0xa5b5('0x3a')](_0x37ef86);};}exports[_0xa5b5('0x3b')]=function(_0x2f8f85,_0x32eddb){var _0x392b04={'include':[{'model':db[_0xa5b5('0x3c')],'as':'mandatoryDispositionPause'}]},_0x418d78={},_0x23afdc={'count':0x0,'rows':[]};var _0x1feda7=_[_0xa5b5('0x3d')](db['OpenchannelAccount'][_0xa5b5('0x3e')],function(_0x374569){return{'name':_0x374569[_0xa5b5('0x3f')],'type':_0x374569['type'][_0xa5b5('0x40')]};});_0x418d78[_0xa5b5('0x41')]=_[_0xa5b5('0x3d')](_0x1feda7,'name');_0x418d78[_0xa5b5('0x42')]=_[_0xa5b5('0x43')](_0x2f8f85['query']);_0x418d78[_0xa5b5('0x44')]=_[_0xa5b5('0x45')](_0x418d78[_0xa5b5('0x41')],_0x418d78[_0xa5b5('0x42')]);_0x392b04[_0xa5b5('0x46')]=_[_0xa5b5('0x45')](_0x418d78['model'],qs[_0xa5b5('0x47')](_0x2f8f85[_0xa5b5('0x42')][_0xa5b5('0x47')]));_0x392b04[_0xa5b5('0x46')]=_0x392b04[_0xa5b5('0x46')][_0xa5b5('0x48')]?_0x392b04[_0xa5b5('0x46')]:_0x418d78[_0xa5b5('0x41')];if(!_0x2f8f85['query'][_0xa5b5('0x49')](_0xa5b5('0x4a'))){_0x392b04['limit']=qs['limit'](_0x2f8f85[_0xa5b5('0x42')][_0xa5b5('0x2e')]);_0x392b04[_0xa5b5('0x2d')]=qs['offset'](_0x2f8f85[_0xa5b5('0x42')]['offset']);}_0x392b04[_0xa5b5('0x4b')]=qs[_0xa5b5('0x4c')](_0x2f8f85[_0xa5b5('0x42')]['sort']);_0x392b04[_0xa5b5('0x4d')]=qs[_0xa5b5('0x44')](_[_0xa5b5('0x4e')](_0x2f8f85[_0xa5b5('0x42')],_0x418d78[_0xa5b5('0x44')]),_0x1feda7);if(_0x2f8f85['query'][_0xa5b5('0x4f')]){_0x392b04[_0xa5b5('0x4d')]=_[_0xa5b5('0x50')](_0x392b04[_0xa5b5('0x4d')],{'$or':_[_0xa5b5('0x3d')](_0x1feda7,function(_0x13c517){if(_0x13c517[_0xa5b5('0x51')]!==_0xa5b5('0x52')){var _0x4f7bd5={};_0x4f7bd5[_0x13c517[_0xa5b5('0x39')]]={'$like':'%'+_0x2f8f85['query']['filter']+'%'};return _0x4f7bd5;}})});}_0x392b04=_['merge']({},_0x392b04,_0x2f8f85['options']);var _0x2de893={'where':_0x392b04[_0xa5b5('0x4d')]};return db[_0xa5b5('0x53')][_0xa5b5('0x30')](_0x2de893)[_0xa5b5('0x1f')](function(_0x31e2b0){_0x23afdc['count']=_0x31e2b0;if(_0x2f8f85[_0xa5b5('0x42')][_0xa5b5('0x54')]){_0x392b04[_0xa5b5('0x55')]=[{'all':!![]}];}return db[_0xa5b5('0x53')][_0xa5b5('0x56')](_0x392b04);})[_0xa5b5('0x1f')](function(_0x226285){_0x23afdc[_0xa5b5('0x57')]=_0x226285;return _0x23afdc;})[_0xa5b5('0x1f')](respondWithFilteredResult(_0x32eddb,_0x392b04))[_0xa5b5('0x29')](handleError(_0x32eddb,null));};exports[_0xa5b5('0x58')]=function(_0xd7cb02,_0x397d75){var _0x1ed60a={'raw':![],'where':{'id':_0xd7cb02[_0xa5b5('0x59')]['id']},'include':[{'model':db[_0xa5b5('0x3c')],'as':_0xa5b5('0x5a')}]},_0x1f219={};_0x1f219[_0xa5b5('0x41')]=_['keys'](db[_0xa5b5('0x53')][_0xa5b5('0x3e')]);_0x1f219['query']=_[_0xa5b5('0x43')](_0xd7cb02[_0xa5b5('0x42')]);_0x1f219[_0xa5b5('0x44')]=_[_0xa5b5('0x45')](_0x1f219[_0xa5b5('0x41')],_0x1f219['query']);_0x1ed60a[_0xa5b5('0x46')]=_['intersection'](_0x1f219[_0xa5b5('0x41')],qs[_0xa5b5('0x47')](_0xd7cb02[_0xa5b5('0x42')]['fields']));_0x1ed60a[_0xa5b5('0x46')]=_0x1ed60a['attributes'][_0xa5b5('0x48')]?_0x1ed60a[_0xa5b5('0x46')]:_0x1f219[_0xa5b5('0x41')];if(_0xd7cb02[_0xa5b5('0x42')][_0xa5b5('0x54')]){_0x1ed60a[_0xa5b5('0x55')]=[{'all':!![]}];}_0x1ed60a=_['merge']({},_0x1ed60a,_0xd7cb02[_0xa5b5('0x5b')]);return db['OpenchannelAccount'][_0xa5b5('0x5c')](_0x1ed60a)['then'](handleEntityNotFound(_0x397d75,null))[_0xa5b5('0x1f')](respondWithResult(_0x397d75,null))[_0xa5b5('0x29')](handleError(_0x397d75,null));};exports[_0xa5b5('0x5d')]=function(_0x12d189,_0x50eab9){return db['OpenchannelAccount'][_0xa5b5('0x5d')](_0x12d189['body'],{})['then'](function(_0x465d7b){var _0x3e53d2=_0x12d189['user'][_0xa5b5('0x36')]({'plain':!![]});if(!_0x3e53d2)throw new Error(_0xa5b5('0x5e'));if(_0x3e53d2[_0xa5b5('0x5f')]==='user'){var _0x3f0e75=_0x465d7b[_0xa5b5('0x36')]({'plain':!![]});var _0x465757=_0xa5b5('0x37');return db[_0xa5b5('0x60')][_0xa5b5('0x5c')]({'where':{'name':_0x465757,'userProfileId':_0x3e53d2['userProfileId']},'raw':!![]})['then'](function(_0x5de8e7){if(_0x5de8e7&&_0x5de8e7['autoAssociation']===0x0){return db['UserProfileResource'][_0xa5b5('0x5d')]({'name':_0x3f0e75['name'],'resourceId':_0x3f0e75['id'],'type':_0x5de8e7['name'],'sectionId':_0x5de8e7['id']},{})[_0xa5b5('0x1f')](function(){return _0x465d7b;});}else{return _0x465d7b;}})[_0xa5b5('0x29')](function(_0x301502){logger['error'](_0xa5b5('0x61'),_0x301502);throw _0x301502;});}return _0x465d7b;})[_0xa5b5('0x1f')](respondWithResult(_0x50eab9,0xc9))[_0xa5b5('0x29')](handleError(_0x50eab9,null));};exports[_0xa5b5('0x34')]=function(_0xdac569,_0x3378a0){if(_0xdac569[_0xa5b5('0x62')]['id']){delete _0xdac569[_0xa5b5('0x62')]['id'];}return db[_0xa5b5('0x53')][_0xa5b5('0x5c')]({'where':{'id':_0xdac569[_0xa5b5('0x59')]['id']},'include':[{'model':db[_0xa5b5('0x3c')],'as':_0xa5b5('0x5a')}]})[_0xa5b5('0x1f')](handleEntityNotFound(_0x3378a0,null))[_0xa5b5('0x1f')](saveUpdates(_0xdac569[_0xa5b5('0x62')],null))[_0xa5b5('0x1f')](respondWithResult(_0x3378a0,null))['catch'](handleError(_0x3378a0,null));};exports['destroy']=function(_0xf406af,_0x497e76){return db[_0xa5b5('0x53')][_0xa5b5('0x5c')]({'where':{'id':_0xf406af['params']['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x497e76,null))['then'](removeEntity(_0x497e76,null))[_0xa5b5('0x29')](handleError(_0x497e76,null));};exports[_0xa5b5('0x63')]=function(_0x378b0d,_0x2de221){return db[_0xa5b5('0x53')]['describe']()[_0xa5b5('0x1f')](respondWithResult(_0x2de221,null))[_0xa5b5('0x29')](handleError(_0x2de221,null));};exports[_0xa5b5('0x64')]=function(_0x234b08,_0x5b80fe,_0x258b6e){if(_0x234b08[_0xa5b5('0x62')]['id']){delete _0x234b08[_0xa5b5('0x62')]['id'];}return db['OpenchannelAccount'][_0xa5b5('0x5c')]({'where':{'id':_0x234b08['params']['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x5b80fe,null))[_0xa5b5('0x1f')](function(_0x36fa78){if(_0x36fa78){_0x234b08['body'][_0xa5b5('0x65')]=_0x36fa78['id'];return db[_0xa5b5('0x66')][_0xa5b5('0x5d')](_0x234b08[_0xa5b5('0x62')]);}})[_0xa5b5('0x1f')](respondWithResult(_0x5b80fe,null))['catch'](handleError(_0x5b80fe,null));};exports[_0xa5b5('0x67')]=function(_0xfd15a2,_0x56d65b,_0x49d726){var _0x54cbf4={'raw':![],'where':{}};var _0x170a97={};var _0x472155={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xa5b5('0x68')]({'where':{'id':_0xfd15a2[_0xa5b5('0x59')]['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x56d65b,null))['then'](function(_0x26180b){if(_0x26180b){_0x170a97[_0xa5b5('0x41')]=_[_0xa5b5('0x43')](db[_0xa5b5('0x66')][_0xa5b5('0x3e')]);_0x170a97['query']=_[_0xa5b5('0x43')](_0xfd15a2[_0xa5b5('0x42')]);_0x170a97[_0xa5b5('0x44')]=_[_0xa5b5('0x45')](_0x170a97[_0xa5b5('0x41')],_0x170a97[_0xa5b5('0x42')]);_0x54cbf4['attributes']=_[_0xa5b5('0x45')](_0x170a97[_0xa5b5('0x41')],qs[_0xa5b5('0x47')](_0xfd15a2[_0xa5b5('0x42')][_0xa5b5('0x47')]));_0x54cbf4[_0xa5b5('0x46')]=_0x54cbf4['attributes']['length']?_0x54cbf4[_0xa5b5('0x46')]:_0x170a97[_0xa5b5('0x41')];if(!_0xfd15a2[_0xa5b5('0x42')]['hasOwnProperty'](_0xa5b5('0x4a'))){_0x54cbf4[_0xa5b5('0x2e')]=qs[_0xa5b5('0x2e')](_0xfd15a2[_0xa5b5('0x42')][_0xa5b5('0x2e')]);_0x54cbf4[_0xa5b5('0x2d')]=qs[_0xa5b5('0x2d')](_0xfd15a2[_0xa5b5('0x42')][_0xa5b5('0x2d')]);}_0x54cbf4[_0xa5b5('0x4b')]=qs[_0xa5b5('0x4c')](_0xfd15a2[_0xa5b5('0x42')][_0xa5b5('0x4c')]);_0x54cbf4['where']=qs[_0xa5b5('0x44')](_[_0xa5b5('0x4e')](_0xfd15a2[_0xa5b5('0x42')],_0x170a97['filters']));_0x54cbf4[_0xa5b5('0x4d')][_0xa5b5('0x65')]=_0x26180b['id'];if(_0xfd15a2[_0xa5b5('0x42')][_0xa5b5('0x4f')]){_0x54cbf4['where']=_[_0xa5b5('0x50')](_0x54cbf4[_0xa5b5('0x4d')],{'$or':_[_0xa5b5('0x3d')](_0x54cbf4[_0xa5b5('0x46')],function(_0x192dca){var _0x22aa2e={};_0x22aa2e[_0x192dca]={'$like':'%'+_0xfd15a2[_0xa5b5('0x42')][_0xa5b5('0x4f')]+'%'};return _0x22aa2e;})});}_0x54cbf4=_[_0xa5b5('0x50')]({},_0x54cbf4,_0xfd15a2[_0xa5b5('0x5b')]);return db['Disposition'][_0xa5b5('0x30')]({'where':_0x54cbf4['where']})['then'](function(_0x460b23){_0x472155[_0xa5b5('0x30')]=_0x460b23;if(_0xfd15a2['query'][_0xa5b5('0x54')]){_0x54cbf4[_0xa5b5('0x55')]=[{'all':!![]}];}return db[_0xa5b5('0x66')][_0xa5b5('0x56')](_0x54cbf4);})['then'](function(_0x2fe371){_0x472155[_0xa5b5('0x57')]=_0x2fe371;return _0x472155;});}})[_0xa5b5('0x1f')](respondWithFilteredResult(_0x56d65b,_0x54cbf4))['catch'](handleError(_0x56d65b,null));};exports[_0xa5b5('0x69')]=function(_0x2c6f0b,_0x138455,_0x2132d4){return db['OpenchannelAccount'][_0xa5b5('0x5c')]({'where':{'id':_0x2c6f0b['params']['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x138455,null))[_0xa5b5('0x1f')](function(_0x571b93){if(_0x571b93){return _0x571b93[_0xa5b5('0x69')](_0x2c6f0b[_0xa5b5('0x42')]['ids']);}})[_0xa5b5('0x1f')](respondWithStatusCode(_0x138455,null))[_0xa5b5('0x29')](handleError(_0x138455,null));};exports[_0xa5b5('0x6a')]=function(_0x3ba461,_0x16b4ff,_0x238a0f){if(_0x3ba461[_0xa5b5('0x62')]['id']){delete _0x3ba461[_0xa5b5('0x62')]['id'];}return db[_0xa5b5('0x53')][_0xa5b5('0x5c')]({'where':{'id':_0x3ba461['params']['id']}})['then'](handleEntityNotFound(_0x16b4ff,null))['then'](function(_0x5e4d2c){if(_0x5e4d2c){_0x3ba461[_0xa5b5('0x62')][_0xa5b5('0x65')]=_0x5e4d2c['id'];return db[_0xa5b5('0x6b')][_0xa5b5('0x5d')](_0x3ba461['body']);}})[_0xa5b5('0x1f')](respondWithResult(_0x16b4ff,null))[_0xa5b5('0x29')](handleError(_0x16b4ff,null));};exports[_0xa5b5('0x6c')]=function(_0x4254c,_0x56cb66,_0xc6b9cd){var _0xdceb61={'raw':![],'where':{}};var _0x347715={};var _0xd9bc78={'count':0x0,'rows':[]};return db[_0xa5b5('0x53')][_0xa5b5('0x68')]({'where':{'id':_0x4254c[_0xa5b5('0x59')]['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x56cb66,null))[_0xa5b5('0x1f')](function(_0x139a70){if(_0x139a70){_0x347715['model']=_['keys'](db[_0xa5b5('0x6b')][_0xa5b5('0x3e')]);_0x347715['query']=_[_0xa5b5('0x43')](_0x4254c[_0xa5b5('0x42')]);_0x347715[_0xa5b5('0x44')]=_[_0xa5b5('0x45')](_0x347715[_0xa5b5('0x41')],_0x347715[_0xa5b5('0x42')]);_0xdceb61[_0xa5b5('0x46')]=_[_0xa5b5('0x45')](_0x347715[_0xa5b5('0x41')],qs['fields'](_0x4254c[_0xa5b5('0x42')][_0xa5b5('0x47')]));_0xdceb61[_0xa5b5('0x46')]=_0xdceb61[_0xa5b5('0x46')][_0xa5b5('0x48')]?_0xdceb61[_0xa5b5('0x46')]:_0x347715['model'];if(!_0x4254c['query'][_0xa5b5('0x49')](_0xa5b5('0x4a'))){_0xdceb61[_0xa5b5('0x2e')]=qs[_0xa5b5('0x2e')](_0x4254c[_0xa5b5('0x42')]['limit']);_0xdceb61[_0xa5b5('0x2d')]=qs[_0xa5b5('0x2d')](_0x4254c[_0xa5b5('0x42')][_0xa5b5('0x2d')]);}_0xdceb61[_0xa5b5('0x4b')]=qs[_0xa5b5('0x4c')](_0x4254c[_0xa5b5('0x42')][_0xa5b5('0x4c')]);_0xdceb61[_0xa5b5('0x4d')]=qs[_0xa5b5('0x44')](_[_0xa5b5('0x4e')](_0x4254c['query'],_0x347715['filters']));_0xdceb61['where'][_0xa5b5('0x65')]=_0x139a70['id'];if(_0x4254c['query'][_0xa5b5('0x4f')]){_0xdceb61['where']=_[_0xa5b5('0x50')](_0xdceb61[_0xa5b5('0x4d')],{'$or':_[_0xa5b5('0x3d')](_0xdceb61[_0xa5b5('0x46')],function(_0x3b0808){var _0x180d46={};_0x180d46[_0x3b0808]={'$like':'%'+_0x4254c[_0xa5b5('0x42')]['filter']+'%'};return _0x180d46;})});}_0xdceb61=_[_0xa5b5('0x50')]({},_0xdceb61,_0x4254c[_0xa5b5('0x5b')]);return db[_0xa5b5('0x6b')][_0xa5b5('0x30')]({'where':_0xdceb61[_0xa5b5('0x4d')]})['then'](function(_0x2e8049){_0xd9bc78[_0xa5b5('0x30')]=_0x2e8049;if(_0x4254c[_0xa5b5('0x42')][_0xa5b5('0x54')]){_0xdceb61['include']=[{'all':!![]}];}return db[_0xa5b5('0x6b')][_0xa5b5('0x56')](_0xdceb61);})['then'](function(_0x1deb2d){_0xd9bc78[_0xa5b5('0x57')]=_0x1deb2d;return _0xd9bc78;});}})['then'](respondWithFilteredResult(_0x56cb66,_0xdceb61))['catch'](handleError(_0x56cb66,null));};exports[_0xa5b5('0x6d')]=function(_0x271d25,_0x2afcd0,_0x5893b0){return db[_0xa5b5('0x53')][_0xa5b5('0x5c')]({'where':{'id':_0x271d25[_0xa5b5('0x59')]['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x2afcd0,null))[_0xa5b5('0x1f')](function(_0x4101f1){if(_0x4101f1){return _0x4101f1[_0xa5b5('0x6d')](_0x271d25[_0xa5b5('0x42')][_0xa5b5('0x6e')]);}})[_0xa5b5('0x1f')](respondWithStatusCode(_0x2afcd0,null))['catch'](handleError(_0x2afcd0,null));};exports[_0xa5b5('0x6f')]=function(_0x2faf91,_0x28547a,_0x82ca45){var _0x4738fc={'body':_0x2faf91['body'],'channel':_0xa5b5('0x70')};var _0x587fc7=[];var _0x277ebb=[];var _0x37d7e0={};var _0x429849=![];return db['CmContact'][_0xa5b5('0x63')]()[_0xa5b5('0x1f')](function(_0x174108){if(!_0x174108){throw new db[(_0xa5b5('0x71'))][(_0xa5b5('0x72'))]('no\x20available\x20attributes');}_0x587fc7=_[_0xa5b5('0x73')](_['keys'](_0x174108),['createdAt',_0xa5b5('0x74')]);_0x277ebb=_[_0xa5b5('0x73')](_[_0xa5b5('0x43')](_0x174108),['createdAt','updatedAt',_0xa5b5('0x75'),_0xa5b5('0x76')]);if(_0x2faf91[_0xa5b5('0x62')]['id']){delete _0x2faf91[_0xa5b5('0x62')]['id'];}if(_[_0xa5b5('0x77')](_0x2faf91['body'][_0xa5b5('0x78')])){throw new db[(_0xa5b5('0x71'))][(_0xa5b5('0x72'))](_0xa5b5('0x79'));}if(_['isNil'](_0x2faf91['body'][_0xa5b5('0x62')])||_0x2faf91['body']['body']===''){throw new db[(_0xa5b5('0x71'))][(_0xa5b5('0x72'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x2faf91['body'][_0xa5b5('0x7a')])){throw new db[(_0xa5b5('0x71'))][(_0xa5b5('0x72'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x277ebb);}if(!_[_0xa5b5('0x7b')](_0x277ebb,_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x7a')])){throw new db[(_0xa5b5('0x71'))]['ValidationError'](_0xa5b5('0x7c')+_0x277ebb);}_0x37d7e0[_0x2faf91['body'][_0xa5b5('0x7a')]]=_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x78')];})[_0xa5b5('0x1f')](function(){return db[_0xa5b5('0x53')]['find']({'where':{'id':_0x2faf91[_0xa5b5('0x59')]['id']},'include':[{'model':db[_0xa5b5('0x7d')],'as':_0xa5b5('0x7e'),'include':[{'model':db[_0xa5b5('0x7f')],'as':_0xa5b5('0x80'),'where':_0x37d7e0,'limit':0x1,'order':[[_0xa5b5('0x74'),_0xa5b5('0x81')]]}]},{'model':db[_0xa5b5('0x82')],'as':'Applications'}]});})[_0xa5b5('0x1f')](handleEntityNotFound(_0x28547a,null))[_0xa5b5('0x1f')](function(_0x3198db){if(_0x3198db&&_0x3198db[_0xa5b5('0x7e')]){_0x4738fc[_0xa5b5('0x83')]=_0x3198db;_0x4738fc['applications']=_0x3198db['Applications'];_0x4738fc[_0xa5b5('0x84')]=_0x3198db[_0xa5b5('0x7e')];_0x4738fc['applications']=_[_0xa5b5('0x85')](_0x4738fc[_0xa5b5('0x86')],[_0xa5b5('0x87')],[_0xa5b5('0x88')]);if(_0x4738fc[_0xa5b5('0x83')][_0xa5b5('0x89')]){delete _0x4738fc[_0xa5b5('0x83')][_0xa5b5('0x89')];}if(_0x4738fc['account'][_0xa5b5('0x7e')]&&_0x4738fc[_0xa5b5('0x83')][_0xa5b5('0x7e')][_0xa5b5('0x80')][_0xa5b5('0x48')]){return _0x4738fc[_0xa5b5('0x83')][_0xa5b5('0x7e')][_0xa5b5('0x80')][0x0];}var _0x23b8da=_[_0xa5b5('0x17')](_0x2faf91['body'],{'firstName':_0x2faf91[_0xa5b5('0x62')]['from'],'ListId':_0x3198db[_0xa5b5('0x76')]});_0x23b8da[_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x7a')]]=_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x78')];return db[_0xa5b5('0x7f')]['create'](_0x23b8da,{'fields':_0x587fc7,'raw':!![]});}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x28547a,null))[_0xa5b5('0x1f')](function(_0x46efee){_0x4738fc[_0xa5b5('0x8a')]=_0x46efee;if(_0x46efee){var _0x10e479={'ContactId':_0x46efee['id'],'OpenchannelAccountId':_0x2faf91[_0xa5b5('0x59')]['id'],'from':(_0x46efee[_0xa5b5('0x8b')]||'')+'\x20'+(_0x46efee['lastName']||'')};var _0x5c8361={'OpenchannelAccountId':_0x2faf91['params']['id'],'closed':![]};if(_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x8c')]){_0x5c8361[_0xa5b5('0x8c')]=_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x8c')];return db['OpenchannelInteraction'][_0xa5b5('0x5c')]({'where':_0x5c8361})[_0xa5b5('0x1f')](function(_0x510116){if(_0x510116){return[_0x510116,![]];}_0x10e479[_0xa5b5('0x8c')]=_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x8c')];_0x10e479[_0xa5b5('0x8d')]=_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x8d')];return db[_0xa5b5('0x8e')]['create'](_0x10e479)['then'](function(_0xe864e){return[_0xe864e,!![]];});});}else{_0x5c8361[_0xa5b5('0x8c')]=null;}_0x5c8361[_0xa5b5('0x8f')]=_0x46efee['id'];return db[_0xa5b5('0x8e')][_0xa5b5('0x5c')]({'where':_0x5c8361})[_0xa5b5('0x1f')](function(_0x1502b6){if(_0x1502b6){return[_0x1502b6,![]];}return db[_0xa5b5('0x8e')][_0xa5b5('0x5d')](_0x10e479)[_0xa5b5('0x1f')](function(_0x7b1996){return[_0x7b1996,!![]];});});}})[_0xa5b5('0x90')](function(_0x43c7f6,_0x3ad288){if(_0x43c7f6){_0x429849=_0x3ad288;if(!_0x3ad288){var _0x366490={'from':(_0x4738fc[_0xa5b5('0x8a')][_0xa5b5('0x8b')]||'')+'\x20'+(_0x4738fc['contact'][_0xa5b5('0x91')]||'')};if(_0x2faf91['body'][_0xa5b5('0x8c')]&&_0x2faf91['body'][_0xa5b5('0x92')]&&_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x8c')]!=_0x2faf91[_0xa5b5('0x62')]['messageId']){_0x366490[_0xa5b5('0x8c')]=_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x92')];}return _0x43c7f6[_0xa5b5('0x34')](_0x366490);}else{return _0x43c7f6;}}})[_0xa5b5('0x1f')](function(_0x271b20){_0x4738fc[_0xa5b5('0x93')]=_0x271b20[_0xa5b5('0x36')]({'plain':!![]});_0x4738fc[_0xa5b5('0x93')][_0xa5b5('0x94')]=_0x429849;if(_0x4738fc['interaction'][_0xa5b5('0x94')]){if(_0x4738fc[_0xa5b5('0x83')][_0xa5b5('0x95')]){_0x4738fc['applications']['push']({'id':0x0,'priority':_0x4738fc[_0xa5b5('0x86')][_0xa5b5('0x48')]+0x1,'app':_0xa5b5('0x96'),'appdata':'unmanaged','interval':_0xa5b5('0x97')});}}return db[_0xa5b5('0x98')][_0xa5b5('0x5d')]({'body':_0x2faf91['body']['body'],'OpenchannelAccountId':_0x2faf91[_0xa5b5('0x59')]['id'],'OpenchannelInteractionId':_0x271b20['id'],'direction':'in','ContactId':_0x4738fc['contact']['id'],'AttachmentId':_0x2faf91[_0xa5b5('0x62')][_0xa5b5('0x99')]});})[_0xa5b5('0x1f')](function(_0x5da81e){_0x4738fc[_0xa5b5('0x27')]=_0x5da81e;if(!_0x4738fc['interaction'][_0xa5b5('0x9a')])return;return db['User'][_0xa5b5('0x5c')]({'attributes':['id',_0xa5b5('0x39')],'where':{'id':_0x4738fc['interaction']['UserId']}});})[_0xa5b5('0x1f')](function(_0x13600e){if(_0x13600e){_0x4738fc['applications'][_0xa5b5('0x9b')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x13600e['name']+','+(_0x4738fc[_0xa5b5('0x83')][_0xa5b5('0x9c')]||0xa),'interval':_0xa5b5('0x97')});}if(!_0x4738fc[_0xa5b5('0x93')][_0xa5b5('0x9d')])return;return db[_0xa5b5('0x9e')][_0xa5b5('0x5c')]({'attributes':['id',_0xa5b5('0x39')],'where':{'id':_0x4738fc[_0xa5b5('0x93')][_0xa5b5('0x9d')]}});})['then'](function(_0x4de6ac){if(_0x4de6ac){_0x4738fc['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xa5b5('0x9f'),'appdata':_0x4de6ac[_0xa5b5('0x39')]+','+(_0x4738fc[_0xa5b5('0x83')][_0xa5b5('0xa0')]||0x12c),'interval':_0xa5b5('0x97')});}return respondWithRpcPromise(_0xa5b5('0xa1'),_0xa5b5('0xa2'),_0x4738fc);})['then'](function(_0x4e5055){respondWithRpcPromise(_0xa5b5('0xa3'),'EventManager',{'event':_0xa5b5('0x6f'),'message':_0x4e5055},client9002);return _0x4e5055;})[_0xa5b5('0x1f')](respondWithResult(_0x28547a,null))[_0xa5b5('0x29')](handleError(_0x28547a,null));};exports[_0xa5b5('0xa4')]=function(_0x2fdd04,_0x2d302d){var _0x2bbc4f=_0x2fdd04['params']['id'];var _0x504e0c=_0x2fdd04['body'];var _0x1f5278=0xc8;var _0x39b711=null;return db[_0xa5b5('0xa5')]['transaction']({'isolationLevel':db[_0xa5b5('0xa5')]['Transaction']['ISOLATION_LEVELS'][_0xa5b5('0xa6')]},function(_0x367d1b){return db['OpenchannelAccount'][_0xa5b5('0x68')]({'where':{'id':_0x2bbc4f},'transaction':_0x367d1b})[_0xa5b5('0x1f')](function(_0x2131e2){if(_0x2131e2){return db[_0xa5b5('0x82')][_0xa5b5('0x35')]({'where':{'OpenchannelAccountId':_0x2bbc4f},'transaction':_0x367d1b})[_0xa5b5('0x1f')](function(){var _0x344607=_[_0xa5b5('0x3d')](_0x504e0c,function(_0x17bfc3){_0x17bfc3[_0xa5b5('0x65')]=_0x2bbc4f;return _0x17bfc3;});return db['OpenchannelApplication'][_0xa5b5('0xa7')](_0x344607,{'transaction':_0x367d1b});});}else{_0x1f5278=0x194;_0x39b711=[];}});})[_0xa5b5('0x1f')](function(){if(_0x1f5278!==0x194){return db['OpenchannelApplication'][_0xa5b5('0xa8')]({'where':{'OpenchannelAccountId':_0x2bbc4f},'order':_0xa5b5('0x87')})['then'](function(_0xcbf5c6){_0x39b711=_0xcbf5c6;});}})[_0xa5b5('0x29')](function(_0x5e929e){_0x1f5278=0x1f4;logger[_0xa5b5('0x25')](_0x5e929e[_0xa5b5('0xa9')]);if(_0x5e929e[_0xa5b5('0x39')]){delete _0x5e929e['name'];}_0x39b711=_0x5e929e;})[_0xa5b5('0xaa')](function(){if(_0x39b711===null){_0x2d302d[_0xa5b5('0x38')](_0x1f5278);}else{if(_0x1f5278===0x1f4){_0x2d302d[_0xa5b5('0x2a')](_0x1f5278)[_0xa5b5('0x3a')](_0x39b711);}else{_0x2d302d['status'](_0x1f5278)[_0xa5b5('0x2c')](_0x39b711);}}});};exports[_0xa5b5('0xab')]=function(_0x3d309c,_0x56d386,_0x121327){var _0x20b6b3={};var _0x3be50c={};var _0x11e279;var _0x288bf7;return db['OpenchannelAccount'][_0xa5b5('0x68')]({'where':{'id':_0x3d309c[_0xa5b5('0x59')]['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x56d386,null))[_0xa5b5('0x1f')](function(_0x29f4d9){if(_0x29f4d9){_0x11e279=_0x29f4d9;_0x3be50c[_0xa5b5('0x41')]=_['keys'](db['OpenchannelApplication'][_0xa5b5('0x3e')]);_0x3be50c[_0xa5b5('0x42')]=_['keys'](_0x3d309c[_0xa5b5('0x42')]);_0x3be50c[_0xa5b5('0x44')]=_[_0xa5b5('0x45')](_0x3be50c[_0xa5b5('0x41')],_0x3be50c[_0xa5b5('0x42')]);_0x20b6b3['attributes']=_['intersection'](_0x3be50c[_0xa5b5('0x41')],qs[_0xa5b5('0x47')](_0x3d309c['query'][_0xa5b5('0x47')]));_0x20b6b3[_0xa5b5('0x46')]=_0x20b6b3[_0xa5b5('0x46')]['length']?_0x20b6b3[_0xa5b5('0x46')]:_0x3be50c['model'];_0x20b6b3[_0xa5b5('0x4b')]=qs[_0xa5b5('0x4c')](_0x3d309c[_0xa5b5('0x42')][_0xa5b5('0x4c')]);_0x20b6b3[_0xa5b5('0x4d')]=qs[_0xa5b5('0x44')](_[_0xa5b5('0x4e')](_0x3d309c['query'],_0x3be50c['filters']));if(_0x3d309c[_0xa5b5('0x42')]['filter']){_0x20b6b3[_0xa5b5('0x4d')]=_[_0xa5b5('0x50')](_0x20b6b3[_0xa5b5('0x4d')],{'$or':_[_0xa5b5('0x3d')](_0x20b6b3[_0xa5b5('0x46')],function(_0x598020){var _0x4ed60c={};_0x4ed60c[_0x598020]={'$like':'%'+_0x3d309c[_0xa5b5('0x42')]['filter']+'%'};return _0x4ed60c;})});}_0x20b6b3=_[_0xa5b5('0x50')]({},_0x20b6b3,_0x3d309c[_0xa5b5('0x5b')]);return _0x11e279[_0xa5b5('0xab')](_0x20b6b3);}})['then'](function(_0x525f16){if(_0x525f16){_0x288bf7=_0x525f16[_0xa5b5('0x48')];if(!_0x3d309c['query'][_0xa5b5('0x49')](_0xa5b5('0x4a'))){_0x20b6b3[_0xa5b5('0x2e')]=qs['limit'](_0x3d309c[_0xa5b5('0x42')]['limit']);_0x20b6b3['offset']=qs['offset'](_0x3d309c[_0xa5b5('0x42')][_0xa5b5('0x2d')]);}return _0x11e279[_0xa5b5('0xab')](_0x20b6b3);}})[_0xa5b5('0x1f')](function(_0xc22d3c){if(_0xc22d3c){return _0xc22d3c?{'count':_0x288bf7,'rows':_0xc22d3c}:null;}})[_0xa5b5('0x1f')](respondWithResult(_0x56d386,null))[_0xa5b5('0x29')](handleError(_0x56d386,null));};exports[_0xa5b5('0xac')]=function(_0x5ec6d2,_0x2d4054,_0x2ae96a){var _0x83c10d={'raw':![],'where':{}};var _0x2dc44a={};var _0x21e2eb={'count':0x0,'rows':[]};return db[_0xa5b5('0x53')][_0xa5b5('0x68')]({'where':{'id':_0x5ec6d2[_0xa5b5('0x59')]['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x2d4054,null))[_0xa5b5('0x1f')](function(_0x4b31f7){if(_0x4b31f7){_0x2dc44a[_0xa5b5('0x41')]=_[_0xa5b5('0x43')](db[_0xa5b5('0x8e')][_0xa5b5('0x3e')]);_0x2dc44a[_0xa5b5('0x42')]=_[_0xa5b5('0x43')](_0x5ec6d2[_0xa5b5('0x42')]);_0x2dc44a[_0xa5b5('0x44')]=_['intersection'](_0x2dc44a[_0xa5b5('0x41')],_0x2dc44a['query']);_0x83c10d['attributes']=_['intersection'](_0x2dc44a[_0xa5b5('0x41')],qs[_0xa5b5('0x47')](_0x5ec6d2['query']['fields']));_0x83c10d[_0xa5b5('0x46')]=_0x83c10d['attributes'][_0xa5b5('0x48')]?_0x83c10d['attributes']:_0x2dc44a[_0xa5b5('0x41')];if(!_0x5ec6d2[_0xa5b5('0x42')][_0xa5b5('0x49')](_0xa5b5('0x4a'))){_0x83c10d[_0xa5b5('0x2e')]=qs['limit'](_0x5ec6d2[_0xa5b5('0x42')][_0xa5b5('0x2e')]);_0x83c10d[_0xa5b5('0x2d')]=qs['offset'](_0x5ec6d2[_0xa5b5('0x42')][_0xa5b5('0x2d')]);}_0x83c10d[_0xa5b5('0x4b')]=qs[_0xa5b5('0x4c')](_0x5ec6d2[_0xa5b5('0x42')][_0xa5b5('0x4c')]);_0x83c10d[_0xa5b5('0x4d')]=qs['filters'](_[_0xa5b5('0x4e')](_0x5ec6d2['query'],_0x2dc44a[_0xa5b5('0x44')]));_0x83c10d[_0xa5b5('0x4d')][_0xa5b5('0x65')]=_0x4b31f7['id'];if(_0x5ec6d2[_0xa5b5('0x42')]['filter']){_0x83c10d['where']=_[_0xa5b5('0x50')](_0x83c10d[_0xa5b5('0x4d')],{'$or':_['map'](_0x83c10d[_0xa5b5('0x46')],function(_0xa355af){var _0xd91a2e={};_0xd91a2e[_0xa355af]={'$like':'%'+_0x5ec6d2['query']['filter']+'%'};return _0xd91a2e;})});}_0x83c10d=_[_0xa5b5('0x50')]({},_0x83c10d,_0x5ec6d2[_0xa5b5('0x5b')]);return db['OpenchannelInteraction'][_0xa5b5('0x30')]({'where':_0x83c10d[_0xa5b5('0x4d')]})[_0xa5b5('0x1f')](function(_0x1efdcf){_0x21e2eb[_0xa5b5('0x30')]=_0x1efdcf;if(_0x5ec6d2[_0xa5b5('0x42')][_0xa5b5('0x54')]){_0x83c10d[_0xa5b5('0x55')]=[{'model':db[_0xa5b5('0x7f')],'as':_0xa5b5('0xad'),'required':![]},{'model':db[_0xa5b5('0xae')],'as':_0xa5b5('0xaf'),'attributes':[_0xa5b5('0x39'),_0xa5b5('0xb0'),_0xa5b5('0xb1')],'required':![]},{'model':db[_0xa5b5('0xb2')],'as':_0xa5b5('0xb3'),'attributes':['id',_0xa5b5('0x39'),_0xa5b5('0xb4')],'where':_0x5ec6d2[_0xa5b5('0x42')][_0xa5b5('0xb5')]?{'id':_0x5ec6d2[_0xa5b5('0x42')][_0xa5b5('0xb5')]}:undefined,'required':_0x5ec6d2[_0xa5b5('0x42')]['tag']?!![]:![]}];}return db[_0xa5b5('0x8e')]['findAll'](_0x83c10d);})['then'](function(_0x12cc12){_0x21e2eb[_0xa5b5('0x57')]=_0x12cc12;return _0x21e2eb;});}})[_0xa5b5('0x1f')](respondWithFilteredResult(_0x2d4054,_0x83c10d))[_0xa5b5('0x29')](handleError(_0x2d4054,null));};exports[_0xa5b5('0xb6')]=function(_0x403a96,_0x78874,_0x34f8f0){return db[_0xa5b5('0x53')][_0xa5b5('0x5c')]({'where':{'id':_0x403a96['params']['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x78874,null))[_0xa5b5('0x1f')](function(_0x1fc6fd){if(_0x1fc6fd){return _0x1fc6fd[_0xa5b5('0xb6')](_0x403a96[_0xa5b5('0x62')][_0xa5b5('0x6e')],_[_0xa5b5('0xb7')](_0x403a96[_0xa5b5('0x62')],['ids','id'])||{})['spread'](function(_0x5755ac){for(var _0x4b45e0=0x0;_0x4b45e0<_0x403a96['body'][_0xa5b5('0x6e')]['length'];_0x4b45e0+=0x1){socket['emit'](_0xa5b5('0xb8'),{'UserId':Number(_0x403a96[_0xa5b5('0x62')][_0xa5b5('0x6e')][_0x4b45e0]),'OpenchannelAccountId':Number(_0x403a96[_0xa5b5('0x59')]['id'])});}return _0x5755ac;});}})[_0xa5b5('0x1f')](respondWithResult(_0x78874,null))[_0xa5b5('0x29')](handleError(_0x78874,null));};exports[_0xa5b5('0xb9')]=function(_0x434bdb,_0x477617,_0x309d16){return db['OpenchannelAccount'][_0xa5b5('0x5c')]({'where':{'id':_0x434bdb[_0xa5b5('0x59')]['id']}})['then'](handleEntityNotFound(_0x477617,null))[_0xa5b5('0x1f')](function(_0xc84d25){if(_0xc84d25){return _0xc84d25[_0xa5b5('0xb9')](_0x434bdb[_0xa5b5('0x42')][_0xa5b5('0x6e')])[_0xa5b5('0x1f')](function(){if(_[_0xa5b5('0xba')](_0x434bdb[_0xa5b5('0x42')]['ids'])){for(var _0x5e1bcd=0x0;_0x5e1bcd<_0x434bdb[_0xa5b5('0x42')][_0xa5b5('0x6e')]['length'];_0x5e1bcd+=0x1){socket[_0xa5b5('0xbb')](_0xa5b5('0xbc'),{'UserId':Number(_0x434bdb[_0xa5b5('0x42')][_0xa5b5('0x6e')][_0x5e1bcd]),'OpenchannelAccountId':Number(_0x434bdb[_0xa5b5('0x59')]['id'])});}}else{socket[_0xa5b5('0xbb')](_0xa5b5('0xbc'),{'UserId':Number(_0x434bdb['query'][_0xa5b5('0x6e')]),'OpenchannelAccountId':Number(_0x434bdb[_0xa5b5('0x59')]['id'])});}});}})[_0xa5b5('0x1f')](respondWithStatusCode(_0x477617,null))[_0xa5b5('0x29')](handleError(_0x477617,null));};exports['getAgents']=function(_0x3d0def,_0x538dcf,_0x4e2dcb){var _0x3c8de0={};var _0xa1dad5={};var _0x2202a2;var _0x8c933;return db[_0xa5b5('0x53')][_0xa5b5('0x68')]({'where':{'id':_0x3d0def[_0xa5b5('0x59')]['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x538dcf,null))['then'](function(_0x51e509){if(_0x51e509){_0x2202a2=_0x51e509;_0xa1dad5['model']=_[_0xa5b5('0x43')](db[_0xa5b5('0xae')]['rawAttributes']);_0xa1dad5['query']=_[_0xa5b5('0x43')](_0x3d0def[_0xa5b5('0x42')]);_0xa1dad5[_0xa5b5('0x44')]=_[_0xa5b5('0x45')](_0xa1dad5[_0xa5b5('0x41')],_0xa1dad5[_0xa5b5('0x42')]);_0x3c8de0[_0xa5b5('0x46')]=_['intersection'](_0xa1dad5[_0xa5b5('0x41')],qs[_0xa5b5('0x47')](_0x3d0def[_0xa5b5('0x42')][_0xa5b5('0x47')]));_0x3c8de0['attributes']=_0x3c8de0['attributes'][_0xa5b5('0x48')]?_0x3c8de0['attributes']:_0xa1dad5['model'];_0x3c8de0['order']=qs[_0xa5b5('0x4c')](_0x3d0def['query']['sort']);_0x3c8de0[_0xa5b5('0x4d')]=qs[_0xa5b5('0x44')](_[_0xa5b5('0x4e')](_0x3d0def[_0xa5b5('0x42')],_0xa1dad5[_0xa5b5('0x44')]));if(_0x3d0def[_0xa5b5('0x42')]['filter']){_0x3c8de0[_0xa5b5('0x4d')]=_['merge'](_0x3c8de0[_0xa5b5('0x4d')],{'$or':_['map'](_0x3c8de0['attributes'],function(_0x1cd634){var _0x2279de={};_0x2279de[_0x1cd634]={'$like':'%'+_0x3d0def[_0xa5b5('0x42')]['filter']+'%'};return _0x2279de;})});}_0x3c8de0=_[_0xa5b5('0x50')]({},_0x3c8de0,_0x3d0def['options']);return _0x2202a2[_0xa5b5('0xbd')](_0x3c8de0);}})[_0xa5b5('0x1f')](function(_0x17a55f){if(_0x17a55f){_0x8c933=_0x17a55f['length'];if(!_0x3d0def[_0xa5b5('0x42')][_0xa5b5('0x49')](_0xa5b5('0x4a'))){_0x3c8de0[_0xa5b5('0x2e')]=qs[_0xa5b5('0x2e')](_0x3d0def['query'][_0xa5b5('0x2e')]);_0x3c8de0[_0xa5b5('0x2d')]=qs[_0xa5b5('0x2d')](_0x3d0def['query'][_0xa5b5('0x2d')]);}return _0x2202a2['getAgents'](_0x3c8de0);}})['then'](function(_0x1def89){if(_0x1def89){return _0x1def89?{'count':_0x8c933,'rows':_0x1def89}:null;}})[_0xa5b5('0x1f')](respondWithResult(_0x538dcf,null))[_0xa5b5('0x29')](handleError(_0x538dcf,null));};exports[_0xa5b5('0x3a')]=function(_0x3edc5e,_0x4d4058,_0x2d4ad8){var _0x321aab,_0x3be194,_0x3e0a8b;if(_['isNil'](_0x3edc5e[_0xa5b5('0x62')][_0xa5b5('0x62')])||_0x3edc5e['body'][_0xa5b5('0x62')]===''){throw new db[(_0xa5b5('0x71'))][(_0xa5b5('0x72'))](_0xa5b5('0xbe'));}if(_[_0xa5b5('0x77')](_0x3edc5e[_0xa5b5('0x62')]['to'])){}_0x321aab=_0x3edc5e[_0xa5b5('0x62')]['to'];return db[_0xa5b5('0x53')]['findOne']({'where':{'id':_0x3edc5e[_0xa5b5('0x59')]['id']}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x4d4058,null))[_0xa5b5('0x1f')](function(_0x2c16d){if(_0x2c16d){return db['OpenchannelAccount'][_0xa5b5('0x5c')]({'where':{'id':_0x2c16d['id']},'include':[{'model':db[_0xa5b5('0x7d')],'as':_0xa5b5('0x7e'),'include':[{'model':db[_0xa5b5('0x7f')],'as':_0xa5b5('0x80'),'where':{[_0x2c16d['mapKey']]:_0x321aab},'limit':0x1,'order':[[_0xa5b5('0x74'),'DESC']]}]}]})[_0xa5b5('0x1f')](handleEntityNotFound(_0x4d4058,null))[_0xa5b5('0x1f')](function(_0x28a3fb){if(_0x28a3fb&&_0x28a3fb[_0xa5b5('0x7e')]){_0x3be194=_0x28a3fb['get']({'plain':!![]});if(_0x3be194[_0xa5b5('0x7e')]&&_0x3be194[_0xa5b5('0x7e')]['Contacts'][_0xa5b5('0x48')]){return _0x3be194[_0xa5b5('0x7e')][_0xa5b5('0x80')][0x0];}return db[_0xa5b5('0x7f')][_0xa5b5('0x5d')](_[_0xa5b5('0x17')](_0x3edc5e[_0xa5b5('0x62')],{'firstName':_0x321aab,[_0x28a3fb['mapKey']]:_0x321aab,'phone':_0x321aab,'ListId':_0x3be194[_0xa5b5('0x76')]}));}})[_0xa5b5('0x1f')](handleEntityNotFound(_0x4d4058,null))[_0xa5b5('0x1f')](function(_0x37e7cb){if(_0x37e7cb){_0x3e0a8b=_0x37e7cb;return db['OpenchannelInteraction']['find']({'where':{'ContactId':_0x3e0a8b['id'],'closed':![],'OpenchannelAccountId':_0x3be194['id']}})[_0xa5b5('0x1f')](function(_0x2b9a81){if(_0x2b9a81){return[_0x2b9a81,![]];}return db[_0xa5b5('0x8e')][_0xa5b5('0x5d')]({'UserId':_0x3edc5e['user']['id'],'ContactId':_0x3e0a8b['id'],'OpenchannelAccountId':_0x3be194['id'],'lastMsgDirection':_0xa5b5('0xbf'),'firstMsgDirection':'out','Messages':[_['merge'](_0x3edc5e[_0xa5b5('0x62')],{'read':![],'body':_0x3edc5e['body'][_0xa5b5('0x62')],'OpenchannelAccountId':_0x3be194['id'],'UserId':_0x3edc5e[_0xa5b5('0xc0')]['id'],'ContactId':_0x3e0a8b['id']})]},{'include':[{'model':db[_0xa5b5('0x98')],'as':_0xa5b5('0xc1')}]})[_0xa5b5('0x1f')](function(_0x2f90c5){return[_0x2f90c5,!![]];});});}})[_0xa5b5('0x90')](function(_0xa5f641,_0x19c0a6){if(_0x19c0a6){return _0xa5f641;}return db[_0xa5b5('0x98')][_0xa5b5('0x5d')](_['merge'](_0x3edc5e['body'],{'read':![],'body':_0x3edc5e['body'][_0xa5b5('0x62')],'OpenchannelAccountId':_0x3be194['id'],'OpenchannelInteractionId':_0xa5f641['id'],'UserId':_0x3edc5e[_0xa5b5('0xc0')]['id'],'ContactId':_0x3e0a8b['id']}))[_0xa5b5('0x1f')](function(_0x3b9fb1){_0xa5f641[_0xa5b5('0xc2')][_0xa5b5('0xc1')]=[];_0xa5f641[_0xa5b5('0xc2')]['Messages'][_0xa5b5('0xc3')](_0x3b9fb1[_0xa5b5('0xc2')]);return _0xa5f641;});});}})[_0xa5b5('0x1f')](respondWithResult(_0x4d4058,null))[_0xa5b5('0x29')](handleError(_0x4d4058,null));};
\ No newline at end of file
+var _0x1da9=['get','OpenchannelAccounts','end','name','send','index','map','OpenchannelAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','include','findAll','rows','show','Pause','mandatoryDispositionPause','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelAccountId','Disposition','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','ListId','isNil','from','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','Applications','account','applications','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','autoclose','push','close','OpenchannelMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','stack','json','getApplications','Contact','fullname','internal','Tag','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy'];(function(_0x13c4f8,_0x433521){var _0x5a8f4b=function(_0x1df845){while(--_0x1df845){_0x13c4f8['push'](_0x13c4f8['shift']());}};_0x5a8f4b(++_0x433521);}(_0x1da9,0x141));var _0x91da=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x1da9[_0x4cf98e];return _0x1623ac;};'use strict';var emlformat=require(_0x91da('0x0'));var rimraf=require(_0x91da('0x1'));var zipdir=require(_0x91da('0x2'));var jsonpatch=require(_0x91da('0x3'));var rp=require(_0x91da('0x4'));var moment=require(_0x91da('0x5'));var BPromise=require(_0x91da('0x6'));var Mustache=require(_0x91da('0x7'));var util=require(_0x91da('0x8'));var path=require(_0x91da('0x9'));var sox=require(_0x91da('0xa'));var csv=require(_0x91da('0xb'));var ejs=require(_0x91da('0xc'));var fs=require('fs');var fs_extra=require(_0x91da('0xd'));var _=require(_0x91da('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x91da('0xf'));var deskjs=require(_0x91da('0x10'));var toCsv=require(_0x91da('0xb'));var querystring=require('querystring');var Papa=require(_0x91da('0x11'));var Redis=require(_0x91da('0x12'));var authService=require(_0x91da('0x13'));var qs=require(_0x91da('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91da('0x15'));var logger=require(_0x91da('0x16'))('api');var utils=require(_0x91da('0x17'));var config=require(_0x91da('0x18'));var licenseUtil=require(_0x91da('0x19'));var db=require(_0x91da('0x1a'))['db'];config[_0x91da('0x1b')]=_[_0x91da('0x1c')](config[_0x91da('0x1b')],{'host':_0x91da('0x1d'),'port':0x18eb});var socket=require(_0x91da('0x1e'))(new Redis(config[_0x91da('0x1b')]));require('./openchannelAccount.socket')[_0x91da('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x91da('0x20')][_0x91da('0x21')]({'port':0x232c});var client9002=jayson['client'][_0x91da('0x21')]({'port':0x232a});function respondWithRpcPromise(_0xc1e865,_0x36c0c9,_0x404abe,_0x3a9044){return new BPromise(function(_0x40dd9f,_0x3c2593){var _0xde7544=_0x3a9044||client;return _0xde7544[_0x91da('0x22')](_0xc1e865,_0x404abe)[_0x91da('0x23')](function(_0xe024bd){logger[_0x91da('0x24')](_0x91da('0x25'),_0x36c0c9,_0x91da('0x26'));logger[_0x91da('0x27')](_0x91da('0x28'),_0x36c0c9,'request\x20sent',JSON[_0x91da('0x29')](_0xe024bd));if(_0xe024bd[_0x91da('0x2a')]){if(_0xe024bd['error'][_0x91da('0x2b')]===0x1f4){logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0xe024bd['error'][_0x91da('0x2c')]);return _0x3c2593(_0xe024bd[_0x91da('0x2a')][_0x91da('0x2c')]);}logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0xe024bd['error'][_0x91da('0x2c')]);return _0x40dd9f(_0xe024bd[_0x91da('0x2a')][_0x91da('0x2c')]);}else{logger[_0x91da('0x24')](_0x91da('0x25'),_0x36c0c9,_0x91da('0x26'));_0x40dd9f(_0xe024bd[_0x91da('0x2d')][_0x91da('0x2c')]);}})[_0x91da('0x2e')](function(_0x263463){logger[_0x91da('0x2a')](_0x91da('0x25'),_0x36c0c9,_0x263463);_0x3c2593(_0x263463);});});}function respondWithStatusCode(_0x3deb73,_0x1a9b87){_0x1a9b87=_0x1a9b87||0xcc;return function(_0x4269f2){if(_0x4269f2){return _0x3deb73[_0x91da('0x2f')](_0x1a9b87);}return _0x3deb73[_0x91da('0x30')](_0x1a9b87)['end']();};}function respondWithResult(_0x275d54,_0x572320){_0x572320=_0x572320||0xc8;return function(_0x2afa22){if(_0x2afa22){return _0x275d54['status'](_0x572320)['json'](_0x2afa22);}};}function respondWithFilteredResult(_0x3d37c4,_0x274c82){return function(_0x74a4cf){if(_0x74a4cf){var _0x5ebd61=typeof _0x274c82[_0x91da('0x31')]===_0x91da('0x32')&&typeof _0x274c82[_0x91da('0x33')]===_0x91da('0x32');var _0x15c96c=_0x74a4cf['count'];var _0x51968d=_0x5ebd61?0x0:_0x274c82[_0x91da('0x31')];var _0x304b3c=_0x5ebd61?_0x74a4cf[_0x91da('0x34')]:_0x274c82[_0x91da('0x31')]+_0x274c82[_0x91da('0x33')];var _0x5d1faa;if(_0x304b3c>=_0x15c96c){_0x304b3c=_0x15c96c;_0x5d1faa=0xc8;}else{_0x5d1faa=0xce;}_0x3d37c4[_0x91da('0x30')](_0x5d1faa);return _0x3d37c4[_0x91da('0x35')](_0x91da('0x36'),_0x51968d+'-'+_0x304b3c+'/'+_0x15c96c)['json'](_0x74a4cf);}return null;};}function patchUpdates(_0x466b67){return function(_0x13d7af){try{jsonpatch['apply'](_0x13d7af,_0x466b67,!![]);}catch(_0x5e9adb){return BPromise[_0x91da('0x37')](_0x5e9adb);}return _0x13d7af[_0x91da('0x38')]();};}function saveUpdates(_0x41a0a5,_0x367c42){return function(_0x3e3268){if(_0x3e3268){return _0x3e3268[_0x91da('0x39')](_0x41a0a5)['then'](function(_0x175384){return _0x175384;});}return null;};}function removeEntity(_0x96b8da,_0x425e9d){return function(_0x29597f){if(_0x29597f){return _0x29597f[_0x91da('0x3a')]()[_0x91da('0x23')](function(){var _0x1e88a7=_0x29597f[_0x91da('0x3b')]({'plain':!![]});var _0x77a081=_0x91da('0x3c');return db['UserProfileResource'][_0x91da('0x3a')]({'where':{'type':_0x77a081,'resourceId':_0x1e88a7['id']}})[_0x91da('0x23')](function(){return _0x29597f;});})[_0x91da('0x23')](function(){_0x96b8da[_0x91da('0x30')](0xcc)[_0x91da('0x3d')]();});}};}function handleEntityNotFound(_0x375ef0,_0x48657c){return function(_0x4e2d85){if(!_0x4e2d85){_0x375ef0[_0x91da('0x2f')](0x194);}return _0x4e2d85;};}function handleError(_0x132dfb,_0x61ed93){_0x61ed93=_0x61ed93||0x1f4;return function(_0xc94277){logger[_0x91da('0x2a')](_0xc94277['stack']);if(_0xc94277[_0x91da('0x3e')]){delete _0xc94277[_0x91da('0x3e')];}_0x132dfb[_0x91da('0x30')](_0x61ed93)[_0x91da('0x3f')](_0xc94277);};}exports[_0x91da('0x40')]=function(_0x15253a,_0x264356){var _0x370330={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x238ad2={},_0x2f5bb4={'count':0x0,'rows':[]};var _0x163870=_[_0x91da('0x41')](db[_0x91da('0x42')][_0x91da('0x43')],function(_0x3b12bb){return{'name':_0x3b12bb[_0x91da('0x44')],'type':_0x3b12bb[_0x91da('0x45')]['key']};});_0x238ad2[_0x91da('0x46')]=_[_0x91da('0x41')](_0x163870,_0x91da('0x3e'));_0x238ad2['query']=_[_0x91da('0x47')](_0x15253a[_0x91da('0x48')]);_0x238ad2[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x238ad2[_0x91da('0x46')],_0x238ad2[_0x91da('0x48')]);_0x370330['attributes']=_[_0x91da('0x4a')](_0x238ad2[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x15253a[_0x91da('0x48')][_0x91da('0x4b')]));_0x370330[_0x91da('0x4c')]=_0x370330['attributes'][_0x91da('0x4d')]?_0x370330[_0x91da('0x4c')]:_0x238ad2[_0x91da('0x46')];if(!_0x15253a[_0x91da('0x48')][_0x91da('0x4e')]('nolimit')){_0x370330['limit']=qs['limit'](_0x15253a[_0x91da('0x48')][_0x91da('0x33')]);_0x370330[_0x91da('0x31')]=qs[_0x91da('0x31')](_0x15253a[_0x91da('0x48')][_0x91da('0x31')]);}_0x370330[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x15253a[_0x91da('0x48')]['sort']);_0x370330[_0x91da('0x51')]=qs[_0x91da('0x49')](_[_0x91da('0x52')](_0x15253a['query'],_0x238ad2['filters']),_0x163870);if(_0x15253a[_0x91da('0x48')][_0x91da('0x53')]){_0x370330[_0x91da('0x51')]=_[_0x91da('0x54')](_0x370330[_0x91da('0x51')],{'$or':_['map'](_0x163870,function(_0x1ef97e){if(_0x1ef97e[_0x91da('0x45')]!=='VIRTUAL'){var _0x3e6ad2={};_0x3e6ad2[_0x1ef97e['name']]={'$like':'%'+_0x15253a[_0x91da('0x48')][_0x91da('0x53')]+'%'};return _0x3e6ad2;}})});}_0x370330=_[_0x91da('0x54')]({},_0x370330,_0x15253a['options']);var _0x12da71={'where':_0x370330[_0x91da('0x51')]};return db[_0x91da('0x42')][_0x91da('0x34')](_0x12da71)['then'](function(_0x4287e5){_0x2f5bb4[_0x91da('0x34')]=_0x4287e5;if(_0x15253a['query']['includeAll']){_0x370330[_0x91da('0x55')]=[{'all':!![]}];}return db[_0x91da('0x42')][_0x91da('0x56')](_0x370330);})[_0x91da('0x23')](function(_0x273456){_0x2f5bb4[_0x91da('0x57')]=_0x273456;return _0x2f5bb4;})['then'](respondWithFilteredResult(_0x264356,_0x370330))[_0x91da('0x2e')](handleError(_0x264356,null));};exports[_0x91da('0x58')]=function(_0x1a19ef,_0x5ced50){var _0x18707b={'raw':![],'where':{'id':_0x1a19ef['params']['id']},'include':[{'model':db[_0x91da('0x59')],'as':_0x91da('0x5a')}]},_0x39637a={};_0x39637a[_0x91da('0x46')]=_[_0x91da('0x47')](db[_0x91da('0x42')][_0x91da('0x43')]);_0x39637a[_0x91da('0x48')]=_['keys'](_0x1a19ef[_0x91da('0x48')]);_0x39637a['filters']=_[_0x91da('0x4a')](_0x39637a[_0x91da('0x46')],_0x39637a[_0x91da('0x48')]);_0x18707b[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x39637a[_0x91da('0x46')],qs['fields'](_0x1a19ef['query'][_0x91da('0x4b')]));_0x18707b[_0x91da('0x4c')]=_0x18707b[_0x91da('0x4c')][_0x91da('0x4d')]?_0x18707b[_0x91da('0x4c')]:_0x39637a['model'];if(_0x1a19ef[_0x91da('0x48')][_0x91da('0x5b')]){_0x18707b[_0x91da('0x55')]=[{'all':!![]}];}_0x18707b=_[_0x91da('0x54')]({},_0x18707b,_0x1a19ef[_0x91da('0x5c')]);return db[_0x91da('0x42')][_0x91da('0x5d')](_0x18707b)['then'](handleEntityNotFound(_0x5ced50,null))[_0x91da('0x23')](respondWithResult(_0x5ced50,null))[_0x91da('0x2e')](handleError(_0x5ced50,null));};exports['create']=function(_0x4c5111,_0x3b04cc){return db[_0x91da('0x42')][_0x91da('0x5e')](_0x4c5111[_0x91da('0x5f')],{})[_0x91da('0x23')](function(_0x45b17d){var _0x2b6f9d=_0x4c5111[_0x91da('0x60')][_0x91da('0x3b')]({'plain':!![]});if(!_0x2b6f9d)throw new Error(_0x91da('0x61'));if(_0x2b6f9d[_0x91da('0x62')]===_0x91da('0x60')){var _0x170c71=_0x45b17d[_0x91da('0x3b')]({'plain':!![]});var _0x455c96='OpenchannelAccounts';return db[_0x91da('0x63')][_0x91da('0x5d')]({'where':{'name':_0x455c96,'userProfileId':_0x2b6f9d[_0x91da('0x64')]},'raw':!![]})[_0x91da('0x23')](function(_0x5efde5){if(_0x5efde5&&_0x5efde5['autoAssociation']===0x0){return db['UserProfileResource'][_0x91da('0x5e')]({'name':_0x170c71['name'],'resourceId':_0x170c71['id'],'type':_0x5efde5['name'],'sectionId':_0x5efde5['id']},{})['then'](function(){return _0x45b17d;});}else{return _0x45b17d;}})[_0x91da('0x2e')](function(_0x6354fd){logger[_0x91da('0x2a')](_0x91da('0x65'),_0x6354fd);throw _0x6354fd;});}return _0x45b17d;})['then'](respondWithResult(_0x3b04cc,0xc9))[_0x91da('0x2e')](handleError(_0x3b04cc,null));};exports[_0x91da('0x39')]=function(_0x9cb767,_0xa9a7a9){if(_0x9cb767[_0x91da('0x5f')]['id']){delete _0x9cb767[_0x91da('0x5f')]['id'];}return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x9cb767[_0x91da('0x66')]['id']},'include':[{'model':db[_0x91da('0x59')],'as':_0x91da('0x5a')}]})[_0x91da('0x23')](handleEntityNotFound(_0xa9a7a9,null))[_0x91da('0x23')](saveUpdates(_0x9cb767['body'],null))[_0x91da('0x23')](respondWithResult(_0xa9a7a9,null))[_0x91da('0x2e')](handleError(_0xa9a7a9,null));};exports[_0x91da('0x3a')]=function(_0x4a4d9b,_0x47a8e8){return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x4a4d9b[_0x91da('0x66')]['id']}})['then'](handleEntityNotFound(_0x47a8e8,null))[_0x91da('0x23')](removeEntity(_0x47a8e8,null))[_0x91da('0x2e')](handleError(_0x47a8e8,null));};exports[_0x91da('0x67')]=function(_0x56bebf,_0x2de14d){return db[_0x91da('0x42')]['describe']()[_0x91da('0x23')](respondWithResult(_0x2de14d,null))['catch'](handleError(_0x2de14d,null));};exports['addDisposition']=function(_0x5d60d9,_0x44b99b,_0x547bb0){if(_0x5d60d9[_0x91da('0x5f')]['id']){delete _0x5d60d9[_0x91da('0x5f')]['id'];}return db['OpenchannelAccount'][_0x91da('0x5d')]({'where':{'id':_0x5d60d9['params']['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x44b99b,null))[_0x91da('0x23')](function(_0x18ac40){if(_0x18ac40){_0x5d60d9[_0x91da('0x5f')][_0x91da('0x68')]=_0x18ac40['id'];return db[_0x91da('0x69')][_0x91da('0x5e')](_0x5d60d9[_0x91da('0x5f')]);}})[_0x91da('0x23')](respondWithResult(_0x44b99b,null))[_0x91da('0x2e')](handleError(_0x44b99b,null));};exports['getDispositions']=function(_0x2f697d,_0x1f3be6,_0x3a5bb7){var _0x3bd489={'raw':![],'where':{}};var _0x565ecf={};var _0x21c428={'count':0x0,'rows':[]};return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0x2f697d[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x1f3be6,null))[_0x91da('0x23')](function(_0x58a0bb){if(_0x58a0bb){_0x565ecf[_0x91da('0x46')]=_[_0x91da('0x47')](db[_0x91da('0x69')][_0x91da('0x43')]);_0x565ecf[_0x91da('0x48')]=_[_0x91da('0x47')](_0x2f697d[_0x91da('0x48')]);_0x565ecf[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x565ecf[_0x91da('0x46')],_0x565ecf[_0x91da('0x48')]);_0x3bd489[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x565ecf[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x2f697d[_0x91da('0x48')][_0x91da('0x4b')]));_0x3bd489[_0x91da('0x4c')]=_0x3bd489['attributes']['length']?_0x3bd489[_0x91da('0x4c')]:_0x565ecf[_0x91da('0x46')];if(!_0x2f697d[_0x91da('0x48')][_0x91da('0x4e')](_0x91da('0x6b'))){_0x3bd489[_0x91da('0x33')]=qs[_0x91da('0x33')](_0x2f697d['query']['limit']);_0x3bd489[_0x91da('0x31')]=qs['offset'](_0x2f697d[_0x91da('0x48')][_0x91da('0x31')]);}_0x3bd489[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x2f697d[_0x91da('0x48')][_0x91da('0x50')]);_0x3bd489['where']=qs[_0x91da('0x49')](_[_0x91da('0x52')](_0x2f697d[_0x91da('0x48')],_0x565ecf[_0x91da('0x49')]));_0x3bd489[_0x91da('0x51')][_0x91da('0x68')]=_0x58a0bb['id'];if(_0x2f697d['query']['filter']){_0x3bd489['where']=_[_0x91da('0x54')](_0x3bd489[_0x91da('0x51')],{'$or':_[_0x91da('0x41')](_0x3bd489['attributes'],function(_0x559064){var _0x176823={};_0x176823[_0x559064]={'$like':'%'+_0x2f697d[_0x91da('0x48')]['filter']+'%'};return _0x176823;})});}_0x3bd489=_[_0x91da('0x54')]({},_0x3bd489,_0x2f697d[_0x91da('0x5c')]);return db[_0x91da('0x69')][_0x91da('0x34')]({'where':_0x3bd489['where']})['then'](function(_0x5050a4){_0x21c428[_0x91da('0x34')]=_0x5050a4;if(_0x2f697d[_0x91da('0x48')]['includeAll']){_0x3bd489[_0x91da('0x55')]=[{'all':!![]}];}return db[_0x91da('0x69')][_0x91da('0x56')](_0x3bd489);})['then'](function(_0x3c0844){_0x21c428[_0x91da('0x57')]=_0x3c0844;return _0x21c428;});}})[_0x91da('0x23')](respondWithFilteredResult(_0x1f3be6,_0x3bd489))[_0x91da('0x2e')](handleError(_0x1f3be6,null));};exports[_0x91da('0x6c')]=function(_0x30b999,_0x56e042,_0x193fe4){return db[_0x91da('0x42')]['find']({'where':{'id':_0x30b999[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x56e042,null))[_0x91da('0x23')](function(_0x1d6c64){if(_0x1d6c64){return _0x1d6c64['removeDispositions'](_0x30b999['query'][_0x91da('0x6d')]);}})['then'](respondWithStatusCode(_0x56e042,null))['catch'](handleError(_0x56e042,null));};exports[_0x91da('0x6e')]=function(_0x305663,_0x5affa0,_0x5033c4){if(_0x305663['body']['id']){delete _0x305663[_0x91da('0x5f')]['id'];}return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x305663['params']['id']}})['then'](handleEntityNotFound(_0x5affa0,null))[_0x91da('0x23')](function(_0x16bc65){if(_0x16bc65){_0x305663[_0x91da('0x5f')][_0x91da('0x68')]=_0x16bc65['id'];return db[_0x91da('0x6f')][_0x91da('0x5e')](_0x305663[_0x91da('0x5f')]);}})[_0x91da('0x23')](respondWithResult(_0x5affa0,null))[_0x91da('0x2e')](handleError(_0x5affa0,null));};exports[_0x91da('0x70')]=function(_0x9c18b1,_0x140eb0,_0x4e9ab7){var _0x6912da={'raw':![],'where':{}};var _0x4cfb46={};var _0xdd4738={'count':0x0,'rows':[]};return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0x9c18b1[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x140eb0,null))[_0x91da('0x23')](function(_0x24ec9a){if(_0x24ec9a){_0x4cfb46['model']=_[_0x91da('0x47')](db['CannedAnswer']['rawAttributes']);_0x4cfb46[_0x91da('0x48')]=_[_0x91da('0x47')](_0x9c18b1[_0x91da('0x48')]);_0x4cfb46[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x4cfb46['model'],_0x4cfb46[_0x91da('0x48')]);_0x6912da[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x4cfb46[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x9c18b1[_0x91da('0x48')][_0x91da('0x4b')]));_0x6912da[_0x91da('0x4c')]=_0x6912da[_0x91da('0x4c')][_0x91da('0x4d')]?_0x6912da[_0x91da('0x4c')]:_0x4cfb46[_0x91da('0x46')];if(!_0x9c18b1[_0x91da('0x48')]['hasOwnProperty'](_0x91da('0x6b'))){_0x6912da[_0x91da('0x33')]=qs[_0x91da('0x33')](_0x9c18b1['query'][_0x91da('0x33')]);_0x6912da[_0x91da('0x31')]=qs['offset'](_0x9c18b1['query'][_0x91da('0x31')]);}_0x6912da[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x9c18b1[_0x91da('0x48')][_0x91da('0x50')]);_0x6912da[_0x91da('0x51')]=qs[_0x91da('0x49')](_[_0x91da('0x52')](_0x9c18b1[_0x91da('0x48')],_0x4cfb46[_0x91da('0x49')]));_0x6912da[_0x91da('0x51')]['OpenchannelAccountId']=_0x24ec9a['id'];if(_0x9c18b1[_0x91da('0x48')][_0x91da('0x53')]){_0x6912da[_0x91da('0x51')]=_[_0x91da('0x54')](_0x6912da[_0x91da('0x51')],{'$or':_[_0x91da('0x41')](_0x6912da[_0x91da('0x4c')],function(_0x1fe74f){var _0x4f4f6c={};_0x4f4f6c[_0x1fe74f]={'$like':'%'+_0x9c18b1[_0x91da('0x48')]['filter']+'%'};return _0x4f4f6c;})});}_0x6912da=_[_0x91da('0x54')]({},_0x6912da,_0x9c18b1[_0x91da('0x5c')]);return db[_0x91da('0x6f')][_0x91da('0x34')]({'where':_0x6912da[_0x91da('0x51')]})[_0x91da('0x23')](function(_0x333fc5){_0xdd4738['count']=_0x333fc5;if(_0x9c18b1[_0x91da('0x48')][_0x91da('0x5b')]){_0x6912da[_0x91da('0x55')]=[{'all':!![]}];}return db[_0x91da('0x6f')][_0x91da('0x56')](_0x6912da);})['then'](function(_0xa7e29){_0xdd4738[_0x91da('0x57')]=_0xa7e29;return _0xdd4738;});}})[_0x91da('0x23')](respondWithFilteredResult(_0x140eb0,_0x6912da))[_0x91da('0x2e')](handleError(_0x140eb0,null));};exports[_0x91da('0x71')]=function(_0x2330b7,_0x1a9d77,_0x3081d4){return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x2330b7[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x1a9d77,null))[_0x91da('0x23')](function(_0x32cb9b){if(_0x32cb9b){return _0x32cb9b[_0x91da('0x71')](_0x2330b7[_0x91da('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x1a9d77,null))[_0x91da('0x2e')](handleError(_0x1a9d77,null));};exports[_0x91da('0x72')]=function(_0x2a2ea7,_0xe14ea9,_0x38060d){var _0x4d850c={'body':_0x2a2ea7[_0x91da('0x5f')],'channel':'openchannel'};var _0x42fb06=[];var _0x465d3f=[];var _0x246dee={};var _0x57b11d=![];return db[_0x91da('0x73')][_0x91da('0x67')]()[_0x91da('0x23')](function(_0x2f9557){if(!_0x2f9557){throw new db['Sequelize'][(_0x91da('0x74'))](_0x91da('0x75'));}_0x42fb06=_['difference'](_[_0x91da('0x47')](_0x2f9557),[_0x91da('0x76'),_0x91da('0x77')]);_0x465d3f=_[_0x91da('0x78')](_[_0x91da('0x47')](_0x2f9557),['createdAt',_0x91da('0x77'),'CompanyId',_0x91da('0x79')]);if(_0x2a2ea7[_0x91da('0x5f')]['id']){delete _0x2a2ea7[_0x91da('0x5f')]['id'];}if(_[_0x91da('0x7a')](_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x7b')])){throw new db[(_0x91da('0x7c'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x91da('0x7a')](_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x5f')])||_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x5f')]===''){throw new db['Sequelize'][(_0x91da('0x74'))](_0x91da('0x7d'));}if(_[_0x91da('0x7a')](_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x7e')])){throw new db[(_0x91da('0x7c'))][(_0x91da('0x74'))](_0x91da('0x7f')+_0x465d3f);}if(!_[_0x91da('0x80')](_0x465d3f,_0x2a2ea7['body'][_0x91da('0x7e')])){throw new db[(_0x91da('0x7c'))][(_0x91da('0x74'))](_0x91da('0x81')+_0x465d3f);}_0x246dee[_0x2a2ea7['body']['mapKey']]=_0x2a2ea7[_0x91da('0x5f')]['from'];})[_0x91da('0x23')](function(){return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x2a2ea7[_0x91da('0x66')]['id']},'include':[{'model':db[_0x91da('0x82')],'as':_0x91da('0x83'),'include':[{'model':db[_0x91da('0x73')],'as':_0x91da('0x84'),'where':_0x246dee,'limit':0x1,'order':[[_0x91da('0x77'),_0x91da('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':_0x91da('0x86')}]});})[_0x91da('0x23')](handleEntityNotFound(_0xe14ea9,null))[_0x91da('0x23')](function(_0x24fdf8){if(_0x24fdf8&&_0x24fdf8[_0x91da('0x83')]){_0x4d850c[_0x91da('0x87')]=_0x24fdf8;_0x4d850c[_0x91da('0x88')]=_0x24fdf8[_0x91da('0x86')];_0x4d850c['list']=_0x24fdf8['List'];_0x4d850c[_0x91da('0x88')]=_['orderBy'](_0x4d850c[_0x91da('0x88')],['priority'],[_0x91da('0x89')]);if(_0x4d850c['account']['Applications']){delete _0x4d850c['account']['Applications'];}if(_0x4d850c[_0x91da('0x87')][_0x91da('0x83')]&&_0x4d850c[_0x91da('0x87')][_0x91da('0x83')][_0x91da('0x84')][_0x91da('0x4d')]){return _0x4d850c[_0x91da('0x87')]['List'][_0x91da('0x84')][0x0];}var _0x45e62a=_[_0x91da('0x1c')](_0x2a2ea7[_0x91da('0x5f')],{'firstName':_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x7b')],'ListId':_0x24fdf8[_0x91da('0x79')]});_0x45e62a[_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x7e')]]=_0x2a2ea7['body'][_0x91da('0x7b')];return db[_0x91da('0x73')][_0x91da('0x5e')](_0x45e62a,{'fields':_0x42fb06,'raw':!![]});}})[_0x91da('0x23')](handleEntityNotFound(_0xe14ea9,null))[_0x91da('0x23')](function(_0x328c3a){_0x4d850c[_0x91da('0x8a')]=_0x328c3a;if(_0x328c3a){var _0x21d37c={'ContactId':_0x328c3a['id'],'OpenchannelAccountId':_0x2a2ea7[_0x91da('0x66')]['id'],'from':(_0x328c3a[_0x91da('0x8b')]||'')+'\x20'+(_0x328c3a[_0x91da('0x8c')]||'')};var _0x1004f={'OpenchannelAccountId':_0x2a2ea7['params']['id'],'closed':![]};if(_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x8d')]){_0x1004f[_0x91da('0x8d')]=_0x2a2ea7['body'][_0x91da('0x8d')];return db[_0x91da('0x8e')]['find']({'where':_0x1004f})[_0x91da('0x23')](function(_0x54588c){if(_0x54588c){return[_0x54588c,![]];}_0x21d37c['threadId']=_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x8d')];_0x21d37c[_0x91da('0x8f')]=_0x2a2ea7[_0x91da('0x5f')]['externalUrl'];return db['OpenchannelInteraction'][_0x91da('0x5e')](_0x21d37c)[_0x91da('0x23')](function(_0x25c407){return[_0x25c407,!![]];});});}else{_0x1004f['threadId']=null;}_0x1004f[_0x91da('0x90')]=_0x328c3a['id'];return db[_0x91da('0x8e')][_0x91da('0x5d')]({'where':_0x1004f})[_0x91da('0x23')](function(_0x94fa85){if(_0x94fa85){return[_0x94fa85,![]];}return db[_0x91da('0x8e')][_0x91da('0x5e')](_0x21d37c)[_0x91da('0x23')](function(_0x8c24e){return[_0x8c24e,!![]];});});}})[_0x91da('0x91')](function(_0x46f80d,_0x36c082){if(_0x46f80d){_0x57b11d=_0x36c082;if(!_0x36c082){var _0x598e62={'from':(_0x4d850c['contact'][_0x91da('0x8b')]||'')+'\x20'+(_0x4d850c[_0x91da('0x8a')]['lastName']||'')};if(_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x8d')]&&_0x2a2ea7[_0x91da('0x5f')]['messageId']&&_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x8d')]!=_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x92')]){_0x598e62[_0x91da('0x8d')]=_0x2a2ea7[_0x91da('0x5f')]['messageId'];}return _0x46f80d[_0x91da('0x39')](_0x598e62);}else{return _0x46f80d;}}})[_0x91da('0x23')](function(_0x49e6d3){_0x4d850c[_0x91da('0x93')]=_0x49e6d3[_0x91da('0x3b')]({'plain':!![]});_0x4d850c[_0x91da('0x93')][_0x91da('0x94')]=_0x57b11d;if(_0x4d850c[_0x91da('0x93')][_0x91da('0x94')]){if(_0x4d850c['account'][_0x91da('0x95')]){_0x4d850c[_0x91da('0x88')][_0x91da('0x96')]({'id':0x0,'priority':_0x4d850c[_0x91da('0x88')][_0x91da('0x4d')]+0x1,'app':_0x91da('0x97'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x91da('0x98')]['create']({'body':_0x2a2ea7['body'][_0x91da('0x5f')],'OpenchannelAccountId':_0x2a2ea7[_0x91da('0x66')]['id'],'OpenchannelInteractionId':_0x49e6d3['id'],'direction':'in','ContactId':_0x4d850c[_0x91da('0x8a')]['id'],'AttachmentId':_0x2a2ea7[_0x91da('0x5f')][_0x91da('0x99')]});})['then'](function(_0x490c53){_0x4d850c[_0x91da('0x2c')]=_0x490c53;if(!_0x4d850c[_0x91da('0x93')]['UserId'])return;return db[_0x91da('0x9a')][_0x91da('0x5d')]({'attributes':['id',_0x91da('0x3e')],'where':{'id':_0x4d850c[_0x91da('0x93')][_0x91da('0x9b')]}});})[_0x91da('0x23')](function(_0x2f4dd3){if(_0x2f4dd3){_0x4d850c[_0x91da('0x88')][_0x91da('0x9c')]({'id':0x0,'priority':0x0,'app':_0x91da('0x9d'),'appdata':_0x2f4dd3[_0x91da('0x3e')]+','+(_0x4d850c['account'][_0x91da('0x9e')]||0xa),'interval':_0x91da('0x9f')});}if(!_0x4d850c[_0x91da('0x93')][_0x91da('0xa0')])return;return db[_0x91da('0xa1')][_0x91da('0x5d')]({'attributes':['id',_0x91da('0x3e')],'where':{'id':_0x4d850c['interaction'][_0x91da('0xa0')]}});})[_0x91da('0x23')](function(_0x226a9c){if(_0x226a9c){_0x4d850c[_0x91da('0x88')][_0x91da('0x9c')]({'id':0x0,'priority':0x1,'app':_0x91da('0xa2'),'appdata':_0x226a9c[_0x91da('0x3e')]+','+(_0x4d850c['account'][_0x91da('0xa3')]||0x12c),'interval':_0x91da('0x9f')});}return respondWithRpcPromise(_0x91da('0xa4'),'startRouting',_0x4d850c);})[_0x91da('0x23')](function(_0xd3de9b){respondWithRpcPromise(_0x91da('0xa5'),_0x91da('0xa5'),{'event':_0x91da('0x72'),'message':_0xd3de9b},client9002);return _0xd3de9b;})[_0x91da('0x23')](respondWithResult(_0xe14ea9,null))[_0x91da('0x2e')](handleError(_0xe14ea9,null));};exports['addApplications']=function(_0x4c3276,_0x3a9bca){var _0x493994=_0x4c3276[_0x91da('0x66')]['id'];var _0x3f2838=_0x4c3276[_0x91da('0x5f')];var _0x56ebf9=0xc8;var _0x453095=null;return db[_0x91da('0xa6')][_0x91da('0xa7')]({'isolationLevel':db['sequelize'][_0x91da('0xa8')][_0x91da('0xa9')][_0x91da('0xaa')]},function(_0x1c84b1){return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0x493994},'transaction':_0x1c84b1})[_0x91da('0x23')](function(_0x147e04){if(_0x147e04){return db['OpenchannelApplication'][_0x91da('0x3a')]({'where':{'OpenchannelAccountId':_0x493994},'transaction':_0x1c84b1})[_0x91da('0x23')](function(){var _0x16300e=_[_0x91da('0x41')](_0x3f2838,function(_0xdc0dfe){_0xdc0dfe[_0x91da('0x68')]=_0x493994;return _0xdc0dfe;});return db[_0x91da('0xab')]['bulkCreate'](_0x16300e,{'transaction':_0x1c84b1});});}else{_0x56ebf9=0x194;_0x453095=[];}});})[_0x91da('0x23')](function(){if(_0x56ebf9!==0x194){return db[_0x91da('0xab')][_0x91da('0xac')]({'where':{'OpenchannelAccountId':_0x493994},'order':'priority'})[_0x91da('0x23')](function(_0x38dc25){_0x453095=_0x38dc25;});}})[_0x91da('0x2e')](function(_0x5de1e9){_0x56ebf9=0x1f4;logger[_0x91da('0x2a')](_0x5de1e9[_0x91da('0xad')]);if(_0x5de1e9[_0x91da('0x3e')]){delete _0x5de1e9[_0x91da('0x3e')];}_0x453095=_0x5de1e9;})['finally'](function(){if(_0x453095===null){_0x3a9bca[_0x91da('0x2f')](_0x56ebf9);}else{if(_0x56ebf9===0x1f4){_0x3a9bca['status'](_0x56ebf9)[_0x91da('0x3f')](_0x453095);}else{_0x3a9bca[_0x91da('0x30')](_0x56ebf9)[_0x91da('0xae')](_0x453095);}}});};exports[_0x91da('0xaf')]=function(_0x5b9d68,_0x541084,_0x1d7cc0){var _0x5b2e4c={};var _0x426a8c={};var _0x5f39a4;var _0x575209;return db['OpenchannelAccount'][_0x91da('0x6a')]({'where':{'id':_0x5b9d68['params']['id']}})['then'](handleEntityNotFound(_0x541084,null))[_0x91da('0x23')](function(_0x5bc036){if(_0x5bc036){_0x5f39a4=_0x5bc036;_0x426a8c['model']=_[_0x91da('0x47')](db[_0x91da('0xab')][_0x91da('0x43')]);_0x426a8c[_0x91da('0x48')]=_[_0x91da('0x47')](_0x5b9d68[_0x91da('0x48')]);_0x426a8c[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x426a8c[_0x91da('0x46')],_0x426a8c[_0x91da('0x48')]);_0x5b2e4c[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x426a8c[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x5b9d68[_0x91da('0x48')][_0x91da('0x4b')]));_0x5b2e4c[_0x91da('0x4c')]=_0x5b2e4c[_0x91da('0x4c')][_0x91da('0x4d')]?_0x5b2e4c['attributes']:_0x426a8c[_0x91da('0x46')];_0x5b2e4c[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x5b9d68[_0x91da('0x48')]['sort']);_0x5b2e4c['where']=qs['filters'](_[_0x91da('0x52')](_0x5b9d68[_0x91da('0x48')],_0x426a8c[_0x91da('0x49')]));if(_0x5b9d68['query'][_0x91da('0x53')]){_0x5b2e4c[_0x91da('0x51')]=_[_0x91da('0x54')](_0x5b2e4c[_0x91da('0x51')],{'$or':_[_0x91da('0x41')](_0x5b2e4c[_0x91da('0x4c')],function(_0x17e0d6){var _0x525ed5={};_0x525ed5[_0x17e0d6]={'$like':'%'+_0x5b9d68[_0x91da('0x48')][_0x91da('0x53')]+'%'};return _0x525ed5;})});}_0x5b2e4c=_[_0x91da('0x54')]({},_0x5b2e4c,_0x5b9d68[_0x91da('0x5c')]);return _0x5f39a4['getApplications'](_0x5b2e4c);}})['then'](function(_0x6bd17f){if(_0x6bd17f){_0x575209=_0x6bd17f[_0x91da('0x4d')];if(!_0x5b9d68[_0x91da('0x48')][_0x91da('0x4e')](_0x91da('0x6b'))){_0x5b2e4c[_0x91da('0x33')]=qs[_0x91da('0x33')](_0x5b9d68['query'][_0x91da('0x33')]);_0x5b2e4c[_0x91da('0x31')]=qs[_0x91da('0x31')](_0x5b9d68[_0x91da('0x48')][_0x91da('0x31')]);}return _0x5f39a4[_0x91da('0xaf')](_0x5b2e4c);}})['then'](function(_0x31090c){if(_0x31090c){return _0x31090c?{'count':_0x575209,'rows':_0x31090c}:null;}})[_0x91da('0x23')](respondWithResult(_0x541084,null))['catch'](handleError(_0x541084,null));};exports['getInteractions']=function(_0x413d67,_0x1b3733,_0x5167d6){var _0x476677={'raw':![],'where':{}};var _0x371a52={};var _0x3d83a7={'count':0x0,'rows':[]};return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0x413d67[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x1b3733,null))['then'](function(_0x3001c2){if(_0x3001c2){_0x371a52[_0x91da('0x46')]=_[_0x91da('0x47')](db[_0x91da('0x8e')][_0x91da('0x43')]);_0x371a52[_0x91da('0x48')]=_[_0x91da('0x47')](_0x413d67[_0x91da('0x48')]);_0x371a52[_0x91da('0x49')]=_[_0x91da('0x4a')](_0x371a52[_0x91da('0x46')],_0x371a52[_0x91da('0x48')]);_0x476677[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x371a52['model'],qs[_0x91da('0x4b')](_0x413d67[_0x91da('0x48')][_0x91da('0x4b')]));_0x476677['attributes']=_0x476677[_0x91da('0x4c')][_0x91da('0x4d')]?_0x476677[_0x91da('0x4c')]:_0x371a52['model'];if(!_0x413d67['query'][_0x91da('0x4e')]('nolimit')){_0x476677[_0x91da('0x33')]=qs['limit'](_0x413d67['query'][_0x91da('0x33')]);_0x476677['offset']=qs[_0x91da('0x31')](_0x413d67[_0x91da('0x48')][_0x91da('0x31')]);}_0x476677[_0x91da('0x4f')]=qs[_0x91da('0x50')](_0x413d67['query'][_0x91da('0x50')]);_0x476677['where']=qs['filters'](_[_0x91da('0x52')](_0x413d67[_0x91da('0x48')],_0x371a52[_0x91da('0x49')]));_0x476677[_0x91da('0x51')][_0x91da('0x68')]=_0x3001c2['id'];if(_0x413d67[_0x91da('0x48')][_0x91da('0x53')]){_0x476677[_0x91da('0x51')]=_[_0x91da('0x54')](_0x476677['where'],{'$or':_[_0x91da('0x41')](_0x476677['attributes'],function(_0x5b74e0){var _0x13b07d={};_0x13b07d[_0x5b74e0]={'$like':'%'+_0x413d67[_0x91da('0x48')]['filter']+'%'};return _0x13b07d;})});}_0x476677=_[_0x91da('0x54')]({},_0x476677,_0x413d67[_0x91da('0x5c')]);return db[_0x91da('0x8e')]['count']({'where':_0x476677[_0x91da('0x51')]})[_0x91da('0x23')](function(_0x4fe82e){_0x3d83a7[_0x91da('0x34')]=_0x4fe82e;if(_0x413d67[_0x91da('0x48')][_0x91da('0x5b')]){_0x476677[_0x91da('0x55')]=[{'model':db[_0x91da('0x73')],'as':_0x91da('0xb0'),'required':![]},{'model':db[_0x91da('0x9a')],'as':'Owner','attributes':[_0x91da('0x3e'),_0x91da('0xb1'),_0x91da('0xb2')],'required':![]},{'model':db[_0x91da('0xb3')],'as':'Tags','attributes':['id','name','color'],'where':_0x413d67['query'][_0x91da('0xb4')]?{'id':_0x413d67['query'][_0x91da('0xb4')]}:undefined,'required':_0x413d67['query'][_0x91da('0xb4')]?!![]:![]}];}return db[_0x91da('0x8e')][_0x91da('0x56')](_0x476677);})['then'](function(_0x50a502){_0x3d83a7[_0x91da('0x57')]=_0x50a502;return _0x3d83a7;});}})[_0x91da('0x23')](respondWithFilteredResult(_0x1b3733,_0x476677))[_0x91da('0x2e')](handleError(_0x1b3733,null));};exports[_0x91da('0xb5')]=function(_0x41b872,_0xd8233d,_0x477538){return db[_0x91da('0x42')][_0x91da('0x5d')]({'where':{'id':_0x41b872['params']['id']}})['then'](handleEntityNotFound(_0xd8233d,null))['then'](function(_0x46d5f9){if(_0x46d5f9){return _0x46d5f9[_0x91da('0xb5')](_0x41b872[_0x91da('0x5f')]['ids'],_['omit'](_0x41b872[_0x91da('0x5f')],[_0x91da('0x6d'),'id'])||{})[_0x91da('0x91')](function(_0x59ee60){for(var _0x1eb8bd=0x0;_0x1eb8bd<_0x41b872[_0x91da('0x5f')][_0x91da('0x6d')][_0x91da('0x4d')];_0x1eb8bd+=0x1){socket[_0x91da('0xb6')](_0x91da('0xb7'),{'UserId':Number(_0x41b872['body'][_0x91da('0x6d')][_0x1eb8bd]),'OpenchannelAccountId':Number(_0x41b872[_0x91da('0x66')]['id'])});}return _0x59ee60;});}})[_0x91da('0x23')](respondWithResult(_0xd8233d,null))[_0x91da('0x2e')](handleError(_0xd8233d,null));};exports[_0x91da('0xb8')]=function(_0x30e69a,_0x9ffd50,_0x4f841f){return db[_0x91da('0x42')]['find']({'where':{'id':_0x30e69a[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x9ffd50,null))[_0x91da('0x23')](function(_0x4bbe04){if(_0x4bbe04){return _0x4bbe04[_0x91da('0xb8')](_0x30e69a[_0x91da('0x48')]['ids'])[_0x91da('0x23')](function(){if(_[_0x91da('0xb9')](_0x30e69a[_0x91da('0x48')][_0x91da('0x6d')])){for(var _0x4591c1=0x0;_0x4591c1<_0x30e69a['query'][_0x91da('0x6d')][_0x91da('0x4d')];_0x4591c1+=0x1){socket[_0x91da('0xb6')](_0x91da('0xba'),{'UserId':Number(_0x30e69a[_0x91da('0x48')][_0x91da('0x6d')][_0x4591c1]),'OpenchannelAccountId':Number(_0x30e69a['params']['id'])});}}else{socket[_0x91da('0xb6')](_0x91da('0xba'),{'UserId':Number(_0x30e69a[_0x91da('0x48')][_0x91da('0x6d')]),'OpenchannelAccountId':Number(_0x30e69a['params']['id'])});}});}})[_0x91da('0x23')](respondWithStatusCode(_0x9ffd50,null))[_0x91da('0x2e')](handleError(_0x9ffd50,null));};exports[_0x91da('0xbb')]=function(_0x53527f,_0x47b997,_0x303e3b){var _0x2b1129={};var _0x3377b9={};var _0xd1d720;var _0x40ab4e;return db['OpenchannelAccount'][_0x91da('0x6a')]({'where':{'id':_0x53527f[_0x91da('0x66')]['id']}})['then'](handleEntityNotFound(_0x47b997,null))[_0x91da('0x23')](function(_0x17d8f7){if(_0x17d8f7){_0xd1d720=_0x17d8f7;_0x3377b9[_0x91da('0x46')]=_[_0x91da('0x47')](db[_0x91da('0x9a')][_0x91da('0x43')]);_0x3377b9[_0x91da('0x48')]=_['keys'](_0x53527f['query']);_0x3377b9[_0x91da('0x49')]=_['intersection'](_0x3377b9[_0x91da('0x46')],_0x3377b9[_0x91da('0x48')]);_0x2b1129[_0x91da('0x4c')]=_[_0x91da('0x4a')](_0x3377b9[_0x91da('0x46')],qs[_0x91da('0x4b')](_0x53527f[_0x91da('0x48')][_0x91da('0x4b')]));_0x2b1129[_0x91da('0x4c')]=_0x2b1129[_0x91da('0x4c')][_0x91da('0x4d')]?_0x2b1129['attributes']:_0x3377b9[_0x91da('0x46')];_0x2b1129[_0x91da('0x4f')]=qs['sort'](_0x53527f[_0x91da('0x48')][_0x91da('0x50')]);_0x2b1129[_0x91da('0x51')]=qs[_0x91da('0x49')](_['pick'](_0x53527f[_0x91da('0x48')],_0x3377b9[_0x91da('0x49')]));if(_0x53527f[_0x91da('0x48')]['filter']){_0x2b1129[_0x91da('0x51')]=_['merge'](_0x2b1129[_0x91da('0x51')],{'$or':_[_0x91da('0x41')](_0x2b1129['attributes'],function(_0x2288fe){var _0x4aae2a={};_0x4aae2a[_0x2288fe]={'$like':'%'+_0x53527f[_0x91da('0x48')][_0x91da('0x53')]+'%'};return _0x4aae2a;})});}_0x2b1129=_['merge']({},_0x2b1129,_0x53527f[_0x91da('0x5c')]);return _0xd1d720[_0x91da('0xbb')](_0x2b1129);}})['then'](function(_0x3e6f55){if(_0x3e6f55){_0x40ab4e=_0x3e6f55[_0x91da('0x4d')];if(!_0x53527f['query'][_0x91da('0x4e')]('nolimit')){_0x2b1129[_0x91da('0x33')]=qs[_0x91da('0x33')](_0x53527f['query'][_0x91da('0x33')]);_0x2b1129[_0x91da('0x31')]=qs[_0x91da('0x31')](_0x53527f['query'][_0x91da('0x31')]);}return _0xd1d720['getAgents'](_0x2b1129);}})[_0x91da('0x23')](function(_0x461e35){if(_0x461e35){return _0x461e35?{'count':_0x40ab4e,'rows':_0x461e35}:null;}})['then'](respondWithResult(_0x47b997,null))['catch'](handleError(_0x47b997,null));};exports['send']=function(_0xf0afab,_0x1cdd94,_0x1e80c1){var _0x4a88fc,_0x9bde05,_0x2596c3;if(_[_0x91da('0x7a')](_0xf0afab[_0x91da('0x5f')][_0x91da('0x5f')])||_0xf0afab['body'][_0x91da('0x5f')]===''){throw new db[(_0x91da('0x7c'))][(_0x91da('0x74'))](_0x91da('0x7d'));}if(_[_0x91da('0x7a')](_0xf0afab[_0x91da('0x5f')]['to'])){}_0x4a88fc=_0xf0afab[_0x91da('0x5f')]['to'];return db[_0x91da('0x42')][_0x91da('0x6a')]({'where':{'id':_0xf0afab[_0x91da('0x66')]['id']}})[_0x91da('0x23')](handleEntityNotFound(_0x1cdd94,null))['then'](function(_0x5c5f5e){if(_0x5c5f5e){return db['OpenchannelAccount']['find']({'where':{'id':_0x5c5f5e['id']},'include':[{'model':db['CmList'],'as':_0x91da('0x83'),'include':[{'model':db[_0x91da('0x73')],'as':_0x91da('0x84'),'where':{[_0x5c5f5e[_0x91da('0x7e')]]:_0x4a88fc},'limit':0x1,'order':[[_0x91da('0x77'),'DESC']]}]}]})[_0x91da('0x23')](handleEntityNotFound(_0x1cdd94,null))[_0x91da('0x23')](function(_0x654ff6){if(_0x654ff6&&_0x654ff6['List']){_0x9bde05=_0x654ff6[_0x91da('0x3b')]({'plain':!![]});if(_0x9bde05[_0x91da('0x83')]&&_0x9bde05['List'][_0x91da('0x84')][_0x91da('0x4d')]){return _0x9bde05[_0x91da('0x83')]['Contacts'][0x0];}return db['CmContact']['create'](_[_0x91da('0x1c')](_0xf0afab[_0x91da('0x5f')],{'firstName':_0x4a88fc,[_0x654ff6[_0x91da('0x7e')]]:_0x4a88fc,'phone':_0x4a88fc,'ListId':_0x9bde05[_0x91da('0x79')]}));}})['then'](handleEntityNotFound(_0x1cdd94,null))[_0x91da('0x23')](function(_0x548a7c){if(_0x548a7c){_0x2596c3=_0x548a7c;return db['OpenchannelInteraction'][_0x91da('0x5d')]({'where':{'ContactId':_0x2596c3['id'],'closed':![],'OpenchannelAccountId':_0x9bde05['id']}})[_0x91da('0x23')](function(_0x28882a){if(_0x28882a){return[_0x28882a,![]];}return db[_0x91da('0x8e')][_0x91da('0x5e')]({'UserId':_0xf0afab['user']['id'],'ContactId':_0x2596c3['id'],'OpenchannelAccountId':_0x9bde05['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x91da('0x54')](_0xf0afab[_0x91da('0x5f')],{'read':![],'body':_0xf0afab['body'][_0x91da('0x5f')],'OpenchannelAccountId':_0x9bde05['id'],'UserId':_0xf0afab[_0x91da('0x60')]['id'],'ContactId':_0x2596c3['id']})]},{'include':[{'model':db[_0x91da('0x98')],'as':_0x91da('0xbc')}]})[_0x91da('0x23')](function(_0x398834){return[_0x398834,!![]];});});}})[_0x91da('0x91')](function(_0x2b7062,_0x31eac5){if(_0x31eac5){return _0x2b7062;}return db[_0x91da('0x98')][_0x91da('0x5e')](_[_0x91da('0x54')](_0xf0afab[_0x91da('0x5f')],{'read':![],'body':_0xf0afab[_0x91da('0x5f')][_0x91da('0x5f')],'OpenchannelAccountId':_0x9bde05['id'],'OpenchannelInteractionId':_0x2b7062['id'],'UserId':_0xf0afab[_0x91da('0x60')]['id'],'ContactId':_0x2596c3['id']}))[_0x91da('0x23')](function(_0x571654){_0x2b7062[_0x91da('0xbd')][_0x91da('0xbc')]=[];_0x2b7062['dataValues'][_0x91da('0xbc')]['push'](_0x571654[_0x91da('0xbd')]);return _0x2b7062;});});}})['then'](respondWithResult(_0x1cdd94,null))[_0x91da('0x2e')](handleError(_0x1cdd94,null));};
\ No newline at end of file
index 6a959ac..64f09bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4e6=['update','remove','emit','hook','events','OpenchannelAccount','setMaxListeners','save'];(function(_0x47d294,_0xf7c02a){var _0x130595=function(_0xc4b70d){while(--_0xc4b70d){_0x47d294['push'](_0x47d294['shift']());}};_0x130595(++_0xf7c02a);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x498334,_0x27b6fe){_0x498334=_0x498334-0x0;var _0x13bb70=_0xb4e6[_0x498334];return _0x13bb70;};'use strict';var EventEmitter=require(_0x6b4e('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0x6b4e('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x6b4e('0x2')](0x0);var events={'afterCreate':_0x6b4e('0x3'),'afterUpdate':_0x6b4e('0x4'),'afterDestroy':_0x6b4e('0x5')};function emitEvent(_0x31e8ad){return function(_0x1929b8,_0x52313b,_0x40da90){OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad+':'+_0x1929b8['id'],_0x1929b8);OpenchannelAccountEvents[_0x6b4e('0x6')](_0x31e8ad,_0x1929b8);_0x40da90(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0x6b4e('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents;
\ No newline at end of file
+var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x1df1b5,_0xaf02e4){var _0x459a04=function(_0x1168a7){while(--_0x1168a7){_0x1df1b5['push'](_0x1df1b5['shift']());}};_0x459a04(++_0xaf02e4);}(_0x9348,0x10d));var _0x8934=function(_0x1d1a63,_0x1b1773){_0x1d1a63=_0x1d1a63-0x0;var _0x2be668=_0x9348[_0x1d1a63];return _0x2be668;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents;
\ No newline at end of file
index ff57392..2056947 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1698f3,_0x3e701d){var _0x8f46e7=function(_0x34670f){while(--_0x34670f){_0x1698f3['push'](_0x1698f3['shift']());}};_0x8f46e7(++_0x3e701d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4f25c5,_0x227589){var _0x5a39c3=function(_0x440cf4){while(--_0x440cf4){_0x4f25c5['push'](_0x4f25c5['shift']());}};_0x5a39c3(++_0x227589);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 749a7a5..88dd7a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x282b=['request','then','info','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','OpenchannelAccount,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register'];(function(_0x16eb21,_0x51e63e){var _0xc0d39e=function(_0x56c5dc){while(--_0x56c5dc){_0x16eb21['push'](_0x16eb21['shift']());}};_0xc0d39e(++_0x51e63e);}(_0x282b,0xec));var _0xb282=function(_0x59d3a3,_0x3fc017){_0x59d3a3=_0x59d3a3-0x0;var _0x1c99a0=_0x282b[_0x59d3a3];return _0x1c99a0;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});config[_0xb282('0xb')]=_['defaults'](config['redis'],{'host':_0xb282('0xc'),'port':0x18eb});var socket=require(_0xb282('0xd'))(new Redis(config['redis']));require(_0xb282('0xe'))[_0xb282('0xf')](socket);function respondWithRpcPromise(_0x3435fc,_0x2d86ba,_0x56caf2){return new BPromise(function(_0x47e62e,_0x36b984){return client[_0xb282('0x10')](_0x3435fc,_0x56caf2)[_0xb282('0x11')](function(_0x1cbe28){logger[_0xb282('0x12')]('OpenchannelAccount,\x20%s,\x20%s',_0x2d86ba,'request\x20sent');logger[_0xb282('0x13')](_0xb282('0x14'),_0x2d86ba,_0xb282('0x15'),JSON[_0xb282('0x16')](_0x1cbe28));if(_0x1cbe28[_0xb282('0x17')]){if(_0x1cbe28['error'][_0xb282('0x18')]===0x1f4){logger['error'](_0xb282('0x19'),_0x2d86ba,_0x1cbe28[_0xb282('0x17')]['message']);return _0x36b984(_0x1cbe28['error']['message']);}logger[_0xb282('0x17')](_0xb282('0x19'),_0x2d86ba,_0x1cbe28[_0xb282('0x17')][_0xb282('0x1a')]);return _0x47e62e(_0x1cbe28[_0xb282('0x17')]['message']);}else{logger[_0xb282('0x12')](_0xb282('0x19'),_0x2d86ba,_0xb282('0x15'));_0x47e62e(_0x1cbe28[_0xb282('0x1b')][_0xb282('0x1a')]);}})['catch'](function(_0x52e305){logger[_0xb282('0x17')](_0xb282('0x19'),_0x2d86ba,_0x52e305);_0x36b984(_0x52e305);});});}
\ No newline at end of file
+var _0xc2da=['code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc2da,0x124));var _0xac2d=function(_0x530db1,_0x2b9531){_0x530db1=_0x530db1-0x0;var _0x31c1f2=_0xc2da[_0x530db1];return _0x31c1f2;};'use strict';var _=require(_0xac2d('0x0'));var util=require('util');var moment=require(_0xac2d('0x1'));var BPromise=require('bluebird');var rs=require(_0xac2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac2d('0x3'))['db'];var utils=require(_0xac2d('0x4'));var logger=require(_0xac2d('0x5'))(_0xac2d('0x6'));var config=require(_0xac2d('0x7'));var jayson=require(_0xac2d('0x8'));var client=jayson[_0xac2d('0x9')][_0xac2d('0xa')]({'port':0x232a});config[_0xac2d('0xb')]=_[_0xac2d('0xc')](config[_0xac2d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac2d('0xb')]));require('./openchannelAccount.socket')[_0xac2d('0xd')](socket);function respondWithRpcPromise(_0x254c5c,_0x42aad8,_0x11ac79){return new BPromise(function(_0x9a01cd,_0xe5d74a){return client['request'](_0x254c5c,_0x11ac79)['then'](function(_0x2c895b){logger[_0xac2d('0xe')](_0xac2d('0xf'),_0x42aad8,_0xac2d('0x10'));logger['debug'](_0xac2d('0x11'),_0x42aad8,_0xac2d('0x10'),JSON[_0xac2d('0x12')](_0x2c895b));if(_0x2c895b[_0xac2d('0x13')]){if(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x14')]===0x1f4){logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);return _0xe5d74a(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);}logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x2c895b[_0xac2d('0x13')]['message']);return _0x9a01cd(_0x2c895b[_0xac2d('0x13')][_0xac2d('0x15')]);}else{logger['info'](_0xac2d('0xf'),_0x42aad8,_0xac2d('0x10'));_0x9a01cd(_0x2c895b[_0xac2d('0x16')]['message']);}})[_0xac2d('0x17')](function(_0x5da81c){logger[_0xac2d('0x13')](_0xac2d('0xf'),_0x42aad8,_0x5da81c);_0xe5d74a(_0x5da81c);});});}
\ No newline at end of file
index 1f26df2..ca63fb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb6b8=['remove','update','removeListener','length','openchannelAccount:','save'];(function(_0x3807ed,_0x333d93){var _0x329527=function(_0xb4eed5){while(--_0xb4eed5){_0x3807ed['push'](_0x3807ed['shift']());}};_0x329527(++_0x333d93);}(_0xb6b8,0xc5));var _0x8b6b=function(_0xa36d18,_0x107ccc){_0xa36d18=_0xa36d18-0x0;var _0x21377a=_0xb6b8[_0xa36d18];return _0x21377a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x8b6b('0x0'),_0x8b6b('0x1'),_0x8b6b('0x2')];function createListener(_0x3cc9c9,_0x1153aa){return function(_0x387e4c){_0x1153aa['emit'](_0x3cc9c9,_0x387e4c);};}function removeListener(_0x84d985,_0x23b61b){return function(){OpenchannelAccountEvents[_0x8b6b('0x3')](_0x84d985,_0x23b61b);};}exports['register']=function(_0x144451){for(var _0x511688=0x0,_0x56da2a=events[_0x8b6b('0x4')];_0x511688<_0x56da2a;_0x511688++){var _0x303c21=events[_0x511688];var _0x142239=createListener(_0x8b6b('0x5')+_0x303c21,_0x144451);OpenchannelAccountEvents['on'](_0x303c21,_0x142239);}};
\ No newline at end of file
+var _0xbe31=['update','emit','register','length','openchannelAccount:','save','remove'];(function(_0x34fab8,_0x10575b){var _0x870f0e=function(_0x2d775a){while(--_0x2d775a){_0x34fab8['push'](_0x34fab8['shift']());}};_0x870f0e(++_0x10575b);}(_0xbe31,0x83));var _0x1be3=function(_0x3cb41d,_0x2d7f6d){_0x3cb41d=_0x3cb41d-0x0;var _0x4dc372=_0xbe31[_0x3cb41d];return _0x4dc372;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x1be3('0x0'),_0x1be3('0x1'),_0x1be3('0x2')];function createListener(_0x474db2,_0x228047){return function(_0x1bd12d){_0x228047[_0x1be3('0x3')](_0x474db2,_0x1bd12d);};}function removeListener(_0x2c1ddd,_0x3aacc2){return function(){OpenchannelAccountEvents['removeListener'](_0x2c1ddd,_0x3aacc2);};}exports[_0x1be3('0x4')]=function(_0x57e6b0){for(var _0x1f09ec=0x0,_0xa757b9=events[_0x1be3('0x5')];_0x1f09ec<_0xa757b9;_0x1f09ec++){var _0x2c3965=events[_0x1f09ec];var _0x2bb749=createListener(_0x1be3('0x6')+_0x2c3965,_0x57e6b0);OpenchannelAccountEvents['on'](_0x2c3965,_0x2bb749);}};
\ No newline at end of file
index 0584136..7096101 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd154=['exports','multer','util','path','express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','destroy'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xd154,0xc1));var _0x4d15=function(_0x17e930,_0x55b966){_0x17e930=_0x17e930-0x0;var _0x32808d=_0xd154[_0x17e930];return _0x32808d;};'use strict';var multer=require(_0x4d15('0x0'));var util=require(_0x4d15('0x1'));var path=require(_0x4d15('0x2'));var timeout=require('connect-timeout');var express=require(_0x4d15('0x3'));var router=express[_0x4d15('0x4')]();var fs_extra=require(_0x4d15('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4d15('0x6'));var controller=require('./openchannelApplication.controller');router[_0x4d15('0x7')]('/',auth[_0x4d15('0x8')](),controller[_0x4d15('0x9')]);router[_0x4d15('0x7')](_0x4d15('0xa'),auth[_0x4d15('0x8')](),controller[_0x4d15('0xb')]);router[_0x4d15('0xc')]('/',auth[_0x4d15('0x8')](),controller['create']);router[_0x4d15('0xd')](_0x4d15('0xa'),auth[_0x4d15('0x8')](),controller['update']);router['delete'](_0x4d15('0xa'),auth['isAuthenticated'](),controller[_0x4d15('0xe')]);module[_0x4d15('0xf')]=router;
\ No newline at end of file
+var _0xf655=['put','update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x142537,_0x4e3b77){var _0x31b015=function(_0x5aad4e){while(--_0x5aad4e){_0x142537['push'](_0x142537['shift']());}};_0x31b015(++_0x4e3b77);}(_0xf655,0x1b4));var _0x5f65=function(_0x501401,_0x2d8737){_0x501401=_0x501401-0x0;var _0xfd0a47=_0xf655[_0x501401];return _0xfd0a47;};'use strict';var multer=require(_0x5f65('0x0'));var util=require('util');var path=require(_0x5f65('0x1'));var timeout=require(_0x5f65('0x2'));var express=require(_0x5f65('0x3'));var router=express[_0x5f65('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5f65('0x5'));var interaction=require(_0x5f65('0x6'));var config=require(_0x5f65('0x7'));var controller=require(_0x5f65('0x8'));router[_0x5f65('0x9')]('/',auth[_0x5f65('0xa')](),controller[_0x5f65('0xb')]);router[_0x5f65('0x9')](_0x5f65('0xc'),auth[_0x5f65('0xa')](),controller[_0x5f65('0xd')]);router['post']('/',auth[_0x5f65('0xa')](),controller['create']);router[_0x5f65('0xe')](_0x5f65('0xc'),auth['isAuthenticated'](),controller[_0x5f65('0xf')]);router['delete'](_0x5f65('0xc'),auth[_0x5f65('0xa')](),controller[_0x5f65('0x10')]);module[_0x5f65('0x11')]=router;
\ No newline at end of file
index 0c86071..7117402 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb6d3=['STRING','sequelize','exports','INTEGER'];(function(_0x17e22e,_0x4fa092){var _0x4b0914=function(_0x3a09ed){while(--_0x3a09ed){_0x17e22e['push'](_0x17e22e['shift']());}};_0x4b0914(++_0x4fa092);}(_0xb6d3,0xa9));var _0x3b6d=function(_0x2a5e39,_0x41b87c){_0x2a5e39=_0x2a5e39-0x0;var _0x28f36f=_0xb6d3[_0x2a5e39];return _0x28f36f;};'use strict';var Sequelize=require(_0x3b6d('0x0'));module[_0x3b6d('0x1')]={'priority':{'type':Sequelize[_0x3b6d('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x3b6d('0x3')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
+var _0xb9c8=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x1e0ca5,_0x57fd4f){var _0x410923=function(_0x5bd94d){while(--_0x5bd94d){_0x1e0ca5['push'](_0x1e0ca5['shift']());}};_0x410923(++_0x57fd4f);}(_0xb9c8,0x19a));var _0x8b9c=function(_0x412342,_0x180734){_0x412342=_0x412342-0x0;var _0x3e62cb=_0xb9c8[_0x412342];return _0x3e62cb;};'use strict';var Sequelize=require(_0x8b9c('0x0'));module[_0x8b9c('0x1')]={'priority':{'type':Sequelize[_0x8b9c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8b9c('0x3')],'allowNull':![],'defaultValue':_0x8b9c('0x4')},'appdata':{'type':Sequelize[_0x8b9c('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x8b9c('0x3')],'defaultValue':_0x8b9c('0x6')}};
\ No newline at end of file
index c670888..d092c6a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0924=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','error','stack','name','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x263684,_0x1b9359){var _0x3121cc=function(_0x329625){while(--_0x329625){_0x263684['push'](_0x263684['shift']());}};_0x3121cc(++_0x1b9359);}(_0x0924,0x161));var _0x4092=function(_0x1ce595,_0x1069cb){_0x1ce595=_0x1ce595-0x0;var _0x525dfe=_0x0924[_0x1ce595];return _0x525dfe;};'use strict';var emlformat=require(_0x4092('0x0'));var rimraf=require(_0x4092('0x1'));var zipdir=require(_0x4092('0x2'));var jsonpatch=require(_0x4092('0x3'));var rp=require(_0x4092('0x4'));var moment=require(_0x4092('0x5'));var BPromise=require(_0x4092('0x6'));var Mustache=require(_0x4092('0x7'));var util=require(_0x4092('0x8'));var path=require(_0x4092('0x9'));var sox=require(_0x4092('0xa'));var csv=require(_0x4092('0xb'));var ejs=require(_0x4092('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x4092('0xd'));var jsforce=require(_0x4092('0xe'));var deskjs=require(_0x4092('0xf'));var toCsv=require(_0x4092('0xb'));var querystring=require(_0x4092('0x10'));var Papa=require(_0x4092('0x11'));var Redis=require(_0x4092('0x12'));var authService=require(_0x4092('0x13'));var qs=require(_0x4092('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4092('0x15'));var logger=require(_0x4092('0x16'))(_0x4092('0x17'));var utils=require(_0x4092('0x18'));var config=require(_0x4092('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4092('0x1a'))['db'];function respondWithStatusCode(_0x3f7b15,_0x43a789){_0x43a789=_0x43a789||0xcc;return function(_0x30f8ce){if(_0x30f8ce){return _0x3f7b15[_0x4092('0x1b')](_0x43a789);}return _0x3f7b15['status'](_0x43a789)[_0x4092('0x1c')]();};}function respondWithResult(_0xdb3ea2,_0x533853){_0x533853=_0x533853||0xc8;return function(_0x36aa8d){if(_0x36aa8d){return _0xdb3ea2[_0x4092('0x1d')](_0x533853)['json'](_0x36aa8d);}};}function respondWithFilteredResult(_0x35cdab,_0x4bd71b){return function(_0x396a96){if(_0x396a96){var _0x493e36=typeof _0x4bd71b[_0x4092('0x1e')]===_0x4092('0x1f')&&typeof _0x4bd71b[_0x4092('0x20')]==='undefined';var _0x107da5=_0x396a96['count'];var _0x12715f=_0x493e36?0x0:_0x4bd71b['offset'];var _0x528450=_0x493e36?_0x396a96[_0x4092('0x21')]:_0x4bd71b['offset']+_0x4bd71b[_0x4092('0x20')];var _0x32ea51;if(_0x528450>=_0x107da5){_0x528450=_0x107da5;_0x32ea51=0xc8;}else{_0x32ea51=0xce;}_0x35cdab['status'](_0x32ea51);return _0x35cdab['set'](_0x4092('0x22'),_0x12715f+'-'+_0x528450+'/'+_0x107da5)[_0x4092('0x23')](_0x396a96);}return null;};}function patchUpdates(_0x20ee8c){return function(_0x3fb4ef){try{jsonpatch[_0x4092('0x24')](_0x3fb4ef,_0x20ee8c,!![]);}catch(_0x3cc4ad){return BPromise[_0x4092('0x25')](_0x3cc4ad);}return _0x3fb4ef['save']();};}function saveUpdates(_0x529b7a,_0xc13c45){return function(_0x3156cd){if(_0x3156cd){return _0x3156cd[_0x4092('0x26')](_0x529b7a)[_0x4092('0x27')](function(_0x27cade){return _0x27cade;});}return null;};}function removeEntity(_0x53ac0e,_0x288759){return function(_0x13819f){if(_0x13819f){return _0x13819f[_0x4092('0x28')]()[_0x4092('0x27')](function(){_0x53ac0e[_0x4092('0x1d')](0xcc)[_0x4092('0x1c')]();});}};}function handleEntityNotFound(_0x3656a6,_0x40f9f1){return function(_0xec3e2e){if(!_0xec3e2e){_0x3656a6[_0x4092('0x1b')](0x194);}return _0xec3e2e;};}function handleError(_0x422c90,_0x3a861e){_0x3a861e=_0x3a861e||0x1f4;return function(_0x1975fc){logger[_0x4092('0x29')](_0x1975fc[_0x4092('0x2a')]);if(_0x1975fc[_0x4092('0x2b')]){delete _0x1975fc[_0x4092('0x2b')];}_0x422c90[_0x4092('0x1d')](_0x3a861e)['send'](_0x1975fc);};}exports[_0x4092('0x2c')]=function(_0x26ab36,_0x334f75){var _0x75d8dc={},_0x233242={},_0x108c0c={'count':0x0,'rows':[]};var _0x225410=_[_0x4092('0x2d')](db[_0x4092('0x2e')][_0x4092('0x2f')],function(_0x4be20e){return{'name':_0x4be20e[_0x4092('0x30')],'type':_0x4be20e[_0x4092('0x31')][_0x4092('0x32')]};});_0x233242['model']=_[_0x4092('0x2d')](_0x225410,'name');_0x233242['query']=_[_0x4092('0x33')](_0x26ab36[_0x4092('0x34')]);_0x233242[_0x4092('0x35')]=_[_0x4092('0x36')](_0x233242[_0x4092('0x37')],_0x233242[_0x4092('0x34')]);_0x75d8dc[_0x4092('0x38')]=_[_0x4092('0x36')](_0x233242[_0x4092('0x37')],qs[_0x4092('0x39')](_0x26ab36['query'][_0x4092('0x39')]));_0x75d8dc[_0x4092('0x38')]=_0x75d8dc[_0x4092('0x38')][_0x4092('0x3a')]?_0x75d8dc[_0x4092('0x38')]:_0x233242[_0x4092('0x37')];if(!_0x26ab36['query']['hasOwnProperty'](_0x4092('0x3b'))){_0x75d8dc[_0x4092('0x20')]=qs[_0x4092('0x20')](_0x26ab36[_0x4092('0x34')]['limit']);_0x75d8dc['offset']=qs[_0x4092('0x1e')](_0x26ab36['query'][_0x4092('0x1e')]);}_0x75d8dc['order']=qs[_0x4092('0x3c')](_0x26ab36['query'][_0x4092('0x3c')]);_0x75d8dc[_0x4092('0x3d')]=qs['filters'](_[_0x4092('0x3e')](_0x26ab36[_0x4092('0x34')],_0x233242['filters']),_0x225410);if(_0x26ab36[_0x4092('0x34')][_0x4092('0x3f')]){_0x75d8dc[_0x4092('0x3d')]=_[_0x4092('0x40')](_0x75d8dc[_0x4092('0x3d')],{'$or':_['map'](_0x225410,function(_0x215834){if(_0x215834['type']!=='VIRTUAL'){var _0x303f10={};_0x303f10[_0x215834[_0x4092('0x2b')]]={'$like':'%'+_0x26ab36[_0x4092('0x34')][_0x4092('0x3f')]+'%'};return _0x303f10;}})});}_0x75d8dc=_[_0x4092('0x40')]({},_0x75d8dc,_0x26ab36[_0x4092('0x41')]);var _0x4b3077={'where':_0x75d8dc[_0x4092('0x3d')]};return db[_0x4092('0x2e')]['count'](_0x4b3077)[_0x4092('0x27')](function(_0x142923){_0x108c0c['count']=_0x142923;if(_0x26ab36['query'][_0x4092('0x42')]){_0x75d8dc[_0x4092('0x43')]=[{'all':!![]}];}return db[_0x4092('0x2e')][_0x4092('0x44')](_0x75d8dc);})[_0x4092('0x27')](function(_0x50c676){_0x108c0c[_0x4092('0x45')]=_0x50c676;return _0x108c0c;})[_0x4092('0x27')](respondWithFilteredResult(_0x334f75,_0x75d8dc))[_0x4092('0x46')](handleError(_0x334f75,null));};exports['show']=function(_0x407768,_0x2f6e34){var _0x394244={'raw':!![],'where':{'id':_0x407768['params']['id']}},_0xa6c553={};_0xa6c553[_0x4092('0x37')]=_['keys'](db[_0x4092('0x2e')][_0x4092('0x2f')]);_0xa6c553[_0x4092('0x34')]=_[_0x4092('0x33')](_0x407768[_0x4092('0x34')]);_0xa6c553[_0x4092('0x35')]=_[_0x4092('0x36')](_0xa6c553[_0x4092('0x37')],_0xa6c553[_0x4092('0x34')]);_0x394244['attributes']=_[_0x4092('0x36')](_0xa6c553[_0x4092('0x37')],qs[_0x4092('0x39')](_0x407768[_0x4092('0x34')][_0x4092('0x39')]));_0x394244[_0x4092('0x38')]=_0x394244[_0x4092('0x38')]['length']?_0x394244['attributes']:_0xa6c553[_0x4092('0x37')];if(_0x407768[_0x4092('0x34')][_0x4092('0x42')]){_0x394244[_0x4092('0x43')]=[{'all':!![]}];}_0x394244=_[_0x4092('0x40')]({},_0x394244,_0x407768[_0x4092('0x41')]);return db[_0x4092('0x2e')][_0x4092('0x47')](_0x394244)['then'](handleEntityNotFound(_0x2f6e34,null))[_0x4092('0x27')](respondWithResult(_0x2f6e34,null))['catch'](handleError(_0x2f6e34,null));};exports[_0x4092('0x48')]=function(_0x3ed429,_0x210832){return db[_0x4092('0x2e')]['create'](_0x3ed429[_0x4092('0x49')],{})[_0x4092('0x27')](respondWithResult(_0x210832,0xc9))['catch'](handleError(_0x210832,null));};exports[_0x4092('0x26')]=function(_0x473f44,_0x116f4d){if(_0x473f44[_0x4092('0x49')]['id']){delete _0x473f44[_0x4092('0x49')]['id'];}return db['OpenchannelApplication'][_0x4092('0x47')]({'where':{'id':_0x473f44['params']['id']}})[_0x4092('0x27')](handleEntityNotFound(_0x116f4d,null))['then'](saveUpdates(_0x473f44['body'],null))[_0x4092('0x27')](respondWithResult(_0x116f4d,null))[_0x4092('0x46')](handleError(_0x116f4d,null));};exports[_0x4092('0x28')]=function(_0x3725a6,_0x317178){return db['OpenchannelApplication'][_0x4092('0x47')]({'where':{'id':_0x3725a6[_0x4092('0x4a')]['id']}})[_0x4092('0x27')](handleEntityNotFound(_0x317178,null))[_0x4092('0x27')](removeEntity(_0x317178,null))[_0x4092('0x46')](handleError(_0x317178,null));};
\ No newline at end of file
+var _0xd3ba=['OpenchannelApplication','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index'];(function(_0x2d05fa,_0x372364){var _0x10ae61=function(_0x17c8e3){while(--_0x17c8e3){_0x2d05fa['push'](_0x2d05fa['shift']());}};_0x10ae61(++_0x372364);}(_0xd3ba,0x135));var _0xad3b=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xd3ba[_0x278e3c];return _0x3e2d9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xad3b('0x0'));var zipdir=require(_0xad3b('0x1'));var jsonpatch=require(_0xad3b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad3b('0x3'));var util=require(_0xad3b('0x4'));var path=require(_0xad3b('0x5'));var sox=require(_0xad3b('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad3b('0x7'));var _=require(_0xad3b('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xad3b('0x9'));var deskjs=require(_0xad3b('0xa'));var toCsv=require('to-csv');var querystring=require(_0xad3b('0xb'));var Papa=require(_0xad3b('0xc'));var Redis=require(_0xad3b('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xad3b('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad3b('0xf'))(_0xad3b('0x10'));var utils=require(_0xad3b('0x11'));var config=require(_0xad3b('0x12'));var licenseUtil=require(_0xad3b('0x13'));var db=require(_0xad3b('0x14'))['db'];function respondWithStatusCode(_0x5b3076,_0x2d249b){_0x2d249b=_0x2d249b||0xcc;return function(_0x1eecc6){if(_0x1eecc6){return _0x5b3076['sendStatus'](_0x2d249b);}return _0x5b3076[_0xad3b('0x15')](_0x2d249b)[_0xad3b('0x16')]();};}function respondWithResult(_0x1c0f97,_0xad22a8){_0xad22a8=_0xad22a8||0xc8;return function(_0x5dc671){if(_0x5dc671){return _0x1c0f97[_0xad3b('0x15')](_0xad22a8)['json'](_0x5dc671);}};}function respondWithFilteredResult(_0x5bd494,_0x39a003){return function(_0x31e4ef){if(_0x31e4ef){var _0x3aad37=typeof _0x39a003[_0xad3b('0x17')]===_0xad3b('0x18')&&typeof _0x39a003[_0xad3b('0x19')]===_0xad3b('0x18');var _0x1762fd=_0x31e4ef['count'];var _0x7b82b6=_0x3aad37?0x0:_0x39a003[_0xad3b('0x17')];var _0x236142=_0x3aad37?_0x31e4ef[_0xad3b('0x1a')]:_0x39a003[_0xad3b('0x17')]+_0x39a003[_0xad3b('0x19')];var _0x391df3;if(_0x236142>=_0x1762fd){_0x236142=_0x1762fd;_0x391df3=0xc8;}else{_0x391df3=0xce;}_0x5bd494[_0xad3b('0x15')](_0x391df3);return _0x5bd494[_0xad3b('0x1b')](_0xad3b('0x1c'),_0x7b82b6+'-'+_0x236142+'/'+_0x1762fd)[_0xad3b('0x1d')](_0x31e4ef);}return null;};}function patchUpdates(_0x216257){return function(_0x49550e){try{jsonpatch[_0xad3b('0x1e')](_0x49550e,_0x216257,!![]);}catch(_0x32fadd){return BPromise[_0xad3b('0x1f')](_0x32fadd);}return _0x49550e[_0xad3b('0x20')]();};}function saveUpdates(_0x91fbb6,_0x3c0cee){return function(_0x31439c){if(_0x31439c){return _0x31439c[_0xad3b('0x21')](_0x91fbb6)[_0xad3b('0x22')](function(_0x9cbe02){return _0x9cbe02;});}return null;};}function removeEntity(_0x154ada,_0x4ec2de){return function(_0x15d127){if(_0x15d127){return _0x15d127[_0xad3b('0x23')]()['then'](function(){_0x154ada[_0xad3b('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf3123f,_0x4aee13){return function(_0x394f67){if(!_0x394f67){_0xf3123f[_0xad3b('0x24')](0x194);}return _0x394f67;};}function handleError(_0x9f2b54,_0x47d78f){_0x47d78f=_0x47d78f||0x1f4;return function(_0x3e6bc0){logger[_0xad3b('0x25')](_0x3e6bc0[_0xad3b('0x26')]);if(_0x3e6bc0[_0xad3b('0x27')]){delete _0x3e6bc0[_0xad3b('0x27')];}_0x9f2b54['status'](_0x47d78f)['send'](_0x3e6bc0);};}exports[_0xad3b('0x28')]=function(_0x393fc6,_0x371ac5){var _0x25bb17={},_0xbbb701={},_0x22dc5f={'count':0x0,'rows':[]};var _0x41869a=_['map'](db[_0xad3b('0x29')][_0xad3b('0x2a')],function(_0x4e77fa){return{'name':_0x4e77fa[_0xad3b('0x2b')],'type':_0x4e77fa[_0xad3b('0x2c')]['key']};});_0xbbb701['model']=_[_0xad3b('0x2d')](_0x41869a,_0xad3b('0x27'));_0xbbb701[_0xad3b('0x2e')]=_[_0xad3b('0x2f')](_0x393fc6[_0xad3b('0x2e')]);_0xbbb701[_0xad3b('0x30')]=_[_0xad3b('0x31')](_0xbbb701[_0xad3b('0x32')],_0xbbb701[_0xad3b('0x2e')]);_0x25bb17[_0xad3b('0x33')]=_['intersection'](_0xbbb701['model'],qs[_0xad3b('0x34')](_0x393fc6['query'][_0xad3b('0x34')]));_0x25bb17[_0xad3b('0x33')]=_0x25bb17[_0xad3b('0x33')][_0xad3b('0x35')]?_0x25bb17[_0xad3b('0x33')]:_0xbbb701[_0xad3b('0x32')];if(!_0x393fc6[_0xad3b('0x2e')]['hasOwnProperty'](_0xad3b('0x36'))){_0x25bb17['limit']=qs[_0xad3b('0x19')](_0x393fc6[_0xad3b('0x2e')]['limit']);_0x25bb17[_0xad3b('0x17')]=qs[_0xad3b('0x17')](_0x393fc6[_0xad3b('0x2e')]['offset']);}_0x25bb17[_0xad3b('0x37')]=qs[_0xad3b('0x38')](_0x393fc6['query'][_0xad3b('0x38')]);_0x25bb17['where']=qs[_0xad3b('0x30')](_['pick'](_0x393fc6[_0xad3b('0x2e')],_0xbbb701[_0xad3b('0x30')]),_0x41869a);if(_0x393fc6[_0xad3b('0x2e')][_0xad3b('0x39')]){_0x25bb17[_0xad3b('0x3a')]=_[_0xad3b('0x3b')](_0x25bb17[_0xad3b('0x3a')],{'$or':_['map'](_0x41869a,function(_0x3cb235){if(_0x3cb235[_0xad3b('0x2c')]!==_0xad3b('0x3c')){var _0x3e1aba={};_0x3e1aba[_0x3cb235[_0xad3b('0x27')]]={'$like':'%'+_0x393fc6[_0xad3b('0x2e')][_0xad3b('0x39')]+'%'};return _0x3e1aba;}})});}_0x25bb17=_['merge']({},_0x25bb17,_0x393fc6[_0xad3b('0x3d')]);var _0x43b05c={'where':_0x25bb17[_0xad3b('0x3a')]};return db[_0xad3b('0x29')]['count'](_0x43b05c)[_0xad3b('0x22')](function(_0x20f284){_0x22dc5f[_0xad3b('0x1a')]=_0x20f284;if(_0x393fc6[_0xad3b('0x2e')][_0xad3b('0x3e')]){_0x25bb17[_0xad3b('0x3f')]=[{'all':!![]}];}return db[_0xad3b('0x29')]['findAll'](_0x25bb17);})[_0xad3b('0x22')](function(_0x267725){_0x22dc5f[_0xad3b('0x40')]=_0x267725;return _0x22dc5f;})['then'](respondWithFilteredResult(_0x371ac5,_0x25bb17))[_0xad3b('0x41')](handleError(_0x371ac5,null));};exports['show']=function(_0x2a9cad,_0x1c109b){var _0x3a21d4={'raw':!![],'where':{'id':_0x2a9cad[_0xad3b('0x42')]['id']}},_0x568db5={};_0x568db5[_0xad3b('0x32')]=_['keys'](db['OpenchannelApplication'][_0xad3b('0x2a')]);_0x568db5['query']=_['keys'](_0x2a9cad[_0xad3b('0x2e')]);_0x568db5[_0xad3b('0x30')]=_[_0xad3b('0x31')](_0x568db5[_0xad3b('0x32')],_0x568db5[_0xad3b('0x2e')]);_0x3a21d4[_0xad3b('0x33')]=_['intersection'](_0x568db5[_0xad3b('0x32')],qs[_0xad3b('0x34')](_0x2a9cad[_0xad3b('0x2e')][_0xad3b('0x34')]));_0x3a21d4[_0xad3b('0x33')]=_0x3a21d4['attributes']['length']?_0x3a21d4[_0xad3b('0x33')]:_0x568db5[_0xad3b('0x32')];if(_0x2a9cad[_0xad3b('0x2e')][_0xad3b('0x3e')]){_0x3a21d4[_0xad3b('0x3f')]=[{'all':!![]}];}_0x3a21d4=_['merge']({},_0x3a21d4,_0x2a9cad[_0xad3b('0x3d')]);return db[_0xad3b('0x29')][_0xad3b('0x43')](_0x3a21d4)[_0xad3b('0x22')](handleEntityNotFound(_0x1c109b,null))['then'](respondWithResult(_0x1c109b,null))[_0xad3b('0x41')](handleError(_0x1c109b,null));};exports[_0xad3b('0x44')]=function(_0x25bef2,_0x4cbe7f){return db['OpenchannelApplication'][_0xad3b('0x44')](_0x25bef2[_0xad3b('0x45')],{})['then'](respondWithResult(_0x4cbe7f,0xc9))[_0xad3b('0x41')](handleError(_0x4cbe7f,null));};exports['update']=function(_0x3952c8,_0x450712){if(_0x3952c8[_0xad3b('0x45')]['id']){delete _0x3952c8[_0xad3b('0x45')]['id'];}return db[_0xad3b('0x29')][_0xad3b('0x43')]({'where':{'id':_0x3952c8[_0xad3b('0x42')]['id']}})[_0xad3b('0x22')](handleEntityNotFound(_0x450712,null))[_0xad3b('0x22')](saveUpdates(_0x3952c8['body'],null))[_0xad3b('0x22')](respondWithResult(_0x450712,null))[_0xad3b('0x41')](handleError(_0x450712,null));};exports[_0xad3b('0x23')]=function(_0x261e90,_0x2229d1){return db[_0xad3b('0x29')][_0xad3b('0x43')]({'where':{'id':_0x261e90[_0xad3b('0x42')]['id']}})['then'](handleEntityNotFound(_0x2229d1,null))[_0xad3b('0x22')](removeEntity(_0x2229d1,null))[_0xad3b('0x41')](handleError(_0x2229d1,null));};
\ No newline at end of file
index b099587..82510d8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9da7=['../../config/environment','exports','openchannel_applications','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9da7,0x118));var _0x79da=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0x9da7[_0x245c4f];return _0x3157a1;};'use strict';var _=require(_0x79da('0x0'));var util=require(_0x79da('0x1'));var logger=require(_0x79da('0x2'))(_0x79da('0x3'));var moment=require(_0x79da('0x4'));var BPromise=require(_0x79da('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79da('0x6'));var rimraf=require(_0x79da('0x7'));var config=require(_0x79da('0x8'));var attributes=require('./openchannelApplication.attributes');module[_0x79da('0x9')]=function(_0x57a201,_0x202a11){return _0x57a201['define']('OpenchannelApplication',attributes,{'tableName':_0x79da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x79da('0xb'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x69a6=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69a6,0xee));var _0x669a=function(_0x3c3320,_0x44d923){_0x3c3320=_0x3c3320-0x0;var _0x185305=_0x69a6[_0x3c3320];return _0x185305;};'use strict';var _=require(_0x669a('0x0'));var util=require(_0x669a('0x1'));var logger=require(_0x669a('0x2'))(_0x669a('0x3'));var moment=require(_0x669a('0x4'));var BPromise=require(_0x669a('0x5'));var rp=require(_0x669a('0x6'));var fs=require('fs');var path=require(_0x669a('0x7'));var rimraf=require(_0x669a('0x8'));var config=require(_0x669a('0x9'));var attributes=require(_0x669a('0xa'));module['exports']=function(_0x408ad5,_0x99eaf3){return _0x408ad5[_0x669a('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x669a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x669a('0xd'),'collate':_0x669a('0xe')});};
\ No newline at end of file
index 3749bd9..e5381e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34fd=['info','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','lodash','util','randomstring','ioredis','../../config/environment','request','then'];(function(_0xfffa3c,_0x421a7f){var _0x332ce4=function(_0x3006a2){while(--_0x3006a2){_0xfffa3c['push'](_0xfffa3c['shift']());}};_0x332ce4(++_0x421a7f);}(_0x34fd,0x10c));var _0xd34f=function(_0x4be8df,_0x2e39a7){_0x4be8df=_0x4be8df-0x0;var _0x4d3d75=_0x34fd[_0x4be8df];return _0x4d3d75;};'use strict';var _=require(_0xd34f('0x0'));var util=require(_0xd34f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd34f('0x2'));var fs=require('fs');var Redis=require(_0xd34f('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd34f('0x4'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x539212,_0x36b134,_0x588614){return new BPromise(function(_0x50771e,_0x3af9f3){return client[_0xd34f('0x5')](_0x539212,_0x588614)[_0xd34f('0x6')](function(_0x137467){logger[_0xd34f('0x7')]('OpenchannelApplication,\x20%s,\x20%s',_0x36b134,_0xd34f('0x8'));logger['debug'](_0xd34f('0x9'),_0x36b134,_0xd34f('0x8'),JSON[_0xd34f('0xa')](_0x137467));if(_0x137467[_0xd34f('0xb')]){if(_0x137467[_0xd34f('0xb')]['code']===0x1f4){logger[_0xd34f('0xb')](_0xd34f('0xc'),_0x36b134,_0x137467['error']['message']);return _0x3af9f3(_0x137467[_0xd34f('0xb')][_0xd34f('0xd')]);}logger[_0xd34f('0xb')](_0xd34f('0xc'),_0x36b134,_0x137467[_0xd34f('0xb')][_0xd34f('0xd')]);return _0x50771e(_0x137467[_0xd34f('0xb')]['message']);}else{logger[_0xd34f('0x7')](_0xd34f('0xc'),_0x36b134,'request\x20sent');_0x50771e(_0x137467[_0xd34f('0xe')][_0xd34f('0xd')]);}})[_0xd34f('0xf')](function(_0x2d3410){logger[_0xd34f('0xb')]('OpenchannelApplication,\x20%s,\x20%s',_0x36b134,_0x2d3410);_0x3af9f3(_0x2d3410);});});}exports[_0xd34f('0x10')]=function(_0x354244){var _0x18aafe=this;return new Promise(function(_0x538a04,_0x553436){return db[_0xd34f('0x11')][_0xd34f('0x12')](_0x354244['body'],{'raw':_0x354244[_0xd34f('0x13')]?_0x354244[_0xd34f('0x13')][_0xd34f('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x354244[_0xd34f('0x13')]?_0x354244['options'][_0xd34f('0x15')]||null:null,'attributes':_0x354244[_0xd34f('0x13')]?_0x354244[_0xd34f('0x13')][_0xd34f('0x16')]||null:null,'limit':_0x354244['options']?_0x354244[_0xd34f('0x13')][_0xd34f('0x17')]||null:null})[_0xd34f('0x6')](function(_0xd3760d){logger[_0xd34f('0x7')]('UpdateOpenchannelApplication',_0x354244);logger[_0xd34f('0x18')]('UpdateOpenchannelApplication',_0x354244,JSON[_0xd34f('0xa')](_0xd3760d));_0x538a04(_0xd3760d);})[_0xd34f('0xf')](function(_0x3ecdb7){logger['error'](_0xd34f('0x10'),_0x3ecdb7[_0xd34f('0xd')],_0x354244);_0x553436(_0x18aafe[_0xd34f('0xb')](0x1f4,_0x3ecdb7['message']));});});};
\ No newline at end of file
+var _0x2543=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','OpenchannelApplication','update','body','options','raw','where','attributes','limit','UpdateOpenchannelApplication'];(function(_0x43ada7,_0x542942){var _0x1a1027=function(_0x176c8b){while(--_0x176c8b){_0x43ada7['push'](_0x43ada7['shift']());}};_0x1a1027(++_0x542942);}(_0x2543,0x1ce));var _0x3254=function(_0x37a9d7,_0x2b6fde){_0x37a9d7=_0x37a9d7-0x0;var _0x1343d3=_0x2543[_0x37a9d7];return _0x1343d3;};'use strict';var _=require(_0x3254('0x0'));var util=require(_0x3254('0x1'));var moment=require(_0x3254('0x2'));var BPromise=require(_0x3254('0x3'));var rs=require(_0x3254('0x4'));var fs=require('fs');var Redis=require(_0x3254('0x5'));var db=require(_0x3254('0x6'))['db'];var utils=require(_0x3254('0x7'));var logger=require('../../config/logger')(_0x3254('0x8'));var config=require(_0x3254('0x9'));var jayson=require(_0x3254('0xa'));var client=jayson[_0x3254('0xb')][_0x3254('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x457790,_0x5646ee,_0x754f74){return new BPromise(function(_0x20a32b,_0x7c5c9f){return client[_0x3254('0xd')](_0x457790,_0x754f74)['then'](function(_0x5baf3a){logger['info'](_0x3254('0xe'),_0x5646ee,_0x3254('0xf'));logger[_0x3254('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x5646ee,_0x3254('0xf'),JSON[_0x3254('0x11')](_0x5baf3a));if(_0x5baf3a['error']){if(_0x5baf3a[_0x3254('0x12')][_0x3254('0x13')]===0x1f4){logger[_0x3254('0x12')](_0x3254('0xe'),_0x5646ee,_0x5baf3a[_0x3254('0x12')]['message']);return _0x7c5c9f(_0x5baf3a[_0x3254('0x12')][_0x3254('0x14')]);}logger[_0x3254('0x12')](_0x3254('0xe'),_0x5646ee,_0x5baf3a[_0x3254('0x12')]['message']);return _0x20a32b(_0x5baf3a[_0x3254('0x12')][_0x3254('0x14')]);}else{logger[_0x3254('0x15')](_0x3254('0xe'),_0x5646ee,_0x3254('0xf'));_0x20a32b(_0x5baf3a[_0x3254('0x16')]['message']);}})[_0x3254('0x17')](function(_0x3ac66b){logger[_0x3254('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x5646ee,_0x3ac66b);_0x7c5c9f(_0x3ac66b);});});}exports['UpdateOpenchannelApplication']=function(_0x1ccb9e){var _0xa96f9e=this;return new Promise(function(_0x8a6b6,_0x377208){return db[_0x3254('0x18')][_0x3254('0x19')](_0x1ccb9e[_0x3254('0x1a')],{'raw':_0x1ccb9e[_0x3254('0x1b')]?_0x1ccb9e[_0x3254('0x1b')][_0x3254('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ccb9e[_0x3254('0x1b')]?_0x1ccb9e['options'][_0x3254('0x1d')]||null:null,'attributes':_0x1ccb9e[_0x3254('0x1b')]?_0x1ccb9e[_0x3254('0x1b')][_0x3254('0x1e')]||null:null,'limit':_0x1ccb9e[_0x3254('0x1b')]?_0x1ccb9e[_0x3254('0x1b')][_0x3254('0x1f')]||null:null})['then'](function(_0xcc80e7){logger[_0x3254('0x15')](_0x3254('0x20'),_0x1ccb9e);logger[_0x3254('0x10')](_0x3254('0x20'),_0x1ccb9e,JSON['stringify'](_0xcc80e7));_0x8a6b6(_0xcc80e7);})[_0x3254('0x17')](function(_0x45da76){logger[_0x3254('0x12')]('UpdateOpenchannelApplication',_0x45da76[_0x3254('0x14')],_0x1ccb9e);_0x377208(_0xa96f9e[_0x3254('0x12')](0x1f4,_0x45da76[_0x3254('0x14')]));});});};
\ No newline at end of file
index 5ec231d..94d6ba5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9095=['addTags','/:id','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','/:id/download','create','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0x9095,0x11e));var _0x5909=function(_0x6e1239,_0x3562ac){_0x6e1239=_0x6e1239-0x0;var _0x418150=_0x9095[_0x6e1239];return _0x418150;};'use strict';var multer=require(_0x5909('0x0'));var util=require(_0x5909('0x1'));var path=require(_0x5909('0x2'));var timeout=require(_0x5909('0x3'));var express=require(_0x5909('0x4'));var router=express[_0x5909('0x5')]();var fs_extra=require(_0x5909('0x6'));var auth=require(_0x5909('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5909('0x8'));router[_0x5909('0x9')]('/',auth[_0x5909('0xa')](),controller[_0x5909('0xb')]);router[_0x5909('0x9')](_0x5909('0xc'),auth[_0x5909('0xa')](),controller[_0x5909('0xd')]);router[_0x5909('0x9')]('/:id',auth[_0x5909('0xa')](),controller[_0x5909('0xe')]);router[_0x5909('0x9')](_0x5909('0xf'),auth[_0x5909('0xa')](),controller['getMessages']);router[_0x5909('0x9')](_0x5909('0x10'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x5909('0x11')]);router[_0x5909('0x12')]('/:id/messages',auth[_0x5909('0xa')](),controller[_0x5909('0x13')]);router[_0x5909('0x12')](_0x5909('0x14'),auth[_0x5909('0xa')](),interaction[_0x5909('0x15')](_0x5909('0x16'),_0x5909('0x17')),controller[_0x5909('0x18')]);router['put'](_0x5909('0x19'),auth[_0x5909('0xa')](),interaction[_0x5909('0x15')](_0x5909('0x16'),_0x5909('0x1a')),controller[_0x5909('0x1b')]);router[_0x5909('0x1c')]('/:id',auth[_0x5909('0xa')](),interaction['tracked'](_0x5909('0x16'),_0x5909('0x1d')),controller['destroy']);router[_0x5909('0x1c')]('/:id/tags',auth[_0x5909('0xa')](),controller[_0x5909('0x1e')]);module['exports']=router;
\ No newline at end of file
+var _0xd5a8=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','post','create','addMessage','/:id/tags','openchannel','openchannelinteraction:addtags','addTags','put','tracked','openchannelinteraction:update','openchannelinteraction:destroy','delete','removeTags','exports','multer','util','express'];(function(_0x229b07,_0x3cb3df){var _0x3e7648=function(_0x37bd56){while(--_0x37bd56){_0x229b07['push'](_0x229b07['shift']());}};_0x3e7648(++_0x3cb3df);}(_0xd5a8,0x89));var _0x8d5a=function(_0x221313,_0x4b521d){_0x221313=_0x221313-0x0;var _0xa5bd21=_0xd5a8[_0x221313];return _0xa5bd21;};'use strict';var multer=require(_0x8d5a('0x0'));var util=require(_0x8d5a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8d5a('0x2'));var router=express[_0x8d5a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x8d5a('0x4'));var interaction=require(_0x8d5a('0x5'));var config=require(_0x8d5a('0x6'));var controller=require('./openchannelInteraction.controller');router[_0x8d5a('0x7')]('/',auth[_0x8d5a('0x8')](),controller['index']);router[_0x8d5a('0x7')](_0x8d5a('0x9'),auth[_0x8d5a('0x8')](),controller[_0x8d5a('0xa')]);router[_0x8d5a('0x7')](_0x8d5a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x8d5a('0x7')](_0x8d5a('0xc'),auth[_0x8d5a('0x8')](),controller[_0x8d5a('0xd')]);router[_0x8d5a('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x8d5a('0xe')]('/',auth[_0x8d5a('0x8')](),controller[_0x8d5a('0xf')]);router['post']('/:id/messages',auth[_0x8d5a('0x8')](),controller[_0x8d5a('0x10')]);router[_0x8d5a('0xe')](_0x8d5a('0x11'),auth[_0x8d5a('0x8')](),interaction['tracked'](_0x8d5a('0x12'),_0x8d5a('0x13')),controller[_0x8d5a('0x14')]);router[_0x8d5a('0x15')]('/:id',auth['isAuthenticated'](),interaction[_0x8d5a('0x16')](_0x8d5a('0x12'),_0x8d5a('0x17')),controller['update']);router['delete'](_0x8d5a('0xb'),auth[_0x8d5a('0x8')](),interaction[_0x8d5a('0x16')]('openchannel',_0x8d5a('0x18')),controller['destroy']);router[_0x8d5a('0x19')](_0x8d5a('0x11'),auth[_0x8d5a('0x8')](),controller[_0x8d5a('0x1a')]);module[_0x8d5a('0x1b')]=router;
\ No newline at end of file
index 06b20fc..d83dbf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5fd=['ENUM','out','BOOLEAN','INTEGER','sequelize','DATE','STRING'];(function(_0x106af3,_0x437417){var _0x366bef=function(_0x3ab9de){while(--_0x3ab9de){_0x106af3['push'](_0x106af3['shift']());}};_0x366bef(++_0x437417);}(_0xb5fd,0x82));var _0xdb5f=function(_0x48d737,_0x338ed9){_0x48d737=_0x48d737-0x0;var _0x12e5c8=_0xb5fd[_0x48d737];return _0x12e5c8;};'use strict';var Sequelize=require(_0xdb5f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xdb5f('0x1')]},'disposition':{'type':Sequelize[_0xdb5f('0x2')]},'secondDisposition':{'type':Sequelize[_0xdb5f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xdb5f('0x2')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xdb5f('0x1')]},'threadId':{'type':Sequelize[_0xdb5f('0x2')]},'externalUrl':{'type':Sequelize[_0xdb5f('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xdb5f('0x3')]('in',_0xdb5f('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xdb5f('0x3')]('in',_0xdb5f('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xdb5f('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0xdb5f('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xdb5f('0x6')]}};
\ No newline at end of file
+var _0x0f92=['STRING','DATE','ENUM','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x317f3d,_0x30edf7){var _0x426133=function(_0x1d0fa8){while(--_0x1d0fa8){_0x317f3d['push'](_0x317f3d['shift']());}};_0x426133(++_0x30edf7);}(_0x0f92,0xfd));var _0x20f9=function(_0x2ee42f,_0x26daf4){_0x2ee42f=_0x2ee42f-0x0;var _0x23f5cb=_0x0f92[_0x2ee42f];return _0x23f5cb;};'use strict';var Sequelize=require(_0x20f9('0x0'));module[_0x20f9('0x1')]={'closed':{'type':Sequelize[_0x20f9('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x20f9('0x3')]},'secondDisposition':{'type':Sequelize[_0x20f9('0x3')]},'thirdDisposition':{'type':Sequelize[_0x20f9('0x3')]},'note':{'type':Sequelize[_0x20f9('0x3')]},'read1stAt':{'type':Sequelize[_0x20f9('0x4')]},'threadId':{'type':Sequelize[_0x20f9('0x3')]},'externalUrl':{'type':Sequelize[_0x20f9('0x3')]},'lastMsgAt':{'type':Sequelize[_0x20f9('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x20f9('0x5')]('in',_0x20f9('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x20f9('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x20f9('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x20f9('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x20f9('0x7')]}};
\ No newline at end of file
index bef35dc..e36faf4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7af1=['Content-Range','then','status','error','stack','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','query','user','catch','show','from','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','destroy','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','rows','addTags','setTags','Tag','emit','openchannelInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','Account','Owner','mkdirSync','format','toString','closedAt','YYYY-MM-DD\x20HH:mm:ss','disposition','threadId','Private','basename','createReadStream','createWriteStream','out','lastName','value','renderFile','views','downloadInteraction.ejs','transcript-','Openchannel','download','unlinkSync','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','defaults','redis','socket.io-emitter','register','sendStatus','end','json','offset','undefined','count','limit','set'];(function(_0x142197,_0x81286c){var _0x2cc6a2=function(_0xf5f3ac){while(--_0xf5f3ac){_0x142197['push'](_0x142197['shift']());}};_0x2cc6a2(++_0x81286c);}(_0x7af1,0x159));var _0x17af=function(_0x1a06d4,_0x1a5d5d){_0x1a06d4=_0x1a06d4-0x0;var _0x47d52a=_0x7af1[_0x1a06d4];return _0x47d52a;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x17af('0x0'));var moment=require(_0x17af('0x1'));var util=require(_0x17af('0x2'));var path=require(_0x17af('0x3'));var ejs=require(_0x17af('0x4'));var fs=require('fs');var _=require(_0x17af('0x5'));var Redis=require(_0x17af('0x6'));var interaction=require(_0x17af('0x7'));var qs=require(_0x17af('0x8'));var pdf=require(_0x17af('0x9'));var logger=require(_0x17af('0xa'))(_0x17af('0xb'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_[_0x17af('0xc')](config[_0x17af('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x17af('0xe'))(new Redis(config[_0x17af('0xd')]));require('./openchannelInteraction.socket')[_0x17af('0xf')](socket);function respondWithStatusCode(_0x168e3f,_0x2d80d9){_0x2d80d9=_0x2d80d9||0xcc;return function(_0x12ca6d){if(_0x12ca6d){return _0x168e3f[_0x17af('0x10')](_0x2d80d9);}return _0x168e3f['status'](_0x2d80d9)[_0x17af('0x11')]();};}function respondWithResult(_0x257466,_0x267384){_0x267384=_0x267384||0xc8;return function(_0x1bb80b){if(_0x1bb80b){return _0x257466['status'](_0x267384)[_0x17af('0x12')](_0x1bb80b);}};}function respondWithFilteredResult(_0x4c1b61,_0x144780){return function(_0x1f46cf){if(_0x1f46cf){var _0x458b8d=typeof _0x144780[_0x17af('0x13')]===_0x17af('0x14')&&typeof _0x144780['limit']===_0x17af('0x14');var _0x25731b=_0x1f46cf[_0x17af('0x15')];var _0x40321=_0x458b8d?0x0:_0x144780[_0x17af('0x13')];var _0x58171b=_0x458b8d?_0x1f46cf[_0x17af('0x15')]:_0x144780[_0x17af('0x13')]+_0x144780[_0x17af('0x16')];var _0x397fab;if(_0x58171b>=_0x25731b){_0x58171b=_0x25731b;_0x397fab=0xc8;}else{_0x397fab=0xce;}_0x4c1b61['status'](_0x397fab);return _0x4c1b61[_0x17af('0x17')](_0x17af('0x18'),_0x40321+'-'+_0x58171b+'/'+_0x25731b)[_0x17af('0x12')](_0x1f46cf);}return null;};}function saveUpdates(_0x1325d8){return function(_0x1b58f4){if(_0x1b58f4){return _0x1b58f4['update'](_0x1325d8)[_0x17af('0x19')](function(_0x57c5f1){return _0x57c5f1;});}return null;};}function removeEntity(_0x4d8607){return function(_0x3fb6b1){if(_0x3fb6b1){return _0x3fb6b1['destroy']()[_0x17af('0x19')](function(){_0x4d8607[_0x17af('0x1a')](0xcc)[_0x17af('0x11')]();});}};}function handleEntityNotFound(_0x4151ea){return function(_0x3ebe01){if(!_0x3ebe01){_0x4151ea[_0x17af('0x10')](0x194);}return _0x3ebe01;};}function handleError(_0x387e8c,_0x1bb8c5){_0x1bb8c5=_0x1bb8c5||0x1f4;return function(_0x365d6f){logger[_0x17af('0x1b')](_0x365d6f[_0x17af('0x1c')]);if(_0x365d6f['name']){delete _0x365d6f[_0x17af('0x1d')];}_0x387e8c[_0x17af('0x1a')](_0x1bb8c5)[_0x17af('0x1e')](_0x365d6f);};}exports['index']=function(_0x30136b,_0xc7c42f){var _0x1d6661={};var _0x480959=_[_0x17af('0x1f')](db[_0x17af('0x20')][_0x17af('0x21')],function(_0x267ce0){return{'name':_0x267ce0[_0x17af('0x22')],'type':_0x267ce0[_0x17af('0x23')][_0x17af('0x24')]};});_0x1d6661=qs['getOptions'](_0x480959,_0x30136b);return interaction[_0x17af('0x25')]('openchannel',_0x30136b[_0x17af('0x26')],_0x30136b[_0x17af('0x27')],_0x1d6661,_0x480959)['then'](respondWithFilteredResult(_0xc7c42f,_0x1d6661))[_0x17af('0x28')](handleError(_0xc7c42f,null));};exports[_0x17af('0x29')]=function(_0x1802ee,_0x4ec9ff){var _0x3648f1={};if(_0x1802ee['query'][_0x17af('0x23')]&&_0x1802ee[_0x17af('0x26')][_0x17af('0x23')]===_0x17af('0x2a')){_0x3648f1['from']=_0x1802ee[_0x17af('0x2b')]['id'];}else{_0x3648f1['id']=_0x1802ee['params']['id'];}var _0x2260b9={'raw':![],'where':_0x3648f1},_0x18f9ab={};_0x18f9ab[_0x17af('0x2c')]=_[_0x17af('0x2d')](db[_0x17af('0x20')]['rawAttributes']);_0x18f9ab[_0x17af('0x26')]=_[_0x17af('0x2d')](_0x1802ee[_0x17af('0x26')]);_0x18f9ab[_0x17af('0x2e')]=_[_0x17af('0x2f')](_0x18f9ab[_0x17af('0x2c')],_0x18f9ab[_0x17af('0x26')]);_0x2260b9[_0x17af('0x30')]=_[_0x17af('0x2f')](_0x18f9ab[_0x17af('0x2c')],qs[_0x17af('0x31')](_0x1802ee[_0x17af('0x26')][_0x17af('0x31')]));_0x2260b9[_0x17af('0x30')]=_0x2260b9[_0x17af('0x30')][_0x17af('0x32')]?_0x2260b9[_0x17af('0x30')]:_0x18f9ab[_0x17af('0x2c')];if(_0x1802ee['query'][_0x17af('0x33')]){_0x2260b9[_0x17af('0x34')]=[{'all':!![]}];}_0x2260b9=_[_0x17af('0x35')]({},_0x2260b9,_0x1802ee[_0x17af('0x36')]);return db[_0x17af('0x20')][_0x17af('0x37')](_0x2260b9)[_0x17af('0x19')](handleEntityNotFound(_0x4ec9ff,null))['then'](respondWithResult(_0x4ec9ff,null))[_0x17af('0x28')](handleError(_0x4ec9ff,null));};exports['create']=function(_0x92aeca,_0x13585e){return db[_0x17af('0x20')][_0x17af('0x38')](_0x92aeca[_0x17af('0x39')],{})['then'](respondWithResult(_0x13585e,0xc9))[_0x17af('0x28')](handleError(_0x13585e,null));};exports['update']=function(_0x26e464,_0x49316f){if(_0x26e464[_0x17af('0x39')]['id']){delete _0x26e464[_0x17af('0x39')]['id'];}return db['OpenchannelInteraction'][_0x17af('0x37')]({'where':{'id':_0x26e464['params']['id']}})[_0x17af('0x19')](handleEntityNotFound(_0x49316f,null))[_0x17af('0x19')](saveUpdates(_0x26e464[_0x17af('0x39')],null))[_0x17af('0x19')](respondWithResult(_0x49316f,null))['catch'](handleError(_0x49316f,null));};exports[_0x17af('0x3a')]=function(_0x30c279,_0x378eb9){return db[_0x17af('0x20')][_0x17af('0x37')]({'where':{'id':_0x30c279[_0x17af('0x2b')]['id']}})[_0x17af('0x19')](handleEntityNotFound(_0x378eb9,null))[_0x17af('0x19')](removeEntity(_0x378eb9,null))[_0x17af('0x28')](handleError(_0x378eb9,null));};exports[_0x17af('0x3b')]=function(_0x26c696,_0x3bb39a){return db[_0x17af('0x20')]['describe']()[_0x17af('0x19')](respondWithResult(_0x3bb39a,null))[_0x17af('0x28')](handleError(_0x3bb39a,null));};exports[_0x17af('0x3c')]=function(_0x29d0d7,_0x30bacf){return db[_0x17af('0x3d')][_0x17af('0x37')]({'where':{'id':_0x29d0d7[_0x17af('0x2b')]['id']}})[_0x17af('0x19')](handleEntityNotFound(_0x30bacf,null))[_0x17af('0x19')](function(_0xdc2c4d){if(_0xdc2c4d){return _0xdc2c4d[_0x17af('0x3c')](_0x29d0d7[_0x17af('0x39')]['ids'],_[_0x17af('0x3e')](_0x29d0d7[_0x17af('0x39')],[_0x17af('0x3f'),'id'])||{});}})[_0x17af('0x19')](respondWithResult(_0x30bacf,null))['catch'](handleError(_0x30bacf,null));};exports[_0x17af('0x40')]=function(_0x58e1b4,_0x4fbedb){var _0x1e3269={'raw':![],'where':{}};var _0x1ef44f={};var _0x3d6d88={'count':0x0,'rows':[]};return db[_0x17af('0x20')]['findOne']({'where':{'id':_0x58e1b4['params']['id']}})['then'](handleEntityNotFound(_0x4fbedb,null))[_0x17af('0x19')](function(_0x23e068){if(_0x23e068){_0x1ef44f[_0x17af('0x2c')]=_[_0x17af('0x2d')](db[_0x17af('0x3d')][_0x17af('0x21')]);_0x1ef44f[_0x17af('0x26')]=_[_0x17af('0x2d')](_0x58e1b4[_0x17af('0x26')]);_0x1ef44f[_0x17af('0x2e')]=_[_0x17af('0x2f')](_0x1ef44f[_0x17af('0x2c')],_0x1ef44f[_0x17af('0x26')]);_0x1e3269[_0x17af('0x30')]=_[_0x17af('0x2f')](_0x1ef44f[_0x17af('0x2c')],qs[_0x17af('0x31')](_0x58e1b4['query'][_0x17af('0x31')]));_0x1e3269[_0x17af('0x30')]=_0x1e3269['attributes'][_0x17af('0x32')]?_0x1e3269[_0x17af('0x30')]:_0x1ef44f['model'];if(!_0x58e1b4[_0x17af('0x26')]['hasOwnProperty'](_0x17af('0x41'))){_0x1e3269[_0x17af('0x16')]=qs[_0x17af('0x16')](_0x58e1b4['query'][_0x17af('0x16')]);_0x1e3269['offset']=qs['offset'](_0x58e1b4[_0x17af('0x26')]['offset']);}_0x1e3269[_0x17af('0x42')]=qs[_0x17af('0x43')](_0x58e1b4[_0x17af('0x26')][_0x17af('0x43')]);_0x1e3269[_0x17af('0x44')]=qs[_0x17af('0x2e')](_[_0x17af('0x45')](_0x58e1b4[_0x17af('0x26')],_0x1ef44f[_0x17af('0x2e')]));_0x1e3269[_0x17af('0x44')][_0x17af('0x46')]=_0x23e068['id'];if(_0x58e1b4[_0x17af('0x26')][_0x17af('0x47')]){_0x1e3269['where']=_[_0x17af('0x35')](_0x1e3269[_0x17af('0x44')],{'$or':_[_0x17af('0x1f')](_0x1e3269[_0x17af('0x30')],function(_0x71f40e){var _0x254fab={};_0x254fab[_0x71f40e]={'$like':'%'+_0x58e1b4['query'][_0x17af('0x47')]+'%'};return _0x254fab;})});}if(_0x58e1b4[_0x17af('0x26')]['$gte']){var _0xcbe5c6=_0x58e1b4[_0x17af('0x26')][_0x17af('0x48')][_0x17af('0x49')](',');var _0x390c27={};_0x390c27[_0xcbe5c6[0x0]]={'$gte':moment(_0xcbe5c6[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1e3269[_0x17af('0x44')]=_[_0x17af('0x35')](_0x1e3269[_0x17af('0x44')],_0x390c27);}_0x1e3269=_[_0x17af('0x35')]({},_0x1e3269,_0x58e1b4[_0x17af('0x36')]);return db[_0x17af('0x3d')][_0x17af('0x15')]({'where':_0x1e3269[_0x17af('0x44')]})[_0x17af('0x19')](function(_0x531b14){_0x3d6d88['count']=_0x531b14;if(_0x58e1b4[_0x17af('0x26')][_0x17af('0x33')]){_0x1e3269[_0x17af('0x34')]=[{'all':!![]}];}return db[_0x17af('0x3d')][_0x17af('0x25')](_0x1e3269);})[_0x17af('0x19')](function(_0x5302c2){_0x3d6d88[_0x17af('0x4a')]=_0x5302c2;return _0x3d6d88;});}})[_0x17af('0x19')](respondWithFilteredResult(_0x4fbedb,_0x1e3269))['catch'](handleError(_0x4fbedb,null));};exports[_0x17af('0x4b')]=function(_0x2b6a42,_0x2db51e){return db[_0x17af('0x20')][_0x17af('0x37')]({'where':{'id':_0x2b6a42[_0x17af('0x2b')]['id']}})[_0x17af('0x19')](handleEntityNotFound(_0x2db51e,null))['then'](function(_0x1e7972){if(_0x1e7972){return _0x1e7972[_0x17af('0x4c')](_0x2b6a42[_0x17af('0x39')][_0x17af('0x3f')],_[_0x17af('0x3e')](_0x2b6a42[_0x17af('0x39')],[_0x17af('0x3f'),'id'])||{})['spread'](function(){return db[_0x17af('0x4d')][_0x17af('0x25')]({'attributes':['id',_0x17af('0x1d'),'color'],'where':{'id':_0x2b6a42[_0x17af('0x39')][_0x17af('0x3f')]}});})[_0x17af('0x19')](function(_0x44f5a3){socket[_0x17af('0x4e')](_0x17af('0x4f'),{'id':Number(_0x2b6a42[_0x17af('0x2b')]['id']),'tags':_0x44f5a3||[]});return{'id':Number(_0x2b6a42[_0x17af('0x2b')]['id']),'tags':_0x44f5a3||[]};});}})[_0x17af('0x19')](respondWithResult(_0x2db51e,null))['catch'](handleError(_0x2db51e,null));};exports['removeTags']=function(_0x39a13c,_0x4b8ee0){return db[_0x17af('0x20')][_0x17af('0x37')]({'where':{'id':_0x39a13c[_0x17af('0x2b')]['id']}})[_0x17af('0x19')](handleEntityNotFound(_0x4b8ee0,null))[_0x17af('0x19')](function(_0x3a7a40){if(_0x3a7a40){return _0x3a7a40[_0x17af('0x50')](_0x39a13c[_0x17af('0x26')][_0x17af('0x3f')]);}})['then'](respondWithStatusCode(_0x4b8ee0,null))[_0x17af('0x28')](handleError(_0x4b8ee0,null));};exports['download']=function(_0x4d8bb4,_0x1c3447){var _0x9eae42=moment()[_0x17af('0x51')]()['toString']();var _0x1334a4=path['join'](config[_0x17af('0x52')],_0x17af('0x53'),_0x17af('0x54'),_0x17af('0x55'));var _0x204796=path[_0x17af('0x56')](config[_0x17af('0x52')],_0x17af('0x53'),'files',_0x17af('0x57'));var _0x35c8db=path[_0x17af('0x56')](_0x1334a4,_0x9eae42);var _0x12d24e=util['format'](_0x17af('0x58'),_0x4d8bb4[_0x17af('0x2b')]['id'],_0x9eae42);var _0x2d2c31=path['join'](_0x1334a4,_0x12d24e);var _0x4d9e18=[];_0x4d9e18['push']({'model':db[_0x17af('0x59')],'as':_0x17af('0x59'),'attributes':['id',_0x17af('0x5a')],'raw':!![]});_0x4d9e18[_0x17af('0x5b')]({'model':db['CmContact'],'as':_0x17af('0x5c'),'attributes':['id',_0x17af('0x5d'),'lastName'],'raw':!![]});if(_0x4d8bb4['query']['attachments']){_0x4d9e18[_0x17af('0x5b')]({'model':db[_0x17af('0x5e')],'as':_0x17af('0x5e'),'raw':!![]});}var _0x49ec34=[{'model':db['OpenchannelMessage'],'as':_0x17af('0x5f'),'attributes':['id',_0x17af('0x39'),_0x17af('0x60'),_0x17af('0x61'),_0x17af('0x62'),_0x17af('0x63')],'include':_0x4d9e18}];_0x49ec34[_0x17af('0x5b')]({'model':db['OpenchannelAccount'],'as':_0x17af('0x64'),'attributes':['id','name']});_0x49ec34[_0x17af('0x5b')]({'model':db[_0x17af('0x59')],'as':_0x17af('0x65'),'attributes':['id',_0x17af('0x5a')]});return db[_0x17af('0x20')][_0x17af('0x37')]({'where':{'id':_0x4d8bb4[_0x17af('0x2b')]['id']},'include':_0x49ec34})['then'](handleEntityNotFound(_0x1c3447,null))[_0x17af('0x19')](function(_0x5de0ec){if(_0x5de0ec){var _0x5c1a8f=_0x5de0ec['get']({'plain':!![]});fs[_0x17af('0x66')](_0x35c8db);var _0x3ae048={'channel':'Openchannel','account':_0x5c1a8f[_0x17af('0x64')][_0x17af('0x1d')],'agent':_0x5c1a8f['Owner']?_0x5c1a8f['Owner'][_0x17af('0x5a')]:'N.A.','createdAt':moment(_0x5c1a8f['createdAt'])[_0x17af('0x67')]('YYYY-MM-DD\x20HH:mm:ss')[_0x17af('0x68')](),'closedAt':_0x5c1a8f['closed']?moment(_0x5c1a8f[_0x17af('0x69')])[_0x17af('0x67')](_0x17af('0x6a'))[_0x17af('0x68')]():'','disposition':_0x5c1a8f[_0x17af('0x6b')],'visibility':_0x5c1a8f[_0x17af('0x6c')]?'Public':_0x17af('0x6d'),'messages':_(_0x5c1a8f['Messages'])[_0x17af('0x47')]({'secret':![]})[_0x17af('0x1f')](function(_0x949d37){if(_0x949d37[_0x17af('0x5e')]){var _0x4e3415=path[_0x17af('0x56')](_0x204796,_0x949d37['Attachment'][_0x17af('0x6e')]);if(fs['existsSync'](_0x4e3415)){fs[_0x17af('0x6f')](_0x4e3415)['pipe'](fs[_0x17af('0x70')](path['join'](_0x35c8db,_0x949d37['Attachment'][_0x17af('0x6e')])));}}return{'date':moment(_0x949d37[_0x17af('0x60')])[_0x17af('0x67')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x949d37['direction']===_0x17af('0x71')?_0x949d37[_0x17af('0x59')]?_0x949d37[_0x17af('0x59')]['fullname']:'System':_0x949d37[_0x17af('0x5c')][_0x17af('0x5d')]+(_0x949d37[_0x17af('0x5c')][_0x17af('0x72')]?'\x20'+_0x949d37[_0x17af('0x5c')][_0x17af('0x72')]:''),'body':_0x949d37[_0x17af('0x5e')]?_0x949d37[_0x17af('0x5e')]['basename']:_0x949d37[_0x17af('0x39')],'direction':_0x949d37[_0x17af('0x61')]===_0x17af('0x71')?'A':'C','secret':_0x949d37['secret'],'read':_0x949d37[_0x17af('0x63')],'attachment':_0x949d37[_0x17af('0x5e')]};})[_0x17af('0x73')]()};return ejs[_0x17af('0x74')](path['join'](config[_0x17af('0x52')],_0x17af('0x53'),_0x17af('0x75'),_0x17af('0x76')),{'interaction':_0x3ae048})[_0x17af('0x19')](function(_0x195fbd){var _0x148057=path[_0x17af('0x56')](_0x35c8db,_0x17af('0x77')+_0x5c1a8f['id']+'-'+_0x9eae42+'.pdf');var _0x2e2494={'path':_0x148057,'channel':_0x17af('0x78'),'interactionId':_0x5c1a8f['id']};return pdf['createPdfFromHTML'](_0x195fbd,_0x2e2494);})['then'](function(){return new Promise(function(_0x1cbcba,_0x210b4c){zipdir(_0x35c8db,{'saveTo':_0x2d2c31},function(_0x3fa268,_0x128b7c){if(_0x3fa268)return _0x210b4c(_0x3fa268);return _0x1cbcba(_0x128b7c);});})[_0x17af('0x19')](function(){return new Promise(function(_0x57c6ee,_0x5a3714){rimraf(_0x35c8db,function(_0x56c932){if(_0x56c932)_0x5a3714(_0x56c932);return _0x57c6ee();});});})[_0x17af('0x19')](function(){return _0x1c3447[_0x17af('0x79')](_0x2d2c31,_0x12d24e,function(_0x32aedb){if(_0x32aedb){logger['error']('Unable\x20to\x20delete\x20zip\x20file',_0x32aedb);}else{fs[_0x17af('0x7a')](_0x2d2c31);}});});});}else{return _0x1c3447['sendStatus'](0xc8);}})['catch'](handleError(_0x1c3447,null));};
\ No newline at end of file
+var _0x0530=['limit','sort','where','pick','OpenchannelInteractionId','filter','merge','map','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','omit','spread','Tag','color','openchannelInteractionTags:save','removeTags','download','unix','root','server','files','tmp','join','push','fullname','CmContact','firstName','lastName','attachments','Attachment','Messages','createdAt','secret','read','Account','User','Owner','get','mkdirSync','toString','closed','closedAt','disposition','Public','Private','basename','existsSync','pipe','direction','out','System','Contact','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../mysqldb','redis','localhost','./openchannelInteraction.socket','status','end','json','offset','undefined','count','Content-Range','destroy','then','sendStatus','name','index','OpenchannelInteraction','rawAttributes','key','getOptions','openchannel','query','user','catch','show','type','from','params','model','keys','filters','attributes','intersection','fields','length','includeAll','include','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0530,0x1a9));var _0x0053=function(_0x28c5ff,_0x47abab){_0x28c5ff=_0x28c5ff-0x0;var _0x25d6c8=_0x0530[_0x28c5ff];return _0x25d6c8;};'use strict';var rimraf=require(_0x0053('0x0'));var zipdir=require(_0x0053('0x1'));var moment=require(_0x0053('0x2'));var util=require(_0x0053('0x3'));var path=require(_0x0053('0x4'));var ejs=require(_0x0053('0x5'));var fs=require('fs');var _=require(_0x0053('0x6'));var Redis=require(_0x0053('0x7'));var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x0053('0x8'))['db'];config[_0x0053('0x9')]=_['defaults'](config[_0x0053('0x9')],{'host':_0x0053('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0053('0x9')]));require(_0x0053('0xb'))['register'](socket);function respondWithStatusCode(_0x295e08,_0x47e78e){_0x47e78e=_0x47e78e||0xcc;return function(_0x4c1bb0){if(_0x4c1bb0){return _0x295e08['sendStatus'](_0x47e78e);}return _0x295e08[_0x0053('0xc')](_0x47e78e)[_0x0053('0xd')]();};}function respondWithResult(_0x283c37,_0x5c464d){_0x5c464d=_0x5c464d||0xc8;return function(_0x6579f1){if(_0x6579f1){return _0x283c37[_0x0053('0xc')](_0x5c464d)[_0x0053('0xe')](_0x6579f1);}};}function respondWithFilteredResult(_0x4fb30e,_0x4d2dd2){return function(_0x381ec6){if(_0x381ec6){var _0x2ae193=typeof _0x4d2dd2[_0x0053('0xf')]===_0x0053('0x10')&&typeof _0x4d2dd2['limit']===_0x0053('0x10');var _0x2c5b56=_0x381ec6[_0x0053('0x11')];var _0x153d14=_0x2ae193?0x0:_0x4d2dd2['offset'];var _0x33e1e5=_0x2ae193?_0x381ec6['count']:_0x4d2dd2['offset']+_0x4d2dd2['limit'];var _0x26d99a;if(_0x33e1e5>=_0x2c5b56){_0x33e1e5=_0x2c5b56;_0x26d99a=0xc8;}else{_0x26d99a=0xce;}_0x4fb30e[_0x0053('0xc')](_0x26d99a);return _0x4fb30e['set'](_0x0053('0x12'),_0x153d14+'-'+_0x33e1e5+'/'+_0x2c5b56)[_0x0053('0xe')](_0x381ec6);}return null;};}function saveUpdates(_0x16b66d){return function(_0x511566){if(_0x511566){return _0x511566['update'](_0x16b66d)['then'](function(_0x2851be){return _0x2851be;});}return null;};}function removeEntity(_0x473071){return function(_0x2d51ad){if(_0x2d51ad){return _0x2d51ad[_0x0053('0x13')]()[_0x0053('0x14')](function(){_0x473071[_0x0053('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11964a){return function(_0x51ae27){if(!_0x51ae27){_0x11964a[_0x0053('0x15')](0x194);}return _0x51ae27;};}function handleError(_0x510986,_0x5857ad){_0x5857ad=_0x5857ad||0x1f4;return function(_0x46e705){logger['error'](_0x46e705['stack']);if(_0x46e705[_0x0053('0x16')]){delete _0x46e705[_0x0053('0x16')];}_0x510986['status'](_0x5857ad)['send'](_0x46e705);};}exports[_0x0053('0x17')]=function(_0x1bb475,_0x17e3c5){var _0x566677={};var _0x1fffeb=_['map'](db[_0x0053('0x18')][_0x0053('0x19')],function(_0x398e4a){return{'name':_0x398e4a['fieldName'],'type':_0x398e4a['type'][_0x0053('0x1a')]};});_0x566677=qs[_0x0053('0x1b')](_0x1fffeb,_0x1bb475);return interaction['findAll'](_0x0053('0x1c'),_0x1bb475[_0x0053('0x1d')],_0x1bb475[_0x0053('0x1e')],_0x566677,_0x1fffeb)[_0x0053('0x14')](respondWithFilteredResult(_0x17e3c5,_0x566677))[_0x0053('0x1f')](handleError(_0x17e3c5,null));};exports[_0x0053('0x20')]=function(_0x592aff,_0x48bbc0){var _0x2b28cd={};if(_0x592aff[_0x0053('0x1d')][_0x0053('0x21')]&&_0x592aff['query']['type']==='from'){_0x2b28cd[_0x0053('0x22')]=_0x592aff[_0x0053('0x23')]['id'];}else{_0x2b28cd['id']=_0x592aff[_0x0053('0x23')]['id'];}var _0x37d28a={'raw':![],'where':_0x2b28cd},_0x1c7309={};_0x1c7309[_0x0053('0x24')]=_[_0x0053('0x25')](db[_0x0053('0x18')][_0x0053('0x19')]);_0x1c7309[_0x0053('0x1d')]=_[_0x0053('0x25')](_0x592aff[_0x0053('0x1d')]);_0x1c7309[_0x0053('0x26')]=_['intersection'](_0x1c7309[_0x0053('0x24')],_0x1c7309[_0x0053('0x1d')]);_0x37d28a[_0x0053('0x27')]=_[_0x0053('0x28')](_0x1c7309[_0x0053('0x24')],qs[_0x0053('0x29')](_0x592aff['query'][_0x0053('0x29')]));_0x37d28a[_0x0053('0x27')]=_0x37d28a[_0x0053('0x27')][_0x0053('0x2a')]?_0x37d28a[_0x0053('0x27')]:_0x1c7309['model'];if(_0x592aff[_0x0053('0x1d')][_0x0053('0x2b')]){_0x37d28a[_0x0053('0x2c')]=[{'all':!![]}];}_0x37d28a=_['merge']({},_0x37d28a,_0x592aff[_0x0053('0x2d')]);return db[_0x0053('0x18')][_0x0053('0x2e')](_0x37d28a)[_0x0053('0x14')](handleEntityNotFound(_0x48bbc0,null))[_0x0053('0x14')](respondWithResult(_0x48bbc0,null))[_0x0053('0x1f')](handleError(_0x48bbc0,null));};exports['create']=function(_0x44b673,_0x3a5961){return db[_0x0053('0x18')][_0x0053('0x2f')](_0x44b673['body'],{})['then'](respondWithResult(_0x3a5961,0xc9))['catch'](handleError(_0x3a5961,null));};exports['update']=function(_0x48044f,_0x2b4dbb){if(_0x48044f[_0x0053('0x30')]['id']){delete _0x48044f[_0x0053('0x30')]['id'];}return db['OpenchannelInteraction'][_0x0053('0x2e')]({'where':{'id':_0x48044f[_0x0053('0x23')]['id']}})['then'](handleEntityNotFound(_0x2b4dbb,null))[_0x0053('0x14')](saveUpdates(_0x48044f['body'],null))[_0x0053('0x14')](respondWithResult(_0x2b4dbb,null))[_0x0053('0x1f')](handleError(_0x2b4dbb,null));};exports['destroy']=function(_0x168b89,_0x3f528d){return db[_0x0053('0x18')][_0x0053('0x2e')]({'where':{'id':_0x168b89[_0x0053('0x23')]['id']}})[_0x0053('0x14')](handleEntityNotFound(_0x3f528d,null))[_0x0053('0x14')](removeEntity(_0x3f528d,null))[_0x0053('0x1f')](handleError(_0x3f528d,null));};exports[_0x0053('0x31')]=function(_0x8a635,_0xa43a90){return db[_0x0053('0x18')]['describe']()[_0x0053('0x14')](respondWithResult(_0xa43a90,null))[_0x0053('0x1f')](handleError(_0xa43a90,null));};exports[_0x0053('0x32')]=function(_0x447824,_0x227566){return db[_0x0053('0x33')]['find']({'where':{'id':_0x447824[_0x0053('0x23')]['id']}})[_0x0053('0x14')](handleEntityNotFound(_0x227566,null))['then'](function(_0x56bb4c){if(_0x56bb4c){return _0x56bb4c[_0x0053('0x32')](_0x447824[_0x0053('0x30')][_0x0053('0x34')],_['omit'](_0x447824[_0x0053('0x30')],['ids','id'])||{});}})[_0x0053('0x14')](respondWithResult(_0x227566,null))[_0x0053('0x1f')](handleError(_0x227566,null));};exports[_0x0053('0x35')]=function(_0x125d80,_0x18f15d){var _0x6e33b6={'raw':![],'where':{}};var _0x505ae2={};var _0x3cccec={'count':0x0,'rows':[]};return db[_0x0053('0x18')][_0x0053('0x36')]({'where':{'id':_0x125d80['params']['id']}})[_0x0053('0x14')](handleEntityNotFound(_0x18f15d,null))[_0x0053('0x14')](function(_0x449fa6){if(_0x449fa6){_0x505ae2[_0x0053('0x24')]=_[_0x0053('0x25')](db['OpenchannelMessage'][_0x0053('0x19')]);_0x505ae2['query']=_[_0x0053('0x25')](_0x125d80[_0x0053('0x1d')]);_0x505ae2['filters']=_[_0x0053('0x28')](_0x505ae2[_0x0053('0x24')],_0x505ae2['query']);_0x6e33b6['attributes']=_['intersection'](_0x505ae2[_0x0053('0x24')],qs[_0x0053('0x29')](_0x125d80[_0x0053('0x1d')]['fields']));_0x6e33b6[_0x0053('0x27')]=_0x6e33b6[_0x0053('0x27')][_0x0053('0x2a')]?_0x6e33b6[_0x0053('0x27')]:_0x505ae2['model'];if(!_0x125d80[_0x0053('0x1d')]['hasOwnProperty']('nolimit')){_0x6e33b6[_0x0053('0x37')]=qs['limit'](_0x125d80[_0x0053('0x1d')]['limit']);_0x6e33b6[_0x0053('0xf')]=qs[_0x0053('0xf')](_0x125d80[_0x0053('0x1d')][_0x0053('0xf')]);}_0x6e33b6['order']=qs[_0x0053('0x38')](_0x125d80[_0x0053('0x1d')]['sort']);_0x6e33b6[_0x0053('0x39')]=qs[_0x0053('0x26')](_[_0x0053('0x3a')](_0x125d80[_0x0053('0x1d')],_0x505ae2[_0x0053('0x26')]));_0x6e33b6[_0x0053('0x39')][_0x0053('0x3b')]=_0x449fa6['id'];if(_0x125d80[_0x0053('0x1d')][_0x0053('0x3c')]){_0x6e33b6[_0x0053('0x39')]=_[_0x0053('0x3d')](_0x6e33b6[_0x0053('0x39')],{'$or':_[_0x0053('0x3e')](_0x6e33b6['attributes'],function(_0x30fca2){var _0x1ab116={};_0x1ab116[_0x30fca2]={'$like':'%'+_0x125d80[_0x0053('0x1d')][_0x0053('0x3c')]+'%'};return _0x1ab116;})});}if(_0x125d80[_0x0053('0x1d')][_0x0053('0x3f')]){var _0x4fff62=_0x125d80[_0x0053('0x1d')][_0x0053('0x3f')]['split'](',');var _0x40da14={};_0x40da14[_0x4fff62[0x0]]={'$gte':moment(_0x4fff62[0x1])[_0x0053('0x40')](_0x0053('0x41'))};_0x6e33b6[_0x0053('0x39')]=_[_0x0053('0x3d')](_0x6e33b6[_0x0053('0x39')],_0x40da14);}_0x6e33b6=_[_0x0053('0x3d')]({},_0x6e33b6,_0x125d80['options']);return db['OpenchannelMessage']['count']({'where':_0x6e33b6[_0x0053('0x39')]})['then'](function(_0x584628){_0x3cccec[_0x0053('0x11')]=_0x584628;if(_0x125d80[_0x0053('0x1d')][_0x0053('0x2b')]){_0x6e33b6[_0x0053('0x2c')]=[{'all':!![]}];}return db[_0x0053('0x33')][_0x0053('0x42')](_0x6e33b6);})[_0x0053('0x14')](function(_0x3c21bb){_0x3cccec[_0x0053('0x43')]=_0x3c21bb;return _0x3cccec;});}})['then'](respondWithFilteredResult(_0x18f15d,_0x6e33b6))[_0x0053('0x1f')](handleError(_0x18f15d,null));};exports[_0x0053('0x44')]=function(_0xf8be61,_0x429568){return db[_0x0053('0x18')][_0x0053('0x2e')]({'where':{'id':_0xf8be61['params']['id']}})['then'](handleEntityNotFound(_0x429568,null))['then'](function(_0x41e4c5){if(_0x41e4c5){return _0x41e4c5['setTags'](_0xf8be61['body']['ids'],_[_0x0053('0x45')](_0xf8be61[_0x0053('0x30')],[_0x0053('0x34'),'id'])||{})[_0x0053('0x46')](function(){return db[_0x0053('0x47')][_0x0053('0x42')]({'attributes':['id',_0x0053('0x16'),_0x0053('0x48')],'where':{'id':_0xf8be61[_0x0053('0x30')][_0x0053('0x34')]}});})['then'](function(_0x230783){socket['emit'](_0x0053('0x49'),{'id':Number(_0xf8be61[_0x0053('0x23')]['id']),'tags':_0x230783||[]});return{'id':Number(_0xf8be61[_0x0053('0x23')]['id']),'tags':_0x230783||[]};});}})[_0x0053('0x14')](respondWithResult(_0x429568,null))['catch'](handleError(_0x429568,null));};exports[_0x0053('0x4a')]=function(_0x1b3ac8,_0xf5dcf7){return db['OpenchannelInteraction']['find']({'where':{'id':_0x1b3ac8[_0x0053('0x23')]['id']}})['then'](handleEntityNotFound(_0xf5dcf7,null))[_0x0053('0x14')](function(_0x3c93c0){if(_0x3c93c0){return _0x3c93c0[_0x0053('0x4a')](_0x1b3ac8[_0x0053('0x1d')]['ids']);}})[_0x0053('0x14')](respondWithStatusCode(_0xf5dcf7,null))[_0x0053('0x1f')](handleError(_0xf5dcf7,null));};exports[_0x0053('0x4b')]=function(_0x55bb74,_0x2e3bcb){var _0x25b35a=moment()[_0x0053('0x4c')]()['toString']();var _0x416feb=path['join'](config[_0x0053('0x4d')],_0x0053('0x4e'),_0x0053('0x4f'),_0x0053('0x50'));var _0x56a91e=path[_0x0053('0x51')](config[_0x0053('0x4d')],_0x0053('0x4e'),'files','attachments');var _0x1516a7=path[_0x0053('0x51')](_0x416feb,_0x25b35a);var _0x4d6819=util[_0x0053('0x40')]('transcript-%d-%s.zip',_0x55bb74[_0x0053('0x23')]['id'],_0x25b35a);var _0x3c3ecd=path[_0x0053('0x51')](_0x416feb,_0x4d6819);var _0x548d47=[];_0x548d47[_0x0053('0x52')]({'model':db['User'],'as':'User','attributes':['id',_0x0053('0x53')],'raw':!![]});_0x548d47[_0x0053('0x52')]({'model':db[_0x0053('0x54')],'as':'Contact','attributes':['id',_0x0053('0x55'),_0x0053('0x56')],'raw':!![]});if(_0x55bb74[_0x0053('0x1d')][_0x0053('0x57')]){_0x548d47[_0x0053('0x52')]({'model':db[_0x0053('0x58')],'as':_0x0053('0x58'),'raw':!![]});}var _0x5797d6=[{'model':db[_0x0053('0x33')],'as':_0x0053('0x59'),'attributes':['id',_0x0053('0x30'),_0x0053('0x5a'),'direction',_0x0053('0x5b'),_0x0053('0x5c')],'include':_0x548d47}];_0x5797d6[_0x0053('0x52')]({'model':db['OpenchannelAccount'],'as':_0x0053('0x5d'),'attributes':['id','name']});_0x5797d6[_0x0053('0x52')]({'model':db[_0x0053('0x5e')],'as':_0x0053('0x5f'),'attributes':['id',_0x0053('0x53')]});return db[_0x0053('0x18')][_0x0053('0x2e')]({'where':{'id':_0x55bb74[_0x0053('0x23')]['id']},'include':_0x5797d6})[_0x0053('0x14')](handleEntityNotFound(_0x2e3bcb,null))[_0x0053('0x14')](function(_0x1cb99c){if(_0x1cb99c){var _0x46011c=_0x1cb99c[_0x0053('0x60')]({'plain':!![]});fs[_0x0053('0x61')](_0x1516a7);var _0x33ec10={'channel':'Openchannel','account':_0x46011c[_0x0053('0x5d')][_0x0053('0x16')],'agent':_0x46011c[_0x0053('0x5f')]?_0x46011c[_0x0053('0x5f')][_0x0053('0x53')]:'N.A.','createdAt':moment(_0x46011c[_0x0053('0x5a')])[_0x0053('0x40')](_0x0053('0x41'))[_0x0053('0x62')](),'closedAt':_0x46011c[_0x0053('0x63')]?moment(_0x46011c[_0x0053('0x64')])[_0x0053('0x40')](_0x0053('0x41'))['toString']():'','disposition':_0x46011c[_0x0053('0x65')],'visibility':_0x46011c['threadId']?_0x0053('0x66'):_0x0053('0x67'),'messages':_(_0x46011c['Messages'])[_0x0053('0x3c')]({'secret':![]})['map'](function(_0x2ac1dd){if(_0x2ac1dd['Attachment']){var _0x5ad040=path[_0x0053('0x51')](_0x56a91e,_0x2ac1dd[_0x0053('0x58')][_0x0053('0x68')]);if(fs[_0x0053('0x69')](_0x5ad040)){fs['createReadStream'](_0x5ad040)[_0x0053('0x6a')](fs['createWriteStream'](path['join'](_0x1516a7,_0x2ac1dd[_0x0053('0x58')][_0x0053('0x68')])));}}return{'date':moment(_0x2ac1dd['createdAt'])[_0x0053('0x40')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0053('0x62')](),'sender':_0x2ac1dd[_0x0053('0x6b')]===_0x0053('0x6c')?_0x2ac1dd['User']?_0x2ac1dd[_0x0053('0x5e')][_0x0053('0x53')]:_0x0053('0x6d'):_0x2ac1dd['Contact'][_0x0053('0x55')]+(_0x2ac1dd[_0x0053('0x6e')]['lastName']?'\x20'+_0x2ac1dd['Contact'][_0x0053('0x56')]:''),'body':_0x2ac1dd['Attachment']?_0x2ac1dd['Attachment']['basename']:_0x2ac1dd[_0x0053('0x30')],'direction':_0x2ac1dd[_0x0053('0x6b')]===_0x0053('0x6c')?'A':'C','secret':_0x2ac1dd[_0x0053('0x5b')],'read':_0x2ac1dd[_0x0053('0x5c')],'attachment':_0x2ac1dd['Attachment']};})[_0x0053('0x6f')]()};return ejs[_0x0053('0x70')](path['join'](config[_0x0053('0x4d')],_0x0053('0x4e'),'views',_0x0053('0x71')),{'interaction':_0x33ec10})[_0x0053('0x14')](function(_0xe14468){var _0x10c5e1=path[_0x0053('0x51')](_0x1516a7,_0x0053('0x72')+_0x46011c['id']+'-'+_0x25b35a+_0x0053('0x73'));var _0x1e06aa={'path':_0x10c5e1,'channel':'Openchannel','interactionId':_0x46011c['id']};return pdf[_0x0053('0x74')](_0xe14468,_0x1e06aa);})[_0x0053('0x14')](function(){return new Promise(function(_0x3b556d,_0x2c8cac){zipdir(_0x1516a7,{'saveTo':_0x3c3ecd},function(_0x108ac7,_0x474cd6){if(_0x108ac7)return _0x2c8cac(_0x108ac7);return _0x3b556d(_0x474cd6);});})['then'](function(){return new Promise(function(_0x2f0e3a,_0x354996){rimraf(_0x1516a7,function(_0x21612b){if(_0x21612b)_0x354996(_0x21612b);return _0x2f0e3a();});});})[_0x0053('0x14')](function(){return _0x2e3bcb[_0x0053('0x4b')](_0x3c3ecd,_0x4d6819,function(_0x47ab76){if(_0x47ab76){logger[_0x0053('0x75')](_0x0053('0x76'),_0x47ab76);}else{fs[_0x0053('0x77')](_0x3c3ecd);}});});});}else{return _0x2e3bcb[_0x0053('0x15')](0xc8);}})[_0x0053('0x1f')](handleError(_0x2e3bcb,null));};
\ No newline at end of file
index 5f546c1..3031090 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xabfe=['getUsers','then','map','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x3b632f,_0x453380){var _0x10e788=function(_0x2228a4){while(--_0x2228a4){_0x3b632f['push'](_0x3b632f['shift']());}};_0x10e788(++_0x453380);}(_0xabfe,0x1e9));var _0xeabf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xabfe[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xeabf('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xeabf('0x1')];var OpenchannelMessage=require(_0xeabf('0x2'))['db'][_0xeabf('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xeabf('0x4')](0x0);var events={'afterCreate':_0xeabf('0x5'),'afterUpdate':_0xeabf('0x6'),'afterDestroy':'remove'};function emitEvent(_0x5d7a92){return function(_0x493a56,_0x4765da,_0x359c89){_0x493a56[_0xeabf('0x7')]({'attributes':['id'],'raw':!![]})[_0xeabf('0x8')](function(_0x2525a4){_0x493a56['setDataValue']('Users',_0x2525a4[_0xeabf('0x9')](function(_0x27e15d){return{'id':_0x27e15d['id']};}));return OpenchannelMessage[_0xeabf('0xa')]({'where':{'OpenchannelInteractionId':_0x493a56['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3a04b2){_0x493a56['setDataValue'](_0xeabf('0xb'),_0x3a04b2['length']);OpenchannelInteractionEvents[_0xeabf('0xc')](_0x5d7a92+':'+_0x493a56['id'],_0x493a56);OpenchannelInteractionEvents[_0xeabf('0xc')](_0x5d7a92,_0x493a56);_0x359c89(null);})[_0xeabf('0xd')](_0x359c89(null));};}for(var e in events){if(events[_0xeabf('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xeabf('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents;
\ No newline at end of file
+var _0x9936=['../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','Users','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x186376,_0x5d988a){var _0x2dbdd9=function(_0x96908e){while(--_0x96908e){_0x186376['push'](_0x186376['shift']());}};_0x2dbdd9(++_0x5d988a);}(_0x9936,0x76));var _0x6993=function(_0x250c78,_0x25b838){_0x250c78=_0x250c78-0x0;var _0x44f07a=_0x9936[_0x250c78];return _0x44f07a;};'use strict';var EventEmitter=require(_0x6993('0x0'));var OpenchannelInteraction=require(_0x6993('0x1'))['db'][_0x6993('0x2')];var OpenchannelMessage=require(_0x6993('0x1'))['db'][_0x6993('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x6993('0x4')](0x0);var events={'afterCreate':_0x6993('0x5'),'afterUpdate':_0x6993('0x6'),'afterDestroy':_0x6993('0x7')};function emitEvent(_0x9e9c40){return function(_0x119034,_0x111d50,_0x4e1c16){_0x119034[_0x6993('0x8')]({'attributes':['id'],'raw':!![]})[_0x6993('0x9')](function(_0xce78fc){_0x119034['setDataValue'](_0x6993('0xa'),_0xce78fc['map'](function(_0xf0b0cb){return{'id':_0xf0b0cb['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x119034['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6993('0x9')](function(_0xb8acba){_0x119034['setDataValue']('unreadMessages',_0xb8acba[_0x6993('0xb')]);OpenchannelInteractionEvents[_0x6993('0xc')](_0x9e9c40+':'+_0x119034['id'],_0x119034);OpenchannelInteractionEvents[_0x6993('0xc')](_0x9e9c40,_0x119034);_0x4e1c16(null);})[_0x6993('0xd')](_0x4e1c16(null));};}for(var e in events){if(events[_0x6993('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x6993('0xf')](e,emitEvent(event));}}module[_0x6993('0x10')]=OpenchannelInteractionEvents;
\ No newline at end of file
index 4967594..72372e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xec3d=['util','moment','bluebird','request-promise','path','rimraf','exports','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x298ed3,_0x4ab5e1){var _0x5aad28=function(_0x168687){while(--_0x168687){_0x298ed3['push'](_0x298ed3['shift']());}};_0x5aad28(++_0x4ab5e1);}(_0xec3d,0x12c));var _0xdec3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xec3d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xdec3('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xdec3('0x1'));var BPromise=require(_0xdec3('0x2'));var rp=require(_0xdec3('0x3'));var fs=require('fs');var path=require(_0xdec3('0x4'));var rimraf=require(_0xdec3('0x5'));var config=require('../../config/environment');var attributes=require('./openchannelInteraction.attributes');module[_0xdec3('0x6')]=function(_0xf1af3e,_0x263d44){return _0xf1af3e['define']('OpenchannelInteraction',attributes,{'tableName':_0xdec3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdec3('0x8'),'collate':_0xdec3('0x9'),'hooks':{'beforeUpdate':function(_0x196489,_0x5831c2,_0x265d70){if(_0x196489[_0xdec3('0xa')](_0xdec3('0xb'))){_0x196489[_0xdec3('0xc')]=moment()[_0xdec3('0xd')](_0xdec3('0xe'));}_0x265d70(null,_0x196489);}}});};
\ No newline at end of file
+var _0xe635=['define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelInteraction.attributes','exports'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0xe635,0x1be));var _0x5e63=function(_0xf3a659,_0x33a393){_0xf3a659=_0xf3a659-0x0;var _0x2ec619=_0xe635[_0xf3a659];return _0x2ec619;};'use strict';var _=require(_0x5e63('0x0'));var util=require(_0x5e63('0x1'));var logger=require(_0x5e63('0x2'))(_0x5e63('0x3'));var moment=require(_0x5e63('0x4'));var BPromise=require(_0x5e63('0x5'));var rp=require(_0x5e63('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5e63('0x7'));var attributes=require(_0x5e63('0x8'));module[_0x5e63('0x9')]=function(_0x41fdd1,_0x2d48ac){return _0x41fdd1[_0x5e63('0xa')](_0x5e63('0xb'),attributes,{'tableName':_0x5e63('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5e63('0xd'),'collate':_0x5e63('0xe'),'hooks':{'beforeUpdate':function(_0x5cba07,_0x2794dc,_0x13501d){if(_0x5cba07[_0x5e63('0xf')](_0x5e63('0x10'))){_0x5cba07['closedAt']=moment()[_0x5e63('0x11')](_0x5e63('0x12'));}_0x13501d(null,_0x5cba07);}}});};
\ No newline at end of file
index 1fedbd1..3727954 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0509=['OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','raw','options','where','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0509,0xd5));var _0x9050=function(_0xa7163a,_0x25b4df){_0xa7163a=_0xa7163a-0x0;var _0x2b68b7=_0x0509[_0xa7163a];return _0x2b68b7;};'use strict';var _=require(_0x9050('0x0'));var util=require(_0x9050('0x1'));var moment=require(_0x9050('0x2'));var BPromise=require(_0x9050('0x3'));var rs=require(_0x9050('0x4'));var fs=require('fs');var Redis=require(_0x9050('0x5'));var db=require(_0x9050('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9050('0x7'));var config=require(_0x9050('0x8'));var jayson=require(_0x9050('0x9'));var client=jayson[_0x9050('0xa')][_0x9050('0xb')]({'port':0x232a});config[_0x9050('0xc')]=_[_0x9050('0xd')](config[_0x9050('0xc')],{'host':_0x9050('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9050('0xc')]));require('./openchannelInteraction.socket')[_0x9050('0xf')](socket);function respondWithRpcPromise(_0x20e1ed,_0x591703,_0x3be084){return new BPromise(function(_0x4ffd89,_0x2f7df3){return client['request'](_0x20e1ed,_0x3be084)[_0x9050('0x10')](function(_0x2b9768){logger[_0x9050('0x11')](_0x9050('0x12'),_0x591703,_0x9050('0x13'));logger[_0x9050('0x14')](_0x9050('0x15'),_0x591703,_0x9050('0x13'),JSON[_0x9050('0x16')](_0x2b9768));if(_0x2b9768[_0x9050('0x17')]){if(_0x2b9768['error']['code']===0x1f4){logger[_0x9050('0x17')](_0x9050('0x12'),_0x591703,_0x2b9768['error']['message']);return _0x2f7df3(_0x2b9768[_0x9050('0x17')][_0x9050('0x18')]);}logger[_0x9050('0x17')]('OpenchannelInteraction,\x20%s,\x20%s',_0x591703,_0x2b9768['error'][_0x9050('0x18')]);return _0x4ffd89(_0x2b9768[_0x9050('0x17')][_0x9050('0x18')]);}else{logger[_0x9050('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x591703,_0x9050('0x13'));_0x4ffd89(_0x2b9768[_0x9050('0x19')]['message']);}})[_0x9050('0x1a')](function(_0x33ff92){logger[_0x9050('0x17')](_0x9050('0x12'),_0x591703,_0x33ff92);_0x2f7df3(_0x33ff92);});});}exports[_0x9050('0x1b')]=function(_0x11b593){var _0x5eda62=this;return new Promise(function(_0x376295,_0x548f4c){return db[_0x9050('0x1c')]['update'](_0x11b593[_0x9050('0x1d')],{'raw':_0x11b593['options']?_0x11b593['options'][_0x9050('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11b593['options']?_0x11b593[_0x9050('0x1f')][_0x9050('0x20')]||null:null,'attributes':_0x11b593[_0x9050('0x1f')]?_0x11b593[_0x9050('0x1f')]['attributes']||null:null,'limit':_0x11b593['options']?_0x11b593[_0x9050('0x1f')]['limit']||null:null})[_0x9050('0x10')](function(_0xa9e06e){logger[_0x9050('0x11')](_0x9050('0x1b'),_0x11b593);logger['debug'](_0x9050('0x1b'),_0x11b593,JSON['stringify'](_0xa9e06e));_0x376295(_0xa9e06e);})['catch'](function(_0x4815ed){logger['error']('UpdateOpenchannelInteraction',_0x4815ed[_0x9050('0x18')],_0x11b593);_0x548f4c(_0x5eda62[_0x9050('0x17')](0x1f4,_0x4815ed[_0x9050('0x18')]));});});};exports[_0x9050('0x21')]=function(_0x115453){return new Promise(function(_0x87b5db,_0x412523){return db[_0x9050('0x1c')][_0x9050('0x22')]({'where':_0x115453['options']?_0x115453[_0x9050('0x1f')][_0x9050('0x20')]||null:null})[_0x9050('0x10')](function(_0x1fef59){if(_0x1fef59){return _0x1fef59[_0x9050('0x23')](_0x115453[_0x9050('0x1d')][_0x9050('0x24')],_[_0x9050('0x25')](_0x115453[_0x9050('0x1d')],[_0x9050('0x24'),'id'])||{});}})['spread'](function(_0x4664c8){logger[_0x9050('0x11')]('AddTags',_0x115453);logger['debug']('AddTags',_0x115453,JSON[_0x9050('0x16')](_0x4664c8));_0x87b5db(_0x4664c8);})['catch'](function(_0x307ec4){logger[_0x9050('0x17')](_0x9050('0x26'),_0x307ec4[_0x9050('0x18')],_0x115453);_0x412523(_this['error'](0x1f4,_0x307ec4['message']));});});};
\ No newline at end of file
+var _0xedd4=['socket.io-emitter','redis','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction','find','addTags','ids','spread','AddTags','util','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost'];(function(_0x389d7c,_0x12041f){var _0x5da054=function(_0xc23dc6){while(--_0xc23dc6){_0x389d7c['push'](_0x389d7c['shift']());}};_0x5da054(++_0x12041f);}(_0xedd4,0x10e));var _0x4edd=function(_0x1b89df,_0x4cd3e9){_0x1b89df=_0x1b89df-0x0;var _0x1478a7=_0xedd4[_0x1b89df];return _0x1478a7;};'use strict';var _=require('lodash');var util=require(_0x4edd('0x0'));var moment=require('moment');var BPromise=require(_0x4edd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4edd('0x2'))['db'];var utils=require(_0x4edd('0x3'));var logger=require('../../config/logger')(_0x4edd('0x4'));var config=require('../../config/environment');var jayson=require(_0x4edd('0x5'));var client=jayson[_0x4edd('0x6')][_0x4edd('0x7')]({'port':0x232a});config['redis']=_[_0x4edd('0x8')](config['redis'],{'host':_0x4edd('0x9'),'port':0x18eb});var socket=require(_0x4edd('0xa'))(new Redis(config[_0x4edd('0xb')]));require('./openchannelInteraction.socket')[_0x4edd('0xc')](socket);function respondWithRpcPromise(_0x94e200,_0x353e16,_0x2154b8){return new BPromise(function(_0x2a43ee,_0x4d8ad9){return client[_0x4edd('0xd')](_0x94e200,_0x2154b8)[_0x4edd('0xe')](function(_0x37303c){logger[_0x4edd('0xf')](_0x4edd('0x10'),_0x353e16,'request\x20sent');logger[_0x4edd('0x11')](_0x4edd('0x12'),_0x353e16,'request\x20sent',JSON[_0x4edd('0x13')](_0x37303c));if(_0x37303c[_0x4edd('0x14')]){if(_0x37303c['error']['code']===0x1f4){logger[_0x4edd('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x353e16,_0x37303c[_0x4edd('0x14')][_0x4edd('0x15')]);return _0x4d8ad9(_0x37303c['error'][_0x4edd('0x15')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x353e16,_0x37303c[_0x4edd('0x14')][_0x4edd('0x15')]);return _0x2a43ee(_0x37303c[_0x4edd('0x14')][_0x4edd('0x15')]);}else{logger[_0x4edd('0xf')]('OpenchannelInteraction,\x20%s,\x20%s',_0x353e16,_0x4edd('0x16'));_0x2a43ee(_0x37303c[_0x4edd('0x17')]['message']);}})[_0x4edd('0x18')](function(_0x12cead){logger['error'](_0x4edd('0x10'),_0x353e16,_0x12cead);_0x4d8ad9(_0x12cead);});});}exports[_0x4edd('0x19')]=function(_0x50d4dc){var _0x433110=this;return new Promise(function(_0x7242ad,_0x3c4e68){return db[_0x4edd('0x1a')][_0x4edd('0x1b')](_0x50d4dc[_0x4edd('0x1c')],{'raw':_0x50d4dc[_0x4edd('0x1d')]?_0x50d4dc['options'][_0x4edd('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50d4dc[_0x4edd('0x1d')]?_0x50d4dc['options'][_0x4edd('0x1f')]||null:null,'attributes':_0x50d4dc['options']?_0x50d4dc[_0x4edd('0x1d')][_0x4edd('0x20')]||null:null,'limit':_0x50d4dc[_0x4edd('0x1d')]?_0x50d4dc[_0x4edd('0x1d')][_0x4edd('0x21')]||null:null})[_0x4edd('0xe')](function(_0x7e473c){logger[_0x4edd('0xf')]('UpdateOpenchannelInteraction',_0x50d4dc);logger[_0x4edd('0x11')](_0x4edd('0x19'),_0x50d4dc,JSON[_0x4edd('0x13')](_0x7e473c));_0x7242ad(_0x7e473c);})[_0x4edd('0x18')](function(_0x5e7d42){logger[_0x4edd('0x14')](_0x4edd('0x19'),_0x5e7d42['message'],_0x50d4dc);_0x3c4e68(_0x433110[_0x4edd('0x14')](0x1f4,_0x5e7d42[_0x4edd('0x15')]));});});};exports[_0x4edd('0x22')]=function(_0xf6f89c){return new Promise(function(_0x226971,_0x12c4c6){return db['OpenchannelInteraction'][_0x4edd('0x23')]({'where':_0xf6f89c[_0x4edd('0x1d')]?_0xf6f89c[_0x4edd('0x1d')][_0x4edd('0x1f')]||null:null})[_0x4edd('0xe')](function(_0x4c8d87){if(_0x4c8d87){return _0x4c8d87[_0x4edd('0x24')](_0xf6f89c[_0x4edd('0x1c')][_0x4edd('0x25')],_['omit'](_0xf6f89c[_0x4edd('0x1c')],[_0x4edd('0x25'),'id'])||{});}})[_0x4edd('0x26')](function(_0x427aeb){logger[_0x4edd('0xf')](_0x4edd('0x27'),_0xf6f89c);logger[_0x4edd('0x11')](_0x4edd('0x27'),_0xf6f89c,JSON[_0x4edd('0x13')](_0x427aeb));_0x226971(_0x427aeb);})[_0x4edd('0x18')](function(_0x26d17b){logger[_0x4edd('0x14')](_0x4edd('0x27'),_0x26d17b[_0x4edd('0x15')],_0xf6f89c);_0x12c4c6(_this[_0x4edd('0x14')](0x1f4,_0x26d17b[_0x4edd('0x15')]));});});};
\ No newline at end of file
index 860b236..bc28bb7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfa98=['register','length','openchannelInteraction:','save','remove','update','emit','removeListener'];(function(_0x592df4,_0x4e719b){var _0x3b4fe4=function(_0x5ebf53){while(--_0x5ebf53){_0x592df4['push'](_0x592df4['shift']());}};_0x3b4fe4(++_0x4e719b);}(_0xfa98,0xb3));var _0x8fa9=function(_0x2b7640,_0x2ca406){_0x2b7640=_0x2b7640-0x0;var _0x181339=_0xfa98[_0x2b7640];return _0x181339;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x8fa9('0x0'),_0x8fa9('0x1'),_0x8fa9('0x2')];function createListener(_0x3b3d53,_0x2fd3f8){return function(_0x588d7e){_0x2fd3f8[_0x8fa9('0x3')](_0x3b3d53,_0x588d7e);};}function removeListener(_0x1e842e,_0x32ac0b){return function(){OpenchannelInteractionEvents[_0x8fa9('0x4')](_0x1e842e,_0x32ac0b);};}exports[_0x8fa9('0x5')]=function(_0x42776d){for(var _0x20bef8=0x0,_0x3397b6=events[_0x8fa9('0x6')];_0x20bef8<_0x3397b6;_0x20bef8++){var _0x59638d=events[_0x20bef8];var _0x5a3f78=createListener(_0x8fa9('0x7')+_0x59638d,_0x42776d);OpenchannelInteractionEvents['on'](_0x59638d,_0x5a3f78);}};
\ No newline at end of file
+var _0xf73b=['remove','update','removeListener','length','openchannelInteraction:','./openchannelInteraction.events'];(function(_0x2a1a73,_0x4d99bf){var _0x40a57c=function(_0x41e091){while(--_0x41e091){_0x2a1a73['push'](_0x2a1a73['shift']());}};_0x40a57c(++_0x4d99bf);}(_0xf73b,0x131));var _0xbf73=function(_0x582fe0,_0x5db79e){_0x582fe0=_0x582fe0-0x0;var _0xd9b691=_0xf73b[_0x582fe0];return _0xd9b691;};'use strict';var OpenchannelInteractionEvents=require(_0xbf73('0x0'));var events=['save',_0xbf73('0x1'),_0xbf73('0x2')];function createListener(_0x3d097a,_0x59d198){return function(_0x59a689){_0x59d198['emit'](_0x3d097a,_0x59a689);};}function removeListener(_0x26f541,_0x489ec5){return function(){OpenchannelInteractionEvents[_0xbf73('0x3')](_0x26f541,_0x489ec5);};}exports['register']=function(_0x8f83dd){for(var _0x5281d6=0x0,_0x1224bc=events[_0xbf73('0x4')];_0x5281d6<_0x1224bc;_0x5281d6++){var _0x2b7f52=events[_0x5281d6];var _0x50acbf=createListener(_0xbf73('0x5')+_0x2b7f52,_0x8f83dd);OpenchannelInteractionEvents['on'](_0x2b7f52,_0x50acbf);}};
\ No newline at end of file
index 3e042f3..5175f15 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x216c2f,_0xaf2d0e){var _0x1b6b9a=function(_0x3871be){while(--_0x3871be){_0x216c2f['push'](_0x216c2f['shift']());}};_0x1b6b9a(++_0xaf2d0e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./openchannelMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),interaction[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x0d8b('0x10')),controller['create']);router[_0x0d8b('0x11')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x11')](_0x0d8b('0x13'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x14')]);router[_0x0d8b('0x11')](_0x0d8b('0x15'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x16')]);router[_0x0d8b('0x17')](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x18')]);module['exports']=router;
\ No newline at end of file
+var _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x5293a1,_0x351c64){var _0x5085aa=function(_0x3c3bd8){while(--_0x3c3bd8){_0x5293a1['push'](_0x5293a1['shift']());}};_0x5085aa(++_0x351c64);}(_0x9c44,0x178));var _0x49c4=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x9c44[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router;
\ No newline at end of file
index cfa8b80..a642260 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3495=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x1e1d07,_0x299b1e){var _0x225dce=function(_0x21fb0a){while(--_0x21fb0a){_0x1e1d07['push'](_0x1e1d07['shift']());}};_0x225dce(++_0x299b1e);}(_0x3495,0x1de));var _0x5349=function(_0x51bea2,_0x19d310){_0x51bea2=_0x51bea2-0x0;var _0x8fabf6=_0x3495[_0x51bea2];return _0x8fabf6;};'use strict';var Sequelize=require(_0x5349('0x0'));module[_0x5349('0x1')]={'body':{'type':Sequelize[_0x5349('0x2')](_0x5349('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x5349('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x5349('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x5349('0x5')]('in',_0x5349('0x6')),'defaultValue':_0x5349('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x5349('0x7')]},'providerResponse':{'type':Sequelize[_0x5349('0x2')]}};
\ No newline at end of file
+var _0x48ac=['exports','medium','BOOLEAN','out','DATE','STRING','TEXT'];(function(_0x3aea4d,_0x295c1c){var _0x28a18a=function(_0x506d8a){while(--_0x506d8a){_0x3aea4d['push'](_0x3aea4d['shift']());}};_0x28a18a(++_0x295c1c);}(_0x48ac,0xe0));var _0xc48a=function(_0x4ee98d,_0x3826e3){_0x4ee98d=_0x4ee98d-0x0;var _0x53ca2e=_0x48ac[_0x4ee98d];return _0x53ca2e;};'use strict';var Sequelize=require('sequelize');module[_0xc48a('0x0')]={'body':{'type':Sequelize['TEXT'](_0xc48a('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc48a('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc48a('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xc48a('0x3')),'defaultValue':_0xc48a('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xc48a('0x4')]},'providerName':{'type':Sequelize[_0xc48a('0x5')]},'providerResponse':{'type':Sequelize[_0xc48a('0x6')]}};
\ No newline at end of file
index 9d31c89..8931dd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1696=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','message','catch','status','limit','undefined','offset','count','apply','save','update','destroy','end','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','nolimit','order','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','fields','find','create','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','read1stAt','interaction','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','User','fullname','internal','interface','SIP/%s','channel','event','openchannel-interactions','reject','openchannel','role','RejectMessage','rejectMessage','ContactId','Sequelize','EventManager','rejectmessage','eml-format','zip-dir'];(function(_0x9fead2,_0x26432){var _0x283e0f=function(_0xb2c452){while(--_0xb2c452){_0x9fead2['push'](_0x9fead2['shift']());}};_0x283e0f(++_0x26432);}(_0x1696,0x79));var _0x6169=function(_0x1ae61f,_0x32724b){_0x1ae61f=_0x1ae61f-0x0;var _0x361c9b=_0x1696[_0x1ae61f];return _0x361c9b;};'use strict';var emlformat=require(_0x6169('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6169('0x1'));var jsonpatch=require(_0x6169('0x2'));var rp=require(_0x6169('0x3'));var moment=require(_0x6169('0x4'));var BPromise=require(_0x6169('0x5'));var Mustache=require(_0x6169('0x6'));var util=require(_0x6169('0x7'));var path=require(_0x6169('0x8'));var sox=require(_0x6169('0x9'));var csv=require('to-csv');var ejs=require(_0x6169('0xa'));var fs=require('fs');var fs_extra=require(_0x6169('0xb'));var _=require(_0x6169('0xc'));var squel=require(_0x6169('0xd'));var crypto=require(_0x6169('0xe'));var jsforce=require(_0x6169('0xf'));var deskjs=require(_0x6169('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6169('0x11'));var Papa=require('papaparse');var Redis=require(_0x6169('0x12'));var authService=require(_0x6169('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6169('0x14'));var hardwareService=require(_0x6169('0x15'));var logger=require(_0x6169('0x16'))(_0x6169('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6169('0x18'));var db=require(_0x6169('0x19'))['db'];config['redis']=_[_0x6169('0x1a')](config[_0x6169('0x1b')],{'host':_0x6169('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x6169('0x1d')](socket);var jayson=require(_0x6169('0x1e'));var client=jayson[_0x6169('0x1f')][_0x6169('0x20')]({'port':0x232c});var client9002=jayson[_0x6169('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x461294,_0x3e2eb4,_0x49a94f,_0x5e3312){return new BPromise(function(_0x5afc48,_0x3c172c){var _0x1e3b4e=_0x5e3312||client;return _0x1e3b4e['request'](_0x461294,_0x49a94f)[_0x6169('0x21')](function(_0x76c6fb){logger[_0x6169('0x22')](_0x6169('0x23'),_0x3e2eb4,_0x6169('0x24'));logger[_0x6169('0x25')](_0x6169('0x26'),_0x3e2eb4,'request\x20sent',JSON['stringify'](_0x76c6fb));if(_0x76c6fb[_0x6169('0x27')]){if(_0x76c6fb[_0x6169('0x27')]['code']===0x1f4){logger[_0x6169('0x27')](_0x6169('0x23'),_0x3e2eb4,_0x76c6fb[_0x6169('0x27')][_0x6169('0x28')]);return _0x3c172c(_0x76c6fb[_0x6169('0x27')]['message']);}logger[_0x6169('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0x3e2eb4,_0x76c6fb[_0x6169('0x27')][_0x6169('0x28')]);return _0x5afc48(_0x76c6fb[_0x6169('0x27')]['message']);}else{logger[_0x6169('0x22')](_0x6169('0x23'),_0x3e2eb4,'request\x20sent');_0x5afc48(_0x76c6fb['result'][_0x6169('0x28')]);}})[_0x6169('0x29')](function(_0x3e706c){logger[_0x6169('0x27')](_0x6169('0x23'),_0x3e2eb4,_0x3e706c);_0x3c172c(_0x3e706c);});});}function respondWithStatusCode(_0x918440,_0x647f57){_0x647f57=_0x647f57||0xcc;return function(_0x3010f7){if(_0x3010f7){return _0x918440['sendStatus'](_0x647f57);}return _0x918440[_0x6169('0x2a')](_0x647f57)['end']();};}function respondWithResult(_0x5789b1,_0x593fa9){_0x593fa9=_0x593fa9||0xc8;return function(_0x5451ef){if(_0x5451ef){return _0x5789b1[_0x6169('0x2a')](_0x593fa9)['json'](_0x5451ef);}};}function respondWithFilteredResult(_0x4466f3,_0x136d11){return function(_0x15bef9){if(_0x15bef9){var _0x512977=typeof _0x136d11['offset']==='undefined'&&typeof _0x136d11[_0x6169('0x2b')]===_0x6169('0x2c');var _0x4a55a0=_0x15bef9['count'];var _0x39322c=_0x512977?0x0:_0x136d11[_0x6169('0x2d')];var _0x591814=_0x512977?_0x15bef9[_0x6169('0x2e')]:_0x136d11[_0x6169('0x2d')]+_0x136d11['limit'];var _0x4d0d73;if(_0x591814>=_0x4a55a0){_0x591814=_0x4a55a0;_0x4d0d73=0xc8;}else{_0x4d0d73=0xce;}_0x4466f3[_0x6169('0x2a')](_0x4d0d73);return _0x4466f3['set']('Content-Range',_0x39322c+'-'+_0x591814+'/'+_0x4a55a0)['json'](_0x15bef9);}return null;};}function patchUpdates(_0x7e42dc){return function(_0x597e0c){try{jsonpatch[_0x6169('0x2f')](_0x597e0c,_0x7e42dc,!![]);}catch(_0x11f9b3){return BPromise['reject'](_0x11f9b3);}return _0x597e0c[_0x6169('0x30')]();};}function saveUpdates(_0x5b1f3d,_0x290651){return function(_0x2c0b4a){if(_0x2c0b4a){return _0x2c0b4a[_0x6169('0x31')](_0x5b1f3d)['then'](function(_0x571465){return _0x571465;});}return null;};}function removeEntity(_0x48414e,_0x57b64b){return function(_0x473001){if(_0x473001){return _0x473001[_0x6169('0x32')]()['then'](function(){_0x48414e[_0x6169('0x2a')](0xcc)[_0x6169('0x33')]();});}};}function handleEntityNotFound(_0x2368d3,_0x4a254d){return function(_0x280628){if(!_0x280628){_0x2368d3[_0x6169('0x34')](0x194);}return _0x280628;};}function handleError(_0x293451,_0x1817e8){_0x1817e8=_0x1817e8||0x1f4;return function(_0x153339){logger[_0x6169('0x27')](_0x153339[_0x6169('0x35')]);if(_0x153339[_0x6169('0x36')]){delete _0x153339[_0x6169('0x36')];}_0x293451[_0x6169('0x2a')](_0x1817e8)[_0x6169('0x37')](_0x153339);};}exports['index']=function(_0x504c4b,_0x2c5ed6){var _0x542c5d={},_0x1cf68e={},_0x369e30={'count':0x0,'rows':[]};var _0x308b5a=_[_0x6169('0x38')](db[_0x6169('0x39')][_0x6169('0x3a')],function(_0x388ca5){return{'name':_0x388ca5[_0x6169('0x3b')],'type':_0x388ca5[_0x6169('0x3c')]['key']};});_0x1cf68e[_0x6169('0x3d')]=_[_0x6169('0x38')](_0x308b5a,_0x6169('0x36'));_0x1cf68e['query']=_[_0x6169('0x3e')](_0x504c4b[_0x6169('0x3f')]);_0x1cf68e['filters']=_[_0x6169('0x40')](_0x1cf68e['model'],_0x1cf68e[_0x6169('0x3f')]);_0x542c5d['attributes']=_[_0x6169('0x40')](_0x1cf68e[_0x6169('0x3d')],qs['fields'](_0x504c4b[_0x6169('0x3f')]['fields']));_0x542c5d[_0x6169('0x41')]=_0x542c5d[_0x6169('0x41')]['length']?_0x542c5d[_0x6169('0x41')]:_0x1cf68e['model'];if(!_0x504c4b[_0x6169('0x3f')]['hasOwnProperty'](_0x6169('0x42'))){_0x542c5d['limit']=qs['limit'](_0x504c4b[_0x6169('0x3f')][_0x6169('0x2b')]);_0x542c5d['offset']=qs[_0x6169('0x2d')](_0x504c4b['query'][_0x6169('0x2d')]);}_0x542c5d[_0x6169('0x43')]=qs['sort'](_0x504c4b[_0x6169('0x3f')]['sort']);_0x542c5d['where']=qs[_0x6169('0x44')](_[_0x6169('0x45')](_0x504c4b['query'],_0x1cf68e[_0x6169('0x44')]),_0x308b5a);if(_0x504c4b['query'][_0x6169('0x46')]){_0x542c5d[_0x6169('0x47')]=_[_0x6169('0x48')](_0x542c5d['where'],{'$or':_[_0x6169('0x38')](_0x308b5a,function(_0x407306){if(_0x407306[_0x6169('0x3c')]!==_0x6169('0x49')){var _0x4550d9={};_0x4550d9[_0x407306[_0x6169('0x36')]]={'$like':'%'+_0x504c4b['query'][_0x6169('0x46')]+'%'};return _0x4550d9;}})});}_0x542c5d=_[_0x6169('0x48')]({},_0x542c5d,_0x504c4b[_0x6169('0x4a')]);var _0x364f27={'where':_0x542c5d[_0x6169('0x47')]};return db['OpenchannelMessage']['count'](_0x364f27)[_0x6169('0x21')](function(_0x100a43){_0x369e30[_0x6169('0x2e')]=_0x100a43;if(_0x504c4b[_0x6169('0x3f')][_0x6169('0x4b')]){_0x542c5d[_0x6169('0x4c')]=[{'all':!![]}];}return db[_0x6169('0x39')][_0x6169('0x4d')](_0x542c5d);})[_0x6169('0x21')](function(_0xf51b72){_0x369e30[_0x6169('0x4e')]=_0xf51b72;return _0x369e30;})['then'](respondWithFilteredResult(_0x2c5ed6,_0x542c5d))[_0x6169('0x29')](handleError(_0x2c5ed6,null));};exports['show']=function(_0x3dbd02,_0x259138){var _0x4bd1d8={'raw':!![],'where':{'id':_0x3dbd02[_0x6169('0x4f')]['id']}},_0x47282d={};_0x47282d[_0x6169('0x3d')]=_[_0x6169('0x3e')](db['OpenchannelMessage'][_0x6169('0x3a')]);_0x47282d['query']=_[_0x6169('0x3e')](_0x3dbd02[_0x6169('0x3f')]);_0x47282d[_0x6169('0x44')]=_[_0x6169('0x40')](_0x47282d[_0x6169('0x3d')],_0x47282d['query']);_0x4bd1d8[_0x6169('0x41')]=_['intersection'](_0x47282d[_0x6169('0x3d')],qs[_0x6169('0x50')](_0x3dbd02[_0x6169('0x3f')][_0x6169('0x50')]));_0x4bd1d8[_0x6169('0x41')]=_0x4bd1d8[_0x6169('0x41')]['length']?_0x4bd1d8['attributes']:_0x47282d[_0x6169('0x3d')];if(_0x3dbd02[_0x6169('0x3f')][_0x6169('0x4b')]){_0x4bd1d8[_0x6169('0x4c')]=[{'all':!![]}];}_0x4bd1d8=_[_0x6169('0x48')]({},_0x4bd1d8,_0x3dbd02[_0x6169('0x4a')]);return db[_0x6169('0x39')][_0x6169('0x51')](_0x4bd1d8)[_0x6169('0x21')](handleEntityNotFound(_0x259138,null))[_0x6169('0x21')](respondWithResult(_0x259138,null))['catch'](handleError(_0x259138,null));};exports[_0x6169('0x52')]=function(_0x24a2ff,_0x1252d9){return db[_0x6169('0x39')][_0x6169('0x52')](_0x24a2ff[_0x6169('0x53')],{})[_0x6169('0x21')](respondWithResult(_0x1252d9,0xc9))[_0x6169('0x29')](handleError(_0x1252d9,null));};exports[_0x6169('0x31')]=function(_0x18190e,_0x14b9dd){if(_0x18190e['body']['id']){delete _0x18190e[_0x6169('0x53')]['id'];}return db[_0x6169('0x39')][_0x6169('0x51')]({'where':{'id':_0x18190e[_0x6169('0x4f')]['id']}})['then'](handleEntityNotFound(_0x14b9dd,null))[_0x6169('0x21')](saveUpdates(_0x18190e[_0x6169('0x53')],null))['then'](respondWithResult(_0x14b9dd,null))['catch'](handleError(_0x14b9dd,null));};exports[_0x6169('0x32')]=function(_0x3f653d,_0x3eeb53){return db[_0x6169('0x39')][_0x6169('0x51')]({'where':{'id':_0x3f653d[_0x6169('0x4f')]['id']}})[_0x6169('0x21')](handleEntityNotFound(_0x3eeb53,null))[_0x6169('0x21')](removeEntity(_0x3eeb53,null))[_0x6169('0x29')](handleError(_0x3eeb53,null));};exports[_0x6169('0x54')]=function(_0x5d0474,_0x56cac8){return db[_0x6169('0x39')][_0x6169('0x54')]()[_0x6169('0x21')](respondWithResult(_0x56cac8,null))[_0x6169('0x29')](handleError(_0x56cac8,null));};var interaction_log=require(_0x6169('0x16'))('openchannel-interactions');exports[_0x6169('0x55')]=function(_0x58adb7,_0x35269c,_0x4810b4){var _0xe1ce7e={'agent':{},'channel':'openchannel'};if(_0x58adb7[_0x6169('0x53')]['id']){delete _0x58adb7[_0x6169('0x53')]['id'];}_0x58adb7['body'][_0x6169('0x56')]=!![];_0x58adb7[_0x6169('0x53')][_0x6169('0x57')]=moment()[_0x6169('0x58')](_0x6169('0x59'));_0x58adb7[_0x6169('0x53')][_0x6169('0x5a')]=_0x58adb7['body'][_0x6169('0x5a')]||_0x58adb7[_0x6169('0x5b')]['id'];_0xe1ce7e[_0x6169('0x5c')]['id']=_0x58adb7[_0x6169('0x53')][_0x6169('0x5a')];return db[_0x6169('0x39')]['find']({'where':{'id':_0x58adb7[_0x6169('0x4f')]['id'],'UserId':null}})[_0x6169('0x21')](handleEntityNotFound(_0x35269c,null))[_0x6169('0x21')](saveUpdates(_0x58adb7[_0x6169('0x53')],null))[_0x6169('0x21')](function(_0x83101f){if(_0x83101f){_0xe1ce7e['message']=_0x83101f[_0x6169('0x5d')]({'plain':!![]});return db[_0x6169('0x5e')]['find']({'where':{'id':_0x83101f[_0x6169('0x5f')]}});}return null;})[_0x6169('0x21')](handleEntityNotFound(_0x35269c,null))['then'](function(_0x5d52e5){if(_0x5d52e5){return _0x5d52e5[_0x6169('0x31')]({'UserId':_0x58adb7[_0x6169('0x53')][_0x6169('0x5a')],'read1stAt':_['isNil'](_0x5d52e5[_0x6169('0x60')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x6169('0x21')](function(_0x980ee9){if(_0x980ee9){_0xe1ce7e[_0x6169('0x61')]=_0x980ee9[_0x6169('0x5d')]({'plain':!![]});interaction_log['info']('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58adb7[_0x6169('0x5b')]['id'],_0x58adb7[_0x6169('0x5b')]['name'],_0x58adb7[_0x6169('0x5b')]['role'],_0xe1ce7e[_0x6169('0x61')]['id'],_0x58adb7[_0x6169('0x53')]?JSON[_0x6169('0x62')](_0x58adb7['body']):_0x6169('0x63'));return respondWithRpcPromise(_0x6169('0x64'),_0x6169('0x65'),_0xe1ce7e);}return null;})[_0x6169('0x21')](function(_0x434ae7){var _0x2e7049=_0x6169('0x66')+_0x434ae7[_0x6169('0x28')]['ContactId'];return db['sequelize'][_0x6169('0x3f')](_0x2e7049,{'type':db['Sequelize'][_0x6169('0x67')][_0x6169('0x68')],'raw':!![]})[_0x6169('0x21')](function(_0x132fc0){return _0x132fc0;});})[_0x6169('0x21')](function(_0x20bb07){if(_0x20bb07){_0xe1ce7e[_0x6169('0x28')][_0x6169('0x69')]=_0x20bb07[0x0];if(!_0x58adb7[_0x6169('0x53')][_0x6169('0x5a')])return;return db[_0x6169('0x6a')]['find']({'where':{'id':_0x58adb7[_0x6169('0x53')][_0x6169('0x5a')],'role':'agent'},'attributes':['id',_0x6169('0x36'),_0x6169('0x6b'),'email',_0x6169('0x6c')],'raw':!![]});}return null;})[_0x6169('0x21')](function(_0x532090){if(!_0x532090)return null;_0xe1ce7e[_0x6169('0x28')][_0x6169('0x5c')]=_0x532090;return _0xe1ce7e;})['then'](function(_0x4af546){if(_0x4af546){if(_0x58adb7[_0x6169('0x53')]['manual']){_0xe1ce7e[_0x6169('0x28')][_0x6169('0x6d')]=util[_0x6169('0x58')](_0x6169('0x6e'),_0x58adb7['user'][_0x6169('0x36')]);_0xe1ce7e[_0x6169('0x28')][_0x6169('0x6f')]=_0xe1ce7e['channel'];_0xe1ce7e[_0x6169('0x28')]['motionChannel']=_0xe1ce7e[_0x6169('0x6f')];_0xe1ce7e[_0x6169('0x28')][_0x6169('0x70')]=_0x6169('0x55');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0xe1ce7e[_0x6169('0x28')]},client9002)[_0x6169('0x21')](function(){return _0xe1ce7e;});}return _0xe1ce7e;}return null;})['then'](respondWithResult(_0x35269c,null))[_0x6169('0x29')](handleError(_0x35269c,null));};var interaction_log=require(_0x6169('0x16'))(_0x6169('0x71'));exports[_0x6169('0x72')]=function(_0x13c70b,_0x46e60f,_0x5c42aa){var _0x5b0b28={'agent':{},'channel':_0x6169('0x73')};if(_0x13c70b[_0x6169('0x53')]['id']){delete _0x13c70b['body']['id'];}_0x13c70b[_0x6169('0x53')]['UserId']=_0x13c70b['body'][_0x6169('0x5a')]||_0x13c70b[_0x6169('0x5b')]['id'];_0x5b0b28[_0x6169('0x5c')]['id']=_0x13c70b[_0x6169('0x53')]['UserId'];return db['OpenchannelMessage'][_0x6169('0x51')]({'where':{'id':_0x13c70b[_0x6169('0x4f')]['id'],'UserId':null}})[_0x6169('0x21')](handleEntityNotFound(_0x46e60f,null))['then'](function(_0x331379){if(_0x331379){_0x5b0b28['message']=_0x331379[_0x6169('0x5d')]({'plain':!![]});return db[_0x6169('0x5e')]['find']({'where':{'id':_0x331379[_0x6169('0x5f')]}});}return null;})[_0x6169('0x21')](handleEntityNotFound(_0x46e60f,null))['then'](function(_0x23e902){if(_0x23e902){_0x5b0b28[_0x6169('0x61')]=_0x23e902[_0x6169('0x5d')]({'plain':!![]});interaction_log[_0x6169('0x22')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x13c70b[_0x6169('0x5b')]['id'],_0x13c70b[_0x6169('0x5b')]['name'],_0x13c70b[_0x6169('0x5b')][_0x6169('0x74')],_0x5b0b28['interaction']['id'],_0x13c70b['body']?JSON['stringify'](_0x13c70b[_0x6169('0x53')]):_0x6169('0x63'));return respondWithRpcPromise(_0x6169('0x75'),_0x6169('0x76'),_0x5b0b28);}return null;})['then'](function(_0x5c7853){var _0x985d0a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5c7853[_0x6169('0x28')][_0x6169('0x77')];return db['sequelize'][_0x6169('0x3f')](_0x985d0a,{'type':db[_0x6169('0x78')][_0x6169('0x67')][_0x6169('0x68')],'raw':!![]})['then'](function(_0x13b30f){return _0x13b30f;});})[_0x6169('0x21')](function(_0x1a83d4){if(_0x1a83d4){_0x5b0b28[_0x6169('0x28')]['contact']=_0x1a83d4[0x0];if(!_0x13c70b[_0x6169('0x53')][_0x6169('0x5a')])return;return db[_0x6169('0x6a')][_0x6169('0x51')]({'where':{'id':_0x13c70b[_0x6169('0x53')][_0x6169('0x5a')],'role':_0x6169('0x5c')},'attributes':['id','name',_0x6169('0x6b'),'email','internal'],'raw':!![]});}return null;})[_0x6169('0x21')](function(_0x3c78d2){if(!_0x3c78d2)return null;_0x5b0b28[_0x6169('0x28')][_0x6169('0x5c')]=_0x3c78d2;return _0x5b0b28;})[_0x6169('0x21')](function(_0x5b9224){if(_0x5b9224){_0x5b9224[_0x6169('0x28')][_0x6169('0x6d')]=util['format'](_0x6169('0x6e'),_0x13c70b['user'][_0x6169('0x36')]);_0x5b9224[_0x6169('0x28')]['channel']=_0x5b0b28[_0x6169('0x6f')];_0x5b9224[_0x6169('0x28')]['motionChannel']=_0x5b0b28[_0x6169('0x6f')];_0x5b9224['message'][_0x6169('0x70')]=_0x6169('0x72');respondWithRpcPromise(_0x6169('0x79'),_0x6169('0x79'),{'event':_0x6169('0x7a'),'message':_0x5b9224['message']},client9002);return _0x5b0b28;}return null;})['then'](respondWithResult(_0x46e60f,null))[_0x6169('0x29')](handleError(_0x46e60f,null));};
\ No newline at end of file
+var _0xd10b=['Sequelize','contact','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelMessage.socket','jayson/promise','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','code','error','message','catch','sendStatus','status','end','offset','limit','count','set','reject','save','destroy','stack','name','index','map','OpenchannelMessage','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','params','length','find','create','body','describe','openchannel-interactions','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','update','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','openchannel','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId'];(function(_0x32550e,_0x3f3b89){var _0x117f89=function(_0x3c9c2e){while(--_0x3c9c2e){_0x32550e['push'](_0x32550e['shift']());}};_0x117f89(++_0x3f3b89);}(_0xd10b,0x189));var _0xbd10=function(_0x1d7c35,_0x21d2b9){_0x1d7c35=_0x1d7c35-0x0;var _0x5064ed=_0xd10b[_0x1d7c35];return _0x5064ed;};'use strict';var emlformat=require(_0xbd10('0x0'));var rimraf=require(_0xbd10('0x1'));var zipdir=require(_0xbd10('0x2'));var jsonpatch=require(_0xbd10('0x3'));var rp=require(_0xbd10('0x4'));var moment=require(_0xbd10('0x5'));var BPromise=require(_0xbd10('0x6'));var Mustache=require(_0xbd10('0x7'));var util=require('util');var path=require('path');var sox=require(_0xbd10('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd10('0x9'));var _=require(_0xbd10('0xa'));var squel=require(_0xbd10('0xb'));var crypto=require(_0xbd10('0xc'));var jsforce=require(_0xbd10('0xd'));var deskjs=require(_0xbd10('0xe'));var toCsv=require(_0xbd10('0xf'));var querystring=require(_0xbd10('0x10'));var Papa=require(_0xbd10('0x11'));var Redis=require(_0xbd10('0x12'));var authService=require(_0xbd10('0x13'));var qs=require(_0xbd10('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd10('0x15'));var logger=require(_0xbd10('0x16'))(_0xbd10('0x17'));var utils=require(_0xbd10('0x18'));var config=require(_0xbd10('0x19'));var licenseUtil=require(_0xbd10('0x1a'));var db=require(_0xbd10('0x1b'))['db'];config['redis']=_[_0xbd10('0x1c')](config['redis'],{'host':_0xbd10('0x1d'),'port':0x18eb});var socket=require(_0xbd10('0x1e'))(new Redis(config[_0xbd10('0x1f')]));require(_0xbd10('0x20'))['register'](socket);var jayson=require(_0xbd10('0x21'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xbd10('0x22')][_0xbd10('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x2c74a2,_0x2ee5fc,_0x160f6e,_0x4e4d10){return new BPromise(function(_0x212399,_0x3c61c3){var _0x7efcf0=_0x4e4d10||client;return _0x7efcf0[_0xbd10('0x24')](_0x2c74a2,_0x160f6e)[_0xbd10('0x25')](function(_0x7d1f16){logger[_0xbd10('0x26')](_0xbd10('0x27'),_0x2ee5fc,_0xbd10('0x28'));logger[_0xbd10('0x29')](_0xbd10('0x2a'),_0x2ee5fc,'request\x20sent',JSON['stringify'](_0x7d1f16));if(_0x7d1f16['error']){if(_0x7d1f16['error'][_0xbd10('0x2b')]===0x1f4){logger[_0xbd10('0x2c')](_0xbd10('0x27'),_0x2ee5fc,_0x7d1f16['error']['message']);return _0x3c61c3(_0x7d1f16[_0xbd10('0x2c')][_0xbd10('0x2d')]);}logger[_0xbd10('0x2c')](_0xbd10('0x27'),_0x2ee5fc,_0x7d1f16[_0xbd10('0x2c')][_0xbd10('0x2d')]);return _0x212399(_0x7d1f16[_0xbd10('0x2c')][_0xbd10('0x2d')]);}else{logger['info'](_0xbd10('0x27'),_0x2ee5fc,'request\x20sent');_0x212399(_0x7d1f16['result'][_0xbd10('0x2d')]);}})[_0xbd10('0x2e')](function(_0x2f21d3){logger[_0xbd10('0x2c')](_0xbd10('0x27'),_0x2ee5fc,_0x2f21d3);_0x3c61c3(_0x2f21d3);});});}function respondWithStatusCode(_0x1fad34,_0xc2c6be){_0xc2c6be=_0xc2c6be||0xcc;return function(_0x4f8571){if(_0x4f8571){return _0x1fad34[_0xbd10('0x2f')](_0xc2c6be);}return _0x1fad34[_0xbd10('0x30')](_0xc2c6be)[_0xbd10('0x31')]();};}function respondWithResult(_0x2c7037,_0x56a041){_0x56a041=_0x56a041||0xc8;return function(_0x4cfd63){if(_0x4cfd63){return _0x2c7037[_0xbd10('0x30')](_0x56a041)['json'](_0x4cfd63);}};}function respondWithFilteredResult(_0x3d80c0,_0x536718){return function(_0x45db01){if(_0x45db01){var _0x1cea00=typeof _0x536718[_0xbd10('0x32')]==='undefined'&&typeof _0x536718[_0xbd10('0x33')]==='undefined';var _0x225333=_0x45db01[_0xbd10('0x34')];var _0x413526=_0x1cea00?0x0:_0x536718['offset'];var _0x43b177=_0x1cea00?_0x45db01['count']:_0x536718[_0xbd10('0x32')]+_0x536718[_0xbd10('0x33')];var _0x4e6a97;if(_0x43b177>=_0x225333){_0x43b177=_0x225333;_0x4e6a97=0xc8;}else{_0x4e6a97=0xce;}_0x3d80c0['status'](_0x4e6a97);return _0x3d80c0[_0xbd10('0x35')]('Content-Range',_0x413526+'-'+_0x43b177+'/'+_0x225333)['json'](_0x45db01);}return null;};}function patchUpdates(_0x12d13e){return function(_0xb2ee81){try{jsonpatch['apply'](_0xb2ee81,_0x12d13e,!![]);}catch(_0x66dc9b){return BPromise[_0xbd10('0x36')](_0x66dc9b);}return _0xb2ee81[_0xbd10('0x37')]();};}function saveUpdates(_0xec869,_0x416fb7){return function(_0x519914){if(_0x519914){return _0x519914['update'](_0xec869)['then'](function(_0x493246){return _0x493246;});}return null;};}function removeEntity(_0xff92e8,_0x55ae35){return function(_0x9016e0){if(_0x9016e0){return _0x9016e0[_0xbd10('0x38')]()[_0xbd10('0x25')](function(){_0xff92e8[_0xbd10('0x30')](0xcc)[_0xbd10('0x31')]();});}};}function handleEntityNotFound(_0x219c21,_0x4bb9b3){return function(_0x321a3b){if(!_0x321a3b){_0x219c21['sendStatus'](0x194);}return _0x321a3b;};}function handleError(_0x115c36,_0x58e207){_0x58e207=_0x58e207||0x1f4;return function(_0x434e7b){logger[_0xbd10('0x2c')](_0x434e7b[_0xbd10('0x39')]);if(_0x434e7b['name']){delete _0x434e7b[_0xbd10('0x3a')];}_0x115c36[_0xbd10('0x30')](_0x58e207)['send'](_0x434e7b);};}exports[_0xbd10('0x3b')]=function(_0x1fe8c1,_0x1590b7){var _0x4f1aaf={},_0x3aea73={},_0x325765={'count':0x0,'rows':[]};var _0x7d9cf7=_[_0xbd10('0x3c')](db[_0xbd10('0x3d')]['rawAttributes'],function(_0x17f84d){return{'name':_0x17f84d[_0xbd10('0x3e')],'type':_0x17f84d['type']['key']};});_0x3aea73[_0xbd10('0x3f')]=_['map'](_0x7d9cf7,_0xbd10('0x3a'));_0x3aea73[_0xbd10('0x40')]=_[_0xbd10('0x41')](_0x1fe8c1[_0xbd10('0x40')]);_0x3aea73[_0xbd10('0x42')]=_[_0xbd10('0x43')](_0x3aea73[_0xbd10('0x3f')],_0x3aea73[_0xbd10('0x40')]);_0x4f1aaf[_0xbd10('0x44')]=_['intersection'](_0x3aea73[_0xbd10('0x3f')],qs['fields'](_0x1fe8c1[_0xbd10('0x40')][_0xbd10('0x45')]));_0x4f1aaf['attributes']=_0x4f1aaf[_0xbd10('0x44')]['length']?_0x4f1aaf[_0xbd10('0x44')]:_0x3aea73[_0xbd10('0x3f')];if(!_0x1fe8c1['query'][_0xbd10('0x46')]('nolimit')){_0x4f1aaf['limit']=qs[_0xbd10('0x33')](_0x1fe8c1[_0xbd10('0x40')]['limit']);_0x4f1aaf[_0xbd10('0x32')]=qs[_0xbd10('0x32')](_0x1fe8c1[_0xbd10('0x40')][_0xbd10('0x32')]);}_0x4f1aaf['order']=qs[_0xbd10('0x47')](_0x1fe8c1['query'][_0xbd10('0x47')]);_0x4f1aaf[_0xbd10('0x48')]=qs[_0xbd10('0x42')](_[_0xbd10('0x49')](_0x1fe8c1[_0xbd10('0x40')],_0x3aea73[_0xbd10('0x42')]),_0x7d9cf7);if(_0x1fe8c1['query'][_0xbd10('0x4a')]){_0x4f1aaf[_0xbd10('0x48')]=_[_0xbd10('0x4b')](_0x4f1aaf[_0xbd10('0x48')],{'$or':_['map'](_0x7d9cf7,function(_0x23f15d){if(_0x23f15d[_0xbd10('0x4c')]!==_0xbd10('0x4d')){var _0x1e8546={};_0x1e8546[_0x23f15d[_0xbd10('0x3a')]]={'$like':'%'+_0x1fe8c1[_0xbd10('0x40')][_0xbd10('0x4a')]+'%'};return _0x1e8546;}})});}_0x4f1aaf=_[_0xbd10('0x4b')]({},_0x4f1aaf,_0x1fe8c1[_0xbd10('0x4e')]);var _0x49a162={'where':_0x4f1aaf[_0xbd10('0x48')]};return db[_0xbd10('0x3d')]['count'](_0x49a162)['then'](function(_0x3c4e56){_0x325765[_0xbd10('0x34')]=_0x3c4e56;if(_0x1fe8c1[_0xbd10('0x40')][_0xbd10('0x4f')]){_0x4f1aaf[_0xbd10('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x4f1aaf);})[_0xbd10('0x25')](function(_0x5cfe12){_0x325765[_0xbd10('0x51')]=_0x5cfe12;return _0x325765;})[_0xbd10('0x25')](respondWithFilteredResult(_0x1590b7,_0x4f1aaf))[_0xbd10('0x2e')](handleError(_0x1590b7,null));};exports['show']=function(_0x233755,_0x5c9e35){var _0x359b7f={'raw':!![],'where':{'id':_0x233755[_0xbd10('0x52')]['id']}},_0x3f918b={};_0x3f918b[_0xbd10('0x3f')]=_[_0xbd10('0x41')](db[_0xbd10('0x3d')]['rawAttributes']);_0x3f918b[_0xbd10('0x40')]=_[_0xbd10('0x41')](_0x233755[_0xbd10('0x40')]);_0x3f918b[_0xbd10('0x42')]=_[_0xbd10('0x43')](_0x3f918b['model'],_0x3f918b['query']);_0x359b7f[_0xbd10('0x44')]=_[_0xbd10('0x43')](_0x3f918b[_0xbd10('0x3f')],qs[_0xbd10('0x45')](_0x233755[_0xbd10('0x40')][_0xbd10('0x45')]));_0x359b7f[_0xbd10('0x44')]=_0x359b7f[_0xbd10('0x44')][_0xbd10('0x53')]?_0x359b7f[_0xbd10('0x44')]:_0x3f918b[_0xbd10('0x3f')];if(_0x233755[_0xbd10('0x40')]['includeAll']){_0x359b7f[_0xbd10('0x50')]=[{'all':!![]}];}_0x359b7f=_[_0xbd10('0x4b')]({},_0x359b7f,_0x233755[_0xbd10('0x4e')]);return db[_0xbd10('0x3d')][_0xbd10('0x54')](_0x359b7f)[_0xbd10('0x25')](handleEntityNotFound(_0x5c9e35,null))[_0xbd10('0x25')](respondWithResult(_0x5c9e35,null))[_0xbd10('0x2e')](handleError(_0x5c9e35,null));};exports[_0xbd10('0x55')]=function(_0x57b52b,_0x41b471){return db[_0xbd10('0x3d')][_0xbd10('0x55')](_0x57b52b[_0xbd10('0x56')],{})[_0xbd10('0x25')](respondWithResult(_0x41b471,0xc9))['catch'](handleError(_0x41b471,null));};exports['update']=function(_0x252928,_0x3834dc){if(_0x252928[_0xbd10('0x56')]['id']){delete _0x252928['body']['id'];}return db[_0xbd10('0x3d')][_0xbd10('0x54')]({'where':{'id':_0x252928['params']['id']}})['then'](handleEntityNotFound(_0x3834dc,null))[_0xbd10('0x25')](saveUpdates(_0x252928[_0xbd10('0x56')],null))['then'](respondWithResult(_0x3834dc,null))[_0xbd10('0x2e')](handleError(_0x3834dc,null));};exports[_0xbd10('0x38')]=function(_0x51972a,_0x534a94){return db[_0xbd10('0x3d')][_0xbd10('0x54')]({'where':{'id':_0x51972a['params']['id']}})[_0xbd10('0x25')](handleEntityNotFound(_0x534a94,null))['then'](removeEntity(_0x534a94,null))[_0xbd10('0x2e')](handleError(_0x534a94,null));};exports['describe']=function(_0x21169d,_0x919720){return db[_0xbd10('0x3d')][_0xbd10('0x57')]()[_0xbd10('0x25')](respondWithResult(_0x919720,null))['catch'](handleError(_0x919720,null));};var interaction_log=require(_0xbd10('0x16'))(_0xbd10('0x58'));exports['accept']=function(_0x471060,_0x4caef0,_0x44c8fa){var _0x135e62={'agent':{},'channel':'openchannel'};if(_0x471060['body']['id']){delete _0x471060[_0xbd10('0x56')]['id'];}_0x471060[_0xbd10('0x56')][_0xbd10('0x59')]=!![];_0x471060[_0xbd10('0x56')][_0xbd10('0x5a')]=moment()[_0xbd10('0x5b')](_0xbd10('0x5c'));_0x471060[_0xbd10('0x56')][_0xbd10('0x5d')]=_0x471060[_0xbd10('0x56')]['UserId']||_0x471060[_0xbd10('0x5e')]['id'];_0x135e62[_0xbd10('0x5f')]['id']=_0x471060['body'][_0xbd10('0x5d')];return db[_0xbd10('0x3d')][_0xbd10('0x54')]({'where':{'id':_0x471060[_0xbd10('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4caef0,null))['then'](saveUpdates(_0x471060[_0xbd10('0x56')],null))['then'](function(_0x5f08b6){if(_0x5f08b6){_0x135e62['message']=_0x5f08b6[_0xbd10('0x60')]({'plain':!![]});return db['OpenchannelInteraction'][_0xbd10('0x54')]({'where':{'id':_0x5f08b6['OpenchannelInteractionId']}});}return null;})[_0xbd10('0x25')](handleEntityNotFound(_0x4caef0,null))['then'](function(_0x5d9c2c){if(_0x5d9c2c){return _0x5d9c2c[_0xbd10('0x61')]({'UserId':_0x471060[_0xbd10('0x56')][_0xbd10('0x5d')],'read1stAt':_[_0xbd10('0x62')](_0x5d9c2c['read1stAt'])?moment()[_0xbd10('0x5b')](_0xbd10('0x5c')):undefined});}return null;})['then'](function(_0x132a28){if(_0x132a28){_0x135e62[_0xbd10('0x63')]=_0x132a28['get']({'plain':!![]});interaction_log[_0xbd10('0x26')](_0xbd10('0x64'),_0x471060['user']['id'],_0x471060[_0xbd10('0x5e')]['name'],_0x471060['user'][_0xbd10('0x65')],_0x135e62[_0xbd10('0x63')]['id'],_0x471060[_0xbd10('0x56')]?JSON[_0xbd10('0x66')](_0x471060[_0xbd10('0x56')]):_0xbd10('0x67'));return respondWithRpcPromise(_0xbd10('0x68'),'acceptMessage',_0x135e62);}return null;})[_0xbd10('0x25')](function(_0x52e999){var _0x2e708e=_0xbd10('0x69')+_0x52e999['message']['ContactId'];return db[_0xbd10('0x6a')][_0xbd10('0x40')](_0x2e708e,{'type':db['Sequelize'][_0xbd10('0x6b')][_0xbd10('0x6c')],'raw':!![]})[_0xbd10('0x25')](function(_0x34cd29){return _0x34cd29;});})[_0xbd10('0x25')](function(_0x143342){if(_0x143342){_0x135e62['message']['contact']=_0x143342[0x0];if(!_0x471060['body']['UserId'])return;return db[_0xbd10('0x6d')][_0xbd10('0x54')]({'where':{'id':_0x471060[_0xbd10('0x56')][_0xbd10('0x5d')],'role':_0xbd10('0x5f')},'attributes':['id',_0xbd10('0x3a'),_0xbd10('0x6e'),_0xbd10('0x6f'),_0xbd10('0x70')],'raw':!![]});}return null;})['then'](function(_0x3aeaa5){if(!_0x3aeaa5)return null;_0x135e62[_0xbd10('0x2d')][_0xbd10('0x5f')]=_0x3aeaa5;return _0x135e62;})[_0xbd10('0x25')](function(_0x1a6906){if(_0x1a6906){if(_0x471060[_0xbd10('0x56')][_0xbd10('0x71')]){_0x135e62['message'][_0xbd10('0x72')]=util[_0xbd10('0x5b')](_0xbd10('0x73'),_0x471060['user']['name']);_0x135e62[_0xbd10('0x2d')][_0xbd10('0x74')]=_0x135e62[_0xbd10('0x74')];_0x135e62['message'][_0xbd10('0x75')]=_0x135e62[_0xbd10('0x74')];_0x135e62[_0xbd10('0x2d')][_0xbd10('0x76')]='accept';return respondWithRpcPromise(_0xbd10('0x77'),_0xbd10('0x77'),{'event':_0xbd10('0x78'),'message':_0x135e62['message']},client9002)[_0xbd10('0x25')](function(){return _0x135e62;});}return _0x135e62;}return null;})[_0xbd10('0x25')](respondWithResult(_0x4caef0,null))[_0xbd10('0x2e')](handleError(_0x4caef0,null));};var interaction_log=require(_0xbd10('0x16'))(_0xbd10('0x58'));exports[_0xbd10('0x36')]=function(_0x134139,_0x33d2d8,_0x37759b){var _0x3c5ebd={'agent':{},'channel':_0xbd10('0x79')};if(_0x134139[_0xbd10('0x56')]['id']){delete _0x134139[_0xbd10('0x56')]['id'];}_0x134139[_0xbd10('0x56')][_0xbd10('0x5d')]=_0x134139['body']['UserId']||_0x134139[_0xbd10('0x5e')]['id'];_0x3c5ebd[_0xbd10('0x5f')]['id']=_0x134139[_0xbd10('0x56')]['UserId'];return db['OpenchannelMessage'][_0xbd10('0x54')]({'where':{'id':_0x134139[_0xbd10('0x52')]['id'],'UserId':null}})[_0xbd10('0x25')](handleEntityNotFound(_0x33d2d8,null))[_0xbd10('0x25')](function(_0x6ec284){if(_0x6ec284){_0x3c5ebd[_0xbd10('0x2d')]=_0x6ec284[_0xbd10('0x60')]({'plain':!![]});return db[_0xbd10('0x7a')][_0xbd10('0x54')]({'where':{'id':_0x6ec284[_0xbd10('0x7b')]}});}return null;})[_0xbd10('0x25')](handleEntityNotFound(_0x33d2d8,null))['then'](function(_0x1b003d){if(_0x1b003d){_0x3c5ebd[_0xbd10('0x63')]=_0x1b003d[_0xbd10('0x60')]({'plain':!![]});interaction_log[_0xbd10('0x26')](_0xbd10('0x7c'),_0x134139[_0xbd10('0x5e')]['id'],_0x134139[_0xbd10('0x5e')][_0xbd10('0x3a')],_0x134139[_0xbd10('0x5e')][_0xbd10('0x65')],_0x3c5ebd[_0xbd10('0x63')]['id'],_0x134139['body']?JSON[_0xbd10('0x66')](_0x134139[_0xbd10('0x56')]):_0xbd10('0x67'));return respondWithRpcPromise('RejectMessage',_0xbd10('0x7d'),_0x3c5ebd);}return null;})[_0xbd10('0x25')](function(_0x464bc6){var _0x461177=_0xbd10('0x69')+_0x464bc6[_0xbd10('0x2d')][_0xbd10('0x7e')];return db[_0xbd10('0x6a')][_0xbd10('0x40')](_0x461177,{'type':db[_0xbd10('0x7f')]['QueryTypes'][_0xbd10('0x6c')],'raw':!![]})[_0xbd10('0x25')](function(_0x3d93c5){return _0x3d93c5;});})[_0xbd10('0x25')](function(_0x25b19b){if(_0x25b19b){_0x3c5ebd[_0xbd10('0x2d')][_0xbd10('0x80')]=_0x25b19b[0x0];if(!_0x134139['body'][_0xbd10('0x5d')])return;return db['User'][_0xbd10('0x54')]({'where':{'id':_0x134139[_0xbd10('0x56')][_0xbd10('0x5d')],'role':_0xbd10('0x5f')},'attributes':['id',_0xbd10('0x3a'),'fullname',_0xbd10('0x6f'),'internal'],'raw':!![]});}return null;})[_0xbd10('0x25')](function(_0x2e88d0){if(!_0x2e88d0)return null;_0x3c5ebd[_0xbd10('0x2d')][_0xbd10('0x5f')]=_0x2e88d0;return _0x3c5ebd;})[_0xbd10('0x25')](function(_0x3fd85e){if(_0x3fd85e){_0x3fd85e[_0xbd10('0x2d')][_0xbd10('0x72')]=util[_0xbd10('0x5b')](_0xbd10('0x73'),_0x134139[_0xbd10('0x5e')][_0xbd10('0x3a')]);_0x3fd85e[_0xbd10('0x2d')]['channel']=_0x3c5ebd['channel'];_0x3fd85e[_0xbd10('0x2d')]['motionChannel']=_0x3c5ebd['channel'];_0x3fd85e[_0xbd10('0x2d')][_0xbd10('0x76')]='reject';respondWithRpcPromise(_0xbd10('0x77'),_0xbd10('0x77'),{'event':_0xbd10('0x81'),'message':_0x3fd85e[_0xbd10('0x2d')]},client9002);return _0x3c5ebd;}return null;})[_0xbd10('0x25')](respondWithResult(_0x33d2d8,null))['catch'](handleError(_0x33d2d8,null));};
\ No newline at end of file
index 666e2bf..6158797 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5d7d=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x1c2da9,_0x4539c8){var _0x16065f=function(_0x2e354e){while(--_0x2e354e){_0x1c2da9['push'](_0x1c2da9['shift']());}};_0x16065f(++_0x4539c8);}(_0x5d7d,0xf4));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xd5d7('0x0'));var OpenchannelMessage=require(_0xd5d7('0x1'))['db'][_0xd5d7('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xd5d7('0x3')](0x0);var events={'afterCreate':_0xd5d7('0x4'),'afterUpdate':_0xd5d7('0x5'),'afterDestroy':_0xd5d7('0x6')};function emitEvent(_0x540f60){return function(_0x3f1587,_0x3b7ee0,_0x58a98a){OpenchannelMessageEvents[_0xd5d7('0x7')](_0x540f60+':'+_0x3f1587['id'],_0x3f1587);OpenchannelMessageEvents[_0xd5d7('0x7')](_0x540f60,_0x3f1587);_0x58a98a(null);};}for(var e in events){if(events[_0xd5d7('0x8')](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xd5d7('0x9')]=OpenchannelMessageEvents;
\ No newline at end of file
+var _0xee97=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','OpenchannelMessage'];(function(_0x46bdee,_0x3c3738){var _0x5a3fae=function(_0x255ed8){while(--_0x255ed8){_0x46bdee['push'](_0x46bdee['shift']());}};_0x5a3fae(++_0x3c3738);}(_0xee97,0x1ab));var _0x7ee9=function(_0x27f6a2,_0x5c9bf9){_0x27f6a2=_0x27f6a2-0x0;var _0xc4fd1f=_0xee97[_0x27f6a2];return _0xc4fd1f;};'use strict';var EventEmitter=require(_0x7ee9('0x0'));var OpenchannelMessage=require(_0x7ee9('0x1'))['db'][_0x7ee9('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x7ee9('0x3')](0x0);var events={'afterCreate':_0x7ee9('0x4'),'afterUpdate':_0x7ee9('0x5'),'afterDestroy':_0x7ee9('0x6')};function emitEvent(_0x591de1){return function(_0x3142ee,_0x120e4e,_0x23029b){OpenchannelMessageEvents['emit'](_0x591de1+':'+_0x3142ee['id'],_0x3142ee);OpenchannelMessageEvents[_0x7ee9('0x7')](_0x591de1,_0x3142ee);_0x23029b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x7ee9('0x8')](e,emitEvent(event));}}module[_0x7ee9('0x9')]=OpenchannelMessageEvents;
\ No newline at end of file
index 1f25533..0f570cc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xefcb=['threadId','error','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','fti_openchannel_messages','body','FULLTEXT','models','get','toLowerCase','direction','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','catch','out','CmContact','describe','OpenchannelAccount','OpenchannelAccountId','Interactions','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','Interaction','omit','method','GET','POST','Message\x20%d\x20forwarded\x20to\x20%s'];(function(_0x29a894,_0x5f2d6f){var _0x588f68=function(_0x3a19cf){while(--_0x3a19cf){_0x29a894['push'](_0x29a894['shift']());}};_0x588f68(++_0x5f2d6f);}(_0xefcb,0xde));var _0xbefc=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xefcb[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xbefc('0x0'));var util=require(_0xbefc('0x1'));var logger=require(_0xbefc('0x2'))(_0xbefc('0x3'));var moment=require(_0xbefc('0x4'));var BPromise=require(_0xbefc('0x5'));var rp=require(_0xbefc('0x6'));var fs=require('fs');var path=require(_0xbefc('0x7'));var rimraf=require('rimraf');var config=require(_0xbefc('0x8'));var attributes=require(_0xbefc('0x9'));module['exports']=function(_0x4b39ad,_0x5cc20f){return _0x4b39ad[_0xbefc('0xa')](_0xbefc('0xb'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xbefc('0xc'),'fields':[_0xbefc('0xd')],'type':_0xbefc('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2bb3ed,_0x2abeda,_0x17ee87){var _0x56e08a=_0x4b39ad[_0xbefc('0xf')];var _0x4774bb=_0x2bb3ed[_0xbefc('0x10')]({'plain':!![]});if(_0x4774bb['direction'][_0xbefc('0x11')]()==='in'||_0x4774bb[_0xbefc('0x12')][_0xbefc('0x11')]()==='out'&&!_0x4774bb[_0xbefc('0x13')]&&!_['isNil'](_0x4774bb[_0xbefc('0x14')])){_0x56e08a[_0xbefc('0x15')][_0xbefc('0x16')]({'where':{'id':_0x4774bb[_0xbefc('0x17')]}})[_0xbefc('0x18')](function(_0x50f138){if(_0x50f138){_0x50f138[_0xbefc('0x19')]({'lastMsgAt':_0x4774bb[_0xbefc('0x1a')],'lastMsgDirection':_0x4774bb[_0xbefc('0x12')][_0xbefc('0x11')]()});}})[_0xbefc('0x1b')](function(_0xd2316b){console['error'](_0xd2316b);});}if(_0x4774bb[_0xbefc('0x12')]===_0xbefc('0x1c')&&!_0x4774bb['secret']){var _0x585328;_0x56e08a[_0xbefc('0x1d')][_0xbefc('0x1e')]()[_0xbefc('0x18')](function(_0x80b69a){return _0x56e08a[_0xbefc('0x1f')]['find']({'where':{'id':_0x4774bb[_0xbefc('0x20')]},'include':[{'model':_0x56e08a[_0xbefc('0x15')],'as':_0xbefc('0x21'),'where':{'id':_0x4774bb['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x56e08a[_0xbefc('0x1d')],'as':_0xbefc('0x22'),'attributes':_[_0xbefc('0x23')](_0x80b69a)}]}]});})[_0xbefc('0x18')](function(_0x334e5b){_0x585328=_0x334e5b[_0xbefc('0x10')]({'plain':!![]});if(_0x585328&&_0x585328['replyUri']){logger[_0xbefc('0x24')](_0xbefc('0x25'),_0xbefc('0x26'),util[_0xbefc('0x27')](_0xbefc('0x28'),_0x4774bb['id'],_0x585328[_0xbefc('0x29')]));if(_0x585328['Interactions']&&_0x585328[_0xbefc('0x21')]['length']){_0x4774bb[_0xbefc('0x2a')]=_[_0xbefc('0x2b')](_0x585328['Interactions'][0x0],_0xbefc('0x22'));_0x4774bb[_0xbefc('0x22')]=_0x585328[_0xbefc('0x21')][0x0][_0xbefc('0x22')];}var _0x2abeda={'method':'POST','uri':encodeURI(_0x585328[_0xbefc('0x29')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2abeda[_0xbefc('0x2c')]){case _0xbefc('0x2d'):_0x2abeda['qs']=_0x4774bb;break;case _0xbefc('0x2e'):_0x2abeda[_0xbefc('0xd')]=_0x4774bb;break;}return rp(_0x2abeda)['then'](function(_0x32dc0e){logger[_0xbefc('0x24')](_0xbefc('0x25'),_0xbefc('0x26'),util[_0xbefc('0x27')](_0xbefc('0x2f'),_0x4774bb['id'],_0x585328[_0xbefc('0x29')]));if(_0x32dc0e[_0xbefc('0xd')][_0xbefc('0x30')]&&_0x32dc0e[_0xbefc('0xd')][_0xbefc('0x30')]!=_0x4774bb[_0xbefc('0x2a')][_0xbefc('0x30')]){return _0x56e08a['OpenchannelInteraction']['update']({'threadId':_0x32dc0e[_0xbefc('0xd')]['threadId']},{'where':{'id':_0x4774bb[_0xbefc('0x2a')]['id']}});}else{return;}})[_0xbefc('0x18')](function(){return _0x2bb3ed[_0xbefc('0x19')]({'read':!![]});})['catch'](function(_0x28ca0a){logger[_0xbefc('0x31')]('OpenchannelMessage,\x20%s,\x20%s',_0xbefc('0x26'),util[_0xbefc('0x32')](_0x28ca0a,{'showHidden':![],'depth':null}));_0x17ee87();});}else{_0x17ee87();}})[_0xbefc('0x33')](function(){_0x17ee87();});}else{_0x17ee87();}}},'charset':_0xbefc('0x34'),'collate':_0xbefc('0x35')});};
\ No newline at end of file
+var _0x87c1=['CmContact','describe','find','OpenchannelAccountId','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','omit','POST','method','GET','body','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','update','inspect','finally','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','models','get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','createdAt','catch','error'];(function(_0x1afa2f,_0x478dc0){var _0x95e7b3=function(_0x5b90ef){while(--_0x5b90ef){_0x1afa2f['push'](_0x1afa2f['shift']());}};_0x95e7b3(++_0x478dc0);}(_0x87c1,0x7f));var _0x187c=function(_0x3e4026,_0x443ec2){_0x3e4026=_0x3e4026-0x0;var _0x58fb46=_0x87c1[_0x3e4026];return _0x58fb46;};'use strict';var _=require(_0x187c('0x0'));var util=require('util');var logger=require(_0x187c('0x1'))('api');var moment=require(_0x187c('0x2'));var BPromise=require(_0x187c('0x3'));var rp=require(_0x187c('0x4'));var fs=require('fs');var path=require(_0x187c('0x5'));var rimraf=require(_0x187c('0x6'));var config=require('../../config/environment');var attributes=require('./openchannelMessage.attributes');module[_0x187c('0x7')]=function(_0x151ca8,_0x12678b){return _0x151ca8[_0x187c('0x8')](_0x187c('0x9'),attributes,{'tableName':_0x187c('0xa'),'paranoid':![],'indexes':[{'name':_0x187c('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x51f67e,_0x580fed,_0x2d5dc3){var _0x402c00=_0x151ca8[_0x187c('0xc')];var _0x55a602=_0x51f67e[_0x187c('0xd')]({'plain':!![]});if(_0x55a602[_0x187c('0xe')]['toLowerCase']()==='in'||_0x55a602[_0x187c('0xe')][_0x187c('0xf')]()==='out'&&!_0x55a602[_0x187c('0x10')]&&!_[_0x187c('0x11')](_0x55a602[_0x187c('0x12')])){_0x402c00[_0x187c('0x13')][_0x187c('0x14')]({'where':{'id':_0x55a602[_0x187c('0x15')]}})[_0x187c('0x16')](function(_0x49fa42){if(_0x49fa42){_0x49fa42['update']({'lastMsgAt':_0x55a602[_0x187c('0x17')],'lastMsgDirection':_0x55a602[_0x187c('0xe')][_0x187c('0xf')]()});}})[_0x187c('0x18')](function(_0xbf9033){console[_0x187c('0x19')](_0xbf9033);});}if(_0x55a602[_0x187c('0xe')]==='out'&&!_0x55a602['secret']){var _0xdcca25;_0x402c00[_0x187c('0x1a')][_0x187c('0x1b')]()[_0x187c('0x16')](function(_0x1596f7){return _0x402c00['OpenchannelAccount'][_0x187c('0x1c')]({'where':{'id':_0x55a602[_0x187c('0x1d')]},'include':[{'model':_0x402c00[_0x187c('0x13')],'as':'Interactions','where':{'id':_0x55a602[_0x187c('0x15')]},'limit':0x1,'include':[{'model':_0x402c00[_0x187c('0x1a')],'as':_0x187c('0x1e'),'attributes':_['keys'](_0x1596f7)}]}]});})[_0x187c('0x16')](function(_0x75749b){_0xdcca25=_0x75749b['get']({'plain':!![]});if(_0xdcca25&&_0xdcca25[_0x187c('0x1f')]){logger[_0x187c('0x20')](_0x187c('0x21'),_0x187c('0x22'),util[_0x187c('0x23')](_0x187c('0x24'),_0x55a602['id'],_0xdcca25[_0x187c('0x1f')]));if(_0xdcca25[_0x187c('0x25')]&&_0xdcca25[_0x187c('0x25')][_0x187c('0x26')]){_0x55a602['Interaction']=_[_0x187c('0x27')](_0xdcca25['Interactions'][0x0],'Contact');_0x55a602[_0x187c('0x1e')]=_0xdcca25[_0x187c('0x25')][0x0][_0x187c('0x1e')];}var _0x580fed={'method':_0x187c('0x28'),'uri':encodeURI(_0xdcca25[_0x187c('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x580fed[_0x187c('0x29')]){case _0x187c('0x2a'):_0x580fed['qs']=_0x55a602;break;case _0x187c('0x28'):_0x580fed[_0x187c('0x2b')]=_0x55a602;break;}return rp(_0x580fed)[_0x187c('0x16')](function(_0x206e39){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x187c('0x22'),util[_0x187c('0x23')](_0x187c('0x2c'),_0x55a602['id'],_0xdcca25[_0x187c('0x1f')]));if(_0x206e39[_0x187c('0x2b')][_0x187c('0x2d')]&&_0x206e39[_0x187c('0x2b')]['threadId']!=_0x55a602[_0x187c('0x2e')][_0x187c('0x2d')]){return _0x402c00[_0x187c('0x13')]['update']({'threadId':_0x206e39[_0x187c('0x2b')][_0x187c('0x2d')]},{'where':{'id':_0x55a602[_0x187c('0x2e')]['id']}});}else{return;}})[_0x187c('0x16')](function(){return _0x51f67e[_0x187c('0x2f')]({'read':!![]});})['catch'](function(_0x32d21b){logger[_0x187c('0x19')](_0x187c('0x21'),_0x187c('0x22'),util[_0x187c('0x30')](_0x32d21b,{'showHidden':![],'depth':null}));_0x2d5dc3();});}else{_0x2d5dc3();}})[_0x187c('0x31')](function(){_0x2d5dc3();});}else{_0x2d5dc3();}}},'charset':'utf8mb4','collate':_0x187c('0x32')});};
\ No newline at end of file
index 8e9e3f9..7760459 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x504291,_0x3b79bf){var _0x79a64c=function(_0x391223){while(--_0x391223){_0x504291['push'](_0x504291['shift']());}};_0x79a64c(++_0x3b79bf);}(_0xadb5,0xad));var _0x5adb=function(_0x126ffa,_0x3553f4){_0x126ffa=_0x126ffa-0x0;var _0x5d5d79=_0xadb5[_0x126ffa];return _0x5d5d79;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});};
\ No newline at end of file
+var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0xc3cdbc,_0x265415){var _0x4a8a2c=function(_0x1e9007){while(--_0x1e9007){_0xc3cdbc['push'](_0xc3cdbc['shift']());}};_0x4a8a2c(++_0x265415);}(_0xadb5,0xad));var _0x5adb=function(_0x3dd9ec,_0x47c75a){_0x3dd9ec=_0x3dd9ec-0x0;var _0x19220a=_0xadb5[_0x3dd9ec];return _0x19220a;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});};
\ No newline at end of file
index 0ed751c..717eb61 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7278=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener','register'];(function(_0x53b6ae,_0x3cb9f4){var _0x34f4b2=function(_0x4b3169){while(--_0x4b3169){_0x53b6ae['push'](_0x53b6ae['shift']());}};_0x34f4b2(++_0x3cb9f4);}(_0x7278,0x161));var _0x8727=function(_0x620d5d,_0xc55aa5){_0x620d5d=_0x620d5d-0x0;var _0x42a5da=_0x7278[_0x620d5d];return _0x42a5da;};'use strict';var OpenchannelMessageEvents=require(_0x8727('0x0'));var events=[_0x8727('0x1'),_0x8727('0x2'),_0x8727('0x3')];function createListener(_0x2ee64e,_0x5822da){return function(_0x1ddbe9){_0x5822da[_0x8727('0x4')](_0x2ee64e,_0x1ddbe9);};}function removeListener(_0x6007de,_0x221021){return function(){OpenchannelMessageEvents[_0x8727('0x5')](_0x6007de,_0x221021);};}exports[_0x8727('0x6')]=function(_0x180b71){for(var _0x5549d5=0x0,_0xfd1902=events[_0x8727('0x7')];_0x5549d5<_0xfd1902;_0x5549d5++){var _0xffd783=events[_0x5549d5];var _0x435911=createListener(_0x8727('0x8')+_0xffd783,_0x180b71);OpenchannelMessageEvents['on'](_0xffd783,_0x435911);}};
\ No newline at end of file
+var _0x4059=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0x4059,0xb2));var _0x9405=function(_0xca0aac,_0x23689c){_0xca0aac=_0xca0aac-0x0;var _0x58a0c1=_0x4059[_0xca0aac];return _0x58a0c1;};'use strict';var OpenchannelMessageEvents=require(_0x9405('0x0'));var events=[_0x9405('0x1'),_0x9405('0x2'),_0x9405('0x3')];function createListener(_0x12007c,_0x51ccd7){return function(_0xe43380){_0x51ccd7[_0x9405('0x4')](_0x12007c,_0xe43380);};}function removeListener(_0x230fff,_0x1fe9d1){return function(){OpenchannelMessageEvents[_0x9405('0x5')](_0x230fff,_0x1fe9d1);};}exports['register']=function(_0x904624){for(var _0x3701f3=0x0,_0x5e1b5e=events[_0x9405('0x6')];_0x3701f3<_0x5e1b5e;_0x3701f3++){var _0x18dd09=events[_0x3701f3];var _0x4fc464=createListener(_0x9405('0x7')+_0x18dd09,_0x904624);OpenchannelMessageEvents['on'](_0x18dd09,_0x4fc464);}};
\ No newline at end of file
index 5b0d090..90eea57 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8da2=['/describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','create','post','/:id/teams','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','isAuthenticated','index','get'];(function(_0x65acd6,_0x320a16){var _0x5d93c0=function(_0x2bd633){while(--_0x2bd633){_0x65acd6['push'](_0x65acd6['shift']());}};_0x5d93c0(++_0x320a16);}(_0x8da2,0x148));var _0x28da=function(_0xca287c,_0x10bb40){_0xca287c=_0xca287c-0x0;var _0x1da511=_0x8da2[_0xca287c];return _0x1da511;};'use strict';var multer=require(_0x28da('0x0'));var util=require(_0x28da('0x1'));var path=require(_0x28da('0x2'));var timeout=require(_0x28da('0x3'));var express=require(_0x28da('0x4'));var router=express['Router']();var fs_extra=require(_0x28da('0x5'));var auth=require(_0x28da('0x6'));var interaction=require(_0x28da('0x7'));var config=require(_0x28da('0x8'));var controller=require(_0x28da('0x9'));router['get']('/',auth[_0x28da('0xa')](),controller[_0x28da('0xb')]);router[_0x28da('0xc')](_0x28da('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x28da('0xc')](_0x28da('0xe'),auth[_0x28da('0xa')](),controller[_0x28da('0xf')]);router[_0x28da('0xc')](_0x28da('0x10'),auth[_0x28da('0xa')](),controller['getMembers']);router[_0x28da('0xc')]('/:id/teams',auth[_0x28da('0xa')](),controller[_0x28da('0x11')]);router['get'](_0x28da('0x12'),auth[_0x28da('0xa')](),controller[_0x28da('0x13')]);router['post']('/',auth[_0x28da('0xa')](),controller[_0x28da('0x14')]);router[_0x28da('0x15')](_0x28da('0x16'),auth[_0x28da('0xa')](),controller[_0x28da('0x17')]);router[_0x28da('0x15')](_0x28da('0x12'),auth[_0x28da('0xa')](),controller[_0x28da('0x18')]);router['put'](_0x28da('0xe'),auth[_0x28da('0xa')](),controller[_0x28da('0x19')]);router[_0x28da('0x1a')](_0x28da('0xe'),auth[_0x28da('0xa')](),controller[_0x28da('0x1b')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x28da('0x1c')]);router[_0x28da('0x1a')](_0x28da('0x12'),auth[_0x28da('0xa')](),controller[_0x28da('0x1d')]);module[_0x28da('0x1e')]=router;
\ No newline at end of file
+var _0x397f=['/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','put','/:id','update','delete','removeTeams','removeAgents','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','show'];(function(_0x205255,_0x18ef0e){var _0x185a99=function(_0x6b3c1f){while(--_0x6b3c1f){_0x205255['push'](_0x205255['shift']());}};_0x185a99(++_0x18ef0e);}(_0x397f,0x1c2));var _0xf397=function(_0x738311,_0xba0d68){_0x738311=_0x738311-0x0;var _0x4a616=_0x397f[_0x738311];return _0x4a616;};'use strict';var multer=require('multer');var util=require(_0xf397('0x0'));var path=require(_0xf397('0x1'));var timeout=require('connect-timeout');var express=require(_0xf397('0x2'));var router=express[_0xf397('0x3')]();var fs_extra=require(_0xf397('0x4'));var auth=require(_0xf397('0x5'));var interaction=require(_0xf397('0x6'));var config=require(_0xf397('0x7'));var controller=require(_0xf397('0x8'));router[_0xf397('0x9')]('/',auth[_0xf397('0xa')](),controller[_0xf397('0xb')]);router[_0xf397('0x9')]('/describe',auth[_0xf397('0xa')](),controller[_0xf397('0xc')]);router[_0xf397('0x9')]('/:id',auth[_0xf397('0xa')](),controller[_0xf397('0xd')]);router['get'](_0xf397('0xe'),auth[_0xf397('0xa')](),controller[_0xf397('0xf')]);router[_0xf397('0x9')](_0xf397('0x10'),auth[_0xf397('0xa')](),controller[_0xf397('0x11')]);router[_0xf397('0x9')](_0xf397('0x12'),auth['isAuthenticated'](),controller[_0xf397('0x13')]);router[_0xf397('0x14')]('/',auth[_0xf397('0xa')](),controller[_0xf397('0x15')]);router[_0xf397('0x14')]('/:id/teams',auth[_0xf397('0xa')](),controller['addTeams']);router[_0xf397('0x14')](_0xf397('0x12'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf397('0x16')](_0xf397('0x17'),auth[_0xf397('0xa')](),controller[_0xf397('0x18')]);router['delete'](_0xf397('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0xf397('0x19')]('/:id/teams',auth[_0xf397('0xa')](),controller[_0xf397('0x1a')]);router[_0xf397('0x19')]('/:id/users',auth[_0xf397('0xa')](),controller[_0xf397('0x1b')]);module[_0xf397('0x1c')]=router;
\ No newline at end of file
index be3da47..22ebbf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f71=['beepall','sequelize','exports','STRING','name','INTEGER','rrmemory'];(function(_0x18ee80,_0x2adf1c){var _0x2f60c2=function(_0x2bd265){while(--_0x2bd265){_0x18ee80['push'](_0x18ee80['shift']());}};_0x2f60c2(++_0x2adf1c);}(_0x9f71,0x1c8));var _0x19f7=function(_0x4e55e4,_0x24a34e){_0x4e55e4=_0x4e55e4-0x0;var _0x3d6c83=_0x9f71[_0x4e55e4];return _0x3d6c83;};'use strict';var Sequelize=require(_0x19f7('0x0'));module[_0x19f7('0x1')]={'name':{'type':Sequelize[_0x19f7('0x2')],'unique':_0x19f7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x19f7('0x2')]},'timeout':{'type':Sequelize[_0x19f7('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x19f7('0x5'),_0x19f7('0x6'),'roundrobin')}};
\ No newline at end of file
+var _0x42e4=['STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x42e4,0xdf));var _0x442e=function(_0x7046e,_0x121ce1){_0x7046e=_0x7046e-0x0;var _0x256ee7=_0x42e4[_0x7046e];return _0x256ee7;};'use strict';var Sequelize=require(_0x442e('0x0'));module['exports']={'name':{'type':Sequelize[_0x442e('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x442e('0x1')]},'timeout':{'type':Sequelize[_0x442e('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x442e('0x3')](_0x442e('0x4'),_0x442e('0x5'),_0x442e('0x6'))}};
\ No newline at end of file
index 4ab9f64..e9b54f0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x918b=['toString','QueryTypes','SELECT','includes','compact','value','removeAgents','addAgents','omit','spread','userOpenchannelQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','getOptions','include','findAll','params','keys','query','filters','intersection','model','fields','attributes','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','where','OpenchannelQueueId','filter','findAndCountAll','UserId','openchannelPause','createdAt','rows','SIP','getTeams','findOne','addTeams','User','Agents','online','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Team','ids','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0x918b,0x82));var _0xb918=function(_0x501035,_0x3c1742){_0x501035=_0x501035-0x0;var _0x4dd166=_0x918b[_0x501035];return _0x4dd166;};'use strict';var BPromise=require(_0xb918('0x0'));var util=require(_0xb918('0x1'));var _=require(_0xb918('0x2'));var squel=require(_0xb918('0x3'));var Redis=require(_0xb918('0x4'));var qs=require(_0xb918('0x5'));var logger=require(_0xb918('0x6'))(_0xb918('0x7'));var config=require('../../config/environment');var db=require(_0xb918('0x8'))['db'];config['redis']=_[_0xb918('0x9')](config[_0xb918('0xa')],{'host':_0xb918('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelQueue.socket')[_0xb918('0xc')](socket);function respondWithStatusCode(_0x2c6aad,_0x36889e){_0x36889e=_0x36889e||0xcc;return function(_0x3215c7){if(_0x3215c7){return _0x2c6aad[_0xb918('0xd')](_0x36889e);}return _0x2c6aad[_0xb918('0xe')](_0x36889e)[_0xb918('0xf')]();};}function respondWithResult(_0x3e7238,_0x3b6ec6){_0x3b6ec6=_0x3b6ec6||0xc8;return function(_0x4d8ce3){if(_0x4d8ce3){return _0x3e7238[_0xb918('0xe')](_0x3b6ec6)[_0xb918('0x10')](_0x4d8ce3);}};}function respondWithFilteredResult(_0x3c82eb,_0xe5d30b){return function(_0x4f3f1c){if(_0x4f3f1c){var _0xe61635=typeof _0xe5d30b[_0xb918('0x11')]==='undefined'&&typeof _0xe5d30b[_0xb918('0x12')]===_0xb918('0x13');var _0x17e9c0=_0x4f3f1c[_0xb918('0x14')];var _0x4ed031=_0xe61635?0x0:_0xe5d30b[_0xb918('0x11')];var _0x514edd=_0xe61635?_0x4f3f1c[_0xb918('0x14')]:_0xe5d30b[_0xb918('0x11')]+_0xe5d30b[_0xb918('0x12')];var _0xb1de66;if(_0x514edd>=_0x17e9c0){_0x514edd=_0x17e9c0;_0xb1de66=0xc8;}else{_0xb1de66=0xce;}_0x3c82eb['status'](_0xb1de66);return _0x3c82eb['set'](_0xb918('0x15'),_0x4ed031+'-'+_0x514edd+'/'+_0x17e9c0)[_0xb918('0x10')](_0x4f3f1c);}return null;};}function saveUpdates(_0x3258aa){return function(_0x53e82d){if(_0x53e82d){return _0x53e82d[_0xb918('0x16')](_0x3258aa)[_0xb918('0x17')](function(_0x1a1a4c){return _0x1a1a4c;});}return null;};}function removeEntity(_0x174bb3){return function(_0x192097){if(_0x192097){return _0x192097[_0xb918('0x18')]()[_0xb918('0x17')](function(){var _0x33b954=_0x192097[_0xb918('0x19')]({'plain':!![]});var _0xf3cb70=_0xb918('0x1a');return db[_0xb918('0x1b')][_0xb918('0x18')]({'where':{'type':_0xf3cb70,'resourceId':_0x33b954['id']}})[_0xb918('0x17')](function(){return _0x192097;});})[_0xb918('0x17')](function(){_0x174bb3[_0xb918('0xe')](0xcc)[_0xb918('0xf')]();});}};}function handleEntityNotFound(_0x58d5ca){return function(_0x1e14ef){if(!_0x1e14ef){_0x58d5ca['sendStatus'](0x194);}return _0x1e14ef;};}function handleError(_0x3602b4,_0x315d1d){_0x315d1d=_0x315d1d||0x1f4;return function(_0x3cdd3e){logger[_0xb918('0x1c')](_0x3cdd3e['stack']);if(_0x3cdd3e[_0xb918('0x1d')]){delete _0x3cdd3e['name'];}_0x3602b4[_0xb918('0xe')](_0x315d1d)[_0xb918('0x1e')](_0x3cdd3e);};}exports[_0xb918('0x1f')]=function(_0x5d5f55,_0x2f3041){var _0x324c66={};var _0x37f290={'count':0x0,'rows':[]};var _0x31c02c=_[_0xb918('0x20')](db[_0xb918('0x21')][_0xb918('0x22')],function(_0x4b2226){return{'name':_0x4b2226[_0xb918('0x23')],'type':_0x4b2226[_0xb918('0x24')][_0xb918('0x25')]};});_0x324c66=qs[_0xb918('0x26')](_0x31c02c,_0x5d5f55);var _0x4eae97={'where':_0x324c66['where']};return db['OpenchannelQueue']['count'](_0x4eae97)[_0xb918('0x17')](function(_0x3a2c2c){_0x37f290[_0xb918('0x14')]=_0x3a2c2c;_0x324c66[_0xb918('0x27')]=qs[_0xb918('0x27')](_0x5d5f55['query']);return db[_0xb918('0x21')][_0xb918('0x28')](_0x324c66);})[_0xb918('0x17')](function(_0x8b742d){_0x37f290['rows']=_0x8b742d;return _0x37f290;})[_0xb918('0x17')](respondWithFilteredResult(_0x2f3041,_0x324c66))['catch'](handleError(_0x2f3041,null));};exports['show']=function(_0x6c4685,_0x107408){var _0x243f6b={'raw':!![],'where':{'id':_0x6c4685[_0xb918('0x29')]['id']}},_0xdaee68={};_0xdaee68['model']=_[_0xb918('0x2a')](db[_0xb918('0x21')]['rawAttributes']);_0xdaee68[_0xb918('0x2b')]=_[_0xb918('0x2a')](_0x6c4685['query']);_0xdaee68[_0xb918('0x2c')]=_[_0xb918('0x2d')](_0xdaee68[_0xb918('0x2e')],_0xdaee68[_0xb918('0x2b')]);_0x243f6b['attributes']=_[_0xb918('0x2d')](_0xdaee68[_0xb918('0x2e')],qs[_0xb918('0x2f')](_0x6c4685[_0xb918('0x2b')][_0xb918('0x2f')]));_0x243f6b[_0xb918('0x30')]=_0x243f6b[_0xb918('0x30')][_0xb918('0x31')]?_0x243f6b['attributes']:_0xdaee68[_0xb918('0x2e')];if(_0x6c4685[_0xb918('0x2b')][_0xb918('0x32')]){_0x243f6b[_0xb918('0x27')]=[{'all':!![]}];}_0x243f6b=_[_0xb918('0x33')]({},_0x243f6b,_0x6c4685[_0xb918('0x34')]);return db['OpenchannelQueue']['find'](_0x243f6b)['then'](handleEntityNotFound(_0x107408,null))[_0xb918('0x17')](respondWithResult(_0x107408,null))['catch'](handleError(_0x107408,null));};exports[_0xb918('0x35')]=function(_0xd00dcd,_0x1dab46){return db[_0xb918('0x21')][_0xb918('0x35')](_0xd00dcd[_0xb918('0x36')],{})[_0xb918('0x17')](function(_0x35b016){var _0x5e6308=_0xd00dcd[_0xb918('0x37')]['get']({'plain':!![]});if(!_0x5e6308)throw new Error(_0xb918('0x38'));if(_0x5e6308[_0xb918('0x39')]===_0xb918('0x37')){var _0x1286dc=_0x35b016[_0xb918('0x19')]({'plain':!![]});var _0x5a85b1=_0xb918('0x1a');return db[_0xb918('0x3a')]['find']({'where':{'name':_0x5a85b1,'userProfileId':_0x5e6308['userProfileId']},'raw':!![]})[_0xb918('0x17')](function(_0x2838dc){if(_0x2838dc&&_0x2838dc[_0xb918('0x3b')]===0x0){return db[_0xb918('0x1b')][_0xb918('0x35')]({'name':_0x1286dc[_0xb918('0x1d')],'resourceId':_0x1286dc['id'],'type':_0x2838dc[_0xb918('0x1d')],'sectionId':_0x2838dc['id']},{})[_0xb918('0x17')](function(){return _0x35b016;});}else{return _0x35b016;}})[_0xb918('0x3c')](function(_0x1672db){logger['error'](_0xb918('0x3d'),_0x1672db);throw _0x1672db;});}return _0x35b016;})['then'](respondWithResult(_0x1dab46,0xc9))[_0xb918('0x3c')](handleError(_0x1dab46,null));};exports['update']=function(_0x12f7f1,_0x4565ec){if(_0x12f7f1[_0xb918('0x36')]['id']){delete _0x12f7f1['body']['id'];}return db[_0xb918('0x21')][_0xb918('0x3e')]({'where':{'id':_0x12f7f1[_0xb918('0x29')]['id']}})[_0xb918('0x17')](handleEntityNotFound(_0x4565ec,null))[_0xb918('0x17')](saveUpdates(_0x12f7f1['body'],null))[_0xb918('0x17')](respondWithResult(_0x4565ec,null))[_0xb918('0x3c')](handleError(_0x4565ec,null));};exports[_0xb918('0x18')]=function(_0x359980,_0x4fc998){return db['OpenchannelQueue']['find']({'where':{'id':_0x359980[_0xb918('0x29')]['id']}})[_0xb918('0x17')](handleEntityNotFound(_0x4fc998,null))[_0xb918('0x17')](removeEntity(_0x4fc998,null))[_0xb918('0x3c')](handleError(_0x4fc998,null));};exports[_0xb918('0x3f')]=function(_0x467d8f,_0x57cd34){return db[_0xb918('0x21')][_0xb918('0x3f')]()[_0xb918('0x17')](respondWithResult(_0x57cd34,null))[_0xb918('0x3c')](handleError(_0x57cd34,null));};exports[_0xb918('0x40')]=function(_0x4846b7,_0x13183c){var _0x35f69f={'raw':!![],'where':{}},_0x359504={},_0x20069e;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x4846b7[_0xb918('0x29')]['id']}})[_0xb918('0x17')](handleEntityNotFound(_0x13183c,null))[_0xb918('0x17')](function(_0x370366){if(_0x370366){_0x20069e=_0x370366[_0xb918('0x19')]({'plain':!![]});_0x359504[_0xb918('0x2e')]=_[_0xb918('0x2a')](db[_0xb918('0x41')][_0xb918('0x22')]);_0x359504[_0xb918('0x2b')]=_[_0xb918('0x2a')](_0x4846b7[_0xb918('0x2b')]);_0x359504['filters']=_[_0xb918('0x2d')](_0x359504['model'],_0x359504[_0xb918('0x2b')]);_0x35f69f[_0xb918('0x30')]=_['intersection'](_0x359504[_0xb918('0x2e')],qs[_0xb918('0x2f')](_0x4846b7[_0xb918('0x2b')][_0xb918('0x2f')]));_0x35f69f['attributes']=_0x35f69f[_0xb918('0x30')][_0xb918('0x31')]?_0x35f69f['attributes']:_0x359504[_0xb918('0x2e')];if(!_0x4846b7['query'][_0xb918('0x42')](_0xb918('0x43'))){_0x35f69f[_0xb918('0x12')]=qs[_0xb918('0x12')](_0x4846b7[_0xb918('0x2b')][_0xb918('0x12')]);_0x35f69f[_0xb918('0x11')]=qs[_0xb918('0x11')](_0x4846b7[_0xb918('0x2b')]['offset']);}_0x35f69f['order']=qs[_0xb918('0x44')](_0x4846b7[_0xb918('0x2b')]['sort']);_0x35f69f['where']=qs[_0xb918('0x2c')](_[_0xb918('0x45')](_0x4846b7[_0xb918('0x2b')],_0x359504[_0xb918('0x2c')]));_0x35f69f[_0xb918('0x46')][_0xb918('0x47')]=_0x370366['id'];if(_0x4846b7[_0xb918('0x2b')]['filter']){_0x35f69f[_0xb918('0x46')]=_['merge'](_0x35f69f[_0xb918('0x46')],{'$or':_['map'](_0x35f69f[_0xb918('0x30')],function(_0x344bd1){var _0x16c83f={};_0x16c83f[_0x344bd1]={'$like':'%'+_0x4846b7['query'][_0xb918('0x48')]+'%'};return _0x16c83f;})});}_0x35f69f=_[_0xb918('0x33')]({},_0x35f69f,_0x4846b7['options']);return db[_0xb918('0x41')]['findAll'](_0x35f69f);}})[_0xb918('0x17')](function(_0x2771b3){if(_0x2771b3){return db['User'][_0xb918('0x49')]({'where':{'id':_['map'](_0x2771b3,_0xb918('0x4a')),'role':'agent'},'attributes':['id',_0xb918('0x1d'),_0xb918('0x4b'),'updatedAt',_0xb918('0x4c')]});}})[_0xb918('0x17')](function(_0x384458){if(_0x384458){return{'count':_0x384458[_0xb918('0x14')],'rows':_['map'](_0x384458[_0xb918('0x4d')],function(_0xbafd71){return{'membername':_0xbafd71[_0xb918('0x1d')],'UserId':_0xbafd71['id'],'queue_name':_0x20069e[_0xb918('0x1d')],'OpenchannelQueueId':_0x20069e['id'],'interface':util['format']('%s/%s',_0xb918('0x4e'),_0xbafd71[_0xb918('0x1d')]),'penalty':0x0,'paused':_0xbafd71[_0xb918('0x4b')],'createdAt':_0xbafd71['createdAt'],'updatedAt':_0xbafd71['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb918('0x17')](respondWithFilteredResult(_0x13183c,_0x35f69f))[_0xb918('0x3c')](handleError(_0x13183c,null));};exports[_0xb918('0x4f')]=function(_0x4f3185,_0x4eade6){var _0x45874a={};var _0x170171={};var _0x571aa6;var _0x5af2c4;return db[_0xb918('0x21')][_0xb918('0x50')]({'where':{'id':_0x4f3185[_0xb918('0x29')]['id']}})[_0xb918('0x17')](handleEntityNotFound(_0x4eade6,null))[_0xb918('0x17')](function(_0x316767){if(_0x316767){_0x571aa6=_0x316767;_0x170171[_0xb918('0x2e')]=_['keys'](db['Team'][_0xb918('0x22')]);_0x170171['query']=_[_0xb918('0x2a')](_0x4f3185[_0xb918('0x2b')]);_0x170171['filters']=_[_0xb918('0x2d')](_0x170171['model'],_0x170171[_0xb918('0x2b')]);_0x45874a[_0xb918('0x30')]=_[_0xb918('0x2d')](_0x170171[_0xb918('0x2e')],qs['fields'](_0x4f3185['query'][_0xb918('0x2f')]));_0x45874a[_0xb918('0x30')]=_0x45874a[_0xb918('0x30')][_0xb918('0x31')]?_0x45874a[_0xb918('0x30')]:_0x170171['model'];_0x45874a['order']=qs[_0xb918('0x44')](_0x4f3185['query'][_0xb918('0x44')]);_0x45874a[_0xb918('0x46')]=qs[_0xb918('0x2c')](_[_0xb918('0x45')](_0x4f3185[_0xb918('0x2b')],_0x170171['filters']));if(_0x4f3185[_0xb918('0x2b')][_0xb918('0x48')]){_0x45874a[_0xb918('0x46')]=_[_0xb918('0x33')](_0x45874a[_0xb918('0x46')],{'$or':_[_0xb918('0x20')](_0x45874a[_0xb918('0x30')],function(_0x4bb28d){var _0x407931={};_0x407931[_0x4bb28d]={'$like':'%'+_0x4f3185['query'][_0xb918('0x48')]+'%'};return _0x407931;})});}_0x45874a=_[_0xb918('0x33')]({},_0x45874a,_0x4f3185[_0xb918('0x34')]);return _0x571aa6['getTeams'](_0x45874a);}})['then'](function(_0x5d8534){if(_0x5d8534){_0x5af2c4=_0x5d8534['length'];if(!_0x4f3185['query'][_0xb918('0x42')](_0xb918('0x43'))){_0x45874a[_0xb918('0x12')]=qs[_0xb918('0x12')](_0x4f3185[_0xb918('0x2b')][_0xb918('0x12')]);_0x45874a[_0xb918('0x11')]=qs[_0xb918('0x11')](_0x4f3185[_0xb918('0x2b')][_0xb918('0x11')]);}return _0x571aa6['getTeams'](_0x45874a);}})[_0xb918('0x17')](function(_0x16779d){if(_0x16779d){return _0x16779d?{'count':_0x5af2c4,'rows':_0x16779d}:null;}})[_0xb918('0x17')](respondWithResult(_0x4eade6,null))[_0xb918('0x3c')](handleError(_0x4eade6,null));};exports[_0xb918('0x51')]=function(_0x39d46d,_0x3f17f9){var _0x3577c3=_0x39d46d[_0xb918('0x36')]['ids'];return db['Team'][_0xb918('0x28')]({'where':{'id':_0x3577c3},'attributes':['id'],'include':[{'model':db[_0xb918('0x52')],'as':_0xb918('0x53'),'attributes':['id',_0xb918('0x1d'),_0xb918('0x54'),'voicePause',_0xb918('0x55')],'raw':!![]}]})[_0xb918('0x17')](function(_0x42eda5){if(_0x42eda5){var _0x13aeba=_['flatMap'](_0x42eda5,function(_0x6957d9){var _0x4fffec=_0x6957d9[_0xb918('0x19')]({'plain':!![]});return _0x4fffec['Agents'];});return db[_0xb918('0x21')]['find']({'where':{'id':_0x39d46d['params']['id']}})[_0xb918('0x17')](function(_0x3bbec9){return db[_0xb918('0x56')][_0xb918('0x57')](function(_0x50b45){return _0x3bbec9['addTeams'](_0x3577c3,{'transaction':_0x50b45})[_0xb918('0x17')](function(){return BPromise[_0xb918('0x58')](_0x13aeba,function(_0x196956){return db['UserOpenchannelQueue'][_0xb918('0x59')]({'where':{'UserId':_0x196956['id'],'OpenchannelQueueId':_0x39d46d[_0xb918('0x29')]['id']},'transaction':_0x50b45});});})['then'](function(){_0x13aeba[_0xb918('0x5a')](function(_0xfc59d2){socket[_0xb918('0x5b')](_0xb918('0x5c'),{'UserId':_0xfc59d2['id'],'OpenchannelQueueId':_0x3bbec9['id']});});});});});}})[_0xb918('0x17')](respondWithStatusCode(_0x3f17f9,null))['catch'](handleError(_0x3f17f9,null));};exports[_0xb918('0x5d')]=function(_0x46ff55,_0x120267){return db[_0xb918('0x5e')]['findAll']({'where':{'id':_0x46ff55[_0xb918('0x2b')][_0xb918('0x5f')]},'attributes':['id'],'include':[{'model':db[_0xb918('0x52')],'as':_0xb918('0x53'),'attributes':['id'],'raw':!![]}]})[_0xb918('0x17')](handleEntityNotFound(_0x120267,null))['then'](function(_0x3df396){var _0x4196a1=_[_0xb918('0x20')](_0x3df396,'id');var _0x240116=[];var _0x356fec=[];var _0x2e3066=squel['select']();_0x2e3066[_0xb918('0x60')](_0xb918('0x61'))['from'](_0xb918('0x62'),'tq')[_0xb918('0x63')](_0xb918('0x64'),'ut',_0xb918('0x65'))[_0xb918('0x46')](_0xb918('0x66'),_0x46ff55['params']['id']);for(var _0x30c93a=0x0;_0x30c93a<_0x3df396['length'];_0x30c93a+=0x1){let _0xd39159=_0x3df396[_0x30c93a];for(var _0x55e1e9=0x0;_0x55e1e9<_0xd39159[_0xb918('0x53')][_0xb918('0x31')];_0x55e1e9+=0x1){let _0x214113=_0xd39159['Agents'][_0x55e1e9];var _0x26d417=_0x2e3066[_0xb918('0x67')]();_0x26d417[_0xb918('0x46')](_0xb918('0x68'),_0x214113['id']);_0x356fec[_0xb918('0x69')](db[_0xb918('0x56')]['query'](_0x26d417[_0xb918('0x6a')](),{'type':db[_0xb918('0x56')][_0xb918('0x6b')][_0xb918('0x6c')]})[_0xb918('0x17')](function(_0x86e78a){if(_0x86e78a[_0xb918('0x31')]===0x1){return _0x214113['id'];}else{var _0x16a817=_['every'](_[_0xb918('0x20')](_0x86e78a,'TeamId'),function(_0x439f49){return _[_0xb918('0x6d')](_0x4196a1,_0x439f49);});if(_0x16a817){return _0x214113['id'];}}}));}}return BPromise['all'](_0x356fec)[_0xb918('0x17')](function(_0x69fa54){_0x240116=_(_0x240116)['union'](_0x69fa54)[_0xb918('0x6e')]()[_0xb918('0x6f')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x46ff55[_0xb918('0x29')]['id']}})[_0xb918('0x17')](function(_0x317d6b){return db[_0xb918('0x56')][_0xb918('0x57')](function(_0x106eb8){return _0x317d6b['removeTeams'](_0x46ff55[_0xb918('0x2b')]['ids'],{'transaction':_0x106eb8})['then'](function(){if(!_['isEmpty'](_0x240116)){return _0x317d6b[_0xb918('0x70')](_0x240116,{'transaction':_0x106eb8});}})[_0xb918('0x17')](function(){_0x240116[_0xb918('0x5a')](function(_0x3fc6a5){socket[_0xb918('0x5b')]('userOpenchannelQueue:remove',{'UserId':_0x3fc6a5,'OpenchannelQueueId':_0x317d6b['id']});});});});});});})[_0xb918('0x17')](respondWithStatusCode(_0x120267,null))[_0xb918('0x3c')](handleError(_0x120267,null));};exports[_0xb918('0x71')]=function(_0x535d63,_0x374394){return db['OpenchannelQueue']['find']({'where':{'id':_0x535d63[_0xb918('0x29')]['id']}})[_0xb918('0x17')](handleEntityNotFound(_0x374394,null))['then'](function(_0x250e10){if(_0x250e10){return _0x250e10[_0xb918('0x71')](_0x535d63[_0xb918('0x36')][_0xb918('0x5f')],_[_0xb918('0x72')](_0x535d63[_0xb918('0x36')],[_0xb918('0x5f'),'id'])||{})[_0xb918('0x73')](function(_0x5a642b){for(var _0x4f28c2=0x0;_0x4f28c2<_0x535d63['body'][_0xb918('0x5f')][_0xb918('0x31')];_0x4f28c2+=0x1){socket[_0xb918('0x5b')](_0xb918('0x5c'),{'UserId':Number(_0x535d63[_0xb918('0x36')]['ids'][_0x4f28c2]),'OpenchannelQueueId':Number(_0x535d63['params']['id'])});}return _0x5a642b;});}})[_0xb918('0x17')](respondWithResult(_0x374394,null))[_0xb918('0x3c')](handleError(_0x374394,null));};exports[_0xb918('0x70')]=function(_0x28dd2e,_0x1763a1){return db[_0xb918('0x21')][_0xb918('0x3e')]({'where':{'id':_0x28dd2e[_0xb918('0x29')]['id']}})[_0xb918('0x17')](handleEntityNotFound(_0x1763a1,null))[_0xb918('0x17')](function(_0x42de3e){if(_0x42de3e){return _0x42de3e[_0xb918('0x70')](_0x28dd2e[_0xb918('0x2b')][_0xb918('0x5f')])[_0xb918('0x17')](function(){if(_['isArray'](_0x28dd2e[_0xb918('0x2b')]['ids'])){for(var _0x14aefd=0x0;_0x14aefd<_0x28dd2e[_0xb918('0x2b')][_0xb918('0x5f')][_0xb918('0x31')];_0x14aefd+=0x1){socket['emit'](_0xb918('0x74'),{'UserId':Number(_0x28dd2e[_0xb918('0x2b')][_0xb918('0x5f')][_0x14aefd]),'OpenchannelQueueId':Number(_0x28dd2e[_0xb918('0x29')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x28dd2e['query'][_0xb918('0x5f')]),'OpenchannelQueueId':Number(_0x28dd2e['params']['id'])});}});}})[_0xb918('0x17')](respondWithStatusCode(_0x1763a1,null))[_0xb918('0x3c')](handleError(_0x1763a1,null));};exports[_0xb918('0x75')]=function(_0x918792,_0x3e1acb){var _0x31f431={};var _0x3f93fa={};var _0x758942;var _0x494ff7;return db[_0xb918('0x21')]['findOne']({'where':{'id':_0x918792[_0xb918('0x29')]['id']}})[_0xb918('0x17')](handleEntityNotFound(_0x3e1acb,null))[_0xb918('0x17')](function(_0x3a54ef){if(_0x3a54ef){_0x758942=_0x3a54ef;_0x3f93fa[_0xb918('0x2e')]=_[_0xb918('0x2a')](db[_0xb918('0x52')][_0xb918('0x22')]);_0x3f93fa[_0xb918('0x2b')]=_[_0xb918('0x2a')](_0x918792[_0xb918('0x2b')]);_0x3f93fa[_0xb918('0x2c')]=_['intersection'](_0x3f93fa[_0xb918('0x2e')],_0x3f93fa['query']);_0x31f431[_0xb918('0x30')]=_[_0xb918('0x2d')](_0x3f93fa[_0xb918('0x2e')],qs[_0xb918('0x2f')](_0x918792[_0xb918('0x2b')][_0xb918('0x2f')]));_0x31f431['attributes']=_0x31f431[_0xb918('0x30')][_0xb918('0x31')]?_0x31f431[_0xb918('0x30')]:_0x3f93fa['model'];_0x31f431['order']=qs[_0xb918('0x44')](_0x918792[_0xb918('0x2b')][_0xb918('0x44')]);_0x31f431[_0xb918('0x46')]=qs[_0xb918('0x2c')](_[_0xb918('0x45')](_0x918792['query'],_0x3f93fa[_0xb918('0x2c')]));if(_0x918792[_0xb918('0x2b')][_0xb918('0x48')]){_0x31f431[_0xb918('0x46')]=_['merge'](_0x31f431[_0xb918('0x46')],{'$or':_['map'](_0x31f431[_0xb918('0x30')],function(_0x20f255){var _0x530114={};_0x530114[_0x20f255]={'$like':'%'+_0x918792[_0xb918('0x2b')]['filter']+'%'};return _0x530114;})});}_0x31f431=_['merge']({},_0x31f431,_0x918792[_0xb918('0x34')]);return _0x758942['getAgents'](_0x31f431);}})['then'](function(_0x9953b6){if(_0x9953b6){_0x494ff7=_0x9953b6['length'];if(!_0x918792[_0xb918('0x2b')][_0xb918('0x42')](_0xb918('0x43'))){_0x31f431[_0xb918('0x12')]=qs[_0xb918('0x12')](_0x918792[_0xb918('0x2b')]['limit']);_0x31f431[_0xb918('0x11')]=qs[_0xb918('0x11')](_0x918792['query']['offset']);}return _0x758942[_0xb918('0x75')](_0x31f431);}})[_0xb918('0x17')](function(_0xdb825f){if(_0xdb825f){return _0xdb825f?{'count':_0x494ff7,'rows':_0xdb825f}:null;}})[_0xb918('0x17')](respondWithResult(_0x3e1acb,null))['catch'](handleError(_0x3e1acb,null));};
\ No newline at end of file
+var _0xd243=['map','OpenchannelQueue','fieldName','key','getOptions','where','include','query','findAll','show','params','keys','rawAttributes','filters','attributes','intersection','model','fields','length','includeAll','options','create','user','role','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','body','find','catch','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','filter','merge','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','rows','format','%s/%s','SIP','createdAt','getTeams','addTeams','ids','Team','online','interface','flatMap','Agents','sequelize','transaction','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','isArray','getAgents','order','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','update','then','destroy','get','UserProfileResource','error','stack','name','index'];(function(_0x6b197f,_0x1f80d5){var _0x48e0b7=function(_0x44ee8a){while(--_0x44ee8a){_0x6b197f['push'](_0x6b197f['shift']());}};_0x48e0b7(++_0x1f80d5);}(_0xd243,0x1c9));var _0x3d24=function(_0x209fee,_0x514038){_0x209fee=_0x209fee-0x0;var _0x4644c9=_0xd243[_0x209fee];return _0x4644c9;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3d24('0x0'));var squel=require('squel');var Redis=require(_0x3d24('0x1'));var qs=require(_0x3d24('0x2'));var logger=require('../../config/logger')(_0x3d24('0x3'));var config=require(_0x3d24('0x4'));var db=require('../../mysqldb')['db'];config[_0x3d24('0x5')]=_['defaults'](config[_0x3d24('0x5')],{'host':_0x3d24('0x6'),'port':0x18eb});var socket=require(_0x3d24('0x7'))(new Redis(config[_0x3d24('0x5')]));require(_0x3d24('0x8'))['register'](socket);function respondWithStatusCode(_0x58e680,_0x1e2c40){_0x1e2c40=_0x1e2c40||0xcc;return function(_0x23b33e){if(_0x23b33e){return _0x58e680[_0x3d24('0x9')](_0x1e2c40);}return _0x58e680['status'](_0x1e2c40)[_0x3d24('0xa')]();};}function respondWithResult(_0x361a5d,_0x1dfc6d){_0x1dfc6d=_0x1dfc6d||0xc8;return function(_0x4e746a){if(_0x4e746a){return _0x361a5d[_0x3d24('0xb')](_0x1dfc6d)[_0x3d24('0xc')](_0x4e746a);}};}function respondWithFilteredResult(_0x1c9094,_0x583955){return function(_0x44135e){if(_0x44135e){var _0x51cd33=typeof _0x583955[_0x3d24('0xd')]===_0x3d24('0xe')&&typeof _0x583955[_0x3d24('0xf')]==='undefined';var _0x2a149d=_0x44135e[_0x3d24('0x10')];var _0x5d8378=_0x51cd33?0x0:_0x583955[_0x3d24('0xd')];var _0x4610e8=_0x51cd33?_0x44135e[_0x3d24('0x10')]:_0x583955[_0x3d24('0xd')]+_0x583955[_0x3d24('0xf')];var _0x31359b;if(_0x4610e8>=_0x2a149d){_0x4610e8=_0x2a149d;_0x31359b=0xc8;}else{_0x31359b=0xce;}_0x1c9094['status'](_0x31359b);return _0x1c9094[_0x3d24('0x11')]('Content-Range',_0x5d8378+'-'+_0x4610e8+'/'+_0x2a149d)['json'](_0x44135e);}return null;};}function saveUpdates(_0x3965f7){return function(_0xd8e302){if(_0xd8e302){return _0xd8e302[_0x3d24('0x12')](_0x3965f7)[_0x3d24('0x13')](function(_0x5038b5){return _0x5038b5;});}return null;};}function removeEntity(_0x36d949){return function(_0x4f179d){if(_0x4f179d){return _0x4f179d[_0x3d24('0x14')]()[_0x3d24('0x13')](function(){var _0x10e45f=_0x4f179d[_0x3d24('0x15')]({'plain':!![]});var _0x53338f='OpenchannelQueues';return db[_0x3d24('0x16')][_0x3d24('0x14')]({'where':{'type':_0x53338f,'resourceId':_0x10e45f['id']}})[_0x3d24('0x13')](function(){return _0x4f179d;});})[_0x3d24('0x13')](function(){_0x36d949[_0x3d24('0xb')](0xcc)[_0x3d24('0xa')]();});}};}function handleEntityNotFound(_0x3aeb95){return function(_0x1fe70d){if(!_0x1fe70d){_0x3aeb95['sendStatus'](0x194);}return _0x1fe70d;};}function handleError(_0x102341,_0x597825){_0x597825=_0x597825||0x1f4;return function(_0x5beeaa){logger[_0x3d24('0x17')](_0x5beeaa[_0x3d24('0x18')]);if(_0x5beeaa[_0x3d24('0x19')]){delete _0x5beeaa['name'];}_0x102341[_0x3d24('0xb')](_0x597825)['send'](_0x5beeaa);};}exports[_0x3d24('0x1a')]=function(_0x52a247,_0xde10d9){var _0x3e12fd={};var _0x44d668={'count':0x0,'rows':[]};var _0x4b4a7a=_[_0x3d24('0x1b')](db[_0x3d24('0x1c')]['rawAttributes'],function(_0xe7a26f){return{'name':_0xe7a26f[_0x3d24('0x1d')],'type':_0xe7a26f['type'][_0x3d24('0x1e')]};});_0x3e12fd=qs[_0x3d24('0x1f')](_0x4b4a7a,_0x52a247);var _0x5270ee={'where':_0x3e12fd[_0x3d24('0x20')]};return db[_0x3d24('0x1c')][_0x3d24('0x10')](_0x5270ee)['then'](function(_0x83533){_0x44d668[_0x3d24('0x10')]=_0x83533;_0x3e12fd[_0x3d24('0x21')]=qs[_0x3d24('0x21')](_0x52a247[_0x3d24('0x22')]);return db['OpenchannelQueue'][_0x3d24('0x23')](_0x3e12fd);})[_0x3d24('0x13')](function(_0x356f75){_0x44d668['rows']=_0x356f75;return _0x44d668;})['then'](respondWithFilteredResult(_0xde10d9,_0x3e12fd))['catch'](handleError(_0xde10d9,null));};exports[_0x3d24('0x24')]=function(_0x466199,_0x310a7b){var _0x15c79b={'raw':!![],'where':{'id':_0x466199[_0x3d24('0x25')]['id']}},_0x59a138={};_0x59a138['model']=_[_0x3d24('0x26')](db[_0x3d24('0x1c')][_0x3d24('0x27')]);_0x59a138[_0x3d24('0x22')]=_['keys'](_0x466199[_0x3d24('0x22')]);_0x59a138[_0x3d24('0x28')]=_['intersection'](_0x59a138['model'],_0x59a138[_0x3d24('0x22')]);_0x15c79b[_0x3d24('0x29')]=_[_0x3d24('0x2a')](_0x59a138[_0x3d24('0x2b')],qs['fields'](_0x466199[_0x3d24('0x22')][_0x3d24('0x2c')]));_0x15c79b['attributes']=_0x15c79b['attributes'][_0x3d24('0x2d')]?_0x15c79b[_0x3d24('0x29')]:_0x59a138['model'];if(_0x466199[_0x3d24('0x22')][_0x3d24('0x2e')]){_0x15c79b[_0x3d24('0x21')]=[{'all':!![]}];}_0x15c79b=_['merge']({},_0x15c79b,_0x466199[_0x3d24('0x2f')]);return db[_0x3d24('0x1c')]['find'](_0x15c79b)[_0x3d24('0x13')](handleEntityNotFound(_0x310a7b,null))[_0x3d24('0x13')](respondWithResult(_0x310a7b,null))['catch'](handleError(_0x310a7b,null));};exports[_0x3d24('0x30')]=function(_0x50dd16,_0x7c0f6e){return db[_0x3d24('0x1c')]['create'](_0x50dd16['body'],{})[_0x3d24('0x13')](function(_0x22fb86){var _0x45f6dd=_0x50dd16[_0x3d24('0x31')]['get']({'plain':!![]});if(!_0x45f6dd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x45f6dd[_0x3d24('0x32')]===_0x3d24('0x31')){var _0x203595=_0x22fb86[_0x3d24('0x15')]({'plain':!![]});var _0x1fae5e=_0x3d24('0x33');return db[_0x3d24('0x34')]['find']({'where':{'name':_0x1fae5e,'userProfileId':_0x45f6dd[_0x3d24('0x35')]},'raw':!![]})[_0x3d24('0x13')](function(_0x3a76d5){if(_0x3a76d5&&_0x3a76d5[_0x3d24('0x36')]===0x0){return db['UserProfileResource'][_0x3d24('0x30')]({'name':_0x203595[_0x3d24('0x19')],'resourceId':_0x203595['id'],'type':_0x3a76d5[_0x3d24('0x19')],'sectionId':_0x3a76d5['id']},{})[_0x3d24('0x13')](function(){return _0x22fb86;});}else{return _0x22fb86;}})['catch'](function(_0x508cf6){logger[_0x3d24('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x508cf6);throw _0x508cf6;});}return _0x22fb86;})[_0x3d24('0x13')](respondWithResult(_0x7c0f6e,0xc9))['catch'](handleError(_0x7c0f6e,null));};exports[_0x3d24('0x12')]=function(_0x17eaea,_0x26bb53){if(_0x17eaea['body']['id']){delete _0x17eaea[_0x3d24('0x37')]['id'];}return db[_0x3d24('0x1c')][_0x3d24('0x38')]({'where':{'id':_0x17eaea['params']['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x26bb53,null))[_0x3d24('0x13')](saveUpdates(_0x17eaea['body'],null))[_0x3d24('0x13')](respondWithResult(_0x26bb53,null))['catch'](handleError(_0x26bb53,null));};exports[_0x3d24('0x14')]=function(_0x25fe1d,_0x25065f){return db['OpenchannelQueue']['find']({'where':{'id':_0x25fe1d[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x25065f,null))[_0x3d24('0x13')](removeEntity(_0x25065f,null))[_0x3d24('0x39')](handleError(_0x25065f,null));};exports[_0x3d24('0x3a')]=function(_0x85d7b7,_0x8bf3d6){return db['OpenchannelQueue']['describe']()[_0x3d24('0x13')](respondWithResult(_0x8bf3d6,null))[_0x3d24('0x39')](handleError(_0x8bf3d6,null));};exports[_0x3d24('0x3b')]=function(_0x497d79,_0x14c732){var _0x403b1a={'raw':!![],'where':{}},_0x4ba5d6={},_0x5bad93;return db[_0x3d24('0x1c')][_0x3d24('0x3c')]({'where':{'id':_0x497d79['params']['id']}})['then'](handleEntityNotFound(_0x14c732,null))['then'](function(_0x2818a6){if(_0x2818a6){_0x5bad93=_0x2818a6['get']({'plain':!![]});_0x4ba5d6[_0x3d24('0x2b')]=_[_0x3d24('0x26')](db[_0x3d24('0x3d')][_0x3d24('0x27')]);_0x4ba5d6[_0x3d24('0x22')]=_[_0x3d24('0x26')](_0x497d79[_0x3d24('0x22')]);_0x4ba5d6['filters']=_['intersection'](_0x4ba5d6[_0x3d24('0x2b')],_0x4ba5d6[_0x3d24('0x22')]);_0x403b1a[_0x3d24('0x29')]=_[_0x3d24('0x2a')](_0x4ba5d6[_0x3d24('0x2b')],qs['fields'](_0x497d79['query']['fields']));_0x403b1a['attributes']=_0x403b1a[_0x3d24('0x29')][_0x3d24('0x2d')]?_0x403b1a[_0x3d24('0x29')]:_0x4ba5d6['model'];if(!_0x497d79[_0x3d24('0x22')][_0x3d24('0x3e')](_0x3d24('0x3f'))){_0x403b1a['limit']=qs[_0x3d24('0xf')](_0x497d79[_0x3d24('0x22')][_0x3d24('0xf')]);_0x403b1a[_0x3d24('0xd')]=qs[_0x3d24('0xd')](_0x497d79[_0x3d24('0x22')][_0x3d24('0xd')]);}_0x403b1a['order']=qs[_0x3d24('0x40')](_0x497d79[_0x3d24('0x22')]['sort']);_0x403b1a[_0x3d24('0x20')]=qs[_0x3d24('0x28')](_[_0x3d24('0x41')](_0x497d79['query'],_0x4ba5d6[_0x3d24('0x28')]));_0x403b1a['where']['OpenchannelQueueId']=_0x2818a6['id'];if(_0x497d79[_0x3d24('0x22')][_0x3d24('0x42')]){_0x403b1a[_0x3d24('0x20')]=_[_0x3d24('0x43')](_0x403b1a[_0x3d24('0x20')],{'$or':_[_0x3d24('0x1b')](_0x403b1a[_0x3d24('0x29')],function(_0x174ed9){var _0x5b5a3a={};_0x5b5a3a[_0x174ed9]={'$like':'%'+_0x497d79[_0x3d24('0x22')][_0x3d24('0x42')]+'%'};return _0x5b5a3a;})});}_0x403b1a=_[_0x3d24('0x43')]({},_0x403b1a,_0x497d79[_0x3d24('0x2f')]);return db[_0x3d24('0x3d')][_0x3d24('0x23')](_0x403b1a);}})[_0x3d24('0x13')](function(_0x37dc07){if(_0x37dc07){return db[_0x3d24('0x44')][_0x3d24('0x45')]({'where':{'id':_[_0x3d24('0x1b')](_0x37dc07,_0x3d24('0x46')),'role':_0x3d24('0x47')},'attributes':['id','name',_0x3d24('0x48'),_0x3d24('0x49'),'createdAt']});}})[_0x3d24('0x13')](function(_0x1faa54){if(_0x1faa54){return{'count':_0x1faa54[_0x3d24('0x10')],'rows':_[_0x3d24('0x1b')](_0x1faa54[_0x3d24('0x4a')],function(_0x4c9e72){return{'membername':_0x4c9e72['name'],'UserId':_0x4c9e72['id'],'queue_name':_0x5bad93[_0x3d24('0x19')],'OpenchannelQueueId':_0x5bad93['id'],'interface':util[_0x3d24('0x4b')](_0x3d24('0x4c'),_0x3d24('0x4d'),_0x4c9e72[_0x3d24('0x19')]),'penalty':0x0,'paused':_0x4c9e72[_0x3d24('0x48')],'createdAt':_0x4c9e72[_0x3d24('0x4e')],'updatedAt':_0x4c9e72[_0x3d24('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x3d24('0x13')](respondWithFilteredResult(_0x14c732,_0x403b1a))[_0x3d24('0x39')](handleError(_0x14c732,null));};exports[_0x3d24('0x4f')]=function(_0x3e0a52,_0x3f5c0f){var _0x54f520={};var _0x475a50={};var _0x2a9ebf;var _0x423ad9;return db[_0x3d24('0x1c')][_0x3d24('0x3c')]({'where':{'id':_0x3e0a52[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x3f5c0f,null))[_0x3d24('0x13')](function(_0x5b7663){if(_0x5b7663){_0x2a9ebf=_0x5b7663;_0x475a50[_0x3d24('0x2b')]=_['keys'](db['Team'][_0x3d24('0x27')]);_0x475a50[_0x3d24('0x22')]=_[_0x3d24('0x26')](_0x3e0a52[_0x3d24('0x22')]);_0x475a50['filters']=_[_0x3d24('0x2a')](_0x475a50[_0x3d24('0x2b')],_0x475a50[_0x3d24('0x22')]);_0x54f520[_0x3d24('0x29')]=_[_0x3d24('0x2a')](_0x475a50['model'],qs[_0x3d24('0x2c')](_0x3e0a52[_0x3d24('0x22')][_0x3d24('0x2c')]));_0x54f520[_0x3d24('0x29')]=_0x54f520[_0x3d24('0x29')]['length']?_0x54f520[_0x3d24('0x29')]:_0x475a50['model'];_0x54f520['order']=qs[_0x3d24('0x40')](_0x3e0a52['query'][_0x3d24('0x40')]);_0x54f520[_0x3d24('0x20')]=qs[_0x3d24('0x28')](_[_0x3d24('0x41')](_0x3e0a52[_0x3d24('0x22')],_0x475a50['filters']));if(_0x3e0a52[_0x3d24('0x22')]['filter']){_0x54f520[_0x3d24('0x20')]=_['merge'](_0x54f520[_0x3d24('0x20')],{'$or':_['map'](_0x54f520[_0x3d24('0x29')],function(_0x1f1f8f){var _0x1d432a={};_0x1d432a[_0x1f1f8f]={'$like':'%'+_0x3e0a52[_0x3d24('0x22')][_0x3d24('0x42')]+'%'};return _0x1d432a;})});}_0x54f520=_['merge']({},_0x54f520,_0x3e0a52[_0x3d24('0x2f')]);return _0x2a9ebf[_0x3d24('0x4f')](_0x54f520);}})[_0x3d24('0x13')](function(_0x273777){if(_0x273777){_0x423ad9=_0x273777[_0x3d24('0x2d')];if(!_0x3e0a52[_0x3d24('0x22')][_0x3d24('0x3e')](_0x3d24('0x3f'))){_0x54f520[_0x3d24('0xf')]=qs[_0x3d24('0xf')](_0x3e0a52[_0x3d24('0x22')][_0x3d24('0xf')]);_0x54f520['offset']=qs[_0x3d24('0xd')](_0x3e0a52[_0x3d24('0x22')][_0x3d24('0xd')]);}return _0x2a9ebf[_0x3d24('0x4f')](_0x54f520);}})[_0x3d24('0x13')](function(_0x371025){if(_0x371025){return _0x371025?{'count':_0x423ad9,'rows':_0x371025}:null;}})[_0x3d24('0x13')](respondWithResult(_0x3f5c0f,null))[_0x3d24('0x39')](handleError(_0x3f5c0f,null));};exports[_0x3d24('0x50')]=function(_0x4ed8d2,_0x2a7be2){var _0x3524da=_0x4ed8d2['body'][_0x3d24('0x51')];return db[_0x3d24('0x52')]['findAll']({'where':{'id':_0x3524da},'attributes':['id'],'include':[{'model':db[_0x3d24('0x44')],'as':'Agents','attributes':['id','name',_0x3d24('0x53'),'voicePause',_0x3d24('0x54')],'raw':!![]}]})[_0x3d24('0x13')](function(_0x15fae5){if(_0x15fae5){var _0x2fa392=_[_0x3d24('0x55')](_0x15fae5,function(_0x2a55bc){var _0xb36437=_0x2a55bc[_0x3d24('0x15')]({'plain':!![]});return _0xb36437[_0x3d24('0x56')];});return db['OpenchannelQueue'][_0x3d24('0x38')]({'where':{'id':_0x4ed8d2['params']['id']}})[_0x3d24('0x13')](function(_0x3ee3b3){return db[_0x3d24('0x57')][_0x3d24('0x58')](function(_0x255ee9){return _0x3ee3b3[_0x3d24('0x50')](_0x3524da,{'transaction':_0x255ee9})[_0x3d24('0x13')](function(){return BPromise['each'](_0x2fa392,function(_0x5aee23){return db[_0x3d24('0x3d')][_0x3d24('0x59')]({'where':{'UserId':_0x5aee23['id'],'OpenchannelQueueId':_0x4ed8d2[_0x3d24('0x25')]['id']},'transaction':_0x255ee9});});})['then'](function(){_0x2fa392[_0x3d24('0x5a')](function(_0x3a35ab){socket[_0x3d24('0x5b')](_0x3d24('0x5c'),{'UserId':_0x3a35ab['id'],'OpenchannelQueueId':_0x3ee3b3['id']});});});});});}})[_0x3d24('0x13')](respondWithStatusCode(_0x2a7be2,null))[_0x3d24('0x39')](handleError(_0x2a7be2,null));};exports[_0x3d24('0x5d')]=function(_0x3f8487,_0x2a1b74){return db[_0x3d24('0x52')][_0x3d24('0x23')]({'where':{'id':_0x3f8487[_0x3d24('0x22')][_0x3d24('0x51')]},'attributes':['id'],'include':[{'model':db[_0x3d24('0x44')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2a1b74,null))[_0x3d24('0x13')](function(_0x3efdcd){var _0x5fb018=_[_0x3d24('0x1b')](_0x3efdcd,'id');var _0x3252a2=[];var _0x372321=[];var _0x4ec0a2=squel[_0x3d24('0x5e')]();_0x4ec0a2[_0x3d24('0x5f')](_0x3d24('0x60'))[_0x3d24('0x61')](_0x3d24('0x62'),'tq')[_0x3d24('0x63')](_0x3d24('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x3d24('0x20')](_0x3d24('0x65'),_0x3f8487['params']['id']);for(var _0x58adab=0x0;_0x58adab<_0x3efdcd['length'];_0x58adab+=0x1){let _0x5547e6=_0x3efdcd[_0x58adab];for(var _0x2ea59d=0x0;_0x2ea59d<_0x5547e6[_0x3d24('0x56')][_0x3d24('0x2d')];_0x2ea59d+=0x1){let _0x3acc73=_0x5547e6[_0x3d24('0x56')][_0x2ea59d];var _0x145f83=_0x4ec0a2[_0x3d24('0x66')]();_0x145f83[_0x3d24('0x20')](_0x3d24('0x67'),_0x3acc73['id']);_0x372321['push'](db[_0x3d24('0x57')][_0x3d24('0x22')](_0x145f83[_0x3d24('0x68')](),{'type':db['sequelize'][_0x3d24('0x69')][_0x3d24('0x6a')]})[_0x3d24('0x13')](function(_0x4855ca){if(_0x4855ca['length']===0x1){return _0x3acc73['id'];}else{var _0x3f7f45=_[_0x3d24('0x6b')](_[_0x3d24('0x1b')](_0x4855ca,_0x3d24('0x6c')),function(_0x48fd47){return _[_0x3d24('0x6d')](_0x5fb018,_0x48fd47);});if(_0x3f7f45){return _0x3acc73['id'];}}}));}}return BPromise[_0x3d24('0x6e')](_0x372321)['then'](function(_0x2ff9e8){_0x3252a2=_(_0x3252a2)[_0x3d24('0x6f')](_0x2ff9e8)['compact']()[_0x3d24('0x70')]();return db[_0x3d24('0x1c')][_0x3d24('0x38')]({'where':{'id':_0x3f8487[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](function(_0x205747){return db[_0x3d24('0x57')]['transaction'](function(_0x4b8fe2){return _0x205747[_0x3d24('0x5d')](_0x3f8487[_0x3d24('0x22')][_0x3d24('0x51')],{'transaction':_0x4b8fe2})['then'](function(){if(!_[_0x3d24('0x71')](_0x3252a2)){return _0x205747[_0x3d24('0x72')](_0x3252a2,{'transaction':_0x4b8fe2});}})[_0x3d24('0x13')](function(){_0x3252a2['forEach'](function(_0x44c84f){socket['emit'](_0x3d24('0x73'),{'UserId':_0x44c84f,'OpenchannelQueueId':_0x205747['id']});});});});});});})[_0x3d24('0x13')](respondWithStatusCode(_0x2a1b74,null))[_0x3d24('0x39')](handleError(_0x2a1b74,null));};exports['addAgents']=function(_0x10a8df,_0x421615){return db[_0x3d24('0x1c')][_0x3d24('0x38')]({'where':{'id':_0x10a8df[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x421615,null))[_0x3d24('0x13')](function(_0x8816f2){if(_0x8816f2){return _0x8816f2[_0x3d24('0x74')](_0x10a8df['body'][_0x3d24('0x51')],_[_0x3d24('0x75')](_0x10a8df[_0x3d24('0x37')],[_0x3d24('0x51'),'id'])||{})['spread'](function(_0x387b61){for(var _0x4c0e29=0x0;_0x4c0e29<_0x10a8df[_0x3d24('0x37')]['ids'][_0x3d24('0x2d')];_0x4c0e29+=0x1){socket[_0x3d24('0x5b')](_0x3d24('0x5c'),{'UserId':Number(_0x10a8df['body']['ids'][_0x4c0e29]),'OpenchannelQueueId':Number(_0x10a8df['params']['id'])});}return _0x387b61;});}})['then'](respondWithResult(_0x421615,null))[_0x3d24('0x39')](handleError(_0x421615,null));};exports[_0x3d24('0x72')]=function(_0x29fb08,_0x4ae529){return db[_0x3d24('0x1c')]['find']({'where':{'id':_0x29fb08[_0x3d24('0x25')]['id']}})[_0x3d24('0x13')](handleEntityNotFound(_0x4ae529,null))[_0x3d24('0x13')](function(_0x4d513d){if(_0x4d513d){return _0x4d513d['removeAgents'](_0x29fb08[_0x3d24('0x22')][_0x3d24('0x51')])[_0x3d24('0x13')](function(){if(_[_0x3d24('0x76')](_0x29fb08[_0x3d24('0x22')][_0x3d24('0x51')])){for(var _0x1d53c5=0x0;_0x1d53c5<_0x29fb08[_0x3d24('0x22')]['ids'][_0x3d24('0x2d')];_0x1d53c5+=0x1){socket['emit'](_0x3d24('0x73'),{'UserId':Number(_0x29fb08[_0x3d24('0x22')][_0x3d24('0x51')][_0x1d53c5]),'OpenchannelQueueId':Number(_0x29fb08['params']['id'])});}}else{socket[_0x3d24('0x5b')](_0x3d24('0x73'),{'UserId':Number(_0x29fb08[_0x3d24('0x22')][_0x3d24('0x51')]),'OpenchannelQueueId':Number(_0x29fb08['params']['id'])});}});}})[_0x3d24('0x13')](respondWithStatusCode(_0x4ae529,null))['catch'](handleError(_0x4ae529,null));};exports[_0x3d24('0x77')]=function(_0x519c26,_0x32ba42){var _0x200200={};var _0x1c7150={};var _0x57ac2a;var _0x50f5bc;return db[_0x3d24('0x1c')][_0x3d24('0x3c')]({'where':{'id':_0x519c26['params']['id']}})['then'](handleEntityNotFound(_0x32ba42,null))['then'](function(_0xf48e82){if(_0xf48e82){_0x57ac2a=_0xf48e82;_0x1c7150[_0x3d24('0x2b')]=_[_0x3d24('0x26')](db['User'][_0x3d24('0x27')]);_0x1c7150[_0x3d24('0x22')]=_[_0x3d24('0x26')](_0x519c26[_0x3d24('0x22')]);_0x1c7150[_0x3d24('0x28')]=_[_0x3d24('0x2a')](_0x1c7150[_0x3d24('0x2b')],_0x1c7150['query']);_0x200200['attributes']=_['intersection'](_0x1c7150[_0x3d24('0x2b')],qs['fields'](_0x519c26['query']['fields']));_0x200200[_0x3d24('0x29')]=_0x200200[_0x3d24('0x29')][_0x3d24('0x2d')]?_0x200200[_0x3d24('0x29')]:_0x1c7150[_0x3d24('0x2b')];_0x200200[_0x3d24('0x78')]=qs[_0x3d24('0x40')](_0x519c26[_0x3d24('0x22')][_0x3d24('0x40')]);_0x200200[_0x3d24('0x20')]=qs['filters'](_[_0x3d24('0x41')](_0x519c26[_0x3d24('0x22')],_0x1c7150[_0x3d24('0x28')]));if(_0x519c26[_0x3d24('0x22')][_0x3d24('0x42')]){_0x200200[_0x3d24('0x20')]=_[_0x3d24('0x43')](_0x200200['where'],{'$or':_['map'](_0x200200[_0x3d24('0x29')],function(_0x10ffea){var _0x1a3bf9={};_0x1a3bf9[_0x10ffea]={'$like':'%'+_0x519c26[_0x3d24('0x22')]['filter']+'%'};return _0x1a3bf9;})});}_0x200200=_[_0x3d24('0x43')]({},_0x200200,_0x519c26[_0x3d24('0x2f')]);return _0x57ac2a[_0x3d24('0x77')](_0x200200);}})[_0x3d24('0x13')](function(_0x5830dc){if(_0x5830dc){_0x50f5bc=_0x5830dc[_0x3d24('0x2d')];if(!_0x519c26[_0x3d24('0x22')][_0x3d24('0x3e')]('nolimit')){_0x200200['limit']=qs[_0x3d24('0xf')](_0x519c26[_0x3d24('0x22')][_0x3d24('0xf')]);_0x200200[_0x3d24('0xd')]=qs[_0x3d24('0xd')](_0x519c26['query'][_0x3d24('0xd')]);}return _0x57ac2a['getAgents'](_0x200200);}})[_0x3d24('0x13')](function(_0x2a1e9e){if(_0x2a1e9e){return _0x2a1e9e?{'count':_0x50f5bc,'rows':_0x2a1e9e}:null;}})[_0x3d24('0x13')](respondWithResult(_0x32ba42,null))['catch'](handleError(_0x32ba42,null));};
\ No newline at end of file
index a85c0a1..8009853 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cde=['remove','emit','hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','update'];(function(_0x591bf4,_0x320dc1){var _0x189009=function(_0x1bb617){while(--_0x1bb617){_0x591bf4['push'](_0x591bf4['shift']());}};_0x189009(++_0x320dc1);}(_0x4cde,0x79));var _0xe4cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4cde[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xe4cd('0x0'));var OpenchannelQueue=require(_0xe4cd('0x1'))['db'][_0xe4cd('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe4cd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe4cd('0x4'),'afterDestroy':_0xe4cd('0x5')};function emitEvent(_0x434626){return function(_0x1a8f81,_0x5803bf,_0x4eb9e2){OpenchannelQueueEvents[_0xe4cd('0x6')](_0x434626+':'+_0x1a8f81['id'],_0x1a8f81);OpenchannelQueueEvents[_0xe4cd('0x6')](_0x434626,_0x1a8f81);_0x4eb9e2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xe4cd('0x7')](e,emitEvent(event));}}module[_0xe4cd('0x8')]=OpenchannelQueueEvents;
\ No newline at end of file
+var _0x5393=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x2d099f,_0x40d72d){var _0x2adc30=function(_0x2a1c12){while(--_0x2a1c12){_0x2d099f['push'](_0x2d099f['shift']());}};_0x2adc30(++_0x40d72d);}(_0x5393,0x1ab));var _0x3539=function(_0x390a67,_0x426949){_0x390a67=_0x390a67-0x0;var _0x58a1fa=_0x5393[_0x390a67];return _0x58a1fa;};'use strict';var EventEmitter=require(_0x3539('0x0'));var OpenchannelQueue=require(_0x3539('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x3539('0x2')](0x0);var events={'afterCreate':_0x3539('0x3'),'afterUpdate':_0x3539('0x4'),'afterDestroy':'remove'};function emitEvent(_0x13f72e){return function(_0x23f21f,_0x2817ab,_0x4d8fed){OpenchannelQueueEvents[_0x3539('0x5')](_0x13f72e+':'+_0x23f21f['id'],_0x23f21f);OpenchannelQueueEvents[_0x3539('0x5')](_0x13f72e,_0x23f21f);_0x4d8fed(null);};}for(var e in events){if(events[_0x3539('0x6')](e)){var event=events[e];OpenchannelQueue[_0x3539('0x7')](e,emitEvent(event));}}module[_0x3539('0x8')]=OpenchannelQueueEvents;
\ No newline at end of file
index 20f70cc..cff57b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e15=['../../config/logger','request-promise','path','rimraf','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash'];(function(_0x3b453d,_0x9c4e0){var _0x3b37f7=function(_0x39b1b9){while(--_0x39b1b9){_0x3b453d['push'](_0x3b453d['shift']());}};_0x3b37f7(++_0x9c4e0);}(_0x6e15,0x7d));var _0x56e1=function(_0x4849ae,_0x38565a){_0x4849ae=_0x4849ae-0x0;var _0x354344=_0x6e15[_0x4849ae];return _0x354344;};'use strict';var _=require(_0x56e1('0x0'));var util=require('util');var logger=require(_0x56e1('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x56e1('0x2'));var fs=require('fs');var path=require(_0x56e1('0x3'));var rimraf=require(_0x56e1('0x4'));var config=require('../../config/environment');var attributes=require(_0x56e1('0x5'));module[_0x56e1('0x6')]=function(_0x5299d5,_0x4195d5){return _0x5299d5[_0x56e1('0x7')]('OpenchannelQueue',attributes,{'tableName':_0x56e1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc0bc=['bluebird','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','openchannel_queues','lodash','util','../../config/logger','api','moment'];(function(_0xc6263e,_0x405c99){var _0x38ada7=function(_0x8a9aaa){while(--_0x8a9aaa){_0xc6263e['push'](_0xc6263e['shift']());}};_0x38ada7(++_0x405c99);}(_0xc0bc,0x97));var _0xcc0b=function(_0x4689e8,_0x1a2c6e){_0x4689e8=_0x4689e8-0x0;var _0xa49476=_0xc0bc[_0x4689e8];return _0xa49476;};'use strict';var _=require(_0xcc0b('0x0'));var util=require(_0xcc0b('0x1'));var logger=require(_0xcc0b('0x2'))(_0xcc0b('0x3'));var moment=require(_0xcc0b('0x4'));var BPromise=require(_0xcc0b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc0b('0x6'));var rimraf=require(_0xcc0b('0x7'));var config=require(_0xcc0b('0x8'));var attributes=require(_0xcc0b('0x9'));module[_0xcc0b('0xa')]=function(_0x55eaf8,_0x2efefb){return _0x55eaf8[_0xcc0b('0xb')]('OpenchannelQueue',attributes,{'tableName':_0xcc0b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 0ccd676..26aa9b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x50b5=['../../config/environment','http','redis','defaults','socket.io-emitter','register','request','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetOpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowOpenchannelQueue','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x50b5,0x1f1));var _0x550b=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x50b5[_0x381589];return _0x2a075d;};'use strict';var _=require('lodash');var util=require(_0x550b('0x0'));var moment=require(_0x550b('0x1'));var BPromise=require(_0x550b('0x2'));var rs=require(_0x550b('0x3'));var fs=require('fs');var Redis=require(_0x550b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x550b('0x5'));var logger=require(_0x550b('0x6'))('rpc');var config=require(_0x550b('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x550b('0x8')]({'port':0x232a});config[_0x550b('0x9')]=_[_0x550b('0xa')](config[_0x550b('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x550b('0xb'))(new Redis(config[_0x550b('0x9')]));require('./openchannelQueue.socket')[_0x550b('0xc')](socket);function respondWithRpcPromise(_0x5015cc,_0x418e1f,_0x3ba221){return new BPromise(function(_0x1a4b67,_0x435f6d){return client[_0x550b('0xd')](_0x5015cc,_0x3ba221)['then'](function(_0xe19d98){logger[_0x550b('0xe')](_0x550b('0xf'),_0x418e1f,_0x550b('0x10'));logger[_0x550b('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x418e1f,_0x550b('0x10'),JSON[_0x550b('0x12')](_0xe19d98));if(_0xe19d98[_0x550b('0x13')]){if(_0xe19d98[_0x550b('0x13')][_0x550b('0x14')]===0x1f4){logger[_0x550b('0x13')](_0x550b('0xf'),_0x418e1f,_0xe19d98[_0x550b('0x13')][_0x550b('0x15')]);return _0x435f6d(_0xe19d98[_0x550b('0x13')][_0x550b('0x15')]);}logger['error'](_0x550b('0xf'),_0x418e1f,_0xe19d98['error']['message']);return _0x1a4b67(_0xe19d98[_0x550b('0x13')][_0x550b('0x15')]);}else{logger[_0x550b('0xe')](_0x550b('0xf'),_0x418e1f,_0x550b('0x10'));_0x1a4b67(_0xe19d98[_0x550b('0x16')][_0x550b('0x15')]);}})[_0x550b('0x17')](function(_0x4f1c81){logger[_0x550b('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x418e1f,_0x4f1c81);_0x435f6d(_0x4f1c81);});});}exports[_0x550b('0x18')]=function(_0x430784){var _0x340596=this;return new Promise(function(_0x111cb7,_0x17f029){return db['OpenchannelQueue'][_0x550b('0x19')]({'raw':_0x430784[_0x550b('0x1a')]?_0x430784[_0x550b('0x1a')][_0x550b('0x1b')]===undefined?!![]:![]:!![],'where':_0x430784[_0x550b('0x1a')]?_0x430784[_0x550b('0x1a')][_0x550b('0x1c')]||null:null,'attributes':_0x430784['options']?_0x430784['options'][_0x550b('0x1d')]||null:null,'limit':_0x430784[_0x550b('0x1a')]?_0x430784['options'][_0x550b('0x1e')]||null:null,'include':_0x430784[_0x550b('0x1a')]?_0x430784[_0x550b('0x1a')][_0x550b('0x1f')]?_[_0x550b('0x20')](_0x430784[_0x550b('0x1a')][_0x550b('0x1f')],function(_0x5b30b6){return{'model':db[_0x5b30b6[_0x550b('0x21')]],'as':_0x5b30b6['as'],'attributes':_0x5b30b6[_0x550b('0x1d')],'include':_0x5b30b6[_0x550b('0x1f')]?_[_0x550b('0x20')](_0x5b30b6[_0x550b('0x1f')],function(_0x2b6f74){return{'model':db[_0x2b6f74[_0x550b('0x21')]],'as':_0x2b6f74['as'],'attributes':_0x2b6f74[_0x550b('0x1d')],'include':_0x2b6f74[_0x550b('0x1f')]?_['map'](_0x2b6f74['include'],function(_0x24c2f9){return{'model':db[_0x24c2f9[_0x550b('0x21')]],'as':_0x24c2f9['as'],'attributes':_0x24c2f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x550b('0x22')](function(_0x3d7ad2){logger[_0x550b('0xe')](_0x550b('0x18'),_0x430784);logger[_0x550b('0x11')](_0x550b('0x18'),_0x430784,JSON['stringify'](_0x3d7ad2));_0x111cb7(_0x3d7ad2);})[_0x550b('0x17')](function(_0xe0e763){logger[_0x550b('0x13')](_0x550b('0x18'),_0xe0e763[_0x550b('0x15')],_0x430784);_0x17f029(_0x340596[_0x550b('0x13')](0x1f4,_0xe0e763['message']));});});};exports[_0x550b('0x23')]=function(_0x3ba15b){var _0xf669ca=this;return new Promise(function(_0x34bf3c,_0x3f7117){return db['OpenchannelQueue']['find']({'raw':_0x3ba15b[_0x550b('0x1a')]?_0x3ba15b[_0x550b('0x1a')][_0x550b('0x1b')]===undefined?!![]:![]:!![],'where':_0x3ba15b[_0x550b('0x1a')]?_0x3ba15b['options'][_0x550b('0x1c')]||null:null,'attributes':_0x3ba15b[_0x550b('0x1a')]?_0x3ba15b[_0x550b('0x1a')]['attributes']||null:null,'include':_0x3ba15b[_0x550b('0x1a')]?_0x3ba15b['options'][_0x550b('0x1f')]?_['map'](_0x3ba15b[_0x550b('0x1a')][_0x550b('0x1f')],function(_0x3fda72){return{'model':db[_0x3fda72[_0x550b('0x21')]],'as':_0x3fda72['as'],'attributes':_0x3fda72[_0x550b('0x1d')],'include':_0x3fda72[_0x550b('0x1f')]?_[_0x550b('0x20')](_0x3fda72[_0x550b('0x1f')],function(_0x372ac0){return{'model':db[_0x372ac0[_0x550b('0x21')]],'as':_0x372ac0['as'],'attributes':_0x372ac0[_0x550b('0x1d')],'include':_0x372ac0[_0x550b('0x1f')]?_[_0x550b('0x20')](_0x372ac0[_0x550b('0x1f')],function(_0x234e4d){return{'model':db[_0x234e4d[_0x550b('0x21')]],'as':_0x234e4d['as'],'attributes':_0x234e4d[_0x550b('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x550b('0x22')](function(_0x157724){logger[_0x550b('0xe')]('ShowOpenchannelQueue',_0x3ba15b);logger[_0x550b('0x11')]('ShowOpenchannelQueue',_0x3ba15b,JSON['stringify'](_0x157724));_0x34bf3c(_0x157724);})[_0x550b('0x17')](function(_0x3108c4){logger[_0x550b('0x13')]('ShowOpenchannelQueue',_0x3108c4['message'],_0x3ba15b);_0x3f7117(_0xf669ca[_0x550b('0x13')](0x1f4,_0x3108c4[_0x550b('0x15')]));});});};
\ No newline at end of file
+var _0x7509=['request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','ShowOpenchannelQueue','find','where','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register'];(function(_0x576ce0,_0x22f404){var _0x36f9a3=function(_0x244830){while(--_0x244830){_0x576ce0['push'](_0x576ce0['shift']());}};_0x36f9a3(++_0x22f404);}(_0x7509,0x97));var _0x9750=function(_0x397e87,_0x237eca){_0x397e87=_0x397e87-0x0;var _0x362fdd=_0x7509[_0x397e87];return _0x362fdd;};'use strict';var _=require(_0x9750('0x0'));var util=require('util');var moment=require(_0x9750('0x1'));var BPromise=require(_0x9750('0x2'));var rs=require(_0x9750('0x3'));var fs=require('fs');var Redis=require(_0x9750('0x4'));var db=require(_0x9750('0x5'))['db'];var utils=require(_0x9750('0x6'));var logger=require('../../config/logger')(_0x9750('0x7'));var config=require('../../config/environment');var jayson=require(_0x9750('0x8'));var client=jayson[_0x9750('0x9')][_0x9750('0xa')]({'port':0x232a});config[_0x9750('0xb')]=_[_0x9750('0xc')](config['redis'],{'host':_0x9750('0xd'),'port':0x18eb});var socket=require(_0x9750('0xe'))(new Redis(config[_0x9750('0xb')]));require(_0x9750('0xf'))[_0x9750('0x10')](socket);function respondWithRpcPromise(_0x57c25a,_0x18c12a,_0x5b63fe){return new BPromise(function(_0x12a876,_0x333cb4){return client[_0x9750('0x11')](_0x57c25a,_0x5b63fe)[_0x9750('0x12')](function(_0x576ba7){logger[_0x9750('0x13')](_0x9750('0x14'),_0x18c12a,_0x9750('0x15'));logger[_0x9750('0x16')](_0x9750('0x17'),_0x18c12a,_0x9750('0x15'),JSON['stringify'](_0x576ba7));if(_0x576ba7[_0x9750('0x18')]){if(_0x576ba7['error'][_0x9750('0x19')]===0x1f4){logger[_0x9750('0x18')](_0x9750('0x14'),_0x18c12a,_0x576ba7[_0x9750('0x18')][_0x9750('0x1a')]);return _0x333cb4(_0x576ba7[_0x9750('0x18')][_0x9750('0x1a')]);}logger[_0x9750('0x18')](_0x9750('0x14'),_0x18c12a,_0x576ba7['error'][_0x9750('0x1a')]);return _0x12a876(_0x576ba7['error'][_0x9750('0x1a')]);}else{logger[_0x9750('0x13')](_0x9750('0x14'),_0x18c12a,_0x9750('0x15'));_0x12a876(_0x576ba7[_0x9750('0x1b')][_0x9750('0x1a')]);}})[_0x9750('0x1c')](function(_0x132148){logger[_0x9750('0x18')](_0x9750('0x14'),_0x18c12a,_0x132148);_0x333cb4(_0x132148);});});}exports[_0x9750('0x1d')]=function(_0x1cd2d5){var _0x314f29=this;return new Promise(function(_0x29e26b,_0x51f34f){return db[_0x9750('0x1e')][_0x9750('0x1f')]({'raw':_0x1cd2d5[_0x9750('0x20')]?_0x1cd2d5['options'][_0x9750('0x21')]===undefined?!![]:![]:!![],'where':_0x1cd2d5['options']?_0x1cd2d5[_0x9750('0x20')]['where']||null:null,'attributes':_0x1cd2d5['options']?_0x1cd2d5[_0x9750('0x20')][_0x9750('0x22')]||null:null,'limit':_0x1cd2d5[_0x9750('0x20')]?_0x1cd2d5['options']['limit']||null:null,'include':_0x1cd2d5[_0x9750('0x20')]?_0x1cd2d5[_0x9750('0x20')][_0x9750('0x23')]?_[_0x9750('0x24')](_0x1cd2d5[_0x9750('0x20')][_0x9750('0x23')],function(_0x197e8d){return{'model':db[_0x197e8d[_0x9750('0x25')]],'as':_0x197e8d['as'],'attributes':_0x197e8d[_0x9750('0x22')],'include':_0x197e8d[_0x9750('0x23')]?_[_0x9750('0x24')](_0x197e8d['include'],function(_0x2b0d23){return{'model':db[_0x2b0d23[_0x9750('0x25')]],'as':_0x2b0d23['as'],'attributes':_0x2b0d23[_0x9750('0x22')],'include':_0x2b0d23[_0x9750('0x23')]?_[_0x9750('0x24')](_0x2b0d23[_0x9750('0x23')],function(_0x2e0b45){return{'model':db[_0x2e0b45[_0x9750('0x25')]],'as':_0x2e0b45['as'],'attributes':_0x2e0b45[_0x9750('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9750('0x12')](function(_0x4ef5dd){logger[_0x9750('0x13')](_0x9750('0x1d'),_0x1cd2d5);logger['debug'](_0x9750('0x1d'),_0x1cd2d5,JSON['stringify'](_0x4ef5dd));_0x29e26b(_0x4ef5dd);})[_0x9750('0x1c')](function(_0x136db9){logger[_0x9750('0x18')](_0x9750('0x1d'),_0x136db9[_0x9750('0x1a')],_0x1cd2d5);_0x51f34f(_0x314f29[_0x9750('0x18')](0x1f4,_0x136db9[_0x9750('0x1a')]));});});};exports[_0x9750('0x26')]=function(_0x41d9ec){var _0x2a63b0=this;return new Promise(function(_0x35c101,_0x20b1d8){return db[_0x9750('0x1e')][_0x9750('0x27')]({'raw':_0x41d9ec[_0x9750('0x20')]?_0x41d9ec[_0x9750('0x20')][_0x9750('0x21')]===undefined?!![]:![]:!![],'where':_0x41d9ec[_0x9750('0x20')]?_0x41d9ec[_0x9750('0x20')][_0x9750('0x28')]||null:null,'attributes':_0x41d9ec[_0x9750('0x20')]?_0x41d9ec['options'][_0x9750('0x22')]||null:null,'include':_0x41d9ec[_0x9750('0x20')]?_0x41d9ec[_0x9750('0x20')]['include']?_['map'](_0x41d9ec['options'][_0x9750('0x23')],function(_0x292a06){return{'model':db[_0x292a06[_0x9750('0x25')]],'as':_0x292a06['as'],'attributes':_0x292a06[_0x9750('0x22')],'include':_0x292a06[_0x9750('0x23')]?_[_0x9750('0x24')](_0x292a06['include'],function(_0xa168b4){return{'model':db[_0xa168b4[_0x9750('0x25')]],'as':_0xa168b4['as'],'attributes':_0xa168b4[_0x9750('0x22')],'include':_0xa168b4['include']?_[_0x9750('0x24')](_0xa168b4['include'],function(_0x53b0fd){return{'model':db[_0x53b0fd[_0x9750('0x25')]],'as':_0x53b0fd['as'],'attributes':_0x53b0fd[_0x9750('0x22')]};}):[]};}):[]};}):[]:[]})[_0x9750('0x12')](function(_0x46848d){logger[_0x9750('0x13')]('ShowOpenchannelQueue',_0x41d9ec);logger[_0x9750('0x16')](_0x9750('0x26'),_0x41d9ec,JSON[_0x9750('0x29')](_0x46848d));_0x35c101(_0x46848d);})[_0x9750('0x1c')](function(_0x50e3a3){logger['error'](_0x9750('0x26'),_0x50e3a3['message'],_0x41d9ec);_0x20b1d8(_0x2a63b0[_0x9750('0x18')](0x1f4,_0x50e3a3['message']));});});};
\ No newline at end of file
index 917ad40..c748f82 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2552=['save','remove','update','emit','register','length','openchannelQueue:','./openchannelQueue.events'];(function(_0x2e4152,_0x5aa898){var _0xe77494=function(_0x1c4007){while(--_0x1c4007){_0x2e4152['push'](_0x2e4152['shift']());}};_0xe77494(++_0x5aa898);}(_0x2552,0x1df));var _0x2255=function(_0x1d7325,_0x188c55){_0x1d7325=_0x1d7325-0x0;var _0x59d748=_0x2552[_0x1d7325];return _0x59d748;};'use strict';var OpenchannelQueueEvents=require(_0x2255('0x0'));var events=[_0x2255('0x1'),_0x2255('0x2'),_0x2255('0x3')];function createListener(_0x505360,_0x8b2619){return function(_0x174076){_0x8b2619[_0x2255('0x4')](_0x505360,_0x174076);};}function removeListener(_0x185731,_0x508857){return function(){OpenchannelQueueEvents['removeListener'](_0x185731,_0x508857);};}exports[_0x2255('0x5')]=function(_0x3b9c7b){for(var _0x3d5d4d=0x0,_0x249f27=events[_0x2255('0x6')];_0x3d5d4d<_0x249f27;_0x3d5d4d++){var _0x16f7fe=events[_0x3d5d4d];var _0x407ca3=createListener(_0x2255('0x7')+_0x16f7fe,_0x3b9c7b);OpenchannelQueueEvents['on'](_0x16f7fe,_0x407ca3);}};
\ No newline at end of file
+var _0x4386=['openchannelQueue:','./openchannelQueue.events','save','update','emit','removeListener','register','length'];(function(_0x5a2ee2,_0x2dcc19){var _0xf2fcb7=function(_0x5e8640){while(--_0x5e8640){_0x5a2ee2['push'](_0x5a2ee2['shift']());}};_0xf2fcb7(++_0x2dcc19);}(_0x4386,0xe9));var _0x6438=function(_0x4b6792,_0x1098bb){_0x4b6792=_0x4b6792-0x0;var _0x406802=_0x4386[_0x4b6792];return _0x406802;};'use strict';var OpenchannelQueueEvents=require(_0x6438('0x0'));var events=[_0x6438('0x1'),'remove',_0x6438('0x2')];function createListener(_0x4205c0,_0x23f797){return function(_0xa45f25){_0x23f797[_0x6438('0x3')](_0x4205c0,_0xa45f25);};}function removeListener(_0x50427d,_0x2e6b61){return function(){OpenchannelQueueEvents[_0x6438('0x4')](_0x50427d,_0x2e6b61);};}exports[_0x6438('0x5')]=function(_0x3b6386){for(var _0x488f97=0x0,_0x5c1513=events[_0x6438('0x6')];_0x488f97<_0x5c1513;_0x488f97++){var _0x33bb55=events[_0x488f97];var _0x36bdd7=createListener(_0x6438('0x7')+_0x33bb55,_0x3b6386);OpenchannelQueueEvents['on'](_0x33bb55,_0x36bdd7);}};
\ No newline at end of file
index 85dde1f..2b29eb0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2379=['post','put','update','delete','destroy','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x201ed2,_0x1042cc){var _0x138582=function(_0x682b4a){while(--_0x682b4a){_0x201ed2['push'](_0x201ed2['shift']());}};_0x138582(++_0x1042cc);}(_0x2379,0x123));var _0x9237=function(_0x110838,_0x5f55dd){_0x110838=_0x110838-0x0;var _0x504da4=_0x2379[_0x110838];return _0x504da4;};'use strict';var multer=require(_0x9237('0x0'));var util=require('util');var path=require(_0x9237('0x1'));var timeout=require('connect-timeout');var express=require(_0x9237('0x2'));var router=express['Router']();var fs_extra=require(_0x9237('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x9237('0x4'));var config=require(_0x9237('0x5'));var controller=require(_0x9237('0x6'));router[_0x9237('0x7')]('/',auth[_0x9237('0x8')](),controller[_0x9237('0x9')]);router[_0x9237('0x7')](_0x9237('0xa'),auth['isAuthenticated'](),controller[_0x9237('0xb')]);router['get'](_0x9237('0xc'),auth[_0x9237('0x8')](),controller['show']);router[_0x9237('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9237('0xe')](_0x9237('0xc'),auth['isAuthenticated'](),controller[_0x9237('0xf')]);router[_0x9237('0x10')]('/:id',auth[_0x9237('0x8')](),controller[_0x9237('0x11')]);module[_0x9237('0x12')]=router;
\ No newline at end of file
+var _0xa76b=['express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','/:id','show','create','put','update','delete','destroy','exports','path','connect-timeout'];(function(_0x57ee3d,_0x35107d){var _0x18d665=function(_0x3c3901){while(--_0x3c3901){_0x57ee3d['push'](_0x57ee3d['shift']());}};_0x18d665(++_0x35107d);}(_0xa76b,0xbc));var _0xba76=function(_0xdffe7d,_0x1d258d){_0xdffe7d=_0xdffe7d-0x0;var _0x3063e0=_0xa76b[_0xdffe7d];return _0x3063e0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xba76('0x0'));var timeout=require(_0xba76('0x1'));var express=require(_0xba76('0x2'));var router=express[_0xba76('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xba76('0x4'));var interaction=require(_0xba76('0x5'));var config=require('../../config/environment');var controller=require(_0xba76('0x6'));router[_0xba76('0x7')]('/',auth[_0xba76('0x8')](),controller[_0xba76('0x9')]);router[_0xba76('0x7')](_0xba76('0xa'),auth[_0xba76('0x8')](),controller['describe']);router[_0xba76('0x7')](_0xba76('0xb'),auth[_0xba76('0x8')](),controller[_0xba76('0xc')]);router['post']('/',auth[_0xba76('0x8')](),controller[_0xba76('0xd')]);router[_0xba76('0xe')](_0xba76('0xb'),auth[_0xba76('0x8')](),controller[_0xba76('0xf')]);router[_0xba76('0x10')]('/:id',auth[_0xba76('0x8')](),controller[_0xba76('0x11')]);module[_0xba76('0x12')]=router;
\ No newline at end of file
index 754b2be..ef5bf19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb96a=['STRING','DATE','moment','exports'];(function(_0x66f52,_0x27d805){var _0x47ad49=function(_0x2b1d56){while(--_0x2b1d56){_0x66f52['push'](_0x66f52['shift']());}};_0x47ad49(++_0x27d805);}(_0xb96a,0x196));var _0xab96=function(_0x6b63b1,_0x1f6254){_0x6b63b1=_0x6b63b1-0x0;var _0x49c9d6=_0xb96a[_0x6b63b1];return _0x49c9d6;};'use strict';var moment=require(_0xab96('0x0'));var Sequelize=require('sequelize');module[_0xab96('0x1')]={'uniqueid':{'type':Sequelize[_0xab96('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xab96('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xab96('0x3')]},'acceptAt':{'type':Sequelize[_0xab96('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xab96('0x2')]}};
\ No newline at end of file
+var _0x97bf=['STRING','DATE','sequelize','exports'];(function(_0x1076de,_0x28d40b){var _0x430d82=function(_0x4b28ac){while(--_0x4b28ac){_0x1076de['push'](_0x1076de['shift']());}};_0x430d82(++_0x28d40b);}(_0x97bf,0xa2));var _0xf97b=function(_0x3a8457,_0x25b0dd){_0x3a8457=_0x3a8457-0x0;var _0x56d233=_0x97bf[_0x3a8457];return _0x56d233;};'use strict';var moment=require('moment');var Sequelize=require(_0xf97b('0x0'));module[_0xf97b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xf97b('0x2')]},'joinAt':{'type':Sequelize[_0xf97b('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xf97b('0x3')]},'reason':{'type':Sequelize[_0xf97b('0x2')]}};
\ No newline at end of file
index 06599db..68d1231 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe43=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','index','fieldName','map','query','keys','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','merge','type','VIRTUAL','OpenchannelQueueReport','include','catch','show','params','rawAttributes','options','find','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x4ec3ab,_0x50a5de){var _0x229613=function(_0x5c2daa){while(--_0x5c2daa){_0x4ec3ab['push'](_0x4ec3ab['shift']());}};_0x229613(++_0x50a5de);}(_0xfe43,0x187));var _0x3fe4=function(_0x4d1744,_0x4171ea){_0x4d1744=_0x4d1744-0x0;var _0x115232=_0xfe43[_0x4d1744];return _0x115232;};'use strict';var emlformat=require(_0x3fe4('0x0'));var rimraf=require(_0x3fe4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fe4('0x2'));var rp=require(_0x3fe4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3fe4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x3fe4('0x5'));var csv=require(_0x3fe4('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fe4('0x7'));var squel=require(_0x3fe4('0x8'));var crypto=require(_0x3fe4('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3fe4('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3fe4('0xb'));var Papa=require(_0x3fe4('0xc'));var Redis=require(_0x3fe4('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3fe4('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3fe4('0xf'));var logger=require(_0x3fe4('0x10'))('api');var utils=require(_0x3fe4('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3fe4('0x12'))['db'];function respondWithStatusCode(_0x3cf981,_0x183bf4){_0x183bf4=_0x183bf4||0xcc;return function(_0x363955){if(_0x363955){return _0x3cf981[_0x3fe4('0x13')](_0x183bf4);}return _0x3cf981['status'](_0x183bf4)['end']();};}function respondWithResult(_0x45d3a1,_0x3d62fd){_0x3d62fd=_0x3d62fd||0xc8;return function(_0x1cfe2e){if(_0x1cfe2e){return _0x45d3a1[_0x3fe4('0x14')](_0x3d62fd)[_0x3fe4('0x15')](_0x1cfe2e);}};}function respondWithFilteredResult(_0x4ae6e9,_0x403b81){return function(_0x2a4d39){if(_0x2a4d39){var _0x53fe6e=typeof _0x403b81[_0x3fe4('0x16')]===_0x3fe4('0x17')&&typeof _0x403b81[_0x3fe4('0x18')]==='undefined';var _0x3ec9a2=_0x2a4d39['count'];var _0x284792=_0x53fe6e?0x0:_0x403b81['offset'];var _0x3645d9=_0x53fe6e?_0x2a4d39[_0x3fe4('0x19')]:_0x403b81[_0x3fe4('0x16')]+_0x403b81[_0x3fe4('0x18')];var _0x2bf63e;if(_0x3645d9>=_0x3ec9a2){_0x3645d9=_0x3ec9a2;_0x2bf63e=0xc8;}else{_0x2bf63e=0xce;}_0x4ae6e9[_0x3fe4('0x14')](_0x2bf63e);return _0x4ae6e9[_0x3fe4('0x1a')](_0x3fe4('0x1b'),_0x284792+'-'+_0x3645d9+'/'+_0x3ec9a2)[_0x3fe4('0x15')](_0x2a4d39);}return null;};}function patchUpdates(_0x570d0b){return function(_0x56a423){try{jsonpatch[_0x3fe4('0x1c')](_0x56a423,_0x570d0b,!![]);}catch(_0x3128ba){return BPromise[_0x3fe4('0x1d')](_0x3128ba);}return _0x56a423[_0x3fe4('0x1e')]();};}function saveUpdates(_0x3aa1fb,_0x2974fe){return function(_0x4b9950){if(_0x4b9950){return _0x4b9950[_0x3fe4('0x1f')](_0x3aa1fb)[_0x3fe4('0x20')](function(_0x4cc300){return _0x4cc300;});}return null;};}function removeEntity(_0x246bda,_0x878b46){return function(_0x38743e){if(_0x38743e){return _0x38743e['destroy']()[_0x3fe4('0x20')](function(){_0x246bda[_0x3fe4('0x14')](0xcc)[_0x3fe4('0x21')]();});}};}function handleEntityNotFound(_0x5da7da,_0x5a5eb8){return function(_0x840ca9){if(!_0x840ca9){_0x5da7da['sendStatus'](0x194);}return _0x840ca9;};}function handleError(_0x5cc3cb,_0x1b25a3){_0x1b25a3=_0x1b25a3||0x1f4;return function(_0x15cfb1){logger[_0x3fe4('0x22')](_0x15cfb1[_0x3fe4('0x23')]);if(_0x15cfb1[_0x3fe4('0x24')]){delete _0x15cfb1[_0x3fe4('0x24')];}_0x5cc3cb[_0x3fe4('0x14')](_0x1b25a3)['send'](_0x15cfb1);};}exports[_0x3fe4('0x25')]=function(_0x5395bb,_0x1511f8){var _0x5a4468={},_0x536ac8={},_0x5ded33={'count':0x0,'rows':[]};var _0x4ce649=_['map'](db['OpenchannelQueueReport']['rawAttributes'],function(_0x828646){return{'name':_0x828646[_0x3fe4('0x26')],'type':_0x828646['type']['key']};});_0x536ac8['model']=_[_0x3fe4('0x27')](_0x4ce649,'name');_0x536ac8[_0x3fe4('0x28')]=_[_0x3fe4('0x29')](_0x5395bb['query']);_0x536ac8['filters']=_[_0x3fe4('0x2a')](_0x536ac8[_0x3fe4('0x2b')],_0x536ac8[_0x3fe4('0x28')]);_0x5a4468[_0x3fe4('0x2c')]=_[_0x3fe4('0x2a')](_0x536ac8[_0x3fe4('0x2b')],qs['fields'](_0x5395bb[_0x3fe4('0x28')][_0x3fe4('0x2d')]));_0x5a4468[_0x3fe4('0x2c')]=_0x5a4468[_0x3fe4('0x2c')][_0x3fe4('0x2e')]?_0x5a4468[_0x3fe4('0x2c')]:_0x536ac8[_0x3fe4('0x2b')];if(!_0x5395bb[_0x3fe4('0x28')]['hasOwnProperty'](_0x3fe4('0x2f'))){_0x5a4468['limit']=qs[_0x3fe4('0x18')](_0x5395bb[_0x3fe4('0x28')][_0x3fe4('0x18')]);_0x5a4468[_0x3fe4('0x16')]=qs[_0x3fe4('0x16')](_0x5395bb[_0x3fe4('0x28')][_0x3fe4('0x16')]);}_0x5a4468['order']=qs[_0x3fe4('0x30')](_0x5395bb[_0x3fe4('0x28')]['sort']);_0x5a4468[_0x3fe4('0x31')]=qs[_0x3fe4('0x32')](_[_0x3fe4('0x33')](_0x5395bb['query'],_0x536ac8[_0x3fe4('0x32')]),_0x4ce649);if(_0x5395bb[_0x3fe4('0x28')]['filter']){_0x5a4468[_0x3fe4('0x31')]=_[_0x3fe4('0x34')](_0x5a4468['where'],{'$or':_[_0x3fe4('0x27')](_0x4ce649,function(_0x1b8188){if(_0x1b8188[_0x3fe4('0x35')]!==_0x3fe4('0x36')){var _0x4d05e2={};_0x4d05e2[_0x1b8188['name']]={'$like':'%'+_0x5395bb['query']['filter']+'%'};return _0x4d05e2;}})});}_0x5a4468=_[_0x3fe4('0x34')]({},_0x5a4468,_0x5395bb['options']);var _0x26915d={'where':_0x5a4468[_0x3fe4('0x31')]};return db[_0x3fe4('0x37')][_0x3fe4('0x19')](_0x26915d)[_0x3fe4('0x20')](function(_0xc49224){_0x5ded33[_0x3fe4('0x19')]=_0xc49224;if(_0x5395bb[_0x3fe4('0x28')]['includeAll']){_0x5a4468[_0x3fe4('0x38')]=[{'all':!![]}];}return db[_0x3fe4('0x37')]['findAll'](_0x5a4468);})[_0x3fe4('0x20')](function(_0x4d3d07){_0x5ded33['rows']=_0x4d3d07;return _0x5ded33;})['then'](respondWithFilteredResult(_0x1511f8,_0x5a4468))[_0x3fe4('0x39')](handleError(_0x1511f8,null));};exports[_0x3fe4('0x3a')]=function(_0x1d55f7,_0x5eb410){var _0x35e6a7={'raw':!![],'where':{'id':_0x1d55f7[_0x3fe4('0x3b')]['id']}},_0xd0e2d5={};_0xd0e2d5[_0x3fe4('0x2b')]=_['keys'](db[_0x3fe4('0x37')][_0x3fe4('0x3c')]);_0xd0e2d5[_0x3fe4('0x28')]=_[_0x3fe4('0x29')](_0x1d55f7['query']);_0xd0e2d5['filters']=_['intersection'](_0xd0e2d5[_0x3fe4('0x2b')],_0xd0e2d5[_0x3fe4('0x28')]);_0x35e6a7['attributes']=_[_0x3fe4('0x2a')](_0xd0e2d5[_0x3fe4('0x2b')],qs[_0x3fe4('0x2d')](_0x1d55f7[_0x3fe4('0x28')][_0x3fe4('0x2d')]));_0x35e6a7[_0x3fe4('0x2c')]=_0x35e6a7[_0x3fe4('0x2c')][_0x3fe4('0x2e')]?_0x35e6a7['attributes']:_0xd0e2d5[_0x3fe4('0x2b')];if(_0x1d55f7[_0x3fe4('0x28')]['includeAll']){_0x35e6a7['include']=[{'all':!![]}];}_0x35e6a7=_['merge']({},_0x35e6a7,_0x1d55f7[_0x3fe4('0x3d')]);return db['OpenchannelQueueReport'][_0x3fe4('0x3e')](_0x35e6a7)['then'](handleEntityNotFound(_0x5eb410,null))[_0x3fe4('0x20')](respondWithResult(_0x5eb410,null))[_0x3fe4('0x39')](handleError(_0x5eb410,null));};exports[_0x3fe4('0x3f')]=function(_0x29caf3,_0x26bb8){return db['OpenchannelQueueReport'][_0x3fe4('0x3f')](_0x29caf3[_0x3fe4('0x40')],{})['then'](respondWithResult(_0x26bb8,0xc9))['catch'](handleError(_0x26bb8,null));};exports[_0x3fe4('0x1f')]=function(_0x290dfb,_0x108860){if(_0x290dfb[_0x3fe4('0x40')]['id']){delete _0x290dfb[_0x3fe4('0x40')]['id'];}return db[_0x3fe4('0x37')][_0x3fe4('0x3e')]({'where':{'id':_0x290dfb[_0x3fe4('0x3b')]['id']}})[_0x3fe4('0x20')](handleEntityNotFound(_0x108860,null))[_0x3fe4('0x20')](saveUpdates(_0x290dfb[_0x3fe4('0x40')],null))[_0x3fe4('0x20')](respondWithResult(_0x108860,null))[_0x3fe4('0x39')](handleError(_0x108860,null));};exports[_0x3fe4('0x41')]=function(_0x5457b5,_0x263df9){return db[_0x3fe4('0x37')][_0x3fe4('0x3e')]({'where':{'id':_0x5457b5[_0x3fe4('0x3b')]['id']}})[_0x3fe4('0x20')](handleEntityNotFound(_0x263df9,null))[_0x3fe4('0x20')](removeEntity(_0x263df9,null))[_0x3fe4('0x39')](handleError(_0x263df9,null));};exports[_0x3fe4('0x42')]=function(_0x29cfa5,_0x41b742){return db[_0x3fe4('0x37')][_0x3fe4('0x42')]()[_0x3fe4('0x20')](respondWithResult(_0x41b742,null))[_0x3fe4('0x39')](handleError(_0x41b742,null));};
\ No newline at end of file
+var _0x67d6=['filter','options','includeAll','findAll','rows','catch','params','rawAttributes','fields','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','map','OpenchannelQueueReport','fieldName','type','model','keys','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL'];(function(_0x4137e4,_0x442153){var _0x7b6759=function(_0x414930){while(--_0x414930){_0x4137e4['push'](_0x4137e4['shift']());}};_0x7b6759(++_0x442153);}(_0x67d6,0xa0));var _0x667d=function(_0x254b22,_0x27159f){_0x254b22=_0x254b22-0x0;var _0x1279db=_0x67d6[_0x254b22];return _0x1279db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x667d('0x0'));var zipdir=require(_0x667d('0x1'));var jsonpatch=require(_0x667d('0x2'));var rp=require('request-promise');var moment=require(_0x667d('0x3'));var BPromise=require(_0x667d('0x4'));var Mustache=require(_0x667d('0x5'));var util=require(_0x667d('0x6'));var path=require(_0x667d('0x7'));var sox=require('sox');var csv=require(_0x667d('0x8'));var ejs=require(_0x667d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x667d('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x667d('0xb'));var toCsv=require(_0x667d('0x8'));var querystring=require(_0x667d('0xc'));var Papa=require(_0x667d('0xd'));var Redis=require(_0x667d('0xe'));var authService=require(_0x667d('0xf'));var qs=require(_0x667d('0x10'));var as=require(_0x667d('0x11'));var hardwareService=require(_0x667d('0x12'));var logger=require('../../config/logger')(_0x667d('0x13'));var utils=require('../../config/utils');var config=require(_0x667d('0x14'));var licenseUtil=require(_0x667d('0x15'));var db=require(_0x667d('0x16'))['db'];function respondWithStatusCode(_0x1312bc,_0x4d95cd){_0x4d95cd=_0x4d95cd||0xcc;return function(_0x516b41){if(_0x516b41){return _0x1312bc[_0x667d('0x17')](_0x4d95cd);}return _0x1312bc[_0x667d('0x18')](_0x4d95cd)[_0x667d('0x19')]();};}function respondWithResult(_0x34b46d,_0x5ea553){_0x5ea553=_0x5ea553||0xc8;return function(_0xaa67fa){if(_0xaa67fa){return _0x34b46d['status'](_0x5ea553)[_0x667d('0x1a')](_0xaa67fa);}};}function respondWithFilteredResult(_0x15879e,_0x156391){return function(_0x1b5b0c){if(_0x1b5b0c){var _0x16b59c=typeof _0x156391[_0x667d('0x1b')]===_0x667d('0x1c')&&typeof _0x156391[_0x667d('0x1d')]===_0x667d('0x1c');var _0x5a06d3=_0x1b5b0c[_0x667d('0x1e')];var _0x453864=_0x16b59c?0x0:_0x156391['offset'];var _0x1a1025=_0x16b59c?_0x1b5b0c[_0x667d('0x1e')]:_0x156391[_0x667d('0x1b')]+_0x156391[_0x667d('0x1d')];var _0x3b9033;if(_0x1a1025>=_0x5a06d3){_0x1a1025=_0x5a06d3;_0x3b9033=0xc8;}else{_0x3b9033=0xce;}_0x15879e['status'](_0x3b9033);return _0x15879e[_0x667d('0x1f')](_0x667d('0x20'),_0x453864+'-'+_0x1a1025+'/'+_0x5a06d3)[_0x667d('0x1a')](_0x1b5b0c);}return null;};}function patchUpdates(_0x7badda){return function(_0x1da53f){try{jsonpatch[_0x667d('0x21')](_0x1da53f,_0x7badda,!![]);}catch(_0x3d1563){return BPromise[_0x667d('0x22')](_0x3d1563);}return _0x1da53f['save']();};}function saveUpdates(_0x2a95b3,_0x1484bd){return function(_0x43ebd1){if(_0x43ebd1){return _0x43ebd1[_0x667d('0x23')](_0x2a95b3)[_0x667d('0x24')](function(_0x52e8cf){return _0x52e8cf;});}return null;};}function removeEntity(_0x31251a,_0x3d6363){return function(_0x5d4f9e){if(_0x5d4f9e){return _0x5d4f9e[_0x667d('0x25')]()[_0x667d('0x24')](function(){_0x31251a[_0x667d('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x552c20,_0x4e686a){return function(_0xe874ca){if(!_0xe874ca){_0x552c20['sendStatus'](0x194);}return _0xe874ca;};}function handleError(_0x1beec5,_0x39d20b){_0x39d20b=_0x39d20b||0x1f4;return function(_0xf6273b){logger[_0x667d('0x26')](_0xf6273b[_0x667d('0x27')]);if(_0xf6273b['name']){delete _0xf6273b[_0x667d('0x28')];}_0x1beec5[_0x667d('0x18')](_0x39d20b)['send'](_0xf6273b);};}exports[_0x667d('0x29')]=function(_0x1d891b,_0x41ff78){var _0x224703={},_0x157cea={},_0x588136={'count':0x0,'rows':[]};var _0x2a7361=_[_0x667d('0x2a')](db[_0x667d('0x2b')]['rawAttributes'],function(_0x2d480e){return{'name':_0x2d480e[_0x667d('0x2c')],'type':_0x2d480e[_0x667d('0x2d')]['key']};});_0x157cea[_0x667d('0x2e')]=_[_0x667d('0x2a')](_0x2a7361,'name');_0x157cea['query']=_[_0x667d('0x2f')](_0x1d891b[_0x667d('0x30')]);_0x157cea['filters']=_['intersection'](_0x157cea['model'],_0x157cea[_0x667d('0x30')]);_0x224703[_0x667d('0x31')]=_['intersection'](_0x157cea[_0x667d('0x2e')],qs['fields'](_0x1d891b[_0x667d('0x30')]['fields']));_0x224703[_0x667d('0x31')]=_0x224703[_0x667d('0x31')][_0x667d('0x32')]?_0x224703[_0x667d('0x31')]:_0x157cea[_0x667d('0x2e')];if(!_0x1d891b[_0x667d('0x30')][_0x667d('0x33')](_0x667d('0x34'))){_0x224703[_0x667d('0x1d')]=qs[_0x667d('0x1d')](_0x1d891b[_0x667d('0x30')][_0x667d('0x1d')]);_0x224703[_0x667d('0x1b')]=qs['offset'](_0x1d891b['query'][_0x667d('0x1b')]);}_0x224703[_0x667d('0x35')]=qs[_0x667d('0x36')](_0x1d891b[_0x667d('0x30')][_0x667d('0x36')]);_0x224703[_0x667d('0x37')]=qs[_0x667d('0x38')](_[_0x667d('0x39')](_0x1d891b['query'],_0x157cea[_0x667d('0x38')]),_0x2a7361);if(_0x1d891b[_0x667d('0x30')]['filter']){_0x224703[_0x667d('0x37')]=_['merge'](_0x224703['where'],{'$or':_[_0x667d('0x2a')](_0x2a7361,function(_0x4bddcf){if(_0x4bddcf['type']!==_0x667d('0x3a')){var _0x650944={};_0x650944[_0x4bddcf[_0x667d('0x28')]]={'$like':'%'+_0x1d891b[_0x667d('0x30')][_0x667d('0x3b')]+'%'};return _0x650944;}})});}_0x224703=_['merge']({},_0x224703,_0x1d891b[_0x667d('0x3c')]);var _0x52d45c={'where':_0x224703[_0x667d('0x37')]};return db[_0x667d('0x2b')][_0x667d('0x1e')](_0x52d45c)[_0x667d('0x24')](function(_0x915b0f){_0x588136['count']=_0x915b0f;if(_0x1d891b['query'][_0x667d('0x3d')]){_0x224703['include']=[{'all':!![]}];}return db[_0x667d('0x2b')][_0x667d('0x3e')](_0x224703);})[_0x667d('0x24')](function(_0x46dec1){_0x588136[_0x667d('0x3f')]=_0x46dec1;return _0x588136;})[_0x667d('0x24')](respondWithFilteredResult(_0x41ff78,_0x224703))[_0x667d('0x40')](handleError(_0x41ff78,null));};exports['show']=function(_0x409c6d,_0x177be6){var _0x43ea19={'raw':!![],'where':{'id':_0x409c6d[_0x667d('0x41')]['id']}},_0x27a0e1={};_0x27a0e1[_0x667d('0x2e')]=_[_0x667d('0x2f')](db[_0x667d('0x2b')][_0x667d('0x42')]);_0x27a0e1[_0x667d('0x30')]=_['keys'](_0x409c6d[_0x667d('0x30')]);_0x27a0e1[_0x667d('0x38')]=_['intersection'](_0x27a0e1[_0x667d('0x2e')],_0x27a0e1[_0x667d('0x30')]);_0x43ea19[_0x667d('0x31')]=_['intersection'](_0x27a0e1['model'],qs['fields'](_0x409c6d['query'][_0x667d('0x43')]));_0x43ea19[_0x667d('0x31')]=_0x43ea19['attributes'][_0x667d('0x32')]?_0x43ea19[_0x667d('0x31')]:_0x27a0e1[_0x667d('0x2e')];if(_0x409c6d[_0x667d('0x30')][_0x667d('0x3d')]){_0x43ea19['include']=[{'all':!![]}];}_0x43ea19=_[_0x667d('0x44')]({},_0x43ea19,_0x409c6d['options']);return db[_0x667d('0x2b')][_0x667d('0x45')](_0x43ea19)['then'](handleEntityNotFound(_0x177be6,null))[_0x667d('0x24')](respondWithResult(_0x177be6,null))[_0x667d('0x40')](handleError(_0x177be6,null));};exports[_0x667d('0x46')]=function(_0x37d5fd,_0x3528c9){return db['OpenchannelQueueReport'][_0x667d('0x46')](_0x37d5fd[_0x667d('0x47')],{})[_0x667d('0x24')](respondWithResult(_0x3528c9,0xc9))[_0x667d('0x40')](handleError(_0x3528c9,null));};exports[_0x667d('0x23')]=function(_0x31b215,_0x34533c){if(_0x31b215[_0x667d('0x47')]['id']){delete _0x31b215['body']['id'];}return db[_0x667d('0x2b')][_0x667d('0x45')]({'where':{'id':_0x31b215[_0x667d('0x41')]['id']}})[_0x667d('0x24')](handleEntityNotFound(_0x34533c,null))['then'](saveUpdates(_0x31b215[_0x667d('0x47')],null))[_0x667d('0x24')](respondWithResult(_0x34533c,null))['catch'](handleError(_0x34533c,null));};exports[_0x667d('0x25')]=function(_0x54361d,_0x56d380){return db[_0x667d('0x2b')]['find']({'where':{'id':_0x54361d[_0x667d('0x41')]['id']}})[_0x667d('0x24')](handleEntityNotFound(_0x56d380,null))[_0x667d('0x24')](removeEntity(_0x56d380,null))[_0x667d('0x40')](handleError(_0x56d380,null));};exports[_0x667d('0x48')]=function(_0x45dbc6,_0x2a36c0){return db[_0x667d('0x2b')][_0x667d('0x48')]()[_0x667d('0x24')](respondWithResult(_0x2a36c0,null))[_0x667d('0x40')](handleError(_0x2a36c0,null));};
\ No newline at end of file
index 1295986..a22073d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x5e0563,_0x337c4f){var _0x17d4f2=function(_0x7d0b9d){while(--_0x7d0b9d){_0x5e0563['push'](_0x5e0563['shift']());}};_0x17d4f2(++_0x337c4f);}(_0x7a54,0x106));var _0x47a5=function(_0x447d5c,_0x33185c){_0x447d5c=_0x447d5c-0x0;var _0x19a434=_0x7a54[_0x447d5c];return _0x19a434;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x814b,0x1a2));var _0xb814=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x814b[_0x4e783c];return _0x2fbd6d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index 217a34d..67605bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd26f=['OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','options','raw','update','body','attributes','limit','then','UpdateOpenchannelQueueReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info'];(function(_0x15a87b,_0x487b06){var _0x55ebe3=function(_0xc0f3ad){while(--_0xc0f3ad){_0x15a87b['push'](_0x15a87b['shift']());}};_0x55ebe3(++_0x487b06);}(_0xd26f,0x113));var _0xfd26=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xd26f[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xfd26('0x0'));var util=require(_0xfd26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd26('0x2'));var fs=require('fs');var Redis=require(_0xfd26('0x3'));var db=require(_0xfd26('0x4'))['db'];var utils=require(_0xfd26('0x5'));var logger=require(_0xfd26('0x6'))(_0xfd26('0x7'));var config=require(_0xfd26('0x8'));var jayson=require(_0xfd26('0x9'));var client=jayson[_0xfd26('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x22b353,_0x3c148d,_0x1905a2){return new BPromise(function(_0x3d405f,_0x3c9154){return client[_0xfd26('0xb')](_0x22b353,_0x1905a2)['then'](function(_0xcf2fdb){logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));logger[_0xfd26('0xf')](_0xfd26('0x10'),_0x3c148d,'request\x20sent',JSON[_0xfd26('0x11')](_0xcf2fdb));if(_0xcf2fdb['error']){if(_0xcf2fdb[_0xfd26('0x12')]['code']===0x1f4){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3c148d,_0xcf2fdb['error']['message']);return _0x3c9154(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}logger[_0xfd26('0x12')](_0xfd26('0xd'),_0x3c148d,_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);return _0x3d405f(_0xcf2fdb[_0xfd26('0x12')][_0xfd26('0x13')]);}else{logger[_0xfd26('0xc')](_0xfd26('0xd'),_0x3c148d,_0xfd26('0xe'));_0x3d405f(_0xcf2fdb[_0xfd26('0x14')][_0xfd26('0x13')]);}})[_0xfd26('0x15')](function(_0x2f9b37){logger['error'](_0xfd26('0xd'),_0x3c148d,_0x2f9b37);_0x3c9154(_0x2f9b37);});});}exports[_0xfd26('0x16')]=function(_0xeb7aeb){var _0x210dd4=this;return new Promise(function(_0x36a275,_0x5b3e8b){return db[_0xfd26('0x17')]['create'](_0xeb7aeb['body'],{'raw':_0xeb7aeb['options']?_0xeb7aeb[_0xfd26('0x18')][_0xfd26('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x523cbe){logger[_0xfd26('0xc')](_0xfd26('0x16'),_0xeb7aeb);logger['debug'](_0xfd26('0x16'),_0xeb7aeb,JSON['stringify'](_0x523cbe));_0x36a275(_0x523cbe);})[_0xfd26('0x15')](function(_0x531bf7){logger[_0xfd26('0x12')]('CreateOpenchannelQueueReport',_0x531bf7[_0xfd26('0x13')],_0xeb7aeb);_0x5b3e8b(_0x210dd4[_0xfd26('0x12')](0x1f4,_0x531bf7['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x1194c2){var _0x4bc02c=this;return new Promise(function(_0x1d62c5,_0xebbab7){return db[_0xfd26('0x17')][_0xfd26('0x1a')](_0x1194c2[_0xfd26('0x1b')],{'raw':_0x1194c2['options']?_0x1194c2[_0xfd26('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')]['where']||null:null,'attributes':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')][_0xfd26('0x1c')]||null:null,'limit':_0x1194c2[_0xfd26('0x18')]?_0x1194c2[_0xfd26('0x18')][_0xfd26('0x1d')]||null:null})[_0xfd26('0x1e')](function(_0x565c0){logger[_0xfd26('0xc')]('UpdateOpenchannelQueueReport',_0x1194c2);logger['debug']('UpdateOpenchannelQueueReport',_0x1194c2,JSON['stringify'](_0x565c0));_0x1d62c5(_0x565c0);})[_0xfd26('0x15')](function(_0x5d0101){logger[_0xfd26('0x12')](_0xfd26('0x1f'),_0x5d0101['message'],_0x1194c2);_0xebbab7(_0x4bc02c['error'](0x1f4,_0x5d0101[_0xfd26('0x13')]));});});};
\ No newline at end of file
+var _0x0abf=['debug','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','then','UpdateOpenchannelQueueReport','where','attributes','limit'];(function(_0x46180a,_0x23483e){var _0x3b3e78=function(_0x18d45c){while(--_0x18d45c){_0x46180a['push'](_0x46180a['shift']());}};_0x3b3e78(++_0x23483e);}(_0x0abf,0xe8));var _0xf0ab=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0abf[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xf0ab('0x0'));var util=require('util');var moment=require(_0xf0ab('0x1'));var BPromise=require(_0xf0ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf0ab('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf0ab('0x4'))(_0xf0ab('0x5'));var config=require(_0xf0ab('0x6'));var jayson=require(_0xf0ab('0x7'));var client=jayson[_0xf0ab('0x8')][_0xf0ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233afe,_0x57ff3b,_0x2c4628){return new BPromise(function(_0x3f7e2b,_0x3ca099){return client[_0xf0ab('0xa')](_0x233afe,_0x2c4628)['then'](function(_0x472508){logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,'request\x20sent');logger['debug'](_0xf0ab('0xd'),_0x57ff3b,'request\x20sent',JSON[_0xf0ab('0xe')](_0x472508));if(_0x472508[_0xf0ab('0xf')]){if(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x10')]===0x1f4){logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')]['message']);return _0x3ca099(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}logger[_0xf0ab('0xf')](_0xf0ab('0xc'),_0x57ff3b,_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);return _0x3f7e2b(_0x472508[_0xf0ab('0xf')][_0xf0ab('0x11')]);}else{logger[_0xf0ab('0xb')](_0xf0ab('0xc'),_0x57ff3b,_0xf0ab('0x12'));_0x3f7e2b(_0x472508[_0xf0ab('0x13')][_0xf0ab('0x11')]);}})[_0xf0ab('0x14')](function(_0x230f40){logger['error'](_0xf0ab('0xc'),_0x57ff3b,_0x230f40);_0x3ca099(_0x230f40);});});}exports[_0xf0ab('0x15')]=function(_0x1803f0){var _0x1ffeb5=this;return new Promise(function(_0x776619,_0xb9a33){return db[_0xf0ab('0x16')][_0xf0ab('0x17')](_0x1803f0[_0xf0ab('0x18')],{'raw':_0x1803f0[_0xf0ab('0x19')]?_0x1803f0[_0xf0ab('0x19')][_0xf0ab('0x1a')]===undefined?!![]:![]:!![]})[_0xf0ab('0x1b')](function(_0x22a205){logger[_0xf0ab('0xb')](_0xf0ab('0x15'),_0x1803f0);logger['debug'](_0xf0ab('0x15'),_0x1803f0,JSON[_0xf0ab('0xe')](_0x22a205));_0x776619(_0x22a205);})[_0xf0ab('0x14')](function(_0x11ab3a){logger[_0xf0ab('0xf')](_0xf0ab('0x15'),_0x11ab3a[_0xf0ab('0x11')],_0x1803f0);_0xb9a33(_0x1ffeb5[_0xf0ab('0xf')](0x1f4,_0x11ab3a[_0xf0ab('0x11')]));});});};exports[_0xf0ab('0x1c')]=function(_0x43119f){var _0x5645b2=this;return new Promise(function(_0x585841,_0x4eee21){return db[_0xf0ab('0x16')]['update'](_0x43119f[_0xf0ab('0x18')],{'raw':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43119f[_0xf0ab('0x19')]?_0x43119f[_0xf0ab('0x19')][_0xf0ab('0x1d')]||null:null,'attributes':_0x43119f[_0xf0ab('0x19')]?_0x43119f['options'][_0xf0ab('0x1e')]||null:null,'limit':_0x43119f['options']?_0x43119f['options'][_0xf0ab('0x1f')]||null:null})[_0xf0ab('0x1b')](function(_0x1b223d){logger[_0xf0ab('0xb')](_0xf0ab('0x1c'),_0x43119f);logger[_0xf0ab('0x20')](_0xf0ab('0x1c'),_0x43119f,JSON[_0xf0ab('0xe')](_0x1b223d));_0x585841(_0x1b223d);})[_0xf0ab('0x14')](function(_0x2f0fcd){logger[_0xf0ab('0xf')](_0xf0ab('0x1c'),_0x2f0fcd['message'],_0x43119f);_0x4eee21(_0x5645b2[_0xf0ab('0xf')](0x1f4,_0x2f0fcd[_0xf0ab('0x11')]));});});};
\ No newline at end of file
index 4dc066a..cea00f8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa3a9=['./openchannelTransferReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','update','/:id','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0xa3a9,0x12b));var _0x9a3a=function(_0x281f55,_0x34d3ef){_0x281f55=_0x281f55-0x0;var _0x5eef7b=_0xa3a9[_0x281f55];return _0x5eef7b;};'use strict';var multer=require(_0x9a3a('0x0'));var util=require(_0x9a3a('0x1'));var path=require('path');var timeout=require(_0x9a3a('0x2'));var express=require(_0x9a3a('0x3'));var router=express[_0x9a3a('0x4')]();var fs_extra=require(_0x9a3a('0x5'));var auth=require(_0x9a3a('0x6'));var interaction=require(_0x9a3a('0x7'));var config=require(_0x9a3a('0x8'));var controller=require(_0x9a3a('0x9'));router[_0x9a3a('0xa')]('/',auth[_0x9a3a('0xb')](),controller[_0x9a3a('0xc')]);router[_0x9a3a('0xa')](_0x9a3a('0xd'),auth['isAuthenticated'](),controller[_0x9a3a('0xe')]);router['get']('/:id',auth[_0x9a3a('0xb')](),controller[_0x9a3a('0xf')]);router[_0x9a3a('0x10')]('/',auth[_0x9a3a('0xb')](),controller[_0x9a3a('0x11')]);router[_0x9a3a('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x9a3a('0x13')]);router['delete'](_0x9a3a('0x14'),auth[_0x9a3a('0xb')](),controller[_0x9a3a('0x15')]);module['exports']=router;
\ No newline at end of file
+var _0xa473=['./openchannelTransferReport.controller','isAuthenticated','index','get','describe','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x409ec0,_0x58b73e){var _0x58cec3=function(_0x89a210){while(--_0x89a210){_0x409ec0['push'](_0x409ec0['shift']());}};_0x58cec3(++_0x58b73e);}(_0xa473,0xab));var _0x3a47=function(_0x31617f,_0x6d7afa){_0x31617f=_0x31617f-0x0;var _0x38db34=_0xa473[_0x31617f];return _0x38db34;};'use strict';var multer=require(_0x3a47('0x0'));var util=require(_0x3a47('0x1'));var path=require(_0x3a47('0x2'));var timeout=require(_0x3a47('0x3'));var express=require(_0x3a47('0x4'));var router=express[_0x3a47('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3a47('0x6'));var interaction=require(_0x3a47('0x7'));var config=require(_0x3a47('0x8'));var controller=require(_0x3a47('0x9'));router['get']('/',auth[_0x3a47('0xa')](),controller[_0x3a47('0xb')]);router[_0x3a47('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x3a47('0xd')]);router[_0x3a47('0xc')](_0x3a47('0xe'),auth[_0x3a47('0xa')](),controller['show']);router[_0x3a47('0xf')]('/',auth[_0x3a47('0xa')](),controller['create']);router[_0x3a47('0x10')]('/:id',auth[_0x3a47('0xa')](),controller['update']);router[_0x3a47('0x11')]('/:id',auth[_0x3a47('0xa')](),controller[_0x3a47('0x12')]);module[_0x3a47('0x13')]=router;
\ No newline at end of file
index a83b902..d195a66 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x222127,_0x574b09){var _0xb81096=function(_0x50e7e9){while(--_0x50e7e9){_0x222127['push'](_0x222127['shift']());}};_0xb81096(++_0x574b09);}(_0x70e0,0x17b));var _0x070e=function(_0x141cf2,_0x36b3c1){_0x141cf2=_0x141cf2-0x0;var _0x4e96e6=_0x70e0[_0x141cf2];return _0x4e96e6;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}};
\ No newline at end of file
+var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0xa4b2cf,_0x68a28){var _0xf1584a=function(_0x30e8e6){while(--_0x30e8e6){_0xa4b2cf['push'](_0xa4b2cf['shift']());}};_0xf1584a(++_0x68a28);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}};
\ No newline at end of file
index 68eacf5..56e09b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4a1=['model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','OpenchannelTransferReport','includeAll','include','rows','show','params','find','catch','create','update','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','save','then','error','name','send','index','map','rawAttributes','fieldName','key'];(function(_0x1127da,_0x43edf9){var _0x88eece=function(_0x5e0d45){while(--_0x5e0d45){_0x1127da['push'](_0x1127da['shift']());}};_0x88eece(++_0x43edf9);}(_0xc4a1,0x104));var _0x1c4a=function(_0x5a1533,_0x1dc425){_0x5a1533=_0x5a1533-0x0;var _0x3fba08=_0xc4a1[_0x5a1533];return _0x3fba08;};'use strict';var emlformat=require(_0x1c4a('0x0'));var rimraf=require(_0x1c4a('0x1'));var zipdir=require(_0x1c4a('0x2'));var jsonpatch=require(_0x1c4a('0x3'));var rp=require(_0x1c4a('0x4'));var moment=require('moment');var BPromise=require(_0x1c4a('0x5'));var Mustache=require(_0x1c4a('0x6'));var util=require('util');var path=require(_0x1c4a('0x7'));var sox=require(_0x1c4a('0x8'));var csv=require(_0x1c4a('0x9'));var ejs=require(_0x1c4a('0xa'));var fs=require('fs');var fs_extra=require(_0x1c4a('0xb'));var _=require(_0x1c4a('0xc'));var squel=require(_0x1c4a('0xd'));var crypto=require(_0x1c4a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1c4a('0xf'));var toCsv=require(_0x1c4a('0x9'));var querystring=require(_0x1c4a('0x10'));var Papa=require('papaparse');var Redis=require(_0x1c4a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1c4a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c4a('0x13'));var logger=require(_0x1c4a('0x14'))('api');var utils=require(_0x1c4a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1c4a('0x16'));var db=require(_0x1c4a('0x17'))['db'];function respondWithStatusCode(_0x24bcd4,_0x46b751){_0x46b751=_0x46b751||0xcc;return function(_0x44e35d){if(_0x44e35d){return _0x24bcd4[_0x1c4a('0x18')](_0x46b751);}return _0x24bcd4[_0x1c4a('0x19')](_0x46b751)[_0x1c4a('0x1a')]();};}function respondWithResult(_0x40341a,_0x2acab5){_0x2acab5=_0x2acab5||0xc8;return function(_0x32f485){if(_0x32f485){return _0x40341a[_0x1c4a('0x19')](_0x2acab5)['json'](_0x32f485);}};}function respondWithFilteredResult(_0xbf2374,_0x4e87ef){return function(_0x4d4836){if(_0x4d4836){var _0x49f16a=typeof _0x4e87ef[_0x1c4a('0x1b')]===_0x1c4a('0x1c')&&typeof _0x4e87ef['limit']===_0x1c4a('0x1c');var _0x104673=_0x4d4836[_0x1c4a('0x1d')];var _0x162b5e=_0x49f16a?0x0:_0x4e87ef['offset'];var _0x141958=_0x49f16a?_0x4d4836[_0x1c4a('0x1d')]:_0x4e87ef[_0x1c4a('0x1b')]+_0x4e87ef[_0x1c4a('0x1e')];var _0x35ed37;if(_0x141958>=_0x104673){_0x141958=_0x104673;_0x35ed37=0xc8;}else{_0x35ed37=0xce;}_0xbf2374[_0x1c4a('0x19')](_0x35ed37);return _0xbf2374[_0x1c4a('0x1f')]('Content-Range',_0x162b5e+'-'+_0x141958+'/'+_0x104673)[_0x1c4a('0x20')](_0x4d4836);}return null;};}function patchUpdates(_0x4b7e9f){return function(_0xe0a7c9){try{jsonpatch[_0x1c4a('0x21')](_0xe0a7c9,_0x4b7e9f,!![]);}catch(_0x2ad1d7){return BPromise['reject'](_0x2ad1d7);}return _0xe0a7c9[_0x1c4a('0x22')]();};}function saveUpdates(_0x2a09cb,_0x4d830e){return function(_0xf1dc80){if(_0xf1dc80){return _0xf1dc80['update'](_0x2a09cb)[_0x1c4a('0x23')](function(_0x41f71c){return _0x41f71c;});}return null;};}function removeEntity(_0x3bee12,_0x21b40e){return function(_0x238574){if(_0x238574){return _0x238574['destroy']()[_0x1c4a('0x23')](function(){_0x3bee12[_0x1c4a('0x19')](0xcc)[_0x1c4a('0x1a')]();});}};}function handleEntityNotFound(_0x4e43c7,_0x20c846){return function(_0x2f33c7){if(!_0x2f33c7){_0x4e43c7['sendStatus'](0x194);}return _0x2f33c7;};}function handleError(_0x263f07,_0xc516a0){_0xc516a0=_0xc516a0||0x1f4;return function(_0x36d56f){logger[_0x1c4a('0x24')](_0x36d56f['stack']);if(_0x36d56f[_0x1c4a('0x25')]){delete _0x36d56f[_0x1c4a('0x25')];}_0x263f07[_0x1c4a('0x19')](_0xc516a0)[_0x1c4a('0x26')](_0x36d56f);};}exports[_0x1c4a('0x27')]=function(_0x10f34e,_0xca5fa6){var _0xa94127={},_0x580a0d={},_0x5bef75={'count':0x0,'rows':[]};var _0x5c7864=_[_0x1c4a('0x28')](db['OpenchannelTransferReport'][_0x1c4a('0x29')],function(_0x2aee06){return{'name':_0x2aee06[_0x1c4a('0x2a')],'type':_0x2aee06['type'][_0x1c4a('0x2b')]};});_0x580a0d[_0x1c4a('0x2c')]=_[_0x1c4a('0x28')](_0x5c7864,_0x1c4a('0x25'));_0x580a0d[_0x1c4a('0x2d')]=_[_0x1c4a('0x2e')](_0x10f34e[_0x1c4a('0x2d')]);_0x580a0d[_0x1c4a('0x2f')]=_[_0x1c4a('0x30')](_0x580a0d[_0x1c4a('0x2c')],_0x580a0d[_0x1c4a('0x2d')]);_0xa94127[_0x1c4a('0x31')]=_[_0x1c4a('0x30')](_0x580a0d[_0x1c4a('0x2c')],qs[_0x1c4a('0x32')](_0x10f34e[_0x1c4a('0x2d')]['fields']));_0xa94127[_0x1c4a('0x31')]=_0xa94127[_0x1c4a('0x31')][_0x1c4a('0x33')]?_0xa94127['attributes']:_0x580a0d['model'];if(!_0x10f34e[_0x1c4a('0x2d')][_0x1c4a('0x34')](_0x1c4a('0x35'))){_0xa94127[_0x1c4a('0x1e')]=qs[_0x1c4a('0x1e')](_0x10f34e['query']['limit']);_0xa94127[_0x1c4a('0x1b')]=qs[_0x1c4a('0x1b')](_0x10f34e['query'][_0x1c4a('0x1b')]);}_0xa94127[_0x1c4a('0x36')]=qs[_0x1c4a('0x37')](_0x10f34e[_0x1c4a('0x2d')]['sort']);_0xa94127[_0x1c4a('0x38')]=qs[_0x1c4a('0x2f')](_[_0x1c4a('0x39')](_0x10f34e[_0x1c4a('0x2d')],_0x580a0d[_0x1c4a('0x2f')]),_0x5c7864);if(_0x10f34e[_0x1c4a('0x2d')]['filter']){_0xa94127['where']=_[_0x1c4a('0x3a')](_0xa94127['where'],{'$or':_['map'](_0x5c7864,function(_0x1160b2){if(_0x1160b2[_0x1c4a('0x3b')]!==_0x1c4a('0x3c')){var _0x4e8f9e={};_0x4e8f9e[_0x1160b2['name']]={'$like':'%'+_0x10f34e[_0x1c4a('0x2d')][_0x1c4a('0x3d')]+'%'};return _0x4e8f9e;}})});}_0xa94127=_['merge']({},_0xa94127,_0x10f34e[_0x1c4a('0x3e')]);var _0x1bb01b={'where':_0xa94127[_0x1c4a('0x38')]};return db[_0x1c4a('0x3f')][_0x1c4a('0x1d')](_0x1bb01b)['then'](function(_0x35947b){_0x5bef75['count']=_0x35947b;if(_0x10f34e[_0x1c4a('0x2d')][_0x1c4a('0x40')]){_0xa94127[_0x1c4a('0x41')]=[{'all':!![]}];}return db[_0x1c4a('0x3f')]['findAll'](_0xa94127);})[_0x1c4a('0x23')](function(_0x5c4517){_0x5bef75[_0x1c4a('0x42')]=_0x5c4517;return _0x5bef75;})['then'](respondWithFilteredResult(_0xca5fa6,_0xa94127))['catch'](handleError(_0xca5fa6,null));};exports[_0x1c4a('0x43')]=function(_0x5c54f7,_0x326bb0){var _0x218cbe={'raw':!![],'where':{'id':_0x5c54f7[_0x1c4a('0x44')]['id']}},_0x1ef526={};_0x1ef526['model']=_[_0x1c4a('0x2e')](db[_0x1c4a('0x3f')]['rawAttributes']);_0x1ef526[_0x1c4a('0x2d')]=_[_0x1c4a('0x2e')](_0x5c54f7[_0x1c4a('0x2d')]);_0x1ef526[_0x1c4a('0x2f')]=_[_0x1c4a('0x30')](_0x1ef526[_0x1c4a('0x2c')],_0x1ef526['query']);_0x218cbe[_0x1c4a('0x31')]=_[_0x1c4a('0x30')](_0x1ef526['model'],qs[_0x1c4a('0x32')](_0x5c54f7[_0x1c4a('0x2d')][_0x1c4a('0x32')]));_0x218cbe[_0x1c4a('0x31')]=_0x218cbe[_0x1c4a('0x31')][_0x1c4a('0x33')]?_0x218cbe[_0x1c4a('0x31')]:_0x1ef526[_0x1c4a('0x2c')];if(_0x5c54f7[_0x1c4a('0x2d')]['includeAll']){_0x218cbe[_0x1c4a('0x41')]=[{'all':!![]}];}_0x218cbe=_['merge']({},_0x218cbe,_0x5c54f7[_0x1c4a('0x3e')]);return db[_0x1c4a('0x3f')][_0x1c4a('0x45')](_0x218cbe)[_0x1c4a('0x23')](handleEntityNotFound(_0x326bb0,null))[_0x1c4a('0x23')](respondWithResult(_0x326bb0,null))[_0x1c4a('0x46')](handleError(_0x326bb0,null));};exports[_0x1c4a('0x47')]=function(_0x11856e,_0x37f39a){return db['OpenchannelTransferReport'][_0x1c4a('0x47')](_0x11856e['body'],{})[_0x1c4a('0x23')](respondWithResult(_0x37f39a,0xc9))[_0x1c4a('0x46')](handleError(_0x37f39a,null));};exports[_0x1c4a('0x48')]=function(_0x1890f7,_0x2b5047){if(_0x1890f7[_0x1c4a('0x49')]['id']){delete _0x1890f7['body']['id'];}return db[_0x1c4a('0x3f')][_0x1c4a('0x45')]({'where':{'id':_0x1890f7[_0x1c4a('0x44')]['id']}})[_0x1c4a('0x23')](handleEntityNotFound(_0x2b5047,null))[_0x1c4a('0x23')](saveUpdates(_0x1890f7[_0x1c4a('0x49')],null))[_0x1c4a('0x23')](respondWithResult(_0x2b5047,null))[_0x1c4a('0x46')](handleError(_0x2b5047,null));};exports[_0x1c4a('0x4a')]=function(_0x1aafa6,_0x5e1b58){return db[_0x1c4a('0x3f')]['find']({'where':{'id':_0x1aafa6[_0x1c4a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5e1b58,null))[_0x1c4a('0x23')](removeEntity(_0x5e1b58,null))[_0x1c4a('0x46')](handleError(_0x5e1b58,null));};exports[_0x1c4a('0x4b')]=function(_0x16f62e,_0x525adc){return db[_0x1c4a('0x3f')]['describe']()[_0x1c4a('0x23')](respondWithResult(_0x525adc,null))['catch'](handleError(_0x525adc,null));};
\ No newline at end of file
+var _0x0a9f=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','include','findAll','rows','show','params','keys','includeAll','find','create','body','catch','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x0a9f,0x169));var _0xf0a9=function(_0x31ead7,_0x2e9a7c){_0x31ead7=_0x31ead7-0x0;var _0x3516f0=_0x0a9f[_0x31ead7];return _0x3516f0;};'use strict';var emlformat=require(_0xf0a9('0x0'));var rimraf=require(_0xf0a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf0a9('0x2'));var rp=require(_0xf0a9('0x3'));var moment=require('moment');var BPromise=require(_0xf0a9('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf0a9('0x5'));var csv=require(_0xf0a9('0x6'));var ejs=require(_0xf0a9('0x7'));var fs=require('fs');var fs_extra=require(_0xf0a9('0x8'));var _=require(_0xf0a9('0x9'));var squel=require(_0xf0a9('0xa'));var crypto=require('crypto');var jsforce=require(_0xf0a9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf0a9('0x6'));var querystring=require(_0xf0a9('0xc'));var Papa=require(_0xf0a9('0xd'));var Redis=require(_0xf0a9('0xe'));var authService=require(_0xf0a9('0xf'));var qs=require(_0xf0a9('0x10'));var as=require(_0xf0a9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0a9('0x12'))(_0xf0a9('0x13'));var utils=require(_0xf0a9('0x14'));var config=require(_0xf0a9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf0a9('0x16'))['db'];function respondWithStatusCode(_0x18e3de,_0xd43694){_0xd43694=_0xd43694||0xcc;return function(_0x4e0a8d){if(_0x4e0a8d){return _0x18e3de[_0xf0a9('0x17')](_0xd43694);}return _0x18e3de['status'](_0xd43694)['end']();};}function respondWithResult(_0x41c465,_0xb3e18c){_0xb3e18c=_0xb3e18c||0xc8;return function(_0x35eda8){if(_0x35eda8){return _0x41c465[_0xf0a9('0x18')](_0xb3e18c)['json'](_0x35eda8);}};}function respondWithFilteredResult(_0x1bb15b,_0x25d786){return function(_0x1b86f6){if(_0x1b86f6){var _0x45888a=typeof _0x25d786[_0xf0a9('0x19')]===_0xf0a9('0x1a')&&typeof _0x25d786[_0xf0a9('0x1b')]==='undefined';var _0x1023d3=_0x1b86f6[_0xf0a9('0x1c')];var _0x765a36=_0x45888a?0x0:_0x25d786['offset'];var _0x13926a=_0x45888a?_0x1b86f6[_0xf0a9('0x1c')]:_0x25d786[_0xf0a9('0x19')]+_0x25d786[_0xf0a9('0x1b')];var _0x2f2d10;if(_0x13926a>=_0x1023d3){_0x13926a=_0x1023d3;_0x2f2d10=0xc8;}else{_0x2f2d10=0xce;}_0x1bb15b[_0xf0a9('0x18')](_0x2f2d10);return _0x1bb15b[_0xf0a9('0x1d')](_0xf0a9('0x1e'),_0x765a36+'-'+_0x13926a+'/'+_0x1023d3)[_0xf0a9('0x1f')](_0x1b86f6);}return null;};}function patchUpdates(_0x483f26){return function(_0x5fff6e){try{jsonpatch[_0xf0a9('0x20')](_0x5fff6e,_0x483f26,!![]);}catch(_0x56f08a){return BPromise[_0xf0a9('0x21')](_0x56f08a);}return _0x5fff6e['save']();};}function saveUpdates(_0x5ca62e,_0x3f4916){return function(_0x885dbd){if(_0x885dbd){return _0x885dbd[_0xf0a9('0x22')](_0x5ca62e)[_0xf0a9('0x23')](function(_0x1aff44){return _0x1aff44;});}return null;};}function removeEntity(_0x117814,_0x3dd01d){return function(_0x4b45e6){if(_0x4b45e6){return _0x4b45e6[_0xf0a9('0x24')]()[_0xf0a9('0x23')](function(){_0x117814[_0xf0a9('0x18')](0xcc)[_0xf0a9('0x25')]();});}};}function handleEntityNotFound(_0x1bb070,_0x137012){return function(_0x1697b4){if(!_0x1697b4){_0x1bb070[_0xf0a9('0x17')](0x194);}return _0x1697b4;};}function handleError(_0x572316,_0x404074){_0x404074=_0x404074||0x1f4;return function(_0x46377e){logger[_0xf0a9('0x26')](_0x46377e[_0xf0a9('0x27')]);if(_0x46377e[_0xf0a9('0x28')]){delete _0x46377e[_0xf0a9('0x28')];}_0x572316['status'](_0x404074)[_0xf0a9('0x29')](_0x46377e);};}exports[_0xf0a9('0x2a')]=function(_0x2b7413,_0x24d4b8){var _0x1f2477={},_0x1407c1={},_0x2f0472={'count':0x0,'rows':[]};var _0x1f624f=_[_0xf0a9('0x2b')](db[_0xf0a9('0x2c')][_0xf0a9('0x2d')],function(_0x1f92eb){return{'name':_0x1f92eb['fieldName'],'type':_0x1f92eb['type'][_0xf0a9('0x2e')]};});_0x1407c1[_0xf0a9('0x2f')]=_[_0xf0a9('0x2b')](_0x1f624f,'name');_0x1407c1[_0xf0a9('0x30')]=_['keys'](_0x2b7413[_0xf0a9('0x30')]);_0x1407c1[_0xf0a9('0x31')]=_[_0xf0a9('0x32')](_0x1407c1[_0xf0a9('0x2f')],_0x1407c1['query']);_0x1f2477[_0xf0a9('0x33')]=_[_0xf0a9('0x32')](_0x1407c1[_0xf0a9('0x2f')],qs['fields'](_0x2b7413['query'][_0xf0a9('0x34')]));_0x1f2477[_0xf0a9('0x33')]=_0x1f2477['attributes'][_0xf0a9('0x35')]?_0x1f2477[_0xf0a9('0x33')]:_0x1407c1[_0xf0a9('0x2f')];if(!_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x36')](_0xf0a9('0x37'))){_0x1f2477[_0xf0a9('0x1b')]=qs['limit'](_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x1b')]);_0x1f2477[_0xf0a9('0x19')]=qs[_0xf0a9('0x19')](_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x19')]);}_0x1f2477[_0xf0a9('0x38')]=qs[_0xf0a9('0x39')](_0x2b7413['query'][_0xf0a9('0x39')]);_0x1f2477[_0xf0a9('0x3a')]=qs[_0xf0a9('0x31')](_[_0xf0a9('0x3b')](_0x2b7413['query'],_0x1407c1[_0xf0a9('0x31')]),_0x1f624f);if(_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x3c')]){_0x1f2477[_0xf0a9('0x3a')]=_['merge'](_0x1f2477[_0xf0a9('0x3a')],{'$or':_[_0xf0a9('0x2b')](_0x1f624f,function(_0x435679){if(_0x435679[_0xf0a9('0x3d')]!=='VIRTUAL'){var _0x76bc7a={};_0x76bc7a[_0x435679[_0xf0a9('0x28')]]={'$like':'%'+_0x2b7413[_0xf0a9('0x30')][_0xf0a9('0x3c')]+'%'};return _0x76bc7a;}})});}_0x1f2477=_[_0xf0a9('0x3e')]({},_0x1f2477,_0x2b7413[_0xf0a9('0x3f')]);var _0x2e9b2d={'where':_0x1f2477[_0xf0a9('0x3a')]};return db[_0xf0a9('0x2c')][_0xf0a9('0x1c')](_0x2e9b2d)[_0xf0a9('0x23')](function(_0x523329){_0x2f0472[_0xf0a9('0x1c')]=_0x523329;if(_0x2b7413[_0xf0a9('0x30')]['includeAll']){_0x1f2477[_0xf0a9('0x40')]=[{'all':!![]}];}return db[_0xf0a9('0x2c')][_0xf0a9('0x41')](_0x1f2477);})[_0xf0a9('0x23')](function(_0x15a6ef){_0x2f0472[_0xf0a9('0x42')]=_0x15a6ef;return _0x2f0472;})['then'](respondWithFilteredResult(_0x24d4b8,_0x1f2477))['catch'](handleError(_0x24d4b8,null));};exports[_0xf0a9('0x43')]=function(_0x5ca41d,_0x3c3ca0){var _0x779bd0={'raw':!![],'where':{'id':_0x5ca41d[_0xf0a9('0x44')]['id']}},_0x147044={};_0x147044['model']=_[_0xf0a9('0x45')](db['OpenchannelTransferReport'][_0xf0a9('0x2d')]);_0x147044[_0xf0a9('0x30')]=_['keys'](_0x5ca41d[_0xf0a9('0x30')]);_0x147044[_0xf0a9('0x31')]=_[_0xf0a9('0x32')](_0x147044[_0xf0a9('0x2f')],_0x147044[_0xf0a9('0x30')]);_0x779bd0[_0xf0a9('0x33')]=_[_0xf0a9('0x32')](_0x147044[_0xf0a9('0x2f')],qs['fields'](_0x5ca41d[_0xf0a9('0x30')][_0xf0a9('0x34')]));_0x779bd0['attributes']=_0x779bd0[_0xf0a9('0x33')][_0xf0a9('0x35')]?_0x779bd0[_0xf0a9('0x33')]:_0x147044['model'];if(_0x5ca41d[_0xf0a9('0x30')][_0xf0a9('0x46')]){_0x779bd0['include']=[{'all':!![]}];}_0x779bd0=_[_0xf0a9('0x3e')]({},_0x779bd0,_0x5ca41d[_0xf0a9('0x3f')]);return db['OpenchannelTransferReport'][_0xf0a9('0x47')](_0x779bd0)[_0xf0a9('0x23')](handleEntityNotFound(_0x3c3ca0,null))['then'](respondWithResult(_0x3c3ca0,null))['catch'](handleError(_0x3c3ca0,null));};exports[_0xf0a9('0x48')]=function(_0x490930,_0x5aac7){return db[_0xf0a9('0x2c')][_0xf0a9('0x48')](_0x490930['body'],{})['then'](respondWithResult(_0x5aac7,0xc9))['catch'](handleError(_0x5aac7,null));};exports[_0xf0a9('0x22')]=function(_0x484e43,_0x90ed07){if(_0x484e43[_0xf0a9('0x49')]['id']){delete _0x484e43['body']['id'];}return db[_0xf0a9('0x2c')]['find']({'where':{'id':_0x484e43[_0xf0a9('0x44')]['id']}})[_0xf0a9('0x23')](handleEntityNotFound(_0x90ed07,null))[_0xf0a9('0x23')](saveUpdates(_0x484e43[_0xf0a9('0x49')],null))[_0xf0a9('0x23')](respondWithResult(_0x90ed07,null))[_0xf0a9('0x4a')](handleError(_0x90ed07,null));};exports[_0xf0a9('0x24')]=function(_0x263308,_0x484b42){return db[_0xf0a9('0x2c')][_0xf0a9('0x47')]({'where':{'id':_0x263308['params']['id']}})['then'](handleEntityNotFound(_0x484b42,null))['then'](removeEntity(_0x484b42,null))[_0xf0a9('0x4a')](handleError(_0x484b42,null));};exports[_0xf0a9('0x4b')]=function(_0x3616bd,_0x338643){return db[_0xf0a9('0x2c')][_0xf0a9('0x4b')]()['then'](respondWithResult(_0x338643,null))['catch'](handleError(_0x338643,null));};
\ No newline at end of file
index 53bd92a..d42d0aa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdd04=['../../config/environment','OpenchannelTransferReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdd04,0x134));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4dd0('0x0'));var util=require('util');var logger=require(_0x4dd0('0x1'))(_0x4dd0('0x2'));var moment=require(_0x4dd0('0x3'));var BPromise=require(_0x4dd0('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4dd0('0x5'));var rimraf=require(_0x4dd0('0x6'));var config=require(_0x4dd0('0x7'));var attributes=require('./openchannelTransferReport.attributes');module['exports']=function(_0x5978de,_0x4faca2){return _0x5978de['define'](_0x4dd0('0x8'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0x78bb=['bluebird','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x78bb,0x1e4));var _0xb78b=function(_0x1e5cc3,_0x238a87){_0x1e5cc3=_0x1e5cc3-0x0;var _0x15c596=_0x78bb[_0x1e5cc3];return _0x15c596;};'use strict';var _=require(_0xb78b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb78b('0x1'));var moment=require('moment');var BPromise=require(_0xb78b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb78b('0x3'));var attributes=require(_0xb78b('0x4'));module['exports']=function(_0x579947,_0x59297e){return _0x579947[_0xb78b('0x5')](_0xb78b('0x6'),attributes,{'tableName':_0xb78b('0x7'),'paranoid':![],'indexes':[{'name':_0xb78b('0x8'),'fields':[_0xb78b('0x8')]}],'timestamps':!![]});};
\ No newline at end of file
index 082b0dc..0948a5f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6eed=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6eed,0xff));var _0xd6ee=function(_0xe69141,_0x554822){_0xe69141=_0xe69141-0x0;var _0x214e55=_0x6eed[_0xe69141];return _0x214e55;};'use strict';var _=require(_0xd6ee('0x0'));var util=require(_0xd6ee('0x1'));var moment=require(_0xd6ee('0x2'));var BPromise=require(_0xd6ee('0x3'));var rs=require(_0xd6ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6ee('0x5'))['db'];var utils=require(_0xd6ee('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xd6ee('0x7'));var jayson=require(_0xd6ee('0x8'));var client=jayson[_0xd6ee('0x9')][_0xd6ee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10c1d7,_0x48a812,_0x514dc3){return new BPromise(function(_0x2e6369,_0x5134ea){return client['request'](_0x10c1d7,_0x514dc3)['then'](function(_0x2c4f23){logger[_0xd6ee('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48a812,_0xd6ee('0xc'));logger[_0xd6ee('0xd')](_0xd6ee('0xe'),_0x48a812,_0xd6ee('0xc'),JSON['stringify'](_0x2c4f23));if(_0x2c4f23[_0xd6ee('0xf')]){if(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x10')]===0x1f4){logger[_0xd6ee('0xf')](_0xd6ee('0x11'),_0x48a812,_0x2c4f23[_0xd6ee('0xf')]['message']);return _0x5134ea(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);}logger['error'](_0xd6ee('0x11'),_0x48a812,_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);return _0x2e6369(_0x2c4f23[_0xd6ee('0xf')][_0xd6ee('0x12')]);}else{logger[_0xd6ee('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x48a812,_0xd6ee('0xc'));_0x2e6369(_0x2c4f23[_0xd6ee('0x13')][_0xd6ee('0x12')]);}})['catch'](function(_0x3196c0){logger['error'](_0xd6ee('0x11'),_0x48a812,_0x3196c0);_0x5134ea(_0x3196c0);});});}
\ No newline at end of file
+var _0x3e9d=['info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x32faaf,_0x2ed4a6){var _0x213374=function(_0x4dde79){while(--_0x4dde79){_0x32faaf['push'](_0x32faaf['shift']());}};_0x213374(++_0x2ed4a6);}(_0x3e9d,0x1ba));var _0xd3e9=function(_0x307655,_0x182c2e){_0x307655=_0x307655-0x0;var _0x17e2ae=_0x3e9d[_0x307655];return _0x17e2ae;};'use strict';var _=require(_0xd3e9('0x0'));var util=require(_0xd3e9('0x1'));var moment=require('moment');var BPromise=require(_0xd3e9('0x2'));var rs=require(_0xd3e9('0x3'));var fs=require('fs');var Redis=require(_0xd3e9('0x4'));var db=require(_0xd3e9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd3e9('0x6'));var config=require(_0xd3e9('0x7'));var jayson=require(_0xd3e9('0x8'));var client=jayson[_0xd3e9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc1de,_0x17f2b0,_0x140f2d){return new BPromise(function(_0x45364e,_0x3025f9){return client[_0xd3e9('0xa')](_0x4dc1de,_0x140f2d)[_0xd3e9('0xb')](function(_0x2944cd){logger['info'](_0xd3e9('0xc'),_0x17f2b0,_0xd3e9('0xd'));logger[_0xd3e9('0xe')](_0xd3e9('0xf'),_0x17f2b0,_0xd3e9('0xd'),JSON[_0xd3e9('0x10')](_0x2944cd));if(_0x2944cd[_0xd3e9('0x11')]){if(_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x12')]===0x1f4){logger[_0xd3e9('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x17f2b0,_0x2944cd[_0xd3e9('0x11')]['message']);return _0x3025f9(_0x2944cd['error']['message']);}logger[_0xd3e9('0x11')](_0xd3e9('0xc'),_0x17f2b0,_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x13')]);return _0x45364e(_0x2944cd[_0xd3e9('0x11')][_0xd3e9('0x13')]);}else{logger[_0xd3e9('0x14')](_0xd3e9('0xc'),_0x17f2b0,_0xd3e9('0xd'));_0x45364e(_0x2944cd['result'][_0xd3e9('0x13')]);}})['catch'](function(_0x8b9e10){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x17f2b0,_0x8b9e10);_0x3025f9(_0x8b9e10);});});}
\ No newline at end of file
index 0eaf3db..54eb014 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ac2=['create','put','update','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x5b1554,_0x37a302){var _0x9371eb=function(_0x56c4ff){while(--_0x56c4ff){_0x5b1554['push'](_0x5b1554['shift']());}};_0x9371eb(++_0x37a302);}(_0x2ac2,0x125));var _0x22ac=function(_0x5a8df5,_0xfe8b28){_0x5a8df5=_0x5a8df5-0x0;var _0x121425=_0x2ac2[_0x5a8df5];return _0x121425;};'use strict';var multer=require('multer');var util=require(_0x22ac('0x0'));var path=require('path');var timeout=require(_0x22ac('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x22ac('0x2'));var interaction=require(_0x22ac('0x3'));var config=require(_0x22ac('0x4'));var controller=require('./pause.controller');router[_0x22ac('0x5')]('/',auth[_0x22ac('0x6')](),controller[_0x22ac('0x7')]);router[_0x22ac('0x5')](_0x22ac('0x8'),auth[_0x22ac('0x6')](),controller[_0x22ac('0x9')]);router[_0x22ac('0xa')]('/',auth['isAuthenticated'](),controller[_0x22ac('0xb')]);router[_0x22ac('0xc')](_0x22ac('0x8'),auth[_0x22ac('0x6')](),controller[_0x22ac('0xd')]);router[_0x22ac('0xe')](_0x22ac('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x22ac('0xf')]=router;
\ No newline at end of file
+var _0x1cd8=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x387862,_0x3c5c4e){var _0x16d405=function(_0x113b00){while(--_0x113b00){_0x387862['push'](_0x387862['shift']());}};_0x16d405(++_0x3c5c4e);}(_0x1cd8,0x198));var _0x81cd=function(_0x373e27,_0x527f8d){_0x373e27=_0x373e27-0x0;var _0x4a336f=_0x1cd8[_0x373e27];return _0x4a336f;};'use strict';var multer=require(_0x81cd('0x0'));var util=require(_0x81cd('0x1'));var path=require(_0x81cd('0x2'));var timeout=require(_0x81cd('0x3'));var express=require(_0x81cd('0x4'));var router=express[_0x81cd('0x5')]();var fs_extra=require(_0x81cd('0x6'));var auth=require(_0x81cd('0x7'));var interaction=require(_0x81cd('0x8'));var config=require(_0x81cd('0x9'));var controller=require('./pause.controller');router[_0x81cd('0xa')]('/',auth[_0x81cd('0xb')](),controller['index']);router[_0x81cd('0xa')](_0x81cd('0xc'),auth[_0x81cd('0xb')](),controller[_0x81cd('0xd')]);router[_0x81cd('0xe')]('/',auth[_0x81cd('0xb')](),controller['create']);router[_0x81cd('0xf')](_0x81cd('0xc'),auth['isAuthenticated'](),controller[_0x81cd('0x10')]);router['delete'](_0x81cd('0xc'),auth[_0x81cd('0xb')](),controller[_0x81cd('0x11')]);module['exports']=router;
\ No newline at end of file
index bbd0e24..2eefede 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x36cd=['STRING','name','sequelize','exports'];(function(_0x42275b,_0x563091){var _0x12dc72=function(_0x14917e){while(--_0x14917e){_0x42275b['push'](_0x42275b['shift']());}};_0x12dc72(++_0x563091);}(_0x36cd,0x10e));var _0xd36c=function(_0x309f89,_0x4dcee4){_0x309f89=_0x309f89-0x0;var _0xbbbf35=_0x36cd[_0x309f89];return _0xbbbf35;};'use strict';var Sequelize=require(_0xd36c('0x0'));module[_0xd36c('0x1')]={'name':{'type':Sequelize[_0xd36c('0x2')],'unique':_0xd36c('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xd612=['sequelize','exports','STRING','name'];(function(_0x1cbc66,_0x1a6273){var _0x4e1a7a=function(_0x2fb4a3){while(--_0x2fb4a3){_0x1cbc66['push'](_0x1cbc66['shift']());}};_0x4e1a7a(++_0x1a6273);}(_0xd612,0x17c));var _0x2d61=function(_0x3f26ba,_0x32c76a){_0x3f26ba=_0x3f26ba-0x0;var _0x59e313=_0xd612[_0x3f26ba];return _0x59e313;};'use strict';var Sequelize=require(_0x2d61('0x0'));module[_0x2d61('0x1')]={'name':{'type':Sequelize[_0x2d61('0x2')],'unique':_0x2d61('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2d61('0x2')]}};
\ No newline at end of file
index 0bf72ca..ef6829b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x138c=['mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','Pauses','error','stack','name','index','Pause','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x138c,0x13b));var _0xc138=function(_0x181940,_0x736556){_0x181940=_0x181940-0x0;var _0x24d158=_0x138c[_0x181940];return _0x24d158;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc138('0x0'));var zipdir=require(_0xc138('0x1'));var jsonpatch=require(_0xc138('0x2'));var rp=require(_0xc138('0x3'));var moment=require(_0xc138('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc138('0x5'));var util=require(_0xc138('0x6'));var path=require(_0xc138('0x7'));var sox=require('sox');var csv=require(_0xc138('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc138('0x9'));var _=require('lodash');var squel=require(_0xc138('0xa'));var crypto=require(_0xc138('0xb'));var jsforce=require(_0xc138('0xc'));var deskjs=require(_0xc138('0xd'));var toCsv=require(_0xc138('0x8'));var querystring=require('querystring');var Papa=require(_0xc138('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc138('0xf'));var as=require(_0xc138('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc138('0x11'));var utils=require(_0xc138('0x12'));var config=require(_0xc138('0x13'));var licenseUtil=require(_0xc138('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38113f,_0x2dd271){_0x2dd271=_0x2dd271||0xcc;return function(_0x573d4f){if(_0x573d4f){return _0x38113f[_0xc138('0x15')](_0x2dd271);}return _0x38113f[_0xc138('0x16')](_0x2dd271)[_0xc138('0x17')]();};}function respondWithResult(_0x50d2a4,_0x154e30){_0x154e30=_0x154e30||0xc8;return function(_0x3813d0){if(_0x3813d0){return _0x50d2a4[_0xc138('0x16')](_0x154e30)[_0xc138('0x18')](_0x3813d0);}};}function respondWithFilteredResult(_0x338483,_0xf6062c){return function(_0x36d2d2){if(_0x36d2d2){var _0x41dc02=typeof _0xf6062c[_0xc138('0x19')]==='undefined'&&typeof _0xf6062c['limit']===_0xc138('0x1a');var _0x3450b4=_0x36d2d2[_0xc138('0x1b')];var _0x41db1c=_0x41dc02?0x0:_0xf6062c['offset'];var _0x36a1e5=_0x41dc02?_0x36d2d2[_0xc138('0x1b')]:_0xf6062c[_0xc138('0x19')]+_0xf6062c[_0xc138('0x1c')];var _0xcbd24e;if(_0x36a1e5>=_0x3450b4){_0x36a1e5=_0x3450b4;_0xcbd24e=0xc8;}else{_0xcbd24e=0xce;}_0x338483[_0xc138('0x16')](_0xcbd24e);return _0x338483[_0xc138('0x1d')](_0xc138('0x1e'),_0x41db1c+'-'+_0x36a1e5+'/'+_0x3450b4)['json'](_0x36d2d2);}return null;};}function patchUpdates(_0x5f0bea){return function(_0x49c0ce){try{jsonpatch[_0xc138('0x1f')](_0x49c0ce,_0x5f0bea,!![]);}catch(_0x5a5cea){return BPromise['reject'](_0x5a5cea);}return _0x49c0ce[_0xc138('0x20')]();};}function saveUpdates(_0x10f20c,_0x50e436){return function(_0x1a635c){if(_0x1a635c){return _0x1a635c[_0xc138('0x21')](_0x10f20c)['then'](function(_0x5dfcb6){return _0x5dfcb6;});}return null;};}function removeEntity(_0x4613b0,_0x34402d){return function(_0x465ade){if(_0x465ade){return _0x465ade['destroy']()[_0xc138('0x22')](function(){var _0x567371=_0x465ade['get']({'plain':!![]});var _0x402dc7=_0xc138('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x402dc7,'resourceId':_0x567371['id']}})[_0xc138('0x22')](function(){return _0x465ade;});})['then'](function(){_0x4613b0[_0xc138('0x16')](0xcc)[_0xc138('0x17')]();});}};}function handleEntityNotFound(_0x5da63d,_0x2c5680){return function(_0x2d962d){if(!_0x2d962d){_0x5da63d[_0xc138('0x15')](0x194);}return _0x2d962d;};}function handleError(_0xc0a3ba,_0x4c932b){_0x4c932b=_0x4c932b||0x1f4;return function(_0x5d77b5){logger[_0xc138('0x24')](_0x5d77b5[_0xc138('0x25')]);if(_0x5d77b5[_0xc138('0x26')]){delete _0x5d77b5[_0xc138('0x26')];}_0xc0a3ba['status'](_0x4c932b)['send'](_0x5d77b5);};}exports[_0xc138('0x27')]=function(_0x3df8b0,_0x24e196){var _0x417c8a={},_0x56847e={},_0xc151ce={'count':0x0,'rows':[]};var _0x21503c=_['map'](db[_0xc138('0x28')]['rawAttributes'],function(_0x3a5a20){return{'name':_0x3a5a20['fieldName'],'type':_0x3a5a20[_0xc138('0x29')][_0xc138('0x2a')]};});_0x56847e[_0xc138('0x2b')]=_['map'](_0x21503c,_0xc138('0x26'));_0x56847e[_0xc138('0x2c')]=_[_0xc138('0x2d')](_0x3df8b0[_0xc138('0x2c')]);_0x56847e['filters']=_[_0xc138('0x2e')](_0x56847e['model'],_0x56847e[_0xc138('0x2c')]);_0x417c8a[_0xc138('0x2f')]=_[_0xc138('0x2e')](_0x56847e[_0xc138('0x2b')],qs[_0xc138('0x30')](_0x3df8b0['query'][_0xc138('0x30')]));_0x417c8a[_0xc138('0x2f')]=_0x417c8a['attributes'][_0xc138('0x31')]?_0x417c8a[_0xc138('0x2f')]:_0x56847e[_0xc138('0x2b')];if(!_0x3df8b0[_0xc138('0x2c')][_0xc138('0x32')]('nolimit')){_0x417c8a[_0xc138('0x1c')]=qs[_0xc138('0x1c')](_0x3df8b0['query'][_0xc138('0x1c')]);_0x417c8a[_0xc138('0x19')]=qs[_0xc138('0x19')](_0x3df8b0[_0xc138('0x2c')]['offset']);}_0x417c8a[_0xc138('0x33')]=qs[_0xc138('0x34')](_0x3df8b0['query'][_0xc138('0x34')]);_0x417c8a[_0xc138('0x35')]=qs[_0xc138('0x36')](_[_0xc138('0x37')](_0x3df8b0['query'],_0x56847e[_0xc138('0x36')]),_0x21503c);if(_0x3df8b0[_0xc138('0x2c')]['filter']){_0x417c8a[_0xc138('0x35')]=_[_0xc138('0x38')](_0x417c8a[_0xc138('0x35')],{'$or':_[_0xc138('0x39')](_0x21503c,function(_0x58656c){if(_0x58656c[_0xc138('0x29')]!==_0xc138('0x3a')){var _0x85415e={};_0x85415e[_0x58656c[_0xc138('0x26')]]={'$like':'%'+_0x3df8b0['query'][_0xc138('0x3b')]+'%'};return _0x85415e;}})});}_0x417c8a=_[_0xc138('0x38')]({},_0x417c8a,_0x3df8b0[_0xc138('0x3c')]);var _0x22444d={'where':_0x417c8a[_0xc138('0x35')]};return db['Pause']['count'](_0x22444d)[_0xc138('0x22')](function(_0x73dd18){_0xc151ce['count']=_0x73dd18;if(_0x3df8b0[_0xc138('0x2c')][_0xc138('0x3d')]){_0x417c8a[_0xc138('0x3e')]=[{'all':!![]}];}return db[_0xc138('0x28')][_0xc138('0x3f')](_0x417c8a);})[_0xc138('0x22')](function(_0x43601f){_0xc151ce[_0xc138('0x40')]=_0x43601f;return _0xc151ce;})[_0xc138('0x22')](respondWithFilteredResult(_0x24e196,_0x417c8a))[_0xc138('0x41')](handleError(_0x24e196,null));};exports[_0xc138('0x42')]=function(_0x7e4d20,_0x6dc9fd){var _0x4ff909={'raw':!![],'where':{'id':_0x7e4d20[_0xc138('0x43')]['id']}},_0x5e19de={};_0x5e19de['model']=_[_0xc138('0x2d')](db[_0xc138('0x28')][_0xc138('0x44')]);_0x5e19de[_0xc138('0x2c')]=_[_0xc138('0x2d')](_0x7e4d20[_0xc138('0x2c')]);_0x5e19de[_0xc138('0x36')]=_[_0xc138('0x2e')](_0x5e19de['model'],_0x5e19de[_0xc138('0x2c')]);_0x4ff909[_0xc138('0x2f')]=_[_0xc138('0x2e')](_0x5e19de[_0xc138('0x2b')],qs['fields'](_0x7e4d20['query'][_0xc138('0x30')]));_0x4ff909[_0xc138('0x2f')]=_0x4ff909[_0xc138('0x2f')][_0xc138('0x31')]?_0x4ff909[_0xc138('0x2f')]:_0x5e19de['model'];if(_0x7e4d20[_0xc138('0x2c')][_0xc138('0x3d')]){_0x4ff909[_0xc138('0x3e')]=[{'all':!![]}];}_0x4ff909=_[_0xc138('0x38')]({},_0x4ff909,_0x7e4d20['options']);return db[_0xc138('0x28')][_0xc138('0x45')](_0x4ff909)[_0xc138('0x22')](handleEntityNotFound(_0x6dc9fd,null))[_0xc138('0x22')](respondWithResult(_0x6dc9fd,null))[_0xc138('0x41')](handleError(_0x6dc9fd,null));};exports[_0xc138('0x46')]=function(_0x40c85c,_0x227737){return db[_0xc138('0x28')]['create'](_0x40c85c[_0xc138('0x47')],{})[_0xc138('0x22')](function(_0x92ff7b){var _0x402f0f=_0x40c85c[_0xc138('0x48')][_0xc138('0x49')]({'plain':!![]});if(!_0x402f0f)throw new Error(_0xc138('0x4a'));if(_0x402f0f[_0xc138('0x4b')]===_0xc138('0x48')){var _0xbec79c=_0x92ff7b[_0xc138('0x49')]({'plain':!![]});var _0x54d6bf='Pauses';return db[_0xc138('0x4c')][_0xc138('0x45')]({'where':{'name':_0x54d6bf,'userProfileId':_0x402f0f[_0xc138('0x4d')]},'raw':!![]})['then'](function(_0x1685fe){if(_0x1685fe&&_0x1685fe['autoAssociation']===0x0){return db[_0xc138('0x4e')][_0xc138('0x46')]({'name':_0xbec79c['name'],'resourceId':_0xbec79c['id'],'type':_0x1685fe['name'],'sectionId':_0x1685fe['id']},{})[_0xc138('0x22')](function(){return _0x92ff7b;});}else{return _0x92ff7b;}})[_0xc138('0x41')](function(_0x459efd){logger[_0xc138('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x459efd);throw _0x459efd;});}return _0x92ff7b;})[_0xc138('0x22')](respondWithResult(_0x227737,0xc9))['catch'](handleError(_0x227737,null));};exports['update']=function(_0x403ee2,_0x29cc73){if(_0x403ee2[_0xc138('0x47')]['id']){delete _0x403ee2[_0xc138('0x47')]['id'];}return db[_0xc138('0x28')][_0xc138('0x45')]({'where':{'id':_0x403ee2['params']['id']}})[_0xc138('0x22')](handleEntityNotFound(_0x29cc73,null))[_0xc138('0x22')](saveUpdates(_0x403ee2[_0xc138('0x47')],null))[_0xc138('0x22')](respondWithResult(_0x29cc73,null))[_0xc138('0x41')](handleError(_0x29cc73,null));};exports[_0xc138('0x4f')]=function(_0x49a566,_0x4cce4a){return db[_0xc138('0x28')]['find']({'where':{'id':_0x49a566[_0xc138('0x43')]['id']}})[_0xc138('0x22')](handleEntityNotFound(_0x4cce4a,null))[_0xc138('0x22')](removeEntity(_0x4cce4a,null))[_0xc138('0x41')](handleError(_0x4cce4a,null));};
\ No newline at end of file
+var _0x6b8c=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','count','set','Content-Range','apply','save','update','then','destroy','Pauses','UserProfileResource','error','stack','name','send','index','map','Pause','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','user','get','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2ad0ea,_0x5be9eb){var _0x39a572=function(_0x3fe486){while(--_0x3fe486){_0x2ad0ea['push'](_0x2ad0ea['shift']());}};_0x39a572(++_0x5be9eb);}(_0x6b8c,0x199));var _0xc6b8=function(_0x26a919,_0x25f029){_0x26a919=_0x26a919-0x0;var _0x326208=_0x6b8c[_0x26a919];return _0x326208;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc6b8('0x0'));var zipdir=require(_0xc6b8('0x1'));var jsonpatch=require(_0xc6b8('0x2'));var rp=require(_0xc6b8('0x3'));var moment=require(_0xc6b8('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc6b8('0x5'));var path=require(_0xc6b8('0x6'));var sox=require(_0xc6b8('0x7'));var csv=require(_0xc6b8('0x8'));var ejs=require(_0xc6b8('0x9'));var fs=require('fs');var fs_extra=require(_0xc6b8('0xa'));var _=require(_0xc6b8('0xb'));var squel=require('squel');var crypto=require(_0xc6b8('0xc'));var jsforce=require(_0xc6b8('0xd'));var deskjs=require(_0xc6b8('0xe'));var toCsv=require(_0xc6b8('0x8'));var querystring=require(_0xc6b8('0xf'));var Papa=require(_0xc6b8('0x10'));var Redis=require('ioredis');var authService=require(_0xc6b8('0x11'));var qs=require(_0xc6b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc6b8('0x13'))(_0xc6b8('0x14'));var utils=require(_0xc6b8('0x15'));var config=require(_0xc6b8('0x16'));var licenseUtil=require(_0xc6b8('0x17'));var db=require(_0xc6b8('0x18'))['db'];function respondWithStatusCode(_0x1956ab,_0x2bb2e0){_0x2bb2e0=_0x2bb2e0||0xcc;return function(_0x16b467){if(_0x16b467){return _0x1956ab[_0xc6b8('0x19')](_0x2bb2e0);}return _0x1956ab['status'](_0x2bb2e0)[_0xc6b8('0x1a')]();};}function respondWithResult(_0x2a5ef4,_0x53a65e){_0x53a65e=_0x53a65e||0xc8;return function(_0x34912a){if(_0x34912a){return _0x2a5ef4[_0xc6b8('0x1b')](_0x53a65e)[_0xc6b8('0x1c')](_0x34912a);}};}function respondWithFilteredResult(_0x2e34a8,_0x3b57fc){return function(_0x477743){if(_0x477743){var _0x196219=typeof _0x3b57fc['offset']==='undefined'&&typeof _0x3b57fc[_0xc6b8('0x1d')]==='undefined';var _0x2c6834=_0x477743[_0xc6b8('0x1e')];var _0x2c1199=_0x196219?0x0:_0x3b57fc['offset'];var _0x551468=_0x196219?_0x477743['count']:_0x3b57fc['offset']+_0x3b57fc[_0xc6b8('0x1d')];var _0x38afb1;if(_0x551468>=_0x2c6834){_0x551468=_0x2c6834;_0x38afb1=0xc8;}else{_0x38afb1=0xce;}_0x2e34a8[_0xc6b8('0x1b')](_0x38afb1);return _0x2e34a8[_0xc6b8('0x1f')](_0xc6b8('0x20'),_0x2c1199+'-'+_0x551468+'/'+_0x2c6834)['json'](_0x477743);}return null;};}function patchUpdates(_0x4dfb00){return function(_0x452049){try{jsonpatch[_0xc6b8('0x21')](_0x452049,_0x4dfb00,!![]);}catch(_0x1b7104){return BPromise['reject'](_0x1b7104);}return _0x452049[_0xc6b8('0x22')]();};}function saveUpdates(_0x4e823e,_0x38cf8e){return function(_0x278950){if(_0x278950){return _0x278950[_0xc6b8('0x23')](_0x4e823e)[_0xc6b8('0x24')](function(_0x4f8489){return _0x4f8489;});}return null;};}function removeEntity(_0x18d54d,_0x31eaf6){return function(_0x58e07d){if(_0x58e07d){return _0x58e07d[_0xc6b8('0x25')]()[_0xc6b8('0x24')](function(){var _0x4ffdb2=_0x58e07d['get']({'plain':!![]});var _0x1e6506=_0xc6b8('0x26');return db[_0xc6b8('0x27')][_0xc6b8('0x25')]({'where':{'type':_0x1e6506,'resourceId':_0x4ffdb2['id']}})[_0xc6b8('0x24')](function(){return _0x58e07d;});})[_0xc6b8('0x24')](function(){_0x18d54d[_0xc6b8('0x1b')](0xcc)[_0xc6b8('0x1a')]();});}};}function handleEntityNotFound(_0x4016ec,_0x135bcf){return function(_0x213c60){if(!_0x213c60){_0x4016ec[_0xc6b8('0x19')](0x194);}return _0x213c60;};}function handleError(_0xb353b0,_0x3bcdaa){_0x3bcdaa=_0x3bcdaa||0x1f4;return function(_0xec5dae){logger[_0xc6b8('0x28')](_0xec5dae[_0xc6b8('0x29')]);if(_0xec5dae[_0xc6b8('0x2a')]){delete _0xec5dae[_0xc6b8('0x2a')];}_0xb353b0['status'](_0x3bcdaa)[_0xc6b8('0x2b')](_0xec5dae);};}exports[_0xc6b8('0x2c')]=function(_0x2eca3a,_0x5adc89){var _0x411a0e={},_0x3c0c90={},_0x34254c={'count':0x0,'rows':[]};var _0xe67f68=_[_0xc6b8('0x2d')](db[_0xc6b8('0x2e')][_0xc6b8('0x2f')],function(_0x355b6a){return{'name':_0x355b6a[_0xc6b8('0x30')],'type':_0x355b6a[_0xc6b8('0x31')][_0xc6b8('0x32')]};});_0x3c0c90[_0xc6b8('0x33')]=_['map'](_0xe67f68,_0xc6b8('0x2a'));_0x3c0c90[_0xc6b8('0x34')]=_[_0xc6b8('0x35')](_0x2eca3a[_0xc6b8('0x34')]);_0x3c0c90[_0xc6b8('0x36')]=_[_0xc6b8('0x37')](_0x3c0c90[_0xc6b8('0x33')],_0x3c0c90[_0xc6b8('0x34')]);_0x411a0e[_0xc6b8('0x38')]=_[_0xc6b8('0x37')](_0x3c0c90['model'],qs[_0xc6b8('0x39')](_0x2eca3a['query'][_0xc6b8('0x39')]));_0x411a0e['attributes']=_0x411a0e[_0xc6b8('0x38')][_0xc6b8('0x3a')]?_0x411a0e['attributes']:_0x3c0c90['model'];if(!_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x3b')](_0xc6b8('0x3c'))){_0x411a0e['limit']=qs[_0xc6b8('0x1d')](_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x1d')]);_0x411a0e['offset']=qs[_0xc6b8('0x3d')](_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x3d')]);}_0x411a0e[_0xc6b8('0x3e')]=qs[_0xc6b8('0x3f')](_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x3f')]);_0x411a0e[_0xc6b8('0x40')]=qs[_0xc6b8('0x36')](_[_0xc6b8('0x41')](_0x2eca3a[_0xc6b8('0x34')],_0x3c0c90[_0xc6b8('0x36')]),_0xe67f68);if(_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x42')]){_0x411a0e[_0xc6b8('0x40')]=_[_0xc6b8('0x43')](_0x411a0e[_0xc6b8('0x40')],{'$or':_['map'](_0xe67f68,function(_0x2a92bb){if(_0x2a92bb[_0xc6b8('0x31')]!=='VIRTUAL'){var _0x3e390d={};_0x3e390d[_0x2a92bb[_0xc6b8('0x2a')]]={'$like':'%'+_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x42')]+'%'};return _0x3e390d;}})});}_0x411a0e=_[_0xc6b8('0x43')]({},_0x411a0e,_0x2eca3a['options']);var _0x285427={'where':_0x411a0e[_0xc6b8('0x40')]};return db[_0xc6b8('0x2e')][_0xc6b8('0x1e')](_0x285427)['then'](function(_0x3f20f8){_0x34254c[_0xc6b8('0x1e')]=_0x3f20f8;if(_0x2eca3a[_0xc6b8('0x34')][_0xc6b8('0x44')]){_0x411a0e[_0xc6b8('0x45')]=[{'all':!![]}];}return db[_0xc6b8('0x2e')][_0xc6b8('0x46')](_0x411a0e);})['then'](function(_0x2a60ef){_0x34254c[_0xc6b8('0x47')]=_0x2a60ef;return _0x34254c;})[_0xc6b8('0x24')](respondWithFilteredResult(_0x5adc89,_0x411a0e))['catch'](handleError(_0x5adc89,null));};exports[_0xc6b8('0x48')]=function(_0x51e4ce,_0x3cbf33){var _0x4f5fcc={'raw':!![],'where':{'id':_0x51e4ce[_0xc6b8('0x49')]['id']}},_0x16609e={};_0x16609e[_0xc6b8('0x33')]=_[_0xc6b8('0x35')](db[_0xc6b8('0x2e')][_0xc6b8('0x2f')]);_0x16609e[_0xc6b8('0x34')]=_[_0xc6b8('0x35')](_0x51e4ce[_0xc6b8('0x34')]);_0x16609e[_0xc6b8('0x36')]=_['intersection'](_0x16609e[_0xc6b8('0x33')],_0x16609e[_0xc6b8('0x34')]);_0x4f5fcc[_0xc6b8('0x38')]=_[_0xc6b8('0x37')](_0x16609e[_0xc6b8('0x33')],qs['fields'](_0x51e4ce['query'][_0xc6b8('0x39')]));_0x4f5fcc['attributes']=_0x4f5fcc[_0xc6b8('0x38')][_0xc6b8('0x3a')]?_0x4f5fcc['attributes']:_0x16609e[_0xc6b8('0x33')];if(_0x51e4ce[_0xc6b8('0x34')][_0xc6b8('0x44')]){_0x4f5fcc[_0xc6b8('0x45')]=[{'all':!![]}];}_0x4f5fcc=_[_0xc6b8('0x43')]({},_0x4f5fcc,_0x51e4ce[_0xc6b8('0x4a')]);return db['Pause'][_0xc6b8('0x4b')](_0x4f5fcc)[_0xc6b8('0x24')](handleEntityNotFound(_0x3cbf33,null))[_0xc6b8('0x24')](respondWithResult(_0x3cbf33,null))[_0xc6b8('0x4c')](handleError(_0x3cbf33,null));};exports[_0xc6b8('0x4d')]=function(_0x7fc6e7,_0x23821d){return db[_0xc6b8('0x2e')]['create'](_0x7fc6e7[_0xc6b8('0x4e')],{})[_0xc6b8('0x24')](function(_0x1b975a){var _0x122171=_0x7fc6e7[_0xc6b8('0x4f')][_0xc6b8('0x50')]({'plain':!![]});if(!_0x122171)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x122171[_0xc6b8('0x51')]===_0xc6b8('0x4f')){var _0x588a24=_0x1b975a['get']({'plain':!![]});var _0x3da1c8=_0xc6b8('0x26');return db[_0xc6b8('0x52')]['find']({'where':{'name':_0x3da1c8,'userProfileId':_0x122171['userProfileId']},'raw':!![]})['then'](function(_0x387d38){if(_0x387d38&&_0x387d38['autoAssociation']===0x0){return db[_0xc6b8('0x27')][_0xc6b8('0x4d')]({'name':_0x588a24[_0xc6b8('0x2a')],'resourceId':_0x588a24['id'],'type':_0x387d38[_0xc6b8('0x2a')],'sectionId':_0x387d38['id']},{})[_0xc6b8('0x24')](function(){return _0x1b975a;});}else{return _0x1b975a;}})['catch'](function(_0x54ec4f){logger['error'](_0xc6b8('0x53'),_0x54ec4f);throw _0x54ec4f;});}return _0x1b975a;})[_0xc6b8('0x24')](respondWithResult(_0x23821d,0xc9))[_0xc6b8('0x4c')](handleError(_0x23821d,null));};exports['update']=function(_0x526003,_0x535a67){if(_0x526003[_0xc6b8('0x4e')]['id']){delete _0x526003[_0xc6b8('0x4e')]['id'];}return db[_0xc6b8('0x2e')]['find']({'where':{'id':_0x526003[_0xc6b8('0x49')]['id']}})[_0xc6b8('0x24')](handleEntityNotFound(_0x535a67,null))['then'](saveUpdates(_0x526003[_0xc6b8('0x4e')],null))[_0xc6b8('0x24')](respondWithResult(_0x535a67,null))['catch'](handleError(_0x535a67,null));};exports[_0xc6b8('0x25')]=function(_0x211231,_0x257e2e){return db[_0xc6b8('0x2e')][_0xc6b8('0x4b')]({'where':{'id':_0x211231[_0xc6b8('0x49')]['id']}})[_0xc6b8('0x24')](handleEntityNotFound(_0x257e2e,null))[_0xc6b8('0x24')](removeEntity(_0x257e2e,null))[_0xc6b8('0x4c')](handleError(_0x257e2e,null));};
\ No newline at end of file
index 3fecb0d..dafbe5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6aa7,0x178));var _0x76aa=function(_0x283009,_0x4a89d7){_0x283009=_0x283009-0x0;var _0x34cd86=_0x6aa7[_0x283009];return _0x34cd86;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf494=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','lodash','util'];(function(_0x4579e3,_0x457476){var _0x470ac0=function(_0xdd0392){while(--_0xdd0392){_0x4579e3['push'](_0x4579e3['shift']());}};_0x470ac0(++_0x457476);}(_0xf494,0x1c6));var _0x4f49=function(_0x2fbd8e,_0x2464fd){_0x2fbd8e=_0x2fbd8e-0x0;var _0x1995a2=_0xf494[_0x2fbd8e];return _0x1995a2;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('Pause',attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2315d87..c5b8537 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x59f9f4,_0x4a3492){var _0x1dc481=function(_0x44f17e){while(--_0x44f17e){_0x59f9f4['push'](_0x59f9f4['shift']());}};_0x1dc481(++_0x4a3492);}(_0xb10b,0x12a));var _0xbb10=function(_0x50180c,_0x3fc232){_0x50180c=_0x50180c-0x0;var _0x5eaa41=_0xb10b[_0x50180c];return _0x5eaa41;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});};
\ No newline at end of file
+var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x480499,_0xa738a2){var _0x3dc16e=function(_0x51b290){while(--_0x51b290){_0x480499['push'](_0x480499['shift']());}};_0x3dc16e(++_0xa738a2);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e24d7,_0x11218f){_0x5e24d7=_0x5e24d7-0x0;var _0x10063d=_0xb10b[_0x5e24d7];return _0x10063d;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});};
\ No newline at end of file
index b7636b7..d80f6fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaba6=['get','webhookGet','isAuthenticated','show','/:id/download','download','diskStorage','root','server/files/plugins','originalname','format','%s-%s%s','basename','extname','now','post','single','file','upload','/webhook','put','/:id','delete','multer','util','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller'];(function(_0x272eb4,_0x4b652b){var _0x44cbcf=function(_0x2b471a){while(--_0x2b471a){_0x272eb4['push'](_0x272eb4['shift']());}};_0x44cbcf(++_0x4b652b);}(_0xaba6,0xe2));var _0x6aba=function(_0x407d0f,_0x5cafa2){_0x407d0f=_0x407d0f-0x0;var _0xdeeb73=_0xaba6[_0x407d0f];return _0xdeeb73;};'use strict';var multer=require(_0x6aba('0x0'));var util=require(_0x6aba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x6aba('0x2'));var auth=require(_0x6aba('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6aba('0x4'));var controller=require(_0x6aba('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6aba('0x6')]('/webhook',controller[_0x6aba('0x7')]);router[_0x6aba('0x6')]('/:id',auth[_0x6aba('0x8')](),controller[_0x6aba('0x9')]);router['get'](_0x6aba('0xa'),auth[_0x6aba('0x8')](),controller[_0x6aba('0xb')]);var upload=multer({'storage':multer[_0x6aba('0xc')]({'destination':function(_0xdbc119,_0x4089c6,_0x181426){_0x181426(null,path['join'](config[_0x6aba('0xd')],_0x6aba('0xe')));},'filename':function(_0x43867b,_0x254007,_0x53e604){_0x254007[_0x6aba('0xf')]=_0x254007[_0x6aba('0xf')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x53e604(null,util[_0x6aba('0x10')](_0x6aba('0x11'),path[_0x6aba('0x12')](_0x254007['originalname'],path[_0x6aba('0x13')](_0x254007[_0x6aba('0xf')])),Date[_0x6aba('0x14')](),path['extname'](_0x254007[_0x6aba('0xf')])));}})});router[_0x6aba('0x15')]('/',upload[_0x6aba('0x16')](_0x6aba('0x17')),controller[_0x6aba('0x18')]);router[_0x6aba('0x15')](_0x6aba('0x19'),controller['webhookPost']);router[_0x6aba('0x1a')](_0x6aba('0x1b'),auth[_0x6aba('0x8')](),controller['update']);router[_0x6aba('0x1c')]('/:id',auth['isAuthenticated'](),controller[_0x6aba('0x1c')]);module['exports']=router;
\ No newline at end of file
+var _0x17ba=['single','upload','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','download','diskStorage','join','server/files/plugins','originalname','replace','format','basename','extname','post'];(function(_0x1ba49a,_0x2b59bd){var _0x42361d=function(_0x2a00a3){while(--_0x2a00a3){_0x1ba49a['push'](_0x1ba49a['shift']());}};_0x42361d(++_0x2b59bd);}(_0x17ba,0xab));var _0xa17b=function(_0x318cb1,_0x57a0f1){_0x318cb1=_0x318cb1-0x0;var _0x209237=_0x17ba[_0x318cb1];return _0x209237;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router[_0xa17b('0xa')]('/:id/download',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);var upload=multer({'storage':multer[_0xa17b('0x12')]({'destination':function(_0x1e799a,_0x140943,_0x4382df){_0x4382df(null,path[_0xa17b('0x13')](config['root'],_0xa17b('0x14')));},'filename':function(_0x3e92e4,_0x3c3a8a,_0x52b7aa){_0x3c3a8a[_0xa17b('0x15')]=_0x3c3a8a[_0xa17b('0x15')][_0xa17b('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52b7aa(null,util[_0xa17b('0x17')]('%s-%s%s',path[_0xa17b('0x18')](_0x3c3a8a['originalname'],path[_0xa17b('0x19')](_0x3c3a8a[_0xa17b('0x15')])),Date['now'](),path[_0xa17b('0x19')](_0x3c3a8a[_0xa17b('0x15')])));}})});router[_0xa17b('0x1a')]('/',upload[_0xa17b('0x1b')]('file'),controller[_0xa17b('0x1c')]);router['post']('/webhook',controller['webhookPost']);router[_0xa17b('0x1d')](_0xa17b('0xf'),auth['isAuthenticated'](),controller[_0xa17b('0x1e')]);router[_0xa17b('0x1f')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x1f')]);module[_0xa17b('0x20')]=router;
\ No newline at end of file
index c9757f6..fc02d76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0709=['script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','html'];(function(_0x125c6b,_0x3396bd){var _0x49b36f=function(_0x14a408){while(--_0x14a408){_0x125c6b['push'](_0x125c6b['shift']());}};_0x49b36f(++_0x3396bd);}(_0x0709,0x1e8));var _0x9070=function(_0x500c0,_0xdb6a03){_0x500c0=_0x500c0-0x0;var _0xdd146f=_0x0709[_0x500c0];return _0xdd146f;};'use strict';var Sequelize=require(_0x9070('0x0'));module[_0x9070('0x1')]={'name':{'type':Sequelize[_0x9070('0x2')]},'type':{'type':Sequelize['ENUM'](_0x9070('0x3'),_0x9070('0x4'))},'description':{'type':Sequelize[_0x9070('0x5')]},'version':{'type':Sequelize[_0x9070('0x5')]},'path':{'type':Sequelize[_0x9070('0x2')],'comment':_0x9070('0x6')},'active':{'type':Sequelize[_0x9070('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0x9070('0x8'),_0x9070('0x9'),_0x9070('0xa'),'never'),'defaultValue':'always','comment':_0x9070('0xb')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x9070('0x2')]},'scriptPath':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xe853=['html','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe853,0xd5));var _0x3e85=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe853[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x3e85('0x0'));module[_0x3e85('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3e85('0x2')](_0x3e85('0x3'),_0x3e85('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x3e85('0x5')],'comment':_0x3e85('0x6')},'active':{'type':Sequelize[_0x3e85('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x3e85('0x2')](_0x3e85('0x8'),_0x3e85('0x9'),_0x3e85('0xa'),'never'),'defaultValue':_0x3e85('0xa'),'comment':_0x3e85('0xb')},'icon':{'type':Sequelize[_0x3e85('0x5')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x3e85('0x5')]},'scriptName':{'type':Sequelize[_0x3e85('0x5')]},'scriptPath':{'type':Sequelize[_0x3e85('0x5')]}};
\ No newline at end of file
index 287b7a8..dce8fa3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe31a=['always','icon','icon-apps','admin','test','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','plugins','create','body','role','userProfileId','user','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','params','delete','dirname','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','webhookPost','hostname','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../mysqldb','redis','localhost','./plugin.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','catch','show','keys','length','find','download','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','code','Sequelize','Error\x20while\x20generating\x20the\x20zip\x20archive','Error','pipe','glob','node_modules/**/*','attachments/**/*','close','existsSync','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type'];(function(_0x1906e0,_0x45a2bf){var _0x5657a6=function(_0x27fa24){while(--_0x27fa24){_0x1906e0['push'](_0x1906e0['shift']());}};_0x5657a6(++_0x45a2bf);}(_0xe31a,0xc7));var _0xae31=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xe31a[_0x2c7618];return _0x5ce3f0;};'use strict';var emlformat=require(_0xae31('0x0'));var rimraf=require(_0xae31('0x1'));var zipdir=require(_0xae31('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xae31('0x3'));var moment=require(_0xae31('0x4'));var BPromise=require(_0xae31('0x5'));var Mustache=require(_0xae31('0x6'));var util=require('util');var path=require(_0xae31('0x7'));var sox=require('sox');var csv=require(_0xae31('0x8'));var ejs=require(_0xae31('0x9'));var fs=require('fs');var fs_extra=require(_0xae31('0xa'));var _=require(_0xae31('0xb'));var squel=require(_0xae31('0xc'));var crypto=require(_0xae31('0xd'));var jsforce=require(_0xae31('0xe'));var deskjs=require(_0xae31('0xf'));var toCsv=require('to-csv');var querystring=require(_0xae31('0x10'));var Papa=require(_0xae31('0x11'));var extract=require(_0xae31('0x12'));var rimraf=require(_0xae31('0x1'));var archiver=require(_0xae31('0x13'));var Redis=require(_0xae31('0x14'));var authService=require(_0xae31('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xae31('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xae31('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xae31('0x18'))['db'];config[_0xae31('0x19')]=_['defaults'](config[_0xae31('0x19')],{'host':_0xae31('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xae31('0x19')]));require(_0xae31('0x1b'))[_0xae31('0x1c')](socket);function respondWithStatusCode(_0x45ec99,_0x183d7c){_0x183d7c=_0x183d7c||0xcc;return function(_0x30d9dc){if(_0x30d9dc){return _0x45ec99['sendStatus'](_0x183d7c);}return _0x45ec99[_0xae31('0x1d')](_0x183d7c)[_0xae31('0x1e')]();};}function respondWithResult(_0x66fbc7,_0x542a77){_0x542a77=_0x542a77||0xc8;return function(_0x5ae939){if(_0x5ae939){return _0x66fbc7[_0xae31('0x1d')](_0x542a77)[_0xae31('0x1f')](_0x5ae939);}};}function respondWithFilteredResult(_0x30d633,_0x1706d3){return function(_0x2c4d94){if(_0x2c4d94){var _0xfe7b61=typeof _0x1706d3[_0xae31('0x20')]===_0xae31('0x21')&&typeof _0x1706d3[_0xae31('0x22')]===_0xae31('0x21');var _0x11c04d=_0x2c4d94[_0xae31('0x23')];var _0x19f6d4=_0xfe7b61?0x0:_0x1706d3[_0xae31('0x20')];var _0x194fad=_0xfe7b61?_0x2c4d94[_0xae31('0x23')]:_0x1706d3[_0xae31('0x20')]+_0x1706d3['limit'];var _0x4c2962;if(_0x194fad>=_0x11c04d){_0x194fad=_0x11c04d;_0x4c2962=0xc8;}else{_0x4c2962=0xce;}_0x30d633[_0xae31('0x1d')](_0x4c2962);return _0x30d633['set'](_0xae31('0x24'),_0x19f6d4+'-'+_0x194fad+'/'+_0x11c04d)[_0xae31('0x1f')](_0x2c4d94);}return null;};}function patchUpdates(_0x168fca){return function(_0x17a7cc){try{jsonpatch[_0xae31('0x25')](_0x17a7cc,_0x168fca,!![]);}catch(_0x5221aa){return BPromise[_0xae31('0x26')](_0x5221aa);}return _0x17a7cc[_0xae31('0x27')]();};}function saveUpdates(_0x146425,_0x2d51c1){return function(_0x1efab6){if(_0x1efab6){return _0x1efab6[_0xae31('0x28')](_0x146425)[_0xae31('0x29')](function(_0x4cf6d0){return _0x4cf6d0;});}return null;};}function removeEntity(_0x3a1fce,_0xa77ca9){return function(_0x4efec1){if(_0x4efec1){return _0x4efec1[_0xae31('0x2a')]()[_0xae31('0x29')](function(){var _0x40d80c=_0x4efec1[_0xae31('0x2b')]({'plain':!![]});var _0x2cb49e='Plugins';return db[_0xae31('0x2c')][_0xae31('0x2a')]({'where':{'type':_0x2cb49e,'resourceId':_0x40d80c['id']}})[_0xae31('0x29')](function(){return _0x4efec1;});})[_0xae31('0x29')](function(){_0x3a1fce['status'](0xcc)[_0xae31('0x1e')]();});}};}function handleEntityNotFound(_0x565bdd,_0x12e79c){return function(_0x41d31f){if(!_0x41d31f){_0x565bdd[_0xae31('0x2d')](0x194);}return _0x41d31f;};}function handleError(_0x4103b5,_0x364367){_0x364367=_0x364367||0x1f4;return function(_0x189d3a){logger[_0xae31('0x2e')](_0x189d3a[_0xae31('0x2f')]);if(_0x189d3a['name']){delete _0x189d3a[_0xae31('0x30')];}_0x4103b5[_0xae31('0x1d')](_0x364367)[_0xae31('0x31')](_0x189d3a);};}exports[_0xae31('0x32')]=function(_0x11cda5,_0x57ad7f){var _0x3683c5={},_0x3fbb8a={},_0x280482={'count':0x0,'rows':[]};var _0x319bf4=_[_0xae31('0x33')](db[_0xae31('0x34')][_0xae31('0x35')],function(_0x13f658){return{'name':_0x13f658[_0xae31('0x36')],'type':_0x13f658[_0xae31('0x37')][_0xae31('0x38')]};});_0x3fbb8a[_0xae31('0x39')]=_[_0xae31('0x33')](_0x319bf4,'name');_0x3fbb8a[_0xae31('0x3a')]=_['keys'](_0x11cda5[_0xae31('0x3a')]);_0x3fbb8a[_0xae31('0x3b')]=_[_0xae31('0x3c')](_0x3fbb8a[_0xae31('0x39')],_0x3fbb8a[_0xae31('0x3a')]);_0x3683c5[_0xae31('0x3d')]=_[_0xae31('0x3c')](_0x3fbb8a[_0xae31('0x39')],qs[_0xae31('0x3e')](_0x11cda5['query'][_0xae31('0x3e')]));_0x3683c5['attributes']=_0x3683c5[_0xae31('0x3d')]['length']?_0x3683c5[_0xae31('0x3d')]:_0x3fbb8a['model'];if(!_0x11cda5[_0xae31('0x3a')]['hasOwnProperty'](_0xae31('0x3f'))){_0x3683c5[_0xae31('0x22')]=qs[_0xae31('0x22')](_0x11cda5[_0xae31('0x3a')][_0xae31('0x22')]);_0x3683c5[_0xae31('0x20')]=qs[_0xae31('0x20')](_0x11cda5[_0xae31('0x3a')][_0xae31('0x20')]);}_0x3683c5[_0xae31('0x40')]=qs[_0xae31('0x41')](_0x11cda5[_0xae31('0x3a')][_0xae31('0x41')]);_0x3683c5[_0xae31('0x42')]=qs['filters'](_[_0xae31('0x43')](_0x11cda5[_0xae31('0x3a')],_0x3fbb8a[_0xae31('0x3b')]),_0x319bf4);if(_0x11cda5[_0xae31('0x3a')]['filter']){_0x3683c5[_0xae31('0x42')]=_['merge'](_0x3683c5[_0xae31('0x42')],{'$or':_[_0xae31('0x33')](_0x319bf4,function(_0x8c405a){if(_0x8c405a[_0xae31('0x37')]!==_0xae31('0x44')){var _0x5bbfc3={};_0x5bbfc3[_0x8c405a['name']]={'$like':'%'+_0x11cda5[_0xae31('0x3a')][_0xae31('0x45')]+'%'};return _0x5bbfc3;}})});}_0x3683c5=_[_0xae31('0x46')]({},_0x3683c5,_0x11cda5[_0xae31('0x47')]);var _0x4ade71={'where':_0x3683c5[_0xae31('0x42')]};return db['Plugin'][_0xae31('0x23')](_0x4ade71)[_0xae31('0x29')](function(_0x40fe50){_0x280482[_0xae31('0x23')]=_0x40fe50;if(_0x11cda5[_0xae31('0x3a')]['includeAll']){_0x3683c5[_0xae31('0x48')]=[{'all':!![]}];}return db[_0xae31('0x34')]['findAll'](_0x3683c5);})[_0xae31('0x29')](function(_0x276be1){_0x280482['rows']=_0x276be1;return _0x280482;})[_0xae31('0x29')](respondWithFilteredResult(_0x57ad7f,_0x3683c5))[_0xae31('0x49')](handleError(_0x57ad7f,null));};exports[_0xae31('0x4a')]=function(_0x3104f0,_0x2bf319){var _0x1e14d4={'raw':!![],'where':{'id':_0x3104f0['params']['id']}},_0x5348c2={};_0x5348c2['model']=_[_0xae31('0x4b')](db[_0xae31('0x34')][_0xae31('0x35')]);_0x5348c2[_0xae31('0x3a')]=_[_0xae31('0x4b')](_0x3104f0[_0xae31('0x3a')]);_0x5348c2[_0xae31('0x3b')]=_[_0xae31('0x3c')](_0x5348c2[_0xae31('0x39')],_0x5348c2[_0xae31('0x3a')]);_0x1e14d4['attributes']=_[_0xae31('0x3c')](_0x5348c2['model'],qs['fields'](_0x3104f0['query'][_0xae31('0x3e')]));_0x1e14d4[_0xae31('0x3d')]=_0x1e14d4['attributes'][_0xae31('0x4c')]?_0x1e14d4[_0xae31('0x3d')]:_0x5348c2[_0xae31('0x39')];if(_0x3104f0['query']['includeAll']){_0x1e14d4[_0xae31('0x48')]=[{'all':!![]}];}_0x1e14d4=_[_0xae31('0x46')]({},_0x1e14d4,_0x3104f0[_0xae31('0x47')]);return db[_0xae31('0x34')][_0xae31('0x4d')](_0x1e14d4)[_0xae31('0x29')](handleEntityNotFound(_0x2bf319,null))[_0xae31('0x29')](respondWithResult(_0x2bf319,null))['catch'](handleError(_0x2bf319,null));};exports[_0xae31('0x4e')]=function(_0x106ac0,_0x4525b9,_0x2dda3e){return db[_0xae31('0x34')][_0xae31('0x4d')]({'where':{'id':_0x106ac0['params']['id']},'attributes':[_0xae31('0x30'),_0xae31('0x7')],'raw':!![]})[_0xae31('0x29')](handleEntityNotFound(_0x4525b9,null))[_0xae31('0x29')](function(_0x9e2688){if(_0x9e2688){var _0x3b3baf=path[_0xae31('0x4f')](config[_0xae31('0x50')],_0xae31('0x51'),util[_0xae31('0x52')](_0xae31('0x53'),path[_0xae31('0x54')](_0x9e2688[_0xae31('0x7')])));var _0x3b0678=fs[_0xae31('0x55')](_0x3b3baf);var _0x290fc4=archiver('zip',{'zlib':{'level':0x9}});_0x290fc4['on']('warning',function(_0x391b12){if(_0x391b12[_0xae31('0x56')]==='ENOENT'){logger['error'](_0x391b12);}else{throw new db[(_0xae31('0x57'))]['Error'](_0xae31('0x58'));}});_0x290fc4['on']('error',function(_0x17dde4){throw new db[(_0xae31('0x57'))][(_0xae31('0x59'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x290fc4[_0xae31('0x5a')](_0x3b0678);_0x290fc4[_0xae31('0x5b')]('**/*',{'cwd':path[_0xae31('0x4f')](config['root'],_0xae31('0x51'),path['dirname'](_0x9e2688[_0xae31('0x7')])),'ignore':[path[_0xae31('0x4f')](path[_0xae31('0x54')](_0x9e2688[_0xae31('0x7')]),_0xae31('0x5c')),path[_0xae31('0x4f')](path['basename'](_0x9e2688[_0xae31('0x7')]),_0xae31('0x5d'))],'nodir':!![]})['finalize']();_0x3b0678['on'](_0xae31('0x5e'),function(){if(!fs[_0xae31('0x5f')](_0x3b3baf)){throw new db['Sequelize'][(_0xae31('0x59'))]('Plugin\x20not\x20found');}return _0x4525b9[_0xae31('0x4e')](_0x3b3baf,util[_0xae31('0x52')]('%s.zip',path[_0xae31('0x54')](_0x9e2688['path'])),function(_0x3c668b){if(_0x3c668b){throw new db[(_0xae31('0x57'))][(_0xae31('0x59'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xae31('0x60')](_0x3b3baf);logger['info'](_0xae31('0x61'));logger[_0xae31('0x62')](_0xae31('0x63'));});});}return null;})[_0xae31('0x49')](handleError(_0x4525b9,null));};exports[_0xae31('0x64')]=function(_0x591ff2,_0x11e71d,_0x5aa121){var _0x4e7601=path[_0xae31('0x54')](_0x591ff2[_0xae31('0x65')][_0xae31('0x66')],path[_0xae31('0x67')](_0x591ff2[_0xae31('0x65')][_0xae31('0x66')]));var _0x565885=path[_0xae31('0x4f')](config['root'],'server/files/plugins',_0x591ff2['file']['filename']);var _0x18070b=path['join'](config[_0xae31('0x50')],_0xae31('0x51'),_0x4e7601);logger[_0xae31('0x62')](_0xae31('0x68'),_0x565885);logger['info']('Plugin\x20upload\x20destination:\x20%s',_0x18070b);try{fs[_0xae31('0x69')](_0x565885,parseInt(_0xae31('0x6a'),0x8));extract(_0x565885,{'dir':_0x18070b},function(_0x30f09){if(_0x30f09){logger[_0xae31('0x2e')](_0x30f09);handleError(_0x30f09,!![]);};var _0x4092cb=fs[_0xae31('0x6b')](_0x18070b);if(_0x4092cb[_0xae31('0x4c')]>0x1){removeReferences(_0x565885,_0x18070b);logger[_0xae31('0x2e')](_0xae31('0x6c'));return _0x5aa121(new Error(_0xae31('0x6c')));}var _0x16ee41=fs['lstatSync'](path['join'](_0x18070b,_0x4092cb[0x0]));if(_0x16ee41[_0xae31('0x6d')]()){removeReferences(_0x565885,_0x18070b);logger[_0xae31('0x2e')]('Invalid\x20plugin\x20structure');return _0x5aa121(new Error(_0xae31('0x6c')));}if(_0x16ee41['isDirectory']()){var _0x160fde=fs[_0xae31('0x6b')](path['join'](_0x18070b,_0x4092cb[0x0]));if(_0x160fde[_0xae31('0x4c')]===0x0){removeReferences(_0x565885,_0x18070b);logger[_0xae31('0x2e')](_0xae31('0x6c'));return _0x5aa121(new Error(_0xae31('0x6c')));}var _0x3be2c3=_0x160fde['some'](function(_0x2df285){return _0x2df285==='manifest.json';});if(!_0x3be2c3){return _0x5aa121(new Error(_0xae31('0x6e')));}var _0x42d5a3=fs['readFileSync'](path['join'](_0x18070b,_0x4092cb[0x0],'manifest.json'));var _0x1f73c7=JSON[_0xae31('0x6f')](_0x42d5a3);if('undefined'==typeof _0x1f73c7[_0xae31('0x30')]){return _0x5aa121(new Error(_0xae31('0x70')));}if(_0xae31('0x21')==typeof _0x1f73c7[_0xae31('0x37')]){return _0x5aa121(new Error(_0xae31('0x71')));}if(_0xae31('0x21')==typeof _0x1f73c7[_0xae31('0x72')]){return _0x5aa121(new Error(_0xae31('0x73')));}if('undefined'==typeof _0x1f73c7[_0xae31('0x74')]){return _0x5aa121(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x1f73c7['type']===_0xae31('0x75')){if('undefined'==typeof _0x1f73c7[_0xae31('0x74')][_0xae31('0x76')]){return _0x5aa121(new Error(_0xae31('0x77')));}if(_0xae31('0x21')==typeof _0x1f73c7[_0xae31('0x74')]['views']['admin']&&_0xae31('0x21')==typeof _0x1f73c7[_0xae31('0x74')][_0xae31('0x76')][_0xae31('0x78')]){return _0x5aa121(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1f73c7[_0xae31('0x37')]===_0xae31('0x79')){if(_0xae31('0x21')==typeof _0x1f73c7[_0xae31('0x74')][_0xae31('0x7a')]){return _0x5aa121(new Error(_0xae31('0x7b')));}if(_0xae31('0x21')==typeof _0x1f73c7['parameters'][_0xae31('0x7c')]){return _0x5aa121(new Error(_0xae31('0x7d')));}}else{return _0x5aa121(new Error(_0xae31('0x7e')));}var _0x51775a=_0x1f73c7[_0xae31('0x30')];var _0x53aa3a=_0x1f73c7['description'];var _0x3da5c8=_0x1f73c7['type'];var _0x3805e3=_0x1f73c7['sidebar']?_0x1f73c7['sidebar']:_0xae31('0x7f');var _0x57793a=_0x1f73c7[_0xae31('0x80')]?_0x1f73c7[_0xae31('0x80')]:_0xae31('0x81');var _0x1df3c4='';var _0x36b930='';var _0x39081d='';var _0x110979='';var _0x5cacb9=_0x1f73c7[_0xae31('0x72')];if(_0x3da5c8===_0xae31('0x75')){if(_0xae31('0x21')!=typeof _0x1f73c7['parameters']['views'][_0xae31('0x82')]){var _0x31fd10=_0x1f73c7[_0xae31('0x74')][_0xae31('0x76')][_0xae31('0x82')];if(!/^(f|ht)tps?:\/\//i[_0xae31('0x83')](_0x31fd10)){_0x1df3c4=path['join']('plugins',_0x4e7601,_0x4092cb[0x0],_0x31fd10);}else{_0x1df3c4=_0x31fd10;}}else{logger[_0xae31('0x62')](_0xae31('0x84'));}if(_0xae31('0x21')!=typeof _0x1f73c7['parameters'][_0xae31('0x76')][_0xae31('0x78')]){var _0x442566=_0x1f73c7[_0xae31('0x74')]['views'][_0xae31('0x78')];if(!/^(f|ht)tps?:\/\//i[_0xae31('0x83')](_0x442566)){_0x36b930=path[_0xae31('0x4f')]('plugins',_0x4e7601,_0x4092cb[0x0],_0x442566);}else{_0x36b930=_0x442566;}}else{logger[_0xae31('0x62')](_0xae31('0x85'));}}else if(_0x3da5c8===_0xae31('0x79')){_0x39081d=_0x1f73c7[_0xae31('0x74')][_0xae31('0x7a')];_0x110979=_0x1f73c7[_0xae31('0x74')][_0xae31('0x7c')];if(_0xae31('0x21')!=typeof _0x1f73c7[_0xae31('0x74')][_0xae31('0x76')]){if(_0xae31('0x21')!=typeof _0x1f73c7['parameters'][_0xae31('0x76')][_0xae31('0x82')]){var _0x31fd10=_0x1f73c7[_0xae31('0x74')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xae31('0x83')](_0x31fd10)){_0x1df3c4=path['join']('plugins',_0x4e7601,_0x4092cb[0x0],_0x31fd10);}else{_0x1df3c4=_0x31fd10;}}if('undefined'!=typeof _0x1f73c7['parameters'][_0xae31('0x76')]['agent']){var _0x442566=_0x1f73c7[_0xae31('0x74')]['views'][_0xae31('0x78')];if(!/^(f|ht)tps?:\/\//i['test'](_0x442566)){_0x36b930=path['join'](_0xae31('0x86'),_0x4e7601,_0x4092cb[0x0],_0x442566);}else{_0x36b930=_0x442566;}}}}var _0x19c497={'name':_0x51775a,'description':_0x53aa3a,'path':path[_0xae31('0x4f')](_0x4e7601,_0x4092cb[0x0]),'type':_0x3da5c8,'sidebar':_0x3805e3,'icon':_0x57793a,'adminUrl':_0x1df3c4,'agentUrl':_0x36b930,'scriptName':_0x39081d,'scriptPath':_0x110979,'version':_0x5cacb9};removeReferences(_0x565885,null);return db['Plugin'][_0xae31('0x87')](_0x19c497)['then'](function(_0x417b82){var _0x37c8c8={'role':_0x591ff2[_0xae31('0x88')][_0xae31('0x89')],'userProfileId':_0x591ff2[_0xae31('0x88')][_0xae31('0x8a')]};if(!_0x37c8c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x37c8c8[_0xae31('0x89')]===_0xae31('0x8b')){var _0x539422=_0x417b82[_0xae31('0x2b')]({'plain':!![]});return db[_0xae31('0x8c')][_0xae31('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x37c8c8[_0xae31('0x8a')]},'raw':!![]})['then'](function(_0xbf7ee8){if(_0xbf7ee8&&_0xbf7ee8[_0xae31('0x8d')]===0x0){return db[_0xae31('0x2c')][_0xae31('0x87')]({'name':_0x539422[_0xae31('0x30')],'resourceId':_0x539422['id'],'type':_0xbf7ee8[_0xae31('0x30')],'sectionId':_0xbf7ee8['id']},{})[_0xae31('0x29')](function(){return _0x417b82;});}else{return _0x417b82;}})[_0xae31('0x49')](function(_0x156280){logger[_0xae31('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x156280);throw _0x156280;});}return _0x417b82;})[_0xae31('0x29')](respondWithResult(_0x11e71d,null))['catch'](handleError(_0x11e71d,null));}});}catch(_0x30842e){_0x11e71d[_0xae31('0x1d')](0x1f4)['send'](_0x30842e);}};function removeReferences(_0x38175f,_0x35b1f1){try{if(_0x38175f){fs[_0xae31('0x60')](_0x38175f);logger['info'](_0xae31('0x8e'));}if(_0x35b1f1){rimraf(_0x35b1f1,function(){});logger[_0xae31('0x62')](_0xae31('0x8f'));}}catch(_0x2a63e8){logger['error'](_0x2a63e8);}}exports[_0xae31('0x28')]=function(_0x501fc0,_0x210115,_0x1b1330){return db[_0xae31('0x34')][_0xae31('0x4d')]({'where':{'id':_0x501fc0[_0xae31('0x90')]['id']}})[_0xae31('0x29')](handleEntityNotFound(_0x210115,null))[_0xae31('0x29')](saveUpdates(_0x501fc0[_0xae31('0x88')],null))[_0xae31('0x29')](respondWithResult(_0x210115,null))[_0xae31('0x49')](handleError(_0x210115,null));};exports[_0xae31('0x91')]=function(_0xae4e81,_0x115a77,_0x2cc4da){return db[_0xae31('0x34')][_0xae31('0x4d')]({'where':{'id':_0xae4e81[_0xae31('0x90')]['id']}})['then'](function(_0x4421ed){if(_0x4421ed){return _0x4421ed['destroy']();}})[_0xae31('0x29')](function(_0x5c4209){rimraf(path[_0xae31('0x4f')](config[_0xae31('0x50')],_0xae31('0x51'),path[_0xae31('0x92')](_0x5c4209[_0xae31('0x7')])),function(){});return _0x5c4209;})[_0xae31('0x29')](handleEntityNotFound(_0x115a77,null))['then'](respondWithStatusCode(_0x115a77,null))['catch'](handleError(_0x115a77,null));};exports['webhookGet']=function(_0x1f555b,_0xbfaf69,_0x105f85){return BPromise[_0xae31('0x93')]()[_0xae31('0x29')](function(){if(!_0x1f555b[_0xae31('0x3a')][_0xae31('0x7')]){throw new Error(_0xae31('0x94'));}if(!_0x1f555b[_0xae31('0x3a')]['port']){throw new Error(_0xae31('0x95'));}var _0x5227fa=_0x1f555b[_0xae31('0x3a')]['hostname']?_0x1f555b['query']['hostname']+':'+_0x1f555b['query'][_0xae31('0x96')]:_0xae31('0x97')+_0x1f555b[_0xae31('0x3a')][_0xae31('0x96')];var _0x21d117=_0x1f555b['query'][_0xae31('0x1f')]?_0x1f555b['query'][_0xae31('0x1f')]:!![];var _0x410958=_0x1f555b[_0xae31('0x3a')][_0xae31('0x98')]?_0x1f555b['query'][_0xae31('0x98')]:null;var _0x1bdc0f={'method':_0x1f555b[_0xae31('0x99')],'uri':util[_0xae31('0x52')](_0xae31('0x9a'),_0x5227fa,_0x1f555b[_0xae31('0x3a')][_0xae31('0x7')]),'json':_0x21d117,'resolveWithFullResponse':!![],'encoding':_0x410958,'qs':_0x1f555b['query']};if(_0x1f555b[_0xae31('0x9b')]){_0x1bdc0f['headers']=_0x1f555b[_0xae31('0x9b')];if(_0x1bdc0f[_0xae31('0x9b')][_0xae31('0x9c')]){delete _0x1bdc0f['headers'][_0xae31('0x9c')];}}if(_0x1bdc0f[_0xae31('0x9b')][_0xae31('0x9d')]){delete _0x1bdc0f[_0xae31('0x9b')][_0xae31('0x9d')];}return rp(_0x1bdc0f);})[_0xae31('0x29')](function(_0x3a1ba2){if(_0x3a1ba2){_0xbfaf69[_0xae31('0x9e')](_0x3a1ba2[_0xae31('0x9b')]);logger[_0xae31('0x62')](_0x3a1ba2[_0xae31('0x88')]);if(_[_0xae31('0x9f')](_0x1f555b[_0xae31('0x3a')][_0xae31('0x7')],_0xae31('0x4e'))&&_0x3a1ba2[_0xae31('0xa0')]==0x1f4){return _0xbfaf69[_0xae31('0x2d')](_0x3a1ba2[_0xae31('0xa0')]);}else{return _0xbfaf69[_0xae31('0x1d')](_0x3a1ba2[_0xae31('0xa0')])[_0xae31('0x31')](_0x3a1ba2[_0xae31('0x88')]);}}else{return _0xbfaf69[_0xae31('0x2d')](0xc8);}})[_0xae31('0x49')](handleError(_0xbfaf69,null));};exports[_0xae31('0xa1')]=function(_0x55f2fc,_0x141794,_0x335327){return BPromise[_0xae31('0x93')]()[_0xae31('0x29')](function(){if(!_0x55f2fc[_0xae31('0x3a')][_0xae31('0x7')]){throw new Error(_0xae31('0x94'));}if(!_0x55f2fc[_0xae31('0x3a')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x15c6d0=_0x55f2fc[_0xae31('0x3a')][_0xae31('0xa2')]?_0x55f2fc[_0xae31('0x3a')][_0xae31('0xa2')]+':'+_0x55f2fc[_0xae31('0x3a')][_0xae31('0x96')]:_0xae31('0x97')+_0x55f2fc['query'][_0xae31('0x96')];var _0x14da22=_0x55f2fc[_0xae31('0x3a')][_0xae31('0x1f')]?_0x55f2fc[_0xae31('0x3a')][_0xae31('0x1f')]:!![];var _0x53bc47=_0x55f2fc[_0xae31('0x3a')]['encoding']?_0x55f2fc[_0xae31('0x3a')][_0xae31('0x98')]:null;var _0x13885e={'method':_0x55f2fc['method'],'uri':util[_0xae31('0x52')](_0xae31('0x9a'),_0x15c6d0,_0x55f2fc[_0xae31('0x3a')][_0xae31('0x7')]),'json':_0x14da22,'resolveWithFullResponse':!![],'encoding':_0x53bc47,'body':_0x55f2fc[_0xae31('0x88')]};if(_0x55f2fc[_0xae31('0x9b')]){_0x13885e[_0xae31('0x9b')]=_0x55f2fc[_0xae31('0x9b')];if(_0x13885e[_0xae31('0x9b')][_0xae31('0x9c')]){delete _0x13885e['headers'][_0xae31('0x9c')];}}if(_0x13885e[_0xae31('0x9b')][_0xae31('0x9d')]){delete _0x13885e['headers'][_0xae31('0x9d')];}return rp(_0x13885e);})[_0xae31('0x29')](function(_0x46e5ab){if(_0x46e5ab){_0x141794[_0xae31('0x9e')](_0x46e5ab[_0xae31('0x9b')]);logger[_0xae31('0x62')](_0x46e5ab['body']);return _0x141794[_0xae31('0x1d')](_0x46e5ab['statusCode'])[_0xae31('0x31')](_0x46e5ab['body']);}else{return _0x141794[_0xae31('0x2d')](0xc8);}})[_0xae31('0x49')](handleError(_0x141794,null));};
\ No newline at end of file
+var _0xc0e0=['fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','download','path','join','root','server/files/plugins','format','%s.zip','zip','warning','code','ENOENT','error','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','basename','node_modules/**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','readdirSync','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20name\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon-apps','admin','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','scriptPath','body','role','userProfileId','user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','port','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','set','send','eml-format','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','rimraf','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','redis','register','sendStatus','status','end','json','limit','undefined','offset','count','apply','reject','save','then','destroy','get','Plugins','stack','name','index','map','Plugin','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes'];(function(_0x3b0a16,_0x199d72){var _0x5a7ced=function(_0x54343d){while(--_0x54343d){_0x3b0a16['push'](_0x3b0a16['shift']());}};_0x5a7ced(++_0x199d72);}(_0xc0e0,0x73));var _0x0c0e=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xc0e0[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require(_0x0c0e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0c0e('0x1'));var jsonpatch=require(_0x0c0e('0x2'));var rp=require(_0x0c0e('0x3'));var moment=require(_0x0c0e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x0c0e('0x5'));var csv=require(_0x0c0e('0x6'));var ejs=require(_0x0c0e('0x7'));var fs=require('fs');var fs_extra=require(_0x0c0e('0x8'));var _=require(_0x0c0e('0x9'));var squel=require(_0x0c0e('0xa'));var crypto=require(_0x0c0e('0xb'));var jsforce=require(_0x0c0e('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0c0e('0xd'));var Papa=require(_0x0c0e('0xe'));var extract=require('extract-zip');var rimraf=require(_0x0c0e('0xf'));var archiver=require('archiver');var Redis=require(_0x0c0e('0x10'));var authService=require(_0x0c0e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x0c0e('0x12'));var hardwareService=require(_0x0c0e('0x13'));var logger=require(_0x0c0e('0x14'))(_0x0c0e('0x15'));var utils=require(_0x0c0e('0x16'));var config=require(_0x0c0e('0x17'));var licenseUtil=require(_0x0c0e('0x18'));var db=require(_0x0c0e('0x19'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0c0e('0x1a'))(new Redis(config[_0x0c0e('0x1b')]));require('./plugin.socket')[_0x0c0e('0x1c')](socket);function respondWithStatusCode(_0x32a7e7,_0x907bc0){_0x907bc0=_0x907bc0||0xcc;return function(_0x50d715){if(_0x50d715){return _0x32a7e7[_0x0c0e('0x1d')](_0x907bc0);}return _0x32a7e7[_0x0c0e('0x1e')](_0x907bc0)[_0x0c0e('0x1f')]();};}function respondWithResult(_0x1d7d0f,_0x367470){_0x367470=_0x367470||0xc8;return function(_0x1f9544){if(_0x1f9544){return _0x1d7d0f[_0x0c0e('0x1e')](_0x367470)[_0x0c0e('0x20')](_0x1f9544);}};}function respondWithFilteredResult(_0x30959d,_0x1271c9){return function(_0x2b0f9a){if(_0x2b0f9a){var _0x59c57c=typeof _0x1271c9['offset']==='undefined'&&typeof _0x1271c9[_0x0c0e('0x21')]===_0x0c0e('0x22');var _0x435555=_0x2b0f9a['count'];var _0x5777cd=_0x59c57c?0x0:_0x1271c9[_0x0c0e('0x23')];var _0x2a2c6e=_0x59c57c?_0x2b0f9a[_0x0c0e('0x24')]:_0x1271c9[_0x0c0e('0x23')]+_0x1271c9[_0x0c0e('0x21')];var _0x4f3279;if(_0x2a2c6e>=_0x435555){_0x2a2c6e=_0x435555;_0x4f3279=0xc8;}else{_0x4f3279=0xce;}_0x30959d[_0x0c0e('0x1e')](_0x4f3279);return _0x30959d['set']('Content-Range',_0x5777cd+'-'+_0x2a2c6e+'/'+_0x435555)['json'](_0x2b0f9a);}return null;};}function patchUpdates(_0x4f7d32){return function(_0x158563){try{jsonpatch[_0x0c0e('0x25')](_0x158563,_0x4f7d32,!![]);}catch(_0x54458e){return BPromise[_0x0c0e('0x26')](_0x54458e);}return _0x158563[_0x0c0e('0x27')]();};}function saveUpdates(_0x173dc3,_0x18aa19){return function(_0x1721ed){if(_0x1721ed){return _0x1721ed['update'](_0x173dc3)[_0x0c0e('0x28')](function(_0x2a8a1f){return _0x2a8a1f;});}return null;};}function removeEntity(_0xc6ad35,_0x58ddc3){return function(_0x45f0bb){if(_0x45f0bb){return _0x45f0bb[_0x0c0e('0x29')]()[_0x0c0e('0x28')](function(){var _0x5ef698=_0x45f0bb[_0x0c0e('0x2a')]({'plain':!![]});var _0x9e2023=_0x0c0e('0x2b');return db['UserProfileResource'][_0x0c0e('0x29')]({'where':{'type':_0x9e2023,'resourceId':_0x5ef698['id']}})[_0x0c0e('0x28')](function(){return _0x45f0bb;});})[_0x0c0e('0x28')](function(){_0xc6ad35[_0x0c0e('0x1e')](0xcc)[_0x0c0e('0x1f')]();});}};}function handleEntityNotFound(_0x1073f3,_0x5ce413){return function(_0x6b7351){if(!_0x6b7351){_0x1073f3['sendStatus'](0x194);}return _0x6b7351;};}function handleError(_0x3c8933,_0x152306){_0x152306=_0x152306||0x1f4;return function(_0x4eb70a){logger['error'](_0x4eb70a[_0x0c0e('0x2c')]);if(_0x4eb70a[_0x0c0e('0x2d')]){delete _0x4eb70a[_0x0c0e('0x2d')];}_0x3c8933['status'](_0x152306)['send'](_0x4eb70a);};}exports[_0x0c0e('0x2e')]=function(_0x4ecb03,_0x2d7f57){var _0x1aa3dd={},_0x1f8cb5={},_0x54bb1d={'count':0x0,'rows':[]};var _0x101d4e=_[_0x0c0e('0x2f')](db[_0x0c0e('0x30')][_0x0c0e('0x31')],function(_0x1fe4fc){return{'name':_0x1fe4fc[_0x0c0e('0x32')],'type':_0x1fe4fc['type'][_0x0c0e('0x33')]};});_0x1f8cb5['model']=_['map'](_0x101d4e,'name');_0x1f8cb5[_0x0c0e('0x34')]=_[_0x0c0e('0x35')](_0x4ecb03[_0x0c0e('0x34')]);_0x1f8cb5[_0x0c0e('0x36')]=_[_0x0c0e('0x37')](_0x1f8cb5['model'],_0x1f8cb5[_0x0c0e('0x34')]);_0x1aa3dd[_0x0c0e('0x38')]=_['intersection'](_0x1f8cb5['model'],qs[_0x0c0e('0x39')](_0x4ecb03[_0x0c0e('0x34')][_0x0c0e('0x39')]));_0x1aa3dd[_0x0c0e('0x38')]=_0x1aa3dd[_0x0c0e('0x38')][_0x0c0e('0x3a')]?_0x1aa3dd['attributes']:_0x1f8cb5[_0x0c0e('0x3b')];if(!_0x4ecb03[_0x0c0e('0x34')][_0x0c0e('0x3c')](_0x0c0e('0x3d'))){_0x1aa3dd[_0x0c0e('0x21')]=qs[_0x0c0e('0x21')](_0x4ecb03[_0x0c0e('0x34')]['limit']);_0x1aa3dd[_0x0c0e('0x23')]=qs['offset'](_0x4ecb03['query'][_0x0c0e('0x23')]);}_0x1aa3dd[_0x0c0e('0x3e')]=qs[_0x0c0e('0x3f')](_0x4ecb03[_0x0c0e('0x34')]['sort']);_0x1aa3dd[_0x0c0e('0x40')]=qs[_0x0c0e('0x36')](_[_0x0c0e('0x41')](_0x4ecb03[_0x0c0e('0x34')],_0x1f8cb5['filters']),_0x101d4e);if(_0x4ecb03['query'][_0x0c0e('0x42')]){_0x1aa3dd[_0x0c0e('0x40')]=_[_0x0c0e('0x43')](_0x1aa3dd[_0x0c0e('0x40')],{'$or':_[_0x0c0e('0x2f')](_0x101d4e,function(_0x101e1c){if(_0x101e1c[_0x0c0e('0x44')]!==_0x0c0e('0x45')){var _0x185138={};_0x185138[_0x101e1c[_0x0c0e('0x2d')]]={'$like':'%'+_0x4ecb03['query'][_0x0c0e('0x42')]+'%'};return _0x185138;}})});}_0x1aa3dd=_[_0x0c0e('0x43')]({},_0x1aa3dd,_0x4ecb03[_0x0c0e('0x46')]);var _0x270f69={'where':_0x1aa3dd[_0x0c0e('0x40')]};return db[_0x0c0e('0x30')][_0x0c0e('0x24')](_0x270f69)['then'](function(_0x3757a5){_0x54bb1d[_0x0c0e('0x24')]=_0x3757a5;if(_0x4ecb03[_0x0c0e('0x34')][_0x0c0e('0x47')]){_0x1aa3dd[_0x0c0e('0x48')]=[{'all':!![]}];}return db[_0x0c0e('0x30')][_0x0c0e('0x49')](_0x1aa3dd);})[_0x0c0e('0x28')](function(_0x364396){_0x54bb1d[_0x0c0e('0x4a')]=_0x364396;return _0x54bb1d;})['then'](respondWithFilteredResult(_0x2d7f57,_0x1aa3dd))['catch'](handleError(_0x2d7f57,null));};exports[_0x0c0e('0x4b')]=function(_0x25fd93,_0x2b394d){var _0x1e9596={'raw':!![],'where':{'id':_0x25fd93[_0x0c0e('0x4c')]['id']}},_0x448584={};_0x448584[_0x0c0e('0x3b')]=_[_0x0c0e('0x35')](db[_0x0c0e('0x30')]['rawAttributes']);_0x448584[_0x0c0e('0x34')]=_[_0x0c0e('0x35')](_0x25fd93[_0x0c0e('0x34')]);_0x448584['filters']=_[_0x0c0e('0x37')](_0x448584[_0x0c0e('0x3b')],_0x448584[_0x0c0e('0x34')]);_0x1e9596[_0x0c0e('0x38')]=_[_0x0c0e('0x37')](_0x448584['model'],qs[_0x0c0e('0x39')](_0x25fd93['query'][_0x0c0e('0x39')]));_0x1e9596['attributes']=_0x1e9596[_0x0c0e('0x38')][_0x0c0e('0x3a')]?_0x1e9596['attributes']:_0x448584[_0x0c0e('0x3b')];if(_0x25fd93[_0x0c0e('0x34')][_0x0c0e('0x47')]){_0x1e9596[_0x0c0e('0x48')]=[{'all':!![]}];}_0x1e9596=_[_0x0c0e('0x43')]({},_0x1e9596,_0x25fd93[_0x0c0e('0x46')]);return db[_0x0c0e('0x30')][_0x0c0e('0x4d')](_0x1e9596)['then'](handleEntityNotFound(_0x2b394d,null))[_0x0c0e('0x28')](respondWithResult(_0x2b394d,null))[_0x0c0e('0x4e')](handleError(_0x2b394d,null));};exports[_0x0c0e('0x4f')]=function(_0x44a4a1,_0x48bcd3,_0x83fc5){return db['Plugin'][_0x0c0e('0x4d')]({'where':{'id':_0x44a4a1[_0x0c0e('0x4c')]['id']},'attributes':[_0x0c0e('0x2d'),_0x0c0e('0x50')],'raw':!![]})[_0x0c0e('0x28')](handleEntityNotFound(_0x48bcd3,null))[_0x0c0e('0x28')](function(_0x3a32a0){if(_0x3a32a0){var _0xbc89b5=path[_0x0c0e('0x51')](config[_0x0c0e('0x52')],_0x0c0e('0x53'),util[_0x0c0e('0x54')](_0x0c0e('0x55'),path['basename'](_0x3a32a0[_0x0c0e('0x50')])));var _0x3b0008=fs['createWriteStream'](_0xbc89b5);var _0x5d9a36=archiver(_0x0c0e('0x56'),{'zlib':{'level':0x9}});_0x5d9a36['on'](_0x0c0e('0x57'),function(_0x11bd28){if(_0x11bd28[_0x0c0e('0x58')]===_0x0c0e('0x59')){logger[_0x0c0e('0x5a')](_0x11bd28);}else{throw new db[(_0x0c0e('0x5b'))][(_0x0c0e('0x5c'))](_0x0c0e('0x5d'));}});_0x5d9a36['on'](_0x0c0e('0x5a'),function(_0x5b0559){throw new db[(_0x0c0e('0x5b'))][(_0x0c0e('0x5c'))](_0x0c0e('0x5d'));});_0x5d9a36[_0x0c0e('0x5e')](_0x3b0008);_0x5d9a36[_0x0c0e('0x5f')](_0x0c0e('0x60'),{'cwd':path['join'](config[_0x0c0e('0x52')],_0x0c0e('0x53'),path[_0x0c0e('0x61')](_0x3a32a0[_0x0c0e('0x50')])),'ignore':[path[_0x0c0e('0x51')](path[_0x0c0e('0x62')](_0x3a32a0[_0x0c0e('0x50')]),_0x0c0e('0x63')),path['join'](path[_0x0c0e('0x62')](_0x3a32a0[_0x0c0e('0x50')]),_0x0c0e('0x64'))],'nodir':!![]})[_0x0c0e('0x65')]();_0x3b0008['on'](_0x0c0e('0x66'),function(){if(!fs[_0x0c0e('0x67')](_0xbc89b5)){throw new db[(_0x0c0e('0x5b'))]['Error']('Plugin\x20not\x20found');}return _0x48bcd3['download'](_0xbc89b5,util[_0x0c0e('0x54')](_0x0c0e('0x55'),path[_0x0c0e('0x62')](_0x3a32a0['path'])),function(_0x4adae4){if(_0x4adae4){throw new db[(_0x0c0e('0x5b'))][(_0x0c0e('0x5c'))](_0x0c0e('0x68'));}fs[_0x0c0e('0x69')](_0xbc89b5);logger[_0x0c0e('0x6a')](_0x0c0e('0x6b'));logger[_0x0c0e('0x6a')](_0x0c0e('0x6c'));});});}return null;})[_0x0c0e('0x4e')](handleError(_0x48bcd3,null));};exports[_0x0c0e('0x6d')]=function(_0x5045f8,_0x4b5858,_0x1bcec4){var _0x51fcbe=path[_0x0c0e('0x62')](_0x5045f8[_0x0c0e('0x6e')][_0x0c0e('0x6f')],path['extname'](_0x5045f8[_0x0c0e('0x6e')][_0x0c0e('0x6f')]));var _0x306e66=path[_0x0c0e('0x51')](config[_0x0c0e('0x52')],_0x0c0e('0x53'),_0x5045f8['file'][_0x0c0e('0x6f')]);var _0x20f841=path[_0x0c0e('0x51')](config[_0x0c0e('0x52')],_0x0c0e('0x53'),_0x51fcbe);logger[_0x0c0e('0x6a')]('Plugin\x20upload\x20filepath:\x20%s',_0x306e66);logger[_0x0c0e('0x6a')](_0x0c0e('0x70'),_0x20f841);try{fs[_0x0c0e('0x71')](_0x306e66,parseInt('0777',0x8));extract(_0x306e66,{'dir':_0x20f841},function(_0xe9de1c){if(_0xe9de1c){logger[_0x0c0e('0x5a')](_0xe9de1c);handleError(_0xe9de1c,!![]);};var _0x554a26=fs['readdirSync'](_0x20f841);if(_0x554a26['length']>0x1){removeReferences(_0x306e66,_0x20f841);logger[_0x0c0e('0x5a')]('Invalid\x20plugin\x20structure');return _0x1bcec4(new Error(_0x0c0e('0x72')));}var _0x32429b=fs[_0x0c0e('0x73')](path[_0x0c0e('0x51')](_0x20f841,_0x554a26[0x0]));if(_0x32429b['isFile']()){removeReferences(_0x306e66,_0x20f841);logger['error'](_0x0c0e('0x72'));return _0x1bcec4(new Error(_0x0c0e('0x72')));}if(_0x32429b[_0x0c0e('0x74')]()){var _0x1b3b45=fs[_0x0c0e('0x75')](path['join'](_0x20f841,_0x554a26[0x0]));if(_0x1b3b45[_0x0c0e('0x3a')]===0x0){removeReferences(_0x306e66,_0x20f841);logger[_0x0c0e('0x5a')](_0x0c0e('0x72'));return _0x1bcec4(new Error('Invalid\x20plugin\x20structure'));}var _0x3d86f3=_0x1b3b45[_0x0c0e('0x76')](function(_0x44c7a3){return _0x44c7a3==='manifest.json';});if(!_0x3d86f3){return _0x1bcec4(new Error(_0x0c0e('0x77')));}var _0x16c3ad=fs['readFileSync'](path[_0x0c0e('0x51')](_0x20f841,_0x554a26[0x0],_0x0c0e('0x78')));var _0xda5241=JSON[_0x0c0e('0x79')](_0x16c3ad);if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x2d')]){return _0x1bcec4(new Error(_0x0c0e('0x7a')));}if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x44')]){return _0x1bcec4(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x7b')]){return _0x1bcec4(new Error(_0x0c0e('0x7c')));}if(_0x0c0e('0x22')==typeof _0xda5241['parameters']){return _0x1bcec4(new Error(_0x0c0e('0x7d')));}if(_0xda5241[_0x0c0e('0x44')]===_0x0c0e('0x7e')){if(_0x0c0e('0x22')==typeof _0xda5241['parameters'][_0x0c0e('0x7f')]){return _0x1bcec4(new Error(_0x0c0e('0x80')));}if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')]['admin']&&_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')]['agent']){return _0x1bcec4(new Error(_0x0c0e('0x82')));}}else if(_0xda5241[_0x0c0e('0x44')]===_0x0c0e('0x83')){if(_0x0c0e('0x22')==typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x84')]){return _0x1bcec4(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0xda5241[_0x0c0e('0x81')]['scriptPath']){return _0x1bcec4(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x1bcec4(new Error(_0x0c0e('0x85')));}var _0x26c84d=_0xda5241[_0x0c0e('0x2d')];var _0x4019e3=_0xda5241[_0x0c0e('0x86')];var _0x188ccd=_0xda5241[_0x0c0e('0x44')];var _0x2b421c=_0xda5241['sidebar']?_0xda5241[_0x0c0e('0x87')]:_0x0c0e('0x88');var _0x3be0cf=_0xda5241['icon']?_0xda5241['icon']:_0x0c0e('0x89');var _0x454e9e='';var _0x246f3d='';var _0x28a253='';var _0x8991d9='';var _0xfa2eba=_0xda5241[_0x0c0e('0x7b')];if(_0x188ccd==='html'){if(_0x0c0e('0x22')!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8a')]){var _0x221480=_0xda5241['parameters'][_0x0c0e('0x7f')][_0x0c0e('0x8a')];if(!/^(f|ht)tps?:\/\//i[_0x0c0e('0x8b')](_0x221480)){_0x454e9e=path[_0x0c0e('0x51')](_0x0c0e('0x8c'),_0x51fcbe,_0x554a26[0x0],_0x221480);}else{_0x454e9e=_0x221480;}}else{logger[_0x0c0e('0x6a')](_0x0c0e('0x8d'));}if(_0x0c0e('0x22')!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8e')]){var _0x232633=_0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x0c0e('0x8b')](_0x232633)){_0x246f3d=path['join'](_0x0c0e('0x8c'),_0x51fcbe,_0x554a26[0x0],_0x232633);}else{_0x246f3d=_0x232633;}}else{logger[_0x0c0e('0x6a')]('Warning:\x20agent\x20view\x20not\x20specified');}}else if(_0x188ccd===_0x0c0e('0x83')){_0x28a253=_0xda5241[_0x0c0e('0x81')]['scriptName'];_0x8991d9=_0xda5241[_0x0c0e('0x81')][_0x0c0e('0x8f')];if('undefined'!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')]){if(_0x0c0e('0x22')!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')]['admin']){var _0x221480=_0xda5241[_0x0c0e('0x81')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0x0c0e('0x8b')](_0x221480)){_0x454e9e=path[_0x0c0e('0x51')](_0x0c0e('0x8c'),_0x51fcbe,_0x554a26[0x0],_0x221480);}else{_0x454e9e=_0x221480;}}if(_0x0c0e('0x22')!=typeof _0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8e')]){var _0x232633=_0xda5241[_0x0c0e('0x81')][_0x0c0e('0x7f')][_0x0c0e('0x8e')];if(!/^(f|ht)tps?:\/\//i[_0x0c0e('0x8b')](_0x232633)){_0x246f3d=path[_0x0c0e('0x51')](_0x0c0e('0x8c'),_0x51fcbe,_0x554a26[0x0],_0x232633);}else{_0x246f3d=_0x232633;}}}}var _0x4a778c={'name':_0x26c84d,'description':_0x4019e3,'path':path[_0x0c0e('0x51')](_0x51fcbe,_0x554a26[0x0]),'type':_0x188ccd,'sidebar':_0x2b421c,'icon':_0x3be0cf,'adminUrl':_0x454e9e,'agentUrl':_0x246f3d,'scriptName':_0x28a253,'scriptPath':_0x8991d9,'version':_0xfa2eba};removeReferences(_0x306e66,null);return db[_0x0c0e('0x30')]['create'](_0x4a778c)[_0x0c0e('0x28')](function(_0x1ff946){var _0x48ee8c={'role':_0x5045f8[_0x0c0e('0x90')][_0x0c0e('0x91')],'userProfileId':_0x5045f8['body'][_0x0c0e('0x92')]};if(!_0x48ee8c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x48ee8c['role']===_0x0c0e('0x93')){var _0x241cbf=_0x1ff946['get']({'plain':!![]});return db['UserProfileSection'][_0x0c0e('0x4d')]({'where':{'name':'Plugins','userProfileId':_0x48ee8c[_0x0c0e('0x92')]},'raw':!![]})[_0x0c0e('0x28')](function(_0x32680e){if(_0x32680e&&_0x32680e[_0x0c0e('0x94')]===0x0){return db['UserProfileResource'][_0x0c0e('0x95')]({'name':_0x241cbf[_0x0c0e('0x2d')],'resourceId':_0x241cbf['id'],'type':_0x32680e['name'],'sectionId':_0x32680e['id']},{})['then'](function(){return _0x1ff946;});}else{return _0x1ff946;}})[_0x0c0e('0x4e')](function(_0x3b07f4){logger[_0x0c0e('0x5a')](_0x0c0e('0x96'),_0x3b07f4);throw _0x3b07f4;});}return _0x1ff946;})['then'](respondWithResult(_0x4b5858,null))[_0x0c0e('0x4e')](handleError(_0x4b5858,null));}});}catch(_0xbb3e98){_0x4b5858[_0x0c0e('0x1e')](0x1f4)['send'](_0xbb3e98);}};function removeReferences(_0x6a17e,_0x18bf82){try{if(_0x6a17e){fs[_0x0c0e('0x69')](_0x6a17e);logger[_0x0c0e('0x6a')](_0x0c0e('0x97'));}if(_0x18bf82){rimraf(_0x18bf82,function(){});logger[_0x0c0e('0x6a')](_0x0c0e('0x98'));}}catch(_0x152d14){logger[_0x0c0e('0x5a')](_0x152d14);}}exports[_0x0c0e('0x99')]=function(_0x2e2003,_0x18f7a3,_0x2baf54){return db[_0x0c0e('0x30')][_0x0c0e('0x4d')]({'where':{'id':_0x2e2003[_0x0c0e('0x4c')]['id']}})['then'](handleEntityNotFound(_0x18f7a3,null))['then'](saveUpdates(_0x2e2003[_0x0c0e('0x90')],null))[_0x0c0e('0x28')](respondWithResult(_0x18f7a3,null))[_0x0c0e('0x4e')](handleError(_0x18f7a3,null));};exports[_0x0c0e('0x9a')]=function(_0x42bd99,_0x24a34a,_0x2df21d){return db[_0x0c0e('0x30')][_0x0c0e('0x4d')]({'where':{'id':_0x42bd99[_0x0c0e('0x4c')]['id']}})['then'](function(_0x54d330){if(_0x54d330){return _0x54d330[_0x0c0e('0x29')]();}})[_0x0c0e('0x28')](function(_0x5bcd38){rimraf(path[_0x0c0e('0x51')](config['root'],_0x0c0e('0x53'),path[_0x0c0e('0x61')](_0x5bcd38[_0x0c0e('0x50')])),function(){});return _0x5bcd38;})[_0x0c0e('0x28')](handleEntityNotFound(_0x24a34a,null))[_0x0c0e('0x28')](respondWithStatusCode(_0x24a34a,null))[_0x0c0e('0x4e')](handleError(_0x24a34a,null));};exports['webhookGet']=function(_0x4ddab5,_0x48313c,_0x1838ae){return BPromise[_0x0c0e('0x9b')]()[_0x0c0e('0x28')](function(){if(!_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0x50')]){throw new Error(_0x0c0e('0x9c'));}if(!_0x4ddab5['query']['port']){throw new Error(_0x0c0e('0x9d'));}var _0x3f7722=_0x4ddab5['query']['hostname']?_0x4ddab5['query'][_0x0c0e('0x9e')]+':'+_0x4ddab5[_0x0c0e('0x34')]['port']:_0x0c0e('0x9f')+_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0xa0')];var _0x16c6ad=_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0x20')]?_0x4ddab5['query'][_0x0c0e('0x20')]:!![];var _0x437827=_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0xa1')]?_0x4ddab5[_0x0c0e('0x34')]['encoding']:null;var _0x109a98={'method':_0x4ddab5[_0x0c0e('0xa2')],'uri':util[_0x0c0e('0x54')]('%s%s',_0x3f7722,_0x4ddab5[_0x0c0e('0x34')][_0x0c0e('0x50')]),'json':_0x16c6ad,'resolveWithFullResponse':!![],'encoding':_0x437827,'qs':_0x4ddab5['query']};if(_0x4ddab5[_0x0c0e('0xa3')]){_0x109a98['headers']=_0x4ddab5[_0x0c0e('0xa3')];if(_0x109a98['headers'][_0x0c0e('0xa4')]){delete _0x109a98[_0x0c0e('0xa3')][_0x0c0e('0xa4')];}}if(_0x109a98[_0x0c0e('0xa3')][_0x0c0e('0xa5')]){delete _0x109a98[_0x0c0e('0xa3')]['content-type'];}return rp(_0x109a98);})[_0x0c0e('0x28')](function(_0xec907d){if(_0xec907d){_0x48313c['set'](_0xec907d[_0x0c0e('0xa3')]);logger[_0x0c0e('0x6a')](_0xec907d[_0x0c0e('0x90')]);if(_[_0x0c0e('0xa6')](_0x4ddab5['query'][_0x0c0e('0x50')],_0x0c0e('0x4f'))&&_0xec907d[_0x0c0e('0xa7')]==0x1f4){return _0x48313c[_0x0c0e('0x1d')](_0xec907d[_0x0c0e('0xa7')]);}else{return _0x48313c[_0x0c0e('0x1e')](_0xec907d['statusCode'])['send'](_0xec907d['body']);}}else{return _0x48313c[_0x0c0e('0x1d')](0xc8);}})[_0x0c0e('0x4e')](handleError(_0x48313c,null));};exports[_0x0c0e('0xa8')]=function(_0x49321f,_0x113972,_0x3b4e66){return BPromise[_0x0c0e('0x9b')]()[_0x0c0e('0x28')](function(){if(!_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x50')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x49321f[_0x0c0e('0x34')]['port']){throw new Error(_0x0c0e('0x9d'));}var _0x48b5b6=_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x9e')]?_0x49321f['query'][_0x0c0e('0x9e')]+':'+_0x49321f[_0x0c0e('0x34')][_0x0c0e('0xa0')]:_0x0c0e('0x9f')+_0x49321f[_0x0c0e('0x34')][_0x0c0e('0xa0')];var _0x351c74=_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x20')]?_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x20')]:!![];var _0x289295=_0x49321f['query']['encoding']?_0x49321f[_0x0c0e('0x34')][_0x0c0e('0xa1')]:null;var _0x357bdd={'method':_0x49321f[_0x0c0e('0xa2')],'uri':util[_0x0c0e('0x54')](_0x0c0e('0xa9'),_0x48b5b6,_0x49321f[_0x0c0e('0x34')][_0x0c0e('0x50')]),'json':_0x351c74,'resolveWithFullResponse':!![],'encoding':_0x289295,'body':_0x49321f[_0x0c0e('0x90')]};if(_0x49321f['headers']){_0x357bdd[_0x0c0e('0xa3')]=_0x49321f[_0x0c0e('0xa3')];if(_0x357bdd[_0x0c0e('0xa3')]['content-length']){delete _0x357bdd['headers'][_0x0c0e('0xa4')];}}if(_0x357bdd[_0x0c0e('0xa3')][_0x0c0e('0xa5')]){delete _0x357bdd[_0x0c0e('0xa3')][_0x0c0e('0xa5')];}return rp(_0x357bdd);})[_0x0c0e('0x28')](function(_0x27ddf1){if(_0x27ddf1){_0x113972[_0x0c0e('0xaa')](_0x27ddf1[_0x0c0e('0xa3')]);logger[_0x0c0e('0x6a')](_0x27ddf1[_0x0c0e('0x90')]);return _0x113972[_0x0c0e('0x1e')](_0x27ddf1[_0x0c0e('0xa7')])[_0x0c0e('0xab')](_0x27ddf1[_0x0c0e('0x90')]);}else{return _0x113972[_0x0c0e('0x1d')](0xc8);}})[_0x0c0e('0x4e')](handleError(_0x113972,null));};
\ No newline at end of file
index 827d714..a7cb9e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13fe=['events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x23d706,_0x12b65b){var _0x66611c=function(_0x1b2192){while(--_0x1b2192){_0x23d706['push'](_0x23d706['shift']());}};_0x66611c(++_0x12b65b);}(_0x13fe,0x138));var _0xe13f=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x13fe[_0x433a86];return _0x23000c;};'use strict';var EventEmitter=require(_0xe13f('0x0'));var Plugin=require(_0xe13f('0x1'))['db'][_0xe13f('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe13f('0x3')](0x0);var events={'afterCreate':_0xe13f('0x4'),'afterUpdate':_0xe13f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x348f9b){return function(_0x466eee,_0x19c559,_0x2c70b9){PluginEvents[_0xe13f('0x6')](_0x348f9b+':'+_0x466eee['id'],_0x466eee);PluginEvents[_0xe13f('0x6')](_0x348f9b,_0x466eee);_0x2c70b9(null);};}for(var e in events){if(events[_0xe13f('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents;
\ No newline at end of file
+var _0x297f=['../../mysqldb','save','update','remove','emit','hasOwnProperty','events'];(function(_0x385358,_0x4aebf7){var _0x5bd30f=function(_0x552c4f){while(--_0x552c4f){_0x385358['push'](_0x385358['shift']());}};_0x5bd30f(++_0x4aebf7);}(_0x297f,0x1f0));var _0xf297=function(_0x45149b,_0x24a12b){_0x45149b=_0x45149b-0x0;var _0x194261=_0x297f[_0x45149b];return _0x194261;};'use strict';var EventEmitter=require(_0xf297('0x0'));var Plugin=require(_0xf297('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf297('0x2'),'afterUpdate':_0xf297('0x3'),'afterDestroy':_0xf297('0x4')};function emitEvent(_0x39ec01){return function(_0x586413,_0x462efe,_0x4a736d){PluginEvents[_0xf297('0x5')](_0x39ec01+':'+_0x586413['id'],_0x586413);PluginEvents[_0xf297('0x5')](_0x39ec01,_0x586413);_0x4a736d(null);};}for(var e in events){if(events[_0xf297('0x6')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module['exports']=PluginEvents;
\ No newline at end of file
index e157adb..318422d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xba77=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash'];(function(_0x59b524,_0xc1d0a4){var _0x25679b=function(_0x1e2aa4){while(--_0x1e2aa4){_0x59b524['push'](_0x59b524['shift']());}};_0x25679b(++_0xc1d0a4);}(_0xba77,0x133));var _0x7ba7=function(_0x4db46b,_0xadcb1a){_0x4db46b=_0x4db46b-0x0;var _0x565be8=_0xba77[_0x4db46b];return _0x565be8;};'use strict';var _=require(_0x7ba7('0x0'));var util=require(_0x7ba7('0x1'));var logger=require(_0x7ba7('0x2'))(_0x7ba7('0x3'));var moment=require(_0x7ba7('0x4'));var BPromise=require('bluebird');var rp=require(_0x7ba7('0x5'));var fs=require('fs');var path=require(_0x7ba7('0x6'));var rimraf=require(_0x7ba7('0x7'));var config=require(_0x7ba7('0x8'));var attributes=require(_0x7ba7('0x9'));module[_0x7ba7('0xa')]=function(_0x199dda,_0x2cf4dc){return _0x199dda[_0x7ba7('0xb')](_0x7ba7('0xc'),attributes,{'tableName':_0x7ba7('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1f2f=['path','../../config/environment','./plugin.attributes','exports','define','plugins','lodash','../../config/logger','moment','request-promise'];(function(_0x273963,_0x20a0ae){var _0x462e19=function(_0xcbbf22){while(--_0xcbbf22){_0x273963['push'](_0x273963['shift']());}};_0x462e19(++_0x20a0ae);}(_0x1f2f,0x1d2));var _0xf1f2=function(_0x1e0c0e,_0x5ccb80){_0x1e0c0e=_0x1e0c0e-0x0;var _0x53fecc=_0x1f2f[_0x1e0c0e];return _0x53fecc;};'use strict';var _=require(_0xf1f2('0x0'));var util=require('util');var logger=require(_0xf1f2('0x1'))('api');var moment=require(_0xf1f2('0x2'));var BPromise=require('bluebird');var rp=require(_0xf1f2('0x3'));var fs=require('fs');var path=require(_0xf1f2('0x4'));var rimraf=require('rimraf');var config=require(_0xf1f2('0x5'));var attributes=require(_0xf1f2('0x6'));module[_0xf1f2('0x7')]=function(_0x3a30a5,_0x78012d){return _0x3a30a5[_0xf1f2('0x8')]('Plugin',attributes,{'tableName':_0xf1f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8bc8c4e..17c3270 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x64a5=['localhost','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreatePlugin','body','options','raw','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults'];(function(_0x38a951,_0xa8e31){var _0x36e88e=function(_0x53e70c){while(--_0x53e70c){_0x38a951['push'](_0x38a951['shift']());}};_0x36e88e(++_0xa8e31);}(_0x64a5,0xc6));var _0x564a=function(_0x31611f,_0x1e6d20){_0x31611f=_0x31611f-0x0;var _0x3185e6=_0x64a5[_0x31611f];return _0x3185e6;};'use strict';var _=require(_0x564a('0x0'));var util=require(_0x564a('0x1'));var moment=require(_0x564a('0x2'));var BPromise=require('bluebird');var rs=require(_0x564a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x564a('0x4'))['db'];var utils=require(_0x564a('0x5'));var logger=require(_0x564a('0x6'))(_0x564a('0x7'));var config=require('../../config/environment');var jayson=require(_0x564a('0x8'));var client=jayson[_0x564a('0x9')]['http']({'port':0x232a});config[_0x564a('0xa')]=_[_0x564a('0xb')](config[_0x564a('0xa')],{'host':_0x564a('0xc'),'port':0x18eb});var socket=require(_0x564a('0xd'))(new Redis(config[_0x564a('0xa')]));require(_0x564a('0xe'))['register'](socket);function respondWithRpcPromise(_0x2c1cef,_0x498f28,_0xe755fe){return new BPromise(function(_0xbfce71,_0x3258c1){return client[_0x564a('0xf')](_0x2c1cef,_0xe755fe)['then'](function(_0x4b8ed4){logger[_0x564a('0x10')](_0x564a('0x11'),_0x498f28,_0x564a('0x12'));logger[_0x564a('0x13')](_0x564a('0x14'),_0x498f28,_0x564a('0x12'),JSON[_0x564a('0x15')](_0x4b8ed4));if(_0x4b8ed4['error']){if(_0x4b8ed4[_0x564a('0x16')][_0x564a('0x17')]===0x1f4){logger[_0x564a('0x16')](_0x564a('0x11'),_0x498f28,_0x4b8ed4[_0x564a('0x16')][_0x564a('0x18')]);return _0x3258c1(_0x4b8ed4['error'][_0x564a('0x18')]);}logger['error']('Plugin,\x20%s,\x20%s',_0x498f28,_0x4b8ed4[_0x564a('0x16')][_0x564a('0x18')]);return _0xbfce71(_0x4b8ed4[_0x564a('0x16')][_0x564a('0x18')]);}else{logger[_0x564a('0x10')](_0x564a('0x11'),_0x498f28,_0x564a('0x12'));_0xbfce71(_0x4b8ed4['result']['message']);}})[_0x564a('0x19')](function(_0x1f5110){logger[_0x564a('0x16')]('Plugin,\x20%s,\x20%s',_0x498f28,_0x1f5110);_0x3258c1(_0x1f5110);});});}exports[_0x564a('0x1a')]=function(_0x5bde31){var _0x1fd6bd=this;return new Promise(function(_0x16a4ea,_0x532a2f){return db['Plugin']['create'](_0x5bde31[_0x564a('0x1b')],{'raw':_0x5bde31[_0x564a('0x1c')]?_0x5bde31[_0x564a('0x1c')][_0x564a('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x1bd8f2){logger[_0x564a('0x10')](_0x564a('0x1a'),_0x5bde31);logger['debug'](_0x564a('0x1a'),_0x5bde31,JSON[_0x564a('0x15')](_0x1bd8f2));_0x16a4ea(_0x1bd8f2);})[_0x564a('0x19')](function(_0x2af182){logger[_0x564a('0x16')](_0x564a('0x1a'),_0x2af182[_0x564a('0x18')],_0x5bde31);_0x532a2f(_0x1fd6bd[_0x564a('0x16')](0x1f4,_0x2af182[_0x564a('0x18')]));});});};
\ No newline at end of file
+var _0xa4e3=['body','options','raw','CreatePlugin','debug','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create'];(function(_0x3056aa,_0x58f587){var _0xd4bd5c=function(_0x1a4408){while(--_0x1a4408){_0x3056aa['push'](_0x3056aa['shift']());}};_0xd4bd5c(++_0x58f587);}(_0xa4e3,0x17c));var _0x3a4e=function(_0x40c115,_0x2b91da){_0x40c115=_0x40c115-0x0;var _0x4ec04f=_0xa4e3[_0x40c115];return _0x4ec04f;};'use strict';var _=require(_0x3a4e('0x0'));var util=require(_0x3a4e('0x1'));var moment=require('moment');var BPromise=require(_0x3a4e('0x2'));var rs=require(_0x3a4e('0x3'));var fs=require('fs');var Redis=require(_0x3a4e('0x4'));var db=require(_0x3a4e('0x5'))['db'];var utils=require(_0x3a4e('0x6'));var logger=require(_0x3a4e('0x7'))(_0x3a4e('0x8'));var config=require(_0x3a4e('0x9'));var jayson=require(_0x3a4e('0xa'));var client=jayson[_0x3a4e('0xb')][_0x3a4e('0xc')]({'port':0x232a});config[_0x3a4e('0xd')]=_[_0x3a4e('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3a4e('0xf'))(new Redis(config[_0x3a4e('0xd')]));require('./plugin.socket')['register'](socket);function respondWithRpcPromise(_0x191ccb,_0x4e7ca4,_0x40e403){return new BPromise(function(_0x2f9c97,_0xb737c){return client[_0x3a4e('0x10')](_0x191ccb,_0x40e403)[_0x3a4e('0x11')](function(_0x3eadbf){logger[_0x3a4e('0x12')](_0x3a4e('0x13'),_0x4e7ca4,_0x3a4e('0x14'));logger['debug'](_0x3a4e('0x15'),_0x4e7ca4,_0x3a4e('0x14'),JSON[_0x3a4e('0x16')](_0x3eadbf));if(_0x3eadbf[_0x3a4e('0x17')]){if(_0x3eadbf['error'][_0x3a4e('0x18')]===0x1f4){logger['error'](_0x3a4e('0x13'),_0x4e7ca4,_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);return _0xb737c(_0x3eadbf[_0x3a4e('0x17')]['message']);}logger[_0x3a4e('0x17')](_0x3a4e('0x13'),_0x4e7ca4,_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);return _0x2f9c97(_0x3eadbf[_0x3a4e('0x17')][_0x3a4e('0x19')]);}else{logger[_0x3a4e('0x12')](_0x3a4e('0x13'),_0x4e7ca4,'request\x20sent');_0x2f9c97(_0x3eadbf[_0x3a4e('0x1a')][_0x3a4e('0x19')]);}})['catch'](function(_0x5daf23){logger['error']('Plugin,\x20%s,\x20%s',_0x4e7ca4,_0x5daf23);_0xb737c(_0x5daf23);});});}exports['CreatePlugin']=function(_0x5778c8){var _0x526e5d=this;return new Promise(function(_0x3f631f,_0xd6c77d){return db['Plugin'][_0x3a4e('0x1b')](_0x5778c8[_0x3a4e('0x1c')],{'raw':_0x5778c8[_0x3a4e('0x1d')]?_0x5778c8[_0x3a4e('0x1d')][_0x3a4e('0x1e')]===undefined?!![]:![]:!![]})[_0x3a4e('0x11')](function(_0x3dd607){logger[_0x3a4e('0x12')](_0x3a4e('0x1f'),_0x5778c8);logger[_0x3a4e('0x20')](_0x3a4e('0x1f'),_0x5778c8,JSON['stringify'](_0x3dd607));_0x3f631f(_0x3dd607);})[_0x3a4e('0x21')](function(_0x30bbda){logger[_0x3a4e('0x17')](_0x3a4e('0x1f'),_0x30bbda['message'],_0x5778c8);_0xd6c77d(_0x526e5d[_0x3a4e('0x17')](0x1f4,_0x30bbda[_0x3a4e('0x19')]));});});};
\ No newline at end of file
index c659e0b..05c4f60 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x02ff=['length','plugin:','./plugin.events','save','remove','emit','register'];(function(_0x34c063,_0x11d3d7){var _0x2c63a3=function(_0x5983d0){while(--_0x5983d0){_0x34c063['push'](_0x34c063['shift']());}};_0x2c63a3(++_0x11d3d7);}(_0x02ff,0x198));var _0xf02f=function(_0x409863,_0x351c15){_0x409863=_0x409863-0x0;var _0x184c99=_0x02ff[_0x409863];return _0x184c99;};'use strict';var PluginEvents=require(_0xf02f('0x0'));var events=[_0xf02f('0x1'),_0xf02f('0x2'),'update'];function createListener(_0x43eb05,_0x1edf45){return function(_0x3d71c3){_0x1edf45[_0xf02f('0x3')](_0x43eb05,_0x3d71c3);};}function removeListener(_0x46abda,_0x54f279){return function(){PluginEvents['removeListener'](_0x46abda,_0x54f279);};}exports[_0xf02f('0x4')]=function(_0x4ae994){for(var _0x6c73e1=0x0,_0x3e3fc6=events[_0xf02f('0x5')];_0x6c73e1<_0x3e3fc6;_0x6c73e1++){var _0x1df70b=events[_0x6c73e1];var _0x68aa1c=createListener(_0xf02f('0x6')+_0x1df70b,_0x4ae994);PluginEvents['on'](_0x1df70b,_0x68aa1c);}};
\ No newline at end of file
+var _0x8a6a=['./plugin.events','update','emit','length','plugin:'];(function(_0x2f672a,_0x25e21a){var _0x26d058=function(_0x233387){while(--_0x233387){_0x2f672a['push'](_0x2f672a['shift']());}};_0x26d058(++_0x25e21a);}(_0x8a6a,0x96));var _0xa8a6=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8a6a[_0x311c35];return _0x5cc50c;};'use strict';var PluginEvents=require(_0xa8a6('0x0'));var events=['save','remove',_0xa8a6('0x1')];function createListener(_0x501473,_0x1a7bd7){return function(_0xbc57bf){_0x1a7bd7[_0xa8a6('0x2')](_0x501473,_0xbc57bf);};}function removeListener(_0x27a2f9,_0x2bb6fa){return function(){PluginEvents['removeListener'](_0x27a2f9,_0x2bb6fa);};}exports['register']=function(_0x4f1777){for(var _0xdbe031=0x0,_0x530649=events[_0xa8a6('0x3')];_0xdbe031<_0x530649;_0xdbe031++){var _0x2882f1=events[_0xdbe031];var _0x4d34c5=createListener(_0xa8a6('0x4')+_0x2882f1,_0x4f1777);PluginEvents['on'](_0x2882f1,_0x4d34c5);}};
\ No newline at end of file
index 9f12203..1378bd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x2f08c1,_0x1a7607){var _0x2200f5=function(_0x57afd9){while(--_0x57afd9){_0x2f08c1['push'](_0x2f08c1['shift']());}};_0x2200f5(++_0x1a7607);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router;
\ No newline at end of file
+var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x4698db,_0x5c99bb){var _0x547af6=function(_0x56425c){while(--_0x56425c){_0x4698db['push'](_0x4698db['shift']());}};_0x547af6(++_0x5c99bb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router;
\ No newline at end of file
index e67b63f..b697226 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fdb=['lodash','../../config/pm2','../../config/logger','api','path','child_process','exec','bluebird','status','json','error','stack','name','send','npm\x20install','info','index','then','reject','express','motion2','length','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dump','restart','stop','hasOwnProperty','Unknown\x20status','destroy','Unknown\x20id'];(function(_0x13fdcf,_0x256a86){var _0x84d9e8=function(_0x3e7ef6){while(--_0x3e7ef6){_0x13fdcf['push'](_0x13fdcf['shift']());}};_0x84d9e8(++_0x256a86);}(_0x4fdb,0x9c));var _0xb4fd=function(_0xd1a136,_0x55b861){_0xd1a136=_0xd1a136-0x0;var _0x416daa=_0x4fdb[_0xd1a136];return _0x416daa;};'use strict';var _=require(_0xb4fd('0x0'));var pm2=require(_0xb4fd('0x1'));var logger=require(_0xb4fd('0x2'))(_0xb4fd('0x3'));var path=require(_0xb4fd('0x4'));var exec=require(_0xb4fd('0x5'))[_0xb4fd('0x6')];var BPromise=require(_0xb4fd('0x7'));function handleEntityNotFound(_0x1c0b08,_0x5b73bb){return function(_0x308de6){if(!_0x308de6){_0x1c0b08['sendStatus'](0x194);;}return _0x308de6;};}function respondWithResult(_0x14052b,_0x5d8b39){_0x5d8b39=_0x5d8b39||0xc8;return function(_0x53273f){if(_0x53273f){return _0x14052b[_0xb4fd('0x8')](_0x5d8b39)[_0xb4fd('0x9')](_0x53273f);}return null;};}function handleError(_0x1151b5,_0x52dca2){_0x52dca2=_0x52dca2||0x1f4;return function(_0x526d3b){logger[_0xb4fd('0xa')](_0x526d3b[_0xb4fd('0xb')]);if(_0x526d3b[_0xb4fd('0xc')]){delete _0x526d3b['name'];}_0x1151b5[_0xb4fd('0x8')](_0x52dca2)[_0xb4fd('0xd')](_0x526d3b);};}function execChildProcess(){return new BPromise(function(_0x2148db,_0x23b08f){exec(_0xb4fd('0xe'),function(_0x502379,_0xd05458,_0x1f3e30){logger[_0xb4fd('0xf')](_0xd05458);logger[_0xb4fd('0xf')](_0x1f3e30);if(_0x502379){logger['error'](_0x502379);return _0x23b08f(_0x502379);}return _0x2148db(_0xd05458);});});}exports[_0xb4fd('0x10')]=function(_0x65f08a,_0x345d35){return pm2['list']()[_0xb4fd('0x11')](function(_0x1234d7){if(_0x1234d7){var _0xc35d8d=_[_0xb4fd('0x12')](_0x1234d7,function(_0x36e88f){return _0x36e88f[_0xb4fd('0xc')]===_0xb4fd('0x13')||_0x36e88f['name']===_0xb4fd('0x14');});return{'rows':_0xc35d8d,'count':_0xc35d8d[_0xb4fd('0x15')]};}return null;})[_0xb4fd('0x11')](respondWithResult(_0x345d35,null))[_0xb4fd('0x16')](handleError(_0x345d35,null));};exports[_0xb4fd('0x17')]=function(_0x137e51,_0x1d0812){return pm2[_0xb4fd('0x18')](_0x137e51[_0xb4fd('0x19')]['id'])[_0xb4fd('0x11')](respondWithResult(_0x1d0812,null))[_0xb4fd('0x11')](handleEntityNotFound(_0x1d0812,null))['catch'](handleError(_0x1d0812,null));};exports['create']=function(_0x504e80,_0x5c14c0){if(_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')]&&_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0x1b')]){var _0x458133=path[_0xb4fd('0x1c')](__dirname,_0xb4fd('0x1d'),_0x504e80['body']['script']);var _0x216307=process[_0xb4fd('0x1e')]();process[_0xb4fd('0x1f')](path['dirname'](_0x458133));return execChildProcess()[_0xb4fd('0x11')](function(_0x49d42c){process[_0xb4fd('0x1f')](_0x216307);return pm2['start']({'name':_0x504e80[_0xb4fd('0x1a')][_0xb4fd('0xc')],'script':_0x458133});})[_0xb4fd('0x11')](function(_0x261eda){pm2[_0xb4fd('0x20')]();return _0x261eda[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x5c14c0,0xc9))[_0xb4fd('0x16')](handleError(_0x5c14c0,null));}else{return _0x5c14c0[_0xb4fd('0x8')](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports['update']=function(_0x453982,_0x4bad85){if(_0x453982[_0xb4fd('0x1a')]['id']){delete _0x453982['body']['id'];}var _0x5738c2={'online':_0xb4fd('0x21'),'stopped':_0xb4fd('0x22')};if(_0x5738c2[_0xb4fd('0x23')](_0x453982['body'][_0xb4fd('0x8')])){return pm2[_0x5738c2[_0x453982[_0xb4fd('0x1a')][_0xb4fd('0x8')]]](_0x453982[_0xb4fd('0x19')]['id'])['then'](respondWithResult(_0x4bad85,0xc8))[_0xb4fd('0x16')](handleError(_0x4bad85,null));}else{return _0x4bad85[_0xb4fd('0x8')](0x1f4)['send']({'message':_0xb4fd('0x24')});}};exports[_0xb4fd('0x25')]=function(_0xbe7d2c,_0x597874){if(_0xbe7d2c[_0xb4fd('0x1a')]['id']){delete _0xbe7d2c[_0xb4fd('0x1a')]['id'];}if(_0xbe7d2c[_0xb4fd('0x19')]['id']){return pm2['delete'](_0xbe7d2c['params']['id'])['then'](function(_0x5f36e4){pm2[_0xb4fd('0x20')]();return _0x5f36e4[0x0];})[_0xb4fd('0x11')](respondWithResult(_0x597874,null))[_0xb4fd('0x16')](handleError(_0x597874,null));}else{return _0x597874[_0xb4fd('0x8')](0x1f4)[_0xb4fd('0xd')]({'message':_0xb4fd('0x26')});}};
\ No newline at end of file
+var _0xb688=['error','stack','name','send','info','index','then','reject','motion2','catch','show','describe','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','update','stop','Unknown\x20status','destroy','Unknown\x20id','../../config/pm2','../../config/logger','api','path','child_process','exec','sendStatus','status','json'];(function(_0x49a1a0,_0x48f776){var _0x518a4f=function(_0x313633){while(--_0x313633){_0x49a1a0['push'](_0x49a1a0['shift']());}};_0x518a4f(++_0x48f776);}(_0xb688,0xcf));var _0x8b68=function(_0x279624,_0x555b65){_0x279624=_0x279624-0x0;var _0x533513=_0xb688[_0x279624];return _0x533513;};'use strict';var _=require('lodash');var pm2=require(_0x8b68('0x0'));var logger=require(_0x8b68('0x1'))(_0x8b68('0x2'));var path=require(_0x8b68('0x3'));var exec=require(_0x8b68('0x4'))[_0x8b68('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x41030e,_0x27925d){return function(_0x30f33d){if(!_0x30f33d){_0x41030e[_0x8b68('0x6')](0x194);;}return _0x30f33d;};}function respondWithResult(_0x583d16,_0x34314e){_0x34314e=_0x34314e||0xc8;return function(_0x57ee56){if(_0x57ee56){return _0x583d16[_0x8b68('0x7')](_0x34314e)[_0x8b68('0x8')](_0x57ee56);}return null;};}function handleError(_0x130892,_0xa5571b){_0xa5571b=_0xa5571b||0x1f4;return function(_0x132617){logger[_0x8b68('0x9')](_0x132617[_0x8b68('0xa')]);if(_0x132617[_0x8b68('0xb')]){delete _0x132617[_0x8b68('0xb')];}_0x130892[_0x8b68('0x7')](_0xa5571b)[_0x8b68('0xc')](_0x132617);};}function execChildProcess(){return new BPromise(function(_0x317d01,_0x2a852a){exec('npm\x20install',function(_0x2c0f3b,_0x4426d1,_0x5e76c){logger[_0x8b68('0xd')](_0x4426d1);logger[_0x8b68('0xd')](_0x5e76c);if(_0x2c0f3b){logger[_0x8b68('0x9')](_0x2c0f3b);return _0x2a852a(_0x2c0f3b);}return _0x317d01(_0x4426d1);});});}exports[_0x8b68('0xe')]=function(_0x137c8e,_0x2686c7){return pm2['list']()[_0x8b68('0xf')](function(_0x509033){if(_0x509033){var _0x5e3c66=_[_0x8b68('0x10')](_0x509033,function(_0x1554d6){return _0x1554d6[_0x8b68('0xb')]==='express'||_0x1554d6['name']===_0x8b68('0x11');});return{'rows':_0x5e3c66,'count':_0x5e3c66['length']};}return null;})[_0x8b68('0xf')](respondWithResult(_0x2686c7,null))[_0x8b68('0x12')](handleError(_0x2686c7,null));};exports[_0x8b68('0x13')]=function(_0x10c9c6,_0x491695){return pm2[_0x8b68('0x14')](_0x10c9c6[_0x8b68('0x15')]['id'])['then'](respondWithResult(_0x491695,null))[_0x8b68('0xf')](handleEntityNotFound(_0x491695,null))[_0x8b68('0x12')](handleError(_0x491695,null));};exports[_0x8b68('0x16')]=function(_0x17f321,_0x38b7a7){if(_0x17f321['body'][_0x8b68('0xb')]&&_0x17f321[_0x8b68('0x17')][_0x8b68('0x18')]){var _0x1a9788=path[_0x8b68('0x19')](__dirname,_0x8b68('0x1a'),_0x17f321['body']['script']);var _0x23edc1=process['cwd']();process[_0x8b68('0x1b')](path[_0x8b68('0x1c')](_0x1a9788));return execChildProcess()[_0x8b68('0xf')](function(_0x21ecca){process[_0x8b68('0x1b')](_0x23edc1);return pm2[_0x8b68('0x1d')]({'name':_0x17f321['body'][_0x8b68('0xb')],'script':_0x1a9788});})[_0x8b68('0xf')](function(_0x4ca77d){pm2[_0x8b68('0x1e')]();return _0x4ca77d[0x0];})[_0x8b68('0xf')](respondWithResult(_0x38b7a7,0xc9))[_0x8b68('0x12')](handleError(_0x38b7a7,null));}else{return _0x38b7a7['status'](0x1f4)['send']({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0x8b68('0x1f')]=function(_0x448e43,_0x2ba2a3){if(_0x448e43['body']['id']){delete _0x448e43[_0x8b68('0x17')]['id'];}var _0x53aaa2={'online':'restart','stopped':_0x8b68('0x20')};if(_0x53aaa2['hasOwnProperty'](_0x448e43[_0x8b68('0x17')][_0x8b68('0x7')])){return pm2[_0x53aaa2[_0x448e43['body']['status']]](_0x448e43[_0x8b68('0x15')]['id'])[_0x8b68('0xf')](respondWithResult(_0x2ba2a3,0xc8))[_0x8b68('0x12')](handleError(_0x2ba2a3,null));}else{return _0x2ba2a3[_0x8b68('0x7')](0x1f4)[_0x8b68('0xc')]({'message':_0x8b68('0x21')});}};exports[_0x8b68('0x22')]=function(_0x5b7ed1,_0x3b6d1b){if(_0x5b7ed1['body']['id']){delete _0x5b7ed1[_0x8b68('0x17')]['id'];}if(_0x5b7ed1[_0x8b68('0x15')]['id']){return pm2['delete'](_0x5b7ed1[_0x8b68('0x15')]['id'])[_0x8b68('0xf')](function(_0x26fe0e){pm2['dump']();return _0x26fe0e[0x0];})['then'](respondWithResult(_0x3b6d1b,null))[_0x8b68('0x12')](handleError(_0x3b6d1b,null));}else{return _0x3b6d1b[_0x8b68('0x7')](0x1f4)[_0x8b68('0xc')]({'message':_0x8b68('0x23')});}};
\ No newline at end of file
index cdcb1e8..167cdb1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bc0=['getQueues','express','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues'];(function(_0x4cc771,_0x3cd440){var _0x48d914=function(_0x58b674){while(--_0x58b674){_0x4cc771['push'](_0x4cc771['shift']());}};_0x48d914(++_0x3cd440);}(_0x2bc0,0x1de));var _0x02bc=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x2bc0[_0x21a9d9];return _0x46adce;};'use strict';var express=require(_0x02bc('0x0'));var router=express['Router']();var auth=require(_0x02bc('0x1'));var controller=require(_0x02bc('0x2'));router[_0x02bc('0x3')](_0x02bc('0x4'),auth[_0x02bc('0x5')](),controller[_0x02bc('0x6')]);router[_0x02bc('0x3')](_0x02bc('0x7'),auth[_0x02bc('0x5')](),controller[_0x02bc('0x8')]);module['exports']=router;
\ No newline at end of file
+var _0xef10=['get','isAuthenticated','getAgents','/queues','getQueues','exports','Router','../../components/auth/service','./realtime.controller'];(function(_0x534c8f,_0x500079){var _0x5a57f5=function(_0x38ec0a){while(--_0x38ec0a){_0x534c8f['push'](_0x534c8f['shift']());}};_0x5a57f5(++_0x500079);}(_0xef10,0x84));var _0x0ef1=function(_0x48aa9f,_0x26e09d){_0x48aa9f=_0x48aa9f-0x0;var _0x1efb5f=_0xef10[_0x48aa9f];return _0x1efb5f;};'use strict';var express=require('express');var router=express[_0x0ef1('0x0')]();var auth=require(_0x0ef1('0x1'));var controller=require(_0x0ef1('0x2'));router[_0x0ef1('0x3')]('/agents',auth[_0x0ef1('0x4')](),controller[_0x0ef1('0x5')]);router[_0x0ef1('0x3')](_0x0ef1('0x6'),auth['isAuthenticated'](),controller[_0x0ef1('0x7')]);module[_0x0ef1('0x8')]=router;
\ No newline at end of file
index 42e6780..8399506 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb330=['UserProfile','getRealtimeQueues','catch','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../errors/api','APIBadRequestError','offset','undefined','count','limit','status','set','Content-Range','json','getAgents','getChannels','globalStatusFilter','query','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','push','sequelize','literal','Pause','forEach','merge','where','user','userProfileId','Agents','online','extraQueryConditions','assign','getResources','find','filterAgentAttributes','includes','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','startCase','map','fields','outbound','dialMethod','join','QueueCampaigns','Queues','name','filter'];(function(_0x86323e,_0x918bf7){var _0x38e833=function(_0x2faf07){while(--_0x2faf07){_0x86323e['push'](_0x86323e['shift']());}};_0x38e833(++_0x918bf7);}(_0xb330,0xad));var _0x0b33=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb330[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b33('0x0'));var util=require(_0x0b33('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x0b33('0x2'));var qs=require(_0x0b33('0x3'));var utils=require('../../config/utils');var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x0b33('0x4'))[_0x0b33('0x5')];var APIHandleError=require(_0x0b33('0x4'))['handleError'];function respondWithFilteredResult(_0x54d40f,_0x61a8fa){return function(_0x344490){if(_0x344490){var _0x2e3f20=typeof _0x61a8fa[_0x0b33('0x6')]===_0x0b33('0x7')&&typeof _0x61a8fa['limit']==='undefined';var _0x38ca49=_0x344490[_0x0b33('0x8')];var _0x3e1b7a=_0x2e3f20?0x0:_0x61a8fa[_0x0b33('0x6')];var _0xdd40ac=_0x2e3f20?_0x344490['count']:_0x61a8fa[_0x0b33('0x6')]+_0x61a8fa[_0x0b33('0x9')];var _0x50f04c;if(_0xdd40ac>=_0x38ca49){_0xdd40ac=_0x38ca49;_0x50f04c=0xc8;}else{_0x50f04c=0xce;}_0x54d40f[_0x0b33('0xa')](_0x50f04c);return _0x54d40f[_0x0b33('0xb')](_0x0b33('0xc'),_0x3e1b7a+'-'+_0xdd40ac+'/'+_0x38ca49)[_0x0b33('0xd')](_0x344490);}return null;};}exports[_0x0b33('0xe')]=function(_0x49e802,_0x3eb998){var _0x13a93b={'count':0x0,'rows':[]};var _0x856b28={};var _0x5c58b6;var _0x241edd=utils[_0x0b33('0xf')]();var _0x170572;var _0x1a6599;var _0x5d8769=_0x49e802['query']['globalQueueFilter'];var _0x5df28e=_0x49e802['query'][_0x0b33('0x10')];var _0x1b667a=_0x49e802[_0x0b33('0x11')][_0x0b33('0x12')];var _0x172b4e=_0x5df28e===_0x0b33('0x13')||_0x5df28e===_0x0b33('0x14')?!![]:![];var _0x207674=[];var _0x1e4d6c;var _0x21b92d;Promise[_0x0b33('0x15')]()[_0x0b33('0x16')](function(){if(_0x49e802[_0x0b33('0x11')][_0x0b33('0x17')]){if(!utils[_0x0b33('0x18')](_0x49e802['query']['channel'])){throw new APIBadRequestError(util[_0x0b33('0x19')](_0x0b33('0x1a'),_0x49e802['query'][_0x0b33('0x17')]));}_0x5c58b6=_0x49e802[_0x0b33('0x11')]['channel'][_0x0b33('0x1b')]();}if(!_0x49e802[_0x0b33('0x11')]['sort']||!_0x49e802[_0x0b33('0x11')][_0x0b33('0x1c')]['includes'](_0x0b33('0x1d'))){_0x49e802[_0x0b33('0x11')][_0x0b33('0x1c')]=rta[_0x0b33('0x1e')](_0x49e802[_0x0b33('0x11')][_0x0b33('0x1c')]);return;}var _0x574343=rta[_0x0b33('0x1f')](_0x49e802[_0x0b33('0x11')][_0x0b33('0x1c')]);_0x49e802['query'][_0x0b33('0x1c')]=_0x574343['fields']['join'](',');_0x1e4d6c=_0x574343[_0x0b33('0x20')];})['then'](function(){if(!_0x5d8769){return[];}return rta[_0x0b33('0x21')](_0x5d8769,_0x5c58b6);})[_0x0b33('0x16')](function(_0x3c4f1c){_0x207674=_0x3c4f1c;return rta['getRealtimeAgents']();})[_0x0b33('0x16')](function(_0x55d200){_0x1a6599=_0x55d200[_0x0b33('0x22')];if((!_0x5df28e||_0x172b4e)&&!_0x1e4d6c){return _0x207674;}if(_0x1e4d6c&&!_0x5df28e){return rta[_0x0b33('0x23')](_0x1a6599,_0x207674,_0x1e4d6c);}else{return rta[_0x0b33('0x24')](_0x1a6599,_0x207674,_0x5df28e);}})[_0x0b33('0x16')](function(_0x5121d9){_0x207674=_0x5121d9;var _0x20b0a0=![];if(_0x207674['length']===0x0){if(_0x5d8769||_0x5df28e){_0x20b0a0=!![];}if(_0x172b4e){_0x20b0a0=![];}}if(_0x20b0a0){return _0x13a93b;}var _0x1bc7cc=_['map'](db[_0x0b33('0x25')][_0x0b33('0x26')],function(_0x469818){return{'name':_0x469818[_0x0b33('0x27')],'type':_0x469818[_0x0b33('0x28')][_0x0b33('0x29')]};});_0x49e802[_0x0b33('0x11')][_0x0b33('0x2a')]=_0x0b33('0x2b');_0x856b28=qs[_0x0b33('0x2c')](_0x1bc7cc,_0x49e802);_0x856b28[_0x0b33('0x2d')]=!![];var _0x2b065d=[];if(_0x207674[_0x0b33('0x2e')]>0x0){_0x2b065d[_0x0b33('0x2f')]({'id':{'$in':_0x207674}});if(_0x1e4d6c&&!_0x5df28e){_0x21b92d=[db[_0x0b33('0x30')][_0x0b33('0x31')]('FIELD(id,'+_0x207674+')')];_0x856b28[_0x0b33('0x20')]=_0x21b92d;}}if(_0x172b4e){_0x241edd['forEach'](function(_0x4a4cca){var _0x2bacd4=!![];if(_0x5df28e===_0x0b33('0x14')&&_0x5c58b6!==_0x4a4cca){_0x2bacd4=![];}_0x2b065d[_0x0b33('0x2f')]({[_0x4a4cca+_0x0b33('0x32')]:_0x2bacd4});});if(_0x1b667a){_0x2b065d[_0x0b33('0x2f')]({'pauseType':_0x1b667a});}}else if(_0x5df28e){_0x241edd[_0x0b33('0x33')](function(_0x28245d){_0x2b065d['push']({[_0x28245d+'Pause']:![]});});}_0x856b28['where']=_[_0x0b33('0x34')](_0x856b28[_0x0b33('0x35')],{'$and':_0x2b065d});if(_0x49e802['user'][_0x0b33('0x2a')]===_0x0b33('0x36')){var _0x14f912={'params':{'id':_0x49e802['user'][_0x0b33('0x37')]},'query':{'section':_0x0b33('0x38'),'role':_0x0b33('0x2b'),'raw':!![],'ids':_0x207674,'customSorting':_0x21b92d}};if(_0x49e802[_0x0b33('0x11')][_0x0b33('0x39')]){_0x14f912[_0x0b33('0x11')][_0x0b33('0x39')]=!![];}if(_0x172b4e){_0x14f912['query'][_0x0b33('0x3a')]=_0x2b065d;}_0x14f912[_0x0b33('0x11')]=Object[_0x0b33('0x3b')](_0x14f912[_0x0b33('0x11')],_0x49e802['query']);return db['UserProfile'][_0x0b33('0x3c')](_0x14f912);}return db['User']['findAndCountAll'](_0x856b28);})[_0x0b33('0x16')](function(_0x208fc1){_0x13a93b[_0x0b33('0x8')]=_0x208fc1[_0x0b33('0x8')];_0x170572=_0x208fc1[_0x0b33('0x22')];return _0x170572['map'](function(_0x506a05){var _0x232ecc=_[_0x0b33('0x3d')](_0x1a6599,['id',_0x506a05['id']]);if(_0x232ecc){var _0x2ed8ce=rta[_0x0b33('0x3e')](_0x232ecc);_['merge'](_0x506a05,_0x2ed8ce);}_0x506a05[_0x0b33('0x1d')]=rta['getAgentStatus'](_0x506a05);if(_0x506a05['globalStatus'][_0x0b33('0x3f')](_0x0b33('0x13'))){_0x241edd[_0x0b33('0x33')](function(_0x3e5f07){if(_0x506a05[_0x3e5f07+_0x0b33('0x32')]){if(_0x3e5f07===_0x0b33('0x40')){if(_0x506a05[_0x0b33('0x41')]!==_0x0b33('0x42')){_0x506a05['voiceStatus']=_0x0b33('0x13');}}else{_0x506a05[_0x3e5f07+_0x0b33('0x43')]=_0x0b33('0x13');}}});}return _0x506a05;});})[_0x0b33('0x16')](function(_0x2259b4){if(!_0x1e4d6c||_0x21b92d){return _0x2259b4;}return rta[_0x0b33('0x44')](_0x2259b4,_0x1e4d6c);})[_0x0b33('0x16')](function(_0xdbef3a){var _0x434a79=rta[_0x0b33('0x45')]();_0x13a93b[_0x0b33('0x22')]=_0xdbef3a['map'](function(_0x5f07bb){return _[_0x0b33('0x46')](_0x5f07bb,_0x434a79);});return _0x13a93b;})['then'](respondWithFilteredResult(_0x3eb998,_0x856b28))['catch'](APIHandleError(_0x3eb998));};exports[_0x0b33('0x47')]=function(_0x5c5ba9,_0x2aea1f){var _0x1a4310={'count':0x0,'rows':[]};var _0x458380={};var _0x3a8809;var _0x2df924;var _0xa2b32b;Promise['resolve']()[_0x0b33('0x16')](function(){if(_0x5c5ba9[_0x0b33('0x11')][_0x0b33('0x17')]){if(!utils[_0x0b33('0x18')](_0x5c5ba9[_0x0b33('0x11')][_0x0b33('0x17')])){throw new APIBadRequestError(util['format'](_0x0b33('0x1a'),_0x5c5ba9['query'][_0x0b33('0x17')]));}_0x3a8809=_0x5c5ba9[_0x0b33('0x11')][_0x0b33('0x17')][_0x0b33('0x1b')]();}var _0x276825=_[_0x0b33('0x48')](_0x3a8809)+'Queue';var _0x10ddec=_[_0x0b33('0x49')](db[_0x276825][_0x0b33('0x26')],function(_0x387535){return{'name':_0x387535[_0x0b33('0x27')],'type':_0x387535['type']['key']};});if(!_0x5c5ba9[_0x0b33('0x11')][_0x0b33('0x4a')]){var _0x1ab4df=['id','name'];if(_0x3a8809==='voice'){_0x1ab4df[_0x0b33('0x2f')](_0x0b33('0x28'));if(_0x5c5ba9[_0x0b33('0x11')][_0x0b33('0x28')]===_0x0b33('0x4b')){_0x1ab4df[_0x0b33('0x2f')](['dialActive',_0x0b33('0x4c')]);}}_0x5c5ba9[_0x0b33('0x11')]['fields']=_0x1ab4df[_0x0b33('0x4d')](',');}_0x458380=qs[_0x0b33('0x2c')](_0x10ddec,_0x5c5ba9);if(_0x5c5ba9['user'][_0x0b33('0x2a')]===_0x0b33('0x36')){var _0x323804={'params':{'id':_0x5c5ba9[_0x0b33('0x36')][_0x0b33('0x37')]},'query':{'section':_0x3a8809===_0x0b33('0x40')&&_0x5c5ba9[_0x0b33('0x11')][_0x0b33('0x28')]===_0x0b33('0x4b')?_0x0b33('0x4e'):_[_0x0b33('0x48')](_0x3a8809)+_0x0b33('0x4f'),'type':_0x5c5ba9[_0x0b33('0x11')][_0x0b33('0x28')],'nolimit':!![],'sort':_0x0b33('0x50'),'filter':_0x5c5ba9['query'][_0x0b33('0x51')]}};_0x323804[_0x0b33('0x11')]=Object[_0x0b33('0x3b')](_0x323804['query'],_0x5c5ba9[_0x0b33('0x11')]);delete _0x323804[_0x0b33('0x11')]['id'];return db[_0x0b33('0x52')][_0x0b33('0x3c')](_0x323804);}return db[_0x276825]['findAndCountAll'](_0x458380);})['then'](function(_0x316a11){_0x1a4310[_0x0b33('0x8')]=_0x316a11[_0x0b33('0x8')];_0x2df924=_0x316a11[_0x0b33('0x22')];return rtq[_0x0b33('0x53')](_0x5c5ba9,_0x3a8809);})[_0x0b33('0x16')](function(_0x2fefe5){_0xa2b32b=_0x2fefe5[_0x0b33('0x22')];return rtq['initializeQueues'](_0x2df924,_0xa2b32b,_0x3a8809,_0x5c5ba9[_0x0b33('0x11')][_0x0b33('0x28')]);})[_0x0b33('0x16')](function(_0x5eebfe){_0x1a4310[_0x0b33('0x22')]=_0x5eebfe;return _0x1a4310;})[_0x0b33('0x16')](respondWithFilteredResult(_0x2aea1f,_0x458380))[_0x0b33('0x54')](APIHandleError(_0x2aea1f));};
\ No newline at end of file
+var _0xf0ea=['../../config/utils','../../errors/api','APIBadRequestError','handleError','offset','count','Content-Range','json','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','length','map','rawAttributes','fieldName','key','role','agent','getOptions','raw','push','sequelize','literal','forEach','Pause','where','merge','user','online','extraQueryConditions','assign','UserProfile','getResources','User','findAndCountAll','filterAgentAttributes','getAgentStatus','includes','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','catch','getQueues','isValidChannel','format','startCase','Queue','type','outbound','userProfileId','Queues','name','filter','getRealtimeQueues','initializeQueues','lodash','util','../../components/parsers/qs'];(function(_0x53bde8,_0x49f0aa){var _0x2c53c7=function(_0x45b696){while(--_0x45b696){_0x53bde8['push'](_0x53bde8['shift']());}};_0x2c53c7(++_0x49f0aa);}(_0xf0ea,0x17e));var _0xaf0e=function(_0x330c6f,_0x3294f6){_0x330c6f=_0x330c6f-0x0;var _0x1f1b84=_0xf0ea[_0x330c6f];return _0x1f1b84;};'use strict';var _=require(_0xaf0e('0x0'));var util=require(_0xaf0e('0x1'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require(_0xaf0e('0x2'));var utils=require(_0xaf0e('0x3'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0xaf0e('0x4'))[_0xaf0e('0x5')];var APIHandleError=require(_0xaf0e('0x4'))[_0xaf0e('0x6')];function respondWithFilteredResult(_0x40a2c5,_0x37b4da){return function(_0x11a52c){if(_0x11a52c){var _0x49dcde=typeof _0x37b4da[_0xaf0e('0x7')]==='undefined'&&typeof _0x37b4da['limit']==='undefined';var _0x284e73=_0x11a52c[_0xaf0e('0x8')];var _0x5be476=_0x49dcde?0x0:_0x37b4da[_0xaf0e('0x7')];var _0x4981d1=_0x49dcde?_0x11a52c['count']:_0x37b4da[_0xaf0e('0x7')]+_0x37b4da['limit'];var _0x5847d9;if(_0x4981d1>=_0x284e73){_0x4981d1=_0x284e73;_0x5847d9=0xc8;}else{_0x5847d9=0xce;}_0x40a2c5['status'](_0x5847d9);return _0x40a2c5['set'](_0xaf0e('0x9'),_0x5be476+'-'+_0x4981d1+'/'+_0x284e73)[_0xaf0e('0xa')](_0x11a52c);}return null;};}exports['getAgents']=function(_0x31e3be,_0xc7c437){var _0x3ced98={'count':0x0,'rows':[]};var _0x4603be={};var _0x57b7f3;var _0x8b87e1=utils[_0xaf0e('0xb')]();var _0x50b210;var _0x37fac0;var _0x524c9b=_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0xd')];var _0x59052f=_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0xe')];var _0x54b196=_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0xf')];var _0x51c57a=_0x59052f===_0xaf0e('0x10')||_0x59052f===_0xaf0e('0x11')?!![]:![];var _0x53e136=[];var _0x2ae49b;var _0x5e2b8a;Promise[_0xaf0e('0x12')]()[_0xaf0e('0x13')](function(){if(_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x14')]){if(!utils['isValidChannel'](_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x14')])){throw new APIBadRequestError(util['format'](_0xaf0e('0x15'),_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x14')]));}_0x57b7f3=_0x31e3be['query'][_0xaf0e('0x14')][_0xaf0e('0x16')]();}if(!_0x31e3be['query'][_0xaf0e('0x17')]||!_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]['includes'](_0xaf0e('0x18'))){_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]=rta['validateSortParameter'](_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]);return;}var _0x4781d6=rta['getUpdatedSortOptions'](_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]);_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x17')]=_0x4781d6[_0xaf0e('0x19')][_0xaf0e('0x1a')](',');_0x2ae49b=_0x4781d6[_0xaf0e('0x1b')];})[_0xaf0e('0x13')](function(){if(!_0x524c9b){return[];}return rta[_0xaf0e('0x1c')](_0x524c9b,_0x57b7f3);})[_0xaf0e('0x13')](function(_0xe8999d){_0x53e136=_0xe8999d;return rta[_0xaf0e('0x1d')]();})['then'](function(_0x125851){_0x37fac0=_0x125851[_0xaf0e('0x1e')];if((!_0x59052f||_0x51c57a)&&!_0x2ae49b){return _0x53e136;}if(_0x2ae49b&&!_0x59052f){return rta['getSortedAgentsIdsByStatus'](_0x37fac0,_0x53e136,_0x2ae49b);}else{return rta['getAgentIdsByStatus'](_0x37fac0,_0x53e136,_0x59052f);}})[_0xaf0e('0x13')](function(_0xdd9775){_0x53e136=_0xdd9775;var _0x32b55b=![];if(_0x53e136[_0xaf0e('0x1f')]===0x0){if(_0x524c9b||_0x59052f){_0x32b55b=!![];}if(_0x51c57a){_0x32b55b=![];}}if(_0x32b55b){return _0x3ced98;}var _0x4354bd=_[_0xaf0e('0x20')](db['User'][_0xaf0e('0x21')],function(_0x3da9b3){return{'name':_0x3da9b3[_0xaf0e('0x22')],'type':_0x3da9b3['type'][_0xaf0e('0x23')]};});_0x31e3be[_0xaf0e('0xc')][_0xaf0e('0x24')]=_0xaf0e('0x25');_0x4603be=qs[_0xaf0e('0x26')](_0x4354bd,_0x31e3be);_0x4603be[_0xaf0e('0x27')]=!![];var _0xe8b2d6=[];if(_0x53e136[_0xaf0e('0x1f')]>0x0){_0xe8b2d6[_0xaf0e('0x28')]({'id':{'$in':_0x53e136}});if(_0x2ae49b&&!_0x59052f){_0x5e2b8a=[db[_0xaf0e('0x29')][_0xaf0e('0x2a')]('FIELD(id,'+_0x53e136+')')];_0x4603be[_0xaf0e('0x1b')]=_0x5e2b8a;}}if(_0x51c57a){_0x8b87e1[_0xaf0e('0x2b')](function(_0x243e1c){var _0x5a742e=!![];if(_0x59052f===_0xaf0e('0x11')&&_0x57b7f3!==_0x243e1c){_0x5a742e=![];}_0xe8b2d6[_0xaf0e('0x28')]({[_0x243e1c+_0xaf0e('0x2c')]:_0x5a742e});});if(_0x54b196){_0xe8b2d6[_0xaf0e('0x28')]({'pauseType':_0x54b196});}}else if(_0x59052f){_0x8b87e1['forEach'](function(_0x301f2c){_0xe8b2d6[_0xaf0e('0x28')]({[_0x301f2c+'Pause']:![]});});}_0x4603be[_0xaf0e('0x2d')]=_[_0xaf0e('0x2e')](_0x4603be['where'],{'$and':_0xe8b2d6});if(_0x31e3be[_0xaf0e('0x2f')]['role']===_0xaf0e('0x2f')){var _0x38d0f7={'params':{'id':_0x31e3be[_0xaf0e('0x2f')]['userProfileId']},'query':{'section':'Agents','role':_0xaf0e('0x25'),'raw':!![],'ids':_0x53e136,'customSorting':_0x5e2b8a}};if(_0x31e3be['query']['online']){_0x38d0f7['query'][_0xaf0e('0x30')]=!![];}if(_0x51c57a){_0x38d0f7['query'][_0xaf0e('0x31')]=_0xe8b2d6;}_0x38d0f7['query']=Object[_0xaf0e('0x32')](_0x38d0f7[_0xaf0e('0xc')],_0x31e3be[_0xaf0e('0xc')]);return db[_0xaf0e('0x33')][_0xaf0e('0x34')](_0x38d0f7);}return db[_0xaf0e('0x35')][_0xaf0e('0x36')](_0x4603be);})['then'](function(_0xda1aa2){_0x3ced98['count']=_0xda1aa2[_0xaf0e('0x8')];_0x50b210=_0xda1aa2[_0xaf0e('0x1e')];return _0x50b210[_0xaf0e('0x20')](function(_0x50ada4){var _0x331994=_['find'](_0x37fac0,['id',_0x50ada4['id']]);if(_0x331994){var _0x33a5f2=rta[_0xaf0e('0x37')](_0x331994);_[_0xaf0e('0x2e')](_0x50ada4,_0x33a5f2);}_0x50ada4[_0xaf0e('0x18')]=rta[_0xaf0e('0x38')](_0x50ada4);if(_0x50ada4[_0xaf0e('0x18')][_0xaf0e('0x39')](_0xaf0e('0x10'))){_0x8b87e1['forEach'](function(_0x5967cb){if(_0x50ada4[_0x5967cb+_0xaf0e('0x2c')]){if(_0x5967cb===_0xaf0e('0x3a')){if(_0x50ada4[_0xaf0e('0x3b')]!==_0xaf0e('0x3c')){_0x50ada4[_0xaf0e('0x3b')]=_0xaf0e('0x10');}}else{_0x50ada4[_0x5967cb+'Status']='pause';}}});}return _0x50ada4;});})['then'](function(_0x7f438c){if(!_0x2ae49b||_0x5e2b8a){return _0x7f438c;}return rta[_0xaf0e('0x3d')](_0x7f438c,_0x2ae49b);})[_0xaf0e('0x13')](function(_0x547780){var _0x288dfb=rta[_0xaf0e('0x3e')]();_0x3ced98[_0xaf0e('0x1e')]=_0x547780[_0xaf0e('0x20')](function(_0x4dec02){return _['pick'](_0x4dec02,_0x288dfb);});return _0x3ced98;})['then'](respondWithFilteredResult(_0xc7c437,_0x4603be))[_0xaf0e('0x3f')](APIHandleError(_0xc7c437));};exports[_0xaf0e('0x40')]=function(_0x20e72a,_0x188cfe){var _0x47099c={'count':0x0,'rows':[]};var _0x25a71e={};var _0x4f599e;var _0xd3048;var _0x4cd328;Promise[_0xaf0e('0x12')]()[_0xaf0e('0x13')](function(){if(_0x20e72a[_0xaf0e('0xc')]['channel']){if(!utils[_0xaf0e('0x41')](_0x20e72a[_0xaf0e('0xc')]['channel'])){throw new APIBadRequestError(util[_0xaf0e('0x42')](_0xaf0e('0x15'),_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x14')]));}_0x4f599e=_0x20e72a[_0xaf0e('0xc')]['channel'][_0xaf0e('0x16')]();}var _0x14d5b7=_[_0xaf0e('0x43')](_0x4f599e)+_0xaf0e('0x44');var _0x2f8d08=_[_0xaf0e('0x20')](db[_0x14d5b7][_0xaf0e('0x21')],function(_0x1b8dec){return{'name':_0x1b8dec[_0xaf0e('0x22')],'type':_0x1b8dec[_0xaf0e('0x45')][_0xaf0e('0x23')]};});if(!_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x19')]){var _0xa805cd=['id','name'];if(_0x4f599e===_0xaf0e('0x3a')){_0xa805cd[_0xaf0e('0x28')]('type');if(_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x45')]===_0xaf0e('0x46')){_0xa805cd[_0xaf0e('0x28')](['dialActive','dialMethod']);}}_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x19')]=_0xa805cd[_0xaf0e('0x1a')](',');}_0x25a71e=qs[_0xaf0e('0x26')](_0x2f8d08,_0x20e72a);if(_0x20e72a['user'][_0xaf0e('0x24')]===_0xaf0e('0x2f')){var _0x2d5a77={'params':{'id':_0x20e72a[_0xaf0e('0x2f')][_0xaf0e('0x47')]},'query':{'section':_0x4f599e===_0xaf0e('0x3a')&&_0x20e72a[_0xaf0e('0xc')]['type']===_0xaf0e('0x46')?'QueueCampaigns':_[_0xaf0e('0x43')](_0x4f599e)+_0xaf0e('0x48'),'type':_0x20e72a['query']['type'],'nolimit':!![],'sort':_0xaf0e('0x49'),'filter':_0x20e72a[_0xaf0e('0xc')][_0xaf0e('0x4a')]}};_0x2d5a77[_0xaf0e('0xc')]=Object[_0xaf0e('0x32')](_0x2d5a77['query'],_0x20e72a['query']);delete _0x2d5a77[_0xaf0e('0xc')]['id'];return db['UserProfile'][_0xaf0e('0x34')](_0x2d5a77);}return db[_0x14d5b7]['findAndCountAll'](_0x25a71e);})['then'](function(_0x3ffc43){_0x47099c[_0xaf0e('0x8')]=_0x3ffc43[_0xaf0e('0x8')];_0xd3048=_0x3ffc43[_0xaf0e('0x1e')];return rtq[_0xaf0e('0x4b')](_0x20e72a,_0x4f599e);})[_0xaf0e('0x13')](function(_0x6697ae){_0x4cd328=_0x6697ae[_0xaf0e('0x1e')];return rtq[_0xaf0e('0x4c')](_0xd3048,_0x4cd328,_0x4f599e,_0x20e72a[_0xaf0e('0xc')]['type']);})['then'](function(_0x9f1e39){_0x47099c['rows']=_0x9f1e39;return _0x47099c;})['then'](respondWithFilteredResult(_0x188cfe,_0x25a71e))[_0xaf0e('0x3f')](APIHandleError(_0x188cfe));};
\ No newline at end of file
index 00c5b3e..44d20ab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x6ef77f,_0x763cdf){var _0x30b05a=function(_0x1610f7){while(--_0x1610f7){_0x6ef77f['push'](_0x6ef77f['shift']());}};_0x30b05a(++_0x763cdf);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39caaa,_0x1f37bc){_0x39caaa=_0x39caaa-0x0;var _0x9b9c7d=_0xcb91[_0x39caaa];return _0x9b9c7d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router;
\ No newline at end of file
+var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
index 92ea3f7..1d07208 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x93bb=['exports','INTEGER','STRING','DATE','sequelize'];(function(_0xe25ee9,_0x1f6d98){var _0x56c669=function(_0x32e81a){while(--_0x32e81a){_0xe25ee9['push'](_0xe25ee9['shift']());}};_0x56c669(++_0x1f6d98);}(_0x93bb,0x135));var _0xb93b=function(_0x551e99,_0x457901){_0x551e99=_0x551e99-0x0;var _0x3e23e8=_0x93bb[_0x551e99];return _0x3e23e8;};'use strict';var Sequelize=require(_0xb93b('0x0'));module[_0xb93b('0x1')]={'state':{'type':Sequelize[_0xb93b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xb93b('0x3')]},'scheduledat':{'type':Sequelize[_0xb93b('0x4')]},'uniqueid':{'type':Sequelize[_0xb93b('0x3')]},'starttime':{'type':Sequelize[_0xb93b('0x4')]},'responsetime':{'type':Sequelize[_0xb93b('0x4')]},'ringtime':{'type':Sequelize[_0xb93b('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xb93b('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb93b('0x3')]}};
\ No newline at end of file
+var _0x7412=['STRING','sequelize'];(function(_0x3bae28,_0x5ca4f5){var _0xb431b=function(_0x1ef970){while(--_0x1ef970){_0x3bae28['push'](_0x3bae28['shift']());}};_0xb431b(++_0x5ca4f5);}(_0x7412,0x161));var _0x2741=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0x7412[_0x17928f];return _0x500b63;};'use strict';var Sequelize=require(_0x2741('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x2741('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0x2741('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 2067363..3a2a471 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1fe6=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util'];(function(_0x1551b1,_0xa732f0){var _0x3940f2=function(_0x2cb291){while(--_0x2cb291){_0x1551b1['push'](_0x1551b1['shift']());}};_0x3940f2(++_0xa732f0);}(_0x1fe6,0x1ea));var _0x61fe=function(_0x15f232,_0x35cb91){_0x15f232=_0x15f232-0x0;var _0x8b178d=_0x1fe6[_0x15f232];return _0x8b178d;};'use strict';var _=require(_0x61fe('0x0'));var util=require(_0x61fe('0x1'));var logger=require(_0x61fe('0x2'))('api');var moment=require(_0x61fe('0x3'));var BPromise=require(_0x61fe('0x4'));var rp=require(_0x61fe('0x5'));var fs=require('fs');var path=require(_0x61fe('0x6'));var rimraf=require(_0x61fe('0x7'));var config=require('../../config/environment');var attributes=require(_0x61fe('0x8'));module[_0x61fe('0x9')]=function(_0x45bb90,_0xbd146e){return _0x45bb90[_0x61fe('0xa')](_0x61fe('0xb'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x659f=['./reportAgentPreview.attributes','exports','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x36cd24,_0x16f1fb){var _0x239e3d=function(_0x57c160){while(--_0x57c160){_0x36cd24['push'](_0x36cd24['shift']());}};_0x239e3d(++_0x16f1fb);}(_0x659f,0x142));var _0xf659=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x659f[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0xf659('0x0'));var util=require('util');var logger=require(_0xf659('0x1'))(_0xf659('0x2'));var moment=require(_0xf659('0x3'));var BPromise=require(_0xf659('0x4'));var rp=require(_0xf659('0x5'));var fs=require('fs');var path=require(_0xf659('0x6'));var rimraf=require('rimraf');var config=require(_0xf659('0x7'));var attributes=require(_0xf659('0x8'));module[_0xf659('0x9')]=function(_0x7cb3cc,_0x48dffc){return _0x7cb3cc['define']('ReportAgentPreview',attributes,{'tableName':_0xf659('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 80e4db9..48a9de1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0e39=['code','message','request\x20sent','result','CreateReportAgentPreview','ReportAgentPreview','body','raw','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ReportAgentPreview,\x20%s,\x20%s','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xad4cb1,_0x4757ef){var _0x2e55c9=function(_0x5ed6e6){while(--_0x5ed6e6){_0xad4cb1['push'](_0xad4cb1['shift']());}};_0x2e55c9(++_0x4757ef);}(_0x0e39,0x18f));var _0x90e3=function(_0x49fcfc,_0x104175){_0x49fcfc=_0x49fcfc-0x0;var _0x4ab162=_0x0e39[_0x49fcfc];return _0x4ab162;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x90e3('0x0'));var BPromise=require('bluebird');var rs=require(_0x90e3('0x1'));var fs=require('fs');var Redis=require(_0x90e3('0x2'));var db=require(_0x90e3('0x3'))['db'];var utils=require(_0x90e3('0x4'));var logger=require(_0x90e3('0x5'))(_0x90e3('0x6'));var config=require(_0x90e3('0x7'));var jayson=require(_0x90e3('0x8'));var client=jayson[_0x90e3('0x9')][_0x90e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a7778,_0x29578f,_0x48a827){return new BPromise(function(_0xc63300,_0x5fe470){return client['request'](_0x1a7778,_0x48a827)['then'](function(_0x34991a){logger[_0x90e3('0xb')](_0x90e3('0xc'),_0x29578f,'request\x20sent');logger[_0x90e3('0xd')](_0x90e3('0xe'),_0x29578f,'request\x20sent',JSON[_0x90e3('0xf')](_0x34991a));if(_0x34991a['error']){if(_0x34991a[_0x90e3('0x10')][_0x90e3('0x11')]===0x1f4){logger['error'](_0x90e3('0xc'),_0x29578f,_0x34991a[_0x90e3('0x10')][_0x90e3('0x12')]);return _0x5fe470(_0x34991a[_0x90e3('0x10')][_0x90e3('0x12')]);}logger[_0x90e3('0x10')](_0x90e3('0xc'),_0x29578f,_0x34991a[_0x90e3('0x10')]['message']);return _0xc63300(_0x34991a[_0x90e3('0x10')]['message']);}else{logger[_0x90e3('0xb')](_0x90e3('0xc'),_0x29578f,_0x90e3('0x13'));_0xc63300(_0x34991a[_0x90e3('0x14')]['message']);}})['catch'](function(_0x2e55fd){logger[_0x90e3('0x10')](_0x90e3('0xc'),_0x29578f,_0x2e55fd);_0x5fe470(_0x2e55fd);});});}exports[_0x90e3('0x15')]=function(_0x94de75){var _0x6acd34=this;return new Promise(function(_0xc397a6,_0x909e24){return db[_0x90e3('0x16')]['create'](_0x94de75[_0x90e3('0x17')],{'raw':_0x94de75['options']?_0x94de75['options'][_0x90e3('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x4a56a6){logger[_0x90e3('0xb')](_0x90e3('0x15'),_0x94de75);logger[_0x90e3('0xd')]('CreateReportAgentPreview',_0x94de75,JSON[_0x90e3('0xf')](_0x4a56a6));_0xc397a6(_0x4a56a6);})[_0x90e3('0x19')](function(_0x16be14){logger[_0x90e3('0x10')]('CreateReportAgentPreview',_0x16be14[_0x90e3('0x12')],_0x94de75);_0x909e24(_0x6acd34[_0x90e3('0x10')](0x1f4,_0x16be14[_0x90e3('0x12')]));});});};
\ No newline at end of file
+var _0x2884=['ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','options','raw','then','lodash','util','moment','randomstring'];(function(_0x10324d,_0xd0634e){var _0x2d72ce=function(_0x4e698e){while(--_0x4e698e){_0x10324d['push'](_0x10324d['shift']());}};_0x2d72ce(++_0xd0634e);}(_0x2884,0x11a));var _0x4288=function(_0x3c3b51,_0xe90b55){_0x3c3b51=_0x3c3b51-0x0;var _0x303246=_0x2884[_0x3c3b51];return _0x303246;};'use strict';var _=require(_0x4288('0x0'));var util=require(_0x4288('0x1'));var moment=require(_0x4288('0x2'));var BPromise=require('bluebird');var rs=require(_0x4288('0x3'));var fs=require('fs');var Redis=require(_0x4288('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4288('0x5'));var logger=require(_0x4288('0x6'))('rpc');var config=require(_0x4288('0x7'));var jayson=require(_0x4288('0x8'));var client=jayson[_0x4288('0x9')][_0x4288('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18e69a,_0x55c999,_0x341f80){return new BPromise(function(_0x43150a,_0x5ef497){return client[_0x4288('0xb')](_0x18e69a,_0x341f80)['then'](function(_0x238a77){logger[_0x4288('0xc')](_0x4288('0xd'),_0x55c999,_0x4288('0xe'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x55c999,_0x4288('0xe'),JSON[_0x4288('0xf')](_0x238a77));if(_0x238a77[_0x4288('0x10')]){if(_0x238a77['error'][_0x4288('0x11')]===0x1f4){logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0x238a77['error'][_0x4288('0x12')]);return _0x5ef497(_0x238a77[_0x4288('0x10')][_0x4288('0x12')]);}logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0x238a77['error'][_0x4288('0x12')]);return _0x43150a(_0x238a77[_0x4288('0x10')]['message']);}else{logger[_0x4288('0xc')](_0x4288('0xd'),_0x55c999,_0x4288('0xe'));_0x43150a(_0x238a77[_0x4288('0x13')][_0x4288('0x12')]);}})[_0x4288('0x14')](function(_0xe3dd7){logger[_0x4288('0x10')](_0x4288('0xd'),_0x55c999,_0xe3dd7);_0x5ef497(_0xe3dd7);});});}exports[_0x4288('0x15')]=function(_0x1fa2de){var _0x3c3164=this;return new Promise(function(_0x25f679,_0x46706e){return db[_0x4288('0x16')]['create'](_0x1fa2de['body'],{'raw':_0x1fa2de['options']?_0x1fa2de[_0x4288('0x17')][_0x4288('0x18')]===undefined?!![]:![]:!![]})[_0x4288('0x19')](function(_0x346ce5){logger['info']('CreateReportAgentPreview',_0x1fa2de);logger['debug'](_0x4288('0x15'),_0x1fa2de,JSON[_0x4288('0xf')](_0x346ce5));_0x25f679(_0x346ce5);})['catch'](function(_0x17ef56){logger[_0x4288('0x10')](_0x4288('0x15'),_0x17ef56[_0x4288('0x12')],_0x1fa2de);_0x46706e(_0x3c3164['error'](0x1f4,_0x17ef56[_0x4288('0x12')]));});});};
\ No newline at end of file
index 644b2a5..b0186c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbeda=['voiceQueues','mailQueues','/openchannel/queues','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','/outbound/channels','outboundChannels','/agents','agents','put','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xbeda,0xda));var _0xabed=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0xbeda[_0x5027b1];return _0x4a46cf;};'use strict';var multer=require('multer');var util=require(_0xabed('0x0'));var path=require(_0xabed('0x1'));var express=require(_0xabed('0x2'));var router=express[_0xabed('0x3')]();var auth=require(_0xabed('0x4'));var controller=require(_0xabed('0x5'));router[_0xabed('0x6')]('/voice/channels',auth[_0xabed('0x7')](),controller[_0xabed('0x8')]);router[_0xabed('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0xabed('0x7')](),controller[_0xabed('0x9')]);router[_0xabed('0x6')](_0xabed('0xa'),auth['isAuthenticated'](),controller[_0xabed('0xb')]);router[_0xabed('0x6')](_0xabed('0xc'),auth[_0xabed('0x7')](),controller[_0xabed('0xd')]);router[_0xabed('0x6')]('/chat/queues',auth[_0xabed('0x7')](),controller['chatQueues']);router[_0xabed('0x6')]('/mail/queues',auth['isAuthenticated'](),controller[_0xabed('0xe')]);router['get']('/mail/accounts',auth['isAuthenticated'](),controller['mailAccounts']);router[_0xabed('0x6')](_0xabed('0xf'),auth[_0xabed('0x7')](),controller[_0xabed('0x10')]);router[_0xabed('0x6')](_0xabed('0x11'),auth['isAuthenticated'](),controller['smsQueues']);router[_0xabed('0x6')](_0xabed('0x12'),auth[_0xabed('0x7')](),controller[_0xabed('0x13')]);router[_0xabed('0x6')](_0xabed('0x14'),auth[_0xabed('0x7')](),controller[_0xabed('0x15')]);router[_0xabed('0x6')](_0xabed('0x16'),auth[_0xabed('0x7')](),controller[_0xabed('0x17')]);router['get'](_0xabed('0x18'),auth['isAuthenticated'](),controller[_0xabed('0x19')]);router['get']('/voice/queues/channels/:uniqueid',auth[_0xabed('0x7')](),controller[_0xabed('0x1a')]);router[_0xabed('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth[_0xabed('0x7')](),controller[_0xabed('0x1b')]);router['get']('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xabed('0x7')](),controller[_0xabed('0x1c')]);router[_0xabed('0x6')](_0xabed('0x1d'),auth[_0xabed('0x7')](),controller[_0xabed('0x1e')]);router['put'](_0xabed('0x1d'),auth[_0xabed('0x7')](),controller[_0xabed('0x1f')]);router[_0xabed('0x6')](_0xabed('0x20'),auth['isAuthenticated'](),controller['outbound']);router[_0xabed('0x6')](_0xabed('0x21'),auth[_0xabed('0x7')](),controller[_0xabed('0x22')]);router[_0xabed('0x6')](_0xabed('0x23'),auth[_0xabed('0x7')](),controller[_0xabed('0x24')]);router[_0xabed('0x25')](_0xabed('0x26'),auth[_0xabed('0x7')](),controller[_0xabed('0x27')]);router[_0xabed('0x6')]('/telephones',auth[_0xabed('0x7')](),controller[_0xabed('0x28')]);router[_0xabed('0x6')](_0xabed('0x29'),auth[_0xabed('0x7')](),controller[_0xabed('0x2a')]);router['get']('/campaigns',auth[_0xabed('0x7')](),controller['campaigns']);router[_0xabed('0x6')](_0xabed('0x2b'),auth[_0xabed('0x7')](),controller[_0xabed('0x2c')]);router[_0xabed('0x6')](_0xabed('0x2d'),auth['isAuthenticated'](),controller[_0xabed('0x2e')]);router[_0xabed('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0xabed('0x6')](_0xabed('0x2f'),auth[_0xabed('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0xabed('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0xabed('0x7')](),controller[_0xabed('0x30')]);router['get'](_0xabed('0x31'),auth[_0xabed('0x7')](),controller[_0xabed('0x32')]);router[_0xabed('0x6')]('/whatsapp/queues/waitinginteractions',auth[_0xabed('0x7')](),controller[_0xabed('0x33')]);router['get'](_0xabed('0x34'),auth['isAuthenticated'](),controller[_0xabed('0x35')]);router[_0xabed('0x36')]('/mail/queues/:id/notify',auth[_0xabed('0x7')](),controller[_0xabed('0x37')](_0xabed('0x38')));router[_0xabed('0x6')](_0xabed('0x39'),auth['isAuthenticated'](),controller[_0xabed('0x3a')]);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xabed('0x3b')));router['get'](_0xabed('0x3c'),auth[_0xabed('0x7')](),controller[_0xabed('0x3d')]);router[_0xabed('0x36')](_0xabed('0x3e'),auth[_0xabed('0x7')](),controller[_0xabed('0x37')](_0xabed('0x3f')));router['get']('/fax/queues/:id',auth[_0xabed('0x7')](),controller[_0xabed('0x40')]);router[_0xabed('0x36')](_0xabed('0x41'),auth[_0xabed('0x7')](),controller[_0xabed('0x37')](_0xabed('0x42')));router['get'](_0xabed('0x43'),auth[_0xabed('0x7')](),controller['showOpenchannelQueues']);router[_0xabed('0x36')](_0xabed('0x44'),auth[_0xabed('0x7')](),controller['queueNotify'](_0xabed('0x45')));router[_0xabed('0x36')](_0xabed('0x46'),auth[_0xabed('0x7')](),controller['queueNotify'](_0xabed('0x47')));router['get'](_0xabed('0x48'),auth[_0xabed('0x7')](),controller['showSmsQueues']);router[_0xabed('0x6')](_0xabed('0x49'),auth['isAuthenticated'](),controller[_0xabed('0x4a')]);router[_0xabed('0x36')]('/agents/:id/notify',auth[_0xabed('0x7')](),controller[_0xabed('0x4b')]);module[_0xabed('0x4c')]=router;
\ No newline at end of file
+var _0xad07=['mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/:id','showVoiceQueues','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','agents','put','/agents/:id/capacity','agentCapacity','/telephones','/trunks','trunks','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','express','Router','get','/voice/channels','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var path=require('path');var express=require(_0x7ad0('0x2'));var router=express[_0x7ad0('0x3')]();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0x7ad0('0x4')](_0x7ad0('0x5'),auth[_0x7ad0('0x6')](),controller['voiceChannels']);router[_0x7ad0('0x4')]('/voice/channels/:uniqueid/mixmonitor',auth['isAuthenticated'](),controller[_0x7ad0('0x7')]);router[_0x7ad0('0x4')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x7ad0('0x8')]);router[_0x7ad0('0x4')]('/voice/queues',auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x9')]);router[_0x7ad0('0x4')](_0x7ad0('0xa'),auth['isAuthenticated'](),controller[_0x7ad0('0xb')]);router[_0x7ad0('0x4')](_0x7ad0('0xc'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0xd')]);router[_0x7ad0('0x4')](_0x7ad0('0xe'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0xf')]);router['get'](_0x7ad0('0x10'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x11')]);router[_0x7ad0('0x4')]('/sms/queues',auth['isAuthenticated'](),controller[_0x7ad0('0x12')]);router[_0x7ad0('0x4')](_0x7ad0('0x13'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x14')]);router[_0x7ad0('0x4')](_0x7ad0('0x15'),auth[_0x7ad0('0x6')](),controller['faxQueues']);router[_0x7ad0('0x4')](_0x7ad0('0x16'),auth['isAuthenticated'](),controller['voiceQueuesPreview']);router[_0x7ad0('0x4')]('/voice/queues/channels',auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x17')]);router['get'](_0x7ad0('0x18'),auth['isAuthenticated'](),controller[_0x7ad0('0x19')]);router['get'](_0x7ad0('0x1a'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x1b')]);router[_0x7ad0('0x4')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x7ad0('0x6')](),controller['voiceQueuesChannelRedirect']);router[_0x7ad0('0x4')](_0x7ad0('0x1c'),auth['isAuthenticated'](),controller[_0x7ad0('0x1d')]);router['put']('/voice/queues/:id',auth['isAuthenticated'](),controller[_0x7ad0('0x1e')]);router['get'](_0x7ad0('0x1f'),auth['isAuthenticated'](),controller[_0x7ad0('0x20')]);router[_0x7ad0('0x4')](_0x7ad0('0x21'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x22')]);router[_0x7ad0('0x4')]('/agents',auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x23')]);router[_0x7ad0('0x24')](_0x7ad0('0x25'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x26')]);router[_0x7ad0('0x4')](_0x7ad0('0x27'),auth['isAuthenticated'](),controller['telephones']);router[_0x7ad0('0x4')](_0x7ad0('0x28'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x29')]);router[_0x7ad0('0x4')]('/campaigns',auth['isAuthenticated'](),controller[_0x7ad0('0x2a')]);router[_0x7ad0('0x4')](_0x7ad0('0x2b'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x2c')]);router[_0x7ad0('0x4')](_0x7ad0('0x2d'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x2e')]);router[_0x7ad0('0x4')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x7ad0('0x2f')]);router[_0x7ad0('0x4')](_0x7ad0('0x30'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x31')]);router[_0x7ad0('0x4')](_0x7ad0('0x32'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x33')]);router[_0x7ad0('0x4')](_0x7ad0('0x34'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x35')]);router['get'](_0x7ad0('0x36'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x37')]);router[_0x7ad0('0x4')](_0x7ad0('0x38'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x39')]);router[_0x7ad0('0x3a')](_0x7ad0('0x3b'),auth[_0x7ad0('0x6')](),controller['queueNotify'](_0x7ad0('0x3c')));router['get'](_0x7ad0('0x3d'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x3e')]);router['post'](_0x7ad0('0x3f'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x40')](_0x7ad0('0x41')));router['get'](_0x7ad0('0x42'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x7ad0('0x3a')]('/fax/queues/:id/notify',auth['isAuthenticated'](),controller[_0x7ad0('0x40')](_0x7ad0('0x43')));router[_0x7ad0('0x4')](_0x7ad0('0x44'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x45')]);router['post'](_0x7ad0('0x46'),auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x40')]('openchannel'));router[_0x7ad0('0x4')](_0x7ad0('0x47'),auth[_0x7ad0('0x6')](),controller['showOpenchannelQueues']);router[_0x7ad0('0x3a')](_0x7ad0('0x48'),auth[_0x7ad0('0x6')](),controller['queueNotify']('sms'));router[_0x7ad0('0x3a')](_0x7ad0('0x49'),auth['isAuthenticated'](),controller['queueNotify'](_0x7ad0('0x4a')));router[_0x7ad0('0x4')](_0x7ad0('0x4b'),auth[_0x7ad0('0x6')](),controller['showSmsQueues']);router['get']('/whatsapp/queues/:id',auth[_0x7ad0('0x6')](),controller[_0x7ad0('0x4c')]);router[_0x7ad0('0x3a')](_0x7ad0('0x4d'),auth['isAuthenticated'](),controller[_0x7ad0('0x4e')]);module[_0x7ad0('0x4f')]=router;
\ No newline at end of file
index b0ec6d3..3b07395 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x1d7f7f,_0x882ca9){var _0x4287c7=function(_0x2153b7){while(--_0x2153b7){_0x1d7f7f['push'](_0x1d7f7f['shift']());}};_0x4287c7(++_0x882ca9);}(_0xe706,0xa3));var _0x6e70=function(_0x3bb63a,_0x15af8f){_0x3bb63a=_0x3bb63a-0x0;var _0x3b822a=_0xe706[_0x3bb63a];return _0x3b822a;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));};
\ No newline at end of file
+var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x549502,_0x5ce153){var _0xb679c4=function(_0x122d41){while(--_0x122d41){_0x549502['push'](_0x549502['shift']());}};_0xb679c4(++_0x5ce153);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));};
\ No newline at end of file
index 9ebf291..eebd663 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x080f=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/run','run','create','put','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x080f,0x1a0));var _0xf080=function(_0x395eea,_0x2d3168){_0x395eea=_0x395eea-0x0;var _0x95a9ec=_0x080f[_0x395eea];return _0x95a9ec;};'use strict';var multer=require('multer');var util=require(_0xf080('0x0'));var path=require(_0xf080('0x1'));var timeout=require(_0xf080('0x2'));var express=require(_0xf080('0x3'));var router=express[_0xf080('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf080('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf080('0x6'));var controller=require('./schedule.controller');router[_0xf080('0x7')]('/',auth[_0xf080('0x8')](),controller[_0xf080('0x9')]);router[_0xf080('0x7')](_0xf080('0xa'),auth[_0xf080('0x8')](),controller[_0xf080('0xb')]);router[_0xf080('0x7')](_0xf080('0xc'),auth['isAuthenticated'](),controller[_0xf080('0xd')]);router['post']('/',auth[_0xf080('0x8')](),controller[_0xf080('0xe')]);router[_0xf080('0xf')]('/:id',auth[_0xf080('0x8')](),controller[_0xf080('0x10')]);router[_0xf080('0x11')](_0xf080('0xa'),auth[_0xf080('0x8')](),controller[_0xf080('0x12')]);module[_0xf080('0x13')]=router;
\ No newline at end of file
+var _0xec49=['show','get','/:id/run','run','post','create','update','delete','destroy','exports','util','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','/:id'];(function(_0x4415a7,_0x5e921f){var _0x3ec6e3=function(_0x231b43){while(--_0x231b43){_0x4415a7['push'](_0x4415a7['shift']());}};_0x3ec6e3(++_0x5e921f);}(_0xec49,0x9a));var _0x9ec4=function(_0x820608,_0x6c3dc2){_0x820608=_0x820608-0x0;var _0x558912=_0xec49[_0x820608];return _0x558912;};'use strict';var multer=require('multer');var util=require(_0x9ec4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9ec4('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x9ec4('0x2'));var interaction=require(_0x9ec4('0x3'));var config=require(_0x9ec4('0x4'));var controller=require(_0x9ec4('0x5'));router['get']('/',auth[_0x9ec4('0x6')](),controller['index']);router['get'](_0x9ec4('0x7'),auth[_0x9ec4('0x6')](),controller[_0x9ec4('0x8')]);router[_0x9ec4('0x9')](_0x9ec4('0xa'),auth[_0x9ec4('0x6')](),controller[_0x9ec4('0xb')]);router[_0x9ec4('0xc')]('/',auth['isAuthenticated'](),controller[_0x9ec4('0xd')]);router['put']('/:id',auth[_0x9ec4('0x6')](),controller[_0x9ec4('0xe')]);router[_0x9ec4('0xf')]('/:id',auth[_0x9ec4('0x6')](),controller[_0x9ec4('0x10')]);module[_0x9ec4('0x11')]=router;
\ No newline at end of file
index 18f5311..d03b3fa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49d7=['weeks','minutes','days','pdf','xlsx','csv','custom','default','STRING','sequelize','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years'];(function(_0x27a148,_0x1f70bd){var _0x23af64=function(_0x2c3d4d){while(--_0x2c3d4d){_0x27a148['push'](_0x27a148['shift']());}};_0x23af64(++_0x1f70bd);}(_0x49d7,0x14b));var _0x749d=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x49d7[_0x13cab0];return _0x38804f;};'use strict';var Sequelize=require(_0x749d('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x749d('0x1')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x749d('0x2')},'startAt':{'type':Sequelize[_0x749d('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x749d('0x4'),'quarters','months',_0x749d('0x5'),'days','hours',_0x749d('0x6')),'allowNull':![],'defaultValue':_0x749d('0x7')},'output':{'type':Sequelize['ENUM']('csv',_0x749d('0x8'),_0x749d('0x9')),'allowNull':![],'defaultValue':_0x749d('0xa')},'type':{'type':Sequelize['ENUM'](_0x749d('0xb'),_0x749d('0xc')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0x749d('0x1')],'defaultValue':![]},'email':{'type':Sequelize[_0x749d('0xd')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x749d('0x1')],'defaultValue':!![]}};
\ No newline at end of file
+var _0x7b6d=['DATE','ENUM','months','weeks','days','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*'];(function(_0x324800,_0x48a149){var _0x2407e5=function(_0x30cc18){while(--_0x30cc18){_0x324800['push'](_0x324800['shift']());}};_0x2407e5(++_0x48a149);}(_0x7b6d,0x95));var _0xd7b6=function(_0x4b4152,_0x374b67){_0x4b4152=_0x4b4152-0x0;var _0x4ee178=_0x7b6d[_0x4b4152];return _0x4ee178;};'use strict';var Sequelize=require(_0xd7b6('0x0'));module[_0xd7b6('0x1')]={'name':{'type':Sequelize[_0xd7b6('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7b6('0x2')]},'active':{'type':Sequelize[_0xd7b6('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd7b6('0x2')],'allowNull':![],'defaultValue':_0xd7b6('0x4')},'startAt':{'type':Sequelize[_0xd7b6('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xd7b6('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd7b6('0x6')]('years','quarters',_0xd7b6('0x7'),_0xd7b6('0x8'),_0xd7b6('0x9'),'hours','minutes'),'allowNull':![],'defaultValue':_0xd7b6('0x9')},'output':{'type':Sequelize[_0xd7b6('0x6')](_0xd7b6('0xa'),_0xd7b6('0xb'),'xlsx'),'allowNull':![],'defaultValue':_0xd7b6('0xa')},'type':{'type':Sequelize[_0xd7b6('0x6')](_0xd7b6('0xc'),'default'),'allowNull':![],'defaultValue':_0xd7b6('0xc')},'sendMail':{'type':Sequelize[_0xd7b6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd7b6('0x2')]},'cc':{'type':Sequelize[_0xd7b6('0xd')]},'bcc':{'type':Sequelize[_0xd7b6('0xd')]},'sendIfEmpty':{'type':Sequelize[_0xd7b6('0x3')],'defaultValue':!![]}};
\ No newline at end of file
index 04d3abe..1c2193e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f42=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','json','apply','reject','update','then','destroy','Scheduler','UserProfileResource','error','name','send','map','Schedule','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x407787,_0x470ee6){var _0x20aff5=function(_0x56b515){while(--_0x56b515){_0x407787['push'](_0x407787['shift']());}};_0x20aff5(++_0x470ee6);}(_0x8f42,0x191));var _0x28f4=function(_0x160982,_0x1d3a3b){_0x160982=_0x160982-0x0;var _0x11f149=_0x8f42[_0x160982];return _0x11f149;};'use strict';var emlformat=require(_0x28f4('0x0'));var rimraf=require(_0x28f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x28f4('0x2'));var BPromise=require(_0x28f4('0x3'));var Mustache=require('mustache');var util=require(_0x28f4('0x4'));var path=require('path');var sox=require(_0x28f4('0x5'));var csv=require(_0x28f4('0x6'));var ejs=require(_0x28f4('0x7'));var fs=require('fs');var fs_extra=require(_0x28f4('0x8'));var _=require(_0x28f4('0x9'));var squel=require(_0x28f4('0xa'));var crypto=require(_0x28f4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x28f4('0xc'));var toCsv=require('to-csv');var querystring=require(_0x28f4('0xd'));var Papa=require(_0x28f4('0xe'));var Redis=require('ioredis');var authService=require(_0x28f4('0xf'));var qs=require(_0x28f4('0x10'));var as=require(_0x28f4('0x11'));var hardwareService=require(_0x28f4('0x12'));var logger=require(_0x28f4('0x13'))(_0x28f4('0x14'));var utils=require(_0x28f4('0x15'));var config=require(_0x28f4('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x28f4('0x17'))['db'];function respondWithStatusCode(_0x2b29e8,_0x1e1205){_0x1e1205=_0x1e1205||0xcc;return function(_0x1e1de9){if(_0x1e1de9){return _0x2b29e8[_0x28f4('0x18')](_0x1e1205);}return _0x2b29e8[_0x28f4('0x19')](_0x1e1205)[_0x28f4('0x1a')]();};}function respondWithResult(_0x30df02,_0x4f1d72){_0x4f1d72=_0x4f1d72||0xc8;return function(_0x26d62b){if(_0x26d62b){return _0x30df02['status'](_0x4f1d72)['json'](_0x26d62b);}};}function respondWithFilteredResult(_0x4e0817,_0x2adf11){return function(_0xfac73d){if(_0xfac73d){var _0x480fb6=typeof _0x2adf11[_0x28f4('0x1b')]===_0x28f4('0x1c')&&typeof _0x2adf11['limit']===_0x28f4('0x1c');var _0x3704a4=_0xfac73d['count'];var _0x36ee22=_0x480fb6?0x0:_0x2adf11[_0x28f4('0x1b')];var _0x2839f2=_0x480fb6?_0xfac73d['count']:_0x2adf11[_0x28f4('0x1b')]+_0x2adf11[_0x28f4('0x1d')];var _0x35432f;if(_0x2839f2>=_0x3704a4){_0x2839f2=_0x3704a4;_0x35432f=0xc8;}else{_0x35432f=0xce;}_0x4e0817[_0x28f4('0x19')](_0x35432f);return _0x4e0817['set']('Content-Range',_0x36ee22+'-'+_0x2839f2+'/'+_0x3704a4)[_0x28f4('0x1e')](_0xfac73d);}return null;};}function patchUpdates(_0x474ce4){return function(_0xb7cc5c){try{jsonpatch[_0x28f4('0x1f')](_0xb7cc5c,_0x474ce4,!![]);}catch(_0x346dc9){return BPromise[_0x28f4('0x20')](_0x346dc9);}return _0xb7cc5c['save']();};}function saveUpdates(_0xc9caec,_0x1444ce){return function(_0x3c0bb3){if(_0x3c0bb3){return _0x3c0bb3[_0x28f4('0x21')](_0xc9caec)[_0x28f4('0x22')](function(_0x1a1918){return _0x1a1918;});}return null;};}function removeEntity(_0x4dc5d5,_0x1d2dfb){return function(_0x45ccc1){if(_0x45ccc1){return _0x45ccc1[_0x28f4('0x23')]()[_0x28f4('0x22')](function(){var _0xfb7ed=_0x45ccc1['get']({'plain':!![]});var _0x359352=_0x28f4('0x24');return db[_0x28f4('0x25')][_0x28f4('0x23')]({'where':{'type':_0x359352,'resourceId':_0xfb7ed['id']}})[_0x28f4('0x22')](function(){return _0x45ccc1;});})[_0x28f4('0x22')](function(){_0x4dc5d5[_0x28f4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc6cb50,_0x2f5a07){return function(_0x15f973){if(!_0x15f973){_0xc6cb50[_0x28f4('0x18')](0x194);}return _0x15f973;};}function handleError(_0x36a1a9,_0x179d5f){_0x179d5f=_0x179d5f||0x1f4;return function(_0x3458bd){logger[_0x28f4('0x26')](_0x3458bd['stack']);if(_0x3458bd[_0x28f4('0x27')]){delete _0x3458bd[_0x28f4('0x27')];}_0x36a1a9[_0x28f4('0x19')](_0x179d5f)[_0x28f4('0x28')](_0x3458bd);};}exports['index']=function(_0x1f5dea,_0x1922f4){var _0x251261={},_0x4ddc0f={},_0x4fc274={'count':0x0,'rows':[]};var _0x39ab07=_[_0x28f4('0x29')](db[_0x28f4('0x2a')][_0x28f4('0x2b')],function(_0x2232bc){return{'name':_0x2232bc[_0x28f4('0x2c')],'type':_0x2232bc['type'][_0x28f4('0x2d')]};});_0x4ddc0f[_0x28f4('0x2e')]=_[_0x28f4('0x29')](_0x39ab07,_0x28f4('0x27'));_0x4ddc0f[_0x28f4('0x2f')]=_[_0x28f4('0x30')](_0x1f5dea[_0x28f4('0x2f')]);_0x4ddc0f['filters']=_[_0x28f4('0x31')](_0x4ddc0f[_0x28f4('0x2e')],_0x4ddc0f[_0x28f4('0x2f')]);_0x251261[_0x28f4('0x32')]=_[_0x28f4('0x31')](_0x4ddc0f[_0x28f4('0x2e')],qs[_0x28f4('0x33')](_0x1f5dea['query'][_0x28f4('0x33')]));_0x251261[_0x28f4('0x32')]=_0x251261[_0x28f4('0x32')][_0x28f4('0x34')]?_0x251261[_0x28f4('0x32')]:_0x4ddc0f[_0x28f4('0x2e')];if(!_0x1f5dea['query']['hasOwnProperty'](_0x28f4('0x35'))){_0x251261['limit']=qs[_0x28f4('0x1d')](_0x1f5dea[_0x28f4('0x2f')]['limit']);_0x251261[_0x28f4('0x1b')]=qs[_0x28f4('0x1b')](_0x1f5dea[_0x28f4('0x2f')][_0x28f4('0x1b')]);}_0x251261[_0x28f4('0x36')]=qs[_0x28f4('0x37')](_0x1f5dea['query']['sort']);_0x251261[_0x28f4('0x38')]=qs[_0x28f4('0x39')](_[_0x28f4('0x3a')](_0x1f5dea[_0x28f4('0x2f')],_0x4ddc0f[_0x28f4('0x39')]),_0x39ab07);if(_0x1f5dea['query']['filter']){_0x251261[_0x28f4('0x38')]=_[_0x28f4('0x3b')](_0x251261['where'],{'$or':_[_0x28f4('0x29')](_0x39ab07,function(_0x1bc9fa){if(_0x1bc9fa[_0x28f4('0x3c')]!==_0x28f4('0x3d')){var _0x9886e7={};_0x9886e7[_0x1bc9fa['name']]={'$like':'%'+_0x1f5dea[_0x28f4('0x2f')][_0x28f4('0x3e')]+'%'};return _0x9886e7;}})});}_0x251261=_[_0x28f4('0x3b')]({},_0x251261,_0x1f5dea[_0x28f4('0x3f')]);var _0x52c733={'where':_0x251261[_0x28f4('0x38')]};return db[_0x28f4('0x2a')][_0x28f4('0x40')](_0x52c733)[_0x28f4('0x22')](function(_0x3e4b28){_0x4fc274[_0x28f4('0x40')]=_0x3e4b28;if(_0x1f5dea[_0x28f4('0x2f')][_0x28f4('0x41')]){_0x251261[_0x28f4('0x42')]=[{'all':!![]}];}return db[_0x28f4('0x2a')][_0x28f4('0x43')](_0x251261);})[_0x28f4('0x22')](function(_0x33f8a4){_0x4fc274['rows']=_0x33f8a4;return _0x4fc274;})[_0x28f4('0x22')](respondWithFilteredResult(_0x1922f4,_0x251261))[_0x28f4('0x44')](handleError(_0x1922f4,null));};exports[_0x28f4('0x45')]=function(_0xa6d091,_0x1ef66e){var _0x2f0e0b={'raw':![],'where':{'id':_0xa6d091[_0x28f4('0x46')]['id']}},_0x577f0e={};_0x577f0e[_0x28f4('0x2e')]=_[_0x28f4('0x30')](db[_0x28f4('0x2a')]['rawAttributes']);_0x577f0e[_0x28f4('0x2f')]=_['keys'](_0xa6d091[_0x28f4('0x2f')]);_0x577f0e[_0x28f4('0x39')]=_[_0x28f4('0x31')](_0x577f0e[_0x28f4('0x2e')],_0x577f0e[_0x28f4('0x2f')]);_0x2f0e0b[_0x28f4('0x32')]=_['intersection'](_0x577f0e[_0x28f4('0x2e')],qs['fields'](_0xa6d091[_0x28f4('0x2f')][_0x28f4('0x33')]));_0x2f0e0b['attributes']=_0x2f0e0b[_0x28f4('0x32')][_0x28f4('0x34')]?_0x2f0e0b['attributes']:_0x577f0e[_0x28f4('0x2e')];if(_0xa6d091[_0x28f4('0x2f')][_0x28f4('0x41')]){_0x2f0e0b[_0x28f4('0x42')]=[{'all':!![]}];}_0x2f0e0b=_[_0x28f4('0x3b')]({},_0x2f0e0b,_0xa6d091[_0x28f4('0x3f')]);return db[_0x28f4('0x2a')]['find'](_0x2f0e0b)[_0x28f4('0x22')](handleEntityNotFound(_0x1ef66e,null))['then'](respondWithResult(_0x1ef66e,null))[_0x28f4('0x44')](handleError(_0x1ef66e,null));};exports[_0x28f4('0x47')]=function(_0x22844d,_0x5ec94c){return db[_0x28f4('0x2a')][_0x28f4('0x47')](_0x22844d[_0x28f4('0x48')],{})[_0x28f4('0x22')](function(_0x3e754d){var _0x34e4d7=_0x22844d[_0x28f4('0x49')][_0x28f4('0x4a')]({'plain':!![]});if(!_0x34e4d7)throw new Error(_0x28f4('0x4b'));if(_0x34e4d7[_0x28f4('0x4c')]===_0x28f4('0x49')){var _0x77679e=_0x3e754d['get']({'plain':!![]});var _0x572612=_0x28f4('0x24');return db[_0x28f4('0x4d')][_0x28f4('0x4e')]({'where':{'name':_0x572612,'userProfileId':_0x34e4d7[_0x28f4('0x4f')]},'raw':!![]})[_0x28f4('0x22')](function(_0x12c16a){if(_0x12c16a&&_0x12c16a[_0x28f4('0x50')]===0x0){return db[_0x28f4('0x25')][_0x28f4('0x47')]({'name':_0x77679e['name'],'resourceId':_0x77679e['id'],'type':_0x12c16a[_0x28f4('0x27')],'sectionId':_0x12c16a['id']},{})[_0x28f4('0x22')](function(){return _0x3e754d;});}else{return _0x3e754d;}})['catch'](function(_0x30aa50){logger[_0x28f4('0x26')](_0x28f4('0x51'),_0x30aa50);throw _0x30aa50;});}return _0x3e754d;})[_0x28f4('0x22')](respondWithResult(_0x5ec94c,0xc9))[_0x28f4('0x44')](handleError(_0x5ec94c,null));};exports[_0x28f4('0x21')]=function(_0x5697e0,_0xbcf143){if(_0x5697e0['body']['id']){delete _0x5697e0['body']['id'];}return db[_0x28f4('0x2a')][_0x28f4('0x4e')]({'where':{'id':_0x5697e0['params']['id']}})[_0x28f4('0x22')](handleEntityNotFound(_0xbcf143,null))[_0x28f4('0x22')](saveUpdates(_0x5697e0[_0x28f4('0x48')],null))['then'](respondWithResult(_0xbcf143,null))[_0x28f4('0x44')](handleError(_0xbcf143,null));};exports[_0x28f4('0x23')]=function(_0x10e78b,_0xb1e817){return db[_0x28f4('0x2a')][_0x28f4('0x4e')]({'where':{'id':_0x10e78b['params']['id']}})[_0x28f4('0x22')](handleEntityNotFound(_0xb1e817,null))[_0x28f4('0x22')](removeEntity(_0xb1e817,null))[_0x28f4('0x44')](handleError(_0xb1e817,null));};exports[_0x28f4('0x52')]=function(_0x3f0f5d,_0x1e767f,_0x39b9f1){var _0x4872fa=require(_0x28f4('0x53'));return db[_0x28f4('0x2a')][_0x28f4('0x4e')]({'where':{'id':_0x3f0f5d[_0x28f4('0x46')]['id']},'raw':!![]})[_0x28f4('0x22')](handleEntityNotFound(_0x1e767f,null))[_0x28f4('0x22')](function(){_0x4872fa[_0x28f4('0x52')](_0x3f0f5d[_0x28f4('0x46')]['id']);})['then'](respondWithStatusCode(_0x1e767f,null))[_0x28f4('0x44')](handleError(_0x1e767f,null));};
\ No newline at end of file
+var _0x14ff=['merge','options','Schedule','includeAll','findAll','catch','show','params','keys','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','Scheduler','UserProfileResource','destroy','end','error','stack','name','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL'];(function(_0x561c4b,_0x1810d5){var _0x3c7e03=function(_0x28c4c6){while(--_0x28c4c6){_0x561c4b['push'](_0x561c4b['shift']());}};_0x3c7e03(++_0x1810d5);}(_0x14ff,0x14c));var _0xf14f=function(_0x1083b5,_0x109255){_0x1083b5=_0x1083b5-0x0;var _0x4dc854=_0x14ff[_0x1083b5];return _0x4dc854;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf14f('0x0'));var BPromise=require(_0xf14f('0x1'));var Mustache=require('mustache');var util=require(_0xf14f('0x2'));var path=require(_0xf14f('0x3'));var sox=require(_0xf14f('0x4'));var csv=require(_0xf14f('0x5'));var ejs=require(_0xf14f('0x6'));var fs=require('fs');var fs_extra=require(_0xf14f('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf14f('0x8'));var deskjs=require(_0xf14f('0x9'));var toCsv=require(_0xf14f('0x5'));var querystring=require(_0xf14f('0xa'));var Papa=require(_0xf14f('0xb'));var Redis=require(_0xf14f('0xc'));var authService=require(_0xf14f('0xd'));var qs=require(_0xf14f('0xe'));var as=require(_0xf14f('0xf'));var hardwareService=require(_0xf14f('0x10'));var logger=require(_0xf14f('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf14f('0x12'));var licenseUtil=require(_0xf14f('0x13'));var db=require(_0xf14f('0x14'))['db'];function respondWithStatusCode(_0x3971d4,_0x45b742){_0x45b742=_0x45b742||0xcc;return function(_0x1ae6f7){if(_0x1ae6f7){return _0x3971d4[_0xf14f('0x15')](_0x45b742);}return _0x3971d4[_0xf14f('0x16')](_0x45b742)['end']();};}function respondWithResult(_0x9973cb,_0x590fab){_0x590fab=_0x590fab||0xc8;return function(_0x3d7d89){if(_0x3d7d89){return _0x9973cb['status'](_0x590fab)[_0xf14f('0x17')](_0x3d7d89);}};}function respondWithFilteredResult(_0xb214a7,_0xb805ee){return function(_0x10fba4){if(_0x10fba4){var _0x57a5f5=typeof _0xb805ee[_0xf14f('0x18')]===_0xf14f('0x19')&&typeof _0xb805ee[_0xf14f('0x1a')]==='undefined';var _0x4e6b9c=_0x10fba4[_0xf14f('0x1b')];var _0x1f9c3d=_0x57a5f5?0x0:_0xb805ee[_0xf14f('0x18')];var _0x40b0fe=_0x57a5f5?_0x10fba4[_0xf14f('0x1b')]:_0xb805ee['offset']+_0xb805ee[_0xf14f('0x1a')];var _0x752893;if(_0x40b0fe>=_0x4e6b9c){_0x40b0fe=_0x4e6b9c;_0x752893=0xc8;}else{_0x752893=0xce;}_0xb214a7[_0xf14f('0x16')](_0x752893);return _0xb214a7['set'](_0xf14f('0x1c'),_0x1f9c3d+'-'+_0x40b0fe+'/'+_0x4e6b9c)[_0xf14f('0x17')](_0x10fba4);}return null;};}function patchUpdates(_0x5a4e02){return function(_0x1dd08a){try{jsonpatch[_0xf14f('0x1d')](_0x1dd08a,_0x5a4e02,!![]);}catch(_0x21c54b){return BPromise[_0xf14f('0x1e')](_0x21c54b);}return _0x1dd08a[_0xf14f('0x1f')]();};}function saveUpdates(_0x4913fc,_0x43f7d8){return function(_0x378731){if(_0x378731){return _0x378731[_0xf14f('0x20')](_0x4913fc)[_0xf14f('0x21')](function(_0x4567ba){return _0x4567ba;});}return null;};}function removeEntity(_0x5c71f8,_0x5ab585){return function(_0x2b42e4){if(_0x2b42e4){return _0x2b42e4['destroy']()[_0xf14f('0x21')](function(){var _0x26581c=_0x2b42e4['get']({'plain':!![]});var _0x4ad713=_0xf14f('0x22');return db[_0xf14f('0x23')][_0xf14f('0x24')]({'where':{'type':_0x4ad713,'resourceId':_0x26581c['id']}})[_0xf14f('0x21')](function(){return _0x2b42e4;});})[_0xf14f('0x21')](function(){_0x5c71f8['status'](0xcc)[_0xf14f('0x25')]();});}};}function handleEntityNotFound(_0x3bf47b,_0x33e3f4){return function(_0x554623){if(!_0x554623){_0x3bf47b[_0xf14f('0x15')](0x194);}return _0x554623;};}function handleError(_0x2427c5,_0x324343){_0x324343=_0x324343||0x1f4;return function(_0x436f22){logger[_0xf14f('0x26')](_0x436f22[_0xf14f('0x27')]);if(_0x436f22[_0xf14f('0x28')]){delete _0x436f22['name'];}_0x2427c5[_0xf14f('0x16')](_0x324343)['send'](_0x436f22);};}exports['index']=function(_0x66e7a5,_0x415306){var _0x3777ff={},_0x4a2c2c={},_0x4d80da={'count':0x0,'rows':[]};var _0x6ecfe5=_['map'](db['Schedule'][_0xf14f('0x29')],function(_0x182ae9){return{'name':_0x182ae9[_0xf14f('0x2a')],'type':_0x182ae9[_0xf14f('0x2b')][_0xf14f('0x2c')]};});_0x4a2c2c['model']=_[_0xf14f('0x2d')](_0x6ecfe5,_0xf14f('0x28'));_0x4a2c2c[_0xf14f('0x2e')]=_['keys'](_0x66e7a5[_0xf14f('0x2e')]);_0x4a2c2c[_0xf14f('0x2f')]=_[_0xf14f('0x30')](_0x4a2c2c[_0xf14f('0x31')],_0x4a2c2c[_0xf14f('0x2e')]);_0x3777ff[_0xf14f('0x32')]=_['intersection'](_0x4a2c2c['model'],qs[_0xf14f('0x33')](_0x66e7a5[_0xf14f('0x2e')]['fields']));_0x3777ff[_0xf14f('0x32')]=_0x3777ff['attributes']['length']?_0x3777ff[_0xf14f('0x32')]:_0x4a2c2c['model'];if(!_0x66e7a5['query'][_0xf14f('0x34')]('nolimit')){_0x3777ff[_0xf14f('0x1a')]=qs[_0xf14f('0x1a')](_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x1a')]);_0x3777ff[_0xf14f('0x18')]=qs['offset'](_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x18')]);}_0x3777ff['order']=qs['sort'](_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x35')]);_0x3777ff[_0xf14f('0x36')]=qs['filters'](_[_0xf14f('0x37')](_0x66e7a5['query'],_0x4a2c2c[_0xf14f('0x2f')]),_0x6ecfe5);if(_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x38')]){_0x3777ff[_0xf14f('0x36')]=_['merge'](_0x3777ff['where'],{'$or':_[_0xf14f('0x2d')](_0x6ecfe5,function(_0x65c0ea){if(_0x65c0ea[_0xf14f('0x2b')]!==_0xf14f('0x39')){var _0x313aec={};_0x313aec[_0x65c0ea[_0xf14f('0x28')]]={'$like':'%'+_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x38')]+'%'};return _0x313aec;}})});}_0x3777ff=_[_0xf14f('0x3a')]({},_0x3777ff,_0x66e7a5[_0xf14f('0x3b')]);var _0x238f2e={'where':_0x3777ff['where']};return db[_0xf14f('0x3c')][_0xf14f('0x1b')](_0x238f2e)[_0xf14f('0x21')](function(_0x352ad1){_0x4d80da[_0xf14f('0x1b')]=_0x352ad1;if(_0x66e7a5[_0xf14f('0x2e')][_0xf14f('0x3d')]){_0x3777ff['include']=[{'all':!![]}];}return db[_0xf14f('0x3c')][_0xf14f('0x3e')](_0x3777ff);})[_0xf14f('0x21')](function(_0x12d635){_0x4d80da['rows']=_0x12d635;return _0x4d80da;})[_0xf14f('0x21')](respondWithFilteredResult(_0x415306,_0x3777ff))[_0xf14f('0x3f')](handleError(_0x415306,null));};exports[_0xf14f('0x40')]=function(_0x1621a1,_0x239025){var _0x211a94={'raw':![],'where':{'id':_0x1621a1[_0xf14f('0x41')]['id']}},_0x147c10={};_0x147c10[_0xf14f('0x31')]=_[_0xf14f('0x42')](db[_0xf14f('0x3c')][_0xf14f('0x29')]);_0x147c10['query']=_[_0xf14f('0x42')](_0x1621a1['query']);_0x147c10[_0xf14f('0x2f')]=_['intersection'](_0x147c10[_0xf14f('0x31')],_0x147c10['query']);_0x211a94['attributes']=_[_0xf14f('0x30')](_0x147c10[_0xf14f('0x31')],qs[_0xf14f('0x33')](_0x1621a1[_0xf14f('0x2e')]['fields']));_0x211a94[_0xf14f('0x32')]=_0x211a94[_0xf14f('0x32')][_0xf14f('0x43')]?_0x211a94['attributes']:_0x147c10[_0xf14f('0x31')];if(_0x1621a1[_0xf14f('0x2e')][_0xf14f('0x3d')]){_0x211a94[_0xf14f('0x44')]=[{'all':!![]}];}_0x211a94=_[_0xf14f('0x3a')]({},_0x211a94,_0x1621a1[_0xf14f('0x3b')]);return db[_0xf14f('0x3c')][_0xf14f('0x45')](_0x211a94)[_0xf14f('0x21')](handleEntityNotFound(_0x239025,null))[_0xf14f('0x21')](respondWithResult(_0x239025,null))['catch'](handleError(_0x239025,null));};exports[_0xf14f('0x46')]=function(_0x1cfe1c,_0x1ac6aa){return db[_0xf14f('0x3c')][_0xf14f('0x46')](_0x1cfe1c[_0xf14f('0x47')],{})[_0xf14f('0x21')](function(_0x1c5a3d){var _0x12b5ec=_0x1cfe1c['user'][_0xf14f('0x48')]({'plain':!![]});if(!_0x12b5ec)throw new Error(_0xf14f('0x49'));if(_0x12b5ec[_0xf14f('0x4a')]==='user'){var _0x231286=_0x1c5a3d[_0xf14f('0x48')]({'plain':!![]});var _0x9b063d=_0xf14f('0x22');return db['UserProfileSection'][_0xf14f('0x45')]({'where':{'name':_0x9b063d,'userProfileId':_0x12b5ec['userProfileId']},'raw':!![]})['then'](function(_0x4bca3b){if(_0x4bca3b&&_0x4bca3b['autoAssociation']===0x0){return db[_0xf14f('0x23')][_0xf14f('0x46')]({'name':_0x231286['name'],'resourceId':_0x231286['id'],'type':_0x4bca3b[_0xf14f('0x28')],'sectionId':_0x4bca3b['id']},{})[_0xf14f('0x21')](function(){return _0x1c5a3d;});}else{return _0x1c5a3d;}})[_0xf14f('0x3f')](function(_0x248d66){logger[_0xf14f('0x26')](_0xf14f('0x4b'),_0x248d66);throw _0x248d66;});}return _0x1c5a3d;})[_0xf14f('0x21')](respondWithResult(_0x1ac6aa,0xc9))[_0xf14f('0x3f')](handleError(_0x1ac6aa,null));};exports[_0xf14f('0x20')]=function(_0x34a911,_0x1e6104){if(_0x34a911['body']['id']){delete _0x34a911[_0xf14f('0x47')]['id'];}return db[_0xf14f('0x3c')]['find']({'where':{'id':_0x34a911[_0xf14f('0x41')]['id']}})[_0xf14f('0x21')](handleEntityNotFound(_0x1e6104,null))[_0xf14f('0x21')](saveUpdates(_0x34a911[_0xf14f('0x47')],null))[_0xf14f('0x21')](respondWithResult(_0x1e6104,null))[_0xf14f('0x3f')](handleError(_0x1e6104,null));};exports[_0xf14f('0x24')]=function(_0x4736f,_0x4cb1e6){return db[_0xf14f('0x3c')][_0xf14f('0x45')]({'where':{'id':_0x4736f['params']['id']}})['then'](handleEntityNotFound(_0x4cb1e6,null))[_0xf14f('0x21')](removeEntity(_0x4cb1e6,null))[_0xf14f('0x3f')](handleError(_0x4cb1e6,null));};exports[_0xf14f('0x4c')]=function(_0x4c2ea5,_0xa1f63d,_0x44c9ea){var _0x524c7e=require(_0xf14f('0x4d'));return db['Schedule'][_0xf14f('0x45')]({'where':{'id':_0x4c2ea5['params']['id']},'raw':!![]})[_0xf14f('0x21')](handleEntityNotFound(_0xa1f63d,null))['then'](function(){_0x524c7e[_0xf14f('0x4c')](_0x4c2ea5['params']['id']);})['then'](respondWithStatusCode(_0xa1f63d,null))[_0xf14f('0x3f')](handleError(_0xa1f63d,null));};
\ No newline at end of file
index 47994f7..ac56a17 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc315=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./schedule.attributes','define','Schedule','tools_schedules'];(function(_0x799242,_0xef7524){var _0x40478e=function(_0x33a88e){while(--_0x33a88e){_0x799242['push'](_0x799242['shift']());}};_0x40478e(++_0xef7524);}(_0xc315,0x11e));var _0x5c31=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0xc315[_0x39609a];return _0xecd92;};'use strict';var _=require(_0x5c31('0x0'));var util=require('util');var logger=require(_0x5c31('0x1'))(_0x5c31('0x2'));var moment=require(_0x5c31('0x3'));var BPromise=require(_0x5c31('0x4'));var rp=require(_0x5c31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5c31('0x6'));var attributes=require(_0x5c31('0x7'));module['exports']=function(_0x3bc18a,_0x3821d4){return _0x3bc18a[_0x5c31('0x8')](_0x5c31('0x9'),attributes,{'tableName':_0x5c31('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x8488=['Schedule','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define'];(function(_0x2466ec,_0x4260dc){var _0x450c0b=function(_0x6e7ab6){while(--_0x6e7ab6){_0x2466ec['push'](_0x2466ec['shift']());}};_0x450c0b(++_0x4260dc);}(_0x8488,0x1b1));var _0x8848=function(_0xa82178,_0x5f0ad5){_0xa82178=_0xa82178-0x0;var _0x3e02c9=_0x8488[_0xa82178];return _0x3e02c9;};'use strict';var _=require(_0x8848('0x0'));var util=require(_0x8848('0x1'));var logger=require(_0x8848('0x2'))(_0x8848('0x3'));var moment=require(_0x8848('0x4'));var BPromise=require('bluebird');var rp=require(_0x8848('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8848('0x6'));var config=require(_0x8848('0x7'));var attributes=require(_0x8848('0x8'));module[_0x8848('0x9')]=function(_0x2e605c,_0xcfd7e9){return _0x2e605c[_0x8848('0xa')](_0x8848('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8e36492..5e2fad7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe3a3=['../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe3a3,0x144));var _0x3e3a=function(_0x3b319a,_0x2f3e48){_0x3b319a=_0x3b319a-0x0;var _0x569ae5=_0xe3a3[_0x3b319a];return _0x569ae5;};'use strict';var _=require(_0x3e3a('0x0'));var util=require('util');var moment=require(_0x3e3a('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e3a('0x2'));var db=require(_0x3e3a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e3a('0x4'))(_0x3e3a('0x5'));var config=require(_0x3e3a('0x6'));var jayson=require(_0x3e3a('0x7'));var client=jayson[_0x3e3a('0x8')][_0x3e3a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34aa18,_0x4ac68a,_0x387818){return new BPromise(function(_0x5a97f4,_0x48be22){return client[_0x3e3a('0xa')](_0x34aa18,_0x387818)[_0x3e3a('0xb')](function(_0x1783a9){logger['info'](_0x3e3a('0xc'),_0x4ac68a,'request\x20sent');logger[_0x3e3a('0xd')](_0x3e3a('0xe'),_0x4ac68a,_0x3e3a('0xf'),JSON['stringify'](_0x1783a9));if(_0x1783a9['error']){if(_0x1783a9[_0x3e3a('0x10')][_0x3e3a('0x11')]===0x1f4){logger[_0x3e3a('0x10')](_0x3e3a('0xc'),_0x4ac68a,_0x1783a9[_0x3e3a('0x10')][_0x3e3a('0x12')]);return _0x48be22(_0x1783a9[_0x3e3a('0x10')][_0x3e3a('0x12')]);}logger[_0x3e3a('0x10')]('Schedule,\x20%s,\x20%s',_0x4ac68a,_0x1783a9[_0x3e3a('0x10')]['message']);return _0x5a97f4(_0x1783a9[_0x3e3a('0x10')][_0x3e3a('0x12')]);}else{logger[_0x3e3a('0x13')]('Schedule,\x20%s,\x20%s',_0x4ac68a,_0x3e3a('0xf'));_0x5a97f4(_0x1783a9[_0x3e3a('0x14')][_0x3e3a('0x12')]);}})[_0x3e3a('0x15')](function(_0xc32a4a){logger[_0x3e3a('0x10')](_0x3e3a('0xc'),_0x4ac68a,_0xc32a4a);_0x48be22(_0xc32a4a);});});}
\ No newline at end of file
+var _0x6b90=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x23e4bf,_0x590a4f){var _0x52bd14=function(_0x4375af){while(--_0x4375af){_0x23e4bf['push'](_0x23e4bf['shift']());}};_0x52bd14(++_0x590a4f);}(_0x6b90,0x1df));var _0x06b9=function(_0xbf8ec1,_0x9169c8){_0xbf8ec1=_0xbf8ec1-0x0;var _0xc84567=_0x6b90[_0xbf8ec1];return _0xc84567;};'use strict';var _=require('lodash');var util=require(_0x06b9('0x0'));var moment=require(_0x06b9('0x1'));var BPromise=require(_0x06b9('0x2'));var rs=require(_0x06b9('0x3'));var fs=require('fs');var Redis=require(_0x06b9('0x4'));var db=require(_0x06b9('0x5'))['db'];var utils=require(_0x06b9('0x6'));var logger=require(_0x06b9('0x7'))(_0x06b9('0x8'));var config=require(_0x06b9('0x9'));var jayson=require(_0x06b9('0xa'));var client=jayson[_0x06b9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59418f,_0x3d5e3c,_0x4b6a36){return new BPromise(function(_0x455f9b,_0x392e3b){return client[_0x06b9('0xc')](_0x59418f,_0x4b6a36)['then'](function(_0x204691){logger[_0x06b9('0xd')](_0x06b9('0xe'),_0x3d5e3c,_0x06b9('0xf'));logger['debug'](_0x06b9('0x10'),_0x3d5e3c,'request\x20sent',JSON[_0x06b9('0x11')](_0x204691));if(_0x204691[_0x06b9('0x12')]){if(_0x204691['error'][_0x06b9('0x13')]===0x1f4){logger[_0x06b9('0x12')](_0x06b9('0xe'),_0x3d5e3c,_0x204691[_0x06b9('0x12')][_0x06b9('0x14')]);return _0x392e3b(_0x204691['error'][_0x06b9('0x14')]);}logger[_0x06b9('0x12')]('Schedule,\x20%s,\x20%s',_0x3d5e3c,_0x204691[_0x06b9('0x12')][_0x06b9('0x14')]);return _0x455f9b(_0x204691[_0x06b9('0x12')][_0x06b9('0x14')]);}else{logger[_0x06b9('0xd')]('Schedule,\x20%s,\x20%s',_0x3d5e3c,_0x06b9('0xf'));_0x455f9b(_0x204691[_0x06b9('0x15')]['message']);}})[_0x06b9('0x16')](function(_0x36a735){logger[_0x06b9('0x12')](_0x06b9('0xe'),_0x3d5e3c,_0x36a735);_0x392e3b(_0x36a735);});});}
\ No newline at end of file
index cee622a..21332ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeae2=['fs-extra','../../components/auth/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xeae2,0x12f));var _0x2eae=function(_0xdea52,_0x256362){_0xdea52=_0xdea52-0x0;var _0x4a5a90=_0xeae2[_0xdea52];return _0x4a5a90;};'use strict';var multer=require('multer');var util=require(_0x2eae('0x0'));var path=require(_0x2eae('0x1'));var timeout=require(_0x2eae('0x2'));var express=require(_0x2eae('0x3'));var router=express[_0x2eae('0x4')]();var fs_extra=require(_0x2eae('0x5'));var auth=require(_0x2eae('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2eae('0x7'));var controller=require(_0x2eae('0x8'));router[_0x2eae('0x9')]('/',auth[_0x2eae('0xa')](),controller[_0x2eae('0xb')]);router[_0x2eae('0x9')]('/describe',auth[_0x2eae('0xa')](),controller[_0x2eae('0xc')]);router[_0x2eae('0x9')](_0x2eae('0xd'),auth['isAuthenticated'](),controller[_0x2eae('0xe')]);router['get'](_0x2eae('0xf'),auth[_0x2eae('0xa')](),controller['download']);router[_0x2eae('0x10')]('/',auth['isAuthenticated'](),controller[_0x2eae('0x11')]);router['put'](_0x2eae('0xd'),auth[_0x2eae('0xa')](),controller[_0x2eae('0x12')]);router[_0x2eae('0x13')](_0x2eae('0xd'),auth[_0x2eae('0xa')](),controller[_0x2eae('0x14')]);module[_0x2eae('0x15')]=router;
\ No newline at end of file
+var _0x6233=['../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x30d521,_0x293a3f){var _0x17d2ca=function(_0x179ae7){while(--_0x179ae7){_0x30d521['push'](_0x30d521['shift']());}};_0x17d2ca(++_0x293a3f);}(_0x6233,0x160));var _0x3623=function(_0x3fadfb,_0x149cd6){_0x3fadfb=_0x3fadfb-0x0;var _0x2de459=_0x6233[_0x3fadfb];return _0x2de459;};'use strict';var multer=require(_0x3623('0x0'));var util=require(_0x3623('0x1'));var path=require(_0x3623('0x2'));var timeout=require(_0x3623('0x3'));var express=require('express');var router=express[_0x3623('0x4')]();var fs_extra=require(_0x3623('0x5'));var auth=require(_0x3623('0x6'));var interaction=require(_0x3623('0x7'));var config=require(_0x3623('0x8'));var controller=require('./screenRecording.controller');router[_0x3623('0x9')]('/',auth[_0x3623('0xa')](),controller['index']);router[_0x3623('0x9')](_0x3623('0xb'),auth['isAuthenticated'](),controller[_0x3623('0xc')]);router['get'](_0x3623('0xd'),auth[_0x3623('0xa')](),controller[_0x3623('0xe')]);router['get'](_0x3623('0xf'),auth['isAuthenticated'](),controller[_0x3623('0x10')]);router[_0x3623('0x11')]('/',auth[_0x3623('0xa')](),controller[_0x3623('0x12')]);router[_0x3623('0x13')](_0x3623('0xd'),auth[_0x3623('0xa')](),controller[_0x3623('0x14')]);router[_0x3623('0x15')](_0x3623('0xd'),auth[_0x3623('0xa')](),controller[_0x3623('0x16')]);module[_0x3623('0x17')]=router;
\ No newline at end of file
index b04a8d8..fa1f6c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1472=['../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','setDataValue','INTEGER','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','updatedAt','sequelize','moment','path'];(function(_0x36c1e8,_0x3a9ac2){var _0x5e78fd=function(_0x37492a){while(--_0x37492a){_0x36c1e8['push'](_0x36c1e8['shift']());}};_0x5e78fd(++_0x3a9ac2);}(_0x1472,0x166));var _0x2147=function(_0x10dc60,_0x2fcce1){_0x10dc60=_0x10dc60-0x0;var _0x47dec5=_0x1472[_0x10dc60];return _0x47dec5;};'use strict';var Sequelize=require(_0x2147('0x0'));var moment=require(_0x2147('0x1'));var path=require(_0x2147('0x2'));var config=require(_0x2147('0x3'));module[_0x2147('0x4')]={'format':{'type':Sequelize[_0x2147('0x5')],'get':function(){return this[_0x2147('0x6')](_0x2147('0x7'))?path['extname'](this['getDataValue'](_0x2147('0x7'))):undefined;}},'interactionid':{'type':Sequelize[_0x2147('0x8')]},'channel':{'type':Sequelize[_0x2147('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x4b8324){var _0x160f19=_0x4b8324['replace'](/\\/g,'/');this[_0x2147('0x9')](_0x2147('0x7'),_0x160f19);}},'rating':{'type':Sequelize[_0x2147('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x32dcbc){this[_0x2147('0x9')]('startedAt',moment()[_0x2147('0xb')](_0x32dcbc,'ms'));this[_0x2147('0x9')](_0x2147('0xc'),moment());this[_0x2147('0x9')](_0x2147('0xd'),_0x32dcbc);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2147('0x6')]('startedAt'))[_0x2147('0xe')](_0x2147('0xf'))[_0x2147('0x10')]();}},'closedAt':{'type':Sequelize[_0x2147('0x11')],'get':function(){return moment(this[_0x2147('0x6')](_0x2147('0xc')))[_0x2147('0xe')](_0x2147('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0x2147('0x11')],'get':function(){return moment(this[_0x2147('0x6')]('createdAt'))['format'](_0x2147('0xf'))[_0x2147('0x10')]();}},'updatedAt':{'type':Sequelize[_0x2147('0x11')],'get':function(){return moment(this['getDataValue'](_0x2147('0x12')))[_0x2147('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x2147('0x10')]();}}};
\ No newline at end of file
+var _0xeaab=['subtract','closedAt','DATE','format','toString','MM-DD-YYYY\x20HH:mm','createdAt','updatedAt','sequelize','path','../../config/environment','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt'];(function(_0x1269c6,_0x1c8942){var _0x4868c7=function(_0x1661bc){while(--_0x1661bc){_0x1269c6['push'](_0x1269c6['shift']());}};_0x4868c7(++_0x1c8942);}(_0xeaab,0xd9));var _0xbeaa=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xeaab[_0x502c7d];return _0x30b7ed;};'use strict';var Sequelize=require(_0xbeaa('0x0'));var moment=require('moment');var path=require(_0xbeaa('0x1'));var config=require(_0xbeaa('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xbeaa('0x3')](_0xbeaa('0x4'))?path[_0xbeaa('0x5')](this[_0xbeaa('0x3')](_0xbeaa('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0xbeaa('0x6')]},'channel':{'type':Sequelize[_0xbeaa('0x6')]},'value':{'type':Sequelize[_0xbeaa('0x6')],'set':function(_0x2f015b){var _0x42a779=_0x2f015b[_0xbeaa('0x7')](/\\/g,'/');this[_0xbeaa('0x8')](_0xbeaa('0x4'),_0x42a779);}},'rating':{'type':Sequelize[_0xbeaa('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x389c0b){this[_0xbeaa('0x8')](_0xbeaa('0xa'),moment()[_0xbeaa('0xb')](_0x389c0b,'ms'));this[_0xbeaa('0x8')](_0xbeaa('0xc'),moment());this[_0xbeaa('0x8')]('duration',_0x389c0b);}},'startedAt':{'type':Sequelize[_0xbeaa('0xd')],'get':function(){return moment(this['getDataValue'](_0xbeaa('0xa')))[_0xbeaa('0xe')]('MM-DD-YYYY\x20HH:mm')[_0xbeaa('0xf')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xbeaa('0x3')](_0xbeaa('0xc')))['format'](_0xbeaa('0x10'))[_0xbeaa('0xf')]();}},'createdAt':{'type':Sequelize[_0xbeaa('0xd')],'get':function(){return moment(this[_0xbeaa('0x3')](_0xbeaa('0x11')))[_0xbeaa('0xe')](_0xbeaa('0x10'))[_0xbeaa('0xf')]();}},'updatedAt':{'type':Sequelize[_0xbeaa('0xd')],'get':function(){return moment(this[_0xbeaa('0x3')](_0xbeaa('0x12')))[_0xbeaa('0xe')](_0xbeaa('0x10'))[_0xbeaa('0xf')]();}}};
\ No newline at end of file
index 5f972f8..fcead26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ef6=['keys','find','create','update','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','value','join','server/files/screen_recordings','existsSync','decryptFile','secrets','recording','root','ValidationError','ScreenRecording\x20not\x20found','filename','extname','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','ScreenRecording','rawAttributes','type','model','differenceBy','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','map','VIRTUAL','merge','options','count','includeAll','findAll','rows','catch','show','params'];(function(_0x1c4219,_0x505f12){var _0x3b35cc=function(_0x3c8695){while(--_0x3c8695){_0x1c4219['push'](_0x1c4219['shift']());}};_0x3b35cc(++_0x505f12);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5a57ad,_0x5920ed){_0x5a57ad=_0x5a57ad-0x0;var _0x28ff9c=_0x8ef6[_0x5a57ad];return _0x28ff9c;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x13280b,_0x5e4dbe){return function(_0x178460){if(!_0x178460){_0x13280b['sendStatus'](0x194);}return _0x178460;};}function handleError(_0x599243,_0x55d8b0){_0x55d8b0=_0x55d8b0||0x1f4;return function(_0x1a7ce1){logger[_0x68ef('0x29')](_0x1a7ce1[_0x68ef('0x2a')]);if(_0x1a7ce1[_0x68ef('0x2b')]){delete _0x1a7ce1['name'];}_0x599243['status'](_0x55d8b0)[_0x68ef('0x2c')](_0x1a7ce1);};}exports[_0x68ef('0x2d')]=function(_0x7bf96,_0x263b30){var _0x22ef25={},_0x201884={},_0x26288a={'count':0x0,'rows':[]};var _0x4579cb=_['map'](db[_0x68ef('0x2e')][_0x68ef('0x2f')],function(_0x132d9e){return{'name':_0x132d9e['fieldName'],'type':_0x132d9e[_0x68ef('0x30')]['key']};});_0x201884[_0x68ef('0x31')]=_[_0x68ef('0x32')](_['map'](_0x4579cb,'name'),[_0x68ef('0x33')]);_0x201884[_0x68ef('0x34')]=_['keys'](_0x7bf96[_0x68ef('0x34')]);_0x201884[_0x68ef('0x35')]=_[_0x68ef('0x36')](_0x201884[_0x68ef('0x31')],_0x201884['query']);_0x22ef25[_0x68ef('0x37')]=_[_0x68ef('0x36')](_0x201884['model'],qs[_0x68ef('0x38')](_0x7bf96['query'][_0x68ef('0x38')]));_0x22ef25[_0x68ef('0x37')]=_0x22ef25['attributes'][_0x68ef('0x39')]?_0x22ef25['attributes']:_0x201884[_0x68ef('0x31')];if(!_0x7bf96['query'][_0x68ef('0x3a')](_0x68ef('0x3b'))){_0x22ef25[_0x68ef('0x21')]=qs['limit'](_0x7bf96[_0x68ef('0x34')]['limit']);_0x22ef25[_0x68ef('0x1f')]=qs['offset'](_0x7bf96[_0x68ef('0x34')][_0x68ef('0x1f')]);}_0x22ef25[_0x68ef('0x3c')]=qs[_0x68ef('0x3d')](_0x7bf96[_0x68ef('0x34')][_0x68ef('0x3d')]);_0x22ef25['where']=qs[_0x68ef('0x35')](_[_0x68ef('0x3e')](_0x7bf96[_0x68ef('0x34')],_0x201884['filters']),_0x4579cb);if(_0x7bf96[_0x68ef('0x34')][_0x68ef('0x3f')]){_0x22ef25[_0x68ef('0x40')]=_['merge'](_0x22ef25['where'],{'$or':_[_0x68ef('0x41')](_0x4579cb,function(_0xec7de3){if(_0xec7de3[_0x68ef('0x30')]!==_0x68ef('0x42')){var _0x401459={};_0x401459[_0xec7de3[_0x68ef('0x2b')]]={'$like':'%'+_0x7bf96[_0x68ef('0x34')]['filter']+'%'};return _0x401459;}})});}_0x22ef25=_[_0x68ef('0x43')]({},_0x22ef25,_0x7bf96[_0x68ef('0x44')]);var _0x2f6ee0={'where':_0x22ef25[_0x68ef('0x40')]};return db['ScreenRecording'][_0x68ef('0x45')](_0x2f6ee0)[_0x68ef('0x27')](function(_0xcf595d){_0x26288a[_0x68ef('0x45')]=_0xcf595d;if(_0x7bf96[_0x68ef('0x34')][_0x68ef('0x46')]){_0x22ef25['include']=[{'all':!![]}];}return db[_0x68ef('0x2e')][_0x68ef('0x47')](_0x22ef25);})[_0x68ef('0x27')](function(_0x43796b){_0x26288a[_0x68ef('0x48')]=_0x43796b;return _0x26288a;})[_0x68ef('0x27')](respondWithFilteredResult(_0x263b30,_0x22ef25))[_0x68ef('0x49')](handleError(_0x263b30,null));};exports[_0x68ef('0x4a')]=function(_0xc687ab,_0x531096){var _0xad1a28={'raw':![],'where':{'id':_0xc687ab[_0x68ef('0x4b')]['id']}},_0x19d7a1={};_0x19d7a1[_0x68ef('0x31')]=_[_0x68ef('0x4c')](db[_0x68ef('0x2e')][_0x68ef('0x2f')]);_0x19d7a1['query']=_[_0x68ef('0x4c')](_0xc687ab['query']);_0x19d7a1[_0x68ef('0x35')]=_[_0x68ef('0x36')](_0x19d7a1[_0x68ef('0x31')],_0x19d7a1[_0x68ef('0x34')]);_0xad1a28['attributes']=_[_0x68ef('0x36')](_0x19d7a1['model'],qs[_0x68ef('0x38')](_0xc687ab['query'][_0x68ef('0x38')]));_0xad1a28[_0x68ef('0x37')]=_0xad1a28[_0x68ef('0x37')]['length']?_0xad1a28['attributes']:_0x19d7a1[_0x68ef('0x31')];if(_0xc687ab[_0x68ef('0x34')]['includeAll']){_0xad1a28['include']=[{'all':!![]}];}_0xad1a28=_['merge']({},_0xad1a28,_0xc687ab[_0x68ef('0x44')]);return db[_0x68ef('0x2e')][_0x68ef('0x4d')](_0xad1a28)[_0x68ef('0x27')](handleEntityNotFound(_0x531096,null))[_0x68ef('0x27')](respondWithResult(_0x531096,null))['catch'](handleError(_0x531096,null));};exports['create']=function(_0xc39f5b,_0x21f064){return db[_0x68ef('0x2e')][_0x68ef('0x4e')](_0xc39f5b['body'],{})[_0x68ef('0x27')](respondWithResult(_0x21f064,0xc9))[_0x68ef('0x49')](handleError(_0x21f064,null));};exports[_0x68ef('0x4f')]=function(_0x14142a,_0x53880c){if(_0x14142a['body']['id']){delete _0x14142a[_0x68ef('0x50')]['id'];}delete _0x14142a[_0x68ef('0x50')]['duration'];delete _0x14142a[_0x68ef('0x50')][_0x68ef('0x51')];delete _0x14142a[_0x68ef('0x50')][_0x68ef('0x52')];delete _0x14142a[_0x68ef('0x50')]['value'];return db[_0x68ef('0x2e')][_0x68ef('0x4d')]({'where':{'id':_0x14142a[_0x68ef('0x4b')]['id']}})['then'](handleEntityNotFound(_0x53880c,null))[_0x68ef('0x27')](saveUpdates(_0x14142a[_0x68ef('0x50')],null))[_0x68ef('0x27')](respondWithResult(_0x53880c,null))['catch'](handleError(_0x53880c,null));};exports[_0x68ef('0x53')]=function(_0x59e8ee,_0x574573){return db[_0x68ef('0x2e')]['describe']()[_0x68ef('0x27')](respondWithResult(_0x574573,null))[_0x68ef('0x49')](handleError(_0x574573,null));};exports[_0x68ef('0x54')]=function(_0x1e651f,_0x2a0be0,_0x45ae42){var _0x363498=require(_0x68ef('0x55'));var _0x2b35f4=![];var _0x247915={};if(_0x1e651f['query']['type']&&_0x1e651f[_0x68ef('0x34')][_0x68ef('0x30')]===_0x68ef('0x56')){_0x247915[_0x68ef('0x56')]=_0x1e651f[_0x68ef('0x4b')]['id'];}else{_0x247915['id']=_0x1e651f[_0x68ef('0x4b')]['id'];}return db[_0x68ef('0x2e')][_0x68ef('0x4d')]({'where':_0x247915,'attributes':['id',_0x68ef('0x57')],'raw':!![]})['then'](handleEntityNotFound(_0x2a0be0,null))['then'](function(_0x42a4b2){if(_0x42a4b2){var _0x5781c8=path[_0x68ef('0x58')](config['root'],_0x68ef('0x59'),_0x42a4b2[_0x68ef('0x57')]);var _0x552736=util[_0x68ef('0x33')]('%s.cypher',_0x5781c8);if(fs[_0x68ef('0x5a')](_0x552736)){_0x2b35f4=!![];return _0x363498[_0x68ef('0x5b')](_0x552736,_0x5781c8,config[_0x68ef('0x5c')][_0x68ef('0x5d')])[_0x68ef('0x27')](function(){return _0x42a4b2;});}return _0x42a4b2;}})[_0x68ef('0x27')](function(_0x5c347c){if(_0x5c347c){var _0x1cdaef=path[_0x68ef('0x58')](config[_0x68ef('0x5e')],_0x68ef('0x59'),_0x5c347c[_0x68ef('0x57')]);if(!fs[_0x68ef('0x5a')](_0x1cdaef)){throw new db['Sequelize'][(_0x68ef('0x5f'))](_0x68ef('0x60'));}if(_0x5c347c['filename']){return _0x2a0be0[_0x68ef('0x54')](_0x1cdaef,_0x5c347c[_0x68ef('0x61')]+path[_0x68ef('0x62')](_0x1cdaef),function(){if(_0x2b35f4){fs['unlink'](_0x1cdaef);}});}else{return _0x2a0be0[_0x68ef('0x54')](_0x1cdaef,function(_0x49d197){if(_0x2b35f4){fs['unlink'](_0x1cdaef);}});}}})[_0x68ef('0x49')](function(_0x540da5){if(_0x540da5[_0x68ef('0x63')]==='ScreenRecording\x20not\x20found'){_0x2a0be0[_0x68ef('0x1d')](0x194)[_0x68ef('0x2c')](_0x68ef('0x64'));}else{return handleError(_0x2a0be0,null);}});};exports[_0x68ef('0x28')]=function(_0x19ce17,_0x19a9c4){return db['ScreenRecording'][_0x68ef('0x4d')]({'where':{'id':_0x19ce17['params']['id']}})[_0x68ef('0x27')](function(_0x4b0c3e){if(_[_0x68ef('0x65')](_0x4b0c3e)){throw new ReferenceError(_0x68ef('0x66'));}return _0x4b0c3e;})[_0x68ef('0x27')](function(_0xf0a40f){var _0x2f409c=path[_0x68ef('0x58')](config[_0x68ef('0x5e')],'server/files/screen_recordings',_0xf0a40f[_0x68ef('0x57')]);logger[_0x68ef('0x67')](_0x68ef('0x68'),_0x2f409c);if(!_[_0x68ef('0x65')](_0xf0a40f[_0x68ef('0x57')])&&fs['existsSync'](_0x2f409c)){logger[_0x68ef('0x67')]('File:\x20\x22'+_0x2f409c+_0x68ef('0x69'));fs['unlinkSync'](_0x2f409c);}_0x2f409c=_0x2f409c+'.cypher';if(!_[_0x68ef('0x65')](_0xf0a40f[_0x68ef('0x57')])&&fs[_0x68ef('0x5a')](_0x2f409c)){logger[_0x68ef('0x67')]('File:\x20\x22'+_0x2f409c+_0x68ef('0x69'));fs['unlinkSync'](_0x2f409c);}return _0xf0a40f;})[_0x68ef('0x27')](function(_0x2d916e){if(!_0x2d916e)throw new InternalError();return _0x2d916e[_0x68ef('0x28')]();})['then'](function(){_0x19a9c4['status'](0xcc)[_0x68ef('0x1c')]();})[_0x68ef('0x49')](handleError(_0x19a9c4,null));};
\ No newline at end of file
+var _0x9c5a=['ScreenRecording','includeAll','findAll','rows','catch','params','include','find','create','body','duration','createdAt','closedAt','value','describe','download','uniqueid','join','root','server/files/screen_recordings','%s.cypher','decryptFile','recording','existsSync','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','destroy','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','stack','name','send','map','rawAttributes','fieldName','key','model','format','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x119ddf,_0x4901db){_0x119ddf=_0x119ddf-0x0;var _0x112c06=_0x9c5a[_0x119ddf];return _0x112c06;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)[_0xa9c5('0x18')]();});}};}function handleEntityNotFound(_0x32fc7d,_0x4cbba1){return function(_0x40f08b){if(!_0x40f08b){_0x32fc7d[_0xa9c5('0x17')](0x194);}return _0x40f08b;};}function handleError(_0x51b64a,_0x4e8a7f){_0x4e8a7f=_0x4e8a7f||0x1f4;return function(_0x242771){logger['error'](_0x242771[_0xa9c5('0x25')]);if(_0x242771[_0xa9c5('0x26')]){delete _0x242771['name'];}_0x51b64a[_0xa9c5('0x19')](_0x4e8a7f)[_0xa9c5('0x27')](_0x242771);};}exports['index']=function(_0x413edf,_0x32baf9){var _0x198cdf={},_0x185eb8={},_0x325c65={'count':0x0,'rows':[]};var _0x4f6e70=_[_0xa9c5('0x28')](db['ScreenRecording'][_0xa9c5('0x29')],function(_0x1ef388){return{'name':_0x1ef388[_0xa9c5('0x2a')],'type':_0x1ef388['type'][_0xa9c5('0x2b')]};});_0x185eb8[_0xa9c5('0x2c')]=_['differenceBy'](_[_0xa9c5('0x28')](_0x4f6e70,_0xa9c5('0x26')),[_0xa9c5('0x2d')]);_0x185eb8[_0xa9c5('0x2e')]=_[_0xa9c5('0x2f')](_0x413edf[_0xa9c5('0x2e')]);_0x185eb8[_0xa9c5('0x30')]=_['intersection'](_0x185eb8[_0xa9c5('0x2c')],_0x185eb8[_0xa9c5('0x2e')]);_0x198cdf[_0xa9c5('0x31')]=_[_0xa9c5('0x32')](_0x185eb8[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x33')]));_0x198cdf['attributes']=_0x198cdf['attributes'][_0xa9c5('0x34')]?_0x198cdf[_0xa9c5('0x31')]:_0x185eb8[_0xa9c5('0x2c')];if(!_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x35')](_0xa9c5('0x36'))){_0x198cdf['limit']=qs['limit'](_0x413edf['query'][_0xa9c5('0x1c')]);_0x198cdf[_0xa9c5('0x1e')]=qs['offset'](_0x413edf[_0xa9c5('0x2e')]['offset']);}_0x198cdf[_0xa9c5('0x37')]=qs[_0xa9c5('0x38')](_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x38')]);_0x198cdf['where']=qs[_0xa9c5('0x30')](_[_0xa9c5('0x39')](_0x413edf[_0xa9c5('0x2e')],_0x185eb8[_0xa9c5('0x30')]),_0x4f6e70);if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x3a')]){_0x198cdf[_0xa9c5('0x3b')]=_[_0xa9c5('0x3c')](_0x198cdf['where'],{'$or':_[_0xa9c5('0x28')](_0x4f6e70,function(_0x46e5d2){if(_0x46e5d2[_0xa9c5('0x3d')]!==_0xa9c5('0x3e')){var _0x1132e0={};_0x1132e0[_0x46e5d2[_0xa9c5('0x26')]]={'$like':'%'+_0x413edf['query'][_0xa9c5('0x3a')]+'%'};return _0x1132e0;}})});}_0x198cdf=_['merge']({},_0x198cdf,_0x413edf[_0xa9c5('0x3f')]);var _0x5c89e7={'where':_0x198cdf[_0xa9c5('0x3b')]};return db[_0xa9c5('0x40')][_0xa9c5('0x1d')](_0x5c89e7)['then'](function(_0x12e19c){_0x325c65[_0xa9c5('0x1d')]=_0x12e19c;if(_0x413edf[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x198cdf['include']=[{'all':!![]}];}return db[_0xa9c5('0x40')][_0xa9c5('0x42')](_0x198cdf);})[_0xa9c5('0x24')](function(_0x45668e){_0x325c65[_0xa9c5('0x43')]=_0x45668e;return _0x325c65;})['then'](respondWithFilteredResult(_0x32baf9,_0x198cdf))[_0xa9c5('0x44')](handleError(_0x32baf9,null));};exports['show']=function(_0x1de605,_0x397614){var _0x2998ad={'raw':![],'where':{'id':_0x1de605[_0xa9c5('0x45')]['id']}},_0xc8fca4={};_0xc8fca4[_0xa9c5('0x2c')]=_[_0xa9c5('0x2f')](db[_0xa9c5('0x40')][_0xa9c5('0x29')]);_0xc8fca4[_0xa9c5('0x2e')]=_['keys'](_0x1de605[_0xa9c5('0x2e')]);_0xc8fca4[_0xa9c5('0x30')]=_[_0xa9c5('0x32')](_0xc8fca4[_0xa9c5('0x2c')],_0xc8fca4[_0xa9c5('0x2e')]);_0x2998ad[_0xa9c5('0x31')]=_['intersection'](_0xc8fca4[_0xa9c5('0x2c')],qs[_0xa9c5('0x33')](_0x1de605['query']['fields']));_0x2998ad['attributes']=_0x2998ad['attributes']['length']?_0x2998ad[_0xa9c5('0x31')]:_0xc8fca4[_0xa9c5('0x2c')];if(_0x1de605[_0xa9c5('0x2e')][_0xa9c5('0x41')]){_0x2998ad[_0xa9c5('0x46')]=[{'all':!![]}];}_0x2998ad=_[_0xa9c5('0x3c')]({},_0x2998ad,_0x1de605[_0xa9c5('0x3f')]);return db[_0xa9c5('0x40')][_0xa9c5('0x47')](_0x2998ad)[_0xa9c5('0x24')](handleEntityNotFound(_0x397614,null))[_0xa9c5('0x24')](respondWithResult(_0x397614,null))[_0xa9c5('0x44')](handleError(_0x397614,null));};exports[_0xa9c5('0x48')]=function(_0x4bf8b4,_0x1108f0){return db['ScreenRecording'][_0xa9c5('0x48')](_0x4bf8b4[_0xa9c5('0x49')],{})['then'](respondWithResult(_0x1108f0,0xc9))['catch'](handleError(_0x1108f0,null));};exports[_0xa9c5('0x23')]=function(_0x32e64a,_0xeb0720){if(_0x32e64a['body']['id']){delete _0x32e64a['body']['id'];}delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4a')];delete _0x32e64a['body'][_0xa9c5('0x4b')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4c')];delete _0x32e64a[_0xa9c5('0x49')][_0xa9c5('0x4d')];return db[_0xa9c5('0x40')]['find']({'where':{'id':_0x32e64a['params']['id']}})['then'](handleEntityNotFound(_0xeb0720,null))[_0xa9c5('0x24')](saveUpdates(_0x32e64a[_0xa9c5('0x49')],null))[_0xa9c5('0x24')](respondWithResult(_0xeb0720,null))[_0xa9c5('0x44')](handleError(_0xeb0720,null));};exports[_0xa9c5('0x4e')]=function(_0x15d044,_0x56bc1d){return db[_0xa9c5('0x40')][_0xa9c5('0x4e')]()[_0xa9c5('0x24')](respondWithResult(_0x56bc1d,null))[_0xa9c5('0x44')](handleError(_0x56bc1d,null));};exports[_0xa9c5('0x4f')]=function(_0x242e8a,_0x547654,_0x4fcc44){var _0x10ff6b=require('../../components/encryptor');var _0x1b158f=![];var _0x5ea9b0={};if(_0x242e8a[_0xa9c5('0x2e')][_0xa9c5('0x3d')]&&_0x242e8a[_0xa9c5('0x2e')]['type']===_0xa9c5('0x50')){_0x5ea9b0[_0xa9c5('0x50')]=_0x242e8a[_0xa9c5('0x45')]['id'];}else{_0x5ea9b0['id']=_0x242e8a[_0xa9c5('0x45')]['id'];}return db['ScreenRecording']['find']({'where':_0x5ea9b0,'attributes':['id',_0xa9c5('0x4d')],'raw':!![]})[_0xa9c5('0x24')](handleEntityNotFound(_0x547654,null))[_0xa9c5('0x24')](function(_0x5b4323){if(_0x5b4323){var _0x31e12e=path[_0xa9c5('0x51')](config[_0xa9c5('0x52')],_0xa9c5('0x53'),_0x5b4323[_0xa9c5('0x4d')]);var _0x29b198=util[_0xa9c5('0x2d')](_0xa9c5('0x54'),_0x31e12e);if(fs['existsSync'](_0x29b198)){_0x1b158f=!![];return _0x10ff6b[_0xa9c5('0x55')](_0x29b198,_0x31e12e,config['secrets'][_0xa9c5('0x56')])[_0xa9c5('0x24')](function(){return _0x5b4323;});}return _0x5b4323;}})[_0xa9c5('0x24')](function(_0x4dfe3a){if(_0x4dfe3a){var _0x4d475a=path[_0xa9c5('0x51')](config['root'],_0xa9c5('0x53'),_0x4dfe3a[_0xa9c5('0x4d')]);if(!fs[_0xa9c5('0x57')](_0x4d475a)){throw new db[(_0xa9c5('0x58'))]['ValidationError'](_0xa9c5('0x59'));}if(_0x4dfe3a[_0xa9c5('0x5a')]){return _0x547654[_0xa9c5('0x4f')](_0x4d475a,_0x4dfe3a[_0xa9c5('0x5a')]+path['extname'](_0x4d475a),function(){if(_0x1b158f){fs['unlink'](_0x4d475a);}});}else{return _0x547654[_0xa9c5('0x4f')](_0x4d475a,function(_0x3deb64){if(_0x1b158f){fs[_0xa9c5('0x5b')](_0x4d475a);}});}}})[_0xa9c5('0x44')](function(_0x279a26){if(_0x279a26[_0xa9c5('0x5c')]==='ScreenRecording\x20not\x20found'){_0x547654[_0xa9c5('0x19')](0x194)[_0xa9c5('0x27')](_0xa9c5('0x5d'));}else{return handleError(_0x547654,null);}});};exports[_0xa9c5('0x5e')]=function(_0x2b8575,_0x372ab9){return db[_0xa9c5('0x40')][_0xa9c5('0x47')]({'where':{'id':_0x2b8575[_0xa9c5('0x45')]['id']}})[_0xa9c5('0x24')](function(_0x50d438){if(_['isNil'](_0x50d438)){throw new ReferenceError(_0xa9c5('0x5f'));}return _0x50d438;})[_0xa9c5('0x24')](function(_0x3322cc){var _0x47afaa=path['join'](config[_0xa9c5('0x52')],'server/files/screen_recordings',_0x3322cc[_0xa9c5('0x4d')]);logger[_0xa9c5('0x60')](_0xa9c5('0x61'),_0x47afaa);if(!_[_0xa9c5('0x62')](_0x3322cc[_0xa9c5('0x4d')])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}_0x47afaa=_0x47afaa+_0xa9c5('0x66');if(!_[_0xa9c5('0x62')](_0x3322cc['value'])&&fs[_0xa9c5('0x57')](_0x47afaa)){logger[_0xa9c5('0x60')](_0xa9c5('0x63')+_0x47afaa+_0xa9c5('0x64'));fs[_0xa9c5('0x65')](_0x47afaa);}return _0x3322cc;})[_0xa9c5('0x24')](function(_0x28ba54){if(!_0x28ba54)throw new InternalError();return _0x28ba54['destroy']();})['then'](function(){_0x372ab9[_0xa9c5('0x19')](0xcc)['end']();})[_0xa9c5('0x44')](handleError(_0x372ab9,null));};
\ No newline at end of file
index 65386ff..05cb697 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb94f=['interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','define','ScreenRecording'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0xb94f,0x1a1));var _0xfb94=function(_0x398294,_0x5ceb9d){_0x398294=_0x398294-0x0;var _0x2a872d=_0xb94f[_0x398294];return _0x2a872d;};'use strict';var _=require(_0xfb94('0x0'));var util=require(_0xfb94('0x1'));var logger=require(_0xfb94('0x2'))(_0xfb94('0x3'));var moment=require(_0xfb94('0x4'));var BPromise=require(_0xfb94('0x5'));var rp=require(_0xfb94('0x6'));var fs=require('fs');var path=require(_0xfb94('0x7'));var rimraf=require('rimraf');var config=require(_0xfb94('0x8'));var attributes=require(_0xfb94('0x9'));module['exports']=function(_0x103658,_0xff4158){return _0x103658[_0xfb94('0xa')](_0xfb94('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xfb94('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x4f50=['screen_recordings','interactionid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./screenRecording.attributes','exports','define','ScreenRecording'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x4f50,0x1a6));var _0x04f5=function(_0x28551c,_0x2623f2){_0x28551c=_0x28551c-0x0;var _0x240140=_0x4f50[_0x28551c];return _0x240140;};'use strict';var _=require(_0x04f5('0x0'));var util=require('util');var logger=require(_0x04f5('0x1'))('api');var moment=require(_0x04f5('0x2'));var BPromise=require(_0x04f5('0x3'));var rp=require(_0x04f5('0x4'));var fs=require('fs');var path=require(_0x04f5('0x5'));var rimraf=require(_0x04f5('0x6'));var config=require(_0x04f5('0x7'));var attributes=require(_0x04f5('0x8'));module[_0x04f5('0x9')]=function(_0x23f410,_0x9f8095){return _0x23f410[_0x04f5('0xa')](_0x04f5('0xb'),attributes,{'tableName':_0x04f5('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x04f5('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index a8e56eb..4e70fa1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea6d=['info','request\x20sent','stringify','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0xea6d,0xd8));var _0xdea6=function(_0x1a1087,_0x4f43f3){_0x1a1087=_0x1a1087-0x0;var _0x5d7081=_0xea6d[_0x1a1087];return _0x5d7081;};'use strict';var _=require(_0xdea6('0x0'));var util=require(_0xdea6('0x1'));var moment=require(_0xdea6('0x2'));var BPromise=require(_0xdea6('0x3'));var rs=require(_0xdea6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdea6('0x5'))['db'];var utils=require(_0xdea6('0x6'));var logger=require(_0xdea6('0x7'))(_0xdea6('0x8'));var config=require(_0xdea6('0x9'));var jayson=require(_0xdea6('0xa'));var client=jayson['client'][_0xdea6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a5c7d,_0x21b0ba,_0x35e881){return new BPromise(function(_0x350bb9,_0x41ff31){return client[_0xdea6('0xc')](_0x3a5c7d,_0x35e881)[_0xdea6('0xd')](function(_0xced867){logger[_0xdea6('0xe')]('ScreenRecording,\x20%s,\x20%s',_0x21b0ba,_0xdea6('0xf'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x21b0ba,'request\x20sent',JSON[_0xdea6('0x10')](_0xced867));if(_0xced867[_0xdea6('0x11')]){if(_0xced867[_0xdea6('0x11')][_0xdea6('0x12')]===0x1f4){logger[_0xdea6('0x11')](_0xdea6('0x13'),_0x21b0ba,_0xced867[_0xdea6('0x11')]['message']);return _0x41ff31(_0xced867[_0xdea6('0x11')][_0xdea6('0x14')]);}logger['error'](_0xdea6('0x13'),_0x21b0ba,_0xced867['error'][_0xdea6('0x14')]);return _0x350bb9(_0xced867[_0xdea6('0x11')][_0xdea6('0x14')]);}else{logger[_0xdea6('0xe')](_0xdea6('0x13'),_0x21b0ba,'request\x20sent');_0x350bb9(_0xced867[_0xdea6('0x15')]['message']);}})[_0xdea6('0x16')](function(_0x523d88){logger[_0xdea6('0x11')](_0xdea6('0x13'),_0x21b0ba,_0x523d88);_0x41ff31(_0x523d88);});});}
\ No newline at end of file
+var _0xc24c=['../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','error','code','ScreenRecording,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x370cac,_0x3000ff){var _0x46d1f4=function(_0x17262c){while(--_0x17262c){_0x370cac['push'](_0x370cac['shift']());}};_0x46d1f4(++_0x3000ff);}(_0xc24c,0x14a));var _0xcc24=function(_0x3900e2,_0x4226aa){_0x3900e2=_0x3900e2-0x0;var _0x6b9d5e=_0xc24c[_0x3900e2];return _0x6b9d5e;};'use strict';var _=require('lodash');var util=require(_0xcc24('0x0'));var moment=require(_0xcc24('0x1'));var BPromise=require(_0xcc24('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc24('0x3'));var db=require(_0xcc24('0x4'))['db'];var utils=require(_0xcc24('0x5'));var logger=require(_0xcc24('0x6'))(_0xcc24('0x7'));var config=require('../../config/environment');var jayson=require(_0xcc24('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1533e6,_0x111bb4,_0x2af871){return new BPromise(function(_0x14ed1b,_0xabb7e8){return client[_0xcc24('0x9')](_0x1533e6,_0x2af871)[_0xcc24('0xa')](function(_0x2748c1){logger[_0xcc24('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x111bb4,_0xcc24('0xc'));logger[_0xcc24('0xd')](_0xcc24('0xe'),_0x111bb4,_0xcc24('0xc'),JSON['stringify'](_0x2748c1));if(_0x2748c1[_0xcc24('0xf')]){if(_0x2748c1[_0xcc24('0xf')][_0xcc24('0x10')]===0x1f4){logger[_0xcc24('0xf')](_0xcc24('0x11'),_0x111bb4,_0x2748c1['error'][_0xcc24('0x12')]);return _0xabb7e8(_0x2748c1[_0xcc24('0xf')][_0xcc24('0x12')]);}logger['error'](_0xcc24('0x11'),_0x111bb4,_0x2748c1[_0xcc24('0xf')]['message']);return _0x14ed1b(_0x2748c1[_0xcc24('0xf')][_0xcc24('0x12')]);}else{logger['info'](_0xcc24('0x11'),_0x111bb4,_0xcc24('0xc'));_0x14ed1b(_0x2748c1[_0xcc24('0x13')][_0xcc24('0x12')]);}})[_0xcc24('0x14')](function(_0x4fef91){logger[_0xcc24('0xf')](_0xcc24('0x11'),_0x111bb4,_0x4fef91);_0xabb7e8(_0x4fef91);});});}
\ No newline at end of file
index 01a5547..01aaf20 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x50d6=['format','%s%s','originalname','single','file','addLogo','join','root','server/files/images/logos/','logologin','post','addLogoLogin','preferred','extname','addPreferred','favicon','addFavicon','put','/:id','update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','index','get','/now','getDate','show','/:id/logo','getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage'];(function(_0x201a83,_0x9a970a){var _0x433797=function(_0x145413){while(--_0x145413){_0x201a83['push'](_0x201a83['shift']());}};_0x433797(++_0x9a970a);}(_0x50d6,0xf6));var _0x650d=function(_0x5c8811,_0x4f77d5){_0x5c8811=_0x5c8811-0x0;var _0x2c0941=_0x50d6[_0x5c8811];return _0x2c0941;};'use strict';var multer=require(_0x650d('0x0'));var util=require(_0x650d('0x1'));var path=require(_0x650d('0x2'));var timeout=require(_0x650d('0x3'));var express=require(_0x650d('0x4'));var router=express['Router']();var fs_extra=require(_0x650d('0x5'));var auth=require(_0x650d('0x6'));var interaction=require(_0x650d('0x7'));var config=require('../../config/environment');var controller=require(_0x650d('0x8'));router['get']('/',auth[_0x650d('0x9')](),controller[_0x650d('0xa')]);router[_0x650d('0xb')](_0x650d('0xc'),controller[_0x650d('0xd')]);router['get']('/:id',controller[_0x650d('0xe')]);router[_0x650d('0xb')](_0x650d('0xf'),controller[_0x650d('0x10')]);router[_0x650d('0xb')](_0x650d('0x11'),controller['getLogoLogin']);router['get']('/:id/gdpr',controller[_0x650d('0x12')]);router[_0x650d('0xb')](_0x650d('0x13'),controller[_0x650d('0x14')]);router[_0x650d('0xb')](_0x650d('0x15'),controller[_0x650d('0x16')]);var upload=multer({'storage':multer[_0x650d('0x17')]({'destination':function(_0x8df631,_0x3a0492,_0x3bf888){_0x3bf888(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0xc60645,_0x3dffd5,_0x42d30e){_0x42d30e(null,util[_0x650d('0x18')](_0x650d('0x19'),'logo',path['extname'](_0x3dffd5[_0x650d('0x1a')])));}})});router['post']('/:id/logo',upload[_0x650d('0x1b')](_0x650d('0x1c')),controller[_0x650d('0x1d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x50175f,_0x2792e6,_0x3e14d3){_0x3e14d3(null,path[_0x650d('0x1e')](config[_0x650d('0x1f')],_0x650d('0x20')));},'filename':function(_0x3ad5ab,_0x181cdc,_0x433753){_0x433753(null,util[_0x650d('0x18')]('%s%s',_0x650d('0x21'),path['extname'](_0x181cdc[_0x650d('0x1a')])));}})});router[_0x650d('0x22')](_0x650d('0x11'),upload['single'](_0x650d('0x1c')),controller[_0x650d('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3d99df,_0x413c4e,_0x1563f1){_0x1563f1(null,path[_0x650d('0x1e')](config[_0x650d('0x1f')],_0x650d('0x20')));},'filename':function(_0x46b8da,_0x3f8bd1,_0x509bd6){_0x509bd6(null,util[_0x650d('0x18')](_0x650d('0x19'),_0x650d('0x24'),path[_0x650d('0x25')](_0x3f8bd1['originalname'])));}})});router[_0x650d('0x22')](_0x650d('0x13'),upload['single'](_0x650d('0x1c')),controller[_0x650d('0x26')]);var upload=multer({'storage':multer[_0x650d('0x17')]({'destination':function(_0x5bed6e,_0x3d105f,_0x296e12){_0x296e12(null,path[_0x650d('0x1e')](config['root'],_0x650d('0x20')));},'filename':function(_0x57681a,_0x253e0d,_0x597f60){_0x597f60(null,util[_0x650d('0x18')](_0x650d('0x19'),_0x650d('0x27'),path[_0x650d('0x25')](_0x253e0d['originalname'])));}})});router['post'](_0x650d('0x15'),upload[_0x650d('0x1b')](_0x650d('0x1c')),controller[_0x650d('0x28')]);router[_0x650d('0x29')](_0x650d('0x2a'),auth[_0x650d('0x9')](),controller[_0x650d('0x2b')]);module[_0x650d('0x2c')]=router;
\ No newline at end of file
+var _0x7503=['../../config/environment','./setting.controller','get','index','/now','show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','format','%s%s','extname','originalname','single','addLogo','diskStorage','server/files/images/logos/','post','file','addLogoLogin','preferred','addPreferred','favicon','addFavicon','/:id','isAuthenticated','update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2aeb13,_0x14bc69){var _0x124a94=function(_0x4f6855){while(--_0x4f6855){_0x2aeb13['push'](_0x2aeb13['shift']());}};_0x124a94(++_0x14bc69);}(_0x7503,0x183));var _0x3750=function(_0x1b8050,_0x4d12c6){_0x1b8050=_0x1b8050-0x0;var _0x1ec2b1=_0x7503[_0x1b8050];return _0x1ec2b1;};'use strict';var multer=require(_0x3750('0x0'));var util=require(_0x3750('0x1'));var path=require(_0x3750('0x2'));var timeout=require(_0x3750('0x3'));var express=require(_0x3750('0x4'));var router=express[_0x3750('0x5')]();var fs_extra=require(_0x3750('0x6'));var auth=require(_0x3750('0x7'));var interaction=require(_0x3750('0x8'));var config=require(_0x3750('0x9'));var controller=require(_0x3750('0xa'));router[_0x3750('0xb')]('/',auth['isAuthenticated'](),controller[_0x3750('0xc')]);router[_0x3750('0xb')](_0x3750('0xd'),controller['getDate']);router[_0x3750('0xb')]('/:id',controller[_0x3750('0xe')]);router[_0x3750('0xb')](_0x3750('0xf'),controller[_0x3750('0x10')]);router['get'](_0x3750('0x11'),controller[_0x3750('0x12')]);router[_0x3750('0xb')](_0x3750('0x13'),controller['gdpr']);router[_0x3750('0xb')](_0x3750('0x14'),controller[_0x3750('0x15')]);router[_0x3750('0xb')](_0x3750('0x16'),controller[_0x3750('0x17')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4b29e3,_0x107167,_0xa3afe7){_0xa3afe7(null,path[_0x3750('0x18')](config[_0x3750('0x19')],'server/files/images/logos/'));},'filename':function(_0x47c863,_0x342473,_0x1e6e38){_0x1e6e38(null,util[_0x3750('0x1a')](_0x3750('0x1b'),'logo',path[_0x3750('0x1c')](_0x342473[_0x3750('0x1d')])));}})});router['post'](_0x3750('0xf'),upload[_0x3750('0x1e')]('file'),controller[_0x3750('0x1f')]);var upload=multer({'storage':multer[_0x3750('0x20')]({'destination':function(_0x24d693,_0x2a71e6,_0x1b09dd){_0x1b09dd(null,path[_0x3750('0x18')](config[_0x3750('0x19')],_0x3750('0x21')));},'filename':function(_0x1cee91,_0x4761c2,_0x5c19ba){_0x5c19ba(null,util['format']('%s%s','logologin',path[_0x3750('0x1c')](_0x4761c2[_0x3750('0x1d')])));}})});router[_0x3750('0x22')](_0x3750('0x11'),upload[_0x3750('0x1e')](_0x3750('0x23')),controller[_0x3750('0x24')]);var upload=multer({'storage':multer[_0x3750('0x20')]({'destination':function(_0x3f3651,_0xc08e21,_0x411011){_0x411011(null,path[_0x3750('0x18')](config[_0x3750('0x19')],_0x3750('0x21')));},'filename':function(_0x42d392,_0x570944,_0x2e3ae5){_0x2e3ae5(null,util[_0x3750('0x1a')](_0x3750('0x1b'),_0x3750('0x25'),path[_0x3750('0x1c')](_0x570944['originalname'])));}})});router['post']('/:id/preferred',upload[_0x3750('0x1e')](_0x3750('0x23')),controller[_0x3750('0x26')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2efd72,_0x55f836,_0x35a30c){_0x35a30c(null,path[_0x3750('0x18')](config[_0x3750('0x19')],'server/files/images/logos/'));},'filename':function(_0x5bf743,_0xd91152,_0x3c225c){_0x3c225c(null,util[_0x3750('0x1a')](_0x3750('0x1b'),_0x3750('0x27'),path[_0x3750('0x1c')](_0xd91152['originalname'])));}})});router[_0x3750('0x22')]('/:id/favicon',upload[_0x3750('0x1e')](_0x3750('0x23')),controller[_0x3750('0x28')]);router['put'](_0x3750('0x29'),auth[_0x3750('0x2a')](),controller[_0x3750('0x2b')]);module['exports']=router;
\ No newline at end of file
index 7c998fe..66bc069 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x37e030,_0xdf84ab){var _0x1a02f1=function(_0x7ce508){while(--_0x7ce508){_0x37e030['push'](_0x37e030['shift']());}};_0x1a02f1(++_0xdf84ab);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}};
\ No newline at end of file
+var _0xea63=['sequelize','exports','INTEGER','min_internal','STRING','BOOLEAN','alternate','UNSIGNED'];(function(_0x502953,_0x28de83){var _0x2fa32d=function(_0x3b3a52){while(--_0x3b3a52){_0x502953['push'](_0x502953['shift']());}};_0x2fa32d(++_0x28de83);}(_0xea63,0x120));var _0x3ea6=function(_0x21988e,_0x353aa1){_0x21988e=_0x21988e-0x0;var _0x26784e=_0xea63[_0x21988e];return _0x26784e;};'use strict';var Sequelize=require(_0x3ea6('0x0'));module[_0x3ea6('0x1')]={'min_internal':{'type':Sequelize[_0x3ea6('0x2')](0xb),'unique':_0x3ea6('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x3ea6('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x3ea6('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x3ea6('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x3ea6('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x3ea6('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x3ea6('0x4')]},'turnaddr':{'type':Sequelize[_0x3ea6('0x4')]},'turnusername':{'type':Sequelize[_0x3ea6('0x4')]},'turnpassword':{'type':Sequelize[_0x3ea6('0x4')]},'pageTitle':{'type':Sequelize[_0x3ea6('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x3ea6('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x3ea6('0x4')],'defaultValue':_0x3ea6('0x6')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x3ea6('0x4')]},'defaultPreferred':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x3ea6('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x3ea6('0x4')]},'defaultFavicon':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x3ea6('0x4')]},'sentiment':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x3ea6('0x2')]},'sentimentRegion':{'type':Sequelize[_0x3ea6('0x4')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x3ea6('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0x3ea6('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x3ea6('0x2')](0x2)[_0x3ea6('0x7')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)[_0x3ea6('0x7')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x3ea6('0x7')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x3ea6('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x3ea6('0x5')],'defaultValue':![]}};
\ No newline at end of file
index a2cb541..9ab9ff7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x177a=['client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','end','status','offset','limit','set','Content-Range','json','apply','save','update','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting','count','includeAll','include','findAll','rows','show','params','find','body','file','logo','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultPreferred','defaultFavicon','existsSync','root','toLower','join','default_logo.svg','default','ValidationError','upperFirst','\x20not\x20found','download','defaultLogo','defaultLoginLogo','Sequelize','gdpr','addPreferred','getPreferred','default_preferred.png','custom','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise'];(function(_0x4e1078,_0x24a9dd){var _0xb795fe=function(_0x36abb4){while(--_0x36abb4){_0x4e1078['push'](_0x4e1078['shift']());}};_0xb795fe(++_0x24a9dd);}(_0x177a,0xdd));var _0xa177=function(_0x4cd0e3,_0x15d7c5){_0x4cd0e3=_0x4cd0e3-0x0;var _0x340f20=_0x177a[_0x4cd0e3];return _0x340f20;};'use strict';var emlformat=require(_0xa177('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa177('0x1'));var rp=require(_0xa177('0x2'));var moment=require(_0xa177('0x3'));var BPromise=require(_0xa177('0x4'));var Mustache=require(_0xa177('0x5'));var util=require(_0xa177('0x6'));var path=require('path');var sox=require(_0xa177('0x7'));var csv=require(_0xa177('0x8'));var ejs=require(_0xa177('0x9'));var fs=require('fs');var fs_extra=require(_0xa177('0xa'));var _=require(_0xa177('0xb'));var squel=require(_0xa177('0xc'));var crypto=require(_0xa177('0xd'));var jsforce=require(_0xa177('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa177('0x8'));var querystring=require('querystring');var Papa=require(_0xa177('0xf'));var Redis=require(_0xa177('0x10'));var authService=require(_0xa177('0x11'));var qs=require(_0xa177('0x12'));var as=require(_0xa177('0x13'));var hardwareService=require(_0xa177('0x14'));var logger=require(_0xa177('0x15'))('api');var utils=require(_0xa177('0x16'));var config=require(_0xa177('0x17'));var licenseUtil=require(_0xa177('0x18'));var db=require(_0xa177('0x19'))['db'];var jayson=require(_0xa177('0x1a'));var client=jayson[_0xa177('0x1b')][_0xa177('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x548bbf,_0x4e4d95,_0xca78d4,_0x198a92){return new BPromise(function(_0x39d274,_0x179f42){var _0xef81bb=_0x198a92||client;return _0xef81bb[_0xa177('0x1d')](_0x548bbf,_0xca78d4)[_0xa177('0x1e')](function(_0xbc9fa4){logger[_0xa177('0x1f')](_0xa177('0x20'),_0x4e4d95,_0xa177('0x21'));logger[_0xa177('0x22')]('Setting,\x20%s,\x20%s,\x20%s',_0x4e4d95,_0xa177('0x21'),JSON[_0xa177('0x23')](_0xbc9fa4));if(_0xbc9fa4['error']){if(_0xbc9fa4[_0xa177('0x24')][_0xa177('0x25')]===0x1f4){logger[_0xa177('0x24')](_0xa177('0x20'),_0x4e4d95,_0xbc9fa4['error']['message']);return _0x179f42(_0xbc9fa4['error'][_0xa177('0x26')]);}logger[_0xa177('0x24')](_0xa177('0x20'),_0x4e4d95,_0xbc9fa4[_0xa177('0x24')]['message']);return _0x39d274(_0xbc9fa4[_0xa177('0x24')]['message']);}else{logger[_0xa177('0x1f')]('Setting,\x20%s,\x20%s',_0x4e4d95,_0xa177('0x21'));_0x39d274(_0xbc9fa4[_0xa177('0x27')][_0xa177('0x26')]);}})[_0xa177('0x28')](function(_0x58d4bd){logger[_0xa177('0x24')](_0xa177('0x20'),_0x4e4d95,_0x58d4bd);_0x179f42(_0x58d4bd);});});}function respondWithStatusCode(_0x1ad5da,_0x4bc686){_0x4bc686=_0x4bc686||0xcc;return function(_0x5d5118){if(_0x5d5118){return _0x1ad5da['sendStatus'](_0x4bc686);}return _0x1ad5da['status'](_0x4bc686)[_0xa177('0x29')]();};}function respondWithResult(_0x382a61,_0x1cf775){_0x1cf775=_0x1cf775||0xc8;return function(_0x1b7cec){if(_0x1b7cec){return _0x382a61[_0xa177('0x2a')](_0x1cf775)['json'](_0x1b7cec);}};}function respondWithFilteredResult(_0x31608c,_0x102095){return function(_0x479587){if(_0x479587){var _0x4c61b1=typeof _0x102095[_0xa177('0x2b')]==='undefined'&&typeof _0x102095['limit']==='undefined';var _0x45c513=_0x479587['count'];var _0x216cab=_0x4c61b1?0x0:_0x102095[_0xa177('0x2b')];var _0x320cce=_0x4c61b1?_0x479587['count']:_0x102095[_0xa177('0x2b')]+_0x102095[_0xa177('0x2c')];var _0x595920;if(_0x320cce>=_0x45c513){_0x320cce=_0x45c513;_0x595920=0xc8;}else{_0x595920=0xce;}_0x31608c[_0xa177('0x2a')](_0x595920);return _0x31608c[_0xa177('0x2d')](_0xa177('0x2e'),_0x216cab+'-'+_0x320cce+'/'+_0x45c513)[_0xa177('0x2f')](_0x479587);}return null;};}function patchUpdates(_0x253efa){return function(_0xe7a886){try{jsonpatch[_0xa177('0x30')](_0xe7a886,_0x253efa,!![]);}catch(_0x423ed7){return BPromise['reject'](_0x423ed7);}return _0xe7a886[_0xa177('0x31')]();};}function saveUpdates(_0x40ca8f,_0x4c4ce4){return function(_0x5b8f10){if(_0x5b8f10){return _0x5b8f10[_0xa177('0x32')](_0x40ca8f)['then'](function(_0x2b5cdc){return _0x2b5cdc;});}return null;};}function removeEntity(_0x1b7d71,_0x558c8c){return function(_0x26dfd5){if(_0x26dfd5){return _0x26dfd5[_0xa177('0x33')]()[_0xa177('0x1e')](function(){_0x1b7d71['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a4f52,_0x4cf7fd){return function(_0x54bce7){if(!_0x54bce7){_0x5a4f52[_0xa177('0x34')](0x194);}return _0x54bce7;};}function handleError(_0xd57ceb,_0x1efed3){_0x1efed3=_0x1efed3||0x1f4;return function(_0x2b9bd0){logger[_0xa177('0x24')](_0x2b9bd0[_0xa177('0x35')]);if(_0x2b9bd0['name']){delete _0x2b9bd0[_0xa177('0x36')];}_0xd57ceb[_0xa177('0x2a')](_0x1efed3)[_0xa177('0x37')](_0x2b9bd0);};}exports[_0xa177('0x38')]=function(_0x30115d,_0x33aecc){var _0x3d2350={},_0x3d141c={},_0x5ca2a2={'count':0x0,'rows':[]};var _0x2b92c8=_[_0xa177('0x39')](db['Setting'][_0xa177('0x3a')],function(_0x47e1ba){return{'name':_0x47e1ba[_0xa177('0x3b')],'type':_0x47e1ba[_0xa177('0x3c')]['key']};});_0x3d141c[_0xa177('0x3d')]=_[_0xa177('0x39')](_0x2b92c8,_0xa177('0x36'));_0x3d141c[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x30115d[_0xa177('0x3e')]);_0x3d141c[_0xa177('0x40')]=_[_0xa177('0x41')](_0x3d141c[_0xa177('0x3d')],_0x3d141c[_0xa177('0x3e')]);_0x3d2350[_0xa177('0x42')]=_[_0xa177('0x41')](_0x3d141c['model'],qs['fields'](_0x30115d[_0xa177('0x3e')][_0xa177('0x43')]));_0x3d2350[_0xa177('0x42')]=_0x3d2350[_0xa177('0x42')][_0xa177('0x44')]?_0x3d2350[_0xa177('0x42')]:_0x3d141c[_0xa177('0x3d')];if(!_0x30115d[_0xa177('0x3e')]['hasOwnProperty']('nolimit')){_0x3d2350[_0xa177('0x2c')]=qs[_0xa177('0x2c')](_0x30115d[_0xa177('0x3e')][_0xa177('0x2c')]);_0x3d2350[_0xa177('0x2b')]=qs[_0xa177('0x2b')](_0x30115d[_0xa177('0x3e')]['offset']);}_0x3d2350[_0xa177('0x45')]=qs['sort'](_0x30115d[_0xa177('0x3e')][_0xa177('0x46')]);_0x3d2350[_0xa177('0x47')]=qs[_0xa177('0x40')](_[_0xa177('0x48')](_0x30115d[_0xa177('0x3e')],_0x3d141c['filters']),_0x2b92c8);if(_0x30115d[_0xa177('0x3e')][_0xa177('0x49')]){_0x3d2350[_0xa177('0x47')]=_[_0xa177('0x4a')](_0x3d2350[_0xa177('0x47')],{'$or':_[_0xa177('0x39')](_0x2b92c8,function(_0x5e7481){if(_0x5e7481[_0xa177('0x3c')]!==_0xa177('0x4b')){var _0x2ef46d={};_0x2ef46d[_0x5e7481[_0xa177('0x36')]]={'$like':'%'+_0x30115d[_0xa177('0x3e')][_0xa177('0x49')]+'%'};return _0x2ef46d;}})});}_0x3d2350=_['merge']({},_0x3d2350,_0x30115d[_0xa177('0x4c')]);var _0x3fef34={'where':_0x3d2350[_0xa177('0x47')]};return db[_0xa177('0x4d')][_0xa177('0x4e')](_0x3fef34)[_0xa177('0x1e')](function(_0x3f06b2){_0x5ca2a2[_0xa177('0x4e')]=_0x3f06b2;if(_0x30115d[_0xa177('0x3e')][_0xa177('0x4f')]){_0x3d2350[_0xa177('0x50')]=[{'all':!![]}];}return db[_0xa177('0x4d')][_0xa177('0x51')](_0x3d2350);})[_0xa177('0x1e')](function(_0xd05bcb){_0x5ca2a2[_0xa177('0x52')]=_0xd05bcb;return _0x5ca2a2;})['then'](respondWithFilteredResult(_0x33aecc,_0x3d2350))[_0xa177('0x28')](handleError(_0x33aecc,null));};exports[_0xa177('0x53')]=function(_0x1714a4,_0x423817){var _0x34d9c4={'raw':![],'where':{'id':_0x1714a4[_0xa177('0x54')]['id']}},_0x54d596={};_0x54d596[_0xa177('0x3d')]=_['keys'](db[_0xa177('0x4d')][_0xa177('0x3a')]);_0x54d596[_0xa177('0x3e')]=_[_0xa177('0x3f')](_0x1714a4[_0xa177('0x3e')]);_0x54d596[_0xa177('0x40')]=_['intersection'](_0x54d596[_0xa177('0x3d')],_0x54d596[_0xa177('0x3e')]);_0x34d9c4[_0xa177('0x42')]=_['intersection'](_0x54d596[_0xa177('0x3d')],qs[_0xa177('0x43')](_0x1714a4[_0xa177('0x3e')][_0xa177('0x43')]));_0x34d9c4[_0xa177('0x42')]=_0x34d9c4[_0xa177('0x42')][_0xa177('0x44')]?_0x34d9c4['attributes']:_0x54d596[_0xa177('0x3d')];if(_0x1714a4[_0xa177('0x3e')]['includeAll']){_0x34d9c4[_0xa177('0x50')]=[{'all':!![]}];}_0x34d9c4=_['merge']({},_0x34d9c4,_0x1714a4[_0xa177('0x4c')]);return db['Setting'][_0xa177('0x55')](_0x34d9c4)[_0xa177('0x1e')](handleEntityNotFound(_0x423817,null))[_0xa177('0x1e')](respondWithResult(_0x423817,null))[_0xa177('0x28')](handleError(_0x423817,null));};exports[_0xa177('0x32')]=function(_0x3489ed,_0x1bc494){if(_0x3489ed[_0xa177('0x56')]['id']){delete _0x3489ed[_0xa177('0x56')]['id'];}return db[_0xa177('0x4d')][_0xa177('0x55')]({'where':{'id':_0x3489ed[_0xa177('0x54')]['id']}})[_0xa177('0x1e')](handleEntityNotFound(_0x1bc494,null))['then'](saveUpdates(_0x3489ed[_0xa177('0x56')],null))[_0xa177('0x1e')](respondWithResult(_0x1bc494,null))[_0xa177('0x28')](handleError(_0x1bc494,null));};exports['addLogo']=function(_0x5e8472,_0x5a7534,_0x26c65e){if(_0x5e8472[_0xa177('0x57')]&&_0x5e8472[_0xa177('0x57')]['filename']){_0x5e8472[_0xa177('0x56')][_0xa177('0x58')]=_0x5e8472[_0xa177('0x57')][_0xa177('0x59')];}return db[_0xa177('0x4d')][_0xa177('0x55')]({'where':{'id':_0x5e8472[_0xa177('0x54')]['id']}})[_0xa177('0x1e')](handleEntityNotFound(_0x5a7534,null))[_0xa177('0x1e')](saveUpdates(_0x5e8472[_0xa177('0x56')],null))[_0xa177('0x1e')](respondWithResult(_0x5a7534,null))[_0xa177('0x28')](handleError(_0x5a7534,null));};exports[_0xa177('0x5a')]=function(_0x5f0c57,_0x52be95,_0x126261){if(_0x5f0c57[_0xa177('0x57')]&&_0x5f0c57[_0xa177('0x57')][_0xa177('0x59')]){_0x5f0c57[_0xa177('0x56')][_0xa177('0x5b')]=_0x5f0c57[_0xa177('0x57')]['filename'];}return db[_0xa177('0x4d')][_0xa177('0x55')]({'where':{'id':_0x5f0c57['params']['id']}})[_0xa177('0x1e')](handleEntityNotFound(_0x52be95,null))[_0xa177('0x1e')](saveUpdates(_0x5f0c57[_0xa177('0x56')],null))['then'](respondWithResult(_0x52be95,null))['catch'](handleError(_0x52be95,null));};var utilLicense=require(_0xa177('0x18'));exports[_0xa177('0x5c')]=function(_0x36230d,_0x290bb6,_0x8cc5d0){var _0x990f90=_0xa177('0x5d');var _0x489934={'custom':![]};return utilLicense[_0xa177('0x5e')]()[_0xa177('0x1e')](function(_0x206cc5){if(_0x206cc5){_0x489934=_0x206cc5;}return db[_0xa177('0x4d')][_0xa177('0x55')]({'where':{'id':_0x36230d[_0xa177('0x54')]['id']},'attributes':['logo','loginLogo',_0xa177('0x5f'),_0xa177('0x60'),'defaultLogo','defaultLoginLogo',_0xa177('0x61'),_0xa177('0x62')],'raw':!![]});})[_0xa177('0x1e')](handleEntityNotFound(_0x290bb6,null))[_0xa177('0x1e')](function(_0x244e29){if(_0x244e29){var _0xfceddd=_0x244e29[_0xa177('0x58')]&&fs[_0xa177('0x63')](path['join'](config[_0xa177('0x64')],_0x990f90,_[_0xa177('0x65')](_0x244e29['logo'])))?path[_0xa177('0x66')](config['root'],_0x990f90,_['toLower'](_0x244e29[_0xa177('0x58')])):path['join'](config['root'],_0x990f90,_['toLower'](_0xa177('0x67')));var _0x45b0cc=_0xa177('0x68')+_['upperFirst']('logo');if(_0x244e29[_0x45b0cc]||!_0x489934['custom']){_0xfceddd=path[_0xa177('0x66')](config[_0xa177('0x64')],_0x990f90,_[_0xa177('0x65')](_0xa177('0x67')));}if(!fs['existsSync'](_0xfceddd)){throw new db['Sequelize'][(_0xa177('0x69'))](_[_0xa177('0x6a')]('logo')+_0xa177('0x6b'));}return _0x290bb6[_0xa177('0x6c')](_0xfceddd);}})[_0xa177('0x28')](handleError(_0x290bb6,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x4bd3eb,_0x1b8d26,_0x128623){var _0x128b5f=_0xa177('0x5d');var _0x23311d={'custom':![]};return utilLicense[_0xa177('0x5e')]()[_0xa177('0x1e')](function(_0x371e87){if(_0x371e87){_0x23311d=_0x371e87;}return db[_0xa177('0x4d')][_0xa177('0x55')]({'where':{'id':_0x4bd3eb[_0xa177('0x54')]['id']},'attributes':[_0xa177('0x58'),_0xa177('0x5b'),_0xa177('0x5f'),_0xa177('0x60'),_0xa177('0x6d'),_0xa177('0x6e'),_0xa177('0x61'),'defaultFavicon'],'raw':!![]});})[_0xa177('0x1e')](handleEntityNotFound(_0x1b8d26,null))[_0xa177('0x1e')](function(_0x5b7949){if(_0x5b7949){var _0x3bec2d=_0x5b7949[_0xa177('0x5b')]&&fs['existsSync'](path[_0xa177('0x66')](config[_0xa177('0x64')],_0x128b5f,_[_0xa177('0x65')](_0x5b7949[_0xa177('0x5b')])))?path[_0xa177('0x66')](config['root'],_0x128b5f,_[_0xa177('0x65')](_0x5b7949['loginLogo'])):path[_0xa177('0x66')](config[_0xa177('0x64')],_0x128b5f,_[_0xa177('0x65')]('default_loginLogo.svg'));var _0x155b41=_0xa177('0x68')+_[_0xa177('0x6a')](_0xa177('0x5b'));if(_0x5b7949[_0x155b41]||!_0x23311d['custom']){_0x3bec2d=path[_0xa177('0x66')](config[_0xa177('0x64')],_0x128b5f,_['toLower']('default_loginLogo.svg'));}if(!fs[_0xa177('0x63')](_0x3bec2d)){throw new db[(_0xa177('0x6f'))][(_0xa177('0x69'))](_[_0xa177('0x6a')](_0xa177('0x5b'))+'\x20not\x20found');}return _0x1b8d26['download'](_0x3bec2d);}})[_0xa177('0x28')](handleError(_0x1b8d26,null));};exports[_0xa177('0x70')]=function(_0x2c11be,_0x533d23){return db[_0xa177('0x4d')][_0xa177('0x55')]({'where':{'id':_0x2c11be['params']['id']},'attributes':['securePassword']})[_0xa177('0x1e')](respondWithResult(_0x533d23,null))['catch'](handleError(_0x533d23,null));};exports[_0xa177('0x71')]=function(_0x2d0ea9,_0x252095,_0x4c7dfa){if(_0x2d0ea9[_0xa177('0x57')]&&_0x2d0ea9['file'][_0xa177('0x59')]){_0x2d0ea9['body'][_0xa177('0x5f')]=_0x2d0ea9['file'][_0xa177('0x59')];}return db[_0xa177('0x4d')][_0xa177('0x55')]({'where':{'id':_0x2d0ea9[_0xa177('0x54')]['id']}})['then'](handleEntityNotFound(_0x252095,null))[_0xa177('0x1e')](saveUpdates(_0x2d0ea9[_0xa177('0x56')],null))[_0xa177('0x1e')](respondWithResult(_0x252095,null))[_0xa177('0x28')](handleError(_0x252095,null));};var utilLicense=require(_0xa177('0x18'));exports[_0xa177('0x72')]=function(_0x3f8b27,_0x1b8956,_0x2755e9){var _0x4422b8=_0xa177('0x5d');var _0x25f897={'custom':![]};return utilLicense[_0xa177('0x5e')]()[_0xa177('0x1e')](function(_0x3e8eb5){if(_0x3e8eb5){_0x25f897=_0x3e8eb5;}return db[_0xa177('0x4d')][_0xa177('0x55')]({'where':{'id':_0x3f8b27[_0xa177('0x54')]['id']},'attributes':[_0xa177('0x58'),_0xa177('0x5b'),_0xa177('0x5f'),_0xa177('0x60'),_0xa177('0x6d'),_0xa177('0x6e'),'defaultPreferred',_0xa177('0x62')],'raw':!![]});})[_0xa177('0x1e')](handleEntityNotFound(_0x1b8956,null))[_0xa177('0x1e')](function(_0x1b6368){if(_0x1b6368){var _0x2935cb=_0x1b6368[_0xa177('0x5f')]&&fs['existsSync'](path[_0xa177('0x66')](config['root'],_0x4422b8,_[_0xa177('0x65')](_0x1b6368[_0xa177('0x5f')])))?path[_0xa177('0x66')](config[_0xa177('0x64')],_0x4422b8,_['toLower'](_0x1b6368['preferred'])):path[_0xa177('0x66')](config[_0xa177('0x64')],_0x4422b8,_[_0xa177('0x65')](_0xa177('0x73')));var _0x2a6c99=_0xa177('0x68')+_['upperFirst'](_0xa177('0x5f'));if(_0x1b6368[_0x2a6c99]||!_0x25f897[_0xa177('0x74')]||!_0x25f897[_0xa177('0x5f')]){_0x2935cb=path['join'](config['root'],_0x4422b8,_[_0xa177('0x65')]('default_preferred.png'));}if(!fs['existsSync'](_0x2935cb)){throw new db[(_0xa177('0x6f'))][(_0xa177('0x69'))](_['upperFirst'](_0xa177('0x5f'))+'\x20not\x20found');}return _0x1b8956[_0xa177('0x6c')](_0x2935cb);}})['catch'](handleError(_0x1b8956,null));};exports[_0xa177('0x75')]=function(_0xf44600,_0x370aa9,_0x2b0806){if(_0xf44600[_0xa177('0x57')]&&_0xf44600[_0xa177('0x57')]['filename']){_0xf44600['body'][_0xa177('0x60')]=_0xf44600[_0xa177('0x57')][_0xa177('0x59')];}return db['Setting'][_0xa177('0x55')]({'where':{'id':_0xf44600[_0xa177('0x54')]['id']}})[_0xa177('0x1e')](handleEntityNotFound(_0x370aa9,null))[_0xa177('0x1e')](saveUpdates(_0xf44600['body'],null))['then'](respondWithResult(_0x370aa9,null))[_0xa177('0x28')](handleError(_0x370aa9,null));};var utilLicense=require(_0xa177('0x18'));exports[_0xa177('0x76')]=function(_0x5d7157,_0x2588a3,_0x2471fb){var _0x1f6f39='server/files/images/logos';var _0x1fc8ba={'custom':![]};return utilLicense[_0xa177('0x5e')]()[_0xa177('0x1e')](function(_0x1d381d){if(_0x1d381d){_0x1fc8ba=_0x1d381d;}return db[_0xa177('0x4d')]['find']({'where':{'id':_0x5d7157[_0xa177('0x54')]['id']},'attributes':[_0xa177('0x58'),_0xa177('0x5b'),_0xa177('0x5f'),_0xa177('0x60'),_0xa177('0x6d'),_0xa177('0x6e'),_0xa177('0x61'),_0xa177('0x62')],'raw':!![]});})[_0xa177('0x1e')](handleEntityNotFound(_0x2588a3,null))[_0xa177('0x1e')](function(_0x3d2c23){if(_0x3d2c23){var _0x21d568=_0x3d2c23[_0xa177('0x60')]&&fs[_0xa177('0x63')](path[_0xa177('0x66')](config[_0xa177('0x64')],_0x1f6f39,_[_0xa177('0x65')](_0x3d2c23[_0xa177('0x60')])))?path[_0xa177('0x66')](config['root'],_0x1f6f39,_[_0xa177('0x65')](_0x3d2c23['favicon'])):path['join'](config[_0xa177('0x64')],_0x1f6f39,_[_0xa177('0x65')](_0xa177('0x77')));var _0x29d556=_0xa177('0x68')+_['upperFirst'](_0xa177('0x60'));if(_0x3d2c23[_0x29d556]||!_0x1fc8ba[_0xa177('0x74')]){_0x21d568=path[_0xa177('0x66')](config['root'],_0x1f6f39,_['toLower']('default_favicon.ico'));}if(!fs[_0xa177('0x63')](_0x21d568)){throw new db[(_0xa177('0x6f'))]['ValidationError'](_[_0xa177('0x6a')](_0xa177('0x60'))+_0xa177('0x6b'));}return _0x2588a3[_0xa177('0x6c')](_0x21d568);}})['catch'](handleError(_0x2588a3,null));};exports[_0xa177('0x78')]=function(_0x4195b2,_0x17703c){var _0x4ad1ec={'offset':moment()['utcOffset']()};_0x4ad1ec['now']=moment()[_0xa177('0x79')](_0x4ad1ec['offset'])[_0xa177('0x7a')](_0xa177('0x7b'));return _0x17703c[_0xa177('0x2a')](0xc8)[_0xa177('0x37')](_0x4ad1ec);};
\ No newline at end of file
+var _0xdbbc=['includeAll','include','rows','show','params','keys','intersection','find','body','filename','logo','file','addLogoLogin','loginLogo','server/files/images/logos','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','upperFirst','custom','existsSync','Sequelize','ValidationError','getLogoLogin','getLicense','default_loginLogo.svg','default','\x20not\x20found','download','gdpr','securePassword','addPreferred','../../config/license/util','getPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../mysqldb','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Setting'];(function(_0x478acb,_0x9d30c2){var _0x574935=function(_0x2279e5){while(--_0x2279e5){_0x478acb['push'](_0x478acb['shift']());}};_0x574935(++_0x9d30c2);}(_0xdbbc,0x19d));var _0xcdbb=function(_0x25dc19,_0xfec57c){_0x25dc19=_0x25dc19-0x0;var _0x21f424=_0xdbbc[_0x25dc19];return _0x21f424;};'use strict';var emlformat=require(_0xcdbb('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdbb('0x1'));var rp=require(_0xcdbb('0x2'));var moment=require(_0xcdbb('0x3'));var BPromise=require(_0xcdbb('0x4'));var Mustache=require(_0xcdbb('0x5'));var util=require(_0xcdbb('0x6'));var path=require(_0xcdbb('0x7'));var sox=require(_0xcdbb('0x8'));var csv=require(_0xcdbb('0x9'));var ejs=require(_0xcdbb('0xa'));var fs=require('fs');var fs_extra=require(_0xcdbb('0xb'));var _=require(_0xcdbb('0xc'));var squel=require('squel');var crypto=require(_0xcdbb('0xd'));var jsforce=require(_0xcdbb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcdbb('0x9'));var querystring=require(_0xcdbb('0xf'));var Papa=require(_0xcdbb('0x10'));var Redis=require(_0xcdbb('0x11'));var authService=require(_0xcdbb('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcdbb('0x13'));var utils=require(_0xcdbb('0x14'));var config=require(_0xcdbb('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcdbb('0x16'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xcdbb('0x17')][_0xcdbb('0x18')]({'port':0x232a});function respondWithRpcPromise(_0xc0128b,_0x264e83,_0xa55411,_0x37fd72){return new BPromise(function(_0x2d2acf,_0x4db6ce){var _0x5e515c=_0x37fd72||client;return _0x5e515c[_0xcdbb('0x19')](_0xc0128b,_0xa55411)[_0xcdbb('0x1a')](function(_0x3135e1){logger[_0xcdbb('0x1b')](_0xcdbb('0x1c'),_0x264e83,_0xcdbb('0x1d'));logger['debug'](_0xcdbb('0x1e'),_0x264e83,_0xcdbb('0x1d'),JSON['stringify'](_0x3135e1));if(_0x3135e1[_0xcdbb('0x1f')]){if(_0x3135e1['error']['code']===0x1f4){logger['error'](_0xcdbb('0x1c'),_0x264e83,_0x3135e1['error'][_0xcdbb('0x20')]);return _0x4db6ce(_0x3135e1['error']['message']);}logger[_0xcdbb('0x1f')](_0xcdbb('0x1c'),_0x264e83,_0x3135e1[_0xcdbb('0x1f')][_0xcdbb('0x20')]);return _0x2d2acf(_0x3135e1[_0xcdbb('0x1f')][_0xcdbb('0x20')]);}else{logger[_0xcdbb('0x1b')](_0xcdbb('0x1c'),_0x264e83,'request\x20sent');_0x2d2acf(_0x3135e1[_0xcdbb('0x21')][_0xcdbb('0x20')]);}})[_0xcdbb('0x22')](function(_0xa0ad0){logger[_0xcdbb('0x1f')](_0xcdbb('0x1c'),_0x264e83,_0xa0ad0);_0x4db6ce(_0xa0ad0);});});}function respondWithStatusCode(_0x3c3213,_0x4912e1){_0x4912e1=_0x4912e1||0xcc;return function(_0x261722){if(_0x261722){return _0x3c3213['sendStatus'](_0x4912e1);}return _0x3c3213[_0xcdbb('0x23')](_0x4912e1)['end']();};}function respondWithResult(_0x4bd018,_0xc3b018){_0xc3b018=_0xc3b018||0xc8;return function(_0x32164f){if(_0x32164f){return _0x4bd018[_0xcdbb('0x23')](_0xc3b018)['json'](_0x32164f);}};}function respondWithFilteredResult(_0x2c0b2c,_0x28468f){return function(_0x40e4b6){if(_0x40e4b6){var _0x536dc9=typeof _0x28468f['offset']===_0xcdbb('0x24')&&typeof _0x28468f[_0xcdbb('0x25')]===_0xcdbb('0x24');var _0xb665c5=_0x40e4b6[_0xcdbb('0x26')];var _0x1d4835=_0x536dc9?0x0:_0x28468f[_0xcdbb('0x27')];var _0x20bd13=_0x536dc9?_0x40e4b6['count']:_0x28468f[_0xcdbb('0x27')]+_0x28468f[_0xcdbb('0x25')];var _0x3503e6;if(_0x20bd13>=_0xb665c5){_0x20bd13=_0xb665c5;_0x3503e6=0xc8;}else{_0x3503e6=0xce;}_0x2c0b2c[_0xcdbb('0x23')](_0x3503e6);return _0x2c0b2c[_0xcdbb('0x28')](_0xcdbb('0x29'),_0x1d4835+'-'+_0x20bd13+'/'+_0xb665c5)[_0xcdbb('0x2a')](_0x40e4b6);}return null;};}function patchUpdates(_0x2951fb){return function(_0x22f68b){try{jsonpatch[_0xcdbb('0x2b')](_0x22f68b,_0x2951fb,!![]);}catch(_0x27996a){return BPromise[_0xcdbb('0x2c')](_0x27996a);}return _0x22f68b[_0xcdbb('0x2d')]();};}function saveUpdates(_0x4aabb6,_0x3b7b16){return function(_0x333d56){if(_0x333d56){return _0x333d56['update'](_0x4aabb6)[_0xcdbb('0x1a')](function(_0x4d178f){return _0x4d178f;});}return null;};}function removeEntity(_0x3f5c72,_0x25ab66){return function(_0x2d29b7){if(_0x2d29b7){return _0x2d29b7[_0xcdbb('0x2e')]()[_0xcdbb('0x1a')](function(){_0x3f5c72['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18bf51,_0xe598d9){return function(_0x48ffa1){if(!_0x48ffa1){_0x18bf51['sendStatus'](0x194);}return _0x48ffa1;};}function handleError(_0x371759,_0x177143){_0x177143=_0x177143||0x1f4;return function(_0x3cbae8){logger[_0xcdbb('0x1f')](_0x3cbae8['stack']);if(_0x3cbae8[_0xcdbb('0x2f')]){delete _0x3cbae8[_0xcdbb('0x2f')];}_0x371759[_0xcdbb('0x23')](_0x177143)[_0xcdbb('0x30')](_0x3cbae8);};}exports[_0xcdbb('0x31')]=function(_0xa16aff,_0x30a9f0){var _0x30f000={},_0x3d9b41={},_0x44cb0d={'count':0x0,'rows':[]};var _0x4588cf=_[_0xcdbb('0x32')](db['Setting'][_0xcdbb('0x33')],function(_0x36253f){return{'name':_0x36253f[_0xcdbb('0x34')],'type':_0x36253f[_0xcdbb('0x35')][_0xcdbb('0x36')]};});_0x3d9b41[_0xcdbb('0x37')]=_[_0xcdbb('0x32')](_0x4588cf,_0xcdbb('0x2f'));_0x3d9b41[_0xcdbb('0x38')]=_['keys'](_0xa16aff['query']);_0x3d9b41[_0xcdbb('0x39')]=_['intersection'](_0x3d9b41[_0xcdbb('0x37')],_0x3d9b41[_0xcdbb('0x38')]);_0x30f000['attributes']=_['intersection'](_0x3d9b41[_0xcdbb('0x37')],qs[_0xcdbb('0x3a')](_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x3a')]));_0x30f000[_0xcdbb('0x3b')]=_0x30f000[_0xcdbb('0x3b')][_0xcdbb('0x3c')]?_0x30f000[_0xcdbb('0x3b')]:_0x3d9b41['model'];if(!_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x3d')]('nolimit')){_0x30f000[_0xcdbb('0x25')]=qs[_0xcdbb('0x25')](_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x25')]);_0x30f000['offset']=qs[_0xcdbb('0x27')](_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x27')]);}_0x30f000[_0xcdbb('0x3e')]=qs['sort'](_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x3f')]);_0x30f000[_0xcdbb('0x40')]=qs[_0xcdbb('0x39')](_[_0xcdbb('0x41')](_0xa16aff[_0xcdbb('0x38')],_0x3d9b41['filters']),_0x4588cf);if(_0xa16aff['query'][_0xcdbb('0x42')]){_0x30f000[_0xcdbb('0x40')]=_[_0xcdbb('0x43')](_0x30f000['where'],{'$or':_[_0xcdbb('0x32')](_0x4588cf,function(_0x13f1da){if(_0x13f1da[_0xcdbb('0x35')]!==_0xcdbb('0x44')){var _0x1f5914={};_0x1f5914[_0x13f1da[_0xcdbb('0x2f')]]={'$like':'%'+_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x42')]+'%'};return _0x1f5914;}})});}_0x30f000=_[_0xcdbb('0x43')]({},_0x30f000,_0xa16aff[_0xcdbb('0x45')]);var _0x1519e4={'where':_0x30f000[_0xcdbb('0x40')]};return db[_0xcdbb('0x46')][_0xcdbb('0x26')](_0x1519e4)[_0xcdbb('0x1a')](function(_0x221711){_0x44cb0d[_0xcdbb('0x26')]=_0x221711;if(_0xa16aff[_0xcdbb('0x38')][_0xcdbb('0x47')]){_0x30f000[_0xcdbb('0x48')]=[{'all':!![]}];}return db[_0xcdbb('0x46')]['findAll'](_0x30f000);})[_0xcdbb('0x1a')](function(_0x504009){_0x44cb0d[_0xcdbb('0x49')]=_0x504009;return _0x44cb0d;})[_0xcdbb('0x1a')](respondWithFilteredResult(_0x30a9f0,_0x30f000))['catch'](handleError(_0x30a9f0,null));};exports[_0xcdbb('0x4a')]=function(_0x2321dc,_0x500488){var _0x3def8f={'raw':![],'where':{'id':_0x2321dc[_0xcdbb('0x4b')]['id']}},_0x1e0c27={};_0x1e0c27[_0xcdbb('0x37')]=_[_0xcdbb('0x4c')](db[_0xcdbb('0x46')]['rawAttributes']);_0x1e0c27['query']=_['keys'](_0x2321dc['query']);_0x1e0c27['filters']=_[_0xcdbb('0x4d')](_0x1e0c27[_0xcdbb('0x37')],_0x1e0c27['query']);_0x3def8f[_0xcdbb('0x3b')]=_['intersection'](_0x1e0c27['model'],qs[_0xcdbb('0x3a')](_0x2321dc[_0xcdbb('0x38')][_0xcdbb('0x3a')]));_0x3def8f['attributes']=_0x3def8f['attributes'][_0xcdbb('0x3c')]?_0x3def8f['attributes']:_0x1e0c27[_0xcdbb('0x37')];if(_0x2321dc[_0xcdbb('0x38')][_0xcdbb('0x47')]){_0x3def8f[_0xcdbb('0x48')]=[{'all':!![]}];}_0x3def8f=_[_0xcdbb('0x43')]({},_0x3def8f,_0x2321dc[_0xcdbb('0x45')]);return db[_0xcdbb('0x46')][_0xcdbb('0x4e')](_0x3def8f)[_0xcdbb('0x1a')](handleEntityNotFound(_0x500488,null))[_0xcdbb('0x1a')](respondWithResult(_0x500488,null))[_0xcdbb('0x22')](handleError(_0x500488,null));};exports['update']=function(_0x18c5f7,_0x32c45d){if(_0x18c5f7['body']['id']){delete _0x18c5f7['body']['id'];}return db[_0xcdbb('0x46')][_0xcdbb('0x4e')]({'where':{'id':_0x18c5f7[_0xcdbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x32c45d,null))[_0xcdbb('0x1a')](saveUpdates(_0x18c5f7[_0xcdbb('0x4f')],null))[_0xcdbb('0x1a')](respondWithResult(_0x32c45d,null))[_0xcdbb('0x22')](handleError(_0x32c45d,null));};exports['addLogo']=function(_0x5c2e5c,_0x3c7cb4,_0x8164a7){if(_0x5c2e5c['file']&&_0x5c2e5c['file'][_0xcdbb('0x50')]){_0x5c2e5c[_0xcdbb('0x4f')][_0xcdbb('0x51')]=_0x5c2e5c[_0xcdbb('0x52')]['filename'];}return db['Setting']['find']({'where':{'id':_0x5c2e5c[_0xcdbb('0x4b')]['id']}})[_0xcdbb('0x1a')](handleEntityNotFound(_0x3c7cb4,null))[_0xcdbb('0x1a')](saveUpdates(_0x5c2e5c['body'],null))[_0xcdbb('0x1a')](respondWithResult(_0x3c7cb4,null))['catch'](handleError(_0x3c7cb4,null));};exports[_0xcdbb('0x53')]=function(_0x2906b0,_0x133725,_0x31fd3c){if(_0x2906b0[_0xcdbb('0x52')]&&_0x2906b0[_0xcdbb('0x52')]['filename']){_0x2906b0[_0xcdbb('0x4f')][_0xcdbb('0x54')]=_0x2906b0[_0xcdbb('0x52')][_0xcdbb('0x50')];}return db['Setting']['find']({'where':{'id':_0x2906b0[_0xcdbb('0x4b')]['id']}})['then'](handleEntityNotFound(_0x133725,null))[_0xcdbb('0x1a')](saveUpdates(_0x2906b0['body'],null))['then'](respondWithResult(_0x133725,null))['catch'](handleError(_0x133725,null));};var utilLicense=require('../../config/license/util');exports['getLogo']=function(_0x48f3a4,_0x144dce,_0x99b7c3){var _0x2a0112=_0xcdbb('0x55');var _0x81b588={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2d064c){if(_0x2d064c){_0x81b588=_0x2d064c;}return db['Setting'][_0xcdbb('0x4e')]({'where':{'id':_0x48f3a4[_0xcdbb('0x4b')]['id']},'attributes':[_0xcdbb('0x51'),'loginLogo',_0xcdbb('0x56'),_0xcdbb('0x57'),_0xcdbb('0x58'),_0xcdbb('0x59'),_0xcdbb('0x5a'),_0xcdbb('0x5b')],'raw':!![]});})[_0xcdbb('0x1a')](handleEntityNotFound(_0x144dce,null))[_0xcdbb('0x1a')](function(_0x1c669f){if(_0x1c669f){var _0x5254f5=_0x1c669f[_0xcdbb('0x51')]&&fs['existsSync'](path[_0xcdbb('0x5c')](config['root'],_0x2a0112,_[_0xcdbb('0x5d')](_0x1c669f[_0xcdbb('0x51')])))?path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x2a0112,_[_0xcdbb('0x5d')](_0x1c669f[_0xcdbb('0x51')])):path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x2a0112,_[_0xcdbb('0x5d')](_0xcdbb('0x5f')));var _0x1dd837='default'+_[_0xcdbb('0x60')](_0xcdbb('0x51'));if(_0x1c669f[_0x1dd837]||!_0x81b588[_0xcdbb('0x61')]){_0x5254f5=path['join'](config['root'],_0x2a0112,_[_0xcdbb('0x5d')](_0xcdbb('0x5f')));}if(!fs[_0xcdbb('0x62')](_0x5254f5)){throw new db[(_0xcdbb('0x63'))][(_0xcdbb('0x64'))](_[_0xcdbb('0x60')](_0xcdbb('0x51'))+'\x20not\x20found');}return _0x144dce['download'](_0x5254f5);}})[_0xcdbb('0x22')](handleError(_0x144dce,null));};var utilLicense=require('../../config/license/util');exports[_0xcdbb('0x65')]=function(_0x15ec8c,_0x505f7b,_0xfbcece){var _0x72390b='server/files/images/logos';var _0x5969d5={'custom':![]};return utilLicense[_0xcdbb('0x66')]()[_0xcdbb('0x1a')](function(_0x16899c){if(_0x16899c){_0x5969d5=_0x16899c;}return db['Setting'][_0xcdbb('0x4e')]({'where':{'id':_0x15ec8c[_0xcdbb('0x4b')]['id']},'attributes':[_0xcdbb('0x51'),_0xcdbb('0x54'),_0xcdbb('0x56'),'favicon',_0xcdbb('0x58'),_0xcdbb('0x59'),_0xcdbb('0x5a'),_0xcdbb('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x505f7b,null))[_0xcdbb('0x1a')](function(_0x489593){if(_0x489593){var _0x3f4c99=_0x489593[_0xcdbb('0x54')]&&fs[_0xcdbb('0x62')](path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x72390b,_[_0xcdbb('0x5d')](_0x489593['loginLogo'])))?path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x72390b,_[_0xcdbb('0x5d')](_0x489593['loginLogo'])):path['join'](config['root'],_0x72390b,_[_0xcdbb('0x5d')](_0xcdbb('0x67')));var _0x2388e5=_0xcdbb('0x68')+_[_0xcdbb('0x60')](_0xcdbb('0x54'));if(_0x489593[_0x2388e5]||!_0x5969d5['custom']){_0x3f4c99=path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x72390b,_[_0xcdbb('0x5d')]('default_loginLogo.svg'));}if(!fs[_0xcdbb('0x62')](_0x3f4c99)){throw new db[(_0xcdbb('0x63'))][(_0xcdbb('0x64'))](_[_0xcdbb('0x60')](_0xcdbb('0x54'))+_0xcdbb('0x69'));}return _0x505f7b[_0xcdbb('0x6a')](_0x3f4c99);}})[_0xcdbb('0x22')](handleError(_0x505f7b,null));};exports[_0xcdbb('0x6b')]=function(_0x293880,_0x39f521){return db[_0xcdbb('0x46')][_0xcdbb('0x4e')]({'where':{'id':_0x293880[_0xcdbb('0x4b')]['id']},'attributes':[_0xcdbb('0x6c')]})[_0xcdbb('0x1a')](respondWithResult(_0x39f521,null))[_0xcdbb('0x22')](handleError(_0x39f521,null));};exports[_0xcdbb('0x6d')]=function(_0x2cbe8a,_0xc1c32e,_0x3e0f2d){if(_0x2cbe8a[_0xcdbb('0x52')]&&_0x2cbe8a[_0xcdbb('0x52')][_0xcdbb('0x50')]){_0x2cbe8a['body'][_0xcdbb('0x56')]=_0x2cbe8a[_0xcdbb('0x52')][_0xcdbb('0x50')];}return db[_0xcdbb('0x46')][_0xcdbb('0x4e')]({'where':{'id':_0x2cbe8a['params']['id']}})[_0xcdbb('0x1a')](handleEntityNotFound(_0xc1c32e,null))[_0xcdbb('0x1a')](saveUpdates(_0x2cbe8a[_0xcdbb('0x4f')],null))[_0xcdbb('0x1a')](respondWithResult(_0xc1c32e,null))[_0xcdbb('0x22')](handleError(_0xc1c32e,null));};var utilLicense=require(_0xcdbb('0x6e'));exports[_0xcdbb('0x6f')]=function(_0x3f4198,_0x3c2563,_0x26c1b8){var _0x5adbc9='server/files/images/logos';var _0x3b150d={'custom':![]};return utilLicense[_0xcdbb('0x66')]()[_0xcdbb('0x1a')](function(_0x58491f){if(_0x58491f){_0x3b150d=_0x58491f;}return db[_0xcdbb('0x46')]['find']({'where':{'id':_0x3f4198['params']['id']},'attributes':['logo',_0xcdbb('0x54'),'preferred',_0xcdbb('0x57'),_0xcdbb('0x58'),'defaultLoginLogo',_0xcdbb('0x5a'),_0xcdbb('0x5b')],'raw':!![]});})[_0xcdbb('0x1a')](handleEntityNotFound(_0x3c2563,null))[_0xcdbb('0x1a')](function(_0x41686d){if(_0x41686d){var _0x137a4f=_0x41686d[_0xcdbb('0x56')]&&fs[_0xcdbb('0x62')](path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x5adbc9,_[_0xcdbb('0x5d')](_0x41686d['preferred'])))?path['join'](config[_0xcdbb('0x5e')],_0x5adbc9,_[_0xcdbb('0x5d')](_0x41686d[_0xcdbb('0x56')])):path[_0xcdbb('0x5c')](config['root'],_0x5adbc9,_[_0xcdbb('0x5d')](_0xcdbb('0x70')));var _0x131c1f=_0xcdbb('0x68')+_[_0xcdbb('0x60')](_0xcdbb('0x56'));if(_0x41686d[_0x131c1f]||!_0x3b150d[_0xcdbb('0x61')]||!_0x3b150d['preferred']){_0x137a4f=path[_0xcdbb('0x5c')](config['root'],_0x5adbc9,_[_0xcdbb('0x5d')](_0xcdbb('0x70')));}if(!fs['existsSync'](_0x137a4f)){throw new db[(_0xcdbb('0x63'))][(_0xcdbb('0x64'))](_[_0xcdbb('0x60')](_0xcdbb('0x56'))+_0xcdbb('0x69'));}return _0x3c2563['download'](_0x137a4f);}})[_0xcdbb('0x22')](handleError(_0x3c2563,null));};exports[_0xcdbb('0x71')]=function(_0x1b59ca,_0x3eb71b,_0x346f36){if(_0x1b59ca[_0xcdbb('0x52')]&&_0x1b59ca[_0xcdbb('0x52')][_0xcdbb('0x50')]){_0x1b59ca[_0xcdbb('0x4f')][_0xcdbb('0x57')]=_0x1b59ca[_0xcdbb('0x52')][_0xcdbb('0x50')];}return db[_0xcdbb('0x46')][_0xcdbb('0x4e')]({'where':{'id':_0x1b59ca[_0xcdbb('0x4b')]['id']}})[_0xcdbb('0x1a')](handleEntityNotFound(_0x3eb71b,null))['then'](saveUpdates(_0x1b59ca['body'],null))[_0xcdbb('0x1a')](respondWithResult(_0x3eb71b,null))[_0xcdbb('0x22')](handleError(_0x3eb71b,null));};var utilLicense=require(_0xcdbb('0x6e'));exports[_0xcdbb('0x72')]=function(_0x34cbd2,_0x5e61f8,_0x4dcf89){var _0x199f52='server/files/images/logos';var _0x333742={'custom':![]};return utilLicense[_0xcdbb('0x66')]()[_0xcdbb('0x1a')](function(_0x227067){if(_0x227067){_0x333742=_0x227067;}return db['Setting'][_0xcdbb('0x4e')]({'where':{'id':_0x34cbd2['params']['id']},'attributes':['logo','loginLogo',_0xcdbb('0x56'),_0xcdbb('0x57'),_0xcdbb('0x58'),_0xcdbb('0x59'),_0xcdbb('0x5a'),_0xcdbb('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x5e61f8,null))[_0xcdbb('0x1a')](function(_0x55263f){if(_0x55263f){var _0x10ee4a=_0x55263f['favicon']&&fs['existsSync'](path['join'](config[_0xcdbb('0x5e')],_0x199f52,_[_0xcdbb('0x5d')](_0x55263f[_0xcdbb('0x57')])))?path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x199f52,_[_0xcdbb('0x5d')](_0x55263f[_0xcdbb('0x57')])):path[_0xcdbb('0x5c')](config[_0xcdbb('0x5e')],_0x199f52,_[_0xcdbb('0x5d')](_0xcdbb('0x73')));var _0x2e7adf=_0xcdbb('0x68')+_[_0xcdbb('0x60')](_0xcdbb('0x57'));if(_0x55263f[_0x2e7adf]||!_0x333742[_0xcdbb('0x61')]){_0x10ee4a=path['join'](config[_0xcdbb('0x5e')],_0x199f52,_[_0xcdbb('0x5d')](_0xcdbb('0x73')));}if(!fs[_0xcdbb('0x62')](_0x10ee4a)){throw new db['Sequelize'][(_0xcdbb('0x64'))](_[_0xcdbb('0x60')](_0xcdbb('0x57'))+_0xcdbb('0x69'));}return _0x5e61f8['download'](_0x10ee4a);}})['catch'](handleError(_0x5e61f8,null));};exports[_0xcdbb('0x74')]=function(_0x4a4a63,_0x3ca81d){var _0x52744d={'offset':moment()[_0xcdbb('0x75')]()};_0x52744d[_0xcdbb('0x76')]=moment()['utcOffset'](_0x52744d['offset'])[_0xcdbb('0x77')](_0xcdbb('0x78'));return _0x3ca81d[_0xcdbb('0x23')](0xc8)[_0xcdbb('0x30')](_0x52744d);};
\ No newline at end of file
index 91b7dd1..ac1650f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x3cfd57,_0x537cf5){var _0x527d26=function(_0x37d396){while(--_0x37d396){_0x3cfd57['push'](_0x3cfd57['shift']());}};_0x527d26(++_0x537cf5);}(_0x3e74,0x175));var _0x43e7=function(_0x2554d9,_0x14f2d7){_0x2554d9=_0x2554d9-0x0;var _0x49cee8=_0x3e74[_0x2554d9];return _0x49cee8;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x52e52b,_0x172445){var _0x26a280=function(_0x56c60d){while(--_0x56c60d){_0x52e52b['push'](_0x52e52b['shift']());}};_0x26a280(++_0x172445);}(_0xedd9,0xfc));var _0x9edd=function(_0x236101,_0x1daa6e){_0x236101=_0x236101-0x0;var _0x546eb5=_0xedd9[_0x236101];return _0x546eb5;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index f513888..3060389 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc818=['attributes','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','Setting,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','include','map','model'];(function(_0xba1760,_0x191969){var _0x1f3143=function(_0x5aa807){while(--_0x5aa807){_0xba1760['push'](_0xba1760['shift']());}};_0x1f3143(++_0x191969);}(_0xc818,0x1bc));var _0x8c81=function(_0x1d3484,_0x18974b){_0x1d3484=_0x1d3484-0x0;var _0x94f618=_0xc818[_0x1d3484];return _0x94f618;};'use strict';var _=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var BPromise=require(_0x8c81('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8c81('0x4'))['db'];var utils=require(_0x8c81('0x5'));var logger=require(_0x8c81('0x6'))(_0x8c81('0x7'));var config=require(_0x8c81('0x8'));var jayson=require(_0x8c81('0x9'));var client=jayson[_0x8c81('0xa')][_0x8c81('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x103fb9,_0x29fe94,_0x35792d){return new BPromise(function(_0x5b9fca,_0x2f8016){return client['request'](_0x103fb9,_0x35792d)[_0x8c81('0xc')](function(_0x26c1be){logger[_0x8c81('0xd')](_0x8c81('0xe'),_0x29fe94,'request\x20sent');logger['debug'](_0x8c81('0xf'),_0x29fe94,_0x8c81('0x10'),JSON[_0x8c81('0x11')](_0x26c1be));if(_0x26c1be[_0x8c81('0x12')]){if(_0x26c1be['error'][_0x8c81('0x13')]===0x1f4){logger[_0x8c81('0x12')](_0x8c81('0xe'),_0x29fe94,_0x26c1be[_0x8c81('0x12')]['message']);return _0x2f8016(_0x26c1be[_0x8c81('0x12')][_0x8c81('0x14')]);}logger['error']('Setting,\x20%s,\x20%s',_0x29fe94,_0x26c1be[_0x8c81('0x12')]['message']);return _0x5b9fca(_0x26c1be[_0x8c81('0x12')]['message']);}else{logger['info'](_0x8c81('0xe'),_0x29fe94,_0x8c81('0x10'));_0x5b9fca(_0x26c1be[_0x8c81('0x15')][_0x8c81('0x14')]);}})[_0x8c81('0x16')](function(_0x50fbbb){logger[_0x8c81('0x12')](_0x8c81('0xe'),_0x29fe94,_0x50fbbb);_0x2f8016(_0x50fbbb);});});}exports[_0x8c81('0x17')]=function(_0x2fc690){var _0x4e77ea=this;return new Promise(function(_0x593bb0,_0x4f4abf){return db[_0x8c81('0x18')][_0x8c81('0x19')]({'raw':_0x2fc690[_0x8c81('0x1a')]?_0x2fc690[_0x8c81('0x1a')][_0x8c81('0x1b')]===undefined?!![]:![]:!![],'where':_0x2fc690[_0x8c81('0x1a')]?_0x2fc690['options'][_0x8c81('0x1c')]||null:null,'attributes':_0x2fc690[_0x8c81('0x1a')]?_0x2fc690[_0x8c81('0x1a')]['attributes']||null:null,'include':_0x2fc690[_0x8c81('0x1a')]?_0x2fc690[_0x8c81('0x1a')][_0x8c81('0x1d')]?_['map'](_0x2fc690[_0x8c81('0x1a')][_0x8c81('0x1d')],function(_0x2cb8eb){return{'model':db[_0x2cb8eb['model']],'as':_0x2cb8eb['as'],'attributes':_0x2cb8eb['attributes'],'include':_0x2cb8eb['include']?_[_0x8c81('0x1e')](_0x2cb8eb[_0x8c81('0x1d')],function(_0x292dab){return{'model':db[_0x292dab[_0x8c81('0x1f')]],'as':_0x292dab['as'],'attributes':_0x292dab['attributes'],'include':_0x292dab['include']?_['map'](_0x292dab[_0x8c81('0x1d')],function(_0x521e7e){return{'model':db[_0x521e7e[_0x8c81('0x1f')]],'as':_0x521e7e['as'],'attributes':_0x521e7e[_0x8c81('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8c81('0xc')](function(_0x49daa5){logger['info'](_0x8c81('0x17'),_0x2fc690);logger[_0x8c81('0x21')](_0x8c81('0x17'),_0x2fc690,JSON[_0x8c81('0x11')](_0x49daa5));_0x593bb0(_0x49daa5);})['catch'](function(_0x1abd20){logger[_0x8c81('0x12')](_0x8c81('0x17'),_0x1abd20[_0x8c81('0x14')],_0x2fc690);_0x4f4abf(_0x4e77ea['error'](0x1f4,_0x1abd20[_0x8c81('0x14')]));});});};
\ No newline at end of file
+var _0x6760=['../../config/utils','rpc','../../config/environment','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','catch','ShowSetting','Setting','find','options','where','map','include','model','attributes','then','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6760,0x13a));var _0x0676=function(_0x46e39f,_0x5066c7){_0x46e39f=_0x46e39f-0x0;var _0x4bf790=_0x6760[_0x46e39f];return _0x4bf790;};'use strict';var _=require(_0x0676('0x0'));var util=require('util');var moment=require(_0x0676('0x1'));var BPromise=require(_0x0676('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0676('0x3'));var db=require(_0x0676('0x4'))['db'];var utils=require(_0x0676('0x5'));var logger=require('../../config/logger')(_0x0676('0x6'));var config=require(_0x0676('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0676('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x306570,_0x3eb932,_0x5d9617){return new BPromise(function(_0x598d5f,_0x56e8ab){return client[_0x0676('0x9')](_0x306570,_0x5d9617)['then'](function(_0x174bb8){logger[_0x0676('0xa')](_0x0676('0xb'),_0x3eb932,_0x0676('0xc'));logger[_0x0676('0xd')](_0x0676('0xe'),_0x3eb932,'request\x20sent',JSON['stringify'](_0x174bb8));if(_0x174bb8[_0x0676('0xf')]){if(_0x174bb8[_0x0676('0xf')][_0x0676('0x10')]===0x1f4){logger[_0x0676('0xf')](_0x0676('0xb'),_0x3eb932,_0x174bb8[_0x0676('0xf')][_0x0676('0x11')]);return _0x56e8ab(_0x174bb8[_0x0676('0xf')][_0x0676('0x11')]);}logger[_0x0676('0xf')](_0x0676('0xb'),_0x3eb932,_0x174bb8[_0x0676('0xf')]['message']);return _0x598d5f(_0x174bb8[_0x0676('0xf')][_0x0676('0x11')]);}else{logger[_0x0676('0xa')](_0x0676('0xb'),_0x3eb932,_0x0676('0xc'));_0x598d5f(_0x174bb8['result'][_0x0676('0x11')]);}})[_0x0676('0x12')](function(_0x25087f){logger[_0x0676('0xf')](_0x0676('0xb'),_0x3eb932,_0x25087f);_0x56e8ab(_0x25087f);});});}exports[_0x0676('0x13')]=function(_0x52424b){var _0x1acb97=this;return new Promise(function(_0x514b49,_0x505032){return db[_0x0676('0x14')][_0x0676('0x15')]({'raw':_0x52424b['options']?_0x52424b[_0x0676('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x52424b[_0x0676('0x16')]?_0x52424b[_0x0676('0x16')][_0x0676('0x17')]||null:null,'attributes':_0x52424b[_0x0676('0x16')]?_0x52424b['options']['attributes']||null:null,'include':_0x52424b[_0x0676('0x16')]?_0x52424b[_0x0676('0x16')]['include']?_[_0x0676('0x18')](_0x52424b['options'][_0x0676('0x19')],function(_0x456311){return{'model':db[_0x456311[_0x0676('0x1a')]],'as':_0x456311['as'],'attributes':_0x456311['attributes'],'include':_0x456311[_0x0676('0x19')]?_[_0x0676('0x18')](_0x456311['include'],function(_0x5635b1){return{'model':db[_0x5635b1[_0x0676('0x1a')]],'as':_0x5635b1['as'],'attributes':_0x5635b1[_0x0676('0x1b')],'include':_0x5635b1[_0x0676('0x19')]?_['map'](_0x5635b1[_0x0676('0x19')],function(_0x3863c3){return{'model':db[_0x3863c3['model']],'as':_0x3863c3['as'],'attributes':_0x3863c3['attributes']};}):[]};}):[]};}):[]:[]})[_0x0676('0x1c')](function(_0x3532b0){logger[_0x0676('0xa')](_0x0676('0x13'),_0x52424b);logger['debug'](_0x0676('0x13'),_0x52424b,JSON['stringify'](_0x3532b0));_0x514b49(_0x3532b0);})[_0x0676('0x12')](function(_0x523507){logger[_0x0676('0xf')](_0x0676('0x13'),_0x523507['message'],_0x52424b);_0x505032(_0x1acb97['error'](0x1f4,_0x523507['message']));});});};
\ No newline at end of file
index 506ecc2..b3d4433 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x3967c8,_0x1fb6e2){var _0x477dd2=function(_0xe93850){while(--_0xe93850){_0x3967c8['push'](_0x3967c8['shift']());}};_0x477dd2(++_0x1fb6e2);}(_0x7a54,0x106));var _0x47a5=function(_0x2fc136,_0x50590a){_0x2fc136=_0x2fc136-0x0;var _0x31299f=_0x7a54[_0x2fc136];return _0x31299f;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router;
\ No newline at end of file
+var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x42c118,_0x197006){var _0x112ebd=function(_0x337411){while(--_0x337411){_0x42c118['push'](_0x42c118['shift']());}};_0x112ebd(++_0x197006);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router;
\ No newline at end of file
index dda6ae3..153cce2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0b2=['INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','csc','infobip','intelepeer','BOOLEAN','TEXT'];(function(_0x8a5bf,_0x32cbce){var _0x531724=function(_0x161d3e){while(--_0x161d3e){_0x8a5bf['push'](_0x8a5bf['shift']());}};_0x531724(++_0x32cbce);}(_0xe0b2,0x14f));var _0x2e0b=function(_0x557dfe,_0x59348d){_0x557dfe=_0x557dfe-0x0;var _0x47be9f=_0xe0b2[_0x557dfe];return _0x47be9f;};'use strict';var Sequelize=require(_0x2e0b('0x0'));var rs=require('randomstring');module[_0x2e0b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2e0b('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x2e0b('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x2e0b('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x2e0b('0x3')],'defaultValue':function(){return rs[_0x2e0b('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x2e0b('0x5')](_0x2e0b('0x6'),_0x2e0b('0x7'),_0x2e0b('0x8'),_0x2e0b('0x9'),_0x2e0b('0xa'),_0x2e0b('0xb'),'bandwidth',_0x2e0b('0xc'),_0x2e0b('0xd'),_0x2e0b('0xe'))},'accountSid':{'type':Sequelize[_0x2e0b('0x3')]},'authId':{'type':Sequelize[_0x2e0b('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x2e0b('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x2e0b('0x3')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x2e0b('0x3')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x2e0b('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x2e0b('0x3')]},'notificationTemplate':{'type':Sequelize[_0x2e0b('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2e0b('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2e0b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2e0b('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2e0b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2e0b('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2e0b('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2e0b('0xf')],'defaultValue':![],'comment':_0x2e0b('0x12'),'set':function(_0x21983a){if(!_0x21983a)this[_0x2e0b('0x13')](_0x2e0b('0x14'),null);this[_0x2e0b('0x13')](_0x2e0b('0x15'),_0x21983a);}}};
\ No newline at end of file
+var _0x7608=['csc','intelepeer','ENUM','BOOLEAN','TEXT','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','STRING','name','generate','twilio','skebby','clicksend','plivo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7608,0xf3));var _0x8760=function(_0x226857,_0x183547){_0x226857=_0x226857-0x0;var _0x21281d=_0x7608[_0x226857];return _0x21281d;};'use strict';var Sequelize=require(_0x8760('0x0'));var rs=require(_0x8760('0x1'));module['exports']={'name':{'type':Sequelize[_0x8760('0x2')],'unique':_0x8760('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x8760('0x2')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x8760('0x4')]();}},'phone':{'type':Sequelize[_0x8760('0x2')]},'type':{'type':Sequelize['ENUM'](_0x8760('0x5'),_0x8760('0x6'),'connectel',_0x8760('0x7'),_0x8760('0x8'),'clickatell','bandwidth',_0x8760('0x9'),'infobip',_0x8760('0xa'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x8760('0x2')]},'authToken':{'type':Sequelize[_0x8760('0x2')]},'smsMethod':{'type':Sequelize[_0x8760('0xb')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x8760('0x2')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x8760('0x2')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0x8760('0xc')],'defaultValue':![]},'description':{'type':Sequelize[_0x8760('0x2')]},'notificationTemplate':{'type':Sequelize[_0x8760('0xd')],'defaultValue':function(){return'Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x8760('0xc')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8760('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8760('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8760('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8760('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x8760('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x8760('0xe')],'comment':_0x8760('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x8760('0xc')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x3c2854){if(!_0x3c2854)this[_0x8760('0x10')](_0x8760('0x11'),null);this[_0x8760('0x10')]('mandatoryDisposition',_0x3c2854);}}};
\ No newline at end of file
index 6576cbd..a135bef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa527=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','get','SmsAccounts','end','stack','name','send','index','Pause','map','SmsAccount','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','mandatoryDispositionPause','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','describe','addDisposition','SmsAccountId','Disposition','rawAttributes','fields','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','account','applications','Applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','clicksend','message_id','plivo','Text','infobip','results','csc','originatingAddress','clickatell','fromNumber','replyMessageId','intelepeer','refid','Sequelize','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','omit','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','entity\x20found','text/xml','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>','addApplications','sequelize','transaction','Transaction','findOne','priority','finally','getApplications','order','getInteractions','User','Owner','fullname','internal','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','userSmsAccount:save','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xa527,0xda));var _0x7a52=function(_0x3456fe,_0x4e21b6){_0x3456fe=_0x3456fe-0x0;var _0x46fdcb=_0xa527[_0x3456fe];return _0x46fdcb;};'use strict';var emlformat=require(_0x7a52('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7a52('0x1'));var rp=require(_0x7a52('0x2'));var moment=require(_0x7a52('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7a52('0x4'));var util=require(_0x7a52('0x5'));var path=require(_0x7a52('0x6'));var sox=require(_0x7a52('0x7'));var csv=require(_0x7a52('0x8'));var ejs=require(_0x7a52('0x9'));var fs=require('fs');var fs_extra=require(_0x7a52('0xa'));var _=require(_0x7a52('0xb'));var squel=require(_0x7a52('0xc'));var crypto=require('crypto');var jsforce=require(_0x7a52('0xd'));var deskjs=require(_0x7a52('0xe'));var toCsv=require(_0x7a52('0x8'));var querystring=require(_0x7a52('0xf'));var Papa=require(_0x7a52('0x10'));var Redis=require(_0x7a52('0x11'));var authService=require(_0x7a52('0x12'));var qs=require(_0x7a52('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a52('0x14'));var logger=require(_0x7a52('0x15'))(_0x7a52('0x16'));var utils=require(_0x7a52('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7a52('0x18'));var db=require(_0x7a52('0x19'))['db'];config[_0x7a52('0x1a')]=_[_0x7a52('0x1b')](config[_0x7a52('0x1a')],{'host':_0x7a52('0x1c'),'port':0x18eb});var socket=require(_0x7a52('0x1d'))(new Redis(config['redis']));require(_0x7a52('0x1e'))[_0x7a52('0x1f')](socket);var jayson=require(_0x7a52('0x20'));var client=jayson[_0x7a52('0x21')][_0x7a52('0x22')]({'port':0x232c});function respondWithRpcPromise(_0xc91888,_0x26c114,_0x286f98,_0x2bfc6e){return new BPromise(function(_0x14226d,_0x5664a0){var _0x26a86a=_0x2bfc6e||client;return _0x26a86a['request'](_0xc91888,_0x286f98)[_0x7a52('0x23')](function(_0x2d4601){logger[_0x7a52('0x24')](_0x7a52('0x25'),_0x26c114,_0x7a52('0x26'));logger[_0x7a52('0x27')](_0x7a52('0x28'),_0x26c114,_0x7a52('0x26'),JSON[_0x7a52('0x29')](_0x2d4601));if(_0x2d4601[_0x7a52('0x2a')]){if(_0x2d4601[_0x7a52('0x2a')][_0x7a52('0x2b')]===0x1f4){logger['error'](_0x7a52('0x25'),_0x26c114,_0x2d4601['error'][_0x7a52('0x2c')]);return _0x5664a0(_0x2d4601[_0x7a52('0x2a')][_0x7a52('0x2c')]);}logger['error'](_0x7a52('0x25'),_0x26c114,_0x2d4601['error'][_0x7a52('0x2c')]);return _0x14226d(_0x2d4601[_0x7a52('0x2a')][_0x7a52('0x2c')]);}else{logger['info'](_0x7a52('0x25'),_0x26c114,_0x7a52('0x26'));_0x14226d(_0x2d4601[_0x7a52('0x2d')][_0x7a52('0x2c')]);}})[_0x7a52('0x2e')](function(_0x2ee169){logger['error'](_0x7a52('0x25'),_0x26c114,_0x2ee169);_0x5664a0(_0x2ee169);});});}function respondWithStatusCode(_0x54f26a,_0x359f7f){_0x359f7f=_0x359f7f||0xcc;return function(_0x24906a){if(_0x24906a){return _0x54f26a[_0x7a52('0x2f')](_0x359f7f);}return _0x54f26a[_0x7a52('0x30')](_0x359f7f)['end']();};}function respondWithResult(_0x2e9366,_0x21cf8b){_0x21cf8b=_0x21cf8b||0xc8;return function(_0x4dbd9a){if(_0x4dbd9a){return _0x2e9366[_0x7a52('0x30')](_0x21cf8b)['json'](_0x4dbd9a);}};}function respondWithFilteredResult(_0x59ecf8,_0x5ddc8a){return function(_0x51add0){if(_0x51add0){var _0x5d595f=typeof _0x5ddc8a[_0x7a52('0x31')]===_0x7a52('0x32')&&typeof _0x5ddc8a[_0x7a52('0x33')]===_0x7a52('0x32');var _0x5c367d=_0x51add0[_0x7a52('0x34')];var _0x4d46f8=_0x5d595f?0x0:_0x5ddc8a[_0x7a52('0x31')];var _0x21f5e3=_0x5d595f?_0x51add0['count']:_0x5ddc8a[_0x7a52('0x31')]+_0x5ddc8a[_0x7a52('0x33')];var _0x4910f5;if(_0x21f5e3>=_0x5c367d){_0x21f5e3=_0x5c367d;_0x4910f5=0xc8;}else{_0x4910f5=0xce;}_0x59ecf8['status'](_0x4910f5);return _0x59ecf8[_0x7a52('0x35')](_0x7a52('0x36'),_0x4d46f8+'-'+_0x21f5e3+'/'+_0x5c367d)[_0x7a52('0x37')](_0x51add0);}return null;};}function patchUpdates(_0x368520){return function(_0xb4ce7e){try{jsonpatch[_0x7a52('0x38')](_0xb4ce7e,_0x368520,!![]);}catch(_0x46d9d3){return BPromise['reject'](_0x46d9d3);}return _0xb4ce7e[_0x7a52('0x39')]();};}function saveUpdates(_0x21b07f,_0x46a845){return function(_0x4aa3e2){if(_0x4aa3e2){return _0x4aa3e2['update'](_0x21b07f)[_0x7a52('0x23')](function(_0x2b7281){return _0x2b7281;});}return null;};}function removeEntity(_0x834a6a,_0x4163a0){return function(_0x41ae20){if(_0x41ae20){return _0x41ae20[_0x7a52('0x3a')]()[_0x7a52('0x23')](function(){var _0x3e46bf=_0x41ae20[_0x7a52('0x3b')]({'plain':!![]});var _0x21dfd6=_0x7a52('0x3c');return db['UserProfileResource'][_0x7a52('0x3a')]({'where':{'type':_0x21dfd6,'resourceId':_0x3e46bf['id']}})['then'](function(){return _0x41ae20;});})[_0x7a52('0x23')](function(){_0x834a6a[_0x7a52('0x30')](0xcc)[_0x7a52('0x3d')]();});}};}function handleEntityNotFound(_0xa1f344,_0x2c3cc2){return function(_0x3367b0){if(!_0x3367b0){_0xa1f344[_0x7a52('0x2f')](0x194);}return _0x3367b0;};}function handleError(_0x522b90,_0x57636f){_0x57636f=_0x57636f||0x1f4;return function(_0x4364c2){logger['error'](_0x4364c2[_0x7a52('0x3e')]);if(_0x4364c2[_0x7a52('0x3f')]){delete _0x4364c2[_0x7a52('0x3f')];}_0x522b90[_0x7a52('0x30')](_0x57636f)[_0x7a52('0x40')](_0x4364c2);};}exports[_0x7a52('0x41')]=function(_0xdbd300,_0x3fd40a){var _0x1b2c5c={'include':[{'model':db[_0x7a52('0x42')],'as':'mandatoryDispositionPause'}]},_0x36d316={},_0x5091cd={'count':0x0,'rows':[]};var _0x54f706=_[_0x7a52('0x43')](db[_0x7a52('0x44')]['rawAttributes'],function(_0xd29df7){return{'name':_0xd29df7['fieldName'],'type':_0xd29df7[_0x7a52('0x45')][_0x7a52('0x46')]};});_0x36d316['model']=_[_0x7a52('0x43')](_0x54f706,_0x7a52('0x3f'));_0x36d316[_0x7a52('0x47')]=_[_0x7a52('0x48')](_0xdbd300[_0x7a52('0x47')]);_0x36d316[_0x7a52('0x49')]=_[_0x7a52('0x4a')](_0x36d316[_0x7a52('0x4b')],_0x36d316['query']);_0x1b2c5c['attributes']=_[_0x7a52('0x4a')](_0x36d316[_0x7a52('0x4b')],qs['fields'](_0xdbd300[_0x7a52('0x47')]['fields']));_0x1b2c5c[_0x7a52('0x4c')]=_0x1b2c5c['attributes'][_0x7a52('0x4d')]?_0x1b2c5c[_0x7a52('0x4c')]:_0x36d316['model'];if(!_0xdbd300[_0x7a52('0x47')][_0x7a52('0x4e')](_0x7a52('0x4f'))){_0x1b2c5c['limit']=qs['limit'](_0xdbd300['query']['limit']);_0x1b2c5c['offset']=qs[_0x7a52('0x31')](_0xdbd300[_0x7a52('0x47')][_0x7a52('0x31')]);}_0x1b2c5c['order']=qs[_0x7a52('0x50')](_0xdbd300[_0x7a52('0x47')][_0x7a52('0x50')]);_0x1b2c5c[_0x7a52('0x51')]=qs['filters'](_[_0x7a52('0x52')](_0xdbd300[_0x7a52('0x47')],_0x36d316['filters']),_0x54f706);if(_0xdbd300['query']['filter']){_0x1b2c5c[_0x7a52('0x51')]=_[_0x7a52('0x53')](_0x1b2c5c[_0x7a52('0x51')],{'$or':_[_0x7a52('0x43')](_0x54f706,function(_0x2d2a5d){if(_0x2d2a5d['type']!==_0x7a52('0x54')){var _0x711461={};_0x711461[_0x2d2a5d[_0x7a52('0x3f')]]={'$like':'%'+_0xdbd300[_0x7a52('0x47')][_0x7a52('0x55')]+'%'};return _0x711461;}})});}_0x1b2c5c=_[_0x7a52('0x53')]({},_0x1b2c5c,_0xdbd300[_0x7a52('0x56')]);var _0x43c979={'where':_0x1b2c5c['where']};return db[_0x7a52('0x44')]['count'](_0x43c979)[_0x7a52('0x23')](function(_0x2cae55){_0x5091cd[_0x7a52('0x34')]=_0x2cae55;if(_0xdbd300[_0x7a52('0x47')][_0x7a52('0x57')]){_0x1b2c5c[_0x7a52('0x58')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x1b2c5c);})[_0x7a52('0x23')](function(_0x1d804d){_0x5091cd[_0x7a52('0x59')]=_0x1d804d;return _0x5091cd;})['then'](respondWithFilteredResult(_0x3fd40a,_0x1b2c5c))[_0x7a52('0x2e')](handleError(_0x3fd40a,null));};exports[_0x7a52('0x5a')]=function(_0x220a45,_0x414a5d){var _0x1aca82={'raw':![],'where':{'id':_0x220a45[_0x7a52('0x5b')]['id']},'include':[{'model':db[_0x7a52('0x42')],'as':_0x7a52('0x5c')}]},_0x172b34={};_0x172b34[_0x7a52('0x4b')]=_[_0x7a52('0x48')](db[_0x7a52('0x44')]['rawAttributes']);_0x172b34[_0x7a52('0x47')]=_['keys'](_0x220a45['query']);_0x172b34[_0x7a52('0x49')]=_[_0x7a52('0x4a')](_0x172b34[_0x7a52('0x4b')],_0x172b34[_0x7a52('0x47')]);_0x1aca82[_0x7a52('0x4c')]=_['intersection'](_0x172b34[_0x7a52('0x4b')],qs['fields'](_0x220a45['query']['fields']));_0x1aca82[_0x7a52('0x4c')]=_0x1aca82['attributes']['length']?_0x1aca82[_0x7a52('0x4c')]:_0x172b34[_0x7a52('0x4b')];if(_0x220a45['query'][_0x7a52('0x57')]){_0x1aca82[_0x7a52('0x58')]=[{'all':!![]}];}_0x1aca82=_[_0x7a52('0x53')]({},_0x1aca82,_0x220a45['options']);return db[_0x7a52('0x44')]['find'](_0x1aca82)[_0x7a52('0x23')](handleEntityNotFound(_0x414a5d,null))[_0x7a52('0x23')](respondWithResult(_0x414a5d,null))['catch'](handleError(_0x414a5d,null));};exports[_0x7a52('0x5d')]=function(_0x51df3e,_0x1defb4){return db['SmsAccount'][_0x7a52('0x5d')](_0x51df3e['body'],{})['then'](function(_0x2a69c2){var _0x44a015=_0x51df3e[_0x7a52('0x5e')][_0x7a52('0x3b')]({'plain':!![]});if(!_0x44a015)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x44a015[_0x7a52('0x5f')]===_0x7a52('0x5e')){var _0x495e60=_0x2a69c2[_0x7a52('0x3b')]({'plain':!![]});var _0x4300d2=_0x7a52('0x3c');return db[_0x7a52('0x60')]['find']({'where':{'name':_0x4300d2,'userProfileId':_0x44a015[_0x7a52('0x61')]},'raw':!![]})[_0x7a52('0x23')](function(_0x5b23da){if(_0x5b23da&&_0x5b23da[_0x7a52('0x62')]===0x0){return db[_0x7a52('0x63')][_0x7a52('0x5d')]({'name':_0x495e60[_0x7a52('0x3f')],'resourceId':_0x495e60['id'],'type':_0x5b23da['name'],'sectionId':_0x5b23da['id']},{})[_0x7a52('0x23')](function(){return _0x2a69c2;});}else{return _0x2a69c2;}})[_0x7a52('0x2e')](function(_0x4647b1){logger[_0x7a52('0x2a')](_0x7a52('0x64'),_0x4647b1);throw _0x4647b1;});}return _0x2a69c2;})['then'](respondWithResult(_0x1defb4,0xc9))[_0x7a52('0x2e')](handleError(_0x1defb4,null));};exports[_0x7a52('0x65')]=function(_0x4a5580,_0x5d23e3){if(_0x4a5580['body']['id']){delete _0x4a5580[_0x7a52('0x66')]['id'];}return db[_0x7a52('0x44')][_0x7a52('0x67')]({'where':{'id':_0x4a5580[_0x7a52('0x5b')]['id']},'include':[{'model':db[_0x7a52('0x42')],'as':_0x7a52('0x5c')}]})[_0x7a52('0x23')](handleEntityNotFound(_0x5d23e3,null))[_0x7a52('0x23')](saveUpdates(_0x4a5580[_0x7a52('0x66')],null))[_0x7a52('0x23')](respondWithResult(_0x5d23e3,null))[_0x7a52('0x2e')](handleError(_0x5d23e3,null));};exports['destroy']=function(_0x4fa0e3,_0x5ae81a){return db[_0x7a52('0x44')][_0x7a52('0x67')]({'where':{'id':_0x4fa0e3[_0x7a52('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5ae81a,null))[_0x7a52('0x23')](removeEntity(_0x5ae81a,null))[_0x7a52('0x2e')](handleError(_0x5ae81a,null));};exports[_0x7a52('0x68')]=function(_0x25396e,_0x1744d8){return db[_0x7a52('0x44')][_0x7a52('0x68')]()[_0x7a52('0x23')](respondWithResult(_0x1744d8,null))['catch'](handleError(_0x1744d8,null));};exports[_0x7a52('0x69')]=function(_0x129799,_0x3ad58c,_0x216faf){if(_0x129799[_0x7a52('0x66')]['id']){delete _0x129799['body']['id'];}return db[_0x7a52('0x44')]['find']({'where':{'id':_0x129799[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x3ad58c,null))[_0x7a52('0x23')](function(_0x25ddd4){if(_0x25ddd4){_0x129799['body'][_0x7a52('0x6a')]=_0x25ddd4['id'];return db[_0x7a52('0x6b')][_0x7a52('0x5d')](_0x129799[_0x7a52('0x66')]);}})[_0x7a52('0x23')](respondWithResult(_0x3ad58c,null))[_0x7a52('0x2e')](handleError(_0x3ad58c,null));};exports['getDispositions']=function(_0x57a6c3,_0x2d452f,_0x5993d4){var _0x122d37={'raw':![],'where':{}};var _0x5ce65e={};var _0x409e95={'count':0x0,'rows':[]};return db['SmsAccount']['findOne']({'where':{'id':_0x57a6c3['params']['id']}})['then'](handleEntityNotFound(_0x2d452f,null))[_0x7a52('0x23')](function(_0x221aa5){if(_0x221aa5){_0x5ce65e[_0x7a52('0x4b')]=_['keys'](db[_0x7a52('0x6b')][_0x7a52('0x6c')]);_0x5ce65e['query']=_[_0x7a52('0x48')](_0x57a6c3[_0x7a52('0x47')]);_0x5ce65e[_0x7a52('0x49')]=_[_0x7a52('0x4a')](_0x5ce65e['model'],_0x5ce65e['query']);_0x122d37[_0x7a52('0x4c')]=_[_0x7a52('0x4a')](_0x5ce65e[_0x7a52('0x4b')],qs[_0x7a52('0x6d')](_0x57a6c3[_0x7a52('0x47')]['fields']));_0x122d37[_0x7a52('0x4c')]=_0x122d37['attributes']['length']?_0x122d37['attributes']:_0x5ce65e['model'];if(!_0x57a6c3[_0x7a52('0x47')][_0x7a52('0x4e')](_0x7a52('0x4f'))){_0x122d37['limit']=qs[_0x7a52('0x33')](_0x57a6c3[_0x7a52('0x47')][_0x7a52('0x33')]);_0x122d37[_0x7a52('0x31')]=qs[_0x7a52('0x31')](_0x57a6c3[_0x7a52('0x47')][_0x7a52('0x31')]);}_0x122d37['order']=qs[_0x7a52('0x50')](_0x57a6c3[_0x7a52('0x47')][_0x7a52('0x50')]);_0x122d37['where']=qs[_0x7a52('0x49')](_[_0x7a52('0x52')](_0x57a6c3['query'],_0x5ce65e[_0x7a52('0x49')]));_0x122d37['where'][_0x7a52('0x6a')]=_0x221aa5['id'];if(_0x57a6c3[_0x7a52('0x47')][_0x7a52('0x55')]){_0x122d37[_0x7a52('0x51')]=_['merge'](_0x122d37['where'],{'$or':_[_0x7a52('0x43')](_0x122d37[_0x7a52('0x4c')],function(_0x19815){var _0x218e30={};_0x218e30[_0x19815]={'$like':'%'+_0x57a6c3['query'][_0x7a52('0x55')]+'%'};return _0x218e30;})});}_0x122d37=_['merge']({},_0x122d37,_0x57a6c3['options']);return db['Disposition'][_0x7a52('0x34')]({'where':_0x122d37[_0x7a52('0x51')]})[_0x7a52('0x23')](function(_0x2f4d38){_0x409e95['count']=_0x2f4d38;if(_0x57a6c3[_0x7a52('0x47')]['includeAll']){_0x122d37[_0x7a52('0x58')]=[{'all':!![]}];}return db[_0x7a52('0x6b')][_0x7a52('0x6e')](_0x122d37);})[_0x7a52('0x23')](function(_0x1817e1){_0x409e95[_0x7a52('0x59')]=_0x1817e1;return _0x409e95;});}})[_0x7a52('0x23')](respondWithFilteredResult(_0x2d452f,_0x122d37))[_0x7a52('0x2e')](handleError(_0x2d452f,null));};exports[_0x7a52('0x6f')]=function(_0x2330a8,_0x46266f,_0x3f86e8){return db[_0x7a52('0x44')]['find']({'where':{'id':_0x2330a8['params']['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x46266f,null))[_0x7a52('0x23')](function(_0x3fb532){if(_0x3fb532){return _0x3fb532[_0x7a52('0x6f')](_0x2330a8['query'][_0x7a52('0x70')]);}})['then'](respondWithStatusCode(_0x46266f,null))[_0x7a52('0x2e')](handleError(_0x46266f,null));};exports[_0x7a52('0x71')]=function(_0x48bc59,_0x35fb1e,_0x26991f){if(_0x48bc59[_0x7a52('0x66')]['id']){delete _0x48bc59[_0x7a52('0x66')]['id'];}return db[_0x7a52('0x44')][_0x7a52('0x67')]({'where':{'id':_0x48bc59[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x35fb1e,null))[_0x7a52('0x23')](function(_0x43f3ba){if(_0x43f3ba){_0x48bc59['body'][_0x7a52('0x6a')]=_0x43f3ba['id'];return db[_0x7a52('0x72')]['create'](_0x48bc59[_0x7a52('0x66')]);}})[_0x7a52('0x23')](respondWithResult(_0x35fb1e,null))[_0x7a52('0x2e')](handleError(_0x35fb1e,null));};exports[_0x7a52('0x73')]=function(_0x14d3f7,_0x2e25f8,_0xc15a9a){var _0x1c4c3b={'raw':![],'where':{}};var _0xe2a62d={};var _0x993ee7={'count':0x0,'rows':[]};return db[_0x7a52('0x44')]['findOne']({'where':{'id':_0x14d3f7[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x2e25f8,null))[_0x7a52('0x23')](function(_0x53f909){if(_0x53f909){_0xe2a62d[_0x7a52('0x4b')]=_[_0x7a52('0x48')](db[_0x7a52('0x72')][_0x7a52('0x6c')]);_0xe2a62d['query']=_[_0x7a52('0x48')](_0x14d3f7[_0x7a52('0x47')]);_0xe2a62d[_0x7a52('0x49')]=_[_0x7a52('0x4a')](_0xe2a62d[_0x7a52('0x4b')],_0xe2a62d[_0x7a52('0x47')]);_0x1c4c3b['attributes']=_[_0x7a52('0x4a')](_0xe2a62d['model'],qs[_0x7a52('0x6d')](_0x14d3f7['query'][_0x7a52('0x6d')]));_0x1c4c3b[_0x7a52('0x4c')]=_0x1c4c3b[_0x7a52('0x4c')]['length']?_0x1c4c3b[_0x7a52('0x4c')]:_0xe2a62d[_0x7a52('0x4b')];if(!_0x14d3f7['query'][_0x7a52('0x4e')](_0x7a52('0x4f'))){_0x1c4c3b[_0x7a52('0x33')]=qs['limit'](_0x14d3f7['query'][_0x7a52('0x33')]);_0x1c4c3b[_0x7a52('0x31')]=qs['offset'](_0x14d3f7[_0x7a52('0x47')][_0x7a52('0x31')]);}_0x1c4c3b['order']=qs['sort'](_0x14d3f7[_0x7a52('0x47')]['sort']);_0x1c4c3b[_0x7a52('0x51')]=qs[_0x7a52('0x49')](_[_0x7a52('0x52')](_0x14d3f7['query'],_0xe2a62d[_0x7a52('0x49')]));_0x1c4c3b[_0x7a52('0x51')][_0x7a52('0x6a')]=_0x53f909['id'];if(_0x14d3f7[_0x7a52('0x47')][_0x7a52('0x55')]){_0x1c4c3b[_0x7a52('0x51')]=_[_0x7a52('0x53')](_0x1c4c3b['where'],{'$or':_[_0x7a52('0x43')](_0x1c4c3b[_0x7a52('0x4c')],function(_0x351968){var _0xe95443={};_0xe95443[_0x351968]={'$like':'%'+_0x14d3f7[_0x7a52('0x47')][_0x7a52('0x55')]+'%'};return _0xe95443;})});}_0x1c4c3b=_[_0x7a52('0x53')]({},_0x1c4c3b,_0x14d3f7[_0x7a52('0x56')]);return db[_0x7a52('0x72')]['count']({'where':_0x1c4c3b[_0x7a52('0x51')]})[_0x7a52('0x23')](function(_0x3f4376){_0x993ee7[_0x7a52('0x34')]=_0x3f4376;if(_0x14d3f7[_0x7a52('0x47')][_0x7a52('0x57')]){_0x1c4c3b[_0x7a52('0x58')]=[{'all':!![]}];}return db[_0x7a52('0x72')][_0x7a52('0x6e')](_0x1c4c3b);})[_0x7a52('0x23')](function(_0x27ddc4){_0x993ee7[_0x7a52('0x59')]=_0x27ddc4;return _0x993ee7;});}})['then'](respondWithFilteredResult(_0x2e25f8,_0x1c4c3b))[_0x7a52('0x2e')](handleError(_0x2e25f8,null));};exports[_0x7a52('0x74')]=function(_0x537c4b,_0x2bab95,_0x2beb7e){return db['SmsAccount'][_0x7a52('0x67')]({'where':{'id':_0x537c4b['params']['id']}})['then'](handleEntityNotFound(_0x2bab95,null))['then'](function(_0x560a8d){if(_0x560a8d){return _0x560a8d[_0x7a52('0x74')](_0x537c4b[_0x7a52('0x47')][_0x7a52('0x70')]);}})[_0x7a52('0x23')](respondWithStatusCode(_0x2bab95,null))['catch'](handleError(_0x2bab95,null));};exports[_0x7a52('0x75')]=function(_0x3a9b44,_0x3d408f,_0x125133){var _0x4fd080={'channel':_0x7a52('0x76')};var _0x5c0766=[];var _0x4b3d7e=[];var _0x4762ad={};return db[_0x7a52('0x44')]['find']({'where':{'id':_0x3a9b44[_0x7a52('0x5b')]['id']},'include':[{'model':db[_0x7a52('0x77')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x3d408f,null))[_0x7a52('0x23')](function(_0x459035){_0x4fd080[_0x7a52('0x78')]=_0x459035;_0x4fd080[_0x7a52('0x79')]=_['orderBy'](_0x459035[_0x7a52('0x7a')],['priority'],[_0x7a52('0x7b')]);if(_0x4fd080[_0x7a52('0x78')][_0x7a52('0x7a')]){delete _0x4fd080[_0x7a52('0x78')][_0x7a52('0x7a')];}return db[_0x7a52('0x7c')][_0x7a52('0x68')]();})['then'](function(_0x1ae5d4){if(!_0x1ae5d4){throw new db['Sequelize'][(_0x7a52('0x7d'))](_0x7a52('0x7e'));}_0x5c0766=_[_0x7a52('0x7f')](_[_0x7a52('0x48')](_0x1ae5d4),['createdAt','updatedAt']);_0x4b3d7e=_[_0x7a52('0x7f')](_[_0x7a52('0x48')](_0x1ae5d4),[_0x7a52('0x80'),_0x7a52('0x81'),_0x7a52('0x82'),'ListId']);_0x4fd080[_0x7a52('0x66')]={'mapKey':_0x7a52('0x83')};if(_0x4fd080[_0x7a52('0x78')][_0x7a52('0x45')]){switch(_0x4fd080['account'][_0x7a52('0x45')]){case _0x7a52('0x84'):_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')]=_0x3a9b44['body']['From'];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x86')];_0x4fd080['body'][_0x7a52('0x87')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x88')];break;case _0x7a52('0x89'):_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')]='+'+_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x8a')];_0x4fd080[_0x7a52('0x66')]['body']=_0x3a9b44['body'][_0x7a52('0x8b')];break;case'connectel':_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x85')];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')]=_0x3a9b44[_0x7a52('0x66')]['message'];break;case _0x7a52('0x8c'):_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x85')];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')]=_0x3a9b44[_0x7a52('0x66')]['body'];_0x4fd080['body'][_0x7a52('0x87')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x8d')];break;case _0x7a52('0x8e'):_0x4fd080['body']['from']=_0x3a9b44[_0x7a52('0x66')]['From'];_0x4fd080['body']['body']=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x8f')];_0x4fd080[_0x7a52('0x66')]['messageId']=_0x3a9b44[_0x7a52('0x66')]['MessageUUID'];break;case _0x7a52('0x90'):_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')]='+'+_0x3a9b44['body'][_0x7a52('0x91')][0x0][_0x7a52('0x85')];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x91')][0x0][_0x7a52('0x8b')];_0x4fd080['body'][_0x7a52('0x87')]=_0x3a9b44['body']['results'][0x0]['messageId'];break;case _0x7a52('0x92'):_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x93')];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')]=_0x3a9b44[_0x7a52('0x66')]['segmentedMessage'][_0x7a52('0x2c')];break;case _0x7a52('0x94'):_0x4fd080['body'][_0x7a52('0x85')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x95')];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x8b')];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x87')]=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x96')];break;case'bandwidth':_0x4fd080['body'][_0x7a52('0x87')]=_0x3a9b44[_0x7a52('0x66')][0x0][_0x7a52('0x2c')]['id'];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')]=_0x3a9b44[_0x7a52('0x66')][0x0][_0x7a52('0x2c')][_0x7a52('0x85')];_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')]=_0x3a9b44[_0x7a52('0x66')][0x0][_0x7a52('0x2c')][_0x7a52('0x8b')];break;case _0x7a52('0x97'):_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')]=_0x3a9b44['body'][_0x7a52('0x85')];_0x4fd080['body']['body']=_0x3a9b44[_0x7a52('0x66')]['message'];_0x4fd080[_0x7a52('0x66')]['messageId']=_0x3a9b44[_0x7a52('0x66')][_0x7a52('0x98')];break;}}if(_0x4fd080['body']['id']){delete _0x4fd080['body']['id'];}if(_['isNil'](_0x4fd080['body'][_0x7a52('0x85')])){throw new db[(_0x7a52('0x99'))][(_0x7a52('0x7d'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')])||_0x4fd080[_0x7a52('0x66')][_0x7a52('0x66')]===''){throw new db[(_0x7a52('0x99'))][(_0x7a52('0x7d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7a52('0x9a')](_0x4fd080[_0x7a52('0x66')][_0x7a52('0x9b')])){throw new db['Sequelize'][(_0x7a52('0x7d'))](_0x7a52('0x9c')+_0x4b3d7e);}if(!_[_0x7a52('0x9d')](_0x4b3d7e,_0x4fd080[_0x7a52('0x66')]['mapKey'])){throw new db['Sequelize'][(_0x7a52('0x7d'))](_0x7a52('0x9e')+_0x4b3d7e);}_0x4762ad[_0x4fd080[_0x7a52('0x66')][_0x7a52('0x9b')]]=_0x4fd080['body']['from'];return db[_0x7a52('0x9f')][_0x7a52('0x67')]({'where':{'id':_0x4fd080[_0x7a52('0x78')][_0x7a52('0xa0')]},'include':[{'model':db[_0x7a52('0x7c')],'as':_0x7a52('0xa1'),'where':_0x4762ad,'limit':0x1,'order':[[_0x7a52('0x81'),_0x7a52('0xa2')]]}]});})[_0x7a52('0x23')](handleEntityNotFound(_0x3d408f,null))[_0x7a52('0x23')](function(_0x390b13){if(_0x390b13){_0x4fd080['list']=_[_0x7a52('0xa3')](_0x390b13,[_0x7a52('0xa1')]);if(_0x390b13[_0x7a52('0xa1')]['length']){return _0x390b13['Contacts'][0x0];}var _0x452049=_[_0x7a52('0x1b')](_0x4fd080[_0x7a52('0x66')],{'firstName':_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')],'ListId':_0x390b13['id']});_0x452049[_0x4fd080[_0x7a52('0x66')][_0x7a52('0x9b')]]=_0x4fd080['body'][_0x7a52('0x85')];return db[_0x7a52('0x7c')][_0x7a52('0x5d')](_0x452049,{'fields':_0x5c0766,'raw':!![]});}})['then'](handleEntityNotFound(_0x3d408f,null))[_0x7a52('0x23')](function(_0xc1f023){if(_0xc1f023){_0x4fd080['contact']=_0xc1f023;var _0x61b54c={'ContactId':_0xc1f023['id'],'phone':_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')],'SmsAccountId':_0x3a9b44[_0x7a52('0x5b')]['id']};var _0x1dd3d8={'ContactId':_0xc1f023['id'],'SmsAccountId':_0x3a9b44[_0x7a52('0x5b')]['id'],'closed':![]};return db[_0x7a52('0xa4')][_0x7a52('0x67')]({'where':_0x1dd3d8})[_0x7a52('0x23')](function(_0x4a304b){if(_0x4a304b){return[_0x4a304b,![]];}return db['SmsInteraction']['create'](_0x61b54c)[_0x7a52('0x23')](function(_0x49513a){return[_0x49513a,!![]];});});}})[_0x7a52('0xa5')](function(_0x125423,_0x492c4c){_0x4fd080[_0x7a52('0xa6')]=_0x125423[_0x7a52('0x3b')]({'plain':!![]});_0x4fd080['interaction'][_0x7a52('0xa7')]=![];if(_0x492c4c){if(_0x4fd080[_0x7a52('0x78')][_0x7a52('0xa8')]){_0x4fd080['applications'][_0x7a52('0xa9')]({'id':0x0,'priority':_0x4fd080['applications'][_0x7a52('0x4d')]+0x1,'app':_0x7a52('0xaa'),'appdata':_0x7a52('0xab'),'interval':_0x7a52('0xac')});}_0x4fd080[_0x7a52('0xa6')]['created']=!![];}return db['SmsMessage'][_0x7a52('0x5d')]({'phone':_0x4fd080[_0x7a52('0x66')][_0x7a52('0x85')],'messageId':_0x4fd080[_0x7a52('0x66')][_0x7a52('0x87')],'body':_0x4fd080['body']['body'],'SmsAccountId':_0x3a9b44['params']['id'],'SmsInteractionId':_0x125423['id'],'direction':'in','ContactId':_0x125423[_0x7a52('0xad')],'AttachmentId':_0x4fd080['body'][_0x7a52('0xae')]});})['then'](function(_0x2f6a42){_0x4fd080[_0x7a52('0x2c')]=_0x2f6a42;if(!_0x4fd080[_0x7a52('0xa6')][_0x7a52('0xaf')])return;return db['User']['find']({'attributes':['id','name'],'where':{'id':_0x4fd080['interaction']['UserId']}});})[_0x7a52('0x23')](function(_0x2e2cbf){if(_0x2e2cbf){_0x4fd080[_0x7a52('0x79')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x2e2cbf['name']+','+(_0x4fd080['account'][_0x7a52('0xb0')]||0xa),'interval':_0x7a52('0xac')});}if(!_0x4fd080[_0x7a52('0xa6')][_0x7a52('0xb1')])return;return db['SmsQueue']['find']({'attributes':['id',_0x7a52('0x3f')],'where':{'id':_0x4fd080[_0x7a52('0xa6')][_0x7a52('0xb1')]}});})['then'](function(_0x509494){if(_0x509494){_0x4fd080[_0x7a52('0x79')][_0x7a52('0xb2')]({'id':0x0,'priority':0x1,'app':_0x7a52('0xb3'),'appdata':_0x509494[_0x7a52('0x3f')]+','+(_0x4fd080[_0x7a52('0x78')][_0x7a52('0xb4')]||0x12c),'interval':_0x7a52('0xac')});}return respondWithRpcPromise(_0x7a52('0xb5'),'startRouting',_0x4fd080);})['then'](function(_0x161606){if(_0x161606){var _0x1738d6=0xc8;var _0x73ad83='receiveMessage';logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x73ad83,_0x1738d6,'entity\x20found');logger[_0x7a52('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x73ad83,_0x1738d6,_0x7a52('0xb6'),JSON[_0x7a52('0x29')](_0x161606));if(_0x4fd080['account'][_0x7a52('0x45')]===_0x7a52('0x84')){return _0x3d408f['status'](_0x1738d6)[_0x7a52('0x35')]('Content-Type',_0x7a52('0xb7'))['send'](_0x7a52('0xb8'));}else{return _0x3d408f['status'](_0x1738d6)[_0x7a52('0x37')](_0x161606);}}})[_0x7a52('0x2e')](handleError(_0x3d408f,null));};exports[_0x7a52('0xb9')]=function(_0x3c04fd,_0x247c81){var _0x508a81=_0x3c04fd[_0x7a52('0x5b')]['id'];var _0x3aa3fc=_0x3c04fd['body'];var _0x45cd95=0xc8;var _0x536f4f=null;return db[_0x7a52('0xba')][_0x7a52('0xbb')]({'isolationLevel':db[_0x7a52('0xba')][_0x7a52('0xbc')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x13eb45){return db[_0x7a52('0x44')][_0x7a52('0xbd')]({'where':{'id':_0x508a81},'transaction':_0x13eb45})[_0x7a52('0x23')](function(_0x171c84){if(_0x171c84){return db[_0x7a52('0x77')][_0x7a52('0x3a')]({'where':{'SmsAccountId':_0x508a81},'transaction':_0x13eb45})[_0x7a52('0x23')](function(){var _0x932e92=_[_0x7a52('0x43')](_0x3aa3fc,function(_0x4b61b1){_0x4b61b1[_0x7a52('0x6a')]=_0x508a81;return _0x4b61b1;});return db[_0x7a52('0x77')]['bulkCreate'](_0x932e92,{'transaction':_0x13eb45});});}else{_0x45cd95=0x194;_0x536f4f=[];}});})[_0x7a52('0x23')](function(){if(_0x45cd95!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x508a81},'order':_0x7a52('0xbe')})['then'](function(_0x5b6354){_0x536f4f=_0x5b6354;});}})['catch'](function(_0x26ccb9){_0x45cd95=0x1f4;logger[_0x7a52('0x2a')](_0x26ccb9[_0x7a52('0x3e')]);if(_0x26ccb9[_0x7a52('0x3f')]){delete _0x26ccb9[_0x7a52('0x3f')];}_0x536f4f=_0x26ccb9;})[_0x7a52('0xbf')](function(){if(_0x536f4f===null){_0x247c81[_0x7a52('0x2f')](_0x45cd95);}else{if(_0x45cd95===0x1f4){_0x247c81[_0x7a52('0x30')](_0x45cd95)[_0x7a52('0x40')](_0x536f4f);}else{_0x247c81[_0x7a52('0x30')](_0x45cd95)[_0x7a52('0x37')](_0x536f4f);}}});};exports[_0x7a52('0xc0')]=function(_0x593904,_0xa1710b,_0x187ef6){var _0xac04e6={};var _0x369c97={};var _0x721d56;var _0x5affd5;return db['SmsAccount'][_0x7a52('0xbd')]({'where':{'id':_0x593904[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0xa1710b,null))[_0x7a52('0x23')](function(_0x20b3db){if(_0x20b3db){_0x721d56=_0x20b3db;_0x369c97[_0x7a52('0x4b')]=_[_0x7a52('0x48')](db[_0x7a52('0x77')]['rawAttributes']);_0x369c97[_0x7a52('0x47')]=_[_0x7a52('0x48')](_0x593904[_0x7a52('0x47')]);_0x369c97[_0x7a52('0x49')]=_[_0x7a52('0x4a')](_0x369c97[_0x7a52('0x4b')],_0x369c97['query']);_0xac04e6['attributes']=_['intersection'](_0x369c97[_0x7a52('0x4b')],qs[_0x7a52('0x6d')](_0x593904[_0x7a52('0x47')][_0x7a52('0x6d')]));_0xac04e6[_0x7a52('0x4c')]=_0xac04e6[_0x7a52('0x4c')]['length']?_0xac04e6[_0x7a52('0x4c')]:_0x369c97[_0x7a52('0x4b')];_0xac04e6[_0x7a52('0xc1')]=qs[_0x7a52('0x50')](_0x593904['query'][_0x7a52('0x50')]);_0xac04e6[_0x7a52('0x51')]=qs['filters'](_[_0x7a52('0x52')](_0x593904[_0x7a52('0x47')],_0x369c97[_0x7a52('0x49')]));if(_0x593904[_0x7a52('0x47')]['filter']){_0xac04e6[_0x7a52('0x51')]=_['merge'](_0xac04e6[_0x7a52('0x51')],{'$or':_[_0x7a52('0x43')](_0xac04e6[_0x7a52('0x4c')],function(_0x585a5b){var _0x1554aa={};_0x1554aa[_0x585a5b]={'$like':'%'+_0x593904[_0x7a52('0x47')]['filter']+'%'};return _0x1554aa;})});}_0xac04e6=_[_0x7a52('0x53')]({},_0xac04e6,_0x593904['options']);return _0x721d56[_0x7a52('0xc0')](_0xac04e6);}})[_0x7a52('0x23')](function(_0x1fdda4){if(_0x1fdda4){_0x5affd5=_0x1fdda4[_0x7a52('0x4d')];if(!_0x593904[_0x7a52('0x47')][_0x7a52('0x4e')](_0x7a52('0x4f'))){_0xac04e6[_0x7a52('0x33')]=qs[_0x7a52('0x33')](_0x593904['query'][_0x7a52('0x33')]);_0xac04e6[_0x7a52('0x31')]=qs[_0x7a52('0x31')](_0x593904[_0x7a52('0x47')][_0x7a52('0x31')]);}return _0x721d56[_0x7a52('0xc0')](_0xac04e6);}})['then'](function(_0x1cde66){if(_0x1cde66){return _0x1cde66?{'count':_0x5affd5,'rows':_0x1cde66}:null;}})[_0x7a52('0x23')](respondWithResult(_0xa1710b,null))[_0x7a52('0x2e')](handleError(_0xa1710b,null));};exports[_0x7a52('0xc2')]=function(_0xdd1c05,_0x1c9549,_0x444d0f){var _0x5832e9={'raw':![],'where':{}};var _0x387165={};var _0x4324be={'count':0x0,'rows':[]};return db['SmsAccount'][_0x7a52('0xbd')]({'where':{'id':_0xdd1c05[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x1c9549,null))[_0x7a52('0x23')](function(_0x215537){if(_0x215537){_0x387165[_0x7a52('0x4b')]=_[_0x7a52('0x48')](db[_0x7a52('0xa4')]['rawAttributes']);_0x387165[_0x7a52('0x47')]=_[_0x7a52('0x48')](_0xdd1c05[_0x7a52('0x47')]);_0x387165[_0x7a52('0x49')]=_[_0x7a52('0x4a')](_0x387165[_0x7a52('0x4b')],_0x387165[_0x7a52('0x47')]);_0x5832e9[_0x7a52('0x4c')]=_['intersection'](_0x387165[_0x7a52('0x4b')],qs[_0x7a52('0x6d')](_0xdd1c05[_0x7a52('0x47')][_0x7a52('0x6d')]));_0x5832e9[_0x7a52('0x4c')]=_0x5832e9['attributes'][_0x7a52('0x4d')]?_0x5832e9['attributes']:_0x387165[_0x7a52('0x4b')];if(!_0xdd1c05[_0x7a52('0x47')][_0x7a52('0x4e')](_0x7a52('0x4f'))){_0x5832e9[_0x7a52('0x33')]=qs[_0x7a52('0x33')](_0xdd1c05[_0x7a52('0x47')][_0x7a52('0x33')]);_0x5832e9[_0x7a52('0x31')]=qs[_0x7a52('0x31')](_0xdd1c05[_0x7a52('0x47')]['offset']);}_0x5832e9['order']=qs[_0x7a52('0x50')](_0xdd1c05[_0x7a52('0x47')][_0x7a52('0x50')]);_0x5832e9['where']=qs[_0x7a52('0x49')](_[_0x7a52('0x52')](_0xdd1c05[_0x7a52('0x47')],_0x387165['filters']));_0x5832e9[_0x7a52('0x51')]['SmsAccountId']=_0x215537['id'];if(_0xdd1c05['query'][_0x7a52('0x55')]){_0x5832e9['where']=_[_0x7a52('0x53')](_0x5832e9['where'],{'$or':_[_0x7a52('0x43')](_0x5832e9['attributes'],function(_0x26a90c){var _0x3c31ed={};_0x3c31ed[_0x26a90c]={'$like':'%'+_0xdd1c05[_0x7a52('0x47')][_0x7a52('0x55')]+'%'};return _0x3c31ed;})});}_0x5832e9=_[_0x7a52('0x53')]({},_0x5832e9,_0xdd1c05['options']);return db[_0x7a52('0xa4')]['count']({'where':_0x5832e9['where']})[_0x7a52('0x23')](function(_0x60ca27){_0x4324be[_0x7a52('0x34')]=_0x60ca27;if(_0xdd1c05[_0x7a52('0x47')][_0x7a52('0x57')]){_0x5832e9[_0x7a52('0x58')]=[{'model':db[_0x7a52('0x7c')],'as':'Contact','required':![]},{'model':db[_0x7a52('0xc3')],'as':_0x7a52('0xc4'),'attributes':['name',_0x7a52('0xc5'),_0x7a52('0xc6')],'required':![]},{'model':db['Tag'],'as':_0x7a52('0xc7'),'attributes':['id',_0x7a52('0x3f'),_0x7a52('0xc8')],'where':_0xdd1c05[_0x7a52('0x47')][_0x7a52('0xc9')]?{'id':_0xdd1c05[_0x7a52('0x47')][_0x7a52('0xc9')]}:undefined,'required':_0xdd1c05['query'][_0x7a52('0xc9')]?!![]:![]}];}return db['SmsInteraction'][_0x7a52('0x6e')](_0x5832e9);})[_0x7a52('0x23')](function(_0x3b89db){_0x4324be['rows']=_0x3b89db;return _0x4324be;});}})[_0x7a52('0x23')](respondWithFilteredResult(_0x1c9549,_0x5832e9))[_0x7a52('0x2e')](handleError(_0x1c9549,null));};exports[_0x7a52('0x40')]=function(_0x56f391,_0x15556b,_0x23c86b){var _0x349f2a,_0x2d0d7c,_0x5c141d;if(_[_0x7a52('0x9a')](_0x56f391['body'][_0x7a52('0x66')])||_0x56f391[_0x7a52('0x66')][_0x7a52('0x66')]===''){throw new db[(_0x7a52('0x99'))][(_0x7a52('0x7d'))](_0x7a52('0xca'));}if(_[_0x7a52('0x9a')](_0x56f391['body']['to'])){throw new db[(_0x7a52('0x99'))][(_0x7a52('0x7d'))](_0x7a52('0xcb'));}_0x349f2a=_0x56f391[_0x7a52('0x66')]['to'];return db[_0x7a52('0x44')][_0x7a52('0x67')]({'where':{'id':_0x56f391['params']['id']},'include':[{'model':db[_0x7a52('0x9f')],'as':_0x7a52('0xcc'),'include':[{'model':db['CmContact'],'as':_0x7a52('0xa1'),'where':{'mobile':_0x349f2a},'limit':0x1,'order':[['updatedAt',_0x7a52('0xa2')]]}]}]})[_0x7a52('0x23')](handleEntityNotFound(_0x15556b,null))[_0x7a52('0x23')](function(_0x405089){if(_0x405089&&_0x405089[_0x7a52('0xcc')]){_0x2d0d7c=_0x405089[_0x7a52('0x3b')]({'plain':!![]});if(_0x2d0d7c[_0x7a52('0xcc')]&&_0x2d0d7c[_0x7a52('0xcc')]['Contacts'][_0x7a52('0x4d')]){return _0x2d0d7c['List']['Contacts'][0x0];}return db[_0x7a52('0x7c')][_0x7a52('0x5d')](_[_0x7a52('0x1b')](_0x56f391[_0x7a52('0x66')],{'firstName':_0x349f2a,'mobile':_0x349f2a,'phone':_0x349f2a,'ListId':_0x2d0d7c[_0x7a52('0xa0')]}));}})['then'](handleEntityNotFound(_0x15556b,null))[_0x7a52('0x23')](function(_0x39292b){if(_0x39292b){_0x5c141d=_0x39292b;return db[_0x7a52('0xa4')][_0x7a52('0x67')]({'where':{'ContactId':_0x5c141d['id'],'closed':![],'SmsAccountId':_0x2d0d7c['id']}})[_0x7a52('0x23')](function(_0x49ec07){if(_0x49ec07){return[_0x49ec07,![]];}return db['SmsInteraction'][_0x7a52('0x5d')]({'UserId':_0x56f391[_0x7a52('0x5e')]['id'],'ContactId':_0x5c141d['id'],'SmsAccountId':_0x2d0d7c['id'],'phone':_0x349f2a,'firstMsgDirection':_0x7a52('0xcd'),'Messages':[_[_0x7a52('0x53')](_0x56f391[_0x7a52('0x66')],{'read':![],'body':_0x56f391[_0x7a52('0x66')][_0x7a52('0x66')],'phone':_0x349f2a,'SmsAccountId':_0x2d0d7c['id'],'UserId':_0x56f391['user']['id'],'ContactId':_0x5c141d['id']})]},{'include':[{'model':db[_0x7a52('0xce')],'as':_0x7a52('0xcf')}]})['then'](function(_0x50f210){return[_0x50f210,!![]];});});}})[_0x7a52('0xa5')](function(_0x1a34ee,_0x1b514e){if(_0x1b514e){return _0x1a34ee;}return db[_0x7a52('0xce')][_0x7a52('0x5d')](_[_0x7a52('0x53')](_0x56f391[_0x7a52('0x66')],{'read':![],'body':_0x56f391[_0x7a52('0x66')][_0x7a52('0x66')],'phone':_0x349f2a,'SmsAccountId':_0x2d0d7c['id'],'SmsInteractionId':_0x1a34ee['id'],'UserId':_0x56f391[_0x7a52('0x5e')]['id'],'ContactId':_0x5c141d['id']}))[_0x7a52('0x23')](function(_0x4e8ab7){_0x1a34ee[_0x7a52('0xd0')][_0x7a52('0xcf')]=[];_0x1a34ee[_0x7a52('0xd0')][_0x7a52('0xcf')][_0x7a52('0xa9')](_0x4e8ab7[_0x7a52('0xd0')]);return _0x1a34ee;});})[_0x7a52('0x23')](respondWithResult(_0x15556b,null))[_0x7a52('0x2e')](handleError(_0x15556b,null));};exports[_0x7a52('0x30')]=function(_0x2a7593,_0x442446,_0x210d71){if(_0x2a7593[_0x7a52('0x66')]['id']){delete _0x2a7593['body']['id'];}var _0x47325d,_0x2e8857,_0x1620e5;return db[_0x7a52('0x44')][_0x7a52('0x67')]({'where':{'id':_0x2a7593[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x442446,null))['then'](function(_0x207d53){if(_0x207d53){_0x1620e5=_0x207d53;logger[_0x7a52('0x27')](_0x7a52('0x28'),_0x7a52('0x30'),_0x7a52('0xd1'),_0x207d53['type'],util['inspect'](_0x2a7593[_0x7a52('0x66')],{'showHidden':![],'depth':null}));switch(_0x207d53[_0x7a52('0x45')]){case'skebby':if(_0x2a7593[_0x7a52('0x66')][_0x7a52('0xd2')]&&_0x2a7593[_0x7a52('0x66')][_0x7a52('0x30')]){_0x2e8857=_0x2a7593[_0x7a52('0x66')]['status'];return db[_0x7a52('0xce')][_0x7a52('0x67')]({'where':{'messageId':_0x2a7593[_0x7a52('0x66')][_0x7a52('0xd2')]}});}break;case _0x7a52('0xd3'):if(_0x2a7593['body'][_0x7a52('0xd4')]&&_0x2a7593[_0x7a52('0x66')]['statusInt']){_0x2e8857=_0x2a7593[_0x7a52('0x66')][_0x7a52('0xd5')];return db[_0x7a52('0xce')]['find']({'where':{'messageId':_0x2a7593[_0x7a52('0x66')]['requestid']}});}break;case _0x7a52('0x8c'):if(_0x2a7593[_0x7a52('0x66')]['message_id']&&_0x2a7593['body'][_0x7a52('0xd6')]){_0x2e8857=_0x2a7593[_0x7a52('0x66')]['status_code'];return db['SmsMessage'][_0x7a52('0x67')]({'where':{'messageId':_0x2a7593['body'][_0x7a52('0x8d')]}});}break;case _0x7a52('0x90'):var _0xd695a1=_0x2a7593[_0x7a52('0x66')][_0x7a52('0x91')][0x0];if(_0xd695a1[_0x7a52('0x87')]&&_0xd695a1[_0x7a52('0x30')][_0x7a52('0xd7')]===_0x7a52('0xd8')){_0x2e8857=_0xd695a1[_0x7a52('0x30')]['groupName'];return db[_0x7a52('0xce')][_0x7a52('0x67')]({'where':{'messageId':_0xd695a1[_0x7a52('0x87')]}});}break;case _0x7a52('0x94'):if(_0x2a7593['body'][_0x7a52('0x87')]&&_0x2a7593[_0x7a52('0x66')][_0x7a52('0x30')]){_0x2e8857=_0x2a7593['body'][_0x7a52('0x30')];return db['SmsMessage']['find']({'where':{'messageId':_0x2a7593[_0x7a52('0x66')][_0x7a52('0x87')]}});}break;case'bandwidth':if(_0x2a7593[_0x7a52('0x66')][0x0][_0x7a52('0x2c')]['id']){_0x2e8857=_0x2a7593['body'][0x0]['type'];return db[_0x7a52('0xce')]['find']({'where':{'messageId':_0x2a7593[_0x7a52('0x66')][0x0][_0x7a52('0x2c')]['id']}});}break;case _0x7a52('0x97'):if(_0x2a7593[_0x7a52('0x66')][_0x7a52('0xd9')]&&_0x2a7593[_0x7a52('0x66')][_0x7a52('0x30')]){_0x2e8857=_0x2a7593[_0x7a52('0x66')]['status'];return db['SmsMessage'][_0x7a52('0x67')]({'where':{'messageId':_0x2a7593['body'][_0x7a52('0xd9')]}});}break;}}})[_0x7a52('0x23')](handleEntityNotFound(_0x442446,null))[_0x7a52('0x23')](function(_0xf8ec7b){if(_0xf8ec7b){_0x47325d=_0xf8ec7b;switch(_0x1620e5['type']){case _0x7a52('0x89'):if(_0x2e8857===_0x7a52('0xd8')){return _0x47325d[_0x7a52('0x65')]({'read':!![]});}else{logger[_0x7a52('0x2a')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7a52('0x89'),util[_0x7a52('0xda')](_0x2a7593[_0x7a52('0x66')],{'showHidden':![],'depth':null}));}break;case _0x7a52('0xd3'):if(_0x2e8857==='1'){return _0x47325d[_0x7a52('0x65')]({'read':!![]});}else{logger[_0x7a52('0x2a')](_0x7a52('0x28'),_0x7a52('0x30'),'skebby',util[_0x7a52('0xda')](_0x2a7593['body'],{'showHidden':![],'depth':null}));}break;case _0x7a52('0x8c'):if(!_0x2a7593[_0x7a52('0x66')][_0x7a52('0xdb')]&&_0x2e8857>=0xc8&&_0x2e8857<=0xce){return _0x47325d['update']({'read':!![]});}else{logger[_0x7a52('0x2a')](_0x7a52('0x28'),_0x7a52('0x30'),_0x7a52('0x8c'),util[_0x7a52('0xda')](_0x2a7593[_0x7a52('0x66')],{'showHidden':![],'depth':null}));}break;case _0x7a52('0x90'):var _0x5be310=_0x2a7593[_0x7a52('0x66')][_0x7a52('0x91')][0x0];if(_0x5be310[_0x7a52('0x30')][_0x7a52('0xd7')]==='DELIVERED'){return _0x47325d[_0x7a52('0x65')]({'read':!![]});}else{logger[_0x7a52('0x2a')](_0x7a52('0x28'),_0x7a52('0x30'),_0x7a52('0x90'),util[_0x7a52('0xda')](_0x2a7593[_0x7a52('0x66')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x2e8857==_0x7a52('0xdc')||_0x2e8857==_0x7a52('0xdd')){return _0x47325d[_0x7a52('0x65')]({'read':!![]});}else{logger[_0x7a52('0x2a')](_0x7a52('0x28'),_0x7a52('0x30'),_0x7a52('0x94'),util[_0x7a52('0xda')](_0x2a7593[_0x7a52('0x66')],{'showHidden':![],'depth':null}));}break;case _0x7a52('0xde'):if(_0x2e8857=='message-delivered'){return _0x47325d[_0x7a52('0x65')]({'read':!![]});}else{logger[_0x7a52('0x2a')](_0x7a52('0x28'),_0x7a52('0x30'),_0x7a52('0xde'),util['inspect'](_0x2a7593['body'],{'showHidden':![],'depth':null}));}break;case _0x7a52('0x97'):if(_0x2e8857===_0x7a52('0xdf')||_0x2e8857===_0x7a52('0xe0')){return _0x47325d[_0x7a52('0x65')]({'read':!![]});}else{logger['error'](_0x7a52('0x28'),_0x7a52('0x30'),_0x7a52('0x97'),util[_0x7a52('0xda')](_0x2a7593[_0x7a52('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x47325d;}})[_0x7a52('0x23')](respondWithResult(_0x442446,null))[_0x7a52('0x2e')](handleError(_0x442446,null));};exports[_0x7a52('0xe1')]=function(_0x5a5230,_0x369dd2,_0x5ccaf9){var _0x280a83,_0x53be5a,_0x1efe61;return db['SmsAccount'][_0x7a52('0x67')]({'where':{'id':_0x5a5230[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x369dd2,null))['then'](function(_0x21a7d0){if(_0x21a7d0){_0x1efe61=_0x21a7d0;logger['debug'](_0x7a52('0x28'),_0x7a52('0x30'),_0x7a52('0xd1'),_0x21a7d0[_0x7a52('0x45')],util[_0x7a52('0xda')](_0x5a5230[_0x7a52('0x47')],{'showHidden':![],'depth':null}));switch(_0x21a7d0[_0x7a52('0x45')]){case _0x7a52('0x92'):if(_0x5a5230[_0x7a52('0x47')][_0x7a52('0xe2')]&&_0x5a5230[_0x7a52('0x47')][_0x7a52('0xe3')]){_0x53be5a=_0x5a5230[_0x7a52('0x47')][_0x7a52('0xe3')];return db[_0x7a52('0xce')][_0x7a52('0x67')]({'where':{'messageId':_0x5a5230['query'][_0x7a52('0xe2')]}});}break;}}})[_0x7a52('0x23')](handleEntityNotFound(_0x369dd2,null))[_0x7a52('0x23')](function(_0x151cee){if(_0x151cee){_0x280a83=_0x151cee;switch(_0x1efe61['type']){case _0x7a52('0x92'):if(_0x53be5a==='2'||_0x53be5a==='6'){return _0x280a83[_0x7a52('0x65')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util[_0x7a52('0xda')](_0x5a5230['query'],{'showHidden':![],'depth':null}));};break;}return _0x280a83;}})[_0x7a52('0x23')](respondWithResult(_0x369dd2,null))['catch'](handleError(_0x369dd2,null));};exports[_0x7a52('0xe4')]=function(_0x262c5c,_0x2c0be7,_0x34c7f5){return db[_0x7a52('0x44')][_0x7a52('0x67')]({'where':{'id':_0x262c5c[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x2c0be7,null))[_0x7a52('0x23')](function(_0x3d4dd5){if(_0x3d4dd5){return _0x3d4dd5[_0x7a52('0xe4')](_0x262c5c[_0x7a52('0x66')]['ids'],_[_0x7a52('0xa3')](_0x262c5c['body'],[_0x7a52('0x70'),'id'])||{})[_0x7a52('0xa5')](function(_0x5db5ff){for(var _0x35a924=0x0;_0x35a924<_0x262c5c[_0x7a52('0x66')]['ids'][_0x7a52('0x4d')];_0x35a924+=0x1){socket['emit'](_0x7a52('0xe5'),{'UserId':Number(_0x262c5c['body'][_0x7a52('0x70')][_0x35a924]),'SmsAccountId':Number(_0x262c5c[_0x7a52('0x5b')]['id'])});}return _0x5db5ff;});}})[_0x7a52('0x23')](respondWithResult(_0x2c0be7,null))['catch'](handleError(_0x2c0be7,null));};exports[_0x7a52('0xe6')]=function(_0x228a5c,_0xc356cc,_0x5c7de3){return db[_0x7a52('0x44')][_0x7a52('0x67')]({'where':{'id':_0x228a5c[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0xc356cc,null))[_0x7a52('0x23')](function(_0x58566e){if(_0x58566e){return _0x58566e[_0x7a52('0xe6')](_0x228a5c['query'][_0x7a52('0x70')])[_0x7a52('0x23')](function(){if(_[_0x7a52('0xe7')](_0x228a5c[_0x7a52('0x47')][_0x7a52('0x70')])){for(var _0x5e69be=0x0;_0x5e69be<_0x228a5c['query']['ids'][_0x7a52('0x4d')];_0x5e69be+=0x1){socket[_0x7a52('0xe8')](_0x7a52('0xe9'),{'UserId':Number(_0x228a5c[_0x7a52('0x47')][_0x7a52('0x70')][_0x5e69be]),'SmsAccountId':Number(_0x228a5c[_0x7a52('0x5b')]['id'])});}}else{socket[_0x7a52('0xe8')](_0x7a52('0xe9'),{'UserId':Number(_0x228a5c[_0x7a52('0x47')][_0x7a52('0x70')]),'SmsAccountId':Number(_0x228a5c[_0x7a52('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0xc356cc,null))['catch'](handleError(_0xc356cc,null));};exports[_0x7a52('0xea')]=function(_0x3c2327,_0x5c6551,_0xe6acf9){var _0x1acee3={};var _0x27da6a={};var _0x4aabea;var _0x35db5a;return db['SmsAccount'][_0x7a52('0xbd')]({'where':{'id':_0x3c2327[_0x7a52('0x5b')]['id']}})[_0x7a52('0x23')](handleEntityNotFound(_0x5c6551,null))[_0x7a52('0x23')](function(_0x34b616){if(_0x34b616){_0x4aabea=_0x34b616;_0x27da6a[_0x7a52('0x4b')]=_[_0x7a52('0x48')](db['User']['rawAttributes']);_0x27da6a[_0x7a52('0x47')]=_['keys'](_0x3c2327[_0x7a52('0x47')]);_0x27da6a[_0x7a52('0x49')]=_['intersection'](_0x27da6a[_0x7a52('0x4b')],_0x27da6a[_0x7a52('0x47')]);_0x1acee3[_0x7a52('0x4c')]=_[_0x7a52('0x4a')](_0x27da6a[_0x7a52('0x4b')],qs[_0x7a52('0x6d')](_0x3c2327[_0x7a52('0x47')]['fields']));_0x1acee3['attributes']=_0x1acee3[_0x7a52('0x4c')][_0x7a52('0x4d')]?_0x1acee3[_0x7a52('0x4c')]:_0x27da6a[_0x7a52('0x4b')];_0x1acee3[_0x7a52('0xc1')]=qs[_0x7a52('0x50')](_0x3c2327[_0x7a52('0x47')]['sort']);_0x1acee3[_0x7a52('0x51')]=qs['filters'](_['pick'](_0x3c2327['query'],_0x27da6a[_0x7a52('0x49')]));if(_0x3c2327[_0x7a52('0x47')][_0x7a52('0x55')]){_0x1acee3[_0x7a52('0x51')]=_[_0x7a52('0x53')](_0x1acee3['where'],{'$or':_['map'](_0x1acee3[_0x7a52('0x4c')],function(_0x3018d4){var _0x56a978={};_0x56a978[_0x3018d4]={'$like':'%'+_0x3c2327[_0x7a52('0x47')][_0x7a52('0x55')]+'%'};return _0x56a978;})});}_0x1acee3=_['merge']({},_0x1acee3,_0x3c2327[_0x7a52('0x56')]);return _0x4aabea[_0x7a52('0xea')](_0x1acee3);}})['then'](function(_0x255b10){if(_0x255b10){_0x35db5a=_0x255b10[_0x7a52('0x4d')];if(!_0x3c2327[_0x7a52('0x47')][_0x7a52('0x4e')](_0x7a52('0x4f'))){_0x1acee3[_0x7a52('0x33')]=qs[_0x7a52('0x33')](_0x3c2327[_0x7a52('0x47')][_0x7a52('0x33')]);_0x1acee3[_0x7a52('0x31')]=qs[_0x7a52('0x31')](_0x3c2327['query'][_0x7a52('0x31')]);}return _0x4aabea[_0x7a52('0xea')](_0x1acee3);}})[_0x7a52('0x23')](function(_0x38b931){if(_0x38b931){return _0x38b931?{'count':_0x35db5a,'rows':_0x38b931}:null;}})[_0x7a52('0x23')](respondWithResult(_0x5c6551,null))[_0x7a52('0x2e')](handleError(_0x5c6551,null));};
\ No newline at end of file
+var _0xf70c=['attributes','intersection','length','hasOwnProperty','sort','where','VIRTUAL','filter','merge','options','includeAll','include','rows','show','params','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','Disposition','getDispositions','findOne','order','pick','SmsAccountId','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','notify','sms','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','From','messageId','MessageSid','sender','plivo','Text','MessageUUID','infobip','results','text','originatingAddress','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','twilio','Content-Type','text/xml','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','internal','Tags','tag','to\x20is\x20mandatory','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','clicksend','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','statusGet','csc','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','zip-dir','request-promise','bluebird','mustache','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','get','SmsAccounts','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','keys','query','filters'];(function(_0x148279,_0x487999){var _0x36aa23=function(_0x3c529a){while(--_0x3c529a){_0x148279['push'](_0x148279['shift']());}};_0x36aa23(++_0x487999);}(_0xf70c,0x18f));var _0xcf70=function(_0x3e9482,_0xc9773d){_0x3e9482=_0x3e9482-0x0;var _0x42201c=_0xf70c[_0x3e9482];return _0x42201c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcf70('0x0'));var zipdir=require(_0xcf70('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcf70('0x2'));var moment=require('moment');var BPromise=require(_0xcf70('0x3'));var Mustache=require(_0xcf70('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcf70('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcf70('0x6'));var _=require(_0xcf70('0x7'));var squel=require(_0xcf70('0x8'));var crypto=require(_0xcf70('0x9'));var jsforce=require(_0xcf70('0xa'));var deskjs=require(_0xcf70('0xb'));var toCsv=require('to-csv');var querystring=require(_0xcf70('0xc'));var Papa=require(_0xcf70('0xd'));var Redis=require('ioredis');var authService=require(_0xcf70('0xe'));var qs=require(_0xcf70('0xf'));var as=require(_0xcf70('0x10'));var hardwareService=require(_0xcf70('0x11'));var logger=require(_0xcf70('0x12'))(_0xcf70('0x13'));var utils=require(_0xcf70('0x14'));var config=require(_0xcf70('0x15'));var licenseUtil=require(_0xcf70('0x16'));var db=require(_0xcf70('0x17'))['db'];config[_0xcf70('0x18')]=_[_0xcf70('0x19')](config[_0xcf70('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xcf70('0x1a'))(new Redis(config[_0xcf70('0x18')]));require(_0xcf70('0x1b'))[_0xcf70('0x1c')](socket);var jayson=require(_0xcf70('0x1d'));var client=jayson[_0xcf70('0x1e')][_0xcf70('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x2155fb,_0x503f2a,_0x19515f,_0x428d13){return new BPromise(function(_0xb2471a,_0x415d23){var _0x16120a=_0x428d13||client;return _0x16120a[_0xcf70('0x20')](_0x2155fb,_0x19515f)[_0xcf70('0x21')](function(_0x8546){logger[_0xcf70('0x22')](_0xcf70('0x23'),_0x503f2a,'request\x20sent');logger[_0xcf70('0x24')](_0xcf70('0x25'),_0x503f2a,_0xcf70('0x26'),JSON[_0xcf70('0x27')](_0x8546));if(_0x8546[_0xcf70('0x28')]){if(_0x8546['error']['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x503f2a,_0x8546['error'][_0xcf70('0x29')]);return _0x415d23(_0x8546['error']['message']);}logger[_0xcf70('0x28')](_0xcf70('0x23'),_0x503f2a,_0x8546['error']['message']);return _0xb2471a(_0x8546[_0xcf70('0x28')]['message']);}else{logger['info']('SmsAccount,\x20%s,\x20%s',_0x503f2a,_0xcf70('0x26'));_0xb2471a(_0x8546[_0xcf70('0x2a')][_0xcf70('0x29')]);}})[_0xcf70('0x2b')](function(_0x3fc994){logger['error'](_0xcf70('0x23'),_0x503f2a,_0x3fc994);_0x415d23(_0x3fc994);});});}function respondWithStatusCode(_0x3991a0,_0x2536e0){_0x2536e0=_0x2536e0||0xcc;return function(_0x164f7d){if(_0x164f7d){return _0x3991a0[_0xcf70('0x2c')](_0x2536e0);}return _0x3991a0[_0xcf70('0x2d')](_0x2536e0)[_0xcf70('0x2e')]();};}function respondWithResult(_0x529e73,_0x43e92a){_0x43e92a=_0x43e92a||0xc8;return function(_0xf9e4a8){if(_0xf9e4a8){return _0x529e73[_0xcf70('0x2d')](_0x43e92a)['json'](_0xf9e4a8);}};}function respondWithFilteredResult(_0x303246,_0xe17136){return function(_0xcca1f6){if(_0xcca1f6){var _0x4823e5=typeof _0xe17136[_0xcf70('0x2f')]===_0xcf70('0x30')&&typeof _0xe17136['limit']===_0xcf70('0x30');var _0x974887=_0xcca1f6[_0xcf70('0x31')];var _0x5e544d=_0x4823e5?0x0:_0xe17136[_0xcf70('0x2f')];var _0x5537a1=_0x4823e5?_0xcca1f6['count']:_0xe17136[_0xcf70('0x2f')]+_0xe17136[_0xcf70('0x32')];var _0x207ef7;if(_0x5537a1>=_0x974887){_0x5537a1=_0x974887;_0x207ef7=0xc8;}else{_0x207ef7=0xce;}_0x303246['status'](_0x207ef7);return _0x303246[_0xcf70('0x33')](_0xcf70('0x34'),_0x5e544d+'-'+_0x5537a1+'/'+_0x974887)[_0xcf70('0x35')](_0xcca1f6);}return null;};}function patchUpdates(_0x593daa){return function(_0x5b727e){try{jsonpatch[_0xcf70('0x36')](_0x5b727e,_0x593daa,!![]);}catch(_0x33332f){return BPromise[_0xcf70('0x37')](_0x33332f);}return _0x5b727e[_0xcf70('0x38')]();};}function saveUpdates(_0x380d0f,_0x4e44a3){return function(_0x25e4cf){if(_0x25e4cf){return _0x25e4cf[_0xcf70('0x39')](_0x380d0f)[_0xcf70('0x21')](function(_0x213b3c){return _0x213b3c;});}return null;};}function removeEntity(_0x1df26f,_0x34bce4){return function(_0x3722b2){if(_0x3722b2){return _0x3722b2[_0xcf70('0x3a')]()[_0xcf70('0x21')](function(){var _0x3c66c1=_0x3722b2[_0xcf70('0x3b')]({'plain':!![]});var _0x5f59ba=_0xcf70('0x3c');return db['UserProfileResource']['destroy']({'where':{'type':_0x5f59ba,'resourceId':_0x3c66c1['id']}})[_0xcf70('0x21')](function(){return _0x3722b2;});})[_0xcf70('0x21')](function(){_0x1df26f[_0xcf70('0x2d')](0xcc)[_0xcf70('0x2e')]();});}};}function handleEntityNotFound(_0x573fc8,_0x4d79cd){return function(_0x58d36c){if(!_0x58d36c){_0x573fc8['sendStatus'](0x194);}return _0x58d36c;};}function handleError(_0x21b804,_0x19a215){_0x19a215=_0x19a215||0x1f4;return function(_0x1e9fd8){logger[_0xcf70('0x28')](_0x1e9fd8[_0xcf70('0x3d')]);if(_0x1e9fd8[_0xcf70('0x3e')]){delete _0x1e9fd8[_0xcf70('0x3e')];}_0x21b804['status'](_0x19a215)[_0xcf70('0x3f')](_0x1e9fd8);};}exports[_0xcf70('0x40')]=function(_0x46cbba,_0x5a9564){var _0x576e84={'include':[{'model':db[_0xcf70('0x41')],'as':_0xcf70('0x42')}]},_0x4f3251={},_0x57b794={'count':0x0,'rows':[]};var _0x19c78d=_[_0xcf70('0x43')](db[_0xcf70('0x44')][_0xcf70('0x45')],function(_0x5aa5ca){return{'name':_0x5aa5ca[_0xcf70('0x46')],'type':_0x5aa5ca[_0xcf70('0x47')][_0xcf70('0x48')]};});_0x4f3251[_0xcf70('0x49')]=_[_0xcf70('0x43')](_0x19c78d,_0xcf70('0x3e'));_0x4f3251['query']=_[_0xcf70('0x4a')](_0x46cbba[_0xcf70('0x4b')]);_0x4f3251[_0xcf70('0x4c')]=_['intersection'](_0x4f3251[_0xcf70('0x49')],_0x4f3251[_0xcf70('0x4b')]);_0x576e84[_0xcf70('0x4d')]=_[_0xcf70('0x4e')](_0x4f3251['model'],qs['fields'](_0x46cbba[_0xcf70('0x4b')]['fields']));_0x576e84[_0xcf70('0x4d')]=_0x576e84[_0xcf70('0x4d')][_0xcf70('0x4f')]?_0x576e84[_0xcf70('0x4d')]:_0x4f3251['model'];if(!_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x50')]('nolimit')){_0x576e84[_0xcf70('0x32')]=qs['limit'](_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x576e84[_0xcf70('0x2f')]=qs[_0xcf70('0x2f')](_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x2f')]);}_0x576e84['order']=qs[_0xcf70('0x51')](_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x51')]);_0x576e84[_0xcf70('0x52')]=qs[_0xcf70('0x4c')](_['pick'](_0x46cbba[_0xcf70('0x4b')],_0x4f3251[_0xcf70('0x4c')]),_0x19c78d);if(_0x46cbba[_0xcf70('0x4b')]['filter']){_0x576e84[_0xcf70('0x52')]=_['merge'](_0x576e84[_0xcf70('0x52')],{'$or':_['map'](_0x19c78d,function(_0x559cda){if(_0x559cda['type']!==_0xcf70('0x53')){var _0x4a3593={};_0x4a3593[_0x559cda['name']]={'$like':'%'+_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x54')]+'%'};return _0x4a3593;}})});}_0x576e84=_[_0xcf70('0x55')]({},_0x576e84,_0x46cbba[_0xcf70('0x56')]);var _0x17d95e={'where':_0x576e84['where']};return db[_0xcf70('0x44')][_0xcf70('0x31')](_0x17d95e)['then'](function(_0x3892e3){_0x57b794['count']=_0x3892e3;if(_0x46cbba[_0xcf70('0x4b')][_0xcf70('0x57')]){_0x576e84[_0xcf70('0x58')]=[{'all':!![]}];}return db[_0xcf70('0x44')]['findAll'](_0x576e84);})[_0xcf70('0x21')](function(_0x55cb46){_0x57b794[_0xcf70('0x59')]=_0x55cb46;return _0x57b794;})['then'](respondWithFilteredResult(_0x5a9564,_0x576e84))[_0xcf70('0x2b')](handleError(_0x5a9564,null));};exports[_0xcf70('0x5a')]=function(_0x29f50a,_0x247744){var _0x1a8a44={'raw':![],'where':{'id':_0x29f50a[_0xcf70('0x5b')]['id']},'include':[{'model':db[_0xcf70('0x41')],'as':_0xcf70('0x42')}]},_0x452640={};_0x452640[_0xcf70('0x49')]=_[_0xcf70('0x4a')](db[_0xcf70('0x44')][_0xcf70('0x45')]);_0x452640['query']=_['keys'](_0x29f50a[_0xcf70('0x4b')]);_0x452640[_0xcf70('0x4c')]=_[_0xcf70('0x4e')](_0x452640[_0xcf70('0x49')],_0x452640[_0xcf70('0x4b')]);_0x1a8a44[_0xcf70('0x4d')]=_['intersection'](_0x452640[_0xcf70('0x49')],qs['fields'](_0x29f50a['query'][_0xcf70('0x5c')]));_0x1a8a44[_0xcf70('0x4d')]=_0x1a8a44[_0xcf70('0x4d')]['length']?_0x1a8a44[_0xcf70('0x4d')]:_0x452640[_0xcf70('0x49')];if(_0x29f50a[_0xcf70('0x4b')][_0xcf70('0x57')]){_0x1a8a44[_0xcf70('0x58')]=[{'all':!![]}];}_0x1a8a44=_[_0xcf70('0x55')]({},_0x1a8a44,_0x29f50a[_0xcf70('0x56')]);return db[_0xcf70('0x44')][_0xcf70('0x5d')](_0x1a8a44)['then'](handleEntityNotFound(_0x247744,null))[_0xcf70('0x21')](respondWithResult(_0x247744,null))['catch'](handleError(_0x247744,null));};exports[_0xcf70('0x5e')]=function(_0x534e56,_0x47a4bd){return db[_0xcf70('0x44')][_0xcf70('0x5e')](_0x534e56[_0xcf70('0x5f')],{})[_0xcf70('0x21')](function(_0x44ed78){var _0x48d940=_0x534e56[_0xcf70('0x60')][_0xcf70('0x3b')]({'plain':!![]});if(!_0x48d940)throw new Error(_0xcf70('0x61'));if(_0x48d940['role']===_0xcf70('0x60')){var _0x1deba5=_0x44ed78['get']({'plain':!![]});var _0x557650=_0xcf70('0x3c');return db[_0xcf70('0x62')][_0xcf70('0x5d')]({'where':{'name':_0x557650,'userProfileId':_0x48d940[_0xcf70('0x63')]},'raw':!![]})['then'](function(_0x9333fc){if(_0x9333fc&&_0x9333fc[_0xcf70('0x64')]===0x0){return db[_0xcf70('0x65')]['create']({'name':_0x1deba5[_0xcf70('0x3e')],'resourceId':_0x1deba5['id'],'type':_0x9333fc[_0xcf70('0x3e')],'sectionId':_0x9333fc['id']},{})[_0xcf70('0x21')](function(){return _0x44ed78;});}else{return _0x44ed78;}})[_0xcf70('0x2b')](function(_0x124488){logger[_0xcf70('0x28')](_0xcf70('0x66'),_0x124488);throw _0x124488;});}return _0x44ed78;})[_0xcf70('0x21')](respondWithResult(_0x47a4bd,0xc9))[_0xcf70('0x2b')](handleError(_0x47a4bd,null));};exports[_0xcf70('0x39')]=function(_0x26cc6b,_0x236a5d){if(_0x26cc6b['body']['id']){delete _0x26cc6b[_0xcf70('0x5f')]['id'];}return db[_0xcf70('0x44')]['find']({'where':{'id':_0x26cc6b['params']['id']},'include':[{'model':db[_0xcf70('0x41')],'as':'mandatoryDispositionPause'}]})[_0xcf70('0x21')](handleEntityNotFound(_0x236a5d,null))[_0xcf70('0x21')](saveUpdates(_0x26cc6b[_0xcf70('0x5f')],null))[_0xcf70('0x21')](respondWithResult(_0x236a5d,null))[_0xcf70('0x2b')](handleError(_0x236a5d,null));};exports['destroy']=function(_0x419170,_0x4ec1a2){return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x419170[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x4ec1a2,null))['then'](removeEntity(_0x4ec1a2,null))[_0xcf70('0x2b')](handleError(_0x4ec1a2,null));};exports[_0xcf70('0x67')]=function(_0x42947a,_0x23f330){return db['SmsAccount'][_0xcf70('0x67')]()[_0xcf70('0x21')](respondWithResult(_0x23f330,null))['catch'](handleError(_0x23f330,null));};exports['addDisposition']=function(_0x5e3268,_0x13ae85,_0x22fc65){if(_0x5e3268[_0xcf70('0x5f')]['id']){delete _0x5e3268['body']['id'];}return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x5e3268['params']['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x13ae85,null))[_0xcf70('0x21')](function(_0x45cbb5){if(_0x45cbb5){_0x5e3268[_0xcf70('0x5f')]['SmsAccountId']=_0x45cbb5['id'];return db[_0xcf70('0x68')][_0xcf70('0x5e')](_0x5e3268[_0xcf70('0x5f')]);}})[_0xcf70('0x21')](respondWithResult(_0x13ae85,null))[_0xcf70('0x2b')](handleError(_0x13ae85,null));};exports[_0xcf70('0x69')]=function(_0x67197a,_0x495c7c,_0x4d96d9){var _0x18f809={'raw':![],'where':{}};var _0x396cbd={};var _0x9aead9={'count':0x0,'rows':[]};return db[_0xcf70('0x44')][_0xcf70('0x6a')]({'where':{'id':_0x67197a[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x495c7c,null))[_0xcf70('0x21')](function(_0x3d3c36){if(_0x3d3c36){_0x396cbd[_0xcf70('0x49')]=_['keys'](db[_0xcf70('0x68')][_0xcf70('0x45')]);_0x396cbd['query']=_[_0xcf70('0x4a')](_0x67197a[_0xcf70('0x4b')]);_0x396cbd['filters']=_['intersection'](_0x396cbd['model'],_0x396cbd[_0xcf70('0x4b')]);_0x18f809[_0xcf70('0x4d')]=_[_0xcf70('0x4e')](_0x396cbd[_0xcf70('0x49')],qs[_0xcf70('0x5c')](_0x67197a[_0xcf70('0x4b')][_0xcf70('0x5c')]));_0x18f809[_0xcf70('0x4d')]=_0x18f809['attributes']['length']?_0x18f809[_0xcf70('0x4d')]:_0x396cbd[_0xcf70('0x49')];if(!_0x67197a['query'][_0xcf70('0x50')]('nolimit')){_0x18f809[_0xcf70('0x32')]=qs[_0xcf70('0x32')](_0x67197a[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x18f809[_0xcf70('0x2f')]=qs[_0xcf70('0x2f')](_0x67197a[_0xcf70('0x4b')]['offset']);}_0x18f809[_0xcf70('0x6b')]=qs[_0xcf70('0x51')](_0x67197a[_0xcf70('0x4b')][_0xcf70('0x51')]);_0x18f809['where']=qs[_0xcf70('0x4c')](_[_0xcf70('0x6c')](_0x67197a['query'],_0x396cbd[_0xcf70('0x4c')]));_0x18f809[_0xcf70('0x52')][_0xcf70('0x6d')]=_0x3d3c36['id'];if(_0x67197a[_0xcf70('0x4b')][_0xcf70('0x54')]){_0x18f809[_0xcf70('0x52')]=_[_0xcf70('0x55')](_0x18f809[_0xcf70('0x52')],{'$or':_['map'](_0x18f809[_0xcf70('0x4d')],function(_0xa2879d){var _0x2d91ff={};_0x2d91ff[_0xa2879d]={'$like':'%'+_0x67197a['query']['filter']+'%'};return _0x2d91ff;})});}_0x18f809=_['merge']({},_0x18f809,_0x67197a[_0xcf70('0x56')]);return db[_0xcf70('0x68')][_0xcf70('0x31')]({'where':_0x18f809[_0xcf70('0x52')]})[_0xcf70('0x21')](function(_0x1bb141){_0x9aead9[_0xcf70('0x31')]=_0x1bb141;if(_0x67197a[_0xcf70('0x4b')][_0xcf70('0x57')]){_0x18f809[_0xcf70('0x58')]=[{'all':!![]}];}return db[_0xcf70('0x68')][_0xcf70('0x6e')](_0x18f809);})['then'](function(_0x6508ba){_0x9aead9['rows']=_0x6508ba;return _0x9aead9;});}})[_0xcf70('0x21')](respondWithFilteredResult(_0x495c7c,_0x18f809))[_0xcf70('0x2b')](handleError(_0x495c7c,null));};exports[_0xcf70('0x6f')]=function(_0x2c7786,_0x51e07c,_0x3446b2){return db[_0xcf70('0x44')]['find']({'where':{'id':_0x2c7786[_0xcf70('0x5b')]['id']}})['then'](handleEntityNotFound(_0x51e07c,null))[_0xcf70('0x21')](function(_0x36bd4c){if(_0x36bd4c){return _0x36bd4c['removeDispositions'](_0x2c7786['query'][_0xcf70('0x70')]);}})['then'](respondWithStatusCode(_0x51e07c,null))[_0xcf70('0x2b')](handleError(_0x51e07c,null));};exports[_0xcf70('0x71')]=function(_0x1540bd,_0x3a1b60,_0x5147ce){if(_0x1540bd['body']['id']){delete _0x1540bd['body']['id'];}return db['SmsAccount']['find']({'where':{'id':_0x1540bd[_0xcf70('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3a1b60,null))[_0xcf70('0x21')](function(_0x29ac47){if(_0x29ac47){_0x1540bd[_0xcf70('0x5f')][_0xcf70('0x6d')]=_0x29ac47['id'];return db[_0xcf70('0x72')][_0xcf70('0x5e')](_0x1540bd[_0xcf70('0x5f')]);}})['then'](respondWithResult(_0x3a1b60,null))[_0xcf70('0x2b')](handleError(_0x3a1b60,null));};exports[_0xcf70('0x73')]=function(_0x15728a,_0x20eb25,_0x4078bc){var _0x2cc49f={'raw':![],'where':{}};var _0x3126fb={};var _0x538dee={'count':0x0,'rows':[]};return db['SmsAccount'][_0xcf70('0x6a')]({'where':{'id':_0x15728a[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x20eb25,null))[_0xcf70('0x21')](function(_0x539f15){if(_0x539f15){_0x3126fb[_0xcf70('0x49')]=_[_0xcf70('0x4a')](db[_0xcf70('0x72')]['rawAttributes']);_0x3126fb[_0xcf70('0x4b')]=_[_0xcf70('0x4a')](_0x15728a['query']);_0x3126fb['filters']=_['intersection'](_0x3126fb[_0xcf70('0x49')],_0x3126fb[_0xcf70('0x4b')]);_0x2cc49f['attributes']=_['intersection'](_0x3126fb['model'],qs['fields'](_0x15728a[_0xcf70('0x4b')]['fields']));_0x2cc49f['attributes']=_0x2cc49f[_0xcf70('0x4d')][_0xcf70('0x4f')]?_0x2cc49f['attributes']:_0x3126fb[_0xcf70('0x49')];if(!_0x15728a[_0xcf70('0x4b')][_0xcf70('0x50')](_0xcf70('0x74'))){_0x2cc49f[_0xcf70('0x32')]=qs[_0xcf70('0x32')](_0x15728a[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x2cc49f[_0xcf70('0x2f')]=qs['offset'](_0x15728a[_0xcf70('0x4b')][_0xcf70('0x2f')]);}_0x2cc49f[_0xcf70('0x6b')]=qs[_0xcf70('0x51')](_0x15728a['query'][_0xcf70('0x51')]);_0x2cc49f[_0xcf70('0x52')]=qs[_0xcf70('0x4c')](_[_0xcf70('0x6c')](_0x15728a[_0xcf70('0x4b')],_0x3126fb[_0xcf70('0x4c')]));_0x2cc49f[_0xcf70('0x52')][_0xcf70('0x6d')]=_0x539f15['id'];if(_0x15728a[_0xcf70('0x4b')][_0xcf70('0x54')]){_0x2cc49f[_0xcf70('0x52')]=_[_0xcf70('0x55')](_0x2cc49f[_0xcf70('0x52')],{'$or':_[_0xcf70('0x43')](_0x2cc49f[_0xcf70('0x4d')],function(_0x38ec5f){var _0x482f61={};_0x482f61[_0x38ec5f]={'$like':'%'+_0x15728a['query'][_0xcf70('0x54')]+'%'};return _0x482f61;})});}_0x2cc49f=_['merge']({},_0x2cc49f,_0x15728a[_0xcf70('0x56')]);return db[_0xcf70('0x72')][_0xcf70('0x31')]({'where':_0x2cc49f['where']})[_0xcf70('0x21')](function(_0x2d5de5){_0x538dee['count']=_0x2d5de5;if(_0x15728a[_0xcf70('0x4b')]['includeAll']){_0x2cc49f[_0xcf70('0x58')]=[{'all':!![]}];}return db[_0xcf70('0x72')]['findAll'](_0x2cc49f);})[_0xcf70('0x21')](function(_0x5b11ae){_0x538dee[_0xcf70('0x59')]=_0x5b11ae;return _0x538dee;});}})[_0xcf70('0x21')](respondWithFilteredResult(_0x20eb25,_0x2cc49f))[_0xcf70('0x2b')](handleError(_0x20eb25,null));};exports[_0xcf70('0x75')]=function(_0x1c929c,_0x5a4d64,_0x2e338b){return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x1c929c['params']['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x5a4d64,null))[_0xcf70('0x21')](function(_0x4fa754){if(_0x4fa754){return _0x4fa754[_0xcf70('0x75')](_0x1c929c[_0xcf70('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x5a4d64,null))[_0xcf70('0x2b')](handleError(_0x5a4d64,null));};exports[_0xcf70('0x76')]=function(_0x168231,_0xb8cf2d,_0x4e3b5a){var _0x51ed46={'channel':_0xcf70('0x77')};var _0x18f2dc=[];var _0x6ad739=[];var _0x4c5362={};return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x168231['params']['id']},'include':[{'model':db[_0xcf70('0x78')],'as':_0xcf70('0x79')}]})[_0xcf70('0x21')](handleEntityNotFound(_0xb8cf2d,null))[_0xcf70('0x21')](function(_0x9b63b6){_0x51ed46['account']=_0x9b63b6;_0x51ed46[_0xcf70('0x7a')]=_[_0xcf70('0x7b')](_0x9b63b6[_0xcf70('0x79')],[_0xcf70('0x7c')],[_0xcf70('0x7d')]);if(_0x51ed46[_0xcf70('0x7e')][_0xcf70('0x79')]){delete _0x51ed46['account'][_0xcf70('0x79')];}return db[_0xcf70('0x7f')][_0xcf70('0x67')]();})[_0xcf70('0x21')](function(_0x54e6cc){if(!_0x54e6cc){throw new db['Sequelize'][(_0xcf70('0x80'))](_0xcf70('0x81'));}_0x18f2dc=_[_0xcf70('0x82')](_['keys'](_0x54e6cc),['createdAt','updatedAt']);_0x6ad739=_[_0xcf70('0x82')](_[_0xcf70('0x4a')](_0x54e6cc),[_0xcf70('0x83'),_0xcf70('0x84'),_0xcf70('0x85'),_0xcf70('0x86')]);_0x51ed46[_0xcf70('0x5f')]={'mapKey':_0xcf70('0x87')};if(_0x51ed46[_0xcf70('0x7e')]['type']){switch(_0x51ed46[_0xcf70('0x7e')]['type']){case'twilio':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]=_0x168231['body'][_0xcf70('0x89')];_0x51ed46[_0xcf70('0x5f')]['body']=_0x168231['body']['Body'];_0x51ed46['body'][_0xcf70('0x8a')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x8b')];break;case'skebby':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]='+'+_0x168231[_0xcf70('0x5f')][_0xcf70('0x8c')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231[_0xcf70('0x5f')]['text'];break;case'connectel':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x88')];_0x51ed46[_0xcf70('0x5f')]['body']=_0x168231[_0xcf70('0x5f')][_0xcf70('0x29')];break;case'clicksend':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')]['from'];_0x51ed46['body'][_0xcf70('0x5f')]=_0x168231['body']['body'];_0x51ed46[_0xcf70('0x5f')]['messageId']=_0x168231[_0xcf70('0x5f')]['message_id'];break;case _0xcf70('0x8d'):_0x51ed46[_0xcf70('0x5f')]['from']=_0x168231[_0xcf70('0x5f')]['From'];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231['body'][_0xcf70('0x8e')];_0x51ed46['body'][_0xcf70('0x8a')]=_0x168231['body'][_0xcf70('0x8f')];break;case _0xcf70('0x90'):_0x51ed46['body'][_0xcf70('0x88')]='+'+_0x168231['body'][_0xcf70('0x91')][0x0][_0xcf70('0x88')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x91')][0x0][_0xcf70('0x92')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x8a')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x91')][0x0]['messageId'];break;case'csc':_0x51ed46['body'][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x93')];_0x51ed46['body'][_0xcf70('0x5f')]=_0x168231['body']['segmentedMessage'][_0xcf70('0x29')];break;case _0xcf70('0x94'):_0x51ed46['body']['from']=_0x168231[_0xcf70('0x5f')][_0xcf70('0x95')];_0x51ed46[_0xcf70('0x5f')]['body']=_0x168231[_0xcf70('0x5f')]['text'];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x8a')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x96')];break;case _0xcf70('0x97'):_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x8a')]=_0x168231['body'][0x0][_0xcf70('0x29')]['id'];_0x51ed46['body'][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')][0x0][_0xcf70('0x29')][_0xcf70('0x88')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231[_0xcf70('0x5f')][0x0]['message'][_0xcf70('0x92')];break;case _0xcf70('0x98'):_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x88')];_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')]=_0x168231[_0xcf70('0x5f')][_0xcf70('0x29')];_0x51ed46['body']['messageId']=_0x168231[_0xcf70('0x5f')][_0xcf70('0x99')];break;}}if(_0x51ed46[_0xcf70('0x5f')]['id']){delete _0x51ed46[_0xcf70('0x5f')]['id'];}if(_[_0xcf70('0x9a')](_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')])){throw new db['Sequelize']['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')])||_0x51ed46['body']['body']===''){throw new db[(_0xcf70('0x9b'))][(_0xcf70('0x80'))](_0xcf70('0x9c'));}if(_['isNil'](_0x51ed46['body'][_0xcf70('0x9d')])){throw new db['Sequelize'][(_0xcf70('0x80'))](_0xcf70('0x9e')+_0x6ad739);}if(!_[_0xcf70('0x9f')](_0x6ad739,_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x9d')])){throw new db[(_0xcf70('0x9b'))][(_0xcf70('0x80'))](_0xcf70('0xa0')+_0x6ad739);}_0x4c5362[_0x51ed46[_0xcf70('0x5f')]['mapKey']]=_0x51ed46[_0xcf70('0x5f')]['from'];return db[_0xcf70('0xa1')]['find']({'where':{'id':_0x51ed46[_0xcf70('0x7e')][_0xcf70('0x86')]},'include':[{'model':db['CmContact'],'as':_0xcf70('0xa2'),'where':_0x4c5362,'limit':0x1,'order':[[_0xcf70('0x84'),_0xcf70('0xa3')]]}]});})[_0xcf70('0x21')](handleEntityNotFound(_0xb8cf2d,null))[_0xcf70('0x21')](function(_0x22702a){if(_0x22702a){_0x51ed46[_0xcf70('0xa4')]=_['omit'](_0x22702a,['Contacts']);if(_0x22702a[_0xcf70('0xa2')][_0xcf70('0x4f')]){return _0x22702a['Contacts'][0x0];}var _0x4890f2=_[_0xcf70('0x19')](_0x51ed46['body'],{'firstName':_0x51ed46['body'][_0xcf70('0x88')],'ListId':_0x22702a['id']});_0x4890f2[_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x9d')]]=_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x88')];return db[_0xcf70('0x7f')][_0xcf70('0x5e')](_0x4890f2,{'fields':_0x18f2dc,'raw':!![]});}})[_0xcf70('0x21')](handleEntityNotFound(_0xb8cf2d,null))[_0xcf70('0x21')](function(_0x55d0bc){if(_0x55d0bc){_0x51ed46['contact']=_0x55d0bc;var _0x2619e5={'ContactId':_0x55d0bc['id'],'phone':_0x51ed46['body'][_0xcf70('0x88')],'SmsAccountId':_0x168231[_0xcf70('0x5b')]['id']};var _0x2b70f9={'ContactId':_0x55d0bc['id'],'SmsAccountId':_0x168231[_0xcf70('0x5b')]['id'],'closed':![]};return db['SmsInteraction'][_0xcf70('0x5d')]({'where':_0x2b70f9})[_0xcf70('0x21')](function(_0x54dea3){if(_0x54dea3){return[_0x54dea3,![]];}return db['SmsInteraction'][_0xcf70('0x5e')](_0x2619e5)[_0xcf70('0x21')](function(_0x4dd1a9){return[_0x4dd1a9,!![]];});});}})[_0xcf70('0xa5')](function(_0x158cf8,_0x1b00d5){_0x51ed46[_0xcf70('0xa6')]=_0x158cf8[_0xcf70('0x3b')]({'plain':!![]});_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xa7')]=![];if(_0x1b00d5){if(_0x51ed46[_0xcf70('0x7e')][_0xcf70('0xa8')]){_0x51ed46[_0xcf70('0x7a')][_0xcf70('0xa9')]({'id':0x0,'priority':_0x51ed46[_0xcf70('0x7a')][_0xcf70('0x4f')]+0x1,'app':_0xcf70('0xaa'),'appdata':_0xcf70('0xab'),'interval':_0xcf70('0xac')});}_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xa7')]=!![];}return db[_0xcf70('0xad')]['create']({'phone':_0x51ed46['body'][_0xcf70('0x88')],'messageId':_0x51ed46[_0xcf70('0x5f')]['messageId'],'body':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0x5f')],'SmsAccountId':_0x168231[_0xcf70('0x5b')]['id'],'SmsInteractionId':_0x158cf8['id'],'direction':'in','ContactId':_0x158cf8['ContactId'],'AttachmentId':_0x51ed46[_0xcf70('0x5f')][_0xcf70('0xae')]});})[_0xcf70('0x21')](function(_0x33290a){_0x51ed46['message']=_0x33290a;if(!_0x51ed46[_0xcf70('0xa6')]['UserId'])return;return db[_0xcf70('0xaf')][_0xcf70('0x5d')]({'attributes':['id',_0xcf70('0x3e')],'where':{'id':_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xb0')]}});})['then'](function(_0x4e4843){if(_0x4e4843){_0x51ed46[_0xcf70('0x7a')][_0xcf70('0xb1')]({'id':0x0,'priority':0x0,'app':_0xcf70('0xb2'),'appdata':_0x4e4843[_0xcf70('0x3e')]+','+(_0x51ed46[_0xcf70('0x7e')][_0xcf70('0xb3')]||0xa),'interval':'*,*,*,*'});}if(!_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xb4')])return;return db[_0xcf70('0xb5')][_0xcf70('0x5d')]({'attributes':['id',_0xcf70('0x3e')],'where':{'id':_0x51ed46[_0xcf70('0xa6')][_0xcf70('0xb4')]}});})['then'](function(_0x2d9aa0){if(_0x2d9aa0){_0x51ed46[_0xcf70('0x7a')][_0xcf70('0xb1')]({'id':0x0,'priority':0x1,'app':_0xcf70('0xb6'),'appdata':_0x2d9aa0[_0xcf70('0x3e')]+','+(_0x51ed46[_0xcf70('0x7e')][_0xcf70('0xb7')]||0x12c),'interval':_0xcf70('0xac')});}return respondWithRpcPromise(_0xcf70('0xb8'),_0xcf70('0xb9'),_0x51ed46);})[_0xcf70('0x21')](function(_0x2b61dd){if(_0x2b61dd){var _0x955e7b=0xc8;var _0x55862d=_0xcf70('0xba');logger['info'](_0xcf70('0x25'),_0x55862d,_0x955e7b,_0xcf70('0xbb'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x55862d,_0x955e7b,'entity\x20found',JSON['stringify'](_0x2b61dd));if(_0x51ed46['account'][_0xcf70('0x47')]===_0xcf70('0xbc')){return _0xb8cf2d[_0xcf70('0x2d')](_0x955e7b)[_0xcf70('0x33')](_0xcf70('0xbd'),_0xcf70('0xbe'))[_0xcf70('0x3f')]('<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>');}else{return _0xb8cf2d[_0xcf70('0x2d')](_0x955e7b)[_0xcf70('0x35')](_0x2b61dd);}}})[_0xcf70('0x2b')](handleError(_0xb8cf2d,null));};exports[_0xcf70('0xbf')]=function(_0x3f1b8c,_0x138173){var _0x5b80c7=_0x3f1b8c[_0xcf70('0x5b')]['id'];var _0x1b5bbd=_0x3f1b8c[_0xcf70('0x5f')];var _0x2fe191=0xc8;var _0x49f804=null;return db[_0xcf70('0xc0')][_0xcf70('0xc1')]({'isolationLevel':db[_0xcf70('0xc0')][_0xcf70('0xc2')][_0xcf70('0xc3')][_0xcf70('0xc4')]},function(_0x2b450){return db[_0xcf70('0x44')][_0xcf70('0x6a')]({'where':{'id':_0x5b80c7},'transaction':_0x2b450})['then'](function(_0x484313){if(_0x484313){return db['SmsApplication'][_0xcf70('0x3a')]({'where':{'SmsAccountId':_0x5b80c7},'transaction':_0x2b450})[_0xcf70('0x21')](function(){var _0x1ef52b=_[_0xcf70('0x43')](_0x1b5bbd,function(_0x269ba5){_0x269ba5[_0xcf70('0x6d')]=_0x5b80c7;return _0x269ba5;});return db[_0xcf70('0x78')]['bulkCreate'](_0x1ef52b,{'transaction':_0x2b450});});}else{_0x2fe191=0x194;_0x49f804=[];}});})[_0xcf70('0x21')](function(){if(_0x2fe191!==0x194){return db[_0xcf70('0x78')][_0xcf70('0xc5')]({'where':{'SmsAccountId':_0x5b80c7},'order':_0xcf70('0x7c')})['then'](function(_0xeb2643){_0x49f804=_0xeb2643;});}})[_0xcf70('0x2b')](function(_0x18f96a){_0x2fe191=0x1f4;logger[_0xcf70('0x28')](_0x18f96a[_0xcf70('0x3d')]);if(_0x18f96a[_0xcf70('0x3e')]){delete _0x18f96a[_0xcf70('0x3e')];}_0x49f804=_0x18f96a;})[_0xcf70('0xc6')](function(){if(_0x49f804===null){_0x138173[_0xcf70('0x2c')](_0x2fe191);}else{if(_0x2fe191===0x1f4){_0x138173[_0xcf70('0x2d')](_0x2fe191)[_0xcf70('0x3f')](_0x49f804);}else{_0x138173[_0xcf70('0x2d')](_0x2fe191)[_0xcf70('0x35')](_0x49f804);}}});};exports[_0xcf70('0xc7')]=function(_0x168c69,_0x25a159,_0x46beb2){var _0x3e308e={};var _0x23d47d={};var _0x28f097;var _0x3d6f99;return db[_0xcf70('0x44')]['findOne']({'where':{'id':_0x168c69[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x25a159,null))[_0xcf70('0x21')](function(_0xcf179c){if(_0xcf179c){_0x28f097=_0xcf179c;_0x23d47d[_0xcf70('0x49')]=_[_0xcf70('0x4a')](db[_0xcf70('0x78')][_0xcf70('0x45')]);_0x23d47d[_0xcf70('0x4b')]=_[_0xcf70('0x4a')](_0x168c69[_0xcf70('0x4b')]);_0x23d47d[_0xcf70('0x4c')]=_[_0xcf70('0x4e')](_0x23d47d[_0xcf70('0x49')],_0x23d47d['query']);_0x3e308e['attributes']=_[_0xcf70('0x4e')](_0x23d47d['model'],qs[_0xcf70('0x5c')](_0x168c69[_0xcf70('0x4b')][_0xcf70('0x5c')]));_0x3e308e[_0xcf70('0x4d')]=_0x3e308e[_0xcf70('0x4d')][_0xcf70('0x4f')]?_0x3e308e[_0xcf70('0x4d')]:_0x23d47d[_0xcf70('0x49')];_0x3e308e[_0xcf70('0x6b')]=qs['sort'](_0x168c69['query']['sort']);_0x3e308e[_0xcf70('0x52')]=qs['filters'](_[_0xcf70('0x6c')](_0x168c69['query'],_0x23d47d['filters']));if(_0x168c69[_0xcf70('0x4b')][_0xcf70('0x54')]){_0x3e308e['where']=_[_0xcf70('0x55')](_0x3e308e[_0xcf70('0x52')],{'$or':_['map'](_0x3e308e[_0xcf70('0x4d')],function(_0x24d863){var _0x2f206e={};_0x2f206e[_0x24d863]={'$like':'%'+_0x168c69['query']['filter']+'%'};return _0x2f206e;})});}_0x3e308e=_[_0xcf70('0x55')]({},_0x3e308e,_0x168c69[_0xcf70('0x56')]);return _0x28f097[_0xcf70('0xc7')](_0x3e308e);}})['then'](function(_0x2d7818){if(_0x2d7818){_0x3d6f99=_0x2d7818['length'];if(!_0x168c69[_0xcf70('0x4b')]['hasOwnProperty'](_0xcf70('0x74'))){_0x3e308e[_0xcf70('0x32')]=qs['limit'](_0x168c69[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x3e308e[_0xcf70('0x2f')]=qs[_0xcf70('0x2f')](_0x168c69['query'][_0xcf70('0x2f')]);}return _0x28f097[_0xcf70('0xc7')](_0x3e308e);}})[_0xcf70('0x21')](function(_0x170783){if(_0x170783){return _0x170783?{'count':_0x3d6f99,'rows':_0x170783}:null;}})[_0xcf70('0x21')](respondWithResult(_0x25a159,null))[_0xcf70('0x2b')](handleError(_0x25a159,null));};exports[_0xcf70('0xc8')]=function(_0x4dfd5f,_0x11af8b,_0x4469d0){var _0x54836b={'raw':![],'where':{}};var _0x44a7b8={};var _0x2acde8={'count':0x0,'rows':[]};return db[_0xcf70('0x44')]['findOne']({'where':{'id':_0x4dfd5f[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x11af8b,null))[_0xcf70('0x21')](function(_0x1ce329){if(_0x1ce329){_0x44a7b8[_0xcf70('0x49')]=_['keys'](db[_0xcf70('0xc9')][_0xcf70('0x45')]);_0x44a7b8[_0xcf70('0x4b')]=_[_0xcf70('0x4a')](_0x4dfd5f[_0xcf70('0x4b')]);_0x44a7b8['filters']=_[_0xcf70('0x4e')](_0x44a7b8[_0xcf70('0x49')],_0x44a7b8['query']);_0x54836b[_0xcf70('0x4d')]=_[_0xcf70('0x4e')](_0x44a7b8[_0xcf70('0x49')],qs[_0xcf70('0x5c')](_0x4dfd5f[_0xcf70('0x4b')]['fields']));_0x54836b[_0xcf70('0x4d')]=_0x54836b[_0xcf70('0x4d')][_0xcf70('0x4f')]?_0x54836b[_0xcf70('0x4d')]:_0x44a7b8[_0xcf70('0x49')];if(!_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x50')](_0xcf70('0x74'))){_0x54836b[_0xcf70('0x32')]=qs[_0xcf70('0x32')](_0x4dfd5f[_0xcf70('0x4b')]['limit']);_0x54836b['offset']=qs[_0xcf70('0x2f')](_0x4dfd5f[_0xcf70('0x4b')]['offset']);}_0x54836b['order']=qs[_0xcf70('0x51')](_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x51')]);_0x54836b['where']=qs['filters'](_[_0xcf70('0x6c')](_0x4dfd5f[_0xcf70('0x4b')],_0x44a7b8[_0xcf70('0x4c')]));_0x54836b[_0xcf70('0x52')]['SmsAccountId']=_0x1ce329['id'];if(_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x54')]){_0x54836b[_0xcf70('0x52')]=_['merge'](_0x54836b[_0xcf70('0x52')],{'$or':_['map'](_0x54836b[_0xcf70('0x4d')],function(_0x1d7ca9){var _0x12a1c7={};_0x12a1c7[_0x1d7ca9]={'$like':'%'+_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x54')]+'%'};return _0x12a1c7;})});}_0x54836b=_[_0xcf70('0x55')]({},_0x54836b,_0x4dfd5f['options']);return db['SmsInteraction'][_0xcf70('0x31')]({'where':_0x54836b[_0xcf70('0x52')]})[_0xcf70('0x21')](function(_0x21b7aa){_0x2acde8[_0xcf70('0x31')]=_0x21b7aa;if(_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0x57')]){_0x54836b['include']=[{'model':db['CmContact'],'as':_0xcf70('0xca'),'required':![]},{'model':db[_0xcf70('0xaf')],'as':_0xcf70('0xcb'),'attributes':[_0xcf70('0x3e'),_0xcf70('0xcc'),_0xcf70('0xcd')],'required':![]},{'model':db['Tag'],'as':_0xcf70('0xce'),'attributes':['id',_0xcf70('0x3e'),'color'],'where':_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0xcf')]?{'id':_0x4dfd5f[_0xcf70('0x4b')]['tag']}:undefined,'required':_0x4dfd5f[_0xcf70('0x4b')][_0xcf70('0xcf')]?!![]:![]}];}return db['SmsInteraction'][_0xcf70('0x6e')](_0x54836b);})[_0xcf70('0x21')](function(_0xeb52e5){_0x2acde8[_0xcf70('0x59')]=_0xeb52e5;return _0x2acde8;});}})[_0xcf70('0x21')](respondWithFilteredResult(_0x11af8b,_0x54836b))[_0xcf70('0x2b')](handleError(_0x11af8b,null));};exports['send']=function(_0x57c2d8,_0x11cd86,_0x39c967){var _0x181ef4,_0x5ee4b9,_0x2c9ed6;if(_[_0xcf70('0x9a')](_0x57c2d8[_0xcf70('0x5f')][_0xcf70('0x5f')])||_0x57c2d8[_0xcf70('0x5f')]['body']===''){throw new db[(_0xcf70('0x9b'))][(_0xcf70('0x80'))](_0xcf70('0x9c'));}if(_[_0xcf70('0x9a')](_0x57c2d8[_0xcf70('0x5f')]['to'])){throw new db[(_0xcf70('0x9b'))][(_0xcf70('0x80'))](_0xcf70('0xd0'));}_0x181ef4=_0x57c2d8['body']['to'];return db[_0xcf70('0x44')]['find']({'where':{'id':_0x57c2d8[_0xcf70('0x5b')]['id']},'include':[{'model':db[_0xcf70('0xa1')],'as':_0xcf70('0xd1'),'include':[{'model':db[_0xcf70('0x7f')],'as':_0xcf70('0xa2'),'where':{'mobile':_0x181ef4},'limit':0x1,'order':[[_0xcf70('0x84'),_0xcf70('0xa3')]]}]}]})[_0xcf70('0x21')](handleEntityNotFound(_0x11cd86,null))[_0xcf70('0x21')](function(_0x31b776){if(_0x31b776&&_0x31b776['List']){_0x5ee4b9=_0x31b776[_0xcf70('0x3b')]({'plain':!![]});if(_0x5ee4b9['List']&&_0x5ee4b9[_0xcf70('0xd1')]['Contacts']['length']){return _0x5ee4b9[_0xcf70('0xd1')]['Contacts'][0x0];}return db[_0xcf70('0x7f')]['create'](_[_0xcf70('0x19')](_0x57c2d8[_0xcf70('0x5f')],{'firstName':_0x181ef4,'mobile':_0x181ef4,'phone':_0x181ef4,'ListId':_0x5ee4b9[_0xcf70('0x86')]}));}})[_0xcf70('0x21')](handleEntityNotFound(_0x11cd86,null))[_0xcf70('0x21')](function(_0x594477){if(_0x594477){_0x2c9ed6=_0x594477;return db[_0xcf70('0xc9')][_0xcf70('0x5d')]({'where':{'ContactId':_0x2c9ed6['id'],'closed':![],'SmsAccountId':_0x5ee4b9['id']}})['then'](function(_0x158f77){if(_0x158f77){return[_0x158f77,![]];}return db['SmsInteraction'][_0xcf70('0x5e')]({'UserId':_0x57c2d8[_0xcf70('0x60')]['id'],'ContactId':_0x2c9ed6['id'],'SmsAccountId':_0x5ee4b9['id'],'phone':_0x181ef4,'firstMsgDirection':_0xcf70('0xd2'),'Messages':[_[_0xcf70('0x55')](_0x57c2d8['body'],{'read':![],'body':_0x57c2d8[_0xcf70('0x5f')]['body'],'phone':_0x181ef4,'SmsAccountId':_0x5ee4b9['id'],'UserId':_0x57c2d8[_0xcf70('0x60')]['id'],'ContactId':_0x2c9ed6['id']})]},{'include':[{'model':db[_0xcf70('0xad')],'as':_0xcf70('0xd3')}]})[_0xcf70('0x21')](function(_0x2af763){return[_0x2af763,!![]];});});}})[_0xcf70('0xa5')](function(_0x7b8947,_0x569b9a){if(_0x569b9a){return _0x7b8947;}return db[_0xcf70('0xad')][_0xcf70('0x5e')](_[_0xcf70('0x55')](_0x57c2d8['body'],{'read':![],'body':_0x57c2d8['body'][_0xcf70('0x5f')],'phone':_0x181ef4,'SmsAccountId':_0x5ee4b9['id'],'SmsInteractionId':_0x7b8947['id'],'UserId':_0x57c2d8[_0xcf70('0x60')]['id'],'ContactId':_0x2c9ed6['id']}))[_0xcf70('0x21')](function(_0xec3853){_0x7b8947[_0xcf70('0xd4')][_0xcf70('0xd3')]=[];_0x7b8947[_0xcf70('0xd4')][_0xcf70('0xd3')][_0xcf70('0xa9')](_0xec3853[_0xcf70('0xd4')]);return _0x7b8947;});})[_0xcf70('0x21')](respondWithResult(_0x11cd86,null))[_0xcf70('0x2b')](handleError(_0x11cd86,null));};exports['status']=function(_0x5eb69b,_0x172069,_0x4947df){if(_0x5eb69b['body']['id']){delete _0x5eb69b[_0xcf70('0x5f')]['id'];}var _0x45f945,_0x199059,_0x1d5866;return db[_0xcf70('0x44')][_0xcf70('0x5d')]({'where':{'id':_0x5eb69b[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x172069,null))[_0xcf70('0x21')](function(_0x3a9314){if(_0x3a9314){_0x1d5866=_0x3a9314;logger[_0xcf70('0x24')](_0xcf70('0x25'),_0xcf70('0x2d'),_0xcf70('0xd5'),_0x3a9314[_0xcf70('0x47')],util[_0xcf70('0xd6')](_0x5eb69b['body'],{'showHidden':![],'depth':null}));switch(_0x3a9314[_0xcf70('0x47')]){case _0xcf70('0xd7'):if(_0x5eb69b['body'][_0xcf70('0xd8')]&&_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')]){_0x199059=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xd8')]}});}break;case _0xcf70('0xd9'):if(_0x5eb69b['body']['requestid']&&_0x5eb69b['body']['statusInt']){_0x199059=_0x5eb69b[_0xcf70('0x5f')]['statusInt'];return db['SmsMessage'][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b['body']['requestid']}});}break;case _0xcf70('0xda'):if(_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdb')]&&_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdc')]){_0x199059=_0x5eb69b[_0xcf70('0x5f')]['status_code'];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdb')]}});}break;case _0xcf70('0x90'):var _0x4c1fba=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x91')][0x0];if(_0x4c1fba['messageId']&&_0x4c1fba['status'][_0xcf70('0xdd')]===_0xcf70('0xde')){_0x199059=_0x4c1fba['status'][_0xcf70('0xdd')];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x4c1fba[_0xcf70('0x8a')]}});}break;case'clickatell':if(_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x8a')]&&_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')]){_0x199059=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')];return db['SmsMessage'][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x8a')]}});}break;case _0xcf70('0x97'):if(_0x5eb69b[_0xcf70('0x5f')][0x0][_0xcf70('0x29')]['id']){_0x199059=_0x5eb69b[_0xcf70('0x5f')][0x0][_0xcf70('0x47')];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][0x0][_0xcf70('0x29')]['id']}});}break;case'intelepeer':if(_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdf')]&&_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')]){_0x199059=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x2d')];return db[_0xcf70('0xad')][_0xcf70('0x5d')]({'where':{'messageId':_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xdf')]}});}break;}}})['then'](handleEntityNotFound(_0x172069,null))[_0xcf70('0x21')](function(_0x497949){if(_0x497949){_0x45f945=_0x497949;switch(_0x1d5866[_0xcf70('0x47')]){case'skebby':if(_0x199059===_0xcf70('0xde')){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),_0xcf70('0x2d'),_0xcf70('0xd7'),util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xcf70('0xd9'):if(_0x199059==='1'){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger['error'](_0xcf70('0x25'),_0xcf70('0x2d'),_0xcf70('0xd7'),util['inspect'](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xcf70('0xda'):if(!_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0xe0')]&&_0x199059>=0xc8&&_0x199059<=0xce){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcf70('0x2d'),_0xcf70('0xda'),util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xcf70('0x90'):var _0x1101ae=_0x5eb69b[_0xcf70('0x5f')][_0xcf70('0x91')][0x0];if(_0x1101ae[_0xcf70('0x2d')][_0xcf70('0xdd')]===_0xcf70('0xde')){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),'status','infobip',util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x199059==_0xcf70('0xe1')||_0x199059=='RECEIVED_BY_RECIPIENT'){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),_0xcf70('0x2d'),'clickatell',util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case _0xcf70('0x97'):if(_0x199059==_0xcf70('0xe2')){return _0x45f945[_0xcf70('0x39')]({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),'status',_0xcf70('0x97'),util['inspect'](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x199059===_0xcf70('0xe3')||_0x199059==='ACCEPTD'){return _0x45f945['update']({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),'status',_0xcf70('0x98'),util[_0xcf70('0xd6')](_0x5eb69b[_0xcf70('0x5f')],{'showHidden':![],'depth':null}));}break;}return _0x45f945;}})[_0xcf70('0x21')](respondWithResult(_0x172069,null))[_0xcf70('0x2b')](handleError(_0x172069,null));};exports[_0xcf70('0xe4')]=function(_0x3f3347,_0x35f03c,_0x59a23b){var _0x3cbe3a,_0x29b37a,_0x365121;return db['SmsAccount'][_0xcf70('0x5d')]({'where':{'id':_0x3f3347['params']['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x35f03c,null))[_0xcf70('0x21')](function(_0x4ef9b6){if(_0x4ef9b6){_0x365121=_0x4ef9b6;logger['debug'](_0xcf70('0x25'),_0xcf70('0x2d'),_0xcf70('0xd5'),_0x4ef9b6[_0xcf70('0x47')],util[_0xcf70('0xd6')](_0x3f3347[_0xcf70('0x4b')],{'showHidden':![],'depth':null}));switch(_0x4ef9b6[_0xcf70('0x47')]){case _0xcf70('0xe5'):if(_0x3f3347[_0xcf70('0x4b')]['message-id']&&_0x3f3347[_0xcf70('0x4b')][_0xcf70('0xe6')]){_0x29b37a=_0x3f3347[_0xcf70('0x4b')][_0xcf70('0xe6')];return db[_0xcf70('0xad')]['find']({'where':{'messageId':_0x3f3347[_0xcf70('0x4b')][_0xcf70('0xe7')]}});}break;}}})['then'](handleEntityNotFound(_0x35f03c,null))[_0xcf70('0x21')](function(_0x52f498){if(_0x52f498){_0x3cbe3a=_0x52f498;switch(_0x365121[_0xcf70('0x47')]){case _0xcf70('0xe5'):if(_0x29b37a==='2'||_0x29b37a==='6'){return _0x3cbe3a['update']({'read':!![]});}else{logger[_0xcf70('0x28')](_0xcf70('0x25'),_0xcf70('0x2d'),'csc',util['inspect'](_0x3f3347[_0xcf70('0x4b')],{'showHidden':![],'depth':null}));};break;}return _0x3cbe3a;}})[_0xcf70('0x21')](respondWithResult(_0x35f03c,null))[_0xcf70('0x2b')](handleError(_0x35f03c,null));};exports['addAgents']=function(_0x5ec167,_0x2bf9cb,_0x4b5fe4){return db[_0xcf70('0x44')]['find']({'where':{'id':_0x5ec167[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x2bf9cb,null))[_0xcf70('0x21')](function(_0x5793d3){if(_0x5793d3){return _0x5793d3[_0xcf70('0xe8')](_0x5ec167['body'][_0xcf70('0x70')],_['omit'](_0x5ec167[_0xcf70('0x5f')],['ids','id'])||{})[_0xcf70('0xa5')](function(_0x128765){for(var _0x394f35=0x0;_0x394f35<_0x5ec167['body']['ids']['length'];_0x394f35+=0x1){socket[_0xcf70('0xe9')](_0xcf70('0xea'),{'UserId':Number(_0x5ec167['body']['ids'][_0x394f35]),'SmsAccountId':Number(_0x5ec167[_0xcf70('0x5b')]['id'])});}return _0x128765;});}})[_0xcf70('0x21')](respondWithResult(_0x2bf9cb,null))[_0xcf70('0x2b')](handleError(_0x2bf9cb,null));};exports[_0xcf70('0xeb')]=function(_0x1fb470,_0x37c702,_0x5d18c8){return db['SmsAccount'][_0xcf70('0x5d')]({'where':{'id':_0x1fb470[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x37c702,null))[_0xcf70('0x21')](function(_0x9f6227){if(_0x9f6227){return _0x9f6227['removeAgents'](_0x1fb470[_0xcf70('0x4b')][_0xcf70('0x70')])[_0xcf70('0x21')](function(){if(_['isArray'](_0x1fb470[_0xcf70('0x4b')][_0xcf70('0x70')])){for(var _0x50188b=0x0;_0x50188b<_0x1fb470[_0xcf70('0x4b')][_0xcf70('0x70')]['length'];_0x50188b+=0x1){socket[_0xcf70('0xe9')](_0xcf70('0xec'),{'UserId':Number(_0x1fb470[_0xcf70('0x4b')]['ids'][_0x50188b]),'SmsAccountId':Number(_0x1fb470[_0xcf70('0x5b')]['id'])});}}else{socket[_0xcf70('0xe9')](_0xcf70('0xec'),{'UserId':Number(_0x1fb470[_0xcf70('0x4b')][_0xcf70('0x70')]),'SmsAccountId':Number(_0x1fb470['params']['id'])});}});}})['then'](respondWithStatusCode(_0x37c702,null))['catch'](handleError(_0x37c702,null));};exports[_0xcf70('0xed')]=function(_0x5adada,_0x2f15c3,_0xe18763){var _0x17777f={};var _0x545028={};var _0xcc60ef;var _0x293d09;return db[_0xcf70('0x44')]['findOne']({'where':{'id':_0x5adada[_0xcf70('0x5b')]['id']}})[_0xcf70('0x21')](handleEntityNotFound(_0x2f15c3,null))['then'](function(_0x3b11c8){if(_0x3b11c8){_0xcc60ef=_0x3b11c8;_0x545028[_0xcf70('0x49')]=_[_0xcf70('0x4a')](db[_0xcf70('0xaf')][_0xcf70('0x45')]);_0x545028[_0xcf70('0x4b')]=_['keys'](_0x5adada[_0xcf70('0x4b')]);_0x545028[_0xcf70('0x4c')]=_[_0xcf70('0x4e')](_0x545028[_0xcf70('0x49')],_0x545028[_0xcf70('0x4b')]);_0x17777f[_0xcf70('0x4d')]=_['intersection'](_0x545028[_0xcf70('0x49')],qs[_0xcf70('0x5c')](_0x5adada['query'][_0xcf70('0x5c')]));_0x17777f['attributes']=_0x17777f['attributes'][_0xcf70('0x4f')]?_0x17777f['attributes']:_0x545028[_0xcf70('0x49')];_0x17777f['order']=qs[_0xcf70('0x51')](_0x5adada[_0xcf70('0x4b')][_0xcf70('0x51')]);_0x17777f[_0xcf70('0x52')]=qs[_0xcf70('0x4c')](_[_0xcf70('0x6c')](_0x5adada[_0xcf70('0x4b')],_0x545028[_0xcf70('0x4c')]));if(_0x5adada[_0xcf70('0x4b')]['filter']){_0x17777f[_0xcf70('0x52')]=_['merge'](_0x17777f[_0xcf70('0x52')],{'$or':_[_0xcf70('0x43')](_0x17777f[_0xcf70('0x4d')],function(_0x734306){var _0xd796d9={};_0xd796d9[_0x734306]={'$like':'%'+_0x5adada[_0xcf70('0x4b')][_0xcf70('0x54')]+'%'};return _0xd796d9;})});}_0x17777f=_[_0xcf70('0x55')]({},_0x17777f,_0x5adada[_0xcf70('0x56')]);return _0xcc60ef[_0xcf70('0xed')](_0x17777f);}})[_0xcf70('0x21')](function(_0x4d2bc9){if(_0x4d2bc9){_0x293d09=_0x4d2bc9['length'];if(!_0x5adada[_0xcf70('0x4b')][_0xcf70('0x50')](_0xcf70('0x74'))){_0x17777f['limit']=qs[_0xcf70('0x32')](_0x5adada[_0xcf70('0x4b')][_0xcf70('0x32')]);_0x17777f['offset']=qs['offset'](_0x5adada['query'][_0xcf70('0x2f')]);}return _0xcc60ef['getAgents'](_0x17777f);}})[_0xcf70('0x21')](function(_0x4ec385){if(_0x4ec385){return _0x4ec385?{'count':_0x293d09,'rows':_0x4ec385}:null;}})[_0xcf70('0x21')](respondWithResult(_0x2f15c3,null))[_0xcf70('0x2b')](handleError(_0x2f15c3,null));};
\ No newline at end of file
index 3400b5f..38135ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4326=['hasOwnProperty','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','emit'];(function(_0x1907cd,_0x202496){var _0xc77506=function(_0x1e16a3){while(--_0x1e16a3){_0x1907cd['push'](_0x1907cd['shift']());}};_0xc77506(++_0x202496);}(_0x4326,0x162));var _0x6432=function(_0x47ac7c,_0x3c2627){_0x47ac7c=_0x47ac7c-0x0;var _0x7a5178=_0x4326[_0x47ac7c];return _0x7a5178;};'use strict';var EventEmitter=require(_0x6432('0x0'));var SmsAccount=require(_0x6432('0x1'))['db'][_0x6432('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x6432('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6432('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4b8900){return function(_0x2e4fca,_0xacd453,_0xdd40a8){SmsAccountEvents[_0x6432('0x5')](_0x4b8900+':'+_0x2e4fca['id'],_0x2e4fca);SmsAccountEvents[_0x6432('0x5')](_0x4b8900,_0x2e4fca);_0xdd40a8(null);};}for(var e in events){if(events[_0x6432('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x6432('0x7')]=SmsAccountEvents;
\ No newline at end of file
+var _0x1d09=['SmsAccount','setMaxListeners','save','update','hasOwnProperty','hook','events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d09,0x11e));var _0x91d0=function(_0x34bd34,_0x1444f7){_0x34bd34=_0x34bd34-0x0;var _0x4e36d6=_0x1d09[_0x34bd34];return _0x4e36d6;};'use strict';var EventEmitter=require(_0x91d0('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x91d0('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x91d0('0x2')](0x0);var events={'afterCreate':_0x91d0('0x3'),'afterUpdate':_0x91d0('0x4'),'afterDestroy':'remove'};function emitEvent(_0x371787){return function(_0x773339,_0x5b27f9,_0xd91ce0){SmsAccountEvents['emit'](_0x371787+':'+_0x773339['id'],_0x773339);SmsAccountEvents['emit'](_0x371787,_0x773339);_0xd91ce0(null);};}for(var e in events){if(events[_0x91d0('0x5')](e)){var event=events[e];SmsAccount[_0x91d0('0x6')](e,emitEvent(event));}}module['exports']=SmsAccountEvents;
\ No newline at end of file
index 0779e09..f0d3823 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe413=['../../config/logger','api','moment','path','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts'];(function(_0x2384f6,_0x167775){var _0x370294=function(_0x8f68f4){while(--_0x8f68f4){_0x2384f6['push'](_0x2384f6['shift']());}};_0x370294(++_0x167775);}(_0xe413,0x1d6));var _0x3e41=function(_0x8a164f,_0xdcf66){_0x8a164f=_0x8a164f-0x0;var _0x97400=_0xe413[_0x8a164f];return _0x97400;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3e41('0x0'))(_0x3e41('0x1'));var moment=require(_0x3e41('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e41('0x3'));var rimraf=require(_0x3e41('0x4'));var config=require(_0x3e41('0x5'));var attributes=require(_0x3e41('0x6'));module[_0x3e41('0x7')]=function(_0x1e4963,_0x202dd2){return _0x1e4963[_0x3e41('0x8')]('SmsAccount',attributes,{'tableName':_0x3e41('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x95f8=['api','moment','bluebird','request-promise','path','rimraf','exports','sms_accounts'];(function(_0x10d2e3,_0x55572b){var _0x331450=function(_0x5c9202){while(--_0x5c9202){_0x10d2e3['push'](_0x10d2e3['shift']());}};_0x331450(++_0x55572b);}(_0x95f8,0x150));var _0x895f=function(_0x30da2e,_0x146e54){_0x30da2e=_0x30da2e-0x0;var _0x794139=_0x95f8[_0x30da2e];return _0x794139;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x895f('0x0'));var moment=require(_0x895f('0x1'));var BPromise=require(_0x895f('0x2'));var rp=require(_0x895f('0x3'));var fs=require('fs');var path=require(_0x895f('0x4'));var rimraf=require(_0x895f('0x5'));var config=require('../../config/environment');var attributes=require('./smsAccount.attributes');module[_0x895f('0x6')]=function(_0x45c2d3,_0x4b26f2){return _0x45c2d3['define']('SmsAccount',attributes,{'tableName':_0x895f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 57d5468..b0c19db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0088=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','options','raw','attributes','include','map','model','lodash','util','moment','randomstring'];(function(_0x3a4675,_0x247940){var _0x2d2cf2=function(_0xd9782f){while(--_0xd9782f){_0x3a4675['push'](_0x3a4675['shift']());}};_0x2d2cf2(++_0x247940);}(_0x0088,0x188));var _0x8008=function(_0x50602c,_0x59ada5){_0x50602c=_0x50602c-0x0;var _0x3fa1f6=_0x0088[_0x50602c];return _0x3fa1f6;};'use strict';var _=require(_0x8008('0x0'));var util=require(_0x8008('0x1'));var moment=require(_0x8008('0x2'));var BPromise=require('bluebird');var rs=require(_0x8008('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8008('0x4'));var logger=require(_0x8008('0x5'))('rpc');var config=require(_0x8008('0x6'));var jayson=require(_0x8008('0x7'));var client=jayson['client'][_0x8008('0x8')]({'port':0x232a});config[_0x8008('0x9')]=_[_0x8008('0xa')](config[_0x8008('0x9')],{'host':_0x8008('0xb'),'port':0x18eb});var socket=require(_0x8008('0xc'))(new Redis(config[_0x8008('0x9')]));require('./smsAccount.socket')[_0x8008('0xd')](socket);function respondWithRpcPromise(_0x5c4468,_0x73f7a1,_0x1e2715){return new BPromise(function(_0x176db5,_0xb07cb7){return client[_0x8008('0xe')](_0x5c4468,_0x1e2715)[_0x8008('0xf')](function(_0x579751){logger[_0x8008('0x10')](_0x8008('0x11'),_0x73f7a1,_0x8008('0x12'));logger[_0x8008('0x13')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x73f7a1,_0x8008('0x12'),JSON[_0x8008('0x14')](_0x579751));if(_0x579751[_0x8008('0x15')]){if(_0x579751[_0x8008('0x15')][_0x8008('0x16')]===0x1f4){logger['error'](_0x8008('0x11'),_0x73f7a1,_0x579751[_0x8008('0x15')][_0x8008('0x17')]);return _0xb07cb7(_0x579751[_0x8008('0x15')][_0x8008('0x17')]);}logger[_0x8008('0x15')](_0x8008('0x11'),_0x73f7a1,_0x579751['error'][_0x8008('0x17')]);return _0x176db5(_0x579751[_0x8008('0x15')][_0x8008('0x17')]);}else{logger['info'](_0x8008('0x11'),_0x73f7a1,'request\x20sent');_0x176db5(_0x579751['result']['message']);}})[_0x8008('0x18')](function(_0xade720){logger[_0x8008('0x15')](_0x8008('0x11'),_0x73f7a1,_0xade720);_0xb07cb7(_0xade720);});});}exports[_0x8008('0x19')]=function(_0x5246f1){var _0x24f8ef=this;return new Promise(function(_0x368fcc,_0x37e776){return db[_0x8008('0x1a')]['find']({'raw':_0x5246f1[_0x8008('0x1b')]?_0x5246f1[_0x8008('0x1b')][_0x8008('0x1c')]===undefined?!![]:![]:!![],'where':_0x5246f1[_0x8008('0x1b')]?_0x5246f1[_0x8008('0x1b')]['where']||null:null,'attributes':_0x5246f1[_0x8008('0x1b')]?_0x5246f1[_0x8008('0x1b')][_0x8008('0x1d')]||null:null,'include':_0x5246f1[_0x8008('0x1b')]?_0x5246f1[_0x8008('0x1b')][_0x8008('0x1e')]?_[_0x8008('0x1f')](_0x5246f1[_0x8008('0x1b')][_0x8008('0x1e')],function(_0xbf2b3f){return{'model':db[_0xbf2b3f['model']],'as':_0xbf2b3f['as'],'attributes':_0xbf2b3f[_0x8008('0x1d')],'include':_0xbf2b3f[_0x8008('0x1e')]?_[_0x8008('0x1f')](_0xbf2b3f[_0x8008('0x1e')],function(_0x3e9c57){return{'model':db[_0x3e9c57[_0x8008('0x20')]],'as':_0x3e9c57['as'],'attributes':_0x3e9c57['attributes'],'include':_0x3e9c57['include']?_[_0x8008('0x1f')](_0x3e9c57[_0x8008('0x1e')],function(_0x5377d1){return{'model':db[_0x5377d1[_0x8008('0x20')]],'as':_0x5377d1['as'],'attributes':_0x5377d1[_0x8008('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8008('0xf')](function(_0x846b28){logger[_0x8008('0x10')](_0x8008('0x19'),_0x5246f1);logger['debug'](_0x8008('0x19'),_0x5246f1,JSON[_0x8008('0x14')](_0x846b28));_0x368fcc(_0x846b28);})[_0x8008('0x18')](function(_0xeac74a){logger[_0x8008('0x15')](_0x8008('0x19'),_0xeac74a[_0x8008('0x17')],_0x5246f1);_0x37e776(_0x24f8ef[_0x8008('0x15')](0x1f4,_0xeac74a[_0x8008('0x17')]));});});};
\ No newline at end of file
+var _0x3d03=['request','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch','ShowSmsAccount','find','options','raw','where','include','map','model','attributes','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register'];(function(_0x124e1f,_0x430836){var _0x59f01c=function(_0x31f2e3){while(--_0x31f2e3){_0x124e1f['push'](_0x124e1f['shift']());}};_0x59f01c(++_0x430836);}(_0x3d03,0x134));var _0x33d0=function(_0xeea277,_0x56ce7b){_0xeea277=_0xeea277-0x0;var _0x4a84cb=_0x3d03[_0xeea277];return _0x4a84cb;};'use strict';var _=require(_0x33d0('0x0'));var util=require(_0x33d0('0x1'));var moment=require(_0x33d0('0x2'));var BPromise=require('bluebird');var rs=require(_0x33d0('0x3'));var fs=require('fs');var Redis=require(_0x33d0('0x4'));var db=require(_0x33d0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x33d0('0x6'))(_0x33d0('0x7'));var config=require('../../config/environment');var jayson=require(_0x33d0('0x8'));var client=jayson[_0x33d0('0x9')][_0x33d0('0xa')]({'port':0x232a});config[_0x33d0('0xb')]=_[_0x33d0('0xc')](config[_0x33d0('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x33d0('0xd'))(new Redis(config['redis']));require(_0x33d0('0xe'))[_0x33d0('0xf')](socket);function respondWithRpcPromise(_0x72f34f,_0x4be155,_0x3f3cf5){return new BPromise(function(_0x2c64f8,_0x5d820b){return client[_0x33d0('0x10')](_0x72f34f,_0x3f3cf5)['then'](function(_0x19d176){logger['info'](_0x33d0('0x11'),_0x4be155,'request\x20sent');logger[_0x33d0('0x12')](_0x33d0('0x13'),_0x4be155,_0x33d0('0x14'),JSON[_0x33d0('0x15')](_0x19d176));if(_0x19d176[_0x33d0('0x16')]){if(_0x19d176[_0x33d0('0x16')]['code']===0x1f4){logger[_0x33d0('0x16')](_0x33d0('0x11'),_0x4be155,_0x19d176[_0x33d0('0x16')][_0x33d0('0x17')]);return _0x5d820b(_0x19d176['error']['message']);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x4be155,_0x19d176[_0x33d0('0x16')][_0x33d0('0x17')]);return _0x2c64f8(_0x19d176[_0x33d0('0x16')][_0x33d0('0x17')]);}else{logger[_0x33d0('0x18')](_0x33d0('0x11'),_0x4be155,_0x33d0('0x14'));_0x2c64f8(_0x19d176['result'][_0x33d0('0x17')]);}})[_0x33d0('0x19')](function(_0x314c23){logger['error'](_0x33d0('0x11'),_0x4be155,_0x314c23);_0x5d820b(_0x314c23);});});}exports[_0x33d0('0x1a')]=function(_0x20630e){var _0xab618b=this;return new Promise(function(_0x3b97c7,_0x5566a3){return db['SmsAccount'][_0x33d0('0x1b')]({'raw':_0x20630e[_0x33d0('0x1c')]?_0x20630e[_0x33d0('0x1c')][_0x33d0('0x1d')]===undefined?!![]:![]:!![],'where':_0x20630e[_0x33d0('0x1c')]?_0x20630e['options'][_0x33d0('0x1e')]||null:null,'attributes':_0x20630e[_0x33d0('0x1c')]?_0x20630e[_0x33d0('0x1c')]['attributes']||null:null,'include':_0x20630e[_0x33d0('0x1c')]?_0x20630e[_0x33d0('0x1c')][_0x33d0('0x1f')]?_[_0x33d0('0x20')](_0x20630e[_0x33d0('0x1c')][_0x33d0('0x1f')],function(_0x38cea3){return{'model':db[_0x38cea3[_0x33d0('0x21')]],'as':_0x38cea3['as'],'attributes':_0x38cea3[_0x33d0('0x22')],'include':_0x38cea3[_0x33d0('0x1f')]?_[_0x33d0('0x20')](_0x38cea3[_0x33d0('0x1f')],function(_0x341b64){return{'model':db[_0x341b64['model']],'as':_0x341b64['as'],'attributes':_0x341b64[_0x33d0('0x22')],'include':_0x341b64[_0x33d0('0x1f')]?_[_0x33d0('0x20')](_0x341b64['include'],function(_0x434c43){return{'model':db[_0x434c43[_0x33d0('0x21')]],'as':_0x434c43['as'],'attributes':_0x434c43[_0x33d0('0x22')]};}):[]};}):[]};}):[]:[]})[_0x33d0('0x23')](function(_0x40090c){logger[_0x33d0('0x18')]('ShowSmsAccount',_0x20630e);logger[_0x33d0('0x12')](_0x33d0('0x1a'),_0x20630e,JSON['stringify'](_0x40090c));_0x3b97c7(_0x40090c);})[_0x33d0('0x19')](function(_0x43a028){logger['error'](_0x33d0('0x1a'),_0x43a028[_0x33d0('0x17')],_0x20630e);_0x5566a3(_0xab618b[_0x33d0('0x16')](0x1f4,_0x43a028['message']));});});};
\ No newline at end of file
index bc2fcc9..71d4d24 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
+var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}};
\ No newline at end of file
index 3d0260a..45e01e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router;
\ No newline at end of file
+var _0xe14b=['/:id','create','put','exports','multer','util','express','Router','../../components/auth/service','./smsApplication.controller','get','isAuthenticated','index'];(function(_0x1d24a4,_0x33ad54){var _0x1f1302=function(_0x6a065b){while(--_0x6a065b){_0x1d24a4['push'](_0x1d24a4['shift']());}};_0x1f1302(++_0x33ad54);}(_0xe14b,0x93));var _0xbe14=function(_0x43550b,_0x3c20c4){_0x43550b=_0x43550b-0x0;var _0x1fee0a=_0xe14b[_0x43550b];return _0x1fee0a;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router['delete'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['destroy']);module[_0xbe14('0xc')]=router;
\ No newline at end of file
index 2b7809e..87bf143 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadf1=['noop','TEXT','STRING','*,*,*,*','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xadf1,0xbd));var _0x1adf=function(_0x272cb6,_0xc27708){_0x272cb6=_0x272cb6-0x0;var _0x403cc0=_0xadf1[_0x272cb6];return _0x403cc0;};'use strict';var Sequelize=require('sequelize');module[_0x1adf('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1adf('0x1')},'appdata':{'type':Sequelize[_0x1adf('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1adf('0x3')],'defaultValue':_0x1adf('0x4')}};
\ No newline at end of file
+var _0xaac8=['STRING','noop','TEXT','*,*,*,*'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaac8,0xf8));var _0x8aac=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xaac8[_0x341e0f];return _0x59555a;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x8aac('0x0')],'allowNull':![],'defaultValue':_0x8aac('0x1')},'appdata':{'type':Sequelize[_0x8aac('0x2')]()},'description':{'type':Sequelize[_0x8aac('0x0')]},'interval':{'type':Sequelize[_0x8aac('0x0')],'defaultValue':_0x8aac('0x3')}};
\ No newline at end of file
index 66e962d..5e983e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8885=['type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','then','rows','catch','show','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','error','stack','name','send','map','SmsApplication','rawAttributes','fieldName'];(function(_0x111eaa,_0x85af85){var _0x23676f=function(_0x3c898f){while(--_0x3c898f){_0x111eaa['push'](_0x111eaa['shift']());}};_0x23676f(++_0x85af85);}(_0x8885,0xa7));var _0x5888=function(_0x199978,_0x49ae04){_0x199978=_0x199978-0x0;var _0x537283=_0x8885[_0x199978];return _0x537283;};'use strict';var emlformat=require(_0x5888('0x0'));var rimraf=require(_0x5888('0x1'));var zipdir=require(_0x5888('0x2'));var jsonpatch=require(_0x5888('0x3'));var rp=require(_0x5888('0x4'));var moment=require(_0x5888('0x5'));var BPromise=require(_0x5888('0x6'));var Mustache=require('mustache');var util=require(_0x5888('0x7'));var path=require(_0x5888('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5888('0x9'));var _=require(_0x5888('0xa'));var squel=require('squel');var crypto=require(_0x5888('0xb'));var jsforce=require(_0x5888('0xc'));var deskjs=require(_0x5888('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5888('0xe'));var Redis=require(_0x5888('0xf'));var authService=require(_0x5888('0x10'));var qs=require(_0x5888('0x11'));var as=require(_0x5888('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5888('0x13'))('api');var utils=require(_0x5888('0x14'));var config=require(_0x5888('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5888('0x16'))['db'];function respondWithStatusCode(_0xc8bf23,_0x297f03){_0x297f03=_0x297f03||0xcc;return function(_0x4bceda){if(_0x4bceda){return _0xc8bf23[_0x5888('0x17')](_0x297f03);}return _0xc8bf23[_0x5888('0x18')](_0x297f03)[_0x5888('0x19')]();};}function respondWithResult(_0x4de95e,_0x165bca){_0x165bca=_0x165bca||0xc8;return function(_0x56675d){if(_0x56675d){return _0x4de95e[_0x5888('0x18')](_0x165bca)[_0x5888('0x1a')](_0x56675d);}};}function respondWithFilteredResult(_0x32455a,_0x163602){return function(_0x3dc02e){if(_0x3dc02e){var _0x4a18ef=typeof _0x163602['offset']==='undefined'&&typeof _0x163602[_0x5888('0x1b')]===_0x5888('0x1c');var _0x3f9f9c=_0x3dc02e[_0x5888('0x1d')];var _0x309e09=_0x4a18ef?0x0:_0x163602['offset'];var _0x5d9f72=_0x4a18ef?_0x3dc02e[_0x5888('0x1d')]:_0x163602[_0x5888('0x1e')]+_0x163602[_0x5888('0x1b')];var _0x2ca72a;if(_0x5d9f72>=_0x3f9f9c){_0x5d9f72=_0x3f9f9c;_0x2ca72a=0xc8;}else{_0x2ca72a=0xce;}_0x32455a[_0x5888('0x18')](_0x2ca72a);return _0x32455a['set'](_0x5888('0x1f'),_0x309e09+'-'+_0x5d9f72+'/'+_0x3f9f9c)['json'](_0x3dc02e);}return null;};}function patchUpdates(_0x3e8c38){return function(_0x21f841){try{jsonpatch['apply'](_0x21f841,_0x3e8c38,!![]);}catch(_0x280794){return BPromise[_0x5888('0x20')](_0x280794);}return _0x21f841[_0x5888('0x21')]();};}function saveUpdates(_0x23f461,_0x24b02f){return function(_0x445731){if(_0x445731){return _0x445731[_0x5888('0x22')](_0x23f461)['then'](function(_0x118640){return _0x118640;});}return null;};}function removeEntity(_0x5a558f,_0x224ade){return function(_0x9b3f2c){if(_0x9b3f2c){return _0x9b3f2c['destroy']()['then'](function(){_0x5a558f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31aa2e,_0x3c7f46){return function(_0x2f8e06){if(!_0x2f8e06){_0x31aa2e[_0x5888('0x17')](0x194);}return _0x2f8e06;};}function handleError(_0x3a8b30,_0xae752f){_0xae752f=_0xae752f||0x1f4;return function(_0x3ea28b){logger[_0x5888('0x23')](_0x3ea28b[_0x5888('0x24')]);if(_0x3ea28b[_0x5888('0x25')]){delete _0x3ea28b['name'];}_0x3a8b30[_0x5888('0x18')](_0xae752f)[_0x5888('0x26')](_0x3ea28b);};}exports['index']=function(_0x5201cc,_0x16f1d8){var _0x492145={},_0x51c070={},_0xd62c08={'count':0x0,'rows':[]};var _0x1e1d3c=_[_0x5888('0x27')](db[_0x5888('0x28')][_0x5888('0x29')],function(_0x97110){return{'name':_0x97110[_0x5888('0x2a')],'type':_0x97110[_0x5888('0x2b')]['key']};});_0x51c070[_0x5888('0x2c')]=_[_0x5888('0x27')](_0x1e1d3c,_0x5888('0x25'));_0x51c070[_0x5888('0x2d')]=_[_0x5888('0x2e')](_0x5201cc['query']);_0x51c070[_0x5888('0x2f')]=_[_0x5888('0x30')](_0x51c070['model'],_0x51c070[_0x5888('0x2d')]);_0x492145[_0x5888('0x31')]=_[_0x5888('0x30')](_0x51c070[_0x5888('0x2c')],qs[_0x5888('0x32')](_0x5201cc['query'][_0x5888('0x32')]));_0x492145[_0x5888('0x31')]=_0x492145[_0x5888('0x31')][_0x5888('0x33')]?_0x492145['attributes']:_0x51c070[_0x5888('0x2c')];if(!_0x5201cc[_0x5888('0x2d')][_0x5888('0x34')]('nolimit')){_0x492145['limit']=qs['limit'](_0x5201cc[_0x5888('0x2d')][_0x5888('0x1b')]);_0x492145[_0x5888('0x1e')]=qs[_0x5888('0x1e')](_0x5201cc[_0x5888('0x2d')][_0x5888('0x1e')]);}_0x492145[_0x5888('0x35')]=qs[_0x5888('0x36')](_0x5201cc[_0x5888('0x2d')][_0x5888('0x36')]);_0x492145[_0x5888('0x37')]=qs['filters'](_['pick'](_0x5201cc['query'],_0x51c070[_0x5888('0x2f')]),_0x1e1d3c);if(_0x5201cc[_0x5888('0x2d')][_0x5888('0x38')]){_0x492145['where']=_[_0x5888('0x39')](_0x492145[_0x5888('0x37')],{'$or':_['map'](_0x1e1d3c,function(_0x38ce86){if(_0x38ce86[_0x5888('0x2b')]!==_0x5888('0x3a')){var _0x8be960={};_0x8be960[_0x38ce86[_0x5888('0x25')]]={'$like':'%'+_0x5201cc[_0x5888('0x2d')]['filter']+'%'};return _0x8be960;}})});}_0x492145=_[_0x5888('0x39')]({},_0x492145,_0x5201cc['options']);var _0x74cb1={'where':_0x492145[_0x5888('0x37')]};return db[_0x5888('0x28')][_0x5888('0x1d')](_0x74cb1)['then'](function(_0x302c8a){_0xd62c08['count']=_0x302c8a;if(_0x5201cc[_0x5888('0x2d')][_0x5888('0x3b')]){_0x492145['include']=[{'all':!![]}];}return db[_0x5888('0x28')][_0x5888('0x3c')](_0x492145);})[_0x5888('0x3d')](function(_0x1aa904){_0xd62c08[_0x5888('0x3e')]=_0x1aa904;return _0xd62c08;})[_0x5888('0x3d')](respondWithFilteredResult(_0x16f1d8,_0x492145))[_0x5888('0x3f')](handleError(_0x16f1d8,null));};exports[_0x5888('0x40')]=function(_0x4a52ce,_0x200e8d){var _0x5c962b={'raw':!![],'where':{'id':_0x4a52ce['params']['id']}},_0x2c9f81={};_0x2c9f81['model']=_['keys'](db[_0x5888('0x28')][_0x5888('0x29')]);_0x2c9f81['query']=_[_0x5888('0x2e')](_0x4a52ce['query']);_0x2c9f81['filters']=_[_0x5888('0x30')](_0x2c9f81['model'],_0x2c9f81['query']);_0x5c962b[_0x5888('0x31')]=_[_0x5888('0x30')](_0x2c9f81[_0x5888('0x2c')],qs['fields'](_0x4a52ce[_0x5888('0x2d')][_0x5888('0x32')]));_0x5c962b[_0x5888('0x31')]=_0x5c962b[_0x5888('0x31')][_0x5888('0x33')]?_0x5c962b[_0x5888('0x31')]:_0x2c9f81[_0x5888('0x2c')];if(_0x4a52ce['query'][_0x5888('0x3b')]){_0x5c962b['include']=[{'all':!![]}];}_0x5c962b=_[_0x5888('0x39')]({},_0x5c962b,_0x4a52ce['options']);return db[_0x5888('0x28')][_0x5888('0x41')](_0x5c962b)[_0x5888('0x3d')](handleEntityNotFound(_0x200e8d,null))[_0x5888('0x3d')](respondWithResult(_0x200e8d,null))[_0x5888('0x3f')](handleError(_0x200e8d,null));};exports['create']=function(_0x428d7b,_0x453f93){return db[_0x5888('0x28')][_0x5888('0x42')](_0x428d7b[_0x5888('0x43')],{})[_0x5888('0x3d')](respondWithResult(_0x453f93,0xc9))[_0x5888('0x3f')](handleError(_0x453f93,null));};exports['update']=function(_0x3aa230,_0x7bb2cd){if(_0x3aa230[_0x5888('0x43')]['id']){delete _0x3aa230[_0x5888('0x43')]['id'];}return db[_0x5888('0x28')][_0x5888('0x41')]({'where':{'id':_0x3aa230[_0x5888('0x44')]['id']}})[_0x5888('0x3d')](handleEntityNotFound(_0x7bb2cd,null))['then'](saveUpdates(_0x3aa230['body'],null))[_0x5888('0x3d')](respondWithResult(_0x7bb2cd,null))[_0x5888('0x3f')](handleError(_0x7bb2cd,null));};exports[_0x5888('0x45')]=function(_0x3ad7d9,_0x5be175){return db['SmsApplication'][_0x5888('0x41')]({'where':{'id':_0x3ad7d9[_0x5888('0x44')]['id']}})['then'](handleEntityNotFound(_0x5be175,null))['then'](removeEntity(_0x5be175,null))[_0x5888('0x3f')](handleError(_0x5be175,null));};
\ No newline at end of file
+var _0xf4c9=['crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','name','send','index','map','SmsApplication','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','destroy','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4c9,0x83));var _0x9f4c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf4c9[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x9f4c('0x0'));var rimraf=require(_0x9f4c('0x1'));var zipdir=require(_0x9f4c('0x2'));var jsonpatch=require(_0x9f4c('0x3'));var rp=require('request-promise');var moment=require(_0x9f4c('0x4'));var BPromise=require(_0x9f4c('0x5'));var Mustache=require(_0x9f4c('0x6'));var util=require(_0x9f4c('0x7'));var path=require(_0x9f4c('0x8'));var sox=require('sox');var csv=require(_0x9f4c('0x9'));var ejs=require(_0x9f4c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9f4c('0xb'));var jsforce=require(_0x9f4c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9f4c('0x9'));var querystring=require(_0x9f4c('0xd'));var Papa=require(_0x9f4c('0xe'));var Redis=require(_0x9f4c('0xf'));var authService=require(_0x9f4c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9f4c('0x11'));var hardwareService=require(_0x9f4c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x9f4c('0x13'));var config=require(_0x9f4c('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x451368,_0x369546){_0x369546=_0x369546||0xcc;return function(_0x5aef51){if(_0x5aef51){return _0x451368['sendStatus'](_0x369546);}return _0x451368[_0x9f4c('0x15')](_0x369546)[_0x9f4c('0x16')]();};}function respondWithResult(_0x443ed5,_0x394bc6){_0x394bc6=_0x394bc6||0xc8;return function(_0x170d77){if(_0x170d77){return _0x443ed5[_0x9f4c('0x15')](_0x394bc6)[_0x9f4c('0x17')](_0x170d77);}};}function respondWithFilteredResult(_0x321443,_0x19191b){return function(_0xcb9c8a){if(_0xcb9c8a){var _0x2de07e=typeof _0x19191b['offset']===_0x9f4c('0x18')&&typeof _0x19191b[_0x9f4c('0x19')]==='undefined';var _0x2c1f67=_0xcb9c8a[_0x9f4c('0x1a')];var _0x4cf399=_0x2de07e?0x0:_0x19191b[_0x9f4c('0x1b')];var _0x2823a7=_0x2de07e?_0xcb9c8a[_0x9f4c('0x1a')]:_0x19191b['offset']+_0x19191b['limit'];var _0x3fdada;if(_0x2823a7>=_0x2c1f67){_0x2823a7=_0x2c1f67;_0x3fdada=0xc8;}else{_0x3fdada=0xce;}_0x321443[_0x9f4c('0x15')](_0x3fdada);return _0x321443[_0x9f4c('0x1c')](_0x9f4c('0x1d'),_0x4cf399+'-'+_0x2823a7+'/'+_0x2c1f67)[_0x9f4c('0x17')](_0xcb9c8a);}return null;};}function patchUpdates(_0xf48909){return function(_0xaa7f36){try{jsonpatch['apply'](_0xaa7f36,_0xf48909,!![]);}catch(_0x32869b){return BPromise[_0x9f4c('0x1e')](_0x32869b);}return _0xaa7f36[_0x9f4c('0x1f')]();};}function saveUpdates(_0x53902d,_0xf86944){return function(_0x37892e){if(_0x37892e){return _0x37892e[_0x9f4c('0x20')](_0x53902d)['then'](function(_0x27fb36){return _0x27fb36;});}return null;};}function removeEntity(_0x28a822,_0x2eae3c){return function(_0x55b405){if(_0x55b405){return _0x55b405['destroy']()[_0x9f4c('0x21')](function(){_0x28a822[_0x9f4c('0x15')](0xcc)[_0x9f4c('0x16')]();});}};}function handleEntityNotFound(_0x5a916f,_0x157466){return function(_0x4cd7f6){if(!_0x4cd7f6){_0x5a916f['sendStatus'](0x194);}return _0x4cd7f6;};}function handleError(_0x467ee4,_0x561f1d){_0x561f1d=_0x561f1d||0x1f4;return function(_0x33f237){logger[_0x9f4c('0x22')](_0x33f237['stack']);if(_0x33f237[_0x9f4c('0x23')]){delete _0x33f237[_0x9f4c('0x23')];}_0x467ee4[_0x9f4c('0x15')](_0x561f1d)[_0x9f4c('0x24')](_0x33f237);};}exports[_0x9f4c('0x25')]=function(_0x28aa6f,_0x3c9775){var _0x50ed19={},_0x27463f={},_0x2e8e17={'count':0x0,'rows':[]};var _0x3e0024=_[_0x9f4c('0x26')](db[_0x9f4c('0x27')]['rawAttributes'],function(_0x15a1ae){return{'name':_0x15a1ae[_0x9f4c('0x28')],'type':_0x15a1ae[_0x9f4c('0x29')][_0x9f4c('0x2a')]};});_0x27463f[_0x9f4c('0x2b')]=_['map'](_0x3e0024,'name');_0x27463f[_0x9f4c('0x2c')]=_[_0x9f4c('0x2d')](_0x28aa6f[_0x9f4c('0x2c')]);_0x27463f[_0x9f4c('0x2e')]=_[_0x9f4c('0x2f')](_0x27463f['model'],_0x27463f[_0x9f4c('0x2c')]);_0x50ed19[_0x9f4c('0x30')]=_[_0x9f4c('0x2f')](_0x27463f[_0x9f4c('0x2b')],qs[_0x9f4c('0x31')](_0x28aa6f['query'][_0x9f4c('0x31')]));_0x50ed19[_0x9f4c('0x30')]=_0x50ed19['attributes']['length']?_0x50ed19[_0x9f4c('0x30')]:_0x27463f[_0x9f4c('0x2b')];if(!_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x32')](_0x9f4c('0x33'))){_0x50ed19[_0x9f4c('0x19')]=qs['limit'](_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x19')]);_0x50ed19[_0x9f4c('0x1b')]=qs[_0x9f4c('0x1b')](_0x28aa6f[_0x9f4c('0x2c')]['offset']);}_0x50ed19[_0x9f4c('0x34')]=qs[_0x9f4c('0x35')](_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x35')]);_0x50ed19[_0x9f4c('0x36')]=qs[_0x9f4c('0x2e')](_['pick'](_0x28aa6f[_0x9f4c('0x2c')],_0x27463f['filters']),_0x3e0024);if(_0x28aa6f['query'][_0x9f4c('0x37')]){_0x50ed19[_0x9f4c('0x36')]=_[_0x9f4c('0x38')](_0x50ed19[_0x9f4c('0x36')],{'$or':_[_0x9f4c('0x26')](_0x3e0024,function(_0x526f83){if(_0x526f83[_0x9f4c('0x29')]!==_0x9f4c('0x39')){var _0xa2a02c={};_0xa2a02c[_0x526f83[_0x9f4c('0x23')]]={'$like':'%'+_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x37')]+'%'};return _0xa2a02c;}})});}_0x50ed19=_[_0x9f4c('0x38')]({},_0x50ed19,_0x28aa6f[_0x9f4c('0x3a')]);var _0x50da83={'where':_0x50ed19['where']};return db[_0x9f4c('0x27')][_0x9f4c('0x1a')](_0x50da83)[_0x9f4c('0x21')](function(_0x22f7e6){_0x2e8e17['count']=_0x22f7e6;if(_0x28aa6f[_0x9f4c('0x2c')][_0x9f4c('0x3b')]){_0x50ed19[_0x9f4c('0x3c')]=[{'all':!![]}];}return db[_0x9f4c('0x27')][_0x9f4c('0x3d')](_0x50ed19);})[_0x9f4c('0x21')](function(_0xad1f63){_0x2e8e17[_0x9f4c('0x3e')]=_0xad1f63;return _0x2e8e17;})[_0x9f4c('0x21')](respondWithFilteredResult(_0x3c9775,_0x50ed19))[_0x9f4c('0x3f')](handleError(_0x3c9775,null));};exports[_0x9f4c('0x40')]=function(_0x33875d,_0x5487ab){var _0x256d6b={'raw':!![],'where':{'id':_0x33875d[_0x9f4c('0x41')]['id']}},_0x4fecd9={};_0x4fecd9['model']=_[_0x9f4c('0x2d')](db['SmsApplication'][_0x9f4c('0x42')]);_0x4fecd9[_0x9f4c('0x2c')]=_[_0x9f4c('0x2d')](_0x33875d['query']);_0x4fecd9['filters']=_['intersection'](_0x4fecd9['model'],_0x4fecd9[_0x9f4c('0x2c')]);_0x256d6b[_0x9f4c('0x30')]=_[_0x9f4c('0x2f')](_0x4fecd9['model'],qs[_0x9f4c('0x31')](_0x33875d['query'][_0x9f4c('0x31')]));_0x256d6b[_0x9f4c('0x30')]=_0x256d6b['attributes']['length']?_0x256d6b[_0x9f4c('0x30')]:_0x4fecd9['model'];if(_0x33875d[_0x9f4c('0x2c')][_0x9f4c('0x3b')]){_0x256d6b[_0x9f4c('0x3c')]=[{'all':!![]}];}_0x256d6b=_[_0x9f4c('0x38')]({},_0x256d6b,_0x33875d[_0x9f4c('0x3a')]);return db['SmsApplication']['find'](_0x256d6b)[_0x9f4c('0x21')](handleEntityNotFound(_0x5487ab,null))['then'](respondWithResult(_0x5487ab,null))[_0x9f4c('0x3f')](handleError(_0x5487ab,null));};exports[_0x9f4c('0x43')]=function(_0xf1f3e5,_0x28998f){return db[_0x9f4c('0x27')][_0x9f4c('0x43')](_0xf1f3e5[_0x9f4c('0x44')],{})[_0x9f4c('0x21')](respondWithResult(_0x28998f,0xc9))['catch'](handleError(_0x28998f,null));};exports[_0x9f4c('0x20')]=function(_0x1fcc57,_0x4502da){if(_0x1fcc57[_0x9f4c('0x44')]['id']){delete _0x1fcc57[_0x9f4c('0x44')]['id'];}return db[_0x9f4c('0x27')]['find']({'where':{'id':_0x1fcc57['params']['id']}})[_0x9f4c('0x21')](handleEntityNotFound(_0x4502da,null))[_0x9f4c('0x21')](saveUpdates(_0x1fcc57[_0x9f4c('0x44')],null))[_0x9f4c('0x21')](respondWithResult(_0x4502da,null))['catch'](handleError(_0x4502da,null));};exports[_0x9f4c('0x45')]=function(_0xa77448,_0x3ed42c){return db[_0x9f4c('0x27')][_0x9f4c('0x46')]({'where':{'id':_0xa77448[_0x9f4c('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ed42c,null))[_0x9f4c('0x21')](removeEntity(_0x3ed42c,null))[_0x9f4c('0x3f')](handleError(_0x3ed42c,null));};
\ No newline at end of file
index 3af4038..0adb7d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x66d6=['../../config/environment','./smsApplication.attributes','exports','define','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x389130,_0x411fa8){var _0x522259=function(_0x411513){while(--_0x411513){_0x389130['push'](_0x389130['shift']());}};_0x522259(++_0x411fa8);}(_0x66d6,0x1c7));var _0x666d=function(_0x437aa2,_0x48d508){_0x437aa2=_0x437aa2-0x0;var _0x28ac4d=_0x66d6[_0x437aa2];return _0x28ac4d;};'use strict';var _=require(_0x666d('0x0'));var util=require('util');var logger=require(_0x666d('0x1'))(_0x666d('0x2'));var moment=require(_0x666d('0x3'));var BPromise=require('bluebird');var rp=require(_0x666d('0x4'));var fs=require('fs');var path=require(_0x666d('0x5'));var rimraf=require(_0x666d('0x6'));var config=require(_0x666d('0x7'));var attributes=require(_0x666d('0x8'));module[_0x666d('0x9')]=function(_0x5490df,_0x5a0af9){return _0x5490df[_0x666d('0xa')]('SmsApplication',attributes,{'tableName':_0x666d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x666d('0xc'),'collate':_0x666d('0xd')});};
\ No newline at end of file
+var _0x2e9f=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x230078,_0x40e1b4){var _0x379ab7=function(_0x39675e){while(--_0x39675e){_0x230078['push'](_0x230078['shift']());}};_0x379ab7(++_0x40e1b4);}(_0x2e9f,0xc7));var _0xf2e9=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x2e9f[_0x160c73];return _0xd9302;};'use strict';var _=require(_0xf2e9('0x0'));var util=require(_0xf2e9('0x1'));var logger=require(_0xf2e9('0x2'))(_0xf2e9('0x3'));var moment=require(_0xf2e9('0x4'));var BPromise=require(_0xf2e9('0x5'));var rp=require(_0xf2e9('0x6'));var fs=require('fs');var path=require(_0xf2e9('0x7'));var rimraf=require(_0xf2e9('0x8'));var config=require(_0xf2e9('0x9'));var attributes=require(_0xf2e9('0xa'));module[_0xf2e9('0xb')]=function(_0x581373,_0x51f86e){return _0x581373[_0xf2e9('0xc')](_0xf2e9('0xd'),attributes,{'tableName':_0xf2e9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf2e9('0xf'),'collate':_0xf2e9('0x10')});};
\ No newline at end of file
index bf44093..dacb79c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b47=['result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x502bb3,_0x5aad61){var _0x3e5771=function(_0x549f5d){while(--_0x549f5d){_0x502bb3['push'](_0x502bb3['shift']());}};_0x3e5771(++_0x5aad61);}(_0x2b47,0x177));var _0x72b4=function(_0x1ec978,_0xe42c4){_0x1ec978=_0x1ec978-0x0;var _0x3040e5=_0x2b47[_0x1ec978];return _0x3040e5;};'use strict';var _=require(_0x72b4('0x0'));var util=require('util');var moment=require(_0x72b4('0x1'));var BPromise=require(_0x72b4('0x2'));var rs=require(_0x72b4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72b4('0x4'))['db'];var utils=require(_0x72b4('0x5'));var logger=require(_0x72b4('0x6'))(_0x72b4('0x7'));var config=require(_0x72b4('0x8'));var jayson=require(_0x72b4('0x9'));var client=jayson['client'][_0x72b4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x480984,_0x104f08,_0x1c90aa){return new BPromise(function(_0xb1e42f,_0x1bdf7f){return client[_0x72b4('0xb')](_0x480984,_0x1c90aa)[_0x72b4('0xc')](function(_0x114a98){logger[_0x72b4('0xd')](_0x72b4('0xe'),_0x104f08,_0x72b4('0xf'));logger[_0x72b4('0x10')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x104f08,_0x72b4('0xf'),JSON[_0x72b4('0x11')](_0x114a98));if(_0x114a98[_0x72b4('0x12')]){if(_0x114a98[_0x72b4('0x12')][_0x72b4('0x13')]===0x1f4){logger[_0x72b4('0x12')](_0x72b4('0xe'),_0x104f08,_0x114a98[_0x72b4('0x12')][_0x72b4('0x14')]);return _0x1bdf7f(_0x114a98[_0x72b4('0x12')][_0x72b4('0x14')]);}logger['error'](_0x72b4('0xe'),_0x104f08,_0x114a98[_0x72b4('0x12')][_0x72b4('0x14')]);return _0xb1e42f(_0x114a98[_0x72b4('0x12')]['message']);}else{logger['info'](_0x72b4('0xe'),_0x104f08,'request\x20sent');_0xb1e42f(_0x114a98[_0x72b4('0x15')][_0x72b4('0x14')]);}})['catch'](function(_0x2a9c37){logger[_0x72b4('0x12')](_0x72b4('0xe'),_0x104f08,_0x2a9c37);_0x1bdf7f(_0x2a9c37);});});}
\ No newline at end of file
+var _0x2b29=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x2b29,0x163));var _0x92b2=function(_0x4f7f2f,_0x48b7d6){_0x4f7f2f=_0x4f7f2f-0x0;var _0x1ba18d=_0x2b29[_0x4f7f2f];return _0x1ba18d;};'use strict';var _=require('lodash');var util=require(_0x92b2('0x0'));var moment=require(_0x92b2('0x1'));var BPromise=require(_0x92b2('0x2'));var rs=require(_0x92b2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x92b2('0x4'))['db'];var utils=require(_0x92b2('0x5'));var logger=require(_0x92b2('0x6'))(_0x92b2('0x7'));var config=require(_0x92b2('0x8'));var jayson=require(_0x92b2('0x9'));var client=jayson['client'][_0x92b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536e21,_0x29f183,_0x43a292){return new BPromise(function(_0x5c1d94,_0x3e2204){return client[_0x92b2('0xb')](_0x536e21,_0x43a292)[_0x92b2('0xc')](function(_0x465011){logger['info'](_0x92b2('0xd'),_0x29f183,_0x92b2('0xe'));logger[_0x92b2('0xf')](_0x92b2('0x10'),_0x29f183,_0x92b2('0xe'),JSON[_0x92b2('0x11')](_0x465011));if(_0x465011[_0x92b2('0x12')]){if(_0x465011['error'][_0x92b2('0x13')]===0x1f4){logger[_0x92b2('0x12')](_0x92b2('0xd'),_0x29f183,_0x465011['error'][_0x92b2('0x14')]);return _0x3e2204(_0x465011[_0x92b2('0x12')][_0x92b2('0x14')]);}logger[_0x92b2('0x12')](_0x92b2('0xd'),_0x29f183,_0x465011[_0x92b2('0x12')]['message']);return _0x5c1d94(_0x465011[_0x92b2('0x12')]['message']);}else{logger[_0x92b2('0x15')](_0x92b2('0xd'),_0x29f183,_0x92b2('0xe'));_0x5c1d94(_0x465011['result']['message']);}})[_0x92b2('0x16')](function(_0x5a2912){logger[_0x92b2('0x12')]('SmsApplication,\x20%s,\x20%s',_0x29f183,_0x5a2912);_0x3e2204(_0x5a2912);});});}
\ No newline at end of file
index b8f5c72..6672602 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x087b=['sms','smsinteraction:addtags','addTags','put','update','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked'];(function(_0x47b0d9,_0x41b561){var _0x599df3=function(_0x4c0c30){while(--_0x4c0c30){_0x47b0d9['push'](_0x47b0d9['shift']());}};_0x599df3(++_0x41b561);}(_0x087b,0x11a));var _0xb087=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x087b[_0x4b7895];return _0x264180;};'use strict';var multer=require(_0xb087('0x0'));var util=require(_0xb087('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb087('0x2'));var router=express['Router']();var fs_extra=require(_0xb087('0x3'));var auth=require(_0xb087('0x4'));var interaction=require(_0xb087('0x5'));var config=require(_0xb087('0x6'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/messages',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x12')]('/',auth['isAuthenticated'](),controller[_0xb087('0x13')]);router[_0xb087('0x12')](_0xb087('0x14'),auth['isAuthenticated'](),controller[_0xb087('0x15')]);router[_0xb087('0x12')](_0xb087('0x16'),auth[_0xb087('0x9')](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x19')),controller[_0xb087('0x1a')]);router[_0xb087('0x1b')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),'smsinteraction:update'),controller[_0xb087('0x1c')]);router[_0xb087('0x1d')](_0xb087('0xd'),auth['isAuthenticated'](),interaction[_0xb087('0x17')](_0xb087('0x18'),_0xb087('0x1e')),controller[_0xb087('0x1f')]);router['delete'](_0xb087('0x16'),auth[_0xb087('0x9')](),controller[_0xb087('0x20')]);module[_0xb087('0x21')]=router;
\ No newline at end of file
+var _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x121be0,_0x563c36){var _0x3d965a=function(_0x1c526d){while(--_0x1c526d){_0x121be0['push'](_0x121be0['shift']());}};_0x3d965a(++_0x563c36);}(_0x4fc2,0x111));var _0x24fc=function(_0x4445a9,_0x4d7cc8){_0x4445a9=_0x4445a9-0x0;var _0x18d7f8=_0x4fc2[_0x4445a9];return _0x18d7f8;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router;
\ No newline at end of file
index 9e4ad0a..835a0d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x30fc=['STRING','ENUM','out','INTEGER','sequelize','moment','BOOLEAN','DATE'];(function(_0x5914a3,_0x22e240){var _0x25af13=function(_0x33c161){while(--_0x33c161){_0x5914a3['push'](_0x5914a3['shift']());}};_0x25af13(++_0x22e240);}(_0x30fc,0x64));var _0xc30f=function(_0x533ffd,_0x547e7b){_0x533ffd=_0x533ffd-0x0;var _0x1069f5=_0x30fc[_0x533ffd];return _0x1069f5;};'use strict';var Sequelize=require(_0xc30f('0x0'));var moment=require(_0xc30f('0x1'));module['exports']={'closed':{'type':Sequelize[_0xc30f('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc30f('0x3')]},'disposition':{'type':Sequelize[_0xc30f('0x4')]},'secondDisposition':{'type':Sequelize[_0xc30f('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xc30f('0x4')]},'phone':{'type':Sequelize[_0xc30f('0x4')]},'read1stAt':{'type':Sequelize[_0xc30f('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xc30f('0x5')]('in',_0xc30f('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc30f('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc30f('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc30f('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc30f('0x7')]}};
\ No newline at end of file
+var _0xd448=['exports','BOOLEAN','DATE','STRING','out','INTEGER','moment'];(function(_0x546895,_0xb414da){var _0x3b5a09=function(_0x1da01c){while(--_0x1da01c){_0x546895['push'](_0x546895['shift']());}};_0x3b5a09(++_0xb414da);}(_0xd448,0x172));var _0x8d44=function(_0x52b701,_0x435f59){_0x52b701=_0x52b701-0x0;var _0x39387c=_0xd448[_0x52b701];return _0x39387c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x8d44('0x0'));module[_0x8d44('0x1')]={'closed':{'type':Sequelize[_0x8d44('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8d44('0x3')]},'disposition':{'type':Sequelize[_0x8d44('0x4')]},'secondDisposition':{'type':Sequelize[_0x8d44('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8d44('0x4')]},'note':{'type':Sequelize[_0x8d44('0x4')]},'phone':{'type':Sequelize[_0x8d44('0x4')]},'read1stAt':{'type':Sequelize[_0x8d44('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x8d44('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8d44('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x8d44('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8d44('0x6')]}};
\ No newline at end of file
index 77cdc3b..1b5a7a9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x31e3=['log','err','rimraf','zip-dir','moment','util','path','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','defaults','localhost','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','sms','query','user','catch','show','params','filters','intersection','attributes','fields','length','model','include','merge','options','body','describe','addMessage','SmsMessage','find','ids','getMessages','findOne','keys','hasOwnProperty','order','sort','where','pick','map','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','omit','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','User','fullname','CmContact','firstName','lastName','Messages','createdAt','direction','secret','push','SmsAccount','Account','Owner','Sms','N.A.','format','closedAt','disposition','out','System','Contact','read','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML'];(function(_0x5773e7,_0x435e69){var _0x5e6621=function(_0x112829){while(--_0x112829){_0x5773e7['push'](_0x5773e7['shift']());}};_0x5e6621(++_0x435e69);}(_0x31e3,0xf4));var _0x331e=function(_0x15073d,_0x49aad5){_0x15073d=_0x15073d-0x0;var _0x4eff5d=_0x31e3[_0x15073d];return _0x4eff5d;};'use strict';var rimraf=require(_0x331e('0x0'));var zipdir=require(_0x331e('0x1'));var moment=require(_0x331e('0x2'));var BPromise=require('bluebird');var util=require(_0x331e('0x3'));var path=require(_0x331e('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x331e('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x331e('0x6'));var pdf=require(_0x331e('0x7'));var logger=require(_0x331e('0x8'))(_0x331e('0x9'));var config=require('../../config/environment');var db=require(_0x331e('0xa'))['db'];config['redis']=_[_0x331e('0xb')](config['redis'],{'host':_0x331e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x331e('0xd')]));require('./smsInteraction.socket')[_0x331e('0xe')](socket);function respondWithStatusCode(_0x2fee33,_0x44c9ed){_0x44c9ed=_0x44c9ed||0xcc;return function(_0x4ff7cc){if(_0x4ff7cc){return _0x2fee33[_0x331e('0xf')](_0x44c9ed);}return _0x2fee33[_0x331e('0x10')](_0x44c9ed)[_0x331e('0x11')]();};}function respondWithResult(_0x3cc015,_0x185641){_0x185641=_0x185641||0xc8;return function(_0x455659){if(_0x455659){return _0x3cc015[_0x331e('0x10')](_0x185641)[_0x331e('0x12')](_0x455659);}};}function respondWithFilteredResult(_0x73b9b2,_0x1fa41b){return function(_0x564bf8){if(_0x564bf8){var _0x3e9208=typeof _0x1fa41b[_0x331e('0x13')]===_0x331e('0x14')&&typeof _0x1fa41b[_0x331e('0x15')]==='undefined';var _0x25423d=_0x564bf8['count'];var _0x2f00f=_0x3e9208?0x0:_0x1fa41b[_0x331e('0x13')];var _0x40954b=_0x3e9208?_0x564bf8[_0x331e('0x16')]:_0x1fa41b[_0x331e('0x13')]+_0x1fa41b[_0x331e('0x15')];var _0x4ea679;if(_0x40954b>=_0x25423d){_0x40954b=_0x25423d;_0x4ea679=0xc8;}else{_0x4ea679=0xce;}_0x73b9b2[_0x331e('0x10')](_0x4ea679);return _0x73b9b2[_0x331e('0x17')](_0x331e('0x18'),_0x2f00f+'-'+_0x40954b+'/'+_0x25423d)[_0x331e('0x12')](_0x564bf8);}return null;};}function saveUpdates(_0x4049d7){return function(_0x4fc9e0){if(_0x4fc9e0){return _0x4fc9e0[_0x331e('0x19')](_0x4049d7)[_0x331e('0x1a')](function(_0x3f3d52){return _0x3f3d52;});}return null;};}function removeEntity(_0xa73fee){return function(_0x3d3c20){if(_0x3d3c20){return _0x3d3c20[_0x331e('0x1b')]()[_0x331e('0x1a')](function(){_0xa73fee['status'](0xcc)[_0x331e('0x11')]();});}};}function handleEntityNotFound(_0x489a85){return function(_0x5b7921){if(!_0x5b7921){_0x489a85[_0x331e('0xf')](0x194);}return _0x5b7921;};}function handleError(_0xc08882,_0x592a5a){_0x592a5a=_0x592a5a||0x1f4;return function(_0x22dbcb){logger[_0x331e('0x1c')](_0x22dbcb[_0x331e('0x1d')]);if(_0x22dbcb[_0x331e('0x1e')]){delete _0x22dbcb[_0x331e('0x1e')];}_0xc08882[_0x331e('0x10')](_0x592a5a)[_0x331e('0x1f')](_0x22dbcb);};}exports[_0x331e('0x20')]=function(_0x4e0bf0,_0x5831c5){var _0x164d29={};var _0x423468=_['map'](db[_0x331e('0x21')][_0x331e('0x22')],function(_0x12ec67){return{'name':_0x12ec67[_0x331e('0x23')],'type':_0x12ec67[_0x331e('0x24')][_0x331e('0x25')]};});_0x164d29=qs[_0x331e('0x26')](_0x423468,_0x4e0bf0);return interaction['findAll'](_0x331e('0x27'),_0x4e0bf0[_0x331e('0x28')],_0x4e0bf0[_0x331e('0x29')],_0x164d29,_0x423468)[_0x331e('0x1a')](respondWithFilteredResult(_0x5831c5,_0x164d29))[_0x331e('0x2a')](handleError(_0x5831c5,null));};exports[_0x331e('0x2b')]=function(_0x2f72ca,_0x357a13){var _0x3a4685={'raw':![],'where':{'id':_0x2f72ca[_0x331e('0x2c')]['id']}},_0x9b9bee={};_0x9b9bee['model']=_['keys'](db['SmsInteraction'][_0x331e('0x22')]);_0x9b9bee['query']=_['keys'](_0x2f72ca['query']);_0x9b9bee[_0x331e('0x2d')]=_[_0x331e('0x2e')](_0x9b9bee['model'],_0x9b9bee[_0x331e('0x28')]);_0x3a4685[_0x331e('0x2f')]=_[_0x331e('0x2e')](_0x9b9bee['model'],qs[_0x331e('0x30')](_0x2f72ca['query'][_0x331e('0x30')]));_0x3a4685[_0x331e('0x2f')]=_0x3a4685[_0x331e('0x2f')][_0x331e('0x31')]?_0x3a4685[_0x331e('0x2f')]:_0x9b9bee[_0x331e('0x32')];if(_0x2f72ca[_0x331e('0x28')]['includeAll']){_0x3a4685[_0x331e('0x33')]=[{'all':!![]}];}_0x3a4685=_[_0x331e('0x34')]({},_0x3a4685,_0x2f72ca[_0x331e('0x35')]);return db['SmsInteraction']['find'](_0x3a4685)['then'](handleEntityNotFound(_0x357a13,null))[_0x331e('0x1a')](respondWithResult(_0x357a13,null))['catch'](handleError(_0x357a13,null));};exports['create']=function(_0x5dcb3c,_0x57a12f){return db[_0x331e('0x21')]['create'](_0x5dcb3c[_0x331e('0x36')],{})[_0x331e('0x1a')](respondWithResult(_0x57a12f,0xc9))['catch'](handleError(_0x57a12f,null));};exports['update']=function(_0x451d51,_0x1e83fc){if(_0x451d51['body']['id']){delete _0x451d51[_0x331e('0x36')]['id'];}return db[_0x331e('0x21')]['find']({'where':{'id':_0x451d51[_0x331e('0x2c')]['id']}})[_0x331e('0x1a')](handleEntityNotFound(_0x1e83fc,null))['then'](saveUpdates(_0x451d51[_0x331e('0x36')],null))[_0x331e('0x1a')](respondWithResult(_0x1e83fc,null))[_0x331e('0x2a')](handleError(_0x1e83fc,null));};exports[_0x331e('0x1b')]=function(_0x2d71f2,_0x20ea90){return db['SmsInteraction']['find']({'where':{'id':_0x2d71f2[_0x331e('0x2c')]['id']}})[_0x331e('0x1a')](handleEntityNotFound(_0x20ea90,null))['then'](removeEntity(_0x20ea90,null))['catch'](handleError(_0x20ea90,null));};exports[_0x331e('0x37')]=function(_0x328100,_0x46318f){return db[_0x331e('0x21')][_0x331e('0x37')]()[_0x331e('0x1a')](respondWithResult(_0x46318f,null))['catch'](handleError(_0x46318f,null));};exports[_0x331e('0x38')]=function(_0x42634f,_0x2c2140){return db[_0x331e('0x39')][_0x331e('0x3a')]({'where':{'id':_0x42634f[_0x331e('0x2c')]['id']}})['then'](handleEntityNotFound(_0x2c2140,null))[_0x331e('0x1a')](function(_0x2a901e){if(_0x2a901e){return _0x2a901e['addMessage'](_0x42634f[_0x331e('0x36')][_0x331e('0x3b')],_['omit'](_0x42634f[_0x331e('0x36')],[_0x331e('0x3b'),'id'])||{});}})[_0x331e('0x1a')](respondWithResult(_0x2c2140,null))['catch'](handleError(_0x2c2140,null));};exports[_0x331e('0x3c')]=function(_0x442d40,_0x49fa10){var _0x64917a={'raw':![],'where':{}};var _0x19d876={};var _0x1c69dd={'count':0x0,'rows':[]};return db[_0x331e('0x21')][_0x331e('0x3d')]({'where':{'id':_0x442d40[_0x331e('0x2c')]['id']}})[_0x331e('0x1a')](handleEntityNotFound(_0x49fa10,null))[_0x331e('0x1a')](function(_0x425c6c){if(_0x425c6c){_0x19d876[_0x331e('0x32')]=_[_0x331e('0x3e')](db['SmsMessage']['rawAttributes']);_0x19d876[_0x331e('0x28')]=_['keys'](_0x442d40[_0x331e('0x28')]);_0x19d876[_0x331e('0x2d')]=_['intersection'](_0x19d876[_0x331e('0x32')],_0x19d876['query']);_0x64917a['attributes']=_['intersection'](_0x19d876[_0x331e('0x32')],qs[_0x331e('0x30')](_0x442d40[_0x331e('0x28')]['fields']));_0x64917a[_0x331e('0x2f')]=_0x64917a[_0x331e('0x2f')][_0x331e('0x31')]?_0x64917a[_0x331e('0x2f')]:_0x19d876['model'];if(!_0x442d40[_0x331e('0x28')][_0x331e('0x3f')]('nolimit')){_0x64917a[_0x331e('0x15')]=qs['limit'](_0x442d40[_0x331e('0x28')][_0x331e('0x15')]);_0x64917a['offset']=qs[_0x331e('0x13')](_0x442d40['query'][_0x331e('0x13')]);}_0x64917a[_0x331e('0x40')]=qs[_0x331e('0x41')](_0x442d40[_0x331e('0x28')]['sort']);_0x64917a[_0x331e('0x42')]=qs[_0x331e('0x2d')](_[_0x331e('0x43')](_0x442d40[_0x331e('0x28')],_0x19d876[_0x331e('0x2d')]));_0x64917a['where']['SmsInteractionId']=_0x425c6c['id'];if(_0x442d40[_0x331e('0x28')]['filter']){_0x64917a['where']=_[_0x331e('0x34')](_0x64917a[_0x331e('0x42')],{'$or':_[_0x331e('0x44')](_0x64917a[_0x331e('0x2f')],function(_0x1de2a1){var _0x505fdb={};_0x505fdb[_0x1de2a1]={'$like':'%'+_0x442d40[_0x331e('0x28')][_0x331e('0x45')]+'%'};return _0x505fdb;})});}if(_0x442d40['query'][_0x331e('0x46')]){var _0x55de7a=_0x442d40[_0x331e('0x28')]['$gte']['split'](',');var _0x550090={};_0x550090[_0x55de7a[0x0]]={'$gte':moment(_0x55de7a[0x1])['format'](_0x331e('0x47'))};_0x64917a[_0x331e('0x42')]=_[_0x331e('0x34')](_0x64917a[_0x331e('0x42')],_0x550090);}_0x64917a=_[_0x331e('0x34')]({},_0x64917a,_0x442d40[_0x331e('0x35')]);return db[_0x331e('0x39')]['count']({'where':_0x64917a['where']})[_0x331e('0x1a')](function(_0x2ad439){_0x1c69dd[_0x331e('0x16')]=_0x2ad439;if(_0x442d40['query']['includeAll']){_0x64917a[_0x331e('0x33')]=[{'all':!![]}];}return db[_0x331e('0x39')][_0x331e('0x48')](_0x64917a);})[_0x331e('0x1a')](function(_0x56506f){_0x1c69dd[_0x331e('0x49')]=_0x56506f;return _0x1c69dd;});}})[_0x331e('0x1a')](respondWithFilteredResult(_0x49fa10,_0x64917a))[_0x331e('0x2a')](handleError(_0x49fa10,null));};exports[_0x331e('0x4a')]=function(_0x4f0710,_0x3d2c9e){return db[_0x331e('0x21')][_0x331e('0x3a')]({'where':{'id':_0x4f0710[_0x331e('0x2c')]['id']}})[_0x331e('0x1a')](handleEntityNotFound(_0x3d2c9e,null))['then'](function(_0xbb1d97){if(_0xbb1d97){return _0xbb1d97['setTags'](_0x4f0710['body']['ids'],_[_0x331e('0x4b')](_0x4f0710[_0x331e('0x36')],[_0x331e('0x3b'),'id'])||{})[_0x331e('0x4c')](function(){return db[_0x331e('0x4d')]['findAll']({'attributes':['id',_0x331e('0x1e'),_0x331e('0x4e')],'where':{'id':_0x4f0710[_0x331e('0x36')][_0x331e('0x3b')]}});})[_0x331e('0x1a')](function(_0x10ca0d){socket[_0x331e('0x4f')](_0x331e('0x50'),{'id':Number(_0x4f0710['params']['id']),'tags':_0x10ca0d||[]});return{'id':Number(_0x4f0710[_0x331e('0x2c')]['id']),'tags':_0x10ca0d||[]};});}})[_0x331e('0x1a')](respondWithResult(_0x3d2c9e,null))['catch'](handleError(_0x3d2c9e,null));};exports[_0x331e('0x51')]=function(_0x67ca9e,_0x4f88b2){return db[_0x331e('0x21')][_0x331e('0x3a')]({'where':{'id':_0x67ca9e['params']['id']}})[_0x331e('0x1a')](handleEntityNotFound(_0x4f88b2,null))[_0x331e('0x1a')](function(_0x5789f3){if(_0x5789f3){return _0x5789f3[_0x331e('0x51')](_0x67ca9e[_0x331e('0x28')][_0x331e('0x3b')]);}})[_0x331e('0x1a')](respondWithStatusCode(_0x4f88b2,null))[_0x331e('0x2a')](handleError(_0x4f88b2,null));};exports[_0x331e('0x52')]=function(_0x41bc8b,_0x45c454){var _0x3aa242=moment()[_0x331e('0x53')]()[_0x331e('0x54')]();var _0x4a6858=path[_0x331e('0x55')](config[_0x331e('0x56')],_0x331e('0x57'),_0x331e('0x58'),_0x331e('0x59'));var _0x3fbfa3=path[_0x331e('0x55')](_0x4a6858,_0x3aa242);var _0x17a06e=util['format'](_0x331e('0x5a'),_0x41bc8b[_0x331e('0x2c')]['id'],_0x3aa242);var _0x3098c8=path[_0x331e('0x55')](_0x4a6858,_0x17a06e);var _0x200feb=[];_0x200feb['push']({'model':db['User'],'as':_0x331e('0x5b'),'attributes':['id',_0x331e('0x5c')],'raw':!![]});_0x200feb['push']({'model':db[_0x331e('0x5d')],'as':'Contact','attributes':['id',_0x331e('0x5e'),_0x331e('0x5f')],'raw':!![]});var _0x16e318=[{'model':db['SmsMessage'],'as':_0x331e('0x60'),'attributes':['id',_0x331e('0x36'),_0x331e('0x61'),_0x331e('0x62'),_0x331e('0x63'),'read'],'include':_0x200feb}];_0x16e318[_0x331e('0x64')]({'model':db[_0x331e('0x65')],'as':_0x331e('0x66'),'attributes':['id',_0x331e('0x1e')]});_0x16e318[_0x331e('0x64')]({'model':db[_0x331e('0x5b')],'as':_0x331e('0x67'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x331e('0x3a')]({'where':{'id':_0x41bc8b[_0x331e('0x2c')]['id']},'include':_0x16e318})[_0x331e('0x1a')](handleEntityNotFound(_0x45c454,null))[_0x331e('0x1a')](function(_0x17bb15){if(_0x17bb15){var _0xffb53f=_0x17bb15['get']({'plain':!![]});fs['mkdirSync'](_0x3fbfa3);var _0x3154b0={'channel':_0x331e('0x68'),'account':_0xffb53f[_0x331e('0x66')][_0x331e('0x1e')],'agent':_0xffb53f[_0x331e('0x67')]?_0xffb53f[_0x331e('0x67')][_0x331e('0x5c')]:_0x331e('0x69'),'createdAt':moment(_0xffb53f[_0x331e('0x61')])[_0x331e('0x6a')](_0x331e('0x47'))['toString'](),'closedAt':_0xffb53f['closed']?moment(_0xffb53f[_0x331e('0x6b')])[_0x331e('0x6a')](_0x331e('0x47'))['toString']():'','disposition':_0xffb53f[_0x331e('0x6c')],'messages':_(_0xffb53f[_0x331e('0x60')])[_0x331e('0x45')]({'secret':![]})[_0x331e('0x44')](function(_0x128d74){return{'date':moment(_0x128d74['createdAt'])[_0x331e('0x6a')](_0x331e('0x47'))['toString'](),'sender':_0x128d74[_0x331e('0x62')]===_0x331e('0x6d')?_0x128d74[_0x331e('0x5b')]?_0x128d74['User'][_0x331e('0x5c')]:_0x331e('0x6e'):_0x128d74[_0x331e('0x6f')]['firstName']+(_0x128d74[_0x331e('0x6f')][_0x331e('0x5f')]?'\x20'+_0x128d74['Contact'][_0x331e('0x5f')]:''),'body':_0x128d74[_0x331e('0x36')],'direction':_0x128d74[_0x331e('0x62')]===_0x331e('0x6d')?'A':'C','secret':_0x128d74[_0x331e('0x63')],'read':_0x128d74[_0x331e('0x70')]};})[_0x331e('0x71')]()};return ejs['renderFile'](path[_0x331e('0x55')](config['root'],_0x331e('0x57'),_0x331e('0x72'),_0x331e('0x73')),{'interaction':_0x3154b0})[_0x331e('0x1a')](function(_0x436302){var _0x13f7b2=path[_0x331e('0x55')](_0x3fbfa3,_0x331e('0x74')+_0xffb53f['id']+'-'+_0x3aa242+_0x331e('0x75'));var _0x5261ab={'path':_0x13f7b2,'channel':_0x331e('0x68'),'interactionId':_0xffb53f['id']};return pdf[_0x331e('0x76')](_0x436302,_0x5261ab);})[_0x331e('0x1a')](function(){return new BPromise(function(_0x57edb8,_0x3d0285){zipdir(_0x3fbfa3,{'saveTo':_0x3098c8},function(_0x5e2e60,_0x326f22){if(_0x5e2e60)return _0x3d0285(_0x5e2e60);return _0x57edb8(_0x326f22);});})['then'](function(){return new BPromise(function(_0x119ce3,_0xa04ef0){rimraf(_0x3fbfa3,function(_0x25e277){if(_0x25e277)_0xa04ef0(_0x25e277);return _0x119ce3();});});})[_0x331e('0x1a')](function(){return _0x45c454['download'](_0x3098c8,_0x17a06e,function(_0x3f1f63){if(_0x3f1f63){console[_0x331e('0x77')](_0x331e('0x78'),_0x3f1f63);}else{fs['unlinkSync'](_0x3098c8);}});});});}else{return _0x45c454[_0x331e('0xf')](0xc8);}})[_0x331e('0x2a')](handleError(_0x45c454,null));};
\ No newline at end of file
+var _0x58eb=['err','unlinkSync','zip-dir','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','stack','name','send','index','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','user','params','model','keys','attributes','intersection','fields','includeAll','merge','options','catch','create','body','destroy','describe','addMessage','SmsMessage','find','ids','omit','getMessages','findOne','filters','length','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','format','transcript-%d-%s.zip','push','User','CmContact','lastName','createdAt','secret','read','SmsAccount','Owner','fullname','get','mkdirSync','Sms','N.A.','closedAt','disposition','Messages','map','direction','out','firstName','Contact','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML'];(function(_0x23d627,_0x4eb910){var _0x5bde54=function(_0x3f36b5){while(--_0x3f36b5){_0x23d627['push'](_0x23d627['shift']());}};_0x5bde54(++_0x4eb910);}(_0x58eb,0x15e));var _0xb58e=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x58eb[_0x2aec52];return _0x3b8835;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xb58e('0x0'));var moment=require('moment');var BPromise=require(_0xb58e('0x1'));var util=require(_0xb58e('0x2'));var path=require(_0xb58e('0x3'));var ejs=require(_0xb58e('0x4'));var fs=require('fs');var _=require(_0xb58e('0x5'));var Redis=require(_0xb58e('0x6'));var interaction=require(_0xb58e('0x7'));var qs=require(_0xb58e('0x8'));var pdf=require(_0xb58e('0x9'));var logger=require(_0xb58e('0xa'))('api');var config=require(_0xb58e('0xb'));var db=require(_0xb58e('0xc'))['db'];config['redis']=_['defaults'](config[_0xb58e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb58e('0xe'))(new Redis(config[_0xb58e('0xd')]));require(_0xb58e('0xf'))[_0xb58e('0x10')](socket);function respondWithStatusCode(_0x2278f4,_0x50a4e3){_0x50a4e3=_0x50a4e3||0xcc;return function(_0x7ebf0b){if(_0x7ebf0b){return _0x2278f4[_0xb58e('0x11')](_0x50a4e3);}return _0x2278f4[_0xb58e('0x12')](_0x50a4e3)[_0xb58e('0x13')]();};}function respondWithResult(_0x24ac0e,_0x178fff){_0x178fff=_0x178fff||0xc8;return function(_0x25533e){if(_0x25533e){return _0x24ac0e['status'](_0x178fff)[_0xb58e('0x14')](_0x25533e);}};}function respondWithFilteredResult(_0x4e1949,_0x363283){return function(_0x4a0c13){if(_0x4a0c13){var _0x3edab1=typeof _0x363283[_0xb58e('0x15')]===_0xb58e('0x16')&&typeof _0x363283[_0xb58e('0x17')]===_0xb58e('0x16');var _0xde5f61=_0x4a0c13[_0xb58e('0x18')];var _0x3b26bb=_0x3edab1?0x0:_0x363283[_0xb58e('0x15')];var _0x3aa75c=_0x3edab1?_0x4a0c13[_0xb58e('0x18')]:_0x363283[_0xb58e('0x15')]+_0x363283[_0xb58e('0x17')];var _0x59cd7e;if(_0x3aa75c>=_0xde5f61){_0x3aa75c=_0xde5f61;_0x59cd7e=0xc8;}else{_0x59cd7e=0xce;}_0x4e1949['status'](_0x59cd7e);return _0x4e1949['set'](_0xb58e('0x19'),_0x3b26bb+'-'+_0x3aa75c+'/'+_0xde5f61)[_0xb58e('0x14')](_0x4a0c13);}return null;};}function saveUpdates(_0x4bd354){return function(_0x3382ac){if(_0x3382ac){return _0x3382ac[_0xb58e('0x1a')](_0x4bd354)['then'](function(_0x399328){return _0x399328;});}return null;};}function removeEntity(_0x2b7214){return function(_0x58884){if(_0x58884){return _0x58884['destroy']()[_0xb58e('0x1b')](function(){_0x2b7214[_0xb58e('0x12')](0xcc)[_0xb58e('0x13')]();});}};}function handleEntityNotFound(_0x5f4def){return function(_0x4e5d93){if(!_0x4e5d93){_0x5f4def[_0xb58e('0x11')](0x194);}return _0x4e5d93;};}function handleError(_0x5ad9f4,_0x179638){_0x179638=_0x179638||0x1f4;return function(_0x5c8e37){logger['error'](_0x5c8e37[_0xb58e('0x1c')]);if(_0x5c8e37['name']){delete _0x5c8e37[_0xb58e('0x1d')];}_0x5ad9f4['status'](_0x179638)[_0xb58e('0x1e')](_0x5c8e37);};}exports[_0xb58e('0x1f')]=function(_0x119207,_0x53e5e8){var _0x406313={};var _0xbc70a1=_['map'](db[_0xb58e('0x20')][_0xb58e('0x21')],function(_0x56f62d){return{'name':_0x56f62d[_0xb58e('0x22')],'type':_0x56f62d[_0xb58e('0x23')]['key']};});_0x406313=qs[_0xb58e('0x24')](_0xbc70a1,_0x119207);return interaction[_0xb58e('0x25')](_0xb58e('0x26'),_0x119207[_0xb58e('0x27')],_0x119207[_0xb58e('0x28')],_0x406313,_0xbc70a1)['then'](respondWithFilteredResult(_0x53e5e8,_0x406313))['catch'](handleError(_0x53e5e8,null));};exports['show']=function(_0x3cccb5,_0x43a239){var _0x394c9a={'raw':![],'where':{'id':_0x3cccb5[_0xb58e('0x29')]['id']}},_0x73bc9d={};_0x73bc9d[_0xb58e('0x2a')]=_['keys'](db[_0xb58e('0x20')][_0xb58e('0x21')]);_0x73bc9d[_0xb58e('0x27')]=_[_0xb58e('0x2b')](_0x3cccb5[_0xb58e('0x27')]);_0x73bc9d['filters']=_['intersection'](_0x73bc9d[_0xb58e('0x2a')],_0x73bc9d[_0xb58e('0x27')]);_0x394c9a[_0xb58e('0x2c')]=_[_0xb58e('0x2d')](_0x73bc9d[_0xb58e('0x2a')],qs['fields'](_0x3cccb5[_0xb58e('0x27')][_0xb58e('0x2e')]));_0x394c9a[_0xb58e('0x2c')]=_0x394c9a[_0xb58e('0x2c')]['length']?_0x394c9a[_0xb58e('0x2c')]:_0x73bc9d['model'];if(_0x3cccb5[_0xb58e('0x27')][_0xb58e('0x2f')]){_0x394c9a['include']=[{'all':!![]}];}_0x394c9a=_[_0xb58e('0x30')]({},_0x394c9a,_0x3cccb5[_0xb58e('0x31')]);return db[_0xb58e('0x20')]['find'](_0x394c9a)['then'](handleEntityNotFound(_0x43a239,null))[_0xb58e('0x1b')](respondWithResult(_0x43a239,null))[_0xb58e('0x32')](handleError(_0x43a239,null));};exports[_0xb58e('0x33')]=function(_0x15d44c,_0x1c3e71){return db[_0xb58e('0x20')][_0xb58e('0x33')](_0x15d44c[_0xb58e('0x34')],{})[_0xb58e('0x1b')](respondWithResult(_0x1c3e71,0xc9))[_0xb58e('0x32')](handleError(_0x1c3e71,null));};exports['update']=function(_0x223e8b,_0x1f2c38){if(_0x223e8b[_0xb58e('0x34')]['id']){delete _0x223e8b[_0xb58e('0x34')]['id'];}return db[_0xb58e('0x20')]['find']({'where':{'id':_0x223e8b[_0xb58e('0x29')]['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x1f2c38,null))[_0xb58e('0x1b')](saveUpdates(_0x223e8b[_0xb58e('0x34')],null))[_0xb58e('0x1b')](respondWithResult(_0x1f2c38,null))[_0xb58e('0x32')](handleError(_0x1f2c38,null));};exports[_0xb58e('0x35')]=function(_0x50f17a,_0x27dace){return db['SmsInteraction']['find']({'where':{'id':_0x50f17a['params']['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x27dace,null))[_0xb58e('0x1b')](removeEntity(_0x27dace,null))[_0xb58e('0x32')](handleError(_0x27dace,null));};exports[_0xb58e('0x36')]=function(_0x11809b,_0x4165cd){return db[_0xb58e('0x20')][_0xb58e('0x36')]()[_0xb58e('0x1b')](respondWithResult(_0x4165cd,null))[_0xb58e('0x32')](handleError(_0x4165cd,null));};exports[_0xb58e('0x37')]=function(_0x477079,_0x1c9347){return db[_0xb58e('0x38')][_0xb58e('0x39')]({'where':{'id':_0x477079[_0xb58e('0x29')]['id']}})['then'](handleEntityNotFound(_0x1c9347,null))[_0xb58e('0x1b')](function(_0x403bb9){if(_0x403bb9){return _0x403bb9[_0xb58e('0x37')](_0x477079[_0xb58e('0x34')][_0xb58e('0x3a')],_[_0xb58e('0x3b')](_0x477079[_0xb58e('0x34')],[_0xb58e('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x1c9347,null))[_0xb58e('0x32')](handleError(_0x1c9347,null));};exports[_0xb58e('0x3c')]=function(_0x162857,_0x3dd110){var _0xea6b7f={'raw':![],'where':{}};var _0x3ad68d={};var _0x5ebad2={'count':0x0,'rows':[]};return db[_0xb58e('0x20')][_0xb58e('0x3d')]({'where':{'id':_0x162857['params']['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x3dd110,null))['then'](function(_0x51de82){if(_0x51de82){_0x3ad68d[_0xb58e('0x2a')]=_[_0xb58e('0x2b')](db[_0xb58e('0x38')][_0xb58e('0x21')]);_0x3ad68d[_0xb58e('0x27')]=_[_0xb58e('0x2b')](_0x162857[_0xb58e('0x27')]);_0x3ad68d[_0xb58e('0x3e')]=_[_0xb58e('0x2d')](_0x3ad68d[_0xb58e('0x2a')],_0x3ad68d['query']);_0xea6b7f['attributes']=_[_0xb58e('0x2d')](_0x3ad68d[_0xb58e('0x2a')],qs[_0xb58e('0x2e')](_0x162857[_0xb58e('0x27')][_0xb58e('0x2e')]));_0xea6b7f[_0xb58e('0x2c')]=_0xea6b7f[_0xb58e('0x2c')][_0xb58e('0x3f')]?_0xea6b7f[_0xb58e('0x2c')]:_0x3ad68d[_0xb58e('0x2a')];if(!_0x162857[_0xb58e('0x27')]['hasOwnProperty'](_0xb58e('0x40'))){_0xea6b7f[_0xb58e('0x17')]=qs['limit'](_0x162857[_0xb58e('0x27')][_0xb58e('0x17')]);_0xea6b7f[_0xb58e('0x15')]=qs[_0xb58e('0x15')](_0x162857[_0xb58e('0x27')]['offset']);}_0xea6b7f[_0xb58e('0x41')]=qs[_0xb58e('0x42')](_0x162857[_0xb58e('0x27')]['sort']);_0xea6b7f[_0xb58e('0x43')]=qs[_0xb58e('0x3e')](_[_0xb58e('0x44')](_0x162857['query'],_0x3ad68d['filters']));_0xea6b7f[_0xb58e('0x43')][_0xb58e('0x45')]=_0x51de82['id'];if(_0x162857[_0xb58e('0x27')][_0xb58e('0x46')]){_0xea6b7f['where']=_[_0xb58e('0x30')](_0xea6b7f[_0xb58e('0x43')],{'$or':_['map'](_0xea6b7f['attributes'],function(_0x44ecc6){var _0x5b0879={};_0x5b0879[_0x44ecc6]={'$like':'%'+_0x162857['query']['filter']+'%'};return _0x5b0879;})});}if(_0x162857[_0xb58e('0x27')][_0xb58e('0x47')]){var _0x121db6=_0x162857[_0xb58e('0x27')][_0xb58e('0x47')]['split'](',');var _0x2c035a={};_0x2c035a[_0x121db6[0x0]]={'$gte':moment(_0x121db6[0x1])['format'](_0xb58e('0x48'))};_0xea6b7f[_0xb58e('0x43')]=_[_0xb58e('0x30')](_0xea6b7f['where'],_0x2c035a);}_0xea6b7f=_[_0xb58e('0x30')]({},_0xea6b7f,_0x162857[_0xb58e('0x31')]);return db[_0xb58e('0x38')][_0xb58e('0x18')]({'where':_0xea6b7f[_0xb58e('0x43')]})[_0xb58e('0x1b')](function(_0x2bb7e1){_0x5ebad2['count']=_0x2bb7e1;if(_0x162857['query']['includeAll']){_0xea6b7f['include']=[{'all':!![]}];}return db[_0xb58e('0x38')]['findAll'](_0xea6b7f);})['then'](function(_0xebfb16){_0x5ebad2['rows']=_0xebfb16;return _0x5ebad2;});}})[_0xb58e('0x1b')](respondWithFilteredResult(_0x3dd110,_0xea6b7f))[_0xb58e('0x32')](handleError(_0x3dd110,null));};exports['addTags']=function(_0x2a6446,_0x42cb86){return db[_0xb58e('0x20')]['find']({'where':{'id':_0x2a6446[_0xb58e('0x29')]['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x42cb86,null))[_0xb58e('0x1b')](function(_0x1b0925){if(_0x1b0925){return _0x1b0925['setTags'](_0x2a6446[_0xb58e('0x34')][_0xb58e('0x3a')],_['omit'](_0x2a6446[_0xb58e('0x34')],[_0xb58e('0x3a'),'id'])||{})['spread'](function(){return db[_0xb58e('0x49')][_0xb58e('0x25')]({'attributes':['id',_0xb58e('0x1d'),_0xb58e('0x4a')],'where':{'id':_0x2a6446[_0xb58e('0x34')]['ids']}});})['then'](function(_0x2ebd36){socket[_0xb58e('0x4b')](_0xb58e('0x4c'),{'id':Number(_0x2a6446[_0xb58e('0x29')]['id']),'tags':_0x2ebd36||[]});return{'id':Number(_0x2a6446[_0xb58e('0x29')]['id']),'tags':_0x2ebd36||[]};});}})[_0xb58e('0x1b')](respondWithResult(_0x42cb86,null))[_0xb58e('0x32')](handleError(_0x42cb86,null));};exports['removeTags']=function(_0x155ac0,_0x4195b2){return db[_0xb58e('0x20')][_0xb58e('0x39')]({'where':{'id':_0x155ac0['params']['id']}})[_0xb58e('0x1b')](handleEntityNotFound(_0x4195b2,null))[_0xb58e('0x1b')](function(_0x39e027){if(_0x39e027){return _0x39e027[_0xb58e('0x4d')](_0x155ac0[_0xb58e('0x27')][_0xb58e('0x3a')]);}})[_0xb58e('0x1b')](respondWithStatusCode(_0x4195b2,null))[_0xb58e('0x32')](handleError(_0x4195b2,null));};exports[_0xb58e('0x4e')]=function(_0x5993c0,_0xfb7bd4){var _0x2cde04=moment()[_0xb58e('0x4f')]()[_0xb58e('0x50')]();var _0x318a93=path[_0xb58e('0x51')](config[_0xb58e('0x52')],_0xb58e('0x53'),_0xb58e('0x54'),'tmp');var _0x54db15=path[_0xb58e('0x51')](_0x318a93,_0x2cde04);var _0x272846=util[_0xb58e('0x55')](_0xb58e('0x56'),_0x5993c0[_0xb58e('0x29')]['id'],_0x2cde04);var _0x4be764=path['join'](_0x318a93,_0x272846);var _0x1306ce=[];_0x1306ce[_0xb58e('0x57')]({'model':db['User'],'as':_0xb58e('0x58'),'attributes':['id','fullname'],'raw':!![]});_0x1306ce[_0xb58e('0x57')]({'model':db[_0xb58e('0x59')],'as':'Contact','attributes':['id','firstName',_0xb58e('0x5a')],'raw':!![]});var _0x4bd50f=[{'model':db[_0xb58e('0x38')],'as':'Messages','attributes':['id',_0xb58e('0x34'),_0xb58e('0x5b'),'direction',_0xb58e('0x5c'),_0xb58e('0x5d')],'include':_0x1306ce}];_0x4bd50f[_0xb58e('0x57')]({'model':db[_0xb58e('0x5e')],'as':'Account','attributes':['id',_0xb58e('0x1d')]});_0x4bd50f[_0xb58e('0x57')]({'model':db[_0xb58e('0x58')],'as':_0xb58e('0x5f'),'attributes':['id',_0xb58e('0x60')]});return db['SmsInteraction'][_0xb58e('0x39')]({'where':{'id':_0x5993c0['params']['id']},'include':_0x4bd50f})[_0xb58e('0x1b')](handleEntityNotFound(_0xfb7bd4,null))[_0xb58e('0x1b')](function(_0x2f9997){if(_0x2f9997){var _0x5deed4=_0x2f9997[_0xb58e('0x61')]({'plain':!![]});fs[_0xb58e('0x62')](_0x54db15);var _0x45b22c={'channel':_0xb58e('0x63'),'account':_0x5deed4['Account'][_0xb58e('0x1d')],'agent':_0x5deed4[_0xb58e('0x5f')]?_0x5deed4[_0xb58e('0x5f')][_0xb58e('0x60')]:_0xb58e('0x64'),'createdAt':moment(_0x5deed4[_0xb58e('0x5b')])[_0xb58e('0x55')](_0xb58e('0x48'))[_0xb58e('0x50')](),'closedAt':_0x5deed4['closed']?moment(_0x5deed4[_0xb58e('0x65')])['format'](_0xb58e('0x48'))[_0xb58e('0x50')]():'','disposition':_0x5deed4[_0xb58e('0x66')],'messages':_(_0x5deed4[_0xb58e('0x67')])[_0xb58e('0x46')]({'secret':![]})[_0xb58e('0x68')](function(_0x548d6b){return{'date':moment(_0x548d6b[_0xb58e('0x5b')])[_0xb58e('0x55')](_0xb58e('0x48'))['toString'](),'sender':_0x548d6b[_0xb58e('0x69')]===_0xb58e('0x6a')?_0x548d6b[_0xb58e('0x58')]?_0x548d6b[_0xb58e('0x58')][_0xb58e('0x60')]:'System':_0x548d6b['Contact'][_0xb58e('0x6b')]+(_0x548d6b[_0xb58e('0x6c')]['lastName']?'\x20'+_0x548d6b['Contact']['lastName']:''),'body':_0x548d6b[_0xb58e('0x34')],'direction':_0x548d6b[_0xb58e('0x69')]==='out'?'A':'C','secret':_0x548d6b[_0xb58e('0x5c')],'read':_0x548d6b[_0xb58e('0x5d')]};})[_0xb58e('0x6d')]()};return ejs['renderFile'](path['join'](config[_0xb58e('0x52')],_0xb58e('0x53'),'views',_0xb58e('0x6e')),{'interaction':_0x45b22c})[_0xb58e('0x1b')](function(_0x433b58){var _0x37f07b=path['join'](_0x54db15,_0xb58e('0x6f')+_0x5deed4['id']+'-'+_0x2cde04+_0xb58e('0x70'));var _0x100f38={'path':_0x37f07b,'channel':_0xb58e('0x63'),'interactionId':_0x5deed4['id']};return pdf[_0xb58e('0x71')](_0x433b58,_0x100f38);})['then'](function(){return new BPromise(function(_0x2ef423,_0x5b519c){zipdir(_0x54db15,{'saveTo':_0x4be764},function(_0x4fbe7d,_0x1495c3){if(_0x4fbe7d)return _0x5b519c(_0x4fbe7d);return _0x2ef423(_0x1495c3);});})[_0xb58e('0x1b')](function(){return new BPromise(function(_0x5cc6e9,_0x50baf0){rimraf(_0x54db15,function(_0x5479ee){if(_0x5479ee)_0x50baf0(_0x5479ee);return _0x5cc6e9();});});})[_0xb58e('0x1b')](function(){return _0xfb7bd4[_0xb58e('0x4e')](_0x4be764,_0x272846,function(_0x73bb4d){if(_0x73bb4d){console['log'](_0xb58e('0x72'),_0x73bb4d);}else{fs[_0xb58e('0x73')](_0x4be764);}});});});}else{return _0xfb7bd4['sendStatus'](0xc8);}})[_0xb58e('0x32')](handleError(_0xfb7bd4,null));};
\ No newline at end of file
index 64c043d..4c72ccd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x160f=['events','../../mysqldb','SmsInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','findAll','then','emit','catch','hook','exports'];(function(_0x1fac60,_0x1dec5e){var _0x4c10e1=function(_0x1b9d1a){while(--_0x1b9d1a){_0x1fac60['push'](_0x1fac60['shift']());}};_0x4c10e1(++_0x1dec5e);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xf160('0x0'));var SmsInteraction=require(_0xf160('0x1'))['db'][_0xf160('0x2')];var SmsMessage=require(_0xf160('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf160('0x3')](0x0);var events={'afterCreate':_0xf160('0x4'),'afterUpdate':_0xf160('0x5'),'afterDestroy':_0xf160('0x6')};function emitEvent(_0x194331){return function(_0xfdbd72,_0x4a6f3d,_0x311d63){_0xfdbd72[_0xf160('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x59440e){_0xfdbd72[_0xf160('0x8')]('Users',_0x59440e['map'](function(_0x496014){return{'id':_0x496014['id']};}));return SmsMessage[_0xf160('0x9')]({'where':{'SmsInteractionId':_0xfdbd72['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf160('0xa')](function(_0x393f70){_0xfdbd72[_0xf160('0x8')]('unreadMessages',_0x393f70['length']);SmsInteractionEvents[_0xf160('0xb')](_0x194331+':'+_0xfdbd72['id'],_0xfdbd72);SmsInteractionEvents[_0xf160('0xb')](_0x194331,_0xfdbd72);_0x311d63(null);})[_0xf160('0xc')](_0x311d63(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction[_0xf160('0xd')](e,emitEvent(event));}}module[_0xf160('0xe')]=SmsInteractionEvents;
\ No newline at end of file
+var _0xd914=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x1dfb1c,_0x117aac){var _0x39ef83=function(_0x1b8878){while(--_0x1b8878){_0x1dfb1c['push'](_0x1dfb1c['shift']());}};_0x39ef83(++_0x117aac);}(_0xd914,0x17f));var _0x4d91=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xd914[_0x2b5eae];return _0x5f3ac9;};'use strict';var EventEmitter=require(_0x4d91('0x0'));var SmsInteraction=require(_0x4d91('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0x4d91('0x1'))['db'][_0x4d91('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x4d91('0x3')](0x0);var events={'afterCreate':_0x4d91('0x4'),'afterUpdate':_0x4d91('0x5'),'afterDestroy':_0x4d91('0x6')};function emitEvent(_0x4875a2){return function(_0x1b256e,_0x5d8af4,_0x3ab6f8){_0x1b256e[_0x4d91('0x7')]({'attributes':['id'],'raw':!![]})[_0x4d91('0x8')](function(_0x27c0d5){_0x1b256e[_0x4d91('0x9')](_0x4d91('0xa'),_0x27c0d5[_0x4d91('0xb')](function(_0x2a3ca1){return{'id':_0x2a3ca1['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1b256e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4d91('0x8')](function(_0xa4bb25){_0x1b256e[_0x4d91('0x9')](_0x4d91('0xc'),_0xa4bb25[_0x4d91('0xd')]);SmsInteractionEvents[_0x4d91('0xe')](_0x4875a2+':'+_0x1b256e['id'],_0x1b256e);SmsInteractionEvents['emit'](_0x4875a2,_0x1b256e);_0x3ab6f8(null);})['catch'](_0x3ab6f8(null));};}for(var e in events){if(events[_0x4d91('0xf')](e)){var event=events[e];SmsInteraction[_0x4d91('0x10')](e,emitEvent(event));}}module[_0x4d91('0x11')]=SmsInteractionEvents;
\ No newline at end of file
index 306abc3..9b662e1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaba9=['../../config/logger','api','moment','bluebird','request-promise','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x45afec,_0x18bc92){var _0x5a841a=function(_0x47c272){while(--_0x47c272){_0x45afec['push'](_0x45afec['shift']());}};_0x5a841a(++_0x18bc92);}(_0xaba9,0xbe));var _0x9aba=function(_0x11a33f,_0xd3e773){_0x11a33f=_0x11a33f-0x0;var _0x1fe457=_0xaba9[_0x11a33f];return _0x1fe457;};'use strict';var _=require(_0x9aba('0x0'));var util=require(_0x9aba('0x1'));var logger=require(_0x9aba('0x2'))(_0x9aba('0x3'));var moment=require(_0x9aba('0x4'));var BPromise=require(_0x9aba('0x5'));var rp=require(_0x9aba('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9aba('0x7'));module[_0x9aba('0x8')]=function(_0x4374c3,_0x49769f){return _0x4374c3[_0x9aba('0x9')](_0x9aba('0xa'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x206b2c,_0x5a6d89,_0x82e188){if(_0x206b2c[_0x9aba('0xb')](_0x9aba('0xc'))){_0x206b2c[_0x9aba('0xd')]=moment()[_0x9aba('0xe')](_0x9aba('0xf'));}_0x82e188(null,_0x206b2c);}}});};
\ No newline at end of file
+var _0x3788=['changed','closed','util','../../config/logger','api','moment','request-promise','rimraf','./smsInteraction.attributes','define','SmsInteraction','sms_interactions'];(function(_0x463dce,_0x5d8814){var _0x28a67e=function(_0x5c3945){while(--_0x5c3945){_0x463dce['push'](_0x463dce['shift']());}};_0x28a67e(++_0x5d8814);}(_0x3788,0xfe));var _0x8378=function(_0x7957d5,_0x5e4f40){_0x7957d5=_0x7957d5-0x0;var _0x103f14=_0x3788[_0x7957d5];return _0x103f14;};'use strict';var _=require('lodash');var util=require(_0x8378('0x0'));var logger=require(_0x8378('0x1'))(_0x8378('0x2'));var moment=require(_0x8378('0x3'));var BPromise=require('bluebird');var rp=require(_0x8378('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8378('0x5'));var config=require('../../config/environment');var attributes=require(_0x8378('0x6'));module['exports']=function(_0x1f4429,_0x535fb7){return _0x1f4429[_0x8378('0x7')](_0x8378('0x8'),attributes,{'tableName':_0x8378('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x94f4b5,_0x2f2582,_0x5c842c){if(_0x94f4b5[_0x8378('0xa')](_0x8378('0xb'))){_0x94f4b5['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x5c842c(null,_0x94f4b5);}}});};
\ No newline at end of file
index c9ffd8a..79dd7c3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb412=['spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','SmsInteraction,\x20%s,\x20%s','message','result','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','then','catch','find','where','omit','ids'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb412,0xa6));var _0x2b41=function(_0x3530ae,_0x14dd25){_0x3530ae=_0x3530ae-0x0;var _0x437587=_0xb412[_0x3530ae];return _0x437587;};'use strict';var _=require(_0x2b41('0x0'));var util=require(_0x2b41('0x1'));var moment=require(_0x2b41('0x2'));var BPromise=require(_0x2b41('0x3'));var rs=require(_0x2b41('0x4'));var fs=require('fs');var Redis=require(_0x2b41('0x5'));var db=require(_0x2b41('0x6'))['db'];var utils=require(_0x2b41('0x7'));var logger=require(_0x2b41('0x8'))(_0x2b41('0x9'));var config=require(_0x2b41('0xa'));var jayson=require(_0x2b41('0xb'));var client=jayson['client'][_0x2b41('0xc')]({'port':0x232a});config[_0x2b41('0xd')]=_[_0x2b41('0xe')](config[_0x2b41('0xd')],{'host':_0x2b41('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2b41('0xd')]));require('./smsInteraction.socket')[_0x2b41('0x10')](socket);function respondWithRpcPromise(_0x3fab52,_0x2c9730,_0x38a391){return new BPromise(function(_0x48cf1c,_0x3085ae){return client[_0x2b41('0x11')](_0x3fab52,_0x38a391)['then'](function(_0x2c1abd){logger[_0x2b41('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x2c9730,_0x2b41('0x13'));logger[_0x2b41('0x14')](_0x2b41('0x15'),_0x2c9730,_0x2b41('0x13'),JSON[_0x2b41('0x16')](_0x2c1abd));if(_0x2c1abd[_0x2b41('0x17')]){if(_0x2c1abd['error']['code']===0x1f4){logger[_0x2b41('0x17')](_0x2b41('0x18'),_0x2c9730,_0x2c1abd['error']['message']);return _0x3085ae(_0x2c1abd[_0x2b41('0x17')][_0x2b41('0x19')]);}logger[_0x2b41('0x17')](_0x2b41('0x18'),_0x2c9730,_0x2c1abd[_0x2b41('0x17')]['message']);return _0x48cf1c(_0x2c1abd[_0x2b41('0x17')][_0x2b41('0x19')]);}else{logger[_0x2b41('0x12')](_0x2b41('0x18'),_0x2c9730,_0x2b41('0x13'));_0x48cf1c(_0x2c1abd[_0x2b41('0x1a')][_0x2b41('0x19')]);}})['catch'](function(_0x1e0483){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x2c9730,_0x1e0483);_0x3085ae(_0x1e0483);});});}exports[_0x2b41('0x1b')]=function(_0x43f54b){var _0x483566=this;return new Promise(function(_0xb4e115,_0x45e5a0){return db[_0x2b41('0x1c')][_0x2b41('0x1d')](_0x43f54b[_0x2b41('0x1e')],{'raw':_0x43f54b[_0x2b41('0x1f')]?_0x43f54b[_0x2b41('0x1f')][_0x2b41('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43f54b['options']?_0x43f54b[_0x2b41('0x1f')]['where']||null:null,'attributes':_0x43f54b[_0x2b41('0x1f')]?_0x43f54b['options']['attributes']||null:null,'limit':_0x43f54b['options']?_0x43f54b['options']['limit']||null:null})[_0x2b41('0x21')](function(_0x46cb94){logger[_0x2b41('0x12')](_0x2b41('0x1b'),_0x43f54b);logger[_0x2b41('0x14')](_0x2b41('0x1b'),_0x43f54b,JSON[_0x2b41('0x16')](_0x46cb94));_0xb4e115(_0x46cb94);})[_0x2b41('0x22')](function(_0x13d1a5){logger[_0x2b41('0x17')](_0x2b41('0x1b'),_0x13d1a5[_0x2b41('0x19')],_0x43f54b);_0x45e5a0(_0x483566['error'](0x1f4,_0x13d1a5['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x5d3f96){return new Promise(function(_0x53c0e9,_0x39d67c){return db['SmsInteraction'][_0x2b41('0x23')]({'where':_0x5d3f96[_0x2b41('0x1f')]?_0x5d3f96['options'][_0x2b41('0x24')]||null:null})[_0x2b41('0x21')](function(_0x250de8){if(_0x250de8){return _0x250de8['addTags'](_0x5d3f96['body']['ids'],_[_0x2b41('0x25')](_0x5d3f96[_0x2b41('0x1e')],[_0x2b41('0x26'),'id'])||{});}})[_0x2b41('0x27')](function(_0x7ce967){logger['info'](_0x2b41('0x28'),_0x5d3f96);logger[_0x2b41('0x14')]('AddTags',_0x5d3f96,JSON[_0x2b41('0x16')](_0x7ce967));_0x53c0e9(_0x7ce967);})[_0x2b41('0x22')](function(_0x25432e){logger[_0x2b41('0x17')](_0x2b41('0x28'),_0x25432e[_0x2b41('0x19')],_0x5d3f96);_0x39d67c(_this[_0x2b41('0x17')](0x1f4,_0x25432e[_0x2b41('0x19')]));});});};
\ No newline at end of file
+var _0x7449=['jayson/promise','http','defaults','socket.io-emitter','./smsInteraction.socket','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result','UpdateSmsInteraction','SmsInteraction','update','body','options','where','attributes','limit','debug','catch','AddTagsToSmsInteraction','find','addTags','omit','ids','spread','AddTags','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x17d40a,_0x3e523d){var _0x2ae8f4=function(_0x34ba1c){while(--_0x34ba1c){_0x17d40a['push'](_0x17d40a['shift']());}};_0x2ae8f4(++_0x3e523d);}(_0x7449,0x70));var _0x9744=function(_0x5689ca,_0x59ac65){_0x5689ca=_0x5689ca-0x0;var _0x384c7d=_0x7449[_0x5689ca];return _0x384c7d;};'use strict';var _=require(_0x9744('0x0'));var util=require('util');var moment=require(_0x9744('0x1'));var BPromise=require('bluebird');var rs=require(_0x9744('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9744('0x3'))['db'];var utils=require(_0x9744('0x4'));var logger=require(_0x9744('0x5'))(_0x9744('0x6'));var config=require(_0x9744('0x7'));var jayson=require(_0x9744('0x8'));var client=jayson['client'][_0x9744('0x9')]({'port':0x232a});config['redis']=_[_0x9744('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9744('0xb'))(new Redis(config['redis']));require(_0x9744('0xc'))['register'](socket);function respondWithRpcPromise(_0x5620c3,_0x3ce8db,_0x2c95b2){return new BPromise(function(_0x17b14e,_0x3ee636){return client['request'](_0x5620c3,_0x2c95b2)[_0x9744('0xd')](function(_0x5b26c8){logger['info'](_0x9744('0xe'),_0x3ce8db,_0x9744('0xf'));logger['debug'](_0x9744('0x10'),_0x3ce8db,_0x9744('0xf'),JSON['stringify'](_0x5b26c8));if(_0x5b26c8[_0x9744('0x11')]){if(_0x5b26c8[_0x9744('0x11')][_0x9744('0x12')]===0x1f4){logger[_0x9744('0x11')]('SmsInteraction,\x20%s,\x20%s',_0x3ce8db,_0x5b26c8[_0x9744('0x11')][_0x9744('0x13')]);return _0x3ee636(_0x5b26c8[_0x9744('0x11')][_0x9744('0x13')]);}logger[_0x9744('0x11')](_0x9744('0xe'),_0x3ce8db,_0x5b26c8[_0x9744('0x11')][_0x9744('0x13')]);return _0x17b14e(_0x5b26c8[_0x9744('0x11')]['message']);}else{logger[_0x9744('0x14')](_0x9744('0xe'),_0x3ce8db,_0x9744('0xf'));_0x17b14e(_0x5b26c8[_0x9744('0x15')][_0x9744('0x13')]);}})['catch'](function(_0x301c5f){logger[_0x9744('0x11')](_0x9744('0xe'),_0x3ce8db,_0x301c5f);_0x3ee636(_0x301c5f);});});}exports[_0x9744('0x16')]=function(_0x5e3996){var _0x50d69c=this;return new Promise(function(_0x1fd2ab,_0x35f1c8){return db[_0x9744('0x17')][_0x9744('0x18')](_0x5e3996[_0x9744('0x19')],{'raw':_0x5e3996[_0x9744('0x1a')]?_0x5e3996[_0x9744('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e3996[_0x9744('0x1a')]?_0x5e3996[_0x9744('0x1a')][_0x9744('0x1b')]||null:null,'attributes':_0x5e3996[_0x9744('0x1a')]?_0x5e3996[_0x9744('0x1a')][_0x9744('0x1c')]||null:null,'limit':_0x5e3996['options']?_0x5e3996[_0x9744('0x1a')][_0x9744('0x1d')]||null:null})[_0x9744('0xd')](function(_0x285a0f){logger[_0x9744('0x14')]('UpdateSmsInteraction',_0x5e3996);logger[_0x9744('0x1e')](_0x9744('0x16'),_0x5e3996,JSON['stringify'](_0x285a0f));_0x1fd2ab(_0x285a0f);})[_0x9744('0x1f')](function(_0x43b19b){logger['error']('UpdateSmsInteraction',_0x43b19b[_0x9744('0x13')],_0x5e3996);_0x35f1c8(_0x50d69c[_0x9744('0x11')](0x1f4,_0x43b19b[_0x9744('0x13')]));});});};exports[_0x9744('0x20')]=function(_0x39524b){return new Promise(function(_0x5b14cf,_0x41bb24){return db[_0x9744('0x17')][_0x9744('0x21')]({'where':_0x39524b[_0x9744('0x1a')]?_0x39524b[_0x9744('0x1a')][_0x9744('0x1b')]||null:null})[_0x9744('0xd')](function(_0x2a759f){if(_0x2a759f){return _0x2a759f[_0x9744('0x22')](_0x39524b['body']['ids'],_[_0x9744('0x23')](_0x39524b['body'],[_0x9744('0x24'),'id'])||{});}})[_0x9744('0x25')](function(_0x256d97){logger[_0x9744('0x14')](_0x9744('0x26'),_0x39524b);logger[_0x9744('0x1e')](_0x9744('0x26'),_0x39524b,JSON[_0x9744('0x27')](_0x256d97));_0x5b14cf(_0x256d97);})['catch'](function(_0x5f27d3){logger['error'](_0x9744('0x26'),_0x5f27d3['message'],_0x39524b);_0x41bb24(_this['error'](0x1f4,_0x5f27d3[_0x9744('0x13')]));});});};
\ No newline at end of file
index 5d26e99..ea05234 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ff7=['register','length','smsInteraction:','save','remove','update','emit','removeListener'];(function(_0x3e7f85,_0x7e326a){var _0x5b20c1=function(_0x2711ed){while(--_0x2711ed){_0x3e7f85['push'](_0x3e7f85['shift']());}};_0x5b20c1(++_0x7e326a);}(_0x9ff7,0x7b));var _0x79ff=function(_0x40ee6b,_0xbb72c){_0x40ee6b=_0x40ee6b-0x0;var _0x425b55=_0x9ff7[_0x40ee6b];return _0x425b55;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x79ff('0x0'),_0x79ff('0x1'),_0x79ff('0x2')];function createListener(_0x1b9218,_0x4571de){return function(_0x1626b2){_0x4571de[_0x79ff('0x3')](_0x1b9218,_0x1626b2);};}function removeListener(_0x15d147,_0x306fde){return function(){SmsInteractionEvents[_0x79ff('0x4')](_0x15d147,_0x306fde);};}exports[_0x79ff('0x5')]=function(_0x4bd4a1){for(var _0x15af74=0x0,_0x233041=events[_0x79ff('0x6')];_0x15af74<_0x233041;_0x15af74++){var _0x2c0628=events[_0x15af74];var _0x1b1b1a=createListener(_0x79ff('0x7')+_0x2c0628,_0x4bd4a1);SmsInteractionEvents['on'](_0x2c0628,_0x1b1b1a);}};
\ No newline at end of file
+var _0x2f47=['update','emit','register','length','smsInteraction:','save','remove'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0x2f47,0xd0));var _0x72f4=function(_0x41216b,_0x42501a){_0x41216b=_0x41216b-0x0;var _0x7d9c7a=_0x2f47[_0x41216b];return _0x7d9c7a;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x72f4('0x0'),_0x72f4('0x1'),_0x72f4('0x2')];function createListener(_0x3aebd7,_0x3e592f){return function(_0x54a4b4){_0x3e592f[_0x72f4('0x3')](_0x3aebd7,_0x54a4b4);};}function removeListener(_0x39d80f,_0xb843a6){return function(){SmsInteractionEvents['removeListener'](_0x39d80f,_0xb843a6);};}exports[_0x72f4('0x4')]=function(_0x1c3a43){for(var _0x59c220=0x0,_0x21123c=events[_0x72f4('0x5')];_0x59c220<_0x21123c;_0x59c220++){var _0x43a174=events[_0x59c220];var _0x1d401b=createListener(_0x72f4('0x6')+_0x43a174,_0x1c3a43);SmsInteractionEvents['on'](_0x43a174,_0x1d401b);}};
\ No newline at end of file
index 902e5e7..b8b9a6c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f5f=['isAuthenticated','index','/describe','/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get'];(function(_0x240257,_0x7a7717){var _0x5208a6=function(_0x107472){while(--_0x107472){_0x240257['push'](_0x240257['shift']());}};_0x5208a6(++_0x7a7717);}(_0x4f5f,0xb9));var _0xf4f5=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x4f5f[_0x44b3bd];return _0x1efc4a;};'use strict';var multer=require(_0xf4f5('0x0'));var util=require(_0xf4f5('0x1'));var path=require(_0xf4f5('0x2'));var timeout=require(_0xf4f5('0x3'));var express=require(_0xf4f5('0x4'));var router=express[_0xf4f5('0x5')]();var fs_extra=require(_0xf4f5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf4f5('0x7'));var config=require(_0xf4f5('0x8'));var controller=require(_0xf4f5('0x9'));router[_0xf4f5('0xa')]('/',auth[_0xf4f5('0xb')](),controller[_0xf4f5('0xc')]);router['get'](_0xf4f5('0xd'),auth[_0xf4f5('0xb')](),controller['describe']);router['get'](_0xf4f5('0xe'),auth['isAuthenticated'](),controller[_0xf4f5('0xf')]);router[_0xf4f5('0x10')]('/',auth['isAuthenticated'](),interaction[_0xf4f5('0x11')](_0xf4f5('0x12'),_0xf4f5('0x13')),controller['create']);router[_0xf4f5('0x10')](_0xf4f5('0x14'),controller[_0xf4f5('0x15')]);router[_0xf4f5('0x16')](_0xf4f5('0xe'),auth['isAuthenticated'](),controller[_0xf4f5('0x17')]);router[_0xf4f5('0x16')]('/:id/accept',auth[_0xf4f5('0xb')](),controller['accept']);router[_0xf4f5('0x16')](_0xf4f5('0x18'),auth[_0xf4f5('0xb')](),controller['reject']);router[_0xf4f5('0x19')](_0xf4f5('0xe'),auth[_0xf4f5('0xb')](),controller[_0xf4f5('0x1a')]);module[_0xf4f5('0x1b')]=router;
\ No newline at end of file
+var _0xa789=['index','/describe','/:id','show','post','tracked','status','put','update','/:id/accept','reject','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa789,0x71));var _0x9a78=function(_0x44db31,_0x1adf02){_0x44db31=_0x44db31-0x0;var _0x5a574d=_0xa789[_0x44db31];return _0x5a574d;};'use strict';var multer=require(_0x9a78('0x0'));var util=require(_0x9a78('0x1'));var path=require(_0x9a78('0x2'));var timeout=require(_0x9a78('0x3'));var express=require(_0x9a78('0x4'));var router=express['Router']();var fs_extra=require(_0x9a78('0x5'));var auth=require(_0x9a78('0x6'));var interaction=require(_0x9a78('0x7'));var config=require(_0x9a78('0x8'));var controller=require(_0x9a78('0x9'));router[_0x9a78('0xa')]('/',auth[_0x9a78('0xb')](),controller[_0x9a78('0xc')]);router[_0x9a78('0xa')](_0x9a78('0xd'),auth[_0x9a78('0xb')](),controller['describe']);router['get'](_0x9a78('0xe'),auth[_0x9a78('0xb')](),controller[_0x9a78('0xf')]);router[_0x9a78('0x10')]('/',auth['isAuthenticated'](),interaction[_0x9a78('0x11')]('sms','smsmessage:create'),controller['create']);router[_0x9a78('0x10')]('/:id/status',controller[_0x9a78('0x12')]);router[_0x9a78('0x13')](_0x9a78('0xe'),auth[_0x9a78('0xb')](),controller[_0x9a78('0x14')]);router[_0x9a78('0x13')](_0x9a78('0x15'),auth['isAuthenticated'](),controller['accept']);router[_0x9a78('0x13')]('/:id/reject',auth[_0x9a78('0xb')](),controller[_0x9a78('0x16')]);router['delete'](_0x9a78('0xe'),auth[_0x9a78('0xb')](),controller[_0x9a78('0x17')]);module[_0x9a78('0x18')]=router;
\ No newline at end of file
index 6092c31..b2a87ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08b3=['STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x08b3,0x130));var _0x308b=function(_0x5801ba,_0x1a97c6){_0x5801ba=_0x5801ba-0x0;var _0x6d8021=_0x08b3[_0x5801ba];return _0x6d8021;};'use strict';var Sequelize=require(_0x308b('0x0'));module[_0x308b('0x1')]={'body':{'type':Sequelize[_0x308b('0x2')](_0x308b('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x308b('0x4')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x308b('0x5')]},'secret':{'type':Sequelize[_0x308b('0x6')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x308b('0x4')]},'providerResponse':{'type':Sequelize[_0x308b('0x2')]}};
\ No newline at end of file
+var _0x525e=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x2125f0,_0x2f23b9){var _0x12d6eb=function(_0x7a43ea){while(--_0x7a43ea){_0x2125f0['push'](_0x2125f0['shift']());}};_0x12d6eb(++_0x2f23b9);}(_0x525e,0x78));var _0xe525=function(_0x474f4f,_0x2f667a){_0x474f4f=_0x474f4f-0x0;var _0x36082d=_0x525e[_0x474f4f];return _0x36082d;};'use strict';var Sequelize=require(_0xe525('0x0'));module[_0xe525('0x1')]={'body':{'type':Sequelize[_0xe525('0x2')](_0xe525('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe525('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe525('0x5')]('in',_0xe525('0x6')),'defaultValue':_0xe525('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe525('0x7')]},'readAt':{'type':Sequelize[_0xe525('0x8')]},'secret':{'type':Sequelize[_0xe525('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index 5b41624..f899cd1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd50=['internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','sms','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','plivo','MessageUUID','sent','delivered','Status','plivio','results','DELIVERED','zip-dir','request-promise','moment','bluebird','path','sox','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','SmsMessage','rows','catch','show','params','includeAll','include','create','body','find','destroy','describe','sms-interactions','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','agent','UserId','get','SmsInteraction','isNil','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email'];(function(_0x400825,_0x2e8768){var _0x18bd6e=function(_0x45d44a){while(--_0x45d44a){_0x400825['push'](_0x400825['shift']());}};_0x18bd6e(++_0x2e8768);}(_0xbd50,0x151));var _0x0bd5=function(_0x4782d8,_0x5aa9c8){_0x4782d8=_0x4782d8-0x0;var _0x1f4d70=_0xbd50[_0x4782d8];return _0x1f4d70;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0bd5('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require(_0x0bd5('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0bd5('0x4'));var sox=require(_0x0bd5('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0bd5('0x6'));var crypto=require(_0x0bd5('0x7'));var jsforce=require(_0x0bd5('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x0bd5('0x9'));var querystring=require(_0x0bd5('0xa'));var Papa=require(_0x0bd5('0xb'));var Redis=require(_0x0bd5('0xc'));var authService=require(_0x0bd5('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x0bd5('0xe'));var hardwareService=require(_0x0bd5('0xf'));var logger=require(_0x0bd5('0x10'))(_0x0bd5('0x11'));var utils=require(_0x0bd5('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0bd5('0x13'));var db=require(_0x0bd5('0x14'))['db'];config[_0x0bd5('0x15')]=_[_0x0bd5('0x16')](config[_0x0bd5('0x15')],{'host':_0x0bd5('0x17'),'port':0x18eb});var socket=require(_0x0bd5('0x18'))(new Redis(config[_0x0bd5('0x15')]));require(_0x0bd5('0x19'))[_0x0bd5('0x1a')](socket);var jayson=require(_0x0bd5('0x1b'));var client=jayson[_0x0bd5('0x1c')][_0x0bd5('0x1d')]({'port':0x232c});var client9002=jayson[_0x0bd5('0x1c')]['http']({'port':0x232a});function respondWithRpcPromise(_0x473c9e,_0x131ee5,_0x3f8ebf,_0x29999e){return new BPromise(function(_0x5457f5,_0x1e1368){var _0x1b73b3=_0x29999e||client;return _0x1b73b3[_0x0bd5('0x1e')](_0x473c9e,_0x3f8ebf)[_0x0bd5('0x1f')](function(_0x5d2223){logger[_0x0bd5('0x20')](_0x0bd5('0x21'),_0x131ee5,_0x0bd5('0x22'));logger[_0x0bd5('0x23')](_0x0bd5('0x24'),_0x131ee5,_0x0bd5('0x22'),JSON[_0x0bd5('0x25')](_0x5d2223));if(_0x5d2223[_0x0bd5('0x26')]){if(_0x5d2223[_0x0bd5('0x26')][_0x0bd5('0x27')]===0x1f4){logger['error'](_0x0bd5('0x21'),_0x131ee5,_0x5d2223[_0x0bd5('0x26')][_0x0bd5('0x28')]);return _0x1e1368(_0x5d2223['error'][_0x0bd5('0x28')]);}logger[_0x0bd5('0x26')](_0x0bd5('0x21'),_0x131ee5,_0x5d2223[_0x0bd5('0x26')]['message']);return _0x5457f5(_0x5d2223['error'][_0x0bd5('0x28')]);}else{logger[_0x0bd5('0x20')](_0x0bd5('0x21'),_0x131ee5,_0x0bd5('0x22'));_0x5457f5(_0x5d2223[_0x0bd5('0x29')][_0x0bd5('0x28')]);}})['catch'](function(_0x3f6d0b){logger[_0x0bd5('0x26')](_0x0bd5('0x21'),_0x131ee5,_0x3f6d0b);_0x1e1368(_0x3f6d0b);});});}function respondWithStatusCode(_0x49eb35,_0xdbb5d2){_0xdbb5d2=_0xdbb5d2||0xcc;return function(_0x373dd7){if(_0x373dd7){return _0x49eb35['sendStatus'](_0xdbb5d2);}return _0x49eb35[_0x0bd5('0x2a')](_0xdbb5d2)[_0x0bd5('0x2b')]();};}function respondWithResult(_0x2480c8,_0x7faa52){_0x7faa52=_0x7faa52||0xc8;return function(_0x5722f3){if(_0x5722f3){return _0x2480c8[_0x0bd5('0x2a')](_0x7faa52)['json'](_0x5722f3);}};}function respondWithFilteredResult(_0x3d8b19,_0x3c03ec){return function(_0x35d29f){if(_0x35d29f){var _0xe95c45=typeof _0x3c03ec['offset']===_0x0bd5('0x2c')&&typeof _0x3c03ec[_0x0bd5('0x2d')]==='undefined';var _0x466898=_0x35d29f[_0x0bd5('0x2e')];var _0x373e42=_0xe95c45?0x0:_0x3c03ec[_0x0bd5('0x2f')];var _0x16d993=_0xe95c45?_0x35d29f[_0x0bd5('0x2e')]:_0x3c03ec[_0x0bd5('0x2f')]+_0x3c03ec[_0x0bd5('0x2d')];var _0x4249eb;if(_0x16d993>=_0x466898){_0x16d993=_0x466898;_0x4249eb=0xc8;}else{_0x4249eb=0xce;}_0x3d8b19[_0x0bd5('0x2a')](_0x4249eb);return _0x3d8b19[_0x0bd5('0x30')](_0x0bd5('0x31'),_0x373e42+'-'+_0x16d993+'/'+_0x466898)[_0x0bd5('0x32')](_0x35d29f);}return null;};}function patchUpdates(_0x55f80a){return function(_0x77c8d9){try{jsonpatch[_0x0bd5('0x33')](_0x77c8d9,_0x55f80a,!![]);}catch(_0x17696e){return BPromise['reject'](_0x17696e);}return _0x77c8d9[_0x0bd5('0x34')]();};}function saveUpdates(_0x348af4,_0x427863){return function(_0xeea77e){if(_0xeea77e){return _0xeea77e[_0x0bd5('0x35')](_0x348af4)[_0x0bd5('0x1f')](function(_0x2a1549){return _0x2a1549;});}return null;};}function removeEntity(_0x35f0e6,_0x5a0ec0){return function(_0x503832){if(_0x503832){return _0x503832['destroy']()[_0x0bd5('0x1f')](function(){_0x35f0e6[_0x0bd5('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8a0833,_0x2faea1){return function(_0x3309c7){if(!_0x3309c7){_0x8a0833['sendStatus'](0x194);}return _0x3309c7;};}function handleError(_0x1941d3,_0x19d293){_0x19d293=_0x19d293||0x1f4;return function(_0x2c80bd){logger['error'](_0x2c80bd['stack']);if(_0x2c80bd[_0x0bd5('0x36')]){delete _0x2c80bd['name'];}_0x1941d3['status'](_0x19d293)[_0x0bd5('0x37')](_0x2c80bd);};}exports[_0x0bd5('0x38')]=function(_0x6f78dc,_0x49b0b3){var _0x55c845={},_0xdda468={},_0x38dffb={'count':0x0,'rows':[]};var _0x481911=_[_0x0bd5('0x39')](db['SmsMessage'][_0x0bd5('0x3a')],function(_0x38c15b){return{'name':_0x38c15b[_0x0bd5('0x3b')],'type':_0x38c15b[_0x0bd5('0x3c')][_0x0bd5('0x3d')]};});_0xdda468[_0x0bd5('0x3e')]=_[_0x0bd5('0x39')](_0x481911,_0x0bd5('0x36'));_0xdda468[_0x0bd5('0x3f')]=_[_0x0bd5('0x40')](_0x6f78dc[_0x0bd5('0x3f')]);_0xdda468[_0x0bd5('0x41')]=_[_0x0bd5('0x42')](_0xdda468[_0x0bd5('0x3e')],_0xdda468['query']);_0x55c845[_0x0bd5('0x43')]=_[_0x0bd5('0x42')](_0xdda468[_0x0bd5('0x3e')],qs['fields'](_0x6f78dc[_0x0bd5('0x3f')][_0x0bd5('0x44')]));_0x55c845[_0x0bd5('0x43')]=_0x55c845['attributes'][_0x0bd5('0x45')]?_0x55c845['attributes']:_0xdda468[_0x0bd5('0x3e')];if(!_0x6f78dc[_0x0bd5('0x3f')][_0x0bd5('0x46')](_0x0bd5('0x47'))){_0x55c845['limit']=qs[_0x0bd5('0x2d')](_0x6f78dc[_0x0bd5('0x3f')][_0x0bd5('0x2d')]);_0x55c845[_0x0bd5('0x2f')]=qs[_0x0bd5('0x2f')](_0x6f78dc[_0x0bd5('0x3f')][_0x0bd5('0x2f')]);}_0x55c845[_0x0bd5('0x48')]=qs[_0x0bd5('0x49')](_0x6f78dc[_0x0bd5('0x3f')][_0x0bd5('0x49')]);_0x55c845[_0x0bd5('0x4a')]=qs[_0x0bd5('0x41')](_[_0x0bd5('0x4b')](_0x6f78dc[_0x0bd5('0x3f')],_0xdda468[_0x0bd5('0x41')]),_0x481911);if(_0x6f78dc[_0x0bd5('0x3f')]['filter']){_0x55c845[_0x0bd5('0x4a')]=_[_0x0bd5('0x4c')](_0x55c845['where'],{'$or':_[_0x0bd5('0x39')](_0x481911,function(_0x2cb266){if(_0x2cb266[_0x0bd5('0x3c')]!==_0x0bd5('0x4d')){var _0x2a7b9f={};_0x2a7b9f[_0x2cb266[_0x0bd5('0x36')]]={'$like':'%'+_0x6f78dc[_0x0bd5('0x3f')][_0x0bd5('0x4e')]+'%'};return _0x2a7b9f;}})});}_0x55c845=_[_0x0bd5('0x4c')]({},_0x55c845,_0x6f78dc[_0x0bd5('0x4f')]);var _0x4a622b={'where':_0x55c845[_0x0bd5('0x4a')]};return db['SmsMessage'][_0x0bd5('0x2e')](_0x4a622b)['then'](function(_0x3e8120){_0x38dffb[_0x0bd5('0x2e')]=_0x3e8120;if(_0x6f78dc[_0x0bd5('0x3f')]['includeAll']){_0x55c845['include']=[{'all':!![]}];}return db[_0x0bd5('0x50')]['findAll'](_0x55c845);})[_0x0bd5('0x1f')](function(_0x1a7f92){_0x38dffb[_0x0bd5('0x51')]=_0x1a7f92;return _0x38dffb;})[_0x0bd5('0x1f')](respondWithFilteredResult(_0x49b0b3,_0x55c845))[_0x0bd5('0x52')](handleError(_0x49b0b3,null));};exports[_0x0bd5('0x53')]=function(_0x426b81,_0x5d3e03){var _0xd25b63={'raw':!![],'where':{'id':_0x426b81[_0x0bd5('0x54')]['id']}},_0x352f8b={};_0x352f8b[_0x0bd5('0x3e')]=_[_0x0bd5('0x40')](db[_0x0bd5('0x50')][_0x0bd5('0x3a')]);_0x352f8b[_0x0bd5('0x3f')]=_[_0x0bd5('0x40')](_0x426b81[_0x0bd5('0x3f')]);_0x352f8b[_0x0bd5('0x41')]=_[_0x0bd5('0x42')](_0x352f8b['model'],_0x352f8b['query']);_0xd25b63[_0x0bd5('0x43')]=_[_0x0bd5('0x42')](_0x352f8b[_0x0bd5('0x3e')],qs['fields'](_0x426b81['query'][_0x0bd5('0x44')]));_0xd25b63['attributes']=_0xd25b63[_0x0bd5('0x43')][_0x0bd5('0x45')]?_0xd25b63[_0x0bd5('0x43')]:_0x352f8b['model'];if(_0x426b81[_0x0bd5('0x3f')][_0x0bd5('0x55')]){_0xd25b63[_0x0bd5('0x56')]=[{'all':!![]}];}_0xd25b63=_[_0x0bd5('0x4c')]({},_0xd25b63,_0x426b81[_0x0bd5('0x4f')]);return db['SmsMessage']['find'](_0xd25b63)[_0x0bd5('0x1f')](handleEntityNotFound(_0x5d3e03,null))[_0x0bd5('0x1f')](respondWithResult(_0x5d3e03,null))['catch'](handleError(_0x5d3e03,null));};exports[_0x0bd5('0x57')]=function(_0x2d9e31,_0x285ae3){return db[_0x0bd5('0x50')][_0x0bd5('0x57')](_0x2d9e31[_0x0bd5('0x58')],{})[_0x0bd5('0x1f')](respondWithResult(_0x285ae3,0xc9))[_0x0bd5('0x52')](handleError(_0x285ae3,null));};exports[_0x0bd5('0x35')]=function(_0x765b1e,_0x227774){if(_0x765b1e[_0x0bd5('0x58')]['id']){delete _0x765b1e[_0x0bd5('0x58')]['id'];}return db[_0x0bd5('0x50')][_0x0bd5('0x59')]({'where':{'id':_0x765b1e[_0x0bd5('0x54')]['id']}})[_0x0bd5('0x1f')](handleEntityNotFound(_0x227774,null))[_0x0bd5('0x1f')](saveUpdates(_0x765b1e['body'],null))[_0x0bd5('0x1f')](respondWithResult(_0x227774,null))[_0x0bd5('0x52')](handleError(_0x227774,null));};exports[_0x0bd5('0x5a')]=function(_0x3e7442,_0x2674ec){return db['SmsMessage'][_0x0bd5('0x59')]({'where':{'id':_0x3e7442['params']['id']}})[_0x0bd5('0x1f')](handleEntityNotFound(_0x2674ec,null))[_0x0bd5('0x1f')](removeEntity(_0x2674ec,null))['catch'](handleError(_0x2674ec,null));};exports[_0x0bd5('0x5b')]=function(_0x283136,_0x1f5604){return db[_0x0bd5('0x50')][_0x0bd5('0x5b')]()[_0x0bd5('0x1f')](respondWithResult(_0x1f5604,null))[_0x0bd5('0x52')](handleError(_0x1f5604,null));};var interaction_log=require('../../config/logger')(_0x0bd5('0x5c'));exports[_0x0bd5('0x5d')]=function(_0x15c5fb,_0xaffbec,_0x5f369d){var _0x5e1ee2={'agent':{},'channel':'sms'};if(_0x15c5fb['body']['id']){delete _0x15c5fb[_0x0bd5('0x58')]['id'];}_0x15c5fb[_0x0bd5('0x58')][_0x0bd5('0x5e')]=!![];_0x15c5fb['body'][_0x0bd5('0x5f')]=moment()['format'](_0x0bd5('0x60'));_0x15c5fb[_0x0bd5('0x58')]['UserId']=_0x15c5fb['body']['UserId']||_0x15c5fb['user']['id'];_0x5e1ee2[_0x0bd5('0x61')]['id']=_0x15c5fb[_0x0bd5('0x58')][_0x0bd5('0x62')];return db[_0x0bd5('0x50')][_0x0bd5('0x59')]({'where':{'id':_0x15c5fb['params']['id'],'UserId':null}})[_0x0bd5('0x1f')](handleEntityNotFound(_0xaffbec,null))['then'](saveUpdates(_0x15c5fb[_0x0bd5('0x58')],null))['then'](function(_0x3839c0){if(_0x3839c0){_0x5e1ee2[_0x0bd5('0x28')]=_0x3839c0[_0x0bd5('0x63')]({'plain':!![]});return db[_0x0bd5('0x64')][_0x0bd5('0x59')]({'where':{'id':_0x3839c0['SmsInteractionId']}});}return null;})[_0x0bd5('0x1f')](handleEntityNotFound(_0xaffbec,null))[_0x0bd5('0x1f')](function(_0x2b8bd0){if(_0x2b8bd0){return _0x2b8bd0[_0x0bd5('0x35')]({'UserId':_0x15c5fb[_0x0bd5('0x58')]['UserId'],'read1stAt':_[_0x0bd5('0x65')](_0x2b8bd0[_0x0bd5('0x66')])?moment()[_0x0bd5('0x67')](_0x0bd5('0x60')):undefined});}return null;})[_0x0bd5('0x1f')](function(_0x482c22){if(_0x482c22){_0x5e1ee2[_0x0bd5('0x68')]=_0x482c22['get']({'plain':!![]});interaction_log['info'](_0x0bd5('0x69'),_0x15c5fb[_0x0bd5('0x6a')]['id'],_0x15c5fb[_0x0bd5('0x6a')]['name'],_0x15c5fb[_0x0bd5('0x6a')][_0x0bd5('0x6b')],_0x5e1ee2[_0x0bd5('0x68')]['id'],_0x15c5fb[_0x0bd5('0x58')]?JSON['stringify'](_0x15c5fb[_0x0bd5('0x58')]):_0x0bd5('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x0bd5('0x6d'),_0x5e1ee2);}return null;})[_0x0bd5('0x1f')](function(_0x4b0f6f){var _0x3c55b3='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4b0f6f[_0x0bd5('0x28')][_0x0bd5('0x6e')];return db[_0x0bd5('0x6f')][_0x0bd5('0x3f')](_0x3c55b3,{'type':db[_0x0bd5('0x70')][_0x0bd5('0x71')][_0x0bd5('0x72')],'raw':!![]})[_0x0bd5('0x1f')](function(_0xb5073c){return _0xb5073c;});})[_0x0bd5('0x1f')](function(_0x1ee709){if(_0x1ee709){_0x5e1ee2[_0x0bd5('0x28')][_0x0bd5('0x73')]=_0x1ee709[0x0];if(!_0x15c5fb[_0x0bd5('0x58')][_0x0bd5('0x62')])return;return db[_0x0bd5('0x74')][_0x0bd5('0x59')]({'where':{'id':_0x15c5fb[_0x0bd5('0x58')]['UserId'],'role':_0x0bd5('0x61')},'attributes':['id',_0x0bd5('0x36'),_0x0bd5('0x75'),_0x0bd5('0x76'),_0x0bd5('0x77')],'raw':!![]});}return null;})[_0x0bd5('0x1f')](function(_0x8e13d9){if(!_0x8e13d9)return null;_0x5e1ee2['message'][_0x0bd5('0x61')]=_0x8e13d9;return _0x5e1ee2;})[_0x0bd5('0x1f')](function(_0x5116bd){if(_0x5116bd){if(_0x15c5fb[_0x0bd5('0x58')][_0x0bd5('0x78')]){_0x5e1ee2['message'][_0x0bd5('0x79')]=util[_0x0bd5('0x67')](_0x0bd5('0x7a'),_0x15c5fb[_0x0bd5('0x6a')][_0x0bd5('0x36')]);_0x5e1ee2[_0x0bd5('0x28')][_0x0bd5('0x7b')]=_0x5e1ee2[_0x0bd5('0x7b')];_0x5e1ee2[_0x0bd5('0x28')][_0x0bd5('0x7c')]=_0x5e1ee2[_0x0bd5('0x7b')];_0x5e1ee2[_0x0bd5('0x28')]['event']=_0x0bd5('0x5d');return respondWithRpcPromise(_0x0bd5('0x7d'),_0x0bd5('0x7d'),{'event':_0x0bd5('0x7e'),'message':_0x5e1ee2[_0x0bd5('0x28')]},client9002)[_0x0bd5('0x1f')](function(){return _0x5e1ee2;});}return _0x5e1ee2;}return null;})[_0x0bd5('0x1f')](respondWithResult(_0xaffbec,null))[_0x0bd5('0x52')](handleError(_0xaffbec,null));};var interaction_log=require('../../config/logger')('sms-interactions');exports[_0x0bd5('0x7f')]=function(_0x244b59,_0x5ec2b4,_0xa603d4){var _0x135694={'agent':{},'channel':_0x0bd5('0x80')};if(_0x244b59['body']['id']){delete _0x244b59[_0x0bd5('0x58')]['id'];}_0x244b59[_0x0bd5('0x58')][_0x0bd5('0x62')]=_0x244b59[_0x0bd5('0x58')][_0x0bd5('0x62')]||_0x244b59['user']['id'];_0x135694['agent']['id']=_0x244b59['body'][_0x0bd5('0x62')];return db['SmsMessage'][_0x0bd5('0x59')]({'where':{'id':_0x244b59[_0x0bd5('0x54')]['id'],'UserId':null}})[_0x0bd5('0x1f')](handleEntityNotFound(_0x5ec2b4,null))[_0x0bd5('0x1f')](function(_0x588866){if(_0x588866){_0x135694[_0x0bd5('0x28')]=_0x588866['get']({'plain':!![]});return db[_0x0bd5('0x64')][_0x0bd5('0x59')]({'where':{'id':_0x588866[_0x0bd5('0x81')]}});}return null;})['then'](handleEntityNotFound(_0x5ec2b4,null))['then'](function(_0x48a76a){if(_0x48a76a){_0x135694[_0x0bd5('0x68')]=_0x48a76a['get']({'plain':!![]});interaction_log['info'](_0x0bd5('0x82'),_0x244b59['user']['id'],_0x244b59[_0x0bd5('0x6a')]['name'],_0x244b59[_0x0bd5('0x6a')][_0x0bd5('0x6b')],_0x135694[_0x0bd5('0x68')]['id'],_0x244b59[_0x0bd5('0x58')]?JSON[_0x0bd5('0x25')](_0x244b59[_0x0bd5('0x58')]):_0x0bd5('0x6c'));return respondWithRpcPromise(_0x0bd5('0x83'),_0x0bd5('0x84'),_0x135694);}return null;})[_0x0bd5('0x1f')](function(_0x118358){var _0x10c332=_0x0bd5('0x85')+_0x118358['message'][_0x0bd5('0x6e')];return db[_0x0bd5('0x6f')][_0x0bd5('0x3f')](_0x10c332,{'type':db['Sequelize']['QueryTypes'][_0x0bd5('0x72')],'raw':!![]})[_0x0bd5('0x1f')](function(_0x18ccd2){return _0x18ccd2;});})[_0x0bd5('0x1f')](function(_0xbca213){if(_0xbca213){_0x135694[_0x0bd5('0x28')][_0x0bd5('0x73')]=_0xbca213[0x0];if(!_0x244b59[_0x0bd5('0x58')]['UserId'])return;return db[_0x0bd5('0x74')][_0x0bd5('0x59')]({'where':{'id':_0x244b59['body'][_0x0bd5('0x62')],'role':_0x0bd5('0x61')},'attributes':['id',_0x0bd5('0x36'),'fullname',_0x0bd5('0x76'),_0x0bd5('0x77')],'raw':!![]});}return null;})[_0x0bd5('0x1f')](function(_0x1eac09){if(!_0x1eac09)return null;_0x135694['message']['agent']=_0x1eac09;return _0x135694;})[_0x0bd5('0x1f')](function(_0x1aa901){if(_0x1aa901){_0x1aa901[_0x0bd5('0x28')]['interface']=util[_0x0bd5('0x67')]('SIP/%s',_0x244b59['user'][_0x0bd5('0x36')]);_0x1aa901['message'][_0x0bd5('0x7b')]=_0x135694[_0x0bd5('0x7b')];_0x1aa901[_0x0bd5('0x28')][_0x0bd5('0x7c')]=_0x135694[_0x0bd5('0x7b')];_0x1aa901[_0x0bd5('0x28')][_0x0bd5('0x86')]=_0x0bd5('0x7f');respondWithRpcPromise(_0x0bd5('0x7d'),_0x0bd5('0x7d'),{'event':_0x0bd5('0x87'),'message':_0x1aa901[_0x0bd5('0x28')]},client9002);return _0x135694;}return null;})[_0x0bd5('0x1f')](respondWithResult(_0x5ec2b4,null))['catch'](handleError(_0x5ec2b4,null));};exports[_0x0bd5('0x2a')]=function(_0x4f5bd4,_0x4bdc5e,_0x4a095f){if(_0x4f5bd4[_0x0bd5('0x58')]['id']){delete _0x4f5bd4[_0x0bd5('0x58')]['id'];}var _0x24e550;return db[_0x0bd5('0x50')][_0x0bd5('0x59')]({'where':{'id':_0x4f5bd4[_0x0bd5('0x54')]['id']}})[_0x0bd5('0x1f')](handleEntityNotFound(_0x4bdc5e,null))[_0x0bd5('0x1f')](function(_0x59fe20){if(_0x59fe20){_0x24e550=_0x59fe20;return db[_0x0bd5('0x88')][_0x0bd5('0x59')]({'where':{'id':_0x59fe20[_0x0bd5('0x89')]}});}})['then'](handleEntityNotFound(_0x4bdc5e,null))[_0x0bd5('0x1f')](function(_0x52f87b){if(_0x52f87b){logger[_0x0bd5('0x23')](_0x0bd5('0x24'),_0x0bd5('0x2a'),_0x0bd5('0x8a'),_0x52f87b[_0x0bd5('0x3c')],util['inspect'](_0x4f5bd4[_0x0bd5('0x58')],{'showHidden':![],'depth':null}));switch(_0x52f87b[_0x0bd5('0x3c')]){case _0x0bd5('0x8b'):if(_0x4f5bd4['body'][_0x0bd5('0x8c')]&&_0x4f5bd4['body'][_0x0bd5('0x8c')]===_0x24e550[_0x0bd5('0x8d')]){return _0x24e550[_0x0bd5('0x35')]({'read':!![]});}else{logger['error'](_0x0bd5('0x8e'),_0x0bd5('0x2a'),_0x0bd5('0x8b'),util[_0x0bd5('0x8f')](_0x4f5bd4[_0x0bd5('0x58')],{'showHidden':![],'depth':null}));}break;case _0x0bd5('0x90'):if(_0x4f5bd4['body'][_0x0bd5('0x91')]&&_0x4f5bd4[_0x0bd5('0x58')][_0x0bd5('0x91')]===_0x24e550[_0x0bd5('0x8d')]&&_['indexOf']([_0x0bd5('0x92'),_0x0bd5('0x93')],_0x4f5bd4[_0x0bd5('0x58')][_0x0bd5('0x94')])>=0x0){return _0x24e550[_0x0bd5('0x35')]({'read':!![]});}else{logger[_0x0bd5('0x26')](_0x0bd5('0x8e'),_0x0bd5('0x2a'),_0x0bd5('0x95'),util[_0x0bd5('0x8f')](_0x4f5bd4[_0x0bd5('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x160d00=_0x4f5bd4[_0x0bd5('0x58')][_0x0bd5('0x96')][0x0];if(_0x160d00[_0x0bd5('0x2a')]['groupName']===_0x0bd5('0x97')){return _0x24e550[_0x0bd5('0x35')]({'read':!![]});}else{logger[_0x0bd5('0x26')](_0x0bd5('0x8e'),'status','infobip',util['inspect'](_0x4f5bd4['body'],{'showHidden':![],'depth':null}));}break;}return _0x24e550;}})[_0x0bd5('0x1f')](respondWithResult(_0x4bdc5e,null))[_0x0bd5('0x52')](handleError(_0x4bdc5e,null));};
\ No newline at end of file
+var _0x1e44=['SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','ContactId','QueryTypes','fullname','email','SIP/%s','rejectmessage','SmsAccount','debug','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','name','send','index','map','fieldName','key','query','keys','filters','attributes','intersection','model','fields','length','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','SmsMessage','findAll','rows','show','params','rawAttributes','find','create','body','describe','sms-interactions','accept','sms','UserId','agent','get','SmsInteractionId','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','user','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','User','internal','manual','interface','channel','motionChannel','event','EventManager','../../config/logger'];(function(_0x2db639,_0xdea495){var _0x1025b6=function(_0x39817b){while(--_0x39817b){_0x2db639['push'](_0x2db639['shift']());}};_0x1025b6(++_0xdea495);}(_0x1e44,0xb3));var _0x41e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1e44[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x41e4('0x0'));var rimraf=require(_0x41e4('0x1'));var zipdir=require(_0x41e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x41e4('0x3'));var moment=require(_0x41e4('0x4'));var BPromise=require(_0x41e4('0x5'));var Mustache=require(_0x41e4('0x6'));var util=require('util');var path=require(_0x41e4('0x7'));var sox=require(_0x41e4('0x8'));var csv=require(_0x41e4('0x9'));var ejs=require(_0x41e4('0xa'));var fs=require('fs');var fs_extra=require(_0x41e4('0xb'));var _=require(_0x41e4('0xc'));var squel=require(_0x41e4('0xd'));var crypto=require(_0x41e4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x41e4('0xf'));var toCsv=require(_0x41e4('0x9'));var querystring=require(_0x41e4('0x10'));var Papa=require(_0x41e4('0x11'));var Redis=require(_0x41e4('0x12'));var authService=require(_0x41e4('0x13'));var qs=require(_0x41e4('0x14'));var as=require(_0x41e4('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x41e4('0x16'));var utils=require('../../config/utils');var config=require(_0x41e4('0x17'));var licenseUtil=require(_0x41e4('0x18'));var db=require(_0x41e4('0x19'))['db'];config[_0x41e4('0x1a')]=_[_0x41e4('0x1b')](config[_0x41e4('0x1a')],{'host':_0x41e4('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x41e4('0x1d'))['register'](socket);var jayson=require(_0x41e4('0x1e'));var client=jayson['client'][_0x41e4('0x1f')]({'port':0x232c});var client9002=jayson[_0x41e4('0x20')][_0x41e4('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x508caa,_0x41238a,_0x2e9500,_0x5b207d){return new BPromise(function(_0x5bbe36,_0x56d8d1){var _0x4b5fb6=_0x5b207d||client;return _0x4b5fb6[_0x41e4('0x21')](_0x508caa,_0x2e9500)[_0x41e4('0x22')](function(_0xdd9766){logger[_0x41e4('0x23')](_0x41e4('0x24'),_0x41238a,'request\x20sent');logger['debug'](_0x41e4('0x25'),_0x41238a,_0x41e4('0x26'),JSON[_0x41e4('0x27')](_0xdd9766));if(_0xdd9766[_0x41e4('0x28')]){if(_0xdd9766[_0x41e4('0x28')][_0x41e4('0x29')]===0x1f4){logger[_0x41e4('0x28')](_0x41e4('0x24'),_0x41238a,_0xdd9766['error'][_0x41e4('0x2a')]);return _0x56d8d1(_0xdd9766['error'][_0x41e4('0x2a')]);}logger[_0x41e4('0x28')](_0x41e4('0x24'),_0x41238a,_0xdd9766[_0x41e4('0x28')][_0x41e4('0x2a')]);return _0x5bbe36(_0xdd9766[_0x41e4('0x28')]['message']);}else{logger[_0x41e4('0x23')]('SmsMessage,\x20%s,\x20%s',_0x41238a,_0x41e4('0x26'));_0x5bbe36(_0xdd9766[_0x41e4('0x2b')][_0x41e4('0x2a')]);}})[_0x41e4('0x2c')](function(_0x18fac9){logger[_0x41e4('0x28')](_0x41e4('0x24'),_0x41238a,_0x18fac9);_0x56d8d1(_0x18fac9);});});}function respondWithStatusCode(_0xe9bc87,_0x297fa1){_0x297fa1=_0x297fa1||0xcc;return function(_0x2dd222){if(_0x2dd222){return _0xe9bc87[_0x41e4('0x2d')](_0x297fa1);}return _0xe9bc87[_0x41e4('0x2e')](_0x297fa1)[_0x41e4('0x2f')]();};}function respondWithResult(_0x74ea28,_0x3f2749){_0x3f2749=_0x3f2749||0xc8;return function(_0x136fc5){if(_0x136fc5){return _0x74ea28[_0x41e4('0x2e')](_0x3f2749)[_0x41e4('0x30')](_0x136fc5);}};}function respondWithFilteredResult(_0xff795e,_0x3599c8){return function(_0x4fe8b2){if(_0x4fe8b2){var _0x16fa1b=typeof _0x3599c8[_0x41e4('0x31')]===_0x41e4('0x32')&&typeof _0x3599c8['limit']===_0x41e4('0x32');var _0x163fef=_0x4fe8b2[_0x41e4('0x33')];var _0x103e28=_0x16fa1b?0x0:_0x3599c8[_0x41e4('0x31')];var _0x1f3a8b=_0x16fa1b?_0x4fe8b2[_0x41e4('0x33')]:_0x3599c8['offset']+_0x3599c8[_0x41e4('0x34')];var _0x31b1b8;if(_0x1f3a8b>=_0x163fef){_0x1f3a8b=_0x163fef;_0x31b1b8=0xc8;}else{_0x31b1b8=0xce;}_0xff795e[_0x41e4('0x2e')](_0x31b1b8);return _0xff795e['set'](_0x41e4('0x35'),_0x103e28+'-'+_0x1f3a8b+'/'+_0x163fef)[_0x41e4('0x30')](_0x4fe8b2);}return null;};}function patchUpdates(_0x130ad0){return function(_0x530fcd){try{jsonpatch[_0x41e4('0x36')](_0x530fcd,_0x130ad0,!![]);}catch(_0x2c86fe){return BPromise[_0x41e4('0x37')](_0x2c86fe);}return _0x530fcd[_0x41e4('0x38')]();};}function saveUpdates(_0x4e1b3f,_0xec2833){return function(_0x1160da){if(_0x1160da){return _0x1160da[_0x41e4('0x39')](_0x4e1b3f)[_0x41e4('0x22')](function(_0x3b86ff){return _0x3b86ff;});}return null;};}function removeEntity(_0x5687d4,_0x22267a){return function(_0xbc5c7a){if(_0xbc5c7a){return _0xbc5c7a[_0x41e4('0x3a')]()[_0x41e4('0x22')](function(){_0x5687d4['status'](0xcc)[_0x41e4('0x2f')]();});}};}function handleEntityNotFound(_0x13164b,_0x311a05){return function(_0x31702c){if(!_0x31702c){_0x13164b['sendStatus'](0x194);}return _0x31702c;};}function handleError(_0x5c3dec,_0x5ef1c1){_0x5ef1c1=_0x5ef1c1||0x1f4;return function(_0x19362c){logger[_0x41e4('0x28')](_0x19362c['stack']);if(_0x19362c[_0x41e4('0x3b')]){delete _0x19362c['name'];}_0x5c3dec['status'](_0x5ef1c1)[_0x41e4('0x3c')](_0x19362c);};}exports[_0x41e4('0x3d')]=function(_0x210e83,_0x3de587){var _0x3696e6={},_0x2eb0aa={},_0x3a8114={'count':0x0,'rows':[]};var _0x298d05=_[_0x41e4('0x3e')](db['SmsMessage']['rawAttributes'],function(_0x54678d){return{'name':_0x54678d[_0x41e4('0x3f')],'type':_0x54678d['type'][_0x41e4('0x40')]};});_0x2eb0aa['model']=_[_0x41e4('0x3e')](_0x298d05,_0x41e4('0x3b'));_0x2eb0aa[_0x41e4('0x41')]=_[_0x41e4('0x42')](_0x210e83[_0x41e4('0x41')]);_0x2eb0aa[_0x41e4('0x43')]=_['intersection'](_0x2eb0aa['model'],_0x2eb0aa[_0x41e4('0x41')]);_0x3696e6[_0x41e4('0x44')]=_[_0x41e4('0x45')](_0x2eb0aa[_0x41e4('0x46')],qs[_0x41e4('0x47')](_0x210e83[_0x41e4('0x41')]['fields']));_0x3696e6['attributes']=_0x3696e6[_0x41e4('0x44')][_0x41e4('0x48')]?_0x3696e6[_0x41e4('0x44')]:_0x2eb0aa[_0x41e4('0x46')];if(!_0x210e83[_0x41e4('0x41')]['hasOwnProperty']('nolimit')){_0x3696e6[_0x41e4('0x34')]=qs['limit'](_0x210e83[_0x41e4('0x41')][_0x41e4('0x34')]);_0x3696e6[_0x41e4('0x31')]=qs['offset'](_0x210e83[_0x41e4('0x41')][_0x41e4('0x31')]);}_0x3696e6[_0x41e4('0x49')]=qs[_0x41e4('0x4a')](_0x210e83[_0x41e4('0x41')][_0x41e4('0x4a')]);_0x3696e6[_0x41e4('0x4b')]=qs[_0x41e4('0x43')](_[_0x41e4('0x4c')](_0x210e83[_0x41e4('0x41')],_0x2eb0aa[_0x41e4('0x43')]),_0x298d05);if(_0x210e83['query'][_0x41e4('0x4d')]){_0x3696e6['where']=_[_0x41e4('0x4e')](_0x3696e6[_0x41e4('0x4b')],{'$or':_[_0x41e4('0x3e')](_0x298d05,function(_0x448892){if(_0x448892[_0x41e4('0x4f')]!==_0x41e4('0x50')){var _0x21b983={};_0x21b983[_0x448892[_0x41e4('0x3b')]]={'$like':'%'+_0x210e83[_0x41e4('0x41')][_0x41e4('0x4d')]+'%'};return _0x21b983;}})});}_0x3696e6=_['merge']({},_0x3696e6,_0x210e83['options']);var _0x16cb47={'where':_0x3696e6[_0x41e4('0x4b')]};return db['SmsMessage']['count'](_0x16cb47)[_0x41e4('0x22')](function(_0x235ada){_0x3a8114['count']=_0x235ada;if(_0x210e83[_0x41e4('0x41')][_0x41e4('0x51')]){_0x3696e6[_0x41e4('0x52')]=[{'all':!![]}];}return db[_0x41e4('0x53')][_0x41e4('0x54')](_0x3696e6);})[_0x41e4('0x22')](function(_0x3330c1){_0x3a8114[_0x41e4('0x55')]=_0x3330c1;return _0x3a8114;})['then'](respondWithFilteredResult(_0x3de587,_0x3696e6))[_0x41e4('0x2c')](handleError(_0x3de587,null));};exports[_0x41e4('0x56')]=function(_0x5a1ac8,_0x5a594e){var _0x490948={'raw':!![],'where':{'id':_0x5a1ac8[_0x41e4('0x57')]['id']}},_0xdf65c6={};_0xdf65c6[_0x41e4('0x46')]=_[_0x41e4('0x42')](db[_0x41e4('0x53')][_0x41e4('0x58')]);_0xdf65c6[_0x41e4('0x41')]=_[_0x41e4('0x42')](_0x5a1ac8[_0x41e4('0x41')]);_0xdf65c6[_0x41e4('0x43')]=_[_0x41e4('0x45')](_0xdf65c6['model'],_0xdf65c6[_0x41e4('0x41')]);_0x490948[_0x41e4('0x44')]=_[_0x41e4('0x45')](_0xdf65c6[_0x41e4('0x46')],qs[_0x41e4('0x47')](_0x5a1ac8[_0x41e4('0x41')][_0x41e4('0x47')]));_0x490948[_0x41e4('0x44')]=_0x490948[_0x41e4('0x44')][_0x41e4('0x48')]?_0x490948[_0x41e4('0x44')]:_0xdf65c6[_0x41e4('0x46')];if(_0x5a1ac8[_0x41e4('0x41')]['includeAll']){_0x490948[_0x41e4('0x52')]=[{'all':!![]}];}_0x490948=_['merge']({},_0x490948,_0x5a1ac8['options']);return db['SmsMessage'][_0x41e4('0x59')](_0x490948)[_0x41e4('0x22')](handleEntityNotFound(_0x5a594e,null))[_0x41e4('0x22')](respondWithResult(_0x5a594e,null))[_0x41e4('0x2c')](handleError(_0x5a594e,null));};exports[_0x41e4('0x5a')]=function(_0x422f50,_0x4830da){return db['SmsMessage'][_0x41e4('0x5a')](_0x422f50[_0x41e4('0x5b')],{})[_0x41e4('0x22')](respondWithResult(_0x4830da,0xc9))[_0x41e4('0x2c')](handleError(_0x4830da,null));};exports['update']=function(_0x26fd45,_0x1cd8cc){if(_0x26fd45['body']['id']){delete _0x26fd45['body']['id'];}return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x26fd45[_0x41e4('0x57')]['id']}})[_0x41e4('0x22')](handleEntityNotFound(_0x1cd8cc,null))[_0x41e4('0x22')](saveUpdates(_0x26fd45[_0x41e4('0x5b')],null))['then'](respondWithResult(_0x1cd8cc,null))[_0x41e4('0x2c')](handleError(_0x1cd8cc,null));};exports[_0x41e4('0x3a')]=function(_0x30a948,_0x242323){return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x30a948[_0x41e4('0x57')]['id']}})[_0x41e4('0x22')](handleEntityNotFound(_0x242323,null))[_0x41e4('0x22')](removeEntity(_0x242323,null))[_0x41e4('0x2c')](handleError(_0x242323,null));};exports['describe']=function(_0x16bae9,_0x4911e9){return db['SmsMessage'][_0x41e4('0x5c')]()[_0x41e4('0x22')](respondWithResult(_0x4911e9,null))[_0x41e4('0x2c')](handleError(_0x4911e9,null));};var interaction_log=require('../../config/logger')(_0x41e4('0x5d'));exports[_0x41e4('0x5e')]=function(_0x37416d,_0x49185d,_0xf1c89e){var _0x2c29c1={'agent':{},'channel':_0x41e4('0x5f')};if(_0x37416d[_0x41e4('0x5b')]['id']){delete _0x37416d[_0x41e4('0x5b')]['id'];}_0x37416d[_0x41e4('0x5b')]['read']=!![];_0x37416d[_0x41e4('0x5b')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37416d[_0x41e4('0x5b')]['UserId']=_0x37416d[_0x41e4('0x5b')][_0x41e4('0x60')]||_0x37416d['user']['id'];_0x2c29c1[_0x41e4('0x61')]['id']=_0x37416d['body'][_0x41e4('0x60')];return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x37416d[_0x41e4('0x57')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x49185d,null))[_0x41e4('0x22')](saveUpdates(_0x37416d[_0x41e4('0x5b')],null))['then'](function(_0x3cc255){if(_0x3cc255){_0x2c29c1[_0x41e4('0x2a')]=_0x3cc255[_0x41e4('0x62')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x3cc255[_0x41e4('0x63')]}});}return null;})[_0x41e4('0x22')](handleEntityNotFound(_0x49185d,null))[_0x41e4('0x22')](function(_0xe7826){if(_0xe7826){return _0xe7826[_0x41e4('0x39')]({'UserId':_0x37416d[_0x41e4('0x5b')][_0x41e4('0x60')],'read1stAt':_[_0x41e4('0x64')](_0xe7826[_0x41e4('0x65')])?moment()[_0x41e4('0x66')](_0x41e4('0x67')):undefined});}return null;})[_0x41e4('0x22')](function(_0x21cb55){if(_0x21cb55){_0x2c29c1['interaction']=_0x21cb55[_0x41e4('0x62')]({'plain':!![]});interaction_log[_0x41e4('0x23')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x37416d[_0x41e4('0x68')]['id'],_0x37416d[_0x41e4('0x68')][_0x41e4('0x3b')],_0x37416d[_0x41e4('0x68')]['role'],_0x2c29c1[_0x41e4('0x69')]['id'],_0x37416d[_0x41e4('0x5b')]?JSON[_0x41e4('0x27')](_0x37416d[_0x41e4('0x5b')]):_0x41e4('0x6a'));return respondWithRpcPromise(_0x41e4('0x6b'),_0x41e4('0x6c'),_0x2c29c1);}return null;})[_0x41e4('0x22')](function(_0x539257){var _0x1df624=_0x41e4('0x6d')+_0x539257['message']['ContactId'];return db[_0x41e4('0x6e')][_0x41e4('0x41')](_0x1df624,{'type':db[_0x41e4('0x6f')]['QueryTypes'][_0x41e4('0x70')],'raw':!![]})[_0x41e4('0x22')](function(_0x462f8f){return _0x462f8f;});})[_0x41e4('0x22')](function(_0x7665){if(_0x7665){_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x71')]=_0x7665[0x0];if(!_0x37416d['body'][_0x41e4('0x60')])return;return db[_0x41e4('0x72')][_0x41e4('0x59')]({'where':{'id':_0x37416d[_0x41e4('0x5b')][_0x41e4('0x60')],'role':_0x41e4('0x61')},'attributes':['id','name','fullname','email',_0x41e4('0x73')],'raw':!![]});}return null;})['then'](function(_0x59a579){if(!_0x59a579)return null;_0x2c29c1[_0x41e4('0x2a')]['agent']=_0x59a579;return _0x2c29c1;})[_0x41e4('0x22')](function(_0x2c83ca){if(_0x2c83ca){if(_0x37416d[_0x41e4('0x5b')][_0x41e4('0x74')]){_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x75')]=util[_0x41e4('0x66')]('SIP/%s',_0x37416d[_0x41e4('0x68')][_0x41e4('0x3b')]);_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x76')]=_0x2c29c1[_0x41e4('0x76')];_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x77')]=_0x2c29c1[_0x41e4('0x76')];_0x2c29c1[_0x41e4('0x2a')][_0x41e4('0x78')]=_0x41e4('0x5e');return respondWithRpcPromise(_0x41e4('0x79'),'EventManager',{'event':'acceptmessage','message':_0x2c29c1['message']},client9002)[_0x41e4('0x22')](function(){return _0x2c29c1;});}return _0x2c29c1;}return null;})[_0x41e4('0x22')](respondWithResult(_0x49185d,null))['catch'](handleError(_0x49185d,null));};var interaction_log=require(_0x41e4('0x7a'))(_0x41e4('0x5d'));exports['reject']=function(_0x4ca991,_0x504e8d,_0x5ca509){var _0x431c9a={'agent':{},'channel':_0x41e4('0x5f')};if(_0x4ca991[_0x41e4('0x5b')]['id']){delete _0x4ca991[_0x41e4('0x5b')]['id'];}_0x4ca991[_0x41e4('0x5b')][_0x41e4('0x60')]=_0x4ca991[_0x41e4('0x5b')][_0x41e4('0x60')]||_0x4ca991['user']['id'];_0x431c9a[_0x41e4('0x61')]['id']=_0x4ca991['body'][_0x41e4('0x60')];return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x4ca991[_0x41e4('0x57')]['id'],'UserId':null}})[_0x41e4('0x22')](handleEntityNotFound(_0x504e8d,null))[_0x41e4('0x22')](function(_0x50c4c6){if(_0x50c4c6){_0x431c9a[_0x41e4('0x2a')]=_0x50c4c6[_0x41e4('0x62')]({'plain':!![]});return db[_0x41e4('0x7b')][_0x41e4('0x59')]({'where':{'id':_0x50c4c6['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x504e8d,null))[_0x41e4('0x22')](function(_0x258177){if(_0x258177){_0x431c9a[_0x41e4('0x69')]=_0x258177['get']({'plain':!![]});interaction_log[_0x41e4('0x23')](_0x41e4('0x7c'),_0x4ca991[_0x41e4('0x68')]['id'],_0x4ca991['user'][_0x41e4('0x3b')],_0x4ca991[_0x41e4('0x68')][_0x41e4('0x7d')],_0x431c9a[_0x41e4('0x69')]['id'],_0x4ca991[_0x41e4('0x5b')]?JSON[_0x41e4('0x27')](_0x4ca991[_0x41e4('0x5b')]):_0x41e4('0x6a'));return respondWithRpcPromise(_0x41e4('0x7e'),'rejectMessage',_0x431c9a);}return null;})[_0x41e4('0x22')](function(_0x5aeb70){var _0x534796=_0x41e4('0x6d')+_0x5aeb70[_0x41e4('0x2a')][_0x41e4('0x7f')];return db[_0x41e4('0x6e')][_0x41e4('0x41')](_0x534796,{'type':db[_0x41e4('0x6f')][_0x41e4('0x80')]['SELECT'],'raw':!![]})[_0x41e4('0x22')](function(_0x52bdc0){return _0x52bdc0;});})[_0x41e4('0x22')](function(_0x2702e6){if(_0x2702e6){_0x431c9a[_0x41e4('0x2a')][_0x41e4('0x71')]=_0x2702e6[0x0];if(!_0x4ca991['body']['UserId'])return;return db['User']['find']({'where':{'id':_0x4ca991['body'][_0x41e4('0x60')],'role':_0x41e4('0x61')},'attributes':['id','name',_0x41e4('0x81'),_0x41e4('0x82'),'internal'],'raw':!![]});}return null;})[_0x41e4('0x22')](function(_0x5c0702){if(!_0x5c0702)return null;_0x431c9a[_0x41e4('0x2a')]['agent']=_0x5c0702;return _0x431c9a;})[_0x41e4('0x22')](function(_0x3c4151){if(_0x3c4151){_0x3c4151['message']['interface']=util[_0x41e4('0x66')](_0x41e4('0x83'),_0x4ca991[_0x41e4('0x68')][_0x41e4('0x3b')]);_0x3c4151[_0x41e4('0x2a')][_0x41e4('0x76')]=_0x431c9a['channel'];_0x3c4151['message'][_0x41e4('0x77')]=_0x431c9a[_0x41e4('0x76')];_0x3c4151['message'][_0x41e4('0x78')]=_0x41e4('0x37');respondWithRpcPromise(_0x41e4('0x79'),_0x41e4('0x79'),{'event':_0x41e4('0x84'),'message':_0x3c4151['message']},client9002);return _0x431c9a;}return null;})[_0x41e4('0x22')](respondWithResult(_0x504e8d,null))[_0x41e4('0x2c')](handleError(_0x504e8d,null));};exports[_0x41e4('0x2e')]=function(_0x543551,_0x2c7de1,_0x2a211e){if(_0x543551['body']['id']){delete _0x543551[_0x41e4('0x5b')]['id'];}var _0x36b4ad;return db[_0x41e4('0x53')][_0x41e4('0x59')]({'where':{'id':_0x543551[_0x41e4('0x57')]['id']}})[_0x41e4('0x22')](handleEntityNotFound(_0x2c7de1,null))[_0x41e4('0x22')](function(_0x5dd2b8){if(_0x5dd2b8){_0x36b4ad=_0x5dd2b8;return db[_0x41e4('0x85')]['find']({'where':{'id':_0x5dd2b8['SmsAccountId']}});}})[_0x41e4('0x22')](handleEntityNotFound(_0x2c7de1,null))[_0x41e4('0x22')](function(_0x365fc1){if(_0x365fc1){logger[_0x41e4('0x86')](_0x41e4('0x25'),_0x41e4('0x2e'),_0x41e4('0x87'),_0x365fc1[_0x41e4('0x4f')],util[_0x41e4('0x88')](_0x543551[_0x41e4('0x5b')],{'showHidden':![],'depth':null}));switch(_0x365fc1['type']){case _0x41e4('0x89'):if(_0x543551['body'][_0x41e4('0x8a')]&&_0x543551['body']['MessageSid']===_0x36b4ad[_0x41e4('0x8b')]){return _0x36b4ad['update']({'read':!![]});}else{logger[_0x41e4('0x28')](_0x41e4('0x8c'),_0x41e4('0x2e'),_0x41e4('0x89'),util[_0x41e4('0x88')](_0x543551[_0x41e4('0x5b')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x543551['body'][_0x41e4('0x8d')]&&_0x543551[_0x41e4('0x5b')]['MessageUUID']===_0x36b4ad['messageId']&&_[_0x41e4('0x8e')]([_0x41e4('0x8f'),_0x41e4('0x90')],_0x543551[_0x41e4('0x5b')][_0x41e4('0x91')])>=0x0){return _0x36b4ad[_0x41e4('0x39')]({'read':!![]});}else{logger[_0x41e4('0x28')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x41e4('0x2e'),_0x41e4('0x92'),util[_0x41e4('0x88')](_0x543551['body'],{'showHidden':![],'depth':null}));}break;case _0x41e4('0x93'):var _0xb7c4d9=_0x543551[_0x41e4('0x5b')][_0x41e4('0x94')][0x0];if(_0xb7c4d9[_0x41e4('0x2e')][_0x41e4('0x95')]===_0x41e4('0x96')){return _0x36b4ad['update']({'read':!![]});}else{logger[_0x41e4('0x28')](_0x41e4('0x8c'),_0x41e4('0x2e'),_0x41e4('0x93'),util[_0x41e4('0x88')](_0x543551['body'],{'showHidden':![],'depth':null}));}break;}return _0x36b4ad;}})[_0x41e4('0x22')](respondWithResult(_0x2c7de1,null))[_0x41e4('0x2c')](handleError(_0x2c7de1,null));};
\ No newline at end of file
index 3f55be1..6f7858e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc18=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x21a268,_0x57219b){var _0x573dfb=function(_0x36372b){while(--_0x36372b){_0x21a268['push'](_0x21a268['shift']());}};_0x573dfb(++_0x57219b);}(_0xbc18,0x1e4));var _0x8bc1=function(_0x539533,_0x59b89b){_0x539533=_0x539533-0x0;var _0x3942f3=_0xbc18[_0x539533];return _0x3942f3;};'use strict';var EventEmitter=require(_0x8bc1('0x0'));var SmsMessage=require(_0x8bc1('0x1'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8bc1('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8bc1('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1d2992){return function(_0x11e949,_0x160859,_0xf4c47a){SmsMessageEvents[_0x8bc1('0x4')](_0x1d2992+':'+_0x11e949['id'],_0x11e949);SmsMessageEvents[_0x8bc1('0x4')](_0x1d2992,_0x11e949);_0xf4c47a(null);};}for(var e in events){if(events[_0x8bc1('0x5')](e)){var event=events[e];SmsMessage[_0x8bc1('0x6')](e,emitEvent(event));}}module[_0x8bc1('0x7')]=SmsMessageEvents;
\ No newline at end of file
+var _0xac88=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','update','remove'];(function(_0x4d44ff,_0x4dbe86){var _0x2e9706=function(_0xba1c71){while(--_0xba1c71){_0x4d44ff['push'](_0x4d44ff['shift']());}};_0x2e9706(++_0x4dbe86);}(_0xac88,0x112));var _0x8ac8=function(_0x291024,_0xfbf1b){_0x291024=_0x291024-0x0;var _0x519e58=_0xac88[_0x291024];return _0x519e58;};'use strict';var EventEmitter=require(_0x8ac8('0x0'));var SmsMessage=require(_0x8ac8('0x1'))['db'][_0x8ac8('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8ac8('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8ac8('0x4'),'afterDestroy':_0x8ac8('0x5')};function emitEvent(_0x2c879b){return function(_0x194d14,_0x436c89,_0x50ba87){SmsMessageEvents[_0x8ac8('0x6')](_0x2c879b+':'+_0x194d14['id'],_0x194d14);SmsMessageEvents[_0x8ac8('0x6')](_0x2c879b,_0x194d14);_0x50ba87(null);};}for(var e in events){if(events[_0x8ac8('0x7')](e)){var event=events[e];SmsMessage[_0x8ac8('0x8')](e,emitEvent(event));}}module[_0x8ac8('0x9')]=SmsMessageEvents;
\ No newline at end of file
index 6d1c68e..bbf146c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd901=['error','secret','find','SmsAccountId','type','twilio','accountSid','authToken','phone','create','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','split','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','body','senderString','https://smsapi.connectel.se/api/v2/send/','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','Basic\x20%s','toString','http_code','data','head','messages','message_id','clickSend','plivo','authId','remote','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','keys','id_sms','clickatell','https://platform.clickatell.com/messages','apiMessageId','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','createdAt','catch'];(function(_0x11c523,_0x430d11){var _0x8e9e27=function(_0x4d92a1){while(--_0x4d92a1){_0x11c523['push'](_0x11c523['shift']());}};_0x8e9e27(++_0x430d11);}(_0xd901,0x1ee));var _0x1d90=function(_0x305866,_0x556589){_0x305866=_0x305866-0x0;var _0x5894ea=_0xd901[_0x305866];return _0x5894ea;};'use strict';var _=require(_0x1d90('0x0'));var util=require(_0x1d90('0x1'));var logger=require(_0x1d90('0x2'))(_0x1d90('0x3'));var moment=require(_0x1d90('0x4'));var BPromise=require(_0x1d90('0x5'));var rp=require(_0x1d90('0x6'));var fs=require('fs');var path=require(_0x1d90('0x7'));var rimraf=require(_0x1d90('0x8'));var config=require('../../config/environment');var attributes=require(_0x1d90('0x9'));module[_0x1d90('0xa')]=function(_0x1913f5,_0x30b0e1){return _0x1913f5[_0x1d90('0xb')](_0x1d90('0xc'),attributes,{'tableName':_0x1d90('0xd'),'paranoid':![],'indexes':[{'name':_0x1d90('0xe'),'fields':[_0x1d90('0xe')]},{'name':_0x1d90('0xf'),'fields':['body'],'type':_0x1d90('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x42d6d4,_0x468821,_0x308451){var _0x49cf13=_0x1913f5[_0x1d90('0x11')];var _0x27d7ad=_0x42d6d4[_0x1d90('0x12')]({'plain':!![]});if(_0x27d7ad[_0x1d90('0x13')][_0x1d90('0x14')]()==='in'||_0x27d7ad[_0x1d90('0x13')][_0x1d90('0x14')]()===_0x1d90('0x15')&&!_0x27d7ad['secret']&&!_[_0x1d90('0x16')](_0x27d7ad[_0x1d90('0x17')])&&!_[_0x1d90('0x16')](_0x27d7ad[_0x1d90('0x18')])){_0x49cf13[_0x1d90('0x19')][_0x1d90('0x1a')]({'where':{'id':_0x27d7ad['SmsInteractionId']}})[_0x1d90('0x1b')](function(_0xcd8b5f){if(_0xcd8b5f){_0xcd8b5f['update']({'lastMsgAt':_0x27d7ad[_0x1d90('0x1c')],'lastMsgDirection':_0x27d7ad[_0x1d90('0x13')][_0x1d90('0x14')]()});}})[_0x1d90('0x1d')](function(_0x43cb17){console[_0x1d90('0x1e')](_0x43cb17);});}if(_0x27d7ad[_0x1d90('0x13')]===_0x1d90('0x15')&&!_0x27d7ad[_0x1d90('0x1f')]){var _0x85f82b;_0x49cf13['SmsAccount'][_0x1d90('0x20')]({'where':{'id':_0x27d7ad[_0x1d90('0x21')]},'raw':!![]})[_0x1d90('0x1b')](function(_0x149d07){_0x85f82b=_0x149d07;if(_0x85f82b&&_0x85f82b[_0x1d90('0x22')]){switch(_0x85f82b[_0x1d90('0x22')]){case'twilio':var _0x2e3fdc=require(_0x1d90('0x23'));if(_0x85f82b[_0x1d90('0x24')]&&_0x85f82b[_0x1d90('0x25')]&&_0x85f82b[_0x1d90('0x26')]){var _0x3ff34a=new _0x2e3fdc(_0x85f82b[_0x1d90('0x24')],_0x85f82b['authToken']);_0x3ff34a['messages'][_0x1d90('0x27')]({'body':_0x27d7ad['body'],'to':_0x27d7ad['phone'],'from':_0x85f82b[_0x1d90('0x26')],'statusCallback':_0x85f82b['remote']+_0x1d90('0x28')+_0x27d7ad['id']+_0x1d90('0x29')+_0x85f82b[_0x1d90('0x2a')]})[_0x1d90('0x1b')](function(_0x3ab2ad){if(_0x3ab2ad[_0x1d90('0x2b')]){return _0x42d6d4[_0x1d90('0x2c')]({'messageId':_0x3ab2ad['sid']});}})['catch'](function(_0x1e5cc9){logger['error'](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x23'),util[_0x1d90('0x2e')](_0x1e5cc9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x1d90('0x2d'),_0x1d90('0x2f'),'twilio',_0x1d90('0x30'));}break;case _0x1d90('0x31'):var _0x1108ea='https://api.skebby.it/API/v1.0/REST/';if(_0x85f82b[_0x1d90('0x32')]&&_0x85f82b[_0x1d90('0x33')]){var _0x108105={'recipient':[_0x27d7ad[_0x1d90('0x26')]],'message':_0x27d7ad['body'],'message_type':_0x85f82b['smsMethod']};if(_0x85f82b[_0x1d90('0x34')]&&_0x85f82b[_0x1d90('0x34')]!=='SI'){_0x108105[_0x1d90('0x35')]=_0x85f82b['phone'];}var _0x1839a6={'url':_0x1108ea+_0x1d90('0x36')+_0x85f82b[_0x1d90('0x32')]+_0x1d90('0x37')+_0x85f82b[_0x1d90('0x33')],'method':'GET'};rp(_0x1839a6)['then'](function(_0x309c20){var _0x4a0e87=_0x309c20[_0x1d90('0x38')](';');var _0x436d64={'user_key':_0x4a0e87[0x0],'session_key':_0x4a0e87[0x1]};_0x1839a6={'url':_0x1108ea+'sms','method':_0x1d90('0x39'),'headers':{'user_key':_0x436d64[_0x1d90('0x3a')],'Session_key':_0x436d64[_0x1d90('0x3b')]},'json':!![],'body':_0x108105};return rp(_0x1839a6);})[_0x1d90('0x1b')](function(_0x5ef4a8){if(_0x5ef4a8[_0x1d90('0x3c')]>=0x1){var _0x159579={'messageId':_0x5ef4a8[_0x1d90('0x3d')]};if(_0x85f82b['smsMethod']!=='GP'||!_0x85f82b[_0x1d90('0x3e')]){_0x159579['read']=!![];}return _0x42d6d4['update'](_0x159579);}else{return logger['error'](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x31'),util[_0x1d90('0x2e')](_0x5ef4a8,{'showHidden':![],'depth':null}));}})[_0x1d90('0x1d')](function(_0x440054){return logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x31'),util[_0x1d90('0x2e')](_0x440054,{'showHidden':![],'depth':null}));});}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x31'),_0x1d90('0x3f'));}break;case _0x1d90('0x40'):if(_0x85f82b[_0x1d90('0x25')]){var _0x4aac79={'recipient':_0x27d7ad[_0x1d90('0x26')],'message':_0x27d7ad[_0x1d90('0x41')],'sender':_0x85f82b[_0x1d90('0x42')]||_0x85f82b[_0x1d90('0x26')],'authorization':_0x85f82b[_0x1d90('0x25')]};var _0x468821={'method':_0x1d90('0x39'),'uri':_0x1d90('0x43'),'body':_0x4aac79,'json':!![]};rp(_0x468821)[_0x1d90('0x1b')](function(_0x5867e6){var _0x5afe7c={'messageId':_0x5867e6['requestid']};if(!_0x85f82b['deliveryReport']){_0x5afe7c[_0x1d90('0x44')]=!![];}return _0x42d6d4[_0x1d90('0x2c')](_0x5afe7c);})['catch'](function(_0x40df91){logger['error'](_0x1d90('0x2d'),'afterCreate','connectel',util[_0x1d90('0x2e')](_0x40df91,{'showHidden':![],'depth':null}));});}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x40'),_0x1d90('0x45'));}break;case _0x1d90('0x46'):if(_0x85f82b[_0x1d90('0x32')]&&_0x85f82b['password']){var _0x4aac79={'messages':[{'source':_0x1d90('0x47'),'to':_0x27d7ad[_0x1d90('0x26')],'body':_0x27d7ad[_0x1d90('0x41')],'from':_0x85f82b['senderString']||_0x85f82b['phone']}]};var _0x13f033=util[_0x1d90('0x48')]('%s:%s',_0x85f82b[_0x1d90('0x32')],_0x85f82b[_0x1d90('0x33')]);var _0x468821={'method':_0x1d90('0x39'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x4aac79,'headers':{'Authorization':util['format'](_0x1d90('0x49'),new Buffer(_0x13f033)[_0x1d90('0x4a')]('base64'))},'json':!![]};rp(_0x468821)['then'](function(_0x3a5dca){if(_0x3a5dca[_0x1d90('0x4b')]>=0xc8&&_0x3a5dca[_0x1d90('0x4b')]<=0xce){if(_0x3a5dca[_0x1d90('0x4c')]&&_0x3a5dca[_0x1d90('0x4c')]['queued_count']>0x0){var _0x234a87=_[_0x1d90('0x4d')](_0x3a5dca[_0x1d90('0x4c')][_0x1d90('0x4e')]);var _0x2b1c94={'messageId':_0x234a87[_0x1d90('0x4f')]};if(!_0x85f82b[_0x1d90('0x3e')]){_0x2b1c94[_0x1d90('0x44')]=!![];}return _0x42d6d4[_0x1d90('0x2c')](_0x2b1c94);}else{logger['error'](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x50'),util['inspect'](_0x3a5dca,{'showHidden':![],'depth':null}));}}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x50'),util[_0x1d90('0x2e')](_0x3a5dca,{'showHidden':![],'depth':null}));}})['catch'](function(_0x441286){logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x50'),util[_0x1d90('0x2e')](_0x441286,{'showHidden':![],'depth':null}));});}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x50'),_0x1d90('0x3f'));}break;case _0x1d90('0x51'):if(_0x85f82b[_0x1d90('0x52')]&&_0x85f82b[_0x1d90('0x25')]){var _0x4aac79={'dst':_0x27d7ad[_0x1d90('0x26')],'text':_0x27d7ad[_0x1d90('0x41')],'src':_0x85f82b[_0x1d90('0x42')]||_0x85f82b[_0x1d90('0x26')],'url':_0x85f82b[_0x1d90('0x53')]+_0x1d90('0x28')+_0x27d7ad['id']+_0x1d90('0x29')+_0x85f82b['token']};var _0x13f033=util[_0x1d90('0x48')](_0x1d90('0x54'),_0x85f82b['authId'],_0x85f82b[_0x1d90('0x25')]);var _0x468821={'method':_0x1d90('0x39'),'uri':util[_0x1d90('0x48')](_0x1d90('0x55'),_0x85f82b[_0x1d90('0x52')]),'body':_0x4aac79,'headers':{'Authorization':util[_0x1d90('0x48')]('Basic\x20%s',new Buffer(_0x13f033)[_0x1d90('0x4a')](_0x1d90('0x56')))},'json':!![]};rp(_0x468821)[_0x1d90('0x1b')](function(_0x4ae504){var _0x1157db={'messageId':_0x4ae504[_0x1d90('0x57')][0x0]};return _0x42d6d4[_0x1d90('0x2c')](_0x1157db);})[_0x1d90('0x1d')](function(_0x3a9d17){logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x51'),util['inspect'](_0x3a9d17,{'showHidden':![],'depth':null}));});}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x51'),_0x1d90('0x58'));}break;case'infobip':if(_0x85f82b['username']&&_0x85f82b[_0x1d90('0x33')]){if(_0x85f82b[_0x1d90('0x59')]){var _0x440a23={'method':_0x1d90('0x39'),'uri':_0x85f82b['baseUrl']+_0x1d90('0x5a'),'body':{'username':_0x85f82b[_0x1d90('0x32')],'password':_0x85f82b[_0x1d90('0x33')]},'json':!![]};return rp(_0x440a23)[_0x1d90('0x1b')](function(_0x35593b){var _0x31d563={'method':_0x1d90('0x39'),'uri':_0x85f82b[_0x1d90('0x59')]+_0x1d90('0x5b'),'body':{'messages':[{'from':_0x85f82b[_0x1d90('0x26')],'destinations':[{'to':_0x27d7ad[_0x1d90('0x26')]}],'text':_0x27d7ad[_0x1d90('0x41')],'notifyUrl':_0x85f82b[_0x1d90('0x53')]+_0x1d90('0x28')+_0x27d7ad['id']+_0x1d90('0x29')+_0x85f82b[_0x1d90('0x2a')],'notifyContentType':_0x1d90('0x5c'),'callbackData':_0x85f82b[_0x1d90('0x26')]+';'+_0x27d7ad[_0x1d90('0x41')]}]},'headers':{'Authorization':_0x1d90('0x5d')+_0x35593b[_0x1d90('0x2a')]},'json':!![]};return rp(_0x31d563)[_0x1d90('0x1b')](function(_0x3dfc34){if(_0x3dfc34['messages']){var _0x5dc843={'messageId':_0x3dfc34[_0x1d90('0x4e')][0x0][_0x1d90('0xe')]};if(!_0x85f82b[_0x1d90('0x3e')]){_0x5dc843[_0x1d90('0x44')]=!![];}return _0x42d6d4[_0x1d90('0x2c')](_0x5dc843);}else{return logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x5e'),util[_0x1d90('0x2e')](_0x3dfc34,{'showHidden':![],'depth':null}));}});})[_0x1d90('0x1d')](function(_0x26d024){return logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x5e'),util[_0x1d90('0x2e')](_0x26d024,{'showHidden':![],'depth':null}));});}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x5e'),_0x1d90('0x5f'));}}else{logger[_0x1d90('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1d90('0x2f'),'infobip','Missing\x20parameters:\x20username,\x20password');}break;case _0x1d90('0x60'):var _0x1fa213=require(_0x1d90('0x61'));if(_0x85f82b[_0x1d90('0x62')]){var _0x4a647f={};_0x4a647f[_0x1d90('0x63')]=_0x85f82b[_0x1d90('0x32')];_0x4a647f[_0x1d90('0x26')]=_0x27d7ad[_0x1d90('0x26')];_0x4a647f[_0x1d90('0x35')]=_0x85f82b['phone'];_0x4a647f[_0x1d90('0x64')]=_0x27d7ad[_0x1d90('0x41')];_0x4a647f['timestamp']=+new Date();var _0x520848='';var _0x3980b9='';var _0x379b66=Object['keys'](_0x4a647f);_0x379b66[_0x1d90('0x65')]();for(var _0x36128d=0x0;_0x36128d<_0x379b66[_0x1d90('0x66')];_0x36128d++){if(_0x520848!=''){_0x520848+='&';}_0x520848+=_0x379b66[_0x36128d]+'='+encodeURIComponent(_0x4a647f[_0x379b66[_0x36128d]]);_0x3980b9+=_0x4a647f[_0x379b66[_0x36128d]];}_0x3980b9+=_0x85f82b[_0x1d90('0x62')];_0x3980b9=_0x1fa213[_0x1d90('0x67')](_0x1d90('0x68'))[_0x1d90('0x2c')](_0x3980b9)[_0x1d90('0x69')](_0x1d90('0x6a'));if(_0x520848!==''){_0x520848+='&';}_0x520848+=_0x1d90('0x6b')+_0x3980b9;var _0x1839a6={'method':'GET','uri':_0x85f82b[_0x1d90('0x59')]+_0x1d90('0x6c')+_0x520848,'json':!![]};return rp(_0x1839a6)['then'](function(_0x539c93){var _0x4db45e=Object[_0x1d90('0x6d')](_0x539c93);if(_0x539c93[_0x4db45e[0x0]][_0x1d90('0x1e')]&&parseInt(_0x539c93[_0x4db45e[0x0]][_0x1d90('0x1e')])===0x0){var _0x2dd467={'messageId':_0x539c93[_0x4db45e[0x0]][_0x1d90('0x6e')]};if(!_0x85f82b[_0x1d90('0x3e')]){_0x2dd467['read']=!![];}return _0x42d6d4['update'](_0x2dd467);}else{return logger[_0x1d90('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x1d90('0x2f'),_0x1d90('0x60'),util[_0x1d90('0x2e')](_0x539c93['error'],{'showHidden':![],'depth':null}));}})[_0x1d90('0x1d')](function(_0x40d12b){return logger[_0x1d90('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x1d90('0x60'),util['inspect'](_0x40d12b,{'showHidden':![],'depth':null}));});}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x1d90('0x6f'):if(_0x85f82b['apiKey']){var _0x1c0ff2={'method':_0x1d90('0x39'),'uri':_0x1d90('0x70'),'headers':{'Authorization':_0x85f82b[_0x1d90('0x62')]},'body':{'content':_0x27d7ad[_0x1d90('0x41')],'to':[_0x27d7ad[_0x1d90('0x26')]],'from':_0x85f82b[_0x1d90('0x26')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x1c0ff2)[_0x1d90('0x1b')](function(_0x2d2cd1){if(!_0x2d2cd1[_0x1d90('0x1e')]){var _0x1bb010={'messageId':_0x2d2cd1[_0x1d90('0x4e')][0x0][_0x1d90('0x71')]};if(!_0x85f82b[_0x1d90('0x3e')]){_0x1bb010[_0x1d90('0x44')]=!![];}return _0x42d6d4['update'](_0x1bb010);}else{return logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x6f'),util[_0x1d90('0x2e')](_0x2d2cd1[_0x1d90('0x1e')],{'showHidden':![],'depth':null}));}})[_0x1d90('0x1d')](function(_0x27921a){return logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x6f'),util[_0x1d90('0x2e')](_0x27921a,{'showHidden':![],'depth':null}));});}else{logger[_0x1d90('0x1e')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','clickatell','Missing\x20parameters:\x20apiKey');}break;case'bandwidth':if(_0x85f82b['username']&&_0x85f82b[_0x1d90('0x33')]){var _0x13f033=util['format'](_0x1d90('0x54'),_0x85f82b[_0x1d90('0x32')],_0x85f82b[_0x1d90('0x33')]);var _0x468821={'method':_0x1d90('0x39'),'uri':_0x1d90('0x72')+_0x85f82b[_0x1d90('0x73')]+_0x1d90('0x74'),'body':{'to':[_0x27d7ad['phone']],'text':_0x27d7ad[_0x1d90('0x41')],'from':_0x85f82b[_0x1d90('0x26')],'applicationId':_0x85f82b[_0x1d90('0x75')]},'headers':{'Authorization':util[_0x1d90('0x48')]('Basic\x20%s',new Buffer(_0x13f033)[_0x1d90('0x4a')](_0x1d90('0x56')))},'json':!![]};rp(_0x468821)[_0x1d90('0x1b')](function(_0x146dcd){if(_0x146dcd['id']){var _0x4e4ba6={'messageId':_0x146dcd['id']};return _0x42d6d4[_0x1d90('0x2c')](_0x4e4ba6);}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x76'),util[_0x1d90('0x2e')](_0x146dcd,{'showHidden':![],'depth':null}));}})[_0x1d90('0x1d')](function(_0x2ec7d8){logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x76'),util[_0x1d90('0x2e')](_0x2ec7d8,{'showHidden':![],'depth':null}));});}else{logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate',_0x1d90('0x76'),_0x1d90('0x3f'));}break;case _0x1d90('0x77'):if(_0x85f82b[_0x1d90('0x62')]){var _0x1b87c1={};var _0x1839a6={'method':_0x1d90('0x39'),'uri':_0x1d90('0x78'),'headers':{'Authorization':'Bearer\x20'+_0x85f82b['apiKey'],'Content-Type':_0x1d90('0x5c')},'body':{'from':_0x85f82b[_0x1d90('0x26')],'to':_0x27d7ad['phone'],'text':_0x27d7ad[_0x1d90('0x41')]},'json':!![]};return rp(_0x1839a6)[_0x1d90('0x1b')](function(_0x5d1e1f){if(_0x5d1e1f[_0x1d90('0x79')]==0xca){_0x1b87c1[_0x1d90('0x7a')]=_0x5d1e1f;var _0x31b5e9={'method':_0x1d90('0x39'),'uri':_0x1d90('0x7b'),'headers':{'Authorization':_0x1d90('0x7c')+_0x85f82b[_0x1d90('0x62')],'Content-Type':'application/json'},'body':{'refid':_0x1b87c1[_0x1d90('0x7a')][_0x1d90('0x7d')]},'json':!![]};return rp(_0x31b5e9)[_0x1d90('0x1b')](function(_0x515883){_0x1b87c1[_0x1d90('0x7e')]=_0x515883;var _0x5644d7={'messageId':_0x1b87c1[_0x1d90('0x7a')]['refid'],'read':!![]};return _0x42d6d4[_0x1d90('0x2c')](_0x5644d7);});}else{return logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x77'),util[_0x1d90('0x2e')](_0x5d1e1f,{'showHidden':![],'depth':null}));}})[_0x1d90('0x1d')](function(_0x13c0ed){return logger[_0x1d90('0x1e')](_0x1d90('0x2d'),'afterCreate','intelepeer',util[_0x1d90('0x2e')](_0x13c0ed,{'showHidden':![],'depth':null}));});}else{return logger[_0x1d90('0x1e')](_0x1d90('0x2d'),_0x1d90('0x2f'),_0x1d90('0x77'),_0x1d90('0x7f'));}break;}}})[_0x1d90('0x80')](function(){_0x308451();});}else{_0x308451();}}},'charset':_0x1d90('0x81'),'collate':_0x1d90('0x82')});};
\ No newline at end of file
+var _0xb97f=['rimraf','./smsMessage.attributes','exports','define','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','secret','SmsInteractionId','findOne','then','update','createdAt','catch','error','SmsAccount','find','type','twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','smsMethod','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','Missing\x20parameters:\x20authToken','clicksend','format','%s:%s','https://rest.clicksend.com/v3/sms/send','base64','http_code','data','queued_count','head','clickSend','plivo','authId','Basic\x20%s','toString','message_uuid','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','csc','crypto','apiKey','text','timestamp','keys','sort','length','createHash','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','UTF-8','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x2f7a78,_0x37febb){var _0x12d6c2=function(_0x45db81){while(--_0x45db81){_0x2f7a78['push'](_0x2f7a78['shift']());}};_0x12d6c2(++_0x37febb);}(_0xb97f,0x71));var _0xfb97=function(_0x5ccfe0,_0x4b3a33){_0x5ccfe0=_0x5ccfe0-0x0;var _0x346997=_0xb97f[_0x5ccfe0];return _0x346997;};'use strict';var _=require(_0xfb97('0x0'));var util=require(_0xfb97('0x1'));var logger=require(_0xfb97('0x2'))('api');var moment=require(_0xfb97('0x3'));var BPromise=require(_0xfb97('0x4'));var rp=require(_0xfb97('0x5'));var fs=require('fs');var path=require(_0xfb97('0x6'));var rimraf=require(_0xfb97('0x7'));var config=require('../../config/environment');var attributes=require(_0xfb97('0x8'));module[_0xfb97('0x9')]=function(_0x22d6c6,_0x3af81b){return _0x22d6c6[_0xfb97('0xa')]('SmsMessage',attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0xfb97('0xb')]},{'name':_0xfb97('0xc'),'fields':[_0xfb97('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x38242b,_0x3aa141,_0x2f6210){var _0x25ce56=_0x22d6c6[_0xfb97('0xe')];var _0x2f0df5=_0x38242b[_0xfb97('0xf')]({'plain':!![]});if(_0x2f0df5[_0xfb97('0x10')][_0xfb97('0x11')]()==='in'||_0x2f0df5['direction'][_0xfb97('0x11')]()===_0xfb97('0x12')&&!_0x2f0df5[_0xfb97('0x13')]&&!_['isNil'](_0x2f0df5['UserId'])&&!_['isNil'](_0x2f0df5[_0xfb97('0x14')])){_0x25ce56['SmsInteraction'][_0xfb97('0x15')]({'where':{'id':_0x2f0df5[_0xfb97('0x14')]}})[_0xfb97('0x16')](function(_0x1d8317){if(_0x1d8317){_0x1d8317[_0xfb97('0x17')]({'lastMsgAt':_0x2f0df5[_0xfb97('0x18')],'lastMsgDirection':_0x2f0df5[_0xfb97('0x10')]['toLowerCase']()});}})[_0xfb97('0x19')](function(_0x1f89ac){console[_0xfb97('0x1a')](_0x1f89ac);});}if(_0x2f0df5[_0xfb97('0x10')]===_0xfb97('0x12')&&!_0x2f0df5[_0xfb97('0x13')]){var _0x130267;_0x25ce56[_0xfb97('0x1b')][_0xfb97('0x1c')]({'where':{'id':_0x2f0df5['SmsAccountId']},'raw':!![]})[_0xfb97('0x16')](function(_0xd9e9a7){_0x130267=_0xd9e9a7;if(_0x130267&&_0x130267['type']){switch(_0x130267[_0xfb97('0x1d')]){case _0xfb97('0x1e'):var _0x308375=require(_0xfb97('0x1e'));if(_0x130267[_0xfb97('0x1f')]&&_0x130267[_0xfb97('0x20')]&&_0x130267[_0xfb97('0x21')]){var _0x4f5ae7=new _0x308375(_0x130267[_0xfb97('0x1f')],_0x130267[_0xfb97('0x20')]);_0x4f5ae7[_0xfb97('0x22')][_0xfb97('0x23')]({'body':_0x2f0df5['body'],'to':_0x2f0df5[_0xfb97('0x21')],'from':_0x130267['phone'],'statusCallback':_0x130267[_0xfb97('0x24')]+_0xfb97('0x25')+_0x2f0df5['id']+_0xfb97('0x26')+_0x130267[_0xfb97('0x27')]})[_0xfb97('0x16')](function(_0x168984){if(_0x168984[_0xfb97('0x28')]){return _0x38242b['update']({'messageId':_0x168984[_0xfb97('0x28')]});}})[_0xfb97('0x19')](function(_0x48a55a){logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x1e'),util['inspect'](_0x48a55a,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x1e'),_0xfb97('0x2b'));}break;case _0xfb97('0x2c'):var _0x5008e4=_0xfb97('0x2d');if(_0x130267[_0xfb97('0x2e')]&&_0x130267[_0xfb97('0x2f')]){var _0x319316={'recipient':[_0x2f0df5[_0xfb97('0x21')]],'message':_0x2f0df5[_0xfb97('0xd')],'message_type':_0x130267['smsMethod']};if(_0x130267['smsMethod']&&_0x130267['smsMethod']!=='SI'){_0x319316[_0xfb97('0x30')]=_0x130267[_0xfb97('0x21')];}var _0x3e200b={'url':_0x5008e4+_0xfb97('0x31')+_0x130267['username']+_0xfb97('0x32')+_0x130267[_0xfb97('0x2f')],'method':_0xfb97('0x33')};rp(_0x3e200b)[_0xfb97('0x16')](function(_0x3806cc){var _0x60b7d6=_0x3806cc[_0xfb97('0x34')](';');var _0x956a3={'user_key':_0x60b7d6[0x0],'session_key':_0x60b7d6[0x1]};_0x3e200b={'url':_0x5008e4+_0xfb97('0x35'),'method':_0xfb97('0x36'),'headers':{'user_key':_0x956a3[_0xfb97('0x37')],'Session_key':_0x956a3[_0xfb97('0x38')]},'json':!![],'body':_0x319316};return rp(_0x3e200b);})[_0xfb97('0x16')](function(_0x224be8){if(_0x224be8[_0xfb97('0x39')]>=0x1){var _0x3a649c={'messageId':_0x224be8[_0xfb97('0x3a')]};if(_0x130267[_0xfb97('0x3b')]!=='GP'||!_0x130267[_0xfb97('0x3c')]){_0x3a649c[_0xfb97('0x3d')]=!![];}return _0x38242b['update'](_0x3a649c);}else{return logger[_0xfb97('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb97('0x2a'),'skebby',util[_0xfb97('0x3e')](_0x224be8,{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x181147){return logger['error'](_0xfb97('0x29'),'afterCreate',_0xfb97('0x2c'),util[_0xfb97('0x3e')](_0x181147,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfb97('0x2c'),_0xfb97('0x3f'));}break;case _0xfb97('0x40'):if(_0x130267[_0xfb97('0x20')]){var _0x5602ec={'recipient':_0x2f0df5[_0xfb97('0x21')],'message':_0x2f0df5[_0xfb97('0xd')],'sender':_0x130267[_0xfb97('0x41')]||_0x130267[_0xfb97('0x21')],'authorization':_0x130267['authToken']};var _0x3aa141={'method':_0xfb97('0x36'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x5602ec,'json':!![]};rp(_0x3aa141)[_0xfb97('0x16')](function(_0x7b06fe){var _0x492f67={'messageId':_0x7b06fe['requestid']};if(!_0x130267[_0xfb97('0x3c')]){_0x492f67[_0xfb97('0x3d')]=!![];}return _0x38242b[_0xfb97('0x17')](_0x492f67);})[_0xfb97('0x19')](function(_0x4011e0){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb97('0x2a'),'connectel',util[_0xfb97('0x3e')](_0x4011e0,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb97('0x2a'),'connectel',_0xfb97('0x42'));}break;case _0xfb97('0x43'):if(_0x130267[_0xfb97('0x2e')]&&_0x130267[_0xfb97('0x2f')]){var _0x5602ec={'messages':[{'source':'xCALLY\x20Motion','to':_0x2f0df5[_0xfb97('0x21')],'body':_0x2f0df5[_0xfb97('0xd')],'from':_0x130267[_0xfb97('0x41')]||_0x130267[_0xfb97('0x21')]}]};var _0x1c4ca0=util[_0xfb97('0x44')](_0xfb97('0x45'),_0x130267['username'],_0x130267[_0xfb97('0x2f')]);var _0x3aa141={'method':_0xfb97('0x36'),'uri':_0xfb97('0x46'),'body':_0x5602ec,'headers':{'Authorization':util[_0xfb97('0x44')]('Basic\x20%s',new Buffer(_0x1c4ca0)['toString'](_0xfb97('0x47')))},'json':!![]};rp(_0x3aa141)['then'](function(_0xad4f75){if(_0xad4f75[_0xfb97('0x48')]>=0xc8&&_0xad4f75['http_code']<=0xce){if(_0xad4f75['data']&&_0xad4f75[_0xfb97('0x49')][_0xfb97('0x4a')]>0x0){var _0x145152=_[_0xfb97('0x4b')](_0xad4f75[_0xfb97('0x49')][_0xfb97('0x22')]);var _0xa2df17={'messageId':_0x145152['message_id']};if(!_0x130267[_0xfb97('0x3c')]){_0xa2df17['read']=!![];}return _0x38242b[_0xfb97('0x17')](_0xa2df17);}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x4c'),util[_0xfb97('0x3e')](_0xad4f75,{'showHidden':![],'depth':null}));}}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x4c'),util['inspect'](_0xad4f75,{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x466e91){logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x4c'),util[_0xfb97('0x3e')](_0x466e91,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),'afterCreate',_0xfb97('0x4c'),_0xfb97('0x3f'));}break;case _0xfb97('0x4d'):if(_0x130267['authId']&&_0x130267[_0xfb97('0x20')]){var _0x5602ec={'dst':_0x2f0df5[_0xfb97('0x21')],'text':_0x2f0df5[_0xfb97('0xd')],'src':_0x130267[_0xfb97('0x41')]||_0x130267[_0xfb97('0x21')],'url':_0x130267[_0xfb97('0x24')]+_0xfb97('0x25')+_0x2f0df5['id']+'/status?token='+_0x130267[_0xfb97('0x27')]};var _0x1c4ca0=util[_0xfb97('0x44')](_0xfb97('0x45'),_0x130267[_0xfb97('0x4e')],_0x130267[_0xfb97('0x20')]);var _0x3aa141={'method':'POST','uri':util[_0xfb97('0x44')]('https://api.plivo.com/v1/Account/%s/Message/',_0x130267['authId']),'body':_0x5602ec,'headers':{'Authorization':util[_0xfb97('0x44')](_0xfb97('0x4f'),new Buffer(_0x1c4ca0)[_0xfb97('0x50')](_0xfb97('0x47')))},'json':!![]};rp(_0x3aa141)[_0xfb97('0x16')](function(_0x34591e){var _0x2896ea={'messageId':_0x34591e[_0xfb97('0x51')][0x0]};return _0x38242b['update'](_0x2896ea);})[_0xfb97('0x19')](function(_0x20d1fb){logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x4d'),util['inspect'](_0x20d1fb,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xfb97('0x52'):if(_0x130267[_0xfb97('0x2e')]&&_0x130267[_0xfb97('0x2f')]){if(_0x130267[_0xfb97('0x53')]){var _0x35ac0a={'method':_0xfb97('0x36'),'uri':_0x130267['baseUrl']+_0xfb97('0x54'),'body':{'username':_0x130267[_0xfb97('0x2e')],'password':_0x130267[_0xfb97('0x2f')]},'json':!![]};return rp(_0x35ac0a)[_0xfb97('0x16')](function(_0x47e535){var _0x585612={'method':_0xfb97('0x36'),'uri':_0x130267[_0xfb97('0x53')]+_0xfb97('0x55'),'body':{'messages':[{'from':_0x130267[_0xfb97('0x21')],'destinations':[{'to':_0x2f0df5[_0xfb97('0x21')]}],'text':_0x2f0df5[_0xfb97('0xd')],'notifyUrl':_0x130267['remote']+_0xfb97('0x25')+_0x2f0df5['id']+'/status?token='+_0x130267[_0xfb97('0x27')],'notifyContentType':'application/json','callbackData':_0x130267['phone']+';'+_0x2f0df5[_0xfb97('0xd')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x47e535[_0xfb97('0x27')]},'json':!![]};return rp(_0x585612)['then'](function(_0x15580e){if(_0x15580e[_0xfb97('0x22')]){var _0x4889f6={'messageId':_0x15580e[_0xfb97('0x22')][0x0][_0xfb97('0xb')]};if(!_0x130267['deliveryReport']){_0x4889f6[_0xfb97('0x3d')]=!![];}return _0x38242b[_0xfb97('0x17')](_0x4889f6);}else{return logger['error'](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x52'),util[_0xfb97('0x3e')](_0x15580e,{'showHidden':![],'depth':null}));}});})[_0xfb97('0x19')](function(_0x4be959){return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x52'),util[_0xfb97('0x3e')](_0x4be959,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x52'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xfb97('0x56'):var _0x56c201=require(_0xfb97('0x57'));if(_0x130267[_0xfb97('0x58')]){var _0x2eb37b={};_0x2eb37b['login']=_0x130267[_0xfb97('0x2e')];_0x2eb37b[_0xfb97('0x21')]=_0x2f0df5[_0xfb97('0x21')];_0x2eb37b['sender']=_0x130267[_0xfb97('0x21')];_0x2eb37b[_0xfb97('0x59')]=_0x2f0df5[_0xfb97('0xd')];_0x2eb37b[_0xfb97('0x5a')]=+new Date();var _0x122416='';var _0x48525e='';var _0x4ca550=Object[_0xfb97('0x5b')](_0x2eb37b);_0x4ca550[_0xfb97('0x5c')]();for(var _0xd7f1f8=0x0;_0xd7f1f8<_0x4ca550[_0xfb97('0x5d')];_0xd7f1f8++){if(_0x122416!=''){_0x122416+='&';}_0x122416+=_0x4ca550[_0xd7f1f8]+'='+encodeURIComponent(_0x2eb37b[_0x4ca550[_0xd7f1f8]]);_0x48525e+=_0x2eb37b[_0x4ca550[_0xd7f1f8]];}_0x48525e+=_0x130267[_0xfb97('0x58')];_0x48525e=_0x56c201[_0xfb97('0x5e')]('md5')[_0xfb97('0x17')](_0x48525e)[_0xfb97('0x5f')](_0xfb97('0x60'));if(_0x122416!==''){_0x122416+='&';}_0x122416+=_0xfb97('0x61')+_0x48525e;var _0x3e200b={'method':_0xfb97('0x33'),'uri':_0x130267[_0xfb97('0x53')]+_0xfb97('0x62')+_0x122416,'json':!![]};return rp(_0x3e200b)[_0xfb97('0x16')](function(_0x5d493c){var _0x93e259=Object[_0xfb97('0x5b')](_0x5d493c);if(_0x5d493c[_0x93e259[0x0]][_0xfb97('0x1a')]&&parseInt(_0x5d493c[_0x93e259[0x0]][_0xfb97('0x1a')])===0x0){var _0x5f3681={'messageId':_0x5d493c[_0x93e259[0x0]]['id_sms']};if(!_0x130267[_0xfb97('0x3c')]){_0x5f3681[_0xfb97('0x3d')]=!![];}return _0x38242b[_0xfb97('0x17')](_0x5f3681);}else{return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x56'),util[_0xfb97('0x3e')](_0x5d493c[_0xfb97('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x554ac0){return logger[_0xfb97('0x1a')](_0xfb97('0x29'),'afterCreate',_0xfb97('0x56'),util[_0xfb97('0x3e')](_0x554ac0,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xfb97('0x56'),_0xfb97('0x63'));}break;case _0xfb97('0x64'):if(_0x130267['apiKey']){var _0x246d1b={'method':'POST','uri':_0xfb97('0x65'),'headers':{'Authorization':_0x130267['apiKey']},'body':{'content':_0x2f0df5[_0xfb97('0xd')],'to':[_0x2f0df5['phone']],'from':_0x130267[_0xfb97('0x21')],'binary':![],'clientMessageId':'uuid','charset':_0xfb97('0x66')},'json':!![]};rp(_0x246d1b)[_0xfb97('0x16')](function(_0x57bf86){if(!_0x57bf86['error']){var _0x566a99={'messageId':_0x57bf86[_0xfb97('0x22')][0x0][_0xfb97('0x67')]};if(!_0x130267[_0xfb97('0x3c')]){_0x566a99[_0xfb97('0x3d')]=!![];}return _0x38242b[_0xfb97('0x17')](_0x566a99);}else{return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),'clickatell',util['inspect'](_0x57bf86[_0xfb97('0x1a')],{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x83f1d5){return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x64'),util['inspect'](_0x83f1d5,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x64'),'Missing\x20parameters:\x20apiKey');}break;case _0xfb97('0x68'):if(_0x130267[_0xfb97('0x2e')]&&_0x130267[_0xfb97('0x2f')]){var _0x1c4ca0=util[_0xfb97('0x44')]('%s:%s',_0x130267[_0xfb97('0x2e')],_0x130267[_0xfb97('0x2f')]);var _0x3aa141={'method':_0xfb97('0x36'),'uri':_0xfb97('0x69')+_0x130267[_0xfb97('0x6a')]+'/messages','body':{'to':[_0x2f0df5[_0xfb97('0x21')]],'text':_0x2f0df5[_0xfb97('0xd')],'from':_0x130267[_0xfb97('0x21')],'applicationId':_0x130267[_0xfb97('0x6b')]},'headers':{'Authorization':util['format'](_0xfb97('0x4f'),new Buffer(_0x1c4ca0)['toString']('base64'))},'json':!![]};rp(_0x3aa141)['then'](function(_0x49b051){if(_0x49b051['id']){var _0xb6ec5b={'messageId':_0x49b051['id']};return _0x38242b['update'](_0xb6ec5b);}else{logger[_0xfb97('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xfb97('0x2a'),_0xfb97('0x68'),util['inspect'](_0x49b051,{'showHidden':![],'depth':null}));}})[_0xfb97('0x19')](function(_0x5e4ede){logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x68'),util[_0xfb97('0x3e')](_0x5e4ede,{'showHidden':![],'depth':null}));});}else{logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),'bandwidth',_0xfb97('0x3f'));}break;case'intelepeer':if(_0x130267[_0xfb97('0x58')]){var _0x52355d={};var _0x3e200b={'method':_0xfb97('0x36'),'uri':_0xfb97('0x6c'),'headers':{'Authorization':_0xfb97('0x6d')+_0x130267[_0xfb97('0x58')],'Content-Type':_0xfb97('0x6e')},'body':{'from':_0x130267['phone'],'to':_0x2f0df5[_0xfb97('0x21')],'text':_0x2f0df5[_0xfb97('0xd')]},'json':!![]};return rp(_0x3e200b)[_0xfb97('0x16')](function(_0x2db4f7){if(_0x2db4f7[_0xfb97('0x6f')]==0xca){_0x52355d[_0xfb97('0x70')]=_0x2db4f7;var _0x29b0db={'method':_0xfb97('0x36'),'uri':_0xfb97('0x71'),'headers':{'Authorization':_0xfb97('0x6d')+_0x130267[_0xfb97('0x58')],'Content-Type':_0xfb97('0x6e')},'body':{'refid':_0x52355d['message'][_0xfb97('0x72')]},'json':!![]};return rp(_0x29b0db)[_0xfb97('0x16')](function(_0x248d85){_0x52355d[_0xfb97('0x73')]=_0x248d85;var _0x5b2a5e={'messageId':_0x52355d[_0xfb97('0x70')]['refid'],'read':!![]};return _0x38242b[_0xfb97('0x17')](_0x5b2a5e);});}else{return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),'intelepeer',util[_0xfb97('0x3e')](_0x2db4f7,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4c4940){return logger[_0xfb97('0x1a')](_0xfb97('0x29'),_0xfb97('0x2a'),_0xfb97('0x74'),util[_0xfb97('0x3e')](_0x4c4940,{'showHidden':![],'depth':null}));});}else{return logger[_0xfb97('0x1a')](_0xfb97('0x29'),'afterCreate',_0xfb97('0x74'),_0xfb97('0x75'));}break;}}})[_0xfb97('0x76')](function(){_0x2f6210();});}else{_0x2f6210();}}},'charset':_0xfb97('0x77'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index 98e0a8f..b495ed8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e6e=['options','raw','CreateSmsMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','info','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','request\x20sent','catch','SmsMessage','create','body'];(function(_0x3d991f,_0x4f24c4){var _0x4b9b00=function(_0x5ce313){while(--_0x5ce313){_0x3d991f['push'](_0x3d991f['shift']());}};_0x4b9b00(++_0x4f24c4);}(_0x4e6e,0x1f3));var _0xe4e6=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0x4e6e[_0x710815];return _0x5b3b89;};'use strict';var _=require('lodash');var util=require(_0xe4e6('0x0'));var moment=require(_0xe4e6('0x1'));var BPromise=require(_0xe4e6('0x2'));var rs=require(_0xe4e6('0x3'));var fs=require('fs');var Redis=require(_0xe4e6('0x4'));var db=require(_0xe4e6('0x5'))['db'];var utils=require(_0xe4e6('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe4e6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4e6('0x8')][_0xe4e6('0x9')]({'port':0x232a});config[_0xe4e6('0xa')]=_['defaults'](config[_0xe4e6('0xa')],{'host':_0xe4e6('0xb'),'port':0x18eb});var socket=require(_0xe4e6('0xc'))(new Redis(config[_0xe4e6('0xa')]));require(_0xe4e6('0xd'))['register'](socket);function respondWithRpcPromise(_0x3c3799,_0x58c127,_0x541fd7){return new BPromise(function(_0xc9f02d,_0x2d2955){return client[_0xe4e6('0xe')](_0x3c3799,_0x541fd7)[_0xe4e6('0xf')](function(_0x3e39b3){logger[_0xe4e6('0x10')]('SmsMessage,\x20%s,\x20%s',_0x58c127,'request\x20sent');logger[_0xe4e6('0x11')](_0xe4e6('0x12'),_0x58c127,'request\x20sent',JSON['stringify'](_0x3e39b3));if(_0x3e39b3[_0xe4e6('0x13')]){if(_0x3e39b3[_0xe4e6('0x13')][_0xe4e6('0x14')]===0x1f4){logger['error'](_0xe4e6('0x15'),_0x58c127,_0x3e39b3[_0xe4e6('0x13')]['message']);return _0x2d2955(_0x3e39b3[_0xe4e6('0x13')][_0xe4e6('0x16')]);}logger[_0xe4e6('0x13')](_0xe4e6('0x15'),_0x58c127,_0x3e39b3[_0xe4e6('0x13')][_0xe4e6('0x16')]);return _0xc9f02d(_0x3e39b3[_0xe4e6('0x13')][_0xe4e6('0x16')]);}else{logger['info'](_0xe4e6('0x15'),_0x58c127,_0xe4e6('0x17'));_0xc9f02d(_0x3e39b3['result'][_0xe4e6('0x16')]);}})[_0xe4e6('0x18')](function(_0x5aa290){logger[_0xe4e6('0x13')](_0xe4e6('0x15'),_0x58c127,_0x5aa290);_0x2d2955(_0x5aa290);});});}exports['CreateSmsMessage']=function(_0x2cd1a0){var _0x51a471=this;return new Promise(function(_0x1637d5,_0x5cc62d){return db[_0xe4e6('0x19')][_0xe4e6('0x1a')](_0x2cd1a0[_0xe4e6('0x1b')],{'raw':_0x2cd1a0[_0xe4e6('0x1c')]?_0x2cd1a0[_0xe4e6('0x1c')][_0xe4e6('0x1d')]===undefined?!![]:![]:!![]})[_0xe4e6('0xf')](function(_0x2a31bf){logger[_0xe4e6('0x10')](_0xe4e6('0x1e'),_0x2cd1a0);logger[_0xe4e6('0x11')](_0xe4e6('0x1e'),_0x2cd1a0,JSON['stringify'](_0x2a31bf));_0x1637d5(_0x2a31bf);})['catch'](function(_0x442832){logger['error'](_0xe4e6('0x1e'),_0x442832[_0xe4e6('0x16')],_0x2cd1a0);_0x5cc62d(_0x51a471[_0xe4e6('0x13')](0x1f4,_0x442832[_0xe4e6('0x16')]));});});};
\ No newline at end of file
+var _0xb050=['options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','code','error','message','result','catch','CreateSmsMessage','SmsMessage','create'];(function(_0x215393,_0x4c406d){var _0x595198=function(_0x5d641f){while(--_0x5d641f){_0x215393['push'](_0x215393['shift']());}};_0x595198(++_0x4c406d);}(_0xb050,0x195));var _0x0b05=function(_0x36596f,_0x460a0a){_0x36596f=_0x36596f-0x0;var _0x3d2be8=_0xb050[_0x36596f];return _0x3d2be8;};'use strict';var _=require(_0x0b05('0x0'));var util=require(_0x0b05('0x1'));var moment=require(_0x0b05('0x2'));var BPromise=require(_0x0b05('0x3'));var rs=require(_0x0b05('0x4'));var fs=require('fs');var Redis=require(_0x0b05('0x5'));var db=require(_0x0b05('0x6'))['db'];var utils=require(_0x0b05('0x7'));var logger=require(_0x0b05('0x8'))('rpc');var config=require(_0x0b05('0x9'));var jayson=require(_0x0b05('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x0b05('0xb')](config[_0x0b05('0xc')],{'host':_0x0b05('0xd'),'port':0x18eb});var socket=require(_0x0b05('0xe'))(new Redis(config['redis']));require(_0x0b05('0xf'))['register'](socket);function respondWithRpcPromise(_0x2740a8,_0x5e643f,_0x2ee45c){return new BPromise(function(_0x51ac02,_0x362c2c){return client[_0x0b05('0x10')](_0x2740a8,_0x2ee45c)[_0x0b05('0x11')](function(_0x22eb03){logger['info'](_0x0b05('0x12'),_0x5e643f,_0x0b05('0x13'));logger[_0x0b05('0x14')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5e643f,'request\x20sent',JSON['stringify'](_0x22eb03));if(_0x22eb03['error']){if(_0x22eb03['error'][_0x0b05('0x15')]===0x1f4){logger[_0x0b05('0x16')](_0x0b05('0x12'),_0x5e643f,_0x22eb03['error']['message']);return _0x362c2c(_0x22eb03['error'][_0x0b05('0x17')]);}logger[_0x0b05('0x16')](_0x0b05('0x12'),_0x5e643f,_0x22eb03['error'][_0x0b05('0x17')]);return _0x51ac02(_0x22eb03[_0x0b05('0x16')][_0x0b05('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x5e643f,'request\x20sent');_0x51ac02(_0x22eb03[_0x0b05('0x18')][_0x0b05('0x17')]);}})[_0x0b05('0x19')](function(_0x371e60){logger['error'](_0x0b05('0x12'),_0x5e643f,_0x371e60);_0x362c2c(_0x371e60);});});}exports[_0x0b05('0x1a')]=function(_0x3cb597){var _0x50caca=this;return new Promise(function(_0x135848,_0x4e7866){return db[_0x0b05('0x1b')][_0x0b05('0x1c')](_0x3cb597['body'],{'raw':_0x3cb597[_0x0b05('0x1d')]?_0x3cb597[_0x0b05('0x1d')][_0x0b05('0x1e')]===undefined?!![]:![]:!![]})[_0x0b05('0x11')](function(_0x4ae22b){logger['info'](_0x0b05('0x1a'),_0x3cb597);logger[_0x0b05('0x14')]('CreateSmsMessage',_0x3cb597,JSON['stringify'](_0x4ae22b));_0x135848(_0x4ae22b);})['catch'](function(_0x594afc){logger['error'](_0x0b05('0x1a'),_0x594afc['message'],_0x3cb597);_0x4e7866(_0x50caca['error'](0x1f4,_0x594afc[_0x0b05('0x17')]));});});};
\ No newline at end of file
index b096612..6c25d43 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x97f0=['save','remove','update','emit','length','smsMessage:','./smsMessage.events'];(function(_0x11352d,_0x568d0e){var _0x4f03fb=function(_0x2957c6){while(--_0x2957c6){_0x11352d['push'](_0x11352d['shift']());}};_0x4f03fb(++_0x568d0e);}(_0x97f0,0xb5));var _0x097f=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x97f0[_0x1969a7];return _0x3d665f;};'use strict';var SmsMessageEvents=require(_0x097f('0x0'));var events=[_0x097f('0x1'),_0x097f('0x2'),_0x097f('0x3')];function createListener(_0x1c65ee,_0x392aa0){return function(_0x1d5dac){_0x392aa0[_0x097f('0x4')](_0x1c65ee,_0x1d5dac);};}function removeListener(_0x179bc4,_0x8ce71){return function(){SmsMessageEvents['removeListener'](_0x179bc4,_0x8ce71);};}exports['register']=function(_0x112301){for(var _0x3d7a9c=0x0,_0x1ab6bb=events[_0x097f('0x5')];_0x3d7a9c<_0x1ab6bb;_0x3d7a9c++){var _0x32af6f=events[_0x3d7a9c];var _0x3e6d0b=createListener(_0x097f('0x6')+_0x32af6f,_0x112301);SmsMessageEvents['on'](_0x32af6f,_0x3e6d0b);}};
\ No newline at end of file
+var _0x26b2=['removeListener','length','smsMessage:','./smsMessage.events','save','remove','emit'];(function(_0x4d8764,_0xd13d7b){var _0x4e0b49=function(_0x56126a){while(--_0x56126a){_0x4d8764['push'](_0x4d8764['shift']());}};_0x4e0b49(++_0xd13d7b);}(_0x26b2,0xe3));var _0x226b=function(_0x29cedf,_0x1d0dc1){_0x29cedf=_0x29cedf-0x0;var _0x235826=_0x26b2[_0x29cedf];return _0x235826;};'use strict';var SmsMessageEvents=require(_0x226b('0x0'));var events=[_0x226b('0x1'),_0x226b('0x2'),'update'];function createListener(_0x59b890,_0x572fb4){return function(_0x4a1ae4){_0x572fb4[_0x226b('0x3')](_0x59b890,_0x4a1ae4);};}function removeListener(_0x41dac8,_0x39ee32){return function(){SmsMessageEvents[_0x226b('0x4')](_0x41dac8,_0x39ee32);};}exports['register']=function(_0x1590cc){for(var _0x468114=0x0,_0x180733=events[_0x226b('0x5')];_0x468114<_0x180733;_0x468114++){var _0x3c8a5b=events[_0x468114];var _0x1a56aa=createListener(_0x226b('0x6')+_0x3c8a5b,_0x1590cc);SmsMessageEvents['on'](_0x3c8a5b,_0x1a56aa);}};
\ No newline at end of file
index 096fafa..4fe0396 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x187c=['fs-extra','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','/:id','delete','removeTeams','exports','connect-timeout','express','Router'];(function(_0x1acefc,_0x5da0bf){var _0x543527=function(_0x27040d){while(--_0x27040d){_0x1acefc['push'](_0x1acefc['shift']());}};_0x543527(++_0x5da0bf);}(_0x187c,0x174));var _0xc187=function(_0x2ece76,_0x3249ac){_0x2ece76=_0x2ece76-0x0;var _0x43c243=_0x187c[_0x2ece76];return _0x43c243;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc187('0x0'));var express=require(_0xc187('0x1'));var router=express[_0xc187('0x2')]();var fs_extra=require(_0xc187('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc187('0x4'));var config=require(_0xc187('0x5'));var controller=require(_0xc187('0x6'));router[_0xc187('0x7')]('/',auth[_0xc187('0x8')](),controller[_0xc187('0x9')]);router[_0xc187('0x7')](_0xc187('0xa'),auth[_0xc187('0x8')](),controller[_0xc187('0xb')]);router['get']('/:id',auth[_0xc187('0x8')](),controller['show']);router['get'](_0xc187('0xc'),auth[_0xc187('0x8')](),controller['getMembers']);router[_0xc187('0x7')](_0xc187('0xd'),auth[_0xc187('0x8')](),controller[_0xc187('0xe')]);router['get'](_0xc187('0xf'),auth[_0xc187('0x8')](),controller['getAgents']);router[_0xc187('0x10')]('/',auth['isAuthenticated'](),controller[_0xc187('0x11')]);router['post'](_0xc187('0xd'),auth[_0xc187('0x8')](),controller[_0xc187('0x12')]);router['post']('/:id/users',auth[_0xc187('0x8')](),controller[_0xc187('0x13')]);router[_0xc187('0x14')](_0xc187('0x15'),auth[_0xc187('0x8')](),controller['update']);router['delete'](_0xc187('0x15'),auth[_0xc187('0x8')](),controller['destroy']);router[_0xc187('0x16')](_0xc187('0xd'),auth[_0xc187('0x8')](),controller[_0xc187('0x17')]);router[_0xc187('0x16')](_0xc187('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xc187('0x18')]=router;
\ No newline at end of file
+var _0x4231=['fs-extra','../../components/auth/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','/:id','get','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','delete','destroy','removeAgents','exports','multer','util','path','express'];(function(_0x556b2c,_0x579e4b){var _0x32da88=function(_0x3b1413){while(--_0x3b1413){_0x556b2c['push'](_0x556b2c['shift']());}};_0x32da88(++_0x579e4b);}(_0x4231,0x79));var _0x1423=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x4231[_0x284bc3];return _0x41ac81;};'use strict';var multer=require(_0x1423('0x0'));var util=require(_0x1423('0x1'));var path=require(_0x1423('0x2'));var timeout=require('connect-timeout');var express=require(_0x1423('0x3'));var router=express['Router']();var fs_extra=require(_0x1423('0x4'));var auth=require(_0x1423('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1423('0x6'));var controller=require(_0x1423('0x7'));router['get']('/',auth[_0x1423('0x8')](),controller[_0x1423('0x9')]);router['get']('/describe',auth[_0x1423('0x8')](),controller['describe']);router['get'](_0x1423('0xa'),auth[_0x1423('0x8')](),controller['show']);router[_0x1423('0xb')](_0x1423('0xc'),auth[_0x1423('0x8')](),controller[_0x1423('0xd')]);router['get'](_0x1423('0xe'),auth[_0x1423('0x8')](),controller[_0x1423('0xf')]);router['get'](_0x1423('0x10'),auth[_0x1423('0x8')](),controller['getAgents']);router[_0x1423('0x11')]('/',auth['isAuthenticated'](),controller[_0x1423('0x12')]);router[_0x1423('0x11')]('/:id/teams',auth[_0x1423('0x8')](),controller['addTeams']);router['post'](_0x1423('0x10'),auth[_0x1423('0x8')](),controller[_0x1423('0x13')]);router[_0x1423('0x14')](_0x1423('0xa'),auth[_0x1423('0x8')](),controller['update']);router[_0x1423('0x15')](_0x1423('0xa'),auth[_0x1423('0x8')](),controller[_0x1423('0x16')]);router[_0x1423('0x15')](_0x1423('0xe'),auth[_0x1423('0x8')](),controller['removeTeams']);router[_0x1423('0x15')](_0x1423('0x10'),auth[_0x1423('0x8')](),controller[_0x1423('0x17')]);module[_0x1423('0x18')]=router;
\ No newline at end of file
index adc7839..6c4805f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1652=['STRING','ENUM','beepall','roundrobin','sequelize','exports','name'];(function(_0x6e1214,_0x123a25){var _0x7a3ce9=function(_0x10ad07){while(--_0x10ad07){_0x6e1214['push'](_0x6e1214['shift']());}};_0x7a3ce9(++_0x123a25);}(_0x1652,0x10e));var _0x2165=function(_0x237c45,_0x55cf99){_0x237c45=_0x237c45-0x0;var _0x2942f6=_0x1652[_0x237c45];return _0x2942f6;};'use strict';var Sequelize=require(_0x2165('0x0'));module[_0x2165('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2165('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2165('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2165('0x4')]('rrmemory',_0x2165('0x5'),_0x2165('0x6'))}};
\ No newline at end of file
+var _0x89e5=['sequelize','exports','name','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x43d79c,_0x531a55){var _0x4866b0=function(_0x847a){while(--_0x847a){_0x43d79c['push'](_0x43d79c['shift']());}};_0x4866b0(++_0x531a55);}(_0x89e5,0x1d0));var _0x589e=function(_0x3c05a8,_0x17c094){_0x3c05a8=_0x3c05a8-0x0;var _0x1fffc1=_0x89e5[_0x3c05a8];return _0x1fffc1;};'use strict';var Sequelize=require(_0x589e('0x0'));module[_0x589e('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x589e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x589e('0x3')]},'timeout':{'type':Sequelize[_0x589e('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x589e('0x5'),_0x589e('0x6'),_0x589e('0x7'))}};
\ No newline at end of file
index dcd1c3c..244ba0d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x5ab713,_0x4832a8){var _0x17ba14=function(_0x12c199){while(--_0x12c199){_0x5ab713['push'](_0x5ab713['shift']());}};_0x17ba14(++_0x4832a8);}(_0x7a54,0x106));var _0x47a5=function(_0x501b55,_0x2b8537){_0x501b55=_0x501b55-0x0;var _0x566349=_0x7a54[_0x501b55];return _0x566349;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));};
\ No newline at end of file
+var _0x0b0e=['userSmsQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_sms_queues','join','clone','ut.UserId\x20=\x20?','push','QueryTypes','every','TeamId','union','value','removeAgents','forEach','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','hasOwnProperty','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','update','SmsQueues','destroy','then','error','stack','name','send','SmsQueue','fieldName','type','key','getOptions','include','query','findAll','rows','show','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','params','nolimit','order','sort','where','SmsQueueId','filter','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','findOne','Team','pick','getTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3db122,_0x5e6bee){_0x3db122=_0x3db122-0x0;var _0x325b67=_0x0b0e[_0x3db122];return _0x325b67;};'use strict';var BPromise=require(_0xe0b0('0x0'));var util=require('util');var _=require(_0xe0b0('0x1'));var squel=require('squel');var Redis=require(_0xe0b0('0x2'));var qs=require(_0xe0b0('0x3'));var logger=require(_0xe0b0('0x4'))(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var db=require(_0xe0b0('0x7'))['db'];config[_0xe0b0('0x8')]=_[_0xe0b0('0x9')](config[_0xe0b0('0x8')],{'host':_0xe0b0('0xa'),'port':0x18eb});var socket=require(_0xe0b0('0xb'))(new Redis(config['redis']));require('./smsQueue.socket')[_0xe0b0('0xc')](socket);function respondWithStatusCode(_0x435060,_0xc4a085){_0xc4a085=_0xc4a085||0xcc;return function(_0x2ac27e){if(_0x2ac27e){return _0x435060['sendStatus'](_0xc4a085);}return _0x435060[_0xe0b0('0xd')](_0xc4a085)[_0xe0b0('0xe')]();};}function respondWithResult(_0x553d4f,_0x1fef28){_0x1fef28=_0x1fef28||0xc8;return function(_0x2f32b6){if(_0x2f32b6){return _0x553d4f['status'](_0x1fef28)[_0xe0b0('0xf')](_0x2f32b6);}};}function respondWithFilteredResult(_0x2cdad2,_0x39b1c2){return function(_0x585615){if(_0x585615){var _0x3068c0=typeof _0x39b1c2[_0xe0b0('0x10')]===_0xe0b0('0x11')&&typeof _0x39b1c2[_0xe0b0('0x12')]===_0xe0b0('0x11');var _0x4d2bf7=_0x585615[_0xe0b0('0x13')];var _0x154de6=_0x3068c0?0x0:_0x39b1c2[_0xe0b0('0x10')];var _0x24babd=_0x3068c0?_0x585615[_0xe0b0('0x13')]:_0x39b1c2['offset']+_0x39b1c2[_0xe0b0('0x12')];var _0x5adb01;if(_0x24babd>=_0x4d2bf7){_0x24babd=_0x4d2bf7;_0x5adb01=0xc8;}else{_0x5adb01=0xce;}_0x2cdad2[_0xe0b0('0xd')](_0x5adb01);return _0x2cdad2[_0xe0b0('0x14')]('Content-Range',_0x154de6+'-'+_0x24babd+'/'+_0x4d2bf7)[_0xe0b0('0xf')](_0x585615);}return null;};}function saveUpdates(_0x4a4cc0){return function(_0x2d6fb6){if(_0x2d6fb6){return _0x2d6fb6[_0xe0b0('0x15')](_0x4a4cc0)['then'](function(_0x54a3eb){return _0x54a3eb;});}return null;};}function removeEntity(_0x46bb44){return function(_0x50a441){if(_0x50a441){return _0x50a441['destroy']()['then'](function(){var _0x1920ee=_0x50a441['get']({'plain':!![]});var _0x52598b=_0xe0b0('0x16');return db['UserProfileResource'][_0xe0b0('0x17')]({'where':{'type':_0x52598b,'resourceId':_0x1920ee['id']}})['then'](function(){return _0x50a441;});})[_0xe0b0('0x18')](function(){_0x46bb44[_0xe0b0('0xd')](0xcc)[_0xe0b0('0xe')]();});}};}function handleEntityNotFound(_0x310a6d){return function(_0x2cf6a1){if(!_0x2cf6a1){_0x310a6d['sendStatus'](0x194);}return _0x2cf6a1;};}function handleError(_0x4cae54,_0x2fa820){_0x2fa820=_0x2fa820||0x1f4;return function(_0x5512bb){logger[_0xe0b0('0x19')](_0x5512bb[_0xe0b0('0x1a')]);if(_0x5512bb['name']){delete _0x5512bb[_0xe0b0('0x1b')];}_0x4cae54['status'](_0x2fa820)[_0xe0b0('0x1c')](_0x5512bb);};}exports['index']=function(_0x28586d,_0x576352){var _0x3e5c88={};var _0x4de537={'count':0x0,'rows':[]};var _0x4700cc=_['map'](db[_0xe0b0('0x1d')]['rawAttributes'],function(_0x362aba){return{'name':_0x362aba[_0xe0b0('0x1e')],'type':_0x362aba[_0xe0b0('0x1f')][_0xe0b0('0x20')]};});_0x3e5c88=qs[_0xe0b0('0x21')](_0x4700cc,_0x28586d);var _0x10745d={'where':_0x3e5c88['where']};return db[_0xe0b0('0x1d')][_0xe0b0('0x13')](_0x10745d)['then'](function(_0x15e13b){_0x4de537[_0xe0b0('0x13')]=_0x15e13b;_0x3e5c88[_0xe0b0('0x22')]=qs[_0xe0b0('0x22')](_0x28586d[_0xe0b0('0x23')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x24')](_0x3e5c88);})['then'](function(_0x1854b8){_0x4de537[_0xe0b0('0x25')]=_0x1854b8;return _0x4de537;})['then'](respondWithFilteredResult(_0x576352,_0x3e5c88))['catch'](handleError(_0x576352,null));};exports[_0xe0b0('0x26')]=function(_0x33e672,_0x422575){var _0x3f81d5={'raw':!![],'where':{'id':_0x33e672['params']['id']}},_0x2ab1b1={};_0x2ab1b1[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db[_0xe0b0('0x1d')][_0xe0b0('0x29')]);_0x2ab1b1[_0xe0b0('0x23')]=_['keys'](_0x33e672[_0xe0b0('0x23')]);_0x2ab1b1[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],_0x2ab1b1[_0xe0b0('0x23')]);_0x3f81d5[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x2ab1b1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3f81d5[_0xe0b0('0x2c')]=_0x3f81d5[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x3f81d5[_0xe0b0('0x2c')]:_0x2ab1b1['model'];if(_0x33e672[_0xe0b0('0x23')][_0xe0b0('0x2f')]){_0x3f81d5[_0xe0b0('0x22')]=[{'all':!![]}];}_0x3f81d5=_[_0xe0b0('0x30')]({},_0x3f81d5,_0x33e672[_0xe0b0('0x31')]);return db[_0xe0b0('0x1d')][_0xe0b0('0x32')](_0x3f81d5)['then'](handleEntityNotFound(_0x422575,null))['then'](respondWithResult(_0x422575,null))['catch'](handleError(_0x422575,null));};exports['create']=function(_0x26137c,_0xc3d967){return db[_0xe0b0('0x1d')]['create'](_0x26137c[_0xe0b0('0x33')],{})[_0xe0b0('0x18')](function(_0x1cd705){var _0x297c64=_0x26137c['user'][_0xe0b0('0x34')]({'plain':!![]});if(!_0x297c64)throw new Error(_0xe0b0('0x35'));if(_0x297c64[_0xe0b0('0x36')]===_0xe0b0('0x37')){var _0x4265e3=_0x1cd705[_0xe0b0('0x34')]({'plain':!![]});var _0x8b745=_0xe0b0('0x16');return db[_0xe0b0('0x38')]['find']({'where':{'name':_0x8b745,'userProfileId':_0x297c64[_0xe0b0('0x39')]},'raw':!![]})['then'](function(_0x34178d){if(_0x34178d&&_0x34178d[_0xe0b0('0x3a')]===0x0){return db[_0xe0b0('0x3b')][_0xe0b0('0x3c')]({'name':_0x4265e3['name'],'resourceId':_0x4265e3['id'],'type':_0x34178d[_0xe0b0('0x1b')],'sectionId':_0x34178d['id']},{})[_0xe0b0('0x18')](function(){return _0x1cd705;});}else{return _0x1cd705;}})[_0xe0b0('0x3d')](function(_0x402a0e){logger[_0xe0b0('0x19')](_0xe0b0('0x3e'),_0x402a0e);throw _0x402a0e;});}return _0x1cd705;})[_0xe0b0('0x18')](respondWithResult(_0xc3d967,0xc9))[_0xe0b0('0x3d')](handleError(_0xc3d967,null));};exports['update']=function(_0x2aad80,_0x309bbf){if(_0x2aad80['body']['id']){delete _0x2aad80['body']['id'];}return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x2aad80['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x309bbf,null))[_0xe0b0('0x18')](saveUpdates(_0x2aad80[_0xe0b0('0x33')],null))[_0xe0b0('0x18')](respondWithResult(_0x309bbf,null))[_0xe0b0('0x3d')](handleError(_0x309bbf,null));};exports['destroy']=function(_0x5d2fa2,_0x51c580){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x5d2fa2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x51c580,null))[_0xe0b0('0x18')](removeEntity(_0x51c580,null))[_0xe0b0('0x3d')](handleError(_0x51c580,null));};exports[_0xe0b0('0x3f')]=function(_0x16ccca,_0x5c6f94){return db['SmsQueue'][_0xe0b0('0x3f')]()[_0xe0b0('0x18')](respondWithResult(_0x5c6f94,null))[_0xe0b0('0x3d')](handleError(_0x5c6f94,null));};exports[_0xe0b0('0x40')]=function(_0x1bf77d,_0x575c7d){var _0x3b1474={'raw':!![],'where':{}},_0x11d4fd={},_0x534340;return db['SmsQueue']['findOne']({'where':{'id':_0x1bf77d[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x575c7d,null))[_0xe0b0('0x18')](function(_0x364877){if(_0x364877){_0x534340=_0x364877['get']({'plain':!![]});_0x11d4fd[_0xe0b0('0x27')]=_[_0xe0b0('0x28')](db['UserSmsQueue']['rawAttributes']);_0x11d4fd[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x1bf77d['query']);_0x11d4fd[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0x11d4fd['model'],_0x11d4fd['query']);_0x3b1474[_0xe0b0('0x2c')]=_['intersection'](_0x11d4fd[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x3b1474[_0xe0b0('0x2c')]=_0x3b1474[_0xe0b0('0x2c')]['length']?_0x3b1474['attributes']:_0x11d4fd[_0xe0b0('0x27')];if(!_0x1bf77d['query']['hasOwnProperty'](_0xe0b0('0x42'))){_0x3b1474[_0xe0b0('0x12')]=qs['limit'](_0x1bf77d['query'][_0xe0b0('0x12')]);_0x3b1474[_0xe0b0('0x10')]=qs[_0xe0b0('0x10')](_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x10')]);}_0x3b1474[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x1bf77d['query'][_0xe0b0('0x44')]);_0x3b1474['where']=qs[_0xe0b0('0x2a')](_['pick'](_0x1bf77d['query'],_0x11d4fd[_0xe0b0('0x2a')]));_0x3b1474[_0xe0b0('0x45')][_0xe0b0('0x46')]=_0x364877['id'];if(_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x3b1474[_0xe0b0('0x45')]=_[_0xe0b0('0x30')](_0x3b1474[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x3b1474['attributes'],function(_0x253ab0){var _0x57ccc9={};_0x57ccc9[_0x253ab0]={'$like':'%'+_0x1bf77d[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x57ccc9;})});}_0x3b1474=_[_0xe0b0('0x30')]({},_0x3b1474,_0x1bf77d[_0xe0b0('0x31')]);return db[_0xe0b0('0x49')][_0xe0b0('0x24')](_0x3b1474);}})['then'](function(_0x1a057c){if(_0x1a057c){return db[_0xe0b0('0x4a')][_0xe0b0('0x4b')]({'where':{'id':_[_0xe0b0('0x48')](_0x1a057c,_0xe0b0('0x4c')),'role':_0xe0b0('0x4d')},'attributes':['id',_0xe0b0('0x1b'),_0xe0b0('0x4e'),_0xe0b0('0x4f'),_0xe0b0('0x50')]});}})[_0xe0b0('0x18')](function(_0x18ab99){if(_0x18ab99){return{'count':_0x18ab99[_0xe0b0('0x13')],'rows':_[_0xe0b0('0x48')](_0x18ab99[_0xe0b0('0x25')],function(_0x34c642){return{'membername':_0x34c642[_0xe0b0('0x1b')],'UserId':_0x34c642['id'],'queue_name':_0x534340[_0xe0b0('0x1b')],'SmsQueueId':_0x534340['id'],'interface':util['format'](_0xe0b0('0x51'),_0xe0b0('0x52'),_0x34c642[_0xe0b0('0x1b')]),'penalty':0x0,'paused':_0x34c642[_0xe0b0('0x4e')],'createdAt':_0x34c642[_0xe0b0('0x50')],'updatedAt':_0x34c642[_0xe0b0('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0b0('0x18')](respondWithFilteredResult(_0x575c7d,_0x3b1474))['catch'](handleError(_0x575c7d,null));};exports['getTeams']=function(_0x139014,_0x2a0415){var _0x157556={};var _0x47ecc1={};var _0x117d20;var _0x13fb4b;return db[_0xe0b0('0x1d')][_0xe0b0('0x53')]({'where':{'id':_0x139014[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x2a0415,null))[_0xe0b0('0x18')](function(_0x242120){if(_0x242120){_0x117d20=_0x242120;_0x47ecc1[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x54')][_0xe0b0('0x29')]);_0x47ecc1['query']=_[_0xe0b0('0x28')](_0x139014['query']);_0x47ecc1['filters']=_[_0xe0b0('0x2b')](_0x47ecc1['model'],_0x47ecc1['query']);_0x157556[_0xe0b0('0x2c')]=_[_0xe0b0('0x2b')](_0x47ecc1[_0xe0b0('0x27')],qs[_0xe0b0('0x2d')](_0x139014['query'][_0xe0b0('0x2d')]));_0x157556[_0xe0b0('0x2c')]=_0x157556[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x157556[_0xe0b0('0x2c')]:_0x47ecc1[_0xe0b0('0x27')];_0x157556[_0xe0b0('0x43')]=qs[_0xe0b0('0x44')](_0x139014['query']['sort']);_0x157556[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x139014['query'],_0x47ecc1['filters']));if(_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x157556['where']=_['merge'](_0x157556[_0xe0b0('0x45')],{'$or':_[_0xe0b0('0x48')](_0x157556[_0xe0b0('0x2c')],function(_0x29175a){var _0x3b263f={};_0x3b263f[_0x29175a]={'$like':'%'+_0x139014[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3b263f;})});}_0x157556=_[_0xe0b0('0x30')]({},_0x157556,_0x139014['options']);return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0x1673bc){if(_0x1673bc){_0x13fb4b=_0x1673bc['length'];if(!_0x139014['query']['hasOwnProperty']('nolimit')){_0x157556['limit']=qs['limit'](_0x139014[_0xe0b0('0x23')]['limit']);_0x157556['offset']=qs[_0xe0b0('0x10')](_0x139014[_0xe0b0('0x23')][_0xe0b0('0x10')]);}return _0x117d20[_0xe0b0('0x56')](_0x157556);}})[_0xe0b0('0x18')](function(_0xd0629e){if(_0xd0629e){return _0xd0629e?{'count':_0x13fb4b,'rows':_0xd0629e}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x2a0415,null))[_0xe0b0('0x3d')](handleError(_0x2a0415,null));};exports['addTeams']=function(_0x3097fb,_0x5da8fd){var _0x86e90=_0x3097fb[_0xe0b0('0x33')][_0xe0b0('0x57')];return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x86e90},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0b0('0x58'),'attributes':['id','name',_0xe0b0('0x59'),_0xe0b0('0x5a'),_0xe0b0('0x5b')],'raw':!![]}]})[_0xe0b0('0x18')](function(_0x4a78f8){if(_0x4a78f8){var _0x311f79=_[_0xe0b0('0x5c')](_0x4a78f8,function(_0x49deef){var _0x4cf60a=_0x49deef[_0xe0b0('0x34')]({'plain':!![]});return _0x4cf60a[_0xe0b0('0x58')];});return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x3097fb[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](function(_0x34f4ff){return db[_0xe0b0('0x5d')][_0xe0b0('0x5e')](function(_0x24571b){return _0x34f4ff['addTeams'](_0x86e90,{'transaction':_0x24571b})['then'](function(){return BPromise[_0xe0b0('0x5f')](_0x311f79,function(_0x4880d5){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0x4880d5['id'],'SmsQueueId':_0x3097fb['params']['id']},'transaction':_0x24571b});});})[_0xe0b0('0x18')](function(){_0x311f79['forEach'](function(_0x654d2b){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':_0x654d2b['id'],'SmsQueueId':_0x34f4ff['id']});});});});});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x5da8fd,null))['catch'](handleError(_0x5da8fd,null));};exports[_0xe0b0('0x62')]=function(_0x948708,_0x5a0817){return db[_0xe0b0('0x54')][_0xe0b0('0x24')]({'where':{'id':_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')]},'attributes':['id'],'include':[{'model':db[_0xe0b0('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5a0817,null))['then'](function(_0x545694){var _0x5c258b=_[_0xe0b0('0x48')](_0x545694,'id');var _0x567e1a=[];var _0x3c09af=[];var _0x5f4aaf=squel[_0xe0b0('0x63')]();_0x5f4aaf[_0xe0b0('0x64')](_0xe0b0('0x65'))[_0xe0b0('0x66')](_0xe0b0('0x67'),'tq')[_0xe0b0('0x68')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where']('SmsQueueId\x20=\x20?',_0x948708[_0xe0b0('0x41')]['id']);for(var _0x261381=0x0;_0x261381<_0x545694[_0xe0b0('0x2e')];_0x261381+=0x1){let _0x4377f7=_0x545694[_0x261381];for(var _0x2c1149=0x0;_0x2c1149<_0x4377f7['Agents'][_0xe0b0('0x2e')];_0x2c1149+=0x1){let _0x39a07b=_0x4377f7[_0xe0b0('0x58')][_0x2c1149];var _0xc6090e=_0x5f4aaf[_0xe0b0('0x69')]();_0xc6090e[_0xe0b0('0x45')](_0xe0b0('0x6a'),_0x39a07b['id']);_0x3c09af[_0xe0b0('0x6b')](db[_0xe0b0('0x5d')]['query'](_0xc6090e['toString'](),{'type':db[_0xe0b0('0x5d')][_0xe0b0('0x6c')]['SELECT']})[_0xe0b0('0x18')](function(_0x4593f1){if(_0x4593f1[_0xe0b0('0x2e')]===0x1){return _0x39a07b['id'];}else{var _0x3fcffd=_[_0xe0b0('0x6d')](_[_0xe0b0('0x48')](_0x4593f1,_0xe0b0('0x6e')),function(_0xc8eba3){return _['includes'](_0x5c258b,_0xc8eba3);});if(_0x3fcffd){return _0x39a07b['id'];}}}));}}return BPromise['all'](_0x3c09af)['then'](function(_0xc19743){_0x567e1a=_(_0x567e1a)[_0xe0b0('0x6f')](_0xc19743)['compact']()[_0xe0b0('0x70')]();return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x948708[_0xe0b0('0x41')]['id']}})['then'](function(_0x56c4b9){return db['sequelize'][_0xe0b0('0x5e')](function(_0x266835){return _0x56c4b9['removeTeams'](_0x948708[_0xe0b0('0x23')][_0xe0b0('0x57')],{'transaction':_0x266835})['then'](function(){if(!_['isEmpty'](_0x567e1a)){return _0x56c4b9[_0xe0b0('0x71')](_0x567e1a,{'transaction':_0x266835});}})['then'](function(){_0x567e1a[_0xe0b0('0x72')](function(_0x5f06c0){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':_0x5f06c0,'SmsQueueId':_0x56c4b9['id']});});});});});});})[_0xe0b0('0x18')](respondWithStatusCode(_0x5a0817,null))[_0xe0b0('0x3d')](handleError(_0x5a0817,null));};exports[_0xe0b0('0x74')]=function(_0x1ec7c2,_0x434dfa){return db[_0xe0b0('0x1d')][_0xe0b0('0x32')]({'where':{'id':_0x1ec7c2['params']['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x434dfa,null))[_0xe0b0('0x18')](function(_0x2b40eb){if(_0x2b40eb){return _0x2b40eb['addAgents'](_0x1ec7c2[_0xe0b0('0x33')]['ids'],_[_0xe0b0('0x75')](_0x1ec7c2[_0xe0b0('0x33')],['ids','id'])||{})[_0xe0b0('0x76')](function(_0x4e4b45){for(var _0x528932=0x0;_0x528932<_0x1ec7c2[_0xe0b0('0x33')]['ids']['length'];_0x528932+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x61'),{'UserId':Number(_0x1ec7c2[_0xe0b0('0x33')][_0xe0b0('0x57')][_0x528932]),'SmsQueueId':Number(_0x1ec7c2[_0xe0b0('0x41')]['id'])});}return _0x4e4b45;});}})[_0xe0b0('0x18')](respondWithResult(_0x434dfa,null))['catch'](handleError(_0x434dfa,null));};exports[_0xe0b0('0x71')]=function(_0x4609d5,_0x421b3b){return db['SmsQueue'][_0xe0b0('0x32')]({'where':{'id':_0x4609d5[_0xe0b0('0x41')]['id']}})['then'](handleEntityNotFound(_0x421b3b,null))['then'](function(_0x33f89a){if(_0x33f89a){return _0x33f89a['removeAgents'](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])[_0xe0b0('0x18')](function(){if(_[_0xe0b0('0x77')](_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')])){for(var _0x3d70d7=0x0;_0x3d70d7<_0x4609d5['query'][_0xe0b0('0x57')][_0xe0b0('0x2e')];_0x3d70d7+=0x1){socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')]['ids'][_0x3d70d7]),'SmsQueueId':Number(_0x4609d5['params']['id'])});}}else{socket[_0xe0b0('0x60')](_0xe0b0('0x73'),{'UserId':Number(_0x4609d5[_0xe0b0('0x23')][_0xe0b0('0x57')]),'SmsQueueId':Number(_0x4609d5[_0xe0b0('0x41')]['id'])});}});}})[_0xe0b0('0x18')](respondWithStatusCode(_0x421b3b,null))[_0xe0b0('0x3d')](handleError(_0x421b3b,null));};exports[_0xe0b0('0x78')]=function(_0x932e,_0x1b3f4d){var _0x4fe048={};var _0xac45e6={};var _0x401c4b;var _0x3e18a3;return db[_0xe0b0('0x1d')]['findOne']({'where':{'id':_0x932e[_0xe0b0('0x41')]['id']}})[_0xe0b0('0x18')](handleEntityNotFound(_0x1b3f4d,null))[_0xe0b0('0x18')](function(_0x116c16){if(_0x116c16){_0x401c4b=_0x116c16;_0xac45e6[_0xe0b0('0x27')]=_['keys'](db[_0xe0b0('0x4a')]['rawAttributes']);_0xac45e6[_0xe0b0('0x23')]=_[_0xe0b0('0x28')](_0x932e[_0xe0b0('0x23')]);_0xac45e6[_0xe0b0('0x2a')]=_[_0xe0b0('0x2b')](_0xac45e6['model'],_0xac45e6['query']);_0x4fe048[_0xe0b0('0x2c')]=_['intersection'](_0xac45e6[_0xe0b0('0x27')],qs['fields'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x2d')]));_0x4fe048[_0xe0b0('0x2c')]=_0x4fe048[_0xe0b0('0x2c')][_0xe0b0('0x2e')]?_0x4fe048[_0xe0b0('0x2c')]:_0xac45e6[_0xe0b0('0x27')];_0x4fe048['order']=qs['sort'](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x44')]);_0x4fe048[_0xe0b0('0x45')]=qs[_0xe0b0('0x2a')](_[_0xe0b0('0x55')](_0x932e[_0xe0b0('0x23')],_0xac45e6[_0xe0b0('0x2a')]));if(_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]){_0x4fe048[_0xe0b0('0x45')]=_['merge'](_0x4fe048['where'],{'$or':_[_0xe0b0('0x48')](_0x4fe048[_0xe0b0('0x2c')],function(_0x187465){var _0x3f9e6b={};_0x3f9e6b[_0x187465]={'$like':'%'+_0x932e[_0xe0b0('0x23')][_0xe0b0('0x47')]+'%'};return _0x3f9e6b;})});}_0x4fe048=_[_0xe0b0('0x30')]({},_0x4fe048,_0x932e['options']);return _0x401c4b['getAgents'](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x1ea4d5){if(_0x1ea4d5){_0x3e18a3=_0x1ea4d5[_0xe0b0('0x2e')];if(!_0x932e[_0xe0b0('0x23')][_0xe0b0('0x79')](_0xe0b0('0x42'))){_0x4fe048[_0xe0b0('0x12')]=qs[_0xe0b0('0x12')](_0x932e[_0xe0b0('0x23')][_0xe0b0('0x12')]);_0x4fe048['offset']=qs[_0xe0b0('0x10')](_0x932e[_0xe0b0('0x23')]['offset']);}return _0x401c4b[_0xe0b0('0x78')](_0x4fe048);}})[_0xe0b0('0x18')](function(_0x3615f9){if(_0x3615f9){return _0x3615f9?{'count':_0x3e18a3,'rows':_0x3615f9}:null;}})[_0xe0b0('0x18')](respondWithResult(_0x1b3f4d,null))[_0xe0b0('0x3d')](handleError(_0x1b3f4d,null));};
\ No newline at end of file
index 5b83053..51b0c77 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3092=['hook','exports','SmsQueue','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3092,0xc2));var _0x2309=function(_0x334fea,_0x1f1e18){_0x334fea=_0x334fea-0x0;var _0x3c5829=_0x3092[_0x334fea];return _0x3c5829;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x2309('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x2309('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2309('0x2'),'afterDestroy':_0x2309('0x3')};function emitEvent(_0x38b47b){return function(_0x20cf5c,_0x2d0b8d,_0xc15b64){SmsQueueEvents[_0x2309('0x4')](_0x38b47b+':'+_0x20cf5c['id'],_0x20cf5c);SmsQueueEvents[_0x2309('0x4')](_0x38b47b,_0x20cf5c);_0xc15b64(null);};}for(var e in events){if(events[_0x2309('0x5')](e)){var event=events[e];SmsQueue[_0x2309('0x6')](e,emitEvent(event));}}module[_0x2309('0x7')]=SmsQueueEvents;
\ No newline at end of file
+var _0x25e6=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x4a1862,_0x397ea1){var _0x4cbcc9=function(_0x11598f){while(--_0x11598f){_0x4a1862['push'](_0x4a1862['shift']());}};_0x4cbcc9(++_0x397ea1);}(_0x25e6,0x146));var _0x625e=function(_0x54b012,_0x4948f){_0x54b012=_0x54b012-0x0;var _0x31eea5=_0x25e6[_0x54b012];return _0x31eea5;};'use strict';var EventEmitter=require(_0x625e('0x0'));var SmsQueue=require(_0x625e('0x1'))['db'][_0x625e('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x625e('0x3')](0x0);var events={'afterCreate':_0x625e('0x4'),'afterUpdate':_0x625e('0x5'),'afterDestroy':_0x625e('0x6')};function emitEvent(_0x2a3bd8){return function(_0x37ee52,_0x3d889e,_0x327246){SmsQueueEvents[_0x625e('0x7')](_0x2a3bd8+':'+_0x37ee52['id'],_0x37ee52);SmsQueueEvents[_0x625e('0x7')](_0x2a3bd8,_0x37ee52);_0x327246(null);};}for(var e in events){if(events[_0x625e('0x8')](e)){var event=events[e];SmsQueue[_0x625e('0x9')](e,emitEvent(event));}}module[_0x625e('0xa')]=SmsQueueEvents;
\ No newline at end of file
index 581bcb5..590abb0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8800=['./smsQueue.attributes','exports','define','sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0x8800,0xd4));var _0x0880=function(_0x2514f4,_0x4d3b3a){_0x2514f4=_0x2514f4-0x0;var _0x3646a6=_0x8800[_0x2514f4];return _0x3646a6;};'use strict';var _=require(_0x0880('0x0'));var util=require(_0x0880('0x1'));var logger=require('../../config/logger')(_0x0880('0x2'));var moment=require(_0x0880('0x3'));var BPromise=require(_0x0880('0x4'));var rp=require(_0x0880('0x5'));var fs=require('fs');var path=require(_0x0880('0x6'));var rimraf=require(_0x0880('0x7'));var config=require(_0x0880('0x8'));var attributes=require(_0x0880('0x9'));module[_0x0880('0xa')]=function(_0x5b453d,_0x2511f9){return _0x5b453d[_0x0880('0xb')]('SmsQueue',attributes,{'tableName':_0x0880('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x75fd=['api','bluebird','request-promise','path','./smsQueue.attributes','SmsQueue','lodash','../../config/logger'];(function(_0x2aab2e,_0x5deafa){var _0x9391e4=function(_0x5eb6ce){while(--_0x5eb6ce){_0x2aab2e['push'](_0x2aab2e['shift']());}};_0x9391e4(++_0x5deafa);}(_0x75fd,0xee));var _0xd75f=function(_0x34607a,_0x1d0ae4){_0x34607a=_0x34607a-0x0;var _0x9d1926=_0x75fd[_0x34607a];return _0x9d1926;};'use strict';var _=require(_0xd75f('0x0'));var util=require('util');var logger=require(_0xd75f('0x1'))(_0xd75f('0x2'));var moment=require('moment');var BPromise=require(_0xd75f('0x3'));var rp=require(_0xd75f('0x4'));var fs=require('fs');var path=require(_0xd75f('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd75f('0x6'));module['exports']=function(_0x375e8d,_0x5d8196){return _0x375e8d['define'](_0xd75f('0x7'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 18ce21e..48ee8f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4468=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue'];(function(_0x48a91e,_0x4a6a8f){var _0x4288a4=function(_0x49d5cb){while(--_0x49d5cb){_0x48a91e['push'](_0x48a91e['shift']());}};_0x4288a4(++_0x4a6a8f);}(_0x4468,0x118));var _0x8446=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x4468[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x8446('0x0'));var util=require(_0x8446('0x1'));var moment=require(_0x8446('0x2'));var BPromise=require(_0x8446('0x3'));var rs=require(_0x8446('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8446('0x5'))['db'];var utils=require(_0x8446('0x6'));var logger=require(_0x8446('0x7'))(_0x8446('0x8'));var config=require(_0x8446('0x9'));var jayson=require(_0x8446('0xa'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0x8446('0xb')](config['redis'],{'host':_0x8446('0xc'),'port':0x18eb});var socket=require(_0x8446('0xd'))(new Redis(config['redis']));require(_0x8446('0xe'))[_0x8446('0xf')](socket);function respondWithRpcPromise(_0x3910f4,_0x5ed22a,_0x1e2535){return new BPromise(function(_0x4370ae,_0x5171eb){return client[_0x8446('0x10')](_0x3910f4,_0x1e2535)[_0x8446('0x11')](function(_0x40646c){logger[_0x8446('0x12')](_0x8446('0x13'),_0x5ed22a,_0x8446('0x14'));logger[_0x8446('0x15')](_0x8446('0x16'),_0x5ed22a,_0x8446('0x14'),JSON[_0x8446('0x17')](_0x40646c));if(_0x40646c['error']){if(_0x40646c[_0x8446('0x18')][_0x8446('0x19')]===0x1f4){logger[_0x8446('0x18')]('SmsQueue,\x20%s,\x20%s',_0x5ed22a,_0x40646c[_0x8446('0x18')][_0x8446('0x1a')]);return _0x5171eb(_0x40646c[_0x8446('0x18')]['message']);}logger[_0x8446('0x18')](_0x8446('0x13'),_0x5ed22a,_0x40646c[_0x8446('0x18')][_0x8446('0x1a')]);return _0x4370ae(_0x40646c[_0x8446('0x18')][_0x8446('0x1a')]);}else{logger[_0x8446('0x12')]('SmsQueue,\x20%s,\x20%s',_0x5ed22a,_0x8446('0x14'));_0x4370ae(_0x40646c[_0x8446('0x1b')][_0x8446('0x1a')]);}})[_0x8446('0x1c')](function(_0x19a763){logger['error'](_0x8446('0x13'),_0x5ed22a,_0x19a763);_0x5171eb(_0x19a763);});});}exports[_0x8446('0x1d')]=function(_0x139534){var _0x5818b2=this;return new Promise(function(_0x1c923f,_0x3ca97e){return db[_0x8446('0x1e')]['findAll']({'raw':_0x139534[_0x8446('0x1f')]?_0x139534['options'][_0x8446('0x20')]===undefined?!![]:![]:!![],'where':_0x139534['options']?_0x139534[_0x8446('0x1f')][_0x8446('0x21')]||null:null,'attributes':_0x139534[_0x8446('0x1f')]?_0x139534[_0x8446('0x1f')][_0x8446('0x22')]||null:null,'limit':_0x139534[_0x8446('0x1f')]?_0x139534[_0x8446('0x1f')][_0x8446('0x23')]||null:null,'include':_0x139534[_0x8446('0x1f')]?_0x139534[_0x8446('0x1f')][_0x8446('0x24')]?_[_0x8446('0x25')](_0x139534['options'][_0x8446('0x24')],function(_0x492de6){return{'model':db[_0x492de6[_0x8446('0x26')]],'as':_0x492de6['as'],'attributes':_0x492de6[_0x8446('0x22')],'include':_0x492de6['include']?_[_0x8446('0x25')](_0x492de6['include'],function(_0x31dfb4){return{'model':db[_0x31dfb4[_0x8446('0x26')]],'as':_0x31dfb4['as'],'attributes':_0x31dfb4['attributes'],'include':_0x31dfb4[_0x8446('0x24')]?_['map'](_0x31dfb4[_0x8446('0x24')],function(_0x363605){return{'model':db[_0x363605[_0x8446('0x26')]],'as':_0x363605['as'],'attributes':_0x363605[_0x8446('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8446('0x11')](function(_0x543d8e){logger[_0x8446('0x12')]('GetSmsQueue',_0x139534);logger[_0x8446('0x15')](_0x8446('0x1d'),_0x139534,JSON['stringify'](_0x543d8e));_0x1c923f(_0x543d8e);})[_0x8446('0x1c')](function(_0x39255c){logger[_0x8446('0x18')](_0x8446('0x1d'),_0x39255c[_0x8446('0x1a')],_0x139534);_0x3ca97e(_0x5818b2[_0x8446('0x18')](0x1f4,_0x39255c[_0x8446('0x1a')]));});});};exports['ShowSmsQueue']=function(_0x464201){var _0x73e44b=this;return new Promise(function(_0x42e799,_0x3ef6e8){return db[_0x8446('0x1e')]['find']({'raw':_0x464201[_0x8446('0x1f')]?_0x464201[_0x8446('0x1f')][_0x8446('0x20')]===undefined?!![]:![]:!![],'where':_0x464201[_0x8446('0x1f')]?_0x464201['options'][_0x8446('0x21')]||null:null,'attributes':_0x464201[_0x8446('0x1f')]?_0x464201['options'][_0x8446('0x22')]||null:null,'include':_0x464201[_0x8446('0x1f')]?_0x464201[_0x8446('0x1f')][_0x8446('0x24')]?_[_0x8446('0x25')](_0x464201[_0x8446('0x1f')][_0x8446('0x24')],function(_0x312c71){return{'model':db[_0x312c71[_0x8446('0x26')]],'as':_0x312c71['as'],'attributes':_0x312c71['attributes'],'include':_0x312c71[_0x8446('0x24')]?_[_0x8446('0x25')](_0x312c71[_0x8446('0x24')],function(_0x293b52){return{'model':db[_0x293b52['model']],'as':_0x293b52['as'],'attributes':_0x293b52[_0x8446('0x22')],'include':_0x293b52[_0x8446('0x24')]?_['map'](_0x293b52[_0x8446('0x24')],function(_0xf5f4c9){return{'model':db[_0xf5f4c9['model']],'as':_0xf5f4c9['as'],'attributes':_0xf5f4c9[_0x8446('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8446('0x11')](function(_0x5b2f5d){logger[_0x8446('0x12')]('ShowSmsQueue',_0x464201);logger[_0x8446('0x15')](_0x8446('0x27'),_0x464201,JSON['stringify'](_0x5b2f5d));_0x42e799(_0x5b2f5d);})['catch'](function(_0x4cb62a){logger[_0x8446('0x18')](_0x8446('0x27'),_0x4cb62a[_0x8446('0x1a')],_0x464201);_0x3ef6e8(_0x73e44b[_0x8446('0x18')](0x1f4,_0x4cb62a[_0x8446('0x1a')]));});});};
\ No newline at end of file
+var _0x0504=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','request','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','raw','options','where','attributes','limit','include','map','model','debug','ShowSmsQueue'];(function(_0x277108,_0x550276){var _0x36999f=function(_0x9da2d5){while(--_0x9da2d5){_0x277108['push'](_0x277108['shift']());}};_0x36999f(++_0x550276);}(_0x0504,0x1ee));var _0x4050=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x0504[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x4050('0x0'));var util=require(_0x4050('0x1'));var moment=require(_0x4050('0x2'));var BPromise=require('bluebird');var rs=require(_0x4050('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4050('0x4'))['db'];var utils=require(_0x4050('0x5'));var logger=require('../../config/logger')(_0x4050('0x6'));var config=require(_0x4050('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4050('0x8')][_0x4050('0x9')]({'port':0x232a});config['redis']=_[_0x4050('0xa')](config[_0x4050('0xb')],{'host':_0x4050('0xc'),'port':0x18eb});var socket=require(_0x4050('0xd'))(new Redis(config[_0x4050('0xb')]));require(_0x4050('0xe'))['register'](socket);function respondWithRpcPromise(_0x369899,_0x302cd2,_0x3534b8){return new BPromise(function(_0x39b017,_0x1030c7){return client[_0x4050('0xf')](_0x369899,_0x3534b8)[_0x4050('0x10')](function(_0x582b71){logger[_0x4050('0x11')](_0x4050('0x12'),_0x302cd2,_0x4050('0x13'));logger['debug'](_0x4050('0x14'),_0x302cd2,'request\x20sent',JSON[_0x4050('0x15')](_0x582b71));if(_0x582b71[_0x4050('0x16')]){if(_0x582b71[_0x4050('0x16')][_0x4050('0x17')]===0x1f4){logger[_0x4050('0x16')](_0x4050('0x12'),_0x302cd2,_0x582b71['error'][_0x4050('0x18')]);return _0x1030c7(_0x582b71[_0x4050('0x16')]['message']);}logger[_0x4050('0x16')](_0x4050('0x12'),_0x302cd2,_0x582b71[_0x4050('0x16')][_0x4050('0x18')]);return _0x39b017(_0x582b71[_0x4050('0x16')]['message']);}else{logger[_0x4050('0x11')](_0x4050('0x12'),_0x302cd2,_0x4050('0x13'));_0x39b017(_0x582b71['result']['message']);}})[_0x4050('0x19')](function(_0x4f1a48){logger[_0x4050('0x16')]('SmsQueue,\x20%s,\x20%s',_0x302cd2,_0x4f1a48);_0x1030c7(_0x4f1a48);});});}exports[_0x4050('0x1a')]=function(_0x3ddee3){var _0x425d06=this;return new Promise(function(_0x3af908,_0x492d19){return db[_0x4050('0x1b')]['findAll']({'raw':_0x3ddee3['options']?_0x3ddee3['options'][_0x4050('0x1c')]===undefined?!![]:![]:!![],'where':_0x3ddee3[_0x4050('0x1d')]?_0x3ddee3[_0x4050('0x1d')][_0x4050('0x1e')]||null:null,'attributes':_0x3ddee3[_0x4050('0x1d')]?_0x3ddee3[_0x4050('0x1d')][_0x4050('0x1f')]||null:null,'limit':_0x3ddee3[_0x4050('0x1d')]?_0x3ddee3[_0x4050('0x1d')][_0x4050('0x20')]||null:null,'include':_0x3ddee3[_0x4050('0x1d')]?_0x3ddee3[_0x4050('0x1d')][_0x4050('0x21')]?_[_0x4050('0x22')](_0x3ddee3[_0x4050('0x1d')][_0x4050('0x21')],function(_0xcd73f8){return{'model':db[_0xcd73f8[_0x4050('0x23')]],'as':_0xcd73f8['as'],'attributes':_0xcd73f8[_0x4050('0x1f')],'include':_0xcd73f8['include']?_[_0x4050('0x22')](_0xcd73f8[_0x4050('0x21')],function(_0x1e38b0){return{'model':db[_0x1e38b0[_0x4050('0x23')]],'as':_0x1e38b0['as'],'attributes':_0x1e38b0['attributes'],'include':_0x1e38b0[_0x4050('0x21')]?_[_0x4050('0x22')](_0x1e38b0[_0x4050('0x21')],function(_0xfc263b){return{'model':db[_0xfc263b[_0x4050('0x23')]],'as':_0xfc263b['as'],'attributes':_0xfc263b[_0x4050('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e90b){logger[_0x4050('0x11')](_0x4050('0x1a'),_0x3ddee3);logger[_0x4050('0x24')](_0x4050('0x1a'),_0x3ddee3,JSON[_0x4050('0x15')](_0x57e90b));_0x3af908(_0x57e90b);})[_0x4050('0x19')](function(_0x4a92b9){logger[_0x4050('0x16')]('GetSmsQueue',_0x4a92b9[_0x4050('0x18')],_0x3ddee3);_0x492d19(_0x425d06[_0x4050('0x16')](0x1f4,_0x4a92b9[_0x4050('0x18')]));});});};exports[_0x4050('0x25')]=function(_0x53481a){var _0x52773c=this;return new Promise(function(_0x49d4be,_0x4dac4a){return db['SmsQueue']['find']({'raw':_0x53481a['options']?_0x53481a[_0x4050('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x53481a[_0x4050('0x1d')]?_0x53481a[_0x4050('0x1d')][_0x4050('0x1e')]||null:null,'attributes':_0x53481a[_0x4050('0x1d')]?_0x53481a[_0x4050('0x1d')][_0x4050('0x1f')]||null:null,'include':_0x53481a[_0x4050('0x1d')]?_0x53481a['options'][_0x4050('0x21')]?_[_0x4050('0x22')](_0x53481a[_0x4050('0x1d')][_0x4050('0x21')],function(_0x3d1c13){return{'model':db[_0x3d1c13['model']],'as':_0x3d1c13['as'],'attributes':_0x3d1c13[_0x4050('0x1f')],'include':_0x3d1c13[_0x4050('0x21')]?_[_0x4050('0x22')](_0x3d1c13[_0x4050('0x21')],function(_0x47b5e9){return{'model':db[_0x47b5e9['model']],'as':_0x47b5e9['as'],'attributes':_0x47b5e9[_0x4050('0x1f')],'include':_0x47b5e9[_0x4050('0x21')]?_[_0x4050('0x22')](_0x47b5e9[_0x4050('0x21')],function(_0xb86ce2){return{'model':db[_0xb86ce2['model']],'as':_0xb86ce2['as'],'attributes':_0xb86ce2[_0x4050('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x665be8){logger[_0x4050('0x11')](_0x4050('0x25'),_0x53481a);logger[_0x4050('0x24')](_0x4050('0x25'),_0x53481a,JSON[_0x4050('0x15')](_0x665be8));_0x49d4be(_0x665be8);})[_0x4050('0x19')](function(_0x3f6009){logger[_0x4050('0x16')](_0x4050('0x25'),_0x3f6009[_0x4050('0x18')],_0x53481a);_0x4dac4a(_0x52773c['error'](0x1f4,_0x3f6009[_0x4050('0x18')]));});});};
\ No newline at end of file
index 11a9652..15532ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8667=['./smsQueue.events','save','remove','emit','removeListener'];(function(_0x4d7fed,_0x2626c7){var _0x4ed546=function(_0x1ddba0){while(--_0x1ddba0){_0x4d7fed['push'](_0x4d7fed['shift']());}};_0x4ed546(++_0x2626c7);}(_0x8667,0xa5));var _0x7866=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8667[_0x2641f9];return _0x585741;};'use strict';var SmsQueueEvents=require(_0x7866('0x0'));var events=[_0x7866('0x1'),_0x7866('0x2'),'update'];function createListener(_0x14ca50,_0x3113d2){return function(_0x22b7bb){_0x3113d2[_0x7866('0x3')](_0x14ca50,_0x22b7bb);};}function removeListener(_0x3aad7b,_0x4f3f24){return function(){SmsQueueEvents[_0x7866('0x4')](_0x3aad7b,_0x4f3f24);};}exports['register']=function(_0x1fd5aa){for(var _0x36e438=0x0,_0x492f63=events['length'];_0x36e438<_0x492f63;_0x36e438++){var _0x1a6706=events[_0x36e438];var _0x30caf7=createListener('smsQueue:'+_0x1a6706,_0x1fd5aa);SmsQueueEvents['on'](_0x1a6706,_0x30caf7);}};
\ No newline at end of file
+var _0xbe95=['removeListener','length','./smsQueue.events','save','remove','update','emit'];(function(_0x5bedd3,_0x5ed9ec){var _0x3ad7e8=function(_0x4b2a3a){while(--_0x4b2a3a){_0x5bedd3['push'](_0x5bedd3['shift']());}};_0x3ad7e8(++_0x5ed9ec);}(_0xbe95,0x152));var _0x5be9=function(_0x2e24c6,_0x1f83e1){_0x2e24c6=_0x2e24c6-0x0;var _0x350907=_0xbe95[_0x2e24c6];return _0x350907;};'use strict';var SmsQueueEvents=require(_0x5be9('0x0'));var events=[_0x5be9('0x1'),_0x5be9('0x2'),_0x5be9('0x3')];function createListener(_0x37f146,_0x59212e){return function(_0x3229b2){_0x59212e[_0x5be9('0x4')](_0x37f146,_0x3229b2);};}function removeListener(_0xb0ef5b,_0x3e5162){return function(){SmsQueueEvents[_0x5be9('0x5')](_0xb0ef5b,_0x3e5162);};}exports['register']=function(_0x22f9e5){for(var _0x460734=0x0,_0x42403c=events[_0x5be9('0x6')];_0x460734<_0x42403c;_0x460734++){var _0x4affe5=events[_0x460734];var _0x1410f9=createListener('smsQueue:'+_0x4affe5,_0x22f9e5);SmsQueueEvents['on'](_0x4affe5,_0x1410f9);}};
\ No newline at end of file
index 6953fdc..3d6c1a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4c7=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','isAuthenticated','index','get','describe','/:id','show'];(function(_0x51233d,_0x20e44d){var _0x56eb26=function(_0x46cfc6){while(--_0x46cfc6){_0x51233d['push'](_0x51233d['shift']());}};_0x56eb26(++_0x20e44d);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1dc459,_0x3fc122){_0x1dc459=_0x1dc459-0x0;var _0x8674a7=_0xb4c7[_0x1dc459];return _0x8674a7;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get']('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xb')]);router[_0x7b4c('0xc')]('/describe',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xd')]);router['get'](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0xf')]);router[_0x7b4c('0x10')]('/',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x11')]);router[_0x7b4c('0x12')](_0x7b4c('0xe'),auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x13')]);router['delete']('/:id',auth[_0x7b4c('0xa')](),controller[_0x7b4c('0x14')]);module[_0x7b4c('0x15')]=router;
\ No newline at end of file
+var _0x4350=['/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','index','isAuthenticated'];(function(_0x867b4a,_0x1441ca){var _0x1260f4=function(_0xae9a96){while(--_0xae9a96){_0x867b4a['push'](_0x867b4a['shift']());}};_0x1260f4(++_0x1441ca);}(_0x4350,0x1d0));var _0x0435=function(_0x5ef0a1,_0x632b77){_0x5ef0a1=_0x5ef0a1-0x0;var _0x3a25c7=_0x4350[_0x5ef0a1];return _0x3a25c7;};'use strict';var multer=require(_0x0435('0x0'));var util=require(_0x0435('0x1'));var path=require('path');var timeout=require(_0x0435('0x2'));var express=require('express');var router=express[_0x0435('0x3')]();var fs_extra=require(_0x0435('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0435('0x5'));var config=require(_0x0435('0x6'));var controller=require(_0x0435('0x7'));router[_0x0435('0x8')]('/',auth['isAuthenticated'](),controller[_0x0435('0x9')]);router['get']('/describe',auth[_0x0435('0xa')](),controller['describe']);router['get'](_0x0435('0xb'),auth['isAuthenticated'](),controller[_0x0435('0xc')]);router[_0x0435('0xd')]('/',auth['isAuthenticated'](),controller[_0x0435('0xe')]);router['put'](_0x0435('0xb'),auth[_0x0435('0xa')](),controller[_0x0435('0xf')]);router[_0x0435('0x10')](_0x0435('0xb'),auth[_0x0435('0xa')](),controller[_0x0435('0x11')]);module[_0x0435('0x12')]=router;
\ No newline at end of file
index efb9f2e..f59f980 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa997=['moment','exports','STRING','DATE'];(function(_0x578ee9,_0x4f8c8c){var _0x2d303f=function(_0x17bbcd){while(--_0x17bbcd){_0x578ee9['push'](_0x578ee9['shift']());}};_0x2d303f(++_0x4f8c8c);}(_0xa997,0x1c4));var _0x7a99=function(_0x4e2861,_0x199be0){_0x4e2861=_0x4e2861-0x0;var _0x2265e3=_0xa997[_0x4e2861];return _0x2265e3;};'use strict';var moment=require(_0x7a99('0x0'));var Sequelize=require('sequelize');module[_0x7a99('0x1')]={'uniqueid':{'type':Sequelize[_0x7a99('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7a99('0x3')]},'acceptAt':{'type':Sequelize[_0x7a99('0x3')]},'exitAt':{'type':Sequelize[_0x7a99('0x3')]},'reason':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x5a4d=['STRING','DATE','sequelize','exports'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x5a4d,0x1ea));var _0xd5a4=function(_0x38c3ef,_0x4851a2){_0x38c3ef=_0x38c3ef-0x0;var _0x421227=_0x5a4d[_0x38c3ef];return _0x421227;};'use strict';var moment=require('moment');var Sequelize=require(_0xd5a4('0x0'));module[_0xd5a4('0x1')]={'uniqueid':{'type':Sequelize[_0xd5a4('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd5a4('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xd5a4('0x3')]},'exitAt':{'type':Sequelize[_0xd5a4('0x3')]},'reason':{'type':Sequelize[_0xd5a4('0x2')]}};
\ No newline at end of file
index bef9a8a..cd813f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a44=['undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','map','SmsQueueReport','rawAttributes','type','key','name','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x2e030a,_0x8e4c48){var _0x597df6=function(_0x3da9ce){while(--_0x3da9ce){_0x2e030a['push'](_0x2e030a['shift']());}};_0x597df6(++_0x8e4c48);}(_0x1a44,0xbf));var _0x41a4=function(_0x143d47,_0x40def6){_0x143d47=_0x143d47-0x0;var _0x5cc0cb=_0x1a44[_0x143d47];return _0x5cc0cb;};'use strict';var emlformat=require(_0x41a4('0x0'));var rimraf=require(_0x41a4('0x1'));var zipdir=require(_0x41a4('0x2'));var jsonpatch=require(_0x41a4('0x3'));var rp=require(_0x41a4('0x4'));var moment=require(_0x41a4('0x5'));var BPromise=require(_0x41a4('0x6'));var Mustache=require(_0x41a4('0x7'));var util=require(_0x41a4('0x8'));var path=require('path');var sox=require(_0x41a4('0x9'));var csv=require(_0x41a4('0xa'));var ejs=require(_0x41a4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x41a4('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x41a4('0xd'));var deskjs=require(_0x41a4('0xe'));var toCsv=require(_0x41a4('0xa'));var querystring=require(_0x41a4('0xf'));var Papa=require(_0x41a4('0x10'));var Redis=require(_0x41a4('0x11'));var authService=require(_0x41a4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x41a4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x41a4('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x41a4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x41a4('0x16'))['db'];function respondWithStatusCode(_0x519ab0,_0xf4e610){_0xf4e610=_0xf4e610||0xcc;return function(_0x5a131f){if(_0x5a131f){return _0x519ab0[_0x41a4('0x17')](_0xf4e610);}return _0x519ab0[_0x41a4('0x18')](_0xf4e610)[_0x41a4('0x19')]();};}function respondWithResult(_0x1c55a0,_0x413349){_0x413349=_0x413349||0xc8;return function(_0x50ff2c){if(_0x50ff2c){return _0x1c55a0[_0x41a4('0x18')](_0x413349)[_0x41a4('0x1a')](_0x50ff2c);}};}function respondWithFilteredResult(_0x54b7e6,_0x2753f3){return function(_0x54ebad){if(_0x54ebad){var _0x4591f0=typeof _0x2753f3[_0x41a4('0x1b')]===_0x41a4('0x1c')&&typeof _0x2753f3['limit']===_0x41a4('0x1c');var _0x4ac5ca=_0x54ebad[_0x41a4('0x1d')];var _0x3fe68b=_0x4591f0?0x0:_0x2753f3['offset'];var _0x5061ba=_0x4591f0?_0x54ebad['count']:_0x2753f3[_0x41a4('0x1b')]+_0x2753f3['limit'];var _0x4e433b;if(_0x5061ba>=_0x4ac5ca){_0x5061ba=_0x4ac5ca;_0x4e433b=0xc8;}else{_0x4e433b=0xce;}_0x54b7e6[_0x41a4('0x18')](_0x4e433b);return _0x54b7e6[_0x41a4('0x1e')](_0x41a4('0x1f'),_0x3fe68b+'-'+_0x5061ba+'/'+_0x4ac5ca)[_0x41a4('0x1a')](_0x54ebad);}return null;};}function patchUpdates(_0x1bf1e0){return function(_0x3df0c1){try{jsonpatch[_0x41a4('0x20')](_0x3df0c1,_0x1bf1e0,!![]);}catch(_0x5ba8de){return BPromise[_0x41a4('0x21')](_0x5ba8de);}return _0x3df0c1[_0x41a4('0x22')]();};}function saveUpdates(_0x5af243,_0x2e1eaf){return function(_0x9d8a2){if(_0x9d8a2){return _0x9d8a2['update'](_0x5af243)[_0x41a4('0x23')](function(_0x5dbec6){return _0x5dbec6;});}return null;};}function removeEntity(_0x7394cd,_0x223d1b){return function(_0x2434af){if(_0x2434af){return _0x2434af[_0x41a4('0x24')]()[_0x41a4('0x23')](function(){_0x7394cd[_0x41a4('0x18')](0xcc)[_0x41a4('0x19')]();});}};}function handleEntityNotFound(_0x4a8ae6,_0x21aa6b){return function(_0x39683a){if(!_0x39683a){_0x4a8ae6[_0x41a4('0x17')](0x194);}return _0x39683a;};}function handleError(_0x12f032,_0x18a9ba){_0x18a9ba=_0x18a9ba||0x1f4;return function(_0x59c5c7){logger[_0x41a4('0x25')](_0x59c5c7[_0x41a4('0x26')]);if(_0x59c5c7['name']){delete _0x59c5c7['name'];}_0x12f032[_0x41a4('0x18')](_0x18a9ba)['send'](_0x59c5c7);};}exports['index']=function(_0x179ac9,_0x5edfaf){var _0x43efe4={},_0x18c178={},_0x5ef8c6={'count':0x0,'rows':[]};var _0x271664=_[_0x41a4('0x27')](db[_0x41a4('0x28')][_0x41a4('0x29')],function(_0x1bab77){return{'name':_0x1bab77['fieldName'],'type':_0x1bab77[_0x41a4('0x2a')][_0x41a4('0x2b')]};});_0x18c178['model']=_[_0x41a4('0x27')](_0x271664,_0x41a4('0x2c'));_0x18c178['query']=_['keys'](_0x179ac9[_0x41a4('0x2d')]);_0x18c178[_0x41a4('0x2e')]=_['intersection'](_0x18c178[_0x41a4('0x2f')],_0x18c178[_0x41a4('0x2d')]);_0x43efe4[_0x41a4('0x30')]=_[_0x41a4('0x31')](_0x18c178[_0x41a4('0x2f')],qs[_0x41a4('0x32')](_0x179ac9[_0x41a4('0x2d')][_0x41a4('0x32')]));_0x43efe4['attributes']=_0x43efe4[_0x41a4('0x30')][_0x41a4('0x33')]?_0x43efe4[_0x41a4('0x30')]:_0x18c178[_0x41a4('0x2f')];if(!_0x179ac9[_0x41a4('0x2d')][_0x41a4('0x34')]('nolimit')){_0x43efe4[_0x41a4('0x35')]=qs[_0x41a4('0x35')](_0x179ac9[_0x41a4('0x2d')]['limit']);_0x43efe4[_0x41a4('0x1b')]=qs[_0x41a4('0x1b')](_0x179ac9['query'][_0x41a4('0x1b')]);}_0x43efe4[_0x41a4('0x36')]=qs[_0x41a4('0x37')](_0x179ac9['query']['sort']);_0x43efe4['where']=qs[_0x41a4('0x2e')](_[_0x41a4('0x38')](_0x179ac9[_0x41a4('0x2d')],_0x18c178[_0x41a4('0x2e')]),_0x271664);if(_0x179ac9[_0x41a4('0x2d')][_0x41a4('0x39')]){_0x43efe4[_0x41a4('0x3a')]=_[_0x41a4('0x3b')](_0x43efe4[_0x41a4('0x3a')],{'$or':_['map'](_0x271664,function(_0x55897a){if(_0x55897a[_0x41a4('0x2a')]!==_0x41a4('0x3c')){var _0xa05530={};_0xa05530[_0x55897a[_0x41a4('0x2c')]]={'$like':'%'+_0x179ac9[_0x41a4('0x2d')][_0x41a4('0x39')]+'%'};return _0xa05530;}})});}_0x43efe4=_[_0x41a4('0x3b')]({},_0x43efe4,_0x179ac9['options']);var _0x5c0184={'where':_0x43efe4[_0x41a4('0x3a')]};return db[_0x41a4('0x28')][_0x41a4('0x1d')](_0x5c0184)[_0x41a4('0x23')](function(_0x1ea394){_0x5ef8c6[_0x41a4('0x1d')]=_0x1ea394;if(_0x179ac9[_0x41a4('0x2d')][_0x41a4('0x3d')]){_0x43efe4[_0x41a4('0x3e')]=[{'all':!![]}];}return db[_0x41a4('0x28')][_0x41a4('0x3f')](_0x43efe4);})[_0x41a4('0x23')](function(_0xd971c0){_0x5ef8c6['rows']=_0xd971c0;return _0x5ef8c6;})[_0x41a4('0x23')](respondWithFilteredResult(_0x5edfaf,_0x43efe4))[_0x41a4('0x40')](handleError(_0x5edfaf,null));};exports[_0x41a4('0x41')]=function(_0x30194e,_0x399d92){var _0x32e7b2={'raw':!![],'where':{'id':_0x30194e['params']['id']}},_0x3317d3={};_0x3317d3['model']=_['keys'](db[_0x41a4('0x28')][_0x41a4('0x29')]);_0x3317d3[_0x41a4('0x2d')]=_[_0x41a4('0x42')](_0x30194e['query']);_0x3317d3[_0x41a4('0x2e')]=_['intersection'](_0x3317d3[_0x41a4('0x2f')],_0x3317d3['query']);_0x32e7b2[_0x41a4('0x30')]=_[_0x41a4('0x31')](_0x3317d3['model'],qs[_0x41a4('0x32')](_0x30194e['query'][_0x41a4('0x32')]));_0x32e7b2[_0x41a4('0x30')]=_0x32e7b2[_0x41a4('0x30')][_0x41a4('0x33')]?_0x32e7b2['attributes']:_0x3317d3[_0x41a4('0x2f')];if(_0x30194e[_0x41a4('0x2d')]['includeAll']){_0x32e7b2[_0x41a4('0x3e')]=[{'all':!![]}];}_0x32e7b2=_['merge']({},_0x32e7b2,_0x30194e['options']);return db['SmsQueueReport'][_0x41a4('0x43')](_0x32e7b2)[_0x41a4('0x23')](handleEntityNotFound(_0x399d92,null))[_0x41a4('0x23')](respondWithResult(_0x399d92,null))[_0x41a4('0x40')](handleError(_0x399d92,null));};exports[_0x41a4('0x44')]=function(_0x437ead,_0x3e2f09){return db[_0x41a4('0x28')][_0x41a4('0x44')](_0x437ead[_0x41a4('0x45')],{})['then'](respondWithResult(_0x3e2f09,0xc9))[_0x41a4('0x40')](handleError(_0x3e2f09,null));};exports[_0x41a4('0x46')]=function(_0x4a9247,_0x40d113){if(_0x4a9247[_0x41a4('0x45')]['id']){delete _0x4a9247['body']['id'];}return db[_0x41a4('0x28')][_0x41a4('0x43')]({'where':{'id':_0x4a9247[_0x41a4('0x47')]['id']}})[_0x41a4('0x23')](handleEntityNotFound(_0x40d113,null))[_0x41a4('0x23')](saveUpdates(_0x4a9247['body'],null))[_0x41a4('0x23')](respondWithResult(_0x40d113,null))[_0x41a4('0x40')](handleError(_0x40d113,null));};exports[_0x41a4('0x24')]=function(_0x4c2c70,_0x155689){return db['SmsQueueReport'][_0x41a4('0x43')]({'where':{'id':_0x4c2c70[_0x41a4('0x47')]['id']}})[_0x41a4('0x23')](handleEntityNotFound(_0x155689,null))['then'](removeEntity(_0x155689,null))[_0x41a4('0x40')](handleError(_0x155689,null));};exports[_0x41a4('0x48')]=function(_0x1a5d63,_0x33ccd0){return db[_0x41a4('0x28')][_0x41a4('0x48')]()[_0x41a4('0x23')](respondWithResult(_0x33ccd0,null))[_0x41a4('0x40')](handleError(_0x33ccd0,null));};
\ No newline at end of file
+var _0xb2ed=['show','params','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','offset','count','set','apply','reject','save','update','then','error','stack','name','index','map','SmsQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch'];(function(_0x2984d0,_0x1a7211){var _0x2885f2=function(_0x42f3da){while(--_0x42f3da){_0x2984d0['push'](_0x2984d0['shift']());}};_0x2885f2(++_0x1a7211);}(_0xb2ed,0x18d));var _0xdb2e=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0xb2ed[_0x1ae4a9];return _0x54d0b0;};'use strict';var emlformat=require(_0xdb2e('0x0'));var rimraf=require(_0xdb2e('0x1'));var zipdir=require(_0xdb2e('0x2'));var jsonpatch=require(_0xdb2e('0x3'));var rp=require('request-promise');var moment=require(_0xdb2e('0x4'));var BPromise=require(_0xdb2e('0x5'));var Mustache=require(_0xdb2e('0x6'));var util=require(_0xdb2e('0x7'));var path=require(_0xdb2e('0x8'));var sox=require(_0xdb2e('0x9'));var csv=require('to-csv');var ejs=require(_0xdb2e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdb2e('0xb'));var squel=require(_0xdb2e('0xc'));var crypto=require(_0xdb2e('0xd'));var jsforce=require(_0xdb2e('0xe'));var deskjs=require(_0xdb2e('0xf'));var toCsv=require(_0xdb2e('0x10'));var querystring=require(_0xdb2e('0x11'));var Papa=require(_0xdb2e('0x12'));var Redis=require('ioredis');var authService=require(_0xdb2e('0x13'));var qs=require(_0xdb2e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb2e('0x15'));var logger=require(_0xdb2e('0x16'))(_0xdb2e('0x17'));var utils=require(_0xdb2e('0x18'));var config=require(_0xdb2e('0x19'));var licenseUtil=require(_0xdb2e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x585653,_0x4418a1){_0x4418a1=_0x4418a1||0xcc;return function(_0x5175fb){if(_0x5175fb){return _0x585653[_0xdb2e('0x1b')](_0x4418a1);}return _0x585653[_0xdb2e('0x1c')](_0x4418a1)[_0xdb2e('0x1d')]();};}function respondWithResult(_0x3d67a0,_0x57fada){_0x57fada=_0x57fada||0xc8;return function(_0x5b4e04){if(_0x5b4e04){return _0x3d67a0['status'](_0x57fada)[_0xdb2e('0x1e')](_0x5b4e04);}};}function respondWithFilteredResult(_0x250744,_0x3a4c18){return function(_0x355ced){if(_0x355ced){var _0x524bf7=typeof _0x3a4c18['offset']==='undefined'&&typeof _0x3a4c18[_0xdb2e('0x1f')]==='undefined';var _0x5c98a0=_0x355ced['count'];var _0x40f051=_0x524bf7?0x0:_0x3a4c18[_0xdb2e('0x20')];var _0x14573b=_0x524bf7?_0x355ced[_0xdb2e('0x21')]:_0x3a4c18['offset']+_0x3a4c18[_0xdb2e('0x1f')];var _0x9c5d5d;if(_0x14573b>=_0x5c98a0){_0x14573b=_0x5c98a0;_0x9c5d5d=0xc8;}else{_0x9c5d5d=0xce;}_0x250744[_0xdb2e('0x1c')](_0x9c5d5d);return _0x250744[_0xdb2e('0x22')]('Content-Range',_0x40f051+'-'+_0x14573b+'/'+_0x5c98a0)[_0xdb2e('0x1e')](_0x355ced);}return null;};}function patchUpdates(_0x35e8b1){return function(_0xce05c2){try{jsonpatch[_0xdb2e('0x23')](_0xce05c2,_0x35e8b1,!![]);}catch(_0x58375b){return BPromise[_0xdb2e('0x24')](_0x58375b);}return _0xce05c2[_0xdb2e('0x25')]();};}function saveUpdates(_0x3dab0c,_0x38449c){return function(_0x3486d9){if(_0x3486d9){return _0x3486d9[_0xdb2e('0x26')](_0x3dab0c)[_0xdb2e('0x27')](function(_0x59e61c){return _0x59e61c;});}return null;};}function removeEntity(_0x516d98,_0x9d3dba){return function(_0x4ebb9c){if(_0x4ebb9c){return _0x4ebb9c['destroy']()['then'](function(){_0x516d98[_0xdb2e('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56f49d,_0x5202b1){return function(_0x10ec6d){if(!_0x10ec6d){_0x56f49d[_0xdb2e('0x1b')](0x194);}return _0x10ec6d;};}function handleError(_0x1eb9d2,_0x51aecb){_0x51aecb=_0x51aecb||0x1f4;return function(_0x536bf1){logger[_0xdb2e('0x28')](_0x536bf1[_0xdb2e('0x29')]);if(_0x536bf1[_0xdb2e('0x2a')]){delete _0x536bf1[_0xdb2e('0x2a')];}_0x1eb9d2[_0xdb2e('0x1c')](_0x51aecb)['send'](_0x536bf1);};}exports[_0xdb2e('0x2b')]=function(_0x26ad0f,_0x55ac6f){var _0x450986={},_0x474f93={},_0x5e9325={'count':0x0,'rows':[]};var _0x22d797=_[_0xdb2e('0x2c')](db[_0xdb2e('0x2d')][_0xdb2e('0x2e')],function(_0x1b0991){return{'name':_0x1b0991[_0xdb2e('0x2f')],'type':_0x1b0991[_0xdb2e('0x30')]['key']};});_0x474f93[_0xdb2e('0x31')]=_[_0xdb2e('0x2c')](_0x22d797,'name');_0x474f93[_0xdb2e('0x32')]=_[_0xdb2e('0x33')](_0x26ad0f['query']);_0x474f93['filters']=_[_0xdb2e('0x34')](_0x474f93[_0xdb2e('0x31')],_0x474f93[_0xdb2e('0x32')]);_0x450986[_0xdb2e('0x35')]=_[_0xdb2e('0x34')](_0x474f93[_0xdb2e('0x31')],qs[_0xdb2e('0x36')](_0x26ad0f['query'][_0xdb2e('0x36')]));_0x450986[_0xdb2e('0x35')]=_0x450986[_0xdb2e('0x35')][_0xdb2e('0x37')]?_0x450986[_0xdb2e('0x35')]:_0x474f93[_0xdb2e('0x31')];if(!_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x38')](_0xdb2e('0x39'))){_0x450986[_0xdb2e('0x1f')]=qs[_0xdb2e('0x1f')](_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x1f')]);_0x450986[_0xdb2e('0x20')]=qs[_0xdb2e('0x20')](_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x20')]);}_0x450986[_0xdb2e('0x3a')]=qs[_0xdb2e('0x3b')](_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x3b')]);_0x450986['where']=qs[_0xdb2e('0x3c')](_[_0xdb2e('0x3d')](_0x26ad0f[_0xdb2e('0x32')],_0x474f93['filters']),_0x22d797);if(_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x3e')]){_0x450986[_0xdb2e('0x3f')]=_[_0xdb2e('0x40')](_0x450986['where'],{'$or':_['map'](_0x22d797,function(_0x3e5d05){if(_0x3e5d05[_0xdb2e('0x30')]!==_0xdb2e('0x41')){var _0x2261c8={};_0x2261c8[_0x3e5d05[_0xdb2e('0x2a')]]={'$like':'%'+_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x3e')]+'%'};return _0x2261c8;}})});}_0x450986=_[_0xdb2e('0x40')]({},_0x450986,_0x26ad0f[_0xdb2e('0x42')]);var _0x15d6b1={'where':_0x450986['where']};return db['SmsQueueReport'][_0xdb2e('0x21')](_0x15d6b1)[_0xdb2e('0x27')](function(_0x2c363e){_0x5e9325[_0xdb2e('0x21')]=_0x2c363e;if(_0x26ad0f[_0xdb2e('0x32')][_0xdb2e('0x43')]){_0x450986['include']=[{'all':!![]}];}return db[_0xdb2e('0x2d')][_0xdb2e('0x44')](_0x450986);})[_0xdb2e('0x27')](function(_0x592bd5){_0x5e9325[_0xdb2e('0x45')]=_0x592bd5;return _0x5e9325;})[_0xdb2e('0x27')](respondWithFilteredResult(_0x55ac6f,_0x450986))[_0xdb2e('0x46')](handleError(_0x55ac6f,null));};exports[_0xdb2e('0x47')]=function(_0x188f67,_0x512cd0){var _0x5eaaa2={'raw':!![],'where':{'id':_0x188f67[_0xdb2e('0x48')]['id']}},_0x3a7c8f={};_0x3a7c8f[_0xdb2e('0x31')]=_[_0xdb2e('0x33')](db[_0xdb2e('0x2d')][_0xdb2e('0x2e')]);_0x3a7c8f['query']=_['keys'](_0x188f67[_0xdb2e('0x32')]);_0x3a7c8f[_0xdb2e('0x3c')]=_[_0xdb2e('0x34')](_0x3a7c8f['model'],_0x3a7c8f['query']);_0x5eaaa2[_0xdb2e('0x35')]=_[_0xdb2e('0x34')](_0x3a7c8f[_0xdb2e('0x31')],qs['fields'](_0x188f67[_0xdb2e('0x32')][_0xdb2e('0x36')]));_0x5eaaa2['attributes']=_0x5eaaa2['attributes']['length']?_0x5eaaa2[_0xdb2e('0x35')]:_0x3a7c8f[_0xdb2e('0x31')];if(_0x188f67[_0xdb2e('0x32')][_0xdb2e('0x43')]){_0x5eaaa2[_0xdb2e('0x49')]=[{'all':!![]}];}_0x5eaaa2=_['merge']({},_0x5eaaa2,_0x188f67['options']);return db[_0xdb2e('0x2d')][_0xdb2e('0x4a')](_0x5eaaa2)[_0xdb2e('0x27')](handleEntityNotFound(_0x512cd0,null))[_0xdb2e('0x27')](respondWithResult(_0x512cd0,null))[_0xdb2e('0x46')](handleError(_0x512cd0,null));};exports[_0xdb2e('0x4b')]=function(_0x1c31b2,_0x41f5a9){return db[_0xdb2e('0x2d')]['create'](_0x1c31b2['body'],{})['then'](respondWithResult(_0x41f5a9,0xc9))[_0xdb2e('0x46')](handleError(_0x41f5a9,null));};exports['update']=function(_0x55b16a,_0x178695){if(_0x55b16a[_0xdb2e('0x4c')]['id']){delete _0x55b16a[_0xdb2e('0x4c')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x55b16a[_0xdb2e('0x48')]['id']}})['then'](handleEntityNotFound(_0x178695,null))['then'](saveUpdates(_0x55b16a[_0xdb2e('0x4c')],null))[_0xdb2e('0x27')](respondWithResult(_0x178695,null))[_0xdb2e('0x46')](handleError(_0x178695,null));};exports[_0xdb2e('0x4d')]=function(_0x423fb8,_0x2e417e){return db['SmsQueueReport'][_0xdb2e('0x4a')]({'where':{'id':_0x423fb8['params']['id']}})[_0xdb2e('0x27')](handleEntityNotFound(_0x2e417e,null))[_0xdb2e('0x27')](removeEntity(_0x2e417e,null))[_0xdb2e('0x46')](handleError(_0x2e417e,null));};exports['describe']=function(_0xabc13e,_0x12ebba){return db[_0xdb2e('0x2d')]['describe']()[_0xdb2e('0x27')](respondWithResult(_0x12ebba,null))[_0xdb2e('0x46')](handleError(_0x12ebba,null));};
\ No newline at end of file
index d67b800..d65e956 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','SmsQueueReport','uniqueid','lodash'];(function(_0x58e575,_0x21f2b4){var _0x16b06a=function(_0x421737){while(--_0x421737){_0x58e575['push'](_0x58e575['shift']());}};_0x16b06a(++_0x21f2b4);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
index 9c32217..c49fd1a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8c71=['jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','CreateSmsQueueReport','SmsQueueReport','body','options','stringify','UpdateSmsQueueReport','raw','attributes','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1898c0,_0x47b37f){var _0xbf2ee1=function(_0x4e34de){while(--_0x4e34de){_0x1898c0['push'](_0x1898c0['shift']());}};_0xbf2ee1(++_0x47b37f);}(_0x8c71,0x14c));var _0x18c7=function(_0x7577b9,_0x4fe21c){_0x7577b9=_0x7577b9-0x0;var _0x2660c8=_0x8c71[_0x7577b9];return _0x2660c8;};'use strict';var _=require(_0x18c7('0x0'));var util=require(_0x18c7('0x1'));var moment=require(_0x18c7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18c7('0x3'));var db=require(_0x18c7('0x4'))['db'];var utils=require(_0x18c7('0x5'));var logger=require(_0x18c7('0x6'))(_0x18c7('0x7'));var config=require(_0x18c7('0x8'));var jayson=require(_0x18c7('0x9'));var client=jayson[_0x18c7('0xa')][_0x18c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ed5c0,_0x12fd09,_0x3fea4b){return new BPromise(function(_0x5ed034,_0x148707){return client[_0x18c7('0xc')](_0x2ed5c0,_0x3fea4b)[_0x18c7('0xd')](function(_0x1eb01c){logger[_0x18c7('0xe')](_0x18c7('0xf'),_0x12fd09,_0x18c7('0x10'));logger[_0x18c7('0x11')](_0x18c7('0x12'),_0x12fd09,_0x18c7('0x10'),JSON['stringify'](_0x1eb01c));if(_0x1eb01c[_0x18c7('0x13')]){if(_0x1eb01c['error']['code']===0x1f4){logger[_0x18c7('0x13')](_0x18c7('0xf'),_0x12fd09,_0x1eb01c['error'][_0x18c7('0x14')]);return _0x148707(_0x1eb01c[_0x18c7('0x13')]['message']);}logger['error'](_0x18c7('0xf'),_0x12fd09,_0x1eb01c[_0x18c7('0x13')][_0x18c7('0x14')]);return _0x5ed034(_0x1eb01c[_0x18c7('0x13')]['message']);}else{logger[_0x18c7('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x12fd09,_0x18c7('0x10'));_0x5ed034(_0x1eb01c[_0x18c7('0x15')]['message']);}})['catch'](function(_0xae4689){logger[_0x18c7('0x13')](_0x18c7('0xf'),_0x12fd09,_0xae4689);_0x148707(_0xae4689);});});}exports[_0x18c7('0x16')]=function(_0x542ebe){var _0x32c2c3=this;return new Promise(function(_0x36e53e,_0x4c734c){return db[_0x18c7('0x17')]['create'](_0x542ebe[_0x18c7('0x18')],{'raw':_0x542ebe['options']?_0x542ebe[_0x18c7('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x268f35){logger[_0x18c7('0xe')](_0x18c7('0x16'),_0x542ebe);logger[_0x18c7('0x11')]('CreateSmsQueueReport',_0x542ebe,JSON[_0x18c7('0x1a')](_0x268f35));_0x36e53e(_0x268f35);})['catch'](function(_0x1c639a){logger[_0x18c7('0x13')](_0x18c7('0x16'),_0x1c639a[_0x18c7('0x14')],_0x542ebe);_0x4c734c(_0x32c2c3[_0x18c7('0x13')](0x1f4,_0x1c639a['message']));});});};exports[_0x18c7('0x1b')]=function(_0x18ddc1){var _0xb93e9f=this;return new Promise(function(_0x2b2998,_0x569663){return db[_0x18c7('0x17')]['update'](_0x18ddc1['body'],{'raw':_0x18ddc1[_0x18c7('0x19')]?_0x18ddc1[_0x18c7('0x19')][_0x18c7('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18ddc1[_0x18c7('0x19')]?_0x18ddc1['options']['where']||null:null,'attributes':_0x18ddc1[_0x18c7('0x19')]?_0x18ddc1['options'][_0x18c7('0x1d')]||null:null,'limit':_0x18ddc1[_0x18c7('0x19')]?_0x18ddc1[_0x18c7('0x19')]['limit']||null:null})[_0x18c7('0xd')](function(_0x45623d){logger['info'](_0x18c7('0x1b'),_0x18ddc1);logger[_0x18c7('0x11')](_0x18c7('0x1b'),_0x18ddc1,JSON['stringify'](_0x45623d));_0x2b2998(_0x45623d);})[_0x18c7('0x1e')](function(_0x39bed9){logger['error']('UpdateSmsQueueReport',_0x39bed9[_0x18c7('0x14')],_0x18ddc1);_0x569663(_0xb93e9f[_0x18c7('0x13')](0x1f4,_0x39bed9[_0x18c7('0x14')]));});});};
\ No newline at end of file
+var _0xaccd=['create','body','options','raw','UpdateSmsQueueReport','update','limit','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport'];(function(_0x4dc3ac,_0x46853c){var _0x1cfa22=function(_0x3a82ae){while(--_0x3a82ae){_0x4dc3ac['push'](_0x4dc3ac['shift']());}};_0x1cfa22(++_0x46853c);}(_0xaccd,0x100));var _0xdacc=function(_0x31a1c8,_0x1febb8){_0x31a1c8=_0x31a1c8-0x0;var _0x2d38ef=_0xaccd[_0x31a1c8];return _0x2d38ef;};'use strict';var _=require('lodash');var util=require(_0xdacc('0x0'));var moment=require(_0xdacc('0x1'));var BPromise=require(_0xdacc('0x2'));var rs=require(_0xdacc('0x3'));var fs=require('fs');var Redis=require(_0xdacc('0x4'));var db=require(_0xdacc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdacc('0x6'))(_0xdacc('0x7'));var config=require('../../config/environment');var jayson=require(_0xdacc('0x8'));var client=jayson[_0xdacc('0x9')][_0xdacc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x495ec0,_0x260d04,_0x2adb33){return new BPromise(function(_0x329a19,_0x4cccd5){return client[_0xdacc('0xb')](_0x495ec0,_0x2adb33)[_0xdacc('0xc')](function(_0x4e2d0a){logger[_0xdacc('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x260d04,_0xdacc('0xe'));logger['debug'](_0xdacc('0xf'),_0x260d04,_0xdacc('0xe'),JSON[_0xdacc('0x10')](_0x4e2d0a));if(_0x4e2d0a[_0xdacc('0x11')]){if(_0x4e2d0a['error']['code']===0x1f4){logger[_0xdacc('0x11')](_0xdacc('0x12'),_0x260d04,_0x4e2d0a[_0xdacc('0x11')][_0xdacc('0x13')]);return _0x4cccd5(_0x4e2d0a[_0xdacc('0x11')][_0xdacc('0x13')]);}logger[_0xdacc('0x11')](_0xdacc('0x12'),_0x260d04,_0x4e2d0a['error'][_0xdacc('0x13')]);return _0x329a19(_0x4e2d0a[_0xdacc('0x11')][_0xdacc('0x13')]);}else{logger[_0xdacc('0xd')](_0xdacc('0x12'),_0x260d04,_0xdacc('0xe'));_0x329a19(_0x4e2d0a[_0xdacc('0x14')][_0xdacc('0x13')]);}})[_0xdacc('0x15')](function(_0x11d1c8){logger[_0xdacc('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0x260d04,_0x11d1c8);_0x4cccd5(_0x11d1c8);});});}exports[_0xdacc('0x16')]=function(_0x54e963){var _0x3ab33a=this;return new Promise(function(_0x2ce6fe,_0x3feff1){return db['SmsQueueReport'][_0xdacc('0x17')](_0x54e963[_0xdacc('0x18')],{'raw':_0x54e963[_0xdacc('0x19')]?_0x54e963[_0xdacc('0x19')][_0xdacc('0x1a')]===undefined?!![]:![]:!![]})[_0xdacc('0xc')](function(_0xb52c95){logger['info'](_0xdacc('0x16'),_0x54e963);logger['debug'](_0xdacc('0x16'),_0x54e963,JSON[_0xdacc('0x10')](_0xb52c95));_0x2ce6fe(_0xb52c95);})[_0xdacc('0x15')](function(_0x25ec04){logger[_0xdacc('0x11')](_0xdacc('0x16'),_0x25ec04[_0xdacc('0x13')],_0x54e963);_0x3feff1(_0x3ab33a['error'](0x1f4,_0x25ec04['message']));});});};exports[_0xdacc('0x1b')]=function(_0x594898){var _0x17f46a=this;return new Promise(function(_0x52548f,_0x1b996e){return db['SmsQueueReport'][_0xdacc('0x1c')](_0x594898[_0xdacc('0x18')],{'raw':_0x594898['options']?_0x594898['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x594898[_0xdacc('0x19')]?_0x594898[_0xdacc('0x19')]['where']||null:null,'attributes':_0x594898[_0xdacc('0x19')]?_0x594898[_0xdacc('0x19')]['attributes']||null:null,'limit':_0x594898['options']?_0x594898[_0xdacc('0x19')][_0xdacc('0x1d')]||null:null})[_0xdacc('0xc')](function(_0x31bc56){logger['info'](_0xdacc('0x1b'),_0x594898);logger[_0xdacc('0x1e')]('UpdateSmsQueueReport',_0x594898,JSON['stringify'](_0x31bc56));_0x52548f(_0x31bc56);})[_0xdacc('0x15')](function(_0x34773f){logger[_0xdacc('0x11')](_0xdacc('0x1b'),_0x34773f[_0xdacc('0x13')],_0x594898);_0x1b996e(_0x17f46a[_0xdacc('0x11')](0x1f4,_0x34773f[_0xdacc('0x13')]));});});};
\ No newline at end of file
index 1cae572..bb8818d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x303a=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','update','delete','exports','multer','path'];(function(_0x23ea89,_0x1598f9){var _0x1da46e=function(_0x364e09){while(--_0x364e09){_0x23ea89['push'](_0x23ea89['shift']());}};_0x1da46e(++_0x1598f9);}(_0x303a,0x1a0));var _0xa303=function(_0x1f01f4,_0x5ea9ef){_0x1f01f4=_0x1f01f4-0x0;var _0x42dcb5=_0x303a[_0x1f01f4];return _0x42dcb5;};'use strict';var multer=require(_0xa303('0x0'));var util=require('util');var path=require(_0xa303('0x1'));var timeout=require(_0xa303('0x2'));var express=require(_0xa303('0x3'));var router=express[_0xa303('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa303('0x5'));var interaction=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var controller=require(_0xa303('0x8'));router[_0xa303('0x9')]('/',auth[_0xa303('0xa')](),controller[_0xa303('0xb')]);router[_0xa303('0x9')](_0xa303('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller['show']);router[_0xa303('0xe')]('/',auth['isAuthenticated'](),controller[_0xa303('0xf')]);router['put'](_0xa303('0xd'),auth[_0xa303('0xa')](),controller[_0xa303('0x10')]);router[_0xa303('0x11')]('/:id',auth[_0xa303('0xa')](),controller['destroy']);module[_0xa303('0x12')]=router;
\ No newline at end of file
+var _0xdbf5=['show','post','put','update','exports','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3ebecb,_0x59203c){_0x3ebecb=_0x3ebecb-0x0;var _0x47f512=_0xdbf5[_0x3ebecb];return _0x47f512;};'use strict';var multer=require('multer');var util=require(_0x5dbf('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5dbf('0x1'));var router=express[_0x5dbf('0x2')]();var fs_extra=require(_0x5dbf('0x3'));var auth=require(_0x5dbf('0x4'));var interaction=require(_0x5dbf('0x5'));var config=require(_0x5dbf('0x6'));var controller=require(_0x5dbf('0x7'));router[_0x5dbf('0x8')]('/',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xa')]);router[_0x5dbf('0x8')](_0x5dbf('0xb'),auth[_0x5dbf('0x9')](),controller['describe']);router[_0x5dbf('0x8')]('/:id',auth[_0x5dbf('0x9')](),controller[_0x5dbf('0xc')]);router[_0x5dbf('0xd')]('/',auth[_0x5dbf('0x9')](),controller['create']);router[_0x5dbf('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5dbf('0xf')]);router['delete']('/:id',auth[_0x5dbf('0x9')](),controller['destroy']);module[_0x5dbf('0x10')]=router;
\ No newline at end of file
index 0970e53..456fd55 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2906e6,_0x5ccd59){var _0x12517a=function(_0x36d576){while(--_0x36d576){_0x2906e6['push'](_0x2906e6['shift']());}};_0x12517a(++_0x5ccd59);}(_0xb43b,0x1b2));var _0xbb43=function(_0x7654a2,_0x12298e){_0x7654a2=_0x7654a2-0x0;var _0x3c8323=_0xb43b[_0x7654a2];return _0x3c8323;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}};
\ No newline at end of file
+var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x27a7d3,_0x24ca5b){var _0x107ab8=function(_0x5e7453){while(--_0x5e7453){_0x27a7d3['push'](_0x27a7d3['shift']());}};_0x107ab8(++_0x24ca5b);}(_0x54ef,0x112));var _0xf54e=function(_0x92bb2c,_0x54ca05){_0x92bb2c=_0x92bb2c-0x0;var _0x4a6525=_0x54ef[_0x92bb2c];return _0x4a6525;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}};
\ No newline at end of file
index 5822149..f7e77ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x909e=['body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','sendStatus','error','name','send','index','map','SmsTransferReport','fieldName','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create'];(function(_0x3d5df9,_0x5b3623){var _0x50ba39=function(_0x3c0de0){while(--_0x3c0de0){_0x3d5df9['push'](_0x3d5df9['shift']());}};_0x50ba39(++_0x5b3623);}(_0x909e,0x174));var _0xe909=function(_0x257594,_0x1b6333){_0x257594=_0x257594-0x0;var _0x3ed83e=_0x909e[_0x257594];return _0x3ed83e;};'use strict';var emlformat=require(_0xe909('0x0'));var rimraf=require(_0xe909('0x1'));var zipdir=require(_0xe909('0x2'));var jsonpatch=require(_0xe909('0x3'));var rp=require(_0xe909('0x4'));var moment=require('moment');var BPromise=require(_0xe909('0x5'));var Mustache=require(_0xe909('0x6'));var util=require('util');var path=require(_0xe909('0x7'));var sox=require(_0xe909('0x8'));var csv=require(_0xe909('0x9'));var ejs=require(_0xe909('0xa'));var fs=require('fs');var fs_extra=require(_0xe909('0xb'));var _=require(_0xe909('0xc'));var squel=require(_0xe909('0xd'));var crypto=require(_0xe909('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe909('0xf'));var Papa=require(_0xe909('0x10'));var Redis=require(_0xe909('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe909('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe909('0x13'));var logger=require('../../config/logger')(_0xe909('0x14'));var utils=require(_0xe909('0x15'));var config=require(_0xe909('0x16'));var licenseUtil=require(_0xe909('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x443e99,_0x57a30b){_0x57a30b=_0x57a30b||0xcc;return function(_0x446904){if(_0x446904){return _0x443e99['sendStatus'](_0x57a30b);}return _0x443e99['status'](_0x57a30b)[_0xe909('0x18')]();};}function respondWithResult(_0x14fe07,_0x30e6b3){_0x30e6b3=_0x30e6b3||0xc8;return function(_0x33f1e5){if(_0x33f1e5){return _0x14fe07[_0xe909('0x19')](_0x30e6b3)[_0xe909('0x1a')](_0x33f1e5);}};}function respondWithFilteredResult(_0x19dff4,_0x367a0d){return function(_0x583c05){if(_0x583c05){var _0x4df9e4=typeof _0x367a0d[_0xe909('0x1b')]==='undefined'&&typeof _0x367a0d[_0xe909('0x1c')]===_0xe909('0x1d');var _0x55e8a2=_0x583c05[_0xe909('0x1e')];var _0x377873=_0x4df9e4?0x0:_0x367a0d['offset'];var _0x430c25=_0x4df9e4?_0x583c05[_0xe909('0x1e')]:_0x367a0d[_0xe909('0x1b')]+_0x367a0d['limit'];var _0x49789b;if(_0x430c25>=_0x55e8a2){_0x430c25=_0x55e8a2;_0x49789b=0xc8;}else{_0x49789b=0xce;}_0x19dff4[_0xe909('0x19')](_0x49789b);return _0x19dff4[_0xe909('0x1f')]('Content-Range',_0x377873+'-'+_0x430c25+'/'+_0x55e8a2)[_0xe909('0x1a')](_0x583c05);}return null;};}function patchUpdates(_0x312ea){return function(_0x125346){try{jsonpatch[_0xe909('0x20')](_0x125346,_0x312ea,!![]);}catch(_0x4db4dc){return BPromise[_0xe909('0x21')](_0x4db4dc);}return _0x125346['save']();};}function saveUpdates(_0x4463fa,_0x59c6ed){return function(_0x4cd517){if(_0x4cd517){return _0x4cd517[_0xe909('0x22')](_0x4463fa)[_0xe909('0x23')](function(_0x5a5e8e){return _0x5a5e8e;});}return null;};}function removeEntity(_0x1ac4fd,_0x564f44){return function(_0x21e0f5){if(_0x21e0f5){return _0x21e0f5['destroy']()[_0xe909('0x23')](function(){_0x1ac4fd[_0xe909('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfb29a4,_0x184758){return function(_0x17c128){if(!_0x17c128){_0xfb29a4[_0xe909('0x24')](0x194);}return _0x17c128;};}function handleError(_0x4353b1,_0x5b9544){_0x5b9544=_0x5b9544||0x1f4;return function(_0x376646){logger[_0xe909('0x25')](_0x376646['stack']);if(_0x376646[_0xe909('0x26')]){delete _0x376646[_0xe909('0x26')];}_0x4353b1[_0xe909('0x19')](_0x5b9544)[_0xe909('0x27')](_0x376646);};}exports[_0xe909('0x28')]=function(_0x55b31a,_0x3a3049){var _0x45fbf1={},_0xb4d409={},_0x34ae28={'count':0x0,'rows':[]};var _0x5e156a=_[_0xe909('0x29')](db[_0xe909('0x2a')]['rawAttributes'],function(_0x584dc3){return{'name':_0x584dc3[_0xe909('0x2b')],'type':_0x584dc3['type'][_0xe909('0x2c')]};});_0xb4d409[_0xe909('0x2d')]=_[_0xe909('0x29')](_0x5e156a,_0xe909('0x26'));_0xb4d409[_0xe909('0x2e')]=_[_0xe909('0x2f')](_0x55b31a[_0xe909('0x2e')]);_0xb4d409[_0xe909('0x30')]=_['intersection'](_0xb4d409[_0xe909('0x2d')],_0xb4d409['query']);_0x45fbf1['attributes']=_[_0xe909('0x31')](_0xb4d409[_0xe909('0x2d')],qs[_0xe909('0x32')](_0x55b31a[_0xe909('0x2e')][_0xe909('0x32')]));_0x45fbf1[_0xe909('0x33')]=_0x45fbf1[_0xe909('0x33')]['length']?_0x45fbf1[_0xe909('0x33')]:_0xb4d409['model'];if(!_0x55b31a[_0xe909('0x2e')]['hasOwnProperty'](_0xe909('0x34'))){_0x45fbf1['limit']=qs[_0xe909('0x1c')](_0x55b31a['query'][_0xe909('0x1c')]);_0x45fbf1[_0xe909('0x1b')]=qs[_0xe909('0x1b')](_0x55b31a['query'][_0xe909('0x1b')]);}_0x45fbf1['order']=qs[_0xe909('0x35')](_0x55b31a[_0xe909('0x2e')]['sort']);_0x45fbf1[_0xe909('0x36')]=qs['filters'](_[_0xe909('0x37')](_0x55b31a['query'],_0xb4d409['filters']),_0x5e156a);if(_0x55b31a[_0xe909('0x2e')][_0xe909('0x38')]){_0x45fbf1[_0xe909('0x36')]=_[_0xe909('0x39')](_0x45fbf1['where'],{'$or':_['map'](_0x5e156a,function(_0x404416){if(_0x404416[_0xe909('0x3a')]!==_0xe909('0x3b')){var _0x1e5f59={};_0x1e5f59[_0x404416[_0xe909('0x26')]]={'$like':'%'+_0x55b31a[_0xe909('0x2e')]['filter']+'%'};return _0x1e5f59;}})});}_0x45fbf1=_[_0xe909('0x39')]({},_0x45fbf1,_0x55b31a[_0xe909('0x3c')]);var _0x348424={'where':_0x45fbf1[_0xe909('0x36')]};return db[_0xe909('0x2a')]['count'](_0x348424)['then'](function(_0x1fc721){_0x34ae28['count']=_0x1fc721;if(_0x55b31a['query'][_0xe909('0x3d')]){_0x45fbf1[_0xe909('0x3e')]=[{'all':!![]}];}return db[_0xe909('0x2a')][_0xe909('0x3f')](_0x45fbf1);})['then'](function(_0x3efe3a){_0x34ae28[_0xe909('0x40')]=_0x3efe3a;return _0x34ae28;})['then'](respondWithFilteredResult(_0x3a3049,_0x45fbf1))[_0xe909('0x41')](handleError(_0x3a3049,null));};exports[_0xe909('0x42')]=function(_0x309b08,_0x2a50c9){var _0x33dd7f={'raw':!![],'where':{'id':_0x309b08[_0xe909('0x43')]['id']}},_0x5c9ca2={};_0x5c9ca2[_0xe909('0x2d')]=_[_0xe909('0x2f')](db['SmsTransferReport'][_0xe909('0x44')]);_0x5c9ca2['query']=_[_0xe909('0x2f')](_0x309b08[_0xe909('0x2e')]);_0x5c9ca2[_0xe909('0x30')]=_[_0xe909('0x31')](_0x5c9ca2[_0xe909('0x2d')],_0x5c9ca2['query']);_0x33dd7f['attributes']=_[_0xe909('0x31')](_0x5c9ca2[_0xe909('0x2d')],qs[_0xe909('0x32')](_0x309b08[_0xe909('0x2e')][_0xe909('0x32')]));_0x33dd7f[_0xe909('0x33')]=_0x33dd7f[_0xe909('0x33')][_0xe909('0x45')]?_0x33dd7f[_0xe909('0x33')]:_0x5c9ca2[_0xe909('0x2d')];if(_0x309b08[_0xe909('0x2e')][_0xe909('0x3d')]){_0x33dd7f[_0xe909('0x3e')]=[{'all':!![]}];}_0x33dd7f=_['merge']({},_0x33dd7f,_0x309b08[_0xe909('0x3c')]);return db['SmsTransferReport'][_0xe909('0x46')](_0x33dd7f)[_0xe909('0x23')](handleEntityNotFound(_0x2a50c9,null))['then'](respondWithResult(_0x2a50c9,null))['catch'](handleError(_0x2a50c9,null));};exports[_0xe909('0x47')]=function(_0xc22d54,_0x32e5c5){return db[_0xe909('0x2a')][_0xe909('0x47')](_0xc22d54[_0xe909('0x48')],{})[_0xe909('0x23')](respondWithResult(_0x32e5c5,0xc9))['catch'](handleError(_0x32e5c5,null));};exports['update']=function(_0x5005f1,_0x2612dd){if(_0x5005f1[_0xe909('0x48')]['id']){delete _0x5005f1['body']['id'];}return db[_0xe909('0x2a')][_0xe909('0x46')]({'where':{'id':_0x5005f1[_0xe909('0x43')]['id']}})[_0xe909('0x23')](handleEntityNotFound(_0x2612dd,null))[_0xe909('0x23')](saveUpdates(_0x5005f1[_0xe909('0x48')],null))[_0xe909('0x23')](respondWithResult(_0x2612dd,null))[_0xe909('0x41')](handleError(_0x2612dd,null));};exports['destroy']=function(_0xd9b6d5,_0x46426a){return db[_0xe909('0x2a')][_0xe909('0x46')]({'where':{'id':_0xd9b6d5['params']['id']}})['then'](handleEntityNotFound(_0x46426a,null))['then'](removeEntity(_0x46426a,null))[_0xe909('0x41')](handleError(_0x46426a,null));};exports[_0xe909('0x49')]=function(_0x423583,_0x351fd9){return db['SmsTransferReport'][_0xe909('0x49')]()[_0xe909('0x23')](respondWithResult(_0x351fd9,null))[_0xe909('0x41')](handleError(_0x351fd9,null));};
\ No newline at end of file
+var _0x115f=['rows','catch','show','params','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','findAll'];(function(_0x33d124,_0x536de7){var _0x30f108=function(_0x3d7299){while(--_0x3d7299){_0x33d124['push'](_0x33d124['shift']());}};_0x30f108(++_0x536de7);}(_0x115f,0x17d));var _0xf115=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x115f[_0x2b4411];return _0x8e41ef;};'use strict';var emlformat=require(_0xf115('0x0'));var rimraf=require(_0xf115('0x1'));var zipdir=require(_0xf115('0x2'));var jsonpatch=require(_0xf115('0x3'));var rp=require(_0xf115('0x4'));var moment=require(_0xf115('0x5'));var BPromise=require(_0xf115('0x6'));var Mustache=require(_0xf115('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf115('0x8'));var csv=require(_0xf115('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf115('0xa'));var squel=require(_0xf115('0xb'));var crypto=require(_0xf115('0xc'));var jsforce=require(_0xf115('0xd'));var deskjs=require(_0xf115('0xe'));var toCsv=require(_0xf115('0x9'));var querystring=require(_0xf115('0xf'));var Papa=require(_0xf115('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf115('0x11'));var as=require(_0xf115('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf115('0x13'))(_0xf115('0x14'));var utils=require('../../config/utils');var config=require(_0xf115('0x15'));var licenseUtil=require(_0xf115('0x16'));var db=require(_0xf115('0x17'))['db'];function respondWithStatusCode(_0x5288ba,_0x2019f1){_0x2019f1=_0x2019f1||0xcc;return function(_0xc80fa1){if(_0xc80fa1){return _0x5288ba[_0xf115('0x18')](_0x2019f1);}return _0x5288ba[_0xf115('0x19')](_0x2019f1)['end']();};}function respondWithResult(_0x434bf7,_0x38abc7){_0x38abc7=_0x38abc7||0xc8;return function(_0x1c5da4){if(_0x1c5da4){return _0x434bf7[_0xf115('0x19')](_0x38abc7)[_0xf115('0x1a')](_0x1c5da4);}};}function respondWithFilteredResult(_0x211e7f,_0x157c47){return function(_0x37e0f8){if(_0x37e0f8){var _0x399971=typeof _0x157c47[_0xf115('0x1b')]===_0xf115('0x1c')&&typeof _0x157c47[_0xf115('0x1d')]===_0xf115('0x1c');var _0x4722ae=_0x37e0f8[_0xf115('0x1e')];var _0x2787f1=_0x399971?0x0:_0x157c47[_0xf115('0x1b')];var _0x3e764c=_0x399971?_0x37e0f8[_0xf115('0x1e')]:_0x157c47['offset']+_0x157c47[_0xf115('0x1d')];var _0x4b3495;if(_0x3e764c>=_0x4722ae){_0x3e764c=_0x4722ae;_0x4b3495=0xc8;}else{_0x4b3495=0xce;}_0x211e7f['status'](_0x4b3495);return _0x211e7f[_0xf115('0x1f')](_0xf115('0x20'),_0x2787f1+'-'+_0x3e764c+'/'+_0x4722ae)['json'](_0x37e0f8);}return null;};}function patchUpdates(_0x4c4a47){return function(_0x2266bd){try{jsonpatch[_0xf115('0x21')](_0x2266bd,_0x4c4a47,!![]);}catch(_0x58fd5a){return BPromise['reject'](_0x58fd5a);}return _0x2266bd[_0xf115('0x22')]();};}function saveUpdates(_0x462ff0,_0x432d42){return function(_0x3a064b){if(_0x3a064b){return _0x3a064b[_0xf115('0x23')](_0x462ff0)[_0xf115('0x24')](function(_0x1cc74c){return _0x1cc74c;});}return null;};}function removeEntity(_0x42a7ee,_0x3d0434){return function(_0x2256d8){if(_0x2256d8){return _0x2256d8[_0xf115('0x25')]()[_0xf115('0x24')](function(){_0x42a7ee[_0xf115('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x976283,_0x5375d1){return function(_0x1c5138){if(!_0x1c5138){_0x976283[_0xf115('0x18')](0x194);}return _0x1c5138;};}function handleError(_0xfd5996,_0x2cf839){_0x2cf839=_0x2cf839||0x1f4;return function(_0x1c273f){logger['error'](_0x1c273f[_0xf115('0x26')]);if(_0x1c273f[_0xf115('0x27')]){delete _0x1c273f[_0xf115('0x27')];}_0xfd5996[_0xf115('0x19')](_0x2cf839)[_0xf115('0x28')](_0x1c273f);};}exports[_0xf115('0x29')]=function(_0x5677b,_0x28ffd9){var _0x58ad15={},_0x153ac6={},_0x3c80de={'count':0x0,'rows':[]};var _0x2ba8d1=_[_0xf115('0x2a')](db[_0xf115('0x2b')]['rawAttributes'],function(_0x47340e){return{'name':_0x47340e[_0xf115('0x2c')],'type':_0x47340e[_0xf115('0x2d')][_0xf115('0x2e')]};});_0x153ac6[_0xf115('0x2f')]=_[_0xf115('0x2a')](_0x2ba8d1,_0xf115('0x27'));_0x153ac6['query']=_[_0xf115('0x30')](_0x5677b[_0xf115('0x31')]);_0x153ac6[_0xf115('0x32')]=_[_0xf115('0x33')](_0x153ac6[_0xf115('0x2f')],_0x153ac6['query']);_0x58ad15[_0xf115('0x34')]=_[_0xf115('0x33')](_0x153ac6[_0xf115('0x2f')],qs[_0xf115('0x35')](_0x5677b['query'][_0xf115('0x35')]));_0x58ad15[_0xf115('0x34')]=_0x58ad15['attributes']['length']?_0x58ad15[_0xf115('0x34')]:_0x153ac6[_0xf115('0x2f')];if(!_0x5677b[_0xf115('0x31')][_0xf115('0x36')](_0xf115('0x37'))){_0x58ad15[_0xf115('0x1d')]=qs['limit'](_0x5677b[_0xf115('0x31')][_0xf115('0x1d')]);_0x58ad15[_0xf115('0x1b')]=qs[_0xf115('0x1b')](_0x5677b[_0xf115('0x31')][_0xf115('0x1b')]);}_0x58ad15[_0xf115('0x38')]=qs[_0xf115('0x39')](_0x5677b[_0xf115('0x31')][_0xf115('0x39')]);_0x58ad15['where']=qs[_0xf115('0x32')](_['pick'](_0x5677b[_0xf115('0x31')],_0x153ac6[_0xf115('0x32')]),_0x2ba8d1);if(_0x5677b[_0xf115('0x31')][_0xf115('0x3a')]){_0x58ad15[_0xf115('0x3b')]=_[_0xf115('0x3c')](_0x58ad15[_0xf115('0x3b')],{'$or':_['map'](_0x2ba8d1,function(_0x27b222){if(_0x27b222['type']!==_0xf115('0x3d')){var _0x3e62d8={};_0x3e62d8[_0x27b222[_0xf115('0x27')]]={'$like':'%'+_0x5677b[_0xf115('0x31')]['filter']+'%'};return _0x3e62d8;}})});}_0x58ad15=_[_0xf115('0x3c')]({},_0x58ad15,_0x5677b['options']);var _0x4dc4e1={'where':_0x58ad15[_0xf115('0x3b')]};return db[_0xf115('0x2b')][_0xf115('0x1e')](_0x4dc4e1)[_0xf115('0x24')](function(_0x1f476a){_0x3c80de['count']=_0x1f476a;if(_0x5677b[_0xf115('0x31')]['includeAll']){_0x58ad15['include']=[{'all':!![]}];}return db[_0xf115('0x2b')][_0xf115('0x3e')](_0x58ad15);})[_0xf115('0x24')](function(_0x3180b9){_0x3c80de[_0xf115('0x3f')]=_0x3180b9;return _0x3c80de;})['then'](respondWithFilteredResult(_0x28ffd9,_0x58ad15))[_0xf115('0x40')](handleError(_0x28ffd9,null));};exports[_0xf115('0x41')]=function(_0x18eb87,_0x11e006){var _0x4baf9b={'raw':!![],'where':{'id':_0x18eb87[_0xf115('0x42')]['id']}},_0x20880c={};_0x20880c['model']=_[_0xf115('0x30')](db[_0xf115('0x2b')]['rawAttributes']);_0x20880c[_0xf115('0x31')]=_[_0xf115('0x30')](_0x18eb87[_0xf115('0x31')]);_0x20880c[_0xf115('0x32')]=_[_0xf115('0x33')](_0x20880c[_0xf115('0x2f')],_0x20880c[_0xf115('0x31')]);_0x4baf9b['attributes']=_['intersection'](_0x20880c['model'],qs['fields'](_0x18eb87['query'][_0xf115('0x35')]));_0x4baf9b[_0xf115('0x34')]=_0x4baf9b['attributes'][_0xf115('0x43')]?_0x4baf9b[_0xf115('0x34')]:_0x20880c['model'];if(_0x18eb87[_0xf115('0x31')][_0xf115('0x44')]){_0x4baf9b[_0xf115('0x45')]=[{'all':!![]}];}_0x4baf9b=_[_0xf115('0x3c')]({},_0x4baf9b,_0x18eb87['options']);return db[_0xf115('0x2b')][_0xf115('0x46')](_0x4baf9b)['then'](handleEntityNotFound(_0x11e006,null))[_0xf115('0x24')](respondWithResult(_0x11e006,null))[_0xf115('0x40')](handleError(_0x11e006,null));};exports[_0xf115('0x47')]=function(_0x11f915,_0x55cacf){return db[_0xf115('0x2b')][_0xf115('0x47')](_0x11f915[_0xf115('0x48')],{})[_0xf115('0x24')](respondWithResult(_0x55cacf,0xc9))[_0xf115('0x40')](handleError(_0x55cacf,null));};exports['update']=function(_0x90625e,_0x34d13b){if(_0x90625e[_0xf115('0x48')]['id']){delete _0x90625e[_0xf115('0x48')]['id'];}return db[_0xf115('0x2b')]['find']({'where':{'id':_0x90625e[_0xf115('0x42')]['id']}})[_0xf115('0x24')](handleEntityNotFound(_0x34d13b,null))[_0xf115('0x24')](saveUpdates(_0x90625e[_0xf115('0x48')],null))['then'](respondWithResult(_0x34d13b,null))[_0xf115('0x40')](handleError(_0x34d13b,null));};exports[_0xf115('0x25')]=function(_0x3cf69d,_0x1f0905){return db['SmsTransferReport'][_0xf115('0x46')]({'where':{'id':_0x3cf69d[_0xf115('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f0905,null))[_0xf115('0x24')](removeEntity(_0x1f0905,null))[_0xf115('0x40')](handleError(_0x1f0905,null));};exports[_0xf115('0x49')]=function(_0x27511f,_0x2b4bf2){return db['SmsTransferReport'][_0xf115('0x49')]()[_0xf115('0x24')](respondWithResult(_0x2b4bf2,null))[_0xf115('0x40')](handleError(_0x2b4bf2,null));};
\ No newline at end of file
index 61e2dfc..318b189 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1625=['../../config/logger','moment','bluebird','request-promise','rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0xa22054,_0x464303){var _0x4bee13=function(_0x26b6d7){while(--_0x26b6d7){_0xa22054['push'](_0xa22054['shift']());}};_0x4bee13(++_0x464303);}(_0x1625,0xa7));var _0x5162=function(_0x164c1d,_0x3efb96){_0x164c1d=_0x164c1d-0x0;var _0x10e323=_0x1625[_0x164c1d];return _0x10e323;};'use strict';var _=require(_0x5162('0x0'));var util=require('util');var logger=require(_0x5162('0x1'))('api');var moment=require(_0x5162('0x2'));var BPromise=require(_0x5162('0x3'));var rp=require(_0x5162('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5162('0x5'));var config=require('../../config/environment');var attributes=require(_0x5162('0x6'));module[_0x5162('0x7')]=function(_0x46a175,_0x4fdff8){return _0x46a175[_0x5162('0x8')](_0x5162('0x9'),attributes,{'tableName':_0x5162('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5162('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x3685=['rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4e4a90,_0x3bb089){var _0x4a6b89=function(_0x367eb1){while(--_0x367eb1){_0x4e4a90['push'](_0x4e4a90['shift']());}};_0x4a6b89(++_0x3bb089);}(_0x3685,0xf8));var _0x5368=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3685[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x5368('0x0'));var util=require('util');var logger=require(_0x5368('0x1'))(_0x5368('0x2'));var moment=require(_0x5368('0x3'));var BPromise=require(_0x5368('0x4'));var rp=require(_0x5368('0x5'));var fs=require('fs');var path=require(_0x5368('0x6'));var rimraf=require(_0x5368('0x7'));var config=require(_0x5368('0x8'));var attributes=require(_0x5368('0x9'));module[_0x5368('0xa')]=function(_0x4fc6ed,_0x1a4450){return _0x4fc6ed[_0x5368('0xb')](_0x5368('0xc'),attributes,{'tableName':_0x5368('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5368('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
index 3ad6744..a9bd42d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0bb=['debug','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0xb56e51,_0x3c688c){var _0x321d95=function(_0x3d90b8){while(--_0x3d90b8){_0xb56e51['push'](_0xb56e51['shift']());}};_0x321d95(++_0x3c688c);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x216494,_0x21a0b4){_0x216494=_0x216494-0x0;var _0x3fce22=_0xd0bb[_0x216494];return _0x3fce22;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var moment=require(_0xbd0b('0x2'));var BPromise=require('bluebird');var rs=require(_0xbd0b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbd0b('0x4'))['db'];var utils=require(_0xbd0b('0x5'));var logger=require('../../config/logger')(_0xbd0b('0x6'));var config=require('../../config/environment');var jayson=require(_0xbd0b('0x7'));var client=jayson[_0xbd0b('0x8')][_0xbd0b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37c205,_0x809599,_0x5eb975){return new BPromise(function(_0x2a4075,_0x4533ff){return client[_0xbd0b('0xa')](_0x37c205,_0x5eb975)[_0xbd0b('0xb')](function(_0x16e185){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'));logger[_0xbd0b('0xd')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x809599,_0xbd0b('0xc'),JSON[_0xbd0b('0xe')](_0x16e185));if(_0x16e185['error']){if(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x10')]===0x1f4){logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);return _0x4533ff(_0x16e185[_0xbd0b('0xf')][_0xbd0b('0x12')]);}logger[_0xbd0b('0xf')](_0xbd0b('0x11'),_0x809599,_0x16e185[_0xbd0b('0xf')]['message']);return _0x2a4075(_0x16e185[_0xbd0b('0xf')]['message']);}else{logger['info'](_0xbd0b('0x11'),_0x809599,_0xbd0b('0xc'));_0x2a4075(_0x16e185[_0xbd0b('0x13')][_0xbd0b('0x12')]);}})[_0xbd0b('0x14')](function(_0x546db3){logger['error'](_0xbd0b('0x11'),_0x809599,_0x546db3);_0x4533ff(_0x546db3);});});}
\ No newline at end of file
+var _0xf23b=['SmsTransferReport,\x20%s,\x20%s','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x526b9b,_0x16dc98){var _0x5618e6=function(_0x31283c){while(--_0x31283c){_0x526b9b['push'](_0x526b9b['shift']());}};_0x5618e6(++_0x16dc98);}(_0xf23b,0x133));var _0xbf23=function(_0x323e02,_0x2b1ac6){_0x323e02=_0x323e02-0x0;var _0x1a9772=_0xf23b[_0x323e02];return _0x1a9772;};'use strict';var _=require(_0xbf23('0x0'));var util=require(_0xbf23('0x1'));var moment=require(_0xbf23('0x2'));var BPromise=require(_0xbf23('0x3'));var rs=require(_0xbf23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf23('0x5'))['db'];var utils=require(_0xbf23('0x6'));var logger=require(_0xbf23('0x7'))('rpc');var config=require(_0xbf23('0x8'));var jayson=require(_0xbf23('0x9'));var client=jayson[_0xbf23('0xa')][_0xbf23('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18857b,_0x4c0869,_0x4b5e1e){return new BPromise(function(_0x41b721,_0x486c02){return client[_0xbf23('0xc')](_0x18857b,_0x4b5e1e)[_0xbf23('0xd')](function(_0x378d37){logger[_0xbf23('0xe')](_0xbf23('0xf'),_0x4c0869,'request\x20sent');logger[_0xbf23('0x10')](_0xbf23('0x11'),_0x4c0869,_0xbf23('0x12'),JSON[_0xbf23('0x13')](_0x378d37));if(_0x378d37[_0xbf23('0x14')]){if(_0x378d37[_0xbf23('0x14')]['code']===0x1f4){logger[_0xbf23('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4c0869,_0x378d37[_0xbf23('0x14')]['message']);return _0x486c02(_0x378d37[_0xbf23('0x14')][_0xbf23('0x15')]);}logger['error'](_0xbf23('0xf'),_0x4c0869,_0x378d37['error']['message']);return _0x41b721(_0x378d37[_0xbf23('0x14')][_0xbf23('0x15')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x4c0869,_0xbf23('0x12'));_0x41b721(_0x378d37['result'][_0xbf23('0x15')]);}})[_0xbf23('0x16')](function(_0x3e3575){logger[_0xbf23('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x4c0869,_0x3e3575);_0x486c02(_0x3e3575);});});}
\ No newline at end of file
index 473cab0..eb745d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x806c=['update','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','download','diskStorage','root','originalname','extname','now','single','create'];(function(_0x47f21d,_0x29498c){var _0x3f2a9b=function(_0x545568){while(--_0x545568){_0x47f21d['push'](_0x47f21d['shift']());}};_0x3f2a9b(++_0x29498c);}(_0x806c,0x189));var _0xc806=function(_0x146a85,_0x529b52){_0x146a85=_0x146a85-0x0;var _0x1b59bf=_0x806c[_0x146a85];return _0x1b59bf;};'use strict';var multer=require(_0xc806('0x0'));var util=require('util');var path=require(_0xc806('0x1'));var timeout=require(_0xc806('0x2'));var express=require(_0xc806('0x3'));var router=express[_0xc806('0x4')]();var fs_extra=require(_0xc806('0x5'));var auth=require(_0xc806('0x6'));var interaction=require(_0xc806('0x7'));var config=require(_0xc806('0x8'));var controller=require(_0xc806('0x9'));router[_0xc806('0xa')]('/',auth[_0xc806('0xb')](),controller[_0xc806('0xc')]);router['get'](_0xc806('0xd'),auth[_0xc806('0xb')](),controller[_0xc806('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xc806('0xf')]);var upload=multer({'storage':multer[_0xc806('0x10')]({'destination':function(_0x36c0be,_0x13ce83,_0x418abb){_0x418abb(null,path['join'](config[_0xc806('0x11')],'server/files/sounds/original/'));},'filename':function(_0x59c7f8,_0x1374da,_0x432cf0){_0x1374da[_0xc806('0x12')]=_0x1374da[_0xc806('0x12')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x432cf0(null,util['format']('%s-%s%s',path['basename'](_0x1374da[_0xc806('0x12')],path[_0xc806('0x13')](_0x1374da[_0xc806('0x12')])),Date[_0xc806('0x14')](),path[_0xc806('0x13')](_0x1374da[_0xc806('0x12')])));}})});router['post']('/',upload[_0xc806('0x15')]('file'),controller[_0xc806('0x16')]);router['put']('/:id',auth[_0xc806('0xb')](),controller[_0xc806('0x17')]);router[_0xc806('0x18')](_0xc806('0xd'),auth[_0xc806('0xb')](),controller[_0xc806('0x18')]);module[_0xc806('0x19')]=router;
\ No newline at end of file
+var _0xb18d=['get','isAuthenticated','index','show','/:id/download','join','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','post','file','create','/:id','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./sound.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb18d,0x17e));var _0xdb18=function(_0x37bd25,_0x3d52c1){_0x37bd25=_0x37bd25-0x0;var _0x1142f4=_0xb18d[_0x37bd25];return _0x1142f4;};'use strict';var multer=require(_0xdb18('0x0'));var util=require(_0xdb18('0x1'));var path=require(_0xdb18('0x2'));var timeout=require(_0xdb18('0x3'));var express=require(_0xdb18('0x4'));var router=express[_0xdb18('0x5')]();var fs_extra=require(_0xdb18('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xdb18('0x7'));var config=require(_0xdb18('0x8'));var controller=require(_0xdb18('0x9'));router[_0xdb18('0xa')]('/',auth[_0xdb18('0xb')](),controller[_0xdb18('0xc')]);router[_0xdb18('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xdb18('0xd')]);router['get'](_0xdb18('0xe'),auth[_0xdb18('0xb')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4a74cd,_0x5ce3a4,_0x36ab7a){_0x36ab7a(null,path[_0xdb18('0xf')](config[_0xdb18('0x10')],_0xdb18('0x11')));},'filename':function(_0x326acf,_0xc33497,_0x52378a){_0xc33497[_0xdb18('0x12')]=_0xc33497[_0xdb18('0x12')][_0xdb18('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x52378a(null,util[_0xdb18('0x14')](_0xdb18('0x15'),path[_0xdb18('0x16')](_0xc33497[_0xdb18('0x12')],path['extname'](_0xc33497[_0xdb18('0x12')])),Date['now'](),path['extname'](_0xc33497[_0xdb18('0x12')])));}})});router[_0xdb18('0x17')]('/',upload['single'](_0xdb18('0x18')),controller[_0xdb18('0x19')]);router['put'](_0xdb18('0x1a'),auth[_0xdb18('0xb')](),controller['update']);router[_0xdb18('0x1b')](_0xdb18('0x1a'),auth[_0xdb18('0xb')](),controller[_0xdb18('0x1b')]);module['exports']=router;
\ No newline at end of file
index 1295bea..78e79e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x01e3=['BIGINT','INTEGER','FLOAT','sequelize','exports','STRING','name'];(function(_0x103efb,_0x2a0a30){var _0x5df1ad=function(_0x546374){while(--_0x546374){_0x103efb['push'](_0x103efb['shift']());}};_0x5df1ad(++_0x2a0a30);}(_0x01e3,0x122));var _0x301e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x01e3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x301e('0x0'));module[_0x301e('0x1')]={'name':{'type':Sequelize[_0x301e('0x2')],'unique':_0x301e('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x301e('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x301e('0x2')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x301e('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x301e('0x4')]},'original_sampleRate':{'type':Sequelize[_0x301e('0x5')]},'converted_format':{'type':Sequelize[_0x301e('0x2')]},'converted_duration':{'type':Sequelize[_0x301e('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x301e('0x5')]},'converted_bitRate':{'type':Sequelize[_0x301e('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x301e('0x5')]}};
\ No newline at end of file
+var _0x3ffb=['BIGINT','INTEGER','sequelize','STRING','FLOAT'];(function(_0x361e5d,_0x15e1a4){var _0x4c303d=function(_0x504f9f){while(--_0x504f9f){_0x361e5d['push'](_0x361e5d['shift']());}};_0x4c303d(++_0x15e1a4);}(_0x3ffb,0xfc));var _0xb3ff=function(_0x5d0a55,_0x56a92f){_0x5d0a55=_0x5d0a55-0x0;var _0x53ad00=_0x3ffb[_0x5d0a55];return _0x53ad00;};'use strict';var Sequelize=require(_0xb3ff('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0xb3ff('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xb3ff('0x1')]},'original_duration':{'type':Sequelize[_0xb3ff('0x2')]},'original_sampleCount':{'type':Sequelize[_0xb3ff('0x3')]},'original_channelCount':{'type':Sequelize[_0xb3ff('0x4')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0xb3ff('0x4')]},'converted_format':{'type':Sequelize[_0xb3ff('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0xb3ff('0x3')]},'converted_channelCount':{'type':Sequelize[_0xb3ff('0x4')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0xb3ff('0x4')]}};
\ No newline at end of file
index 56f81cf..da82cd2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6b11=['create','body','userProfileId','role','user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','Sounds','UserProfileResource','stack','name','Sound','type','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','keys','include','find','params','save_name','existsSync','join','root','server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','download','%s.%s','basename','file','extname','originalname','filename','substring','wav','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','error','unlinkSync','send','src','duration','sampleCount','original_channelCount','channelCount','bitRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6b11,0x87));var _0x16b1=function(_0x5235dd,_0x3f91cf){_0x5235dd=_0x5235dd-0x0;var _0x13059d=_0x6b11[_0x5235dd];return _0x13059d;};'use strict';var emlformat=require(_0x16b1('0x0'));var rimraf=require(_0x16b1('0x1'));var zipdir=require(_0x16b1('0x2'));var jsonpatch=require(_0x16b1('0x3'));var rp=require(_0x16b1('0x4'));var moment=require(_0x16b1('0x5'));var BPromise=require(_0x16b1('0x6'));var Mustache=require(_0x16b1('0x7'));var util=require(_0x16b1('0x8'));var path=require(_0x16b1('0x9'));var sox=require('sox');var csv=require(_0x16b1('0xa'));var ejs=require(_0x16b1('0xb'));var fs=require('fs');var fs_extra=require(_0x16b1('0xc'));var _=require(_0x16b1('0xd'));var squel=require(_0x16b1('0xe'));var crypto=require(_0x16b1('0xf'));var jsforce=require(_0x16b1('0x10'));var deskjs=require(_0x16b1('0x11'));var toCsv=require(_0x16b1('0xa'));var querystring=require('querystring');var Papa=require(_0x16b1('0x12'));var Redis=require('ioredis');var authService=require(_0x16b1('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16b1('0x14'));var logger=require(_0x16b1('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x16b1('0x16'));var licenseUtil=require(_0x16b1('0x17'));var db=require(_0x16b1('0x18'))['db'];function respondWithStatusCode(_0x315c1b,_0x583368){_0x583368=_0x583368||0xcc;return function(_0x1c9535){if(_0x1c9535){return _0x315c1b[_0x16b1('0x19')](_0x583368);}return _0x315c1b[_0x16b1('0x1a')](_0x583368)[_0x16b1('0x1b')]();};}function respondWithResult(_0x17a5ed,_0x2cefbc){_0x2cefbc=_0x2cefbc||0xc8;return function(_0x423882){if(_0x423882){return _0x17a5ed[_0x16b1('0x1a')](_0x2cefbc)[_0x16b1('0x1c')](_0x423882);}};}function respondWithFilteredResult(_0xfccc17,_0x4d4d3f){return function(_0x2c5940){if(_0x2c5940){var _0xefe2ad=typeof _0x4d4d3f['offset']===_0x16b1('0x1d')&&typeof _0x4d4d3f[_0x16b1('0x1e')]===_0x16b1('0x1d');var _0x281a16=_0x2c5940['count'];var _0x4325b6=_0xefe2ad?0x0:_0x4d4d3f['offset'];var _0x515e89=_0xefe2ad?_0x2c5940[_0x16b1('0x1f')]:_0x4d4d3f['offset']+_0x4d4d3f[_0x16b1('0x1e')];var _0x880d06;if(_0x515e89>=_0x281a16){_0x515e89=_0x281a16;_0x880d06=0xc8;}else{_0x880d06=0xce;}_0xfccc17[_0x16b1('0x1a')](_0x880d06);return _0xfccc17['set'](_0x16b1('0x20'),_0x4325b6+'-'+_0x515e89+'/'+_0x281a16)['json'](_0x2c5940);}return null;};}function patchUpdates(_0xa3d98a){return function(_0x1d2cb0){try{jsonpatch[_0x16b1('0x21')](_0x1d2cb0,_0xa3d98a,!![]);}catch(_0xb43c2){return BPromise[_0x16b1('0x22')](_0xb43c2);}return _0x1d2cb0['save']();};}function saveUpdates(_0x320e60,_0x5de90a){return function(_0x516a73){if(_0x516a73){return _0x516a73[_0x16b1('0x23')](_0x320e60)[_0x16b1('0x24')](function(_0x2924f9){return _0x2924f9;});}return null;};}function removeEntity(_0xae13df,_0x30c65b){return function(_0x1056d7){if(_0x1056d7){return _0x1056d7[_0x16b1('0x25')]()[_0x16b1('0x24')](function(){var _0x535237=_0x1056d7['get']({'plain':!![]});var _0x11c969=_0x16b1('0x26');return db[_0x16b1('0x27')][_0x16b1('0x25')]({'where':{'type':_0x11c969,'resourceId':_0x535237['id']}})[_0x16b1('0x24')](function(){return _0x1056d7;});})[_0x16b1('0x24')](function(){_0xae13df[_0x16b1('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x206ab8,_0x594af4){return function(_0x59174e){if(!_0x59174e){_0x206ab8['sendStatus'](0x194);}return _0x59174e;};}function handleError(_0x42183d,_0x4147b5){_0x4147b5=_0x4147b5||0x1f4;return function(_0x821e38){logger['error'](_0x821e38[_0x16b1('0x28')]);if(_0x821e38[_0x16b1('0x29')]){delete _0x821e38[_0x16b1('0x29')];}_0x42183d[_0x16b1('0x1a')](_0x4147b5)['send'](_0x821e38);};}exports['index']=function(_0x2e4f89,_0x45cedc){var _0x3a51eb={},_0x202b9={},_0x193859={'count':0x0,'rows':[]};var _0x248806=_['map'](db[_0x16b1('0x2a')]['rawAttributes'],function(_0x3aafd4){return{'name':_0x3aafd4['fieldName'],'type':_0x3aafd4[_0x16b1('0x2b')][_0x16b1('0x2c')]};});_0x202b9['model']=_[_0x16b1('0x2d')](_0x248806,_0x16b1('0x29'));_0x202b9[_0x16b1('0x2e')]=_['keys'](_0x2e4f89[_0x16b1('0x2e')]);_0x202b9[_0x16b1('0x2f')]=_[_0x16b1('0x30')](_0x202b9['model'],_0x202b9[_0x16b1('0x2e')]);_0x3a51eb['attributes']=_[_0x16b1('0x30')](_0x202b9[_0x16b1('0x31')],qs[_0x16b1('0x32')](_0x2e4f89[_0x16b1('0x2e')]['fields']));_0x3a51eb['attributes']=_0x3a51eb[_0x16b1('0x33')][_0x16b1('0x34')]?_0x3a51eb['attributes']:_0x202b9[_0x16b1('0x31')];if(!_0x2e4f89[_0x16b1('0x2e')][_0x16b1('0x35')]('nolimit')){_0x3a51eb[_0x16b1('0x1e')]=qs['limit'](_0x2e4f89[_0x16b1('0x2e')][_0x16b1('0x1e')]);_0x3a51eb[_0x16b1('0x36')]=qs['offset'](_0x2e4f89[_0x16b1('0x2e')][_0x16b1('0x36')]);}_0x3a51eb[_0x16b1('0x37')]=qs[_0x16b1('0x38')](_0x2e4f89[_0x16b1('0x2e')]['sort']);_0x3a51eb[_0x16b1('0x39')]=qs[_0x16b1('0x2f')](_[_0x16b1('0x3a')](_0x2e4f89[_0x16b1('0x2e')],_0x202b9[_0x16b1('0x2f')]),_0x248806);if(_0x2e4f89['query'][_0x16b1('0x3b')]){_0x3a51eb[_0x16b1('0x39')]=_[_0x16b1('0x3c')](_0x3a51eb[_0x16b1('0x39')],{'$or':_[_0x16b1('0x2d')](_0x248806,function(_0xb8e05d){if(_0xb8e05d['type']!=='VIRTUAL'){var _0x52da14={};_0x52da14[_0xb8e05d[_0x16b1('0x29')]]={'$like':'%'+_0x2e4f89['query'][_0x16b1('0x3b')]+'%'};return _0x52da14;}})});}_0x3a51eb=_['merge']({},_0x3a51eb,_0x2e4f89[_0x16b1('0x3d')]);var _0x5a4036={'where':_0x3a51eb['where']};return db[_0x16b1('0x2a')][_0x16b1('0x1f')](_0x5a4036)[_0x16b1('0x24')](function(_0x2d77e6){_0x193859['count']=_0x2d77e6;if(_0x2e4f89[_0x16b1('0x2e')][_0x16b1('0x3e')]){_0x3a51eb['include']=[{'all':!![]}];}return db['Sound'][_0x16b1('0x3f')](_0x3a51eb);})['then'](function(_0x59e5f5){_0x193859['rows']=_0x59e5f5;return _0x193859;})[_0x16b1('0x24')](respondWithFilteredResult(_0x45cedc,_0x3a51eb))[_0x16b1('0x40')](handleError(_0x45cedc,null));};exports[_0x16b1('0x41')]=function(_0x22cce2,_0x5ca1dd){var _0x4f24e7={'raw':!![],'where':{'id':_0x22cce2['params']['id']}},_0x423d73={};_0x423d73[_0x16b1('0x31')]=_[_0x16b1('0x42')](db[_0x16b1('0x2a')]['rawAttributes']);_0x423d73[_0x16b1('0x2e')]=_[_0x16b1('0x42')](_0x22cce2[_0x16b1('0x2e')]);_0x423d73['filters']=_[_0x16b1('0x30')](_0x423d73['model'],_0x423d73[_0x16b1('0x2e')]);_0x4f24e7[_0x16b1('0x33')]=_[_0x16b1('0x30')](_0x423d73['model'],qs['fields'](_0x22cce2['query'][_0x16b1('0x32')]));_0x4f24e7[_0x16b1('0x33')]=_0x4f24e7[_0x16b1('0x33')][_0x16b1('0x34')]?_0x4f24e7[_0x16b1('0x33')]:_0x423d73[_0x16b1('0x31')];if(_0x22cce2[_0x16b1('0x2e')][_0x16b1('0x3e')]){_0x4f24e7[_0x16b1('0x43')]=[{'all':!![]}];}_0x4f24e7=_[_0x16b1('0x3c')]({},_0x4f24e7,_0x22cce2['options']);return db[_0x16b1('0x2a')][_0x16b1('0x44')](_0x4f24e7)[_0x16b1('0x24')](handleEntityNotFound(_0x5ca1dd,null))[_0x16b1('0x24')](respondWithResult(_0x5ca1dd,null))[_0x16b1('0x40')](handleError(_0x5ca1dd,null));};exports['download']=function(_0x49d69a,_0x255c08,_0x2a8c26){return db[_0x16b1('0x2a')][_0x16b1('0x44')]({'where':{'id':_0x49d69a[_0x16b1('0x45')]['id']},'attributes':[_0x16b1('0x29'),_0x16b1('0x46'),'converted_format'],'raw':!![]})[_0x16b1('0x24')](handleEntityNotFound(_0x255c08,null))['then'](function(_0x2fdfeb){if(_0x2fdfeb){if(!fs[_0x16b1('0x47')](path[_0x16b1('0x48')](config[_0x16b1('0x49')],_0x16b1('0x4a'),_0x2fdfeb['save_name']+'.'+_0x2fdfeb[_0x16b1('0x4b')]))){throw new db[(_0x16b1('0x4c'))][(_0x16b1('0x4d'))](_0x16b1('0x4e'));}return _0x255c08[_0x16b1('0x4f')](path['join'](config[_0x16b1('0x49')],_0x16b1('0x4a'),util['format'](_0x16b1('0x50'),_0x2fdfeb[_0x16b1('0x46')],_0x2fdfeb[_0x16b1('0x4b')])),util['format'](_0x16b1('0x50'),_0x2fdfeb['name'],_0x2fdfeb[_0x16b1('0x4b')]));}return null;})[_0x16b1('0x40')](handleError(_0x255c08,null));};exports['create']=function(_0xa02dfb,_0x173fa3,_0x55dcc5){var _0x350674={'name':path[_0x16b1('0x51')](_0xa02dfb[_0x16b1('0x52')]['originalname'],path[_0x16b1('0x53')](_0xa02dfb[_0x16b1('0x52')][_0x16b1('0x54')])),'save_name':path[_0x16b1('0x51')](_0xa02dfb['file'][_0x16b1('0x55')],path[_0x16b1('0x53')](_0xa02dfb['file'][_0x16b1('0x55')])),'original_format':path['extname'](_0xa02dfb['file'][_0x16b1('0x54')])[_0x16b1('0x56')](0x1),'converted_format':_0x16b1('0x57')};var _0x234d1f=path[_0x16b1('0x48')](config['root'],_0x16b1('0x58'),_0xa02dfb['file'][_0x16b1('0x55')]);var _0x521dba=path[_0x16b1('0x48')](config[_0x16b1('0x49')],'server/files/sounds/converted',util[_0x16b1('0x59')]('%s.%s',path['basename'](_0xa02dfb[_0x16b1('0x52')]['filename'],path[_0x16b1('0x53')](_0xa02dfb[_0x16b1('0x52')][_0x16b1('0x55')])),_0x350674['converted_format']));logger[_0x16b1('0x5a')](_0x16b1('0x5b'),_0x234d1f);logger[_0x16b1('0x5a')](_0x16b1('0x5c'),_0x521dba);try{fs[_0x16b1('0x5d')](_0x234d1f,parseInt('0777',0x8));var _0xcdc829=sox[_0x16b1('0x5e')](_0x234d1f,_0x521dba,{'sampleRate':0x1f40,'format':_0x16b1('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0xcdc829['on'](_0x16b1('0x5f'),function(_0x5d965b){fs[_0x16b1('0x60')](_0x234d1f);_0x173fa3[_0x16b1('0x1a')](0x1f4)[_0x16b1('0x61')](_0x5d965b);});_0xcdc829['on'](_0x16b1('0x62'),function(_0x140315){_0x350674['original_duration']=isNaN(_0x140315['duration'])?null:_0x140315[_0x16b1('0x63')]*0x3e8;_0x350674['original_sampleCount']=isNaN(_0x140315[_0x16b1('0x64')])?null:_0x140315['sampleCount'];_0x350674[_0x16b1('0x65')]=isNaN(_0x140315[_0x16b1('0x66')])?null:_0x140315[_0x16b1('0x66')];_0x350674['original_bitRate']=isNaN(_0x140315[_0x16b1('0x67')])?null:_0x140315[_0x16b1('0x67')];_0x350674['original_sampleRate']=isNaN(_0x140315[_0x16b1('0x68')])?null:_0x140315[_0x16b1('0x68')];});_0xcdc829['on'](_0x16b1('0x69'),function(_0x275136){_0x350674[_0x16b1('0x6a')]=isNaN(_0x275136['duration'])?null:_0x275136[_0x16b1('0x63')]*0x3e8;_0x350674[_0x16b1('0x6b')]=isNaN(_0x275136['sampleCount'])?null:_0x275136[_0x16b1('0x64')];_0x350674[_0x16b1('0x6c')]=isNaN(_0x275136[_0x16b1('0x66')])?null:_0x275136[_0x16b1('0x66')];_0x350674[_0x16b1('0x6d')]=isNaN(_0x275136[_0x16b1('0x67')])?null:_0x275136['bitRate'];_0x350674[_0x16b1('0x6e')]=isNaN(_0x275136[_0x16b1('0x68')])?null:_0x275136[_0x16b1('0x68')];});_0xcdc829['on'](_0x16b1('0x1b'),function(){fs['chmodSync'](_0x521dba,parseInt('0777',0x8));return db['Sound'][_0x16b1('0x6f')](_0x350674)[_0x16b1('0x24')](function(_0x5db9b9){var _0x23239a={'role':_0xa02dfb[_0x16b1('0x70')]['role'],'userProfileId':_0xa02dfb['body'][_0x16b1('0x71')]};if(!_0x23239a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23239a[_0x16b1('0x72')]===_0x16b1('0x73')){var _0x52c812=_0x5db9b9[_0x16b1('0x74')]({'plain':!![]});return db[_0x16b1('0x75')]['find']({'where':{'name':_0x16b1('0x26'),'userProfileId':_0x23239a[_0x16b1('0x71')]},'raw':!![]})[_0x16b1('0x24')](function(_0x35d8c2){if(_0x35d8c2&&_0x35d8c2[_0x16b1('0x76')]===0x0){return db[_0x16b1('0x27')][_0x16b1('0x6f')]({'name':_0x52c812[_0x16b1('0x29')],'resourceId':_0x52c812['id'],'type':_0x35d8c2[_0x16b1('0x29')],'sectionId':_0x35d8c2['id']},{})[_0x16b1('0x24')](function(){return _0x5db9b9;});}else{return _0x5db9b9;}})['catch'](function(_0x33979c){logger[_0x16b1('0x5f')](_0x16b1('0x77'),_0x33979c);throw _0x33979c;});}return _0x5db9b9;})['then'](respondWithResult(_0x173fa3,null))[_0x16b1('0x40')](handleError(_0x173fa3,null));});_0xcdc829[_0x16b1('0x78')]();}catch(_0xc65ab8){_0x173fa3[_0x16b1('0x1a')](0x1f4)[_0x16b1('0x61')](_0xc65ab8);}};exports[_0x16b1('0x23')]=function(_0x583982,_0x345692,_0x3094c4){return db[_0x16b1('0x2a')][_0x16b1('0x44')]({'where':{'id':_0x583982[_0x16b1('0x45')]['id']}})['then'](handleEntityNotFound(_0x345692,null))['then'](saveUpdates(_[_0x16b1('0x3a')](_0x583982[_0x16b1('0x70')],[_0x16b1('0x29'),_0x16b1('0x79')]),null))['then'](respondWithResult(_0x345692,null))['catch'](handleError(_0x345692,null));};exports['delete']=function(_0xcc266c,_0x25f32a,_0x376f95){return db[_0x16b1('0x2a')][_0x16b1('0x44')]({'where':{'id':_0xcc266c['params']['id']}})[_0x16b1('0x24')](function(_0x4b71e9){if(_0x4b71e9){return _0x4b71e9['destroy']();}})['then'](function(_0x4d200e){var _0x1ece27=path[_0x16b1('0x48')](config[_0x16b1('0x49')],_0x16b1('0x58'),util[_0x16b1('0x59')](_0x16b1('0x50'),_0x4d200e[_0x16b1('0x46')],_0x4d200e[_0x16b1('0x7a')]));var _0x188c31=path['join'](config[_0x16b1('0x49')],_0x16b1('0x4a'),util[_0x16b1('0x59')](_0x16b1('0x50'),_0x4d200e[_0x16b1('0x46')],_0x4d200e['converted_format']));fs[_0x16b1('0x60')](_0x1ece27);fs[_0x16b1('0x60')](_0x188c31);return _0x4d200e;})['then'](function(_0x1a135f){if(_0x1a135f){return _0x25f32a[_0x16b1('0x1a')](0xcc)['end']();}})[_0x16b1('0x24')](handleEntityNotFound(_0x25f32a,null))[_0x16b1('0x40')](handleError(_0x25f32a,null));};
\ No newline at end of file
+var _0x9d7f=['stack','name','send','index','map','Sound','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','includeAll','include','findAll','rows','params','merge','options','find','download','save_name','converted_format','existsSync','join','root','Sequelize','Sound\x20not\x20found','server/files/sounds/converted','%s.%s','catch','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','format','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','Sounds','error'];(function(_0x2d4e30,_0x3f3569){var _0x5e3c76=function(_0x4203ad){while(--_0x4203ad){_0x2d4e30['push'](_0x2d4e30['shift']());}};_0x5e3c76(++_0x3f3569);}(_0x9d7f,0x148));var _0xf9d7=function(_0x5cae6f,_0x3c8bb1){_0x5cae6f=_0x5cae6f-0x0;var _0x284ff4=_0x9d7f[_0x5cae6f];return _0x284ff4;};'use strict';var emlformat=require(_0xf9d7('0x0'));var rimraf=require(_0xf9d7('0x1'));var zipdir=require(_0xf9d7('0x2'));var jsonpatch=require(_0xf9d7('0x3'));var rp=require(_0xf9d7('0x4'));var moment=require(_0xf9d7('0x5'));var BPromise=require(_0xf9d7('0x6'));var Mustache=require(_0xf9d7('0x7'));var util=require(_0xf9d7('0x8'));var path=require('path');var sox=require(_0xf9d7('0x9'));var csv=require(_0xf9d7('0xa'));var ejs=require(_0xf9d7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf9d7('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf9d7('0xd'));var deskjs=require(_0xf9d7('0xe'));var toCsv=require(_0xf9d7('0xa'));var querystring=require('querystring');var Papa=require(_0xf9d7('0xf'));var Redis=require('ioredis');var authService=require(_0xf9d7('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf9d7('0x11'))('api');var utils=require(_0xf9d7('0x12'));var config=require(_0xf9d7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9d7('0x14'))['db'];function respondWithStatusCode(_0x5f437f,_0x4c15f9){_0x4c15f9=_0x4c15f9||0xcc;return function(_0x27586a){if(_0x27586a){return _0x5f437f[_0xf9d7('0x15')](_0x4c15f9);}return _0x5f437f[_0xf9d7('0x16')](_0x4c15f9)[_0xf9d7('0x17')]();};}function respondWithResult(_0x1cb1a6,_0x5d6002){_0x5d6002=_0x5d6002||0xc8;return function(_0x526eca){if(_0x526eca){return _0x1cb1a6[_0xf9d7('0x16')](_0x5d6002)[_0xf9d7('0x18')](_0x526eca);}};}function respondWithFilteredResult(_0x36f1a5,_0x158664){return function(_0x22c396){if(_0x22c396){var _0x420c83=typeof _0x158664[_0xf9d7('0x19')]===_0xf9d7('0x1a')&&typeof _0x158664[_0xf9d7('0x1b')]===_0xf9d7('0x1a');var _0x17dcad=_0x22c396[_0xf9d7('0x1c')];var _0x393d78=_0x420c83?0x0:_0x158664[_0xf9d7('0x19')];var _0x28fa31=_0x420c83?_0x22c396[_0xf9d7('0x1c')]:_0x158664['offset']+_0x158664[_0xf9d7('0x1b')];var _0x3fe71f;if(_0x28fa31>=_0x17dcad){_0x28fa31=_0x17dcad;_0x3fe71f=0xc8;}else{_0x3fe71f=0xce;}_0x36f1a5[_0xf9d7('0x16')](_0x3fe71f);return _0x36f1a5['set'](_0xf9d7('0x1d'),_0x393d78+'-'+_0x28fa31+'/'+_0x17dcad)[_0xf9d7('0x18')](_0x22c396);}return null;};}function patchUpdates(_0x445317){return function(_0x282cbd){try{jsonpatch['apply'](_0x282cbd,_0x445317,!![]);}catch(_0x510343){return BPromise[_0xf9d7('0x1e')](_0x510343);}return _0x282cbd[_0xf9d7('0x1f')]();};}function saveUpdates(_0x265dee,_0x312721){return function(_0x2da988){if(_0x2da988){return _0x2da988[_0xf9d7('0x20')](_0x265dee)[_0xf9d7('0x21')](function(_0x40abd5){return _0x40abd5;});}return null;};}function removeEntity(_0x165876,_0x4fccd9){return function(_0x46365a){if(_0x46365a){return _0x46365a[_0xf9d7('0x22')]()[_0xf9d7('0x21')](function(){var _0x28aee7=_0x46365a[_0xf9d7('0x23')]({'plain':!![]});var _0x41a727=_0xf9d7('0x24');return db['UserProfileResource'][_0xf9d7('0x22')]({'where':{'type':_0x41a727,'resourceId':_0x28aee7['id']}})[_0xf9d7('0x21')](function(){return _0x46365a;});})['then'](function(){_0x165876[_0xf9d7('0x16')](0xcc)[_0xf9d7('0x17')]();});}};}function handleEntityNotFound(_0x19e648,_0x3d61b0){return function(_0x5a5d1e){if(!_0x5a5d1e){_0x19e648[_0xf9d7('0x15')](0x194);}return _0x5a5d1e;};}function handleError(_0x4294fe,_0x481a2c){_0x481a2c=_0x481a2c||0x1f4;return function(_0x1c2058){logger[_0xf9d7('0x25')](_0x1c2058[_0xf9d7('0x26')]);if(_0x1c2058[_0xf9d7('0x27')]){delete _0x1c2058[_0xf9d7('0x27')];}_0x4294fe[_0xf9d7('0x16')](_0x481a2c)[_0xf9d7('0x28')](_0x1c2058);};}exports[_0xf9d7('0x29')]=function(_0x44a57e,_0x3e763d){var _0x198f41={},_0x50cf53={},_0x4c1797={'count':0x0,'rows':[]};var _0xe5f22a=_[_0xf9d7('0x2a')](db[_0xf9d7('0x2b')][_0xf9d7('0x2c')],function(_0x6f453a){return{'name':_0x6f453a[_0xf9d7('0x2d')],'type':_0x6f453a[_0xf9d7('0x2e')]['key']};});_0x50cf53[_0xf9d7('0x2f')]=_[_0xf9d7('0x2a')](_0xe5f22a,'name');_0x50cf53[_0xf9d7('0x30')]=_[_0xf9d7('0x31')](_0x44a57e[_0xf9d7('0x30')]);_0x50cf53[_0xf9d7('0x32')]=_[_0xf9d7('0x33')](_0x50cf53['model'],_0x50cf53[_0xf9d7('0x30')]);_0x198f41[_0xf9d7('0x34')]=_['intersection'](_0x50cf53[_0xf9d7('0x2f')],qs[_0xf9d7('0x35')](_0x44a57e[_0xf9d7('0x30')]['fields']));_0x198f41[_0xf9d7('0x34')]=_0x198f41[_0xf9d7('0x34')][_0xf9d7('0x36')]?_0x198f41[_0xf9d7('0x34')]:_0x50cf53['model'];if(!_0x44a57e['query'][_0xf9d7('0x37')](_0xf9d7('0x38'))){_0x198f41['limit']=qs[_0xf9d7('0x1b')](_0x44a57e[_0xf9d7('0x30')][_0xf9d7('0x1b')]);_0x198f41['offset']=qs['offset'](_0x44a57e['query'][_0xf9d7('0x19')]);}_0x198f41[_0xf9d7('0x39')]=qs[_0xf9d7('0x3a')](_0x44a57e['query'][_0xf9d7('0x3a')]);_0x198f41[_0xf9d7('0x3b')]=qs[_0xf9d7('0x32')](_['pick'](_0x44a57e['query'],_0x50cf53[_0xf9d7('0x32')]),_0xe5f22a);if(_0x44a57e[_0xf9d7('0x30')][_0xf9d7('0x3c')]){_0x198f41['where']=_['merge'](_0x198f41[_0xf9d7('0x3b')],{'$or':_[_0xf9d7('0x2a')](_0xe5f22a,function(_0x3c6f9d){if(_0x3c6f9d[_0xf9d7('0x2e')]!=='VIRTUAL'){var _0x44a064={};_0x44a064[_0x3c6f9d[_0xf9d7('0x27')]]={'$like':'%'+_0x44a57e[_0xf9d7('0x30')][_0xf9d7('0x3c')]+'%'};return _0x44a064;}})});}_0x198f41=_['merge']({},_0x198f41,_0x44a57e['options']);var _0x2640ca={'where':_0x198f41[_0xf9d7('0x3b')]};return db['Sound'][_0xf9d7('0x1c')](_0x2640ca)[_0xf9d7('0x21')](function(_0x50b00a){_0x4c1797[_0xf9d7('0x1c')]=_0x50b00a;if(_0x44a57e[_0xf9d7('0x30')][_0xf9d7('0x3d')]){_0x198f41[_0xf9d7('0x3e')]=[{'all':!![]}];}return db['Sound'][_0xf9d7('0x3f')](_0x198f41);})[_0xf9d7('0x21')](function(_0x57654c){_0x4c1797[_0xf9d7('0x40')]=_0x57654c;return _0x4c1797;})[_0xf9d7('0x21')](respondWithFilteredResult(_0x3e763d,_0x198f41))['catch'](handleError(_0x3e763d,null));};exports['show']=function(_0x48070c,_0x291391){var _0xf5a595={'raw':!![],'where':{'id':_0x48070c[_0xf9d7('0x41')]['id']}},_0xb6525d={};_0xb6525d['model']=_[_0xf9d7('0x31')](db[_0xf9d7('0x2b')][_0xf9d7('0x2c')]);_0xb6525d[_0xf9d7('0x30')]=_[_0xf9d7('0x31')](_0x48070c['query']);_0xb6525d[_0xf9d7('0x32')]=_[_0xf9d7('0x33')](_0xb6525d[_0xf9d7('0x2f')],_0xb6525d[_0xf9d7('0x30')]);_0xf5a595[_0xf9d7('0x34')]=_[_0xf9d7('0x33')](_0xb6525d[_0xf9d7('0x2f')],qs[_0xf9d7('0x35')](_0x48070c[_0xf9d7('0x30')][_0xf9d7('0x35')]));_0xf5a595[_0xf9d7('0x34')]=_0xf5a595[_0xf9d7('0x34')][_0xf9d7('0x36')]?_0xf5a595[_0xf9d7('0x34')]:_0xb6525d[_0xf9d7('0x2f')];if(_0x48070c['query'][_0xf9d7('0x3d')]){_0xf5a595[_0xf9d7('0x3e')]=[{'all':!![]}];}_0xf5a595=_[_0xf9d7('0x42')]({},_0xf5a595,_0x48070c[_0xf9d7('0x43')]);return db[_0xf9d7('0x2b')][_0xf9d7('0x44')](_0xf5a595)[_0xf9d7('0x21')](handleEntityNotFound(_0x291391,null))[_0xf9d7('0x21')](respondWithResult(_0x291391,null))['catch'](handleError(_0x291391,null));};exports[_0xf9d7('0x45')]=function(_0x306c01,_0x39edcb,_0x202022){return db['Sound']['find']({'where':{'id':_0x306c01[_0xf9d7('0x41')]['id']},'attributes':['name',_0xf9d7('0x46'),_0xf9d7('0x47')],'raw':!![]})[_0xf9d7('0x21')](handleEntityNotFound(_0x39edcb,null))[_0xf9d7('0x21')](function(_0x3a1050){if(_0x3a1050){if(!fs[_0xf9d7('0x48')](path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],'server/files/sounds/converted',_0x3a1050['save_name']+'.'+_0x3a1050[_0xf9d7('0x47')]))){throw new db[(_0xf9d7('0x4b'))]['ValidationError'](_0xf9d7('0x4c'));}return _0x39edcb[_0xf9d7('0x45')](path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],_0xf9d7('0x4d'),util['format'](_0xf9d7('0x4e'),_0x3a1050[_0xf9d7('0x46')],_0x3a1050[_0xf9d7('0x47')])),util['format'](_0xf9d7('0x4e'),_0x3a1050[_0xf9d7('0x27')],_0x3a1050[_0xf9d7('0x47')]));}return null;})[_0xf9d7('0x4f')](handleError(_0x39edcb,null));};exports[_0xf9d7('0x50')]=function(_0xfdb004,_0x1c7afd,_0x2a01ef){var _0x58bbd8={'name':path[_0xf9d7('0x51')](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x53')],path[_0xf9d7('0x54')](_0xfdb004['file'][_0xf9d7('0x53')])),'save_name':path['basename'](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x55')],path[_0xf9d7('0x54')](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x55')])),'original_format':path[_0xf9d7('0x54')](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x53')])['substring'](0x1),'converted_format':_0xf9d7('0x56')};var _0x17b031=path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],_0xf9d7('0x57'),_0xfdb004[_0xf9d7('0x52')]['filename']);var _0x510677=path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],_0xf9d7('0x4d'),util[_0xf9d7('0x58')](_0xf9d7('0x4e'),path[_0xf9d7('0x51')](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x55')],path['extname'](_0xfdb004[_0xf9d7('0x52')][_0xf9d7('0x55')])),_0x58bbd8[_0xf9d7('0x47')]));logger[_0xf9d7('0x59')](_0xf9d7('0x5a'),_0x17b031);logger[_0xf9d7('0x59')](_0xf9d7('0x5b'),_0x510677);try{fs[_0xf9d7('0x5c')](_0x17b031,parseInt(_0xf9d7('0x5d'),0x8));var _0x1aac35=sox[_0xf9d7('0x5e')](_0x17b031,_0x510677,{'sampleRate':0x1f40,'format':_0xf9d7('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1aac35['on'](_0xf9d7('0x25'),function(_0x49e581){fs[_0xf9d7('0x5f')](_0x17b031);_0x1c7afd[_0xf9d7('0x16')](0x1f4)['send'](_0x49e581);});_0x1aac35['on'](_0xf9d7('0x60'),function(_0x355e6e){_0x58bbd8['original_duration']=isNaN(_0x355e6e[_0xf9d7('0x61')])?null:_0x355e6e[_0xf9d7('0x61')]*0x3e8;_0x58bbd8[_0xf9d7('0x62')]=isNaN(_0x355e6e[_0xf9d7('0x63')])?null:_0x355e6e['sampleCount'];_0x58bbd8[_0xf9d7('0x64')]=isNaN(_0x355e6e['channelCount'])?null:_0x355e6e[_0xf9d7('0x65')];_0x58bbd8[_0xf9d7('0x66')]=isNaN(_0x355e6e[_0xf9d7('0x67')])?null:_0x355e6e[_0xf9d7('0x67')];_0x58bbd8[_0xf9d7('0x68')]=isNaN(_0x355e6e[_0xf9d7('0x69')])?null:_0x355e6e['sampleRate'];});_0x1aac35['on'](_0xf9d7('0x6a'),function(_0x4433d0){_0x58bbd8[_0xf9d7('0x6b')]=isNaN(_0x4433d0[_0xf9d7('0x61')])?null:_0x4433d0['duration']*0x3e8;_0x58bbd8['converted_sampleCount']=isNaN(_0x4433d0['sampleCount'])?null:_0x4433d0[_0xf9d7('0x63')];_0x58bbd8[_0xf9d7('0x6c')]=isNaN(_0x4433d0[_0xf9d7('0x65')])?null:_0x4433d0['channelCount'];_0x58bbd8[_0xf9d7('0x6d')]=isNaN(_0x4433d0[_0xf9d7('0x67')])?null:_0x4433d0[_0xf9d7('0x67')];_0x58bbd8[_0xf9d7('0x6e')]=isNaN(_0x4433d0[_0xf9d7('0x69')])?null:_0x4433d0['sampleRate'];});_0x1aac35['on']('end',function(){fs[_0xf9d7('0x5c')](_0x510677,parseInt('0777',0x8));return db[_0xf9d7('0x2b')][_0xf9d7('0x50')](_0x58bbd8)[_0xf9d7('0x21')](function(_0x36c4f5){var _0xcb8445={'role':_0xfdb004[_0xf9d7('0x6f')][_0xf9d7('0x70')],'userProfileId':_0xfdb004[_0xf9d7('0x6f')][_0xf9d7('0x71')]};if(!_0xcb8445)throw new Error(_0xf9d7('0x72'));if(_0xcb8445[_0xf9d7('0x70')]===_0xf9d7('0x73')){var _0x589f8a=_0x36c4f5[_0xf9d7('0x23')]({'plain':!![]});return db['UserProfileSection'][_0xf9d7('0x44')]({'where':{'name':_0xf9d7('0x24'),'userProfileId':_0xcb8445['userProfileId']},'raw':!![]})[_0xf9d7('0x21')](function(_0x2e957c){if(_0x2e957c&&_0x2e957c['autoAssociation']===0x0){return db[_0xf9d7('0x74')][_0xf9d7('0x50')]({'name':_0x589f8a[_0xf9d7('0x27')],'resourceId':_0x589f8a['id'],'type':_0x2e957c['name'],'sectionId':_0x2e957c['id']},{})[_0xf9d7('0x21')](function(){return _0x36c4f5;});}else{return _0x36c4f5;}})[_0xf9d7('0x4f')](function(_0x57b19f){logger[_0xf9d7('0x25')](_0xf9d7('0x75'),_0x57b19f);throw _0x57b19f;});}return _0x36c4f5;})[_0xf9d7('0x21')](respondWithResult(_0x1c7afd,null))[_0xf9d7('0x4f')](handleError(_0x1c7afd,null));});_0x1aac35[_0xf9d7('0x76')]();}catch(_0x3896ac){_0x1c7afd[_0xf9d7('0x16')](0x1f4)[_0xf9d7('0x28')](_0x3896ac);}};exports[_0xf9d7('0x20')]=function(_0x459173,_0x4129b1,_0x273f0a){return db[_0xf9d7('0x2b')]['find']({'where':{'id':_0x459173[_0xf9d7('0x41')]['id']}})[_0xf9d7('0x21')](handleEntityNotFound(_0x4129b1,null))['then'](saveUpdates(_[_0xf9d7('0x77')](_0x459173[_0xf9d7('0x6f')],[_0xf9d7('0x27'),'description']),null))['then'](respondWithResult(_0x4129b1,null))[_0xf9d7('0x4f')](handleError(_0x4129b1,null));};exports[_0xf9d7('0x78')]=function(_0x3b07bd,_0x2d2078,_0x96cb43){return db['Sound']['find']({'where':{'id':_0x3b07bd[_0xf9d7('0x41')]['id']}})[_0xf9d7('0x21')](function(_0x5729a6){if(_0x5729a6){return _0x5729a6[_0xf9d7('0x22')]();}})[_0xf9d7('0x21')](function(_0x395a54){var _0x55ba44=path[_0xf9d7('0x49')](config[_0xf9d7('0x4a')],_0xf9d7('0x57'),util['format'](_0xf9d7('0x4e'),_0x395a54[_0xf9d7('0x46')],_0x395a54[_0xf9d7('0x79')]));var _0x3a1fe7=path[_0xf9d7('0x49')](config['root'],'server/files/sounds/converted',util[_0xf9d7('0x58')](_0xf9d7('0x4e'),_0x395a54[_0xf9d7('0x46')],_0x395a54['converted_format']));fs['unlinkSync'](_0x55ba44);fs['unlinkSync'](_0x3a1fe7);return _0x395a54;})[_0xf9d7('0x21')](function(_0x244699){if(_0x244699){return _0x2d2078[_0xf9d7('0x16')](0xcc)['end']();}})['then'](handleEntityNotFound(_0x2d2078,null))['catch'](handleError(_0x2d2078,null));};
\ No newline at end of file
index da9a34e..9647030 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe14=['moment','bluebird','path','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x48a679,_0x3818e2){var _0x45f368=function(_0x9a8181){while(--_0x9a8181){_0x48a679['push'](_0x48a679['shift']());}};_0x45f368(++_0x3818e2);}(_0xfe14,0x110));var _0x4fe1=function(_0x3221cd,_0x4a4a4a){_0x3221cd=_0x3221cd-0x0;var _0x21a689=_0xfe14[_0x3221cd];return _0x21a689;};'use strict';var _=require(_0x4fe1('0x0'));var util=require(_0x4fe1('0x1'));var logger=require(_0x4fe1('0x2'))('api');var moment=require(_0x4fe1('0x3'));var BPromise=require(_0x4fe1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fe1('0x5'));var rimraf=require('rimraf');var config=require(_0x4fe1('0x6'));var attributes=require(_0x4fe1('0x7'));module['exports']=function(_0x1a1997,_0x38439c){return _0x1a1997[_0x4fe1('0x8')](_0x4fe1('0x9'),attributes,{'tableName':_0x4fe1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x91ea=['Sound','tools_sounds','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./sound.attributes','exports'];(function(_0x5f2e01,_0x2d5765){var _0xd508f6=function(_0x119454){while(--_0x119454){_0x5f2e01['push'](_0x5f2e01['shift']());}};_0xd508f6(++_0x2d5765);}(_0x91ea,0x195));var _0xa91e=function(_0x999c6e,_0x2fdef4){_0x999c6e=_0x999c6e-0x0;var _0x37e20c=_0x91ea[_0x999c6e];return _0x37e20c;};'use strict';var _=require(_0xa91e('0x0'));var util=require(_0xa91e('0x1'));var logger=require('../../config/logger')(_0xa91e('0x2'));var moment=require(_0xa91e('0x3'));var BPromise=require(_0xa91e('0x4'));var rp=require(_0xa91e('0x5'));var fs=require('fs');var path=require(_0xa91e('0x6'));var rimraf=require(_0xa91e('0x7'));var config=require(_0xa91e('0x8'));var attributes=require(_0xa91e('0x9'));module[_0xa91e('0xa')]=function(_0x48eb53,_0x46b2a3){return _0x48eb53['define'](_0xa91e('0xb'),attributes,{'tableName':_0xa91e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 08f134e..053e98e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe620=['client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','Sound','find','options','attributes','include','map','model','ShowSound','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4327fe,_0x4f8040){var _0x138651=function(_0x418acc){while(--_0x418acc){_0x4327fe['push'](_0x4327fe['shift']());}};_0x138651(++_0x4f8040);}(_0xe620,0x1c8));var _0x0e62=function(_0xb4e2df,_0x1cbb7c){_0xb4e2df=_0xb4e2df-0x0;var _0x5e95ba=_0xe620[_0xb4e2df];return _0x5e95ba;};'use strict';var _=require(_0x0e62('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0e62('0x1'));var rs=require(_0x0e62('0x2'));var fs=require('fs');var Redis=require(_0x0e62('0x3'));var db=require(_0x0e62('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0e62('0x5'))(_0x0e62('0x6'));var config=require(_0x0e62('0x7'));var jayson=require(_0x0e62('0x8'));var client=jayson[_0x0e62('0x9')][_0x0e62('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1545a4,_0x275513,_0x175ae2){return new BPromise(function(_0x488bad,_0x536dea){return client[_0x0e62('0xb')](_0x1545a4,_0x175ae2)[_0x0e62('0xc')](function(_0x9d0e7b){logger[_0x0e62('0xd')](_0x0e62('0xe'),_0x275513,_0x0e62('0xf'));logger[_0x0e62('0x10')](_0x0e62('0x11'),_0x275513,'request\x20sent',JSON[_0x0e62('0x12')](_0x9d0e7b));if(_0x9d0e7b[_0x0e62('0x13')]){if(_0x9d0e7b['error'][_0x0e62('0x14')]===0x1f4){logger[_0x0e62('0x13')](_0x0e62('0xe'),_0x275513,_0x9d0e7b[_0x0e62('0x13')][_0x0e62('0x15')]);return _0x536dea(_0x9d0e7b['error'][_0x0e62('0x15')]);}logger[_0x0e62('0x13')](_0x0e62('0xe'),_0x275513,_0x9d0e7b[_0x0e62('0x13')]['message']);return _0x488bad(_0x9d0e7b['error'][_0x0e62('0x15')]);}else{logger[_0x0e62('0xd')](_0x0e62('0xe'),_0x275513,_0x0e62('0xf'));_0x488bad(_0x9d0e7b['result'][_0x0e62('0x15')]);}})[_0x0e62('0x16')](function(_0x3b1927){logger[_0x0e62('0x13')](_0x0e62('0xe'),_0x275513,_0x3b1927);_0x536dea(_0x3b1927);});});}exports['ShowSound']=function(_0x3982d5){var _0x4fbd51=this;return new Promise(function(_0x490122,_0xa98be6){return db[_0x0e62('0x17')][_0x0e62('0x18')]({'raw':_0x3982d5[_0x0e62('0x19')]?_0x3982d5[_0x0e62('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3982d5[_0x0e62('0x19')]?_0x3982d5[_0x0e62('0x19')]['where']||null:null,'attributes':_0x3982d5[_0x0e62('0x19')]?_0x3982d5[_0x0e62('0x19')][_0x0e62('0x1a')]||null:null,'include':_0x3982d5[_0x0e62('0x19')]?_0x3982d5['options'][_0x0e62('0x1b')]?_[_0x0e62('0x1c')](_0x3982d5['options']['include'],function(_0x1d555b){return{'model':db[_0x1d555b[_0x0e62('0x1d')]],'as':_0x1d555b['as'],'attributes':_0x1d555b[_0x0e62('0x1a')],'include':_0x1d555b[_0x0e62('0x1b')]?_[_0x0e62('0x1c')](_0x1d555b[_0x0e62('0x1b')],function(_0x5735be){return{'model':db[_0x5735be[_0x0e62('0x1d')]],'as':_0x5735be['as'],'attributes':_0x5735be['attributes'],'include':_0x5735be[_0x0e62('0x1b')]?_['map'](_0x5735be['include'],function(_0x2d8723){return{'model':db[_0x2d8723['model']],'as':_0x2d8723['as'],'attributes':_0x2d8723[_0x0e62('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0e62('0xc')](function(_0x49ead3){logger[_0x0e62('0xd')](_0x0e62('0x1e'),_0x3982d5);logger[_0x0e62('0x10')](_0x0e62('0x1e'),_0x3982d5,JSON['stringify'](_0x49ead3));_0x490122(_0x49ead3);})['catch'](function(_0x5bc7c9){logger[_0x0e62('0x13')]('ShowSound',_0x5bc7c9[_0x0e62('0x15')],_0x3982d5);_0xa98be6(_0x4fbd51[_0x0e62('0x13')](0x1f4,_0x5bc7c9[_0x0e62('0x15')]));});});};
\ No newline at end of file
+var _0xee46=['options','raw','attributes','include','map','model','ShowSound','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Sound,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','Sound','find'];(function(_0x3bd2c0,_0xbe4fa0){var _0x57b005=function(_0x365fc2){while(--_0x365fc2){_0x3bd2c0['push'](_0x3bd2c0['shift']());}};_0x57b005(++_0xbe4fa0);}(_0xee46,0x128));var _0x6ee4=function(_0x47ab72,_0x5dbf3e){_0x47ab72=_0x47ab72-0x0;var _0x204b9d=_0xee46[_0x47ab72];return _0x204b9d;};'use strict';var _=require(_0x6ee4('0x0'));var util=require(_0x6ee4('0x1'));var moment=require(_0x6ee4('0x2'));var BPromise=require(_0x6ee4('0x3'));var rs=require(_0x6ee4('0x4'));var fs=require('fs');var Redis=require(_0x6ee4('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6ee4('0x6'))(_0x6ee4('0x7'));var config=require(_0x6ee4('0x8'));var jayson=require(_0x6ee4('0x9'));var client=jayson[_0x6ee4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x509f84,_0x1b6f7c,_0x174f0b){return new BPromise(function(_0x522f15,_0x184695){return client[_0x6ee4('0xb')](_0x509f84,_0x174f0b)[_0x6ee4('0xc')](function(_0x4ee176){logger['info'](_0x6ee4('0xd'),_0x1b6f7c,_0x6ee4('0xe'));logger[_0x6ee4('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x1b6f7c,_0x6ee4('0xe'),JSON['stringify'](_0x4ee176));if(_0x4ee176['error']){if(_0x4ee176[_0x6ee4('0x10')][_0x6ee4('0x11')]===0x1f4){logger[_0x6ee4('0x10')](_0x6ee4('0xd'),_0x1b6f7c,_0x4ee176[_0x6ee4('0x10')][_0x6ee4('0x12')]);return _0x184695(_0x4ee176[_0x6ee4('0x10')][_0x6ee4('0x12')]);}logger[_0x6ee4('0x10')](_0x6ee4('0xd'),_0x1b6f7c,_0x4ee176['error'][_0x6ee4('0x12')]);return _0x522f15(_0x4ee176[_0x6ee4('0x10')]['message']);}else{logger[_0x6ee4('0x13')]('Sound,\x20%s,\x20%s',_0x1b6f7c,_0x6ee4('0xe'));_0x522f15(_0x4ee176[_0x6ee4('0x14')]['message']);}})[_0x6ee4('0x15')](function(_0x55926d){logger[_0x6ee4('0x10')](_0x6ee4('0xd'),_0x1b6f7c,_0x55926d);_0x184695(_0x55926d);});});}exports['ShowSound']=function(_0x3dfea2){var _0x163f59=this;return new Promise(function(_0x476865,_0x15e515){return db[_0x6ee4('0x16')][_0x6ee4('0x17')]({'raw':_0x3dfea2['options']?_0x3dfea2[_0x6ee4('0x18')][_0x6ee4('0x19')]===undefined?!![]:![]:!![],'where':_0x3dfea2[_0x6ee4('0x18')]?_0x3dfea2[_0x6ee4('0x18')]['where']||null:null,'attributes':_0x3dfea2[_0x6ee4('0x18')]?_0x3dfea2[_0x6ee4('0x18')][_0x6ee4('0x1a')]||null:null,'include':_0x3dfea2[_0x6ee4('0x18')]?_0x3dfea2['options'][_0x6ee4('0x1b')]?_[_0x6ee4('0x1c')](_0x3dfea2[_0x6ee4('0x18')][_0x6ee4('0x1b')],function(_0x38c1b6){return{'model':db[_0x38c1b6[_0x6ee4('0x1d')]],'as':_0x38c1b6['as'],'attributes':_0x38c1b6[_0x6ee4('0x1a')],'include':_0x38c1b6[_0x6ee4('0x1b')]?_['map'](_0x38c1b6[_0x6ee4('0x1b')],function(_0x427ae8){return{'model':db[_0x427ae8[_0x6ee4('0x1d')]],'as':_0x427ae8['as'],'attributes':_0x427ae8[_0x6ee4('0x1a')],'include':_0x427ae8[_0x6ee4('0x1b')]?_['map'](_0x427ae8[_0x6ee4('0x1b')],function(_0x6e9f10){return{'model':db[_0x6e9f10[_0x6ee4('0x1d')]],'as':_0x6e9f10['as'],'attributes':_0x6e9f10[_0x6ee4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x6ee4('0xc')](function(_0x1d16f2){logger['info']('ShowSound',_0x3dfea2);logger[_0x6ee4('0xf')](_0x6ee4('0x1e'),_0x3dfea2,JSON[_0x6ee4('0x1f')](_0x1d16f2));_0x476865(_0x1d16f2);})['catch'](function(_0x1b412f){logger[_0x6ee4('0x10')]('ShowSound',_0x1b412f[_0x6ee4('0x12')],_0x3dfea2);_0x15e515(_0x163f59[_0x6ee4('0x10')](0x1f4,_0x1b412f['message']));});});};
\ No newline at end of file
index e8fda26..70d2d89 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0x134bc5,_0x380db2){var _0x16bce2=function(_0x5db76d){while(--_0x5db76d){_0x134bc5['push'](_0x134bc5['shift']());}};_0x16bce2(++_0x380db2);}(_0xda3f,0xec));var _0xfda3=function(_0x35fbc4,_0x189ae3){_0x35fbc4=_0x35fbc4-0x0;var _0x1923f2=_0xda3f[_0x35fbc4];return _0x1923f2;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router;
\ No newline at end of file
+var _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x1460ab,_0x74d06e){var _0x1eeb5c=function(_0x28de38){while(--_0x28de38){_0x1460ab['push'](_0x1460ab['shift']());}};_0x1eeb5c(++_0x74d06e);}(_0x4fc2,0x111));var _0x24fc=function(_0x482af4,_0x841ba7){_0x482af4=_0x482af4-0x0;var _0x266fbb=_0x4fc2[_0x482af4];return _0x266fbb;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var fs_extra=require(_0x24fc('0x5'));var auth=require(_0x24fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x24fc('0x7'));var controller=require(_0x24fc('0x8'));router['get']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xa')]);router['get'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0xe')]);router['put'](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0xf')]);router[_0x24fc('0x10')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x11')]);module[_0x24fc('0x12')]=router;
\ No newline at end of file
index a4d0b5f..cad887a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfeec=['TEXT','ENUM','out','STRING','sequelize','exports'];(function(_0x26ad23,_0x970145){var _0x3f7615=function(_0x5b14dc){while(--_0x5b14dc){_0x26ad23['push'](_0x26ad23['shift']());}};_0x3f7615(++_0x970145);}(_0xfeec,0x1a2));var _0xcfee=function(_0x11869f,_0x47e8d0){_0x11869f=_0x11869f-0x0;var _0x1b174d=_0xfeec[_0x11869f];return _0x1b174d;};'use strict';var Sequelize=require(_0xcfee('0x0'));module[_0xcfee('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xcfee('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xcfee('0x3')]('in',_0xcfee('0x4')),'defaultValue':_0xcfee('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0xcfee('0x5')]},'providerResponse':{'type':Sequelize[_0xcfee('0x2')]}};
\ No newline at end of file
+var _0xbed2=['sequelize','STRING','TEXT','medium','ENUM','out'];(function(_0x104d23,_0x39fb6c){var _0x1988c5=function(_0x1c839f){while(--_0x1c839f){_0x104d23['push'](_0x104d23['shift']());}};_0x1988c5(++_0x39fb6c);}(_0xbed2,0xf0));var _0x2bed=function(_0x39c8f2,_0x23df6c){_0x39c8f2=_0x39c8f2-0x0;var _0x445526=_0xbed2[_0x39c8f2];return _0x445526;};'use strict';var Sequelize=require(_0x2bed('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x2bed('0x1')]},'body':{'type':Sequelize[_0x2bed('0x2')](_0x2bed('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x2bed('0x4')]('in',_0x2bed('0x5')),'defaultValue':'out','allowNull':![]},'providerName':{'type':Sequelize[_0x2bed('0x1')]},'providerResponse':{'type':Sequelize['TEXT']}};
\ No newline at end of file
index c8a384f..935dfc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe1c4=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareMessage','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','moment','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x292531,_0x209918){var _0x114834=function(_0x5649ed){while(--_0x5649ed){_0x292531['push'](_0x292531['shift']());}};_0x114834(++_0x209918);}(_0xe1c4,0x1ec));var _0x4e1c=function(_0x2536b3,_0x25e762){_0x2536b3=_0x2536b3-0x0;var _0x1def76=_0xe1c4[_0x2536b3];return _0x1def76;};'use strict';var emlformat=require(_0x4e1c('0x0'));var rimraf=require(_0x4e1c('0x1'));var zipdir=require(_0x4e1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4e1c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4e1c('0x4'));var util=require(_0x4e1c('0x5'));var path=require(_0x4e1c('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4e1c('0x7'));var fs=require('fs');var fs_extra=require(_0x4e1c('0x8'));var _=require(_0x4e1c('0x9'));var squel=require(_0x4e1c('0xa'));var crypto=require(_0x4e1c('0xb'));var jsforce=require(_0x4e1c('0xc'));var deskjs=require(_0x4e1c('0xd'));var toCsv=require(_0x4e1c('0xe'));var querystring=require(_0x4e1c('0xf'));var Papa=require(_0x4e1c('0x10'));var Redis=require(_0x4e1c('0x11'));var authService=require(_0x4e1c('0x12'));var qs=require(_0x4e1c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4e1c('0x14'));var logger=require(_0x4e1c('0x15'))('api');var utils=require(_0x4e1c('0x16'));var config=require(_0x4e1c('0x17'));var licenseUtil=require(_0x4e1c('0x18'));var db=require(_0x4e1c('0x19'))['db'];function respondWithStatusCode(_0x54b2d1,_0xb4a030){_0xb4a030=_0xb4a030||0xcc;return function(_0x12178d){if(_0x12178d){return _0x54b2d1[_0x4e1c('0x1a')](_0xb4a030);}return _0x54b2d1[_0x4e1c('0x1b')](_0xb4a030)['end']();};}function respondWithResult(_0x531159,_0x550f27){_0x550f27=_0x550f27||0xc8;return function(_0x12e7fe){if(_0x12e7fe){return _0x531159[_0x4e1c('0x1b')](_0x550f27)[_0x4e1c('0x1c')](_0x12e7fe);}};}function respondWithFilteredResult(_0x201779,_0x4d47ec){return function(_0x2cd5bc){if(_0x2cd5bc){var _0x374c78=typeof _0x4d47ec[_0x4e1c('0x1d')]===_0x4e1c('0x1e')&&typeof _0x4d47ec[_0x4e1c('0x1f')]===_0x4e1c('0x1e');var _0x58d9e3=_0x2cd5bc[_0x4e1c('0x20')];var _0x399bcc=_0x374c78?0x0:_0x4d47ec[_0x4e1c('0x1d')];var _0x46a887=_0x374c78?_0x2cd5bc[_0x4e1c('0x20')]:_0x4d47ec[_0x4e1c('0x1d')]+_0x4d47ec[_0x4e1c('0x1f')];var _0x544b08;if(_0x46a887>=_0x58d9e3){_0x46a887=_0x58d9e3;_0x544b08=0xc8;}else{_0x544b08=0xce;}_0x201779[_0x4e1c('0x1b')](_0x544b08);return _0x201779[_0x4e1c('0x21')](_0x4e1c('0x22'),_0x399bcc+'-'+_0x46a887+'/'+_0x58d9e3)[_0x4e1c('0x1c')](_0x2cd5bc);}return null;};}function patchUpdates(_0x33da37){return function(_0x427cc1){try{jsonpatch[_0x4e1c('0x23')](_0x427cc1,_0x33da37,!![]);}catch(_0x53a020){return BPromise[_0x4e1c('0x24')](_0x53a020);}return _0x427cc1[_0x4e1c('0x25')]();};}function saveUpdates(_0xc57bcc,_0x169b4e){return function(_0x3dde0d){if(_0x3dde0d){return _0x3dde0d[_0x4e1c('0x26')](_0xc57bcc)[_0x4e1c('0x27')](function(_0x19ed77){return _0x19ed77;});}return null;};}function removeEntity(_0x45c13e,_0x5ada14){return function(_0x46ad33){if(_0x46ad33){return _0x46ad33[_0x4e1c('0x28')]()[_0x4e1c('0x27')](function(){_0x45c13e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17f5a5,_0x551d50){return function(_0x25cc93){if(!_0x25cc93){_0x17f5a5[_0x4e1c('0x1a')](0x194);}return _0x25cc93;};}function handleError(_0x2a2ccb,_0x564b30){_0x564b30=_0x564b30||0x1f4;return function(_0x12364d){logger[_0x4e1c('0x29')](_0x12364d['stack']);if(_0x12364d[_0x4e1c('0x2a')]){delete _0x12364d[_0x4e1c('0x2a')];}_0x2a2ccb[_0x4e1c('0x1b')](_0x564b30)[_0x4e1c('0x2b')](_0x12364d);};}exports[_0x4e1c('0x2c')]=function(_0x5ef2f7,_0xeccf79){var _0x8e3e14={},_0x1b5ba8={},_0x1c4c4a={'count':0x0,'rows':[]};var _0x504259=_[_0x4e1c('0x2d')](db[_0x4e1c('0x2e')]['rawAttributes'],function(_0x46d181){return{'name':_0x46d181['fieldName'],'type':_0x46d181[_0x4e1c('0x2f')][_0x4e1c('0x30')]};});_0x1b5ba8[_0x4e1c('0x31')]=_[_0x4e1c('0x2d')](_0x504259,'name');_0x1b5ba8[_0x4e1c('0x32')]=_['keys'](_0x5ef2f7[_0x4e1c('0x32')]);_0x1b5ba8['filters']=_[_0x4e1c('0x33')](_0x1b5ba8[_0x4e1c('0x31')],_0x1b5ba8['query']);_0x8e3e14[_0x4e1c('0x34')]=_['intersection'](_0x1b5ba8[_0x4e1c('0x31')],qs[_0x4e1c('0x35')](_0x5ef2f7[_0x4e1c('0x32')][_0x4e1c('0x35')]));_0x8e3e14[_0x4e1c('0x34')]=_0x8e3e14[_0x4e1c('0x34')][_0x4e1c('0x36')]?_0x8e3e14[_0x4e1c('0x34')]:_0x1b5ba8[_0x4e1c('0x31')];if(!_0x5ef2f7[_0x4e1c('0x32')]['hasOwnProperty'](_0x4e1c('0x37'))){_0x8e3e14[_0x4e1c('0x1f')]=qs[_0x4e1c('0x1f')](_0x5ef2f7[_0x4e1c('0x32')][_0x4e1c('0x1f')]);_0x8e3e14[_0x4e1c('0x1d')]=qs['offset'](_0x5ef2f7['query'][_0x4e1c('0x1d')]);}_0x8e3e14[_0x4e1c('0x38')]=qs[_0x4e1c('0x39')](_0x5ef2f7[_0x4e1c('0x32')]['sort']);_0x8e3e14[_0x4e1c('0x3a')]=qs[_0x4e1c('0x3b')](_['pick'](_0x5ef2f7[_0x4e1c('0x32')],_0x1b5ba8[_0x4e1c('0x3b')]),_0x504259);if(_0x5ef2f7[_0x4e1c('0x32')]['filter']){_0x8e3e14[_0x4e1c('0x3a')]=_[_0x4e1c('0x3c')](_0x8e3e14['where'],{'$or':_[_0x4e1c('0x2d')](_0x504259,function(_0x128ddd){if(_0x128ddd[_0x4e1c('0x2f')]!==_0x4e1c('0x3d')){var _0x1cb1a3={};_0x1cb1a3[_0x128ddd[_0x4e1c('0x2a')]]={'$like':'%'+_0x5ef2f7['query']['filter']+'%'};return _0x1cb1a3;}})});}_0x8e3e14=_[_0x4e1c('0x3c')]({},_0x8e3e14,_0x5ef2f7[_0x4e1c('0x3e')]);var _0x390d05={'where':_0x8e3e14[_0x4e1c('0x3a')]};return db[_0x4e1c('0x2e')][_0x4e1c('0x20')](_0x390d05)[_0x4e1c('0x27')](function(_0x6838bc){_0x1c4c4a[_0x4e1c('0x20')]=_0x6838bc;if(_0x5ef2f7[_0x4e1c('0x32')][_0x4e1c('0x3f')]){_0x8e3e14['include']=[{'all':!![]}];}return db['SquareMessage'][_0x4e1c('0x40')](_0x8e3e14);})[_0x4e1c('0x27')](function(_0xe26367){_0x1c4c4a[_0x4e1c('0x41')]=_0xe26367;return _0x1c4c4a;})[_0x4e1c('0x27')](respondWithFilteredResult(_0xeccf79,_0x8e3e14))[_0x4e1c('0x42')](handleError(_0xeccf79,null));};exports['show']=function(_0x18d021,_0x1da617){var _0x827f0a={'raw':!![],'where':{'id':_0x18d021[_0x4e1c('0x43')]['id']}},_0xdfb6d7={};_0xdfb6d7[_0x4e1c('0x31')]=_[_0x4e1c('0x44')](db[_0x4e1c('0x2e')][_0x4e1c('0x45')]);_0xdfb6d7[_0x4e1c('0x32')]=_[_0x4e1c('0x44')](_0x18d021['query']);_0xdfb6d7[_0x4e1c('0x3b')]=_[_0x4e1c('0x33')](_0xdfb6d7[_0x4e1c('0x31')],_0xdfb6d7[_0x4e1c('0x32')]);_0x827f0a[_0x4e1c('0x34')]=_[_0x4e1c('0x33')](_0xdfb6d7[_0x4e1c('0x31')],qs[_0x4e1c('0x35')](_0x18d021['query'][_0x4e1c('0x35')]));_0x827f0a['attributes']=_0x827f0a[_0x4e1c('0x34')][_0x4e1c('0x36')]?_0x827f0a['attributes']:_0xdfb6d7[_0x4e1c('0x31')];if(_0x18d021[_0x4e1c('0x32')]['includeAll']){_0x827f0a['include']=[{'all':!![]}];}_0x827f0a=_[_0x4e1c('0x3c')]({},_0x827f0a,_0x18d021[_0x4e1c('0x3e')]);return db[_0x4e1c('0x2e')][_0x4e1c('0x46')](_0x827f0a)['then'](handleEntityNotFound(_0x1da617,null))[_0x4e1c('0x27')](respondWithResult(_0x1da617,null))[_0x4e1c('0x42')](handleError(_0x1da617,null));};exports[_0x4e1c('0x47')]=function(_0x6fae67,_0x488fe4){return db[_0x4e1c('0x2e')][_0x4e1c('0x47')](_0x6fae67[_0x4e1c('0x48')],{})[_0x4e1c('0x27')](respondWithResult(_0x488fe4,0xc9))[_0x4e1c('0x42')](handleError(_0x488fe4,null));};exports[_0x4e1c('0x26')]=function(_0x38aa72,_0x25ba45){if(_0x38aa72[_0x4e1c('0x48')]['id']){delete _0x38aa72['body']['id'];}return db[_0x4e1c('0x2e')]['find']({'where':{'id':_0x38aa72[_0x4e1c('0x43')]['id']}})[_0x4e1c('0x27')](handleEntityNotFound(_0x25ba45,null))[_0x4e1c('0x27')](saveUpdates(_0x38aa72['body'],null))['then'](respondWithResult(_0x25ba45,null))[_0x4e1c('0x42')](handleError(_0x25ba45,null));};exports[_0x4e1c('0x28')]=function(_0x4b6910,_0x304b74){return db[_0x4e1c('0x2e')]['find']({'where':{'id':_0x4b6910['params']['id']}})[_0x4e1c('0x27')](handleEntityNotFound(_0x304b74,null))['then'](removeEntity(_0x304b74,null))[_0x4e1c('0x42')](handleError(_0x304b74,null));};
\ No newline at end of file
+var _0x536e=['ejs','lodash','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','SquareMessage','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','update','rimraf','zip-dir','moment','bluebird','mustache','util','path'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x536e,0x111));var _0xe536=function(_0x50d2db,_0x47481f){_0x50d2db=_0x50d2db-0x0;var _0x1c7e27=_0x536e[_0x50d2db];return _0x1c7e27;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe536('0x0'));var zipdir=require(_0xe536('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe536('0x2'));var BPromise=require(_0xe536('0x3'));var Mustache=require(_0xe536('0x4'));var util=require(_0xe536('0x5'));var path=require(_0xe536('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe536('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe536('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe536('0x9'));var toCsv=require(_0xe536('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe536('0xb'));var authService=require(_0xe536('0xc'));var qs=require(_0xe536('0xd'));var as=require(_0xe536('0xe'));var hardwareService=require(_0xe536('0xf'));var logger=require(_0xe536('0x10'))(_0xe536('0x11'));var utils=require(_0xe536('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe536('0x13'))['db'];function respondWithStatusCode(_0x40767e,_0x3429df){_0x3429df=_0x3429df||0xcc;return function(_0x3f1ea4){if(_0x3f1ea4){return _0x40767e[_0xe536('0x14')](_0x3429df);}return _0x40767e[_0xe536('0x15')](_0x3429df)[_0xe536('0x16')]();};}function respondWithResult(_0x185969,_0x5e8c5c){_0x5e8c5c=_0x5e8c5c||0xc8;return function(_0x3df7e7){if(_0x3df7e7){return _0x185969[_0xe536('0x15')](_0x5e8c5c)[_0xe536('0x17')](_0x3df7e7);}};}function respondWithFilteredResult(_0x562bf3,_0x451e7b){return function(_0x1d5939){if(_0x1d5939){var _0x16bd53=typeof _0x451e7b[_0xe536('0x18')]==='undefined'&&typeof _0x451e7b[_0xe536('0x19')]===_0xe536('0x1a');var _0x2ae487=_0x1d5939['count'];var _0x342988=_0x16bd53?0x0:_0x451e7b[_0xe536('0x18')];var _0x571570=_0x16bd53?_0x1d5939[_0xe536('0x1b')]:_0x451e7b[_0xe536('0x18')]+_0x451e7b[_0xe536('0x19')];var _0xeac20e;if(_0x571570>=_0x2ae487){_0x571570=_0x2ae487;_0xeac20e=0xc8;}else{_0xeac20e=0xce;}_0x562bf3['status'](_0xeac20e);return _0x562bf3[_0xe536('0x1c')](_0xe536('0x1d'),_0x342988+'-'+_0x571570+'/'+_0x2ae487)['json'](_0x1d5939);}return null;};}function patchUpdates(_0x2940ff){return function(_0x410656){try{jsonpatch[_0xe536('0x1e')](_0x410656,_0x2940ff,!![]);}catch(_0x4287ff){return BPromise[_0xe536('0x1f')](_0x4287ff);}return _0x410656[_0xe536('0x20')]();};}function saveUpdates(_0x49f603,_0x31dc6c){return function(_0x587879){if(_0x587879){return _0x587879['update'](_0x49f603)['then'](function(_0x19b839){return _0x19b839;});}return null;};}function removeEntity(_0x5ba038,_0x2a3818){return function(_0x16fb7c){if(_0x16fb7c){return _0x16fb7c[_0xe536('0x21')]()[_0xe536('0x22')](function(){_0x5ba038[_0xe536('0x15')](0xcc)[_0xe536('0x16')]();});}};}function handleEntityNotFound(_0x595785,_0xba2c27){return function(_0x32893f){if(!_0x32893f){_0x595785[_0xe536('0x14')](0x194);}return _0x32893f;};}function handleError(_0x24605f,_0x43f25e){_0x43f25e=_0x43f25e||0x1f4;return function(_0x197f09){logger['error'](_0x197f09[_0xe536('0x23')]);if(_0x197f09[_0xe536('0x24')]){delete _0x197f09[_0xe536('0x24')];}_0x24605f['status'](_0x43f25e)[_0xe536('0x25')](_0x197f09);};}exports['index']=function(_0x48a8e2,_0x497bba){var _0x177aff={},_0x2faeb3={},_0x1a7205={'count':0x0,'rows':[]};var _0x33ec18=_[_0xe536('0x26')](db[_0xe536('0x27')][_0xe536('0x28')],function(_0x1c29ed){return{'name':_0x1c29ed[_0xe536('0x29')],'type':_0x1c29ed['type'][_0xe536('0x2a')]};});_0x2faeb3[_0xe536('0x2b')]=_[_0xe536('0x26')](_0x33ec18,_0xe536('0x24'));_0x2faeb3['query']=_[_0xe536('0x2c')](_0x48a8e2[_0xe536('0x2d')]);_0x2faeb3[_0xe536('0x2e')]=_[_0xe536('0x2f')](_0x2faeb3[_0xe536('0x2b')],_0x2faeb3[_0xe536('0x2d')]);_0x177aff[_0xe536('0x30')]=_[_0xe536('0x2f')](_0x2faeb3[_0xe536('0x2b')],qs[_0xe536('0x31')](_0x48a8e2[_0xe536('0x2d')][_0xe536('0x31')]));_0x177aff[_0xe536('0x30')]=_0x177aff[_0xe536('0x30')]['length']?_0x177aff[_0xe536('0x30')]:_0x2faeb3['model'];if(!_0x48a8e2[_0xe536('0x2d')]['hasOwnProperty'](_0xe536('0x32'))){_0x177aff[_0xe536('0x19')]=qs['limit'](_0x48a8e2[_0xe536('0x2d')]['limit']);_0x177aff[_0xe536('0x18')]=qs[_0xe536('0x18')](_0x48a8e2[_0xe536('0x2d')][_0xe536('0x18')]);}_0x177aff[_0xe536('0x33')]=qs[_0xe536('0x34')](_0x48a8e2[_0xe536('0x2d')][_0xe536('0x34')]);_0x177aff[_0xe536('0x35')]=qs[_0xe536('0x2e')](_[_0xe536('0x36')](_0x48a8e2['query'],_0x2faeb3[_0xe536('0x2e')]),_0x33ec18);if(_0x48a8e2[_0xe536('0x2d')][_0xe536('0x37')]){_0x177aff[_0xe536('0x35')]=_['merge'](_0x177aff[_0xe536('0x35')],{'$or':_[_0xe536('0x26')](_0x33ec18,function(_0x33365b){if(_0x33365b[_0xe536('0x38')]!=='VIRTUAL'){var _0x5ad164={};_0x5ad164[_0x33365b[_0xe536('0x24')]]={'$like':'%'+_0x48a8e2[_0xe536('0x2d')][_0xe536('0x37')]+'%'};return _0x5ad164;}})});}_0x177aff=_['merge']({},_0x177aff,_0x48a8e2[_0xe536('0x39')]);var _0x14f9ad={'where':_0x177aff[_0xe536('0x35')]};return db[_0xe536('0x27')][_0xe536('0x1b')](_0x14f9ad)[_0xe536('0x22')](function(_0x3d54c7){_0x1a7205[_0xe536('0x1b')]=_0x3d54c7;if(_0x48a8e2[_0xe536('0x2d')][_0xe536('0x3a')]){_0x177aff[_0xe536('0x3b')]=[{'all':!![]}];}return db[_0xe536('0x27')][_0xe536('0x3c')](_0x177aff);})[_0xe536('0x22')](function(_0x52f4cf){_0x1a7205[_0xe536('0x3d')]=_0x52f4cf;return _0x1a7205;})[_0xe536('0x22')](respondWithFilteredResult(_0x497bba,_0x177aff))[_0xe536('0x3e')](handleError(_0x497bba,null));};exports[_0xe536('0x3f')]=function(_0x2b9537,_0x23910f){var _0x4eaeee={'raw':!![],'where':{'id':_0x2b9537[_0xe536('0x40')]['id']}},_0x4d3fc9={};_0x4d3fc9[_0xe536('0x2b')]=_[_0xe536('0x2c')](db[_0xe536('0x27')]['rawAttributes']);_0x4d3fc9[_0xe536('0x2d')]=_['keys'](_0x2b9537['query']);_0x4d3fc9['filters']=_[_0xe536('0x2f')](_0x4d3fc9[_0xe536('0x2b')],_0x4d3fc9[_0xe536('0x2d')]);_0x4eaeee[_0xe536('0x30')]=_[_0xe536('0x2f')](_0x4d3fc9[_0xe536('0x2b')],qs[_0xe536('0x31')](_0x2b9537[_0xe536('0x2d')][_0xe536('0x31')]));_0x4eaeee[_0xe536('0x30')]=_0x4eaeee[_0xe536('0x30')]['length']?_0x4eaeee[_0xe536('0x30')]:_0x4d3fc9[_0xe536('0x2b')];if(_0x2b9537['query'][_0xe536('0x3a')]){_0x4eaeee[_0xe536('0x3b')]=[{'all':!![]}];}_0x4eaeee=_[_0xe536('0x41')]({},_0x4eaeee,_0x2b9537[_0xe536('0x39')]);return db[_0xe536('0x27')][_0xe536('0x42')](_0x4eaeee)['then'](handleEntityNotFound(_0x23910f,null))[_0xe536('0x22')](respondWithResult(_0x23910f,null))[_0xe536('0x3e')](handleError(_0x23910f,null));};exports[_0xe536('0x43')]=function(_0x17055b,_0x2c91ba){return db['SquareMessage'][_0xe536('0x43')](_0x17055b[_0xe536('0x44')],{})[_0xe536('0x22')](respondWithResult(_0x2c91ba,0xc9))[_0xe536('0x3e')](handleError(_0x2c91ba,null));};exports[_0xe536('0x45')]=function(_0xb0c2a0,_0x3f2803){if(_0xb0c2a0[_0xe536('0x44')]['id']){delete _0xb0c2a0['body']['id'];}return db['SquareMessage'][_0xe536('0x42')]({'where':{'id':_0xb0c2a0[_0xe536('0x40')]['id']}})[_0xe536('0x22')](handleEntityNotFound(_0x3f2803,null))['then'](saveUpdates(_0xb0c2a0[_0xe536('0x44')],null))[_0xe536('0x22')](respondWithResult(_0x3f2803,null))[_0xe536('0x3e')](handleError(_0x3f2803,null));};exports[_0xe536('0x21')]=function(_0x350ab1,_0x3245a2){return db[_0xe536('0x27')][_0xe536('0x42')]({'where':{'id':_0x350ab1[_0xe536('0x40')]['id']}})[_0xe536('0x22')](handleEntityNotFound(_0x3245a2,null))[_0xe536('0x22')](removeEntity(_0x3245a2,null))[_0xe536('0x3e')](handleError(_0x3245a2,null));};
\ No newline at end of file
index fcb03b4..8cfe4ae 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe232=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./squareMessage.attributes','define','square_messages'];(function(_0x53efa4,_0x1e673b){var _0x276274=function(_0x5a0479){while(--_0x5a0479){_0x53efa4['push'](_0x53efa4['shift']());}};_0x276274(++_0x1e673b);}(_0xe232,0x160));var _0x2e23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe232[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2e23('0x0'));var util=require(_0x2e23('0x1'));var logger=require(_0x2e23('0x2'))(_0x2e23('0x3'));var moment=require(_0x2e23('0x4'));var BPromise=require(_0x2e23('0x5'));var rp=require(_0x2e23('0x6'));var fs=require('fs');var path=require(_0x2e23('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2e23('0x8'));module['exports']=function(_0x3f76aa,_0x58f605){return _0x3f76aa[_0x2e23('0x9')]('SquareMessage',attributes,{'tableName':_0x2e23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfdea=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','exports','define','SquareMessage','square_messages'];(function(_0x22fa59,_0x59c7b7){var _0x38cab6=function(_0x19c880){while(--_0x19c880){_0x22fa59['push'](_0x22fa59['shift']());}};_0x38cab6(++_0x59c7b7);}(_0xfdea,0x1a4));var _0xafde=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xfdea[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0xafde('0x0'));var util=require(_0xafde('0x1'));var logger=require(_0xafde('0x2'))('api');var moment=require(_0xafde('0x3'));var BPromise=require('bluebird');var rp=require(_0xafde('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xafde('0x5'));var attributes=require('./squareMessage.attributes');module[_0xafde('0x6')]=function(_0x369d9e,_0x1f2dd3){return _0x369d9e[_0xafde('0x7')](_0xafde('0x8'),attributes,{'tableName':_0xafde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 93fabe5..9a96ef4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x08eb=['catch','lodash','util','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateSquareMessage','SquareMessage','options','then','stringify'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x08eb,0xb9));var _0xb08e=function(_0xa7b324,_0x3b80e0){_0xa7b324=_0xa7b324-0x0;var _0x5f4a8a=_0x08eb[_0xa7b324];return _0x5f4a8a;};'use strict';var _=require(_0xb08e('0x0'));var util=require(_0xb08e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb08e('0x2'));var db=require(_0xb08e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xb08e('0x4'))('rpc');var config=require(_0xb08e('0x5'));var jayson=require(_0xb08e('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2db935,_0x138ecc,_0x49c1a1){return new BPromise(function(_0x3a6c74,_0x2cd4ab){return client[_0xb08e('0x7')](_0x2db935,_0x49c1a1)['then'](function(_0x362be5){logger[_0xb08e('0x8')](_0xb08e('0x9'),_0x138ecc,_0xb08e('0xa'));logger[_0xb08e('0xb')](_0xb08e('0xc'),_0x138ecc,_0xb08e('0xa'),JSON['stringify'](_0x362be5));if(_0x362be5[_0xb08e('0xd')]){if(_0x362be5[_0xb08e('0xd')][_0xb08e('0xe')]===0x1f4){logger['error'](_0xb08e('0x9'),_0x138ecc,_0x362be5[_0xb08e('0xd')][_0xb08e('0xf')]);return _0x2cd4ab(_0x362be5['error'][_0xb08e('0xf')]);}logger[_0xb08e('0xd')](_0xb08e('0x9'),_0x138ecc,_0x362be5[_0xb08e('0xd')][_0xb08e('0xf')]);return _0x3a6c74(_0x362be5[_0xb08e('0xd')][_0xb08e('0xf')]);}else{logger['info'](_0xb08e('0x9'),_0x138ecc,_0xb08e('0xa'));_0x3a6c74(_0x362be5[_0xb08e('0x10')][_0xb08e('0xf')]);}})['catch'](function(_0x1b092a){logger['error'](_0xb08e('0x9'),_0x138ecc,_0x1b092a);_0x2cd4ab(_0x1b092a);});});}exports[_0xb08e('0x11')]=function(_0x27fecc){var _0x5caf95=this;return new Promise(function(_0x33a9eb,_0x1cb9ae){return db[_0xb08e('0x12')]['create'](_0x27fecc['body'],{'raw':_0x27fecc[_0xb08e('0x13')]?_0x27fecc[_0xb08e('0x13')]['raw']===undefined?!![]:![]:!![]})[_0xb08e('0x14')](function(_0x12d6ec){logger['info'](_0xb08e('0x11'),_0x27fecc);logger[_0xb08e('0xb')]('CreateSquareMessage',_0x27fecc,JSON[_0xb08e('0x15')](_0x12d6ec));_0x33a9eb(_0x12d6ec);})[_0xb08e('0x16')](function(_0x288222){logger['error'](_0xb08e('0x11'),_0x288222['message'],_0x27fecc);_0x1cb9ae(_0x5caf95['error'](0x1f4,_0x288222[_0xb08e('0xf')]));});});};
\ No newline at end of file
+var _0xf030=['error','code','message','info','result','catch','CreateSquareMessage','SquareMessage','create','options','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','SquareMessage,\x20%s,\x20%s','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0xf030,0x177));var _0x0f03=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf030[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x0f03('0x0'));var util=require('util');var moment=require(_0x0f03('0x1'));var BPromise=require(_0x0f03('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f03('0x3'));var db=require(_0x0f03('0x4'))['db'];var utils=require(_0x0f03('0x5'));var logger=require(_0x0f03('0x6'))(_0x0f03('0x7'));var config=require(_0x0f03('0x8'));var jayson=require(_0x0f03('0x9'));var client=jayson['client'][_0x0f03('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x291415,_0x810758,_0x536568){return new BPromise(function(_0x42e0ed,_0x5f5b5b){return client[_0x0f03('0xb')](_0x291415,_0x536568)[_0x0f03('0xc')](function(_0x85aeef){logger['info'](_0x0f03('0xd'),_0x810758,'request\x20sent');logger['debug'](_0x0f03('0xe'),_0x810758,_0x0f03('0xf'),JSON[_0x0f03('0x10')](_0x85aeef));if(_0x85aeef[_0x0f03('0x11')]){if(_0x85aeef['error'][_0x0f03('0x12')]===0x1f4){logger[_0x0f03('0x11')](_0x0f03('0xd'),_0x810758,_0x85aeef[_0x0f03('0x11')][_0x0f03('0x13')]);return _0x5f5b5b(_0x85aeef[_0x0f03('0x11')][_0x0f03('0x13')]);}logger[_0x0f03('0x11')](_0x0f03('0xd'),_0x810758,_0x85aeef[_0x0f03('0x11')][_0x0f03('0x13')]);return _0x42e0ed(_0x85aeef[_0x0f03('0x11')][_0x0f03('0x13')]);}else{logger[_0x0f03('0x14')](_0x0f03('0xd'),_0x810758,_0x0f03('0xf'));_0x42e0ed(_0x85aeef[_0x0f03('0x15')][_0x0f03('0x13')]);}})[_0x0f03('0x16')](function(_0x4fd052){logger[_0x0f03('0x11')]('SquareMessage,\x20%s,\x20%s',_0x810758,_0x4fd052);_0x5f5b5b(_0x4fd052);});});}exports[_0x0f03('0x17')]=function(_0x540658){var _0xedaa70=this;return new Promise(function(_0x1f4954,_0xc34c8c){return db[_0x0f03('0x18')][_0x0f03('0x19')](_0x540658['body'],{'raw':_0x540658[_0x0f03('0x1a')]?_0x540658[_0x0f03('0x1a')][_0x0f03('0x1b')]===undefined?!![]:![]:!![]})[_0x0f03('0xc')](function(_0x3b1822){logger[_0x0f03('0x14')]('CreateSquareMessage',_0x540658);logger['debug']('CreateSquareMessage',_0x540658,JSON['stringify'](_0x3b1822));_0x1f4954(_0x3b1822);})[_0x0f03('0x16')](function(_0x40f101){logger['error'](_0x0f03('0x17'),_0x40f101['message'],_0x540658);_0xc34c8c(_0xedaa70[_0x0f03('0x11')](0x1f4,_0x40f101[_0x0f03('0x13')]));});});};
\ No newline at end of file
index 67b7a92..39bea0a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa00b=['get','isAuthenticated','/:id','show','/:id/test','test','post','create','put','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller'];(function(_0xf0d35,_0xce9c1c){var _0x5ba3bc=function(_0x3314d3){while(--_0x3314d3){_0xf0d35['push'](_0xf0d35['shift']());}};_0x5ba3bc(++_0xce9c1c);}(_0xa00b,0xc9));var _0xba00=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa00b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xba00('0x0'));var util=require('util');var path=require(_0xba00('0x1'));var timeout=require(_0xba00('0x2'));var express=require(_0xba00('0x3'));var router=express['Router']();var fs_extra=require(_0xba00('0x4'));var auth=require(_0xba00('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba00('0x6'));var controller=require(_0xba00('0x7'));router[_0xba00('0x8')]('/',auth[_0xba00('0x9')](),controller['index']);router['get'](_0xba00('0xa'),auth[_0xba00('0x9')](),controller[_0xba00('0xb')]);router[_0xba00('0x8')](_0xba00('0xc'),auth[_0xba00('0x9')](),timeout('15s'),controller[_0xba00('0xd')]);router[_0xba00('0xe')]('/',auth[_0xba00('0x9')](),controller[_0xba00('0xf')]);router[_0xba00('0x10')](_0xba00('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xba00('0xa'),auth['isAuthenticated'](),controller[_0xba00('0x11')]);module[_0xba00('0x12')]=router;
\ No newline at end of file
+var _0x1604=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','post','update','delete','destroy','exports','multer'];(function(_0x29a904,_0x13a67e){var _0x307e74=function(_0x55046f){while(--_0x55046f){_0x29a904['push'](_0x29a904['shift']());}};_0x307e74(++_0x13a67e);}(_0x1604,0x107));var _0x4160=function(_0x4b8575,_0xb21ebe){_0x4b8575=_0x4b8575-0x0;var _0xacbd81=_0x1604[_0x4b8575];return _0xacbd81;};'use strict';var multer=require(_0x4160('0x0'));var util=require(_0x4160('0x1'));var path=require(_0x4160('0x2'));var timeout=require(_0x4160('0x3'));var express=require('express');var router=express[_0x4160('0x4')]();var fs_extra=require(_0x4160('0x5'));var auth=require(_0x4160('0x6'));var interaction=require(_0x4160('0x7'));var config=require(_0x4160('0x8'));var controller=require(_0x4160('0x9'));router[_0x4160('0xa')]('/',auth[_0x4160('0xb')](),controller[_0x4160('0xc')]);router['get'](_0x4160('0xd'),auth['isAuthenticated'](),controller[_0x4160('0xe')]);router[_0x4160('0xa')](_0x4160('0xf'),auth['isAuthenticated'](),timeout('15s'),controller[_0x4160('0x10')]);router[_0x4160('0x11')]('/',auth[_0x4160('0xb')](),controller['create']);router['put'](_0x4160('0xd'),auth[_0x4160('0xb')](),controller[_0x4160('0x12')]);router[_0x4160('0x13')](_0x4160('0xd'),auth[_0x4160('0xb')](),controller[_0x4160('0x14')]);module[_0x4160('0x15')]=router;
\ No newline at end of file
index 55e8ae4..412fd39 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe6af=['sequelize','exports','STRING','name'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xe6af,0x194));var _0xfe6a=function(_0x297afe,_0x33391a){_0x297afe=_0x297afe-0x0;var _0x589de6=_0xe6af[_0x297afe];return _0x589de6;};'use strict';var Sequelize=require(_0xfe6a('0x0'));module[_0xfe6a('0x1')]={'name':{'type':Sequelize[_0xfe6a('0x2')],'unique':_0xfe6a('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfe6a('0x2')]}};
\ No newline at end of file
+var _0x0276=['exports','STRING','sequelize'];(function(_0x1348c0,_0x7a9608){var _0x8a6441=function(_0x41ba2a){while(--_0x41ba2a){_0x1348c0['push'](_0x1348c0['shift']());}};_0x8a6441(++_0x7a9608);}(_0x0276,0xd7));var _0x6027=function(_0x3a177b,_0x10d9fe){_0x3a177b=_0x3a177b-0x0;var _0x205959=_0x0276[_0x3a177b];return _0x205959;};'use strict';var Sequelize=require(_0x6027('0x0'));module[_0x6027('0x1')]={'name':{'type':Sequelize[_0x6027('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index ab99d7f..78445c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1ee2=['sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','save','update','then','destroy','get','ODBC','UserProfileResource','end','error','name','send','index','map','fieldName','type','key','query','filters','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','SquareOdbc','includeAll','findAll','rows','catch','show','params','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','test','dsn','odbc','openSync','closeSync','rimraf','fast-json-patch','mustache','util','path'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x1ee2,0xfd));var _0x21ee=function(_0x58129e,_0x3450c7){_0x58129e=_0x58129e-0x0;var _0x23d8ee=_0x1ee2[_0x58129e];return _0x23d8ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x21ee('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x21ee('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x21ee('0x2'));var util=require(_0x21ee('0x3'));var path=require(_0x21ee('0x4'));var sox=require(_0x21ee('0x5'));var csv=require(_0x21ee('0x6'));var ejs=require(_0x21ee('0x7'));var fs=require('fs');var fs_extra=require(_0x21ee('0x8'));var _=require(_0x21ee('0x9'));var squel=require(_0x21ee('0xa'));var crypto=require(_0x21ee('0xb'));var jsforce=require(_0x21ee('0xc'));var deskjs=require(_0x21ee('0xd'));var toCsv=require('to-csv');var querystring=require(_0x21ee('0xe'));var Papa=require(_0x21ee('0xf'));var Redis=require('ioredis');var authService=require(_0x21ee('0x10'));var qs=require(_0x21ee('0x11'));var as=require(_0x21ee('0x12'));var hardwareService=require(_0x21ee('0x13'));var logger=require(_0x21ee('0x14'))(_0x21ee('0x15'));var utils=require(_0x21ee('0x16'));var config=require(_0x21ee('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x21ee('0x18'))['db'];function respondWithStatusCode(_0x4c78b3,_0x4dafcc){_0x4dafcc=_0x4dafcc||0xcc;return function(_0x171dba){if(_0x171dba){return _0x4c78b3[_0x21ee('0x19')](_0x4dafcc);}return _0x4c78b3['status'](_0x4dafcc)['end']();};}function respondWithResult(_0x18c9e7,_0x3d2818){_0x3d2818=_0x3d2818||0xc8;return function(_0x52fd0a){if(_0x52fd0a){return _0x18c9e7[_0x21ee('0x1a')](_0x3d2818)[_0x21ee('0x1b')](_0x52fd0a);}};}function respondWithFilteredResult(_0x4e5547,_0x4822c1){return function(_0xa25e2c){if(_0xa25e2c){var _0x100a26=typeof _0x4822c1[_0x21ee('0x1c')]===_0x21ee('0x1d')&&typeof _0x4822c1['limit']===_0x21ee('0x1d');var _0x1e9286=_0xa25e2c[_0x21ee('0x1e')];var _0x10d530=_0x100a26?0x0:_0x4822c1[_0x21ee('0x1c')];var _0x3da3fd=_0x100a26?_0xa25e2c['count']:_0x4822c1[_0x21ee('0x1c')]+_0x4822c1[_0x21ee('0x1f')];var _0x4905e4;if(_0x3da3fd>=_0x1e9286){_0x3da3fd=_0x1e9286;_0x4905e4=0xc8;}else{_0x4905e4=0xce;}_0x4e5547['status'](_0x4905e4);return _0x4e5547[_0x21ee('0x20')]('Content-Range',_0x10d530+'-'+_0x3da3fd+'/'+_0x1e9286)[_0x21ee('0x1b')](_0xa25e2c);}return null;};}function patchUpdates(_0x70953){return function(_0x3cfe04){try{jsonpatch['apply'](_0x3cfe04,_0x70953,!![]);}catch(_0x206d83){return BPromise['reject'](_0x206d83);}return _0x3cfe04[_0x21ee('0x21')]();};}function saveUpdates(_0x2bd088,_0x2a9ba2){return function(_0x13385f){if(_0x13385f){return _0x13385f[_0x21ee('0x22')](_0x2bd088)[_0x21ee('0x23')](function(_0x1791b4){return _0x1791b4;});}return null;};}function removeEntity(_0x3fcfbc,_0x24cdfe){return function(_0x57fb82){if(_0x57fb82){return _0x57fb82[_0x21ee('0x24')]()[_0x21ee('0x23')](function(){var _0x205049=_0x57fb82[_0x21ee('0x25')]({'plain':!![]});var _0x4762d0=_0x21ee('0x26');return db[_0x21ee('0x27')][_0x21ee('0x24')]({'where':{'type':_0x4762d0,'resourceId':_0x205049['id']}})[_0x21ee('0x23')](function(){return _0x57fb82;});})[_0x21ee('0x23')](function(){_0x3fcfbc[_0x21ee('0x1a')](0xcc)[_0x21ee('0x28')]();});}};}function handleEntityNotFound(_0x26b2d2,_0x4fdc4e){return function(_0x5e85d5){if(!_0x5e85d5){_0x26b2d2['sendStatus'](0x194);}return _0x5e85d5;};}function handleError(_0x44e267,_0x107fcd){_0x107fcd=_0x107fcd||0x1f4;return function(_0x49efb6){logger[_0x21ee('0x29')](_0x49efb6['stack']);if(_0x49efb6[_0x21ee('0x2a')]){delete _0x49efb6[_0x21ee('0x2a')];}_0x44e267['status'](_0x107fcd)[_0x21ee('0x2b')](_0x49efb6);};}exports[_0x21ee('0x2c')]=function(_0x12e54c,_0x5e1bc9){var _0xb41176={},_0x23e42c={},_0x40e789={'count':0x0,'rows':[]};var _0x35fe0f=_[_0x21ee('0x2d')](db['SquareOdbc']['rawAttributes'],function(_0x3d9f4e){return{'name':_0x3d9f4e[_0x21ee('0x2e')],'type':_0x3d9f4e[_0x21ee('0x2f')][_0x21ee('0x30')]};});_0x23e42c['model']=_['map'](_0x35fe0f,_0x21ee('0x2a'));_0x23e42c[_0x21ee('0x31')]=_['keys'](_0x12e54c[_0x21ee('0x31')]);_0x23e42c[_0x21ee('0x32')]=_['intersection'](_0x23e42c['model'],_0x23e42c[_0x21ee('0x31')]);_0xb41176[_0x21ee('0x33')]=_[_0x21ee('0x34')](_0x23e42c[_0x21ee('0x35')],qs[_0x21ee('0x36')](_0x12e54c[_0x21ee('0x31')][_0x21ee('0x36')]));_0xb41176[_0x21ee('0x33')]=_0xb41176['attributes'][_0x21ee('0x37')]?_0xb41176[_0x21ee('0x33')]:_0x23e42c[_0x21ee('0x35')];if(!_0x12e54c[_0x21ee('0x31')][_0x21ee('0x38')]('nolimit')){_0xb41176['limit']=qs[_0x21ee('0x1f')](_0x12e54c[_0x21ee('0x31')][_0x21ee('0x1f')]);_0xb41176[_0x21ee('0x1c')]=qs[_0x21ee('0x1c')](_0x12e54c[_0x21ee('0x31')][_0x21ee('0x1c')]);}_0xb41176[_0x21ee('0x39')]=qs['sort'](_0x12e54c[_0x21ee('0x31')][_0x21ee('0x3a')]);_0xb41176[_0x21ee('0x3b')]=qs[_0x21ee('0x32')](_['pick'](_0x12e54c[_0x21ee('0x31')],_0x23e42c['filters']),_0x35fe0f);if(_0x12e54c[_0x21ee('0x31')]['filter']){_0xb41176[_0x21ee('0x3b')]=_['merge'](_0xb41176['where'],{'$or':_[_0x21ee('0x2d')](_0x35fe0f,function(_0x51f348){if(_0x51f348[_0x21ee('0x2f')]!=='VIRTUAL'){var _0x8b20de={};_0x8b20de[_0x51f348[_0x21ee('0x2a')]]={'$like':'%'+_0x12e54c[_0x21ee('0x31')][_0x21ee('0x3c')]+'%'};return _0x8b20de;}})});}_0xb41176=_[_0x21ee('0x3d')]({},_0xb41176,_0x12e54c[_0x21ee('0x3e')]);var _0x28b1f7={'where':_0xb41176[_0x21ee('0x3b')]};return db[_0x21ee('0x3f')][_0x21ee('0x1e')](_0x28b1f7)[_0x21ee('0x23')](function(_0x5cdec5){_0x40e789[_0x21ee('0x1e')]=_0x5cdec5;if(_0x12e54c['query'][_0x21ee('0x40')]){_0xb41176['include']=[{'all':!![]}];}return db['SquareOdbc'][_0x21ee('0x41')](_0xb41176);})[_0x21ee('0x23')](function(_0x22bd9b){_0x40e789[_0x21ee('0x42')]=_0x22bd9b;return _0x40e789;})['then'](respondWithFilteredResult(_0x5e1bc9,_0xb41176))[_0x21ee('0x43')](handleError(_0x5e1bc9,null));};exports[_0x21ee('0x44')]=function(_0x2afcb9,_0x69afa0){var _0x8fbcb6={'raw':!![],'where':{'id':_0x2afcb9[_0x21ee('0x45')]['id']}},_0x23a1b4={};_0x23a1b4[_0x21ee('0x35')]=_['keys'](db['SquareOdbc']['rawAttributes']);_0x23a1b4[_0x21ee('0x31')]=_[_0x21ee('0x46')](_0x2afcb9[_0x21ee('0x31')]);_0x23a1b4[_0x21ee('0x32')]=_[_0x21ee('0x34')](_0x23a1b4[_0x21ee('0x35')],_0x23a1b4[_0x21ee('0x31')]);_0x8fbcb6[_0x21ee('0x33')]=_[_0x21ee('0x34')](_0x23a1b4['model'],qs[_0x21ee('0x36')](_0x2afcb9[_0x21ee('0x31')][_0x21ee('0x36')]));_0x8fbcb6[_0x21ee('0x33')]=_0x8fbcb6[_0x21ee('0x33')]['length']?_0x8fbcb6[_0x21ee('0x33')]:_0x23a1b4[_0x21ee('0x35')];if(_0x2afcb9[_0x21ee('0x31')][_0x21ee('0x40')]){_0x8fbcb6[_0x21ee('0x47')]=[{'all':!![]}];}_0x8fbcb6=_['merge']({},_0x8fbcb6,_0x2afcb9[_0x21ee('0x3e')]);return db[_0x21ee('0x3f')][_0x21ee('0x48')](_0x8fbcb6)[_0x21ee('0x23')](handleEntityNotFound(_0x69afa0,null))[_0x21ee('0x23')](respondWithResult(_0x69afa0,null))[_0x21ee('0x43')](handleError(_0x69afa0,null));};exports['create']=function(_0x12e81c,_0x38f1f8){return db[_0x21ee('0x3f')][_0x21ee('0x49')](_0x12e81c['body'],{})[_0x21ee('0x23')](function(_0x266149){var _0x4b83d4=_0x12e81c[_0x21ee('0x4a')][_0x21ee('0x25')]({'plain':!![]});if(!_0x4b83d4)throw new Error(_0x21ee('0x4b'));if(_0x4b83d4[_0x21ee('0x4c')]===_0x21ee('0x4a')){var _0x31fd45=_0x266149[_0x21ee('0x25')]({'plain':!![]});var _0x5c2e37=_0x21ee('0x26');return db[_0x21ee('0x4d')]['find']({'where':{'name':_0x5c2e37,'userProfileId':_0x4b83d4[_0x21ee('0x4e')]},'raw':!![]})[_0x21ee('0x23')](function(_0x2a63ae){if(_0x2a63ae&&_0x2a63ae['autoAssociation']===0x0){return db['UserProfileResource'][_0x21ee('0x49')]({'name':_0x31fd45[_0x21ee('0x2a')],'resourceId':_0x31fd45['id'],'type':_0x2a63ae[_0x21ee('0x2a')],'sectionId':_0x2a63ae['id']},{})[_0x21ee('0x23')](function(){return _0x266149;});}else{return _0x266149;}})['catch'](function(_0x4c0ab7){logger[_0x21ee('0x29')](_0x21ee('0x4f'),_0x4c0ab7);throw _0x4c0ab7;});}return _0x266149;})[_0x21ee('0x23')](respondWithResult(_0x38f1f8,0xc9))[_0x21ee('0x43')](handleError(_0x38f1f8,null));};exports['update']=function(_0x4b0b39,_0x812f62){if(_0x4b0b39[_0x21ee('0x50')]['id']){delete _0x4b0b39[_0x21ee('0x50')]['id'];}return db[_0x21ee('0x3f')][_0x21ee('0x48')]({'where':{'id':_0x4b0b39[_0x21ee('0x45')]['id']}})['then'](handleEntityNotFound(_0x812f62,null))[_0x21ee('0x23')](saveUpdates(_0x4b0b39['body'],null))['then'](respondWithResult(_0x812f62,null))[_0x21ee('0x43')](handleError(_0x812f62,null));};exports['destroy']=function(_0x523299,_0x4d1998){return db[_0x21ee('0x3f')][_0x21ee('0x48')]({'where':{'id':_0x523299['params']['id']}})[_0x21ee('0x23')](handleEntityNotFound(_0x4d1998,null))[_0x21ee('0x23')](removeEntity(_0x4d1998,null))['catch'](handleError(_0x4d1998,null));};exports[_0x21ee('0x51')]=function(_0x550f48,_0x1e0401,_0x577b15){var _0x5c57f4;return db[_0x21ee('0x3f')]['find']({'where':{'id':_0x550f48[_0x21ee('0x45')]['id']},'attributes':['id',_0x21ee('0x52')]})[_0x21ee('0x23')](handleEntityNotFound(_0x1e0401,null))[_0x21ee('0x23')](function(_0x5f1633){if(_0x5f1633){var _0x168af4=require(_0x21ee('0x53'))();_0x168af4[_0x21ee('0x54')](_0x5f1633[_0x21ee('0x52')]);_0x168af4[_0x21ee('0x55')]();return _0x5f1633;}})[_0x21ee('0x23')](respondWithResult(_0x1e0401,null))['catch'](handleError(_0x1e0401,null));};
\ No newline at end of file
+var _0xeeeb=['ODBC','UserProfileResource','error','stack','name','index','map','SquareOdbc','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','merge','filter','options','count','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','get'];(function(_0x32daac,_0x24ad7f){var _0x28ecd0=function(_0x29f33e){while(--_0x29f33e){_0x32daac['push'](_0x32daac['shift']());}};_0x28ecd0(++_0x24ad7f);}(_0xeeeb,0x80));var _0xbeee=function(_0x4a65f4,_0x31defe){_0x4a65f4=_0x4a65f4-0x0;var _0x5b3c63=_0xeeeb[_0x4a65f4];return _0x5b3c63;};'use strict';var emlformat=require(_0xbeee('0x0'));var rimraf=require(_0xbeee('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbeee('0x2'));var rp=require(_0xbeee('0x3'));var moment=require(_0xbeee('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xbeee('0x5'));var sox=require(_0xbeee('0x6'));var csv=require(_0xbeee('0x7'));var ejs=require(_0xbeee('0x8'));var fs=require('fs');var fs_extra=require(_0xbeee('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbeee('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbeee('0x7'));var querystring=require('querystring');var Papa=require(_0xbeee('0xb'));var Redis=require(_0xbeee('0xc'));var authService=require(_0xbeee('0xd'));var qs=require(_0xbeee('0xe'));var as=require(_0xbeee('0xf'));var hardwareService=require(_0xbeee('0x10'));var logger=require(_0xbeee('0x11'))('api');var utils=require(_0xbeee('0x12'));var config=require(_0xbeee('0x13'));var licenseUtil=require(_0xbeee('0x14'));var db=require(_0xbeee('0x15'))['db'];function respondWithStatusCode(_0x55d7d8,_0x3f479e){_0x3f479e=_0x3f479e||0xcc;return function(_0x212573){if(_0x212573){return _0x55d7d8[_0xbeee('0x16')](_0x3f479e);}return _0x55d7d8[_0xbeee('0x17')](_0x3f479e)[_0xbeee('0x18')]();};}function respondWithResult(_0x270cbb,_0x3acc9b){_0x3acc9b=_0x3acc9b||0xc8;return function(_0x2b371d){if(_0x2b371d){return _0x270cbb[_0xbeee('0x17')](_0x3acc9b)[_0xbeee('0x19')](_0x2b371d);}};}function respondWithFilteredResult(_0x2eee3f,_0x4a38f1){return function(_0x51c9d6){if(_0x51c9d6){var _0xc29484=typeof _0x4a38f1[_0xbeee('0x1a')]===_0xbeee('0x1b')&&typeof _0x4a38f1[_0xbeee('0x1c')]==='undefined';var _0x583982=_0x51c9d6['count'];var _0x4e266a=_0xc29484?0x0:_0x4a38f1['offset'];var _0x434620=_0xc29484?_0x51c9d6['count']:_0x4a38f1[_0xbeee('0x1a')]+_0x4a38f1[_0xbeee('0x1c')];var _0x2bf716;if(_0x434620>=_0x583982){_0x434620=_0x583982;_0x2bf716=0xc8;}else{_0x2bf716=0xce;}_0x2eee3f[_0xbeee('0x17')](_0x2bf716);return _0x2eee3f[_0xbeee('0x1d')](_0xbeee('0x1e'),_0x4e266a+'-'+_0x434620+'/'+_0x583982)['json'](_0x51c9d6);}return null;};}function patchUpdates(_0x109cb9){return function(_0x37e0a6){try{jsonpatch[_0xbeee('0x1f')](_0x37e0a6,_0x109cb9,!![]);}catch(_0x8939c5){return BPromise[_0xbeee('0x20')](_0x8939c5);}return _0x37e0a6[_0xbeee('0x21')]();};}function saveUpdates(_0x5b3f59,_0x5f0dc7){return function(_0x451b30){if(_0x451b30){return _0x451b30[_0xbeee('0x22')](_0x5b3f59)[_0xbeee('0x23')](function(_0x506da4){return _0x506da4;});}return null;};}function removeEntity(_0x1fb7ae,_0x943e01){return function(_0x16e777){if(_0x16e777){return _0x16e777[_0xbeee('0x24')]()['then'](function(){var _0x512976=_0x16e777[_0xbeee('0x25')]({'plain':!![]});var _0x46428e=_0xbeee('0x26');return db[_0xbeee('0x27')]['destroy']({'where':{'type':_0x46428e,'resourceId':_0x512976['id']}})[_0xbeee('0x23')](function(){return _0x16e777;});})[_0xbeee('0x23')](function(){_0x1fb7ae[_0xbeee('0x17')](0xcc)[_0xbeee('0x18')]();});}};}function handleEntityNotFound(_0x138939,_0x5df055){return function(_0x593944){if(!_0x593944){_0x138939[_0xbeee('0x16')](0x194);}return _0x593944;};}function handleError(_0x11aea0,_0xbc94ca){_0xbc94ca=_0xbc94ca||0x1f4;return function(_0x545883){logger[_0xbeee('0x28')](_0x545883[_0xbeee('0x29')]);if(_0x545883['name']){delete _0x545883[_0xbeee('0x2a')];}_0x11aea0[_0xbeee('0x17')](_0xbc94ca)['send'](_0x545883);};}exports[_0xbeee('0x2b')]=function(_0xd9c888,_0x40b206){var _0x15d102={},_0x8940c1={},_0x5b2022={'count':0x0,'rows':[]};var _0x19f931=_[_0xbeee('0x2c')](db[_0xbeee('0x2d')][_0xbeee('0x2e')],function(_0x2dad1e){return{'name':_0x2dad1e[_0xbeee('0x2f')],'type':_0x2dad1e[_0xbeee('0x30')]['key']};});_0x8940c1[_0xbeee('0x31')]=_[_0xbeee('0x2c')](_0x19f931,_0xbeee('0x2a'));_0x8940c1['query']=_[_0xbeee('0x32')](_0xd9c888[_0xbeee('0x33')]);_0x8940c1[_0xbeee('0x34')]=_['intersection'](_0x8940c1[_0xbeee('0x31')],_0x8940c1[_0xbeee('0x33')]);_0x15d102[_0xbeee('0x35')]=_['intersection'](_0x8940c1[_0xbeee('0x31')],qs[_0xbeee('0x36')](_0xd9c888[_0xbeee('0x33')][_0xbeee('0x36')]));_0x15d102['attributes']=_0x15d102[_0xbeee('0x35')][_0xbeee('0x37')]?_0x15d102[_0xbeee('0x35')]:_0x8940c1[_0xbeee('0x31')];if(!_0xd9c888['query'][_0xbeee('0x38')]('nolimit')){_0x15d102[_0xbeee('0x1c')]=qs[_0xbeee('0x1c')](_0xd9c888[_0xbeee('0x33')][_0xbeee('0x1c')]);_0x15d102[_0xbeee('0x1a')]=qs[_0xbeee('0x1a')](_0xd9c888[_0xbeee('0x33')]['offset']);}_0x15d102[_0xbeee('0x39')]=qs['sort'](_0xd9c888[_0xbeee('0x33')][_0xbeee('0x3a')]);_0x15d102['where']=qs[_0xbeee('0x34')](_['pick'](_0xd9c888['query'],_0x8940c1['filters']),_0x19f931);if(_0xd9c888[_0xbeee('0x33')]['filter']){_0x15d102[_0xbeee('0x3b')]=_[_0xbeee('0x3c')](_0x15d102[_0xbeee('0x3b')],{'$or':_[_0xbeee('0x2c')](_0x19f931,function(_0xcface){if(_0xcface['type']!=='VIRTUAL'){var _0x1470e0={};_0x1470e0[_0xcface[_0xbeee('0x2a')]]={'$like':'%'+_0xd9c888[_0xbeee('0x33')][_0xbeee('0x3d')]+'%'};return _0x1470e0;}})});}_0x15d102=_['merge']({},_0x15d102,_0xd9c888[_0xbeee('0x3e')]);var _0x23342c={'where':_0x15d102[_0xbeee('0x3b')]};return db['SquareOdbc']['count'](_0x23342c)['then'](function(_0x5598c0){_0x5b2022[_0xbeee('0x3f')]=_0x5598c0;if(_0xd9c888['query'][_0xbeee('0x40')]){_0x15d102[_0xbeee('0x41')]=[{'all':!![]}];}return db[_0xbeee('0x2d')][_0xbeee('0x42')](_0x15d102);})[_0xbeee('0x23')](function(_0x272e69){_0x5b2022[_0xbeee('0x43')]=_0x272e69;return _0x5b2022;})[_0xbeee('0x23')](respondWithFilteredResult(_0x40b206,_0x15d102))[_0xbeee('0x44')](handleError(_0x40b206,null));};exports['show']=function(_0x181ba7,_0x803cdf){var _0x49c6c6={'raw':!![],'where':{'id':_0x181ba7[_0xbeee('0x45')]['id']}},_0x26e942={};_0x26e942[_0xbeee('0x31')]=_[_0xbeee('0x32')](db[_0xbeee('0x2d')][_0xbeee('0x2e')]);_0x26e942['query']=_[_0xbeee('0x32')](_0x181ba7[_0xbeee('0x33')]);_0x26e942[_0xbeee('0x34')]=_[_0xbeee('0x46')](_0x26e942[_0xbeee('0x31')],_0x26e942[_0xbeee('0x33')]);_0x49c6c6[_0xbeee('0x35')]=_[_0xbeee('0x46')](_0x26e942[_0xbeee('0x31')],qs[_0xbeee('0x36')](_0x181ba7[_0xbeee('0x33')][_0xbeee('0x36')]));_0x49c6c6[_0xbeee('0x35')]=_0x49c6c6['attributes']['length']?_0x49c6c6[_0xbeee('0x35')]:_0x26e942[_0xbeee('0x31')];if(_0x181ba7['query'][_0xbeee('0x40')]){_0x49c6c6[_0xbeee('0x41')]=[{'all':!![]}];}_0x49c6c6=_[_0xbeee('0x3c')]({},_0x49c6c6,_0x181ba7[_0xbeee('0x3e')]);return db[_0xbeee('0x2d')][_0xbeee('0x47')](_0x49c6c6)[_0xbeee('0x23')](handleEntityNotFound(_0x803cdf,null))[_0xbeee('0x23')](respondWithResult(_0x803cdf,null))[_0xbeee('0x44')](handleError(_0x803cdf,null));};exports['create']=function(_0x548d3a,_0xf09d99){return db[_0xbeee('0x2d')][_0xbeee('0x48')](_0x548d3a[_0xbeee('0x49')],{})[_0xbeee('0x23')](function(_0x38d9b7){var _0x325167=_0x548d3a[_0xbeee('0x4a')][_0xbeee('0x25')]({'plain':!![]});if(!_0x325167)throw new Error(_0xbeee('0x4b'));if(_0x325167['role']==='user'){var _0x2607cd=_0x38d9b7[_0xbeee('0x25')]({'plain':!![]});var _0x5ea4fb=_0xbeee('0x26');return db[_0xbeee('0x4c')][_0xbeee('0x47')]({'where':{'name':_0x5ea4fb,'userProfileId':_0x325167[_0xbeee('0x4d')]},'raw':!![]})['then'](function(_0x9a24af){if(_0x9a24af&&_0x9a24af[_0xbeee('0x4e')]===0x0){return db[_0xbeee('0x27')]['create']({'name':_0x2607cd[_0xbeee('0x2a')],'resourceId':_0x2607cd['id'],'type':_0x9a24af[_0xbeee('0x2a')],'sectionId':_0x9a24af['id']},{})['then'](function(){return _0x38d9b7;});}else{return _0x38d9b7;}})[_0xbeee('0x44')](function(_0x360d41){logger['error'](_0xbeee('0x4f'),_0x360d41);throw _0x360d41;});}return _0x38d9b7;})['then'](respondWithResult(_0xf09d99,0xc9))[_0xbeee('0x44')](handleError(_0xf09d99,null));};exports[_0xbeee('0x22')]=function(_0x4d5061,_0x26997b){if(_0x4d5061[_0xbeee('0x49')]['id']){delete _0x4d5061[_0xbeee('0x49')]['id'];}return db[_0xbeee('0x2d')][_0xbeee('0x47')]({'where':{'id':_0x4d5061[_0xbeee('0x45')]['id']}})['then'](handleEntityNotFound(_0x26997b,null))[_0xbeee('0x23')](saveUpdates(_0x4d5061[_0xbeee('0x49')],null))[_0xbeee('0x23')](respondWithResult(_0x26997b,null))[_0xbeee('0x44')](handleError(_0x26997b,null));};exports[_0xbeee('0x24')]=function(_0x257a90,_0x318a7c){return db[_0xbeee('0x2d')][_0xbeee('0x47')]({'where':{'id':_0x257a90[_0xbeee('0x45')]['id']}})[_0xbeee('0x23')](handleEntityNotFound(_0x318a7c,null))[_0xbeee('0x23')](removeEntity(_0x318a7c,null))[_0xbeee('0x44')](handleError(_0x318a7c,null));};exports['test']=function(_0x1631f1,_0x3b9253,_0x59ce9d){var _0x33540a;return db[_0xbeee('0x2d')]['find']({'where':{'id':_0x1631f1[_0xbeee('0x45')]['id']},'attributes':['id',_0xbeee('0x50')]})[_0xbeee('0x23')](handleEntityNotFound(_0x3b9253,null))['then'](function(_0xec2cb1){if(_0xec2cb1){var _0x46f922=require(_0xbeee('0x51'))();_0x46f922['openSync'](_0xec2cb1[_0xbeee('0x50')]);_0x46f922[_0xbeee('0x52')]();return _0xec2cb1;}})['then'](respondWithResult(_0x3b9253,null))[_0xbeee('0x44')](handleError(_0x3b9253,null));};
\ No newline at end of file
index 14aa268..795a2a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe310=['square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','SquareOdbc'];(function(_0xe5287b,_0x26b8ab){var _0x346f77=function(_0x4d52d7){while(--_0x4d52d7){_0xe5287b['push'](_0xe5287b['shift']());}};_0x346f77(++_0x26b8ab);}(_0xe310,0x1a5));var _0x0e31=function(_0x4b4396,_0x39907d){_0x4b4396=_0x4b4396-0x0;var _0x52af56=_0xe310[_0x4b4396];return _0x52af56;};'use strict';var _=require(_0x0e31('0x0'));var util=require(_0x0e31('0x1'));var logger=require(_0x0e31('0x2'))(_0x0e31('0x3'));var moment=require(_0x0e31('0x4'));var BPromise=require(_0x0e31('0x5'));var rp=require(_0x0e31('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e31('0x7'));var config=require(_0x0e31('0x8'));var attributes=require('./squareOdbc.attributes');module[_0x0e31('0x9')]=function(_0x37f26d,_0x37a83b){return _0x37f26d['define'](_0x0e31('0xa'),attributes,{'tableName':_0x0e31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xf77c=['request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','square_odbc','../../config/logger','api','moment','bluebird'];(function(_0x4b8412,_0x235b3d){var _0x1ed9ed=function(_0x455209){while(--_0x455209){_0x4b8412['push'](_0x4b8412['shift']());}};_0x1ed9ed(++_0x235b3d);}(_0xf77c,0x1a0));var _0xcf77=function(_0x4c1f1f,_0x3aa18d){_0x4c1f1f=_0x4c1f1f-0x0;var _0x4f9e3c=_0xf77c[_0x4c1f1f];return _0x4f9e3c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xcf77('0x0'))(_0xcf77('0x1'));var moment=require(_0xcf77('0x2'));var BPromise=require(_0xcf77('0x3'));var rp=require(_0xcf77('0x4'));var fs=require('fs');var path=require(_0xcf77('0x5'));var rimraf=require(_0xcf77('0x6'));var config=require(_0xcf77('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xcf77('0x8')]=function(_0xfafc1a,_0xdef53a){return _0xfafc1a[_0xcf77('0x9')](_0xcf77('0xa'),attributes,{'tableName':_0xcf77('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index baba861..e75acd1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f89=['http','then','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','SquareOdbc,\x20%s,\x20%s','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','info','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x5a42c6,_0x952449){var _0x1c640c=function(_0x13af00){while(--_0x13af00){_0x5a42c6['push'](_0x5a42c6['shift']());}};_0x1c640c(++_0x952449);}(_0x5f89,0x152));var _0x95f8=function(_0x25f3f2,_0x3a66e1){_0x25f3f2=_0x25f3f2-0x0;var _0x15e57f=_0x5f89[_0x25f3f2];return _0x15e57f;};'use strict';var _=require('lodash');var util=require(_0x95f8('0x0'));var moment=require('moment');var BPromise=require(_0x95f8('0x1'));var rs=require(_0x95f8('0x2'));var fs=require('fs');var Redis=require(_0x95f8('0x3'));var db=require(_0x95f8('0x4'))['db'];var utils=require(_0x95f8('0x5'));var logger=require(_0x95f8('0x6'))('rpc');var config=require(_0x95f8('0x7'));var jayson=require(_0x95f8('0x8'));var client=jayson[_0x95f8('0x9')][_0x95f8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b201f,_0x10ef45,_0x423b05){return new BPromise(function(_0x1963ca,_0x26108c){return client['request'](_0x4b201f,_0x423b05)[_0x95f8('0xb')](function(_0x2d7ed2){logger['info']('SquareOdbc,\x20%s,\x20%s',_0x10ef45,_0x95f8('0xc'));logger['debug'](_0x95f8('0xd'),_0x10ef45,'request\x20sent',JSON['stringify'](_0x2d7ed2));if(_0x2d7ed2['error']){if(_0x2d7ed2[_0x95f8('0xe')][_0x95f8('0xf')]===0x1f4){logger[_0x95f8('0xe')]('SquareOdbc,\x20%s,\x20%s',_0x10ef45,_0x2d7ed2['error'][_0x95f8('0x10')]);return _0x26108c(_0x2d7ed2[_0x95f8('0xe')]['message']);}logger['error']('SquareOdbc,\x20%s,\x20%s',_0x10ef45,_0x2d7ed2['error'][_0x95f8('0x10')]);return _0x1963ca(_0x2d7ed2[_0x95f8('0xe')]['message']);}else{logger['info'](_0x95f8('0x11'),_0x10ef45,'request\x20sent');_0x1963ca(_0x2d7ed2['result'][_0x95f8('0x10')]);}})[_0x95f8('0x12')](function(_0x2d034d){logger[_0x95f8('0xe')](_0x95f8('0x11'),_0x10ef45,_0x2d034d);_0x26108c(_0x2d034d);});});}exports[_0x95f8('0x13')]=function(_0x1799d5){var _0x5f2927=this;return new Promise(function(_0x13ee53,_0x3116b5){return db[_0x95f8('0x14')][_0x95f8('0x15')]({'raw':_0x1799d5[_0x95f8('0x16')]?_0x1799d5[_0x95f8('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1799d5[_0x95f8('0x16')]?_0x1799d5[_0x95f8('0x16')][_0x95f8('0x17')]||null:null,'attributes':_0x1799d5[_0x95f8('0x16')]?_0x1799d5[_0x95f8('0x16')][_0x95f8('0x18')]||null:null,'include':_0x1799d5[_0x95f8('0x16')]?_0x1799d5[_0x95f8('0x16')][_0x95f8('0x19')]?_[_0x95f8('0x1a')](_0x1799d5[_0x95f8('0x16')][_0x95f8('0x19')],function(_0x4fbf64){return{'model':db[_0x4fbf64[_0x95f8('0x1b')]],'as':_0x4fbf64['as'],'attributes':_0x4fbf64[_0x95f8('0x18')],'include':_0x4fbf64[_0x95f8('0x19')]?_[_0x95f8('0x1a')](_0x4fbf64['include'],function(_0x567f78){return{'model':db[_0x567f78['model']],'as':_0x567f78['as'],'attributes':_0x567f78[_0x95f8('0x18')],'include':_0x567f78['include']?_[_0x95f8('0x1a')](_0x567f78[_0x95f8('0x19')],function(_0x152101){return{'model':db[_0x152101[_0x95f8('0x1b')]],'as':_0x152101['as'],'attributes':_0x152101[_0x95f8('0x18')]};}):[]};}):[]};}):[]:[]})[_0x95f8('0xb')](function(_0x507d38){logger[_0x95f8('0x1c')](_0x95f8('0x13'),_0x1799d5);logger['debug'](_0x95f8('0x13'),_0x1799d5,JSON['stringify'](_0x507d38));_0x13ee53(_0x507d38);})[_0x95f8('0x12')](function(_0x2b7eb7){logger[_0x95f8('0xe')](_0x95f8('0x13'),_0x2b7eb7[_0x95f8('0x10')],_0x1799d5);_0x3116b5(_0x5f2927['error'](0x1f4,_0x2b7eb7['message']));});});};
\ No newline at end of file
+var _0xd2d3=['include','map','model','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','SquareOdbc,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowSquareOdbc','options','attributes'];(function(_0x26aa24,_0xcd5d8c){var _0xf90f88=function(_0x113459){while(--_0x113459){_0x26aa24['push'](_0x26aa24['shift']());}};_0xf90f88(++_0xcd5d8c);}(_0xd2d3,0x14f));var _0x3d2d=function(_0x1da239,_0x3cf474){_0x1da239=_0x1da239-0x0;var _0x15a4e7=_0xd2d3[_0x1da239];return _0x15a4e7;};'use strict';var _=require(_0x3d2d('0x0'));var util=require(_0x3d2d('0x1'));var moment=require(_0x3d2d('0x2'));var BPromise=require(_0x3d2d('0x3'));var rs=require(_0x3d2d('0x4'));var fs=require('fs');var Redis=require(_0x3d2d('0x5'));var db=require(_0x3d2d('0x6'))['db'];var utils=require(_0x3d2d('0x7'));var logger=require(_0x3d2d('0x8'))(_0x3d2d('0x9'));var config=require('../../config/environment');var jayson=require(_0x3d2d('0xa'));var client=jayson[_0x3d2d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8f0571,_0x4782c3,_0x3f1990){return new BPromise(function(_0x238b6b,_0x56eb56){return client[_0x3d2d('0xc')](_0x8f0571,_0x3f1990)['then'](function(_0x5cebda){logger['info'](_0x3d2d('0xd'),_0x4782c3,_0x3d2d('0xe'));logger['debug']('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x4782c3,_0x3d2d('0xe'),JSON[_0x3d2d('0xf')](_0x5cebda));if(_0x5cebda[_0x3d2d('0x10')]){if(_0x5cebda[_0x3d2d('0x10')][_0x3d2d('0x11')]===0x1f4){logger['error'](_0x3d2d('0xd'),_0x4782c3,_0x5cebda[_0x3d2d('0x10')]['message']);return _0x56eb56(_0x5cebda[_0x3d2d('0x10')]['message']);}logger[_0x3d2d('0x10')](_0x3d2d('0xd'),_0x4782c3,_0x5cebda[_0x3d2d('0x10')]['message']);return _0x238b6b(_0x5cebda['error'][_0x3d2d('0x12')]);}else{logger[_0x3d2d('0x13')](_0x3d2d('0xd'),_0x4782c3,_0x3d2d('0xe'));_0x238b6b(_0x5cebda[_0x3d2d('0x14')][_0x3d2d('0x12')]);}})[_0x3d2d('0x15')](function(_0x4f056e){logger[_0x3d2d('0x10')](_0x3d2d('0xd'),_0x4782c3,_0x4f056e);_0x56eb56(_0x4f056e);});});}exports[_0x3d2d('0x16')]=function(_0x403e56){var _0x3ff3ae=this;return new Promise(function(_0x17e3d3,_0x393ae0){return db['SquareOdbc']['find']({'raw':_0x403e56[_0x3d2d('0x17')]?_0x403e56[_0x3d2d('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x403e56[_0x3d2d('0x17')]?_0x403e56[_0x3d2d('0x17')]['where']||null:null,'attributes':_0x403e56[_0x3d2d('0x17')]?_0x403e56[_0x3d2d('0x17')][_0x3d2d('0x18')]||null:null,'include':_0x403e56[_0x3d2d('0x17')]?_0x403e56[_0x3d2d('0x17')][_0x3d2d('0x19')]?_[_0x3d2d('0x1a')](_0x403e56[_0x3d2d('0x17')][_0x3d2d('0x19')],function(_0x44fc9b){return{'model':db[_0x44fc9b[_0x3d2d('0x1b')]],'as':_0x44fc9b['as'],'attributes':_0x44fc9b[_0x3d2d('0x18')],'include':_0x44fc9b[_0x3d2d('0x19')]?_[_0x3d2d('0x1a')](_0x44fc9b[_0x3d2d('0x19')],function(_0x177b95){return{'model':db[_0x177b95['model']],'as':_0x177b95['as'],'attributes':_0x177b95[_0x3d2d('0x18')],'include':_0x177b95[_0x3d2d('0x19')]?_[_0x3d2d('0x1a')](_0x177b95[_0x3d2d('0x19')],function(_0x5cae76){return{'model':db[_0x5cae76[_0x3d2d('0x1b')]],'as':_0x5cae76['as'],'attributes':_0x5cae76[_0x3d2d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3d2d('0x1c')](function(_0x833b80){logger[_0x3d2d('0x13')](_0x3d2d('0x16'),_0x403e56);logger[_0x3d2d('0x1d')](_0x3d2d('0x16'),_0x403e56,JSON[_0x3d2d('0xf')](_0x833b80));_0x17e3d3(_0x833b80);})[_0x3d2d('0x15')](function(_0xe4f022){logger[_0x3d2d('0x10')](_0x3d2d('0x16'),_0xe4f022[_0x3d2d('0x12')],_0x403e56);_0x393ae0(_0x3ff3ae[_0x3d2d('0x10')](0x1f4,_0xe4f022['message']));});});};
\ No newline at end of file
index 2b6eeae..5ff35a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x099d=['../../components/interaction/service','./squareProject.controller','get','isAuthenticated','/:id','show','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x099d,0x1e7));var _0xd099=function(_0x5c6563,_0x502b24){_0x5c6563=_0x5c6563-0x0;var _0x1df992=_0x099d[_0x5c6563];return _0x1df992;};'use strict';var multer=require(_0xd099('0x0'));var util=require('util');var path=require(_0xd099('0x1'));var timeout=require(_0xd099('0x2'));var express=require(_0xd099('0x3'));var router=express[_0xd099('0x4')]();var fs_extra=require(_0xd099('0x5'));var auth=require(_0xd099('0x6'));var interaction=require(_0xd099('0x7'));var config=require('../../config/environment');var controller=require(_0xd099('0x8'));router[_0xd099('0x9')]('/',auth[_0xd099('0xa')](),controller['index']);router[_0xd099('0x9')](_0xd099('0xb'),auth[_0xd099('0xa')](),controller[_0xd099('0xc')]);router[_0xd099('0xd')]('/',auth[_0xd099('0xa')](),controller[_0xd099('0xe')]);router[_0xd099('0xf')]('/:id',auth[_0xd099('0xa')](),controller['update']);router[_0xd099('0x10')](_0xd099('0xb'),auth[_0xd099('0xa')](),controller[_0xd099('0x11')]);module[_0xd099('0x12')]=router;
\ No newline at end of file
+var _0x8667=['put','update','delete','/:id','destroy','exports','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create'];(function(_0x2b4388,_0x1cbaaa){var _0x2fce40=function(_0x1ec89a){while(--_0x1ec89a){_0x2b4388['push'](_0x2b4388['shift']());}};_0x2fce40(++_0x1cbaaa);}(_0x8667,0x186));var _0x7866=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8667[_0x397e5f];return _0x5302b8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7866('0x0'));var timeout=require(_0x7866('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x7866('0x2'));var interaction=require(_0x7866('0x3'));var config=require(_0x7866('0x4'));var controller=require('./squareProject.controller');router[_0x7866('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7866('0x5')]('/:id',auth[_0x7866('0x6')](),controller[_0x7866('0x7')]);router[_0x7866('0x8')]('/',auth[_0x7866('0x6')](),controller[_0x7866('0x9')]);router[_0x7866('0xa')]('/:id',auth[_0x7866('0x6')](),controller[_0x7866('0xb')]);router[_0x7866('0xc')](_0x7866('0xd'),auth[_0x7866('0x6')](),controller[_0x7866('0xe')]);module[_0x7866('0xf')]=router;
\ No newline at end of file
index 2c83a6a..97bc6e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2563=['name','TEXT','long','getDataValue','preproduction','utf8','BLOB','production','DATE','sequelize','exports','STRING'];(function(_0xcd043d,_0x142b07){var _0x541e8e=function(_0x4c4de1){while(--_0x4c4de1){_0xcd043d['push'](_0xcd043d['shift']());}};_0x541e8e(++_0x142b07);}(_0x2563,0x75));var _0x3256=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2563[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x3256('0x0'));module[_0x3256('0x1')]={'name':{'type':Sequelize[_0x3256('0x2')],'unique':_0x3256('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x3256('0x2')]},'notes':{'type':Sequelize[_0x3256('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0x3256('0x5')),'get':function(){if(this[_0x3256('0x6')]('preproduction')){return this[_0x3256('0x6')](_0x3256('0x7'))['toString'](_0x3256('0x8'));}}},'production':{'type':Sequelize[_0x3256('0x9')](_0x3256('0x5')),'get':function(){if(this[_0x3256('0x6')](_0x3256('0xa'))){return this['getDataValue']('production')['toString']('utf8');}}},'savedAt':{'type':Sequelize[_0x3256('0xb')]},'publishedAt':{'type':Sequelize['DATE']}};
\ No newline at end of file
+var _0x0a05=['toString','utf8','production','DATE','sequelize','exports','STRING','name','TEXT','BLOB','getDataValue'];(function(_0x3e25c1,_0x1d15f9){var _0x52e7f2=function(_0x597a5a){while(--_0x597a5a){_0x3e25c1['push'](_0x3e25c1['shift']());}};_0x52e7f2(++_0x1d15f9);}(_0x0a05,0x9e));var _0x50a0=function(_0x31ddba,_0x28ec26){_0x31ddba=_0x31ddba-0x0;var _0x3f014c=_0x0a05[_0x31ddba];return _0x3f014c;};'use strict';var Sequelize=require(_0x50a0('0x0'));module[_0x50a0('0x1')]={'name':{'type':Sequelize[_0x50a0('0x2')],'unique':_0x50a0('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x50a0('0x2')]},'notes':{'type':Sequelize[_0x50a0('0x4')]},'preproduction':{'type':Sequelize[_0x50a0('0x5')]('long'),'get':function(){if(this[_0x50a0('0x6')]('preproduction')){return this[_0x50a0('0x6')]('preproduction')[_0x50a0('0x7')](_0x50a0('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0x50a0('0x6')](_0x50a0('0x9'))){return this[_0x50a0('0x6')](_0x50a0('0x9'))['toString'](_0x50a0('0x8'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x50a0('0xa')]}};
\ No newline at end of file
index 36ddb2e..4b86fe9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9eb1=['get','SquareProjects','publish','agi','end','sendStatus','error','stack','index','map','SquareProject','rawAttributes','type','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','production','ioredis','../../config/logger','api','redis','defaults','localhost','./squareProject.socket','register','status','json','offset','undefined','limit','count','Content-Range','then','destroy'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x9eb1,0x6f));var _0x19eb=function(_0x1ad0c1,_0x2f5433){_0x1ad0c1=_0x1ad0c1-0x0;var _0x1b56ae=_0x9eb1[_0x1ad0c1];return _0x1b56ae;};'use strict';var _=require('lodash');var Redis=require(_0x19eb('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x19eb('0x1'))(_0x19eb('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x19eb('0x3')]=_[_0x19eb('0x4')](config[_0x19eb('0x3')],{'host':_0x19eb('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x19eb('0x3')]));require(_0x19eb('0x6'))[_0x19eb('0x7')](socket);function respondWithResult(_0x5c56a9,_0x273560){_0x273560=_0x273560||0xc8;return function(_0x5ee338){if(_0x5ee338){return _0x5c56a9[_0x19eb('0x8')](_0x273560)[_0x19eb('0x9')](_0x5ee338);}};}function respondWithFilteredResult(_0x13b764,_0x19df32){return function(_0x32a049){if(_0x32a049){var _0x36372b=typeof _0x19df32[_0x19eb('0xa')]===_0x19eb('0xb')&&typeof _0x19df32[_0x19eb('0xc')]===_0x19eb('0xb');var _0x1e923e=_0x32a049[_0x19eb('0xd')];var _0x2f6e78=_0x36372b?0x0:_0x19df32['offset'];var _0x201fe9=_0x36372b?_0x32a049['count']:_0x19df32[_0x19eb('0xa')]+_0x19df32[_0x19eb('0xc')];var _0x510a62;if(_0x201fe9>=_0x1e923e){_0x201fe9=_0x1e923e;_0x510a62=0xc8;}else{_0x510a62=0xce;}_0x13b764[_0x19eb('0x8')](_0x510a62);return _0x13b764['set'](_0x19eb('0xe'),_0x2f6e78+'-'+_0x201fe9+'/'+_0x1e923e)['json'](_0x32a049);}return null;};}function saveUpdates(_0x21975f){return function(_0x3181c7){if(_0x3181c7){return _0x3181c7['update'](_0x21975f)[_0x19eb('0xf')](function(_0x596afe){return _0x596afe;});}return null;};}function removeEntity(_0x412779){return function(_0x449922){if(_0x449922){return _0x449922[_0x19eb('0x10')]()['then'](function(){var _0x4c6e61=_0x449922[_0x19eb('0x11')]({'plain':!![]});var _0xe1bf7c=_0x19eb('0x12');return db['UserProfileResource'][_0x19eb('0x10')]({'where':{'type':_0xe1bf7c,'resourceId':_0x4c6e61['id']}})[_0x19eb('0xf')](function(){return _0x449922;});})['then'](function(){var _0x511be2=new Redis(config['redis']);_0x511be2[_0x19eb('0x13')](_0x19eb('0x14'),JSON['stringify']({'id':_0x449922['id'],'deleted':!![]}));})['then'](function(){_0x412779[_0x19eb('0x8')](0xcc)[_0x19eb('0x15')]();});}};}function handleEntityNotFound(_0x118fcd){return function(_0x1b79dd){if(!_0x1b79dd){_0x118fcd[_0x19eb('0x16')](0x194);}return _0x1b79dd;};}function handleError(_0x517504,_0x5e246a){_0x5e246a=_0x5e246a||0x1f4;return function(_0x333fdc){logger[_0x19eb('0x17')](_0x333fdc[_0x19eb('0x18')]);if(_0x333fdc['name']){delete _0x333fdc['name'];}_0x517504['status'](_0x5e246a)['send'](_0x333fdc);};}exports[_0x19eb('0x19')]=function(_0x217714,_0x54ac0a){var _0x17bbb5={},_0x42b663={},_0x1e89c9={'count':0x0,'rows':[]};var _0x1934c0=_[_0x19eb('0x1a')](db[_0x19eb('0x1b')][_0x19eb('0x1c')],function(_0x358546){return{'name':_0x358546['fieldName'],'type':_0x358546[_0x19eb('0x1d')]['key']};});_0x42b663[_0x19eb('0x1e')]=_[_0x19eb('0x1a')](_0x1934c0,_0x19eb('0x1f'));_0x42b663[_0x19eb('0x20')]=_['keys'](_0x217714[_0x19eb('0x20')]);_0x42b663[_0x19eb('0x21')]=_[_0x19eb('0x22')](_0x42b663[_0x19eb('0x1e')],_0x42b663[_0x19eb('0x20')]);_0x17bbb5[_0x19eb('0x23')]=_['intersection'](_0x42b663[_0x19eb('0x1e')],qs['fields'](_0x217714[_0x19eb('0x20')][_0x19eb('0x24')]));_0x17bbb5['attributes']=_0x17bbb5[_0x19eb('0x23')][_0x19eb('0x25')]?_0x17bbb5[_0x19eb('0x23')]:_0x42b663[_0x19eb('0x1e')];if(!_0x217714[_0x19eb('0x20')][_0x19eb('0x26')]('nolimit')){_0x17bbb5['limit']=qs[_0x19eb('0xc')](_0x217714[_0x19eb('0x20')]['limit']);_0x17bbb5['offset']=qs[_0x19eb('0xa')](_0x217714['query']['offset']);}_0x17bbb5[_0x19eb('0x27')]=qs[_0x19eb('0x28')](_0x217714[_0x19eb('0x20')][_0x19eb('0x28')]);_0x17bbb5[_0x19eb('0x29')]=qs[_0x19eb('0x21')](_[_0x19eb('0x2a')](_0x217714[_0x19eb('0x20')],_0x42b663[_0x19eb('0x21')]),_0x1934c0);if(_0x217714['query']['filter']){_0x17bbb5['where']=_[_0x19eb('0x2b')](_0x17bbb5[_0x19eb('0x29')],{'$or':_['map'](_0x1934c0,function(_0x5043a7){if(_0x5043a7[_0x19eb('0x1d')]!=='VIRTUAL'){var _0x474827={};_0x474827[_0x5043a7['name']]={'$like':'%'+_0x217714[_0x19eb('0x20')]['filter']+'%'};return _0x474827;}})});}_0x17bbb5=_[_0x19eb('0x2b')]({},_0x17bbb5,_0x217714[_0x19eb('0x2c')]);var _0x3fdf5f={'where':_0x17bbb5[_0x19eb('0x29')]};return db['SquareProject']['count'](_0x3fdf5f)[_0x19eb('0xf')](function(_0x57ea93){_0x1e89c9[_0x19eb('0xd')]=_0x57ea93;if(_0x217714[_0x19eb('0x20')][_0x19eb('0x2d')]){_0x17bbb5[_0x19eb('0x2e')]=[{'all':!![]}];}return db[_0x19eb('0x1b')][_0x19eb('0x2f')](_0x17bbb5);})[_0x19eb('0xf')](function(_0x5786db){_0x1e89c9['rows']=_0x5786db;return _0x1e89c9;})[_0x19eb('0xf')](respondWithFilteredResult(_0x54ac0a,_0x17bbb5))[_0x19eb('0x30')](handleError(_0x54ac0a,null));};exports[_0x19eb('0x31')]=function(_0x1312d1,_0x1961c9){var _0x580c97={'raw':![],'where':{'id':_0x1312d1[_0x19eb('0x32')]['id']}},_0x5e26b2={};_0x5e26b2[_0x19eb('0x1e')]=_[_0x19eb('0x33')](db[_0x19eb('0x1b')]['rawAttributes']);_0x5e26b2[_0x19eb('0x20')]=_[_0x19eb('0x33')](_0x1312d1[_0x19eb('0x20')]);_0x5e26b2[_0x19eb('0x21')]=_['intersection'](_0x5e26b2[_0x19eb('0x1e')],_0x5e26b2[_0x19eb('0x20')]);_0x580c97[_0x19eb('0x23')]=_[_0x19eb('0x22')](_0x5e26b2['model'],qs[_0x19eb('0x24')](_0x1312d1[_0x19eb('0x20')][_0x19eb('0x24')]));_0x580c97[_0x19eb('0x23')]=_0x580c97[_0x19eb('0x23')][_0x19eb('0x25')]?_0x580c97[_0x19eb('0x23')]:_0x5e26b2[_0x19eb('0x1e')];if(_0x1312d1[_0x19eb('0x20')][_0x19eb('0x2d')]){_0x580c97[_0x19eb('0x2e')]=[{'all':!![]}];}_0x580c97=_['merge']({},_0x580c97,_0x1312d1[_0x19eb('0x2c')]);return db[_0x19eb('0x1b')][_0x19eb('0x34')](_0x580c97)[_0x19eb('0xf')](handleEntityNotFound(_0x1961c9,null))[_0x19eb('0xf')](respondWithResult(_0x1961c9,null))[_0x19eb('0x30')](handleError(_0x1961c9,null));};exports[_0x19eb('0x35')]=function(_0x579024,_0x4c4458){return db[_0x19eb('0x1b')][_0x19eb('0x35')](_0x579024[_0x19eb('0x36')],{})['then'](function(_0x1d29bf){var _0x1267b4=_0x579024['user'][_0x19eb('0x11')]({'plain':!![]});if(!_0x1267b4)throw new Error(_0x19eb('0x37'));if(_0x1267b4[_0x19eb('0x38')]===_0x19eb('0x39')){var _0x45d1b5=_0x1d29bf['get']({'plain':!![]});var _0x27db43=_0x19eb('0x12');return db[_0x19eb('0x3a')][_0x19eb('0x34')]({'where':{'name':_0x27db43,'userProfileId':_0x1267b4[_0x19eb('0x3b')]},'raw':!![]})['then'](function(_0x20e744){if(_0x20e744&&_0x20e744['autoAssociation']===0x0){return db[_0x19eb('0x3c')][_0x19eb('0x35')]({'name':_0x45d1b5[_0x19eb('0x1f')],'resourceId':_0x45d1b5['id'],'type':_0x20e744[_0x19eb('0x1f')],'sectionId':_0x20e744['id']},{})[_0x19eb('0xf')](function(){return _0x1d29bf;});}else{return _0x1d29bf;}})[_0x19eb('0x30')](function(_0x23eab1){logger[_0x19eb('0x17')](_0x19eb('0x3d'),_0x23eab1);throw _0x23eab1;});}return _0x1d29bf;})[_0x19eb('0xf')](respondWithResult(_0x4c4458,0xc9))[_0x19eb('0x30')](handleError(_0x4c4458,null));};exports[_0x19eb('0x3e')]=function(_0x2f5400,_0x559256){if(_0x2f5400[_0x19eb('0x36')]['id']){delete _0x2f5400[_0x19eb('0x36')]['id'];}return db[_0x19eb('0x1b')]['find']({'where':{'id':_0x2f5400['params']['id']}})[_0x19eb('0xf')](handleEntityNotFound(_0x559256,null))[_0x19eb('0xf')](saveUpdates(_0x2f5400[_0x19eb('0x36')],null))[_0x19eb('0xf')](function(_0x49f079){if(!_0x49f079)return;var _0x4e1c25=_0x49f079[_0x19eb('0x11')]({'plain':!![]});return _0x4e1c25;})[_0x19eb('0xf')](function(_0x18c3b7){var _0x404530=new Redis(config[_0x19eb('0x3')]);_0x404530['publish'](_0x19eb('0x14'),JSON['stringify'](_[_0x19eb('0x2a')](_0x18c3b7,['id','name',_0x19eb('0x3f')])));return _0x18c3b7;})[_0x19eb('0xf')](respondWithResult(_0x559256,null))[_0x19eb('0x30')](handleError(_0x559256,null));};exports[_0x19eb('0x10')]=function(_0x3afa69,_0x12481d){return db['SquareProject']['find']({'where':{'id':_0x3afa69[_0x19eb('0x32')]['id']}})['then'](handleEntityNotFound(_0x12481d,null))[_0x19eb('0xf')](removeEntity(_0x12481d,null))[_0x19eb('0x30')](handleError(_0x12481d,null));};
\ No newline at end of file
+var _0xcc3f=['where','pick','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','includeAll','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','production','find','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./squareProject.socket','register','json','offset','limit','undefined','count','status','set','Content-Range','update','destroy','then','get','SquareProjects','publish','agi','end','sendStatus','name','send','map','SquareProject','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xcc3f,0xa4));var _0xfcc3=function(_0x3aee3b,_0x2fe0dc){_0x3aee3b=_0x3aee3b-0x0;var _0x1cf89c=_0xcc3f[_0x3aee3b];return _0x1cf89c;};'use strict';var _=require(_0xfcc3('0x0'));var Redis=require(_0xfcc3('0x1'));var qs=require(_0xfcc3('0x2'));var logger=require(_0xfcc3('0x3'))(_0xfcc3('0x4'));var config=require(_0xfcc3('0x5'));var db=require('../../mysqldb')['db'];config[_0xfcc3('0x6')]=_['defaults'](config['redis'],{'host':_0xfcc3('0x7'),'port':0x18eb});var socket=require(_0xfcc3('0x8'))(new Redis(config[_0xfcc3('0x6')]));require(_0xfcc3('0x9'))[_0xfcc3('0xa')](socket);function respondWithResult(_0x3de300,_0x23b3fb){_0x23b3fb=_0x23b3fb||0xc8;return function(_0x25f12d){if(_0x25f12d){return _0x3de300['status'](_0x23b3fb)[_0xfcc3('0xb')](_0x25f12d);}};}function respondWithFilteredResult(_0x8a882f,_0x233c3e){return function(_0x272a05){if(_0x272a05){var _0x52d7f1=typeof _0x233c3e[_0xfcc3('0xc')]==='undefined'&&typeof _0x233c3e[_0xfcc3('0xd')]===_0xfcc3('0xe');var _0x41d107=_0x272a05[_0xfcc3('0xf')];var _0x4be562=_0x52d7f1?0x0:_0x233c3e[_0xfcc3('0xc')];var _0x2d3515=_0x52d7f1?_0x272a05[_0xfcc3('0xf')]:_0x233c3e[_0xfcc3('0xc')]+_0x233c3e[_0xfcc3('0xd')];var _0x5cc7cd;if(_0x2d3515>=_0x41d107){_0x2d3515=_0x41d107;_0x5cc7cd=0xc8;}else{_0x5cc7cd=0xce;}_0x8a882f[_0xfcc3('0x10')](_0x5cc7cd);return _0x8a882f[_0xfcc3('0x11')](_0xfcc3('0x12'),_0x4be562+'-'+_0x2d3515+'/'+_0x41d107)[_0xfcc3('0xb')](_0x272a05);}return null;};}function saveUpdates(_0x60a34f){return function(_0x287fa7){if(_0x287fa7){return _0x287fa7[_0xfcc3('0x13')](_0x60a34f)['then'](function(_0x1449c1){return _0x1449c1;});}return null;};}function removeEntity(_0x4a425c){return function(_0x4fee86){if(_0x4fee86){return _0x4fee86[_0xfcc3('0x14')]()[_0xfcc3('0x15')](function(){var _0x133880=_0x4fee86[_0xfcc3('0x16')]({'plain':!![]});var _0x51a5fb=_0xfcc3('0x17');return db['UserProfileResource'][_0xfcc3('0x14')]({'where':{'type':_0x51a5fb,'resourceId':_0x133880['id']}})['then'](function(){return _0x4fee86;});})[_0xfcc3('0x15')](function(){var _0x3b26c9=new Redis(config[_0xfcc3('0x6')]);_0x3b26c9[_0xfcc3('0x18')](_0xfcc3('0x19'),JSON['stringify']({'id':_0x4fee86['id'],'deleted':!![]}));})['then'](function(){_0x4a425c[_0xfcc3('0x10')](0xcc)[_0xfcc3('0x1a')]();});}};}function handleEntityNotFound(_0x188de7){return function(_0x534a7c){if(!_0x534a7c){_0x188de7[_0xfcc3('0x1b')](0x194);}return _0x534a7c;};}function handleError(_0x28ef27,_0x35436b){_0x35436b=_0x35436b||0x1f4;return function(_0x30ea57){logger['error'](_0x30ea57['stack']);if(_0x30ea57[_0xfcc3('0x1c')]){delete _0x30ea57[_0xfcc3('0x1c')];}_0x28ef27[_0xfcc3('0x10')](_0x35436b)[_0xfcc3('0x1d')](_0x30ea57);};}exports['index']=function(_0x29b0d5,_0x20c24e){var _0x33325b={},_0x3c0001={},_0x5b4c5e={'count':0x0,'rows':[]};var _0x3a0f7e=_[_0xfcc3('0x1e')](db[_0xfcc3('0x1f')][_0xfcc3('0x20')],function(_0x4f62a8){return{'name':_0x4f62a8[_0xfcc3('0x21')],'type':_0x4f62a8['type']['key']};});_0x3c0001[_0xfcc3('0x22')]=_[_0xfcc3('0x1e')](_0x3a0f7e,_0xfcc3('0x1c'));_0x3c0001[_0xfcc3('0x23')]=_[_0xfcc3('0x24')](_0x29b0d5['query']);_0x3c0001[_0xfcc3('0x25')]=_[_0xfcc3('0x26')](_0x3c0001[_0xfcc3('0x22')],_0x3c0001[_0xfcc3('0x23')]);_0x33325b['attributes']=_[_0xfcc3('0x26')](_0x3c0001[_0xfcc3('0x22')],qs[_0xfcc3('0x27')](_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0x27')]));_0x33325b[_0xfcc3('0x28')]=_0x33325b[_0xfcc3('0x28')][_0xfcc3('0x29')]?_0x33325b[_0xfcc3('0x28')]:_0x3c0001[_0xfcc3('0x22')];if(!_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0x2a')](_0xfcc3('0x2b'))){_0x33325b[_0xfcc3('0xd')]=qs['limit'](_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0xd')]);_0x33325b[_0xfcc3('0xc')]=qs['offset'](_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0xc')]);}_0x33325b[_0xfcc3('0x2c')]=qs['sort'](_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0x2d')]);_0x33325b[_0xfcc3('0x2e')]=qs[_0xfcc3('0x25')](_[_0xfcc3('0x2f')](_0x29b0d5[_0xfcc3('0x23')],_0x3c0001[_0xfcc3('0x25')]),_0x3a0f7e);if(_0x29b0d5[_0xfcc3('0x23')]['filter']){_0x33325b[_0xfcc3('0x2e')]=_[_0xfcc3('0x30')](_0x33325b[_0xfcc3('0x2e')],{'$or':_['map'](_0x3a0f7e,function(_0x6861f5){if(_0x6861f5[_0xfcc3('0x31')]!==_0xfcc3('0x32')){var _0x36e2c0={};_0x36e2c0[_0x6861f5['name']]={'$like':'%'+_0x29b0d5[_0xfcc3('0x23')][_0xfcc3('0x33')]+'%'};return _0x36e2c0;}})});}_0x33325b=_[_0xfcc3('0x30')]({},_0x33325b,_0x29b0d5[_0xfcc3('0x34')]);var _0x539a1a={'where':_0x33325b[_0xfcc3('0x2e')]};return db['SquareProject'][_0xfcc3('0xf')](_0x539a1a)[_0xfcc3('0x15')](function(_0x1a5dba){_0x5b4c5e[_0xfcc3('0xf')]=_0x1a5dba;if(_0x29b0d5[_0xfcc3('0x23')]['includeAll']){_0x33325b['include']=[{'all':!![]}];}return db[_0xfcc3('0x1f')][_0xfcc3('0x35')](_0x33325b);})[_0xfcc3('0x15')](function(_0x349d56){_0x5b4c5e[_0xfcc3('0x36')]=_0x349d56;return _0x5b4c5e;})[_0xfcc3('0x15')](respondWithFilteredResult(_0x20c24e,_0x33325b))[_0xfcc3('0x37')](handleError(_0x20c24e,null));};exports[_0xfcc3('0x38')]=function(_0x2926a0,_0x54060f){var _0x53d351={'raw':![],'where':{'id':_0x2926a0['params']['id']}},_0x56792c={};_0x56792c[_0xfcc3('0x22')]=_[_0xfcc3('0x24')](db[_0xfcc3('0x1f')]['rawAttributes']);_0x56792c[_0xfcc3('0x23')]=_[_0xfcc3('0x24')](_0x2926a0[_0xfcc3('0x23')]);_0x56792c[_0xfcc3('0x25')]=_[_0xfcc3('0x26')](_0x56792c[_0xfcc3('0x22')],_0x56792c['query']);_0x53d351['attributes']=_[_0xfcc3('0x26')](_0x56792c[_0xfcc3('0x22')],qs[_0xfcc3('0x27')](_0x2926a0[_0xfcc3('0x23')][_0xfcc3('0x27')]));_0x53d351[_0xfcc3('0x28')]=_0x53d351[_0xfcc3('0x28')]['length']?_0x53d351['attributes']:_0x56792c[_0xfcc3('0x22')];if(_0x2926a0[_0xfcc3('0x23')][_0xfcc3('0x39')]){_0x53d351['include']=[{'all':!![]}];}_0x53d351=_['merge']({},_0x53d351,_0x2926a0['options']);return db[_0xfcc3('0x1f')]['find'](_0x53d351)[_0xfcc3('0x15')](handleEntityNotFound(_0x54060f,null))[_0xfcc3('0x15')](respondWithResult(_0x54060f,null))['catch'](handleError(_0x54060f,null));};exports[_0xfcc3('0x3a')]=function(_0x64d53a,_0x5bbd80){return db[_0xfcc3('0x1f')][_0xfcc3('0x3a')](_0x64d53a['body'],{})[_0xfcc3('0x15')](function(_0x3b0c11){var _0x1d0550=_0x64d53a[_0xfcc3('0x3b')][_0xfcc3('0x16')]({'plain':!![]});if(!_0x1d0550)throw new Error(_0xfcc3('0x3c'));if(_0x1d0550[_0xfcc3('0x3d')]===_0xfcc3('0x3b')){var _0x3142dd=_0x3b0c11[_0xfcc3('0x16')]({'plain':!![]});var _0x2eaae5=_0xfcc3('0x17');return db[_0xfcc3('0x3e')]['find']({'where':{'name':_0x2eaae5,'userProfileId':_0x1d0550[_0xfcc3('0x3f')]},'raw':!![]})[_0xfcc3('0x15')](function(_0x52e5bd){if(_0x52e5bd&&_0x52e5bd['autoAssociation']===0x0){return db['UserProfileResource'][_0xfcc3('0x3a')]({'name':_0x3142dd[_0xfcc3('0x1c')],'resourceId':_0x3142dd['id'],'type':_0x52e5bd['name'],'sectionId':_0x52e5bd['id']},{})[_0xfcc3('0x15')](function(){return _0x3b0c11;});}else{return _0x3b0c11;}})[_0xfcc3('0x37')](function(_0x214ffb){logger[_0xfcc3('0x40')](_0xfcc3('0x41'),_0x214ffb);throw _0x214ffb;});}return _0x3b0c11;})[_0xfcc3('0x15')](respondWithResult(_0x5bbd80,0xc9))['catch'](handleError(_0x5bbd80,null));};exports['update']=function(_0x139f9f,_0x5e3f34){if(_0x139f9f[_0xfcc3('0x42')]['id']){delete _0x139f9f[_0xfcc3('0x42')]['id'];}return db[_0xfcc3('0x1f')]['find']({'where':{'id':_0x139f9f[_0xfcc3('0x43')]['id']}})[_0xfcc3('0x15')](handleEntityNotFound(_0x5e3f34,null))['then'](saveUpdates(_0x139f9f['body'],null))[_0xfcc3('0x15')](function(_0x478bbd){if(!_0x478bbd)return;var _0x3101a9=_0x478bbd[_0xfcc3('0x16')]({'plain':!![]});return _0x3101a9;})[_0xfcc3('0x15')](function(_0x499f9a){var _0x43fbd2=new Redis(config[_0xfcc3('0x6')]);_0x43fbd2[_0xfcc3('0x18')]('agi',JSON['stringify'](_['pick'](_0x499f9a,['id',_0xfcc3('0x1c'),_0xfcc3('0x44')])));return _0x499f9a;})['then'](respondWithResult(_0x5e3f34,null))[_0xfcc3('0x37')](handleError(_0x5e3f34,null));};exports['destroy']=function(_0xe586f9,_0xc8c213){return db['SquareProject'][_0xfcc3('0x45')]({'where':{'id':_0xe586f9[_0xfcc3('0x43')]['id']}})[_0xfcc3('0x15')](handleEntityNotFound(_0xc8c213,null))[_0xfcc3('0x15')](removeEntity(_0xc8c213,null))[_0xfcc3('0x37')](handleError(_0xc8c213,null));};
\ No newline at end of file
index 1ab0c9e..0de49d5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x589a=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SquareProject','setMaxListeners','save','update','remove'];(function(_0x5e593f,_0xcabc65){var _0x2c641a=function(_0x19199c){while(--_0x19199c){_0x5e593f['push'](_0x5e593f['shift']());}};_0x2c641a(++_0xcabc65);}(_0x589a,0x1b1));var _0xa589=function(_0x2661ab,_0x3b406c){_0x2661ab=_0x2661ab-0x0;var _0x4662cc=_0x589a[_0x2661ab];return _0x4662cc;};'use strict';var EventEmitter=require(_0xa589('0x0'));var SquareProject=require(_0xa589('0x1'))['db'][_0xa589('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa589('0x3')](0x0);var events={'afterCreate':_0xa589('0x4'),'afterUpdate':_0xa589('0x5'),'afterDestroy':_0xa589('0x6')};function emitEvent(_0x139948){return function(_0x1d0355,_0x11d61e,_0x44a8d6){SquareProjectEvents[_0xa589('0x7')](_0x139948+':'+_0x1d0355['id'],_0x1d0355);SquareProjectEvents[_0xa589('0x7')](_0x139948,_0x1d0355);_0x44a8d6(null);};}for(var e in events){if(events[_0xa589('0x8')](e)){var event=events[e];SquareProject[_0xa589('0x9')](e,emitEvent(event));}}module[_0xa589('0xa')]=SquareProjectEvents;
\ No newline at end of file
+var _0x55c3=['../../mysqldb','setMaxListeners','save','update','emit','hook','exports','events'];(function(_0xb6eb3c,_0x2b7e4c){var _0x140a2f=function(_0x2049fd){while(--_0x2049fd){_0xb6eb3c['push'](_0xb6eb3c['shift']());}};_0x140a2f(++_0x2b7e4c);}(_0x55c3,0x8f));var _0x355c=function(_0x3384d7,_0xa746d4){_0x3384d7=_0x3384d7-0x0;var _0x492c58=_0x55c3[_0x3384d7];return _0x492c58;};'use strict';var EventEmitter=require(_0x355c('0x0'));var SquareProject=require(_0x355c('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x355c('0x2')](0x0);var events={'afterCreate':_0x355c('0x3'),'afterUpdate':_0x355c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x488a22){return function(_0x30d3cf,_0x97b62d,_0x1ab918){SquareProjectEvents[_0x355c('0x5')](_0x488a22+':'+_0x30d3cf['id'],_0x30d3cf);SquareProjectEvents[_0x355c('0x5')](_0x488a22,_0x30d3cf);_0x1ab918(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x355c('0x6')](e,emitEvent(event));}}module[_0x355c('0x7')]=SquareProjectEvents;
\ No newline at end of file
index dba96d5..381c6e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x811f=['YYYY-MM-DD\x20HH:mm:ss','changed','publishedAt','../../config/logger','api','moment','request-promise','path','../../config/environment','SquareProject','savedAt','format'];(function(_0x50684a,_0x1c709c){var _0xa35d13=function(_0x4e8f4b){while(--_0x4e8f4b){_0x50684a['push'](_0x50684a['shift']());}};_0xa35d13(++_0x1c709c);}(_0x811f,0x18f));var _0xf811=function(_0x99c2dd,_0x1d32eb){_0x99c2dd=_0x99c2dd-0x0;var _0x173349=_0x811f[_0x99c2dd];return _0x173349;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf811('0x0'))(_0xf811('0x1'));var moment=require(_0xf811('0x2'));var BPromise=require('bluebird');var rp=require(_0xf811('0x3'));var fs=require('fs');var path=require(_0xf811('0x4'));var rimraf=require('rimraf');var config=require(_0xf811('0x5'));var attributes=require('./squareProject.attributes');module['exports']=function(_0x4038f4,_0x502c58){return _0x4038f4['define'](_0xf811('0x6'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d3135,_0x2a2fb2,_0x56382c){if(_0x3d3135['changed']('preproduction')){_0x3d3135[_0xf811('0x7')]=moment()[_0xf811('0x8')](_0xf811('0x9'));}if(_0x3d3135[_0xf811('0xa')]('production')){_0x3d3135[_0xf811('0xb')]=moment()[_0xf811('0x8')](_0xf811('0x9'));}_0x56382c(null,_0x3d3135);}}});};
\ No newline at end of file
+var _0x092c=['square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject'];(function(_0x4fb046,_0x35329c){var _0x1f3c93=function(_0x155757){while(--_0x155757){_0x4fb046['push'](_0x4fb046['shift']());}};_0x1f3c93(++_0x35329c);}(_0x092c,0x74));var _0xc092=function(_0x46c5da,_0x40ec83){_0x46c5da=_0x46c5da-0x0;var _0x3b4169=_0x092c[_0x46c5da];return _0x3b4169;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc092('0x0'))(_0xc092('0x1'));var moment=require('moment');var BPromise=require(_0xc092('0x2'));var rp=require(_0xc092('0x3'));var fs=require('fs');var path=require(_0xc092('0x4'));var rimraf=require(_0xc092('0x5'));var config=require(_0xc092('0x6'));var attributes=require(_0xc092('0x7'));module[_0xc092('0x8')]=function(_0x5e727d,_0x487f3c){return _0x5e727d['define'](_0xc092('0x9'),attributes,{'tableName':_0xc092('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5dbb07,_0x35fc35,_0x1c56e6){if(_0x5dbb07[_0xc092('0xb')](_0xc092('0xc'))){_0x5dbb07[_0xc092('0xd')]=moment()[_0xc092('0xe')](_0xc092('0xf'));}if(_0x5dbb07[_0xc092('0xb')](_0xc092('0x10'))){_0x5dbb07[_0xc092('0x11')]=moment()[_0xc092('0xe')](_0xc092('0xf'));}_0x1c56e6(null,_0x5dbb07);}}});};
\ No newline at end of file
index 8654a7d..aad13b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b82=['./squareProject.socket','GetSquareProjects','SquareProject','findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','stringify','catch','error','message','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','localhost'];(function(_0x1ac6ec,_0x1f81fc){var _0x48a489=function(_0xf38b04){while(--_0xf38b04){_0x1ac6ec['push'](_0x1ac6ec['shift']());}};_0x48a489(++_0x1f81fc);}(_0x9b82,0x107));var _0x29b8=function(_0x44b4ae,_0x1f2d04){_0x44b4ae=_0x44b4ae-0x0;var _0x26db7e=_0x9b82[_0x44b4ae];return _0x26db7e;};'use strict';var _=require(_0x29b8('0x0'));var Redis=require(_0x29b8('0x1'));var db=require(_0x29b8('0x2'))['db'];var logger=require(_0x29b8('0x3'))('rpc');var config=require(_0x29b8('0x4'));config[_0x29b8('0x5')]=_['defaults'](config['redis'],{'host':_0x29b8('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29b8('0x5')]));require(_0x29b8('0x7'))['register'](socket);exports[_0x29b8('0x8')]=function(_0xf4188a){var _0x1fe0dc=this;return new Promise(function(_0x2c7c52,_0x3ae778){return db[_0x29b8('0x9')][_0x29b8('0xa')]({'raw':_0xf4188a[_0x29b8('0xb')]?_0xf4188a[_0x29b8('0xb')][_0x29b8('0xc')]===undefined?!![]:![]:!![],'where':_0xf4188a['options']?_0xf4188a['options'][_0x29b8('0xd')]||null:null,'attributes':_0xf4188a[_0x29b8('0xb')]?_0xf4188a[_0x29b8('0xb')]['attributes']||null:null,'limit':_0xf4188a[_0x29b8('0xb')]?_0xf4188a['options'][_0x29b8('0xe')]||null:null,'include':_0xf4188a[_0x29b8('0xb')]?_0xf4188a['options'][_0x29b8('0xf')]?_[_0x29b8('0x10')](_0xf4188a[_0x29b8('0xb')][_0x29b8('0xf')],function(_0x576461){return{'model':db[_0x576461[_0x29b8('0x11')]],'as':_0x576461['as'],'attributes':_0x576461['attributes'],'include':_0x576461[_0x29b8('0xf')]?_['map'](_0x576461['include'],function(_0x24377e){return{'model':db[_0x24377e[_0x29b8('0x11')]],'as':_0x24377e['as'],'attributes':_0x24377e['attributes'],'include':_0x24377e[_0x29b8('0xf')]?_['map'](_0x24377e[_0x29b8('0xf')],function(_0x30e497){return{'model':db[_0x30e497['model']],'as':_0x30e497['as'],'attributes':_0x30e497[_0x29b8('0x12')]};}):[]};}):[]};}):[]:[]})[_0x29b8('0x13')](function(_0x525785){logger[_0x29b8('0x14')]('GetSquareProjects',_0xf4188a);logger[_0x29b8('0x15')](_0x29b8('0x8'),_0xf4188a,JSON[_0x29b8('0x16')](_0x525785));_0x2c7c52(_0x525785);})[_0x29b8('0x17')](function(_0x8263e6){logger[_0x29b8('0x18')](_0x29b8('0x8'),_0x8263e6['message'],_0xf4188a);_0x3ae778(_0x1fe0dc[_0x29b8('0x18')](0x1f4,_0x8263e6[_0x29b8('0x19')]));});});};exports['ShowSquareProject']=function(_0x4019d3){var _0x1bf1f1=this;return new Promise(function(_0x76bfa0,_0x29c64c){return db[_0x29b8('0x9')]['find']({'raw':_0x4019d3['options']?_0x4019d3[_0x29b8('0xb')][_0x29b8('0xc')]===undefined?!![]:![]:!![],'where':_0x4019d3[_0x29b8('0xb')]?_0x4019d3[_0x29b8('0xb')]['where']||null:null,'attributes':_0x4019d3[_0x29b8('0xb')]?_0x4019d3['options']['attributes']||null:null,'include':_0x4019d3[_0x29b8('0xb')]?_0x4019d3[_0x29b8('0xb')]['include']?_[_0x29b8('0x10')](_0x4019d3['options'][_0x29b8('0xf')],function(_0x2ebf5b){return{'model':db[_0x2ebf5b[_0x29b8('0x11')]],'as':_0x2ebf5b['as'],'attributes':_0x2ebf5b[_0x29b8('0x12')],'include':_0x2ebf5b[_0x29b8('0xf')]?_[_0x29b8('0x10')](_0x2ebf5b[_0x29b8('0xf')],function(_0x556c03){return{'model':db[_0x556c03['model']],'as':_0x556c03['as'],'attributes':_0x556c03[_0x29b8('0x12')],'include':_0x556c03[_0x29b8('0xf')]?_[_0x29b8('0x10')](_0x556c03['include'],function(_0x227795){return{'model':db[_0x227795[_0x29b8('0x11')]],'as':_0x227795['as'],'attributes':_0x227795[_0x29b8('0x12')]};}):[]};}):[]};}):[]:[]})[_0x29b8('0x13')](function(_0x52559c){logger[_0x29b8('0x14')](_0x29b8('0x1a'),_0x4019d3);logger['debug'](_0x29b8('0x1a'),_0x4019d3,JSON[_0x29b8('0x16')](_0x52559c));_0x76bfa0(_0x52559c);})[_0x29b8('0x17')](function(_0x379735){logger[_0x29b8('0x18')]('ShowSquareProject',_0x379735[_0x29b8('0x19')],_0x4019d3);_0x29c64c(_0x1bf1f1[_0x29b8('0x18')](0x1f4,_0x379735[_0x29b8('0x19')]));});});};
\ No newline at end of file
+var _0x686a=['socket.io-emitter','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','model','map','info','debug','stringify','catch','error','message','then','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','localhost'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x686a,0x154));var _0xa686=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0x686a[_0x2d3d0d];return _0xca35b6;};'use strict';var _=require(_0xa686('0x0'));var Redis=require(_0xa686('0x1'));var db=require(_0xa686('0x2'))['db'];var logger=require(_0xa686('0x3'))(_0xa686('0x4'));var config=require(_0xa686('0x5'));config[_0xa686('0x6')]=_['defaults'](config[_0xa686('0x6')],{'host':_0xa686('0x7'),'port':0x18eb});var socket=require(_0xa686('0x8'))(new Redis(config[_0xa686('0x6')]));require('./squareProject.socket')[_0xa686('0x9')](socket);exports[_0xa686('0xa')]=function(_0x408450){var _0x4176c0=this;return new Promise(function(_0x3605e1,_0x43ab9f){return db[_0xa686('0xb')][_0xa686('0xc')]({'raw':_0x408450['options']?_0x408450[_0xa686('0xd')][_0xa686('0xe')]===undefined?!![]:![]:!![],'where':_0x408450[_0xa686('0xd')]?_0x408450[_0xa686('0xd')][_0xa686('0xf')]||null:null,'attributes':_0x408450['options']?_0x408450[_0xa686('0xd')][_0xa686('0x10')]||null:null,'limit':_0x408450[_0xa686('0xd')]?_0x408450[_0xa686('0xd')][_0xa686('0x11')]||null:null,'include':_0x408450[_0xa686('0xd')]?_0x408450[_0xa686('0xd')][_0xa686('0x12')]?_['map'](_0x408450[_0xa686('0xd')]['include'],function(_0x33102f){return{'model':db[_0x33102f[_0xa686('0x13')]],'as':_0x33102f['as'],'attributes':_0x33102f['attributes'],'include':_0x33102f['include']?_['map'](_0x33102f['include'],function(_0x51e9fa){return{'model':db[_0x51e9fa[_0xa686('0x13')]],'as':_0x51e9fa['as'],'attributes':_0x51e9fa[_0xa686('0x10')],'include':_0x51e9fa[_0xa686('0x12')]?_[_0xa686('0x14')](_0x51e9fa[_0xa686('0x12')],function(_0x55fe3c){return{'model':db[_0x55fe3c[_0xa686('0x13')]],'as':_0x55fe3c['as'],'attributes':_0x55fe3c[_0xa686('0x10')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xd76532){logger[_0xa686('0x15')](_0xa686('0xa'),_0x408450);logger[_0xa686('0x16')](_0xa686('0xa'),_0x408450,JSON[_0xa686('0x17')](_0xd76532));_0x3605e1(_0xd76532);})[_0xa686('0x18')](function(_0x1de252){logger[_0xa686('0x19')]('GetSquareProjects',_0x1de252[_0xa686('0x1a')],_0x408450);_0x43ab9f(_0x4176c0['error'](0x1f4,_0x1de252[_0xa686('0x1a')]));});});};exports['ShowSquareProject']=function(_0x1b816f){var _0x47f815=this;return new Promise(function(_0xa7d46d,_0x34faaf){return db[_0xa686('0xb')]['find']({'raw':_0x1b816f[_0xa686('0xd')]?_0x1b816f['options'][_0xa686('0xe')]===undefined?!![]:![]:!![],'where':_0x1b816f['options']?_0x1b816f[_0xa686('0xd')]['where']||null:null,'attributes':_0x1b816f[_0xa686('0xd')]?_0x1b816f['options'][_0xa686('0x10')]||null:null,'include':_0x1b816f[_0xa686('0xd')]?_0x1b816f['options'][_0xa686('0x12')]?_[_0xa686('0x14')](_0x1b816f['options'][_0xa686('0x12')],function(_0x2721c1){return{'model':db[_0x2721c1[_0xa686('0x13')]],'as':_0x2721c1['as'],'attributes':_0x2721c1[_0xa686('0x10')],'include':_0x2721c1[_0xa686('0x12')]?_['map'](_0x2721c1['include'],function(_0x104b2c){return{'model':db[_0x104b2c[_0xa686('0x13')]],'as':_0x104b2c['as'],'attributes':_0x104b2c[_0xa686('0x10')],'include':_0x104b2c[_0xa686('0x12')]?_['map'](_0x104b2c['include'],function(_0x52c77b){return{'model':db[_0x52c77b[_0xa686('0x13')]],'as':_0x52c77b['as'],'attributes':_0x52c77b[_0xa686('0x10')]};}):[]};}):[]};}):[]:[]})[_0xa686('0x1b')](function(_0xff75ed){logger[_0xa686('0x15')]('ShowSquareProject',_0x1b816f);logger['debug'](_0xa686('0x1c'),_0x1b816f,JSON['stringify'](_0xff75ed));_0xa7d46d(_0xff75ed);})[_0xa686('0x18')](function(_0xe8a579){logger[_0xa686('0x19')](_0xa686('0x1c'),_0xe8a579[_0xa686('0x1a')],_0x1b816f);_0x34faaf(_0x47f815[_0xa686('0x19')](0x1f4,_0xe8a579[_0xa686('0x1a')]));});});};
\ No newline at end of file
index 4c1cb03..aaec0d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0353=['length','squareProject:','./squareProject.events','remove','update','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0353,0xd4));var _0x3035=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x0353[_0x1cd47d];return _0x29d52f;};'use strict';var SquareProjectEvents=require(_0x3035('0x0'));var events=['save',_0x3035('0x1'),_0x3035('0x2')];function createListener(_0x356096,_0x363169){return function(_0x1085a4){_0x363169['emit'](_0x356096,_0x1085a4);};}function removeListener(_0x2e7387,_0x153be2){return function(){SquareProjectEvents[_0x3035('0x3')](_0x2e7387,_0x153be2);};}exports[_0x3035('0x4')]=function(_0x12ac72){for(var _0x23536a=0x0,_0x327801=events[_0x3035('0x5')];_0x23536a<_0x327801;_0x23536a++){var _0x5a0fae=events[_0x23536a];var _0x1e518a=createListener(_0x3035('0x6')+_0x5a0fae,_0x12ac72);SquareProjectEvents['on'](_0x5a0fae,_0x1e518a);}};
\ No newline at end of file
+var _0x9b2a=['update','emit','removeListener','register','length','squareProject:','./squareProject.events','save','remove'];(function(_0x49d592,_0x5c7e18){var _0x31dca6=function(_0x1354af){while(--_0x1354af){_0x49d592['push'](_0x49d592['shift']());}};_0x31dca6(++_0x5c7e18);}(_0x9b2a,0x69));var _0xa9b2=function(_0x4c0fb6,_0x222b06){_0x4c0fb6=_0x4c0fb6-0x0;var _0xbd6340=_0x9b2a[_0x4c0fb6];return _0xbd6340;};'use strict';var SquareProjectEvents=require(_0xa9b2('0x0'));var events=[_0xa9b2('0x1'),_0xa9b2('0x2'),_0xa9b2('0x3')];function createListener(_0x434647,_0x4ffee9){return function(_0x4b23e1){_0x4ffee9[_0xa9b2('0x4')](_0x434647,_0x4b23e1);};}function removeListener(_0x3f6639,_0x28f99b){return function(){SquareProjectEvents[_0xa9b2('0x5')](_0x3f6639,_0x28f99b);};}exports[_0xa9b2('0x6')]=function(_0x4f268e){for(var _0x43c3a8=0x0,_0x5eada6=events[_0xa9b2('0x7')];_0x43c3a8<_0x5eada6;_0x43c3a8++){var _0x10ef5c=events[_0x43c3a8];var _0x4c9321=createListener(_0xa9b2('0x8')+_0x10ef5c,_0x4f268e);SquareProjectEvents['on'](_0x10ef5c,_0x4c9321);}};
\ No newline at end of file
index 15cc778..d7a2a77 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x238742,_0x46f903){var _0x1324f6=function(_0x4bea52){while(--_0x4bea52){_0x238742['push'](_0x238742['shift']());}};_0x1324f6(++_0x46f903);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router;
\ No newline at end of file
+var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x27412b,_0x4cc0f7){var _0x5c8b27=function(_0x2ff6a4){while(--_0x2ff6a4){_0x27412b['push'](_0x27412b['shift']());}};_0x5c8b27(++_0x4cc0f7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2181b1,_0x569637){_0x2181b1=_0x2181b1-0x0;var _0x530548=_0x7fbe[_0x2181b1];return _0x530548;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router;
\ No newline at end of file
index f094a80..8e387c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x98a8=['exports','STRING','VIRTUAL','savePath','substring','lastIndexOf','sequelize'];(function(_0x1f5e4a,_0x16111e){var _0x380da7=function(_0x49dbbb){while(--_0x49dbbb){_0x1f5e4a['push'](_0x1f5e4a['shift']());}};_0x380da7(++_0x16111e);}(_0x98a8,0x12c));var _0x898a=function(_0x599f83,_0x3b89eb){_0x599f83=_0x599f83-0x0;var _0x37cca4=_0x98a8[_0x599f83];return _0x37cca4;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'uniqueid':{'type':Sequelize[_0x898a('0x2')]},'callerid':{'type':Sequelize[_0x898a('0x2')]},'calleridname':{'type':Sequelize[_0x898a('0x2')]},'context':{'type':Sequelize[_0x898a('0x2')]},'extension':{'type':Sequelize[_0x898a('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x898a('0x2')]},'dnid':{'type':Sequelize[_0x898a('0x2')]},'projectName':{'type':Sequelize[_0x898a('0x2')]},'saveName':{'type':Sequelize[_0x898a('0x2')]},'filename':{'type':Sequelize[_0x898a('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x898a('0x3')],'get':function(){var _0x564583='';var _0xfa8c50=this['getDataValue'](_0x898a('0x4'));if(_0xfa8c50){_0x564583=_0xfa8c50[_0x898a('0x5')](_0xfa8c50[_0x898a('0x6')]('.'));}return _0x564583;}}};
\ No newline at end of file
+var _0x032e=['VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x2bd45b,_0x117bec){var _0x519aae=function(_0x514d09){while(--_0x514d09){_0x2bd45b['push'](_0x2bd45b['shift']());}};_0x519aae(++_0x117bec);}(_0x032e,0x124));var _0xe032=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0x032e[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0xe032('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe032('0x1')]},'callerid':{'type':Sequelize[_0xe032('0x1')]},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xe032('0x1')]},'priority':{'type':Sequelize[_0xe032('0x1')]},'accountcode':{'type':Sequelize[_0xe032('0x1')]},'dnid':{'type':Sequelize[_0xe032('0x1')]},'projectName':{'type':Sequelize[_0xe032('0x1')]},'saveName':{'type':Sequelize[_0xe032('0x1')]},'filename':{'type':Sequelize[_0xe032('0x1')]},'savePath':{'type':Sequelize[_0xe032('0x1')]},'format':{'type':Sequelize[_0xe032('0x2')],'get':function(){var _0x1576c8='';var _0x3289b0=this[_0xe032('0x3')](_0xe032('0x4'));if(_0x3289b0){_0x1576c8=_0x3289b0[_0xe032('0x5')](_0x3289b0[_0xe032('0x6')]('.'));}return _0x1576c8;}}};
\ No newline at end of file
index ab34179..3f1fcaf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c97=['destroy','end','error','stack','name','send','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','SquareRecording','includeAll','include','findAll','catch','show','params','fields','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','recording','existsSync','Sequelize','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','zip-dir','moment','bluebird','mustache','util','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x3c97,0x15d));var _0x73c9=function(_0x53f3e4,_0x167997){_0x53f3e4=_0x53f3e4-0x0;var _0x47d763=_0x3c97[_0x53f3e4];return _0x47d763;};'use strict';var emlformat=require(_0x73c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x73c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x73c9('0x2'));var BPromise=require(_0x73c9('0x3'));var Mustache=require(_0x73c9('0x4'));var util=require(_0x73c9('0x5'));var path=require('path');var sox=require(_0x73c9('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x73c9('0x7'));var squel=require(_0x73c9('0x8'));var crypto=require('crypto');var jsforce=require(_0x73c9('0x9'));var deskjs=require(_0x73c9('0xa'));var toCsv=require(_0x73c9('0xb'));var querystring=require(_0x73c9('0xc'));var Papa=require(_0x73c9('0xd'));var Redis=require(_0x73c9('0xe'));var authService=require(_0x73c9('0xf'));var qs=require(_0x73c9('0x10'));var as=require(_0x73c9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x73c9('0x12'))('api');var utils=require(_0x73c9('0x13'));var config=require(_0x73c9('0x14'));var licenseUtil=require(_0x73c9('0x15'));var db=require(_0x73c9('0x16'))['db'];function respondWithStatusCode(_0x31b700,_0x4f2f64){_0x4f2f64=_0x4f2f64||0xcc;return function(_0x1be97a){if(_0x1be97a){return _0x31b700['sendStatus'](_0x4f2f64);}return _0x31b700[_0x73c9('0x17')](_0x4f2f64)['end']();};}function respondWithResult(_0x2233f8,_0x514f47){_0x514f47=_0x514f47||0xc8;return function(_0x5ae86d){if(_0x5ae86d){return _0x2233f8[_0x73c9('0x17')](_0x514f47)[_0x73c9('0x18')](_0x5ae86d);}};}function respondWithFilteredResult(_0x3f96a3,_0x877eac){return function(_0x31a2a7){if(_0x31a2a7){var _0x323633=typeof _0x877eac[_0x73c9('0x19')]===_0x73c9('0x1a')&&typeof _0x877eac[_0x73c9('0x1b')]===_0x73c9('0x1a');var _0x4e42cb=_0x31a2a7[_0x73c9('0x1c')];var _0x2fd3a3=_0x323633?0x0:_0x877eac[_0x73c9('0x19')];var _0x4009a4=_0x323633?_0x31a2a7[_0x73c9('0x1c')]:_0x877eac[_0x73c9('0x19')]+_0x877eac[_0x73c9('0x1b')];var _0x11b340;if(_0x4009a4>=_0x4e42cb){_0x4009a4=_0x4e42cb;_0x11b340=0xc8;}else{_0x11b340=0xce;}_0x3f96a3[_0x73c9('0x17')](_0x11b340);return _0x3f96a3[_0x73c9('0x1d')](_0x73c9('0x1e'),_0x2fd3a3+'-'+_0x4009a4+'/'+_0x4e42cb)['json'](_0x31a2a7);}return null;};}function patchUpdates(_0x42c6a1){return function(_0x8c62aa){try{jsonpatch['apply'](_0x8c62aa,_0x42c6a1,!![]);}catch(_0x153065){return BPromise[_0x73c9('0x1f')](_0x153065);}return _0x8c62aa[_0x73c9('0x20')]();};}function saveUpdates(_0x31620e,_0x3c8236){return function(_0x7ad7f1){if(_0x7ad7f1){return _0x7ad7f1[_0x73c9('0x21')](_0x31620e)[_0x73c9('0x22')](function(_0x533b47){return _0x533b47;});}return null;};}function removeEntity(_0xea45e0,_0x20f802){return function(_0xe7c45c){if(_0xe7c45c){return _0xe7c45c[_0x73c9('0x23')]()[_0x73c9('0x22')](function(){_0xea45e0[_0x73c9('0x17')](0xcc)[_0x73c9('0x24')]();});}};}function handleEntityNotFound(_0x3bd8b1,_0x38b7ac){return function(_0x5589dc){if(!_0x5589dc){_0x3bd8b1['sendStatus'](0x194);}return _0x5589dc;};}function handleError(_0x426a4a,_0x29f6da){_0x29f6da=_0x29f6da||0x1f4;return function(_0x55cfd2){logger[_0x73c9('0x25')](_0x55cfd2[_0x73c9('0x26')]);if(_0x55cfd2['name']){delete _0x55cfd2[_0x73c9('0x27')];}_0x426a4a['status'](_0x29f6da)[_0x73c9('0x28')](_0x55cfd2);};}exports['index']=function(_0x4caca6,_0x161c76){var _0x3a0a3a={},_0x222bfb={},_0x3c5e67={'count':0x0,'rows':[]};var _0x2a67c9=_[_0x73c9('0x29')](db['SquareRecording'][_0x73c9('0x2a')],function(_0x3924a9){return{'name':_0x3924a9['fieldName'],'type':_0x3924a9['type'][_0x73c9('0x2b')]};});_0x222bfb['model']=_[_0x73c9('0x29')](_0x2a67c9,_0x73c9('0x27'));_0x222bfb[_0x73c9('0x2c')]=_[_0x73c9('0x2d')](_0x4caca6[_0x73c9('0x2c')]);_0x222bfb[_0x73c9('0x2e')]=_[_0x73c9('0x2f')](_0x222bfb[_0x73c9('0x30')],_0x222bfb[_0x73c9('0x2c')]);_0x3a0a3a[_0x73c9('0x31')]=_[_0x73c9('0x2f')](_0x222bfb[_0x73c9('0x30')],qs['fields'](_0x4caca6[_0x73c9('0x2c')]['fields']));_0x3a0a3a[_0x73c9('0x31')]=_0x3a0a3a['attributes'][_0x73c9('0x32')]?_0x3a0a3a[_0x73c9('0x31')]:_0x222bfb[_0x73c9('0x30')];if(!_0x4caca6[_0x73c9('0x2c')]['hasOwnProperty'](_0x73c9('0x33'))){_0x3a0a3a[_0x73c9('0x1b')]=qs[_0x73c9('0x1b')](_0x4caca6[_0x73c9('0x2c')][_0x73c9('0x1b')]);_0x3a0a3a[_0x73c9('0x19')]=qs[_0x73c9('0x19')](_0x4caca6[_0x73c9('0x2c')]['offset']);}_0x3a0a3a[_0x73c9('0x34')]=qs[_0x73c9('0x35')](_0x4caca6[_0x73c9('0x2c')][_0x73c9('0x35')]);_0x3a0a3a['where']=qs[_0x73c9('0x2e')](_[_0x73c9('0x36')](_0x4caca6[_0x73c9('0x2c')],_0x222bfb['filters']),_0x2a67c9);if(_0x4caca6[_0x73c9('0x2c')]['filter']){_0x3a0a3a[_0x73c9('0x37')]=_[_0x73c9('0x38')](_0x3a0a3a[_0x73c9('0x37')],{'$or':_['map'](_0x2a67c9,function(_0x8360ff){if(_0x8360ff[_0x73c9('0x39')]!==_0x73c9('0x3a')){var _0x258c55={};_0x258c55[_0x8360ff['name']]={'$like':'%'+_0x4caca6[_0x73c9('0x2c')][_0x73c9('0x3b')]+'%'};return _0x258c55;}})});}_0x3a0a3a=_['merge']({},_0x3a0a3a,_0x4caca6[_0x73c9('0x3c')]);var _0x33a787={'where':_0x3a0a3a['where']};return db[_0x73c9('0x3d')][_0x73c9('0x1c')](_0x33a787)['then'](function(_0x3266c8){_0x3c5e67[_0x73c9('0x1c')]=_0x3266c8;if(_0x4caca6[_0x73c9('0x2c')][_0x73c9('0x3e')]){_0x3a0a3a[_0x73c9('0x3f')]=[{'all':!![]}];}return db[_0x73c9('0x3d')][_0x73c9('0x40')](_0x3a0a3a);})['then'](function(_0x1dc0d9){_0x3c5e67['rows']=_0x1dc0d9;return _0x3c5e67;})['then'](respondWithFilteredResult(_0x161c76,_0x3a0a3a))[_0x73c9('0x41')](handleError(_0x161c76,null));};exports[_0x73c9('0x42')]=function(_0x28f768,_0x3d6e92){var _0x7f21f7={'raw':!![],'where':{'id':_0x28f768[_0x73c9('0x43')]['id']}},_0x17cab4={};_0x17cab4[_0x73c9('0x30')]=_['keys'](db['SquareRecording'][_0x73c9('0x2a')]);_0x17cab4[_0x73c9('0x2c')]=_[_0x73c9('0x2d')](_0x28f768[_0x73c9('0x2c')]);_0x17cab4['filters']=_['intersection'](_0x17cab4[_0x73c9('0x30')],_0x17cab4[_0x73c9('0x2c')]);_0x7f21f7[_0x73c9('0x31')]=_[_0x73c9('0x2f')](_0x17cab4[_0x73c9('0x30')],qs[_0x73c9('0x44')](_0x28f768[_0x73c9('0x2c')]['fields']));_0x7f21f7[_0x73c9('0x31')]=_0x7f21f7[_0x73c9('0x31')][_0x73c9('0x32')]?_0x7f21f7[_0x73c9('0x31')]:_0x17cab4['model'];if(_0x28f768[_0x73c9('0x2c')][_0x73c9('0x3e')]){_0x7f21f7[_0x73c9('0x3f')]=[{'all':!![]}];}_0x7f21f7=_[_0x73c9('0x38')]({},_0x7f21f7,_0x28f768[_0x73c9('0x3c')]);return db[_0x73c9('0x3d')]['find'](_0x7f21f7)[_0x73c9('0x22')](handleEntityNotFound(_0x3d6e92,null))['then'](respondWithResult(_0x3d6e92,null))[_0x73c9('0x41')](handleError(_0x3d6e92,null));};exports['create']=function(_0x41ec11,_0x4228c2){return db[_0x73c9('0x3d')]['create'](_0x41ec11[_0x73c9('0x45')],{})[_0x73c9('0x22')](respondWithResult(_0x4228c2,0xc9))['catch'](handleError(_0x4228c2,null));};exports['update']=function(_0x571d88,_0x56e7a1){if(_0x571d88['body']['id']){delete _0x571d88[_0x73c9('0x45')]['id'];}return db['SquareRecording'][_0x73c9('0x46')]({'where':{'id':_0x571d88[_0x73c9('0x43')]['id']}})['then'](handleEntityNotFound(_0x56e7a1,null))[_0x73c9('0x22')](saveUpdates(_0x571d88[_0x73c9('0x45')],null))['then'](respondWithResult(_0x56e7a1,null))[_0x73c9('0x41')](handleError(_0x56e7a1,null));};exports[_0x73c9('0x47')]=function(_0xaf1879,_0xbb860d,_0x3e1236){var _0x341d4d=require(_0x73c9('0x48'));var _0x21dfe9=![];var _0x4ffeec={};if(_0xaf1879[_0x73c9('0x2c')][_0x73c9('0x39')]&&_0xaf1879[_0x73c9('0x2c')][_0x73c9('0x39')]===_0x73c9('0x49')){_0x4ffeec[_0x73c9('0x49')]=_0xaf1879[_0x73c9('0x43')]['id'];}else{_0x4ffeec['id']=_0xaf1879[_0x73c9('0x43')]['id'];}return db[_0x73c9('0x3d')]['find']({'where':_0x4ffeec,'attributes':['id',_0x73c9('0x4a'),_0x73c9('0x4b')],'raw':!![]})[_0x73c9('0x22')](handleEntityNotFound(_0xbb860d,null))[_0x73c9('0x22')](function(_0x30fbcd){if(_0x30fbcd){var _0x4ab185=_0x30fbcd['savePath'];var _0x145065=util[_0x73c9('0x4c')](_0x73c9('0x4d'),_0x4ab185);if(fs['existsSync'](_0x145065)){_0x21dfe9=!![];return _0x341d4d[_0x73c9('0x4e')](_0x145065,_0x4ab185,config['secrets'][_0x73c9('0x4f')])['then'](function(){return _0x30fbcd;});}return _0x30fbcd;}})[_0x73c9('0x22')](function(_0x36326c){if(_0x36326c){var _0x5e4720=_0x36326c[_0x73c9('0x4a')];if(!fs[_0x73c9('0x50')](_0x5e4720)){throw new db[(_0x73c9('0x51'))][(_0x73c9('0x52'))](_0x73c9('0x53'));}if(_0x36326c[_0x73c9('0x4b')]){return _0xbb860d['download'](_0x5e4720,_0x36326c[_0x73c9('0x4b')]+path[_0x73c9('0x54')](_0x5e4720),function(){if(_0x21dfe9){fs['unlink'](_0x5e4720);}});}else{return _0xbb860d[_0x73c9('0x47')](_0x5e4720,function(_0x3973dd){if(_0x21dfe9){fs[_0x73c9('0x55')](_0x5e4720);}});}}})['catch'](function(_0x2c0983){if(_0x2c0983[_0x73c9('0x56')]===_0x73c9('0x53')){_0xbb860d[_0x73c9('0x17')](0x194)[_0x73c9('0x28')](_0x73c9('0x57'));}else{return handleError(_0xbb860d,null);}});};exports['destroy']=function(_0x12a7df,_0x4168ad){return db['SquareRecording'][_0x73c9('0x46')]({'where':{'id':_0x12a7df[_0x73c9('0x43')]['id']}})[_0x73c9('0x22')](function(_0x19bfe0){if(_['isNil'](_0x19bfe0)){throw new ReferenceError(_0x73c9('0x58'));}return _0x19bfe0;})[_0x73c9('0x22')](function(_0x10b459){var _0x59c85f=_0x10b459[_0x73c9('0x4a')];logger[_0x73c9('0x59')](_0x73c9('0x5a'),_0x59c85f);if(!_[_0x73c9('0x5b')](_0x10b459[_0x73c9('0x4a')])&&fs['existsSync'](_0x59c85f)){logger['info']('File:\x20\x22'+_0x59c85f+_0x73c9('0x5c'));fs[_0x73c9('0x5d')](_0x59c85f);}_0x59c85f=_0x59c85f+_0x73c9('0x5e');if(!_[_0x73c9('0x5b')](_0x10b459[_0x73c9('0x4a')])&&fs[_0x73c9('0x50')](_0x59c85f)){logger[_0x73c9('0x59')](_0x73c9('0x5f')+_0x59c85f+_0x73c9('0x5c'));fs[_0x73c9('0x5d')](_0x59c85f);}return _0x10b459;})['then'](function(_0x3db7de){if(!_0x3db7de)throw new InternalError();return _0x3db7de[_0x73c9('0x23')]();})['then'](function(){_0x4168ad[_0x73c9('0x17')](0xcc)[_0x73c9('0x24')]();})[_0x73c9('0x41')](handleError(_0x4168ad,null));};
\ No newline at end of file
+var _0xec20=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','SquareRecording','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','decryptFile','secrets','recording','existsSync','filename','extname','unlink','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xec20,0xb5));var _0x0ec2=function(_0x4d8b1d,_0x3c42bf){_0x4d8b1d=_0x4d8b1d-0x0;var _0x467bfb=_0xec20[_0x4d8b1d];return _0x467bfb;};'use strict';var emlformat=require(_0x0ec2('0x0'));var rimraf=require(_0x0ec2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ec2('0x2'));var rp=require(_0x0ec2('0x3'));var moment=require('moment');var BPromise=require(_0x0ec2('0x4'));var Mustache=require(_0x0ec2('0x5'));var util=require(_0x0ec2('0x6'));var path=require(_0x0ec2('0x7'));var sox=require(_0x0ec2('0x8'));var csv=require(_0x0ec2('0x9'));var ejs=require(_0x0ec2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ec2('0xb'));var squel=require(_0x0ec2('0xc'));var crypto=require(_0x0ec2('0xd'));var jsforce=require(_0x0ec2('0xe'));var deskjs=require(_0x0ec2('0xf'));var toCsv=require(_0x0ec2('0x9'));var querystring=require(_0x0ec2('0x10'));var Papa=require(_0x0ec2('0x11'));var Redis=require(_0x0ec2('0x12'));var authService=require(_0x0ec2('0x13'));var qs=require(_0x0ec2('0x14'));var as=require(_0x0ec2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0ec2('0x16'));var utils=require(_0x0ec2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x0ec2('0x18'));var db=require(_0x0ec2('0x19'))['db'];function respondWithStatusCode(_0x2513bf,_0x33dfe5){_0x33dfe5=_0x33dfe5||0xcc;return function(_0xc54c79){if(_0xc54c79){return _0x2513bf[_0x0ec2('0x1a')](_0x33dfe5);}return _0x2513bf['status'](_0x33dfe5)[_0x0ec2('0x1b')]();};}function respondWithResult(_0x5de80d,_0x4b9204){_0x4b9204=_0x4b9204||0xc8;return function(_0x66ce1){if(_0x66ce1){return _0x5de80d['status'](_0x4b9204)[_0x0ec2('0x1c')](_0x66ce1);}};}function respondWithFilteredResult(_0x344e4c,_0x9e7113){return function(_0x2cee99){if(_0x2cee99){var _0x10af1b=typeof _0x9e7113['offset']===_0x0ec2('0x1d')&&typeof _0x9e7113[_0x0ec2('0x1e')]===_0x0ec2('0x1d');var _0xf48c59=_0x2cee99[_0x0ec2('0x1f')];var _0x58bdf1=_0x10af1b?0x0:_0x9e7113[_0x0ec2('0x20')];var _0x3906a3=_0x10af1b?_0x2cee99[_0x0ec2('0x1f')]:_0x9e7113[_0x0ec2('0x20')]+_0x9e7113[_0x0ec2('0x1e')];var _0x15d82a;if(_0x3906a3>=_0xf48c59){_0x3906a3=_0xf48c59;_0x15d82a=0xc8;}else{_0x15d82a=0xce;}_0x344e4c['status'](_0x15d82a);return _0x344e4c[_0x0ec2('0x21')](_0x0ec2('0x22'),_0x58bdf1+'-'+_0x3906a3+'/'+_0xf48c59)[_0x0ec2('0x1c')](_0x2cee99);}return null;};}function patchUpdates(_0x536d82){return function(_0xfb88fe){try{jsonpatch[_0x0ec2('0x23')](_0xfb88fe,_0x536d82,!![]);}catch(_0x3fd375){return BPromise[_0x0ec2('0x24')](_0x3fd375);}return _0xfb88fe[_0x0ec2('0x25')]();};}function saveUpdates(_0x3cb274,_0x65ae2d){return function(_0x1e46d0){if(_0x1e46d0){return _0x1e46d0[_0x0ec2('0x26')](_0x3cb274)[_0x0ec2('0x27')](function(_0xb6962f){return _0xb6962f;});}return null;};}function removeEntity(_0x1a14b1,_0xcd5763){return function(_0x30dc2b){if(_0x30dc2b){return _0x30dc2b[_0x0ec2('0x28')]()[_0x0ec2('0x27')](function(){_0x1a14b1[_0x0ec2('0x29')](0xcc)[_0x0ec2('0x1b')]();});}};}function handleEntityNotFound(_0x31c4c1,_0x59f99d){return function(_0x5f48fa){if(!_0x5f48fa){_0x31c4c1[_0x0ec2('0x1a')](0x194);}return _0x5f48fa;};}function handleError(_0xacb0c9,_0x33e2de){_0x33e2de=_0x33e2de||0x1f4;return function(_0x2875de){logger[_0x0ec2('0x2a')](_0x2875de[_0x0ec2('0x2b')]);if(_0x2875de[_0x0ec2('0x2c')]){delete _0x2875de[_0x0ec2('0x2c')];}_0xacb0c9['status'](_0x33e2de)[_0x0ec2('0x2d')](_0x2875de);};}exports[_0x0ec2('0x2e')]=function(_0x504dde,_0x126259){var _0x4717f3={},_0x3a5130={},_0xfe514d={'count':0x0,'rows':[]};var _0x54db71=_[_0x0ec2('0x2f')](db[_0x0ec2('0x30')]['rawAttributes'],function(_0x52c6d2){return{'name':_0x52c6d2[_0x0ec2('0x31')],'type':_0x52c6d2[_0x0ec2('0x32')][_0x0ec2('0x33')]};});_0x3a5130[_0x0ec2('0x34')]=_[_0x0ec2('0x2f')](_0x54db71,_0x0ec2('0x2c'));_0x3a5130[_0x0ec2('0x35')]=_['keys'](_0x504dde[_0x0ec2('0x35')]);_0x3a5130[_0x0ec2('0x36')]=_[_0x0ec2('0x37')](_0x3a5130[_0x0ec2('0x34')],_0x3a5130['query']);_0x4717f3[_0x0ec2('0x38')]=_[_0x0ec2('0x37')](_0x3a5130[_0x0ec2('0x34')],qs[_0x0ec2('0x39')](_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x39')]));_0x4717f3[_0x0ec2('0x38')]=_0x4717f3[_0x0ec2('0x38')][_0x0ec2('0x3a')]?_0x4717f3[_0x0ec2('0x38')]:_0x3a5130[_0x0ec2('0x34')];if(!_0x504dde[_0x0ec2('0x35')]['hasOwnProperty'](_0x0ec2('0x3b'))){_0x4717f3[_0x0ec2('0x1e')]=qs[_0x0ec2('0x1e')](_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x1e')]);_0x4717f3[_0x0ec2('0x20')]=qs[_0x0ec2('0x20')](_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x20')]);}_0x4717f3[_0x0ec2('0x3c')]=qs['sort'](_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x3d')]);_0x4717f3[_0x0ec2('0x3e')]=qs[_0x0ec2('0x36')](_['pick'](_0x504dde[_0x0ec2('0x35')],_0x3a5130['filters']),_0x54db71);if(_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x3f')]){_0x4717f3[_0x0ec2('0x3e')]=_[_0x0ec2('0x40')](_0x4717f3[_0x0ec2('0x3e')],{'$or':_[_0x0ec2('0x2f')](_0x54db71,function(_0x2bef78){if(_0x2bef78[_0x0ec2('0x32')]!==_0x0ec2('0x41')){var _0x18bcdc={};_0x18bcdc[_0x2bef78[_0x0ec2('0x2c')]]={'$like':'%'+_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x3f')]+'%'};return _0x18bcdc;}})});}_0x4717f3=_[_0x0ec2('0x40')]({},_0x4717f3,_0x504dde[_0x0ec2('0x42')]);var _0x392673={'where':_0x4717f3[_0x0ec2('0x3e')]};return db[_0x0ec2('0x30')][_0x0ec2('0x1f')](_0x392673)[_0x0ec2('0x27')](function(_0x31e6a3){_0xfe514d['count']=_0x31e6a3;if(_0x504dde[_0x0ec2('0x35')][_0x0ec2('0x43')]){_0x4717f3[_0x0ec2('0x44')]=[{'all':!![]}];}return db[_0x0ec2('0x30')][_0x0ec2('0x45')](_0x4717f3);})[_0x0ec2('0x27')](function(_0x26ed57){_0xfe514d['rows']=_0x26ed57;return _0xfe514d;})[_0x0ec2('0x27')](respondWithFilteredResult(_0x126259,_0x4717f3))[_0x0ec2('0x46')](handleError(_0x126259,null));};exports[_0x0ec2('0x47')]=function(_0x47111d,_0x37386b){var _0x3f925e={'raw':!![],'where':{'id':_0x47111d[_0x0ec2('0x48')]['id']}},_0x374727={};_0x374727[_0x0ec2('0x34')]=_[_0x0ec2('0x49')](db['SquareRecording'][_0x0ec2('0x4a')]);_0x374727['query']=_['keys'](_0x47111d['query']);_0x374727[_0x0ec2('0x36')]=_['intersection'](_0x374727[_0x0ec2('0x34')],_0x374727['query']);_0x3f925e['attributes']=_[_0x0ec2('0x37')](_0x374727['model'],qs[_0x0ec2('0x39')](_0x47111d['query']['fields']));_0x3f925e[_0x0ec2('0x38')]=_0x3f925e[_0x0ec2('0x38')][_0x0ec2('0x3a')]?_0x3f925e[_0x0ec2('0x38')]:_0x374727[_0x0ec2('0x34')];if(_0x47111d['query'][_0x0ec2('0x43')]){_0x3f925e[_0x0ec2('0x44')]=[{'all':!![]}];}_0x3f925e=_['merge']({},_0x3f925e,_0x47111d[_0x0ec2('0x42')]);return db[_0x0ec2('0x30')][_0x0ec2('0x4b')](_0x3f925e)[_0x0ec2('0x27')](handleEntityNotFound(_0x37386b,null))[_0x0ec2('0x27')](respondWithResult(_0x37386b,null))['catch'](handleError(_0x37386b,null));};exports[_0x0ec2('0x4c')]=function(_0x6bed50,_0x41758c){return db['SquareRecording'][_0x0ec2('0x4c')](_0x6bed50[_0x0ec2('0x4d')],{})[_0x0ec2('0x27')](respondWithResult(_0x41758c,0xc9))[_0x0ec2('0x46')](handleError(_0x41758c,null));};exports[_0x0ec2('0x26')]=function(_0x10d4ef,_0x59f39c){if(_0x10d4ef['body']['id']){delete _0x10d4ef['body']['id'];}return db[_0x0ec2('0x30')][_0x0ec2('0x4b')]({'where':{'id':_0x10d4ef[_0x0ec2('0x48')]['id']}})[_0x0ec2('0x27')](handleEntityNotFound(_0x59f39c,null))[_0x0ec2('0x27')](saveUpdates(_0x10d4ef[_0x0ec2('0x4d')],null))[_0x0ec2('0x27')](respondWithResult(_0x59f39c,null))['catch'](handleError(_0x59f39c,null));};exports[_0x0ec2('0x4e')]=function(_0x3ceedf,_0x3445df,_0x1018b1){var _0x28972c=require(_0x0ec2('0x4f'));var _0x3c1ed0=![];var _0x215d7c={};if(_0x3ceedf['query'][_0x0ec2('0x32')]&&_0x3ceedf[_0x0ec2('0x35')][_0x0ec2('0x32')]===_0x0ec2('0x50')){_0x215d7c['uniqueid']=_0x3ceedf[_0x0ec2('0x48')]['id'];}else{_0x215d7c['id']=_0x3ceedf[_0x0ec2('0x48')]['id'];}return db[_0x0ec2('0x30')][_0x0ec2('0x4b')]({'where':_0x215d7c,'attributes':['id',_0x0ec2('0x51'),'filename'],'raw':!![]})[_0x0ec2('0x27')](handleEntityNotFound(_0x3445df,null))[_0x0ec2('0x27')](function(_0x9d26ba){if(_0x9d26ba){var _0x4e387a=_0x9d26ba[_0x0ec2('0x51')];var _0x51f41f=util[_0x0ec2('0x52')](_0x0ec2('0x53'),_0x4e387a);if(fs['existsSync'](_0x51f41f)){_0x3c1ed0=!![];return _0x28972c[_0x0ec2('0x54')](_0x51f41f,_0x4e387a,config[_0x0ec2('0x55')][_0x0ec2('0x56')])['then'](function(){return _0x9d26ba;});}return _0x9d26ba;}})[_0x0ec2('0x27')](function(_0x86a36f){if(_0x86a36f){var _0xa84898=_0x86a36f[_0x0ec2('0x51')];if(!fs[_0x0ec2('0x57')](_0xa84898)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x86a36f['filename']){return _0x3445df[_0x0ec2('0x4e')](_0xa84898,_0x86a36f[_0x0ec2('0x58')]+path[_0x0ec2('0x59')](_0xa84898),function(){if(_0x3c1ed0){fs[_0x0ec2('0x5a')](_0xa84898);}});}else{return _0x3445df[_0x0ec2('0x4e')](_0xa84898,function(_0x4d4364){if(_0x3c1ed0){fs[_0x0ec2('0x5a')](_0xa84898);}});}}})[_0x0ec2('0x46')](function(_0x1ae58a){if(_0x1ae58a['message']===_0x0ec2('0x5b')){_0x3445df[_0x0ec2('0x29')](0x194)[_0x0ec2('0x2d')](_0x0ec2('0x5c'));}else{return handleError(_0x3445df,null);}});};exports[_0x0ec2('0x28')]=function(_0x3f92b5,_0x129eff){return db[_0x0ec2('0x30')][_0x0ec2('0x4b')]({'where':{'id':_0x3f92b5['params']['id']}})[_0x0ec2('0x27')](function(_0x6ae248){if(_[_0x0ec2('0x5d')](_0x6ae248)){throw new ReferenceError(_0x0ec2('0x5e'));}return _0x6ae248;})['then'](function(_0x3f51a5){var _0x4f21b6=_0x3f51a5[_0x0ec2('0x51')];logger[_0x0ec2('0x5f')](_0x0ec2('0x60'),_0x4f21b6);if(!_[_0x0ec2('0x5d')](_0x3f51a5[_0x0ec2('0x51')])&&fs[_0x0ec2('0x57')](_0x4f21b6)){logger[_0x0ec2('0x5f')](_0x0ec2('0x61')+_0x4f21b6+_0x0ec2('0x62'));fs[_0x0ec2('0x63')](_0x4f21b6);}_0x4f21b6=_0x4f21b6+'.cypher';if(!_[_0x0ec2('0x5d')](_0x3f51a5['savePath'])&&fs[_0x0ec2('0x57')](_0x4f21b6)){logger[_0x0ec2('0x5f')](_0x0ec2('0x61')+_0x4f21b6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x0ec2('0x63')](_0x4f21b6);}return _0x3f51a5;})[_0x0ec2('0x27')](function(_0x25866c){if(!_0x25866c)throw new InternalError();return _0x25866c[_0x0ec2('0x28')]();})[_0x0ec2('0x27')](function(){_0x129eff[_0x0ec2('0x29')](0xcc)['end']();})[_0x0ec2('0x46')](handleError(_0x129eff,null));};
\ No newline at end of file
index a1b4a08..a2a88c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x83d0=['./squareRecording.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0xab1898,_0x535f14){var _0x3a9c70=function(_0x57bb36){while(--_0x57bb36){_0xab1898['push'](_0xab1898['shift']());}};_0x3a9c70(++_0x535f14);}(_0x83d0,0xb7));var _0x083d=function(_0x10de25,_0x2de4fa){_0x10de25=_0x10de25-0x0;var _0x12b301=_0x83d0[_0x10de25];return _0x12b301;};'use strict';var _=require(_0x083d('0x0'));var util=require(_0x083d('0x1'));var logger=require(_0x083d('0x2'))(_0x083d('0x3'));var moment=require(_0x083d('0x4'));var BPromise=require(_0x083d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x083d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x083d('0x7'));module[_0x083d('0x8')]=function(_0x3c4b8c,_0x2e75e8){return _0x3c4b8c[_0x083d('0x9')]('SquareRecording',attributes,{'tableName':'square_recordings','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9b09=['util','api','moment','request-promise','rimraf','./squareRecording.attributes','exports','define','square_recordings','lodash'];(function(_0x1a4aea,_0x24fc64){var _0x24a48a=function(_0x286d5a){while(--_0x286d5a){_0x1a4aea['push'](_0x1a4aea['shift']());}};_0x24a48a(++_0x24fc64);}(_0x9b09,0x1ad));var _0x99b0=function(_0x25f797,_0x449916){_0x25f797=_0x25f797-0x0;var _0x157fdd=_0x9b09[_0x25f797];return _0x157fdd;};'use strict';var _=require(_0x99b0('0x0'));var util=require(_0x99b0('0x1'));var logger=require('../../config/logger')(_0x99b0('0x2'));var moment=require(_0x99b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x99b0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x99b0('0x5'));var config=require('../../config/environment');var attributes=require(_0x99b0('0x6'));module[_0x99b0('0x7')]=function(_0x498180,_0x466c23){return _0x498180[_0x99b0('0x8')]('SquareRecording',attributes,{'tableName':_0x99b0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c08c55c..0d318a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0ad4=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareRecording','SquareRecording','body','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request'];(function(_0x24887d,_0xf81af9){var _0xe08583=function(_0x4bf06d){while(--_0x4bf06d){_0x24887d['push'](_0x24887d['shift']());}};_0xe08583(++_0xf81af9);}(_0x0ad4,0xb8));var _0x40ad=function(_0x54cf47,_0x3207ee){_0x54cf47=_0x54cf47-0x0;var _0x32803f=_0x0ad4[_0x54cf47];return _0x32803f;};'use strict';var _=require('lodash');var util=require(_0x40ad('0x0'));var moment=require(_0x40ad('0x1'));var BPromise=require(_0x40ad('0x2'));var rs=require(_0x40ad('0x3'));var fs=require('fs');var Redis=require(_0x40ad('0x4'));var db=require(_0x40ad('0x5'))['db'];var utils=require(_0x40ad('0x6'));var logger=require(_0x40ad('0x7'))('rpc');var config=require(_0x40ad('0x8'));var jayson=require(_0x40ad('0x9'));var client=jayson['client'][_0x40ad('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5d8079,_0x2588da,_0x47175c){return new BPromise(function(_0x413f25,_0x1757b1){return client[_0x40ad('0xb')](_0x5d8079,_0x47175c)[_0x40ad('0xc')](function(_0x256d6d){logger[_0x40ad('0xd')](_0x40ad('0xe'),_0x2588da,_0x40ad('0xf'));logger[_0x40ad('0x10')](_0x40ad('0x11'),_0x2588da,'request\x20sent',JSON[_0x40ad('0x12')](_0x256d6d));if(_0x256d6d['error']){if(_0x256d6d[_0x40ad('0x13')]['code']===0x1f4){logger[_0x40ad('0x13')](_0x40ad('0xe'),_0x2588da,_0x256d6d[_0x40ad('0x13')][_0x40ad('0x14')]);return _0x1757b1(_0x256d6d['error'][_0x40ad('0x14')]);}logger[_0x40ad('0x13')](_0x40ad('0xe'),_0x2588da,_0x256d6d[_0x40ad('0x13')][_0x40ad('0x14')]);return _0x413f25(_0x256d6d['error']['message']);}else{logger['info'](_0x40ad('0xe'),_0x2588da,_0x40ad('0xf'));_0x413f25(_0x256d6d[_0x40ad('0x15')][_0x40ad('0x14')]);}})[_0x40ad('0x16')](function(_0x34ec9b){logger[_0x40ad('0x13')](_0x40ad('0xe'),_0x2588da,_0x34ec9b);_0x1757b1(_0x34ec9b);});});}exports[_0x40ad('0x17')]=function(_0x21de37){var _0x4dc4db=this;return new Promise(function(_0x49e11a,_0x1cd1d4){return db[_0x40ad('0x18')]['create'](_0x21de37[_0x40ad('0x19')],{'raw':_0x21de37['options']?_0x21de37[_0x40ad('0x1a')][_0x40ad('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x5715b3){logger[_0x40ad('0xd')](_0x40ad('0x17'),_0x21de37);logger[_0x40ad('0x10')]('CreateSquareRecording',_0x21de37,JSON['stringify'](_0x5715b3));_0x49e11a(_0x5715b3);})[_0x40ad('0x16')](function(_0x49f56a){logger[_0x40ad('0x13')](_0x40ad('0x17'),_0x49f56a['message'],_0x21de37);_0x1cd1d4(_0x4dc4db[_0x40ad('0x13')](0x1f4,_0x49f56a[_0x40ad('0x14')]));});});};
\ No newline at end of file
+var _0x5628=['request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','SquareRecording','create','body','options','raw','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client','http','request','info','SquareRecording,\x20%s,\x20%s'];(function(_0x33f30a,_0x243d8d){var _0x422d3d=function(_0x22b717){while(--_0x22b717){_0x33f30a['push'](_0x33f30a['shift']());}};_0x422d3d(++_0x243d8d);}(_0x5628,0xc5));var _0x8562=function(_0x3475f3,_0x534e11){_0x3475f3=_0x3475f3-0x0;var _0x21c52e=_0x5628[_0x3475f3];return _0x21c52e;};'use strict';var _=require(_0x8562('0x0'));var util=require('util');var moment=require(_0x8562('0x1'));var BPromise=require(_0x8562('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8562('0x3'));var db=require(_0x8562('0x4'))['db'];var utils=require(_0x8562('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8562('0x6')][_0x8562('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4b7083,_0x614f2f,_0x561e0d){return new BPromise(function(_0x44b8b4,_0x22ae18){return client[_0x8562('0x8')](_0x4b7083,_0x561e0d)['then'](function(_0x4e871c){logger[_0x8562('0x9')](_0x8562('0xa'),_0x614f2f,_0x8562('0xb'));logger[_0x8562('0xc')](_0x8562('0xd'),_0x614f2f,_0x8562('0xb'),JSON[_0x8562('0xe')](_0x4e871c));if(_0x4e871c[_0x8562('0xf')]){if(_0x4e871c[_0x8562('0xf')][_0x8562('0x10')]===0x1f4){logger[_0x8562('0xf')](_0x8562('0xa'),_0x614f2f,_0x4e871c['error'][_0x8562('0x11')]);return _0x22ae18(_0x4e871c[_0x8562('0xf')][_0x8562('0x11')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x614f2f,_0x4e871c[_0x8562('0xf')][_0x8562('0x11')]);return _0x44b8b4(_0x4e871c[_0x8562('0xf')][_0x8562('0x11')]);}else{logger[_0x8562('0x9')](_0x8562('0xa'),_0x614f2f,_0x8562('0xb'));_0x44b8b4(_0x4e871c[_0x8562('0x12')][_0x8562('0x11')]);}})['catch'](function(_0x1f66a6){logger[_0x8562('0xf')]('SquareRecording,\x20%s,\x20%s',_0x614f2f,_0x1f66a6);_0x22ae18(_0x1f66a6);});});}exports[_0x8562('0x13')]=function(_0x364838){var _0x1d559d=this;return new Promise(function(_0x13a98e,_0x52aa07){return db[_0x8562('0x14')][_0x8562('0x15')](_0x364838[_0x8562('0x16')],{'raw':_0x364838[_0x8562('0x17')]?_0x364838[_0x8562('0x17')][_0x8562('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x2fa3e2){logger['info'](_0x8562('0x13'),_0x364838);logger['debug']('CreateSquareRecording',_0x364838,JSON[_0x8562('0xe')](_0x2fa3e2));_0x13a98e(_0x2fa3e2);})[_0x8562('0x19')](function(_0x377ad4){logger['error'](_0x8562('0x13'),_0x377ad4[_0x8562('0x11')],_0x364838);_0x52aa07(_0x1d559d[_0x8562('0xf')](0x1f4,_0x377ad4[_0x8562('0x11')]));});});};
\ No newline at end of file
index 0b9c977..744ce12 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x1b8c3a,_0x1eb604){var _0x31f0f3=function(_0x4bfdd7){while(--_0x4bfdd7){_0x1b8c3a['push'](_0x1b8c3a['shift']());}};_0x31f0f3(++_0x1eb604);}(_0xe706,0xa3));var _0x6e70=function(_0x4292cd,_0x327a40){_0x4292cd=_0x4292cd-0x0;var _0x5e4838=_0xe706[_0x4292cd];return _0x5e4838;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router;
\ No newline at end of file
+var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0x1bde77,_0x470905){var _0x44e5e1=function(_0x216043){while(--_0x216043){_0x1bde77['push'](_0x1bde77['shift']());}};_0x44e5e1(++_0x470905);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('0x14')]=router;
\ No newline at end of file
index e0974d7..20782ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3423=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x41052b,_0x124bd4){var _0xcb0005=function(_0x1834b3){while(--_0x1834b3){_0x41052b['push'](_0x41052b['shift']());}};_0xcb0005(++_0x124bd4);}(_0x3423,0x77));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3342('0x0'));module[_0x3342('0x1')]={'network':{'type':Sequelize[_0x3342('0x2')]},'network_script':{'type':Sequelize[_0x3342('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3342('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3342('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x3342('0x2')]},'callerid':{'type':Sequelize[_0x3342('0x2')]},'calleridname':{'type':Sequelize[_0x3342('0x2')]},'callingpres':{'type':Sequelize[_0x3342('0x2')]},'callingani2':{'type':Sequelize[_0x3342('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x3342('0x2')]},'dnid':{'type':Sequelize[_0x3342('0x2')]},'rdnis':{'type':Sequelize[_0x3342('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x3342('0x2')]},'priority':{'type':Sequelize[_0x3342('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3342('0x2')]},'threadid':{'type':Sequelize[_0x3342('0x2')]},'project_name':{'type':Sequelize[_0x3342('0x2')]},'joinAt':{'type':Sequelize[_0x3342('0x3')]},'leaveAt':{'type':Sequelize[_0x3342('0x3')]},'bot':{'type':Sequelize[_0x3342('0x4')],'defaultValue':![]}};
\ No newline at end of file
+var _0x0efc=['DATE','BOOLEAN','exports','STRING'];(function(_0x23c801,_0x4ebd81){var _0x3baf14=function(_0x5a749f){while(--_0x5a749f){_0x23c801['push'](_0x23c801['shift']());}};_0x3baf14(++_0x4ebd81);}(_0x0efc,0x1ee));var _0xc0ef=function(_0x1f8a2a,_0x906b0f){_0x1f8a2a=_0x1f8a2a-0x0;var _0x4dcaa7=_0x0efc[_0x1f8a2a];return _0x4dcaa7;};'use strict';var Sequelize=require('sequelize');module[_0xc0ef('0x0')]={'network':{'type':Sequelize[_0xc0ef('0x1')]},'network_script':{'type':Sequelize[_0xc0ef('0x1')]},'request':{'type':Sequelize[_0xc0ef('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc0ef('0x1')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0xc0ef('0x1')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0xc0ef('0x1')]},'dnid':{'type':Sequelize[_0xc0ef('0x1')]},'rdnis':{'type':Sequelize[_0xc0ef('0x1')]},'context':{'type':Sequelize[_0xc0ef('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xc0ef('0x1')]},'enhanced':{'type':Sequelize[_0xc0ef('0x1')]},'accountcode':{'type':Sequelize[_0xc0ef('0x1')]},'threadid':{'type':Sequelize[_0xc0ef('0x1')]},'project_name':{'type':Sequelize[_0xc0ef('0x1')]},'joinAt':{'type':Sequelize[_0xc0ef('0x2')]},'leaveAt':{'type':Sequelize[_0xc0ef('0x2')]},'bot':{'type':Sequelize[_0xc0ef('0x3')],'defaultValue':![]}};
\ No newline at end of file
index bc54f0a..82d29c8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdea2=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','fields','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','update','then','destroy','error','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','length','nolimit','order','sort'];(function(_0x34a969,_0x2881e1){var _0x19c3d7=function(_0x3ceb92){while(--_0x3ceb92){_0x34a969['push'](_0x34a969['shift']());}};_0x19c3d7(++_0x2881e1);}(_0xdea2,0x1d4));var _0x2dea=function(_0x6c6d17,_0x203165){_0x6c6d17=_0x6c6d17-0x0;var _0x425f24=_0xdea2[_0x6c6d17];return _0x425f24;};'use strict';var emlformat=require(_0x2dea('0x0'));var rimraf=require(_0x2dea('0x1'));var zipdir=require(_0x2dea('0x2'));var jsonpatch=require(_0x2dea('0x3'));var rp=require(_0x2dea('0x4'));var moment=require(_0x2dea('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2dea('0x6'));var path=require(_0x2dea('0x7'));var sox=require(_0x2dea('0x8'));var csv=require(_0x2dea('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dea('0xa'));var _=require(_0x2dea('0xb'));var squel=require(_0x2dea('0xc'));var crypto=require(_0x2dea('0xd'));var jsforce=require(_0x2dea('0xe'));var deskjs=require(_0x2dea('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2dea('0x10'));var Papa=require('papaparse');var Redis=require(_0x2dea('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x2dea('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2dea('0x13'));var logger=require(_0x2dea('0x14'))(_0x2dea('0x15'));var utils=require('../../config/utils');var config=require(_0x2dea('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x86a883,_0x35401c){_0x35401c=_0x35401c||0xcc;return function(_0x2918e3){if(_0x2918e3){return _0x86a883[_0x2dea('0x17')](_0x35401c);}return _0x86a883[_0x2dea('0x18')](_0x35401c)[_0x2dea('0x19')]();};}function respondWithResult(_0x4ad44f,_0x30e2d7){_0x30e2d7=_0x30e2d7||0xc8;return function(_0x2a0968){if(_0x2a0968){return _0x4ad44f[_0x2dea('0x18')](_0x30e2d7)['json'](_0x2a0968);}};}function respondWithFilteredResult(_0x4bc2b8,_0x3221f7){return function(_0x216c67){if(_0x216c67){var _0x5c15f0=typeof _0x3221f7['offset']===_0x2dea('0x1a')&&typeof _0x3221f7[_0x2dea('0x1b')]===_0x2dea('0x1a');var _0x2e068e=_0x216c67[_0x2dea('0x1c')];var _0x5b7ae8=_0x5c15f0?0x0:_0x3221f7['offset'];var _0x27cdaa=_0x5c15f0?_0x216c67[_0x2dea('0x1c')]:_0x3221f7[_0x2dea('0x1d')]+_0x3221f7[_0x2dea('0x1b')];var _0x56d034;if(_0x27cdaa>=_0x2e068e){_0x27cdaa=_0x2e068e;_0x56d034=0xc8;}else{_0x56d034=0xce;}_0x4bc2b8[_0x2dea('0x18')](_0x56d034);return _0x4bc2b8['set'](_0x2dea('0x1e'),_0x5b7ae8+'-'+_0x27cdaa+'/'+_0x2e068e)[_0x2dea('0x1f')](_0x216c67);}return null;};}function patchUpdates(_0x106c60){return function(_0x239499){try{jsonpatch[_0x2dea('0x20')](_0x239499,_0x106c60,!![]);}catch(_0x7c8190){return BPromise[_0x2dea('0x21')](_0x7c8190);}return _0x239499['save']();};}function saveUpdates(_0x2b08d0,_0x4a11a8){return function(_0x50495b){if(_0x50495b){return _0x50495b[_0x2dea('0x22')](_0x2b08d0)[_0x2dea('0x23')](function(_0x2774a3){return _0x2774a3;});}return null;};}function removeEntity(_0x579096,_0x7fcd59){return function(_0x385d3e){if(_0x385d3e){return _0x385d3e[_0x2dea('0x24')]()[_0x2dea('0x23')](function(){_0x579096['status'](0xcc)[_0x2dea('0x19')]();});}};}function handleEntityNotFound(_0x3a65ee,_0x66f609){return function(_0x385134){if(!_0x385134){_0x3a65ee[_0x2dea('0x17')](0x194);}return _0x385134;};}function handleError(_0x105917,_0x145246){_0x145246=_0x145246||0x1f4;return function(_0x1044a6){logger[_0x2dea('0x25')](_0x1044a6['stack']);if(_0x1044a6[_0x2dea('0x26')]){delete _0x1044a6[_0x2dea('0x26')];}_0x105917[_0x2dea('0x18')](_0x145246)[_0x2dea('0x27')](_0x1044a6);};}exports[_0x2dea('0x28')]=function(_0x1747d8,_0xe44d86){var _0x59a55a={},_0x3664d4={},_0xc85376={'count':0x0,'rows':[]};var _0x42a25a=_[_0x2dea('0x29')](db[_0x2dea('0x2a')][_0x2dea('0x2b')],function(_0x2a8b56){return{'name':_0x2a8b56[_0x2dea('0x2c')],'type':_0x2a8b56[_0x2dea('0x2d')][_0x2dea('0x2e')]};});_0x3664d4['model']=_[_0x2dea('0x29')](_0x42a25a,_0x2dea('0x26'));_0x3664d4[_0x2dea('0x2f')]=_[_0x2dea('0x30')](_0x1747d8[_0x2dea('0x2f')]);_0x3664d4[_0x2dea('0x31')]=_[_0x2dea('0x32')](_0x3664d4['model'],_0x3664d4[_0x2dea('0x2f')]);_0x59a55a[_0x2dea('0x33')]=_[_0x2dea('0x32')](_0x3664d4[_0x2dea('0x34')],qs['fields'](_0x1747d8[_0x2dea('0x2f')]['fields']));_0x59a55a['attributes']=_0x59a55a[_0x2dea('0x33')][_0x2dea('0x35')]?_0x59a55a['attributes']:_0x3664d4[_0x2dea('0x34')];if(!_0x1747d8['query']['hasOwnProperty'](_0x2dea('0x36'))){_0x59a55a[_0x2dea('0x1b')]=qs[_0x2dea('0x1b')](_0x1747d8[_0x2dea('0x2f')][_0x2dea('0x1b')]);_0x59a55a['offset']=qs[_0x2dea('0x1d')](_0x1747d8[_0x2dea('0x2f')]['offset']);}_0x59a55a[_0x2dea('0x37')]=qs[_0x2dea('0x38')](_0x1747d8[_0x2dea('0x2f')]['sort']);_0x59a55a[_0x2dea('0x39')]=qs[_0x2dea('0x31')](_[_0x2dea('0x3a')](_0x1747d8['query'],_0x3664d4[_0x2dea('0x31')]),_0x42a25a);if(_0x1747d8['query'][_0x2dea('0x3b')]){_0x59a55a[_0x2dea('0x39')]=_[_0x2dea('0x3c')](_0x59a55a['where'],{'$or':_[_0x2dea('0x29')](_0x42a25a,function(_0x551e0d){if(_0x551e0d['type']!==_0x2dea('0x3d')){var _0x4a4644={};_0x4a4644[_0x551e0d[_0x2dea('0x26')]]={'$like':'%'+_0x1747d8[_0x2dea('0x2f')][_0x2dea('0x3b')]+'%'};return _0x4a4644;}})});}_0x59a55a=_[_0x2dea('0x3c')]({},_0x59a55a,_0x1747d8[_0x2dea('0x3e')]);var _0xa459bf={'where':_0x59a55a[_0x2dea('0x39')]};return db[_0x2dea('0x2a')][_0x2dea('0x1c')](_0xa459bf)[_0x2dea('0x23')](function(_0x423a5e){_0xc85376[_0x2dea('0x1c')]=_0x423a5e;if(_0x1747d8[_0x2dea('0x2f')][_0x2dea('0x3f')]){_0x59a55a['include']=[{'all':!![]}];}return db[_0x2dea('0x2a')][_0x2dea('0x40')](_0x59a55a);})['then'](function(_0x33348e){_0xc85376[_0x2dea('0x41')]=_0x33348e;return _0xc85376;})[_0x2dea('0x23')](respondWithFilteredResult(_0xe44d86,_0x59a55a))[_0x2dea('0x42')](handleError(_0xe44d86,null));};exports[_0x2dea('0x43')]=function(_0x279b5f,_0x238302){var _0x200f61={'raw':!![],'where':{'id':_0x279b5f[_0x2dea('0x44')]['id']}},_0x2f7284={};_0x2f7284[_0x2dea('0x34')]=_['keys'](db[_0x2dea('0x2a')][_0x2dea('0x2b')]);_0x2f7284[_0x2dea('0x2f')]=_[_0x2dea('0x30')](_0x279b5f[_0x2dea('0x2f')]);_0x2f7284['filters']=_[_0x2dea('0x32')](_0x2f7284[_0x2dea('0x34')],_0x2f7284[_0x2dea('0x2f')]);_0x200f61[_0x2dea('0x33')]=_['intersection'](_0x2f7284[_0x2dea('0x34')],qs[_0x2dea('0x45')](_0x279b5f[_0x2dea('0x2f')]['fields']));_0x200f61[_0x2dea('0x33')]=_0x200f61['attributes']['length']?_0x200f61['attributes']:_0x2f7284[_0x2dea('0x34')];if(_0x279b5f['query'][_0x2dea('0x3f')]){_0x200f61[_0x2dea('0x46')]=[{'all':!![]}];}_0x200f61=_[_0x2dea('0x3c')]({},_0x200f61,_0x279b5f[_0x2dea('0x3e')]);return db['SquareReport']['find'](_0x200f61)['then'](handleEntityNotFound(_0x238302,null))[_0x2dea('0x23')](respondWithResult(_0x238302,null))[_0x2dea('0x42')](handleError(_0x238302,null));};exports[_0x2dea('0x47')]=function(_0x55c009,_0x18db15){return db['SquareReport'][_0x2dea('0x47')](_0x55c009[_0x2dea('0x48')],{})[_0x2dea('0x23')](respondWithResult(_0x18db15,0xc9))[_0x2dea('0x42')](handleError(_0x18db15,null));};exports['update']=function(_0x3465d0,_0x20696c){if(_0x3465d0[_0x2dea('0x48')]['id']){delete _0x3465d0['body']['id'];}return db['SquareReport']['find']({'where':{'id':_0x3465d0['params']['id']}})[_0x2dea('0x23')](handleEntityNotFound(_0x20696c,null))[_0x2dea('0x23')](saveUpdates(_0x3465d0[_0x2dea('0x48')],null))[_0x2dea('0x23')](respondWithResult(_0x20696c,null))['catch'](handleError(_0x20696c,null));};exports[_0x2dea('0x24')]=function(_0x4ccd80,_0xef6a99){return db[_0x2dea('0x2a')][_0x2dea('0x49')]({'where':{'id':_0x4ccd80[_0x2dea('0x44')]['id']}})['then'](handleEntityNotFound(_0xef6a99,null))[_0x2dea('0x23')](removeEntity(_0xef6a99,null))['catch'](handleError(_0xef6a99,null));};exports[_0x2dea('0x4a')]=function(_0x1226eb,_0x49a1dc){return db[_0x2dea('0x2a')][_0x2dea('0x4a')]()[_0x2dea('0x23')](respondWithResult(_0x49a1dc,null))[_0x2dea('0x42')](handleError(_0x49a1dc,null));};
\ No newline at end of file
+var _0xf69b=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SquareReport','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','describe','eml-format'];(function(_0x531cb8,_0x8ef36f){var _0x5cf297=function(_0x45acb4){while(--_0x45acb4){_0x531cb8['push'](_0x531cb8['shift']());}};_0x5cf297(++_0x8ef36f);}(_0xf69b,0x185));var _0xbf69=function(_0x3c9b67,_0x1b021e){_0x3c9b67=_0x3c9b67-0x0;var _0x565d95=_0xf69b[_0x3c9b67];return _0x565d95;};'use strict';var emlformat=require(_0xbf69('0x0'));var rimraf=require(_0xbf69('0x1'));var zipdir=require(_0xbf69('0x2'));var jsonpatch=require(_0xbf69('0x3'));var rp=require(_0xbf69('0x4'));var moment=require(_0xbf69('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbf69('0x6'));var util=require(_0xbf69('0x7'));var path=require('path');var sox=require(_0xbf69('0x8'));var csv=require(_0xbf69('0x9'));var ejs=require(_0xbf69('0xa'));var fs=require('fs');var fs_extra=require(_0xbf69('0xb'));var _=require(_0xbf69('0xc'));var squel=require(_0xbf69('0xd'));var crypto=require('crypto');var jsforce=require(_0xbf69('0xe'));var deskjs=require(_0xbf69('0xf'));var toCsv=require(_0xbf69('0x9'));var querystring=require('querystring');var Papa=require(_0xbf69('0x10'));var Redis=require('ioredis');var authService=require(_0xbf69('0x11'));var qs=require(_0xbf69('0x12'));var as=require(_0xbf69('0x13'));var hardwareService=require(_0xbf69('0x14'));var logger=require(_0xbf69('0x15'))(_0xbf69('0x16'));var utils=require(_0xbf69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xbf69('0x18'));var db=require(_0xbf69('0x19'))['db'];function respondWithStatusCode(_0x432155,_0x5eb286){_0x5eb286=_0x5eb286||0xcc;return function(_0xcd0bce){if(_0xcd0bce){return _0x432155[_0xbf69('0x1a')](_0x5eb286);}return _0x432155[_0xbf69('0x1b')](_0x5eb286)[_0xbf69('0x1c')]();};}function respondWithResult(_0x5bbbaa,_0x1a5591){_0x1a5591=_0x1a5591||0xc8;return function(_0x14c010){if(_0x14c010){return _0x5bbbaa['status'](_0x1a5591)[_0xbf69('0x1d')](_0x14c010);}};}function respondWithFilteredResult(_0x1a9406,_0xff741d){return function(_0x39f66e){if(_0x39f66e){var _0x3aa749=typeof _0xff741d[_0xbf69('0x1e')]===_0xbf69('0x1f')&&typeof _0xff741d[_0xbf69('0x20')]==='undefined';var _0x3fafbb=_0x39f66e[_0xbf69('0x21')];var _0x5e7a3c=_0x3aa749?0x0:_0xff741d[_0xbf69('0x1e')];var _0x5dfa38=_0x3aa749?_0x39f66e[_0xbf69('0x21')]:_0xff741d['offset']+_0xff741d[_0xbf69('0x20')];var _0x57c6b4;if(_0x5dfa38>=_0x3fafbb){_0x5dfa38=_0x3fafbb;_0x57c6b4=0xc8;}else{_0x57c6b4=0xce;}_0x1a9406[_0xbf69('0x1b')](_0x57c6b4);return _0x1a9406['set'](_0xbf69('0x22'),_0x5e7a3c+'-'+_0x5dfa38+'/'+_0x3fafbb)[_0xbf69('0x1d')](_0x39f66e);}return null;};}function patchUpdates(_0x13d83b){return function(_0x1ab71b){try{jsonpatch[_0xbf69('0x23')](_0x1ab71b,_0x13d83b,!![]);}catch(_0xf860d7){return BPromise[_0xbf69('0x24')](_0xf860d7);}return _0x1ab71b['save']();};}function saveUpdates(_0x5b6109,_0x50325a){return function(_0x41ea0b){if(_0x41ea0b){return _0x41ea0b[_0xbf69('0x25')](_0x5b6109)[_0xbf69('0x26')](function(_0x192ff2){return _0x192ff2;});}return null;};}function removeEntity(_0x3cdf41,_0x29e1a7){return function(_0x22548b){if(_0x22548b){return _0x22548b[_0xbf69('0x27')]()['then'](function(){_0x3cdf41[_0xbf69('0x1b')](0xcc)[_0xbf69('0x1c')]();});}};}function handleEntityNotFound(_0x4bab3d,_0x2f97ef){return function(_0x44806e){if(!_0x44806e){_0x4bab3d[_0xbf69('0x1a')](0x194);}return _0x44806e;};}function handleError(_0x124cda,_0x29784b){_0x29784b=_0x29784b||0x1f4;return function(_0x818c2c){logger[_0xbf69('0x28')](_0x818c2c[_0xbf69('0x29')]);if(_0x818c2c[_0xbf69('0x2a')]){delete _0x818c2c[_0xbf69('0x2a')];}_0x124cda[_0xbf69('0x1b')](_0x29784b)['send'](_0x818c2c);};}exports[_0xbf69('0x2b')]=function(_0x516057,_0x1d8377){var _0x1f7fe2={},_0x19e9c8={},_0x4a913a={'count':0x0,'rows':[]};var _0x316f9d=_['map'](db['SquareReport']['rawAttributes'],function(_0x22cd6f){return{'name':_0x22cd6f[_0xbf69('0x2c')],'type':_0x22cd6f[_0xbf69('0x2d')][_0xbf69('0x2e')]};});_0x19e9c8['model']=_[_0xbf69('0x2f')](_0x316f9d,'name');_0x19e9c8[_0xbf69('0x30')]=_[_0xbf69('0x31')](_0x516057['query']);_0x19e9c8[_0xbf69('0x32')]=_[_0xbf69('0x33')](_0x19e9c8['model'],_0x19e9c8['query']);_0x1f7fe2[_0xbf69('0x34')]=_[_0xbf69('0x33')](_0x19e9c8[_0xbf69('0x35')],qs[_0xbf69('0x36')](_0x516057['query'][_0xbf69('0x36')]));_0x1f7fe2[_0xbf69('0x34')]=_0x1f7fe2[_0xbf69('0x34')][_0xbf69('0x37')]?_0x1f7fe2[_0xbf69('0x34')]:_0x19e9c8[_0xbf69('0x35')];if(!_0x516057[_0xbf69('0x30')][_0xbf69('0x38')](_0xbf69('0x39'))){_0x1f7fe2[_0xbf69('0x20')]=qs['limit'](_0x516057[_0xbf69('0x30')]['limit']);_0x1f7fe2[_0xbf69('0x1e')]=qs[_0xbf69('0x1e')](_0x516057[_0xbf69('0x30')][_0xbf69('0x1e')]);}_0x1f7fe2[_0xbf69('0x3a')]=qs['sort'](_0x516057['query'][_0xbf69('0x3b')]);_0x1f7fe2['where']=qs[_0xbf69('0x32')](_[_0xbf69('0x3c')](_0x516057[_0xbf69('0x30')],_0x19e9c8[_0xbf69('0x32')]),_0x316f9d);if(_0x516057[_0xbf69('0x30')][_0xbf69('0x3d')]){_0x1f7fe2[_0xbf69('0x3e')]=_[_0xbf69('0x3f')](_0x1f7fe2[_0xbf69('0x3e')],{'$or':_[_0xbf69('0x2f')](_0x316f9d,function(_0x25f098){if(_0x25f098[_0xbf69('0x2d')]!==_0xbf69('0x40')){var _0x3aa48d={};_0x3aa48d[_0x25f098[_0xbf69('0x2a')]]={'$like':'%'+_0x516057[_0xbf69('0x30')][_0xbf69('0x3d')]+'%'};return _0x3aa48d;}})});}_0x1f7fe2=_[_0xbf69('0x3f')]({},_0x1f7fe2,_0x516057['options']);var _0x1de75a={'where':_0x1f7fe2[_0xbf69('0x3e')]};return db[_0xbf69('0x41')][_0xbf69('0x21')](_0x1de75a)[_0xbf69('0x26')](function(_0x28f2f8){_0x4a913a[_0xbf69('0x21')]=_0x28f2f8;if(_0x516057[_0xbf69('0x30')][_0xbf69('0x42')]){_0x1f7fe2['include']=[{'all':!![]}];}return db[_0xbf69('0x41')][_0xbf69('0x43')](_0x1f7fe2);})[_0xbf69('0x26')](function(_0x1a64c7){_0x4a913a[_0xbf69('0x44')]=_0x1a64c7;return _0x4a913a;})[_0xbf69('0x26')](respondWithFilteredResult(_0x1d8377,_0x1f7fe2))[_0xbf69('0x45')](handleError(_0x1d8377,null));};exports[_0xbf69('0x46')]=function(_0xa2841c,_0x1a359c){var _0x3365ca={'raw':!![],'where':{'id':_0xa2841c[_0xbf69('0x47')]['id']}},_0x4c7735={};_0x4c7735[_0xbf69('0x35')]=_['keys'](db[_0xbf69('0x41')][_0xbf69('0x48')]);_0x4c7735[_0xbf69('0x30')]=_[_0xbf69('0x31')](_0xa2841c[_0xbf69('0x30')]);_0x4c7735[_0xbf69('0x32')]=_[_0xbf69('0x33')](_0x4c7735[_0xbf69('0x35')],_0x4c7735[_0xbf69('0x30')]);_0x3365ca['attributes']=_[_0xbf69('0x33')](_0x4c7735['model'],qs['fields'](_0xa2841c[_0xbf69('0x30')]['fields']));_0x3365ca[_0xbf69('0x34')]=_0x3365ca[_0xbf69('0x34')][_0xbf69('0x37')]?_0x3365ca[_0xbf69('0x34')]:_0x4c7735[_0xbf69('0x35')];if(_0xa2841c[_0xbf69('0x30')][_0xbf69('0x42')]){_0x3365ca[_0xbf69('0x49')]=[{'all':!![]}];}_0x3365ca=_[_0xbf69('0x3f')]({},_0x3365ca,_0xa2841c['options']);return db[_0xbf69('0x41')][_0xbf69('0x4a')](_0x3365ca)[_0xbf69('0x26')](handleEntityNotFound(_0x1a359c,null))[_0xbf69('0x26')](respondWithResult(_0x1a359c,null))[_0xbf69('0x45')](handleError(_0x1a359c,null));};exports[_0xbf69('0x4b')]=function(_0x63101e,_0x260acc){return db[_0xbf69('0x41')]['create'](_0x63101e[_0xbf69('0x4c')],{})[_0xbf69('0x26')](respondWithResult(_0x260acc,0xc9))[_0xbf69('0x45')](handleError(_0x260acc,null));};exports['update']=function(_0x1ed189,_0x13652a){if(_0x1ed189[_0xbf69('0x4c')]['id']){delete _0x1ed189[_0xbf69('0x4c')]['id'];}return db[_0xbf69('0x41')]['find']({'where':{'id':_0x1ed189['params']['id']}})[_0xbf69('0x26')](handleEntityNotFound(_0x13652a,null))[_0xbf69('0x26')](saveUpdates(_0x1ed189[_0xbf69('0x4c')],null))['then'](respondWithResult(_0x13652a,null))[_0xbf69('0x45')](handleError(_0x13652a,null));};exports[_0xbf69('0x27')]=function(_0x22a29c,_0x5030ef){return db[_0xbf69('0x41')]['find']({'where':{'id':_0x22a29c[_0xbf69('0x47')]['id']}})['then'](handleEntityNotFound(_0x5030ef,null))[_0xbf69('0x26')](removeEntity(_0x5030ef,null))['catch'](handleError(_0x5030ef,null));};exports['describe']=function(_0x542fcc,_0x42f34c){return db[_0xbf69('0x41')][_0xbf69('0x4d')]()[_0xbf69('0x26')](respondWithResult(_0x42f34c,null))[_0xbf69('0x45')](handleError(_0x42f34c,null));};
\ No newline at end of file
index 0c95822..4422e8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x72be=['api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','uid_pname','project_name','leaveAt','lodash','util','../../config/logger'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x72be,0x169));var _0xe72b=function(_0x62f454,_0x50218f){_0x62f454=_0x62f454-0x0;var _0x1fb34a=_0x72be[_0x62f454];return _0x1fb34a;};'use strict';var _=require(_0xe72b('0x0'));var util=require(_0xe72b('0x1'));var logger=require(_0xe72b('0x2'))(_0xe72b('0x3'));var moment=require('moment');var BPromise=require(_0xe72b('0x4'));var rp=require(_0xe72b('0x5'));var fs=require('fs');var path=require(_0xe72b('0x6'));var rimraf=require(_0xe72b('0x7'));var config=require(_0xe72b('0x8'));var attributes=require(_0xe72b('0x9'));module[_0xe72b('0xa')]=function(_0x3ff571,_0xb646a5){return _0x3ff571['define']('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0xe72b('0xb'),'fields':['uniqueid',_0xe72b('0xc')]},{'name':_0xe72b('0xd'),'fields':[_0xe72b('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xf293=['request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird'];(function(_0x4c06a6,_0x249410){var _0x5917f3=function(_0x3f1e69){while(--_0x3f1e69){_0x4c06a6['push'](_0x4c06a6['shift']());}};_0x5917f3(++_0x249410);}(_0xf293,0x11c));var _0x3f29=function(_0x215010,_0x294f69){_0x215010=_0x215010-0x0;var _0x26869a=_0xf293[_0x215010];return _0x26869a;};'use strict';var _=require(_0x3f29('0x0'));var util=require(_0x3f29('0x1'));var logger=require(_0x3f29('0x2'))(_0x3f29('0x3'));var moment=require('moment');var BPromise=require(_0x3f29('0x4'));var rp=require(_0x3f29('0x5'));var fs=require('fs');var path=require(_0x3f29('0x6'));var rimraf=require(_0x3f29('0x7'));var config=require('../../config/environment');var attributes=require(_0x3f29('0x8'));module[_0x3f29('0x9')]=function(_0xaab013,_0x59f821){return _0xaab013[_0x3f29('0xa')](_0x3f29('0xb'),attributes,{'tableName':_0x3f29('0xc'),'paranoid':![],'indexes':[{'name':_0x3f29('0xd'),'fields':[_0x3f29('0xe'),_0x3f29('0xf')]},{'name':_0x3f29('0x10'),'fields':[_0x3f29('0x10')]}],'timestamps':!![]});};
\ No newline at end of file
index 412c94e..9c90c6e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ad8=['result','CreateSquareReport','SquareReport','create','body','options','raw','debug','UpdateSquareReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x763293,_0x2b92f0){var _0x29af7c=function(_0x5976cd){while(--_0x5976cd){_0x763293['push'](_0x763293['shift']());}};_0x29af7c(++_0x2b92f0);}(_0x8ad8,0x1c5));var _0x88ad=function(_0xdfd050,_0x246010){_0xdfd050=_0xdfd050-0x0;var _0x315a6b=_0x8ad8[_0xdfd050];return _0x315a6b;};'use strict';var _=require(_0x88ad('0x0'));var util=require(_0x88ad('0x1'));var moment=require(_0x88ad('0x2'));var BPromise=require(_0x88ad('0x3'));var rs=require(_0x88ad('0x4'));var fs=require('fs');var Redis=require(_0x88ad('0x5'));var db=require(_0x88ad('0x6'))['db'];var utils=require(_0x88ad('0x7'));var logger=require(_0x88ad('0x8'))(_0x88ad('0x9'));var config=require('../../config/environment');var jayson=require(_0x88ad('0xa'));var client=jayson[_0x88ad('0xb')][_0x88ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2ddf4f,_0x17e2d0,_0x59c7d5){return new BPromise(function(_0x10f1bd,_0x34ef33){return client[_0x88ad('0xd')](_0x2ddf4f,_0x59c7d5)[_0x88ad('0xe')](function(_0x10eb9d){logger[_0x88ad('0xf')](_0x88ad('0x10'),_0x17e2d0,_0x88ad('0x11'));logger['debug'](_0x88ad('0x12'),_0x17e2d0,'request\x20sent',JSON[_0x88ad('0x13')](_0x10eb9d));if(_0x10eb9d[_0x88ad('0x14')]){if(_0x10eb9d[_0x88ad('0x14')][_0x88ad('0x15')]===0x1f4){logger[_0x88ad('0x14')](_0x88ad('0x10'),_0x17e2d0,_0x10eb9d[_0x88ad('0x14')][_0x88ad('0x16')]);return _0x34ef33(_0x10eb9d[_0x88ad('0x14')][_0x88ad('0x16')]);}logger['error']('SquareReport,\x20%s,\x20%s',_0x17e2d0,_0x10eb9d[_0x88ad('0x14')][_0x88ad('0x16')]);return _0x10f1bd(_0x10eb9d[_0x88ad('0x14')][_0x88ad('0x16')]);}else{logger[_0x88ad('0xf')](_0x88ad('0x10'),_0x17e2d0,'request\x20sent');_0x10f1bd(_0x10eb9d[_0x88ad('0x17')][_0x88ad('0x16')]);}})['catch'](function(_0x4d8c95){logger[_0x88ad('0x14')](_0x88ad('0x10'),_0x17e2d0,_0x4d8c95);_0x34ef33(_0x4d8c95);});});}exports[_0x88ad('0x18')]=function(_0x32599c){var _0x37e573=this;return new Promise(function(_0x2c2da0,_0x5ca2bb){return db[_0x88ad('0x19')][_0x88ad('0x1a')](_0x32599c[_0x88ad('0x1b')],{'raw':_0x32599c[_0x88ad('0x1c')]?_0x32599c[_0x88ad('0x1c')][_0x88ad('0x1d')]===undefined?!![]:![]:!![]})[_0x88ad('0xe')](function(_0x17979c){logger[_0x88ad('0xf')](_0x88ad('0x18'),_0x32599c);logger[_0x88ad('0x1e')](_0x88ad('0x18'),_0x32599c,JSON[_0x88ad('0x13')](_0x17979c));_0x2c2da0(_0x17979c);})['catch'](function(_0x512246){logger[_0x88ad('0x14')](_0x88ad('0x18'),_0x512246[_0x88ad('0x16')],_0x32599c);_0x5ca2bb(_0x37e573[_0x88ad('0x14')](0x1f4,_0x512246['message']));});});};exports[_0x88ad('0x1f')]=function(_0x519c6f){var _0x30d07d=this;return new Promise(function(_0x25d3f2,_0x5b5408){return db[_0x88ad('0x19')]['update'](_0x519c6f['body'],{'raw':_0x519c6f[_0x88ad('0x1c')]?_0x519c6f[_0x88ad('0x1c')][_0x88ad('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x519c6f[_0x88ad('0x1c')]?_0x519c6f[_0x88ad('0x1c')]['where']||null:null,'attributes':_0x519c6f[_0x88ad('0x1c')]?_0x519c6f[_0x88ad('0x1c')][_0x88ad('0x20')]||null:null,'limit':_0x519c6f['options']?_0x519c6f['options'][_0x88ad('0x21')]||null:null})[_0x88ad('0xe')](function(_0x4b44cc){logger['info']('UpdateSquareReport',_0x519c6f);logger[_0x88ad('0x1e')](_0x88ad('0x1f'),_0x519c6f,JSON[_0x88ad('0x13')](_0x4b44cc));_0x25d3f2(_0x4b44cc);})['catch'](function(_0x4e43b0){logger['error'](_0x88ad('0x1f'),_0x4e43b0[_0x88ad('0x16')],_0x519c6f);_0x5b5408(_0x30d07d['error'](0x1f4,_0x4e43b0['message']));});});};
\ No newline at end of file
+var _0x0b67=['raw','limit','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','CreateSquareReport','create','body','options','debug','UpdateSquareReport','SquareReport','update'];(function(_0x5ad084,_0xce6302){var _0x117fa7=function(_0x4ad169){while(--_0x4ad169){_0x5ad084['push'](_0x5ad084['shift']());}};_0x117fa7(++_0xce6302);}(_0x0b67,0xdb));var _0x70b6=function(_0x2285a1,_0x52076c){_0x2285a1=_0x2285a1-0x0;var _0x180da2=_0x0b67[_0x2285a1];return _0x180da2;};'use strict';var _=require(_0x70b6('0x0'));var util=require(_0x70b6('0x1'));var moment=require(_0x70b6('0x2'));var BPromise=require(_0x70b6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x70b6('0x4'))['db'];var utils=require(_0x70b6('0x5'));var logger=require(_0x70b6('0x6'))(_0x70b6('0x7'));var config=require(_0x70b6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x70b6('0x9')][_0x70b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c6f62,_0x54aa71,_0x5eaae1){return new BPromise(function(_0xb4d20c,_0xe4bf6f){return client[_0x70b6('0xb')](_0x2c6f62,_0x5eaae1)[_0x70b6('0xc')](function(_0x2f606c){logger['info'](_0x70b6('0xd'),_0x54aa71,_0x70b6('0xe'));logger['debug']('SquareReport,\x20%s,\x20%s,\x20%s',_0x54aa71,'request\x20sent',JSON[_0x70b6('0xf')](_0x2f606c));if(_0x2f606c[_0x70b6('0x10')]){if(_0x2f606c[_0x70b6('0x10')][_0x70b6('0x11')]===0x1f4){logger[_0x70b6('0x10')](_0x70b6('0xd'),_0x54aa71,_0x2f606c[_0x70b6('0x10')][_0x70b6('0x12')]);return _0xe4bf6f(_0x2f606c['error'][_0x70b6('0x12')]);}logger[_0x70b6('0x10')](_0x70b6('0xd'),_0x54aa71,_0x2f606c['error'][_0x70b6('0x12')]);return _0xb4d20c(_0x2f606c[_0x70b6('0x10')]['message']);}else{logger[_0x70b6('0x13')]('SquareReport,\x20%s,\x20%s',_0x54aa71,_0x70b6('0xe'));_0xb4d20c(_0x2f606c['result'][_0x70b6('0x12')]);}})[_0x70b6('0x14')](function(_0x13e89a){logger[_0x70b6('0x10')](_0x70b6('0xd'),_0x54aa71,_0x13e89a);_0xe4bf6f(_0x13e89a);});});}exports[_0x70b6('0x15')]=function(_0x3e00c2){var _0x828c16=this;return new Promise(function(_0x442163,_0x250d5b){return db['SquareReport'][_0x70b6('0x16')](_0x3e00c2[_0x70b6('0x17')],{'raw':_0x3e00c2[_0x70b6('0x18')]?_0x3e00c2['options']['raw']===undefined?!![]:![]:!![]})[_0x70b6('0xc')](function(_0x48195f){logger[_0x70b6('0x13')](_0x70b6('0x15'),_0x3e00c2);logger[_0x70b6('0x19')](_0x70b6('0x15'),_0x3e00c2,JSON[_0x70b6('0xf')](_0x48195f));_0x442163(_0x48195f);})[_0x70b6('0x14')](function(_0x43a122){logger[_0x70b6('0x10')](_0x70b6('0x15'),_0x43a122['message'],_0x3e00c2);_0x250d5b(_0x828c16['error'](0x1f4,_0x43a122[_0x70b6('0x12')]));});});};exports[_0x70b6('0x1a')]=function(_0x379ff0){var _0x5d43fd=this;return new Promise(function(_0x49e4f4,_0x4a6295){return db[_0x70b6('0x1b')][_0x70b6('0x1c')](_0x379ff0[_0x70b6('0x17')],{'raw':_0x379ff0[_0x70b6('0x18')]?_0x379ff0[_0x70b6('0x18')][_0x70b6('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x379ff0[_0x70b6('0x18')]?_0x379ff0[_0x70b6('0x18')]['where']||null:null,'attributes':_0x379ff0[_0x70b6('0x18')]?_0x379ff0[_0x70b6('0x18')]['attributes']||null:null,'limit':_0x379ff0[_0x70b6('0x18')]?_0x379ff0[_0x70b6('0x18')][_0x70b6('0x1e')]||null:null})[_0x70b6('0xc')](function(_0x58cc13){logger[_0x70b6('0x13')](_0x70b6('0x1a'),_0x379ff0);logger['debug'](_0x70b6('0x1a'),_0x379ff0,JSON[_0x70b6('0xf')](_0x58cc13));_0x49e4f4(_0x58cc13);})[_0x70b6('0x14')](function(_0x18f577){logger['error'](_0x70b6('0x1a'),_0x18f577[_0x70b6('0x12')],_0x379ff0);_0x4a6295(_0x5d43fd[_0x70b6('0x10')](0x1f4,_0x18f577[_0x70b6('0x12')]));});});};
\ No newline at end of file
index b7c7f89..1ee7d85 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb837=['put','/:id','update','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create'];(function(_0x7c1c32,_0x51a3c9){var _0x1815de=function(_0x4bc386){while(--_0x4bc386){_0x7c1c32['push'](_0x7c1c32['shift']());}};_0x1815de(++_0x51a3c9);}(_0xb837,0xbf));var _0x7b83=function(_0x1c86a5,_0x1594ca){_0x1c86a5=_0x1c86a5-0x0;var _0x4bfe61=_0xb837[_0x1c86a5];return _0x4bfe61;};'use strict';var multer=require(_0x7b83('0x0'));var util=require(_0x7b83('0x1'));var path=require(_0x7b83('0x2'));var timeout=require(_0x7b83('0x3'));var express=require('express');var router=express[_0x7b83('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7b83('0x5'));var interaction=require(_0x7b83('0x6'));var config=require(_0x7b83('0x7'));var controller=require('./squareReportDetail.controller');router[_0x7b83('0x8')]('/',auth[_0x7b83('0x9')](),controller[_0x7b83('0xa')]);router[_0x7b83('0x8')]('/describe',auth[_0x7b83('0x9')](),controller['describe']);router['get']('/:id',auth[_0x7b83('0x9')](),controller[_0x7b83('0xb')]);router['post']('/',auth[_0x7b83('0x9')](),controller[_0x7b83('0xc')]);router[_0x7b83('0xd')](_0x7b83('0xe'),auth[_0x7b83('0x9')](),controller[_0x7b83('0xf')]);router['delete'](_0x7b83('0xe'),auth[_0x7b83('0x9')](),controller[_0x7b83('0x10')]);module['exports']=router;
\ No newline at end of file
+var _0xa727=['update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index','/describe','get','/:id','post','create','put'];(function(_0x3ba924,_0x3b99f0){var _0x4cc1df=function(_0x15bf28){while(--_0x15bf28){_0x3ba924['push'](_0x3ba924['shift']());}};_0x4cc1df(++_0x3b99f0);}(_0xa727,0x17d));var _0x7a72=function(_0x23c00c,_0x5f496b){_0x23c00c=_0x23c00c-0x0;var _0xcd2f14=_0xa727[_0x23c00c];return _0xcd2f14;};'use strict';var multer=require(_0x7a72('0x0'));var util=require(_0x7a72('0x1'));var path=require(_0x7a72('0x2'));var timeout=require(_0x7a72('0x3'));var express=require(_0x7a72('0x4'));var router=express[_0x7a72('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x7a72('0x6'));var interaction=require(_0x7a72('0x7'));var config=require(_0x7a72('0x8'));var controller=require(_0x7a72('0x9'));router['get']('/',auth[_0x7a72('0xa')](),controller[_0x7a72('0xb')]);router['get'](_0x7a72('0xc'),auth[_0x7a72('0xa')](),controller['describe']);router[_0x7a72('0xd')](_0x7a72('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x7a72('0xf')]('/',auth[_0x7a72('0xa')](),controller[_0x7a72('0x10')]);router[_0x7a72('0x11')](_0x7a72('0xe'),auth[_0x7a72('0xa')](),controller[_0x7a72('0x12')]);router['delete'](_0x7a72('0xe'),auth[_0x7a72('0xa')](),controller[_0x7a72('0x13')]);module[_0x7a72('0x14')]=router;
\ No newline at end of file
index 8e38579..b8981da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea02=['TEXT','sequelize','exports','STRING'];(function(_0x211f4e,_0x41fa9c){var _0x2cda9c=function(_0x2543ca){while(--_0x2543ca){_0x211f4e['push'](_0x211f4e['shift']());}};_0x2cda9c(++_0x41fa9c);}(_0xea02,0x12d));var _0x2ea0=function(_0xc05bd3,_0x193c13){_0xc05bd3=_0xc05bd3-0x0;var _0x1afc55=_0xea02[_0xc05bd3];return _0x1afc55;};'use strict';var Sequelize=require(_0x2ea0('0x0'));module[_0x2ea0('0x1')]={'uniqueid':{'type':Sequelize[_0x2ea0('0x2')]},'node':{'type':Sequelize[_0x2ea0('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x2ea0('0x3')]},'project_name':{'type':Sequelize[_0x2ea0('0x2')]},'callerid':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x4c99=['TEXT','sequelize','exports','STRING'];(function(_0x4671df,_0x515197){var _0xc77c8c=function(_0x12c0ff){while(--_0x12c0ff){_0x4671df['push'](_0x4671df['shift']());}};_0xc77c8c(++_0x515197);}(_0x4c99,0xfd));var _0x94c9=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x4c99[_0x346737];return _0x1ade2e;};'use strict';var Sequelize=require(_0x94c9('0x0'));module[_0x94c9('0x1')]={'uniqueid':{'type':Sequelize[_0x94c9('0x2')]},'node':{'type':Sequelize[_0x94c9('0x2')]},'application':{'type':Sequelize[_0x94c9('0x2')]},'data':{'type':Sequelize[_0x94c9('0x3')]},'project_name':{'type':Sequelize[_0x94c9('0x2')]},'callerid':{'type':Sequelize[_0x94c9('0x2')]}};
\ No newline at end of file
index 1caa31d..c75d65d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb1f6=['show','params','create','body','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','stack','name','send','map','SquareDetailsReport','rawAttributes','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch'];(function(_0x4c7b20,_0x361515){var _0x4872bd=function(_0x358e19){while(--_0x358e19){_0x4c7b20['push'](_0x4c7b20['shift']());}};_0x4872bd(++_0x361515);}(_0xb1f6,0x12e));var _0x6b1f=function(_0x4c3ed3,_0x40c7dd){_0x4c3ed3=_0x4c3ed3-0x0;var _0x4317f2=_0xb1f6[_0x4c3ed3];return _0x4317f2;};'use strict';var emlformat=require(_0x6b1f('0x0'));var rimraf=require(_0x6b1f('0x1'));var zipdir=require(_0x6b1f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6b1f('0x3'));var moment=require('moment');var BPromise=require(_0x6b1f('0x4'));var Mustache=require(_0x6b1f('0x5'));var util=require(_0x6b1f('0x6'));var path=require(_0x6b1f('0x7'));var sox=require(_0x6b1f('0x8'));var csv=require(_0x6b1f('0x9'));var ejs=require(_0x6b1f('0xa'));var fs=require('fs');var fs_extra=require(_0x6b1f('0xb'));var _=require(_0x6b1f('0xc'));var squel=require(_0x6b1f('0xd'));var crypto=require(_0x6b1f('0xe'));var jsforce=require(_0x6b1f('0xf'));var deskjs=require(_0x6b1f('0x10'));var toCsv=require(_0x6b1f('0x9'));var querystring=require(_0x6b1f('0x11'));var Papa=require(_0x6b1f('0x12'));var Redis=require(_0x6b1f('0x13'));var authService=require(_0x6b1f('0x14'));var qs=require(_0x6b1f('0x15'));var as=require(_0x6b1f('0x16'));var hardwareService=require(_0x6b1f('0x17'));var logger=require(_0x6b1f('0x18'))(_0x6b1f('0x19'));var utils=require(_0x6b1f('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x6b1f('0x1b'));var db=require(_0x6b1f('0x1c'))['db'];function respondWithStatusCode(_0x5d38d8,_0x149338){_0x149338=_0x149338||0xcc;return function(_0xcc849){if(_0xcc849){return _0x5d38d8['sendStatus'](_0x149338);}return _0x5d38d8['status'](_0x149338)[_0x6b1f('0x1d')]();};}function respondWithResult(_0x5313d0,_0x27af1a){_0x27af1a=_0x27af1a||0xc8;return function(_0x493382){if(_0x493382){return _0x5313d0[_0x6b1f('0x1e')](_0x27af1a)[_0x6b1f('0x1f')](_0x493382);}};}function respondWithFilteredResult(_0x23fe59,_0x3618e8){return function(_0xc179c3){if(_0xc179c3){var _0x46a50b=typeof _0x3618e8[_0x6b1f('0x20')]===_0x6b1f('0x21')&&typeof _0x3618e8['limit']===_0x6b1f('0x21');var _0x446941=_0xc179c3[_0x6b1f('0x22')];var _0x5561dc=_0x46a50b?0x0:_0x3618e8['offset'];var _0x264d36=_0x46a50b?_0xc179c3[_0x6b1f('0x22')]:_0x3618e8[_0x6b1f('0x20')]+_0x3618e8[_0x6b1f('0x23')];var _0x16fafb;if(_0x264d36>=_0x446941){_0x264d36=_0x446941;_0x16fafb=0xc8;}else{_0x16fafb=0xce;}_0x23fe59[_0x6b1f('0x1e')](_0x16fafb);return _0x23fe59[_0x6b1f('0x24')]('Content-Range',_0x5561dc+'-'+_0x264d36+'/'+_0x446941)['json'](_0xc179c3);}return null;};}function patchUpdates(_0x53847e){return function(_0x42e142){try{jsonpatch[_0x6b1f('0x25')](_0x42e142,_0x53847e,!![]);}catch(_0x18cf7c){return BPromise['reject'](_0x18cf7c);}return _0x42e142[_0x6b1f('0x26')]();};}function saveUpdates(_0x4823e4,_0x13b612){return function(_0x23c785){if(_0x23c785){return _0x23c785[_0x6b1f('0x27')](_0x4823e4)[_0x6b1f('0x28')](function(_0x37942b){return _0x37942b;});}return null;};}function removeEntity(_0x5eaaec,_0x230ee4){return function(_0x5d87b7){if(_0x5d87b7){return _0x5d87b7['destroy']()[_0x6b1f('0x28')](function(){_0x5eaaec[_0x6b1f('0x1e')](0xcc)[_0x6b1f('0x1d')]();});}};}function handleEntityNotFound(_0xe08ae,_0x288871){return function(_0x341f20){if(!_0x341f20){_0xe08ae['sendStatus'](0x194);}return _0x341f20;};}function handleError(_0x33bb29,_0x49b04){_0x49b04=_0x49b04||0x1f4;return function(_0x440aef){logger['error'](_0x440aef[_0x6b1f('0x29')]);if(_0x440aef['name']){delete _0x440aef[_0x6b1f('0x2a')];}_0x33bb29[_0x6b1f('0x1e')](_0x49b04)[_0x6b1f('0x2b')](_0x440aef);};}exports['index']=function(_0x38c851,_0x32a29c){var _0x57d6ea={},_0x1be7ac={},_0x1511f5={'count':0x0,'rows':[]};var _0x340a13=_[_0x6b1f('0x2c')](db[_0x6b1f('0x2d')][_0x6b1f('0x2e')],function(_0x4b7023){return{'name':_0x4b7023['fieldName'],'type':_0x4b7023['type']['key']};});_0x1be7ac[_0x6b1f('0x2f')]=_[_0x6b1f('0x2c')](_0x340a13,_0x6b1f('0x2a'));_0x1be7ac[_0x6b1f('0x30')]=_[_0x6b1f('0x31')](_0x38c851['query']);_0x1be7ac[_0x6b1f('0x32')]=_[_0x6b1f('0x33')](_0x1be7ac[_0x6b1f('0x2f')],_0x1be7ac[_0x6b1f('0x30')]);_0x57d6ea['attributes']=_['intersection'](_0x1be7ac['model'],qs[_0x6b1f('0x34')](_0x38c851[_0x6b1f('0x30')][_0x6b1f('0x34')]));_0x57d6ea[_0x6b1f('0x35')]=_0x57d6ea[_0x6b1f('0x35')]['length']?_0x57d6ea[_0x6b1f('0x35')]:_0x1be7ac[_0x6b1f('0x2f')];if(!_0x38c851[_0x6b1f('0x30')][_0x6b1f('0x36')](_0x6b1f('0x37'))){_0x57d6ea['limit']=qs['limit'](_0x38c851[_0x6b1f('0x30')]['limit']);_0x57d6ea[_0x6b1f('0x20')]=qs[_0x6b1f('0x20')](_0x38c851[_0x6b1f('0x30')]['offset']);}_0x57d6ea[_0x6b1f('0x38')]=qs[_0x6b1f('0x39')](_0x38c851['query'][_0x6b1f('0x39')]);_0x57d6ea[_0x6b1f('0x3a')]=qs[_0x6b1f('0x32')](_[_0x6b1f('0x3b')](_0x38c851[_0x6b1f('0x30')],_0x1be7ac[_0x6b1f('0x32')]),_0x340a13);if(_0x38c851[_0x6b1f('0x30')][_0x6b1f('0x3c')]){_0x57d6ea[_0x6b1f('0x3a')]=_[_0x6b1f('0x3d')](_0x57d6ea[_0x6b1f('0x3a')],{'$or':_[_0x6b1f('0x2c')](_0x340a13,function(_0x508e20){if(_0x508e20['type']!==_0x6b1f('0x3e')){var _0x202aa8={};_0x202aa8[_0x508e20[_0x6b1f('0x2a')]]={'$like':'%'+_0x38c851[_0x6b1f('0x30')][_0x6b1f('0x3c')]+'%'};return _0x202aa8;}})});}_0x57d6ea=_['merge']({},_0x57d6ea,_0x38c851[_0x6b1f('0x3f')]);var _0x1f4fe9={'where':_0x57d6ea[_0x6b1f('0x3a')]};return db[_0x6b1f('0x2d')][_0x6b1f('0x22')](_0x1f4fe9)[_0x6b1f('0x28')](function(_0x456906){_0x1511f5[_0x6b1f('0x22')]=_0x456906;if(_0x38c851[_0x6b1f('0x30')][_0x6b1f('0x40')]){_0x57d6ea[_0x6b1f('0x41')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x6b1f('0x42')](_0x57d6ea);})[_0x6b1f('0x28')](function(_0x512451){_0x1511f5['rows']=_0x512451;return _0x1511f5;})[_0x6b1f('0x28')](respondWithFilteredResult(_0x32a29c,_0x57d6ea))[_0x6b1f('0x43')](handleError(_0x32a29c,null));};exports[_0x6b1f('0x44')]=function(_0x2c4d08,_0xdf3a4e){var _0x491f6b={'raw':!![],'where':{'id':_0x2c4d08[_0x6b1f('0x45')]['id']}},_0x480029={};_0x480029['model']=_[_0x6b1f('0x31')](db[_0x6b1f('0x2d')][_0x6b1f('0x2e')]);_0x480029[_0x6b1f('0x30')]=_[_0x6b1f('0x31')](_0x2c4d08[_0x6b1f('0x30')]);_0x480029[_0x6b1f('0x32')]=_[_0x6b1f('0x33')](_0x480029[_0x6b1f('0x2f')],_0x480029['query']);_0x491f6b[_0x6b1f('0x35')]=_[_0x6b1f('0x33')](_0x480029[_0x6b1f('0x2f')],qs['fields'](_0x2c4d08[_0x6b1f('0x30')][_0x6b1f('0x34')]));_0x491f6b[_0x6b1f('0x35')]=_0x491f6b[_0x6b1f('0x35')]['length']?_0x491f6b[_0x6b1f('0x35')]:_0x480029[_0x6b1f('0x2f')];if(_0x2c4d08[_0x6b1f('0x30')][_0x6b1f('0x40')]){_0x491f6b[_0x6b1f('0x41')]=[{'all':!![]}];}_0x491f6b=_['merge']({},_0x491f6b,_0x2c4d08[_0x6b1f('0x3f')]);return db['SquareDetailsReport']['find'](_0x491f6b)[_0x6b1f('0x28')](handleEntityNotFound(_0xdf3a4e,null))[_0x6b1f('0x28')](respondWithResult(_0xdf3a4e,null))[_0x6b1f('0x43')](handleError(_0xdf3a4e,null));};exports[_0x6b1f('0x46')]=function(_0x5eafbd,_0x470529){return db[_0x6b1f('0x2d')][_0x6b1f('0x46')](_0x5eafbd[_0x6b1f('0x47')],{})[_0x6b1f('0x28')](respondWithResult(_0x470529,0xc9))[_0x6b1f('0x43')](handleError(_0x470529,null));};exports[_0x6b1f('0x27')]=function(_0xc68c9e,_0x25114c){if(_0xc68c9e[_0x6b1f('0x47')]['id']){delete _0xc68c9e[_0x6b1f('0x47')]['id'];}return db[_0x6b1f('0x2d')]['find']({'where':{'id':_0xc68c9e['params']['id']}})[_0x6b1f('0x28')](handleEntityNotFound(_0x25114c,null))['then'](saveUpdates(_0xc68c9e[_0x6b1f('0x47')],null))[_0x6b1f('0x28')](respondWithResult(_0x25114c,null))['catch'](handleError(_0x25114c,null));};exports[_0x6b1f('0x48')]=function(_0xe320b4,_0x5d2b80){return db[_0x6b1f('0x2d')]['find']({'where':{'id':_0xe320b4[_0x6b1f('0x45')]['id']}})[_0x6b1f('0x28')](handleEntityNotFound(_0x5d2b80,null))[_0x6b1f('0x28')](removeEntity(_0x5d2b80,null))['catch'](handleError(_0x5d2b80,null));};exports[_0x6b1f('0x49')]=function(_0x5d1731,_0x2320ff){return db[_0x6b1f('0x2d')][_0x6b1f('0x49')]()[_0x6b1f('0x28')](respondWithResult(_0x2320ff,null))[_0x6b1f('0x43')](handleError(_0x2320ff,null));};
\ No newline at end of file
+var _0xd324=['status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','length','order','pick','filter','where','merge','VIRTUAL','SquareDetailsReport','includeAll','include','findAll','rows','params','options','find','create','body','catch','describe','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x420df7,_0x5e15bf){var _0x20f465=function(_0x3a7861){while(--_0x3a7861){_0x420df7['push'](_0x420df7['shift']());}};_0x20f465(++_0x5e15bf);}(_0xd324,0x116));var _0x4d32=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xd324[_0x2d8d69];return _0x39ae22;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d32('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4d32('0x1'));var moment=require('moment');var BPromise=require(_0x4d32('0x2'));var Mustache=require(_0x4d32('0x3'));var util=require(_0x4d32('0x4'));var path=require(_0x4d32('0x5'));var sox=require(_0x4d32('0x6'));var csv=require(_0x4d32('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d32('0x8'));var _=require('lodash');var squel=require(_0x4d32('0x9'));var crypto=require(_0x4d32('0xa'));var jsforce=require(_0x4d32('0xb'));var deskjs=require(_0x4d32('0xc'));var toCsv=require(_0x4d32('0x7'));var querystring=require(_0x4d32('0xd'));var Papa=require(_0x4d32('0xe'));var Redis=require(_0x4d32('0xf'));var authService=require(_0x4d32('0x10'));var qs=require(_0x4d32('0x11'));var as=require(_0x4d32('0x12'));var hardwareService=require(_0x4d32('0x13'));var logger=require(_0x4d32('0x14'))(_0x4d32('0x15'));var utils=require('../../config/utils');var config=require(_0x4d32('0x16'));var licenseUtil=require(_0x4d32('0x17'));var db=require(_0x4d32('0x18'))['db'];function respondWithStatusCode(_0x735b87,_0xada3d0){_0xada3d0=_0xada3d0||0xcc;return function(_0x3cf2b6){if(_0x3cf2b6){return _0x735b87[_0x4d32('0x19')](_0xada3d0);}return _0x735b87[_0x4d32('0x1a')](_0xada3d0)[_0x4d32('0x1b')]();};}function respondWithResult(_0x56fdde,_0x4883e2){_0x4883e2=_0x4883e2||0xc8;return function(_0x5b1753){if(_0x5b1753){return _0x56fdde['status'](_0x4883e2)[_0x4d32('0x1c')](_0x5b1753);}};}function respondWithFilteredResult(_0x43dd23,_0x380ed6){return function(_0x305633){if(_0x305633){var _0x493181=typeof _0x380ed6['offset']===_0x4d32('0x1d')&&typeof _0x380ed6[_0x4d32('0x1e')]===_0x4d32('0x1d');var _0x4aa963=_0x305633[_0x4d32('0x1f')];var _0xb04bdd=_0x493181?0x0:_0x380ed6[_0x4d32('0x20')];var _0x3120f7=_0x493181?_0x305633[_0x4d32('0x1f')]:_0x380ed6[_0x4d32('0x20')]+_0x380ed6[_0x4d32('0x1e')];var _0x53608e;if(_0x3120f7>=_0x4aa963){_0x3120f7=_0x4aa963;_0x53608e=0xc8;}else{_0x53608e=0xce;}_0x43dd23[_0x4d32('0x1a')](_0x53608e);return _0x43dd23[_0x4d32('0x21')](_0x4d32('0x22'),_0xb04bdd+'-'+_0x3120f7+'/'+_0x4aa963)[_0x4d32('0x1c')](_0x305633);}return null;};}function patchUpdates(_0x43732d){return function(_0x1baf28){try{jsonpatch[_0x4d32('0x23')](_0x1baf28,_0x43732d,!![]);}catch(_0x4bf034){return BPromise[_0x4d32('0x24')](_0x4bf034);}return _0x1baf28[_0x4d32('0x25')]();};}function saveUpdates(_0x54b17a,_0x1e2d36){return function(_0x262e55){if(_0x262e55){return _0x262e55[_0x4d32('0x26')](_0x54b17a)[_0x4d32('0x27')](function(_0x13324d){return _0x13324d;});}return null;};}function removeEntity(_0x2fd62e,_0x509808){return function(_0x393b07){if(_0x393b07){return _0x393b07[_0x4d32('0x28')]()[_0x4d32('0x27')](function(){_0x2fd62e['status'](0xcc)[_0x4d32('0x1b')]();});}};}function handleEntityNotFound(_0x3c1f0b,_0x332bb2){return function(_0x51cd18){if(!_0x51cd18){_0x3c1f0b[_0x4d32('0x19')](0x194);}return _0x51cd18;};}function handleError(_0x106766,_0x1e47e7){_0x1e47e7=_0x1e47e7||0x1f4;return function(_0x467f14){logger[_0x4d32('0x29')](_0x467f14[_0x4d32('0x2a')]);if(_0x467f14[_0x4d32('0x2b')]){delete _0x467f14[_0x4d32('0x2b')];}_0x106766[_0x4d32('0x1a')](_0x1e47e7)[_0x4d32('0x2c')](_0x467f14);};}exports['index']=function(_0x2c2875,_0xd290f4){var _0x5c8330={},_0x24aa28={},_0x5a492c={'count':0x0,'rows':[]};var _0x31809e=_['map'](db['SquareDetailsReport'][_0x4d32('0x2d')],function(_0x290d01){return{'name':_0x290d01[_0x4d32('0x2e')],'type':_0x290d01[_0x4d32('0x2f')][_0x4d32('0x30')]};});_0x24aa28['model']=_[_0x4d32('0x31')](_0x31809e,_0x4d32('0x2b'));_0x24aa28[_0x4d32('0x32')]=_[_0x4d32('0x33')](_0x2c2875[_0x4d32('0x32')]);_0x24aa28[_0x4d32('0x34')]=_['intersection'](_0x24aa28[_0x4d32('0x35')],_0x24aa28[_0x4d32('0x32')]);_0x5c8330[_0x4d32('0x36')]=_[_0x4d32('0x37')](_0x24aa28[_0x4d32('0x35')],qs[_0x4d32('0x38')](_0x2c2875[_0x4d32('0x32')][_0x4d32('0x38')]));_0x5c8330[_0x4d32('0x36')]=_0x5c8330[_0x4d32('0x36')][_0x4d32('0x39')]?_0x5c8330[_0x4d32('0x36')]:_0x24aa28['model'];if(!_0x2c2875[_0x4d32('0x32')]['hasOwnProperty']('nolimit')){_0x5c8330['limit']=qs[_0x4d32('0x1e')](_0x2c2875[_0x4d32('0x32')][_0x4d32('0x1e')]);_0x5c8330['offset']=qs[_0x4d32('0x20')](_0x2c2875[_0x4d32('0x32')]['offset']);}_0x5c8330[_0x4d32('0x3a')]=qs['sort'](_0x2c2875[_0x4d32('0x32')]['sort']);_0x5c8330['where']=qs[_0x4d32('0x34')](_[_0x4d32('0x3b')](_0x2c2875['query'],_0x24aa28[_0x4d32('0x34')]),_0x31809e);if(_0x2c2875[_0x4d32('0x32')][_0x4d32('0x3c')]){_0x5c8330[_0x4d32('0x3d')]=_[_0x4d32('0x3e')](_0x5c8330['where'],{'$or':_[_0x4d32('0x31')](_0x31809e,function(_0x13268f){if(_0x13268f[_0x4d32('0x2f')]!==_0x4d32('0x3f')){var _0x55f9c3={};_0x55f9c3[_0x13268f[_0x4d32('0x2b')]]={'$like':'%'+_0x2c2875[_0x4d32('0x32')][_0x4d32('0x3c')]+'%'};return _0x55f9c3;}})});}_0x5c8330=_['merge']({},_0x5c8330,_0x2c2875['options']);var _0x427d38={'where':_0x5c8330['where']};return db[_0x4d32('0x40')][_0x4d32('0x1f')](_0x427d38)[_0x4d32('0x27')](function(_0x2e8ef8){_0x5a492c[_0x4d32('0x1f')]=_0x2e8ef8;if(_0x2c2875[_0x4d32('0x32')][_0x4d32('0x41')]){_0x5c8330[_0x4d32('0x42')]=[{'all':!![]}];}return db[_0x4d32('0x40')][_0x4d32('0x43')](_0x5c8330);})[_0x4d32('0x27')](function(_0x808d3b){_0x5a492c[_0x4d32('0x44')]=_0x808d3b;return _0x5a492c;})['then'](respondWithFilteredResult(_0xd290f4,_0x5c8330))['catch'](handleError(_0xd290f4,null));};exports['show']=function(_0x56cc25,_0x59a0d7){var _0x34e304={'raw':!![],'where':{'id':_0x56cc25[_0x4d32('0x45')]['id']}},_0x1dba99={};_0x1dba99['model']=_[_0x4d32('0x33')](db[_0x4d32('0x40')][_0x4d32('0x2d')]);_0x1dba99[_0x4d32('0x32')]=_[_0x4d32('0x33')](_0x56cc25['query']);_0x1dba99[_0x4d32('0x34')]=_[_0x4d32('0x37')](_0x1dba99['model'],_0x1dba99[_0x4d32('0x32')]);_0x34e304['attributes']=_[_0x4d32('0x37')](_0x1dba99[_0x4d32('0x35')],qs[_0x4d32('0x38')](_0x56cc25['query'][_0x4d32('0x38')]));_0x34e304[_0x4d32('0x36')]=_0x34e304[_0x4d32('0x36')]['length']?_0x34e304[_0x4d32('0x36')]:_0x1dba99[_0x4d32('0x35')];if(_0x56cc25[_0x4d32('0x32')][_0x4d32('0x41')]){_0x34e304[_0x4d32('0x42')]=[{'all':!![]}];}_0x34e304=_[_0x4d32('0x3e')]({},_0x34e304,_0x56cc25[_0x4d32('0x46')]);return db[_0x4d32('0x40')][_0x4d32('0x47')](_0x34e304)[_0x4d32('0x27')](handleEntityNotFound(_0x59a0d7,null))['then'](respondWithResult(_0x59a0d7,null))['catch'](handleError(_0x59a0d7,null));};exports[_0x4d32('0x48')]=function(_0x88b2a2,_0x634522){return db[_0x4d32('0x40')][_0x4d32('0x48')](_0x88b2a2[_0x4d32('0x49')],{})[_0x4d32('0x27')](respondWithResult(_0x634522,0xc9))[_0x4d32('0x4a')](handleError(_0x634522,null));};exports[_0x4d32('0x26')]=function(_0x44022d,_0x3c037b){if(_0x44022d['body']['id']){delete _0x44022d['body']['id'];}return db[_0x4d32('0x40')]['find']({'where':{'id':_0x44022d['params']['id']}})[_0x4d32('0x27')](handleEntityNotFound(_0x3c037b,null))[_0x4d32('0x27')](saveUpdates(_0x44022d[_0x4d32('0x49')],null))['then'](respondWithResult(_0x3c037b,null))['catch'](handleError(_0x3c037b,null));};exports['destroy']=function(_0x1cd6fa,_0x162200){return db['SquareDetailsReport']['find']({'where':{'id':_0x1cd6fa[_0x4d32('0x45')]['id']}})[_0x4d32('0x27')](handleEntityNotFound(_0x162200,null))[_0x4d32('0x27')](removeEntity(_0x162200,null))[_0x4d32('0x4a')](handleError(_0x162200,null));};exports[_0x4d32('0x4b')]=function(_0x3c2013,_0x11ff50){return db[_0x4d32('0x40')]['describe']()['then'](respondWithResult(_0x11ff50,null))[_0x4d32('0x4a')](handleError(_0x11ff50,null));};
\ No newline at end of file
index a6746c2..af97793 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf68a=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf68a,0x193));var _0xaf68=function(_0x30033b,_0x3ddc0d){_0x30033b=_0x30033b-0x0;var _0x3f9674=_0xf68a[_0x30033b];return _0x3f9674;};'use strict';var _=require(_0xaf68('0x0'));var util=require(_0xaf68('0x1'));var logger=require(_0xaf68('0x2'))(_0xaf68('0x3'));var moment=require(_0xaf68('0x4'));var BPromise=require(_0xaf68('0x5'));var rp=require(_0xaf68('0x6'));var fs=require('fs');var path=require(_0xaf68('0x7'));var rimraf=require(_0xaf68('0x8'));var config=require(_0xaf68('0x9'));var attributes=require(_0xaf68('0xa'));module[_0xaf68('0xb')]=function(_0x23c53a,_0x2a8bb8){return _0x23c53a[_0xaf68('0xc')](_0xaf68('0xd'),attributes,{'tableName':_0xaf68('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x41b6=['lodash','util','api','request-promise','rimraf','./squareReportDetail.attributes','define','SquareDetailsReport'];(function(_0x19c765,_0x5c7831){var _0x6e07a0=function(_0x594bb8){while(--_0x594bb8){_0x19c765['push'](_0x19c765['shift']());}};_0x6e07a0(++_0x5c7831);}(_0x41b6,0x158));var _0x641b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x41b6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x641b('0x0'));var util=require(_0x641b('0x1'));var logger=require('../../config/logger')(_0x641b('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x641b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x641b('0x4'));var config=require('../../config/environment');var attributes=require(_0x641b('0x5'));module['exports']=function(_0x395fbb,_0x3e3a66){return _0x395fbb[_0x641b('0x6')](_0x641b('0x7'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 965c2cb..bde0311 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x23a3=['jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','raw','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x217c77,_0x1ab688){var _0x4af98c=function(_0x358e20){while(--_0x358e20){_0x217c77['push'](_0x217c77['shift']());}};_0x4af98c(++_0x1ab688);}(_0x23a3,0x131));var _0x323a=function(_0x5d44ed,_0x3ff59b){_0x5d44ed=_0x5d44ed-0x0;var _0x124871=_0x23a3[_0x5d44ed];return _0x124871;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x323a('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x323a('0x1'));var db=require(_0x323a('0x2'))['db'];var utils=require(_0x323a('0x3'));var logger=require(_0x323a('0x4'))(_0x323a('0x5'));var config=require(_0x323a('0x6'));var jayson=require(_0x323a('0x7'));var client=jayson[_0x323a('0x8')][_0x323a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x50ad5a,_0x3452d3,_0x3544bd){return new BPromise(function(_0x568996,_0x385a54){return client[_0x323a('0xa')](_0x50ad5a,_0x3544bd)[_0x323a('0xb')](function(_0x4a74bd){logger[_0x323a('0xc')](_0x323a('0xd'),_0x3452d3,_0x323a('0xe'));logger[_0x323a('0xf')](_0x323a('0x10'),_0x3452d3,_0x323a('0xe'),JSON[_0x323a('0x11')](_0x4a74bd));if(_0x4a74bd[_0x323a('0x12')]){if(_0x4a74bd[_0x323a('0x12')][_0x323a('0x13')]===0x1f4){logger[_0x323a('0x12')](_0x323a('0xd'),_0x3452d3,_0x4a74bd[_0x323a('0x12')][_0x323a('0x14')]);return _0x385a54(_0x4a74bd['error'][_0x323a('0x14')]);}logger['error'](_0x323a('0xd'),_0x3452d3,_0x4a74bd['error']['message']);return _0x568996(_0x4a74bd[_0x323a('0x12')]['message']);}else{logger[_0x323a('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x3452d3,_0x323a('0xe'));_0x568996(_0x4a74bd[_0x323a('0x15')]['message']);}})[_0x323a('0x16')](function(_0x32674f){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x3452d3,_0x32674f);_0x385a54(_0x32674f);});});}exports[_0x323a('0x17')]=function(_0x221ae4){var _0x2feed1=this;return new Promise(function(_0x29dd21,_0x303338){return db[_0x323a('0x18')]['create'](_0x221ae4['body'],{'raw':_0x221ae4['options']?_0x221ae4['options'][_0x323a('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xc0f3e4){logger[_0x323a('0xc')](_0x323a('0x17'),_0x221ae4);logger[_0x323a('0xf')]('CreateSquareDetailsReport',_0x221ae4,JSON[_0x323a('0x11')](_0xc0f3e4));_0x29dd21(_0xc0f3e4);})['catch'](function(_0x12c8d7){logger[_0x323a('0x12')](_0x323a('0x17'),_0x12c8d7['message'],_0x221ae4);_0x303338(_0x2feed1[_0x323a('0x12')](0x1f4,_0x12c8d7[_0x323a('0x14')]));});});};
\ No newline at end of file
+var _0xb9be=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x370d3d,_0x1e1f4a){var _0x5bfcaf=function(_0x4a57c7){while(--_0x4a57c7){_0x370d3d['push'](_0x370d3d['shift']());}};_0x5bfcaf(++_0x1e1f4a);}(_0xb9be,0xc5));var _0xeb9b=function(_0x3f3f40,_0x4c71f4){_0x3f3f40=_0x3f3f40-0x0;var _0x403b7a=_0xb9be[_0x3f3f40];return _0x403b7a;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a8b9,_0x1ee7e0,_0x58ca1d){return new BPromise(function(_0x210eeb,_0x28dc5f){return client[_0xeb9b('0xc')](_0x49a8b9,_0x58ca1d)[_0xeb9b('0xd')](function(_0x418204){logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,'request\x20sent');logger[_0xeb9b('0x10')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1ee7e0,'request\x20sent',JSON[_0xeb9b('0x11')](_0x418204));if(_0x418204[_0xeb9b('0x12')]){if(_0x418204['error'][_0xeb9b('0x13')]===0x1f4){logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x28dc5f(_0x418204['error']['message']);}logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x210eeb(_0x418204['error']['message']);}else{logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,_0xeb9b('0x14'));_0x210eeb(_0x418204[_0xeb9b('0x15')][_0xeb9b('0x16')]);}})[_0xeb9b('0x17')](function(_0x239ccf){logger['error'](_0xeb9b('0xf'),_0x1ee7e0,_0x239ccf);_0x28dc5f(_0x239ccf);});});}exports[_0xeb9b('0x18')]=function(_0x21aca6){var _0x3a11e3=this;return new Promise(function(_0x3cbe3e,_0x1a140c){return db[_0xeb9b('0x19')][_0xeb9b('0x1a')](_0x21aca6[_0xeb9b('0x1b')],{'raw':_0x21aca6[_0xeb9b('0x1c')]?_0x21aca6['options'][_0xeb9b('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x5d5f54){logger[_0xeb9b('0xe')](_0xeb9b('0x18'),_0x21aca6);logger['debug'](_0xeb9b('0x18'),_0x21aca6,JSON[_0xeb9b('0x11')](_0x5d5f54));_0x3cbe3e(_0x5d5f54);})[_0xeb9b('0x17')](function(_0x37d7e0){logger[_0xeb9b('0x12')](_0xeb9b('0x18'),_0x37d7e0[_0xeb9b('0x16')],_0x21aca6);_0x1a140c(_0x3a11e3[_0xeb9b('0x12')](0x1f4,_0x37d7e0[_0xeb9b('0x16')]));});});};
\ No newline at end of file
index 49b2b90..bd47597 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b92=['isAuthenticated','index','/process/:pid/kill','killProcess','Router','../../components/auth/service','./system.controller','get'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x1b92,0xdc));var _0x21b9=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x1b92[_0x4b055c];return _0x4b62bb;};'use strict';var express=require('express');var router=express[_0x21b9('0x0')]();var auth=require(_0x21b9('0x1'));var controller=require(_0x21b9('0x2'));router[_0x21b9('0x3')]('/',auth[_0x21b9('0x4')](),controller[_0x21b9('0x5')]);router[_0x21b9('0x3')](_0x21b9('0x6'),auth[_0x21b9('0x4')](),controller[_0x21b9('0x7')]);module['exports']=router;
\ No newline at end of file
+var _0xef8d=['Router','../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','exports','express'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xef8d,0xe7));var _0xdef8=function(_0x2c90c1,_0x446eda){_0x2c90c1=_0x2c90c1-0x0;var _0xcb55d4=_0xef8d[_0x2c90c1];return _0xcb55d4;};'use strict';var express=require(_0xdef8('0x0'));var router=express[_0xdef8('0x1')]();var auth=require(_0xdef8('0x2'));var controller=require(_0xdef8('0x3'));router[_0xdef8('0x4')]('/',auth[_0xdef8('0x5')](),controller['index']);router['get'](_0xdef8('0x6'),auth[_0xdef8('0x5')](),controller['killProcess']);module[_0xdef8('0x7')]=router;
\ No newline at end of file
index c9d67d5..32a52a5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x84b0=['api','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','index','then','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','length','indexOf','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','systeminformation','exec','../../config/logger'];(function(_0x4f39cb,_0x183183){var _0x223a67=function(_0x2b6c35){while(--_0x2b6c35){_0x4f39cb['push'](_0x4f39cb['shift']());}};_0x223a67(++_0x183183);}(_0x84b0,0x1a6));var _0x084b=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x84b0[_0x2a6809];return _0x11c371;};'use strict';var info=require(_0x084b('0x0'));var exec=require('child_process')[_0x084b('0x1')];var logger=require(_0x084b('0x2'))(_0x084b('0x3'));var util=require('util');var BPromise=require('bluebird');var _=require(_0x084b('0x4'));function handleError(_0x5d6308,_0x145043,_0x53e909){_0x145043=_0x145043||0x1f4;return function(_0x3b2313){logger[_0x084b('0x5')](_0x084b('0x6'),_0x53e909,_0x145043,util[_0x084b('0x7')](_0x3b2313,{'showHidden':![],'depth':null}));delete _0x3b2313[_0x084b('0x8')];_0x5d6308[_0x084b('0x9')](_0x145043)['send'](_0x3b2313);};}exports[_0x084b('0xa')]=function(_0x12ea60,_0x502554){return info['getAllData']()[_0x084b('0xb')](function(_0x2fb70b){return _0x502554['status'](0xc8)[_0x084b('0xc')](_0x2fb70b);})['catch'](function(_0x53f373){return _0x502554[_0x084b('0x9')](0x1f4)['json'](_0x53f373);});};exports[_0x084b('0xd')]=function(_0x3ea7e9,_0x7ad10c){var _0x26b3cf=[_0x084b('0xe')];return new BPromise(function(_0x53a97b,_0x5a963e){return exec(util[_0x084b('0xf')](_0x084b('0x10'),_0x3ea7e9[_0x084b('0x11')][_0x084b('0x12')]),function(_0x5deff5,_0x94f116,_0x3edc36){if(_0x5deff5){return _0x5a963e(_0x5deff5);}return _0x53a97b(_0x94f116);});})[_0x084b('0xb')](function(_0x3d6486){var _0xb66a9e=![];var _0x23da36=_0x3d6486['split'](/\n/);for(var _0x1406e8=0x0,_0x4d4a01=_0x26b3cf[_0x084b('0x13')];_0x1406e8<_0x4d4a01,_0xb66a9e===![];_0x1406e8+=0x1){if(_0x3d6486[_0x084b('0x14')](_0x26b3cf[_0x1406e8])>=0x0){_0xb66a9e=!![];}}if(!_0xb66a9e){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x3ea7e9[_0x084b('0x11')]['pid']));}process[_0x084b('0x15')](_0x3ea7e9['params'][_0x084b('0x12')],_0x084b('0x16'));return _0x7ad10c[_0x084b('0x9')](0xc8)[_0x084b('0xc')]({'message':util[_0x084b('0xf')](_0x084b('0x17'),_0x3ea7e9['params']['pid'])});})[_0x084b('0x18')](handleError(_0x7ad10c,null,'killProcess'));};
\ No newline at end of file
+var _0xd89c=['../../config/logger','api','util','bluebird','error','inspect','name','status','send','index','getAllData','then','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd89c,0x85));var _0xcd89=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xd89c[_0x19e35c];return _0x3e1fe8;};'use strict';var info=require(_0xcd89('0x0'));var exec=require(_0xcd89('0x1'))['exec'];var logger=require(_0xcd89('0x2'))(_0xcd89('0x3'));var util=require(_0xcd89('0x4'));var BPromise=require(_0xcd89('0x5'));var _=require('lodash');function handleError(_0x38e4c9,_0x44c372,_0x410b2c){_0x44c372=_0x44c372||0x1f4;return function(_0x1bb681){logger[_0xcd89('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x410b2c,_0x44c372,util[_0xcd89('0x7')](_0x1bb681,{'showHidden':![],'depth':null}));delete _0x1bb681[_0xcd89('0x8')];_0x38e4c9[_0xcd89('0x9')](_0x44c372)[_0xcd89('0xa')](_0x1bb681);};}exports[_0xcd89('0xb')]=function(_0x3252f8,_0x2f4b47){return info[_0xcd89('0xc')]()[_0xcd89('0xd')](function(_0x44a2e4){return _0x2f4b47['status'](0xc8)['json'](_0x44a2e4);})['catch'](function(_0x37f7f7){return _0x2f4b47[_0xcd89('0x9')](0x1f4)[_0xcd89('0xe')](_0x37f7f7);});};exports['killProcess']=function(_0x36a194,_0x4aed06){var _0x35e097=[_0xcd89('0xf')];return new BPromise(function(_0x4ad089,_0x50b5ef){return exec(util[_0xcd89('0x10')](_0xcd89('0x11'),_0x36a194[_0xcd89('0x12')][_0xcd89('0x13')]),function(_0x3cac19,_0x48b5be,_0x259aa5){if(_0x3cac19){return _0x50b5ef(_0x3cac19);}return _0x4ad089(_0x48b5be);});})[_0xcd89('0xd')](function(_0x48f021){var _0x599163=![];var _0x34e666=_0x48f021[_0xcd89('0x14')](/\n/);for(var _0x3ce60e=0x0,_0x50439e=_0x35e097[_0xcd89('0x15')];_0x3ce60e<_0x50439e,_0x599163===![];_0x3ce60e+=0x1){if(_0x48f021[_0xcd89('0x16')](_0x35e097[_0x3ce60e])>=0x0){_0x599163=!![];}}if(!_0x599163){throw new Error(util[_0xcd89('0x10')](_0xcd89('0x17'),_0x36a194[_0xcd89('0x12')]['pid']));}process[_0xcd89('0x18')](_0x36a194[_0xcd89('0x12')][_0xcd89('0x13')],_0xcd89('0x19'));return _0x4aed06[_0xcd89('0x9')](0xc8)[_0xcd89('0xe')]({'message':util[_0xcd89('0x10')](_0xcd89('0x1a'),_0x36a194[_0xcd89('0x12')][_0xcd89('0x13')])});})['catch'](handleError(_0x4aed06,null,'killProcess'));};
\ No newline at end of file
index 50614fd..8020a26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd6d=['isAuthenticated','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','index','get','/:id'];(function(_0x3ba91c,_0x500bf0){var _0x334eec=function(_0x365422){while(--_0x365422){_0x3ba91c['push'](_0x3ba91c['shift']());}};_0x334eec(++_0x500bf0);}(_0xbd6d,0xc5));var _0xdbd6=function(_0x6db11d,_0xbcfa89){_0x6db11d=_0x6db11d-0x0;var _0x19a65f=_0xbd6d[_0x6db11d];return _0x19a65f;};'use strict';var multer=require(_0xdbd6('0x0'));var util=require(_0xdbd6('0x1'));var path=require(_0xdbd6('0x2'));var timeout=require(_0xdbd6('0x3'));var express=require(_0xdbd6('0x4'));var router=express['Router']();var fs_extra=require(_0xdbd6('0x5'));var auth=require(_0xdbd6('0x6'));var interaction=require(_0xdbd6('0x7'));var config=require(_0xdbd6('0x8'));var controller=require(_0xdbd6('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xdbd6('0xa')]);router[_0xdbd6('0xb')](_0xdbd6('0xc'),auth[_0xdbd6('0xd')](),controller[_0xdbd6('0xe')]);router[_0xdbd6('0xf')]('/',auth[_0xdbd6('0xd')](),controller[_0xdbd6('0x10')]);router['put']('/:id',auth[_0xdbd6('0xd')](),controller[_0xdbd6('0x11')]);router[_0xdbd6('0x12')](_0xdbd6('0xc'),auth[_0xdbd6('0xd')](),controller[_0xdbd6('0x13')]);module[_0xdbd6('0x14')]=router;
\ No newline at end of file
+var _0xb466=['update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x3297ce,_0x12d594){var _0x566b08=function(_0x37ba06){while(--_0x37ba06){_0x3297ce['push'](_0x3297ce['shift']());}};_0x566b08(++_0x12d594);}(_0xb466,0x6d));var _0x6b46=function(_0x1a3160,_0x3061a9){_0x1a3160=_0x1a3160-0x0;var _0x3e07cf=_0xb466[_0x1a3160];return _0x3e07cf;};'use strict';var multer=require(_0x6b46('0x0'));var util=require('util');var path=require(_0x6b46('0x1'));var timeout=require(_0x6b46('0x2'));var express=require('express');var router=express[_0x6b46('0x3')]();var fs_extra=require(_0x6b46('0x4'));var auth=require(_0x6b46('0x5'));var interaction=require(_0x6b46('0x6'));var config=require(_0x6b46('0x7'));var controller=require(_0x6b46('0x8'));router[_0x6b46('0x9')]('/',auth[_0x6b46('0xa')](),controller[_0x6b46('0xb')]);router[_0x6b46('0x9')](_0x6b46('0xc'),auth['isAuthenticated'](),controller[_0x6b46('0xd')]);router[_0x6b46('0xe')]('/',auth[_0x6b46('0xa')](),controller[_0x6b46('0xf')]);router[_0x6b46('0x10')]('/:id',auth[_0x6b46('0xa')](),controller[_0x6b46('0x11')]);router[_0x6b46('0x12')](_0x6b46('0xc'),auth['isAuthenticated'](),controller[_0x6b46('0x13')]);module[_0x6b46('0x14')]=router;
\ No newline at end of file
index 180409d..394a5a5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e44=['sequelize','exports','STRING','#0091EA'];(function(_0x3e0c77,_0x320fa7){var _0x5a66fd=function(_0xe72bad){while(--_0xe72bad){_0x3e0c77['push'](_0x3e0c77['shift']());}};_0x5a66fd(++_0x320fa7);}(_0x8e44,0x1ac));var _0x48e4=function(_0x29c3f3,_0x17cc26){_0x29c3f3=_0x29c3f3-0x0;var _0x420c9e=_0x8e44[_0x29c3f3];return _0x420c9e;};'use strict';var Sequelize=require(_0x48e4('0x0'));module[_0x48e4('0x1')]={'name':{'type':Sequelize[_0x48e4('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x48e4('0x3')},'description':{'type':Sequelize[_0x48e4('0x2')]}};
\ No newline at end of file
+var _0xf1f9=['name','sequelize','exports','STRING'];(function(_0x2aa2ff,_0x573663){var _0x234c17=function(_0x474bad){while(--_0x474bad){_0x2aa2ff['push'](_0x2aa2ff['shift']());}};_0x234c17(++_0x573663);}(_0xf1f9,0x1cd));var _0x9f1f=function(_0x30d6c6,_0x5e51dc){_0x30d6c6=_0x30d6c6-0x0;var _0x4bb109=_0xf1f9[_0x30d6c6];return _0x4bb109;};'use strict';var Sequelize=require(_0x9f1f('0x0'));module[_0x9f1f('0x1')]={'name':{'type':Sequelize[_0x9f1f('0x2')],'unique':_0x9f1f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x9f1f('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x9f1f('0x2')]}};
\ No newline at end of file
index e6ab079..75368df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf2cb=['../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','get','Tags','UserProfileResource','end','error','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','rimraf','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0xf2cb,0x130));var _0xbf2c=function(_0x1e53e5,_0x186c08){_0x1e53e5=_0x1e53e5-0x0;var _0x185457=_0xf2cb[_0x1e53e5];return _0x185457;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf2c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbf2c('0x1'));var rp=require('request-promise');var moment=require(_0xbf2c('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbf2c('0x3'));var util=require(_0xbf2c('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0xbf2c('0x5'));var ejs=require(_0xbf2c('0x6'));var fs=require('fs');var fs_extra=require(_0xbf2c('0x7'));var _=require(_0xbf2c('0x8'));var squel=require('squel');var crypto=require(_0xbf2c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xbf2c('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf2c('0xb'));var Redis=require(_0xbf2c('0xc'));var authService=require(_0xbf2c('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xbf2c('0xe'));var hardwareService=require(_0xbf2c('0xf'));var logger=require(_0xbf2c('0x10'))(_0xbf2c('0x11'));var utils=require(_0xbf2c('0x12'));var config=require(_0xbf2c('0x13'));var licenseUtil=require(_0xbf2c('0x14'));var db=require(_0xbf2c('0x15'))['db'];function respondWithStatusCode(_0x52983d,_0x149235){_0x149235=_0x149235||0xcc;return function(_0x294d0d){if(_0x294d0d){return _0x52983d[_0xbf2c('0x16')](_0x149235);}return _0x52983d[_0xbf2c('0x17')](_0x149235)['end']();};}function respondWithResult(_0x7665b1,_0x5a160b){_0x5a160b=_0x5a160b||0xc8;return function(_0x557740){if(_0x557740){return _0x7665b1[_0xbf2c('0x17')](_0x5a160b)['json'](_0x557740);}};}function respondWithFilteredResult(_0x47df49,_0x3ed1c3){return function(_0x45412){if(_0x45412){var _0x2dc80e=typeof _0x3ed1c3[_0xbf2c('0x18')]===_0xbf2c('0x19')&&typeof _0x3ed1c3['limit']===_0xbf2c('0x19');var _0x5514b0=_0x45412[_0xbf2c('0x1a')];var _0x1df2ab=_0x2dc80e?0x0:_0x3ed1c3[_0xbf2c('0x18')];var _0x32a44d=_0x2dc80e?_0x45412[_0xbf2c('0x1a')]:_0x3ed1c3['offset']+_0x3ed1c3[_0xbf2c('0x1b')];var _0x1fbfe8;if(_0x32a44d>=_0x5514b0){_0x32a44d=_0x5514b0;_0x1fbfe8=0xc8;}else{_0x1fbfe8=0xce;}_0x47df49[_0xbf2c('0x17')](_0x1fbfe8);return _0x47df49[_0xbf2c('0x1c')](_0xbf2c('0x1d'),_0x1df2ab+'-'+_0x32a44d+'/'+_0x5514b0)[_0xbf2c('0x1e')](_0x45412);}return null;};}function patchUpdates(_0x426724){return function(_0x58caa9){try{jsonpatch[_0xbf2c('0x1f')](_0x58caa9,_0x426724,!![]);}catch(_0x2a3adf){return BPromise[_0xbf2c('0x20')](_0x2a3adf);}return _0x58caa9[_0xbf2c('0x21')]();};}function saveUpdates(_0x57873c,_0x2bc2ad){return function(_0x1f5515){if(_0x1f5515){return _0x1f5515['update'](_0x57873c)[_0xbf2c('0x22')](function(_0x356f26){return _0x356f26;});}return null;};}function removeEntity(_0x3f1cdb,_0x52ecb4){return function(_0x5de1f2){if(_0x5de1f2){return _0x5de1f2[_0xbf2c('0x23')]()[_0xbf2c('0x22')](function(){var _0xae9c7=_0x5de1f2[_0xbf2c('0x24')]({'plain':!![]});var _0x108aa8=_0xbf2c('0x25');return db[_0xbf2c('0x26')]['destroy']({'where':{'type':_0x108aa8,'resourceId':_0xae9c7['id']}})['then'](function(){return _0x5de1f2;});})[_0xbf2c('0x22')](function(){_0x3f1cdb[_0xbf2c('0x17')](0xcc)[_0xbf2c('0x27')]();});}};}function handleEntityNotFound(_0x4314d6,_0x3ed68d){return function(_0x4a0257){if(!_0x4a0257){_0x4314d6[_0xbf2c('0x16')](0x194);}return _0x4a0257;};}function handleError(_0x2976fa,_0x1f7030){_0x1f7030=_0x1f7030||0x1f4;return function(_0x4f3191){logger[_0xbf2c('0x28')](_0x4f3191['stack']);if(_0x4f3191[_0xbf2c('0x29')]){delete _0x4f3191[_0xbf2c('0x29')];}_0x2976fa[_0xbf2c('0x17')](_0x1f7030)[_0xbf2c('0x2a')](_0x4f3191);};}exports[_0xbf2c('0x2b')]=function(_0x502943,_0x1e946c){var _0xef5fc9={},_0x132365={},_0x13e238={'count':0x0,'rows':[]};var _0x2cc8cb=_[_0xbf2c('0x2c')](db[_0xbf2c('0x2d')][_0xbf2c('0x2e')],function(_0x4d731d){return{'name':_0x4d731d[_0xbf2c('0x2f')],'type':_0x4d731d[_0xbf2c('0x30')][_0xbf2c('0x31')]};});_0x132365['model']=_['map'](_0x2cc8cb,_0xbf2c('0x29'));_0x132365[_0xbf2c('0x32')]=_[_0xbf2c('0x33')](_0x502943[_0xbf2c('0x32')]);_0x132365[_0xbf2c('0x34')]=_[_0xbf2c('0x35')](_0x132365[_0xbf2c('0x36')],_0x132365[_0xbf2c('0x32')]);_0xef5fc9[_0xbf2c('0x37')]=_['intersection'](_0x132365[_0xbf2c('0x36')],qs[_0xbf2c('0x38')](_0x502943[_0xbf2c('0x32')][_0xbf2c('0x38')]));_0xef5fc9[_0xbf2c('0x37')]=_0xef5fc9[_0xbf2c('0x37')][_0xbf2c('0x39')]?_0xef5fc9[_0xbf2c('0x37')]:_0x132365['model'];if(!_0x502943[_0xbf2c('0x32')][_0xbf2c('0x3a')](_0xbf2c('0x3b'))){_0xef5fc9['limit']=qs[_0xbf2c('0x1b')](_0x502943[_0xbf2c('0x32')][_0xbf2c('0x1b')]);_0xef5fc9['offset']=qs[_0xbf2c('0x18')](_0x502943[_0xbf2c('0x32')]['offset']);}_0xef5fc9['order']=qs['sort'](_0x502943['query']['sort']);_0xef5fc9[_0xbf2c('0x3c')]=qs[_0xbf2c('0x34')](_[_0xbf2c('0x3d')](_0x502943[_0xbf2c('0x32')],_0x132365[_0xbf2c('0x34')]),_0x2cc8cb);if(_0x502943[_0xbf2c('0x32')][_0xbf2c('0x3e')]){_0xef5fc9[_0xbf2c('0x3c')]=_[_0xbf2c('0x3f')](_0xef5fc9[_0xbf2c('0x3c')],{'$or':_[_0xbf2c('0x2c')](_0x2cc8cb,function(_0x99abc8){if(_0x99abc8[_0xbf2c('0x30')]!==_0xbf2c('0x40')){var _0x4776e0={};_0x4776e0[_0x99abc8[_0xbf2c('0x29')]]={'$like':'%'+_0x502943['query'][_0xbf2c('0x3e')]+'%'};return _0x4776e0;}})});}_0xef5fc9=_[_0xbf2c('0x3f')]({},_0xef5fc9,_0x502943[_0xbf2c('0x41')]);var _0x3379d2={'where':_0xef5fc9[_0xbf2c('0x3c')]};return db[_0xbf2c('0x2d')][_0xbf2c('0x1a')](_0x3379d2)[_0xbf2c('0x22')](function(_0x500e0b){_0x13e238[_0xbf2c('0x1a')]=_0x500e0b;if(_0x502943[_0xbf2c('0x32')][_0xbf2c('0x42')]){_0xef5fc9[_0xbf2c('0x43')]=[{'all':!![]}];}return db['Tag'][_0xbf2c('0x44')](_0xef5fc9);})['then'](function(_0x369bdc){_0x13e238[_0xbf2c('0x45')]=_0x369bdc;return _0x13e238;})[_0xbf2c('0x22')](respondWithFilteredResult(_0x1e946c,_0xef5fc9))[_0xbf2c('0x46')](handleError(_0x1e946c,null));};exports[_0xbf2c('0x47')]=function(_0x14107c,_0x4c2a1e){var _0x365710={'raw':!![],'where':{'id':_0x14107c['params']['id']}},_0x55c3d7={};_0x55c3d7[_0xbf2c('0x36')]=_['keys'](db['Tag'][_0xbf2c('0x2e')]);_0x55c3d7[_0xbf2c('0x32')]=_['keys'](_0x14107c[_0xbf2c('0x32')]);_0x55c3d7['filters']=_[_0xbf2c('0x35')](_0x55c3d7['model'],_0x55c3d7[_0xbf2c('0x32')]);_0x365710[_0xbf2c('0x37')]=_[_0xbf2c('0x35')](_0x55c3d7[_0xbf2c('0x36')],qs[_0xbf2c('0x38')](_0x14107c[_0xbf2c('0x32')]['fields']));_0x365710[_0xbf2c('0x37')]=_0x365710[_0xbf2c('0x37')][_0xbf2c('0x39')]?_0x365710[_0xbf2c('0x37')]:_0x55c3d7[_0xbf2c('0x36')];if(_0x14107c['query']['includeAll']){_0x365710[_0xbf2c('0x43')]=[{'all':!![]}];}_0x365710=_['merge']({},_0x365710,_0x14107c[_0xbf2c('0x41')]);return db[_0xbf2c('0x2d')][_0xbf2c('0x48')](_0x365710)[_0xbf2c('0x22')](handleEntityNotFound(_0x4c2a1e,null))[_0xbf2c('0x22')](respondWithResult(_0x4c2a1e,null))[_0xbf2c('0x46')](handleError(_0x4c2a1e,null));};exports[_0xbf2c('0x49')]=function(_0x1c3b78,_0x128e97){return db[_0xbf2c('0x2d')][_0xbf2c('0x49')](_0x1c3b78['body'],{})[_0xbf2c('0x22')](function(_0x22af02){var _0x90276=_0x1c3b78[_0xbf2c('0x4a')]['get']({'plain':!![]});if(!_0x90276)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x90276['role']===_0xbf2c('0x4a')){var _0x2451ba=_0x22af02['get']({'plain':!![]});var _0x5a0c37='Tags';return db[_0xbf2c('0x4b')][_0xbf2c('0x48')]({'where':{'name':_0x5a0c37,'userProfileId':_0x90276[_0xbf2c('0x4c')]},'raw':!![]})[_0xbf2c('0x22')](function(_0x3a8d9a){if(_0x3a8d9a&&_0x3a8d9a[_0xbf2c('0x4d')]===0x0){return db['UserProfileResource'][_0xbf2c('0x49')]({'name':_0x2451ba[_0xbf2c('0x29')],'resourceId':_0x2451ba['id'],'type':_0x3a8d9a[_0xbf2c('0x29')],'sectionId':_0x3a8d9a['id']},{})[_0xbf2c('0x22')](function(){return _0x22af02;});}else{return _0x22af02;}})[_0xbf2c('0x46')](function(_0x3166dd){logger[_0xbf2c('0x28')](_0xbf2c('0x4e'),_0x3166dd);throw _0x3166dd;});}return _0x22af02;})['then'](respondWithResult(_0x128e97,0xc9))['catch'](handleError(_0x128e97,null));};exports['update']=function(_0x3a62f9,_0x2b0ec3){if(_0x3a62f9[_0xbf2c('0x4f')]['id']){delete _0x3a62f9[_0xbf2c('0x4f')]['id'];}return db['Tag'][_0xbf2c('0x48')]({'where':{'id':_0x3a62f9[_0xbf2c('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b0ec3,null))[_0xbf2c('0x22')](saveUpdates(_0x3a62f9[_0xbf2c('0x4f')],null))[_0xbf2c('0x22')](respondWithResult(_0x2b0ec3,null))['catch'](handleError(_0x2b0ec3,null));};exports['destroy']=function(_0x4b6253,_0x49cae6){return db[_0xbf2c('0x2d')][_0xbf2c('0x48')]({'where':{'id':_0x4b6253[_0xbf2c('0x50')]['id']}})[_0xbf2c('0x22')](handleEntityNotFound(_0x49cae6,null))[_0xbf2c('0x22')](removeEntity(_0x49cae6,null))['catch'](handleError(_0x49cae6,null));};
\ No newline at end of file
+var _0x407f=['filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','get','Tags','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick'];(function(_0x5c31ba,_0x5b60d9){var _0x3a305f=function(_0x4155a7){while(--_0x4155a7){_0x5c31ba['push'](_0x5c31ba['shift']());}};_0x3a305f(++_0x5b60d9);}(_0x407f,0xc2));var _0xf407=function(_0x7c9f1d,_0x4b7628){_0x7c9f1d=_0x7c9f1d-0x0;var _0x1b24bd=_0x407f[_0x7c9f1d];return _0x1b24bd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf407('0x0'));var rp=require(_0xf407('0x1'));var moment=require(_0xf407('0x2'));var BPromise=require(_0xf407('0x3'));var Mustache=require(_0xf407('0x4'));var util=require(_0xf407('0x5'));var path=require(_0xf407('0x6'));var sox=require(_0xf407('0x7'));var csv=require(_0xf407('0x8'));var ejs=require(_0xf407('0x9'));var fs=require('fs');var fs_extra=require(_0xf407('0xa'));var _=require(_0xf407('0xb'));var squel=require(_0xf407('0xc'));var crypto=require(_0xf407('0xd'));var jsforce=require(_0xf407('0xe'));var deskjs=require(_0xf407('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf407('0x10'));var Papa=require(_0xf407('0x11'));var Redis=require(_0xf407('0x12'));var authService=require(_0xf407('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf407('0x14'))(_0xf407('0x15'));var utils=require(_0xf407('0x16'));var config=require(_0xf407('0x17'));var licenseUtil=require(_0xf407('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ee485,_0x3f4ca0){_0x3f4ca0=_0x3f4ca0||0xcc;return function(_0x3b26ae){if(_0x3b26ae){return _0x2ee485[_0xf407('0x19')](_0x3f4ca0);}return _0x2ee485[_0xf407('0x1a')](_0x3f4ca0)[_0xf407('0x1b')]();};}function respondWithResult(_0x242f43,_0x5257ef){_0x5257ef=_0x5257ef||0xc8;return function(_0x5d80ab){if(_0x5d80ab){return _0x242f43['status'](_0x5257ef)[_0xf407('0x1c')](_0x5d80ab);}};}function respondWithFilteredResult(_0x593e36,_0x454710){return function(_0x4c1320){if(_0x4c1320){var _0x48fd5d=typeof _0x454710[_0xf407('0x1d')]===_0xf407('0x1e')&&typeof _0x454710[_0xf407('0x1f')]===_0xf407('0x1e');var _0x351252=_0x4c1320[_0xf407('0x20')];var _0x4ddbe6=_0x48fd5d?0x0:_0x454710[_0xf407('0x1d')];var _0x588fe4=_0x48fd5d?_0x4c1320[_0xf407('0x20')]:_0x454710[_0xf407('0x1d')]+_0x454710[_0xf407('0x1f')];var _0x334c1a;if(_0x588fe4>=_0x351252){_0x588fe4=_0x351252;_0x334c1a=0xc8;}else{_0x334c1a=0xce;}_0x593e36[_0xf407('0x1a')](_0x334c1a);return _0x593e36[_0xf407('0x21')]('Content-Range',_0x4ddbe6+'-'+_0x588fe4+'/'+_0x351252)[_0xf407('0x1c')](_0x4c1320);}return null;};}function patchUpdates(_0x39febd){return function(_0x2f7ed0){try{jsonpatch[_0xf407('0x22')](_0x2f7ed0,_0x39febd,!![]);}catch(_0x4eb0c3){return BPromise[_0xf407('0x23')](_0x4eb0c3);}return _0x2f7ed0[_0xf407('0x24')]();};}function saveUpdates(_0x23659c,_0xa6f11e){return function(_0x5f32bb){if(_0x5f32bb){return _0x5f32bb['update'](_0x23659c)[_0xf407('0x25')](function(_0x100e6e){return _0x100e6e;});}return null;};}function removeEntity(_0x2558a1,_0x2cea00){return function(_0x9406cf){if(_0x9406cf){return _0x9406cf[_0xf407('0x26')]()[_0xf407('0x25')](function(){var _0x5aecf2=_0x9406cf[_0xf407('0x27')]({'plain':!![]});var _0x1996c8=_0xf407('0x28');return db['UserProfileResource'][_0xf407('0x26')]({'where':{'type':_0x1996c8,'resourceId':_0x5aecf2['id']}})[_0xf407('0x25')](function(){return _0x9406cf;});})[_0xf407('0x25')](function(){_0x2558a1[_0xf407('0x1a')](0xcc)[_0xf407('0x1b')]();});}};}function handleEntityNotFound(_0x187c93,_0x524b34){return function(_0x3953c5){if(!_0x3953c5){_0x187c93['sendStatus'](0x194);}return _0x3953c5;};}function handleError(_0x4fc4df,_0x949669){_0x949669=_0x949669||0x1f4;return function(_0x115dce){logger[_0xf407('0x29')](_0x115dce[_0xf407('0x2a')]);if(_0x115dce[_0xf407('0x2b')]){delete _0x115dce[_0xf407('0x2b')];}_0x4fc4df['status'](_0x949669)[_0xf407('0x2c')](_0x115dce);};}exports[_0xf407('0x2d')]=function(_0xa91b61,_0x89915b){var _0x15cd8d={},_0x5e12da={},_0x4a763e={'count':0x0,'rows':[]};var _0xce3a12=_[_0xf407('0x2e')](db[_0xf407('0x2f')][_0xf407('0x30')],function(_0x153287){return{'name':_0x153287[_0xf407('0x31')],'type':_0x153287[_0xf407('0x32')]['key']};});_0x5e12da[_0xf407('0x33')]=_['map'](_0xce3a12,_0xf407('0x2b'));_0x5e12da[_0xf407('0x34')]=_['keys'](_0xa91b61['query']);_0x5e12da['filters']=_[_0xf407('0x35')](_0x5e12da[_0xf407('0x33')],_0x5e12da['query']);_0x15cd8d[_0xf407('0x36')]=_[_0xf407('0x35')](_0x5e12da[_0xf407('0x33')],qs[_0xf407('0x37')](_0xa91b61['query']['fields']));_0x15cd8d[_0xf407('0x36')]=_0x15cd8d[_0xf407('0x36')][_0xf407('0x38')]?_0x15cd8d[_0xf407('0x36')]:_0x5e12da[_0xf407('0x33')];if(!_0xa91b61[_0xf407('0x34')][_0xf407('0x39')](_0xf407('0x3a'))){_0x15cd8d[_0xf407('0x1f')]=qs[_0xf407('0x1f')](_0xa91b61['query'][_0xf407('0x1f')]);_0x15cd8d['offset']=qs[_0xf407('0x1d')](_0xa91b61[_0xf407('0x34')][_0xf407('0x1d')]);}_0x15cd8d[_0xf407('0x3b')]=qs[_0xf407('0x3c')](_0xa91b61['query'][_0xf407('0x3c')]);_0x15cd8d[_0xf407('0x3d')]=qs[_0xf407('0x3e')](_[_0xf407('0x3f')](_0xa91b61['query'],_0x5e12da[_0xf407('0x3e')]),_0xce3a12);if(_0xa91b61[_0xf407('0x34')][_0xf407('0x40')]){_0x15cd8d['where']=_['merge'](_0x15cd8d[_0xf407('0x3d')],{'$or':_['map'](_0xce3a12,function(_0x573fae){if(_0x573fae[_0xf407('0x32')]!==_0xf407('0x41')){var _0x4890ae={};_0x4890ae[_0x573fae[_0xf407('0x2b')]]={'$like':'%'+_0xa91b61[_0xf407('0x34')][_0xf407('0x40')]+'%'};return _0x4890ae;}})});}_0x15cd8d=_[_0xf407('0x42')]({},_0x15cd8d,_0xa91b61[_0xf407('0x43')]);var _0x5c27c4={'where':_0x15cd8d[_0xf407('0x3d')]};return db['Tag']['count'](_0x5c27c4)[_0xf407('0x25')](function(_0x1ddb15){_0x4a763e['count']=_0x1ddb15;if(_0xa91b61[_0xf407('0x34')][_0xf407('0x44')]){_0x15cd8d[_0xf407('0x45')]=[{'all':!![]}];}return db[_0xf407('0x2f')][_0xf407('0x46')](_0x15cd8d);})[_0xf407('0x25')](function(_0x1c8f17){_0x4a763e[_0xf407('0x47')]=_0x1c8f17;return _0x4a763e;})['then'](respondWithFilteredResult(_0x89915b,_0x15cd8d))[_0xf407('0x48')](handleError(_0x89915b,null));};exports['show']=function(_0x2def2e,_0x571188){var _0x444b01={'raw':!![],'where':{'id':_0x2def2e[_0xf407('0x49')]['id']}},_0x56ea2b={};_0x56ea2b[_0xf407('0x33')]=_[_0xf407('0x4a')](db[_0xf407('0x2f')][_0xf407('0x30')]);_0x56ea2b[_0xf407('0x34')]=_[_0xf407('0x4a')](_0x2def2e['query']);_0x56ea2b[_0xf407('0x3e')]=_[_0xf407('0x35')](_0x56ea2b[_0xf407('0x33')],_0x56ea2b[_0xf407('0x34')]);_0x444b01[_0xf407('0x36')]=_[_0xf407('0x35')](_0x56ea2b['model'],qs[_0xf407('0x37')](_0x2def2e[_0xf407('0x34')][_0xf407('0x37')]));_0x444b01[_0xf407('0x36')]=_0x444b01[_0xf407('0x36')][_0xf407('0x38')]?_0x444b01['attributes']:_0x56ea2b[_0xf407('0x33')];if(_0x2def2e[_0xf407('0x34')][_0xf407('0x44')]){_0x444b01['include']=[{'all':!![]}];}_0x444b01=_[_0xf407('0x42')]({},_0x444b01,_0x2def2e['options']);return db[_0xf407('0x2f')][_0xf407('0x4b')](_0x444b01)[_0xf407('0x25')](handleEntityNotFound(_0x571188,null))[_0xf407('0x25')](respondWithResult(_0x571188,null))['catch'](handleError(_0x571188,null));};exports[_0xf407('0x4c')]=function(_0x3b6c44,_0x16cf14){return db['Tag']['create'](_0x3b6c44[_0xf407('0x4d')],{})[_0xf407('0x25')](function(_0x45e9ab){var _0x4799c1=_0x3b6c44[_0xf407('0x4e')][_0xf407('0x27')]({'plain':!![]});if(!_0x4799c1)throw new Error(_0xf407('0x4f'));if(_0x4799c1[_0xf407('0x50')]==='user'){var _0x1282df=_0x45e9ab[_0xf407('0x27')]({'plain':!![]});var _0x4e8483=_0xf407('0x28');return db[_0xf407('0x51')][_0xf407('0x4b')]({'where':{'name':_0x4e8483,'userProfileId':_0x4799c1['userProfileId']},'raw':!![]})[_0xf407('0x25')](function(_0xd168af){if(_0xd168af&&_0xd168af[_0xf407('0x52')]===0x0){return db[_0xf407('0x53')]['create']({'name':_0x1282df[_0xf407('0x2b')],'resourceId':_0x1282df['id'],'type':_0xd168af[_0xf407('0x2b')],'sectionId':_0xd168af['id']},{})['then'](function(){return _0x45e9ab;});}else{return _0x45e9ab;}})[_0xf407('0x48')](function(_0x588fd7){logger[_0xf407('0x29')](_0xf407('0x54'),_0x588fd7);throw _0x588fd7;});}return _0x45e9ab;})['then'](respondWithResult(_0x16cf14,0xc9))[_0xf407('0x48')](handleError(_0x16cf14,null));};exports[_0xf407('0x55')]=function(_0x4b161b,_0x289d00){if(_0x4b161b['body']['id']){delete _0x4b161b['body']['id'];}return db[_0xf407('0x2f')][_0xf407('0x4b')]({'where':{'id':_0x4b161b[_0xf407('0x49')]['id']}})[_0xf407('0x25')](handleEntityNotFound(_0x289d00,null))[_0xf407('0x25')](saveUpdates(_0x4b161b[_0xf407('0x4d')],null))['then'](respondWithResult(_0x289d00,null))['catch'](handleError(_0x289d00,null));};exports[_0xf407('0x26')]=function(_0x34cdf1,_0x417bdd){return db[_0xf407('0x2f')][_0xf407('0x4b')]({'where':{'id':_0x34cdf1[_0xf407('0x49')]['id']}})['then'](handleEntityNotFound(_0x417bdd,null))[_0xf407('0x25')](removeEntity(_0x417bdd,null))[_0xf407('0x48')](handleError(_0x417bdd,null));};
\ No newline at end of file
index 8a61ad8..5fe4f3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfa09=['rimraf','../../config/environment','./tag.attributes','define','Tag','tools_tags','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x475f75,_0x45e3bf){var _0x1dd143=function(_0xfb99fe){while(--_0xfb99fe){_0x475f75['push'](_0x475f75['shift']());}};_0x1dd143(++_0x45e3bf);}(_0xfa09,0x10a));var _0x9fa0=function(_0x26d704,_0x3be080){_0x26d704=_0x26d704-0x0;var _0x3cdc7e=_0xfa09[_0x26d704];return _0x3cdc7e;};'use strict';var _=require(_0x9fa0('0x0'));var util=require(_0x9fa0('0x1'));var logger=require('../../config/logger')(_0x9fa0('0x2'));var moment=require(_0x9fa0('0x3'));var BPromise=require(_0x9fa0('0x4'));var rp=require(_0x9fa0('0x5'));var fs=require('fs');var path=require(_0x9fa0('0x6'));var rimraf=require(_0x9fa0('0x7'));var config=require(_0x9fa0('0x8'));var attributes=require(_0x9fa0('0x9'));module['exports']=function(_0x1c8ae6,_0x5b0e47){return _0x1c8ae6[_0x9fa0('0xa')](_0x9fa0('0xb'),attributes,{'tableName':_0x9fa0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x176d=['../../config/environment','./tag.attributes','exports','define','Tag','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0x2c645b,_0x313fd4){var _0x511ba8=function(_0x2ec9bd){while(--_0x2ec9bd){_0x2c645b['push'](_0x2c645b['shift']());}};_0x511ba8(++_0x313fd4);}(_0x176d,0x16d));var _0xd176=function(_0x186aa1,_0x2dc40c){_0x186aa1=_0x186aa1-0x0;var _0x355f9b=_0x176d[_0x186aa1];return _0x355f9b;};'use strict';var _=require(_0xd176('0x0'));var util=require(_0xd176('0x1'));var logger=require(_0xd176('0x2'))(_0xd176('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd176('0x4'));var fs=require('fs');var path=require(_0xd176('0x5'));var rimraf=require(_0xd176('0x6'));var config=require(_0xd176('0x7'));var attributes=require(_0xd176('0x8'));module[_0xd176('0x9')]=function(_0x8ef23e,_0x4cbcba){return _0x8ef23e[_0xd176('0xa')](_0xd176('0xb'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4b60aa2..51831a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1cc7=['error','code','Tag,\x20%s,\x20%s','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','client','then','info','request\x20sent','stringify'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1cc7,0x15a));var _0x71cc=function(_0x1b7459,_0x19bef7){_0x1b7459=_0x1b7459-0x0;var _0x58a7f2=_0x1cc7[_0x1b7459];return _0x58a7f2;};'use strict';var _=require(_0x71cc('0x0'));var util=require(_0x71cc('0x1'));var moment=require(_0x71cc('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x71cc('0x3'))['db'];var utils=require(_0x71cc('0x4'));var logger=require(_0x71cc('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x71cc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc0444e,_0x41a004,_0x4039ce){return new BPromise(function(_0x2e70f0,_0x2b788c){return client['request'](_0xc0444e,_0x4039ce)[_0x71cc('0x7')](function(_0x322df2){logger[_0x71cc('0x8')]('Tag,\x20%s,\x20%s',_0x41a004,'request\x20sent');logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x41a004,_0x71cc('0x9'),JSON[_0x71cc('0xa')](_0x322df2));if(_0x322df2[_0x71cc('0xb')]){if(_0x322df2['error'][_0x71cc('0xc')]===0x1f4){logger['error'](_0x71cc('0xd'),_0x41a004,_0x322df2['error'][_0x71cc('0xe')]);return _0x2b788c(_0x322df2['error'][_0x71cc('0xe')]);}logger[_0x71cc('0xb')](_0x71cc('0xd'),_0x41a004,_0x322df2[_0x71cc('0xb')][_0x71cc('0xe')]);return _0x2e70f0(_0x322df2['error'][_0x71cc('0xe')]);}else{logger[_0x71cc('0x8')](_0x71cc('0xd'),_0x41a004,_0x71cc('0x9'));_0x2e70f0(_0x322df2[_0x71cc('0xf')][_0x71cc('0xe')]);}})[_0x71cc('0x10')](function(_0x5eae5b){logger[_0x71cc('0xb')](_0x71cc('0xd'),_0x41a004,_0x5eae5b);_0x2b788c(_0x5eae5b);});});}
\ No newline at end of file
+var _0x54f3=['moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','util'];(function(_0x5db506,_0x3026cb){var _0x2a67cb=function(_0x3f8ef4){while(--_0x3f8ef4){_0x5db506['push'](_0x5db506['shift']());}};_0x2a67cb(++_0x3026cb);}(_0x54f3,0x120));var _0x354f=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x54f3[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x354f('0x0'));var moment=require(_0x354f('0x1'));var BPromise=require(_0x354f('0x2'));var rs=require(_0x354f('0x3'));var fs=require('fs');var Redis=require(_0x354f('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x354f('0x5'))(_0x354f('0x6'));var config=require(_0x354f('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x354f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51cd16,_0x1da503,_0x4311ad){return new BPromise(function(_0x2f111a,_0x173e1d){return client['request'](_0x51cd16,_0x4311ad)[_0x354f('0x9')](function(_0x5d1e5d){logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,'request\x20sent');logger['debug'](_0x354f('0xc'),_0x1da503,_0x354f('0xd'),JSON['stringify'](_0x5d1e5d));if(_0x5d1e5d[_0x354f('0xe')]){if(_0x5d1e5d[_0x354f('0xe')]['code']===0x1f4){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x173e1d(_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);}logger[_0x354f('0xe')]('Tag,\x20%s,\x20%s',_0x1da503,_0x5d1e5d[_0x354f('0xe')][_0x354f('0xf')]);return _0x2f111a(_0x5d1e5d[_0x354f('0xe')]['message']);}else{logger[_0x354f('0xa')](_0x354f('0xb'),_0x1da503,_0x354f('0xd'));_0x2f111a(_0x5d1e5d['result']['message']);}})[_0x354f('0x10')](function(_0x1d7627){logger[_0x354f('0xe')](_0x354f('0xb'),_0x1da503,_0x1d7627);_0x173e1d(_0x1d7627);});});}
\ No newline at end of file
index b816cc8..568405c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router;
\ No newline at end of file
index 450fa63..20807a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbaf0=['name','exports','STRING'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0xbaf0,0x12a));var _0x0baf=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xbaf0[_0x5ddb1c];return _0x354adc;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}};
\ No newline at end of file
+var _0xd8b0=['exports','sequelize'];(function(_0x57255c,_0x513036){var _0xf58e8e=function(_0x2a6ece){while(--_0x2a6ece){_0x57255c['push'](_0x57255c['shift']());}};_0xf58e8e(++_0x513036);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 9f6f5e1..4adbb62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x31c4=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','autoAssociation','sequelize','transaction','Sequelize','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','destroy','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','UserVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','Queue','order','addQueues','isValidChannel','ValidationError','add','Queues','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Openchannel','Whatsapp','through','penalty','QueueId','User','findOrCreate','findAll','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','format','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','Fax','emit','Queue:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','update','then','error','name','send','index','map','Team','rawAttributes','fieldName','type','model','query'];(function(_0x366fe1,_0x1db8ca){var _0x48ffae=function(_0x5d6d8c){while(--_0x5d6d8c){_0x366fe1['push'](_0x366fe1['shift']());}};_0x48ffae(++_0x1db8ca);}(_0x31c4,0xf9));var _0x431c=function(_0x10bc7f,_0x4ca597){_0x10bc7f=_0x10bc7f-0x0;var _0x1f9726=_0x31c4[_0x10bc7f];return _0x1f9726;};'use strict';var emlformat=require(_0x431c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x431c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x431c('0x2'));var moment=require(_0x431c('0x3'));var BPromise=require(_0x431c('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x431c('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x431c('0x6'));var squel=require('squel');var crypto=require(_0x431c('0x7'));var jsforce=require(_0x431c('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x431c('0x9'));var querystring=require(_0x431c('0xa'));var Papa=require(_0x431c('0xb'));var Redis=require('ioredis');var authService=require(_0x431c('0xc'));var qs=require(_0x431c('0xd'));var as=require(_0x431c('0xe'));var hardwareService=require(_0x431c('0xf'));var logger=require('../../config/logger')(_0x431c('0x10'));var utils=require(_0x431c('0x11'));var config=require(_0x431c('0x12'));var licenseUtil=require(_0x431c('0x13'));var db=require(_0x431c('0x14'))['db'];config[_0x431c('0x15')]=_[_0x431c('0x16')](config[_0x431c('0x15')],{'host':_0x431c('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x431c('0x15')]));require('./team.socket')[_0x431c('0x18')](socket);function respondWithStatusCode(_0x4456a5,_0x49a735){_0x49a735=_0x49a735||0xcc;return function(_0x422453){if(_0x422453){return _0x4456a5[_0x431c('0x19')](_0x49a735);}return _0x4456a5[_0x431c('0x1a')](_0x49a735)[_0x431c('0x1b')]();};}function respondWithResult(_0x422677,_0x34b4ec){_0x34b4ec=_0x34b4ec||0xc8;return function(_0x5e1792){if(_0x5e1792){return _0x422677['status'](_0x34b4ec)[_0x431c('0x1c')](_0x5e1792);}};}function respondWithFilteredResult(_0x1f91f2,_0x369839){return function(_0x2a70e8){if(_0x2a70e8){var _0x573c83=typeof _0x369839[_0x431c('0x1d')]===_0x431c('0x1e')&&typeof _0x369839['limit']===_0x431c('0x1e');var _0x20ec29=_0x2a70e8[_0x431c('0x1f')];var _0x59faad=_0x573c83?0x0:_0x369839['offset'];var _0x4800d4=_0x573c83?_0x2a70e8[_0x431c('0x1f')]:_0x369839[_0x431c('0x1d')]+_0x369839['limit'];var _0x22938b;if(_0x4800d4>=_0x20ec29){_0x4800d4=_0x20ec29;_0x22938b=0xc8;}else{_0x22938b=0xce;}_0x1f91f2[_0x431c('0x1a')](_0x22938b);return _0x1f91f2['set'](_0x431c('0x20'),_0x59faad+'-'+_0x4800d4+'/'+_0x20ec29)['json'](_0x2a70e8);}return null;};}function patchUpdates(_0x40176d){return function(_0x5bb976){try{jsonpatch[_0x431c('0x21')](_0x5bb976,_0x40176d,!![]);}catch(_0x6ce183){return BPromise['reject'](_0x6ce183);}return _0x5bb976['save']();};}function saveUpdates(_0x2bf876,_0x2c1992){return function(_0x78efd0){if(_0x78efd0){return _0x78efd0[_0x431c('0x22')](_0x2bf876)[_0x431c('0x23')](function(_0x12c67){return _0x12c67;});}return null;};}function handleEntityNotFound(_0x184a43,_0x7ab509){return function(_0x5b5b77){if(!_0x5b5b77){_0x184a43[_0x431c('0x19')](0x194);}return _0x5b5b77;};}function handleError(_0x2ff34d,_0x4d22fb){_0x4d22fb=_0x4d22fb||0x1f4;return function(_0x26eb9e){logger[_0x431c('0x24')](_0x26eb9e['stack']);if(_0x26eb9e['name']){delete _0x26eb9e[_0x431c('0x25')];}_0x2ff34d[_0x431c('0x1a')](_0x4d22fb)[_0x431c('0x26')](_0x26eb9e);};}exports[_0x431c('0x27')]=function(_0x230248,_0x18961b){var _0x15e144={},_0x43fb98={},_0x3bc3d2={'count':0x0,'rows':[]};var _0x24e7f8=_[_0x431c('0x28')](db[_0x431c('0x29')][_0x431c('0x2a')],function(_0x360b59){return{'name':_0x360b59[_0x431c('0x2b')],'type':_0x360b59[_0x431c('0x2c')]['key']};});_0x43fb98[_0x431c('0x2d')]=_[_0x431c('0x28')](_0x24e7f8,_0x431c('0x25'));_0x43fb98[_0x431c('0x2e')]=_[_0x431c('0x2f')](_0x230248[_0x431c('0x2e')]);_0x43fb98[_0x431c('0x30')]=_[_0x431c('0x31')](_0x43fb98[_0x431c('0x2d')],_0x43fb98[_0x431c('0x2e')]);_0x15e144[_0x431c('0x32')]=_[_0x431c('0x31')](_0x43fb98[_0x431c('0x2d')],qs[_0x431c('0x33')](_0x230248[_0x431c('0x2e')]['fields']));_0x15e144[_0x431c('0x32')]=_0x15e144[_0x431c('0x32')][_0x431c('0x34')]?_0x15e144[_0x431c('0x32')]:_0x43fb98['model'];if(!_0x230248['query'][_0x431c('0x35')](_0x431c('0x36'))){_0x15e144[_0x431c('0x37')]=qs[_0x431c('0x37')](_0x230248['query'][_0x431c('0x37')]);_0x15e144[_0x431c('0x1d')]=qs[_0x431c('0x1d')](_0x230248[_0x431c('0x2e')][_0x431c('0x1d')]);}_0x15e144['order']=qs[_0x431c('0x38')](_0x230248[_0x431c('0x2e')][_0x431c('0x38')]);_0x15e144['where']=qs[_0x431c('0x30')](_[_0x431c('0x39')](_0x230248['query'],_0x43fb98[_0x431c('0x30')]),_0x24e7f8);if(_0x230248[_0x431c('0x2e')][_0x431c('0x3a')]){_0x15e144[_0x431c('0x3b')]=_[_0x431c('0x3c')](_0x15e144[_0x431c('0x3b')],{'$or':_['map'](_0x24e7f8,function(_0x4b5ae7){if(_0x4b5ae7['type']!=='VIRTUAL'){var _0x3d1acd={};_0x3d1acd[_0x4b5ae7[_0x431c('0x25')]]={'$like':'%'+_0x230248[_0x431c('0x2e')][_0x431c('0x3a')]+'%'};return _0x3d1acd;}})});}_0x15e144=_[_0x431c('0x3c')]({},_0x15e144,_0x230248[_0x431c('0x3d')]);var _0x59f310={'where':_0x15e144['where']};return db[_0x431c('0x29')][_0x431c('0x1f')](_0x59f310)['then'](function(_0x303f77){_0x3bc3d2[_0x431c('0x1f')]=_0x303f77;if(_0x230248[_0x431c('0x2e')][_0x431c('0x3e')]){_0x15e144[_0x431c('0x3f')]=[{'all':!![]}];}return db[_0x431c('0x29')]['findAll'](_0x15e144);})[_0x431c('0x23')](function(_0x246464){_0x3bc3d2['rows']=_0x246464;return _0x3bc3d2;})['then'](respondWithFilteredResult(_0x18961b,_0x15e144))[_0x431c('0x40')](handleError(_0x18961b,null));};exports['show']=function(_0xaea7b7,_0x380d19){var _0x4b66c2={'raw':![],'where':{'id':_0xaea7b7[_0x431c('0x41')]['id']}},_0xfd59ff={};_0xfd59ff[_0x431c('0x2d')]=_['keys'](db['Team']['rawAttributes']);_0xfd59ff[_0x431c('0x2e')]=_['keys'](_0xaea7b7[_0x431c('0x2e')]);_0xfd59ff[_0x431c('0x30')]=_[_0x431c('0x31')](_0xfd59ff[_0x431c('0x2d')],_0xfd59ff[_0x431c('0x2e')]);_0x4b66c2[_0x431c('0x32')]=_[_0x431c('0x31')](_0xfd59ff[_0x431c('0x2d')],qs[_0x431c('0x33')](_0xaea7b7['query']['fields']));_0x4b66c2['attributes']=_0x4b66c2[_0x431c('0x32')][_0x431c('0x34')]?_0x4b66c2[_0x431c('0x32')]:_0xfd59ff[_0x431c('0x2d')];if(_0xaea7b7['query'][_0x431c('0x3e')]){_0x4b66c2[_0x431c('0x3f')]=[{'all':!![]}];}_0x4b66c2=_[_0x431c('0x3c')]({},_0x4b66c2,_0xaea7b7[_0x431c('0x3d')]);return db[_0x431c('0x29')][_0x431c('0x42')](_0x4b66c2)[_0x431c('0x23')](handleEntityNotFound(_0x380d19,null))[_0x431c('0x23')](respondWithResult(_0x380d19,null))[_0x431c('0x40')](handleError(_0x380d19,null));};exports[_0x431c('0x43')]=function(_0x5953d6,_0x2c77be){return db['Team']['create'](_0x5953d6[_0x431c('0x44')],{})[_0x431c('0x23')](function(_0x19016e){var _0x338f12=_0x5953d6[_0x431c('0x45')]['get']({'plain':!![]});if(!_0x338f12)throw new Error(_0x431c('0x46'));if(_0x338f12[_0x431c('0x47')]===_0x431c('0x45')){var _0x4d0887=_0x19016e[_0x431c('0x48')]({'plain':!![]});var _0x5eec00=_0x431c('0x49');return db['UserProfileSection'][_0x431c('0x42')]({'where':{'name':_0x5eec00,'userProfileId':_0x338f12['userProfileId']},'raw':!![]})[_0x431c('0x23')](function(_0x238dd3){if(_0x238dd3&&_0x238dd3[_0x431c('0x4a')]===0x0){return db['UserProfileResource'][_0x431c('0x43')]({'name':_0x4d0887[_0x431c('0x25')],'resourceId':_0x4d0887['id'],'type':_0x238dd3[_0x431c('0x25')],'sectionId':_0x238dd3['id']},{})[_0x431c('0x23')](function(){return _0x19016e;});}else{return _0x19016e;}})[_0x431c('0x40')](function(_0x49cca3){logger[_0x431c('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49cca3);throw _0x49cca3;});}return _0x19016e;})['then'](respondWithResult(_0x2c77be,0xc9))[_0x431c('0x40')](handleError(_0x2c77be,null));};exports[_0x431c('0x22')]=function(_0x59136a,_0x1ac369){if(_0x59136a[_0x431c('0x44')]['id']){delete _0x59136a[_0x431c('0x44')]['id'];}return db[_0x431c('0x29')][_0x431c('0x42')]({'where':{'id':_0x59136a[_0x431c('0x41')]['id']}})[_0x431c('0x23')](handleEntityNotFound(_0x1ac369,null))[_0x431c('0x23')](saveUpdates(_0x59136a['body'],null))[_0x431c('0x23')](respondWithResult(_0x1ac369,null))[_0x431c('0x40')](handleError(_0x1ac369,null));};exports['destroy']=function(_0x468157,_0x3169e1){var _0x1c645c=_0x468157[_0x431c('0x41')]['id'];var _0x508258=[];return db[_0x431c('0x4b')][_0x431c('0x4c')](function(_0x33a9b0){var _0x5d5ebd='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x1c645c;return db[_0x431c('0x4b')][_0x431c('0x2e')](_0x5d5ebd,{'type':db[_0x431c('0x4d')]['QueryTypes'][_0x431c('0x4e')],'raw':!![],'transaction':_0x33a9b0})[_0x431c('0x23')](function(_0x52afbe){_0x508258=_[_0x431c('0x28')](_0x52afbe,function(_0x30b863){return Number(_0x30b863[_0x431c('0x4f')]);});})[_0x431c('0x23')](function(){var _0x588180=_0x431c('0x50')+_0x1c645c;return db[_0x431c('0x4b')][_0x431c('0x2e')](_0x588180,{'type':db['Sequelize'][_0x431c('0x51')][_0x431c('0x4e')],'raw':!![],'transaction':_0x33a9b0});})[_0x431c('0x23')](function(_0x58c04b){var _0x11e200=_[_0x431c('0x28')](_0x58c04b,function(_0x236896){return Number(_0x236896[_0x431c('0x52')]);});return db[_0x431c('0x53')]['destroy']({'where':{'UserId':{'$in':_0x508258},'VoiceQueueId':{'$in':_0x11e200}},'transaction':_0x33a9b0});})['then'](function(){var _0xe31e51=_0x431c('0x54')+_0x1c645c;return db[_0x431c('0x4b')]['query'](_0xe31e51,{'type':db[_0x431c('0x4d')][_0x431c('0x51')]['SELECT'],'raw':!![],'transaction':_0x33a9b0});})[_0x431c('0x23')](function(_0x5ac54e){var _0x19a1b2=_[_0x431c('0x28')](_0x5ac54e,function(_0x503640){return Number(_0x503640['MailQueueId']);});return db[_0x431c('0x55')]['destroy']({'where':{'UserId':{'$in':_0x508258},'MailQueueId':{'$in':_0x19a1b2}},'transaction':_0x33a9b0});})[_0x431c('0x23')](function(){var _0xd6d537=_0x431c('0x56')+_0x1c645c;return db['sequelize'][_0x431c('0x2e')](_0xd6d537,{'type':db[_0x431c('0x4d')][_0x431c('0x51')][_0x431c('0x4e')],'raw':!![],'transaction':_0x33a9b0});})[_0x431c('0x23')](function(_0x3a7161){var _0x30760c=_[_0x431c('0x28')](_0x3a7161,function(_0x9202c8){return Number(_0x9202c8[_0x431c('0x57')]);});return db['UserSmsQueue'][_0x431c('0x58')]({'where':{'UserId':{'$in':_0x508258},'SmsQueueId':{'$in':_0x30760c}},'transaction':_0x33a9b0});})['then'](function(){var _0x263f67=_0x431c('0x59')+_0x1c645c;return db[_0x431c('0x4b')]['query'](_0x263f67,{'type':db[_0x431c('0x4d')][_0x431c('0x51')][_0x431c('0x4e')],'raw':!![],'transaction':_0x33a9b0});})['then'](function(_0x114c5a){var _0x419b4e=_[_0x431c('0x28')](_0x114c5a,function(_0x20d2d4){return Number(_0x20d2d4[_0x431c('0x5a')]);});return db[_0x431c('0x5b')][_0x431c('0x58')]({'where':{'UserId':{'$in':_0x508258},'ChatQueueId':{'$in':_0x419b4e}},'transaction':_0x33a9b0});})[_0x431c('0x23')](function(){var _0x49ea8d=_0x431c('0x5c')+_0x1c645c;return db[_0x431c('0x4b')][_0x431c('0x2e')](_0x49ea8d,{'type':db[_0x431c('0x4d')]['QueryTypes'][_0x431c('0x4e')],'raw':!![],'transaction':_0x33a9b0});})[_0x431c('0x23')](function(_0x5664f7){var _0x771b16=_[_0x431c('0x28')](_0x5664f7,function(_0x391c3e){return Number(_0x391c3e[_0x431c('0x5d')]);});return db['UserFaxQueue'][_0x431c('0x58')]({'where':{'UserId':{'$in':_0x508258},'FaxQueueId':{'$in':_0x771b16}},'transaction':_0x33a9b0});})[_0x431c('0x23')](function(){var _0x519e95='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x1c645c;return db[_0x431c('0x4b')][_0x431c('0x2e')](_0x519e95,{'type':db[_0x431c('0x4d')]['QueryTypes'][_0x431c('0x4e')],'raw':!![],'transaction':_0x33a9b0});})['then'](function(_0xd5ab08){var _0x126251=_[_0x431c('0x28')](_0xd5ab08,function(_0x50a57b){return Number(_0x50a57b[_0x431c('0x5e')]);});return db[_0x431c('0x5f')][_0x431c('0x58')]({'where':{'UserId':{'$in':_0x508258},'OpenchannelQueueId':{'$in':_0x126251}},'transaction':_0x33a9b0});})[_0x431c('0x23')](function(){var _0xcdee3=_0x431c('0x60')+_0x1c645c;return db[_0x431c('0x4b')][_0x431c('0x2e')](_0xcdee3,{'type':db[_0x431c('0x4d')][_0x431c('0x51')][_0x431c('0x4e')],'raw':!![],'transaction':_0x33a9b0});})['then'](function(_0x87f6b0){var _0x2ced10=_[_0x431c('0x28')](_0x87f6b0,function(_0xdededb){return Number(_0xdededb[_0x431c('0x61')]);});return db[_0x431c('0x62')][_0x431c('0x58')]({'where':{'UserId':{'$in':_0x508258},'WhatsappQueueId':{'$in':_0x2ced10}},'transaction':_0x33a9b0});})[_0x431c('0x23')](function(){return db['TeamVoicePrefix'][_0x431c('0x42')]({'where':{'TeamId':_0x1c645c}});})[_0x431c('0x23')](function(_0x2c705c){if(_0x2c705c===null){return;}return db[_0x431c('0x63')][_0x431c('0x58')]({'where':{'UserId':{'$in':_0x508258},'VoicePrefixId':_0x2c705c[_0x431c('0x64')]},'transaction':_0x33a9b0});})[_0x431c('0x23')](function(){return db[_0x431c('0x29')][_0x431c('0x58')]({'where':{'id':_0x1c645c},'cascade':!![],'transaction':_0x33a9b0});})[_0x431c('0x23')](function(_0x520828){if(_0x520828===0x0){_0x3169e1[_0x431c('0x19')](0x194);}else{return db[_0x431c('0x65')][_0x431c('0x58')]({'where':{'type':'Teams','resourceId':_0x1c645c},'cascade':!![],'transaction':_0x33a9b0})[_0x431c('0x23')](function(){_0x3169e1[_0x431c('0x1a')](0xcc)[_0x431c('0x1b')]();});}})[_0x431c('0x40')](function(_0x1ac004){_0x3169e1[_0x431c('0x1a')](0x1f4)[_0x431c('0x26')](_0x1ac004);});});};exports[_0x431c('0x66')]=function(_0x4b920f,_0x5e8a69,_0x42daee){return db[_0x431c('0x29')][_0x431c('0x67')]({'where':{'id':_0x4b920f[_0x431c('0x41')]['id']}})[_0x431c('0x23')](handleEntityNotFound(_0x5e8a69,null))[_0x431c('0x23')](function(_0x416f3f){if(!_0x4b920f[_0x431c('0x2e')][_0x431c('0x68')]||!utils['isValidChannel'](_0x4b920f[_0x431c('0x2e')][_0x431c('0x68')])){throw new db[(_0x431c('0x4d'))]['ValidationError'](_0x431c('0x69'));}var _0x3740ae={};var _0x421236={};_0x421236['model']=_[_0x431c('0x2f')](db[_[_0x431c('0x6a')](_0x4b920f[_0x431c('0x2e')][_0x431c('0x68')][_0x431c('0x6b')]())+_0x431c('0x6c')][_0x431c('0x2a')]);_0x421236[_0x431c('0x2e')]=_['keys'](_0x4b920f[_0x431c('0x2e')]);_0x421236[_0x431c('0x30')]=_[_0x431c('0x31')](_0x421236[_0x431c('0x2d')],_0x421236[_0x431c('0x2e')]);_0x3740ae['attributes']=_[_0x431c('0x31')](_0x421236['model'],qs[_0x431c('0x33')](_0x4b920f[_0x431c('0x2e')][_0x431c('0x33')]));_0x3740ae[_0x431c('0x32')]=_0x3740ae[_0x431c('0x32')][_0x431c('0x34')]?_0x3740ae[_0x431c('0x32')]:_0x421236['model'];_0x3740ae[_0x431c('0x37')]=qs['limit'](_0x4b920f['query']['limit']);_0x3740ae['offset']=qs[_0x431c('0x1d')](_0x4b920f['query'][_0x431c('0x1d')]);_0x3740ae[_0x431c('0x6d')]=qs[_0x431c('0x38')](_0x4b920f[_0x431c('0x2e')][_0x431c('0x38')]);_0x3740ae[_0x431c('0x3b')]=qs[_0x431c('0x30')](_[_0x431c('0x39')](_0x4b920f['query'],_0x421236[_0x431c('0x30')]));_0x3740ae=_['merge']({},_0x3740ae,_0x4b920f[_0x431c('0x3d')]);return _0x416f3f[_0x431c('0x48')+_[_0x431c('0x6a')](_0x4b920f['query'][_0x431c('0x68')][_0x431c('0x6b')]())+'Queues'](_0x3740ae);})[_0x431c('0x23')](respondWithResult(_0x5e8a69,null))[_0x431c('0x40')](handleError(_0x5e8a69,null));};exports[_0x431c('0x6e')]=function(_0x33c0fc,_0x244338,_0x5e4f6a){return db[_0x431c('0x29')][_0x431c('0x67')]({'where':{'id':_0x33c0fc['params']['id']}})[_0x431c('0x23')](function(_0x153005){if(_0x153005){if(!_0x33c0fc[_0x431c('0x44')][_0x431c('0x68')]||!utils[_0x431c('0x6f')](_0x33c0fc[_0x431c('0x44')][_0x431c('0x68')])){throw new db[(_0x431c('0x4d'))][(_0x431c('0x70'))](_0x431c('0x69'));}return _0x153005[_0x431c('0x71')+_[_0x431c('0x6a')](_0x33c0fc[_0x431c('0x44')][_0x431c('0x68')]['toLowerCase']())+_0x431c('0x72')](_0x33c0fc[_0x431c('0x44')][_0x431c('0x73')]);}return null;})[_0x431c('0x23')](handleEntityNotFound(_0x244338,null))[_0x431c('0x23')](respondWithStatusCode(_0x244338,null))[_0x431c('0x40')](handleError(_0x244338,null));};exports[_0x431c('0x74')]=function(_0x56f2f8,_0x4926b1,_0x385ff7){return db[_0x431c('0x29')]['findOne']({'where':{'id':_0x56f2f8[_0x431c('0x41')]['id']}})['then'](function(_0x276ffa){if(_0x276ffa){if(!_0x56f2f8['query']['channel']||!utils[_0x431c('0x6f')](_0x56f2f8[_0x431c('0x2e')][_0x431c('0x68')])){throw new db[(_0x431c('0x4d'))][(_0x431c('0x70'))](_0x431c('0x69'));}return _0x276ffa[_0x431c('0x75')+_[_0x431c('0x6a')](_0x56f2f8[_0x431c('0x2e')][_0x431c('0x68')]['toLowerCase']())+_0x431c('0x72')](_0x56f2f8['query']['ids']);}return null;})['then'](handleEntityNotFound(_0x4926b1,null))['then'](respondWithStatusCode(_0x4926b1,null))[_0x431c('0x40')](handleError(_0x4926b1,null));};exports[_0x431c('0x76')]=function(_0x4fe35e,_0x5e0ba6){var _0x3ffe20=_[_0x431c('0x77')](_0x4fe35e[_0x431c('0x44')][_0x431c('0x73')])?_0x4fe35e[_0x431c('0x44')][_0x431c('0x73')]:[_0x4fe35e[_0x431c('0x44')][_0x431c('0x73')]];var _0x5b4136=_0x4fe35e['params']['id'];return db['Team'][_0x431c('0x42')]({'where':{'id':_0x5b4136}})[_0x431c('0x23')](handleEntityNotFound(_0x5e0ba6,null))[_0x431c('0x23')](function(_0x308815){if(_0x308815){var _0x1c251e=[_0x431c('0x78'),_0x431c('0x79'),_0x431c('0x7a'),_0x431c('0x7b'),'Fax',_0x431c('0x7c'),_0x431c('0x7d')];return db[_0x431c('0x4b')][_0x431c('0x4c')](function(_0xf8e78b){var _0x5d5d0a=_[_0x431c('0x28')](_0x1c251e,function(_0x3a740a){var _0x3f33c2={'attributes':['id','name']};if(_0x3a740a===_0x431c('0x78')){_0x3f33c2[_0x431c('0x7e')]={'attributes':[_0x431c('0x7f')]};}return _0x308815[_0x431c('0x48')+_0x3a740a+_0x431c('0x72')](_0x3f33c2)[_0x431c('0x23')](function(_0xcd1f9){var _0x246ef5=_[_0x431c('0x28')](_0xcd1f9,function(_0x1c589d){var _0xdc0232=_['map'](_0x3ffe20,function(_0x16aa5f){var _0x41da45={'where':{'UserId':_0x16aa5f,[_0x3a740a+_0x431c('0x80')]:_0x1c589d['id']},'transaction':_0xf8e78b};if(_0x3a740a==='Voice'){_0x41da45['defaults']={'penalty':_0x1c589d['TeamVoiceQueue'][_0x431c('0x7f')]};}return db[_0x431c('0x81')+_0x3a740a+_0x431c('0x6c')][_0x431c('0x82')](_0x41da45)[_0x431c('0x23')](function(){socket['emit'](_0x431c('0x45')+_0x3a740a+'Queue:save',{'UserId':_0x16aa5f,[_0x3a740a+_0x431c('0x80')]:_0x1c589d['id']});if(_0x3a740a!==_0x431c('0x78')){return;}return db['User'][_0x431c('0x83')]({'where':{'id':_0x3ffe20,'online':0x1},'attributes':['id','name',_0x431c('0x84'),_0x431c('0x85'),_0x431c('0x86')],'raw':!![]})[_0x431c('0x23')](function(_0x41b4cd){var _0x346faa=_[_0x431c('0x28')](_0x41b4cd,function(_0x278629){return db[_0x431c('0x87')][_0x431c('0x88')]({'membername':_0x278629['name'],'UserId':_0x278629['id'],'queue_name':_0x1c589d['name'],'VoiceQueueId':_0x1c589d['id'],'interface':_[_0x431c('0x89')](_0x278629[_0x431c('0x86')])?util[_0x431c('0x8a')]('SIP/%s',_0x278629[_0x431c('0x25')]):_0x278629[_0x431c('0x86')],'paused':_0x278629['voicePause']||![],'penalty':_0x1c589d[_0x431c('0x8b')][_0x431c('0x7f')]},{'transaction':_0xf8e78b});});return Promise[_0x431c('0x8c')](_0x346faa);});});});return Promise['all'](_0xdc0232);});return Promise[_0x431c('0x8c')](_0x246ef5);})[_0x431c('0x23')](function(){return db[_0x431c('0x8d')][_0x431c('0x67')]({'where':{'teamId':_0x5b4136}})[_0x431c('0x23')](function(_0x198184){if(_0x198184){var _0x4c3990=_[_0x431c('0x28')](_0x3ffe20,function(_0x441455){db['UserVoicePrefix'][_0x431c('0x88')]({'UserId':_0x441455,'VoicePrefixId':_0x198184[_0x431c('0x64')]});});return Promise[_0x431c('0x8c')](_0x4c3990);}});});});return Promise[_0x431c('0x8c')](_0x5d5d0a)[_0x431c('0x23')](function(){return _0x308815[_0x431c('0x76')](_0x3ffe20,{'transaction':_0xf8e78b})[_0x431c('0x8e')](function(_0x2c743a){return _0x2c743a;});});});}})[_0x431c('0x23')](respondWithResult(_0x5e0ba6,null))[_0x431c('0x40')](handleError(_0x5e0ba6,null));};exports[_0x431c('0x8f')]=function(_0xb2df71,_0x4419f4){var _0x51bded=_[_0x431c('0x77')](_0xb2df71[_0x431c('0x2e')][_0x431c('0x73')])?_0xb2df71[_0x431c('0x2e')][_0x431c('0x73')]:[_0xb2df71[_0x431c('0x2e')]['ids']];var _0x3bea39=_0xb2df71[_0x431c('0x41')]['id'];return db['Team'][_0x431c('0x42')]({'where':{'id':_0x3bea39}})[_0x431c('0x23')](handleEntityNotFound(_0x4419f4,null))[_0x431c('0x23')](function(_0x36659e){if(_0x36659e){var _0x4cf90e=[_0x431c('0x78'),'Chat',_0x431c('0x7a'),_0x431c('0x7b'),_0x431c('0x90'),'Openchannel',_0x431c('0x7d')];return db[_0x431c('0x4b')][_0x431c('0x4c')](function(_0xcb81f8){var _0x125d1a=_[_0x431c('0x28')](_0x4cf90e,function(_0x18c439){var _0x352348={'attributes':['id',_0x431c('0x25')]};return _0x36659e[_0x431c('0x48')+_0x18c439+_0x431c('0x72')](_0x352348)[_0x431c('0x23')](function(_0x10a418){var _0x5dc047=_[_0x431c('0x28')](_0x10a418,function(_0x29d94c){return _0x29d94c[_0x431c('0x8f')](_0x51bded,{'transaction':_0xcb81f8})[_0x431c('0x23')](function(){var _0x4bccc9=_[_0x431c('0x28')](_0x51bded,function(_0x51f7ce){socket[_0x431c('0x91')](_0x431c('0x45')+_0x18c439+_0x431c('0x92'),{'UserId':Number(_0x51f7ce),[_0x18c439+'QueueId']:_0x29d94c['id']});if(_0x18c439!=='Voice'){return;}return db['UserVoiceQueueRt'][_0x431c('0x58')]({'where':{'VoiceQueueId':_0x29d94c['id'],'UserId':_0x51f7ce},'transaction':_0xcb81f8});});return Promise['all'](_0x4bccc9);});});return Promise[_0x431c('0x8c')](_0x5dc047);});});return Promise[_0x431c('0x8c')](_0x125d1a)['then'](function(){return _0x36659e[_0x431c('0x8f')](_0x51bded,{'transaction':_0xcb81f8});})['then'](function(){return db[_0x431c('0x8d')][_0x431c('0x67')]({'where':{'teamId':_0x3bea39}})[_0x431c('0x23')](function(_0x14576f){if(_0x14576f){var _0x49f248=_[_0x431c('0x28')](_0x51bded,function(_0x1617bb){db[_0x431c('0x63')][_0x431c('0x58')]({'where':{'UserId':_0x1617bb,'VoicePrefixId':_0x14576f[_0x431c('0x64')]}});});return Promise[_0x431c('0x8c')](_0x49f248);}});});});}})[_0x431c('0x23')](respondWithStatusCode(_0x4419f4,null))[_0x431c('0x40')](handleError(_0x4419f4,null));};exports[_0x431c('0x93')]=function(_0x162422,_0x500d70,_0x2bee01){var _0x58871e={};var _0x171e21={};var _0x2fea90;var _0x5ebe5a;return db[_0x431c('0x29')][_0x431c('0x67')]({'where':{'id':_0x162422['params']['id']}})['then'](handleEntityNotFound(_0x500d70,null))[_0x431c('0x23')](function(_0x27e6df){if(_0x27e6df){_0x2fea90=_0x27e6df;_0x171e21[_0x431c('0x2d')]=_[_0x431c('0x2f')](db[_0x431c('0x81')][_0x431c('0x2a')]);_0x171e21[_0x431c('0x2e')]=_['keys'](_0x162422[_0x431c('0x2e')]);_0x171e21[_0x431c('0x30')]=_[_0x431c('0x31')](_0x171e21[_0x431c('0x2d')],_0x171e21['query']);_0x58871e[_0x431c('0x32')]=_[_0x431c('0x31')](_0x171e21[_0x431c('0x2d')],qs[_0x431c('0x33')](_0x162422['query']['fields']));_0x58871e[_0x431c('0x32')]=_0x58871e[_0x431c('0x32')][_0x431c('0x34')]?_0x58871e[_0x431c('0x32')]:_0x171e21[_0x431c('0x2d')];_0x58871e['order']=qs[_0x431c('0x38')](_0x162422[_0x431c('0x2e')]['sort']);_0x58871e[_0x431c('0x3b')]=qs[_0x431c('0x30')](_[_0x431c('0x39')](_0x162422[_0x431c('0x2e')],_0x171e21[_0x431c('0x30')]));if(_0x162422[_0x431c('0x2e')]['filter']){_0x58871e[_0x431c('0x3b')]=_['merge'](_0x58871e[_0x431c('0x3b')],{'$or':_[_0x431c('0x28')](_0x58871e[_0x431c('0x32')],function(_0x1a8498){var _0x2cf99f={};_0x2cf99f[_0x1a8498]={'$like':'%'+_0x162422[_0x431c('0x2e')][_0x431c('0x3a')]+'%'};return _0x2cf99f;})});}_0x58871e=_[_0x431c('0x3c')]({},_0x58871e,_0x162422[_0x431c('0x3d')]);return _0x2fea90[_0x431c('0x93')](_0x58871e);}})[_0x431c('0x23')](function(_0x11024e){if(_0x11024e){_0x5ebe5a=_0x11024e[_0x431c('0x34')];if(!_0x162422['query'][_0x431c('0x35')](_0x431c('0x36'))){_0x58871e[_0x431c('0x37')]=qs['limit'](_0x162422[_0x431c('0x2e')][_0x431c('0x37')]);_0x58871e[_0x431c('0x1d')]=qs['offset'](_0x162422[_0x431c('0x2e')][_0x431c('0x1d')]);}return _0x2fea90['getAgents'](_0x58871e);}})[_0x431c('0x23')](function(_0x56779f){if(_0x56779f){return _0x56779f?{'count':_0x5ebe5a,'rows':_0x56779f}:null;}})[_0x431c('0x23')](respondWithResult(_0x500d70,null))[_0x431c('0x40')](handleError(_0x500d70,null));};
\ No newline at end of file
+var _0x1450=['interface','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','Queue:remove','getAgents','nolimit','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','status','end','json','offset','limit','count','set','reject','save','update','then','error','stack','name','send','map','Team','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','show','rawAttributes','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','sequelize','transaction','Sequelize','QueryTypes','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','destroy','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues','addQueues','isValidChannel','add','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','TeamVoiceQueue','User','Queue','findOrCreate','QueueId','online','voicePause'];(function(_0x5f03ed,_0x3cde1a){var _0x2a8eb3=function(_0x3026e9){while(--_0x3026e9){_0x5f03ed['push'](_0x5f03ed['shift']());}};_0x2a8eb3(++_0x3cde1a);}(_0x1450,0x1df));var _0x0145=function(_0x2a40f4,_0x3383bf){_0x2a40f4=_0x2a40f4-0x0;var _0x203c70=_0x1450[_0x2a40f4];return _0x203c70;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0145('0x0'));var zipdir=require(_0x0145('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0145('0x2'));var moment=require(_0x0145('0x3'));var BPromise=require(_0x0145('0x4'));var Mustache=require('mustache');var util=require(_0x0145('0x5'));var path=require(_0x0145('0x6'));var sox=require(_0x0145('0x7'));var csv=require(_0x0145('0x8'));var ejs=require(_0x0145('0x9'));var fs=require('fs');var fs_extra=require(_0x0145('0xa'));var _=require(_0x0145('0xb'));var squel=require(_0x0145('0xc'));var crypto=require('crypto');var jsforce=require(_0x0145('0xd'));var deskjs=require(_0x0145('0xe'));var toCsv=require(_0x0145('0x8'));var querystring=require(_0x0145('0xf'));var Papa=require(_0x0145('0x10'));var Redis=require('ioredis');var authService=require(_0x0145('0x11'));var qs=require(_0x0145('0x12'));var as=require(_0x0145('0x13'));var hardwareService=require(_0x0145('0x14'));var logger=require(_0x0145('0x15'))(_0x0145('0x16'));var utils=require(_0x0145('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0145('0x18'))['db'];config[_0x0145('0x19')]=_[_0x0145('0x1a')](config['redis'],{'host':_0x0145('0x1b'),'port':0x18eb});var socket=require(_0x0145('0x1c'))(new Redis(config[_0x0145('0x19')]));require(_0x0145('0x1d'))[_0x0145('0x1e')](socket);function respondWithStatusCode(_0x1bfec7,_0x2e0b41){_0x2e0b41=_0x2e0b41||0xcc;return function(_0x2fa37b){if(_0x2fa37b){return _0x1bfec7['sendStatus'](_0x2e0b41);}return _0x1bfec7[_0x0145('0x1f')](_0x2e0b41)[_0x0145('0x20')]();};}function respondWithResult(_0x570457,_0x5836c0){_0x5836c0=_0x5836c0||0xc8;return function(_0x36ed69){if(_0x36ed69){return _0x570457[_0x0145('0x1f')](_0x5836c0)[_0x0145('0x21')](_0x36ed69);}};}function respondWithFilteredResult(_0x2095cb,_0x34b2f5){return function(_0x58fda1){if(_0x58fda1){var _0x31c663=typeof _0x34b2f5[_0x0145('0x22')]==='undefined'&&typeof _0x34b2f5[_0x0145('0x23')]==='undefined';var _0x2d7160=_0x58fda1[_0x0145('0x24')];var _0x1318d7=_0x31c663?0x0:_0x34b2f5[_0x0145('0x22')];var _0x21d5e6=_0x31c663?_0x58fda1['count']:_0x34b2f5[_0x0145('0x22')]+_0x34b2f5[_0x0145('0x23')];var _0x3072f3;if(_0x21d5e6>=_0x2d7160){_0x21d5e6=_0x2d7160;_0x3072f3=0xc8;}else{_0x3072f3=0xce;}_0x2095cb[_0x0145('0x1f')](_0x3072f3);return _0x2095cb[_0x0145('0x25')]('Content-Range',_0x1318d7+'-'+_0x21d5e6+'/'+_0x2d7160)[_0x0145('0x21')](_0x58fda1);}return null;};}function patchUpdates(_0x1f5640){return function(_0x3f6699){try{jsonpatch['apply'](_0x3f6699,_0x1f5640,!![]);}catch(_0x3d3ba9){return BPromise[_0x0145('0x26')](_0x3d3ba9);}return _0x3f6699[_0x0145('0x27')]();};}function saveUpdates(_0x45ac0c,_0xc0ec39){return function(_0x4bdc97){if(_0x4bdc97){return _0x4bdc97[_0x0145('0x28')](_0x45ac0c)[_0x0145('0x29')](function(_0xbf16dd){return _0xbf16dd;});}return null;};}function handleEntityNotFound(_0x51f07f,_0xfb36fa){return function(_0x105237){if(!_0x105237){_0x51f07f['sendStatus'](0x194);}return _0x105237;};}function handleError(_0x50b507,_0x17cd16){_0x17cd16=_0x17cd16||0x1f4;return function(_0x1f52d7){logger[_0x0145('0x2a')](_0x1f52d7[_0x0145('0x2b')]);if(_0x1f52d7[_0x0145('0x2c')]){delete _0x1f52d7[_0x0145('0x2c')];}_0x50b507['status'](_0x17cd16)[_0x0145('0x2d')](_0x1f52d7);};}exports['index']=function(_0x5425ba,_0x59f6c4){var _0x41280a={},_0x29ba47={},_0x4903e5={'count':0x0,'rows':[]};var _0x324435=_[_0x0145('0x2e')](db[_0x0145('0x2f')]['rawAttributes'],function(_0xaf1fe){return{'name':_0xaf1fe[_0x0145('0x30')],'type':_0xaf1fe[_0x0145('0x31')][_0x0145('0x32')]};});_0x29ba47[_0x0145('0x33')]=_[_0x0145('0x2e')](_0x324435,'name');_0x29ba47[_0x0145('0x34')]=_[_0x0145('0x35')](_0x5425ba[_0x0145('0x34')]);_0x29ba47[_0x0145('0x36')]=_[_0x0145('0x37')](_0x29ba47[_0x0145('0x33')],_0x29ba47[_0x0145('0x34')]);_0x41280a[_0x0145('0x38')]=_[_0x0145('0x37')](_0x29ba47[_0x0145('0x33')],qs['fields'](_0x5425ba[_0x0145('0x34')][_0x0145('0x39')]));_0x41280a[_0x0145('0x38')]=_0x41280a[_0x0145('0x38')][_0x0145('0x3a')]?_0x41280a[_0x0145('0x38')]:_0x29ba47[_0x0145('0x33')];if(!_0x5425ba[_0x0145('0x34')][_0x0145('0x3b')]('nolimit')){_0x41280a[_0x0145('0x23')]=qs[_0x0145('0x23')](_0x5425ba[_0x0145('0x34')][_0x0145('0x23')]);_0x41280a[_0x0145('0x22')]=qs[_0x0145('0x22')](_0x5425ba['query'][_0x0145('0x22')]);}_0x41280a[_0x0145('0x3c')]=qs[_0x0145('0x3d')](_0x5425ba[_0x0145('0x34')]['sort']);_0x41280a[_0x0145('0x3e')]=qs[_0x0145('0x36')](_[_0x0145('0x3f')](_0x5425ba[_0x0145('0x34')],_0x29ba47[_0x0145('0x36')]),_0x324435);if(_0x5425ba['query'][_0x0145('0x40')]){_0x41280a[_0x0145('0x3e')]=_[_0x0145('0x41')](_0x41280a['where'],{'$or':_[_0x0145('0x2e')](_0x324435,function(_0x1190ab){if(_0x1190ab[_0x0145('0x31')]!=='VIRTUAL'){var _0x42c847={};_0x42c847[_0x1190ab[_0x0145('0x2c')]]={'$like':'%'+_0x5425ba[_0x0145('0x34')][_0x0145('0x40')]+'%'};return _0x42c847;}})});}_0x41280a=_[_0x0145('0x41')]({},_0x41280a,_0x5425ba[_0x0145('0x42')]);var _0x389b75={'where':_0x41280a[_0x0145('0x3e')]};return db['Team'][_0x0145('0x24')](_0x389b75)[_0x0145('0x29')](function(_0x2b7fd8){_0x4903e5[_0x0145('0x24')]=_0x2b7fd8;if(_0x5425ba[_0x0145('0x34')][_0x0145('0x43')]){_0x41280a[_0x0145('0x44')]=[{'all':!![]}];}return db[_0x0145('0x2f')][_0x0145('0x45')](_0x41280a);})[_0x0145('0x29')](function(_0x1ffc05){_0x4903e5['rows']=_0x1ffc05;return _0x4903e5;})[_0x0145('0x29')](respondWithFilteredResult(_0x59f6c4,_0x41280a))['catch'](handleError(_0x59f6c4,null));};exports[_0x0145('0x46')]=function(_0x165220,_0x4bd57f){var _0x916057={'raw':![],'where':{'id':_0x165220['params']['id']}},_0x26f45a={};_0x26f45a[_0x0145('0x33')]=_[_0x0145('0x35')](db[_0x0145('0x2f')][_0x0145('0x47')]);_0x26f45a[_0x0145('0x34')]=_[_0x0145('0x35')](_0x165220[_0x0145('0x34')]);_0x26f45a[_0x0145('0x36')]=_[_0x0145('0x37')](_0x26f45a[_0x0145('0x33')],_0x26f45a[_0x0145('0x34')]);_0x916057[_0x0145('0x38')]=_['intersection'](_0x26f45a[_0x0145('0x33')],qs[_0x0145('0x39')](_0x165220[_0x0145('0x34')][_0x0145('0x39')]));_0x916057[_0x0145('0x38')]=_0x916057[_0x0145('0x38')][_0x0145('0x3a')]?_0x916057[_0x0145('0x38')]:_0x26f45a['model'];if(_0x165220[_0x0145('0x34')][_0x0145('0x43')]){_0x916057[_0x0145('0x44')]=[{'all':!![]}];}_0x916057=_[_0x0145('0x41')]({},_0x916057,_0x165220['options']);return db[_0x0145('0x2f')][_0x0145('0x48')](_0x916057)[_0x0145('0x29')](handleEntityNotFound(_0x4bd57f,null))[_0x0145('0x29')](respondWithResult(_0x4bd57f,null))[_0x0145('0x49')](handleError(_0x4bd57f,null));};exports[_0x0145('0x4a')]=function(_0x44816a,_0x5e8a39){return db[_0x0145('0x2f')][_0x0145('0x4a')](_0x44816a[_0x0145('0x4b')],{})[_0x0145('0x29')](function(_0x308f3f){var _0x39f4bd=_0x44816a[_0x0145('0x4c')][_0x0145('0x4d')]({'plain':!![]});if(!_0x39f4bd)throw new Error(_0x0145('0x4e'));if(_0x39f4bd[_0x0145('0x4f')]===_0x0145('0x4c')){var _0x588340=_0x308f3f[_0x0145('0x4d')]({'plain':!![]});var _0xd1eb53='Teams';return db[_0x0145('0x50')]['find']({'where':{'name':_0xd1eb53,'userProfileId':_0x39f4bd['userProfileId']},'raw':!![]})[_0x0145('0x29')](function(_0x317185){if(_0x317185&&_0x317185[_0x0145('0x51')]===0x0){return db[_0x0145('0x52')][_0x0145('0x4a')]({'name':_0x588340[_0x0145('0x2c')],'resourceId':_0x588340['id'],'type':_0x317185[_0x0145('0x2c')],'sectionId':_0x317185['id']},{})[_0x0145('0x29')](function(){return _0x308f3f;});}else{return _0x308f3f;}})[_0x0145('0x49')](function(_0x4a90fd){logger[_0x0145('0x2a')](_0x0145('0x53'),_0x4a90fd);throw _0x4a90fd;});}return _0x308f3f;})['then'](respondWithResult(_0x5e8a39,0xc9))['catch'](handleError(_0x5e8a39,null));};exports[_0x0145('0x28')]=function(_0xe757b6,_0x35b47b){if(_0xe757b6[_0x0145('0x4b')]['id']){delete _0xe757b6[_0x0145('0x4b')]['id'];}return db['Team'][_0x0145('0x48')]({'where':{'id':_0xe757b6[_0x0145('0x54')]['id']}})[_0x0145('0x29')](handleEntityNotFound(_0x35b47b,null))['then'](saveUpdates(_0xe757b6[_0x0145('0x4b')],null))[_0x0145('0x29')](respondWithResult(_0x35b47b,null))['catch'](handleError(_0x35b47b,null));};exports['destroy']=function(_0x228a24,_0x2c2719){var _0x5e23bb=_0x228a24[_0x0145('0x54')]['id'];var _0x216d3d=[];return db[_0x0145('0x55')][_0x0145('0x56')](function(_0x449e27){var _0x491f20='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x5e23bb;return db[_0x0145('0x55')][_0x0145('0x34')](_0x491f20,{'type':db[_0x0145('0x57')][_0x0145('0x58')]['SELECT'],'raw':!![],'transaction':_0x449e27})['then'](function(_0x5bb073){_0x216d3d=_[_0x0145('0x2e')](_0x5bb073,function(_0x58eb35){return Number(_0x58eb35[_0x0145('0x59')]);});})[_0x0145('0x29')](function(){var _0x30dc53=_0x0145('0x5a')+_0x5e23bb;return db['sequelize']['query'](_0x30dc53,{'type':db[_0x0145('0x57')][_0x0145('0x58')][_0x0145('0x5b')],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x493573){var _0x32ecdb=_[_0x0145('0x2e')](_0x493573,function(_0x4fb2de){return Number(_0x4fb2de[_0x0145('0x5c')]);});return db[_0x0145('0x5d')]['destroy']({'where':{'UserId':{'$in':_0x216d3d},'VoiceQueueId':{'$in':_0x32ecdb}},'transaction':_0x449e27});})['then'](function(){var _0x34d1fb=_0x0145('0x5e')+_0x5e23bb;return db[_0x0145('0x55')][_0x0145('0x34')](_0x34d1fb,{'type':db[_0x0145('0x57')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x449e27});})['then'](function(_0xe46cde){var _0x2cb7d1=_[_0x0145('0x2e')](_0xe46cde,function(_0x2a04ea){return Number(_0x2a04ea[_0x0145('0x5f')]);});return db[_0x0145('0x60')][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'MailQueueId':{'$in':_0x2cb7d1}},'transaction':_0x449e27});})[_0x0145('0x29')](function(){var _0x200cc9=_0x0145('0x62')+_0x5e23bb;return db['sequelize']['query'](_0x200cc9,{'type':db[_0x0145('0x57')][_0x0145('0x58')]['SELECT'],'raw':!![],'transaction':_0x449e27});})['then'](function(_0x58f7d8){var _0x32cc9c=_['map'](_0x58f7d8,function(_0x399d73){return Number(_0x399d73['SmsQueueId']);});return db['UserSmsQueue'][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'SmsQueueId':{'$in':_0x32cc9c}},'transaction':_0x449e27});})['then'](function(){var _0x1e7543=_0x0145('0x63')+_0x5e23bb;return db['sequelize'][_0x0145('0x34')](_0x1e7543,{'type':db[_0x0145('0x57')]['QueryTypes'][_0x0145('0x5b')],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x2c67a0){var _0x423778=_['map'](_0x2c67a0,function(_0x580e88){return Number(_0x580e88['ChatQueueId']);});return db['UserChatQueue'][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'ChatQueueId':{'$in':_0x423778}},'transaction':_0x449e27});})[_0x0145('0x29')](function(){var _0x3825e3=_0x0145('0x64')+_0x5e23bb;return db[_0x0145('0x55')]['query'](_0x3825e3,{'type':db[_0x0145('0x57')][_0x0145('0x58')][_0x0145('0x5b')],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x4d8c92){var _0x20508e=_[_0x0145('0x2e')](_0x4d8c92,function(_0x30da67){return Number(_0x30da67[_0x0145('0x65')]);});return db[_0x0145('0x66')]['destroy']({'where':{'UserId':{'$in':_0x216d3d},'FaxQueueId':{'$in':_0x20508e}},'transaction':_0x449e27});})[_0x0145('0x29')](function(){var _0x18c1df=_0x0145('0x67')+_0x5e23bb;return db['sequelize'][_0x0145('0x34')](_0x18c1df,{'type':db[_0x0145('0x57')]['QueryTypes'][_0x0145('0x5b')],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x43b9c3){var _0x58097d=_[_0x0145('0x2e')](_0x43b9c3,function(_0x56fd73){return Number(_0x56fd73[_0x0145('0x68')]);});return db['UserOpenchannelQueue'][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'OpenchannelQueueId':{'$in':_0x58097d}},'transaction':_0x449e27});})['then'](function(){var _0x22edf8=_0x0145('0x69')+_0x5e23bb;return db[_0x0145('0x55')][_0x0145('0x34')](_0x22edf8,{'type':db[_0x0145('0x57')][_0x0145('0x58')]['SELECT'],'raw':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x4eb02b){var _0x5577c8=_[_0x0145('0x2e')](_0x4eb02b,function(_0xc40e41){return Number(_0xc40e41[_0x0145('0x6a')]);});return db[_0x0145('0x6b')][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'WhatsappQueueId':{'$in':_0x5577c8}},'transaction':_0x449e27});})[_0x0145('0x29')](function(){return db[_0x0145('0x6c')][_0x0145('0x48')]({'where':{'TeamId':_0x5e23bb}});})[_0x0145('0x29')](function(_0x3fb732){if(_0x3fb732===null){return;}return db['UserVoicePrefix'][_0x0145('0x61')]({'where':{'UserId':{'$in':_0x216d3d},'VoicePrefixId':_0x3fb732[_0x0145('0x6d')]},'transaction':_0x449e27});})[_0x0145('0x29')](function(){return db[_0x0145('0x2f')][_0x0145('0x61')]({'where':{'id':_0x5e23bb},'cascade':!![],'transaction':_0x449e27});})[_0x0145('0x29')](function(_0x5e43b8){if(_0x5e43b8===0x0){_0x2c2719['sendStatus'](0x194);}else{return db[_0x0145('0x52')]['destroy']({'where':{'type':'Teams','resourceId':_0x5e23bb},'cascade':!![],'transaction':_0x449e27})['then'](function(){_0x2c2719['status'](0xcc)[_0x0145('0x20')]();});}})[_0x0145('0x49')](function(_0x11aa5a){_0x2c2719['status'](0x1f4)[_0x0145('0x2d')](_0x11aa5a);});});};exports[_0x0145('0x6e')]=function(_0x12c796,_0x371d17,_0x283b69){return db[_0x0145('0x2f')][_0x0145('0x6f')]({'where':{'id':_0x12c796['params']['id']}})[_0x0145('0x29')](handleEntityNotFound(_0x371d17,null))[_0x0145('0x29')](function(_0x270261){if(!_0x12c796[_0x0145('0x34')][_0x0145('0x70')]||!utils['isValidChannel'](_0x12c796['query']['channel'])){throw new db[(_0x0145('0x57'))][(_0x0145('0x71'))](_0x0145('0x72'));}var _0x2b95b1={};var _0x32175e={};_0x32175e[_0x0145('0x33')]=_['keys'](db[_[_0x0145('0x73')](_0x12c796['query'][_0x0145('0x70')][_0x0145('0x74')]())+'Queue'][_0x0145('0x47')]);_0x32175e[_0x0145('0x34')]=_['keys'](_0x12c796[_0x0145('0x34')]);_0x32175e['filters']=_[_0x0145('0x37')](_0x32175e[_0x0145('0x33')],_0x32175e[_0x0145('0x34')]);_0x2b95b1['attributes']=_[_0x0145('0x37')](_0x32175e[_0x0145('0x33')],qs['fields'](_0x12c796[_0x0145('0x34')][_0x0145('0x39')]));_0x2b95b1['attributes']=_0x2b95b1[_0x0145('0x38')][_0x0145('0x3a')]?_0x2b95b1['attributes']:_0x32175e[_0x0145('0x33')];_0x2b95b1[_0x0145('0x23')]=qs['limit'](_0x12c796[_0x0145('0x34')][_0x0145('0x23')]);_0x2b95b1[_0x0145('0x22')]=qs['offset'](_0x12c796[_0x0145('0x34')]['offset']);_0x2b95b1['order']=qs['sort'](_0x12c796[_0x0145('0x34')][_0x0145('0x3d')]);_0x2b95b1[_0x0145('0x3e')]=qs['filters'](_[_0x0145('0x3f')](_0x12c796[_0x0145('0x34')],_0x32175e[_0x0145('0x36')]));_0x2b95b1=_[_0x0145('0x41')]({},_0x2b95b1,_0x12c796[_0x0145('0x42')]);return _0x270261['get'+_[_0x0145('0x73')](_0x12c796[_0x0145('0x34')][_0x0145('0x70')][_0x0145('0x74')]())+_0x0145('0x75')](_0x2b95b1);})[_0x0145('0x29')](respondWithResult(_0x371d17,null))[_0x0145('0x49')](handleError(_0x371d17,null));};exports[_0x0145('0x76')]=function(_0x2aacb7,_0xd91655,_0xc8423){return db[_0x0145('0x2f')]['findOne']({'where':{'id':_0x2aacb7['params']['id']}})['then'](function(_0x54a275){if(_0x54a275){if(!_0x2aacb7[_0x0145('0x4b')][_0x0145('0x70')]||!utils[_0x0145('0x77')](_0x2aacb7['body'][_0x0145('0x70')])){throw new db['Sequelize'][(_0x0145('0x71'))](_0x0145('0x72'));}return _0x54a275[_0x0145('0x78')+_[_0x0145('0x73')](_0x2aacb7[_0x0145('0x4b')]['channel'][_0x0145('0x74')]())+_0x0145('0x75')](_0x2aacb7[_0x0145('0x4b')][_0x0145('0x79')]);}return null;})[_0x0145('0x29')](handleEntityNotFound(_0xd91655,null))['then'](respondWithStatusCode(_0xd91655,null))['catch'](handleError(_0xd91655,null));};exports[_0x0145('0x7a')]=function(_0x4a6589,_0x130277,_0x3fc7d6){return db[_0x0145('0x2f')][_0x0145('0x6f')]({'where':{'id':_0x4a6589[_0x0145('0x54')]['id']}})[_0x0145('0x29')](function(_0x41fffb){if(_0x41fffb){if(!_0x4a6589[_0x0145('0x34')][_0x0145('0x70')]||!utils[_0x0145('0x77')](_0x4a6589[_0x0145('0x34')][_0x0145('0x70')])){throw new db['Sequelize']['ValidationError'](_0x0145('0x72'));}return _0x41fffb[_0x0145('0x7b')+_[_0x0145('0x73')](_0x4a6589[_0x0145('0x34')][_0x0145('0x70')][_0x0145('0x74')]())+_0x0145('0x75')](_0x4a6589[_0x0145('0x34')][_0x0145('0x79')]);}return null;})[_0x0145('0x29')](handleEntityNotFound(_0x130277,null))[_0x0145('0x29')](respondWithStatusCode(_0x130277,null))[_0x0145('0x49')](handleError(_0x130277,null));};exports['addAgents']=function(_0x2cb16b,_0x247dca){var _0x144518=_[_0x0145('0x7c')](_0x2cb16b[_0x0145('0x4b')][_0x0145('0x79')])?_0x2cb16b['body']['ids']:[_0x2cb16b[_0x0145('0x4b')][_0x0145('0x79')]];var _0x48bfb3=_0x2cb16b[_0x0145('0x54')]['id'];return db['Team'][_0x0145('0x48')]({'where':{'id':_0x48bfb3}})[_0x0145('0x29')](handleEntityNotFound(_0x247dca,null))[_0x0145('0x29')](function(_0x2b06b2){if(_0x2b06b2){var _0x4923fa=[_0x0145('0x7d'),_0x0145('0x7e'),_0x0145('0x7f'),_0x0145('0x80'),_0x0145('0x81'),_0x0145('0x82'),_0x0145('0x83')];return db[_0x0145('0x55')][_0x0145('0x56')](function(_0x5c10f3){var _0x2705a3=_['map'](_0x4923fa,function(_0x79c841){var _0x2f6f22={'attributes':['id','name']};if(_0x79c841==='Voice'){_0x2f6f22[_0x0145('0x84')]={'attributes':[_0x0145('0x85')]};}return _0x2b06b2[_0x0145('0x4d')+_0x79c841+_0x0145('0x75')](_0x2f6f22)[_0x0145('0x29')](function(_0x4d94c0){var _0x3890c0=_[_0x0145('0x2e')](_0x4d94c0,function(_0x5b1eb9){var _0x5552c6=_[_0x0145('0x2e')](_0x144518,function(_0x849508){var _0x25e6c7={'where':{'UserId':_0x849508,[_0x79c841+'QueueId']:_0x5b1eb9['id']},'transaction':_0x5c10f3};if(_0x79c841==='Voice'){_0x25e6c7['defaults']={'penalty':_0x5b1eb9[_0x0145('0x86')][_0x0145('0x85')]};}return db[_0x0145('0x87')+_0x79c841+_0x0145('0x88')][_0x0145('0x89')](_0x25e6c7)[_0x0145('0x29')](function(){socket['emit']('user'+_0x79c841+'Queue:save',{'UserId':_0x849508,[_0x79c841+_0x0145('0x8a')]:_0x5b1eb9['id']});if(_0x79c841!=='Voice'){return;}return db[_0x0145('0x87')][_0x0145('0x45')]({'where':{'id':_0x144518,'online':0x1},'attributes':['id',_0x0145('0x2c'),_0x0145('0x8b'),_0x0145('0x8c'),_0x0145('0x8d')],'raw':!![]})[_0x0145('0x29')](function(_0x426279){var _0x1bfc29=_[_0x0145('0x2e')](_0x426279,function(_0xbf3b79){return db[_0x0145('0x8e')][_0x0145('0x8f')]({'membername':_0xbf3b79[_0x0145('0x2c')],'UserId':_0xbf3b79['id'],'queue_name':_0x5b1eb9[_0x0145('0x2c')],'VoiceQueueId':_0x5b1eb9['id'],'interface':_[_0x0145('0x90')](_0xbf3b79['interface'])?util[_0x0145('0x91')](_0x0145('0x92'),_0xbf3b79['name']):_0xbf3b79[_0x0145('0x8d')],'paused':_0xbf3b79[_0x0145('0x8c')]||![],'penalty':_0x5b1eb9[_0x0145('0x86')][_0x0145('0x85')]},{'transaction':_0x5c10f3});});return Promise['all'](_0x1bfc29);});});});return Promise[_0x0145('0x93')](_0x5552c6);});return Promise['all'](_0x3890c0);})[_0x0145('0x29')](function(){return db[_0x0145('0x6c')][_0x0145('0x6f')]({'where':{'teamId':_0x48bfb3}})['then'](function(_0x428d16){if(_0x428d16){var _0x3c6f04=_['map'](_0x144518,function(_0x50d79a){db[_0x0145('0x94')][_0x0145('0x8f')]({'UserId':_0x50d79a,'VoicePrefixId':_0x428d16[_0x0145('0x6d')]});});return Promise[_0x0145('0x93')](_0x3c6f04);}});});});return Promise[_0x0145('0x93')](_0x2705a3)[_0x0145('0x29')](function(){return _0x2b06b2[_0x0145('0x95')](_0x144518,{'transaction':_0x5c10f3})[_0x0145('0x96')](function(_0x45c27b){return _0x45c27b;});});});}})[_0x0145('0x29')](respondWithResult(_0x247dca,null))[_0x0145('0x49')](handleError(_0x247dca,null));};exports['removeAgents']=function(_0x563072,_0xe3640a){var _0x50454b=_[_0x0145('0x7c')](_0x563072[_0x0145('0x34')][_0x0145('0x79')])?_0x563072[_0x0145('0x34')][_0x0145('0x79')]:[_0x563072[_0x0145('0x34')][_0x0145('0x79')]];var _0xfbb792=_0x563072['params']['id'];return db[_0x0145('0x2f')]['find']({'where':{'id':_0xfbb792}})[_0x0145('0x29')](handleEntityNotFound(_0xe3640a,null))[_0x0145('0x29')](function(_0x12b62c){if(_0x12b62c){var _0x21941b=[_0x0145('0x7d'),_0x0145('0x7e'),_0x0145('0x7f'),'Sms',_0x0145('0x81'),_0x0145('0x82'),_0x0145('0x83')];return db['sequelize']['transaction'](function(_0x32d166){var _0x429561=_[_0x0145('0x2e')](_0x21941b,function(_0x2789d2){var _0x3af2d1={'attributes':['id','name']};return _0x12b62c[_0x0145('0x4d')+_0x2789d2+_0x0145('0x75')](_0x3af2d1)[_0x0145('0x29')](function(_0x1b0658){var _0xa1214f=_['map'](_0x1b0658,function(_0x3afd01){return _0x3afd01[_0x0145('0x97')](_0x50454b,{'transaction':_0x32d166})[_0x0145('0x29')](function(){var _0x9ef705=_[_0x0145('0x2e')](_0x50454b,function(_0x4537f5){socket['emit'](_0x0145('0x4c')+_0x2789d2+_0x0145('0x98'),{'UserId':Number(_0x4537f5),[_0x2789d2+_0x0145('0x8a')]:_0x3afd01['id']});if(_0x2789d2!=='Voice'){return;}return db[_0x0145('0x8e')][_0x0145('0x61')]({'where':{'VoiceQueueId':_0x3afd01['id'],'UserId':_0x4537f5},'transaction':_0x32d166});});return Promise[_0x0145('0x93')](_0x9ef705);});});return Promise[_0x0145('0x93')](_0xa1214f);});});return Promise['all'](_0x429561)['then'](function(){return _0x12b62c[_0x0145('0x97')](_0x50454b,{'transaction':_0x32d166});})[_0x0145('0x29')](function(){return db[_0x0145('0x6c')]['findOne']({'where':{'teamId':_0xfbb792}})[_0x0145('0x29')](function(_0xf1bb80){if(_0xf1bb80){var _0x3ca29a=_[_0x0145('0x2e')](_0x50454b,function(_0x473df1){db[_0x0145('0x94')]['destroy']({'where':{'UserId':_0x473df1,'VoicePrefixId':_0xf1bb80[_0x0145('0x6d')]}});});return Promise[_0x0145('0x93')](_0x3ca29a);}});});});}})['then'](respondWithStatusCode(_0xe3640a,null))[_0x0145('0x49')](handleError(_0xe3640a,null));};exports[_0x0145('0x99')]=function(_0x5d3375,_0x531373,_0x3d895b){var _0x5b552b={};var _0x14b8c5={};var _0x1fd98a;var _0x3638d0;return db[_0x0145('0x2f')]['findOne']({'where':{'id':_0x5d3375[_0x0145('0x54')]['id']}})[_0x0145('0x29')](handleEntityNotFound(_0x531373,null))[_0x0145('0x29')](function(_0x4d49ac){if(_0x4d49ac){_0x1fd98a=_0x4d49ac;_0x14b8c5['model']=_[_0x0145('0x35')](db[_0x0145('0x87')][_0x0145('0x47')]);_0x14b8c5[_0x0145('0x34')]=_[_0x0145('0x35')](_0x5d3375[_0x0145('0x34')]);_0x14b8c5[_0x0145('0x36')]=_['intersection'](_0x14b8c5[_0x0145('0x33')],_0x14b8c5[_0x0145('0x34')]);_0x5b552b[_0x0145('0x38')]=_['intersection'](_0x14b8c5[_0x0145('0x33')],qs[_0x0145('0x39')](_0x5d3375[_0x0145('0x34')]['fields']));_0x5b552b[_0x0145('0x38')]=_0x5b552b[_0x0145('0x38')][_0x0145('0x3a')]?_0x5b552b[_0x0145('0x38')]:_0x14b8c5[_0x0145('0x33')];_0x5b552b[_0x0145('0x3c')]=qs[_0x0145('0x3d')](_0x5d3375[_0x0145('0x34')]['sort']);_0x5b552b['where']=qs[_0x0145('0x36')](_[_0x0145('0x3f')](_0x5d3375[_0x0145('0x34')],_0x14b8c5[_0x0145('0x36')]));if(_0x5d3375[_0x0145('0x34')]['filter']){_0x5b552b['where']=_[_0x0145('0x41')](_0x5b552b['where'],{'$or':_[_0x0145('0x2e')](_0x5b552b[_0x0145('0x38')],function(_0x126fc5){var _0x107237={};_0x107237[_0x126fc5]={'$like':'%'+_0x5d3375[_0x0145('0x34')][_0x0145('0x40')]+'%'};return _0x107237;})});}_0x5b552b=_['merge']({},_0x5b552b,_0x5d3375[_0x0145('0x42')]);return _0x1fd98a[_0x0145('0x99')](_0x5b552b);}})[_0x0145('0x29')](function(_0x20266d){if(_0x20266d){_0x3638d0=_0x20266d[_0x0145('0x3a')];if(!_0x5d3375[_0x0145('0x34')]['hasOwnProperty'](_0x0145('0x9a'))){_0x5b552b[_0x0145('0x23')]=qs[_0x0145('0x23')](_0x5d3375[_0x0145('0x34')][_0x0145('0x23')]);_0x5b552b[_0x0145('0x22')]=qs['offset'](_0x5d3375[_0x0145('0x34')][_0x0145('0x22')]);}return _0x1fd98a[_0x0145('0x99')](_0x5b552b);}})[_0x0145('0x29')](function(_0x209bd2){if(_0x209bd2){return _0x209bd2?{'count':_0x3638d0,'rows':_0x209bd2}:null;}})['then'](respondWithResult(_0x531373,null))[_0x0145('0x49')](handleError(_0x531373,null));};
\ No newline at end of file
index d5fe4f3..db0fcf5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x88d0=['update','emit','hasOwnProperty','hook','events','Team','setMaxListeners','save'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x88d0,0x19c));var _0x088d=function(_0x22b8a3,_0x2a79a7){_0x22b8a3=_0x22b8a3-0x0;var _0x199a0c=_0x88d0[_0x22b8a3];return _0x199a0c;};'use strict';var EventEmitter=require(_0x088d('0x0'));var Team=require('../../mysqldb')['db'][_0x088d('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x088d('0x2')](0x0);var events={'afterCreate':_0x088d('0x3'),'afterUpdate':_0x088d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d7f97){return function(_0x1ef4df,_0x400739,_0x360fc6){TeamEvents[_0x088d('0x5')](_0x4d7f97+':'+_0x1ef4df['id'],_0x1ef4df);TeamEvents[_0x088d('0x5')](_0x4d7f97,_0x1ef4df);_0x360fc6(null);};}for(var e in events){if(events[_0x088d('0x6')](e)){var event=events[e];Team[_0x088d('0x7')](e,emitEvent(event));}}module['exports']=TeamEvents;
\ No newline at end of file
+var _0x66b7=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x66b7,0x14a));var _0x766b=function(_0x136031,_0x4c913f){_0x136031=_0x136031-0x0;var _0x943566=_0x66b7[_0x136031];return _0x943566;};'use strict';var EventEmitter=require(_0x766b('0x0'));var Team=require(_0x766b('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x766b('0x2')](0x0);var events={'afterCreate':_0x766b('0x3'),'afterUpdate':_0x766b('0x4'),'afterDestroy':_0x766b('0x5')};function emitEvent(_0x46e32e){return function(_0x13702e,_0x48a325,_0xaa1e48){TeamEvents['emit'](_0x46e32e+':'+_0x13702e['id'],_0x13702e);TeamEvents['emit'](_0x46e32e,_0x13702e);_0xaa1e48(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0x766b('0x6')](e,emitEvent(event));}}module[_0x766b('0x7')]=TeamEvents;
\ No newline at end of file
index 5f6f11a..2d1c08d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0a4e=['then','setDataValue','channel','catch','exports','define','teams','Chat','Fax','Mail','Sms','Voice','Whatsapp','resolve','all','lodash','get','Queues'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x0a4e,0x19b));var _0xe0a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a4e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe0a4('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x3b5f58,_0x466e26){var _0x4ad38f=_0xe0a4('0x1')+_0x466e26+_0xe0a4('0x2');return _0x3b5f58[_0x4ad38f]()[_0xe0a4('0x3')](function(_0x45b2ad){return _['map'](_0x45b2ad,function(_0x213101){_0x213101[_0xe0a4('0x4')](_0xe0a4('0x5'),_0x466e26);return _0x213101;});})[_0xe0a4('0x6')](function(_0x542e6c){throw _0x542e6c;});}module[_0xe0a4('0x7')]=function(_0x4eb2b3){return _0x4eb2b3[_0xe0a4('0x8')]('Team',attributes,{'tableName':_0xe0a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x230a57=this;var _0x347c3b=[_0xe0a4('0xa'),_0xe0a4('0xb'),_0xe0a4('0xc'),'Openchannel',_0xe0a4('0xd'),_0xe0a4('0xe'),_0xe0a4('0xf')];return Promise[_0xe0a4('0x10')]()[_0xe0a4('0x3')](function(){var _0x5a46eb=_['map'](_0x347c3b,function(_0x123576){return getQueuesByChannel(_0x230a57,_0x123576);});return Promise[_0xe0a4('0x11')](_0x5a46eb);})[_0xe0a4('0x6')](function(_0x2e8c90){throw _0x2e8c90;});}}});};
\ No newline at end of file
+var _0xcfc3=['channel','catch','Team','Chat','Fax','Mail','Openchannel','Voice','lodash','./team.attributes','get','Queues','then','map','setDataValue'];(function(_0x89452,_0x2cd867){var _0x1c0c02=function(_0x27033c){while(--_0x27033c){_0x89452['push'](_0x89452['shift']());}};_0x1c0c02(++_0x2cd867);}(_0xcfc3,0x1ac));var _0x3cfc=function(_0x13f5a2,_0x435893){_0x13f5a2=_0x13f5a2-0x0;var _0x1c2719=_0xcfc3[_0x13f5a2];return _0x1c2719;};'use strict';var _=require(_0x3cfc('0x0'));var attributes=require(_0x3cfc('0x1'));function getQueuesByChannel(_0x185916,_0x1ec1e9){var _0x3217fb=_0x3cfc('0x2')+_0x1ec1e9+_0x3cfc('0x3');return _0x185916[_0x3217fb]()[_0x3cfc('0x4')](function(_0x200d49){return _[_0x3cfc('0x5')](_0x200d49,function(_0x1b0b25){_0x1b0b25[_0x3cfc('0x6')](_0x3cfc('0x7'),_0x1ec1e9);return _0x1b0b25;});})[_0x3cfc('0x8')](function(_0x4f14f1){throw _0x4f14f1;});}module['exports']=function(_0x45fe9f){return _0x45fe9f['define'](_0x3cfc('0x9'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x28c06f=this;var _0x442c39=[_0x3cfc('0xa'),_0x3cfc('0xb'),_0x3cfc('0xc'),_0x3cfc('0xd'),'Sms',_0x3cfc('0xe'),'Whatsapp'];return Promise['resolve']()[_0x3cfc('0x4')](function(){var _0x44dab4=_['map'](_0x442c39,function(_0x5886f0){return getQueuesByChannel(_0x28c06f,_0x5886f0);});return Promise['all'](_0x44dab4);})[_0x3cfc('0x8')](function(_0x15c9be){throw _0x15c9be;});}}});};
\ No newline at end of file
index a36f7d0..f3f66bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb69e=['../../config/environment','jayson/promise','client','redis','defaults','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xb69e,0x1a2));var _0xeb69=function(_0x2a2249,_0x49ba23){_0x2a2249=_0x2a2249-0x0;var _0x3a43fa=_0xb69e[_0x2a2249];return _0x3a43fa;};'use strict';var _=require(_0xeb69('0x0'));var util=require(_0xeb69('0x1'));var moment=require(_0xeb69('0x2'));var BPromise=require(_0xeb69('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb69('0x4'));var db=require(_0xeb69('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeb69('0x6'));var config=require(_0xeb69('0x7'));var jayson=require(_0xeb69('0x8'));var client=jayson[_0xeb69('0x9')]['http']({'port':0x232a});config[_0xeb69('0xa')]=_[_0xeb69('0xb')](config[_0xeb69('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0xeb69('0xc')](socket);function respondWithRpcPromise(_0x370cc8,_0x3f3634,_0x30f8be){return new BPromise(function(_0x11b7de,_0x3788be){return client[_0xeb69('0xd')](_0x370cc8,_0x30f8be)[_0xeb69('0xe')](function(_0x54e72d){logger[_0xeb69('0xf')]('Team,\x20%s,\x20%s',_0x3f3634,_0xeb69('0x10'));logger[_0xeb69('0x11')](_0xeb69('0x12'),_0x3f3634,_0xeb69('0x10'),JSON[_0xeb69('0x13')](_0x54e72d));if(_0x54e72d[_0xeb69('0x14')]){if(_0x54e72d[_0xeb69('0x14')][_0xeb69('0x15')]===0x1f4){logger[_0xeb69('0x14')](_0xeb69('0x16'),_0x3f3634,_0x54e72d[_0xeb69('0x14')][_0xeb69('0x17')]);return _0x3788be(_0x54e72d[_0xeb69('0x14')][_0xeb69('0x17')]);}logger[_0xeb69('0x14')](_0xeb69('0x16'),_0x3f3634,_0x54e72d[_0xeb69('0x14')]['message']);return _0x11b7de(_0x54e72d[_0xeb69('0x14')][_0xeb69('0x17')]);}else{logger[_0xeb69('0xf')](_0xeb69('0x16'),_0x3f3634,_0xeb69('0x10'));_0x11b7de(_0x54e72d['result'][_0xeb69('0x17')]);}})[_0xeb69('0x18')](function(_0x5d0882){logger[_0xeb69('0x14')](_0xeb69('0x16'),_0x3f3634,_0x5d0882);_0x3788be(_0x5d0882);});});}
\ No newline at end of file
+var _0x32ca=['Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','info','Team,\x20%s,\x20%s','request\x20sent'];(function(_0x2392c4,_0x9c9aed){var _0x158f6e=function(_0x9c066b){while(--_0x9c066b){_0x2392c4['push'](_0x2392c4['shift']());}};_0x158f6e(++_0x9c9aed);}(_0x32ca,0x13f));var _0xa32c=function(_0x32b5b1,_0x1da9ad){_0x32b5b1=_0x32b5b1-0x0;var _0x1fcc4c=_0x32ca[_0x32b5b1];return _0x1fcc4c;};'use strict';var _=require(_0xa32c('0x0'));var util=require('util');var moment=require(_0xa32c('0x1'));var BPromise=require(_0xa32c('0x2'));var rs=require(_0xa32c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa32c('0x4'));var logger=require(_0xa32c('0x5'))('rpc');var config=require(_0xa32c('0x6'));var jayson=require(_0xa32c('0x7'));var client=jayson[_0xa32c('0x8')][_0xa32c('0x9')]({'port':0x232a});config['redis']=_[_0xa32c('0xa')](config[_0xa32c('0xb')],{'host':_0xa32c('0xc'),'port':0x18eb});var socket=require(_0xa32c('0xd'))(new Redis(config[_0xa32c('0xb')]));require('./team.socket')[_0xa32c('0xe')](socket);function respondWithRpcPromise(_0x49fd03,_0x17ab8c,_0x15d8a8){return new BPromise(function(_0x165c4c,_0x12f2e7){return client[_0xa32c('0xf')](_0x49fd03,_0x15d8a8)['then'](function(_0x54cb48){logger[_0xa32c('0x10')](_0xa32c('0x11'),_0x17ab8c,_0xa32c('0x12'));logger['debug'](_0xa32c('0x13'),_0x17ab8c,_0xa32c('0x12'),JSON[_0xa32c('0x14')](_0x54cb48));if(_0x54cb48['error']){if(_0x54cb48[_0xa32c('0x15')][_0xa32c('0x16')]===0x1f4){logger[_0xa32c('0x15')]('Team,\x20%s,\x20%s',_0x17ab8c,_0x54cb48[_0xa32c('0x15')][_0xa32c('0x17')]);return _0x12f2e7(_0x54cb48[_0xa32c('0x15')][_0xa32c('0x17')]);}logger[_0xa32c('0x15')](_0xa32c('0x11'),_0x17ab8c,_0x54cb48['error'][_0xa32c('0x17')]);return _0x165c4c(_0x54cb48['error'][_0xa32c('0x17')]);}else{logger[_0xa32c('0x10')](_0xa32c('0x11'),_0x17ab8c,_0xa32c('0x12'));_0x165c4c(_0x54cb48[_0xa32c('0x18')][_0xa32c('0x17')]);}})[_0xa32c('0x19')](function(_0x3b62aa){logger['error'](_0xa32c('0x11'),_0x17ab8c,_0x3b62aa);_0x12f2e7(_0x3b62aa);});});}
\ No newline at end of file
index 825b5f2..346104f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xce3a=['save','remove','update','emit','removeListener','register','length','team:','./team.events'];(function(_0x54b60d,_0x573b1c){var _0x245c39=function(_0x27e9cf){while(--_0x27e9cf){_0x54b60d['push'](_0x54b60d['shift']());}};_0x245c39(++_0x573b1c);}(_0xce3a,0x194));var _0xace3=function(_0x415129,_0x4b7222){_0x415129=_0x415129-0x0;var _0x191952=_0xce3a[_0x415129];return _0x191952;};'use strict';var TeamEvents=require(_0xace3('0x0'));var events=[_0xace3('0x1'),_0xace3('0x2'),_0xace3('0x3')];function createListener(_0x291b34,_0x37ef15){return function(_0x1f1865){_0x37ef15[_0xace3('0x4')](_0x291b34,_0x1f1865);};}function removeListener(_0xa5640c,_0x80eaaf){return function(){TeamEvents[_0xace3('0x5')](_0xa5640c,_0x80eaaf);};}exports[_0xace3('0x6')]=function(_0x4c3ae9){for(var _0x3ee264=0x0,_0x3d4ebc=events[_0xace3('0x7')];_0x3ee264<_0x3d4ebc;_0x3ee264++){var _0x22f00a=events[_0x3ee264];var _0x4e27ad=createListener(_0xace3('0x8')+_0x22f00a,_0x4c3ae9);TeamEvents['on'](_0x22f00a,_0x4e27ad);}};
\ No newline at end of file
+var _0xa74f=['emit','removeListener','length','team:','remove'];(function(_0x1cf9eb,_0xe1a336){var _0x3dd1a4=function(_0x3a9353){while(--_0x3a9353){_0x1cf9eb['push'](_0x1cf9eb['shift']());}};_0x3dd1a4(++_0xe1a336);}(_0xa74f,0x9a));var _0xfa74=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0xa74f[_0x2d2c16];return _0x53f2fb;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xfa74('0x0'),'update'];function createListener(_0x4b5765,_0x29e4c8){return function(_0x110824){_0x29e4c8[_0xfa74('0x1')](_0x4b5765,_0x110824);};}function removeListener(_0x25a9b7,_0x5b367b){return function(){TeamEvents[_0xfa74('0x2')](_0x25a9b7,_0x5b367b);};}exports['register']=function(_0x543cfe){for(var _0x43dd2f=0x0,_0x9ddbd2=events[_0xfa74('0x3')];_0x43dd2f<_0x9ddbd2;_0x43dd2f++){var _0x2d9fa9=events[_0x43dd2f];var _0x287921=createListener(_0xfa74('0x4')+_0x2d9fa9,_0x543cfe);TeamEvents['on'](_0x2d9fa9,_0x287921);}};
\ No newline at end of file
index fc27239..70966c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x74f0=['exports'];(function(_0x5d8ace,_0x111a34){var _0xd2034e=function(_0x4924d0){while(--_0x4924d0){_0x5d8ace['push'](_0x5d8ace['shift']());}};_0xd2034e(++_0x111a34);}(_0x74f0,0xf3));var _0x074f=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0x74f0[_0x46f1a6];return _0x38429a;};'use strict';var Sequelize=require('sequelize');module[_0x074f('0x0')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x4ea3=['INTEGER','sequelize','exports'];(function(_0x15cf93,_0x5b1029){var _0x2afb0a=function(_0x5413ed){while(--_0x5413ed){_0x15cf93['push'](_0x15cf93['shift']());}};_0x2afb0a(++_0x5b1029);}(_0x4ea3,0x70));var _0x34ea=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4ea3[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'TeamId':{'type':Sequelize[_0x34ea('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x34ea('0x2')]}};
\ No newline at end of file
index ff2ca66..e6d866a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x823c=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x1b3364,_0x5f59d1){var _0x26f5f9=function(_0x1e0d5c){while(--_0x1e0d5c){_0x1b3364['push'](_0x1b3364['shift']());}};_0x26f5f9(++_0x5f59d1);}(_0x823c,0x143));var _0xc823=function(_0x24e0e9,_0x4c0c30){_0x24e0e9=_0x24e0e9-0x0;var _0x1dd0f4=_0x823c[_0x24e0e9];return _0x1dd0f4;};'use strict';var _=require(_0xc823('0x0'));var util=require('util');var logger=require(_0xc823('0x1'))(_0xc823('0x2'));var moment=require(_0xc823('0x3'));var BPromise=require(_0xc823('0x4'));var rp=require(_0xc823('0x5'));var fs=require('fs');var path=require(_0xc823('0x6'));var rimraf=require('rimraf');var config=require(_0xc823('0x7'));var attributes=require(_0xc823('0x8'));module[_0xc823('0x9')]=function(_0x42e0c0,_0x380607){return _0x42e0c0['define'](_0xc823('0xa'),attributes,{'tableName':_0xc823('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xc6fe=['bluebird','path','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','api','moment'];(function(_0x507abf,_0x102de1){var _0x93bddf=function(_0x1230d8){while(--_0x1230d8){_0x507abf['push'](_0x507abf['shift']());}};_0x93bddf(++_0x102de1);}(_0xc6fe,0xbc));var _0xec6f=function(_0x3df373,_0x45de06){_0x3df373=_0x3df373-0x0;var _0x43f399=_0xc6fe[_0x3df373];return _0x43f399;};'use strict';var _=require(_0xec6f('0x0'));var util=require(_0xec6f('0x1'));var logger=require('../../config/logger')(_0xec6f('0x2'));var moment=require(_0xec6f('0x3'));var BPromise=require(_0xec6f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xec6f('0x5'));var rimraf=require('rimraf');var config=require(_0xec6f('0x6'));var attributes=require(_0xec6f('0x7'));module[_0xec6f('0x8')]=function(_0x2f64ea,_0x4adbb8){return _0x2f64ea[_0xec6f('0x9')](_0xec6f('0xa'),attributes,{'tableName':_0xec6f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4aa5cb6..5e4e863 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2e409e,_0x2d227e){var _0xe6e039=function(_0x47195d){while(--_0x47195d){_0x2e409e['push'](_0x2e409e['shift']());}};_0xe6e039(++_0x2d227e);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
+var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x160a50,_0x4d6597){var _0xabf8d5=function(_0x26a228){while(--_0x26a228){_0x160a50['push'](_0x160a50['shift']());}};_0xabf8d5(++_0x4d6597);}(_0xedd9,0xfc));var _0x9edd=function(_0x1c81af,_0x57b08b){_0x1c81af=_0x1c81af-0x0;var _0x328228=_0xedd9[_0x1c81af];return _0x328228;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router;
\ No newline at end of file
index a9d3917..5caa101 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd729=['sequelize','exports','INTEGER'];(function(_0x4c1d87,_0x269c0b){var _0x360b3b=function(_0x4f0032){while(--_0x4f0032){_0x4c1d87['push'](_0x4c1d87['shift']());}};_0x360b3b(++_0x269c0b);}(_0xd729,0x1bc));var _0x9d72=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xd729[_0x7e2eb0];return _0xd92de4;};'use strict';var Sequelize=require(_0x9d72('0x0'));module[_0x9d72('0x1')]={'penalty':{'type':Sequelize[_0x9d72('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x79fc=['INTEGER','exports'];(function(_0x5706dd,_0xdad318){var _0x4606b6=function(_0xf36185){while(--_0xf36185){_0x5706dd['push'](_0x5706dd['shift']());}};_0x4606b6(++_0xdad318);}(_0x79fc,0x1db));var _0xc79f=function(_0x43b9df,_0x48e578){_0x43b9df=_0x43b9df-0x0;var _0xb0cb10=_0x79fc[_0x43b9df];return _0xb0cb10;};'use strict';var Sequelize=require('sequelize');module[_0xc79f('0x0')]={'penalty':{'type':Sequelize[_0xc79f('0x1')],'defaultValue':0x0}};
\ No newline at end of file
index 2d0f096..2f55664 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8128=['team_has_voice_queues','lodash','api','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x155b75,_0x3ac691){var _0x2e37af=function(_0x29b0f0){while(--_0x29b0f0){_0x155b75['push'](_0x155b75['shift']());}};_0x2e37af(++_0x3ac691);}(_0x8128,0x1b1));var _0x8812=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x8128[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0x8812('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8812('0x1'));var moment=require(_0x8812('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8812('0x3'));var rimraf=require(_0x8812('0x4'));var config=require(_0x8812('0x5'));var attributes=require('./teamVoiceQueue.attributes');module[_0x8812('0x6')]=function(_0x2f4af9,_0x2b43c6){return _0x2f4af9[_0x8812('0x7')]('TeamVoiceQueue',attributes,{'tableName':_0x8812('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x130d=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x5459c1,_0x36f6f0){var _0x3f99b5=function(_0x512bea){while(--_0x512bea){_0x5459c1['push'](_0x5459c1['shift']());}};_0x3f99b5(++_0x36f6f0);}(_0x130d,0x125));var _0xd130=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x130d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd130('0x0'));var util=require('util');var logger=require(_0xd130('0x1'))('api');var moment=require(_0xd130('0x2'));var BPromise=require(_0xd130('0x3'));var rp=require(_0xd130('0x4'));var fs=require('fs');var path=require(_0xd130('0x5'));var rimraf=require(_0xd130('0x6'));var config=require(_0xd130('0x7'));var attributes=require(_0xd130('0x8'));module[_0xd130('0x9')]=function(_0x287e61,_0x4689a8){return _0x287e61[_0xd130('0xa')](_0xd130('0xb'),attributes,{'tableName':_0xd130('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5956ad2..8a25e4d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x82a2=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','catch'];(function(_0x1b0bcc,_0x4af3f1){var _0x497cf9=function(_0x3f8306){while(--_0x3f8306){_0x1b0bcc['push'](_0x1b0bcc['shift']());}};_0x497cf9(++_0x4af3f1);}(_0x82a2,0x17a));var _0x282a=function(_0x393591,_0xaf1721){_0x393591=_0x393591-0x0;var _0x5863bf=_0x82a2[_0x393591];return _0x5863bf;};'use strict';var _=require(_0x282a('0x0'));var util=require('util');var moment=require(_0x282a('0x1'));var BPromise=require(_0x282a('0x2'));var rs=require(_0x282a('0x3'));var fs=require('fs');var Redis=require(_0x282a('0x4'));var db=require(_0x282a('0x5'))['db'];var utils=require(_0x282a('0x6'));var logger=require(_0x282a('0x7'))(_0x282a('0x8'));var config=require(_0x282a('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x282a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7bc1b5,_0x4ebdce,_0x48e7f4){return new BPromise(function(_0x161255,_0x369baa){return client['request'](_0x7bc1b5,_0x48e7f4)[_0x282a('0xb')](function(_0x303821){logger['info'](_0x282a('0xc'),_0x4ebdce,'request\x20sent');logger[_0x282a('0xd')](_0x282a('0xe'),_0x4ebdce,_0x282a('0xf'),JSON[_0x282a('0x10')](_0x303821));if(_0x303821[_0x282a('0x11')]){if(_0x303821[_0x282a('0x11')]['code']===0x1f4){logger[_0x282a('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4ebdce,_0x303821[_0x282a('0x11')][_0x282a('0x12')]);return _0x369baa(_0x303821[_0x282a('0x11')][_0x282a('0x12')]);}logger[_0x282a('0x11')](_0x282a('0xc'),_0x4ebdce,_0x303821[_0x282a('0x11')][_0x282a('0x12')]);return _0x161255(_0x303821[_0x282a('0x11')]['message']);}else{logger[_0x282a('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4ebdce,_0x282a('0xf'));_0x161255(_0x303821['result'][_0x282a('0x12')]);}})[_0x282a('0x14')](function(_0x242e64){logger[_0x282a('0x11')](_0x282a('0xc'),_0x4ebdce,_0x242e64);_0x369baa(_0x242e64);});});}
\ No newline at end of file
+var _0xb088=['request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x51b64b,_0x306317){var _0x4167a8=function(_0x4e7b74){while(--_0x4e7b74){_0x51b64b['push'](_0x51b64b['shift']());}};_0x4167a8(++_0x306317);}(_0xb088,0x7b));var _0x8b08=function(_0x3da885,_0x5b66cc){_0x3da885=_0x3da885-0x0;var _0x1c4569=_0xb088[_0x3da885];return _0x1c4569;};'use strict';var _=require(_0x8b08('0x0'));var util=require(_0x8b08('0x1'));var moment=require(_0x8b08('0x2'));var BPromise=require(_0x8b08('0x3'));var rs=require(_0x8b08('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b08('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b08('0x6'))(_0x8b08('0x7'));var config=require(_0x8b08('0x8'));var jayson=require(_0x8b08('0x9'));var client=jayson['client'][_0x8b08('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x17dd63,_0xe29c94,_0x4ec834){return new BPromise(function(_0x3f2890,_0x242c07){return client[_0x8b08('0xb')](_0x17dd63,_0x4ec834)[_0x8b08('0xc')](function(_0x2c67ad){logger[_0x8b08('0xd')](_0x8b08('0xe'),_0xe29c94,_0x8b08('0xf'));logger[_0x8b08('0x10')](_0x8b08('0x11'),_0xe29c94,'request\x20sent',JSON[_0x8b08('0x12')](_0x2c67ad));if(_0x2c67ad[_0x8b08('0x13')]){if(_0x2c67ad[_0x8b08('0x13')][_0x8b08('0x14')]===0x1f4){logger[_0x8b08('0x13')](_0x8b08('0xe'),_0xe29c94,_0x2c67ad[_0x8b08('0x13')][_0x8b08('0x15')]);return _0x242c07(_0x2c67ad[_0x8b08('0x13')][_0x8b08('0x15')]);}logger[_0x8b08('0x13')]('TeamVoiceQueue,\x20%s,\x20%s',_0xe29c94,_0x2c67ad[_0x8b08('0x13')]['message']);return _0x3f2890(_0x2c67ad['error']['message']);}else{logger['info'](_0x8b08('0xe'),_0xe29c94,'request\x20sent');_0x3f2890(_0x2c67ad[_0x8b08('0x16')]['message']);}})['catch'](function(_0x1d6499){logger['error'](_0x8b08('0xe'),_0xe29c94,_0x1d6499);_0x242c07(_0x1d6499);});});}
\ No newline at end of file
index 3e44f79..3fa85c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb44a=['destroy','exports','path','express','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x379355,_0x9dd636){var _0x2b2b60=function(_0x335ebf){while(--_0x335ebf){_0x379355['push'](_0x379355['shift']());}};_0x2b2b60(++_0x9dd636);}(_0xb44a,0x1c2));var _0xab44=function(_0x3b9b2e,_0x1d3afe){_0x3b9b2e=_0x3b9b2e-0x0;var _0x3e1a74=_0xb44a[_0x3b9b2e];return _0x3e1a74;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab44('0x0'));var timeout=require('connect-timeout');var express=require(_0xab44('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xab44('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xab44('0x3'));var controller=require(_0xab44('0x4'));router[_0xab44('0x5')]('/',auth[_0xab44('0x6')](),controller[_0xab44('0x7')]);router[_0xab44('0x5')](_0xab44('0x8'),auth[_0xab44('0x6')](),controller[_0xab44('0x9')]);router[_0xab44('0xa')]('/',auth[_0xab44('0x6')](),controller[_0xab44('0xb')]);router[_0xab44('0xc')]('/:id',auth[_0xab44('0x6')](),controller['update']);router[_0xab44('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xab44('0xe')]);module[_0xab44('0xf')]=router;
\ No newline at end of file
+var _0x46c1=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','/:id','isAuthenticated','post','create','put','update','delete','destroy','util','path'];(function(_0x1b6311,_0x42ec20){var _0x25aab6=function(_0x139a77){while(--_0x139a77){_0x1b6311['push'](_0x1b6311['shift']());}};_0x25aab6(++_0x42ec20);}(_0x46c1,0x7c));var _0x146c=function(_0x1b63e1,_0x30a406){_0x1b63e1=_0x1b63e1-0x0;var _0x18e513=_0x46c1[_0x1b63e1];return _0x18e513;};'use strict';var multer=require('multer');var util=require(_0x146c('0x0'));var path=require(_0x146c('0x1'));var timeout=require(_0x146c('0x2'));var express=require(_0x146c('0x3'));var router=express[_0x146c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x146c('0x5'));var interaction=require(_0x146c('0x6'));var config=require(_0x146c('0x7'));var controller=require(_0x146c('0x8'));router[_0x146c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x146c('0x9')](_0x146c('0xa'),auth[_0x146c('0xb')](),controller['show']);router[_0x146c('0xc')]('/',auth['isAuthenticated'](),controller[_0x146c('0xd')]);router[_0x146c('0xe')]('/:id',auth[_0x146c('0xb')](),controller[_0x146c('0xf')]);router[_0x146c('0x10')](_0x146c('0xa'),auth['isAuthenticated'](),controller[_0x146c('0x11')]);module['exports']=router;
\ No newline at end of file
index beb19ec..048ecfa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf09=['TEXT','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf09,0x109));var _0x9df0=function(_0x4bfabd,_0xf1fcb7){_0x4bfabd=_0x4bfabd-0x0;var _0x3c1b98=_0xdf09[_0x4bfabd];return _0x3c1b98;};'use strict';var Sequelize=require(_0x9df0('0x0'));module[_0x9df0('0x1')]={'name':{'type':Sequelize[_0x9df0('0x2')]},'description':{'type':Sequelize[_0x9df0('0x2')]},'html':{'type':Sequelize[_0x9df0('0x3')]}};
\ No newline at end of file
+var _0x634b=['exports','STRING','TEXT'];(function(_0x1ef01c,_0x5a0b84){var _0x42c8ed=function(_0x3531cd){while(--_0x3531cd){_0x1ef01c['push'](_0x1ef01c['shift']());}};_0x42c8ed(++_0x5a0b84);}(_0x634b,0x153));var _0xb634=function(_0x16560c,_0x5a0b94){_0x16560c=_0x16560c-0x0;var _0x16b918=_0x634b[_0x16560c];return _0x16b918;};'use strict';var Sequelize=require('sequelize');module[_0xb634('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb634('0x1')]},'html':{'type':Sequelize[_0xb634('0x2')]}};
\ No newline at end of file
index f344f1d..21ad0b2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7b1f=['json','save','update','then','get','Templates','UserProfileResource','error','stack','name','index','Template','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count'];(function(_0x44b0c7,_0x3644e0){var _0x501ce0=function(_0x120a91){while(--_0x120a91){_0x44b0c7['push'](_0x44b0c7['shift']());}};_0x501ce0(++_0x3644e0);}(_0x7b1f,0x195));var _0xf7b1=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x7b1f[_0x1c34e7];return _0x378cb1;};'use strict';var emlformat=require(_0xf7b1('0x0'));var rimraf=require(_0xf7b1('0x1'));var zipdir=require(_0xf7b1('0x2'));var jsonpatch=require(_0xf7b1('0x3'));var rp=require(_0xf7b1('0x4'));var moment=require(_0xf7b1('0x5'));var BPromise=require(_0xf7b1('0x6'));var Mustache=require(_0xf7b1('0x7'));var util=require(_0xf7b1('0x8'));var path=require(_0xf7b1('0x9'));var sox=require(_0xf7b1('0xa'));var csv=require(_0xf7b1('0xb'));var ejs=require(_0xf7b1('0xc'));var fs=require('fs');var fs_extra=require(_0xf7b1('0xd'));var _=require(_0xf7b1('0xe'));var squel=require(_0xf7b1('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf7b1('0x10'));var toCsv=require(_0xf7b1('0xb'));var querystring=require(_0xf7b1('0x11'));var Papa=require(_0xf7b1('0x12'));var Redis=require(_0xf7b1('0x13'));var authService=require(_0xf7b1('0x14'));var qs=require(_0xf7b1('0x15'));var as=require(_0xf7b1('0x16'));var hardwareService=require(_0xf7b1('0x17'));var logger=require(_0xf7b1('0x18'))('api');var utils=require(_0xf7b1('0x19'));var config=require(_0xf7b1('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xf7b1('0x1b'))['db'];function respondWithStatusCode(_0x127e8c,_0x523525){_0x523525=_0x523525||0xcc;return function(_0x592a05){if(_0x592a05){return _0x127e8c[_0xf7b1('0x1c')](_0x523525);}return _0x127e8c[_0xf7b1('0x1d')](_0x523525)[_0xf7b1('0x1e')]();};}function respondWithResult(_0x5acd1d,_0x14c7c4){_0x14c7c4=_0x14c7c4||0xc8;return function(_0x3c24a9){if(_0x3c24a9){return _0x5acd1d[_0xf7b1('0x1d')](_0x14c7c4)['json'](_0x3c24a9);}};}function respondWithFilteredResult(_0x267760,_0xf16745){return function(_0x35db0d){if(_0x35db0d){var _0x4758cd=typeof _0xf16745[_0xf7b1('0x1f')]===_0xf7b1('0x20')&&typeof _0xf16745[_0xf7b1('0x21')]===_0xf7b1('0x20');var _0x31b1af=_0x35db0d[_0xf7b1('0x22')];var _0x1d10ca=_0x4758cd?0x0:_0xf16745[_0xf7b1('0x1f')];var _0x258e81=_0x4758cd?_0x35db0d[_0xf7b1('0x22')]:_0xf16745[_0xf7b1('0x1f')]+_0xf16745['limit'];var _0x1c776a;if(_0x258e81>=_0x31b1af){_0x258e81=_0x31b1af;_0x1c776a=0xc8;}else{_0x1c776a=0xce;}_0x267760[_0xf7b1('0x1d')](_0x1c776a);return _0x267760['set']('Content-Range',_0x1d10ca+'-'+_0x258e81+'/'+_0x31b1af)[_0xf7b1('0x23')](_0x35db0d);}return null;};}function patchUpdates(_0x3c3c94){return function(_0x20ff79){try{jsonpatch['apply'](_0x20ff79,_0x3c3c94,!![]);}catch(_0xb33203){return BPromise['reject'](_0xb33203);}return _0x20ff79[_0xf7b1('0x24')]();};}function saveUpdates(_0x258070,_0xe79d23){return function(_0x1ca2ba){if(_0x1ca2ba){return _0x1ca2ba[_0xf7b1('0x25')](_0x258070)[_0xf7b1('0x26')](function(_0x5e2d84){return _0x5e2d84;});}return null;};}function removeEntity(_0x2edde5,_0x327195){return function(_0x4ac21a){if(_0x4ac21a){return _0x4ac21a['destroy']()[_0xf7b1('0x26')](function(){var _0x41602b=_0x4ac21a[_0xf7b1('0x27')]({'plain':!![]});var _0x919d1d=_0xf7b1('0x28');return db[_0xf7b1('0x29')]['destroy']({'where':{'type':_0x919d1d,'resourceId':_0x41602b['id']}})[_0xf7b1('0x26')](function(){return _0x4ac21a;});})[_0xf7b1('0x26')](function(){_0x2edde5[_0xf7b1('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3282ce,_0x137797){return function(_0x59c0b8){if(!_0x59c0b8){_0x3282ce[_0xf7b1('0x1c')](0x194);}return _0x59c0b8;};}function handleError(_0x30c7d7,_0x3e8b4d){_0x3e8b4d=_0x3e8b4d||0x1f4;return function(_0x5b0208){logger[_0xf7b1('0x2a')](_0x5b0208[_0xf7b1('0x2b')]);if(_0x5b0208['name']){delete _0x5b0208[_0xf7b1('0x2c')];}_0x30c7d7[_0xf7b1('0x1d')](_0x3e8b4d)['send'](_0x5b0208);};}exports[_0xf7b1('0x2d')]=function(_0x1cec58,_0x53a8ce){var _0x50f57c={},_0x5935a3={},_0x179195={'count':0x0,'rows':[]};var _0x42fd09=_['map'](db[_0xf7b1('0x2e')]['rawAttributes'],function(_0x2a3081){return{'name':_0x2a3081[_0xf7b1('0x2f')],'type':_0x2a3081[_0xf7b1('0x30')][_0xf7b1('0x31')]};});_0x5935a3[_0xf7b1('0x32')]=_['map'](_0x42fd09,_0xf7b1('0x2c'));_0x5935a3['query']=_[_0xf7b1('0x33')](_0x1cec58[_0xf7b1('0x34')]);_0x5935a3[_0xf7b1('0x35')]=_['intersection'](_0x5935a3[_0xf7b1('0x32')],_0x5935a3[_0xf7b1('0x34')]);_0x50f57c['attributes']=_[_0xf7b1('0x36')](_0x5935a3[_0xf7b1('0x32')],qs[_0xf7b1('0x37')](_0x1cec58[_0xf7b1('0x34')]['fields']));_0x50f57c[_0xf7b1('0x38')]=_0x50f57c['attributes'][_0xf7b1('0x39')]?_0x50f57c['attributes']:_0x5935a3[_0xf7b1('0x32')];if(!_0x1cec58['query'][_0xf7b1('0x3a')](_0xf7b1('0x3b'))){_0x50f57c[_0xf7b1('0x21')]=qs['limit'](_0x1cec58[_0xf7b1('0x34')]['limit']);_0x50f57c[_0xf7b1('0x1f')]=qs[_0xf7b1('0x1f')](_0x1cec58[_0xf7b1('0x34')][_0xf7b1('0x1f')]);}_0x50f57c[_0xf7b1('0x3c')]=qs[_0xf7b1('0x3d')](_0x1cec58['query']['sort']);_0x50f57c[_0xf7b1('0x3e')]=qs['filters'](_[_0xf7b1('0x3f')](_0x1cec58['query'],_0x5935a3['filters']),_0x42fd09);if(_0x1cec58[_0xf7b1('0x34')][_0xf7b1('0x40')]){_0x50f57c[_0xf7b1('0x3e')]=_[_0xf7b1('0x41')](_0x50f57c[_0xf7b1('0x3e')],{'$or':_[_0xf7b1('0x42')](_0x42fd09,function(_0xd6842b){if(_0xd6842b[_0xf7b1('0x30')]!==_0xf7b1('0x43')){var _0x290195={};_0x290195[_0xd6842b[_0xf7b1('0x2c')]]={'$like':'%'+_0x1cec58['query'][_0xf7b1('0x40')]+'%'};return _0x290195;}})});}_0x50f57c=_[_0xf7b1('0x41')]({},_0x50f57c,_0x1cec58['options']);var _0x212605={'where':_0x50f57c[_0xf7b1('0x3e')]};return db[_0xf7b1('0x2e')][_0xf7b1('0x22')](_0x212605)['then'](function(_0x15b29e){_0x179195[_0xf7b1('0x22')]=_0x15b29e;if(_0x1cec58['query'][_0xf7b1('0x44')]){_0x50f57c[_0xf7b1('0x45')]=[{'all':!![]}];}return db[_0xf7b1('0x2e')][_0xf7b1('0x46')](_0x50f57c);})['then'](function(_0x1c0476){_0x179195[_0xf7b1('0x47')]=_0x1c0476;return _0x179195;})[_0xf7b1('0x26')](respondWithFilteredResult(_0x53a8ce,_0x50f57c))[_0xf7b1('0x48')](handleError(_0x53a8ce,null));};exports[_0xf7b1('0x49')]=function(_0x2048c8,_0xd0446){var _0x37e89c={'raw':!![],'where':{'id':_0x2048c8[_0xf7b1('0x4a')]['id']}},_0x6b0c94={};_0x6b0c94[_0xf7b1('0x32')]=_[_0xf7b1('0x33')](db[_0xf7b1('0x2e')][_0xf7b1('0x4b')]);_0x6b0c94[_0xf7b1('0x34')]=_['keys'](_0x2048c8[_0xf7b1('0x34')]);_0x6b0c94[_0xf7b1('0x35')]=_[_0xf7b1('0x36')](_0x6b0c94[_0xf7b1('0x32')],_0x6b0c94[_0xf7b1('0x34')]);_0x37e89c[_0xf7b1('0x38')]=_[_0xf7b1('0x36')](_0x6b0c94[_0xf7b1('0x32')],qs[_0xf7b1('0x37')](_0x2048c8['query'][_0xf7b1('0x37')]));_0x37e89c['attributes']=_0x37e89c[_0xf7b1('0x38')][_0xf7b1('0x39')]?_0x37e89c[_0xf7b1('0x38')]:_0x6b0c94[_0xf7b1('0x32')];if(_0x2048c8[_0xf7b1('0x34')][_0xf7b1('0x44')]){_0x37e89c[_0xf7b1('0x45')]=[{'all':!![]}];}_0x37e89c=_[_0xf7b1('0x41')]({},_0x37e89c,_0x2048c8[_0xf7b1('0x4c')]);return db[_0xf7b1('0x2e')][_0xf7b1('0x4d')](_0x37e89c)[_0xf7b1('0x26')](handleEntityNotFound(_0xd0446,null))[_0xf7b1('0x26')](respondWithResult(_0xd0446,null))['catch'](handleError(_0xd0446,null));};exports[_0xf7b1('0x4e')]=function(_0x306c89,_0x14a3f2){return db['Template'][_0xf7b1('0x4e')](_0x306c89[_0xf7b1('0x4f')],{})[_0xf7b1('0x26')](function(_0x1113eb){var _0x2e2d8b=_0x306c89[_0xf7b1('0x50')][_0xf7b1('0x27')]({'plain':!![]});if(!_0x2e2d8b)throw new Error(_0xf7b1('0x51'));if(_0x2e2d8b[_0xf7b1('0x52')]===_0xf7b1('0x50')){var _0x1efc3f=_0x1113eb[_0xf7b1('0x27')]({'plain':!![]});var _0x489647=_0xf7b1('0x28');return db[_0xf7b1('0x53')]['find']({'where':{'name':_0x489647,'userProfileId':_0x2e2d8b[_0xf7b1('0x54')]},'raw':!![]})[_0xf7b1('0x26')](function(_0xbd1558){if(_0xbd1558&&_0xbd1558[_0xf7b1('0x55')]===0x0){return db[_0xf7b1('0x29')]['create']({'name':_0x1efc3f['name'],'resourceId':_0x1efc3f['id'],'type':_0xbd1558[_0xf7b1('0x2c')],'sectionId':_0xbd1558['id']},{})['then'](function(){return _0x1113eb;});}else{return _0x1113eb;}})[_0xf7b1('0x48')](function(_0x40ea5e){logger[_0xf7b1('0x2a')](_0xf7b1('0x56'),_0x40ea5e);throw _0x40ea5e;});}return _0x1113eb;})[_0xf7b1('0x26')](respondWithResult(_0x14a3f2,0xc9))['catch'](handleError(_0x14a3f2,null));};exports[_0xf7b1('0x25')]=function(_0x2d1b7c,_0x1df84d){if(_0x2d1b7c[_0xf7b1('0x4f')]['id']){delete _0x2d1b7c[_0xf7b1('0x4f')]['id'];}return db[_0xf7b1('0x2e')]['find']({'where':{'id':_0x2d1b7c[_0xf7b1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1df84d,null))[_0xf7b1('0x26')](saveUpdates(_0x2d1b7c[_0xf7b1('0x4f')],null))[_0xf7b1('0x26')](respondWithResult(_0x1df84d,null))['catch'](handleError(_0x1df84d,null));};exports[_0xf7b1('0x57')]=function(_0x489cad,_0x8bc8ff){return db[_0xf7b1('0x2e')][_0xf7b1('0x4d')]({'where':{'id':_0x489cad[_0xf7b1('0x4a')]['id']}})[_0xf7b1('0x26')](handleEntityNotFound(_0x8bc8ff,null))['then'](removeEntity(_0x8bc8ff,null))[_0xf7b1('0x48')](handleError(_0x8bc8ff,null));};
\ No newline at end of file
+var _0x7278=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','Templates','UserProfileResource','end','stack','name','send','index','map','Template','rawAttributes','type','key','model','query','keys','filters','fields','length','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','intersection','include','create','body','user','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel'];(function(_0x1e476b,_0x4ac7b3){var _0x4a75b2=function(_0x34e816){while(--_0x34e816){_0x1e476b['push'](_0x1e476b['shift']());}};_0x4a75b2(++_0x4ac7b3);}(_0x7278,0xed));var _0x8727=function(_0x3a1ae3,_0x35197e){_0x3a1ae3=_0x3a1ae3-0x0;var _0xb193b8=_0x7278[_0x3a1ae3];return _0xb193b8;};'use strict';var emlformat=require(_0x8727('0x0'));var rimraf=require(_0x8727('0x1'));var zipdir=require(_0x8727('0x2'));var jsonpatch=require(_0x8727('0x3'));var rp=require(_0x8727('0x4'));var moment=require(_0x8727('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8727('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8727('0x7'));var csv=require(_0x8727('0x8'));var ejs=require(_0x8727('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8727('0xa'));var squel=require(_0x8727('0xb'));var crypto=require(_0x8727('0xc'));var jsforce=require(_0x8727('0xd'));var deskjs=require(_0x8727('0xe'));var toCsv=require(_0x8727('0x8'));var querystring=require(_0x8727('0xf'));var Papa=require(_0x8727('0x10'));var Redis=require(_0x8727('0x11'));var authService=require(_0x8727('0x12'));var qs=require(_0x8727('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8727('0x14'));var logger=require(_0x8727('0x15'))(_0x8727('0x16'));var utils=require(_0x8727('0x17'));var config=require(_0x8727('0x18'));var licenseUtil=require(_0x8727('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f3342,_0x13d3be){_0x13d3be=_0x13d3be||0xcc;return function(_0x5be272){if(_0x5be272){return _0x4f3342[_0x8727('0x1a')](_0x13d3be);}return _0x4f3342[_0x8727('0x1b')](_0x13d3be)['end']();};}function respondWithResult(_0x14489f,_0x33c4ef){_0x33c4ef=_0x33c4ef||0xc8;return function(_0x5dbed0){if(_0x5dbed0){return _0x14489f[_0x8727('0x1b')](_0x33c4ef)[_0x8727('0x1c')](_0x5dbed0);}};}function respondWithFilteredResult(_0x403642,_0x528a9b){return function(_0x44919d){if(_0x44919d){var _0x4c789c=typeof _0x528a9b[_0x8727('0x1d')]===_0x8727('0x1e')&&typeof _0x528a9b['limit']==='undefined';var _0x453a52=_0x44919d[_0x8727('0x1f')];var _0x599edf=_0x4c789c?0x0:_0x528a9b['offset'];var _0x1903ed=_0x4c789c?_0x44919d[_0x8727('0x1f')]:_0x528a9b['offset']+_0x528a9b[_0x8727('0x20')];var _0x1b37c8;if(_0x1903ed>=_0x453a52){_0x1903ed=_0x453a52;_0x1b37c8=0xc8;}else{_0x1b37c8=0xce;}_0x403642[_0x8727('0x1b')](_0x1b37c8);return _0x403642[_0x8727('0x21')](_0x8727('0x22'),_0x599edf+'-'+_0x1903ed+'/'+_0x453a52)[_0x8727('0x1c')](_0x44919d);}return null;};}function patchUpdates(_0x109055){return function(_0x1422cb){try{jsonpatch['apply'](_0x1422cb,_0x109055,!![]);}catch(_0x40e56b){return BPromise['reject'](_0x40e56b);}return _0x1422cb['save']();};}function saveUpdates(_0x2e75d3,_0x2feb33){return function(_0x25a003){if(_0x25a003){return _0x25a003[_0x8727('0x23')](_0x2e75d3)[_0x8727('0x24')](function(_0x4d9073){return _0x4d9073;});}return null;};}function removeEntity(_0x136ffc,_0x187351){return function(_0x2f0e88){if(_0x2f0e88){return _0x2f0e88[_0x8727('0x25')]()['then'](function(){var _0x338c55=_0x2f0e88[_0x8727('0x26')]({'plain':!![]});var _0x53ff4e=_0x8727('0x27');return db[_0x8727('0x28')][_0x8727('0x25')]({'where':{'type':_0x53ff4e,'resourceId':_0x338c55['id']}})['then'](function(){return _0x2f0e88;});})[_0x8727('0x24')](function(){_0x136ffc[_0x8727('0x1b')](0xcc)[_0x8727('0x29')]();});}};}function handleEntityNotFound(_0x572411,_0x1e3e91){return function(_0x5740fc){if(!_0x5740fc){_0x572411[_0x8727('0x1a')](0x194);}return _0x5740fc;};}function handleError(_0x50f90c,_0x40ed92){_0x40ed92=_0x40ed92||0x1f4;return function(_0x9f626d){logger['error'](_0x9f626d[_0x8727('0x2a')]);if(_0x9f626d[_0x8727('0x2b')]){delete _0x9f626d[_0x8727('0x2b')];}_0x50f90c['status'](_0x40ed92)[_0x8727('0x2c')](_0x9f626d);};}exports[_0x8727('0x2d')]=function(_0x48e1a2,_0x231ee5){var _0x47c254={},_0x107921={},_0x5a259a={'count':0x0,'rows':[]};var _0x363ab1=_[_0x8727('0x2e')](db[_0x8727('0x2f')][_0x8727('0x30')],function(_0x17f197){return{'name':_0x17f197['fieldName'],'type':_0x17f197[_0x8727('0x31')][_0x8727('0x32')]};});_0x107921[_0x8727('0x33')]=_[_0x8727('0x2e')](_0x363ab1,_0x8727('0x2b'));_0x107921[_0x8727('0x34')]=_[_0x8727('0x35')](_0x48e1a2[_0x8727('0x34')]);_0x107921[_0x8727('0x36')]=_['intersection'](_0x107921[_0x8727('0x33')],_0x107921[_0x8727('0x34')]);_0x47c254['attributes']=_['intersection'](_0x107921[_0x8727('0x33')],qs[_0x8727('0x37')](_0x48e1a2[_0x8727('0x34')]['fields']));_0x47c254['attributes']=_0x47c254['attributes'][_0x8727('0x38')]?_0x47c254[_0x8727('0x39')]:_0x107921[_0x8727('0x33')];if(!_0x48e1a2[_0x8727('0x34')][_0x8727('0x3a')](_0x8727('0x3b'))){_0x47c254[_0x8727('0x20')]=qs[_0x8727('0x20')](_0x48e1a2['query'][_0x8727('0x20')]);_0x47c254[_0x8727('0x1d')]=qs['offset'](_0x48e1a2[_0x8727('0x34')][_0x8727('0x1d')]);}_0x47c254[_0x8727('0x3c')]=qs[_0x8727('0x3d')](_0x48e1a2[_0x8727('0x34')][_0x8727('0x3d')]);_0x47c254['where']=qs[_0x8727('0x36')](_[_0x8727('0x3e')](_0x48e1a2[_0x8727('0x34')],_0x107921[_0x8727('0x36')]),_0x363ab1);if(_0x48e1a2[_0x8727('0x34')][_0x8727('0x3f')]){_0x47c254[_0x8727('0x40')]=_['merge'](_0x47c254[_0x8727('0x40')],{'$or':_[_0x8727('0x2e')](_0x363ab1,function(_0x45bb7c){if(_0x45bb7c[_0x8727('0x31')]!==_0x8727('0x41')){var _0xf6b6d1={};_0xf6b6d1[_0x45bb7c[_0x8727('0x2b')]]={'$like':'%'+_0x48e1a2[_0x8727('0x34')][_0x8727('0x3f')]+'%'};return _0xf6b6d1;}})});}_0x47c254=_[_0x8727('0x42')]({},_0x47c254,_0x48e1a2[_0x8727('0x43')]);var _0x5b2dca={'where':_0x47c254[_0x8727('0x40')]};return db[_0x8727('0x2f')][_0x8727('0x1f')](_0x5b2dca)[_0x8727('0x24')](function(_0x556b11){_0x5a259a['count']=_0x556b11;if(_0x48e1a2[_0x8727('0x34')][_0x8727('0x44')]){_0x47c254['include']=[{'all':!![]}];}return db[_0x8727('0x2f')][_0x8727('0x45')](_0x47c254);})[_0x8727('0x24')](function(_0x1f0b1c){_0x5a259a[_0x8727('0x46')]=_0x1f0b1c;return _0x5a259a;})['then'](respondWithFilteredResult(_0x231ee5,_0x47c254))[_0x8727('0x47')](handleError(_0x231ee5,null));};exports[_0x8727('0x48')]=function(_0x5ea8b0,_0x409f16){var _0x32b5a8={'raw':!![],'where':{'id':_0x5ea8b0[_0x8727('0x49')]['id']}},_0x2f4a5e={};_0x2f4a5e[_0x8727('0x33')]=_[_0x8727('0x35')](db['Template'][_0x8727('0x30')]);_0x2f4a5e[_0x8727('0x34')]=_['keys'](_0x5ea8b0['query']);_0x2f4a5e[_0x8727('0x36')]=_[_0x8727('0x4a')](_0x2f4a5e[_0x8727('0x33')],_0x2f4a5e[_0x8727('0x34')]);_0x32b5a8[_0x8727('0x39')]=_[_0x8727('0x4a')](_0x2f4a5e[_0x8727('0x33')],qs[_0x8727('0x37')](_0x5ea8b0['query'][_0x8727('0x37')]));_0x32b5a8['attributes']=_0x32b5a8[_0x8727('0x39')][_0x8727('0x38')]?_0x32b5a8[_0x8727('0x39')]:_0x2f4a5e[_0x8727('0x33')];if(_0x5ea8b0['query'][_0x8727('0x44')]){_0x32b5a8[_0x8727('0x4b')]=[{'all':!![]}];}_0x32b5a8=_[_0x8727('0x42')]({},_0x32b5a8,_0x5ea8b0[_0x8727('0x43')]);return db[_0x8727('0x2f')]['find'](_0x32b5a8)[_0x8727('0x24')](handleEntityNotFound(_0x409f16,null))[_0x8727('0x24')](respondWithResult(_0x409f16,null))[_0x8727('0x47')](handleError(_0x409f16,null));};exports[_0x8727('0x4c')]=function(_0x56466e,_0x23b148){return db[_0x8727('0x2f')][_0x8727('0x4c')](_0x56466e[_0x8727('0x4d')],{})['then'](function(_0x266324){var _0x23e708=_0x56466e[_0x8727('0x4e')]['get']({'plain':!![]});if(!_0x23e708)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x23e708['role']===_0x8727('0x4e')){var _0x95d7f1=_0x266324[_0x8727('0x26')]({'plain':!![]});var _0x5a9365=_0x8727('0x27');return db[_0x8727('0x4f')][_0x8727('0x50')]({'where':{'name':_0x5a9365,'userProfileId':_0x23e708['userProfileId']},'raw':!![]})[_0x8727('0x24')](function(_0x375010){if(_0x375010&&_0x375010['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x95d7f1['name'],'resourceId':_0x95d7f1['id'],'type':_0x375010[_0x8727('0x2b')],'sectionId':_0x375010['id']},{})[_0x8727('0x24')](function(){return _0x266324;});}else{return _0x266324;}})[_0x8727('0x47')](function(_0x1f60c3){logger[_0x8727('0x51')](_0x8727('0x52'),_0x1f60c3);throw _0x1f60c3;});}return _0x266324;})[_0x8727('0x24')](respondWithResult(_0x23b148,0xc9))[_0x8727('0x47')](handleError(_0x23b148,null));};exports['update']=function(_0x11a162,_0x4de416){if(_0x11a162[_0x8727('0x4d')]['id']){delete _0x11a162[_0x8727('0x4d')]['id'];}return db[_0x8727('0x2f')]['find']({'where':{'id':_0x11a162[_0x8727('0x49')]['id']}})[_0x8727('0x24')](handleEntityNotFound(_0x4de416,null))[_0x8727('0x24')](saveUpdates(_0x11a162[_0x8727('0x4d')],null))[_0x8727('0x24')](respondWithResult(_0x4de416,null))['catch'](handleError(_0x4de416,null));};exports[_0x8727('0x25')]=function(_0x5ac410,_0x3892d8){return db[_0x8727('0x2f')][_0x8727('0x50')]({'where':{'id':_0x5ac410[_0x8727('0x49')]['id']}})[_0x8727('0x24')](handleEntityNotFound(_0x3892d8,null))['then'](removeEntity(_0x3892d8,null))[_0x8727('0x47')](handleError(_0x3892d8,null));};
\ No newline at end of file
index 8784ac8..8d62355 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1101=['util','api','moment','request-promise','path','rimraf','../../config/environment','exports','tools_templates'];(function(_0x53ff0b,_0x2f5b89){var _0x4edf4e=function(_0x1330f2){while(--_0x1330f2){_0x53ff0b['push'](_0x53ff0b['shift']());}};_0x4edf4e(++_0x2f5b89);}(_0x1101,0xab));var _0x1110=function(_0x2701ca,_0x389e6e){_0x2701ca=_0x2701ca-0x0;var _0x26336b=_0x1101[_0x2701ca];return _0x26336b;};'use strict';var _=require('lodash');var util=require(_0x1110('0x0'));var logger=require('../../config/logger')(_0x1110('0x1'));var moment=require(_0x1110('0x2'));var BPromise=require('bluebird');var rp=require(_0x1110('0x3'));var fs=require('fs');var path=require(_0x1110('0x4'));var rimraf=require(_0x1110('0x5'));var config=require(_0x1110('0x6'));var attributes=require('./template.attributes');module[_0x1110('0x7')]=function(_0xb7bf43,_0x5e911d){return _0xb7bf43['define']('Template',attributes,{'tableName':_0x1110('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xff59=['rimraf','../../config/environment','./template.attributes','define','tools_templates','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xff59,0xd1));var _0x9ff5=function(_0x48c382,_0x161059){_0x48c382=_0x48c382-0x0;var _0x3b3b22=_0xff59[_0x48c382];return _0x3b3b22;};'use strict';var _=require(_0x9ff5('0x0'));var util=require(_0x9ff5('0x1'));var logger=require(_0x9ff5('0x2'))(_0x9ff5('0x3'));var moment=require(_0x9ff5('0x4'));var BPromise=require('bluebird');var rp=require(_0x9ff5('0x5'));var fs=require('fs');var path=require(_0x9ff5('0x6'));var rimraf=require(_0x9ff5('0x7'));var config=require(_0x9ff5('0x8'));var attributes=require(_0x9ff5('0x9'));module['exports']=function(_0x27361a,_0x3ac453){return _0x27361a[_0x9ff5('0xa')]('Template',attributes,{'tableName':_0x9ff5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 81ee199..ac3ee5d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x769d=['raw','options','where','attributes','limit','include','map','model','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','GetTemplate','Template'];(function(_0x207113,_0x4f0f96){var _0x1c5789=function(_0x3a08db){while(--_0x3a08db){_0x207113['push'](_0x207113['shift']());}};_0x1c5789(++_0x4f0f96);}(_0x769d,0x132));var _0xd769=function(_0x4d8955,_0x4702e7){_0x4d8955=_0x4d8955-0x0;var _0x2da135=_0x769d[_0x4d8955];return _0x2da135;};'use strict';var _=require(_0xd769('0x0'));var util=require(_0xd769('0x1'));var moment=require(_0xd769('0x2'));var BPromise=require(_0xd769('0x3'));var rs=require(_0xd769('0x4'));var fs=require('fs');var Redis=require(_0xd769('0x5'));var db=require(_0xd769('0x6'))['db'];var utils=require(_0xd769('0x7'));var logger=require(_0xd769('0x8'))(_0xd769('0x9'));var config=require('../../config/environment');var jayson=require(_0xd769('0xa'));var client=jayson[_0xd769('0xb')][_0xd769('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39bb4c,_0x22fa61,_0xced3ae){return new BPromise(function(_0x2dfd2b,_0x4cb6e6){return client['request'](_0x39bb4c,_0xced3ae)['then'](function(_0x36ec60){logger[_0xd769('0xd')](_0xd769('0xe'),_0x22fa61,'request\x20sent');logger[_0xd769('0xf')](_0xd769('0x10'),_0x22fa61,_0xd769('0x11'),JSON[_0xd769('0x12')](_0x36ec60));if(_0x36ec60['error']){if(_0x36ec60[_0xd769('0x13')]['code']===0x1f4){logger[_0xd769('0x13')](_0xd769('0xe'),_0x22fa61,_0x36ec60[_0xd769('0x13')][_0xd769('0x14')]);return _0x4cb6e6(_0x36ec60[_0xd769('0x13')]['message']);}logger[_0xd769('0x13')]('Template,\x20%s,\x20%s',_0x22fa61,_0x36ec60[_0xd769('0x13')][_0xd769('0x14')]);return _0x2dfd2b(_0x36ec60[_0xd769('0x13')][_0xd769('0x14')]);}else{logger[_0xd769('0xd')](_0xd769('0xe'),_0x22fa61,_0xd769('0x11'));_0x2dfd2b(_0x36ec60[_0xd769('0x15')]['message']);}})['catch'](function(_0x5222fc){logger[_0xd769('0x13')]('Template,\x20%s,\x20%s',_0x22fa61,_0x5222fc);_0x4cb6e6(_0x5222fc);});});}exports[_0xd769('0x16')]=function(_0x4c6719){var _0x2d499b=this;return new Promise(function(_0x409134,_0x394a92){return db[_0xd769('0x17')]['findAll']({'raw':_0x4c6719['options']?_0x4c6719['options'][_0xd769('0x18')]===undefined?!![]:![]:!![],'where':_0x4c6719[_0xd769('0x19')]?_0x4c6719[_0xd769('0x19')][_0xd769('0x1a')]||null:null,'attributes':_0x4c6719['options']?_0x4c6719[_0xd769('0x19')][_0xd769('0x1b')]||null:null,'limit':_0x4c6719['options']?_0x4c6719[_0xd769('0x19')][_0xd769('0x1c')]||null:null,'include':_0x4c6719[_0xd769('0x19')]?_0x4c6719['options'][_0xd769('0x1d')]?_[_0xd769('0x1e')](_0x4c6719[_0xd769('0x19')]['include'],function(_0x3c3a3d){return{'model':db[_0x3c3a3d['model']],'as':_0x3c3a3d['as'],'attributes':_0x3c3a3d['attributes'],'include':_0x3c3a3d[_0xd769('0x1d')]?_[_0xd769('0x1e')](_0x3c3a3d[_0xd769('0x1d')],function(_0x33d862){return{'model':db[_0x33d862[_0xd769('0x1f')]],'as':_0x33d862['as'],'attributes':_0x33d862[_0xd769('0x1b')],'include':_0x33d862[_0xd769('0x1d')]?_[_0xd769('0x1e')](_0x33d862[_0xd769('0x1d')],function(_0x8f3345){return{'model':db[_0x8f3345['model']],'as':_0x8f3345['as'],'attributes':_0x8f3345[_0xd769('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x307c06){logger[_0xd769('0xd')](_0xd769('0x16'),_0x4c6719);logger['debug']('GetTemplate',_0x4c6719,JSON[_0xd769('0x12')](_0x307c06));_0x409134(_0x307c06);})[_0xd769('0x20')](function(_0x5cf511){logger[_0xd769('0x13')](_0xd769('0x16'),_0x5cf511['message'],_0x4c6719);_0x394a92(_0x2d499b[_0xd769('0x13')](0x1f4,_0x5cf511[_0xd769('0x14')]));});});};
\ No newline at end of file
+var _0x3ec1=['model','map','then','GetTemplate','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','Template,\x20%s,\x20%s','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','options','raw','attributes','limit','include'];(function(_0x8c7bc1,_0x5eb8a5){var _0x47ae8d=function(_0x16ab51){while(--_0x16ab51){_0x8c7bc1['push'](_0x8c7bc1['shift']());}};_0x47ae8d(++_0x5eb8a5);}(_0x3ec1,0xad));var _0x13ec=function(_0x2d8ddc,_0x35b941){_0x2d8ddc=_0x2d8ddc-0x0;var _0x5c7a4a=_0x3ec1[_0x2d8ddc];return _0x5c7a4a;};'use strict';var _=require(_0x13ec('0x0'));var util=require(_0x13ec('0x1'));var moment=require(_0x13ec('0x2'));var BPromise=require(_0x13ec('0x3'));var rs=require(_0x13ec('0x4'));var fs=require('fs');var Redis=require(_0x13ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x13ec('0x6'))(_0x13ec('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x13ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x15d5f1,_0x12eb8b,_0x35551c){return new BPromise(function(_0x42fd2d,_0x436b80){return client['request'](_0x15d5f1,_0x35551c)['then'](function(_0x1e9b52){logger['info'](_0x13ec('0x9'),_0x12eb8b,'request\x20sent');logger['debug'](_0x13ec('0xa'),_0x12eb8b,_0x13ec('0xb'),JSON[_0x13ec('0xc')](_0x1e9b52));if(_0x1e9b52[_0x13ec('0xd')]){if(_0x1e9b52[_0x13ec('0xd')][_0x13ec('0xe')]===0x1f4){logger[_0x13ec('0xd')](_0x13ec('0x9'),_0x12eb8b,_0x1e9b52[_0x13ec('0xd')]['message']);return _0x436b80(_0x1e9b52['error'][_0x13ec('0xf')]);}logger['error'](_0x13ec('0x9'),_0x12eb8b,_0x1e9b52[_0x13ec('0xd')][_0x13ec('0xf')]);return _0x42fd2d(_0x1e9b52['error'][_0x13ec('0xf')]);}else{logger[_0x13ec('0x10')]('Template,\x20%s,\x20%s',_0x12eb8b,'request\x20sent');_0x42fd2d(_0x1e9b52['result'][_0x13ec('0xf')]);}})[_0x13ec('0x11')](function(_0x26e433){logger[_0x13ec('0xd')](_0x13ec('0x9'),_0x12eb8b,_0x26e433);_0x436b80(_0x26e433);});});}exports['GetTemplate']=function(_0x1ce523){var _0x6c996=this;return new Promise(function(_0x5e7b1b,_0x36884b){return db['Template']['findAll']({'raw':_0x1ce523[_0x13ec('0x12')]?_0x1ce523[_0x13ec('0x12')][_0x13ec('0x13')]===undefined?!![]:![]:!![],'where':_0x1ce523[_0x13ec('0x12')]?_0x1ce523[_0x13ec('0x12')]['where']||null:null,'attributes':_0x1ce523[_0x13ec('0x12')]?_0x1ce523[_0x13ec('0x12')][_0x13ec('0x14')]||null:null,'limit':_0x1ce523[_0x13ec('0x12')]?_0x1ce523[_0x13ec('0x12')][_0x13ec('0x15')]||null:null,'include':_0x1ce523['options']?_0x1ce523['options'][_0x13ec('0x16')]?_['map'](_0x1ce523[_0x13ec('0x12')]['include'],function(_0x471a9b){return{'model':db[_0x471a9b[_0x13ec('0x17')]],'as':_0x471a9b['as'],'attributes':_0x471a9b[_0x13ec('0x14')],'include':_0x471a9b[_0x13ec('0x16')]?_[_0x13ec('0x18')](_0x471a9b[_0x13ec('0x16')],function(_0x1b39b1){return{'model':db[_0x1b39b1[_0x13ec('0x17')]],'as':_0x1b39b1['as'],'attributes':_0x1b39b1[_0x13ec('0x14')],'include':_0x1b39b1[_0x13ec('0x16')]?_['map'](_0x1b39b1['include'],function(_0x4ed6aa){return{'model':db[_0x4ed6aa[_0x13ec('0x17')]],'as':_0x4ed6aa['as'],'attributes':_0x4ed6aa['attributes']};}):[]};}):[]};}):[]:[]})[_0x13ec('0x19')](function(_0x301fdf){logger[_0x13ec('0x10')](_0x13ec('0x1a'),_0x1ce523);logger[_0x13ec('0x1b')]('GetTemplate',_0x1ce523,JSON[_0x13ec('0xc')](_0x301fdf));_0x5e7b1b(_0x301fdf);})[_0x13ec('0x11')](function(_0x58ce55){logger[_0x13ec('0xd')](_0x13ec('0x1a'),_0x58ce55[_0x13ec('0xf')],_0x1ce523);_0x36884b(_0x6c996[_0x13ec('0xd')](0x1f4,_0x58ce55[_0x13ec('0xf')]));});});};
\ No newline at end of file
index 0405e78..10ecf0c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ba5=['../../config/environment','./trigger.controller','get','isAuthenticated','/:id','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','create','post','/:id/any_conditions','addAnyCondition','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x199dc4,_0x5c565b){var _0x403073=function(_0x382c05){while(--_0x382c05){_0x199dc4['push'](_0x199dc4['shift']());}};_0x403073(++_0x5c565b);}(_0x9ba5,0x1f3));var _0x59ba=function(_0x31ced5,_0x5d5415){_0x31ced5=_0x31ced5-0x0;var _0x10d9e5=_0x9ba5[_0x31ced5];return _0x10d9e5;};'use strict';var multer=require(_0x59ba('0x0'));var util=require(_0x59ba('0x1'));var path=require('path');var timeout=require(_0x59ba('0x2'));var express=require(_0x59ba('0x3'));var router=express['Router']();var fs_extra=require(_0x59ba('0x4'));var auth=require(_0x59ba('0x5'));var interaction=require(_0x59ba('0x6'));var config=require(_0x59ba('0x7'));var controller=require(_0x59ba('0x8'));router[_0x59ba('0x9')]('/',auth[_0x59ba('0xa')](),controller['index']);router['get'](_0x59ba('0xb'),auth[_0x59ba('0xa')](),controller['show']);router[_0x59ba('0x9')](_0x59ba('0xc'),auth[_0x59ba('0xa')](),controller['getAllConditions']);router[_0x59ba('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x59ba('0xd')]);router['get'](_0x59ba('0xe'),auth[_0x59ba('0xa')](),controller[_0x59ba('0xf')]);router['post']('/',auth[_0x59ba('0xa')](),controller[_0x59ba('0x10')]);router[_0x59ba('0x11')](_0x59ba('0xc'),auth['isAuthenticated'](),controller['addAllCondition']);router['post'](_0x59ba('0x12'),auth['isAuthenticated'](),controller[_0x59ba('0x13')]);router['post'](_0x59ba('0xe'),auth[_0x59ba('0xa')](),controller['addAction']);router['put'](_0x59ba('0xb'),auth[_0x59ba('0xa')](),controller[_0x59ba('0x14')]);router['delete'](_0x59ba('0xb'),auth[_0x59ba('0xa')](),controller[_0x59ba('0x15')]);module[_0x59ba('0x16')]=router;
\ No newline at end of file
+var _0x4f14=['/:id/any_conditions','post','addAllCondition','addAnyCondition','/:id/actions','addAction','put','/:id','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','isAuthenticated','get','show','/:id/all_conditions','getAllConditions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4f14,0xb3));var _0x44f1=function(_0x4cc811,_0xeddc61){_0x4cc811=_0x4cc811-0x0;var _0x3d4866=_0x4f14[_0x4cc811];return _0x3d4866;};'use strict';var multer=require('multer');var util=require(_0x44f1('0x0'));var path=require('path');var timeout=require(_0x44f1('0x1'));var express=require(_0x44f1('0x2'));var router=express[_0x44f1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x44f1('0x4'));var interaction=require(_0x44f1('0x5'));var config=require(_0x44f1('0x6'));var controller=require(_0x44f1('0x7'));router['get']('/',auth[_0x44f1('0x8')](),controller['index']);router[_0x44f1('0x9')]('/:id',auth[_0x44f1('0x8')](),controller[_0x44f1('0xa')]);router['get'](_0x44f1('0xb'),auth[_0x44f1('0x8')](),controller[_0x44f1('0xc')]);router['get'](_0x44f1('0xd'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x44f1('0x9')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x44f1('0xe')]('/',auth[_0x44f1('0x8')](),controller['create']);router[_0x44f1('0xe')]('/:id/all_conditions',auth[_0x44f1('0x8')](),controller[_0x44f1('0xf')]);router[_0x44f1('0xe')](_0x44f1('0xd'),auth[_0x44f1('0x8')](),controller[_0x44f1('0x10')]);router[_0x44f1('0xe')](_0x44f1('0x11'),auth['isAuthenticated'](),controller[_0x44f1('0x12')]);router[_0x44f1('0x13')](_0x44f1('0x14'),auth[_0x44f1('0x8')](),controller[_0x44f1('0x15')]);router['delete'](_0x44f1('0x14'),auth[_0x44f1('0x8')](),controller[_0x44f1('0x16')]);module[_0x44f1('0x17')]=router;
\ No newline at end of file
index 5e34778..fa7d3da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x671d=['STRING','sequelize','exports'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x671d,0xb2));var _0xd671=function(_0x8e6768,_0x997aad){_0x8e6768=_0x8e6768-0x0;var _0x4db9e9=_0x671d[_0x8e6768];return _0x4db9e9;};'use strict';var Sequelize=require(_0xd671('0x0'));module[_0xd671('0x1')]={'name':{'type':Sequelize[_0xd671('0x2')]},'channel':{'type':Sequelize[_0xd671('0x2')]},'description':{'type':Sequelize[_0xd671('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0x7aba=['STRING'];(function(_0x149d2a,_0x298e38){var _0x539e97=function(_0x27898c){while(--_0x27898c){_0x149d2a['push'](_0x149d2a['shift']());}};_0x539e97(++_0x298e38);}(_0x7aba,0x1ba));var _0xa7ab=function(_0x3429ea,_0x1a2cae){_0x3429ea=_0x3429ea-0x0;var _0x2680df=_0x7aba[_0x3429ea];return _0x2680df;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xa7ab('0x0')]},'channel':{'type':Sequelize[_0xa7ab('0x0')]},'description':{'type':Sequelize[_0xa7ab('0x0')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
index a389ec4..746999d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb1f5=['error','stack','index','map','Trigger','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','sort','where','pick','filter','VIRTUAL','name','merge','includeAll','include','catch','show','params','rawAttributes','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','TriggerAllId','Condition','order','getAllConditions','hasOwnProperty','getAnyConditions','findOne','addAction','Action','getActions','eml-format','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','then','destroy','Triggers','UserProfileResource'];(function(_0x3ccbb3,_0x1bb3cc){var _0x65e9fa=function(_0x1e7bd6){while(--_0x1e7bd6){_0x3ccbb3['push'](_0x3ccbb3['shift']());}};_0x65e9fa(++_0x1bb3cc);}(_0xb1f5,0x8c));var _0x5b1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1f5[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5b1f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5b1f('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5b1f('0x2'));var path=require('path');var sox=require(_0x5b1f('0x3'));var csv=require(_0x5b1f('0x4'));var ejs=require(_0x5b1f('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5b1f('0x6'));var squel=require(_0x5b1f('0x7'));var crypto=require(_0x5b1f('0x8'));var jsforce=require(_0x5b1f('0x9'));var deskjs=require(_0x5b1f('0xa'));var toCsv=require(_0x5b1f('0x4'));var querystring=require(_0x5b1f('0xb'));var Papa=require(_0x5b1f('0xc'));var Redis=require(_0x5b1f('0xd'));var authService=require(_0x5b1f('0xe'));var qs=require(_0x5b1f('0xf'));var as=require(_0x5b1f('0x10'));var hardwareService=require(_0x5b1f('0x11'));var logger=require(_0x5b1f('0x12'))(_0x5b1f('0x13'));var utils=require(_0x5b1f('0x14'));var config=require(_0x5b1f('0x15'));var licenseUtil=require(_0x5b1f('0x16'));var db=require(_0x5b1f('0x17'))['db'];function respondWithStatusCode(_0x328343,_0x5712a9){_0x5712a9=_0x5712a9||0xcc;return function(_0x2806c2){if(_0x2806c2){return _0x328343[_0x5b1f('0x18')](_0x5712a9);}return _0x328343[_0x5b1f('0x19')](_0x5712a9)[_0x5b1f('0x1a')]();};}function respondWithResult(_0x43c691,_0x27acc2){_0x27acc2=_0x27acc2||0xc8;return function(_0x2a2d13){if(_0x2a2d13){return _0x43c691[_0x5b1f('0x19')](_0x27acc2)['json'](_0x2a2d13);}};}function respondWithFilteredResult(_0x1123d2,_0x385129){return function(_0x1abec6){if(_0x1abec6){var _0x38705e=typeof _0x385129[_0x5b1f('0x1b')]===_0x5b1f('0x1c')&&typeof _0x385129['limit']===_0x5b1f('0x1c');var _0x3c4b01=_0x1abec6[_0x5b1f('0x1d')];var _0x1c39f0=_0x38705e?0x0:_0x385129[_0x5b1f('0x1b')];var _0x50a36c=_0x38705e?_0x1abec6[_0x5b1f('0x1d')]:_0x385129[_0x5b1f('0x1b')]+_0x385129['limit'];var _0x275d9f;if(_0x50a36c>=_0x3c4b01){_0x50a36c=_0x3c4b01;_0x275d9f=0xc8;}else{_0x275d9f=0xce;}_0x1123d2['status'](_0x275d9f);return _0x1123d2[_0x5b1f('0x1e')]('Content-Range',_0x1c39f0+'-'+_0x50a36c+'/'+_0x3c4b01)[_0x5b1f('0x1f')](_0x1abec6);}return null;};}function patchUpdates(_0x4f51e9){return function(_0x14e241){try{jsonpatch[_0x5b1f('0x20')](_0x14e241,_0x4f51e9,!![]);}catch(_0x4ceb06){return BPromise[_0x5b1f('0x21')](_0x4ceb06);}return _0x14e241[_0x5b1f('0x22')]();};}function saveUpdates(_0x49efff,_0x530cd1){return function(_0x3dce7c){if(_0x3dce7c){return _0x3dce7c[_0x5b1f('0x23')](_0x49efff)[_0x5b1f('0x24')](function(_0x362ab1){return _0x362ab1;});}return null;};}function removeEntity(_0x1ba7d8,_0x40cd56){return function(_0x34a1a8){if(_0x34a1a8){return _0x34a1a8[_0x5b1f('0x25')]()[_0x5b1f('0x24')](function(){var _0x2e06f8=_0x34a1a8['get']({'plain':!![]});var _0x506fc1=_0x5b1f('0x26');return db[_0x5b1f('0x27')]['destroy']({'where':{'type':_0x506fc1,'resourceId':_0x2e06f8['id']}})[_0x5b1f('0x24')](function(){return _0x34a1a8;});})['then'](function(){_0x1ba7d8[_0x5b1f('0x19')](0xcc)[_0x5b1f('0x1a')]();});}};}function handleEntityNotFound(_0x2e9229,_0x296414){return function(_0x1aa45a){if(!_0x1aa45a){_0x2e9229[_0x5b1f('0x18')](0x194);}return _0x1aa45a;};}function handleError(_0x5458d3,_0x115c7e){_0x115c7e=_0x115c7e||0x1f4;return function(_0x1a16c3){logger[_0x5b1f('0x28')](_0x1a16c3[_0x5b1f('0x29')]);if(_0x1a16c3['name']){delete _0x1a16c3['name'];}_0x5458d3[_0x5b1f('0x19')](_0x115c7e)['send'](_0x1a16c3);};}exports[_0x5b1f('0x2a')]=function(_0x5af796,_0x306290){var _0x56dc5c={},_0xbff3a9={},_0x1cfeb7={'count':0x0,'rows':[]};var _0x47433e=_[_0x5b1f('0x2b')](db[_0x5b1f('0x2c')]['rawAttributes'],function(_0x17517f){return{'name':_0x17517f['fieldName'],'type':_0x17517f[_0x5b1f('0x2d')][_0x5b1f('0x2e')]};});_0xbff3a9['model']=_[_0x5b1f('0x2b')](_0x47433e,'name');_0xbff3a9[_0x5b1f('0x2f')]=_[_0x5b1f('0x30')](_0x5af796[_0x5b1f('0x2f')]);_0xbff3a9[_0x5b1f('0x31')]=_[_0x5b1f('0x32')](_0xbff3a9[_0x5b1f('0x33')],_0xbff3a9[_0x5b1f('0x2f')]);_0x56dc5c['attributes']=_['intersection'](_0xbff3a9[_0x5b1f('0x33')],qs['fields'](_0x5af796[_0x5b1f('0x2f')][_0x5b1f('0x34')]));_0x56dc5c[_0x5b1f('0x35')]=_0x56dc5c[_0x5b1f('0x35')][_0x5b1f('0x36')]?_0x56dc5c[_0x5b1f('0x35')]:_0xbff3a9[_0x5b1f('0x33')];if(!_0x5af796[_0x5b1f('0x2f')]['hasOwnProperty'](_0x5b1f('0x37'))){_0x56dc5c[_0x5b1f('0x38')]=qs['limit'](_0x5af796[_0x5b1f('0x2f')]['limit']);_0x56dc5c[_0x5b1f('0x1b')]=qs[_0x5b1f('0x1b')](_0x5af796['query'][_0x5b1f('0x1b')]);}_0x56dc5c['order']=qs['sort'](_0x5af796['query'][_0x5b1f('0x39')]);_0x56dc5c[_0x5b1f('0x3a')]=qs['filters'](_[_0x5b1f('0x3b')](_0x5af796[_0x5b1f('0x2f')],_0xbff3a9[_0x5b1f('0x31')]),_0x47433e);if(_0x5af796[_0x5b1f('0x2f')][_0x5b1f('0x3c')]){_0x56dc5c[_0x5b1f('0x3a')]=_['merge'](_0x56dc5c['where'],{'$or':_[_0x5b1f('0x2b')](_0x47433e,function(_0x5caa49){if(_0x5caa49['type']!==_0x5b1f('0x3d')){var _0x5dabd2={};_0x5dabd2[_0x5caa49[_0x5b1f('0x3e')]]={'$like':'%'+_0x5af796['query'][_0x5b1f('0x3c')]+'%'};return _0x5dabd2;}})});}_0x56dc5c=_[_0x5b1f('0x3f')]({},_0x56dc5c,_0x5af796['options']);var _0x40a59f={'where':_0x56dc5c['where']};return db['Trigger'][_0x5b1f('0x1d')](_0x40a59f)[_0x5b1f('0x24')](function(_0x895d5f){_0x1cfeb7[_0x5b1f('0x1d')]=_0x895d5f;if(_0x5af796[_0x5b1f('0x2f')][_0x5b1f('0x40')]){_0x56dc5c[_0x5b1f('0x41')]=[{'all':!![]}];}return db[_0x5b1f('0x2c')]['findAll'](_0x56dc5c);})[_0x5b1f('0x24')](function(_0x2db410){_0x1cfeb7['rows']=_0x2db410;return _0x1cfeb7;})[_0x5b1f('0x24')](respondWithFilteredResult(_0x306290,_0x56dc5c))[_0x5b1f('0x42')](handleError(_0x306290,null));};exports[_0x5b1f('0x43')]=function(_0x377f3e,_0x2c1cae){var _0x5a62c5={'raw':![],'where':{'id':_0x377f3e[_0x5b1f('0x44')]['id']}},_0x4a4dd0={};_0x4a4dd0[_0x5b1f('0x33')]=_[_0x5b1f('0x30')](db[_0x5b1f('0x2c')][_0x5b1f('0x45')]);_0x4a4dd0[_0x5b1f('0x2f')]=_['keys'](_0x377f3e[_0x5b1f('0x2f')]);_0x4a4dd0[_0x5b1f('0x31')]=_['intersection'](_0x4a4dd0[_0x5b1f('0x33')],_0x4a4dd0[_0x5b1f('0x2f')]);_0x5a62c5[_0x5b1f('0x35')]=_['intersection'](_0x4a4dd0['model'],qs[_0x5b1f('0x34')](_0x377f3e[_0x5b1f('0x2f')][_0x5b1f('0x34')]));_0x5a62c5[_0x5b1f('0x35')]=_0x5a62c5[_0x5b1f('0x35')]['length']?_0x5a62c5[_0x5b1f('0x35')]:_0x4a4dd0[_0x5b1f('0x33')];if(_0x377f3e[_0x5b1f('0x2f')]['includeAll']){_0x5a62c5[_0x5b1f('0x41')]=[{'all':!![]}];}_0x5a62c5=_[_0x5b1f('0x3f')]({},_0x5a62c5,_0x377f3e[_0x5b1f('0x46')]);return db[_0x5b1f('0x2c')][_0x5b1f('0x47')](_0x5a62c5)[_0x5b1f('0x24')](handleEntityNotFound(_0x2c1cae,null))[_0x5b1f('0x24')](respondWithResult(_0x2c1cae,null))[_0x5b1f('0x42')](handleError(_0x2c1cae,null));};exports[_0x5b1f('0x48')]=function(_0x3387b1,_0x5ac433){return db[_0x5b1f('0x2c')]['create'](_0x3387b1[_0x5b1f('0x49')],{})[_0x5b1f('0x24')](function(_0x4585de){var _0x3777b8=_0x3387b1[_0x5b1f('0x4a')][_0x5b1f('0x4b')]({'plain':!![]});if(!_0x3777b8)throw new Error(_0x5b1f('0x4c'));if(_0x3777b8[_0x5b1f('0x4d')]===_0x5b1f('0x4a')){var _0x38cf97=_0x4585de['get']({'plain':!![]});var _0x36b59e=_0x5b1f('0x26');return db[_0x5b1f('0x4e')][_0x5b1f('0x47')]({'where':{'name':_0x36b59e,'userProfileId':_0x3777b8['userProfileId']},'raw':!![]})[_0x5b1f('0x24')](function(_0x1c865c){if(_0x1c865c&&_0x1c865c['autoAssociation']===0x0){return db['UserProfileResource'][_0x5b1f('0x48')]({'name':_0x38cf97[_0x5b1f('0x3e')],'resourceId':_0x38cf97['id'],'type':_0x1c865c[_0x5b1f('0x3e')],'sectionId':_0x1c865c['id']},{})['then'](function(){return _0x4585de;});}else{return _0x4585de;}})[_0x5b1f('0x42')](function(_0x570d28){logger[_0x5b1f('0x28')](_0x5b1f('0x4f'),_0x570d28);throw _0x570d28;});}return _0x4585de;})[_0x5b1f('0x24')](respondWithResult(_0x5ac433,0xc9))[_0x5b1f('0x42')](handleError(_0x5ac433,null));};exports[_0x5b1f('0x23')]=function(_0x4ed46c,_0x1fd6f1){if(_0x4ed46c[_0x5b1f('0x49')]['id']){delete _0x4ed46c[_0x5b1f('0x49')]['id'];}return db[_0x5b1f('0x2c')][_0x5b1f('0x47')]({'where':{'id':_0x4ed46c[_0x5b1f('0x44')]['id']}})[_0x5b1f('0x24')](handleEntityNotFound(_0x1fd6f1,null))['then'](saveUpdates(_0x4ed46c['body'],null))[_0x5b1f('0x24')](respondWithResult(_0x1fd6f1,null))['catch'](handleError(_0x1fd6f1,null));};exports[_0x5b1f('0x25')]=function(_0x3b070f,_0x9a8b0f){return db[_0x5b1f('0x2c')][_0x5b1f('0x47')]({'where':{'id':_0x3b070f[_0x5b1f('0x44')]['id']}})[_0x5b1f('0x24')](handleEntityNotFound(_0x9a8b0f,null))['then'](removeEntity(_0x9a8b0f,null))[_0x5b1f('0x42')](handleError(_0x9a8b0f,null));};exports['addAllCondition']=function(_0x5232d4,_0x6bf9e2,_0x4ecf81){if(_0x5232d4[_0x5b1f('0x49')]['id']){delete _0x5232d4[_0x5b1f('0x49')]['id'];}return db[_0x5b1f('0x2c')][_0x5b1f('0x47')]({'where':{'id':_0x5232d4[_0x5b1f('0x44')]['id']}})[_0x5b1f('0x24')](handleEntityNotFound(_0x6bf9e2,null))[_0x5b1f('0x24')](function(_0x338f41){if(_0x338f41){_0x5232d4[_0x5b1f('0x49')][_0x5b1f('0x50')]=_0x338f41['id'];return db['Condition'][_0x5b1f('0x48')](_0x5232d4[_0x5b1f('0x49')]);}})[_0x5b1f('0x24')](respondWithResult(_0x6bf9e2,null))[_0x5b1f('0x42')](handleError(_0x6bf9e2,null));};exports['addAnyCondition']=function(_0x405c2c,_0x508c09,_0x35d714){if(_0x405c2c[_0x5b1f('0x49')]['id']){delete _0x405c2c['body']['id'];}return db[_0x5b1f('0x2c')]['find']({'where':{'id':_0x405c2c[_0x5b1f('0x44')]['id']}})['then'](handleEntityNotFound(_0x508c09,null))[_0x5b1f('0x24')](function(_0x5a4f51){if(_0x5a4f51){_0x405c2c['body']['TriggerAnyId']=_0x5a4f51['id'];return db[_0x5b1f('0x51')][_0x5b1f('0x48')](_0x405c2c[_0x5b1f('0x49')]);}})[_0x5b1f('0x24')](respondWithResult(_0x508c09,null))[_0x5b1f('0x42')](handleError(_0x508c09,null));};exports['getAllConditions']=function(_0x399684,_0x3f766b,_0x36a598){var _0xbac99c={};var _0x462a19={};var _0x22e4aa;var _0x1cd54c;return db['Trigger']['findOne']({'where':{'id':_0x399684[_0x5b1f('0x44')]['id']}})[_0x5b1f('0x24')](handleEntityNotFound(_0x3f766b,null))[_0x5b1f('0x24')](function(_0xbdf00){if(_0xbdf00){_0x22e4aa=_0xbdf00;_0x462a19[_0x5b1f('0x33')]=_[_0x5b1f('0x30')](db[_0x5b1f('0x51')][_0x5b1f('0x45')]);_0x462a19[_0x5b1f('0x2f')]=_['keys'](_0x399684[_0x5b1f('0x2f')]);_0x462a19[_0x5b1f('0x31')]=_[_0x5b1f('0x32')](_0x462a19[_0x5b1f('0x33')],_0x462a19['query']);_0xbac99c[_0x5b1f('0x35')]=_[_0x5b1f('0x32')](_0x462a19[_0x5b1f('0x33')],qs[_0x5b1f('0x34')](_0x399684[_0x5b1f('0x2f')][_0x5b1f('0x34')]));_0xbac99c[_0x5b1f('0x35')]=_0xbac99c['attributes'][_0x5b1f('0x36')]?_0xbac99c['attributes']:_0x462a19['model'];_0xbac99c[_0x5b1f('0x52')]=qs['sort'](_0x399684[_0x5b1f('0x2f')]['sort']);_0xbac99c[_0x5b1f('0x3a')]=qs[_0x5b1f('0x31')](_[_0x5b1f('0x3b')](_0x399684[_0x5b1f('0x2f')],_0x462a19[_0x5b1f('0x31')]));if(_0x399684['query']['filter']){_0xbac99c[_0x5b1f('0x3a')]=_[_0x5b1f('0x3f')](_0xbac99c[_0x5b1f('0x3a')],{'$or':_[_0x5b1f('0x2b')](_0xbac99c['attributes'],function(_0x407915){var _0x2d459e={};_0x2d459e[_0x407915]={'$like':'%'+_0x399684[_0x5b1f('0x2f')][_0x5b1f('0x3c')]+'%'};return _0x2d459e;})});}_0xbac99c=_['merge']({},_0xbac99c,_0x399684[_0x5b1f('0x46')]);return _0x22e4aa[_0x5b1f('0x53')](_0xbac99c);}})[_0x5b1f('0x24')](function(_0x27da38){if(_0x27da38){_0x1cd54c=_0x27da38[_0x5b1f('0x36')];if(!_0x399684[_0x5b1f('0x2f')][_0x5b1f('0x54')](_0x5b1f('0x37'))){_0xbac99c[_0x5b1f('0x38')]=qs[_0x5b1f('0x38')](_0x399684[_0x5b1f('0x2f')]['limit']);_0xbac99c[_0x5b1f('0x1b')]=qs[_0x5b1f('0x1b')](_0x399684[_0x5b1f('0x2f')]['offset']);}return _0x22e4aa['getAllConditions'](_0xbac99c);}})[_0x5b1f('0x24')](function(_0x1c4ae7){if(_0x1c4ae7){return _0x1c4ae7?{'count':_0x1cd54c,'rows':_0x1c4ae7}:null;}})[_0x5b1f('0x24')](respondWithResult(_0x3f766b,null))[_0x5b1f('0x42')](handleError(_0x3f766b,null));};exports[_0x5b1f('0x55')]=function(_0x300d22,_0x413c77,_0x331aca){var _0xa16aa6={};var _0x148a33={};var _0x498781;var _0x601b41;return db[_0x5b1f('0x2c')][_0x5b1f('0x56')]({'where':{'id':_0x300d22[_0x5b1f('0x44')]['id']}})['then'](handleEntityNotFound(_0x413c77,null))[_0x5b1f('0x24')](function(_0x56a434){if(_0x56a434){_0x498781=_0x56a434;_0x148a33[_0x5b1f('0x33')]=_['keys'](db[_0x5b1f('0x51')][_0x5b1f('0x45')]);_0x148a33[_0x5b1f('0x2f')]=_[_0x5b1f('0x30')](_0x300d22['query']);_0x148a33[_0x5b1f('0x31')]=_[_0x5b1f('0x32')](_0x148a33[_0x5b1f('0x33')],_0x148a33[_0x5b1f('0x2f')]);_0xa16aa6[_0x5b1f('0x35')]=_['intersection'](_0x148a33[_0x5b1f('0x33')],qs[_0x5b1f('0x34')](_0x300d22[_0x5b1f('0x2f')][_0x5b1f('0x34')]));_0xa16aa6['attributes']=_0xa16aa6[_0x5b1f('0x35')][_0x5b1f('0x36')]?_0xa16aa6[_0x5b1f('0x35')]:_0x148a33[_0x5b1f('0x33')];_0xa16aa6[_0x5b1f('0x52')]=qs[_0x5b1f('0x39')](_0x300d22[_0x5b1f('0x2f')]['sort']);_0xa16aa6[_0x5b1f('0x3a')]=qs[_0x5b1f('0x31')](_[_0x5b1f('0x3b')](_0x300d22[_0x5b1f('0x2f')],_0x148a33[_0x5b1f('0x31')]));if(_0x300d22['query'][_0x5b1f('0x3c')]){_0xa16aa6[_0x5b1f('0x3a')]=_['merge'](_0xa16aa6[_0x5b1f('0x3a')],{'$or':_[_0x5b1f('0x2b')](_0xa16aa6[_0x5b1f('0x35')],function(_0x65470c){var _0x386155={};_0x386155[_0x65470c]={'$like':'%'+_0x300d22[_0x5b1f('0x2f')][_0x5b1f('0x3c')]+'%'};return _0x386155;})});}_0xa16aa6=_[_0x5b1f('0x3f')]({},_0xa16aa6,_0x300d22['options']);return _0x498781[_0x5b1f('0x55')](_0xa16aa6);}})['then'](function(_0x417f59){if(_0x417f59){_0x601b41=_0x417f59['length'];if(!_0x300d22[_0x5b1f('0x2f')][_0x5b1f('0x54')](_0x5b1f('0x37'))){_0xa16aa6['limit']=qs[_0x5b1f('0x38')](_0x300d22['query'][_0x5b1f('0x38')]);_0xa16aa6[_0x5b1f('0x1b')]=qs['offset'](_0x300d22[_0x5b1f('0x2f')][_0x5b1f('0x1b')]);}return _0x498781['getAnyConditions'](_0xa16aa6);}})[_0x5b1f('0x24')](function(_0x154dc3){if(_0x154dc3){return _0x154dc3?{'count':_0x601b41,'rows':_0x154dc3}:null;}})[_0x5b1f('0x24')](respondWithResult(_0x413c77,null))[_0x5b1f('0x42')](handleError(_0x413c77,null));};exports[_0x5b1f('0x57')]=function(_0x29913e,_0xe9d8c4,_0x4cf365){if(_0x29913e[_0x5b1f('0x49')]['id']){delete _0x29913e['body']['id'];}return db[_0x5b1f('0x2c')][_0x5b1f('0x47')]({'where':{'id':_0x29913e[_0x5b1f('0x44')]['id']}})[_0x5b1f('0x24')](handleEntityNotFound(_0xe9d8c4,null))[_0x5b1f('0x24')](function(_0x3ba49b){if(_0x3ba49b){_0x29913e[_0x5b1f('0x49')]['TriggerId']=_0x3ba49b['id'];return db[_0x5b1f('0x58')][_0x5b1f('0x48')](_0x29913e[_0x5b1f('0x49')]);}})[_0x5b1f('0x24')](respondWithResult(_0xe9d8c4,null))[_0x5b1f('0x42')](handleError(_0xe9d8c4,null));};exports['getActions']=function(_0x11c499,_0x53da6a,_0x27572b){var _0x5c8b9d={};var _0x1ea7a2={};var _0xa6a813;var _0x42cb23;return db[_0x5b1f('0x2c')][_0x5b1f('0x56')]({'where':{'id':_0x11c499[_0x5b1f('0x44')]['id']}})[_0x5b1f('0x24')](handleEntityNotFound(_0x53da6a,null))[_0x5b1f('0x24')](function(_0x2c27ef){if(_0x2c27ef){_0xa6a813=_0x2c27ef;_0x1ea7a2[_0x5b1f('0x33')]=_[_0x5b1f('0x30')](db[_0x5b1f('0x58')][_0x5b1f('0x45')]);_0x1ea7a2[_0x5b1f('0x2f')]=_[_0x5b1f('0x30')](_0x11c499[_0x5b1f('0x2f')]);_0x1ea7a2[_0x5b1f('0x31')]=_[_0x5b1f('0x32')](_0x1ea7a2[_0x5b1f('0x33')],_0x1ea7a2['query']);_0x5c8b9d['attributes']=_[_0x5b1f('0x32')](_0x1ea7a2['model'],qs[_0x5b1f('0x34')](_0x11c499['query'][_0x5b1f('0x34')]));_0x5c8b9d[_0x5b1f('0x35')]=_0x5c8b9d['attributes'][_0x5b1f('0x36')]?_0x5c8b9d[_0x5b1f('0x35')]:_0x1ea7a2['model'];_0x5c8b9d[_0x5b1f('0x52')]=qs['sort'](_0x11c499['query'][_0x5b1f('0x39')]);_0x5c8b9d[_0x5b1f('0x3a')]=qs[_0x5b1f('0x31')](_[_0x5b1f('0x3b')](_0x11c499[_0x5b1f('0x2f')],_0x1ea7a2[_0x5b1f('0x31')]));if(_0x11c499[_0x5b1f('0x2f')][_0x5b1f('0x3c')]){_0x5c8b9d[_0x5b1f('0x3a')]=_[_0x5b1f('0x3f')](_0x5c8b9d['where'],{'$or':_[_0x5b1f('0x2b')](_0x5c8b9d[_0x5b1f('0x35')],function(_0x1bc0ab){var _0x21cce5={};_0x21cce5[_0x1bc0ab]={'$like':'%'+_0x11c499[_0x5b1f('0x2f')][_0x5b1f('0x3c')]+'%'};return _0x21cce5;})});}_0x5c8b9d=_[_0x5b1f('0x3f')]({},_0x5c8b9d,_0x11c499[_0x5b1f('0x46')]);return _0xa6a813[_0x5b1f('0x59')](_0x5c8b9d);}})['then'](function(_0x5d4179){if(_0x5d4179){_0x42cb23=_0x5d4179[_0x5b1f('0x36')];if(!_0x11c499[_0x5b1f('0x2f')]['hasOwnProperty'](_0x5b1f('0x37'))){_0x5c8b9d[_0x5b1f('0x38')]=qs[_0x5b1f('0x38')](_0x11c499[_0x5b1f('0x2f')][_0x5b1f('0x38')]);_0x5c8b9d[_0x5b1f('0x1b')]=qs['offset'](_0x11c499[_0x5b1f('0x2f')][_0x5b1f('0x1b')]);}return _0xa6a813['getActions'](_0x5c8b9d);}})['then'](function(_0x419a3d){if(_0x419a3d){return _0x419a3d?{'count':_0x42cb23,'rows':_0x419a3d}:null;}})[_0x5b1f('0x24')](respondWithResult(_0x53da6a,null))['catch'](handleError(_0x53da6a,null));};
\ No newline at end of file
+var _0x022c=['Action','getActions','eml-format','zip-dir','fast-json-patch','moment','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','count','offset','status','Content-Range','update','then','destroy','get','Triggers','UserProfileResource','end','error','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','addAnyCondition','getAllConditions','findOne','Condition','pick','getAnyConditions','addAction'];(function(_0xf62e6c,_0x160938){var _0x14234f=function(_0x16fe1d){while(--_0x16fe1d){_0xf62e6c['push'](_0xf62e6c['shift']());}};_0x14234f(++_0x160938);}(_0x022c,0x16e));var _0xc022=function(_0xc7cb34,_0x1f4326){_0xc7cb34=_0xc7cb34-0x0;var _0x424a82=_0x022c[_0xc7cb34];return _0x424a82;};'use strict';var emlformat=require(_0xc022('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc022('0x1'));var jsonpatch=require(_0xc022('0x2'));var rp=require('request-promise');var moment=require(_0xc022('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xc022('0x4'));var path=require(_0xc022('0x5'));var sox=require(_0xc022('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc022('0x7'));var _=require(_0xc022('0x8'));var squel=require(_0xc022('0x9'));var crypto=require(_0xc022('0xa'));var jsforce=require(_0xc022('0xb'));var deskjs=require(_0xc022('0xc'));var toCsv=require(_0xc022('0xd'));var querystring=require(_0xc022('0xe'));var Papa=require(_0xc022('0xf'));var Redis=require(_0xc022('0x10'));var authService=require(_0xc022('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc022('0x12'));var hardwareService=require(_0xc022('0x13'));var logger=require('../../config/logger')(_0xc022('0x14'));var utils=require(_0xc022('0x15'));var config=require(_0xc022('0x16'));var licenseUtil=require(_0xc022('0x17'));var db=require(_0xc022('0x18'))['db'];function respondWithStatusCode(_0x187492,_0x7fcb55){_0x7fcb55=_0x7fcb55||0xcc;return function(_0x41cdb7){if(_0x41cdb7){return _0x187492[_0xc022('0x19')](_0x7fcb55);}return _0x187492['status'](_0x7fcb55)['end']();};}function respondWithResult(_0x4ff686,_0x440003){_0x440003=_0x440003||0xc8;return function(_0x24a6dc){if(_0x24a6dc){return _0x4ff686['status'](_0x440003)[_0xc022('0x1a')](_0x24a6dc);}};}function respondWithFilteredResult(_0xd570cd,_0x6cbdac){return function(_0x20c0ad){if(_0x20c0ad){var _0x1a0007=typeof _0x6cbdac['offset']==='undefined'&&typeof _0x6cbdac['limit']===_0xc022('0x1b');var _0x173277=_0x20c0ad[_0xc022('0x1c')];var _0x539021=_0x1a0007?0x0:_0x6cbdac[_0xc022('0x1d')];var _0xed3108=_0x1a0007?_0x20c0ad[_0xc022('0x1c')]:_0x6cbdac['offset']+_0x6cbdac['limit'];var _0x472550;if(_0xed3108>=_0x173277){_0xed3108=_0x173277;_0x472550=0xc8;}else{_0x472550=0xce;}_0xd570cd[_0xc022('0x1e')](_0x472550);return _0xd570cd['set'](_0xc022('0x1f'),_0x539021+'-'+_0xed3108+'/'+_0x173277)[_0xc022('0x1a')](_0x20c0ad);}return null;};}function patchUpdates(_0xd90705){return function(_0x11d93e){try{jsonpatch['apply'](_0x11d93e,_0xd90705,!![]);}catch(_0x4e9401){return BPromise['reject'](_0x4e9401);}return _0x11d93e['save']();};}function saveUpdates(_0x2b282d,_0x13101c){return function(_0x35c82e){if(_0x35c82e){return _0x35c82e[_0xc022('0x20')](_0x2b282d)[_0xc022('0x21')](function(_0x2d207f){return _0x2d207f;});}return null;};}function removeEntity(_0x266739,_0x1a1776){return function(_0xcb84a9){if(_0xcb84a9){return _0xcb84a9[_0xc022('0x22')]()[_0xc022('0x21')](function(){var _0x488d4c=_0xcb84a9[_0xc022('0x23')]({'plain':!![]});var _0x235645=_0xc022('0x24');return db[_0xc022('0x25')][_0xc022('0x22')]({'where':{'type':_0x235645,'resourceId':_0x488d4c['id']}})['then'](function(){return _0xcb84a9;});})[_0xc022('0x21')](function(){_0x266739['status'](0xcc)[_0xc022('0x26')]();});}};}function handleEntityNotFound(_0x88f865,_0x11d1eb){return function(_0x2e3423){if(!_0x2e3423){_0x88f865[_0xc022('0x19')](0x194);}return _0x2e3423;};}function handleError(_0x180bbd,_0x31fd9a){_0x31fd9a=_0x31fd9a||0x1f4;return function(_0x51d6dc){logger[_0xc022('0x27')](_0x51d6dc[_0xc022('0x28')]);if(_0x51d6dc[_0xc022('0x29')]){delete _0x51d6dc[_0xc022('0x29')];}_0x180bbd[_0xc022('0x1e')](_0x31fd9a)[_0xc022('0x2a')](_0x51d6dc);};}exports[_0xc022('0x2b')]=function(_0xfe190a,_0x5babb3){var _0x13d635={},_0x1a6590={},_0x1b7403={'count':0x0,'rows':[]};var _0x4a9021=_[_0xc022('0x2c')](db[_0xc022('0x2d')][_0xc022('0x2e')],function(_0x2149fe){return{'name':_0x2149fe[_0xc022('0x2f')],'type':_0x2149fe[_0xc022('0x30')]['key']};});_0x1a6590[_0xc022('0x31')]=_['map'](_0x4a9021,_0xc022('0x29'));_0x1a6590[_0xc022('0x32')]=_[_0xc022('0x33')](_0xfe190a[_0xc022('0x32')]);_0x1a6590[_0xc022('0x34')]=_['intersection'](_0x1a6590['model'],_0x1a6590['query']);_0x13d635[_0xc022('0x35')]=_['intersection'](_0x1a6590['model'],qs[_0xc022('0x36')](_0xfe190a[_0xc022('0x32')][_0xc022('0x36')]));_0x13d635[_0xc022('0x35')]=_0x13d635[_0xc022('0x35')][_0xc022('0x37')]?_0x13d635['attributes']:_0x1a6590[_0xc022('0x31')];if(!_0xfe190a[_0xc022('0x32')][_0xc022('0x38')](_0xc022('0x39'))){_0x13d635[_0xc022('0x3a')]=qs[_0xc022('0x3a')](_0xfe190a['query'][_0xc022('0x3a')]);_0x13d635[_0xc022('0x1d')]=qs[_0xc022('0x1d')](_0xfe190a[_0xc022('0x32')][_0xc022('0x1d')]);}_0x13d635[_0xc022('0x3b')]=qs[_0xc022('0x3c')](_0xfe190a[_0xc022('0x32')][_0xc022('0x3c')]);_0x13d635[_0xc022('0x3d')]=qs['filters'](_['pick'](_0xfe190a[_0xc022('0x32')],_0x1a6590['filters']),_0x4a9021);if(_0xfe190a[_0xc022('0x32')][_0xc022('0x3e')]){_0x13d635['where']=_[_0xc022('0x3f')](_0x13d635[_0xc022('0x3d')],{'$or':_[_0xc022('0x2c')](_0x4a9021,function(_0x42b7fe){if(_0x42b7fe[_0xc022('0x30')]!==_0xc022('0x40')){var _0x1b4b20={};_0x1b4b20[_0x42b7fe[_0xc022('0x29')]]={'$like':'%'+_0xfe190a[_0xc022('0x32')][_0xc022('0x3e')]+'%'};return _0x1b4b20;}})});}_0x13d635=_['merge']({},_0x13d635,_0xfe190a[_0xc022('0x41')]);var _0x30a2fa={'where':_0x13d635['where']};return db[_0xc022('0x2d')][_0xc022('0x1c')](_0x30a2fa)[_0xc022('0x21')](function(_0x1fa2ec){_0x1b7403[_0xc022('0x1c')]=_0x1fa2ec;if(_0xfe190a[_0xc022('0x32')][_0xc022('0x42')]){_0x13d635[_0xc022('0x43')]=[{'all':!![]}];}return db['Trigger'][_0xc022('0x44')](_0x13d635);})['then'](function(_0x1b718b){_0x1b7403[_0xc022('0x45')]=_0x1b718b;return _0x1b7403;})[_0xc022('0x21')](respondWithFilteredResult(_0x5babb3,_0x13d635))[_0xc022('0x46')](handleError(_0x5babb3,null));};exports['show']=function(_0x58edaf,_0x4f7942){var _0x559403={'raw':![],'where':{'id':_0x58edaf[_0xc022('0x47')]['id']}},_0x18a28f={};_0x18a28f[_0xc022('0x31')]=_['keys'](db['Trigger']['rawAttributes']);_0x18a28f[_0xc022('0x32')]=_[_0xc022('0x33')](_0x58edaf[_0xc022('0x32')]);_0x18a28f[_0xc022('0x34')]=_[_0xc022('0x48')](_0x18a28f[_0xc022('0x31')],_0x18a28f[_0xc022('0x32')]);_0x559403[_0xc022('0x35')]=_[_0xc022('0x48')](_0x18a28f[_0xc022('0x31')],qs[_0xc022('0x36')](_0x58edaf[_0xc022('0x32')][_0xc022('0x36')]));_0x559403[_0xc022('0x35')]=_0x559403['attributes']['length']?_0x559403[_0xc022('0x35')]:_0x18a28f[_0xc022('0x31')];if(_0x58edaf[_0xc022('0x32')]['includeAll']){_0x559403[_0xc022('0x43')]=[{'all':!![]}];}_0x559403=_['merge']({},_0x559403,_0x58edaf[_0xc022('0x41')]);return db[_0xc022('0x2d')][_0xc022('0x49')](_0x559403)[_0xc022('0x21')](handleEntityNotFound(_0x4f7942,null))[_0xc022('0x21')](respondWithResult(_0x4f7942,null))[_0xc022('0x46')](handleError(_0x4f7942,null));};exports[_0xc022('0x4a')]=function(_0x4a13a7,_0x1393bc){return db[_0xc022('0x2d')][_0xc022('0x4a')](_0x4a13a7[_0xc022('0x4b')],{})['then'](function(_0x198a8c){var _0xf5da63=_0x4a13a7[_0xc022('0x4c')][_0xc022('0x23')]({'plain':!![]});if(!_0xf5da63)throw new Error(_0xc022('0x4d'));if(_0xf5da63[_0xc022('0x4e')]===_0xc022('0x4c')){var _0x7f69c9=_0x198a8c[_0xc022('0x23')]({'plain':!![]});var _0x4d30a1='Triggers';return db[_0xc022('0x4f')]['find']({'where':{'name':_0x4d30a1,'userProfileId':_0xf5da63['userProfileId']},'raw':!![]})['then'](function(_0x50e55b){if(_0x50e55b&&_0x50e55b['autoAssociation']===0x0){return db['UserProfileResource'][_0xc022('0x4a')]({'name':_0x7f69c9[_0xc022('0x29')],'resourceId':_0x7f69c9['id'],'type':_0x50e55b['name'],'sectionId':_0x50e55b['id']},{})[_0xc022('0x21')](function(){return _0x198a8c;});}else{return _0x198a8c;}})[_0xc022('0x46')](function(_0x3a8b3f){logger[_0xc022('0x27')](_0xc022('0x50'),_0x3a8b3f);throw _0x3a8b3f;});}return _0x198a8c;})['then'](respondWithResult(_0x1393bc,0xc9))[_0xc022('0x46')](handleError(_0x1393bc,null));};exports[_0xc022('0x20')]=function(_0x1e91d1,_0x5c883e){if(_0x1e91d1[_0xc022('0x4b')]['id']){delete _0x1e91d1[_0xc022('0x4b')]['id'];}return db[_0xc022('0x2d')][_0xc022('0x49')]({'where':{'id':_0x1e91d1['params']['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x5c883e,null))[_0xc022('0x21')](saveUpdates(_0x1e91d1[_0xc022('0x4b')],null))[_0xc022('0x21')](respondWithResult(_0x5c883e,null))[_0xc022('0x46')](handleError(_0x5c883e,null));};exports[_0xc022('0x22')]=function(_0x269498,_0x462635){return db[_0xc022('0x2d')][_0xc022('0x49')]({'where':{'id':_0x269498[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x462635,null))['then'](removeEntity(_0x462635,null))[_0xc022('0x46')](handleError(_0x462635,null));};exports[_0xc022('0x51')]=function(_0x4cc8ce,_0x4a56e2,_0x4061a5){if(_0x4cc8ce['body']['id']){delete _0x4cc8ce[_0xc022('0x4b')]['id'];}return db[_0xc022('0x2d')][_0xc022('0x49')]({'where':{'id':_0x4cc8ce['params']['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x4a56e2,null))[_0xc022('0x21')](function(_0x28080f){if(_0x28080f){_0x4cc8ce[_0xc022('0x4b')]['TriggerAllId']=_0x28080f['id'];return db['Condition'][_0xc022('0x4a')](_0x4cc8ce[_0xc022('0x4b')]);}})[_0xc022('0x21')](respondWithResult(_0x4a56e2,null))[_0xc022('0x46')](handleError(_0x4a56e2,null));};exports[_0xc022('0x52')]=function(_0x21b3e4,_0x38a631,_0x490e5a){if(_0x21b3e4[_0xc022('0x4b')]['id']){delete _0x21b3e4[_0xc022('0x4b')]['id'];}return db['Trigger'][_0xc022('0x49')]({'where':{'id':_0x21b3e4[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x38a631,null))[_0xc022('0x21')](function(_0x456971){if(_0x456971){_0x21b3e4['body']['TriggerAnyId']=_0x456971['id'];return db['Condition'][_0xc022('0x4a')](_0x21b3e4['body']);}})[_0xc022('0x21')](respondWithResult(_0x38a631,null))[_0xc022('0x46')](handleError(_0x38a631,null));};exports[_0xc022('0x53')]=function(_0x20e42e,_0x91d261,_0x3ff03f){var _0x46ca8b={};var _0x2a8068={};var _0x23af34;var _0x55b4dd;return db[_0xc022('0x2d')][_0xc022('0x54')]({'where':{'id':_0x20e42e['params']['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x91d261,null))[_0xc022('0x21')](function(_0x4e4fc7){if(_0x4e4fc7){_0x23af34=_0x4e4fc7;_0x2a8068['model']=_['keys'](db[_0xc022('0x55')][_0xc022('0x2e')]);_0x2a8068[_0xc022('0x32')]=_[_0xc022('0x33')](_0x20e42e[_0xc022('0x32')]);_0x2a8068[_0xc022('0x34')]=_[_0xc022('0x48')](_0x2a8068['model'],_0x2a8068[_0xc022('0x32')]);_0x46ca8b['attributes']=_[_0xc022('0x48')](_0x2a8068[_0xc022('0x31')],qs[_0xc022('0x36')](_0x20e42e[_0xc022('0x32')][_0xc022('0x36')]));_0x46ca8b['attributes']=_0x46ca8b[_0xc022('0x35')]['length']?_0x46ca8b['attributes']:_0x2a8068[_0xc022('0x31')];_0x46ca8b[_0xc022('0x3b')]=qs[_0xc022('0x3c')](_0x20e42e['query'][_0xc022('0x3c')]);_0x46ca8b[_0xc022('0x3d')]=qs[_0xc022('0x34')](_[_0xc022('0x56')](_0x20e42e[_0xc022('0x32')],_0x2a8068[_0xc022('0x34')]));if(_0x20e42e['query'][_0xc022('0x3e')]){_0x46ca8b[_0xc022('0x3d')]=_[_0xc022('0x3f')](_0x46ca8b[_0xc022('0x3d')],{'$or':_[_0xc022('0x2c')](_0x46ca8b[_0xc022('0x35')],function(_0x4f1f3e){var _0x2887db={};_0x2887db[_0x4f1f3e]={'$like':'%'+_0x20e42e[_0xc022('0x32')]['filter']+'%'};return _0x2887db;})});}_0x46ca8b=_['merge']({},_0x46ca8b,_0x20e42e['options']);return _0x23af34[_0xc022('0x53')](_0x46ca8b);}})[_0xc022('0x21')](function(_0x15e269){if(_0x15e269){_0x55b4dd=_0x15e269[_0xc022('0x37')];if(!_0x20e42e[_0xc022('0x32')]['hasOwnProperty']('nolimit')){_0x46ca8b['limit']=qs[_0xc022('0x3a')](_0x20e42e[_0xc022('0x32')][_0xc022('0x3a')]);_0x46ca8b[_0xc022('0x1d')]=qs[_0xc022('0x1d')](_0x20e42e['query'][_0xc022('0x1d')]);}return _0x23af34['getAllConditions'](_0x46ca8b);}})['then'](function(_0x425bde){if(_0x425bde){return _0x425bde?{'count':_0x55b4dd,'rows':_0x425bde}:null;}})[_0xc022('0x21')](respondWithResult(_0x91d261,null))[_0xc022('0x46')](handleError(_0x91d261,null));};exports['getAnyConditions']=function(_0x355c75,_0x4cdec2,_0x212f9e){var _0x2cf06c={};var _0x6e574a={};var _0x2a0bcd;var _0x442e80;return db[_0xc022('0x2d')]['findOne']({'where':{'id':_0x355c75[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x4cdec2,null))[_0xc022('0x21')](function(_0x2584b6){if(_0x2584b6){_0x2a0bcd=_0x2584b6;_0x6e574a[_0xc022('0x31')]=_[_0xc022('0x33')](db[_0xc022('0x55')][_0xc022('0x2e')]);_0x6e574a['query']=_['keys'](_0x355c75[_0xc022('0x32')]);_0x6e574a[_0xc022('0x34')]=_[_0xc022('0x48')](_0x6e574a['model'],_0x6e574a[_0xc022('0x32')]);_0x2cf06c[_0xc022('0x35')]=_['intersection'](_0x6e574a['model'],qs[_0xc022('0x36')](_0x355c75[_0xc022('0x32')][_0xc022('0x36')]));_0x2cf06c[_0xc022('0x35')]=_0x2cf06c[_0xc022('0x35')][_0xc022('0x37')]?_0x2cf06c[_0xc022('0x35')]:_0x6e574a['model'];_0x2cf06c[_0xc022('0x3b')]=qs['sort'](_0x355c75[_0xc022('0x32')][_0xc022('0x3c')]);_0x2cf06c[_0xc022('0x3d')]=qs[_0xc022('0x34')](_[_0xc022('0x56')](_0x355c75[_0xc022('0x32')],_0x6e574a[_0xc022('0x34')]));if(_0x355c75['query']['filter']){_0x2cf06c['where']=_[_0xc022('0x3f')](_0x2cf06c[_0xc022('0x3d')],{'$or':_[_0xc022('0x2c')](_0x2cf06c[_0xc022('0x35')],function(_0x27b37d){var _0x31a5fc={};_0x31a5fc[_0x27b37d]={'$like':'%'+_0x355c75[_0xc022('0x32')][_0xc022('0x3e')]+'%'};return _0x31a5fc;})});}_0x2cf06c=_['merge']({},_0x2cf06c,_0x355c75['options']);return _0x2a0bcd[_0xc022('0x57')](_0x2cf06c);}})['then'](function(_0x17d14b){if(_0x17d14b){_0x442e80=_0x17d14b[_0xc022('0x37')];if(!_0x355c75['query'][_0xc022('0x38')](_0xc022('0x39'))){_0x2cf06c[_0xc022('0x3a')]=qs[_0xc022('0x3a')](_0x355c75[_0xc022('0x32')][_0xc022('0x3a')]);_0x2cf06c[_0xc022('0x1d')]=qs['offset'](_0x355c75[_0xc022('0x32')][_0xc022('0x1d')]);}return _0x2a0bcd['getAnyConditions'](_0x2cf06c);}})[_0xc022('0x21')](function(_0x24c2d7){if(_0x24c2d7){return _0x24c2d7?{'count':_0x442e80,'rows':_0x24c2d7}:null;}})[_0xc022('0x21')](respondWithResult(_0x4cdec2,null))[_0xc022('0x46')](handleError(_0x4cdec2,null));};exports[_0xc022('0x58')]=function(_0x5d4ff5,_0x313295,_0xaf1632){if(_0x5d4ff5[_0xc022('0x4b')]['id']){delete _0x5d4ff5[_0xc022('0x4b')]['id'];}return db[_0xc022('0x2d')]['find']({'where':{'id':_0x5d4ff5[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x313295,null))['then'](function(_0x38482d){if(_0x38482d){_0x5d4ff5[_0xc022('0x4b')]['TriggerId']=_0x38482d['id'];return db[_0xc022('0x59')][_0xc022('0x4a')](_0x5d4ff5[_0xc022('0x4b')]);}})[_0xc022('0x21')](respondWithResult(_0x313295,null))[_0xc022('0x46')](handleError(_0x313295,null));};exports[_0xc022('0x5a')]=function(_0x4f9133,_0x4afefa,_0x2cbd70){var _0x342c08={};var _0x151637={};var _0x36cf24;var _0x5650ff;return db[_0xc022('0x2d')]['findOne']({'where':{'id':_0x4f9133[_0xc022('0x47')]['id']}})[_0xc022('0x21')](handleEntityNotFound(_0x4afefa,null))['then'](function(_0x3c7138){if(_0x3c7138){_0x36cf24=_0x3c7138;_0x151637[_0xc022('0x31')]=_[_0xc022('0x33')](db[_0xc022('0x59')][_0xc022('0x2e')]);_0x151637[_0xc022('0x32')]=_[_0xc022('0x33')](_0x4f9133[_0xc022('0x32')]);_0x151637['filters']=_[_0xc022('0x48')](_0x151637[_0xc022('0x31')],_0x151637[_0xc022('0x32')]);_0x342c08['attributes']=_[_0xc022('0x48')](_0x151637['model'],qs[_0xc022('0x36')](_0x4f9133[_0xc022('0x32')][_0xc022('0x36')]));_0x342c08['attributes']=_0x342c08[_0xc022('0x35')]['length']?_0x342c08[_0xc022('0x35')]:_0x151637['model'];_0x342c08[_0xc022('0x3b')]=qs[_0xc022('0x3c')](_0x4f9133[_0xc022('0x32')][_0xc022('0x3c')]);_0x342c08['where']=qs['filters'](_[_0xc022('0x56')](_0x4f9133[_0xc022('0x32')],_0x151637[_0xc022('0x34')]));if(_0x4f9133[_0xc022('0x32')][_0xc022('0x3e')]){_0x342c08[_0xc022('0x3d')]=_['merge'](_0x342c08[_0xc022('0x3d')],{'$or':_[_0xc022('0x2c')](_0x342c08[_0xc022('0x35')],function(_0x3dd33b){var _0x2d65c7={};_0x2d65c7[_0x3dd33b]={'$like':'%'+_0x4f9133[_0xc022('0x32')][_0xc022('0x3e')]+'%'};return _0x2d65c7;})});}_0x342c08=_['merge']({},_0x342c08,_0x4f9133[_0xc022('0x41')]);return _0x36cf24['getActions'](_0x342c08);}})[_0xc022('0x21')](function(_0x4bbd6e){if(_0x4bbd6e){_0x5650ff=_0x4bbd6e[_0xc022('0x37')];if(!_0x4f9133[_0xc022('0x32')][_0xc022('0x38')]('nolimit')){_0x342c08[_0xc022('0x3a')]=qs[_0xc022('0x3a')](_0x4f9133['query'][_0xc022('0x3a')]);_0x342c08[_0xc022('0x1d')]=qs['offset'](_0x4f9133[_0xc022('0x32')]['offset']);}return _0x36cf24[_0xc022('0x5a')](_0x342c08);}})['then'](function(_0x33faae){if(_0x33faae){return _0x33faae?{'count':_0x5650ff,'rows':_0x33faae}:null;}})[_0xc022('0x21')](respondWithResult(_0x4afefa,null))[_0xc022('0x46')](handleError(_0x4afefa,null));};
\ No newline at end of file
index 0736359..cd4c1cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x55d2=['../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x486b88,_0x10faca){var _0x20dee9=function(_0x5130a3){while(--_0x5130a3){_0x486b88['push'](_0x486b88['shift']());}};_0x20dee9(++_0x10faca);}(_0x55d2,0x9f));var _0x255d=function(_0x45d1b1,_0x328cb0){_0x45d1b1=_0x45d1b1-0x0;var _0x313c30=_0x55d2[_0x45d1b1];return _0x313c30;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x255d('0x0'))(_0x255d('0x1'));var moment=require(_0x255d('0x2'));var BPromise=require(_0x255d('0x3'));var rp=require(_0x255d('0x4'));var fs=require('fs');var path=require(_0x255d('0x5'));var rimraf=require('rimraf');var config=require(_0x255d('0x6'));var attributes=require(_0x255d('0x7'));module[_0x255d('0x8')]=function(_0x38017a,_0x58dae4){return _0x38017a['define'](_0x255d('0x9'),attributes,{'tableName':_0x255d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x0faf=['path','rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3511d3,_0x4107ae){var _0x5d6321=function(_0x1a23da){while(--_0x1a23da){_0x3511d3['push'](_0x3511d3['shift']());}};_0x5d6321(++_0x4107ae);}(_0x0faf,0x132));var _0xf0fa=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x0faf[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0xf0fa('0x0'));var util=require('util');var logger=require(_0xf0fa('0x1'))(_0xf0fa('0x2'));var moment=require(_0xf0fa('0x3'));var BPromise=require(_0xf0fa('0x4'));var rp=require(_0xf0fa('0x5'));var fs=require('fs');var path=require(_0xf0fa('0x6'));var rimraf=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var attributes=require(_0xf0fa('0x9'));module['exports']=function(_0x3637a3,_0x44ffa0){return _0x3637a3[_0xf0fa('0xa')](_0xf0fa('0xb'),attributes,{'tableName':_0xf0fa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 614c5dd..7cafdec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0bbe=['jayson/promise','client','http','request','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Trigger','findAll','options','raw','where','attributes','limit','include','map','model','then','GetTrigger','ShowTrigger','find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x2aee2f,_0xad9887){var _0x19337f=function(_0x2e62d){while(--_0x2e62d){_0x2aee2f['push'](_0x2aee2f['shift']());}};_0x19337f(++_0xad9887);}(_0x0bbe,0x1f1));var _0xe0bb=function(_0x3a406b,_0x39c9cd){_0x3a406b=_0x3a406b-0x0;var _0x5dd5a5=_0x0bbe[_0x3a406b];return _0x5dd5a5;};'use strict';var _=require('lodash');var util=require(_0xe0bb('0x0'));var moment=require(_0xe0bb('0x1'));var BPromise=require(_0xe0bb('0x2'));var rs=require(_0xe0bb('0x3'));var fs=require('fs');var Redis=require(_0xe0bb('0x4'));var db=require(_0xe0bb('0x5'))['db'];var utils=require(_0xe0bb('0x6'));var logger=require(_0xe0bb('0x7'))(_0xe0bb('0x8'));var config=require(_0xe0bb('0x9'));var jayson=require(_0xe0bb('0xa'));var client=jayson[_0xe0bb('0xb')][_0xe0bb('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53cad3,_0x2e3e0a,_0x40fc21){return new BPromise(function(_0x33aa06,_0xa4fb35){return client[_0xe0bb('0xd')](_0x53cad3,_0x40fc21)['then'](function(_0x208354){logger[_0xe0bb('0xe')](_0xe0bb('0xf'),_0x2e3e0a,_0xe0bb('0x10'));logger[_0xe0bb('0x11')](_0xe0bb('0x12'),_0x2e3e0a,'request\x20sent',JSON[_0xe0bb('0x13')](_0x208354));if(_0x208354[_0xe0bb('0x14')]){if(_0x208354[_0xe0bb('0x14')][_0xe0bb('0x15')]===0x1f4){logger[_0xe0bb('0x14')](_0xe0bb('0xf'),_0x2e3e0a,_0x208354[_0xe0bb('0x14')][_0xe0bb('0x16')]);return _0xa4fb35(_0x208354[_0xe0bb('0x14')][_0xe0bb('0x16')]);}logger['error'](_0xe0bb('0xf'),_0x2e3e0a,_0x208354[_0xe0bb('0x14')][_0xe0bb('0x16')]);return _0x33aa06(_0x208354[_0xe0bb('0x14')][_0xe0bb('0x16')]);}else{logger['info'](_0xe0bb('0xf'),_0x2e3e0a,_0xe0bb('0x10'));_0x33aa06(_0x208354[_0xe0bb('0x17')][_0xe0bb('0x16')]);}})[_0xe0bb('0x18')](function(_0xdc10ec){logger[_0xe0bb('0x14')]('Trigger,\x20%s,\x20%s',_0x2e3e0a,_0xdc10ec);_0xa4fb35(_0xdc10ec);});});}exports['GetTrigger']=function(_0x54bfe7){var _0x271846=this;return new Promise(function(_0x406606,_0x30a156){return db[_0xe0bb('0x19')][_0xe0bb('0x1a')]({'raw':_0x54bfe7[_0xe0bb('0x1b')]?_0x54bfe7['options'][_0xe0bb('0x1c')]===undefined?!![]:![]:!![],'where':_0x54bfe7['options']?_0x54bfe7['options'][_0xe0bb('0x1d')]||null:null,'attributes':_0x54bfe7[_0xe0bb('0x1b')]?_0x54bfe7['options'][_0xe0bb('0x1e')]||null:null,'limit':_0x54bfe7[_0xe0bb('0x1b')]?_0x54bfe7[_0xe0bb('0x1b')][_0xe0bb('0x1f')]||null:null,'include':_0x54bfe7[_0xe0bb('0x1b')]?_0x54bfe7[_0xe0bb('0x1b')][_0xe0bb('0x20')]?_[_0xe0bb('0x21')](_0x54bfe7[_0xe0bb('0x1b')][_0xe0bb('0x20')],function(_0x1ab58d){return{'model':db[_0x1ab58d[_0xe0bb('0x22')]],'as':_0x1ab58d['as'],'attributes':_0x1ab58d['attributes'],'include':_0x1ab58d[_0xe0bb('0x20')]?_['map'](_0x1ab58d[_0xe0bb('0x20')],function(_0x6168a1){return{'model':db[_0x6168a1[_0xe0bb('0x22')]],'as':_0x6168a1['as'],'attributes':_0x6168a1[_0xe0bb('0x1e')],'include':_0x6168a1['include']?_[_0xe0bb('0x21')](_0x6168a1[_0xe0bb('0x20')],function(_0x327f29){return{'model':db[_0x327f29[_0xe0bb('0x22')]],'as':_0x327f29['as'],'attributes':_0x327f29[_0xe0bb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe0bb('0x23')](function(_0x5aa000){logger['info'](_0xe0bb('0x24'),_0x54bfe7);logger['debug'](_0xe0bb('0x24'),_0x54bfe7,JSON[_0xe0bb('0x13')](_0x5aa000));_0x406606(_0x5aa000);})['catch'](function(_0x4a45ba){logger[_0xe0bb('0x14')](_0xe0bb('0x24'),_0x4a45ba[_0xe0bb('0x16')],_0x54bfe7);_0x30a156(_0x271846[_0xe0bb('0x14')](0x1f4,_0x4a45ba[_0xe0bb('0x16')]));});});};exports[_0xe0bb('0x25')]=function(_0x52c60c){var _0x4378ee=this;return new Promise(function(_0x3ba52e,_0x21d185){return db[_0xe0bb('0x19')][_0xe0bb('0x26')]({'raw':_0x52c60c[_0xe0bb('0x1b')]?_0x52c60c[_0xe0bb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x52c60c[_0xe0bb('0x1b')]?_0x52c60c[_0xe0bb('0x1b')]['where']||null:null,'attributes':_0x52c60c[_0xe0bb('0x1b')]?_0x52c60c[_0xe0bb('0x1b')][_0xe0bb('0x1e')]||null:null,'include':_0x52c60c[_0xe0bb('0x1b')]?_0x52c60c[_0xe0bb('0x1b')][_0xe0bb('0x20')]?_['map'](_0x52c60c[_0xe0bb('0x1b')][_0xe0bb('0x20')],function(_0x43460){return{'model':db[_0x43460['model']],'as':_0x43460['as'],'attributes':_0x43460[_0xe0bb('0x1e')],'include':_0x43460[_0xe0bb('0x20')]?_[_0xe0bb('0x21')](_0x43460[_0xe0bb('0x20')],function(_0x322331){return{'model':db[_0x322331[_0xe0bb('0x22')]],'as':_0x322331['as'],'attributes':_0x322331['attributes'],'include':_0x322331['include']?_['map'](_0x322331['include'],function(_0x4de19b){return{'model':db[_0x4de19b[_0xe0bb('0x22')]],'as':_0x4de19b['as'],'attributes':_0x4de19b[_0xe0bb('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xe0bb('0x23')](function(_0x139868){logger[_0xe0bb('0xe')](_0xe0bb('0x25'),_0x52c60c);logger[_0xe0bb('0x11')](_0xe0bb('0x25'),_0x52c60c,JSON['stringify'](_0x139868));_0x3ba52e(_0x139868);})[_0xe0bb('0x18')](function(_0x500256){logger[_0xe0bb('0x14')](_0xe0bb('0x25'),_0x500256[_0xe0bb('0x16')],_0x52c60c);_0x21d185(_0x4378ee[_0xe0bb('0x14')](0x1f4,_0x500256[_0xe0bb('0x16')]));});});};
\ No newline at end of file
+var _0x175c=['../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','where','attributes','map','include','model','GetTrigger','ShowTrigger','Trigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x39b7cf,_0x8c6fc8){var _0x2dacbf=function(_0x58c7a3){while(--_0x58c7a3){_0x39b7cf['push'](_0x39b7cf['shift']());}};_0x2dacbf(++_0x8c6fc8);}(_0x175c,0x18e));var _0xc175=function(_0x15eb08,_0x442680){_0x15eb08=_0x15eb08-0x0;var _0x24f733=_0x175c[_0x15eb08];return _0x24f733;};'use strict';var _=require(_0xc175('0x0'));var util=require(_0xc175('0x1'));var moment=require(_0xc175('0x2'));var BPromise=require(_0xc175('0x3'));var rs=require(_0xc175('0x4'));var fs=require('fs');var Redis=require(_0xc175('0x5'));var db=require(_0xc175('0x6'))['db'];var utils=require(_0xc175('0x7'));var logger=require('../../config/logger')(_0xc175('0x8'));var config=require(_0xc175('0x9'));var jayson=require(_0xc175('0xa'));var client=jayson[_0xc175('0xb')][_0xc175('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4a7348,_0x29d697,_0x385e08){return new BPromise(function(_0xc95ec0,_0x438074){return client[_0xc175('0xd')](_0x4a7348,_0x385e08)[_0xc175('0xe')](function(_0x2b5cd0){logger[_0xc175('0xf')](_0xc175('0x10'),_0x29d697,_0xc175('0x11'));logger[_0xc175('0x12')](_0xc175('0x13'),_0x29d697,_0xc175('0x11'),JSON[_0xc175('0x14')](_0x2b5cd0));if(_0x2b5cd0['error']){if(_0x2b5cd0[_0xc175('0x15')][_0xc175('0x16')]===0x1f4){logger[_0xc175('0x15')](_0xc175('0x10'),_0x29d697,_0x2b5cd0[_0xc175('0x15')]['message']);return _0x438074(_0x2b5cd0['error'][_0xc175('0x17')]);}logger['error'](_0xc175('0x10'),_0x29d697,_0x2b5cd0['error']['message']);return _0xc95ec0(_0x2b5cd0[_0xc175('0x15')][_0xc175('0x17')]);}else{logger[_0xc175('0xf')](_0xc175('0x10'),_0x29d697,_0xc175('0x11'));_0xc95ec0(_0x2b5cd0['result'][_0xc175('0x17')]);}})[_0xc175('0x18')](function(_0x585ba3){logger[_0xc175('0x15')]('Trigger,\x20%s,\x20%s',_0x29d697,_0x585ba3);_0x438074(_0x585ba3);});});}exports['GetTrigger']=function(_0x4839cc){var _0x3415a5=this;return new Promise(function(_0x5b6d90,_0x4d5f6f){return db['Trigger'][_0xc175('0x19')]({'raw':_0x4839cc[_0xc175('0x1a')]?_0x4839cc[_0xc175('0x1a')][_0xc175('0x1b')]===undefined?!![]:![]:!![],'where':_0x4839cc['options']?_0x4839cc[_0xc175('0x1a')][_0xc175('0x1c')]||null:null,'attributes':_0x4839cc['options']?_0x4839cc[_0xc175('0x1a')][_0xc175('0x1d')]||null:null,'limit':_0x4839cc[_0xc175('0x1a')]?_0x4839cc[_0xc175('0x1a')]['limit']||null:null,'include':_0x4839cc['options']?_0x4839cc['options']['include']?_[_0xc175('0x1e')](_0x4839cc[_0xc175('0x1a')][_0xc175('0x1f')],function(_0x4fa849){return{'model':db[_0x4fa849[_0xc175('0x20')]],'as':_0x4fa849['as'],'attributes':_0x4fa849[_0xc175('0x1d')],'include':_0x4fa849[_0xc175('0x1f')]?_[_0xc175('0x1e')](_0x4fa849[_0xc175('0x1f')],function(_0x1b9e08){return{'model':db[_0x1b9e08[_0xc175('0x20')]],'as':_0x1b9e08['as'],'attributes':_0x1b9e08[_0xc175('0x1d')],'include':_0x1b9e08[_0xc175('0x1f')]?_[_0xc175('0x1e')](_0x1b9e08['include'],function(_0x262aba){return{'model':db[_0x262aba[_0xc175('0x20')]],'as':_0x262aba['as'],'attributes':_0x262aba[_0xc175('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc175('0xe')](function(_0x56ce6b){logger[_0xc175('0xf')]('GetTrigger',_0x4839cc);logger[_0xc175('0x12')]('GetTrigger',_0x4839cc,JSON[_0xc175('0x14')](_0x56ce6b));_0x5b6d90(_0x56ce6b);})[_0xc175('0x18')](function(_0x382eaa){logger['error'](_0xc175('0x21'),_0x382eaa[_0xc175('0x17')],_0x4839cc);_0x4d5f6f(_0x3415a5['error'](0x1f4,_0x382eaa[_0xc175('0x17')]));});});};exports[_0xc175('0x22')]=function(_0x1b2dd9){var _0x2c7279=this;return new Promise(function(_0x206001,_0x173f73){return db[_0xc175('0x23')][_0xc175('0x24')]({'raw':_0x1b2dd9[_0xc175('0x1a')]?_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1b')]===undefined?!![]:![]:!![],'where':_0x1b2dd9['options']?_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1c')]||null:null,'attributes':_0x1b2dd9[_0xc175('0x1a')]?_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1d')]||null:null,'include':_0x1b2dd9[_0xc175('0x1a')]?_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1f')]?_['map'](_0x1b2dd9[_0xc175('0x1a')][_0xc175('0x1f')],function(_0x319a12){return{'model':db[_0x319a12[_0xc175('0x20')]],'as':_0x319a12['as'],'attributes':_0x319a12[_0xc175('0x1d')],'include':_0x319a12[_0xc175('0x1f')]?_[_0xc175('0x1e')](_0x319a12[_0xc175('0x1f')],function(_0x234e4c){return{'model':db[_0x234e4c['model']],'as':_0x234e4c['as'],'attributes':_0x234e4c[_0xc175('0x1d')],'include':_0x234e4c[_0xc175('0x1f')]?_[_0xc175('0x1e')](_0x234e4c[_0xc175('0x1f')],function(_0x315ce5){return{'model':db[_0x315ce5[_0xc175('0x20')]],'as':_0x315ce5['as'],'attributes':_0x315ce5['attributes']};}):[]};}):[]};}):[]:[]})[_0xc175('0xe')](function(_0x521f70){logger[_0xc175('0xf')](_0xc175('0x22'),_0x1b2dd9);logger[_0xc175('0x12')](_0xc175('0x22'),_0x1b2dd9,JSON[_0xc175('0x14')](_0x521f70));_0x206001(_0x521f70);})[_0xc175('0x18')](function(_0x2d0d52){logger[_0xc175('0x15')]('ShowTrigger',_0x2d0d52[_0xc175('0x17')],_0x1b2dd9);_0x173f73(_0x2c7279['error'](0x1f4,_0x2d0d52[_0xc175('0x17')]));});});};
\ No newline at end of file
index 340b381..8695aaa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe915=['create','put','update','destroy','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','/:id/clone','clone'];(function(_0x39a757,_0x51e36d){var _0x3df2f=function(_0x1e5083){while(--_0x1e5083){_0x39a757['push'](_0x39a757['shift']());}};_0x3df2f(++_0x51e36d);}(_0xe915,0xb9));var _0x5e91=function(_0x106032,_0x5985de){_0x106032=_0x106032-0x0;var _0x38b1f8=_0xe915[_0x106032];return _0x38b1f8;};'use strict';var multer=require(_0x5e91('0x0'));var util=require('util');var path=require(_0x5e91('0x1'));var timeout=require('connect-timeout');var express=require(_0x5e91('0x2'));var router=express[_0x5e91('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5e91('0x4'));var config=require(_0x5e91('0x5'));var controller=require('./trunk.controller');router[_0x5e91('0x6')]('/',auth[_0x5e91('0x7')](),controller['index']);router[_0x5e91('0x6')](_0x5e91('0x8'),auth['isAuthenticated'](),controller[_0x5e91('0x9')]);router[_0x5e91('0xa')](_0x5e91('0xb'),auth['isAuthenticated'](),controller[_0x5e91('0xc')]);router[_0x5e91('0xa')]('/',auth[_0x5e91('0x7')](),controller[_0x5e91('0xd')]);router[_0x5e91('0xe')](_0x5e91('0x8'),auth['isAuthenticated'](),controller[_0x5e91('0xf')]);router['delete'](_0x5e91('0x8'),auth[_0x5e91('0x7')](),controller[_0x5e91('0x10')]);module[_0x5e91('0x11')]=router;
\ No newline at end of file
+var _0xa814=['exports','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','post','delete'];(function(_0x1aec60,_0x34fe2a){var _0x4b7422=function(_0x33f0f5){while(--_0x33f0f5){_0x1aec60['push'](_0x1aec60['shift']());}};_0x4b7422(++_0x34fe2a);}(_0xa814,0x161));var _0x4a81=function(_0x529942,_0x272e1a){_0x529942=_0x529942-0x0;var _0x48cd0d=_0xa814[_0x529942];return _0x48cd0d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4a81('0x0'));var timeout=require(_0x4a81('0x1'));var express=require(_0x4a81('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4a81('0x3'));var interaction=require(_0x4a81('0x4'));var config=require('../../config/environment');var controller=require(_0x4a81('0x5'));router[_0x4a81('0x6')]('/',auth[_0x4a81('0x7')](),controller[_0x4a81('0x8')]);router[_0x4a81('0x6')](_0x4a81('0x9'),auth[_0x4a81('0x7')](),controller[_0x4a81('0xa')]);router['post'](_0x4a81('0xb'),auth['isAuthenticated'](),controller[_0x4a81('0xc')]);router[_0x4a81('0xd')]('/',auth[_0x4a81('0x7')](),controller['create']);router['put']('/:id',auth[_0x4a81('0x7')](),controller['update']);router[_0x4a81('0xe')](_0x4a81('0x9'),auth[_0x4a81('0x7')](),controller['destroy']);module[_0x4a81('0xf')]=router;
\ No newline at end of file
index f4489aa..127bf43 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6652=['PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','nonat','update','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','active','actpass','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED'];(function(_0x23cf74,_0x4c4534){var _0x205458=function(_0x152d92){while(--_0x152d92){_0x23cf74['push'](_0x23cf74['shift']());}};_0x205458(++_0x4c4534);}(_0x6652,0x8b));var _0x2665=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x6652[_0x29b609];return _0x54c952;};'use strict';var Sequelize=require(_0x2665('0x0'));module[_0x2665('0x1')]={'name':{'type':Sequelize[_0x2665('0x2')],'allowNull':![],'unique':_0x2665('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x5'),_0x2665('0x6'),_0x2665('0x7')),'allowNull':![],'defaultValue':_0x2665('0x5')},'context':{'type':Sequelize[_0x2665('0x2')],'allowNull':![],'defaultValue':_0x2665('0x8')},'callingpres':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x9'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0x2665('0xa'),_0x2665('0xb'),'PROHIB_PASSED_SCREEN',_0x2665('0xc'),_0x2665('0xd'))},'deny':{'type':Sequelize['STRING']},'permit':{'type':Sequelize[_0x2665('0x2')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x2665('0x2')]},'remotesecret':{'type':Sequelize[_0x2665('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x6c789a){this['setDataValue'](_0x2665('0xe'),_0x6c789a?_0x6c789a[_0x2665('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x2665('0xe'))?this[_0x2665('0x10')](_0x2665('0xe'))[_0x2665('0x11')](','):null;},'comment':_0x2665('0x12')},'dtmfmode':{'type':Sequelize['ENUM']('rfc2833','info',_0x2665('0x13'),_0x2665('0x14'),_0x2665('0x15')),'defaultValue':_0x2665('0x16')},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x2665('0x17'),_0x2665('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x2665('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x2665('0x1a'),'set':function(_0x4ab61f){this[_0x2665('0x1b')](_0x2665('0x1c'),_0x4ab61f?_0x4ab61f[_0x2665('0xf')](','):null);},'get':function(){return this[_0x2665('0x10')](_0x2665('0x1c'))?this['getDataValue'](_0x2665('0x1c'))[_0x2665('0x11')](','):null;},'comment':_0x2665('0x1d')},'callgroup':{'type':Sequelize[_0x2665('0x2')]},'namedcallgroup':{'type':Sequelize[_0x2665('0x2')]},'pickupgroup':{'type':Sequelize[_0x2665('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x2665('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x2665('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x2665('0x2')],'defaultValue':_0x2665('0x1e')},'allow':{'type':Sequelize[_0x2665('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x1208f9){this[_0x2665('0x1b')](_0x2665('0x1f'),_0x1208f9?_0x1208f9[_0x2665('0xf')](';'):_0x2665('0x20'));},'get':function(){return this[_0x2665('0x10')](_0x2665('0x1f'))?this['getDataValue']('allow')[_0x2665('0x11')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x2665('0x21'),'set':function(_0x3dc58f){this[_0x2665('0x1b')]('insecure',_0x3dc58f?_0x3dc58f[_0x2665('0xf')](','):null);},'get':function(){return this['getDataValue'](_0x2665('0x22'))?this[_0x2665('0x10')](_0x2665('0x22'))[_0x2665('0x11')](','):null;},'comment':_0x2665('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x2665('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x2665('0x19'),'no',_0x2665('0x24'))},'promiscredir':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no')},'useclientcode':{'type':Sequelize['ENUM']('yes','no')},'accountcode':{'type':Sequelize[_0x2665('0x25')](0xb)},'setvar':{'type':Sequelize[_0x2665('0x2')]},'callerid':{'type':Sequelize[_0x2665('0x2')],'defaultValue':_0x2665('0x26')},'amaflags':{'type':Sequelize[_0x2665('0x2')]},'callcounter':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no'),'defaultValue':_0x2665('0x19')},'busylevel':{'type':Sequelize[_0x2665('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x2665('0x19'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x2665('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x2665('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x2665('0x2')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no',_0x2665('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x2665('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no')},'mailbox':{'type':Sequelize[_0x2665('0x2')]},'session_timers':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x28'),_0x2665('0x29'),_0x2665('0x2a'))},'session_expires':{'type':Sequelize[_0x2665('0x25')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x2665('0x2b'),_0x2665('0x2c')),'defaultValue':_0x2665('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x2665('0x2')]},'regexten':{'type':Sequelize[_0x2665('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x2665('0x2')]},'port':{'type':Sequelize[_0x2665('0x25')](0x5)},'qualify':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no'),'defaultValue':_0x2665('0x19')},'keepalive':{'type':Sequelize[_0x2665('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x2665('0x2')]},'defaultuser':{'type':Sequelize[_0x2665('0x2')]},'rtptimeout':{'type':Sequelize[_0x2665('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x2665('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x2665('0x4')]('yes','no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x2665('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x2665('0x25')](0xb)},'timerb':{'type':Sequelize[_0x2665('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x2665('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x2665('0x2')]},'contactdeny':{'type':Sequelize[_0x2665('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x2665('0x2')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x2665('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no')},'force_avp':{'type':Sequelize[_0x2665('0x4')]('yes','no')},'icesupport':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x2665('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x2665('0x4')]('yes','no',_0x2665('0x2d'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x2665('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x2665('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x2665('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x2665('0x2e'),'passive',_0x2665('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x2665('0x2')]},'usereqphone':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x2665('0x2')]},'recordofffeature':{'type':Sequelize[_0x2665('0x2')]},'call_limit':{'type':Sequelize[_0x2665('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x2665('0x2')]},'mohsuggest':{'type':Sequelize[_0x2665('0x2')]},'parkinglot':{'type':Sequelize[_0x2665('0x2')]},'description':{'type':Sequelize[_0x2665('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':'dynamic'},'canreinvite':{'type':Sequelize[_0x2665('0x4')](_0x2665('0x19'),'no',_0x2665('0x17'),_0x2665('0x18'),_0x2665('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x2665('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x2665('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x2665('0x2')],'defaultValue':'no'}};
\ No newline at end of file
+var _0x160d=['name','user','peer','friend','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','udp','setDataValue','join','getDataValue','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','yes','nonat','update','outgoing','force_rport,comedia','nat','all','allow','ulaw;alaw;gsm','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING'];(function(_0xb74c89,_0x246040){var _0xe4ccef=function(_0x12b652){while(--_0x12b652){_0xb74c89['push'](_0xb74c89['shift']());}};_0xe4ccef(++_0x246040);}(_0x160d,0xc1));var _0xd160=function(_0x23d880,_0x25a936){_0x23d880=_0x23d880-0x0;var _0x589344=_0x160d[_0x23d880];return _0x589344;};'use strict';var Sequelize=require(_0xd160('0x0'));module[_0xd160('0x1')]={'name':{'type':Sequelize[_0xd160('0x2')],'allowNull':![],'unique':_0xd160('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('friend',_0xd160('0x4'),_0xd160('0x5')),'allowNull':![],'defaultValue':_0xd160('0x6')},'context':{'type':Sequelize[_0xd160('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x8'),'ALLOWED_PASSED_SCREEN',_0xd160('0x9'),'ALLOWED','PROHIB_NOT_SCREENED',_0xd160('0xa'),'PROHIB_FAILED_SCREEN','PROHIB')},'deny':{'type':Sequelize[_0xd160('0x2')]},'permit':{'type':Sequelize[_0xd160('0x2')]},'secret':{'type':Sequelize[_0xd160('0x2')]},'md5secret':{'type':Sequelize[_0xd160('0x2')]},'remotesecret':{'type':Sequelize[_0xd160('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':_0xd160('0xb'),'set':function(_0x11f0df){this[_0xd160('0xc')]('transport',_0x11f0df?_0x11f0df[_0xd160('0xd')](','):null);},'get':function(){return this[_0xd160('0xe')](_0xd160('0xf'))?this[_0xd160('0xe')](_0xd160('0xf'))['split'](','):null;},'comment':_0xd160('0x10')},'dtmfmode':{'type':Sequelize['ENUM'](_0xd160('0x11'),_0xd160('0x12'),_0xd160('0x13'),'inband','auto'),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no',_0xd160('0x15'),_0xd160('0x16'),_0xd160('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xd160('0x2')]},'directmediadeny':{'type':Sequelize[_0xd160('0x2')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0xd160('0x18'),'set':function(_0xe915d8){this[_0xd160('0xc')](_0xd160('0x19'),_0xe915d8?_0xe915d8['join'](','):null);},'get':function(){return this[_0xd160('0xe')](_0xd160('0x19'))?this[_0xd160('0xe')](_0xd160('0x19'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xd160('0x2')]},'pickupgroup':{'type':Sequelize[_0xd160('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xd160('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xd160('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xd160('0x2')],'defaultValue':_0xd160('0x1a')},'allow':{'type':Sequelize[_0xd160('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2fedbf){this[_0xd160('0xc')](_0xd160('0x1b'),_0x2fedbf?_0x2fedbf[_0xd160('0xd')](';'):_0xd160('0x1c'));},'get':function(){return this[_0xd160('0xe')](_0xd160('0x1b'))?this[_0xd160('0xe')](_0xd160('0x1b'))[_0xd160('0x1d')](';'):null;},'comment':_0xd160('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'insecure':{'type':Sequelize[_0xd160('0x2')],'defaultValue':_0xd160('0x1f'),'set':function(_0x46e37e){this[_0xd160('0xc')](_0xd160('0x20'),_0x46e37e?_0x46e37e[_0xd160('0xd')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xd160('0xe')](_0xd160('0x20'))['split'](','):null;},'comment':_0xd160('0x21')},'trustrpid':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xd160('0x7')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xd160('0x7')]('yes','no',_0xd160('0x22'))},'promiscredir':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'useclientcode':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'accountcode':{'type':Sequelize[_0xd160('0x23')](0xb)},'setvar':{'type':Sequelize[_0xd160('0x2')]},'callerid':{'type':Sequelize[_0xd160('0x2')],'defaultValue':_0xd160('0x24')},'amaflags':{'type':Sequelize[_0xd160('0x2')]},'callcounter':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xd160('0x23')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'allowsubscribe':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'allowtransfer':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'ignoresdpversion':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no',_0xd160('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xd160('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'mailbox':{'type':Sequelize[_0xd160('0x2')]},'session_timers':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x26'),'refuse','originate')},'session_expires':{'type':Sequelize[_0xd160('0x23')](0xb)},'session_minse':{'type':Sequelize[_0xd160('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x27'),'uas'),'defaultValue':_0xd160('0x28')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xd160('0x2')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xd160('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xd160('0x23')](0xb)},'defaultip':{'type':Sequelize[_0xd160('0x2')]},'defaultuser':{'type':Sequelize['STRING']},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xd160('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xd160('0x2')]},'callbackextension':{'type':Sequelize[_0xd160('0x2')]},'timert1':{'type':Sequelize[_0xd160('0x23')](0xb)},'timerb':{'type':Sequelize[_0xd160('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0xd160('0x23')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xd160('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xd160('0x2')]},'maxforwards':{'type':Sequelize[_0xd160('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'force_avp':{'type':Sequelize[_0xd160('0x7')]('yes','no')},'icesupport':{'type':Sequelize[_0xd160('0x7')]('yes','no')},'dtlsenable':{'type':Sequelize[_0xd160('0x7')]('yes','no')},'dtlsverify':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no',_0xd160('0x29'),_0xd160('0x2a'))},'dtlsrekey':{'type':Sequelize[_0xd160('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0xd160('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xd160('0x2')]},'dtlscipher':{'type':Sequelize[_0xd160('0x2')]},'dtlscafile':{'type':Sequelize[_0xd160('0x2')]},'dtlscapath':{'type':Sequelize['STRING']},'dtlssetup':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x2b'),_0xd160('0x2c'),_0xd160('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0xd160('0x2')]},'call_limit':{'type':Sequelize[_0xd160('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xd160('0x14'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xd160('0x2')]},'mohsuggest':{'type':Sequelize[_0xd160('0x2')]},'parkinglot':{'type':Sequelize[_0xd160('0x2')]},'description':{'type':Sequelize[_0xd160('0x2')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xd160('0x2e')},'canreinvite':{'type':Sequelize[_0xd160('0x7')](_0xd160('0x14'),'no','nonat',_0xd160('0x16'),_0xd160('0x2f')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xd160('0x2')]},'otherFields':{'type':Sequelize[_0xd160('0x2')]},'active':{'type':Sequelize[_0xd160('0x30')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}};
\ No newline at end of file
index 5f7155c..8bd310d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));};
\ No newline at end of file
+var _0x9a19=['query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','show','include','find','clone','params','omit','updatedAt','body','createdAt','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','role','autoAssociation','findAll','readFileSync','writeFileSync','Reload','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','fieldName','type'];(function(_0x1de83e,_0xc143c8){var _0x5a54d9=function(_0x2caeae){while(--_0x2caeae){_0x1de83e['push'](_0x1de83e['shift']());}};_0x5a54d9(++_0xc143c8);}(_0x9a19,0x114));var _0x99a1=function(_0x3cc9d9,_0x69ed38){_0x3cc9d9=_0x3cc9d9-0x0;var _0x1a425d=_0x9a19[_0x3cc9d9];return _0x1a425d;};'use strict';var emlformat=require(_0x99a1('0x0'));var rimraf=require(_0x99a1('0x1'));var zipdir=require(_0x99a1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x99a1('0x3'));var moment=require(_0x99a1('0x4'));var BPromise=require(_0x99a1('0x5'));var Mustache=require(_0x99a1('0x6'));var util=require(_0x99a1('0x7'));var path=require(_0x99a1('0x8'));var sox=require(_0x99a1('0x9'));var csv=require(_0x99a1('0xa'));var ejs=require(_0x99a1('0xb'));var fs=require('fs');var fs_extra=require(_0x99a1('0xc'));var _=require(_0x99a1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x99a1('0xe'));var toCsv=require(_0x99a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x99a1('0xf'));var authService=require(_0x99a1('0x10'));var qs=require(_0x99a1('0x11'));var as=require(_0x99a1('0x12'));var hardwareService=require(_0x99a1('0x13'));var logger=require('../../config/logger')(_0x99a1('0x14'));var utils=require(_0x99a1('0x15'));var config=require(_0x99a1('0x16'));var licenseUtil=require(_0x99a1('0x17'));var db=require(_0x99a1('0x18'))['db'];var jayson=require(_0x99a1('0x19'));var client=jayson[_0x99a1('0x1a')][_0x99a1('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0xf713b9,_0x40c19c,_0x3a865c,_0x47815e){return new BPromise(function(_0xe1a1f,_0x3c9ef4){var _0x39ee55=_0x47815e||client;return _0x39ee55['request'](_0xf713b9,_0x3a865c)[_0x99a1('0x1c')](function(_0x3e45d4){logger[_0x99a1('0x1d')](_0x99a1('0x1e'),_0x40c19c,_0x99a1('0x1f'));logger[_0x99a1('0x20')](_0x99a1('0x21'),_0x40c19c,'request\x20sent',JSON['stringify'](_0x3e45d4));if(_0x3e45d4[_0x99a1('0x22')]){if(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x23')]===0x1f4){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);return _0x3c9ef4(_0x3e45d4[_0x99a1('0x22')][_0x99a1('0x24')]);}logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x3e45d4['error'][_0x99a1('0x24')]);return _0xe1a1f(_0x3e45d4[_0x99a1('0x22')]['message']);}else{logger[_0x99a1('0x1d')]('Trunk,\x20%s,\x20%s',_0x40c19c,_0x99a1('0x1f'));_0xe1a1f(_0x3e45d4[_0x99a1('0x25')][_0x99a1('0x24')]);}})[_0x99a1('0x26')](function(_0x5a88c6){logger[_0x99a1('0x22')](_0x99a1('0x1e'),_0x40c19c,_0x5a88c6);_0x3c9ef4(_0x5a88c6);});});}function respondWithStatusCode(_0x483c17,_0x44df2d){_0x44df2d=_0x44df2d||0xcc;return function(_0x5b5dfa){if(_0x5b5dfa){return _0x483c17[_0x99a1('0x27')](_0x44df2d);}return _0x483c17[_0x99a1('0x28')](_0x44df2d)[_0x99a1('0x29')]();};}function respondWithResult(_0xdaa27d,_0x3c813){_0x3c813=_0x3c813||0xc8;return function(_0x491341){if(_0x491341){return _0xdaa27d['status'](_0x3c813)[_0x99a1('0x2a')](_0x491341);}};}function respondWithFilteredResult(_0x5dabd9,_0x5dc733){return function(_0xafea84){if(_0xafea84){var _0x440879=typeof _0x5dc733[_0x99a1('0x2b')]===_0x99a1('0x2c')&&typeof _0x5dc733[_0x99a1('0x2d')]===_0x99a1('0x2c');var _0x183037=_0xafea84['count'];var _0xf41b0d=_0x440879?0x0:_0x5dc733['offset'];var _0x255197=_0x440879?_0xafea84[_0x99a1('0x2e')]:_0x5dc733[_0x99a1('0x2b')]+_0x5dc733['limit'];var _0x371edf;if(_0x255197>=_0x183037){_0x255197=_0x183037;_0x371edf=0xc8;}else{_0x371edf=0xce;}_0x5dabd9[_0x99a1('0x28')](_0x371edf);return _0x5dabd9['set'](_0x99a1('0x2f'),_0xf41b0d+'-'+_0x255197+'/'+_0x183037)[_0x99a1('0x2a')](_0xafea84);}return null;};}function patchUpdates(_0x36aa34){return function(_0x303d1e){try{jsonpatch[_0x99a1('0x30')](_0x303d1e,_0x36aa34,!![]);}catch(_0x969f6e){return BPromise[_0x99a1('0x31')](_0x969f6e);}return _0x303d1e[_0x99a1('0x32')]();};}function saveUpdates(_0x52da8d,_0x4960e4){return function(_0x3fa342){if(_0x3fa342){return _0x3fa342['update'](_0x52da8d)[_0x99a1('0x1c')](function(_0x400581){return _0x400581;});}return null;};}function removeEntity(_0x5b1a79,_0xa5972b){return function(_0x3503d5){if(_0x3503d5){return _0x3503d5[_0x99a1('0x33')]()[_0x99a1('0x1c')](function(){var _0x13f4db=_0x3503d5[_0x99a1('0x34')]({'plain':!![]});var _0x3081cd=_0x99a1('0x35');return db[_0x99a1('0x36')][_0x99a1('0x33')]({'where':{'type':_0x3081cd,'resourceId':_0x13f4db['id']}})[_0x99a1('0x1c')](function(){return _0x3503d5;});})[_0x99a1('0x1c')](function(){_0x5b1a79[_0x99a1('0x28')](0xcc)[_0x99a1('0x29')]();});}};}function handleEntityNotFound(_0x55005e,_0x53fed5){return function(_0x46e3f2){if(!_0x46e3f2){_0x55005e[_0x99a1('0x27')](0x194);}return _0x46e3f2;};}function handleError(_0x416a36,_0x4131e0){_0x4131e0=_0x4131e0||0x1f4;return function(_0x2690bd){logger[_0x99a1('0x22')](_0x2690bd[_0x99a1('0x37')]);if(_0x2690bd['name']){delete _0x2690bd[_0x99a1('0x38')];}_0x416a36[_0x99a1('0x28')](_0x4131e0)['send'](_0x2690bd);};}exports[_0x99a1('0x39')]=function(_0x2d328c,_0x391afa){var _0x3cd1a0={},_0x430cbc={},_0x399fd4={'count':0x0,'rows':[]};var _0x30e8a9=_[_0x99a1('0x3a')](db[_0x99a1('0x3b')][_0x99a1('0x3c')],function(_0x1da3e7){return{'name':_0x1da3e7[_0x99a1('0x3d')],'type':_0x1da3e7[_0x99a1('0x3e')]['key']};});_0x430cbc['model']=_['map'](_0x30e8a9,_0x99a1('0x38'));_0x430cbc[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x2d328c[_0x99a1('0x3f')]);_0x430cbc[_0x99a1('0x41')]=_['intersection'](_0x430cbc[_0x99a1('0x42')],_0x430cbc[_0x99a1('0x3f')]);_0x3cd1a0[_0x99a1('0x43')]=_['intersection'](_0x430cbc['model'],qs[_0x99a1('0x44')](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x3cd1a0['attributes']=_0x3cd1a0[_0x99a1('0x43')][_0x99a1('0x45')]?_0x3cd1a0[_0x99a1('0x43')]:_0x430cbc[_0x99a1('0x42')];if(!_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x46')](_0x99a1('0x47'))){_0x3cd1a0[_0x99a1('0x2d')]=qs[_0x99a1('0x2d')](_0x2d328c[_0x99a1('0x3f')]['limit']);_0x3cd1a0[_0x99a1('0x2b')]=qs[_0x99a1('0x2b')](_0x2d328c[_0x99a1('0x3f')]['offset']);}_0x3cd1a0[_0x99a1('0x48')]=qs['sort'](_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x49')]);_0x3cd1a0[_0x99a1('0x4a')]=qs[_0x99a1('0x41')](_[_0x99a1('0x4b')](_0x2d328c[_0x99a1('0x3f')],_0x430cbc['filters']),_0x30e8a9);if(_0x2d328c[_0x99a1('0x3f')]['filter']){_0x3cd1a0[_0x99a1('0x4a')]=_[_0x99a1('0x4c')](_0x3cd1a0[_0x99a1('0x4a')],{'$or':_[_0x99a1('0x3a')](_0x30e8a9,function(_0x3a0b44){if(_0x3a0b44[_0x99a1('0x3e')]!==_0x99a1('0x4d')){var _0x3861b6={};_0x3861b6[_0x3a0b44[_0x99a1('0x38')]]={'$like':'%'+_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x4e')]+'%'};return _0x3861b6;}})});}_0x3cd1a0=_['merge']({},_0x3cd1a0,_0x2d328c[_0x99a1('0x4f')]);var _0x330e3b={'where':_0x3cd1a0['where']};return db[_0x99a1('0x3b')][_0x99a1('0x2e')](_0x330e3b)[_0x99a1('0x1c')](function(_0x2e377b){_0x399fd4[_0x99a1('0x2e')]=_0x2e377b;if(_0x2d328c[_0x99a1('0x3f')][_0x99a1('0x50')]){_0x3cd1a0['include']=[{'all':!![]}];}return db[_0x99a1('0x3b')]['findAll'](_0x3cd1a0);})[_0x99a1('0x1c')](function(_0x269798){_0x399fd4['rows']=_0x269798;return _0x399fd4;})['then'](respondWithFilteredResult(_0x391afa,_0x3cd1a0))[_0x99a1('0x26')](handleError(_0x391afa,null));};exports[_0x99a1('0x51')]=function(_0x462c15,_0x4519fb){var _0xee2b1b={'raw':![],'where':{'id':_0x462c15['params']['id']}},_0x597836={};_0x597836['model']=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x597836[_0x99a1('0x3f')]=_[_0x99a1('0x40')](_0x462c15[_0x99a1('0x3f')]);_0x597836[_0x99a1('0x41')]=_['intersection'](_0x597836[_0x99a1('0x42')],_0x597836[_0x99a1('0x3f')]);_0xee2b1b[_0x99a1('0x43')]=_['intersection'](_0x597836[_0x99a1('0x42')],qs['fields'](_0x462c15['query'][_0x99a1('0x44')]));_0xee2b1b[_0x99a1('0x43')]=_0xee2b1b[_0x99a1('0x43')][_0x99a1('0x45')]?_0xee2b1b[_0x99a1('0x43')]:_0x597836[_0x99a1('0x42')];if(_0x462c15[_0x99a1('0x3f')][_0x99a1('0x50')]){_0xee2b1b[_0x99a1('0x52')]=[{'all':!![]}];}_0xee2b1b=_['merge']({},_0xee2b1b,_0x462c15[_0x99a1('0x4f')]);return db['Trunk'][_0x99a1('0x53')](_0xee2b1b)[_0x99a1('0x1c')](handleEntityNotFound(_0x4519fb,null))['then'](respondWithResult(_0x4519fb,null))[_0x99a1('0x26')](handleError(_0x4519fb,null));};exports[_0x99a1('0x54')]=function(_0x469e10,_0x2b2d63){var _0x2800d5={'where':{'id':_0x469e10[_0x99a1('0x55')]['id']}},_0x1bff78={};_0x1bff78[_0x99a1('0x42')]=_[_0x99a1('0x40')](db[_0x99a1('0x3b')][_0x99a1('0x3c')]);_0x2800d5[_0x99a1('0x43')]=_['intersection'](_0x1bff78['model'],qs[_0x99a1('0x44')](_0x469e10[_0x99a1('0x3f')][_0x99a1('0x44')]));_0x2800d5[_0x99a1('0x43')]=_0x2800d5[_0x99a1('0x43')]['length']?_0x2800d5[_0x99a1('0x43')]:_0x1bff78[_0x99a1('0x42')];if(_0x469e10['query'][_0x99a1('0x50')]){_0x2800d5[_0x99a1('0x52')]=[{'all':!![]}];}_0x2800d5=_[_0x99a1('0x4c')]({},_0x2800d5,_0x469e10[_0x99a1('0x4f')]);return db[_0x99a1('0x3b')]['find'](_0x2800d5)[_0x99a1('0x1c')](handleEntityNotFound(_0x2b2d63,null))[_0x99a1('0x1c')](function(_0x1bb1cb){if(_0x1bb1cb){var _0x22811f=_0x1bb1cb[_0x99a1('0x34')]({'plain':!![]});_0x22811f=qs[_0x99a1('0x56')](_0x22811f,['id','createdAt',_0x99a1('0x57')]);_0x469e10[_0x99a1('0x58')]=_['omit'](_0x469e10[_0x99a1('0x58')],['id',_0x99a1('0x59'),_0x99a1('0x57')]);return db[_0x99a1('0x3b')][_0x99a1('0x5a')](_['merge'](_0x22811f,_0x469e10[_0x99a1('0x58')]),{'include':_0x469e10['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x38ce3c){var _0x3f7c16=_0x469e10['user']['get']({'plain':!![]});if(!_0x3f7c16)throw new Error(_0x99a1('0x5b'));if(_0x3f7c16['role']===_0x99a1('0x5c')){var _0x263db3=_0x38ce3c[_0x99a1('0x34')]({'plain':!![]});var _0x180c1e='Trunks';return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x180c1e,'userProfileId':_0x3f7c16[_0x99a1('0x5e')]},'raw':!![]})['then'](function(_0x3a62c6){if(_0x3a62c6&&_0x3a62c6['autoAssociation']===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x263db3[_0x99a1('0x38')],'resourceId':_0x263db3['id'],'type':_0x3a62c6[_0x99a1('0x38')],'sectionId':_0x3a62c6['id']},{})[_0x99a1('0x1c')](function(){return _0x38ce3c;});}else{return _0x38ce3c;}})['catch'](function(_0x4d37f8){logger['error'](_0x99a1('0x5f'),_0x4d37f8);throw _0x4d37f8;});}return _0x38ce3c;});}})[_0x99a1('0x1c')](respondWithResult(_0x2b2d63,0xc9))['catch'](handleError(_0x2b2d63,null));};exports['create']=function(_0x1fe7af,_0x2f5587,_0x401c8f){var _0x509d4f;return db['Trunk'][_0x99a1('0x5a')](_0x1fe7af['body'],{'raw':!![]})[_0x99a1('0x1c')](function(_0x129690){_0x509d4f=_0x129690;return db[_0x99a1('0x3b')]['findAll']({'raw':!![]});})[_0x99a1('0x1c')](function(_0x28c7d8){var _0x4ac99e=fs['readFileSync'](path[_0x99a1('0x60')](config['root'],_0x99a1('0x61')),_0x99a1('0x62'));var _0x30a0a5=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x3d0ff6=ejs['render'](_0x4ac99e,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x65'),_0x3d0ff6);if(_0x509d4f[_0x99a1('0x66')]){var _0x1750d5=ejs[_0x99a1('0x67')](_0x30a0a5,{'trunks':_0x28c7d8||[]});fs['writeFileSync'](_0x99a1('0x68'),_0x1750d5);}})['then'](function(){return respondWithRpcPromise('Reload',_0x99a1('0x5a'),{'module':_0x99a1('0x69')});})[_0x99a1('0x1c')](function(){var _0x525969=_0x1fe7af[_0x99a1('0x5c')][_0x99a1('0x34')]({'plain':!![]});if(!_0x525969)throw new Error(_0x99a1('0x5b'));if(_0x525969[_0x99a1('0x6a')]===_0x99a1('0x5c')){var _0x4ae313=_0x509d4f[_0x99a1('0x34')]({'plain':!![]});return db[_0x99a1('0x5d')][_0x99a1('0x53')]({'where':{'name':_0x99a1('0x35'),'userProfileId':_0x525969[_0x99a1('0x5e')]},'raw':!![]})[_0x99a1('0x1c')](function(_0x5e42be){if(_0x5e42be&&_0x5e42be[_0x99a1('0x6b')]===0x0){return db[_0x99a1('0x36')][_0x99a1('0x5a')]({'name':_0x4ae313[_0x99a1('0x38')],'resourceId':_0x4ae313['id'],'type':_0x5e42be[_0x99a1('0x38')],'sectionId':_0x5e42be['id']},{})['then'](function(){return _0x509d4f;});}else{return _0x509d4f;}})[_0x99a1('0x26')](function(_0x68c944){logger[_0x99a1('0x22')](_0x99a1('0x5f'),_0x68c944);throw _0x68c944;});}return _0x509d4f;})[_0x99a1('0x1c')](respondWithResult(_0x2f5587,0xc9))[_0x99a1('0x26')](handleError(_0x2f5587,null));};exports['update']=function(_0xaa953e,_0x33d96b,_0x4a5617){var _0x56716a;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0xaa953e['params']['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x33d96b,null))[_0x99a1('0x1c')](saveUpdates(_0xaa953e[_0x99a1('0x58')],null))[_0x99a1('0x1c')](function(_0x43156f){if(_0x43156f){_0x56716a=_0x43156f;return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});}})[_0x99a1('0x1c')](function(_0x4260d7){if(_0x4260d7){var _0x3e099c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],'server/files/templates/trunk.ejs'),_0x99a1('0x62'));var _0x5a9a7d=fs['readFileSync'](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0xbbbe26=ejs[_0x99a1('0x67')](_0x3e099c,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0xbbbe26);var _0x361ce6=ejs['render'](_0x5a9a7d,{'trunks':_0x4260d7||[]});fs[_0x99a1('0x6e')](_0x99a1('0x68'),_0x361ce6);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x70'),{'module':_0x99a1('0x69')});}return null;})[_0x99a1('0x1c')](function(_0x6dab29){if(_0x6dab29){return _0x56716a;}})[_0x99a1('0x1c')](respondWithResult(_0x33d96b,null))['catch'](handleError(_0x33d96b,null));};exports['destroy']=function(_0x51c289,_0x2dd29b,_0x353f25){var _0x53cdb3;return db[_0x99a1('0x3b')][_0x99a1('0x53')]({'where':{'id':_0x51c289[_0x99a1('0x55')]['id']}})[_0x99a1('0x1c')](handleEntityNotFound(_0x2dd29b,null))['then'](removeEntity(_0x2dd29b,null))[_0x99a1('0x1c')](function(){return db[_0x99a1('0x3b')][_0x99a1('0x6c')]({'raw':!![]});})[_0x99a1('0x1c')](function(_0x4e9fe9){var _0x24aa05=fs['readFileSync'](path['join'](config['root'],_0x99a1('0x61')),'utf8');var _0xb7744c=fs[_0x99a1('0x6d')](path[_0x99a1('0x60')](config[_0x99a1('0x63')],_0x99a1('0x64')),_0x99a1('0x62'));var _0x444e43=ejs['render'](_0x24aa05,{'trunks':_0x4e9fe9});var _0x4fcd65=ejs[_0x99a1('0x67')](_0xb7744c,{'trunks':_0x4e9fe9});fs[_0x99a1('0x6e')](_0x99a1('0x65'),_0x444e43);fs['writeFileSync'](_0x99a1('0x68'),_0x4fcd65);return respondWithRpcPromise(_0x99a1('0x6f'),_0x99a1('0x33'),{'module':'chan_sip.so'});})[_0x99a1('0x26')](handleError(_0x2dd29b,null));};
\ No newline at end of file
index e88a25c..e34cd40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb340=['../../config/logger','moment','bluebird','request-promise','rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util'];(function(_0x3bd723,_0x1f6d0f){var _0x57636c=function(_0x35c03f){while(--_0x35c03f){_0x3bd723['push'](_0x3bd723['shift']());}};_0x57636c(++_0x1f6d0f);}(_0xb340,0x82));var _0x0b34=function(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xb340[_0x25bea7];return _0x175952;};'use strict';var _=require(_0x0b34('0x0'));var util=require(_0x0b34('0x1'));var logger=require(_0x0b34('0x2'))('api');var moment=require(_0x0b34('0x3'));var BPromise=require(_0x0b34('0x4'));var rp=require(_0x0b34('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0b34('0x6'));var config=require('../../config/environment');var attributes=require(_0x0b34('0x7'));module[_0x0b34('0x8')]=function(_0x4afba2,_0x1ecff2){return _0x4afba2[_0x0b34('0x9')](_0x0b34('0xa'),attributes,{'tableName':_0x0b34('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xaf5d=['../../config/environment','./trunk.attributes','exports','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird','rimraf'];(function(_0xcafced,_0x321e54){var _0x309e4f=function(_0x377107){while(--_0x377107){_0xcafced['push'](_0xcafced['shift']());}};_0x309e4f(++_0x321e54);}(_0xaf5d,0x143));var _0xdaf5=function(_0x112cca,_0x1e2b0a){_0x112cca=_0x112cca-0x0;var _0x3eacf1=_0xaf5d[_0x112cca];return _0x3eacf1;};'use strict';var _=require(_0xdaf5('0x0'));var util=require(_0xdaf5('0x1'));var logger=require(_0xdaf5('0x2'))(_0xdaf5('0x3'));var moment=require(_0xdaf5('0x4'));var BPromise=require(_0xdaf5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaf5('0x6'));var config=require(_0xdaf5('0x7'));var attributes=require(_0xdaf5('0x8'));module[_0xdaf5('0x9')]=function(_0x222f4b,_0x138b19){return _0x222f4b['define']('Trunk',attributes,{'tableName':_0xdaf5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 9a0e4a4..70be4bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8926=['ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','code','error','message','catch','GetTrunk','Trunk','findAll','raw','options','where','attributes','include','map','model','stringify'];(function(_0x53ac18,_0x10c1ba){var _0x15a924=function(_0x57973c){while(--_0x57973c){_0x53ac18['push'](_0x53ac18['shift']());}};_0x15a924(++_0x10c1ba);}(_0x8926,0x199));var _0x6892=function(_0x7bdb4a,_0xc2b4fc){_0x7bdb4a=_0x7bdb4a-0x0;var _0x28d129=_0x8926[_0x7bdb4a];return _0x28d129;};'use strict';var _=require('lodash');var util=require(_0x6892('0x0'));var moment=require(_0x6892('0x1'));var BPromise=require(_0x6892('0x2'));var rs=require(_0x6892('0x3'));var fs=require('fs');var Redis=require(_0x6892('0x4'));var db=require(_0x6892('0x5'))['db'];var utils=require(_0x6892('0x6'));var logger=require(_0x6892('0x7'))('rpc');var config=require(_0x6892('0x8'));var jayson=require(_0x6892('0x9'));var client=jayson[_0x6892('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d1942,_0x496c8d,_0x59903b){return new BPromise(function(_0x2f420a,_0x473601){return client[_0x6892('0xb')](_0x3d1942,_0x59903b)[_0x6892('0xc')](function(_0x42247e){logger[_0x6892('0xd')](_0x6892('0xe'),_0x496c8d,_0x6892('0xf'));logger[_0x6892('0x10')](_0x6892('0x11'),_0x496c8d,_0x6892('0xf'),JSON['stringify'](_0x42247e));if(_0x42247e['error']){if(_0x42247e['error'][_0x6892('0x12')]===0x1f4){logger[_0x6892('0x13')](_0x6892('0xe'),_0x496c8d,_0x42247e[_0x6892('0x13')][_0x6892('0x14')]);return _0x473601(_0x42247e['error'][_0x6892('0x14')]);}logger[_0x6892('0x13')](_0x6892('0xe'),_0x496c8d,_0x42247e[_0x6892('0x13')][_0x6892('0x14')]);return _0x2f420a(_0x42247e['error'][_0x6892('0x14')]);}else{logger['info'](_0x6892('0xe'),_0x496c8d,_0x6892('0xf'));_0x2f420a(_0x42247e['result']['message']);}})[_0x6892('0x15')](function(_0x1325ae){logger[_0x6892('0x13')](_0x6892('0xe'),_0x496c8d,_0x1325ae);_0x473601(_0x1325ae);});});}exports[_0x6892('0x16')]=function(_0x47848a){var _0x333513=this;return new Promise(function(_0x16cd0d,_0x2f4ec2){return db[_0x6892('0x17')][_0x6892('0x18')]({'raw':_0x47848a['options']?_0x47848a['options'][_0x6892('0x19')]===undefined?!![]:![]:!![],'where':_0x47848a[_0x6892('0x1a')]?_0x47848a['options'][_0x6892('0x1b')]||null:null,'attributes':_0x47848a['options']?_0x47848a[_0x6892('0x1a')][_0x6892('0x1c')]||null:null,'limit':_0x47848a[_0x6892('0x1a')]?_0x47848a[_0x6892('0x1a')]['limit']||null:null,'include':_0x47848a[_0x6892('0x1a')]?_0x47848a[_0x6892('0x1a')][_0x6892('0x1d')]?_[_0x6892('0x1e')](_0x47848a[_0x6892('0x1a')][_0x6892('0x1d')],function(_0x5eebd2){return{'model':db[_0x5eebd2[_0x6892('0x1f')]],'as':_0x5eebd2['as'],'attributes':_0x5eebd2[_0x6892('0x1c')],'include':_0x5eebd2['include']?_[_0x6892('0x1e')](_0x5eebd2['include'],function(_0x2b6c76){return{'model':db[_0x2b6c76[_0x6892('0x1f')]],'as':_0x2b6c76['as'],'attributes':_0x2b6c76[_0x6892('0x1c')],'include':_0x2b6c76[_0x6892('0x1d')]?_['map'](_0x2b6c76[_0x6892('0x1d')],function(_0x460e2a){return{'model':db[_0x460e2a['model']],'as':_0x460e2a['as'],'attributes':_0x460e2a[_0x6892('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6892('0xc')](function(_0x2221ba){logger[_0x6892('0xd')](_0x6892('0x16'),_0x47848a);logger[_0x6892('0x10')]('GetTrunk',_0x47848a,JSON[_0x6892('0x20')](_0x2221ba));_0x16cd0d(_0x2221ba);})['catch'](function(_0x1504a3){logger[_0x6892('0x13')](_0x6892('0x16'),_0x1504a3[_0x6892('0x14')],_0x47848a);_0x2f4ec2(_0x333513['error'](0x1f4,_0x1504a3['message']));});});};exports[_0x6892('0x21')]=function(_0x3a67fb){var _0x44d4f3=this;return new Promise(function(_0x30a489,_0x176759){return db['Trunk']['find']({'raw':_0x3a67fb[_0x6892('0x1a')]?_0x3a67fb[_0x6892('0x1a')][_0x6892('0x19')]===undefined?!![]:![]:!![],'where':_0x3a67fb[_0x6892('0x1a')]?_0x3a67fb['options'][_0x6892('0x1b')]||null:null,'attributes':_0x3a67fb[_0x6892('0x1a')]?_0x3a67fb[_0x6892('0x1a')]['attributes']||null:null,'include':_0x3a67fb['options']?_0x3a67fb['options'][_0x6892('0x1d')]?_[_0x6892('0x1e')](_0x3a67fb[_0x6892('0x1a')][_0x6892('0x1d')],function(_0x491c93){return{'model':db[_0x491c93[_0x6892('0x1f')]],'as':_0x491c93['as'],'attributes':_0x491c93[_0x6892('0x1c')],'include':_0x491c93[_0x6892('0x1d')]?_[_0x6892('0x1e')](_0x491c93['include'],function(_0x2dd5dc){return{'model':db[_0x2dd5dc[_0x6892('0x1f')]],'as':_0x2dd5dc['as'],'attributes':_0x2dd5dc[_0x6892('0x1c')],'include':_0x2dd5dc[_0x6892('0x1d')]?_[_0x6892('0x1e')](_0x2dd5dc[_0x6892('0x1d')],function(_0x535e4b){return{'model':db[_0x535e4b[_0x6892('0x1f')]],'as':_0x535e4b['as'],'attributes':_0x535e4b[_0x6892('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x6892('0xc')](function(_0x415841){logger[_0x6892('0xd')](_0x6892('0x21'),_0x3a67fb);logger[_0x6892('0x10')](_0x6892('0x21'),_0x3a67fb,JSON[_0x6892('0x20')](_0x415841));_0x30a489(_0x415841);})['catch'](function(_0x10b9b7){logger[_0x6892('0x13')]('ShowTrunk',_0x10b9b7[_0x6892('0x14')],_0x3a67fb);_0x176759(_0x44d4f3[_0x6892('0x13')](0x1f4,_0x10b9b7[_0x6892('0x14')]));});});};
\ No newline at end of file
+var _0xa0f7=['options','raw','where','attributes','limit','include','map','model','ShowTrunk','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','Trunk','findAll'];(function(_0x876443,_0x291f94){var _0x58ae19=function(_0x441923){while(--_0x441923){_0x876443['push'](_0x876443['shift']());}};_0x58ae19(++_0x291f94);}(_0xa0f7,0xe8));var _0x7a0f=function(_0x494c5a,_0x42a134){_0x494c5a=_0x494c5a-0x0;var _0x1764bf=_0xa0f7[_0x494c5a];return _0x1764bf;};'use strict';var _=require(_0x7a0f('0x0'));var util=require(_0x7a0f('0x1'));var moment=require(_0x7a0f('0x2'));var BPromise=require(_0x7a0f('0x3'));var rs=require(_0x7a0f('0x4'));var fs=require('fs');var Redis=require(_0x7a0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a0f('0x6'));var logger=require('../../config/logger')(_0x7a0f('0x7'));var config=require(_0x7a0f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7a0f('0x9')][_0x7a0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41161e,_0x5632dc,_0x4b6f63){return new BPromise(function(_0x4cdef7,_0x278819){return client[_0x7a0f('0xb')](_0x41161e,_0x4b6f63)[_0x7a0f('0xc')](function(_0x1ab914){logger[_0x7a0f('0xd')]('Trunk,\x20%s,\x20%s',_0x5632dc,_0x7a0f('0xe'));logger[_0x7a0f('0xf')](_0x7a0f('0x10'),_0x5632dc,'request\x20sent',JSON[_0x7a0f('0x11')](_0x1ab914));if(_0x1ab914[_0x7a0f('0x12')]){if(_0x1ab914['error'][_0x7a0f('0x13')]===0x1f4){logger[_0x7a0f('0x12')](_0x7a0f('0x14'),_0x5632dc,_0x1ab914[_0x7a0f('0x12')][_0x7a0f('0x15')]);return _0x278819(_0x1ab914[_0x7a0f('0x12')]['message']);}logger['error'](_0x7a0f('0x14'),_0x5632dc,_0x1ab914[_0x7a0f('0x12')]['message']);return _0x4cdef7(_0x1ab914['error'][_0x7a0f('0x15')]);}else{logger['info'](_0x7a0f('0x14'),_0x5632dc,_0x7a0f('0xe'));_0x4cdef7(_0x1ab914[_0x7a0f('0x16')]['message']);}})[_0x7a0f('0x17')](function(_0x9cfc96){logger['error'](_0x7a0f('0x14'),_0x5632dc,_0x9cfc96);_0x278819(_0x9cfc96);});});}exports[_0x7a0f('0x18')]=function(_0x2c1ab5){var _0x1ace23=this;return new Promise(function(_0x2f43d9,_0x53fb6a){return db[_0x7a0f('0x19')][_0x7a0f('0x1a')]({'raw':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5['options'][_0x7a0f('0x1d')]||null:null,'attributes':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x1e')]||null:null,'limit':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x1f')]||null:null,'include':_0x2c1ab5[_0x7a0f('0x1b')]?_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x20')]?_[_0x7a0f('0x21')](_0x2c1ab5[_0x7a0f('0x1b')][_0x7a0f('0x20')],function(_0x51ac02){return{'model':db[_0x51ac02[_0x7a0f('0x22')]],'as':_0x51ac02['as'],'attributes':_0x51ac02[_0x7a0f('0x1e')],'include':_0x51ac02[_0x7a0f('0x20')]?_['map'](_0x51ac02['include'],function(_0x29aff1){return{'model':db[_0x29aff1[_0x7a0f('0x22')]],'as':_0x29aff1['as'],'attributes':_0x29aff1['attributes'],'include':_0x29aff1[_0x7a0f('0x20')]?_[_0x7a0f('0x21')](_0x29aff1[_0x7a0f('0x20')],function(_0x36732d){return{'model':db[_0x36732d[_0x7a0f('0x22')]],'as':_0x36732d['as'],'attributes':_0x36732d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xf8a87c){logger[_0x7a0f('0xd')](_0x7a0f('0x18'),_0x2c1ab5);logger[_0x7a0f('0xf')](_0x7a0f('0x18'),_0x2c1ab5,JSON[_0x7a0f('0x11')](_0xf8a87c));_0x2f43d9(_0xf8a87c);})['catch'](function(_0x9353bb){logger[_0x7a0f('0x12')](_0x7a0f('0x18'),_0x9353bb[_0x7a0f('0x15')],_0x2c1ab5);_0x53fb6a(_0x1ace23[_0x7a0f('0x12')](0x1f4,_0x9353bb[_0x7a0f('0x15')]));});});};exports[_0x7a0f('0x23')]=function(_0x341b20){var _0x19ca2c=this;return new Promise(function(_0x1a49b9,_0xe6890e){return db[_0x7a0f('0x19')][_0x7a0f('0x24')]({'raw':_0x341b20[_0x7a0f('0x1b')]?_0x341b20[_0x7a0f('0x1b')][_0x7a0f('0x1c')]===undefined?!![]:![]:!![],'where':_0x341b20[_0x7a0f('0x1b')]?_0x341b20[_0x7a0f('0x1b')][_0x7a0f('0x1d')]||null:null,'attributes':_0x341b20[_0x7a0f('0x1b')]?_0x341b20['options'][_0x7a0f('0x1e')]||null:null,'include':_0x341b20['options']?_0x341b20[_0x7a0f('0x1b')]['include']?_[_0x7a0f('0x21')](_0x341b20[_0x7a0f('0x1b')][_0x7a0f('0x20')],function(_0x2f2d66){return{'model':db[_0x2f2d66[_0x7a0f('0x22')]],'as':_0x2f2d66['as'],'attributes':_0x2f2d66['attributes'],'include':_0x2f2d66[_0x7a0f('0x20')]?_[_0x7a0f('0x21')](_0x2f2d66[_0x7a0f('0x20')],function(_0x1faa76){return{'model':db[_0x1faa76[_0x7a0f('0x22')]],'as':_0x1faa76['as'],'attributes':_0x1faa76['attributes'],'include':_0x1faa76[_0x7a0f('0x20')]?_[_0x7a0f('0x21')](_0x1faa76[_0x7a0f('0x20')],function(_0x2fe2dc){return{'model':db[_0x2fe2dc[_0x7a0f('0x22')]],'as':_0x2fe2dc['as'],'attributes':_0x2fe2dc[_0x7a0f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7a0f('0xc')](function(_0x3d40f7){logger['info'](_0x7a0f('0x23'),_0x341b20);logger['debug']('ShowTrunk',_0x341b20,JSON[_0x7a0f('0x11')](_0x3d40f7));_0x1a49b9(_0x3d40f7);})['catch'](function(_0x8d7f50){logger[_0x7a0f('0x12')]('ShowTrunk',_0x8d7f50[_0x7a0f('0x15')],_0x341b20);_0xe6890e(_0x19ca2c['error'](0x1f4,_0x8d7f50[_0x7a0f('0x15')]));});});};
\ No newline at end of file
index 063b652..f59e07e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x301c=['exports','express','Router','../../components/auth/service','put','isAuthenticated','update'];(function(_0x551150,_0x1b58e8){var _0x57ca32=function(_0x461a8e){while(--_0x461a8e){_0x551150['push'](_0x551150['shift']());}};_0x57ca32(++_0x1b58e8);}(_0x301c,0x127));var _0xc301=function(_0x3f0577,_0x13d404){_0x3f0577=_0x3f0577-0x0;var _0x3c70dc=_0x301c[_0x3f0577];return _0x3c70dc;};'use strict';var express=require(_0xc301('0x0'));var router=express[_0xc301('0x1')]();var auth=require(_0xc301('0x2'));var controller=require('./user-setting.controller');router[_0xc301('0x3')]('/:id',auth[_0xc301('0x4')](),controller[_0xc301('0x5')]);module[_0xc301('0x6')]=router;
\ No newline at end of file
+var _0x3d5a=['update','exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated'];(function(_0x14d26e,_0x10645d){var _0x3c2282=function(_0x1ab037){while(--_0x1ab037){_0x14d26e['push'](_0x14d26e['shift']());}};_0x3c2282(++_0x10645d);}(_0x3d5a,0x1a0));var _0xa3d5=function(_0x20fa63,_0x65c8d3){_0x20fa63=_0x20fa63-0x0;var _0x4c37ae=_0x3d5a[_0x20fa63];return _0x4c37ae;};'use strict';var express=require(_0xa3d5('0x0'));var router=express[_0xa3d5('0x1')]();var auth=require(_0xa3d5('0x2'));var controller=require(_0xa3d5('0x3'));router[_0xa3d5('0x4')](_0xa3d5('0x5'),auth[_0xa3d5('0x6')](),controller[_0xa3d5('0x7')]);module[_0xa3d5('0x8')]=router;
\ No newline at end of file
index 5884489..16fd5f1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7762=['info','debug','exports','ENUM','error','BOOLEAN','DATE','INTEGER','UserId','sequelize','warning'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7762,0x17f));var _0x2776=function(_0x30e100,_0x4108b9){_0x30e100=_0x30e100-0x0;var _0x441eaf=_0x7762[_0x30e100];return _0x441eaf;};'use strict';var Sequelize=require(_0x2776('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0x2776('0x1'),_0x2776('0x2'),_0x2776('0x3')];module[_0x2776('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x2776('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x2776('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x2776('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x2776('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x2776('0x9')],'unique':_0x2776('0xa')}};
\ No newline at end of file
+var _0xa96e=['warning','info','debug','exports','BOOLEAN','TEXT','DATE','INTEGER','UserId','error'];(function(_0x45b9b5,_0x3bb244){var _0x2fd55c=function(_0x33f0e6){while(--_0x33f0e6){_0x45b9b5['push'](_0x45b9b5['shift']());}};_0x2fd55c(++_0x3bb244);}(_0xa96e,0x149));var _0xea96=function(_0x252a77,_0x5f36e7){_0x252a77=_0x252a77-0x0;var _0x1217c2=_0xa96e[_0x252a77];return _0x1217c2;};'use strict';var Sequelize=require('sequelize');const CLIENT_SIDE_LOG_LEVELS=[_0xea96('0x0'),_0xea96('0x1'),_0xea96('0x2'),_0xea96('0x3')];module[_0xea96('0x4')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xea96('0x0'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xea96('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xea96('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xea96('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xea96('0x8')],'unique':_0xea96('0x9')}};
\ No newline at end of file
index 6240955..8b2f927 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x192f=['error','stack','name','send','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find','then','body','catch','lodash','../../config/logger','../../config/environment','redis','./user-setting.socket','register','defaults','status','json','update','sendStatus'];(function(_0x32d462,_0x55a179){var _0x990c6e=function(_0x299190){while(--_0x299190){_0x32d462['push'](_0x32d462['shift']());}};_0x990c6e(++_0x55a179);}(_0x192f,0xd6));var _0xf192=function(_0x5f70f7,_0x40e327){_0x5f70f7=_0x5f70f7-0x0;var _0x94fca7=_0x192f[_0x5f70f7];return _0x94fca7;};'use strict';var _=require(_0xf192('0x0'));var Redis=require('ioredis');var logger=require(_0xf192('0x1'))('api');var config=require(_0xf192('0x2'));var db=require('../../mysqldb')['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xf192('0x3')]));require(_0xf192('0x4'))[_0xf192('0x5')](socket);config[_0xf192('0x3')]=_[_0xf192('0x6')](config[_0xf192('0x3')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x38dcbf,_0x4171d9){_0x4171d9=_0x4171d9||0xc8;return function(_0x5743c9){if(_0x5743c9){return _0x38dcbf[_0xf192('0x7')](_0x4171d9)[_0xf192('0x8')](_0x5743c9);}};}function saveUpdates(_0x18fc0e){return function(_0x24398d){if(_0x24398d){return _0x24398d[_0xf192('0x9')](_0x18fc0e)['then'](function(_0x4c9d03){return _0x4c9d03;});}return null;};}function handleEntityNotFound(_0x3004d1){return function(_0x3389aa){if(!_0x3389aa){_0x3004d1[_0xf192('0xa')](0x194);}return _0x3389aa;};}function handleError(_0x2cb4b2,_0x2ef3e8){_0x2ef3e8=_0x2ef3e8||0x1f4;return function(_0xd855ea){logger[_0xf192('0xb')](_0xd855ea[_0xf192('0xc')]);if(_0xd855ea['name']){delete _0xd855ea[_0xf192('0xd')];}_0x2cb4b2[_0xf192('0x7')](_0x2ef3e8)[_0xf192('0xe')](_0xd855ea);};}exports[_0xf192('0x9')]=function(_0x321c6b,_0x20bbcf){if(_0x321c6b[_0xf192('0xf')][_0xf192('0x10')]!==_0xf192('0x11'))throw new Error(_0xf192('0x12'));if(isNaN(Number(_0x321c6b[_0xf192('0x13')]['id'])))throw new Error(_0xf192('0x14'));return db['UserSetting'][_0xf192('0x15')]({'where':{'id':_0x321c6b[_0xf192('0x13')]['id']}})['then'](handleEntityNotFound(_0x20bbcf,null))[_0xf192('0x16')](saveUpdates(_0x321c6b[_0xf192('0x17')],null))[_0xf192('0x16')](respondWithResult(_0x20bbcf,null))[_0xf192('0x18')](handleError(_0x20bbcf,null));};
\ No newline at end of file
+var _0x3379=['then','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','localhost','status','json','update','sendStatus','error','stack','name','send','user','role','admin','Invalid\x20user\x20setting\x20id','params'];(function(_0x5e941e,_0x178858){var _0x172fb0=function(_0x36321b){while(--_0x36321b){_0x5e941e['push'](_0x5e941e['shift']());}};_0x172fb0(++_0x178858);}(_0x3379,0x115));var _0x9337=function(_0x4af320,_0x10b274){_0x4af320=_0x4af320-0x0;var _0x178fce=_0x3379[_0x4af320];return _0x178fce;};'use strict';var _=require(_0x9337('0x0'));var Redis=require(_0x9337('0x1'));var logger=require(_0x9337('0x2'))(_0x9337('0x3'));var config=require('../../config/environment');var db=require(_0x9337('0x4'))['db'];var socket=require(_0x9337('0x5'))(new Redis(config[_0x9337('0x6')]));require(_0x9337('0x7'))['register'](socket);config[_0x9337('0x6')]=_[_0x9337('0x8')](config[_0x9337('0x6')],{'host':_0x9337('0x9'),'port':0x18eb});function respondWithResult(_0x5a59ab,_0x16e2a4){_0x16e2a4=_0x16e2a4||0xc8;return function(_0x5b1986){if(_0x5b1986){return _0x5a59ab[_0x9337('0xa')](_0x16e2a4)[_0x9337('0xb')](_0x5b1986);}};}function saveUpdates(_0x240bfc){return function(_0x175eb2){if(_0x175eb2){return _0x175eb2[_0x9337('0xc')](_0x240bfc)['then'](function(_0xd9b084){return _0xd9b084;});}return null;};}function handleEntityNotFound(_0x1630bf){return function(_0xc985d1){if(!_0xc985d1){_0x1630bf[_0x9337('0xd')](0x194);}return _0xc985d1;};}function handleError(_0x26995d,_0x5dc1b5){_0x5dc1b5=_0x5dc1b5||0x1f4;return function(_0x2ee523){logger[_0x9337('0xe')](_0x2ee523[_0x9337('0xf')]);if(_0x2ee523[_0x9337('0x10')]){delete _0x2ee523[_0x9337('0x10')];}_0x26995d[_0x9337('0xa')](_0x5dc1b5)[_0x9337('0x11')](_0x2ee523);};}exports['update']=function(_0x4dafd1,_0xa58254){if(_0x4dafd1[_0x9337('0x12')][_0x9337('0x13')]!==_0x9337('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x4dafd1['params']['id'])))throw new Error(_0x9337('0x15'));return db['UserSetting']['find']({'where':{'id':_0x4dafd1[_0x9337('0x16')]['id']}})[_0x9337('0x17')](handleEntityNotFound(_0xa58254,null))[_0x9337('0x17')](saveUpdates(_0x4dafd1['body'],null))[_0x9337('0x17')](respondWithResult(_0xa58254,null))[_0x9337('0x18')](handleError(_0xa58254,null));};
\ No newline at end of file
index c658c31..dd2c076 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x18bc=['emit','events','../../mysqldb','UserSetting','setMaxListeners','save','remove'];(function(_0x194bc8,_0x68a53b){var _0x47f0b7=function(_0x34de30){while(--_0x34de30){_0x194bc8['push'](_0x194bc8['shift']());}};_0x47f0b7(++_0x68a53b);}(_0x18bc,0x197));var _0xc18b=function(_0x10e5ae,_0x4a8c28){_0x10e5ae=_0x10e5ae-0x0;var _0x27d9b5=_0x18bc[_0x10e5ae];return _0x27d9b5;};'use strict';var EventEmitter=require(_0xc18b('0x0'));var UserSetting=require(_0xc18b('0x1'))['db'][_0xc18b('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xc18b('0x3')](0x0);var events={'afterCreate':_0xc18b('0x4'),'afterUpdate':'update','afterDestroy':_0xc18b('0x5')};function emitEvent(_0x1e252a){return function(_0x4515d6,_0x29243d,_0x484996){UserSettingEvents[_0xc18b('0x6')](_0x1e252a+':'+_0x4515d6['id'],_0x4515d6);UserSettingEvents[_0xc18b('0x6')](_0x1e252a,_0x4515d6);_0x484996(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents;
\ No newline at end of file
+var _0xc447=['hook','exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0xea1fe8,_0x123813){var _0xe6da33=function(_0x27d1e3){while(--_0x27d1e3){_0xea1fe8['push'](_0xea1fe8['shift']());}};_0xe6da33(++_0x123813);}(_0xc447,0x1b2));var _0x7c44=function(_0x4ba9e9,_0x148eb9){_0x4ba9e9=_0x4ba9e9-0x0;var _0x146d0f=_0xc447[_0x4ba9e9];return _0x146d0f;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0x7c44('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x7c44('0x1')](0x0);var events={'afterCreate':_0x7c44('0x2'),'afterUpdate':_0x7c44('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54e0f8){return function(_0x4dedf0,_0x1fb306,_0x506cdf){UserSettingEvents[_0x7c44('0x4')](_0x54e0f8+':'+_0x4dedf0['id'],_0x4dedf0);UserSettingEvents['emit'](_0x54e0f8,_0x4dedf0);_0x506cdf(null);};}for(var e in events){if(events[_0x7c44('0x5')](e)){var event=events[e];UserSetting[_0x7c44('0x6')](e,emitEvent(event));}}module[_0x7c44('0x7')]=UserSettingEvents;
\ No newline at end of file
index 502726b..23b4420 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x51c5=['exports','define','UserSetting','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x3a8df8,_0x355a4c){var _0x434912=function(_0x463e44){while(--_0x463e44){_0x3a8df8['push'](_0x3a8df8['shift']());}};_0x434912(++_0x355a4c);}(_0x51c5,0x8f));var _0x551c=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x51c5[_0x565ed7];return _0x183ad7;};'use strict';var attributes=require(_0x551c('0x0'));module[_0x551c('0x1')]=function(_0x3bdc26){return _0x3bdc26[_0x551c('0x2')](_0x551c('0x3'),attributes,{'tableName':_0x551c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe03709){if(!_0xe03709['clientSideLoggingEnabled'])_0xe03709[_0x551c('0x5')]=null;else if(_0xe03709[_0x551c('0x5')]===null)_0xe03709[_0x551c('0x5')]=new Date();}}});};
\ No newline at end of file
+var _0xd757=['./user-setting.attributes','exports','define','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x5f36f5,_0x645bb3){var _0x3c1c2c=function(_0xb4b4a2){while(--_0xb4b4a2){_0x5f36f5['push'](_0x5f36f5['shift']());}};_0x3c1c2c(++_0x645bb3);}(_0xd757,0x1e5));var _0x7d75=function(_0x216384,_0x5d863e){_0x216384=_0x216384-0x0;var _0x19a108=_0xd757[_0x216384];return _0x19a108;};'use strict';var attributes=require(_0x7d75('0x0'));module[_0x7d75('0x1')]=function(_0xe5c184){return _0xe5c184[_0x7d75('0x2')]('UserSetting',attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x379a63){if(!_0x379a63[_0x7d75('0x3')])_0x379a63['clientSideLoggingEnabledSince']=null;else if(_0x379a63[_0x7d75('0x4')]===null)_0x379a63[_0x7d75('0x4')]=new Date();}}});};
\ No newline at end of file
index b7808a9..7859757 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe781=['user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update','user-setting:update:user-','register'];(function(_0x28a418,_0x301838){var _0x29fd01=function(_0x2e2ac1){while(--_0x2e2ac1){_0x28a418['push'](_0x28a418['shift']());}};_0x29fd01(++_0x301838);}(_0xe781,0x1d5));var _0x1e78=function(_0x38c2ba,_0x58b565){_0x38c2ba=_0x38c2ba-0x0;var _0x42c28a=_0xe781[_0x38c2ba];return _0x42c28a;};'use strict';var UserSettingEvents=require(_0x1e78('0x0'));var events=[_0x1e78('0x1'),_0x1e78('0x2'),_0x1e78('0x3')];function createListener(_0x40f8cc,_0x3ab5eb){return function(_0x483411){_0x3ab5eb[_0x1e78('0x4')](_0x40f8cc,_0x483411);if(_0x40f8cc===_0x1e78('0x5')){_0x3ab5eb[_0x1e78('0x4')](_0x1e78('0x6')+_0x483411['UserId'],_0x483411);}};}exports[_0x1e78('0x7')]=function(_0x2170cc){for(var _0x417f79=0x0,_0x413976=events['length'];_0x417f79<_0x413976;_0x417f79++){var _0x105f48=events[_0x417f79];var _0x270ff8=createListener(_0x1e78('0x8')+_0x105f48,_0x2170cc);UserSettingEvents['on'](_0x105f48,_0x270ff8);}};
\ No newline at end of file
+var _0x4012=['UserId','register','length','user-setting:','./user-setting.events','remove','update','emit','user-setting:update','user-setting:update:user-'];(function(_0x5c7d79,_0x26a45b){var _0x2c7e12=function(_0x33298f){while(--_0x33298f){_0x5c7d79['push'](_0x5c7d79['shift']());}};_0x2c7e12(++_0x26a45b);}(_0x4012,0xd6));var _0x2401=function(_0x3ed24f,_0x5c9202){_0x3ed24f=_0x3ed24f-0x0;var _0x3f2e59=_0x4012[_0x3ed24f];return _0x3f2e59;};'use strict';var UserSettingEvents=require(_0x2401('0x0'));var events=['save',_0x2401('0x1'),_0x2401('0x2')];function createListener(_0x56c6cc,_0x362b73){return function(_0x806284){_0x362b73[_0x2401('0x3')](_0x56c6cc,_0x806284);if(_0x56c6cc===_0x2401('0x4')){_0x362b73[_0x2401('0x3')](_0x2401('0x5')+_0x806284[_0x2401('0x6')],_0x806284);}};}exports[_0x2401('0x7')]=function(_0x38123b){for(var _0x85f35f=0x0,_0x184814=events[_0x2401('0x8')];_0x85f35f<_0x184814;_0x85f35f++){var _0x267711=events[_0x85f35f];var _0x1fb21f=createListener(_0x2401('0x9')+_0x267711,_0x38123b);UserSettingEvents['on'](_0x267711,_0x1fb21f);}};
\ No newline at end of file
index 778c93e..61da088 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f80=['server/files/images/','%s-%s','now','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','put','update','/:id/password','changePassword','removeTeams','delete','destroy','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','addContacts','post','create','/create_many','bulkCreate','/:id/queues','addQueues','diskStorage','join','root'];(function(_0x45cfbe,_0xfe4a50){var _0x341c8b=function(_0x4371a2){while(--_0x4371a2){_0x45cfbe['push'](_0x45cfbe['shift']());}};_0x341c8b(++_0xfe4a50);}(_0x8f80,0xa6));var _0x08f8=function(_0x3334f1,_0x723090){_0x3334f1=_0x3334f1-0x0;var _0x2c1ad3=_0x8f80[_0x3334f1];return _0x2c1ad3;};'use strict';var multer=require(_0x08f8('0x0'));var util=require(_0x08f8('0x1'));var path=require(_0x08f8('0x2'));var timeout=require(_0x08f8('0x3'));var express=require('express');var router=express[_0x08f8('0x4')]();var fs_extra=require(_0x08f8('0x5'));var auth=require(_0x08f8('0x6'));var interaction=require(_0x08f8('0x7'));var config=require('../../config/environment');var controller=require(_0x08f8('0x8'));router[_0x08f8('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x08f8('0x9')](_0x08f8('0xa'),auth[_0x08f8('0xb')](),controller[_0x08f8('0xc')]);router['get'](_0x08f8('0xd'),auth[_0x08f8('0xb')](),controller[_0x08f8('0xe')]);router[_0x08f8('0x9')](_0x08f8('0xf'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x10')]);router[_0x08f8('0x9')](_0x08f8('0x11'),auth[_0x08f8('0xb')](),controller['show']);router[_0x08f8('0x9')]('/:id/avatar',controller['getAvatar']);router[_0x08f8('0x9')](_0x08f8('0x12'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x13')]);router[_0x08f8('0x9')]('/:id/contacts',auth[_0x08f8('0xb')](),controller[_0x08f8('0x14')]);router[_0x08f8('0x9')]('/:id/queues',auth['isAuthenticated'](),controller['getQueues']);router[_0x08f8('0x9')](_0x08f8('0x15'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x16')]);router[_0x08f8('0x9')](_0x08f8('0x17'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x18')]);router[_0x08f8('0x9')]('/:id/recordings',auth[_0x08f8('0xb')](),controller[_0x08f8('0x19')]);router[_0x08f8('0x9')]('/:id/screen_recordings',auth[_0x08f8('0xb')](),controller[_0x08f8('0x1a')]);router[_0x08f8('0x9')](_0x08f8('0x1b'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x1c')]);router[_0x08f8('0x9')](_0x08f8('0x1d'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x1e')]);router[_0x08f8('0x9')]('/:id/mail/interactions',auth[_0x08f8('0xb')](),controller[_0x08f8('0x1f')]);router[_0x08f8('0x9')](_0x08f8('0x20'),auth['isAuthenticated'](),controller[_0x08f8('0x21')]);router['get'](_0x08f8('0x22'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x23')]);router[_0x08f8('0x9')]('/:id/whatsapp/interactions',auth[_0x08f8('0xb')](),controller[_0x08f8('0x24')]);router[_0x08f8('0x9')](_0x08f8('0x25'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x26')]);router[_0x08f8('0x9')]('/:id/lists',auth[_0x08f8('0xb')](),controller[_0x08f8('0x27')]);router[_0x08f8('0x9')](_0x08f8('0x28'),auth[_0x08f8('0xb')](),controller['getAgents']);router['get'](_0x08f8('0x29'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x2a')]);router[_0x08f8('0x9')](_0x08f8('0x2b'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x2c')]);router[_0x08f8('0x9')]('/:id/mail_accounts',auth[_0x08f8('0xb')](),controller['getMailAccounts']);router['get'](_0x08f8('0x2d'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router['get'](_0x08f8('0x2e'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x2f')]);router[_0x08f8('0x9')](_0x08f8('0x30'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x31')]);router[_0x08f8('0x9')](_0x08f8('0x32'),auth['isAuthenticated'](),controller[_0x08f8('0x33')]);router[_0x08f8('0x9')](_0x08f8('0x34'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x35')]);router['get']('/:id/api_key',auth[_0x08f8('0xb')](),controller['getApiKey']);router['post']('/:id/contacts',auth[_0x08f8('0xb')](),controller[_0x08f8('0x36')]);router[_0x08f8('0x37')]('/',auth[_0x08f8('0xb')](),controller[_0x08f8('0x38')]);router['post'](_0x08f8('0x39'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x3a')]);router[_0x08f8('0x37')](_0x08f8('0x3b'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x3c')]);var upload=multer({'storage':multer[_0x08f8('0x3d')]({'destination':function(_0x1e910e,_0x2bf5d6,_0x2b3587){_0x2b3587(null,path[_0x08f8('0x3e')](config[_0x08f8('0x3f')],_0x08f8('0x40')));},'filename':function(_0x16b07c,_0x4c130d,_0x4b0656){_0x4b0656(null,util['format'](_0x08f8('0x41'),Date[_0x08f8('0x42')](),_0x4c130d[_0x08f8('0x43')]));}})});router[_0x08f8('0x37')]('/:id/avatar',upload[_0x08f8('0x44')](_0x08f8('0x45')),controller[_0x08f8('0x46')]);router[_0x08f8('0x37')](_0x08f8('0x47'),auth['isAuthenticated'](),controller[_0x08f8('0x48')]);router['post'](_0x08f8('0x49'),auth['isAuthenticated'](),controller[_0x08f8('0x4a')]);router['post'](_0x08f8('0x4b'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x4c')]);router[_0x08f8('0x37')](_0x08f8('0x4d'),auth[_0x08f8('0xb')](),controller['unpause']);router['post']('/:id/teams',auth[_0x08f8('0xb')](),controller[_0x08f8('0x4e')]);router[_0x08f8('0x37')](_0x08f8('0x4f'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x50')]);router[_0x08f8('0x37')]('/:id/mail_interactions',auth[_0x08f8('0xb')](),controller['addMailInteractions']);router[_0x08f8('0x37')](_0x08f8('0x51'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x52')]);router[_0x08f8('0x37')]('/:id/sms_interactions',auth[_0x08f8('0xb')](),controller[_0x08f8('0x53')]);router['post'](_0x08f8('0x54'),auth['isAuthenticated'](),controller[_0x08f8('0x55')]);router[_0x08f8('0x37')](_0x08f8('0x56'),auth[_0x08f8('0xb')](),controller['addWhatsappInteractions']);router['post']('/:id/fax_accounts',auth['isAuthenticated'](),controller[_0x08f8('0x57')]);router[_0x08f8('0x37')]('/:id/mail_accounts',auth[_0x08f8('0xb')](),controller['addMailAccounts']);router[_0x08f8('0x37')](_0x08f8('0x2d'),auth['isAuthenticated'](),controller[_0x08f8('0x58')]);router['post']('/:id/sms_accounts',auth['isAuthenticated'](),controller[_0x08f8('0x59')]);router[_0x08f8('0x37')](_0x08f8('0x30'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x5a')]);router['post'](_0x08f8('0x32'),auth['isAuthenticated'](),controller[_0x08f8('0x5b')]);router[_0x08f8('0x37')]('/:id/api_key',auth[_0x08f8('0xb')](),controller['createApiKey']);router[_0x08f8('0x5c')]('/:id',auth[_0x08f8('0xb')](),controller[_0x08f8('0x5d')]);router[_0x08f8('0x5c')](_0x08f8('0x5e'),auth['isAuthenticated'](),controller[_0x08f8('0x5f')]);router['delete'](_0x08f8('0x3b'),auth[_0x08f8('0xb')](),controller['removeQueues']);router['delete'](_0x08f8('0x25'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x60')]);router[_0x08f8('0x61')](_0x08f8('0x11'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x62')]);router[_0x08f8('0x61')](_0x08f8('0x4f'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x63')]);router['delete'](_0x08f8('0x64'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x65')]);router[_0x08f8('0x61')]('/:id/fax_interactions',auth[_0x08f8('0xb')](),controller['removeFaxInteractions']);router[_0x08f8('0x61')]('/:id/sms_interactions',auth[_0x08f8('0xb')](),controller[_0x08f8('0x66')]);router['delete'](_0x08f8('0x54'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x67')]);router[_0x08f8('0x61')]('/:id/whatsapp_interactions',auth[_0x08f8('0xb')](),controller[_0x08f8('0x68')]);router[_0x08f8('0x61')](_0x08f8('0x2b'),auth['isAuthenticated'](),controller[_0x08f8('0x69')]);router[_0x08f8('0x61')]('/:id/mail_accounts',auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x08f8('0x61')](_0x08f8('0x2d'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x6a')]);router[_0x08f8('0x61')](_0x08f8('0x2e'),auth['isAuthenticated'](),controller[_0x08f8('0x6b')]);router['delete'](_0x08f8('0x30'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x6c')]);router[_0x08f8('0x61')](_0x08f8('0x32'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x6d')]);router[_0x08f8('0x61')](_0x08f8('0x6e'),auth['isAuthenticated'](),controller[_0x08f8('0x6f')]);router[_0x08f8('0x37')](_0x08f8('0x70'),auth[_0x08f8('0xb')](),controller[_0x08f8('0x71')]);module[_0x08f8('0x72')]=router;
\ No newline at end of file
+var _0x7c27=['createApiKey','put','update','changePassword','delete','removeQueues','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','/:id/openchannel_interactions','removeWhatsappInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./user.controller','get','isAuthenticated','describe','whoami','/:id','show','/:id/avatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getApiKey','post','addContacts','create','/create_many','diskStorage','root','server/files/images/','%s-%s','originalname','single','file','addAvatar','login','/:id/logout','logout','/:id/pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/whatsapp_interactions','addFaxAccounts','/:id/mail_accounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','/:id/api_key'];(function(_0x356a00,_0x5e00c9){var _0x18946f=function(_0x178ef9){while(--_0x178ef9){_0x356a00['push'](_0x356a00['shift']());}};_0x18946f(++_0x5e00c9);}(_0x7c27,0x14a));var _0x77c2=function(_0x2f1962,_0x5e4663){_0x2f1962=_0x2f1962-0x0;var _0x50ef57=_0x7c27[_0x2f1962];return _0x50ef57;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x77c2('0x0'));var timeout=require(_0x77c2('0x1'));var express=require(_0x77c2('0x2'));var router=express[_0x77c2('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x77c2('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x77c2('0x5'));var controller=require(_0x77c2('0x6'));router[_0x77c2('0x7')]('/',auth[_0x77c2('0x8')](),controller['index']);router[_0x77c2('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x77c2('0x9')]);router[_0x77c2('0x7')]('/whoami',auth['isAuthenticated'](),controller[_0x77c2('0xa')]);router[_0x77c2('0x7')]('/presence',auth[_0x77c2('0x8')](),controller['getPresence']);router['get'](_0x77c2('0xb'),auth['isAuthenticated'](),controller[_0x77c2('0xc')]);router['get'](_0x77c2('0xd'),controller['getAvatar']);router[_0x77c2('0x7')](_0x77c2('0xe'),auth['isAuthenticated'](),controller[_0x77c2('0xf')]);router[_0x77c2('0x7')](_0x77c2('0x10'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x11')]);router['get'](_0x77c2('0x12'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x13')]);router['get'](_0x77c2('0x14'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x15')]);router[_0x77c2('0x7')](_0x77c2('0x16'),auth['isAuthenticated'](),controller[_0x77c2('0x17')]);router[_0x77c2('0x7')](_0x77c2('0x18'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x19')]);router['get'](_0x77c2('0x1a'),auth[_0x77c2('0x8')](),controller['getScreenRecordings']);router[_0x77c2('0x7')](_0x77c2('0x1b'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x1c')]);router[_0x77c2('0x7')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x77c2('0x1d')]);router[_0x77c2('0x7')](_0x77c2('0x1e'),auth[_0x77c2('0x8')](),controller['getMailInteractions']);router['get'](_0x77c2('0x1f'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x20')]);router[_0x77c2('0x7')]('/:id/fax/interactions',auth[_0x77c2('0x8')](),controller['getFaxInteractions']);router[_0x77c2('0x7')](_0x77c2('0x21'),auth['isAuthenticated'](),controller[_0x77c2('0x22')]);router['get'](_0x77c2('0x23'),auth[_0x77c2('0x8')](),controller['getTeams']);router['get'](_0x77c2('0x24'),auth['isAuthenticated'](),controller[_0x77c2('0x25')]);router[_0x77c2('0x7')](_0x77c2('0x26'),auth[_0x77c2('0x8')](),controller['getAgents']);router[_0x77c2('0x7')](_0x77c2('0x27'),auth['isAuthenticated'](),controller[_0x77c2('0x28')]);router[_0x77c2('0x7')](_0x77c2('0x29'),auth['isAuthenticated'](),controller[_0x77c2('0x2a')]);router[_0x77c2('0x7')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x77c2('0x2b')]);router[_0x77c2('0x7')](_0x77c2('0x2c'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x2d')]);router['get'](_0x77c2('0x2e'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x2f')]);router['get'](_0x77c2('0x30'),auth[_0x77c2('0x8')](),controller['getChatWebsites']);router['get'](_0x77c2('0x31'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x32')]);router[_0x77c2('0x7')](_0x77c2('0x33'),auth['isAuthenticated'](),controller['getScheduledCalls']);router[_0x77c2('0x7')]('/:id/api_key',auth['isAuthenticated'](),controller[_0x77c2('0x34')]);router[_0x77c2('0x35')](_0x77c2('0x10'),auth['isAuthenticated'](),controller[_0x77c2('0x36')]);router[_0x77c2('0x35')]('/',auth[_0x77c2('0x8')](),controller[_0x77c2('0x37')]);router[_0x77c2('0x35')](_0x77c2('0x38'),auth[_0x77c2('0x8')](),controller['bulkCreate']);router['post'](_0x77c2('0x12'),auth[_0x77c2('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x77c2('0x39')]({'destination':function(_0x448e5f,_0x35788f,_0x29e502){_0x29e502(null,path['join'](config[_0x77c2('0x3a')],_0x77c2('0x3b')));},'filename':function(_0x3f0f42,_0x1afe54,_0x1d7e48){_0x1d7e48(null,util['format'](_0x77c2('0x3c'),Date['now'](),_0x1afe54[_0x77c2('0x3d')]));}})});router['post'](_0x77c2('0xd'),upload[_0x77c2('0x3e')](_0x77c2('0x3f')),controller[_0x77c2('0x40')]);router[_0x77c2('0x35')]('/:id/login',auth[_0x77c2('0x8')](),controller[_0x77c2('0x41')]);router['post'](_0x77c2('0x42'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x43')]);router[_0x77c2('0x35')](_0x77c2('0x44'),auth[_0x77c2('0x8')](),controller['pause']);router['post']('/:id/unpause',auth['isAuthenticated'](),controller[_0x77c2('0x45')]);router[_0x77c2('0x35')]('/:id/teams',auth[_0x77c2('0x8')](),controller[_0x77c2('0x46')]);router['post'](_0x77c2('0x47'),auth['isAuthenticated'](),controller[_0x77c2('0x48')]);router['post'](_0x77c2('0x49'),auth[_0x77c2('0x8')](),controller['addMailInteractions']);router[_0x77c2('0x35')](_0x77c2('0x4a'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x4b')]);router[_0x77c2('0x35')](_0x77c2('0x4c'),auth['isAuthenticated'](),controller['addSmsInteractions']);router['post']('/:id/openchannel_interactions',auth[_0x77c2('0x8')](),controller['addOpenchannelInteractions']);router['post'](_0x77c2('0x4d'),auth[_0x77c2('0x8')](),controller['addWhatsappInteractions']);router[_0x77c2('0x35')](_0x77c2('0x29'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x4e')]);router[_0x77c2('0x35')](_0x77c2('0x4f'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x50')]);router[_0x77c2('0x35')]('/:id/openchannel_accounts',auth[_0x77c2('0x8')](),controller[_0x77c2('0x51')]);router[_0x77c2('0x35')](_0x77c2('0x2e'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x52')]);router[_0x77c2('0x35')](_0x77c2('0x30'),auth['isAuthenticated'](),controller[_0x77c2('0x53')]);router['post'](_0x77c2('0x31'),auth['isAuthenticated'](),controller[_0x77c2('0x54')]);router[_0x77c2('0x35')](_0x77c2('0x55'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x56')]);router[_0x77c2('0x57')](_0x77c2('0xb'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x58')]);router[_0x77c2('0x57')]('/:id/password',auth['isAuthenticated'](),controller[_0x77c2('0x59')]);router[_0x77c2('0x5a')](_0x77c2('0x12'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x5b')]);router[_0x77c2('0x5a')](_0x77c2('0x23'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x77c2('0x5a')](_0x77c2('0xb'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x5c')]);router['delete'](_0x77c2('0x47'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x5d')]);router['delete'](_0x77c2('0x49'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x5e')]);router[_0x77c2('0x5a')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x77c2('0x5f')]);router[_0x77c2('0x5a')](_0x77c2('0x4c'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x60')]);router[_0x77c2('0x5a')](_0x77c2('0x61'),auth[_0x77c2('0x8')](),controller['removeOpenchannelInteractions']);router[_0x77c2('0x5a')](_0x77c2('0x4d'),auth['isAuthenticated'](),controller[_0x77c2('0x62')]);router[_0x77c2('0x5a')](_0x77c2('0x29'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x63')]);router[_0x77c2('0x5a')](_0x77c2('0x4f'),auth[_0x77c2('0x8')](),controller['removeMailAccounts']);router[_0x77c2('0x5a')]('/:id/openchannel_accounts',auth[_0x77c2('0x8')](),controller[_0x77c2('0x64')]);router['delete'](_0x77c2('0x2e'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x65')]);router[_0x77c2('0x5a')](_0x77c2('0x30'),auth['isAuthenticated'](),controller['removeChatWebsites']);router[_0x77c2('0x5a')](_0x77c2('0x31'),auth[_0x77c2('0x8')](),controller['removeWhatsappAccounts']);router['delete'](_0x77c2('0x55'),auth[_0x77c2('0x8')](),controller[_0x77c2('0x66')]);router['post'](_0x77c2('0x67'),auth[_0x77c2('0x8')](),controller['messengerSoundNotification']);module['exports']=router;
\ No newline at end of file
index a718465..c82c442 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb2d6=['PROHIB','udp','transport','join','split','rfc2833','shortinfo','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','accept','refuse','uac','uas','certificate','active','actpass','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','TEXT','permissions','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>','email','ENUM','admin','telephone','local','INTEGER','internal','accountcode','callerid','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','friend','user','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN'];(function(_0xd96303,_0x1783c5){var _0xc28142=function(_0x1f1163){while(--_0x1f1163){_0xd96303['push'](_0xd96303['shift']());}};_0xc28142(++_0x1783c5);}(_0xb2d6,0x197));var _0x6b2d=function(_0x407e38,_0x30e1cb){_0x407e38=_0x407e38-0x0;var _0x996a91=_0xb2d6[_0x407e38];return _0x996a91;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require('util');var _=require('lodash');module[_0x6b2d('0x0')]={'name':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':![],'unique':_0x6b2d('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x4c4daf){this[_0x6b2d('0x3')]('name',_0x4c4daf);this[_0x6b2d('0x3')](_0x6b2d('0x4'),_0x4c4daf);},'comment':_0x6b2d('0x5')},'fullname':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':![],'set':function(_0x3c2bbc){this['setDataValue'](_0x6b2d('0x6'),_0x3c2bbc);this[_0x6b2d('0x3')]('callerid',util[_0x6b2d('0x7')](_0x6b2d('0x8'),_0x3c2bbc,this['getDataValue']('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':![],'unique':_0x6b2d('0x9'),'validate':{'isEmail':!![]},'set':function(_0x34f01a){if(_0x34f01a){this['setDataValue'](_0x6b2d('0x9'),_0x34f01a['toLowerCase']());}}},'role':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0xb'),'user','agent',_0x6b2d('0xc')),'allowNull':![]},'password':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':_0x6b2d('0xd')},'internal':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':![],'unique':'internal','set':function(_0x1cf7e3){this['setDataValue'](_0x6b2d('0xf'),_0x1cf7e3);this[_0x6b2d('0x3')](_0x6b2d('0x10'),_0x1cf7e3);this[_0x6b2d('0x3')](_0x6b2d('0x11'),util[_0x6b2d('0x7')](_0x6b2d('0x8'),this[_0x6b2d('0x12')](_0x6b2d('0x6')),_0x1cf7e3));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x6b2d('0x1')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x6b2d('0x1')]},'userpic':{'type':Sequelize[_0x6b2d('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x6b2d('0x1')]},'online':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x6b2d('0x1')],'defaultValue':_0x6b2d('0x14')},'lastPauseAt':{'type':Sequelize[_0x6b2d('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'host':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'port':{'type':Sequelize[_0x6b2d('0xe')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0x6b2d('0x16'),_0x6b2d('0x17'),_0x6b2d('0x18')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![],'defaultValue':_0x6b2d('0x19')},'callingpres':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x1a'),_0x6b2d('0x1b'),_0x6b2d('0x1c'),_0x6b2d('0x1d'),_0x6b2d('0x1e'),_0x6b2d('0x1f'),_0x6b2d('0x20'),_0x6b2d('0x21')),'allowNull':!![]},'deny':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'permit':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'secret':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'transport':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![],'defaultValue':_0x6b2d('0x22'),'set':function(_0x799cfc){this[_0x6b2d('0x3')](_0x6b2d('0x23'),_0x799cfc?_0x799cfc[_0x6b2d('0x24')](','):null);},'get':function(){return this[_0x6b2d('0x12')](_0x6b2d('0x23'))?this[_0x6b2d('0x12')](_0x6b2d('0x23'))[_0x6b2d('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x26'),'info',_0x6b2d('0x27'),'inband',_0x6b2d('0x28')),'allowNull':!![],'defaultValue':_0x6b2d('0x26')},'directmedia':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no',_0x6b2d('0x2a'),_0x6b2d('0x2b'),_0x6b2d('0x2c')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize['STRING'],'allowNull':!![]},'nat':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![],'defaultValue':_0x6b2d('0x2d'),'set':function(_0x370de5){this[_0x6b2d('0x3')](_0x6b2d('0x2e'),_0x370de5?_0x370de5[_0x6b2d('0x24')](','):null);},'get':function(){return this['getDataValue'](_0x6b2d('0x2e'))?this[_0x6b2d('0x12')](_0x6b2d('0x2e'))['split'](','):null;},'comment':_0x6b2d('0x2f')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x6b2d('0x1')]},'pickupgroup':{'type':Sequelize[_0x6b2d('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x6b2d('0x1')]},'language':{'type':Sequelize[_0x6b2d('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x6b2d('0x1')]},'disallow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x6b2d('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0xd5cf51){this[_0x6b2d('0x3')]('allow',_0xd5cf51?_0xd5cf51[_0x6b2d('0x24')](';'):_0x6b2d('0x31'));},'get':function(){return this[_0x6b2d('0x12')](_0x6b2d('0x32'))?this['getDataValue']('allow')[_0x6b2d('0x25')](';'):null;},'comment':_0x6b2d('0x33')},'autoframing':{'type':Sequelize[_0x6b2d('0xa')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![],'set':function(_0x2c7ee7){this[_0x6b2d('0x3')](_0x6b2d('0x34'),_0x2c7ee7?_0x2c7ee7['join'](','):null);},'get':function(){return this[_0x6b2d('0x12')](_0x6b2d('0x34'))?this[_0x6b2d('0x12')](_0x6b2d('0x34'))['split'](','):null;},'comment':_0x6b2d('0x35')},'trustrpid':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x6b2d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x6b2d('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x6b2d('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![],'defaultValue':_0x6b2d('0x37')},'amaflags':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x6b2d('0xa')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'template':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no','always'),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x6b2d('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x38'),_0x6b2d('0x39'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x6b2d('0x3a'),_0x6b2d('0x3b')),'allowNull':!![],'defaultValue':_0x6b2d('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x6b2d('0x29'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x6b2d('0xa')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x6b2d('0x29'),'no','fingerprint',_0x6b2d('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x3d'),'passive',_0x6b2d('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x6b2d('0xe')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x6b2d('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x6b2d('0xa')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x6b2d('0x29'),'no','nonat',_0x6b2d('0x2b'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x6b2d('0x1')]},'resetPasswordExpires':{'type':Sequelize[_0x6b2d('0x15')]},'passwordResetAt':{'type':Sequelize[_0x6b2d('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0,'set':function(_0x57e018){this[_0x6b2d('0x3')](_0x6b2d('0x3f'),_0x57e018);var _0x51696a=this[_0x6b2d('0x40')]({'plain':!![]});switch(_0x57e018){case 0x0:case 0x1:var _0x2877cf=_0x51696a[_0x6b2d('0x23')]?_[_0x6b2d('0x41')](_0x51696a['transport'])?_0x51696a[_0x6b2d('0x23')]['join']():_0x51696a['transport']:_0x6b2d('0x22');if(_0x2877cf==='wss'){_0x2877cf=_0x6b2d('0x22');}this[_0x6b2d('0x3')](_0x6b2d('0x23'),_0x2877cf);this[_0x6b2d('0x3')](_0x6b2d('0x42'),'no');this[_0x6b2d('0x3')](_0x6b2d('0x43'),null);this[_0x6b2d('0x3')](_0x6b2d('0x44'),null);this[_0x6b2d('0x3')](_0x6b2d('0x45'),null);this['setDataValue'](_0x6b2d('0x46'),null);this[_0x6b2d('0x3')](_0x6b2d('0x47'),null);this[_0x6b2d('0x3')](_0x6b2d('0x48'),null);this['setDataValue'](_0x6b2d('0x49'),null);this['setDataValue'](_0x6b2d('0x4a'),null);this[_0x6b2d('0x3')](_0x6b2d('0x4b'),'no');break;case 0x2:this['setDataValue']('transport','wss');this[_0x6b2d('0x3')](_0x6b2d('0x42'),_0x6b2d('0x29'));this['setDataValue'](_0x6b2d('0x43'),_0x6b2d('0x29'));this[_0x6b2d('0x3')](_0x6b2d('0x44'),'yes');this[_0x6b2d('0x3')]('icesupport',_0x6b2d('0x29'));this[_0x6b2d('0x3')](_0x6b2d('0x46'),_0x6b2d('0x29'));this[_0x6b2d('0x3')](_0x6b2d('0x47'),'no');this['setDataValue'](_0x6b2d('0x48'),_0x6b2d('0x3e'));this['setDataValue'](_0x6b2d('0x49'),_0x51696a['dtlscertfile']||_0x6b2d('0x4c'));this[_0x6b2d('0x3')](_0x6b2d('0x4a'),_0x51696a['dtlsprivatekey']||_0x6b2d('0x4d'));this['setDataValue'](_0x6b2d('0x4b'),_0x6b2d('0x29'));break;default:}}},'permissions':{'type':Sequelize[_0x6b2d('0x4e')],'set':function(_0x2a0290){this[_0x6b2d('0x3')]('permissions',_0x2a0290?_0x2a0290[_0x6b2d('0x24')](','):[]);},'get':function(){return this[_0x6b2d('0x12')](_0x6b2d('0x4f'))?_['map'](this[_0x6b2d('0x12')](_0x6b2d('0x4f'))['split'](','),function(_0x4af888){return parseInt(_0x4af888,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x6b2d('0x1')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x6b2d('0x1')]},'phoneBarBusyNumber':{'type':Sequelize[_0x6b2d('0x1')]},'phoneBarUnconditional':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x6b2d('0x1')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x6b2d('0xa')](_0x6b2d('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x6b2d('0x1')]},'phoneBarEnableJaws':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0x6b2d('0x50'))?this[_0x6b2d('0x12')](_0x6b2d('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'interface':{'type':Sequelize[_0x6b2d('0x1')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x6b2d('0x1')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![],'set':function(_0x129e62){if(typeof _0x129e62===_0x6b2d('0x51')){var _0x5b85b8=_0x129e62==='1'?!![]:_0x129e62==='0'?![]:_0x129e62===_0x6b2d('0x52')?!![]:_0x129e62==='false'?![]:![];this[_0x6b2d('0x3')](_0x6b2d('0x53'),_0x5b85b8);}else{this[_0x6b2d('0x3')](_0x6b2d('0x53'),_0x129e62);}}},'blocked':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![],'set':function(_0x370598){this[_0x6b2d('0x3')](_0x6b2d('0x54'),_0x370598);if(_0x370598===!![]){this[_0x6b2d('0x3')](_0x6b2d('0x55'),moment());this[_0x6b2d('0x3')](_0x6b2d('0x56'),0x0);}else{this[_0x6b2d('0x3')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0x6b2d('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x6b2d('0xe')](0x5)[_0x6b2d('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x6b2d('0xe')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x6b2d('0x13')],'defaultValue':![]}};
\ No newline at end of file
+var _0x6dcc=['STRING','callerid','format','getDataValue','internal','ENUM','user','agent','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','dynamic','peer','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','get','isArray','wss','udp','encryption','avpf','force_avp','icesupport','dtlsenable','rtcp_mux','dtlsverify','dtlscertfile','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','lodash','exports','name','setDataValue','defaultuser'];(function(_0x46252a,_0x561222){var _0x1acfc9=function(_0x55a473){while(--_0x55a473){_0x46252a['push'](_0x46252a['shift']());}};_0x1acfc9(++_0x561222);}(_0x6dcc,0xeb));var _0xc6dc=function(_0x2984fb,_0x5c4a5c){_0x2984fb=_0x2984fb-0x0;var _0x44f03c=_0x6dcc[_0x2984fb];return _0x44f03c;};'use strict';var Sequelize=require(_0xc6dc('0x0'));var moment=require(_0xc6dc('0x1'));var util=require(_0xc6dc('0x2'));var _=require(_0xc6dc('0x3'));module[_0xc6dc('0x4')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc6dc('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0xcf1a91){this[_0xc6dc('0x6')](_0xc6dc('0x5'),_0xcf1a91);this['setDataValue'](_0xc6dc('0x7'),_0xcf1a91);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'set':function(_0x5dd920){this[_0xc6dc('0x6')]('fullname',_0x5dd920);this[_0xc6dc('0x6')](_0xc6dc('0x9'),util[_0xc6dc('0xa')]('\x22%s\x22\x20<%s>',_0x5dd920,this[_0xc6dc('0xb')](_0xc6dc('0xc'))));}},'alias':{'type':Sequelize[_0xc6dc('0x8')]},'email':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xd2ce11){if(_0xd2ce11){this[_0xc6dc('0x6')]('email',_0xd2ce11['toLowerCase']());}}},'role':{'type':Sequelize[_0xc6dc('0xd')]('admin',_0xc6dc('0xe'),_0xc6dc('0xf'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc6dc('0x8')],'defaultValue':_0xc6dc('0x10')},'internal':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':![],'unique':_0xc6dc('0xc'),'set':function(_0x821982){this['setDataValue'](_0xc6dc('0xc'),_0x821982);this[_0xc6dc('0x6')](_0xc6dc('0x12'),_0x821982);this[_0xc6dc('0x6')]('callerid',util[_0xc6dc('0xa')]('\x22%s\x22\x20<%s>',this[_0xc6dc('0xb')](_0xc6dc('0x13')),_0x821982));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0xc6dc('0x8')]},'zipcode':{'type':Sequelize[_0xc6dc('0x8')]},'userpic':{'type':Sequelize[_0xc6dc('0x8')]},'city':{'type':Sequelize[_0xc6dc('0x8')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xc6dc('0x15')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc6dc('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc6dc('0x11')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc6dc('0x16')},'ipaddr':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'port':{'type':Sequelize[_0xc6dc('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend',_0xc6dc('0xe'),_0xc6dc('0x17')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xc6dc('0xd')]('ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN',_0xc6dc('0x18'),'ALLOWED',_0xc6dc('0x19'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0xc6dc('0x1a')),'allowNull':!![]},'deny':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'permit':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'defaultValue':'udp','set':function(_0x1bfbfb){this[_0xc6dc('0x6')](_0xc6dc('0x1b'),_0x1bfbfb?_0x1bfbfb[_0xc6dc('0x1c')](','):null);},'get':function(){return this[_0xc6dc('0xb')](_0xc6dc('0x1b'))?this[_0xc6dc('0xb')]('transport')[_0xc6dc('0x1d')](','):null;},'comment':_0xc6dc('0x1e')},'dtmfmode':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x1f'),'info',_0xc6dc('0x20'),'inband',_0xc6dc('0x21')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no','nonat',_0xc6dc('0x23'),_0xc6dc('0x24')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'defaultValue':_0xc6dc('0x25'),'set':function(_0x518d1f){this['setDataValue'](_0xc6dc('0x26'),_0x518d1f?_0x518d1f[_0xc6dc('0x1c')](','):null);},'get':function(){return this[_0xc6dc('0xb')]('nat')?this[_0xc6dc('0xb')]('nat')[_0xc6dc('0x1d')](','):null;},'comment':_0xc6dc('0x27')},'callgroup':{'type':Sequelize[_0xc6dc('0x8')]},'namedcallgroup':{'type':Sequelize[_0xc6dc('0x8')]},'pickupgroup':{'type':Sequelize[_0xc6dc('0x8')]},'namedpickupgroup':{'type':Sequelize[_0xc6dc('0x8')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc6dc('0x8')]},'disallow':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'defaultValue':_0xc6dc('0x28')},'allow':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':![],'defaultValue':_0xc6dc('0x29'),'set':function(_0x257078){this[_0xc6dc('0x6')](_0xc6dc('0x2a'),_0x257078?_0x257078[_0xc6dc('0x1c')](';'):_0xc6dc('0x29'));},'get':function(){return this[_0xc6dc('0xb')]('allow')?this['getDataValue']('allow')[_0xc6dc('0x1d')](';'):null;},'comment':_0xc6dc('0x2b')},'autoframing':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'set':function(_0x4cfeb6){this['setDataValue'](_0xc6dc('0x2c'),_0x4cfeb6?_0x4cfeb6['join'](','):null);},'get':function(){return this['getDataValue'](_0xc6dc('0x2c'))?this[_0xc6dc('0xb')](_0xc6dc('0x2c'))[_0xc6dc('0x1d')](','):null;},'comment':_0xc6dc('0x2d')},'trustrpid':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc6dc('0xd')]('yes','no',_0xc6dc('0x2e')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![],'defaultValue':_0xc6dc('0x2f')},'amaflags':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':_0xc6dc('0x22')},'busylevel':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc6dc('0xd')]('yes','no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no',_0xc6dc('0x30')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x31'),_0xc6dc('0x32'),_0xc6dc('0x33')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc6dc('0xd')]('uac',_0xc6dc('0x34')),'allowNull':!![],'defaultValue':_0xc6dc('0x34')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc6dc('0xd')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc6dc('0xd')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xc6dc('0xd')]('yes','no',_0xc6dc('0x35'),_0xc6dc('0x36')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc6dc('0xd')]('active',_0xc6dc('0x37'),_0xc6dc('0x38')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc6dc('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc6dc('0xd')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc6dc('0xd')]('yes','no','nonat',_0xc6dc('0x23'),_0xc6dc('0x39')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc6dc('0x8')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xc6dc('0x15')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc6dc('0x3a')]},'showWebBar':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0,'set':function(_0x21d22c){this[_0xc6dc('0x6')]('showWebBar',_0x21d22c);var _0x38bf05=this[_0xc6dc('0x3b')]({'plain':!![]});switch(_0x21d22c){case 0x0:case 0x1:var _0x1d6da7=_0x38bf05['transport']?_[_0xc6dc('0x3c')](_0x38bf05[_0xc6dc('0x1b')])?_0x38bf05['transport'][_0xc6dc('0x1c')]():_0x38bf05['transport']:'udp';if(_0x1d6da7===_0xc6dc('0x3d')){_0x1d6da7=_0xc6dc('0x3e');}this['setDataValue'](_0xc6dc('0x1b'),_0x1d6da7);this['setDataValue'](_0xc6dc('0x3f'),'no');this[_0xc6dc('0x6')](_0xc6dc('0x40'),null);this[_0xc6dc('0x6')](_0xc6dc('0x41'),null);this[_0xc6dc('0x6')](_0xc6dc('0x42'),null);this['setDataValue'](_0xc6dc('0x43'),null);this[_0xc6dc('0x6')]('dtlsverify',null);this[_0xc6dc('0x6')]('dtlssetup',null);this[_0xc6dc('0x6')]('dtlscertfile',null);this[_0xc6dc('0x6')]('dtlsprivatekey',null);this[_0xc6dc('0x6')](_0xc6dc('0x44'),'no');break;case 0x2:this[_0xc6dc('0x6')](_0xc6dc('0x1b'),_0xc6dc('0x3d'));this[_0xc6dc('0x6')]('encryption',_0xc6dc('0x22'));this[_0xc6dc('0x6')](_0xc6dc('0x40'),'yes');this[_0xc6dc('0x6')]('force_avp',_0xc6dc('0x22'));this[_0xc6dc('0x6')](_0xc6dc('0x42'),_0xc6dc('0x22'));this[_0xc6dc('0x6')]('dtlsenable','yes');this['setDataValue'](_0xc6dc('0x45'),'no');this[_0xc6dc('0x6')]('dtlssetup',_0xc6dc('0x38'));this[_0xc6dc('0x6')](_0xc6dc('0x46'),_0x38bf05[_0xc6dc('0x46')]||'/etc/pki/tls/certs/motion.crt');this[_0xc6dc('0x6')](_0xc6dc('0x47'),_0x38bf05[_0xc6dc('0x47')]||'/etc/pki/tls/private/motion.key');this[_0xc6dc('0x6')](_0xc6dc('0x44'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xc6dc('0x3a')],'set':function(_0x433f53){this['setDataValue'](_0xc6dc('0x48'),_0x433f53?_0x433f53[_0xc6dc('0x1c')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_[_0xc6dc('0x49')](this[_0xc6dc('0xb')](_0xc6dc('0x48'))[_0xc6dc('0x1d')](','),function(_0xe7ca8d){return parseInt(_0xe7ca8d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc6dc('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xc6dc('0x8')]},'phoneBarUnconditional':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc6dc('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc6dc('0xd')](_0xc6dc('0x22'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc6dc('0x8')]},'phoneBarEnableJaws':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc6dc('0x4a')],'get':function(){return this['getDataValue'](_0xc6dc('0x4b'))?this[_0xc6dc('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc6dc('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xc6dc('0x8')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![],'set':function(_0xc8c036){if(typeof _0xc8c036===_0xc6dc('0x4c')){var _0x45586e=_0xc8c036==='1'?!![]:_0xc8c036==='0'?![]:_0xc8c036===_0xc6dc('0x4d')?!![]:_0xc8c036==='false'?![]:![];this[_0xc6dc('0x6')]('screenrecording',_0x45586e);}else{this['setDataValue']('screenrecording',_0xc8c036);}}},'blocked':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![],'set':function(_0x5a0536){this['setDataValue']('blocked',_0x5a0536);if(_0x5a0536===!![]){this[_0xc6dc('0x6')](_0xc6dc('0x4e'),moment());this[_0xc6dc('0x6')](_0xc6dc('0x4f'),0x0);}else{this[_0xc6dc('0x6')](_0xc6dc('0x4e'),null);}}},'blockedAt':{'type':Sequelize[_0xc6dc('0x15')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc6dc('0x11')](0x5)[_0xc6dc('0x50')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc6dc('0x11')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xc6dc('0x14')],'defaultValue':![]}};
\ No newline at end of file
index 147f1f4..06d4661 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb51=['User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','resolve','pause','getChannels','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Queue:save','removeTeams','removeAgent','getLists','getAgents','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','CmHopper','$and','$or','$gt','$gte','$lt','$lte','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$contained','$any','phone','CmContact','dialActive','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','createApiKey','generateApiKey','iat','nonce','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','unknown','teams','queues','flatten','toString','lower','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','voiceStatus','unavailable','busy','slice','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','moment','path','lodash','squel','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','api','../../config/utils','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','handleError','socket.io-emitter','redis','./user.socket','register','defaults','sendStatus','status','end','json','offset','undefined','limit','count','update','role','agent','emit','userNotification:recalc:','destroy','then','get','admin','Users','Agents','telephone','ignore','map','value','includes','find','name','send','User','fieldName','type','key','previousPasswords','resetPasswordExpires','md5secret','index','getOptions','where','includeAll','query','userSetting','true','include','attributes','push','rows','length','sms','dataValues','fax','mail','openchannel','all','params','UserSetting','merge','options','openTabs','whatsapp','catch','body','describe','addContacts','ids','omit','validatePasswordPattern','password','internal','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','102','103','113','110','104','105','106','107','109','100','111','114','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','create','Telephones','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Unauthorized','some','UserProfileSection','autoAssociation','compact','UserProfileResource','changePassword','oldPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','voice','VoiceQueue','findAll','format','interface','voicePause','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','isArray','Queue:remove','QueueId','addAvatar','userpic','file','getAvatar','server/files/images/logos/default_profile.png','download','existsSync','join','root','server/files/images/','chat','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','WHATSAPP','concat','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','Tags','color','tag','model','keys','Queue','rawAttributes','intersection','fields','order','pick','filters','filter','Queues','Unknown\x20role','nolimit','getVoiceQueuesRt','sort','getGroups','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','loginInPause','SIP/%s','intrf','user:%s','headers','x-forwarded-for','socket','connection','remoteAddress'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb51,0x94));var _0x1eb5=function(_0x7fa36a,_0x474c3f){_0x7fa36a=_0x7fa36a-0x0;var _0x27ba62=_0xeb51[_0x7fa36a];return _0x27ba62;};'use strict';var moment=require(_0x1eb5('0x0'));var util=require('util');var path=require(_0x1eb5('0x1'));var fs=require('fs');var _=require(_0x1eb5('0x2'));var squel=require(_0x1eb5('0x3'));var Redis=require('ioredis');var authService=require(_0x1eb5('0x4'));var contacts=require('../../components/contacts');var qs=require(_0x1eb5('0x5'));var rta=require(_0x1eb5('0x6'));var logger=require('../../config/logger')(_0x1eb5('0x7'));var utils=require(_0x1eb5('0x8'));var config=require(_0x1eb5('0x9'));var licenseUtil=require(_0x1eb5('0xa'));var APIBadRequestError=require(_0x1eb5('0xb'))['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0x1eb5('0xc')];var APIHandleError=require(_0x1eb5('0xb'))[_0x1eb5('0xd')];var db=require('../../mysqldb')['db'];var socket=require(_0x1eb5('0xe'))(new Redis(config[_0x1eb5('0xf')]));require(_0x1eb5('0x10'))[_0x1eb5('0x11')](socket);config[_0x1eb5('0xf')]=_[_0x1eb5('0x12')](config[_0x1eb5('0xf')],{'host':'localhost','port':0x18eb});var values;function respondWithStatusCode(_0x422fd8,_0x242d05){_0x242d05=_0x242d05||0xcc;return function(_0x325f12){if(_0x325f12){return _0x422fd8[_0x1eb5('0x13')](_0x242d05);}return _0x422fd8[_0x1eb5('0x14')](_0x242d05)[_0x1eb5('0x15')]();};}function respondWithResult(_0x6793f4,_0x39f14a){_0x39f14a=_0x39f14a||0xc8;return function(_0x21ac79){if(_0x21ac79){return _0x6793f4[_0x1eb5('0x14')](_0x39f14a)[_0x1eb5('0x16')](_0x21ac79);}};}function respondWithFilteredResult(_0x127c43,_0x44e542){return function(_0x331c85){if(_0x331c85){var _0x4c42e8=typeof _0x44e542[_0x1eb5('0x17')]===_0x1eb5('0x18')&&typeof _0x44e542[_0x1eb5('0x19')]===_0x1eb5('0x18');var _0x543227=_0x331c85[_0x1eb5('0x1a')];var _0x827a69=_0x4c42e8?0x0:_0x44e542['offset'];var _0x1e6277=_0x4c42e8?_0x331c85[_0x1eb5('0x1a')]:_0x44e542['offset']+_0x44e542['limit'];var _0x257575;if(_0x1e6277>=_0x543227){_0x1e6277=_0x543227;_0x257575=0xc8;}else{_0x257575=0xce;}_0x127c43[_0x1eb5('0x14')](_0x257575);return _0x127c43['set']('Content-Range',_0x827a69+'-'+_0x1e6277+'/'+_0x543227)[_0x1eb5('0x16')](_0x331c85);}return null;};}function saveUpdates(_0x5691c5){return function(_0x57bee2){if(_0x57bee2){return _0x57bee2[_0x1eb5('0x1b')](_0x5691c5)['then'](function(_0x1046ec){if(_0x1046ec[_0x1eb5('0x1c')]===_0x1eb5('0x1d')){socket[_0x1eb5('0x1e')](_0x1eb5('0x1f')+_0x1046ec['id'],_0x1046ec);}return _0x1046ec;});}return null;};}function removeEntity(_0x369835){return function(_0x278206){if(_0x278206){return _0x278206[_0x1eb5('0x20')]()[_0x1eb5('0x21')](function(){var _0x31520d=_0x278206[_0x1eb5('0x22')]({'plain':!![]});if(_0x31520d[_0x1eb5('0x1c')]===_0x1eb5('0x23'))return;var _0x357642=[{'name':_0x1eb5('0x24'),'value':'user','ignore':!![]},{'name':_0x1eb5('0x25'),'value':_0x1eb5('0x1d'),'ignore':![]},{'name':'Telephones','value':_0x1eb5('0x26'),'ignore':![]}];var _0x3affdc=_(_0x357642)['filter'](_0x1eb5('0x27'))[_0x1eb5('0x28')](_0x1eb5('0x29'))[_0x1eb5('0x29')]();if(_[_0x1eb5('0x2a')](_0x3affdc,_0x31520d['role'])){return;}var _0x38341=_[_0x1eb5('0x2b')](_0x357642,[_0x1eb5('0x29'),_0x31520d[_0x1eb5('0x1c')]])[_0x1eb5('0x2c')];return db['UserProfileResource'][_0x1eb5('0x20')]({'where':{'type':_0x38341,'resourceId':_0x31520d['id']}})[_0x1eb5('0x21')](function(){return _0x278206;});})['then'](function(){_0x369835[_0x1eb5('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16e1d7){return function(_0x23bdbc){if(!_0x23bdbc){_0x16e1d7[_0x1eb5('0x13')](0x194);}return _0x23bdbc;};}function handleError(_0x4be9db,_0xee6c54){_0xee6c54=_0xee6c54||0x1f4;return function(_0x36c658){logger['error'](_0x36c658['stack']);if(_0x36c658[_0x1eb5('0x2c')]){delete _0x36c658[_0x1eb5('0x2c')];}_0x4be9db[_0x1eb5('0x14')](_0xee6c54)[_0x1eb5('0x2d')](_0x36c658);};}function getUserAttributes(){return _(db[_0x1eb5('0x2e')]['rawAttributes'])[_0x1eb5('0x28')](function(_0x317fec){return{'name':_0x317fec[_0x1eb5('0x2f')],'type':_0x317fec[_0x1eb5('0x30')][_0x1eb5('0x31')]};})['filter'](function(_0x4ae2c2){return!['password','salt',_0x1eb5('0x32'),'resetPasswordToken',_0x1eb5('0x33'),_0x1eb5('0x34')][_0x1eb5('0x2a')](_0x4ae2c2['name']);})['value']();}exports[_0x1eb5('0x35')]=function(_0x5c778f,_0x5d06ed){var _0x2f96bd={},_0x5d1687={'count':0x0,'rows':[]};var _0x5adc88=getUserAttributes();_0x2f96bd=qs[_0x1eb5('0x36')](_0x5adc88,_0x5c778f);var _0x25c91e={'where':_0x2f96bd[_0x1eb5('0x37')]};return db[_0x1eb5('0x2e')][_0x1eb5('0x1a')](_0x25c91e)[_0x1eb5('0x21')](function(_0x32ee42){_0x5d1687[_0x1eb5('0x1a')]=_0x32ee42;if(_0x5c778f['query'][_0x1eb5('0x38')]){_0x2f96bd['include']=[{'all':!![]}];}if(_0x5c778f[_0x1eb5('0x39')][_0x1eb5('0x3a')]===_0x1eb5('0x3b')){_0x2f96bd[_0x1eb5('0x3c')]=[{'model':db['UserSetting'],'as':'userSetting'}];}if(!_[_0x1eb5('0x2a')](_0x2f96bd['attributes'],'id')){_0x2f96bd[_0x1eb5('0x3d')][_0x1eb5('0x3e')]('id');}return db[_0x1eb5('0x2e')]['findAll'](_0x2f96bd);})['then'](function(_0x2a99bf){_0x5d1687[_0x1eb5('0x3f')]=_0x2a99bf;if(_0x5c778f['query']['openTabs']===_0x1eb5('0x3b')){var _0x273b87=[];for(var _0x2197aa=0x0;_0x2197aa<_0x5d1687[_0x1eb5('0x3f')][_0x1eb5('0x40')];_0x2197aa++){_0x273b87[_0x1eb5('0x3e')](get_open_tabs('chat',_0x5d1687['rows'][_0x2197aa]['dataValues']));_0x273b87[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x41'),_0x5d1687[_0x1eb5('0x3f')][_0x2197aa][_0x1eb5('0x42')]));_0x273b87[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x43'),_0x5d1687[_0x1eb5('0x3f')][_0x2197aa][_0x1eb5('0x42')]));_0x273b87[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x44'),_0x5d1687[_0x1eb5('0x3f')][_0x2197aa][_0x1eb5('0x42')]));_0x273b87['push'](get_open_tabs(_0x1eb5('0x45'),_0x5d1687[_0x1eb5('0x3f')][_0x2197aa][_0x1eb5('0x42')]));_0x273b87['push'](get_open_tabs('whatsapp',_0x5d1687[_0x1eb5('0x3f')][_0x2197aa][_0x1eb5('0x42')]));}return Promise[_0x1eb5('0x46')](_0x273b87)[_0x1eb5('0x21')](function(){return _0x5d1687;});}else{return _0x5d1687;}})[_0x1eb5('0x21')](respondWithFilteredResult(_0x5d06ed,_0x2f96bd))['catch'](handleError(_0x5d06ed,null));};exports['show']=function(_0x15c51e,_0x598f2e){var _0x285486=getUserAttributes();_0x15c51e[_0x1eb5('0x39')]['id']=_0x15c51e[_0x1eb5('0x47')]['id'];var _0x5b0a59=qs['getOptions'](_0x285486,_0x15c51e);if(_0x15c51e[_0x1eb5('0x39')][_0x1eb5('0x38')]){_0x5b0a59[_0x1eb5('0x3c')]=[{'all':!![]}];}if(_0x15c51e[_0x1eb5('0x39')]['userSetting']===_0x1eb5('0x3b')){_0x5b0a59['include']=[{'model':db[_0x1eb5('0x48')],'as':_0x1eb5('0x3a')}];}_0x5b0a59=_[_0x1eb5('0x49')]({},_0x5b0a59,_0x15c51e[_0x1eb5('0x4a')]);if(!_['includes'](_0x5b0a59[_0x1eb5('0x3d')],'id')){_0x5b0a59[_0x1eb5('0x3d')][_0x1eb5('0x3e')]('id');}return db[_0x1eb5('0x2e')]['find'](_0x5b0a59)[_0x1eb5('0x21')](handleEntityNotFound(_0x598f2e,null))['then'](function(_0x18c8d8){var _0x22e17f=[];values=_0x18c8d8;if(_0x15c51e[_0x1eb5('0x39')][_0x1eb5('0x4b')]===_0x1eb5('0x3b')){_0x22e17f['push'](get_open_tabs('chat',_0x18c8d8['dataValues']));_0x22e17f['push'](get_open_tabs(_0x1eb5('0x41'),_0x18c8d8[_0x1eb5('0x42')]));_0x22e17f[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x45'),_0x18c8d8['dataValues']));_0x22e17f[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x4c'),_0x18c8d8['dataValues']));_0x22e17f[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x43'),_0x18c8d8[_0x1eb5('0x42')]));_0x22e17f[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x44'),_0x18c8d8[_0x1eb5('0x42')]));return Promise[_0x1eb5('0x46')](_0x22e17f);}else{return values;}})[_0x1eb5('0x21')](function(){return values;})[_0x1eb5('0x21')](respondWithResult(_0x598f2e,null))[_0x1eb5('0x4d')](handleError(_0x598f2e,null));};exports['update']=function(_0x598b2f,_0x57eeb9){if(_0x598b2f['body']['id']){delete _0x598b2f[_0x1eb5('0x4e')]['id'];}delete _0x598b2f[_0x1eb5('0x4e')][_0x1eb5('0x1c')];return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x598b2f[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x57eeb9,null))[_0x1eb5('0x21')](saveUpdates(_0x598b2f[_0x1eb5('0x4e')],null))[_0x1eb5('0x21')](respondWithResult(_0x57eeb9,null))[_0x1eb5('0x4d')](handleError(_0x57eeb9,null));};exports[_0x1eb5('0x4f')]=function(_0x576532,_0x52938e){return db[_0x1eb5('0x2e')][_0x1eb5('0x4f')]()['then'](respondWithResult(_0x52938e,null))['catch'](handleError(_0x52938e,null));};exports[_0x1eb5('0x50')]=function(_0xf0646c,_0x24154c){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0xf0646c[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x24154c,null))['then'](function(_0x1d0275){if(_0x1d0275){return _0x1d0275['addContacts'](_0xf0646c[_0x1eb5('0x4e')][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0xf0646c[_0x1eb5('0x4e')],[_0x1eb5('0x51'),'id'])||{});}})['then'](respondWithResult(_0x24154c,null))[_0x1eb5('0x4d')](handleError(_0x24154c,null));};function validateUser(_0x190aad){return new Promise(function(_0xa6f84c,_0x4a904c){if(_0x190aad['internal'])return _0xa6f84c(_0x190aad);return db['Setting']['findById'](0x1)[_0x1eb5('0x21')](function(_0x5881ba){if(_0x5881ba['securePassword'])authService[_0x1eb5('0x53')](_0x190aad[_0x1eb5('0x54')]);db[_0x1eb5('0x2e')]['max'](_0x1eb5('0x55'))[_0x1eb5('0x21')](function(_0x20feee){if(_[_0x1eb5('0x56')](_0x20feee)){_0x190aad[_0x1eb5('0x55')]=_0x5881ba['min_internal']||0x1;return;}if(_[_0x1eb5('0x56')](_0x5881ba[_0x1eb5('0x57')])||_0x5881ba[_0x1eb5('0x57')]===_0x20feee){_0x190aad['internal']=_0x20feee+0x1;return;}if(_0x5881ba['min_internal']>_0x20feee){_0x190aad[_0x1eb5('0x55')]=_0x5881ba['min_internal'];return;}return db[_0x1eb5('0x58')][_0x1eb5('0x39')](_0x1eb5('0x59'),{'type':db[_0x1eb5('0x58')][_0x1eb5('0x5a')][_0x1eb5('0x5b')]})[_0x1eb5('0x21')](function(_0x308085){if(_0x308085&&_0x308085[_0x1eb5('0x40')]){for(var _0x24dd5d=0x0,_0x2709f1=_0x308085[_0x1eb5('0x40')];_0x24dd5d<_0x2709f1&&_[_0x1eb5('0x56')](_0x190aad[_0x1eb5('0x55')]);_0x24dd5d++){if(_0x5881ba[_0x1eb5('0x57')]<=_0x308085[_0x24dd5d][_0x1eb5('0x5c')]){_0x190aad['internal']=_0x308085[_0x24dd5d][_0x1eb5('0x5c')];}else if(_0x5881ba[_0x1eb5('0x57')]>_0x308085[_0x24dd5d][_0x1eb5('0x5c')]&&_0x5881ba['min_internal']<=_0x308085[_0x24dd5d]['to']){_0x190aad[_0x1eb5('0x55')]=_0x5881ba[_0x1eb5('0x57')];}}}if(_[_0x1eb5('0x56')](_0x190aad[_0x1eb5('0x55')])){_0x190aad[_0x1eb5('0x55')]=_0x20feee+0x1;}return _0xa6f84c(_0x190aad);});});})[_0x1eb5('0x4d')](function(_0x5d6b01){_0x4a904c(_0x5d6b01);});});}function updateUser(_0x20784b){return new Promise(function(_0x5876db,_0x5b02ca){try{if(_0x20784b[_0x1eb5('0x5d')]){_0x20784b[_0x1eb5('0x5e')]=_0x20784b['internal'];_0x20784b[_0x1eb5('0x5f')]={'mailbox':_0x20784b[_0x1eb5('0x55')],'password':_0x20784b[_0x1eb5('0x54')],'fullname':_0x20784b[_0x1eb5('0x60')],'email':_0x20784b[_0x1eb5('0x61')]};}if(_0x20784b[_0x1eb5('0x1c')]===_0x1eb5('0x1d')){if(!_0x20784b[_0x1eb5('0x62')])_0x20784b[_0x1eb5('0x62')]=['101',_0x1eb5('0x63'),_0x1eb5('0x64'),_0x1eb5('0x65'),_0x1eb5('0x66'),_0x1eb5('0x67'),_0x1eb5('0x68'),_0x1eb5('0x69'),_0x1eb5('0x6a'),'108',_0x1eb5('0x6b'),_0x1eb5('0x6c'),_0x1eb5('0x6d'),_0x1eb5('0x6e'),'115'];}_0x5876db(_0x20784b);}catch(_0x3c647c){_0x5b02ca(_0x3c647c);}});}exports['create']=function(_0x32fcb5,_0x405718){if(_0x32fcb5[_0x1eb5('0x6f')]['role']===_0x1eb5('0x1d'))throw new Error('Unauthorized');if(_0x32fcb5['body']['role']===_0x1eb5('0x6f')&&_0x32fcb5[_0x1eb5('0x6f')][_0x1eb5('0x1c')]!==_0x1eb5('0x23')){throw new Error(_0x1eb5('0x70'));}if(_0x32fcb5[_0x1eb5('0x4e')][_0x1eb5('0x1c')]===_0x1eb5('0x23')&&_0x32fcb5[_0x1eb5('0x6f')]['role']!==_0x1eb5('0x23')){throw new Error(_0x1eb5('0x71'));}return licenseUtil[_0x1eb5('0x72')]([_0x32fcb5[_0x1eb5('0x4e')]])['then'](function(){return validateUser(_0x32fcb5['body']);})[_0x1eb5('0x21')](function(_0xd4352f){return updateUser(_0xd4352f)[_0x1eb5('0x21')](function(_0xc71fc9){if(_0xc71fc9[_0x1eb5('0x1c')]==='admin'){_0xc71fc9[_0x1eb5('0x73')]=_0x32fcb5[_0x1eb5('0x6f')][_0x1eb5('0x73')];delete _0xc71fc9[_0x1eb5('0x74')];}return _0xc71fc9;});})[_0x1eb5('0x21')](function(_0x33e2fe){return db['User'][_0x1eb5('0x75')](_0x33e2fe,{'include':[{'model':db[_0x1eb5('0x5f')],'as':_0x1eb5('0x5f')}]});})[_0x1eb5('0x21')](function(_0x487835){if(_0x32fcb5['body'][_0x1eb5('0x1c')]==='user')return _0x487835;if(_0x32fcb5[_0x1eb5('0x6f')][_0x1eb5('0x1c')]!==_0x1eb5('0x6f'))return _0x487835;return db['UserProfileSection'][_0x1eb5('0x2b')]({'where':{'name':_0x487835[_0x1eb5('0x1c')]===_0x1eb5('0x1d')?_0x1eb5('0x25'):_0x1eb5('0x76'),'userProfileId':_0x32fcb5[_0x1eb5('0x6f')][_0x1eb5('0x74')]},'raw':!![]})['then'](function(_0x4ca70e){if(!_0x4ca70e||_0x4ca70e['autoAssociation']!=0x0)return _0x487835;return db['UserProfileResource'][_0x1eb5('0x75')]({'name':_0x487835[_0x1eb5('0x2c')],'resourceId':_0x487835['id'],'type':_0x4ca70e[_0x1eb5('0x2c')],'sectionId':_0x4ca70e['id']},{})[_0x1eb5('0x21')](function(){return _0x487835;});})['catch'](function(_0x5d2e2c){logger[_0x1eb5('0x77')](_0x1eb5('0x78'),_0x5d2e2c);throw _0x5d2e2c;});})['then'](respondWithResult(_0x405718,0xc9))[_0x1eb5('0x4d')](handleError(_0x405718,null));};exports['bulkCreate']=function(_0x242fac,_0x5a4b97){var _0x211557=_0x242fac['body'];var _0x5a7ede=[];if(_0x242fac[_0x1eb5('0x6f')][_0x1eb5('0x1c')]===_0x1eb5('0x1d'))throw new Error(_0x1eb5('0x79'));if(_[_0x1eb5('0x7a')](_0x211557,[_0x1eb5('0x1c'),_0x1eb5('0x6f')])&&_0x242fac[_0x1eb5('0x6f')][_0x1eb5('0x1c')]!==_0x1eb5('0x23')){throw new Error(_0x1eb5('0x70'));}if(_[_0x1eb5('0x7a')](_0x211557,[_0x1eb5('0x1c'),'admin'])&&_0x242fac[_0x1eb5('0x6f')][_0x1eb5('0x1c')]!==_0x1eb5('0x23')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0x1eb5('0x72')](_0x211557)[_0x1eb5('0x21')](function(){return validateUser(_0x211557[0x0]);})[_0x1eb5('0x21')](function(){for(var _0x1228d8=0x1;_0x1228d8<_0x211557[_0x1eb5('0x40')];_0x1228d8++){var _0x51250d=_0x211557[_0x1228d8-0x1][_0x1eb5('0x55')];if(!_0x211557[_0x1228d8]['internal'])_0x211557[_0x1228d8][_0x1eb5('0x55')]=_0x51250d+0x1;_0x5a7ede[_0x1eb5('0x3e')](validateUser(_0x211557[_0x1228d8]));}return Promise[_0x1eb5('0x46')](_0x5a7ede);})[_0x1eb5('0x21')](function(){_0x5a7ede=[];for(var _0x44ac8d=0x0;_0x44ac8d<_0x211557[_0x1eb5('0x40')];_0x44ac8d++){_0x5a7ede[_0x1eb5('0x3e')](updateUser(_0x211557[_0x44ac8d]));}return Promise[_0x1eb5('0x46')](_0x5a7ede);})['then'](function(){_0x5a7ede=_0x211557['map'](function(_0xfe3034){return db[_0x1eb5('0x2e')][_0x1eb5('0x75')](_0xfe3034,{'include':[{'model':db['VoiceMail'],'as':_0x1eb5('0x5f')}]})[_0x1eb5('0x21')](function(_0x36904e){_0xfe3034['id']=_0x36904e['id'];return _0xfe3034;});});return Promise['all'](_0x5a7ede);})['then'](function(_0x74f576){if(_0x242fac['body'][_0x1eb5('0x1c')]==='user')return _0x74f576;if(_0x242fac[_0x1eb5('0x6f')][_0x1eb5('0x1c')]!==_0x1eb5('0x6f'))return _0x74f576;var _0x1875e1=_['some'](_0x74f576,function(_0x2a610a){return _0x2a610a[_0x1eb5('0x1c')]===_0x1eb5('0x1d')||_0x2a610a[_0x1eb5('0x1c')]==='telephone';});if(!_0x1875e1)return _0x74f576;return db[_0x1eb5('0x7b')]['findAll']({'where':{'name':{'$or':[_0x1eb5('0x25'),'Telephones']},'userProfileId':_0x242fac[_0x1eb5('0x6f')][_0x1eb5('0x74')]},'raw':!![]})[_0x1eb5('0x21')](function(_0x986a80){if(_['isEmpty'](_0x986a80)||!_[_0x1eb5('0x7a')](_0x986a80,['autoAssociation',0x0]))return _0x74f576;_0x5a7ede=[];var _0x11c927=_(_0x986a80)[_0x1eb5('0x28')](function(_0x86bec5){if(_0x86bec5[_0x1eb5('0x7c')]===0x1)return;return _0x86bec5[_0x1eb5('0x2c')]===_0x1eb5('0x25')?_0x1eb5('0x1d'):_0x1eb5('0x26');})[_0x1eb5('0x7d')]()['value']();for(var _0x4f8ec4=0x0;_0x4f8ec4<_0x74f576[_0x1eb5('0x40')];_0x4f8ec4++){if(!_[_0x1eb5('0x2a')](_0x11c927,_0x74f576[_0x4f8ec4][_0x1eb5('0x1c')]))return;var _0x4dc05a=_0x74f576[_0x4f8ec4]['role']===_0x1eb5('0x1d')?_0x1eb5('0x25'):'Telephones';_0x5a7ede[_0x1eb5('0x3e')](db[_0x1eb5('0x7e')][_0x1eb5('0x75')]({'name':_0x74f576[_0x4f8ec4][_0x1eb5('0x2c')],'resourceId':_0x74f576[_0x4f8ec4]['id'],'type':_0x4dc05a,'sectionId':_[_0x1eb5('0x2b')](_0x986a80,[_0x1eb5('0x2c'),_0x4dc05a])['id']},{}));}return Promise[_0x1eb5('0x46')](_0x5a7ede);});})[_0x1eb5('0x21')](respondWithResult(_0x5a4b97,0xc9))[_0x1eb5('0x4d')](handleError(_0x5a4b97,null));};exports[_0x1eb5('0x7f')]=function(_0x11592e,_0x11f0ce){if(_0x11592e[_0x1eb5('0x4e')]['id']){delete _0x11592e[_0x1eb5('0x4e')]['id'];}return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x11592e['params']['id']}})['then'](function(_0x2b91bf){if(!_0x2b91bf)return null;if(_0x2b91bf['id']===_0x11592e[_0x1eb5('0x6f')]['id']){if(!_0x11592e[_0x1eb5('0x4e')][_0x1eb5('0x80')]||!_0x11592e[_0x1eb5('0x4e')]['newPassword']){throw new db[(_0x1eb5('0x81'))][(_0x1eb5('0x82'))](_0x1eb5('0x83'));}if(!_0x2b91bf[_0x1eb5('0x84')](_0x11592e[_0x1eb5('0x4e')][_0x1eb5('0x80')])){throw new db[(_0x1eb5('0x81'))]['ValidationError'](_0x1eb5('0x85'));}if(_0x11592e[_0x1eb5('0x4e')]['oldPassword']===_0x11592e[_0x1eb5('0x4e')][_0x1eb5('0x86')]){throw new db[(_0x1eb5('0x81'))][(_0x1eb5('0x82'))](_0x1eb5('0x87'));}}else if(_0x11592e[_0x1eb5('0x6f')][_0x1eb5('0x1c')]==='admin'){if(!_0x11592e[_0x1eb5('0x4e')][_0x1eb5('0x86')]){throw new db['Sequelize'][(_0x1eb5('0x82'))](_0x1eb5('0x88'));}}else if(_0x11592e[_0x1eb5('0x6f')][_0x1eb5('0x1c')]===_0x1eb5('0x6f')){if(!_0x11592e[_0x1eb5('0x4e')][_0x1eb5('0x86')]){throw new db['Sequelize']['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x2b91bf[_0x1eb5('0x1c')]!==_0x1eb5('0x1d')){throw new db[(_0x1eb5('0x81'))][(_0x1eb5('0x82'))](_0x1eb5('0x79'));}}else{throw new db['Sequelize'][(_0x1eb5('0x82'))](_0x1eb5('0x79'));}return _0x2b91bf;})[_0x1eb5('0x21')](handleEntityNotFound(_0x11f0ce,null))[_0x1eb5('0x21')](function(_0x8fa03a){return db[_0x1eb5('0x89')][_0x1eb5('0x8a')]({'attributes':['id',_0x1eb5('0x8b'),_0x1eb5('0x8c'),_0x1eb5('0x8d')]})[_0x1eb5('0x21')](function(_0x4b6c47){if(_0x4b6c47[_0x1eb5('0x8b')])authService[_0x1eb5('0x53')](_0x11592e['body'][_0x1eb5('0x86')]);if(!_0x4b6c47['enforcePasswordHistory']||!_0x8fa03a[_0x1eb5('0x32')])return _0x8fa03a;authService[_0x1eb5('0x8e')](_0x11592e[_0x1eb5('0x4e')][_0x1eb5('0x86')],_0x8fa03a['previousPasswords'],_0x4b6c47[_0x1eb5('0x8d')]);return _0x8fa03a;})[_0x1eb5('0x21')](saveUpdates({'password':_0x11592e[_0x1eb5('0x4e')][_0x1eb5('0x86')],'passwordResetAt':_0x11592e[_0x1eb5('0x6f')]['id']==_0x11592e[_0x1eb5('0x47')]['id']?moment():null,'previousPasswords':authService[_0x1eb5('0x8f')](_0x11592e['body'][_0x1eb5('0x86')],_0x8fa03a[_0x1eb5('0x32')])},null));})['then'](respondWithResult(_0x11f0ce,null))[_0x1eb5('0x4d')](handleError(_0x11f0ce,null));};exports[_0x1eb5('0x90')]=function(_0x4c175f,_0xe4590c){var _0x421be3=_0x4c175f[_0x1eb5('0x4e')][_0x1eb5('0x91')];return db['User']['find']({'where':{'id':_0x4c175f[_0x1eb5('0x47')]['id']},'attributes':['id',_0x1eb5('0x2c'),'role',_0x1eb5('0x92'),'loginInPause','voicePause','interface']})[_0x1eb5('0x21')](handleEntityNotFound(_0xe4590c,null))['then'](function(_0x2bcbd9){if(_0x2bcbd9){if(!utils['isValidChannel'](_0x421be3)){throw new db[(_0x1eb5('0x81'))][(_0x1eb5('0x82'))](_0x1eb5('0x93'));}return _0x2bcbd9[_0x1eb5('0x94')+_['capitalize'](_0x421be3[_0x1eb5('0x95')]())+'Queues'](_0x4c175f[_0x1eb5('0x4e')][_0x1eb5('0x51')],{'penalty':_0x4c175f[_0x1eb5('0x4e')][_0x1eb5('0x96')]||0x0})[_0x1eb5('0x97')](function(_0x1282f0){for(var _0x4b1271=0x0;_0x4b1271<_0x4c175f[_0x1eb5('0x4e')][_0x1eb5('0x51')]['length'];_0x4b1271+=0x1){var _0xba1fe1={'UserId':Number(_0x4c175f['params']['id'])};_0xba1fe1[_[_0x1eb5('0x98')](_0x421be3['toLowerCase']())+'QueueId']=Number(_0x4c175f[_0x1eb5('0x4e')][_0x1eb5('0x51')][_0x4b1271]);socket[_0x1eb5('0x1e')](_0x1eb5('0x6f')+_['capitalize'](_0x421be3[_0x1eb5('0x95')]())+'Queue:save',_0xba1fe1);}return _0x1282f0;})['then'](function(){if(_0x421be3===_0x1eb5('0x99')){return db[_0x1eb5('0x9a')][_0x1eb5('0x9b')]({'where':{'id':_0x4c175f[_0x1eb5('0x4e')][_0x1eb5('0x51')]||[]},'raw':!![],'attributes':['id',_0x1eb5('0x2c')]});}})['then'](function(_0x4a01c1){var _0x126ca5=_0x2bcbd9[_0x1eb5('0x22')]({'plain':!![]});var _0x5d0b61=[];if(_0x421be3===_0x1eb5('0x99')&&_0x126ca5[_0x1eb5('0x1c')]==='agent'&&_0x126ca5[_0x1eb5('0x92')]){for(let _0x3cc290=0x0;_0x3cc290<_0x4a01c1[_0x1eb5('0x40')];_0x3cc290+=0x1){_0x5d0b61[_0x1eb5('0x3e')]({'membername':_0x126ca5['name'],'UserId':_0x126ca5['id'],'queue_name':_0x4a01c1[_0x3cc290][_0x1eb5('0x2c')],'VoiceQueueId':_0x4a01c1[_0x3cc290]['id'],'interface':_['isNil'](_0x126ca5['interface'])?util[_0x1eb5('0x9c')]('SIP/%s',_0x126ca5[_0x1eb5('0x2c')]):_0x126ca5[_0x1eb5('0x9d')],'paused':_0x126ca5[_0x1eb5('0x9e')]||![],'penalty':_0x4c175f[_0x1eb5('0x4e')]['penalty']||0x0});}return Promise[_0x1eb5('0x46')](_0x5d0b61[_0x1eb5('0x28')](function(_0x4e5cf5){return db[_0x1eb5('0x9f')][_0x1eb5('0xa0')](_0x4e5cf5);}));}return _0x2bcbd9;});}})[_0x1eb5('0x21')](respondWithStatusCode(_0xe4590c,null))[_0x1eb5('0x4d')](handleError(_0xe4590c,null));};exports[_0x1eb5('0xa1')]=function(_0x54aa18,_0x257627){var _0x778c3a,_0x318cf8;return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x54aa18[_0x1eb5('0x47')]['id']},'attributes':['id','name',_0x1eb5('0x1c')]})['then'](handleEntityNotFound(_0x257627,null))[_0x1eb5('0x21')](function(_0x4ad99d){if(_0x4ad99d){_0x778c3a=_0x4ad99d;if(!_0x54aa18[_0x1eb5('0x39')]['channel']||!utils[_0x1eb5('0xa2')](_0x54aa18[_0x1eb5('0x39')][_0x1eb5('0x91')])){throw new db[(_0x1eb5('0x81'))][(_0x1eb5('0x82'))]('Unknown\x20channel');}return _0x4ad99d[_0x1eb5('0xa3')+_[_0x1eb5('0x98')](_0x54aa18[_0x1eb5('0x39')][_0x1eb5('0x91')][_0x1eb5('0x95')]())+'Queues'](_0x54aa18[_0x1eb5('0x39')][_0x1eb5('0x51')]);}})['then'](function(_0xdbfebe){if(_[_0x1eb5('0xa4')](_0x54aa18['query']['ids'])){for(var _0x7316bd=0x0;_0x7316bd<_0x54aa18['query'][_0x1eb5('0x51')][_0x1eb5('0x40')];_0x7316bd+=0x1){_0x318cf8={'UserId':Number(_0x54aa18[_0x1eb5('0x47')]['id'])};_0x318cf8[_[_0x1eb5('0x98')](_0x54aa18[_0x1eb5('0x39')][_0x1eb5('0x91')][_0x1eb5('0x95')]())+'QueueId']=Number(_0x54aa18[_0x1eb5('0x39')]['ids'][_0x7316bd]);socket[_0x1eb5('0x1e')](_0x1eb5('0x6f')+_[_0x1eb5('0x98')](_0x54aa18[_0x1eb5('0x39')][_0x1eb5('0x91')][_0x1eb5('0x95')]())+_0x1eb5('0xa5'),_0x318cf8);}}else{_0x318cf8={'UserId':Number(_0x54aa18['params']['id'])};_0x318cf8[_[_0x1eb5('0x98')](_0x54aa18[_0x1eb5('0x39')]['channel'][_0x1eb5('0x95')]())+_0x1eb5('0xa6')]=Number(_0x54aa18[_0x1eb5('0x39')][_0x1eb5('0x51')]);socket[_0x1eb5('0x1e')](_0x1eb5('0x6f')+_[_0x1eb5('0x98')](_0x54aa18['query']['channel'][_0x1eb5('0x95')]())+_0x1eb5('0xa5'),_0x318cf8);}return _0xdbfebe;})[_0x1eb5('0x21')](function(){if(_0x54aa18[_0x1eb5('0x39')][_0x1eb5('0x91')]===_0x1eb5('0x99')){return db[_0x1eb5('0x9f')][_0x1eb5('0x20')]({'where':{'UserId':_0x54aa18[_0x1eb5('0x47')]['id'],'VoiceQueueId':_0x54aa18[_0x1eb5('0x39')][_0x1eb5('0x51')]},'individualHooks':!![]})[_0x1eb5('0x21')](function(){return _0x778c3a;});}return _0x778c3a;})[_0x1eb5('0x21')](respondWithStatusCode(_0x257627,null))['catch'](handleError(_0x257627,null));};exports[_0x1eb5('0xa7')]=function(_0x54cd59,_0x350d9d){_0x54cd59[_0x1eb5('0x4e')][_0x1eb5('0xa8')]=_0x54cd59[_0x1eb5('0xa9')]['filename'];return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x54cd59[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x350d9d,null))[_0x1eb5('0x21')](saveUpdates(_0x54cd59[_0x1eb5('0x4e')],null))[_0x1eb5('0x21')](respondWithResult(_0x350d9d,null))[_0x1eb5('0x4d')](handleError(_0x350d9d,null));};exports[_0x1eb5('0xaa')]=function(_0x562be7,_0x3e12bb){var _0x2e4468=path['join'](config['root'],_0x1eb5('0xab'));return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x562be7[_0x1eb5('0x47')]['id']},'attributes':['id',_0x1eb5('0xa8')],'raw':!![]})[_0x1eb5('0x21')](handleEntityNotFound(_0x3e12bb,null))[_0x1eb5('0x21')](function(_0x1910d4){if(_0x1910d4){if(_['isNil'](_0x1910d4[_0x1eb5('0xa8')])){return _0x3e12bb[_0x1eb5('0xac')](_0x2e4468);}else{if(!fs[_0x1eb5('0xad')](path[_0x1eb5('0xae')](config[_0x1eb5('0xaf')],_0x1eb5('0xb0'),_0x1910d4[_0x1eb5('0xa8')]))){return _0x3e12bb[_0x1eb5('0xac')](_0x2e4468);}return _0x3e12bb[_0x1eb5('0xac')](path[_0x1eb5('0xae')](config[_0x1eb5('0xaf')],'server/files/images/',_0x1910d4[_0x1eb5('0xa8')]));}}})['catch'](handleError(_0x3e12bb,null));};exports['getOpenTabs']=function(_0x3ac1d5,_0x3ad097){return db['User']['find']({'where':{'id':_0x3ac1d5[_0x1eb5('0x47')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x3ad097,null))[_0x1eb5('0x21')](function(_0x3dc962){var _0x30939d=[];values=_0x3dc962[_0x1eb5('0x42')];_0x30939d[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0xb1'),_0x3dc962[_0x1eb5('0x42')]));_0x30939d[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x41'),_0x3dc962[_0x1eb5('0x42')]));_0x30939d[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x45'),_0x3dc962[_0x1eb5('0x42')]));_0x30939d['push'](get_open_tabs(_0x1eb5('0x4c'),_0x3dc962[_0x1eb5('0x42')]));_0x30939d['push'](get_open_tabs(_0x1eb5('0x43'),_0x3dc962['dataValues']));_0x30939d[_0x1eb5('0x3e')](get_open_tabs(_0x1eb5('0x44'),_0x3dc962[_0x1eb5('0x42')]));return Promise[_0x1eb5('0x46')](_0x30939d);})[_0x1eb5('0x21')](function(_0x5ad651){if(_0x5ad651){var _0x4ba01f=_[_0x1eb5('0x28')](values['ChatOpenTabs'],function(_0x9b64){return{'channel':'CHAT','id':_0x9b64['id'],'createdAt':_0x9b64[_0x1eb5('0xb2')]};});var _0x1e60a9=_[_0x1eb5('0x28')](values['FaxOpenTabs'],function(_0x415c90){return{'channel':_0x1eb5('0xb3'),'id':_0x415c90['id'],'createdAt':_0x415c90[_0x1eb5('0xb2')]};});var _0x585867=_[_0x1eb5('0x28')](values[_0x1eb5('0xb4')],function(_0x5c88e4){return{'channel':_0x1eb5('0xb5'),'id':_0x5c88e4['id'],'createdAt':_0x5c88e4['createdAt']};});var _0x5cab4d=_[_0x1eb5('0x28')](values[_0x1eb5('0xb6')],function(_0x228edb){return{'channel':_0x1eb5('0xb7'),'id':_0x228edb['id'],'createdAt':_0x228edb[_0x1eb5('0xb2')]};});var _0x3e89ce=_['map'](values['SmsOpenTabs'],function(_0x366d48){return{'channel':_0x1eb5('0xb8'),'id':_0x366d48['id'],'createdAt':_0x366d48[_0x1eb5('0xb2')]};});var _0x2e8cad=_[_0x1eb5('0x28')](values[_0x1eb5('0xb9')],function(_0x10f033){return{'channel':_0x1eb5('0xba'),'id':_0x10f033['id'],'createdAt':_0x10f033[_0x1eb5('0xb2')]};});var _0x3df51a=_[_0x1eb5('0xbb')](_0x4ba01f,_0x1e60a9,_0x585867,_0x5cab4d,_0x3e89ce,_0x2e8cad);var _0x4bf2e1={'count':_0x3df51a[_0x1eb5('0x40')],'rows':_0x3df51a};return _0x4bf2e1;}else return null;})[_0x1eb5('0x21')](respondWithResult(_0x3ad097,null))['catch'](handleError(_0x3ad097,null));};exports['getContacts']=function(_0x4dd1d6,_0x158318){var _0x6b9222={};return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x4dd1d6[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](function(_0x4fedd4){if(!_0x4fedd4){throw new APINotFoundError(util[_0x1eb5('0x9c')](_0x1eb5('0xbc'),_0x4dd1d6[_0x1eb5('0x47')]['id']));}return contacts[_0x1eb5('0x4f')]();})[_0x1eb5('0x21')](function(_0xd8f9f){_0x4dd1d6[_0x1eb5('0x39')][_0x1eb5('0x2e')]=_0x4dd1d6[_0x1eb5('0x47')]['id'];_0x6b9222=qs[_0x1eb5('0x36')](_0xd8f9f,_0x4dd1d6);if(_0x4dd1d6[_0x1eb5('0x39')][_0x1eb5('0xbd')]('includeAll')){_0x6b9222[_0x1eb5('0x3c')]=[{'model':db[_0x1eb5('0xbe')],'as':_0x1eb5('0xbf'),'required':![]},{'model':db['Tag'],'as':_0x1eb5('0xc0'),'attributes':['id',_0x1eb5('0x2c'),_0x1eb5('0xc1')],'where':_0x4dd1d6[_0x1eb5('0x39')][_0x1eb5('0xc2')]?{'id':_0x4dd1d6[_0x1eb5('0x39')][_0x1eb5('0xc2')]}:undefined,'required':_0x4dd1d6['query'][_0x1eb5('0xc2')]?!![]:![]}];}return contacts[_0x1eb5('0x9b')](_0x4dd1d6[_0x1eb5('0x39')],_0x4dd1d6[_0x1eb5('0x6f')],_0x6b9222,_0xd8f9f);})[_0x1eb5('0x21')](respondWithFilteredResult(_0x158318,_0x6b9222))['catch'](APIHandleError(_0x158318));};exports['getQueues']=function(_0x106539,_0x115782){var _0x40d774;var _0x4ecf51={};var _0x51883f;return db[_0x1eb5('0x2e')]['findOne']({'where':{'id':_0x106539[_0x1eb5('0x47')]['id']},'attributes':['id',_0x1eb5('0x2c'),'role']})[_0x1eb5('0x21')](handleEntityNotFound(_0x115782,null))['then'](function(_0x5bf485){if(!utils[_0x1eb5('0xa2')](_0x106539[_0x1eb5('0x39')][_0x1eb5('0x91')])){throw new db['Sequelize'][(_0x1eb5('0x82'))](_0x1eb5('0x93'));}_0x40d774=_0x5bf485;var _0x5acdd9={};_0x5acdd9[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db[_['capitalize'](_0x106539[_0x1eb5('0x39')][_0x1eb5('0x91')])+_0x1eb5('0xc5')][_0x1eb5('0xc6')]);_0x5acdd9[_0x1eb5('0x39')]=_[_0x1eb5('0xc4')](_0x106539['query']);_0x5acdd9['filters']=_['intersection'](_0x5acdd9[_0x1eb5('0xc3')],_0x5acdd9['query']);_0x4ecf51[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x5acdd9['model'],qs[_0x1eb5('0xc8')](_0x106539['query']['fields']));_0x4ecf51[_0x1eb5('0x3d')]=_0x4ecf51[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x4ecf51[_0x1eb5('0x3d')]:_0x5acdd9['model'];_0x4ecf51[_0x1eb5('0xc9')]=qs['sort'](_0x106539['query']['sort']);_0x4ecf51[_0x1eb5('0x37')]=qs['filters'](_[_0x1eb5('0xca')](_0x106539[_0x1eb5('0x39')],_0x5acdd9[_0x1eb5('0xcb')]));if(_0x106539['query'][_0x1eb5('0xcc')]){_0x4ecf51['where']=_[_0x1eb5('0x49')](_0x4ecf51[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x4ecf51[_0x1eb5('0x3d')],function(_0x3d094b){var _0x4d0c7b={};_0x4d0c7b[_0x3d094b]={'$like':'%'+_0x106539[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x4d0c7b;})});}_0x4ecf51=_['merge']({},_0x4ecf51,_0x106539[_0x1eb5('0x4a')]);switch(_0x40d774[_0x1eb5('0x1c')]){case _0x1eb5('0x23'):return db[_[_0x1eb5('0x98')](_0x106539[_0x1eb5('0x39')][_0x1eb5('0x91')])+_0x1eb5('0xc5')]['findAll'](_0x4ecf51);case _0x1eb5('0x6f'):case _0x1eb5('0x1d'):return _0x40d774['get'+_[_0x1eb5('0x98')](_0x106539[_0x1eb5('0x39')][_0x1eb5('0x91')])+_0x1eb5('0xcd')](_0x4ecf51);default:throw new db[(_0x1eb5('0x81'))]['ValidationError'](_0x1eb5('0xce'));}})[_0x1eb5('0x21')](function(_0x23aeb0){_0x51883f=_0x23aeb0[_0x1eb5('0x40')];if(!_0x106539[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x4ecf51['limit']=qs[_0x1eb5('0x19')](_0x106539[_0x1eb5('0x39')][_0x1eb5('0x19')]);_0x4ecf51['offset']=qs[_0x1eb5('0x17')](_0x106539[_0x1eb5('0x39')][_0x1eb5('0x17')]);}switch(_0x40d774[_0x1eb5('0x1c')]){case'admin':return db[_[_0x1eb5('0x98')](_0x106539['query'][_0x1eb5('0x91')])+'Queue'][_0x1eb5('0x9b')](_0x4ecf51);case _0x1eb5('0x6f'):case _0x1eb5('0x1d'):return _0x40d774[_0x1eb5('0x22')+_[_0x1eb5('0x98')](_0x106539[_0x1eb5('0x39')][_0x1eb5('0x91')])+_0x1eb5('0xcd')](_0x4ecf51);}})['then'](function(_0x165b53){return{'count':_0x51883f,'rows':_0x165b53};})['then'](respondWithResult(_0x115782,null))[_0x1eb5('0x4d')](handleError(_0x115782,null));};exports[_0x1eb5('0xd0')]=function(_0x3e1aed,_0x1c44e7){var _0x1ebb25={};var _0x9bacd6={};var _0x70f58c;var _0x89aaff;return db[_0x1eb5('0x2e')]['findOne']({'where':{'id':_0x3e1aed[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x1c44e7,null))['then'](function(_0x5eebc8){if(_0x5eebc8){_0x70f58c=_0x5eebc8;_0x9bacd6[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db[_0x1eb5('0x9f')][_0x1eb5('0xc6')]);_0x9bacd6[_0x1eb5('0x39')]=_[_0x1eb5('0xc4')](_0x3e1aed[_0x1eb5('0x39')]);_0x9bacd6[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x9bacd6[_0x1eb5('0xc3')],_0x9bacd6[_0x1eb5('0x39')]);_0x1ebb25[_0x1eb5('0x3d')]=_['intersection'](_0x9bacd6[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x3e1aed[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x1ebb25[_0x1eb5('0x3d')]=_0x1ebb25[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x1ebb25['attributes']:_0x9bacd6['model'];_0x1ebb25[_0x1eb5('0xc9')]=qs['sort'](_0x3e1aed[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x1ebb25['where']=qs['filters'](_[_0x1eb5('0xca')](_0x3e1aed[_0x1eb5('0x39')],_0x9bacd6[_0x1eb5('0xcb')]));if(_0x3e1aed[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x1ebb25[_0x1eb5('0x37')]=_['merge'](_0x1ebb25[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x1ebb25[_0x1eb5('0x3d')],function(_0x377c04){var _0x439967={};_0x439967[_0x377c04]={'$like':'%'+_0x3e1aed['query']['filter']+'%'};return _0x439967;})});}_0x1ebb25=_[_0x1eb5('0x49')]({},_0x1ebb25,_0x3e1aed[_0x1eb5('0x4a')]);return _0x70f58c[_0x1eb5('0xd0')](_0x1ebb25);}})[_0x1eb5('0x21')](function(_0x490b08){if(_0x490b08){_0x89aaff=_0x490b08[_0x1eb5('0x40')];if(!_0x3e1aed[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x1ebb25['limit']=qs['limit'](_0x3e1aed['query'][_0x1eb5('0x19')]);_0x1ebb25['offset']=qs[_0x1eb5('0x17')](_0x3e1aed[_0x1eb5('0x39')][_0x1eb5('0x17')]);}return _0x70f58c[_0x1eb5('0xd0')](_0x1ebb25);}})['then'](function(_0x546e60){if(_0x546e60){return _0x546e60?{'count':_0x89aaff,'rows':_0x546e60}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x1c44e7,null))[_0x1eb5('0x4d')](handleError(_0x1c44e7,null));};exports[_0x1eb5('0xd2')]=function(_0x423425,_0x36600a){var _0x323029={};var _0x1424d9={};var _0x52dd8d;var _0xb1ca9b;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x423425['params']['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x36600a,null))['then'](function(_0x3c1139){if(_0x3c1139){_0x52dd8d=_0x3c1139;_0x1424d9[_0x1eb5('0xc3')]=_['keys'](db['ChatGroup'][_0x1eb5('0xc6')]);_0x1424d9['query']=_[_0x1eb5('0xc4')](_0x423425[_0x1eb5('0x39')]);_0x1424d9['filters']=_['intersection'](_0x1424d9['model'],_0x1424d9[_0x1eb5('0x39')]);_0x323029[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x1424d9['model'],qs[_0x1eb5('0xc8')](_0x423425[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x323029[_0x1eb5('0x3d')]=_0x323029[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x323029[_0x1eb5('0x3d')]:_0x1424d9[_0x1eb5('0xc3')];_0x323029[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x423425[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x323029[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_['pick'](_0x423425['query'],_0x1424d9[_0x1eb5('0xcb')]));if(_0x423425[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x323029['where']=_[_0x1eb5('0x49')](_0x323029[_0x1eb5('0x37')],{'$or':_['map'](_0x323029[_0x1eb5('0x3d')],function(_0xd82458){var _0x49bd96={};_0x49bd96[_0xd82458]={'$like':'%'+_0x423425[_0x1eb5('0x39')]['filter']+'%'};return _0x49bd96;})});}_0x323029=_[_0x1eb5('0x49')]({},_0x323029,_0x423425[_0x1eb5('0x4a')]);return _0x52dd8d[_0x1eb5('0xd2')](_0x323029);}})[_0x1eb5('0x21')](function(_0x23cc33){if(_0x23cc33){_0xb1ca9b=_0x23cc33[_0x1eb5('0x40')];if(!_0x423425[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x323029['limit']=qs[_0x1eb5('0x19')](_0x423425[_0x1eb5('0x39')][_0x1eb5('0x19')]);_0x323029[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x423425[_0x1eb5('0x39')]['offset']);}return _0x52dd8d[_0x1eb5('0xd2')](_0x323029);}})[_0x1eb5('0x21')](function(_0x46aebd){if(_0x46aebd){return _0x46aebd?{'count':_0xb1ca9b,'rows':_0x46aebd}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x36600a,null))['catch'](handleError(_0x36600a,null));};exports['getRecordings']=function(_0x1cb3a5,_0x307d36){var _0x3a63ce={'raw':!![],'where':{}};var _0x9a2abd={};var _0x2a6380={'count':0x0,'rows':[]};return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x1cb3a5[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x307d36,null))[_0x1eb5('0x21')](function(_0x120730){if(_0x120730){_0x9a2abd['model']=_[_0x1eb5('0xc4')](db['VoiceRecording']['rawAttributes']);_0x9a2abd['query']=_[_0x1eb5('0xc4')](_0x1cb3a5['query']);_0x9a2abd['filters']=_[_0x1eb5('0xc7')](_0x9a2abd[_0x1eb5('0xc3')],_0x9a2abd['query']);_0x3a63ce[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x9a2abd[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x1cb3a5[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x3a63ce['attributes']=_0x3a63ce['attributes'][_0x1eb5('0x40')]?_0x3a63ce[_0x1eb5('0x3d')]:_0x9a2abd[_0x1eb5('0xc3')];if(!_0x1cb3a5[_0x1eb5('0x39')]['hasOwnProperty'](_0x1eb5('0xcf'))){_0x3a63ce[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x1cb3a5[_0x1eb5('0x39')]['limit']);_0x3a63ce['offset']=qs[_0x1eb5('0x17')](_0x1cb3a5[_0x1eb5('0x39')][_0x1eb5('0x17')]);}_0x3a63ce[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x1cb3a5[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x3a63ce[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x1cb3a5[_0x1eb5('0x39')],_0x9a2abd[_0x1eb5('0xcb')]));_0x3a63ce[_0x1eb5('0x37')][_0x1eb5('0xd3')]=_0x120730['id'];if(_0x1cb3a5[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x3a63ce['where']=_[_0x1eb5('0x49')](_0x3a63ce[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x3a63ce['attributes'],function(_0x30dc15){var _0x4164a4={};_0x4164a4[_0x30dc15]={'$like':'%'+_0x1cb3a5[_0x1eb5('0x39')]['filter']+'%'};return _0x4164a4;})});}_0x3a63ce=_['merge']({},_0x3a63ce,_0x1cb3a5[_0x1eb5('0x4a')]);return db[_0x1eb5('0xd4')]['count']({'where':_0x3a63ce['where']})['then'](function(_0x5a31e6){_0x2a6380[_0x1eb5('0x1a')]=_0x5a31e6;if(_0x1cb3a5['query'][_0x1eb5('0x38')]){_0x3a63ce[_0x1eb5('0x3c')]=[{'all':!![]}];}return db[_0x1eb5('0xd4')][_0x1eb5('0x9b')](_0x3a63ce);})[_0x1eb5('0x21')](function(_0x3a6d5f){_0x2a6380[_0x1eb5('0x3f')]=_0x3a6d5f;return _0x2a6380;});}})[_0x1eb5('0x21')](respondWithFilteredResult(_0x307d36,_0x3a63ce))[_0x1eb5('0x4d')](handleError(_0x307d36,null));};exports[_0x1eb5('0xd5')]=function(_0xccd50c,_0x40bf62){var _0x3cd965={'raw':!![],'where':{}};var _0x5d7f74={};var _0x4e48b7={'count':0x0,'rows':[]};return db['User'][_0x1eb5('0x8a')]({'where':{'id':_0xccd50c[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x40bf62,null))[_0x1eb5('0x21')](function(_0x116660){if(_0x116660){_0x5d7f74[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db[_0x1eb5('0xd6')][_0x1eb5('0xc6')]);_0x5d7f74[_0x1eb5('0x39')]=_[_0x1eb5('0xc4')](_0xccd50c[_0x1eb5('0x39')]);_0x5d7f74[_0x1eb5('0xcb')]=_['intersection'](_0x5d7f74[_0x1eb5('0xc3')],_0x5d7f74[_0x1eb5('0x39')]);_0x3cd965[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x5d7f74['model'],qs['fields'](_0xccd50c[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x3cd965[_0x1eb5('0x3d')]=_0x3cd965['attributes']['length']?_0x3cd965['attributes']:_0x5d7f74[_0x1eb5('0xc3')];if(!_0xccd50c[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x3cd965[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0xccd50c[_0x1eb5('0x39')]['limit']);_0x3cd965[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0xccd50c['query']['offset']);}_0x3cd965[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0xccd50c[_0x1eb5('0x39')]['sort']);_0x3cd965[_0x1eb5('0x37')]=qs['filters'](_['pick'](_0xccd50c[_0x1eb5('0x39')],_0x5d7f74[_0x1eb5('0xcb')]));_0x3cd965[_0x1eb5('0x37')][_0x1eb5('0xd3')]=_0x116660['id'];if(_0xccd50c[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x3cd965[_0x1eb5('0x37')]=_['merge'](_0x3cd965['where'],{'$or':_['map'](_0x3cd965['attributes'],function(_0x48e041){var _0x593c1a={};_0x593c1a[_0x48e041]={'$like':'%'+_0xccd50c['query'][_0x1eb5('0xcc')]+'%'};return _0x593c1a;})});}_0x3cd965=_[_0x1eb5('0x49')]({},_0x3cd965,_0xccd50c[_0x1eb5('0x4a')]);return db[_0x1eb5('0xd6')]['count']({'where':_0x3cd965[_0x1eb5('0x37')]})[_0x1eb5('0x21')](function(_0x3444d5){_0x4e48b7['count']=_0x3444d5;if(_0xccd50c['query']['includeAll']){_0x3cd965[_0x1eb5('0x3c')]=[{'all':!![]}];}return db['ScreenRecording'][_0x1eb5('0x9b')](_0x3cd965);})[_0x1eb5('0x21')](function(_0x256cf3){_0x4e48b7[_0x1eb5('0x3f')]=_0x256cf3;return _0x4e48b7;});}})[_0x1eb5('0x21')](respondWithFilteredResult(_0x40bf62,_0x3cd965))[_0x1eb5('0x4d')](handleError(_0x40bf62,null));};exports['getChatInteractions']=function(_0x8ac526,_0x1e96d2){var _0x6cd618={};var _0x14b96f={};var _0x1e7b68;var _0x5b3a88;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x8ac526[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x1e96d2,null))[_0x1eb5('0x21')](function(_0x1ce2b4){if(_0x1ce2b4){_0x1e7b68=_0x1ce2b4;_0x14b96f[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db['ChatInteraction'][_0x1eb5('0xc6')]);_0x14b96f[_0x1eb5('0x39')]=_[_0x1eb5('0xc4')](_0x8ac526[_0x1eb5('0x39')]);_0x14b96f['filters']=_[_0x1eb5('0xc7')](_0x14b96f[_0x1eb5('0xc3')],_0x14b96f[_0x1eb5('0x39')]);_0x6cd618[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x14b96f[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x8ac526[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x6cd618[_0x1eb5('0x3d')]=_0x6cd618[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x6cd618[_0x1eb5('0x3d')]:_0x14b96f['model'];_0x6cd618[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x8ac526[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x6cd618[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_['pick'](_0x8ac526[_0x1eb5('0x39')],_0x14b96f['filters']));if(_0x8ac526['query'][_0x1eb5('0xcc')]){_0x6cd618[_0x1eb5('0x37')]=_['merge'](_0x6cd618[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x6cd618['attributes'],function(_0x3d4847){var _0x5a40ff={};_0x5a40ff[_0x3d4847]={'$like':'%'+_0x8ac526[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x5a40ff;})});}_0x6cd618=_[_0x1eb5('0x49')]({},_0x6cd618,_0x8ac526[_0x1eb5('0x4a')]);return _0x1e7b68[_0x1eb5('0xd7')](_0x6cd618);}})[_0x1eb5('0x21')](function(_0x4d1e30){if(_0x4d1e30){_0x5b3a88=_0x4d1e30['length'];if(!_0x8ac526[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x6cd618[_0x1eb5('0x19')]=qs['limit'](_0x8ac526[_0x1eb5('0x39')][_0x1eb5('0x19')]);_0x6cd618['offset']=qs[_0x1eb5('0x17')](_0x8ac526[_0x1eb5('0x39')]['offset']);}return _0x1e7b68[_0x1eb5('0xd7')](_0x6cd618);}})[_0x1eb5('0x21')](function(_0xcc625b){if(_0xcc625b){return _0xcc625b?{'count':_0x5b3a88,'rows':_0xcc625b}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x1e96d2,null))[_0x1eb5('0x4d')](handleError(_0x1e96d2,null));};exports[_0x1eb5('0xd8')]=function(_0x5e0294,_0x57fe99){var _0x502f65={};var _0x587eb0={};var _0x1a8d9f;var _0x36d2be;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x5e0294[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x57fe99,null))[_0x1eb5('0x21')](function(_0x545e58){if(_0x545e58){_0x1a8d9f=_0x545e58;_0x587eb0[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db['OpenchannelInteraction'][_0x1eb5('0xc6')]);_0x587eb0['query']=_[_0x1eb5('0xc4')](_0x5e0294[_0x1eb5('0x39')]);_0x587eb0[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x587eb0[_0x1eb5('0xc3')],_0x587eb0[_0x1eb5('0x39')]);_0x502f65[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x587eb0['model'],qs[_0x1eb5('0xc8')](_0x5e0294[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x502f65[_0x1eb5('0x3d')]=_0x502f65[_0x1eb5('0x3d')]['length']?_0x502f65['attributes']:_0x587eb0[_0x1eb5('0xc3')];_0x502f65['order']=qs[_0x1eb5('0xd1')](_0x5e0294[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x502f65['where']=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x5e0294[_0x1eb5('0x39')],_0x587eb0[_0x1eb5('0xcb')]));if(_0x5e0294[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x502f65[_0x1eb5('0x37')]=_[_0x1eb5('0x49')](_0x502f65[_0x1eb5('0x37')],{'$or':_['map'](_0x502f65[_0x1eb5('0x3d')],function(_0x1b869d){var _0x38377f={};_0x38377f[_0x1b869d]={'$like':'%'+_0x5e0294[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x38377f;})});}_0x502f65=_['merge']({},_0x502f65,_0x5e0294['options']);return _0x1a8d9f[_0x1eb5('0xd8')](_0x502f65);}})['then'](function(_0x5a476d){if(_0x5a476d){_0x36d2be=_0x5a476d[_0x1eb5('0x40')];if(!_0x5e0294[_0x1eb5('0x39')][_0x1eb5('0xbd')]('nolimit')){_0x502f65[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x5e0294[_0x1eb5('0x39')][_0x1eb5('0x19')]);_0x502f65['offset']=qs[_0x1eb5('0x17')](_0x5e0294[_0x1eb5('0x39')][_0x1eb5('0x17')]);}return _0x1a8d9f['getOpenchannelInteractions'](_0x502f65);}})[_0x1eb5('0x21')](function(_0x5a8ef6){if(_0x5a8ef6){return _0x5a8ef6?{'count':_0x36d2be,'rows':_0x5a8ef6}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x57fe99,null))[_0x1eb5('0x4d')](handleError(_0x57fe99,null));};exports[_0x1eb5('0xd9')]=function(_0x19ee6c,_0x220e8d){var _0x56e707={'raw':!![],'where':{}};var _0x469c39={};var _0x2ed605={'count':0x0,'rows':[]};return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x19ee6c['params']['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x220e8d,null))[_0x1eb5('0x21')](function(_0x4a444e){if(_0x4a444e){_0x469c39['model']=_['keys'](db['MailInteraction'][_0x1eb5('0xc6')]);_0x469c39[_0x1eb5('0x39')]=_['keys'](_0x19ee6c[_0x1eb5('0x39')]);_0x469c39['filters']=_[_0x1eb5('0xc7')](_0x469c39[_0x1eb5('0xc3')],_0x469c39[_0x1eb5('0x39')]);_0x56e707[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x469c39[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x19ee6c['query'][_0x1eb5('0xc8')]));_0x56e707[_0x1eb5('0x3d')]=_0x56e707['attributes']['length']?_0x56e707[_0x1eb5('0x3d')]:_0x469c39['model'];if(!_0x19ee6c[_0x1eb5('0x39')][_0x1eb5('0xbd')]('nolimit')){_0x56e707[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x19ee6c['query'][_0x1eb5('0x19')]);_0x56e707['offset']=qs[_0x1eb5('0x17')](_0x19ee6c[_0x1eb5('0x39')][_0x1eb5('0x17')]);}_0x56e707[_0x1eb5('0xc9')]=qs['sort'](_0x19ee6c[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x56e707[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x19ee6c[_0x1eb5('0x39')],_0x469c39['filters']));_0x56e707[_0x1eb5('0x37')]['UserId']=_0x4a444e['id'];if(_0x19ee6c[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x56e707[_0x1eb5('0x37')]=_['merge'](_0x56e707['where'],{'$or':_[_0x1eb5('0x28')](_0x56e707[_0x1eb5('0x3d')],function(_0x154b37){var _0x590788={};_0x590788[_0x154b37]={'$like':'%'+_0x19ee6c[_0x1eb5('0x39')]['filter']+'%'};return _0x590788;})});}_0x56e707=_[_0x1eb5('0x49')]({},_0x56e707,_0x19ee6c[_0x1eb5('0x4a')]);return db[_0x1eb5('0xda')][_0x1eb5('0x1a')]({'where':_0x56e707[_0x1eb5('0x37')]})[_0x1eb5('0x21')](function(_0x2e8d39){_0x2ed605['count']=_0x2e8d39;if(_0x19ee6c[_0x1eb5('0x39')]['includeAll']){_0x56e707['include']=[{'all':!![]}];}return db[_0x1eb5('0xda')]['findAll'](_0x56e707);})[_0x1eb5('0x21')](function(_0x488a20){_0x2ed605[_0x1eb5('0x3f')]=_0x488a20;return _0x2ed605;});}})[_0x1eb5('0x21')](respondWithFilteredResult(_0x220e8d,_0x56e707))['catch'](handleError(_0x220e8d,null));};exports[_0x1eb5('0xdb')]=function(_0x52e7b6,_0x442410){var _0x331348={};var _0xd70894={};var _0x4e5fef;var _0x554b92;return db['User'][_0x1eb5('0x8a')]({'where':{'id':_0x52e7b6[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x442410,null))[_0x1eb5('0x21')](function(_0x2b8780){if(_0x2b8780){_0x4e5fef=_0x2b8780;_0xd70894['model']=_['keys'](db[_0x1eb5('0xdc')]['rawAttributes']);_0xd70894[_0x1eb5('0x39')]=_['keys'](_0x52e7b6[_0x1eb5('0x39')]);_0xd70894[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0xd70894[_0x1eb5('0xc3')],_0xd70894[_0x1eb5('0x39')]);_0x331348['attributes']=_[_0x1eb5('0xc7')](_0xd70894[_0x1eb5('0xc3')],qs['fields'](_0x52e7b6[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x331348[_0x1eb5('0x3d')]=_0x331348['attributes'][_0x1eb5('0x40')]?_0x331348['attributes']:_0xd70894[_0x1eb5('0xc3')];_0x331348[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x52e7b6[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x331348[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x52e7b6[_0x1eb5('0x39')],_0xd70894['filters']));if(_0x52e7b6[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x331348['where']=_[_0x1eb5('0x49')](_0x331348[_0x1eb5('0x37')],{'$or':_['map'](_0x331348[_0x1eb5('0x3d')],function(_0x1433de){var _0x1b3c0a={};_0x1b3c0a[_0x1433de]={'$like':'%'+_0x52e7b6[_0x1eb5('0x39')]['filter']+'%'};return _0x1b3c0a;})});}_0x331348=_[_0x1eb5('0x49')]({},_0x331348,_0x52e7b6[_0x1eb5('0x4a')]);return _0x4e5fef[_0x1eb5('0xdb')](_0x331348);}})[_0x1eb5('0x21')](function(_0x4e12c9){if(_0x4e12c9){_0x554b92=_0x4e12c9['length'];if(!_0x52e7b6[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x331348['limit']=qs[_0x1eb5('0x19')](_0x52e7b6['query'][_0x1eb5('0x19')]);_0x331348[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x52e7b6[_0x1eb5('0x39')][_0x1eb5('0x17')]);}return _0x4e5fef[_0x1eb5('0xdb')](_0x331348);}})['then'](function(_0x4da037){if(_0x4da037){return _0x4da037?{'count':_0x554b92,'rows':_0x4da037}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x442410,null))[_0x1eb5('0x4d')](handleError(_0x442410,null));};exports[_0x1eb5('0xdd')]=function(_0x247a13,_0x3b00cf){var _0x12c5b0={};var _0x2e6ab9={};var _0x168073;var _0x42825b;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x247a13[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x3b00cf,null))[_0x1eb5('0x21')](function(_0x5515f5){if(_0x5515f5){_0x168073=_0x5515f5;_0x2e6ab9[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db[_0x1eb5('0xde')][_0x1eb5('0xc6')]);_0x2e6ab9['query']=_[_0x1eb5('0xc4')](_0x247a13['query']);_0x2e6ab9['filters']=_[_0x1eb5('0xc7')](_0x2e6ab9[_0x1eb5('0xc3')],_0x2e6ab9[_0x1eb5('0x39')]);_0x12c5b0[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x2e6ab9[_0x1eb5('0xc3')],qs['fields'](_0x247a13['query'][_0x1eb5('0xc8')]));_0x12c5b0[_0x1eb5('0x3d')]=_0x12c5b0[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x12c5b0[_0x1eb5('0x3d')]:_0x2e6ab9[_0x1eb5('0xc3')];_0x12c5b0['order']=qs[_0x1eb5('0xd1')](_0x247a13[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x12c5b0[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_['pick'](_0x247a13[_0x1eb5('0x39')],_0x2e6ab9['filters']));if(_0x247a13[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x12c5b0['where']=_[_0x1eb5('0x49')](_0x12c5b0[_0x1eb5('0x37')],{'$or':_['map'](_0x12c5b0[_0x1eb5('0x3d')],function(_0x9582e8){var _0x464532={};_0x464532[_0x9582e8]={'$like':'%'+_0x247a13[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x464532;})});}_0x12c5b0=_['merge']({},_0x12c5b0,_0x247a13[_0x1eb5('0x4a')]);return _0x168073['getFaxInteractions'](_0x12c5b0);}})[_0x1eb5('0x21')](function(_0x3e4030){if(_0x3e4030){_0x42825b=_0x3e4030[_0x1eb5('0x40')];if(!_0x247a13[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x12c5b0[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x247a13['query'][_0x1eb5('0x19')]);_0x12c5b0['offset']=qs[_0x1eb5('0x17')](_0x247a13[_0x1eb5('0x39')]['offset']);}return _0x168073[_0x1eb5('0xdd')](_0x12c5b0);}})[_0x1eb5('0x21')](function(_0xa28458){if(_0xa28458){return _0xa28458?{'count':_0x42825b,'rows':_0xa28458}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x3b00cf,null))[_0x1eb5('0x4d')](handleError(_0x3b00cf,null));};exports[_0x1eb5('0xdf')]=function(_0x1056b8,_0x59a75c){var _0x19a2bf={};var _0x42f141={};var _0x547935;var _0x4f65b9;return db[_0x1eb5('0x2e')]['findOne']({'where':{'id':_0x1056b8[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x59a75c,null))[_0x1eb5('0x21')](function(_0x3fa9cd){if(_0x3fa9cd){_0x547935=_0x3fa9cd;_0x42f141[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db[_0x1eb5('0xe0')][_0x1eb5('0xc6')]);_0x42f141[_0x1eb5('0x39')]=_['keys'](_0x1056b8[_0x1eb5('0x39')]);_0x42f141[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x42f141[_0x1eb5('0xc3')],_0x42f141['query']);_0x19a2bf[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x42f141[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x1056b8[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x19a2bf[_0x1eb5('0x3d')]=_0x19a2bf[_0x1eb5('0x3d')]['length']?_0x19a2bf[_0x1eb5('0x3d')]:_0x42f141[_0x1eb5('0xc3')];_0x19a2bf['order']=qs[_0x1eb5('0xd1')](_0x1056b8[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x19a2bf[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x1056b8[_0x1eb5('0x39')],_0x42f141[_0x1eb5('0xcb')]));if(_0x1056b8['query'][_0x1eb5('0xcc')]){_0x19a2bf['where']=_['merge'](_0x19a2bf['where'],{'$or':_[_0x1eb5('0x28')](_0x19a2bf[_0x1eb5('0x3d')],function(_0x4ef248){var _0x22d11c={};_0x22d11c[_0x4ef248]={'$like':'%'+_0x1056b8[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x22d11c;})});}_0x19a2bf=_['merge']({},_0x19a2bf,_0x1056b8['options']);return _0x547935[_0x1eb5('0xdf')](_0x19a2bf);}})['then'](function(_0x27fdf7){if(_0x27fdf7){_0x4f65b9=_0x27fdf7[_0x1eb5('0x40')];if(!_0x1056b8[_0x1eb5('0x39')]['hasOwnProperty'](_0x1eb5('0xcf'))){_0x19a2bf[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x1056b8['query']['limit']);_0x19a2bf[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x1056b8[_0x1eb5('0x39')][_0x1eb5('0x17')]);}return _0x547935[_0x1eb5('0xdf')](_0x19a2bf);}})[_0x1eb5('0x21')](function(_0x179226){if(_0x179226){return _0x179226?{'count':_0x4f65b9,'rows':_0x179226}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x59a75c,null))['catch'](handleError(_0x59a75c,null));};exports[_0x1eb5('0xe1')]=function(_0x22374d,_0x5ab1f6,_0x4eeff1){var _0x24b4bd;var _0x9d08ad;var _0x429ed8;var _0x5bc67e=!_[_0x1eb5('0x56')](_0x22374d[_0x1eb5('0x47')]['id'])?_0x22374d[_0x1eb5('0x47')]['id']:!_['isNil'](_0x22374d[_0x1eb5('0x6f')]['id'])?_0x22374d[_0x1eb5('0x6f')]['id']:null;return db['User']['find']({'where':{'id':_0x5bc67e,'role':{'$or':['admin','user','agent']}},'attributes':['id',_0x1eb5('0x2c'),'phone','mobile','role',_0x1eb5('0x55'),_0x1eb5('0xe2')]})[_0x1eb5('0x21')](function(_0x433de0){if(_0x433de0){if(_0x433de0[_0x1eb5('0x1c')]==='agent'){_0x24b4bd=_0x433de0;if(_0x22374d[_0x1eb5('0x4e')]['interface']){_0x429ed8=util[_0x1eb5('0x9c')]('LOCAL/%s@from-sip/n',_0x24b4bd[_0x22374d[_0x1eb5('0x4e')]['interface']]);}else if(_0x22374d[_0x1eb5('0x4e')]['intrf']){_0x429ed8=util[_0x1eb5('0x9c')](_0x1eb5('0xe3'),_0x22374d[_0x1eb5('0x4e')][_0x1eb5('0xe4')]);}else{_0x429ed8=util[_0x1eb5('0x9c')](_0x1eb5('0xe3'),_0x24b4bd[_0x1eb5('0x2c')]);}socket['to'](util[_0x1eb5('0x9c')](_0x1eb5('0xe5'),_0x24b4bd[_0x1eb5('0x2c')]))[_0x1eb5('0x1e')]('user:forcelogout',{'user':{'id':_0x24b4bd['id'],'name':_0x24b4bd[_0x1eb5('0x2c')]},'ip':_0x22374d[_0x1eb5('0xe6')][_0x1eb5('0xe7')]||_0x22374d['connection']['remoteAddress']||_0x22374d[_0x1eb5('0xe8')]['remoteAddress']||_0x22374d[_0x1eb5('0xe9')][_0x1eb5('0xe8')][_0x1eb5('0xea')]});return db[_0x1eb5('0x9f')]['destroy']({'where':{'membername':_0x24b4bd[_0x1eb5('0x2c')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x1eb5('0x82'))](_0x1eb5('0xeb'));}})[_0x1eb5('0x21')](function(){if(_0x24b4bd){return _0x24b4bd['getVoiceQueues']({'raw':!![]});}})[_0x1eb5('0x21')](function(_0x1027f0){if(_0x24b4bd){if(_0x1027f0){_0x9d08ad=_0x1027f0;if(_0x9d08ad[_0x1eb5('0x40')]){var _0x2e3879=_0x9d08ad['map'](function(_0x3198ce){var _0xb89a6a={'membername':_0x24b4bd[_0x1eb5('0x2c')],'UserId':_0x24b4bd['id'],'queue_name':_0x3198ce[_0x1eb5('0x2c')],'VoiceQueueId':_0x3198ce['id'],'interface':_0x429ed8,'paused':_0x24b4bd['loginInPause']||![],'penalty':_0x3198ce[_0x1eb5('0xec')]||0x0};return db[_0x1eb5('0x9f')][_0x1eb5('0xa0')](_0xb89a6a);});return Promise[_0x1eb5('0x46')](_0x2e3879);}}}})['then'](function(){if(_0x24b4bd){return db[_0x1eb5('0xed')][_0x1eb5('0x9b')]({'where':{'membername':_0x24b4bd[_0x1eb5('0x2c')],'exitAt':null}});}})[_0x1eb5('0x21')](function(_0x5e9b41){if(_0x24b4bd){var _0x24bb08=[];_0x5e9b41[_0x1eb5('0xee')](function(_0x4d531d){_0x24bb08[_0x1eb5('0x3e')](_0x4d531d[_0x1eb5('0x1b')]({'exitAt':moment()[_0x1eb5('0x9c')](_0x1eb5('0xef'))}));});return Promise[_0x1eb5('0x46')](_0x24bb08);}})[_0x1eb5('0x21')](function(){if(_0x24b4bd){var _0x5042ed=[];var _0x4317f6=[];var _0x1a1acc=utils['getChannels']();var _0x141888={'membername':_0x24b4bd[_0x1eb5('0x2c')],'interface':_0x429ed8,'enterAt':moment()[_0x1eb5('0x9c')](_0x1eb5('0xef')),'role':_0x24b4bd['role'],'internal':_0x24b4bd[_0x1eb5('0x55')]};_0x1a1acc['forEach'](function(_0x26a4d4){_0x5042ed['push'](_[_0x1eb5('0x49')]({'channel':_0x26a4d4,'type':_0x1eb5('0xf0'),'data1':_0x22374d['body'][_0x1eb5('0xf1')],'data2':_0x429ed8},_0x141888));if(_0x24b4bd[_0x1eb5('0xe2')]){_0x4317f6[_0x1eb5('0x3e')](_['merge']({'channel':_0x26a4d4,'type':_0x1eb5('0xf2'),'data1':_0x1eb5('0xf3')},_0x141888));}});return db['MemberReport'][_0x1eb5('0xf4')](_0x5042ed[_0x1eb5('0xbb')](_0x4317f6),{'individualHooks':!![]});}})[_0x1eb5('0x21')](function(){if(_0x24b4bd){return _0x24b4bd[_0x1eb5('0x1b')]({'online':!![],'lastLoginAt':moment()[_0x1eb5('0x9c')](_0x1eb5('0xef')),'voicePause':_0x24b4bd[_0x1eb5('0xe2')]||![],'mailPause':_0x24b4bd[_0x1eb5('0xe2')]||![],'chatPause':_0x24b4bd[_0x1eb5('0xe2')]||![],'faxPause':_0x24b4bd[_0x1eb5('0xe2')]||![],'smsPause':_0x24b4bd[_0x1eb5('0xe2')]||![],'openchannelPause':_0x24b4bd[_0x1eb5('0xe2')]||![],'whatsappPause':_0x24b4bd[_0x1eb5('0xe2')]||![],'pauseType':_0x24b4bd['loginInPause']?_0x1eb5('0xf3'):null,'interface':_0x429ed8,'lastPauseAt':moment()[_0x1eb5('0x9c')](_0x1eb5('0xef'))});}})[_0x1eb5('0x21')](function(_0x17589b){if(_0x22374d['isMiddleware']){return _0x4eeff1();}else{return Promise[_0x1eb5('0xf5')](_0x17589b)['then'](respondWithResult(_0x5ab1f6,null));}})[_0x1eb5('0x4d')](handleError(_0x5ab1f6,null));};exports['logout']=function(_0x3c4de6,_0x16503c){var _0x56093f;return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x3c4de6[_0x1eb5('0x47')]['id'],'role':_0x1eb5('0x1d')},'attributes':['id',_0x1eb5('0x2c'),_0x1eb5('0x1c')]})['then'](handleEntityNotFound(_0x16503c,null))['then'](function(_0x366325){if(_0x366325){_0x56093f=_0x366325;return db[_0x1eb5('0x9f')][_0x1eb5('0x20')]({'where':{'membername':_0x56093f[_0x1eb5('0x2c')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport'][_0x1eb5('0x9b')]({'where':{'membername':_0x56093f[_0x1eb5('0x2c')],'exitAt':null}});})[_0x1eb5('0x21')](function(_0x2379c6){var _0x10f71d=[];_0x2379c6[_0x1eb5('0xee')](function(_0x5d67ca){_0x10f71d[_0x1eb5('0x3e')](_0x5d67ca[_0x1eb5('0x1b')]({'exitAt':moment()[_0x1eb5('0x9c')](_0x1eb5('0xef'))}));});return Promise[_0x1eb5('0x46')](_0x10f71d);})['then'](function(){return _0x56093f[_0x1eb5('0x1b')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x16503c,null))[_0x1eb5('0x4d')](handleError(_0x16503c,null));};exports[_0x1eb5('0xf6')]=function(_0x272074,_0x80313c){var _0x3853aa;return db[_0x1eb5('0x9f')][_0x1eb5('0x1b')]({'paused':0x1},{'where':{'UserId':_0x272074['params']['id']},'individualHooks':!![]})[_0x1eb5('0x21')](function(){return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x272074[_0x1eb5('0x47')]['id'],'role':_0x1eb5('0x1d')},'attributes':['id',_0x1eb5('0x2c'),'role','internal',_0x1eb5('0x9d'),_0x1eb5('0x92')]});})[_0x1eb5('0x21')](handleEntityNotFound(_0x80313c,null))[_0x1eb5('0x21')](function(_0x15526c){if(_0x15526c){_0x3853aa=_0x15526c;return db['MemberReport'][_0x1eb5('0x9b')]({'where':{'membername':_0x3853aa['name'],'type':_0x1eb5('0xf2'),'exitAt':null}});}})['then'](function(_0x136662){if(_0x136662[_0x1eb5('0x40')]){var _0x5ac80e=moment()[_0x1eb5('0x9c')](_0x1eb5('0xef'));for(var _0x1e2d9a=0x0,_0x2c9f15=_0x136662[_0x1eb5('0x40')];_0x1e2d9a<_0x2c9f15;_0x1e2d9a++){_0x136662[_0x1e2d9a]['updateAttributes']({'exitAt':_0x5ac80e});}}})[_0x1eb5('0x21')](function(){var _0x3b5e8f=[];var _0x5f1fc6=utils[_0x1eb5('0xf7')]();_0x5f1fc6['forEach'](function(_0x14680f){_0x3b5e8f[_0x1eb5('0x3e')]({'channel':_0x14680f,'membername':_0x3853aa[_0x1eb5('0x2c')],'interface':_[_0x1eb5('0x56')](_0x3853aa[_0x1eb5('0x9d')])?util[_0x1eb5('0x9c')](_0x1eb5('0xe3'),_0x3853aa[_0x1eb5('0x2c')]):_0x3853aa['interface'],'type':_0x1eb5('0xf2'),'enterAt':moment()[_0x1eb5('0x9c')](_0x1eb5('0xef')),'data1':_0x272074['body'][_0x1eb5('0x30')]||_0x1eb5('0xf8'),'role':_0x3853aa[_0x1eb5('0x1c')],'internal':_0x3853aa[_0x1eb5('0x55')]});});return db[_0x1eb5('0xed')][_0x1eb5('0xf4')](_0x3b5e8f,{'individualHooks':!![]});})[_0x1eb5('0x21')](function(){return _0x3853aa['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x272074[_0x1eb5('0x4e')][_0x1eb5('0x30')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x80313c,null))[_0x1eb5('0x4d')](handleError(_0x80313c,null));};exports[_0x1eb5('0xf9')]=function(_0x36a749,_0x4860d4){if(_0x36a749[_0x1eb5('0x4e')][_0x1eb5('0x91')]&&!utils[_0x1eb5('0xa2')](_0x36a749['body']['channel'])){throw new APIBadRequestError(util['format'](_0x1eb5('0xfa'),_0x36a749[_0x1eb5('0x4e')][_0x1eb5('0x91')]));}return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0x36a749['params']['id']},'attributes':['id',_0x1eb5('0x2c'),_0x1eb5('0x1c'),_0x1eb5('0x55'),_0x1eb5('0x9d'),'online','voicePause',_0x1eb5('0xfb'),_0x1eb5('0xfc'),_0x1eb5('0xfd'),_0x1eb5('0xfe'),_0x1eb5('0xff'),_0x1eb5('0x100'),'pauseType','lastPauseAt']})[_0x1eb5('0x21')](function(_0x3b941f){if(!_0x3b941f){throw new APINotFoundError(util[_0x1eb5('0x9c')](_0x1eb5('0xbc'),_0x36a749['params']['id']));}return _0x3b941f['unpause'](_0x36a749[_0x1eb5('0x4e')][_0x1eb5('0x91')]);})[_0x1eb5('0x21')](respondWithResult(_0x4860d4,null))[_0x1eb5('0x4d')](APIHandleError(_0x4860d4));};exports[_0x1eb5('0x101')]=function(_0x1ea6f7,_0x1e49fe){var _0x2d9826={};var _0x119fa3={};var _0x177197;var _0xfcd33c;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x1ea6f7[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e49fe,null))[_0x1eb5('0x21')](function(_0x482b20){if(_0x482b20){_0x177197=_0x482b20;_0x119fa3[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db[_0x1eb5('0x102')][_0x1eb5('0xc6')]);_0x119fa3['query']=_['keys'](_0x1ea6f7[_0x1eb5('0x39')]);_0x119fa3['filters']=_[_0x1eb5('0xc7')](_0x119fa3[_0x1eb5('0xc3')],_0x119fa3[_0x1eb5('0x39')]);_0x2d9826[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x119fa3[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x1ea6f7[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x2d9826[_0x1eb5('0x3d')]=_0x2d9826[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x2d9826[_0x1eb5('0x3d')]:_0x119fa3[_0x1eb5('0xc3')];_0x2d9826[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x1ea6f7[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x2d9826[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_['pick'](_0x1ea6f7['query'],_0x119fa3['filters']));if(_0x1ea6f7[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x2d9826[_0x1eb5('0x37')]=_[_0x1eb5('0x49')](_0x2d9826[_0x1eb5('0x37')],{'$or':_['map'](_0x2d9826[_0x1eb5('0x3d')],function(_0x234d68){var _0x476497={};_0x476497[_0x234d68]={'$like':'%'+_0x1ea6f7['query'][_0x1eb5('0xcc')]+'%'};return _0x476497;})});}_0x2d9826=_[_0x1eb5('0x49')]({},_0x2d9826,_0x1ea6f7['options']);return _0x177197[_0x1eb5('0x101')](_0x2d9826);}})[_0x1eb5('0x21')](function(_0x134e01){if(_0x134e01){_0xfcd33c=_0x134e01[_0x1eb5('0x40')];if(!_0x1ea6f7[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x2d9826[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x1ea6f7['query'][_0x1eb5('0x19')]);_0x2d9826[_0x1eb5('0x17')]=qs['offset'](_0x1ea6f7[_0x1eb5('0x39')]['offset']);}return _0x177197[_0x1eb5('0x101')](_0x2d9826);}})[_0x1eb5('0x21')](function(_0x404e6d){if(_0x404e6d){return _0x404e6d?{'count':_0xfcd33c,'rows':_0x404e6d}:null;}})['then'](respondWithResult(_0x1e49fe,null))[_0x1eb5('0x4d')](handleError(_0x1e49fe,null));};exports[_0x1eb5('0x103')]=function(_0x14ced0,_0x1e14b8){var _0x1f6d09=_0x14ced0['params']['id'];var _0x5f36d0=_0x14ced0[_0x1eb5('0x4e')]?_0x14ced0['body']['ids']:null;var _0xe982eb=[];return Promise[_0x1eb5('0xf5')]()['then'](function(){if(!_0x5f36d0)throw new APIBadRequestError(_0x1eb5('0x104'));})[_0x1eb5('0x21')](function(){return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x1f6d09}});})[_0x1eb5('0x21')](function(_0x3c3dbe){if(!_0x3c3dbe)throw new APINotFoundError(util[_0x1eb5('0x9c')]('User\x20with\x20id\x20%s\x20not\x20found',_0x14ced0[_0x1eb5('0x47')]['id']));return db[_0x1eb5('0x58')][_0x1eb5('0x105')](function(_0x413e1d){return _0x3c3dbe[_0x1eb5('0x103')](_0x5f36d0,{'transaction':_0x413e1d})[_0x1eb5('0x21')](function(){return db['Team'][_0x1eb5('0x9b')]({'where':{'id':{'$in':_0x5f36d0}}});})[_0x1eb5('0x21')](function(_0x28c79b){var _0x2fe5aa=_['map'](_0x28c79b,function(_0x2a34a1){return _0x2a34a1[_0x1eb5('0x106')]();});return Promise[_0x1eb5('0x46')](_0x2fe5aa);})[_0x1eb5('0x21')](function(_0x2ab7a0){_0xe982eb=_[_0x1eb5('0x107')](_0x2ab7a0);var _0x502516=_[_0x1eb5('0x28')](_0xe982eb,function(_0x294ae5){return _0x294ae5[_0x1eb5('0x108')](_0x3c3dbe['id'],{'transaction':_0x413e1d});});return Promise[_0x1eb5('0x46')](_0x502516);})[_0x1eb5('0x21')](function(){if(!_0x3c3dbe['online'])return;var _0x20f6b3=_[_0x1eb5('0xcc')](_0xe982eb,function(_0x3e87a8){return _0x3e87a8[_0x1eb5('0x109')](_0x1eb5('0x91'))===_0x1eb5('0x10a');});var _0x6f7cad=_[_0x1eb5('0x28')](_0x20f6b3,function(_0x287378){return db[_0x1eb5('0x9f')][_0x1eb5('0xa0')]({'membername':_0x3c3dbe[_0x1eb5('0x2c')],'UserId':_0x3c3dbe['id'],'queue_name':_0x287378[_0x1eb5('0x2c')],'VoiceQueueId':_0x287378['id'],'interface':_[_0x1eb5('0x56')](_0x3c3dbe[_0x1eb5('0x9d')])?util[_0x1eb5('0x9c')](_0x1eb5('0xe3'),_0x3c3dbe['name']):_0x3c3dbe[_0x1eb5('0x9d')],'paused':_0x3c3dbe[_0x1eb5('0x9e')]||![],'penalty':_0x3c3dbe[_0x1eb5('0x96')]},{'transaction':_0x413e1d});});return Promise[_0x1eb5('0x46')](_0x6f7cad);})[_0x1eb5('0x21')](function(){return db[_0x1eb5('0x10b')]['findAll']({'where':{'teamId':{'$in':_0x5f36d0}}});})['then'](function(_0x4d95f4){var _0x1aaf0c=_[_0x1eb5('0x28')](_0x4d95f4,function(_0x39be3c){return db[_0x1eb5('0x10c')][_0x1eb5('0x75')]({'UserId':_0x3c3dbe['id'],'VoicePrefixId':_0x39be3c[_0x1eb5('0x10d')]},{'transaction':_0x413e1d});});return Promise[_0x1eb5('0x46')](_0x1aaf0c);});});})['then'](function(){for(var _0x38b546=0x0;_0x38b546<_0xe982eb[_0x1eb5('0x40')];_0x38b546++){var _0x1a8dac=_0xe982eb[_0x38b546][_0x1eb5('0x109')](_0x1eb5('0x91'));var _0x7f8422=_0x1a8dac+_0x1eb5('0xa6');socket['emit']('user'+_0x1a8dac+_0x1eb5('0x10e'),{'UserId':_0x1f6d09,['queueField']:_0xe982eb[_0x38b546]['id']});}})[_0x1eb5('0x21')](respondWithStatusCode(_0x1e14b8,null))[_0x1eb5('0x4d')](APIHandleError(_0x1e14b8));};exports[_0x1eb5('0x10f')]=function(_0x3aca19,_0x6133be){var _0x5d12eb=_0x3aca19[_0x1eb5('0x47')]['id'];var _0x54a66f=null;if(_0x3aca19['query'][_0x1eb5('0x51')]){_0x54a66f=_['isArray'](_0x3aca19[_0x1eb5('0x39')]['ids'])?_0x3aca19[_0x1eb5('0x39')][_0x1eb5('0x51')]:[_0x3aca19[_0x1eb5('0x39')][_0x1eb5('0x51')]];}var _0x1636d8=[];return Promise['resolve']()['then'](function(){if(!_0x54a66f)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0x1eb5('0x2e')]['findOne']({'where':{'id':_0x5d12eb}});})[_0x1eb5('0x21')](function(_0x52982b){if(!_0x52982b)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x3aca19['params']['id']));return db[_0x1eb5('0x58')][_0x1eb5('0x105')](function(_0x3e9c83){return _0x52982b['removeTeams'](_0x54a66f,{'transaction':_0x3e9c83})[_0x1eb5('0x21')](function(){return db[_0x1eb5('0x102')][_0x1eb5('0x9b')]({'where':{'id':{'$in':_0x54a66f}}});})[_0x1eb5('0x21')](function(_0x2719c0){var _0x4b1d6c=_[_0x1eb5('0x28')](_0x2719c0,function(_0x3feb5b){return _0x3feb5b['getAssociatedQueues']();});return Promise[_0x1eb5('0x46')](_0x4b1d6c);})[_0x1eb5('0x21')](function(_0x3494aa){_0x1636d8=_['flattenDeep'](_0x3494aa);var _0x7afb9d=_['map'](_0x1636d8,function(_0x1a8946){return _0x1a8946[_0x1eb5('0x110')](_0x52982b['id'],{'transaction':_0x3e9c83});});return Promise[_0x1eb5('0x46')](_0x7afb9d);})[_0x1eb5('0x21')](function(){if(!_0x52982b[_0x1eb5('0x92')])return;var _0x43885a=_[_0x1eb5('0xcc')](_0x1636d8,function(_0x325d94){return _0x325d94[_0x1eb5('0x109')](_0x1eb5('0x91'))===_0x1eb5('0x10a');});var _0x1a74c6=_[_0x1eb5('0x28')](_0x43885a,function(_0x247f1a){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x247f1a['id'],'UserId':_0x52982b['id']},'transaction':_0x3e9c83});});return Promise[_0x1eb5('0x46')](_0x1a74c6);})[_0x1eb5('0x21')](function(){return db['TeamVoicePrefix'][_0x1eb5('0x9b')]({'where':{'teamId':{'$in':_0x54a66f}}});})[_0x1eb5('0x21')](function(_0xbcffa3){var _0x47929a=_[_0x1eb5('0x28')](_0xbcffa3,function(_0x49f2f4){return db['UserVoicePrefix'][_0x1eb5('0x20')]({'where':{'UserId':_0x52982b['id'],'VoicePrefixId':_0x49f2f4[_0x1eb5('0x10d')]}},{'transaction':_0x3e9c83});});return Promise[_0x1eb5('0x46')](_0x47929a);});});})[_0x1eb5('0x21')](function(){for(var _0xf30857=0x0;_0xf30857<_0x1636d8[_0x1eb5('0x40')];_0xf30857++){var _0x10ba3a=_0x1636d8[_0xf30857][_0x1eb5('0x109')](_0x1eb5('0x91'));var _0x3a768e=_0x10ba3a+'QueueId';socket[_0x1eb5('0x1e')](_0x1eb5('0x6f')+_0x10ba3a+_0x1eb5('0xa5'),{'UserId':_0x5d12eb,['queueField']:_0x1636d8[_0xf30857]['id']});}})[_0x1eb5('0x21')](respondWithStatusCode(_0x6133be,null))[_0x1eb5('0x4d')](APIHandleError(_0x6133be));};exports[_0x1eb5('0x111')]=function(_0x1a17ac,_0x5c6b3e){var _0x3858e5={};var _0x5c8a34={};var _0x2ada86;var _0x1a70dc;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x1a17ac[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x5c6b3e,null))[_0x1eb5('0x21')](function(_0x5b86ae){if(_0x5b86ae){_0x2ada86=_0x5b86ae;_0x5c8a34[_0x1eb5('0xc3')]=_['keys'](db[_0x1eb5('0xbe')]['rawAttributes']);_0x5c8a34['query']=_[_0x1eb5('0xc4')](_0x1a17ac[_0x1eb5('0x39')]);_0x5c8a34[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x5c8a34[_0x1eb5('0xc3')],_0x5c8a34[_0x1eb5('0x39')]);_0x3858e5[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x5c8a34[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x1a17ac[_0x1eb5('0x39')]['fields']));_0x3858e5[_0x1eb5('0x3d')]=_0x3858e5[_0x1eb5('0x3d')]['length']?_0x3858e5['attributes']:_0x5c8a34['model'];_0x3858e5[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x1a17ac[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x3858e5['where']=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x1a17ac[_0x1eb5('0x39')],_0x5c8a34[_0x1eb5('0xcb')]));if(_0x1a17ac[_0x1eb5('0x39')]['filter']){_0x3858e5[_0x1eb5('0x37')]=_[_0x1eb5('0x49')](_0x3858e5[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x3858e5[_0x1eb5('0x3d')],function(_0x4791e2){var _0x3df527={};_0x3df527[_0x4791e2]={'$like':'%'+_0x1a17ac[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x3df527;})});}_0x3858e5=_[_0x1eb5('0x49')]({},_0x3858e5,_0x1a17ac[_0x1eb5('0x4a')]);return _0x2ada86[_0x1eb5('0x111')](_0x3858e5);}})[_0x1eb5('0x21')](function(_0x2dc1e5){if(_0x2dc1e5){_0x1a70dc=_0x2dc1e5[_0x1eb5('0x40')];if(!_0x1a17ac[_0x1eb5('0x39')]['hasOwnProperty'](_0x1eb5('0xcf'))){_0x3858e5['limit']=qs[_0x1eb5('0x19')](_0x1a17ac[_0x1eb5('0x39')]['limit']);_0x3858e5[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x1a17ac[_0x1eb5('0x39')][_0x1eb5('0x17')]);}return _0x2ada86[_0x1eb5('0x111')](_0x3858e5);}})[_0x1eb5('0x21')](function(_0x2ccb62){if(_0x2ccb62){return _0x2ccb62?{'count':_0x1a70dc,'rows':_0x2ccb62}:null;}})['then'](respondWithResult(_0x5c6b3e,null))['catch'](handleError(_0x5c6b3e,null));};exports[_0x1eb5('0x112')]=function(_0x5e4ec8,_0x4f78f9){var _0x2fa407={};var _0x2c9d90={};var _0x2b9327;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x5e4ec8[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x4f78f9,null))[_0x1eb5('0x21')](function(_0x5da185){if(_0x5da185){_0x2b9327=_0x5da185;_0x2c9d90[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db['User'][_0x1eb5('0xc6')]);_0x2c9d90[_0x1eb5('0x39')]=_[_0x1eb5('0xc4')](_0x5e4ec8[_0x1eb5('0x39')]);_0x2c9d90[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x2c9d90[_0x1eb5('0xc3')],_0x2c9d90['query']);_0x2fa407[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x2c9d90[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x5e4ec8['query'][_0x1eb5('0xc8')]));_0x2fa407[_0x1eb5('0x3d')]=_0x2fa407[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x2fa407[_0x1eb5('0x3d')]:_0x2c9d90[_0x1eb5('0xc3')];_0x2fa407[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x5e4ec8[_0x1eb5('0x39')]['sort']);_0x2fa407[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x5e4ec8[_0x1eb5('0x39')],_0x2c9d90['filters']));if(_0x5e4ec8[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x2fa407[_0x1eb5('0x37')]=_['merge'](_0x2fa407[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x2fa407[_0x1eb5('0x3d')],function(_0x2eee7c){var _0x1fe923={};_0x1fe923[_0x2eee7c]={'$like':'%'+_0x5e4ec8[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x1fe923;})});}_0x2fa407[_0x1eb5('0xc3')]=db['User'];_0x2fa407['as']=_0x1eb5('0x25');_0x2fa407=_[_0x1eb5('0x49')]({},_0x2fa407,_0x5e4ec8[_0x1eb5('0x4a')]);return _0x2b9327[_0x1eb5('0x113')]({'include':[_0x2fa407]});}})[_0x1eb5('0x21')](function(_0x37413e){if(_0x37413e){var _0x168fab={},_0x5c9a96=[];for(var _0x2eb2a8=0x0;_0x2eb2a8<_0x37413e['length'];_0x2eb2a8+=0x1){for(var _0x2f622f=0x0,_0x403620;_0x2f622f<_0x37413e[_0x2eb2a8][_0x1eb5('0x25')][_0x1eb5('0x40')];_0x2f622f+=0x1){_0x403620=_0x37413e[_0x2eb2a8]['Agents'][_0x2f622f][_0x1eb5('0x22')]({'plain':!![]});_0x168fab[_0x403620['id']]=_0x403620;}}_0x168fab=_[_0x1eb5('0x114')](_0x168fab);for(var _0x41ea13=qs['offset'](_0x5e4ec8[_0x1eb5('0x39')]['offset']);_0x41ea13<_0x168fab[_0x1eb5('0x40')]&&_0x5c9a96['length']<qs[_0x1eb5('0x19')](_0x5e4ec8['query'][_0x1eb5('0x19')]);_0x41ea13+=0x1){if(_0x168fab[_0x41ea13]){_0x5c9a96['push'](_0x168fab[_0x41ea13]);}}return{'count':_0x168fab[_0x1eb5('0x40')],'rows':_0x5c9a96};}})['then'](respondWithResult(_0x4f78f9,null))[_0x1eb5('0x4d')](handleError(_0x4f78f9,null));};exports['destroy']=function(_0x5b430e,_0x229fad){if(_0x5b430e['user']['id']==_0x5b430e[_0x1eb5('0x47')]['id']){return _0x229fad[_0x1eb5('0x14')](0x1f4)['send']({'message':_0x1eb5('0x115')});}return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x5b430e['params']['id']}})['then'](handleEntityNotFound(_0x229fad,null))[_0x1eb5('0x21')](removeEntity(_0x229fad,null))[_0x1eb5('0x4d')](handleError(_0x229fad,null));};exports[_0x1eb5('0x116')]=function(_0x3443f6,_0x47f2b5){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x3443f6[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x47f2b5,null))[_0x1eb5('0x21')](function(_0x3f22d3){if(_0x3f22d3){return _0x3f22d3[_0x1eb5('0x116')](_0x3443f6[_0x1eb5('0x4e')][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0x3443f6[_0x1eb5('0x4e')],[_0x1eb5('0x51'),'id'])||{})[_0x1eb5('0x97')](function(){for(var _0x550778=0x0;_0x550778<_0x3443f6[_0x1eb5('0x4e')][_0x1eb5('0x51')][_0x1eb5('0x40')];_0x550778+=0x1){socket['emit'](_0x1eb5('0x117'),{'ChatInteractionId':Number(_0x3443f6[_0x1eb5('0x4e')]['ids'][_0x550778]),'UserId':Number(_0x3443f6[_0x1eb5('0x47')]['id'])});}return _0x3443f6[_0x1eb5('0x4e')][_0x1eb5('0x51')];});}})[_0x1eb5('0x21')](respondWithResult(_0x47f2b5,null))['catch'](handleError(_0x47f2b5,null));};exports[_0x1eb5('0x118')]=function(_0x18be23,_0x39ba6c){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0x18be23[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x39ba6c,null))[_0x1eb5('0x21')](function(_0x325073){if(_0x325073){return _0x325073[_0x1eb5('0x118')](_0x18be23[_0x1eb5('0x39')][_0x1eb5('0x51')])[_0x1eb5('0x21')](function(){if(_[_0x1eb5('0xa4')](_0x18be23[_0x1eb5('0x39')]['ids'])){for(var _0x5838f2=0x0;_0x5838f2<_0x18be23[_0x1eb5('0x39')]['ids'][_0x1eb5('0x40')];_0x5838f2+=0x1){socket[_0x1eb5('0x1e')](_0x1eb5('0x119'),{'ChatInteractionId':Number(_0x18be23[_0x1eb5('0x39')][_0x1eb5('0x51')][_0x5838f2]),'UserId':Number(_0x18be23[_0x1eb5('0x47')]['id'])});}}else{socket['emit'](_0x1eb5('0x119'),{'ChatInteractionId':Number(_0x18be23[_0x1eb5('0x39')][_0x1eb5('0x51')]),'UserId':Number(_0x18be23[_0x1eb5('0x47')]['id'])});}});}})[_0x1eb5('0x21')](respondWithStatusCode(_0x39ba6c,null))['catch'](handleError(_0x39ba6c,null));};exports[_0x1eb5('0x11a')]=function(_0x198b91,_0x1fdfed){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0x198b91['params']['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x1fdfed,null))[_0x1eb5('0x21')](function(_0x13d5db){if(_0x13d5db){return _0x13d5db['addMailInteractions'](_0x198b91[_0x1eb5('0x4e')][_0x1eb5('0x51')],_['omit'](_0x198b91['body'],[_0x1eb5('0x51'),'id'])||{})[_0x1eb5('0x97')](function(){for(var _0x2951a2=0x0;_0x2951a2<_0x198b91[_0x1eb5('0x4e')][_0x1eb5('0x51')]['length'];_0x2951a2+=0x1){socket[_0x1eb5('0x1e')](_0x1eb5('0x11b'),{'MailInteractionId':Number(_0x198b91['body']['ids'][_0x2951a2]),'UserId':Number(_0x198b91[_0x1eb5('0x47')]['id'])});}return _0x198b91['body'][_0x1eb5('0x51')];});}})[_0x1eb5('0x21')](respondWithResult(_0x1fdfed,null))[_0x1eb5('0x4d')](handleError(_0x1fdfed,null));};exports[_0x1eb5('0x11c')]=function(_0x303699,_0x5f523a){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0x303699[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x5f523a,null))[_0x1eb5('0x21')](function(_0xb40b8){if(_0xb40b8){return _0xb40b8['removeMailInteractions'](_0x303699[_0x1eb5('0x39')][_0x1eb5('0x51')])[_0x1eb5('0x21')](function(){if(_[_0x1eb5('0xa4')](_0x303699[_0x1eb5('0x39')][_0x1eb5('0x51')])){for(var _0x203fab=0x0;_0x203fab<_0x303699['query'][_0x1eb5('0x51')][_0x1eb5('0x40')];_0x203fab+=0x1){socket[_0x1eb5('0x1e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x303699[_0x1eb5('0x39')][_0x1eb5('0x51')][_0x203fab]),'UserId':Number(_0x303699[_0x1eb5('0x47')]['id'])});}}else{socket[_0x1eb5('0x1e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x303699[_0x1eb5('0x39')][_0x1eb5('0x51')]),'UserId':Number(_0x303699[_0x1eb5('0x47')]['id'])});}});}})[_0x1eb5('0x21')](respondWithStatusCode(_0x5f523a,null))[_0x1eb5('0x4d')](handleError(_0x5f523a,null));};exports[_0x1eb5('0x11d')]=function(_0x572ca7,_0x51416e){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x572ca7[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x51416e,null))['then'](function(_0x3e2c09){if(_0x3e2c09){return _0x3e2c09[_0x1eb5('0x11d')](_0x572ca7[_0x1eb5('0x4e')]['ids'],_['omit'](_0x572ca7[_0x1eb5('0x4e')],['ids','id'])||{})[_0x1eb5('0x97')](function(){for(var _0x4bc243=0x0;_0x4bc243<_0x572ca7[_0x1eb5('0x4e')][_0x1eb5('0x51')][_0x1eb5('0x40')];_0x4bc243+=0x1){socket['emit'](_0x1eb5('0x11e'),{'FaxInteractionId':Number(_0x572ca7['body']['ids'][_0x4bc243]),'UserId':Number(_0x572ca7['params']['id'])});}return _0x572ca7[_0x1eb5('0x4e')]['ids'];});}})[_0x1eb5('0x21')](respondWithResult(_0x51416e,null))['catch'](handleError(_0x51416e,null));};exports[_0x1eb5('0x11f')]=function(_0x2c021e,_0x2ddd81){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0x2c021e['params']['id']}})['then'](handleEntityNotFound(_0x2ddd81,null))['then'](function(_0x359163){if(_0x359163){return _0x359163['removeFaxInteractions'](_0x2c021e[_0x1eb5('0x39')][_0x1eb5('0x51')])[_0x1eb5('0x21')](function(){if(_[_0x1eb5('0xa4')](_0x2c021e[_0x1eb5('0x39')][_0x1eb5('0x51')])){for(var _0x22996d=0x0;_0x22996d<_0x2c021e[_0x1eb5('0x39')][_0x1eb5('0x51')][_0x1eb5('0x40')];_0x22996d+=0x1){socket[_0x1eb5('0x1e')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x2c021e['query'][_0x1eb5('0x51')][_0x22996d]),'UserId':Number(_0x2c021e[_0x1eb5('0x47')]['id'])});}}else{socket[_0x1eb5('0x1e')](_0x1eb5('0x120'),{'FaxInteractionId':Number(_0x2c021e[_0x1eb5('0x39')][_0x1eb5('0x51')]),'UserId':Number(_0x2c021e[_0x1eb5('0x47')]['id'])});}});}})[_0x1eb5('0x21')](respondWithStatusCode(_0x2ddd81,null))[_0x1eb5('0x4d')](handleError(_0x2ddd81,null));};exports[_0x1eb5('0x121')]=function(_0x25a8a9,_0x3186fe){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x25a8a9[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x3186fe,null))['then'](function(_0x19d23d){if(_0x19d23d){return _0x19d23d[_0x1eb5('0x121')](_0x25a8a9[_0x1eb5('0x4e')][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0x25a8a9['body'],['ids','id'])||{})[_0x1eb5('0x97')](function(){for(var _0x17b8b2=0x0;_0x17b8b2<_0x25a8a9['body'][_0x1eb5('0x51')][_0x1eb5('0x40')];_0x17b8b2+=0x1){socket[_0x1eb5('0x1e')](_0x1eb5('0x122'),{'SmsInteractionId':Number(_0x25a8a9['body']['ids'][_0x17b8b2]),'UserId':Number(_0x25a8a9[_0x1eb5('0x47')]['id'])});}return _0x25a8a9[_0x1eb5('0x4e')]['ids'];});}})[_0x1eb5('0x21')](respondWithResult(_0x3186fe,null))[_0x1eb5('0x4d')](handleError(_0x3186fe,null));};exports['removeSmsInteractions']=function(_0xef52e2,_0x5050bf){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0xef52e2[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x5050bf,null))[_0x1eb5('0x21')](function(_0x369f73){if(_0x369f73){return _0x369f73[_0x1eb5('0x123')](_0xef52e2['query'][_0x1eb5('0x51')])[_0x1eb5('0x21')](function(){if(_[_0x1eb5('0xa4')](_0xef52e2[_0x1eb5('0x39')][_0x1eb5('0x51')])){for(var _0x2972c0=0x0;_0x2972c0<_0xef52e2[_0x1eb5('0x39')]['ids'][_0x1eb5('0x40')];_0x2972c0+=0x1){socket[_0x1eb5('0x1e')](_0x1eb5('0x124'),{'SmsInteractionId':Number(_0xef52e2['query'][_0x1eb5('0x51')][_0x2972c0]),'UserId':Number(_0xef52e2[_0x1eb5('0x47')]['id'])});}}else{socket[_0x1eb5('0x1e')](_0x1eb5('0x124'),{'SmsInteractionId':Number(_0xef52e2[_0x1eb5('0x39')][_0x1eb5('0x51')]),'UserId':Number(_0xef52e2[_0x1eb5('0x47')]['id'])});}});}})[_0x1eb5('0x21')](respondWithStatusCode(_0x5050bf,null))[_0x1eb5('0x4d')](handleError(_0x5050bf,null));};exports[_0x1eb5('0x125')]=function(_0x16214e,_0x40cb75){return db['User']['find']({'where':{'id':_0x16214e[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x40cb75,null))[_0x1eb5('0x21')](function(_0x339f14){if(_0x339f14){return _0x339f14[_0x1eb5('0x125')](_0x16214e['body'][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0x16214e[_0x1eb5('0x4e')],[_0x1eb5('0x51'),'id'])||{})[_0x1eb5('0x97')](function(){for(var _0x35b3bb=0x0;_0x35b3bb<_0x16214e[_0x1eb5('0x4e')]['ids'][_0x1eb5('0x40')];_0x35b3bb+=0x1){socket['emit'](_0x1eb5('0x126'),{'OpenchannelInteractionId':Number(_0x16214e[_0x1eb5('0x4e')]['ids'][_0x35b3bb]),'UserId':Number(_0x16214e[_0x1eb5('0x47')]['id'])});}return _0x16214e[_0x1eb5('0x4e')]['ids'];});}})[_0x1eb5('0x21')](respondWithResult(_0x40cb75,null))[_0x1eb5('0x4d')](handleError(_0x40cb75,null));};exports['removeOpenchannelInteractions']=function(_0x2c81a6,_0x94fe27){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x2c81a6[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x94fe27,null))[_0x1eb5('0x21')](function(_0x3a67e0){if(_0x3a67e0){return _0x3a67e0[_0x1eb5('0x127')](_0x2c81a6[_0x1eb5('0x39')][_0x1eb5('0x51')])[_0x1eb5('0x21')](function(){if(_[_0x1eb5('0xa4')](_0x2c81a6[_0x1eb5('0x39')][_0x1eb5('0x51')])){for(var _0x303efe=0x0;_0x303efe<_0x2c81a6['query'][_0x1eb5('0x51')][_0x1eb5('0x40')];_0x303efe+=0x1){socket['emit']('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x2c81a6['query'][_0x1eb5('0x51')][_0x303efe]),'UserId':Number(_0x2c81a6[_0x1eb5('0x47')]['id'])});}}else{socket[_0x1eb5('0x1e')](_0x1eb5('0x128'),{'OpenchannelInteractionId':Number(_0x2c81a6[_0x1eb5('0x39')][_0x1eb5('0x51')]),'UserId':Number(_0x2c81a6['params']['id'])});}});}})[_0x1eb5('0x21')](respondWithStatusCode(_0x94fe27,null))[_0x1eb5('0x4d')](handleError(_0x94fe27,null));};exports[_0x1eb5('0x129')]=function(_0x5c7e60,_0x4674e3){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x5c7e60[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x4674e3,null))['then'](function(_0x5ee09b){if(_0x5ee09b){return _0x5ee09b[_0x1eb5('0x129')](_0x5c7e60[_0x1eb5('0x4e')][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0x5c7e60[_0x1eb5('0x4e')],['ids','id'])||{})['spread'](function(){for(var _0x48e3d0=0x0;_0x48e3d0<_0x5c7e60[_0x1eb5('0x4e')][_0x1eb5('0x51')][_0x1eb5('0x40')];_0x48e3d0+=0x1){socket[_0x1eb5('0x1e')]('user_has_whatsapp_interactions:save',{'WhatsappInteractionId':Number(_0x5c7e60[_0x1eb5('0x4e')][_0x1eb5('0x51')][_0x48e3d0]),'UserId':Number(_0x5c7e60[_0x1eb5('0x47')]['id'])});}return _0x5c7e60['body'][_0x1eb5('0x51')];});}})[_0x1eb5('0x21')](respondWithResult(_0x4674e3,null))[_0x1eb5('0x4d')](handleError(_0x4674e3,null));};exports[_0x1eb5('0x12a')]=function(_0x189dbe,_0x30dcd2){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x189dbe[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x30dcd2,null))[_0x1eb5('0x21')](function(_0xbb14f4){if(_0xbb14f4){return _0xbb14f4[_0x1eb5('0x12a')](_0x189dbe['query'][_0x1eb5('0x51')]);}})[_0x1eb5('0x21')](respondWithStatusCode(_0x30dcd2,null))[_0x1eb5('0x4d')](handleError(_0x30dcd2,null));};exports['getVoicePrefixes']=function(_0x22c607,_0x3b7e94){var _0xff84d4={};var _0x46a32e={};var _0x2e639c;var _0x545e82;return db[_0x1eb5('0x2e')]['findOne']({'where':{'id':_0x22c607[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x3b7e94,null))[_0x1eb5('0x21')](function(_0x41f2ae){if(_0x41f2ae){_0x2e639c=_0x41f2ae;_0x46a32e['model']=_[_0x1eb5('0xc4')](db[_0x1eb5('0x12b')][_0x1eb5('0xc6')]);_0x46a32e[_0x1eb5('0x39')]=_['keys'](_0x22c607[_0x1eb5('0x39')]);_0x46a32e[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x46a32e[_0x1eb5('0xc3')],_0x46a32e[_0x1eb5('0x39')]);_0xff84d4[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x46a32e[_0x1eb5('0xc3')],qs['fields'](_0x22c607[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0xff84d4['attributes']=_0xff84d4[_0x1eb5('0x3d')]['length']?_0xff84d4[_0x1eb5('0x3d')]:_0x46a32e[_0x1eb5('0xc3')];_0xff84d4[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x22c607[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0xff84d4['where']=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x22c607[_0x1eb5('0x39')],_0x46a32e[_0x1eb5('0xcb')]));if(_0x22c607['query'][_0x1eb5('0xcc')]){_0xff84d4['where']=_[_0x1eb5('0x49')](_0xff84d4[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0xff84d4[_0x1eb5('0x3d')],function(_0x38fe4e){var _0x5db518={};_0x5db518[_0x38fe4e]={'$like':'%'+_0x22c607[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x5db518;})});}_0xff84d4=_[_0x1eb5('0x49')]({},_0xff84d4,_0x22c607['options']);return _0x2e639c[_0x1eb5('0x12c')](_0xff84d4);}})[_0x1eb5('0x21')](function(_0x1e0624){if(_0x1e0624){_0x545e82=_0x1e0624[_0x1eb5('0x40')];if(!_0x22c607[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0xff84d4[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x22c607[_0x1eb5('0x39')][_0x1eb5('0x19')]);_0xff84d4['offset']=qs[_0x1eb5('0x17')](_0x22c607[_0x1eb5('0x39')]['offset']);}return _0x2e639c['getVoicePrefixes'](_0xff84d4);}})[_0x1eb5('0x21')](function(_0x4b6f58){if(_0x4b6f58){return _0x4b6f58?{'count':_0x545e82,'rows':_0x4b6f58}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x3b7e94,null))[_0x1eb5('0x4d')](handleError(_0x3b7e94,null));};exports[_0x1eb5('0x12d')]=function(_0x273586,_0x4ed71e){var _0x46aaa7={};var _0x464926={};var _0x377af0;var _0x2abe40;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x273586['params']['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x4ed71e,null))[_0x1eb5('0x21')](function(_0x27a4d8){if(_0x27a4d8){_0x377af0=_0x27a4d8;_0x464926['model']=_['keys'](db[_0x1eb5('0x12e')]['rawAttributes']);_0x464926[_0x1eb5('0x39')]=_[_0x1eb5('0xc4')](_0x273586[_0x1eb5('0x39')]);_0x464926[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x464926[_0x1eb5('0xc3')],_0x464926[_0x1eb5('0x39')]);_0x46aaa7[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x464926[_0x1eb5('0xc3')],qs['fields'](_0x273586['query'][_0x1eb5('0xc8')]));_0x46aaa7['attributes']=_0x46aaa7['attributes'][_0x1eb5('0x40')]?_0x46aaa7['attributes']:_0x464926[_0x1eb5('0xc3')];_0x46aaa7['order']=qs[_0x1eb5('0xd1')](_0x273586[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x46aaa7[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x273586[_0x1eb5('0x39')],_0x464926['filters']));if(_0x273586[_0x1eb5('0x39')]['filter']){_0x46aaa7['where']=_['merge'](_0x46aaa7[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x46aaa7['attributes'],function(_0x264af8){var _0x174296={};_0x174296[_0x264af8]={'$like':'%'+_0x273586[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x174296;})});}_0x46aaa7=_['merge']({},_0x46aaa7,_0x273586[_0x1eb5('0x4a')]);return _0x377af0[_0x1eb5('0x12d')](_0x46aaa7);}})['then'](function(_0x358ee6){if(_0x358ee6){_0x2abe40=_0x358ee6[_0x1eb5('0x40')];if(!_0x273586[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x46aaa7[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x273586['query'][_0x1eb5('0x19')]);_0x46aaa7[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x273586['query']['offset']);}return _0x377af0[_0x1eb5('0x12d')](_0x46aaa7);}})['then'](function(_0xd0104f){if(_0xd0104f){return _0xd0104f?{'count':_0x2abe40,'rows':_0xd0104f}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x4ed71e,null))[_0x1eb5('0x4d')](handleError(_0x4ed71e,null));};exports[_0x1eb5('0x12f')]=function(_0x1dd60a,_0x44ee63){return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x1dd60a[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x44ee63,null))[_0x1eb5('0x21')](function(_0x35981b){if(_0x35981b){return _0x35981b[_0x1eb5('0x12f')](_0x1dd60a['body'][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0x1dd60a[_0x1eb5('0x4e')],[_0x1eb5('0x51'),'id'])||{});}})[_0x1eb5('0x21')](respondWithResult(_0x44ee63,null))[_0x1eb5('0x4d')](handleError(_0x44ee63,null));};exports[_0x1eb5('0x130')]=function(_0x48fc74,_0x2cd61d){return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x48fc74['params']['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x2cd61d,null))[_0x1eb5('0x21')](function(_0x5053e1){if(_0x5053e1){return _0x5053e1['removeFaxAccounts'](_0x48fc74[_0x1eb5('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x2cd61d,null))['catch'](handleError(_0x2cd61d,null));};exports[_0x1eb5('0x131')]=function(_0xd41afd,_0x50a1dd){var _0x35e427={};var _0x4bf45b={};var _0x3063b2;var _0x43b287;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0xd41afd['params']['id']}})['then'](handleEntityNotFound(_0x50a1dd,null))[_0x1eb5('0x21')](function(_0x5a7011){if(_0x5a7011){_0x3063b2=_0x5a7011;_0x4bf45b[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db['MailAccount']['rawAttributes']);_0x4bf45b['query']=_[_0x1eb5('0xc4')](_0xd41afd[_0x1eb5('0x39')]);_0x4bf45b['filters']=_['intersection'](_0x4bf45b[_0x1eb5('0xc3')],_0x4bf45b[_0x1eb5('0x39')]);_0x35e427[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x4bf45b[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0xd41afd[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x35e427[_0x1eb5('0x3d')]=_0x35e427[_0x1eb5('0x3d')]['length']?_0x35e427['attributes']:_0x4bf45b[_0x1eb5('0xc3')];_0x35e427['order']=qs[_0x1eb5('0xd1')](_0xd41afd['query'][_0x1eb5('0xd1')]);_0x35e427['where']=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0xd41afd[_0x1eb5('0x39')],_0x4bf45b[_0x1eb5('0xcb')]));if(_0xd41afd['query']['filter']){_0x35e427[_0x1eb5('0x37')]=_[_0x1eb5('0x49')](_0x35e427['where'],{'$or':_[_0x1eb5('0x28')](_0x35e427['attributes'],function(_0x376ef1){var _0x457e49={};_0x457e49[_0x376ef1]={'$like':'%'+_0xd41afd[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x457e49;})});}_0x35e427=_[_0x1eb5('0x49')]({},_0x35e427,_0xd41afd['options']);return _0x3063b2[_0x1eb5('0x131')](_0x35e427);}})[_0x1eb5('0x21')](function(_0x1bfb0d){if(_0x1bfb0d){_0x43b287=_0x1bfb0d[_0x1eb5('0x40')];if(!_0xd41afd[_0x1eb5('0x39')][_0x1eb5('0xbd')]('nolimit')){_0x35e427[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0xd41afd[_0x1eb5('0x39')]['limit']);_0x35e427[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0xd41afd['query'][_0x1eb5('0x17')]);}return _0x3063b2['getMailAccounts'](_0x35e427);}})[_0x1eb5('0x21')](function(_0x387ac2){if(_0x387ac2){return _0x387ac2?{'count':_0x43b287,'rows':_0x387ac2}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x50a1dd,null))[_0x1eb5('0x4d')](handleError(_0x50a1dd,null));};exports['addMailAccounts']=function(_0x4f17cd,_0x23fab2){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x4f17cd['params']['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x23fab2,null))[_0x1eb5('0x21')](function(_0x19f430){if(_0x19f430){return _0x19f430['addMailAccounts'](_0x4f17cd[_0x1eb5('0x4e')][_0x1eb5('0x51')],_['omit'](_0x4f17cd['body'],[_0x1eb5('0x51'),'id'])||{});}})[_0x1eb5('0x21')](respondWithResult(_0x23fab2,null))[_0x1eb5('0x4d')](handleError(_0x23fab2,null));};exports[_0x1eb5('0x132')]=function(_0x29cf74,_0x6a98bd){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x29cf74['params']['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x6a98bd,null))['then'](function(_0x476b2e){if(_0x476b2e){return _0x476b2e[_0x1eb5('0x132')](_0x29cf74['query'][_0x1eb5('0x51')]);}})[_0x1eb5('0x21')](respondWithStatusCode(_0x6a98bd,null))[_0x1eb5('0x4d')](handleError(_0x6a98bd,null));};exports['getOpenchannelAccounts']=function(_0x3e81e6,_0x34e59d){var _0x431f36={};var _0x49a1bc={};var _0x286be2;var _0x2f9a73;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x3e81e6[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x34e59d,null))['then'](function(_0x447e92){if(_0x447e92){_0x286be2=_0x447e92;_0x49a1bc[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db['OpenchannelAccount'][_0x1eb5('0xc6')]);_0x49a1bc[_0x1eb5('0x39')]=_['keys'](_0x3e81e6['query']);_0x49a1bc[_0x1eb5('0xcb')]=_['intersection'](_0x49a1bc[_0x1eb5('0xc3')],_0x49a1bc[_0x1eb5('0x39')]);_0x431f36[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x49a1bc['model'],qs['fields'](_0x3e81e6[_0x1eb5('0x39')]['fields']));_0x431f36[_0x1eb5('0x3d')]=_0x431f36[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x431f36[_0x1eb5('0x3d')]:_0x49a1bc[_0x1eb5('0xc3')];_0x431f36['order']=qs[_0x1eb5('0xd1')](_0x3e81e6[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x431f36[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x3e81e6[_0x1eb5('0x39')],_0x49a1bc['filters']));if(_0x3e81e6['query'][_0x1eb5('0xcc')]){_0x431f36['where']=_[_0x1eb5('0x49')](_0x431f36[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x431f36[_0x1eb5('0x3d')],function(_0x195e85){var _0x150ecd={};_0x150ecd[_0x195e85]={'$like':'%'+_0x3e81e6[_0x1eb5('0x39')]['filter']+'%'};return _0x150ecd;})});}_0x431f36=_['merge']({},_0x431f36,_0x3e81e6['options']);return _0x286be2[_0x1eb5('0x133')](_0x431f36);}})[_0x1eb5('0x21')](function(_0x353c87){if(_0x353c87){_0x2f9a73=_0x353c87['length'];if(!_0x3e81e6[_0x1eb5('0x39')][_0x1eb5('0xbd')]('nolimit')){_0x431f36['limit']=qs[_0x1eb5('0x19')](_0x3e81e6['query']['limit']);_0x431f36[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x3e81e6['query']['offset']);}return _0x286be2['getOpenchannelAccounts'](_0x431f36);}})['then'](function(_0x4900c3){if(_0x4900c3){return _0x4900c3?{'count':_0x2f9a73,'rows':_0x4900c3}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x34e59d,null))[_0x1eb5('0x4d')](handleError(_0x34e59d,null));};exports[_0x1eb5('0x134')]=function(_0x3ce42a,_0x40ccb7){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x3ce42a['params']['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x40ccb7,null))[_0x1eb5('0x21')](function(_0x1c47e6){if(_0x1c47e6){return _0x1c47e6[_0x1eb5('0x134')](_0x3ce42a[_0x1eb5('0x4e')]['ids'],_[_0x1eb5('0x52')](_0x3ce42a[_0x1eb5('0x4e')],[_0x1eb5('0x51'),'id'])||{});}})['then'](respondWithResult(_0x40ccb7,null))[_0x1eb5('0x4d')](handleError(_0x40ccb7,null));};exports[_0x1eb5('0x135')]=function(_0x11587e,_0x4feed9){return db['User'][_0x1eb5('0x2b')]({'where':{'id':_0x11587e['params']['id']}})['then'](handleEntityNotFound(_0x4feed9,null))[_0x1eb5('0x21')](function(_0x4dca7a){if(_0x4dca7a){return _0x4dca7a[_0x1eb5('0x135')](_0x11587e['query']['ids']);}})[_0x1eb5('0x21')](respondWithStatusCode(_0x4feed9,null))[_0x1eb5('0x4d')](handleError(_0x4feed9,null));};exports[_0x1eb5('0x136')]=function(_0x290c52,_0x5235fe){var _0x33f2ec={};var _0x32a43f={};var _0x2794ea;var _0x372916;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x290c52[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x5235fe,null))[_0x1eb5('0x21')](function(_0x260bc3){if(_0x260bc3){_0x2794ea=_0x260bc3;_0x32a43f['model']=_['keys'](db[_0x1eb5('0x137')]['rawAttributes']);_0x32a43f[_0x1eb5('0x39')]=_[_0x1eb5('0xc4')](_0x290c52['query']);_0x32a43f['filters']=_['intersection'](_0x32a43f[_0x1eb5('0xc3')],_0x32a43f[_0x1eb5('0x39')]);_0x33f2ec[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x32a43f[_0x1eb5('0xc3')],qs['fields'](_0x290c52['query'][_0x1eb5('0xc8')]));_0x33f2ec[_0x1eb5('0x3d')]=_0x33f2ec[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x33f2ec['attributes']:_0x32a43f['model'];_0x33f2ec[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x290c52[_0x1eb5('0x39')]['sort']);_0x33f2ec[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x290c52[_0x1eb5('0x39')],_0x32a43f[_0x1eb5('0xcb')]));if(_0x290c52[_0x1eb5('0x39')]['filter']){_0x33f2ec['where']=_['merge'](_0x33f2ec[_0x1eb5('0x37')],{'$or':_['map'](_0x33f2ec[_0x1eb5('0x3d')],function(_0x5a5190){var _0x3acded={};_0x3acded[_0x5a5190]={'$like':'%'+_0x290c52[_0x1eb5('0x39')]['filter']+'%'};return _0x3acded;})});}_0x33f2ec=_[_0x1eb5('0x49')]({},_0x33f2ec,_0x290c52[_0x1eb5('0x4a')]);return _0x2794ea[_0x1eb5('0x136')](_0x33f2ec);}})['then'](function(_0x3d62e6){if(_0x3d62e6){_0x372916=_0x3d62e6[_0x1eb5('0x40')];if(!_0x290c52[_0x1eb5('0x39')][_0x1eb5('0xbd')](_0x1eb5('0xcf'))){_0x33f2ec['limit']=qs[_0x1eb5('0x19')](_0x290c52[_0x1eb5('0x39')][_0x1eb5('0x19')]);_0x33f2ec[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x290c52[_0x1eb5('0x39')][_0x1eb5('0x17')]);}return _0x2794ea[_0x1eb5('0x136')](_0x33f2ec);}})[_0x1eb5('0x21')](function(_0x1d2c4b){if(_0x1d2c4b){return _0x1d2c4b?{'count':_0x372916,'rows':_0x1d2c4b}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x5235fe,null))['catch'](handleError(_0x5235fe,null));};exports[_0x1eb5('0x138')]=function(_0xf8eb16,_0x9c1af9){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0xf8eb16[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x9c1af9,null))[_0x1eb5('0x21')](function(_0x1ec7ec){if(_0x1ec7ec){return _0x1ec7ec[_0x1eb5('0x138')](_0xf8eb16[_0x1eb5('0x4e')][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0xf8eb16[_0x1eb5('0x4e')],[_0x1eb5('0x51'),'id'])||{});}})[_0x1eb5('0x21')](respondWithResult(_0x9c1af9,null))[_0x1eb5('0x4d')](handleError(_0x9c1af9,null));};exports['removeSmsAccounts']=function(_0x23424e,_0x463af1){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x23424e[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x463af1,null))['then'](function(_0x1a063b){if(_0x1a063b){return _0x1a063b[_0x1eb5('0x139')](_0x23424e[_0x1eb5('0x39')]['ids']);}})[_0x1eb5('0x21')](respondWithStatusCode(_0x463af1,null))[_0x1eb5('0x4d')](handleError(_0x463af1,null));};exports[_0x1eb5('0x13a')]=function(_0x5b4115,_0x25117f){var _0x3f7c0f={};var _0x1b3a8d={};var _0xc7bfa8;var _0x134de1;return db[_0x1eb5('0x2e')]['findOne']({'where':{'id':_0x5b4115[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x25117f,null))[_0x1eb5('0x21')](function(_0x2fa236){if(_0x2fa236){_0xc7bfa8=_0x2fa236;_0x1b3a8d[_0x1eb5('0xc3')]=_[_0x1eb5('0xc4')](db[_0x1eb5('0x13b')][_0x1eb5('0xc6')]);_0x1b3a8d[_0x1eb5('0x39')]=_['keys'](_0x5b4115['query']);_0x1b3a8d[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x1b3a8d['model'],_0x1b3a8d[_0x1eb5('0x39')]);_0x3f7c0f['attributes']=_[_0x1eb5('0xc7')](_0x1b3a8d[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x5b4115[_0x1eb5('0x39')]['fields']));_0x3f7c0f[_0x1eb5('0x3d')]=_0x3f7c0f[_0x1eb5('0x3d')]['length']?_0x3f7c0f[_0x1eb5('0x3d')]:_0x1b3a8d[_0x1eb5('0xc3')];_0x3f7c0f['order']=qs[_0x1eb5('0xd1')](_0x5b4115[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0x3f7c0f[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_[_0x1eb5('0xca')](_0x5b4115[_0x1eb5('0x39')],_0x1b3a8d[_0x1eb5('0xcb')]));if(_0x5b4115[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0x3f7c0f[_0x1eb5('0x37')]=_[_0x1eb5('0x49')](_0x3f7c0f[_0x1eb5('0x37')],{'$or':_[_0x1eb5('0x28')](_0x3f7c0f['attributes'],function(_0x153227){var _0x5ab2ed={};_0x5ab2ed[_0x153227]={'$like':'%'+_0x5b4115[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x5ab2ed;})});}_0x3f7c0f=_[_0x1eb5('0x49')]({},_0x3f7c0f,_0x5b4115[_0x1eb5('0x4a')]);return _0xc7bfa8['getChatWebsites'](_0x3f7c0f);}})[_0x1eb5('0x21')](function(_0x2e6e4d){if(_0x2e6e4d){_0x134de1=_0x2e6e4d[_0x1eb5('0x40')];if(!_0x5b4115['query']['hasOwnProperty'](_0x1eb5('0xcf'))){_0x3f7c0f[_0x1eb5('0x19')]=qs['limit'](_0x5b4115[_0x1eb5('0x39')]['limit']);_0x3f7c0f[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x5b4115[_0x1eb5('0x39')][_0x1eb5('0x17')]);}return _0xc7bfa8[_0x1eb5('0x13a')](_0x3f7c0f);}})[_0x1eb5('0x21')](function(_0x2b2d80){if(_0x2b2d80){return _0x2b2d80?{'count':_0x134de1,'rows':_0x2b2d80}:null;}})[_0x1eb5('0x21')](respondWithResult(_0x25117f,null))['catch'](handleError(_0x25117f,null));};exports['addChatWebsites']=function(_0x5bb434,_0x47e1c5){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0x5bb434[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x47e1c5,null))[_0x1eb5('0x21')](function(_0x4ecb1d){if(_0x4ecb1d){return _0x4ecb1d[_0x1eb5('0x13c')](_0x5bb434[_0x1eb5('0x4e')][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0x5bb434[_0x1eb5('0x4e')],[_0x1eb5('0x51'),'id'])||{});}})[_0x1eb5('0x21')](respondWithResult(_0x47e1c5,null))[_0x1eb5('0x4d')](handleError(_0x47e1c5,null));};exports[_0x1eb5('0x13d')]=function(_0x3ca90f,_0x27746b){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0x3ca90f[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x27746b,null))['then'](function(_0x24f931){if(_0x24f931){return _0x24f931[_0x1eb5('0x13d')](_0x3ca90f[_0x1eb5('0x39')][_0x1eb5('0x51')]);}})[_0x1eb5('0x21')](respondWithStatusCode(_0x27746b,null))[_0x1eb5('0x4d')](handleError(_0x27746b,null));};exports[_0x1eb5('0x13e')]=function(_0x18de18,_0xa774fe){var _0x10e78f={};var _0x1a44ed={};var _0x5c363e;var _0x5ccfde;return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x18de18[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0xa774fe,null))['then'](function(_0xbd5788){if(_0xbd5788){_0x5c363e=_0xbd5788;_0x1a44ed['model']=_['keys'](db[_0x1eb5('0x13f')][_0x1eb5('0xc6')]);_0x1a44ed[_0x1eb5('0x39')]=_[_0x1eb5('0xc4')](_0x18de18[_0x1eb5('0x39')]);_0x1a44ed[_0x1eb5('0xcb')]=_[_0x1eb5('0xc7')](_0x1a44ed[_0x1eb5('0xc3')],_0x1a44ed[_0x1eb5('0x39')]);_0x10e78f[_0x1eb5('0x3d')]=_[_0x1eb5('0xc7')](_0x1a44ed[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x18de18[_0x1eb5('0x39')][_0x1eb5('0xc8')]));_0x10e78f[_0x1eb5('0x3d')]=_0x10e78f[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0x10e78f[_0x1eb5('0x3d')]:_0x1a44ed[_0x1eb5('0xc3')];_0x10e78f['order']=qs[_0x1eb5('0xd1')](_0x18de18[_0x1eb5('0x39')]['sort']);_0x10e78f[_0x1eb5('0x37')]=qs[_0x1eb5('0xcb')](_['pick'](_0x18de18['query'],_0x1a44ed[_0x1eb5('0xcb')]));if(_0x18de18[_0x1eb5('0x39')]['filter']){_0x10e78f[_0x1eb5('0x37')]=_['merge'](_0x10e78f[_0x1eb5('0x37')],{'$or':_['map'](_0x10e78f[_0x1eb5('0x3d')],function(_0x5d7e1d){var _0x4c2a66={};_0x4c2a66[_0x5d7e1d]={'$like':'%'+_0x18de18[_0x1eb5('0x39')][_0x1eb5('0xcc')]+'%'};return _0x4c2a66;})});}_0x10e78f=_['merge']({},_0x10e78f,_0x18de18[_0x1eb5('0x4a')]);return _0x5c363e[_0x1eb5('0x13e')](_0x10e78f);}})[_0x1eb5('0x21')](function(_0x1de6fe){if(_0x1de6fe){_0x5ccfde=_0x1de6fe[_0x1eb5('0x40')];if(!_0x18de18[_0x1eb5('0x39')][_0x1eb5('0xbd')]('nolimit')){_0x10e78f['limit']=qs[_0x1eb5('0x19')](_0x18de18['query'][_0x1eb5('0x19')]);_0x10e78f['offset']=qs[_0x1eb5('0x17')](_0x18de18[_0x1eb5('0x39')]['offset']);}return _0x5c363e[_0x1eb5('0x13e')](_0x10e78f);}})[_0x1eb5('0x21')](function(_0x2558c3){if(_0x2558c3){return _0x2558c3?{'count':_0x5ccfde,'rows':_0x2558c3}:null;}})[_0x1eb5('0x21')](respondWithResult(_0xa774fe,null))[_0x1eb5('0x4d')](handleError(_0xa774fe,null));};exports[_0x1eb5('0x140')]=function(_0x2742b6,_0x18d04b){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x2742b6[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](handleEntityNotFound(_0x18d04b,null))['then'](function(_0x336817){if(_0x336817){return _0x336817['addWhatsappAccounts'](_0x2742b6[_0x1eb5('0x4e')][_0x1eb5('0x51')],_[_0x1eb5('0x52')](_0x2742b6[_0x1eb5('0x4e')],[_0x1eb5('0x51'),'id'])||{});}})[_0x1eb5('0x21')](respondWithResult(_0x18d04b,null))[_0x1eb5('0x4d')](handleError(_0x18d04b,null));};exports[_0x1eb5('0x141')]=function(_0x5c4523,_0x574374){return db[_0x1eb5('0x2e')]['find']({'where':{'id':_0x5c4523[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x574374,null))[_0x1eb5('0x21')](function(_0x3b0e4b){if(_0x3b0e4b){return _0x3b0e4b[_0x1eb5('0x141')](_0x5c4523['query'][_0x1eb5('0x51')]);}})[_0x1eb5('0x21')](respondWithStatusCode(_0x574374,null))[_0x1eb5('0x4d')](handleError(_0x574374,null));};exports['getScheduledCalls']=function(_0x3eb16e,_0x5d1a8b){var _0xb98186={},_0x48f3bf={},_0x10c83e={'count':0x0,'rows':[]};var _0x577268=db[_0x1eb5('0x142')][_0x1eb5('0xc6')];_0x48f3bf['model']=_['keys'](_0x577268);_0x48f3bf[_0x1eb5('0x39')]=_['keys'](_0x3eb16e[_0x1eb5('0x39')]);_0x48f3bf['filters']=_['intersection'](_0x48f3bf['model'],_0x48f3bf['query']);_0x48f3bf[_0x1eb5('0xcb')]=_[_0x1eb5('0xbb')](_0x48f3bf['filters'],[_0x1eb5('0x143'),_0x1eb5('0x144'),_0x1eb5('0x145'),_0x1eb5('0x146'),_0x1eb5('0x147'),_0x1eb5('0x148'),'$ne','$eq',_0x1eb5('0x149'),_0x1eb5('0x14a'),_0x1eb5('0x14b'),_0x1eb5('0x14c'),_0x1eb5('0x14d'),_0x1eb5('0x14e'),_0x1eb5('0x14f'),'$iLike',_0x1eb5('0x150'),_0x1eb5('0x14e'),_0x1eb5('0x151'),_0x1eb5('0x152'),_0x1eb5('0x153'),_0x1eb5('0x154')]);_0xb98186['attributes']=_[_0x1eb5('0xc7')](_0x48f3bf[_0x1eb5('0xc3')],qs[_0x1eb5('0xc8')](_0x3eb16e[_0x1eb5('0x39')]['fields']));_0xb98186['attributes']=_0xb98186[_0x1eb5('0x3d')][_0x1eb5('0x40')]?_0xb98186['attributes']:_0x48f3bf[_0x1eb5('0xc3')];if(!_0x3eb16e[_0x1eb5('0x39')][_0x1eb5('0xbd')]('nolimit')){_0xb98186[_0x1eb5('0x19')]=qs[_0x1eb5('0x19')](_0x3eb16e[_0x1eb5('0x39')][_0x1eb5('0x19')]);_0xb98186[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x3eb16e[_0x1eb5('0x39')][_0x1eb5('0x17')]);}_0xb98186[_0x1eb5('0xc9')]=qs[_0x1eb5('0xd1')](_0x3eb16e[_0x1eb5('0x39')][_0x1eb5('0xd1')]);_0xb98186[_0x1eb5('0x37')]=qs['filters'](_[_0x1eb5('0xca')](_0x3eb16e[_0x1eb5('0x39')],_0x48f3bf[_0x1eb5('0xcb')]));if(_0x3eb16e[_0x1eb5('0x39')][_0x1eb5('0xcc')]){_0xb98186[_0x1eb5('0x37')]=_[_0x1eb5('0x49')](_0xb98186['where'],{'$or':_['map'](_0xb98186['attributes'],function(_0x75d629){var _0x186fcb={};_0x186fcb[_0x75d629]={'$like':'%'+_0x3eb16e[_0x1eb5('0x39')]['filter']+'%'};return _0x186fcb;})});}_0xb98186['where']={'$and':[_0xb98186[_0x1eb5('0x37')],{'$or':[{'UserId':_0x3eb16e['params']['id']},{'OwnerId':_0x3eb16e['params']['id']}]}]};_0xb98186=_[_0x1eb5('0x49')]({},_0xb98186,_0x3eb16e[_0x1eb5('0x4a')]);var _0x48e8b6={'where':_0xb98186[_0x1eb5('0x37')]};return db['CmHopper'][_0x1eb5('0x1a')](_0x48e8b6)[_0x1eb5('0x21')](function(_0x371087){_0x10c83e['count']=_0x371087;if(_0x3eb16e[_0x1eb5('0x39')][_0x1eb5('0x38')]){_0xb98186[_0x1eb5('0x3c')]=[{'attributes':['id','firstName','lastName',_0x1eb5('0x155')],'model':db[_0x1eb5('0x156')],'as':'Contact'},{'attributes':['id',_0x1eb5('0x2c'),_0x1eb5('0x157')],'model':db['VoiceQueue'],'as':_0x1eb5('0xc5')}];}return db[_0x1eb5('0x142')][_0x1eb5('0x9b')](_0xb98186);})[_0x1eb5('0x21')](function(_0x541152){_0x10c83e[_0x1eb5('0x3f')]=_0x541152;return _0x10c83e;})[_0x1eb5('0x21')](respondWithFilteredResult(_0x5d1a8b,_0xb98186))[_0x1eb5('0x4d')](handleError(_0x5d1a8b,null));};exports[_0x1eb5('0x158')]=function(_0x4fe564,_0xa0f418){if(!_['isNil'](_0x4fe564[_0x1eb5('0x6f')]['id'])&&(_0x4fe564[_0x1eb5('0x6f')]['role']=='admin'||_0x4fe564[_0x1eb5('0x6f')][_0x1eb5('0x1c')]==_0x1eb5('0x6f'))){return db[_0x1eb5('0x2e')][_0x1eb5('0x8a')]({'where':{'id':_0x4fe564[_0x1eb5('0x47')]['id']},'raw':!![]})[_0x1eb5('0x21')](function(_0x37d65c){return authService[_0x1eb5('0x159')](_0x37d65c);})[_0x1eb5('0x21')](function(_0x41c0d8){if(_0x41c0d8){return _0xa0f418['status'](0xc8)[_0x1eb5('0x16')]({'api_key':_0x41c0d8[_0x1eb5('0x15a')]});}else{return _0xa0f418[_0x1eb5('0x14')](0xcc)[_0x1eb5('0x16')]({'message':_0x1eb5('0x15b')});}})[_0x1eb5('0x4d')](handleError(_0xa0f418,0x193));}else{return _0xa0f418[_0x1eb5('0x14')](0x191)[_0x1eb5('0x16')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});}};exports[_0x1eb5('0x15c')]=function(_0x4e4652,_0x498b7e){if(!_[_0x1eb5('0x56')](_0x4e4652[_0x1eb5('0x6f')]['id'])&&(_0x4e4652[_0x1eb5('0x6f')]['role']==_0x1eb5('0x23')||_0x4e4652[_0x1eb5('0x6f')][_0x1eb5('0x1c')]=='user')){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x4e4652[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](function(_0x9e6372){return authService[_0x1eb5('0x15d')](_0x9e6372);})[_0x1eb5('0x21')](function(_0xbcd98f){return db['User']['update']({'apiKeyIat':_0xbcd98f[_0x1eb5('0x15e')],'apiKeyNonce':_0xbcd98f[_0x1eb5('0x15f')]},{'where':{'id':_0x4e4652[_0x1eb5('0x47')]['id']}})[_0x1eb5('0x21')](function(){return _0x498b7e[_0x1eb5('0x14')](0xc8)[_0x1eb5('0x16')]({'api_key':_0xbcd98f[_0x1eb5('0x15a')]});});})[_0x1eb5('0x4d')](handleError(_0x498b7e,0x193));}else{return _0x498b7e[_0x1eb5('0x14')](0x191)['json']({'message':_0x1eb5('0x160')});}};exports['removeApiKey']=function(_0x3d2c09,_0x6e31e7){if(!_[_0x1eb5('0x56')](_0x3d2c09['user']['id'])&&(_0x3d2c09['user'][_0x1eb5('0x1c')]==_0x1eb5('0x23')||_0x3d2c09[_0x1eb5('0x6f')][_0x1eb5('0x1c')]==_0x1eb5('0x6f'))){return db[_0x1eb5('0x2e')][_0x1eb5('0x2b')]({'where':{'id':_0x3d2c09[_0x1eb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x6e31e7,null))[_0x1eb5('0x21')](function(_0x3f96d6){if(_0x3f96d6&&_0x3f96d6[_0x1eb5('0x161')]&&_0x3f96d6[_0x1eb5('0x162')])return _0x3f96d6;else throw{'message':_0x1eb5('0x163')};})['then'](function(){return db[_0x1eb5('0x2e')][_0x1eb5('0x1b')]({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x3d2c09[_0x1eb5('0x47')]['id']}});})[_0x1eb5('0x21')](respondWithStatusCode(_0x6e31e7,0xc8))[_0x1eb5('0x4d')](handleError(_0x6e31e7,0x193));}else{return _0x6e31e7['status'](0x191)[_0x1eb5('0x16')]({'message':_0x1eb5('0x160')});}};exports[_0x1eb5('0x164')]=function(_0x4916bb,_0xae0d87){var _0x400452=_0x4916bb[_0x1eb5('0x6f')][_0x1eb5('0x22')]({'plain':!![]});if(!_0x400452){return _0xae0d87[_0x1eb5('0x14')](0x191)[_0x1eb5('0x2d')]('Unable\x20to\x20retrieve\x20the\x20current\x20user');}else{Promise['resolve']()[_0x1eb5('0x21')](function(){if(_0x4916bb[_0x1eb5('0x39')][_0x1eb5('0x3a')]!=='true')return;return _0x4916bb[_0x1eb5('0x6f')]['getUserSetting']();})[_0x1eb5('0x21')](function(_0x4b4391){if(!_0x4b4391)return;return _0x4b4391[_0x1eb5('0x22')]({'plain':!![]});})['then'](function(_0x192d1b){_0x400452[_0x1eb5('0x3a')]=_0x192d1b;return _0xae0d87[_0x1eb5('0x14')](0xc8)[_0x1eb5('0x16')](_0x400452);});}};exports['getPresence']=function(_0x3481a1,_0xa7ba6f){var _0x3f18b4={'offset':0x0};var _0xc2a443={'count':0x0,'rows':[]};var _0x6bd82d=['idle',_0x1eb5('0x165'),'ringing'];var _0x43f709=[];var _0x30024e=[];var _0x424d4a=[];var _0x5bf871=_0x3481a1[_0x1eb5('0x39')][_0x1eb5('0x166')];var _0x27e10e=_0x3481a1[_0x1eb5('0x39')][_0x1eb5('0x167')];var _0x14fc81=_0x3481a1['query']['filter'];return Promise[_0x1eb5('0xf5')]()[_0x1eb5('0x21')](function(){if(!_0x5bf871){return[];}return db[_0x1eb5('0x102')][_0x1eb5('0x9b')]({'attributes':['id',_0x1eb5('0x2c')],'where':{'id':_0x5bf871}});})['then'](function(_0x372b78){_0x424d4a=_0x372b78;if(!_0x27e10e){return[];}return db[_0x1eb5('0x9a')][_0x1eb5('0x9b')]({'attributes':['id',_0x1eb5('0x2c')],'type':'inbound','where':{'id':_0x27e10e}});})[_0x1eb5('0x21')](function(_0x437bbe){_0x30024e=_0x437bbe;var _0x4c31e9=_0x424d4a[_0x1eb5('0xbb')](_0x30024e)[_0x1eb5('0x28')](function(_0x3db87a){return _0x3db87a['getAgents']({'attributes':['id',_0x1eb5('0x2c'),'internal',_0x1eb5('0x92')],'raw':!![]});});return Promise['all'](_0x4c31e9);})[_0x1eb5('0x21')](function(_0x1f13d9){var _0x42c9f4=_[_0x1eb5('0x168')](_0x1f13d9);if(_0x14fc81){if(_0x27e10e||_0x5bf871){return _0x42c9f4['filter'](function(_0x2bb516){return _0x2bb516[_0x1eb5('0x2c')][_0x1eb5('0x95')]()[_0x1eb5('0x2a')](_0x14fc81[_0x1eb5('0x95')]())||_0x2bb516[_0x1eb5('0x55')][_0x1eb5('0x169')]()[_0x1eb5('0x2a')](_0x14fc81);});}else{return db[_0x1eb5('0x2e')][_0x1eb5('0x9b')]({'attributes':['id','name',_0x1eb5('0x55'),'online'],'where':{'role':_0x1eb5('0x1d'),'$or':[db['sequelize'][_0x1eb5('0x37')](db[_0x1eb5('0x58')]['fn'](_0x1eb5('0x16a'),db[_0x1eb5('0x58')]['col']('name')),{'$like':'%'+_0x14fc81[_0x1eb5('0x95')]()+'%'}),{'internal':{'$like':'%'+_0x14fc81+'%'}}]},'raw':!![]});}}else{return _0x42c9f4;}})[_0x1eb5('0x21')](function(_0x28869d){var _0x3fcde1=_0x1eb5('0x2c');var _0x7f5e5c=_0x1eb5('0x16b');if(_0x3481a1['query'][_0x1eb5('0xd1')]){_0x7f5e5c=_0x3481a1[_0x1eb5('0x39')][_0x1eb5('0xd1')][0x0]==='-'?_0x1eb5('0x16c'):_0x1eb5('0x16b');_0x3fcde1=_0x7f5e5c==='asc'?_0x3481a1[_0x1eb5('0x39')][_0x1eb5('0xd1')]:_0x3481a1[_0x1eb5('0x39')][_0x1eb5('0xd1')][_0x1eb5('0x16d')](0x1);}return _(_0x28869d)[_0x1eb5('0x16e')]('id')[_0x1eb5('0x16f')]([function(_0xae6297){return _0x3fcde1===_0x1eb5('0x2c')?_0xae6297[_0x3fcde1][_0x1eb5('0x95')]():_0xae6297[_0x3fcde1];}],[_0x7f5e5c])[_0x1eb5('0x28')](function(_0x49116c){return _[_0x1eb5('0xca')](_0x49116c,['id','name','internal',_0x1eb5('0x92')]);})[_0x1eb5('0x29')]();})[_0x1eb5('0x21')](function(_0x56b635){_0x43f709=_0x56b635;return rta[_0x1eb5('0x170')]();})[_0x1eb5('0x21')](function(_0x23f5a5){return _0x43f709[_0x1eb5('0x28')](function(_0x424f70){var _0x14fbc8=_[_0x1eb5('0x2b')](_0x23f5a5[_0x1eb5('0x3f')],['id',_0x424f70['id']]);if(!_0x14fbc8||!_0x424f70[_0x1eb5('0x92')]){_0x424f70['status']='offline';}else if(_0x14fbc8[_0x1eb5('0x9e')]){_0x424f70['status']='pause';}else if(_0x14fbc8[_0x1eb5('0x171')]===_0x1eb5('0x172')||!_0x14fbc8[_0x1eb5('0x171')]){_0x424f70[_0x1eb5('0x14')]=_0x1eb5('0x172');}else{_0x424f70[_0x1eb5('0x14')]=_0x6bd82d['includes'](_0x14fbc8[_0x1eb5('0x171')])?_0x1eb5('0x92'):_0x1eb5('0x173');}return _0x424f70;});})['then'](function(_0x418568){if(!_0x3481a1[_0x1eb5('0x39')][_0x1eb5('0xbd')]('nolimit')){_0x3f18b4['limit']=qs[_0x1eb5('0x19')](_0x3481a1[_0x1eb5('0x39')][_0x1eb5('0x19')]||0xa);_0x3f18b4[_0x1eb5('0x17')]=qs[_0x1eb5('0x17')](_0x3481a1[_0x1eb5('0x39')][_0x1eb5('0x17')]);}_0xc2a443[_0x1eb5('0x1a')]=_0x418568['length'];_0xc2a443[_0x1eb5('0x3f')]=_0x3f18b4['limit']?_0x418568[_0x1eb5('0x174')](_0x3f18b4[_0x1eb5('0x17')],_0x3f18b4[_0x1eb5('0x17')]+_0x3f18b4['limit']):_0x418568;return _0xc2a443;})['then'](respondWithFilteredResult(_0xa7ba6f,_0x3f18b4))['catch'](handleError(_0xa7ba6f,null));};function get_open_tabs(_0x32c897,_0x257165){var _0x13a890=_0x32c897['charAt'](0x0)[_0x1eb5('0x175')]()+_0x32c897[_0x1eb5('0x174')](0x1);var _0x2f3d07={'type':db[_0x1eb5('0x81')][_0x1eb5('0x5a')][_0x1eb5('0x5b')],'raw':!![]};return new Promise(function(_0x8b4bb9,_0x4cdaf4){var _0x373ed2=squel[_0x1eb5('0x176')]()[_0x1eb5('0x177')](_0x1eb5('0x178')+_0x13a890+_0x1eb5('0x179'),'id')[_0x1eb5('0x177')](_0x1eb5('0x17a'))[_0x1eb5('0x5c')](_0x1eb5('0x17b')+_0x32c897+'_interactions','ui')['where'](_0x1eb5('0x17c'),_0x257165['id']);return db['sequelize'][_0x1eb5('0x39')](_0x373ed2[_0x1eb5('0x169')](),_0x2f3d07)[_0x1eb5('0x21')](function(_0x49129a){_0x257165[_0x13a890+_0x1eb5('0x17d')]=_0x49129a;_0x8b4bb9(_0x49129a);})[_0x1eb5('0x4d')](function(_0x3c53ef){_0x4cdaf4(_0x3c53ef);});});}exports[_0x1eb5('0x17e')]=function(_0x35a402,_0x511b2f){var _0x3d77f8=_0x35a402[_0x1eb5('0x47')]['id'];var _0x899904=_0x35a402['body']['enabled'];return db['User'][_0x1eb5('0x1b')]({'messengerSoundNotification':_0x899904},{'where':{'id':_0x3d77f8}})[_0x1eb5('0x21')](respondWithStatusCode(_0x511b2f,null))[_0x1eb5('0x4d')](handleError(_0x511b2f,null));};
\ No newline at end of file
+var _0xccd4=['params','merge','chat','whatsapp','mail','catch','update','body','describe','addContacts','ids','Setting','securePassword','validatePasswordPattern','password','max','isNil','min_internal','internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','voicemail','mailbox','VoiceMail','fullname','email','permissions','101','102','103','113','110','105','108','109','100','111','114','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','autoAssociation','error','bulkCreate','some','map','findAll','isEmpty','compact','UserProfileResource','oldPassword','Sequelize','ValidationError','authenticate','Wrong\x20credentials','newPassword','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','spread','QueueId','VoiceQueue','voice','format','interface','penalty','UserVoiceQueueRt','removeQueues','remove','isArray','Queue:remove','addAvatar','file','filename','getAvatar','root','server/files/images/logos/default_profile.png','userpic','download','join','server/files/images/','getOpenTabs','sms','ChatOpenTabs','FaxOpenTabs','FAX','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','CmList','List','color','tag','model','keys','Queue','filters','intersection','fields','sort','pick','Unknown\x20role','hasOwnProperty','nolimit','getVoiceQueuesRt','order','options','getGroups','ChatGroup','VoiceRecording','ScreenRecording','UserId','getChatInteractions','ChatInteraction','getOpenchannelInteractions','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','login','phone','mobile','LOCAL/%s@from-sip/n','intrf','SIP/%s','user:%s','headers','x-forwarded-for','connection','remoteAddress','UserVoiceQueue.penalty','upsert','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','smsPause','whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','getTeams','Team','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','Queue:save','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','getAssociatedQueues','removeAgent','UserVoicePrefix','VoicePrefixId','getLists','getAgents','getVoiceQueues','get','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','concat','$or','$gte','$lt','$ne','$eq','$not','$notBetween','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','firstName','CmContact','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','nonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','ringing','inbound','flatten','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','voiceStatus','unavailable','charAt','slice','select','ui.','InteractionId','field','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','enabled','moment','path','squel','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','agent','emit','userNotification:recalc:','destroy','role','Users','user','Telephones','telephone','filter','ignore','value','includes','find','stack','name','send','User','rawAttributes','fieldName','type','key','previousPasswords','resetPasswordToken','resetPasswordExpires','index','getOptions','where','query','includeAll','include','userSetting','true','UserSetting','attributes','push','rows','openTabs','dataValues','fax','openchannel','all','show'];(function(_0x4ea5d2,_0x31d8cd){var _0xffe9e1=function(_0x5baeac){while(--_0x5baeac){_0x4ea5d2['push'](_0x4ea5d2['shift']());}};_0xffe9e1(++_0x31d8cd);}(_0xccd4,0x137));var _0x4ccd=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xccd4[_0xf71120];return _0xbe2fd3;};'use strict';var moment=require(_0x4ccd('0x0'));var util=require('util');var path=require(_0x4ccd('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4ccd('0x2'));var Redis=require('ioredis');var authService=require(_0x4ccd('0x3'));var contacts=require('../../components/contacts');var qs=require(_0x4ccd('0x4'));var rta=require(_0x4ccd('0x5'));var logger=require(_0x4ccd('0x6'))(_0x4ccd('0x7'));var utils=require('../../config/utils');var config=require(_0x4ccd('0x8'));var licenseUtil=require(_0x4ccd('0x9'));var APIBadRequestError=require(_0x4ccd('0xa'))[_0x4ccd('0xb')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIHandleError=require(_0x4ccd('0xa'))[_0x4ccd('0xc')];var db=require(_0x4ccd('0xd'))['db'];var socket=require(_0x4ccd('0xe'))(new Redis(config[_0x4ccd('0xf')]));require(_0x4ccd('0x10'))['register'](socket);config[_0x4ccd('0xf')]=_[_0x4ccd('0x11')](config[_0x4ccd('0xf')],{'host':_0x4ccd('0x12'),'port':0x18eb});var values;function respondWithStatusCode(_0x50931c,_0x3665e4){_0x3665e4=_0x3665e4||0xcc;return function(_0x1fdf6d){if(_0x1fdf6d){return _0x50931c[_0x4ccd('0x13')](_0x3665e4);}return _0x50931c[_0x4ccd('0x14')](_0x3665e4)[_0x4ccd('0x15')]();};}function respondWithResult(_0x507c44,_0x569170){_0x569170=_0x569170||0xc8;return function(_0x4a8c5c){if(_0x4a8c5c){return _0x507c44[_0x4ccd('0x14')](_0x569170)[_0x4ccd('0x16')](_0x4a8c5c);}};}function respondWithFilteredResult(_0x5d3128,_0x8e8c30){return function(_0x1e466f){if(_0x1e466f){var _0x4a3c6d=typeof _0x8e8c30[_0x4ccd('0x17')]===_0x4ccd('0x18')&&typeof _0x8e8c30[_0x4ccd('0x19')]==='undefined';var _0x2f6b45=_0x1e466f[_0x4ccd('0x1a')];var _0x199919=_0x4a3c6d?0x0:_0x8e8c30[_0x4ccd('0x17')];var _0x1315bd=_0x4a3c6d?_0x1e466f[_0x4ccd('0x1a')]:_0x8e8c30[_0x4ccd('0x17')]+_0x8e8c30[_0x4ccd('0x19')];var _0x32c715;if(_0x1315bd>=_0x2f6b45){_0x1315bd=_0x2f6b45;_0x32c715=0xc8;}else{_0x32c715=0xce;}_0x5d3128['status'](_0x32c715);return _0x5d3128[_0x4ccd('0x1b')](_0x4ccd('0x1c'),_0x199919+'-'+_0x1315bd+'/'+_0x2f6b45)[_0x4ccd('0x16')](_0x1e466f);}return null;};}function saveUpdates(_0x3dbf7e){return function(_0x4bfabb){if(_0x4bfabb){return _0x4bfabb['update'](_0x3dbf7e)[_0x4ccd('0x1d')](function(_0x300024){if(_0x300024['role']===_0x4ccd('0x1e')){socket[_0x4ccd('0x1f')](_0x4ccd('0x20')+_0x300024['id'],_0x300024);}return _0x300024;});}return null;};}function removeEntity(_0x17da11){return function(_0x52addd){if(_0x52addd){return _0x52addd[_0x4ccd('0x21')]()[_0x4ccd('0x1d')](function(){var _0x152828=_0x52addd['get']({'plain':!![]});if(_0x152828[_0x4ccd('0x22')]==='admin')return;var _0x1b6097=[{'name':_0x4ccd('0x23'),'value':_0x4ccd('0x24'),'ignore':!![]},{'name':'Agents','value':_0x4ccd('0x1e'),'ignore':![]},{'name':_0x4ccd('0x25'),'value':_0x4ccd('0x26'),'ignore':![]}];var _0xd1b386=_(_0x1b6097)[_0x4ccd('0x27')](_0x4ccd('0x28'))['map'](_0x4ccd('0x29'))[_0x4ccd('0x29')]();if(_[_0x4ccd('0x2a')](_0xd1b386,_0x152828['role'])){return;}var _0x28c57a=_[_0x4ccd('0x2b')](_0x1b6097,[_0x4ccd('0x29'),_0x152828[_0x4ccd('0x22')]])['name'];return db['UserProfileResource'][_0x4ccd('0x21')]({'where':{'type':_0x28c57a,'resourceId':_0x152828['id']}})[_0x4ccd('0x1d')](function(){return _0x52addd;});})[_0x4ccd('0x1d')](function(){_0x17da11[_0x4ccd('0x14')](0xcc)[_0x4ccd('0x15')]();});}};}function handleEntityNotFound(_0x16a04f){return function(_0x29311f){if(!_0x29311f){_0x16a04f[_0x4ccd('0x13')](0x194);}return _0x29311f;};}function handleError(_0x3173ea,_0x399eb5){_0x399eb5=_0x399eb5||0x1f4;return function(_0x254553){logger['error'](_0x254553[_0x4ccd('0x2c')]);if(_0x254553[_0x4ccd('0x2d')]){delete _0x254553[_0x4ccd('0x2d')];}_0x3173ea[_0x4ccd('0x14')](_0x399eb5)[_0x4ccd('0x2e')](_0x254553);};}function getUserAttributes(){return _(db[_0x4ccd('0x2f')][_0x4ccd('0x30')])['map'](function(_0x488b68){return{'name':_0x488b68[_0x4ccd('0x31')],'type':_0x488b68[_0x4ccd('0x32')][_0x4ccd('0x33')]};})[_0x4ccd('0x27')](function(_0x270972){return!['password','salt',_0x4ccd('0x34'),_0x4ccd('0x35'),_0x4ccd('0x36'),'md5secret']['includes'](_0x270972[_0x4ccd('0x2d')]);})[_0x4ccd('0x29')]();}exports[_0x4ccd('0x37')]=function(_0x5d10f6,_0x581d9d){var _0xdfb745={},_0x3ccc78={'count':0x0,'rows':[]};var _0x4e52ce=getUserAttributes();_0xdfb745=qs[_0x4ccd('0x38')](_0x4e52ce,_0x5d10f6);var _0x312736={'where':_0xdfb745[_0x4ccd('0x39')]};return db[_0x4ccd('0x2f')][_0x4ccd('0x1a')](_0x312736)[_0x4ccd('0x1d')](function(_0x308124){_0x3ccc78[_0x4ccd('0x1a')]=_0x308124;if(_0x5d10f6[_0x4ccd('0x3a')][_0x4ccd('0x3b')]){_0xdfb745[_0x4ccd('0x3c')]=[{'all':!![]}];}if(_0x5d10f6[_0x4ccd('0x3a')][_0x4ccd('0x3d')]===_0x4ccd('0x3e')){_0xdfb745[_0x4ccd('0x3c')]=[{'model':db[_0x4ccd('0x3f')],'as':_0x4ccd('0x3d')}];}if(!_[_0x4ccd('0x2a')](_0xdfb745['attributes'],'id')){_0xdfb745[_0x4ccd('0x40')][_0x4ccd('0x41')]('id');}return db[_0x4ccd('0x2f')]['findAll'](_0xdfb745);})[_0x4ccd('0x1d')](function(_0x4362e8){_0x3ccc78[_0x4ccd('0x42')]=_0x4362e8;if(_0x5d10f6[_0x4ccd('0x3a')][_0x4ccd('0x43')]===_0x4ccd('0x3e')){var _0x23bd55=[];for(var _0x528081=0x0;_0x528081<_0x3ccc78[_0x4ccd('0x42')]['length'];_0x528081++){_0x23bd55[_0x4ccd('0x41')](get_open_tabs('chat',_0x3ccc78['rows'][_0x528081][_0x4ccd('0x44')]));_0x23bd55[_0x4ccd('0x41')](get_open_tabs('sms',_0x3ccc78['rows'][_0x528081]['dataValues']));_0x23bd55['push'](get_open_tabs(_0x4ccd('0x45'),_0x3ccc78[_0x4ccd('0x42')][_0x528081]['dataValues']));_0x23bd55[_0x4ccd('0x41')](get_open_tabs('mail',_0x3ccc78[_0x4ccd('0x42')][_0x528081]['dataValues']));_0x23bd55[_0x4ccd('0x41')](get_open_tabs(_0x4ccd('0x46'),_0x3ccc78[_0x4ccd('0x42')][_0x528081]['dataValues']));_0x23bd55[_0x4ccd('0x41')](get_open_tabs('whatsapp',_0x3ccc78[_0x4ccd('0x42')][_0x528081][_0x4ccd('0x44')]));}return Promise[_0x4ccd('0x47')](_0x23bd55)[_0x4ccd('0x1d')](function(){return _0x3ccc78;});}else{return _0x3ccc78;}})[_0x4ccd('0x1d')](respondWithFilteredResult(_0x581d9d,_0xdfb745))['catch'](handleError(_0x581d9d,null));};exports[_0x4ccd('0x48')]=function(_0x43c396,_0x1cadd3){var _0x18ca34=getUserAttributes();_0x43c396[_0x4ccd('0x3a')]['id']=_0x43c396[_0x4ccd('0x49')]['id'];var _0x5dc5e8=qs[_0x4ccd('0x38')](_0x18ca34,_0x43c396);if(_0x43c396[_0x4ccd('0x3a')][_0x4ccd('0x3b')]){_0x5dc5e8[_0x4ccd('0x3c')]=[{'all':!![]}];}if(_0x43c396[_0x4ccd('0x3a')][_0x4ccd('0x3d')]===_0x4ccd('0x3e')){_0x5dc5e8['include']=[{'model':db[_0x4ccd('0x3f')],'as':_0x4ccd('0x3d')}];}_0x5dc5e8=_[_0x4ccd('0x4a')]({},_0x5dc5e8,_0x43c396['options']);if(!_[_0x4ccd('0x2a')](_0x5dc5e8[_0x4ccd('0x40')],'id')){_0x5dc5e8[_0x4ccd('0x40')][_0x4ccd('0x41')]('id');}return db['User'][_0x4ccd('0x2b')](_0x5dc5e8)[_0x4ccd('0x1d')](handleEntityNotFound(_0x1cadd3,null))['then'](function(_0x5e4e92){var _0x2cb0b2=[];values=_0x5e4e92;if(_0x43c396[_0x4ccd('0x3a')][_0x4ccd('0x43')]==='true'){_0x2cb0b2[_0x4ccd('0x41')](get_open_tabs(_0x4ccd('0x4b'),_0x5e4e92['dataValues']));_0x2cb0b2[_0x4ccd('0x41')](get_open_tabs('sms',_0x5e4e92['dataValues']));_0x2cb0b2['push'](get_open_tabs(_0x4ccd('0x46'),_0x5e4e92[_0x4ccd('0x44')]));_0x2cb0b2[_0x4ccd('0x41')](get_open_tabs(_0x4ccd('0x4c'),_0x5e4e92['dataValues']));_0x2cb0b2['push'](get_open_tabs(_0x4ccd('0x45'),_0x5e4e92[_0x4ccd('0x44')]));_0x2cb0b2['push'](get_open_tabs(_0x4ccd('0x4d'),_0x5e4e92[_0x4ccd('0x44')]));return Promise[_0x4ccd('0x47')](_0x2cb0b2);}else{return values;}})['then'](function(){return values;})[_0x4ccd('0x1d')](respondWithResult(_0x1cadd3,null))[_0x4ccd('0x4e')](handleError(_0x1cadd3,null));};exports[_0x4ccd('0x4f')]=function(_0x35a6d0,_0x2678c5){if(_0x35a6d0[_0x4ccd('0x50')]['id']){delete _0x35a6d0[_0x4ccd('0x50')]['id'];}delete _0x35a6d0[_0x4ccd('0x50')][_0x4ccd('0x22')];return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x35a6d0['params']['id']}})['then'](handleEntityNotFound(_0x2678c5,null))[_0x4ccd('0x1d')](saveUpdates(_0x35a6d0['body'],null))[_0x4ccd('0x1d')](respondWithResult(_0x2678c5,null))[_0x4ccd('0x4e')](handleError(_0x2678c5,null));};exports[_0x4ccd('0x51')]=function(_0xfcc0d9,_0x377860){return db[_0x4ccd('0x2f')][_0x4ccd('0x51')]()['then'](respondWithResult(_0x377860,null))[_0x4ccd('0x4e')](handleError(_0x377860,null));};exports[_0x4ccd('0x52')]=function(_0x44bcce,_0x37b62f){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x44bcce[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x37b62f,null))['then'](function(_0x2b6dbc){if(_0x2b6dbc){return _0x2b6dbc['addContacts'](_0x44bcce['body'][_0x4ccd('0x53')],_['omit'](_0x44bcce[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{});}})[_0x4ccd('0x1d')](respondWithResult(_0x37b62f,null))[_0x4ccd('0x4e')](handleError(_0x37b62f,null));};function validateUser(_0x4e819f){return new Promise(function(_0x5a9e63,_0x5eced8){if(_0x4e819f['internal'])return _0x5a9e63(_0x4e819f);return db[_0x4ccd('0x54')]['findById'](0x1)['then'](function(_0x4690c1){if(_0x4690c1[_0x4ccd('0x55')])authService[_0x4ccd('0x56')](_0x4e819f[_0x4ccd('0x57')]);db['User'][_0x4ccd('0x58')]('internal')['then'](function(_0x226d91){if(_[_0x4ccd('0x59')](_0x226d91)){_0x4e819f['internal']=_0x4690c1['min_internal']||0x1;return;}if(_[_0x4ccd('0x59')](_0x4690c1[_0x4ccd('0x5a')])||_0x4690c1[_0x4ccd('0x5a')]===_0x226d91){_0x4e819f[_0x4ccd('0x5b')]=_0x226d91+0x1;return;}if(_0x4690c1[_0x4ccd('0x5a')]>_0x226d91){_0x4e819f[_0x4ccd('0x5b')]=_0x4690c1[_0x4ccd('0x5a')];return;}return db[_0x4ccd('0x5c')][_0x4ccd('0x3a')](_0x4ccd('0x5d'),{'type':db['sequelize'][_0x4ccd('0x5e')][_0x4ccd('0x5f')]})[_0x4ccd('0x1d')](function(_0x195103){if(_0x195103&&_0x195103[_0x4ccd('0x60')]){for(var _0x1ab633=0x0,_0x4470a4=_0x195103[_0x4ccd('0x60')];_0x1ab633<_0x4470a4&&_[_0x4ccd('0x59')](_0x4e819f[_0x4ccd('0x5b')]);_0x1ab633++){if(_0x4690c1[_0x4ccd('0x5a')]<=_0x195103[_0x1ab633][_0x4ccd('0x61')]){_0x4e819f[_0x4ccd('0x5b')]=_0x195103[_0x1ab633][_0x4ccd('0x61')];}else if(_0x4690c1[_0x4ccd('0x5a')]>_0x195103[_0x1ab633][_0x4ccd('0x61')]&&_0x4690c1['min_internal']<=_0x195103[_0x1ab633]['to']){_0x4e819f['internal']=_0x4690c1['min_internal'];}}}if(_['isNil'](_0x4e819f[_0x4ccd('0x5b')])){_0x4e819f[_0x4ccd('0x5b')]=_0x226d91+0x1;}return _0x5a9e63(_0x4e819f);});});})[_0x4ccd('0x4e')](function(_0x3473dd){_0x5eced8(_0x3473dd);});});}function updateUser(_0x29467c){return new Promise(function(_0x38a08d,_0x191fce){try{if(_0x29467c[_0x4ccd('0x62')]){_0x29467c[_0x4ccd('0x63')]=_0x29467c[_0x4ccd('0x5b')];_0x29467c[_0x4ccd('0x64')]={'mailbox':_0x29467c[_0x4ccd('0x5b')],'password':_0x29467c[_0x4ccd('0x57')],'fullname':_0x29467c[_0x4ccd('0x65')],'email':_0x29467c[_0x4ccd('0x66')]};}if(_0x29467c['role']===_0x4ccd('0x1e')){if(!_0x29467c[_0x4ccd('0x67')])_0x29467c[_0x4ccd('0x67')]=[_0x4ccd('0x68'),_0x4ccd('0x69'),_0x4ccd('0x6a'),_0x4ccd('0x6b'),_0x4ccd('0x6c'),'104',_0x4ccd('0x6d'),'106','107',_0x4ccd('0x6e'),_0x4ccd('0x6f'),_0x4ccd('0x70'),_0x4ccd('0x71'),_0x4ccd('0x72'),_0x4ccd('0x73')];}_0x38a08d(_0x29467c);}catch(_0x392d18){_0x191fce(_0x392d18);}});}exports[_0x4ccd('0x74')]=function(_0x1c97ae,_0x22b46a){if(_0x1c97ae['user']['role']===_0x4ccd('0x1e'))throw new Error(_0x4ccd('0x75'));if(_0x1c97ae['body'][_0x4ccd('0x22')]===_0x4ccd('0x24')&&_0x1c97ae[_0x4ccd('0x24')][_0x4ccd('0x22')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x1c97ae['body'][_0x4ccd('0x22')]===_0x4ccd('0x76')&&_0x1c97ae[_0x4ccd('0x24')][_0x4ccd('0x22')]!==_0x4ccd('0x76')){throw new Error(_0x4ccd('0x77'));}return licenseUtil[_0x4ccd('0x78')]([_0x1c97ae[_0x4ccd('0x50')]])[_0x4ccd('0x1d')](function(){return validateUser(_0x1c97ae[_0x4ccd('0x50')]);})['then'](function(_0x2579bc){return updateUser(_0x2579bc)['then'](function(_0x4f0ec0){if(_0x4f0ec0['role']===_0x4ccd('0x76')){_0x4f0ec0[_0x4ccd('0x79')]=_0x1c97ae['user'][_0x4ccd('0x79')];delete _0x4f0ec0[_0x4ccd('0x7a')];}return _0x4f0ec0;});})[_0x4ccd('0x1d')](function(_0x51d338){return db['User'][_0x4ccd('0x74')](_0x51d338,{'include':[{'model':db['VoiceMail'],'as':_0x4ccd('0x64')}]});})['then'](function(_0x5d4a50){if(_0x1c97ae['body'][_0x4ccd('0x22')]===_0x4ccd('0x24'))return _0x5d4a50;if(_0x1c97ae[_0x4ccd('0x24')][_0x4ccd('0x22')]!==_0x4ccd('0x24'))return _0x5d4a50;return db[_0x4ccd('0x7b')][_0x4ccd('0x2b')]({'where':{'name':_0x5d4a50[_0x4ccd('0x22')]===_0x4ccd('0x1e')?_0x4ccd('0x7c'):_0x4ccd('0x25'),'userProfileId':_0x1c97ae[_0x4ccd('0x24')][_0x4ccd('0x7a')]},'raw':!![]})[_0x4ccd('0x1d')](function(_0x53a9e2){if(!_0x53a9e2||_0x53a9e2[_0x4ccd('0x7d')]!=0x0)return _0x5d4a50;return db['UserProfileResource'][_0x4ccd('0x74')]({'name':_0x5d4a50[_0x4ccd('0x2d')],'resourceId':_0x5d4a50['id'],'type':_0x53a9e2[_0x4ccd('0x2d')],'sectionId':_0x53a9e2['id']},{})[_0x4ccd('0x1d')](function(){return _0x5d4a50;});})[_0x4ccd('0x4e')](function(_0x3c3c3e){logger[_0x4ccd('0x7e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c3c3e);throw _0x3c3c3e;});})[_0x4ccd('0x1d')](respondWithResult(_0x22b46a,0xc9))[_0x4ccd('0x4e')](handleError(_0x22b46a,null));};exports[_0x4ccd('0x7f')]=function(_0x4f9fa2,_0x26b10d){var _0x4be9f0=_0x4f9fa2[_0x4ccd('0x50')];var _0x2a2dce=[];if(_0x4f9fa2[_0x4ccd('0x24')][_0x4ccd('0x22')]==='agent')throw new Error('Unauthorized');if(_[_0x4ccd('0x80')](_0x4be9f0,[_0x4ccd('0x22'),'user'])&&_0x4f9fa2[_0x4ccd('0x24')][_0x4ccd('0x22')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x4be9f0,['role',_0x4ccd('0x76')])&&_0x4f9fa2[_0x4ccd('0x24')][_0x4ccd('0x22')]!==_0x4ccd('0x76')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x4be9f0)[_0x4ccd('0x1d')](function(){return validateUser(_0x4be9f0[0x0]);})[_0x4ccd('0x1d')](function(){for(var _0x437aa2=0x1;_0x437aa2<_0x4be9f0[_0x4ccd('0x60')];_0x437aa2++){var _0x47c6d8=_0x4be9f0[_0x437aa2-0x1][_0x4ccd('0x5b')];if(!_0x4be9f0[_0x437aa2][_0x4ccd('0x5b')])_0x4be9f0[_0x437aa2][_0x4ccd('0x5b')]=_0x47c6d8+0x1;_0x2a2dce['push'](validateUser(_0x4be9f0[_0x437aa2]));}return Promise[_0x4ccd('0x47')](_0x2a2dce);})['then'](function(){_0x2a2dce=[];for(var _0x1b98ae=0x0;_0x1b98ae<_0x4be9f0[_0x4ccd('0x60')];_0x1b98ae++){_0x2a2dce['push'](updateUser(_0x4be9f0[_0x1b98ae]));}return Promise[_0x4ccd('0x47')](_0x2a2dce);})[_0x4ccd('0x1d')](function(){_0x2a2dce=_0x4be9f0[_0x4ccd('0x81')](function(_0x307d12){return db['User'][_0x4ccd('0x74')](_0x307d12,{'include':[{'model':db['VoiceMail'],'as':'VoiceMail'}]})[_0x4ccd('0x1d')](function(_0x2161c6){_0x307d12['id']=_0x2161c6['id'];return _0x307d12;});});return Promise['all'](_0x2a2dce);})[_0x4ccd('0x1d')](function(_0x34522e){if(_0x4f9fa2[_0x4ccd('0x50')][_0x4ccd('0x22')]==='user')return _0x34522e;if(_0x4f9fa2[_0x4ccd('0x24')][_0x4ccd('0x22')]!==_0x4ccd('0x24'))return _0x34522e;var _0xeed117=_[_0x4ccd('0x80')](_0x34522e,function(_0x17d7ce){return _0x17d7ce[_0x4ccd('0x22')]===_0x4ccd('0x1e')||_0x17d7ce['role']==='telephone';});if(!_0xeed117)return _0x34522e;return db[_0x4ccd('0x7b')][_0x4ccd('0x82')]({'where':{'name':{'$or':[_0x4ccd('0x7c'),_0x4ccd('0x25')]},'userProfileId':_0x4f9fa2[_0x4ccd('0x24')]['userProfileId']},'raw':!![]})['then'](function(_0x2a0cf3){if(_[_0x4ccd('0x83')](_0x2a0cf3)||!_['some'](_0x2a0cf3,['autoAssociation',0x0]))return _0x34522e;_0x2a2dce=[];var _0x10e7f1=_(_0x2a0cf3)[_0x4ccd('0x81')](function(_0x4865f2){if(_0x4865f2[_0x4ccd('0x7d')]===0x1)return;return _0x4865f2[_0x4ccd('0x2d')]===_0x4ccd('0x7c')?_0x4ccd('0x1e'):_0x4ccd('0x26');})[_0x4ccd('0x84')]()[_0x4ccd('0x29')]();for(var _0x259930=0x0;_0x259930<_0x34522e[_0x4ccd('0x60')];_0x259930++){if(!_[_0x4ccd('0x2a')](_0x10e7f1,_0x34522e[_0x259930][_0x4ccd('0x22')]))return;var _0x108a72=_0x34522e[_0x259930]['role']===_0x4ccd('0x1e')?_0x4ccd('0x7c'):'Telephones';_0x2a2dce['push'](db[_0x4ccd('0x85')][_0x4ccd('0x74')]({'name':_0x34522e[_0x259930]['name'],'resourceId':_0x34522e[_0x259930]['id'],'type':_0x108a72,'sectionId':_[_0x4ccd('0x2b')](_0x2a0cf3,[_0x4ccd('0x2d'),_0x108a72])['id']},{}));}return Promise[_0x4ccd('0x47')](_0x2a2dce);});})['then'](respondWithResult(_0x26b10d,0xc9))[_0x4ccd('0x4e')](handleError(_0x26b10d,null));};exports['changePassword']=function(_0x1eb4a6,_0x394da1){if(_0x1eb4a6[_0x4ccd('0x50')]['id']){delete _0x1eb4a6['body']['id'];}return db['User']['find']({'where':{'id':_0x1eb4a6[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](function(_0x2b365c){if(!_0x2b365c)return null;if(_0x2b365c['id']===_0x1eb4a6[_0x4ccd('0x24')]['id']){if(!_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x86')]||!_0x1eb4a6[_0x4ccd('0x50')]['newPassword']){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x2b365c[_0x4ccd('0x89')](_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x86')])){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x8a'));}if(_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x86')]===_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')]){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x8c'));}}else if(_0x1eb4a6[_0x4ccd('0x24')]['role']==='admin'){if(!_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')]){throw new db[(_0x4ccd('0x87'))]['ValidationError'](_0x4ccd('0x8d'));}}else if(_0x1eb4a6['user'][_0x4ccd('0x22')]===_0x4ccd('0x24')){if(!_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')]){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x8d'));}if(_0x2b365c['role']!==_0x4ccd('0x1e')){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x75'));}}else{throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x75'));}return _0x2b365c;})[_0x4ccd('0x1d')](handleEntityNotFound(_0x394da1,null))[_0x4ccd('0x1d')](function(_0x516c1d){return db[_0x4ccd('0x54')][_0x4ccd('0x8e')]({'attributes':['id',_0x4ccd('0x55'),'enforcePasswordHistory',_0x4ccd('0x8f')]})[_0x4ccd('0x1d')](function(_0x26e97b){if(_0x26e97b['securePassword'])authService[_0x4ccd('0x56')](_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')]);if(!_0x26e97b['enforcePasswordHistory']||!_0x516c1d[_0x4ccd('0x34')])return _0x516c1d;authService[_0x4ccd('0x90')](_0x1eb4a6[_0x4ccd('0x50')]['newPassword'],_0x516c1d[_0x4ccd('0x34')],_0x26e97b['passwordHistoryLimit']);return _0x516c1d;})['then'](saveUpdates({'password':_0x1eb4a6[_0x4ccd('0x50')]['newPassword'],'passwordResetAt':_0x1eb4a6[_0x4ccd('0x24')]['id']==_0x1eb4a6[_0x4ccd('0x49')]['id']?moment():null,'previousPasswords':authService[_0x4ccd('0x91')](_0x1eb4a6[_0x4ccd('0x50')][_0x4ccd('0x8b')],_0x516c1d[_0x4ccd('0x34')])},null));})['then'](respondWithResult(_0x394da1,null))[_0x4ccd('0x4e')](handleError(_0x394da1,null));};exports[_0x4ccd('0x92')]=function(_0x228051,_0x538434){var _0x35b19b=_0x228051[_0x4ccd('0x50')][_0x4ccd('0x93')];return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x228051['params']['id']},'attributes':['id','name',_0x4ccd('0x22'),_0x4ccd('0x94'),_0x4ccd('0x95'),_0x4ccd('0x96'),'interface']})['then'](handleEntityNotFound(_0x538434,null))['then'](function(_0x1c143d){if(_0x1c143d){if(!utils[_0x4ccd('0x97')](_0x35b19b)){throw new db[(_0x4ccd('0x87'))]['ValidationError'](_0x4ccd('0x98'));}return _0x1c143d[_0x4ccd('0x99')+_[_0x4ccd('0x9a')](_0x35b19b[_0x4ccd('0x9b')]())+_0x4ccd('0x9c')](_0x228051[_0x4ccd('0x50')][_0x4ccd('0x53')],{'penalty':_0x228051[_0x4ccd('0x50')]['penalty']||0x0})[_0x4ccd('0x9d')](function(_0x445797){for(var _0x46a3c9=0x0;_0x46a3c9<_0x228051[_0x4ccd('0x50')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x46a3c9+=0x1){var _0x532e62={'UserId':Number(_0x228051[_0x4ccd('0x49')]['id'])};_0x532e62[_['capitalize'](_0x35b19b[_0x4ccd('0x9b')]())+_0x4ccd('0x9e')]=Number(_0x228051[_0x4ccd('0x50')][_0x4ccd('0x53')][_0x46a3c9]);socket[_0x4ccd('0x1f')](_0x4ccd('0x24')+_[_0x4ccd('0x9a')](_0x35b19b[_0x4ccd('0x9b')]())+'Queue:save',_0x532e62);}return _0x445797;})['then'](function(){if(_0x35b19b==='voice'){return db[_0x4ccd('0x9f')][_0x4ccd('0x82')]({'where':{'id':_0x228051[_0x4ccd('0x50')][_0x4ccd('0x53')]||[]},'raw':!![],'attributes':['id',_0x4ccd('0x2d')]});}})[_0x4ccd('0x1d')](function(_0x3e5882){var _0x577cd0=_0x1c143d['get']({'plain':!![]});var _0x3ae363=[];if(_0x35b19b===_0x4ccd('0xa0')&&_0x577cd0[_0x4ccd('0x22')]==='agent'&&_0x577cd0['online']){for(let _0x3b1422=0x0;_0x3b1422<_0x3e5882['length'];_0x3b1422+=0x1){_0x3ae363[_0x4ccd('0x41')]({'membername':_0x577cd0[_0x4ccd('0x2d')],'UserId':_0x577cd0['id'],'queue_name':_0x3e5882[_0x3b1422]['name'],'VoiceQueueId':_0x3e5882[_0x3b1422]['id'],'interface':_[_0x4ccd('0x59')](_0x577cd0['interface'])?util[_0x4ccd('0xa1')]('SIP/%s',_0x577cd0[_0x4ccd('0x2d')]):_0x577cd0[_0x4ccd('0xa2')],'paused':_0x577cd0[_0x4ccd('0x96')]||![],'penalty':_0x228051['body'][_0x4ccd('0xa3')]||0x0});}return Promise[_0x4ccd('0x47')](_0x3ae363['map'](function(_0x5010af){return db[_0x4ccd('0xa4')]['upsert'](_0x5010af);}));}return _0x1c143d;});}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x538434,null))[_0x4ccd('0x4e')](handleError(_0x538434,null));};exports[_0x4ccd('0xa5')]=function(_0x3d8d50,_0x550531){var _0x3528ce,_0x275839;return db['User']['find']({'where':{'id':_0x3d8d50[_0x4ccd('0x49')]['id']},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x22')]})['then'](handleEntityNotFound(_0x550531,null))[_0x4ccd('0x1d')](function(_0x3bc3c4){if(_0x3bc3c4){_0x3528ce=_0x3bc3c4;if(!_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')]||!utils[_0x4ccd('0x97')](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')])){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))]('Unknown\x20channel');}return _0x3bc3c4[_0x4ccd('0xa6')+_['capitalize'](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')]['toLowerCase']())+_0x4ccd('0x9c')](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')]);}})['then'](function(_0x3ce603){if(_[_0x4ccd('0xa7')](_0x3d8d50['query']['ids'])){for(var _0x1c93be=0x0;_0x1c93be<_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x1c93be+=0x1){_0x275839={'UserId':Number(_0x3d8d50['params']['id'])};_0x275839[_['capitalize'](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')]['toLowerCase']())+'QueueId']=Number(_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x1c93be]);socket[_0x4ccd('0x1f')](_0x4ccd('0x24')+_[_0x4ccd('0x9a')](_0x3d8d50[_0x4ccd('0x3a')]['channel'][_0x4ccd('0x9b')]())+_0x4ccd('0xa8'),_0x275839);}}else{_0x275839={'UserId':Number(_0x3d8d50['params']['id'])};_0x275839[_[_0x4ccd('0x9a')](_0x3d8d50[_0x4ccd('0x3a')]['channel'][_0x4ccd('0x9b')]())+_0x4ccd('0x9e')]=Number(_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')]);socket['emit'](_0x4ccd('0x24')+_[_0x4ccd('0x9a')](_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x93')][_0x4ccd('0x9b')]())+_0x4ccd('0xa8'),_0x275839);}return _0x3ce603;})[_0x4ccd('0x1d')](function(){if(_0x3d8d50[_0x4ccd('0x3a')]['channel']===_0x4ccd('0xa0')){return db[_0x4ccd('0xa4')]['destroy']({'where':{'UserId':_0x3d8d50[_0x4ccd('0x49')]['id'],'VoiceQueueId':_0x3d8d50[_0x4ccd('0x3a')][_0x4ccd('0x53')]},'individualHooks':!![]})[_0x4ccd('0x1d')](function(){return _0x3528ce;});}return _0x3528ce;})[_0x4ccd('0x1d')](respondWithStatusCode(_0x550531,null))[_0x4ccd('0x4e')](handleError(_0x550531,null));};exports[_0x4ccd('0xa9')]=function(_0x212547,_0x24def7){_0x212547[_0x4ccd('0x50')]['userpic']=_0x212547[_0x4ccd('0xaa')][_0x4ccd('0xab')];return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x212547[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x24def7,null))[_0x4ccd('0x1d')](saveUpdates(_0x212547[_0x4ccd('0x50')],null))[_0x4ccd('0x1d')](respondWithResult(_0x24def7,null))[_0x4ccd('0x4e')](handleError(_0x24def7,null));};exports[_0x4ccd('0xac')]=function(_0x1befd0,_0x3956d0){var _0x3597eb=path['join'](config[_0x4ccd('0xad')],_0x4ccd('0xae'));return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x1befd0['params']['id']},'attributes':['id',_0x4ccd('0xaf')],'raw':!![]})[_0x4ccd('0x1d')](handleEntityNotFound(_0x3956d0,null))[_0x4ccd('0x1d')](function(_0x1d1de7){if(_0x1d1de7){if(_[_0x4ccd('0x59')](_0x1d1de7[_0x4ccd('0xaf')])){return _0x3956d0[_0x4ccd('0xb0')](_0x3597eb);}else{if(!fs['existsSync'](path['join'](config[_0x4ccd('0xad')],'server/files/images/',_0x1d1de7[_0x4ccd('0xaf')]))){return _0x3956d0[_0x4ccd('0xb0')](_0x3597eb);}return _0x3956d0[_0x4ccd('0xb0')](path[_0x4ccd('0xb1')](config[_0x4ccd('0xad')],_0x4ccd('0xb2'),_0x1d1de7[_0x4ccd('0xaf')]));}}})[_0x4ccd('0x4e')](handleError(_0x3956d0,null));};exports[_0x4ccd('0xb3')]=function(_0x58a5e5,_0xb5317){return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x58a5e5[_0x4ccd('0x49')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0xb5317,null))[_0x4ccd('0x1d')](function(_0xc06831){var _0x58baae=[];values=_0xc06831[_0x4ccd('0x44')];_0x58baae[_0x4ccd('0x41')](get_open_tabs('chat',_0xc06831['dataValues']));_0x58baae['push'](get_open_tabs(_0x4ccd('0xb4'),_0xc06831[_0x4ccd('0x44')]));_0x58baae[_0x4ccd('0x41')](get_open_tabs(_0x4ccd('0x46'),_0xc06831['dataValues']));_0x58baae[_0x4ccd('0x41')](get_open_tabs('whatsapp',_0xc06831['dataValues']));_0x58baae[_0x4ccd('0x41')](get_open_tabs('fax',_0xc06831[_0x4ccd('0x44')]));_0x58baae['push'](get_open_tabs(_0x4ccd('0x4d'),_0xc06831[_0x4ccd('0x44')]));return Promise[_0x4ccd('0x47')](_0x58baae);})[_0x4ccd('0x1d')](function(_0x1cfed2){if(_0x1cfed2){var _0x593315=_[_0x4ccd('0x81')](values[_0x4ccd('0xb5')],function(_0x31edca){return{'channel':'CHAT','id':_0x31edca['id'],'createdAt':_0x31edca['createdAt']};});var _0x498aa7=_['map'](values[_0x4ccd('0xb6')],function(_0x3bccef){return{'channel':_0x4ccd('0xb7'),'id':_0x3bccef['id'],'createdAt':_0x3bccef[_0x4ccd('0xb8')]};});var _0x1479ff=_[_0x4ccd('0x81')](values[_0x4ccd('0xb9')],function(_0x471857){return{'channel':_0x4ccd('0xba'),'id':_0x471857['id'],'createdAt':_0x471857[_0x4ccd('0xb8')]};});var _0x47fd2e=_[_0x4ccd('0x81')](values['MailOpenTabs'],function(_0x3cce7d){return{'channel':_0x4ccd('0xbb'),'id':_0x3cce7d['id'],'createdAt':_0x3cce7d[_0x4ccd('0xb8')]};});var _0x1c9b1a=_[_0x4ccd('0x81')](values[_0x4ccd('0xbc')],function(_0xe11a6b){return{'channel':_0x4ccd('0xbd'),'id':_0xe11a6b['id'],'createdAt':_0xe11a6b[_0x4ccd('0xb8')]};});var _0x15a586=_[_0x4ccd('0x81')](values[_0x4ccd('0xbe')],function(_0x173edf){return{'channel':_0x4ccd('0xbf'),'id':_0x173edf['id'],'createdAt':_0x173edf[_0x4ccd('0xb8')]};});var _0xcb2579=_['concat'](_0x593315,_0x498aa7,_0x1479ff,_0x47fd2e,_0x1c9b1a,_0x15a586);var _0xe876f0={'count':_0xcb2579[_0x4ccd('0x60')],'rows':_0xcb2579};return _0xe876f0;}else return null;})[_0x4ccd('0x1d')](respondWithResult(_0xb5317,null))[_0x4ccd('0x4e')](handleError(_0xb5317,null));};exports[_0x4ccd('0xc0')]=function(_0x371ace,_0xfb33f3){var _0x34b1c2={};return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x371ace[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](function(_0x1f22a1){if(!_0x1f22a1){throw new APINotFoundError(util[_0x4ccd('0xa1')]('User\x20with\x20id\x20%s\x20not\x20found',_0x371ace[_0x4ccd('0x49')]['id']));}return contacts['describe']();})[_0x4ccd('0x1d')](function(_0x5b990d){_0x371ace[_0x4ccd('0x3a')][_0x4ccd('0x2f')]=_0x371ace[_0x4ccd('0x49')]['id'];_0x34b1c2=qs[_0x4ccd('0x38')](_0x5b990d,_0x371ace);if(_0x371ace[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0x3b'))){_0x34b1c2[_0x4ccd('0x3c')]=[{'model':db[_0x4ccd('0xc1')],'as':_0x4ccd('0xc2'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x4ccd('0xc3')],'where':_0x371ace[_0x4ccd('0x3a')][_0x4ccd('0xc4')]?{'id':_0x371ace[_0x4ccd('0x3a')][_0x4ccd('0xc4')]}:undefined,'required':_0x371ace[_0x4ccd('0x3a')]['tag']?!![]:![]}];}return contacts[_0x4ccd('0x82')](_0x371ace[_0x4ccd('0x3a')],_0x371ace[_0x4ccd('0x24')],_0x34b1c2,_0x5b990d);})[_0x4ccd('0x1d')](respondWithFilteredResult(_0xfb33f3,_0x34b1c2))[_0x4ccd('0x4e')](APIHandleError(_0xfb33f3));};exports['getQueues']=function(_0x47f6f1,_0x1aa6fb){var _0x2b9525;var _0x3b3310={};var _0x19478c;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x47f6f1['params']['id']},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x22')]})[_0x4ccd('0x1d')](handleEntityNotFound(_0x1aa6fb,null))[_0x4ccd('0x1d')](function(_0x47fef2){if(!utils[_0x4ccd('0x97')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0x93')])){throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0x98'));}_0x2b9525=_0x47fef2;var _0x3b55e1={};_0x3b55e1[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_[_0x4ccd('0x9a')](_0x47f6f1['query'][_0x4ccd('0x93')])+_0x4ccd('0xc7')][_0x4ccd('0x30')]);_0x3b55e1[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x47f6f1[_0x4ccd('0x3a')]);_0x3b55e1[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x3b55e1[_0x4ccd('0xc5')],_0x3b55e1[_0x4ccd('0x3a')]);_0x3b3310[_0x4ccd('0x40')]=_['intersection'](_0x3b55e1[_0x4ccd('0xc5')],qs['fields'](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x3b3310[_0x4ccd('0x40')]=_0x3b3310['attributes']['length']?_0x3b3310['attributes']:_0x3b55e1[_0x4ccd('0xc5')];_0x3b3310['order']=qs[_0x4ccd('0xcb')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x3b3310[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x47f6f1[_0x4ccd('0x3a')],_0x3b55e1['filters']));if(_0x47f6f1[_0x4ccd('0x3a')]['filter']){_0x3b3310[_0x4ccd('0x39')]=_['merge'](_0x3b3310['where'],{'$or':_[_0x4ccd('0x81')](_0x3b3310['attributes'],function(_0x4a5271){var _0x3b800f={};_0x3b800f[_0x4a5271]={'$like':'%'+_0x47f6f1[_0x4ccd('0x3a')]['filter']+'%'};return _0x3b800f;})});}_0x3b3310=_[_0x4ccd('0x4a')]({},_0x3b3310,_0x47f6f1['options']);switch(_0x2b9525['role']){case _0x4ccd('0x76'):return db[_[_0x4ccd('0x9a')](_0x47f6f1[_0x4ccd('0x3a')]['channel'])+_0x4ccd('0xc7')][_0x4ccd('0x82')](_0x3b3310);case _0x4ccd('0x24'):case'agent':return _0x2b9525['get'+_[_0x4ccd('0x9a')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0x93')])+'Queues'](_0x3b3310);default:throw new db[(_0x4ccd('0x87'))][(_0x4ccd('0x88'))](_0x4ccd('0xcd'));}})[_0x4ccd('0x1d')](function(_0x1deca4){_0x19478c=_0x1deca4[_0x4ccd('0x60')];if(!_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x3b3310[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x47f6f1[_0x4ccd('0x3a')]['limit']);_0x3b3310[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}switch(_0x2b9525[_0x4ccd('0x22')]){case _0x4ccd('0x76'):return db[_[_0x4ccd('0x9a')](_0x47f6f1['query'][_0x4ccd('0x93')])+_0x4ccd('0xc7')][_0x4ccd('0x82')](_0x3b3310);case _0x4ccd('0x24'):case _0x4ccd('0x1e'):return _0x2b9525['get'+_[_0x4ccd('0x9a')](_0x47f6f1[_0x4ccd('0x3a')][_0x4ccd('0x93')])+_0x4ccd('0x9c')](_0x3b3310);}})['then'](function(_0x2a98d4){return{'count':_0x19478c,'rows':_0x2a98d4};})[_0x4ccd('0x1d')](respondWithResult(_0x1aa6fb,null))[_0x4ccd('0x4e')](handleError(_0x1aa6fb,null));};exports[_0x4ccd('0xd0')]=function(_0x307ee6,_0x1e23e8){var _0x126bc7={};var _0x28132a={};var _0x8252c9;var _0x51709f;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x307ee6['params']['id']}})['then'](handleEntityNotFound(_0x1e23e8,null))['then'](function(_0xdd2bca){if(_0xdd2bca){_0x8252c9=_0xdd2bca;_0x28132a['model']=_[_0x4ccd('0xc6')](db[_0x4ccd('0xa4')]['rawAttributes']);_0x28132a[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x307ee6['query']);_0x28132a[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x28132a[_0x4ccd('0xc5')],_0x28132a[_0x4ccd('0x3a')]);_0x126bc7['attributes']=_[_0x4ccd('0xc9')](_0x28132a[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x307ee6[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x126bc7['attributes']=_0x126bc7[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x126bc7[_0x4ccd('0x40')]:_0x28132a[_0x4ccd('0xc5')];_0x126bc7[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x307ee6[_0x4ccd('0x3a')]['sort']);_0x126bc7['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x307ee6[_0x4ccd('0x3a')],_0x28132a[_0x4ccd('0xc8')]));if(_0x307ee6[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x126bc7[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x126bc7[_0x4ccd('0x39')],{'$or':_['map'](_0x126bc7[_0x4ccd('0x40')],function(_0x56a918){var _0x5c9969={};_0x5c9969[_0x56a918]={'$like':'%'+_0x307ee6[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x5c9969;})});}_0x126bc7=_[_0x4ccd('0x4a')]({},_0x126bc7,_0x307ee6[_0x4ccd('0xd2')]);return _0x8252c9[_0x4ccd('0xd0')](_0x126bc7);}})['then'](function(_0x3dd830){if(_0x3dd830){_0x51709f=_0x3dd830[_0x4ccd('0x60')];if(!_0x307ee6[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0xcf'))){_0x126bc7[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x307ee6['query']['limit']);_0x126bc7[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x307ee6['query'][_0x4ccd('0x17')]);}return _0x8252c9['getVoiceQueuesRt'](_0x126bc7);}})['then'](function(_0x4510cd){if(_0x4510cd){return _0x4510cd?{'count':_0x51709f,'rows':_0x4510cd}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x1e23e8,null))[_0x4ccd('0x4e')](handleError(_0x1e23e8,null));};exports[_0x4ccd('0xd3')]=function(_0x5ce74c,_0x4b31ae){var _0x18e7d3={};var _0x543265={};var _0x506374;var _0x1063f2;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x5ce74c[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x4b31ae,null))[_0x4ccd('0x1d')](function(_0x564e37){if(_0x564e37){_0x506374=_0x564e37;_0x543265[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xd4')][_0x4ccd('0x30')]);_0x543265[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x5ce74c[_0x4ccd('0x3a')]);_0x543265[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x543265[_0x4ccd('0xc5')],_0x543265[_0x4ccd('0x3a')]);_0x18e7d3[_0x4ccd('0x40')]=_['intersection'](_0x543265['model'],qs['fields'](_0x5ce74c[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x18e7d3[_0x4ccd('0x40')]=_0x18e7d3[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x18e7d3[_0x4ccd('0x40')]:_0x543265['model'];_0x18e7d3[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x5ce74c[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x18e7d3[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x5ce74c[_0x4ccd('0x3a')],_0x543265[_0x4ccd('0xc8')]));if(_0x5ce74c[_0x4ccd('0x3a')]['filter']){_0x18e7d3[_0x4ccd('0x39')]=_['merge'](_0x18e7d3[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x18e7d3[_0x4ccd('0x40')],function(_0x5f43fe){var _0x447e22={};_0x447e22[_0x5f43fe]={'$like':'%'+_0x5ce74c[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x447e22;})});}_0x18e7d3=_[_0x4ccd('0x4a')]({},_0x18e7d3,_0x5ce74c['options']);return _0x506374[_0x4ccd('0xd3')](_0x18e7d3);}})[_0x4ccd('0x1d')](function(_0x2ddda3){if(_0x2ddda3){_0x1063f2=_0x2ddda3[_0x4ccd('0x60')];if(!_0x5ce74c['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x18e7d3['limit']=qs[_0x4ccd('0x19')](_0x5ce74c[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x18e7d3['offset']=qs['offset'](_0x5ce74c[_0x4ccd('0x3a')]['offset']);}return _0x506374[_0x4ccd('0xd3')](_0x18e7d3);}})[_0x4ccd('0x1d')](function(_0x5054c4){if(_0x5054c4){return _0x5054c4?{'count':_0x1063f2,'rows':_0x5054c4}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x4b31ae,null))[_0x4ccd('0x4e')](handleError(_0x4b31ae,null));};exports['getRecordings']=function(_0x158a61,_0x2dc5e7){var _0x14830f={'raw':!![],'where':{}};var _0xb97f67={};var _0x42a0ed={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x158a61[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x2dc5e7,null))['then'](function(_0x12e06c){if(_0x12e06c){_0xb97f67[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xd5')]['rawAttributes']);_0xb97f67['query']=_[_0x4ccd('0xc6')](_0x158a61[_0x4ccd('0x3a')]);_0xb97f67[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0xb97f67[_0x4ccd('0xc5')],_0xb97f67['query']);_0x14830f[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0xb97f67[_0x4ccd('0xc5')],qs['fields'](_0x158a61[_0x4ccd('0x3a')]['fields']));_0x14830f[_0x4ccd('0x40')]=_0x14830f[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x14830f['attributes']:_0xb97f67[_0x4ccd('0xc5')];if(!_0x158a61['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x14830f[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x158a61[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x14830f[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x158a61['query'][_0x4ccd('0x17')]);}_0x14830f[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x158a61[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x14830f[_0x4ccd('0x39')]=qs['filters'](_[_0x4ccd('0xcc')](_0x158a61[_0x4ccd('0x3a')],_0xb97f67[_0x4ccd('0xc8')]));_0x14830f['where']['UserId']=_0x12e06c['id'];if(_0x158a61[_0x4ccd('0x3a')]['filter']){_0x14830f[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x14830f[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x14830f[_0x4ccd('0x40')],function(_0x2eba71){var _0x1ff731={};_0x1ff731[_0x2eba71]={'$like':'%'+_0x158a61[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x1ff731;})});}_0x14830f=_[_0x4ccd('0x4a')]({},_0x14830f,_0x158a61[_0x4ccd('0xd2')]);return db[_0x4ccd('0xd5')][_0x4ccd('0x1a')]({'where':_0x14830f[_0x4ccd('0x39')]})[_0x4ccd('0x1d')](function(_0x2c47c3){_0x42a0ed[_0x4ccd('0x1a')]=_0x2c47c3;if(_0x158a61['query'][_0x4ccd('0x3b')]){_0x14830f[_0x4ccd('0x3c')]=[{'all':!![]}];}return db[_0x4ccd('0xd5')][_0x4ccd('0x82')](_0x14830f);})[_0x4ccd('0x1d')](function(_0x4e09eb){_0x42a0ed[_0x4ccd('0x42')]=_0x4e09eb;return _0x42a0ed;});}})[_0x4ccd('0x1d')](respondWithFilteredResult(_0x2dc5e7,_0x14830f))[_0x4ccd('0x4e')](handleError(_0x2dc5e7,null));};exports['getScreenRecordings']=function(_0x31d2a6,_0x5d60a7){var _0x18cc25={'raw':!![],'where':{}};var _0x174ca0={};var _0x23321f={'count':0x0,'rows':[]};return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x31d2a6['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x5d60a7,null))[_0x4ccd('0x1d')](function(_0x576bba){if(_0x576bba){_0x174ca0[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xd6')][_0x4ccd('0x30')]);_0x174ca0[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x31d2a6[_0x4ccd('0x3a')]);_0x174ca0[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x174ca0['model'],_0x174ca0[_0x4ccd('0x3a')]);_0x18cc25[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x174ca0[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x31d2a6['query'][_0x4ccd('0xca')]));_0x18cc25[_0x4ccd('0x40')]=_0x18cc25[_0x4ccd('0x40')]['length']?_0x18cc25[_0x4ccd('0x40')]:_0x174ca0[_0x4ccd('0xc5')];if(!_0x31d2a6[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x18cc25['limit']=qs[_0x4ccd('0x19')](_0x31d2a6[_0x4ccd('0x3a')]['limit']);_0x18cc25['offset']=qs[_0x4ccd('0x17')](_0x31d2a6['query'][_0x4ccd('0x17')]);}_0x18cc25[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x31d2a6['query'][_0x4ccd('0xcb')]);_0x18cc25[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x31d2a6[_0x4ccd('0x3a')],_0x174ca0['filters']));_0x18cc25['where'][_0x4ccd('0xd7')]=_0x576bba['id'];if(_0x31d2a6[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x18cc25[_0x4ccd('0x39')]=_['merge'](_0x18cc25[_0x4ccd('0x39')],{'$or':_['map'](_0x18cc25[_0x4ccd('0x40')],function(_0x55bdfa){var _0x5777a3={};_0x5777a3[_0x55bdfa]={'$like':'%'+_0x31d2a6[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x5777a3;})});}_0x18cc25=_[_0x4ccd('0x4a')]({},_0x18cc25,_0x31d2a6[_0x4ccd('0xd2')]);return db[_0x4ccd('0xd6')]['count']({'where':_0x18cc25['where']})[_0x4ccd('0x1d')](function(_0x353754){_0x23321f[_0x4ccd('0x1a')]=_0x353754;if(_0x31d2a6[_0x4ccd('0x3a')][_0x4ccd('0x3b')]){_0x18cc25['include']=[{'all':!![]}];}return db[_0x4ccd('0xd6')][_0x4ccd('0x82')](_0x18cc25);})[_0x4ccd('0x1d')](function(_0x4ae68e){_0x23321f[_0x4ccd('0x42')]=_0x4ae68e;return _0x23321f;});}})[_0x4ccd('0x1d')](respondWithFilteredResult(_0x5d60a7,_0x18cc25))[_0x4ccd('0x4e')](handleError(_0x5d60a7,null));};exports[_0x4ccd('0xd8')]=function(_0x51e1e9,_0x220d84){var _0x14cc10={};var _0x3797a1={};var _0x1c8634;var _0x5d07b2;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x51e1e9['params']['id']}})['then'](handleEntityNotFound(_0x220d84,null))[_0x4ccd('0x1d')](function(_0x3cc34b){if(_0x3cc34b){_0x1c8634=_0x3cc34b;_0x3797a1[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xd9')][_0x4ccd('0x30')]);_0x3797a1[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x51e1e9['query']);_0x3797a1['filters']=_[_0x4ccd('0xc9')](_0x3797a1[_0x4ccd('0xc5')],_0x3797a1[_0x4ccd('0x3a')]);_0x14cc10[_0x4ccd('0x40')]=_['intersection'](_0x3797a1[_0x4ccd('0xc5')],qs['fields'](_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x14cc10[_0x4ccd('0x40')]=_0x14cc10['attributes'][_0x4ccd('0x60')]?_0x14cc10[_0x4ccd('0x40')]:_0x3797a1[_0x4ccd('0xc5')];_0x14cc10[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x14cc10['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x51e1e9['query'],_0x3797a1['filters']));if(_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x14cc10[_0x4ccd('0x39')]=_['merge'](_0x14cc10[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x14cc10['attributes'],function(_0x488068){var _0x16404f={};_0x16404f[_0x488068]={'$like':'%'+_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x16404f;})});}_0x14cc10=_['merge']({},_0x14cc10,_0x51e1e9[_0x4ccd('0xd2')]);return _0x1c8634['getChatInteractions'](_0x14cc10);}})['then'](function(_0x37291e){if(_0x37291e){_0x5d07b2=_0x37291e[_0x4ccd('0x60')];if(!_0x51e1e9['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x14cc10[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x51e1e9[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x14cc10[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x51e1e9[_0x4ccd('0x3a')]['offset']);}return _0x1c8634[_0x4ccd('0xd8')](_0x14cc10);}})[_0x4ccd('0x1d')](function(_0x211066){if(_0x211066){return _0x211066?{'count':_0x5d07b2,'rows':_0x211066}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x220d84,null))[_0x4ccd('0x4e')](handleError(_0x220d84,null));};exports[_0x4ccd('0xda')]=function(_0x4fd621,_0x5ddc60){var _0x4b47e1={};var _0x439471={};var _0x5b6e05;var _0x3dc4a0;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x4fd621[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x5ddc60,null))['then'](function(_0x1bcbf0){if(_0x1bcbf0){_0x5b6e05=_0x1bcbf0;_0x439471[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db['OpenchannelInteraction'][_0x4ccd('0x30')]);_0x439471[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x4fd621['query']);_0x439471[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x439471['model'],_0x439471[_0x4ccd('0x3a')]);_0x4b47e1[_0x4ccd('0x40')]=_['intersection'](_0x439471[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x4fd621['query'][_0x4ccd('0xca')]));_0x4b47e1[_0x4ccd('0x40')]=_0x4b47e1[_0x4ccd('0x40')]['length']?_0x4b47e1[_0x4ccd('0x40')]:_0x439471['model'];_0x4b47e1[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x4fd621[_0x4ccd('0x3a')]['sort']);_0x4b47e1[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x4fd621[_0x4ccd('0x3a')],_0x439471['filters']));if(_0x4fd621[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x4b47e1[_0x4ccd('0x39')]=_['merge'](_0x4b47e1[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x4b47e1['attributes'],function(_0x3b788f){var _0x484ed3={};_0x484ed3[_0x3b788f]={'$like':'%'+_0x4fd621[_0x4ccd('0x3a')]['filter']+'%'};return _0x484ed3;})});}_0x4b47e1=_['merge']({},_0x4b47e1,_0x4fd621[_0x4ccd('0xd2')]);return _0x5b6e05['getOpenchannelInteractions'](_0x4b47e1);}})['then'](function(_0x158a26){if(_0x158a26){_0x3dc4a0=_0x158a26['length'];if(!_0x4fd621[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0xcf'))){_0x4b47e1[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x4fd621[_0x4ccd('0x3a')]['limit']);_0x4b47e1[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x4fd621['query']['offset']);}return _0x5b6e05['getOpenchannelInteractions'](_0x4b47e1);}})['then'](function(_0x16318d){if(_0x16318d){return _0x16318d?{'count':_0x3dc4a0,'rows':_0x16318d}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x5ddc60,null))[_0x4ccd('0x4e')](handleError(_0x5ddc60,null));};exports[_0x4ccd('0xdb')]=function(_0x592ea1,_0x4a2a4b){var _0x294c35={'raw':!![],'where':{}};var _0x12225d={};var _0x422b44={'count':0x0,'rows':[]};return db['User'][_0x4ccd('0x8e')]({'where':{'id':_0x592ea1['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x4a2a4b,null))[_0x4ccd('0x1d')](function(_0x50ab38){if(_0x50ab38){_0x12225d[_0x4ccd('0xc5')]=_['keys'](db[_0x4ccd('0xdc')]['rawAttributes']);_0x12225d['query']=_['keys'](_0x592ea1[_0x4ccd('0x3a')]);_0x12225d[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x12225d['model'],_0x12225d[_0x4ccd('0x3a')]);_0x294c35['attributes']=_['intersection'](_0x12225d['model'],qs['fields'](_0x592ea1[_0x4ccd('0x3a')]['fields']));_0x294c35[_0x4ccd('0x40')]=_0x294c35['attributes'][_0x4ccd('0x60')]?_0x294c35[_0x4ccd('0x40')]:_0x12225d[_0x4ccd('0xc5')];if(!_0x592ea1['query']['hasOwnProperty'](_0x4ccd('0xcf'))){_0x294c35['limit']=qs[_0x4ccd('0x19')](_0x592ea1['query'][_0x4ccd('0x19')]);_0x294c35[_0x4ccd('0x17')]=qs['offset'](_0x592ea1[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}_0x294c35[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x592ea1[_0x4ccd('0x3a')]['sort']);_0x294c35[_0x4ccd('0x39')]=qs['filters'](_[_0x4ccd('0xcc')](_0x592ea1[_0x4ccd('0x3a')],_0x12225d[_0x4ccd('0xc8')]));_0x294c35[_0x4ccd('0x39')][_0x4ccd('0xd7')]=_0x50ab38['id'];if(_0x592ea1[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x294c35[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x294c35['where'],{'$or':_[_0x4ccd('0x81')](_0x294c35[_0x4ccd('0x40')],function(_0x4b8ba6){var _0x1b1c78={};_0x1b1c78[_0x4b8ba6]={'$like':'%'+_0x592ea1[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x1b1c78;})});}_0x294c35=_[_0x4ccd('0x4a')]({},_0x294c35,_0x592ea1[_0x4ccd('0xd2')]);return db[_0x4ccd('0xdc')][_0x4ccd('0x1a')]({'where':_0x294c35['where']})[_0x4ccd('0x1d')](function(_0x26dc98){_0x422b44[_0x4ccd('0x1a')]=_0x26dc98;if(_0x592ea1[_0x4ccd('0x3a')]['includeAll']){_0x294c35['include']=[{'all':!![]}];}return db[_0x4ccd('0xdc')][_0x4ccd('0x82')](_0x294c35);})['then'](function(_0x1beb84){_0x422b44[_0x4ccd('0x42')]=_0x1beb84;return _0x422b44;});}})[_0x4ccd('0x1d')](respondWithFilteredResult(_0x4a2a4b,_0x294c35))['catch'](handleError(_0x4a2a4b,null));};exports[_0x4ccd('0xdd')]=function(_0x5ac40c,_0x16f384){var _0x203c66={};var _0xd711a0={};var _0x14c5f5;var _0xd79842;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x5ac40c['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x16f384,null))['then'](function(_0x5c3a04){if(_0x5c3a04){_0x14c5f5=_0x5c3a04;_0xd711a0[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db['SmsInteraction'][_0x4ccd('0x30')]);_0xd711a0['query']=_[_0x4ccd('0xc6')](_0x5ac40c[_0x4ccd('0x3a')]);_0xd711a0[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0xd711a0[_0x4ccd('0xc5')],_0xd711a0['query']);_0x203c66['attributes']=_['intersection'](_0xd711a0[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x5ac40c[_0x4ccd('0x3a')]['fields']));_0x203c66[_0x4ccd('0x40')]=_0x203c66[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x203c66[_0x4ccd('0x40')]:_0xd711a0['model'];_0x203c66[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x203c66[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x5ac40c[_0x4ccd('0x3a')],_0xd711a0[_0x4ccd('0xc8')]));if(_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x203c66[_0x4ccd('0x39')]=_['merge'](_0x203c66[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x203c66[_0x4ccd('0x40')],function(_0x3ea55c){var _0x512208={};_0x512208[_0x3ea55c]={'$like':'%'+_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x512208;})});}_0x203c66=_['merge']({},_0x203c66,_0x5ac40c[_0x4ccd('0xd2')]);return _0x14c5f5[_0x4ccd('0xdd')](_0x203c66);}})['then'](function(_0x902bb0){if(_0x902bb0){_0xd79842=_0x902bb0['length'];if(!_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x203c66['limit']=qs['limit'](_0x5ac40c['query'][_0x4ccd('0x19')]);_0x203c66[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x5ac40c[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x14c5f5[_0x4ccd('0xdd')](_0x203c66);}})[_0x4ccd('0x1d')](function(_0x412ed2){if(_0x412ed2){return _0x412ed2?{'count':_0xd79842,'rows':_0x412ed2}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x16f384,null))[_0x4ccd('0x4e')](handleError(_0x16f384,null));};exports[_0x4ccd('0xde')]=function(_0x33b29d,_0x1f82ba){var _0x340173={};var _0x247ff5={};var _0x517fbc;var _0x26c187;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x33b29d[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x1f82ba,null))['then'](function(_0x5175f7){if(_0x5175f7){_0x517fbc=_0x5175f7;_0x247ff5[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0xdf')]['rawAttributes']);_0x247ff5[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x33b29d[_0x4ccd('0x3a')]);_0x247ff5[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x247ff5[_0x4ccd('0xc5')],_0x247ff5[_0x4ccd('0x3a')]);_0x340173[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x247ff5[_0x4ccd('0xc5')],qs['fields'](_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x340173[_0x4ccd('0x40')]=_0x340173[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x340173[_0x4ccd('0x40')]:_0x247ff5['model'];_0x340173[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x340173['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x33b29d[_0x4ccd('0x3a')],_0x247ff5[_0x4ccd('0xc8')]));if(_0x33b29d[_0x4ccd('0x3a')]['filter']){_0x340173[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x340173[_0x4ccd('0x39')],{'$or':_['map'](_0x340173[_0x4ccd('0x40')],function(_0x7d7934){var _0xbd75ea={};_0xbd75ea[_0x7d7934]={'$like':'%'+_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0xbd75ea;})});}_0x340173=_[_0x4ccd('0x4a')]({},_0x340173,_0x33b29d[_0x4ccd('0xd2')]);return _0x517fbc[_0x4ccd('0xde')](_0x340173);}})['then'](function(_0x4ce4de){if(_0x4ce4de){_0x26c187=_0x4ce4de[_0x4ccd('0x60')];if(!_0x33b29d[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0xcf'))){_0x340173[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x340173[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x33b29d[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x517fbc['getFaxInteractions'](_0x340173);}})[_0x4ccd('0x1d')](function(_0x310bf7){if(_0x310bf7){return _0x310bf7?{'count':_0x26c187,'rows':_0x310bf7}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x1f82ba,null))['catch'](handleError(_0x1f82ba,null));};exports[_0x4ccd('0xe0')]=function(_0x4c6803,_0x53b421){var _0x194b72={};var _0x462d2d={};var _0x57a526;var _0x44f32b;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x4c6803['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x53b421,null))[_0x4ccd('0x1d')](function(_0x56dd4d){if(_0x56dd4d){_0x57a526=_0x56dd4d;_0x462d2d[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db['WhatsappInteraction'][_0x4ccd('0x30')]);_0x462d2d[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x4c6803[_0x4ccd('0x3a')]);_0x462d2d[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x462d2d[_0x4ccd('0xc5')],_0x462d2d[_0x4ccd('0x3a')]);_0x194b72[_0x4ccd('0x40')]=_['intersection'](_0x462d2d['model'],qs[_0x4ccd('0xca')](_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x194b72['attributes']=_0x194b72[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x194b72[_0x4ccd('0x40')]:_0x462d2d[_0x4ccd('0xc5')];_0x194b72[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x194b72[_0x4ccd('0x39')]=qs['filters'](_['pick'](_0x4c6803['query'],_0x462d2d[_0x4ccd('0xc8')]));if(_0x4c6803[_0x4ccd('0x3a')]['filter']){_0x194b72['where']=_[_0x4ccd('0x4a')](_0x194b72[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x194b72[_0x4ccd('0x40')],function(_0x301c62){var _0xbceb79={};_0xbceb79[_0x301c62]={'$like':'%'+_0x4c6803['query']['filter']+'%'};return _0xbceb79;})});}_0x194b72=_[_0x4ccd('0x4a')]({},_0x194b72,_0x4c6803['options']);return _0x57a526['getWhatsappInteractions'](_0x194b72);}})['then'](function(_0x32171f){if(_0x32171f){_0x44f32b=_0x32171f[_0x4ccd('0x60')];if(!_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0xce')]('nolimit')){_0x194b72[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x194b72['offset']=qs[_0x4ccd('0x17')](_0x4c6803[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x57a526['getWhatsappInteractions'](_0x194b72);}})[_0x4ccd('0x1d')](function(_0x4052a0){if(_0x4052a0){return _0x4052a0?{'count':_0x44f32b,'rows':_0x4052a0}:null;}})['then'](respondWithResult(_0x53b421,null))[_0x4ccd('0x4e')](handleError(_0x53b421,null));};exports[_0x4ccd('0xe1')]=function(_0x468d2e,_0x3b19ed,_0x56abc8){var _0x1cface;var _0x514c93;var _0x2155d4;var _0x400614=!_[_0x4ccd('0x59')](_0x468d2e['params']['id'])?_0x468d2e[_0x4ccd('0x49')]['id']:!_[_0x4ccd('0x59')](_0x468d2e[_0x4ccd('0x24')]['id'])?_0x468d2e[_0x4ccd('0x24')]['id']:null;return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x400614,'role':{'$or':[_0x4ccd('0x76'),_0x4ccd('0x24'),'agent']}},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0xe2'),_0x4ccd('0xe3'),_0x4ccd('0x22'),_0x4ccd('0x5b'),_0x4ccd('0x95')]})[_0x4ccd('0x1d')](function(_0x6d2b67){if(_0x6d2b67){if(_0x6d2b67['role']===_0x4ccd('0x1e')){_0x1cface=_0x6d2b67;if(_0x468d2e[_0x4ccd('0x50')][_0x4ccd('0xa2')]){_0x2155d4=util[_0x4ccd('0xa1')](_0x4ccd('0xe4'),_0x1cface[_0x468d2e['body'][_0x4ccd('0xa2')]]);}else if(_0x468d2e[_0x4ccd('0x50')][_0x4ccd('0xe5')]){_0x2155d4=util[_0x4ccd('0xa1')](_0x4ccd('0xe6'),_0x468d2e[_0x4ccd('0x50')]['intrf']);}else{_0x2155d4=util[_0x4ccd('0xa1')]('SIP/%s',_0x1cface[_0x4ccd('0x2d')]);}socket['to'](util['format'](_0x4ccd('0xe7'),_0x1cface[_0x4ccd('0x2d')]))[_0x4ccd('0x1f')]('user:forcelogout',{'user':{'id':_0x1cface['id'],'name':_0x1cface['name']},'ip':_0x468d2e[_0x4ccd('0xe8')][_0x4ccd('0xe9')]||_0x468d2e[_0x4ccd('0xea')]['remoteAddress']||_0x468d2e['socket'][_0x4ccd('0xeb')]||_0x468d2e[_0x4ccd('0xea')]['socket'][_0x4ccd('0xeb')]});return db['UserVoiceQueueRt'][_0x4ccd('0x21')]({'where':{'membername':_0x1cface[_0x4ccd('0x2d')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0x4ccd('0x88'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x4ccd('0x1d')](function(){if(_0x1cface){return _0x1cface['getVoiceQueues']({'raw':!![]});}})['then'](function(_0x5bb607){if(_0x1cface){if(_0x5bb607){_0x514c93=_0x5bb607;if(_0x514c93[_0x4ccd('0x60')]){var _0x5ed746=_0x514c93[_0x4ccd('0x81')](function(_0x4a4d87){var _0x4a1239={'membername':_0x1cface['name'],'UserId':_0x1cface['id'],'queue_name':_0x4a4d87[_0x4ccd('0x2d')],'VoiceQueueId':_0x4a4d87['id'],'interface':_0x2155d4,'paused':_0x1cface[_0x4ccd('0x95')]||![],'penalty':_0x4a4d87[_0x4ccd('0xec')]||0x0};return db['UserVoiceQueueRt'][_0x4ccd('0xed')](_0x4a1239);});return Promise[_0x4ccd('0x47')](_0x5ed746);}}}})[_0x4ccd('0x1d')](function(){if(_0x1cface){return db[_0x4ccd('0xee')][_0x4ccd('0x82')]({'where':{'membername':_0x1cface[_0x4ccd('0x2d')],'exitAt':null}});}})[_0x4ccd('0x1d')](function(_0x4cbbd2){if(_0x1cface){var _0x7837c5=[];_0x4cbbd2[_0x4ccd('0xef')](function(_0x976059){_0x7837c5['push'](_0x976059['update']({'exitAt':moment()[_0x4ccd('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x7837c5);}})[_0x4ccd('0x1d')](function(){if(_0x1cface){var _0x5c1b8=[];var _0x4baa03=[];var _0x35c6ec=utils[_0x4ccd('0xf0')]();var _0x45a9f7={'membername':_0x1cface['name'],'interface':_0x2155d4,'enterAt':moment()[_0x4ccd('0xa1')](_0x4ccd('0xf1')),'role':_0x1cface[_0x4ccd('0x22')],'internal':_0x1cface[_0x4ccd('0x5b')]};_0x35c6ec[_0x4ccd('0xef')](function(_0x14333a){_0x5c1b8[_0x4ccd('0x41')](_[_0x4ccd('0x4a')]({'channel':_0x14333a,'type':_0x4ccd('0xf2'),'data1':_0x468d2e[_0x4ccd('0x50')][_0x4ccd('0xf3')],'data2':_0x2155d4},_0x45a9f7));if(_0x1cface['loginInPause']){_0x4baa03[_0x4ccd('0x41')](_['merge']({'channel':_0x14333a,'type':_0x4ccd('0xf4'),'data1':_0x4ccd('0xf5')},_0x45a9f7));}});return db['MemberReport']['bulkCreate'](_0x5c1b8['concat'](_0x4baa03),{'individualHooks':!![]});}})[_0x4ccd('0x1d')](function(){if(_0x1cface){return _0x1cface['update']({'online':!![],'lastLoginAt':moment()[_0x4ccd('0xa1')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x1cface['loginInPause']||![],'mailPause':_0x1cface[_0x4ccd('0x95')]||![],'chatPause':_0x1cface['loginInPause']||![],'faxPause':_0x1cface[_0x4ccd('0x95')]||![],'smsPause':_0x1cface[_0x4ccd('0x95')]||![],'openchannelPause':_0x1cface[_0x4ccd('0x95')]||![],'whatsappPause':_0x1cface[_0x4ccd('0x95')]||![],'pauseType':_0x1cface[_0x4ccd('0x95')]?_0x4ccd('0xf5'):null,'interface':_0x2155d4,'lastPauseAt':moment()[_0x4ccd('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x1b518e){if(_0x468d2e[_0x4ccd('0xf6')]){return _0x56abc8();}else{return Promise[_0x4ccd('0xf7')](_0x1b518e)['then'](respondWithResult(_0x3b19ed,null));}})[_0x4ccd('0x4e')](handleError(_0x3b19ed,null));};exports[_0x4ccd('0xf8')]=function(_0x111a48,_0x1fcd69){var _0x400f58;return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x111a48['params']['id'],'role':_0x4ccd('0x1e')},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x22')]})[_0x4ccd('0x1d')](handleEntityNotFound(_0x1fcd69,null))['then'](function(_0x357bed){if(_0x357bed){_0x400f58=_0x357bed;return db[_0x4ccd('0xa4')]['destroy']({'where':{'membername':_0x400f58[_0x4ccd('0x2d')]},'individualHooks':!![]});}})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0xee')][_0x4ccd('0x82')]({'where':{'membername':_0x400f58[_0x4ccd('0x2d')],'exitAt':null}});})[_0x4ccd('0x1d')](function(_0x128921){var _0x5ba95e=[];_0x128921['forEach'](function(_0x53ca93){_0x5ba95e[_0x4ccd('0x41')](_0x53ca93['update']({'exitAt':moment()['format'](_0x4ccd('0xf1'))}));});return Promise[_0x4ccd('0x47')](_0x5ba95e);})[_0x4ccd('0x1d')](function(){return _0x400f58[_0x4ccd('0x4f')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4ccd('0x1d')](respondWithResult(_0x1fcd69,null))[_0x4ccd('0x4e')](handleError(_0x1fcd69,null));};exports[_0x4ccd('0xf9')]=function(_0x4b3e65,_0x6f9e80){var _0x15883c;return db['UserVoiceQueueRt'][_0x4ccd('0x4f')]({'paused':0x1},{'where':{'UserId':_0x4b3e65[_0x4ccd('0x49')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x4b3e65['params']['id'],'role':_0x4ccd('0x1e')},'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x22'),_0x4ccd('0x5b'),_0x4ccd('0xa2'),_0x4ccd('0x94')]});})[_0x4ccd('0x1d')](handleEntityNotFound(_0x6f9e80,null))['then'](function(_0x3dfc3e){if(_0x3dfc3e){_0x15883c=_0x3dfc3e;return db[_0x4ccd('0xee')][_0x4ccd('0x82')]({'where':{'membername':_0x15883c['name'],'type':_0x4ccd('0xf4'),'exitAt':null}});}})['then'](function(_0x4fd3ef){if(_0x4fd3ef[_0x4ccd('0x60')]){var _0x70b32a=moment()['format'](_0x4ccd('0xf1'));for(var _0x48dc26=0x0,_0x38b6a1=_0x4fd3ef[_0x4ccd('0x60')];_0x48dc26<_0x38b6a1;_0x48dc26++){_0x4fd3ef[_0x48dc26]['updateAttributes']({'exitAt':_0x70b32a});}}})[_0x4ccd('0x1d')](function(){var _0x4968ca=[];var _0x50150c=utils[_0x4ccd('0xf0')]();_0x50150c[_0x4ccd('0xef')](function(_0x25d769){_0x4968ca['push']({'channel':_0x25d769,'membername':_0x15883c[_0x4ccd('0x2d')],'interface':_['isNil'](_0x15883c[_0x4ccd('0xa2')])?util[_0x4ccd('0xa1')]('SIP/%s',_0x15883c[_0x4ccd('0x2d')]):_0x15883c[_0x4ccd('0xa2')],'type':_0x4ccd('0xf4'),'enterAt':moment()[_0x4ccd('0xa1')](_0x4ccd('0xf1')),'data1':_0x4b3e65[_0x4ccd('0x50')][_0x4ccd('0x32')]||_0x4ccd('0xfa'),'role':_0x15883c[_0x4ccd('0x22')],'internal':_0x15883c[_0x4ccd('0x5b')]});});return db['MemberReport']['bulkCreate'](_0x4968ca,{'individualHooks':!![]});})[_0x4ccd('0x1d')](function(){return _0x15883c['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x4b3e65[_0x4ccd('0x50')]['type']||_0x4ccd('0xfa'),'lastPauseAt':moment()[_0x4ccd('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x4ccd('0x1d')](respondWithResult(_0x6f9e80,null))['catch'](handleError(_0x6f9e80,null));};exports[_0x4ccd('0xfb')]=function(_0x215305,_0x5c0a60){if(_0x215305[_0x4ccd('0x50')]['channel']&&!utils[_0x4ccd('0x97')](_0x215305[_0x4ccd('0x50')]['channel'])){throw new APIBadRequestError(util[_0x4ccd('0xa1')](_0x4ccd('0xfc'),_0x215305['body']['channel']));}return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x215305[_0x4ccd('0x49')]['id']},'attributes':['id','name',_0x4ccd('0x22'),_0x4ccd('0x5b'),_0x4ccd('0xa2'),_0x4ccd('0x94'),'voicePause',_0x4ccd('0xfd'),_0x4ccd('0xfe'),_0x4ccd('0xff'),'openchannelPause',_0x4ccd('0x100'),_0x4ccd('0x101'),_0x4ccd('0x102'),_0x4ccd('0x103')]})[_0x4ccd('0x1d')](function(_0x1701ee){if(!_0x1701ee){throw new APINotFoundError(util[_0x4ccd('0xa1')](_0x4ccd('0x104'),_0x215305['params']['id']));}return _0x1701ee[_0x4ccd('0xfb')](_0x215305[_0x4ccd('0x50')][_0x4ccd('0x93')]);})['then'](respondWithResult(_0x5c0a60,null))[_0x4ccd('0x4e')](APIHandleError(_0x5c0a60));};exports[_0x4ccd('0x105')]=function(_0x344cce,_0x5084c7){var _0x41e63d={};var _0x1d44d6={};var _0x20bd7e;var _0x538e09;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x344cce[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x5084c7,null))['then'](function(_0x28d71f){if(_0x28d71f){_0x20bd7e=_0x28d71f;_0x1d44d6['model']=_[_0x4ccd('0xc6')](db[_0x4ccd('0x106')]['rawAttributes']);_0x1d44d6['query']=_['keys'](_0x344cce[_0x4ccd('0x3a')]);_0x1d44d6[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x1d44d6['model'],_0x1d44d6[_0x4ccd('0x3a')]);_0x41e63d[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x1d44d6[_0x4ccd('0xc5')],qs['fields'](_0x344cce[_0x4ccd('0x3a')]['fields']));_0x41e63d['attributes']=_0x41e63d['attributes']['length']?_0x41e63d[_0x4ccd('0x40')]:_0x1d44d6[_0x4ccd('0xc5')];_0x41e63d[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x344cce['query']['sort']);_0x41e63d['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x344cce[_0x4ccd('0x3a')],_0x1d44d6['filters']));if(_0x344cce['query']['filter']){_0x41e63d[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x41e63d[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x41e63d[_0x4ccd('0x40')],function(_0x11190c){var _0x5e337c={};_0x5e337c[_0x11190c]={'$like':'%'+_0x344cce[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x5e337c;})});}_0x41e63d=_[_0x4ccd('0x4a')]({},_0x41e63d,_0x344cce['options']);return _0x20bd7e[_0x4ccd('0x105')](_0x41e63d);}})[_0x4ccd('0x1d')](function(_0x237101){if(_0x237101){_0x538e09=_0x237101[_0x4ccd('0x60')];if(!_0x344cce[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x41e63d[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x344cce[_0x4ccd('0x3a')]['limit']);_0x41e63d[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x344cce['query']['offset']);}return _0x20bd7e[_0x4ccd('0x105')](_0x41e63d);}})[_0x4ccd('0x1d')](function(_0xe12d95){if(_0xe12d95){return _0xe12d95?{'count':_0x538e09,'rows':_0xe12d95}:null;}})['then'](respondWithResult(_0x5084c7,null))['catch'](handleError(_0x5084c7,null));};exports[_0x4ccd('0x107')]=function(_0x49f723,_0x2da64f){var _0x57d59=_0x49f723[_0x4ccd('0x49')]['id'];var _0x2d0ad1=_0x49f723[_0x4ccd('0x50')]?_0x49f723[_0x4ccd('0x50')]['ids']:null;var _0xf357a5=[];return Promise[_0x4ccd('0xf7')]()['then'](function(){if(!_0x2d0ad1)throw new APIBadRequestError(_0x4ccd('0x108'));})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x57d59}});})[_0x4ccd('0x1d')](function(_0x581997){if(!_0x581997)throw new APINotFoundError(util[_0x4ccd('0xa1')](_0x4ccd('0x104'),_0x49f723['params']['id']));return db[_0x4ccd('0x5c')]['transaction'](function(_0x35d8e2){return _0x581997['addTeams'](_0x2d0ad1,{'transaction':_0x35d8e2})[_0x4ccd('0x1d')](function(){return db['Team'][_0x4ccd('0x82')]({'where':{'id':{'$in':_0x2d0ad1}}});})[_0x4ccd('0x1d')](function(_0xba128b){var _0x218b1f=_['map'](_0xba128b,function(_0x2944b8){return _0x2944b8['getAssociatedQueues']();});return Promise['all'](_0x218b1f);})[_0x4ccd('0x1d')](function(_0x46a0fb){_0xf357a5=_[_0x4ccd('0x109')](_0x46a0fb);var _0x5a5208=_['map'](_0xf357a5,function(_0xd94d34){return _0xd94d34[_0x4ccd('0x10a')](_0x581997['id'],{'transaction':_0x35d8e2});});return Promise[_0x4ccd('0x47')](_0x5a5208);})[_0x4ccd('0x1d')](function(){if(!_0x581997[_0x4ccd('0x94')])return;var _0x3a0178=_[_0x4ccd('0x27')](_0xf357a5,function(_0x4b469c){return _0x4b469c[_0x4ccd('0x10b')](_0x4ccd('0x93'))===_0x4ccd('0x10c');});var _0x41a378=_[_0x4ccd('0x81')](_0x3a0178,function(_0x448382){return db[_0x4ccd('0xa4')][_0x4ccd('0xed')]({'membername':_0x581997[_0x4ccd('0x2d')],'UserId':_0x581997['id'],'queue_name':_0x448382[_0x4ccd('0x2d')],'VoiceQueueId':_0x448382['id'],'interface':_[_0x4ccd('0x59')](_0x581997[_0x4ccd('0xa2')])?util[_0x4ccd('0xa1')](_0x4ccd('0xe6'),_0x581997[_0x4ccd('0x2d')]):_0x581997[_0x4ccd('0xa2')],'paused':_0x581997['voicePause']||![],'penalty':_0x581997[_0x4ccd('0xa3')]},{'transaction':_0x35d8e2});});return Promise[_0x4ccd('0x47')](_0x41a378);})['then'](function(){return db[_0x4ccd('0x10d')][_0x4ccd('0x82')]({'where':{'teamId':{'$in':_0x2d0ad1}}});})['then'](function(_0x416a13){var _0x218dbf=_[_0x4ccd('0x81')](_0x416a13,function(_0x2a2e88){return db['UserVoicePrefix'][_0x4ccd('0x74')]({'UserId':_0x581997['id'],'VoicePrefixId':_0x2a2e88['VoicePrefixId']},{'transaction':_0x35d8e2});});return Promise[_0x4ccd('0x47')](_0x218dbf);});});})[_0x4ccd('0x1d')](function(){for(var _0x42a132=0x0;_0x42a132<_0xf357a5['length'];_0x42a132++){var _0x45840e=_0xf357a5[_0x42a132][_0x4ccd('0x10b')](_0x4ccd('0x93'));var _0x463b20=_0x45840e+_0x4ccd('0x9e');socket['emit']('user'+_0x45840e+_0x4ccd('0x10e'),{'UserId':_0x57d59,['queueField']:_0xf357a5[_0x42a132]['id']});}})['then'](respondWithStatusCode(_0x2da64f,null))['catch'](APIHandleError(_0x2da64f));};exports[_0x4ccd('0x10f')]=function(_0x1ecffe,_0x105b0e){var _0x31c7ee=_0x1ecffe[_0x4ccd('0x49')]['id'];var _0x2ff8cd=null;if(_0x1ecffe['query'][_0x4ccd('0x53')]){_0x2ff8cd=_[_0x4ccd('0xa7')](_0x1ecffe[_0x4ccd('0x3a')]['ids'])?_0x1ecffe[_0x4ccd('0x3a')]['ids']:[_0x1ecffe['query'][_0x4ccd('0x53')]];}var _0x237be1=[];return Promise[_0x4ccd('0xf7')]()[_0x4ccd('0x1d')](function(){if(!_0x2ff8cd)throw new APIBadRequestError(_0x4ccd('0x110'));})['then'](function(){return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x31c7ee}});})[_0x4ccd('0x1d')](function(_0x561c1b){if(!_0x561c1b)throw new APINotFoundError(util[_0x4ccd('0xa1')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1ecffe['params']['id']));return db[_0x4ccd('0x5c')][_0x4ccd('0x111')](function(_0x23c8c9){return _0x561c1b['removeTeams'](_0x2ff8cd,{'transaction':_0x23c8c9})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0x106')][_0x4ccd('0x82')]({'where':{'id':{'$in':_0x2ff8cd}}});})[_0x4ccd('0x1d')](function(_0x352a87){var _0x288225=_[_0x4ccd('0x81')](_0x352a87,function(_0x47f934){return _0x47f934[_0x4ccd('0x112')]();});return Promise['all'](_0x288225);})[_0x4ccd('0x1d')](function(_0x5e090e){_0x237be1=_[_0x4ccd('0x109')](_0x5e090e);var _0x2f5ec3=_[_0x4ccd('0x81')](_0x237be1,function(_0x185386){return _0x185386[_0x4ccd('0x113')](_0x561c1b['id'],{'transaction':_0x23c8c9});});return Promise[_0x4ccd('0x47')](_0x2f5ec3);})[_0x4ccd('0x1d')](function(){if(!_0x561c1b['online'])return;var _0x29bc7e=_[_0x4ccd('0x27')](_0x237be1,function(_0x4885b9){return _0x4885b9[_0x4ccd('0x10b')](_0x4ccd('0x93'))==='Voice';});var _0x2922aa=_[_0x4ccd('0x81')](_0x29bc7e,function(_0x51e103){return db['UserVoiceQueueRt'][_0x4ccd('0x21')]({'where':{'VoiceQueueId':_0x51e103['id'],'UserId':_0x561c1b['id']},'transaction':_0x23c8c9});});return Promise['all'](_0x2922aa);})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0x10d')][_0x4ccd('0x82')]({'where':{'teamId':{'$in':_0x2ff8cd}}});})[_0x4ccd('0x1d')](function(_0xc2f96e){var _0x1ae2a2=_[_0x4ccd('0x81')](_0xc2f96e,function(_0x59b1d4){return db[_0x4ccd('0x114')][_0x4ccd('0x21')]({'where':{'UserId':_0x561c1b['id'],'VoicePrefixId':_0x59b1d4[_0x4ccd('0x115')]}},{'transaction':_0x23c8c9});});return Promise['all'](_0x1ae2a2);});});})['then'](function(){for(var _0x3d58f9=0x0;_0x3d58f9<_0x237be1[_0x4ccd('0x60')];_0x3d58f9++){var _0x599a00=_0x237be1[_0x3d58f9][_0x4ccd('0x10b')](_0x4ccd('0x93'));var _0x12a841=_0x599a00+_0x4ccd('0x9e');socket['emit'](_0x4ccd('0x24')+_0x599a00+_0x4ccd('0xa8'),{'UserId':_0x31c7ee,['queueField']:_0x237be1[_0x3d58f9]['id']});}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x105b0e,null))[_0x4ccd('0x4e')](APIHandleError(_0x105b0e));};exports[_0x4ccd('0x116')]=function(_0x14c34a,_0x300d10){var _0x585041={};var _0x5076db={};var _0x230fab;var _0x2a3bec;return db['User'][_0x4ccd('0x8e')]({'where':{'id':_0x14c34a['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x300d10,null))[_0x4ccd('0x1d')](function(_0x286e0e){if(_0x286e0e){_0x230fab=_0x286e0e;_0x5076db['model']=_[_0x4ccd('0xc6')](db[_0x4ccd('0xc1')]['rawAttributes']);_0x5076db[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x14c34a[_0x4ccd('0x3a')]);_0x5076db['filters']=_[_0x4ccd('0xc9')](_0x5076db[_0x4ccd('0xc5')],_0x5076db['query']);_0x585041[_0x4ccd('0x40')]=_['intersection'](_0x5076db[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x14c34a['query'][_0x4ccd('0xca')]));_0x585041[_0x4ccd('0x40')]=_0x585041[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x585041[_0x4ccd('0x40')]:_0x5076db[_0x4ccd('0xc5')];_0x585041[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x14c34a['query']['sort']);_0x585041[_0x4ccd('0x39')]=qs['filters'](_[_0x4ccd('0xcc')](_0x14c34a[_0x4ccd('0x3a')],_0x5076db[_0x4ccd('0xc8')]));if(_0x14c34a[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x585041['where']=_['merge'](_0x585041[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x585041[_0x4ccd('0x40')],function(_0x5bd5bf){var _0x1a5472={};_0x1a5472[_0x5bd5bf]={'$like':'%'+_0x14c34a[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x1a5472;})});}_0x585041=_[_0x4ccd('0x4a')]({},_0x585041,_0x14c34a[_0x4ccd('0xd2')]);return _0x230fab[_0x4ccd('0x116')](_0x585041);}})[_0x4ccd('0x1d')](function(_0x111654){if(_0x111654){_0x2a3bec=_0x111654[_0x4ccd('0x60')];if(!_0x14c34a['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x585041[_0x4ccd('0x19')]=qs['limit'](_0x14c34a[_0x4ccd('0x3a')]['limit']);_0x585041[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x14c34a[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x230fab[_0x4ccd('0x116')](_0x585041);}})[_0x4ccd('0x1d')](function(_0x4c1a68){if(_0x4c1a68){return _0x4c1a68?{'count':_0x2a3bec,'rows':_0x4c1a68}:null;}})['then'](respondWithResult(_0x300d10,null))[_0x4ccd('0x4e')](handleError(_0x300d10,null));};exports[_0x4ccd('0x117')]=function(_0x54887f,_0x25a062){var _0x3964d9={};var _0x1e60cf={};var _0x5dc128;return db['User'][_0x4ccd('0x8e')]({'where':{'id':_0x54887f[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x25a062,null))[_0x4ccd('0x1d')](function(_0x33e0fb){if(_0x33e0fb){_0x5dc128=_0x33e0fb;_0x1e60cf['model']=_[_0x4ccd('0xc6')](db['User']['rawAttributes']);_0x1e60cf[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x54887f[_0x4ccd('0x3a')]);_0x1e60cf['filters']=_[_0x4ccd('0xc9')](_0x1e60cf[_0x4ccd('0xc5')],_0x1e60cf[_0x4ccd('0x3a')]);_0x3964d9['attributes']=_[_0x4ccd('0xc9')](_0x1e60cf[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x54887f[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x3964d9[_0x4ccd('0x40')]=_0x3964d9['attributes']['length']?_0x3964d9[_0x4ccd('0x40')]:_0x1e60cf[_0x4ccd('0xc5')];_0x3964d9[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x54887f[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x3964d9[_0x4ccd('0x39')]=qs['filters'](_[_0x4ccd('0xcc')](_0x54887f['query'],_0x1e60cf['filters']));if(_0x54887f[_0x4ccd('0x3a')]['filter']){_0x3964d9[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x3964d9['where'],{'$or':_[_0x4ccd('0x81')](_0x3964d9[_0x4ccd('0x40')],function(_0x212ce8){var _0x5dafa7={};_0x5dafa7[_0x212ce8]={'$like':'%'+_0x54887f['query']['filter']+'%'};return _0x5dafa7;})});}_0x3964d9[_0x4ccd('0xc5')]=db[_0x4ccd('0x2f')];_0x3964d9['as']='Agents';_0x3964d9=_[_0x4ccd('0x4a')]({},_0x3964d9,_0x54887f[_0x4ccd('0xd2')]);return _0x5dc128[_0x4ccd('0x118')]({'include':[_0x3964d9]});}})['then'](function(_0xdd2734){if(_0xdd2734){var _0xa08013={},_0x3c184d=[];for(var _0x34ba73=0x0;_0x34ba73<_0xdd2734[_0x4ccd('0x60')];_0x34ba73+=0x1){for(var _0x241a73=0x0,_0x44c0f4;_0x241a73<_0xdd2734[_0x34ba73]['Agents'][_0x4ccd('0x60')];_0x241a73+=0x1){_0x44c0f4=_0xdd2734[_0x34ba73][_0x4ccd('0x7c')][_0x241a73][_0x4ccd('0x119')]({'plain':!![]});_0xa08013[_0x44c0f4['id']]=_0x44c0f4;}}_0xa08013=_[_0x4ccd('0x11a')](_0xa08013);for(var _0x3f8294=qs[_0x4ccd('0x17')](_0x54887f['query']['offset']);_0x3f8294<_0xa08013[_0x4ccd('0x60')]&&_0x3c184d['length']<qs[_0x4ccd('0x19')](_0x54887f['query']['limit']);_0x3f8294+=0x1){if(_0xa08013[_0x3f8294]){_0x3c184d[_0x4ccd('0x41')](_0xa08013[_0x3f8294]);}}return{'count':_0xa08013[_0x4ccd('0x60')],'rows':_0x3c184d};}})[_0x4ccd('0x1d')](respondWithResult(_0x25a062,null))[_0x4ccd('0x4e')](handleError(_0x25a062,null));};exports['destroy']=function(_0x1d5201,_0x1d1758){if(_0x1d5201[_0x4ccd('0x24')]['id']==_0x1d5201[_0x4ccd('0x49')]['id']){return _0x1d1758[_0x4ccd('0x14')](0x1f4)[_0x4ccd('0x2e')]({'message':_0x4ccd('0x11b')});}return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x1d5201[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x1d1758,null))[_0x4ccd('0x1d')](removeEntity(_0x1d1758,null))['catch'](handleError(_0x1d1758,null));};exports[_0x4ccd('0x11c')]=function(_0x4cbfd6,_0x56887d){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x4cbfd6['params']['id']}})['then'](handleEntityNotFound(_0x56887d,null))['then'](function(_0x11e42d){if(_0x11e42d){return _0x11e42d[_0x4ccd('0x11c')](_0x4cbfd6[_0x4ccd('0x50')][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x4cbfd6[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{})[_0x4ccd('0x9d')](function(){for(var _0x4adac6=0x0;_0x4adac6<_0x4cbfd6[_0x4ccd('0x50')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x4adac6+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x11e'),{'ChatInteractionId':Number(_0x4cbfd6[_0x4ccd('0x50')]['ids'][_0x4adac6]),'UserId':Number(_0x4cbfd6[_0x4ccd('0x49')]['id'])});}return _0x4cbfd6[_0x4ccd('0x50')][_0x4ccd('0x53')];});}})['then'](respondWithResult(_0x56887d,null))[_0x4ccd('0x4e')](handleError(_0x56887d,null));};exports['removeChatInteractions']=function(_0x59b013,_0x527856){return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x59b013['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x527856,null))[_0x4ccd('0x1d')](function(_0x489551){if(_0x489551){return _0x489551[_0x4ccd('0x11f')](_0x59b013[_0x4ccd('0x3a')][_0x4ccd('0x53')])[_0x4ccd('0x1d')](function(){if(_[_0x4ccd('0xa7')](_0x59b013['query'][_0x4ccd('0x53')])){for(var _0x34c9df=0x0;_0x34c9df<_0x59b013[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x34c9df+=0x1){socket[_0x4ccd('0x1f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x59b013[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x34c9df]),'UserId':Number(_0x59b013['params']['id'])});}}else{socket[_0x4ccd('0x1f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x59b013[_0x4ccd('0x3a')][_0x4ccd('0x53')]),'UserId':Number(_0x59b013[_0x4ccd('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x527856,null))['catch'](handleError(_0x527856,null));};exports[_0x4ccd('0x120')]=function(_0x1a22b0,_0x316c99){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x1a22b0[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x316c99,null))['then'](function(_0x513f04){if(_0x513f04){return _0x513f04[_0x4ccd('0x120')](_0x1a22b0[_0x4ccd('0x50')][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x1a22b0[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{})[_0x4ccd('0x9d')](function(){for(var _0x14e686=0x0;_0x14e686<_0x1a22b0[_0x4ccd('0x50')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x14e686+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x121'),{'MailInteractionId':Number(_0x1a22b0['body'][_0x4ccd('0x53')][_0x14e686]),'UserId':Number(_0x1a22b0['params']['id'])});}return _0x1a22b0[_0x4ccd('0x50')][_0x4ccd('0x53')];});}})[_0x4ccd('0x1d')](respondWithResult(_0x316c99,null))[_0x4ccd('0x4e')](handleError(_0x316c99,null));};exports[_0x4ccd('0x122')]=function(_0x59a689,_0x13b594){return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x59a689[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x13b594,null))['then'](function(_0x42107b){if(_0x42107b){return _0x42107b[_0x4ccd('0x122')](_0x59a689[_0x4ccd('0x3a')][_0x4ccd('0x53')])[_0x4ccd('0x1d')](function(){if(_[_0x4ccd('0xa7')](_0x59a689[_0x4ccd('0x3a')]['ids'])){for(var _0x4862b7=0x0;_0x4862b7<_0x59a689[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x4862b7+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x123'),{'MailInteractionId':Number(_0x59a689[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x4862b7]),'UserId':Number(_0x59a689[_0x4ccd('0x49')]['id'])});}}else{socket[_0x4ccd('0x1f')](_0x4ccd('0x123'),{'MailInteractionId':Number(_0x59a689[_0x4ccd('0x3a')][_0x4ccd('0x53')]),'UserId':Number(_0x59a689[_0x4ccd('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x13b594,null))[_0x4ccd('0x4e')](handleError(_0x13b594,null));};exports[_0x4ccd('0x124')]=function(_0x5c6ba9,_0x3217c7){return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x5c6ba9[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x3217c7,null))[_0x4ccd('0x1d')](function(_0x3f9eaa){if(_0x3f9eaa){return _0x3f9eaa[_0x4ccd('0x124')](_0x5c6ba9[_0x4ccd('0x50')][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x5c6ba9[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{})[_0x4ccd('0x9d')](function(){for(var _0x4d5187=0x0;_0x4d5187<_0x5c6ba9[_0x4ccd('0x50')]['ids'][_0x4ccd('0x60')];_0x4d5187+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x125'),{'FaxInteractionId':Number(_0x5c6ba9[_0x4ccd('0x50')]['ids'][_0x4d5187]),'UserId':Number(_0x5c6ba9[_0x4ccd('0x49')]['id'])});}return _0x5c6ba9[_0x4ccd('0x50')][_0x4ccd('0x53')];});}})[_0x4ccd('0x1d')](respondWithResult(_0x3217c7,null))[_0x4ccd('0x4e')](handleError(_0x3217c7,null));};exports[_0x4ccd('0x126')]=function(_0x24e0d4,_0x287ac3){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x24e0d4[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x287ac3,null))[_0x4ccd('0x1d')](function(_0x44ab53){if(_0x44ab53){return _0x44ab53[_0x4ccd('0x126')](_0x24e0d4['query'][_0x4ccd('0x53')])[_0x4ccd('0x1d')](function(){if(_[_0x4ccd('0xa7')](_0x24e0d4[_0x4ccd('0x3a')][_0x4ccd('0x53')])){for(var _0x3bf4d5=0x0;_0x3bf4d5<_0x24e0d4['query'][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x3bf4d5+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x127'),{'FaxInteractionId':Number(_0x24e0d4[_0x4ccd('0x3a')]['ids'][_0x3bf4d5]),'UserId':Number(_0x24e0d4[_0x4ccd('0x49')]['id'])});}}else{socket[_0x4ccd('0x1f')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x24e0d4[_0x4ccd('0x3a')][_0x4ccd('0x53')]),'UserId':Number(_0x24e0d4[_0x4ccd('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x287ac3,null))['catch'](handleError(_0x287ac3,null));};exports[_0x4ccd('0x128')]=function(_0x5cdb24,_0x3beb3d){return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x5cdb24[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x3beb3d,null))[_0x4ccd('0x1d')](function(_0x5b7e97){if(_0x5b7e97){return _0x5b7e97['addSmsInteractions'](_0x5cdb24[_0x4ccd('0x50')][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x5cdb24[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{})['spread'](function(){for(var _0x1454ae=0x0;_0x1454ae<_0x5cdb24[_0x4ccd('0x50')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x1454ae+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x129'),{'SmsInteractionId':Number(_0x5cdb24['body'][_0x4ccd('0x53')][_0x1454ae]),'UserId':Number(_0x5cdb24[_0x4ccd('0x49')]['id'])});}return _0x5cdb24[_0x4ccd('0x50')]['ids'];});}})[_0x4ccd('0x1d')](respondWithResult(_0x3beb3d,null))[_0x4ccd('0x4e')](handleError(_0x3beb3d,null));};exports[_0x4ccd('0x12a')]=function(_0x851c7e,_0x33fb07){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x851c7e['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x33fb07,null))[_0x4ccd('0x1d')](function(_0x555fdb){if(_0x555fdb){return _0x555fdb['removeSmsInteractions'](_0x851c7e[_0x4ccd('0x3a')]['ids'])[_0x4ccd('0x1d')](function(){if(_[_0x4ccd('0xa7')](_0x851c7e[_0x4ccd('0x3a')][_0x4ccd('0x53')])){for(var _0x736c8d=0x0;_0x736c8d<_0x851c7e[_0x4ccd('0x3a')]['ids'][_0x4ccd('0x60')];_0x736c8d+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x12b'),{'SmsInteractionId':Number(_0x851c7e[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x736c8d]),'UserId':Number(_0x851c7e[_0x4ccd('0x49')]['id'])});}}else{socket[_0x4ccd('0x1f')](_0x4ccd('0x12b'),{'SmsInteractionId':Number(_0x851c7e[_0x4ccd('0x3a')][_0x4ccd('0x53')]),'UserId':Number(_0x851c7e[_0x4ccd('0x49')]['id'])});}});}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x33fb07,null))[_0x4ccd('0x4e')](handleError(_0x33fb07,null));};exports[_0x4ccd('0x12c')]=function(_0x4b7e89,_0x2d2dd6){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x4b7e89[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x2d2dd6,null))['then'](function(_0xecf039){if(_0xecf039){return _0xecf039[_0x4ccd('0x12c')](_0x4b7e89[_0x4ccd('0x50')][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x4b7e89['body'],[_0x4ccd('0x53'),'id'])||{})[_0x4ccd('0x9d')](function(){for(var _0x42800c=0x0;_0x42800c<_0x4b7e89[_0x4ccd('0x50')][_0x4ccd('0x53')]['length'];_0x42800c+=0x1){socket['emit'](_0x4ccd('0x12d'),{'OpenchannelInteractionId':Number(_0x4b7e89[_0x4ccd('0x50')][_0x4ccd('0x53')][_0x42800c]),'UserId':Number(_0x4b7e89[_0x4ccd('0x49')]['id'])});}return _0x4b7e89['body'][_0x4ccd('0x53')];});}})[_0x4ccd('0x1d')](respondWithResult(_0x2d2dd6,null))[_0x4ccd('0x4e')](handleError(_0x2d2dd6,null));};exports['removeOpenchannelInteractions']=function(_0x61a4f1,_0x1b3733){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x61a4f1[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x1b3733,null))['then'](function(_0x46570c){if(_0x46570c){return _0x46570c['removeOpenchannelInteractions'](_0x61a4f1[_0x4ccd('0x3a')][_0x4ccd('0x53')])[_0x4ccd('0x1d')](function(){if(_['isArray'](_0x61a4f1['query'][_0x4ccd('0x53')])){for(var _0x10cd1c=0x0;_0x10cd1c<_0x61a4f1[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x4ccd('0x60')];_0x10cd1c+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x12e'),{'OpenchannelInteractionId':Number(_0x61a4f1[_0x4ccd('0x3a')][_0x4ccd('0x53')][_0x10cd1c]),'UserId':Number(_0x61a4f1['params']['id'])});}}else{socket[_0x4ccd('0x1f')](_0x4ccd('0x12e'),{'OpenchannelInteractionId':Number(_0x61a4f1[_0x4ccd('0x3a')][_0x4ccd('0x53')]),'UserId':Number(_0x61a4f1[_0x4ccd('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x1b3733,null))[_0x4ccd('0x4e')](handleError(_0x1b3733,null));};exports[_0x4ccd('0x12f')]=function(_0x5602c0,_0x4e35fd){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x5602c0[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x4e35fd,null))[_0x4ccd('0x1d')](function(_0x2c8547){if(_0x2c8547){return _0x2c8547[_0x4ccd('0x12f')](_0x5602c0[_0x4ccd('0x50')][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x5602c0['body'],[_0x4ccd('0x53'),'id'])||{})[_0x4ccd('0x9d')](function(){for(var _0x18b7ce=0x0;_0x18b7ce<_0x5602c0[_0x4ccd('0x50')][_0x4ccd('0x53')]['length'];_0x18b7ce+=0x1){socket[_0x4ccd('0x1f')](_0x4ccd('0x130'),{'WhatsappInteractionId':Number(_0x5602c0[_0x4ccd('0x50')]['ids'][_0x18b7ce]),'UserId':Number(_0x5602c0[_0x4ccd('0x49')]['id'])});}return _0x5602c0[_0x4ccd('0x50')][_0x4ccd('0x53')];});}})[_0x4ccd('0x1d')](respondWithResult(_0x4e35fd,null))[_0x4ccd('0x4e')](handleError(_0x4e35fd,null));};exports[_0x4ccd('0x131')]=function(_0x416396,_0x3c384f){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x416396[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x3c384f,null))[_0x4ccd('0x1d')](function(_0x4f2dee){if(_0x4f2dee){return _0x4f2dee['removeWhatsappInteractions'](_0x416396['query'][_0x4ccd('0x53')]);}})['then'](respondWithStatusCode(_0x3c384f,null))[_0x4ccd('0x4e')](handleError(_0x3c384f,null));};exports['getVoicePrefixes']=function(_0xb1085e,_0x3195a7){var _0x278e75={};var _0x39b821={};var _0x57dd80;var _0x1b37e9;return db['User'][_0x4ccd('0x8e')]({'where':{'id':_0xb1085e[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x3195a7,null))[_0x4ccd('0x1d')](function(_0x5e8545){if(_0x5e8545){_0x57dd80=_0x5e8545;_0x39b821[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0x132')]['rawAttributes']);_0x39b821[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0xb1085e[_0x4ccd('0x3a')]);_0x39b821[_0x4ccd('0xc8')]=_['intersection'](_0x39b821[_0x4ccd('0xc5')],_0x39b821[_0x4ccd('0x3a')]);_0x278e75[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x39b821[_0x4ccd('0xc5')],qs['fields'](_0xb1085e[_0x4ccd('0x3a')]['fields']));_0x278e75[_0x4ccd('0x40')]=_0x278e75[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x278e75[_0x4ccd('0x40')]:_0x39b821[_0x4ccd('0xc5')];_0x278e75[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0xb1085e['query']['sort']);_0x278e75['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0xb1085e[_0x4ccd('0x3a')],_0x39b821[_0x4ccd('0xc8')]));if(_0xb1085e['query'][_0x4ccd('0x27')]){_0x278e75[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x278e75[_0x4ccd('0x39')],{'$or':_['map'](_0x278e75[_0x4ccd('0x40')],function(_0x509573){var _0x32a1bd={};_0x32a1bd[_0x509573]={'$like':'%'+_0xb1085e[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x32a1bd;})});}_0x278e75=_[_0x4ccd('0x4a')]({},_0x278e75,_0xb1085e[_0x4ccd('0xd2')]);return _0x57dd80['getVoicePrefixes'](_0x278e75);}})['then'](function(_0x311f50){if(_0x311f50){_0x1b37e9=_0x311f50[_0x4ccd('0x60')];if(!_0xb1085e[_0x4ccd('0x3a')][_0x4ccd('0xce')]('nolimit')){_0x278e75[_0x4ccd('0x19')]=qs['limit'](_0xb1085e[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x278e75['offset']=qs[_0x4ccd('0x17')](_0xb1085e['query']['offset']);}return _0x57dd80[_0x4ccd('0x133')](_0x278e75);}})[_0x4ccd('0x1d')](function(_0x1634d2){if(_0x1634d2){return _0x1634d2?{'count':_0x1b37e9,'rows':_0x1634d2}:null;}})['then'](respondWithResult(_0x3195a7,null))[_0x4ccd('0x4e')](handleError(_0x3195a7,null));};exports[_0x4ccd('0x134')]=function(_0x414d4,_0x6b0d21){var _0x1304df={};var _0x416bc1={};var _0x10ee7f;var _0x4c8b3d;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x414d4['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x6b0d21,null))['then'](function(_0x204d14){if(_0x204d14){_0x10ee7f=_0x204d14;_0x416bc1['model']=_[_0x4ccd('0xc6')](db['FaxAccount']['rawAttributes']);_0x416bc1[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x414d4[_0x4ccd('0x3a')]);_0x416bc1['filters']=_[_0x4ccd('0xc9')](_0x416bc1[_0x4ccd('0xc5')],_0x416bc1['query']);_0x1304df[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x416bc1['model'],qs['fields'](_0x414d4[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x1304df['attributes']=_0x1304df[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x1304df[_0x4ccd('0x40')]:_0x416bc1[_0x4ccd('0xc5')];_0x1304df[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x414d4[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x1304df['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x414d4[_0x4ccd('0x3a')],_0x416bc1[_0x4ccd('0xc8')]));if(_0x414d4['query'][_0x4ccd('0x27')]){_0x1304df[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x1304df[_0x4ccd('0x39')],{'$or':_['map'](_0x1304df[_0x4ccd('0x40')],function(_0xf3c26f){var _0x7a57f1={};_0x7a57f1[_0xf3c26f]={'$like':'%'+_0x414d4[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x7a57f1;})});}_0x1304df=_[_0x4ccd('0x4a')]({},_0x1304df,_0x414d4[_0x4ccd('0xd2')]);return _0x10ee7f[_0x4ccd('0x134')](_0x1304df);}})[_0x4ccd('0x1d')](function(_0x3bfd8a){if(_0x3bfd8a){_0x4c8b3d=_0x3bfd8a['length'];if(!_0x414d4[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x1304df[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x414d4[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x1304df[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x414d4[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x10ee7f[_0x4ccd('0x134')](_0x1304df);}})[_0x4ccd('0x1d')](function(_0x2507a0){if(_0x2507a0){return _0x2507a0?{'count':_0x4c8b3d,'rows':_0x2507a0}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x6b0d21,null))[_0x4ccd('0x4e')](handleError(_0x6b0d21,null));};exports[_0x4ccd('0x135')]=function(_0x33f396,_0x13f64d){return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x33f396[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x13f64d,null))[_0x4ccd('0x1d')](function(_0x31b291){if(_0x31b291){return _0x31b291['addFaxAccounts'](_0x33f396[_0x4ccd('0x50')][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x33f396[_0x4ccd('0x50')],['ids','id'])||{});}})[_0x4ccd('0x1d')](respondWithResult(_0x13f64d,null))[_0x4ccd('0x4e')](handleError(_0x13f64d,null));};exports['removeFaxAccounts']=function(_0x16c061,_0x3c7d74){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x16c061[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x3c7d74,null))[_0x4ccd('0x1d')](function(_0x27162d){if(_0x27162d){return _0x27162d['removeFaxAccounts'](_0x16c061['query'][_0x4ccd('0x53')]);}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x3c7d74,null))[_0x4ccd('0x4e')](handleError(_0x3c7d74,null));};exports[_0x4ccd('0x136')]=function(_0x294a2d,_0x5a15a4){var _0x487895={};var _0x8bd5d6={};var _0x55f0dc;var _0x161139;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x294a2d['params']['id']}})['then'](handleEntityNotFound(_0x5a15a4,null))[_0x4ccd('0x1d')](function(_0x1da2cf){if(_0x1da2cf){_0x55f0dc=_0x1da2cf;_0x8bd5d6[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db[_0x4ccd('0x137')][_0x4ccd('0x30')]);_0x8bd5d6[_0x4ccd('0x3a')]=_['keys'](_0x294a2d[_0x4ccd('0x3a')]);_0x8bd5d6[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x8bd5d6[_0x4ccd('0xc5')],_0x8bd5d6[_0x4ccd('0x3a')]);_0x487895[_0x4ccd('0x40')]=_['intersection'](_0x8bd5d6[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x294a2d[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x487895[_0x4ccd('0x40')]=_0x487895['attributes'][_0x4ccd('0x60')]?_0x487895['attributes']:_0x8bd5d6['model'];_0x487895[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x294a2d[_0x4ccd('0x3a')]['sort']);_0x487895[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x294a2d[_0x4ccd('0x3a')],_0x8bd5d6[_0x4ccd('0xc8')]));if(_0x294a2d[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x487895['where']=_[_0x4ccd('0x4a')](_0x487895[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x487895[_0x4ccd('0x40')],function(_0x475694){var _0x258561={};_0x258561[_0x475694]={'$like':'%'+_0x294a2d[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x258561;})});}_0x487895=_['merge']({},_0x487895,_0x294a2d[_0x4ccd('0xd2')]);return _0x55f0dc[_0x4ccd('0x136')](_0x487895);}})[_0x4ccd('0x1d')](function(_0x3864f2){if(_0x3864f2){_0x161139=_0x3864f2[_0x4ccd('0x60')];if(!_0x294a2d[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0xcf'))){_0x487895[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x294a2d[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x487895[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x294a2d[_0x4ccd('0x3a')]['offset']);}return _0x55f0dc['getMailAccounts'](_0x487895);}})[_0x4ccd('0x1d')](function(_0x42786d){if(_0x42786d){return _0x42786d?{'count':_0x161139,'rows':_0x42786d}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x5a15a4,null))['catch'](handleError(_0x5a15a4,null));};exports['addMailAccounts']=function(_0x239860,_0xede273){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x239860[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0xede273,null))[_0x4ccd('0x1d')](function(_0x5d34ab){if(_0x5d34ab){return _0x5d34ab[_0x4ccd('0x138')](_0x239860['body'][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x239860[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{});}})[_0x4ccd('0x1d')](respondWithResult(_0xede273,null))[_0x4ccd('0x4e')](handleError(_0xede273,null));};exports[_0x4ccd('0x139')]=function(_0x57bd8b,_0x53644d){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x57bd8b['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x53644d,null))[_0x4ccd('0x1d')](function(_0x3ae30d){if(_0x3ae30d){return _0x3ae30d['removeMailAccounts'](_0x57bd8b['query'][_0x4ccd('0x53')]);}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x53644d,null))[_0x4ccd('0x4e')](handleError(_0x53644d,null));};exports[_0x4ccd('0x13a')]=function(_0x3c9ee3,_0x5951bb){var _0x253a2e={};var _0x2939f4={};var _0x4704ea;var _0x2b8d93;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x3c9ee3[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x5951bb,null))[_0x4ccd('0x1d')](function(_0x54f06e){if(_0x54f06e){_0x4704ea=_0x54f06e;_0x2939f4['model']=_[_0x4ccd('0xc6')](db[_0x4ccd('0x13b')][_0x4ccd('0x30')]);_0x2939f4['query']=_[_0x4ccd('0xc6')](_0x3c9ee3[_0x4ccd('0x3a')]);_0x2939f4['filters']=_[_0x4ccd('0xc9')](_0x2939f4[_0x4ccd('0xc5')],_0x2939f4[_0x4ccd('0x3a')]);_0x253a2e[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x2939f4[_0x4ccd('0xc5')],qs[_0x4ccd('0xca')](_0x3c9ee3[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x253a2e[_0x4ccd('0x40')]=_0x253a2e['attributes']['length']?_0x253a2e[_0x4ccd('0x40')]:_0x2939f4[_0x4ccd('0xc5')];_0x253a2e[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x3c9ee3[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x253a2e[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x3c9ee3[_0x4ccd('0x3a')],_0x2939f4[_0x4ccd('0xc8')]));if(_0x3c9ee3[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x253a2e['where']=_[_0x4ccd('0x4a')](_0x253a2e[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x253a2e['attributes'],function(_0x36dca9){var _0x485b4a={};_0x485b4a[_0x36dca9]={'$like':'%'+_0x3c9ee3[_0x4ccd('0x3a')]['filter']+'%'};return _0x485b4a;})});}_0x253a2e=_[_0x4ccd('0x4a')]({},_0x253a2e,_0x3c9ee3['options']);return _0x4704ea[_0x4ccd('0x13a')](_0x253a2e);}})[_0x4ccd('0x1d')](function(_0x1ab961){if(_0x1ab961){_0x2b8d93=_0x1ab961[_0x4ccd('0x60')];if(!_0x3c9ee3[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x253a2e[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x3c9ee3[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x253a2e['offset']=qs[_0x4ccd('0x17')](_0x3c9ee3['query'][_0x4ccd('0x17')]);}return _0x4704ea[_0x4ccd('0x13a')](_0x253a2e);}})[_0x4ccd('0x1d')](function(_0x579478){if(_0x579478){return _0x579478?{'count':_0x2b8d93,'rows':_0x579478}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x5951bb,null))['catch'](handleError(_0x5951bb,null));};exports[_0x4ccd('0x13c')]=function(_0x3d0af5,_0x1128cb){return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x3d0af5[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x1128cb,null))[_0x4ccd('0x1d')](function(_0x2e4e51){if(_0x2e4e51){return _0x2e4e51['addOpenchannelAccounts'](_0x3d0af5['body'][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x3d0af5[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{});}})['then'](respondWithResult(_0x1128cb,null))[_0x4ccd('0x4e')](handleError(_0x1128cb,null));};exports[_0x4ccd('0x13d')]=function(_0x23694d,_0xfbfb64){return db['User']['find']({'where':{'id':_0x23694d[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0xfbfb64,null))[_0x4ccd('0x1d')](function(_0xcd0677){if(_0xcd0677){return _0xcd0677[_0x4ccd('0x13d')](_0x23694d[_0x4ccd('0x3a')]['ids']);}})[_0x4ccd('0x1d')](respondWithStatusCode(_0xfbfb64,null))[_0x4ccd('0x4e')](handleError(_0xfbfb64,null));};exports['getSmsAccounts']=function(_0x4f8ce4,_0x4c5360){var _0x3c8f0a={};var _0x290b86={};var _0x330951;var _0x5a01ae;return db[_0x4ccd('0x2f')]['findOne']({'where':{'id':_0x4f8ce4[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x4c5360,null))[_0x4ccd('0x1d')](function(_0x2df9f9){if(_0x2df9f9){_0x330951=_0x2df9f9;_0x290b86['model']=_[_0x4ccd('0xc6')](db['SmsAccount'][_0x4ccd('0x30')]);_0x290b86[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x4f8ce4[_0x4ccd('0x3a')]);_0x290b86[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x290b86[_0x4ccd('0xc5')],_0x290b86[_0x4ccd('0x3a')]);_0x3c8f0a[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x290b86['model'],qs[_0x4ccd('0xca')](_0x4f8ce4[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x3c8f0a[_0x4ccd('0x40')]=_0x3c8f0a[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x3c8f0a[_0x4ccd('0x40')]:_0x290b86[_0x4ccd('0xc5')];_0x3c8f0a['order']=qs[_0x4ccd('0xcb')](_0x4f8ce4[_0x4ccd('0x3a')][_0x4ccd('0xcb')]);_0x3c8f0a['where']=qs['filters'](_[_0x4ccd('0xcc')](_0x4f8ce4['query'],_0x290b86[_0x4ccd('0xc8')]));if(_0x4f8ce4[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x3c8f0a['where']=_[_0x4ccd('0x4a')](_0x3c8f0a[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x3c8f0a[_0x4ccd('0x40')],function(_0x21951c){var _0x345756={};_0x345756[_0x21951c]={'$like':'%'+_0x4f8ce4[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x345756;})});}_0x3c8f0a=_[_0x4ccd('0x4a')]({},_0x3c8f0a,_0x4f8ce4[_0x4ccd('0xd2')]);return _0x330951[_0x4ccd('0x13e')](_0x3c8f0a);}})[_0x4ccd('0x1d')](function(_0x2e73b9){if(_0x2e73b9){_0x5a01ae=_0x2e73b9[_0x4ccd('0x60')];if(!_0x4f8ce4[_0x4ccd('0x3a')][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x3c8f0a[_0x4ccd('0x19')]=qs['limit'](_0x4f8ce4[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x3c8f0a['offset']=qs['offset'](_0x4f8ce4[_0x4ccd('0x3a')]['offset']);}return _0x330951[_0x4ccd('0x13e')](_0x3c8f0a);}})['then'](function(_0x269fa7){if(_0x269fa7){return _0x269fa7?{'count':_0x5a01ae,'rows':_0x269fa7}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x4c5360,null))[_0x4ccd('0x4e')](handleError(_0x4c5360,null));};exports[_0x4ccd('0x13f')]=function(_0x246208,_0x24440a){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x246208[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x24440a,null))[_0x4ccd('0x1d')](function(_0x458c21){if(_0x458c21){return _0x458c21[_0x4ccd('0x13f')](_0x246208[_0x4ccd('0x50')][_0x4ccd('0x53')],_['omit'](_0x246208[_0x4ccd('0x50')],['ids','id'])||{});}})[_0x4ccd('0x1d')](respondWithResult(_0x24440a,null))['catch'](handleError(_0x24440a,null));};exports[_0x4ccd('0x140')]=function(_0x456ed0,_0x243b03){return db['User'][_0x4ccd('0x2b')]({'where':{'id':_0x456ed0['params']['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x243b03,null))[_0x4ccd('0x1d')](function(_0x4f4564){if(_0x4f4564){return _0x4f4564[_0x4ccd('0x140')](_0x456ed0['query'][_0x4ccd('0x53')]);}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x243b03,null))['catch'](handleError(_0x243b03,null));};exports[_0x4ccd('0x141')]=function(_0x5b9ba6,_0x397658){var _0x420c3a={};var _0x47311f={};var _0x5f0ad5;var _0x13cb1f;return db['User'][_0x4ccd('0x8e')]({'where':{'id':_0x5b9ba6[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x397658,null))[_0x4ccd('0x1d')](function(_0x1f0136){if(_0x1f0136){_0x5f0ad5=_0x1f0136;_0x47311f['model']=_[_0x4ccd('0xc6')](db[_0x4ccd('0x142')]['rawAttributes']);_0x47311f[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x5b9ba6[_0x4ccd('0x3a')]);_0x47311f[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x47311f[_0x4ccd('0xc5')],_0x47311f[_0x4ccd('0x3a')]);_0x420c3a['attributes']=_['intersection'](_0x47311f[_0x4ccd('0xc5')],qs['fields'](_0x5b9ba6[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x420c3a['attributes']=_0x420c3a['attributes'][_0x4ccd('0x60')]?_0x420c3a[_0x4ccd('0x40')]:_0x47311f[_0x4ccd('0xc5')];_0x420c3a[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x5b9ba6['query'][_0x4ccd('0xcb')]);_0x420c3a[_0x4ccd('0x39')]=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x5b9ba6[_0x4ccd('0x3a')],_0x47311f[_0x4ccd('0xc8')]));if(_0x5b9ba6[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x420c3a['where']=_[_0x4ccd('0x4a')](_0x420c3a['where'],{'$or':_['map'](_0x420c3a['attributes'],function(_0x1b5da5){var _0x5a8057={};_0x5a8057[_0x1b5da5]={'$like':'%'+_0x5b9ba6[_0x4ccd('0x3a')][_0x4ccd('0x27')]+'%'};return _0x5a8057;})});}_0x420c3a=_[_0x4ccd('0x4a')]({},_0x420c3a,_0x5b9ba6[_0x4ccd('0xd2')]);return _0x5f0ad5[_0x4ccd('0x141')](_0x420c3a);}})[_0x4ccd('0x1d')](function(_0x2d5216){if(_0x2d5216){_0x13cb1f=_0x2d5216[_0x4ccd('0x60')];if(!_0x5b9ba6['query'][_0x4ccd('0xce')]('nolimit')){_0x420c3a['limit']=qs[_0x4ccd('0x19')](_0x5b9ba6[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x420c3a[_0x4ccd('0x17')]=qs[_0x4ccd('0x17')](_0x5b9ba6[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x5f0ad5['getChatWebsites'](_0x420c3a);}})[_0x4ccd('0x1d')](function(_0x35d4c3){if(_0x35d4c3){return _0x35d4c3?{'count':_0x13cb1f,'rows':_0x35d4c3}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x397658,null))['catch'](handleError(_0x397658,null));};exports[_0x4ccd('0x143')]=function(_0x4f1bfe,_0x55cbb2){return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x4f1bfe[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x55cbb2,null))['then'](function(_0x5e5eb2){if(_0x5e5eb2){return _0x5e5eb2[_0x4ccd('0x143')](_0x4f1bfe['body'][_0x4ccd('0x53')],_[_0x4ccd('0x11d')](_0x4f1bfe[_0x4ccd('0x50')],[_0x4ccd('0x53'),'id'])||{});}})[_0x4ccd('0x1d')](respondWithResult(_0x55cbb2,null))[_0x4ccd('0x4e')](handleError(_0x55cbb2,null));};exports[_0x4ccd('0x144')]=function(_0x5c10f7,_0x23c4a8){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x5c10f7[_0x4ccd('0x49')]['id']}})['then'](handleEntityNotFound(_0x23c4a8,null))[_0x4ccd('0x1d')](function(_0x382f7f){if(_0x382f7f){return _0x382f7f[_0x4ccd('0x144')](_0x5c10f7['query'][_0x4ccd('0x53')]);}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x23c4a8,null))[_0x4ccd('0x4e')](handleError(_0x23c4a8,null));};exports[_0x4ccd('0x145')]=function(_0x1ee001,_0x136b33){var _0x45f404={};var _0x17e6b9={};var _0x93fe3;var _0x3518f4;return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0x1ee001['params']['id']}})['then'](handleEntityNotFound(_0x136b33,null))['then'](function(_0x45f1ac){if(_0x45f1ac){_0x93fe3=_0x45f1ac;_0x17e6b9[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](db['WhatsappAccount'][_0x4ccd('0x30')]);_0x17e6b9[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x1ee001[_0x4ccd('0x3a')]);_0x17e6b9[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x17e6b9[_0x4ccd('0xc5')],_0x17e6b9[_0x4ccd('0x3a')]);_0x45f404[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x17e6b9['model'],qs[_0x4ccd('0xca')](_0x1ee001[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x45f404[_0x4ccd('0x40')]=_0x45f404[_0x4ccd('0x40')][_0x4ccd('0x60')]?_0x45f404['attributes']:_0x17e6b9[_0x4ccd('0xc5')];_0x45f404[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x1ee001[_0x4ccd('0x3a')]['sort']);_0x45f404['where']=qs[_0x4ccd('0xc8')](_[_0x4ccd('0xcc')](_0x1ee001[_0x4ccd('0x3a')],_0x17e6b9[_0x4ccd('0xc8')]));if(_0x1ee001[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x45f404[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x45f404[_0x4ccd('0x39')],{'$or':_[_0x4ccd('0x81')](_0x45f404[_0x4ccd('0x40')],function(_0x5b56e7){var _0x16cbb4={};_0x16cbb4[_0x5b56e7]={'$like':'%'+_0x1ee001['query'][_0x4ccd('0x27')]+'%'};return _0x16cbb4;})});}_0x45f404=_[_0x4ccd('0x4a')]({},_0x45f404,_0x1ee001[_0x4ccd('0xd2')]);return _0x93fe3['getWhatsappAccounts'](_0x45f404);}})[_0x4ccd('0x1d')](function(_0x446377){if(_0x446377){_0x3518f4=_0x446377[_0x4ccd('0x60')];if(!_0x1ee001[_0x4ccd('0x3a')]['hasOwnProperty'](_0x4ccd('0xcf'))){_0x45f404['limit']=qs[_0x4ccd('0x19')](_0x1ee001[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x45f404['offset']=qs[_0x4ccd('0x17')](_0x1ee001[_0x4ccd('0x3a')][_0x4ccd('0x17')]);}return _0x93fe3[_0x4ccd('0x145')](_0x45f404);}})[_0x4ccd('0x1d')](function(_0x278c03){if(_0x278c03){return _0x278c03?{'count':_0x3518f4,'rows':_0x278c03}:null;}})[_0x4ccd('0x1d')](respondWithResult(_0x136b33,null))[_0x4ccd('0x4e')](handleError(_0x136b33,null));};exports[_0x4ccd('0x146')]=function(_0x2aea69,_0x5f2c96){return db[_0x4ccd('0x2f')][_0x4ccd('0x2b')]({'where':{'id':_0x2aea69[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x5f2c96,null))['then'](function(_0x557c34){if(_0x557c34){return _0x557c34[_0x4ccd('0x146')](_0x2aea69['body']['ids'],_[_0x4ccd('0x11d')](_0x2aea69[_0x4ccd('0x50')],['ids','id'])||{});}})[_0x4ccd('0x1d')](respondWithResult(_0x5f2c96,null))['catch'](handleError(_0x5f2c96,null));};exports['removeWhatsappAccounts']=function(_0x4e17d6,_0x299026){return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x4e17d6[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x299026,null))['then'](function(_0x347607){if(_0x347607){return _0x347607[_0x4ccd('0x147')](_0x4e17d6['query']['ids']);}})['then'](respondWithStatusCode(_0x299026,null))[_0x4ccd('0x4e')](handleError(_0x299026,null));};exports[_0x4ccd('0x148')]=function(_0x42fcb1,_0xa28cd7){var _0x4b4391={},_0x18533d={},_0x24c46a={'count':0x0,'rows':[]};var _0x2e3f99=db[_0x4ccd('0x149')]['rawAttributes'];_0x18533d[_0x4ccd('0xc5')]=_[_0x4ccd('0xc6')](_0x2e3f99);_0x18533d[_0x4ccd('0x3a')]=_[_0x4ccd('0xc6')](_0x42fcb1[_0x4ccd('0x3a')]);_0x18533d[_0x4ccd('0xc8')]=_[_0x4ccd('0xc9')](_0x18533d['model'],_0x18533d[_0x4ccd('0x3a')]);_0x18533d['filters']=_[_0x4ccd('0x14a')](_0x18533d[_0x4ccd('0xc8')],['$and',_0x4ccd('0x14b'),'$gt',_0x4ccd('0x14c'),_0x4ccd('0x14d'),'$lte',_0x4ccd('0x14e'),_0x4ccd('0x14f'),_0x4ccd('0x150'),'$between',_0x4ccd('0x151'),'$in',_0x4ccd('0x152'),_0x4ccd('0x153'),_0x4ccd('0x154'),_0x4ccd('0x155'),_0x4ccd('0x156'),'$like',_0x4ccd('0x157'),_0x4ccd('0x158'),_0x4ccd('0x159'),'$any']);_0x4b4391[_0x4ccd('0x40')]=_[_0x4ccd('0xc9')](_0x18533d[_0x4ccd('0xc5')],qs['fields'](_0x42fcb1[_0x4ccd('0x3a')][_0x4ccd('0xca')]));_0x4b4391[_0x4ccd('0x40')]=_0x4b4391['attributes']['length']?_0x4b4391['attributes']:_0x18533d[_0x4ccd('0xc5')];if(!_0x42fcb1['query'][_0x4ccd('0xce')](_0x4ccd('0xcf'))){_0x4b4391[_0x4ccd('0x19')]=qs['limit'](_0x42fcb1[_0x4ccd('0x3a')][_0x4ccd('0x19')]);_0x4b4391['offset']=qs[_0x4ccd('0x17')](_0x42fcb1[_0x4ccd('0x3a')]['offset']);}_0x4b4391[_0x4ccd('0xd1')]=qs[_0x4ccd('0xcb')](_0x42fcb1[_0x4ccd('0x3a')]['sort']);_0x4b4391['where']=qs[_0x4ccd('0xc8')](_['pick'](_0x42fcb1['query'],_0x18533d[_0x4ccd('0xc8')]));if(_0x42fcb1[_0x4ccd('0x3a')][_0x4ccd('0x27')]){_0x4b4391[_0x4ccd('0x39')]=_[_0x4ccd('0x4a')](_0x4b4391['where'],{'$or':_[_0x4ccd('0x81')](_0x4b4391[_0x4ccd('0x40')],function(_0x9c7c19){var _0x2ef87b={};_0x2ef87b[_0x9c7c19]={'$like':'%'+_0x42fcb1['query'][_0x4ccd('0x27')]+'%'};return _0x2ef87b;})});}_0x4b4391[_0x4ccd('0x39')]={'$and':[_0x4b4391[_0x4ccd('0x39')],{'$or':[{'UserId':_0x42fcb1['params']['id']},{'OwnerId':_0x42fcb1[_0x4ccd('0x49')]['id']}]}]};_0x4b4391=_[_0x4ccd('0x4a')]({},_0x4b4391,_0x42fcb1[_0x4ccd('0xd2')]);var _0x32ced7={'where':_0x4b4391[_0x4ccd('0x39')]};return db[_0x4ccd('0x149')][_0x4ccd('0x1a')](_0x32ced7)[_0x4ccd('0x1d')](function(_0x450559){_0x24c46a[_0x4ccd('0x1a')]=_0x450559;if(_0x42fcb1[_0x4ccd('0x3a')][_0x4ccd('0x3b')]){_0x4b4391[_0x4ccd('0x3c')]=[{'attributes':['id',_0x4ccd('0x15a'),'lastName','phone'],'model':db[_0x4ccd('0x15b')],'as':'Contact'},{'attributes':['id',_0x4ccd('0x2d'),'dialActive'],'model':db[_0x4ccd('0x9f')],'as':'Queue'}];}return db[_0x4ccd('0x149')]['findAll'](_0x4b4391);})[_0x4ccd('0x1d')](function(_0x45ce52){_0x24c46a['rows']=_0x45ce52;return _0x24c46a;})[_0x4ccd('0x1d')](respondWithFilteredResult(_0xa28cd7,_0x4b4391))[_0x4ccd('0x4e')](handleError(_0xa28cd7,null));};exports['getApiKey']=function(_0xe16538,_0x55612f){if(!_[_0x4ccd('0x59')](_0xe16538[_0x4ccd('0x24')]['id'])&&(_0xe16538['user'][_0x4ccd('0x22')]==_0x4ccd('0x76')||_0xe16538[_0x4ccd('0x24')][_0x4ccd('0x22')]==_0x4ccd('0x24'))){return db[_0x4ccd('0x2f')][_0x4ccd('0x8e')]({'where':{'id':_0xe16538[_0x4ccd('0x49')]['id']},'raw':!![]})['then'](function(_0x59e889){return authService[_0x4ccd('0x15c')](_0x59e889);})[_0x4ccd('0x1d')](function(_0x4e312c){if(_0x4e312c){return _0x55612f[_0x4ccd('0x14')](0xc8)[_0x4ccd('0x16')]({'api_key':_0x4e312c[_0x4ccd('0x15d')]});}else{return _0x55612f['status'](0xcc)[_0x4ccd('0x16')]({'message':_0x4ccd('0x15e')});}})[_0x4ccd('0x4e')](handleError(_0x55612f,0x193));}else{return _0x55612f[_0x4ccd('0x14')](0x191)[_0x4ccd('0x16')]({'message':_0x4ccd('0x15f')});}};exports['createApiKey']=function(_0x54b25a,_0x13e01a){if(!_[_0x4ccd('0x59')](_0x54b25a[_0x4ccd('0x24')]['id'])&&(_0x54b25a[_0x4ccd('0x24')][_0x4ccd('0x22')]==_0x4ccd('0x76')||_0x54b25a[_0x4ccd('0x24')][_0x4ccd('0x22')]==_0x4ccd('0x24'))){return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x54b25a[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](function(_0x5d826f){return authService['generateApiKey'](_0x5d826f);})[_0x4ccd('0x1d')](function(_0x96a857){return db['User'][_0x4ccd('0x4f')]({'apiKeyIat':_0x96a857['iat'],'apiKeyNonce':_0x96a857[_0x4ccd('0x160')]},{'where':{'id':_0x54b25a[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](function(){return _0x13e01a['status'](0xc8)[_0x4ccd('0x16')]({'api_key':_0x96a857[_0x4ccd('0x15d')]});});})[_0x4ccd('0x4e')](handleError(_0x13e01a,0x193));}else{return _0x13e01a[_0x4ccd('0x14')](0x191)[_0x4ccd('0x16')]({'message':'You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.'});}};exports['removeApiKey']=function(_0x41d1c3,_0x3e05e8){if(!_[_0x4ccd('0x59')](_0x41d1c3['user']['id'])&&(_0x41d1c3[_0x4ccd('0x24')]['role']==_0x4ccd('0x76')||_0x41d1c3['user'][_0x4ccd('0x22')]=='user')){return db[_0x4ccd('0x2f')]['find']({'where':{'id':_0x41d1c3[_0x4ccd('0x49')]['id']}})[_0x4ccd('0x1d')](handleEntityNotFound(_0x3e05e8,null))['then'](function(_0x2ea83b){if(_0x2ea83b&&_0x2ea83b['apiKeyNonce']&&_0x2ea83b['apiKeyIat'])return _0x2ea83b;else throw{'message':_0x4ccd('0x161')};})[_0x4ccd('0x1d')](function(){return db[_0x4ccd('0x2f')]['update']({'apiKeyNonce':null,'apiKeyIat':null},{'where':{'id':_0x41d1c3[_0x4ccd('0x49')]['id']}});})[_0x4ccd('0x1d')](respondWithStatusCode(_0x3e05e8,0xc8))['catch'](handleError(_0x3e05e8,0x193));}else{return _0x3e05e8[_0x4ccd('0x14')](0x191)[_0x4ccd('0x16')]({'message':_0x4ccd('0x15f')});}};exports[_0x4ccd('0x162')]=function(_0x43776d,_0x5697f1){var _0x60aad1=_0x43776d[_0x4ccd('0x24')][_0x4ccd('0x119')]({'plain':!![]});if(!_0x60aad1){return _0x5697f1[_0x4ccd('0x14')](0x191)['send'](_0x4ccd('0x163'));}else{Promise['resolve']()[_0x4ccd('0x1d')](function(){if(_0x43776d['query'][_0x4ccd('0x3d')]!=='true')return;return _0x43776d[_0x4ccd('0x24')][_0x4ccd('0x164')]();})[_0x4ccd('0x1d')](function(_0xb4d377){if(!_0xb4d377)return;return _0xb4d377[_0x4ccd('0x119')]({'plain':!![]});})[_0x4ccd('0x1d')](function(_0xfcc16b){_0x60aad1[_0x4ccd('0x3d')]=_0xfcc16b;return _0x5697f1[_0x4ccd('0x14')](0xc8)[_0x4ccd('0x16')](_0x60aad1);});}};exports[_0x4ccd('0x165')]=function(_0x318d8d,_0x19567a){var _0x3bc17b={'offset':0x0};var _0x5ad143={'count':0x0,'rows':[]};var _0x5a7de4=['idle','unknown',_0x4ccd('0x166')];var _0xbc2b9a=[];var _0x359656=[];var _0x3a9f99=[];var _0x3cd245=_0x318d8d['query']['teams'];var _0x28aa76=_0x318d8d[_0x4ccd('0x3a')]['queues'];var _0x54f0c1=_0x318d8d['query'][_0x4ccd('0x27')];return Promise[_0x4ccd('0xf7')]()['then'](function(){if(!_0x3cd245){return[];}return db[_0x4ccd('0x106')]['findAll']({'attributes':['id',_0x4ccd('0x2d')],'where':{'id':_0x3cd245}});})['then'](function(_0x2dff61){_0x3a9f99=_0x2dff61;if(!_0x28aa76){return[];}return db['VoiceQueue'][_0x4ccd('0x82')]({'attributes':['id',_0x4ccd('0x2d')],'type':_0x4ccd('0x167'),'where':{'id':_0x28aa76}});})[_0x4ccd('0x1d')](function(_0x94d1eb){_0x359656=_0x94d1eb;var _0x1060e0=_0x3a9f99[_0x4ccd('0x14a')](_0x359656)[_0x4ccd('0x81')](function(_0x5175e1){return _0x5175e1[_0x4ccd('0x117')]({'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x5b'),_0x4ccd('0x94')],'raw':!![]});});return Promise['all'](_0x1060e0);})['then'](function(_0xbffa2d){var _0x392a8e=_[_0x4ccd('0x168')](_0xbffa2d);if(_0x54f0c1){if(_0x28aa76||_0x3cd245){return _0x392a8e[_0x4ccd('0x27')](function(_0x1902b8){return _0x1902b8['name']['toLowerCase']()['includes'](_0x54f0c1['toLowerCase']())||_0x1902b8[_0x4ccd('0x5b')]['toString']()[_0x4ccd('0x2a')](_0x54f0c1);});}else{return db['User']['findAll']({'attributes':['id',_0x4ccd('0x2d'),_0x4ccd('0x5b'),_0x4ccd('0x94')],'where':{'role':_0x4ccd('0x1e'),'$or':[db[_0x4ccd('0x5c')]['where'](db[_0x4ccd('0x5c')]['fn'](_0x4ccd('0x169'),db['sequelize'][_0x4ccd('0x16a')]('name')),{'$like':'%'+_0x54f0c1[_0x4ccd('0x9b')]()+'%'}),{'internal':{'$like':'%'+_0x54f0c1+'%'}}]},'raw':!![]});}}else{return _0x392a8e;}})['then'](function(_0x1b204e){var _0x14b2ca=_0x4ccd('0x2d');var _0x353605=_0x4ccd('0x16b');if(_0x318d8d[_0x4ccd('0x3a')][_0x4ccd('0xcb')]){_0x353605=_0x318d8d[_0x4ccd('0x3a')][_0x4ccd('0xcb')][0x0]==='-'?_0x4ccd('0x16c'):_0x4ccd('0x16b');_0x14b2ca=_0x353605===_0x4ccd('0x16b')?_0x318d8d[_0x4ccd('0x3a')][_0x4ccd('0xcb')]:_0x318d8d['query'][_0x4ccd('0xcb')][_0x4ccd('0x16d')](0x1);}return _(_0x1b204e)[_0x4ccd('0x16e')]('id')[_0x4ccd('0x16f')]([function(_0x460432){return _0x14b2ca===_0x4ccd('0x2d')?_0x460432[_0x14b2ca][_0x4ccd('0x9b')]():_0x460432[_0x14b2ca];}],[_0x353605])[_0x4ccd('0x81')](function(_0x3d1c56){return _[_0x4ccd('0xcc')](_0x3d1c56,['id',_0x4ccd('0x2d'),_0x4ccd('0x5b'),_0x4ccd('0x94')]);})[_0x4ccd('0x29')]();})[_0x4ccd('0x1d')](function(_0xb922d5){_0xbc2b9a=_0xb922d5;return rta[_0x4ccd('0x170')]();})[_0x4ccd('0x1d')](function(_0x59ec80){return _0xbc2b9a[_0x4ccd('0x81')](function(_0x3f7b66){var _0x15ee96=_['find'](_0x59ec80[_0x4ccd('0x42')],['id',_0x3f7b66['id']]);if(!_0x15ee96||!_0x3f7b66[_0x4ccd('0x94')]){_0x3f7b66[_0x4ccd('0x14')]=_0x4ccd('0x171');}else if(_0x15ee96[_0x4ccd('0x96')]){_0x3f7b66[_0x4ccd('0x14')]=_0x4ccd('0xf9');}else if(_0x15ee96[_0x4ccd('0x172')]==='unavailable'||!_0x15ee96[_0x4ccd('0x172')]){_0x3f7b66['status']=_0x4ccd('0x173');}else{_0x3f7b66[_0x4ccd('0x14')]=_0x5a7de4[_0x4ccd('0x2a')](_0x15ee96[_0x4ccd('0x172')])?'online':'busy';}return _0x3f7b66;});})[_0x4ccd('0x1d')](function(_0x43b4b8){if(!_0x318d8d[_0x4ccd('0x3a')][_0x4ccd('0xce')]('nolimit')){_0x3bc17b[_0x4ccd('0x19')]=qs[_0x4ccd('0x19')](_0x318d8d['query']['limit']||0xa);_0x3bc17b['offset']=qs[_0x4ccd('0x17')](_0x318d8d[_0x4ccd('0x3a')]['offset']);}_0x5ad143[_0x4ccd('0x1a')]=_0x43b4b8[_0x4ccd('0x60')];_0x5ad143[_0x4ccd('0x42')]=_0x3bc17b[_0x4ccd('0x19')]?_0x43b4b8['slice'](_0x3bc17b['offset'],_0x3bc17b[_0x4ccd('0x17')]+_0x3bc17b[_0x4ccd('0x19')]):_0x43b4b8;return _0x5ad143;})['then'](respondWithFilteredResult(_0x19567a,_0x3bc17b))[_0x4ccd('0x4e')](handleError(_0x19567a,null));};function get_open_tabs(_0x503ec4,_0x1f7086){var _0x597678=_0x503ec4[_0x4ccd('0x174')](0x0)['toUpperCase']()+_0x503ec4[_0x4ccd('0x175')](0x1);var _0x5d44c6={'type':db[_0x4ccd('0x87')][_0x4ccd('0x5e')][_0x4ccd('0x5f')],'raw':!![]};return new Promise(function(_0x466f10,_0x2b3412){var _0x2bd99e=squel[_0x4ccd('0x176')]()['field'](_0x4ccd('0x177')+_0x597678+_0x4ccd('0x178'),'id')[_0x4ccd('0x179')](_0x4ccd('0x17a'))[_0x4ccd('0x61')](_0x4ccd('0x17b')+_0x503ec4+_0x4ccd('0x17c'),'ui')[_0x4ccd('0x39')](_0x4ccd('0x17d'),_0x1f7086['id']);return db[_0x4ccd('0x5c')][_0x4ccd('0x3a')](_0x2bd99e['toString'](),_0x5d44c6)['then'](function(_0x36c672){_0x1f7086[_0x597678+_0x4ccd('0x17e')]=_0x36c672;_0x466f10(_0x36c672);})[_0x4ccd('0x4e')](function(_0x7d55f1){_0x2b3412(_0x7d55f1);});});}exports['messengerSoundNotification']=function(_0x1fecfd,_0x1f6c7f){var _0x2a48ea=_0x1fecfd['params']['id'];var _0x2889f0=_0x1fecfd[_0x4ccd('0x50')][_0x4ccd('0x17f')];return db[_0x4ccd('0x2f')][_0x4ccd('0x4f')]({'messengerSoundNotification':_0x2889f0},{'where':{'id':_0x2a48ea}})[_0x4ccd('0x1d')](respondWithStatusCode(_0x1f6c7f,null))[_0x4ccd('0x4e')](handleError(_0x1f6c7f,null));};
\ No newline at end of file
index 634c889..ba707ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x79a7=['events','../../mysqldb','User','setMaxListeners','remove','emit'];(function(_0x19cc86,_0x1a77f3){var _0x2f5c17=function(_0x4b20db){while(--_0x4b20db){_0x19cc86['push'](_0x19cc86['shift']());}};_0x2f5c17(++_0x1a77f3);}(_0x79a7,0xae));var _0x779a=function(_0x1a6e5,_0x315847){_0x1a6e5=_0x1a6e5-0x0;var _0x2d4809=_0x79a7[_0x1a6e5];return _0x2d4809;};'use strict';var EventEmitter=require(_0x779a('0x0'));var User=require(_0x779a('0x1'))['db'][_0x779a('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x779a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x779a('0x4')};function emitEvent(_0x1980a3){return function(_0x32f04c,_0x344933,_0xabb339){UserEvents[_0x779a('0x5')](_0x1980a3+':'+_0x32f04c['id'],_0x32f04c);UserEvents['emit'](_0x1980a3,_0x32f04c);_0xabb339(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module['exports']=UserEvents;
\ No newline at end of file
+var _0xae72=['hasOwnProperty','exports','events','../../mysqldb','User','setMaxListeners','save','update','remove','emit'];(function(_0x38b23e,_0x1753e9){var _0x1f119f=function(_0x331b7a){while(--_0x331b7a){_0x38b23e['push'](_0x38b23e['shift']());}};_0x1f119f(++_0x1753e9);}(_0xae72,0x8e));var _0x2ae7=function(_0x3c95a3,_0x1159f1){_0x3c95a3=_0x3c95a3-0x0;var _0x57b25b=_0xae72[_0x3c95a3];return _0x57b25b;};'use strict';var EventEmitter=require(_0x2ae7('0x0'));var User=require(_0x2ae7('0x1'))['db'][_0x2ae7('0x2')];var UserEvents=new EventEmitter();UserEvents[_0x2ae7('0x3')](0x0);var events={'afterCreate':_0x2ae7('0x4'),'afterUpdate':_0x2ae7('0x5'),'afterDestroy':_0x2ae7('0x6')};function emitEvent(_0xe319a3){return function(_0x3b5247,_0x55542b,_0x543a5e){UserEvents[_0x2ae7('0x7')](_0xe319a3+':'+_0x3b5247['id'],_0x3b5247);UserEvents['emit'](_0xe319a3,_0x3b5247);_0x543a5e(null);};}for(var e in events){if(events[_0x2ae7('0x8')](e)){var event=events[e];User['hook'](e,emitEvent(event));}}module[_0x2ae7('0x9')]=UserEvents;
\ No newline at end of file
index 07a5421..53448cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0cd6=['updateMd5Password','resolve','changed','find','updatePassword','userSetting','createUserSetting','error','VoiceExtension','bulkCreate','destroy','concat','encryptPassword','function','Missing\x20Callback','randomBytes','base64','salt','from','sha1','pbkdf2','toString','indexOf','Invalid\x20password','makeSalt','md5secret',':asterisk:','client','http','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agent\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agent\x20(Routing)','manual','QueuePause','Unable\x20to\x20unpause\x20agent\x20%s:$s','message','voice','UserVoiceQueueRt','update','findOne','PAUSE','channel','MemberReport','isArray','map','YYYY-MM-DD\x20HH:mm:ss','all','voicePause','mailPause','chatPause','faxPause','smsPause','whatsappPause','openchannelPause','Pause','getRealtimeData','getChannels','forEach','Status','bluebird','crypto','md5','moment','jayson/promise','./user.attributes','length','from-sip','system','format','%s%s','push','merge','chanspy','record','MixMonitor','recordingFormat','auth','password','SIP/%s,%s','name','options','join','StopMixMonitor','WAV','context','Set','extensionMonitor','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','SIP/%s,,tTxXU(xcally-mixmonitor-context)','SIP/%s,,tTxX','priority','defaults','VoiceChanSpy','findAll','internal','catch','models','define','User','users','utf8','userProfileId','undefined','then','privacyEnabled'];(function(_0x4c7cbd,_0x577bcb){var _0xddfd0a=function(_0x51d966){while(--_0x51d966){_0x4c7cbd['push'](_0x4c7cbd['shift']());}};_0xddfd0a(++_0x577bcb);}(_0x0cd6,0x113));var _0x60cd=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x0cd6[_0x54a2e4];return _0x4742d0;};'use strict';var BPromise=require(_0x60cd('0x0'));var crypto=require(_0x60cd('0x1'));var util=require('util');var md5=require(_0x60cd('0x2'));var moment=require(_0x60cd('0x3'));var _=require('lodash');var jayson=require(_0x60cd('0x4'));var attributes=require(_0x60cd('0x5'));var authTypes=['google'];var validatePresenceOf=function(_0x54b9cb){return _0x54b9cb&&_0x54b9cb[_0x60cd('0x6')];};var getChanSpyApplications=function(_0xefc62d,_0x22f155,_0x4e3293){var _0x381044={'context':_0xefc62d['context']||_0x60cd('0x7'),'type':_0x60cd('0x8'),'isApp':![],'UserId':_0xefc62d['id']};var _0x160a7f=[];for(var _0xad38c6=0x0,_0x260260=0x1;_0xad38c6<_0x4e3293[_0x60cd('0x6')];_0xad38c6++,_0x260260=0x1){var _0x539cd3={'exten':util[_0x60cd('0x9')](_0x60cd('0xa'),_0x4e3293[_0xad38c6]['prefix'],_0x22f155),'ChanSpyId':_0x4e3293[_0xad38c6]['id']};_0x160a7f[_0x60cd('0xb')](_[_0x60cd('0xc')]({'app':'Set','appdata':util[_0x60cd('0x9')]('CDR(type)=%s',_0x60cd('0xd')),'priority':_0x260260++},_0x381044,_0x539cd3));if(_0x4e3293[_0xad38c6][_0x60cd('0xe')]){_0x160a7f['push'](_[_0x60cd('0xc')]({'app':_0x60cd('0xf'),'appdata':util[_0x60cd('0x9')]('${UNIQUEID}.%s,a',_0x4e3293[_0xad38c6][_0x60cd('0x10')]),'priority':_0x260260++},_0x381044,_0x539cd3));}if(_0x4e3293[_0xad38c6][_0x60cd('0x11')]){_0x160a7f['push'](_[_0x60cd('0xc')]({'app':'Authenticate','appdata':_0x4e3293[_0xad38c6][_0x60cd('0x12')],'priority':_0x260260++},_0x381044,_0x539cd3));}_0x160a7f[_0x60cd('0xb')](_['merge']({'app':'ChanSpy','appdata':util[_0x60cd('0x9')](_0x60cd('0x13'),_0xefc62d[_0x60cd('0x14')],_0x4e3293[_0xad38c6]['options']?_0x4e3293[_0xad38c6][_0x60cd('0x15')][_0x60cd('0x16')](''):''),'priority':_0x260260++},_0x381044,_0x539cd3));if(_0x4e3293[_0xad38c6][_0x60cd('0xe')]){_0x160a7f[_0x60cd('0xb')](_[_0x60cd('0xc')]({'app':_0x60cd('0x17'),'priority':_0x260260++},_0x381044,_0x539cd3));}}return _0x160a7f;};var getUserApplications=function(_0x131e08,_0x1e5ed5){var _0x3677b2=['wav',_0x60cd('0x18'),'gsm'];var _0x4e4478={'context':_0x131e08[_0x60cd('0x19')]||_0x60cd('0x7'),'exten':_0x1e5ed5,'type':'system','isApp':![],'UserId':_0x131e08['id']};var _0x45e390=[{'app':_0x60cd('0x1a'),'appdata':'CDR(type)=internal'}];if(_0x131e08[_0x60cd('0x1b')]&&_['includes'](_0x3677b2,_0x131e08[_0x60cd('0x1b')])){_0x45e390[_0x60cd('0xb')]({'app':'Set','appdata':_0x60cd('0x1c')});_0x45e390['push']({'app':'Set','appdata':util[_0x60cd('0x9')]('_XCALLY_MIXMONITOR_FORMAT=%s',_0x131e08[_0x60cd('0x1b')])});_0x45e390[_0x60cd('0xb')]({'app':'Dial','appdata':util['format'](_0x60cd('0x1d'),_0x131e08[_0x60cd('0x14')])});}else{_0x45e390[_0x60cd('0xb')]({'app':'Dial','appdata':util[_0x60cd('0x9')](_0x60cd('0x1e'),_0x131e08[_0x60cd('0x14')])});}_0x45e390[_0x60cd('0xb')]({'app':'Hangup'});for(var _0x31be62=0x0;_0x31be62<_0x45e390[_0x60cd('0x6')];_0x31be62++){_0x45e390[_0x31be62][_0x60cd('0x1f')]=_0x31be62+0x1;_0x45e390[_0x31be62]=_[_0x60cd('0x20')](_0x45e390[_0x31be62],_0x4e4478);}return _0x45e390;};var getChanSpyPromise=function(_0x446673,_0x4173f7){return new BPromise(function(_0x5925fc,_0x1f4812){return _0x446673[_0x60cd('0x21')][_0x60cd('0x22')]()['then'](function(_0x3f5b23){if(_0x3f5b23){var _0x5d1024=getChanSpyApplications(_0x4173f7,_0x4173f7[_0x60cd('0x23')],_0x3f5b23);if(_0x4173f7[_0x60cd('0x23')]!=_0x4173f7['name']){_0x5d1024=_0x5d1024['concat'](getChanSpyApplications(_0x4173f7,_0x4173f7[_0x60cd('0x14')],_0x3f5b23));}return _0x5925fc(_0x5d1024);}return _0x5925fc([]);})[_0x60cd('0x24')](function(_0x19a84b){_0x1f4812(_0x19a84b);});});};module['exports']=function(_0x60f77a){var _0x2b4959=_0x60f77a[_0x60cd('0x25')];return _0x60f77a[_0x60cd('0x26')](_0x60cd('0x27'),attributes,{'tableName':_0x60cd('0x28'),'charset':_0x60cd('0x29'),'collate':'utf8_bin','hooks':{'beforeCreate':function(_0xf4be4c,_0x2fa0dc,_0xc4ae48){var _0x3eea02=typeof _0xf4be4c[_0x60cd('0x2a')]===_0x60cd('0x2b')?BPromise['resolve'](null):_0x2b4959['UserProfile']['find']({'where':{'id':_0xf4be4c[_0x60cd('0x2a')]}});_0x3eea02[_0x60cd('0x2c')](function(_0xcfb362){if(_0xcfb362){_0xf4be4c[_0x60cd('0x2d')]=_0xcfb362[_0x60cd('0x2d')];}})[_0x60cd('0x2c')](function(){_0xf4be4c[_0x60cd('0x2e')]();_0xf4be4c['updatePassword'](_0xc4ae48);})[_0x60cd('0x24')](function(_0x40b70b){_0xc4ae48(_0x40b70b);});},'beforeUpdate':function(_0x31ec68,_0x356364,_0xbf7af3){Promise[_0x60cd('0x2f')]()[_0x60cd('0x2c')](function(){if(_0x31ec68[_0x60cd('0x30')](_0x60cd('0x2a'))===![])return;return _0x2b4959['UserProfile'][_0x60cd('0x31')]({'where':{'id':_0x31ec68[_0x60cd('0x2a')]}})['then'](function(_0x5e505a){if(_0x5e505a)_0x31ec68[_0x60cd('0x2d')]=_0x5e505a[_0x60cd('0x2d')];return;});})[_0x60cd('0x2c')](function(){if(_0x31ec68[_0x60cd('0x30')](_0x60cd('0x12'))){_0x31ec68['updateMd5Password']();return _0x31ec68[_0x60cd('0x32')](_0xbf7af3);}_0xbf7af3();})[_0x60cd('0x24')](function(_0x59442e){_0xbf7af3(_0x59442e);});},'afterCreate':function(_0x5ac59e,_0x256194,_0x110c4c){var _0x498739=getUserApplications(_0x5ac59e,_0x5ac59e[_0x60cd('0x23')]);if(_0x5ac59e[_0x60cd('0x23')]!=_0x5ac59e[_0x60cd('0x14')]){_0x498739=_0x498739['concat'](getUserApplications(_0x5ac59e,_0x5ac59e[_0x60cd('0x14')]));}return Promise[_0x60cd('0x2f')]()[_0x60cd('0x2c')](function(){if(!_0x5ac59e[_0x60cd('0x33')]){return _0x5ac59e[_0x60cd('0x34')]({'clientSideLoggingLevel':_0x60cd('0x35'),'clientSideLoggingEnabled':![]});}})[_0x60cd('0x2c')](function(){return _0x2b4959[_0x60cd('0x36')][_0x60cd('0x37')](_0x498739);})['then'](function(){if(_0x5ac59e['chanspy']){return getChanSpyPromise(_0x2b4959,_0x5ac59e);}})['then'](function(_0x226a28){if(_0x226a28&&_0x226a28[_0x60cd('0x6')]){return _0x2b4959[_0x60cd('0x36')]['bulkCreate'](_0x226a28);}})['then'](function(){_0x110c4c();})['catch'](function(_0x53c02c){_0x110c4c(_0x53c02c);});},'afterUpdate':function(_0x2361a1,_0x34fd5e,_0x4d3bf0){return BPromise['resolve']()['then'](function(){if(_0x2361a1[_0x60cd('0x30')](_0x60cd('0xd'))||_0x2361a1[_0x60cd('0x30')](_0x60cd('0x19'))){return _0x2b4959['VoiceExtension'][_0x60cd('0x38')]({'where':{'UserId':_0x2361a1['id'],'type':_0x60cd('0x8'),'ChanSpyId':{'$ne':null}}})['then'](function(){if(_0x2361a1[_0x60cd('0xd')]){return getChanSpyPromise(_0x2b4959,_0x2361a1)[_0x60cd('0x2c')](function(_0x4352d4){if(_0x4352d4&&_0x4352d4[_0x60cd('0x6')]){return _0x2b4959[_0x60cd('0x36')]['bulkCreate'](_0x4352d4);}});}});}})[_0x60cd('0x2c')](function(){if(_0x2361a1['changed'](_0x60cd('0x1b'))||_0x2361a1[_0x60cd('0x30')]('context')){return _0x2b4959['VoiceExtension'][_0x60cd('0x38')]({'where':{'UserId':_0x2361a1['id'],'type':_0x60cd('0x8'),'ChanSpyId':null}})[_0x60cd('0x2c')](function(){var _0x3dfecb=getUserApplications(_0x2361a1,_0x2361a1[_0x60cd('0x23')]);if(_0x2361a1[_0x60cd('0x23')]!=_0x2361a1[_0x60cd('0x14')]){_0x3dfecb=_0x3dfecb[_0x60cd('0x39')](getUserApplications(_0x2361a1,_0x2361a1[_0x60cd('0x14')]));}return _0x2b4959[_0x60cd('0x36')][_0x60cd('0x37')](_0x3dfecb);});}})['then'](function(){_0x4d3bf0();})['catch'](function(_0x4f7a23){_0x4d3bf0(_0x4f7a23);});},'afterDestroy':function(_0x31ea0a){return _0x2b4959[_0x60cd('0x36')][_0x60cd('0x38')]({'where':{'UserId':_0x31ea0a['id'],'type':_0x60cd('0x8')}});}},'instanceMethods':{'authenticate':function(_0x3b0454,_0x9bb774){if(!_0x9bb774){return this[_0x60cd('0x12')]===this[_0x60cd('0x3a')](_0x3b0454);}var _0xd16a1f=this;this[_0x60cd('0x3a')](_0x3b0454,function(_0x4cca6a,_0x439b8a){if(_0x4cca6a){_0x9bb774(_0x4cca6a);}if(_0xd16a1f[_0x60cd('0x12')]===_0x439b8a){_0x9bb774(null,!![]);}else{_0x9bb774(null,![]);}});},'makeSalt':function(_0x239c90,_0x5a770a){var _0x2e01ac=0x10;if(typeof arguments[0x0]===_0x60cd('0x3b')){_0x5a770a=arguments[0x0];_0x239c90=_0x2e01ac;}else if(typeof arguments[0x1]===_0x60cd('0x3b')){_0x5a770a=arguments[0x1];}else{throw new Error(_0x60cd('0x3c'));}if(!_0x239c90){_0x239c90=_0x2e01ac;}return crypto[_0x60cd('0x3d')](_0x239c90,function(_0x5dccb7,_0x499749){if(_0x5dccb7){_0x5a770a(_0x5dccb7);}return _0x5a770a(null,_0x499749['toString'](_0x60cd('0x3e')));});},'encryptPassword':function(_0x507dfa,_0x4c8c94){if(!_0x507dfa||!this[_0x60cd('0x3f')]){return _0x4c8c94?_0x4c8c94(null):null;}var _0x4898dc=0x2710;var _0x467661=0x40;var _0x43cb0a=Buffer[_0x60cd('0x40')](this[_0x60cd('0x3f')],_0x60cd('0x3e'));if(!_0x4c8c94){return crypto['pbkdf2Sync'](_0x507dfa,_0x43cb0a,_0x4898dc,_0x467661,_0x60cd('0x41'))['toString'](_0x60cd('0x3e'));}return crypto[_0x60cd('0x42')](_0x507dfa,_0x43cb0a,_0x4898dc,_0x467661,'sha1',function(_0x174475,_0x24d152){if(_0x174475){_0x4c8c94(_0x174475);}return _0x4c8c94(null,_0x24d152[_0x60cd('0x43')]('base64'));});},'updatePassword':function(_0x2b365){if(!this['password']){return _0x2b365(null);}if(!validatePresenceOf(this[_0x60cd('0x12')])&&authTypes[_0x60cd('0x44')](this['provider'])===-0x1){_0x2b365(new Error(_0x60cd('0x45')));}var _0x35f3d6=this;this[_0x60cd('0x46')](function(_0x1ec9e9,_0x35c25c){if(_0x1ec9e9){return _0x2b365(_0x1ec9e9);}_0x35f3d6[_0x60cd('0x3f')]=_0x35c25c;_0x35f3d6['encryptPassword'](_0x35f3d6[_0x60cd('0x12')],function(_0xac8bc3,_0x3a16a0){if(_0xac8bc3){_0x2b365(_0xac8bc3);}_0x35f3d6[_0x60cd('0x12')]=_0x3a16a0;_0x2b365(null);});});},'updateMd5Password':function(){this[_0x60cd('0x47')]=md5(this[_0x60cd('0x14')]+_0x60cd('0x48')+this[_0x60cd('0x12')]);return this[_0x60cd('0x47')];},'getRealtimeData':function(){var _0x122cec={'id':this['id']};var _0x3148d1=jayson[_0x60cd('0x49')][_0x60cd('0x4a')]({'port':0x232a});var _0x3e8144=jayson[_0x60cd('0x49')][_0x60cd('0x4a')]({'port':0x232c});var _0x54d01c={};var _0x30d6fe={};return _0x3148d1[_0x60cd('0x4b')](_0x60cd('0x4c'),_0x122cec)[_0x60cd('0x2c')](function(_0x4fc342){if(_0x4fc342[_0x60cd('0x35')]){throw new Error(_0x60cd('0x4d'));}_0x54d01c=_0x4fc342[_0x60cd('0x4e')];return _0x3e8144[_0x60cd('0x4b')](_0x60cd('0x4c'),_0x122cec);})['then'](function(_0x224ee9){if(_0x224ee9['error']){throw new Error(_0x60cd('0x4f'));}_0x30d6fe=_0x224ee9[_0x60cd('0x4e')];var _0x110f7f=_[_0x60cd('0xc')]({},_0x54d01c,_0x30d6fe);return _0x110f7f;})[_0x60cd('0x24')](function(_0xd6457b){throw _0xd6457b;});},'unpause':function(_0x8b6c3e,_0x1dc510='manual'){var _0x3ee3b8=this;var _0x314621={};return Promise[_0x60cd('0x2f')]()[_0x60cd('0x2c')](function(){if(!_0x8b6c3e||_0x8b6c3e==='voice'&&_0x1dc510===_0x60cd('0x50')){var _0xcbbe15=jayson['client']['http']({'port':0x232a});return _0xcbbe15[_0x60cd('0x4b')](_0x60cd('0x51'),{'id':_0x3ee3b8['id'],'name':_0x3ee3b8[_0x60cd('0x14')],'pause':![]})[_0x60cd('0x2c')](function(_0x3f0211){if(_0x3f0211[_0x60cd('0x35')]){throw new Error(util[_0x60cd('0x9')](_0x60cd('0x52'),_0x3ee3b8['id'],_0x3ee3b8['name']));}return _0x3f0211['result'][_0x60cd('0x53')];});}})[_0x60cd('0x2c')](function(){if(!_0x8b6c3e||_0x8b6c3e===_0x60cd('0x54')){return _0x2b4959[_0x60cd('0x55')][_0x60cd('0x56')]({'paused':0x0},{'where':{'UserId':_0x3ee3b8['id']},'individualHooks':!![]});}})[_0x60cd('0x2c')](function(){var _0x48cb6e=!_0x8b6c3e?_0x60cd('0x22'):_0x60cd('0x57');var _0x256eda={'membername':_0x3ee3b8[_0x60cd('0x14')],'type':_0x60cd('0x58'),'exitAt':null};if(_0x8b6c3e){_0x256eda[_0x60cd('0x59')]=_0x8b6c3e;}return _0x2b4959[_0x60cd('0x5a')][_0x48cb6e]({'where':_0x256eda});})[_0x60cd('0x2c')](function(_0x57504d){if(_0x57504d){var _0x3a591d=Array[_0x60cd('0x5b')](_0x57504d)?_0x57504d:[_0x57504d];var _0x359566=_0x3a591d[_0x60cd('0x5c')](function(_0x116030){return _0x116030[_0x60cd('0x56')]({'exitAt':moment()[_0x60cd('0x9')](_0x60cd('0x5d')),'data2':_0x1dc510});});return Promise[_0x60cd('0x5e')](_0x359566);}})[_0x60cd('0x2c')](function(){if(!_0x8b6c3e){_0x314621[_0x60cd('0x5f')]=![];_0x314621[_0x60cd('0x60')]=![];_0x314621[_0x60cd('0x61')]=![];_0x314621[_0x60cd('0x62')]=![];_0x314621[_0x60cd('0x63')]=![];_0x314621[_0x60cd('0x64')]=![];_0x314621[_0x60cd('0x65')]=![];}else{_0x314621[_0x8b6c3e+_0x60cd('0x66')]=![];}return _0x3ee3b8[_0x60cd('0x67')]();})[_0x60cd('0x2c')](function(_0x4ae448){var _0x400c36=require('../../config/utils');var _0x3466b5=_0x400c36[_0x60cd('0x68')]();_0x3466b5[_0x60cd('0x69')](function(_0x56d4f7){var _0x40cf38=_0x56d4f7+_0x60cd('0x6a');_0x3ee3b8['setDataValue']([_0x40cf38],_0x4ae448[_0x40cf38]);});return _0x3ee3b8[_0x60cd('0x56')](_0x314621);})['catch'](function(_0xb3053a){throw _0xb3053a;});}}});};
\ No newline at end of file
+var _0xd8b1=['manual','voice','QueuePause','Unable\x20to\x20unpause\x20agent\x20%s:$s','message','UserVoiceQueueRt','update','findOne','PAUSE','channel','isArray','map','YYYY-MM-DD\x20HH:mm:ss','all','voicePause','mailPause','chatPause','faxPause','smsPause','whatsappPause','openchannelPause','Pause','getRealtimeData','../../config/utils','forEach','Status','setDataValue','bluebird','crypto','util','md5','moment','jayson/promise','./user.attributes','context','from-sip','system','length','%s%s','push','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','Authenticate','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','wav','gsm','CDR(type)=internal','extensionMonitor','includes','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','SIP/%s,,tTxXU(xcally-mixmonitor-context)','Dial','SIP/%s,,tTxX','Hangup','priority','VoiceChanSpy','findAll','internal','concat','exports','models','define','User','users','utf8','userProfileId','undefined','resolve','UserProfile','find','then','privacyEnabled','updateMd5Password','updatePassword','catch','changed','password','userSetting','createUserSetting','error','VoiceExtension','bulkCreate','destroy','encryptPassword','function','Missing\x20Callback','randomBytes','base64','salt','from','pbkdf2Sync','toString','pbkdf2','sha1','indexOf','provider','makeSalt','md5secret',':asterisk:','client','http','request','Agents','result','Unable\x20to\x20retrieve\x20RPC\x20agent\x20(Routing)'];(function(_0x3037c0,_0x5de2fe){var _0x59802e=function(_0x2c440d){while(--_0x2c440d){_0x3037c0['push'](_0x3037c0['shift']());}};_0x59802e(++_0x5de2fe);}(_0xd8b1,0x105));var _0x1d8b=function(_0x2fbc1b,_0x3222e6){_0x2fbc1b=_0x2fbc1b-0x0;var _0x3b42bc=_0xd8b1[_0x2fbc1b];return _0x3b42bc;};'use strict';var BPromise=require(_0x1d8b('0x0'));var crypto=require(_0x1d8b('0x1'));var util=require(_0x1d8b('0x2'));var md5=require(_0x1d8b('0x3'));var moment=require(_0x1d8b('0x4'));var _=require('lodash');var jayson=require(_0x1d8b('0x5'));var attributes=require(_0x1d8b('0x6'));var authTypes=['google'];var validatePresenceOf=function(_0xad218){return _0xad218&&_0xad218['length'];};var getChanSpyApplications=function(_0x5d069a,_0x4d5ba0,_0x27534c){var _0x5f5bbd={'context':_0x5d069a[_0x1d8b('0x7')]||_0x1d8b('0x8'),'type':_0x1d8b('0x9'),'isApp':![],'UserId':_0x5d069a['id']};var _0x4480cf=[];for(var _0x51438a=0x0,_0x4c099e=0x1;_0x51438a<_0x27534c[_0x1d8b('0xa')];_0x51438a++,_0x4c099e=0x1){var _0x51ba29={'exten':util['format'](_0x1d8b('0xb'),_0x27534c[_0x51438a]['prefix'],_0x4d5ba0),'ChanSpyId':_0x27534c[_0x51438a]['id']};_0x4480cf[_0x1d8b('0xc')](_['merge']({'app':_0x1d8b('0xd'),'appdata':util[_0x1d8b('0xe')](_0x1d8b('0xf'),_0x1d8b('0x10')),'priority':_0x4c099e++},_0x5f5bbd,_0x51ba29));if(_0x27534c[_0x51438a][_0x1d8b('0x11')]){_0x4480cf[_0x1d8b('0xc')](_['merge']({'app':_0x1d8b('0x12'),'appdata':util[_0x1d8b('0xe')](_0x1d8b('0x13'),_0x27534c[_0x51438a][_0x1d8b('0x14')]),'priority':_0x4c099e++},_0x5f5bbd,_0x51ba29));}if(_0x27534c[_0x51438a][_0x1d8b('0x15')]){_0x4480cf[_0x1d8b('0xc')](_[_0x1d8b('0x16')]({'app':_0x1d8b('0x17'),'appdata':_0x27534c[_0x51438a]['password'],'priority':_0x4c099e++},_0x5f5bbd,_0x51ba29));}_0x4480cf[_0x1d8b('0xc')](_[_0x1d8b('0x16')]({'app':_0x1d8b('0x18'),'appdata':util[_0x1d8b('0xe')](_0x1d8b('0x19'),_0x5d069a[_0x1d8b('0x1a')],_0x27534c[_0x51438a][_0x1d8b('0x1b')]?_0x27534c[_0x51438a]['options']['join'](''):''),'priority':_0x4c099e++},_0x5f5bbd,_0x51ba29));if(_0x27534c[_0x51438a][_0x1d8b('0x11')]){_0x4480cf[_0x1d8b('0xc')](_[_0x1d8b('0x16')]({'app':_0x1d8b('0x1c'),'priority':_0x4c099e++},_0x5f5bbd,_0x51ba29));}}return _0x4480cf;};var getUserApplications=function(_0x41b6fe,_0x5d52c0){var _0x40cf64=[_0x1d8b('0x1d'),'WAV',_0x1d8b('0x1e')];var _0x1b9549={'context':_0x41b6fe[_0x1d8b('0x7')]||'from-sip','exten':_0x5d52c0,'type':_0x1d8b('0x9'),'isApp':![],'UserId':_0x41b6fe['id']};var _0x444831=[{'app':_0x1d8b('0xd'),'appdata':_0x1d8b('0x1f')}];if(_0x41b6fe[_0x1d8b('0x20')]&&_[_0x1d8b('0x21')](_0x40cf64,_0x41b6fe[_0x1d8b('0x20')])){_0x444831['push']({'app':_0x1d8b('0xd'),'appdata':_0x1d8b('0x22')});_0x444831[_0x1d8b('0xc')]({'app':_0x1d8b('0xd'),'appdata':util['format']('_XCALLY_MIXMONITOR_FORMAT=%s',_0x41b6fe[_0x1d8b('0x20')])});_0x444831[_0x1d8b('0xc')]({'app':'Dial','appdata':util[_0x1d8b('0xe')](_0x1d8b('0x23'),_0x41b6fe['name'])});}else{_0x444831['push']({'app':_0x1d8b('0x24'),'appdata':util[_0x1d8b('0xe')](_0x1d8b('0x25'),_0x41b6fe[_0x1d8b('0x1a')])});}_0x444831[_0x1d8b('0xc')]({'app':_0x1d8b('0x26')});for(var _0x1d525f=0x0;_0x1d525f<_0x444831['length'];_0x1d525f++){_0x444831[_0x1d525f][_0x1d8b('0x27')]=_0x1d525f+0x1;_0x444831[_0x1d525f]=_['defaults'](_0x444831[_0x1d525f],_0x1b9549);}return _0x444831;};var getChanSpyPromise=function(_0x4b3a64,_0x4ccfa9){return new BPromise(function(_0x37c284,_0x3f16de){return _0x4b3a64[_0x1d8b('0x28')][_0x1d8b('0x29')]()['then'](function(_0x57d6df){if(_0x57d6df){var _0x3a24f4=getChanSpyApplications(_0x4ccfa9,_0x4ccfa9[_0x1d8b('0x2a')],_0x57d6df);if(_0x4ccfa9[_0x1d8b('0x2a')]!=_0x4ccfa9[_0x1d8b('0x1a')]){_0x3a24f4=_0x3a24f4[_0x1d8b('0x2b')](getChanSpyApplications(_0x4ccfa9,_0x4ccfa9[_0x1d8b('0x1a')],_0x57d6df));}return _0x37c284(_0x3a24f4);}return _0x37c284([]);})['catch'](function(_0x4456ba){_0x3f16de(_0x4456ba);});});};module[_0x1d8b('0x2c')]=function(_0x23ed7f){var _0x3bb26b=_0x23ed7f[_0x1d8b('0x2d')];return _0x23ed7f[_0x1d8b('0x2e')](_0x1d8b('0x2f'),attributes,{'tableName':_0x1d8b('0x30'),'charset':_0x1d8b('0x31'),'collate':'utf8_bin','hooks':{'beforeCreate':function(_0x1a6960,_0x57268f,_0x563614){var _0x5d844a=typeof _0x1a6960[_0x1d8b('0x32')]===_0x1d8b('0x33')?BPromise[_0x1d8b('0x34')](null):_0x3bb26b[_0x1d8b('0x35')][_0x1d8b('0x36')]({'where':{'id':_0x1a6960['userProfileId']}});_0x5d844a[_0x1d8b('0x37')](function(_0x12822b){if(_0x12822b){_0x1a6960[_0x1d8b('0x38')]=_0x12822b[_0x1d8b('0x38')];}})[_0x1d8b('0x37')](function(){_0x1a6960[_0x1d8b('0x39')]();_0x1a6960[_0x1d8b('0x3a')](_0x563614);})[_0x1d8b('0x3b')](function(_0x54cce4){_0x563614(_0x54cce4);});},'beforeUpdate':function(_0x45517f,_0x4cf82c,_0x3522de){Promise['resolve']()[_0x1d8b('0x37')](function(){if(_0x45517f[_0x1d8b('0x3c')](_0x1d8b('0x32'))===![])return;return _0x3bb26b['UserProfile'][_0x1d8b('0x36')]({'where':{'id':_0x45517f[_0x1d8b('0x32')]}})[_0x1d8b('0x37')](function(_0x197a15){if(_0x197a15)_0x45517f['privacyEnabled']=_0x197a15[_0x1d8b('0x38')];return;});})[_0x1d8b('0x37')](function(){if(_0x45517f['changed'](_0x1d8b('0x3d'))){_0x45517f['updateMd5Password']();return _0x45517f['updatePassword'](_0x3522de);}_0x3522de();})['catch'](function(_0x21e9e0){_0x3522de(_0x21e9e0);});},'afterCreate':function(_0x18e7c2,_0x46b2ce,_0x2fce1d){var _0x441a27=getUserApplications(_0x18e7c2,_0x18e7c2[_0x1d8b('0x2a')]);if(_0x18e7c2[_0x1d8b('0x2a')]!=_0x18e7c2['name']){_0x441a27=_0x441a27[_0x1d8b('0x2b')](getUserApplications(_0x18e7c2,_0x18e7c2['name']));}return Promise[_0x1d8b('0x34')]()['then'](function(){if(!_0x18e7c2[_0x1d8b('0x3e')]){return _0x18e7c2[_0x1d8b('0x3f')]({'clientSideLoggingLevel':_0x1d8b('0x40'),'clientSideLoggingEnabled':![]});}})[_0x1d8b('0x37')](function(){return _0x3bb26b[_0x1d8b('0x41')][_0x1d8b('0x42')](_0x441a27);})[_0x1d8b('0x37')](function(){if(_0x18e7c2['chanspy']){return getChanSpyPromise(_0x3bb26b,_0x18e7c2);}})['then'](function(_0x16fe4d){if(_0x16fe4d&&_0x16fe4d[_0x1d8b('0xa')]){return _0x3bb26b[_0x1d8b('0x41')][_0x1d8b('0x42')](_0x16fe4d);}})[_0x1d8b('0x37')](function(){_0x2fce1d();})['catch'](function(_0x280775){_0x2fce1d(_0x280775);});},'afterUpdate':function(_0x206223,_0x4d7249,_0x5c0af0){return BPromise['resolve']()[_0x1d8b('0x37')](function(){if(_0x206223['changed'](_0x1d8b('0x10'))||_0x206223[_0x1d8b('0x3c')]('context')){return _0x3bb26b[_0x1d8b('0x41')][_0x1d8b('0x43')]({'where':{'UserId':_0x206223['id'],'type':_0x1d8b('0x9'),'ChanSpyId':{'$ne':null}}})[_0x1d8b('0x37')](function(){if(_0x206223[_0x1d8b('0x10')]){return getChanSpyPromise(_0x3bb26b,_0x206223)['then'](function(_0x495536){if(_0x495536&&_0x495536[_0x1d8b('0xa')]){return _0x3bb26b[_0x1d8b('0x41')][_0x1d8b('0x42')](_0x495536);}});}});}})['then'](function(){if(_0x206223[_0x1d8b('0x3c')](_0x1d8b('0x20'))||_0x206223[_0x1d8b('0x3c')](_0x1d8b('0x7'))){return _0x3bb26b[_0x1d8b('0x41')][_0x1d8b('0x43')]({'where':{'UserId':_0x206223['id'],'type':_0x1d8b('0x9'),'ChanSpyId':null}})[_0x1d8b('0x37')](function(){var _0x57fe82=getUserApplications(_0x206223,_0x206223[_0x1d8b('0x2a')]);if(_0x206223[_0x1d8b('0x2a')]!=_0x206223[_0x1d8b('0x1a')]){_0x57fe82=_0x57fe82[_0x1d8b('0x2b')](getUserApplications(_0x206223,_0x206223[_0x1d8b('0x1a')]));}return _0x3bb26b[_0x1d8b('0x41')][_0x1d8b('0x42')](_0x57fe82);});}})[_0x1d8b('0x37')](function(){_0x5c0af0();})['catch'](function(_0x92e4ec){_0x5c0af0(_0x92e4ec);});},'afterDestroy':function(_0x292a9b){return _0x3bb26b['VoiceExtension']['destroy']({'where':{'UserId':_0x292a9b['id'],'type':_0x1d8b('0x9')}});}},'instanceMethods':{'authenticate':function(_0x51584d,_0x36635f){if(!_0x36635f){return this[_0x1d8b('0x3d')]===this[_0x1d8b('0x44')](_0x51584d);}var _0x46938e=this;this[_0x1d8b('0x44')](_0x51584d,function(_0x1e296d,_0x644520){if(_0x1e296d){_0x36635f(_0x1e296d);}if(_0x46938e[_0x1d8b('0x3d')]===_0x644520){_0x36635f(null,!![]);}else{_0x36635f(null,![]);}});},'makeSalt':function(_0x280c02,_0x2c7074){var _0x70ca24=0x10;if(typeof arguments[0x0]===_0x1d8b('0x45')){_0x2c7074=arguments[0x0];_0x280c02=_0x70ca24;}else if(typeof arguments[0x1]===_0x1d8b('0x45')){_0x2c7074=arguments[0x1];}else{throw new Error(_0x1d8b('0x46'));}if(!_0x280c02){_0x280c02=_0x70ca24;}return crypto[_0x1d8b('0x47')](_0x280c02,function(_0xb86b6b,_0x519a8f){if(_0xb86b6b){_0x2c7074(_0xb86b6b);}return _0x2c7074(null,_0x519a8f['toString'](_0x1d8b('0x48')));});},'encryptPassword':function(_0x3c618d,_0x573ba8){if(!_0x3c618d||!this[_0x1d8b('0x49')]){return _0x573ba8?_0x573ba8(null):null;}var _0x5a7e1c=0x2710;var _0x5ecbce=0x40;var _0x5d7391=Buffer[_0x1d8b('0x4a')](this[_0x1d8b('0x49')],_0x1d8b('0x48'));if(!_0x573ba8){return crypto[_0x1d8b('0x4b')](_0x3c618d,_0x5d7391,_0x5a7e1c,_0x5ecbce,'sha1')[_0x1d8b('0x4c')](_0x1d8b('0x48'));}return crypto[_0x1d8b('0x4d')](_0x3c618d,_0x5d7391,_0x5a7e1c,_0x5ecbce,_0x1d8b('0x4e'),function(_0x38e687,_0x4e154f){if(_0x38e687){_0x573ba8(_0x38e687);}return _0x573ba8(null,_0x4e154f[_0x1d8b('0x4c')](_0x1d8b('0x48')));});},'updatePassword':function(_0x42f835){if(!this['password']){return _0x42f835(null);}if(!validatePresenceOf(this[_0x1d8b('0x3d')])&&authTypes[_0x1d8b('0x4f')](this[_0x1d8b('0x50')])===-0x1){_0x42f835(new Error('Invalid\x20password'));}var _0x20d658=this;this[_0x1d8b('0x51')](function(_0x499fb9,_0x5b24bb){if(_0x499fb9){return _0x42f835(_0x499fb9);}_0x20d658[_0x1d8b('0x49')]=_0x5b24bb;_0x20d658[_0x1d8b('0x44')](_0x20d658[_0x1d8b('0x3d')],function(_0x45f76e,_0xd830c4){if(_0x45f76e){_0x42f835(_0x45f76e);}_0x20d658[_0x1d8b('0x3d')]=_0xd830c4;_0x42f835(null);});});},'updateMd5Password':function(){this[_0x1d8b('0x52')]=md5(this[_0x1d8b('0x1a')]+_0x1d8b('0x53')+this[_0x1d8b('0x3d')]);return this[_0x1d8b('0x52')];},'getRealtimeData':function(){var _0x4aa70a={'id':this['id']};var _0x16fe7a=jayson[_0x1d8b('0x54')][_0x1d8b('0x55')]({'port':0x232a});var _0x32ea38=jayson[_0x1d8b('0x54')][_0x1d8b('0x55')]({'port':0x232c});var _0x5e1372={};var _0x4c044b={};return _0x16fe7a[_0x1d8b('0x56')](_0x1d8b('0x57'),_0x4aa70a)['then'](function(_0x105485){if(_0x105485[_0x1d8b('0x40')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agent\x20(AMI)');}_0x5e1372=_0x105485[_0x1d8b('0x58')];return _0x32ea38[_0x1d8b('0x56')]('Agents',_0x4aa70a);})[_0x1d8b('0x37')](function(_0x1f7ca4){if(_0x1f7ca4[_0x1d8b('0x40')]){throw new Error(_0x1d8b('0x59'));}_0x4c044b=_0x1f7ca4[_0x1d8b('0x58')];var _0x3cd223=_['merge']({},_0x5e1372,_0x4c044b);return _0x3cd223;})[_0x1d8b('0x3b')](function(_0x283a8f){throw _0x283a8f;});},'unpause':function(_0x4e061c,_0x28949a=_0x1d8b('0x5a')){var _0x24afdc=this;var _0x2c09c5={};return Promise[_0x1d8b('0x34')]()['then'](function(){if(!_0x4e061c||_0x4e061c===_0x1d8b('0x5b')&&_0x28949a===_0x1d8b('0x5a')){var _0x2a44ab=jayson[_0x1d8b('0x54')]['http']({'port':0x232a});return _0x2a44ab['request'](_0x1d8b('0x5c'),{'id':_0x24afdc['id'],'name':_0x24afdc[_0x1d8b('0x1a')],'pause':![]})[_0x1d8b('0x37')](function(_0x4db4bc){if(_0x4db4bc['error']){throw new Error(util['format'](_0x1d8b('0x5d'),_0x24afdc['id'],_0x24afdc[_0x1d8b('0x1a')]));}return _0x4db4bc['result'][_0x1d8b('0x5e')];});}})['then'](function(){if(!_0x4e061c||_0x4e061c===_0x1d8b('0x5b')){return _0x3bb26b[_0x1d8b('0x5f')][_0x1d8b('0x60')]({'paused':0x0},{'where':{'UserId':_0x24afdc['id']},'individualHooks':!![]});}})[_0x1d8b('0x37')](function(){var _0x2743d9=!_0x4e061c?_0x1d8b('0x29'):_0x1d8b('0x61');var _0x288cd0={'membername':_0x24afdc[_0x1d8b('0x1a')],'type':_0x1d8b('0x62'),'exitAt':null};if(_0x4e061c){_0x288cd0[_0x1d8b('0x63')]=_0x4e061c;}return _0x3bb26b['MemberReport'][_0x2743d9]({'where':_0x288cd0});})[_0x1d8b('0x37')](function(_0x289e26){if(_0x289e26){var _0x42ee98=Array[_0x1d8b('0x64')](_0x289e26)?_0x289e26:[_0x289e26];var _0x470bda=_0x42ee98[_0x1d8b('0x65')](function(_0x2c323e){return _0x2c323e[_0x1d8b('0x60')]({'exitAt':moment()[_0x1d8b('0xe')](_0x1d8b('0x66')),'data2':_0x28949a});});return Promise[_0x1d8b('0x67')](_0x470bda);}})[_0x1d8b('0x37')](function(){if(!_0x4e061c){_0x2c09c5[_0x1d8b('0x68')]=![];_0x2c09c5[_0x1d8b('0x69')]=![];_0x2c09c5[_0x1d8b('0x6a')]=![];_0x2c09c5[_0x1d8b('0x6b')]=![];_0x2c09c5[_0x1d8b('0x6c')]=![];_0x2c09c5[_0x1d8b('0x6d')]=![];_0x2c09c5[_0x1d8b('0x6e')]=![];}else{_0x2c09c5[_0x4e061c+_0x1d8b('0x6f')]=![];}return _0x24afdc[_0x1d8b('0x70')]();})[_0x1d8b('0x37')](function(_0x40e499){var _0x4fd733=require(_0x1d8b('0x71'));var _0x41e44c=_0x4fd733['getChannels']();_0x41e44c[_0x1d8b('0x72')](function(_0x244724){var _0x5082d9=_0x244724+_0x1d8b('0x73');_0x24afdc[_0x1d8b('0x74')]([_0x5082d9],_0x40e499[_0x5082d9]);});return _0x24afdc[_0x1d8b('0x60')](_0x2c09c5);})[_0x1d8b('0x3b')](function(_0x4802f4){throw _0x4802f4;});}}});};
\ No newline at end of file
index 9845bc9..264d4e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ddf=['interface','agent','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','getChannels','merge','LOGIN','callysquare','bulkCreate','concat','LOGININPAUSE','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','redis','localhost','./user.socket','GetUser','User','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','catch','error','message','ShowUser','find','where','name','role','internal','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','findAll','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','push','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','UnpauseUser','resolve','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','faxPause','smsPause','pauseType','lastPauseAt','unpause','channel','system','LogoutUser','forEach','all','LoginUser','mobile','phone','loginInPause'];(function(_0xd8ae7,_0x4f50ee){var _0x13c9e3=function(_0x1ff50c){while(--_0x1ff50c){_0xd8ae7['push'](_0xd8ae7['shift']());}};_0x13c9e3(++_0x4f50ee);}(_0x9ddf,0x1b2));var _0xf9dd=function(_0x24088,_0x5792d6){_0x24088=_0x24088-0x0;var _0x446a46=_0x9ddf[_0x24088];return _0x446a46;};'use strict';var _=require('lodash');var util=require(_0xf9dd('0x0'));var moment=require('moment');var BPromise=require(_0xf9dd('0x1'));var Redis=require(_0xf9dd('0x2'));var db=require(_0xf9dd('0x3'))['db'];var utils=require(_0xf9dd('0x4'));var logger=require(_0xf9dd('0x5'))(_0xf9dd('0x6'));var config=require('../../config/environment');config[_0xf9dd('0x7')]=_['defaults'](config[_0xf9dd('0x7')],{'host':_0xf9dd('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9dd('0x7')]));require(_0xf9dd('0x9'))['register'](socket);exports[_0xf9dd('0xa')]=function(_0xf1b09b){var _0x4109f2=this;return new Promise(function(_0x19337e,_0x23a851){return db[_0xf9dd('0xb')]['findAll']({'raw':_0xf1b09b[_0xf9dd('0xc')]?_0xf1b09b[_0xf9dd('0xc')][_0xf9dd('0xd')]===undefined?!![]:![]:!![],'where':_0xf1b09b[_0xf9dd('0xc')]?_0xf1b09b[_0xf9dd('0xc')]['where']||null:null,'attributes':_0xf1b09b[_0xf9dd('0xc')]?_0xf1b09b[_0xf9dd('0xc')][_0xf9dd('0xe')]||null:null,'limit':_0xf1b09b[_0xf9dd('0xc')]?_0xf1b09b[_0xf9dd('0xc')][_0xf9dd('0xf')]||null:null,'include':_0xf1b09b[_0xf9dd('0xc')]?_0xf1b09b[_0xf9dd('0xc')][_0xf9dd('0x10')]?_[_0xf9dd('0x11')](_0xf1b09b[_0xf9dd('0xc')]['include'],function(_0x33e6ce){return{'model':db[_0x33e6ce[_0xf9dd('0x12')]],'as':_0x33e6ce['as'],'attributes':_0x33e6ce['attributes'],'include':_0x33e6ce[_0xf9dd('0x10')]?_['map'](_0x33e6ce['include'],function(_0x2d039b){return{'model':db[_0x2d039b['model']],'as':_0x2d039b['as'],'attributes':_0x2d039b[_0xf9dd('0xe')],'include':_0x2d039b[_0xf9dd('0x10')]?_[_0xf9dd('0x11')](_0x2d039b['include'],function(_0x279162){return{'model':db[_0x279162[_0xf9dd('0x12')]],'as':_0x279162['as'],'attributes':_0x279162[_0xf9dd('0xe')]};}):[]};}):[]};}):[]:[]})[_0xf9dd('0x13')](function(_0x3292cb){logger[_0xf9dd('0x14')]('GetUser',_0xf1b09b);logger[_0xf9dd('0x15')](_0xf9dd('0xa'),_0xf1b09b,JSON[_0xf9dd('0x16')](_0x3292cb));_0x19337e(_0x3292cb);})[_0xf9dd('0x17')](function(_0x384709){logger[_0xf9dd('0x18')](_0xf9dd('0xa'),_0x384709['message'],_0xf1b09b);_0x23a851(_0x4109f2[_0xf9dd('0x18')](0x1f4,_0x384709[_0xf9dd('0x19')]));});});};exports[_0xf9dd('0x1a')]=function(_0x29425d){var _0xcbd689=this;return new Promise(function(_0x1bf8ce,_0x593917){return db['User'][_0xf9dd('0x1b')]({'raw':_0x29425d[_0xf9dd('0xc')]?_0x29425d[_0xf9dd('0xc')]['raw']===undefined?!![]:![]:!![],'where':_0x29425d[_0xf9dd('0xc')]?_0x29425d['options']['where']||null:null,'attributes':_0x29425d[_0xf9dd('0xc')]?_0x29425d[_0xf9dd('0xc')]['attributes']||null:null,'include':_0x29425d[_0xf9dd('0xc')]?_0x29425d['options'][_0xf9dd('0x10')]?_[_0xf9dd('0x11')](_0x29425d['options'][_0xf9dd('0x10')],function(_0x2f7a03){return{'model':db[_0x2f7a03[_0xf9dd('0x12')]],'as':_0x2f7a03['as'],'attributes':_0x2f7a03['attributes'],'include':_0x2f7a03['include']?_[_0xf9dd('0x11')](_0x2f7a03['include'],function(_0x8efcbc){return{'model':db[_0x8efcbc[_0xf9dd('0x12')]],'as':_0x8efcbc['as'],'attributes':_0x8efcbc[_0xf9dd('0xe')],'include':_0x8efcbc[_0xf9dd('0x10')]?_['map'](_0x8efcbc[_0xf9dd('0x10')],function(_0x40daf3){return{'model':db[_0x40daf3[_0xf9dd('0x12')]],'as':_0x40daf3['as'],'attributes':_0x40daf3[_0xf9dd('0xe')]};}):[]};}):[]};}):[]:[]})[_0xf9dd('0x13')](function(_0x10417c){logger[_0xf9dd('0x14')](_0xf9dd('0x1a'),_0x29425d);logger[_0xf9dd('0x15')](_0xf9dd('0x1a'),_0x29425d,JSON[_0xf9dd('0x16')](_0x10417c));_0x1bf8ce(_0x10417c);})[_0xf9dd('0x17')](function(_0x11df3b){logger[_0xf9dd('0x18')](_0xf9dd('0x1a'),_0x11df3b[_0xf9dd('0x19')],_0x29425d);_0x593917(_0xcbd689[_0xf9dd('0x18')](0x1f4,_0x11df3b[_0xf9dd('0x19')]));});});};exports['PauseUser']=function(_0x58a770){var _0x2686d7;return db[_0xf9dd('0xb')][_0xf9dd('0x1b')]({'where':_0x58a770[_0xf9dd('0xc')][_0xf9dd('0x1c')]||{},'attributes':['id',_0xf9dd('0x1d'),_0xf9dd('0x1e'),_0xf9dd('0x1f'),'interface']})[_0xf9dd('0x13')](function(_0x2d7f2b){if(!_0x2d7f2b){throw new Error(util[_0xf9dd('0x20')](_0xf9dd('0x21'),_0x58a770[_0xf9dd('0x22')]['id']));}_0x2686d7=_0x2d7f2b;return db[_0xf9dd('0x23')][_0xf9dd('0x24')]({'paused':0x1},{'where':{'UserId':_0x2686d7['id']},'individualHooks':!![]});})[_0xf9dd('0x13')](function(){return db[_0xf9dd('0x25')][_0xf9dd('0x26')]({'where':{'membername':_0x2686d7[_0xf9dd('0x1d')],'type':_0xf9dd('0x27'),'exitAt':null}});})[_0xf9dd('0x13')](function(_0x3b7855){if(_0x3b7855&&_0x3b7855[_0xf9dd('0x28')]){var _0x144823=moment()[_0xf9dd('0x20')](_0xf9dd('0x29'));for(var _0x40c3e8=0x0,_0x2c3242=_0x3b7855[_0xf9dd('0x28')];_0x40c3e8<_0x2c3242;_0x40c3e8++){_0x3b7855[_0x40c3e8][_0xf9dd('0x2a')]({'exitAt':_0x144823});}}})['then'](function(){var _0x4de7b9=[];var _0x2b5d20=utils['getChannels']();_0x2b5d20['forEach'](function(_0x28f473){_0x4de7b9[_0xf9dd('0x2b')]({'channel':_0x28f473,'membername':_0x2686d7[_0xf9dd('0x1d')],'interface':_['isNil'](_0x2686d7['interface'])?util[_0xf9dd('0x20')](_0xf9dd('0x2c'),_0x2686d7[_0xf9dd('0x1d')]):_0x2686d7['interface'],'type':'PAUSE','enterAt':moment()[_0xf9dd('0x20')](_0xf9dd('0x29')),'data1':_0x58a770[_0xf9dd('0x2d')][_0xf9dd('0x2e')]||_0xf9dd('0x2f'),'role':_0x2686d7[_0xf9dd('0x1e')],'internal':_0x2686d7[_0xf9dd('0x1f')],'uniqueid':_0x58a770[_0xf9dd('0x2d')][_0xf9dd('0x30')]||null});});return db[_0xf9dd('0x25')]['bulkCreate'](_0x4de7b9,{'individualHooks':!![]});})[_0xf9dd('0x13')](function(){return _0x2686d7[_0xf9dd('0x24')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x58a770['body'][_0xf9dd('0x2e')]||_0xf9dd('0x2f'),'lastPauseAt':moment()[_0xf9dd('0x20')](_0xf9dd('0x29'))});})[_0xf9dd('0x17')](function(_0x49bc77){throw _0x49bc77;});};exports[_0xf9dd('0x31')]=function(_0x52bcd3){return Promise[_0xf9dd('0x32')]()[_0xf9dd('0x13')](function(){if(_0x52bcd3['body']['channel']&&!utils['isValidChannel'](_0x52bcd3[_0xf9dd('0x2d')]['channel'])){throw new Error(util[_0xf9dd('0x20')](_0xf9dd('0x33'),_0x52bcd3[_0xf9dd('0x2d')]['channel']));}return db[_0xf9dd('0xb')][_0xf9dd('0x34')]({'where':_0x52bcd3[_0xf9dd('0xc')]['where']||{},'attributes':['id',_0xf9dd('0x1d'),'role',_0xf9dd('0x1f'),'interface',_0xf9dd('0x35'),_0xf9dd('0x36'),_0xf9dd('0x37'),'chatPause',_0xf9dd('0x38'),'openchannelPause',_0xf9dd('0x39'),'whatsappPause',_0xf9dd('0x3a'),_0xf9dd('0x3b')]});})[_0xf9dd('0x13')](function(_0x1a507c){if(!_0x1a507c){throw new Error(util['format'](_0xf9dd('0x21'),_0x52bcd3[_0xf9dd('0x22')]['id']));}return _0x1a507c[_0xf9dd('0x3c')](_0x52bcd3[_0xf9dd('0x2d')][_0xf9dd('0x3d')],_0xf9dd('0x3e'));})[_0xf9dd('0x17')](function(_0x5d16d6){throw _0x5d16d6;});};exports[_0xf9dd('0x3f')]=function(_0x72cf76){var _0x87a5db=this;return new Promise(function(_0xc2e3b6,_0x3006ae){var _0x3fd6c5;return db[_0xf9dd('0xb')][_0xf9dd('0x34')]({'where':_0x72cf76[_0xf9dd('0xc')][_0xf9dd('0x1c')]||{},'attributes':['id',_0xf9dd('0x1d')]})[_0xf9dd('0x13')](function(_0x1b3f25){if(_0x1b3f25){_0x3fd6c5=_0x1b3f25;return db[_0xf9dd('0x23')]['destroy']({'where':{'membername':_0x3fd6c5['name']},'individualHooks':!![]});}})[_0xf9dd('0x13')](function(){if(_0x3fd6c5){return db[_0xf9dd('0x25')][_0xf9dd('0x26')]({'where':{'membername':_0x3fd6c5['name'],'exitAt':null}});}})[_0xf9dd('0x13')](function(_0x45b2ce){if(_0x3fd6c5){if(_0x45b2ce&&_0x45b2ce['length']){var _0x164c96=[];_0x45b2ce[_0xf9dd('0x40')](function(_0x29e974){_0x164c96[_0xf9dd('0x2b')](_0x29e974[_0xf9dd('0x24')]({'exitAt':moment()[_0xf9dd('0x20')](_0xf9dd('0x29'))}));});return BPromise[_0xf9dd('0x41')](_0x164c96);}}})[_0xf9dd('0x13')](function(){if(_0x3fd6c5){return _0x3fd6c5[_0xf9dd('0x24')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xf9dd('0x13')](function(_0x5612b1){_0xc2e3b6(_0x5612b1);})[_0xf9dd('0x17')](function(_0x11c91d){_0x3006ae(_0x87a5db[_0xf9dd('0x18')](0x1f4,_0x11c91d['message']));});});};exports[_0xf9dd('0x42')]=function(_0x56de4e){var _0x62dec2=this;return new Promise(function(_0x1497b7,_0x526c9e){var _0x2da708;var _0x5b7e42;var _0x364462;var _0x2d77ca;return db[_0xf9dd('0xb')][_0xf9dd('0x34')]({'where':_0x56de4e[_0xf9dd('0xc')][_0xf9dd('0x1c')]||{},'attributes':['id',_0xf9dd('0x1d'),_0xf9dd('0x1e'),_0xf9dd('0x43'),_0xf9dd('0x44'),_0xf9dd('0x1f'),_0xf9dd('0x45'),_0xf9dd('0x46')]})[_0xf9dd('0x13')](function(_0x3d94fe){if(_0x3d94fe){_0x2da708=_0x3d94fe;_0x2d77ca=_0x56de4e[_0xf9dd('0x2d')]['interface']?_0x56de4e[_0xf9dd('0x2d')]['interface']:util[_0xf9dd('0x20')]('SIP/%s',_0x2da708[_0xf9dd('0x1d')]);return db[_0xf9dd('0xb')]['count']({'where':{'role':_0xf9dd('0x47'),'online':!![],'id':{'$ne':_0x2da708['id']}}});}})[_0xf9dd('0x13')](function(_0x476e07){if(_0x476e07){_0x364462=_0x476e07;return require('../../config/license/util')['getLicense']();}})['then'](function(_0x8bf8e9){if(_0x8bf8e9&&_0x8bf8e9[_0xf9dd('0x48')]&&_0x364462>=_0x8bf8e9['agents']){throw new Error(_0xf9dd('0x49'));}})[_0xf9dd('0x13')](function(){if(_0x2da708){return db[_0xf9dd('0x23')]['destroy']({'where':{'membername':_0x2da708[_0xf9dd('0x1d')]},'individualHooks':!![]});}})[_0xf9dd('0x13')](function(){if(_0x2da708){return _0x2da708[_0xf9dd('0x4a')]({'raw':!![]});}})[_0xf9dd('0x13')](function(_0x1ae3c1){if(_0x2da708){if(_0x1ae3c1){var _0x3fc2bc=[];_0x5b7e42=_0x1ae3c1;if(_0x5b7e42[_0xf9dd('0x28')]){for(var _0x241266=0x0;_0x241266<_0x5b7e42[_0xf9dd('0x28')];_0x241266++){_0x3fc2bc[_0xf9dd('0x2b')](db['UserVoiceQueueRt'][_0xf9dd('0x4b')]({'membername':_0x2da708[_0xf9dd('0x1d')],'UserId':_0x2da708['id'],'queue_name':_0x5b7e42[_0x241266]['name'],'VoiceQueueId':_0x5b7e42[_0x241266]['id'],'interface':_0x2d77ca,'paused':_0x2da708['loginInPause']||![],'penalty':_0x5b7e42[_0x241266][_0xf9dd('0x4c')]||0x0}));}return BPromise[_0xf9dd('0x41')](_0x3fc2bc);}}}})[_0xf9dd('0x13')](function(){if(_0x2da708){return db[_0xf9dd('0x25')][_0xf9dd('0x26')]({'where':{'membername':_0x2da708[_0xf9dd('0x1d')],'exitAt':null}});}})[_0xf9dd('0x13')](function(_0x569dbf){if(_0x2da708){if(_0x569dbf&&_0x569dbf[_0xf9dd('0x28')]){var _0x5763b4=[];_0x569dbf[_0xf9dd('0x40')](function(_0x4e5fd0){_0x5763b4[_0xf9dd('0x2b')](_0x4e5fd0['update']({'exitAt':moment()[_0xf9dd('0x20')](_0xf9dd('0x29'))}));});return BPromise[_0xf9dd('0x41')](_0x5763b4);}}})[_0xf9dd('0x13')](function(){if(_0x2da708){var _0x144f1e=[];var _0x438e01=[];var _0x323c0d=utils[_0xf9dd('0x4d')]();var _0x4fda5e={'membername':_0x2da708[_0xf9dd('0x1d')],'interface':_0x2d77ca,'enterAt':moment()[_0xf9dd('0x20')](_0xf9dd('0x29')),'role':_0x2da708[_0xf9dd('0x1e')],'internal':_0x2da708[_0xf9dd('0x1f')]};_0x323c0d[_0xf9dd('0x40')](function(_0x406185){_0x144f1e[_0xf9dd('0x2b')](_[_0xf9dd('0x4e')]({'channel':_0x406185,'type':_0xf9dd('0x4f'),'data1':_0xf9dd('0x50'),'data2':_0x2d77ca},_0x4fda5e));if(_0x2da708[_0xf9dd('0x45')]){_0x438e01[_0xf9dd('0x2b')](_[_0xf9dd('0x4e')]({'channel':_0x406185,'type':_0xf9dd('0x27'),'data1':'LOGININPAUSE'},_0x4fda5e));}});return db[_0xf9dd('0x25')][_0xf9dd('0x51')](_0x144f1e[_0xf9dd('0x52')](_0x438e01),{'individualHooks':!![]});}})['then'](function(){if(_0x2da708){return _0x2da708[_0xf9dd('0x24')]({'online':!![],'lastLoginAt':moment()[_0xf9dd('0x20')](_0xf9dd('0x29')),'voicePause':_0x2da708[_0xf9dd('0x45')]||![],'mailPause':_0x2da708['loginInPause']||![],'chatPause':_0x2da708['loginInPause']||![],'faxPause':_0x2da708[_0xf9dd('0x45')]||![],'smsPause':_0x2da708[_0xf9dd('0x45')]||![],'openchannelPause':_0x2da708[_0xf9dd('0x45')]||![],'pauseType':_0x2da708['loginInPause']?_0xf9dd('0x53'):null,'lastPauseAt':moment()[_0xf9dd('0x20')](_0xf9dd('0x29')),'interface':_0x2d77ca});}})[_0xf9dd('0x13')](function(_0x450078){_0x1497b7(_0x450078);})[_0xf9dd('0x17')](function(_0x1ed290){_0x526c9e(_0x62dec2[_0xf9dd('0x18')](0x1f4,_0x1ed290[_0xf9dd('0x19')]));});});};
\ No newline at end of file
+var _0xe451=['socket.io-emitter','register','GetUser','User','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','catch','error','message','ShowUser','find','info','stringify','PauseUser','name','role','internal','interface','format','params','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','isNil','SIP/%s','body','DEFAULT\x20PAUSE','uniqueid','bulkCreate','type','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','chatPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','unpause','system','UserVoiceQueueRt','push','all','LoginUser','phone','count','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','loginInPause','merge','LOGININPAUSE','concat','lodash','util','../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost'];(function(_0x397dd0,_0x58a7a8){var _0x4188b2=function(_0x173bb7){while(--_0x173bb7){_0x397dd0['push'](_0x397dd0['shift']());}};_0x4188b2(++_0x58a7a8);}(_0xe451,0x1e4));var _0x1e45=function(_0x191055,_0x1920a6){_0x191055=_0x191055-0x0;var _0x163abb=_0xe451[_0x191055];return _0x163abb;};'use strict';var _=require(_0x1e45('0x0'));var util=require(_0x1e45('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Redis=require('ioredis');var db=require(_0x1e45('0x2'))['db'];var utils=require(_0x1e45('0x3'));var logger=require(_0x1e45('0x4'))('rpc');var config=require('../../config/environment');config[_0x1e45('0x5')]=_[_0x1e45('0x6')](config[_0x1e45('0x5')],{'host':_0x1e45('0x7'),'port':0x18eb});var socket=require(_0x1e45('0x8'))(new Redis(config[_0x1e45('0x5')]));require('./user.socket')[_0x1e45('0x9')](socket);exports[_0x1e45('0xa')]=function(_0x45aeb7){var _0x3a927d=this;return new Promise(function(_0x180210,_0x5e7cf1){return db[_0x1e45('0xb')][_0x1e45('0xc')]({'raw':_0x45aeb7[_0x1e45('0xd')]?_0x45aeb7[_0x1e45('0xd')][_0x1e45('0xe')]===undefined?!![]:![]:!![],'where':_0x45aeb7[_0x1e45('0xd')]?_0x45aeb7[_0x1e45('0xd')][_0x1e45('0xf')]||null:null,'attributes':_0x45aeb7[_0x1e45('0xd')]?_0x45aeb7[_0x1e45('0xd')][_0x1e45('0x10')]||null:null,'limit':_0x45aeb7[_0x1e45('0xd')]?_0x45aeb7[_0x1e45('0xd')][_0x1e45('0x11')]||null:null,'include':_0x45aeb7['options']?_0x45aeb7[_0x1e45('0xd')][_0x1e45('0x12')]?_[_0x1e45('0x13')](_0x45aeb7['options'][_0x1e45('0x12')],function(_0x45980f){return{'model':db[_0x45980f['model']],'as':_0x45980f['as'],'attributes':_0x45980f[_0x1e45('0x10')],'include':_0x45980f[_0x1e45('0x12')]?_[_0x1e45('0x13')](_0x45980f[_0x1e45('0x12')],function(_0x2318a2){return{'model':db[_0x2318a2[_0x1e45('0x14')]],'as':_0x2318a2['as'],'attributes':_0x2318a2[_0x1e45('0x10')],'include':_0x2318a2[_0x1e45('0x12')]?_[_0x1e45('0x13')](_0x2318a2[_0x1e45('0x12')],function(_0x1f08c7){return{'model':db[_0x1f08c7['model']],'as':_0x1f08c7['as'],'attributes':_0x1f08c7[_0x1e45('0x10')]};}):[]};}):[]};}):[]:[]})[_0x1e45('0x15')](function(_0x3b55e7){logger['info']('GetUser',_0x45aeb7);logger[_0x1e45('0x16')]('GetUser',_0x45aeb7,JSON['stringify'](_0x3b55e7));_0x180210(_0x3b55e7);})[_0x1e45('0x17')](function(_0x51c393){logger[_0x1e45('0x18')](_0x1e45('0xa'),_0x51c393[_0x1e45('0x19')],_0x45aeb7);_0x5e7cf1(_0x3a927d[_0x1e45('0x18')](0x1f4,_0x51c393[_0x1e45('0x19')]));});});};exports[_0x1e45('0x1a')]=function(_0x513522){var _0x47aa66=this;return new Promise(function(_0x2d0b5f,_0x53a3b6){return db[_0x1e45('0xb')][_0x1e45('0x1b')]({'raw':_0x513522[_0x1e45('0xd')]?_0x513522[_0x1e45('0xd')][_0x1e45('0xe')]===undefined?!![]:![]:!![],'where':_0x513522[_0x1e45('0xd')]?_0x513522[_0x1e45('0xd')][_0x1e45('0xf')]||null:null,'attributes':_0x513522[_0x1e45('0xd')]?_0x513522[_0x1e45('0xd')]['attributes']||null:null,'include':_0x513522[_0x1e45('0xd')]?_0x513522['options'][_0x1e45('0x12')]?_[_0x1e45('0x13')](_0x513522[_0x1e45('0xd')][_0x1e45('0x12')],function(_0x53a2bc){return{'model':db[_0x53a2bc[_0x1e45('0x14')]],'as':_0x53a2bc['as'],'attributes':_0x53a2bc['attributes'],'include':_0x53a2bc[_0x1e45('0x12')]?_[_0x1e45('0x13')](_0x53a2bc['include'],function(_0x2753f7){return{'model':db[_0x2753f7[_0x1e45('0x14')]],'as':_0x2753f7['as'],'attributes':_0x2753f7[_0x1e45('0x10')],'include':_0x2753f7['include']?_[_0x1e45('0x13')](_0x2753f7[_0x1e45('0x12')],function(_0x185689){return{'model':db[_0x185689[_0x1e45('0x14')]],'as':_0x185689['as'],'attributes':_0x185689[_0x1e45('0x10')]};}):[]};}):[]};}):[]:[]})[_0x1e45('0x15')](function(_0x165f02){logger[_0x1e45('0x1c')]('ShowUser',_0x513522);logger[_0x1e45('0x16')]('ShowUser',_0x513522,JSON[_0x1e45('0x1d')](_0x165f02));_0x2d0b5f(_0x165f02);})[_0x1e45('0x17')](function(_0x1cc231){logger['error']('ShowUser',_0x1cc231[_0x1e45('0x19')],_0x513522);_0x53a3b6(_0x47aa66[_0x1e45('0x18')](0x1f4,_0x1cc231[_0x1e45('0x19')]));});});};exports[_0x1e45('0x1e')]=function(_0x1aeab7){var _0x59bbe8;return db[_0x1e45('0xb')][_0x1e45('0x1b')]({'where':_0x1aeab7[_0x1e45('0xd')][_0x1e45('0xf')]||{},'attributes':['id',_0x1e45('0x1f'),_0x1e45('0x20'),_0x1e45('0x21'),_0x1e45('0x22')]})[_0x1e45('0x15')](function(_0xbc061){if(!_0xbc061){throw new Error(util[_0x1e45('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x1aeab7[_0x1e45('0x24')]['id']));}_0x59bbe8=_0xbc061;return db['UserVoiceQueueRt'][_0x1e45('0x25')]({'paused':0x1},{'where':{'UserId':_0x59bbe8['id']},'individualHooks':!![]});})['then'](function(){return db[_0x1e45('0x26')][_0x1e45('0xc')]({'where':{'membername':_0x59bbe8[_0x1e45('0x1f')],'type':_0x1e45('0x27'),'exitAt':null}});})[_0x1e45('0x15')](function(_0x3f3100){if(_0x3f3100&&_0x3f3100[_0x1e45('0x28')]){var _0x2376e3=moment()[_0x1e45('0x23')](_0x1e45('0x29'));for(var _0x3bbe09=0x0,_0x5300f0=_0x3f3100[_0x1e45('0x28')];_0x3bbe09<_0x5300f0;_0x3bbe09++){_0x3f3100[_0x3bbe09][_0x1e45('0x2a')]({'exitAt':_0x2376e3});}}})['then'](function(){var _0x161a5e=[];var _0x5ecc25=utils[_0x1e45('0x2b')]();_0x5ecc25[_0x1e45('0x2c')](function(_0x45ec80){_0x161a5e['push']({'channel':_0x45ec80,'membername':_0x59bbe8[_0x1e45('0x1f')],'interface':_[_0x1e45('0x2d')](_0x59bbe8[_0x1e45('0x22')])?util['format'](_0x1e45('0x2e'),_0x59bbe8[_0x1e45('0x1f')]):_0x59bbe8[_0x1e45('0x22')],'type':'PAUSE','enterAt':moment()[_0x1e45('0x23')](_0x1e45('0x29')),'data1':_0x1aeab7[_0x1e45('0x2f')]['type']||_0x1e45('0x30'),'role':_0x59bbe8[_0x1e45('0x20')],'internal':_0x59bbe8[_0x1e45('0x21')],'uniqueid':_0x1aeab7[_0x1e45('0x2f')][_0x1e45('0x31')]||null});});return db[_0x1e45('0x26')][_0x1e45('0x32')](_0x161a5e,{'individualHooks':!![]});})[_0x1e45('0x15')](function(){return _0x59bbe8[_0x1e45('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x1aeab7[_0x1e45('0x2f')][_0x1e45('0x33')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1e45('0x23')](_0x1e45('0x29'))});})[_0x1e45('0x17')](function(_0x91dbd4){throw _0x91dbd4;});};exports['UnpauseUser']=function(_0x192509){return Promise[_0x1e45('0x34')]()[_0x1e45('0x15')](function(){if(_0x192509[_0x1e45('0x2f')][_0x1e45('0x35')]&&!utils['isValidChannel'](_0x192509[_0x1e45('0x2f')][_0x1e45('0x35')])){throw new Error(util[_0x1e45('0x23')](_0x1e45('0x36'),_0x192509[_0x1e45('0x2f')][_0x1e45('0x35')]));}return db['User'][_0x1e45('0x37')]({'where':_0x192509[_0x1e45('0xd')]['where']||{},'attributes':['id',_0x1e45('0x1f'),_0x1e45('0x20'),_0x1e45('0x21'),'interface',_0x1e45('0x38'),_0x1e45('0x39'),'mailPause',_0x1e45('0x3a'),'faxPause',_0x1e45('0x3b'),_0x1e45('0x3c'),_0x1e45('0x3d'),_0x1e45('0x3e'),_0x1e45('0x3f')]});})[_0x1e45('0x15')](function(_0x438aef){if(!_0x438aef){throw new Error(util[_0x1e45('0x23')]('User\x20with\x20id\x20%s\x20not\x20found',_0x192509[_0x1e45('0x24')]['id']));}return _0x438aef[_0x1e45('0x40')](_0x192509[_0x1e45('0x2f')][_0x1e45('0x35')],_0x1e45('0x41'));})[_0x1e45('0x17')](function(_0x321d80){throw _0x321d80;});};exports['LogoutUser']=function(_0xf3c606){var _0x11fb79=this;return new Promise(function(_0x4eabf1,_0x5c2871){var _0x462e14;return db[_0x1e45('0xb')][_0x1e45('0x37')]({'where':_0xf3c606[_0x1e45('0xd')][_0x1e45('0xf')]||{},'attributes':['id',_0x1e45('0x1f')]})['then'](function(_0x2edd0e){if(_0x2edd0e){_0x462e14=_0x2edd0e;return db[_0x1e45('0x42')]['destroy']({'where':{'membername':_0x462e14[_0x1e45('0x1f')]},'individualHooks':!![]});}})[_0x1e45('0x15')](function(){if(_0x462e14){return db[_0x1e45('0x26')]['findAll']({'where':{'membername':_0x462e14['name'],'exitAt':null}});}})[_0x1e45('0x15')](function(_0xcfaaa){if(_0x462e14){if(_0xcfaaa&&_0xcfaaa['length']){var _0x10604e=[];_0xcfaaa[_0x1e45('0x2c')](function(_0x16281c){_0x10604e[_0x1e45('0x43')](_0x16281c['update']({'exitAt':moment()[_0x1e45('0x23')](_0x1e45('0x29'))}));});return BPromise[_0x1e45('0x44')](_0x10604e);}}})[_0x1e45('0x15')](function(){if(_0x462e14){return _0x462e14[_0x1e45('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1e45('0x15')](function(_0x40b2dc){_0x4eabf1(_0x40b2dc);})[_0x1e45('0x17')](function(_0x2055ba){_0x5c2871(_0x11fb79['error'](0x1f4,_0x2055ba[_0x1e45('0x19')]));});});};exports[_0x1e45('0x45')]=function(_0x1846b6){var _0xbb9bdb=this;return new Promise(function(_0x713eac,_0x27bd0f){var _0x56a5e1;var _0x49e0ab;var _0x44d071;var _0x565c60;return db[_0x1e45('0xb')][_0x1e45('0x37')]({'where':_0x1846b6['options'][_0x1e45('0xf')]||{},'attributes':['id',_0x1e45('0x1f'),_0x1e45('0x20'),'mobile',_0x1e45('0x46'),_0x1e45('0x21'),'loginInPause',_0x1e45('0x22')]})['then'](function(_0x253ae3){if(_0x253ae3){_0x56a5e1=_0x253ae3;_0x565c60=_0x1846b6[_0x1e45('0x2f')]['interface']?_0x1846b6['body'][_0x1e45('0x22')]:util[_0x1e45('0x23')](_0x1e45('0x2e'),_0x56a5e1[_0x1e45('0x1f')]);return db[_0x1e45('0xb')][_0x1e45('0x47')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x56a5e1['id']}}});}})['then'](function(_0x281c22){if(_0x281c22){_0x44d071=_0x281c22;return require('../../config/license/util')[_0x1e45('0x48')]();}})[_0x1e45('0x15')](function(_0x21d21f){if(_0x21d21f&&_0x21d21f[_0x1e45('0x49')]&&_0x44d071>=_0x21d21f[_0x1e45('0x49')]){throw new Error(_0x1e45('0x4a'));}})['then'](function(){if(_0x56a5e1){return db[_0x1e45('0x42')][_0x1e45('0x4b')]({'where':{'membername':_0x56a5e1[_0x1e45('0x1f')]},'individualHooks':!![]});}})[_0x1e45('0x15')](function(){if(_0x56a5e1){return _0x56a5e1[_0x1e45('0x4c')]({'raw':!![]});}})[_0x1e45('0x15')](function(_0x5b0f03){if(_0x56a5e1){if(_0x5b0f03){var _0x125d97=[];_0x49e0ab=_0x5b0f03;if(_0x49e0ab['length']){for(var _0x4727a8=0x0;_0x4727a8<_0x49e0ab[_0x1e45('0x28')];_0x4727a8++){_0x125d97[_0x1e45('0x43')](db[_0x1e45('0x42')][_0x1e45('0x4d')]({'membername':_0x56a5e1[_0x1e45('0x1f')],'UserId':_0x56a5e1['id'],'queue_name':_0x49e0ab[_0x4727a8][_0x1e45('0x1f')],'VoiceQueueId':_0x49e0ab[_0x4727a8]['id'],'interface':_0x565c60,'paused':_0x56a5e1[_0x1e45('0x4e')]||![],'penalty':_0x49e0ab[_0x4727a8]['UserVoiceQueue.penalty']||0x0}));}return BPromise['all'](_0x125d97);}}}})[_0x1e45('0x15')](function(){if(_0x56a5e1){return db[_0x1e45('0x26')]['findAll']({'where':{'membername':_0x56a5e1[_0x1e45('0x1f')],'exitAt':null}});}})['then'](function(_0x3bd18e){if(_0x56a5e1){if(_0x3bd18e&&_0x3bd18e[_0x1e45('0x28')]){var _0x158ff5=[];_0x3bd18e[_0x1e45('0x2c')](function(_0x598ced){_0x158ff5[_0x1e45('0x43')](_0x598ced[_0x1e45('0x25')]({'exitAt':moment()[_0x1e45('0x23')](_0x1e45('0x29'))}));});return BPromise[_0x1e45('0x44')](_0x158ff5);}}})[_0x1e45('0x15')](function(){if(_0x56a5e1){var _0x3b6d1e=[];var _0xd33f9a=[];var _0x1e0d4e=utils[_0x1e45('0x2b')]();var _0x5aea3c={'membername':_0x56a5e1[_0x1e45('0x1f')],'interface':_0x565c60,'enterAt':moment()[_0x1e45('0x23')](_0x1e45('0x29')),'role':_0x56a5e1[_0x1e45('0x20')],'internal':_0x56a5e1[_0x1e45('0x21')]};_0x1e0d4e['forEach'](function(_0x1ddf00){_0x3b6d1e[_0x1e45('0x43')](_[_0x1e45('0x4f')]({'channel':_0x1ddf00,'type':'LOGIN','data1':'callysquare','data2':_0x565c60},_0x5aea3c));if(_0x56a5e1['loginInPause']){_0xd33f9a['push'](_['merge']({'channel':_0x1ddf00,'type':_0x1e45('0x27'),'data1':_0x1e45('0x50')},_0x5aea3c));}});return db[_0x1e45('0x26')][_0x1e45('0x32')](_0x3b6d1e[_0x1e45('0x51')](_0xd33f9a),{'individualHooks':!![]});}})[_0x1e45('0x15')](function(){if(_0x56a5e1){return _0x56a5e1[_0x1e45('0x25')]({'online':!![],'lastLoginAt':moment()[_0x1e45('0x23')](_0x1e45('0x29')),'voicePause':_0x56a5e1[_0x1e45('0x4e')]||![],'mailPause':_0x56a5e1['loginInPause']||![],'chatPause':_0x56a5e1['loginInPause']||![],'faxPause':_0x56a5e1[_0x1e45('0x4e')]||![],'smsPause':_0x56a5e1[_0x1e45('0x4e')]||![],'openchannelPause':_0x56a5e1[_0x1e45('0x4e')]||![],'pauseType':_0x56a5e1[_0x1e45('0x4e')]?_0x1e45('0x50'):null,'lastPauseAt':moment()['format'](_0x1e45('0x29')),'interface':_0x565c60});}})['then'](function(_0x2eb133){_0x713eac(_0x2eb133);})[_0x1e45('0x17')](function(_0x2eefb3){_0x27bd0f(_0xbb9bdb[_0x1e45('0x18')](0x1f4,_0x2eefb3[_0x1e45('0x19')]));});});};
\ No newline at end of file
index b82a7bf..f303d1e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeafd=['removeListener','register','user:','./user.events','save','emit'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0xeafd,0x135));var _0xdeaf=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xeafd[_0x2e2681];return _0x368a64;};'use strict';var UserEvents=require(_0xdeaf('0x0'));var events=[_0xdeaf('0x1'),'remove','update'];function createListener(_0x55ef96,_0x52a48f){return function(_0xccf765){_0x52a48f[_0xdeaf('0x2')](_0x55ef96,_0xccf765);};}function removeListener(_0x46abdd,_0xdd0cb){return function(){UserEvents[_0xdeaf('0x3')](_0x46abdd,_0xdd0cb);};}exports[_0xdeaf('0x4')]=function(_0x52061f){for(var _0x2180d6=0x0,_0x5a70e0=events['length'];_0x2180d6<_0x5a70e0;_0x2180d6++){var _0x2462ac=events[_0x2180d6];var _0x275f27=createListener(_0xdeaf('0x5')+_0x2462ac,_0x52061f);UserEvents['on'](_0x2462ac,_0x275f27);}};
\ No newline at end of file
+var _0x8cd8=['register','length','user:','./user.events','save','emit','removeListener'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x8cd8,0x8f));var _0x88cd=function(_0x5719e4,_0x3aa0b9){_0x5719e4=_0x5719e4-0x0;var _0x1d74f7=_0x8cd8[_0x5719e4];return _0x1d74f7;};'use strict';var UserEvents=require(_0x88cd('0x0'));var events=[_0x88cd('0x1'),'remove','update'];function createListener(_0x2d46c5,_0x225e1f){return function(_0x21b8da){_0x225e1f[_0x88cd('0x2')](_0x2d46c5,_0x21b8da);};}function removeListener(_0x5be626,_0x4f9a97){return function(){UserEvents[_0x88cd('0x3')](_0x5be626,_0x4f9a97);};}exports[_0x88cd('0x4')]=function(_0x4578f1){for(var _0x4d9e2f=0x0,_0x5c1f74=events[_0x88cd('0x5')];_0x4d9e2f<_0x5c1f74;_0x4d9e2f++){var _0x2c5755=events[_0x4d9e2f];var _0x36aefc=createListener(_0x88cd('0x6')+_0x2c5755,_0x4578f1);UserEvents['on'](_0x2c5755,_0x36aefc);}};
\ No newline at end of file
index 02e6c98..bcf6036 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x550458,_0x51c984){var _0x4cda07=function(_0x4dd8cd){while(--_0x4dd8cd){_0x550458['push'](_0x550458['shift']());}};_0x4cda07(++_0x51c984);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5774be,_0x2259d3){_0x5774be=_0x5774be-0x0;var _0x4914b4=_0xcb91[_0x5774be];return _0x4914b4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router;
\ No newline at end of file
+var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x37bcd8,_0x27bed9){var _0x422480=function(_0x510db3){while(--_0x510db3){_0x37bcd8['push'](_0x37bcd8['shift']());}};_0x422480(++_0x27bed9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
index 03cccc8..20ee21f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc8d=['INTEGER','sequelize'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xbc8d,0x15b));var _0xdbc8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc8d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xdbc8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xdbc8('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xf5cd=['sequelize','exports','INTEGER'];(function(_0x5aaa92,_0x432b00){var _0x3f0367=function(_0x5a517e){while(--_0x5a517e){_0x5aaa92['push'](_0x5aaa92['shift']());}};_0x3f0367(++_0x432b00);}(_0xf5cd,0x1bf));var _0xdf5c=function(_0x31e16a,_0x210c6c){_0x31e16a=_0x31e16a-0x0;var _0x58e686=_0xf5cd[_0x31e16a];return _0x58e686;};'use strict';var Sequelize=require(_0xdf5c('0x0'));module[_0xdf5c('0x1')]={'penalty':{'type':Sequelize[_0xdf5c('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index 348eb0b..143920d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd86a=['exports','define','user_has_chat_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes'];(function(_0x129d96,_0x5ab341){var _0x52ac87=function(_0x313d0d){while(--_0x313d0d){_0x129d96['push'](_0x129d96['shift']());}};_0x52ac87(++_0x5ab341);}(_0xd86a,0x183));var _0xad86=function(_0x6173fc,_0x32aadf){_0x6173fc=_0x6173fc-0x0;var _0x965fbe=_0xd86a[_0x6173fc];return _0x965fbe;};'use strict';var _=require(_0xad86('0x0'));var util=require('util');var logger=require(_0xad86('0x1'))(_0xad86('0x2'));var moment=require(_0xad86('0x3'));var BPromise=require(_0xad86('0x4'));var rp=require(_0xad86('0x5'));var fs=require('fs');var path=require(_0xad86('0x6'));var rimraf=require('rimraf');var config=require(_0xad86('0x7'));var attributes=require(_0xad86('0x8'));module[_0xad86('0x9')]=function(_0x5663e3,_0x221956){return _0x5663e3[_0xad86('0xa')]('UserChatQueue',attributes,{'tableName':_0xad86('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd2cd=['path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','util','../../config/logger','request-promise'];(function(_0x166283,_0x32b4b2){var _0x5ee5cc=function(_0x395b3b){while(--_0x395b3b){_0x166283['push'](_0x166283['shift']());}};_0x5ee5cc(++_0x32b4b2);}(_0xd2cd,0xb7));var _0xdd2c=function(_0x2aae31,_0x1014a2){_0x2aae31=_0x2aae31-0x0;var _0x379006=_0xd2cd[_0x2aae31];return _0x379006;};'use strict';var _=require(_0xdd2c('0x0'));var util=require(_0xdd2c('0x1'));var logger=require(_0xdd2c('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdd2c('0x3'));var fs=require('fs');var path=require(_0xdd2c('0x4'));var rimraf=require(_0xdd2c('0x5'));var config=require(_0xdd2c('0x6'));var attributes=require(_0xdd2c('0x7'));module[_0xdd2c('0x8')]=function(_0x5f3684,_0x4b87d4){return _0x5f3684[_0xdd2c('0x9')](_0xdd2c('0xa'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index f0c2328..5d3acbf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d3c=['client','http','request','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x5adbb4,_0x5092e0){var _0x48e176=function(_0x2af1c8){while(--_0x2af1c8){_0x5adbb4['push'](_0x5adbb4['shift']());}};_0x48e176(++_0x5092e0);}(_0x4d3c,0x1db));var _0xc4d3=function(_0x2dd2d5,_0x599eea){_0x2dd2d5=_0x2dd2d5-0x0;var _0x2c3419=_0x4d3c[_0x2dd2d5];return _0x2c3419;};'use strict';var _=require(_0xc4d3('0x0'));var util=require(_0xc4d3('0x1'));var moment=require(_0xc4d3('0x2'));var BPromise=require(_0xc4d3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4d3('0x4'));var db=require(_0xc4d3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4d3('0x6'))(_0xc4d3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc4d3('0x8')][_0xc4d3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18fd19,_0x4722b3,_0x236268){return new BPromise(function(_0x4c66eb,_0x3d40cd){return client[_0xc4d3('0xa')](_0x18fd19,_0x236268)['then'](function(_0x5b1644){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x4722b3,_0xc4d3('0xb'));logger[_0xc4d3('0xc')](_0xc4d3('0xd'),_0x4722b3,_0xc4d3('0xb'),JSON[_0xc4d3('0xe')](_0x5b1644));if(_0x5b1644[_0xc4d3('0xf')]){if(_0x5b1644[_0xc4d3('0xf')][_0xc4d3('0x10')]===0x1f4){logger[_0xc4d3('0xf')](_0xc4d3('0x11'),_0x4722b3,_0x5b1644[_0xc4d3('0xf')][_0xc4d3('0x12')]);return _0x3d40cd(_0x5b1644[_0xc4d3('0xf')]['message']);}logger['error'](_0xc4d3('0x11'),_0x4722b3,_0x5b1644[_0xc4d3('0xf')][_0xc4d3('0x12')]);return _0x4c66eb(_0x5b1644['error'][_0xc4d3('0x12')]);}else{logger[_0xc4d3('0x13')](_0xc4d3('0x11'),_0x4722b3,'request\x20sent');_0x4c66eb(_0x5b1644[_0xc4d3('0x14')][_0xc4d3('0x12')]);}})['catch'](function(_0x263045){logger[_0xc4d3('0xf')](_0xc4d3('0x11'),_0x4722b3,_0x263045);_0x3d40cd(_0x263045);});});}
\ No newline at end of file
+var _0xa8e3=['request','then','info','request\x20sent','debug','stringify','error','message','UserChatQueue,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0x1404be,_0x4f4384){var _0xeaf7c1=function(_0x4fb590){while(--_0x4fb590){_0x1404be['push'](_0x1404be['shift']());}};_0xeaf7c1(++_0x4f4384);}(_0xa8e3,0x1c3));var _0x3a8e=function(_0x595013,_0x65a215){_0x595013=_0x595013-0x0;var _0x2a29e3=_0xa8e3[_0x595013];return _0x2a29e3;};'use strict';var _=require(_0x3a8e('0x0'));var util=require('util');var moment=require(_0x3a8e('0x1'));var BPromise=require(_0x3a8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a8e('0x3'))['db'];var utils=require(_0x3a8e('0x4'));var logger=require('../../config/logger')(_0x3a8e('0x5'));var config=require(_0x3a8e('0x6'));var jayson=require(_0x3a8e('0x7'));var client=jayson[_0x3a8e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54619c,_0x7a09eb,_0x5d58b9){return new BPromise(function(_0x5a362d,_0x32a878){return client[_0x3a8e('0x9')](_0x54619c,_0x5d58b9)[_0x3a8e('0xa')](function(_0x11381f){logger[_0x3a8e('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x7a09eb,_0x3a8e('0xc'));logger[_0x3a8e('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x7a09eb,_0x3a8e('0xc'),JSON[_0x3a8e('0xe')](_0x11381f));if(_0x11381f['error']){if(_0x11381f[_0x3a8e('0xf')]['code']===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x7a09eb,_0x11381f[_0x3a8e('0xf')]['message']);return _0x32a878(_0x11381f[_0x3a8e('0xf')][_0x3a8e('0x10')]);}logger[_0x3a8e('0xf')](_0x3a8e('0x11'),_0x7a09eb,_0x11381f[_0x3a8e('0xf')][_0x3a8e('0x10')]);return _0x5a362d(_0x11381f[_0x3a8e('0xf')][_0x3a8e('0x10')]);}else{logger[_0x3a8e('0xb')](_0x3a8e('0x11'),_0x7a09eb,_0x3a8e('0xc'));_0x5a362d(_0x11381f[_0x3a8e('0x12')]['message']);}})[_0x3a8e('0x13')](function(_0x4e0ee2){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x7a09eb,_0x4e0ee2);_0x32a878(_0x4e0ee2);});});}
\ No newline at end of file
index 6a4f2f9..818c54d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2f3782,_0x150f14){var _0x40a8c4=function(_0x1cdc87){while(--_0x1cdc87){_0x2f3782['push'](_0x2f3782['shift']());}};_0x40a8c4(++_0x150f14);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
+var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3059d0,_0x254157){var _0x58e2ad=function(_0x353431){while(--_0x353431){_0x3059d0['push'](_0x3059d0['shift']());}};_0x58e2ad(++_0x254157);}(_0x70e0,0x17b));var _0x070e=function(_0x1d7fcf,_0x49f676){_0x1d7fcf=_0x1d7fcf-0x0;var _0x56b54a=_0x70e0[_0x1d7fcf];return _0x56b54a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
index 4fec48c..915c578 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a46=['INTEGER','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6a46,0x1b0));var _0x66a4=function(_0xf26e48,_0x3d1065){_0xf26e48=_0xf26e48-0x0;var _0x310aef=_0x6a46[_0xf26e48];return _0x310aef;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x66a4('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x66a4('0x1')]}};
\ No newline at end of file
+var _0xf8a8=['INTEGER','STRING','sequelize'];(function(_0x3817a9,_0x29e215){var _0x443f30=function(_0x13940b){while(--_0x13940b){_0x3817a9['push'](_0x3817a9['shift']());}};_0x443f30(++_0x29e215);}(_0xf8a8,0x10d));var _0x8f8a=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xf8a8[_0x543084];return _0x306a57;};'use strict';var Sequelize=require(_0x8f8a('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x8f8a('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8f8a('0x2')]}};
\ No newline at end of file
index 3eb3f8c..cfc8c72 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0fd=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0xe0fd,0x120));var _0xde0f=function(_0x2c6e92,_0x1f3638){_0x2c6e92=_0x2c6e92-0x0;var _0x5e3ced=_0xe0fd[_0x2c6e92];return _0x5e3ced;};'use strict';var _=require(_0xde0f('0x0'));var util=require('util');var logger=require(_0xde0f('0x1'))(_0xde0f('0x2'));var moment=require('moment');var BPromise=require(_0xde0f('0x3'));var rp=require(_0xde0f('0x4'));var fs=require('fs');var path=require(_0xde0f('0x5'));var rimraf=require(_0xde0f('0x6'));var config=require(_0xde0f('0x7'));var attributes=require(_0xde0f('0x8'));module['exports']=function(_0x2771ae,_0x3bd3de){return _0x2771ae[_0xde0f('0x9')](_0xde0f('0xa'),attributes,{'tableName':_0xde0f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3401=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3401,0x163));var _0x1340=function(_0x82bb9c,_0x45d0f2){_0x82bb9c=_0x82bb9c-0x0;var _0x2b15ba=_0x3401[_0x82bb9c];return _0x2b15ba;};'use strict';var _=require(_0x1340('0x0'));var util=require(_0x1340('0x1'));var logger=require(_0x1340('0x2'))(_0x1340('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1340('0x4'));var fs=require('fs');var path=require(_0x1340('0x5'));var rimraf=require(_0x1340('0x6'));var config=require(_0x1340('0x7'));var attributes=require(_0x1340('0x8'));module[_0x1340('0x9')]=function(_0x3f34d9,_0x525935){return _0x3f34d9[_0x1340('0xa')](_0x1340('0xb'),attributes,{'tableName':_0x1340('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e3ad621..7d3483b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3b39=['moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util'];(function(_0x539991,_0x4fc3aa){var _0x365d0d=function(_0x2edc84){while(--_0x2edc84){_0x539991['push'](_0x539991['shift']());}};_0x365d0d(++_0x4fc3aa);}(_0x3b39,0x1b7));var _0x93b3=function(_0xeaba4b,_0x1eab4b){_0xeaba4b=_0xeaba4b-0x0;var _0x32f4fd=_0x3b39[_0xeaba4b];return _0x32f4fd;};'use strict';var _=require('lodash');var util=require(_0x93b3('0x0'));var moment=require(_0x93b3('0x1'));var BPromise=require(_0x93b3('0x2'));var rs=require(_0x93b3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x93b3('0x4'));var logger=require(_0x93b3('0x5'))(_0x93b3('0x6'));var config=require(_0x93b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x93b3('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x50cc8b,_0x54d433,_0x2caaa5){return new BPromise(function(_0x3962ec,_0x187ace){return client[_0x93b3('0x9')](_0x50cc8b,_0x2caaa5)['then'](function(_0x4838b3){logger[_0x93b3('0xa')](_0x93b3('0xb'),_0x54d433,'request\x20sent');logger[_0x93b3('0xc')](_0x93b3('0xd'),_0x54d433,_0x93b3('0xe'),JSON['stringify'](_0x4838b3));if(_0x4838b3[_0x93b3('0xf')]){if(_0x4838b3[_0x93b3('0xf')][_0x93b3('0x10')]===0x1f4){logger[_0x93b3('0xf')](_0x93b3('0xb'),_0x54d433,_0x4838b3['error'][_0x93b3('0x11')]);return _0x187ace(_0x4838b3[_0x93b3('0xf')][_0x93b3('0x11')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x54d433,_0x4838b3[_0x93b3('0xf')][_0x93b3('0x11')]);return _0x3962ec(_0x4838b3[_0x93b3('0xf')][_0x93b3('0x11')]);}else{logger[_0x93b3('0xa')](_0x93b3('0xb'),_0x54d433,_0x93b3('0xe'));_0x3962ec(_0x4838b3[_0x93b3('0x12')][_0x93b3('0x11')]);}})[_0x93b3('0x13')](function(_0x3eff27){logger[_0x93b3('0xf')](_0x93b3('0xb'),_0x54d433,_0x3eff27);_0x187ace(_0x3eff27);});});}
\ No newline at end of file
+var _0x5d96=['code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5d96,0x137));var _0x65d9=function(_0x550b35,_0xa48bb6){_0x550b35=_0x550b35-0x0;var _0x3fbb95=_0x5d96[_0x550b35];return _0x3fbb95;};'use strict';var _=require(_0x65d9('0x0'));var util=require('util');var moment=require(_0x65d9('0x1'));var BPromise=require(_0x65d9('0x2'));var rs=require(_0x65d9('0x3'));var fs=require('fs');var Redis=require(_0x65d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x65d9('0x5'))(_0x65d9('0x6'));var config=require(_0x65d9('0x7'));var jayson=require(_0x65d9('0x8'));var client=jayson['client'][_0x65d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x389a94,_0x522018,_0xd3011f){return new BPromise(function(_0x176db4,_0x5098e2){return client[_0x65d9('0xa')](_0x389a94,_0xd3011f)[_0x65d9('0xb')](function(_0x4a2d15){logger[_0x65d9('0xc')](_0x65d9('0xd'),_0x522018,_0x65d9('0xe'));logger[_0x65d9('0xf')](_0x65d9('0x10'),_0x522018,'request\x20sent',JSON[_0x65d9('0x11')](_0x4a2d15));if(_0x4a2d15[_0x65d9('0x12')]){if(_0x4a2d15[_0x65d9('0x12')][_0x65d9('0x13')]===0x1f4){logger['error'](_0x65d9('0xd'),_0x522018,_0x4a2d15[_0x65d9('0x12')][_0x65d9('0x14')]);return _0x5098e2(_0x4a2d15['error'][_0x65d9('0x14')]);}logger[_0x65d9('0x12')](_0x65d9('0xd'),_0x522018,_0x4a2d15[_0x65d9('0x12')]['message']);return _0x176db4(_0x4a2d15[_0x65d9('0x12')][_0x65d9('0x14')]);}else{logger[_0x65d9('0xc')](_0x65d9('0xd'),_0x522018,_0x65d9('0xe'));_0x176db4(_0x4a2d15[_0x65d9('0x15')][_0x65d9('0x14')]);}})['catch'](function(_0xc39f04){logger['error'](_0x65d9('0xd'),_0x522018,_0xc39f04);_0x5098e2(_0xc39f04);});});}
\ No newline at end of file
index 46267bb..1c972d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x36f349,_0xf970bc){var _0x334f0e=function(_0x34f77c){while(--_0x34f77c){_0x36f349['push'](_0x36f349['shift']());}};_0x334f0e(++_0xf970bc);}(_0x70e0,0x17b));var _0x070e=function(_0x5d1841,_0x244dda){_0x5d1841=_0x5d1841-0x0;var _0x22969a=_0x70e0[_0x5d1841];return _0x22969a;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
+var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x26f67d,_0x15aac7){var _0x26de83=function(_0x3f04c1){while(--_0x3f04c1){_0x26f67d['push'](_0x26f67d['shift']());}};_0x26de83(++_0x15aac7);}(_0xedd9,0xfc));var _0x9edd=function(_0xf90af4,_0x5d6ebe){_0xf90af4=_0xf90af4-0x0;var _0x3261a5=_0xedd9[_0xf90af4];return _0x3261a5;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router;
\ No newline at end of file
index cda828c..20dff4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb654=['INTEGER','exports'];(function(_0x2ece52,_0x538ee5){var _0x585ea8=function(_0x528662){while(--_0x528662){_0x2ece52['push'](_0x2ece52['shift']());}};_0x585ea8(++_0x538ee5);}(_0xb654,0xc3));var _0x4b65=function(_0xb97e8c,_0x3d89e1){_0xb97e8c=_0xb97e8c-0x0;var _0x1385af=_0xb654[_0xb97e8c];return _0x1385af;};'use strict';var Sequelize=require('sequelize');module[_0x4b65('0x0')]={'penalty':{'type':Sequelize[_0x4b65('0x1')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x3863=['INTEGER'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x3863,0x72));var _0x3386=function(_0x4d5a59,_0x599a32){_0x4d5a59=_0x4d5a59-0x0;var _0xface5a=_0x3863[_0x4d5a59];return _0xface5a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x3386('0x0')],'defaultValue':0x0}};
\ No newline at end of file
index 4621d3e..52575c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcee0=['define','UserMailQueue','user_has_mail_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports'];(function(_0x24aef2,_0x2fbd37){var _0x5f1433=function(_0x40b524){while(--_0x40b524){_0x24aef2['push'](_0x24aef2['shift']());}};_0x5f1433(++_0x2fbd37);}(_0xcee0,0x199));var _0x0cee=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0xcee0[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x0cee('0x0'));var util=require('util');var logger=require(_0x0cee('0x1'))(_0x0cee('0x2'));var moment=require(_0x0cee('0x3'));var BPromise=require(_0x0cee('0x4'));var rp=require(_0x0cee('0x5'));var fs=require('fs');var path=require(_0x0cee('0x6'));var rimraf=require(_0x0cee('0x7'));var config=require(_0x0cee('0x8'));var attributes=require(_0x0cee('0x9'));module[_0x0cee('0xa')]=function(_0x166182,_0x95ad52){return _0x166182[_0x0cee('0xb')](_0x0cee('0xc'),attributes,{'tableName':_0x0cee('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xbd94=['util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./userMailQueue.attributes','exports','define','UserMailQueue','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xbd94,0x113));var _0x4bd9=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xbd94[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4bd9('0x0'));var util=require(_0x4bd9('0x1'));var logger=require(_0x4bd9('0x2'))(_0x4bd9('0x3'));var moment=require(_0x4bd9('0x4'));var BPromise=require(_0x4bd9('0x5'));var rp=require(_0x4bd9('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4bd9('0x7'));var config=require('../../config/environment');var attributes=require(_0x4bd9('0x8'));module[_0x4bd9('0x9')]=function(_0x4a8726,_0x5dc6cc){return _0x4a8726[_0x4bd9('0xa')](_0x4bd9('0xb'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index edcfaea..f115e72 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00bb=['stringify','error','message','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s'];(function(_0x9cffbe,_0x5bd6d2){var _0x94b478=function(_0x25a8a3){while(--_0x25a8a3){_0x9cffbe['push'](_0x9cffbe['shift']());}};_0x94b478(++_0x5bd6d2);}(_0x00bb,0x1d8));var _0xb00b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x00bb[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0xb00b('0x0'));var util=require(_0xb00b('0x1'));var moment=require(_0xb00b('0x2'));var BPromise=require('bluebird');var rs=require(_0xb00b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb00b('0x4'))['db'];var utils=require(_0xb00b('0x5'));var logger=require('../../config/logger')(_0xb00b('0x6'));var config=require(_0xb00b('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x36e363,_0xf737d0,_0x41dfc9){return new BPromise(function(_0x37f07d,_0xfa4181){return client[_0xb00b('0x8')](_0x36e363,_0x41dfc9)['then'](function(_0x51d12b){logger[_0xb00b('0x9')](_0xb00b('0xa'),_0xf737d0,_0xb00b('0xb'));logger[_0xb00b('0xc')](_0xb00b('0xd'),_0xf737d0,'request\x20sent',JSON[_0xb00b('0xe')](_0x51d12b));if(_0x51d12b['error']){if(_0x51d12b['error']['code']===0x1f4){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);return _0xfa4181(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}logger['error'](_0xb00b('0xa'),_0xf737d0,_0x51d12b[_0xb00b('0xf')]['message']);return _0x37f07d(_0x51d12b[_0xb00b('0xf')][_0xb00b('0x10')]);}else{logger['info']('UserMailQueue,\x20%s,\x20%s',_0xf737d0,_0xb00b('0xb'));_0x37f07d(_0x51d12b['result']['message']);}})[_0xb00b('0x11')](function(_0x638443){logger[_0xb00b('0xf')](_0xb00b('0xa'),_0xf737d0,_0x638443);_0xfa4181(_0x638443);});});}
\ No newline at end of file
+var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x48feef,_0xde9e77){var _0x1d9e12=function(_0x1f583b){while(--_0x1f583b){_0x48feef['push'](_0x48feef['shift']());}};_0x1d9e12(++_0xde9e77);}(_0x34e8,0x12c));var _0x834e=function(_0x17d480,_0x4000ba){_0x17d480=_0x17d480-0x0;var _0x2b795b=_0x34e8[_0x17d480];return _0x2b795b;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});}
\ No newline at end of file
index 4c23c04..41d907e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f38=['exports','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post'];(function(_0x4dd933,_0x150643){var _0x53783e=function(_0x21df7b){while(--_0x21df7b){_0x4dd933['push'](_0x4dd933['shift']());}};_0x53783e(++_0x150643);}(_0x9f38,0x19e));var _0x89f3=function(_0x38540b,_0x345c59){_0x38540b=_0x38540b-0x0;var _0x1b5992=_0x9f38[_0x38540b];return _0x1b5992;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x89f3('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x89f3('0x1'));var auth=require(_0x89f3('0x2'));var interaction=require(_0x89f3('0x3'));var config=require('../../config/environment');var controller=require(_0x89f3('0x4'));router[_0x89f3('0x5')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module[_0x89f3('0x6')]=router;
\ No newline at end of file
+var _0xeb0b=['fs-extra','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','util','path','connect-timeout'];(function(_0x268e9b,_0xb422e2){var _0x30d633=function(_0x5b655e){while(--_0x5b655e){_0x268e9b['push'](_0x268e9b['shift']());}};_0x30d633(++_0xb422e2);}(_0xeb0b,0x1b5));var _0xbeb0=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xeb0b[_0x1ac595];return _0x455fff;};'use strict';var multer=require('multer');var util=require(_0xbeb0('0x0'));var path=require(_0xbeb0('0x1'));var timeout=require(_0xbeb0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbeb0('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbeb0('0x4'));var config=require('../../config/environment');var controller=require(_0xbeb0('0x5'));router[_0xbeb0('0x6')]('/',auth[_0xbeb0('0x7')](),controller[_0xbeb0('0x8')]);module[_0xbeb0('0x9')]=router;
\ No newline at end of file
index c420e50..0efbdd1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x12e1=['TEXT','STRING','BOOLEAN','sequelize'];(function(_0x22f01c,_0x3d6106){var _0x264930=function(_0x45d1b9){while(--_0x45d1b9){_0x22f01c['push'](_0x22f01c['shift']());}};_0x264930(++_0x3d6106);}(_0x12e1,0xa3));var _0x112e=function(_0x126ea7,_0x3ae2a3){_0x126ea7=_0x126ea7-0x0;var _0x2997ad=_0x12e1[_0x126ea7];return _0x2997ad;};'use strict';var Sequelize=require(_0x112e('0x0'));module['exports']={'body':{'type':Sequelize[_0x112e('0x1')]},'senderName':{'type':Sequelize[_0x112e('0x2')]},'recipientsId':{'type':Sequelize[_0x112e('0x1')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x112e('0x3')]}};
\ No newline at end of file
+var _0x76d3=['STRING','sequelize','exports','TEXT'];(function(_0x8a72b5,_0x4bc41f){var _0x2eadfd=function(_0x516942){while(--_0x516942){_0x8a72b5['push'](_0x8a72b5['shift']());}};_0x2eadfd(++_0x4bc41f);}(_0x76d3,0x15d));var _0x376d=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x76d3[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x376d('0x0'));module[_0x376d('0x1')]={'body':{'type':Sequelize[_0x376d('0x2')]},'senderName':{'type':Sequelize[_0x376d('0x3')]},'recipientsId':{'type':Sequelize[_0x376d('0x2')]},'recipientsDescription':{'type':Sequelize[_0x376d('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}};
\ No newline at end of file
index baa1e68..3143201 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x276a=['lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','sendUserNotification','text','body','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','sortBy','join','transaction','UserNotification','create','recipientsDescription','beep','forEach','recipient','emit','userNotification:send','Template','findOne','html','render','model','ids','includes','queue','Queue','push','union','flatten','catch','getAgents','map','eml-format','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x35c6cc,_0x2121ee){var _0x3ae477=function(_0x5b6fb6){while(--_0x5b6fb6){_0x35c6cc['push'](_0x35c6cc['shift']());}};_0x3ae477(++_0x2121ee);}(_0x276a,0x17e));var _0xa276=function(_0x3c7bf9,_0x2587b7){_0x3c7bf9=_0x3c7bf9-0x0;var _0x4978cf=_0x276a[_0x3c7bf9];return _0x4978cf;};'use strict';var emlformat=require(_0xa276('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa276('0x1'));var moment=require(_0xa276('0x2'));var BPromise=require(_0xa276('0x3'));var Mustache=require(_0xa276('0x4'));var util=require(_0xa276('0x5'));var path=require('path');var sox=require(_0xa276('0x6'));var csv=require(_0xa276('0x7'));var ejs=require(_0xa276('0x8'));var fs=require('fs');var fs_extra=require(_0xa276('0x9'));var _=require(_0xa276('0xa'));var squel=require(_0xa276('0xb'));var crypto=require(_0xa276('0xc'));var jsforce=require(_0xa276('0xd'));var deskjs=require(_0xa276('0xe'));var toCsv=require(_0xa276('0x7'));var querystring=require('querystring');var Papa=require(_0xa276('0xf'));var Redis=require(_0xa276('0x10'));var authService=require(_0xa276('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa276('0x12'));var hardwareService=require(_0xa276('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa276('0x14'));var config=require(_0xa276('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xa276('0x16'))['db'];config[_0xa276('0x17')]=_[_0xa276('0x18')](config['redis'],{'host':_0xa276('0x19'),'port':0x18eb});var socket=require(_0xa276('0x1a'))(new Redis(config['redis']));require(_0xa276('0x1b'))[_0xa276('0x1c')](socket);function respondWithStatusCode(_0x128edc,_0xfbc967){_0xfbc967=_0xfbc967||0xcc;return function(_0x4460e5){if(_0x4460e5){return _0x128edc[_0xa276('0x1d')](_0xfbc967);}return _0x128edc[_0xa276('0x1e')](_0xfbc967)[_0xa276('0x1f')]();};}function respondWithResult(_0x447c7d,_0x4a58bd){_0x4a58bd=_0x4a58bd||0xc8;return function(_0x5a5a27){if(_0x5a5a27){return _0x447c7d['status'](_0x4a58bd)[_0xa276('0x20')](_0x5a5a27);}};}function respondWithFilteredResult(_0xa320ba,_0x247944){return function(_0x5b05fe){if(_0x5b05fe){var _0x3b75f8=typeof _0x247944[_0xa276('0x21')]===_0xa276('0x22')&&typeof _0x247944['limit']===_0xa276('0x22');var _0x30987b=_0x5b05fe[_0xa276('0x23')];var _0x1d1a90=_0x3b75f8?0x0:_0x247944['offset'];var _0x3130b2=_0x3b75f8?_0x5b05fe['count']:_0x247944[_0xa276('0x21')]+_0x247944[_0xa276('0x24')];var _0x1fa6ce;if(_0x3130b2>=_0x30987b){_0x3130b2=_0x30987b;_0x1fa6ce=0xc8;}else{_0x1fa6ce=0xce;}_0xa320ba['status'](_0x1fa6ce);return _0xa320ba['set'](_0xa276('0x25'),_0x1d1a90+'-'+_0x3130b2+'/'+_0x30987b)[_0xa276('0x20')](_0x5b05fe);}return null;};}function patchUpdates(_0x1b808c){return function(_0x5cb80b){try{jsonpatch[_0xa276('0x26')](_0x5cb80b,_0x1b808c,!![]);}catch(_0x55f85c){return BPromise[_0xa276('0x27')](_0x55f85c);}return _0x5cb80b[_0xa276('0x28')]();};}function saveUpdates(_0x375c3f,_0x40ba7b){return function(_0x332987){if(_0x332987){return _0x332987['update'](_0x375c3f)[_0xa276('0x29')](function(_0x1be871){return _0x1be871;});}return null;};}function removeEntity(_0xbd7903,_0x229914){return function(_0x4d4bc5){if(_0x4d4bc5){return _0x4d4bc5[_0xa276('0x2a')]()[_0xa276('0x29')](function(){_0xbd7903['status'](0xcc)[_0xa276('0x1f')]();});}};}function handleEntityNotFound(_0x225dab,_0x30e615){return function(_0x4d1e64){if(!_0x4d1e64){_0x225dab[_0xa276('0x1d')](0x194);}return _0x4d1e64;};}function handleError(_0x1b1424,_0xde40fe){_0xde40fe=_0xde40fe||0x1f4;return function(_0x3a7562){logger[_0xa276('0x2b')](_0x3a7562[_0xa276('0x2c')]);if(_0x3a7562[_0xa276('0x2d')]){delete _0x3a7562[_0xa276('0x2d')];}_0x1b1424[_0xa276('0x1e')](_0xde40fe)[_0xa276('0x2e')](_0x3a7562);};}exports[_0xa276('0x2f')]=function(_0x56d65c,_0x430fca,_0x41bc4f){if(!_0x56d65c['body']['hasOwnProperty'](_0xa276('0x30'))&&!_0x56d65c[_0xa276('0x31')][_0xa276('0x32')](_0xa276('0x33'))){throw new db['Sequelize'][(_0xa276('0x34'))](_0xa276('0x35'));}else{if(_0x56d65c[_0xa276('0x31')][_0xa276('0x32')](_0xa276('0x33'))&&!_0x56d65c[_0xa276('0x31')][_0xa276('0x32')](_0xa276('0x36'))){throw new db[(_0xa276('0x37'))][(_0xa276('0x34'))](_0xa276('0x38'));}if(!_0x56d65c[_0xa276('0x31')][_0xa276('0x32')](_0xa276('0x39'))){throw new db[(_0xa276('0x37'))][(_0xa276('0x34'))](_0xa276('0x3a'));}else{try{var _0x1df120=JSON[_0xa276('0x3b')](_0x56d65c[_0xa276('0x31')][_0xa276('0x39')]);}catch(_0x19a7a7){logger[_0xa276('0x2b')](_0x19a7a7);throw new db['Sequelize'][(_0xa276('0x34'))](_0xa276('0x3c'));}var _0x2f6708=['chatqueue',_0xa276('0x3d'),'mailqueue',_0xa276('0x3e'),_0xa276('0x3f'),_0xa276('0x40'),_0xa276('0x41'),_0xa276('0x42'),_0xa276('0x43')];if(_[_0xa276('0x44')](_0x1df120,function(_0x4f67e9){return!_['includes'](_0x2f6708,_0x4f67e9['model'][_0xa276('0x45')]());})){throw new db['Sequelize'][(_0xa276('0x34'))](_0xa276('0x46'));}}}var _0xd7614a={};_0xd7614a[_0xa276('0x47')]=_0x56d65c[_0xa276('0x31')][_0xa276('0x32')]('senderName')?_0x56d65c['body']['senderName']:_0x56d65c[_0xa276('0x43')]['fullname'];_0xd7614a['recipientsDescription']=_['isEmpty'](_0x56d65c[_0xa276('0x31')]['recipientsDescription'])?null:_0x56d65c[_0xa276('0x31')]['recipientsDescription'];_0xd7614a['beep']=_0x56d65c[_0xa276('0x31')]['beep']||![];_0xd7614a['SenderId']=_0x56d65c[_0xa276('0x43')]['id'];return getContent(_0x56d65c[_0xa276('0x31')])[_0xa276('0x29')](function(_0x436d50){_0xd7614a[_0xa276('0x31')]=_0x436d50;return getRecipients(_0x1df120);})['then'](function(_0x12af24){_0xd7614a['recipientsId']=_[_0xa276('0x48')](_0x12af24)[_0xa276('0x49')](',');return db['sequelize'][_0xa276('0x4a')](function(_0x3ec2b3){return db[_0xa276('0x4b')][_0xa276('0x4c')](_0xd7614a,{'raw':!![],'transaction':_0x3ec2b3})[_0xa276('0x29')](function(_0x538ceb){var _0x31c55c={'sender':_0xd7614a[_0xa276('0x47')],'description':_0xd7614a[_0xa276('0x4d')],'content':_0xd7614a[_0xa276('0x31')],'beep':_0xd7614a[_0xa276('0x4e')]};_0x12af24[_0xa276('0x4f')](function(_0x17ce96){_0x31c55c[_0xa276('0x50')]=_0x17ce96;socket[_0xa276('0x51')](_0xa276('0x52'),_0x31c55c);});return _0x538ceb;});});})[_0xa276('0x29')](respondWithResult(_0x430fca,0xc9))['catch'](handleError(_0x430fca,null));};function getContent(_0x558eaf){return new BPromise(function(_0x5d0dee,_0x5646eb){if(_0x558eaf['text']){_0x5d0dee(_0x558eaf[_0xa276('0x30')]);return;}return db[_0xa276('0x53')][_0xa276('0x54')]({'attributes':[_0xa276('0x55')],'where':{'id':_0x558eaf[_0xa276('0x33')]},'raw':!![]})[_0xa276('0x29')](function(_0x54b12e){if(!_0x54b12e)throw new db[(_0xa276('0x37'))][(_0xa276('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x585c8f=Mustache[_0xa276('0x56')](_0x54b12e[_0xa276('0x55')],_0x558eaf[_0xa276('0x36')]);_0x5d0dee(_0x585c8f);})['catch'](function(_0xb3f845){_0x5646eb(_0xb3f845);});});}function getRecipients(_0x56e556){return new BPromise(function(_0x19d60e,_0x402776){var _0x21a17b=[];var _0x5bf82a=[];_0x56e556[_0xa276('0x4f')](function(_0x646565){var _0x3f3848=_['startCase'](_0x646565[_0xa276('0x57')][_0xa276('0x45')]());if(_0x3f3848==='User'){_0x21a17b=_['union'](_0x21a17b,_0x646565[_0xa276('0x58')]);}else{if(_[_0xa276('0x59')](_0x3f3848,'queue'))_0x3f3848=_0x3f3848['replace'](_0xa276('0x5a'),_0xa276('0x5b'));_0x646565[_0xa276('0x58')][_0xa276('0x4f')](function(_0x3cf0d8){_0x5bf82a[_0xa276('0x5c')](getAgents(_0x3f3848,_0x3cf0d8));});}});return BPromise['all'](_0x5bf82a)[_0xa276('0x29')](function(_0x596cc6){_0x21a17b=_[_0xa276('0x5d')](_0x21a17b,_[_0xa276('0x5e')](_0x596cc6));_0x19d60e(_0x21a17b);})[_0xa276('0x5f')](function(_0x3c264c){_0x402776(_0x3c264c);});});}function getAgents(_0x9f55bf,_0x33f44b){return new BPromise(function(_0x27e489,_0x38aea0){return db[_0x9f55bf][_0xa276('0x54')]({'where':{'id':_0x33f44b}})[_0xa276('0x29')](function(_0x15e875){return _0x15e875[_0xa276('0x60')]({'attributes':['id'],'raw':!![]})[_0xa276('0x29')](function(_0x51e537){var _0x10b269=_[_0xa276('0x61')](_0x51e537,'id');_0x27e489(_0x10b269);});})[_0xa276('0x5f')](function(_0x390fff){_0x38aea0(_0x390fff);});});}
\ No newline at end of file
+var _0x1e4b=['model','senderName','user','recipientsDescription','isEmpty','beep','sortBy','join','UserNotification','create','forEach','recipient','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','html','view','startCase','toLowerCase','User','union','ids','includes','queue','push','all','flatten','getAgents','map','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','limit','offset','set','reject','then','destroy','error','stack','name','send','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','some'];(function(_0x51ec85,_0x46832c){var _0x59f6e8=function(_0x1deccd){while(--_0x1deccd){_0x51ec85['push'](_0x51ec85['shift']());}};_0x59f6e8(++_0x46832c);}(_0x1e4b,0x198));var _0xb1e4=function(_0xf777d5,_0x13ae62){_0xf777d5=_0xf777d5-0x0;var _0x879dff=_0x1e4b[_0xf777d5];return _0x879dff;};'use strict';var emlformat=require(_0xb1e4('0x0'));var rimraf=require(_0xb1e4('0x1'));var zipdir=require(_0xb1e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb1e4('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb1e4('0x4'));var util=require(_0xb1e4('0x5'));var path=require(_0xb1e4('0x6'));var sox=require('sox');var csv=require(_0xb1e4('0x7'));var ejs=require(_0xb1e4('0x8'));var fs=require('fs');var fs_extra=require(_0xb1e4('0x9'));var _=require(_0xb1e4('0xa'));var squel=require(_0xb1e4('0xb'));var crypto=require('crypto');var jsforce=require(_0xb1e4('0xc'));var deskjs=require(_0xb1e4('0xd'));var toCsv=require(_0xb1e4('0x7'));var querystring=require(_0xb1e4('0xe'));var Papa=require('papaparse');var Redis=require(_0xb1e4('0xf'));var authService=require(_0xb1e4('0x10'));var qs=require(_0xb1e4('0x11'));var as=require(_0xb1e4('0x12'));var hardwareService=require(_0xb1e4('0x13'));var logger=require('../../config/logger')(_0xb1e4('0x14'));var utils=require(_0xb1e4('0x15'));var config=require(_0xb1e4('0x16'));var licenseUtil=require(_0xb1e4('0x17'));var db=require(_0xb1e4('0x18'))['db'];config[_0xb1e4('0x19')]=_[_0xb1e4('0x1a')](config[_0xb1e4('0x19')],{'host':_0xb1e4('0x1b'),'port':0x18eb});var socket=require(_0xb1e4('0x1c'))(new Redis(config[_0xb1e4('0x19')]));require(_0xb1e4('0x1d'))[_0xb1e4('0x1e')](socket);function respondWithStatusCode(_0x285202,_0x330bc4){_0x330bc4=_0x330bc4||0xcc;return function(_0x593ba8){if(_0x593ba8){return _0x285202[_0xb1e4('0x1f')](_0x330bc4);}return _0x285202['status'](_0x330bc4)[_0xb1e4('0x20')]();};}function respondWithResult(_0x534076,_0x176656){_0x176656=_0x176656||0xc8;return function(_0x45cbb2){if(_0x45cbb2){return _0x534076[_0xb1e4('0x21')](_0x176656)[_0xb1e4('0x22')](_0x45cbb2);}};}function respondWithFilteredResult(_0x26a813,_0x5737be){return function(_0x4fe9d5){if(_0x4fe9d5){var _0x52ef47=typeof _0x5737be['offset']==='undefined'&&typeof _0x5737be[_0xb1e4('0x23')]==='undefined';var _0xe49e06=_0x4fe9d5['count'];var _0x100c39=_0x52ef47?0x0:_0x5737be[_0xb1e4('0x24')];var _0x3dd9d4=_0x52ef47?_0x4fe9d5['count']:_0x5737be[_0xb1e4('0x24')]+_0x5737be[_0xb1e4('0x23')];var _0x4fdc9e;if(_0x3dd9d4>=_0xe49e06){_0x3dd9d4=_0xe49e06;_0x4fdc9e=0xc8;}else{_0x4fdc9e=0xce;}_0x26a813['status'](_0x4fdc9e);return _0x26a813[_0xb1e4('0x25')]('Content-Range',_0x100c39+'-'+_0x3dd9d4+'/'+_0xe49e06)['json'](_0x4fe9d5);}return null;};}function patchUpdates(_0x47c53d){return function(_0x4f99b1){try{jsonpatch['apply'](_0x4f99b1,_0x47c53d,!![]);}catch(_0x31a0cf){return BPromise[_0xb1e4('0x26')](_0x31a0cf);}return _0x4f99b1['save']();};}function saveUpdates(_0x25005,_0x4a4822){return function(_0x40d106){if(_0x40d106){return _0x40d106['update'](_0x25005)[_0xb1e4('0x27')](function(_0x406a51){return _0x406a51;});}return null;};}function removeEntity(_0x3cdd7b,_0x1efc46){return function(_0x2166c1){if(_0x2166c1){return _0x2166c1[_0xb1e4('0x28')]()[_0xb1e4('0x27')](function(){_0x3cdd7b['status'](0xcc)[_0xb1e4('0x20')]();});}};}function handleEntityNotFound(_0x5cd487,_0x15d23f){return function(_0x358aff){if(!_0x358aff){_0x5cd487[_0xb1e4('0x1f')](0x194);}return _0x358aff;};}function handleError(_0x432c6b,_0x39640f){_0x39640f=_0x39640f||0x1f4;return function(_0x2450c4){logger[_0xb1e4('0x29')](_0x2450c4[_0xb1e4('0x2a')]);if(_0x2450c4['name']){delete _0x2450c4[_0xb1e4('0x2b')];}_0x432c6b[_0xb1e4('0x21')](_0x39640f)[_0xb1e4('0x2c')](_0x2450c4);};}exports['sendUserNotification']=function(_0x536e15,_0x3e6d4f,_0x51db9b){if(!_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x2e')]('text')&&!_0x536e15['body'][_0xb1e4('0x2e')](_0xb1e4('0x2f'))){throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x32'));}else{if(_0x536e15['body']['hasOwnProperty'](_0xb1e4('0x2f'))&&!_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x2e')]('view')){throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x33'));}if(!_0x536e15[_0xb1e4('0x2d')]['hasOwnProperty'](_0xb1e4('0x34'))){throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x35'));}else{try{var _0x1b7dee=JSON[_0xb1e4('0x36')](_0x536e15['body'][_0xb1e4('0x34')]);}catch(_0x462ddd){logger[_0xb1e4('0x29')](_0x462ddd);throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x37'));}var _0x1f4565=['chatqueue',_0xb1e4('0x38'),_0xb1e4('0x39'),'openchannelqueue',_0xb1e4('0x3a'),_0xb1e4('0x3b'),_0xb1e4('0x3c'),'team','user'];if(_[_0xb1e4('0x3d')](_0x1b7dee,function(_0x43083b){return!_['includes'](_0x1f4565,_0x43083b[_0xb1e4('0x3e')]['toLowerCase']());})){throw new db['Sequelize']['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x3a69b9={};_0x3a69b9[_0xb1e4('0x3f')]=_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x2e')](_0xb1e4('0x3f'))?_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x3f')]:_0x536e15[_0xb1e4('0x40')]['fullname'];_0x3a69b9[_0xb1e4('0x41')]=_[_0xb1e4('0x42')](_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x41')])?null:_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x41')];_0x3a69b9['beep']=_0x536e15[_0xb1e4('0x2d')][_0xb1e4('0x43')]||![];_0x3a69b9['SenderId']=_0x536e15[_0xb1e4('0x40')]['id'];return getContent(_0x536e15[_0xb1e4('0x2d')])[_0xb1e4('0x27')](function(_0x503358){_0x3a69b9['body']=_0x503358;return getRecipients(_0x1b7dee);})[_0xb1e4('0x27')](function(_0xc023a7){_0x3a69b9['recipientsId']=_[_0xb1e4('0x44')](_0xc023a7)[_0xb1e4('0x45')](',');return db['sequelize']['transaction'](function(_0x184935){return db[_0xb1e4('0x46')][_0xb1e4('0x47')](_0x3a69b9,{'raw':!![],'transaction':_0x184935})[_0xb1e4('0x27')](function(_0x180199){var _0x466d1f={'sender':_0x3a69b9[_0xb1e4('0x3f')],'description':_0x3a69b9[_0xb1e4('0x41')],'content':_0x3a69b9[_0xb1e4('0x2d')],'beep':_0x3a69b9['beep']};_0xc023a7[_0xb1e4('0x48')](function(_0x20db67){_0x466d1f[_0xb1e4('0x49')]=_0x20db67;socket['emit'](_0xb1e4('0x4a'),_0x466d1f);});return _0x180199;});});})[_0xb1e4('0x27')](respondWithResult(_0x3e6d4f,0xc9))[_0xb1e4('0x4b')](handleError(_0x3e6d4f,null));};function getContent(_0x1248a5){return new BPromise(function(_0x39b3f8,_0x3f8c26){if(_0x1248a5[_0xb1e4('0x4c')]){_0x39b3f8(_0x1248a5[_0xb1e4('0x4c')]);return;}return db[_0xb1e4('0x4d')][_0xb1e4('0x4e')]({'attributes':['html'],'where':{'id':_0x1248a5[_0xb1e4('0x2f')]},'raw':!![]})[_0xb1e4('0x27')](function(_0xdcc282){if(!_0xdcc282)throw new db[(_0xb1e4('0x30'))][(_0xb1e4('0x31'))](_0xb1e4('0x4f'));var _0x477594=Mustache['render'](_0xdcc282[_0xb1e4('0x50')],_0x1248a5[_0xb1e4('0x51')]);_0x39b3f8(_0x477594);})['catch'](function(_0x43e0e3){_0x3f8c26(_0x43e0e3);});});}function getRecipients(_0x15aa7f){return new BPromise(function(_0x5a1eb3,_0x413d4c){var _0x184eff=[];var _0x182e24=[];_0x15aa7f[_0xb1e4('0x48')](function(_0x4222a9){var _0x4db182=_[_0xb1e4('0x52')](_0x4222a9[_0xb1e4('0x3e')][_0xb1e4('0x53')]());if(_0x4db182===_0xb1e4('0x54')){_0x184eff=_[_0xb1e4('0x55')](_0x184eff,_0x4222a9[_0xb1e4('0x56')]);}else{if(_[_0xb1e4('0x57')](_0x4db182,_0xb1e4('0x58')))_0x4db182=_0x4db182['replace'](_0xb1e4('0x58'),'Queue');_0x4222a9[_0xb1e4('0x56')][_0xb1e4('0x48')](function(_0x4a56eb){_0x182e24[_0xb1e4('0x59')](getAgents(_0x4db182,_0x4a56eb));});}});return BPromise[_0xb1e4('0x5a')](_0x182e24)['then'](function(_0x10213d){_0x184eff=_['union'](_0x184eff,_[_0xb1e4('0x5b')](_0x10213d));_0x5a1eb3(_0x184eff);})['catch'](function(_0x5a8e44){_0x413d4c(_0x5a8e44);});});}function getAgents(_0x1c8542,_0x43577a){return new BPromise(function(_0x573bca,_0x180946){return db[_0x1c8542][_0xb1e4('0x4e')]({'where':{'id':_0x43577a}})[_0xb1e4('0x27')](function(_0x18f289){return _0x18f289[_0xb1e4('0x5c')]({'attributes':['id'],'raw':!![]})[_0xb1e4('0x27')](function(_0x3862a7){var _0x180eea=_[_0xb1e4('0x5d')](_0x3862a7,'id');_0x573bca(_0x180eea);});})[_0xb1e4('0x4b')](function(_0x5d37ea){_0x180946(_0x5d37ea);});});}
\ No newline at end of file
index e5f5113..3d3365b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd2f=['UserNotification','setMaxListeners','save','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xbd2f,0x73));var _0xfbd2=function(_0x9af589,_0x20b4a0){_0x9af589=_0x9af589-0x0;var _0x545f78=_0xbd2f[_0x9af589];return _0x545f78;};'use strict';var EventEmitter=require(_0xfbd2('0x0'));var UserNotification=require(_0xfbd2('0x1'))['db'][_0xfbd2('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xfbd2('0x3')](0x0);var events={'afterCreate':_0xfbd2('0x4'),'afterUpdate':'update','afterDestroy':_0xfbd2('0x5')};function emitEvent(_0x47805d){return function(_0x579d8c,_0x3fc29c,_0x252158){UserNotificationEvents[_0xfbd2('0x6')](_0x47805d+':'+_0x579d8c['id'],_0x579d8c);UserNotificationEvents[_0xfbd2('0x6')](_0x47805d,_0x579d8c);_0x252158(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0xfbd2('0x7')](e,emitEvent(event));}}module[_0xfbd2('0x8')]=UserNotificationEvents;
\ No newline at end of file
+var _0x81d1=['../../mysqldb','UserNotification','save','remove','emit','hook','events'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x81d1,0x172));var _0x181d=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x81d1[_0x25d386];return _0x857f4a;};'use strict';var EventEmitter=require(_0x181d('0x0'));var UserNotification=require(_0x181d('0x1'))['db'][_0x181d('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x181d('0x3'),'afterUpdate':'update','afterDestroy':_0x181d('0x4')};function emitEvent(_0x9593ad){return function(_0x111070,_0x3a26ac,_0x53171f){UserNotificationEvents[_0x181d('0x5')](_0x9593ad+':'+_0x111070['id'],_0x111070);UserNotificationEvents['emit'](_0x9593ad,_0x111070);_0x53171f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x181d('0x6')](e,emitEvent(event));}}module['exports']=UserNotificationEvents;
\ No newline at end of file
index f99d381..e74b51c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3e2d=['exports','define','userNotifications','lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes'];(function(_0x28f0c6,_0xd8b1d9){var _0x1fa840=function(_0x506c55){while(--_0x506c55){_0x28f0c6['push'](_0x28f0c6['shift']());}};_0x1fa840(++_0xd8b1d9);}(_0x3e2d,0x142));var _0xd3e2=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x3e2d[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0xd3e2('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xd3e2('0x1'));var BPromise=require(_0xd3e2('0x2'));var rp=require(_0xd3e2('0x3'));var fs=require('fs');var path=require(_0xd3e2('0x4'));var rimraf=require(_0xd3e2('0x5'));var config=require(_0xd3e2('0x6'));var attributes=require(_0xd3e2('0x7'));module[_0xd3e2('0x8')]=function(_0x37bad9,_0x58fc16){return _0x37bad9[_0xd3e2('0x9')]('UserNotification',attributes,{'tableName':_0xd3e2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
+var _0x1fd0=['UserNotification','userNotifications','utf8mb4','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0x241d79,_0x3f6cd7){var _0x355805=function(_0x34e153){while(--_0x34e153){_0x241d79['push'](_0x241d79['shift']());}};_0x355805(++_0x3f6cd7);}(_0x1fd0,0x1bd));var _0x01fd=function(_0x92bcf4,_0x168a93){_0x92bcf4=_0x92bcf4-0x0;var _0x2bb264=_0x1fd0[_0x92bcf4];return _0x2bb264;};'use strict';var _=require(_0x01fd('0x0'));var util=require(_0x01fd('0x1'));var logger=require(_0x01fd('0x2'))(_0x01fd('0x3'));var moment=require('moment');var BPromise=require(_0x01fd('0x4'));var rp=require(_0x01fd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x01fd('0x6'));var config=require(_0x01fd('0x7'));var attributes=require('./userNotification.attributes');module[_0x01fd('0x8')]=function(_0x1b787c,_0x4f0c8f){return _0x1b787c[_0x01fd('0x9')](_0x01fd('0xa'),attributes,{'tableName':_0x01fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01fd('0xc'),'collate':'utf8mb4_unicode_ci'});};
\ No newline at end of file
index 81c2629..8948831 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2b09=['register','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./userNotification.socket'];(function(_0x17bbd7,_0x33b9d3){var _0x39feef=function(_0x269a96){while(--_0x269a96){_0x17bbd7['push'](_0x17bbd7['shift']());}};_0x39feef(++_0x33b9d3);}(_0x2b09,0x1a1));var _0x92b0=function(_0x54baf0,_0x59cb8b){_0x54baf0=_0x54baf0-0x0;var _0x33435b=_0x2b09[_0x54baf0];return _0x33435b;};'use strict';var _=require(_0x92b0('0x0'));var util=require('util');var moment=require(_0x92b0('0x1'));var BPromise=require(_0x92b0('0x2'));var rs=require(_0x92b0('0x3'));var fs=require('fs');var Redis=require(_0x92b0('0x4'));var db=require(_0x92b0('0x5'))['db'];var utils=require(_0x92b0('0x6'));var logger=require('../../config/logger')(_0x92b0('0x7'));var config=require(_0x92b0('0x8'));var jayson=require(_0x92b0('0x9'));var client=jayson[_0x92b0('0xa')][_0x92b0('0xb')]({'port':0x232a});config[_0x92b0('0xc')]=_['defaults'](config[_0x92b0('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x92b0('0xd'))(new Redis(config[_0x92b0('0xc')]));require(_0x92b0('0xe'))[_0x92b0('0xf')](socket);function respondWithRpcPromise(_0x5308cc,_0x5a6125,_0x1c5cca){return new BPromise(function(_0x198a48,_0x4e3f8f){return client[_0x92b0('0x10')](_0x5308cc,_0x1c5cca)[_0x92b0('0x11')](function(_0x1f496b){logger[_0x92b0('0x12')](_0x92b0('0x13'),_0x5a6125,_0x92b0('0x14'));logger[_0x92b0('0x15')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5a6125,'request\x20sent',JSON[_0x92b0('0x16')](_0x1f496b));if(_0x1f496b[_0x92b0('0x17')]){if(_0x1f496b[_0x92b0('0x17')][_0x92b0('0x18')]===0x1f4){logger[_0x92b0('0x17')]('UserNotification,\x20%s,\x20%s',_0x5a6125,_0x1f496b['error'][_0x92b0('0x19')]);return _0x4e3f8f(_0x1f496b[_0x92b0('0x17')]['message']);}logger[_0x92b0('0x17')](_0x92b0('0x13'),_0x5a6125,_0x1f496b['error'][_0x92b0('0x19')]);return _0x198a48(_0x1f496b[_0x92b0('0x17')][_0x92b0('0x19')]);}else{logger['info'](_0x92b0('0x13'),_0x5a6125,_0x92b0('0x14'));_0x198a48(_0x1f496b[_0x92b0('0x1a')][_0x92b0('0x19')]);}})['catch'](function(_0x281907){logger[_0x92b0('0x17')]('UserNotification,\x20%s,\x20%s',_0x5a6125,_0x281907);_0x4e3f8f(_0x281907);});});}
\ No newline at end of file
+var _0x9fc2=['ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','request','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x22b832,_0x4696fe){var _0x3b47bc=function(_0x1d2f01){while(--_0x1d2f01){_0x22b832['push'](_0x22b832['shift']());}};_0x3b47bc(++_0x4696fe);}(_0x9fc2,0x181));var _0x29fc=function(_0x504197,_0x53304f){_0x504197=_0x504197-0x0;var _0x4ca27c=_0x9fc2[_0x504197];return _0x4ca27c;};'use strict';var _=require(_0x29fc('0x0'));var util=require(_0x29fc('0x1'));var moment=require(_0x29fc('0x2'));var BPromise=require(_0x29fc('0x3'));var rs=require(_0x29fc('0x4'));var fs=require('fs');var Redis=require(_0x29fc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x29fc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x29fc('0x7'));var jayson=require(_0x29fc('0x8'));var client=jayson[_0x29fc('0x9')][_0x29fc('0xa')]({'port':0x232a});config[_0x29fc('0xb')]=_[_0x29fc('0xc')](config['redis'],{'host':_0x29fc('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x29fc('0xb')]));require(_0x29fc('0xe'))['register'](socket);function respondWithRpcPromise(_0x3108fe,_0x5a49b7,_0x2dc86f){return new BPromise(function(_0x1dd43b,_0x24291f){return client[_0x29fc('0xf')](_0x3108fe,_0x2dc86f)[_0x29fc('0x10')](function(_0x1f9493){logger[_0x29fc('0x11')](_0x29fc('0x12'),_0x5a49b7,_0x29fc('0x13'));logger[_0x29fc('0x14')](_0x29fc('0x15'),_0x5a49b7,_0x29fc('0x13'),JSON[_0x29fc('0x16')](_0x1f9493));if(_0x1f9493[_0x29fc('0x17')]){if(_0x1f9493[_0x29fc('0x17')]['code']===0x1f4){logger[_0x29fc('0x17')](_0x29fc('0x12'),_0x5a49b7,_0x1f9493[_0x29fc('0x17')]['message']);return _0x24291f(_0x1f9493[_0x29fc('0x17')]['message']);}logger[_0x29fc('0x17')](_0x29fc('0x12'),_0x5a49b7,_0x1f9493[_0x29fc('0x17')][_0x29fc('0x18')]);return _0x1dd43b(_0x1f9493['error']['message']);}else{logger[_0x29fc('0x11')](_0x29fc('0x12'),_0x5a49b7,'request\x20sent');_0x1dd43b(_0x1f9493['result']['message']);}})[_0x29fc('0x19')](function(_0x2beb79){logger[_0x29fc('0x17')](_0x29fc('0x12'),_0x5a49b7,_0x2beb79);_0x24291f(_0x2beb79);});});}
\ No newline at end of file
index 95a7042..814a8ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa6f0=['removeListener','register','length','save','remove','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa6f0,0x192));var _0x0a6f=function(_0x421130,_0x39d0aa){_0x421130=_0x421130-0x0;var _0x428e38=_0xa6f0[_0x421130];return _0x428e38;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x0a6f('0x0'),_0x0a6f('0x1'),_0x0a6f('0x2')];function createListener(_0x5e842a,_0x43f5fb){return function(_0xae47ad){_0x43f5fb[_0x0a6f('0x3')](_0x5e842a,_0xae47ad);};}function removeListener(_0x303623,_0x20f221){return function(){UserNotificationEvents[_0x0a6f('0x4')](_0x303623,_0x20f221);};}exports[_0x0a6f('0x5')]=function(_0x433604){for(var _0x3971be=0x0,_0x54ba61=events[_0x0a6f('0x6')];_0x3971be<_0x54ba61;_0x3971be++){var _0x4acc95=events[_0x3971be];var _0x3e2e6c=createListener('userNotification:'+_0x4acc95,_0x433604);UserNotificationEvents['on'](_0x4acc95,_0x3e2e6c);}};
\ No newline at end of file
+var _0x42b0=['save','update','removeListener','register','length','userNotification:','./userNotification.events'];(function(_0x52ff2d,_0x5c7dfe){var _0xd7085=function(_0xa538d7){while(--_0xa538d7){_0x52ff2d['push'](_0x52ff2d['shift']());}};_0xd7085(++_0x5c7dfe);}(_0x42b0,0x110));var _0x042b=function(_0x1fd8b3,_0x3bd29a){_0x1fd8b3=_0x1fd8b3-0x0;var _0x1f461f=_0x42b0[_0x1fd8b3];return _0x1f461f;};'use strict';var UserNotificationEvents=require(_0x042b('0x0'));var events=[_0x042b('0x1'),'remove',_0x042b('0x2')];function createListener(_0x77a98a,_0x563019){return function(_0x5ca0a9){_0x563019['emit'](_0x77a98a,_0x5ca0a9);};}function removeListener(_0x10f20b,_0x25c2ea){return function(){UserNotificationEvents[_0x042b('0x3')](_0x10f20b,_0x25c2ea);};}exports[_0x042b('0x4')]=function(_0x397560){for(var _0x342870=0x0,_0x2ca192=events[_0x042b('0x5')];_0x342870<_0x2ca192;_0x342870++){var _0xc23d8d=events[_0x342870];var _0x6d0fe1=createListener(_0x042b('0x6')+_0xc23d8d,_0x397560);UserNotificationEvents['on'](_0xc23d8d,_0x6d0fe1);}};
\ No newline at end of file
index c803a26..d1c120f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x315bef,_0x4c08af){var _0x289ecf=function(_0x5141d5){while(--_0x5141d5){_0x315bef['push'](_0x315bef['shift']());}};_0x289ecf(++_0x4c08af);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0xcb91[_0x5581ba];return _0x1e927f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router;
\ No newline at end of file
+var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x512066,_0x1c9ca1){var _0x2b99bd=function(_0x1fe14c){while(--_0x1fe14c){_0x512066['push'](_0x512066['shift']());}};_0x2b99bd(++_0x1c9ca1);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
index cad6e5c..8539fe2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf331=['exports','INTEGER','sequelize'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xf331,0xb0));var _0x1f33=function(_0x37a16c,_0x3dd670){_0x37a16c=_0x37a16c-0x0;var _0x2db6b7=_0xf331[_0x37a16c];return _0x2db6b7;};'use strict';var Sequelize=require(_0x1f33('0x0'));module[_0x1f33('0x1')]={'penalty':{'type':Sequelize[_0x1f33('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x4332=['INTEGER','sequelize'];(function(_0x282c9e,_0x356ff6){var _0x11f3ce=function(_0x1cd7c7){while(--_0x1cd7c7){_0x282c9e['push'](_0x282c9e['shift']());}};_0x11f3ce(++_0x356ff6);}(_0x4332,0x73));var _0x2433=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x4332[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x2433('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2433('0x1')],'defaultValue':0x0}};
\ No newline at end of file
index 7ea53c3..3236d6d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x46ee=['UserOpenchannelQueue','lodash','request-promise','path','rimraf','./userOpenchannelQueue.attributes','define'];(function(_0x2d74f7,_0xa0030c){var _0x284199=function(_0x1b0aa4){while(--_0x1b0aa4){_0x2d74f7['push'](_0x2d74f7['shift']());}};_0x284199(++_0xa0030c);}(_0x46ee,0xc5));var _0xe46e=function(_0x357382,_0x1c93d3){_0x357382=_0x357382-0x0;var _0x451c3e=_0x46ee[_0x357382];return _0x451c3e;};'use strict';var _=require(_0xe46e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe46e('0x1'));var fs=require('fs');var path=require(_0xe46e('0x2'));var rimraf=require(_0xe46e('0x3'));var config=require('../../config/environment');var attributes=require(_0xe46e('0x4'));module['exports']=function(_0x198fe1,_0x5f4666){return _0x198fe1[_0xe46e('0x5')](_0xe46e('0x6'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x82fd=['rimraf','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x37130c,_0x2d3df5){var _0x4cac49=function(_0x124603){while(--_0x124603){_0x37130c['push'](_0x37130c['shift']());}};_0x4cac49(++_0x2d3df5);}(_0x82fd,0xc0));var _0xd82f=function(_0x3e9014,_0x4c7c50){_0x3e9014=_0x3e9014-0x0;var _0x1fbbc5=_0x82fd[_0x3e9014];return _0x1fbbc5;};'use strict';var _=require(_0xd82f('0x0'));var util=require('util');var logger=require(_0xd82f('0x1'))(_0xd82f('0x2'));var moment=require('moment');var BPromise=require(_0xd82f('0x3'));var rp=require(_0xd82f('0x4'));var fs=require('fs');var path=require(_0xd82f('0x5'));var rimraf=require(_0xd82f('0x6'));var config=require('../../config/environment');var attributes=require(_0xd82f('0x7'));module[_0xd82f('0x8')]=function(_0x3c62e7,_0x269ee5){return _0x3c62e7[_0xd82f('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0xd82f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index cf60e46..5ab1820 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x136e=['info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3e5bc8,_0x457d89){var _0xfd84bc=function(_0x1a766c){while(--_0x1a766c){_0x3e5bc8['push'](_0x3e5bc8['shift']());}};_0xfd84bc(++_0x457d89);}(_0x136e,0x95));var _0xe136=function(_0x4abe74,_0x5f0c0){_0x4abe74=_0x4abe74-0x0;var _0x1653f5=_0x136e[_0x4abe74];return _0x1653f5;};'use strict';var _=require(_0xe136('0x0'));var util=require('util');var moment=require(_0xe136('0x1'));var BPromise=require(_0xe136('0x2'));var rs=require(_0xe136('0x3'));var fs=require('fs');var Redis=require(_0xe136('0x4'));var db=require(_0xe136('0x5'))['db'];var utils=require(_0xe136('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xe136('0x7'));var jayson=require(_0xe136('0x8'));var client=jayson[_0xe136('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x397bb9,_0x380f8f,_0x1a2425){return new BPromise(function(_0x3956ab,_0x6724cb){return client[_0xe136('0xa')](_0x397bb9,_0x1a2425)[_0xe136('0xb')](function(_0x5e52ee){logger['info'](_0xe136('0xc'),_0x380f8f,_0xe136('0xd'));logger['debug'](_0xe136('0xe'),_0x380f8f,_0xe136('0xd'),JSON[_0xe136('0xf')](_0x5e52ee));if(_0x5e52ee[_0xe136('0x10')]){if(_0x5e52ee['error'][_0xe136('0x11')]===0x1f4){logger[_0xe136('0x10')](_0xe136('0xc'),_0x380f8f,_0x5e52ee[_0xe136('0x10')][_0xe136('0x12')]);return _0x6724cb(_0x5e52ee['error'][_0xe136('0x12')]);}logger['error'](_0xe136('0xc'),_0x380f8f,_0x5e52ee[_0xe136('0x10')][_0xe136('0x12')]);return _0x3956ab(_0x5e52ee['error'][_0xe136('0x12')]);}else{logger[_0xe136('0x13')](_0xe136('0xc'),_0x380f8f,_0xe136('0xd'));_0x3956ab(_0x5e52ee[_0xe136('0x14')][_0xe136('0x12')]);}})['catch'](function(_0x16b640){logger[_0xe136('0x10')](_0xe136('0xc'),_0x380f8f,_0x16b640);_0x6724cb(_0x16b640);});});}
\ No newline at end of file
+var _0x1067=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x1067,0x7f));var _0x7106=function(_0x20960e,_0x467b28){_0x20960e=_0x20960e-0x0;var _0x313fe8=_0x1067[_0x20960e];return _0x313fe8;};'use strict';var _=require(_0x7106('0x0'));var util=require('util');var moment=require(_0x7106('0x1'));var BPromise=require(_0x7106('0x2'));var rs=require(_0x7106('0x3'));var fs=require('fs');var Redis=require(_0x7106('0x4'));var db=require(_0x7106('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7106('0x6'))(_0x7106('0x7'));var config=require('../../config/environment');var jayson=require(_0x7106('0x8'));var client=jayson[_0x7106('0x9')][_0x7106('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4dfaca,_0x34955f,_0x551602){return new BPromise(function(_0x2738ef,_0x53cc60){return client[_0x7106('0xb')](_0x4dfaca,_0x551602)[_0x7106('0xc')](function(_0x33a22f){logger[_0x7106('0xd')](_0x7106('0xe'),_0x34955f,_0x7106('0xf'));logger[_0x7106('0x10')](_0x7106('0x11'),_0x34955f,_0x7106('0xf'),JSON['stringify'](_0x33a22f));if(_0x33a22f[_0x7106('0x12')]){if(_0x33a22f[_0x7106('0x12')]['code']===0x1f4){logger[_0x7106('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34955f,_0x33a22f[_0x7106('0x12')][_0x7106('0x13')]);return _0x53cc60(_0x33a22f[_0x7106('0x12')][_0x7106('0x13')]);}logger['error'](_0x7106('0xe'),_0x34955f,_0x33a22f[_0x7106('0x12')][_0x7106('0x13')]);return _0x2738ef(_0x33a22f[_0x7106('0x12')]['message']);}else{logger[_0x7106('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x34955f,_0x7106('0xf'));_0x2738ef(_0x33a22f[_0x7106('0x14')][_0x7106('0x13')]);}})[_0x7106('0x15')](function(_0x9e8276){logger[_0x7106('0x12')](_0x7106('0xe'),_0x34955f,_0x9e8276);_0x53cc60(_0x9e8276);});});}
\ No newline at end of file
index 161a2a5..e3121be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x57ba=['index','/describe','/:id','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','put','update','delete','destroy','removeSections','removeResources','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x5c0bd8,_0x24c304){var _0x14eca7=function(_0x1ee561){while(--_0x1ee561){_0x5c0bd8['push'](_0x5c0bd8['shift']());}};_0x14eca7(++_0x24c304);}(_0x57ba,0x75));var _0xa57b=function(_0x33a2df,_0x2042f3){_0x33a2df=_0x33a2df-0x0;var _0x4d4226=_0x57ba[_0x33a2df];return _0x4d4226;};'use strict';var multer=require('multer');var util=require(_0xa57b('0x0'));var path=require(_0xa57b('0x1'));var timeout=require(_0xa57b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa57b('0x3'));var auth=require(_0xa57b('0x4'));var interaction=require(_0xa57b('0x5'));var config=require('../../config/environment');var controller=require('./userProfile.controller');router[_0xa57b('0x6')]('/',auth[_0xa57b('0x7')](),controller[_0xa57b('0x8')]);router[_0xa57b('0x6')](_0xa57b('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xa57b('0x6')](_0xa57b('0xa'),auth[_0xa57b('0x7')](),controller['show']);router[_0xa57b('0x6')](_0xa57b('0xb'),auth[_0xa57b('0x7')](),controller[_0xa57b('0xc')]);router[_0xa57b('0x6')](_0xa57b('0xd'),auth[_0xa57b('0x7')](),controller[_0xa57b('0xe')]);router[_0xa57b('0xf')]('/',auth[_0xa57b('0x7')](),controller[_0xa57b('0x10')]);router[_0xa57b('0xf')]('/:id/clone',auth['isAuthenticated'](),controller[_0xa57b('0x11')]);router[_0xa57b('0xf')]('/:id/sections',auth[_0xa57b('0x7')](),controller[_0xa57b('0x12')]);router['post']('/:id/resources',auth[_0xa57b('0x7')](),controller['addResources']);router[_0xa57b('0x13')](_0xa57b('0xa'),auth[_0xa57b('0x7')](),controller[_0xa57b('0x14')]);router[_0xa57b('0x15')](_0xa57b('0xa'),auth[_0xa57b('0x7')](),controller[_0xa57b('0x16')]);router[_0xa57b('0x15')](_0xa57b('0xb'),auth[_0xa57b('0x7')](),controller[_0xa57b('0x17')]);router[_0xa57b('0x15')](_0xa57b('0xd'),auth[_0xa57b('0x7')](),controller[_0xa57b('0x18')]);module['exports']=router;
\ No newline at end of file
+var _0x7fb7=['express','../../components/auth/service','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','delete','destroy','removeResources','exports','multer','util','path','connect-timeout'];(function(_0x285430,_0x1c8b55){var _0x468ad1=function(_0x439f36){while(--_0x439f36){_0x285430['push'](_0x285430['shift']());}};_0x468ad1(++_0x1c8b55);}(_0x7fb7,0x13b));var _0x77fb=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0x7fb7[_0x552fce];return _0x3e27a2;};'use strict';var multer=require(_0x77fb('0x0'));var util=require(_0x77fb('0x1'));var path=require(_0x77fb('0x2'));var timeout=require(_0x77fb('0x3'));var express=require(_0x77fb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x77fb('0x5'));var interaction=require(_0x77fb('0x6'));var config=require('../../config/environment');var controller=require(_0x77fb('0x7'));router[_0x77fb('0x8')]('/',auth[_0x77fb('0x9')](),controller[_0x77fb('0xa')]);router[_0x77fb('0x8')](_0x77fb('0xb'),auth['isAuthenticated'](),controller[_0x77fb('0xc')]);router[_0x77fb('0x8')](_0x77fb('0xd'),auth['isAuthenticated'](),controller[_0x77fb('0xe')]);router[_0x77fb('0x8')](_0x77fb('0xf'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x10')]);router[_0x77fb('0x8')](_0x77fb('0x11'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x12')]);router[_0x77fb('0x13')]('/',auth['isAuthenticated'](),controller[_0x77fb('0x14')]);router['post'](_0x77fb('0x15'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x16')]);router[_0x77fb('0x13')](_0x77fb('0xf'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x17')]);router[_0x77fb('0x13')](_0x77fb('0x11'),auth[_0x77fb('0x9')](),controller['addResources']);router[_0x77fb('0x18')](_0x77fb('0xd'),auth[_0x77fb('0x9')](),controller['update']);router[_0x77fb('0x19')](_0x77fb('0xd'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x1a')]);router[_0x77fb('0x19')](_0x77fb('0xf'),auth[_0x77fb('0x9')](),controller['removeSections']);router[_0x77fb('0x19')](_0x77fb('0x11'),auth[_0x77fb('0x9')](),controller[_0x77fb('0x1b')]);module[_0x77fb('0x1c')]=router;
\ No newline at end of file
index 030bdec..9aa9b8b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x044e=['STRING','crudPermissions','join','getDataValue','BOOLEAN','sequelize','exports'];(function(_0xb43b52,_0x342e5b){var _0x1a2954=function(_0x1b5e03){while(--_0x1b5e03){_0xb43b52['push'](_0xb43b52['shift']());}};_0x1a2954(++_0x342e5b);}(_0x044e,0x140));var _0xe044=function(_0x491e36,_0x4579a7){_0x491e36=_0x491e36-0x0;var _0x2e7a3c=_0x044e[_0x491e36];return _0x2e7a3c;};'use strict';var Sequelize=require(_0xe044('0x0'));module[_0xe044('0x1')]={'name':{'type':Sequelize[_0xe044('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xe044('0x2')],'set':function(_0x15d574){this['setDataValue'](_0xe044('0x3'),_0x15d574?_0x15d574[_0xe044('0x4')](''):[]);},'get':function(){return this[_0xe044('0x5')](_0xe044('0x3'))?this[_0xe044('0x5')](_0xe044('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xe044('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xe044('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xe044('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xe044('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xe044('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xe044('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xe044('0x6')],'defaultValue':!![]}};
\ No newline at end of file
+var _0x7497=['STRING','name','crudPermissions','join','getDataValue','BOOLEAN','sequelize'];(function(_0x423549,_0x242e63){var _0xdcb104=function(_0x6bff59){while(--_0x6bff59){_0x423549['push'](_0x423549['shift']());}};_0xdcb104(++_0x242e63);}(_0x7497,0x187));var _0x7749=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7497[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7749('0x0'));module['exports']={'name':{'type':Sequelize[_0x7749('0x1')],'allowNull':![],'unique':_0x7749('0x2')},'crudPermissions':{'type':Sequelize[_0x7749('0x1')],'set':function(_0x4449af){this['setDataValue'](_0x7749('0x3'),_0x4449af?_0x4449af[_0x7749('0x4')](''):[]);},'get':function(){return this[_0x7749('0x5')]('crudPermissions')?this['getDataValue'](_0x7749('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7749('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7749('0x6')],'defaultValue':!![]}};
\ No newline at end of file
index ef34250..2e54103 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbc67=['rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','clone','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize','UserProfileSection','each','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','transaction','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','forEach','resourceId','Plugin','bulkCreate','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xbc67,0xe3));var _0x7bc6=function(_0x104b86,_0x13be97){_0x104b86=_0x104b86-0x0;var _0x16588c=_0xbc67[_0x104b86];return _0x16588c;};'use strict';var emlformat=require(_0x7bc6('0x0'));var rimraf=require(_0x7bc6('0x1'));var zipdir=require(_0x7bc6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7bc6('0x3'));var moment=require(_0x7bc6('0x4'));var BPromise=require(_0x7bc6('0x5'));var Mustache=require(_0x7bc6('0x6'));var util=require(_0x7bc6('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7bc6('0x8'));var ejs=require(_0x7bc6('0x9'));var fs=require('fs');var fs_extra=require(_0x7bc6('0xa'));var _=require(_0x7bc6('0xb'));var squel=require('squel');var crypto=require(_0x7bc6('0xc'));var jsforce=require(_0x7bc6('0xd'));var deskjs=require(_0x7bc6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7bc6('0xf'));var Papa=require(_0x7bc6('0x10'));var Redis=require(_0x7bc6('0x11'));var authService=require(_0x7bc6('0x12'));var qs=require(_0x7bc6('0x13'));var as=require(_0x7bc6('0x14'));var hardwareService=require(_0x7bc6('0x15'));var logger=require(_0x7bc6('0x16'))(_0x7bc6('0x17'));var utils=require('../../config/utils');var config=require(_0x7bc6('0x18'));var licenseUtil=require(_0x7bc6('0x19'));var db=require(_0x7bc6('0x1a'))['db'];config[_0x7bc6('0x1b')]=_[_0x7bc6('0x1c')](config['redis'],{'host':_0x7bc6('0x1d'),'port':0x18eb});var socket=require(_0x7bc6('0x1e'))(new Redis(config[_0x7bc6('0x1b')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x39c78e,_0x24492c){_0x24492c=_0x24492c||0xcc;return function(_0x1e9624){if(_0x1e9624){return _0x39c78e[_0x7bc6('0x1f')](_0x24492c);}return _0x39c78e[_0x7bc6('0x20')](_0x24492c)[_0x7bc6('0x21')]();};}function respondWithResult(_0x5506b0,_0x57c220){_0x57c220=_0x57c220||0xc8;return function(_0x4c59fd){if(_0x4c59fd){return _0x5506b0['status'](_0x57c220)[_0x7bc6('0x22')](_0x4c59fd);}};}function respondWithFilteredResult(_0x1e3b21,_0x5c4775){return function(_0x145db6){if(_0x145db6){var _0x48e3f4=typeof _0x5c4775['offset']===_0x7bc6('0x23')&&typeof _0x5c4775[_0x7bc6('0x24')]===_0x7bc6('0x23');var _0x141241=_0x145db6[_0x7bc6('0x25')];var _0x4d4229=_0x48e3f4?0x0:_0x5c4775[_0x7bc6('0x26')];var _0x3b0d66=_0x48e3f4?_0x145db6[_0x7bc6('0x25')]:_0x5c4775['offset']+_0x5c4775[_0x7bc6('0x24')];var _0x51361e;if(_0x3b0d66>=_0x141241){_0x3b0d66=_0x141241;_0x51361e=0xc8;}else{_0x51361e=0xce;}_0x1e3b21[_0x7bc6('0x20')](_0x51361e);return _0x1e3b21[_0x7bc6('0x27')]('Content-Range',_0x4d4229+'-'+_0x3b0d66+'/'+_0x141241)[_0x7bc6('0x22')](_0x145db6);}return null;};}function patchUpdates(_0x27dca9){return function(_0x4da6f0){try{jsonpatch[_0x7bc6('0x28')](_0x4da6f0,_0x27dca9,!![]);}catch(_0x4105a8){return BPromise[_0x7bc6('0x29')](_0x4105a8);}return _0x4da6f0[_0x7bc6('0x2a')]();};}function saveUpdates(_0x1960dc,_0x246cd5){return function(_0x20969e){if(_0x20969e){return _0x20969e[_0x7bc6('0x2b')](_0x1960dc)[_0x7bc6('0x2c')](function(_0x492a2e){return _0x492a2e;});}return null;};}function removeEntity(_0x2f2928,_0x2f6b18){return function(_0x3ac27f){if(_0x3ac27f){return _0x3ac27f[_0x7bc6('0x2d')]()[_0x7bc6('0x2c')](function(){_0x2f2928[_0x7bc6('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x212de,_0x17dc4d){return function(_0x567d5b){if(!_0x567d5b){_0x212de[_0x7bc6('0x1f')](0x194);}return _0x567d5b;};}function handleError(_0x4ac5ef,_0x2b05b5){_0x2b05b5=_0x2b05b5||0x1f4;return function(_0x30f8a8){logger[_0x7bc6('0x2e')](_0x30f8a8['stack']);if(_0x30f8a8[_0x7bc6('0x2f')]){delete _0x30f8a8[_0x7bc6('0x2f')];}_0x4ac5ef[_0x7bc6('0x20')](_0x2b05b5)[_0x7bc6('0x30')](_0x30f8a8);};}exports[_0x7bc6('0x31')]=function(_0x34c323,_0x13e1e9){var _0x1733f2={},_0x433fda={},_0x57cf8b={'count':0x0,'rows':[]};var _0x1cede5=_[_0x7bc6('0x32')](db[_0x7bc6('0x33')][_0x7bc6('0x34')],function(_0x8eb28c){return{'name':_0x8eb28c['fieldName'],'type':_0x8eb28c[_0x7bc6('0x35')][_0x7bc6('0x36')]};});_0x433fda[_0x7bc6('0x37')]=_[_0x7bc6('0x32')](_0x1cede5,_0x7bc6('0x2f'));_0x433fda[_0x7bc6('0x38')]=_[_0x7bc6('0x39')](_0x34c323[_0x7bc6('0x38')]);_0x433fda[_0x7bc6('0x3a')]=_[_0x7bc6('0x3b')](_0x433fda[_0x7bc6('0x37')],_0x433fda['query']);_0x1733f2[_0x7bc6('0x3c')]=_['intersection'](_0x433fda[_0x7bc6('0x37')],qs[_0x7bc6('0x3d')](_0x34c323['query'][_0x7bc6('0x3d')]));_0x1733f2[_0x7bc6('0x3c')]=_0x1733f2[_0x7bc6('0x3c')][_0x7bc6('0x3e')]?_0x1733f2[_0x7bc6('0x3c')]:_0x433fda[_0x7bc6('0x37')];if(!_0x34c323[_0x7bc6('0x38')][_0x7bc6('0x3f')](_0x7bc6('0x40'))){_0x1733f2[_0x7bc6('0x24')]=qs[_0x7bc6('0x24')](_0x34c323[_0x7bc6('0x38')][_0x7bc6('0x24')]);_0x1733f2['offset']=qs[_0x7bc6('0x26')](_0x34c323[_0x7bc6('0x38')][_0x7bc6('0x26')]);}_0x1733f2[_0x7bc6('0x41')]=qs[_0x7bc6('0x42')](_0x34c323[_0x7bc6('0x38')][_0x7bc6('0x42')]);_0x1733f2['where']=qs[_0x7bc6('0x3a')](_['pick'](_0x34c323[_0x7bc6('0x38')],_0x433fda[_0x7bc6('0x3a')]),_0x1cede5);if(_0x34c323['query'][_0x7bc6('0x43')]){_0x1733f2[_0x7bc6('0x44')]=_[_0x7bc6('0x45')](_0x1733f2[_0x7bc6('0x44')],{'$or':_[_0x7bc6('0x32')](_0x1cede5,function(_0x5d3bba){if(_0x5d3bba[_0x7bc6('0x35')]!==_0x7bc6('0x46')){var _0x2a3541={};_0x2a3541[_0x5d3bba[_0x7bc6('0x2f')]]={'$like':'%'+_0x34c323[_0x7bc6('0x38')][_0x7bc6('0x43')]+'%'};return _0x2a3541;}})});}_0x1733f2=_[_0x7bc6('0x45')]({},_0x1733f2,_0x34c323[_0x7bc6('0x47')]);var _0x365265={'where':_0x1733f2[_0x7bc6('0x44')]};return db[_0x7bc6('0x33')][_0x7bc6('0x25')](_0x365265)[_0x7bc6('0x2c')](function(_0x532801){_0x57cf8b[_0x7bc6('0x25')]=_0x532801;if(_0x34c323[_0x7bc6('0x38')][_0x7bc6('0x48')]){_0x1733f2[_0x7bc6('0x49')]=[{'all':!![]}];}return db['UserProfile'][_0x7bc6('0x4a')](_0x1733f2);})[_0x7bc6('0x2c')](function(_0x5b45c9){_0x57cf8b[_0x7bc6('0x4b')]=_0x5b45c9;return _0x57cf8b;})[_0x7bc6('0x2c')](respondWithFilteredResult(_0x13e1e9,_0x1733f2))[_0x7bc6('0x4c')](handleError(_0x13e1e9,null));};exports[_0x7bc6('0x4d')]=function(_0x3c8524,_0x1bf879){var _0x3d3903={'raw':![],'where':{'id':_0x3c8524['params']['id']}},_0x24a5f4={};_0x24a5f4['model']=_[_0x7bc6('0x39')](db['UserProfile'][_0x7bc6('0x34')]);_0x24a5f4[_0x7bc6('0x38')]=_[_0x7bc6('0x39')](_0x3c8524[_0x7bc6('0x38')]);_0x24a5f4[_0x7bc6('0x3a')]=_[_0x7bc6('0x3b')](_0x24a5f4['model'],_0x24a5f4[_0x7bc6('0x38')]);_0x3d3903[_0x7bc6('0x3c')]=_['intersection'](_0x24a5f4[_0x7bc6('0x37')],qs[_0x7bc6('0x3d')](_0x3c8524[_0x7bc6('0x38')][_0x7bc6('0x3d')]));_0x3d3903[_0x7bc6('0x3c')]=_0x3d3903[_0x7bc6('0x3c')][_0x7bc6('0x3e')]?_0x3d3903[_0x7bc6('0x3c')]:_0x24a5f4[_0x7bc6('0x37')];if(_0x3c8524[_0x7bc6('0x38')][_0x7bc6('0x48')]){_0x3d3903[_0x7bc6('0x49')]=[{'all':!![]}];}_0x3d3903=_[_0x7bc6('0x45')]({},_0x3d3903,_0x3c8524[_0x7bc6('0x47')]);return db[_0x7bc6('0x33')][_0x7bc6('0x4e')](_0x3d3903)[_0x7bc6('0x2c')](handleEntityNotFound(_0x1bf879,null))['then'](respondWithResult(_0x1bf879,null))[_0x7bc6('0x4c')](handleError(_0x1bf879,null));};exports[_0x7bc6('0x4f')]=function(_0xd2ab0b,_0x997358){return db[_0x7bc6('0x33')][_0x7bc6('0x4f')](_0xd2ab0b[_0x7bc6('0x50')],{})['then'](respondWithResult(_0x997358,0xc9))['catch'](handleError(_0x997358,null));};exports[_0x7bc6('0x51')]=function(_0x574c2f,_0x2ff13b){var _0x1256e8={'where':{'id':_0x574c2f[_0x7bc6('0x52')]['id']}},_0x34e188={};_0x34e188['model']=_[_0x7bc6('0x39')](db[_0x7bc6('0x33')][_0x7bc6('0x34')]);_0x1256e8[_0x7bc6('0x3c')]=_['intersection'](_0x34e188[_0x7bc6('0x37')],qs[_0x7bc6('0x3d')](_0x574c2f[_0x7bc6('0x38')][_0x7bc6('0x3d')]));_0x1256e8[_0x7bc6('0x3c')]=_0x1256e8['attributes'][_0x7bc6('0x3e')]?_0x1256e8[_0x7bc6('0x3c')]:_0x34e188[_0x7bc6('0x37')];if(_0x574c2f[_0x7bc6('0x38')][_0x7bc6('0x48')]){_0x1256e8[_0x7bc6('0x49')]=[{'all':!![]}];}_0x1256e8=_[_0x7bc6('0x45')]({},_0x1256e8,_0x574c2f[_0x7bc6('0x47')]);return db[_0x7bc6('0x33')][_0x7bc6('0x4e')](_0x1256e8)[_0x7bc6('0x2c')](handleEntityNotFound(_0x2ff13b,null))['then'](function(_0x20d1c7){if(_0x20d1c7){var _0x5c5ee6=_0x20d1c7[_0x7bc6('0x53')]({'plain':!![]});_0x5c5ee6=qs[_0x7bc6('0x54')](_0x5c5ee6,['id',_0x7bc6('0x55'),_0x7bc6('0x56'),_0x7bc6('0x57')]);_0x574c2f['body']=_['omit'](_0x574c2f[_0x7bc6('0x50')],['id',_0x7bc6('0x55'),_0x7bc6('0x56')]);return db[_0x7bc6('0x58')]['transaction'](function(_0x5168bc){return db[_0x7bc6('0x33')]['create'](_['merge'](_0x5c5ee6,_0x574c2f['body']),{'include':_0x574c2f[_0x7bc6('0x38')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x5168bc})[_0x7bc6('0x2c')](function(_0x4c81fe){var _0x523615=_0x4c81fe['get']({'plain':!![]});return db[_0x7bc6('0x59')]['findAll']({'where':{'userProfileId':_0x574c2f[_0x7bc6('0x52')]['id']},'raw':!![]})[_0x7bc6('0x2c')](function(_0x28852c){if(_0x28852c){return BPromise[_0x7bc6('0x5a')](_0x28852c,function(_0x3dcd28){return new BPromise(function(_0x184ed0,_0x2ac9f3){if(_0x3dcd28[_0x7bc6('0x5b')]===null||_0x3dcd28[_0x7bc6('0x5b')]===0x1)_0x184ed0(null);return db[_0x7bc6('0x5c')][_0x7bc6('0x4a')]({'where':{'sectionId':_0x3dcd28['id']},'raw':!![]})[_0x7bc6('0x2c')](function(_0x3e20c3){var _0x295155=_[_0x7bc6('0x32')](_0x3e20c3,function(_0x29132d){return qs[_0x7bc6('0x54')](_0x29132d,['id','createdAt',_0x7bc6('0x56'),_0x7bc6('0x5d')]);});_0x184ed0(_0x295155);})[_0x7bc6('0x4c')](function(_0x3ff6e5){_0x2ac9f3(_0x3ff6e5);});})['then'](function(_0x43a5ee){var _0x388a22=qs[_0x7bc6('0x54')](_0x3dcd28,['id','createdAt',_0x7bc6('0x56')]);_0x388a22[_0x7bc6('0x5e')]=_0x523615['id'];if(_0x43a5ee)_0x388a22[_0x7bc6('0x5f')]=_0x43a5ee;return _0x388a22;})[_0x7bc6('0x2c')](function(_0x499fc3){return db[_0x7bc6('0x59')][_0x7bc6('0x4f')](_0x499fc3,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x5168bc});});})[_0x7bc6('0x2c')](function(){return _0x523615;});}});});});}})[_0x7bc6('0x2c')](respondWithResult(_0x2ff13b,0xc9))[_0x7bc6('0x4c')](handleError(_0x2ff13b,null));};exports[_0x7bc6('0x2b')]=function(_0xa5f217,_0xd1c8){if(_0xa5f217[_0x7bc6('0x50')]['id']){delete _0xa5f217[_0x7bc6('0x50')]['id'];}return db[_0x7bc6('0x33')][_0x7bc6('0x4e')]({'where':{'id':_0xa5f217['params']['id']}})[_0x7bc6('0x2c')](handleEntityNotFound(_0xd1c8,null))[_0x7bc6('0x2c')](saveUpdates(_0xa5f217[_0x7bc6('0x50')],null))[_0x7bc6('0x2c')](respondWithResult(_0xd1c8,null))[_0x7bc6('0x4c')](handleError(_0xd1c8,null));};exports['destroy']=function(_0x393115,_0x159707){return db[_0x7bc6('0x33')]['find']({'where':{'id':_0x393115['params']['id']}})[_0x7bc6('0x2c')](handleEntityNotFound(_0x159707,null))[_0x7bc6('0x2c')](removeEntity(_0x159707,null))[_0x7bc6('0x4c')](handleError(_0x159707,null));};exports[_0x7bc6('0x60')]=function(_0xc0bdbc,_0x3e9a3a){return db[_0x7bc6('0x33')][_0x7bc6('0x60')]()[_0x7bc6('0x2c')](respondWithResult(_0x3e9a3a,null))[_0x7bc6('0x4c')](handleError(_0x3e9a3a,null));};exports[_0x7bc6('0x61')]=function(_0x1d3cc2,_0x9ecf2){var _0x271e54=_0x1d3cc2[_0x7bc6('0x50')];return db[_0x7bc6('0x33')][_0x7bc6('0x4e')]({'where':{'id':_0x1d3cc2[_0x7bc6('0x52')]['id']}})[_0x7bc6('0x2c')](handleEntityNotFound(_0x9ecf2,null))[_0x7bc6('0x2c')](function(_0x1a94b6){if(_0x1a94b6){return db['sequelize'][_0x7bc6('0x62')](function(_0x12dd52){return db[_0x7bc6('0x59')][_0x7bc6('0x2d')]({'where':{'userProfileId':_0x1d3cc2[_0x7bc6('0x52')]['id'],'sectionId':_[_0x7bc6('0x32')](_0x271e54,function(_0x14b458){return _0x14b458[_0x7bc6('0x5d')];})},'transaction':_0x12dd52})[_0x7bc6('0x2c')](function(){var _0xe04277=_[_0x7bc6('0x32')](_0x271e54,function(_0x456ad0){_0x456ad0['userProfileId']=_0x1d3cc2[_0x7bc6('0x52')]['id'];return _0x456ad0;});var _0xaf9205=[];return BPromise[_0x7bc6('0x5a')](_0xe04277,function(_0x49297f){return db[_0x7bc6('0x59')]['create'](_0x49297f,{'include':[{'model':db[_0x7bc6('0x5c')],'as':_0x7bc6('0x5f')}],'raw':!![],'transaction':_0x12dd52})['then'](function(_0x239167){_0xaf9205[_0x7bc6('0x63')](_0x239167['get']({'plain':!![]}));});})[_0x7bc6('0x2c')](function(){return _0xaf9205;});});});}})['then'](function(_0x2e311b){return _0x2e311b;})[_0x7bc6('0x2c')](respondWithResult(_0x9ecf2,null))['catch'](handleError(_0x9ecf2,null));};exports[_0x7bc6('0x64')]=function(_0x3c9a18,_0xb80c02){var _0x462252;return db[_0x7bc6('0x33')]['find']({'where':{'id':_0x3c9a18[_0x7bc6('0x52')]['id']},'attributes':['id',_0x7bc6('0x2f')]})[_0x7bc6('0x2c')](handleEntityNotFound(_0xb80c02,null))[_0x7bc6('0x2c')](function(_0x4092f8){if(_0x4092f8){_0x462252=_0x4092f8;return db['UserProfileSection'][_0x7bc6('0x2d')]({'where':{'userProfileId':_0x3c9a18[_0x7bc6('0x52')]['id'],'sectionId':_0x3c9a18[_0x7bc6('0x38')][_0x7bc6('0x65')]}});}})[_0x7bc6('0x2c')](function(){return _0x462252;})[_0x7bc6('0x2c')](respondWithStatusCode(_0xb80c02,null))[_0x7bc6('0x4c')](handleError(_0xb80c02,null));};exports[_0x7bc6('0x66')]=function(_0x46bdb9,_0x1f18ba){var _0xb33df4=[];var _0x19e31e=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x46bdb9['params']['id']},'raw':!![]})[_0x7bc6('0x2c')](function(_0x115919){_0xb33df4=_['filter'](_0x115919,function(_0x8ecd34){return _0x8ecd34[_0x7bc6('0x67')]===0x1||_[_0x7bc6('0x68')]([0x3eb,0x709],_0x8ecd34[_0x7bc6('0x5d')]);});if(!_[_0x7bc6('0x69')](_0xb33df4)){return _[_0x7bc6('0x32')](_0xb33df4,function(_0x4b3b9a){return _0x4b3b9a[_0x7bc6('0x5d')];});}else{return;}})['then'](function(_0x152fe1){if(_0x152fe1)_0x19e31e=_0x152fe1;if(_[_0x7bc6('0x68')](_0x19e31e,0x64)){var _0x31b287=_[_0x7bc6('0x4e')](_0xb33df4,{'sectionId':0x64});return hasDefaultDashboard(_0x31b287)[_0x7bc6('0x2c')](function(_0x9d8c44){return _[_0x7bc6('0x32')](_0xb33df4,function(_0x108cc7){if(_0x108cc7['sectionId']===0x64){_0x108cc7['subsections']=_0x9d8c44;}return _0x108cc7;});});}else{return;}})['then'](function(_0x3e3100){if(_0x3e3100)_0xb33df4=_0x3e3100;if(_['includes'](_0x19e31e,0x3eb)){var _0x43306b=_['find'](_0xb33df4,{'sectionId':0x3eb});return getCustomDashboards(_0x43306b)[_0x7bc6('0x2c')](function(_0x1dd10c){return _[_0x7bc6('0x32')](_0xb33df4,function(_0x8ed02c){if(_0x43306b[_0x7bc6('0x67')]){if(_0x8ed02c[_0x7bc6('0x5d')]===0x3eb){_0x8ed02c['subsections']=_0x1dd10c;}}else{if(_0x8ed02c[_0x7bc6('0x5d')]===0x64){if(!_0x8ed02c[_0x7bc6('0x6a')]){_0x8ed02c[_0x7bc6('0x6a')]=[];}_0x8ed02c[_0x7bc6('0x6a')]=_0x8ed02c[_0x7bc6('0x6a')]['concat'](_0x1dd10c);}}return _0x8ed02c;});});}else{return;}})['then'](function(_0x14fb58){if(_0x14fb58)_0xb33df4=_0x14fb58;if(_[_0x7bc6('0x68')](_0x19e31e,0x709)){var _0x45e39f=_['find'](_0xb33df4,{'sectionId':0x709});return getPlugins(_0x45e39f)['then'](function(_0x305f2e){if(_0x45e39f[_0x7bc6('0x67')]){return _[_0x7bc6('0x32')](_0xb33df4,function(_0x5f52c7){if(_0x5f52c7[_0x7bc6('0x5d')]===0x709){_0x5f52c7[_0x7bc6('0x6a')]=_0x305f2e;}return _0x5f52c7;});}else{var _0x55dada={'sectionId':0x76c,'enabled':0x1,'subsections':_0x305f2e};var _0x5cc69b=_[_0x7bc6('0x32')](_0xb33df4);_0x5cc69b[_0x7bc6('0x63')](_0x55dada);return _0x5cc69b;}});}else{return;}})[_0x7bc6('0x2c')](function(_0x3de9e1){if(_0x3de9e1)_0xb33df4=_0x3de9e1;return _['filter'](_0xb33df4,[_0x7bc6('0x67'),0x1]);})[_0x7bc6('0x2c')](respondWithResult(_0x1f18ba,null))[_0x7bc6('0x4c')](handleError(_0x1f18ba,null));};function hasDefaultDashboard(_0x5e5091){var _0x5b9d4d=[0x65];return new BPromise(function(_0x38206f,_0x3b3d93){try{if(_0x5e5091[_0x7bc6('0x5b')]){_0x38206f(_0x5b9d4d);}else{return db['UserProfileResource'][_0x7bc6('0x6b')]({'where':{'sectionId':_0x5e5091['id']},'raw':!![]})[_0x7bc6('0x2c')](function(_0xf1a19){_0xf1a19?_0x38206f(_0x5b9d4d):_0x38206f();});}}catch(_0x243caf){_0x3b3d93(_0x243caf);}});}function getCustomDashboards(_0x498a2f){var _0xbff412=[];return new BPromise(function(_0x4e14db,_0x444e71){try{if(_0x498a2f['autoAssociation']){return db['Dashboard'][_0x7bc6('0x4a')]({'raw':!![]})['then'](function(_0x3d2cb0){_0x3d2cb0[_0x7bc6('0x6c')](function(_0x5c3944){_0xbff412[_0x7bc6('0x63')](_0x5c3944['id']+0x1869f);});_0x4e14db(_0xbff412);});}else{return db['UserProfileResource'][_0x7bc6('0x4a')]({'where':{'sectionId':_0x498a2f['id']},'raw':!![]})['then'](function(_0x47cdcf){_0x47cdcf[_0x7bc6('0x6c')](function(_0x2d2b81){_0xbff412[_0x7bc6('0x63')](_0x2d2b81[_0x7bc6('0x6d')]+0x1869f);});_0x4e14db(_0xbff412);});}}catch(_0x261568){_0x444e71(_0x261568);}});}function getPlugins(_0x11275d){var _0x781abb=[];return new BPromise(function(_0x352731,_0x4fa857){try{if(_0x11275d[_0x7bc6('0x5b')]){return db[_0x7bc6('0x6e')][_0x7bc6('0x4a')]({'raw':!![]})[_0x7bc6('0x2c')](function(_0x363f80){_0x363f80[_0x7bc6('0x6c')](function(_0x221999){_0x781abb['push'](_0x221999['id']+0x15b38);});_0x352731(_0x781abb);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x11275d['id']},'raw':!![]})[_0x7bc6('0x2c')](function(_0x342b15){_0x342b15[_0x7bc6('0x6c')](function(_0x4ff2d9){_0x781abb[_0x7bc6('0x63')](_0x4ff2d9[_0x7bc6('0x6d')]+0x15b38);});_0x352731(_0x781abb);});}}catch(_0x34509a){_0x4fa857(_0x34509a);}});}exports['addResources']=function(_0x2c71c0,_0x1ec4b7){return db[_0x7bc6('0x33')][_0x7bc6('0x4e')]({'where':{'id':_0x2c71c0[_0x7bc6('0x52')]['id']}})[_0x7bc6('0x2c')](handleEntityNotFound(_0x1ec4b7,null))['then'](function(_0x12fd24){if(_0x12fd24){return db[_0x7bc6('0x58')][_0x7bc6('0x62')](function(_0x555da5){return db[_0x7bc6('0x59')][_0x7bc6('0x4a')]({'where':{'userProfileId':_0x2c71c0[_0x7bc6('0x52')]['id']},'attributes':['id'],'raw':!![]})[_0x7bc6('0x2c')](function(_0x44b287){if(_0x44b287){return db[_0x7bc6('0x59')][_0x7bc6('0x2d')]({'where':{'userProfileId':_0x2c71c0['params']['id'],'id':_[_0x7bc6('0x32')](_0x44b287,function(_0x50a924){return _0x50a924['id'];})},'transaction':_0x555da5});}})[_0x7bc6('0x2c')](function(_0x2856ac){var _0x10feaa=_['map'](_0x2c71c0[_0x7bc6('0x50')],function(_0x87d65b){_0x87d65b[_0x7bc6('0x5e')]=_0x2c71c0[_0x7bc6('0x52')]['id'];return _0x87d65b;});return db[_0x7bc6('0x59')][_0x7bc6('0x6f')](_0x10feaa,{'raw':!![],'transaction':_0x555da5});})['then'](function(_0x27aec1){var _0x3c8113=_[_0x7bc6('0x43')](_[_0x7bc6('0x32')](_0x27aec1,function(_0x2c38b9){return _0x2c38b9[_0x7bc6('0x53')]({'plain':!![]});}),{'includeAll':![]});if(_0x3c8113){return db[_0x7bc6('0x59')][_0x7bc6('0x4a')]({'where':{'userProfileId':_0x2c71c0[_0x7bc6('0x52')]['id'],'sectionId':_['map'](_0x3c8113,function(_0x28f9bb){return _0x28f9bb[_0x7bc6('0x5d')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x7bc6('0x2c')](function(_0x916e59){var _0x2f94e5=_[_0x7bc6('0x32')](_0x2c71c0[_0x7bc6('0x50')],function(_0x1b088f){_0x1b088f[_0x7bc6('0x5e')]=_0x2c71c0[_0x7bc6('0x52')]['id'];return _0x1b088f;});return db[_0x7bc6('0x5c')][_0x7bc6('0x6f')](_0x2f94e5,{'raw':!![],'transaction':_0x555da5});});}})[_0x7bc6('0x4c')](handleError(_0x1ec4b7,null));});}})[_0x7bc6('0x2c')](function(_0x58d860){var _0x8ebd52=_['map'](_0x58d860,function(_0xede046){return _0xede046['get']({'plain':!![]});});})[_0x7bc6('0x2c')](respondWithResult(_0x1ec4b7,null))[_0x7bc6('0x4c')](handleError(_0x1ec4b7,null));};exports['removeResources']=function(_0x1481d6,_0x1be6e7,_0x1f29f8){return db[_0x7bc6('0x33')][_0x7bc6('0x4e')]({'where':{'id':_0x1481d6[_0x7bc6('0x52')]['id']}})[_0x7bc6('0x2c')](handleEntityNotFound(_0x1be6e7,null))[_0x7bc6('0x2c')](function(_0x3203ac){if(_0x3203ac){return _0x3203ac['removeResources'](_0x1481d6[_0x7bc6('0x38')][_0x7bc6('0x65')]);}})[_0x7bc6('0x2c')](respondWithStatusCode(_0x1be6e7,null))['catch'](handleError(_0x1be6e7,null));};exports['getResources']=function(_0x4ba84c,_0x416d9b){var _0x3bbaf0={};if(!_0x4ba84c[_0x7bc6('0x38')]['section'])throw new Error(_0x7bc6('0x70'));if(!_0x4ba84c[_0x7bc6('0x38')][_0x7bc6('0x3f')]('nolimit')){_0x3bbaf0[_0x7bc6('0x24')]=qs['limit'](_0x4ba84c[_0x7bc6('0x38')]['limit']);_0x3bbaf0[_0x7bc6('0x26')]=qs[_0x7bc6('0x26')](_0x4ba84c['query'][_0x7bc6('0x26')]);}return db[_0x7bc6('0x33')][_0x7bc6('0x4e')]({'where':{'id':_0x4ba84c[_0x7bc6('0x52')]['id']}})[_0x7bc6('0x2c')](function(_0x20fcdc){if(!_0x20fcdc)throw new Error(_0x7bc6('0x71')+_0x4ba84c[_0x7bc6('0x52')]['id']);return db[_0x7bc6('0x33')]['getResources'](_0x4ba84c);})[_0x7bc6('0x2c')](respondWithFilteredResult(_0x416d9b,_0x3bbaf0))[_0x7bc6('0x4c')](handleError(_0x416d9b,null));};
\ No newline at end of file
+var _0x4d86=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','clone','merge','get','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','ids','enabled','includes','subsections','concat','push','findOne','Dashboard','forEach','resourceId','Plugin','bulkCreate','removeResources','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','keys','query','filters','intersection'];(function(_0x5f26b0,_0x357294){var _0x2aaf0f=function(_0x1daf64){while(--_0x1daf64){_0x5f26b0['push'](_0x5f26b0['shift']());}};_0x2aaf0f(++_0x357294);}(_0x4d86,0x128));var _0x64d8=function(_0x452e4e,_0x532b7d){_0x452e4e=_0x452e4e-0x0;var _0xea0521=_0x4d86[_0x452e4e];return _0xea0521;};'use strict';var emlformat=require(_0x64d8('0x0'));var rimraf=require(_0x64d8('0x1'));var zipdir=require(_0x64d8('0x2'));var jsonpatch=require(_0x64d8('0x3'));var rp=require(_0x64d8('0x4'));var moment=require(_0x64d8('0x5'));var BPromise=require(_0x64d8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x64d8('0x7'));var sox=require(_0x64d8('0x8'));var csv=require(_0x64d8('0x9'));var ejs=require(_0x64d8('0xa'));var fs=require('fs');var fs_extra=require(_0x64d8('0xb'));var _=require(_0x64d8('0xc'));var squel=require(_0x64d8('0xd'));var crypto=require(_0x64d8('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x64d8('0xf'));var toCsv=require(_0x64d8('0x9'));var querystring=require(_0x64d8('0x10'));var Papa=require(_0x64d8('0x11'));var Redis=require(_0x64d8('0x12'));var authService=require(_0x64d8('0x13'));var qs=require(_0x64d8('0x14'));var as=require(_0x64d8('0x15'));var hardwareService=require(_0x64d8('0x16'));var logger=require(_0x64d8('0x17'))(_0x64d8('0x18'));var utils=require(_0x64d8('0x19'));var config=require(_0x64d8('0x1a'));var licenseUtil=require(_0x64d8('0x1b'));var db=require('../../mysqldb')['db'];config[_0x64d8('0x1c')]=_[_0x64d8('0x1d')](config[_0x64d8('0x1c')],{'host':_0x64d8('0x1e'),'port':0x18eb});var socket=require(_0x64d8('0x1f'))(new Redis(config[_0x64d8('0x1c')]));require(_0x64d8('0x20'))[_0x64d8('0x21')](socket);function respondWithStatusCode(_0x22ed1f,_0x3e6ccf){_0x3e6ccf=_0x3e6ccf||0xcc;return function(_0x2ec036){if(_0x2ec036){return _0x22ed1f[_0x64d8('0x22')](_0x3e6ccf);}return _0x22ed1f['status'](_0x3e6ccf)['end']();};}function respondWithResult(_0x34504f,_0x279bc6){_0x279bc6=_0x279bc6||0xc8;return function(_0x58004a){if(_0x58004a){return _0x34504f['status'](_0x279bc6)['json'](_0x58004a);}};}function respondWithFilteredResult(_0x5acd63,_0x109bfd){return function(_0x2edad6){if(_0x2edad6){var _0x20bed9=typeof _0x109bfd[_0x64d8('0x23')]===_0x64d8('0x24')&&typeof _0x109bfd[_0x64d8('0x25')]===_0x64d8('0x24');var _0x1a2fc6=_0x2edad6[_0x64d8('0x26')];var _0x2f4134=_0x20bed9?0x0:_0x109bfd[_0x64d8('0x23')];var _0x16605c=_0x20bed9?_0x2edad6[_0x64d8('0x26')]:_0x109bfd['offset']+_0x109bfd[_0x64d8('0x25')];var _0x1ae731;if(_0x16605c>=_0x1a2fc6){_0x16605c=_0x1a2fc6;_0x1ae731=0xc8;}else{_0x1ae731=0xce;}_0x5acd63[_0x64d8('0x27')](_0x1ae731);return _0x5acd63[_0x64d8('0x28')](_0x64d8('0x29'),_0x2f4134+'-'+_0x16605c+'/'+_0x1a2fc6)[_0x64d8('0x2a')](_0x2edad6);}return null;};}function patchUpdates(_0x4e4332){return function(_0x10e68f){try{jsonpatch['apply'](_0x10e68f,_0x4e4332,!![]);}catch(_0x3f40d9){return BPromise[_0x64d8('0x2b')](_0x3f40d9);}return _0x10e68f[_0x64d8('0x2c')]();};}function saveUpdates(_0x4c2183,_0x17d4c1){return function(_0x55ce44){if(_0x55ce44){return _0x55ce44[_0x64d8('0x2d')](_0x4c2183)['then'](function(_0x27b72d){return _0x27b72d;});}return null;};}function removeEntity(_0x1ae277,_0x5e6354){return function(_0x2c2563){if(_0x2c2563){return _0x2c2563[_0x64d8('0x2e')]()[_0x64d8('0x2f')](function(){_0x1ae277[_0x64d8('0x27')](0xcc)[_0x64d8('0x30')]();});}};}function handleEntityNotFound(_0x3d47d8,_0x349d5b){return function(_0x5c6e94){if(!_0x5c6e94){_0x3d47d8['sendStatus'](0x194);}return _0x5c6e94;};}function handleError(_0x2f8ced,_0x3220ce){_0x3220ce=_0x3220ce||0x1f4;return function(_0x20c182){logger[_0x64d8('0x31')](_0x20c182[_0x64d8('0x32')]);if(_0x20c182[_0x64d8('0x33')]){delete _0x20c182[_0x64d8('0x33')];}_0x2f8ced[_0x64d8('0x27')](_0x3220ce)[_0x64d8('0x34')](_0x20c182);};}exports[_0x64d8('0x35')]=function(_0x2d6bd7,_0x24a4e3){var _0x13215b={},_0x34f7aa={},_0x492fee={'count':0x0,'rows':[]};var _0x28d0a6=_[_0x64d8('0x36')](db[_0x64d8('0x37')][_0x64d8('0x38')],function(_0x31642){return{'name':_0x31642[_0x64d8('0x39')],'type':_0x31642[_0x64d8('0x3a')][_0x64d8('0x3b')]};});_0x34f7aa['model']=_[_0x64d8('0x36')](_0x28d0a6,'name');_0x34f7aa['query']=_[_0x64d8('0x3c')](_0x2d6bd7[_0x64d8('0x3d')]);_0x34f7aa[_0x64d8('0x3e')]=_[_0x64d8('0x3f')](_0x34f7aa[_0x64d8('0x40')],_0x34f7aa[_0x64d8('0x3d')]);_0x13215b[_0x64d8('0x41')]=_['intersection'](_0x34f7aa[_0x64d8('0x40')],qs[_0x64d8('0x42')](_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x42')]));_0x13215b[_0x64d8('0x41')]=_0x13215b[_0x64d8('0x41')][_0x64d8('0x43')]?_0x13215b[_0x64d8('0x41')]:_0x34f7aa[_0x64d8('0x40')];if(!_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x44')](_0x64d8('0x45'))){_0x13215b[_0x64d8('0x25')]=qs[_0x64d8('0x25')](_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x25')]);_0x13215b['offset']=qs[_0x64d8('0x23')](_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x23')]);}_0x13215b[_0x64d8('0x46')]=qs[_0x64d8('0x47')](_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x47')]);_0x13215b['where']=qs[_0x64d8('0x3e')](_[_0x64d8('0x48')](_0x2d6bd7[_0x64d8('0x3d')],_0x34f7aa[_0x64d8('0x3e')]),_0x28d0a6);if(_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x49')]){_0x13215b[_0x64d8('0x4a')]=_['merge'](_0x13215b[_0x64d8('0x4a')],{'$or':_['map'](_0x28d0a6,function(_0x53206e){if(_0x53206e[_0x64d8('0x3a')]!==_0x64d8('0x4b')){var _0x39ece4={};_0x39ece4[_0x53206e[_0x64d8('0x33')]]={'$like':'%'+_0x2d6bd7[_0x64d8('0x3d')][_0x64d8('0x49')]+'%'};return _0x39ece4;}})});}_0x13215b=_['merge']({},_0x13215b,_0x2d6bd7[_0x64d8('0x4c')]);var _0x8a98b0={'where':_0x13215b[_0x64d8('0x4a')]};return db[_0x64d8('0x37')]['count'](_0x8a98b0)[_0x64d8('0x2f')](function(_0x1072e9){_0x492fee[_0x64d8('0x26')]=_0x1072e9;if(_0x2d6bd7['query'][_0x64d8('0x4d')]){_0x13215b['include']=[{'all':!![]}];}return db[_0x64d8('0x37')][_0x64d8('0x4e')](_0x13215b);})[_0x64d8('0x2f')](function(_0x5eb8bd){_0x492fee[_0x64d8('0x4f')]=_0x5eb8bd;return _0x492fee;})[_0x64d8('0x2f')](respondWithFilteredResult(_0x24a4e3,_0x13215b))[_0x64d8('0x50')](handleError(_0x24a4e3,null));};exports[_0x64d8('0x51')]=function(_0x5bee87,_0x3c9220){var _0x215ec2={'raw':![],'where':{'id':_0x5bee87[_0x64d8('0x52')]['id']}},_0x2511d1={};_0x2511d1[_0x64d8('0x40')]=_[_0x64d8('0x3c')](db['UserProfile']['rawAttributes']);_0x2511d1[_0x64d8('0x3d')]=_[_0x64d8('0x3c')](_0x5bee87['query']);_0x2511d1[_0x64d8('0x3e')]=_[_0x64d8('0x3f')](_0x2511d1[_0x64d8('0x40')],_0x2511d1[_0x64d8('0x3d')]);_0x215ec2[_0x64d8('0x41')]=_['intersection'](_0x2511d1[_0x64d8('0x40')],qs[_0x64d8('0x42')](_0x5bee87[_0x64d8('0x3d')][_0x64d8('0x42')]));_0x215ec2[_0x64d8('0x41')]=_0x215ec2[_0x64d8('0x41')][_0x64d8('0x43')]?_0x215ec2[_0x64d8('0x41')]:_0x2511d1[_0x64d8('0x40')];if(_0x5bee87['query'][_0x64d8('0x4d')]){_0x215ec2[_0x64d8('0x53')]=[{'all':!![]}];}_0x215ec2=_['merge']({},_0x215ec2,_0x5bee87[_0x64d8('0x4c')]);return db[_0x64d8('0x37')][_0x64d8('0x54')](_0x215ec2)[_0x64d8('0x2f')](handleEntityNotFound(_0x3c9220,null))[_0x64d8('0x2f')](respondWithResult(_0x3c9220,null))['catch'](handleError(_0x3c9220,null));};exports['create']=function(_0xeb064d,_0x5c8f5d){return db[_0x64d8('0x37')][_0x64d8('0x55')](_0xeb064d[_0x64d8('0x56')],{})[_0x64d8('0x2f')](respondWithResult(_0x5c8f5d,0xc9))[_0x64d8('0x50')](handleError(_0x5c8f5d,null));};exports[_0x64d8('0x57')]=function(_0x2da0c1,_0x4c0f87){var _0x3c927d={'where':{'id':_0x2da0c1[_0x64d8('0x52')]['id']}},_0x50495f={};_0x50495f['model']=_[_0x64d8('0x3c')](db[_0x64d8('0x37')][_0x64d8('0x38')]);_0x3c927d['attributes']=_[_0x64d8('0x3f')](_0x50495f[_0x64d8('0x40')],qs[_0x64d8('0x42')](_0x2da0c1[_0x64d8('0x3d')][_0x64d8('0x42')]));_0x3c927d[_0x64d8('0x41')]=_0x3c927d[_0x64d8('0x41')][_0x64d8('0x43')]?_0x3c927d[_0x64d8('0x41')]:_0x50495f['model'];if(_0x2da0c1['query'][_0x64d8('0x4d')]){_0x3c927d['include']=[{'all':!![]}];}_0x3c927d=_[_0x64d8('0x58')]({},_0x3c927d,_0x2da0c1['options']);return db['UserProfile'][_0x64d8('0x54')](_0x3c927d)[_0x64d8('0x2f')](handleEntityNotFound(_0x4c0f87,null))[_0x64d8('0x2f')](function(_0x5d4227){if(_0x5d4227){var _0x2835a2=_0x5d4227[_0x64d8('0x59')]({'plain':!![]});_0x2835a2=qs[_0x64d8('0x5a')](_0x2835a2,['id','createdAt',_0x64d8('0x5b'),_0x64d8('0x5c')]);_0x2da0c1[_0x64d8('0x56')]=_['omit'](_0x2da0c1[_0x64d8('0x56')],['id',_0x64d8('0x5d'),_0x64d8('0x5b')]);return db[_0x64d8('0x5e')][_0x64d8('0x5f')](function(_0x23f522){return db['UserProfile'][_0x64d8('0x55')](_[_0x64d8('0x58')](_0x2835a2,_0x2da0c1[_0x64d8('0x56')]),{'include':_0x2da0c1['query'][_0x64d8('0x4d')]?[{'all':!![]}]:undefined,'transaction':_0x23f522})[_0x64d8('0x2f')](function(_0x53b560){var _0x3cd6c3=_0x53b560['get']({'plain':!![]});return db[_0x64d8('0x60')][_0x64d8('0x4e')]({'where':{'userProfileId':_0x2da0c1[_0x64d8('0x52')]['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x4ec457){if(_0x4ec457){return BPromise[_0x64d8('0x61')](_0x4ec457,function(_0x399eac){return new BPromise(function(_0x20716d,_0x58ecef){if(_0x399eac[_0x64d8('0x62')]===null||_0x399eac['autoAssociation']===0x1)_0x20716d(null);return db['UserProfileResource'][_0x64d8('0x4e')]({'where':{'sectionId':_0x399eac['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x1f2692){var _0x55298a=_[_0x64d8('0x36')](_0x1f2692,function(_0x54e6fe){return qs[_0x64d8('0x5a')](_0x54e6fe,['id',_0x64d8('0x5d'),_0x64d8('0x5b'),_0x64d8('0x63')]);});_0x20716d(_0x55298a);})[_0x64d8('0x50')](function(_0x51493e){_0x58ecef(_0x51493e);});})[_0x64d8('0x2f')](function(_0x8496c9){var _0xd61137=qs[_0x64d8('0x5a')](_0x399eac,['id','createdAt',_0x64d8('0x5b')]);_0xd61137[_0x64d8('0x64')]=_0x3cd6c3['id'];if(_0x8496c9)_0xd61137[_0x64d8('0x65')]=_0x8496c9;return _0xd61137;})[_0x64d8('0x2f')](function(_0x735a){return db[_0x64d8('0x60')][_0x64d8('0x55')](_0x735a,{'include':[{'model':db[_0x64d8('0x66')],'as':'Resources'}],'raw':!![],'transaction':_0x23f522});});})[_0x64d8('0x2f')](function(){return _0x3cd6c3;});}});});});}})[_0x64d8('0x2f')](respondWithResult(_0x4c0f87,0xc9))[_0x64d8('0x50')](handleError(_0x4c0f87,null));};exports[_0x64d8('0x2d')]=function(_0x1ab2d6,_0x262fca){if(_0x1ab2d6[_0x64d8('0x56')]['id']){delete _0x1ab2d6[_0x64d8('0x56')]['id'];}return db[_0x64d8('0x37')][_0x64d8('0x54')]({'where':{'id':_0x1ab2d6[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x262fca,null))[_0x64d8('0x2f')](saveUpdates(_0x1ab2d6[_0x64d8('0x56')],null))[_0x64d8('0x2f')](respondWithResult(_0x262fca,null))[_0x64d8('0x50')](handleError(_0x262fca,null));};exports[_0x64d8('0x2e')]=function(_0x322b66,_0x33295c){return db[_0x64d8('0x37')][_0x64d8('0x54')]({'where':{'id':_0x322b66[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x33295c,null))[_0x64d8('0x2f')](removeEntity(_0x33295c,null))['catch'](handleError(_0x33295c,null));};exports['describe']=function(_0x3050b2,_0x13a9ea){return db[_0x64d8('0x37')][_0x64d8('0x67')]()['then'](respondWithResult(_0x13a9ea,null))[_0x64d8('0x50')](handleError(_0x13a9ea,null));};exports[_0x64d8('0x68')]=function(_0x2451bc,_0x1861e7){var _0x33067c=_0x2451bc[_0x64d8('0x56')];return db['UserProfile']['find']({'where':{'id':_0x2451bc[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x1861e7,null))[_0x64d8('0x2f')](function(_0x474a84){if(_0x474a84){return db['sequelize'][_0x64d8('0x5f')](function(_0x5526f2){return db[_0x64d8('0x60')][_0x64d8('0x2e')]({'where':{'userProfileId':_0x2451bc['params']['id'],'sectionId':_[_0x64d8('0x36')](_0x33067c,function(_0x167192){return _0x167192['sectionId'];})},'transaction':_0x5526f2})[_0x64d8('0x2f')](function(){var _0x3a917a=_[_0x64d8('0x36')](_0x33067c,function(_0x4a69ef){_0x4a69ef[_0x64d8('0x64')]=_0x2451bc['params']['id'];return _0x4a69ef;});var _0x4dc58f=[];return BPromise[_0x64d8('0x61')](_0x3a917a,function(_0x4abaed){return db['UserProfileSection'][_0x64d8('0x55')](_0x4abaed,{'include':[{'model':db['UserProfileResource'],'as':_0x64d8('0x65')}],'raw':!![],'transaction':_0x5526f2})[_0x64d8('0x2f')](function(_0x484feb){_0x4dc58f['push'](_0x484feb[_0x64d8('0x59')]({'plain':!![]}));});})[_0x64d8('0x2f')](function(){return _0x4dc58f;});});});}})['then'](function(_0x23a5e6){return _0x23a5e6;})[_0x64d8('0x2f')](respondWithResult(_0x1861e7,null))[_0x64d8('0x50')](handleError(_0x1861e7,null));};exports['removeSections']=function(_0xacb9f0,_0xd371cb){var _0x3164cc;return db[_0x64d8('0x37')][_0x64d8('0x54')]({'where':{'id':_0xacb9f0['params']['id']},'attributes':['id',_0x64d8('0x33')]})[_0x64d8('0x2f')](handleEntityNotFound(_0xd371cb,null))[_0x64d8('0x2f')](function(_0x385757){if(_0x385757){_0x3164cc=_0x385757;return db[_0x64d8('0x60')]['destroy']({'where':{'userProfileId':_0xacb9f0[_0x64d8('0x52')]['id'],'sectionId':_0xacb9f0[_0x64d8('0x3d')][_0x64d8('0x69')]}});}})[_0x64d8('0x2f')](function(){return _0x3164cc;})['then'](respondWithStatusCode(_0xd371cb,null))[_0x64d8('0x50')](handleError(_0xd371cb,null));};exports['getSections']=function(_0x3e0d78,_0x50cf2b){var _0x25e114=[];var _0x26c16a=[];return db[_0x64d8('0x60')][_0x64d8('0x4e')]({'where':{'userProfileId':_0x3e0d78['params']['id']},'raw':!![]})['then'](function(_0x356ac7){_0x25e114=_[_0x64d8('0x49')](_0x356ac7,function(_0x8ae7d2){return _0x8ae7d2[_0x64d8('0x6a')]===0x1||_[_0x64d8('0x6b')]([0x3eb,0x709],_0x8ae7d2[_0x64d8('0x63')]);});if(!_['isEmpty'](_0x25e114)){return _[_0x64d8('0x36')](_0x25e114,function(_0x4240ee){return _0x4240ee[_0x64d8('0x63')];});}else{return;}})[_0x64d8('0x2f')](function(_0x3840d6){if(_0x3840d6)_0x26c16a=_0x3840d6;if(_[_0x64d8('0x6b')](_0x26c16a,0x64)){var _0xe13c1e=_[_0x64d8('0x54')](_0x25e114,{'sectionId':0x64});return hasDefaultDashboard(_0xe13c1e)[_0x64d8('0x2f')](function(_0x517032){return _[_0x64d8('0x36')](_0x25e114,function(_0x18769f){if(_0x18769f[_0x64d8('0x63')]===0x64){_0x18769f['subsections']=_0x517032;}return _0x18769f;});});}else{return;}})[_0x64d8('0x2f')](function(_0x5264d1){if(_0x5264d1)_0x25e114=_0x5264d1;if(_[_0x64d8('0x6b')](_0x26c16a,0x3eb)){var _0x26e37b=_[_0x64d8('0x54')](_0x25e114,{'sectionId':0x3eb});return getCustomDashboards(_0x26e37b)[_0x64d8('0x2f')](function(_0x31be34){return _[_0x64d8('0x36')](_0x25e114,function(_0x40c4aa){if(_0x26e37b[_0x64d8('0x6a')]){if(_0x40c4aa[_0x64d8('0x63')]===0x3eb){_0x40c4aa[_0x64d8('0x6c')]=_0x31be34;}}else{if(_0x40c4aa[_0x64d8('0x63')]===0x64){if(!_0x40c4aa[_0x64d8('0x6c')]){_0x40c4aa[_0x64d8('0x6c')]=[];}_0x40c4aa[_0x64d8('0x6c')]=_0x40c4aa[_0x64d8('0x6c')][_0x64d8('0x6d')](_0x31be34);}}return _0x40c4aa;});});}else{return;}})[_0x64d8('0x2f')](function(_0x1c76c3){if(_0x1c76c3)_0x25e114=_0x1c76c3;if(_[_0x64d8('0x6b')](_0x26c16a,0x709)){var _0xf005bd=_[_0x64d8('0x54')](_0x25e114,{'sectionId':0x709});return getPlugins(_0xf005bd)[_0x64d8('0x2f')](function(_0x1a5b65){if(_0xf005bd['enabled']){return _[_0x64d8('0x36')](_0x25e114,function(_0x32b7d8){if(_0x32b7d8[_0x64d8('0x63')]===0x709){_0x32b7d8['subsections']=_0x1a5b65;}return _0x32b7d8;});}else{var _0x3e7f29={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1a5b65};var _0x11f890=_[_0x64d8('0x36')](_0x25e114);_0x11f890[_0x64d8('0x6e')](_0x3e7f29);return _0x11f890;}});}else{return;}})[_0x64d8('0x2f')](function(_0x32b0fa){if(_0x32b0fa)_0x25e114=_0x32b0fa;return _[_0x64d8('0x49')](_0x25e114,[_0x64d8('0x6a'),0x1]);})['then'](respondWithResult(_0x50cf2b,null))[_0x64d8('0x50')](handleError(_0x50cf2b,null));};function hasDefaultDashboard(_0x31de35){var _0x3853e6=[0x65];return new BPromise(function(_0x7c9d73,_0x3cc59e){try{if(_0x31de35[_0x64d8('0x62')]){_0x7c9d73(_0x3853e6);}else{return db['UserProfileResource'][_0x64d8('0x6f')]({'where':{'sectionId':_0x31de35['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x15937b){_0x15937b?_0x7c9d73(_0x3853e6):_0x7c9d73();});}}catch(_0x46f828){_0x3cc59e(_0x46f828);}});}function getCustomDashboards(_0x2f66f8){var _0x444437=[];return new BPromise(function(_0x31b14d,_0xf15578){try{if(_0x2f66f8[_0x64d8('0x62')]){return db[_0x64d8('0x70')][_0x64d8('0x4e')]({'raw':!![]})['then'](function(_0x15836a){_0x15836a[_0x64d8('0x71')](function(_0x5b22d8){_0x444437[_0x64d8('0x6e')](_0x5b22d8['id']+0x1869f);});_0x31b14d(_0x444437);});}else{return db[_0x64d8('0x66')][_0x64d8('0x4e')]({'where':{'sectionId':_0x2f66f8['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x11dd15){_0x11dd15['forEach'](function(_0x46d487){_0x444437[_0x64d8('0x6e')](_0x46d487[_0x64d8('0x72')]+0x1869f);});_0x31b14d(_0x444437);});}}catch(_0x52730b){_0xf15578(_0x52730b);}});}function getPlugins(_0x3e1666){var _0x23a623=[];return new BPromise(function(_0x2a538e,_0x2bb063){try{if(_0x3e1666['autoAssociation']){return db[_0x64d8('0x73')][_0x64d8('0x4e')]({'raw':!![]})[_0x64d8('0x2f')](function(_0xccef3a){_0xccef3a[_0x64d8('0x71')](function(_0x19940f){_0x23a623['push'](_0x19940f['id']+0x15b38);});_0x2a538e(_0x23a623);});}else{return db[_0x64d8('0x66')][_0x64d8('0x4e')]({'where':{'sectionId':_0x3e1666['id']},'raw':!![]})[_0x64d8('0x2f')](function(_0x3269b0){_0x3269b0[_0x64d8('0x71')](function(_0x460a5c){_0x23a623['push'](_0x460a5c[_0x64d8('0x72')]+0x15b38);});_0x2a538e(_0x23a623);});}}catch(_0x564652){_0x2bb063(_0x564652);}});}exports['addResources']=function(_0x1b31ab,_0x4dcc5d){return db['UserProfile']['find']({'where':{'id':_0x1b31ab[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x4dcc5d,null))['then'](function(_0x326c53){if(_0x326c53){return db[_0x64d8('0x5e')][_0x64d8('0x5f')](function(_0x1cf1fb){return db[_0x64d8('0x60')][_0x64d8('0x4e')]({'where':{'userProfileId':_0x1b31ab[_0x64d8('0x52')]['id']},'attributes':['id'],'raw':!![]})[_0x64d8('0x2f')](function(_0x3646ab){if(_0x3646ab){return db[_0x64d8('0x60')][_0x64d8('0x2e')]({'where':{'userProfileId':_0x1b31ab[_0x64d8('0x52')]['id'],'id':_['map'](_0x3646ab,function(_0x3215f5){return _0x3215f5['id'];})},'transaction':_0x1cf1fb});}})[_0x64d8('0x2f')](function(_0xfd2e2){var _0x402b15=_[_0x64d8('0x36')](_0x1b31ab[_0x64d8('0x56')],function(_0x4e5c98){_0x4e5c98[_0x64d8('0x64')]=_0x1b31ab[_0x64d8('0x52')]['id'];return _0x4e5c98;});return db[_0x64d8('0x60')][_0x64d8('0x74')](_0x402b15,{'raw':!![],'transaction':_0x1cf1fb});})[_0x64d8('0x2f')](function(_0x2c776a){var _0x3e07c4=_[_0x64d8('0x49')](_[_0x64d8('0x36')](_0x2c776a,function(_0x25453e){return _0x25453e[_0x64d8('0x59')]({'plain':!![]});}),{'includeAll':![]});if(_0x3e07c4){return db[_0x64d8('0x60')]['findAll']({'where':{'userProfileId':_0x1b31ab[_0x64d8('0x52')]['id'],'sectionId':_['map'](_0x3e07c4,function(_0x6556f){return _0x6556f['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x35f151){var _0x57d1ba=_['map'](_0x1b31ab[_0x64d8('0x56')],function(_0x472de4){_0x472de4['userProfileId']=_0x1b31ab[_0x64d8('0x52')]['id'];return _0x472de4;});return db[_0x64d8('0x66')][_0x64d8('0x74')](_0x57d1ba,{'raw':!![],'transaction':_0x1cf1fb});});}})[_0x64d8('0x50')](handleError(_0x4dcc5d,null));});}})[_0x64d8('0x2f')](function(_0x27eafe){var _0x2eee2f=_[_0x64d8('0x36')](_0x27eafe,function(_0x5bf34e){return _0x5bf34e[_0x64d8('0x59')]({'plain':!![]});});})[_0x64d8('0x2f')](respondWithResult(_0x4dcc5d,null))[_0x64d8('0x50')](handleError(_0x4dcc5d,null));};exports[_0x64d8('0x75')]=function(_0x21654d,_0x2cc701,_0x5d0da8){return db['UserProfile'][_0x64d8('0x54')]({'where':{'id':_0x21654d[_0x64d8('0x52')]['id']}})[_0x64d8('0x2f')](handleEntityNotFound(_0x2cc701,null))[_0x64d8('0x2f')](function(_0x3be597){if(_0x3be597){return _0x3be597[_0x64d8('0x75')](_0x21654d['query'][_0x64d8('0x69')]);}})['then'](respondWithStatusCode(_0x2cc701,null))['catch'](handleError(_0x2cc701,null));};exports[_0x64d8('0x76')]=function(_0x221e05,_0x2483c2){var _0x28d896={};if(!_0x221e05[_0x64d8('0x3d')]['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x221e05[_0x64d8('0x3d')][_0x64d8('0x44')](_0x64d8('0x45'))){_0x28d896['limit']=qs[_0x64d8('0x25')](_0x221e05['query'][_0x64d8('0x25')]);_0x28d896[_0x64d8('0x23')]=qs[_0x64d8('0x23')](_0x221e05['query'][_0x64d8('0x23')]);}return db[_0x64d8('0x37')][_0x64d8('0x54')]({'where':{'id':_0x221e05[_0x64d8('0x52')]['id']}})['then'](function(_0x243efe){if(!_0x243efe)throw new Error(_0x64d8('0x77')+_0x221e05[_0x64d8('0x52')]['id']);return db[_0x64d8('0x37')][_0x64d8('0x76')](_0x221e05);})[_0x64d8('0x2f')](respondWithFilteredResult(_0x2483c2,_0x28d896))[_0x64d8('0x50')](handleError(_0x2483c2,null));};
\ No newline at end of file
index 1e2cdd5..1f416b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x71ab=['emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove'];(function(_0x49f2a1,_0x2623e0){var _0x1d0ad3=function(_0x36f38){while(--_0x36f38){_0x49f2a1['push'](_0x49f2a1['shift']());}};_0x1d0ad3(++_0x2623e0);}(_0x71ab,0x64));var _0xb71a=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x71ab[_0x138adb];return _0x1b27f2;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xb71a('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb71a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb71a('0x2'),'afterDestroy':_0xb71a('0x3')};function emitEvent(_0x20fd9c){return function(_0x4094b2,_0x37ce74,_0x3c6438){UserProfileEvents[_0xb71a('0x4')](_0x20fd9c+':'+_0x4094b2['id'],_0x4094b2);UserProfileEvents[_0xb71a('0x4')](_0x20fd9c,_0x4094b2);_0x3c6438(null);};}for(var e in events){if(events[_0xb71a('0x5')](e)){var event=events[e];UserProfile[_0xb71a('0x6')](e,emitEvent(event));}}module[_0xb71a('0x7')]=UserProfileEvents;
\ No newline at end of file
+var _0xda81=['exports','events','../../mysqldb','UserProfile','save','update','remove','emit','hook'];(function(_0x1e4930,_0x3dd666){var _0x558ac3=function(_0xdacaf5){while(--_0xdacaf5){_0x1e4930['push'](_0x1e4930['shift']());}};_0x558ac3(++_0x3dd666);}(_0xda81,0x1c3));var _0x1da8=function(_0x32d004,_0x36ab76){_0x32d004=_0x32d004-0x0;var _0x45d0eb=_0xda81[_0x32d004];return _0x45d0eb;};'use strict';var EventEmitter=require(_0x1da8('0x0'));var UserProfile=require(_0x1da8('0x1'))['db'][_0x1da8('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1da8('0x3'),'afterUpdate':_0x1da8('0x4'),'afterDestroy':_0x1da8('0x5')};function emitEvent(_0x177870){return function(_0x48421c,_0x3357ac,_0x2692c1){UserProfileEvents['emit'](_0x177870+':'+_0x48421c['id'],_0x48421c);UserProfileEvents[_0x1da8('0x6')](_0x177870,_0x48421c);_0x2692c1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x1da8('0x7')](e,emitEvent(event));}}module[_0x1da8('0x8')]=UserProfileEvents;
\ No newline at end of file
index 7768d70..520b71c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85f9=['ThroughTags','openTabs','true','chat','dataValues','sms','fax','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','value','findAll','then','map','field','name','catch','resolve','associatedResources','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','ChatQueue','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','VoiceExtension','contexts','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','musiconholds','VoiceMusicOnHold','chanspies','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','WhatsappAccount','voicequeues','queuecampaigns','telephones','admin','zendeskaccounts','salesforceaccounts','SalesforceAccount','FreshdeskAccount','SugarcrmAccount','deskaccounts','DeskAccount','ZohoAccount','cannedanswers','CannedAnswer','dispositions','customdashboards','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Variable','plugins','Plugin','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','user_has_','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','query','raw','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','all','ignore','autoAssociation','model','rawAttributes','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','options','reportType','default','DefaultReports','custom','CustomReports','count','rows','customSorting','extraQueryConditions','includeAll','include','Tags','color','tag'];(function(_0x5edafc,_0x22002c){var _0x1fa600=function(_0x5dc143){while(--_0x5dc143){_0x5edafc['push'](_0x5edafc['shift']());}};_0x1fa600(++_0x22002c);}(_0x85f9,0x189));var _0x985f=function(_0x97203f,_0x44ece2){_0x97203f=_0x97203f-0x0;var _0x55965e=_0x85f9[_0x97203f];return _0x55965e;};'use strict';var _=require(_0x985f('0x0'));var attributes=require(_0x985f('0x1'));var squel=require(_0x985f('0x2'));module[_0x985f('0x3')]=function(_0x4eff0a){var _0x40b951=_0x4eff0a[_0x985f('0x4')];function _0x38dd00(_0x58564e,_0x39995d){return new Promise(function(_0x293947,_0xc7bf23){if(!_0x39995d)return _0x293947(null);var _0x87d2ed=_0x39995d['filter']?{[_0x39995d[_0x985f('0x5')]['field']]:_0x39995d['filter'][_0x985f('0x6')]}:undefined;return _0x40b951[_0x58564e][_0x985f('0x7')]({'where':_0x87d2ed,'raw':!![]})[_0x985f('0x8')](function(_0x4efa64){_0x39995d['associatedResources']=_[_0x985f('0x9')](_0x4efa64,'id');_0x293947(_0x39995d);})['catch'](function(_0x459b51){_0xc7bf23(_0x459b51);});});}function _0x30e20a(_0x2db52a,_0xde90e5){return new Promise(function(_0x2dd112,_0x146675){var _0x49d65a=_0x2db52a[_0x985f('0x5')]?{[_0x2db52a['filter'][_0x985f('0xa')]]:_0x2db52a[_0x985f('0x5')][_0x985f('0x6')]}:undefined;return _0x40b951[_0x2db52a['model']][_0x985f('0x7')]({'where':_0x49d65a,'raw':!![]})[_0x985f('0x8')](function(_0x5a0090){_0xde90e5['associatedResources']=_[_0x985f('0x9')](_0x5a0090,function(_0x259a26){return _0x259a26[_0x985f('0xb')];});_0x2dd112(_0xde90e5);})[_0x985f('0xc')](function(_0x16f748){_0x146675(_0x16f748);});});}function _0x43f96b(_0x1043f3,_0x151839,_0x55660f){if(!_0x151839)return Promise[_0x985f('0xd')](null);return new Promise(function(_0x5e16c6,_0x1f96a5){return _0x40b951['UserProfileResource'][_0x985f('0x7')]({'where':{'sectionId':_0x151839['id']},'raw':!![]})[_0x985f('0x8')](function(_0x1423a5){if(_0x1043f3[_0x985f('0xa')]&&_0x1043f3['field']!=='id'){_0x151839[_0x985f('0xe')]=_[_0x985f('0x9')](_0x1423a5,function(_0x4dc0c1){return _0x4dc0c1[_0x1043f3[_0x985f('0xa')]];});}else{if(_0x55660f==='AnalyticExtractedReport'){_0x151839[_0x985f('0xe')]=_[_0x985f('0x9')](_0x1423a5,function(_0x270e19){return{'id':_0x270e19[_0x985f('0xf')],'type':_0x270e19[_0x985f('0x10')]};});}else{_0x151839[_0x985f('0xe')]=_[_0x985f('0x9')](_0x1423a5,function(_0x3276b1){return _0x3276b1[_0x985f('0xf')];});}}_0x5e16c6(_0x151839);})[_0x985f('0xc')](function(_0xb929c8){_0x1f96a5(_0xb929c8);});});}function _0x32b4d1(_0x1355d5,_0x2017bf){var _0x52e364={'parentSections':[]};switch(_0x1355d5[_0x985f('0x11')]()){case _0x985f('0x12'):_0x52e364[_0x985f('0x13')]=_0x985f('0x14');break;case'odbc':_0x52e364['childModel']=_0x985f('0x15');break;case _0x985f('0x16'):_0x52e364[_0x985f('0x13')]=_0x985f('0x17');_0x52e364[_0x985f('0x18')]=[{'name':_0x985f('0x19'),'field':'name','foreignKey':_0x985f('0x1a')}];break;case _0x985f('0x1b'):_0x52e364[_0x985f('0x13')]='JscriptyProject';break;case'contacts':_0x52e364[_0x985f('0x13')]='CmContact';_0x52e364[_0x985f('0x18')]=[{'name':_0x985f('0x1c'),'field':'id','foreignKey':_0x985f('0x1d')}];break;case _0x985f('0x1e'):_0x52e364['childModel']=_0x985f('0x1f');break;case _0x985f('0x20'):_0x52e364[_0x985f('0x13')]=_0x985f('0x21');break;case _0x985f('0x22'):_0x52e364['childModel']='CmCustomField';break;case'chatqueues':_0x52e364[_0x985f('0x13')]=_0x985f('0x23');break;case'chatwebsites':_0x52e364[_0x985f('0x13')]='ChatWebsite';break;case _0x985f('0x24'):_0x52e364['childModel']='FaxQueue';break;case _0x985f('0x25'):_0x52e364['childModel']=_0x985f('0x26');break;case _0x985f('0x27'):case _0x985f('0x28'):case'outboundroutes':_0x52e364[_0x985f('0x13')]=_0x985f('0x29');break;case _0x985f('0x2a'):_0x52e364[_0x985f('0x13')]='VoiceContext';break;case _0x985f('0x2b'):_0x52e364['childModel']=_0x985f('0x2c');break;case _0x985f('0x2d'):_0x52e364[_0x985f('0x13')]=_0x985f('0x2e');_0x52e364[_0x985f('0x18')]=[{'name':_0x985f('0x2f'),'field':_0x985f('0xb'),'foreignKey':_0x985f('0x30'),'model':_0x985f('0x31'),'filter':{'field':_0x985f('0x32'),'value':[_0x985f('0x33')]}},{'name':_0x985f('0x34'),'field':_0x985f('0xb'),'foreignKey':_0x985f('0x30'),'model':'User','filter':{'field':_0x985f('0x32'),'value':[_0x985f('0x35')]}},{'name':_0x985f('0x36'),'field':_0x985f('0xb'),'foreignKey':'queue','model':_0x985f('0x37'),'filter':{'field':_0x985f('0x10'),'value':[_0x985f('0x38')]}},{'name':_0x985f('0x39'),'field':_0x985f('0xb'),'foreignKey':_0x985f('0x3a'),'model':_0x985f('0x37'),'filter':{'field':_0x985f('0x10'),'value':[_0x985f('0x3b')]}}];break;case _0x985f('0x3c'):_0x52e364[_0x985f('0x13')]=_0x985f('0x3d');break;case _0x985f('0x3e'):_0x52e364[_0x985f('0x13')]='VoiceChanSpy';break;case _0x985f('0x3f'):_0x52e364[_0x985f('0x13')]=_0x985f('0x40');break;case'ivrcampaigns':_0x52e364[_0x985f('0x13')]=_0x985f('0x41');break;case _0x985f('0x42'):_0x52e364[_0x985f('0x13')]=_0x985f('0x43');break;case _0x985f('0x44'):_0x52e364[_0x985f('0x13')]=_0x985f('0x45');break;case _0x985f('0x46'):_0x52e364[_0x985f('0x13')]=_0x985f('0x47');break;case'openchannelqueues':_0x52e364['childModel']='OpenchannelQueue';break;case _0x985f('0x48'):_0x52e364[_0x985f('0x13')]=_0x985f('0x49');break;case _0x985f('0x4a'):_0x52e364[_0x985f('0x13')]=_0x985f('0x4b');break;case _0x985f('0x4c'):_0x52e364[_0x985f('0x13')]='SmsAccount';break;case'whatsappqueues':_0x52e364[_0x985f('0x13')]=_0x985f('0x4d');break;case'whatsappaccounts':_0x52e364['childModel']=_0x985f('0x4e');break;case'teams':_0x52e364[_0x985f('0x13')]='Team';break;case _0x985f('0x4f'):case _0x985f('0x50'):_0x52e364[_0x985f('0x13')]=_0x985f('0x37');if(_0x2017bf){_0x52e364[_0x985f('0x18')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case'users':case'agents':case _0x985f('0x51'):_0x52e364[_0x985f('0x13')]=_0x985f('0x31');if(_0x2017bf){_0x52e364[_0x985f('0x18')]=[{'name':'Users','filter':{'field':_0x985f('0x32'),'value':[_0x985f('0x52'),'user']},'ignore':!![]},{'name':_0x985f('0x2f')},{'name':_0x985f('0x34')}];}break;case _0x985f('0x53'):_0x52e364[_0x985f('0x13')]='ZendeskAccount';break;case _0x985f('0x54'):_0x52e364[_0x985f('0x13')]=_0x985f('0x55');break;case'freshdeskaccounts':_0x52e364[_0x985f('0x13')]=_0x985f('0x56');break;case'sugarcrmaccounts':_0x52e364[_0x985f('0x13')]=_0x985f('0x57');break;case _0x985f('0x58'):_0x52e364['childModel']=_0x985f('0x59');break;case'zohoaccounts':_0x52e364[_0x985f('0x13')]=_0x985f('0x5a');break;case'vtigeraccounts':_0x52e364[_0x985f('0x13')]='User';break;case _0x985f('0x5b'):_0x52e364[_0x985f('0x13')]=_0x985f('0x5c');break;case _0x985f('0x5d'):_0x52e364[_0x985f('0x13')]='Disposition';break;case _0x985f('0x5e'):_0x52e364['childModel']=_0x985f('0x5f');break;case _0x985f('0x60'):_0x52e364[_0x985f('0x13')]=_0x985f('0x61');break;case _0x985f('0x62'):_0x52e364[_0x985f('0x13')]=_0x985f('0x63');break;case _0x985f('0x64'):_0x52e364[_0x985f('0x13')]=_0x985f('0x65');break;case _0x985f('0x66'):_0x52e364['childModel']=_0x985f('0x67');break;case _0x985f('0x68'):_0x52e364[_0x985f('0x13')]=_0x985f('0x69');break;case _0x985f('0x6a'):_0x52e364[_0x985f('0x13')]=_0x985f('0x6b');break;case _0x985f('0x6c'):_0x52e364[_0x985f('0x13')]=_0x985f('0x6d');break;case _0x985f('0x6e'):_0x52e364[_0x985f('0x13')]='Trunk';break;case'variables':_0x52e364['childModel']=_0x985f('0x6f');break;case _0x985f('0x70'):_0x52e364[_0x985f('0x13')]=_0x985f('0x71');break;case'extractedreports':_0x52e364['childModel']='AnalyticExtractedReport';_0x52e364['parentSections']=[{'name':_0x985f('0x72'),'field':'id','foreignKey':_0x985f('0x73')}];break;case _0x985f('0x74'):_0x52e364[_0x985f('0x13')]=_0x985f('0x75');break;}return _0x52e364;}function _0x847ab5(_0x1ccc42,_0xa89a68){var _0x54617c=_0x1ccc42[_0x985f('0x76')](0x0)[_0x985f('0x77')]()+_0x1ccc42[_0x985f('0x78')](0x1);var _0x14a46e={'type':_0x40b951['Sequelize'][_0x985f('0x79')][_0x985f('0x7a')],'raw':!![]};return new Promise(function(_0x4ada1b,_0x4355d5){var _0x227e9a=squel[_0x985f('0x7b')]()[_0x985f('0xa')]('ui.'+_0x54617c+_0x985f('0x7c'),'id')['field'](_0x985f('0x7d'))[_0x985f('0x7e')](_0x985f('0x7f')+_0x1ccc42+_0x985f('0x80'),'ui')[_0x985f('0x81')](_0x985f('0x82'),_0xa89a68['id']);return _0x40b951[_0x985f('0x83')]['query'](_0x227e9a[_0x985f('0x84')](),_0x14a46e)[_0x985f('0x8')](function(_0x569bed){_0xa89a68[_0x54617c+_0x985f('0x85')]=_0x569bed;_0x4ada1b(_0x569bed);})[_0x985f('0xc')](function(_0x58861b){_0x4355d5(_0x58861b);});});}return _0x4eff0a[_0x985f('0x86')](_0x985f('0x87'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x15de17){var _0x4745d5=require('../../components/parsers/qs');var _0x31c917={'raw':_0x15de17[_0x985f('0x88')][_0x985f('0x89')],'where':{}};var _0x5c08da={};var _0x1c03fb={'count':0x0,'rows':[]};var _0x3fedab=_0x15de17[_0x985f('0x88')]['section'];var _0x128dac=_0x15de17[_0x985f('0x88')][_0x985f('0x8a')]||![];var _0x27b3c1=_0x32b4d1(_0x3fedab,_0x128dac);if(!_0x27b3c1[_0x985f('0x13')])throw new Error(_0x985f('0x8b')+_0x3fedab+'\x27');var _0x772df0=[{'name':_0x3fedab}];if(!_[_0x985f('0x8c')](_0x27b3c1[_0x985f('0x18')]))_0x772df0=_0x27b3c1[_0x985f('0x18')];var _0xb0ef61=[];for(var _0x43d8b4=0x0;_0x43d8b4<_0x772df0[_0x985f('0x8d')];_0x43d8b4++){_0xb0ef61[_0x985f('0x8e')](_0x40b951[_0x985f('0x8f')][_0x985f('0x90')]({'where':{'userProfileId':_0x15de17[_0x985f('0x91')]['id'],'name':_0x772df0[_0x43d8b4][_0x985f('0xb')]},'raw':!![]}));}return Promise[_0x985f('0x92')](_0xb0ef61)[_0x985f('0x8')](function(_0x5313f6){var _0xf9ebf1=_[_0x985f('0x5')](_0x5313f6,function(_0x1800f3){return _0x1800f3?_0x1800f3:undefined;});var _0x2bf065=_[_0x985f('0x5')](_0x772df0,[_0x985f('0x93'),!![]]);var _0x3409d4=_['isEmpty'](_0xf9ebf1)&&_[_0x985f('0x8c')](_0x2bf065)?null:_['union'](_0x2bf065,_0xf9ebf1);if(!_0x3409d4)return null;var _0x26c938=[];for(var _0x5f34b4=0x0;_0x5f34b4<_0x3409d4['length'];_0x5f34b4++){var _0x1a13b0=_['find'](_0x772df0,function(_0x2755f8){return _0x3409d4[_0x5f34b4]?_0x2755f8[_0x985f('0xb')]===_0x3409d4[_0x5f34b4]['name']:null;});if(_0x1a13b0){if(_0x3409d4[_0x5f34b4][_0x985f('0x93')]){_0x26c938[_0x985f('0x8e')](_0x38dd00(_0x27b3c1['childModel'],_0x3409d4[_0x5f34b4]));}else{if(!_0x3409d4[_0x5f34b4][_0x985f('0x94')]){_0x26c938['push'](_0x43f96b(_0x1a13b0,_0x3409d4[_0x5f34b4],_0x27b3c1[_0x985f('0x13')]));}else{if(_0x1a13b0[_0x985f('0x95')]){_0x26c938[_0x985f('0x8e')](_0x30e20a(_0x1a13b0,_0x3409d4[_0x5f34b4]));}}}}}return Promise[_0x985f('0x92')](_0x26c938);})['then'](function(_0x26d2a1){var _0x25f06c=_0x26d2a1;var _0x4b9456=null;if(_0x25f06c){_0x4b9456=_0x25f06c[_0x985f('0x8d')]===0x1?_0x25f06c[0x0]:null;}if(!_0x4b9456&&!_0x25f06c)return _0x1c03fb;var _0x3f490f=_0x40b951[_0x27b3c1[_0x985f('0x13')]][_0x985f('0x96')];_0x5c08da[_0x985f('0x95')]=_['keys'](_0x3f490f);_0x5c08da[_0x985f('0x88')]=_['keys'](_0x15de17[_0x985f('0x88')]);_0x5c08da[_0x985f('0x97')]=_['intersection'](_0x5c08da[_0x985f('0x95')],_0x5c08da['query']);_0x31c917[_0x985f('0x98')]=_[_0x985f('0x99')](_0x5c08da[_0x985f('0x95')],_0x4745d5[_0x985f('0x9a')](_0x15de17[_0x985f('0x88')][_0x985f('0x9a')]));_0x31c917[_0x985f('0x98')]=_0x31c917[_0x985f('0x98')][_0x985f('0x8d')]?_0x31c917['attributes']:_0x5c08da[_0x985f('0x95')];if(!_0x15de17[_0x985f('0x88')][_0x985f('0x9b')](_0x985f('0x9c'))){_0x31c917[_0x985f('0x9d')]=_0x4745d5[_0x985f('0x9d')](_0x15de17['query'][_0x985f('0x9d')]);_0x31c917[_0x985f('0x9e')]=_0x4745d5['offset'](_0x15de17['query']['offset']);}_0x31c917[_0x985f('0x9f')]=_0x4745d5[_0x985f('0xa0')](_0x15de17[_0x985f('0x88')][_0x985f('0xa0')]);_0x31c917[_0x985f('0x81')]=_0x4745d5[_0x985f('0x97')](_[_0x985f('0xa1')](_0x15de17[_0x985f('0x88')],_0x5c08da['filters']));if(_0x15de17['query']['filter']){_0x31c917[_0x985f('0x81')]=_[_0x985f('0xa2')](_0x31c917[_0x985f('0x81')],{'$or':_['map'](_0x3f490f,function(_0x2a263e){if(_0x2a263e[_0x985f('0x10')][_0x985f('0xa3')]!==_0x985f('0xa4')){var _0x49aab4={};_0x49aab4[_0x2a263e[_0x985f('0xa')]]={'$like':'%'+_0x15de17[_0x985f('0x88')][_0x985f('0x5')]+'%'};return _0x49aab4;}})});}var _0x54dc49=[];var _0x3db0d0=null;var _0x485f4e={};if(_0x4b9456){_0x3db0d0=_[_0x985f('0x90')](_0x772df0,['name',_0x4b9456['name']]);if(_0x3db0d0[_0x985f('0xa')]){_0x485f4e={};if(_0x27b3c1[_0x985f('0x13')]===_0x985f('0xa5')){_0x485f4e[_0x3db0d0[_0x985f('0xa6')]]=_[_0x985f('0x9')](_0x4b9456['associatedResources'],'id');}else{_0x485f4e[_0x3db0d0['foreignKey']]=_0x4b9456[_0x985f('0xe')];}_0x54dc49[_0x985f('0x8e')](_0x485f4e);}else{_0x31c917[_0x985f('0x81')]['id']=_0x4b9456['associatedResources'];}}else{for(var _0x147fcf=0x0;_0x147fcf<_0x25f06c[_0x985f('0x8d')];_0x147fcf++){_0x3db0d0=_['find'](_0x772df0,['name',_0x25f06c[_0x147fcf][_0x985f('0xb')]]);if(_0x3db0d0[_0x985f('0xa')]){_0x485f4e={};_0x485f4e[_0x3db0d0[_0x985f('0xa6')]]=_0x25f06c[_0x147fcf][_0x985f('0xe')];_0x54dc49['push'](_0x485f4e);}else{if(!_0x31c917[_0x985f('0x81')]['id'])_0x31c917['where']['id']=[];_0x25f06c[_0x147fcf][_0x985f('0xe')][_0x985f('0xa7')](function(_0x293c48){_0x31c917['where']['id'][_0x985f('0x8e')](_0x293c48);});}}}if(!_['isEmpty'](_0x54dc49)){_0x31c917[_0x985f('0x81')]=_[_0x985f('0xa2')](_0x31c917[_0x985f('0x81')],{'$and':{'$or':_0x54dc49}});}_0x31c917=_[_0x985f('0xa2')]({},_0x31c917,_0x15de17[_0x985f('0xa8')]);if(_0x4b9456&&!_0x4b9456[_0x985f('0x94')]&&_0x27b3c1[_0x985f('0x13')]===_0x985f('0xa5')){if(_0x15de17[_0x985f('0x88')]['includeAll']){_0x31c917['include']=[{'all':!![]}];}return _0x40b951[_0x27b3c1[_0x985f('0x13')]][_0x985f('0x7')](_0x31c917)[_0x985f('0x8')](function(_0x3b97a9){var _0x35c4de=[];_0x3b97a9[_0x985f('0xa7')](function(_0x26fcec){var _0x594169;switch(_0x26fcec[_0x985f('0xa9')]){case _0x985f('0xaa'):_0x594169=_[_0x985f('0x90')](_0x4b9456['associatedResources'],function(_0x5758f5){return _0x5758f5['id']===_0x26fcec[_0x985f('0x73')]&&_0x5758f5['type']===_0x985f('0xab');});break;case _0x985f('0xac'):_0x594169=_[_0x985f('0x90')](_0x4b9456[_0x985f('0xe')],function(_0x332d88){return _0x332d88['id']===_0x26fcec[_0x985f('0x73')]&&_0x332d88[_0x985f('0x10')]===_0x985f('0xad');});break;}if(_0x594169)_0x35c4de['push'](_0x26fcec);});_0x1c03fb[_0x985f('0xae')]=_0x35c4de[_0x985f('0x8d')];_0x1c03fb[_0x985f('0xaf')]=_0x35c4de;return _0x1c03fb;});}else{if(!_[_0x985f('0x8c')](_0x15de17[_0x985f('0x88')]['ids'])){_0x31c917['where']['id']=_0x31c917[_0x985f('0x81')]['id']?_[_0x985f('0x99')](_0x31c917[_0x985f('0x81')]['id'],_0x15de17[_0x985f('0x88')]['ids']):_0x15de17[_0x985f('0x88')]['ids'];if(_0x15de17[_0x985f('0x88')][_0x985f('0xb0')]){_0x31c917[_0x985f('0x9f')]=_0x15de17[_0x985f('0x88')][_0x985f('0xb0')];}}if(_0x15de17[_0x985f('0x88')][_0x985f('0xb1')]){_0x31c917[_0x985f('0x81')]=_[_0x985f('0xa2')](_0x31c917[_0x985f('0x81')],{'$and':_0x15de17['query'][_0x985f('0xb1')]});}return _0x40b951[_0x27b3c1[_0x985f('0x13')]][_0x985f('0xae')]({'where':_0x31c917['where']})[_0x985f('0x8')](function(_0x41430d){_0x1c03fb[_0x985f('0xae')]=_0x41430d;if(_0x15de17[_0x985f('0x88')][_0x985f('0xb2')]){if(_0x27b3c1['childModel']==='CmContact'){_0x31c917[_0x985f('0xb3')]=[{'model':_0x40b951['Tag'],'as':_0x985f('0xb4'),'attributes':['id','name',_0x985f('0xb5')],'required':_0x15de17[_0x985f('0x88')][_0x985f('0xb6')]?!![]:![]},{'model':_0x40b951[_0x985f('0x69')],'as':_0x985f('0xb7'),'attributes':['id',_0x985f('0xb'),_0x985f('0xb5')],'through':_0x15de17[_0x985f('0x88')][_0x985f('0xb6')]?{'attributes':[],'where':{'TagId':_0x15de17[_0x985f('0x88')][_0x985f('0xb6')]||undefined}}:{},'required':_0x15de17[_0x985f('0x88')][_0x985f('0xb6')]?!![]:![]}];}else{_0x31c917['include']=[{'all':!![]}];}}return _0x40b951[_0x27b3c1['childModel']][_0x985f('0x7')](_0x31c917);})[_0x985f('0x8')](function(_0x45d931){_0x1c03fb[_0x985f('0xaf')]=_0x45d931;if(_0x3fedab===_0x985f('0x2f')&&_0x15de17[_0x985f('0x88')][_0x985f('0xb8')]===_0x985f('0xb9')){var _0x4beb02=[];for(var _0x5dc6de=0x0;_0x5dc6de<_0x1c03fb[_0x985f('0xaf')][_0x985f('0x8d')];_0x5dc6de++){_0x4beb02[_0x985f('0x8e')](_0x847ab5(_0x985f('0xba'),_0x1c03fb['rows'][_0x5dc6de][_0x985f('0xbb')]));_0x4beb02[_0x985f('0x8e')](_0x847ab5(_0x985f('0xbc'),_0x1c03fb['rows'][_0x5dc6de][_0x985f('0xbb')]));_0x4beb02[_0x985f('0x8e')](_0x847ab5(_0x985f('0xbd'),_0x1c03fb['rows'][_0x5dc6de][_0x985f('0xbb')]));_0x4beb02[_0x985f('0x8e')](_0x847ab5('mail',_0x1c03fb[_0x985f('0xaf')][_0x5dc6de][_0x985f('0xbb')]));_0x4beb02[_0x985f('0x8e')](_0x847ab5(_0x985f('0xbe'),_0x1c03fb[_0x985f('0xaf')][_0x5dc6de][_0x985f('0xbb')]));_0x4beb02[_0x985f('0x8e')](_0x847ab5(_0x985f('0xbf'),_0x1c03fb['rows'][_0x5dc6de][_0x985f('0xbb')]));}return Promise['all'](_0x4beb02)['then'](function(){return _0x1c03fb;});}return _0x1c03fb;});}});}}});};
\ No newline at end of file
+var _0x85b5=['map','name','resolve','UserProfileResource','resourceId','type','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','lists','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','VoiceRecording','Agents','agent','Telephones','membername','telephone','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','VoiceQueues','users','User','Users','role','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','cannedanswers','Disposition','customdashboards','Dashboard','intervals','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','SELECT','select','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','define','UserProfile','user_profiles','../../components/parsers/qs','raw','section','isEmpty','length','UserProfileSection','find','params','all','ignore','push','autoAssociation','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','AnalyticExtractedReport','foreignKey','forEach','merge','include','reportType','DefaultReports','CustomReports','count','ids','customSorting','extraQueryConditions','includeAll','color','tag','ThroughTags','rows','true','dataValues','fax','mail','whatsapp','lodash','./userProfile.attributes','squel','exports','models','field','filter','value','findAll','then','catch','model','associatedResources'];(function(_0x16d991,_0x3f07cc){var _0x4f41c3=function(_0x18d679){while(--_0x18d679){_0x16d991['push'](_0x16d991['shift']());}};_0x4f41c3(++_0x3f07cc);}(_0x85b5,0x16d));var _0x585b=function(_0x2a2c14,_0x14c174){_0x2a2c14=_0x2a2c14-0x0;var _0x311239=_0x85b5[_0x2a2c14];return _0x311239;};'use strict';var _=require(_0x585b('0x0'));var attributes=require(_0x585b('0x1'));var squel=require(_0x585b('0x2'));module[_0x585b('0x3')]=function(_0x538449){var _0x1094f2=_0x538449[_0x585b('0x4')];function _0x256b2e(_0x2649f0,_0x1b33b0){return new Promise(function(_0x388f44,_0x3db147){if(!_0x1b33b0)return _0x388f44(null);var _0x55be5d=_0x1b33b0['filter']?{[_0x1b33b0['filter'][_0x585b('0x5')]]:_0x1b33b0[_0x585b('0x6')][_0x585b('0x7')]}:undefined;return _0x1094f2[_0x2649f0][_0x585b('0x8')]({'where':_0x55be5d,'raw':!![]})[_0x585b('0x9')](function(_0x543d4e){_0x1b33b0['associatedResources']=_['map'](_0x543d4e,'id');_0x388f44(_0x1b33b0);})[_0x585b('0xa')](function(_0xdc30a){_0x3db147(_0xdc30a);});});}function _0x4b6778(_0xcf05ec,_0x5c0109){return new Promise(function(_0x58d372,_0x28aeb3){var _0xb4935a=_0xcf05ec['filter']?{[_0xcf05ec[_0x585b('0x6')][_0x585b('0x5')]]:_0xcf05ec[_0x585b('0x6')][_0x585b('0x7')]}:undefined;return _0x1094f2[_0xcf05ec[_0x585b('0xb')]][_0x585b('0x8')]({'where':_0xb4935a,'raw':!![]})[_0x585b('0x9')](function(_0x2fef29){_0x5c0109[_0x585b('0xc')]=_[_0x585b('0xd')](_0x2fef29,function(_0x2d675f){return _0x2d675f[_0x585b('0xe')];});_0x58d372(_0x5c0109);})[_0x585b('0xa')](function(_0x29b843){_0x28aeb3(_0x29b843);});});}function _0x57b635(_0x15dba3,_0x4e85f3,_0x85b9f7){if(!_0x4e85f3)return Promise[_0x585b('0xf')](null);return new Promise(function(_0x5bcf90,_0x421e1e){return _0x1094f2[_0x585b('0x10')][_0x585b('0x8')]({'where':{'sectionId':_0x4e85f3['id']},'raw':!![]})[_0x585b('0x9')](function(_0x2960f3){if(_0x15dba3[_0x585b('0x5')]&&_0x15dba3[_0x585b('0x5')]!=='id'){_0x4e85f3[_0x585b('0xc')]=_[_0x585b('0xd')](_0x2960f3,function(_0xf121c8){return _0xf121c8[_0x15dba3['field']];});}else{if(_0x85b9f7==='AnalyticExtractedReport'){_0x4e85f3[_0x585b('0xc')]=_[_0x585b('0xd')](_0x2960f3,function(_0x1e3733){return{'id':_0x1e3733[_0x585b('0x11')],'type':_0x1e3733[_0x585b('0x12')]};});}else{_0x4e85f3[_0x585b('0xc')]=_[_0x585b('0xd')](_0x2960f3,function(_0x36a1b4){return _0x36a1b4['resourceId'];});}}_0x5bcf90(_0x4e85f3);})['catch'](function(_0x24be0d){_0x421e1e(_0x24be0d);});});}function _0x1def1f(_0x25eb94,_0x53cdca){var _0x9dae10={'parentSections':[]};switch(_0x25eb94['toLowerCase']()){case _0x585b('0x13'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x15');break;case _0x585b('0x16'):_0x9dae10['childModel']=_0x585b('0x17');break;case _0x585b('0x18'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x19');_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x1b'),'field':_0x585b('0xe'),'foreignKey':_0x585b('0x1c')}];break;case _0x585b('0x1d'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x1e');break;case _0x585b('0x1f'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x20');_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x21'),'field':'id','foreignKey':_0x585b('0x22')}];break;case _0x585b('0x23'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x24');break;case _0x585b('0x25'):_0x9dae10[_0x585b('0x14')]='CmCompany';break;case _0x585b('0x26'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x27');break;case _0x585b('0x28'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x29');break;case'chatwebsites':_0x9dae10[_0x585b('0x14')]='ChatWebsite';break;case'faxqueues':_0x9dae10[_0x585b('0x14')]=_0x585b('0x2a');break;case _0x585b('0x2b'):_0x9dae10['childModel']='FaxAccount';break;case _0x585b('0x2c'):case _0x585b('0x2d'):case _0x585b('0x2e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x2f');break;case _0x585b('0x30'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x31');break;case _0x585b('0x32'):_0x9dae10['childModel']=_0x585b('0x33');break;case'voicerecordings':_0x9dae10[_0x585b('0x14')]=_0x585b('0x34');_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x35'),'field':_0x585b('0xe'),'foreignKey':'membername','model':'User','filter':{'field':'role','value':[_0x585b('0x36')]}},{'name':_0x585b('0x37'),'field':'name','foreignKey':_0x585b('0x38'),'model':'User','filter':{'field':'role','value':[_0x585b('0x39')]}},{'name':'VoiceQueues','field':_0x585b('0xe'),'foreignKey':_0x585b('0x3a'),'model':'VoiceQueue','filter':{'field':_0x585b('0x12'),'value':[_0x585b('0x3b')]}},{'name':_0x585b('0x3c'),'field':_0x585b('0xe'),'foreignKey':'queue','model':_0x585b('0x3d'),'filter':{'field':'type','value':[_0x585b('0x3e')]}}];break;case _0x585b('0x3f'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x40');break;case _0x585b('0x41'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x42');break;case'voiceprefixes':_0x9dae10[_0x585b('0x14')]=_0x585b('0x43');break;case _0x585b('0x44'):_0x9dae10[_0x585b('0x14')]='Campaign';break;case'mailqueues':_0x9dae10[_0x585b('0x14')]=_0x585b('0x45');break;case _0x585b('0x46'):_0x9dae10['childModel']=_0x585b('0x47');break;case _0x585b('0x48'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x49');break;case _0x585b('0x4a'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x4b');break;case'openchannelaccounts':_0x9dae10['childModel']=_0x585b('0x4c');break;case'smsqueues':_0x9dae10[_0x585b('0x14')]=_0x585b('0x4d');break;case _0x585b('0x4e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x4f');break;case _0x585b('0x50'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x51');break;case _0x585b('0x52'):_0x9dae10[_0x585b('0x14')]='WhatsappAccount';break;case _0x585b('0x53'):_0x9dae10['childModel']=_0x585b('0x54');break;case _0x585b('0x55'):case _0x585b('0x56'):_0x9dae10['childModel']=_0x585b('0x3d');if(_0x53cdca){_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x57')},{'name':'QueueCampaigns'}];}break;case _0x585b('0x58'):case'agents':case'telephones':_0x9dae10['childModel']=_0x585b('0x59');if(_0x53cdca){_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x5a'),'filter':{'field':_0x585b('0x5b'),'value':[_0x585b('0x5c'),_0x585b('0x5d')]},'ignore':!![]},{'name':_0x585b('0x35')},{'name':_0x585b('0x37')}];}break;case _0x585b('0x5e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x5f');break;case _0x585b('0x60'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x61');break;case _0x585b('0x62'):_0x9dae10[_0x585b('0x14')]='FreshdeskAccount';break;case _0x585b('0x63'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x64');break;case _0x585b('0x65'):_0x9dae10[_0x585b('0x14')]='DeskAccount';break;case _0x585b('0x66'):_0x9dae10[_0x585b('0x14')]='ZohoAccount';break;case'vtigeraccounts':_0x9dae10['childModel']=_0x585b('0x59');break;case _0x585b('0x67'):_0x9dae10[_0x585b('0x14')]='CannedAnswer';break;case'dispositions':_0x9dae10[_0x585b('0x14')]=_0x585b('0x68');break;case _0x585b('0x69'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x6a');break;case _0x585b('0x6b'):_0x9dae10['childModel']='Interval';break;case _0x585b('0x6c'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x6d');break;case _0x585b('0x6e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x6f');break;case'sounds':_0x9dae10['childModel']=_0x585b('0x70');break;case _0x585b('0x71'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x72');break;case'templates':_0x9dae10[_0x585b('0x14')]=_0x585b('0x73');break;case _0x585b('0x74'):_0x9dae10['childModel']=_0x585b('0x75');break;case _0x585b('0x76'):_0x9dae10['childModel']='Trunk';break;case _0x585b('0x77'):_0x9dae10['childModel']=_0x585b('0x78');break;case _0x585b('0x79'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x7a');break;case _0x585b('0x7b'):_0x9dae10[_0x585b('0x14')]='AnalyticExtractedReport';_0x9dae10[_0x585b('0x1a')]=[{'name':_0x585b('0x7c'),'field':'id','foreignKey':_0x585b('0x7d')}];break;case _0x585b('0x7e'):_0x9dae10[_0x585b('0x14')]=_0x585b('0x7f');break;}return _0x9dae10;}function _0x12f55d(_0x7fd662,_0x1ed758){var _0x45f888=_0x7fd662[_0x585b('0x80')](0x0)['toUpperCase']()+_0x7fd662['slice'](0x1);var _0xdd52e5={'type':_0x1094f2['Sequelize']['QueryTypes'][_0x585b('0x81')],'raw':!![]};return new Promise(function(_0x1d817f,_0x41a54d){var _0x32ea7e=squel[_0x585b('0x82')]()[_0x585b('0x5')]('ui.'+_0x45f888+'InteractionId','id')[_0x585b('0x5')](_0x585b('0x83'))[_0x585b('0x84')]('user_has_'+_0x7fd662+_0x585b('0x85'),'ui')[_0x585b('0x86')](_0x585b('0x87'),_0x1ed758['id']);return _0x1094f2[_0x585b('0x88')][_0x585b('0x89')](_0x32ea7e[_0x585b('0x8a')](),_0xdd52e5)[_0x585b('0x9')](function(_0x5a0ea4){_0x1ed758[_0x45f888+'OpenTabs']=_0x5a0ea4;_0x1d817f(_0x5a0ea4);})[_0x585b('0xa')](function(_0x157279){_0x41a54d(_0x157279);});});}return _0x538449[_0x585b('0x8b')](_0x585b('0x8c'),attributes,{'tableName':_0x585b('0x8d'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x301dc4){var _0x239515=require(_0x585b('0x8e'));var _0x502ab5={'raw':_0x301dc4[_0x585b('0x89')][_0x585b('0x8f')],'where':{}};var _0x2cf352={};var _0x17c3d4={'count':0x0,'rows':[]};var _0x265ef8=_0x301dc4[_0x585b('0x89')][_0x585b('0x90')];var _0x745812=_0x301dc4['query']['mergeResources']||![];var _0xc62840=_0x1def1f(_0x265ef8,_0x745812);if(!_0xc62840[_0x585b('0x14')])throw new Error('Invalid\x20section\x20\x27'+_0x265ef8+'\x27');var _0x920ebf=[{'name':_0x265ef8}];if(!_[_0x585b('0x91')](_0xc62840[_0x585b('0x1a')]))_0x920ebf=_0xc62840[_0x585b('0x1a')];var _0x17cdae=[];for(var _0x14eced=0x0;_0x14eced<_0x920ebf[_0x585b('0x92')];_0x14eced++){_0x17cdae['push'](_0x1094f2[_0x585b('0x93')][_0x585b('0x94')]({'where':{'userProfileId':_0x301dc4[_0x585b('0x95')]['id'],'name':_0x920ebf[_0x14eced][_0x585b('0xe')]},'raw':!![]}));}return Promise[_0x585b('0x96')](_0x17cdae)[_0x585b('0x9')](function(_0x28fa38){var _0x49957c=_[_0x585b('0x6')](_0x28fa38,function(_0x3c8a76){return _0x3c8a76?_0x3c8a76:undefined;});var _0x15983c=_[_0x585b('0x6')](_0x920ebf,[_0x585b('0x97'),!![]]);var _0x5e3ebf=_[_0x585b('0x91')](_0x49957c)&&_[_0x585b('0x91')](_0x15983c)?null:_['union'](_0x15983c,_0x49957c);if(!_0x5e3ebf)return null;var _0x227d89=[];for(var _0x51f977=0x0;_0x51f977<_0x5e3ebf[_0x585b('0x92')];_0x51f977++){var _0x45f0a9=_['find'](_0x920ebf,function(_0x1dc9b4){return _0x5e3ebf[_0x51f977]?_0x1dc9b4[_0x585b('0xe')]===_0x5e3ebf[_0x51f977][_0x585b('0xe')]:null;});if(_0x45f0a9){if(_0x5e3ebf[_0x51f977][_0x585b('0x97')]){_0x227d89[_0x585b('0x98')](_0x256b2e(_0xc62840['childModel'],_0x5e3ebf[_0x51f977]));}else{if(!_0x5e3ebf[_0x51f977][_0x585b('0x99')]){_0x227d89[_0x585b('0x98')](_0x57b635(_0x45f0a9,_0x5e3ebf[_0x51f977],_0xc62840['childModel']));}else{if(_0x45f0a9[_0x585b('0xb')]){_0x227d89['push'](_0x4b6778(_0x45f0a9,_0x5e3ebf[_0x51f977]));}}}}}return Promise[_0x585b('0x96')](_0x227d89);})[_0x585b('0x9')](function(_0x4b7674){var _0x4270f9=_0x4b7674;var _0x4b3131=null;if(_0x4270f9){_0x4b3131=_0x4270f9['length']===0x1?_0x4270f9[0x0]:null;}if(!_0x4b3131&&!_0x4270f9)return _0x17c3d4;var _0x1331d1=_0x1094f2[_0xc62840['childModel']]['rawAttributes'];_0x2cf352[_0x585b('0xb')]=_[_0x585b('0x9a')](_0x1331d1);_0x2cf352[_0x585b('0x89')]=_[_0x585b('0x9a')](_0x301dc4[_0x585b('0x89')]);_0x2cf352[_0x585b('0x9b')]=_['intersection'](_0x2cf352[_0x585b('0xb')],_0x2cf352[_0x585b('0x89')]);_0x502ab5[_0x585b('0x9c')]=_[_0x585b('0x9d')](_0x2cf352[_0x585b('0xb')],_0x239515[_0x585b('0x9e')](_0x301dc4[_0x585b('0x89')]['fields']));_0x502ab5[_0x585b('0x9c')]=_0x502ab5['attributes'][_0x585b('0x92')]?_0x502ab5[_0x585b('0x9c')]:_0x2cf352[_0x585b('0xb')];if(!_0x301dc4[_0x585b('0x89')][_0x585b('0x9f')](_0x585b('0xa0'))){_0x502ab5[_0x585b('0xa1')]=_0x239515['limit'](_0x301dc4[_0x585b('0x89')]['limit']);_0x502ab5[_0x585b('0xa2')]=_0x239515[_0x585b('0xa2')](_0x301dc4[_0x585b('0x89')]['offset']);}_0x502ab5[_0x585b('0xa3')]=_0x239515['sort'](_0x301dc4['query'][_0x585b('0xa4')]);_0x502ab5[_0x585b('0x86')]=_0x239515[_0x585b('0x9b')](_[_0x585b('0xa5')](_0x301dc4[_0x585b('0x89')],_0x2cf352[_0x585b('0x9b')]));if(_0x301dc4[_0x585b('0x89')][_0x585b('0x6')]){_0x502ab5[_0x585b('0x86')]=_['merge'](_0x502ab5[_0x585b('0x86')],{'$or':_[_0x585b('0xd')](_0x1331d1,function(_0xc37f78){if(_0xc37f78[_0x585b('0x12')][_0x585b('0xa6')]!=='VIRTUAL'){var _0x42885a={};_0x42885a[_0xc37f78[_0x585b('0x5')]]={'$like':'%'+_0x301dc4['query'][_0x585b('0x6')]+'%'};return _0x42885a;}})});}var _0x394aa2=[];var _0x3fba90=null;var _0x196072={};if(_0x4b3131){_0x3fba90=_[_0x585b('0x94')](_0x920ebf,[_0x585b('0xe'),_0x4b3131[_0x585b('0xe')]]);if(_0x3fba90[_0x585b('0x5')]){_0x196072={};if(_0xc62840['childModel']===_0x585b('0xa7')){_0x196072[_0x3fba90[_0x585b('0xa8')]]=_[_0x585b('0xd')](_0x4b3131[_0x585b('0xc')],'id');}else{_0x196072[_0x3fba90[_0x585b('0xa8')]]=_0x4b3131[_0x585b('0xc')];}_0x394aa2[_0x585b('0x98')](_0x196072);}else{_0x502ab5[_0x585b('0x86')]['id']=_0x4b3131[_0x585b('0xc')];}}else{for(var _0xde8b21=0x0;_0xde8b21<_0x4270f9[_0x585b('0x92')];_0xde8b21++){_0x3fba90=_[_0x585b('0x94')](_0x920ebf,['name',_0x4270f9[_0xde8b21][_0x585b('0xe')]]);if(_0x3fba90[_0x585b('0x5')]){_0x196072={};_0x196072[_0x3fba90[_0x585b('0xa8')]]=_0x4270f9[_0xde8b21][_0x585b('0xc')];_0x394aa2[_0x585b('0x98')](_0x196072);}else{if(!_0x502ab5[_0x585b('0x86')]['id'])_0x502ab5[_0x585b('0x86')]['id']=[];_0x4270f9[_0xde8b21][_0x585b('0xc')][_0x585b('0xa9')](function(_0x4b8f4d){_0x502ab5[_0x585b('0x86')]['id'][_0x585b('0x98')](_0x4b8f4d);});}}}if(!_['isEmpty'](_0x394aa2)){_0x502ab5[_0x585b('0x86')]=_[_0x585b('0xaa')](_0x502ab5[_0x585b('0x86')],{'$and':{'$or':_0x394aa2}});}_0x502ab5=_[_0x585b('0xaa')]({},_0x502ab5,_0x301dc4['options']);if(_0x4b3131&&!_0x4b3131[_0x585b('0x99')]&&_0xc62840['childModel']===_0x585b('0xa7')){if(_0x301dc4[_0x585b('0x89')]['includeAll']){_0x502ab5[_0x585b('0xab')]=[{'all':!![]}];}return _0x1094f2[_0xc62840['childModel']][_0x585b('0x8')](_0x502ab5)['then'](function(_0x53c977){var _0x30efbb=[];_0x53c977[_0x585b('0xa9')](function(_0x3abb50){var _0x20aeed;switch(_0x3abb50[_0x585b('0xac')]){case'default':_0x20aeed=_[_0x585b('0x94')](_0x4b3131[_0x585b('0xc')],function(_0x28bb7a){return _0x28bb7a['id']===_0x3abb50[_0x585b('0x7d')]&&_0x28bb7a['type']===_0x585b('0xad');});break;case'custom':_0x20aeed=_[_0x585b('0x94')](_0x4b3131[_0x585b('0xc')],function(_0x41ae59){return _0x41ae59['id']===_0x3abb50[_0x585b('0x7d')]&&_0x41ae59[_0x585b('0x12')]===_0x585b('0xae');});break;}if(_0x20aeed)_0x30efbb['push'](_0x3abb50);});_0x17c3d4[_0x585b('0xaf')]=_0x30efbb['length'];_0x17c3d4['rows']=_0x30efbb;return _0x17c3d4;});}else{if(!_[_0x585b('0x91')](_0x301dc4[_0x585b('0x89')][_0x585b('0xb0')])){_0x502ab5[_0x585b('0x86')]['id']=_0x502ab5[_0x585b('0x86')]['id']?_[_0x585b('0x9d')](_0x502ab5[_0x585b('0x86')]['id'],_0x301dc4[_0x585b('0x89')][_0x585b('0xb0')]):_0x301dc4[_0x585b('0x89')][_0x585b('0xb0')];if(_0x301dc4[_0x585b('0x89')][_0x585b('0xb1')]){_0x502ab5[_0x585b('0xa3')]=_0x301dc4[_0x585b('0x89')][_0x585b('0xb1')];}}if(_0x301dc4[_0x585b('0x89')][_0x585b('0xb2')]){_0x502ab5[_0x585b('0x86')]=_['merge'](_0x502ab5[_0x585b('0x86')],{'$and':_0x301dc4[_0x585b('0x89')]['extraQueryConditions']});}return _0x1094f2[_0xc62840[_0x585b('0x14')]][_0x585b('0xaf')]({'where':_0x502ab5[_0x585b('0x86')]})['then'](function(_0x31292a){_0x17c3d4[_0x585b('0xaf')]=_0x31292a;if(_0x301dc4['query'][_0x585b('0xb3')]){if(_0xc62840[_0x585b('0x14')]===_0x585b('0x20')){_0x502ab5[_0x585b('0xab')]=[{'model':_0x1094f2[_0x585b('0x72')],'as':'Tags','attributes':['id','name',_0x585b('0xb4')],'required':_0x301dc4['query'][_0x585b('0xb5')]?!![]:![]},{'model':_0x1094f2[_0x585b('0x72')],'as':_0x585b('0xb6'),'attributes':['id',_0x585b('0xe'),_0x585b('0xb4')],'through':_0x301dc4['query'][_0x585b('0xb5')]?{'attributes':[],'where':{'TagId':_0x301dc4[_0x585b('0x89')][_0x585b('0xb5')]||undefined}}:{},'required':_0x301dc4['query'][_0x585b('0xb5')]?!![]:![]}];}else{_0x502ab5[_0x585b('0xab')]=[{'all':!![]}];}}return _0x1094f2[_0xc62840[_0x585b('0x14')]]['findAll'](_0x502ab5);})[_0x585b('0x9')](function(_0x32248c){_0x17c3d4[_0x585b('0xb7')]=_0x32248c;if(_0x265ef8==='Agents'&&_0x301dc4['query']['openTabs']===_0x585b('0xb8')){var _0x1c7ec2=[];for(var _0x289370=0x0;_0x289370<_0x17c3d4[_0x585b('0xb7')]['length'];_0x289370++){_0x1c7ec2[_0x585b('0x98')](_0x12f55d('chat',_0x17c3d4[_0x585b('0xb7')][_0x289370][_0x585b('0xb9')]));_0x1c7ec2[_0x585b('0x98')](_0x12f55d('sms',_0x17c3d4[_0x585b('0xb7')][_0x289370]['dataValues']));_0x1c7ec2[_0x585b('0x98')](_0x12f55d(_0x585b('0xba'),_0x17c3d4[_0x585b('0xb7')][_0x289370][_0x585b('0xb9')]));_0x1c7ec2[_0x585b('0x98')](_0x12f55d(_0x585b('0xbb'),_0x17c3d4[_0x585b('0xb7')][_0x289370][_0x585b('0xb9')]));_0x1c7ec2[_0x585b('0x98')](_0x12f55d('openchannel',_0x17c3d4[_0x585b('0xb7')][_0x289370]['dataValues']));_0x1c7ec2[_0x585b('0x98')](_0x12f55d(_0x585b('0xbc'),_0x17c3d4['rows'][_0x289370][_0x585b('0xb9')]));}return Promise[_0x585b('0x96')](_0x1c7ec2)[_0x585b('0x9')](function(){return _0x17c3d4;});}return _0x17c3d4;});}});}}});};
\ No newline at end of file
index ba3374a..d00e5f9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00cd=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s','stringify','error','message','request\x20sent','catch','lodash','util'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x00cd,0xee));var _0xd00c=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0x00cd[_0x241424];return _0x3da798;};'use strict';var _=require(_0xd00c('0x0'));var util=require(_0xd00c('0x1'));var moment=require(_0xd00c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd00c('0x3'));var db=require(_0xd00c('0x4'))['db'];var utils=require(_0xd00c('0x5'));var logger=require(_0xd00c('0x6'))(_0xd00c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd00c('0x8'));var client=jayson[_0xd00c('0x9')][_0xd00c('0xa')]({'port':0x232a});config[_0xd00c('0xb')]=_[_0xd00c('0xc')](config[_0xd00c('0xb')],{'host':_0xd00c('0xd'),'port':0x18eb});var socket=require(_0xd00c('0xe'))(new Redis(config[_0xd00c('0xb')]));require(_0xd00c('0xf'))['register'](socket);function respondWithRpcPromise(_0x5b6955,_0x462615,_0x267343){return new BPromise(function(_0x3c7e4f,_0x1dee65){return client['request'](_0x5b6955,_0x267343)[_0xd00c('0x10')](function(_0x532556){logger[_0xd00c('0x11')](_0xd00c('0x12'),_0x462615,'request\x20sent');logger['debug']('UserProfile,\x20%s,\x20%s,\x20%s',_0x462615,'request\x20sent',JSON[_0xd00c('0x13')](_0x532556));if(_0x532556[_0xd00c('0x14')]){if(_0x532556[_0xd00c('0x14')]['code']===0x1f4){logger[_0xd00c('0x14')]('UserProfile,\x20%s,\x20%s',_0x462615,_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);return _0x1dee65(_0x532556[_0xd00c('0x14')]['message']);}logger['error'](_0xd00c('0x12'),_0x462615,_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);return _0x3c7e4f(_0x532556[_0xd00c('0x14')][_0xd00c('0x15')]);}else{logger[_0xd00c('0x11')](_0xd00c('0x12'),_0x462615,_0xd00c('0x16'));_0x3c7e4f(_0x532556['result'][_0xd00c('0x15')]);}})[_0xd00c('0x17')](function(_0x110464){logger['error']('UserProfile,\x20%s,\x20%s',_0x462615,_0x110464);_0x1dee65(_0x110464);});});}
\ No newline at end of file
+var _0x2aa3=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','request','info','UserProfile,\x20%s,\x20%s','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x581fe5,_0xf845c){var _0x4982c2=function(_0x242ab4){while(--_0x242ab4){_0x581fe5['push'](_0x581fe5['shift']());}};_0x4982c2(++_0xf845c);}(_0x2aa3,0x83));var _0x32aa=function(_0x2cb275,_0x47332a){_0x2cb275=_0x2cb275-0x0;var _0x46976f=_0x2aa3[_0x2cb275];return _0x46976f;};'use strict';var _=require(_0x32aa('0x0'));var util=require(_0x32aa('0x1'));var moment=require(_0x32aa('0x2'));var BPromise=require(_0x32aa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x32aa('0x4'))['db'];var utils=require(_0x32aa('0x5'));var logger=require(_0x32aa('0x6'))(_0x32aa('0x7'));var config=require(_0x32aa('0x8'));var jayson=require(_0x32aa('0x9'));var client=jayson['client'][_0x32aa('0xa')]({'port':0x232a});config[_0x32aa('0xb')]=_[_0x32aa('0xc')](config[_0x32aa('0xb')],{'host':_0x32aa('0xd'),'port':0x18eb});var socket=require(_0x32aa('0xe'))(new Redis(config[_0x32aa('0xb')]));require(_0x32aa('0xf'))['register'](socket);function respondWithRpcPromise(_0x21bee0,_0x56992d,_0x3d61ee){return new BPromise(function(_0x448505,_0x39f58e){return client[_0x32aa('0x10')](_0x21bee0,_0x3d61ee)['then'](function(_0x339b72){logger[_0x32aa('0x11')](_0x32aa('0x12'),_0x56992d,'request\x20sent');logger[_0x32aa('0x13')](_0x32aa('0x14'),_0x56992d,_0x32aa('0x15'),JSON[_0x32aa('0x16')](_0x339b72));if(_0x339b72[_0x32aa('0x17')]){if(_0x339b72[_0x32aa('0x17')][_0x32aa('0x18')]===0x1f4){logger[_0x32aa('0x17')]('UserProfile,\x20%s,\x20%s',_0x56992d,_0x339b72[_0x32aa('0x17')][_0x32aa('0x19')]);return _0x39f58e(_0x339b72[_0x32aa('0x17')][_0x32aa('0x19')]);}logger[_0x32aa('0x17')]('UserProfile,\x20%s,\x20%s',_0x56992d,_0x339b72[_0x32aa('0x17')][_0x32aa('0x19')]);return _0x448505(_0x339b72[_0x32aa('0x17')][_0x32aa('0x19')]);}else{logger[_0x32aa('0x11')]('UserProfile,\x20%s,\x20%s',_0x56992d,'request\x20sent');_0x448505(_0x339b72[_0x32aa('0x1a')][_0x32aa('0x19')]);}})[_0x32aa('0x1b')](function(_0x52a182){logger['error'](_0x32aa('0x12'),_0x56992d,_0x52a182);_0x39f58e(_0x52a182);});});}
\ No newline at end of file
index 6717c70..8c384df 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb41=['update','length','save','remove'];(function(_0x5011d9,_0x2f98b1){var _0x19b5c4=function(_0x214e7){while(--_0x214e7){_0x5011d9['push'](_0x5011d9['shift']());}};_0x19b5c4(++_0x2f98b1);}(_0xcb41,0xda));var _0x1cb4=function(_0x49fcd2,_0x11a148){_0x49fcd2=_0x49fcd2-0x0;var _0x13a36f=_0xcb41[_0x49fcd2];return _0x13a36f;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x1cb4('0x0'),_0x1cb4('0x1'),_0x1cb4('0x2')];function createListener(_0x3a0a9d,_0x1dc888){return function(_0x1efbdf){_0x1dc888['emit'](_0x3a0a9d,_0x1efbdf);};}function removeListener(_0x70b727,_0x30a3fb){return function(){UserProfileEvents['removeListener'](_0x70b727,_0x30a3fb);};}exports['register']=function(_0x583769){for(var _0xeed625=0x0,_0x462c0b=events[_0x1cb4('0x3')];_0xeed625<_0x462c0b;_0xeed625++){var _0x4cfb2f=events[_0xeed625];var _0x4d6304=createListener('userProfile:'+_0x4cfb2f,_0x583769);UserProfileEvents['on'](_0x4cfb2f,_0x4d6304);}};
\ No newline at end of file
+var _0x7228=['update','emit','length','userProfile:','./userProfile.events','save','remove'];(function(_0x515afd,_0x1a1e91){var _0x536d53=function(_0x1d3a89){while(--_0x1d3a89){_0x515afd['push'](_0x515afd['shift']());}};_0x536d53(++_0x1a1e91);}(_0x7228,0x1d9));var _0x8722=function(_0x268d75,_0x4ea6c2){_0x268d75=_0x268d75-0x0;var _0x2d302c=_0x7228[_0x268d75];return _0x2d302c;};'use strict';var UserProfileEvents=require(_0x8722('0x0'));var events=[_0x8722('0x1'),_0x8722('0x2'),_0x8722('0x3')];function createListener(_0x42ee90,_0x32f31e){return function(_0x532a9b){_0x32f31e[_0x8722('0x4')](_0x42ee90,_0x532a9b);};}function removeListener(_0x5827ef,_0x4764ca){return function(){UserProfileEvents['removeListener'](_0x5827ef,_0x4764ca);};}exports['register']=function(_0x1875b4){for(var _0x20bc95=0x0,_0x472e16=events[_0x8722('0x5')];_0x20bc95<_0x472e16;_0x20bc95++){var _0x5548cf=events[_0x20bc95];var _0x3f65e2=createListener(_0x8722('0x6')+_0x5548cf,_0x1875b4);UserProfileEvents['on'](_0x5548cf,_0x3f65e2);}};
\ No newline at end of file
index c829880..cea9741 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2c1e=['util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileResource.controller','isAuthenticated','index','get','/describe','/:id','show','put','update','delete','destroy','exports'];(function(_0x1072e4,_0x50ebb9){var _0x2248d8=function(_0x56792e){while(--_0x56792e){_0x1072e4['push'](_0x1072e4['shift']());}};_0x2248d8(++_0x50ebb9);}(_0x2c1e,0x118));var _0xe2c1=function(_0x20eb01,_0x59ae21){_0x20eb01=_0x20eb01-0x0;var _0x5c5e37=_0x2c1e[_0x20eb01];return _0x5c5e37;};'use strict';var multer=require('multer');var util=require(_0xe2c1('0x0'));var path=require(_0xe2c1('0x1'));var timeout=require(_0xe2c1('0x2'));var express=require('express');var router=express[_0xe2c1('0x3')]();var fs_extra=require(_0xe2c1('0x4'));var auth=require(_0xe2c1('0x5'));var interaction=require(_0xe2c1('0x6'));var config=require(_0xe2c1('0x7'));var controller=require(_0xe2c1('0x8'));router['get']('/',auth[_0xe2c1('0x9')](),controller[_0xe2c1('0xa')]);router[_0xe2c1('0xb')](_0xe2c1('0xc'),auth[_0xe2c1('0x9')](),controller['describe']);router[_0xe2c1('0xb')](_0xe2c1('0xd'),auth[_0xe2c1('0x9')](),controller[_0xe2c1('0xe')]);router['post']('/',auth[_0xe2c1('0x9')](),controller['create']);router[_0xe2c1('0xf')](_0xe2c1('0xd'),auth[_0xe2c1('0x9')](),controller[_0xe2c1('0x10')]);router[_0xe2c1('0x11')](_0xe2c1('0xd'),auth[_0xe2c1('0x9')](),controller[_0xe2c1('0x12')]);module[_0xe2c1('0x13')]=router;
\ No newline at end of file
+var _0x2a23=['update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe','/:id','put'];(function(_0x1c2482,_0x29e23f){var _0x268ab7=function(_0x200383){while(--_0x200383){_0x1c2482['push'](_0x1c2482['shift']());}};_0x268ab7(++_0x29e23f);}(_0x2a23,0x1be));var _0x32a2=function(_0x40e5ee,_0x494688){_0x40e5ee=_0x40e5ee-0x0;var _0x1d481a=_0x2a23[_0x40e5ee];return _0x1d481a;};'use strict';var multer=require(_0x32a2('0x0'));var util=require(_0x32a2('0x1'));var path=require(_0x32a2('0x2'));var timeout=require(_0x32a2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x32a2('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x32a2('0x5'));router[_0x32a2('0x6')]('/',auth['isAuthenticated'](),controller[_0x32a2('0x7')]);router['get'](_0x32a2('0x8'),auth[_0x32a2('0x9')](),controller[_0x32a2('0xa')]);router[_0x32a2('0x6')](_0x32a2('0xb'),auth[_0x32a2('0x9')](),controller['show']);router['post']('/',auth[_0x32a2('0x9')](),controller['create']);router[_0x32a2('0xc')](_0x32a2('0xb'),auth['isAuthenticated'](),controller[_0x32a2('0xd')]);router[_0x32a2('0xe')](_0x32a2('0xb'),auth[_0x32a2('0x9')](),controller[_0x32a2('0xf')]);module[_0x32a2('0x10')]=router;
\ No newline at end of file
index 35dd65a..19cb0d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x529c=['sequelize','exports','STRING','INTEGER'];(function(_0x8f6a8f,_0x3e69ea){var _0x315317=function(_0x23d4ec){while(--_0x23d4ec){_0x8f6a8f['push'](_0x8f6a8f['shift']());}};_0x315317(++_0x3e69ea);}(_0x529c,0x1d0));var _0xc529=function(_0x12fc35,_0x5703e7){_0x12fc35=_0x12fc35-0x0;var _0x2e8f95=_0x529c[_0x12fc35];return _0x2e8f95;};'use strict';var Sequelize=require(_0xc529('0x0'));module[_0xc529('0x1')]={'name':{'type':Sequelize[_0xc529('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xc529('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc529('0x2')],'allowNull':![]}};
\ No newline at end of file
+var _0x9ee7=['INTEGER','sequelize','STRING'];(function(_0x78da55,_0xd7609f){var _0x238afb=function(_0x4a6339){while(--_0x4a6339){_0x78da55['push'](_0x78da55['shift']());}};_0x238afb(++_0xd7609f);}(_0x9ee7,0x142));var _0x79ee=function(_0x4da19e,_0x2a76fb){_0x4da19e=_0x4da19e-0x0;var _0x4ededc=_0x9ee7[_0x4da19e];return _0x4ededc;};'use strict';var Sequelize=require(_0x79ee('0x0'));module['exports']={'name':{'type':Sequelize[_0x79ee('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x79ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x79ee('0x1')],'allowNull':![]}};
\ No newline at end of file
index 517a813..5e657c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8952=['filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','UserProfileResource','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x8952,0x17e));var _0x2895=function(_0x16ff8f,_0x3623b7){_0x16ff8f=_0x16ff8f-0x0;var _0x18a0ce=_0x8952[_0x16ff8f];return _0x18a0ce;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['UserProfileResource'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));};exports[_0x2895('0x48')]=function(_0x356d35,_0x3c1135){return db[_0x2895('0x26')][_0x2895('0x48')]()[_0x2895('0x21')](respondWithResult(_0x3c1135,null))[_0x2895('0x43')](handleError(_0x3c1135,null));};
\ No newline at end of file
+var _0xafc4=['update','destroy','then','stack','name','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','VIRTUAL','options','UserProfileResource','includeAll','catch','show','params','create','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x116fe8,_0x28d5b6){var _0x5b9f9e=function(_0x34c46c){while(--_0x34c46c){_0x116fe8['push'](_0x116fe8['shift']());}};_0x5b9f9e(++_0x28d5b6);}(_0xafc4,0x69));var _0x4afc=function(_0x4910e1,_0x147dce){_0x4910e1=_0x4910e1-0x0;var _0x4129fb=_0xafc4[_0x4910e1];return _0x4129fb;};'use strict';var emlformat=require(_0x4afc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4afc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4afc('0x2'));var moment=require(_0x4afc('0x3'));var BPromise=require(_0x4afc('0x4'));var Mustache=require(_0x4afc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x4afc('0x6'));var ejs=require(_0x4afc('0x7'));var fs=require('fs');var fs_extra=require(_0x4afc('0x8'));var _=require(_0x4afc('0x9'));var squel=require(_0x4afc('0xa'));var crypto=require(_0x4afc('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4afc('0xc'));var toCsv=require(_0x4afc('0x6'));var querystring=require(_0x4afc('0xd'));var Papa=require(_0x4afc('0xe'));var Redis=require(_0x4afc('0xf'));var authService=require(_0x4afc('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4afc('0x11'));var logger=require('../../config/logger')(_0x4afc('0x12'));var utils=require(_0x4afc('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4afc('0x14'));var db=require(_0x4afc('0x15'))['db'];function respondWithStatusCode(_0x2b191c,_0x2768bf){_0x2768bf=_0x2768bf||0xcc;return function(_0x1d8f98){if(_0x1d8f98){return _0x2b191c[_0x4afc('0x16')](_0x2768bf);}return _0x2b191c[_0x4afc('0x17')](_0x2768bf)[_0x4afc('0x18')]();};}function respondWithResult(_0x5effb4,_0x26f3f1){_0x26f3f1=_0x26f3f1||0xc8;return function(_0x429fd8){if(_0x429fd8){return _0x5effb4[_0x4afc('0x17')](_0x26f3f1)[_0x4afc('0x19')](_0x429fd8);}};}function respondWithFilteredResult(_0x5f2dc9,_0x4e32e8){return function(_0x2452ae){if(_0x2452ae){var _0x4f3127=typeof _0x4e32e8[_0x4afc('0x1a')]===_0x4afc('0x1b')&&typeof _0x4e32e8[_0x4afc('0x1c')]===_0x4afc('0x1b');var _0x3a306f=_0x2452ae[_0x4afc('0x1d')];var _0x22f809=_0x4f3127?0x0:_0x4e32e8[_0x4afc('0x1a')];var _0x16365f=_0x4f3127?_0x2452ae[_0x4afc('0x1d')]:_0x4e32e8[_0x4afc('0x1a')]+_0x4e32e8['limit'];var _0x1a8f49;if(_0x16365f>=_0x3a306f){_0x16365f=_0x3a306f;_0x1a8f49=0xc8;}else{_0x1a8f49=0xce;}_0x5f2dc9[_0x4afc('0x17')](_0x1a8f49);return _0x5f2dc9[_0x4afc('0x1e')](_0x4afc('0x1f'),_0x22f809+'-'+_0x16365f+'/'+_0x3a306f)['json'](_0x2452ae);}return null;};}function patchUpdates(_0x3bddc0){return function(_0x30eda3){try{jsonpatch[_0x4afc('0x20')](_0x30eda3,_0x3bddc0,!![]);}catch(_0x280587){return BPromise[_0x4afc('0x21')](_0x280587);}return _0x30eda3[_0x4afc('0x22')]();};}function saveUpdates(_0x3ad7a5,_0x573a75){return function(_0x5403e4){if(_0x5403e4){return _0x5403e4[_0x4afc('0x23')](_0x3ad7a5)['then'](function(_0x37debf){return _0x37debf;});}return null;};}function removeEntity(_0x4e9a48,_0x1aa676){return function(_0x2a0314){if(_0x2a0314){return _0x2a0314[_0x4afc('0x24')]()[_0x4afc('0x25')](function(){_0x4e9a48[_0x4afc('0x17')](0xcc)[_0x4afc('0x18')]();});}};}function handleEntityNotFound(_0x40a0db,_0x383a71){return function(_0x2bb837){if(!_0x2bb837){_0x40a0db[_0x4afc('0x16')](0x194);}return _0x2bb837;};}function handleError(_0x4e8273,_0x359c07){_0x359c07=_0x359c07||0x1f4;return function(_0x35f5b3){logger['error'](_0x35f5b3[_0x4afc('0x26')]);if(_0x35f5b3[_0x4afc('0x27')]){delete _0x35f5b3[_0x4afc('0x27')];}_0x4e8273['status'](_0x359c07)['send'](_0x35f5b3);};}exports['index']=function(_0x426e9d,_0x5db47e){var _0x5e4747={},_0xd26d2f={},_0x628e42={'count':0x0,'rows':[]};var _0x494fe7=_['map'](db['UserProfileResource'][_0x4afc('0x28')],function(_0x34434a){return{'name':_0x34434a[_0x4afc('0x29')],'type':_0x34434a[_0x4afc('0x2a')][_0x4afc('0x2b')]};});_0xd26d2f[_0x4afc('0x2c')]=_['map'](_0x494fe7,_0x4afc('0x27'));_0xd26d2f[_0x4afc('0x2d')]=_[_0x4afc('0x2e')](_0x426e9d[_0x4afc('0x2d')]);_0xd26d2f[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0xd26d2f[_0x4afc('0x2c')],_0xd26d2f[_0x4afc('0x2d')]);_0x5e4747['attributes']=_[_0x4afc('0x30')](_0xd26d2f['model'],qs['fields'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x5e4747[_0x4afc('0x32')]=_0x5e4747[_0x4afc('0x32')][_0x4afc('0x33')]?_0x5e4747[_0x4afc('0x32')]:_0xd26d2f['model'];if(!_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x34')](_0x4afc('0x35'))){_0x5e4747[_0x4afc('0x1c')]=qs[_0x4afc('0x1c')](_0x426e9d[_0x4afc('0x2d')]['limit']);_0x5e4747[_0x4afc('0x1a')]=qs[_0x4afc('0x1a')](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x1a')]);}_0x5e4747['order']=qs['sort'](_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x36')]);_0x5e4747[_0x4afc('0x37')]=qs['filters'](_['pick'](_0x426e9d[_0x4afc('0x2d')],_0xd26d2f['filters']),_0x494fe7);if(_0x426e9d['query'][_0x4afc('0x38')]){_0x5e4747[_0x4afc('0x37')]=_[_0x4afc('0x39')](_0x5e4747[_0x4afc('0x37')],{'$or':_[_0x4afc('0x3a')](_0x494fe7,function(_0x4420fb){if(_0x4420fb[_0x4afc('0x2a')]!==_0x4afc('0x3b')){var _0x3ccc5a={};_0x3ccc5a[_0x4420fb[_0x4afc('0x27')]]={'$like':'%'+_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x38')]+'%'};return _0x3ccc5a;}})});}_0x5e4747=_[_0x4afc('0x39')]({},_0x5e4747,_0x426e9d[_0x4afc('0x3c')]);var _0x46dd2a={'where':_0x5e4747['where']};return db[_0x4afc('0x3d')][_0x4afc('0x1d')](_0x46dd2a)[_0x4afc('0x25')](function(_0xe6db12){_0x628e42[_0x4afc('0x1d')]=_0xe6db12;if(_0x426e9d[_0x4afc('0x2d')][_0x4afc('0x3e')]){_0x5e4747['include']=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5e4747);})[_0x4afc('0x25')](function(_0x105c03){_0x628e42['rows']=_0x105c03;return _0x628e42;})[_0x4afc('0x25')](respondWithFilteredResult(_0x5db47e,_0x5e4747))[_0x4afc('0x3f')](handleError(_0x5db47e,null));};exports[_0x4afc('0x40')]=function(_0x397996,_0x545109){var _0x12b5db={'raw':![],'where':{'id':_0x397996[_0x4afc('0x41')]['id']}},_0x45c9c3={};_0x45c9c3[_0x4afc('0x2c')]=_[_0x4afc('0x2e')](db[_0x4afc('0x3d')]['rawAttributes']);_0x45c9c3[_0x4afc('0x2d')]=_['keys'](_0x397996[_0x4afc('0x2d')]);_0x45c9c3[_0x4afc('0x2f')]=_[_0x4afc('0x30')](_0x45c9c3['model'],_0x45c9c3['query']);_0x12b5db[_0x4afc('0x32')]=_[_0x4afc('0x30')](_0x45c9c3[_0x4afc('0x2c')],qs[_0x4afc('0x31')](_0x397996[_0x4afc('0x2d')][_0x4afc('0x31')]));_0x12b5db[_0x4afc('0x32')]=_0x12b5db[_0x4afc('0x32')]['length']?_0x12b5db[_0x4afc('0x32')]:_0x45c9c3[_0x4afc('0x2c')];if(_0x397996['query'][_0x4afc('0x3e')]){_0x12b5db['include']=[{'all':!![]}];}_0x12b5db=_[_0x4afc('0x39')]({},_0x12b5db,_0x397996[_0x4afc('0x3c')]);return db[_0x4afc('0x3d')]['find'](_0x12b5db)[_0x4afc('0x25')](handleEntityNotFound(_0x545109,null))[_0x4afc('0x25')](respondWithResult(_0x545109,null))[_0x4afc('0x3f')](handleError(_0x545109,null));};exports[_0x4afc('0x42')]=function(_0x4772db,_0x19a0ac){return db['UserProfileResource']['create'](_0x4772db['body'],{})[_0x4afc('0x25')](respondWithResult(_0x19a0ac,0xc9))[_0x4afc('0x3f')](handleError(_0x19a0ac,null));};exports[_0x4afc('0x23')]=function(_0x269c24,_0xb5cca9){if(_0x269c24[_0x4afc('0x43')]['id']){delete _0x269c24[_0x4afc('0x43')]['id'];}return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x269c24[_0x4afc('0x41')]['id']}})['then'](handleEntityNotFound(_0xb5cca9,null))[_0x4afc('0x25')](saveUpdates(_0x269c24['body'],null))['then'](respondWithResult(_0xb5cca9,null))[_0x4afc('0x3f')](handleError(_0xb5cca9,null));};exports['destroy']=function(_0x428d78,_0x355198){return db[_0x4afc('0x3d')][_0x4afc('0x44')]({'where':{'id':_0x428d78['params']['id']}})[_0x4afc('0x25')](handleEntityNotFound(_0x355198,null))['then'](removeEntity(_0x355198,null))[_0x4afc('0x3f')](handleError(_0x355198,null));};exports[_0x4afc('0x45')]=function(_0x3625c9,_0x387834){return db[_0x4afc('0x3d')][_0x4afc('0x45')]()[_0x4afc('0x25')](respondWithResult(_0x387834,null))[_0x4afc('0x3f')](handleError(_0x387834,null));};
\ No newline at end of file
index 4e63395..01f105f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c21=['sectionId','lodash','util','api','request-promise','path','rimraf','./userProfileResource.attributes','define','UserProfileResource','user_profile_has_resources','resourceId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5c21,0xb5));var _0x15c2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5c21[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x15c2('0x0'));var util=require(_0x15c2('0x1'));var logger=require('../../config/logger')(_0x15c2('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15c2('0x3'));var fs=require('fs');var path=require(_0x15c2('0x4'));var rimraf=require(_0x15c2('0x5'));var config=require('../../config/environment');var attributes=require(_0x15c2('0x6'));module['exports']=function(_0x26e74b,_0x5f4028){return _0x26e74b[_0x15c2('0x7')](_0x15c2('0x8'),attributes,{'tableName':_0x15c2('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x15c2('0xa'),_0x15c2('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xd6d7=['define','compositeIndex','resourceId','sectionId','lodash','moment','bluebird','request-promise','path','rimraf','./userProfileResource.attributes'];(function(_0x17150a,_0x2a08ae){var _0x32451a=function(_0x2458e8){while(--_0x2458e8){_0x17150a['push'](_0x17150a['shift']());}};_0x32451a(++_0x2a08ae);}(_0xd6d7,0x138));var _0x7d6d=function(_0x42df8f,_0x4e5dd2){_0x42df8f=_0x42df8f-0x0;var _0x2af7f3=_0xd6d7[_0x42df8f];return _0x2af7f3;};'use strict';var _=require(_0x7d6d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x7d6d('0x1'));var BPromise=require(_0x7d6d('0x2'));var rp=require(_0x7d6d('0x3'));var fs=require('fs');var path=require(_0x7d6d('0x4'));var rimraf=require(_0x7d6d('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d6d('0x6'));module['exports']=function(_0x20d7a2,_0x1ad50f){return _0x20d7a2[_0x7d6d('0x7')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0x7d6d('0x8'),'fields':[_0x7d6d('0x9'),_0x7d6d('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index 494b300..e5cc0c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc46=['util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x300bc0,_0x2ddf49){var _0x58d99a=function(_0x31729c){while(--_0x31729c){_0x300bc0['push'](_0x300bc0['shift']());}};_0x58d99a(++_0x2ddf49);}(_0xfc46,0x167));var _0x6fc4=function(_0x223c0d,_0x3ec04d){_0x223c0d=_0x223c0d-0x0;var _0x207827=_0xfc46[_0x223c0d];return _0x207827;};'use strict';var _=require(_0x6fc4('0x0'));var util=require(_0x6fc4('0x1'));var moment=require('moment');var BPromise=require(_0x6fc4('0x2'));var rs=require(_0x6fc4('0x3'));var fs=require('fs');var Redis=require(_0x6fc4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6fc4('0x5'));var logger=require('../../config/logger')(_0x6fc4('0x6'));var config=require(_0x6fc4('0x7'));var jayson=require(_0x6fc4('0x8'));var client=jayson[_0x6fc4('0x9')][_0x6fc4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x305785,_0x165feb,_0x408a52){return new BPromise(function(_0x35dfa8,_0x43d66d){return client[_0x6fc4('0xb')](_0x305785,_0x408a52)[_0x6fc4('0xc')](function(_0x55b6d7){logger[_0x6fc4('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x165feb,_0x6fc4('0xe'));logger[_0x6fc4('0xf')](_0x6fc4('0x10'),_0x165feb,_0x6fc4('0xe'),JSON[_0x6fc4('0x11')](_0x55b6d7));if(_0x55b6d7[_0x6fc4('0x12')]){if(_0x55b6d7[_0x6fc4('0x12')][_0x6fc4('0x13')]===0x1f4){logger[_0x6fc4('0x12')](_0x6fc4('0x14'),_0x165feb,_0x55b6d7[_0x6fc4('0x12')]['message']);return _0x43d66d(_0x55b6d7[_0x6fc4('0x12')][_0x6fc4('0x15')]);}logger[_0x6fc4('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x165feb,_0x55b6d7[_0x6fc4('0x12')][_0x6fc4('0x15')]);return _0x35dfa8(_0x55b6d7[_0x6fc4('0x12')][_0x6fc4('0x15')]);}else{logger[_0x6fc4('0xd')](_0x6fc4('0x14'),_0x165feb,_0x6fc4('0xe'));_0x35dfa8(_0x55b6d7[_0x6fc4('0x16')][_0x6fc4('0x15')]);}})[_0x6fc4('0x17')](function(_0x5dd29c){logger[_0x6fc4('0x12')](_0x6fc4('0x14'),_0x165feb,_0x5dd29c);_0x43d66d(_0x5dd29c);});});}
\ No newline at end of file
+var _0x7232=['jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2e10b1,_0x845b82){var _0x41de8b=function(_0x3cad6d){while(--_0x3cad6d){_0x2e10b1['push'](_0x2e10b1['shift']());}};_0x41de8b(++_0x845b82);}(_0x7232,0x151));var _0x2723=function(_0x101ed0,_0x1d4893){_0x101ed0=_0x101ed0-0x0;var _0x26d33c=_0x7232[_0x101ed0];return _0x26d33c;};'use strict';var _=require(_0x2723('0x0'));var util=require(_0x2723('0x1'));var moment=require(_0x2723('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2723('0x3'));var db=require(_0x2723('0x4'))['db'];var utils=require(_0x2723('0x5'));var logger=require(_0x2723('0x6'))('rpc');var config=require(_0x2723('0x7'));var jayson=require(_0x2723('0x8'));var client=jayson['client'][_0x2723('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eafbb,_0x2860c8,_0x300d75){return new BPromise(function(_0x3b1dcb,_0x2950f5){return client[_0x2723('0xa')](_0x2eafbb,_0x300d75)[_0x2723('0xb')](function(_0x506035){logger[_0x2723('0xc')](_0x2723('0xd'),_0x2860c8,_0x2723('0xe'));logger[_0x2723('0xf')](_0x2723('0x10'),_0x2860c8,_0x2723('0xe'),JSON[_0x2723('0x11')](_0x506035));if(_0x506035[_0x2723('0x12')]){if(_0x506035[_0x2723('0x12')][_0x2723('0x13')]===0x1f4){logger[_0x2723('0x12')](_0x2723('0xd'),_0x2860c8,_0x506035[_0x2723('0x12')][_0x2723('0x14')]);return _0x2950f5(_0x506035[_0x2723('0x12')][_0x2723('0x14')]);}logger[_0x2723('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x2860c8,_0x506035[_0x2723('0x12')][_0x2723('0x14')]);return _0x3b1dcb(_0x506035['error']['message']);}else{logger[_0x2723('0xc')](_0x2723('0xd'),_0x2860c8,_0x2723('0xe'));_0x3b1dcb(_0x506035[_0x2723('0x15')][_0x2723('0x14')]);}})[_0x2723('0x16')](function(_0x1b62e1){logger[_0x2723('0x12')](_0x2723('0xd'),_0x2860c8,_0x1b62e1);_0x2950f5(_0x1b62e1);});});}
\ No newline at end of file
index cf0f436..e4371a3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e6=['/describe','isAuthenticated','describe','/:id','post','put','update','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./userProfileSection.controller','get','index'];(function(_0x3acd80,_0x775456){var _0x531860=function(_0x470f4c){while(--_0x470f4c){_0x3acd80['push'](_0x3acd80['shift']());}};_0x531860(++_0x775456);}(_0x70e6,0x19f));var _0x670e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0x70e6[_0x2bf141];return _0x48277b;};'use strict';var multer=require(_0x670e('0x0'));var util=require(_0x670e('0x1'));var path=require(_0x670e('0x2'));var timeout=require(_0x670e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x670e('0x4'));var auth=require(_0x670e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x670e('0x6'));var controller=require(_0x670e('0x7'));router[_0x670e('0x8')]('/',auth['isAuthenticated'](),controller[_0x670e('0x9')]);router[_0x670e('0x8')](_0x670e('0xa'),auth[_0x670e('0xb')](),controller[_0x670e('0xc')]);router[_0x670e('0x8')](_0x670e('0xd'),auth[_0x670e('0xb')](),controller['show']);router[_0x670e('0xe')]('/',auth[_0x670e('0xb')](),controller['create']);router[_0x670e('0xf')](_0x670e('0xd'),auth['isAuthenticated'](),controller[_0x670e('0x10')]);router['delete'](_0x670e('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
+var _0xea9e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','index','/describe','describe','/:id','isAuthenticated','post','create','put','delete','destroy','exports'];(function(_0x719236,_0x3615f8){var _0x3ae92d=function(_0x539f7a){while(--_0x539f7a){_0x719236['push'](_0x719236['shift']());}};_0x3ae92d(++_0x3615f8);}(_0xea9e,0x1a2));var _0xeea9=function(_0x478ff7,_0x771e3a){_0x478ff7=_0x478ff7-0x0;var _0x3d995d=_0xea9e[_0x478ff7];return _0x3d995d;};'use strict';var multer=require(_0xeea9('0x0'));var util=require(_0xeea9('0x1'));var path=require(_0xeea9('0x2'));var timeout=require(_0xeea9('0x3'));var express=require(_0xeea9('0x4'));var router=express[_0xeea9('0x5')]();var fs_extra=require(_0xeea9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xeea9('0x7'));var config=require(_0xeea9('0x8'));var controller=require(_0xeea9('0x9'));router[_0xeea9('0xa')]('/',auth['isAuthenticated'](),controller[_0xeea9('0xb')]);router['get'](_0xeea9('0xc'),auth['isAuthenticated'](),controller[_0xeea9('0xd')]);router[_0xeea9('0xa')](_0xeea9('0xe'),auth[_0xeea9('0xf')](),controller['show']);router[_0xeea9('0x10')]('/',auth[_0xeea9('0xf')](),controller[_0xeea9('0x11')]);router[_0xeea9('0x12')]('/:id',auth[_0xeea9('0xf')](),controller['update']);router[_0xeea9('0x13')](_0xeea9('0xe'),auth['isAuthenticated'](),controller[_0xeea9('0x14')]);module[_0xeea9('0x15')]=router;
\ No newline at end of file
index 733ac8d..2d37bf9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0713=['getDataValue','split','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join'];(function(_0x9298d8,_0x3c9c3d){var _0x1c66f2=function(_0x5d6634){while(--_0x5d6634){_0x9298d8['push'](_0x9298d8['shift']());}};_0x1c66f2(++_0x3c9c3d);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x3071('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x3071('0x1')],'allowNull':![]},'enabled':{'type':Sequelize[_0x3071('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x3071('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x2c547f){this[_0x3071('0x3')](_0x3071('0x4'),_0x2c547f?_0x2c547f[_0x3071('0x5')](''):[]);},'get':function(){return this[_0x3071('0x6')](_0x3071('0x4'))?this[_0x3071('0x6')](_0x3071('0x4'))[_0x3071('0x7')](''):[];}}};
\ No newline at end of file
+var _0x14a0=['INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split','exports','STRING'];(function(_0x325f6a,_0x26d98c){var _0x5a5fd5=function(_0x38b3bb){while(--_0x38b3bb){_0x325f6a['push'](_0x325f6a['shift']());}};_0x5a5fd5(++_0x26d98c);}(_0x14a0,0x8e));var _0x014a=function(_0x1b617a,_0x5ec7ed){_0x1b617a=_0x1b617a-0x0;var _0x3a6d8a=_0x14a0[_0x1b617a];return _0x3a6d8a;};'use strict';var Sequelize=require('sequelize');module[_0x014a('0x0')]={'name':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x014a('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x014a('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x014a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x014a('0x1')],'set':function(_0x521a59){this['setDataValue'](_0x014a('0x4'),_0x521a59?_0x521a59[_0x014a('0x5')](''):[]);},'get':function(){return this[_0x014a('0x6')]('crudPermissions')?this['getDataValue'](_0x014a('0x4'))[_0x014a('0x7')](''):[];}}};
\ No newline at end of file
index 848e6ff..1f311d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x181b=['catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','update','then','destroy','error','name','map','UserProfileSection','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x1ab27b,_0x1c4669){var _0xcbdeeb=function(_0x2b4833){while(--_0x2b4833){_0x1ab27b['push'](_0x1ab27b['shift']());}};_0xcbdeeb(++_0x1c4669);}(_0x181b,0x9d));var _0xb181=function(_0x496f7d,_0x29793c){_0x496f7d=_0x496f7d-0x0;var _0x591ac5=_0x181b[_0x496f7d];return _0x591ac5;};'use strict';var emlformat=require(_0xb181('0x0'));var rimraf=require(_0xb181('0x1'));var zipdir=require(_0xb181('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb181('0x3'));var moment=require(_0xb181('0x4'));var BPromise=require(_0xb181('0x5'));var Mustache=require(_0xb181('0x6'));var util=require(_0xb181('0x7'));var path=require(_0xb181('0x8'));var sox=require('sox');var csv=require(_0xb181('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb181('0xa'));var _=require(_0xb181('0xb'));var squel=require(_0xb181('0xc'));var crypto=require(_0xb181('0xd'));var jsforce=require(_0xb181('0xe'));var deskjs=require(_0xb181('0xf'));var toCsv=require('to-csv');var querystring=require(_0xb181('0x10'));var Papa=require(_0xb181('0x11'));var Redis=require('ioredis');var authService=require(_0xb181('0x12'));var qs=require(_0xb181('0x13'));var as=require(_0xb181('0x14'));var hardwareService=require(_0xb181('0x15'));var logger=require(_0xb181('0x16'))(_0xb181('0x17'));var utils=require(_0xb181('0x18'));var config=require(_0xb181('0x19'));var licenseUtil=require(_0xb181('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x399516,_0x512fca){_0x512fca=_0x512fca||0xcc;return function(_0x2474df){if(_0x2474df){return _0x399516[_0xb181('0x1b')](_0x512fca);}return _0x399516[_0xb181('0x1c')](_0x512fca)['end']();};}function respondWithResult(_0x42c3c7,_0xf16927){_0xf16927=_0xf16927||0xc8;return function(_0x32d1ef){if(_0x32d1ef){return _0x42c3c7[_0xb181('0x1c')](_0xf16927)['json'](_0x32d1ef);}};}function respondWithFilteredResult(_0x500668,_0x30f7d2){return function(_0x3ac612){if(_0x3ac612){var _0x4ce9b7=typeof _0x30f7d2['offset']===_0xb181('0x1d')&&typeof _0x30f7d2['limit']===_0xb181('0x1d');var _0x23dbd1=_0x3ac612['count'];var _0x1b5782=_0x4ce9b7?0x0:_0x30f7d2['offset'];var _0x4daa93=_0x4ce9b7?_0x3ac612[_0xb181('0x1e')]:_0x30f7d2[_0xb181('0x1f')]+_0x30f7d2[_0xb181('0x20')];var _0xef2f93;if(_0x4daa93>=_0x23dbd1){_0x4daa93=_0x23dbd1;_0xef2f93=0xc8;}else{_0xef2f93=0xce;}_0x500668[_0xb181('0x1c')](_0xef2f93);return _0x500668[_0xb181('0x21')](_0xb181('0x22'),_0x1b5782+'-'+_0x4daa93+'/'+_0x23dbd1)[_0xb181('0x23')](_0x3ac612);}return null;};}function patchUpdates(_0x3db314){return function(_0x30e277){try{jsonpatch[_0xb181('0x24')](_0x30e277,_0x3db314,!![]);}catch(_0x213610){return BPromise['reject'](_0x213610);}return _0x30e277['save']();};}function saveUpdates(_0x19a801,_0x2c2e8e){return function(_0x2e0c2a){if(_0x2e0c2a){return _0x2e0c2a[_0xb181('0x25')](_0x19a801)[_0xb181('0x26')](function(_0x15a829){return _0x15a829;});}return null;};}function removeEntity(_0x4efd8d,_0x15ab03){return function(_0x465fbf){if(_0x465fbf){return _0x465fbf[_0xb181('0x27')]()[_0xb181('0x26')](function(){_0x4efd8d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1245eb,_0x4d2a8b){return function(_0x2e72dd){if(!_0x2e72dd){_0x1245eb['sendStatus'](0x194);}return _0x2e72dd;};}function handleError(_0x3d500a,_0x4592ec){_0x4592ec=_0x4592ec||0x1f4;return function(_0x47c8cc){logger[_0xb181('0x28')](_0x47c8cc['stack']);if(_0x47c8cc[_0xb181('0x29')]){delete _0x47c8cc[_0xb181('0x29')];}_0x3d500a[_0xb181('0x1c')](_0x4592ec)['send'](_0x47c8cc);};}exports['index']=function(_0x11f8fc,_0x3be699){var _0x3d0ea7={},_0x94e9b0={},_0x3668e9={'count':0x0,'rows':[]};var _0x48430d=_[_0xb181('0x2a')](db[_0xb181('0x2b')][_0xb181('0x2c')],function(_0x37a737){return{'name':_0x37a737[_0xb181('0x2d')],'type':_0x37a737[_0xb181('0x2e')][_0xb181('0x2f')]};});_0x94e9b0['model']=_[_0xb181('0x2a')](_0x48430d,_0xb181('0x29'));_0x94e9b0[_0xb181('0x30')]=_[_0xb181('0x31')](_0x11f8fc[_0xb181('0x30')]);_0x94e9b0[_0xb181('0x32')]=_[_0xb181('0x33')](_0x94e9b0[_0xb181('0x34')],_0x94e9b0[_0xb181('0x30')]);_0x3d0ea7['attributes']=_[_0xb181('0x33')](_0x94e9b0['model'],qs[_0xb181('0x35')](_0x11f8fc[_0xb181('0x30')][_0xb181('0x35')]));_0x3d0ea7[_0xb181('0x36')]=_0x3d0ea7[_0xb181('0x36')][_0xb181('0x37')]?_0x3d0ea7[_0xb181('0x36')]:_0x94e9b0[_0xb181('0x34')];if(!_0x11f8fc[_0xb181('0x30')]['hasOwnProperty'](_0xb181('0x38'))){_0x3d0ea7[_0xb181('0x20')]=qs[_0xb181('0x20')](_0x11f8fc[_0xb181('0x30')]['limit']);_0x3d0ea7[_0xb181('0x1f')]=qs['offset'](_0x11f8fc[_0xb181('0x30')][_0xb181('0x1f')]);}_0x3d0ea7[_0xb181('0x39')]=qs[_0xb181('0x3a')](_0x11f8fc[_0xb181('0x30')]['sort']);_0x3d0ea7[_0xb181('0x3b')]=qs['filters'](_[_0xb181('0x3c')](_0x11f8fc[_0xb181('0x30')],_0x94e9b0[_0xb181('0x32')]),_0x48430d);if(_0x11f8fc['query'][_0xb181('0x3d')]){_0x3d0ea7[_0xb181('0x3b')]=_[_0xb181('0x3e')](_0x3d0ea7[_0xb181('0x3b')],{'$or':_[_0xb181('0x2a')](_0x48430d,function(_0x414294){if(_0x414294[_0xb181('0x2e')]!==_0xb181('0x3f')){var _0xeec359={};_0xeec359[_0x414294[_0xb181('0x29')]]={'$like':'%'+_0x11f8fc['query'][_0xb181('0x3d')]+'%'};return _0xeec359;}})});}_0x3d0ea7=_[_0xb181('0x3e')]({},_0x3d0ea7,_0x11f8fc[_0xb181('0x40')]);var _0x3a48d8={'where':_0x3d0ea7[_0xb181('0x3b')]};return db['UserProfileSection'][_0xb181('0x1e')](_0x3a48d8)[_0xb181('0x26')](function(_0x30030e){_0x3668e9['count']=_0x30030e;if(_0x11f8fc[_0xb181('0x30')][_0xb181('0x41')]){_0x3d0ea7[_0xb181('0x42')]=[{'all':!![]}];}return db[_0xb181('0x2b')]['findAll'](_0x3d0ea7);})[_0xb181('0x26')](function(_0x3705dc){_0x3668e9[_0xb181('0x43')]=_0x3705dc;return _0x3668e9;})[_0xb181('0x26')](respondWithFilteredResult(_0x3be699,_0x3d0ea7))[_0xb181('0x44')](handleError(_0x3be699,null));};exports[_0xb181('0x45')]=function(_0x2661a5,_0x2b0ef4){var _0x269a35={'raw':![],'where':{'id':_0x2661a5[_0xb181('0x46')]['id']}},_0x58de50={};_0x58de50[_0xb181('0x34')]=_[_0xb181('0x31')](db[_0xb181('0x2b')][_0xb181('0x2c')]);_0x58de50[_0xb181('0x30')]=_[_0xb181('0x31')](_0x2661a5['query']);_0x58de50[_0xb181('0x32')]=_['intersection'](_0x58de50[_0xb181('0x34')],_0x58de50['query']);_0x269a35['attributes']=_['intersection'](_0x58de50[_0xb181('0x34')],qs['fields'](_0x2661a5[_0xb181('0x30')]['fields']));_0x269a35[_0xb181('0x36')]=_0x269a35[_0xb181('0x36')]['length']?_0x269a35[_0xb181('0x36')]:_0x58de50[_0xb181('0x34')];if(_0x2661a5['query']['includeAll']){_0x269a35[_0xb181('0x42')]=[{'all':!![]}];}_0x269a35=_['merge']({},_0x269a35,_0x2661a5[_0xb181('0x40')]);return db['UserProfileSection'][_0xb181('0x47')](_0x269a35)[_0xb181('0x26')](handleEntityNotFound(_0x2b0ef4,null))[_0xb181('0x26')](respondWithResult(_0x2b0ef4,null))['catch'](handleError(_0x2b0ef4,null));};exports[_0xb181('0x48')]=function(_0x7bd4b6,_0x58403f){return db[_0xb181('0x2b')]['create'](_0x7bd4b6[_0xb181('0x49')],{})[_0xb181('0x26')](respondWithResult(_0x58403f,0xc9))[_0xb181('0x44')](handleError(_0x58403f,null));};exports['update']=function(_0x4310b4,_0x208ff9){if(_0x4310b4['body']['id']){delete _0x4310b4[_0xb181('0x49')]['id'];}return db[_0xb181('0x2b')]['find']({'where':{'id':_0x4310b4['params']['id']}})[_0xb181('0x26')](handleEntityNotFound(_0x208ff9,null))['then'](saveUpdates(_0x4310b4[_0xb181('0x49')],null))['then'](respondWithResult(_0x208ff9,null))['catch'](handleError(_0x208ff9,null));};exports['destroy']=function(_0x1d54e0,_0x4685f6){return db['UserProfileSection']['find']({'where':{'id':_0x1d54e0[_0xb181('0x46')]['id']}})['then'](handleEntityNotFound(_0x4685f6,null))[_0xb181('0x26')](removeEntity(_0x4685f6,null))[_0xb181('0x44')](handleError(_0x4685f6,null));};exports[_0xb181('0x4a')]=function(_0x4ca84c,_0x453913){return db[_0xb181('0x2b')]['describe']()[_0xb181('0x26')](respondWithResult(_0x453913,null))[_0xb181('0x44')](handleError(_0x453913,null));};
\ No newline at end of file
+var _0x6030=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','offset','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','intersection','model','query','attributes','fields','length','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','findAll','rows','show','keys','includeAll','catch','body','find','params','describe','eml-format'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x6030,0x1f0));var _0x0603=function(_0x5c2b71,_0x536489){_0x5c2b71=_0x5c2b71-0x0;var _0x327870=_0x6030[_0x5c2b71];return _0x327870;};'use strict';var emlformat=require(_0x0603('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0603('0x1'));var jsonpatch=require(_0x0603('0x2'));var rp=require(_0x0603('0x3'));var moment=require(_0x0603('0x4'));var BPromise=require(_0x0603('0x5'));var Mustache=require(_0x0603('0x6'));var util=require(_0x0603('0x7'));var path=require(_0x0603('0x8'));var sox=require(_0x0603('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0603('0xa'));var _=require('lodash');var squel=require(_0x0603('0xb'));var crypto=require('crypto');var jsforce=require(_0x0603('0xc'));var deskjs=require(_0x0603('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0603('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0603('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x0603('0x10'));var hardwareService=require(_0x0603('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x0603('0x12'));var config=require(_0x0603('0x13'));var licenseUtil=require(_0x0603('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb489dd,_0x5a6539){_0x5a6539=_0x5a6539||0xcc;return function(_0x1dac31){if(_0x1dac31){return _0xb489dd[_0x0603('0x15')](_0x5a6539);}return _0xb489dd['status'](_0x5a6539)[_0x0603('0x16')]();};}function respondWithResult(_0x251d8b,_0x5d411c){_0x5d411c=_0x5d411c||0xc8;return function(_0x5953b4){if(_0x5953b4){return _0x251d8b[_0x0603('0x17')](_0x5d411c)['json'](_0x5953b4);}};}function respondWithFilteredResult(_0x87accd,_0x5cdbf0){return function(_0x1683d4){if(_0x1683d4){var _0x33e17f=typeof _0x5cdbf0[_0x0603('0x18')]==='undefined'&&typeof _0x5cdbf0[_0x0603('0x19')]==='undefined';var _0x1c1cfe=_0x1683d4[_0x0603('0x1a')];var _0x5a8f95=_0x33e17f?0x0:_0x5cdbf0[_0x0603('0x18')];var _0x12f4a8=_0x33e17f?_0x1683d4[_0x0603('0x1a')]:_0x5cdbf0[_0x0603('0x18')]+_0x5cdbf0[_0x0603('0x19')];var _0x4b97d9;if(_0x12f4a8>=_0x1c1cfe){_0x12f4a8=_0x1c1cfe;_0x4b97d9=0xc8;}else{_0x4b97d9=0xce;}_0x87accd['status'](_0x4b97d9);return _0x87accd['set'](_0x0603('0x1b'),_0x5a8f95+'-'+_0x12f4a8+'/'+_0x1c1cfe)[_0x0603('0x1c')](_0x1683d4);}return null;};}function patchUpdates(_0x553e92){return function(_0x56341e){try{jsonpatch[_0x0603('0x1d')](_0x56341e,_0x553e92,!![]);}catch(_0x18d070){return BPromise[_0x0603('0x1e')](_0x18d070);}return _0x56341e[_0x0603('0x1f')]();};}function saveUpdates(_0x13c647,_0xc77313){return function(_0x5d75d7){if(_0x5d75d7){return _0x5d75d7[_0x0603('0x20')](_0x13c647)[_0x0603('0x21')](function(_0x326de6){return _0x326de6;});}return null;};}function removeEntity(_0x457462,_0x3e7364){return function(_0x122757){if(_0x122757){return _0x122757[_0x0603('0x22')]()[_0x0603('0x21')](function(){_0x457462[_0x0603('0x17')](0xcc)[_0x0603('0x16')]();});}};}function handleEntityNotFound(_0x15d5dc,_0x695cde){return function(_0xaf72cf){if(!_0xaf72cf){_0x15d5dc[_0x0603('0x15')](0x194);}return _0xaf72cf;};}function handleError(_0x382f4a,_0x248c75){_0x248c75=_0x248c75||0x1f4;return function(_0xd3d10){logger[_0x0603('0x23')](_0xd3d10[_0x0603('0x24')]);if(_0xd3d10[_0x0603('0x25')]){delete _0xd3d10[_0x0603('0x25')];}_0x382f4a[_0x0603('0x17')](_0x248c75)[_0x0603('0x26')](_0xd3d10);};}exports[_0x0603('0x27')]=function(_0x479654,_0x2a423f){var _0x1c6f5d={},_0x28a503={},_0x1fa14f={'count':0x0,'rows':[]};var _0x71b9a9=_[_0x0603('0x28')](db[_0x0603('0x29')][_0x0603('0x2a')],function(_0x3e4252){return{'name':_0x3e4252[_0x0603('0x2b')],'type':_0x3e4252[_0x0603('0x2c')][_0x0603('0x2d')]};});_0x28a503['model']=_['map'](_0x71b9a9,_0x0603('0x25'));_0x28a503['query']=_['keys'](_0x479654['query']);_0x28a503['filters']=_[_0x0603('0x2e')](_0x28a503[_0x0603('0x2f')],_0x28a503[_0x0603('0x30')]);_0x1c6f5d[_0x0603('0x31')]=_['intersection'](_0x28a503['model'],qs['fields'](_0x479654[_0x0603('0x30')][_0x0603('0x32')]));_0x1c6f5d[_0x0603('0x31')]=_0x1c6f5d[_0x0603('0x31')][_0x0603('0x33')]?_0x1c6f5d[_0x0603('0x31')]:_0x28a503[_0x0603('0x2f')];if(!_0x479654[_0x0603('0x30')]['hasOwnProperty'](_0x0603('0x34'))){_0x1c6f5d[_0x0603('0x19')]=qs[_0x0603('0x19')](_0x479654['query'][_0x0603('0x19')]);_0x1c6f5d[_0x0603('0x18')]=qs[_0x0603('0x18')](_0x479654[_0x0603('0x30')]['offset']);}_0x1c6f5d[_0x0603('0x35')]=qs['sort'](_0x479654[_0x0603('0x30')]['sort']);_0x1c6f5d[_0x0603('0x36')]=qs[_0x0603('0x37')](_[_0x0603('0x38')](_0x479654['query'],_0x28a503[_0x0603('0x37')]),_0x71b9a9);if(_0x479654[_0x0603('0x30')][_0x0603('0x39')]){_0x1c6f5d[_0x0603('0x36')]=_[_0x0603('0x3a')](_0x1c6f5d[_0x0603('0x36')],{'$or':_['map'](_0x71b9a9,function(_0x4e1a49){if(_0x4e1a49[_0x0603('0x2c')]!==_0x0603('0x3b')){var _0x4ece12={};_0x4ece12[_0x4e1a49['name']]={'$like':'%'+_0x479654[_0x0603('0x30')][_0x0603('0x39')]+'%'};return _0x4ece12;}})});}_0x1c6f5d=_['merge']({},_0x1c6f5d,_0x479654[_0x0603('0x3c')]);var _0x5951f5={'where':_0x1c6f5d[_0x0603('0x36')]};return db[_0x0603('0x29')]['count'](_0x5951f5)['then'](function(_0x3d6108){_0x1fa14f[_0x0603('0x1a')]=_0x3d6108;if(_0x479654['query']['includeAll']){_0x1c6f5d['include']=[{'all':!![]}];}return db['UserProfileSection'][_0x0603('0x3d')](_0x1c6f5d);})[_0x0603('0x21')](function(_0x503f27){_0x1fa14f[_0x0603('0x3e')]=_0x503f27;return _0x1fa14f;})[_0x0603('0x21')](respondWithFilteredResult(_0x2a423f,_0x1c6f5d))['catch'](handleError(_0x2a423f,null));};exports[_0x0603('0x3f')]=function(_0x190f6d,_0x15d183){var _0x3b95de={'raw':![],'where':{'id':_0x190f6d['params']['id']}},_0x5d5cc0={};_0x5d5cc0['model']=_[_0x0603('0x40')](db['UserProfileSection'][_0x0603('0x2a')]);_0x5d5cc0[_0x0603('0x30')]=_['keys'](_0x190f6d[_0x0603('0x30')]);_0x5d5cc0[_0x0603('0x37')]=_[_0x0603('0x2e')](_0x5d5cc0[_0x0603('0x2f')],_0x5d5cc0[_0x0603('0x30')]);_0x3b95de[_0x0603('0x31')]=_[_0x0603('0x2e')](_0x5d5cc0[_0x0603('0x2f')],qs['fields'](_0x190f6d[_0x0603('0x30')]['fields']));_0x3b95de[_0x0603('0x31')]=_0x3b95de['attributes']['length']?_0x3b95de[_0x0603('0x31')]:_0x5d5cc0[_0x0603('0x2f')];if(_0x190f6d[_0x0603('0x30')][_0x0603('0x41')]){_0x3b95de['include']=[{'all':!![]}];}_0x3b95de=_[_0x0603('0x3a')]({},_0x3b95de,_0x190f6d[_0x0603('0x3c')]);return db[_0x0603('0x29')]['find'](_0x3b95de)[_0x0603('0x21')](handleEntityNotFound(_0x15d183,null))[_0x0603('0x21')](respondWithResult(_0x15d183,null))[_0x0603('0x42')](handleError(_0x15d183,null));};exports['create']=function(_0x1c3b3e,_0x1c9297){return db[_0x0603('0x29')]['create'](_0x1c3b3e['body'],{})[_0x0603('0x21')](respondWithResult(_0x1c9297,0xc9))['catch'](handleError(_0x1c9297,null));};exports[_0x0603('0x20')]=function(_0x1a372b,_0x372950){if(_0x1a372b[_0x0603('0x43')]['id']){delete _0x1a372b[_0x0603('0x43')]['id'];}return db[_0x0603('0x29')][_0x0603('0x44')]({'where':{'id':_0x1a372b[_0x0603('0x45')]['id']}})[_0x0603('0x21')](handleEntityNotFound(_0x372950,null))[_0x0603('0x21')](saveUpdates(_0x1a372b['body'],null))[_0x0603('0x21')](respondWithResult(_0x372950,null))[_0x0603('0x42')](handleError(_0x372950,null));};exports['destroy']=function(_0x20af69,_0x3dc7a0){return db[_0x0603('0x29')][_0x0603('0x44')]({'where':{'id':_0x20af69[_0x0603('0x45')]['id']}})[_0x0603('0x21')](handleEntityNotFound(_0x3dc7a0,null))[_0x0603('0x21')](removeEntity(_0x3dc7a0,null))['catch'](handleError(_0x3dc7a0,null));};exports[_0x0603('0x46')]=function(_0x3f02be,_0x1efae0){return db['UserProfileSection'][_0x0603('0x46')]()[_0x0603('0x21')](respondWithResult(_0x1efae0,null))[_0x0603('0x42')](handleError(_0x1efae0,null));};
\ No newline at end of file
index 7f894fe..51b8b0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x79b1=['UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0x1d95a7,_0x394f07){var _0x3efbc0=function(_0x5149e6){while(--_0x5149e6){_0x1d95a7['push'](_0x1d95a7['shift']());}};_0x3efbc0(++_0x394f07);}(_0x79b1,0x1f4));var _0x179b=function(_0x473950,_0x478b61){_0x473950=_0x473950-0x0;var _0x556b59=_0x79b1[_0x473950];return _0x556b59;};'use strict';var _=require(_0x179b('0x0'));var util=require(_0x179b('0x1'));var logger=require('../../config/logger')(_0x179b('0x2'));var moment=require(_0x179b('0x3'));var BPromise=require(_0x179b('0x4'));var rp=require(_0x179b('0x5'));var fs=require('fs');var path=require(_0x179b('0x6'));var rimraf=require(_0x179b('0x7'));var config=require(_0x179b('0x8'));var attributes=require(_0x179b('0x9'));module['exports']=function(_0x37b615,_0x23f43b){return _0x37b615['define'](_0x179b('0xa'),attributes,{'tableName':_0x179b('0xb'),'paranoid':![],'indexes':[{'name':_0x179b('0xc'),'fields':[_0x179b('0xd'),_0x179b('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x1537=['util','api','path','rimraf','./userProfileSection.attributes','exports','UserProfileSection','compositeIndex','sectionId','userProfileId','lodash'];(function(_0x46b3af,_0x589b29){var _0x52f73d=function(_0xa53629){while(--_0xa53629){_0x46b3af['push'](_0x46b3af['shift']());}};_0x52f73d(++_0x589b29);}(_0x1537,0x83));var _0x7153=function(_0x375d91,_0x1423ac){_0x375d91=_0x375d91-0x0;var _0x5cb33a=_0x1537[_0x375d91];return _0x5cb33a;};'use strict';var _=require(_0x7153('0x0'));var util=require(_0x7153('0x1'));var logger=require('../../config/logger')(_0x7153('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7153('0x3'));var rimraf=require(_0x7153('0x4'));var config=require('../../config/environment');var attributes=require(_0x7153('0x5'));module[_0x7153('0x6')]=function(_0x19b587,_0x53f3c1){return _0x19b587['define'](_0x7153('0x7'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0x7153('0x8'),'fields':[_0x7153('0x9'),_0x7153('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index d64a85d..120077a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdaea=['http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0xdaea,0x65));var _0xadae=function(_0x919445,_0x5467dc){_0x919445=_0x919445-0x0;var _0x511b3e=_0xdaea[_0x919445];return _0x511b3e;};'use strict';var _=require(_0xadae('0x0'));var util=require(_0xadae('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xadae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadae('0x3'))['db'];var utils=require(_0xadae('0x4'));var logger=require(_0xadae('0x5'))(_0xadae('0x6'));var config=require('../../config/environment');var jayson=require(_0xadae('0x7'));var client=jayson[_0xadae('0x8')][_0xadae('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x255eae,_0x21860c,_0x5826d2){return new BPromise(function(_0x5c1736,_0x58e930){return client['request'](_0x255eae,_0x5826d2)[_0xadae('0xa')](function(_0x6a1b01){logger[_0xadae('0xb')](_0xadae('0xc'),_0x21860c,_0xadae('0xd'));logger[_0xadae('0xe')](_0xadae('0xf'),_0x21860c,'request\x20sent',JSON[_0xadae('0x10')](_0x6a1b01));if(_0x6a1b01[_0xadae('0x11')]){if(_0x6a1b01[_0xadae('0x11')][_0xadae('0x12')]===0x1f4){logger[_0xadae('0x11')](_0xadae('0xc'),_0x21860c,_0x6a1b01[_0xadae('0x11')][_0xadae('0x13')]);return _0x58e930(_0x6a1b01[_0xadae('0x11')][_0xadae('0x13')]);}logger[_0xadae('0x11')](_0xadae('0xc'),_0x21860c,_0x6a1b01[_0xadae('0x11')][_0xadae('0x13')]);return _0x5c1736(_0x6a1b01[_0xadae('0x11')][_0xadae('0x13')]);}else{logger[_0xadae('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x21860c,'request\x20sent');_0x5c1736(_0x6a1b01[_0xadae('0x14')][_0xadae('0x13')]);}})[_0xadae('0x15')](function(_0x1dd8d4){logger[_0xadae('0x11')](_0xadae('0xc'),_0x21860c,_0x1dd8d4);_0x58e930(_0x1dd8d4);});});}
\ No newline at end of file
+var _0xdc00=['debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','UserProfileSection,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdc00,0xfe));var _0x0dc0=function(_0x5da2f6,_0x29e2eb){_0x5da2f6=_0x5da2f6-0x0;var _0x40471b=_0xdc00[_0x5da2f6];return _0x40471b;};'use strict';var _=require(_0x0dc0('0x0'));var util=require('util');var moment=require(_0x0dc0('0x1'));var BPromise=require(_0x0dc0('0x2'));var rs=require(_0x0dc0('0x3'));var fs=require('fs');var Redis=require(_0x0dc0('0x4'));var db=require(_0x0dc0('0x5'))['db'];var utils=require(_0x0dc0('0x6'));var logger=require(_0x0dc0('0x7'))('rpc');var config=require(_0x0dc0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5e0635,_0x2a3756,_0x5f52ff){return new BPromise(function(_0x3085e2,_0x367552){return client['request'](_0x5e0635,_0x5f52ff)[_0x0dc0('0x9')](function(_0x5a38f6){logger['info'](_0x0dc0('0xa'),_0x2a3756,_0x0dc0('0xb'));logger[_0x0dc0('0xc')](_0x0dc0('0xd'),_0x2a3756,_0x0dc0('0xb'),JSON[_0x0dc0('0xe')](_0x5a38f6));if(_0x5a38f6[_0x0dc0('0xf')]){if(_0x5a38f6[_0x0dc0('0xf')][_0x0dc0('0x10')]===0x1f4){logger[_0x0dc0('0xf')](_0x0dc0('0xa'),_0x2a3756,_0x5a38f6[_0x0dc0('0xf')]['message']);return _0x367552(_0x5a38f6[_0x0dc0('0xf')][_0x0dc0('0x11')]);}logger[_0x0dc0('0xf')](_0x0dc0('0xa'),_0x2a3756,_0x5a38f6[_0x0dc0('0xf')][_0x0dc0('0x11')]);return _0x3085e2(_0x5a38f6[_0x0dc0('0xf')]['message']);}else{logger['info'](_0x0dc0('0xa'),_0x2a3756,_0x0dc0('0xb'));_0x3085e2(_0x5a38f6['result'][_0x0dc0('0x11')]);}})[_0x0dc0('0x12')](function(_0x5205b5){logger[_0x0dc0('0xf')](_0x0dc0('0xa'),_0x2a3756,_0x5205b5);_0x367552(_0x5205b5);});});}
\ No newline at end of file
index ff8c48d..b8bb1bb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4b185e,_0x31c299){var _0x558b84=function(_0x5aa4d5){while(--_0x5aa4d5){_0x4b185e['push'](_0x4b185e['shift']());}};_0x558b84(++_0x31c299);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
+var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1213ca,_0x47436f){var _0x29b347=function(_0x446301){while(--_0x446301){_0x1213ca['push'](_0x1213ca['shift']());}};_0x29b347(++_0x47436f);}(_0xe706,0xa3));var _0x6e70=function(_0x336ca2,_0x1a813a){_0x336ca2=_0x336ca2-0x0;var _0xda59a6=_0xe706[_0x336ca2];return _0xda59a6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router;
\ No newline at end of file
index 48d7156..2a782bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb64b=['sequelize','exports','INTEGER'];(function(_0x17f9b5,_0x176018){var _0x445938=function(_0x3154ea){while(--_0x3154ea){_0x17f9b5['push'](_0x17f9b5['shift']());}};_0x445938(++_0x176018);}(_0xb64b,0x11d));var _0xbb64=function(_0x121350,_0x361f4d){_0x121350=_0x121350-0x0;var _0x2e21c7=_0xb64b[_0x121350];return _0x2e21c7;};'use strict';var Sequelize=require(_0xbb64('0x0'));module[_0xbb64('0x1')]={'penalty':{'type':Sequelize[_0xbb64('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xfdab=['exports'];(function(_0x5ee0ee,_0x3ce413){var _0x198093=function(_0x29dcc9){while(--_0x29dcc9){_0x5ee0ee['push'](_0x5ee0ee['shift']());}};_0x198093(++_0x3ce413);}(_0xfdab,0x99));var _0xbfda=function(_0x24942f,_0x475eee){_0x24942f=_0x24942f-0x0;var _0x1f0d95=_0xfdab[_0x24942f];return _0x1f0d95;};'use strict';var Sequelize=require('sequelize');module[_0xbfda('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
index 7a9c8b4..aca51bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x430c=['user_has_sms_queues','lodash','api','moment','bluebird','./userSmsQueue.attributes','exports','UserSmsQueue'];(function(_0x114820,_0x4b68a0){var _0x5103af=function(_0x3fa623){while(--_0x3fa623){_0x114820['push'](_0x114820['shift']());}};_0x5103af(++_0x4b68a0);}(_0x430c,0x1a1));var _0xc430=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x430c[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xc430('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc430('0x1'));var moment=require(_0xc430('0x2'));var BPromise=require(_0xc430('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc430('0x4'));module[_0xc430('0x5')]=function(_0x50b256,_0x42aa9c){return _0x50b256['define'](_0xc430('0x6'),attributes,{'tableName':_0xc430('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xfc46=['api','moment','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger'];(function(_0x14e442,_0x36b1bd){var _0x1385e2=function(_0x2535b5){while(--_0x2535b5){_0x14e442['push'](_0x14e442['shift']());}};_0x1385e2(++_0x36b1bd);}(_0xfc46,0x9a));var _0x6fc4=function(_0x3042c5,_0x36cb88){_0x3042c5=_0x3042c5-0x0;var _0x7cd140=_0xfc46[_0x3042c5];return _0x7cd140;};'use strict';var _=require(_0x6fc4('0x0'));var util=require('util');var logger=require(_0x6fc4('0x1'))(_0x6fc4('0x2'));var moment=require(_0x6fc4('0x3'));var BPromise=require('bluebird');var rp=require(_0x6fc4('0x4'));var fs=require('fs');var path=require(_0x6fc4('0x5'));var rimraf=require(_0x6fc4('0x6'));var config=require(_0x6fc4('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0x6fc4('0x8')]=function(_0xf57aa9,_0x3100a0){return _0xf57aa9[_0x6fc4('0x9')](_0x6fc4('0xa'),attributes,{'tableName':_0x6fc4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index c6e04dc..615ac44 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfff7=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch'];(function(_0x1f79bf,_0x3b1c6){var _0xc73f8b=function(_0x4418b6){while(--_0x4418b6){_0x1f79bf['push'](_0x1f79bf['shift']());}};_0xc73f8b(++_0x3b1c6);}(_0xfff7,0x160));var _0x7fff=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xfff7[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7fff('0x0'));var util=require(_0x7fff('0x1'));var moment=require(_0x7fff('0x2'));var BPromise=require(_0x7fff('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fff('0x4'));var db=require(_0x7fff('0x5'))['db'];var utils=require(_0x7fff('0x6'));var logger=require(_0x7fff('0x7'))(_0x7fff('0x8'));var config=require(_0x7fff('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7fff('0xa')][_0x7fff('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x14db38,_0x4ef21b,_0xea6e4b){return new BPromise(function(_0x25ee62,_0x3b7548){return client[_0x7fff('0xc')](_0x14db38,_0xea6e4b)['then'](function(_0x49e929){logger[_0x7fff('0xd')](_0x7fff('0xe'),_0x4ef21b,_0x7fff('0xf'));logger[_0x7fff('0x10')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x4ef21b,_0x7fff('0xf'),JSON['stringify'](_0x49e929));if(_0x49e929['error']){if(_0x49e929[_0x7fff('0x11')][_0x7fff('0x12')]===0x1f4){logger['error'](_0x7fff('0xe'),_0x4ef21b,_0x49e929[_0x7fff('0x11')][_0x7fff('0x13')]);return _0x3b7548(_0x49e929[_0x7fff('0x11')]['message']);}logger[_0x7fff('0x11')](_0x7fff('0xe'),_0x4ef21b,_0x49e929[_0x7fff('0x11')][_0x7fff('0x13')]);return _0x25ee62(_0x49e929[_0x7fff('0x11')][_0x7fff('0x13')]);}else{logger[_0x7fff('0xd')](_0x7fff('0xe'),_0x4ef21b,_0x7fff('0xf'));_0x25ee62(_0x49e929[_0x7fff('0x14')][_0x7fff('0x13')]);}})[_0x7fff('0x15')](function(_0x15d8fb){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x4ef21b,_0x15d8fb);_0x3b7548(_0x15d8fb);});});}
\ No newline at end of file
+var _0xbe7c=['request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x8ae2ad,_0x5dece2){var _0xf971d3=function(_0x36b2e5){while(--_0x36b2e5){_0x8ae2ad['push'](_0x8ae2ad['shift']());}};_0xf971d3(++_0x5dece2);}(_0xbe7c,0x6e));var _0xcbe7=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xbe7c[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xcbe7('0x0'));var util=require(_0xcbe7('0x1'));var moment=require(_0xcbe7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcbe7('0x3'));var db=require(_0xcbe7('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcbe7('0x5'));var config=require(_0xcbe7('0x6'));var jayson=require(_0xcbe7('0x7'));var client=jayson[_0xcbe7('0x8')][_0xcbe7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xde5a26,_0x149e94,_0x2c337b){return new BPromise(function(_0x4a4683,_0x3af9db){return client['request'](_0xde5a26,_0x2c337b)['then'](function(_0x54e286){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x149e94,_0xcbe7('0xa'));logger[_0xcbe7('0xb')](_0xcbe7('0xc'),_0x149e94,_0xcbe7('0xa'),JSON['stringify'](_0x54e286));if(_0x54e286[_0xcbe7('0xd')]){if(_0x54e286[_0xcbe7('0xd')][_0xcbe7('0xe')]===0x1f4){logger[_0xcbe7('0xd')](_0xcbe7('0xf'),_0x149e94,_0x54e286['error'][_0xcbe7('0x10')]);return _0x3af9db(_0x54e286[_0xcbe7('0xd')][_0xcbe7('0x10')]);}logger[_0xcbe7('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x149e94,_0x54e286[_0xcbe7('0xd')][_0xcbe7('0x10')]);return _0x4a4683(_0x54e286[_0xcbe7('0xd')][_0xcbe7('0x10')]);}else{logger[_0xcbe7('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x149e94,_0xcbe7('0xa'));_0x4a4683(_0x54e286[_0xcbe7('0x12')]['message']);}})[_0xcbe7('0x13')](function(_0x2e99a2){logger[_0xcbe7('0xd')]('UserSmsQueue,\x20%s,\x20%s',_0x149e94,_0x2e99a2);_0x3af9db(_0x2e99a2);});});}
\ No newline at end of file
index 54cda71..c95371f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bd9=['sequelize','INTEGER'];(function(_0x56f2bd,_0x4539b9){var _0x1a3de4=function(_0x2e2629){while(--_0x2e2629){_0x56f2bd['push'](_0x56f2bd['shift']());}};_0x1a3de4(++_0x4539b9);}(_0x2bd9,0xcc));var _0x92bd=function(_0xbff0db,_0x2c4068){_0xbff0db=_0xbff0db-0x0;var _0x3e88ff=_0x2bd9[_0xbff0db];return _0x3e88ff;};'use strict';var Sequelize=require(_0x92bd('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x92bd('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x92bd('0x1')]}};
\ No newline at end of file
+var _0xeb92=['INTEGER','exports'];(function(_0x4fa8e6,_0x1bf738){var _0x5952d4=function(_0x230fcd){while(--_0x230fcd){_0x4fa8e6['push'](_0x4fa8e6['shift']());}};_0x5952d4(++_0x1bf738);}(_0xeb92,0x171));var _0x2eb9=function(_0x5d1bfb,_0x45491b){_0x5d1bfb=_0x5d1bfb-0x0;var _0x1b75c6=_0xeb92[_0x5d1bfb];return _0x1b75c6;};'use strict';var Sequelize=require('sequelize');module[_0x2eb9('0x0')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x2eb9('0x1')]}};
\ No newline at end of file
index 08d01c3..c3af586 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x24ef6e,_0xf2287c){var _0x31df07=function(_0x1db36b){while(--_0x1db36b){_0x24ef6e['push'](_0x24ef6e['shift']());}};_0x31df07(++_0xf2287c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5a7b88,_0x135f20){var _0x409ee4=function(_0x1e7916){while(--_0x1e7916){_0x5a7b88['push'](_0x5a7b88['shift']());}};_0x409ee4(++_0x135f20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 2934fbc..ed232fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1fa387,_0x40e45f){var _0x2f0101=function(_0x55e833){while(--_0x55e833){_0x1fa387['push'](_0x1fa387['shift']());}};_0x2f0101(++_0x40e45f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
+var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x20c7e2,_0x540664){var _0x30d9d6=function(_0x29b8c2){while(--_0x29b8c2){_0x20c7e2['push'](_0x20c7e2['shift']());}};_0x30d9d6(++_0x540664);}(_0x70e0,0x17b));var _0x070e=function(_0x550604,_0xb6d1b2){_0x550604=_0x550604-0x0;var _0x324c54=_0x70e0[_0x550604];return _0x324c54;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
index 5994e13..547e36c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cc6=['exports','INTEGER','sequelize'];(function(_0x132916,_0x14b31b){var _0x3280a4=function(_0x597bae){while(--_0x597bae){_0x132916['push'](_0x132916['shift']());}};_0x3280a4(++_0x14b31b);}(_0x4cc6,0x164));var _0x64cc=function(_0x13ce0c,_0x3f2a0d){_0x13ce0c=_0x13ce0c-0x0;var _0x4388fb=_0x4cc6[_0x13ce0c];return _0x4388fb;};'use strict';var Sequelize=require(_0x64cc('0x0'));module[_0x64cc('0x1')]={'penalty':{'type':Sequelize[_0x64cc('0x2')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x2ba0=['exports','INTEGER','sequelize'];(function(_0xe82c72,_0x18330d){var _0x2ec30f=function(_0x244424){while(--_0x244424){_0xe82c72['push'](_0xe82c72['shift']());}};_0x2ec30f(++_0x18330d);}(_0x2ba0,0x152));var _0x02ba=function(_0xfc6e7c,_0x4bfc18){_0xfc6e7c=_0xfc6e7c-0x0;var _0x56fa4e=_0x2ba0[_0xfc6e7c];return _0x56fa4e;};'use strict';var Sequelize=require(_0x02ba('0x0'));module[_0x02ba('0x1')]={'penalty':{'type':Sequelize[_0x02ba('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index 5d68280..b7c9701 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb084=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','util'];(function(_0x55c9ad,_0x4e8a15){var _0x3fc198=function(_0x1042ba){while(--_0x1042ba){_0x55c9ad['push'](_0x55c9ad['shift']());}};_0x3fc198(++_0x4e8a15);}(_0xb084,0x74));var _0x4b08=function(_0xa46ccc,_0x20ce0a){_0xa46ccc=_0xa46ccc-0x0;var _0x19565c=_0xb084[_0xa46ccc];return _0x19565c;};'use strict';var _=require('lodash');var util=require(_0x4b08('0x0'));var logger=require('../../config/logger')(_0x4b08('0x1'));var moment=require(_0x4b08('0x2'));var BPromise=require(_0x4b08('0x3'));var rp=require(_0x4b08('0x4'));var fs=require('fs');var path=require(_0x4b08('0x5'));var rimraf=require(_0x4b08('0x6'));var config=require(_0x4b08('0x7'));var attributes=require(_0x4b08('0x8'));module[_0x4b08('0x9')]=function(_0x4d15d7,_0x456a0d){return _0x4d15d7[_0x4b08('0xa')](_0x4b08('0xb'),attributes,{'tableName':_0x4b08('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9594=['request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','../../config/logger','moment','bluebird'];(function(_0x365143,_0x46fd86){var _0x45bb49=function(_0x20bb4b){while(--_0x20bb4b){_0x365143['push'](_0x365143['shift']());}};_0x45bb49(++_0x46fd86);}(_0x9594,0xd9));var _0x4959=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x9594[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4959('0x0'))('api');var moment=require(_0x4959('0x1'));var BPromise=require(_0x4959('0x2'));var rp=require(_0x4959('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4959('0x4'));var config=require(_0x4959('0x5'));var attributes=require(_0x4959('0x6'));module[_0x4959('0x7')]=function(_0x5e5586,_0xec929a){return _0x5e5586[_0x4959('0x8')](_0x4959('0x9'),attributes,{'tableName':_0x4959('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index a84e6e8..fda626e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f13=['info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x306a2d,_0x53f9a9){var _0x1718f5=function(_0x1e3632){while(--_0x1e3632){_0x306a2d['push'](_0x306a2d['shift']());}};_0x1718f5(++_0x53f9a9);}(_0x8f13,0x183));var _0x38f1=function(_0x581960,_0x1232ff){_0x581960=_0x581960-0x0;var _0x4ee892=_0x8f13[_0x581960];return _0x4ee892;};'use strict';var _=require(_0x38f1('0x0'));var util=require('util');var moment=require(_0x38f1('0x1'));var BPromise=require(_0x38f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x38f1('0x3'));var db=require(_0x38f1('0x4'))['db'];var utils=require(_0x38f1('0x5'));var logger=require(_0x38f1('0x6'))(_0x38f1('0x7'));var config=require(_0x38f1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x38f1('0x9')][_0x38f1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x218a4c,_0x4c96e6,_0x3e2bc8){return new BPromise(function(_0x142070,_0x2b7657){return client[_0x38f1('0xb')](_0x218a4c,_0x3e2bc8)[_0x38f1('0xc')](function(_0x4e6aee){logger['info'](_0x38f1('0xd'),_0x4c96e6,_0x38f1('0xe'));logger[_0x38f1('0xf')](_0x38f1('0x10'),_0x4c96e6,_0x38f1('0xe'),JSON[_0x38f1('0x11')](_0x4e6aee));if(_0x4e6aee['error']){if(_0x4e6aee[_0x38f1('0x12')][_0x38f1('0x13')]===0x1f4){logger['error'](_0x38f1('0xd'),_0x4c96e6,_0x4e6aee['error']['message']);return _0x2b7657(_0x4e6aee[_0x38f1('0x12')][_0x38f1('0x14')]);}logger[_0x38f1('0x12')](_0x38f1('0xd'),_0x4c96e6,_0x4e6aee[_0x38f1('0x12')]['message']);return _0x142070(_0x4e6aee[_0x38f1('0x12')][_0x38f1('0x14')]);}else{logger[_0x38f1('0x15')](_0x38f1('0xd'),_0x4c96e6,'request\x20sent');_0x142070(_0x4e6aee[_0x38f1('0x16')][_0x38f1('0x14')]);}})[_0x38f1('0x17')](function(_0x59c2bd){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4c96e6,_0x59c2bd);_0x2b7657(_0x59c2bd);});});}
\ No newline at end of file
+var _0x383c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','moment','randomstring'];(function(_0x2226b3,_0x1f954f){var _0x568171=function(_0x548933){while(--_0x548933){_0x2226b3['push'](_0x2226b3['shift']());}};_0x568171(++_0x1f954f);}(_0x383c,0x11e));var _0xc383=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x383c[_0x819464];return _0x49dcc0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc383('0x0'));var BPromise=require('bluebird');var rs=require(_0xc383('0x1'));var fs=require('fs');var Redis=require(_0xc383('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xc383('0x3'));var logger=require(_0xc383('0x4'))(_0xc383('0x5'));var config=require(_0xc383('0x6'));var jayson=require(_0xc383('0x7'));var client=jayson[_0xc383('0x8')][_0xc383('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59a6ef,_0x3de4ec,_0x4356a9){return new BPromise(function(_0x43815a,_0x3b3445){return client['request'](_0x59a6ef,_0x4356a9)[_0xc383('0xa')](function(_0x1a857c){logger[_0xc383('0xb')](_0xc383('0xc'),_0x3de4ec,_0xc383('0xd'));logger['debug'](_0xc383('0xe'),_0x3de4ec,_0xc383('0xd'),JSON[_0xc383('0xf')](_0x1a857c));if(_0x1a857c[_0xc383('0x10')]){if(_0x1a857c[_0xc383('0x10')]['code']===0x1f4){logger[_0xc383('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x3de4ec,_0x1a857c[_0xc383('0x10')][_0xc383('0x11')]);return _0x3b3445(_0x1a857c['error'][_0xc383('0x11')]);}logger['error'](_0xc383('0xc'),_0x3de4ec,_0x1a857c[_0xc383('0x10')][_0xc383('0x11')]);return _0x43815a(_0x1a857c[_0xc383('0x10')][_0xc383('0x11')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3de4ec,_0xc383('0xd'));_0x43815a(_0x1a857c['result']['message']);}})['catch'](function(_0x1f61be){logger[_0xc383('0x10')](_0xc383('0xc'),_0x3de4ec,_0x1f61be);_0x3b3445(_0x1f61be);});});}
\ No newline at end of file
index b10044d..934a712 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x59c1be,_0xba160a){var _0x47c031=function(_0xb62b0b){while(--_0xb62b0b){_0x59c1be['push'](_0x59c1be['shift']());}};_0x47c031(++_0xba160a);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router;
\ No newline at end of file
+var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x236a8d,_0x2e9b1d){var _0x212efe=function(_0xe70882){while(--_0xe70882){_0x236a8d['push'](_0x236a8d['shift']());}};_0x212efe(++_0x2e9b1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router;
\ No newline at end of file
index cb35427..fe6f494 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a48=['sequelize','exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x42a096,_0x1ac905){var _0x1ba638=function(_0x132cdc){while(--_0x132cdc){_0x42a096['push'](_0x42a096['shift']());}};_0x1ba638(++_0x1ac905);}(_0x8a48,0x132));var _0x88a4=function(_0x250c4a,_0x5b19a8){_0x250c4a=_0x250c4a-0x0;var _0x3ba7fd=_0x8a48[_0x250c4a];return _0x3ba7fd;};'use strict';var Sequelize=require(_0x88a4('0x0'));module[_0x88a4('0x1')]={'uniqueid':{'type':Sequelize[_0x88a4('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x88a4('0x3')},'membername':{'type':Sequelize[_0x88a4('0x4')],'allowNull':![],'comment':_0x88a4('0x3')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x88a4('0x5'),'comment':_0x88a4('0x3')},'VoiceQueueId':{'type':Sequelize[_0x88a4('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x88a4('0x4')],'allowNull':![],'unique':_0x88a4('0x5'),'comment':_0x88a4('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x88a4('0x3')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x88a4('0x3')}};
\ No newline at end of file
+var _0xc60e=['STRING','INTEGER','queue_interface','sequelize','exports','Required\x20by\x20Asterisk'];(function(_0x3248f9,_0x4aff42){var _0x274acc=function(_0x33181c){while(--_0x33181c){_0x3248f9['push'](_0x3248f9['shift']());}};_0x274acc(++_0x4aff42);}(_0xc60e,0x153));var _0xec60=function(_0x66b521,_0x277a00){_0x66b521=_0x66b521-0x0;var _0x196262=_0xc60e[_0x66b521];return _0x196262;};'use strict';var Sequelize=require(_0xec60('0x0'));module[_0xec60('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xec60('0x2')},'membername':{'type':Sequelize[_0xec60('0x3')],'allowNull':![],'comment':_0xec60('0x2')},'UserId':{'type':Sequelize[_0xec60('0x4')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xec60('0x3')],'allowNull':![],'unique':_0xec60('0x5'),'comment':_0xec60('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xec60('0x3')],'allowNull':![],'unique':'queue_interface','comment':_0xec60('0x2')},'penalty':{'type':Sequelize[_0xec60('0x4')](0xb),'defaultValue':0x0,'comment':_0xec60('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}};
\ No newline at end of file
index c3e4ac9..4b052bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcec2=['exports','../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook'];(function(_0x1c9d68,_0x2b8617){var _0x113209=function(_0xc82192){while(--_0xc82192){_0x1c9d68['push'](_0x1c9d68['shift']());}};_0x113209(++_0x2b8617);}(_0xcec2,0xa2));var _0x2cec=function(_0x284b5d,_0x17cf9e){_0x284b5d=_0x284b5d-0x0;var _0x15505e=_0xcec2[_0x284b5d];return _0x15505e;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x2cec('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x2cec('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2cec('0x2'),'afterDestroy':'remove'};function emitEvent(_0xda82e2){return function(_0x355bdd,_0x41b9b8,_0x495065){UserVoiceQueueRtEvents['emit'](_0xda82e2+':'+_0x355bdd['id'],_0x355bdd);UserVoiceQueueRtEvents[_0x2cec('0x3')](_0xda82e2,_0x355bdd);_0x495065(null);};}for(var e in events){if(events[_0x2cec('0x4')](e)){var event=events[e];UserVoiceQueueRt[_0x2cec('0x5')](e,emitEvent(event));}}module[_0x2cec('0x6')]=UserVoiceQueueRtEvents;
\ No newline at end of file
+var _0xc58a=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc58a,0x130));var _0xac58=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xc58a[_0x5a2285];return _0x48f6ed;};'use strict';var EventEmitter=require(_0xac58('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xac58('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xac58('0x2')](0x0);var events={'afterCreate':_0xac58('0x3'),'afterUpdate':_0xac58('0x4'),'afterDestroy':_0xac58('0x5')};function emitEvent(_0x1bde2f){return function(_0x32d4a2,_0x35670d,_0x5087be){UserVoiceQueueRtEvents[_0xac58('0x6')](_0x1bde2f+':'+_0x32d4a2['id'],_0x32d4a2);UserVoiceQueueRtEvents[_0xac58('0x6')](_0x1bde2f,_0x32d4a2);_0x5087be(null);};}for(var e in events){if(events[_0xac58('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xac58('0x8')]=UserVoiceQueueRtEvents;
\ No newline at end of file
index 80c10af..8813091 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe054=['rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','util','../../config/logger','api','moment','bluebird','path'];(function(_0x148b50,_0x2398e8){var _0xadd92e=function(_0x59d026){while(--_0x59d026){_0x148b50['push'](_0x148b50['shift']());}};_0xadd92e(++_0x2398e8);}(_0xe054,0x1d3));var _0x4e05=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0xe054[_0x4a04de];return _0xbbe018;};'use strict';var _=require('lodash');var util=require(_0x4e05('0x0'));var logger=require(_0x4e05('0x1'))(_0x4e05('0x2'));var moment=require(_0x4e05('0x3'));var BPromise=require(_0x4e05('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e05('0x5'));var rimraf=require(_0x4e05('0x6'));var config=require(_0x4e05('0x7'));var attributes=require(_0x4e05('0x8'));module[_0x4e05('0x9')]=function(_0xf07386,_0x3f9cd9){return _0xf07386[_0x4e05('0xa')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3a9b=['user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x3a9b,0x1dd));var _0xb3a9=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x3a9b[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0xb3a9('0x0'));var util=require(_0xb3a9('0x1'));var logger=require(_0xb3a9('0x2'))(_0xb3a9('0x3'));var moment=require(_0xb3a9('0x4'));var BPromise=require(_0xb3a9('0x5'));var rp=require(_0xb3a9('0x6'));var fs=require('fs');var path=require(_0xb3a9('0x7'));var rimraf=require(_0xb3a9('0x8'));var config=require(_0xb3a9('0x9'));var attributes=require(_0xb3a9('0xa'));module[_0xb3a9('0xb')]=function(_0x292161,_0x1abeff){return _0x292161[_0xb3a9('0xc')]('UserVoiceQueueRt',attributes,{'tableName':_0xb3a9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index fa7f2d4..fa5171d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc46a=['debug','stringify','error','code','message','info','catch','UserVoiceQueueRt','findAll','options','COUNT','sequelize','literal','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent'];(function(_0x3c5fbc,_0xb62ed2){var _0x55dbe4=function(_0x198e89){while(--_0x198e89){_0x3c5fbc['push'](_0x3c5fbc['shift']());}};_0x55dbe4(++_0xb62ed2);}(_0xc46a,0x75));var _0xac46=function(_0x3eee78,_0x5acc63){_0x3eee78=_0x3eee78-0x0;var _0x53a5e5=_0xc46a[_0x3eee78];return _0x53a5e5;};'use strict';var _=require(_0xac46('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xac46('0x1'));var fs=require('fs');var Redis=require(_0xac46('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xac46('0x3'));var logger=require(_0xac46('0x4'))(_0xac46('0x5'));var config=require(_0xac46('0x6'));var jayson=require(_0xac46('0x7'));var client=jayson['client'][_0xac46('0x8')]({'port':0x232a});config[_0xac46('0x9')]=_[_0xac46('0xa')](config[_0xac46('0x9')],{'host':_0xac46('0xb'),'port':0x18eb});var socket=require(_0xac46('0xc'))(new Redis(config['redis']));require(_0xac46('0xd'))[_0xac46('0xe')](socket);function respondWithRpcPromise(_0x5e8f45,_0x296b79,_0x2cfff5){return new BPromise(function(_0x492f5c,_0x4dd14d){return client[_0xac46('0xf')](_0x5e8f45,_0x2cfff5)[_0xac46('0x10')](function(_0x34b7c3){logger['info'](_0xac46('0x11'),_0x296b79,_0xac46('0x12'));logger[_0xac46('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x296b79,_0xac46('0x12'),JSON[_0xac46('0x14')](_0x34b7c3));if(_0x34b7c3[_0xac46('0x15')]){if(_0x34b7c3['error'][_0xac46('0x16')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x296b79,_0x34b7c3[_0xac46('0x15')]['message']);return _0x4dd14d(_0x34b7c3[_0xac46('0x15')][_0xac46('0x17')]);}logger[_0xac46('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x296b79,_0x34b7c3['error']['message']);return _0x492f5c(_0x34b7c3[_0xac46('0x15')]['message']);}else{logger[_0xac46('0x18')](_0xac46('0x11'),_0x296b79,'request\x20sent');_0x492f5c(_0x34b7c3['result'][_0xac46('0x17')]);}})[_0xac46('0x19')](function(_0x4fce76){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x296b79,_0x4fce76);_0x4dd14d(_0x4fce76);});});}exports['GetVoiceQueueRtPauses']=function(_0x42f41e){var _0x22a1cb=this;return new Promise(function(_0x3adf4e,_0x4a6271){return db[_0xac46('0x1a')][_0xac46('0x1b')]({'raw':_0x42f41e[_0xac46('0x1c')]?_0x42f41e[_0xac46('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x42f41e[_0xac46('0x1c')]?_0x42f41e[_0xac46('0x1c')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xac46('0x1d'),db[_0xac46('0x1e')]['fn']('IF',db[_0xac46('0x1e')][_0xac46('0x1f')]('`paused`\x20=\x201,\x201,\x20null'))),_0xac46('0x20')]]})[_0xac46('0x10')](function(_0x7d4008){logger[_0xac46('0x18')](_0xac46('0x21'),_0x42f41e);logger[_0xac46('0x13')]('GetVoiceQueueRtPauses',_0x42f41e,JSON['stringify'](_0x7d4008));_0x3adf4e(_0x7d4008);})[_0xac46('0x19')](function(_0xd2bcfd){logger[_0xac46('0x15')](_0xac46('0x21'),_0xd2bcfd[_0xac46('0x17')],_0x42f41e);_0x4a6271(_0x22a1cb['error'](0x1f4,_0xd2bcfd[_0xac46('0x17')]));});});};
\ No newline at end of file
+var _0x6aa1=['error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2ef503,_0x42bb13){var _0x5eb25e=function(_0x5025d0){while(--_0x5025d0){_0x2ef503['push'](_0x2ef503['shift']());}};_0x5eb25e(++_0x42bb13);}(_0x6aa1,0x113));var _0x16aa=function(_0x1a0f70,_0x4ac8d3){_0x1a0f70=_0x1a0f70-0x0;var _0xb761d4=_0x6aa1[_0x1a0f70];return _0xb761d4;};'use strict';var _=require(_0x16aa('0x0'));var util=require('util');var moment=require(_0x16aa('0x1'));var BPromise=require(_0x16aa('0x2'));var rs=require(_0x16aa('0x3'));var fs=require('fs');var Redis=require(_0x16aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x16aa('0x5'))(_0x16aa('0x6'));var config=require(_0x16aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x16aa('0x8')][_0x16aa('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x16aa('0xa')],{'host':_0x16aa('0xb'),'port':0x18eb});var socket=require(_0x16aa('0xc'))(new Redis(config[_0x16aa('0xa')]));require('./userVoiceQueueRt.socket')[_0x16aa('0xd')](socket);function respondWithRpcPromise(_0x1f0365,_0x7331e2,_0x443fdd){return new BPromise(function(_0x4c1db3,_0xa7335d){return client[_0x16aa('0xe')](_0x1f0365,_0x443fdd)['then'](function(_0x27644d){logger[_0x16aa('0xf')](_0x16aa('0x10'),_0x7331e2,_0x16aa('0x11'));logger[_0x16aa('0x12')](_0x16aa('0x13'),_0x7331e2,_0x16aa('0x11'),JSON[_0x16aa('0x14')](_0x27644d));if(_0x27644d['error']){if(_0x27644d[_0x16aa('0x15')][_0x16aa('0x16')]===0x1f4){logger[_0x16aa('0x15')](_0x16aa('0x10'),_0x7331e2,_0x27644d[_0x16aa('0x15')][_0x16aa('0x17')]);return _0xa7335d(_0x27644d[_0x16aa('0x15')][_0x16aa('0x17')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x7331e2,_0x27644d[_0x16aa('0x15')]['message']);return _0x4c1db3(_0x27644d['error'][_0x16aa('0x17')]);}else{logger[_0x16aa('0xf')](_0x16aa('0x10'),_0x7331e2,_0x16aa('0x11'));_0x4c1db3(_0x27644d[_0x16aa('0x18')][_0x16aa('0x17')]);}})[_0x16aa('0x19')](function(_0x514130){logger[_0x16aa('0x15')](_0x16aa('0x10'),_0x7331e2,_0x514130);_0xa7335d(_0x514130);});});}exports['GetVoiceQueueRtPauses']=function(_0x5223a4){var _0x267d1f=this;return new Promise(function(_0x750f1,_0x3f8c2e){return db[_0x16aa('0x1a')][_0x16aa('0x1b')]({'raw':_0x5223a4['options']?_0x5223a4[_0x16aa('0x1c')][_0x16aa('0x1d')]===undefined?!![]:![]:!![],'where':_0x5223a4[_0x16aa('0x1c')]?_0x5223a4[_0x16aa('0x1c')][_0x16aa('0x1e')]||null:null,'attributes':[[db[_0x16aa('0x1f')]['fn'](_0x16aa('0x20'),db[_0x16aa('0x1f')]['fn']('IF',db[_0x16aa('0x1f')][_0x16aa('0x21')](_0x16aa('0x22')))),_0x16aa('0x23')]]})['then'](function(_0x50016a){logger[_0x16aa('0xf')](_0x16aa('0x24'),_0x5223a4);logger['debug']('GetVoiceQueueRtPauses',_0x5223a4,JSON[_0x16aa('0x14')](_0x50016a));_0x750f1(_0x50016a);})[_0x16aa('0x19')](function(_0x20f993){logger[_0x16aa('0x15')](_0x16aa('0x24'),_0x20f993[_0x16aa('0x17')],_0x5223a4);_0x3f8c2e(_0x267d1f[_0x16aa('0x15')](0x1f4,_0x20f993['message']));});});};
\ No newline at end of file
index 92907bc..311db47 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf1c6=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update'];(function(_0x12b89f,_0xb1f64d){var _0x30e0ab=function(_0x394d67){while(--_0x394d67){_0x12b89f['push'](_0x12b89f['shift']());}};_0x30e0ab(++_0xb1f64d);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x30bd6f,_0x2d95aa){_0x30bd6f=_0x30bd6f-0x0;var _0x2e0cd7=_0xf1c6[_0x30bd6f];return _0x2e0cd7;};'use strict';var UserVoiceQueueRtEvents=require(_0x6f1c('0x0'));var events=[_0x6f1c('0x1'),_0x6f1c('0x2'),_0x6f1c('0x3')];function createListener(_0x381044,_0x17a05a){return function(_0x15b146){_0x17a05a['emit'](_0x381044,_0x15b146);};}function removeListener(_0x3747f8,_0x2c875e){return function(){UserVoiceQueueRtEvents[_0x6f1c('0x4')](_0x3747f8,_0x2c875e);};}exports[_0x6f1c('0x5')]=function(_0x4fd3fc){for(var _0x57bb67=0x0,_0x1a3460=events[_0x6f1c('0x6')];_0x57bb67<_0x1a3460;_0x57bb67++){var _0x3f7b30=events[_0x57bb67];var _0x2efcb5=createListener(_0x6f1c('0x7')+_0x3f7b30,_0x4fd3fc);UserVoiceQueueRtEvents['on'](_0x3f7b30,_0x2efcb5);}};
\ No newline at end of file
+var _0xd1f9=['emit','removeListener','length','userVoiceQueueRt:','remove','update'];(function(_0x517b4f,_0x497bcf){var _0x2293e2=function(_0x45c4db){while(--_0x45c4db){_0x517b4f['push'](_0x517b4f['shift']());}};_0x2293e2(++_0x497bcf);}(_0xd1f9,0x88));var _0x9d1f=function(_0xc2869e,_0x105457){_0xc2869e=_0xc2869e-0x0;var _0x243be2=_0xd1f9[_0xc2869e];return _0x243be2;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=['save',_0x9d1f('0x0'),_0x9d1f('0x1')];function createListener(_0x3ebd6f,_0x1b7dcf){return function(_0x2814e4){_0x1b7dcf[_0x9d1f('0x2')](_0x3ebd6f,_0x2814e4);};}function removeListener(_0x283b14,_0xf56850){return function(){UserVoiceQueueRtEvents[_0x9d1f('0x3')](_0x283b14,_0xf56850);};}exports['register']=function(_0x3c4bad){for(var _0x1a72d8=0x0,_0x2c146b=events[_0x9d1f('0x4')];_0x1a72d8<_0x2c146b;_0x1a72d8++){var _0x10ce17=events[_0x1a72d8];var _0x270b08=createListener(_0x9d1f('0x5')+_0x10ce17,_0x3c4bad);UserVoiceQueueRtEvents['on'](_0x10ce17,_0x270b08);}};
\ No newline at end of file
index 9063aa9..df4f01c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xd765f7,_0x5718ff){var _0x4df907=function(_0x32f5da){while(--_0x32f5da){_0xd765f7['push'](_0xd765f7['shift']());}};_0x4df907(++_0x5718ff);}(_0x70e0,0x17b));var _0x070e=function(_0x46bdda,_0x3f0d9f){_0x46bdda=_0x46bdda-0x0;var _0x4a7a67=_0x70e0[_0x46bdda];return _0x4a7a67;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router;
\ No newline at end of file
+var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1001f4,_0x289af5){var _0x3c1a28=function(_0x5f2e8b){while(--_0x5f2e8b){_0x1001f4['push'](_0x1001f4['shift']());}};_0x3c1a28(++_0x289af5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router;
\ No newline at end of file
index 8e5080d..f21dcde 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x76ed=['sequelize','exports'];(function(_0x4eb269,_0x3cd1b6){var _0x1597b8=function(_0x527f9d){while(--_0x527f9d){_0x4eb269['push'](_0x4eb269['shift']());}};_0x1597b8(++_0x3cd1b6);}(_0x76ed,0x1d0));var _0xd76e=function(_0xacb6de,_0x1d3b55){_0xacb6de=_0xacb6de-0x0;var _0x1fb762=_0x76ed[_0xacb6de];return _0x1fb762;};'use strict';var Sequelize=require(_0xd76e('0x0'));module[_0xd76e('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}};
\ No newline at end of file
+var _0xc7d0=['INTEGER','sequelize','exports'];(function(_0x400a56,_0x46746c){var _0x24cbba=function(_0x2d170e){while(--_0x2d170e){_0x400a56['push'](_0x400a56['shift']());}};_0x24cbba(++_0x46746c);}(_0xc7d0,0x130));var _0x0c7d=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc7d0[_0x42cae2];return _0x5f256f;};'use strict';var Sequelize=require(_0x0c7d('0x0'));module[_0x0c7d('0x1')]={'penalty':{'type':Sequelize[_0x0c7d('0x2')],'defaultValue':0x0}};
\ No newline at end of file
index 8248d8c..dfdbdd6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2408=['lodash','util','../../config/logger','api','bluebird','path','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2408,0x1f4));var _0x8240=function(_0x1dd897,_0x2c825e){_0x1dd897=_0x1dd897-0x0;var _0x18667d=_0x2408[_0x1dd897];return _0x18667d;};'use strict';var _=require(_0x8240('0x0'));var util=require(_0x8240('0x1'));var logger=require(_0x8240('0x2'))(_0x8240('0x3'));var moment=require('moment');var BPromise=require(_0x8240('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8240('0x5'));var rimraf=require('rimraf');var config=require(_0x8240('0x6'));var attributes=require(_0x8240('0x7'));module['exports']=function(_0x553ce3,_0x4121ce){return _0x553ce3[_0x8240('0x8')](_0x8240('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x1acc=['api','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','user_has_whatsapp_queues','lodash'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0x1acc,0x182));var _0xc1ac=function(_0x4e3494,_0x59824e){_0x4e3494=_0x4e3494-0x0;var _0xabe05d=_0x1acc[_0x4e3494];return _0xabe05d;};'use strict';var _=require(_0xc1ac('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc1ac('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc1ac('0x2'));var fs=require('fs');var path=require(_0xc1ac('0x3'));var rimraf=require(_0xc1ac('0x4'));var config=require(_0xc1ac('0x5'));var attributes=require(_0xc1ac('0x6'));module['exports']=function(_0x432fc1,_0x1cbe62){return _0x432fc1[_0xc1ac('0x7')]('UserWhatsappQueue',attributes,{'tableName':_0xc1ac('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 8bce413..7d89b0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfc36=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x184c04,_0x3579ff){var _0x2a91d6=function(_0x515868){while(--_0x515868){_0x184c04['push'](_0x184c04['shift']());}};_0x2a91d6(++_0x3579ff);}(_0xfc36,0x1c7));var _0x6fc3=function(_0x271e6b,_0x4162bb){_0x271e6b=_0x271e6b-0x0;var _0x93ac6f=_0xfc36[_0x271e6b];return _0x93ac6f;};'use strict';var _=require('lodash');var util=require(_0x6fc3('0x0'));var moment=require(_0x6fc3('0x1'));var BPromise=require(_0x6fc3('0x2'));var rs=require(_0x6fc3('0x3'));var fs=require('fs');var Redis=require(_0x6fc3('0x4'));var db=require(_0x6fc3('0x5'))['db'];var utils=require(_0x6fc3('0x6'));var logger=require(_0x6fc3('0x7'))(_0x6fc3('0x8'));var config=require(_0x6fc3('0x9'));var jayson=require(_0x6fc3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a7bf0,_0x4590a1,_0x97153e){return new BPromise(function(_0x19b941,_0x5bdb6f){return client[_0x6fc3('0xb')](_0x1a7bf0,_0x97153e)[_0x6fc3('0xc')](function(_0x507f1e){logger[_0x6fc3('0xd')](_0x6fc3('0xe'),_0x4590a1,_0x6fc3('0xf'));logger[_0x6fc3('0x10')](_0x6fc3('0x11'),_0x4590a1,'request\x20sent',JSON[_0x6fc3('0x12')](_0x507f1e));if(_0x507f1e[_0x6fc3('0x13')]){if(_0x507f1e[_0x6fc3('0x13')][_0x6fc3('0x14')]===0x1f4){logger[_0x6fc3('0x13')](_0x6fc3('0xe'),_0x4590a1,_0x507f1e[_0x6fc3('0x13')][_0x6fc3('0x15')]);return _0x5bdb6f(_0x507f1e['error']['message']);}logger[_0x6fc3('0x13')](_0x6fc3('0xe'),_0x4590a1,_0x507f1e['error'][_0x6fc3('0x15')]);return _0x19b941(_0x507f1e[_0x6fc3('0x13')][_0x6fc3('0x15')]);}else{logger[_0x6fc3('0xd')](_0x6fc3('0xe'),_0x4590a1,'request\x20sent');_0x19b941(_0x507f1e[_0x6fc3('0x16')][_0x6fc3('0x15')]);}})[_0x6fc3('0x17')](function(_0x1c5bc6){logger[_0x6fc3('0x13')](_0x6fc3('0xe'),_0x4590a1,_0x1c5bc6);_0x5bdb6f(_0x1c5bc6);});});}
\ No newline at end of file
+var _0x28bb=['request','then','UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http'];(function(_0x38860f,_0x398d45){var _0x1e0eae=function(_0x241e6a){while(--_0x241e6a){_0x38860f['push'](_0x38860f['shift']());}};_0x1e0eae(++_0x398d45);}(_0x28bb,0x145));var _0xb28b=function(_0x15c421,_0x6366f7){_0x15c421=_0x15c421-0x0;var _0x5e5ed5=_0x28bb[_0x15c421];return _0x5e5ed5;};'use strict';var _=require(_0xb28b('0x0'));var util=require(_0xb28b('0x1'));var moment=require(_0xb28b('0x2'));var BPromise=require(_0xb28b('0x3'));var rs=require(_0xb28b('0x4'));var fs=require('fs');var Redis=require(_0xb28b('0x5'));var db=require(_0xb28b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb28b('0x7'))(_0xb28b('0x8'));var config=require('../../config/environment');var jayson=require(_0xb28b('0x9'));var client=jayson['client'][_0xb28b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b47e7,_0xf80bf0,_0x3b9744){return new BPromise(function(_0x19364a,_0x3eaec9){return client[_0xb28b('0xb')](_0x2b47e7,_0x3b9744)[_0xb28b('0xc')](function(_0x4cc762){logger['info'](_0xb28b('0xd'),_0xf80bf0,'request\x20sent');logger[_0xb28b('0xe')](_0xb28b('0xf'),_0xf80bf0,'request\x20sent',JSON[_0xb28b('0x10')](_0x4cc762));if(_0x4cc762[_0xb28b('0x11')]){if(_0x4cc762[_0xb28b('0x11')]['code']===0x1f4){logger[_0xb28b('0x11')](_0xb28b('0xd'),_0xf80bf0,_0x4cc762[_0xb28b('0x11')]['message']);return _0x3eaec9(_0x4cc762['error'][_0xb28b('0x12')]);}logger[_0xb28b('0x11')](_0xb28b('0xd'),_0xf80bf0,_0x4cc762['error'][_0xb28b('0x12')]);return _0x19364a(_0x4cc762[_0xb28b('0x11')]['message']);}else{logger['info']('UserWhatsappQueue,\x20%s,\x20%s',_0xf80bf0,'request\x20sent');_0x19364a(_0x4cc762[_0xb28b('0x13')][_0xb28b('0x12')]);}})[_0xb28b('0x14')](function(_0x55dc96){logger[_0xb28b('0x11')](_0xb28b('0xd'),_0xf80bf0,_0x55dc96);_0x3eaec9(_0x55dc96);});});}
\ No newline at end of file
index b3f626e..a33db19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc17f=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x4ce107,_0x46b16b){var _0x3ab16c=function(_0x584bfa){while(--_0x584bfa){_0x4ce107['push'](_0x4ce107['shift']());}};_0x3ab16c(++_0x46b16b);}(_0xc17f,0xb8));var _0xfc17=function(_0xd4004a,_0x463da1){_0xd4004a=_0xd4004a-0x0;var _0x45bf33=_0xc17f[_0xd4004a];return _0x45bf33;};'use strict';var multer=require(_0xfc17('0x0'));var util=require(_0xfc17('0x1'));var path=require(_0xfc17('0x2'));var timeout=require(_0xfc17('0x3'));var express=require(_0xfc17('0x4'));var router=express[_0xfc17('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfc17('0x6'));var interaction=require(_0xfc17('0x7'));var config=require(_0xfc17('0x8'));var controller=require(_0xfc17('0x9'));router['get']('/',auth[_0xfc17('0xa')](),controller[_0xfc17('0xb')]);router[_0xfc17('0xc')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0xe')]);router[_0xfc17('0xf')]('/',auth[_0xfc17('0xa')](),controller['create']);router[_0xfc17('0x10')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0x11')]);router['delete']('/:id',auth[_0xfc17('0xa')](),controller[_0xfc17('0x12')]);module[_0xfc17('0x13')]=router;
\ No newline at end of file
+var _0x43fd=['../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','util','express','Router'];(function(_0x28c33e,_0x2e4476){var _0x476f26=function(_0x3a194b){while(--_0x3a194b){_0x28c33e['push'](_0x28c33e['shift']());}};_0x476f26(++_0x2e4476);}(_0x43fd,0x1ec));var _0xd43f=function(_0x12e2b1,_0x1f37a8){_0x12e2b1=_0x12e2b1-0x0;var _0x6fc0dd=_0x43fd[_0x12e2b1];return _0x6fc0dd;};'use strict';var multer=require('multer');var util=require(_0xd43f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd43f('0x1'));var router=express[_0xd43f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xd43f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd43f('0x4'));var controller=require(_0xd43f('0x5'));router[_0xd43f('0x6')]('/',auth[_0xd43f('0x7')](),controller['index']);router[_0xd43f('0x6')](_0xd43f('0x8'),auth[_0xd43f('0x7')](),controller[_0xd43f('0x9')]);router['post']('/',auth[_0xd43f('0x7')](),controller[_0xd43f('0xa')]);router['put'](_0xd43f('0x8'),auth[_0xd43f('0x7')](),controller[_0xd43f('0xb')]);router[_0xd43f('0xc')](_0xd43f('0x8'),auth['isAuthenticated'](),controller[_0xd43f('0xd')]);module[_0xd43f('0xe')]=router;
\ No newline at end of file
index ef96b24..600f284 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0385=['exports','STRING','name'];(function(_0x5b71f2,_0x1fa07a){var _0x4c7ac1=function(_0x4b1964){while(--_0x4b1964){_0x5b71f2['push'](_0x5b71f2['shift']());}};_0x4c7ac1(++_0x1fa07a);}(_0x0385,0x108));var _0x5038=function(_0x54f4f1,_0x2e603b){_0x54f4f1=_0x54f4f1-0x0;var _0x14b71f=_0x0385[_0x54f4f1];return _0x14b71f;};'use strict';var Sequelize=require('sequelize');module[_0x5038('0x0')]={'name':{'type':Sequelize[_0x5038('0x1')],'unique':_0x5038('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5038('0x1')]}};
\ No newline at end of file
+var _0x1823=['sequelize','name'];(function(_0x4ed7,_0x14f3ba){var _0x584b32=function(_0x3203f4){while(--_0x3203f4){_0x4ed7['push'](_0x4ed7['shift']());}};_0x584b32(++_0x14f3ba);}(_0x1823,0xe6));var _0x3182=function(_0x574813,_0x17fa69){_0x574813=_0x574813-0x0;var _0xf4f862=_0x1823[_0x574813];return _0xf4f862;};'use strict';var Sequelize=require(_0x3182('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3182('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 1802512..429e442 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf23=['../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','save','then','destroy','UserProfileResource','end','error','stack','name','send','index','Variable','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','type','options','includeAll','rows','params','keys','create','body','user','get','role','Variables','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils'];(function(_0x5ab2a9,_0x2436f5){var _0xeeb1c1=function(_0x221061){while(--_0x221061){_0x5ab2a9['push'](_0x5ab2a9['shift']());}};_0xeeb1c1(++_0x2436f5);}(_0xaf23,0xcf));var _0x3af2=function(_0x9be3f0,_0x628568){_0x9be3f0=_0x9be3f0-0x0;var _0x96930b=_0xaf23[_0x9be3f0];return _0x96930b;};'use strict';var emlformat=require(_0x3af2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3af2('0x1'));var jsonpatch=require(_0x3af2('0x2'));var rp=require(_0x3af2('0x3'));var moment=require(_0x3af2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3af2('0x5'));var util=require(_0x3af2('0x6'));var path=require(_0x3af2('0x7'));var sox=require(_0x3af2('0x8'));var csv=require(_0x3af2('0x9'));var ejs=require(_0x3af2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3af2('0xb'));var squel=require(_0x3af2('0xc'));var crypto=require('crypto');var jsforce=require(_0x3af2('0xd'));var deskjs=require(_0x3af2('0xe'));var toCsv=require(_0x3af2('0x9'));var querystring=require(_0x3af2('0xf'));var Papa=require(_0x3af2('0x10'));var Redis=require(_0x3af2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3af2('0x12'));var as=require(_0x3af2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3af2('0x14'));var config=require(_0x3af2('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x3af2('0x16'))['db'];function respondWithStatusCode(_0xa17da2,_0x1ad7e4){_0x1ad7e4=_0x1ad7e4||0xcc;return function(_0x173bf4){if(_0x173bf4){return _0xa17da2[_0x3af2('0x17')](_0x1ad7e4);}return _0xa17da2[_0x3af2('0x18')](_0x1ad7e4)['end']();};}function respondWithResult(_0x3a5557,_0x5a0309){_0x5a0309=_0x5a0309||0xc8;return function(_0xc30611){if(_0xc30611){return _0x3a5557['status'](_0x5a0309)[_0x3af2('0x19')](_0xc30611);}};}function respondWithFilteredResult(_0x5370af,_0x39b2c8){return function(_0x24a531){if(_0x24a531){var _0x1a088f=typeof _0x39b2c8['offset']===_0x3af2('0x1a')&&typeof _0x39b2c8[_0x3af2('0x1b')]==='undefined';var _0x4d3967=_0x24a531[_0x3af2('0x1c')];var _0x5b1d7b=_0x1a088f?0x0:_0x39b2c8[_0x3af2('0x1d')];var _0x27e5dd=_0x1a088f?_0x24a531['count']:_0x39b2c8[_0x3af2('0x1d')]+_0x39b2c8[_0x3af2('0x1b')];var _0x161d0f;if(_0x27e5dd>=_0x4d3967){_0x27e5dd=_0x4d3967;_0x161d0f=0xc8;}else{_0x161d0f=0xce;}_0x5370af['status'](_0x161d0f);return _0x5370af[_0x3af2('0x1e')](_0x3af2('0x1f'),_0x5b1d7b+'-'+_0x27e5dd+'/'+_0x4d3967)[_0x3af2('0x19')](_0x24a531);}return null;};}function patchUpdates(_0x1a3150){return function(_0x2755c2){try{jsonpatch['apply'](_0x2755c2,_0x1a3150,!![]);}catch(_0x1751b6){return BPromise['reject'](_0x1751b6);}return _0x2755c2[_0x3af2('0x20')]();};}function saveUpdates(_0x2c832a,_0x5d5615){return function(_0x4f4d52){if(_0x4f4d52){return _0x4f4d52['update'](_0x2c832a)[_0x3af2('0x21')](function(_0x1ce4fc){return _0x1ce4fc;});}return null;};}function removeEntity(_0xa0afb1,_0x2fcea2){return function(_0x5b1b2f){if(_0x5b1b2f){return _0x5b1b2f[_0x3af2('0x22')]()[_0x3af2('0x21')](function(){var _0x4f6bfe=_0x5b1b2f['get']({'plain':!![]});var _0x4515a1='Variables';return db[_0x3af2('0x23')][_0x3af2('0x22')]({'where':{'type':_0x4515a1,'resourceId':_0x4f6bfe['id']}})[_0x3af2('0x21')](function(){return _0x5b1b2f;});})[_0x3af2('0x21')](function(){_0xa0afb1[_0x3af2('0x18')](0xcc)[_0x3af2('0x24')]();});}};}function handleEntityNotFound(_0x419f5c,_0xd52938){return function(_0x19aa51){if(!_0x19aa51){_0x419f5c[_0x3af2('0x17')](0x194);}return _0x19aa51;};}function handleError(_0x509b47,_0xd0ab84){_0xd0ab84=_0xd0ab84||0x1f4;return function(_0xbeeace){logger[_0x3af2('0x25')](_0xbeeace[_0x3af2('0x26')]);if(_0xbeeace['name']){delete _0xbeeace[_0x3af2('0x27')];}_0x509b47[_0x3af2('0x18')](_0xd0ab84)[_0x3af2('0x28')](_0xbeeace);};}exports[_0x3af2('0x29')]=function(_0x3bf57c,_0x53fba8){var _0x23e5f0={},_0x10dfe7={},_0x3522c3={'count':0x0,'rows':[]};var _0x19e004=_['map'](db[_0x3af2('0x2a')][_0x3af2('0x2b')],function(_0x45f418){return{'name':_0x45f418[_0x3af2('0x2c')],'type':_0x45f418['type']['key']};});_0x10dfe7[_0x3af2('0x2d')]=_[_0x3af2('0x2e')](_0x19e004,_0x3af2('0x27'));_0x10dfe7[_0x3af2('0x2f')]=_['keys'](_0x3bf57c[_0x3af2('0x2f')]);_0x10dfe7[_0x3af2('0x30')]=_[_0x3af2('0x31')](_0x10dfe7[_0x3af2('0x2d')],_0x10dfe7[_0x3af2('0x2f')]);_0x23e5f0['attributes']=_['intersection'](_0x10dfe7['model'],qs['fields'](_0x3bf57c[_0x3af2('0x2f')][_0x3af2('0x32')]));_0x23e5f0[_0x3af2('0x33')]=_0x23e5f0[_0x3af2('0x33')][_0x3af2('0x34')]?_0x23e5f0[_0x3af2('0x33')]:_0x10dfe7[_0x3af2('0x2d')];if(!_0x3bf57c[_0x3af2('0x2f')]['hasOwnProperty']('nolimit')){_0x23e5f0[_0x3af2('0x1b')]=qs[_0x3af2('0x1b')](_0x3bf57c[_0x3af2('0x2f')][_0x3af2('0x1b')]);_0x23e5f0[_0x3af2('0x1d')]=qs['offset'](_0x3bf57c[_0x3af2('0x2f')][_0x3af2('0x1d')]);}_0x23e5f0[_0x3af2('0x35')]=qs[_0x3af2('0x36')](_0x3bf57c[_0x3af2('0x2f')][_0x3af2('0x36')]);_0x23e5f0[_0x3af2('0x37')]=qs[_0x3af2('0x30')](_[_0x3af2('0x38')](_0x3bf57c[_0x3af2('0x2f')],_0x10dfe7[_0x3af2('0x30')]),_0x19e004);if(_0x3bf57c[_0x3af2('0x2f')][_0x3af2('0x39')]){_0x23e5f0['where']=_[_0x3af2('0x3a')](_0x23e5f0[_0x3af2('0x37')],{'$or':_[_0x3af2('0x2e')](_0x19e004,function(_0x28231c){if(_0x28231c[_0x3af2('0x3b')]!=='VIRTUAL'){var _0x590ff5={};_0x590ff5[_0x28231c['name']]={'$like':'%'+_0x3bf57c['query'][_0x3af2('0x39')]+'%'};return _0x590ff5;}})});}_0x23e5f0=_[_0x3af2('0x3a')]({},_0x23e5f0,_0x3bf57c[_0x3af2('0x3c')]);var _0x3d8d88={'where':_0x23e5f0[_0x3af2('0x37')]};return db['Variable'][_0x3af2('0x1c')](_0x3d8d88)[_0x3af2('0x21')](function(_0x35d4c8){_0x3522c3[_0x3af2('0x1c')]=_0x35d4c8;if(_0x3bf57c['query'][_0x3af2('0x3d')]){_0x23e5f0['include']=[{'all':!![]}];}return db[_0x3af2('0x2a')]['findAll'](_0x23e5f0);})['then'](function(_0x138860){_0x3522c3[_0x3af2('0x3e')]=_0x138860;return _0x3522c3;})[_0x3af2('0x21')](respondWithFilteredResult(_0x53fba8,_0x23e5f0))['catch'](handleError(_0x53fba8,null));};exports['show']=function(_0x22a2bf,_0x3b32d9){var _0x5bed0c={'raw':!![],'where':{'id':_0x22a2bf[_0x3af2('0x3f')]['id']}},_0x26ed4c={};_0x26ed4c[_0x3af2('0x2d')]=_['keys'](db['Variable'][_0x3af2('0x2b')]);_0x26ed4c['query']=_[_0x3af2('0x40')](_0x22a2bf[_0x3af2('0x2f')]);_0x26ed4c['filters']=_['intersection'](_0x26ed4c[_0x3af2('0x2d')],_0x26ed4c[_0x3af2('0x2f')]);_0x5bed0c[_0x3af2('0x33')]=_['intersection'](_0x26ed4c[_0x3af2('0x2d')],qs[_0x3af2('0x32')](_0x22a2bf[_0x3af2('0x2f')][_0x3af2('0x32')]));_0x5bed0c[_0x3af2('0x33')]=_0x5bed0c[_0x3af2('0x33')]['length']?_0x5bed0c[_0x3af2('0x33')]:_0x26ed4c[_0x3af2('0x2d')];if(_0x22a2bf[_0x3af2('0x2f')]['includeAll']){_0x5bed0c['include']=[{'all':!![]}];}_0x5bed0c=_['merge']({},_0x5bed0c,_0x22a2bf[_0x3af2('0x3c')]);return db['Variable']['find'](_0x5bed0c)[_0x3af2('0x21')](handleEntityNotFound(_0x3b32d9,null))['then'](respondWithResult(_0x3b32d9,null))['catch'](handleError(_0x3b32d9,null));};exports[_0x3af2('0x41')]=function(_0x938d96,_0x4f82fd){return db[_0x3af2('0x2a')]['create'](_0x938d96[_0x3af2('0x42')],{})['then'](function(_0x442f73){var _0x1cbb20=_0x938d96[_0x3af2('0x43')][_0x3af2('0x44')]({'plain':!![]});if(!_0x1cbb20)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cbb20[_0x3af2('0x45')]===_0x3af2('0x43')){var _0x3d95bd=_0x442f73[_0x3af2('0x44')]({'plain':!![]});var _0x11f8e9=_0x3af2('0x46');return db[_0x3af2('0x47')][_0x3af2('0x48')]({'where':{'name':_0x11f8e9,'userProfileId':_0x1cbb20[_0x3af2('0x49')]},'raw':!![]})[_0x3af2('0x21')](function(_0x1f19ed){if(_0x1f19ed&&_0x1f19ed['autoAssociation']===0x0){return db[_0x3af2('0x23')][_0x3af2('0x41')]({'name':_0x3d95bd['name'],'resourceId':_0x3d95bd['id'],'type':_0x1f19ed['name'],'sectionId':_0x1f19ed['id']},{})[_0x3af2('0x21')](function(){return _0x442f73;});}else{return _0x442f73;}})['catch'](function(_0x70c8f5){logger[_0x3af2('0x25')](_0x3af2('0x4a'),_0x70c8f5);throw _0x70c8f5;});}return _0x442f73;})[_0x3af2('0x21')](respondWithResult(_0x4f82fd,0xc9))['catch'](handleError(_0x4f82fd,null));};exports['update']=function(_0x5dbc5d,_0x39fc4e){if(_0x5dbc5d[_0x3af2('0x42')]['id']){delete _0x5dbc5d[_0x3af2('0x42')]['id'];}return db['Variable'][_0x3af2('0x48')]({'where':{'id':_0x5dbc5d['params']['id']}})[_0x3af2('0x21')](handleEntityNotFound(_0x39fc4e,null))[_0x3af2('0x21')](saveUpdates(_0x5dbc5d[_0x3af2('0x42')],null))['then'](respondWithResult(_0x39fc4e,null))['catch'](handleError(_0x39fc4e,null));};exports[_0x3af2('0x22')]=function(_0x53680d,_0x19c750){return db[_0x3af2('0x2a')][_0x3af2('0x48')]({'where':{'id':_0x53680d['params']['id']}})[_0x3af2('0x21')](handleEntityNotFound(_0x19c750,null))[_0x3af2('0x21')](removeEntity(_0x19c750,null))[_0x3af2('0x4b')](handleError(_0x19c750,null));};
\ No newline at end of file
+var _0xb619=['Variables','UserProfileResource','end','stack','name','send','index','Variable','rawAttributes','fieldName','type','key','map','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','user','get','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then'];(function(_0x1fa40f,_0x5efe61){var _0x481797=function(_0x34bee5){while(--_0x34bee5){_0x1fa40f['push'](_0x1fa40f['shift']());}};_0x481797(++_0x5efe61);}(_0xb619,0xe5));var _0x9b61=function(_0x1ae809,_0x5ba5a7){_0x1ae809=_0x1ae809-0x0;var _0x20f50d=_0xb619[_0x1ae809];return _0x20f50d;};'use strict';var emlformat=require(_0x9b61('0x0'));var rimraf=require(_0x9b61('0x1'));var zipdir=require(_0x9b61('0x2'));var jsonpatch=require(_0x9b61('0x3'));var rp=require(_0x9b61('0x4'));var moment=require(_0x9b61('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9b61('0x6'));var util=require(_0x9b61('0x7'));var path=require('path');var sox=require(_0x9b61('0x8'));var csv=require(_0x9b61('0x9'));var ejs=require(_0x9b61('0xa'));var fs=require('fs');var fs_extra=require(_0x9b61('0xb'));var _=require(_0x9b61('0xc'));var squel=require(_0x9b61('0xd'));var crypto=require(_0x9b61('0xe'));var jsforce=require(_0x9b61('0xf'));var deskjs=require(_0x9b61('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9b61('0x11'));var Papa=require(_0x9b61('0x12'));var Redis=require(_0x9b61('0x13'));var authService=require(_0x9b61('0x14'));var qs=require(_0x9b61('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b61('0x16'))(_0x9b61('0x17'));var utils=require(_0x9b61('0x18'));var config=require(_0x9b61('0x19'));var licenseUtil=require(_0x9b61('0x1a'));var db=require(_0x9b61('0x1b'))['db'];function respondWithStatusCode(_0x240f93,_0x587d35){_0x587d35=_0x587d35||0xcc;return function(_0x365af4){if(_0x365af4){return _0x240f93[_0x9b61('0x1c')](_0x587d35);}return _0x240f93[_0x9b61('0x1d')](_0x587d35)['end']();};}function respondWithResult(_0xabf8e6,_0x44d1fb){_0x44d1fb=_0x44d1fb||0xc8;return function(_0x448bd){if(_0x448bd){return _0xabf8e6['status'](_0x44d1fb)[_0x9b61('0x1e')](_0x448bd);}};}function respondWithFilteredResult(_0x183a95,_0x17173e){return function(_0x4451c7){if(_0x4451c7){var _0x2ea72e=typeof _0x17173e[_0x9b61('0x1f')]===_0x9b61('0x20')&&typeof _0x17173e['limit']===_0x9b61('0x20');var _0x28e2ea=_0x4451c7[_0x9b61('0x21')];var _0x386b52=_0x2ea72e?0x0:_0x17173e[_0x9b61('0x1f')];var _0x18fed5=_0x2ea72e?_0x4451c7[_0x9b61('0x21')]:_0x17173e['offset']+_0x17173e['limit'];var _0x170bae;if(_0x18fed5>=_0x28e2ea){_0x18fed5=_0x28e2ea;_0x170bae=0xc8;}else{_0x170bae=0xce;}_0x183a95['status'](_0x170bae);return _0x183a95['set'](_0x9b61('0x22'),_0x386b52+'-'+_0x18fed5+'/'+_0x28e2ea)[_0x9b61('0x1e')](_0x4451c7);}return null;};}function patchUpdates(_0x430c21){return function(_0x40b8ed){try{jsonpatch[_0x9b61('0x23')](_0x40b8ed,_0x430c21,!![]);}catch(_0x4fe761){return BPromise[_0x9b61('0x24')](_0x4fe761);}return _0x40b8ed[_0x9b61('0x25')]();};}function saveUpdates(_0x55b74c,_0x402ecb){return function(_0x57db57){if(_0x57db57){return _0x57db57[_0x9b61('0x26')](_0x55b74c)['then'](function(_0x1d7cd3){return _0x1d7cd3;});}return null;};}function removeEntity(_0x15e9f0,_0x512dd2){return function(_0x4b159c){if(_0x4b159c){return _0x4b159c[_0x9b61('0x27')]()[_0x9b61('0x28')](function(){var _0xd796f=_0x4b159c['get']({'plain':!![]});var _0x27ee21=_0x9b61('0x29');return db[_0x9b61('0x2a')]['destroy']({'where':{'type':_0x27ee21,'resourceId':_0xd796f['id']}})[_0x9b61('0x28')](function(){return _0x4b159c;});})[_0x9b61('0x28')](function(){_0x15e9f0[_0x9b61('0x1d')](0xcc)[_0x9b61('0x2b')]();});}};}function handleEntityNotFound(_0x16d8bb,_0x30740d){return function(_0x457791){if(!_0x457791){_0x16d8bb['sendStatus'](0x194);}return _0x457791;};}function handleError(_0x465f92,_0x2b8079){_0x2b8079=_0x2b8079||0x1f4;return function(_0x287cf3){logger['error'](_0x287cf3[_0x9b61('0x2c')]);if(_0x287cf3[_0x9b61('0x2d')]){delete _0x287cf3[_0x9b61('0x2d')];}_0x465f92[_0x9b61('0x1d')](_0x2b8079)[_0x9b61('0x2e')](_0x287cf3);};}exports[_0x9b61('0x2f')]=function(_0x366e7e,_0x37e1cf){var _0x5e2a0a={},_0x19546a={},_0x231e83={'count':0x0,'rows':[]};var _0x334454=_['map'](db[_0x9b61('0x30')][_0x9b61('0x31')],function(_0x555319){return{'name':_0x555319[_0x9b61('0x32')],'type':_0x555319[_0x9b61('0x33')][_0x9b61('0x34')]};});_0x19546a['model']=_[_0x9b61('0x35')](_0x334454,_0x9b61('0x2d'));_0x19546a[_0x9b61('0x36')]=_['keys'](_0x366e7e[_0x9b61('0x36')]);_0x19546a['filters']=_['intersection'](_0x19546a[_0x9b61('0x37')],_0x19546a[_0x9b61('0x36')]);_0x5e2a0a[_0x9b61('0x38')]=_[_0x9b61('0x39')](_0x19546a[_0x9b61('0x37')],qs[_0x9b61('0x3a')](_0x366e7e[_0x9b61('0x36')]['fields']));_0x5e2a0a[_0x9b61('0x38')]=_0x5e2a0a['attributes'][_0x9b61('0x3b')]?_0x5e2a0a[_0x9b61('0x38')]:_0x19546a['model'];if(!_0x366e7e[_0x9b61('0x36')][_0x9b61('0x3c')](_0x9b61('0x3d'))){_0x5e2a0a[_0x9b61('0x3e')]=qs[_0x9b61('0x3e')](_0x366e7e[_0x9b61('0x36')][_0x9b61('0x3e')]);_0x5e2a0a[_0x9b61('0x1f')]=qs[_0x9b61('0x1f')](_0x366e7e[_0x9b61('0x36')][_0x9b61('0x1f')]);}_0x5e2a0a[_0x9b61('0x3f')]=qs[_0x9b61('0x40')](_0x366e7e['query'][_0x9b61('0x40')]);_0x5e2a0a[_0x9b61('0x41')]=qs['filters'](_[_0x9b61('0x42')](_0x366e7e[_0x9b61('0x36')],_0x19546a[_0x9b61('0x43')]),_0x334454);if(_0x366e7e[_0x9b61('0x36')]['filter']){_0x5e2a0a[_0x9b61('0x41')]=_[_0x9b61('0x44')](_0x5e2a0a[_0x9b61('0x41')],{'$or':_['map'](_0x334454,function(_0xab151e){if(_0xab151e[_0x9b61('0x33')]!==_0x9b61('0x45')){var _0x44199c={};_0x44199c[_0xab151e[_0x9b61('0x2d')]]={'$like':'%'+_0x366e7e[_0x9b61('0x36')][_0x9b61('0x46')]+'%'};return _0x44199c;}})});}_0x5e2a0a=_[_0x9b61('0x44')]({},_0x5e2a0a,_0x366e7e[_0x9b61('0x47')]);var _0x5a9ab1={'where':_0x5e2a0a[_0x9b61('0x41')]};return db['Variable']['count'](_0x5a9ab1)[_0x9b61('0x28')](function(_0x4525de){_0x231e83[_0x9b61('0x21')]=_0x4525de;if(_0x366e7e[_0x9b61('0x36')][_0x9b61('0x48')]){_0x5e2a0a[_0x9b61('0x49')]=[{'all':!![]}];}return db[_0x9b61('0x30')][_0x9b61('0x4a')](_0x5e2a0a);})['then'](function(_0x45e6ca){_0x231e83[_0x9b61('0x4b')]=_0x45e6ca;return _0x231e83;})['then'](respondWithFilteredResult(_0x37e1cf,_0x5e2a0a))[_0x9b61('0x4c')](handleError(_0x37e1cf,null));};exports[_0x9b61('0x4d')]=function(_0x30f574,_0x3bba22){var _0x5ab749={'raw':!![],'where':{'id':_0x30f574[_0x9b61('0x4e')]['id']}},_0x4c3024={};_0x4c3024[_0x9b61('0x37')]=_[_0x9b61('0x4f')](db[_0x9b61('0x30')][_0x9b61('0x31')]);_0x4c3024[_0x9b61('0x36')]=_[_0x9b61('0x4f')](_0x30f574['query']);_0x4c3024[_0x9b61('0x43')]=_['intersection'](_0x4c3024[_0x9b61('0x37')],_0x4c3024[_0x9b61('0x36')]);_0x5ab749[_0x9b61('0x38')]=_['intersection'](_0x4c3024['model'],qs[_0x9b61('0x3a')](_0x30f574['query'][_0x9b61('0x3a')]));_0x5ab749[_0x9b61('0x38')]=_0x5ab749['attributes'][_0x9b61('0x3b')]?_0x5ab749[_0x9b61('0x38')]:_0x4c3024['model'];if(_0x30f574[_0x9b61('0x36')][_0x9b61('0x48')]){_0x5ab749[_0x9b61('0x49')]=[{'all':!![]}];}_0x5ab749=_[_0x9b61('0x44')]({},_0x5ab749,_0x30f574[_0x9b61('0x47')]);return db['Variable']['find'](_0x5ab749)[_0x9b61('0x28')](handleEntityNotFound(_0x3bba22,null))[_0x9b61('0x28')](respondWithResult(_0x3bba22,null))[_0x9b61('0x4c')](handleError(_0x3bba22,null));};exports[_0x9b61('0x50')]=function(_0x55fe5e,_0x1e1456){return db[_0x9b61('0x30')]['create'](_0x55fe5e[_0x9b61('0x51')],{})[_0x9b61('0x28')](function(_0x2d6248){var _0x29c55b=_0x55fe5e[_0x9b61('0x52')][_0x9b61('0x53')]({'plain':!![]});if(!_0x29c55b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x29c55b['role']===_0x9b61('0x52')){var _0x2c81e0=_0x2d6248[_0x9b61('0x53')]({'plain':!![]});var _0x3fed05=_0x9b61('0x29');return db[_0x9b61('0x54')][_0x9b61('0x55')]({'where':{'name':_0x3fed05,'userProfileId':_0x29c55b[_0x9b61('0x56')]},'raw':!![]})[_0x9b61('0x28')](function(_0x5d8a69){if(_0x5d8a69&&_0x5d8a69[_0x9b61('0x57')]===0x0){return db[_0x9b61('0x2a')][_0x9b61('0x50')]({'name':_0x2c81e0['name'],'resourceId':_0x2c81e0['id'],'type':_0x5d8a69[_0x9b61('0x2d')],'sectionId':_0x5d8a69['id']},{})[_0x9b61('0x28')](function(){return _0x2d6248;});}else{return _0x2d6248;}})[_0x9b61('0x4c')](function(_0x2f3436){logger[_0x9b61('0x58')](_0x9b61('0x59'),_0x2f3436);throw _0x2f3436;});}return _0x2d6248;})[_0x9b61('0x28')](respondWithResult(_0x1e1456,0xc9))[_0x9b61('0x4c')](handleError(_0x1e1456,null));};exports[_0x9b61('0x26')]=function(_0x576d43,_0x58b27a){if(_0x576d43[_0x9b61('0x51')]['id']){delete _0x576d43['body']['id'];}return db[_0x9b61('0x30')]['find']({'where':{'id':_0x576d43['params']['id']}})[_0x9b61('0x28')](handleEntityNotFound(_0x58b27a,null))[_0x9b61('0x28')](saveUpdates(_0x576d43[_0x9b61('0x51')],null))[_0x9b61('0x28')](respondWithResult(_0x58b27a,null))[_0x9b61('0x4c')](handleError(_0x58b27a,null));};exports[_0x9b61('0x27')]=function(_0x5f41ec,_0x2fb801){return db[_0x9b61('0x30')][_0x9b61('0x55')]({'where':{'id':_0x5f41ec[_0x9b61('0x4e')]['id']}})[_0x9b61('0x28')](handleEntityNotFound(_0x2fb801,null))[_0x9b61('0x28')](removeEntity(_0x2fb801,null))[_0x9b61('0x4c')](handleError(_0x2fb801,null));};
\ No newline at end of file
index 454fc15..dd17609 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cd2=['path','rimraf','../../config/environment','./variable.attributes','define','Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird'];(function(_0x337add,_0x375a20){var _0x205efd=function(_0x5ac062){while(--_0x5ac062){_0x337add['push'](_0x337add['shift']());}};_0x205efd(++_0x375a20);}(_0x4cd2,0x1f3));var _0x24cd=function(_0x2d1d0e,_0x4faf0e){_0x2d1d0e=_0x2d1d0e-0x0;var _0x4d6553=_0x4cd2[_0x2d1d0e];return _0x4d6553;};'use strict';var _=require(_0x24cd('0x0'));var util=require('util');var logger=require(_0x24cd('0x1'))(_0x24cd('0x2'));var moment=require(_0x24cd('0x3'));var BPromise=require(_0x24cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24cd('0x5'));var rimraf=require(_0x24cd('0x6'));var config=require(_0x24cd('0x7'));var attributes=require(_0x24cd('0x8'));module['exports']=function(_0x2becb1,_0x44eeef){return _0x2becb1[_0x24cd('0x9')](_0x24cd('0xa'),attributes,{'tableName':_0x24cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x3ec0=['request-promise','path','rimraf','../../config/environment','exports','define','Variable','tools_variables','util','api','bluebird'];(function(_0x3a2ee2,_0x59d56b){var _0x1e7d1e=function(_0x815530){while(--_0x815530){_0x3a2ee2['push'](_0x3a2ee2['shift']());}};_0x1e7d1e(++_0x59d56b);}(_0x3ec0,0x152));var _0x03ec=function(_0x432376,_0x54481a){_0x432376=_0x432376-0x0;var _0x2dfdf1=_0x3ec0[_0x432376];return _0x2dfdf1;};'use strict';var _=require('lodash');var util=require(_0x03ec('0x0'));var logger=require('../../config/logger')(_0x03ec('0x1'));var moment=require('moment');var BPromise=require(_0x03ec('0x2'));var rp=require(_0x03ec('0x3'));var fs=require('fs');var path=require(_0x03ec('0x4'));var rimraf=require(_0x03ec('0x5'));var config=require(_0x03ec('0x6'));var attributes=require('./variable.attributes');module[_0x03ec('0x7')]=function(_0x1aed07,_0x22848e){return _0x1aed07[_0x03ec('0x8')](_0x03ec('0x9'),attributes,{'tableName':_0x03ec('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index db1bbc3..cbe6a7a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0xea9ea,_0x497a01){var _0x1d8fdf=function(_0x5ea6db){while(--_0x5ea6db){_0xea9ea['push'](_0xea9ea['shift']());}};_0x1d8fdf(++_0x497a01);}(_0x6aa7,0x178));var _0x76aa=function(_0x2700af,_0x437368){_0x2700af=_0x2700af-0x0;var _0x2e6ca1=_0x6aa7[_0x2700af];return _0x2e6ca1;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});};
\ No newline at end of file
+var _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x395b37,_0x2f1905){var _0x52853e=function(_0x41614f){while(--_0x41614f){_0x395b37['push'](_0x395b37['shift']());}};_0x52853e(++_0x2f1905);}(_0x7217,0x19e));var _0x7721=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x7217[_0x2cfb58];return _0xd99951;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var moment=require(_0x7721('0x1'));var BPromise=require(_0x7721('0x2'));var rs=require(_0x7721('0x3'));var fs=require('fs');var Redis=require(_0x7721('0x4'));var db=require(_0x7721('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7721('0x6'));var config=require(_0x7721('0x7'));var jayson=require(_0x7721('0x8'));var client=jayson[_0x7721('0x9')][_0x7721('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf7ff37,_0x18ab6b,_0x21f680){return new BPromise(function(_0x225610,_0x2f99ed){return client[_0x7721('0xb')](_0xf7ff37,_0x21f680)[_0x7721('0xc')](function(_0xfa8835){logger[_0x7721('0xd')](_0x7721('0xe'),_0x18ab6b,'request\x20sent');logger[_0x7721('0xf')](_0x7721('0x10'),_0x18ab6b,_0x7721('0x11'),JSON[_0x7721('0x12')](_0xfa8835));if(_0xfa8835[_0x7721('0x13')]){if(_0xfa8835[_0x7721('0x13')][_0x7721('0x14')]===0x1f4){logger[_0x7721('0x13')]('Variable,\x20%s,\x20%s',_0x18ab6b,_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);return _0x2f99ed(_0xfa8835['error'][_0x7721('0x15')]);}logger[_0x7721('0x13')](_0x7721('0xe'),_0x18ab6b,_0xfa8835[_0x7721('0x13')]['message']);return _0x225610(_0xfa8835[_0x7721('0x13')][_0x7721('0x15')]);}else{logger['info']('Variable,\x20%s,\x20%s',_0x18ab6b,'request\x20sent');_0x225610(_0xfa8835[_0x7721('0x16')][_0x7721('0x15')]);}})[_0x7721('0x17')](function(_0x32550d){logger['error'](_0x7721('0xe'),_0x18ab6b,_0x32550d);_0x2f99ed(_0x32550d);});});}exports['ShowVariable']=function(_0x3fc09e){var _0x5cb0e6=this;return new Promise(function(_0xfec626,_0x4e96fb){return db[_0x7721('0x18')][_0x7721('0x19')]({'raw':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1b')]===undefined?!![]:![]:!![],'where':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1c')]||null:null,'attributes':_0x3fc09e['options']?_0x3fc09e[_0x7721('0x1a')][_0x7721('0x1d')]||null:null,'include':_0x3fc09e[_0x7721('0x1a')]?_0x3fc09e[_0x7721('0x1a')]['include']?_[_0x7721('0x1e')](_0x3fc09e['options'][_0x7721('0x1f')],function(_0x288e3a){return{'model':db[_0x288e3a[_0x7721('0x20')]],'as':_0x288e3a['as'],'attributes':_0x288e3a[_0x7721('0x1d')],'include':_0x288e3a[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x288e3a[_0x7721('0x1f')],function(_0x5b4d74){return{'model':db[_0x5b4d74[_0x7721('0x20')]],'as':_0x5b4d74['as'],'attributes':_0x5b4d74[_0x7721('0x1d')],'include':_0x5b4d74[_0x7721('0x1f')]?_[_0x7721('0x1e')](_0x5b4d74[_0x7721('0x1f')],function(_0x16355a){return{'model':db[_0x16355a[_0x7721('0x20')]],'as':_0x16355a['as'],'attributes':_0x16355a[_0x7721('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7721('0xc')](function(_0x52316e){logger[_0x7721('0xd')]('ShowVariable',_0x3fc09e);logger['debug'](_0x7721('0x21'),_0x3fc09e,JSON[_0x7721('0x12')](_0x52316e));_0xfec626(_0x52316e);})[_0x7721('0x17')](function(_0x158d98){logger[_0x7721('0x13')](_0x7721('0x21'),_0x158d98[_0x7721('0x15')],_0x3fc09e);_0x4e96fb(_0x5cb0e6[_0x7721('0x13')](0x1f4,_0x158d98['message']));});});};
\ No newline at end of file
index a43e3c2..4776103 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb597=['../../components/auth/service','get','index','/fetch','fetch','/reset','canUpdate','reset','/pull','isAuthenticated','/restart','/migrations','migrations','exports','express'];(function(_0x53a133,_0x27f880){var _0x3e0287=function(_0x4ede43){while(--_0x4ede43){_0x53a133['push'](_0x53a133['shift']());}};_0x3e0287(++_0x27f880);}(_0xb597,0x194));var _0x7b59=function(_0x253fa,_0x4e5fb2){_0x253fa=_0x253fa-0x0;var _0xece08d=_0xb597[_0x253fa];return _0xece08d;};'use strict';var express=require(_0x7b59('0x0'));var router=express['Router']();var auth=require(_0x7b59('0x1'));var controller=require('./version.controller');router[_0x7b59('0x2')]('/',controller[_0x7b59('0x3')]);router[_0x7b59('0x2')](_0x7b59('0x4'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x7b59('0x5')]);router['get'](_0x7b59('0x6'),auth['isAuthenticated'](),auth[_0x7b59('0x7')](),controller[_0x7b59('0x8')]);router[_0x7b59('0x2')](_0x7b59('0x9'),auth[_0x7b59('0xa')](),auth['canUpdate'](),controller['pull']);router[_0x7b59('0x2')](_0x7b59('0xb'),auth[_0x7b59('0xa')](),controller['restart']);router['get'](_0x7b59('0xc'),controller[_0x7b59('0xd')]);module[_0x7b59('0xe')]=router;
\ No newline at end of file
+var _0x749c=['exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','isAuthenticated','/reset','canUpdate','reset','pull','/restart','restart','/migrations','migrations'];(function(_0x5ea952,_0xc78c71){var _0x45d14e=function(_0x7f3429){while(--_0x7f3429){_0x5ea952['push'](_0x5ea952['shift']());}};_0x45d14e(++_0xc78c71);}(_0x749c,0x1bb));var _0xc749=function(_0x41d432,_0x20e878){_0x41d432=_0x41d432-0x0;var _0x1650f9=_0x749c[_0x41d432];return _0x1650f9;};'use strict';var express=require(_0xc749('0x0'));var router=express[_0xc749('0x1')]();var auth=require(_0xc749('0x2'));var controller=require(_0xc749('0x3'));router[_0xc749('0x4')]('/',controller[_0xc749('0x5')]);router['get'](_0xc749('0x6'),auth[_0xc749('0x7')](),auth['canUpdate'](),controller['fetch']);router['get'](_0xc749('0x8'),auth[_0xc749('0x7')](),auth[_0xc749('0x9')](),controller[_0xc749('0xa')]);router['get']('/pull',auth[_0xc749('0x7')](),auth[_0xc749('0x9')](),controller[_0xc749('0xb')]);router[_0xc749('0x4')](_0xc749('0xc'),auth[_0xc749('0x7')](),controller[_0xc749('0xd')]);router['get'](_0xc749('0xe'),controller[_0xc749('0xf')]);module[_0xc749('0x10')]=router;
\ No newline at end of file
index 79ed6c0..1cdef1c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x45fe=['sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','root','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../config/pm2','simple-git','index','exports','query','latest','fetch','tags','2.0.0','json','origin','master','status','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','info','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','join','server','replace','push','sort'];(function(_0x3a4bde,_0x99b71c){var _0xfe52bd=function(_0xcb1573){while(--_0xcb1573){_0x3a4bde['push'](_0x3a4bde['shift']());}};_0xfe52bd(++_0x99b71c);}(_0x45fe,0x179));var _0xe45f=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0x45fe[_0x41cfd4];return _0x190f48;};'use strict';var Umzug=require(_0xe45f('0x0'));var path=require(_0xe45f('0x1'));var fs=require('fs');var _=require(_0xe45f('0x2'));var pkginfo=require(_0xe45f('0x3'))(module,_0xe45f('0x4'));var compareVersions=require(_0xe45f('0x5'));var exec=require(_0xe45f('0x6'))[_0xe45f('0x7')];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xe45f('0x8'));var logger=require('../../config/logger')('update');var git=require(_0xe45f('0x9'))(config['root']);exports[_0xe45f('0xa')]=function(_0x2458b9,_0x2b94a8){var _0x568e07={'current':module[_0xe45f('0xb')]['version'],'phonebar':0x2};if(_0x2458b9[_0xe45f('0xc')]&&_0x2458b9['query'][_0xe45f('0xd')]){return git[_0xe45f('0xe')]()[_0xe45f('0xf')](function(_0x4a4e62,_0x170018){_0x568e07[_0xe45f('0xd')]=(_0x4a4e62?module[_0xe45f('0xb')][_0xe45f('0x4')]:_0x170018[_0xe45f('0xd')])||_0xe45f('0x10');return _0x2b94a8['status'](0xc8)[_0xe45f('0x11')](_0x568e07);});}else{return _0x2b94a8['status'](0xc8)[_0xe45f('0x11')](_0x568e07);}};exports[_0xe45f('0xe')]=function(_0x38db2d,_0x3451b2){return git[_0xe45f('0xe')]([_0xe45f('0x12'),_0xe45f('0x13')],function(_0x1ea775){if(_0x1ea775){logger['error'](_0x1ea775);return _0x3451b2[_0xe45f('0x14')](0x1f4)[_0xe45f('0x11')](_0x1ea775);}logger['info'](_0xe45f('0x15'));return _0x3451b2[_0xe45f('0x14')](0xc8)[_0xe45f('0x11')]({'output':_0xe45f('0x16')});});};exports[_0xe45f('0x17')]=function(_0x535e1e,_0x53b388){return git[_0xe45f('0x17')]([_0xe45f('0x18'),_0xe45f('0x19')],function(_0x4b30cf){if(_0x4b30cf){logger[_0xe45f('0x1a')](_0x4b30cf);return _0x53b388[_0xe45f('0x14')](0x1f4)[_0xe45f('0x11')](_0x4b30cf);}logger[_0xe45f('0x1b')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x53b388[_0xe45f('0x14')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x14e997,_0x5f326d){exec('npm\x20install\x20--production',function(_0x245d34,_0x49360f,_0x7e25b8){logger[_0xe45f('0x1b')](_0x49360f);logger[_0xe45f('0x1b')](_0x7e25b8);if(_0x245d34){logger[_0xe45f('0x1a')](_0x245d34);return _0x5f326d[_0xe45f('0x14')](0x1f4)[_0xe45f('0x11')](_0x245d34);}return _0x5f326d[_0xe45f('0x14')](0xc8)[_0xe45f('0x11')]({'output':_0x49360f});});};exports[_0xe45f('0x1c')]=function(_0x4f8a0d,_0x78e2e6){return pm2[_0xe45f('0x1c')](_0xe45f('0x1d'))[_0xe45f('0x1e')](function(_0x3012d8){logger['info'](_0xe45f('0x1f'),_0x3012d8);return _0x78e2e6[_0xe45f('0x14')](0xc8)[_0xe45f('0x11')]({'output':_0xe45f('0x20')});})['catch'](function(_0x55d717){logger[_0xe45f('0x1a')](_0x55d717);return _0x78e2e6[_0xe45f('0x14')](0x1f4)['json'](_0x55d717);});};exports[_0xe45f('0x21')]=function(_0x3edce2,_0x5ab8e2){var _0x2895b7=fs['readdirSync'](path[_0xe45f('0x22')](config['root'],_0xe45f('0x23'),_0xe45f('0x21')));var _0x94d0f8=[];for(var _0x1f8483=0x0;_0x1f8483<_0x2895b7['length'];_0x1f8483++){var _0x256a62=_0x2895b7[_0x1f8483][_0xe45f('0x24')]('.js','');if(compareVersions(module[_0xe45f('0xb')]['version'],_0x256a62)===-0x1){_0x94d0f8[_0xe45f('0x25')](_0x256a62);}}if(_0x94d0f8['length']){var _0x47791a=_0x94d0f8[_0xe45f('0x26')](compareVersions);var _0x10ba07=new Umzug({'storage':_0xe45f('0x27'),'storageOptions':{'model':db[_0xe45f('0x28')],'modelName':'Migration','columnName':_0xe45f('0x4')},'migrations':{'params':[db[_0xe45f('0x27')][_0xe45f('0x29')](),db[_0xe45f('0x27')]['constructor'],function(){throw new Error(_0xe45f('0x2a'));}],'path':path[_0xe45f('0x22')](config[_0xe45f('0x2b')],_0xe45f('0x23'),_0xe45f('0x21')),'pattern':/\.js$/}});_0x10ba07['up']({'migrations':_[_0xe45f('0x2c')](_0x47791a,function(_0x2ab128){return _0x2ab128+_0xe45f('0x2d');})})[_0xe45f('0x1e')](function(){return _0x5ab8e2[_0xe45f('0x14')](0xc8)['json']({'output':_0xe45f('0x2e')+module[_0xe45f('0xb')][_0xe45f('0x4')]+_0xe45f('0x2f')+_[_0xe45f('0x30')](_0x47791a),'migrations':_[_0xe45f('0x22')](_0x47791a)});})[_0xe45f('0x31')](function(_0x376ae4){if(_0x376ae4 instanceof db[_0xe45f('0x27')][_0xe45f('0x32')]){return _0x5ab8e2[_0xe45f('0x14')](0xc8)[_0xe45f('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x5ab8e2[_0xe45f('0x14')](0x1f4)[_0xe45f('0x11')](_0x376ae4);}});}else{return _0x5ab8e2[_0xe45f('0x14')](0xc8)['json']({'output':_0xe45f('0x33')});}};
\ No newline at end of file
+var _0xeea2=['reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','then','pm2\x20restart\x20motion\x20%s','catch','readdirSync','join','server','migrations','replace','.js','length','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','update','root','index','exports','query','latest','fetch','tags','json','status','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master'];(function(_0x598b78,_0xf4ee7e){var _0x6392fa=function(_0x810353){while(--_0x810353){_0x598b78['push'](_0x598b78['shift']());}};_0x6392fa(++_0xf4ee7e);}(_0xeea2,0x89));var _0x2eea=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xeea2[_0x5f3f88];return _0xd08119;};'use strict';var Umzug=require(_0x2eea('0x0'));var path=require(_0x2eea('0x1'));var fs=require('fs');var _=require(_0x2eea('0x2'));var pkginfo=require(_0x2eea('0x3'))(module,_0x2eea('0x4'));var compareVersions=require(_0x2eea('0x5'));var exec=require(_0x2eea('0x6'))[_0x2eea('0x7')];var db=require(_0x2eea('0x8'))['db'];var config=require('../../config/environment');var pm2=require(_0x2eea('0x9'));var logger=require('../../config/logger')(_0x2eea('0xa'));var git=require('simple-git')(config[_0x2eea('0xb')]);exports[_0x2eea('0xc')]=function(_0x2a9631,_0x1389b3){var _0x28be63={'current':module[_0x2eea('0xd')]['version'],'phonebar':0x2};if(_0x2a9631['query']&&_0x2a9631[_0x2eea('0xe')][_0x2eea('0xf')]){return git[_0x2eea('0x10')]()[_0x2eea('0x11')](function(_0x355383,_0xc55cd1){_0x28be63['latest']=(_0x355383?module['exports'][_0x2eea('0x4')]:_0xc55cd1['latest'])||'2.0.0';return _0x1389b3['status'](0xc8)[_0x2eea('0x12')](_0x28be63);});}else{return _0x1389b3[_0x2eea('0x13')](0xc8)[_0x2eea('0x12')](_0x28be63);}};exports['fetch']=function(_0x5975bd,_0x3a5e28){return git[_0x2eea('0x10')]([_0x2eea('0x14'),_0x2eea('0x15')],function(_0x41019c){if(_0x41019c){logger['error'](_0x41019c);return _0x3a5e28[_0x2eea('0x13')](0x1f4)[_0x2eea('0x12')](_0x41019c);}logger[_0x2eea('0x16')](_0x2eea('0x17'));return _0x3a5e28[_0x2eea('0x13')](0xc8)['json']({'output':_0x2eea('0x18')});});};exports[_0x2eea('0x19')]=function(_0x2c26f7,_0xc1af9e){return git[_0x2eea('0x19')]([_0x2eea('0x1a'),_0x2eea('0x1b')],function(_0x528b43){if(_0x528b43){logger[_0x2eea('0x1c')](_0x528b43);return _0xc1af9e[_0x2eea('0x13')](0x1f4)['json'](_0x528b43);}logger[_0x2eea('0x16')](_0x2eea('0x1d'));return _0xc1af9e['status'](0xc8)['json']({'output':_0x2eea('0x1e')});});};exports['pull']=function(_0x1e1703,_0x57f2e4){exec(_0x2eea('0x1f'),function(_0x54edf4,_0x5c1558,_0x5da295){logger[_0x2eea('0x16')](_0x5c1558);logger[_0x2eea('0x16')](_0x5da295);if(_0x54edf4){logger['error'](_0x54edf4);return _0x57f2e4[_0x2eea('0x13')](0x1f4)['json'](_0x54edf4);}return _0x57f2e4[_0x2eea('0x13')](0xc8)[_0x2eea('0x12')]({'output':_0x5c1558});});};exports[_0x2eea('0x20')]=function(_0x3d78d0,_0x13216c){return pm2[_0x2eea('0x20')]('motion2')[_0x2eea('0x21')](function(_0x5c2314){logger[_0x2eea('0x16')](_0x2eea('0x22'),_0x5c2314);return _0x13216c[_0x2eea('0x13')](0xc8)[_0x2eea('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0x2eea('0x23')](function(_0x10db1b){logger[_0x2eea('0x1c')](_0x10db1b);return _0x13216c[_0x2eea('0x13')](0x1f4)[_0x2eea('0x12')](_0x10db1b);});};exports['migrations']=function(_0xdd6120,_0x2ad541){var _0x3f87b7=fs[_0x2eea('0x24')](path[_0x2eea('0x25')](config['root'],_0x2eea('0x26'),_0x2eea('0x27')));var _0x2ee0f4=[];for(var _0x4700ad=0x0;_0x4700ad<_0x3f87b7['length'];_0x4700ad++){var _0x33e539=_0x3f87b7[_0x4700ad][_0x2eea('0x28')](_0x2eea('0x29'),'');if(compareVersions(module[_0x2eea('0xd')]['version'],_0x33e539)===-0x1){_0x2ee0f4['push'](_0x33e539);}}if(_0x2ee0f4[_0x2eea('0x2a')]){var _0xaa3457=_0x2ee0f4[_0x2eea('0x2b')](compareVersions);var _0x39f35a=new Umzug({'storage':_0x2eea('0x2c'),'storageOptions':{'model':db[_0x2eea('0x2d')],'modelName':'Migration','columnName':_0x2eea('0x4')},'migrations':{'params':[db[_0x2eea('0x2c')][_0x2eea('0x2e')](),db[_0x2eea('0x2c')][_0x2eea('0x2f')],function(){throw new Error(_0x2eea('0x30'));}],'path':path[_0x2eea('0x25')](config[_0x2eea('0xb')],_0x2eea('0x26'),_0x2eea('0x27')),'pattern':/\.js$/}});_0x39f35a['up']({'migrations':_[_0x2eea('0x31')](_0xaa3457,function(_0x1962bf){return _0x1962bf+_0x2eea('0x29');})})[_0x2eea('0x21')](function(){return _0x2ad541['status'](0xc8)[_0x2eea('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x2eea('0xd')]['version']+_0x2eea('0x32')+_[_0x2eea('0x33')](_0xaa3457),'migrations':_['join'](_0xaa3457)});})['catch'](function(_0x30e751){if(_0x30e751 instanceof db[_0x2eea('0x2c')][_0x2eea('0x34')]){return _0x2ad541[_0x2eea('0x13')](0xc8)[_0x2eea('0x12')]({'output':_0x2eea('0x35')});}else{return _0x2ad541[_0x2eea('0x13')](0x1f4)['json'](_0x30e751);}});}else{return _0x2ad541['status'](0xc8)[_0x2eea('0x12')]({'output':'Database\x20already\x20up-to-date'});}};
\ No newline at end of file
index 4cb1c29..75ea13f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06bb=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','/:id','post','create','put','delete','exports','util','connect-timeout','express','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x06bb,0x1b6));var _0xb06b=function(_0x27f655,_0x386cb0){_0x27f655=_0x27f655-0x0;var _0x327a62=_0x06bb[_0x27f655];return _0x327a62;};'use strict';var multer=require('multer');var util=require(_0xb06b('0x0'));var path=require('path');var timeout=require(_0xb06b('0x1'));var express=require(_0xb06b('0x2'));var router=express['Router']();var fs_extra=require(_0xb06b('0x3'));var auth=require(_0xb06b('0x4'));var interaction=require(_0xb06b('0x5'));var config=require(_0xb06b('0x6'));var controller=require(_0xb06b('0x7'));router[_0xb06b('0x8')]('/',auth[_0xb06b('0x9')](),controller['index']);router[_0xb06b('0x8')](_0xb06b('0xa'),auth[_0xb06b('0x9')](),controller['describe']);router[_0xb06b('0x8')](_0xb06b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xb06b('0xc')]('/',auth[_0xb06b('0x9')](),controller[_0xb06b('0xd')]);router[_0xb06b('0xe')](_0xb06b('0xb'),auth[_0xb06b('0x9')](),controller['update']);router[_0xb06b('0xf')]('/:id',auth[_0xb06b('0x9')](),controller['destroy']);module[_0xb06b('0x10')]=router;
\ No newline at end of file
+var _0x4513=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','show','post','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5d28e0,_0x4bb9d8){var _0x53a924=function(_0x28b506){while(--_0x28b506){_0x5d28e0['push'](_0x5d28e0['shift']());}};_0x53a924(++_0x4bb9d8);}(_0x4513,0x19e));var _0x3451=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x4513[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require(_0x3451('0x0'));var util=require(_0x3451('0x1'));var path=require(_0x3451('0x2'));var timeout=require(_0x3451('0x3'));var express=require(_0x3451('0x4'));var router=express[_0x3451('0x5')]();var fs_extra=require(_0x3451('0x6'));var auth=require(_0x3451('0x7'));var interaction=require(_0x3451('0x8'));var config=require(_0x3451('0x9'));var controller=require(_0x3451('0xa'));router[_0x3451('0xb')]('/',auth[_0x3451('0xc')](),controller[_0x3451('0xd')]);router['get']('/describe',auth[_0x3451('0xc')](),controller[_0x3451('0xe')]);router[_0x3451('0xb')]('/:id',auth[_0x3451('0xc')](),controller[_0x3451('0xf')]);router[_0x3451('0x10')]('/',auth[_0x3451('0xc')](),controller['create']);router[_0x3451('0x11')](_0x3451('0x12'),auth[_0x3451('0xc')](),controller['update']);router[_0x3451('0x13')](_0x3451('0x12'),auth['isAuthenticated'](),controller[_0x3451('0x14')]);module[_0x3451('0x15')]=router;
\ No newline at end of file
index 2f4aca4..0c7f96c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf5d=['sequelize','exports','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x2abd23,_0x54ce55){var _0x38cf5a=function(_0x501f88){while(--_0x501f88){_0x2abd23['push'](_0x2abd23['shift']());}};_0x38cf5a(++_0x54ce55);}(_0xdf5d,0x126));var _0xddf5=function(_0x4b22bb,_0x2f646d){_0x4b22bb=_0x4b22bb-0x0;var _0x102679=_0xdf5d[_0x4b22bb];return _0x102679;};'use strict';var Sequelize=require(_0xddf5('0x0'));module[_0xddf5('0x1')]={'type':{'type':Sequelize[_0xddf5('0x2')]},'uniqueid':{'type':Sequelize[_0xddf5('0x2')]},'calleridnum':{'type':Sequelize[_0xddf5('0x2')]},'calleridname':{'type':Sequelize[_0xddf5('0x2')]},'queue':{'type':Sequelize[_0xddf5('0x2')]},'interface':{'type':Sequelize[_0xddf5('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xddf5('0x3')]},'agentconnectAt':{'type':Sequelize[_0xddf5('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xddf5('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xddf5('0x3')]},'agentdumpAt':{'type':Sequelize[_0xddf5('0x3')]},'holdtime':{'type':Sequelize[_0xddf5('0x4')]},'agentcomplete':{'type':Sequelize[_0xddf5('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xddf5('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xddf5('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xddf5('0x4')]},'agentacw':{'type':Sequelize[_0xddf5('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xddf5('0x4')]},'reason':{'type':Sequelize[_0xddf5('0x2')]},'lastevent':{'type':Sequelize[_0xddf5('0x2')]},'channel':{'type':Sequelize[_0xddf5('0x2')]},'channelstate':{'type':Sequelize[_0xddf5('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xddf5('0x2')]},'connectedlinename':{'type':Sequelize[_0xddf5('0x2')]},'language':{'type':Sequelize[_0xddf5('0x2')]},'accountcode':{'type':Sequelize[_0xddf5('0x2')]},'context':{'type':Sequelize[_0xddf5('0x2')]},'exten':{'type':Sequelize[_0xddf5('0x2')]},'priority':{'type':Sequelize[_0xddf5('0x2')]},'destchannel':{'type':Sequelize[_0xddf5('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xddf5('0x2')]},'destcalleridname':{'type':Sequelize[_0xddf5('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xddf5('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xddf5('0x2')]},'destlanguage':{'type':Sequelize[_0xddf5('0x2')]},'destaccountcode':{'type':Sequelize[_0xddf5('0x2')]},'destcontext':{'type':Sequelize[_0xddf5('0x2')]},'destexten':{'type':Sequelize[_0xddf5('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xddf5('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xddf5('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xddf5('0x2')]},'transfer':{'type':Sequelize[_0xddf5('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xddf5('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xddf5('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xddf5('0x4')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x87d9=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize'];(function(_0x3bbda6,_0x4568ef){var _0x11fdcf=function(_0xfb8d31){while(--_0xfb8d31){_0x3bbda6['push'](_0x3bbda6['shift']());}};_0x11fdcf(++_0x4568ef);}(_0x87d9,0x143));var _0x987d=function(_0x336c8b,_0x56b55b){_0x336c8b=_0x336c8b-0x0;var _0x4dd2f6=_0x87d9[_0x336c8b];return _0x4dd2f6;};'use strict';var Sequelize=require(_0x987d('0x0'));module['exports']={'type':{'type':Sequelize[_0x987d('0x1')]},'uniqueid':{'type':Sequelize[_0x987d('0x1')]},'calleridnum':{'type':Sequelize[_0x987d('0x1')]},'calleridname':{'type':Sequelize[_0x987d('0x1')]},'queue':{'type':Sequelize[_0x987d('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x987d('0x1')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x987d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0x987d('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0x987d('0x2')]},'holdtime':{'type':Sequelize[_0x987d('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x987d('0x3')]},'agentacw':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x987d('0x3')]},'reason':{'type':Sequelize[_0x987d('0x1')]},'lastevent':{'type':Sequelize[_0x987d('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x987d('0x3')]},'channelstatedesc':{'type':Sequelize[_0x987d('0x1')]},'connectedlinenum':{'type':Sequelize[_0x987d('0x1')]},'connectedlinename':{'type':Sequelize[_0x987d('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x987d('0x1')]},'context':{'type':Sequelize[_0x987d('0x1')]},'exten':{'type':Sequelize[_0x987d('0x1')]},'priority':{'type':Sequelize[_0x987d('0x1')]},'destchannel':{'type':Sequelize[_0x987d('0x1')]},'destchannelstate':{'type':Sequelize[_0x987d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x987d('0x1')]},'destcalleridnum':{'type':Sequelize[_0x987d('0x1')]},'destcalleridname':{'type':Sequelize[_0x987d('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x987d('0x1')]},'destaccountcode':{'type':Sequelize[_0x987d('0x1')]},'destcontext':{'type':Sequelize[_0x987d('0x1')]},'destexten':{'type':Sequelize[_0x987d('0x1')]},'destpriority':{'type':Sequelize[_0x987d('0x1')]},'destuniqueid':{'type':Sequelize[_0x987d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x987d('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x987d('0x1')]},'transfer':{'type':Sequelize[_0x987d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x987d('0x1')],'comment':_0x987d('0x5')},'transferexten':{'type':Sequelize[_0x987d('0x1')]},'transferuniqueid':{'type':Sequelize[_0x987d('0x1')]},'agententerreason':{'type':Sequelize[_0x987d('0x3')],'defaultValue':0x0}};
\ No newline at end of file
index e309ede..0ffa47a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};
\ No newline at end of file
+var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));};
\ No newline at end of file
index 181eff0..8e82dad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3eea=['exports','VoiceAgentReport','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes'];(function(_0x192099,_0x38a593){var _0x3d6ccc=function(_0x541fff){while(--_0x541fff){_0x192099['push'](_0x192099['shift']());}};_0x3d6ccc(++_0x38a593);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x3d8873,_0x8a1b6e){_0x3d8873=_0x3d8873-0x0;var _0x3a6692=_0x3eea[_0x3d8873];return _0x3a6692;};'use strict';var _=require(_0xa3ee('0x0'));var util=require('util');var logger=require(_0xa3ee('0x1'))(_0xa3ee('0x2'));var moment=require(_0xa3ee('0x3'));var BPromise=require(_0xa3ee('0x4'));var rp=require(_0xa3ee('0x5'));var fs=require('fs');var path=require(_0xa3ee('0x6'));var rimraf=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var attributes=require(_0xa3ee('0x9'));module[_0xa3ee('0xa')]=function(_0xb93cdb,_0x5776bb){return _0xb93cdb['define'](_0xa3ee('0xb'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xa3ee('0xc'),'destuniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xf2ca=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_agent','uniqueid','lodash','util'];(function(_0x4d641c,_0x22f431){var _0x113068=function(_0x4b27ef){while(--_0x4b27ef){_0x4d641c['push'](_0x4d641c['shift']());}};_0x113068(++_0x22f431);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0xf2ca[_0x318dda];return _0x3f97ca;};'use strict';var _=require(_0xaf2c('0x0'));var util=require(_0xaf2c('0x1'));var logger=require(_0xaf2c('0x2'))('api');var moment=require(_0xaf2c('0x3'));var BPromise=require(_0xaf2c('0x4'));var rp=require(_0xaf2c('0x5'));var fs=require('fs');var path=require(_0xaf2c('0x6'));var rimraf=require(_0xaf2c('0x7'));var config=require(_0xaf2c('0x8'));var attributes=require('./voiceAgentReport.attributes');module[_0xaf2c('0x9')]=function(_0x100d17,_0x297740){return _0x100d17[_0xaf2c('0xa')]('VoiceAgentReport',attributes,{'tableName':_0xaf2c('0xb'),'paranoid':![],'indexes':[{'fields':[_0xaf2c('0xc'),'destuniqueid']}],'timestamps':!![]});};
\ No newline at end of file
index 24a8b72..cb9545e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6261=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateVoiceAgentReport','create','body','options','raw','info','stringify','UpdateVoiceAgentReport','VoiceAgentReport','where','attributes','limit','util','bluebird','randomstring','ioredis'];(function(_0x36f75a,_0x5ed69d){var _0x24a768=function(_0x2bf9dd){while(--_0x2bf9dd){_0x36f75a['push'](_0x36f75a['shift']());}};_0x24a768(++_0x5ed69d);}(_0x6261,0xc8));var _0x1626=function(_0x4d2f17,_0x4ef455){_0x4d2f17=_0x4d2f17-0x0;var _0x27c255=_0x6261[_0x4d2f17];return _0x27c255;};'use strict';var _=require('lodash');var util=require(_0x1626('0x0'));var moment=require('moment');var BPromise=require(_0x1626('0x1'));var rs=require(_0x1626('0x2'));var fs=require('fs');var Redis=require(_0x1626('0x3'));var db=require(_0x1626('0x4'))['db'];var utils=require(_0x1626('0x5'));var logger=require('../../config/logger')(_0x1626('0x6'));var config=require(_0x1626('0x7'));var jayson=require(_0x1626('0x8'));var client=jayson[_0x1626('0x9')][_0x1626('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26b327,_0x50792e,_0xfcb07d){return new BPromise(function(_0x32767f,_0x27bea1){return client[_0x1626('0xb')](_0x26b327,_0xfcb07d)[_0x1626('0xc')](function(_0x1e1a81){logger['info'](_0x1626('0xd'),_0x50792e,'request\x20sent');logger[_0x1626('0xe')](_0x1626('0xf'),_0x50792e,_0x1626('0x10'),JSON['stringify'](_0x1e1a81));if(_0x1e1a81[_0x1626('0x11')]){if(_0x1e1a81[_0x1626('0x11')][_0x1626('0x12')]===0x1f4){logger[_0x1626('0x11')](_0x1626('0xd'),_0x50792e,_0x1e1a81[_0x1626('0x11')][_0x1626('0x13')]);return _0x27bea1(_0x1e1a81[_0x1626('0x11')][_0x1626('0x13')]);}logger[_0x1626('0x11')](_0x1626('0xd'),_0x50792e,_0x1e1a81[_0x1626('0x11')]['message']);return _0x32767f(_0x1e1a81[_0x1626('0x11')]['message']);}else{logger['info'](_0x1626('0xd'),_0x50792e,_0x1626('0x10'));_0x32767f(_0x1e1a81[_0x1626('0x14')][_0x1626('0x13')]);}})[_0x1626('0x15')](function(_0x1566ad){logger[_0x1626('0x11')](_0x1626('0xd'),_0x50792e,_0x1566ad);_0x27bea1(_0x1566ad);});});}exports[_0x1626('0x16')]=function(_0x1c2777){var _0x7b2fd0=this;return new Promise(function(_0x4b201b,_0x372292){return db['VoiceAgentReport'][_0x1626('0x17')](_0x1c2777[_0x1626('0x18')],{'raw':_0x1c2777[_0x1626('0x19')]?_0x1c2777[_0x1626('0x19')][_0x1626('0x1a')]===undefined?!![]:![]:!![]})[_0x1626('0xc')](function(_0x1a070a){logger[_0x1626('0x1b')](_0x1626('0x16'),_0x1c2777);logger['debug']('CreateVoiceAgentReport',_0x1c2777,JSON[_0x1626('0x1c')](_0x1a070a));_0x4b201b(_0x1a070a);})[_0x1626('0x15')](function(_0x38db5d){logger[_0x1626('0x11')](_0x1626('0x16'),_0x38db5d[_0x1626('0x13')],_0x1c2777);_0x372292(_0x7b2fd0[_0x1626('0x11')](0x1f4,_0x38db5d[_0x1626('0x13')]));});});};exports[_0x1626('0x1d')]=function(_0x29dbb6){var _0x22895e=this;return new Promise(function(_0x404209,_0x333ae1){return db[_0x1626('0x1e')]['update'](_0x29dbb6[_0x1626('0x18')],{'raw':_0x29dbb6[_0x1626('0x19')]?_0x29dbb6[_0x1626('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29dbb6[_0x1626('0x19')]?_0x29dbb6['options'][_0x1626('0x1f')]||null:null,'attributes':_0x29dbb6[_0x1626('0x19')]?_0x29dbb6['options'][_0x1626('0x20')]||null:null,'limit':_0x29dbb6[_0x1626('0x19')]?_0x29dbb6['options'][_0x1626('0x21')]||null:null})[_0x1626('0xc')](function(_0x528ff1){logger[_0x1626('0x1b')](_0x1626('0x1d'),_0x29dbb6);logger[_0x1626('0xe')](_0x1626('0x1d'),_0x29dbb6,JSON[_0x1626('0x1c')](_0x528ff1));_0x404209(_0x528ff1);})[_0x1626('0x15')](function(_0xf9731d){logger[_0x1626('0x11')]('UpdateVoiceAgentReport',_0xf9731d[_0x1626('0x13')],_0x29dbb6);_0x333ae1(_0x22895e[_0x1626('0x11')](0x1f4,_0xf9731d[_0x1626('0x13')]));});});};
\ No newline at end of file
+var _0x6df6=['info','VoiceAgentReport,\x20%s,\x20%s','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateVoiceAgentReport','VoiceAgentReport','then','UpdateVoiceAgentReport','body','options','raw','where','limit','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','request'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6df6,0x64));var _0x66df=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x6df6[_0xb1174e];return _0x285bac;};'use strict';var _=require('lodash');var util=require(_0x66df('0x0'));var moment=require(_0x66df('0x1'));var BPromise=require(_0x66df('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66df('0x3'));var db=require(_0x66df('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66df('0x5'));var config=require(_0x66df('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3ba367,_0x475a1d,_0x1e0fac){return new BPromise(function(_0x1b8442,_0x29467c){return client[_0x66df('0x7')](_0x3ba367,_0x1e0fac)['then'](function(_0x17e436){logger[_0x66df('0x8')](_0x66df('0x9'),_0x475a1d,'request\x20sent');logger[_0x66df('0xa')](_0x66df('0xb'),_0x475a1d,_0x66df('0xc'),JSON[_0x66df('0xd')](_0x17e436));if(_0x17e436[_0x66df('0xe')]){if(_0x17e436['error']['code']===0x1f4){logger[_0x66df('0xe')](_0x66df('0x9'),_0x475a1d,_0x17e436[_0x66df('0xe')]['message']);return _0x29467c(_0x17e436[_0x66df('0xe')][_0x66df('0xf')]);}logger[_0x66df('0xe')](_0x66df('0x9'),_0x475a1d,_0x17e436[_0x66df('0xe')]['message']);return _0x1b8442(_0x17e436['error'][_0x66df('0xf')]);}else{logger[_0x66df('0x8')](_0x66df('0x9'),_0x475a1d,_0x66df('0xc'));_0x1b8442(_0x17e436[_0x66df('0x10')]['message']);}})['catch'](function(_0x49a9d0){logger[_0x66df('0xe')](_0x66df('0x9'),_0x475a1d,_0x49a9d0);_0x29467c(_0x49a9d0);});});}exports[_0x66df('0x11')]=function(_0x5c9bfe){var _0x366926=this;return new Promise(function(_0x407fc1,_0x512078){return db[_0x66df('0x12')]['create'](_0x5c9bfe['body'],{'raw':_0x5c9bfe['options']?_0x5c9bfe['options']['raw']===undefined?!![]:![]:!![]})[_0x66df('0x13')](function(_0x415007){logger[_0x66df('0x8')](_0x66df('0x11'),_0x5c9bfe);logger['debug']('CreateVoiceAgentReport',_0x5c9bfe,JSON[_0x66df('0xd')](_0x415007));_0x407fc1(_0x415007);})['catch'](function(_0xd1691b){logger[_0x66df('0xe')]('CreateVoiceAgentReport',_0xd1691b[_0x66df('0xf')],_0x5c9bfe);_0x512078(_0x366926[_0x66df('0xe')](0x1f4,_0xd1691b[_0x66df('0xf')]));});});};exports[_0x66df('0x14')]=function(_0x30e839){var _0x2e45e7=this;return new Promise(function(_0x52f226,_0x51822f){return db[_0x66df('0x12')]['update'](_0x30e839[_0x66df('0x15')],{'raw':_0x30e839[_0x66df('0x16')]?_0x30e839[_0x66df('0x16')][_0x66df('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30e839[_0x66df('0x16')]?_0x30e839['options'][_0x66df('0x18')]||null:null,'attributes':_0x30e839['options']?_0x30e839[_0x66df('0x16')]['attributes']||null:null,'limit':_0x30e839[_0x66df('0x16')]?_0x30e839[_0x66df('0x16')][_0x66df('0x19')]||null:null})[_0x66df('0x13')](function(_0xbf10f7){logger[_0x66df('0x8')]('UpdateVoiceAgentReport',_0x30e839);logger['debug'](_0x66df('0x14'),_0x30e839,JSON[_0x66df('0xd')](_0xbf10f7));_0x52f226(_0xbf10f7);})[_0x66df('0x1a')](function(_0xbbd28d){logger[_0x66df('0xe')](_0x66df('0x14'),_0xbbd28d[_0x66df('0xf')],_0x30e839);_0x51822f(_0x2e45e7[_0x66df('0xe')](0x1f4,_0xbbd28d[_0x66df('0xf')]));});});};
\ No newline at end of file
index c9ff326..d31b365 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x46ed=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','put','update','delete','destroy','multer'];(function(_0x5ecc63,_0x110d0d){var _0x56e65f=function(_0x138202){while(--_0x138202){_0x5ecc63['push'](_0x5ecc63['shift']());}};_0x56e65f(++_0x110d0d);}(_0x46ed,0x168));var _0xd46e=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x46ed[_0x51020b];return _0x371e47;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd46e('0x5'));var interaction=require(_0xd46e('0x6'));var config=require('../../config/environment');var controller=require(_0xd46e('0x7'));router[_0xd46e('0x8')]('/',auth[_0xd46e('0x9')](),controller[_0xd46e('0xa')]);router[_0xd46e('0x8')](_0xd46e('0xb'),auth[_0xd46e('0x9')](),controller[_0xd46e('0xc')]);router[_0xd46e('0x8')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller['show']);router[_0xd46e('0xe')]('/',auth[_0xd46e('0x9')](),controller['create']);router[_0xd46e('0xf')](_0xd46e('0xd'),auth[_0xd46e('0x9')](),controller[_0xd46e('0x10')]);router[_0xd46e('0x11')](_0xd46e('0xd'),auth['isAuthenticated'](),controller[_0xd46e('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0x24ca=['delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','/:id','post','create','put','update'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x24ca,0x1bc));var _0xa24c=function(_0x439d59,_0x11ccdf){_0x439d59=_0x439d59-0x0;var _0x3670c7=_0x24ca[_0x439d59];return _0x3670c7;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xb')]);router[_0xa24c('0x9')](_0xa24c('0xc'),auth[_0xa24c('0xa')](),controller['describe']);router[_0xa24c('0x9')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller['show']);router[_0xa24c('0xe')]('/',auth[_0xa24c('0xa')](),controller[_0xa24c('0xf')]);router[_0xa24c('0x10')](_0xa24c('0xd'),auth[_0xa24c('0xa')](),controller[_0xa24c('0x11')]);router[_0xa24c('0x12')](_0xa24c('0xd'),auth['isAuthenticated'](),controller[_0xa24c('0x13')]);module[_0xa24c('0x14')]=router;
\ No newline at end of file
index ab351e9..67a99fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d07=['inbound-fax','outbound-fax','dialer','STRING','DATE','INTEGER','sequelize','exports','ENUM','inbound','outbound'];(function(_0x361078,_0x283dcb){var _0x22d9e8=function(_0x140b4b){while(--_0x140b4b){_0x361078['push'](_0x361078['shift']());}};_0x22d9e8(++_0x283dcb);}(_0x2d07,0x13a));var _0x72d0=function(_0x537bcd,_0x13bae1){_0x537bcd=_0x537bcd-0x0;var _0x6cc881=_0x2d07[_0x537bcd];return _0x6cc881;};'use strict';var Sequelize=require(_0x72d0('0x0'));module[_0x72d0('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x72d0('0x2')](_0x72d0('0x3'),'internal',_0x72d0('0x4'),_0x72d0('0x5'),_0x72d0('0x6'),_0x72d0('0x7'))},'tag':{'type':Sequelize[_0x72d0('0x8')]},'accountcode':{'type':Sequelize[_0x72d0('0x8')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x72d0('0x8')]},'destinationcontext':{'type':Sequelize[_0x72d0('0x8')]},'callerid':{'type':Sequelize[_0x72d0('0x8')]},'channel':{'type':Sequelize['STRING']},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x72d0('0x8')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x72d0('0x9')]},'endtime':{'type':Sequelize[_0x72d0('0x9')]},'duration':{'type':Sequelize[_0x72d0('0xa')]},'billableseconds':{'type':Sequelize[_0x72d0('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x72d0('0x8')]},'userDisposition':{'type':Sequelize[_0x72d0('0x8')]},'userSecondDisposition':{'type':Sequelize[_0x72d0('0x8')]},'userThirdDisposition':{'type':Sequelize[_0x72d0('0x8')]},'note':{'type':Sequelize[_0x72d0('0x8')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0x72d0('0xa')]},'sipcallid':{'type':Sequelize[_0x72d0('0x8')]}};
\ No newline at end of file
+var _0xe5fc=['INTEGER','sequelize','STRING','ENUM','inbound','outbound-fax','TEXT','DATE'];(function(_0x320329,_0x1056bd){var _0x3987ba=function(_0x2c4dc5){while(--_0x2c4dc5){_0x320329['push'](_0x320329['shift']());}};_0x3987ba(++_0x1056bd);}(_0xe5fc,0x109));var _0xce5f=function(_0x270970,_0x1188f3){_0x270970=_0x270970-0x0;var _0x33199c=_0xe5fc[_0x270970];return _0x33199c;};'use strict';var Sequelize=require(_0xce5f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xce5f('0x1')]},'type':{'type':Sequelize[_0xce5f('0x2')](_0xce5f('0x3'),'internal','outbound','inbound-fax',_0xce5f('0x4'),'dialer')},'tag':{'type':Sequelize[_0xce5f('0x1')]},'accountcode':{'type':Sequelize[_0xce5f('0x1')]},'source':{'type':Sequelize[_0xce5f('0x1')]},'destination':{'type':Sequelize[_0xce5f('0x1')]},'destinationcontext':{'type':Sequelize[_0xce5f('0x1')]},'callerid':{'type':Sequelize[_0xce5f('0x1')]},'channel':{'type':Sequelize[_0xce5f('0x1')]},'destinationchannel':{'type':Sequelize[_0xce5f('0x1')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xce5f('0x5')]},'starttime':{'type':Sequelize[_0xce5f('0x6')]},'systemanswertime':{'type':Sequelize[_0xce5f('0x6')]},'answertime':{'type':Sequelize[_0xce5f('0x6')]},'endtime':{'type':Sequelize[_0xce5f('0x6')]},'duration':{'type':Sequelize[_0xce5f('0x7')]},'billableseconds':{'type':Sequelize[_0xce5f('0x7')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xce5f('0x1')]},'amaflags':{'type':Sequelize[_0xce5f('0x1')]},'userfield':{'type':Sequelize[_0xce5f('0x1')]},'userDisposition':{'type':Sequelize[_0xce5f('0x1')]},'userSecondDisposition':{'type':Sequelize[_0xce5f('0x1')]},'userThirdDisposition':{'type':Sequelize[_0xce5f('0x1')]},'note':{'type':Sequelize[_0xce5f('0x1')]},'prefix':{'type':Sequelize[_0xce5f('0x1')]},'routeid':{'type':Sequelize[_0xce5f('0x7')]},'sipcallid':{'type':Sequelize['STRING']}};
\ No newline at end of file
index ec838bf..b4211fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b0e=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','undefined','offset','limit','set','json','apply','reject','save','then','destroy','error','stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','merge','where','VIRTUAL','options','count','includeAll','fullname','alias','User','findAll','rows','params','find','create','body','catch','describe','update','uniqueid','user','eml-format','zip-dir','request-promise','moment'];(function(_0x58bbfd,_0x4993bb){var _0x20f701=function(_0x59217d){while(--_0x59217d){_0x58bbfd['push'](_0x58bbfd['shift']());}};_0x20f701(++_0x4993bb);}(_0x0b0e,0x187));var _0xe0b0=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x0b0e[_0x173452];return _0xee3fd0;};'use strict';var emlformat=require(_0xe0b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0b0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0b0('0x2'));var moment=require(_0xe0b0('0x3'));var BPromise=require(_0xe0b0('0x4'));var Mustache=require(_0xe0b0('0x5'));var util=require(_0xe0b0('0x6'));var path=require(_0xe0b0('0x7'));var sox=require(_0xe0b0('0x8'));var csv=require(_0xe0b0('0x9'));var ejs=require(_0xe0b0('0xa'));var fs=require('fs');var fs_extra=require(_0xe0b0('0xb'));var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0x9'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe0b0('0x17'))['db'];function respondWithStatusCode(_0x1c358a,_0x3cc19a){_0x3cc19a=_0x3cc19a||0xcc;return function(_0x45f914){if(_0x45f914){return _0x1c358a[_0xe0b0('0x18')](_0x3cc19a);}return _0x1c358a['status'](_0x3cc19a)[_0xe0b0('0x19')]();};}function respondWithResult(_0x154de6,_0x743318){_0x743318=_0x743318||0xc8;return function(_0x24babd){if(_0x24babd){return _0x154de6[_0xe0b0('0x1a')](_0x743318)['json'](_0x24babd);}};}function respondWithFilteredResult(_0x41a7e2,_0x5adb01){return function(_0x35cb40){if(_0x35cb40){var _0xadee6e=typeof _0x5adb01['offset']===_0xe0b0('0x1b')&&typeof _0x5adb01['limit']===_0xe0b0('0x1b');var _0x100204=_0x35cb40['count'];var _0x54a3eb=_0xadee6e?0x0:_0x5adb01[_0xe0b0('0x1c')];var _0x50a441=_0xadee6e?_0x35cb40['count']:_0x5adb01['offset']+_0x5adb01[_0xe0b0('0x1d')];var _0x50fa4a;if(_0x50a441>=_0x100204){_0x50a441=_0x100204;_0x50fa4a=0xc8;}else{_0x50fa4a=0xce;}_0x41a7e2['status'](_0x50fa4a);return _0x41a7e2[_0xe0b0('0x1e')]('Content-Range',_0x54a3eb+'-'+_0x50a441+'/'+_0x100204)[_0xe0b0('0x1f')](_0x35cb40);}return null;};}function patchUpdates(_0x5dba2f){return function(_0x2c84cc){try{jsonpatch[_0xe0b0('0x20')](_0x2c84cc,_0x5dba2f,!![]);}catch(_0x3e10b3){return BPromise[_0xe0b0('0x21')](_0x3e10b3);}return _0x2c84cc[_0xe0b0('0x22')]();};}function saveUpdates(_0x58b804,_0x4cae54){return function(_0x2fa820){if(_0x2fa820){return _0x2fa820['update'](_0x58b804)[_0xe0b0('0x23')](function(_0x31b5f8){return _0x31b5f8;});}return null;};}function removeEntity(_0x513e63,_0x170ad8){return function(_0x503883){if(_0x503883){return _0x503883[_0xe0b0('0x24')]()['then'](function(){_0x513e63[_0xe0b0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e5c88,_0x4de537){return function(_0x4700cc){if(!_0x4700cc){_0x3e5c88['sendStatus'](0x194);}return _0x4700cc;};}function handleError(_0x3c221d,_0x5c5317){_0x5c5317=_0x5c5317||0x1f4;return function(_0x362aba){logger[_0xe0b0('0x25')](_0x362aba[_0xe0b0('0x26')]);if(_0x362aba[_0xe0b0('0x27')]){delete _0x362aba[_0xe0b0('0x27')];}_0x3c221d[_0xe0b0('0x1a')](_0x5c5317)['send'](_0x362aba);};}exports[_0xe0b0('0x28')]=function(_0x1b8aa8,_0x5b7a64){var _0x15e13b={},_0x419b1f={},_0x36d137={'count':0x0,'rows':[]};var _0x1d5759=_[_0xe0b0('0x29')](db[_0xe0b0('0x2a')][_0xe0b0('0x2b')],function(_0x4fb3b7){return{'name':_0x4fb3b7[_0xe0b0('0x2c')],'type':_0x4fb3b7[_0xe0b0('0x2d')]['key']};});_0x419b1f['model']=_[_0xe0b0('0x29')](_0x1d5759,_0xe0b0('0x27'));_0x419b1f[_0xe0b0('0x2e')]=_[_0xe0b0('0x2f')](_0x1b8aa8[_0xe0b0('0x2e')]);_0x419b1f['filters']=_[_0xe0b0('0x30')](_0x419b1f[_0xe0b0('0x31')],_0x419b1f[_0xe0b0('0x2e')]);_0x15e13b[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x419b1f['model'],qs[_0xe0b0('0x33')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x33')]));_0x15e13b[_0xe0b0('0x32')]=_0x15e13b[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x15e13b[_0xe0b0('0x32')]:_0x419b1f[_0xe0b0('0x31')];if(!_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x35')](_0xe0b0('0x36'))){_0x15e13b[_0xe0b0('0x1d')]=qs[_0xe0b0('0x1d')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1d')]);_0x15e13b['offset']=qs[_0xe0b0('0x1c')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x1c')]);}_0x15e13b[_0xe0b0('0x37')]=qs[_0xe0b0('0x38')](_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x38')]);_0x15e13b['where']=qs['filters'](_['pick'](_0x1b8aa8['query'],_0x419b1f[_0xe0b0('0x39')]),_0x1d5759);if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]){_0x15e13b['where']=_[_0xe0b0('0x3b')](_0x15e13b[_0xe0b0('0x3c')],{'$or':_[_0xe0b0('0x29')](_0x1d5759,function(_0x297c64){if(_0x297c64['type']!==_0xe0b0('0x3d')){var _0xfbb61d={};_0xfbb61d[_0x297c64[_0xe0b0('0x27')]]={'$like':'%'+_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x3a')]+'%'};return _0xfbb61d;}})});}_0x15e13b=_[_0xe0b0('0x3b')]({},_0x15e13b,_0x1b8aa8[_0xe0b0('0x3e')]);var _0x115a69={'where':_0x15e13b[_0xe0b0('0x3c')]};return db['VoiceCallReport'][_0xe0b0('0x3f')](_0x115a69)['then'](function(_0x34178d){_0x36d137[_0xe0b0('0x3f')]=_0x34178d;if(_0x1b8aa8[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x15e13b['include']=[{'attributes':['id',_0xe0b0('0x27'),_0xe0b0('0x41'),_0xe0b0('0x42')],'model':db[_0xe0b0('0x43')],'as':_0xe0b0('0x43')}];}return db[_0xe0b0('0x2a')][_0xe0b0('0x44')](_0x15e13b);})[_0xe0b0('0x23')](function(_0x52ffe4){_0x36d137[_0xe0b0('0x45')]=_0x52ffe4;return _0x36d137;})[_0xe0b0('0x23')](respondWithFilteredResult(_0x5b7a64,_0x15e13b))['catch'](handleError(_0x5b7a64,null));};exports['show']=function(_0x327fb4,_0x247f8d){var _0x56e7df={'raw':!![],'where':{'id':_0x327fb4[_0xe0b0('0x46')]['id']}},_0x18a59d={};_0x18a59d[_0xe0b0('0x31')]=_[_0xe0b0('0x2f')](db[_0xe0b0('0x2a')]['rawAttributes']);_0x18a59d['query']=_['keys'](_0x327fb4[_0xe0b0('0x2e')]);_0x18a59d[_0xe0b0('0x39')]=_['intersection'](_0x18a59d[_0xe0b0('0x31')],_0x18a59d[_0xe0b0('0x2e')]);_0x56e7df[_0xe0b0('0x32')]=_[_0xe0b0('0x30')](_0x18a59d[_0xe0b0('0x31')],qs['fields'](_0x327fb4['query'][_0xe0b0('0x33')]));_0x56e7df[_0xe0b0('0x32')]=_0x56e7df[_0xe0b0('0x32')][_0xe0b0('0x34')]?_0x56e7df[_0xe0b0('0x32')]:_0x18a59d['model'];if(_0x327fb4[_0xe0b0('0x2e')][_0xe0b0('0x40')]){_0x56e7df['include']=[{'all':!![]}];}_0x56e7df=_['merge']({},_0x56e7df,_0x327fb4['options']);return db[_0xe0b0('0x2a')][_0xe0b0('0x47')](_0x56e7df)[_0xe0b0('0x23')](handleEntityNotFound(_0x247f8d,null))[_0xe0b0('0x23')](respondWithResult(_0x247f8d,null))['catch'](handleError(_0x247f8d,null));};exports[_0xe0b0('0x48')]=function(_0x87d8f3,_0x483f12){return db['VoiceCallReport'][_0xe0b0('0x48')](_0x87d8f3[_0xe0b0('0x49')],{})['then'](respondWithResult(_0x483f12,0xc9))[_0xe0b0('0x4a')](handleError(_0x483f12,null));};exports[_0xe0b0('0x24')]=function(_0x504284,_0x5cb2b6){return db[_0xe0b0('0x2a')]['find']({'where':{'id':_0x504284[_0xe0b0('0x46')]['id']}})[_0xe0b0('0x23')](handleEntityNotFound(_0x5cb2b6,null))[_0xe0b0('0x23')](removeEntity(_0x5cb2b6,null))[_0xe0b0('0x4a')](handleError(_0x5cb2b6,null));};exports[_0xe0b0('0x4b')]=function(_0xf9e694,_0x5f5486){return db['VoiceCallReport'][_0xe0b0('0x4b')]()['then'](respondWithResult(_0x5f5486,null))['catch'](handleError(_0x5f5486,null));};exports[_0xe0b0('0x4c')]=function(_0x222174,_0x54cf7b){if(_0x222174['body'][_0xe0b0('0x4d')]){delete _0x222174[_0xe0b0('0x49')][_0xe0b0('0x4d')];}return db[_0xe0b0('0x2a')][_0xe0b0('0x47')]({'where':{'uniqueid':_0x222174[_0xe0b0('0x46')]['id'],'UserId':{'$or':[null,_0x222174[_0xe0b0('0x4e')]['id']]}}})['then'](handleEntityNotFound(_0x54cf7b,null))[_0xe0b0('0x23')](saveUpdates(_0x222174['body'],null))[_0xe0b0('0x23')](respondWithResult(_0x54cf7b,null))['catch'](handleError(_0x54cf7b,null));};
\ No newline at end of file
+var _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x239e5a,_0x2defe1){var _0x3669e2=function(_0x1b89cb){while(--_0x1b89cb){_0x239e5a['push'](_0x239e5a['shift']());}};_0x3669e2(++_0x2defe1);}(_0xb10b,0x12a));var _0xbb10=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0xb10b[_0x2d91c6];return _0x3a8d19;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));};
\ No newline at end of file
index 31b298d..cca63e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x941c=['rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x5c96eb,_0x5404da){var _0x4ddbad=function(_0x5a1225){while(--_0x5a1225){_0x5c96eb['push'](_0x5c96eb['shift']());}};_0x4ddbad(++_0x5404da);}(_0x941c,0x157));var _0xc941=function(_0x4c137c,_0x41c5b4){_0x4c137c=_0x4c137c-0x0;var _0x5e1d03=_0x941c[_0x4c137c];return _0x5e1d03;};'use strict';var _=require(_0xc941('0x0'));var util=require(_0xc941('0x1'));var logger=require('../../config/logger')(_0xc941('0x2'));var moment=require(_0xc941('0x3'));var BPromise=require(_0xc941('0x4'));var rp=require(_0xc941('0x5'));var fs=require('fs');var path=require(_0xc941('0x6'));var rimraf=require(_0xc941('0x7'));var config=require('../../config/environment');var attributes=require(_0xc941('0x8'));module[_0xc941('0x9')]=function(_0x58f092,_0x1236b1){return _0x58f092[_0xc941('0xa')](_0xc941('0xb'),attributes,{'tableName':_0xc941('0xc'),'paranoid':![],'indexes':[{'fields':[_0xc941('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x7a35=['./voiceCallReport.attributes','define','uniqueid','lodash','api','moment','bluebird','path','../../config/environment'];(function(_0x10be5b,_0x252653){var _0x223763=function(_0x51b089){while(--_0x51b089){_0x10be5b['push'](_0x10be5b['shift']());}};_0x223763(++_0x252653);}(_0x7a35,0x1d7));var _0x57a3=function(_0xc106ce,_0x2c20cc){_0xc106ce=_0xc106ce-0x0;var _0x55260c=_0x7a35[_0xc106ce];return _0x55260c;};'use strict';var _=require(_0x57a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x57a3('0x1'));var moment=require(_0x57a3('0x2'));var BPromise=require(_0x57a3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x57a3('0x4'));var rimraf=require('rimraf');var config=require(_0x57a3('0x5'));var attributes=require(_0x57a3('0x6'));module['exports']=function(_0x1c9ba4,_0x1b5011){return _0x1c9ba4[_0x57a3('0x7')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x57a3('0x8')]}],'timestamps':!![]});};
\ No newline at end of file
index ceb6fe6..3993d40 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6734=['findAll','options','raw','attributes','limit','include','map','model','then','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','GetVoiceCallReport','VoiceCallReport'];(function(_0xf9d3ff,_0x40989c){var _0x235b79=function(_0x444bfa){while(--_0x444bfa){_0xf9d3ff['push'](_0xf9d3ff['shift']());}};_0x235b79(++_0x40989c);}(_0x6734,0x109));var _0x4673=function(_0x54bb04,_0x3aaec2){_0x54bb04=_0x54bb04-0x0;var _0xf7a4f4=_0x6734[_0x54bb04];return _0xf7a4f4;};'use strict';var _=require(_0x4673('0x0'));var util=require(_0x4673('0x1'));var moment=require(_0x4673('0x2'));var BPromise=require('bluebird');var rs=require(_0x4673('0x3'));var fs=require('fs');var Redis=require(_0x4673('0x4'));var db=require(_0x4673('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4673('0x6'))(_0x4673('0x7'));var config=require(_0x4673('0x8'));var jayson=require(_0x4673('0x9'));var client=jayson[_0x4673('0xa')][_0x4673('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f028f,_0x305bef,_0x345ab3){return new BPromise(function(_0x5808dd,_0x422d19){return client[_0x4673('0xc')](_0x4f028f,_0x345ab3)['then'](function(_0x368309){logger[_0x4673('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x305bef,_0x4673('0xe'));logger[_0x4673('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x305bef,_0x4673('0xe'),JSON[_0x4673('0x10')](_0x368309));if(_0x368309[_0x4673('0x11')]){if(_0x368309[_0x4673('0x11')]['code']===0x1f4){logger[_0x4673('0x11')](_0x4673('0x12'),_0x305bef,_0x368309['error'][_0x4673('0x13')]);return _0x422d19(_0x368309[_0x4673('0x11')][_0x4673('0x13')]);}logger[_0x4673('0x11')](_0x4673('0x12'),_0x305bef,_0x368309['error'][_0x4673('0x13')]);return _0x5808dd(_0x368309['error'][_0x4673('0x13')]);}else{logger[_0x4673('0xd')](_0x4673('0x12'),_0x305bef,_0x4673('0xe'));_0x5808dd(_0x368309[_0x4673('0x14')]['message']);}})['catch'](function(_0x4b6b9d){logger['error'](_0x4673('0x12'),_0x305bef,_0x4b6b9d);_0x422d19(_0x4b6b9d);});});}exports[_0x4673('0x15')]=function(_0x242932){var _0xa78c64=this;return new Promise(function(_0x3b3e4d,_0x46a239){return db[_0x4673('0x16')][_0x4673('0x17')]({'raw':_0x242932[_0x4673('0x18')]?_0x242932[_0x4673('0x18')][_0x4673('0x19')]===undefined?!![]:![]:!![],'where':_0x242932[_0x4673('0x18')]?_0x242932['options']['where']||null:null,'attributes':_0x242932[_0x4673('0x18')]?_0x242932[_0x4673('0x18')][_0x4673('0x1a')]||null:null,'limit':_0x242932[_0x4673('0x18')]?_0x242932[_0x4673('0x18')][_0x4673('0x1b')]||null:null,'include':_0x242932[_0x4673('0x18')]?_0x242932[_0x4673('0x18')][_0x4673('0x1c')]?_[_0x4673('0x1d')](_0x242932[_0x4673('0x18')][_0x4673('0x1c')],function(_0x223821){return{'model':db[_0x223821[_0x4673('0x1e')]],'as':_0x223821['as'],'attributes':_0x223821['attributes'],'include':_0x223821[_0x4673('0x1c')]?_[_0x4673('0x1d')](_0x223821[_0x4673('0x1c')],function(_0x2fd570){return{'model':db[_0x2fd570[_0x4673('0x1e')]],'as':_0x2fd570['as'],'attributes':_0x2fd570[_0x4673('0x1a')],'include':_0x2fd570['include']?_['map'](_0x2fd570[_0x4673('0x1c')],function(_0x49f444){return{'model':db[_0x49f444['model']],'as':_0x49f444['as'],'attributes':_0x49f444[_0x4673('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4673('0x1f')](function(_0x8f276){logger[_0x4673('0xd')]('GetVoiceCallReport',_0x242932);logger['debug'](_0x4673('0x15'),_0x242932,JSON[_0x4673('0x10')](_0x8f276));_0x3b3e4d(_0x8f276);})['catch'](function(_0x1bce9b){logger['error'](_0x4673('0x15'),_0x1bce9b['message'],_0x242932);_0x46a239(_0xa78c64[_0x4673('0x11')](0x1f4,_0x1bce9b[_0x4673('0x13')]));});});};exports[_0x4673('0x20')]=function(_0x4f244b){var _0xf96d2f=this;return new Promise(function(_0x152503,_0x30848f){return db['VoiceCallReport'][_0x4673('0x21')](_0x4f244b[_0x4673('0x22')],{'raw':_0x4f244b['options']?_0x4f244b[_0x4673('0x18')][_0x4673('0x19')]===undefined?!![]:![]:!![]})[_0x4673('0x1f')](function(_0x29875b){logger[_0x4673('0xd')]('CreateVoiceCallReport',_0x4f244b);logger[_0x4673('0xf')]('CreateVoiceCallReport',_0x4f244b,JSON[_0x4673('0x10')](_0x29875b));_0x152503(_0x29875b);})['catch'](function(_0x4f09c5){logger[_0x4673('0x11')]('CreateVoiceCallReport',_0x4f09c5[_0x4673('0x13')],_0x4f244b);_0x30848f(_0xf96d2f[_0x4673('0x11')](0x1f4,_0x4f09c5[_0x4673('0x13')]));});});};exports[_0x4673('0x23')]=function(_0x1f4861){var _0x17b59e=this;return new Promise(function(_0x86827d,_0x56e986){return db[_0x4673('0x16')]['update'](_0x1f4861[_0x4673('0x22')],{'raw':_0x1f4861[_0x4673('0x18')]?_0x1f4861[_0x4673('0x18')][_0x4673('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f4861[_0x4673('0x18')]?_0x1f4861[_0x4673('0x18')]['where']||null:null,'attributes':_0x1f4861['options']?_0x1f4861['options'][_0x4673('0x1a')]||null:null,'limit':_0x1f4861['options']?_0x1f4861[_0x4673('0x18')][_0x4673('0x1b')]||null:null})[_0x4673('0x1f')](function(_0x4428e3){logger[_0x4673('0xd')](_0x4673('0x23'),_0x1f4861);logger['debug']('UpdateVoiceCallReport',_0x1f4861,JSON[_0x4673('0x10')](_0x4428e3));_0x86827d(_0x4428e3);})['catch'](function(_0x4176ea){logger[_0x4673('0x11')]('UpdateVoiceCallReport',_0x4176ea[_0x4673('0x13')],_0x1f4861);_0x56e986(_0x17b59e[_0x4673('0x11')](0x1f4,_0x4176ea[_0x4673('0x13')]));});});};
\ No newline at end of file
+var _0x6294=['../../config/utils','../../config/logger','../../config/environment','client','http','request','VoiceCallReport,\x20%s,\x20%s','VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','attributes','include','map','model','debug','catch','CreateVoiceCallReport','then','UpdateVoiceCallReport','body','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3886b0,_0x3bf4e4){var _0x17f99d=function(_0x209441){while(--_0x209441){_0x3886b0['push'](_0x3886b0['shift']());}};_0x17f99d(++_0x3bf4e4);}(_0x6294,0x1e7));var _0x4629=function(_0x5186c7,_0x2cd0c5){_0x5186c7=_0x5186c7-0x0;var _0x27f5f0=_0x6294[_0x5186c7];return _0x27f5f0;};'use strict';var _=require(_0x4629('0x0'));var util=require(_0x4629('0x1'));var moment=require(_0x4629('0x2'));var BPromise=require(_0x4629('0x3'));var rs=require(_0x4629('0x4'));var fs=require('fs');var Redis=require(_0x4629('0x5'));var db=require(_0x4629('0x6'))['db'];var utils=require(_0x4629('0x7'));var logger=require(_0x4629('0x8'))('rpc');var config=require(_0x4629('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4629('0xa')][_0x4629('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3facd0,_0x33c523,_0x47d942){return new BPromise(function(_0x43de24,_0x1675a7){return client[_0x4629('0xc')](_0x3facd0,_0x47d942)['then'](function(_0x411b1e){logger['info'](_0x4629('0xd'),_0x33c523,'request\x20sent');logger['debug'](_0x4629('0xe'),_0x33c523,_0x4629('0xf'),JSON[_0x4629('0x10')](_0x411b1e));if(_0x411b1e[_0x4629('0x11')]){if(_0x411b1e[_0x4629('0x11')][_0x4629('0x12')]===0x1f4){logger[_0x4629('0x11')](_0x4629('0xd'),_0x33c523,_0x411b1e[_0x4629('0x11')][_0x4629('0x13')]);return _0x1675a7(_0x411b1e[_0x4629('0x11')][_0x4629('0x13')]);}logger[_0x4629('0x11')](_0x4629('0xd'),_0x33c523,_0x411b1e['error'][_0x4629('0x13')]);return _0x43de24(_0x411b1e[_0x4629('0x11')][_0x4629('0x13')]);}else{logger[_0x4629('0x14')](_0x4629('0xd'),_0x33c523,_0x4629('0xf'));_0x43de24(_0x411b1e[_0x4629('0x15')]['message']);}})['catch'](function(_0x4dc6e9){logger[_0x4629('0x11')](_0x4629('0xd'),_0x33c523,_0x4dc6e9);_0x1675a7(_0x4dc6e9);});});}exports[_0x4629('0x16')]=function(_0x2d9500){var _0x5a1b5d=this;return new Promise(function(_0x28c866,_0x535ad8){return db[_0x4629('0x17')][_0x4629('0x18')]({'raw':_0x2d9500[_0x4629('0x19')]?_0x2d9500[_0x4629('0x19')][_0x4629('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d9500[_0x4629('0x19')]?_0x2d9500[_0x4629('0x19')]['where']||null:null,'attributes':_0x2d9500[_0x4629('0x19')]?_0x2d9500['options'][_0x4629('0x1b')]||null:null,'limit':_0x2d9500[_0x4629('0x19')]?_0x2d9500['options']['limit']||null:null,'include':_0x2d9500[_0x4629('0x19')]?_0x2d9500[_0x4629('0x19')][_0x4629('0x1c')]?_[_0x4629('0x1d')](_0x2d9500[_0x4629('0x19')][_0x4629('0x1c')],function(_0x23eebd){return{'model':db[_0x23eebd[_0x4629('0x1e')]],'as':_0x23eebd['as'],'attributes':_0x23eebd['attributes'],'include':_0x23eebd[_0x4629('0x1c')]?_[_0x4629('0x1d')](_0x23eebd['include'],function(_0x16dec8){return{'model':db[_0x16dec8[_0x4629('0x1e')]],'as':_0x16dec8['as'],'attributes':_0x16dec8[_0x4629('0x1b')],'include':_0x16dec8[_0x4629('0x1c')]?_[_0x4629('0x1d')](_0x16dec8[_0x4629('0x1c')],function(_0x2f82b9){return{'model':db[_0x2f82b9[_0x4629('0x1e')]],'as':_0x2f82b9['as'],'attributes':_0x2f82b9[_0x4629('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c005f){logger[_0x4629('0x14')](_0x4629('0x16'),_0x2d9500);logger[_0x4629('0x1f')](_0x4629('0x16'),_0x2d9500,JSON[_0x4629('0x10')](_0x5c005f));_0x28c866(_0x5c005f);})[_0x4629('0x20')](function(_0x312039){logger['error'](_0x4629('0x16'),_0x312039[_0x4629('0x13')],_0x2d9500);_0x535ad8(_0x5a1b5d[_0x4629('0x11')](0x1f4,_0x312039['message']));});});};exports[_0x4629('0x21')]=function(_0xc6afbb){var _0x5a8e1f=this;return new Promise(function(_0x3a2051,_0x5aabfa){return db[_0x4629('0x17')]['create'](_0xc6afbb['body'],{'raw':_0xc6afbb[_0x4629('0x19')]?_0xc6afbb[_0x4629('0x19')][_0x4629('0x1a')]===undefined?!![]:![]:!![]})[_0x4629('0x22')](function(_0x6e6cef){logger['info']('CreateVoiceCallReport',_0xc6afbb);logger['debug'](_0x4629('0x21'),_0xc6afbb,JSON[_0x4629('0x10')](_0x6e6cef));_0x3a2051(_0x6e6cef);})[_0x4629('0x20')](function(_0x32f0a7){logger[_0x4629('0x11')](_0x4629('0x21'),_0x32f0a7[_0x4629('0x13')],_0xc6afbb);_0x5aabfa(_0x5a8e1f[_0x4629('0x11')](0x1f4,_0x32f0a7['message']));});});};exports[_0x4629('0x23')]=function(_0x30af5c){var _0x40df0d=this;return new Promise(function(_0x283636,_0x33bc5b){return db[_0x4629('0x17')]['update'](_0x30af5c[_0x4629('0x24')],{'raw':_0x30af5c['options']?_0x30af5c['options'][_0x4629('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30af5c[_0x4629('0x19')]?_0x30af5c[_0x4629('0x19')]['where']||null:null,'attributes':_0x30af5c[_0x4629('0x19')]?_0x30af5c['options'][_0x4629('0x1b')]||null:null,'limit':_0x30af5c[_0x4629('0x19')]?_0x30af5c[_0x4629('0x19')][_0x4629('0x25')]||null:null})[_0x4629('0x22')](function(_0x184f98){logger[_0x4629('0x14')](_0x4629('0x23'),_0x30af5c);logger['debug']('UpdateVoiceCallReport',_0x30af5c,JSON[_0x4629('0x10')](_0x184f98));_0x283636(_0x184f98);})['catch'](function(_0x2311b8){logger[_0x4629('0x11')]('UpdateVoiceCallReport',_0x2311b8[_0x4629('0x13')],_0x30af5c);_0x33bc5b(_0x40df0d[_0x4629('0x11')](0x1f4,_0x2311b8[_0x4629('0x13')]));});});};
\ No newline at end of file
index dd47149..45c766d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf2b=['./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x3b5bc5,_0x526b84){var _0x1f30cf=function(_0x12e163){while(--_0x12e163){_0x3b5bc5['push'](_0x3b5bc5['shift']());}};_0x1f30cf(++_0x526b84);}(_0xcf2b,0x162));var _0xbcf2=function(_0xe7d655,_0x184955){_0xe7d655=_0xe7d655-0x0;var _0x3e4804=_0xcf2b[_0xe7d655];return _0x3e4804;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xbcf2('0x0'));var express=require(_0xbcf2('0x1'));var router=express[_0xbcf2('0x2')]();var fs_extra=require(_0xbcf2('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xbcf2('0x4'));var config=require(_0xbcf2('0x5'));var controller=require(_0xbcf2('0x6'));router[_0xbcf2('0x7')]('/',auth[_0xbcf2('0x8')](),controller[_0xbcf2('0x9')]);router[_0xbcf2('0x7')](_0xbcf2('0xa'),auth[_0xbcf2('0x8')](),controller[_0xbcf2('0xb')]);router[_0xbcf2('0xc')]('/',auth[_0xbcf2('0x8')](),controller[_0xbcf2('0xd')]);router['put'](_0xbcf2('0xa'),auth[_0xbcf2('0x8')](),controller[_0xbcf2('0xe')]);router[_0xbcf2('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xbcf2('0x10')]);module[_0xbcf2('0x11')]=router;
\ No newline at end of file
+var _0xe475=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index'];(function(_0x3e700d,_0x222e29){var _0x529259=function(_0x34d29d){while(--_0x34d29d){_0x3e700d['push'](_0x3e700d['shift']());}};_0x529259(++_0x222e29);}(_0xe475,0xa8));var _0x5e47=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe475[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x5e47('0x0'));var util=require(_0x5e47('0x1'));var path=require(_0x5e47('0x2'));var timeout=require(_0x5e47('0x3'));var express=require(_0x5e47('0x4'));var router=express[_0x5e47('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5e47('0x6'));var config=require(_0x5e47('0x7'));var controller=require(_0x5e47('0x8'));router[_0x5e47('0x9')]('/',auth[_0x5e47('0xa')](),controller[_0x5e47('0xb')]);router[_0x5e47('0x9')](_0x5e47('0xc'),auth['isAuthenticated'](),controller[_0x5e47('0xd')]);router['post']('/',auth[_0x5e47('0xa')](),controller[_0x5e47('0xe')]);router[_0x5e47('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5e47('0x10')]);router[_0x5e47('0x11')]('/:id',auth[_0x5e47('0xa')](),controller[_0x5e47('0x12')]);module[_0x5e47('0x13')]=router;
\ No newline at end of file
index 0a295ea..33ed367 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6924=['name','setDataValue','join','options','getDataValue','BOOLEAN','sequelize','exports','STRING'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x6924,0x9f));var _0x4692=function(_0x41d540,_0x51e8f1){_0x41d540=_0x41d540-0x0;var _0x275099=_0x6924[_0x41d540];return _0x275099;};'use strict';var Sequelize=require(_0x4692('0x0'));module[_0x4692('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x4692('0x2')],'unique':_0x4692('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x4692('0x2')],'set':function(_0x389514){this[_0x4692('0x4')]('options',_0x389514?_0x389514[_0x4692('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x4692('0x6'))?this[_0x4692('0x7')](_0x4692('0x6'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x4692('0x2')]},'record':{'type':Sequelize[_0x4692('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4692('0x2')]},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x01c6=['join','getDataValue','split','BOOLEAN','sequelize','STRING','name','setDataValue','options'];(function(_0x31a39f,_0x368fd5){var _0x81cde=function(_0x1998a0){while(--_0x1998a0){_0x31a39f['push'](_0x31a39f['shift']());}};_0x81cde(++_0x368fd5);}(_0x01c6,0xa6));var _0x601c=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0x01c6[_0x4bacb6];return _0x58c029;};'use strict';var Sequelize=require(_0x601c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x601c('0x1')],'unique':_0x601c('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x601c('0x1')],'set':function(_0x1ba517){this[_0x601c('0x3')](_0x601c('0x4'),_0x1ba517?_0x1ba517[_0x601c('0x5')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0x601c('0x6')](_0x601c('0x4'))[_0x601c('0x7')](''):[];}},'auth':{'type':Sequelize[_0x601c('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x601c('0x1')]},'record':{'type':Sequelize[_0x601c('0x8')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x601c('0x1')]},'description':{'type':Sequelize[_0x601c('0x1')]}};
\ No newline at end of file
index 40849f4..9098de2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeea4=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','UserProfileResource','then','error','stack','send','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','findAll','rows','catch','show','params','VoiceChanSpy','intersection','find','create','body','get','role','user','ChanSpies','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv'];(function(_0x1911c0,_0xa7471a){var _0x587296=function(_0x5c1312){while(--_0x5c1312){_0x1911c0['push'](_0x1911c0['shift']());}};_0x587296(++_0xa7471a);}(_0xeea4,0x19e));var _0x4eea=function(_0x25d0df,_0x1a62f1){_0x25d0df=_0x25d0df-0x0;var _0x114117=_0xeea4[_0x25d0df];return _0x114117;};'use strict';var emlformat=require(_0x4eea('0x0'));var rimraf=require(_0x4eea('0x1'));var zipdir=require(_0x4eea('0x2'));var jsonpatch=require(_0x4eea('0x3'));var rp=require(_0x4eea('0x4'));var moment=require(_0x4eea('0x5'));var BPromise=require(_0x4eea('0x6'));var Mustache=require(_0x4eea('0x7'));var util=require(_0x4eea('0x8'));var path=require('path');var sox=require(_0x4eea('0x9'));var csv=require('to-csv');var ejs=require(_0x4eea('0xa'));var fs=require('fs');var fs_extra=require(_0x4eea('0xb'));var _=require(_0x4eea('0xc'));var squel=require('squel');var crypto=require(_0x4eea('0xd'));var jsforce=require(_0x4eea('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4eea('0xf'));var querystring=require(_0x4eea('0x10'));var Papa=require(_0x4eea('0x11'));var Redis=require(_0x4eea('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4eea('0x13'));var as=require(_0x4eea('0x14'));var hardwareService=require(_0x4eea('0x15'));var logger=require(_0x4eea('0x16'))(_0x4eea('0x17'));var utils=require(_0x4eea('0x18'));var config=require(_0x4eea('0x19'));var licenseUtil=require(_0x4eea('0x1a'));var db=require(_0x4eea('0x1b'))['db'];function respondWithStatusCode(_0x130507,_0x47b971){_0x47b971=_0x47b971||0xcc;return function(_0x54fa8c){if(_0x54fa8c){return _0x130507[_0x4eea('0x1c')](_0x47b971);}return _0x130507[_0x4eea('0x1d')](_0x47b971)[_0x4eea('0x1e')]();};}function respondWithResult(_0x238405,_0x3327e0){_0x3327e0=_0x3327e0||0xc8;return function(_0x328275){if(_0x328275){return _0x238405[_0x4eea('0x1d')](_0x3327e0)[_0x4eea('0x1f')](_0x328275);}};}function respondWithFilteredResult(_0x5828e0,_0x1654c0){return function(_0x34ce09){if(_0x34ce09){var _0x150d60=typeof _0x1654c0[_0x4eea('0x20')]==='undefined'&&typeof _0x1654c0[_0x4eea('0x21')]===_0x4eea('0x22');var _0x3fbe8b=_0x34ce09[_0x4eea('0x23')];var _0x27a227=_0x150d60?0x0:_0x1654c0['offset'];var _0x1571f3=_0x150d60?_0x34ce09[_0x4eea('0x23')]:_0x1654c0['offset']+_0x1654c0[_0x4eea('0x21')];var _0x325185;if(_0x1571f3>=_0x3fbe8b){_0x1571f3=_0x3fbe8b;_0x325185=0xc8;}else{_0x325185=0xce;}_0x5828e0[_0x4eea('0x1d')](_0x325185);return _0x5828e0[_0x4eea('0x24')](_0x4eea('0x25'),_0x27a227+'-'+_0x1571f3+'/'+_0x3fbe8b)[_0x4eea('0x1f')](_0x34ce09);}return null;};}function patchUpdates(_0x56fefc){return function(_0xf054a7){try{jsonpatch[_0x4eea('0x26')](_0xf054a7,_0x56fefc,!![]);}catch(_0x24f371){return BPromise[_0x4eea('0x27')](_0x24f371);}return _0xf054a7[_0x4eea('0x28')]();};}function saveUpdates(_0x496ab6,_0x4898e8){return function(_0x3b7513){if(_0x3b7513){return _0x3b7513['update'](_0x496ab6)['then'](function(_0x5a2722){return _0x5a2722;});}return null;};}function removeEntity(_0x37f024,_0x3be3f3){return function(_0x505e50){if(_0x505e50){return _0x505e50[_0x4eea('0x29')]()['then'](function(){var _0x3f0a2c=_0x505e50['get']({'plain':!![]});var _0x111e65='ChanSpies';return db[_0x4eea('0x2a')][_0x4eea('0x29')]({'where':{'type':_0x111e65,'resourceId':_0x3f0a2c['id']}})[_0x4eea('0x2b')](function(){return _0x505e50;});})[_0x4eea('0x2b')](function(){_0x37f024[_0x4eea('0x1d')](0xcc)[_0x4eea('0x1e')]();});}};}function handleEntityNotFound(_0x16f6ac,_0x22939b){return function(_0x368688){if(!_0x368688){_0x16f6ac[_0x4eea('0x1c')](0x194);}return _0x368688;};}function handleError(_0x117079,_0x5ecb81){_0x5ecb81=_0x5ecb81||0x1f4;return function(_0x58c0df){logger[_0x4eea('0x2c')](_0x58c0df[_0x4eea('0x2d')]);if(_0x58c0df['name']){delete _0x58c0df['name'];}_0x117079['status'](_0x5ecb81)[_0x4eea('0x2e')](_0x58c0df);};}exports['index']=function(_0x31d9be,_0x299cf7){var _0x247d4b={},_0x4dd13b={},_0x34277b={'count':0x0,'rows':[]};var _0x14721f=_[_0x4eea('0x2f')](db['VoiceChanSpy'][_0x4eea('0x30')],function(_0x27c2ee){return{'name':_0x27c2ee[_0x4eea('0x31')],'type':_0x27c2ee['type']['key']};});_0x4dd13b[_0x4eea('0x32')]=_[_0x4eea('0x2f')](_0x14721f,'name');_0x4dd13b[_0x4eea('0x33')]=_[_0x4eea('0x34')](_0x31d9be[_0x4eea('0x33')]);_0x4dd13b[_0x4eea('0x35')]=_['intersection'](_0x4dd13b[_0x4eea('0x32')],_0x4dd13b['query']);_0x247d4b[_0x4eea('0x36')]=_['intersection'](_0x4dd13b[_0x4eea('0x32')],qs[_0x4eea('0x37')](_0x31d9be['query'][_0x4eea('0x37')]));_0x247d4b['attributes']=_0x247d4b[_0x4eea('0x36')][_0x4eea('0x38')]?_0x247d4b['attributes']:_0x4dd13b[_0x4eea('0x32')];if(!_0x31d9be[_0x4eea('0x33')][_0x4eea('0x39')]('nolimit')){_0x247d4b[_0x4eea('0x21')]=qs['limit'](_0x31d9be['query'][_0x4eea('0x21')]);_0x247d4b[_0x4eea('0x20')]=qs[_0x4eea('0x20')](_0x31d9be['query']['offset']);}_0x247d4b[_0x4eea('0x3a')]=qs[_0x4eea('0x3b')](_0x31d9be[_0x4eea('0x33')][_0x4eea('0x3b')]);_0x247d4b[_0x4eea('0x3c')]=qs['filters'](_[_0x4eea('0x3d')](_0x31d9be[_0x4eea('0x33')],_0x4dd13b[_0x4eea('0x35')]),_0x14721f);if(_0x31d9be[_0x4eea('0x33')][_0x4eea('0x3e')]){_0x247d4b[_0x4eea('0x3c')]=_[_0x4eea('0x3f')](_0x247d4b[_0x4eea('0x3c')],{'$or':_[_0x4eea('0x2f')](_0x14721f,function(_0x1acecf){if(_0x1acecf['type']!==_0x4eea('0x40')){var _0x368796={};_0x368796[_0x1acecf[_0x4eea('0x41')]]={'$like':'%'+_0x31d9be[_0x4eea('0x33')]['filter']+'%'};return _0x368796;}})});}_0x247d4b=_['merge']({},_0x247d4b,_0x31d9be[_0x4eea('0x42')]);var _0x560101={'where':_0x247d4b[_0x4eea('0x3c')]};return db['VoiceChanSpy'][_0x4eea('0x23')](_0x560101)[_0x4eea('0x2b')](function(_0x2eb27e){_0x34277b[_0x4eea('0x23')]=_0x2eb27e;if(_0x31d9be[_0x4eea('0x33')][_0x4eea('0x43')]){_0x247d4b['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x4eea('0x44')](_0x247d4b);})[_0x4eea('0x2b')](function(_0x835ff3){_0x34277b[_0x4eea('0x45')]=_0x835ff3;return _0x34277b;})[_0x4eea('0x2b')](respondWithFilteredResult(_0x299cf7,_0x247d4b))[_0x4eea('0x46')](handleError(_0x299cf7,null));};exports[_0x4eea('0x47')]=function(_0x36299f,_0xcf7466){var _0xf50514={'raw':![],'where':{'id':_0x36299f[_0x4eea('0x48')]['id']}},_0x99e57={};_0x99e57[_0x4eea('0x32')]=_['keys'](db[_0x4eea('0x49')][_0x4eea('0x30')]);_0x99e57[_0x4eea('0x33')]=_[_0x4eea('0x34')](_0x36299f[_0x4eea('0x33')]);_0x99e57[_0x4eea('0x35')]=_[_0x4eea('0x4a')](_0x99e57[_0x4eea('0x32')],_0x99e57[_0x4eea('0x33')]);_0xf50514[_0x4eea('0x36')]=_['intersection'](_0x99e57['model'],qs[_0x4eea('0x37')](_0x36299f[_0x4eea('0x33')]['fields']));_0xf50514[_0x4eea('0x36')]=_0xf50514[_0x4eea('0x36')][_0x4eea('0x38')]?_0xf50514[_0x4eea('0x36')]:_0x99e57['model'];if(_0x36299f[_0x4eea('0x33')][_0x4eea('0x43')]){_0xf50514['include']=[{'all':!![]}];}_0xf50514=_['merge']({},_0xf50514,_0x36299f[_0x4eea('0x42')]);return db[_0x4eea('0x49')][_0x4eea('0x4b')](_0xf50514)['then'](handleEntityNotFound(_0xcf7466,null))['then'](respondWithResult(_0xcf7466,null))[_0x4eea('0x46')](handleError(_0xcf7466,null));};exports[_0x4eea('0x4c')]=function(_0xf9473c,_0x49b789){return db[_0x4eea('0x49')][_0x4eea('0x4c')](_0xf9473c[_0x4eea('0x4d')],{})['then'](function(_0x173863){var _0x3cef45=_0xf9473c['user'][_0x4eea('0x4e')]({'plain':!![]});if(!_0x3cef45)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3cef45[_0x4eea('0x4f')]===_0x4eea('0x50')){var _0x771590=_0x173863[_0x4eea('0x4e')]({'plain':!![]});var _0x4f2a6f=_0x4eea('0x51');return db[_0x4eea('0x52')][_0x4eea('0x4b')]({'where':{'name':_0x4f2a6f,'userProfileId':_0x3cef45[_0x4eea('0x53')]},'raw':!![]})[_0x4eea('0x2b')](function(_0x2a4030){if(_0x2a4030&&_0x2a4030['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x771590[_0x4eea('0x41')],'resourceId':_0x771590['id'],'type':_0x2a4030[_0x4eea('0x41')],'sectionId':_0x2a4030['id']},{})[_0x4eea('0x2b')](function(){return _0x173863;});}else{return _0x173863;}})[_0x4eea('0x46')](function(_0x47ab65){logger['error'](_0x4eea('0x54'),_0x47ab65);throw _0x47ab65;});}return _0x173863;})[_0x4eea('0x2b')](respondWithResult(_0x49b789,0xc9))[_0x4eea('0x46')](handleError(_0x49b789,null));};exports[_0x4eea('0x55')]=function(_0x1efaad,_0x2c014f){if(_0x1efaad[_0x4eea('0x4d')]['id']){delete _0x1efaad[_0x4eea('0x4d')]['id'];}return db[_0x4eea('0x49')][_0x4eea('0x4b')]({'where':{'id':_0x1efaad[_0x4eea('0x48')]['id']}})[_0x4eea('0x2b')](handleEntityNotFound(_0x2c014f,null))[_0x4eea('0x2b')](saveUpdates(_0x1efaad[_0x4eea('0x4d')],null))[_0x4eea('0x2b')](respondWithResult(_0x2c014f,null))[_0x4eea('0x46')](handleError(_0x2c014f,null));};exports[_0x4eea('0x29')]=function(_0x1fac45,_0x4d0f21){return db[_0x4eea('0x49')][_0x4eea('0x4b')]({'where':{'id':_0x1fac45['params']['id']}})[_0x4eea('0x2b')](handleEntityNotFound(_0x4d0f21,null))[_0x4eea('0x2b')](removeEntity(_0x4d0f21,null))[_0x4eea('0x46')](handleError(_0x4d0f21,null));};
\ No newline at end of file
+var _0x74b1=['merge','options','VoiceChanSpy','includeAll','include','show','params','find','catch','create','body','user','role','ChanSpies','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','to-csv','ejs','fs-extra','squel','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL'];(function(_0x2e48b0,_0xc0acb6){var _0x3d2d42=function(_0x5b31e2){while(--_0x5b31e2){_0x2e48b0['push'](_0x2e48b0['shift']());}};_0x3d2d42(++_0xc0acb6);}(_0x74b1,0xb5));var _0x174b=function(_0x587693,_0x27fe90){_0x587693=_0x587693-0x0;var _0x510a1a=_0x74b1[_0x587693];return _0x510a1a;};'use strict';var emlformat=require(_0x174b('0x0'));var rimraf=require(_0x174b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x174b('0x2'));var rp=require(_0x174b('0x3'));var moment=require('moment');var BPromise=require(_0x174b('0x4'));var Mustache=require(_0x174b('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x174b('0x6'));var ejs=require(_0x174b('0x7'));var fs=require('fs');var fs_extra=require(_0x174b('0x8'));var _=require('lodash');var squel=require(_0x174b('0x9'));var crypto=require(_0x174b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x174b('0x6'));var querystring=require('querystring');var Papa=require(_0x174b('0xb'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x174b('0xc'));var as=require(_0x174b('0xd'));var hardwareService=require(_0x174b('0xe'));var logger=require(_0x174b('0xf'))(_0x174b('0x10'));var utils=require(_0x174b('0x11'));var config=require(_0x174b('0x12'));var licenseUtil=require(_0x174b('0x13'));var db=require(_0x174b('0x14'))['db'];function respondWithStatusCode(_0x4ea947,_0x70fa85){_0x70fa85=_0x70fa85||0xcc;return function(_0xc996e){if(_0xc996e){return _0x4ea947[_0x174b('0x15')](_0x70fa85);}return _0x4ea947[_0x174b('0x16')](_0x70fa85)[_0x174b('0x17')]();};}function respondWithResult(_0x44b778,_0xe9c224){_0xe9c224=_0xe9c224||0xc8;return function(_0x43143b){if(_0x43143b){return _0x44b778[_0x174b('0x16')](_0xe9c224)['json'](_0x43143b);}};}function respondWithFilteredResult(_0x1c5579,_0xde8235){return function(_0x210a3c){if(_0x210a3c){var _0x4a7aeb=typeof _0xde8235['offset']===_0x174b('0x18')&&typeof _0xde8235[_0x174b('0x19')]===_0x174b('0x18');var _0x209dd4=_0x210a3c[_0x174b('0x1a')];var _0x31f801=_0x4a7aeb?0x0:_0xde8235['offset'];var _0x1049dc=_0x4a7aeb?_0x210a3c[_0x174b('0x1a')]:_0xde8235[_0x174b('0x1b')]+_0xde8235[_0x174b('0x19')];var _0x2bef75;if(_0x1049dc>=_0x209dd4){_0x1049dc=_0x209dd4;_0x2bef75=0xc8;}else{_0x2bef75=0xce;}_0x1c5579[_0x174b('0x16')](_0x2bef75);return _0x1c5579[_0x174b('0x1c')](_0x174b('0x1d'),_0x31f801+'-'+_0x1049dc+'/'+_0x209dd4)[_0x174b('0x1e')](_0x210a3c);}return null;};}function patchUpdates(_0x1458a1){return function(_0x4e58f0){try{jsonpatch[_0x174b('0x1f')](_0x4e58f0,_0x1458a1,!![]);}catch(_0x49d32e){return BPromise['reject'](_0x49d32e);}return _0x4e58f0[_0x174b('0x20')]();};}function saveUpdates(_0x568b3f,_0x537ac3){return function(_0x2c09ad){if(_0x2c09ad){return _0x2c09ad[_0x174b('0x21')](_0x568b3f)[_0x174b('0x22')](function(_0x55f2ac){return _0x55f2ac;});}return null;};}function removeEntity(_0x150304,_0x4da1da){return function(_0x3b57c5){if(_0x3b57c5){return _0x3b57c5[_0x174b('0x23')]()[_0x174b('0x22')](function(){var _0x294aac=_0x3b57c5[_0x174b('0x24')]({'plain':!![]});var _0x242295='ChanSpies';return db['UserProfileResource'][_0x174b('0x23')]({'where':{'type':_0x242295,'resourceId':_0x294aac['id']}})[_0x174b('0x22')](function(){return _0x3b57c5;});})[_0x174b('0x22')](function(){_0x150304[_0x174b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x276384,_0x3215bd){return function(_0x583b0c){if(!_0x583b0c){_0x276384[_0x174b('0x15')](0x194);}return _0x583b0c;};}function handleError(_0x2eb1cb,_0x17a237){_0x17a237=_0x17a237||0x1f4;return function(_0x50f947){logger[_0x174b('0x25')](_0x50f947[_0x174b('0x26')]);if(_0x50f947['name']){delete _0x50f947[_0x174b('0x27')];}_0x2eb1cb['status'](_0x17a237)[_0x174b('0x28')](_0x50f947);};}exports[_0x174b('0x29')]=function(_0x220206,_0x3e6fb0){var _0x2a7ec2={},_0x580731={},_0x22bf34={'count':0x0,'rows':[]};var _0x3a72a9=_[_0x174b('0x2a')](db['VoiceChanSpy'][_0x174b('0x2b')],function(_0x146a08){return{'name':_0x146a08[_0x174b('0x2c')],'type':_0x146a08['type'][_0x174b('0x2d')]};});_0x580731['model']=_['map'](_0x3a72a9,_0x174b('0x27'));_0x580731[_0x174b('0x2e')]=_[_0x174b('0x2f')](_0x220206[_0x174b('0x2e')]);_0x580731['filters']=_[_0x174b('0x30')](_0x580731[_0x174b('0x31')],_0x580731[_0x174b('0x2e')]);_0x2a7ec2[_0x174b('0x32')]=_[_0x174b('0x30')](_0x580731[_0x174b('0x31')],qs[_0x174b('0x33')](_0x220206['query'][_0x174b('0x33')]));_0x2a7ec2['attributes']=_0x2a7ec2['attributes'][_0x174b('0x34')]?_0x2a7ec2[_0x174b('0x32')]:_0x580731[_0x174b('0x31')];if(!_0x220206[_0x174b('0x2e')][_0x174b('0x35')]('nolimit')){_0x2a7ec2[_0x174b('0x19')]=qs[_0x174b('0x19')](_0x220206[_0x174b('0x2e')][_0x174b('0x19')]);_0x2a7ec2[_0x174b('0x1b')]=qs[_0x174b('0x1b')](_0x220206[_0x174b('0x2e')][_0x174b('0x1b')]);}_0x2a7ec2[_0x174b('0x36')]=qs['sort'](_0x220206['query'][_0x174b('0x37')]);_0x2a7ec2[_0x174b('0x38')]=qs[_0x174b('0x39')](_[_0x174b('0x3a')](_0x220206[_0x174b('0x2e')],_0x580731['filters']),_0x3a72a9);if(_0x220206['query'][_0x174b('0x3b')]){_0x2a7ec2[_0x174b('0x38')]=_['merge'](_0x2a7ec2[_0x174b('0x38')],{'$or':_[_0x174b('0x2a')](_0x3a72a9,function(_0x1cdefc){if(_0x1cdefc[_0x174b('0x3c')]!==_0x174b('0x3d')){var _0xcbae0f={};_0xcbae0f[_0x1cdefc['name']]={'$like':'%'+_0x220206['query'][_0x174b('0x3b')]+'%'};return _0xcbae0f;}})});}_0x2a7ec2=_[_0x174b('0x3e')]({},_0x2a7ec2,_0x220206[_0x174b('0x3f')]);var _0x5015ce={'where':_0x2a7ec2[_0x174b('0x38')]};return db[_0x174b('0x40')][_0x174b('0x1a')](_0x5015ce)[_0x174b('0x22')](function(_0x1d1d2b){_0x22bf34[_0x174b('0x1a')]=_0x1d1d2b;if(_0x220206[_0x174b('0x2e')][_0x174b('0x41')]){_0x2a7ec2[_0x174b('0x42')]=[{'all':!![]}];}return db[_0x174b('0x40')]['findAll'](_0x2a7ec2);})[_0x174b('0x22')](function(_0xf9dd00){_0x22bf34['rows']=_0xf9dd00;return _0x22bf34;})[_0x174b('0x22')](respondWithFilteredResult(_0x3e6fb0,_0x2a7ec2))['catch'](handleError(_0x3e6fb0,null));};exports[_0x174b('0x43')]=function(_0x6fbdc4,_0x468059){var _0x4c9cb4={'raw':![],'where':{'id':_0x6fbdc4[_0x174b('0x44')]['id']}},_0x1fa140={};_0x1fa140['model']=_['keys'](db[_0x174b('0x40')][_0x174b('0x2b')]);_0x1fa140['query']=_['keys'](_0x6fbdc4[_0x174b('0x2e')]);_0x1fa140[_0x174b('0x39')]=_[_0x174b('0x30')](_0x1fa140[_0x174b('0x31')],_0x1fa140['query']);_0x4c9cb4[_0x174b('0x32')]=_['intersection'](_0x1fa140['model'],qs[_0x174b('0x33')](_0x6fbdc4[_0x174b('0x2e')][_0x174b('0x33')]));_0x4c9cb4['attributes']=_0x4c9cb4[_0x174b('0x32')]['length']?_0x4c9cb4['attributes']:_0x1fa140[_0x174b('0x31')];if(_0x6fbdc4[_0x174b('0x2e')]['includeAll']){_0x4c9cb4[_0x174b('0x42')]=[{'all':!![]}];}_0x4c9cb4=_[_0x174b('0x3e')]({},_0x4c9cb4,_0x6fbdc4[_0x174b('0x3f')]);return db[_0x174b('0x40')][_0x174b('0x45')](_0x4c9cb4)[_0x174b('0x22')](handleEntityNotFound(_0x468059,null))[_0x174b('0x22')](respondWithResult(_0x468059,null))[_0x174b('0x46')](handleError(_0x468059,null));};exports[_0x174b('0x47')]=function(_0x565ad0,_0x4cd165){return db['VoiceChanSpy'][_0x174b('0x47')](_0x565ad0[_0x174b('0x48')],{})[_0x174b('0x22')](function(_0x12ae01){var _0x38cb5e=_0x565ad0[_0x174b('0x49')]['get']({'plain':!![]});if(!_0x38cb5e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38cb5e[_0x174b('0x4a')]===_0x174b('0x49')){var _0x41d309=_0x12ae01[_0x174b('0x24')]({'plain':!![]});var _0xd27c7d=_0x174b('0x4b');return db[_0x174b('0x4c')][_0x174b('0x45')]({'where':{'name':_0xd27c7d,'userProfileId':_0x38cb5e[_0x174b('0x4d')]},'raw':!![]})['then'](function(_0x306b23){if(_0x306b23&&_0x306b23[_0x174b('0x4e')]===0x0){return db[_0x174b('0x4f')][_0x174b('0x47')]({'name':_0x41d309[_0x174b('0x27')],'resourceId':_0x41d309['id'],'type':_0x306b23[_0x174b('0x27')],'sectionId':_0x306b23['id']},{})[_0x174b('0x22')](function(){return _0x12ae01;});}else{return _0x12ae01;}})[_0x174b('0x46')](function(_0x39dd9d){logger['error'](_0x174b('0x50'),_0x39dd9d);throw _0x39dd9d;});}return _0x12ae01;})['then'](respondWithResult(_0x4cd165,0xc9))['catch'](handleError(_0x4cd165,null));};exports[_0x174b('0x21')]=function(_0x50f3e3,_0x55bc56){if(_0x50f3e3[_0x174b('0x48')]['id']){delete _0x50f3e3[_0x174b('0x48')]['id'];}return db[_0x174b('0x40')][_0x174b('0x45')]({'where':{'id':_0x50f3e3[_0x174b('0x44')]['id']}})[_0x174b('0x22')](handleEntityNotFound(_0x55bc56,null))['then'](saveUpdates(_0x50f3e3[_0x174b('0x48')],null))[_0x174b('0x22')](respondWithResult(_0x55bc56,null))['catch'](handleError(_0x55bc56,null));};exports[_0x174b('0x23')]=function(_0x256d6e,_0x201869){return db['VoiceChanSpy']['find']({'where':{'id':_0x256d6e[_0x174b('0x44')]['id']}})['then'](handleEntityNotFound(_0x201869,null))['then'](removeEntity(_0x201869,null))[_0x174b('0x46')](handleError(_0x201869,null));};
\ No newline at end of file
index ed4e470..05fdf63 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd0fc=['prefix','system','Set','format','CDR(type)=%s','chanspy','record','push','merge','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','StopMixMonitor','length','concat','internal','User','agent','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','context','%s%s'];(function(_0x4e7c1c,_0x56eafd){var _0x47adb2=function(_0x346135){while(--_0x346135){_0x4e7c1c['push'](_0x4e7c1c['shift']());}};_0x47adb2(++_0x56eafd);}(_0xd0fc,0x1e9));var _0xcd0f=function(_0x48f64a,_0x594a1c){_0x48f64a=_0x48f64a-0x0;var _0x48872a=_0xd0fc[_0x48f64a];return _0x48872a;};'use strict';var _=require(_0xcd0f('0x0'));var util=require(_0xcd0f('0x1'));var BPromise=require(_0xcd0f('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x2f3cdd,_0x375e63,_0x5e56d3){var _0x216875=0x1;var _0x29a79d=[];var _0x5f32ec={'context':_0x375e63[_0xcd0f('0x3')]||'from-sip','exten':util['format'](_0xcd0f('0x4'),_0x2f3cdd[_0xcd0f('0x5')],_0x5e56d3),'type':_0xcd0f('0x6'),'isApp':![],'ChanSpyId':_0x2f3cdd['id'],'UserId':_0x375e63['id']};_0x29a79d['push'](_['merge']({'app':_0xcd0f('0x7'),'appdata':util[_0xcd0f('0x8')](_0xcd0f('0x9'),_0xcd0f('0xa')),'priority':_0x216875++},_0x5f32ec));if(_0x2f3cdd[_0xcd0f('0xb')]){_0x29a79d[_0xcd0f('0xc')](_[_0xcd0f('0xd')]({'app':'MixMonitor','appdata':util[_0xcd0f('0x8')](_0xcd0f('0xe'),_0x2f3cdd[_0xcd0f('0xf')]),'priority':_0x216875++},_0x5f32ec));}if(_0x2f3cdd[_0xcd0f('0x10')]){_0x29a79d[_0xcd0f('0xc')](_['merge']({'app':_0xcd0f('0x11'),'appdata':_0x2f3cdd[_0xcd0f('0x12')],'priority':_0x216875++},_0x5f32ec));}_0x29a79d[_0xcd0f('0xc')](_[_0xcd0f('0xd')]({'app':_0xcd0f('0x13'),'appdata':util[_0xcd0f('0x8')](_0xcd0f('0x14'),_0x375e63[_0xcd0f('0x15')],_0x2f3cdd['options']?_0x2f3cdd['options'][_0xcd0f('0x16')](''):''),'priority':_0x216875++},_0x5f32ec));if(_0x2f3cdd[_0xcd0f('0xb')]){_0x29a79d[_0xcd0f('0xc')](_[_0xcd0f('0xd')]({'app':_0xcd0f('0x17'),'priority':_0x216875++},_0x5f32ec));}return _0x29a79d;};var getChanSpyApplications=function(_0x4d419e,_0x561db3){var _0x901025=[];for(var _0x52198e=0x0,_0xda434b=0x1;_0x52198e<_0x561db3[_0xcd0f('0x18')];_0x52198e++,_0xda434b=0x1){_0x901025=_0x901025[_0xcd0f('0x19')](getUserApplications(_0x4d419e,_0x561db3[_0x52198e],_0x561db3[_0x52198e][_0xcd0f('0x1a')]));if(_0x561db3[_0x52198e][_0xcd0f('0x1a')]!=_0x561db3[_0x52198e]['name']){_0x901025=_0x901025['concat'](getUserApplications(_0x4d419e,_0x561db3[_0x52198e],_0x561db3[_0x52198e][_0xcd0f('0x15')]));}}return _0x901025;};var getChanSpyPromise=function(_0x5b08f8,_0x491a58){return new BPromise(function(_0x411b45,_0x4f8c90){return _0x5b08f8[_0xcd0f('0x1b')]['findAll']({'attributes':['id',_0xcd0f('0x15'),_0xcd0f('0x1a')],'where':{'role':_0xcd0f('0x1c'),'chanspy':!![]},'raw':!![]})[_0xcd0f('0x1d')](function(_0x5dceab){if(_0x5dceab){return _0x411b45(getChanSpyApplications(_0x491a58,_0x5dceab));}return _0x411b45([]);})[_0xcd0f('0x1e')](function(_0x4f4aea){_0x4f8c90(_0x4f4aea);});});};module[_0xcd0f('0x1f')]=function(_0x159249,_0x173418){var _0x41e4bb=_0x159249[_0xcd0f('0x20')];return _0x159249[_0xcd0f('0x21')](_0xcd0f('0x22'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4d865b,_0x1f512a,_0x5e09aa){return getChanSpyPromise(_0x41e4bb,_0x4d865b)[_0xcd0f('0x1d')](function(_0xa1df18){if(_0xa1df18&&_0xa1df18['length']){return _0x41e4bb[_0xcd0f('0x23')][_0xcd0f('0x24')](_0xa1df18);}})[_0xcd0f('0x1d')](function(){_0x5e09aa();})['catch'](function(_0x527276){_0x5e09aa(_0x527276);});},'afterUpdate':function(_0x5967a5,_0x3b3357,_0x4e8e39){return _0x41e4bb['VoiceExtension'][_0xcd0f('0x25')]({'where':{'ChanSpyId':_0x5967a5['id']}})[_0xcd0f('0x1d')](function(){return getChanSpyPromise(_0x41e4bb,_0x5967a5);})[_0xcd0f('0x1d')](function(_0x210794){if(_0x210794&&_0x210794[_0xcd0f('0x18')]){return _0x41e4bb[_0xcd0f('0x23')][_0xcd0f('0x24')](_0x210794);}})[_0xcd0f('0x1d')](function(){_0x4e8e39();})[_0xcd0f('0x1e')](function(_0x1f6b7b){_0x4e8e39(_0x1f6b7b);});},'afterDestroy':function(_0x3330c1,_0x451bad,_0x470912){return _0x41e4bb[_0xcd0f('0x23')][_0xcd0f('0x25')]({'where':{'ChanSpyId':_0x3330c1['id']}})[_0xcd0f('0x1d')](function(){_0x470912();})[_0xcd0f('0x1e')](function(_0x23f05b){_0x470912(_0x23f05b);});}}});};
\ No newline at end of file
+var _0x7ce6=['record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','StopMixMonitor','concat','internal','User','findAll','agent','then','exports','models','define','length','VoiceExtension','bulkCreate','catch','destroy','util','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','chanspy'];(function(_0x230e39,_0x5341){var _0xa804e=function(_0xe14796){while(--_0xe14796){_0x230e39['push'](_0x230e39['shift']());}};_0xa804e(++_0x5341);}(_0x7ce6,0x11d));var _0x67ce=function(_0x159dc1,_0x31140b){_0x159dc1=_0x159dc1-0x0;var _0x37c7bd=_0x7ce6[_0x159dc1];return _0x37c7bd;};'use strict';var _=require('lodash');var util=require(_0x67ce('0x0'));var BPromise=require('bluebird');var attributes=require(_0x67ce('0x1'));var getUserApplications=function(_0x4a683d,_0x2f2752,_0x54e1e2){var _0xc0aa9f=0x1;var _0x38a50a=[];var _0x29079b={'context':_0x2f2752['context']||_0x67ce('0x2'),'exten':util[_0x67ce('0x3')](_0x67ce('0x4'),_0x4a683d[_0x67ce('0x5')],_0x54e1e2),'type':_0x67ce('0x6'),'isApp':![],'ChanSpyId':_0x4a683d['id'],'UserId':_0x2f2752['id']};_0x38a50a[_0x67ce('0x7')](_[_0x67ce('0x8')]({'app':_0x67ce('0x9'),'appdata':util[_0x67ce('0x3')]('CDR(type)=%s',_0x67ce('0xa')),'priority':_0xc0aa9f++},_0x29079b));if(_0x4a683d[_0x67ce('0xb')]){_0x38a50a['push'](_[_0x67ce('0x8')]({'app':_0x67ce('0xc'),'appdata':util[_0x67ce('0x3')](_0x67ce('0xd'),_0x4a683d[_0x67ce('0xe')]),'priority':_0xc0aa9f++},_0x29079b));}if(_0x4a683d[_0x67ce('0xf')]){_0x38a50a[_0x67ce('0x7')](_[_0x67ce('0x8')]({'app':_0x67ce('0x10'),'appdata':_0x4a683d[_0x67ce('0x11')],'priority':_0xc0aa9f++},_0x29079b));}_0x38a50a[_0x67ce('0x7')](_[_0x67ce('0x8')]({'app':_0x67ce('0x12'),'appdata':util[_0x67ce('0x3')](_0x67ce('0x13'),_0x2f2752[_0x67ce('0x14')],_0x4a683d[_0x67ce('0x15')]?_0x4a683d[_0x67ce('0x15')]['join'](''):''),'priority':_0xc0aa9f++},_0x29079b));if(_0x4a683d[_0x67ce('0xb')]){_0x38a50a['push'](_['merge']({'app':_0x67ce('0x16'),'priority':_0xc0aa9f++},_0x29079b));}return _0x38a50a;};var getChanSpyApplications=function(_0x56c28f,_0x7c2eeb){var _0x263b58=[];for(var _0x1ede3c=0x0,_0xd272af=0x1;_0x1ede3c<_0x7c2eeb['length'];_0x1ede3c++,_0xd272af=0x1){_0x263b58=_0x263b58[_0x67ce('0x17')](getUserApplications(_0x56c28f,_0x7c2eeb[_0x1ede3c],_0x7c2eeb[_0x1ede3c][_0x67ce('0x18')]));if(_0x7c2eeb[_0x1ede3c][_0x67ce('0x18')]!=_0x7c2eeb[_0x1ede3c][_0x67ce('0x14')]){_0x263b58=_0x263b58['concat'](getUserApplications(_0x56c28f,_0x7c2eeb[_0x1ede3c],_0x7c2eeb[_0x1ede3c][_0x67ce('0x14')]));}}return _0x263b58;};var getChanSpyPromise=function(_0x13b130,_0x4e8ed4){return new BPromise(function(_0x441669,_0x36efaf){return _0x13b130[_0x67ce('0x19')][_0x67ce('0x1a')]({'attributes':['id',_0x67ce('0x14'),_0x67ce('0x18')],'where':{'role':_0x67ce('0x1b'),'chanspy':!![]},'raw':!![]})[_0x67ce('0x1c')](function(_0x5355d9){if(_0x5355d9){return _0x441669(getChanSpyApplications(_0x4e8ed4,_0x5355d9));}return _0x441669([]);})['catch'](function(_0x29df4a){_0x36efaf(_0x29df4a);});});};module[_0x67ce('0x1d')]=function(_0x44b572,_0x6a81e7){var _0xebb270=_0x44b572[_0x67ce('0x1e')];return _0x44b572[_0x67ce('0x1f')]('VoiceChanSpy',attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f555a,_0x5e76e8,_0x27e935){return getChanSpyPromise(_0xebb270,_0x1f555a)['then'](function(_0x1b7812){if(_0x1b7812&&_0x1b7812[_0x67ce('0x20')]){return _0xebb270[_0x67ce('0x21')][_0x67ce('0x22')](_0x1b7812);}})[_0x67ce('0x1c')](function(){_0x27e935();})[_0x67ce('0x23')](function(_0xcdffe2){_0x27e935(_0xcdffe2);});},'afterUpdate':function(_0x5782c7,_0x165007,_0x2a192d){return _0xebb270[_0x67ce('0x21')][_0x67ce('0x24')]({'where':{'ChanSpyId':_0x5782c7['id']}})[_0x67ce('0x1c')](function(){return getChanSpyPromise(_0xebb270,_0x5782c7);})[_0x67ce('0x1c')](function(_0x29216e){if(_0x29216e&&_0x29216e[_0x67ce('0x20')]){return _0xebb270[_0x67ce('0x21')][_0x67ce('0x22')](_0x29216e);}})[_0x67ce('0x1c')](function(){_0x2a192d();})[_0x67ce('0x23')](function(_0xa4172){_0x2a192d(_0xa4172);});},'afterDestroy':function(_0x55fb29,_0xc728bf,_0x22198f){return _0xebb270[_0x67ce('0x21')][_0x67ce('0x24')]({'where':{'ChanSpyId':_0x55fb29['id']}})[_0x67ce('0x1c')](function(){_0x22198f();})[_0x67ce('0x23')](function(_0x24fa5c){_0x22198f(_0x24fa5c);});}}});};
\ No newline at end of file
index b09cf3a..b83aa9d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x16d2=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x16d2,0x123));var _0x216d=function(_0x371c0c,_0x4c16ae){_0x371c0c=_0x371c0c-0x0;var _0x3daee3=_0x16d2[_0x371c0c];return _0x3daee3;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});}
\ No newline at end of file
+var _0xeffd=['stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s'];(function(_0x2bc8a2,_0x4ddb0c){var _0x81b093=function(_0x174854){while(--_0x174854){_0x2bc8a2['push'](_0x2bc8a2['shift']());}};_0x81b093(++_0x4ddb0c);}(_0xeffd,0x6b));var _0xdeff=function(_0x4f06fa,_0x31c38b){_0x4f06fa=_0x4f06fa-0x0;var _0x25c1a1=_0xeffd[_0x4f06fa];return _0x25c1a1;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});}
\ No newline at end of file
index 31916d2..18f3de8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff6d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x5d3f52,_0x20c468){var _0x128fe1=function(_0x32bbba){while(--_0x32bbba){_0x5d3f52['push'](_0x5d3f52['shift']());}};_0x128fe1(++_0x20c468);}(_0xff6d,0x1ce));var _0xdff6=function(_0xef69ae,_0x433252){_0xef69ae=_0xef69ae-0x0;var _0x290406=_0xff6d[_0xef69ae];return _0x290406;};'use strict';var multer=require(_0xdff6('0x0'));var util=require(_0xdff6('0x1'));var path=require(_0xdff6('0x2'));var timeout=require(_0xdff6('0x3'));var express=require(_0xdff6('0x4'));var router=express[_0xdff6('0x5')]();var fs_extra=require(_0xdff6('0x6'));var auth=require(_0xdff6('0x7'));var interaction=require(_0xdff6('0x8'));var config=require(_0xdff6('0x9'));var controller=require(_0xdff6('0xa'));router[_0xdff6('0xb')]('/',auth[_0xdff6('0xc')](),controller[_0xdff6('0xd')]);router['get'](_0xdff6('0xe'),auth[_0xdff6('0xc')](),controller['show']);router[_0xdff6('0xf')]('/',auth['isAuthenticated'](),controller[_0xdff6('0x10')]);router[_0xdff6('0x11')](_0xdff6('0xe'),auth[_0xdff6('0xc')](),controller[_0xdff6('0x12')]);router[_0xdff6('0x13')](_0xdff6('0xe'),auth['isAuthenticated'](),controller[_0xdff6('0x14')]);module['exports']=router;
\ No newline at end of file
+var _0x39a2=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','show','post','put','/:id','update','delete','exports'];(function(_0x3afaf6,_0x3336a7){var _0x49d92c=function(_0x388064){while(--_0x388064){_0x3afaf6['push'](_0x3afaf6['shift']());}};_0x49d92c(++_0x3336a7);}(_0x39a2,0x121));var _0x239a=function(_0x4dbdda,_0x11f07c){_0x4dbdda=_0x4dbdda-0x0;var _0x1acbf1=_0x39a2[_0x4dbdda];return _0x1acbf1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x239a('0x0'));var timeout=require(_0x239a('0x1'));var express=require(_0x239a('0x2'));var router=express['Router']();var fs_extra=require(_0x239a('0x3'));var auth=require(_0x239a('0x4'));var interaction=require(_0x239a('0x5'));var config=require(_0x239a('0x6'));var controller=require(_0x239a('0x7'));router['get']('/',auth[_0x239a('0x8')](),controller[_0x239a('0x9')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x239a('0xa')]);router[_0x239a('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x239a('0xc')](_0x239a('0xd'),auth['isAuthenticated'](),controller[_0x239a('0xe')]);router[_0x239a('0xf')](_0x239a('0xd'),auth[_0x239a('0x8')](),controller['destroy']);module[_0x239a('0x10')]=router;
\ No newline at end of file
index ecf1ea8..f16fc84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x04f0=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x04f0,0xb1));var _0x004f=function(_0x36bedc,_0x5b70a2){_0x36bedc=_0x36bedc-0x0;var _0x2ca706=_0x04f0[_0x36bedc];return _0x2ca706;};'use strict';var Sequelize=require(_0x004f('0x0'));module[_0x004f('0x1')]={'name':{'type':Sequelize[_0x004f('0x2')],'unique':_0x004f('0x3')},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x004f('0x4')],'defaultValue':0x0}};
\ No newline at end of file
+var _0xe33a=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x290741,_0x53c0d9){var _0xfced6f=function(_0x3c00f7){while(--_0x3c00f7){_0x290741['push'](_0x290741['shift']());}};_0xfced6f(++_0x53c0d9);}(_0xe33a,0x7c));var _0xae33=function(_0x2d976e,_0x28b640){_0x2d976e=_0x2d976e-0x0;var _0x454f6f=_0xe33a[_0x2d976e];return _0x454f6f;};'use strict';var Sequelize=require(_0xae33('0x0'));module[_0xae33('0x1')]={'name':{'type':Sequelize[_0xae33('0x2')],'unique':_0xae33('0x3')},'description':{'type':Sequelize[_0xae33('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xae33('0x4')],'defaultValue':0x0}};
\ No newline at end of file
index 3b84a6e..d2b1614 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7fdf=['VoiceContext','includeAll','include','catch','show','keys','create','body','findAll','readFileSync','root','server/files/templates/context.ejs','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','join','utf8','render','writeFileSync','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','Contexts','UserProfileResource','end','sendStatus','name','send','index','rawAttributes','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','type','options'];(function(_0x383158,_0x415e43){var _0x507985=function(_0x1e498e){while(--_0x1e498e){_0x383158['push'](_0x383158['shift']());}};_0x507985(++_0x415e43);}(_0x7fdf,0x7f));var _0xf7fd=function(_0x237398,_0xc0ef22){_0x237398=_0x237398-0x0;var _0x5598de=_0x7fdf[_0x237398];return _0x5598de;};'use strict';var emlformat=require(_0xf7fd('0x0'));var rimraf=require(_0xf7fd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf7fd('0x2'));var moment=require(_0xf7fd('0x3'));var BPromise=require(_0xf7fd('0x4'));var Mustache=require(_0xf7fd('0x5'));var util=require(_0xf7fd('0x6'));var path=require('path');var sox=require(_0xf7fd('0x7'));var csv=require(_0xf7fd('0x8'));var ejs=require(_0xf7fd('0x9'));var fs=require('fs');var fs_extra=require(_0xf7fd('0xa'));var _=require(_0xf7fd('0xb'));var squel=require(_0xf7fd('0xc'));var crypto=require('crypto');var jsforce=require(_0xf7fd('0xd'));var deskjs=require(_0xf7fd('0xe'));var toCsv=require(_0xf7fd('0x8'));var querystring=require(_0xf7fd('0xf'));var Papa=require(_0xf7fd('0x10'));var Redis=require(_0xf7fd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf7fd('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf7fd('0x13'));var logger=require('../../config/logger')(_0xf7fd('0x14'));var utils=require('../../config/utils');var config=require(_0xf7fd('0x15'));var licenseUtil=require(_0xf7fd('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xf7fd('0x17')][_0xf7fd('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x280d4e,_0x241061,_0x3e7cd5,_0x2e14fd){return new BPromise(function(_0x53a05f,_0x271655){var _0x2b1c0c=_0x2e14fd||client;return _0x2b1c0c[_0xf7fd('0x19')](_0x280d4e,_0x3e7cd5)[_0xf7fd('0x1a')](function(_0xa979){logger[_0xf7fd('0x1b')](_0xf7fd('0x1c'),_0x241061,'request\x20sent');logger[_0xf7fd('0x1d')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x241061,'request\x20sent',JSON[_0xf7fd('0x1e')](_0xa979));if(_0xa979[_0xf7fd('0x1f')]){if(_0xa979['error']['code']===0x1f4){logger[_0xf7fd('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x241061,_0xa979['error'][_0xf7fd('0x20')]);return _0x271655(_0xa979[_0xf7fd('0x1f')][_0xf7fd('0x20')]);}logger[_0xf7fd('0x1f')](_0xf7fd('0x1c'),_0x241061,_0xa979[_0xf7fd('0x1f')][_0xf7fd('0x20')]);return _0x53a05f(_0xa979[_0xf7fd('0x1f')][_0xf7fd('0x20')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x241061,_0xf7fd('0x21'));_0x53a05f(_0xa979['result'][_0xf7fd('0x20')]);}})['catch'](function(_0x1dd8da){logger[_0xf7fd('0x1f')](_0xf7fd('0x1c'),_0x241061,_0x1dd8da);_0x271655(_0x1dd8da);});});}function respondWithStatusCode(_0x2f0084,_0x4cc15d){_0x4cc15d=_0x4cc15d||0xcc;return function(_0xc5503d){if(_0xc5503d){return _0x2f0084['sendStatus'](_0x4cc15d);}return _0x2f0084[_0xf7fd('0x22')](_0x4cc15d)['end']();};}function respondWithResult(_0x42b176,_0x3ad6de){_0x3ad6de=_0x3ad6de||0xc8;return function(_0x238b41){if(_0x238b41){return _0x42b176[_0xf7fd('0x22')](_0x3ad6de)[_0xf7fd('0x23')](_0x238b41);}};}function respondWithFilteredResult(_0x2a3202,_0x4fd0fe){return function(_0xbe5392){if(_0xbe5392){var _0x370221=typeof _0x4fd0fe[_0xf7fd('0x24')]===_0xf7fd('0x25')&&typeof _0x4fd0fe[_0xf7fd('0x26')]===_0xf7fd('0x25');var _0x5975fd=_0xbe5392[_0xf7fd('0x27')];var _0x563e46=_0x370221?0x0:_0x4fd0fe[_0xf7fd('0x24')];var _0x115bae=_0x370221?_0xbe5392[_0xf7fd('0x27')]:_0x4fd0fe['offset']+_0x4fd0fe[_0xf7fd('0x26')];var _0x5f1699;if(_0x115bae>=_0x5975fd){_0x115bae=_0x5975fd;_0x5f1699=0xc8;}else{_0x5f1699=0xce;}_0x2a3202['status'](_0x5f1699);return _0x2a3202['set'](_0xf7fd('0x28'),_0x563e46+'-'+_0x115bae+'/'+_0x5975fd)['json'](_0xbe5392);}return null;};}function patchUpdates(_0x2d7451){return function(_0x41dc27){try{jsonpatch[_0xf7fd('0x29')](_0x41dc27,_0x2d7451,!![]);}catch(_0x559444){return BPromise[_0xf7fd('0x2a')](_0x559444);}return _0x41dc27['save']();};}function saveUpdates(_0xf4a542,_0x4d4c1d){return function(_0x38860b){if(_0x38860b){return _0x38860b[_0xf7fd('0x2b')](_0xf4a542)['then'](function(_0x26df9f){return _0x26df9f;});}return null;};}function removeEntity(_0x5075da,_0x566299){return function(_0x23aaba){if(_0x23aaba){return _0x23aaba[_0xf7fd('0x2c')]()[_0xf7fd('0x1a')](function(){var _0x15c1e7=_0x23aaba['get']({'plain':!![]});var _0x2879cf=_0xf7fd('0x2d');return db[_0xf7fd('0x2e')][_0xf7fd('0x2c')]({'where':{'type':_0x2879cf,'resourceId':_0x15c1e7['id']}})[_0xf7fd('0x1a')](function(){return _0x23aaba;});})[_0xf7fd('0x1a')](function(){_0x5075da[_0xf7fd('0x22')](0xcc)[_0xf7fd('0x2f')]();});}};}function handleEntityNotFound(_0x573320,_0x56184b){return function(_0x15fa7e){if(!_0x15fa7e){_0x573320[_0xf7fd('0x30')](0x194);}return _0x15fa7e;};}function handleError(_0x53bed6,_0x2d78f0){_0x2d78f0=_0x2d78f0||0x1f4;return function(_0x316318){logger[_0xf7fd('0x1f')](_0x316318['stack']);if(_0x316318[_0xf7fd('0x31')]){delete _0x316318['name'];}_0x53bed6[_0xf7fd('0x22')](_0x2d78f0)[_0xf7fd('0x32')](_0x316318);};}exports[_0xf7fd('0x33')]=function(_0x3793f6,_0x15e8db){var _0x1474ce={},_0x143778={},_0x12db2d={'count':0x0,'rows':[]};var _0x1538ac=_['map'](db['VoiceContext'][_0xf7fd('0x34')],function(_0x44d160){return{'name':_0x44d160['fieldName'],'type':_0x44d160['type']['key']};});_0x143778['model']=_['map'](_0x1538ac,_0xf7fd('0x31'));_0x143778['query']=_['keys'](_0x3793f6[_0xf7fd('0x35')]);_0x143778[_0xf7fd('0x36')]=_[_0xf7fd('0x37')](_0x143778[_0xf7fd('0x38')],_0x143778[_0xf7fd('0x35')]);_0x1474ce['attributes']=_[_0xf7fd('0x37')](_0x143778[_0xf7fd('0x38')],qs['fields'](_0x3793f6[_0xf7fd('0x35')][_0xf7fd('0x39')]));_0x1474ce[_0xf7fd('0x3a')]=_0x1474ce[_0xf7fd('0x3a')][_0xf7fd('0x3b')]?_0x1474ce[_0xf7fd('0x3a')]:_0x143778['model'];if(!_0x3793f6[_0xf7fd('0x35')][_0xf7fd('0x3c')](_0xf7fd('0x3d'))){_0x1474ce['limit']=qs[_0xf7fd('0x26')](_0x3793f6[_0xf7fd('0x35')]['limit']);_0x1474ce['offset']=qs[_0xf7fd('0x24')](_0x3793f6[_0xf7fd('0x35')]['offset']);}_0x1474ce[_0xf7fd('0x3e')]=qs[_0xf7fd('0x3f')](_0x3793f6[_0xf7fd('0x35')][_0xf7fd('0x3f')]);_0x1474ce['where']=qs[_0xf7fd('0x36')](_[_0xf7fd('0x40')](_0x3793f6[_0xf7fd('0x35')],_0x143778[_0xf7fd('0x36')]),_0x1538ac);if(_0x3793f6[_0xf7fd('0x35')][_0xf7fd('0x41')]){_0x1474ce[_0xf7fd('0x42')]=_[_0xf7fd('0x43')](_0x1474ce[_0xf7fd('0x42')],{'$or':_[_0xf7fd('0x44')](_0x1538ac,function(_0x249e1e){if(_0x249e1e[_0xf7fd('0x45')]!=='VIRTUAL'){var _0x28f2ab={};_0x28f2ab[_0x249e1e[_0xf7fd('0x31')]]={'$like':'%'+_0x3793f6[_0xf7fd('0x35')][_0xf7fd('0x41')]+'%'};return _0x28f2ab;}})});}_0x1474ce=_[_0xf7fd('0x43')]({},_0x1474ce,_0x3793f6[_0xf7fd('0x46')]);var _0x3d5ec4={'where':_0x1474ce[_0xf7fd('0x42')]};return db[_0xf7fd('0x47')][_0xf7fd('0x27')](_0x3d5ec4)[_0xf7fd('0x1a')](function(_0x5d8a2e){_0x12db2d[_0xf7fd('0x27')]=_0x5d8a2e;if(_0x3793f6[_0xf7fd('0x35')][_0xf7fd('0x48')]){_0x1474ce[_0xf7fd('0x49')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1474ce);})['then'](function(_0x2dd672){_0x12db2d['rows']=_0x2dd672;return _0x12db2d;})['then'](respondWithFilteredResult(_0x15e8db,_0x1474ce))[_0xf7fd('0x4a')](handleError(_0x15e8db,null));};exports[_0xf7fd('0x4b')]=function(_0x53049a,_0x417a0e){var _0x1de066={'raw':![],'where':{'id':_0x53049a['params']['id']}},_0x13d348={};_0x13d348[_0xf7fd('0x38')]=_[_0xf7fd('0x4c')](db[_0xf7fd('0x47')][_0xf7fd('0x34')]);_0x13d348[_0xf7fd('0x35')]=_['keys'](_0x53049a[_0xf7fd('0x35')]);_0x13d348[_0xf7fd('0x36')]=_[_0xf7fd('0x37')](_0x13d348[_0xf7fd('0x38')],_0x13d348[_0xf7fd('0x35')]);_0x1de066['attributes']=_[_0xf7fd('0x37')](_0x13d348[_0xf7fd('0x38')],qs[_0xf7fd('0x39')](_0x53049a['query'][_0xf7fd('0x39')]));_0x1de066[_0xf7fd('0x3a')]=_0x1de066[_0xf7fd('0x3a')][_0xf7fd('0x3b')]?_0x1de066[_0xf7fd('0x3a')]:_0x13d348['model'];if(_0x53049a[_0xf7fd('0x35')]['includeAll']){_0x1de066[_0xf7fd('0x49')]=[{'all':!![]}];}_0x1de066=_['merge']({},_0x1de066,_0x53049a[_0xf7fd('0x46')]);return db[_0xf7fd('0x47')]['find'](_0x1de066)['then'](handleEntityNotFound(_0x417a0e,null))[_0xf7fd('0x1a')](respondWithResult(_0x417a0e,null))['catch'](handleError(_0x417a0e,null));};exports[_0xf7fd('0x4d')]=function(_0x246c1a,_0x48900e,_0x4d3d2d){var _0x29f8dc;return db['VoiceContext'][_0xf7fd('0x4d')](_0x246c1a[_0xf7fd('0x4e')],{'raw':!![]})[_0xf7fd('0x1a')](function(_0x23c85b){_0x29f8dc=_0x23c85b;return db[_0xf7fd('0x47')][_0xf7fd('0x4f')]({'raw':!![]});})[_0xf7fd('0x1a')](function(_0x4555c1){var _0x35b336=fs[_0xf7fd('0x50')](path['join'](config[_0xf7fd('0x51')],_0xf7fd('0x52')),'utf8');var _0x279d92=ejs['render'](_0x35b336,{'contexts':_0x4555c1||[]});fs['writeFileSync'](_0xf7fd('0x53'),_0x279d92);})['then'](function(){return respondWithRpcPromise(_0xf7fd('0x54'),_0xf7fd('0x4d'),{'module':_0xf7fd('0x55')});})[_0xf7fd('0x1a')](function(){var _0x3e9d9e=_0x246c1a[_0xf7fd('0x56')]['get']({'plain':!![]});if(!_0x3e9d9e)throw new Error(_0xf7fd('0x57'));if(_0x3e9d9e[_0xf7fd('0x58')]===_0xf7fd('0x56')){var _0x305502=_0x29f8dc[_0xf7fd('0x59')]({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xf7fd('0x2d'),'userProfileId':_0x3e9d9e[_0xf7fd('0x5a')]},'raw':!![]})['then'](function(_0x456589){if(_0x456589&&_0x456589[_0xf7fd('0x5b')]===0x0){return db[_0xf7fd('0x2e')][_0xf7fd('0x4d')]({'name':_0x305502[_0xf7fd('0x31')],'resourceId':_0x305502['id'],'type':_0x456589['name'],'sectionId':_0x456589['id']},{})[_0xf7fd('0x1a')](function(){return _0x29f8dc;});}else{return _0x29f8dc;}})[_0xf7fd('0x4a')](function(_0x41bb78){logger['error'](_0xf7fd('0x5c'),_0x41bb78);throw _0x41bb78;});}return _0x29f8dc;})['then'](respondWithResult(_0x48900e,0xc9))['catch'](handleError(_0x48900e,null));};exports['update']=function(_0x57bbdc,_0xaca436,_0x5508ee){var _0xbf7517;return db[_0xf7fd('0x47')][_0xf7fd('0x5d')]({'where':{'id':_0x57bbdc['params']['id']}})[_0xf7fd('0x1a')](handleEntityNotFound(_0xaca436,null))[_0xf7fd('0x1a')](saveUpdates(_0x57bbdc[_0xf7fd('0x4e')],null))[_0xf7fd('0x1a')](function(_0x57a85a){if(_0x57a85a){_0xbf7517=_0x57a85a;return db[_0xf7fd('0x47')][_0xf7fd('0x4f')]({'raw':!![]});}})['then'](function(_0xfaa194){var _0x37d6a=fs[_0xf7fd('0x50')](path[_0xf7fd('0x5e')](config[_0xf7fd('0x51')],_0xf7fd('0x52')),_0xf7fd('0x5f'));var _0x2992f3=ejs[_0xf7fd('0x60')](_0x37d6a,{'contexts':_0xfaa194||[]});fs[_0xf7fd('0x61')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2992f3);})[_0xf7fd('0x1a')](function(){return respondWithRpcPromise(_0xf7fd('0x54'),_0xf7fd('0x2b'),{'module':'chan_sip.so'});})[_0xf7fd('0x1a')](function(){return _0xbf7517;})[_0xf7fd('0x1a')](respondWithResult(_0xaca436,null))[_0xf7fd('0x4a')](handleError(_0xaca436,null));};exports[_0xf7fd('0x2c')]=function(_0xd7a472,_0x548a48,_0x1e1ca4){var _0x25990f;return db[_0xf7fd('0x47')]['find']({'where':{'id':_0xd7a472[_0xf7fd('0x62')]['id']}})[_0xf7fd('0x1a')](handleEntityNotFound(_0x548a48,null))['then'](removeEntity(_0x548a48,null))['then'](function(){return db['VoiceContext']['findAll']({'raw':!![]});})[_0xf7fd('0x1a')](function(_0x3fb820){var _0x51f891=fs['readFileSync'](path['join'](config[_0xf7fd('0x51')],_0xf7fd('0x52')),_0xf7fd('0x5f'));var _0x5edd04=ejs[_0xf7fd('0x60')](_0x51f891,{'contexts':_0x3fb820});fs[_0xf7fd('0x61')](_0xf7fd('0x53'),_0x5edd04);return respondWithRpcPromise(_0xf7fd('0x54'),'destroy',{'module':_0xf7fd('0x55')});})[_0xf7fd('0x4a')](handleError(_0x548a48,null));};
\ No newline at end of file
+var _0xb328=['../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','Contexts','UserProfileResource','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','VoiceContext','includeAll','rows','show','params','rawAttributes','keys','include','find','create','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','readFileSync','chan_sip.so','findAll','destroy','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x5a636f,_0x3fec2b){var _0x6a8cfb=function(_0x20e6ca){while(--_0x20e6ca){_0x5a636f['push'](_0x5a636f['shift']());}};_0x6a8cfb(++_0x3fec2b);}(_0xb328,0xb7));var _0x8b32=function(_0x2b4550,_0x1f55cf){_0x2b4550=_0x2b4550-0x0;var _0x9285e2=_0xb328[_0x2b4550];return _0x9285e2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x8b32('0x0'));var moment=require(_0x8b32('0x1'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8b32('0x2'));var path=require(_0x8b32('0x3'));var sox=require('sox');var csv=require(_0x8b32('0x4'));var ejs=require(_0x8b32('0x5'));var fs=require('fs');var fs_extra=require(_0x8b32('0x6'));var _=require('lodash');var squel=require(_0x8b32('0x7'));var crypto=require('crypto');var jsforce=require(_0x8b32('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8b32('0x9'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8b32('0xa'));var hardwareService=require(_0x8b32('0xb'));var logger=require('../../config/logger')(_0x8b32('0xc'));var utils=require(_0x8b32('0xd'));var config=require(_0x8b32('0xe'));var licenseUtil=require(_0x8b32('0xf'));var db=require('../../mysqldb')['db'];var jayson=require(_0x8b32('0x10'));var client=jayson[_0x8b32('0x11')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f78fe,_0xc0a24e,_0x363de9,_0x3e3c25){return new BPromise(function(_0x62ea8f,_0x39dcfb){var _0x2be68d=_0x3e3c25||client;return _0x2be68d[_0x8b32('0x12')](_0x5f78fe,_0x363de9)[_0x8b32('0x13')](function(_0x5f2f16){logger[_0x8b32('0x14')](_0x8b32('0x15'),_0xc0a24e,'request\x20sent');logger[_0x8b32('0x16')](_0x8b32('0x17'),_0xc0a24e,_0x8b32('0x18'),JSON['stringify'](_0x5f2f16));if(_0x5f2f16[_0x8b32('0x19')]){if(_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1a')]===0x1f4){logger[_0x8b32('0x19')](_0x8b32('0x15'),_0xc0a24e,_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1b')]);return _0x39dcfb(_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1b')]);}logger[_0x8b32('0x19')](_0x8b32('0x15'),_0xc0a24e,_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1b')]);return _0x62ea8f(_0x5f2f16[_0x8b32('0x19')][_0x8b32('0x1b')]);}else{logger[_0x8b32('0x14')](_0x8b32('0x15'),_0xc0a24e,_0x8b32('0x18'));_0x62ea8f(_0x5f2f16[_0x8b32('0x1c')][_0x8b32('0x1b')]);}})[_0x8b32('0x1d')](function(_0x17aea9){logger[_0x8b32('0x19')](_0x8b32('0x15'),_0xc0a24e,_0x17aea9);_0x39dcfb(_0x17aea9);});});}function respondWithStatusCode(_0x3b438a,_0x433175){_0x433175=_0x433175||0xcc;return function(_0x577d27){if(_0x577d27){return _0x3b438a[_0x8b32('0x1e')](_0x433175);}return _0x3b438a[_0x8b32('0x1f')](_0x433175)[_0x8b32('0x20')]();};}function respondWithResult(_0x2ad9db,_0x1ead2e){_0x1ead2e=_0x1ead2e||0xc8;return function(_0x5d480e){if(_0x5d480e){return _0x2ad9db[_0x8b32('0x1f')](_0x1ead2e)[_0x8b32('0x21')](_0x5d480e);}};}function respondWithFilteredResult(_0x2944cf,_0x4b3366){return function(_0x5e20ee){if(_0x5e20ee){var _0x11560f=typeof _0x4b3366['offset']===_0x8b32('0x22')&&typeof _0x4b3366['limit']==='undefined';var _0x536505=_0x5e20ee[_0x8b32('0x23')];var _0x3eaaec=_0x11560f?0x0:_0x4b3366[_0x8b32('0x24')];var _0x4f741e=_0x11560f?_0x5e20ee[_0x8b32('0x23')]:_0x4b3366[_0x8b32('0x24')]+_0x4b3366[_0x8b32('0x25')];var _0x57bd7c;if(_0x4f741e>=_0x536505){_0x4f741e=_0x536505;_0x57bd7c=0xc8;}else{_0x57bd7c=0xce;}_0x2944cf['status'](_0x57bd7c);return _0x2944cf[_0x8b32('0x26')](_0x8b32('0x27'),_0x3eaaec+'-'+_0x4f741e+'/'+_0x536505)[_0x8b32('0x21')](_0x5e20ee);}return null;};}function patchUpdates(_0x318220){return function(_0x2d86ee){try{jsonpatch[_0x8b32('0x28')](_0x2d86ee,_0x318220,!![]);}catch(_0x1ee27c){return BPromise[_0x8b32('0x29')](_0x1ee27c);}return _0x2d86ee[_0x8b32('0x2a')]();};}function saveUpdates(_0x12086d,_0x40fa1f){return function(_0x2c1700){if(_0x2c1700){return _0x2c1700['update'](_0x12086d)['then'](function(_0x52ecb0){return _0x52ecb0;});}return null;};}function removeEntity(_0x2ed0d9,_0x56085b){return function(_0x2f73d4){if(_0x2f73d4){return _0x2f73d4['destroy']()[_0x8b32('0x13')](function(){var _0x558201=_0x2f73d4['get']({'plain':!![]});var _0x42c096=_0x8b32('0x2b');return db[_0x8b32('0x2c')]['destroy']({'where':{'type':_0x42c096,'resourceId':_0x558201['id']}})['then'](function(){return _0x2f73d4;});})[_0x8b32('0x13')](function(){_0x2ed0d9[_0x8b32('0x1f')](0xcc)[_0x8b32('0x20')]();});}};}function handleEntityNotFound(_0x2dd85b,_0x377272){return function(_0x332020){if(!_0x332020){_0x2dd85b[_0x8b32('0x1e')](0x194);}return _0x332020;};}function handleError(_0x29e59c,_0x29393a){_0x29393a=_0x29393a||0x1f4;return function(_0x83198d){logger[_0x8b32('0x19')](_0x83198d['stack']);if(_0x83198d[_0x8b32('0x2d')]){delete _0x83198d['name'];}_0x29e59c[_0x8b32('0x1f')](_0x29393a)[_0x8b32('0x2e')](_0x83198d);};}exports[_0x8b32('0x2f')]=function(_0x5669eb,_0x450a6b){var _0xf01d3a={},_0x4560f5={},_0x58a94c={'count':0x0,'rows':[]};var _0x1c452e=_[_0x8b32('0x30')](db['VoiceContext']['rawAttributes'],function(_0xc9ce2a){return{'name':_0xc9ce2a[_0x8b32('0x31')],'type':_0xc9ce2a[_0x8b32('0x32')][_0x8b32('0x33')]};});_0x4560f5[_0x8b32('0x34')]=_[_0x8b32('0x30')](_0x1c452e,_0x8b32('0x2d'));_0x4560f5[_0x8b32('0x35')]=_['keys'](_0x5669eb['query']);_0x4560f5[_0x8b32('0x36')]=_[_0x8b32('0x37')](_0x4560f5['model'],_0x4560f5[_0x8b32('0x35')]);_0xf01d3a[_0x8b32('0x38')]=_[_0x8b32('0x37')](_0x4560f5[_0x8b32('0x34')],qs[_0x8b32('0x39')](_0x5669eb[_0x8b32('0x35')][_0x8b32('0x39')]));_0xf01d3a[_0x8b32('0x38')]=_0xf01d3a[_0x8b32('0x38')][_0x8b32('0x3a')]?_0xf01d3a[_0x8b32('0x38')]:_0x4560f5[_0x8b32('0x34')];if(!_0x5669eb['query'][_0x8b32('0x3b')](_0x8b32('0x3c'))){_0xf01d3a[_0x8b32('0x25')]=qs[_0x8b32('0x25')](_0x5669eb[_0x8b32('0x35')]['limit']);_0xf01d3a[_0x8b32('0x24')]=qs['offset'](_0x5669eb['query'][_0x8b32('0x24')]);}_0xf01d3a[_0x8b32('0x3d')]=qs[_0x8b32('0x3e')](_0x5669eb[_0x8b32('0x35')][_0x8b32('0x3e')]);_0xf01d3a[_0x8b32('0x3f')]=qs[_0x8b32('0x36')](_[_0x8b32('0x40')](_0x5669eb[_0x8b32('0x35')],_0x4560f5[_0x8b32('0x36')]),_0x1c452e);if(_0x5669eb[_0x8b32('0x35')]['filter']){_0xf01d3a[_0x8b32('0x3f')]=_[_0x8b32('0x41')](_0xf01d3a[_0x8b32('0x3f')],{'$or':_[_0x8b32('0x30')](_0x1c452e,function(_0xdc6293){if(_0xdc6293[_0x8b32('0x32')]!=='VIRTUAL'){var _0x4a52be={};_0x4a52be[_0xdc6293[_0x8b32('0x2d')]]={'$like':'%'+_0x5669eb[_0x8b32('0x35')]['filter']+'%'};return _0x4a52be;}})});}_0xf01d3a=_[_0x8b32('0x41')]({},_0xf01d3a,_0x5669eb[_0x8b32('0x42')]);var _0x42e4f0={'where':_0xf01d3a[_0x8b32('0x3f')]};return db[_0x8b32('0x43')]['count'](_0x42e4f0)['then'](function(_0x1fb784){_0x58a94c['count']=_0x1fb784;if(_0x5669eb['query'][_0x8b32('0x44')]){_0xf01d3a['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0xf01d3a);})[_0x8b32('0x13')](function(_0x16fd99){_0x58a94c[_0x8b32('0x45')]=_0x16fd99;return _0x58a94c;})[_0x8b32('0x13')](respondWithFilteredResult(_0x450a6b,_0xf01d3a))[_0x8b32('0x1d')](handleError(_0x450a6b,null));};exports[_0x8b32('0x46')]=function(_0x9e75fe,_0x88e52d){var _0x210710={'raw':![],'where':{'id':_0x9e75fe[_0x8b32('0x47')]['id']}},_0xccb6a0={};_0xccb6a0[_0x8b32('0x34')]=_['keys'](db['VoiceContext'][_0x8b32('0x48')]);_0xccb6a0['query']=_[_0x8b32('0x49')](_0x9e75fe['query']);_0xccb6a0[_0x8b32('0x36')]=_['intersection'](_0xccb6a0['model'],_0xccb6a0[_0x8b32('0x35')]);_0x210710['attributes']=_[_0x8b32('0x37')](_0xccb6a0[_0x8b32('0x34')],qs[_0x8b32('0x39')](_0x9e75fe[_0x8b32('0x35')][_0x8b32('0x39')]));_0x210710[_0x8b32('0x38')]=_0x210710[_0x8b32('0x38')][_0x8b32('0x3a')]?_0x210710[_0x8b32('0x38')]:_0xccb6a0['model'];if(_0x9e75fe[_0x8b32('0x35')][_0x8b32('0x44')]){_0x210710[_0x8b32('0x4a')]=[{'all':!![]}];}_0x210710=_[_0x8b32('0x41')]({},_0x210710,_0x9e75fe[_0x8b32('0x42')]);return db[_0x8b32('0x43')][_0x8b32('0x4b')](_0x210710)[_0x8b32('0x13')](handleEntityNotFound(_0x88e52d,null))['then'](respondWithResult(_0x88e52d,null))[_0x8b32('0x1d')](handleError(_0x88e52d,null));};exports[_0x8b32('0x4c')]=function(_0xb0191d,_0x555f9e,_0x468120){var _0x1d10f7;return db[_0x8b32('0x43')]['create'](_0xb0191d['body'],{'raw':!![]})[_0x8b32('0x13')](function(_0x45736e){_0x1d10f7=_0x45736e;return db['VoiceContext']['findAll']({'raw':!![]});})['then'](function(_0x1b95b5){var _0x2ca63b=fs['readFileSync'](path[_0x8b32('0x4d')](config[_0x8b32('0x4e')],_0x8b32('0x4f')),_0x8b32('0x50'));var _0x1ec13a=ejs[_0x8b32('0x51')](_0x2ca63b,{'contexts':_0x1b95b5||[]});fs[_0x8b32('0x52')](_0x8b32('0x53'),_0x1ec13a);})['then'](function(){return respondWithRpcPromise(_0x8b32('0x54'),_0x8b32('0x4c'),{'module':'chan_sip.so'});})[_0x8b32('0x13')](function(){var _0x16bdbd=_0xb0191d[_0x8b32('0x55')][_0x8b32('0x56')]({'plain':!![]});if(!_0x16bdbd)throw new Error(_0x8b32('0x57'));if(_0x16bdbd[_0x8b32('0x58')]===_0x8b32('0x55')){var _0x50a4c5=_0x1d10f7[_0x8b32('0x56')]({'plain':!![]});return db[_0x8b32('0x59')][_0x8b32('0x4b')]({'where':{'name':'Contexts','userProfileId':_0x16bdbd['userProfileId']},'raw':!![]})['then'](function(_0x5ae6ba){if(_0x5ae6ba&&_0x5ae6ba[_0x8b32('0x5a')]===0x0){return db[_0x8b32('0x2c')]['create']({'name':_0x50a4c5[_0x8b32('0x2d')],'resourceId':_0x50a4c5['id'],'type':_0x5ae6ba[_0x8b32('0x2d')],'sectionId':_0x5ae6ba['id']},{})[_0x8b32('0x13')](function(){return _0x1d10f7;});}else{return _0x1d10f7;}})[_0x8b32('0x1d')](function(_0x131d46){logger['error'](_0x8b32('0x5b'),_0x131d46);throw _0x131d46;});}return _0x1d10f7;})['then'](respondWithResult(_0x555f9e,0xc9))[_0x8b32('0x1d')](handleError(_0x555f9e,null));};exports[_0x8b32('0x5c')]=function(_0xececad,_0x1ef80d,_0x3025b5){var _0x45d0e2;return db[_0x8b32('0x43')][_0x8b32('0x4b')]({'where':{'id':_0xececad[_0x8b32('0x47')]['id']}})[_0x8b32('0x13')](handleEntityNotFound(_0x1ef80d,null))[_0x8b32('0x13')](saveUpdates(_0xececad[_0x8b32('0x5d')],null))['then'](function(_0x518b6f){if(_0x518b6f){_0x45d0e2=_0x518b6f;return db[_0x8b32('0x43')]['findAll']({'raw':!![]});}})[_0x8b32('0x13')](function(_0x49e8e2){var _0x997fde=fs[_0x8b32('0x5e')](path[_0x8b32('0x4d')](config[_0x8b32('0x4e')],_0x8b32('0x4f')),'utf8');var _0x4da3fd=ejs[_0x8b32('0x51')](_0x997fde,{'contexts':_0x49e8e2||[]});fs['writeFileSync'](_0x8b32('0x53'),_0x4da3fd);})[_0x8b32('0x13')](function(){return respondWithRpcPromise(_0x8b32('0x54'),_0x8b32('0x5c'),{'module':_0x8b32('0x5f')});})[_0x8b32('0x13')](function(){return _0x45d0e2;})[_0x8b32('0x13')](respondWithResult(_0x1ef80d,null))[_0x8b32('0x1d')](handleError(_0x1ef80d,null));};exports['destroy']=function(_0x55466a,_0x2e2d1e,_0x5cd41e){var _0x1fd605;return db['VoiceContext'][_0x8b32('0x4b')]({'where':{'id':_0x55466a[_0x8b32('0x47')]['id']}})[_0x8b32('0x13')](handleEntityNotFound(_0x2e2d1e,null))[_0x8b32('0x13')](removeEntity(_0x2e2d1e,null))['then'](function(){return db['VoiceContext'][_0x8b32('0x60')]({'raw':!![]});})[_0x8b32('0x13')](function(_0x41329a){var _0x12462e=fs[_0x8b32('0x5e')](path['join'](config[_0x8b32('0x4e')],_0x8b32('0x4f')),'utf8');var _0xac1fc7=ejs[_0x8b32('0x51')](_0x12462e,{'contexts':_0x41329a});fs[_0x8b32('0x52')](_0x8b32('0x53'),_0xac1fc7);return respondWithRpcPromise(_0x8b32('0x54'),_0x8b32('0x61'),{'module':_0x8b32('0x5f')});})[_0x8b32('0x1d')](handleError(_0x2e2d1e,null));};
\ No newline at end of file
index ad61d46..04fd801 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbca9=['voice_contexts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext'];(function(_0x1bb80c,_0x26d406){var _0x368f16=function(_0x4e37e5){while(--_0x4e37e5){_0x1bb80c['push'](_0x1bb80c['shift']());}};_0x368f16(++_0x26d406);}(_0xbca9,0x16d));var _0x9bca=function(_0x496480,_0x3660de){_0x496480=_0x496480-0x0;var _0x2ba568=_0xbca9[_0x496480];return _0x2ba568;};'use strict';var _=require(_0x9bca('0x0'));var util=require(_0x9bca('0x1'));var logger=require(_0x9bca('0x2'))(_0x9bca('0x3'));var moment=require(_0x9bca('0x4'));var BPromise=require(_0x9bca('0x5'));var rp=require(_0x9bca('0x6'));var fs=require('fs');var path=require(_0x9bca('0x7'));var rimraf=require('rimraf');var config=require(_0x9bca('0x8'));var attributes=require(_0x9bca('0x9'));module[_0x9bca('0xa')]=function(_0x26cd0a,_0x3c096f){return _0x26cd0a[_0x9bca('0xb')](_0x9bca('0xc'),attributes,{'tableName':_0x9bca('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xd7ca=['rimraf','../../config/environment','exports','define','VoiceContext','voice_contexts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0xd7ca,0xa0));var _0xad7c=function(_0x34e7ef,_0x531a94){_0x34e7ef=_0x34e7ef-0x0;var _0x595878=_0xd7ca[_0x34e7ef];return _0x595878;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xad7c('0x0'))(_0xad7c('0x1'));var moment=require(_0xad7c('0x2'));var BPromise=require(_0xad7c('0x3'));var rp=require(_0xad7c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad7c('0x5'));var config=require(_0xad7c('0x6'));var attributes=require('./voiceContext.attributes');module[_0xad7c('0x7')]=function(_0xf2244a,_0x1ddbc5){return _0xf2244a[_0xad7c('0x8')](_0xad7c('0x9'),attributes,{'tableName':_0xad7c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e961324..8124673 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d11=['../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','ioredis'];(function(_0xacadf9,_0x435886){var _0x1f2a17=function(_0x52a859){while(--_0x52a859){_0xacadf9['push'](_0xacadf9['shift']());}};_0x1f2a17(++_0x435886);}(_0x4d11,0x10f));var _0x14d1=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x4d11[_0x158da6];return _0x429c30;};'use strict';var _=require(_0x14d1('0x0'));var util=require(_0x14d1('0x1'));var moment=require(_0x14d1('0x2'));var BPromise=require(_0x14d1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x14d1('0x4'));var db=require(_0x14d1('0x5'))['db'];var utils=require(_0x14d1('0x6'));var logger=require(_0x14d1('0x7'))(_0x14d1('0x8'));var config=require('../../config/environment');var jayson=require(_0x14d1('0x9'));var client=jayson[_0x14d1('0xa')][_0x14d1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4676a7,_0x455e2d,_0x59fb56){return new BPromise(function(_0x37535e,_0x321ec1){return client['request'](_0x4676a7,_0x59fb56)[_0x14d1('0xc')](function(_0x5341c7){logger['info'](_0x14d1('0xd'),_0x455e2d,_0x14d1('0xe'));logger[_0x14d1('0xf')](_0x14d1('0x10'),_0x455e2d,_0x14d1('0xe'),JSON[_0x14d1('0x11')](_0x5341c7));if(_0x5341c7[_0x14d1('0x12')]){if(_0x5341c7[_0x14d1('0x12')][_0x14d1('0x13')]===0x1f4){logger[_0x14d1('0x12')]('VoiceContext,\x20%s,\x20%s',_0x455e2d,_0x5341c7['error'][_0x14d1('0x14')]);return _0x321ec1(_0x5341c7[_0x14d1('0x12')][_0x14d1('0x14')]);}logger[_0x14d1('0x12')](_0x14d1('0xd'),_0x455e2d,_0x5341c7[_0x14d1('0x12')][_0x14d1('0x14')]);return _0x37535e(_0x5341c7[_0x14d1('0x12')][_0x14d1('0x14')]);}else{logger[_0x14d1('0x15')](_0x14d1('0xd'),_0x455e2d,_0x14d1('0xe'));_0x37535e(_0x5341c7[_0x14d1('0x16')][_0x14d1('0x14')]);}})['catch'](function(_0x45de7c){logger['error'](_0x14d1('0xd'),_0x455e2d,_0x45de7c);_0x321ec1(_0x45de7c);});});}
\ No newline at end of file
+var _0x8135=['info','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x4c79f4,_0x1a9829){var _0x1a705b=function(_0xbc585b){while(--_0xbc585b){_0x4c79f4['push'](_0x4c79f4['shift']());}};_0x1a705b(++_0x1a9829);}(_0x8135,0x171));var _0x5813=function(_0x51a96a,_0xfd3e84){_0x51a96a=_0x51a96a-0x0;var _0x4207d8=_0x8135[_0x51a96a];return _0x4207d8;};'use strict';var _=require(_0x5813('0x0'));var util=require(_0x5813('0x1'));var moment=require('moment');var BPromise=require(_0x5813('0x2'));var rs=require(_0x5813('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5813('0x4'));var logger=require(_0x5813('0x5'))(_0x5813('0x6'));var config=require(_0x5813('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5813('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x517898,_0x4fd2c8,_0x5c6798){return new BPromise(function(_0x32f39e,_0x209cb3){return client[_0x5813('0x9')](_0x517898,_0x5c6798)[_0x5813('0xa')](function(_0x5a4be3){logger[_0x5813('0xb')](_0x5813('0xc'),_0x4fd2c8,_0x5813('0xd'));logger['debug'](_0x5813('0xe'),_0x4fd2c8,_0x5813('0xd'),JSON['stringify'](_0x5a4be3));if(_0x5a4be3[_0x5813('0xf')]){if(_0x5a4be3[_0x5813('0xf')][_0x5813('0x10')]===0x1f4){logger['error'](_0x5813('0xc'),_0x4fd2c8,_0x5a4be3[_0x5813('0xf')]['message']);return _0x209cb3(_0x5a4be3[_0x5813('0xf')]['message']);}logger[_0x5813('0xf')](_0x5813('0xc'),_0x4fd2c8,_0x5a4be3[_0x5813('0xf')]['message']);return _0x32f39e(_0x5a4be3[_0x5813('0xf')][_0x5813('0x11')]);}else{logger[_0x5813('0xb')](_0x5813('0xc'),_0x4fd2c8,_0x5813('0xd'));_0x32f39e(_0x5a4be3[_0x5813('0x12')]['message']);}})[_0x5813('0x13')](function(_0x16cbe5){logger[_0x5813('0xf')](_0x5813('0xc'),_0x4fd2c8,_0x16cbe5);_0x209cb3(_0x16cbe5);});});}
\ No newline at end of file
index 731953b..890a5ab 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda55=['../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','delete','destroy','multer','util','express','Router','fs-extra'];(function(_0x26b5ff,_0x92009a){var _0x58603e=function(_0x4454ff){while(--_0x4454ff){_0x26b5ff['push'](_0x26b5ff['shift']());}};_0x58603e(++_0x92009a);}(_0xda55,0x6d));var _0x5da5=function(_0x5b47cb,_0x21cfc4){_0x5b47cb=_0x5b47cb-0x0;var _0x1e615b=_0xda55[_0x5b47cb];return _0x1e615b;};'use strict';var multer=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5da5('0x2'));var router=express[_0x5da5('0x3')]();var fs_extra=require(_0x5da5('0x4'));var auth=require(_0x5da5('0x5'));var interaction=require(_0x5da5('0x6'));var config=require('../../config/environment');var controller=require(_0x5da5('0x7'));router['get']('/',auth[_0x5da5('0x8')](),controller['index']);router[_0x5da5('0x9')](_0x5da5('0xa'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xb')]);router[_0x5da5('0x9')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0xd')]);router['post']('/',auth[_0x5da5('0x8')](),controller[_0x5da5('0xe')]);router[_0x5da5('0xf')](_0x5da5('0xc'),auth[_0x5da5('0x8')](),controller[_0x5da5('0x10')]);router[_0x5da5('0x11')]('/:id',auth[_0x5da5('0x8')](),controller[_0x5da5('0x12')]);module['exports']=router;
\ No newline at end of file
+var _0xaab2=['show','post','create','put','update','delete','destroy','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x3f013d,_0x192af1){var _0x4481a3=function(_0x51de9f){while(--_0x51de9f){_0x3f013d['push'](_0x3f013d['shift']());}};_0x4481a3(++_0x192af1);}(_0xaab2,0x15b));var _0x2aab=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xaab2[_0x28947d];return _0x12d2ee;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2aab('0x0'));var timeout=require(_0x2aab('0x1'));var express=require(_0x2aab('0x2'));var router=express['Router']();var fs_extra=require(_0x2aab('0x3'));var auth=require(_0x2aab('0x4'));var interaction=require(_0x2aab('0x5'));var config=require('../../config/environment');var controller=require(_0x2aab('0x6'));router[_0x2aab('0x7')]('/',auth[_0x2aab('0x8')](),controller[_0x2aab('0x9')]);router[_0x2aab('0x7')](_0x2aab('0xa'),auth[_0x2aab('0x8')](),controller[_0x2aab('0xb')]);router[_0x2aab('0x7')](_0x2aab('0xc'),auth[_0x2aab('0x8')](),controller[_0x2aab('0xd')]);router[_0x2aab('0xe')]('/',auth['isAuthenticated'](),controller[_0x2aab('0xf')]);router[_0x2aab('0x10')](_0x2aab('0xc'),auth[_0x2aab('0x8')](),controller[_0x2aab('0x11')]);router[_0x2aab('0x12')]('/:id',auth[_0x2aab('0x8')](),controller[_0x2aab('0x13')]);module['exports']=router;
\ No newline at end of file
index 668b7ca..d199e97 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb821=['DATE','called,connect,complete','exports','STRING','INTEGER'];(function(_0x25c7fb,_0x2e4e86){var _0x214b77=function(_0x36b7c0){while(--_0x36b7c0){_0x25c7fb['push'](_0x25c7fb['shift']());}};_0x214b77(++_0x2e4e86);}(_0xb821,0xa7));var _0x1b82=function(_0x5aae31,_0x3fd0d5){_0x5aae31=_0x5aae31-0x0;var _0xce5daf=_0xb821[_0x5aae31];return _0xce5daf;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'privilege':{'type':Sequelize[_0x1b82('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x1b82('0x1')]},'connectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'language':{'type':Sequelize[_0x1b82('0x1')]},'accountcode':{'type':Sequelize[_0x1b82('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x1b82('0x1')]},'priority':{'type':Sequelize[_0x1b82('0x2')]},'uniqueid':{'type':Sequelize[_0x1b82('0x1')]},'linkedid':{'type':Sequelize[_0x1b82('0x1')]},'destchannel':{'type':Sequelize[_0x1b82('0x1')]},'destchannelstate':{'type':Sequelize[_0x1b82('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridnum':{'type':Sequelize[_0x1b82('0x1')]},'destcalleridname':{'type':Sequelize[_0x1b82('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x1b82('0x1')]},'destlanguage':{'type':Sequelize[_0x1b82('0x1')]},'destaccountcode':{'type':Sequelize[_0x1b82('0x1')]},'destcontext':{'type':Sequelize[_0x1b82('0x1')]},'destexten':{'type':Sequelize[_0x1b82('0x1')]},'destpriority':{'type':Sequelize[_0x1b82('0x2')]},'destuniqueid':{'type':Sequelize[_0x1b82('0x1')]},'destlinkedid':{'type':Sequelize[_0x1b82('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x1b82('0x1')]},'starttime':{'type':Sequelize[_0x1b82('0x3')]},'answertime':{'type':Sequelize[_0x1b82('0x3')]},'endtime':{'type':Sequelize[_0x1b82('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':_0x1b82('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x1b82('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
+var _0x6aa7=['called,connect,complete','sequelize','STRING','INTEGER','DATE'];(function(_0x1c9fa8,_0x48fb2f){var _0x20c648=function(_0x2773af){while(--_0x2773af){_0x1c9fa8['push'](_0x1c9fa8['shift']());}};_0x20c648(++_0x48fb2f);}(_0x6aa7,0x178));var _0x76aa=function(_0x66906b,_0x3da330){_0x66906b=_0x66906b-0x0;var _0x417902=_0x6aa7[_0x66906b];return _0x417902;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x2')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x2')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'linkedid':{'type':Sequelize[_0x76aa('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x76aa('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize[_0x76aa('0x1')]},'destaccountcode':{'type':Sequelize[_0x76aa('0x1')]},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize[_0x76aa('0x1')]},'destpriority':{'type':Sequelize[_0x76aa('0x2')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'destlinkedid':{'type':Sequelize[_0x76aa('0x1')]},'dialstring':{'type':Sequelize[_0x76aa('0x1')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x76aa('0x3')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x76aa('0x3')]},'lastevent':{'type':Sequelize[_0x76aa('0x1')],'comment':_0x76aa('0x4')},'routeId':{'type':Sequelize[_0x76aa('0x2')]},'duration':{'type':Sequelize[_0x76aa('0x2')]},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index 36e5958..62f477f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2165=['path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x367448,_0x3e9deb){var _0x28b046=function(_0x2c9ff8){while(--_0x2c9ff8){_0x367448['push'](_0x367448['shift']());}};_0x28b046(++_0x3e9deb);}(_0x2165,0xe0));var _0x5216=function(_0x2d1be7,_0x3df12e){_0x2d1be7=_0x2d1be7-0x0;var _0x4abad8=_0x2165[_0x2d1be7];return _0x4abad8;};'use strict';var emlformat=require(_0x5216('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5216('0x1'));var jsonpatch=require(_0x5216('0x2'));var rp=require(_0x5216('0x3'));var moment=require(_0x5216('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5216('0x5'));var util=require(_0x5216('0x6'));var path=require(_0x5216('0x7'));var sox=require(_0x5216('0x8'));var csv=require('to-csv');var ejs=require(_0x5216('0x9'));var fs=require('fs');var fs_extra=require(_0x5216('0xa'));var _=require('lodash');var squel=require(_0x5216('0xb'));var crypto=require(_0x5216('0xc'));var jsforce=require(_0x5216('0xd'));var deskjs=require(_0x5216('0xe'));var toCsv=require(_0x5216('0xf'));var querystring=require(_0x5216('0x10'));var Papa=require(_0x5216('0x11'));var Redis=require('ioredis');var authService=require(_0x5216('0x12'));var qs=require(_0x5216('0x13'));var as=require(_0x5216('0x14'));var hardwareService=require(_0x5216('0x15'));var logger=require(_0x5216('0x16'))('api');var utils=require(_0x5216('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5216('0x18'));var db=require(_0x5216('0x19'))['db'];function respondWithStatusCode(_0x2d2847,_0x211630){_0x211630=_0x211630||0xcc;return function(_0x40e5c5){if(_0x40e5c5){return _0x2d2847[_0x5216('0x1a')](_0x211630);}return _0x2d2847[_0x5216('0x1b')](_0x211630)[_0x5216('0x1c')]();};}function respondWithResult(_0x4e4ced,_0x1ab95c){_0x1ab95c=_0x1ab95c||0xc8;return function(_0x4ce83c){if(_0x4ce83c){return _0x4e4ced[_0x5216('0x1b')](_0x1ab95c)[_0x5216('0x1d')](_0x4ce83c);}};}function respondWithFilteredResult(_0x274c3c,_0xb8345a){return function(_0x2abe4b){if(_0x2abe4b){var _0x35a71a=typeof _0xb8345a[_0x5216('0x1e')]===_0x5216('0x1f')&&typeof _0xb8345a['limit']===_0x5216('0x1f');var _0x133d58=_0x2abe4b['count'];var _0x30e5d6=_0x35a71a?0x0:_0xb8345a[_0x5216('0x1e')];var _0x8ccfed=_0x35a71a?_0x2abe4b[_0x5216('0x20')]:_0xb8345a[_0x5216('0x1e')]+_0xb8345a['limit'];var _0x4717cd;if(_0x8ccfed>=_0x133d58){_0x8ccfed=_0x133d58;_0x4717cd=0xc8;}else{_0x4717cd=0xce;}_0x274c3c[_0x5216('0x1b')](_0x4717cd);return _0x274c3c[_0x5216('0x21')](_0x5216('0x22'),_0x30e5d6+'-'+_0x8ccfed+'/'+_0x133d58)[_0x5216('0x1d')](_0x2abe4b);}return null;};}function patchUpdates(_0x584b68){return function(_0x2f2d37){try{jsonpatch[_0x5216('0x23')](_0x2f2d37,_0x584b68,!![]);}catch(_0x9cb231){return BPromise[_0x5216('0x24')](_0x9cb231);}return _0x2f2d37[_0x5216('0x25')]();};}function saveUpdates(_0xa86810,_0x52fae0){return function(_0x30ece9){if(_0x30ece9){return _0x30ece9[_0x5216('0x26')](_0xa86810)['then'](function(_0x1f455c){return _0x1f455c;});}return null;};}function removeEntity(_0x46f4b8,_0x1f903c){return function(_0x57888c){if(_0x57888c){return _0x57888c[_0x5216('0x27')]()[_0x5216('0x28')](function(){_0x46f4b8[_0x5216('0x1b')](0xcc)[_0x5216('0x1c')]();});}};}function handleEntityNotFound(_0x5a9034,_0x411573){return function(_0x58673c){if(!_0x58673c){_0x5a9034[_0x5216('0x1a')](0x194);}return _0x58673c;};}function handleError(_0x154bb8,_0x57824f){_0x57824f=_0x57824f||0x1f4;return function(_0x5094fe){logger['error'](_0x5094fe['stack']);if(_0x5094fe['name']){delete _0x5094fe[_0x5216('0x29')];}_0x154bb8['status'](_0x57824f)[_0x5216('0x2a')](_0x5094fe);};}exports[_0x5216('0x2b')]=function(_0x2d96aa,_0x25078d){var _0x4312b7={},_0x57a0c9={},_0x4d29c4={'count':0x0,'rows':[]};var _0x24de22=_[_0x5216('0x2c')](db[_0x5216('0x2d')][_0x5216('0x2e')],function(_0x4c8ece){return{'name':_0x4c8ece[_0x5216('0x2f')],'type':_0x4c8ece[_0x5216('0x30')][_0x5216('0x31')]};});_0x57a0c9[_0x5216('0x32')]=_[_0x5216('0x2c')](_0x24de22,_0x5216('0x29'));_0x57a0c9[_0x5216('0x33')]=_[_0x5216('0x34')](_0x2d96aa['query']);_0x57a0c9['filters']=_[_0x5216('0x35')](_0x57a0c9[_0x5216('0x32')],_0x57a0c9[_0x5216('0x33')]);_0x4312b7[_0x5216('0x36')]=_['intersection'](_0x57a0c9[_0x5216('0x32')],qs[_0x5216('0x37')](_0x2d96aa['query'][_0x5216('0x37')]));_0x4312b7[_0x5216('0x36')]=_0x4312b7[_0x5216('0x36')][_0x5216('0x38')]?_0x4312b7[_0x5216('0x36')]:_0x57a0c9[_0x5216('0x32')];if(!_0x2d96aa[_0x5216('0x33')][_0x5216('0x39')]('nolimit')){_0x4312b7[_0x5216('0x3a')]=qs[_0x5216('0x3a')](_0x2d96aa[_0x5216('0x33')]['limit']);_0x4312b7[_0x5216('0x1e')]=qs[_0x5216('0x1e')](_0x2d96aa[_0x5216('0x33')][_0x5216('0x1e')]);}_0x4312b7['order']=qs[_0x5216('0x3b')](_0x2d96aa[_0x5216('0x33')][_0x5216('0x3b')]);_0x4312b7['where']=qs[_0x5216('0x3c')](_[_0x5216('0x3d')](_0x2d96aa[_0x5216('0x33')],_0x57a0c9['filters']),_0x24de22);if(_0x2d96aa[_0x5216('0x33')][_0x5216('0x3e')]){_0x4312b7[_0x5216('0x3f')]=_[_0x5216('0x40')](_0x4312b7[_0x5216('0x3f')],{'$or':_[_0x5216('0x2c')](_0x24de22,function(_0x3df06b){if(_0x3df06b[_0x5216('0x30')]!==_0x5216('0x41')){var _0x4e29de={};_0x4e29de[_0x3df06b['name']]={'$like':'%'+_0x2d96aa[_0x5216('0x33')][_0x5216('0x3e')]+'%'};return _0x4e29de;}})});}_0x4312b7=_[_0x5216('0x40')]({},_0x4312b7,_0x2d96aa['options']);var _0x5a49f5={'where':_0x4312b7[_0x5216('0x3f')]};return db['VoiceDialReport'][_0x5216('0x20')](_0x5a49f5)[_0x5216('0x28')](function(_0xdcd8ab){_0x4d29c4[_0x5216('0x20')]=_0xdcd8ab;if(_0x2d96aa[_0x5216('0x33')][_0x5216('0x42')]){_0x4312b7[_0x5216('0x43')]=[{'all':!![]}];}return db[_0x5216('0x2d')]['findAll'](_0x4312b7);})[_0x5216('0x28')](function(_0x4b774a){_0x4d29c4[_0x5216('0x44')]=_0x4b774a;return _0x4d29c4;})['then'](respondWithFilteredResult(_0x25078d,_0x4312b7))[_0x5216('0x45')](handleError(_0x25078d,null));};exports[_0x5216('0x46')]=function(_0x360316,_0x49eb8b){var _0x1fa270={'raw':!![],'where':{'id':_0x360316[_0x5216('0x47')]['id']}},_0x2e75c2={};_0x2e75c2[_0x5216('0x32')]=_[_0x5216('0x34')](db[_0x5216('0x2d')]['rawAttributes']);_0x2e75c2[_0x5216('0x33')]=_[_0x5216('0x34')](_0x360316[_0x5216('0x33')]);_0x2e75c2[_0x5216('0x3c')]=_[_0x5216('0x35')](_0x2e75c2[_0x5216('0x32')],_0x2e75c2['query']);_0x1fa270['attributes']=_[_0x5216('0x35')](_0x2e75c2[_0x5216('0x32')],qs[_0x5216('0x37')](_0x360316['query'][_0x5216('0x37')]));_0x1fa270[_0x5216('0x36')]=_0x1fa270['attributes'][_0x5216('0x38')]?_0x1fa270['attributes']:_0x2e75c2[_0x5216('0x32')];if(_0x360316[_0x5216('0x33')][_0x5216('0x42')]){_0x1fa270[_0x5216('0x43')]=[{'all':!![]}];}_0x1fa270=_[_0x5216('0x40')]({},_0x1fa270,_0x360316[_0x5216('0x48')]);return db[_0x5216('0x2d')]['find'](_0x1fa270)['then'](handleEntityNotFound(_0x49eb8b,null))[_0x5216('0x28')](respondWithResult(_0x49eb8b,null))[_0x5216('0x45')](handleError(_0x49eb8b,null));};exports[_0x5216('0x49')]=function(_0x472b38,_0x4aed1a){return db[_0x5216('0x2d')][_0x5216('0x49')](_0x472b38[_0x5216('0x4a')],{})[_0x5216('0x28')](respondWithResult(_0x4aed1a,0xc9))[_0x5216('0x45')](handleError(_0x4aed1a,null));};exports['update']=function(_0xfa73fe,_0x8ceb50){if(_0xfa73fe[_0x5216('0x4a')]['id']){delete _0xfa73fe['body']['id'];}return db[_0x5216('0x2d')][_0x5216('0x4b')]({'where':{'id':_0xfa73fe['params']['id']}})['then'](handleEntityNotFound(_0x8ceb50,null))[_0x5216('0x28')](saveUpdates(_0xfa73fe[_0x5216('0x4a')],null))[_0x5216('0x28')](respondWithResult(_0x8ceb50,null))[_0x5216('0x45')](handleError(_0x8ceb50,null));};exports['destroy']=function(_0x21801b,_0x19d62f){return db[_0x5216('0x2d')][_0x5216('0x4b')]({'where':{'id':_0x21801b[_0x5216('0x47')]['id']}})[_0x5216('0x28')](handleEntityNotFound(_0x19d62f,null))[_0x5216('0x28')](removeEntity(_0x19d62f,null))[_0x5216('0x45')](handleError(_0x19d62f,null));};exports[_0x5216('0x4c')]=function(_0x37dd30,_0x488b3b){return db['VoiceDialReport'][_0x5216('0x4c')]()[_0x5216('0x28')](respondWithResult(_0x488b3b,null))['catch'](handleError(_0x488b3b,null));};
\ No newline at end of file
+var _0x2b5f=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','rawAttributes','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','where','merge','VIRTUAL','VoiceDialReport','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x2b5f,0x15d));var _0xf2b5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x2b5f[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2b5('0x0'));var zipdir=require(_0xf2b5('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2b5('0x2'));var moment=require(_0xf2b5('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf2b5('0x4'));var sox=require(_0xf2b5('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2b5('0x6'));var _=require(_0xf2b5('0x7'));var squel=require(_0xf2b5('0x8'));var crypto=require(_0xf2b5('0x9'));var jsforce=require(_0xf2b5('0xa'));var deskjs=require(_0xf2b5('0xb'));var toCsv=require(_0xf2b5('0xc'));var querystring=require(_0xf2b5('0xd'));var Papa=require(_0xf2b5('0xe'));var Redis=require(_0xf2b5('0xf'));var authService=require(_0xf2b5('0x10'));var qs=require(_0xf2b5('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2b5('0x12'));var logger=require(_0xf2b5('0x13'))('api');var utils=require(_0xf2b5('0x14'));var config=require(_0xf2b5('0x15'));var licenseUtil=require(_0xf2b5('0x16'));var db=require(_0xf2b5('0x17'))['db'];function respondWithStatusCode(_0x5b3cf3,_0x4d63fe){_0x4d63fe=_0x4d63fe||0xcc;return function(_0x31d070){if(_0x31d070){return _0x5b3cf3[_0xf2b5('0x18')](_0x4d63fe);}return _0x5b3cf3[_0xf2b5('0x19')](_0x4d63fe)[_0xf2b5('0x1a')]();};}function respondWithResult(_0x2768a2,_0x4a8bfb){_0x4a8bfb=_0x4a8bfb||0xc8;return function(_0xa9bc62){if(_0xa9bc62){return _0x2768a2['status'](_0x4a8bfb)['json'](_0xa9bc62);}};}function respondWithFilteredResult(_0x6270f5,_0x58d224){return function(_0x5163d4){if(_0x5163d4){var _0x450678=typeof _0x58d224[_0xf2b5('0x1b')]==='undefined'&&typeof _0x58d224['limit']===_0xf2b5('0x1c');var _0x1134b4=_0x5163d4[_0xf2b5('0x1d')];var _0x27a857=_0x450678?0x0:_0x58d224[_0xf2b5('0x1b')];var _0x1d806b=_0x450678?_0x5163d4[_0xf2b5('0x1d')]:_0x58d224['offset']+_0x58d224[_0xf2b5('0x1e')];var _0x497844;if(_0x1d806b>=_0x1134b4){_0x1d806b=_0x1134b4;_0x497844=0xc8;}else{_0x497844=0xce;}_0x6270f5[_0xf2b5('0x19')](_0x497844);return _0x6270f5[_0xf2b5('0x1f')](_0xf2b5('0x20'),_0x27a857+'-'+_0x1d806b+'/'+_0x1134b4)['json'](_0x5163d4);}return null;};}function patchUpdates(_0x54cdb9){return function(_0x14283b){try{jsonpatch[_0xf2b5('0x21')](_0x14283b,_0x54cdb9,!![]);}catch(_0x45bc4c){return BPromise[_0xf2b5('0x22')](_0x45bc4c);}return _0x14283b[_0xf2b5('0x23')]();};}function saveUpdates(_0x1e5102,_0x3b799d){return function(_0x4e558f){if(_0x4e558f){return _0x4e558f[_0xf2b5('0x24')](_0x1e5102)['then'](function(_0x5efe7d){return _0x5efe7d;});}return null;};}function removeEntity(_0x51d07a,_0x1d6a0a){return function(_0xfb02d){if(_0xfb02d){return _0xfb02d[_0xf2b5('0x25')]()[_0xf2b5('0x26')](function(){_0x51d07a['status'](0xcc)[_0xf2b5('0x1a')]();});}};}function handleEntityNotFound(_0xb214a5,_0x344923){return function(_0x5e9f2a){if(!_0x5e9f2a){_0xb214a5['sendStatus'](0x194);}return _0x5e9f2a;};}function handleError(_0x31d0dd,_0x13123e){_0x13123e=_0x13123e||0x1f4;return function(_0x459951){logger['error'](_0x459951[_0xf2b5('0x27')]);if(_0x459951[_0xf2b5('0x28')]){delete _0x459951[_0xf2b5('0x28')];}_0x31d0dd[_0xf2b5('0x19')](_0x13123e)[_0xf2b5('0x29')](_0x459951);};}exports['index']=function(_0x4d3061,_0x5a3832){var _0x100548={},_0x496ca4={},_0x1ffddd={'count':0x0,'rows':[]};var _0x31f69d=_['map'](db['VoiceDialReport'][_0xf2b5('0x2a')],function(_0x2ecb29){return{'name':_0x2ecb29['fieldName'],'type':_0x2ecb29[_0xf2b5('0x2b')][_0xf2b5('0x2c')]};});_0x496ca4[_0xf2b5('0x2d')]=_[_0xf2b5('0x2e')](_0x31f69d,_0xf2b5('0x28'));_0x496ca4[_0xf2b5('0x2f')]=_[_0xf2b5('0x30')](_0x4d3061['query']);_0x496ca4['filters']=_[_0xf2b5('0x31')](_0x496ca4[_0xf2b5('0x2d')],_0x496ca4[_0xf2b5('0x2f')]);_0x100548[_0xf2b5('0x32')]=_[_0xf2b5('0x31')](_0x496ca4[_0xf2b5('0x2d')],qs['fields'](_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x33')]));_0x100548[_0xf2b5('0x32')]=_0x100548['attributes'][_0xf2b5('0x34')]?_0x100548[_0xf2b5('0x32')]:_0x496ca4[_0xf2b5('0x2d')];if(!_0x4d3061['query'][_0xf2b5('0x35')](_0xf2b5('0x36'))){_0x100548['limit']=qs['limit'](_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x1e')]);_0x100548[_0xf2b5('0x1b')]=qs[_0xf2b5('0x1b')](_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x1b')]);}_0x100548['order']=qs[_0xf2b5('0x37')](_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x37')]);_0x100548['where']=qs['filters'](_[_0xf2b5('0x38')](_0x4d3061['query'],_0x496ca4[_0xf2b5('0x39')]),_0x31f69d);if(_0x4d3061[_0xf2b5('0x2f')]['filter']){_0x100548[_0xf2b5('0x3a')]=_[_0xf2b5('0x3b')](_0x100548[_0xf2b5('0x3a')],{'$or':_['map'](_0x31f69d,function(_0x15e70b){if(_0x15e70b[_0xf2b5('0x2b')]!==_0xf2b5('0x3c')){var _0x153b33={};_0x153b33[_0x15e70b['name']]={'$like':'%'+_0x4d3061['query']['filter']+'%'};return _0x153b33;}})});}_0x100548=_['merge']({},_0x100548,_0x4d3061['options']);var _0xcb526d={'where':_0x100548[_0xf2b5('0x3a')]};return db[_0xf2b5('0x3d')][_0xf2b5('0x1d')](_0xcb526d)[_0xf2b5('0x26')](function(_0x243028){_0x1ffddd[_0xf2b5('0x1d')]=_0x243028;if(_0x4d3061[_0xf2b5('0x2f')][_0xf2b5('0x3e')]){_0x100548[_0xf2b5('0x3f')]=[{'all':!![]}];}return db['VoiceDialReport'][_0xf2b5('0x40')](_0x100548);})[_0xf2b5('0x26')](function(_0x30f32b){_0x1ffddd[_0xf2b5('0x41')]=_0x30f32b;return _0x1ffddd;})[_0xf2b5('0x26')](respondWithFilteredResult(_0x5a3832,_0x100548))[_0xf2b5('0x42')](handleError(_0x5a3832,null));};exports[_0xf2b5('0x43')]=function(_0x13120b,_0x821fe1){var _0x407bae={'raw':!![],'where':{'id':_0x13120b['params']['id']}},_0x181dae={};_0x181dae[_0xf2b5('0x2d')]=_[_0xf2b5('0x30')](db['VoiceDialReport'][_0xf2b5('0x2a')]);_0x181dae[_0xf2b5('0x2f')]=_[_0xf2b5('0x30')](_0x13120b[_0xf2b5('0x2f')]);_0x181dae['filters']=_[_0xf2b5('0x31')](_0x181dae[_0xf2b5('0x2d')],_0x181dae[_0xf2b5('0x2f')]);_0x407bae[_0xf2b5('0x32')]=_[_0xf2b5('0x31')](_0x181dae[_0xf2b5('0x2d')],qs[_0xf2b5('0x33')](_0x13120b[_0xf2b5('0x2f')][_0xf2b5('0x33')]));_0x407bae[_0xf2b5('0x32')]=_0x407bae[_0xf2b5('0x32')][_0xf2b5('0x34')]?_0x407bae[_0xf2b5('0x32')]:_0x181dae[_0xf2b5('0x2d')];if(_0x13120b['query'][_0xf2b5('0x3e')]){_0x407bae[_0xf2b5('0x3f')]=[{'all':!![]}];}_0x407bae=_[_0xf2b5('0x3b')]({},_0x407bae,_0x13120b['options']);return db[_0xf2b5('0x3d')][_0xf2b5('0x44')](_0x407bae)[_0xf2b5('0x26')](handleEntityNotFound(_0x821fe1,null))[_0xf2b5('0x26')](respondWithResult(_0x821fe1,null))['catch'](handleError(_0x821fe1,null));};exports[_0xf2b5('0x45')]=function(_0x454642,_0x5a4135){return db['VoiceDialReport']['create'](_0x454642[_0xf2b5('0x46')],{})['then'](respondWithResult(_0x5a4135,0xc9))[_0xf2b5('0x42')](handleError(_0x5a4135,null));};exports[_0xf2b5('0x24')]=function(_0x3db03d,_0x5d4adf){if(_0x3db03d['body']['id']){delete _0x3db03d['body']['id'];}return db[_0xf2b5('0x3d')][_0xf2b5('0x44')]({'where':{'id':_0x3db03d[_0xf2b5('0x47')]['id']}})['then'](handleEntityNotFound(_0x5d4adf,null))[_0xf2b5('0x26')](saveUpdates(_0x3db03d[_0xf2b5('0x46')],null))[_0xf2b5('0x26')](respondWithResult(_0x5d4adf,null))[_0xf2b5('0x42')](handleError(_0x5d4adf,null));};exports[_0xf2b5('0x25')]=function(_0x513424,_0x3f4f06){return db[_0xf2b5('0x3d')][_0xf2b5('0x44')]({'where':{'id':_0x513424[_0xf2b5('0x47')]['id']}})[_0xf2b5('0x26')](handleEntityNotFound(_0x3f4f06,null))[_0xf2b5('0x26')](removeEntity(_0x3f4f06,null))[_0xf2b5('0x42')](handleError(_0x3f4f06,null));};exports[_0xf2b5('0x48')]=function(_0x1228a2,_0xa87558){return db[_0xf2b5('0x3d')][_0xf2b5('0x48')]()[_0xf2b5('0x26')](respondWithResult(_0xa87558,null))['catch'](handleError(_0xa87558,null));};
\ No newline at end of file
index a554413..c23e552 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5569=['../../config/environment','./voiceDialReport.attributes','exports','define','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x139325,_0x2052ea){var _0x585d8c=function(_0x4e683f){while(--_0x4e683f){_0x139325['push'](_0x139325['shift']());}};_0x585d8c(++_0x2052ea);}(_0x5569,0x143));var _0x9556=function(_0x5da107,_0x10357c){_0x5da107=_0x5da107-0x0;var _0x224f15=_0x5569[_0x5da107];return _0x224f15;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9556('0x0'))(_0x9556('0x1'));var moment=require(_0x9556('0x2'));var BPromise=require(_0x9556('0x3'));var rp=require(_0x9556('0x4'));var fs=require('fs');var path=require(_0x9556('0x5'));var rimraf=require(_0x9556('0x6'));var config=require(_0x9556('0x7'));var attributes=require(_0x9556('0x8'));module[_0x9556('0x9')]=function(_0x514523,_0xf24821){return _0x514523[_0x9556('0xa')]('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xdc0d=['rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid','lodash','util','moment','bluebird','path'];(function(_0x3ff2a7,_0x4bd7d1){var _0xb7c07a=function(_0x1b1612){while(--_0x1b1612){_0x3ff2a7['push'](_0x3ff2a7['shift']());}};_0xb7c07a(++_0x4bd7d1);}(_0xdc0d,0xc1));var _0xddc0=function(_0x37c525,_0x4682e8){_0x37c525=_0x37c525-0x0;var _0x1a1151=_0xdc0d[_0x37c525];return _0x1a1151;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xddc0('0x2'));var BPromise=require(_0xddc0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xddc0('0x4'));var rimraf=require(_0xddc0('0x5'));var config=require(_0xddc0('0x6'));var attributes=require(_0xddc0('0x7'));module['exports']=function(_0x9ee883,_0x43ef0b){return _0x9ee883[_0xddc0('0x8')](_0xddc0('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xddc0('0xa')]}],'timestamps':!![]});};
\ No newline at end of file
index 0316923..bb20431 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc19a=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','then','UpdateVoiceDialReport','update','attributes','lodash'];(function(_0x44a887,_0x267574){var _0xb943e4=function(_0x43cb38){while(--_0x43cb38){_0x44a887['push'](_0x44a887['shift']());}};_0xb943e4(++_0x267574);}(_0xc19a,0xc5));var _0xac19=function(_0xcdc734,_0x4e08fd){_0xcdc734=_0xcdc734-0x0;var _0x2faa93=_0xc19a[_0xcdc734];return _0x2faa93;};'use strict';var _=require(_0xac19('0x0'));var util=require(_0xac19('0x1'));var moment=require('moment');var BPromise=require(_0xac19('0x2'));var rs=require(_0xac19('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac19('0x4'));var logger=require(_0xac19('0x5'))(_0xac19('0x6'));var config=require(_0xac19('0x7'));var jayson=require(_0xac19('0x8'));var client=jayson[_0xac19('0x9')][_0xac19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25170e,_0x1ebfb6,_0x29fa76){return new BPromise(function(_0x49bce6,_0x1ef6e9){return client[_0xac19('0xb')](_0x25170e,_0x29fa76)['then'](function(_0x2b9f71){logger[_0xac19('0xc')]('VoiceDialReport,\x20%s,\x20%s',_0x1ebfb6,_0xac19('0xd'));logger[_0xac19('0xe')](_0xac19('0xf'),_0x1ebfb6,_0xac19('0xd'),JSON[_0xac19('0x10')](_0x2b9f71));if(_0x2b9f71[_0xac19('0x11')]){if(_0x2b9f71[_0xac19('0x11')][_0xac19('0x12')]===0x1f4){logger[_0xac19('0x11')](_0xac19('0x13'),_0x1ebfb6,_0x2b9f71['error']['message']);return _0x1ef6e9(_0x2b9f71['error'][_0xac19('0x14')]);}logger[_0xac19('0x11')](_0xac19('0x13'),_0x1ebfb6,_0x2b9f71[_0xac19('0x11')][_0xac19('0x14')]);return _0x49bce6(_0x2b9f71[_0xac19('0x11')]['message']);}else{logger[_0xac19('0xc')](_0xac19('0x13'),_0x1ebfb6,_0xac19('0xd'));_0x49bce6(_0x2b9f71[_0xac19('0x15')][_0xac19('0x14')]);}})[_0xac19('0x16')](function(_0x2aceb4){logger[_0xac19('0x11')](_0xac19('0x13'),_0x1ebfb6,_0x2aceb4);_0x1ef6e9(_0x2aceb4);});});}exports[_0xac19('0x17')]=function(_0x2ac357){var _0x23120e=this;return new Promise(function(_0x5bd82a,_0x1e4568){return db[_0xac19('0x18')][_0xac19('0x19')](_0x2ac357[_0xac19('0x1a')],{'raw':_0x2ac357[_0xac19('0x1b')]?_0x2ac357[_0xac19('0x1b')][_0xac19('0x1c')]===undefined?!![]:![]:!![]})[_0xac19('0x1d')](function(_0x39822e){logger[_0xac19('0xc')](_0xac19('0x17'),_0x2ac357);logger[_0xac19('0xe')]('CreateVoiceDialReport',_0x2ac357,JSON['stringify'](_0x39822e));_0x5bd82a(_0x39822e);})[_0xac19('0x16')](function(_0xcafee6){logger[_0xac19('0x11')]('CreateVoiceDialReport',_0xcafee6['message'],_0x2ac357);_0x1e4568(_0x23120e[_0xac19('0x11')](0x1f4,_0xcafee6[_0xac19('0x14')]));});});};exports[_0xac19('0x1e')]=function(_0x1ce486){var _0xf9acd5=this;return new Promise(function(_0x5dec43,_0x3ef2ea){return db['VoiceDialReport'][_0xac19('0x1f')](_0x1ce486['body'],{'raw':_0x1ce486['options']?_0x1ce486['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ce486[_0xac19('0x1b')]?_0x1ce486['options']['where']||null:null,'attributes':_0x1ce486['options']?_0x1ce486[_0xac19('0x1b')][_0xac19('0x20')]||null:null,'limit':_0x1ce486[_0xac19('0x1b')]?_0x1ce486[_0xac19('0x1b')]['limit']||null:null})[_0xac19('0x1d')](function(_0x2a5c23){logger[_0xac19('0xc')](_0xac19('0x1e'),_0x1ce486);logger[_0xac19('0xe')]('UpdateVoiceDialReport',_0x1ce486,JSON[_0xac19('0x10')](_0x2a5c23));_0x5dec43(_0x2a5c23);})['catch'](function(_0x227857){logger[_0xac19('0x11')](_0xac19('0x1e'),_0x227857['message'],_0x1ce486);_0x3ef2ea(_0xf9acd5[_0xac19('0x11')](0x1f4,_0x227857[_0xac19('0x14')]));});});};
\ No newline at end of file
+var _0xe107=['raw','UpdateVoiceDialReport','where','attributes','limit','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body','options'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe107,0xd1));var _0x7e10=function(_0x2a9368,_0x1d4056){_0x2a9368=_0x2a9368-0x0;var _0x38fb55=_0xe107[_0x2a9368];return _0x38fb55;};'use strict';var _=require(_0x7e10('0x0'));var util=require(_0x7e10('0x1'));var moment=require(_0x7e10('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7e10('0x3'))['db'];var utils=require(_0x7e10('0x4'));var logger=require(_0x7e10('0x5'))(_0x7e10('0x6'));var config=require(_0x7e10('0x7'));var jayson=require(_0x7e10('0x8'));var client=jayson[_0x7e10('0x9')][_0x7e10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a9082,_0xebd9a8,_0x2746eb){return new BPromise(function(_0x22fb6b,_0x51c8b0){return client[_0x7e10('0xb')](_0x4a9082,_0x2746eb)[_0x7e10('0xc')](function(_0x3350c6){logger[_0x7e10('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0xebd9a8,_0x7e10('0xe'));logger[_0x7e10('0xf')](_0x7e10('0x10'),_0xebd9a8,_0x7e10('0xe'),JSON[_0x7e10('0x11')](_0x3350c6));if(_0x3350c6['error']){if(_0x3350c6[_0x7e10('0x12')][_0x7e10('0x13')]===0x1f4){logger['error'](_0x7e10('0x14'),_0xebd9a8,_0x3350c6[_0x7e10('0x12')]['message']);return _0x51c8b0(_0x3350c6[_0x7e10('0x12')][_0x7e10('0x15')]);}logger[_0x7e10('0x12')](_0x7e10('0x14'),_0xebd9a8,_0x3350c6[_0x7e10('0x12')][_0x7e10('0x15')]);return _0x22fb6b(_0x3350c6[_0x7e10('0x12')][_0x7e10('0x15')]);}else{logger[_0x7e10('0xd')](_0x7e10('0x14'),_0xebd9a8,_0x7e10('0xe'));_0x22fb6b(_0x3350c6[_0x7e10('0x16')][_0x7e10('0x15')]);}})[_0x7e10('0x17')](function(_0x372e6a){logger[_0x7e10('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0xebd9a8,_0x372e6a);_0x51c8b0(_0x372e6a);});});}exports[_0x7e10('0x18')]=function(_0x4b54f6){var _0x512f6a=this;return new Promise(function(_0x3c774f,_0x37e7bd){return db[_0x7e10('0x19')][_0x7e10('0x1a')](_0x4b54f6[_0x7e10('0x1b')],{'raw':_0x4b54f6[_0x7e10('0x1c')]?_0x4b54f6[_0x7e10('0x1c')][_0x7e10('0x1d')]===undefined?!![]:![]:!![]})[_0x7e10('0xc')](function(_0x23a7c7){logger[_0x7e10('0xd')](_0x7e10('0x18'),_0x4b54f6);logger['debug'](_0x7e10('0x18'),_0x4b54f6,JSON[_0x7e10('0x11')](_0x23a7c7));_0x3c774f(_0x23a7c7);})[_0x7e10('0x17')](function(_0x370614){logger[_0x7e10('0x12')]('CreateVoiceDialReport',_0x370614[_0x7e10('0x15')],_0x4b54f6);_0x37e7bd(_0x512f6a[_0x7e10('0x12')](0x1f4,_0x370614[_0x7e10('0x15')]));});});};exports[_0x7e10('0x1e')]=function(_0x55e8ec){var _0x1b2460=this;return new Promise(function(_0x186234,_0x228804){return db['VoiceDialReport']['update'](_0x55e8ec[_0x7e10('0x1b')],{'raw':_0x55e8ec['options']?_0x55e8ec[_0x7e10('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x55e8ec[_0x7e10('0x1c')]?_0x55e8ec['options'][_0x7e10('0x1f')]||null:null,'attributes':_0x55e8ec[_0x7e10('0x1c')]?_0x55e8ec[_0x7e10('0x1c')][_0x7e10('0x20')]||null:null,'limit':_0x55e8ec['options']?_0x55e8ec['options'][_0x7e10('0x21')]||null:null})[_0x7e10('0xc')](function(_0x46c9e3){logger[_0x7e10('0xd')](_0x7e10('0x1e'),_0x55e8ec);logger[_0x7e10('0xf')](_0x7e10('0x1e'),_0x55e8ec,JSON[_0x7e10('0x11')](_0x46c9e3));_0x186234(_0x46c9e3);})[_0x7e10('0x17')](function(_0x20c7d4){logger[_0x7e10('0x12')](_0x7e10('0x1e'),_0x20c7d4[_0x7e10('0x15')],_0x55e8ec);_0x228804(_0x1b2460[_0x7e10('0x12')](0x1f4,_0x20c7d4['message']));});});};
\ No newline at end of file
index 0273b09..0d4f3e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c25=['create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x2a92fb,_0x59bb2c){var _0x50aa7a=function(_0x393bdf){while(--_0x393bdf){_0x2a92fb['push'](_0x2a92fb['shift']());}};_0x50aa7a(++_0x59bb2c);}(_0x7c25,0x161));var _0x57c2=function(_0x9197ca,_0x614eac){_0x9197ca=_0x9197ca-0x0;var _0x398522=_0x7c25[_0x9197ca];return _0x398522;};'use strict';var multer=require(_0x57c2('0x0'));var util=require(_0x57c2('0x1'));var path=require(_0x57c2('0x2'));var timeout=require(_0x57c2('0x3'));var express=require(_0x57c2('0x4'));var router=express[_0x57c2('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x57c2('0x6'));var config=require(_0x57c2('0x7'));var controller=require(_0x57c2('0x8'));router[_0x57c2('0x9')]('/',auth[_0x57c2('0xa')](),controller[_0x57c2('0xb')]);router[_0x57c2('0x9')](_0x57c2('0xc'),auth['isAuthenticated'](),controller[_0x57c2('0xd')]);router[_0x57c2('0xe')]('/',auth[_0x57c2('0xa')](),controller[_0x57c2('0xf')]);router[_0x57c2('0xe')](_0x57c2('0x10'),auth[_0x57c2('0xa')](),controller[_0x57c2('0x11')]);router[_0x57c2('0x12')](_0x57c2('0xc'),auth[_0x57c2('0xa')](),controller[_0x57c2('0x13')]);router[_0x57c2('0x14')]('/:id',auth[_0x57c2('0xa')](),controller[_0x57c2('0x15')]);module[_0x57c2('0x16')]=router;
\ No newline at end of file
+var _0x8a11=['get','show','post','isAuthenticated','create','/:id/applications','addApplications','put','/:id','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x8a11,0x197));var _0x18a1=function(_0x102ff9,_0x907658){_0x102ff9=_0x102ff9-0x0;var _0x24fa97=_0x8a11[_0x102ff9];return _0x24fa97;};'use strict';var multer=require(_0x18a1('0x0'));var util=require(_0x18a1('0x1'));var path=require('path');var timeout=require(_0x18a1('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x18a1('0x3'));var auth=require(_0x18a1('0x4'));var interaction=require(_0x18a1('0x5'));var config=require(_0x18a1('0x6'));var controller=require('./voiceExtension.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x18a1('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x18a1('0x8')]);router[_0x18a1('0x9')]('/',auth[_0x18a1('0xa')](),controller[_0x18a1('0xb')]);router['post'](_0x18a1('0xc'),auth[_0x18a1('0xa')](),controller[_0x18a1('0xd')]);router[_0x18a1('0xe')](_0x18a1('0xf'),auth[_0x18a1('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x18a1('0x10')]);module[_0x18a1('0x11')]=router;
\ No newline at end of file
index 92c3b9c..db8fab3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0852=['outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','VIRTUAL','getDataValue','exten','sequelize','STRING','compositeIndex','NoOp','ENUM','inbound','internal','inbound-fax'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0x0852,0xe6));var _0x2085=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x0852[_0x36884e];return _0x1cc367;};'use strict';var Sequelize=require(_0x2085('0x0'));module['exports']={'context':{'type':Sequelize[_0x2085('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x2085('0x1')],'allowNull':![],'defaultValue':'1','unique':_0x2085('0x2')},'tag':{'type':Sequelize[_0x2085('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x2085('0x1')],'allowNull':![],'defaultValue':_0x2085('0x3')},'appdata':{'type':Sequelize[_0x2085('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x2085('0x4')](_0x2085('0x5'),'outbound',_0x2085('0x6'),_0x2085('0x7'),_0x2085('0x8'),_0x2085('0x9'),_0x2085('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2085('0x1')],'allowNull':![],'defaultValue':_0x2085('0xb')},'IntervalId':{'type':Sequelize[_0x2085('0xc')]},'isApp':{'type':Sequelize[_0x2085('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x2085('0x1')],'defaultValue':null},'callerID':{'type':Sequelize['STRING'],'allowNull':!![]},'record':{'type':Sequelize[_0x2085('0xd')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize[_0x2085('0x1')],'defaultValue':'wav'},'answer':{'type':Sequelize[_0x2085('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x2085('0xe')],'get':function(_0x3e0a33){return this[_0x2085('0xf')](_0x2085('0x10'));}},'alias':{'type':Sequelize[_0x2085('0x1')],'allowNull':!![]}};
\ No newline at end of file
+var _0xdeb4=['ENUM','outbound','internal','inbound-fax','outbound-fax','*,*,*,*','BOOLEAN','INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp'];(function(_0x3d01d3,_0x122dc6){var _0x31ab40=function(_0x43b96c){while(--_0x43b96c){_0x3d01d3['push'](_0x3d01d3['shift']());}};_0x31ab40(++_0x122dc6);}(_0xdeb4,0xd8));var _0x4deb=function(_0x5e552f,_0x105a3e){_0x5e552f=_0x5e552f-0x0;var _0x37fc52=_0xdeb4[_0x5e552f];return _0x37fc52;};'use strict';var Sequelize=require(_0x4deb('0x0'));module[_0x4deb('0x1')]={'context':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'unique':_0x4deb('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'unique':_0x4deb('0x3')},'priority':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4deb('0x4')},'appdata':{'type':Sequelize[_0x4deb('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x4deb('0x5')]('inbound',_0x4deb('0x6'),_0x4deb('0x7'),_0x4deb('0x8'),_0x4deb('0x9'),'system','any'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4deb('0x2')],'allowNull':![],'defaultValue':_0x4deb('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize[_0x4deb('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x4deb('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x4deb('0x2')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x4deb('0xc')]},'recordingFormat':{'type':Sequelize[_0x4deb('0x2')],'defaultValue':_0x4deb('0xd')},'answer':{'type':Sequelize[_0x4deb('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x4deb('0xe')],'get':function(_0x348515){return this[_0x4deb('0xf')](_0x4deb('0x10'));}},'alias':{'type':Sequelize['STRING'],'allowNull':!![]}};
\ No newline at end of file
index e11edcc..b8777b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10a=['autoAssociation','UserProfileResource','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','then','get','InboundRoutes','OutboundRoutes','InternalRoutes','ignore','map','includes','type','find','value','name','sendStatus','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','keys','query','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','rows','catch','show','length','destroy','params','create','body','outbound','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','internal','userProfileId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb10a,0x1de));var _0xab10=function(_0x3802d0,_0x25a36a){_0x3802d0=_0x3802d0-0x0;var _0x5739dc=_0xb10a[_0x3802d0];return _0x5739dc;};'use strict';var _=require('lodash');var Redis=require(_0xab10('0x0'));var qs=require(_0xab10('0x1'));var logger=require('../../config/logger')(_0xab10('0x2'));var config=require(_0xab10('0x3'));var db=require('../../mysqldb')['db'];config[_0xab10('0x4')]=_[_0xab10('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xab10('0x6'))(new Redis(config[_0xab10('0x4')]));require(_0xab10('0x7'))[_0xab10('0x8')](socket);function respondWithStatusCode(_0x1ac9f6,_0x2d704c){_0x2d704c=_0x2d704c||0xcc;return function(_0x351272){if(_0x351272){return _0x1ac9f6['sendStatus'](_0x2d704c);}return _0x1ac9f6[_0xab10('0x9')](_0x2d704c)[_0xab10('0xa')]();};}function respondWithResult(_0x4adeb3,_0x3ab7a4){_0x3ab7a4=_0x3ab7a4||0xc8;return function(_0x2a29f2){if(_0x2a29f2){return _0x4adeb3[_0xab10('0x9')](_0x3ab7a4)[_0xab10('0xb')](_0x2a29f2);}};}function respondWithFilteredResult(_0x111a34,_0x1aabd2){return function(_0x4ad091){if(_0x4ad091){var _0x46dcc7=typeof _0x1aabd2[_0xab10('0xc')]===_0xab10('0xd')&&typeof _0x1aabd2['limit']===_0xab10('0xd');var _0x44e395=_0x4ad091[_0xab10('0xe')];var _0x4e16a2=_0x46dcc7?0x0:_0x1aabd2[_0xab10('0xc')];var _0x181e21=_0x46dcc7?_0x4ad091[_0xab10('0xe')]:_0x1aabd2[_0xab10('0xc')]+_0x1aabd2[_0xab10('0xf')];var _0x438427;if(_0x181e21>=_0x44e395){_0x181e21=_0x44e395;_0x438427=0xc8;}else{_0x438427=0xce;}_0x111a34['status'](_0x438427);return _0x111a34[_0xab10('0x10')](_0xab10('0x11'),_0x4e16a2+'-'+_0x181e21+'/'+_0x44e395)[_0xab10('0xb')](_0x4ad091);}return null;};}function removeEntity(_0x1fc341){return function(_0x3e5d12){if(_0x3e5d12){return _0x3e5d12['destroy']()[_0xab10('0x12')](function(){var _0x65f5f1=_0x3e5d12[_0xab10('0x13')]({'plain':!![]});var _0x381ae9=[{'name':_0xab10('0x14'),'value':'inbound','ignore':![]},{'name':_0xab10('0x15'),'value':'outbound','ignore':![]},{'name':_0xab10('0x16'),'value':'internal','ignore':![]}];var _0x41429e=_(_0x381ae9)['filter'](_0xab10('0x17'))[_0xab10('0x18')]('value')['value']();if(_[_0xab10('0x19')](_0x41429e,_0x65f5f1[_0xab10('0x1a')])){return;}var _0x1ba79a=_[_0xab10('0x1b')](_0x381ae9,[_0xab10('0x1c'),_0x65f5f1['type']])[_0xab10('0x1d')];return db['UserProfileResource']['destroy']({'where':{'type':_0x1ba79a,'resourceId':_0x65f5f1['id']}})[_0xab10('0x12')](function(){return _0x3e5d12;});})[_0xab10('0x12')](function(){_0x1fc341['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab5d1){return function(_0x129c11){if(!_0x129c11){_0x4ab5d1[_0xab10('0x1e')](0x194);}return _0x129c11;};}function handleError(_0x108494,_0x14992c){_0x14992c=_0x14992c||0x1f4;return function(_0x50d833){logger[_0xab10('0x1f')](_0x50d833[_0xab10('0x20')]);if(_0x50d833[_0xab10('0x1d')]){delete _0x50d833[_0xab10('0x1d')];}_0x108494[_0xab10('0x9')](_0x14992c)[_0xab10('0x21')](_0x50d833);};}exports[_0xab10('0x22')]=function(_0x218323,_0x5c3144){var _0x34fc69={},_0x533004={},_0x46c066={'count':0x0,'rows':[]};var _0x2e988d=_[_0xab10('0x18')](db[_0xab10('0x23')][_0xab10('0x24')],function(_0x32607a){return{'name':_0x32607a[_0xab10('0x25')],'type':_0x32607a[_0xab10('0x1a')][_0xab10('0x26')]};});_0x533004['model']=_[_0xab10('0x18')](_0x2e988d,_0xab10('0x1d'));_0x533004['query']=_[_0xab10('0x27')](_0x218323[_0xab10('0x28')]);_0x533004[_0xab10('0x29')]=_[_0xab10('0x2a')](_0x533004['model'],_0x533004[_0xab10('0x28')]);_0x34fc69[_0xab10('0x2b')]=_[_0xab10('0x2a')](_0x533004[_0xab10('0x2c')],qs[_0xab10('0x2d')](_0x218323['query'][_0xab10('0x2d')]));_0x34fc69['attributes']=_0x34fc69[_0xab10('0x2b')]['length']?_0x34fc69['attributes']:_0x533004['model'];if(!_0x218323[_0xab10('0x28')][_0xab10('0x2e')](_0xab10('0x2f'))){_0x34fc69['limit']=qs['limit'](_0x218323[_0xab10('0x28')][_0xab10('0xf')]);_0x34fc69['offset']=qs[_0xab10('0xc')](_0x218323[_0xab10('0x28')]['offset']);}_0x34fc69[_0xab10('0x30')]=qs['sort'](_0x218323[_0xab10('0x28')][_0xab10('0x31')]);_0x34fc69['where']=qs[_0xab10('0x29')](_[_0xab10('0x32')](_0x218323[_0xab10('0x28')],_0x533004[_0xab10('0x29')]),_0x2e988d);if(_0x218323[_0xab10('0x28')][_0xab10('0x33')]){_0x34fc69[_0xab10('0x34')]=_[_0xab10('0x35')](_0x34fc69[_0xab10('0x34')],{'$or':_[_0xab10('0x18')](_0x2e988d,function(_0x424ee5){if(_0x424ee5['type']!=='VIRTUAL'){var _0x1bddc5={};_0x1bddc5[_0x424ee5[_0xab10('0x1d')]]={'$like':'%'+_0x218323[_0xab10('0x28')][_0xab10('0x33')]+'%'};return _0x1bddc5;}})});}_0x34fc69=_[_0xab10('0x35')]({},_0x34fc69,_0x218323[_0xab10('0x36')]);var _0x5bac93={'where':_0x34fc69[_0xab10('0x34')]};return db[_0xab10('0x23')]['count'](_0x5bac93)['then'](function(_0x54eba4){_0x46c066[_0xab10('0xe')]=_0x54eba4;if(_0x218323['query'][_0xab10('0x37')]){_0x34fc69[_0xab10('0x38')]=[{'all':!![]}];}return db[_0xab10('0x23')]['findAll'](_0x34fc69);})[_0xab10('0x12')](function(_0x1833af){_0x46c066[_0xab10('0x39')]=_0x1833af;return _0x46c066;})['then'](respondWithFilteredResult(_0x5c3144,_0x34fc69))[_0xab10('0x3a')](handleError(_0x5c3144,null));};exports[_0xab10('0x3b')]=function(_0x39e6e0,_0x2c2d55){var _0x522b85={'raw':![],'where':{'id':_0x39e6e0['params']['id']}},_0x2a7dec={};_0x2a7dec[_0xab10('0x2c')]=_[_0xab10('0x27')](db['VoiceExtension'][_0xab10('0x24')]);_0x2a7dec[_0xab10('0x28')]=_[_0xab10('0x27')](_0x39e6e0['query']);_0x2a7dec['filters']=_[_0xab10('0x2a')](_0x2a7dec[_0xab10('0x2c')],_0x2a7dec[_0xab10('0x28')]);_0x522b85['attributes']=_['intersection'](_0x2a7dec['model'],qs[_0xab10('0x2d')](_0x39e6e0[_0xab10('0x28')][_0xab10('0x2d')]));_0x522b85[_0xab10('0x2b')]=_0x522b85[_0xab10('0x2b')][_0xab10('0x3c')]?_0x522b85[_0xab10('0x2b')]:_0x2a7dec['model'];if(_0x39e6e0[_0xab10('0x28')][_0xab10('0x37')]){_0x522b85['include']=[{'all':!![]}];}_0x522b85=_[_0xab10('0x35')]({},_0x522b85,_0x39e6e0[_0xab10('0x36')]);return db[_0xab10('0x23')][_0xab10('0x1b')](_0x522b85)[_0xab10('0x12')](handleEntityNotFound(_0x2c2d55,null))[_0xab10('0x12')](respondWithResult(_0x2c2d55,null))[_0xab10('0x3a')](handleError(_0x2c2d55,null));};exports[_0xab10('0x3d')]=function(_0x55f801,_0x5550bc){return db[_0xab10('0x23')][_0xab10('0x1b')]({'where':{'id':_0x55f801[_0xab10('0x3e')]['id']}})['then'](handleEntityNotFound(_0x5550bc,null))[_0xab10('0x12')](removeEntity(_0x5550bc,null))[_0xab10('0x3a')](handleError(_0x5550bc,null));};exports[_0xab10('0x3f')]=function(_0x45754b,_0x178e8f){if(_0x45754b[_0xab10('0x40')][_0xab10('0x1a')]===_0xab10('0x41')&&!_['startsWith'](_0x45754b[_0xab10('0x40')][_0xab10('0x42')],'_')){_0x45754b['body']['exten']='_'[_0xab10('0x43')](_0x45754b['body'][_0xab10('0x42')]);}return db[_0xab10('0x23')][_0xab10('0x3f')](_0x45754b[_0xab10('0x40')],{'raw':![]})[_0xab10('0x12')](function(_0x1f1b61){var _0x16af04=_0x45754b[_0xab10('0x44')]['get']({'plain':!![]});if(!_0x16af04)throw new Error(_0xab10('0x45'));if(_0x16af04[_0xab10('0x46')]==='user'){var _0x2bc89d=_0x1f1b61[_0xab10('0x13')]({'plain':!![]});var _0x3c1b35=[{'name':_0xab10('0x14'),'value':_0xab10('0x47')},{'name':_0xab10('0x15'),'value':_0xab10('0x41')},{'name':'InternalRoutes','value':_0xab10('0x48')}];var _0x3db088=_[_0xab10('0x1b')](_0x3c1b35,[_0xab10('0x1c'),_0x2bc89d['type']])[_0xab10('0x1d')];return db['UserProfileSection']['find']({'where':{'name':_0x3db088,'userProfileId':_0x16af04[_0xab10('0x49')]},'raw':!![]})[_0xab10('0x12')](function(_0x25278b){if(_0x25278b&&_0x25278b[_0xab10('0x4a')]===0x0){return db[_0xab10('0x4b')][_0xab10('0x3f')]({'name':_0x2bc89d[_0xab10('0x1d')],'resourceId':_0x2bc89d['id'],'type':_0x25278b[_0xab10('0x1d')],'sectionId':_0x25278b['id']},{})['then'](function(){return _0x1f1b61;});}else{return _0x1f1b61;}})['catch'](function(_0x4a488d){logger[_0xab10('0x1f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a488d);throw _0x4a488d;});}return _0x1f1b61;})[_0xab10('0x12')](respondWithResult(_0x178e8f,0xc9))[_0xab10('0x3a')](handleError(_0x178e8f,null));};exports[_0xab10('0x4c')]=function(_0x447fe7,_0x2fa23b){if(_0x447fe7['body']['id']){delete _0x447fe7[_0xab10('0x40')]['id'];}return db[_0xab10('0x23')][_0xab10('0x1b')]({'where':{'id':_0x447fe7[_0xab10('0x3e')]['id']}})[_0xab10('0x12')](handleEntityNotFound(_0x2fa23b,null))[_0xab10('0x12')](function(_0x3fa9ea){if(_0x3fa9ea){return db['VoiceExtension'][_0xab10('0x4c')](_[_0xab10('0x32')](_0x447fe7[_0xab10('0x40')],['exten',_0xab10('0x4d'),_0xab10('0x4e'),_0xab10('0x4f'),_0xab10('0x50'),_0xab10('0x51'),_0xab10('0x52')]),{'where':{'context':_0x3fa9ea[_0xab10('0x4d')],'exten':_0x3fa9ea[_0xab10('0x42')]},'individualHooks':!![]})[_0xab10('0x12')](function(_0x522768){return _0x522768;});}return null;})['then'](respondWithStatusCode(_0x2fa23b,null))[_0xab10('0x3a')](handleError(_0x2fa23b,null));};exports['addApplications']=function(_0x3443bc,_0x36c392){var _0x3f035d=_0x3443bc[_0xab10('0x3e')]['id'];var _0x1d8a9e=_0x3443bc[_0xab10('0x40')];var _0x37e9a3=0xc8;var _0x3969f3=null;return db[_0xab10('0x53')]['transaction']({'isolationLevel':db[_0xab10('0x53')][_0xab10('0x54')][_0xab10('0x55')][_0xab10('0x56')]},function(_0x133b7c){return db[_0xab10('0x23')][_0xab10('0x57')]({'where':{'id':_0x3f035d},'transaction':_0x133b7c})[_0xab10('0x12')](function(_0x5714e2){if(_0x5714e2){return db[_0xab10('0x23')]['destroy']({'where':{'VoiceExtensionId':_0x3f035d},'transaction':_0x133b7c})[_0xab10('0x12')](function(){var _0x189a75=_[_0xab10('0x18')](_0x1d8a9e,function(_0x77f696){_0x77f696['VoiceExtensionId']=_0x3f035d;_0x77f696[_0xab10('0x58')]=!![];return _0x77f696;});return _0x5714e2[_0xab10('0x59')](_0x189a75);})[_0xab10('0x12')](function(_0xa2d04f){return db[_0xab10('0x23')][_0xab10('0x5a')](_0xa2d04f,{'transaction':_0x133b7c});});}else{_0x37e9a3=0x194;_0x3969f3=[];}});})['then'](function(){if(_0x37e9a3!==0x194){return db[_0xab10('0x23')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x3f035d},'order':_0xab10('0x5b')})['then'](function(_0x39dece){_0x3969f3=_0x39dece;});}})[_0xab10('0x3a')](function(_0x25a97c){_0x37e9a3=0x1f4;logger[_0xab10('0x1f')](_0x25a97c['stack']);if(_0x25a97c[_0xab10('0x1d')]){delete _0x25a97c[_0xab10('0x1d')];}_0x3969f3=_0x25a97c;})['finally'](function(){if(_0x3969f3===null){_0x36c392['sendStatus'](_0x37e9a3);}else{if(_0x37e9a3===0x1f4){_0x36c392['status'](_0x37e9a3)[_0xab10('0x21')](_0x3969f3);}else{_0x36c392['status'](_0x37e9a3)[_0xab10('0xb')](_0x3969f3);}}});};
\ No newline at end of file
+var _0xa63e=['rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','include','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','internal','filter','map','value','includes','find','type','name','UserProfileResource','error','stack','send','index','VoiceExtension'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0xa63e,0x96));var _0xea63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa63e[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xea63('0x0'));var Redis=require(_0xea63('0x1'));var qs=require(_0xea63('0x2'));var logger=require(_0xea63('0x3'))(_0xea63('0x4'));var config=require(_0xea63('0x5'));var db=require(_0xea63('0x6'))['db'];config[_0xea63('0x7')]=_[_0xea63('0x8')](config['redis'],{'host':_0xea63('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xea63('0x7')]));require(_0xea63('0xa'))[_0xea63('0xb')](socket);function respondWithStatusCode(_0x1600d4,_0x3f7722){_0x3f7722=_0x3f7722||0xcc;return function(_0x56bc91){if(_0x56bc91){return _0x1600d4[_0xea63('0xc')](_0x3f7722);}return _0x1600d4[_0xea63('0xd')](_0x3f7722)[_0xea63('0xe')]();};}function respondWithResult(_0x1b718d,_0x1f1ee4){_0x1f1ee4=_0x1f1ee4||0xc8;return function(_0x1a3f6f){if(_0x1a3f6f){return _0x1b718d[_0xea63('0xd')](_0x1f1ee4)[_0xea63('0xf')](_0x1a3f6f);}};}function respondWithFilteredResult(_0x3818d3,_0x2ed120){return function(_0x2e8c4d){if(_0x2e8c4d){var _0x5c0479=typeof _0x2ed120[_0xea63('0x10')]===_0xea63('0x11')&&typeof _0x2ed120['limit']===_0xea63('0x11');var _0x3d6ce0=_0x2e8c4d['count'];var _0xd16d5f=_0x5c0479?0x0:_0x2ed120[_0xea63('0x10')];var _0x2d62f7=_0x5c0479?_0x2e8c4d[_0xea63('0x12')]:_0x2ed120[_0xea63('0x10')]+_0x2ed120['limit'];var _0x4d44da;if(_0x2d62f7>=_0x3d6ce0){_0x2d62f7=_0x3d6ce0;_0x4d44da=0xc8;}else{_0x4d44da=0xce;}_0x3818d3['status'](_0x4d44da);return _0x3818d3[_0xea63('0x13')](_0xea63('0x14'),_0xd16d5f+'-'+_0x2d62f7+'/'+_0x3d6ce0)['json'](_0x2e8c4d);}return null;};}function removeEntity(_0x242846){return function(_0x209178){if(_0x209178){return _0x209178[_0xea63('0x15')]()[_0xea63('0x16')](function(){var _0x5b392e=_0x209178[_0xea63('0x17')]({'plain':!![]});var _0x299a19=[{'name':_0xea63('0x18'),'value':_0xea63('0x19'),'ignore':![]},{'name':_0xea63('0x1a'),'value':_0xea63('0x1b'),'ignore':![]},{'name':'InternalRoutes','value':_0xea63('0x1c'),'ignore':![]}];var _0x3f7c47=_(_0x299a19)[_0xea63('0x1d')]('ignore')[_0xea63('0x1e')](_0xea63('0x1f'))[_0xea63('0x1f')]();if(_[_0xea63('0x20')](_0x3f7c47,_0x5b392e['type'])){return;}var _0x416d08=_[_0xea63('0x21')](_0x299a19,['value',_0x5b392e[_0xea63('0x22')]])[_0xea63('0x23')];return db[_0xea63('0x24')][_0xea63('0x15')]({'where':{'type':_0x416d08,'resourceId':_0x5b392e['id']}})[_0xea63('0x16')](function(){return _0x209178;});})[_0xea63('0x16')](function(){_0x242846['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x453741){return function(_0x4f9306){if(!_0x4f9306){_0x453741[_0xea63('0xc')](0x194);}return _0x4f9306;};}function handleError(_0x525aaa,_0x12ec9d){_0x12ec9d=_0x12ec9d||0x1f4;return function(_0x3bee04){logger[_0xea63('0x25')](_0x3bee04[_0xea63('0x26')]);if(_0x3bee04[_0xea63('0x23')]){delete _0x3bee04[_0xea63('0x23')];}_0x525aaa[_0xea63('0xd')](_0x12ec9d)[_0xea63('0x27')](_0x3bee04);};}exports[_0xea63('0x28')]=function(_0x5a2790,_0x439904){var _0x429b57={},_0x32dbbf={},_0x5eef9d={'count':0x0,'rows':[]};var _0xc39c7f=_[_0xea63('0x1e')](db[_0xea63('0x29')][_0xea63('0x2a')],function(_0x4cdec4){return{'name':_0x4cdec4['fieldName'],'type':_0x4cdec4[_0xea63('0x22')]['key']};});_0x32dbbf[_0xea63('0x2b')]=_[_0xea63('0x1e')](_0xc39c7f,'name');_0x32dbbf[_0xea63('0x2c')]=_['keys'](_0x5a2790['query']);_0x32dbbf[_0xea63('0x2d')]=_[_0xea63('0x2e')](_0x32dbbf[_0xea63('0x2b')],_0x32dbbf[_0xea63('0x2c')]);_0x429b57[_0xea63('0x2f')]=_[_0xea63('0x2e')](_0x32dbbf[_0xea63('0x2b')],qs[_0xea63('0x30')](_0x5a2790[_0xea63('0x2c')][_0xea63('0x30')]));_0x429b57[_0xea63('0x2f')]=_0x429b57[_0xea63('0x2f')][_0xea63('0x31')]?_0x429b57[_0xea63('0x2f')]:_0x32dbbf['model'];if(!_0x5a2790[_0xea63('0x2c')][_0xea63('0x32')](_0xea63('0x33'))){_0x429b57[_0xea63('0x34')]=qs[_0xea63('0x34')](_0x5a2790[_0xea63('0x2c')][_0xea63('0x34')]);_0x429b57[_0xea63('0x10')]=qs['offset'](_0x5a2790[_0xea63('0x2c')]['offset']);}_0x429b57[_0xea63('0x35')]=qs['sort'](_0x5a2790[_0xea63('0x2c')][_0xea63('0x36')]);_0x429b57[_0xea63('0x37')]=qs['filters'](_[_0xea63('0x38')](_0x5a2790[_0xea63('0x2c')],_0x32dbbf[_0xea63('0x2d')]),_0xc39c7f);if(_0x5a2790[_0xea63('0x2c')][_0xea63('0x1d')]){_0x429b57[_0xea63('0x37')]=_[_0xea63('0x39')](_0x429b57[_0xea63('0x37')],{'$or':_[_0xea63('0x1e')](_0xc39c7f,function(_0x2f5505){if(_0x2f5505[_0xea63('0x22')]!==_0xea63('0x3a')){var _0x488a14={};_0x488a14[_0x2f5505[_0xea63('0x23')]]={'$like':'%'+_0x5a2790[_0xea63('0x2c')][_0xea63('0x1d')]+'%'};return _0x488a14;}})});}_0x429b57=_['merge']({},_0x429b57,_0x5a2790[_0xea63('0x3b')]);var _0x2d604f={'where':_0x429b57[_0xea63('0x37')]};return db['VoiceExtension'][_0xea63('0x12')](_0x2d604f)[_0xea63('0x16')](function(_0x260777){_0x5eef9d[_0xea63('0x12')]=_0x260777;if(_0x5a2790[_0xea63('0x2c')][_0xea63('0x3c')]){_0x429b57['include']=[{'all':!![]}];}return db[_0xea63('0x29')][_0xea63('0x3d')](_0x429b57);})['then'](function(_0x4f6733){_0x5eef9d[_0xea63('0x3e')]=_0x4f6733;return _0x5eef9d;})[_0xea63('0x16')](respondWithFilteredResult(_0x439904,_0x429b57))[_0xea63('0x3f')](handleError(_0x439904,null));};exports[_0xea63('0x40')]=function(_0x3daf51,_0x227ebe){var _0x72537={'raw':![],'where':{'id':_0x3daf51[_0xea63('0x41')]['id']}},_0x21bfd8={};_0x21bfd8['model']=_['keys'](db[_0xea63('0x29')][_0xea63('0x2a')]);_0x21bfd8[_0xea63('0x2c')]=_[_0xea63('0x42')](_0x3daf51[_0xea63('0x2c')]);_0x21bfd8['filters']=_[_0xea63('0x2e')](_0x21bfd8[_0xea63('0x2b')],_0x21bfd8[_0xea63('0x2c')]);_0x72537[_0xea63('0x2f')]=_[_0xea63('0x2e')](_0x21bfd8[_0xea63('0x2b')],qs['fields'](_0x3daf51[_0xea63('0x2c')][_0xea63('0x30')]));_0x72537[_0xea63('0x2f')]=_0x72537[_0xea63('0x2f')][_0xea63('0x31')]?_0x72537[_0xea63('0x2f')]:_0x21bfd8[_0xea63('0x2b')];if(_0x3daf51[_0xea63('0x2c')]['includeAll']){_0x72537[_0xea63('0x43')]=[{'all':!![]}];}_0x72537=_[_0xea63('0x39')]({},_0x72537,_0x3daf51[_0xea63('0x3b')]);return db[_0xea63('0x29')][_0xea63('0x21')](_0x72537)[_0xea63('0x16')](handleEntityNotFound(_0x227ebe,null))[_0xea63('0x16')](respondWithResult(_0x227ebe,null))[_0xea63('0x3f')](handleError(_0x227ebe,null));};exports[_0xea63('0x15')]=function(_0x4ae530,_0x63d5cf){return db['VoiceExtension']['find']({'where':{'id':_0x4ae530[_0xea63('0x41')]['id']}})[_0xea63('0x16')](handleEntityNotFound(_0x63d5cf,null))[_0xea63('0x16')](removeEntity(_0x63d5cf,null))[_0xea63('0x3f')](handleError(_0x63d5cf,null));};exports[_0xea63('0x44')]=function(_0x292de9,_0xe33dbb){if(_0x292de9[_0xea63('0x45')][_0xea63('0x22')]==='outbound'&&!_[_0xea63('0x46')](_0x292de9[_0xea63('0x45')][_0xea63('0x47')],'_')){_0x292de9[_0xea63('0x45')][_0xea63('0x47')]='_'['concat'](_0x292de9['body'][_0xea63('0x47')]);}return db[_0xea63('0x29')][_0xea63('0x44')](_0x292de9[_0xea63('0x45')],{'raw':![]})[_0xea63('0x16')](function(_0x2e31c2){var _0x2566f4=_0x292de9[_0xea63('0x48')]['get']({'plain':!![]});if(!_0x2566f4)throw new Error(_0xea63('0x49'));if(_0x2566f4['role']===_0xea63('0x48')){var _0x424ab2=_0x2e31c2[_0xea63('0x17')]({'plain':!![]});var _0x1ba79b=[{'name':_0xea63('0x18'),'value':_0xea63('0x19')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0xea63('0x4a'),'value':_0xea63('0x1c')}];var _0x260972=_['find'](_0x1ba79b,['value',_0x424ab2[_0xea63('0x22')]])[_0xea63('0x23')];return db[_0xea63('0x4b')][_0xea63('0x21')]({'where':{'name':_0x260972,'userProfileId':_0x2566f4[_0xea63('0x4c')]},'raw':!![]})[_0xea63('0x16')](function(_0x4e60d6){if(_0x4e60d6&&_0x4e60d6[_0xea63('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x424ab2['name'],'resourceId':_0x424ab2['id'],'type':_0x4e60d6[_0xea63('0x23')],'sectionId':_0x4e60d6['id']},{})[_0xea63('0x16')](function(){return _0x2e31c2;});}else{return _0x2e31c2;}})[_0xea63('0x3f')](function(_0x15a458){logger[_0xea63('0x25')](_0xea63('0x4e'),_0x15a458);throw _0x15a458;});}return _0x2e31c2;})[_0xea63('0x16')](respondWithResult(_0xe33dbb,0xc9))['catch'](handleError(_0xe33dbb,null));};exports[_0xea63('0x4f')]=function(_0x4c47d7,_0x2ae74b){if(_0x4c47d7[_0xea63('0x45')]['id']){delete _0x4c47d7[_0xea63('0x45')]['id'];}return db[_0xea63('0x29')][_0xea63('0x21')]({'where':{'id':_0x4c47d7['params']['id']}})[_0xea63('0x16')](handleEntityNotFound(_0x2ae74b,null))[_0xea63('0x16')](function(_0x4602c2){if(_0x4602c2){return db[_0xea63('0x29')]['update'](_[_0xea63('0x38')](_0x4c47d7['body'],[_0xea63('0x47'),_0xea63('0x50'),_0xea63('0x51'),'recordingFormat',_0xea63('0x52'),_0xea63('0x53'),_0xea63('0x54')]),{'where':{'context':_0x4602c2['context'],'exten':_0x4602c2[_0xea63('0x47')]},'individualHooks':!![]})[_0xea63('0x16')](function(_0x53756e){return _0x53756e;});}return null;})[_0xea63('0x16')](respondWithStatusCode(_0x2ae74b,null))['catch'](handleError(_0x2ae74b,null));};exports[_0xea63('0x55')]=function(_0xfbb794,_0x1e749b){var _0x3cd335=_0xfbb794[_0xea63('0x41')]['id'];var _0x2c494d=_0xfbb794[_0xea63('0x45')];var _0x265797=0xc8;var _0x185c91=null;return db[_0xea63('0x56')][_0xea63('0x57')]({'isolationLevel':db[_0xea63('0x56')][_0xea63('0x58')][_0xea63('0x59')]['READ_COMMITTED']},function(_0x528109){return db[_0xea63('0x29')][_0xea63('0x5a')]({'where':{'id':_0x3cd335},'transaction':_0x528109})[_0xea63('0x16')](function(_0x26e403){if(_0x26e403){return db['VoiceExtension'][_0xea63('0x15')]({'where':{'VoiceExtensionId':_0x3cd335},'transaction':_0x528109})[_0xea63('0x16')](function(){var _0xf9b5e5=_['map'](_0x2c494d,function(_0x29ee1c){_0x29ee1c['VoiceExtensionId']=_0x3cd335;_0x29ee1c['isApp']=!![];return _0x29ee1c;});return _0x26e403[_0xea63('0x5b')](_0xf9b5e5);})[_0xea63('0x16')](function(_0x1f9aa6){return db[_0xea63('0x29')][_0xea63('0x5c')](_0x1f9aa6,{'transaction':_0x528109});});}else{_0x265797=0x194;_0x185c91=[];}});})['then'](function(){if(_0x265797!==0x194){return db[_0xea63('0x29')][_0xea63('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3cd335},'order':_0xea63('0x5e')})['then'](function(_0x10bba0){_0x185c91=_0x10bba0;});}})['catch'](function(_0x2fcc7e){_0x265797=0x1f4;logger[_0xea63('0x25')](_0x2fcc7e['stack']);if(_0x2fcc7e['name']){delete _0x2fcc7e[_0xea63('0x23')];}_0x185c91=_0x2fcc7e;})[_0xea63('0x5f')](function(){if(_0x185c91===null){_0x1e749b[_0xea63('0xc')](_0x265797);}else{if(_0x265797===0x1f4){_0x1e749b[_0xea63('0xd')](_0x265797)[_0xea63('0x27')](_0x185c91);}else{_0x1e749b[_0xea63('0xd')](_0x265797)[_0xea63('0xf')](_0x185c91);}}});};
\ No newline at end of file
index df7f9cf..78643da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd915=['save','emit','hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners'];(function(_0x3f4721,_0x8662a1){var _0x2ecd12=function(_0xd25802){while(--_0xd25802){_0x3f4721['push'](_0x3f4721['shift']());}};_0x2ecd12(++_0x8662a1);}(_0xd915,0x1c5));var _0x5d91=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xd915[_0x502c7d];return _0x30b7ed;};'use strict';var EventEmitter=require(_0x5d91('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0x5d91('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x5d91('0x2')](0x0);var events={'afterCreate':_0x5d91('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5355d1){return function(_0x2367ee,_0xb9f475,_0x113dfa){VoiceExtensionEvents[_0x5d91('0x4')](_0x5355d1+':'+_0x2367ee['id'],_0x2367ee);VoiceExtensionEvents[_0x5d91('0x4')](_0x5355d1,_0x2367ee);_0x113dfa(null);};}for(var e in events){if(events[_0x5d91('0x5')](e)){var event=events[e];VoiceExtension[_0x5d91('0x6')](e,emitEvent(event));}}module[_0x5d91('0x7')]=VoiceExtensionEvents;
\ No newline at end of file
+var _0xee94=['emit','hasOwnProperty','hook','events','../../mysqldb','VoiceExtension','update','remove'];(function(_0x1f7d31,_0x1ad0ae){var _0x3696b2=function(_0x2cd8cf){while(--_0x2cd8cf){_0x1f7d31['push'](_0x1f7d31['shift']());}};_0x3696b2(++_0x1ad0ae);}(_0xee94,0x1e3));var _0x4ee9=function(_0x2e0030,_0x3c7c6b){_0x2e0030=_0x2e0030-0x0;var _0x294c61=_0xee94[_0x2e0030];return _0x294c61;};'use strict';var EventEmitter=require(_0x4ee9('0x0'));var VoiceExtension=require(_0x4ee9('0x1'))['db'][_0x4ee9('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ee9('0x3'),'afterDestroy':_0x4ee9('0x4')};function emitEvent(_0x525999){return function(_0x5e4485,_0x211f14,_0x541099){VoiceExtensionEvents['emit'](_0x525999+':'+_0x5e4485['id'],_0x5e4485);VoiceExtensionEvents[_0x4ee9('0x5')](_0x525999,_0x5e4485);_0x541099(null);};}for(var e in events){if(events[_0x4ee9('0x6')](e)){var event=events[e];VoiceExtension[_0x4ee9('0x7')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents;
\ No newline at end of file
index 6efd4f2..57cc8ca 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8679=['define','VoiceExtension','voice_extensions','Hangup','lodash','./voiceExtension.attributes','exports','Set','CDR(type)=','type','context','NoOp','CDR(routeAlias)=','No\x20alias\x20set','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','alias','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','options','split','length','name','param','phone','prefix','${EXTEN:','join','none','replace','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','priority','last','catch'];(function(_0x3b8b72,_0x4b951d){var _0x261a8f=function(_0x488e03){while(--_0x488e03){_0x3b8b72['push'](_0x3b8b72['shift']());}};_0x261a8f(++_0x4b951d);}(_0x8679,0x19e));var _0x9867=function(_0x52c9ca,_0x191c87){_0x52c9ca=_0x52c9ca-0x0;var _0x6bdc03=_0x8679[_0x52c9ca];return _0x6bdc03;};'use strict';var _=require(_0x9867('0x0'));var attributes=require(_0x9867('0x1'));module[_0x9867('0x2')]=function(_0x41cbf0){var _0x4d8bf9=_0x41cbf0['models'];function _0x3b0cb5(_0x36c5c9){var _0x243848=0x2;var _0x14358c=[{'type':_0x36c5c9['type'],'app':_0x9867('0x3'),'appdata':_0x9867('0x4')+_0x36c5c9[_0x9867('0x5')],'context':_0x36c5c9[_0x9867('0x6')],'exten':_0x36c5c9['exten'],'priority':_0x243848++,'VoiceExtensionId':_0x36c5c9['id']},{'type':_0x36c5c9[_0x9867('0x5')],'app':_0x36c5c9['alias']?'Set':_0x9867('0x7'),'appdata':_0x36c5c9['alias']?_0x9867('0x8')+_0x36c5c9['alias']:_0x9867('0x9'),'context':_0x36c5c9['context'],'exten':_0x36c5c9[_0x9867('0xa')],'priority':_0x243848++,'VoiceExtensionId':_0x36c5c9['id']}];if(_0x36c5c9['type']===_0x9867('0xb')){_0x14358c[_0x9867('0xc')]({'type':'inbound','app':'Set','appdata':_0x9867('0xd')+_0x36c5c9['id'],'context':_0x36c5c9[_0x9867('0x6')],'exten':_0x36c5c9['exten'],'priority':_0x243848++,'VoiceExtensionId':_0x36c5c9['id']});}_0x14358c[_0x9867('0xc')]({'type':_0x36c5c9['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x36c5c9[_0x9867('0x6')],'exten':_0x36c5c9[_0x9867('0xa')],'priority':_0x243848++,'VoiceExtensionId':_0x36c5c9['id']},{'type':_0x36c5c9[_0x9867('0x5')],'app':_0x9867('0x3'),'appdata':_0x9867('0xe'),'context':_0x36c5c9[_0x9867('0x6')],'exten':_0x36c5c9[_0x9867('0xa')],'priority':_0x243848++,'VoiceExtensionId':_0x36c5c9['id']},{'type':_0x36c5c9[_0x9867('0x5')],'app':_0x9867('0x3'),'appdata':_0x9867('0xf'),'context':_0x36c5c9[_0x9867('0x6')],'exten':_0x36c5c9[_0x9867('0xa')],'priority':_0x243848++,'VoiceExtensionId':_0x36c5c9['id']});return _0x14358c;}function _0x4a30cc(_0x565143){var _0x33fc01=0x2;var _0x4e749c=[{'type':_0x9867('0x10'),'app':_0x9867('0x3'),'appdata':'CDR(type)=outbound','context':_0x565143[_0x9867('0x6')],'exten':_0x565143['exten'],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':_0x9867('0x10'),'app':_0x565143[_0x9867('0x11')]?_0x9867('0x3'):_0x9867('0x7'),'appdata':_0x565143[_0x9867('0x11')]?'CDR(routeAlias)='+_0x565143[_0x9867('0x11')]:_0x9867('0x9'),'context':_0x565143[_0x9867('0x6')],'exten':_0x565143[_0x9867('0xa')],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':_0x9867('0x10'),'app':_0x9867('0x3'),'appdata':_0x9867('0x12')+(_0x565143[_0x9867('0x13')]?'${EXTEN:'+_0x565143['cutdigits']+'}':_0x9867('0x14')),'context':_0x565143[_0x9867('0x6')],'exten':_0x565143['exten'],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':_0x9867('0x10'),'app':_0x9867('0x3'),'appdata':_0x9867('0xd')+_0x565143['id'],'context':_0x565143[_0x9867('0x6')],'exten':_0x565143[_0x9867('0xa')],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':_0x9867('0x10'),'app':_0x9867('0x15'),'appdata':_0x9867('0x16')+(_0x33fc01+0x2)+_0x9867('0x17')+(_0x33fc01+0x1)+')','context':_0x565143[_0x9867('0x6')],'exten':_0x565143[_0x9867('0xa')],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':_0x9867('0x10'),'app':_0x9867('0x3'),'appdata':_0x565143[_0x9867('0x13')]?_0x9867('0x18')+_0x565143[_0x9867('0x13')]+'}':'CDR(prefix)=noprefix','context':_0x565143['context'],'exten':_0x565143[_0x9867('0xa')],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':_0x9867('0x10'),'app':_0x9867('0x3'),'appdata':_0x9867('0x19'),'context':_0x565143[_0x9867('0x6')],'exten':_0x565143[_0x9867('0xa')],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':'outbound','app':'Set','appdata':_0x9867('0xe'),'context':_0x565143[_0x9867('0x6')],'exten':_0x565143[_0x9867('0xa')],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':'outbound','app':'Set','appdata':_0x9867('0xf'),'context':_0x565143['context'],'exten':_0x565143[_0x9867('0xa')],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':'outbound','app':'Set','appdata':'outboundrouteid='+_0x565143['id'],'context':_0x565143['context'],'exten':_0x565143[_0x9867('0xa')],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']}];if(_0x565143[_0x9867('0x1a')]('recordingFormat')&&_0x565143[_0x9867('0x1b')]!=='none'){_0x4e749c[_0x9867('0xc')]({'type':'outbound','app':_0x9867('0x3'),'appdata':_0x9867('0x1c'),'context':_0x565143['context'],'exten':_0x565143['exten'],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']},{'type':_0x9867('0x10'),'app':_0x9867('0x3'),'appdata':_0x9867('0x1d')+_0x565143['recordingFormat']||_0x9867('0x1e'),'context':_0x565143[_0x9867('0x6')],'exten':_0x565143['exten'],'priority':_0x33fc01++,'VoiceExtensionId':_0x565143['id']});}return _0x4e749c;}function _0x49d12f(_0x512b6b,_0x547d6c){var _0x3d92cf=[{'name':_0x9867('0x1f'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0x9867('0x20'),'param':0x2},{'name':'url','param':0x3}];var _0xdcf1c6={};var _0x4d86ea=_0x547d6c[_0x9867('0x21')](',');var _0x1cc280=[];for(var _0x26153e=0x0;_0x26153e<_0x3d92cf[_0x9867('0x22')];_0x26153e++){switch(_0x3d92cf[_0x26153e][_0x9867('0x23')]){case _0x9867('0x1f'):_0xdcf1c6[_0x9867('0x1f')]=_0x4d86ea[_0x3d92cf[_0x26153e][_0x9867('0x24')]][_0x9867('0x21')]('/')[0x1];_0xdcf1c6[_0x9867('0x25')]=_0x4d86ea[_0x3d92cf[_0x26153e]['param']][_0x9867('0x21')]('/')[0x2];_0xdcf1c6[_0x9867('0x26')]=_0xdcf1c6[_0x9867('0x25')]?_0xdcf1c6[_0x9867('0x25')][_0x9867('0x21')]('$')[0x0]:undefined;_0xdcf1c6[_0x9867('0x25')]=_0x512b6b[_0x9867('0x13')]?(_0xdcf1c6[_0x9867('0x26')]||'')+_0x9867('0x27')+_0x512b6b['cutdigits']+'}':(_0xdcf1c6[_0x9867('0x26')]||'')+_0x9867('0x14');_0x1cc280[_0x3d92cf[_0x26153e][_0x9867('0x24')]]=['SIP',_0xdcf1c6[_0x9867('0x1f')],_0xdcf1c6[_0x9867('0x25')]][_0x9867('0x28')]('/');break;case _0x9867('0x20'):_0xdcf1c6[_0x9867('0x20')]=_0x4d86ea[_0x3d92cf[_0x26153e][_0x9867('0x24')]];if(_0x512b6b[_0x9867('0x1b')]!==_0x9867('0x29')){if(_0xdcf1c6[_0x9867('0x20')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0xdcf1c6[_0x9867('0x20')]+='U(xcally-mixmonitor-context)';}}else{_0xdcf1c6[_0x9867('0x20')]=_0xdcf1c6[_0x9867('0x20')][_0x9867('0x2a')](_0x9867('0x2b'),'');}_0x1cc280[_0x3d92cf[_0x26153e][_0x9867('0x24')]]=_0xdcf1c6[_0x9867('0x20')];break;default:_0x1cc280[_0x3d92cf[_0x26153e][_0x9867('0x24')]]=_0x4d86ea[_0x3d92cf[_0x26153e]['param']];}}return _0x1cc280[_0x9867('0x28')](',');}function _0xd1d9c(_0x4c862c,_0x40beb0,_0x54d284){return new Promise(function(_0x56feaf,_0x5301dd){var _0x81dee1=[];if(_[_0x9867('0x2c')](_0x40beb0))return _0x56feaf(_0x81dee1);_0x4d8bf9[_0x9867('0x2d')][_0x9867('0x2e')]({'attributes':['id',_0x9867('0x2f'),_0x9867('0x30')],'raw':!![]})['then'](function(_0xdb2ee8){for(var _0x47c950=0x0,_0x4a87b4=0x0;_0x47c950<_0x40beb0[_0x9867('0x22')];_0x47c950++,_0x4a87b4=0x0){var _0x2fe2bb=_0x40beb0[_0x47c950];var _0x41a378=[];var _0x1d1ad5=[];delete _0x2fe2bb['id'];if(_0x2fe2bb[_0x9867('0x2f')]!==_0x9867('0x31')){_0x2fe2bb[_0x9867('0x32')]=[_0x2fe2bb[_0x9867('0x2f')]];}else{_0x2fe2bb['intervals']=_0x2fe2bb[_0x9867('0x30')]?_[_0x9867('0x33')](_[_0x9867('0x34')](_0xdb2ee8,{'IntervalId':_0x2fe2bb[_0x9867('0x30')]}),'interval'):[];}_0x2fe2bb[_0x9867('0x6')]=_0x4c862c[_0x9867('0x6')];_0x2fe2bb[_0x9867('0xa')]=_0x4c862c[_0x9867('0xa')];if(_0x2fe2bb[_0x9867('0x5')])_0x2fe2bb[_0x9867('0x5')]=_0x2fe2bb[_0x9867('0x5')][_0x9867('0x35')]();if(_0x4c862c[_0x9867('0x5')]===_0x9867('0x10')){if(_0x2fe2bb[_0x9867('0x1a')](_0x9867('0x36'))&&_0x2fe2bb[_0x9867('0x36')]&&_0x2fe2bb[_0x9867('0x36')]!=='--'){_0x41a378[_0x9867('0xc')]({'type':_0x2fe2bb['type'][_0x9867('0x35')](),'app':_0x9867('0x3'),'appdata':_0x9867('0x37')+_0x2fe2bb[_0x9867('0x36')],'context':_0x4c862c[_0x9867('0x6')],'exten':_0x4c862c[_0x9867('0xa')],'priority':_0x2fe2bb[_0x9867('0x32')][_0x9867('0x22')]+_0x54d284+_0x4a87b4++,'VoiceExtensionId':_0x4c862c['id']});}_0x41a378['push']({'type':_0x2fe2bb[_0x9867('0x5')][_0x9867('0x35')](),'app':_0x9867('0x15'),'appdata':_0x9867('0x38')+(_0x2fe2bb['callerID']?_0x9867('0x39')+_0x2fe2bb[_0x9867('0x3a')]+')':_0x9867('0x3b')),'context':_0x4c862c['context'],'exten':_0x4c862c[_0x9867('0xa')],'priority':_0x2fe2bb[_0x9867('0x32')][_0x9867('0x22')]+_0x54d284+_0x4a87b4++,'VoiceExtensionId':_0x4c862c['id']});}else{if(_0x2fe2bb[_0x9867('0x1a')](_0x9867('0x3c'))){if([_0x9867('0x3d'),_0x9867('0x3e')][_0x9867('0x3f')](_0x2fe2bb['app'][_0x9867('0x35')]())&&_0x2fe2bb[_0x9867('0x40')]!==_0x9867('0x41')){if(_0x2fe2bb['answer']){_0x41a378[_0x9867('0xc')]({'type':_0x2fe2bb[_0x9867('0x5')][_0x9867('0x35')](),'app':_0x9867('0x15'),'appdata':_0x9867('0x42'),'context':_0x4c862c[_0x9867('0x6')],'exten':_0x4c862c[_0x9867('0xa')],'priority':_0x2fe2bb['intervals'][_0x9867('0x22')]+_0x54d284+_0x4a87b4++,'VoiceExtensionId':_0x4c862c['id']});_0x41a378[_0x9867('0xc')]({'type':_0x2fe2bb[_0x9867('0x5')]['toLowerCase'](),'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x4c862c[_0x9867('0x6')],'exten':_0x4c862c['exten'],'priority':_0x2fe2bb[_0x9867('0x32')]['length']+_0x54d284+_0x4a87b4++,'VoiceExtensionId':_0x4c862c['id']});}else{_0x41a378[_0x9867('0xc')]({'type':_0x2fe2bb['type']['toLowerCase'](),'app':_0x9867('0x15'),'appdata':_0x9867('0x43'),'context':_0x4c862c[_0x9867('0x6')],'exten':_0x4c862c['exten'],'priority':_0x2fe2bb[_0x9867('0x32')][_0x9867('0x22')]+_0x54d284+_0x4a87b4++,'VoiceExtensionId':_0x4c862c['id']});_0x41a378['push']({'type':_0x2fe2bb[_0x9867('0x5')]['toLowerCase'](),'app':_0x9867('0x3'),'appdata':_0x9867('0x44'),'context':_0x4c862c[_0x9867('0x6')],'exten':_0x4c862c[_0x9867('0xa')],'priority':_0x2fe2bb[_0x9867('0x32')][_0x9867('0x22')]+_0x54d284+_0x4a87b4++,'VoiceExtensionId':_0x4c862c['id']});}}}}for(var _0xc72b1b=0x0;_0xc72b1b<_0x2fe2bb['intervals'][_0x9867('0x22')];_0xc72b1b++){var _0x5a832d=_0x54d284+_0x2fe2bb[_0x9867('0x32')][_0x9867('0x22')];var _0x358e76=_0xc72b1b===_0x2fe2bb['intervals'][_0x9867('0x22')]-0x1?_0x54d284+_0x41a378[_0x9867('0x22')]+_0x1d1ad5[_0x9867('0x22')]+0x2:_0x54d284+_0xc72b1b+0x1;_0x41a378[_0x9867('0x45')](_0xc72b1b,0x0,{'type':_0x4c862c['type'],'app':_0x9867('0x46'),'appdata':_0x2fe2bb[_0x9867('0x32')][_0xc72b1b]+'?'+_0x4c862c[_0x9867('0x6')]+_0x9867('0x47')+_0x5a832d+':'+_0x4c862c[_0x9867('0x6')]+',${EXTEN},'+_0x358e76,'exten':_0x4c862c[_0x9867('0xa')],'context':_0x4c862c['context'],'priority':_0x54d284+_0xc72b1b,'VoiceExtensionId':_0x4c862c['id']});}if(_0x2fe2bb['appType']===_0x9867('0x48')){_0x2fe2bb[_0x9867('0x49')]=_0x49d12f(_0x4c862c,_0x2fe2bb[_0x9867('0x49')]);}if(_0x2fe2bb['appType']===_0x9867('0x4a')){_0x41a378['push']({'type':_0x2fe2bb[_0x9867('0x5')][_0x9867('0x35')](),'app':_0x9867('0x3'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x4c862c[_0x9867('0x6')],'exten':_0x4c862c[_0x9867('0xa')],'priority':_0x2fe2bb[_0x9867('0x32')][_0x9867('0x22')]+_0x54d284+_0x4a87b4++,'VoiceExtensionId':_0x4c862c['id']});}_0x2fe2bb[_0x9867('0x4b')]=_0x41a378[_0x9867('0x22')]?_[_0x9867('0x4c')](_0x41a378)[_0x9867('0x4b')]+0x1:_0x54d284;_0x81dee1=_['concat'](_0x81dee1,_0x41a378,[_0x2fe2bb],_0x1d1ad5);_0x54d284=_[_0x9867('0x4c')](_0x81dee1)[_0x9867('0x4b')]+0x1;}return _0x56feaf(_0x81dee1);})[_0x9867('0x4d')](function(_0x366bbb){_0x5301dd(_0x366bbb);});});}return _0x41cbf0[_0x9867('0x4e')](_0x9867('0x4f'),attributes,{'tableName':_0x9867('0x50'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x379545){var _0x77050c=this['get']({'plain':!![]});var _0x2ecc9a=_0x77050c['type']===_0x9867('0x10')?_0x4a30cc(_0x77050c):_0x3b0cb5(_0x77050c);return _0xd1d9c(_0x77050c,_0x379545,_[_0x9867('0x4c')](_0x2ecc9a)[_0x9867('0x4b')]+0x1)['then'](function(_0x36c0c7){var _0x3a297e=_['concat'](_0x2ecc9a,_0x36c0c7);_0x3a297e[_0x9867('0xc')]({'type':_0x77050c['type'],'app':_0x9867('0x51'),'exten':_0x77050c[_0x9867('0xa')],'context':_0x77050c[_0x9867('0x6')],'priority':_[_0x9867('0x4c')](_0x3a297e)[_0x9867('0x4b')]+0x1,'VoiceExtensionId':_0x77050c['id']});return _0x3a297e;});}}});};
\ No newline at end of file
+var _0xcd28=['Set','CDR(type)=','exten','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','context','inbound','push','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','outbound','CDR(destination)=','${EXTEN:','${EXTEN}','ExecIf','cutdigits','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_FORMAT=','timeout','options','url','length','name','param','split','prefix','phone','SIP','trunk','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval','findAll','interval','then','intervals','IntervalId','map','filter','tag','toLowerCase','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appdata','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','Hangup','./voiceExtension.attributes','exports','models','type'];(function(_0x485574,_0x9216c9){var _0x32ac05=function(_0xf57ddb){while(--_0xf57ddb){_0x485574['push'](_0x485574['shift']());}};_0x32ac05(++_0x9216c9);}(_0xcd28,0x18c));var _0x8cd2=function(_0x50206e,_0x1a906c){_0x50206e=_0x50206e-0x0;var _0x39cdaa=_0xcd28[_0x50206e];return _0x39cdaa;};'use strict';var _=require('lodash');var attributes=require(_0x8cd2('0x0'));module[_0x8cd2('0x1')]=function(_0xb78e1e){var _0x228f5b=_0xb78e1e[_0x8cd2('0x2')];function _0x167aee(_0x11533c){var _0x84713c=0x2;var _0x11fe9c=[{'type':_0x11533c[_0x8cd2('0x3')],'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x5')+_0x11533c[_0x8cd2('0x3')],'context':_0x11533c['context'],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']},{'type':_0x11533c[_0x8cd2('0x3')],'app':_0x11533c[_0x8cd2('0x7')]?_0x8cd2('0x4'):_0x8cd2('0x8'),'appdata':_0x11533c[_0x8cd2('0x7')]?_0x8cd2('0x9')+_0x11533c[_0x8cd2('0x7')]:_0x8cd2('0xa'),'context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']}];if(_0x11533c[_0x8cd2('0x3')]===_0x8cd2('0xc')){_0x11fe9c[_0x8cd2('0xd')]({'type':'inbound','app':_0x8cd2('0x4'),'appdata':_0x8cd2('0xe')+_0x11533c['id'],'context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']});}_0x11fe9c['push']({'type':_0x11533c[_0x8cd2('0x3')],'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0xf'),'context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']},{'type':_0x11533c[_0x8cd2('0x3')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c['exten'],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']},{'type':_0x11533c[_0x8cd2('0x3')],'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x10'),'context':_0x11533c[_0x8cd2('0xb')],'exten':_0x11533c[_0x8cd2('0x6')],'priority':_0x84713c++,'VoiceExtensionId':_0x11533c['id']});return _0x11fe9c;}function _0x3ace79(_0x338e23){var _0x3fc46c=0x2;var _0xcc2c0a=[{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':'CDR(type)=outbound','context':_0x338e23['context'],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':'outbound','app':_0x338e23['alias']?_0x8cd2('0x4'):_0x8cd2('0x8'),'appdata':_0x338e23[_0x8cd2('0x7')]?_0x8cd2('0x9')+_0x338e23[_0x8cd2('0x7')]:_0x8cd2('0xa'),'context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':'outbound','app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x12')+(_0x338e23['cutdigits']?_0x8cd2('0x13')+_0x338e23['cutdigits']+'}':_0x8cd2('0x14')),'context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':'Set','appdata':'CDR(routeid)='+_0x338e23['id'],'context':_0x338e23['context'],'exten':_0x338e23['exten'],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':'outbound','app':_0x8cd2('0x15'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3fc46c+0x2)+'):Goto('+(_0x3fc46c+0x1)+')','context':_0x338e23['context'],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':_0x338e23[_0x8cd2('0x16')]?_0x8cd2('0x17')+_0x338e23['cutdigits']+'}':_0x8cd2('0x18'),'context':_0x338e23['context'],'exten':_0x338e23['exten'],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x338e23['context'],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x19'),'context':_0x338e23['context'],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x10'),'context':_0x338e23['context'],'exten':_0x338e23['exten'],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':'outboundrouteid='+_0x338e23['id'],'context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23['exten'],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']}];if(_0x338e23[_0x8cd2('0x1a')](_0x8cd2('0x1b'))&&_0x338e23[_0x8cd2('0x1b')]!==_0x8cd2('0x1c')){_0xcc2c0a['push']({'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']},{'type':_0x8cd2('0x11'),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x1d')+_0x338e23[_0x8cd2('0x1b')]||'wav','context':_0x338e23[_0x8cd2('0xb')],'exten':_0x338e23[_0x8cd2('0x6')],'priority':_0x3fc46c++,'VoiceExtensionId':_0x338e23['id']});}return _0xcc2c0a;}function _0x2bcd48(_0x2d2290,_0x1b80fc){var _0x5a2b04=[{'name':'trunk','param':0x0},{'name':_0x8cd2('0x1e'),'param':0x1},{'name':_0x8cd2('0x1f'),'param':0x2},{'name':_0x8cd2('0x20'),'param':0x3}];var _0x36980f={};var _0x207078=_0x1b80fc['split'](',');var _0x473bcb=[];for(var _0x1a64cd=0x0;_0x1a64cd<_0x5a2b04[_0x8cd2('0x21')];_0x1a64cd++){switch(_0x5a2b04[_0x1a64cd][_0x8cd2('0x22')]){case'trunk':_0x36980f['trunk']=_0x207078[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]]['split']('/')[0x1];_0x36980f['phone']=_0x207078[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]][_0x8cd2('0x24')]('/')[0x2];_0x36980f[_0x8cd2('0x25')]=_0x36980f['phone']?_0x36980f[_0x8cd2('0x26')]['split']('$')[0x0]:undefined;_0x36980f['phone']=_0x2d2290['cutdigits']?(_0x36980f[_0x8cd2('0x25')]||'')+'${EXTEN:'+_0x2d2290[_0x8cd2('0x16')]+'}':(_0x36980f[_0x8cd2('0x25')]||'')+_0x8cd2('0x14');_0x473bcb[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]]=[_0x8cd2('0x27'),_0x36980f[_0x8cd2('0x28')],_0x36980f[_0x8cd2('0x26')]][_0x8cd2('0x29')]('/');break;case _0x8cd2('0x1f'):_0x36980f[_0x8cd2('0x1f')]=_0x207078[_0x5a2b04[_0x1a64cd]['param']];if(_0x2d2290[_0x8cd2('0x1b')]!==_0x8cd2('0x1c')){if(_0x36980f[_0x8cd2('0x1f')][_0x8cd2('0x2a')](_0x8cd2('0x2b'))<0x0){_0x36980f[_0x8cd2('0x1f')]+=_0x8cd2('0x2b');}}else{_0x36980f[_0x8cd2('0x1f')]=_0x36980f[_0x8cd2('0x1f')][_0x8cd2('0x2c')](_0x8cd2('0x2b'),'');}_0x473bcb[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]]=_0x36980f[_0x8cd2('0x1f')];break;default:_0x473bcb[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]]=_0x207078[_0x5a2b04[_0x1a64cd][_0x8cd2('0x23')]];}}return _0x473bcb['join'](',');}function _0x1b45aa(_0x2a0f42,_0x2f520d,_0x2c1b26){return new Promise(function(_0x433d0d,_0x147ce0){var _0x4d5f9e=[];if(_[_0x8cd2('0x2d')](_0x2f520d))return _0x433d0d(_0x4d5f9e);_0x228f5b[_0x8cd2('0x2e')][_0x8cd2('0x2f')]({'attributes':['id',_0x8cd2('0x30'),'IntervalId'],'raw':!![]})[_0x8cd2('0x31')](function(_0x1bddf9){for(var _0x3570eb=0x0,_0x50af5b=0x0;_0x3570eb<_0x2f520d[_0x8cd2('0x21')];_0x3570eb++,_0x50af5b=0x0){var _0xc958c3=_0x2f520d[_0x3570eb];var _0x59a22f=[];var _0x388dd6=[];delete _0xc958c3['id'];if(_0xc958c3[_0x8cd2('0x30')]!=='*,*,*,*'){_0xc958c3[_0x8cd2('0x32')]=[_0xc958c3[_0x8cd2('0x30')]];}else{_0xc958c3['intervals']=_0xc958c3[_0x8cd2('0x33')]?_[_0x8cd2('0x34')](_[_0x8cd2('0x35')](_0x1bddf9,{'IntervalId':_0xc958c3[_0x8cd2('0x33')]}),_0x8cd2('0x30')):[];}_0xc958c3[_0x8cd2('0xb')]=_0x2a0f42[_0x8cd2('0xb')];_0xc958c3[_0x8cd2('0x6')]=_0x2a0f42[_0x8cd2('0x6')];if(_0xc958c3[_0x8cd2('0x3')])_0xc958c3[_0x8cd2('0x3')]=_0xc958c3[_0x8cd2('0x3')]['toLowerCase']();if(_0x2a0f42['type']===_0x8cd2('0x11')){if(_0xc958c3['hasOwnProperty']('tag')&&_0xc958c3[_0x8cd2('0x36')]&&_0xc958c3['tag']!=='--'){_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x38')+_0xc958c3['tag'],'context':_0x2a0f42['context'],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')]['length']+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}_0x59a22f['push']({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':_0x8cd2('0x15'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0xc958c3['callerID']?'Set(CALLERID(all)='+_0xc958c3[_0x8cd2('0x39')]+')':_0x8cd2('0x3a')),'context':_0x2a0f42[_0x8cd2('0xb')],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}else{if(_0xc958c3['hasOwnProperty'](_0x8cd2('0x3b'))){if([_0x8cd2('0x3c'),_0x8cd2('0x3d')][_0x8cd2('0x3e')](_0xc958c3['app'][_0x8cd2('0x37')]())&&_0xc958c3[_0x8cd2('0x3f')]!=='custom'){if(_0xc958c3[_0x8cd2('0x3b')]){_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')]['toLowerCase'](),'app':_0x8cd2('0x15'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2a0f42[_0x8cd2('0xb')],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':_0x8cd2('0x4'),'appdata':_0x8cd2('0x40'),'context':_0x2a0f42['context'],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}else{_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':'ExecIf','appdata':_0x8cd2('0x41'),'context':_0x2a0f42[_0x8cd2('0xb')],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});_0x59a22f[_0x8cd2('0xd')]({'type':_0xc958c3[_0x8cd2('0x3')][_0x8cd2('0x37')](),'app':'Set','appdata':_0x8cd2('0x42'),'context':_0x2a0f42['context'],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3['intervals'][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}}}}for(var _0x1e1161=0x0;_0x1e1161<_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')];_0x1e1161++){var _0x16e51d=_0x2c1b26+_0xc958c3['intervals'][_0x8cd2('0x21')];var _0x2edf68=_0x1e1161===_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]-0x1?_0x2c1b26+_0x59a22f[_0x8cd2('0x21')]+_0x388dd6[_0x8cd2('0x21')]+0x2:_0x2c1b26+_0x1e1161+0x1;_0x59a22f[_0x8cd2('0x43')](_0x1e1161,0x0,{'type':_0x2a0f42['type'],'app':_0x8cd2('0x44'),'appdata':_0xc958c3['intervals'][_0x1e1161]+'?'+_0x2a0f42[_0x8cd2('0xb')]+_0x8cd2('0x45')+_0x16e51d+':'+_0x2a0f42[_0x8cd2('0xb')]+',${EXTEN},'+_0x2edf68,'exten':_0x2a0f42[_0x8cd2('0x6')],'context':_0x2a0f42['context'],'priority':_0x2c1b26+_0x1e1161,'VoiceExtensionId':_0x2a0f42['id']});}if(_0xc958c3['appType']==='outboundDial'){_0xc958c3[_0x8cd2('0x46')]=_0x2bcd48(_0x2a0f42,_0xc958c3['appdata']);}if(_0xc958c3[_0x8cd2('0x3f')]==='agi'){_0x59a22f['push']({'type':_0xc958c3['type'][_0x8cd2('0x37')](),'app':'Set','appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x2a0f42[_0x8cd2('0xb')],'exten':_0x2a0f42[_0x8cd2('0x6')],'priority':_0xc958c3[_0x8cd2('0x32')][_0x8cd2('0x21')]+_0x2c1b26+_0x50af5b++,'VoiceExtensionId':_0x2a0f42['id']});}_0xc958c3[_0x8cd2('0x47')]=_0x59a22f[_0x8cd2('0x21')]?_[_0x8cd2('0x48')](_0x59a22f)[_0x8cd2('0x47')]+0x1:_0x2c1b26;_0x4d5f9e=_[_0x8cd2('0x49')](_0x4d5f9e,_0x59a22f,[_0xc958c3],_0x388dd6);_0x2c1b26=_[_0x8cd2('0x48')](_0x4d5f9e)['priority']+0x1;}return _0x433d0d(_0x4d5f9e);})[_0x8cd2('0x4a')](function(_0x1e81a0){_0x147ce0(_0x1e81a0);});});}return _0xb78e1e[_0x8cd2('0x4b')](_0x8cd2('0x4c'),attributes,{'tableName':_0x8cd2('0x4d'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x331c26){var _0x683ac2=this[_0x8cd2('0x4e')]({'plain':!![]});var _0x3c563e=_0x683ac2['type']===_0x8cd2('0x11')?_0x3ace79(_0x683ac2):_0x167aee(_0x683ac2);return _0x1b45aa(_0x683ac2,_0x331c26,_[_0x8cd2('0x48')](_0x3c563e)[_0x8cd2('0x47')]+0x1)[_0x8cd2('0x31')](function(_0x4027f8){var _0x31ec4f=_['concat'](_0x3c563e,_0x4027f8);_0x31ec4f[_0x8cd2('0xd')]({'type':_0x683ac2['type'],'app':_0x8cd2('0x4f'),'exten':_0x683ac2[_0x8cd2('0x6')],'context':_0x683ac2['context'],'priority':_[_0x8cd2('0x48')](_0x31ec4f)['priority']+0x1,'VoiceExtensionId':_0x683ac2['id']});return _0x31ec4f;});}}});};
\ No newline at end of file
index f110ae3..b6af6cf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96aa=['redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','findAll','options','attributes','limit','map','include','model','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x96aa,0x67));var _0xa96a=function(_0x51aed7,_0x3427b8){_0x51aed7=_0x51aed7-0x0;var _0x1fa47f=_0x96aa[_0x51aed7];return _0x1fa47f;};'use strict';var _=require(_0xa96a('0x0'));var util=require(_0xa96a('0x1'));var moment=require('moment');var BPromise=require(_0xa96a('0x2'));var rs=require(_0xa96a('0x3'));var fs=require('fs');var Redis=require(_0xa96a('0x4'));var db=require(_0xa96a('0x5'))['db'];var utils=require(_0xa96a('0x6'));var logger=require('../../config/logger')(_0xa96a('0x7'));var config=require(_0xa96a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa96a('0x9')][_0xa96a('0xa')]({'port':0x232a});config[_0xa96a('0xb')]=_[_0xa96a('0xc')](config[_0xa96a('0xb')],{'host':_0xa96a('0xd'),'port':0x18eb});var socket=require(_0xa96a('0xe'))(new Redis(config[_0xa96a('0xb')]));require(_0xa96a('0xf'))[_0xa96a('0x10')](socket);function respondWithRpcPromise(_0x13321e,_0x4825fc,_0x33b786){return new BPromise(function(_0x5532f2,_0x234d1a){return client[_0xa96a('0x11')](_0x13321e,_0x33b786)['then'](function(_0x32393a){logger[_0xa96a('0x12')](_0xa96a('0x13'),_0x4825fc,_0xa96a('0x14'));logger[_0xa96a('0x15')](_0xa96a('0x16'),_0x4825fc,_0xa96a('0x14'),JSON[_0xa96a('0x17')](_0x32393a));if(_0x32393a[_0xa96a('0x18')]){if(_0x32393a[_0xa96a('0x18')][_0xa96a('0x19')]===0x1f4){logger[_0xa96a('0x18')]('VoiceExtension,\x20%s,\x20%s',_0x4825fc,_0x32393a['error'][_0xa96a('0x1a')]);return _0x234d1a(_0x32393a['error'][_0xa96a('0x1a')]);}logger['error'](_0xa96a('0x13'),_0x4825fc,_0x32393a[_0xa96a('0x18')][_0xa96a('0x1a')]);return _0x5532f2(_0x32393a[_0xa96a('0x18')][_0xa96a('0x1a')]);}else{logger[_0xa96a('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x4825fc,_0xa96a('0x14'));_0x5532f2(_0x32393a[_0xa96a('0x1b')]['message']);}})[_0xa96a('0x1c')](function(_0x33298e){logger[_0xa96a('0x18')](_0xa96a('0x13'),_0x4825fc,_0x33298e);_0x234d1a(_0x33298e);});});}exports[_0xa96a('0x1d')]=function(_0x14c8e5){var _0x4e3f58=this;return new Promise(function(_0x190e94,_0x3f41ad){return db['VoiceExtension'][_0xa96a('0x1e')]({'raw':_0x14c8e5['options']?_0x14c8e5[_0xa96a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x14c8e5[_0xa96a('0x1f')]?_0x14c8e5[_0xa96a('0x1f')]['where']||null:null,'attributes':_0x14c8e5['options']?_0x14c8e5[_0xa96a('0x1f')][_0xa96a('0x20')]||null:null,'limit':_0x14c8e5[_0xa96a('0x1f')]?_0x14c8e5[_0xa96a('0x1f')][_0xa96a('0x21')]||null:null,'include':_0x14c8e5[_0xa96a('0x1f')]?_0x14c8e5['options']['include']?_[_0xa96a('0x22')](_0x14c8e5['options'][_0xa96a('0x23')],function(_0x44c4ee){return{'model':db[_0x44c4ee[_0xa96a('0x24')]],'as':_0x44c4ee['as'],'attributes':_0x44c4ee['attributes'],'include':_0x44c4ee[_0xa96a('0x23')]?_['map'](_0x44c4ee['include'],function(_0x4310a9){return{'model':db[_0x4310a9['model']],'as':_0x4310a9['as'],'attributes':_0x4310a9[_0xa96a('0x20')],'include':_0x4310a9[_0xa96a('0x23')]?_[_0xa96a('0x22')](_0x4310a9['include'],function(_0x1bb965){return{'model':db[_0x1bb965['model']],'as':_0x1bb965['as'],'attributes':_0x1bb965['attributes']};}):[]};}):[]};}):[]:[]})[_0xa96a('0x25')](function(_0x5576b9){logger['info'](_0xa96a('0x1d'),_0x14c8e5);logger[_0xa96a('0x15')]('GetVoiceExtension',_0x14c8e5,JSON[_0xa96a('0x17')](_0x5576b9));_0x190e94(_0x5576b9);})[_0xa96a('0x1c')](function(_0x472d59){logger[_0xa96a('0x18')](_0xa96a('0x1d'),_0x472d59['message'],_0x14c8e5);_0x3f41ad(_0x4e3f58[_0xa96a('0x18')](0x1f4,_0x472d59[_0xa96a('0x1a')]));});});};
\ No newline at end of file
+var _0x3a0f=['GetVoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceExtension.socket','register','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','VoiceExtension,\x20%s,\x20%s','result','catch'];(function(_0x32ceb3,_0x29fe45){var _0x391dd4=function(_0x4ceece){while(--_0x4ceece){_0x32ceb3['push'](_0x32ceb3['shift']());}};_0x391dd4(++_0x29fe45);}(_0x3a0f,0x145));var _0xf3a0=function(_0x15ba95,_0x114d6b){_0x15ba95=_0x15ba95-0x0;var _0x4fdf02=_0x3a0f[_0x15ba95];return _0x4fdf02;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf3a0('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf3a0('0x1'));var db=require(_0xf3a0('0x2'))['db'];var utils=require(_0xf3a0('0x3'));var logger=require(_0xf3a0('0x4'))(_0xf3a0('0x5'));var config=require(_0xf3a0('0x6'));var jayson=require(_0xf3a0('0x7'));var client=jayson[_0xf3a0('0x8')]['http']({'port':0x232a});config[_0xf3a0('0x9')]=_[_0xf3a0('0xa')](config[_0xf3a0('0x9')],{'host':_0xf3a0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf3a0('0x9')]));require(_0xf3a0('0xc'))[_0xf3a0('0xd')](socket);function respondWithRpcPromise(_0x12970e,_0x4acd91,_0x185cf7){return new BPromise(function(_0x3d2d63,_0x40d12a){return client['request'](_0x12970e,_0x185cf7)[_0xf3a0('0xe')](function(_0x318e6a){logger[_0xf3a0('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x4acd91,_0xf3a0('0x10'));logger[_0xf3a0('0x11')](_0xf3a0('0x12'),_0x4acd91,'request\x20sent',JSON['stringify'](_0x318e6a));if(_0x318e6a[_0xf3a0('0x13')]){if(_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x14')]===0x1f4){logger[_0xf3a0('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x4acd91,_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);return _0x40d12a(_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);}logger[_0xf3a0('0x13')](_0xf3a0('0x16'),_0x4acd91,_0x318e6a[_0xf3a0('0x13')][_0xf3a0('0x15')]);return _0x3d2d63(_0x318e6a['error']['message']);}else{logger[_0xf3a0('0xf')](_0xf3a0('0x16'),_0x4acd91,_0xf3a0('0x10'));_0x3d2d63(_0x318e6a[_0xf3a0('0x17')][_0xf3a0('0x15')]);}})[_0xf3a0('0x18')](function(_0x5e04b7){logger['error'](_0xf3a0('0x16'),_0x4acd91,_0x5e04b7);_0x40d12a(_0x5e04b7);});});}exports[_0xf3a0('0x19')]=function(_0x66660c){var _0x431fe5=this;return new Promise(function(_0x25c2f4,_0x4f36ae){return db['VoiceExtension'][_0xf3a0('0x1a')]({'raw':_0x66660c['options']?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x1c')]===undefined?!![]:![]:!![],'where':_0x66660c[_0xf3a0('0x1b')]?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x1d')]||null:null,'attributes':_0x66660c[_0xf3a0('0x1b')]?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x1e')]||null:null,'limit':_0x66660c[_0xf3a0('0x1b')]?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x1f')]||null:null,'include':_0x66660c[_0xf3a0('0x1b')]?_0x66660c[_0xf3a0('0x1b')][_0xf3a0('0x20')]?_[_0xf3a0('0x21')](_0x66660c['options'][_0xf3a0('0x20')],function(_0x182ce6){return{'model':db[_0x182ce6[_0xf3a0('0x22')]],'as':_0x182ce6['as'],'attributes':_0x182ce6[_0xf3a0('0x1e')],'include':_0x182ce6[_0xf3a0('0x20')]?_[_0xf3a0('0x21')](_0x182ce6[_0xf3a0('0x20')],function(_0x7f90dd){return{'model':db[_0x7f90dd['model']],'as':_0x7f90dd['as'],'attributes':_0x7f90dd['attributes'],'include':_0x7f90dd['include']?_[_0xf3a0('0x21')](_0x7f90dd[_0xf3a0('0x20')],function(_0x252f89){return{'model':db[_0x252f89[_0xf3a0('0x22')]],'as':_0x252f89['as'],'attributes':_0x252f89['attributes']};}):[]};}):[]};}):[]:[]})[_0xf3a0('0xe')](function(_0x13e65a){logger[_0xf3a0('0xf')](_0xf3a0('0x19'),_0x66660c);logger[_0xf3a0('0x11')](_0xf3a0('0x19'),_0x66660c,JSON['stringify'](_0x13e65a));_0x25c2f4(_0x13e65a);})[_0xf3a0('0x18')](function(_0x1065bd){logger[_0xf3a0('0x13')](_0xf3a0('0x19'),_0x1065bd[_0xf3a0('0x15')],_0x66660c);_0x4f36ae(_0x431fe5[_0xf3a0('0x13')](0x1f4,_0x1065bd['message']));});});};
\ No newline at end of file
index 5e9462a..68bbeaf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x75fac4,_0x2228a3){var _0x245758=function(_0x223b30){while(--_0x223b30){_0x75fac4['push'](_0x75fac4['shift']());}};_0x245758(++_0x2228a3);}(_0x7a54,0x106));var _0x47a5=function(_0x2e6f5f,_0x46d7a7){_0x2e6f5f=_0x2e6f5f-0x0;var _0x203603=_0x7a54[_0x2e6f5f];return _0x203603;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}};
\ No newline at end of file
+var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x5de390,_0x5b955f){var _0x1d8685=function(_0x444fa8){while(--_0x444fa8){_0x5de390['push'](_0x5de390['shift']());}};_0x1d8685(++_0x5b955f);}(_0x1261,0x144));var _0x1126=function(_0x5e6d65,_0x5db89c){_0x5e6d65=_0x5e6d65-0x0;var _0x5e1f75=_0x1261[_0x5e6d65];return _0x5e1f75;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}};
\ No newline at end of file
index bd33365..5d3ce8c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5430=['Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x525af9,_0x4edd23){var _0x129fbf=function(_0x4f44fe){while(--_0x4f44fe){_0x525af9['push'](_0x525af9['shift']());}};_0x129fbf(++_0x4edd23);}(_0x5430,0x10c));var _0x0543=function(_0x23261b,_0x8834ed){_0x23261b=_0x23261b-0x0;var _0x50b977=_0x5430[_0x23261b];return _0x50b977;};'use strict';var multer=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var path=require(_0x0543('0x2'));var timeout=require(_0x0543('0x3'));var express=require(_0x0543('0x4'));var router=express[_0x0543('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0543('0x6'));var config=require('../../config/environment');var controller=require('./voiceMail.controller');router[_0x0543('0x7')]('/',auth[_0x0543('0x8')](),controller[_0x0543('0x9')]);router[_0x0543('0x7')](_0x0543('0xa'),auth['isAuthenticated'](),controller[_0x0543('0xb')]);router[_0x0543('0x7')](_0x0543('0xc'),auth[_0x0543('0x8')](),controller[_0x0543('0xd')]);router[_0x0543('0xe')]('/',auth['isAuthenticated'](),controller[_0x0543('0xf')]);router[_0x0543('0x10')]('/:id',auth[_0x0543('0x8')](),controller[_0x0543('0x11')]);router[_0x0543('0x12')](_0x0543('0xa'),auth[_0x0543('0x8')](),controller[_0x0543('0x13')]);module[_0x0543('0x14')]=router;
\ No newline at end of file
+var _0x7046=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','getMessages','post','create','put','update'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x7046,0x144));var _0x6704=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7046[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var path=require(_0x6704('0x2'));var timeout=require(_0x6704('0x3'));var express=require('express');var router=express[_0x6704('0x4')]();var fs_extra=require(_0x6704('0x5'));var auth=require(_0x6704('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6704('0x7'));var controller=require(_0x6704('0x8'));router[_0x6704('0x9')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xb')]);router['get'](_0x6704('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6704('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0x6704('0xd')]);router[_0x6704('0xe')]('/',auth[_0x6704('0xa')](),controller[_0x6704('0xf')]);router[_0x6704('0x10')](_0x6704('0xc'),auth[_0x6704('0xa')](),controller[_0x6704('0x11')]);router['delete'](_0x6704('0xc'),auth[_0x6704('0xa')](),controller['destroy']);module[_0x6704('0x12')]=router;
\ No newline at end of file
index 0ed2386..6557d84 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7ff=['central','ENUM','yes','TIMESTAMP','INTEGER','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','setDataValue','string','trim'];(function(_0x15cf23,_0x4f90d5){var _0x19cf58=function(_0x33c23e){while(--_0x33c23e){_0x15cf23['push'](_0x15cf23['shift']());}};_0x19cf58(++_0x4f90d5);}(_0xd7ff,0x171));var _0xfd7f=function(_0x54ea21,_0x141bbd){_0x54ea21=_0x54ea21-0x0;var _0x44a3df=_0xd7ff[_0x54ea21];return _0x44a3df;};'use strict';var Sequelize=require(_0xfd7f('0x0'));module[_0xfd7f('0x1')]={'customer_id':{'type':Sequelize[_0xfd7f('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0xfd7f('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xfd7f('0x2')],'validate':{'isEmail':!![]},'set':function(_0x112d6f){this[_0xfd7f('0x3')]('email',typeof _0x112d6f===_0xfd7f('0x4')&&_0x112d6f[_0xfd7f('0x5')]()?_0x112d6f['trim']():null);}},'pager':{'type':Sequelize[_0xfd7f('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xfd7f('0x6')},'attach':{'type':Sequelize[_0xfd7f('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0xfd7f('0x8'),'no'),'defaultValue':_0xfd7f('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfd7f('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xfd7f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfd7f('0x7')](_0xfd7f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xfd7f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0xfd7f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xfd7f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xfd7f('0x7')](_0xfd7f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfd7f('0x7')](_0xfd7f('0x8'),'no'),'defaultValue':_0xfd7f('0x8'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xfd7f('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfd7f('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfd7f('0x7')](_0xfd7f('0x8'),'no'),'defaultValue':_0xfd7f('0x8'),'allowNull':![]},'stamp':{'type':_0xfd7f('0x9')},'emailsubject':{'type':Sequelize[_0xfd7f('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfd7f('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xfd7f('0xb')](_0xfd7f('0xc'))+_0xfd7f('0xd')+this[_0xfd7f('0xb')](_0xfd7f('0xe'));}}};
\ No newline at end of file
+var _0x4b7d=['email','string','trim','central','ENUM','yes','TINYINT(4)','INTEGER','getDataValue','\x20-\x20','sequelize','exports','STRING','contest_mailbox'];(function(_0x457a87,_0x5ea87f){var _0x390362=function(_0x37e75d){while(--_0x37e75d){_0x457a87['push'](_0x457a87['shift']());}};_0x390362(++_0x5ea87f);}(_0x4b7d,0x1e6));var _0xd4b7=function(_0xd55b64,_0x21f609){_0xd55b64=_0xd55b64-0x0;var _0x2dca2a=_0x4b7d[_0xd55b64];return _0x2dca2a;};'use strict';var Sequelize=require(_0xd4b7('0x0'));module[_0xd4b7('0x1')]={'customer_id':{'type':Sequelize[_0xd4b7('0x2')]},'context':{'type':Sequelize[_0xd4b7('0x2')],'defaultValue':'from-voicemail','unique':_0xd4b7('0x3')},'mailbox':{'type':Sequelize[_0xd4b7('0x2')],'defaultValue':'','allowNull':![],'unique':_0xd4b7('0x3')},'password':{'type':Sequelize[_0xd4b7('0x2')]},'fullname':{'type':Sequelize[_0xd4b7('0x2')]},'email':{'type':Sequelize[_0xd4b7('0x2')],'validate':{'isEmail':!![]},'set':function(_0x25feec){this['setDataValue'](_0xd4b7('0x4'),typeof _0x25feec===_0xd4b7('0x5')&&_0x25feec[_0xd4b7('0x6')]()?_0x25feec[_0xd4b7('0x6')]():null);}},'pager':{'type':Sequelize[_0xd4b7('0x2')]},'tz':{'type':Sequelize[_0xd4b7('0x2')],'defaultValue':_0xd4b7('0x7')},'attach':{'type':Sequelize[_0xd4b7('0x8')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xd4b7('0x8')]('yes','no'),'defaultValue':_0xd4b7('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xd4b7('0x2')]},'callback':{'type':Sequelize[_0xd4b7('0x2')]},'review':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xd4b7('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':_0xd4b7('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xd4b7('0x8')](_0xd4b7('0x9'),'no'),'defaultValue':_0xd4b7('0x9'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xd4b7('0x2')]},'emailbody':{'type':Sequelize[_0xd4b7('0x2')]},'maxsecs':{'type':Sequelize[_0xd4b7('0xb')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xd4b7('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xd4b7('0xc')]('fullname')+_0xd4b7('0xd')+this['getDataValue']('mailbox');}}};
\ No newline at end of file
index 52e4823..4d3ec19 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6cb4=['bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','options','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','getMessages','findOne','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x47a349,_0x4699d9){var _0x18ab75=function(_0x210796){while(--_0x210796){_0x47a349['push'](_0x47a349['shift']());}};_0x18ab75(++_0x4699d9);}(_0x6cb4,0xff));var _0x46cb=function(_0x145505,_0x1f8a9e){_0x145505=_0x145505-0x0;var _0x5b469a=_0x6cb4[_0x145505];return _0x5b469a;};'use strict';var emlformat=require(_0x46cb('0x0'));var rimraf=require(_0x46cb('0x1'));var zipdir=require(_0x46cb('0x2'));var jsonpatch=require(_0x46cb('0x3'));var rp=require(_0x46cb('0x4'));var moment=require(_0x46cb('0x5'));var BPromise=require(_0x46cb('0x6'));var Mustache=require(_0x46cb('0x7'));var util=require(_0x46cb('0x8'));var path=require('path');var sox=require(_0x46cb('0x9'));var csv=require('to-csv');var ejs=require(_0x46cb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x46cb('0xb'));var squel=require(_0x46cb('0xc'));var crypto=require(_0x46cb('0xd'));var jsforce=require(_0x46cb('0xe'));var deskjs=require(_0x46cb('0xf'));var toCsv=require(_0x46cb('0x10'));var querystring=require('querystring');var Papa=require(_0x46cb('0x11'));var Redis=require(_0x46cb('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x46cb('0x13'));var as=require(_0x46cb('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x46cb('0x15'))(_0x46cb('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x46cb('0x17'))['db'];function respondWithStatusCode(_0x323ac2,_0x1058a8){_0x1058a8=_0x1058a8||0xcc;return function(_0xf22158){if(_0xf22158){return _0x323ac2['sendStatus'](_0x1058a8);}return _0x323ac2[_0x46cb('0x18')](_0x1058a8)[_0x46cb('0x19')]();};}function respondWithResult(_0x2a1f9d,_0x3c0071){_0x3c0071=_0x3c0071||0xc8;return function(_0x1f7150){if(_0x1f7150){return _0x2a1f9d[_0x46cb('0x18')](_0x3c0071)[_0x46cb('0x1a')](_0x1f7150);}};}function respondWithFilteredResult(_0x3c396b,_0x37d368){return function(_0x41e398){if(_0x41e398){var _0x136215=typeof _0x37d368['offset']===_0x46cb('0x1b')&&typeof _0x37d368['limit']===_0x46cb('0x1b');var _0x4ab22b=_0x41e398['count'];var _0x4e3454=_0x136215?0x0:_0x37d368[_0x46cb('0x1c')];var _0x1f2891=_0x136215?_0x41e398[_0x46cb('0x1d')]:_0x37d368[_0x46cb('0x1c')]+_0x37d368[_0x46cb('0x1e')];var _0x26e38d;if(_0x1f2891>=_0x4ab22b){_0x1f2891=_0x4ab22b;_0x26e38d=0xc8;}else{_0x26e38d=0xce;}_0x3c396b[_0x46cb('0x18')](_0x26e38d);return _0x3c396b[_0x46cb('0x1f')](_0x46cb('0x20'),_0x4e3454+'-'+_0x1f2891+'/'+_0x4ab22b)[_0x46cb('0x1a')](_0x41e398);}return null;};}function patchUpdates(_0x149483){return function(_0x46e541){try{jsonpatch[_0x46cb('0x21')](_0x46e541,_0x149483,!![]);}catch(_0x2f438b){return BPromise[_0x46cb('0x22')](_0x2f438b);}return _0x46e541[_0x46cb('0x23')]();};}function saveUpdates(_0x7084b2,_0x1fb467){return function(_0x41ecd2){if(_0x41ecd2){return _0x41ecd2[_0x46cb('0x24')](_0x7084b2)[_0x46cb('0x25')](function(_0x1e9e38){return _0x1e9e38;});}return null;};}function removeEntity(_0x309e4b,_0xadcad6){return function(_0x40e0e5){if(_0x40e0e5){return _0x40e0e5['destroy']()['then'](function(){var _0x6588f3=_0x40e0e5[_0x46cb('0x26')]({'plain':!![]});var _0x2711ac=_0x46cb('0x27');return db[_0x46cb('0x28')]['destroy']({'where':{'type':_0x2711ac,'resourceId':_0x6588f3['id']}})[_0x46cb('0x25')](function(){return _0x40e0e5;});})['then'](function(){_0x309e4b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x180ce1,_0x119bf6){return function(_0x2242e7){if(!_0x2242e7){_0x180ce1[_0x46cb('0x29')](0x194);}return _0x2242e7;};}function handleError(_0x7cd177,_0x33218b){_0x33218b=_0x33218b||0x1f4;return function(_0x378dc7){logger[_0x46cb('0x2a')](_0x378dc7[_0x46cb('0x2b')]);if(_0x378dc7[_0x46cb('0x2c')]){delete _0x378dc7[_0x46cb('0x2c')];}_0x7cd177['status'](_0x33218b)[_0x46cb('0x2d')](_0x378dc7);};}exports[_0x46cb('0x2e')]=function(_0x4c73bd,_0x49e0bc){var _0x15f5cf={},_0x5cbb22={},_0x27c22d={'count':0x0,'rows':[]};var _0x6f7953=_[_0x46cb('0x2f')](db[_0x46cb('0x30')][_0x46cb('0x31')],function(_0x33c248){return{'name':_0x33c248['fieldName'],'type':_0x33c248[_0x46cb('0x32')]['key']};});_0x5cbb22[_0x46cb('0x33')]=_[_0x46cb('0x2f')](_0x6f7953,'name');_0x5cbb22[_0x46cb('0x34')]=_[_0x46cb('0x35')](_0x4c73bd[_0x46cb('0x34')]);_0x5cbb22[_0x46cb('0x36')]=_[_0x46cb('0x37')](_0x5cbb22['model'],_0x5cbb22[_0x46cb('0x34')]);_0x15f5cf['attributes']=_[_0x46cb('0x37')](_0x5cbb22[_0x46cb('0x33')],qs[_0x46cb('0x38')](_0x4c73bd['query'][_0x46cb('0x38')]));_0x15f5cf[_0x46cb('0x39')]=_0x15f5cf['attributes'][_0x46cb('0x3a')]?_0x15f5cf[_0x46cb('0x39')]:_0x5cbb22[_0x46cb('0x33')];if(!_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x3b')](_0x46cb('0x3c'))){_0x15f5cf[_0x46cb('0x1e')]=qs[_0x46cb('0x1e')](_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x1e')]);_0x15f5cf[_0x46cb('0x1c')]=qs['offset'](_0x4c73bd['query']['offset']);}_0x15f5cf[_0x46cb('0x3d')]=qs[_0x46cb('0x3e')](_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x3e')]);_0x15f5cf[_0x46cb('0x3f')]=qs[_0x46cb('0x36')](_['pick'](_0x4c73bd[_0x46cb('0x34')],_0x5cbb22['filters']),_0x6f7953);if(_0x4c73bd['query'][_0x46cb('0x40')]){_0x15f5cf['where']=_['merge'](_0x15f5cf[_0x46cb('0x3f')],{'$or':_['map'](_0x6f7953,function(_0x5cf8be){if(_0x5cf8be[_0x46cb('0x32')]!==_0x46cb('0x41')){var _0x4680bc={};_0x4680bc[_0x5cf8be[_0x46cb('0x2c')]]={'$like':'%'+_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x40')]+'%'};return _0x4680bc;}})});}_0x15f5cf=_[_0x46cb('0x42')]({},_0x15f5cf,_0x4c73bd['options']);var _0x358ed4={'where':_0x15f5cf['where']};return db[_0x46cb('0x30')]['count'](_0x358ed4)[_0x46cb('0x25')](function(_0x2fbad9){_0x27c22d[_0x46cb('0x1d')]=_0x2fbad9;if(_0x4c73bd['query'][_0x46cb('0x43')]){_0x15f5cf[_0x46cb('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0x46cb('0x45')](_0x15f5cf);})[_0x46cb('0x25')](function(_0x1f67af){_0x27c22d[_0x46cb('0x46')]=_0x1f67af;return _0x27c22d;})[_0x46cb('0x25')](respondWithFilteredResult(_0x49e0bc,_0x15f5cf))['catch'](handleError(_0x49e0bc,null));};exports['show']=function(_0x10bada,_0x4c8ac3){var _0x1a9959={'raw':!![],'where':{'id':_0x10bada['params']['id']}},_0x41f76c={};_0x41f76c[_0x46cb('0x33')]=_[_0x46cb('0x35')](db[_0x46cb('0x30')]['rawAttributes']);_0x41f76c['query']=_['keys'](_0x10bada['query']);_0x41f76c[_0x46cb('0x36')]=_[_0x46cb('0x37')](_0x41f76c[_0x46cb('0x33')],_0x41f76c[_0x46cb('0x34')]);_0x1a9959[_0x46cb('0x39')]=_['intersection'](_0x41f76c['model'],qs[_0x46cb('0x38')](_0x10bada[_0x46cb('0x34')]['fields']));_0x1a9959[_0x46cb('0x39')]=_0x1a9959[_0x46cb('0x39')][_0x46cb('0x3a')]?_0x1a9959[_0x46cb('0x39')]:_0x41f76c[_0x46cb('0x33')];if(_0x10bada[_0x46cb('0x34')][_0x46cb('0x43')]){_0x1a9959['include']=[{'all':!![]}];}_0x1a9959=_['merge']({},_0x1a9959,_0x10bada[_0x46cb('0x47')]);return db['VoiceMail'][_0x46cb('0x48')](_0x1a9959)[_0x46cb('0x25')](handleEntityNotFound(_0x4c8ac3,null))[_0x46cb('0x25')](respondWithResult(_0x4c8ac3,null))['catch'](handleError(_0x4c8ac3,null));};exports[_0x46cb('0x49')]=function(_0x5c1665,_0x5c02c9){return db[_0x46cb('0x30')][_0x46cb('0x49')](_0x5c1665[_0x46cb('0x4a')],{})[_0x46cb('0x25')](function(_0x1b2072){var _0x26adb4=_0x5c1665[_0x46cb('0x4b')]['get']({'plain':!![]});if(!_0x26adb4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26adb4[_0x46cb('0x4c')]===_0x46cb('0x4b')){var _0x52e479=_0x1b2072[_0x46cb('0x26')]({'plain':!![]});var _0x33ab2e=_0x46cb('0x27');return db[_0x46cb('0x4d')][_0x46cb('0x48')]({'where':{'name':_0x33ab2e,'userProfileId':_0x26adb4['userProfileId']},'raw':!![]})[_0x46cb('0x25')](function(_0x202910){if(_0x202910&&_0x202910[_0x46cb('0x4e')]===0x0){return db['UserProfileResource'][_0x46cb('0x49')]({'name':_0x52e479['name'],'resourceId':_0x52e479['id'],'type':_0x202910['name'],'sectionId':_0x202910['id']},{})[_0x46cb('0x25')](function(){return _0x1b2072;});}else{return _0x1b2072;}})[_0x46cb('0x4f')](function(_0x2fe0b1){logger[_0x46cb('0x2a')](_0x46cb('0x50'),_0x2fe0b1);throw _0x2fe0b1;});}return _0x1b2072;})['then'](respondWithResult(_0x5c02c9,0xc9))[_0x46cb('0x4f')](handleError(_0x5c02c9,null));};exports[_0x46cb('0x24')]=function(_0x5701c0,_0x51a103){if(_0x5701c0[_0x46cb('0x4a')]['id']){delete _0x5701c0[_0x46cb('0x4a')]['id'];}return db[_0x46cb('0x30')]['find']({'where':{'id':_0x5701c0[_0x46cb('0x51')]['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x51a103,null))[_0x46cb('0x25')](saveUpdates(_0x5701c0[_0x46cb('0x4a')],null))[_0x46cb('0x25')](respondWithResult(_0x51a103,null))[_0x46cb('0x4f')](handleError(_0x51a103,null));};exports[_0x46cb('0x52')]=function(_0x287147,_0x2ba8b5){return db['VoiceMail'][_0x46cb('0x48')]({'where':{'id':_0x287147['params']['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x2ba8b5,null))[_0x46cb('0x25')](removeEntity(_0x2ba8b5,null))[_0x46cb('0x4f')](handleError(_0x2ba8b5,null));};exports[_0x46cb('0x53')]=function(_0x532aa2,_0x67fb77,_0x13d25f){return db[_0x46cb('0x30')][_0x46cb('0x54')]({'where':{'id':_0x532aa2[_0x46cb('0x51')]['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x67fb77,null))[_0x46cb('0x25')](function(_0x2e55f4){var _0x57c29b;var _0x4a0606={},_0x5a4b11={};_0x5a4b11['model']=_[_0x46cb('0x35')](db[_0x46cb('0x55')]['rawAttributes']);_0x5a4b11[_0x46cb('0x34')]=_[_0x46cb('0x35')](_0x532aa2[_0x46cb('0x34')]);_0x5a4b11['filters']=_['intersection'](_0x5a4b11[_0x46cb('0x33')],_0x5a4b11['query']);_0x4a0606[_0x46cb('0x39')]=_[_0x46cb('0x37')](_0x5a4b11[_0x46cb('0x33')],qs[_0x46cb('0x38')](_0x532aa2[_0x46cb('0x34')][_0x46cb('0x38')]));_0x4a0606[_0x46cb('0x39')]=_0x4a0606[_0x46cb('0x39')][_0x46cb('0x3a')]?_0x4a0606[_0x46cb('0x39')]:_0x5a4b11[_0x46cb('0x33')];if(!_0x532aa2[_0x46cb('0x34')][_0x46cb('0x3b')]('nolimit')){_0x4a0606[_0x46cb('0x1e')]=qs['limit'](_0x532aa2[_0x46cb('0x34')][_0x46cb('0x1e')]);_0x4a0606[_0x46cb('0x1c')]=qs[_0x46cb('0x1c')](_0x532aa2[_0x46cb('0x34')][_0x46cb('0x1c')]);}_0x4a0606[_0x46cb('0x3d')]=qs['sort'](_0x532aa2[_0x46cb('0x34')][_0x46cb('0x3e')]);_0x4a0606[_0x46cb('0x3f')]=qs[_0x46cb('0x36')](_['pick'](_0x532aa2[_0x46cb('0x34')],_0x5a4b11[_0x46cb('0x36')]));if(_0x532aa2[_0x46cb('0x34')][_0x46cb('0x40')]){_0x4a0606[_0x46cb('0x3f')]=_['merge'](_0x4a0606[_0x46cb('0x3f')],{'$or':_[_0x46cb('0x2f')](_0x4a0606[_0x46cb('0x39')],function(_0x2625e4){var _0x38b4a6={};_0x38b4a6[_0x2625e4]={'$like':'%'+_0x532aa2[_0x46cb('0x34')][_0x46cb('0x40')]+'%'};return _0x38b4a6;})});}_0x4a0606[_0x46cb('0x3f')]=_['merge'](_0x4a0606['where'],{'mailboxuser':_0x2e55f4['mailbox']});_0x4a0606=_[_0x46cb('0x42')]({},_0x4a0606,_0x532aa2[_0x46cb('0x47')]);return db[_0x46cb('0x55')][_0x46cb('0x56')](_0x4a0606)[_0x46cb('0x25')](respondWithFilteredResult(_0x67fb77,_0x4a0606));})[_0x46cb('0x4f')](handleError(_0x67fb77,null));};
\ No newline at end of file
+var _0x58a4=['catch','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','get','Voicemails','UserProfileResource','error','stack','name','send','index','map','VoiceMail','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll'];(function(_0x5492e8,_0x139fb4){var _0x3c39e4=function(_0x45e07c){while(--_0x45e07c){_0x5492e8['push'](_0x5492e8['shift']());}};_0x3c39e4(++_0x139fb4);}(_0x58a4,0xbf));var _0x458a=function(_0x14790f,_0x432b5f){_0x14790f=_0x14790f-0x0;var _0x5acc1f=_0x58a4[_0x14790f];return _0x5acc1f;};'use strict';var emlformat=require(_0x458a('0x0'));var rimraf=require(_0x458a('0x1'));var zipdir=require(_0x458a('0x2'));var jsonpatch=require(_0x458a('0x3'));var rp=require(_0x458a('0x4'));var moment=require(_0x458a('0x5'));var BPromise=require(_0x458a('0x6'));var Mustache=require(_0x458a('0x7'));var util=require(_0x458a('0x8'));var path=require(_0x458a('0x9'));var sox=require(_0x458a('0xa'));var csv=require(_0x458a('0xb'));var ejs=require(_0x458a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x458a('0xd'));var crypto=require(_0x458a('0xe'));var jsforce=require(_0x458a('0xf'));var deskjs=require(_0x458a('0x10'));var toCsv=require(_0x458a('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x458a('0x11'));var authService=require(_0x458a('0x12'));var qs=require(_0x458a('0x13'));var as=require(_0x458a('0x14'));var hardwareService=require(_0x458a('0x15'));var logger=require('../../config/logger')(_0x458a('0x16'));var utils=require(_0x458a('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x458a('0x18'));var db=require(_0x458a('0x19'))['db'];function respondWithStatusCode(_0xee09c6,_0x2a4934){_0x2a4934=_0x2a4934||0xcc;return function(_0x2e788b){if(_0x2e788b){return _0xee09c6['sendStatus'](_0x2a4934);}return _0xee09c6['status'](_0x2a4934)[_0x458a('0x1a')]();};}function respondWithResult(_0x56436f,_0x2c7528){_0x2c7528=_0x2c7528||0xc8;return function(_0x44f683){if(_0x44f683){return _0x56436f[_0x458a('0x1b')](_0x2c7528)[_0x458a('0x1c')](_0x44f683);}};}function respondWithFilteredResult(_0xad80f9,_0x29acee){return function(_0x507b0f){if(_0x507b0f){var _0x4b26be=typeof _0x29acee['offset']===_0x458a('0x1d')&&typeof _0x29acee[_0x458a('0x1e')]===_0x458a('0x1d');var _0x5c5b41=_0x507b0f[_0x458a('0x1f')];var _0x260c87=_0x4b26be?0x0:_0x29acee[_0x458a('0x20')];var _0x392986=_0x4b26be?_0x507b0f[_0x458a('0x1f')]:_0x29acee['offset']+_0x29acee['limit'];var _0x178db9;if(_0x392986>=_0x5c5b41){_0x392986=_0x5c5b41;_0x178db9=0xc8;}else{_0x178db9=0xce;}_0xad80f9['status'](_0x178db9);return _0xad80f9[_0x458a('0x21')](_0x458a('0x22'),_0x260c87+'-'+_0x392986+'/'+_0x5c5b41)['json'](_0x507b0f);}return null;};}function patchUpdates(_0x468416){return function(_0x55a588){try{jsonpatch[_0x458a('0x23')](_0x55a588,_0x468416,!![]);}catch(_0x1c79cb){return BPromise['reject'](_0x1c79cb);}return _0x55a588[_0x458a('0x24')]();};}function saveUpdates(_0xead884,_0x5a2bcb){return function(_0xa6b8ff){if(_0xa6b8ff){return _0xa6b8ff['update'](_0xead884)[_0x458a('0x25')](function(_0x5bca42){return _0x5bca42;});}return null;};}function removeEntity(_0x4080fc,_0x5dfc6c){return function(_0x36b08e){if(_0x36b08e){return _0x36b08e[_0x458a('0x26')]()[_0x458a('0x25')](function(){var _0xcda8cc=_0x36b08e[_0x458a('0x27')]({'plain':!![]});var _0x19bd5=_0x458a('0x28');return db[_0x458a('0x29')][_0x458a('0x26')]({'where':{'type':_0x19bd5,'resourceId':_0xcda8cc['id']}})[_0x458a('0x25')](function(){return _0x36b08e;});})[_0x458a('0x25')](function(){_0x4080fc[_0x458a('0x1b')](0xcc)[_0x458a('0x1a')]();});}};}function handleEntityNotFound(_0x5a55b7,_0xb94bd9){return function(_0x112fa6){if(!_0x112fa6){_0x5a55b7['sendStatus'](0x194);}return _0x112fa6;};}function handleError(_0x5df150,_0x41b23d){_0x41b23d=_0x41b23d||0x1f4;return function(_0x596fe2){logger[_0x458a('0x2a')](_0x596fe2[_0x458a('0x2b')]);if(_0x596fe2[_0x458a('0x2c')]){delete _0x596fe2['name'];}_0x5df150[_0x458a('0x1b')](_0x41b23d)[_0x458a('0x2d')](_0x596fe2);};}exports[_0x458a('0x2e')]=function(_0x562c36,_0x47e20d){var _0x18c890={},_0x4cf059={},_0x185f1c={'count':0x0,'rows':[]};var _0x56e0b9=_[_0x458a('0x2f')](db[_0x458a('0x30')]['rawAttributes'],function(_0x309a6a){return{'name':_0x309a6a[_0x458a('0x31')],'type':_0x309a6a[_0x458a('0x32')]['key']};});_0x4cf059[_0x458a('0x33')]=_[_0x458a('0x2f')](_0x56e0b9,_0x458a('0x2c'));_0x4cf059[_0x458a('0x34')]=_[_0x458a('0x35')](_0x562c36['query']);_0x4cf059[_0x458a('0x36')]=_[_0x458a('0x37')](_0x4cf059[_0x458a('0x33')],_0x4cf059[_0x458a('0x34')]);_0x18c890[_0x458a('0x38')]=_[_0x458a('0x37')](_0x4cf059['model'],qs[_0x458a('0x39')](_0x562c36[_0x458a('0x34')][_0x458a('0x39')]));_0x18c890[_0x458a('0x38')]=_0x18c890[_0x458a('0x38')][_0x458a('0x3a')]?_0x18c890[_0x458a('0x38')]:_0x4cf059[_0x458a('0x33')];if(!_0x562c36[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x18c890[_0x458a('0x1e')]=qs[_0x458a('0x1e')](_0x562c36[_0x458a('0x34')][_0x458a('0x1e')]);_0x18c890[_0x458a('0x20')]=qs[_0x458a('0x20')](_0x562c36[_0x458a('0x34')][_0x458a('0x20')]);}_0x18c890[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x562c36[_0x458a('0x34')][_0x458a('0x3d')]);_0x18c890[_0x458a('0x3e')]=qs[_0x458a('0x36')](_['pick'](_0x562c36[_0x458a('0x34')],_0x4cf059[_0x458a('0x36')]),_0x56e0b9);if(_0x562c36[_0x458a('0x34')][_0x458a('0x3f')]){_0x18c890[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x18c890[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x56e0b9,function(_0x41d125){if(_0x41d125[_0x458a('0x32')]!==_0x458a('0x41')){var _0x4efbeb={};_0x4efbeb[_0x41d125[_0x458a('0x2c')]]={'$like':'%'+_0x562c36[_0x458a('0x34')]['filter']+'%'};return _0x4efbeb;}})});}_0x18c890=_[_0x458a('0x40')]({},_0x18c890,_0x562c36[_0x458a('0x42')]);var _0x4286a3={'where':_0x18c890['where']};return db[_0x458a('0x30')][_0x458a('0x1f')](_0x4286a3)[_0x458a('0x25')](function(_0x1e51d2){_0x185f1c[_0x458a('0x1f')]=_0x1e51d2;if(_0x562c36[_0x458a('0x34')][_0x458a('0x43')]){_0x18c890[_0x458a('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0x458a('0x45')](_0x18c890);})[_0x458a('0x25')](function(_0x2b9030){_0x185f1c['rows']=_0x2b9030;return _0x185f1c;})[_0x458a('0x25')](respondWithFilteredResult(_0x47e20d,_0x18c890))[_0x458a('0x46')](handleError(_0x47e20d,null));};exports['show']=function(_0x598707,_0x124f64){var _0x2be08f={'raw':!![],'where':{'id':_0x598707[_0x458a('0x47')]['id']}},_0x36c391={};_0x36c391['model']=_['keys'](db[_0x458a('0x30')][_0x458a('0x48')]);_0x36c391[_0x458a('0x34')]=_[_0x458a('0x35')](_0x598707['query']);_0x36c391[_0x458a('0x36')]=_[_0x458a('0x37')](_0x36c391['model'],_0x36c391[_0x458a('0x34')]);_0x2be08f['attributes']=_[_0x458a('0x37')](_0x36c391[_0x458a('0x33')],qs[_0x458a('0x39')](_0x598707['query'][_0x458a('0x39')]));_0x2be08f[_0x458a('0x38')]=_0x2be08f[_0x458a('0x38')]['length']?_0x2be08f['attributes']:_0x36c391[_0x458a('0x33')];if(_0x598707[_0x458a('0x34')][_0x458a('0x43')]){_0x2be08f['include']=[{'all':!![]}];}_0x2be08f=_['merge']({},_0x2be08f,_0x598707[_0x458a('0x42')]);return db[_0x458a('0x30')][_0x458a('0x49')](_0x2be08f)[_0x458a('0x25')](handleEntityNotFound(_0x124f64,null))[_0x458a('0x25')](respondWithResult(_0x124f64,null))[_0x458a('0x46')](handleError(_0x124f64,null));};exports[_0x458a('0x4a')]=function(_0x30cdaf,_0xb22232){return db[_0x458a('0x30')][_0x458a('0x4a')](_0x30cdaf[_0x458a('0x4b')],{})[_0x458a('0x25')](function(_0x1b0c11){var _0x1ddc39=_0x30cdaf[_0x458a('0x4c')]['get']({'plain':!![]});if(!_0x1ddc39)throw new Error(_0x458a('0x4d'));if(_0x1ddc39[_0x458a('0x4e')]===_0x458a('0x4c')){var _0x396bb3=_0x1b0c11[_0x458a('0x27')]({'plain':!![]});var _0x5630cf='Voicemails';return db['UserProfileSection'][_0x458a('0x49')]({'where':{'name':_0x5630cf,'userProfileId':_0x1ddc39['userProfileId']},'raw':!![]})[_0x458a('0x25')](function(_0x58946){if(_0x58946&&_0x58946[_0x458a('0x4f')]===0x0){return db[_0x458a('0x29')][_0x458a('0x4a')]({'name':_0x396bb3['name'],'resourceId':_0x396bb3['id'],'type':_0x58946['name'],'sectionId':_0x58946['id']},{})[_0x458a('0x25')](function(){return _0x1b0c11;});}else{return _0x1b0c11;}})[_0x458a('0x46')](function(_0x2587a1){logger[_0x458a('0x2a')](_0x458a('0x50'),_0x2587a1);throw _0x2587a1;});}return _0x1b0c11;})['then'](respondWithResult(_0xb22232,0xc9))[_0x458a('0x46')](handleError(_0xb22232,null));};exports['update']=function(_0xa51e28,_0x5b428c){if(_0xa51e28[_0x458a('0x4b')]['id']){delete _0xa51e28['body']['id'];}return db['VoiceMail']['find']({'where':{'id':_0xa51e28[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x5b428c,null))['then'](saveUpdates(_0xa51e28[_0x458a('0x4b')],null))[_0x458a('0x25')](respondWithResult(_0x5b428c,null))[_0x458a('0x46')](handleError(_0x5b428c,null));};exports['destroy']=function(_0x2c1230,_0x212de5){return db[_0x458a('0x30')][_0x458a('0x49')]({'where':{'id':_0x2c1230[_0x458a('0x47')]['id']}})[_0x458a('0x25')](handleEntityNotFound(_0x212de5,null))['then'](removeEntity(_0x212de5,null))[_0x458a('0x46')](handleError(_0x212de5,null));};exports[_0x458a('0x51')]=function(_0x45325f,_0x39e5b5,_0x3ab86a){return db[_0x458a('0x30')][_0x458a('0x52')]({'where':{'id':_0x45325f[_0x458a('0x47')]['id']}})['then'](handleEntityNotFound(_0x39e5b5,null))[_0x458a('0x25')](function(_0x4abe93){var _0x1f93ad;var _0x2921ba={},_0x222aa4={};_0x222aa4[_0x458a('0x33')]=_['keys'](db['VoiceMailMessage'][_0x458a('0x48')]);_0x222aa4[_0x458a('0x34')]=_[_0x458a('0x35')](_0x45325f[_0x458a('0x34')]);_0x222aa4[_0x458a('0x36')]=_[_0x458a('0x37')](_0x222aa4['model'],_0x222aa4[_0x458a('0x34')]);_0x2921ba[_0x458a('0x38')]=_['intersection'](_0x222aa4[_0x458a('0x33')],qs['fields'](_0x45325f[_0x458a('0x34')][_0x458a('0x39')]));_0x2921ba[_0x458a('0x38')]=_0x2921ba[_0x458a('0x38')][_0x458a('0x3a')]?_0x2921ba[_0x458a('0x38')]:_0x222aa4[_0x458a('0x33')];if(!_0x45325f[_0x458a('0x34')]['hasOwnProperty'](_0x458a('0x3b'))){_0x2921ba[_0x458a('0x1e')]=qs['limit'](_0x45325f[_0x458a('0x34')][_0x458a('0x1e')]);_0x2921ba['offset']=qs[_0x458a('0x20')](_0x45325f[_0x458a('0x34')]['offset']);}_0x2921ba[_0x458a('0x3c')]=qs[_0x458a('0x3d')](_0x45325f['query'][_0x458a('0x3d')]);_0x2921ba[_0x458a('0x3e')]=qs[_0x458a('0x36')](_[_0x458a('0x53')](_0x45325f[_0x458a('0x34')],_0x222aa4[_0x458a('0x36')]));if(_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]){_0x2921ba['where']=_[_0x458a('0x40')](_0x2921ba[_0x458a('0x3e')],{'$or':_[_0x458a('0x2f')](_0x2921ba[_0x458a('0x38')],function(_0x250238){var _0x2930ae={};_0x2930ae[_0x250238]={'$like':'%'+_0x45325f[_0x458a('0x34')][_0x458a('0x3f')]+'%'};return _0x2930ae;})});}_0x2921ba[_0x458a('0x3e')]=_[_0x458a('0x40')](_0x2921ba['where'],{'mailboxuser':_0x4abe93[_0x458a('0x54')]});_0x2921ba=_['merge']({},_0x2921ba,_0x45325f[_0x458a('0x42')]);return db[_0x458a('0x55')][_0x458a('0x56')](_0x2921ba)[_0x458a('0x25')](respondWithFilteredResult(_0x39e5b5,_0x2921ba));})[_0x458a('0x46')](handleError(_0x39e5b5,null));};
\ No newline at end of file
index cdbb7d6..a358ae8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x489b=['define','VoiceMail','mailbox_context','mailbox','context','lodash','api','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports'];(function(_0x1cd4d5,_0x40bd09){var _0x348028=function(_0x10ffb3){while(--_0x10ffb3){_0x1cd4d5['push'](_0x1cd4d5['shift']());}};_0x348028(++_0x40bd09);}(_0x489b,0x1cc));var _0xb489=function(_0xa0b83d,_0x5bc7a6){_0xa0b83d=_0xa0b83d-0x0;var _0x2e1916=_0x489b[_0xa0b83d];return _0x2e1916;};'use strict';var _=require(_0xb489('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb489('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb489('0x2'));var fs=require('fs');var path=require(_0xb489('0x3'));var rimraf=require(_0xb489('0x4'));var config=require(_0xb489('0x5'));var attributes=require(_0xb489('0x6'));module[_0xb489('0x7')]=function(_0x5b4845,_0x1abf64){return _0x5b4845[_0xb489('0x8')](_0xb489('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xb489('0xa'),'fields':[_0xb489('0xb'),_0xb489('0xc')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x8bbf=['path','rimraf','exports','context','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x8bbf,0xe0));var _0xf8bb=function(_0x638432,_0x301655){_0x638432=_0x638432-0x0;var _0x24dc70=_0x8bbf[_0x638432];return _0x24dc70;};'use strict';var _=require(_0xf8bb('0x0'));var util=require(_0xf8bb('0x1'));var logger=require(_0xf8bb('0x2'))(_0xf8bb('0x3'));var moment=require(_0xf8bb('0x4'));var BPromise=require('bluebird');var rp=require(_0xf8bb('0x5'));var fs=require('fs');var path=require(_0xf8bb('0x6'));var rimraf=require(_0xf8bb('0x7'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0xf8bb('0x8')]=function(_0x387ced,_0x29d592){return _0x387ced['define']('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0xf8bb('0x9')]}],'timestamps':!![]});};
\ No newline at end of file
index d91fd6c..0fbee4e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb839=['../../config/utils','../../config/logger','rpc','jayson/promise','client','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x390ed1,_0x54d60d){var _0xb4e6ac=function(_0x4d19b3){while(--_0x4d19b3){_0x390ed1['push'](_0x390ed1['shift']());}};_0xb4e6ac(++_0x54d60d);}(_0xb839,0x19e));var _0x9b83=function(_0x157652,_0x5049c3){_0x157652=_0x157652-0x0;var _0x59c72e=_0xb839[_0x157652];return _0x59c72e;};'use strict';var _=require(_0x9b83('0x0'));var util=require('util');var moment=require(_0x9b83('0x1'));var BPromise=require(_0x9b83('0x2'));var rs=require(_0x9b83('0x3'));var fs=require('fs');var Redis=require(_0x9b83('0x4'));var db=require(_0x9b83('0x5'))['db'];var utils=require(_0x9b83('0x6'));var logger=require(_0x9b83('0x7'))(_0x9b83('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b83('0x9'));var client=jayson[_0x9b83('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42e137,_0x197ddd,_0x4f4718){return new BPromise(function(_0x517a1b,_0x1c1f62){return client['request'](_0x42e137,_0x4f4718)['then'](function(_0x23eb55){logger[_0x9b83('0xb')](_0x9b83('0xc'),_0x197ddd,_0x9b83('0xd'));logger[_0x9b83('0xe')](_0x9b83('0xf'),_0x197ddd,_0x9b83('0xd'),JSON[_0x9b83('0x10')](_0x23eb55));if(_0x23eb55[_0x9b83('0x11')]){if(_0x23eb55[_0x9b83('0x11')][_0x9b83('0x12')]===0x1f4){logger['error'](_0x9b83('0xc'),_0x197ddd,_0x23eb55[_0x9b83('0x11')][_0x9b83('0x13')]);return _0x1c1f62(_0x23eb55[_0x9b83('0x11')][_0x9b83('0x13')]);}logger[_0x9b83('0x11')](_0x9b83('0xc'),_0x197ddd,_0x23eb55[_0x9b83('0x11')][_0x9b83('0x13')]);return _0x517a1b(_0x23eb55['error'][_0x9b83('0x13')]);}else{logger[_0x9b83('0xb')]('VoiceMail,\x20%s,\x20%s',_0x197ddd,'request\x20sent');_0x517a1b(_0x23eb55['result'][_0x9b83('0x13')]);}})[_0x9b83('0x14')](function(_0x56e7b6){logger[_0x9b83('0x11')]('VoiceMail,\x20%s,\x20%s',_0x197ddd,_0x56e7b6);_0x1c1f62(_0x56e7b6);});});}
\ No newline at end of file
+var _0x053d=['code','message','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error'];(function(_0x12a73c,_0x23549e){var _0x3f67ad=function(_0x22f485){while(--_0x22f485){_0x12a73c['push'](_0x12a73c['shift']());}};_0x3f67ad(++_0x23549e);}(_0x053d,0x1e6));var _0xd053=function(_0xe7b203,_0x717f0c){_0xe7b203=_0xe7b203-0x0;var _0x49939d=_0x053d[_0xe7b203];return _0x49939d;};'use strict';var _=require(_0xd053('0x0'));var util=require(_0xd053('0x1'));var moment=require(_0xd053('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd053('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd053('0x4'));var logger=require(_0xd053('0x5'))(_0xd053('0x6'));var config=require(_0xd053('0x7'));var jayson=require(_0xd053('0x8'));var client=jayson[_0xd053('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d37cd,_0x3db8d4,_0xbb17e){return new BPromise(function(_0xe1dcc7,_0x986641){return client[_0xd053('0xa')](_0x4d37cd,_0xbb17e)[_0xd053('0xb')](function(_0x318c11){logger[_0xd053('0xc')](_0xd053('0xd'),_0x3db8d4,_0xd053('0xe'));logger[_0xd053('0xf')](_0xd053('0x10'),_0x3db8d4,'request\x20sent',JSON['stringify'](_0x318c11));if(_0x318c11[_0xd053('0x11')]){if(_0x318c11[_0xd053('0x11')][_0xd053('0x12')]===0x1f4){logger['error'](_0xd053('0xd'),_0x3db8d4,_0x318c11[_0xd053('0x11')][_0xd053('0x13')]);return _0x986641(_0x318c11['error'][_0xd053('0x13')]);}logger[_0xd053('0x11')](_0xd053('0xd'),_0x3db8d4,_0x318c11[_0xd053('0x11')][_0xd053('0x13')]);return _0xe1dcc7(_0x318c11[_0xd053('0x11')][_0xd053('0x13')]);}else{logger[_0xd053('0xc')](_0xd053('0xd'),_0x3db8d4,_0xd053('0xe'));_0xe1dcc7(_0x318c11['result']['message']);}})[_0xd053('0x14')](function(_0x29eb0d){logger[_0xd053('0x11')](_0xd053('0xd'),_0x3db8d4,_0x29eb0d);_0x986641(_0x29eb0d);});});}
\ No newline at end of file
index 740a49f..f6dcde9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f63=['/:id','show','create','delete','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated'];(function(_0x22e376,_0xfbd8d6){var _0xe53f7f=function(_0x2dd389){while(--_0x2dd389){_0x22e376['push'](_0x22e376['shift']());}};_0xe53f7f(++_0xfbd8d6);}(_0x4f63,0x6e));var _0x34f6=function(_0x287e09,_0x185de8){_0x287e09=_0x287e09-0x0;var _0x31ddc0=_0x4f63[_0x287e09];return _0x31ddc0;};'use strict';var multer=require(_0x34f6('0x0'));var util=require('util');var path=require(_0x34f6('0x1'));var timeout=require(_0x34f6('0x2'));var express=require(_0x34f6('0x3'));var router=express[_0x34f6('0x4')]();var fs_extra=require(_0x34f6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x34f6('0x6'));var config=require('../../config/environment');var controller=require(_0x34f6('0x7'));router[_0x34f6('0x8')]('/',auth[_0x34f6('0x9')](),controller['index']);router['get'](_0x34f6('0xa'),auth['isAuthenticated'](),controller[_0x34f6('0xb')]);router[_0x34f6('0x8')]('/:id/download',auth[_0x34f6('0x9')](),controller['download']);router['post']('/',auth[_0x34f6('0x9')](),controller[_0x34f6('0xc')]);router['put']('/:id',auth[_0x34f6('0x9')](),controller['update']);router[_0x34f6('0xd')]('/:id',auth[_0x34f6('0x9')](),controller['destroy']);module[_0x34f6('0xe')]=router;
\ No newline at end of file
+var _0xeaa2=['connect-timeout','Router','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','show','download','post','create','put','destroy','util','path'];(function(_0x47bc58,_0x1e1998){var _0x4a0860=function(_0x2a5b23){while(--_0x2a5b23){_0x47bc58['push'](_0x47bc58['shift']());}};_0x4a0860(++_0x1e1998);}(_0xeaa2,0xee));var _0x2eaa=function(_0x291a25,_0x31ae01){_0x291a25=_0x291a25-0x0;var _0x380fab=_0xeaa2[_0x291a25];return _0x380fab;};'use strict';var multer=require('multer');var util=require(_0x2eaa('0x0'));var path=require(_0x2eaa('0x1'));var timeout=require(_0x2eaa('0x2'));var express=require('express');var router=express[_0x2eaa('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2eaa('0x4'));var controller=require(_0x2eaa('0x5'));router[_0x2eaa('0x6')]('/',auth[_0x2eaa('0x7')](),controller['index']);router[_0x2eaa('0x6')](_0x2eaa('0x8'),auth[_0x2eaa('0x7')](),controller[_0x2eaa('0x9')]);router[_0x2eaa('0x6')]('/:id/download',auth[_0x2eaa('0x7')](),controller[_0x2eaa('0xa')]);router[_0x2eaa('0xb')]('/',auth[_0x2eaa('0x7')](),controller[_0x2eaa('0xc')]);router[_0x2eaa('0xd')](_0x2eaa('0x8'),auth[_0x2eaa('0x7')](),controller['update']);router['delete'](_0x2eaa('0x8'),auth[_0x2eaa('0x7')](),controller[_0x2eaa('0xe')]);module['exports']=router;
\ No newline at end of file
index 1587f71..21dada2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e1a=['INTEGER','STRING','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x5e1a,0x11c));var _0xa5e1=function(_0x3a0863,_0x4cd5ef){_0x3a0863=_0x3a0863-0x0;var _0x85c557=_0x5e1a[_0x3a0863];return _0x85c557;};'use strict';var Sequelize=require(_0xa5e1('0x0'));module[_0xa5e1('0x1')]={'name':{'type':Sequelize[_0xa5e1('0x2')],'get':function(_0x1be222){return this[_0xa5e1('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xa5e1('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa5e1('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xa5e1('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xa5e1('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa5e1('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xa5e1('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize['STRING'],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa5e1('0x5')],'defaultValue':''},'stamp':{'type':_0xa5e1('0x6'),'defaultValue':Sequelize[_0xa5e1('0x7')](_0xa5e1('0x8'))}};
\ No newline at end of file
+var _0x4fe7=['sequelize','exports','VIRTUAL','STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4fe7,0xc8));var _0x74fe=function(_0x51d703,_0x2606bb){_0x51d703=_0x51d703-0x0;var _0x14a194=_0x4fe7[_0x51d703];return _0x14a194;};'use strict';var Sequelize=require(_0x74fe('0x0'));module[_0x74fe('0x1')]={'name':{'type':Sequelize[_0x74fe('0x2')],'get':function(_0x5b7404){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x74fe('0x4')](_0x74fe('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x74fe('0x3')],'defaultValue':''},'stamp':{'type':_0x74fe('0x6'),'defaultValue':Sequelize['literal'](_0x74fe('0x7'))}};
\ No newline at end of file
index 1279bfd..84ef125 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa252=['msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','VoiceMailMessage','includeAll','rows','show','params','options','find','catch','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','attachment'];(function(_0x27c592,_0x4b152a){var _0x314289=function(_0x5b2793){while(--_0x5b2793){_0x27c592['push'](_0x27c592['shift']());}};_0x314289(++_0x4b152a);}(_0xa252,0x185));var _0x2a25=function(_0xca3269,_0x374910){_0xca3269=_0xca3269-0x0;var _0x3b015c=_0xa252[_0xca3269];return _0x3b015c;};'use strict';var emlformat=require(_0x2a25('0x0'));var rimraf=require(_0x2a25('0x1'));var zipdir=require(_0x2a25('0x2'));var jsonpatch=require(_0x2a25('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a25('0x4'));var Mustache=require(_0x2a25('0x5'));var util=require('util');var path=require(_0x2a25('0x6'));var sox=require(_0x2a25('0x7'));var csv=require(_0x2a25('0x8'));var ejs=require(_0x2a25('0x9'));var fs=require('fs');var fs_extra=require(_0x2a25('0xa'));var _=require(_0x2a25('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2a25('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2a25('0x8'));var querystring=require(_0x2a25('0xd'));var Papa=require(_0x2a25('0xe'));var Redis=require(_0x2a25('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2a25('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a25('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x2a25('0x12'));var config=require(_0x2a25('0x13'));var licenseUtil=require(_0x2a25('0x14'));var db=require(_0x2a25('0x15'))['db'];function respondWithStatusCode(_0x4f4af7,_0x2c0a49){_0x2c0a49=_0x2c0a49||0xcc;return function(_0x1677b2){if(_0x1677b2){return _0x4f4af7[_0x2a25('0x16')](_0x2c0a49);}return _0x4f4af7[_0x2a25('0x17')](_0x2c0a49)['end']();};}function respondWithResult(_0x3e3cfb,_0x13380e){_0x13380e=_0x13380e||0xc8;return function(_0xc8b483){if(_0xc8b483){return _0x3e3cfb['status'](_0x13380e)[_0x2a25('0x18')](_0xc8b483);}};}function respondWithFilteredResult(_0x344d53,_0x453202){return function(_0x409a9d){if(_0x409a9d){var _0x3623c9=typeof _0x453202[_0x2a25('0x19')]===_0x2a25('0x1a')&&typeof _0x453202['limit']===_0x2a25('0x1a');var _0x3744d9=_0x409a9d['count'];var _0x41d13f=_0x3623c9?0x0:_0x453202[_0x2a25('0x19')];var _0x3ff778=_0x3623c9?_0x409a9d[_0x2a25('0x1b')]:_0x453202['offset']+_0x453202['limit'];var _0x2518e8;if(_0x3ff778>=_0x3744d9){_0x3ff778=_0x3744d9;_0x2518e8=0xc8;}else{_0x2518e8=0xce;}_0x344d53[_0x2a25('0x17')](_0x2518e8);return _0x344d53[_0x2a25('0x1c')](_0x2a25('0x1d'),_0x41d13f+'-'+_0x3ff778+'/'+_0x3744d9)[_0x2a25('0x18')](_0x409a9d);}return null;};}function patchUpdates(_0x5dee93){return function(_0x50a5c9){try{jsonpatch[_0x2a25('0x1e')](_0x50a5c9,_0x5dee93,!![]);}catch(_0x98c8f5){return BPromise['reject'](_0x98c8f5);}return _0x50a5c9[_0x2a25('0x1f')]();};}function saveUpdates(_0x48e084,_0x3e146a){return function(_0x1bc32e){if(_0x1bc32e){return _0x1bc32e[_0x2a25('0x20')](_0x48e084)[_0x2a25('0x21')](function(_0x1ddfca){return _0x1ddfca;});}return null;};}function removeEntity(_0x96d27a,_0x397e1e){return function(_0x2cfcd7){if(_0x2cfcd7){return _0x2cfcd7[_0x2a25('0x22')]()['then'](function(){_0x96d27a[_0x2a25('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e3846,_0x5bff5f){return function(_0x46101d){if(!_0x46101d){_0x5e3846[_0x2a25('0x16')](0x194);}return _0x46101d;};}function handleError(_0x393c53,_0x15f0b7){_0x15f0b7=_0x15f0b7||0x1f4;return function(_0x43900a){logger['error'](_0x43900a[_0x2a25('0x23')]);if(_0x43900a[_0x2a25('0x24')]){delete _0x43900a['name'];}_0x393c53[_0x2a25('0x17')](_0x15f0b7)['send'](_0x43900a);};}exports[_0x2a25('0x25')]=function(_0x315d66,_0x23e44f){var _0x1d09d9={},_0x482d45={},_0x3f79ad={'count':0x0,'rows':[]};var _0x338fe8=_[_0x2a25('0x26')](db['VoiceMailMessage'][_0x2a25('0x27')],function(_0x4e9be4){return{'name':_0x4e9be4[_0x2a25('0x28')],'type':_0x4e9be4[_0x2a25('0x29')]['key']};});_0x482d45[_0x2a25('0x2a')]=_['differenceBy'](_[_0x2a25('0x26')](_0x338fe8,_0x2a25('0x24')),[_0x2a25('0x24')]);_0x482d45[_0x2a25('0x2b')]=_[_0x2a25('0x2c')](_0x315d66[_0x2a25('0x2b')]);_0x482d45['filters']=_['intersection'](_0x482d45[_0x2a25('0x2a')],_0x482d45[_0x2a25('0x2b')]);_0x1d09d9[_0x2a25('0x2d')]=_[_0x2a25('0x2e')](_0x482d45[_0x2a25('0x2a')],qs[_0x2a25('0x2f')](_0x315d66[_0x2a25('0x2b')][_0x2a25('0x2f')]));_0x1d09d9['attributes']=_0x1d09d9[_0x2a25('0x2d')]['length']?_0x1d09d9[_0x2a25('0x2d')]:_0x482d45[_0x2a25('0x2a')];if(!_0x315d66['query'][_0x2a25('0x30')](_0x2a25('0x31'))){_0x1d09d9['limit']=qs['limit'](_0x315d66[_0x2a25('0x2b')]['limit']);_0x1d09d9['offset']=qs[_0x2a25('0x19')](_0x315d66[_0x2a25('0x2b')]['offset']);}_0x1d09d9['order']=qs['sort'](_0x315d66['query'][_0x2a25('0x32')]);_0x1d09d9[_0x2a25('0x33')]=qs[_0x2a25('0x34')](_[_0x2a25('0x35')](_0x315d66['query'],_0x482d45[_0x2a25('0x34')]),_0x338fe8);if(_0x315d66[_0x2a25('0x2b')][_0x2a25('0x36')]){_0x1d09d9[_0x2a25('0x33')]=_[_0x2a25('0x37')](_0x1d09d9[_0x2a25('0x33')],{'$or':_[_0x2a25('0x26')](_0x338fe8,function(_0x45db21){if(_0x45db21['type']!==_0x2a25('0x38')){var _0x5b2640={};_0x5b2640[_0x45db21[_0x2a25('0x24')]]={'$like':'%'+_0x315d66[_0x2a25('0x2b')][_0x2a25('0x36')]+'%'};return _0x5b2640;}})});}_0x1d09d9=_[_0x2a25('0x37')]({},_0x1d09d9,_0x315d66['options']);var _0x5b23b3={'where':_0x1d09d9[_0x2a25('0x33')]};return db[_0x2a25('0x39')]['count'](_0x5b23b3)['then'](function(_0x4c1f3f){_0x3f79ad[_0x2a25('0x1b')]=_0x4c1f3f;if(_0x315d66[_0x2a25('0x2b')][_0x2a25('0x3a')]){_0x1d09d9['include']=[{'all':!![]}];}return db[_0x2a25('0x39')]['findAll'](_0x1d09d9);})[_0x2a25('0x21')](function(_0x247484){_0x3f79ad[_0x2a25('0x3b')]=_0x247484;return _0x3f79ad;})[_0x2a25('0x21')](respondWithFilteredResult(_0x23e44f,_0x1d09d9))['catch'](handleError(_0x23e44f,null));};exports[_0x2a25('0x3c')]=function(_0x52e415,_0x124f34){var _0x3533d6={'raw':!![],'where':{'id':_0x52e415[_0x2a25('0x3d')]['id']}},_0x2c28f5={};_0x2c28f5['model']=_[_0x2a25('0x2c')](db[_0x2a25('0x39')][_0x2a25('0x27')]);_0x2c28f5[_0x2a25('0x2b')]=_[_0x2a25('0x2c')](_0x52e415['query']);_0x2c28f5['filters']=_[_0x2a25('0x2e')](_0x2c28f5[_0x2a25('0x2a')],_0x2c28f5[_0x2a25('0x2b')]);_0x3533d6[_0x2a25('0x2d')]=_['intersection'](_0x2c28f5[_0x2a25('0x2a')],qs[_0x2a25('0x2f')](_0x52e415[_0x2a25('0x2b')][_0x2a25('0x2f')]));_0x3533d6[_0x2a25('0x2d')]=_0x3533d6[_0x2a25('0x2d')]['length']?_0x3533d6[_0x2a25('0x2d')]:_0x2c28f5[_0x2a25('0x2a')];if(_0x52e415[_0x2a25('0x2b')]['includeAll']){_0x3533d6['include']=[{'all':!![]}];}_0x3533d6=_[_0x2a25('0x37')]({},_0x3533d6,_0x52e415[_0x2a25('0x3e')]);return db[_0x2a25('0x39')][_0x2a25('0x3f')](_0x3533d6)[_0x2a25('0x21')](handleEntityNotFound(_0x124f34,null))[_0x2a25('0x21')](respondWithResult(_0x124f34,null))[_0x2a25('0x40')](handleError(_0x124f34,null));};exports[_0x2a25('0x41')]=function(_0x5771ce,_0x4de16b){return db[_0x2a25('0x39')]['create'](_0x5771ce[_0x2a25('0x42')],{})['then'](respondWithResult(_0x4de16b,0xc9))[_0x2a25('0x40')](handleError(_0x4de16b,null));};exports[_0x2a25('0x20')]=function(_0x520f2f,_0x37c030){if(_0x520f2f[_0x2a25('0x42')]['id']){delete _0x520f2f['body']['id'];}return db['VoiceMailMessage'][_0x2a25('0x3f')]({'where':{'id':_0x520f2f[_0x2a25('0x3d')]['id']}})[_0x2a25('0x21')](handleEntityNotFound(_0x37c030,null))['then'](saveUpdates(_0x520f2f['body'],null))[_0x2a25('0x21')](respondWithResult(_0x37c030,null))[_0x2a25('0x40')](handleError(_0x37c030,null));};exports[_0x2a25('0x22')]=function(_0x15788c,_0x301394){return db[_0x2a25('0x39')]['find']({'where':{'id':_0x15788c[_0x2a25('0x3d')]['id']}})[_0x2a25('0x21')](handleEntityNotFound(_0x301394,null))[_0x2a25('0x21')](removeEntity(_0x301394,null))[_0x2a25('0x40')](handleError(_0x301394,null));};exports[_0x2a25('0x43')]=function(_0x7faf4a,_0x5c74f1,_0x4c3458){return db[_0x2a25('0x39')]['find']({'where':{'id':_0x7faf4a['params']['id']},'attributes':['id','recording','msg_id']})[_0x2a25('0x21')](handleEntityNotFound(_0x5c74f1,null))[_0x2a25('0x21')](function(_0x42def9){if(_0x42def9){if(!_0x42def9[_0x2a25('0x44')]){throw new db[(_0x2a25('0x45'))][(_0x2a25('0x46'))](_0x2a25('0x47'));}var _0x1709a0={'Content-Type':'audio/wav','Content-Disposition':_0x2a25('0x48')};if(_0x42def9[_0x2a25('0x49')]){_0x1709a0[_0x2a25('0x4a')]=_0x2a25('0x4b')+_0x42def9[_0x2a25('0x49')]+_0x2a25('0x4c');}_0x5c74f1[_0x2a25('0x1c')](_0x1709a0);return _0x5c74f1['send'](new Buffer(_0x42def9['recording']));}})[_0x2a25('0x40')](handleError(_0x5c74f1,null));};
\ No newline at end of file
+var _0x0c25=['Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','map','VoiceMailMessage','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','rawAttributes','find','body','catch','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','rimraf','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set'];(function(_0x5ac1e5,_0x4b5012){var _0x1bccc6=function(_0x102562){while(--_0x102562){_0x5ac1e5['push'](_0x5ac1e5['shift']());}};_0x1bccc6(++_0x4b5012);}(_0x0c25,0x124));var _0x50c2=function(_0x384231,_0x50be41){_0x384231=_0x384231-0x0;var _0x2480bf=_0x0c25[_0x384231];return _0x2480bf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x50c2('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x50c2('0x1'));var rp=require(_0x50c2('0x2'));var moment=require(_0x50c2('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x50c2('0x4'));var sox=require(_0x50c2('0x5'));var csv=require(_0x50c2('0x6'));var ejs=require(_0x50c2('0x7'));var fs=require('fs');var fs_extra=require(_0x50c2('0x8'));var _=require(_0x50c2('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x50c2('0xa'));var deskjs=require(_0x50c2('0xb'));var toCsv=require('to-csv');var querystring=require(_0x50c2('0xc'));var Papa=require('papaparse');var Redis=require(_0x50c2('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x50c2('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x50c2('0xf'));var logger=require(_0x50c2('0x10'))('api');var utils=require(_0x50c2('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x50c2('0x12'))['db'];function respondWithStatusCode(_0x26dfee,_0x7c8928){_0x7c8928=_0x7c8928||0xcc;return function(_0x5bebdd){if(_0x5bebdd){return _0x26dfee[_0x50c2('0x13')](_0x7c8928);}return _0x26dfee[_0x50c2('0x14')](_0x7c8928)[_0x50c2('0x15')]();};}function respondWithResult(_0x340185,_0x512dbb){_0x512dbb=_0x512dbb||0xc8;return function(_0x547512){if(_0x547512){return _0x340185['status'](_0x512dbb)[_0x50c2('0x16')](_0x547512);}};}function respondWithFilteredResult(_0x23787f,_0x33659f){return function(_0x593937){if(_0x593937){var _0x288328=typeof _0x33659f[_0x50c2('0x17')]===_0x50c2('0x18')&&typeof _0x33659f[_0x50c2('0x19')]===_0x50c2('0x18');var _0x4a26b2=_0x593937['count'];var _0x6a92cd=_0x288328?0x0:_0x33659f['offset'];var _0x2b6c49=_0x288328?_0x593937[_0x50c2('0x1a')]:_0x33659f[_0x50c2('0x17')]+_0x33659f['limit'];var _0x2dde96;if(_0x2b6c49>=_0x4a26b2){_0x2b6c49=_0x4a26b2;_0x2dde96=0xc8;}else{_0x2dde96=0xce;}_0x23787f[_0x50c2('0x14')](_0x2dde96);return _0x23787f[_0x50c2('0x1b')](_0x50c2('0x1c'),_0x6a92cd+'-'+_0x2b6c49+'/'+_0x4a26b2)[_0x50c2('0x16')](_0x593937);}return null;};}function patchUpdates(_0x156d49){return function(_0x85b7a7){try{jsonpatch[_0x50c2('0x1d')](_0x85b7a7,_0x156d49,!![]);}catch(_0xca088b){return BPromise[_0x50c2('0x1e')](_0xca088b);}return _0x85b7a7[_0x50c2('0x1f')]();};}function saveUpdates(_0x41ea17,_0x52bceb){return function(_0x1b2688){if(_0x1b2688){return _0x1b2688[_0x50c2('0x20')](_0x41ea17)['then'](function(_0x167533){return _0x167533;});}return null;};}function removeEntity(_0x2d6b9d,_0x43a5f7){return function(_0x341238){if(_0x341238){return _0x341238[_0x50c2('0x21')]()[_0x50c2('0x22')](function(){_0x2d6b9d[_0x50c2('0x14')](0xcc)[_0x50c2('0x15')]();});}};}function handleEntityNotFound(_0x1ba0ed,_0x19f1bd){return function(_0x54a52b){if(!_0x54a52b){_0x1ba0ed[_0x50c2('0x13')](0x194);}return _0x54a52b;};}function handleError(_0x197697,_0x8151b6){_0x8151b6=_0x8151b6||0x1f4;return function(_0x32b05c){logger['error'](_0x32b05c[_0x50c2('0x23')]);if(_0x32b05c[_0x50c2('0x24')]){delete _0x32b05c[_0x50c2('0x24')];}_0x197697[_0x50c2('0x14')](_0x8151b6)[_0x50c2('0x25')](_0x32b05c);};}exports[_0x50c2('0x26')]=function(_0xa6246a,_0x5630b4){var _0x102550={},_0x2c8b97={},_0x3d213f={'count':0x0,'rows':[]};var _0x19b3c7=_[_0x50c2('0x27')](db[_0x50c2('0x28')]['rawAttributes'],function(_0x169342){return{'name':_0x169342[_0x50c2('0x29')],'type':_0x169342[_0x50c2('0x2a')][_0x50c2('0x2b')]};});_0x2c8b97[_0x50c2('0x2c')]=_[_0x50c2('0x2d')](_['map'](_0x19b3c7,_0x50c2('0x24')),['name']);_0x2c8b97[_0x50c2('0x2e')]=_[_0x50c2('0x2f')](_0xa6246a[_0x50c2('0x2e')]);_0x2c8b97[_0x50c2('0x30')]=_[_0x50c2('0x31')](_0x2c8b97[_0x50c2('0x2c')],_0x2c8b97[_0x50c2('0x2e')]);_0x102550['attributes']=_[_0x50c2('0x31')](_0x2c8b97[_0x50c2('0x2c')],qs[_0x50c2('0x32')](_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x32')]));_0x102550[_0x50c2('0x33')]=_0x102550[_0x50c2('0x33')][_0x50c2('0x34')]?_0x102550['attributes']:_0x2c8b97[_0x50c2('0x2c')];if(!_0xa6246a[_0x50c2('0x2e')]['hasOwnProperty'](_0x50c2('0x35'))){_0x102550[_0x50c2('0x19')]=qs[_0x50c2('0x19')](_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x19')]);_0x102550[_0x50c2('0x17')]=qs[_0x50c2('0x17')](_0xa6246a[_0x50c2('0x2e')]['offset']);}_0x102550[_0x50c2('0x36')]=qs['sort'](_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x37')]);_0x102550['where']=qs[_0x50c2('0x30')](_[_0x50c2('0x38')](_0xa6246a[_0x50c2('0x2e')],_0x2c8b97['filters']),_0x19b3c7);if(_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x39')]){_0x102550[_0x50c2('0x3a')]=_[_0x50c2('0x3b')](_0x102550[_0x50c2('0x3a')],{'$or':_[_0x50c2('0x27')](_0x19b3c7,function(_0x157a28){if(_0x157a28[_0x50c2('0x2a')]!==_0x50c2('0x3c')){var _0x486866={};_0x486866[_0x157a28[_0x50c2('0x24')]]={'$like':'%'+_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x39')]+'%'};return _0x486866;}})});}_0x102550=_[_0x50c2('0x3b')]({},_0x102550,_0xa6246a[_0x50c2('0x3d')]);var _0x2e7fae={'where':_0x102550['where']};return db[_0x50c2('0x28')]['count'](_0x2e7fae)[_0x50c2('0x22')](function(_0x84f7e1){_0x3d213f[_0x50c2('0x1a')]=_0x84f7e1;if(_0xa6246a[_0x50c2('0x2e')][_0x50c2('0x3e')]){_0x102550[_0x50c2('0x3f')]=[{'all':!![]}];}return db[_0x50c2('0x28')][_0x50c2('0x40')](_0x102550);})['then'](function(_0x4ef2be){_0x3d213f[_0x50c2('0x41')]=_0x4ef2be;return _0x3d213f;})[_0x50c2('0x22')](respondWithFilteredResult(_0x5630b4,_0x102550))['catch'](handleError(_0x5630b4,null));};exports['show']=function(_0x471a00,_0x33cb8c){var _0xaec00={'raw':!![],'where':{'id':_0x471a00[_0x50c2('0x42')]['id']}},_0x5f3929={};_0x5f3929[_0x50c2('0x2c')]=_[_0x50c2('0x2f')](db[_0x50c2('0x28')][_0x50c2('0x43')]);_0x5f3929[_0x50c2('0x2e')]=_[_0x50c2('0x2f')](_0x471a00[_0x50c2('0x2e')]);_0x5f3929[_0x50c2('0x30')]=_[_0x50c2('0x31')](_0x5f3929[_0x50c2('0x2c')],_0x5f3929[_0x50c2('0x2e')]);_0xaec00[_0x50c2('0x33')]=_['intersection'](_0x5f3929['model'],qs[_0x50c2('0x32')](_0x471a00['query'][_0x50c2('0x32')]));_0xaec00[_0x50c2('0x33')]=_0xaec00[_0x50c2('0x33')][_0x50c2('0x34')]?_0xaec00[_0x50c2('0x33')]:_0x5f3929[_0x50c2('0x2c')];if(_0x471a00[_0x50c2('0x2e')][_0x50c2('0x3e')]){_0xaec00[_0x50c2('0x3f')]=[{'all':!![]}];}_0xaec00=_['merge']({},_0xaec00,_0x471a00[_0x50c2('0x3d')]);return db[_0x50c2('0x28')][_0x50c2('0x44')](_0xaec00)[_0x50c2('0x22')](handleEntityNotFound(_0x33cb8c,null))[_0x50c2('0x22')](respondWithResult(_0x33cb8c,null))['catch'](handleError(_0x33cb8c,null));};exports['create']=function(_0x5acb63,_0x6e46bf){return db['VoiceMailMessage']['create'](_0x5acb63[_0x50c2('0x45')],{})['then'](respondWithResult(_0x6e46bf,0xc9))[_0x50c2('0x46')](handleError(_0x6e46bf,null));};exports[_0x50c2('0x20')]=function(_0x3b5813,_0x242ab0){if(_0x3b5813[_0x50c2('0x45')]['id']){delete _0x3b5813[_0x50c2('0x45')]['id'];}return db[_0x50c2('0x28')]['find']({'where':{'id':_0x3b5813[_0x50c2('0x42')]['id']}})['then'](handleEntityNotFound(_0x242ab0,null))[_0x50c2('0x22')](saveUpdates(_0x3b5813[_0x50c2('0x45')],null))[_0x50c2('0x22')](respondWithResult(_0x242ab0,null))[_0x50c2('0x46')](handleError(_0x242ab0,null));};exports[_0x50c2('0x21')]=function(_0x390e25,_0x4189d1){return db[_0x50c2('0x28')][_0x50c2('0x44')]({'where':{'id':_0x390e25[_0x50c2('0x42')]['id']}})[_0x50c2('0x22')](handleEntityNotFound(_0x4189d1,null))[_0x50c2('0x22')](removeEntity(_0x4189d1,null))[_0x50c2('0x46')](handleError(_0x4189d1,null));};exports[_0x50c2('0x47')]=function(_0x2111bc,_0x242e42,_0x1af7e8){return db[_0x50c2('0x28')][_0x50c2('0x44')]({'where':{'id':_0x2111bc['params']['id']},'attributes':['id',_0x50c2('0x48'),_0x50c2('0x49')]})[_0x50c2('0x22')](handleEntityNotFound(_0x242e42,null))[_0x50c2('0x22')](function(_0x28ce25){if(_0x28ce25){if(!_0x28ce25[_0x50c2('0x48')]){throw new db['Sequelize'][(_0x50c2('0x4a'))](_0x50c2('0x4b'));}var _0x34c7b9={'Content-Type':_0x50c2('0x4c'),'Content-Disposition':_0x50c2('0x4d')};if(_0x28ce25[_0x50c2('0x49')]){_0x34c7b9[_0x50c2('0x4e')]=_0x50c2('0x4f')+_0x28ce25['msg_id']+'.wav\x22';}_0x242e42[_0x50c2('0x1b')](_0x34c7b9);return _0x242e42[_0x50c2('0x25')](new Buffer(_0x28ce25[_0x50c2('0x48')]));}})[_0x50c2('0x46')](handleError(_0x242e42,null));};
\ No newline at end of file
index f7df751..398b171 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc450=['bluebird','request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment'];(function(_0x20cef7,_0xed9ca2){var _0x245e71=function(_0x5bf669){while(--_0x5bf669){_0x20cef7['push'](_0x20cef7['shift']());}};_0x245e71(++_0xed9ca2);}(_0xc450,0xa3));var _0x0c45=function(_0x13b7d6,_0x230059){_0x13b7d6=_0x13b7d6-0x0;var _0x151163=_0xc450[_0x13b7d6];return _0x151163;};'use strict';var _=require(_0x0c45('0x0'));var util=require(_0x0c45('0x1'));var logger=require(_0x0c45('0x2'))(_0x0c45('0x3'));var moment=require(_0x0c45('0x4'));var BPromise=require(_0x0c45('0x5'));var rp=require(_0x0c45('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c45('0x7'));var config=require(_0x0c45('0x8'));var attributes=require(_0x0c45('0x9'));module[_0x0c45('0xa')]=function(_0x43e5ba,_0x97ad39){return _0x43e5ba[_0x0c45('0xb')](_0x0c45('0xc'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x0c45('0xd')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x9810=['path','define','VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4df6f9,_0x44bd65){var _0x4b1a73=function(_0xf5adb7){while(--_0xf5adb7){_0x4df6f9['push'](_0x4df6f9['shift']());}};_0x4b1a73(++_0x44bd65);}(_0x9810,0x11c));var _0x0981=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x9810[_0x1ebc6c];return _0x3a826d;};'use strict';var _=require(_0x0981('0x0'));var util=require(_0x0981('0x1'));var logger=require(_0x0981('0x2'))(_0x0981('0x3'));var moment=require(_0x0981('0x4'));var BPromise=require(_0x0981('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0981('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module['exports']=function(_0x963b5e,_0x1daea1){return _0x963b5e[_0x0981('0x7')](_0x0981('0x8'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x0981('0x9'),'fields':[_0x0981('0x9')]}],'timestamps':![]});};
\ No newline at end of file
index caa5cde..c9858f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8282=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x399b12,_0x8d4d09){var _0x58df3b=function(_0x1a790b){while(--_0x1a790b){_0x399b12['push'](_0x399b12['shift']());}};_0x58df3b(++_0x8d4d09);}(_0x8282,0x136));var _0x2828=function(_0x2943e9,_0x379e0d){_0x2943e9=_0x2943e9-0x0;var _0x2e1aa9=_0x8282[_0x2943e9];return _0x2e1aa9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2828('0x0'));var BPromise=require(_0x2828('0x1'));var rs=require(_0x2828('0x2'));var fs=require('fs');var Redis=require(_0x2828('0x3'));var db=require(_0x2828('0x4'))['db'];var utils=require(_0x2828('0x5'));var logger=require(_0x2828('0x6'))(_0x2828('0x7'));var config=require(_0x2828('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2828('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f9a4d,_0x59f84e,_0x503210){return new BPromise(function(_0x1f68c6,_0x51e660){return client[_0x2828('0xa')](_0x3f9a4d,_0x503210)[_0x2828('0xb')](function(_0xfab3fb){logger[_0x2828('0xc')](_0x2828('0xd'),_0x59f84e,_0x2828('0xe'));logger['debug'](_0x2828('0xf'),_0x59f84e,_0x2828('0xe'),JSON[_0x2828('0x10')](_0xfab3fb));if(_0xfab3fb['error']){if(_0xfab3fb[_0x2828('0x11')]['code']===0x1f4){logger[_0x2828('0x11')](_0x2828('0xd'),_0x59f84e,_0xfab3fb[_0x2828('0x11')][_0x2828('0x12')]);return _0x51e660(_0xfab3fb['error']['message']);}logger['error'](_0x2828('0xd'),_0x59f84e,_0xfab3fb['error'][_0x2828('0x12')]);return _0x1f68c6(_0xfab3fb[_0x2828('0x11')]['message']);}else{logger[_0x2828('0xc')](_0x2828('0xd'),_0x59f84e,_0x2828('0xe'));_0x1f68c6(_0xfab3fb[_0x2828('0x13')]['message']);}})[_0x2828('0x14')](function(_0x137274){logger[_0x2828('0x11')]('VoiceMailMessage,\x20%s,\x20%s',_0x59f84e,_0x137274);_0x51e660(_0x137274);});});}
\ No newline at end of file
+var _0x37af=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','debug','request\x20sent','error','VoiceMailMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x50a75e,_0x41e663){var _0x304e15=function(_0x35b6a1){while(--_0x35b6a1){_0x50a75e['push'](_0x50a75e['shift']());}};_0x304e15(++_0x41e663);}(_0x37af,0x70));var _0xf37a=function(_0x425e3d,_0x19279a){_0x425e3d=_0x425e3d-0x0;var _0x41ceb3=_0x37af[_0x425e3d];return _0x41ceb3;};'use strict';var _=require(_0xf37a('0x0'));var util=require(_0xf37a('0x1'));var moment=require(_0xf37a('0x2'));var BPromise=require(_0xf37a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf37a('0x4'));var db=require(_0xf37a('0x5'))['db'];var utils=require(_0xf37a('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf37a('0x7'));var client=jayson['client'][_0xf37a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x13d4a0,_0x36819d,_0x374071){return new BPromise(function(_0xd71ee0,_0x11311a){return client[_0xf37a('0x9')](_0x13d4a0,_0x374071)[_0xf37a('0xa')](function(_0x3a6384){logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x36819d,'request\x20sent');logger[_0xf37a('0xb')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x36819d,_0xf37a('0xc'),JSON['stringify'](_0x3a6384));if(_0x3a6384[_0xf37a('0xd')]){if(_0x3a6384[_0xf37a('0xd')]['code']===0x1f4){logger[_0xf37a('0xd')](_0xf37a('0xe'),_0x36819d,_0x3a6384[_0xf37a('0xd')][_0xf37a('0xf')]);return _0x11311a(_0x3a6384['error'][_0xf37a('0xf')]);}logger[_0xf37a('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x36819d,_0x3a6384[_0xf37a('0xd')][_0xf37a('0xf')]);return _0xd71ee0(_0x3a6384[_0xf37a('0xd')][_0xf37a('0xf')]);}else{logger[_0xf37a('0x10')](_0xf37a('0xe'),_0x36819d,_0xf37a('0xc'));_0xd71ee0(_0x3a6384[_0xf37a('0x11')][_0xf37a('0xf')]);}})[_0xf37a('0x12')](function(_0x213e96){logger[_0xf37a('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x36819d,_0x213e96);_0x11311a(_0x213e96);});});}
\ No newline at end of file
index c3b086a..f3ce5e9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6807=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated','index','get','/:id','show','/:id/sounds','getSounds','post','create','addSound','put','update','delete','/:id/sounds/:id2','removeSound','exports','multer','util'];(function(_0x2903d4,_0x35d7c1){var _0x2d966f=function(_0x2a10c5){while(--_0x2a10c5){_0x2903d4['push'](_0x2903d4['shift']());}};_0x2d966f(++_0x35d7c1);}(_0x6807,0xbe));var _0x7680=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x6807[_0x5d4607];return _0x5e4a86;};'use strict';var multer=require(_0x7680('0x0'));var util=require(_0x7680('0x1'));var path=require(_0x7680('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7680('0x3'));var auth=require(_0x7680('0x4'));var interaction=require(_0x7680('0x5'));var config=require(_0x7680('0x6'));var controller=require(_0x7680('0x7'));router['get']('/',auth[_0x7680('0x8')](),controller[_0x7680('0x9')]);router[_0x7680('0xa')](_0x7680('0xb'),auth[_0x7680('0x8')](),controller[_0x7680('0xc')]);router[_0x7680('0xa')](_0x7680('0xd'),auth[_0x7680('0x8')](),controller[_0x7680('0xe')]);router[_0x7680('0xf')]('/',auth[_0x7680('0x8')](),controller[_0x7680('0x10')]);router['post']('/:id/sounds',auth['isAuthenticated'](),controller[_0x7680('0x11')]);router[_0x7680('0x12')](_0x7680('0xb'),auth[_0x7680('0x8')](),controller[_0x7680('0x13')]);router[_0x7680('0x14')](_0x7680('0xb'),auth[_0x7680('0x8')](),controller['destroy']);router[_0x7680('0x14')](_0x7680('0x15'),auth['isAuthenticated'](),controller[_0x7680('0x16')]);module[_0x7680('0x17')]=router;
\ No newline at end of file
+var _0xcb24=['removeSound','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','show','/:id/sounds','getSounds','post','addSound','put','delete','/:id','/:id/sounds/:id2'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xcb24,0xe8));var _0x4cb2=function(_0x4b9c4e,_0x4587c8){_0x4b9c4e=_0x4b9c4e-0x0;var _0x1040e4=_0xcb24[_0x4b9c4e];return _0x1040e4;};'use strict';var multer=require(_0x4cb2('0x0'));var util=require(_0x4cb2('0x1'));var path=require(_0x4cb2('0x2'));var timeout=require(_0x4cb2('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4cb2('0x4'));var auth=require(_0x4cb2('0x5'));var interaction=require(_0x4cb2('0x6'));var config=require(_0x4cb2('0x7'));var controller=require(_0x4cb2('0x8'));router[_0x4cb2('0x9')]('/',auth[_0x4cb2('0xa')](),controller[_0x4cb2('0xb')]);router[_0x4cb2('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x4cb2('0xc')]);router[_0x4cb2('0x9')](_0x4cb2('0xd'),auth[_0x4cb2('0xa')](),controller[_0x4cb2('0xe')]);router[_0x4cb2('0xf')]('/',auth[_0x4cb2('0xa')](),controller['create']);router[_0x4cb2('0xf')](_0x4cb2('0xd'),auth[_0x4cb2('0xa')](),controller[_0x4cb2('0x10')]);router[_0x4cb2('0x11')]('/:id',auth[_0x4cb2('0xa')](),controller['update']);router[_0x4cb2('0x12')](_0x4cb2('0x13'),auth[_0x4cb2('0xa')](),controller['destroy']);router[_0x4cb2('0x12')](_0x4cb2('0x14'),auth['isAuthenticated'](),controller[_0x4cb2('0x15')]);module[_0x4cb2('0x16')]=router;
\ No newline at end of file
index 6a84316..0845262 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcea2=['BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','mp3nb','quietmp3nb','quietmp3','mp3','files','alpha','TIMESTAMP'];(function(_0x27225c,_0x529cfc){var _0xd810b=function(_0x40c875){while(--_0x40c875){_0x27225c['push'](_0x27225c['shift']());}};_0xd810b(++_0x529cfc);}(_0xcea2,0x1a5));var _0x2cea=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xcea2[_0x500419];return _0x241c1a;};'use strict';var Sequelize=require(_0x2cea('0x0'));module[_0x2cea('0x1')]={'name':{'type':Sequelize[_0x2cea('0x2')],'allowNull':![],'unique':_0x2cea('0x3')},'mode':{'type':Sequelize[_0x2cea('0x4')](_0x2cea('0x5'),'files',_0x2cea('0x6'),_0x2cea('0x7'),_0x2cea('0x8'),_0x2cea('0x9')),'allowNull':!![],'defaultValue':_0x2cea('0xa')},'directory':{'type':Sequelize[_0x2cea('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x2cea('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x2cea('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x2cea('0xb')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x2cea('0xc')},'defaultEntry':{'type':Sequelize[_0x2cea('0xd')],'defaultValue':0x0}};
\ No newline at end of file
+var _0x9c38=['alpha','TIMESTAMP','BOOLEAN','sequelize','exports','name','ENUM','custom','files','quietmp3','mp3','STRING'];(function(_0x386788,_0x2cf702){var _0x3d5e7f=function(_0x156e5e){while(--_0x156e5e){_0x386788['push'](_0x386788['shift']());}};_0x3d5e7f(++_0x2cf702);}(_0x9c38,0x10b));var _0x89c3=function(_0x4e027f,_0x431ddc){_0x4e027f=_0x4e027f-0x0;var _0x141300=_0x9c38[_0x4e027f];return _0x141300;};'use strict';var Sequelize=require(_0x89c3('0x0'));module[_0x89c3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x89c3('0x2')},'mode':{'type':Sequelize[_0x89c3('0x3')](_0x89c3('0x4'),_0x89c3('0x5'),'mp3nb','quietmp3nb',_0x89c3('0x6'),_0x89c3('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0x89c3('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x89c3('0x8')],'allowNull':!![]},'digit':{'type':Sequelize[_0x89c3('0x8')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x89c3('0x9')},'format':{'type':Sequelize[_0x89c3('0x8')],'allowNull':!![]},'stamp':{'type':_0x89c3('0xa')},'defaultEntry':{'type':Sequelize[_0x89c3('0xb')],'defaultValue':0x0}};
\ No newline at end of file
index 405ea2e..ade9120 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7061=['sox','to-csv','ejs','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','then','end','name','send','VoiceMusicOnHold','rawAttributes','fieldName','key','map','query','filters','intersection','model','fields','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','keys','include','find','body','params','create','transaction','mode','files','directory','join','root','mkdirSync','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','unlinkSync','Sequelize','ValidationError','addSound','Sound','findOne','createdAt','server/files/sounds/converted','%s.%s','basename','save_name','server/files/moh','format','converted_format','symlinkSync','message','removeSound','id2','getSounds','length','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x5526c4,_0x4e77eb){var _0x165ff8=function(_0x3b8802){while(--_0x3b8802){_0x5526c4['push'](_0x5526c4['shift']());}};_0x165ff8(++_0x4e77eb);}(_0x7061,0x67));var _0x1706=function(_0x2cbda6,_0x3afdeb){_0x2cbda6=_0x2cbda6-0x0;var _0x3cd254=_0x7061[_0x2cbda6];return _0x3cd254;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1706('0x0'));var zipdir=require(_0x1706('0x1'));var jsonpatch=require(_0x1706('0x2'));var rp=require(_0x1706('0x3'));var moment=require(_0x1706('0x4'));var BPromise=require(_0x1706('0x5'));var Mustache=require(_0x1706('0x6'));var util=require(_0x1706('0x7'));var path=require(_0x1706('0x8'));var sox=require(_0x1706('0x9'));var csv=require(_0x1706('0xa'));var ejs=require(_0x1706('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1706('0xc'));var deskjs=require(_0x1706('0xd'));var toCsv=require(_0x1706('0xa'));var querystring=require('querystring');var Papa=require(_0x1706('0xe'));var Redis=require(_0x1706('0xf'));var authService=require(_0x1706('0x10'));var qs=require(_0x1706('0x11'));var as=require(_0x1706('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1706('0x13'))(_0x1706('0x14'));var utils=require(_0x1706('0x15'));var config=require(_0x1706('0x16'));var licenseUtil=require(_0x1706('0x17'));var db=require(_0x1706('0x18'))['db'];function respondWithStatusCode(_0x306cdd,_0x2b9b35){_0x2b9b35=_0x2b9b35||0xcc;return function(_0x55de5c){if(_0x55de5c){return _0x306cdd[_0x1706('0x19')](_0x2b9b35);}return _0x306cdd[_0x1706('0x1a')](_0x2b9b35)['end']();};}function respondWithResult(_0x5c9846,_0x9d313f){_0x9d313f=_0x9d313f||0xc8;return function(_0xac4513){if(_0xac4513){return _0x5c9846[_0x1706('0x1a')](_0x9d313f)[_0x1706('0x1b')](_0xac4513);}};}function respondWithFilteredResult(_0x26ddbc,_0x271fa6){return function(_0x5644cf){if(_0x5644cf){var _0x2bf3d7=typeof _0x271fa6[_0x1706('0x1c')]===_0x1706('0x1d')&&typeof _0x271fa6[_0x1706('0x1e')]===_0x1706('0x1d');var _0x9325f7=_0x5644cf[_0x1706('0x1f')];var _0x284417=_0x2bf3d7?0x0:_0x271fa6[_0x1706('0x1c')];var _0xb60a01=_0x2bf3d7?_0x5644cf['count']:_0x271fa6[_0x1706('0x1c')]+_0x271fa6[_0x1706('0x1e')];var _0x4a163;if(_0xb60a01>=_0x9325f7){_0xb60a01=_0x9325f7;_0x4a163=0xc8;}else{_0x4a163=0xce;}_0x26ddbc[_0x1706('0x1a')](_0x4a163);return _0x26ddbc[_0x1706('0x20')](_0x1706('0x21'),_0x284417+'-'+_0xb60a01+'/'+_0x9325f7)[_0x1706('0x1b')](_0x5644cf);}return null;};}function patchUpdates(_0x5b40b7){return function(_0x194ff3){try{jsonpatch[_0x1706('0x22')](_0x194ff3,_0x5b40b7,!![]);}catch(_0x771d1a){return BPromise[_0x1706('0x23')](_0x771d1a);}return _0x194ff3[_0x1706('0x24')]();};}function saveUpdates(_0x5ff25d,_0x50296e){return function(_0xc90d30){if(_0xc90d30){return _0xc90d30[_0x1706('0x25')](_0x5ff25d)['then'](function(_0x33cf32){return _0x33cf32;});}return null;};}function removeEntity(_0x444cf7,_0xc52eed){return function(_0x138589){if(_0x138589){return _0x138589[_0x1706('0x26')]()['then'](function(){var _0x95dd14=_0x138589[_0x1706('0x27')]({'plain':!![]});var _0x5dbadd=_0x1706('0x28');return db['UserProfileResource'][_0x1706('0x26')]({'where':{'type':_0x5dbadd,'resourceId':_0x95dd14['id']}})[_0x1706('0x29')](function(){return _0x138589;});})[_0x1706('0x29')](function(){_0x444cf7[_0x1706('0x1a')](0xcc)[_0x1706('0x2a')]();});}};}function handleEntityNotFound(_0x4c698c,_0x1e8905){return function(_0x2fced0){if(!_0x2fced0){_0x4c698c['sendStatus'](0x194);}return _0x2fced0;};}function handleError(_0x29c4d9,_0x5380a1){_0x5380a1=_0x5380a1||0x1f4;return function(_0x3daec3){logger['error'](_0x3daec3['stack']);if(_0x3daec3[_0x1706('0x2b')]){delete _0x3daec3[_0x1706('0x2b')];}_0x29c4d9[_0x1706('0x1a')](_0x5380a1)[_0x1706('0x2c')](_0x3daec3);};}exports['index']=function(_0x2e1cb6,_0x526791){var _0x4916ed={},_0x2df8d0={},_0x1754bc={'count':0x0,'rows':[]};var _0x32a1b4=_['map'](db[_0x1706('0x2d')][_0x1706('0x2e')],function(_0x11dcf2){return{'name':_0x11dcf2[_0x1706('0x2f')],'type':_0x11dcf2['type'][_0x1706('0x30')]};});_0x2df8d0['model']=_[_0x1706('0x31')](_0x32a1b4,_0x1706('0x2b'));_0x2df8d0[_0x1706('0x32')]=_['keys'](_0x2e1cb6['query']);_0x2df8d0[_0x1706('0x33')]=_[_0x1706('0x34')](_0x2df8d0['model'],_0x2df8d0[_0x1706('0x32')]);_0x4916ed['attributes']=_[_0x1706('0x34')](_0x2df8d0[_0x1706('0x35')],qs[_0x1706('0x36')](_0x2e1cb6[_0x1706('0x32')][_0x1706('0x36')]));_0x4916ed[_0x1706('0x37')]=_0x4916ed[_0x1706('0x37')]['length']?_0x4916ed[_0x1706('0x37')]:_0x2df8d0[_0x1706('0x35')];if(!_0x2e1cb6[_0x1706('0x32')]['hasOwnProperty'](_0x1706('0x38'))){_0x4916ed['limit']=qs[_0x1706('0x1e')](_0x2e1cb6[_0x1706('0x32')][_0x1706('0x1e')]);_0x4916ed[_0x1706('0x1c')]=qs['offset'](_0x2e1cb6[_0x1706('0x32')]['offset']);}_0x4916ed[_0x1706('0x39')]=qs[_0x1706('0x3a')](_0x2e1cb6[_0x1706('0x32')]['sort']);delete _0x2e1cb6[_0x1706('0x32')]['sort'];_0x4916ed[_0x1706('0x3b')]=qs[_0x1706('0x33')](_[_0x1706('0x3c')](_0x2e1cb6[_0x1706('0x32')],_0x2df8d0['filters']),_0x32a1b4);if(_0x2e1cb6['query'][_0x1706('0x3d')]){_0x4916ed[_0x1706('0x3b')]=_[_0x1706('0x3e')](_0x4916ed[_0x1706('0x3b')],{'$or':_[_0x1706('0x31')](_0x32a1b4,function(_0x4a62fa){if(_0x4a62fa[_0x1706('0x3f')]!==_0x1706('0x40')){var _0x43cbea={};_0x43cbea[_0x4a62fa[_0x1706('0x2b')]]={'$like':'%'+_0x2e1cb6['query'][_0x1706('0x3d')]+'%'};return _0x43cbea;}})});}_0x4916ed=_['merge']({},_0x4916ed,_0x2e1cb6[_0x1706('0x41')]);var _0x38772b={'where':_0x4916ed[_0x1706('0x3b')]};return db[_0x1706('0x2d')][_0x1706('0x1f')](_0x38772b)[_0x1706('0x29')](function(_0x27c3e6){_0x1754bc[_0x1706('0x1f')]=_0x27c3e6;if(_0x2e1cb6[_0x1706('0x32')][_0x1706('0x42')]){_0x4916ed['include']=[{'all':!![]}];}return db[_0x1706('0x2d')][_0x1706('0x43')](_0x4916ed);})[_0x1706('0x29')](function(_0x4d0a4a){_0x1754bc[_0x1706('0x44')]=_0x4d0a4a;return _0x1754bc;})[_0x1706('0x29')](respondWithFilteredResult(_0x526791,_0x4916ed))[_0x1706('0x45')](handleError(_0x526791,null));};exports['show']=function(_0x5de852,_0x367ea2){var _0x35d850={'raw':![],'where':{'id':_0x5de852['params']['id']}},_0x1c768a={};_0x1c768a[_0x1706('0x35')]=_[_0x1706('0x46')](db[_0x1706('0x2d')][_0x1706('0x2e')]);_0x1c768a[_0x1706('0x32')]=_[_0x1706('0x46')](_0x5de852[_0x1706('0x32')]);_0x1c768a[_0x1706('0x33')]=_[_0x1706('0x34')](_0x1c768a[_0x1706('0x35')],_0x1c768a['query']);_0x35d850[_0x1706('0x37')]=_['intersection'](_0x1c768a['model'],qs[_0x1706('0x36')](_0x5de852[_0x1706('0x32')][_0x1706('0x36')]));_0x35d850[_0x1706('0x37')]=_0x35d850['attributes']['length']?_0x35d850[_0x1706('0x37')]:_0x1c768a[_0x1706('0x35')];if(_0x5de852[_0x1706('0x32')][_0x1706('0x42')]){_0x35d850[_0x1706('0x47')]=[{'all':!![]}];}_0x35d850=_[_0x1706('0x3e')]({},_0x35d850,_0x5de852['options']);return db[_0x1706('0x2d')][_0x1706('0x48')](_0x35d850)[_0x1706('0x29')](handleEntityNotFound(_0x367ea2,null))[_0x1706('0x29')](respondWithResult(_0x367ea2,null))[_0x1706('0x45')](handleError(_0x367ea2,null));};exports[_0x1706('0x25')]=function(_0x4bc602,_0x118eeb){if(_0x4bc602[_0x1706('0x49')]['id']){delete _0x4bc602[_0x1706('0x49')]['id'];}return db[_0x1706('0x2d')][_0x1706('0x48')]({'where':{'id':_0x4bc602[_0x1706('0x4a')]['id']}})['then'](handleEntityNotFound(_0x118eeb,null))[_0x1706('0x29')](saveUpdates(_0x4bc602['body'],null))[_0x1706('0x29')](respondWithResult(_0x118eeb,null))[_0x1706('0x45')](handleError(_0x118eeb,null));};exports[_0x1706('0x4b')]=function(_0x207ef1,_0x340af3,_0x33243d){return db['sequelize'][_0x1706('0x4c')](function(_0x521ebd){if(_0x207ef1['body'][_0x1706('0x4d')]===_0x1706('0x4e')){_0x207ef1[_0x1706('0x49')][_0x1706('0x4f')]=path[_0x1706('0x50')](config[_0x1706('0x51')],'server/files/moh',_0x207ef1[_0x1706('0x49')][_0x1706('0x2b')]);}return db[_0x1706('0x2d')][_0x1706('0x4b')](_0x207ef1[_0x1706('0x49')],{'transaction':_0x521ebd})[_0x1706('0x29')](function(_0x242f85){if(_0x207ef1[_0x1706('0x49')][_0x1706('0x4d')]===_0x1706('0x4e')){fs[_0x1706('0x52')](_0x242f85[_0x1706('0x4f')],parseInt('0777',0x8));}var _0x2a4b56=_0x207ef1[_0x1706('0x53')][_0x1706('0x27')]({'plain':!![]});if(!_0x2a4b56)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2a4b56[_0x1706('0x54')]===_0x1706('0x53')){var _0x446e43=_0x242f85['get']({'plain':!![]});return db[_0x1706('0x55')][_0x1706('0x48')]({'where':{'name':_0x1706('0x28'),'userProfileId':_0x2a4b56[_0x1706('0x56')]},'raw':!![]})['then'](function(_0x423979){if(_0x423979&&_0x423979[_0x1706('0x57')]===0x0){return db[_0x1706('0x58')][_0x1706('0x4b')]({'name':_0x446e43['name'],'resourceId':_0x446e43['id'],'type':_0x423979['name'],'sectionId':_0x423979['id']},{})[_0x1706('0x29')](function(){return _0x242f85;});}else{return _0x242f85;}})[_0x1706('0x45')](function(_0x2da2f9){logger[_0x1706('0x59')](_0x1706('0x5a'),_0x2da2f9);});}return _0x242f85;});})['then'](respondWithResult(_0x340af3,0xc9))[_0x1706('0x45')](handleError(_0x340af3,null));};exports[_0x1706('0x26')]=function(_0x172d25,_0x1aa3bf,_0x5420c2){var _0x751adc;return db[_0x1706('0x2d')][_0x1706('0x48')]({'where':{'id':_0x172d25[_0x1706('0x4a')]['id']}})[_0x1706('0x29')](function(_0x32e87d){if(_0x32e87d){return db[_0x1706('0x5b')][_0x1706('0x4c')](function(_0xe52592){return _0x32e87d[_0x1706('0x26')]({'transaction':_0xe52592,'raw':!![]})[_0x1706('0x29')](function(_0x1e9365){if(_0x1e9365[_0x1706('0x4f')]){fs['readdirSync'](_0x1e9365[_0x1706('0x4f')])['forEach'](function(_0x4b1b88){fs[_0x1706('0x5c')](path[_0x1706('0x50')](_0x1e9365[_0x1706('0x4f')],_0x4b1b88));});fs['rmdirSync'](_0x1e9365[_0x1706('0x4f')]);}return _0x1e9365;});})[_0x1706('0x45')](function(_0x32a614){throw new db[(_0x1706('0x5d'))][(_0x1706('0x5e'))](_0x32a614['message']);});}})[_0x1706('0x29')](handleEntityNotFound(_0x1aa3bf,null))[_0x1706('0x29')](removeEntity(_0x1aa3bf,null))[_0x1706('0x45')](handleError(_0x1aa3bf,null));};exports[_0x1706('0x5f')]=function(_0x4ea234,_0x22ef23,_0x3cfc8c){return db[_0x1706('0x5b')][_0x1706('0x4c')](function(_0xd5a8ed){var _0x5a3642;return db[_0x1706('0x2d')][_0x1706('0x48')]({'where':{'id':_0x4ea234['params']['id']}})['then'](function(_0x15c166){if(_0x15c166){_0x5a3642=_0x15c166;return _0x15c166[_0x1706('0x5f')](_0x4ea234[_0x1706('0x49')]['id'],{'transaction':_0xd5a8ed});}})[_0x1706('0x29')](function(_0x2f103d){if(_0x2f103d){return db[_0x1706('0x60')][_0x1706('0x61')]({'where':{'id':_0x4ea234['body']['id']},'attributes':['id',_0x1706('0x2b'),'save_name','converted_format',_0x1706('0x62')],'raw':!![]});}})[_0x1706('0x29')](function(_0x5a3ea9){if(_0x5a3ea9){var _0x58d6a9=path[_0x1706('0x50')](config['root'],_0x1706('0x63'),util['format'](_0x1706('0x64'),path[_0x1706('0x65')](_0x5a3ea9[_0x1706('0x66')],path['extname'](_0x5a3ea9['save_name'])),_0x5a3ea9['converted_format']));var _0x4c165f=path[_0x1706('0x50')](config['root'],_0x1706('0x67'),_0x5a3642[_0x1706('0x2b')],util[_0x1706('0x68')]('%s.%s',_0x5a3ea9['name'],_0x5a3ea9[_0x1706('0x69')]));fs[_0x1706('0x6a')](_0x58d6a9,_0x4c165f);return _0x5a3ea9;}})[_0x1706('0x45')](function(_0x24cf9e){throw new db[(_0x1706('0x5d'))]['ValidationError'](_0x24cf9e[_0x1706('0x6b')]);});})[_0x1706('0x29')](handleEntityNotFound(_0x22ef23,null))['then'](respondWithResult(_0x22ef23,0xc9))[_0x1706('0x45')](handleError(_0x22ef23,null));};exports['removeSound']=function(_0x38eeba,_0x193972,_0x52c315){return db[_0x1706('0x5b')][_0x1706('0x4c')](function(_0x460c52){var _0x35b53d;return db[_0x1706('0x2d')][_0x1706('0x61')]({'where':{'id':_0x38eeba[_0x1706('0x4a')]['id']}})[_0x1706('0x29')](handleEntityNotFound(_0x193972,null))[_0x1706('0x29')](function(_0x392933){if(_0x392933){_0x35b53d=_0x392933;return _0x392933[_0x1706('0x6c')](_0x38eeba[_0x1706('0x4a')][_0x1706('0x6d')]);}})[_0x1706('0x29')](function(_0x56b883){if(_0x56b883){return db[_0x1706('0x60')][_0x1706('0x61')]({'where':{'id':_0x38eeba['params']['id2']},'attributes':['id','name',_0x1706('0x66'),_0x1706('0x69'),_0x1706('0x62')],'raw':!![]});}})[_0x1706('0x29')](function(_0x47d1c6){if(_0x47d1c6){fs['unlinkSync'](path[_0x1706('0x50')](_0x35b53d[_0x1706('0x4f')],util['format'](_0x1706('0x64'),_0x47d1c6['name'],_0x47d1c6['converted_format'])));return _0x47d1c6;}})['catch'](function(_0x33261d){throw new db[(_0x1706('0x5d'))][(_0x1706('0x5e'))](_0x33261d[_0x1706('0x6b')]);});})[_0x1706('0x29')](handleEntityNotFound(_0x193972,null))[_0x1706('0x29')](respondWithStatusCode(_0x193972,0xcc))[_0x1706('0x45')](handleError(_0x193972,null));};exports[_0x1706('0x6e')]=function(_0x20cbac,_0x4feeac,_0x5c92d1){var _0x15797a={};var _0x29e747={};var _0x4b1a91;var _0x3dc0ae;return db[_0x1706('0x2d')]['findOne']({'where':{'id':_0x20cbac['params']['id']}})[_0x1706('0x29')](handleEntityNotFound(_0x4feeac,null))[_0x1706('0x29')](function(_0x2344ab){if(_0x2344ab){_0x4b1a91=_0x2344ab;_0x29e747['model']=_['keys'](db[_0x1706('0x60')]['rawAttributes']);_0x29e747[_0x1706('0x32')]=_['keys'](_0x20cbac[_0x1706('0x32')]);_0x29e747['filters']=_['intersection'](_0x29e747[_0x1706('0x35')],_0x29e747['query']);_0x15797a[_0x1706('0x37')]=_[_0x1706('0x34')](_0x29e747[_0x1706('0x35')],qs['fields'](_0x20cbac[_0x1706('0x32')]['fields']));_0x15797a[_0x1706('0x37')]=_0x15797a[_0x1706('0x37')]['length']?_0x15797a[_0x1706('0x37')]:_0x29e747[_0x1706('0x35')];_0x15797a[_0x1706('0x39')]=qs[_0x1706('0x3a')](_0x20cbac['query'][_0x1706('0x3a')]);_0x15797a['where']=qs[_0x1706('0x33')](_['pick'](_0x20cbac[_0x1706('0x32')],_0x29e747[_0x1706('0x33')]));if(_0x20cbac['query'][_0x1706('0x3d')]){_0x15797a[_0x1706('0x3b')]=_['merge'](_0x15797a[_0x1706('0x3b')],{'$or':_['map'](_0x15797a[_0x1706('0x37')],function(_0x17b7b6){var _0x418ae1={};_0x418ae1[_0x17b7b6]={'$like':'%'+_0x20cbac[_0x1706('0x32')][_0x1706('0x3d')]+'%'};return _0x418ae1;})});}_0x15797a=_[_0x1706('0x3e')]({},_0x15797a,_0x20cbac['options']);return _0x4b1a91[_0x1706('0x6e')](_0x15797a);}})[_0x1706('0x29')](function(_0xb0236d){if(_0xb0236d){_0x3dc0ae=_0xb0236d[_0x1706('0x6f')];if(!_0x20cbac[_0x1706('0x32')]['hasOwnProperty'](_0x1706('0x38'))){_0x15797a[_0x1706('0x1e')]=qs['limit'](_0x20cbac[_0x1706('0x32')][_0x1706('0x1e')]);_0x15797a['offset']=qs[_0x1706('0x1c')](_0x20cbac[_0x1706('0x32')]['offset']);}return _0x4b1a91['getSounds'](_0x15797a);}})[_0x1706('0x29')](function(_0xf549f){if(_0xf549f){return _0xf549f?{'count':_0x3dc0ae,'rows':_0xf549f}:null;}})[_0x1706('0x29')](respondWithResult(_0x4feeac,null))[_0x1706('0x45')](handleError(_0x4feeac,null));};
\ No newline at end of file
+var _0x1453=['moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','map','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','include','VoiceMusicOnHold','findAll','rows','catch','show','params','rawAttributes','find','body','create','sequelize','mode','files','directory','join','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','removeSound','id2','Sequelize','getSounds','order','pick','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x1453,0x152));var _0x3145=function(_0x588cb5,_0x41250c){_0x588cb5=_0x588cb5-0x0;var _0x4547aa=_0x1453[_0x588cb5];return _0x4547aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3145('0x0'));var zipdir=require(_0x3145('0x1'));var jsonpatch=require(_0x3145('0x2'));var rp=require(_0x3145('0x3'));var moment=require(_0x3145('0x4'));var BPromise=require(_0x3145('0x5'));var Mustache=require(_0x3145('0x6'));var util=require('util');var path=require(_0x3145('0x7'));var sox=require(_0x3145('0x8'));var csv=require('to-csv');var ejs=require(_0x3145('0x9'));var fs=require('fs');var fs_extra=require(_0x3145('0xa'));var _=require(_0x3145('0xb'));var squel=require(_0x3145('0xc'));var crypto=require(_0x3145('0xd'));var jsforce=require(_0x3145('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x3145('0xf'));var querystring=require(_0x3145('0x10'));var Papa=require(_0x3145('0x11'));var Redis=require(_0x3145('0x12'));var authService=require(_0x3145('0x13'));var qs=require(_0x3145('0x14'));var as=require(_0x3145('0x15'));var hardwareService=require(_0x3145('0x16'));var logger=require(_0x3145('0x17'))(_0x3145('0x18'));var utils=require(_0x3145('0x19'));var config=require(_0x3145('0x1a'));var licenseUtil=require(_0x3145('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x6f0a66,_0x196f93){_0x196f93=_0x196f93||0xcc;return function(_0x4724ad){if(_0x4724ad){return _0x6f0a66[_0x3145('0x1c')](_0x196f93);}return _0x6f0a66['status'](_0x196f93)[_0x3145('0x1d')]();};}function respondWithResult(_0x6fd737,_0x48f777){_0x48f777=_0x48f777||0xc8;return function(_0x18bdd8){if(_0x18bdd8){return _0x6fd737[_0x3145('0x1e')](_0x48f777)[_0x3145('0x1f')](_0x18bdd8);}};}function respondWithFilteredResult(_0x1ab02f,_0x2bc50c){return function(_0x3b1e6b){if(_0x3b1e6b){var _0x352c45=typeof _0x2bc50c[_0x3145('0x20')]===_0x3145('0x21')&&typeof _0x2bc50c[_0x3145('0x22')]===_0x3145('0x21');var _0x5015f9=_0x3b1e6b[_0x3145('0x23')];var _0x146685=_0x352c45?0x0:_0x2bc50c[_0x3145('0x20')];var _0x16f3aa=_0x352c45?_0x3b1e6b[_0x3145('0x23')]:_0x2bc50c[_0x3145('0x20')]+_0x2bc50c[_0x3145('0x22')];var _0x30498e;if(_0x16f3aa>=_0x5015f9){_0x16f3aa=_0x5015f9;_0x30498e=0xc8;}else{_0x30498e=0xce;}_0x1ab02f[_0x3145('0x1e')](_0x30498e);return _0x1ab02f[_0x3145('0x24')](_0x3145('0x25'),_0x146685+'-'+_0x16f3aa+'/'+_0x5015f9)[_0x3145('0x1f')](_0x3b1e6b);}return null;};}function patchUpdates(_0x3e5e7d){return function(_0x5668ee){try{jsonpatch[_0x3145('0x26')](_0x5668ee,_0x3e5e7d,!![]);}catch(_0x260e1e){return BPromise['reject'](_0x260e1e);}return _0x5668ee['save']();};}function saveUpdates(_0x3c9c67,_0x2c403f){return function(_0x477146){if(_0x477146){return _0x477146[_0x3145('0x27')](_0x3c9c67)[_0x3145('0x28')](function(_0x2743b6){return _0x2743b6;});}return null;};}function removeEntity(_0x54399d,_0x105f6e){return function(_0x1afa7){if(_0x1afa7){return _0x1afa7[_0x3145('0x29')]()[_0x3145('0x28')](function(){var _0x43c2b7=_0x1afa7[_0x3145('0x2a')]({'plain':!![]});var _0x154e32=_0x3145('0x2b');return db[_0x3145('0x2c')][_0x3145('0x29')]({'where':{'type':_0x154e32,'resourceId':_0x43c2b7['id']}})[_0x3145('0x28')](function(){return _0x1afa7;});})[_0x3145('0x28')](function(){_0x54399d[_0x3145('0x1e')](0xcc)[_0x3145('0x1d')]();});}};}function handleEntityNotFound(_0x3466d8,_0x4c2e8a){return function(_0x2c521e){if(!_0x2c521e){_0x3466d8['sendStatus'](0x194);}return _0x2c521e;};}function handleError(_0x4fabcf,_0x1a7de1){_0x1a7de1=_0x1a7de1||0x1f4;return function(_0x191576){logger[_0x3145('0x2d')](_0x191576['stack']);if(_0x191576[_0x3145('0x2e')]){delete _0x191576[_0x3145('0x2e')];}_0x4fabcf['status'](_0x1a7de1)['send'](_0x191576);};}exports['index']=function(_0x26835b,_0x5b8c09){var _0x344aa7={},_0x34e1df={},_0x410af0={'count':0x0,'rows':[]};var _0x32471d=_[_0x3145('0x2f')](db['VoiceMusicOnHold']['rawAttributes'],function(_0x370552){return{'name':_0x370552['fieldName'],'type':_0x370552[_0x3145('0x30')][_0x3145('0x31')]};});_0x34e1df['model']=_[_0x3145('0x2f')](_0x32471d,_0x3145('0x2e'));_0x34e1df['query']=_[_0x3145('0x32')](_0x26835b[_0x3145('0x33')]);_0x34e1df[_0x3145('0x34')]=_[_0x3145('0x35')](_0x34e1df[_0x3145('0x36')],_0x34e1df[_0x3145('0x33')]);_0x344aa7[_0x3145('0x37')]=_[_0x3145('0x35')](_0x34e1df[_0x3145('0x36')],qs[_0x3145('0x38')](_0x26835b[_0x3145('0x33')][_0x3145('0x38')]));_0x344aa7[_0x3145('0x37')]=_0x344aa7['attributes'][_0x3145('0x39')]?_0x344aa7[_0x3145('0x37')]:_0x34e1df[_0x3145('0x36')];if(!_0x26835b[_0x3145('0x33')][_0x3145('0x3a')](_0x3145('0x3b'))){_0x344aa7[_0x3145('0x22')]=qs[_0x3145('0x22')](_0x26835b[_0x3145('0x33')][_0x3145('0x22')]);_0x344aa7[_0x3145('0x20')]=qs[_0x3145('0x20')](_0x26835b[_0x3145('0x33')][_0x3145('0x20')]);}_0x344aa7['order']=qs[_0x3145('0x3c')](_0x26835b[_0x3145('0x33')][_0x3145('0x3c')]);delete _0x26835b[_0x3145('0x33')][_0x3145('0x3c')];_0x344aa7[_0x3145('0x3d')]=qs[_0x3145('0x34')](_['pick'](_0x26835b['query'],_0x34e1df[_0x3145('0x34')]),_0x32471d);if(_0x26835b[_0x3145('0x33')][_0x3145('0x3e')]){_0x344aa7[_0x3145('0x3d')]=_[_0x3145('0x3f')](_0x344aa7[_0x3145('0x3d')],{'$or':_[_0x3145('0x2f')](_0x32471d,function(_0x1b9af4){if(_0x1b9af4[_0x3145('0x30')]!==_0x3145('0x40')){var _0xf99fe7={};_0xf99fe7[_0x1b9af4[_0x3145('0x2e')]]={'$like':'%'+_0x26835b['query'][_0x3145('0x3e')]+'%'};return _0xf99fe7;}})});}_0x344aa7=_['merge']({},_0x344aa7,_0x26835b[_0x3145('0x41')]);var _0x3568ad={'where':_0x344aa7[_0x3145('0x3d')]};return db['VoiceMusicOnHold'][_0x3145('0x23')](_0x3568ad)['then'](function(_0x4d035c){_0x410af0[_0x3145('0x23')]=_0x4d035c;if(_0x26835b['query'][_0x3145('0x42')]){_0x344aa7[_0x3145('0x43')]=[{'all':!![]}];}return db[_0x3145('0x44')][_0x3145('0x45')](_0x344aa7);})['then'](function(_0x442971){_0x410af0[_0x3145('0x46')]=_0x442971;return _0x410af0;})[_0x3145('0x28')](respondWithFilteredResult(_0x5b8c09,_0x344aa7))[_0x3145('0x47')](handleError(_0x5b8c09,null));};exports[_0x3145('0x48')]=function(_0x5c0e66,_0x192b96){var _0x2374f9={'raw':![],'where':{'id':_0x5c0e66[_0x3145('0x49')]['id']}},_0x94ad00={};_0x94ad00[_0x3145('0x36')]=_[_0x3145('0x32')](db['VoiceMusicOnHold'][_0x3145('0x4a')]);_0x94ad00[_0x3145('0x33')]=_[_0x3145('0x32')](_0x5c0e66[_0x3145('0x33')]);_0x94ad00[_0x3145('0x34')]=_['intersection'](_0x94ad00[_0x3145('0x36')],_0x94ad00[_0x3145('0x33')]);_0x2374f9['attributes']=_[_0x3145('0x35')](_0x94ad00[_0x3145('0x36')],qs[_0x3145('0x38')](_0x5c0e66[_0x3145('0x33')][_0x3145('0x38')]));_0x2374f9['attributes']=_0x2374f9[_0x3145('0x37')][_0x3145('0x39')]?_0x2374f9[_0x3145('0x37')]:_0x94ad00[_0x3145('0x36')];if(_0x5c0e66[_0x3145('0x33')][_0x3145('0x42')]){_0x2374f9[_0x3145('0x43')]=[{'all':!![]}];}_0x2374f9=_['merge']({},_0x2374f9,_0x5c0e66['options']);return db[_0x3145('0x44')][_0x3145('0x4b')](_0x2374f9)[_0x3145('0x28')](handleEntityNotFound(_0x192b96,null))[_0x3145('0x28')](respondWithResult(_0x192b96,null))[_0x3145('0x47')](handleError(_0x192b96,null));};exports[_0x3145('0x27')]=function(_0x454df7,_0x573765){if(_0x454df7[_0x3145('0x4c')]['id']){delete _0x454df7['body']['id'];}return db[_0x3145('0x44')][_0x3145('0x4b')]({'where':{'id':_0x454df7[_0x3145('0x49')]['id']}})[_0x3145('0x28')](handleEntityNotFound(_0x573765,null))[_0x3145('0x28')](saveUpdates(_0x454df7[_0x3145('0x4c')],null))['then'](respondWithResult(_0x573765,null))[_0x3145('0x47')](handleError(_0x573765,null));};exports[_0x3145('0x4d')]=function(_0x3e782c,_0x209ff1,_0x52fc30){return db[_0x3145('0x4e')]['transaction'](function(_0x3b731c){if(_0x3e782c[_0x3145('0x4c')][_0x3145('0x4f')]===_0x3145('0x50')){_0x3e782c[_0x3145('0x4c')][_0x3145('0x51')]=path[_0x3145('0x52')](config['root'],_0x3145('0x53'),_0x3e782c[_0x3145('0x4c')][_0x3145('0x2e')]);}return db[_0x3145('0x44')]['create'](_0x3e782c[_0x3145('0x4c')],{'transaction':_0x3b731c})[_0x3145('0x28')](function(_0x2bdd96){if(_0x3e782c['body'][_0x3145('0x4f')]==='files'){fs[_0x3145('0x54')](_0x2bdd96[_0x3145('0x51')],parseInt(_0x3145('0x55'),0x8));}var _0x15bbbe=_0x3e782c[_0x3145('0x56')]['get']({'plain':!![]});if(!_0x15bbbe)throw new Error(_0x3145('0x57'));if(_0x15bbbe[_0x3145('0x58')]===_0x3145('0x56')){var _0x22f341=_0x2bdd96['get']({'plain':!![]});return db['UserProfileSection'][_0x3145('0x4b')]({'where':{'name':'MusicOnHolds','userProfileId':_0x15bbbe['userProfileId']},'raw':!![]})[_0x3145('0x28')](function(_0x34769f){if(_0x34769f&&_0x34769f['autoAssociation']===0x0){return db['UserProfileResource'][_0x3145('0x4d')]({'name':_0x22f341['name'],'resourceId':_0x22f341['id'],'type':_0x34769f[_0x3145('0x2e')],'sectionId':_0x34769f['id']},{})[_0x3145('0x28')](function(){return _0x2bdd96;});}else{return _0x2bdd96;}})[_0x3145('0x47')](function(_0x3c0479){logger['error'](_0x3145('0x59'),_0x3c0479);});}return _0x2bdd96;});})[_0x3145('0x28')](respondWithResult(_0x209ff1,0xc9))[_0x3145('0x47')](handleError(_0x209ff1,null));};exports['destroy']=function(_0xceeaaa,_0x4a64bc,_0x34c77e){var _0x185604;return db[_0x3145('0x44')][_0x3145('0x4b')]({'where':{'id':_0xceeaaa[_0x3145('0x49')]['id']}})[_0x3145('0x28')](function(_0x4ceb84){if(_0x4ceb84){return db['sequelize'][_0x3145('0x5a')](function(_0x1e7d25){return _0x4ceb84[_0x3145('0x29')]({'transaction':_0x1e7d25,'raw':!![]})[_0x3145('0x28')](function(_0x17aea6){if(_0x17aea6[_0x3145('0x51')]){fs[_0x3145('0x5b')](_0x17aea6[_0x3145('0x51')])[_0x3145('0x5c')](function(_0x38e2a7){fs[_0x3145('0x5d')](path[_0x3145('0x52')](_0x17aea6[_0x3145('0x51')],_0x38e2a7));});fs[_0x3145('0x5e')](_0x17aea6[_0x3145('0x51')]);}return _0x17aea6;});})['catch'](function(_0x22ae72){throw new db['Sequelize'][(_0x3145('0x5f'))](_0x22ae72[_0x3145('0x60')]);});}})['then'](handleEntityNotFound(_0x4a64bc,null))[_0x3145('0x28')](removeEntity(_0x4a64bc,null))[_0x3145('0x47')](handleError(_0x4a64bc,null));};exports['addSound']=function(_0x303b3b,_0x107e12,_0x164a92){return db[_0x3145('0x4e')][_0x3145('0x5a')](function(_0x4b0c35){var _0x5d17e3;return db[_0x3145('0x44')][_0x3145('0x4b')]({'where':{'id':_0x303b3b[_0x3145('0x49')]['id']}})[_0x3145('0x28')](function(_0x213a6b){if(_0x213a6b){_0x5d17e3=_0x213a6b;return _0x213a6b['addSound'](_0x303b3b[_0x3145('0x4c')]['id'],{'transaction':_0x4b0c35});}})[_0x3145('0x28')](function(_0x12d6b7){if(_0x12d6b7){return db[_0x3145('0x61')][_0x3145('0x62')]({'where':{'id':_0x303b3b[_0x3145('0x4c')]['id']},'attributes':['id',_0x3145('0x2e'),_0x3145('0x63'),_0x3145('0x64'),_0x3145('0x65')],'raw':!![]});}})[_0x3145('0x28')](function(_0x2cfbb1){if(_0x2cfbb1){var _0x3f56a0=path[_0x3145('0x52')](config[_0x3145('0x66')],_0x3145('0x67'),util[_0x3145('0x68')](_0x3145('0x69'),path[_0x3145('0x6a')](_0x2cfbb1[_0x3145('0x63')],path['extname'](_0x2cfbb1['save_name'])),_0x2cfbb1[_0x3145('0x64')]));var _0x5c6a82=path[_0x3145('0x52')](config['root'],'server/files/moh',_0x5d17e3[_0x3145('0x2e')],util[_0x3145('0x68')](_0x3145('0x69'),_0x2cfbb1[_0x3145('0x2e')],_0x2cfbb1[_0x3145('0x64')]));fs[_0x3145('0x6b')](_0x3f56a0,_0x5c6a82);return _0x2cfbb1;}})[_0x3145('0x47')](function(_0x4614fe){throw new db['Sequelize'][(_0x3145('0x5f'))](_0x4614fe['message']);});})[_0x3145('0x28')](handleEntityNotFound(_0x107e12,null))[_0x3145('0x28')](respondWithResult(_0x107e12,0xc9))['catch'](handleError(_0x107e12,null));};exports[_0x3145('0x6c')]=function(_0x5d57a1,_0xdfe77c,_0xace144){return db['sequelize']['transaction'](function(_0x15c9c6){var _0x5099f5;return db[_0x3145('0x44')]['findOne']({'where':{'id':_0x5d57a1[_0x3145('0x49')]['id']}})[_0x3145('0x28')](handleEntityNotFound(_0xdfe77c,null))['then'](function(_0x2d25af){if(_0x2d25af){_0x5099f5=_0x2d25af;return _0x2d25af[_0x3145('0x6c')](_0x5d57a1[_0x3145('0x49')]['id2']);}})[_0x3145('0x28')](function(_0x427b49){if(_0x427b49){return db[_0x3145('0x61')][_0x3145('0x62')]({'where':{'id':_0x5d57a1[_0x3145('0x49')][_0x3145('0x6d')]},'attributes':['id',_0x3145('0x2e'),_0x3145('0x63'),_0x3145('0x64'),'createdAt'],'raw':!![]});}})[_0x3145('0x28')](function(_0x242a4e){if(_0x242a4e){fs[_0x3145('0x5d')](path[_0x3145('0x52')](_0x5099f5[_0x3145('0x51')],util[_0x3145('0x68')]('%s.%s',_0x242a4e[_0x3145('0x2e')],_0x242a4e['converted_format'])));return _0x242a4e;}})['catch'](function(_0x599ff8){throw new db[(_0x3145('0x6e'))][(_0x3145('0x5f'))](_0x599ff8[_0x3145('0x60')]);});})[_0x3145('0x28')](handleEntityNotFound(_0xdfe77c,null))[_0x3145('0x28')](respondWithStatusCode(_0xdfe77c,0xcc))[_0x3145('0x47')](handleError(_0xdfe77c,null));};exports[_0x3145('0x6f')]=function(_0x3b4877,_0x2d6916,_0x251bc1){var _0x4b41de={};var _0x14a7ab={};var _0x37592f;var _0x2ff68a;return db['VoiceMusicOnHold'][_0x3145('0x62')]({'where':{'id':_0x3b4877[_0x3145('0x49')]['id']}})[_0x3145('0x28')](handleEntityNotFound(_0x2d6916,null))[_0x3145('0x28')](function(_0x45d759){if(_0x45d759){_0x37592f=_0x45d759;_0x14a7ab['model']=_[_0x3145('0x32')](db[_0x3145('0x61')]['rawAttributes']);_0x14a7ab['query']=_[_0x3145('0x32')](_0x3b4877[_0x3145('0x33')]);_0x14a7ab[_0x3145('0x34')]=_[_0x3145('0x35')](_0x14a7ab[_0x3145('0x36')],_0x14a7ab[_0x3145('0x33')]);_0x4b41de[_0x3145('0x37')]=_[_0x3145('0x35')](_0x14a7ab['model'],qs[_0x3145('0x38')](_0x3b4877[_0x3145('0x33')][_0x3145('0x38')]));_0x4b41de[_0x3145('0x37')]=_0x4b41de[_0x3145('0x37')][_0x3145('0x39')]?_0x4b41de[_0x3145('0x37')]:_0x14a7ab[_0x3145('0x36')];_0x4b41de[_0x3145('0x70')]=qs[_0x3145('0x3c')](_0x3b4877[_0x3145('0x33')][_0x3145('0x3c')]);_0x4b41de['where']=qs[_0x3145('0x34')](_[_0x3145('0x71')](_0x3b4877['query'],_0x14a7ab[_0x3145('0x34')]));if(_0x3b4877[_0x3145('0x33')][_0x3145('0x3e')]){_0x4b41de['where']=_[_0x3145('0x3f')](_0x4b41de['where'],{'$or':_[_0x3145('0x2f')](_0x4b41de[_0x3145('0x37')],function(_0x51ec25){var _0x312a2a={};_0x312a2a[_0x51ec25]={'$like':'%'+_0x3b4877[_0x3145('0x33')][_0x3145('0x3e')]+'%'};return _0x312a2a;})});}_0x4b41de=_[_0x3145('0x3f')]({},_0x4b41de,_0x3b4877[_0x3145('0x41')]);return _0x37592f['getSounds'](_0x4b41de);}})[_0x3145('0x28')](function(_0x3e41cb){if(_0x3e41cb){_0x2ff68a=_0x3e41cb['length'];if(!_0x3b4877[_0x3145('0x33')][_0x3145('0x3a')](_0x3145('0x3b'))){_0x4b41de[_0x3145('0x22')]=qs['limit'](_0x3b4877['query']['limit']);_0x4b41de[_0x3145('0x20')]=qs[_0x3145('0x20')](_0x3b4877[_0x3145('0x33')][_0x3145('0x20')]);}return _0x37592f['getSounds'](_0x4b41de);}})['then'](function(_0x417061){if(_0x417061){return _0x417061?{'count':_0x2ff68a,'rows':_0x417061}:null;}})[_0x3145('0x28')](respondWithResult(_0x2d6916,null))[_0x3145('0x47')](handleError(_0x2d6916,null));};
\ No newline at end of file
index dcb2312..8bbe22b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0693=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','define','lodash'];(function(_0x497d58,_0x38359e){var _0x397fa9=function(_0x21400c){while(--_0x21400c){_0x497d58['push'](_0x497d58['shift']());}};_0x397fa9(++_0x38359e);}(_0x0693,0x1ee));var _0x3069=function(_0x42b17c,_0x4054fa){_0x42b17c=_0x42b17c-0x0;var _0x1d3d05=_0x0693[_0x42b17c];return _0x1d3d05;};'use strict';var _=require(_0x3069('0x0'));var util=require('util');var logger=require(_0x3069('0x1'))(_0x3069('0x2'));var moment=require(_0x3069('0x3'));var BPromise=require(_0x3069('0x4'));var rp=require(_0x3069('0x5'));var fs=require('fs');var path=require(_0x3069('0x6'));var rimraf=require(_0x3069('0x7'));var config=require('../../config/environment');var attributes=require(_0x3069('0x8'));module[_0x3069('0x9')]=function(_0x143d65,_0x224095){return _0x143d65[_0x3069('0xa')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0xeb0c=['api','bluebird','request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','../../config/logger'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xeb0c,0x1de));var _0xceb0=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xeb0c[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require(_0xceb0('0x0'));var util=require('util');var logger=require(_0xceb0('0x1'))(_0xceb0('0x2'));var moment=require('moment');var BPromise=require(_0xceb0('0x3'));var rp=require(_0xceb0('0x4'));var fs=require('fs');var path=require(_0xceb0('0x5'));var rimraf=require('rimraf');var config=require(_0xceb0('0x6'));var attributes=require(_0xceb0('0x7'));module[_0xceb0('0x8')]=function(_0x333b1f,_0x1334b4){return _0x333b1f[_0xceb0('0x9')](_0xceb0('0xa'),attributes,{'tableName':_0xceb0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index ab4fa58..1fb9941 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x3511b4,_0x1809c0){var _0x8650f8=function(_0x25f587){while(--_0x25f587){_0x3511b4['push'](_0x3511b4['shift']());}};_0x8650f8(++_0x1809c0);}(_0x9c44,0x178));var _0x49c4=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x9c44[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});}
\ No newline at end of file
+var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xb3d8e8,_0x455772){var _0x5f4d40=function(_0x5d04a8){while(--_0x5d04a8){_0xb3d8e8['push'](_0xb3d8e8['shift']());}};_0x5f4d40(++_0x455772);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}
\ No newline at end of file
index 0e89402..8161aa9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x45aa=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','/describe','/:id','/:id/users','getAgents','getTeams','post','create','addAgents','put','update','delete','removeAgents','/:id/teams','exports','util','path'];(function(_0x1f49d5,_0x178592){var _0x2fbcda=function(_0x41522e){while(--_0x41522e){_0x1f49d5['push'](_0x1f49d5['shift']());}};_0x2fbcda(++_0x178592);}(_0x45aa,0xdf));var _0xa45a=function(_0x22f88f,_0x7d7fbc){_0x22f88f=_0x22f88f-0x0;var _0x24d607=_0x45aa[_0x22f88f];return _0x24d607;};'use strict';var multer=require('multer');var util=require(_0xa45a('0x0'));var path=require(_0xa45a('0x1'));var timeout=require(_0xa45a('0x2'));var express=require(_0xa45a('0x3'));var router=express['Router']();var fs_extra=require(_0xa45a('0x4'));var auth=require(_0xa45a('0x5'));var interaction=require(_0xa45a('0x6'));var config=require(_0xa45a('0x7'));var controller=require(_0xa45a('0x8'));router[_0xa45a('0x9')]('/',auth[_0xa45a('0xa')](),controller['index']);router[_0xa45a('0x9')](_0xa45a('0xb'),auth[_0xa45a('0xa')](),controller['describe']);router[_0xa45a('0x9')](_0xa45a('0xc'),auth[_0xa45a('0xa')](),controller['show']);router[_0xa45a('0x9')](_0xa45a('0xd'),auth[_0xa45a('0xa')](),controller[_0xa45a('0xe')]);router['get']('/:id/teams',auth[_0xa45a('0xa')](),controller[_0xa45a('0xf')]);router[_0xa45a('0x10')]('/',auth[_0xa45a('0xa')](),controller[_0xa45a('0x11')]);router[_0xa45a('0x10')]('/:id/users',auth[_0xa45a('0xa')](),controller[_0xa45a('0x12')]);router[_0xa45a('0x10')]('/:id/teams',auth[_0xa45a('0xa')](),controller['addTeams']);router[_0xa45a('0x13')]('/:id',auth[_0xa45a('0xa')](),controller[_0xa45a('0x14')]);router[_0xa45a('0x15')]('/:id',auth[_0xa45a('0xa')](),controller['destroy']);router[_0xa45a('0x15')]('/:id/users',auth[_0xa45a('0xa')](),controller[_0xa45a('0x16')]);router[_0xa45a('0x15')](_0xa45a('0x17'),auth[_0xa45a('0xa')](),controller['removeTeams']);module[_0xa45a('0x18')]=router;
\ No newline at end of file
+var _0x6d6f=['post','create','addAgents','put','update','removeAgents','delete','removeTeams','exports','connect-timeout','express','Router','../../components/auth/service','./voicePrefix.controller','isAuthenticated','get','/:id','show','/:id/users','/:id/teams','getTeams'];(function(_0xe04198,_0x1bd4ab){var _0x1a9526=function(_0x162988){while(--_0x162988){_0xe04198['push'](_0xe04198['shift']());}};_0x1a9526(++_0x1bd4ab);}(_0x6d6f,0x159));var _0xf6d6=function(_0x17bb31,_0x2fc6f8){_0x17bb31=_0x17bb31-0x0;var _0x505c71=_0x6d6f[_0x17bb31];return _0x505c71;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf6d6('0x0'));var express=require(_0xf6d6('0x1'));var router=express[_0xf6d6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xf6d6('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf6d6('0x4'));router['get']('/',auth[_0xf6d6('0x5')](),controller['index']);router['get']('/describe',auth[_0xf6d6('0x5')](),controller['describe']);router[_0xf6d6('0x6')](_0xf6d6('0x7'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x8')]);router[_0xf6d6('0x6')](_0xf6d6('0x9'),auth[_0xf6d6('0x5')](),controller['getAgents']);router[_0xf6d6('0x6')](_0xf6d6('0xa'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0xb')]);router[_0xf6d6('0xc')]('/',auth['isAuthenticated'](),controller[_0xf6d6('0xd')]);router['post']('/:id/users',auth[_0xf6d6('0x5')](),controller[_0xf6d6('0xe')]);router[_0xf6d6('0xc')](_0xf6d6('0xa'),auth['isAuthenticated'](),controller['addTeams']);router[_0xf6d6('0xf')](_0xf6d6('0x7'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x10')]);router['delete'](_0xf6d6('0x7'),auth[_0xf6d6('0x5')](),controller['destroy']);router['delete']('/:id/users',auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x11')]);router[_0xf6d6('0x12')](_0xf6d6('0xa'),auth[_0xf6d6('0x5')](),controller[_0xf6d6('0x13')]);module[_0xf6d6('0x14')]=router;
\ No newline at end of file
index 5673366..10a8e3b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa7f=['INTEGER','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x367df9,_0x53f8ef){var _0x5ed608=function(_0x410339){while(--_0x410339){_0x367df9['push'](_0x367df9['shift']());}};_0x5ed608(++_0x53f8ef);}(_0xaa7f,0xbe));var _0xfaa7=function(_0x349a4c,_0x3dc8f7){_0x349a4c=_0x349a4c-0x0;var _0x313068=_0xaa7f[_0x349a4c];return _0x313068;};'use strict';var Sequelize=require(_0xfaa7('0x0'));module[_0xfaa7('0x1')]={'name':{'type':Sequelize[_0xfaa7('0x2')],'allowNull':![],'unique':_0xfaa7('0x3')},'prefix':{'type':Sequelize[_0xfaa7('0x4')],'get':function(_0x5ef8e7){return _0xfaa7('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0xfaa7('0x2')]},'callerIdAll':{'type':Sequelize[_0xfaa7('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0xfaa7('0x6')]}};
\ No newline at end of file
+var _0x8db3=['getDataValue','exports','STRING','VIRTUAL','system-'];(function(_0xbc1bfb,_0x552523){var _0x37954d=function(_0x5ebafb){while(--_0x5ebafb){_0xbc1bfb['push'](_0xbc1bfb['shift']());}};_0x37954d(++_0x552523);}(_0x8db3,0x13c));var _0x38db=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x8db3[_0x376b45];return _0x2341b3;};'use strict';var Sequelize=require('sequelize');module[_0x38db('0x0')]={'name':{'type':Sequelize[_0x38db('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x38db('0x2')],'get':function(_0x4e4d69){return _0x38db('0x3')+this[_0x38db('0x4')]('name')+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x38db('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index 8a990a5..5cac0e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x1c9a,0x98));var _0xa1c9=function(_0x56ede9,_0x4cfe84){_0x56ede9=_0x56ede9-0x0;var _0x576a1f=_0x1c9a[_0x56ede9];return _0x576a1f;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));};
\ No newline at end of file
+var _0x8f59=['../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','includeAll','find','describe','create','sequelize','transaction','body','VoiceExtensionId','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','priority','appdata','VoicePrefixId','VoiceExtension','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','params','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','pick','Team','getTeams','Agents','online','voicePause','interface','flatMap','addTeams','each','TeamVoicePrefix','upsert','findOrCreate','forEach','removeTeams','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','TeamId','includes','compact','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service'];(function(_0x47d80a,_0x420364){var _0x43405b=function(_0x22ce2b){while(--_0x22ce2b){_0x47d80a['push'](_0x47d80a['shift']());}};_0x43405b(++_0x420364);}(_0x8f59,0x11d));var _0x98f5=function(_0x4d9a93,_0x547671){_0x4d9a93=_0x4d9a93-0x0;var _0xe200a0=_0x8f59[_0x4d9a93];return _0xe200a0;};'use strict';var emlformat=require(_0x98f5('0x0'));var rimraf=require(_0x98f5('0x1'));var zipdir=require(_0x98f5('0x2'));var jsonpatch=require(_0x98f5('0x3'));var rp=require(_0x98f5('0x4'));var moment=require(_0x98f5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x98f5('0x6'));var util=require(_0x98f5('0x7'));var path=require(_0x98f5('0x8'));var sox=require(_0x98f5('0x9'));var csv=require('to-csv');var ejs=require(_0x98f5('0xa'));var fs=require('fs');var fs_extra=require(_0x98f5('0xb'));var _=require(_0x98f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x98f5('0xd'));var deskjs=require(_0x98f5('0xe'));var toCsv=require(_0x98f5('0xf'));var querystring=require('querystring');var Papa=require(_0x98f5('0x10'));var Redis=require(_0x98f5('0x11'));var authService=require(_0x98f5('0x12'));var qs=require(_0x98f5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x98f5('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x98f5('0x15'));var config=require(_0x98f5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x98f5('0x17'))['db'];config[_0x98f5('0x18')]=_[_0x98f5('0x19')](config[_0x98f5('0x18')],{'host':_0x98f5('0x1a'),'port':0x18eb});var socket=require(_0x98f5('0x1b'))(new Redis(config['redis']));require(_0x98f5('0x1c'))[_0x98f5('0x1d')](socket);function respondWithStatusCode(_0x5b8bab,_0x9df84){_0x9df84=_0x9df84||0xcc;return function(_0x3d6b5c){if(_0x3d6b5c){return _0x5b8bab[_0x98f5('0x1e')](_0x9df84);}return _0x5b8bab['status'](_0x9df84)[_0x98f5('0x1f')]();};}function respondWithResult(_0xc7a49b,_0x113545){_0x113545=_0x113545||0xc8;return function(_0x5bb486){if(_0x5bb486){return _0xc7a49b[_0x98f5('0x20')](_0x113545)[_0x98f5('0x21')](_0x5bb486);}};}function respondWithFilteredResult(_0x574644,_0x1df52d){return function(_0x51a567){if(_0x51a567){var _0x10c57c=typeof _0x1df52d[_0x98f5('0x22')]===_0x98f5('0x23')&&typeof _0x1df52d[_0x98f5('0x24')]===_0x98f5('0x23');var _0xa4477c=_0x51a567['count'];var _0xf88f34=_0x10c57c?0x0:_0x1df52d['offset'];var _0xd1209d=_0x10c57c?_0x51a567[_0x98f5('0x25')]:_0x1df52d['offset']+_0x1df52d[_0x98f5('0x24')];var _0x2933d1;if(_0xd1209d>=_0xa4477c){_0xd1209d=_0xa4477c;_0x2933d1=0xc8;}else{_0x2933d1=0xce;}_0x574644[_0x98f5('0x20')](_0x2933d1);return _0x574644[_0x98f5('0x26')](_0x98f5('0x27'),_0xf88f34+'-'+_0xd1209d+'/'+_0xa4477c)[_0x98f5('0x21')](_0x51a567);}return null;};}function patchUpdates(_0x38b46d){return function(_0x5ac2b7){try{jsonpatch[_0x98f5('0x28')](_0x5ac2b7,_0x38b46d,!![]);}catch(_0x49ee4e){return BPromise[_0x98f5('0x29')](_0x49ee4e);}return _0x5ac2b7['save']();};}function saveUpdates(_0x44bfbb,_0x40c69b){return function(_0x106b24){if(_0x106b24){return _0x106b24[_0x98f5('0x2a')](_0x44bfbb)[_0x98f5('0x2b')](function(_0x18052d){return _0x18052d;});}return null;};}function removeEntity(_0x46dbd4,_0x58d506){return function(_0x27a533){if(_0x27a533){return _0x27a533[_0x98f5('0x2c')]()['then'](function(){var _0x1a1c55=_0x27a533[_0x98f5('0x2d')]({'plain':!![]});var _0x5b08c2=_0x98f5('0x2e');return db[_0x98f5('0x2f')][_0x98f5('0x2c')]({'where':{'type':_0x5b08c2,'resourceId':_0x1a1c55['id']}})[_0x98f5('0x2b')](function(){return _0x27a533;});})[_0x98f5('0x2b')](function(){_0x46dbd4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x428c85,_0x71661e){return function(_0x18bb29){if(!_0x18bb29){_0x428c85[_0x98f5('0x1e')](0x194);}return _0x18bb29;};}function handleError(_0x15bf92,_0x1ae531){_0x1ae531=_0x1ae531||0x1f4;return function(_0x5e9d73){logger[_0x98f5('0x30')](_0x5e9d73[_0x98f5('0x31')]);if(_0x5e9d73[_0x98f5('0x32')]){delete _0x5e9d73[_0x98f5('0x32')];}_0x15bf92[_0x98f5('0x20')](_0x1ae531)[_0x98f5('0x33')](_0x5e9d73);};}exports['index']=function(_0x1e7027,_0x4d4b5c){var _0x229495={},_0x1e193c={},_0x492771={'count':0x0,'rows':[]};var _0x45ca95=_[_0x98f5('0x34')](db[_0x98f5('0x35')][_0x98f5('0x36')],function(_0x45e55c){return{'name':_0x45e55c[_0x98f5('0x37')],'type':_0x45e55c[_0x98f5('0x38')][_0x98f5('0x39')]};});_0x1e193c[_0x98f5('0x3a')]=_[_0x98f5('0x34')](_0x45ca95,_0x98f5('0x32'));_0x1e193c[_0x98f5('0x3b')]=_[_0x98f5('0x3c')](_0x1e7027[_0x98f5('0x3b')]);_0x1e193c[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x1e193c[_0x98f5('0x3a')],_0x1e193c[_0x98f5('0x3b')]);_0x229495[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x1e193c['model'],qs[_0x98f5('0x40')](_0x1e7027['query']['fields']));_0x229495[_0x98f5('0x3f')]=_0x229495[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x229495[_0x98f5('0x3f')]:_0x1e193c['model'];if(!_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x42')](_0x98f5('0x43'))){_0x229495['limit']=qs[_0x98f5('0x24')](_0x1e7027[_0x98f5('0x3b')]['limit']);_0x229495[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x1e7027[_0x98f5('0x3b')]['offset']);}_0x229495[_0x98f5('0x44')]=qs[_0x98f5('0x45')](_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x229495[_0x98f5('0x46')]=qs['filters'](_['pick'](_0x1e7027[_0x98f5('0x3b')],_0x1e193c[_0x98f5('0x3d')]),_0x45ca95);if(_0x1e7027[_0x98f5('0x3b')][_0x98f5('0x47')]){_0x229495[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x229495['where'],{'$or':_['map'](_0x45ca95,function(_0x3f6394){if(_0x3f6394[_0x98f5('0x38')]!==_0x98f5('0x49')){var _0x2f9638={};_0x2f9638[_0x3f6394['name']]={'$like':'%'+_0x1e7027['query'][_0x98f5('0x47')]+'%'};return _0x2f9638;}})});}_0x229495=_[_0x98f5('0x48')]({},_0x229495,_0x1e7027[_0x98f5('0x4a')]);var _0x110aa7={'where':_0x229495['where']};return db['VoicePrefix'][_0x98f5('0x25')](_0x110aa7)[_0x98f5('0x2b')](function(_0x372c33){_0x492771['count']=_0x372c33;if(_0x1e7027[_0x98f5('0x3b')]['includeAll']){_0x229495[_0x98f5('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0x98f5('0x4c')](_0x229495);})[_0x98f5('0x2b')](function(_0x1b8d40){_0x492771['rows']=_0x1b8d40;return _0x492771;})[_0x98f5('0x2b')](respondWithFilteredResult(_0x4d4b5c,_0x229495))[_0x98f5('0x4d')](handleError(_0x4d4b5c,null));};exports['show']=function(_0x3b5dee,_0xd27e7c){var _0x5ed787={'raw':![],'where':{'id':_0x3b5dee['params']['id']}},_0x42ec3e={};_0x42ec3e[_0x98f5('0x3a')]=_[_0x98f5('0x3c')](db['VoicePrefix']['rawAttributes']);_0x42ec3e['query']=_['keys'](_0x3b5dee[_0x98f5('0x3b')]);_0x42ec3e['filters']=_[_0x98f5('0x3e')](_0x42ec3e[_0x98f5('0x3a')],_0x42ec3e[_0x98f5('0x3b')]);_0x5ed787[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x42ec3e[_0x98f5('0x3a')],qs['fields'](_0x3b5dee[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x5ed787[_0x98f5('0x3f')]=_0x5ed787[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x5ed787[_0x98f5('0x3f')]:_0x42ec3e['model'];if(_0x3b5dee[_0x98f5('0x3b')][_0x98f5('0x4e')]){_0x5ed787[_0x98f5('0x4b')]=[{'all':!![]}];}_0x5ed787=_[_0x98f5('0x48')]({},_0x5ed787,_0x3b5dee['options']);return db[_0x98f5('0x35')][_0x98f5('0x4f')](_0x5ed787)[_0x98f5('0x2b')](handleEntityNotFound(_0xd27e7c,null))[_0x98f5('0x2b')](respondWithResult(_0xd27e7c,null))[_0x98f5('0x4d')](handleError(_0xd27e7c,null));};exports['destroy']=function(_0x8d7ebd,_0x254005){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x8d7ebd['params']['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x254005,null))['then'](removeEntity(_0x254005,null))[_0x98f5('0x4d')](handleError(_0x254005,null));};exports[_0x98f5('0x50')]=function(_0x3114a4,_0x5b495e){return db[_0x98f5('0x35')][_0x98f5('0x50')]()[_0x98f5('0x2b')](respondWithResult(_0x5b495e,null))[_0x98f5('0x4d')](handleError(_0x5b495e,null));};exports[_0x98f5('0x51')]=function(_0xf39073,_0x37e620){var _0x1891ac;return db[_0x98f5('0x52')][_0x98f5('0x53')](function(_0x50343c){return db[_0x98f5('0x35')][_0x98f5('0x51')](_0xf39073[_0x98f5('0x54')],{'transaction':_0x50343c})[_0x98f5('0x2b')](function(_0x1289a7){_0x1891ac=_0x1289a7[_0x98f5('0x2d')]({'plain':!![]});return db['VoiceExtension'][_0x98f5('0x4f')]({'where':{'id':_0x1891ac[_0x98f5('0x55')]},'raw':!![]})[_0x98f5('0x2b')](function(_0x4663f2){return createVoicePrefixExtensions(_0x1891ac,_0x4663f2,_0x50343c);});});})[_0x98f5('0x2b')](function(){var _0x15c514=_0xf39073['user']['get']({'plain':!![]});if(!_0x15c514)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15c514[_0x98f5('0x56')]===_0x98f5('0x57')){var _0x372c49=_0x1891ac;return db[_0x98f5('0x58')]['find']({'where':{'name':_0x98f5('0x2e'),'userProfileId':_0x15c514['userProfileId']},'raw':!![]})[_0x98f5('0x2b')](function(_0x583be6){if(_0x583be6&&_0x583be6['autoAssociation']===0x0){return db[_0x98f5('0x2f')][_0x98f5('0x51')]({'name':_0x372c49[_0x98f5('0x32')],'resourceId':_0x372c49['id'],'type':_0x583be6['name'],'sectionId':_0x583be6['id']},{})['then'](function(){return _0x1891ac;});}else{return _0x1891ac;}})[_0x98f5('0x4d')](function(_0x139ca3){logger['error'](_0x98f5('0x59'),_0x139ca3);throw _0x139ca3;});}return _0x1891ac;})[_0x98f5('0x2b')](respondWithResult(_0x37e620,null))['catch'](handleError(_0x37e620,null));};function Extension(_0x400f32,_0x974509,_0x8e6975,_0x53249f){this[_0x98f5('0x5a')]=_0x98f5('0x5b');this[_0x98f5('0x5c')]=_0x400f32;this[_0x98f5('0x5d')]=_0x8e6975;this[_0x98f5('0x38')]=_0x98f5('0x5e');this[_0x98f5('0x5f')]='Voice\x20Prefix\x20Extension';this[_0x98f5('0x60')]=_0x974509;this[_0x98f5('0x61')]=_0x53249f;}function createVoicePrefixExtensions(_0x3f2da8,_0x58041d,_0x577552){return new BPromise(function(_0x43b8de,_0x43edfc){var _0x5ae48c=new Extension(formatPrefixName(_0x3f2da8['prefix']),0x1,'NoOp','Voice\x20Prefix');_0x5ae48c[_0x98f5('0x62')]=_0x3f2da8['id'];return db['VoiceExtension'][_0x98f5('0x51')](_0x5ae48c,{'transaction':_0x577552})[_0x98f5('0x2b')](function(_0x44149f){var _0x368567=_0x44149f[_0x98f5('0x2d')]({'plain':!![]});var _0x26cc86=_[_0x98f5('0x34')](addVoicePrefixExtensions(_0x3f2da8,_0x58041d),function(_0x9758e8){_0x9758e8['VoiceExtensionId']=_0x368567['id'];_0x9758e8['VoicePrefixId']=_0x3f2da8['id'];return _0x9758e8;});return db[_0x98f5('0x63')]['bulkCreate'](_0x26cc86,{'transaction':_0x577552})[_0x98f5('0x2b')](function(_0x4ae63d){if(!_0x4ae63d){return _0x43edfc(_0x98f5('0x64'));}else{return _0x43b8de(_0x4ae63d);}})['catch'](function(_0x1cd03f){return _0x43edfc(_0x1cd03f);});});;});};function addVoicePrefixExtensions(_0x56b308,_0x4a1de1){var _0x595aee=[];var _0x2d9cd8=formatPrefixName(_0x56b308['prefix']);_0x595aee[_0x98f5('0x65')](new Extension(_0x2d9cd8,0x2,_0x98f5('0x66'),_0x98f5('0x67')+_0x56b308['name']));if(_0x56b308['callerIdAll']){_0x595aee['push'](new Extension(_0x2d9cd8,0x3,_0x98f5('0x66'),_0x98f5('0x68')+_0x56b308['callerIdAll']));}else{_0x595aee['push'](new Extension(_0x2d9cd8,0x3,_0x98f5('0x69'),_0x98f5('0x6a')));}_0x595aee[_0x98f5('0x65')](new Extension(_0x2d9cd8,0x4,_0x98f5('0x6b'),_0x4a1de1[_0x98f5('0x5a')]+','+_0x98f5('0x6c')+(0x8+_0x56b308[_0x98f5('0x32')][_0x98f5('0x41')])+'}'+','+0x1));return _0x595aee;}function formatPrefixName(_0x139d2c){var _0x4fc5d6='_';for(var _0x35e965=0x0;_0x35e965<_0x139d2c[_0x98f5('0x41')];_0x35e965++){if(_0x139d2c[_0x98f5('0x6d')](_0x35e965)=='-'){_0x4fc5d6+=_0x139d2c[_0x98f5('0x6d')](_0x35e965);}else{_0x4fc5d6+='['+_0x139d2c['charAt'](_0x35e965)+']';}}_0x4fc5d6+='.';return _0x4fc5d6;}exports[_0x98f5('0x2a')]=function(_0x48b175,_0x42c7a6,_0x5760b3){var _0x1d54d8=_0x48b175[_0x98f5('0x54')];_0x1d54d8['prefix']=_0x98f5('0x6e')+_0x1d54d8[_0x98f5('0x32')]+'-';return db[_0x98f5('0x52')]['transaction'](function(_0x45413e){return db[_0x98f5('0x35')][_0x98f5('0x2a')](_0x1d54d8,{'where':{'id':_0x1d54d8['id']},'transaction':_0x45413e})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x63')][_0x98f5('0x2c')]({'where':{'VoicePrefixId':_0x1d54d8['id']},'transaction':_0x45413e})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x63')][_0x98f5('0x4f')]({'where':{'id':_0x1d54d8['VoiceExtensionId']},'raw':!![]})[_0x98f5('0x2b')](function(_0x486ff6){return createVoicePrefixExtensions(_0x1d54d8,_0x486ff6,_0x45413e);});});});})[_0x98f5('0x2b')](function(){return db[_0x98f5('0x35')][_0x98f5('0x6f')](_0x1d54d8['id']);})[_0x98f5('0x2b')](respondWithResult(_0x42c7a6,null))['catch'](handleError(_0x42c7a6,null));};exports[_0x98f5('0x70')]=function(_0x23bf5f,_0x57b9c1,_0x540c00){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x23bf5f[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x57b9c1,null))[_0x98f5('0x2b')](function(_0x5427a3){if(_0x5427a3){return _0x5427a3['addAgents'](_0x23bf5f[_0x98f5('0x54')][_0x98f5('0x72')],_['omit'](_0x23bf5f[_0x98f5('0x54')],[_0x98f5('0x72'),'id'])||{})[_0x98f5('0x73')](function(_0x28aa43){for(var _0x258ee7=0x0;_0x258ee7<_0x23bf5f[_0x98f5('0x54')][_0x98f5('0x72')][_0x98f5('0x41')];_0x258ee7+=0x1){socket[_0x98f5('0x74')](_0x98f5('0x75'),{'UserId':Number(_0x23bf5f[_0x98f5('0x54')]['ids'][_0x258ee7]),'VoicePrefixId':Number(_0x23bf5f['params']['id'])});}return _0x28aa43;});}})[_0x98f5('0x2b')](respondWithResult(_0x57b9c1,null))[_0x98f5('0x4d')](handleError(_0x57b9c1,null));};exports[_0x98f5('0x76')]=function(_0x54c7f9,_0x28d910,_0x3303d4){return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x54c7f9[_0x98f5('0x71')]['id']}})['then'](handleEntityNotFound(_0x28d910,null))['then'](function(_0x4dfef7){if(_0x4dfef7){return _0x4dfef7['removeAgents'](_0x54c7f9[_0x98f5('0x3b')][_0x98f5('0x72')])['then'](function(){if(_[_0x98f5('0x77')](_0x54c7f9[_0x98f5('0x3b')]['ids'])){for(var _0x2afe1d=0x0;_0x2afe1d<_0x54c7f9['query']['ids'][_0x98f5('0x41')];_0x2afe1d+=0x1){socket[_0x98f5('0x74')](_0x98f5('0x78'),{'UserId':Number(_0x54c7f9[_0x98f5('0x3b')]['ids'][_0x2afe1d]),'VoicePrefixId':Number(_0x54c7f9[_0x98f5('0x71')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x54c7f9['query'][_0x98f5('0x72')]),'VoicePrefixId':Number(_0x54c7f9[_0x98f5('0x71')]['id'])});}});}})[_0x98f5('0x2b')](respondWithStatusCode(_0x28d910,null))[_0x98f5('0x4d')](handleError(_0x28d910,null));};exports[_0x98f5('0x79')]=function(_0x3ab0dc,_0x36048c,_0x11e72a){var _0x1a3a76={};var _0x2aa9a4={};var _0x485a15;var _0x40b6fa;return db[_0x98f5('0x35')][_0x98f5('0x7a')]({'where':{'id':_0x3ab0dc[_0x98f5('0x71')]['id']}})['then'](handleEntityNotFound(_0x36048c,null))[_0x98f5('0x2b')](function(_0x1aba52){if(_0x1aba52){_0x485a15=_0x1aba52;_0x2aa9a4['model']=_[_0x98f5('0x3c')](db[_0x98f5('0x7b')][_0x98f5('0x36')]);_0x2aa9a4['query']=_[_0x98f5('0x3c')](_0x3ab0dc[_0x98f5('0x3b')]);_0x2aa9a4[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x2aa9a4[_0x98f5('0x3a')],_0x2aa9a4[_0x98f5('0x3b')]);_0x1a3a76['attributes']=_['intersection'](_0x2aa9a4[_0x98f5('0x3a')],qs[_0x98f5('0x40')](_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x1a3a76['attributes']=_0x1a3a76[_0x98f5('0x3f')][_0x98f5('0x41')]?_0x1a3a76['attributes']:_0x2aa9a4['model'];_0x1a3a76[_0x98f5('0x44')]=qs['sort'](_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x1a3a76[_0x98f5('0x46')]=qs['filters'](_[_0x98f5('0x7c')](_0x3ab0dc[_0x98f5('0x3b')],_0x2aa9a4['filters']));if(_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x47')]){_0x1a3a76[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x1a3a76['where'],{'$or':_['map'](_0x1a3a76[_0x98f5('0x3f')],function(_0x1e32f1){var _0x514dea={};_0x514dea[_0x1e32f1]={'$like':'%'+_0x3ab0dc[_0x98f5('0x3b')][_0x98f5('0x47')]+'%'};return _0x514dea;})});}_0x1a3a76=_[_0x98f5('0x48')]({},_0x1a3a76,_0x3ab0dc['options']);return _0x485a15[_0x98f5('0x79')](_0x1a3a76);}})[_0x98f5('0x2b')](function(_0x2de7e7){if(_0x2de7e7){_0x40b6fa=_0x2de7e7[_0x98f5('0x41')];if(!_0x3ab0dc['query'][_0x98f5('0x42')]('nolimit')){_0x1a3a76[_0x98f5('0x24')]=qs[_0x98f5('0x24')](_0x3ab0dc['query'][_0x98f5('0x24')]);_0x1a3a76[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x3ab0dc[_0x98f5('0x3b')]['offset']);}return _0x485a15[_0x98f5('0x79')](_0x1a3a76);}})['then'](function(_0x6c3951){if(_0x6c3951){return _0x6c3951?{'count':_0x40b6fa,'rows':_0x6c3951}:null;}})['then'](respondWithResult(_0x36048c,null))[_0x98f5('0x4d')](handleError(_0x36048c,null));};exports['getTeams']=function(_0x1ba9a2,_0x193cbb,_0x3a411f){var _0x1a04f6={};var _0x40eb2f={};var _0x421e3c;var _0x1e28b7;return db[_0x98f5('0x35')][_0x98f5('0x7a')]({'where':{'id':_0x1ba9a2[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](handleEntityNotFound(_0x193cbb,null))[_0x98f5('0x2b')](function(_0x5bec4f){if(_0x5bec4f){_0x421e3c=_0x5bec4f;_0x40eb2f['model']=_[_0x98f5('0x3c')](db[_0x98f5('0x7d')]['rawAttributes']);_0x40eb2f[_0x98f5('0x3b')]=_[_0x98f5('0x3c')](_0x1ba9a2[_0x98f5('0x3b')]);_0x40eb2f[_0x98f5('0x3d')]=_[_0x98f5('0x3e')](_0x40eb2f[_0x98f5('0x3a')],_0x40eb2f['query']);_0x1a04f6[_0x98f5('0x3f')]=_[_0x98f5('0x3e')](_0x40eb2f[_0x98f5('0x3a')],qs[_0x98f5('0x40')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x40')]));_0x1a04f6['attributes']=_0x1a04f6[_0x98f5('0x3f')]['length']?_0x1a04f6[_0x98f5('0x3f')]:_0x40eb2f[_0x98f5('0x3a')];_0x1a04f6[_0x98f5('0x44')]=qs[_0x98f5('0x45')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x45')]);_0x1a04f6[_0x98f5('0x46')]=qs[_0x98f5('0x3d')](_['pick'](_0x1ba9a2['query'],_0x40eb2f[_0x98f5('0x3d')]));if(_0x1ba9a2['query'][_0x98f5('0x47')]){_0x1a04f6[_0x98f5('0x46')]=_[_0x98f5('0x48')](_0x1a04f6['where'],{'$or':_['map'](_0x1a04f6['attributes'],function(_0x20cbaf){var _0x45779d={};_0x45779d[_0x20cbaf]={'$like':'%'+_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x47')]+'%'};return _0x45779d;})});}_0x1a04f6=_[_0x98f5('0x48')]({},_0x1a04f6,_0x1ba9a2['options']);return _0x421e3c[_0x98f5('0x7e')](_0x1a04f6);}})[_0x98f5('0x2b')](function(_0x163f7e){if(_0x163f7e){_0x1e28b7=_0x163f7e[_0x98f5('0x41')];if(!_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x42')](_0x98f5('0x43'))){_0x1a04f6[_0x98f5('0x24')]=qs[_0x98f5('0x24')](_0x1ba9a2[_0x98f5('0x3b')]['limit']);_0x1a04f6[_0x98f5('0x22')]=qs[_0x98f5('0x22')](_0x1ba9a2[_0x98f5('0x3b')][_0x98f5('0x22')]);}return _0x421e3c[_0x98f5('0x7e')](_0x1a04f6);}})['then'](function(_0x3af4fc){if(_0x3af4fc){return _0x3af4fc?{'count':_0x1e28b7,'rows':_0x3af4fc}:null;}})[_0x98f5('0x2b')](respondWithResult(_0x193cbb,null))[_0x98f5('0x4d')](handleError(_0x193cbb,null));};exports['addTeams']=function(_0x87ae6,_0x14a01b,_0x31282d){var _0x2e85ad=_0x87ae6[_0x98f5('0x54')][_0x98f5('0x72')];var _0x2a983e;return db[_0x98f5('0x7d')][_0x98f5('0x4c')]({'where':{'id':_0x2e85ad},'attributes':['id'],'include':[{'model':db['User'],'as':_0x98f5('0x7f'),'attributes':['id','name',_0x98f5('0x80'),_0x98f5('0x81'),_0x98f5('0x82')],'raw':!![]}]})[_0x98f5('0x2b')](function(_0x1f90ce){if(_0x1f90ce){_0x2a983e=_0x1f90ce;var _0x2bf55c=_[_0x98f5('0x83')](_0x1f90ce,function(_0x54eb1d){var _0x1aa66f=_0x54eb1d[_0x98f5('0x2d')]({'plain':!![]});return _0x1aa66f[_0x98f5('0x7f')];});return db['VoicePrefix'][_0x98f5('0x4f')]({'where':{'id':_0x87ae6[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](function(_0x37a1a7){return db[_0x98f5('0x52')][_0x98f5('0x53')](function(_0x55de57){return _0x37a1a7[_0x98f5('0x84')](_0x2e85ad,{'transaction':_0x55de57})[_0x98f5('0x2b')](function(){return BPromise[_0x98f5('0x85')](_0x2a983e,function(_0x462498){return db[_0x98f5('0x86')][_0x98f5('0x87')]({'TeamId':_0x462498['id'],'VoicePrefixId':_0x87ae6[_0x98f5('0x71')]['id']},{'transaction':_0x55de57});});})[_0x98f5('0x2b')](function(){return BPromise[_0x98f5('0x85')](_0x2bf55c,function(_0x2adc96){return db['UserVoicePrefix'][_0x98f5('0x88')]({'where':{'UserId':_0x2adc96['id'],'VoicePrefixId':_0x87ae6[_0x98f5('0x71')]['id']},'transaction':_0x55de57});});})[_0x98f5('0x2b')](function(){_0x2bf55c[_0x98f5('0x89')](function(_0x4c06c3){socket[_0x98f5('0x74')](_0x98f5('0x75'),{'UserId':_0x4c06c3['id'],'VoicePrefixId':_0x37a1a7['id']});});});});});}})[_0x98f5('0x2b')](respondWithStatusCode(_0x14a01b,null))['catch'](handleError(_0x14a01b,null));};exports[_0x98f5('0x8a')]=function(_0x29f1af,_0x165c5c,_0x401ec7){return db[_0x98f5('0x7d')]['findAll']({'where':{'id':_0x29f1af['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x98f5('0x7f'),'attributes':['id'],'raw':!![]}]})[_0x98f5('0x2b')](handleEntityNotFound(_0x165c5c,null))['then'](function(_0x55edfd){var _0x339388=_[_0x98f5('0x34')](_0x55edfd,'id');var _0x1f1e6c=[];var _0x22009b=[];var _0x269fe1=squel['select']();_0x269fe1['field'](_0x98f5('0x8b'))[_0x98f5('0x8c')](_0x98f5('0x8d'),'tq')['join'](_0x98f5('0x8e'),'ut',_0x98f5('0x8f'))['where']('VoicePrefixId\x20=\x20?',_0x29f1af[_0x98f5('0x71')]['id']);for(var _0x4a8f92=0x0;_0x4a8f92<_0x55edfd['length'];_0x4a8f92+=0x1){let _0x20b788=_0x55edfd[_0x4a8f92];for(var _0x1743a8=0x0;_0x1743a8<_0x20b788[_0x98f5('0x7f')][_0x98f5('0x41')];_0x1743a8+=0x1){let _0x18bb66=_0x20b788[_0x98f5('0x7f')][_0x1743a8];var _0x1f1b89=_0x269fe1['clone']();_0x1f1b89[_0x98f5('0x46')](_0x98f5('0x90'),_0x18bb66['id']);_0x22009b[_0x98f5('0x65')](db[_0x98f5('0x52')]['query'](_0x1f1b89[_0x98f5('0x91')](),{'type':db[_0x98f5('0x52')][_0x98f5('0x92')][_0x98f5('0x93')]})[_0x98f5('0x2b')](function(_0x10d7d0){if(_0x10d7d0[_0x98f5('0x41')]===0x1){return _0x18bb66['id'];}else{var _0x4cc03e=_['every'](_[_0x98f5('0x34')](_0x10d7d0,_0x98f5('0x94')),function(_0x1068ff){return _[_0x98f5('0x95')](_0x339388,_0x1068ff);});if(_0x4cc03e){return _0x18bb66['id'];}}}));}}return BPromise['all'](_0x22009b)['then'](function(_0x2ddef8){_0x1f1e6c=_(_0x1f1e6c)['union'](_0x2ddef8)[_0x98f5('0x96')]()[_0x98f5('0x97')]();return db[_0x98f5('0x35')][_0x98f5('0x4f')]({'where':{'id':_0x29f1af[_0x98f5('0x71')]['id']}})[_0x98f5('0x2b')](function(_0x1d1949){return db['sequelize'][_0x98f5('0x53')](function(_0x2391f1){return _0x1d1949['removeTeams'](_0x29f1af[_0x98f5('0x3b')][_0x98f5('0x72')],{'transaction':_0x2391f1})[_0x98f5('0x2b')](function(){if(!_['isEmpty'](_0x1f1e6c)){return _0x1d1949['removeAgents'](_0x1f1e6c,{'transaction':_0x2391f1});}})[_0x98f5('0x2b')](function(){_0x1f1e6c[_0x98f5('0x89')](function(_0x4de795){socket['emit'](_0x98f5('0x78'),{'UserId':_0x4de795,'VoicePrefixId':_0x1d1949['id']});});});});});});})[_0x98f5('0x2b')](respondWithStatusCode(_0x165c5c,null))[_0x98f5('0x4d')](handleError(_0x165c5c,null));};
\ No newline at end of file
index a7ce55b..b6b259c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1bc0=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','save','update','remove'];(function(_0x5bd6d2,_0x112676){var _0x3ae319=function(_0x20714d){while(--_0x20714d){_0x5bd6d2['push'](_0x5bd6d2['shift']());}};_0x3ae319(++_0x112676);}(_0x1bc0,0xed));var _0x01bc=function(_0x9a7c0a,_0x5b1d12){_0x9a7c0a=_0x9a7c0a-0x0;var _0x3f404b=_0x1bc0[_0x9a7c0a];return _0x3f404b;};'use strict';var EventEmitter=require(_0x01bc('0x0'));var VoicePrefix=require(_0x01bc('0x1'))['db'][_0x01bc('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x01bc('0x3'),'afterUpdate':_0x01bc('0x4'),'afterDestroy':_0x01bc('0x5')};function emitEvent(_0x464c99){return function(_0x117578,_0x5e47aa,_0x560bcf){VoicePrefixEvents['emit'](_0x464c99+':'+_0x117578['id'],_0x117578);VoicePrefixEvents[_0x01bc('0x6')](_0x464c99,_0x117578);_0x560bcf(null);};}for(var e in events){if(events[_0x01bc('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0x01bc('0x8')]=VoicePrefixEvents;
\ No newline at end of file
+var _0x3d4e=['exports','events','VoicePrefix','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x481da5,_0x288957){var _0x2ba6e2=function(_0x445454){while(--_0x445454){_0x481da5['push'](_0x481da5['shift']());}};_0x2ba6e2(++_0x288957);}(_0x3d4e,0x160));var _0xe3d4=function(_0x46de37,_0x4ceaea){_0x46de37=_0x46de37-0x0;var _0x5c6aae=_0x3d4e[_0x46de37];return _0x5c6aae;};'use strict';var EventEmitter=require(_0xe3d4('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xe3d4('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe3d4('0x2')](0x0);var events={'afterCreate':_0xe3d4('0x3'),'afterUpdate':_0xe3d4('0x4'),'afterDestroy':'remove'};function emitEvent(_0x256640){return function(_0x9ac433,_0x2c5439,_0xfeadbc){VoicePrefixEvents[_0xe3d4('0x5')](_0x256640+':'+_0x9ac433['id'],_0x9ac433);VoicePrefixEvents['emit'](_0x256640,_0x9ac433);_0xfeadbc(null);};}for(var e in events){if(events[_0xe3d4('0x6')](e)){var event=events[e];VoicePrefix[_0xe3d4('0x7')](e,emitEvent(event));}}module[_0xe3d4('0x8')]=VoicePrefixEvents;
\ No newline at end of file
index 3c67358..9ab1891 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a71=['voice_prefixes','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x6a71,0x169));var _0x16a7=function(_0x54e718,_0x171432){_0x54e718=_0x54e718-0x0;var _0x1e3c8f=_0x6a71[_0x54e718];return _0x1e3c8f;};'use strict';var _=require(_0x16a7('0x0'));var util=require(_0x16a7('0x1'));var logger=require(_0x16a7('0x2'))('api');var moment=require(_0x16a7('0x3'));var BPromise=require('bluebird');var rp=require(_0x16a7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x16a7('0x5'));var config=require(_0x16a7('0x6'));var attributes=require(_0x16a7('0x7'));module[_0x16a7('0x8')]=function(_0x4170d8,_0x165592){return _0x4170d8[_0x16a7('0x9')](_0x16a7('0xa'),attributes,{'tableName':_0x16a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x7fa8=['define','VoicePrefix','lodash','util','api','moment','request-promise','path','../../config/environment','./voicePrefix.attributes','exports'];(function(_0x5945fa,_0x5b286c){var _0x367090=function(_0x4cadd1){while(--_0x4cadd1){_0x5945fa['push'](_0x5945fa['shift']());}};_0x367090(++_0x5b286c);}(_0x7fa8,0xbd));var _0x87fa=function(_0x3c2407,_0x3c9a47){_0x3c2407=_0x3c2407-0x0;var _0x5d2eac=_0x7fa8[_0x3c2407];return _0x5d2eac;};'use strict';var _=require(_0x87fa('0x0'));var util=require(_0x87fa('0x1'));var logger=require('../../config/logger')(_0x87fa('0x2'));var moment=require(_0x87fa('0x3'));var BPromise=require('bluebird');var rp=require(_0x87fa('0x4'));var fs=require('fs');var path=require(_0x87fa('0x5'));var rimraf=require('rimraf');var config=require(_0x87fa('0x6'));var attributes=require(_0x87fa('0x7'));module[_0x87fa('0x8')]=function(_0x670ee6,_0x3e3ce6){return _0x670ee6[_0x87fa('0x9')](_0x87fa('0xa'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 5606d00..a84ed8f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe55d=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x2a608d,_0x298459){var _0x1bee3e=function(_0x989a39){while(--_0x989a39){_0x2a608d['push'](_0x2a608d['shift']());}};_0x1bee3e(++_0x298459);}(_0xe55d,0x126));var _0xde55=function(_0xda2ab6,_0x578bb9){_0xda2ab6=_0xda2ab6-0x0;var _0x34d48e=_0xe55d[_0xda2ab6];return _0x34d48e;};'use strict';var _=require(_0xde55('0x0'));var util=require(_0xde55('0x1'));var moment=require('moment');var BPromise=require(_0xde55('0x2'));var rs=require(_0xde55('0x3'));var fs=require('fs');var Redis=require(_0xde55('0x4'));var db=require(_0xde55('0x5'))['db'];var utils=require(_0xde55('0x6'));var logger=require(_0xde55('0x7'))('rpc');var config=require(_0xde55('0x8'));var jayson=require(_0xde55('0x9'));var client=jayson[_0xde55('0xa')]['http']({'port':0x232a});config[_0xde55('0xb')]=_[_0xde55('0xc')](config[_0xde55('0xb')],{'host':_0xde55('0xd'),'port':0x18eb});var socket=require(_0xde55('0xe'))(new Redis(config[_0xde55('0xb')]));require('./voicePrefix.socket')[_0xde55('0xf')](socket);function respondWithRpcPromise(_0x170817,_0x4cceb0,_0x4da24f){return new BPromise(function(_0x752d81,_0x1bb15b){return client['request'](_0x170817,_0x4da24f)[_0xde55('0x10')](function(_0x23edbf){logger['info'](_0xde55('0x11'),_0x4cceb0,_0xde55('0x12'));logger[_0xde55('0x13')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x4cceb0,_0xde55('0x12'),JSON[_0xde55('0x14')](_0x23edbf));if(_0x23edbf[_0xde55('0x15')]){if(_0x23edbf[_0xde55('0x15')][_0xde55('0x16')]===0x1f4){logger[_0xde55('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x4cceb0,_0x23edbf['error'][_0xde55('0x17')]);return _0x1bb15b(_0x23edbf[_0xde55('0x15')]['message']);}logger[_0xde55('0x15')](_0xde55('0x11'),_0x4cceb0,_0x23edbf[_0xde55('0x15')][_0xde55('0x17')]);return _0x752d81(_0x23edbf[_0xde55('0x15')][_0xde55('0x17')]);}else{logger[_0xde55('0x18')](_0xde55('0x11'),_0x4cceb0,_0xde55('0x12'));_0x752d81(_0x23edbf[_0xde55('0x19')][_0xde55('0x17')]);}})[_0xde55('0x1a')](function(_0x4605d0){logger['error'](_0xde55('0x11'),_0x4cceb0,_0x4605d0);_0x1bb15b(_0x4605d0);});});}
\ No newline at end of file
+var _0xa017=['jayson/promise','redis','defaults','register','request','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x11f893,_0x259935){var _0x400fa8=function(_0x25933b){while(--_0x25933b){_0x11f893['push'](_0x11f893['shift']());}};_0x400fa8(++_0x259935);}(_0xa017,0x1f1));var _0x7a01=function(_0x542c89,_0x449203){_0x542c89=_0x542c89-0x0;var _0xaa2a8a=_0xa017[_0x542c89];return _0xaa2a8a;};'use strict';var _=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var moment=require(_0x7a01('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a01('0x3'));var db=require(_0x7a01('0x4'))['db'];var utils=require(_0x7a01('0x5'));var logger=require(_0x7a01('0x6'))(_0x7a01('0x7'));var config=require(_0x7a01('0x8'));var jayson=require(_0x7a01('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x7a01('0xa')]=_[_0x7a01('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7a01('0xa')]));require('./voicePrefix.socket')[_0x7a01('0xc')](socket);function respondWithRpcPromise(_0x36e3f5,_0x639e05,_0x355d50){return new BPromise(function(_0x1cedf4,_0x32a982){return client[_0x7a01('0xd')](_0x36e3f5,_0x355d50)['then'](function(_0x124e89){logger['info'](_0x7a01('0xe'),_0x639e05,_0x7a01('0xf'));logger[_0x7a01('0x10')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x639e05,_0x7a01('0xf'),JSON[_0x7a01('0x11')](_0x124e89));if(_0x124e89[_0x7a01('0x12')]){if(_0x124e89[_0x7a01('0x12')][_0x7a01('0x13')]===0x1f4){logger[_0x7a01('0x12')](_0x7a01('0xe'),_0x639e05,_0x124e89[_0x7a01('0x12')][_0x7a01('0x14')]);return _0x32a982(_0x124e89[_0x7a01('0x12')][_0x7a01('0x14')]);}logger[_0x7a01('0x12')]('VoicePrefix,\x20%s,\x20%s',_0x639e05,_0x124e89['error']['message']);return _0x1cedf4(_0x124e89[_0x7a01('0x12')]['message']);}else{logger[_0x7a01('0x15')](_0x7a01('0xe'),_0x639e05,_0x7a01('0xf'));_0x1cedf4(_0x124e89['result'][_0x7a01('0x14')]);}})[_0x7a01('0x16')](function(_0x1f013c){logger['error'](_0x7a01('0xe'),_0x639e05,_0x1f013c);_0x32a982(_0x1f013c);});});}
\ No newline at end of file
index c457859..5170eba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd73a=['length','./voicePrefix.events','save','remove','update','emit','removeListener','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd73a,0x171));var _0xad73=function(_0x1982cc,_0x35cba2){_0x1982cc=_0x1982cc-0x0;var _0x322da9=_0xd73a[_0x1982cc];return _0x322da9;};'use strict';var VoicePrefixEvents=require(_0xad73('0x0'));var events=[_0xad73('0x1'),_0xad73('0x2'),_0xad73('0x3')];function createListener(_0x6da8ec,_0x59c24f){return function(_0x5048f2){_0x59c24f[_0xad73('0x4')](_0x6da8ec,_0x5048f2);};}function removeListener(_0x216563,_0x279d4f){return function(){VoicePrefixEvents[_0xad73('0x5')](_0x216563,_0x279d4f);};}exports[_0xad73('0x6')]=function(_0x7d2258){for(var _0x247d3c=0x0,_0x2f4736=events[_0xad73('0x7')];_0x247d3c<_0x2f4736;_0x247d3c++){var _0x15cf28=events[_0x247d3c];var _0x1352b3=createListener('voicePrefix:'+_0x15cf28,_0x7d2258);VoicePrefixEvents['on'](_0x15cf28,_0x1352b3);}};
\ No newline at end of file
+var _0x342e=['removeListener','register','./voicePrefix.events','save','remove'];(function(_0x29d87d,_0x23dc31){var _0x1fd84b=function(_0x4e2aa1){while(--_0x4e2aa1){_0x29d87d['push'](_0x29d87d['shift']());}};_0x1fd84b(++_0x23dc31);}(_0x342e,0xde));var _0xe342=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x342e[_0x55c00d];return _0x254a8f;};'use strict';var VoicePrefixEvents=require(_0xe342('0x0'));var events=[_0xe342('0x1'),_0xe342('0x2'),'update'];function createListener(_0x5d2113,_0x15d20f){return function(_0x4070d1){_0x15d20f['emit'](_0x5d2113,_0x4070d1);};}function removeListener(_0x509778,_0x349dc1){return function(){VoicePrefixEvents[_0xe342('0x3')](_0x509778,_0x349dc1);};}exports[_0xe342('0x4')]=function(_0x590e9){for(var _0x164e21=0x0,_0x5e643a=events['length'];_0x164e21<_0x5e643a;_0x164e21++){var _0x3457ac=events[_0x164e21];var _0x36bb18=createListener('voicePrefix:'+_0x3457ac,_0x590e9);VoicePrefixEvents['on'](_0x3457ac,_0x36bb18);}};
\ No newline at end of file
index c45319c..037923a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x2aac38,_0x4cf347){var _0x1992af=function(_0x837482){while(--_0x837482){_0x2aac38['push'](_0x2aac38['shift']());}};_0x1992af(++_0x4cf347);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router;
\ No newline at end of file
+var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x1e48d3,_0x5d8c43){var _0x2852b1=function(_0x11d7b3){while(--_0x11d7b3){_0x1e48d3['push'](_0x1e48d3['shift']());}};_0x2852b1(++_0x5d8c43);}(_0xb10b,0x12a));var _0xbb10=function(_0x1dabf0,_0xd6ec46){_0x1dabf0=_0x1dabf0-0x0;var _0x197431=_0xb10b[_0x1dabf0];return _0x197431;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router;
\ No newline at end of file
index 8319fc6..2626802 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa91b=['setDataValue','strategy','getDataValue','type','dialMethod','preview','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','split','joinempty','leavewhenempty','join','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','booked','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','STRING','name','inbound','outbound','default','ENUM','ringall','random','rrmemory','linear','rrordered'];(function(_0x464aa8,_0xc8d7be){var _0x14478f=function(_0x228c62){while(--_0x228c62){_0x464aa8['push'](_0x464aa8['shift']());}};_0x14478f(++_0xc8d7be);}(_0xa91b,0x1ce));var _0xba91=function(_0xf54078,_0x565b5c){_0xf54078=_0xf54078-0x0;var _0x1fcf49=_0xa91b[_0xf54078];return _0x1fcf49;};'use strict';var Sequelize=require(_0xba91('0x0'));module['exports']={'name':{'type':Sequelize[_0xba91('0x1')],'allowNull':![],'unique':_0xba91('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xba91('0x3'),_0xba91('0x4')),'allowNull':![],'defaultValue':_0xba91('0x3')},'musiconhold':{'type':Sequelize[_0xba91('0x1')],'defaultValue':_0xba91('0x5')},'announce':{'type':Sequelize[_0xba91('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0xba91('0x6')]('rr',_0xba91('0x7'),'leastrecent','fewestcalls',_0xba91('0x8'),_0xba91('0x9'),_0xba91('0xa'),'wrandom',_0xba91('0xb')),'allowNull':![],'defaultValue':_0xba91('0x7'),'set':function(_0x2ca345){this[_0xba91('0xc')](_0xba91('0xd'),_0x2ca345?_0x2ca345:_0xba91('0x9'));},'get':function(){var _0x1a5e60=this[_0xba91('0xe')](_0xba91('0xf'));var _0x11581e=this['getDataValue'](_0xba91('0x10'));var _0xd13374=this[_0xba91('0xe')]('strategy');if(_0x1a5e60===_0xba91('0x4')){if(_0x11581e===_0xba91('0x11')){return null;}if(_0x11581e==='booked'&&![_0xba91('0x9'),_0xba91('0x12')][_0xba91('0x13')](_0xd13374)){this[_0xba91('0xc')]('strategy',_0xba91('0x9'));}}return _0xd13374;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xba91('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xba91('0x14')](0xb)},'timeout':{'type':Sequelize[_0xba91('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xba91('0x1')]},'weight':{'type':Sequelize[_0xba91('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defaultValue':_0xba91('0x15')},'autopause':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no',_0xba91('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0xba91('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xba91('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xba91('0x6')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xba91('0x1')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xba91('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xba91('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xba91('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xba91('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defaultValue':_0xba91('0x15')},'announce_holdtime':{'type':Sequelize[_0xba91('0x6')]('yes','no',_0xba91('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0xba91('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xba91('0x6')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xba91('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xba91('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xba91('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xba91('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xba91('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xba91('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xba91('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xba91('0x1')]},'queue_quantity1':{'type':Sequelize[_0xba91('0x1')]},'queue_quantity2':{'type':Sequelize[_0xba91('0x1')]},'queue_periodic_announce':{'type':Sequelize[_0xba91('0x1')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0xba91('0x18')],'set':function(_0x378175){this[_0xba91('0xc')](_0xba91('0x19'),_0x378175?_0x378175['join'](','):[]);},'get':function(){return this[_0xba91('0xe')](_0xba91('0x19'))?this[_0xba91('0xe')](_0xba91('0x19'))[_0xba91('0x1a')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xba91('0x15'),'set':function(_0x4d1930){this[_0xba91('0xc')]('joinempty',_0x4d1930?_0x4d1930['join'](','):undefined);},'get':function(){return this[_0xba91('0xe')](_0xba91('0x1b'))?this[_0xba91('0xe')](_0xba91('0x1b'))[_0xba91('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xba91('0x1')],'defaultValue':'no','set':function(_0x51ffc4){this[_0xba91('0xc')](_0xba91('0x1c'),_0x51ffc4?_0x51ffc4[_0xba91('0x1d')](','):undefined);},'get':function(){return this[_0xba91('0xe')](_0xba91('0x1c'))?this[_0xba91('0xe')](_0xba91('0x1c'))[_0xba91('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xba91('0x6')](_0xba91('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xba91('0x6')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xba91('0x1')]},'description':{'type':Sequelize[_0xba91('0x1')]},'acw':{'type':Sequelize[_0xba91('0x1e')],'defaultValue':0x0,'set':function(_0x7d1af4){this[_0xba91('0xc')]('acw',_0x7d1af4);if(_0x7d1af4){if(this['getDataValue'](_0xba91('0x1f'))<0x2){this['setDataValue'](_0xba91('0x1f'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xba91('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xba91('0x1e')],'defaultValue':0x0,'comment':_0xba91('0x20')},'dialMethod':{'type':Sequelize[_0xba91('0x6')]('preview',_0xba91('0x21'),'power',_0xba91('0x22'),_0xba91('0x23')),'defaultValue':_0xba91('0x21'),'comment':_0xba91('0x24')},'dialLimitChannel':{'type':Sequelize[_0xba91('0x14')](0x4)[_0xba91('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xba91('0x26')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)[_0xba91('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xba91('0x27')},'dialPowerLevel':{'type':Sequelize[_0xba91('0x28')](0x2)[_0xba91('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0xba91('0x6')]('agentBusyFactor',_0xba91('0x29')),'defaultValue':_0xba91('0x29'),'comment':_0xba91('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xba91('0x2b')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xba91('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xba91('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0xba91('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xba91('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xba91('0x14')](0x3)[_0xba91('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba91('0x2d')},'dialQueueOptions':{'type':Sequelize[_0xba91('0x1')],'defaultValue':_0xba91('0x2e'),'comment':_0xba91('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0xba91('0x14')](0x3)[_0xba91('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba91('0x30')},'dialQueueProject':{'type':Sequelize[_0xba91('0x1')],'comment':_0xba91('0x31')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba91('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba91('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba91('0x33')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba91('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xba91('0x14')](0x5)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba91('0x34')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba91('0x25')],'defaultValue':0x3,'comment':_0xba91('0x35')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba91('0x36')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xba91('0x37')},'dialTimezone':{'type':Sequelize[_0xba91('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xba91('0x1')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xba91('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xba91('0x6')]('always',_0xba91('0x38'),_0xba91('0x39')),'defaultValue':_0xba91('0x3a')},'dialAMDActive':{'type':Sequelize[_0xba91('0x1e')],'defaultValue':0x0,'comment':_0xba91('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xba91('0x14')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xba91('0x3c')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xba91('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xba91('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xba91('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xba91('0x14')](0x9)[_0xba91('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xba91('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xba91('0x14')](0x9)[_0xba91('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xba91('0x14')](0x9)[_0xba91('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xba91('0x14')](0x5)[_0xba91('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xba91('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xba91('0x14')](0x9)[_0xba91('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xba91('0x40')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0xba91('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xba91('0x41')},'dialRecallInQueue':{'type':Sequelize[_0xba91('0x1e')],'defaultValue':0x0,'comment':_0xba91('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0xba91('0x6')]('DESC',_0xba91('0x43')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xba91('0x31')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xba91('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xba91('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xba91('0x14')](0x3)[_0xba91('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xba91('0x44')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xba91('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xba91('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xba91('0x14')](0x3)[_0xba91('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba91('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xba91('0x14')](0x5)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0xba91('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba91('0x47')},'dialDropRetryFrequency':{'type':Sequelize[_0xba91('0x14')](0x5)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba91('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xba91('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba91('0x49')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xba91('0x14')](0x5)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba91('0x4a')},'dialMachineMaxRetry':{'type':Sequelize[_0xba91('0x14')](0x3)[_0xba91('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba91('0x4b')},'dialMachineRetryFrequency':{'type':Sequelize[_0xba91('0x14')](0x5)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xba91('0x14')](0x3)[_0xba91('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xba91('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xba91('0x14')](0x5)[_0xba91('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xba91('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xba91('0x14')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xba91('0x1e')],'defaultValue':![],'comment':_0xba91('0x4e'),'set':function(_0x4e7bc1){if(!_0x4e7bc1)this[_0xba91('0xc')]('mandatoryDispositionPauseId',null);this[_0xba91('0xc')]('mandatoryDisposition',_0x4e7bc1);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xba91('0x14')](0x3)[_0xba91('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xba91('0x14')](0x3)[_0xba91('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}};
\ No newline at end of file
+var _0xfcfd=['Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','STRING','name','inbound','outbound','ENUM','ringall','leastrecent','fewestcalls','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,<project_name>)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen'];(function(_0x3efc2b,_0x30e89e){var _0x143578=function(_0x506c2d){while(--_0x506c2d){_0x3efc2b['push'](_0x3efc2b['shift']());}};_0x143578(++_0x30e89e);}(_0xfcfd,0x6b));var _0xdfcf=function(_0x4cd71a,_0x446f37){_0x4cd71a=_0x4cd71a-0x0;var _0x24602e=_0xfcfd[_0x4cd71a];return _0x24602e;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xdfcf('0x0')],'allowNull':![],'unique':_0xdfcf('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xdfcf('0x2'),_0xdfcf('0x3')),'allowNull':![],'defaultValue':_0xdfcf('0x2')},'musiconhold':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':'default'},'announce':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':''},'strategy':{'type':Sequelize[_0xdfcf('0x4')]('rr',_0xdfcf('0x5'),_0xdfcf('0x6'),_0xdfcf('0x7'),'random',_0xdfcf('0x8'),'linear',_0xdfcf('0x9'),_0xdfcf('0xa')),'allowNull':![],'defaultValue':_0xdfcf('0x5'),'set':function(_0x4a35a9){this[_0xdfcf('0xb')](_0xdfcf('0xc'),_0x4a35a9?_0x4a35a9:_0xdfcf('0x8'));},'get':function(){var _0x2b12d2=this['getDataValue']('type');var _0x18cba7=this[_0xdfcf('0xd')](_0xdfcf('0xe'));var _0xaf601f=this['getDataValue'](_0xdfcf('0xc'));if(_0x2b12d2==='outbound'){if(_0x18cba7===_0xdfcf('0xf')){return null;}if(_0x18cba7===_0xdfcf('0x10')&&![_0xdfcf('0x8'),_0xdfcf('0x11')][_0xdfcf('0x12')](_0xaf601f)){this[_0xdfcf('0xb')](_0xdfcf('0xc'),_0xdfcf('0x8'));}}return _0xaf601f;}},'servicelevel':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xdfcf('0x13')](0xb)},'timeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xdfcf('0x0')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':_0xdfcf('0x14')},'autopause':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xdfcf('0x13')](0xb)},'autopausebusy':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xdfcf('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xdfcf('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xdfcf('0x4')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xdfcf('0x0')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xdfcf('0x0')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xdfcf('0x4')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xdfcf('0x14')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xdfcf('0x14'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no')},'announce_position_limit':{'type':Sequelize[_0xdfcf('0x13')](0xb)},'announce_round_seconds':{'type':Sequelize[_0xdfcf('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xdfcf('0x0')]},'queue_youarenext':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xdfcf('0x0')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xdfcf('0x0')]},'queue_quantity1':{'type':Sequelize[_0xdfcf('0x0')]},'queue_quantity2':{'type':Sequelize[_0xdfcf('0x0')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xdfcf('0x0')]},'periodic_announce':{'type':Sequelize[_0xdfcf('0x15')],'set':function(_0x3d8a36){this['setDataValue'](_0xdfcf('0x16'),_0x3d8a36?_0x3d8a36[_0xdfcf('0x17')](','):[]);},'get':function(){return this['getDataValue'](_0xdfcf('0x16'))?this[_0xdfcf('0xd')]('periodic_announce')[_0xdfcf('0x18')](','):[];}},'joinempty':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':_0xdfcf('0x14'),'set':function(_0x493229){this[_0xdfcf('0xb')]('joinempty',_0x493229?_0x493229[_0xdfcf('0x17')](','):undefined);},'get':function(){return this[_0xdfcf('0xd')](_0xdfcf('0x19'))?this['getDataValue'](_0xdfcf('0x19'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':'no','set':function(_0x49fad2){this[_0xdfcf('0xb')](_0xdfcf('0x1a'),_0x49fad2?_0x49fad2[_0xdfcf('0x17')](','):undefined);},'get':function(){return this[_0xdfcf('0xd')](_0xdfcf('0x1a'))?this[_0xdfcf('0xd')]('leavewhenempty')['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0xdfcf('0x14'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xdfcf('0x0')]},'description':{'type':Sequelize[_0xdfcf('0x0')]},'acw':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':0x0,'set':function(_0x335892){this[_0xdfcf('0xb')](_0xdfcf('0x1c'),_0x335892);if(_0x335892){if(this[_0xdfcf('0xd')]('wrapuptime')<0x2){this[_0xdfcf('0xb')](_0xdfcf('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xdfcf('0x13')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':0x0,'comment':_0xdfcf('0x1e')},'dialMethod':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0xf'),_0xdfcf('0x1f'),'power',_0xdfcf('0x20'),_0xdfcf('0x10')),'defaultValue':'progressive','comment':_0xdfcf('0x21')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdfcf('0x22')},'dialLimitQueue':{'type':Sequelize[_0xdfcf('0x13')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xdfcf('0x23')},'dialPowerLevel':{'type':Sequelize[_0xdfcf('0x24')](0x2)[_0xdfcf('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xdfcf('0x26')},'dialPredictiveOptimization':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x27'),_0xdfcf('0x28')),'defaultValue':'dropRate','comment':_0xdfcf('0x29')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xdfcf('0x24')](0x2)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xdfcf('0x2a')},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0xdfcf('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xdfcf('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0xdfcf('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xdfcf('0x2d'),'comment':_0xdfcf('0x2e')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x2f')},'dialQueueProject':{'type':Sequelize[_0xdfcf('0x0')],'comment':_0xdfcf('0x30')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'comment':_0xdfcf('0x34')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x35')},'dialGlobalMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xdfcf('0x36')},'dialTimezone':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xdfcf('0x37')},'dialPrefix':{'type':Sequelize[_0xdfcf('0x0')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xdfcf('0x4')](_0xdfcf('0x38'),_0xdfcf('0x39'),_0xdfcf('0x3a')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xdfcf('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xdfcf('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xdfcf('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xdfcf('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xdfcf('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xdfcf('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdfcf('0x3f')},'dialAMDMinWordLength':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xdfcf('0x40')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xdfcf('0x41')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xdfcf('0x13')](0x9)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0xdfcf('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xdfcf('0x13')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xdfcf('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xdfcf('0x43')},'dialRecallInQueue':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':0x0,'comment':_0xdfcf('0x44')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xdfcf('0x45'),_0xdfcf('0x46')),'defaultValue':_0xdfcf('0x45')},'dialQueueProject2':{'type':Sequelize[_0xdfcf('0x0')],'comment':_0xdfcf('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xdfcf('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdfcf('0x47')},'dialCutDigit':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xdfcf('0x48')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x49')},'dialDropMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x4a')},'dialDropRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x4b')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x4c')},'dialMachineMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xdfcf('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xdfcf('0x13')](0x5)[_0xdfcf('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xdfcf('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdfcf('0x13')],'allowNull':!![],'comment':_0xdfcf('0x50')},'mandatoryDisposition':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':![],'comment':_0xdfcf('0x51'),'set':function(_0x2c9c43){if(!_0x2c9c43)this[_0xdfcf('0xb')]('mandatoryDispositionPauseId',null);this[_0xdfcf('0xb')](_0xdfcf('0x52'),_0x2c9c43);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xdfcf('0x13')](0x3)[_0xdfcf('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xdfcf('0x1b')],'defaultValue':![]}};
\ No newline at end of file
index e033671..134660f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x33f470,_0x3367ad){var _0x599536=function(_0x186e07){while(--_0x186e07){_0x33f470['push'](_0x33f470['shift']());}};_0x599536(++_0x3367ad);}(_0xe14b,0x93));var _0xbe14=function(_0x122a34,_0x1ea0c5){_0x122a34=_0x122a34-0x0;var _0x3b526f=_0xe14b[_0x122a34];return _0x3b526f;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));};
\ No newline at end of file
+var _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x6aa7,0x178));var _0x76aa=function(_0x25fe8e,_0x273a3b){_0x25fe8e=_0x25fe8e-0x0;var _0x2569b0=_0x6aa7[_0x25fe8e];return _0x2569b0;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));};
\ No newline at end of file
index 4327b84..09c4c08 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5661=['emit','exports','events','../../mysqldb','VoiceQueue','update'];(function(_0x2452b1,_0x2f51d8){var _0x3c7685=function(_0x15c9fd){while(--_0x15c9fd){_0x2452b1['push'](_0x2452b1['shift']());}};_0x3c7685(++_0x2f51d8);}(_0x5661,0xbc));var _0x1566=function(_0x1d2e88,_0x410d1d){_0x1d2e88=_0x1d2e88-0x0;var _0x42794b=_0x5661[_0x1d2e88];return _0x42794b;};'use strict';var EventEmitter=require(_0x1566('0x0'));var VoiceQueue=require(_0x1566('0x1'))['db'][_0x1566('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1566('0x3'),'afterDestroy':'remove'};function emitEvent(_0x18a068){return function(_0x2092ab,_0x334796,_0x119faa){VoiceQueueEvents[_0x1566('0x4')](_0x18a068+':'+_0x2092ab['id'],_0x2092ab);VoiceQueueEvents[_0x1566('0x4')](_0x18a068,_0x2092ab);_0x119faa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x1566('0x5')]=VoiceQueueEvents;
\ No newline at end of file
+var _0x335d=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x335d,0x166));var _0xd335=function(_0x10a0ab,_0x37b227){_0x10a0ab=_0x10a0ab-0x0;var _0x35f4c3=_0x335d[_0x10a0ab];return _0x35f4c3;};'use strict';var EventEmitter=require(_0xd335('0x0'));var VoiceQueue=require(_0xd335('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xd335('0x2')](0x0);var events={'afterCreate':_0xd335('0x3'),'afterUpdate':_0xd335('0x4'),'afterDestroy':_0xd335('0x5')};function emitEvent(_0x2ed622){return function(_0x5b42e1,_0x26eadd,_0x1d213a){VoiceQueueEvents[_0xd335('0x6')](_0x2ed622+':'+_0x5b42e1['id'],_0x5b42e1);VoiceQueueEvents['emit'](_0x2ed622,_0x5b42e1);_0x1d213a(null);};}for(var e in events){if(events[_0xd335('0x7')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xd335('0x8')]=VoiceQueueEvents;
\ No newline at end of file
index 4247970..e7875f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x122633,_0x22057b){var _0x2d02e5=function(_0x420024){while(--_0x420024){_0x122633['push'](_0x122633['shift']());}};_0x2d02e5(++_0x22057b);}(_0x008c,0x188));var _0xc008=function(_0x5b27da,_0x4a6532){_0x5b27da=_0x5b27da-0x0;var _0x3254f4=_0x008c[_0x5b27da];return _0x3254f4;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x137d9b,_0x2c01bc){var _0x1ed789=function(_0xc52068){while(--_0xc52068){_0x137d9b['push'](_0x137d9b['shift']());}};_0x1ed789(++_0x2c01bc);}(_0x34e8,0x12c));var _0x834e=function(_0x38e3cb,_0x3e09fd){_0x38e3cb=_0x38e3cb-0x0;var _0x17d975=_0x34e8[_0x38e3cb];return _0x17d975;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 748ffeb..36bf19c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf5d5=['../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','register','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','options','raw','where','limit','map','include','model','attributes','then','GetVoiceQueue','catch','ShowVoiceQueue','VoiceQueue','find','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x504df6,_0x43699e){var _0x425a7d=function(_0x3aaf97){while(--_0x3aaf97){_0x504df6['push'](_0x504df6['shift']());}};_0x425a7d(++_0x43699e);}(_0xf5d5,0xbc));var _0x5f5d=function(_0x544553,_0x4592c7){_0x544553=_0x544553-0x0;var _0x49220e=_0xf5d5[_0x544553];return _0x49220e;};'use strict';var _=require(_0x5f5d('0x0'));var util=require(_0x5f5d('0x1'));var moment=require('moment');var BPromise=require(_0x5f5d('0x2'));var rs=require(_0x5f5d('0x3'));var fs=require('fs');var Redis=require(_0x5f5d('0x4'));var db=require(_0x5f5d('0x5'))['db'];var utils=require(_0x5f5d('0x6'));var logger=require(_0x5f5d('0x7'))(_0x5f5d('0x8'));var config=require(_0x5f5d('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5f5d('0xa')][_0x5f5d('0xb')]({'port':0x232a});config[_0x5f5d('0xc')]=_['defaults'](config[_0x5f5d('0xc')],{'host':_0x5f5d('0xd'),'port':0x18eb});var socket=require(_0x5f5d('0xe'))(new Redis(config[_0x5f5d('0xc')]));require('./voiceQueue.socket')[_0x5f5d('0xf')](socket);function respondWithRpcPromise(_0x199a18,_0x326935,_0x4ec32f){return new BPromise(function(_0x14c552,_0x57e8ac){return client['request'](_0x199a18,_0x4ec32f)['then'](function(_0x676a0f){logger['info'](_0x5f5d('0x10'),_0x326935,_0x5f5d('0x11'));logger[_0x5f5d('0x12')](_0x5f5d('0x13'),_0x326935,_0x5f5d('0x11'),JSON['stringify'](_0x676a0f));if(_0x676a0f['error']){if(_0x676a0f[_0x5f5d('0x14')]['code']===0x1f4){logger[_0x5f5d('0x14')](_0x5f5d('0x10'),_0x326935,_0x676a0f[_0x5f5d('0x14')]['message']);return _0x57e8ac(_0x676a0f[_0x5f5d('0x14')][_0x5f5d('0x15')]);}logger[_0x5f5d('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x326935,_0x676a0f['error'][_0x5f5d('0x15')]);return _0x14c552(_0x676a0f[_0x5f5d('0x14')][_0x5f5d('0x15')]);}else{logger[_0x5f5d('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x326935,_0x5f5d('0x11'));_0x14c552(_0x676a0f[_0x5f5d('0x17')][_0x5f5d('0x15')]);}})['catch'](function(_0x338533){logger['error'](_0x5f5d('0x10'),_0x326935,_0x338533);_0x57e8ac(_0x338533);});});}exports['GetVoiceQueue']=function(_0x5c4cd0){var _0x570c27=this;return new Promise(function(_0xbd3578,_0x5bea30){return db['VoiceQueue']['findAll']({'raw':_0x5c4cd0['options']?_0x5c4cd0[_0x5f5d('0x18')][_0x5f5d('0x19')]===undefined?!![]:![]:!![],'where':_0x5c4cd0[_0x5f5d('0x18')]?_0x5c4cd0['options'][_0x5f5d('0x1a')]||null:null,'attributes':_0x5c4cd0['options']?_0x5c4cd0[_0x5f5d('0x18')]['attributes']||null:null,'limit':_0x5c4cd0[_0x5f5d('0x18')]?_0x5c4cd0[_0x5f5d('0x18')][_0x5f5d('0x1b')]||null:null,'include':_0x5c4cd0[_0x5f5d('0x18')]?_0x5c4cd0[_0x5f5d('0x18')]['include']?_[_0x5f5d('0x1c')](_0x5c4cd0[_0x5f5d('0x18')][_0x5f5d('0x1d')],function(_0x30fce3){return{'model':db[_0x30fce3[_0x5f5d('0x1e')]],'as':_0x30fce3['as'],'attributes':_0x30fce3[_0x5f5d('0x1f')],'include':_0x30fce3[_0x5f5d('0x1d')]?_['map'](_0x30fce3[_0x5f5d('0x1d')],function(_0x864367){return{'model':db[_0x864367[_0x5f5d('0x1e')]],'as':_0x864367['as'],'attributes':_0x864367[_0x5f5d('0x1f')],'include':_0x864367[_0x5f5d('0x1d')]?_['map'](_0x864367[_0x5f5d('0x1d')],function(_0x248112){return{'model':db[_0x248112[_0x5f5d('0x1e')]],'as':_0x248112['as'],'attributes':_0x248112[_0x5f5d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5f5d('0x20')](function(_0x152652){logger['info'](_0x5f5d('0x21'),_0x5c4cd0);logger[_0x5f5d('0x12')]('GetVoiceQueue',_0x5c4cd0,JSON['stringify'](_0x152652));_0xbd3578(_0x152652);})[_0x5f5d('0x22')](function(_0x4e8bb2){logger[_0x5f5d('0x14')](_0x5f5d('0x21'),_0x4e8bb2[_0x5f5d('0x15')],_0x5c4cd0);_0x5bea30(_0x570c27[_0x5f5d('0x14')](0x1f4,_0x4e8bb2['message']));});});};exports[_0x5f5d('0x23')]=function(_0x891985){var _0x1155e4=this;return new Promise(function(_0x85c028,_0x580d6b){return db[_0x5f5d('0x24')][_0x5f5d('0x25')]({'raw':_0x891985[_0x5f5d('0x18')]?_0x891985['options']['raw']===undefined?!![]:![]:!![],'where':_0x891985['options']?_0x891985['options'][_0x5f5d('0x1a')]||null:null,'attributes':_0x891985[_0x5f5d('0x18')]?_0x891985[_0x5f5d('0x18')]['attributes']||null:null,'include':_0x891985['options']?_0x891985[_0x5f5d('0x18')][_0x5f5d('0x1d')]?_['map'](_0x891985[_0x5f5d('0x18')][_0x5f5d('0x1d')],function(_0xe9c390){return{'model':db[_0xe9c390[_0x5f5d('0x1e')]],'as':_0xe9c390['as'],'attributes':_0xe9c390['attributes'],'include':_0xe9c390[_0x5f5d('0x1d')]?_['map'](_0xe9c390[_0x5f5d('0x1d')],function(_0x4d67e1){return{'model':db[_0x4d67e1['model']],'as':_0x4d67e1['as'],'attributes':_0x4d67e1[_0x5f5d('0x1f')],'include':_0x4d67e1[_0x5f5d('0x1d')]?_[_0x5f5d('0x1c')](_0x4d67e1[_0x5f5d('0x1d')],function(_0x39c8fe){return{'model':db[_0x39c8fe[_0x5f5d('0x1e')]],'as':_0x39c8fe['as'],'attributes':_0x39c8fe[_0x5f5d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5f5d('0x20')](function(_0x200760){logger[_0x5f5d('0x16')](_0x5f5d('0x23'),_0x891985);logger['debug'](_0x5f5d('0x23'),_0x891985,JSON[_0x5f5d('0x26')](_0x200760));_0x85c028(_0x200760);})[_0x5f5d('0x22')](function(_0x1c5827){logger[_0x5f5d('0x14')](_0x5f5d('0x23'),_0x1c5827[_0x5f5d('0x15')],_0x891985);_0x580d6b(_0x1155e4[_0x5f5d('0x14')](0x1f4,_0x1c5827[_0x5f5d('0x15')]));});});};
\ No newline at end of file
+var _0x5b93=['map','model','ShowVoiceQueue','then','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./voiceQueue.socket','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include'];(function(_0x238cd6,_0x260c10){var _0x5216c1=function(_0x3f646f){while(--_0x3f646f){_0x238cd6['push'](_0x238cd6['shift']());}};_0x5216c1(++_0x260c10);}(_0x5b93,0x148));var _0x35b9=function(_0xc66538,_0x3d40b4){_0xc66538=_0xc66538-0x0;var _0x5bdd01=_0x5b93[_0xc66538];return _0x5bdd01;};'use strict';var _=require('lodash');var util=require(_0x35b9('0x0'));var moment=require(_0x35b9('0x1'));var BPromise=require('bluebird');var rs=require(_0x35b9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35b9('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x35b9('0x4'))(_0x35b9('0x5'));var config=require(_0x35b9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x35b9('0x7')]['http']({'port':0x232a});config[_0x35b9('0x8')]=_['defaults'](config[_0x35b9('0x8')],{'host':_0x35b9('0x9'),'port':0x18eb});var socket=require(_0x35b9('0xa'))(new Redis(config[_0x35b9('0x8')]));require(_0x35b9('0xb'))['register'](socket);function respondWithRpcPromise(_0x11c157,_0x1b4b7a,_0x47cae5){return new BPromise(function(_0x30145e,_0x140073){return client[_0x35b9('0xc')](_0x11c157,_0x47cae5)['then'](function(_0x4f1ac3){logger[_0x35b9('0xd')](_0x35b9('0xe'),_0x1b4b7a,_0x35b9('0xf'));logger[_0x35b9('0x10')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x1b4b7a,'request\x20sent',JSON[_0x35b9('0x11')](_0x4f1ac3));if(_0x4f1ac3[_0x35b9('0x12')]){if(_0x4f1ac3[_0x35b9('0x12')][_0x35b9('0x13')]===0x1f4){logger[_0x35b9('0x12')](_0x35b9('0xe'),_0x1b4b7a,_0x4f1ac3['error'][_0x35b9('0x14')]);return _0x140073(_0x4f1ac3[_0x35b9('0x12')][_0x35b9('0x14')]);}logger[_0x35b9('0x12')](_0x35b9('0xe'),_0x1b4b7a,_0x4f1ac3[_0x35b9('0x12')]['message']);return _0x30145e(_0x4f1ac3[_0x35b9('0x12')][_0x35b9('0x14')]);}else{logger[_0x35b9('0xd')](_0x35b9('0xe'),_0x1b4b7a,'request\x20sent');_0x30145e(_0x4f1ac3[_0x35b9('0x15')][_0x35b9('0x14')]);}})[_0x35b9('0x16')](function(_0x426b29){logger[_0x35b9('0x12')](_0x35b9('0xe'),_0x1b4b7a,_0x426b29);_0x140073(_0x426b29);});});}exports[_0x35b9('0x17')]=function(_0x35ffde){var _0x3c7b5c=this;return new Promise(function(_0x5d763c,_0xaff629){return db[_0x35b9('0x18')][_0x35b9('0x19')]({'raw':_0x35ffde[_0x35b9('0x1a')]?_0x35ffde[_0x35b9('0x1a')][_0x35b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x35ffde[_0x35b9('0x1a')]?_0x35ffde['options'][_0x35b9('0x1c')]||null:null,'attributes':_0x35ffde['options']?_0x35ffde[_0x35b9('0x1a')][_0x35b9('0x1d')]||null:null,'limit':_0x35ffde[_0x35b9('0x1a')]?_0x35ffde['options'][_0x35b9('0x1e')]||null:null,'include':_0x35ffde[_0x35b9('0x1a')]?_0x35ffde[_0x35b9('0x1a')][_0x35b9('0x1f')]?_[_0x35b9('0x20')](_0x35ffde[_0x35b9('0x1a')][_0x35b9('0x1f')],function(_0xf468df){return{'model':db[_0xf468df[_0x35b9('0x21')]],'as':_0xf468df['as'],'attributes':_0xf468df[_0x35b9('0x1d')],'include':_0xf468df[_0x35b9('0x1f')]?_[_0x35b9('0x20')](_0xf468df[_0x35b9('0x1f')],function(_0x20e617){return{'model':db[_0x20e617[_0x35b9('0x21')]],'as':_0x20e617['as'],'attributes':_0x20e617[_0x35b9('0x1d')],'include':_0x20e617[_0x35b9('0x1f')]?_['map'](_0x20e617['include'],function(_0x2689a4){return{'model':db[_0x2689a4[_0x35b9('0x21')]],'as':_0x2689a4['as'],'attributes':_0x2689a4[_0x35b9('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3fb061){logger[_0x35b9('0xd')](_0x35b9('0x17'),_0x35ffde);logger[_0x35b9('0x10')](_0x35b9('0x17'),_0x35ffde,JSON['stringify'](_0x3fb061));_0x5d763c(_0x3fb061);})[_0x35b9('0x16')](function(_0x278d7b){logger[_0x35b9('0x12')]('GetVoiceQueue',_0x278d7b[_0x35b9('0x14')],_0x35ffde);_0xaff629(_0x3c7b5c['error'](0x1f4,_0x278d7b[_0x35b9('0x14')]));});});};exports[_0x35b9('0x22')]=function(_0x5cf039){var _0x5f09e0=this;return new Promise(function(_0x1a3993,_0x28fc50){return db[_0x35b9('0x18')]['find']({'raw':_0x5cf039[_0x35b9('0x1a')]?_0x5cf039[_0x35b9('0x1a')][_0x35b9('0x1b')]===undefined?!![]:![]:!![],'where':_0x5cf039[_0x35b9('0x1a')]?_0x5cf039[_0x35b9('0x1a')][_0x35b9('0x1c')]||null:null,'attributes':_0x5cf039[_0x35b9('0x1a')]?_0x5cf039[_0x35b9('0x1a')][_0x35b9('0x1d')]||null:null,'include':_0x5cf039[_0x35b9('0x1a')]?_0x5cf039['options'][_0x35b9('0x1f')]?_['map'](_0x5cf039['options'][_0x35b9('0x1f')],function(_0x14a7cc){return{'model':db[_0x14a7cc[_0x35b9('0x21')]],'as':_0x14a7cc['as'],'attributes':_0x14a7cc[_0x35b9('0x1d')],'include':_0x14a7cc[_0x35b9('0x1f')]?_[_0x35b9('0x20')](_0x14a7cc[_0x35b9('0x1f')],function(_0x445ae7){return{'model':db[_0x445ae7['model']],'as':_0x445ae7['as'],'attributes':_0x445ae7[_0x35b9('0x1d')],'include':_0x445ae7[_0x35b9('0x1f')]?_[_0x35b9('0x20')](_0x445ae7[_0x35b9('0x1f')],function(_0x5103a9){return{'model':db[_0x5103a9[_0x35b9('0x21')]],'as':_0x5103a9['as'],'attributes':_0x5103a9[_0x35b9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x35b9('0x23')](function(_0xc432f5){logger['info']('ShowVoiceQueue',_0x5cf039);logger[_0x35b9('0x10')](_0x35b9('0x22'),_0x5cf039,JSON['stringify'](_0xc432f5));_0x1a3993(_0xc432f5);})[_0x35b9('0x16')](function(_0x598645){logger[_0x35b9('0x12')](_0x35b9('0x22'),_0x598645['message'],_0x5cf039);_0x28fc50(_0x5f09e0[_0x35b9('0x12')](0x1f4,_0x598645[_0x35b9('0x14')]));});});};
\ No newline at end of file
index aae2f49..655466c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x859e=['update','emit','register','length','voiceQueue:','./voiceQueue.events','save','remove'];(function(_0x15b380,_0x1a3c5f){var _0x232c5c=function(_0x12f8e0){while(--_0x12f8e0){_0x15b380['push'](_0x15b380['shift']());}};_0x232c5c(++_0x1a3c5f);}(_0x859e,0x17d));var _0xe859=function(_0x3649da,_0x567e70){_0x3649da=_0x3649da-0x0;var _0x305595=_0x859e[_0x3649da];return _0x305595;};'use strict';var VoiceQueueEvents=require(_0xe859('0x0'));var events=[_0xe859('0x1'),_0xe859('0x2'),_0xe859('0x3')];function createListener(_0x120f67,_0x39a21a){return function(_0x4edf4c){_0x39a21a[_0xe859('0x4')](_0x120f67,_0x4edf4c);};}function removeListener(_0x427a47,_0x50b436){return function(){VoiceQueueEvents['removeListener'](_0x427a47,_0x50b436);};}exports[_0xe859('0x5')]=function(_0x417096){for(var _0x3a0ba8=0x0,_0x48e67a=events[_0xe859('0x6')];_0x3a0ba8<_0x48e67a;_0x3a0ba8++){var _0xe2bcae=events[_0x3a0ba8];var _0x9ede6e=createListener(_0xe859('0x7')+_0xe2bcae,_0x417096);VoiceQueueEvents['on'](_0xe2bcae,_0x9ede6e);}};
\ No newline at end of file
+var _0xcb67=['remove','emit','removeListener','register','length','voiceQueue:','./voiceQueue.events','save'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xcb67,0x8e));var _0x7cb6=function(_0x587fb5,_0x59cb3b){_0x587fb5=_0x587fb5-0x0;var _0x551105=_0xcb67[_0x587fb5];return _0x551105;};'use strict';var VoiceQueueEvents=require(_0x7cb6('0x0'));var events=[_0x7cb6('0x1'),_0x7cb6('0x2'),'update'];function createListener(_0x437fb4,_0x2cb19a){return function(_0x3c752c){_0x2cb19a[_0x7cb6('0x3')](_0x437fb4,_0x3c752c);};}function removeListener(_0x2bab5d,_0x2f4b25){return function(){VoiceQueueEvents[_0x7cb6('0x4')](_0x2bab5d,_0x2f4b25);};}exports[_0x7cb6('0x5')]=function(_0x21be0a){for(var _0x5d7ed8=0x0,_0x216e58=events[_0x7cb6('0x6')];_0x5d7ed8<_0x216e58;_0x5d7ed8++){var _0x441f05=events[_0x5d7ed8];var _0x3b97a3=createListener(_0x7cb6('0x7')+_0x441f05,_0x21be0a);VoiceQueueEvents['on'](_0x441f05,_0x3b97a3);}};
\ No newline at end of file
index bc5aeaf..02b5731 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c29=['post','create','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','/:id','show'];(function(_0x1f175e,_0x25487c){var _0x4ab74c=function(_0x301e14){while(--_0x301e14){_0x1f175e['push'](_0x1f175e['shift']());}};_0x4ab74c(++_0x25487c);}(_0x6c29,0x72));var _0x96c2=function(_0xd1c39b,_0x16f0c6){_0xd1c39b=_0xd1c39b-0x0;var _0x58f5bc=_0x6c29[_0xd1c39b];return _0x58f5bc;};'use strict';var multer=require(_0x96c2('0x0'));var util=require(_0x96c2('0x1'));var path=require(_0x96c2('0x2'));var timeout=require(_0x96c2('0x3'));var express=require(_0x96c2('0x4'));var router=express[_0x96c2('0x5')]();var fs_extra=require(_0x96c2('0x6'));var auth=require(_0x96c2('0x7'));var interaction=require(_0x96c2('0x8'));var config=require(_0x96c2('0x9'));var controller=require(_0x96c2('0xa'));router[_0x96c2('0xb')]('/',auth[_0x96c2('0xc')](),controller['index']);router['get'](_0x96c2('0xd'),auth[_0x96c2('0xc')](),controller[_0x96c2('0xe')]);router[_0x96c2('0xb')](_0x96c2('0xf'),auth[_0x96c2('0xc')](),controller['getVoiceQueuesReport']);router[_0x96c2('0xb')](_0x96c2('0x10'),auth[_0x96c2('0xc')](),controller[_0x96c2('0x11')]);router[_0x96c2('0x12')]('/',auth[_0x96c2('0xc')](),controller[_0x96c2('0x13')]);router['put'](_0x96c2('0x10'),auth[_0x96c2('0xc')](),controller['update']);router[_0x96c2('0x14')](_0x96c2('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x96c2('0x15')]=router;
\ No newline at end of file
+var _0x73fa=['express','Router','fs-extra','../../config/environment','get','isAuthenticated','index','describe','/index','/:id','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x5b6a3e,_0xcf20dd){var _0x272448=function(_0x115bfa){while(--_0x115bfa){_0x5b6a3e['push'](_0x5b6a3e['shift']());}};_0x272448(++_0xcf20dd);}(_0x73fa,0x153));var _0xa73f=function(_0x4d525c,_0x277dac){_0x4d525c=_0x4d525c-0x0;var _0x3f0655=_0x73fa[_0x4d525c];return _0x3f0655;};'use strict';var multer=require(_0xa73f('0x0'));var util=require(_0xa73f('0x1'));var path=require(_0xa73f('0x2'));var timeout=require('connect-timeout');var express=require(_0xa73f('0x3'));var router=express[_0xa73f('0x4')]();var fs_extra=require(_0xa73f('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa73f('0x6'));var controller=require('./voiceQueueReport.controller');router[_0xa73f('0x7')]('/',auth[_0xa73f('0x8')](),controller[_0xa73f('0x9')]);router[_0xa73f('0x7')]('/describe',auth[_0xa73f('0x8')](),controller[_0xa73f('0xa')]);router[_0xa73f('0x7')](_0xa73f('0xb'),auth[_0xa73f('0x8')](),controller['getVoiceQueuesReport']);router[_0xa73f('0x7')](_0xa73f('0xc'),auth[_0xa73f('0x8')](),controller['show']);router['post']('/',auth[_0xa73f('0x8')](),controller[_0xa73f('0xd')]);router[_0xa73f('0xe')](_0xa73f('0xc'),auth['isAuthenticated'](),controller[_0xa73f('0xf')]);router[_0xa73f('0x10')](_0xa73f('0xc'),auth[_0xa73f('0x8')](),controller[_0xa73f('0x11')]);module[_0xa73f('0x12')]=router;
\ No newline at end of file
index 4b11d5e..9aba696 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf113=['exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment'];(function(_0x228934,_0x56a696){var _0x1c261f=function(_0x32d5e5){while(--_0x32d5e5){_0x228934['push'](_0x228934['shift']());}};_0x1c261f(++_0x56a696);}(_0xf113,0x1da));var _0x3f11=function(_0x3bead0,_0x2b7123){_0x3bead0=_0x3bead0-0x0;var _0x129c66=_0xf113[_0x3bead0];return _0x129c66;};'use strict';var Sequelize=require(_0x3f11('0x0'));var moment=require(_0x3f11('0x1'));module[_0x3f11('0x2')]={'type':{'type':Sequelize[_0x3f11('0x3')]},'uniqueid':{'type':Sequelize[_0x3f11('0x3')]},'calleridnum':{'type':Sequelize[_0x3f11('0x3')]},'calleridname':{'type':Sequelize[_0x3f11('0x3')]},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x3f11('0x4')],'set':function(_0x28d556){var _0x51ec7c=moment(_0x28d556);var _0x27aa17=moment(this[_0x3f11('0x5')](_0x3f11('0x6')))[_0x3f11('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x147b17=_0x51ec7c[_0x3f11('0x8')](_0x27aa17,_0x3f11('0x9'));this[_0x3f11('0xa')](_0x3f11('0xb'),_0x28d556);this[_0x3f11('0xa')](_0x3f11('0xc'),_0x147b17||null);}},'position':{'type':Sequelize[_0x3f11('0xd')]},'count':{'type':Sequelize[_0x3f11('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3f11('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x3f11('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3f11('0x4')]},'queuecallerexit':{'type':Sequelize[_0x3f11('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x3f11('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x3f11('0x3')],'comment':_0x3f11('0xf')},'originalposition':{'type':Sequelize[_0x3f11('0xd')]},'channel':{'type':Sequelize[_0x3f11('0x3')]},'connectedlinenum':{'type':Sequelize[_0x3f11('0x3')]},'connectedlinename':{'type':Sequelize[_0x3f11('0x3')]},'accountcode':{'type':Sequelize[_0x3f11('0x3')]},'context':{'type':Sequelize[_0x3f11('0x3')]},'exten':{'type':Sequelize[_0x3f11('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize[_0x3f11('0xd')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3f11('0x3')]},'transfer':{'type':Sequelize[_0x3f11('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3f11('0x3')],'comment':_0x3f11('0x10')},'transferexten':{'type':Sequelize[_0x3f11('0x3')]},'transferuniqueid':{'type':Sequelize[_0x3f11('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3f11('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3f11('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x3f11('0xd')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0x0266=['format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue','queuecallerjoinAt'];(function(_0x1e2eac,_0x26dddf){var _0x7a4e81=function(_0x341ed5){while(--_0x341ed5){_0x1e2eac['push'](_0x1e2eac['shift']());}};_0x7a4e81(++_0x26dddf);}(_0x0266,0xe5));var _0x6026=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0266[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0x6026('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x6026('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x6026('0x1')]},'calleridname':{'type':Sequelize[_0x6026('0x1')]},'queue':{'type':Sequelize[_0x6026('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x6026('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x6026('0x2')],'set':function(_0x944084){var _0x19b10c=moment(_0x944084);var _0x4a7f41=moment(this[_0x6026('0x3')](_0x6026('0x4')))[_0x6026('0x5')](_0x6026('0x6'));var _0x114cfb=_0x19b10c[_0x6026('0x7')](_0x4a7f41,_0x6026('0x8'));this[_0x6026('0x9')]('queuecallerleaveAt',_0x944084);this[_0x6026('0x9')]('holdtime',_0x114cfb||null);}},'position':{'type':Sequelize[_0x6026('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x6026('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x6026('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x6026('0x2')]},'queuecallerexit':{'type':Sequelize[_0x6026('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x6026('0x1')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x6026('0x1')]},'connectedlinenum':{'type':Sequelize[_0x6026('0x1')]},'connectedlinename':{'type':Sequelize[_0x6026('0x1')]},'accountcode':{'type':Sequelize[_0x6026('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x6026('0x1')]},'priority':{'type':Sequelize[_0x6026('0x1')]},'holdtime':{'type':Sequelize[_0x6026('0xa')]},'mohtime':{'type':Sequelize[_0x6026('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6026('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x6026('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x6026('0x1')],'comment':_0x6026('0xc')},'transferexten':{'type':Sequelize[_0x6026('0x1')]},'transferuniqueid':{'type':Sequelize[_0x6026('0x1')]},'disposition':{'type':Sequelize[_0x6026('0x1')]},'secondDisposition':{'type':Sequelize[_0x6026('0x1')]},'thirdDisposition':{'type':Sequelize[_0x6026('0x1')]},'queuecallerenterreason':{'type':Sequelize[_0x6026('0xa')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 41e6a5e..23be812 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb761=['../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','find','create','body','describe','getVoiceQueuesReport','order','options','rows','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api'];(function(_0x15f40e,_0x34e487){var _0x7cd167=function(_0xd5ebbd){while(--_0xd5ebbd){_0x15f40e['push'](_0x15f40e['shift']());}};_0x7cd167(++_0x34e487);}(_0xb761,0x194));var _0x1b76=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0xb761[_0x152aa1];return _0x1bc01a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b76('0x0'));var zipdir=require(_0x1b76('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1b76('0x2'));var moment=require('moment');var BPromise=require(_0x1b76('0x3'));var Mustache=require(_0x1b76('0x4'));var util=require(_0x1b76('0x5'));var path=require(_0x1b76('0x6'));var sox=require('sox');var csv=require(_0x1b76('0x7'));var ejs=require(_0x1b76('0x8'));var fs=require('fs');var fs_extra=require(_0x1b76('0x9'));var _=require(_0x1b76('0xa'));var squel=require(_0x1b76('0xb'));var crypto=require('crypto');var jsforce=require(_0x1b76('0xc'));var deskjs=require(_0x1b76('0xd'));var toCsv=require('to-csv');var querystring=require(_0x1b76('0xe'));var Papa=require(_0x1b76('0xf'));var Redis=require(_0x1b76('0x10'));var authService=require(_0x1b76('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1b76('0x12'));var logger=require(_0x1b76('0x13'))(_0x1b76('0x14'));var utils=require('../../config/utils');var config=require(_0x1b76('0x15'));var licenseUtil=require(_0x1b76('0x16'));var db=require(_0x1b76('0x17'))['db'];config['redis']=_[_0x1b76('0x18')](config[_0x1b76('0x19')],{'host':_0x1b76('0x1a'),'port':0x18eb});var socket=require(_0x1b76('0x1b'))(new Redis(config['redis']));require(_0x1b76('0x1c'))[_0x1b76('0x1d')](socket);function respondWithStatusCode(_0x1cedfb,_0x349e2e){_0x349e2e=_0x349e2e||0xcc;return function(_0x3ba57d){if(_0x3ba57d){return _0x1cedfb[_0x1b76('0x1e')](_0x349e2e);}return _0x1cedfb[_0x1b76('0x1f')](_0x349e2e)[_0x1b76('0x20')]();};}function respondWithResult(_0x60ee94,_0x2e18fd){_0x2e18fd=_0x2e18fd||0xc8;return function(_0x45b98e){if(_0x45b98e){return _0x60ee94[_0x1b76('0x1f')](_0x2e18fd)[_0x1b76('0x21')](_0x45b98e);}};}function respondWithFilteredResult(_0x315162,_0x3d458c){return function(_0x2966cb){if(_0x2966cb){var _0x5322e7=typeof _0x3d458c['offset']===_0x1b76('0x22')&&typeof _0x3d458c['limit']===_0x1b76('0x22');var _0x25d0a6=_0x2966cb['count'];var _0x4aa382=_0x5322e7?0x0:_0x3d458c[_0x1b76('0x23')];var _0x3fd597=_0x5322e7?_0x2966cb[_0x1b76('0x24')]:_0x3d458c['offset']+_0x3d458c[_0x1b76('0x25')];var _0x7629a5;if(_0x3fd597>=_0x25d0a6){_0x3fd597=_0x25d0a6;_0x7629a5=0xc8;}else{_0x7629a5=0xce;}_0x315162[_0x1b76('0x1f')](_0x7629a5);return _0x315162[_0x1b76('0x26')](_0x1b76('0x27'),_0x4aa382+'-'+_0x3fd597+'/'+_0x25d0a6)['json'](_0x2966cb);}return null;};}function patchUpdates(_0x397694){return function(_0x4f39d2){try{jsonpatch[_0x1b76('0x28')](_0x4f39d2,_0x397694,!![]);}catch(_0x188c28){return BPromise[_0x1b76('0x29')](_0x188c28);}return _0x4f39d2[_0x1b76('0x2a')]();};}function saveUpdates(_0x2e3f8e,_0x2dd4cd){return function(_0x417f96){if(_0x417f96){return _0x417f96[_0x1b76('0x2b')](_0x2e3f8e)['then'](function(_0x1da89b){return _0x1da89b;});}return null;};}function removeEntity(_0x1f913e,_0x25b866){return function(_0x6c14e9){if(_0x6c14e9){return _0x6c14e9[_0x1b76('0x2c')]()[_0x1b76('0x2d')](function(){_0x1f913e[_0x1b76('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x110855,_0x27f87e){return function(_0x3715d4){if(!_0x3715d4){_0x110855[_0x1b76('0x1e')](0x194);}return _0x3715d4;};}function handleError(_0x4a0ed3,_0x52816b){_0x52816b=_0x52816b||0x1f4;return function(_0xe60db5){logger['error'](_0xe60db5[_0x1b76('0x2e')]);if(_0xe60db5['name']){delete _0xe60db5[_0x1b76('0x2f')];}_0x4a0ed3[_0x1b76('0x1f')](_0x52816b)[_0x1b76('0x30')](_0xe60db5);};}exports['index']=function(_0x5d21ef,_0x53a822){var _0x1feb28={},_0x10b83d={},_0x150733={'count':0x0,'rows':[]};var _0x5c29f2=_[_0x1b76('0x31')](db[_0x1b76('0x32')][_0x1b76('0x33')],function(_0x33f28a){return{'name':_0x33f28a[_0x1b76('0x34')],'type':_0x33f28a[_0x1b76('0x35')][_0x1b76('0x36')]};});_0x10b83d[_0x1b76('0x37')]=_[_0x1b76('0x31')](_0x5c29f2,_0x1b76('0x2f'));_0x10b83d[_0x1b76('0x38')]=_['keys'](_0x5d21ef[_0x1b76('0x38')]);_0x10b83d[_0x1b76('0x39')]=_[_0x1b76('0x3a')](_0x10b83d[_0x1b76('0x37')],_0x10b83d[_0x1b76('0x38')]);_0x1feb28['attributes']=_[_0x1b76('0x3a')](_0x10b83d[_0x1b76('0x37')],qs['fields'](_0x5d21ef[_0x1b76('0x38')][_0x1b76('0x3b')]));_0x1feb28['attributes']=_0x1feb28[_0x1b76('0x3c')][_0x1b76('0x3d')]?_0x1feb28[_0x1b76('0x3c')]:_0x10b83d[_0x1b76('0x37')];if(!_0x5d21ef[_0x1b76('0x38')][_0x1b76('0x3e')](_0x1b76('0x3f'))){_0x1feb28[_0x1b76('0x25')]=qs['limit'](_0x5d21ef[_0x1b76('0x38')][_0x1b76('0x25')]);_0x1feb28[_0x1b76('0x23')]=qs[_0x1b76('0x23')](_0x5d21ef[_0x1b76('0x38')][_0x1b76('0x23')]);}_0x1feb28['order']=qs[_0x1b76('0x40')](_0x5d21ef[_0x1b76('0x38')][_0x1b76('0x40')]);_0x1feb28[_0x1b76('0x41')]=qs['filters'](_[_0x1b76('0x42')](_0x5d21ef['query'],_0x10b83d['filters']),_0x5c29f2);if(_0x5d21ef[_0x1b76('0x38')][_0x1b76('0x43')]){_0x1feb28[_0x1b76('0x41')]=_[_0x1b76('0x44')](_0x1feb28[_0x1b76('0x41')],{'$or':_[_0x1b76('0x31')](_0x5c29f2,function(_0x7d99e1){if(_0x7d99e1[_0x1b76('0x35')]!==_0x1b76('0x45')){var _0x2d1589={};_0x2d1589[_0x7d99e1[_0x1b76('0x2f')]]={'$like':'%'+_0x5d21ef['query'][_0x1b76('0x43')]+'%'};return _0x2d1589;}})});}_0x1feb28=_['merge']({},_0x1feb28,_0x5d21ef['options']);var _0x1984c2={'where':_0x1feb28[_0x1b76('0x41')]};return db[_0x1b76('0x32')][_0x1b76('0x24')](_0x1984c2)['then'](function(_0x154406){_0x150733[_0x1b76('0x24')]=_0x154406;if(_0x5d21ef['query'][_0x1b76('0x46')]){_0x1feb28[_0x1b76('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x1b76('0x48')](_0x1feb28);})[_0x1b76('0x2d')](function(_0x230dca){_0x150733['rows']=_0x230dca;return _0x150733;})[_0x1b76('0x2d')](respondWithFilteredResult(_0x53a822,_0x1feb28))[_0x1b76('0x49')](handleError(_0x53a822,null));};exports[_0x1b76('0x4a')]=function(_0x17d079,_0x3dfb64){var _0x3c7356={'raw':![],'where':{'id':_0x17d079[_0x1b76('0x4b')]['id']}},_0x43ec3e={};_0x43ec3e[_0x1b76('0x37')]=_['keys'](db['VoiceQueueReport'][_0x1b76('0x33')]);_0x43ec3e[_0x1b76('0x38')]=_[_0x1b76('0x4c')](_0x17d079['query']);_0x43ec3e[_0x1b76('0x39')]=_[_0x1b76('0x3a')](_0x43ec3e['model'],_0x43ec3e[_0x1b76('0x38')]);_0x3c7356[_0x1b76('0x3c')]=_[_0x1b76('0x3a')](_0x43ec3e['model'],qs[_0x1b76('0x3b')](_0x17d079[_0x1b76('0x38')][_0x1b76('0x3b')]));_0x3c7356[_0x1b76('0x3c')]=_0x3c7356[_0x1b76('0x3c')][_0x1b76('0x3d')]?_0x3c7356['attributes']:_0x43ec3e[_0x1b76('0x37')];if(_0x17d079['query'][_0x1b76('0x46')]){_0x3c7356[_0x1b76('0x47')]=[{'all':!![]}];}_0x3c7356=_['merge']({},_0x3c7356,_0x17d079['options']);return db[_0x1b76('0x32')][_0x1b76('0x4d')](_0x3c7356)[_0x1b76('0x2d')](handleEntityNotFound(_0x3dfb64,null))[_0x1b76('0x2d')](respondWithResult(_0x3dfb64,null))[_0x1b76('0x49')](handleError(_0x3dfb64,null));};exports[_0x1b76('0x4e')]=function(_0x167ad1,_0xa44535){return db[_0x1b76('0x32')][_0x1b76('0x4e')](_0x167ad1[_0x1b76('0x4f')],{})['then'](respondWithResult(_0xa44535,0xc9))[_0x1b76('0x49')](handleError(_0xa44535,null));};exports['update']=function(_0x538fd9,_0x42e53d){if(_0x538fd9[_0x1b76('0x4f')]['id']){delete _0x538fd9[_0x1b76('0x4f')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x538fd9[_0x1b76('0x4b')]['id']}})[_0x1b76('0x2d')](handleEntityNotFound(_0x42e53d,null))[_0x1b76('0x2d')](saveUpdates(_0x538fd9['body'],null))[_0x1b76('0x2d')](respondWithResult(_0x42e53d,null))[_0x1b76('0x49')](handleError(_0x42e53d,null));};exports[_0x1b76('0x2c')]=function(_0x2be39d,_0x150526){return db['VoiceQueueReport'][_0x1b76('0x4d')]({'where':{'id':_0x2be39d['params']['id']}})[_0x1b76('0x2d')](handleEntityNotFound(_0x150526,null))[_0x1b76('0x2d')](removeEntity(_0x150526,null))[_0x1b76('0x49')](handleError(_0x150526,null));};exports[_0x1b76('0x50')]=function(_0xdad9a9,_0x15749c){return db[_0x1b76('0x32')][_0x1b76('0x50')]()[_0x1b76('0x2d')](respondWithResult(_0x15749c,null))[_0x1b76('0x49')](handleError(_0x15749c,null));};exports[_0x1b76('0x51')]=function(_0x22750d,_0x5ee158){var _0x46ea6e={},_0x1c0661={},_0x478806={'count':0x0,'rows':[]};_0x1c0661['model']=_[_0x1b76('0x4c')](db[_0x1b76('0x32')][_0x1b76('0x33')]);_0x1c0661[_0x1b76('0x38')]=_[_0x1b76('0x4c')](_0x22750d['query']);_0x1c0661[_0x1b76('0x39')]=_[_0x1b76('0x3a')](_0x1c0661[_0x1b76('0x37')],_0x1c0661[_0x1b76('0x38')]);_0x46ea6e[_0x1b76('0x3c')]=_[_0x1b76('0x3a')](_0x1c0661['model'],qs[_0x1b76('0x3b')](_0x22750d[_0x1b76('0x38')]['fields']));_0x46ea6e['attributes']=_0x46ea6e[_0x1b76('0x3c')][_0x1b76('0x3d')]?_0x46ea6e[_0x1b76('0x3c')]:_0x1c0661[_0x1b76('0x37')];if(!_0x22750d[_0x1b76('0x38')]['hasOwnProperty'](_0x1b76('0x3f'))){_0x46ea6e[_0x1b76('0x25')]=qs[_0x1b76('0x25')](_0x22750d[_0x1b76('0x38')][_0x1b76('0x25')]);_0x46ea6e['offset']=qs[_0x1b76('0x23')](_0x22750d[_0x1b76('0x38')][_0x1b76('0x23')]);}_0x46ea6e[_0x1b76('0x52')]=qs[_0x1b76('0x40')](_0x22750d['query'][_0x1b76('0x40')]);_0x46ea6e[_0x1b76('0x41')]=qs[_0x1b76('0x39')](_[_0x1b76('0x42')](_0x22750d[_0x1b76('0x38')],_0x1c0661[_0x1b76('0x39')]));if(_0x22750d[_0x1b76('0x38')]['filter']){_0x46ea6e['where']=_[_0x1b76('0x44')](_0x46ea6e['where'],{'$or':_['map'](_0x46ea6e[_0x1b76('0x3c')],function(_0x1d2d99){var _0x3baefd={};_0x3baefd[_0x1d2d99]={'$like':'%'+_0x22750d[_0x1b76('0x38')]['filter']+'%'};return _0x3baefd;})});}_0x46ea6e=_[_0x1b76('0x44')]({},_0x46ea6e,_0x22750d[_0x1b76('0x53')]);var _0x7323a2={'where':_0x46ea6e[_0x1b76('0x41')]};return db[_0x1b76('0x32')][_0x1b76('0x24')](_0x7323a2)[_0x1b76('0x2d')](function(_0x21698e){_0x478806[_0x1b76('0x24')]=_0x21698e;if(_0x22750d[_0x1b76('0x38')]['includeAll']){_0x46ea6e[_0x1b76('0x47')]=[{'all':!![]}];}return db[_0x1b76('0x32')][_0x1b76('0x48')](_0x46ea6e);})[_0x1b76('0x2d')](function(_0xa4cfa0){_0x478806[_0x1b76('0x54')]=_0xa4cfa0;return _0x478806;})[_0x1b76('0x2d')](respondWithFilteredResult(_0x5ee158,_0x46ea6e,_0x1b76('0x51')))[_0x1b76('0x49')](handleError(_0x5ee158,null,'getVoiceQueuesReport'));};
\ No newline at end of file
+var _0xc5ef=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceQueueReport','includeAll','include','findAll','rows','catch','show','params','create','body','find','destroy','describe','getVoiceQueuesReport','hasOwnProperty'];(function(_0x2f31f7,_0x3a0fc4){var _0x4023b0=function(_0x325787){while(--_0x325787){_0x2f31f7['push'](_0x2f31f7['shift']());}};_0x4023b0(++_0x3a0fc4);}(_0xc5ef,0xa2));var _0xfc5e=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xc5ef[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0xfc5e('0x0'));var rimraf=require(_0xfc5e('0x1'));var zipdir=require(_0xfc5e('0x2'));var jsonpatch=require(_0xfc5e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfc5e('0x4'));var Mustache=require(_0xfc5e('0x5'));var util=require(_0xfc5e('0x6'));var path=require(_0xfc5e('0x7'));var sox=require(_0xfc5e('0x8'));var csv=require('to-csv');var ejs=require(_0xfc5e('0x9'));var fs=require('fs');var fs_extra=require(_0xfc5e('0xa'));var _=require(_0xfc5e('0xb'));var squel=require(_0xfc5e('0xc'));var crypto=require(_0xfc5e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfc5e('0xe'));var toCsv=require(_0xfc5e('0xf'));var querystring=require(_0xfc5e('0x10'));var Papa=require('papaparse');var Redis=require(_0xfc5e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfc5e('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc5e('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc5e('0x14'));var db=require(_0xfc5e('0x15'))['db'];config[_0xfc5e('0x16')]=_['defaults'](config[_0xfc5e('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc5e('0x16')]));require(_0xfc5e('0x17'))[_0xfc5e('0x18')](socket);function respondWithStatusCode(_0x26e3bb,_0x57c04a){_0x57c04a=_0x57c04a||0xcc;return function(_0x48dcb3){if(_0x48dcb3){return _0x26e3bb[_0xfc5e('0x19')](_0x57c04a);}return _0x26e3bb[_0xfc5e('0x1a')](_0x57c04a)[_0xfc5e('0x1b')]();};}function respondWithResult(_0x4aca98,_0x3a6ff7){_0x3a6ff7=_0x3a6ff7||0xc8;return function(_0x4b3a45){if(_0x4b3a45){return _0x4aca98['status'](_0x3a6ff7)[_0xfc5e('0x1c')](_0x4b3a45);}};}function respondWithFilteredResult(_0x520174,_0xacded1){return function(_0x13b64b){if(_0x13b64b){var _0x572169=typeof _0xacded1[_0xfc5e('0x1d')]===_0xfc5e('0x1e')&&typeof _0xacded1[_0xfc5e('0x1f')]==='undefined';var _0x11cf55=_0x13b64b[_0xfc5e('0x20')];var _0x18ff32=_0x572169?0x0:_0xacded1[_0xfc5e('0x1d')];var _0x5a2cf9=_0x572169?_0x13b64b[_0xfc5e('0x20')]:_0xacded1[_0xfc5e('0x1d')]+_0xacded1[_0xfc5e('0x1f')];var _0x1d91b3;if(_0x5a2cf9>=_0x11cf55){_0x5a2cf9=_0x11cf55;_0x1d91b3=0xc8;}else{_0x1d91b3=0xce;}_0x520174[_0xfc5e('0x1a')](_0x1d91b3);return _0x520174[_0xfc5e('0x21')]('Content-Range',_0x18ff32+'-'+_0x5a2cf9+'/'+_0x11cf55)[_0xfc5e('0x1c')](_0x13b64b);}return null;};}function patchUpdates(_0x1836f0){return function(_0x1370c6){try{jsonpatch[_0xfc5e('0x22')](_0x1370c6,_0x1836f0,!![]);}catch(_0x3cee04){return BPromise[_0xfc5e('0x23')](_0x3cee04);}return _0x1370c6[_0xfc5e('0x24')]();};}function saveUpdates(_0x10ee7d,_0x4511a7){return function(_0x1ff706){if(_0x1ff706){return _0x1ff706[_0xfc5e('0x25')](_0x10ee7d)[_0xfc5e('0x26')](function(_0x5ec35e){return _0x5ec35e;});}return null;};}function removeEntity(_0x566f68,_0x274a77){return function(_0x236ad0){if(_0x236ad0){return _0x236ad0['destroy']()['then'](function(){_0x566f68[_0xfc5e('0x1a')](0xcc)[_0xfc5e('0x1b')]();});}};}function handleEntityNotFound(_0x3e8e7b,_0x4caf2f){return function(_0x2df413){if(!_0x2df413){_0x3e8e7b[_0xfc5e('0x19')](0x194);}return _0x2df413;};}function handleError(_0x2ded36,_0x544ad2){_0x544ad2=_0x544ad2||0x1f4;return function(_0x14ae69){logger[_0xfc5e('0x27')](_0x14ae69[_0xfc5e('0x28')]);if(_0x14ae69[_0xfc5e('0x29')]){delete _0x14ae69['name'];}_0x2ded36[_0xfc5e('0x1a')](_0x544ad2)[_0xfc5e('0x2a')](_0x14ae69);};}exports[_0xfc5e('0x2b')]=function(_0x19e5cd,_0x1c2d4a){var _0x4074f0={},_0x2791b0={},_0xb3888={'count':0x0,'rows':[]};var _0x1f9416=_['map'](db['VoiceQueueReport'][_0xfc5e('0x2c')],function(_0x454df8){return{'name':_0x454df8[_0xfc5e('0x2d')],'type':_0x454df8[_0xfc5e('0x2e')][_0xfc5e('0x2f')]};});_0x2791b0[_0xfc5e('0x30')]=_[_0xfc5e('0x31')](_0x1f9416,'name');_0x2791b0[_0xfc5e('0x32')]=_[_0xfc5e('0x33')](_0x19e5cd[_0xfc5e('0x32')]);_0x2791b0[_0xfc5e('0x34')]=_['intersection'](_0x2791b0['model'],_0x2791b0[_0xfc5e('0x32')]);_0x4074f0[_0xfc5e('0x35')]=_[_0xfc5e('0x36')](_0x2791b0[_0xfc5e('0x30')],qs[_0xfc5e('0x37')](_0x19e5cd[_0xfc5e('0x32')]['fields']));_0x4074f0[_0xfc5e('0x35')]=_0x4074f0[_0xfc5e('0x35')][_0xfc5e('0x38')]?_0x4074f0[_0xfc5e('0x35')]:_0x2791b0[_0xfc5e('0x30')];if(!_0x19e5cd[_0xfc5e('0x32')]['hasOwnProperty'](_0xfc5e('0x39'))){_0x4074f0[_0xfc5e('0x1f')]=qs[_0xfc5e('0x1f')](_0x19e5cd[_0xfc5e('0x32')][_0xfc5e('0x1f')]);_0x4074f0[_0xfc5e('0x1d')]=qs[_0xfc5e('0x1d')](_0x19e5cd['query'][_0xfc5e('0x1d')]);}_0x4074f0[_0xfc5e('0x3a')]=qs[_0xfc5e('0x3b')](_0x19e5cd[_0xfc5e('0x32')][_0xfc5e('0x3b')]);_0x4074f0[_0xfc5e('0x3c')]=qs[_0xfc5e('0x34')](_[_0xfc5e('0x3d')](_0x19e5cd['query'],_0x2791b0[_0xfc5e('0x34')]),_0x1f9416);if(_0x19e5cd[_0xfc5e('0x32')]['filter']){_0x4074f0[_0xfc5e('0x3c')]=_[_0xfc5e('0x3e')](_0x4074f0[_0xfc5e('0x3c')],{'$or':_[_0xfc5e('0x31')](_0x1f9416,function(_0x8bd247){if(_0x8bd247[_0xfc5e('0x2e')]!==_0xfc5e('0x3f')){var _0x559d2d={};_0x559d2d[_0x8bd247[_0xfc5e('0x29')]]={'$like':'%'+_0x19e5cd['query'][_0xfc5e('0x40')]+'%'};return _0x559d2d;}})});}_0x4074f0=_[_0xfc5e('0x3e')]({},_0x4074f0,_0x19e5cd[_0xfc5e('0x41')]);var _0x4295e3={'where':_0x4074f0[_0xfc5e('0x3c')]};return db[_0xfc5e('0x42')][_0xfc5e('0x20')](_0x4295e3)['then'](function(_0x5cf487){_0xb3888[_0xfc5e('0x20')]=_0x5cf487;if(_0x19e5cd[_0xfc5e('0x32')][_0xfc5e('0x43')]){_0x4074f0[_0xfc5e('0x44')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xfc5e('0x45')](_0x4074f0);})[_0xfc5e('0x26')](function(_0x4a4076){_0xb3888[_0xfc5e('0x46')]=_0x4a4076;return _0xb3888;})['then'](respondWithFilteredResult(_0x1c2d4a,_0x4074f0))[_0xfc5e('0x47')](handleError(_0x1c2d4a,null));};exports[_0xfc5e('0x48')]=function(_0x58fc61,_0x36ab98){var _0x49cba0={'raw':![],'where':{'id':_0x58fc61[_0xfc5e('0x49')]['id']}},_0x3822ba={};_0x3822ba[_0xfc5e('0x30')]=_[_0xfc5e('0x33')](db['VoiceQueueReport'][_0xfc5e('0x2c')]);_0x3822ba[_0xfc5e('0x32')]=_[_0xfc5e('0x33')](_0x58fc61['query']);_0x3822ba[_0xfc5e('0x34')]=_[_0xfc5e('0x36')](_0x3822ba[_0xfc5e('0x30')],_0x3822ba[_0xfc5e('0x32')]);_0x49cba0['attributes']=_['intersection'](_0x3822ba[_0xfc5e('0x30')],qs[_0xfc5e('0x37')](_0x58fc61['query']['fields']));_0x49cba0[_0xfc5e('0x35')]=_0x49cba0['attributes'][_0xfc5e('0x38')]?_0x49cba0[_0xfc5e('0x35')]:_0x3822ba[_0xfc5e('0x30')];if(_0x58fc61[_0xfc5e('0x32')]['includeAll']){_0x49cba0[_0xfc5e('0x44')]=[{'all':!![]}];}_0x49cba0=_['merge']({},_0x49cba0,_0x58fc61[_0xfc5e('0x41')]);return db[_0xfc5e('0x42')]['find'](_0x49cba0)[_0xfc5e('0x26')](handleEntityNotFound(_0x36ab98,null))[_0xfc5e('0x26')](respondWithResult(_0x36ab98,null))[_0xfc5e('0x47')](handleError(_0x36ab98,null));};exports[_0xfc5e('0x4a')]=function(_0xf43965,_0x1c6345){return db[_0xfc5e('0x42')][_0xfc5e('0x4a')](_0xf43965[_0xfc5e('0x4b')],{})['then'](respondWithResult(_0x1c6345,0xc9))['catch'](handleError(_0x1c6345,null));};exports[_0xfc5e('0x25')]=function(_0x1c1e2b,_0x201c03){if(_0x1c1e2b[_0xfc5e('0x4b')]['id']){delete _0x1c1e2b[_0xfc5e('0x4b')]['id'];}return db[_0xfc5e('0x42')][_0xfc5e('0x4c')]({'where':{'id':_0x1c1e2b[_0xfc5e('0x49')]['id']}})[_0xfc5e('0x26')](handleEntityNotFound(_0x201c03,null))[_0xfc5e('0x26')](saveUpdates(_0x1c1e2b[_0xfc5e('0x4b')],null))[_0xfc5e('0x26')](respondWithResult(_0x201c03,null))['catch'](handleError(_0x201c03,null));};exports[_0xfc5e('0x4d')]=function(_0xf73310,_0x313003){return db['VoiceQueueReport']['find']({'where':{'id':_0xf73310[_0xfc5e('0x49')]['id']}})[_0xfc5e('0x26')](handleEntityNotFound(_0x313003,null))['then'](removeEntity(_0x313003,null))[_0xfc5e('0x47')](handleError(_0x313003,null));};exports[_0xfc5e('0x4e')]=function(_0x153da1,_0x3449ed){return db['VoiceQueueReport']['describe']()[_0xfc5e('0x26')](respondWithResult(_0x3449ed,null))[_0xfc5e('0x47')](handleError(_0x3449ed,null));};exports[_0xfc5e('0x4f')]=function(_0xe18fba,_0x35b534){var _0x41a931={},_0x264496={},_0x4ea2a4={'count':0x0,'rows':[]};_0x264496[_0xfc5e('0x30')]=_[_0xfc5e('0x33')](db[_0xfc5e('0x42')]['rawAttributes']);_0x264496[_0xfc5e('0x32')]=_[_0xfc5e('0x33')](_0xe18fba[_0xfc5e('0x32')]);_0x264496[_0xfc5e('0x34')]=_[_0xfc5e('0x36')](_0x264496[_0xfc5e('0x30')],_0x264496[_0xfc5e('0x32')]);_0x41a931[_0xfc5e('0x35')]=_[_0xfc5e('0x36')](_0x264496['model'],qs[_0xfc5e('0x37')](_0xe18fba[_0xfc5e('0x32')][_0xfc5e('0x37')]));_0x41a931[_0xfc5e('0x35')]=_0x41a931[_0xfc5e('0x35')][_0xfc5e('0x38')]?_0x41a931[_0xfc5e('0x35')]:_0x264496[_0xfc5e('0x30')];if(!_0xe18fba[_0xfc5e('0x32')][_0xfc5e('0x50')](_0xfc5e('0x39'))){_0x41a931[_0xfc5e('0x1f')]=qs[_0xfc5e('0x1f')](_0xe18fba['query'][_0xfc5e('0x1f')]);_0x41a931[_0xfc5e('0x1d')]=qs['offset'](_0xe18fba[_0xfc5e('0x32')]['offset']);}_0x41a931[_0xfc5e('0x3a')]=qs[_0xfc5e('0x3b')](_0xe18fba['query'][_0xfc5e('0x3b')]);_0x41a931[_0xfc5e('0x3c')]=qs[_0xfc5e('0x34')](_[_0xfc5e('0x3d')](_0xe18fba[_0xfc5e('0x32')],_0x264496[_0xfc5e('0x34')]));if(_0xe18fba[_0xfc5e('0x32')][_0xfc5e('0x40')]){_0x41a931[_0xfc5e('0x3c')]=_[_0xfc5e('0x3e')](_0x41a931[_0xfc5e('0x3c')],{'$or':_[_0xfc5e('0x31')](_0x41a931[_0xfc5e('0x35')],function(_0x198998){var _0x519a68={};_0x519a68[_0x198998]={'$like':'%'+_0xe18fba[_0xfc5e('0x32')]['filter']+'%'};return _0x519a68;})});}_0x41a931=_[_0xfc5e('0x3e')]({},_0x41a931,_0xe18fba[_0xfc5e('0x41')]);var _0x4c3638={'where':_0x41a931[_0xfc5e('0x3c')]};return db['VoiceQueueReport'][_0xfc5e('0x20')](_0x4c3638)[_0xfc5e('0x26')](function(_0x11ff67){_0x4ea2a4[_0xfc5e('0x20')]=_0x11ff67;if(_0xe18fba[_0xfc5e('0x32')][_0xfc5e('0x43')]){_0x41a931[_0xfc5e('0x44')]=[{'all':!![]}];}return db[_0xfc5e('0x42')][_0xfc5e('0x45')](_0x41a931);})['then'](function(_0x5ac64c){_0x4ea2a4[_0xfc5e('0x46')]=_0x5ac64c;return _0x4ea2a4;})[_0xfc5e('0x26')](respondWithFilteredResult(_0x35b534,_0x41a931,_0xfc5e('0x4f')))[_0xfc5e('0x47')](handleError(_0x35b534,null,'getVoiceQueuesReport'));};
\ No newline at end of file
index 4915195..5edeef1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x37f7=['setMaxListeners','save','emit','exports','events','../../mysqldb','VoiceQueueReport'];(function(_0x15e6fe,_0x1a5c39){var _0x34894d=function(_0x32eec2){while(--_0x32eec2){_0x15e6fe['push'](_0x15e6fe['shift']());}};_0x34894d(++_0x1a5c39);}(_0x37f7,0x90));var _0x737f=function(_0x3b892a,_0x40ab0b){_0x3b892a=_0x3b892a-0x0;var _0x5e354f=_0x37f7[_0x3b892a];return _0x5e354f;};'use strict';var EventEmitter=require(_0x737f('0x0'));var VoiceQueueReport=require(_0x737f('0x1'))['db'][_0x737f('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x737f('0x3')](0x0);var events={'afterCreate':_0x737f('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3f7826){return function(_0x4d28d0,_0x1db173,_0x908a43){VoiceQueueReportEvents[_0x737f('0x5')](_0x3f7826+':'+_0x4d28d0['id'],_0x4d28d0);VoiceQueueReportEvents['emit'](_0x3f7826,_0x4d28d0);_0x908a43(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x737f('0x6')]=VoiceQueueReportEvents;
\ No newline at end of file
+var _0xaa9e=['save','emit','exports','events','VoiceQueueReport'];(function(_0x5cec4a,_0x2cb41e){var _0x2d64f4=function(_0x287b5e){while(--_0x287b5e){_0x5cec4a['push'](_0x5cec4a['shift']());}};_0x2d64f4(++_0x2cb41e);}(_0xaa9e,0x1ed));var _0xeaa9=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xaa9e[_0x55d8c5];return _0x225ae5;};'use strict';var EventEmitter=require(_0xeaa9('0x0'));var VoiceQueueReport=require('../../mysqldb')['db'][_0xeaa9('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xeaa9('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x7630e8){return function(_0x224528,_0x4219af,_0x119f7e){VoiceQueueReportEvents[_0xeaa9('0x3')](_0x7630e8+':'+_0x224528['id'],_0x224528);VoiceQueueReportEvents[_0xeaa9('0x3')](_0x7630e8,_0x224528);_0x119f7e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xeaa9('0x4')]=VoiceQueueReportEvents;
\ No newline at end of file
index d345a3b..1fa9237 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdac2=['define','report_queue','uniqueid','calleridnum','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x165db8,_0x3de335){var _0x19dd29=function(_0x261256){while(--_0x261256){_0x165db8['push'](_0x165db8['shift']());}};_0x19dd29(++_0x3de335);}(_0xdac2,0x154));var _0x2dac=function(_0x568f96,_0x32d489){_0x568f96=_0x568f96-0x0;var _0x5a053a=_0xdac2[_0x568f96];return _0x5a053a;};'use strict';var _=require(_0x2dac('0x0'));var util=require(_0x2dac('0x1'));var logger=require('../../config/logger')(_0x2dac('0x2'));var moment=require(_0x2dac('0x3'));var BPromise=require('bluebird');var rp=require(_0x2dac('0x4'));var fs=require('fs');var path=require(_0x2dac('0x5'));var rimraf=require(_0x2dac('0x6'));var config=require(_0x2dac('0x7'));var attributes=require(_0x2dac('0x8'));module[_0x2dac('0x9')]=function(_0x525eff,_0x272898){return _0x525eff[_0x2dac('0xa')]('VoiceQueueReport',attributes,{'tableName':_0x2dac('0xb'),'paranoid':![],'indexes':[{'fields':[_0x2dac('0xc')]},{'fields':[_0x2dac('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x01a3=['./voiceQueueReport.attributes','exports','define','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14efed,_0x16f631){var _0x3599c3=function(_0x385c31){while(--_0x385c31){_0x14efed['push'](_0x14efed['shift']());}};_0x3599c3(++_0x16f631);}(_0x01a3,0x13a));var _0x301a=function(_0x5440c1,_0x4efa2b){_0x5440c1=_0x5440c1-0x0;var _0x125394=_0x01a3[_0x5440c1];return _0x125394;};'use strict';var _=require(_0x301a('0x0'));var util=require(_0x301a('0x1'));var logger=require(_0x301a('0x2'))(_0x301a('0x3'));var moment=require(_0x301a('0x4'));var BPromise=require(_0x301a('0x5'));var rp=require(_0x301a('0x6'));var fs=require('fs');var path=require(_0x301a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x301a('0x8'));module[_0x301a('0x9')]=function(_0x33c685,_0x506808){return _0x33c685[_0x301a('0xa')]('VoiceQueueReport',attributes,{'tableName':_0x301a('0xb'),'paranoid':![],'indexes':[{'fields':[_0x301a('0xc')]},{'fields':[_0x301a('0xd')]}],'timestamps':!![]});};
\ No newline at end of file
index 6a60dad..b48f856 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa505=['create','body','debug','UpdateVoiceQueueReport','update','limit','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','include','model','map','CreateVoiceQueueReport'];(function(_0x11c929,_0x3a2f62){var _0x2989ef=function(_0x132fc5){while(--_0x132fc5){_0x11c929['push'](_0x11c929['shift']());}};_0x2989ef(++_0x3a2f62);}(_0xa505,0x177));var _0x5a50=function(_0xcbc362,_0x598ed1){_0xcbc362=_0xcbc362-0x0;var _0x54a952=_0xa505[_0xcbc362];return _0x54a952;};'use strict';var _=require('lodash');var util=require(_0x5a50('0x0'));var moment=require(_0x5a50('0x1'));var BPromise=require(_0x5a50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5a50('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5a50('0x4'))(_0x5a50('0x5'));var config=require('../../config/environment');var jayson=require(_0x5a50('0x6'));var client=jayson[_0x5a50('0x7')][_0x5a50('0x8')]({'port':0x232a});config[_0x5a50('0x9')]=_[_0x5a50('0xa')](config['redis'],{'host':_0x5a50('0xb'),'port':0x18eb});var socket=require(_0x5a50('0xc'))(new Redis(config[_0x5a50('0x9')]));require('./voiceQueueReport.socket')[_0x5a50('0xd')](socket);function respondWithRpcPromise(_0x3f3b1c,_0x43d9ff,_0x355fdf){return new BPromise(function(_0x295bce,_0x277f1e){return client[_0x5a50('0xe')](_0x3f3b1c,_0x355fdf)[_0x5a50('0xf')](function(_0x5c65eb){logger[_0x5a50('0x10')](_0x5a50('0x11'),_0x43d9ff,_0x5a50('0x12'));logger['debug']('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x43d9ff,_0x5a50('0x12'),JSON[_0x5a50('0x13')](_0x5c65eb));if(_0x5c65eb[_0x5a50('0x14')]){if(_0x5c65eb[_0x5a50('0x14')]['code']===0x1f4){logger[_0x5a50('0x14')](_0x5a50('0x11'),_0x43d9ff,_0x5c65eb['error'][_0x5a50('0x15')]);return _0x277f1e(_0x5c65eb[_0x5a50('0x14')][_0x5a50('0x15')]);}logger['error'](_0x5a50('0x11'),_0x43d9ff,_0x5c65eb[_0x5a50('0x14')][_0x5a50('0x15')]);return _0x295bce(_0x5c65eb['error'][_0x5a50('0x15')]);}else{logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x43d9ff,'request\x20sent');_0x295bce(_0x5c65eb[_0x5a50('0x16')]['message']);}})[_0x5a50('0x17')](function(_0x5d87e0){logger['error'](_0x5a50('0x11'),_0x43d9ff,_0x5d87e0);_0x277f1e(_0x5d87e0);});});}exports[_0x5a50('0x18')]=function(_0x5d805a){var _0x5a0318=this;return new Promise(function(_0x5ab139,_0x1d127f){return db[_0x5a50('0x19')][_0x5a50('0x1a')]({'raw':_0x5d805a[_0x5a50('0x1b')]?_0x5d805a[_0x5a50('0x1b')][_0x5a50('0x1c')]===undefined?!![]:![]:!![],'where':_0x5d805a[_0x5a50('0x1b')]?_0x5d805a[_0x5a50('0x1b')][_0x5a50('0x1d')]||null:null,'attributes':_0x5d805a[_0x5a50('0x1b')]?_0x5d805a[_0x5a50('0x1b')][_0x5a50('0x1e')]||null:null,'limit':_0x5d805a[_0x5a50('0x1b')]?_0x5d805a['options']['limit']||null:null,'include':_0x5d805a[_0x5a50('0x1b')]?_0x5d805a[_0x5a50('0x1b')][_0x5a50('0x1f')]?_['map'](_0x5d805a[_0x5a50('0x1b')][_0x5a50('0x1f')],function(_0x4b6d69){return{'model':db[_0x4b6d69[_0x5a50('0x20')]],'as':_0x4b6d69['as'],'attributes':_0x4b6d69[_0x5a50('0x1e')],'include':_0x4b6d69[_0x5a50('0x1f')]?_[_0x5a50('0x21')](_0x4b6d69['include'],function(_0x4516b1){return{'model':db[_0x4516b1[_0x5a50('0x20')]],'as':_0x4516b1['as'],'attributes':_0x4516b1['attributes'],'include':_0x4516b1['include']?_['map'](_0x4516b1[_0x5a50('0x1f')],function(_0x793ea1){return{'model':db[_0x793ea1[_0x5a50('0x20')]],'as':_0x793ea1['as'],'attributes':_0x793ea1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x546ea8){logger[_0x5a50('0x10')](_0x5a50('0x18'),_0x5d805a);logger['debug']('GetVoiceQueueReport',_0x5d805a,JSON[_0x5a50('0x13')](_0x546ea8));_0x5ab139(_0x546ea8);})[_0x5a50('0x17')](function(_0x3ea0c3){logger['error'](_0x5a50('0x18'),_0x3ea0c3['message'],_0x5d805a);_0x1d127f(_0x5a0318['error'](0x1f4,_0x3ea0c3['message']));});});};exports[_0x5a50('0x22')]=function(_0xdb8cee){var _0x11460e=this;return new Promise(function(_0x39bb85,_0x368ef2){return db[_0x5a50('0x19')][_0x5a50('0x23')](_0xdb8cee[_0x5a50('0x24')],{'raw':_0xdb8cee[_0x5a50('0x1b')]?_0xdb8cee[_0x5a50('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x5a50('0xf')](function(_0x3e505e){logger[_0x5a50('0x10')](_0x5a50('0x22'),_0xdb8cee);logger[_0x5a50('0x25')](_0x5a50('0x22'),_0xdb8cee,JSON[_0x5a50('0x13')](_0x3e505e));_0x39bb85(_0x3e505e);})[_0x5a50('0x17')](function(_0x521661){logger[_0x5a50('0x14')](_0x5a50('0x22'),_0x521661[_0x5a50('0x15')],_0xdb8cee);_0x368ef2(_0x11460e[_0x5a50('0x14')](0x1f4,_0x521661[_0x5a50('0x15')]));});});};exports[_0x5a50('0x26')]=function(_0x5e4513){var _0x5bb227=this;return new Promise(function(_0x45be3e,_0x4a5fc6){return db[_0x5a50('0x19')][_0x5a50('0x27')](_0x5e4513[_0x5a50('0x24')],{'raw':_0x5e4513[_0x5a50('0x1b')]?_0x5e4513[_0x5a50('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e4513[_0x5a50('0x1b')]?_0x5e4513['options'][_0x5a50('0x1d')]||null:null,'attributes':_0x5e4513['options']?_0x5e4513[_0x5a50('0x1b')][_0x5a50('0x1e')]||null:null,'limit':_0x5e4513['options']?_0x5e4513[_0x5a50('0x1b')][_0x5a50('0x28')]||null:null})['then'](function(_0x2b8a1a){logger[_0x5a50('0x10')](_0x5a50('0x26'),_0x5e4513);logger[_0x5a50('0x25')](_0x5a50('0x26'),_0x5e4513,JSON[_0x5a50('0x13')](_0x2b8a1a));_0x45be3e(_0x2b8a1a);})[_0x5a50('0x17')](function(_0x238761){logger[_0x5a50('0x14')]('UpdateVoiceQueueReport',_0x238761[_0x5a50('0x15')],_0x5e4513);_0x4a5fc6(_0x5bb227[_0x5a50('0x14')](0x1f4,_0x238761[_0x5a50('0x15')]));});});};
\ No newline at end of file
+var _0x1266=['randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueueReport.socket','register','request','then','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','info','result','catch','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','include','model','map','CreateVoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','lodash','util','moment'];(function(_0x41da69,_0x4751df){var _0x44fe91=function(_0x2930e3){while(--_0x2930e3){_0x41da69['push'](_0x41da69['shift']());}};_0x44fe91(++_0x4751df);}(_0x1266,0xd4));var _0x6126=function(_0xf2193a,_0x1c7dbf){_0xf2193a=_0xf2193a-0x0;var _0xf18f1d=_0x1266[_0xf2193a];return _0xf18f1d;};'use strict';var _=require(_0x6126('0x0'));var util=require(_0x6126('0x1'));var moment=require(_0x6126('0x2'));var BPromise=require('bluebird');var rs=require(_0x6126('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6126('0x4'))['db'];var utils=require(_0x6126('0x5'));var logger=require('../../config/logger')(_0x6126('0x6'));var config=require(_0x6126('0x7'));var jayson=require(_0x6126('0x8'));var client=jayson[_0x6126('0x9')]['http']({'port':0x232a});config[_0x6126('0xa')]=_[_0x6126('0xb')](config[_0x6126('0xa')],{'host':_0x6126('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6126('0xd'))[_0x6126('0xe')](socket);function respondWithRpcPromise(_0x2e3648,_0x41098f,_0x35fb25){return new BPromise(function(_0x545b8e,_0x35fbbe){return client[_0x6126('0xf')](_0x2e3648,_0x35fb25)[_0x6126('0x10')](function(_0xa05d6d){logger['info']('VoiceQueueReport,\x20%s,\x20%s',_0x41098f,_0x6126('0x11'));logger['debug'](_0x6126('0x12'),_0x41098f,_0x6126('0x11'),JSON[_0x6126('0x13')](_0xa05d6d));if(_0xa05d6d[_0x6126('0x14')]){if(_0xa05d6d['error'][_0x6126('0x15')]===0x1f4){logger[_0x6126('0x14')](_0x6126('0x16'),_0x41098f,_0xa05d6d['error'][_0x6126('0x17')]);return _0x35fbbe(_0xa05d6d['error'][_0x6126('0x17')]);}logger[_0x6126('0x14')](_0x6126('0x16'),_0x41098f,_0xa05d6d['error'][_0x6126('0x17')]);return _0x545b8e(_0xa05d6d['error'][_0x6126('0x17')]);}else{logger[_0x6126('0x18')](_0x6126('0x16'),_0x41098f,'request\x20sent');_0x545b8e(_0xa05d6d[_0x6126('0x19')][_0x6126('0x17')]);}})[_0x6126('0x1a')](function(_0xac2bb7){logger[_0x6126('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x41098f,_0xac2bb7);_0x35fbbe(_0xac2bb7);});});}exports[_0x6126('0x1b')]=function(_0x907f88){var _0x1afff2=this;return new Promise(function(_0x818e2e,_0x83dfdd){return db[_0x6126('0x1c')][_0x6126('0x1d')]({'raw':_0x907f88[_0x6126('0x1e')]?_0x907f88['options'][_0x6126('0x1f')]===undefined?!![]:![]:!![],'where':_0x907f88['options']?_0x907f88['options'][_0x6126('0x20')]||null:null,'attributes':_0x907f88[_0x6126('0x1e')]?_0x907f88[_0x6126('0x1e')][_0x6126('0x21')]||null:null,'limit':_0x907f88[_0x6126('0x1e')]?_0x907f88['options'][_0x6126('0x22')]||null:null,'include':_0x907f88[_0x6126('0x1e')]?_0x907f88['options']['include']?_['map'](_0x907f88[_0x6126('0x1e')][_0x6126('0x23')],function(_0x4a710d){return{'model':db[_0x4a710d[_0x6126('0x24')]],'as':_0x4a710d['as'],'attributes':_0x4a710d[_0x6126('0x21')],'include':_0x4a710d['include']?_['map'](_0x4a710d['include'],function(_0x3b82f3){return{'model':db[_0x3b82f3[_0x6126('0x24')]],'as':_0x3b82f3['as'],'attributes':_0x3b82f3['attributes'],'include':_0x3b82f3[_0x6126('0x23')]?_[_0x6126('0x25')](_0x3b82f3[_0x6126('0x23')],function(_0x2639c2){return{'model':db[_0x2639c2[_0x6126('0x24')]],'as':_0x2639c2['as'],'attributes':_0x2639c2[_0x6126('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6126('0x10')](function(_0x52af37){logger[_0x6126('0x18')]('GetVoiceQueueReport',_0x907f88);logger['debug'](_0x6126('0x1b'),_0x907f88,JSON[_0x6126('0x13')](_0x52af37));_0x818e2e(_0x52af37);})[_0x6126('0x1a')](function(_0x460bd3){logger['error'](_0x6126('0x1b'),_0x460bd3[_0x6126('0x17')],_0x907f88);_0x83dfdd(_0x1afff2[_0x6126('0x14')](0x1f4,_0x460bd3[_0x6126('0x17')]));});});};exports[_0x6126('0x26')]=function(_0x3e2313){var _0x13fa6f=this;return new Promise(function(_0x50f3d2,_0x3a4a06){return db[_0x6126('0x1c')][_0x6126('0x27')](_0x3e2313[_0x6126('0x28')],{'raw':_0x3e2313[_0x6126('0x1e')]?_0x3e2313['options'][_0x6126('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x12d05b){logger[_0x6126('0x18')](_0x6126('0x26'),_0x3e2313);logger[_0x6126('0x29')](_0x6126('0x26'),_0x3e2313,JSON[_0x6126('0x13')](_0x12d05b));_0x50f3d2(_0x12d05b);})['catch'](function(_0x172483){logger[_0x6126('0x14')](_0x6126('0x26'),_0x172483['message'],_0x3e2313);_0x3a4a06(_0x13fa6f[_0x6126('0x14')](0x1f4,_0x172483['message']));});});};exports[_0x6126('0x2a')]=function(_0x5964dd){var _0xad8a10=this;return new Promise(function(_0x50398f,_0x4759f6){return db[_0x6126('0x1c')]['update'](_0x5964dd['body'],{'raw':_0x5964dd[_0x6126('0x1e')]?_0x5964dd[_0x6126('0x1e')][_0x6126('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5964dd[_0x6126('0x1e')]?_0x5964dd[_0x6126('0x1e')]['where']||null:null,'attributes':_0x5964dd[_0x6126('0x1e')]?_0x5964dd['options'][_0x6126('0x21')]||null:null,'limit':_0x5964dd['options']?_0x5964dd[_0x6126('0x1e')][_0x6126('0x22')]||null:null})[_0x6126('0x10')](function(_0x2ce2dd){logger[_0x6126('0x18')](_0x6126('0x2a'),_0x5964dd);logger[_0x6126('0x29')]('UpdateVoiceQueueReport',_0x5964dd,JSON[_0x6126('0x13')](_0x2ce2dd));_0x50398f(_0x2ce2dd);})['catch'](function(_0x2c1529){logger[_0x6126('0x14')](_0x6126('0x2a'),_0x2c1529['message'],_0x5964dd);_0x4759f6(_0xad8a10[_0x6126('0x14')](0x1f4,_0x2c1529['message']));});});};
\ No newline at end of file
index 448565c..9d1e68f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8fed=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','length','voiceQueueReport:'];(function(_0x59407a,_0xa684c1){var _0x1f2559=function(_0x593e5c){while(--_0x593e5c){_0x59407a['push'](_0x59407a['shift']());}};_0x1f2559(++_0xa684c1);}(_0x8fed,0xab));var _0xd8fe=function(_0xd86893,_0x260ddd){_0xd86893=_0xd86893-0x0;var _0x48495a=_0x8fed[_0xd86893];return _0x48495a;};'use strict';var VoiceQueueReportEvents=require(_0xd8fe('0x0'));var events=[_0xd8fe('0x1'),_0xd8fe('0x2'),_0xd8fe('0x3')];function createListener(_0x354e07,_0x24215b){return function(_0x7ef3d7){_0x24215b[_0xd8fe('0x4')](_0x354e07,_0x7ef3d7);};}function removeListener(_0x398e5f,_0x3e2a87){return function(){VoiceQueueReportEvents[_0xd8fe('0x5')](_0x398e5f,_0x3e2a87);};}exports[_0xd8fe('0x6')]=function(_0x343d98){for(var _0x143f41=0x0,_0x5642f9=events[_0xd8fe('0x7')];_0x143f41<_0x5642f9;_0x143f41++){var _0x366a21=events[_0x143f41];var _0x4e4598=createListener(_0xd8fe('0x8')+_0x366a21,_0x343d98);VoiceQueueReportEvents['on'](_0x366a21,_0x4e4598);}};
\ No newline at end of file
+var _0x872a=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x3c3f14,_0x43b666){var _0x7068cd=function(_0x3db43c){while(--_0x3db43c){_0x3c3f14['push'](_0x3c3f14['shift']());}};_0x7068cd(++_0x43b666);}(_0x872a,0x100));var _0xa872=function(_0x450087,_0x7cae40){_0x450087=_0x450087-0x0;var _0x420929=_0x872a[_0x450087];return _0x420929;};'use strict';var VoiceQueueReportEvents=require(_0xa872('0x0'));var events=[_0xa872('0x1'),_0xa872('0x2'),_0xa872('0x3')];function createListener(_0x4a2170,_0x48294d){return function(_0x4c6509){_0x48294d[_0xa872('0x4')](_0x4a2170,_0x4c6509);};}function removeListener(_0x58715a,_0x2854a7){return function(){VoiceQueueReportEvents[_0xa872('0x5')](_0x58715a,_0x2854a7);};}exports[_0xa872('0x6')]=function(_0x1c8d2f){for(var _0x3e3cd4=0x0,_0x4aab9d=events[_0xa872('0x7')];_0x3e3cd4<_0x4aab9d;_0x3e3cd4++){var _0x1b87b7=events[_0x3e3cd4];var _0x1e0c05=createListener(_0xa872('0x8')+_0x1b87b7,_0x1c8d2f);VoiceQueueReportEvents['on'](_0x1b87b7,_0x1e0c05);}};
\ No newline at end of file
index b50875c..cdcc6ac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e48=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','post','create','exports','util','express'];(function(_0x261e29,_0x10fffd){var _0x25ef43=function(_0x21b8e7){while(--_0x21b8e7){_0x261e29['push'](_0x261e29['shift']());}};_0x25ef43(++_0x10fffd);}(_0x6e48,0x16e));var _0x86e4=function(_0x5a9178,_0x2c30ad){_0x5a9178=_0x5a9178-0x0;var _0x436896=_0x6e48[_0x5a9178];return _0x436896;};'use strict';var multer=require('multer');var util=require(_0x86e4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x86e4('0x1'));var router=express[_0x86e4('0x2')]();var fs_extra=require(_0x86e4('0x3'));var auth=require(_0x86e4('0x4'));var interaction=require(_0x86e4('0x5'));var config=require(_0x86e4('0x6'));var controller=require(_0x86e4('0x7'));router[_0x86e4('0x8')]('/',auth[_0x86e4('0x9')](),controller[_0x86e4('0xa')]);router[_0x86e4('0x8')](_0x86e4('0xb'),auth[_0x86e4('0x9')](),controller[_0x86e4('0xc')]);router[_0x86e4('0xd')]('/',auth[_0x86e4('0x9')](),controller[_0x86e4('0xe')]);router['put'](_0x86e4('0xb'),auth[_0x86e4('0x9')](),controller['update']);router['delete'](_0x86e4('0xb'),auth[_0x86e4('0x9')](),controller['destroy']);module[_0x86e4('0xf')]=router;
\ No newline at end of file
+var _0x4ef1=['/:id','show','post','create','put','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated'];(function(_0x30cb58,_0x560b63){var _0x1ea023=function(_0x111f7b){while(--_0x111f7b){_0x30cb58['push'](_0x30cb58['shift']());}};_0x1ea023(++_0x560b63);}(_0x4ef1,0xeb));var _0x14ef=function(_0xb65f0c,_0xe60c57){_0xb65f0c=_0xb65f0c-0x0;var _0x2ff246=_0x4ef1[_0xb65f0c];return _0x2ff246;};'use strict';var multer=require(_0x14ef('0x0'));var util=require(_0x14ef('0x1'));var path=require('path');var timeout=require(_0x14ef('0x2'));var express=require(_0x14ef('0x3'));var router=express[_0x14ef('0x4')]();var fs_extra=require(_0x14ef('0x5'));var auth=require(_0x14ef('0x6'));var interaction=require(_0x14ef('0x7'));var config=require(_0x14ef('0x8'));var controller=require(_0x14ef('0x9'));router[_0x14ef('0xa')]('/',auth[_0x14ef('0xb')](),controller['index']);router[_0x14ef('0xa')](_0x14ef('0xc'),auth['isAuthenticated'](),controller[_0x14ef('0xd')]);router[_0x14ef('0xe')]('/',auth[_0x14ef('0xb')](),controller[_0x14ef('0xf')]);router[_0x14ef('0x10')]('/:id',auth[_0x14ef('0xb')](),controller['update']);router[_0x14ef('0x11')](_0x14ef('0xc'),auth[_0x14ef('0xb')](),controller[_0x14ef('0x12')]);module['exports']=router;
\ No newline at end of file
index fe76e2b..3662580 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a51=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x1a51,0xe5));var _0x11a5=function(_0x54f40a,_0x5e2964){_0x54f40a=_0x54f40a-0x0;var _0x15bb24=_0x1a51[_0x54f40a];return _0x15bb24;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x11a5('0x0'));module['exports']={'time':{'type':Sequelize[_0x11a5('0x1')]},'callid':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x11a5('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x11a5('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x11a5('0x3')](_0x11a5('0x4'))}};
\ No newline at end of file
+var _0xf2be=['STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','moment','exports'];(function(_0x1b3224,_0x3351d9){var _0x5dae4f=function(_0x22894a){while(--_0x22894a){_0x1b3224['push'](_0x1b3224['shift']());}};_0x5dae4f(++_0x3351d9);}(_0xf2be,0x1d2));var _0xef2b=function(_0x352c54,_0x52c1f6){_0x352c54=_0x352c54-0x0;var _0x1f134d=_0xf2be[_0x352c54];return _0x1f134d;};'use strict';var Sequelize=require(_0xef2b('0x0'));var moment=require(_0xef2b('0x1'));module[_0xef2b('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xef2b('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xef2b('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xef2b('0x5')](_0xef2b('0x6'))}};
\ No newline at end of file
index 0ab6628..aac1661 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x135a=['keys','rawAttributes','length','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','end','offset','limit','count','status','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','index','map','VoiceQueuesLog','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x4f2914,_0x533ca9){var _0x4325de=function(_0x1ec8ab){while(--_0x1ec8ab){_0x4f2914['push'](_0x4f2914['shift']());}};_0x4325de(++_0x533ca9);}(_0x135a,0x97));var _0xa135=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x135a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xa135('0x0'));var rimraf=require(_0xa135('0x1'));var zipdir=require(_0xa135('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa135('0x3'));var moment=require(_0xa135('0x4'));var BPromise=require(_0xa135('0x5'));var Mustache=require('mustache');var util=require(_0xa135('0x6'));var path=require(_0xa135('0x7'));var sox=require(_0xa135('0x8'));var csv=require(_0xa135('0x9'));var ejs=require(_0xa135('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa135('0xb'));var squel=require(_0xa135('0xc'));var crypto=require('crypto');var jsforce=require(_0xa135('0xd'));var deskjs=require(_0xa135('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa135('0xf'));var Papa=require('papaparse');var Redis=require(_0xa135('0x10'));var authService=require(_0xa135('0x11'));var qs=require(_0xa135('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa135('0x13'));var logger=require(_0xa135('0x14'))(_0xa135('0x15'));var utils=require(_0xa135('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2166bd,_0x502eb1){_0x502eb1=_0x502eb1||0xcc;return function(_0x270eef){if(_0x270eef){return _0x2166bd[_0xa135('0x17')](_0x502eb1);}return _0x2166bd['status'](_0x502eb1)[_0xa135('0x18')]();};}function respondWithResult(_0x1c72ad,_0x23db34){_0x23db34=_0x23db34||0xc8;return function(_0x1b7f5b){if(_0x1b7f5b){return _0x1c72ad['status'](_0x23db34)['json'](_0x1b7f5b);}};}function respondWithFilteredResult(_0x4a1d25,_0x2d9bda){return function(_0x2c7ff9){if(_0x2c7ff9){var _0x3d6c7e=typeof _0x2d9bda[_0xa135('0x19')]==='undefined'&&typeof _0x2d9bda[_0xa135('0x1a')]==='undefined';var _0x365076=_0x2c7ff9[_0xa135('0x1b')];var _0x21d9f1=_0x3d6c7e?0x0:_0x2d9bda[_0xa135('0x19')];var _0x2ae404=_0x3d6c7e?_0x2c7ff9['count']:_0x2d9bda[_0xa135('0x19')]+_0x2d9bda['limit'];var _0x484ee9;if(_0x2ae404>=_0x365076){_0x2ae404=_0x365076;_0x484ee9=0xc8;}else{_0x484ee9=0xce;}_0x4a1d25[_0xa135('0x1c')](_0x484ee9);return _0x4a1d25['set'](_0xa135('0x1d'),_0x21d9f1+'-'+_0x2ae404+'/'+_0x365076)[_0xa135('0x1e')](_0x2c7ff9);}return null;};}function patchUpdates(_0x51a4bd){return function(_0x5efa10){try{jsonpatch[_0xa135('0x1f')](_0x5efa10,_0x51a4bd,!![]);}catch(_0x35d9e8){return BPromise[_0xa135('0x20')](_0x35d9e8);}return _0x5efa10[_0xa135('0x21')]();};}function saveUpdates(_0x4578ee,_0x4d24f6){return function(_0xa2d643){if(_0xa2d643){return _0xa2d643[_0xa135('0x22')](_0x4578ee)[_0xa135('0x23')](function(_0x5013d5){return _0x5013d5;});}return null;};}function removeEntity(_0x56efd4,_0x18fd63){return function(_0x13be3d){if(_0x13be3d){return _0x13be3d[_0xa135('0x24')]()[_0xa135('0x23')](function(){_0x56efd4[_0xa135('0x1c')](0xcc)[_0xa135('0x18')]();});}};}function handleEntityNotFound(_0x5c97d2,_0x19fb6d){return function(_0x115ae2){if(!_0x115ae2){_0x5c97d2[_0xa135('0x17')](0x194);}return _0x115ae2;};}function handleError(_0x1a0efa,_0x37285a){_0x37285a=_0x37285a||0x1f4;return function(_0x11fae1){logger[_0xa135('0x25')](_0x11fae1[_0xa135('0x26')]);if(_0x11fae1[_0xa135('0x27')]){delete _0x11fae1[_0xa135('0x27')];}_0x1a0efa[_0xa135('0x1c')](_0x37285a)['send'](_0x11fae1);};}exports[_0xa135('0x28')]=function(_0x822d02,_0x193c75){var _0x4e1eb0={},_0x2cb29c={},_0xc39a2c={'count':0x0,'rows':[]};var _0x48d6af=_[_0xa135('0x29')](db[_0xa135('0x2a')]['rawAttributes'],function(_0x13e388){return{'name':_0x13e388[_0xa135('0x2b')],'type':_0x13e388[_0xa135('0x2c')]['key']};});_0x2cb29c[_0xa135('0x2d')]=_['map'](_0x48d6af,_0xa135('0x27'));_0x2cb29c[_0xa135('0x2e')]=_['keys'](_0x822d02['query']);_0x2cb29c[_0xa135('0x2f')]=_[_0xa135('0x30')](_0x2cb29c[_0xa135('0x2d')],_0x2cb29c['query']);_0x4e1eb0['attributes']=_[_0xa135('0x30')](_0x2cb29c[_0xa135('0x2d')],qs[_0xa135('0x31')](_0x822d02[_0xa135('0x2e')]['fields']));_0x4e1eb0[_0xa135('0x32')]=_0x4e1eb0['attributes']['length']?_0x4e1eb0['attributes']:_0x2cb29c[_0xa135('0x2d')];if(!_0x822d02[_0xa135('0x2e')][_0xa135('0x33')](_0xa135('0x34'))){_0x4e1eb0[_0xa135('0x1a')]=qs['limit'](_0x822d02[_0xa135('0x2e')]['limit']);_0x4e1eb0[_0xa135('0x19')]=qs[_0xa135('0x19')](_0x822d02[_0xa135('0x2e')][_0xa135('0x19')]);}_0x4e1eb0[_0xa135('0x35')]=qs[_0xa135('0x36')](_0x822d02[_0xa135('0x2e')]['sort']);_0x4e1eb0[_0xa135('0x37')]=qs[_0xa135('0x2f')](_[_0xa135('0x38')](_0x822d02[_0xa135('0x2e')],_0x2cb29c[_0xa135('0x2f')]),_0x48d6af);if(_0x822d02['query'][_0xa135('0x39')]){_0x4e1eb0['where']=_[_0xa135('0x3a')](_0x4e1eb0[_0xa135('0x37')],{'$or':_[_0xa135('0x29')](_0x48d6af,function(_0x2d38f1){if(_0x2d38f1[_0xa135('0x2c')]!==_0xa135('0x3b')){var _0x8924f4={};_0x8924f4[_0x2d38f1['name']]={'$like':'%'+_0x822d02[_0xa135('0x2e')][_0xa135('0x39')]+'%'};return _0x8924f4;}})});}_0x4e1eb0=_[_0xa135('0x3a')]({},_0x4e1eb0,_0x822d02[_0xa135('0x3c')]);var _0x5a8fa0={'where':_0x4e1eb0[_0xa135('0x37')]};return db[_0xa135('0x2a')][_0xa135('0x1b')](_0x5a8fa0)[_0xa135('0x23')](function(_0x5c393d){_0xc39a2c['count']=_0x5c393d;if(_0x822d02[_0xa135('0x2e')][_0xa135('0x3d')]){_0x4e1eb0[_0xa135('0x3e')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0xa135('0x3f')](_0x4e1eb0);})['then'](function(_0x2571c6){_0xc39a2c[_0xa135('0x40')]=_0x2571c6;return _0xc39a2c;})[_0xa135('0x23')](respondWithFilteredResult(_0x193c75,_0x4e1eb0))[_0xa135('0x41')](handleError(_0x193c75,null));};exports[_0xa135('0x42')]=function(_0x29dc24,_0x3411a6){var _0x1796ea={'raw':!![],'where':{'id':_0x29dc24[_0xa135('0x43')]['id']}},_0x46ca7e={};_0x46ca7e['model']=_[_0xa135('0x44')](db[_0xa135('0x2a')][_0xa135('0x45')]);_0x46ca7e[_0xa135('0x2e')]=_[_0xa135('0x44')](_0x29dc24[_0xa135('0x2e')]);_0x46ca7e[_0xa135('0x2f')]=_[_0xa135('0x30')](_0x46ca7e[_0xa135('0x2d')],_0x46ca7e[_0xa135('0x2e')]);_0x1796ea['attributes']=_[_0xa135('0x30')](_0x46ca7e[_0xa135('0x2d')],qs[_0xa135('0x31')](_0x29dc24[_0xa135('0x2e')][_0xa135('0x31')]));_0x1796ea[_0xa135('0x32')]=_0x1796ea[_0xa135('0x32')][_0xa135('0x46')]?_0x1796ea[_0xa135('0x32')]:_0x46ca7e['model'];if(_0x29dc24[_0xa135('0x2e')][_0xa135('0x3d')]){_0x1796ea[_0xa135('0x3e')]=[{'all':!![]}];}_0x1796ea=_[_0xa135('0x3a')]({},_0x1796ea,_0x29dc24[_0xa135('0x3c')]);return db['VoiceQueuesLog']['find'](_0x1796ea)[_0xa135('0x23')](handleEntityNotFound(_0x3411a6,null))[_0xa135('0x23')](respondWithResult(_0x3411a6,null))[_0xa135('0x41')](handleError(_0x3411a6,null));};exports['create']=function(_0x4dca02,_0x14bc36){return db[_0xa135('0x2a')]['create'](_0x4dca02[_0xa135('0x47')],{})[_0xa135('0x23')](respondWithResult(_0x14bc36,0xc9))[_0xa135('0x41')](handleError(_0x14bc36,null));};exports[_0xa135('0x22')]=function(_0x24305a,_0x3d1ec8){if(_0x24305a['body']['id']){delete _0x24305a['body']['id'];}return db[_0xa135('0x2a')][_0xa135('0x48')]({'where':{'id':_0x24305a[_0xa135('0x43')]['id']}})[_0xa135('0x23')](handleEntityNotFound(_0x3d1ec8,null))[_0xa135('0x23')](saveUpdates(_0x24305a['body'],null))[_0xa135('0x23')](respondWithResult(_0x3d1ec8,null))[_0xa135('0x41')](handleError(_0x3d1ec8,null));};exports[_0xa135('0x24')]=function(_0x496f20,_0x1318f8){return db[_0xa135('0x2a')][_0xa135('0x48')]({'where':{'id':_0x496f20['params']['id']}})['then'](handleEntityNotFound(_0x1318f8,null))['then'](removeEntity(_0x1318f8,null))[_0xa135('0x41')](handleError(_0x1318f8,null));};
\ No newline at end of file
+var _0x98e2=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','VoiceQueuesLog','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','include','findAll','catch','rawAttributes','options','find','create','body','params','destroy','eml-format','rimraf','zip-dir'];(function(_0x413944,_0x1f8ba4){var _0x35f812=function(_0x4495eb){while(--_0x4495eb){_0x413944['push'](_0x413944['shift']());}};_0x35f812(++_0x1f8ba4);}(_0x98e2,0xdb));var _0x298e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x98e2[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x298e('0x0'));var rimraf=require(_0x298e('0x1'));var zipdir=require(_0x298e('0x2'));var jsonpatch=require(_0x298e('0x3'));var rp=require(_0x298e('0x4'));var moment=require(_0x298e('0x5'));var BPromise=require(_0x298e('0x6'));var Mustache=require(_0x298e('0x7'));var util=require(_0x298e('0x8'));var path=require(_0x298e('0x9'));var sox=require(_0x298e('0xa'));var csv=require(_0x298e('0xb'));var ejs=require(_0x298e('0xc'));var fs=require('fs');var fs_extra=require(_0x298e('0xd'));var _=require(_0x298e('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x298e('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x298e('0xb'));var querystring=require('querystring');var Papa=require(_0x298e('0x10'));var Redis=require(_0x298e('0x11'));var authService=require(_0x298e('0x12'));var qs=require(_0x298e('0x13'));var as=require(_0x298e('0x14'));var hardwareService=require(_0x298e('0x15'));var logger=require(_0x298e('0x16'))(_0x298e('0x17'));var utils=require(_0x298e('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x298e('0x19'))['db'];function respondWithStatusCode(_0x203d55,_0x54950a){_0x54950a=_0x54950a||0xcc;return function(_0x46fde2){if(_0x46fde2){return _0x203d55[_0x298e('0x1a')](_0x54950a);}return _0x203d55[_0x298e('0x1b')](_0x54950a)[_0x298e('0x1c')]();};}function respondWithResult(_0xbb56a5,_0x2906f9){_0x2906f9=_0x2906f9||0xc8;return function(_0x134a2b){if(_0x134a2b){return _0xbb56a5[_0x298e('0x1b')](_0x2906f9)[_0x298e('0x1d')](_0x134a2b);}};}function respondWithFilteredResult(_0x4906b2,_0x28f115){return function(_0x3775d7){if(_0x3775d7){var _0x4e6fe9=typeof _0x28f115[_0x298e('0x1e')]===_0x298e('0x1f')&&typeof _0x28f115[_0x298e('0x20')]===_0x298e('0x1f');var _0x35b8ae=_0x3775d7[_0x298e('0x21')];var _0x45dd99=_0x4e6fe9?0x0:_0x28f115['offset'];var _0x51b2b7=_0x4e6fe9?_0x3775d7[_0x298e('0x21')]:_0x28f115[_0x298e('0x1e')]+_0x28f115[_0x298e('0x20')];var _0x37ce3b;if(_0x51b2b7>=_0x35b8ae){_0x51b2b7=_0x35b8ae;_0x37ce3b=0xc8;}else{_0x37ce3b=0xce;}_0x4906b2[_0x298e('0x1b')](_0x37ce3b);return _0x4906b2[_0x298e('0x22')](_0x298e('0x23'),_0x45dd99+'-'+_0x51b2b7+'/'+_0x35b8ae)['json'](_0x3775d7);}return null;};}function patchUpdates(_0x5cba98){return function(_0x34ec32){try{jsonpatch[_0x298e('0x24')](_0x34ec32,_0x5cba98,!![]);}catch(_0x1a5870){return BPromise[_0x298e('0x25')](_0x1a5870);}return _0x34ec32[_0x298e('0x26')]();};}function saveUpdates(_0x11b756,_0x599782){return function(_0x49c204){if(_0x49c204){return _0x49c204[_0x298e('0x27')](_0x11b756)[_0x298e('0x28')](function(_0x9f0ad6){return _0x9f0ad6;});}return null;};}function removeEntity(_0x58c9da,_0x444955){return function(_0x134499){if(_0x134499){return _0x134499['destroy']()[_0x298e('0x28')](function(){_0x58c9da['status'](0xcc)[_0x298e('0x1c')]();});}};}function handleEntityNotFound(_0x56faf0,_0x269b40){return function(_0x7fa78a){if(!_0x7fa78a){_0x56faf0[_0x298e('0x1a')](0x194);}return _0x7fa78a;};}function handleError(_0x27919e,_0x3c9083){_0x3c9083=_0x3c9083||0x1f4;return function(_0x431d5a){logger[_0x298e('0x29')](_0x431d5a['stack']);if(_0x431d5a[_0x298e('0x2a')]){delete _0x431d5a[_0x298e('0x2a')];}_0x27919e[_0x298e('0x1b')](_0x3c9083)[_0x298e('0x2b')](_0x431d5a);};}exports[_0x298e('0x2c')]=function(_0x207155,_0x557811){var _0x1053bd={},_0x2c32d7={},_0x523cc1={'count':0x0,'rows':[]};var _0x47493c=_[_0x298e('0x2d')](db[_0x298e('0x2e')]['rawAttributes'],function(_0x2825a0){return{'name':_0x2825a0[_0x298e('0x2f')],'type':_0x2825a0['type'][_0x298e('0x30')]};});_0x2c32d7[_0x298e('0x31')]=_['map'](_0x47493c,_0x298e('0x2a'));_0x2c32d7[_0x298e('0x32')]=_[_0x298e('0x33')](_0x207155[_0x298e('0x32')]);_0x2c32d7[_0x298e('0x34')]=_['intersection'](_0x2c32d7[_0x298e('0x31')],_0x2c32d7[_0x298e('0x32')]);_0x1053bd[_0x298e('0x35')]=_[_0x298e('0x36')](_0x2c32d7['model'],qs['fields'](_0x207155[_0x298e('0x32')][_0x298e('0x37')]));_0x1053bd[_0x298e('0x35')]=_0x1053bd['attributes'][_0x298e('0x38')]?_0x1053bd[_0x298e('0x35')]:_0x2c32d7[_0x298e('0x31')];if(!_0x207155['query'][_0x298e('0x39')]('nolimit')){_0x1053bd['limit']=qs[_0x298e('0x20')](_0x207155['query'][_0x298e('0x20')]);_0x1053bd[_0x298e('0x1e')]=qs[_0x298e('0x1e')](_0x207155[_0x298e('0x32')]['offset']);}_0x1053bd['order']=qs[_0x298e('0x3a')](_0x207155[_0x298e('0x32')][_0x298e('0x3a')]);_0x1053bd[_0x298e('0x3b')]=qs['filters'](_[_0x298e('0x3c')](_0x207155[_0x298e('0x32')],_0x2c32d7[_0x298e('0x34')]),_0x47493c);if(_0x207155[_0x298e('0x32')][_0x298e('0x3d')]){_0x1053bd[_0x298e('0x3b')]=_[_0x298e('0x3e')](_0x1053bd[_0x298e('0x3b')],{'$or':_[_0x298e('0x2d')](_0x47493c,function(_0x523c31){if(_0x523c31[_0x298e('0x3f')]!=='VIRTUAL'){var _0xe1d59d={};_0xe1d59d[_0x523c31[_0x298e('0x2a')]]={'$like':'%'+_0x207155[_0x298e('0x32')][_0x298e('0x3d')]+'%'};return _0xe1d59d;}})});}_0x1053bd=_[_0x298e('0x3e')]({},_0x1053bd,_0x207155['options']);var _0x3f6bcd={'where':_0x1053bd[_0x298e('0x3b')]};return db[_0x298e('0x2e')][_0x298e('0x21')](_0x3f6bcd)[_0x298e('0x28')](function(_0x1a1676){_0x523cc1[_0x298e('0x21')]=_0x1a1676;if(_0x207155[_0x298e('0x32')]['includeAll']){_0x1053bd[_0x298e('0x40')]=[{'all':!![]}];}return db[_0x298e('0x2e')][_0x298e('0x41')](_0x1053bd);})[_0x298e('0x28')](function(_0x5d492d){_0x523cc1['rows']=_0x5d492d;return _0x523cc1;})[_0x298e('0x28')](respondWithFilteredResult(_0x557811,_0x1053bd))[_0x298e('0x42')](handleError(_0x557811,null));};exports['show']=function(_0x275a61,_0x4e3468){var _0x40cc80={'raw':!![],'where':{'id':_0x275a61['params']['id']}},_0x563040={};_0x563040[_0x298e('0x31')]=_[_0x298e('0x33')](db['VoiceQueuesLog'][_0x298e('0x43')]);_0x563040[_0x298e('0x32')]=_[_0x298e('0x33')](_0x275a61[_0x298e('0x32')]);_0x563040['filters']=_[_0x298e('0x36')](_0x563040['model'],_0x563040['query']);_0x40cc80[_0x298e('0x35')]=_[_0x298e('0x36')](_0x563040[_0x298e('0x31')],qs['fields'](_0x275a61[_0x298e('0x32')][_0x298e('0x37')]));_0x40cc80['attributes']=_0x40cc80[_0x298e('0x35')][_0x298e('0x38')]?_0x40cc80['attributes']:_0x563040[_0x298e('0x31')];if(_0x275a61[_0x298e('0x32')]['includeAll']){_0x40cc80['include']=[{'all':!![]}];}_0x40cc80=_['merge']({},_0x40cc80,_0x275a61[_0x298e('0x44')]);return db['VoiceQueuesLog'][_0x298e('0x45')](_0x40cc80)[_0x298e('0x28')](handleEntityNotFound(_0x4e3468,null))['then'](respondWithResult(_0x4e3468,null))['catch'](handleError(_0x4e3468,null));};exports[_0x298e('0x46')]=function(_0x432c99,_0x11fe68){return db[_0x298e('0x2e')][_0x298e('0x46')](_0x432c99[_0x298e('0x47')],{})[_0x298e('0x28')](respondWithResult(_0x11fe68,0xc9))[_0x298e('0x42')](handleError(_0x11fe68,null));};exports[_0x298e('0x27')]=function(_0x2e0c42,_0x5ab72e){if(_0x2e0c42[_0x298e('0x47')]['id']){delete _0x2e0c42[_0x298e('0x47')]['id'];}return db['VoiceQueuesLog'][_0x298e('0x45')]({'where':{'id':_0x2e0c42[_0x298e('0x48')]['id']}})[_0x298e('0x28')](handleEntityNotFound(_0x5ab72e,null))[_0x298e('0x28')](saveUpdates(_0x2e0c42[_0x298e('0x47')],null))['then'](respondWithResult(_0x5ab72e,null))[_0x298e('0x42')](handleError(_0x5ab72e,null));};exports[_0x298e('0x49')]=function(_0x177a00,_0x53488f){return db[_0x298e('0x2e')]['find']({'where':{'id':_0x177a00['params']['id']}})[_0x298e('0x28')](handleEntityNotFound(_0x53488f,null))['then'](removeEntity(_0x53488f,null))[_0x298e('0x42')](handleError(_0x53488f,null));};
\ No newline at end of file
index d45ac72..5897385 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbe79=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','event_dtm','dtm','lodash','util','../../config/logger'];(function(_0x58c029,_0x556da1){var _0x209542=function(_0x548389){while(--_0x548389){_0x58c029['push'](_0x58c029['shift']());}};_0x209542(++_0x556da1);}(_0xbe79,0x169));var _0x9be7=function(_0x2461fe,_0x40aafe){_0x2461fe=_0x2461fe-0x0;var _0x505f1a=_0xbe79[_0x2461fe];return _0x505f1a;};'use strict';var _=require(_0x9be7('0x0'));var util=require(_0x9be7('0x1'));var logger=require(_0x9be7('0x2'))(_0x9be7('0x3'));var moment=require(_0x9be7('0x4'));var BPromise=require('bluebird');var rp=require(_0x9be7('0x5'));var fs=require('fs');var path=require(_0x9be7('0x6'));var rimraf=require(_0x9be7('0x7'));var config=require(_0x9be7('0x8'));var attributes=require(_0x9be7('0x9'));module[_0x9be7('0xa')]=function(_0x57b111,_0x2ddcb5){return _0x57b111[_0x9be7('0xb')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x9be7('0xc'),'fields':['event',_0x9be7('0xd')]}],'timestamps':![]});};
\ No newline at end of file
+var _0x79c6=['voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog'];(function(_0xa4a02b,_0x4bc67b){var _0x179ce2=function(_0x481edd){while(--_0x481edd){_0xa4a02b['push'](_0xa4a02b['shift']());}};_0x179ce2(++_0x4bc67b);}(_0x79c6,0x158));var _0x679c=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x79c6[_0x3e6729];return _0x535bcd;};'use strict';var _=require(_0x679c('0x0'));var util=require(_0x679c('0x1'));var logger=require(_0x679c('0x2'))('api');var moment=require(_0x679c('0x3'));var BPromise=require(_0x679c('0x4'));var rp=require(_0x679c('0x5'));var fs=require('fs');var path=require(_0x679c('0x6'));var rimraf=require(_0x679c('0x7'));var config=require(_0x679c('0x8'));var attributes=require(_0x679c('0x9'));module[_0x679c('0xa')]=function(_0xc5407,_0x41b4b1){return _0xc5407[_0x679c('0xb')](_0x679c('0xc'),attributes,{'tableName':_0x679c('0xd'),'paranoid':![],'indexes':[{'name':_0x679c('0xe'),'fields':[_0x679c('0xf'),_0x679c('0x10')]}],'timestamps':![]});};
\ No newline at end of file
index ef10ee5..bfbc8ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x05c2=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x51a97d,_0x5707c8){var _0x2132fd=function(_0x5d7c14){while(--_0x5d7c14){_0x51a97d['push'](_0x51a97d['shift']());}};_0x2132fd(++_0x5707c8);}(_0x05c2,0x174));var _0x205c=function(_0x2facd6,_0x47864d){_0x2facd6=_0x2facd6-0x0;var _0x44cd6a=_0x05c2[_0x2facd6];return _0x44cd6a;};'use strict';var _=require(_0x205c('0x0'));var util=require(_0x205c('0x1'));var moment=require('moment');var BPromise=require(_0x205c('0x2'));var rs=require(_0x205c('0x3'));var fs=require('fs');var Redis=require(_0x205c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x205c('0x5'));var logger=require(_0x205c('0x6'))(_0x205c('0x7'));var config=require(_0x205c('0x8'));var jayson=require(_0x205c('0x9'));var client=jayson[_0x205c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x172b64,_0x11a90a,_0x465185){return new BPromise(function(_0x293b3d,_0x194eb6){return client['request'](_0x172b64,_0x465185)[_0x205c('0xb')](function(_0x3cc048){logger[_0x205c('0xc')](_0x205c('0xd'),_0x11a90a,_0x205c('0xe'));logger[_0x205c('0xf')](_0x205c('0x10'),_0x11a90a,_0x205c('0xe'),JSON[_0x205c('0x11')](_0x3cc048));if(_0x3cc048['error']){if(_0x3cc048[_0x205c('0x12')]['code']===0x1f4){logger['error'](_0x205c('0xd'),_0x11a90a,_0x3cc048[_0x205c('0x12')][_0x205c('0x13')]);return _0x194eb6(_0x3cc048[_0x205c('0x12')][_0x205c('0x13')]);}logger[_0x205c('0x12')](_0x205c('0xd'),_0x11a90a,_0x3cc048[_0x205c('0x12')][_0x205c('0x13')]);return _0x293b3d(_0x3cc048[_0x205c('0x12')][_0x205c('0x13')]);}else{logger[_0x205c('0xc')](_0x205c('0xd'),_0x11a90a,'request\x20sent');_0x293b3d(_0x3cc048[_0x205c('0x14')][_0x205c('0x13')]);}})['catch'](function(_0x3b3026){logger[_0x205c('0x12')](_0x205c('0xd'),_0x11a90a,_0x3b3026);_0x194eb6(_0x3b3026);});});}
\ No newline at end of file
+var _0xba78=['message','result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','error','code'];(function(_0x34ae53,_0x382394){var _0x4d6fd8=function(_0x3ba293){while(--_0x3ba293){_0x34ae53['push'](_0x34ae53['shift']());}};_0x4d6fd8(++_0x382394);}(_0xba78,0x159));var _0x8ba7=function(_0x4e2bbb,_0x407e05){_0x4e2bbb=_0x4e2bbb-0x0;var _0x4b6e8c=_0xba78[_0x4e2bbb];return _0x4b6e8c;};'use strict';var _=require(_0x8ba7('0x0'));var util=require('util');var moment=require(_0x8ba7('0x1'));var BPromise=require(_0x8ba7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ba7('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8ba7('0x4'))(_0x8ba7('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8ba7('0x6')][_0x8ba7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d310e,_0x2c0180,_0x1e33fb){return new BPromise(function(_0x276d74,_0x429d6b){return client[_0x8ba7('0x8')](_0x5d310e,_0x1e33fb)['then'](function(_0xdafa31){logger[_0x8ba7('0x9')](_0x8ba7('0xa'),_0x2c0180,_0x8ba7('0xb'));logger[_0x8ba7('0xc')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2c0180,_0x8ba7('0xb'),JSON['stringify'](_0xdafa31));if(_0xdafa31[_0x8ba7('0xd')]){if(_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xe')]===0x1f4){logger[_0x8ba7('0xd')](_0x8ba7('0xa'),_0x2c0180,_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xf')]);return _0x429d6b(_0xdafa31['error'][_0x8ba7('0xf')]);}logger[_0x8ba7('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2c0180,_0xdafa31['error'][_0x8ba7('0xf')]);return _0x276d74(_0xdafa31[_0x8ba7('0xd')][_0x8ba7('0xf')]);}else{logger['info'](_0x8ba7('0xa'),_0x2c0180,_0x8ba7('0xb'));_0x276d74(_0xdafa31[_0x8ba7('0x10')][_0x8ba7('0xf')]);}})[_0x8ba7('0x11')](function(_0x554991){logger[_0x8ba7('0xd')](_0x8ba7('0xa'),_0x2c0180,_0x554991);_0x429d6b(_0x554991);});});}
\ No newline at end of file
index 2eea67d..59d56de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4335=['isAuthenticated','index','get','/describe','describe','/:id','show','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x25818b,_0x3b3afb){var _0x40928a=function(_0x2532c4){while(--_0x2532c4){_0x25818b['push'](_0x25818b['shift']());}};_0x40928a(++_0x3b3afb);}(_0x4335,0x9a));var _0x5433=function(_0xf48cce,_0x3531e4){_0xf48cce=_0xf48cce-0x0;var _0x2a5c38=_0x4335[_0xf48cce];return _0x2a5c38;};'use strict';var multer=require(_0x5433('0x0'));var util=require(_0x5433('0x1'));var path=require(_0x5433('0x2'));var timeout=require('connect-timeout');var express=require(_0x5433('0x3'));var router=express[_0x5433('0x4')]();var fs_extra=require(_0x5433('0x5'));var auth=require(_0x5433('0x6'));var interaction=require(_0x5433('0x7'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router['get']('/',auth[_0x5433('0x8')](),controller[_0x5433('0x9')]);router[_0x5433('0xa')](_0x5433('0xb'),auth['isAuthenticated'](),controller[_0x5433('0xc')]);router['get'](_0x5433('0xd'),auth[_0x5433('0x8')](),controller[_0x5433('0xe')]);router['get']('/:id/download',auth[_0x5433('0x8')](),controller[_0x5433('0xf')]);router['get']('/:id/downloads',controller[_0x5433('0x10')]);router[_0x5433('0xa')](_0x5433('0x11'),auth[_0x5433('0x8')](),controller[_0x5433('0x12')]);router[_0x5433('0x13')]('/',auth['isAuthenticated'](),controller[_0x5433('0x14')]);router[_0x5433('0x13')](_0x5433('0x11'),auth[_0x5433('0x8')](),controller[_0x5433('0x15')]);router[_0x5433('0x16')](_0x5433('0xd'),auth[_0x5433('0x8')](),controller[_0x5433('0x17')]);router[_0x5433('0x18')](_0x5433('0xd'),auth[_0x5433('0x8')](),controller[_0x5433('0x19')]);module[_0x5433('0x1a')]=router;
\ No newline at end of file
+var _0xfed6=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','downloads','downloadTranscribe','post','create','/:id/transcribe','runTranscribe','/:id','util'];(function(_0x270f18,_0x8155e9){var _0x39d745=function(_0x294bdd){while(--_0x294bdd){_0x270f18['push'](_0x270f18['shift']());}};_0x39d745(++_0x8155e9);}(_0xfed6,0x18b));var _0x6fed=function(_0x30ebbd,_0x3f51d8){_0x30ebbd=_0x30ebbd-0x0;var _0xc3b968=_0xfed6[_0x30ebbd];return _0xc3b968;};'use strict';var multer=require('multer');var util=require(_0x6fed('0x0'));var path=require(_0x6fed('0x1'));var timeout=require(_0x6fed('0x2'));var express=require(_0x6fed('0x3'));var router=express['Router']();var fs_extra=require(_0x6fed('0x4'));var auth=require(_0x6fed('0x5'));var interaction=require(_0x6fed('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x6fed('0x7')]('/',auth[_0x6fed('0x8')](),controller[_0x6fed('0x9')]);router[_0x6fed('0x7')](_0x6fed('0xa'),auth['isAuthenticated'](),controller[_0x6fed('0xb')]);router[_0x6fed('0x7')]('/:id',auth[_0x6fed('0x8')](),controller[_0x6fed('0xc')]);router[_0x6fed('0x7')](_0x6fed('0xd'),auth[_0x6fed('0x8')](),controller[_0x6fed('0xe')]);router[_0x6fed('0x7')]('/:id/downloads',controller[_0x6fed('0xf')]);router[_0x6fed('0x7')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x6fed('0x10')]);router[_0x6fed('0x11')]('/',auth['isAuthenticated'](),controller[_0x6fed('0x12')]);router['post'](_0x6fed('0x13'),auth[_0x6fed('0x8')](),controller[_0x6fed('0x14')]);router['put'](_0x6fed('0x15'),auth[_0x6fed('0x8')](),controller['update']);router['delete'](_0x6fed('0x15'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router;
\ No newline at end of file
index 7dd5586..ea4918d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}};
\ No newline at end of file
+var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}};
\ No newline at end of file
index fe990db..6a8093a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe916=['startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','Location','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','bucket','Transcribe\x20not\x20configured','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','runSentiment','updateAttributes','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','differenceBy','map','format','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','VoiceRecording','findAll','rows','params','keys','find','catch','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','send','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','decryptFile','extname','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','createBucket','TranscribeService'];(function(_0x45ce08,_0x59dcc7){var _0x23dff2=function(_0x1ad0e5){while(--_0x1ad0e5){_0x45ce08['push'](_0x45ce08['shift']());}};_0x23dff2(++_0x59dcc7);}(_0xe916,0xcb));var _0x6e91=function(_0x568aa7,_0x95b37b){_0x568aa7=_0x568aa7-0x0;var _0x1f9e8f=_0xe916[_0x568aa7];return _0x1f9e8f;};'use strict';var emlformat=require(_0x6e91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6e91('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6e91('0x2'));var BPromise=require(_0x6e91('0x3'));var Mustache=require(_0x6e91('0x4'));var util=require(_0x6e91('0x5'));var path=require(_0x6e91('0x6'));var sox=require(_0x6e91('0x7'));var csv=require(_0x6e91('0x8'));var ejs=require(_0x6e91('0x9'));var fs=require('fs');var fs_extra=require(_0x6e91('0xa'));var _=require(_0x6e91('0xb'));var squel=require(_0x6e91('0xc'));var crypto=require(_0x6e91('0xd'));var jsforce=require(_0x6e91('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x6e91('0x8'));var querystring=require(_0x6e91('0xf'));var Papa=require(_0x6e91('0x10'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x6e91('0x11'));var authService=require(_0x6e91('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6e91('0x13'));var hardwareService=require(_0x6e91('0x14'));var logger=require('../../config/logger')(_0x6e91('0x15'));var utils=require(_0x6e91('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x6e91('0x17'));var db=require(_0x6e91('0x18'))['db'];function respondWithStatusCode(_0x1465b6,_0x394caf){_0x394caf=_0x394caf||0xcc;return function(_0x27eac2){if(_0x27eac2){return _0x1465b6[_0x6e91('0x19')](_0x394caf);}return _0x1465b6[_0x6e91('0x1a')](_0x394caf)[_0x6e91('0x1b')]();};}function respondWithResult(_0x35cad6,_0x17260b){_0x17260b=_0x17260b||0xc8;return function(_0xf26032){if(_0xf26032){return _0x35cad6[_0x6e91('0x1a')](_0x17260b)[_0x6e91('0x1c')](_0xf26032);}};}function respondWithFilteredResult(_0x2246af,_0x5b208f){return function(_0x357b1d){if(_0x357b1d){var _0x2c1c3a=typeof _0x5b208f['offset']===_0x6e91('0x1d')&&typeof _0x5b208f[_0x6e91('0x1e')]===_0x6e91('0x1d');var _0x495733=_0x357b1d[_0x6e91('0x1f')];var _0x25b412=_0x2c1c3a?0x0:_0x5b208f[_0x6e91('0x20')];var _0x207915=_0x2c1c3a?_0x357b1d[_0x6e91('0x1f')]:_0x5b208f['offset']+_0x5b208f[_0x6e91('0x1e')];var _0x189a9b;if(_0x207915>=_0x495733){_0x207915=_0x495733;_0x189a9b=0xc8;}else{_0x189a9b=0xce;}_0x2246af[_0x6e91('0x1a')](_0x189a9b);return _0x2246af[_0x6e91('0x21')]('Content-Range',_0x25b412+'-'+_0x207915+'/'+_0x495733)[_0x6e91('0x1c')](_0x357b1d);}return null;};}function patchUpdates(_0x1ab6cf){return function(_0x3379cb){try{jsonpatch[_0x6e91('0x22')](_0x3379cb,_0x1ab6cf,!![]);}catch(_0x3acd3b){return BPromise[_0x6e91('0x23')](_0x3acd3b);}return _0x3379cb['save']();};}function saveUpdates(_0x23209f,_0x5665c3){return function(_0x1f3d4a){if(_0x1f3d4a){return _0x1f3d4a[_0x6e91('0x24')](_0x23209f)[_0x6e91('0x25')](function(_0x5a631a){return _0x5a631a;});}return null;};}function removeEntity(_0x46b484,_0x5b7ce8){return function(_0x574085){if(_0x574085){return _0x574085[_0x6e91('0x26')]()[_0x6e91('0x25')](function(){_0x46b484[_0x6e91('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51d6c0,_0x4044a8){return function(_0x5cd3c2){if(!_0x5cd3c2){_0x51d6c0[_0x6e91('0x19')](0x194);}return _0x5cd3c2;};}function handleError(_0x35d0f6,_0x505fdf){_0x505fdf=_0x505fdf||0x1f4;return function(_0x465cd3){logger[_0x6e91('0x27')](_0x465cd3[_0x6e91('0x28')]);if(_0x465cd3['name']){delete _0x465cd3[_0x6e91('0x29')];}_0x35d0f6[_0x6e91('0x1a')](_0x505fdf)['send'](_0x465cd3);};}exports[_0x6e91('0x2a')]=function(_0x557d1b,_0x712280){var _0x5a1195={},_0x17ddf5={},_0x92b268={'count':0x0,'rows':[]};var _0x3098ae=_['map'](db['VoiceRecording'][_0x6e91('0x2b')],function(_0x12c69b){return{'name':_0x12c69b[_0x6e91('0x2c')],'type':_0x12c69b[_0x6e91('0x2d')][_0x6e91('0x2e')]};});_0x17ddf5[_0x6e91('0x2f')]=_[_0x6e91('0x30')](_[_0x6e91('0x31')](_0x3098ae,_0x6e91('0x29')),[_0x6e91('0x32')]);_0x17ddf5[_0x6e91('0x33')]=_['keys'](_0x557d1b['query']);_0x17ddf5[_0x6e91('0x34')]=_[_0x6e91('0x35')](_0x17ddf5[_0x6e91('0x2f')],_0x17ddf5['query']);_0x5a1195[_0x6e91('0x36')]=_[_0x6e91('0x35')](_0x17ddf5[_0x6e91('0x2f')],qs[_0x6e91('0x37')](_0x557d1b[_0x6e91('0x33')]['fields']));_0x5a1195[_0x6e91('0x36')]=_0x5a1195[_0x6e91('0x36')][_0x6e91('0x38')]?_0x5a1195[_0x6e91('0x36')]:_0x17ddf5[_0x6e91('0x2f')];if(!_0x557d1b[_0x6e91('0x33')][_0x6e91('0x39')](_0x6e91('0x3a'))){_0x5a1195[_0x6e91('0x1e')]=qs[_0x6e91('0x1e')](_0x557d1b['query'][_0x6e91('0x1e')]);_0x5a1195[_0x6e91('0x20')]=qs['offset'](_0x557d1b['query'][_0x6e91('0x20')]);}_0x5a1195[_0x6e91('0x3b')]=qs[_0x6e91('0x3c')](_0x557d1b[_0x6e91('0x33')][_0x6e91('0x3c')]);_0x5a1195[_0x6e91('0x3d')]=qs[_0x6e91('0x34')](_['pick'](_0x557d1b['query'],_0x17ddf5['filters']),_0x3098ae);if(_0x557d1b['query'][_0x6e91('0x3e')]){_0x5a1195[_0x6e91('0x3d')]=_[_0x6e91('0x3f')](_0x5a1195[_0x6e91('0x3d')],{'$or':_[_0x6e91('0x31')](_0x3098ae,function(_0x2faa8c){if(_0x2faa8c['type']!==_0x6e91('0x40')){var _0x1bb317={};_0x1bb317[_0x2faa8c['name']]={'$like':'%'+_0x557d1b[_0x6e91('0x33')][_0x6e91('0x3e')]+'%'};return _0x1bb317;}})});}_0x5a1195=_[_0x6e91('0x3f')]({},_0x5a1195,_0x557d1b[_0x6e91('0x41')]);var _0x41368d={'where':_0x5a1195['where']};return db['VoiceRecording']['count'](_0x41368d)[_0x6e91('0x25')](function(_0x231904){_0x92b268[_0x6e91('0x1f')]=_0x231904;if(_0x557d1b['query'][_0x6e91('0x42')]){_0x5a1195[_0x6e91('0x43')]=[{'all':!![]}];}return db[_0x6e91('0x44')][_0x6e91('0x45')](_0x5a1195);})[_0x6e91('0x25')](function(_0x5edcad){_0x92b268[_0x6e91('0x46')]=_0x5edcad;return _0x92b268;})[_0x6e91('0x25')](respondWithFilteredResult(_0x712280,_0x5a1195))['catch'](handleError(_0x712280,null));};exports['show']=function(_0x8cc3,_0x41fecc){var _0x1ec077={'raw':![],'where':{'id':_0x8cc3[_0x6e91('0x47')]['id']}},_0x1aaa25={};_0x1aaa25['model']=_[_0x6e91('0x48')](db[_0x6e91('0x44')][_0x6e91('0x2b')]);_0x1aaa25[_0x6e91('0x33')]=_[_0x6e91('0x48')](_0x8cc3[_0x6e91('0x33')]);_0x1aaa25[_0x6e91('0x34')]=_['intersection'](_0x1aaa25[_0x6e91('0x2f')],_0x1aaa25['query']);_0x1ec077['attributes']=_[_0x6e91('0x35')](_0x1aaa25['model'],qs[_0x6e91('0x37')](_0x8cc3[_0x6e91('0x33')][_0x6e91('0x37')]));_0x1ec077[_0x6e91('0x36')]=_0x1ec077[_0x6e91('0x36')]['length']?_0x1ec077[_0x6e91('0x36')]:_0x1aaa25[_0x6e91('0x2f')];if(_0x8cc3[_0x6e91('0x33')]['includeAll']){_0x1ec077[_0x6e91('0x43')]=[{'all':!![]}];}_0x1ec077=_[_0x6e91('0x3f')]({},_0x1ec077,_0x8cc3[_0x6e91('0x41')]);return db[_0x6e91('0x44')][_0x6e91('0x49')](_0x1ec077)[_0x6e91('0x25')](handleEntityNotFound(_0x41fecc,null))[_0x6e91('0x25')](respondWithResult(_0x41fecc,null))[_0x6e91('0x4a')](handleError(_0x41fecc,null));};exports[_0x6e91('0x4b')]=function(_0x68e885,_0x3cf734){return db[_0x6e91('0x44')][_0x6e91('0x4b')](_0x68e885[_0x6e91('0x4c')],{})[_0x6e91('0x25')](respondWithResult(_0x3cf734,0xc9))['catch'](handleError(_0x3cf734,null));};exports[_0x6e91('0x24')]=function(_0x57fab4,_0x535ec8){if(_0x57fab4[_0x6e91('0x4c')]['id']){delete _0x57fab4[_0x6e91('0x4c')]['id'];}return db[_0x6e91('0x44')][_0x6e91('0x49')]({'where':{'id':_0x57fab4[_0x6e91('0x47')]['id']}})[_0x6e91('0x25')](handleEntityNotFound(_0x535ec8,null))['then'](saveUpdates(_0x57fab4[_0x6e91('0x4c')],null))[_0x6e91('0x25')](respondWithResult(_0x535ec8,null))[_0x6e91('0x4a')](handleError(_0x535ec8,null));};exports[_0x6e91('0x4d')]=function(_0x1e994a,_0x2801ce){return db[_0x6e91('0x44')][_0x6e91('0x4d')]()[_0x6e91('0x25')](respondWithResult(_0x2801ce,null))[_0x6e91('0x4a')](handleError(_0x2801ce,null));};exports[_0x6e91('0x4e')]=function(_0x5a24e2,_0x529087,_0x1e1b99){var _0x22d609=require('../../components/encryptor');var _0x27166a=![];var _0x5f58f5={};if(_0x5a24e2[_0x6e91('0x33')][_0x6e91('0x2d')]&&_0x5a24e2['query'][_0x6e91('0x2d')]===_0x6e91('0x4f')){_0x5f58f5[_0x6e91('0x4f')]=_0x5a24e2[_0x6e91('0x47')]['id'];}else{_0x5f58f5['id']=_0x5a24e2[_0x6e91('0x47')]['id'];}return db[_0x6e91('0x44')][_0x6e91('0x49')]({'where':_0x5f58f5,'attributes':['id',_0x6e91('0x50')],'raw':!![]})[_0x6e91('0x25')](handleEntityNotFound(_0x529087,null))[_0x6e91('0x25')](function(_0x40cd22){if(_0x40cd22){var _0x3c166e=_0x40cd22[_0x6e91('0x50')];var _0x3899cc=util[_0x6e91('0x32')](_0x6e91('0x51'),_0x3c166e);if(fs[_0x6e91('0x52')](_0x3899cc)){_0x27166a=!![];return _0x22d609['decryptFile'](_0x3899cc,_0x3c166e,config[_0x6e91('0x53')][_0x6e91('0x54')])[_0x6e91('0x25')](function(){return _0x40cd22;});}return _0x40cd22;}})[_0x6e91('0x25')](function(_0x152e60){if(_0x152e60){var _0x1af547=_0x152e60[_0x6e91('0x50')];if(!fs[_0x6e91('0x52')](_0x1af547)){throw new db[(_0x6e91('0x55'))][(_0x6e91('0x56'))](_0x6e91('0x57'));}if(_0x152e60[_0x6e91('0x58')]){return _0x529087[_0x6e91('0x4e')](_0x1af547,_0x152e60['filename']+path['extname'](_0x1af547),function(){if(_0x27166a){fs[_0x6e91('0x59')](_0x1af547);}});}else{return _0x529087[_0x6e91('0x4e')](_0x1af547,function(_0x40b125){if(_0x27166a){fs['unlink'](_0x1af547);}});}}})[_0x6e91('0x4a')](function(_0x57675e){if(_0x57675e[_0x6e91('0x5a')]===_0x6e91('0x57')){_0x529087[_0x6e91('0x1a')](0x194)[_0x6e91('0x5b')]('Not\x20found');}else{return handleError(_0x529087,null);}});};exports[_0x6e91('0x5c')]=function(_0x1be771,_0x418011,_0x492105){var _0x41e2db=require(_0x6e91('0x5d'));var _0x287117=![];var _0x31645c={'$and':[db[_0x6e91('0x5e')][_0x6e91('0x3d')](db[_0x6e91('0x5e')]['fn'](_0x6e91('0x5f'),db[_0x6e91('0x5e')][_0x6e91('0x60')](_0x6e91('0x4f'))),_0x1be771[_0x6e91('0x33')][_0x6e91('0x61')])]};if(_0x1be771[_0x6e91('0x33')]['type']&&_0x1be771[_0x6e91('0x33')][_0x6e91('0x2d')]===_0x6e91('0x4f')){_0x31645c['$and']['push']({'uniqueid':_0x1be771['params']['id']});}else{_0x31645c[_0x6e91('0x62')][_0x6e91('0x63')]({'id':_0x1be771[_0x6e91('0x47')]['id']});}return db['VoiceRecording'][_0x6e91('0x49')]({'where':_0x31645c,'attributes':['id',_0x6e91('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x418011,null))['then'](function(_0x2cabb0){if(_0x2cabb0){var _0x5aef42=util['format'](_0x6e91('0x51'),_0x2cabb0[_0x6e91('0x50')]);if(fs[_0x6e91('0x52')](_0x5aef42)){_0x287117=!![];return _0x41e2db[_0x6e91('0x64')](_0x5aef42,_0x2cabb0[_0x6e91('0x50')],config['secrets']['recording'])[_0x6e91('0x25')](function(){return _0x2cabb0;});}return _0x2cabb0;}})[_0x6e91('0x25')](function(_0x49fd5c){if(_0x49fd5c){if(!fs['existsSync'](_0x49fd5c[_0x6e91('0x50')])){throw new db['Sequelize'][(_0x6e91('0x56'))](_0x6e91('0x57'));}if(_0x49fd5c[_0x6e91('0x58')]){return _0x418011[_0x6e91('0x4e')](_0x49fd5c[_0x6e91('0x50')],_0x49fd5c['filename']+path[_0x6e91('0x65')](_0x49fd5c[_0x6e91('0x50')]),function(){if(_0x287117){fs[_0x6e91('0x59')](_0x49fd5c[_0x6e91('0x50')]);}});}else{return _0x418011['download'](_0x49fd5c[_0x6e91('0x50')],function(_0x25a79f){if(_0x287117){fs['unlink'](_0x49fd5c[_0x6e91('0x50')]);}});}}})[_0x6e91('0x4a')](handleError(_0x418011,null));};exports[_0x6e91('0x26')]=function(_0x493d7c,_0x33f132){return db[_0x6e91('0x44')][_0x6e91('0x49')]({'where':{'id':_0x493d7c[_0x6e91('0x47')]['id']}})['then'](function(_0x47d9b2){if(_[_0x6e91('0x66')](_0x47d9b2)){throw new ReferenceError(_0x6e91('0x67'));}return _0x47d9b2;})[_0x6e91('0x25')](function(_0x4da443){var _0x597ec6=_0x4da443['value'];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x597ec6);if(!_[_0x6e91('0x66')](_0x4da443[_0x6e91('0x50')])&&fs[_0x6e91('0x52')](_0x597ec6)){logger[_0x6e91('0x68')](_0x6e91('0x69')+_0x597ec6+_0x6e91('0x6a'));fs[_0x6e91('0x6b')](_0x597ec6);}_0x597ec6=_0x597ec6+_0x6e91('0x6c');if(!_[_0x6e91('0x66')](_0x4da443[_0x6e91('0x50')])&&fs['existsSync'](_0x597ec6)){logger[_0x6e91('0x68')](_0x6e91('0x69')+_0x597ec6+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6e91('0x6b')](_0x597ec6);}return _0x4da443;})['then'](function(_0x18a9c9){if(!_0x18a9c9)throw new InternalError();return _0x18a9c9[_0x6e91('0x26')]();})[_0x6e91('0x25')](function(){_0x33f132[_0x6e91('0x1a')](0xcc)[_0x6e91('0x1b')]();})['catch'](handleError(_0x33f132,null));};function getBucketslist(_0x39dd42,_0x426278,_0xca8a52){return new Promise(function(_0x57a428,_0x233859){var _0x1a5a86=new AWS['S3']({'accessKeyId':_0x426278,'secretAccessKey':_0x39dd42,'region':_0xca8a52});_0x1a5a86['listBuckets']({},function(_0x5860df,_0x519b2f){if(_0x5860df){return _0x233859(_0x5860df);}else{return _0x57a428(_0x519b2f);}});});}function createBucket(_0xae1e9d,_0x17aeb9,_0x3c7b36,_0xf3276){return new Promise(function(_0x306763,_0x2ef4ca){var _0xd80f=new AWS['S3']({'accessKeyId':_0x17aeb9,'secretAccessKey':_0xae1e9d,'region':_0x3c7b36});_0xd80f[_0x6e91('0x6d')]({'Bucket':_0xf3276},function(_0xe33604,_0x222278){if(_0xe33604){return _0x2ef4ca(_0xe33604);}else{return _0x306763(_0x222278);}});});}function uploadFile(_0x2b236e,_0x3fd609,_0x348362,_0x366b19,_0x344ce2,_0x235625){return new Promise(function(_0x1f43cf,_0x2e2210){var _0xad83f3=new AWS['S3']({'accessKeyId':_0x3fd609,'secretAccessKey':_0x2b236e,'region':_0x348362});_0xad83f3['upload']({'Bucket':_0x366b19,'Key':_0x344ce2,'Body':_0x235625},function(_0x5c2bb8,_0x4e3183){if(_0x5c2bb8){return _0x2e2210(_0x5c2bb8);}else{return _0x1f43cf(_0x4e3183);}});});}function startTranscribe(_0x1e1a8b,_0x76321d,_0x4611d0,_0x274251,_0x177679,_0x23227b){return new Promise(function(_0xc666b5,_0x13ec3c){var _0x210675=new AWS[(_0x6e91('0x6e'))]({'accessKeyId':_0x76321d,'secretAccessKey':_0x1e1a8b,'region':_0x4611d0});_0x210675[_0x6e91('0x6f')]({'TranscriptionJobName':_0x274251,'LanguageCode':_0x177679,'Media':{'MediaFileUri':_0x23227b}},function(_0x393260,_0x51e899){if(_0x393260){return _0x13ec3c(_0x393260);}else{return _0xc666b5(_0x51e899);}});});}function transcribe(_0x1a49bf,_0x23e396,_0x3d751a,_0x14079f,_0x417d2f,_0x300fcb,_0x4f756e){return new Promise(function(_0x1718b9,_0x133650){var _0x32dba7={};logger[_0x6e91('0x68')](util[_0x6e91('0x32')](_0x6e91('0x70'),_0x1a49bf,_0x417d2f));return uploadFile(_0x23e396,_0x3d751a,_0x14079f,_0x417d2f,path[_0x6e91('0x71')](_0x300fcb),fs[_0x6e91('0x72')](_0x300fcb))[_0x6e91('0x25')](function(_0x5bb912){logger[_0x6e91('0x68')](util[_0x6e91('0x32')](_0x6e91('0x73'),_0x1a49bf,_0x417d2f,_0x5bb912['Location']));_0x32dba7['bucket']=_0x5bb912[_0x6e91('0x74')];_0x32dba7[_0x6e91('0x75')]=_0x5bb912['Location'];logger['info'](util[_0x6e91('0x32')](_0x6e91('0x76'),_0x1a49bf));return startTranscribe(_0x23e396,_0x3d751a,_0x14079f,uuidv4(),_0x4f756e,_0x5bb912[_0x6e91('0x77')]);})[_0x6e91('0x25')](function(_0x607b14){logger[_0x6e91('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1a49bf,_0x607b14[_0x6e91('0x78')]['TranscriptionJobName']));_0x32dba7[_0x6e91('0x79')]=_0x607b14[_0x6e91('0x78')][_0x6e91('0x7a')];_0x32dba7[_0x6e91('0x7b')]=_0x607b14[_0x6e91('0x78')]['TranscriptionJobStatus'];return _0x1718b9(_0x32dba7);})[_0x6e91('0x4a')](function(_0x10d6f4){return _0x133650(_0x10d6f4);});});}exports[_0x6e91('0x7c')]=function(_0x51eb40,_0x47e99a,_0x4d8f1f){var _0x392caf;var _0x1fb5bc;var _0x5c1357;var _0x11651c=require('../../components/encryptor');return db['VoiceRecording'][_0x6e91('0x7d')]({'where':{'id':_0x51eb40[_0x6e91('0x47')]['id']}})[_0x6e91('0x25')](function(_0x254d7b){if(_0x254d7b){var _0x1f53f9=util[_0x6e91('0x32')]('%s.cypher',_0x254d7b[_0x6e91('0x50')]);if(fs[_0x6e91('0x52')](_0x1f53f9)){cypher=!![];return _0x11651c[_0x6e91('0x64')](_0x1f53f9,_0x254d7b['value'],config['secrets'][_0x6e91('0x54')])[_0x6e91('0x25')](function(){return _0x254d7b;});}return _0x254d7b;}})[_0x6e91('0x25')](function(_0x528294){if(!_0x528294){throw new db[(_0x6e91('0x55'))][(_0x6e91('0x56'))](_0x6e91('0x7e'));}_0x1fb5bc=_0x528294;return db[_0x6e91('0x7f')][_0x6e91('0x7d')]({'where':{'id':0x1}});})[_0x6e91('0x25')](handleEntityNotFound(_0x47e99a,null))[_0x6e91('0x25')](function(_0xdfff51){if(_0xdfff51){_0x392caf=_0xdfff51;if(!_0x392caf[_0x6e91('0x80')]||!_0x392caf[_0x6e91('0x81')]||!_0x392caf[_0x6e91('0x82')]||!_0x392caf[_0x6e91('0x83')]||!_0x392caf[_0x6e91('0x84')]){throw new db[(_0x6e91('0x55'))]['ValidationError'](_0x6e91('0x85'));}if(_0x51eb40[_0x6e91('0x4c')]['runSentiment']&&(!_0x392caf[_0x6e91('0x86')]||!_0x392caf['sentimentAccountId']||!_0x392caf[_0x6e91('0x87')]||!_0x392caf[_0x6e91('0x83')]||!_0x392caf[_0x6e91('0x84')])){throw new db[(_0x6e91('0x55'))][(_0x6e91('0x56'))](_0x6e91('0x88'));}return db[_0x6e91('0x89')][_0x6e91('0x7d')]({'where':{'id':_0x392caf['transcribeAccountId']}});}})[_0x6e91('0x25')](function(_0xe809d7){if(!_0xe809d7){throw new db['Sequelize']['ValidationError'](_0x6e91('0x8a'));}if(!_0xe809d7[_0x6e91('0x8b')]||!_0xe809d7[_0x6e91('0x8c')]){throw new db[(_0x6e91('0x55'))][(_0x6e91('0x56'))](_0x6e91('0x8d'));}_0x5c1357=_0xe809d7;return getBucketslist(_0x5c1357[_0x6e91('0x8b')],_0x5c1357[_0x6e91('0x8c')],_0x392caf['transcribeRegion']);})['then'](function(_0x566ee7){if(_0x566ee7&&_0x566ee7[_0x6e91('0x8e')]){var _0x2abe35=_['find'](_0x566ee7[_0x6e91('0x8e')],function(_0x1e6498){return _0x1e6498[_0x6e91('0x8f')]===_0x392caf[_0x6e91('0x84')];});if(!_0x2abe35){logger[_0x6e91('0x68')](util[_0x6e91('0x32')](_0x6e91('0x90'),_0x51eb40[_0x6e91('0x47')]['id'],_0x392caf[_0x6e91('0x84')]));return createBucket(_0x5c1357[_0x6e91('0x8b')],_0x5c1357[_0x6e91('0x8c')],_0x392caf['transcribeRegion'],_0x392caf[_0x6e91('0x84')]);}logger['info'](util[_0x6e91('0x32')](_0x6e91('0x91'),_0x51eb40[_0x6e91('0x47')]['id'],_0x392caf[_0x6e91('0x84')]));return;}})['then'](function(_0x5515fa){if(_0x1fb5bc[_0x6e91('0x7b')]===_0x6e91('0x92')){return transcribe(_0x51eb40['params']['id'],_0x5c1357['data1'],_0x5c1357[_0x6e91('0x8c')],_0x392caf[_0x6e91('0x82')],_0x392caf[_0x6e91('0x84')],_0x1fb5bc[_0x6e91('0x50')],_0x392caf[_0x6e91('0x83')]);}else{logger[_0x6e91('0x68')](util[_0x6e91('0x32')](_0x6e91('0x93'),_0x51eb40[_0x6e91('0x47')]['id']));return{'transcribeStatus':_0x6e91('0x94')};}})[_0x6e91('0x25')](function(_0x47ffd4){if(_0x47ffd4){_0x47ffd4['tempSentiment']=_0x51eb40[_0x6e91('0x4c')][_0x6e91('0x95')];return _0x1fb5bc[_0x6e91('0x96')](_0x47ffd4);}})[_0x6e91('0x25')](respondWithResult(_0x47e99a,null))[_0x6e91('0x4a')](handleError(_0x47e99a,null));};function writeFile(_0x396d79,_0x57b10b){return new Promise(function(_0x2e5eb3,_0xecbc42){fs['writeFile'](_0x57b10b,_0x396d79,function(_0x1cb548,_0x4f9b7e){if(_0x1cb548){return _0xecbc42(_0x1cb548);}else{return _0x2e5eb3(_0x4f9b7e);}});});}exports[_0x6e91('0x97')]=function(_0x1a677d,_0x3ca60d,_0x1f942e){return db[_0x6e91('0x44')][_0x6e91('0x7d')]({'where':{'id':_0x1a677d[_0x6e91('0x47')]['id']}})[_0x6e91('0x25')](handleEntityNotFound(_0x3ca60d))[_0x6e91('0x25')](function(_0x34e31c){if(_0x34e31c&&_0x34e31c[_0x6e91('0x98')]){var _0x52910d=_0x34e31c[_0x6e91('0x98')];var _0x408253=config[_0x6e91('0x99')]+_0x6e91('0x9a')+_0x34e31c['id']+_0x6e91('0x9b');if(fs['existsSync'](_0x408253)){return _0x408253;}return writeFile(_0x52910d,_0x408253)[_0x6e91('0x25')](function(){return _0x408253;});}else{throw new db['Sequelize'][(_0x6e91('0x56'))](_0x6e91('0x9c'));}})['then'](function(_0x336f94){return _0x3ca60d['download'](_0x336f94);})['catch'](handleError(_0x3ca60d));};
\ No newline at end of file
+var _0x2097=['nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','download','../../components/encryptor','uniqueid','value','existsSync','decryptFile','ValidationError','filename','extname','unlink','Not\x20found','downloads','sequelize','col','push','$and','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','basename','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobStatus','runTranscribe','findOne','%s.cypher','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','sentiment','sentimentAccountId','sentimentRegion','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','NEW','IN_PROGRESS','tempSentiment','runSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','.txt','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','json','reject','update','destroy','then','end','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','model','differenceBy','format','query','filters','intersection','attributes','fields','length'];(function(_0x5e7979,_0x4175c0){var _0x50f569=function(_0x184fa4){while(--_0x184fa4){_0x5e7979['push'](_0x5e7979['shift']());}};_0x50f569(++_0x4175c0);}(_0x2097,0xee));var _0x7209=function(_0x5ff328,_0x57f784){_0x5ff328=_0x5ff328-0x0;var _0xd2cdbb=_0x2097[_0x5ff328];return _0xd2cdbb;};'use strict';var emlformat=require(_0x7209('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7209('0x1'));var jsonpatch=require(_0x7209('0x2'));var rp=require(_0x7209('0x3'));var moment=require(_0x7209('0x4'));var BPromise=require(_0x7209('0x5'));var Mustache=require(_0x7209('0x6'));var util=require('util');var path=require(_0x7209('0x7'));var sox=require(_0x7209('0x8'));var csv=require(_0x7209('0x9'));var ejs=require(_0x7209('0xa'));var fs=require('fs');var fs_extra=require(_0x7209('0xb'));var _=require(_0x7209('0xc'));var squel=require(_0x7209('0xd'));var crypto=require(_0x7209('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7209('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7209('0x10'));var Papa=require(_0x7209('0x11'));var AWS=require(_0x7209('0x12'));var uuidv4=require(_0x7209('0x13'));var Redis=require(_0x7209('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x7209('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7209('0x16'));var logger=require(_0x7209('0x17'))(_0x7209('0x18'));var utils=require('../../config/utils');var config=require(_0x7209('0x19'));var licenseUtil=require(_0x7209('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43b3ad,_0x2d32eb){_0x2d32eb=_0x2d32eb||0xcc;return function(_0x5f04a5){if(_0x5f04a5){return _0x43b3ad[_0x7209('0x1b')](_0x2d32eb);}return _0x43b3ad[_0x7209('0x1c')](_0x2d32eb)['end']();};}function respondWithResult(_0x4f9b1e,_0x1b39be){_0x1b39be=_0x1b39be||0xc8;return function(_0x58cc2c){if(_0x58cc2c){return _0x4f9b1e[_0x7209('0x1c')](_0x1b39be)['json'](_0x58cc2c);}};}function respondWithFilteredResult(_0x449a03,_0x4b370e){return function(_0x29e446){if(_0x29e446){var _0x20375e=typeof _0x4b370e[_0x7209('0x1d')]===_0x7209('0x1e')&&typeof _0x4b370e[_0x7209('0x1f')]===_0x7209('0x1e');var _0x49adee=_0x29e446[_0x7209('0x20')];var _0x53c3ce=_0x20375e?0x0:_0x4b370e[_0x7209('0x1d')];var _0x4bff17=_0x20375e?_0x29e446[_0x7209('0x20')]:_0x4b370e[_0x7209('0x1d')]+_0x4b370e[_0x7209('0x1f')];var _0x4ac8ba;if(_0x4bff17>=_0x49adee){_0x4bff17=_0x49adee;_0x4ac8ba=0xc8;}else{_0x4ac8ba=0xce;}_0x449a03['status'](_0x4ac8ba);return _0x449a03[_0x7209('0x21')]('Content-Range',_0x53c3ce+'-'+_0x4bff17+'/'+_0x49adee)[_0x7209('0x22')](_0x29e446);}return null;};}function patchUpdates(_0x28ff1d){return function(_0x495233){try{jsonpatch['apply'](_0x495233,_0x28ff1d,!![]);}catch(_0x2f196f){return BPromise[_0x7209('0x23')](_0x2f196f);}return _0x495233['save']();};}function saveUpdates(_0x3ab99d,_0x41996b){return function(_0x4fb337){if(_0x4fb337){return _0x4fb337[_0x7209('0x24')](_0x3ab99d)['then'](function(_0x2522c6){return _0x2522c6;});}return null;};}function removeEntity(_0x4345f5,_0x4e5e3c){return function(_0x16be2c){if(_0x16be2c){return _0x16be2c[_0x7209('0x25')]()[_0x7209('0x26')](function(){_0x4345f5[_0x7209('0x1c')](0xcc)[_0x7209('0x27')]();});}};}function handleEntityNotFound(_0x46d5ad,_0x3dd36e){return function(_0x585c31){if(!_0x585c31){_0x46d5ad[_0x7209('0x1b')](0x194);}return _0x585c31;};}function handleError(_0x1f6718,_0x84ebc1){_0x84ebc1=_0x84ebc1||0x1f4;return function(_0x458d25){logger[_0x7209('0x28')](_0x458d25[_0x7209('0x29')]);if(_0x458d25[_0x7209('0x2a')]){delete _0x458d25[_0x7209('0x2a')];}_0x1f6718['status'](_0x84ebc1)[_0x7209('0x2b')](_0x458d25);};}exports[_0x7209('0x2c')]=function(_0x4b53a7,_0x28503b){var _0x186b92={},_0x49091e={},_0x53d685={'count':0x0,'rows':[]};var _0xb1c90c=_[_0x7209('0x2d')](db[_0x7209('0x2e')][_0x7209('0x2f')],function(_0x332e06){return{'name':_0x332e06[_0x7209('0x30')],'type':_0x332e06['type']['key']};});_0x49091e[_0x7209('0x31')]=_[_0x7209('0x32')](_[_0x7209('0x2d')](_0xb1c90c,_0x7209('0x2a')),[_0x7209('0x33')]);_0x49091e[_0x7209('0x34')]=_['keys'](_0x4b53a7[_0x7209('0x34')]);_0x49091e[_0x7209('0x35')]=_[_0x7209('0x36')](_0x49091e[_0x7209('0x31')],_0x49091e[_0x7209('0x34')]);_0x186b92[_0x7209('0x37')]=_['intersection'](_0x49091e[_0x7209('0x31')],qs[_0x7209('0x38')](_0x4b53a7[_0x7209('0x34')]['fields']));_0x186b92['attributes']=_0x186b92[_0x7209('0x37')][_0x7209('0x39')]?_0x186b92[_0x7209('0x37')]:_0x49091e[_0x7209('0x31')];if(!_0x4b53a7[_0x7209('0x34')]['hasOwnProperty'](_0x7209('0x3a'))){_0x186b92[_0x7209('0x1f')]=qs['limit'](_0x4b53a7['query'][_0x7209('0x1f')]);_0x186b92[_0x7209('0x1d')]=qs[_0x7209('0x1d')](_0x4b53a7[_0x7209('0x34')][_0x7209('0x1d')]);}_0x186b92[_0x7209('0x3b')]=qs[_0x7209('0x3c')](_0x4b53a7[_0x7209('0x34')][_0x7209('0x3c')]);_0x186b92[_0x7209('0x3d')]=qs[_0x7209('0x35')](_[_0x7209('0x3e')](_0x4b53a7[_0x7209('0x34')],_0x49091e[_0x7209('0x35')]),_0xb1c90c);if(_0x4b53a7[_0x7209('0x34')][_0x7209('0x3f')]){_0x186b92['where']=_['merge'](_0x186b92[_0x7209('0x3d')],{'$or':_[_0x7209('0x2d')](_0xb1c90c,function(_0x244b4a){if(_0x244b4a[_0x7209('0x40')]!==_0x7209('0x41')){var _0x534271={};_0x534271[_0x244b4a[_0x7209('0x2a')]]={'$like':'%'+_0x4b53a7[_0x7209('0x34')][_0x7209('0x3f')]+'%'};return _0x534271;}})});}_0x186b92=_[_0x7209('0x42')]({},_0x186b92,_0x4b53a7[_0x7209('0x43')]);var _0xaa5702={'where':_0x186b92[_0x7209('0x3d')]};return db['VoiceRecording'][_0x7209('0x20')](_0xaa5702)['then'](function(_0x2275b0){_0x53d685[_0x7209('0x20')]=_0x2275b0;if(_0x4b53a7[_0x7209('0x34')][_0x7209('0x44')]){_0x186b92[_0x7209('0x45')]=[{'all':!![]}];}return db[_0x7209('0x2e')][_0x7209('0x46')](_0x186b92);})[_0x7209('0x26')](function(_0x259f79){_0x53d685[_0x7209('0x47')]=_0x259f79;return _0x53d685;})[_0x7209('0x26')](respondWithFilteredResult(_0x28503b,_0x186b92))[_0x7209('0x48')](handleError(_0x28503b,null));};exports[_0x7209('0x49')]=function(_0x437e65,_0x322358){var _0x23732b={'raw':![],'where':{'id':_0x437e65[_0x7209('0x4a')]['id']}},_0x51edc5={};_0x51edc5[_0x7209('0x31')]=_[_0x7209('0x4b')](db[_0x7209('0x2e')][_0x7209('0x2f')]);_0x51edc5[_0x7209('0x34')]=_[_0x7209('0x4b')](_0x437e65[_0x7209('0x34')]);_0x51edc5[_0x7209('0x35')]=_[_0x7209('0x36')](_0x51edc5[_0x7209('0x31')],_0x51edc5[_0x7209('0x34')]);_0x23732b[_0x7209('0x37')]=_[_0x7209('0x36')](_0x51edc5['model'],qs[_0x7209('0x38')](_0x437e65[_0x7209('0x34')][_0x7209('0x38')]));_0x23732b[_0x7209('0x37')]=_0x23732b[_0x7209('0x37')][_0x7209('0x39')]?_0x23732b['attributes']:_0x51edc5[_0x7209('0x31')];if(_0x437e65[_0x7209('0x34')][_0x7209('0x44')]){_0x23732b[_0x7209('0x45')]=[{'all':!![]}];}_0x23732b=_[_0x7209('0x42')]({},_0x23732b,_0x437e65[_0x7209('0x43')]);return db[_0x7209('0x2e')]['find'](_0x23732b)[_0x7209('0x26')](handleEntityNotFound(_0x322358,null))[_0x7209('0x26')](respondWithResult(_0x322358,null))[_0x7209('0x48')](handleError(_0x322358,null));};exports[_0x7209('0x4c')]=function(_0x569700,_0x47eebc){return db[_0x7209('0x2e')][_0x7209('0x4c')](_0x569700['body'],{})[_0x7209('0x26')](respondWithResult(_0x47eebc,0xc9))[_0x7209('0x48')](handleError(_0x47eebc,null));};exports[_0x7209('0x24')]=function(_0x488040,_0x59d975){if(_0x488040[_0x7209('0x4d')]['id']){delete _0x488040[_0x7209('0x4d')]['id'];}return db['VoiceRecording'][_0x7209('0x4e')]({'where':{'id':_0x488040[_0x7209('0x4a')]['id']}})[_0x7209('0x26')](handleEntityNotFound(_0x59d975,null))[_0x7209('0x26')](saveUpdates(_0x488040[_0x7209('0x4d')],null))[_0x7209('0x26')](respondWithResult(_0x59d975,null))['catch'](handleError(_0x59d975,null));};exports[_0x7209('0x4f')]=function(_0xb5eebc,_0x1bc916){return db[_0x7209('0x2e')][_0x7209('0x4f')]()[_0x7209('0x26')](respondWithResult(_0x1bc916,null))[_0x7209('0x48')](handleError(_0x1bc916,null));};exports[_0x7209('0x50')]=function(_0x32f274,_0x343ec1,_0x26c6bf){var _0x5e8402=require(_0x7209('0x51'));var _0x139fb5=![];var _0x5a7ca4={};if(_0x32f274[_0x7209('0x34')]['type']&&_0x32f274['query'][_0x7209('0x40')]===_0x7209('0x52')){_0x5a7ca4[_0x7209('0x52')]=_0x32f274[_0x7209('0x4a')]['id'];}else{_0x5a7ca4['id']=_0x32f274[_0x7209('0x4a')]['id'];}return db[_0x7209('0x2e')]['find']({'where':_0x5a7ca4,'attributes':['id','value'],'raw':!![]})[_0x7209('0x26')](handleEntityNotFound(_0x343ec1,null))[_0x7209('0x26')](function(_0x23e8af){if(_0x23e8af){var _0x5d2370=_0x23e8af[_0x7209('0x53')];var _0x5cb17d=util[_0x7209('0x33')]('%s.cypher',_0x5d2370);if(fs[_0x7209('0x54')](_0x5cb17d)){_0x139fb5=!![];return _0x5e8402[_0x7209('0x55')](_0x5cb17d,_0x5d2370,config['secrets']['recording'])[_0x7209('0x26')](function(){return _0x23e8af;});}return _0x23e8af;}})['then'](function(_0x3e1bb6){if(_0x3e1bb6){var _0x5c5f8a=_0x3e1bb6[_0x7209('0x53')];if(!fs[_0x7209('0x54')](_0x5c5f8a)){throw new db['Sequelize'][(_0x7209('0x56'))]('VoiceRecording\x20not\x20found');}if(_0x3e1bb6[_0x7209('0x57')]){return _0x343ec1[_0x7209('0x50')](_0x5c5f8a,_0x3e1bb6[_0x7209('0x57')]+path[_0x7209('0x58')](_0x5c5f8a),function(){if(_0x139fb5){fs[_0x7209('0x59')](_0x5c5f8a);}});}else{return _0x343ec1['download'](_0x5c5f8a,function(_0x3d72ca){if(_0x139fb5){fs['unlink'](_0x5c5f8a);}});}}})['catch'](function(_0x4904d2){if(_0x4904d2['message']==='VoiceRecording\x20not\x20found'){_0x343ec1[_0x7209('0x1c')](0x194)[_0x7209('0x2b')](_0x7209('0x5a'));}else{return handleError(_0x343ec1,null);}});};exports[_0x7209('0x5b')]=function(_0x5c3fe8,_0x33c08a,_0x55b6d8){var _0x4efd2f=require(_0x7209('0x51'));var _0x4a39c7=![];var _0x2a56b8={'$and':[db['sequelize'][_0x7209('0x3d')](db['sequelize']['fn']('MD5',db[_0x7209('0x5c')][_0x7209('0x5d')](_0x7209('0x52'))),_0x5c3fe8[_0x7209('0x34')]['token'])]};if(_0x5c3fe8[_0x7209('0x34')][_0x7209('0x40')]&&_0x5c3fe8[_0x7209('0x34')][_0x7209('0x40')]===_0x7209('0x52')){_0x2a56b8['$and'][_0x7209('0x5e')]({'uniqueid':_0x5c3fe8[_0x7209('0x4a')]['id']});}else{_0x2a56b8[_0x7209('0x5f')][_0x7209('0x5e')]({'id':_0x5c3fe8[_0x7209('0x4a')]['id']});}return db[_0x7209('0x2e')][_0x7209('0x4e')]({'where':_0x2a56b8,'attributes':['id',_0x7209('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x33c08a,null))[_0x7209('0x26')](function(_0x1bfefe){if(_0x1bfefe){var _0x1fb1ba=util['format']('%s.cypher',_0x1bfefe['value']);if(fs['existsSync'](_0x1fb1ba)){_0x4a39c7=!![];return _0x4efd2f[_0x7209('0x55')](_0x1fb1ba,_0x1bfefe[_0x7209('0x53')],config[_0x7209('0x60')][_0x7209('0x61')])['then'](function(){return _0x1bfefe;});}return _0x1bfefe;}})['then'](function(_0x352d47){if(_0x352d47){if(!fs['existsSync'](_0x352d47['value'])){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))](_0x7209('0x63'));}if(_0x352d47[_0x7209('0x57')]){return _0x33c08a[_0x7209('0x50')](_0x352d47['value'],_0x352d47['filename']+path[_0x7209('0x58')](_0x352d47['value']),function(){if(_0x4a39c7){fs[_0x7209('0x59')](_0x352d47[_0x7209('0x53')]);}});}else{return _0x33c08a[_0x7209('0x50')](_0x352d47[_0x7209('0x53')],function(_0x53250b){if(_0x4a39c7){fs['unlink'](_0x352d47[_0x7209('0x53')]);}});}}})[_0x7209('0x48')](handleError(_0x33c08a,null));};exports[_0x7209('0x25')]=function(_0x4afe22,_0x5b34e2){return db[_0x7209('0x2e')][_0x7209('0x4e')]({'where':{'id':_0x4afe22[_0x7209('0x4a')]['id']}})[_0x7209('0x26')](function(_0x1f2a5f){if(_['isNil'](_0x1f2a5f)){throw new ReferenceError(_0x7209('0x64'));}return _0x1f2a5f;})[_0x7209('0x26')](function(_0x32f404){var _0x1487ca=_0x32f404[_0x7209('0x53')];logger['info'](_0x7209('0x65'),_0x1487ca);if(!_[_0x7209('0x66')](_0x32f404['value'])&&fs[_0x7209('0x54')](_0x1487ca)){logger[_0x7209('0x67')](_0x7209('0x68')+_0x1487ca+_0x7209('0x69'));fs[_0x7209('0x6a')](_0x1487ca);}_0x1487ca=_0x1487ca+_0x7209('0x6b');if(!_['isNil'](_0x32f404[_0x7209('0x53')])&&fs[_0x7209('0x54')](_0x1487ca)){logger['info']('File:\x20\x22'+_0x1487ca+_0x7209('0x69'));fs['unlinkSync'](_0x1487ca);}return _0x32f404;})[_0x7209('0x26')](function(_0xe99187){if(!_0xe99187)throw new InternalError();return _0xe99187['destroy']();})[_0x7209('0x26')](function(){_0x5b34e2['status'](0xcc)[_0x7209('0x27')]();})['catch'](handleError(_0x5b34e2,null));};function getBucketslist(_0x36e878,_0x236ca4,_0x220e76){return new Promise(function(_0x5e2a76,_0x4cbe69){var _0x4ce024=new AWS['S3']({'accessKeyId':_0x236ca4,'secretAccessKey':_0x36e878,'region':_0x220e76});_0x4ce024[_0x7209('0x6c')]({},function(_0x571551,_0x3d5463){if(_0x571551){return _0x4cbe69(_0x571551);}else{return _0x5e2a76(_0x3d5463);}});});}function createBucket(_0x223b96,_0x5847dc,_0x530d83,_0x15f9fb){return new Promise(function(_0x5cf6b2,_0x37735e){var _0x2fa5c9=new AWS['S3']({'accessKeyId':_0x5847dc,'secretAccessKey':_0x223b96,'region':_0x530d83});_0x2fa5c9[_0x7209('0x6d')]({'Bucket':_0x15f9fb},function(_0x145ff3,_0x2bc397){if(_0x145ff3){return _0x37735e(_0x145ff3);}else{return _0x5cf6b2(_0x2bc397);}});});}function uploadFile(_0x2962e2,_0x3c9524,_0x3fb9f6,_0x419500,_0x1368ba,_0x451f61){return new Promise(function(_0x119ce2,_0x550ad9){var _0x486e17=new AWS['S3']({'accessKeyId':_0x3c9524,'secretAccessKey':_0x2962e2,'region':_0x3fb9f6});_0x486e17['upload']({'Bucket':_0x419500,'Key':_0x1368ba,'Body':_0x451f61},function(_0x5273f6,_0x478b88){if(_0x5273f6){return _0x550ad9(_0x5273f6);}else{return _0x119ce2(_0x478b88);}});});}function startTranscribe(_0x5f45d3,_0x525291,_0x2c482f,_0x4c45a4,_0x8b8039,_0x7f1f6a){return new Promise(function(_0x36ea65,_0x284a6a){var _0xfe7a10=new AWS[(_0x7209('0x6e'))]({'accessKeyId':_0x525291,'secretAccessKey':_0x5f45d3,'region':_0x2c482f});_0xfe7a10['startTranscriptionJob']({'TranscriptionJobName':_0x4c45a4,'LanguageCode':_0x8b8039,'Media':{'MediaFileUri':_0x7f1f6a}},function(_0x5ca7e7,_0x15fe5c){if(_0x5ca7e7){return _0x284a6a(_0x5ca7e7);}else{return _0x36ea65(_0x15fe5c);}});});}function transcribe(_0x2f381e,_0x4eea57,_0x42db2b,_0x5613ca,_0xe37e40,_0x342fe8,_0x1f7259){return new Promise(function(_0x287d3d,_0x2fc2f6){var _0x3b5605={};logger[_0x7209('0x67')](util[_0x7209('0x33')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x2f381e,_0xe37e40));return uploadFile(_0x4eea57,_0x42db2b,_0x5613ca,_0xe37e40,path[_0x7209('0x6f')](_0x342fe8),fs['readFileSync'](_0x342fe8))[_0x7209('0x26')](function(_0x325ce2){logger[_0x7209('0x67')](util[_0x7209('0x33')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x2f381e,_0xe37e40,_0x325ce2[_0x7209('0x70')]));_0x3b5605[_0x7209('0x71')]=_0x325ce2['Bucket'];_0x3b5605['location']=_0x325ce2[_0x7209('0x70')];logger[_0x7209('0x67')](util[_0x7209('0x33')](_0x7209('0x72'),_0x2f381e));return startTranscribe(_0x4eea57,_0x42db2b,_0x5613ca,uuidv4(),_0x1f7259,_0x325ce2[_0x7209('0x70')]);})[_0x7209('0x26')](function(_0x362ff0){logger[_0x7209('0x67')](util[_0x7209('0x33')](_0x7209('0x73'),_0x2f381e,_0x362ff0[_0x7209('0x74')]['TranscriptionJobName']));_0x3b5605[_0x7209('0x75')]=_0x362ff0[_0x7209('0x74')]['TranscriptionJobName'];_0x3b5605['transcribeStatus']=_0x362ff0['TranscriptionJob'][_0x7209('0x76')];return _0x287d3d(_0x3b5605);})[_0x7209('0x48')](function(_0x31ce45){return _0x2fc2f6(_0x31ce45);});});}exports[_0x7209('0x77')]=function(_0x47e909,_0xbd0726,_0x6bfd27){var _0xce2fd;var _0x2bf1fd;var _0x44d42d;var _0x14d0fd=require(_0x7209('0x51'));return db[_0x7209('0x2e')][_0x7209('0x78')]({'where':{'id':_0x47e909['params']['id']}})[_0x7209('0x26')](function(_0x4a586e){if(_0x4a586e){var _0x2026da=util[_0x7209('0x33')](_0x7209('0x79'),_0x4a586e[_0x7209('0x53')]);if(fs['existsSync'](_0x2026da)){cypher=!![];return _0x14d0fd['decryptFile'](_0x2026da,_0x4a586e[_0x7209('0x53')],config[_0x7209('0x60')][_0x7209('0x61')])[_0x7209('0x26')](function(){return _0x4a586e;});}return _0x4a586e;}})[_0x7209('0x26')](function(_0x10e095){if(!_0x10e095){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))](_0x7209('0x7a'));}_0x2bf1fd=_0x10e095;return db[_0x7209('0x7b')][_0x7209('0x78')]({'where':{'id':0x1}});})[_0x7209('0x26')](handleEntityNotFound(_0xbd0726,null))[_0x7209('0x26')](function(_0x49ce63){if(_0x49ce63){_0xce2fd=_0x49ce63;if(!_0xce2fd[_0x7209('0x7c')]||!_0xce2fd[_0x7209('0x7d')]||!_0xce2fd[_0x7209('0x7e')]||!_0xce2fd[_0x7209('0x7f')]||!_0xce2fd['bucket']){throw new db[(_0x7209('0x62'))]['ValidationError'](_0x7209('0x80'));}if(_0x47e909[_0x7209('0x4d')]['runSentiment']&&(!_0xce2fd[_0x7209('0x81')]||!_0xce2fd[_0x7209('0x82')]||!_0xce2fd[_0x7209('0x83')]||!_0xce2fd[_0x7209('0x7f')]||!_0xce2fd[_0x7209('0x71')])){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x7209('0x84')][_0x7209('0x78')]({'where':{'id':_0xce2fd['transcribeAccountId']}});}})[_0x7209('0x26')](function(_0x5da2a9){if(!_0x5da2a9){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x5da2a9[_0x7209('0x85')]||!_0x5da2a9[_0x7209('0x86')]){throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))](_0x7209('0x87'));}_0x44d42d=_0x5da2a9;return getBucketslist(_0x44d42d[_0x7209('0x85')],_0x44d42d[_0x7209('0x86')],_0xce2fd[_0x7209('0x7e')]);})['then'](function(_0x15629c){if(_0x15629c&&_0x15629c['Buckets']){var _0x4ec07d=_['find'](_0x15629c[_0x7209('0x88')],function(_0x14425f){return _0x14425f[_0x7209('0x89')]===_0xce2fd[_0x7209('0x71')];});if(!_0x4ec07d){logger[_0x7209('0x67')](util[_0x7209('0x33')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x47e909['params']['id'],_0xce2fd['bucket']));return createBucket(_0x44d42d[_0x7209('0x85')],_0x44d42d[_0x7209('0x86')],_0xce2fd[_0x7209('0x7e')],_0xce2fd['bucket']);}logger[_0x7209('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x47e909[_0x7209('0x4a')]['id'],_0xce2fd['bucket']));return;}})['then'](function(_0x58b34b){if(_0x2bf1fd['transcribeStatus']===_0x7209('0x8a')){return transcribe(_0x47e909['params']['id'],_0x44d42d[_0x7209('0x85')],_0x44d42d[_0x7209('0x86')],_0xce2fd[_0x7209('0x7e')],_0xce2fd[_0x7209('0x71')],_0x2bf1fd['value'],_0xce2fd[_0x7209('0x7f')]);}else{logger[_0x7209('0x67')](util[_0x7209('0x33')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x47e909['params']['id']));return{'transcribeStatus':_0x7209('0x8b')};}})[_0x7209('0x26')](function(_0x81c895){if(_0x81c895){_0x81c895[_0x7209('0x8c')]=_0x47e909[_0x7209('0x4d')][_0x7209('0x8d')];return _0x2bf1fd[_0x7209('0x8e')](_0x81c895);}})['then'](respondWithResult(_0xbd0726,null))['catch'](handleError(_0xbd0726,null));};function writeFile(_0x4742d2,_0x337121){return new Promise(function(_0x6376ac,_0x3ea637){fs[_0x7209('0x8f')](_0x337121,_0x4742d2,function(_0x27e88d,_0x4b7382){if(_0x27e88d){return _0x3ea637(_0x27e88d);}else{return _0x6376ac(_0x4b7382);}});});}exports[_0x7209('0x90')]=function(_0x510a5a,_0x18c0a1,_0xc954c4){return db[_0x7209('0x2e')][_0x7209('0x78')]({'where':{'id':_0x510a5a['params']['id']}})[_0x7209('0x26')](handleEntityNotFound(_0x18c0a1))[_0x7209('0x26')](function(_0x527daf){if(_0x527daf&&_0x527daf[_0x7209('0x91')]){var _0x8bc39b=_0x527daf[_0x7209('0x91')];var _0x1651bf=config[_0x7209('0x92')]+'/server/files/transcribes/transcribe_'+_0x527daf['id']+_0x7209('0x93');if(fs[_0x7209('0x54')](_0x1651bf)){return _0x1651bf;}return writeFile(_0x8bc39b,_0x1651bf)['then'](function(){return _0x1651bf;});}else{throw new db[(_0x7209('0x62'))][(_0x7209('0x56'))]('Transcript\x20not\x20available');}})[_0x7209('0x26')](function(_0x3de7cc){return _0x18c0a1[_0x7209('0x50')](_0x3de7cc);})[_0x7209('0x48')](handleError(_0x18c0a1));};
\ No newline at end of file
index d8d68c1..b2a0fac 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb469=['./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus'];(function(_0x51e819,_0x59fc8a){var _0x574ea9=function(_0x2d9903){while(--_0x2d9903){_0x51e819['push'](_0x51e819['shift']());}};_0x574ea9(++_0x59fc8a);}(_0xb469,0x13b));var _0x9b46=function(_0xfc4103,_0x10baae){_0xfc4103=_0xfc4103-0x0;var _0xb69a=_0xb469[_0xfc4103];return _0xb69a;};'use strict';var attributes=require(_0x9b46('0x0'));module[_0x9b46('0x1')]=function(_0x2d18d9,_0x34f477){return _0x2d18d9[_0x9b46('0x2')](_0x9b46('0x3'),attributes,{'tableName':_0x9b46('0x4'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9b46('0x5')]},{'name':_0x9b46('0x6'),'fields':['transcribeStatus']}],'timestamps':!![]});};
\ No newline at end of file
+var _0xa631=['exports','VoiceRecording','uniqueid','transcribeStatus'];(function(_0x25fbc8,_0x44a334){var _0x4eed32=function(_0x2fca9e){while(--_0x2fca9e){_0x25fbc8['push'](_0x25fbc8['shift']());}};_0x4eed32(++_0x44a334);}(_0xa631,0xe4));var _0x1a63=function(_0x289c9d,_0x5ced78){_0x289c9d=_0x289c9d-0x0;var _0x2e135=_0xa631[_0x289c9d];return _0x2e135;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0x1a63('0x0')]=function(_0x1e771b,_0x17d7a7){return _0x1e771b['define'](_0x1a63('0x1'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x1a63('0x2')]},{'name':_0x1a63('0x3'),'fields':[_0x1a63('0x3')]}],'timestamps':!![]});};
\ No newline at end of file
index 10e414b..86769a4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcaf2=['CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','recording','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceRecording','body','options','raw','where','attributes','limit','UpdateVoiceRecording','stringify','catch'];(function(_0x419548,_0x466b84){var _0x5ebdf7=function(_0x59a281){while(--_0x59a281){_0x419548['push'](_0x419548['shift']());}};_0x5ebdf7(++_0x466b84);}(_0xcaf2,0x8a));var _0x2caf=function(_0x21afd5,_0x57b9ba){_0x21afd5=_0x21afd5-0x0;var _0x59b71d=_0xcaf2[_0x21afd5];return _0x59b71d;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});}exports['UpdateVoiceRecording']=function(_0x4a33fc){var _0x3e975f=this;return new Promise(function(_0x58047b,_0xe72440){return db[_0x2caf('0x14')]['update'](_0x4a33fc[_0x2caf('0x15')],{'raw':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc['options'][_0x2caf('0x18')]||null:null,'attributes':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x19')]||null:null,'limit':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x1a')]||null:null})[_0x2caf('0xa')](function(_0x3332b1){logger[_0x2caf('0xb')](_0x2caf('0x1b'),_0x4a33fc);logger['debug'](_0x2caf('0x1b'),_0x4a33fc,JSON[_0x2caf('0x1c')](_0x3332b1));_0x58047b(_0x3332b1);})[_0x2caf('0x1d')](function(_0x401ea2){logger[_0x2caf('0x10')](_0x2caf('0x1b'),_0x401ea2[_0x2caf('0x12')],_0x4a33fc);_0xe72440(_0x3e975f[_0x2caf('0x10')](0x1f4,_0x401ea2[_0x2caf('0x12')]));});});};exports[_0x2caf('0x1e')]=function(_0x5ad211){var _0x6a32ac=this;return new Promise(function(_0x325eda,_0xbefce6){var _0x37b08f=require(_0x2caf('0x1f'));var _0x17d3c6;return db[_0x2caf('0x20')][_0x2caf('0x21')]({'attributes':['id',_0x2caf('0x22')],'where':{'id':0x1},'raw':!![]})[_0x2caf('0xa')](function(_0x30da75){_0x17d3c6=_0x30da75;return db[_0x2caf('0x14')][_0x2caf('0x23')](_0x5ad211['body']);})[_0x2caf('0xa')](function(_0xda0ec5){if(_0x17d3c6[_0x2caf('0x22')]&&fs[_0x2caf('0x24')](_0xda0ec5[_0x2caf('0x25')])){var _0x1f52bf=util[_0x2caf('0x26')]('%s.cypher',_0xda0ec5[_0x2caf('0x25')]);return _0x37b08f[_0x2caf('0x27')](_0xda0ec5['value'],_0x1f52bf,config[_0x2caf('0x28')][_0x2caf('0x29')])[_0x2caf('0xa')](function(){fs['unlink'](_0xda0ec5[_0x2caf('0x25')]);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0xda0ec5;});}return _0xda0ec5;})[_0x2caf('0xa')](function(_0x28b715){logger[_0x2caf('0xb')](_0x2caf('0x1e'),_0x5ad211);logger[_0x2caf('0xe')](_0x2caf('0x1e'),_0x5ad211,JSON[_0x2caf('0x1c')](_0x28b715));_0x325eda(_0x28b715);})[_0x2caf('0x1d')](function(_0x20818e){logger['error'](_0x2caf('0x1e'),_0x20818e[_0x2caf('0x12')],_0x5ad211);_0xbefce6(_0x6a32ac[_0x2caf('0x10')](0x1f4,_0x20818e[_0x2caf('0x12')]));});});};
\ No newline at end of file
+var _0xd824=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','then','debug','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','%s.cypher','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash'];(function(_0x3b1a51,_0x14f19e){var _0x136c1f=function(_0x4d3af4){while(--_0x4d3af4){_0x3b1a51['push'](_0x3b1a51['shift']());}};_0x136c1f(++_0x14f19e);}(_0xd824,0xc2));var _0x4d82=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xd824[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4d82('0x0'));var util=require(_0x4d82('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4d82('0x2'));var fs=require('fs');var Redis=require(_0x4d82('0x3'));var db=require(_0x4d82('0x4'))['db'];var utils=require(_0x4d82('0x5'));var logger=require(_0x4d82('0x6'))(_0x4d82('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4d82('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4b842f,_0x464caf,_0xb54db2){return new BPromise(function(_0x13d624,_0x5cccb6){return client[_0x4d82('0x9')](_0x4b842f,_0xb54db2)['then'](function(_0x5356cd){logger[_0x4d82('0xa')](_0x4d82('0xb'),_0x464caf,_0x4d82('0xc'));logger['debug'](_0x4d82('0xd'),_0x464caf,'request\x20sent',JSON[_0x4d82('0xe')](_0x5356cd));if(_0x5356cd[_0x4d82('0xf')]){if(_0x5356cd[_0x4d82('0xf')]['code']===0x1f4){logger['error'](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')][_0x4d82('0x10')]);return _0x5cccb6(_0x5356cd[_0x4d82('0xf')]['message']);}logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x5356cd[_0x4d82('0xf')]['message']);return _0x13d624(_0x5356cd[_0x4d82('0xf')]['message']);}else{logger[_0x4d82('0xa')]('VoiceRecording,\x20%s,\x20%s',_0x464caf,_0x4d82('0xc'));_0x13d624(_0x5356cd['result'][_0x4d82('0x10')]);}})[_0x4d82('0x11')](function(_0x461476){logger[_0x4d82('0xf')](_0x4d82('0xb'),_0x464caf,_0x461476);_0x5cccb6(_0x461476);});});}exports[_0x4d82('0x12')]=function(_0x258c59){var _0x217b72=this;return new Promise(function(_0x2f2127,_0x5ef783){return db[_0x4d82('0x13')][_0x4d82('0x14')](_0x258c59[_0x4d82('0x15')],{'raw':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')][_0x4d82('0x18')]||null:null,'attributes':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['attributes']||null:null,'limit':_0x258c59[_0x4d82('0x16')]?_0x258c59[_0x4d82('0x16')]['limit']||null:null})[_0x4d82('0x19')](function(_0x41f194){logger[_0x4d82('0xa')](_0x4d82('0x12'),_0x258c59);logger[_0x4d82('0x1a')](_0x4d82('0x12'),_0x258c59,JSON[_0x4d82('0xe')](_0x41f194));_0x2f2127(_0x41f194);})[_0x4d82('0x11')](function(_0x12feab){logger[_0x4d82('0xf')](_0x4d82('0x12'),_0x12feab[_0x4d82('0x10')],_0x258c59);_0x5ef783(_0x217b72[_0x4d82('0xf')](0x1f4,_0x12feab[_0x4d82('0x10')]));});});};exports[_0x4d82('0x1b')]=function(_0x4af6da){var _0x5e0b03=this;return new Promise(function(_0x3dcb0f,_0x2548de){var _0x2a0572=require(_0x4d82('0x1c'));var _0x5cbd7e;return db[_0x4d82('0x1d')][_0x4d82('0x1e')]({'attributes':['id',_0x4d82('0x1f')],'where':{'id':0x1},'raw':!![]})[_0x4d82('0x19')](function(_0x5ce98b){_0x5cbd7e=_0x5ce98b;return db[_0x4d82('0x13')]['create'](_0x4af6da['body']);})['then'](function(_0x52533b){if(_0x5cbd7e[_0x4d82('0x1f')]&&fs[_0x4d82('0x20')](_0x52533b[_0x4d82('0x21')])){var _0x52e320=util[_0x4d82('0x22')](_0x4d82('0x23'),_0x52533b['value']);return _0x2a0572['encryptFile'](_0x52533b[_0x4d82('0x21')],_0x52e320,config[_0x4d82('0x24')][_0x4d82('0x25')])[_0x4d82('0x19')](function(){fs['unlink'](_0x52533b[_0x4d82('0x21')]);logger['info'](_0x4d82('0x26'));return _0x52533b;});}return _0x52533b;})[_0x4d82('0x19')](function(_0x4a2a45){logger['info'](_0x4d82('0x1b'),_0x4af6da);logger[_0x4d82('0x1a')](_0x4d82('0x1b'),_0x4af6da,JSON[_0x4d82('0xe')](_0x4a2a45));_0x3dcb0f(_0x4a2a45);})[_0x4d82('0x11')](function(_0x420b28){logger[_0x4d82('0xf')](_0x4d82('0x1b'),_0x420b28[_0x4d82('0x10')],_0x4af6da);_0x2548de(_0x5e0b03[_0x4d82('0xf')](0x1f4,_0x420b28['message']));});});};
\ No newline at end of file
index 7be3b19..5c3d41a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf66f=['isAuthenticated','index','/describe','describe','/:id','show','create','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get'];(function(_0x1b954f,_0x563eca){var _0x27c71e=function(_0x47ad0e){while(--_0x47ad0e){_0x1b954f['push'](_0x1b954f['shift']());}};_0x27c71e(++_0x563eca);}(_0xf66f,0x160));var _0xff66=function(_0x29dfa5,_0xd3078e){_0x29dfa5=_0x29dfa5-0x0;var _0x41c15a=_0xf66f[_0x29dfa5];return _0x41c15a;};'use strict';var multer=require(_0xff66('0x0'));var util=require(_0xff66('0x1'));var path=require(_0xff66('0x2'));var timeout=require(_0xff66('0x3'));var express=require(_0xff66('0x4'));var router=express['Router']();var fs_extra=require(_0xff66('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xff66('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xff66('0x7')]('/',auth[_0xff66('0x8')](),controller[_0xff66('0x9')]);router['get'](_0xff66('0xa'),auth[_0xff66('0x8')](),controller[_0xff66('0xb')]);router['get'](_0xff66('0xc'),auth[_0xff66('0x8')](),controller[_0xff66('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xff66('0xe')]);router['put'](_0xff66('0xc'),auth[_0xff66('0x8')](),controller['update']);router[_0xff66('0xf')](_0xff66('0xc'),auth[_0xff66('0x8')](),controller[_0xff66('0x10')]);module[_0xff66('0x11')]=router;
\ No newline at end of file
+var _0x51a3=['multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/describe','describe','/:id','show','create','put','update','destroy'];(function(_0x13893b,_0x510a2b){var _0x4d0949=function(_0x32d6a7){while(--_0x32d6a7){_0x13893b['push'](_0x13893b['shift']());}};_0x4d0949(++_0x510a2b);}(_0x51a3,0x110));var _0x351a=function(_0x373408,_0x6d5db){_0x373408=_0x373408-0x0;var _0x523114=_0x51a3[_0x373408];return _0x523114;};'use strict';var multer=require(_0x351a('0x0'));var util=require(_0x351a('0x1'));var path=require(_0x351a('0x2'));var timeout=require(_0x351a('0x3'));var express=require('express');var router=express[_0x351a('0x4')]();var fs_extra=require(_0x351a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x351a('0x6'));var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0x351a('0x7')](),controller['index']);router[_0x351a('0x8')](_0x351a('0x9'),auth[_0x351a('0x7')](),controller[_0x351a('0xa')]);router['get'](_0x351a('0xb'),auth['isAuthenticated'](),controller[_0x351a('0xc')]);router['post']('/',auth[_0x351a('0x7')](),controller[_0x351a('0xd')]);router[_0x351a('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x351a('0xf')]);router['delete'](_0x351a('0xb'),auth[_0x351a('0x7')](),controller[_0x351a('0x10')]);module['exports']=router;
\ No newline at end of file
index 02074af..b38c668 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf80b=['blind','attended','STRING','Yes','sequelize','moment','ENUM'];(function(_0x26bf3,_0x2707a9){var _0x48bb65=function(_0x542be){while(--_0x542be){_0x26bf3['push'](_0x26bf3['shift']());}};_0x48bb65(++_0x2707a9);}(_0xf80b,0x15b));var _0xbf80=function(_0x47edd3,_0x36d1ed){_0x47edd3=_0x47edd3-0x0;var _0x11d317=_0xf80b[_0x47edd3];return _0x11d317;};'use strict';var Sequelize=require(_0xbf80('0x0'));var moment=require(_0xbf80('0x1'));module['exports']={'type':{'type':Sequelize[_0xbf80('0x2')](_0xbf80('0x3'),_0xbf80('0x4'))},'result':{'type':Sequelize[_0xbf80('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0xbf80('0x5')]},'transferercalleridname':{'type':Sequelize[_0xbf80('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xbf80('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0xbf80('0x5')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xbf80('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0xbf80('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0xbf80('0x5')]},'transfereecontext':{'type':Sequelize[_0xbf80('0x5')]},'transfereeexten':{'type':Sequelize[_0xbf80('0x5')]},'transfereelinkedid':{'type':Sequelize[_0xbf80('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0xbf80('0x6'),'No')},'context':{'type':Sequelize[_0xbf80('0x5')]},'extension':{'type':Sequelize['STRING']}};
\ No newline at end of file
+var _0xc067=['exports','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x553bd0,_0x3a06e9){var _0x305023=function(_0x45d089){while(--_0x45d089){_0x553bd0['push'](_0x553bd0['shift']());}};_0x305023(++_0x3a06e9);}(_0xc067,0xad));var _0x7c06=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0xc067[_0x26a4ea];return _0x1b669e;};'use strict';var Sequelize=require(_0x7c06('0x0'));var moment=require(_0x7c06('0x1'));module[_0x7c06('0x2')]={'type':{'type':Sequelize['ENUM'](_0x7c06('0x3'),_0x7c06('0x4'))},'result':{'type':Sequelize[_0x7c06('0x5')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x7c06('0x5')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x7c06('0x5')]},'transferercontext':{'type':Sequelize[_0x7c06('0x5')]},'transfererexten':{'type':Sequelize[_0x7c06('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x7c06('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x7c06('0x5')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x7c06('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x7c06('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x7c06('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x7c06('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x7c06('0x6'),'No')},'context':{'type':Sequelize[_0x7c06('0x5')]},'extension':{'type':Sequelize[_0x7c06('0x5')]}};
\ No newline at end of file
index 334e39a..7d078ec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf9be=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','VoiceTransferReport','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','catch','params','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x242ddc,_0xb1fb03){var _0x7a6756=function(_0xd7d430){while(--_0xd7d430){_0x242ddc['push'](_0x242ddc['shift']());}};_0x7a6756(++_0xb1fb03);}(_0xf9be,0x1c5));var _0xef9b=function(_0xb65f0c,_0xe60c57){_0xb65f0c=_0xb65f0c-0x0;var _0x2ff246=_0xf9be[_0xb65f0c];return _0x2ff246;};'use strict';var emlformat=require(_0xef9b('0x0'));var rimraf=require(_0xef9b('0x1'));var zipdir=require(_0xef9b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef9b('0x3'));var moment=require(_0xef9b('0x4'));var BPromise=require(_0xef9b('0x5'));var Mustache=require(_0xef9b('0x6'));var util=require(_0xef9b('0x7'));var path=require(_0xef9b('0x8'));var sox=require(_0xef9b('0x9'));var csv=require('to-csv');var ejs=require(_0xef9b('0xa'));var fs=require('fs');var fs_extra=require(_0xef9b('0xb'));var _=require(_0xef9b('0xc'));var squel=require(_0xef9b('0xd'));var crypto=require(_0xef9b('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xef9b('0xf'));var Papa=require(_0xef9b('0x10'));var Redis=require(_0xef9b('0x11'));var authService=require(_0xef9b('0x12'));var qs=require(_0xef9b('0x13'));var as=require(_0xef9b('0x14'));var hardwareService=require(_0xef9b('0x15'));var logger=require(_0xef9b('0x16'))(_0xef9b('0x17'));var utils=require(_0xef9b('0x18'));var config=require(_0xef9b('0x19'));var licenseUtil=require(_0xef9b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x239648,_0x1bf6dd){_0x1bf6dd=_0x1bf6dd||0xcc;return function(_0x417ab0){if(_0x417ab0){return _0x239648[_0xef9b('0x1b')](_0x1bf6dd);}return _0x239648[_0xef9b('0x1c')](_0x1bf6dd)['end']();};}function respondWithResult(_0x4f8030,_0xde65ba){_0xde65ba=_0xde65ba||0xc8;return function(_0x2d003f){if(_0x2d003f){return _0x4f8030[_0xef9b('0x1c')](_0xde65ba)[_0xef9b('0x1d')](_0x2d003f);}};}function respondWithFilteredResult(_0x5673ee,_0x2e25f0){return function(_0x320a66){if(_0x320a66){var _0x5513f9=typeof _0x2e25f0[_0xef9b('0x1e')]===_0xef9b('0x1f')&&typeof _0x2e25f0['limit']===_0xef9b('0x1f');var _0x253667=_0x320a66[_0xef9b('0x20')];var _0x534929=_0x5513f9?0x0:_0x2e25f0[_0xef9b('0x1e')];var _0x335663=_0x5513f9?_0x320a66[_0xef9b('0x20')]:_0x2e25f0[_0xef9b('0x1e')]+_0x2e25f0['limit'];var _0x2e3036;if(_0x335663>=_0x253667){_0x335663=_0x253667;_0x2e3036=0xc8;}else{_0x2e3036=0xce;}_0x5673ee[_0xef9b('0x1c')](_0x2e3036);return _0x5673ee[_0xef9b('0x21')](_0xef9b('0x22'),_0x534929+'-'+_0x335663+'/'+_0x253667)['json'](_0x320a66);}return null;};}function patchUpdates(_0x56b158){return function(_0x583792){try{jsonpatch[_0xef9b('0x23')](_0x583792,_0x56b158,!![]);}catch(_0x19c552){return BPromise[_0xef9b('0x24')](_0x19c552);}return _0x583792[_0xef9b('0x25')]();};}function saveUpdates(_0x19b82a,_0x28b7bc){return function(_0xa9986){if(_0xa9986){return _0xa9986[_0xef9b('0x26')](_0x19b82a)[_0xef9b('0x27')](function(_0x820c25){return _0x820c25;});}return null;};}function removeEntity(_0x2b1b56,_0x1c551a){return function(_0x4c66c9){if(_0x4c66c9){return _0x4c66c9[_0xef9b('0x28')]()[_0xef9b('0x27')](function(){_0x2b1b56[_0xef9b('0x1c')](0xcc)[_0xef9b('0x29')]();});}};}function handleEntityNotFound(_0x19cb98,_0x59091a){return function(_0x262371){if(!_0x262371){_0x19cb98[_0xef9b('0x1b')](0x194);}return _0x262371;};}function handleError(_0x2c4c7a,_0x2311aa){_0x2311aa=_0x2311aa||0x1f4;return function(_0x50c607){logger[_0xef9b('0x2a')](_0x50c607[_0xef9b('0x2b')]);if(_0x50c607[_0xef9b('0x2c')]){delete _0x50c607[_0xef9b('0x2c')];}_0x2c4c7a['status'](_0x2311aa)[_0xef9b('0x2d')](_0x50c607);};}exports[_0xef9b('0x2e')]=function(_0x3da323,_0x6db81){var _0x1d868e={},_0x24233b={},_0x196dfc={'count':0x0,'rows':[]};var _0x40120d=_[_0xef9b('0x2f')](db[_0xef9b('0x30')]['rawAttributes'],function(_0x3745dc){return{'name':_0x3745dc[_0xef9b('0x31')],'type':_0x3745dc['type'][_0xef9b('0x32')]};});_0x24233b[_0xef9b('0x33')]=_[_0xef9b('0x2f')](_0x40120d,_0xef9b('0x2c'));_0x24233b['query']=_[_0xef9b('0x34')](_0x3da323['query']);_0x24233b[_0xef9b('0x35')]=_[_0xef9b('0x36')](_0x24233b[_0xef9b('0x33')],_0x24233b[_0xef9b('0x37')]);_0x1d868e[_0xef9b('0x38')]=_['intersection'](_0x24233b[_0xef9b('0x33')],qs[_0xef9b('0x39')](_0x3da323[_0xef9b('0x37')]['fields']));_0x1d868e[_0xef9b('0x38')]=_0x1d868e[_0xef9b('0x38')][_0xef9b('0x3a')]?_0x1d868e['attributes']:_0x24233b[_0xef9b('0x33')];if(!_0x3da323[_0xef9b('0x37')]['hasOwnProperty']('nolimit')){_0x1d868e[_0xef9b('0x3b')]=qs[_0xef9b('0x3b')](_0x3da323[_0xef9b('0x37')][_0xef9b('0x3b')]);_0x1d868e['offset']=qs[_0xef9b('0x1e')](_0x3da323[_0xef9b('0x37')][_0xef9b('0x1e')]);}_0x1d868e[_0xef9b('0x3c')]=qs[_0xef9b('0x3d')](_0x3da323[_0xef9b('0x37')]['sort']);_0x1d868e[_0xef9b('0x3e')]=qs[_0xef9b('0x35')](_[_0xef9b('0x3f')](_0x3da323['query'],_0x24233b[_0xef9b('0x35')]),_0x40120d);if(_0x3da323[_0xef9b('0x37')][_0xef9b('0x40')]){_0x1d868e[_0xef9b('0x3e')]=_[_0xef9b('0x41')](_0x1d868e[_0xef9b('0x3e')],{'$or':_[_0xef9b('0x2f')](_0x40120d,function(_0x1f1254){if(_0x1f1254[_0xef9b('0x42')]!==_0xef9b('0x43')){var _0x11a46f={};_0x11a46f[_0x1f1254['name']]={'$like':'%'+_0x3da323['query'][_0xef9b('0x40')]+'%'};return _0x11a46f;}})});}_0x1d868e=_[_0xef9b('0x41')]({},_0x1d868e,_0x3da323[_0xef9b('0x44')]);var _0x160b3e={'where':_0x1d868e[_0xef9b('0x3e')]};return db[_0xef9b('0x30')][_0xef9b('0x20')](_0x160b3e)[_0xef9b('0x27')](function(_0x55d890){_0x196dfc['count']=_0x55d890;if(_0x3da323[_0xef9b('0x37')]['includeAll']){_0x1d868e[_0xef9b('0x45')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xef9b('0x46')](_0x1d868e);})[_0xef9b('0x27')](function(_0x3dba6d){_0x196dfc['rows']=_0x3dba6d;return _0x196dfc;})[_0xef9b('0x27')](respondWithFilteredResult(_0x6db81,_0x1d868e))[_0xef9b('0x47')](handleError(_0x6db81,null));};exports['show']=function(_0x5ea6d2,_0x546365){var _0x5b4041={'raw':!![],'where':{'id':_0x5ea6d2[_0xef9b('0x48')]['id']}},_0xc4d99c={};_0xc4d99c['model']=_[_0xef9b('0x34')](db[_0xef9b('0x30')][_0xef9b('0x49')]);_0xc4d99c[_0xef9b('0x37')]=_['keys'](_0x5ea6d2['query']);_0xc4d99c['filters']=_['intersection'](_0xc4d99c[_0xef9b('0x33')],_0xc4d99c[_0xef9b('0x37')]);_0x5b4041[_0xef9b('0x38')]=_[_0xef9b('0x36')](_0xc4d99c[_0xef9b('0x33')],qs['fields'](_0x5ea6d2['query'][_0xef9b('0x39')]));_0x5b4041['attributes']=_0x5b4041[_0xef9b('0x38')][_0xef9b('0x3a')]?_0x5b4041['attributes']:_0xc4d99c[_0xef9b('0x33')];if(_0x5ea6d2[_0xef9b('0x37')][_0xef9b('0x4a')]){_0x5b4041[_0xef9b('0x45')]=[{'all':!![]}];}_0x5b4041=_[_0xef9b('0x41')]({},_0x5b4041,_0x5ea6d2[_0xef9b('0x44')]);return db['VoiceTransferReport'][_0xef9b('0x4b')](_0x5b4041)[_0xef9b('0x27')](handleEntityNotFound(_0x546365,null))['then'](respondWithResult(_0x546365,null))[_0xef9b('0x47')](handleError(_0x546365,null));};exports[_0xef9b('0x4c')]=function(_0x415668,_0x3bc707){return db['VoiceTransferReport']['create'](_0x415668[_0xef9b('0x4d')],{})[_0xef9b('0x27')](respondWithResult(_0x3bc707,0xc9))[_0xef9b('0x47')](handleError(_0x3bc707,null));};exports[_0xef9b('0x26')]=function(_0x44c787,_0x3fdf82){if(_0x44c787[_0xef9b('0x4d')]['id']){delete _0x44c787['body']['id'];}return db['VoiceTransferReport'][_0xef9b('0x4b')]({'where':{'id':_0x44c787['params']['id']}})[_0xef9b('0x27')](handleEntityNotFound(_0x3fdf82,null))[_0xef9b('0x27')](saveUpdates(_0x44c787[_0xef9b('0x4d')],null))[_0xef9b('0x27')](respondWithResult(_0x3fdf82,null))['catch'](handleError(_0x3fdf82,null));};exports[_0xef9b('0x28')]=function(_0xe84a58,_0x35b708){return db[_0xef9b('0x30')][_0xef9b('0x4b')]({'where':{'id':_0xe84a58[_0xef9b('0x48')]['id']}})[_0xef9b('0x27')](handleEntityNotFound(_0x35b708,null))[_0xef9b('0x27')](removeEntity(_0x35b708,null))[_0xef9b('0x47')](handleError(_0x35b708,null));};exports[_0xef9b('0x4e')]=function(_0x5f154d,_0x474b6b){return db[_0xef9b('0x30')][_0xef9b('0x4e')]()['then'](respondWithResult(_0x474b6b,null))[_0xef9b('0x47')](handleError(_0x474b6b,null));};
\ No newline at end of file
+var _0x33ff=['length','hasOwnProperty','limit','order','sort','filter','merge','VIRTUAL','options','where','include','findAll','rows','catch','show','keys','create','body','params','find','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','set','Content-Range','json','reject','save','update','then','destroy','end','sendStatus','error','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields'];(function(_0x2d339c,_0x253cc8){var _0x5b72d3=function(_0x4a03ae){while(--_0x4a03ae){_0x2d339c['push'](_0x2d339c['shift']());}};_0x5b72d3(++_0x253cc8);}(_0x33ff,0xf9));var _0xf33f=function(_0x2f92d8,_0x2ef7f4){_0x2f92d8=_0x2f92d8-0x0;var _0x200ef1=_0x33ff[_0x2f92d8];return _0x200ef1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf33f('0x0'));var zipdir=require(_0xf33f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf33f('0x2'));var moment=require(_0xf33f('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf33f('0x4'));var util=require(_0xf33f('0x5'));var path=require(_0xf33f('0x6'));var sox=require(_0xf33f('0x7'));var csv=require(_0xf33f('0x8'));var ejs=require(_0xf33f('0x9'));var fs=require('fs');var fs_extra=require(_0xf33f('0xa'));var _=require(_0xf33f('0xb'));var squel=require(_0xf33f('0xc'));var crypto=require(_0xf33f('0xd'));var jsforce=require(_0xf33f('0xe'));var deskjs=require(_0xf33f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf33f('0x10'));var Papa=require(_0xf33f('0x11'));var Redis=require(_0xf33f('0x12'));var authService=require(_0xf33f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xf33f('0x14'));var hardwareService=require(_0xf33f('0x15'));var logger=require(_0xf33f('0x16'))('api');var utils=require(_0xf33f('0x17'));var config=require(_0xf33f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf33f('0x19'))['db'];function respondWithStatusCode(_0x4dc871,_0x33313d){_0x33313d=_0x33313d||0xcc;return function(_0x178b87){if(_0x178b87){return _0x4dc871['sendStatus'](_0x33313d);}return _0x4dc871[_0xf33f('0x1a')](_0x33313d)['end']();};}function respondWithResult(_0x14d8b1,_0x4d71ac){_0x4d71ac=_0x4d71ac||0xc8;return function(_0x3cc556){if(_0x3cc556){return _0x14d8b1[_0xf33f('0x1a')](_0x4d71ac)['json'](_0x3cc556);}};}function respondWithFilteredResult(_0x3ea5fd,_0x64e122){return function(_0x493c0d){if(_0x493c0d){var _0x259b6d=typeof _0x64e122[_0xf33f('0x1b')]===_0xf33f('0x1c')&&typeof _0x64e122['limit']===_0xf33f('0x1c');var _0x56bae8=_0x493c0d['count'];var _0x252bdf=_0x259b6d?0x0:_0x64e122['offset'];var _0x2720df=_0x259b6d?_0x493c0d[_0xf33f('0x1d')]:_0x64e122[_0xf33f('0x1b')]+_0x64e122['limit'];var _0x57a24b;if(_0x2720df>=_0x56bae8){_0x2720df=_0x56bae8;_0x57a24b=0xc8;}else{_0x57a24b=0xce;}_0x3ea5fd[_0xf33f('0x1a')](_0x57a24b);return _0x3ea5fd[_0xf33f('0x1e')](_0xf33f('0x1f'),_0x252bdf+'-'+_0x2720df+'/'+_0x56bae8)[_0xf33f('0x20')](_0x493c0d);}return null;};}function patchUpdates(_0x1af2b7){return function(_0x2c2f09){try{jsonpatch['apply'](_0x2c2f09,_0x1af2b7,!![]);}catch(_0x547278){return BPromise[_0xf33f('0x21')](_0x547278);}return _0x2c2f09[_0xf33f('0x22')]();};}function saveUpdates(_0xfcb2f9,_0x2836e1){return function(_0x1664b4){if(_0x1664b4){return _0x1664b4[_0xf33f('0x23')](_0xfcb2f9)[_0xf33f('0x24')](function(_0x3dbf9f){return _0x3dbf9f;});}return null;};}function removeEntity(_0xcff6fc,_0x45c122){return function(_0x2c04a8){if(_0x2c04a8){return _0x2c04a8[_0xf33f('0x25')]()[_0xf33f('0x24')](function(){_0xcff6fc[_0xf33f('0x1a')](0xcc)[_0xf33f('0x26')]();});}};}function handleEntityNotFound(_0x324e6f,_0x119811){return function(_0x408b93){if(!_0x408b93){_0x324e6f[_0xf33f('0x27')](0x194);}return _0x408b93;};}function handleError(_0x267df7,_0x57b3ba){_0x57b3ba=_0x57b3ba||0x1f4;return function(_0x45a2b2){logger[_0xf33f('0x28')](_0x45a2b2['stack']);if(_0x45a2b2[_0xf33f('0x29')]){delete _0x45a2b2['name'];}_0x267df7[_0xf33f('0x1a')](_0x57b3ba)[_0xf33f('0x2a')](_0x45a2b2);};}exports[_0xf33f('0x2b')]=function(_0x41d1c5,_0xe9daea){var _0xf32339={},_0x457227={},_0x53d504={'count':0x0,'rows':[]};var _0x425913=_[_0xf33f('0x2c')](db[_0xf33f('0x2d')][_0xf33f('0x2e')],function(_0x4c4913){return{'name':_0x4c4913[_0xf33f('0x2f')],'type':_0x4c4913['type'][_0xf33f('0x30')]};});_0x457227['model']=_[_0xf33f('0x2c')](_0x425913,_0xf33f('0x29'));_0x457227[_0xf33f('0x31')]=_['keys'](_0x41d1c5['query']);_0x457227[_0xf33f('0x32')]=_[_0xf33f('0x33')](_0x457227[_0xf33f('0x34')],_0x457227[_0xf33f('0x31')]);_0xf32339[_0xf33f('0x35')]=_[_0xf33f('0x33')](_0x457227[_0xf33f('0x34')],qs[_0xf33f('0x36')](_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x36')]));_0xf32339[_0xf33f('0x35')]=_0xf32339['attributes'][_0xf33f('0x37')]?_0xf32339['attributes']:_0x457227[_0xf33f('0x34')];if(!_0x41d1c5['query'][_0xf33f('0x38')]('nolimit')){_0xf32339[_0xf33f('0x39')]=qs[_0xf33f('0x39')](_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x39')]);_0xf32339[_0xf33f('0x1b')]=qs['offset'](_0x41d1c5['query']['offset']);}_0xf32339[_0xf33f('0x3a')]=qs[_0xf33f('0x3b')](_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x3b')]);_0xf32339['where']=qs[_0xf33f('0x32')](_['pick'](_0x41d1c5['query'],_0x457227[_0xf33f('0x32')]),_0x425913);if(_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x3c')]){_0xf32339['where']=_[_0xf33f('0x3d')](_0xf32339['where'],{'$or':_[_0xf33f('0x2c')](_0x425913,function(_0xfd3e1b){if(_0xfd3e1b['type']!==_0xf33f('0x3e')){var _0xabf3c9={};_0xabf3c9[_0xfd3e1b[_0xf33f('0x29')]]={'$like':'%'+_0x41d1c5[_0xf33f('0x31')][_0xf33f('0x3c')]+'%'};return _0xabf3c9;}})});}_0xf32339=_[_0xf33f('0x3d')]({},_0xf32339,_0x41d1c5[_0xf33f('0x3f')]);var _0x591d5={'where':_0xf32339[_0xf33f('0x40')]};return db[_0xf33f('0x2d')][_0xf33f('0x1d')](_0x591d5)['then'](function(_0x46054d){_0x53d504[_0xf33f('0x1d')]=_0x46054d;if(_0x41d1c5[_0xf33f('0x31')]['includeAll']){_0xf32339[_0xf33f('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xf33f('0x42')](_0xf32339);})['then'](function(_0x373601){_0x53d504[_0xf33f('0x43')]=_0x373601;return _0x53d504;})[_0xf33f('0x24')](respondWithFilteredResult(_0xe9daea,_0xf32339))[_0xf33f('0x44')](handleError(_0xe9daea,null));};exports[_0xf33f('0x45')]=function(_0x8c31d0,_0x247ad7){var _0x97224e={'raw':!![],'where':{'id':_0x8c31d0['params']['id']}},_0xa2a8b6={};_0xa2a8b6[_0xf33f('0x34')]=_[_0xf33f('0x46')](db[_0xf33f('0x2d')][_0xf33f('0x2e')]);_0xa2a8b6['query']=_['keys'](_0x8c31d0[_0xf33f('0x31')]);_0xa2a8b6['filters']=_[_0xf33f('0x33')](_0xa2a8b6['model'],_0xa2a8b6[_0xf33f('0x31')]);_0x97224e[_0xf33f('0x35')]=_['intersection'](_0xa2a8b6['model'],qs['fields'](_0x8c31d0[_0xf33f('0x31')][_0xf33f('0x36')]));_0x97224e[_0xf33f('0x35')]=_0x97224e[_0xf33f('0x35')][_0xf33f('0x37')]?_0x97224e[_0xf33f('0x35')]:_0xa2a8b6[_0xf33f('0x34')];if(_0x8c31d0[_0xf33f('0x31')]['includeAll']){_0x97224e[_0xf33f('0x41')]=[{'all':!![]}];}_0x97224e=_[_0xf33f('0x3d')]({},_0x97224e,_0x8c31d0[_0xf33f('0x3f')]);return db[_0xf33f('0x2d')]['find'](_0x97224e)[_0xf33f('0x24')](handleEntityNotFound(_0x247ad7,null))[_0xf33f('0x24')](respondWithResult(_0x247ad7,null))[_0xf33f('0x44')](handleError(_0x247ad7,null));};exports[_0xf33f('0x47')]=function(_0x4438df,_0x485c34){return db[_0xf33f('0x2d')]['create'](_0x4438df[_0xf33f('0x48')],{})[_0xf33f('0x24')](respondWithResult(_0x485c34,0xc9))[_0xf33f('0x44')](handleError(_0x485c34,null));};exports[_0xf33f('0x23')]=function(_0x4d9d95,_0x340dda){if(_0x4d9d95[_0xf33f('0x48')]['id']){delete _0x4d9d95['body']['id'];}return db[_0xf33f('0x2d')]['find']({'where':{'id':_0x4d9d95[_0xf33f('0x49')]['id']}})['then'](handleEntityNotFound(_0x340dda,null))[_0xf33f('0x24')](saveUpdates(_0x4d9d95[_0xf33f('0x48')],null))[_0xf33f('0x24')](respondWithResult(_0x340dda,null))[_0xf33f('0x44')](handleError(_0x340dda,null));};exports[_0xf33f('0x25')]=function(_0x35bfa0,_0x159912){return db[_0xf33f('0x2d')][_0xf33f('0x4a')]({'where':{'id':_0x35bfa0[_0xf33f('0x49')]['id']}})[_0xf33f('0x24')](handleEntityNotFound(_0x159912,null))[_0xf33f('0x24')](removeEntity(_0x159912,null))[_0xf33f('0x44')](handleError(_0x159912,null));};exports['describe']=function(_0x3ba719,_0x40e4fb){return db[_0xf33f('0x2d')][_0xf33f('0x4b')]()[_0xf33f('0x24')](respondWithResult(_0x40e4fb,null))[_0xf33f('0x44')](handleError(_0x40e4fb,null));};
\ No newline at end of file
index 5e471e5..d0b3585 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x68c2=['./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x29a894,_0x5f2d6f){var _0x588f68=function(_0x3a19cf){while(--_0x3a19cf){_0x29a894['push'](_0x29a894['shift']());}};_0x588f68(++_0x5f2d6f);}(_0x68c2,0x10f));var _0x268c=function(_0x84a85,_0x54e55c){_0x84a85=_0x84a85-0x0;var _0x1c2943=_0x68c2[_0x84a85];return _0x1c2943;};'use strict';var _=require('lodash');var util=require(_0x268c('0x0'));var logger=require(_0x268c('0x1'))(_0x268c('0x2'));var moment=require(_0x268c('0x3'));var BPromise=require(_0x268c('0x4'));var rp=require(_0x268c('0x5'));var fs=require('fs');var path=require(_0x268c('0x6'));var rimraf=require(_0x268c('0x7'));var config=require(_0x268c('0x8'));var attributes=require(_0x268c('0x9'));module[_0x268c('0xa')]=function(_0x10a224,_0x4074){return _0x10a224[_0x268c('0xb')](_0x268c('0xc'),attributes,{'tableName':_0x268c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x50e7=['moment','bluebird','request-promise','path','../../config/environment','./voiceTransferReport.attributes','exports','define','lodash','../../config/logger','api'];(function(_0x430b4a,_0x3053f6){var _0x23bd67=function(_0x30bc98){while(--_0x30bc98){_0x430b4a['push'](_0x430b4a['shift']());}};_0x23bd67(++_0x3053f6);}(_0x50e7,0x152));var _0x750e=function(_0x34bda3,_0x5774bf){_0x34bda3=_0x34bda3-0x0;var _0x474d5b=_0x50e7[_0x34bda3];return _0x474d5b;};'use strict';var _=require(_0x750e('0x0'));var util=require('util');var logger=require(_0x750e('0x1'))(_0x750e('0x2'));var moment=require(_0x750e('0x3'));var BPromise=require(_0x750e('0x4'));var rp=require(_0x750e('0x5'));var fs=require('fs');var path=require(_0x750e('0x6'));var rimraf=require('rimraf');var config=require(_0x750e('0x7'));var attributes=require(_0x750e('0x8'));module[_0x750e('0x9')]=function(_0x7f9d09,_0x5bac0b){return _0x7f9d09[_0x750e('0xa')]('VoiceTransferReport',attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index e631c79..4be9f7e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1897=['jayson/promise','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1e89a2,_0x3e0802){var _0x138787=function(_0x2cbd93){while(--_0x2cbd93){_0x1e89a2['push'](_0x1e89a2['shift']());}};_0x138787(++_0x3e0802);}(_0x1897,0x16e));var _0x7189=function(_0x35bfe4,_0xc45df3){_0x35bfe4=_0x35bfe4-0x0;var _0x3eb686=_0x1897[_0x35bfe4];return _0x3eb686;};'use strict';var _=require(_0x7189('0x0'));var util=require(_0x7189('0x1'));var moment=require(_0x7189('0x2'));var BPromise=require(_0x7189('0x3'));var rs=require(_0x7189('0x4'));var fs=require('fs');var Redis=require(_0x7189('0x5'));var db=require(_0x7189('0x6'))['db'];var utils=require(_0x7189('0x7'));var logger=require(_0x7189('0x8'))(_0x7189('0x9'));var config=require(_0x7189('0xa'));var jayson=require(_0x7189('0xb'));var client=jayson['client'][_0x7189('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x18a467,_0x3425c7,_0x24654c){return new BPromise(function(_0x463b42,_0x4a50fe){return client['request'](_0x18a467,_0x24654c)[_0x7189('0xd')](function(_0x4eafe7){logger[_0x7189('0xe')](_0x7189('0xf'),_0x3425c7,_0x7189('0x10'));logger['debug'](_0x7189('0x11'),_0x3425c7,_0x7189('0x10'),JSON[_0x7189('0x12')](_0x4eafe7));if(_0x4eafe7[_0x7189('0x13')]){if(_0x4eafe7[_0x7189('0x13')]['code']===0x1f4){logger[_0x7189('0x13')](_0x7189('0xf'),_0x3425c7,_0x4eafe7[_0x7189('0x13')][_0x7189('0x14')]);return _0x4a50fe(_0x4eafe7['error'][_0x7189('0x14')]);}logger[_0x7189('0x13')](_0x7189('0xf'),_0x3425c7,_0x4eafe7['error']['message']);return _0x463b42(_0x4eafe7[_0x7189('0x13')][_0x7189('0x14')]);}else{logger[_0x7189('0xe')](_0x7189('0xf'),_0x3425c7,_0x7189('0x10'));_0x463b42(_0x4eafe7[_0x7189('0x15')]['message']);}})[_0x7189('0x16')](function(_0x4158aa){logger['error'](_0x7189('0xf'),_0x3425c7,_0x4158aa);_0x4a50fe(_0x4158aa);});});}exports[_0x7189('0x17')]=function(_0x267e2f){var _0x4c5229=this;return new Promise(function(_0x88426b,_0x221707){return db[_0x7189('0x18')][_0x7189('0x19')](_0x267e2f[_0x7189('0x1a')],{'raw':_0x267e2f['options']?_0x267e2f[_0x7189('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x7189('0xd')](function(_0x344906){logger[_0x7189('0xe')](_0x7189('0x17'),_0x267e2f);logger[_0x7189('0x1c')](_0x7189('0x17'),_0x267e2f,JSON[_0x7189('0x12')](_0x344906));_0x88426b(_0x344906);})['catch'](function(_0x41bfe7){logger['error']('CreateVoiceTransferReport',_0x41bfe7[_0x7189('0x14')],_0x267e2f);_0x221707(_0x4c5229[_0x7189('0x13')](0x1f4,_0x41bfe7['message']));});});};
\ No newline at end of file
+var _0xdc83=['../../config/logger','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','VoiceTransferReport','body','options','raw','then','CreateVoiceTransferReport','lodash','util','randomstring','../../mysqldb'];(function(_0x581481,_0x190792){var _0x4dfd79=function(_0x3be3ad){while(--_0x3be3ad){_0x581481['push'](_0x581481['shift']());}};_0x4dfd79(++_0x190792);}(_0xdc83,0x14c));var _0x3dc8=function(_0x49709b,_0xfe162e){_0x49709b=_0x49709b-0x0;var _0x4867d2=_0xdc83[_0x49709b];return _0x4867d2;};'use strict';var _=require(_0x3dc8('0x0'));var util=require(_0x3dc8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3dc8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3dc8('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3dc8('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3dc8('0x5'));var client=jayson[_0x3dc8('0x6')][_0x3dc8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1bf16c,_0x1a656a,_0x5ebb29){return new BPromise(function(_0x10982b,_0x45918d){return client[_0x3dc8('0x8')](_0x1bf16c,_0x5ebb29)['then'](function(_0x4de363){logger[_0x3dc8('0x9')](_0x3dc8('0xa'),_0x1a656a,_0x3dc8('0xb'));logger[_0x3dc8('0xc')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x1a656a,_0x3dc8('0xb'),JSON[_0x3dc8('0xd')](_0x4de363));if(_0x4de363[_0x3dc8('0xe')]){if(_0x4de363['error'][_0x3dc8('0xf')]===0x1f4){logger[_0x3dc8('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x1a656a,_0x4de363[_0x3dc8('0xe')][_0x3dc8('0x10')]);return _0x45918d(_0x4de363[_0x3dc8('0xe')]['message']);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x1a656a,_0x4de363[_0x3dc8('0xe')][_0x3dc8('0x10')]);return _0x10982b(_0x4de363['error'][_0x3dc8('0x10')]);}else{logger[_0x3dc8('0x9')](_0x3dc8('0xa'),_0x1a656a,'request\x20sent');_0x10982b(_0x4de363['result'][_0x3dc8('0x10')]);}})[_0x3dc8('0x11')](function(_0x44c2a7){logger[_0x3dc8('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x1a656a,_0x44c2a7);_0x45918d(_0x44c2a7);});});}exports['CreateVoiceTransferReport']=function(_0x59bfc7){var _0x264d95=this;return new Promise(function(_0x3d20e8,_0x87a7aa){return db[_0x3dc8('0x12')]['create'](_0x59bfc7[_0x3dc8('0x13')],{'raw':_0x59bfc7[_0x3dc8('0x14')]?_0x59bfc7[_0x3dc8('0x14')][_0x3dc8('0x15')]===undefined?!![]:![]:!![]})[_0x3dc8('0x16')](function(_0x4b343b){logger[_0x3dc8('0x9')](_0x3dc8('0x17'),_0x59bfc7);logger['debug'](_0x3dc8('0x17'),_0x59bfc7,JSON[_0x3dc8('0xd')](_0x4b343b));_0x3d20e8(_0x4b343b);})[_0x3dc8('0x11')](function(_0x58b881){logger[_0x3dc8('0xe')](_0x3dc8('0x17'),_0x58b881[_0x3dc8('0x10')],_0x59bfc7);_0x87a7aa(_0x264d95['error'](0x1f4,_0x58b881[_0x3dc8('0x10')]));});});};
\ No newline at end of file
index 1007174..0a139d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x21ccc2,_0x1ac1dd){var _0x33898a=function(_0x4f52bd){while(--_0x4f52bd){_0x21ccc2['push'](_0x21ccc2['shift']());}};_0x33898a(++_0x1ac1dd);}(_0x9f62,0x154));var _0x29f6=function(_0x1c1f58,_0x4f689b){_0x1c1f58=_0x1c1f58-0x0;var _0x13c22f=_0x9f62[_0x1c1f58];return _0x13c22f;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router;
\ No newline at end of file
+var _0x91a7=['/originate','isWebrtcLicence','/hangup','isAuthenticated','hangup','/answer','answer','post','/hold','/unhold','unhold','/calls','/transfer','transfer','exports','Router','../../components/auth/service','./webbar.controller'];(function(_0x586fa2,_0x1a45bc){var _0x515be9=function(_0x4e90d5){while(--_0x4e90d5){_0x586fa2['push'](_0x586fa2['shift']());}};_0x515be9(++_0x1a45bc);}(_0x91a7,0xe7));var _0x791a=function(_0x183c17,_0x330723){_0x183c17=_0x183c17-0x0;var _0x3b7e11=_0x91a7[_0x183c17];return _0x3b7e11;};'use strict';var express=require('express');var router=express[_0x791a('0x0')]();var auth=require(_0x791a('0x1'));var controller=require(_0x791a('0x2'));router['post'](_0x791a('0x3'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller['originate']);router['post'](_0x791a('0x5'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x7')]);router['post'](_0x791a('0x8'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x9')]);router[_0x791a('0xa')](_0x791a('0xb'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['hold']);router[_0x791a('0xa')](_0x791a('0xc'),auth['isAuthenticated'](),auth[_0x791a('0x4')](),controller[_0x791a('0xd')]);router[_0x791a('0xa')](_0x791a('0xe'),auth[_0x791a('0x6')](),auth[_0x791a('0x4')](),controller['calls']);router['post'](_0x791a('0xf'),auth[_0x791a('0x6')](),auth['isWebrtcLicence'](),controller[_0x791a('0x10')]);module[_0x791a('0x11')]=router;
\ No newline at end of file
index 6000af9..9d35a38 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9567=['stringify','emit','handleError:','error','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','validate','json','userId','callNumber','callerId','callbackUrl','entityFound:','user:%s','originate\x20executed!','hangup\x20fired:','webbar:hangup','answer','answer\x20fired:','format','webbar:answer','answer\x20executed!','hold','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','client','http','webbarapi','redis','localhost','number','userId\x20is\x20required','callNumber\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info'];(function(_0x4f3fc0,_0x20aee7){var _0x1e7bf8=function(_0x219e30){while(--_0x219e30){_0x4f3fc0['push'](_0x4f3fc0['shift']());}};_0x1e7bf8(++_0x20aee7);}(_0x9567,0xdc));var _0x7956=function(_0x59eb0f,_0x2530ad){_0x59eb0f=_0x59eb0f-0x0;var _0x22b7c8=_0x9567[_0x59eb0f];return _0x22b7c8;};'use strict';var path=require(_0x7956('0x0'));var fs=require('fs');var _=require(_0x7956('0x1'));var db=require(_0x7956('0x2'))['db'];var config=require(_0x7956('0x3'));var util=require(_0x7956('0x4'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var amiClient=jayson[_0x7956('0x5')][_0x7956('0x6')]({'port':0x232a});var logger=require('../../config/logger')(_0x7956('0x7'));var Redis=require('ioredis');config[_0x7956('0x8')]=_['defaults'](config[_0x7956('0x8')],{'host':_0x7956('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x7956('0x8')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x7956('0xa'),'required':[!![],_0x7956('0xb')]},'callNumber':{'type':'string','required':[!![],_0x7956('0xc')]},'callerId':{'type':_0x7956('0xd')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x7956('0xa'),'required':[!![],_0x7956('0xb')]},'sessionId':{'type':_0x7956('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7956('0xb')]},'sessionId':{'type':_0x7956('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x7956('0xa'),'required':[!![],_0x7956('0xb')]},'sessionId':{'type':'string','required':[!![],_0x7956('0xe')]},'transferNumber':{'type':_0x7956('0xd'),'required':[!![],_0x7956('0xf')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x7956('0xb')]},'sessionId':{'type':_0x7956('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x7956('0xa'),'required':[!![],_0x7956('0xb')]},'sessionId':{'type':_0x7956('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x7956('0xa'),'required':[!![],_0x7956('0xb')]}});var conferenceValidation=new Schema({'userId':{'type':_0x7956('0xa'),'required':[!![],_0x7956('0xb')]}});function emit(_0x6a6d78,_0x41d67a,_0x2820cd){logger[_0x7956('0x10')](_0x6a6d78,_0x41d67a,JSON[_0x7956('0x11')](_0x2820cd));io['to'](_0x6a6d78)[_0x7956('0x12')](_0x41d67a,_0x2820cd);}function handleError(_0x4640db){return function(_0x5e6b90){console['log'](_0x7956('0x13'),_0x5e6b90,_0x5e6b90 instanceof RangeError);logger[_0x7956('0x14')](_0x5e6b90['stack']);if(_0x5e6b90 instanceof RangeError){if(_0x5e6b90[_0x7956('0x15')]){delete _0x5e6b90['name'];}_0x4640db[_0x7956('0x16')](0x194)[_0x7956('0x17')](_0x5e6b90);}else{if(_0x5e6b90['name']){delete _0x5e6b90[_0x7956('0x15')];}_0x4640db[_0x7956('0x16')](0x1f4)[_0x7956('0x17')](_0x5e6b90);}};}function checkError(){return function(_0x4adf84){if(!_0x4adf84){throw new RangeError(_0x7956('0x18'));}return _0x4adf84;};}function respondWithRpcPromise(_0x497996,_0x171fc8){return new BPromise(function(_0x5100d8,_0x427500){var _0x8a7165=amiClient;return _0x8a7165[_0x7956('0x19')](_0x497996,_0x171fc8)[_0x7956('0x1a')](function(_0x4d4d95){if(_0x4d4d95[_0x7956('0x14')]){if(_0x4d4d95[_0x7956('0x14')][_0x7956('0x1b')]===0x1f4){return _0x427500(_0x4d4d95['error']['message']);}return _0x5100d8(_0x4d4d95[_0x7956('0x14')][_0x7956('0x1c')]);}else{_0x5100d8(_0x4d4d95[_0x7956('0x1d')]);}})[_0x7956('0x1e')](function(_0x4572b2){_0x427500(_0x4572b2);});});}function getAgent(_0x4e5b2d){return db[_0x7956('0x1f')][_0x7956('0x20')]({'where':{'id':_0x4e5b2d,'role':_0x7956('0x21')}})[_0x7956('0x1a')](checkError());}function getAgentCheckSession(_0x16d978,_0x30392c){return new BPromise(function(_0x4821d7,_0x3c4d5f){var _0x33401e=respondWithRpcPromise(_0x7956('0x22'));var _0x3de345=getAgent(_0x16d978);Promise[_0x7956('0x23')]([_0x33401e,_0x3de345])[_0x7956('0x1a')](function(_0x12cc06){var _0x30a8d1=_0x12cc06[0x0];var _0x2f248d=_0x12cc06[0x1];var _0x401770=_[_0x7956('0x24')](_0x30a8d1[_0x7956('0x25')],function(_0x21fb1b){return _0x21fb1b[_0x7956('0x26')]==_0x2f248d['id']&&_0x21fb1b[_0x7956('0x27')]==_0x30392c;});if(_0x401770[_0x7956('0x28')]==0x1){_0x4821d7(_0x2f248d);}else{_0x3c4d5f(new RangeError(_0x7956('0x29')+_0x30392c+_0x7956('0x2a')));}});});}exports[_0x7956('0x2b')]=function(_0x134d24,_0x5bb0f1){logger[_0x7956('0x10')](_0x7956('0x2c'),_0x134d24[_0x7956('0x2d')]);var _0x3a8d1d=originateValidation[_0x7956('0x2e')](_0x134d24[_0x7956('0x2d')]);if(_0x3a8d1d['length']>0x0){return _0x5bb0f1[_0x7956('0x16')](0x190)[_0x7956('0x2f')](_0x3a8d1d);}var _0x50d8cc=_0x134d24[_0x7956('0x2d')][_0x7956('0x30')];var _0x1c3411=_0x134d24[_0x7956('0x2d')][_0x7956('0x31')];var _0x302d38=_0x134d24[_0x7956('0x2d')][_0x7956('0x32')];var _0x5fb356=_0x134d24[_0x7956('0x2d')][_0x7956('0x33')];return getAgent(_0x50d8cc)[_0x7956('0x1a')](function(_0x1326b5){logger[_0x7956('0x10')](_0x7956('0x34'),_0x1326b5[_0x7956('0x15')]);emit(util['format'](_0x7956('0x35'),_0x1326b5[_0x7956('0x15')]),'webbar:originate',{'callNumber':_0x1c3411,'callerId':_0x302d38,'callbackUrl':_0x5fb356});return _0x5bb0f1[_0x7956('0x16')](0xc8)['json']({'error':![],'message':_0x7956('0x36')});})['catch'](handleError(_0x5bb0f1));};exports['hangup']=function(_0x5003ca,_0x4810ff){logger[_0x7956('0x10')](_0x7956('0x37'),_0x5003ca[_0x7956('0x2d')]);var _0x26f7b5=hangupValidation[_0x7956('0x2e')](_0x5003ca[_0x7956('0x2d')]);if(_0x26f7b5[_0x7956('0x28')]>0x0){return _0x4810ff[_0x7956('0x16')](0x190)[_0x7956('0x2f')](_0x26f7b5);}var _0x55c526=_0x5003ca[_0x7956('0x2d')]['userId'];var _0x1aaee5=_0x5003ca[_0x7956('0x2d')][_0x7956('0x27')];return getAgent(_0x55c526)[_0x7956('0x1a')](function(_0x4fd0fc){logger[_0x7956('0x10')](_0x7956('0x34'),_0x4fd0fc['name']);emit(util['format'](_0x7956('0x35'),_0x4fd0fc['name']),_0x7956('0x38'),{'sessionId':_0x1aaee5});return _0x4810ff[_0x7956('0x16')](0xc8)[_0x7956('0x2f')]({'error':![],'message':'hangup\x20executed!'});})[_0x7956('0x1e')](handleError(_0x4810ff));};exports[_0x7956('0x39')]=function(_0x57865d,_0x2f5d7d){logger['info'](_0x7956('0x3a'),_0x57865d[_0x7956('0x2d')]);var _0x1968ab=answerValidation[_0x7956('0x2e')](_0x57865d[_0x7956('0x2d')]);if(_0x1968ab['length']>0x0){return _0x2f5d7d['status'](0x190)[_0x7956('0x2f')](_0x1968ab);}var _0x475c42=_0x57865d[_0x7956('0x2d')][_0x7956('0x30')];var _0x23472d=_0x57865d[_0x7956('0x2d')]['sessionId'];return getAgent(_0x475c42)[_0x7956('0x1a')](function(_0x17589f){logger[_0x7956('0x10')](_0x7956('0x34'),_0x17589f[_0x7956('0x15')]);emit(util[_0x7956('0x3b')](_0x7956('0x35'),_0x17589f[_0x7956('0x15')]),_0x7956('0x3c'),{'sessionId':_0x23472d});return _0x2f5d7d[_0x7956('0x16')](0xc8)[_0x7956('0x2f')]({'error':![],'message':_0x7956('0x3d')});})[_0x7956('0x1e')](handleError(_0x2f5d7d));};exports[_0x7956('0x3e')]=function(_0x2d2c5e,_0x5c0fce){logger[_0x7956('0x10')]('hold\x20fired:',_0x2d2c5e['body']);var _0x45209c=holdValidation[_0x7956('0x2e')](_0x2d2c5e[_0x7956('0x2d')]);if(_0x45209c[_0x7956('0x28')]>0x0){return _0x5c0fce[_0x7956('0x16')](0x190)[_0x7956('0x2f')](_0x45209c);}var _0x441404=_0x2d2c5e[_0x7956('0x2d')][_0x7956('0x30')];var _0x1c6722=_0x2d2c5e[_0x7956('0x2d')][_0x7956('0x27')];return getAgent(_0x441404)[_0x7956('0x1a')](function(_0x2ba635){logger[_0x7956('0x10')](_0x7956('0x34'),_0x2ba635[_0x7956('0x15')]);emit(util[_0x7956('0x3b')](_0x7956('0x35'),_0x2ba635[_0x7956('0x15')]),_0x7956('0x3f'),{'sessionId':_0x1c6722});return _0x5c0fce[_0x7956('0x16')](0xc8)['json']({'error':![],'message':_0x7956('0x40')});})[_0x7956('0x1e')](handleError(_0x5c0fce));};exports[_0x7956('0x41')]=function(_0x493092,_0x385fb3){logger['info'](_0x7956('0x42'),_0x493092[_0x7956('0x2d')]);var _0x48c757=unholdValidation[_0x7956('0x2e')](_0x493092[_0x7956('0x2d')]);if(_0x48c757['length']>0x0){return _0x385fb3[_0x7956('0x16')](0x190)[_0x7956('0x2f')](_0x48c757);}var _0x52aa90=_0x493092[_0x7956('0x2d')][_0x7956('0x30')];var _0xc070ce=_0x493092[_0x7956('0x2d')][_0x7956('0x27')];return getAgent(_0x52aa90)[_0x7956('0x1a')](function(_0x455d3c){logger['info'](_0x7956('0x34'),_0x455d3c[_0x7956('0x15')]);emit(util[_0x7956('0x3b')](_0x7956('0x35'),_0x455d3c['name']),_0x7956('0x43'),{'sessionId':_0xc070ce});return _0x385fb3[_0x7956('0x16')](0xc8)[_0x7956('0x2f')]({'error':![],'message':_0x7956('0x44')});})[_0x7956('0x1e')](handleError(_0x385fb3));};exports[_0x7956('0x45')]=function(_0x23e7ee,_0x277d78){logger[_0x7956('0x10')](_0x7956('0x46'),_0x277d78[_0x7956('0x2d')]);var _0x1d2af8=callsValidation[_0x7956('0x2e')](_0x23e7ee[_0x7956('0x2d')]);if(_0x1d2af8['length']>0x0){return _0x277d78[_0x7956('0x16')](0x190)[_0x7956('0x2f')](_0x1d2af8);}var _0x40661a=_0x23e7ee[_0x7956('0x2d')]['userId'];var _0x196013=respondWithRpcPromise(_0x7956('0x22'));var _0x2122d3=getAgent(_0x40661a);return Promise[_0x7956('0x23')]([_0x196013,_0x2122d3])[_0x7956('0x1a')](function(_0x373dfa){var _0x3b8f7f=_0x373dfa[0x0];var _0x578a12=_0x373dfa[0x1];var _0x551501=_[_0x7956('0x24')](_0x3b8f7f['rows'],function(_0x1ca924){return _0x1ca924[_0x7956('0x26')]==_0x578a12['id'];});return _0x277d78[_0x7956('0x16')](0xc8)[_0x7956('0x2f')]({'count':_0x551501[_0x7956('0x28')],'rows':_0x551501});})[_0x7956('0x1e')](handleError(_0x277d78));};exports[_0x7956('0x47')]=function(_0x32e7b0,_0xaeda0b){logger['info'](_0x7956('0x48'),_0x32e7b0[_0x7956('0x2d')]);var _0x45cc68=conferenceValidation['validate'](_0x32e7b0[_0x7956('0x2d')]);if(_0x45cc68[_0x7956('0x28')]>0x0){return _0xaeda0b['status'](0x190)[_0x7956('0x2f')](_0x45cc68);}var _0x512088=_0x32e7b0[_0x7956('0x2d')][_0x7956('0x30')];return getAgent(_0x512088)[_0x7956('0x1a')](function(_0x1c440d){logger['info'](_0x7956('0x34'),_0x1c440d[_0x7956('0x15')]);emit(util[_0x7956('0x3b')]('user:%s',_0x1c440d[_0x7956('0x15')]),_0x7956('0x49'));return _0xaeda0b[_0x7956('0x16')](0xc8)[_0x7956('0x2f')]({'error':![],'message':_0x7956('0x4a')});})[_0x7956('0x1e')](handleError(_0xaeda0b));};exports['transfer']=function(_0x4fa4dd,_0x1c67dc){logger['info'](_0x7956('0x4b'),_0x4fa4dd['body']);var _0x28a06a=transferValidation[_0x7956('0x2e')](_0x4fa4dd[_0x7956('0x2d')]);if(_0x28a06a['length']>0x0){return _0x1c67dc['status'](0x190)[_0x7956('0x2f')](_0x28a06a);}var _0x40cbad=_0x4fa4dd[_0x7956('0x2d')][_0x7956('0x30')];var _0x5b0225=_0x4fa4dd[_0x7956('0x2d')][_0x7956('0x27')];var _0x16beac=_0x4fa4dd[_0x7956('0x2d')][_0x7956('0x4c')];return getAgent(_0x40cbad)[_0x7956('0x1a')](function(_0xf35ffd){logger['info'](_0x7956('0x34'),_0xf35ffd[_0x7956('0x15')]);emit(util[_0x7956('0x3b')](_0x7956('0x35'),_0xf35ffd[_0x7956('0x15')]),_0x7956('0x4d'),{'sessionId':_0x5b0225,'transferNumber':_0x16beac});return _0x1c67dc['status'](0xc8)[_0x7956('0x2f')]({'error':![],'message':_0x7956('0x4e')});})[_0x7956('0x1e')](handleError(_0x1c67dc));};
\ No newline at end of file
+var _0x00b3=['webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','util','jayson/promise','http','webbarapi','ioredis','redis','defaults','socket.io-emitter','number','userId\x20is\x20required','string','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','handleError:','error','name','status','send','NotFound','then','code','message','catch','User','VoiceChannels','all','rows','UserId','sessionId','sessionId\x20','body','json','userId','callerId','callbackUrl','entityFound:','user:%s','webbar:originate','originate\x20executed!','hangup\x20fired:','validate','length','format','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:'];(function(_0x4214da,_0x586705){var _0x64da0=function(_0x273e00){while(--_0x273e00){_0x4214da['push'](_0x4214da['shift']());}};_0x64da0(++_0x586705);}(_0x00b3,0x17a));var _0x300b=function(_0x8997b8,_0x28a408){_0x8997b8=_0x8997b8-0x0;var _0x421870=_0x00b3[_0x8997b8];return _0x421870;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x300b('0x0'));var db=require(_0x300b('0x1'))['db'];var config=require(_0x300b('0x2'));var util=require(_0x300b('0x3'));var BPromise=require('bluebird');var jayson=require(_0x300b('0x4'));var amiClient=jayson['client'][_0x300b('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x300b('0x6'));var Redis=require(_0x300b('0x7'));config[_0x300b('0x8')]=_[_0x300b('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x300b('0xa'))(new Redis(config['redis']));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'callNumber':{'type':_0x300b('0xd'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':_0x300b('0xd')},'callbackUrl':{'type':_0x300b('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':[!![],_0x300b('0xe')]},'transferNumber':{'type':_0x300b('0xd'),'required':[!![],_0x300b('0xf')]}});var holdValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]},'sessionId':{'type':_0x300b('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0x300b('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x300b('0xb'),'required':[!![],_0x300b('0xc')]}});function emit(_0xd252fa,_0x51186d,_0x509089){logger[_0x300b('0x10')](_0xd252fa,_0x51186d,JSON[_0x300b('0x11')](_0x509089));io['to'](_0xd252fa)[_0x300b('0x12')](_0x51186d,_0x509089);}function handleError(_0xae48d2){return function(_0x4d2024){console[_0x300b('0x13')](_0x300b('0x14'),_0x4d2024,_0x4d2024 instanceof RangeError);logger[_0x300b('0x15')](_0x4d2024['stack']);if(_0x4d2024 instanceof RangeError){if(_0x4d2024[_0x300b('0x16')]){delete _0x4d2024[_0x300b('0x16')];}_0xae48d2[_0x300b('0x17')](0x194)[_0x300b('0x18')](_0x4d2024);}else{if(_0x4d2024['name']){delete _0x4d2024[_0x300b('0x16')];}_0xae48d2[_0x300b('0x17')](0x1f4)[_0x300b('0x18')](_0x4d2024);}};}function checkError(){return function(_0x4a5f75){if(!_0x4a5f75){throw new RangeError(_0x300b('0x19'));}return _0x4a5f75;};}function respondWithRpcPromise(_0x38dedb,_0x30a057){return new BPromise(function(_0x502c5f,_0x26913f){var _0x5b14ed=amiClient;return _0x5b14ed['request'](_0x38dedb,_0x30a057)[_0x300b('0x1a')](function(_0xad0fb){if(_0xad0fb[_0x300b('0x15')]){if(_0xad0fb[_0x300b('0x15')][_0x300b('0x1b')]===0x1f4){return _0x26913f(_0xad0fb[_0x300b('0x15')][_0x300b('0x1c')]);}return _0x502c5f(_0xad0fb[_0x300b('0x15')][_0x300b('0x1c')]);}else{_0x502c5f(_0xad0fb['result']);}})[_0x300b('0x1d')](function(_0x152048){_0x26913f(_0x152048);});});}function getAgent(_0x260bdc){return db[_0x300b('0x1e')]['findOne']({'where':{'id':_0x260bdc,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x39794a,_0x4a1300){return new BPromise(function(_0x1241c7,_0x2496e0){var _0x60bb0c=respondWithRpcPromise(_0x300b('0x1f'));var _0x2d2ea7=getAgent(_0x39794a);Promise[_0x300b('0x20')]([_0x60bb0c,_0x2d2ea7])[_0x300b('0x1a')](function(_0x159b63){var _0x1cdc8b=_0x159b63[0x0];var _0x3210cd=_0x159b63[0x1];var _0x485952=_['filter'](_0x1cdc8b[_0x300b('0x21')],function(_0x2a7604){return _0x2a7604[_0x300b('0x22')]==_0x3210cd['id']&&_0x2a7604[_0x300b('0x23')]==_0x4a1300;});if(_0x485952['length']==0x1){_0x1241c7(_0x3210cd);}else{_0x2496e0(new RangeError(_0x300b('0x24')+_0x4a1300+'\x20not\x20found!'));}});});}exports['originate']=function(_0x53ed0c,_0x27d2de){logger[_0x300b('0x10')]('originate\x20fired:',_0x53ed0c[_0x300b('0x25')]);var _0x39007c=originateValidation['validate'](_0x53ed0c[_0x300b('0x25')]);if(_0x39007c['length']>0x0){return _0x27d2de[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x39007c);}var _0xdad35f=_0x53ed0c[_0x300b('0x25')][_0x300b('0x27')];var _0x46a0e3=_0x53ed0c[_0x300b('0x25')]['callNumber'];var _0x4b00e6=_0x53ed0c['body'][_0x300b('0x28')];var _0x32e326=_0x53ed0c['body'][_0x300b('0x29')];return getAgent(_0xdad35f)[_0x300b('0x1a')](function(_0x5a5aba){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x5a5aba[_0x300b('0x16')]);emit(util['format'](_0x300b('0x2b'),_0x5a5aba[_0x300b('0x16')]),_0x300b('0x2c'),{'callNumber':_0x46a0e3,'callerId':_0x4b00e6,'callbackUrl':_0x32e326});return _0x27d2de[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x2d')});})[_0x300b('0x1d')](handleError(_0x27d2de));};exports['hangup']=function(_0x2da2e3,_0x30b72){logger['info'](_0x300b('0x2e'),_0x2da2e3['body']);var _0x5987da=hangupValidation[_0x300b('0x2f')](_0x2da2e3[_0x300b('0x25')]);if(_0x5987da[_0x300b('0x30')]>0x0){return _0x30b72[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x5987da);}var _0x510ad8=_0x2da2e3[_0x300b('0x25')][_0x300b('0x27')];var _0x55b4da=_0x2da2e3[_0x300b('0x25')]['sessionId'];return getAgent(_0x510ad8)[_0x300b('0x1a')](function(_0x262ddb){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x262ddb[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x262ddb[_0x300b('0x16')]),_0x300b('0x32'),{'sessionId':_0x55b4da});return _0x30b72[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':'hangup\x20executed!'});})['catch'](handleError(_0x30b72));};exports[_0x300b('0x33')]=function(_0x566af2,_0x5a08f7){logger[_0x300b('0x10')](_0x300b('0x34'),_0x566af2[_0x300b('0x25')]);var _0x5ef864=answerValidation[_0x300b('0x2f')](_0x566af2['body']);if(_0x5ef864['length']>0x0){return _0x5a08f7[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x5ef864);}var _0x5f0fd1=_0x566af2[_0x300b('0x25')][_0x300b('0x27')];var _0x54bdc9=_0x566af2[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x5f0fd1)['then'](function(_0x3b1432){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x3b1432[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x3b1432[_0x300b('0x16')]),_0x300b('0x35'),{'sessionId':_0x54bdc9});return _0x5a08f7['status'](0xc8)['json']({'error':![],'message':_0x300b('0x36')});})['catch'](handleError(_0x5a08f7));};exports['hold']=function(_0x3379cb,_0x3028c0){logger[_0x300b('0x10')](_0x300b('0x37'),_0x3379cb[_0x300b('0x25')]);var _0x33f978=holdValidation['validate'](_0x3379cb[_0x300b('0x25')]);if(_0x33f978['length']>0x0){return _0x3028c0['status'](0x190)[_0x300b('0x26')](_0x33f978);}var _0x44d1b4=_0x3379cb['body'][_0x300b('0x27')];var _0x290942=_0x3379cb[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x44d1b4)['then'](function(_0x389256){logger[_0x300b('0x10')]('entityFound:',_0x389256[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x389256['name']),_0x300b('0x38'),{'sessionId':_0x290942});return _0x3028c0[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x39')});})[_0x300b('0x1d')](handleError(_0x3028c0));};exports[_0x300b('0x3a')]=function(_0x418ac3,_0x3dd25c){logger[_0x300b('0x10')](_0x300b('0x3b'),_0x418ac3[_0x300b('0x25')]);var _0x377ca8=unholdValidation[_0x300b('0x2f')](_0x418ac3['body']);if(_0x377ca8['length']>0x0){return _0x3dd25c[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x377ca8);}var _0x124229=_0x418ac3['body'][_0x300b('0x27')];var _0x543035=_0x418ac3[_0x300b('0x25')][_0x300b('0x23')];return getAgent(_0x124229)['then'](function(_0x31aba8){logger[_0x300b('0x10')](_0x300b('0x2a'),_0x31aba8[_0x300b('0x16')]);emit(util['format'](_0x300b('0x2b'),_0x31aba8['name']),_0x300b('0x3c'),{'sessionId':_0x543035});return _0x3dd25c[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x3d')});})[_0x300b('0x1d')](handleError(_0x3dd25c));};exports[_0x300b('0x3e')]=function(_0x69d6dd,_0x178f82){logger[_0x300b('0x10')](_0x300b('0x3f'),_0x178f82[_0x300b('0x25')]);var _0x1d6672=callsValidation[_0x300b('0x2f')](_0x69d6dd[_0x300b('0x25')]);if(_0x1d6672['length']>0x0){return _0x178f82[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x1d6672);}var _0x488715=_0x69d6dd['body'][_0x300b('0x27')];var _0x23e11e=respondWithRpcPromise(_0x300b('0x1f'));var _0xb9eb0a=getAgent(_0x488715);return Promise[_0x300b('0x20')]([_0x23e11e,_0xb9eb0a])[_0x300b('0x1a')](function(_0x18d5d2){var _0x487c2e=_0x18d5d2[0x0];var _0xff003a=_0x18d5d2[0x1];var _0x37ed9f=_['filter'](_0x487c2e[_0x300b('0x21')],function(_0x555f86){return _0x555f86[_0x300b('0x22')]==_0xff003a['id'];});return _0x178f82[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'count':_0x37ed9f['length'],'rows':_0x37ed9f});})[_0x300b('0x1d')](handleError(_0x178f82));};exports[_0x300b('0x40')]=function(_0x371396,_0x34c962){logger['info'](_0x300b('0x41'),_0x371396['body']);var _0x18b763=conferenceValidation[_0x300b('0x2f')](_0x371396['body']);if(_0x18b763[_0x300b('0x30')]>0x0){return _0x34c962[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x18b763);}var _0x4f8881=_0x371396[_0x300b('0x25')][_0x300b('0x27')];return getAgent(_0x4f8881)['then'](function(_0x158b08){logger['info'](_0x300b('0x2a'),_0x158b08[_0x300b('0x16')]);emit(util[_0x300b('0x31')](_0x300b('0x2b'),_0x158b08[_0x300b('0x16')]),_0x300b('0x42'));return _0x34c962[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x43')});})[_0x300b('0x1d')](handleError(_0x34c962));};exports[_0x300b('0x44')]=function(_0x3768f6,_0x464aa6){logger[_0x300b('0x10')](_0x300b('0x45'),_0x3768f6[_0x300b('0x25')]);var _0x3069c0=transferValidation[_0x300b('0x2f')](_0x3768f6[_0x300b('0x25')]);if(_0x3069c0[_0x300b('0x30')]>0x0){return _0x464aa6[_0x300b('0x17')](0x190)[_0x300b('0x26')](_0x3069c0);}var _0x3a7470=_0x3768f6['body'][_0x300b('0x27')];var _0x5022d5=_0x3768f6[_0x300b('0x25')][_0x300b('0x23')];var _0x2680e0=_0x3768f6[_0x300b('0x25')][_0x300b('0x46')];return getAgent(_0x3a7470)[_0x300b('0x1a')](function(_0x2f0113){logger[_0x300b('0x10')]('entityFound:',_0x2f0113[_0x300b('0x16')]);emit(util['format']('user:%s',_0x2f0113[_0x300b('0x16')]),_0x300b('0x47'),{'sessionId':_0x5022d5,'transferNumber':_0x2680e0});return _0x464aa6[_0x300b('0x17')](0xc8)[_0x300b('0x26')]({'error':![],'message':_0x300b('0x48')});})['catch'](handleError(_0x464aa6));};
\ No newline at end of file
index 5e144fa..a2dd428 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2913=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','addAgents','addApplications','/:id/notify','/:id/send','send','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','get','describe','/:id','show'];(function(_0xa0a4dd,_0x1b989a){var _0x6cb69b=function(_0x1c587b){while(--_0x1c587b){_0xa0a4dd['push'](_0xa0a4dd['shift']());}};_0x6cb69b(++_0x1b989a);}(_0x2913,0x189));var _0x3291=function(_0x46da8c,_0x41e0d9){_0x46da8c=_0x46da8c-0x0;var _0xacda43=_0x2913[_0x46da8c];return _0xacda43;};'use strict';var multer=require(_0x3291('0x0'));var util=require(_0x3291('0x1'));var path=require(_0x3291('0x2'));var timeout=require('connect-timeout');var express=require(_0x3291('0x3'));var router=express[_0x3291('0x4')]();var fs_extra=require(_0x3291('0x5'));var auth=require(_0x3291('0x6'));var interaction=require(_0x3291('0x7'));var config=require(_0x3291('0x8'));var controller=require(_0x3291('0x9'));router['get']('/',auth[_0x3291('0xa')](),controller['index']);router[_0x3291('0xb')]('/describe',auth[_0x3291('0xa')](),controller[_0x3291('0xc')]);router[_0x3291('0xb')](_0x3291('0xd'),auth[_0x3291('0xa')](),controller[_0x3291('0xe')]);router[_0x3291('0xb')](_0x3291('0xf'),auth['isAuthenticated'](),controller[_0x3291('0x10')]);router['get'](_0x3291('0x11'),auth['isAuthenticated'](),controller[_0x3291('0x12')]);router[_0x3291('0xb')](_0x3291('0x13'),auth[_0x3291('0xa')](),controller[_0x3291('0x14')]);router[_0x3291('0xb')](_0x3291('0x15'),auth[_0x3291('0xa')](),controller[_0x3291('0x16')]);router[_0x3291('0x17')]('/',auth[_0x3291('0xa')](),controller[_0x3291('0x18')]);router['post'](_0x3291('0xf'),auth[_0x3291('0xa')](),controller['addDisposition']);router[_0x3291('0x17')](_0x3291('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x3291('0x17')]('/:id/users',auth[_0x3291('0xa')](),controller[_0x3291('0x19')]);router[_0x3291('0x17')](_0x3291('0x15'),auth[_0x3291('0xa')](),controller[_0x3291('0x1a')]);router[_0x3291('0x17')](_0x3291('0x1b'),controller['notify']);router[_0x3291('0x17')](_0x3291('0x1c'),auth[_0x3291('0xa')](),controller[_0x3291('0x1d')]);router[_0x3291('0x1e')](_0x3291('0xd'),auth[_0x3291('0xa')](),controller[_0x3291('0x1f')]);router[_0x3291('0x20')](_0x3291('0xd'),auth[_0x3291('0xa')](),controller[_0x3291('0x21')]);router[_0x3291('0x20')](_0x3291('0xf'),auth[_0x3291('0xa')](),controller['removeDispositions']);router[_0x3291('0x20')]('/:id/canned_answers',auth[_0x3291('0xa')](),controller['removeAnswers']);router['delete'](_0x3291('0x13'),auth[_0x3291('0xa')](),controller['removeAgents']);module['exports']=router;
\ No newline at end of file
+var _0x6268=['removeAgents','exports','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/users','getAgents','/:id/applications','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/send','put','update','delete','destroy','removeDispositions'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x6268,0xbc));var _0x8626=function(_0x62e12d,_0x10a0c7){_0x62e12d=_0x62e12d-0x0;var _0x121c4b=_0x6268[_0x62e12d];return _0x121c4b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8626('0x0')]();var fs_extra=require(_0x8626('0x1'));var auth=require(_0x8626('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x8626('0x3'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x8626('0x4')](),controller[_0x8626('0x5')]);router[_0x8626('0x6')](_0x8626('0x7'),auth['isAuthenticated'](),controller[_0x8626('0x8')]);router[_0x8626('0x6')](_0x8626('0x9'),auth[_0x8626('0x4')](),controller[_0x8626('0xa')]);router['get'](_0x8626('0xb'),auth[_0x8626('0x4')](),controller[_0x8626('0xc')]);router[_0x8626('0x6')]('/:id/canned_answers',auth[_0x8626('0x4')](),controller[_0x8626('0xd')]);router[_0x8626('0x6')](_0x8626('0xe'),auth[_0x8626('0x4')](),controller[_0x8626('0xf')]);router[_0x8626('0x6')](_0x8626('0x10'),auth[_0x8626('0x4')](),controller['getApplications']);router[_0x8626('0x11')]('/',auth[_0x8626('0x4')](),controller[_0x8626('0x12')]);router[_0x8626('0x11')]('/:id/dispositions',auth[_0x8626('0x4')](),controller[_0x8626('0x13')]);router[_0x8626('0x11')](_0x8626('0x14'),auth[_0x8626('0x4')](),controller[_0x8626('0x15')]);router[_0x8626('0x11')](_0x8626('0xe'),auth[_0x8626('0x4')](),controller['addAgents']);router[_0x8626('0x11')](_0x8626('0x10'),auth[_0x8626('0x4')](),controller[_0x8626('0x16')]);router['post']('/:id/notify',controller['notify']);router[_0x8626('0x11')](_0x8626('0x17'),auth[_0x8626('0x4')](),controller['send']);router[_0x8626('0x18')]('/:id',auth[_0x8626('0x4')](),controller[_0x8626('0x19')]);router[_0x8626('0x1a')](_0x8626('0x9'),auth['isAuthenticated'](),controller[_0x8626('0x1b')]);router[_0x8626('0x1a')](_0x8626('0xb'),auth[_0x8626('0x4')](),controller[_0x8626('0x1c')]);router[_0x8626('0x1a')](_0x8626('0x14'),auth[_0x8626('0x4')](),controller['removeAnswers']);router['delete'](_0x8626('0xe'),auth['isAuthenticated'](),controller[_0x8626('0x1d')]);module[_0x8626('0x1e')]=router;
\ No newline at end of file
index 23366d5..775f95b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x043a=['Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x043a,0x1e4));var _0xa043=function(_0x97d4b6,_0x1b8eab){_0x97d4b6=_0x97d4b6-0x0;var _0x364238=_0x043a[_0x97d4b6];return _0x364238;};'use strict';var Sequelize=require(_0xa043('0x0'));var rs=require(_0xa043('0x1'));module[_0xa043('0x2')]={'name':{'type':Sequelize[_0xa043('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0xa043('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa043('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xa043('0x3')],'defaultValue':function(){return rs[_0xa043('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa043('0x5')]('twilio',_0xa043('0x6'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize[_0xa043('0x3')]},'authToken':{'type':Sequelize[_0xa043('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa043('0x7')],'defaultValue':function(){return _0xa043('0x8');}},'notificationSound':{'type':Sequelize[_0xa043('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa043('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa043('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa043('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa043('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa043('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa043('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa043('0xa')],'comment':_0xa043('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xa043('0x9')],'defaultValue':![],'comment':_0xa043('0xc'),'set':function(_0x18bc00){if(!_0x18bc00){this[_0xa043('0xd')](_0xa043('0xe'),null);}this['setDataValue']('mandatoryDisposition',_0x18bc00);}},'description':{'type':Sequelize[_0xa043('0x3')]}};
\ No newline at end of file
+var _0x30a9=['TEXT','Account:\x20{{account.name}}<br/>{{#queue}}Queue:\x20{{queue.name}}<br/>{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','sinch'];(function(_0x1f0fc7,_0x452257){var _0x47592f=function(_0x5c26e5){while(--_0x5c26e5){_0x1f0fc7['push'](_0x1f0fc7['shift']());}};_0x47592f(++_0x452257);}(_0x30a9,0x169));var _0x930a=function(_0x250af7,_0x388398){_0x250af7=_0x250af7-0x0;var _0x5e217f=_0x30a9[_0x250af7];return _0x5e217f;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x930a('0x0'));module[_0x930a('0x1')]={'name':{'type':Sequelize[_0x930a('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x930a('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x930a('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x930a('0x2')],'defaultValue':function(){return rs[_0x930a('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x930a('0x4')](_0x930a('0x5'),_0x930a('0x6'))},'accountSid':{'type':Sequelize[_0x930a('0x2')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x930a('0x2')]},'notificationTemplate':{'type':Sequelize[_0x930a('0x7')],'defaultValue':function(){return _0x930a('0x8');}},'notificationSound':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x930a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x930a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x930a('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x930a('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x930a('0x9')],'defaultValue':![],'comment':_0x930a('0xc'),'set':function(_0xc36bd){if(!_0xc36bd){this[_0x930a('0xd')](_0x930a('0xe'),null);}this[_0x930a('0xd')](_0x930a('0xf'),_0xc36bd);}},'description':{'type':Sequelize['STRING']}};
\ No newline at end of file
index 880bff0..8048560 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x261c=['from','From','whatsapp:','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','push','close','unmanaged','*,*,*,*','created','WhatsappMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>','List','out','Messages','spread','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./whatsappAccount.socket','client','http','request','then','request\x20sent','debug','stringify','error','code','message','WhatsappAccount,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','WhatsappAccounts','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','includeAll','removeDispositions','addAnswer','CannedAnswer','removeAnswers','ids','addAgents','omit','emit','removeAgents','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','whatsapp','account','sinch','statuses','state','read','update','message_id','applications','orderBy','Applications','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio'];(function(_0x179e11,_0xf65436){var _0x549f04=function(_0x610545){while(--_0x610545){_0x179e11['push'](_0x179e11['shift']());}};_0x549f04(++_0xf65436);}(_0x261c,0x1b8));var _0xc261=function(_0x7d261d,_0x4e1d2f){_0x7d261d=_0x7d261d-0x0;var _0x1a992a=_0x261c[_0x7d261d];return _0x1a992a;};'use strict';var emlformat=require(_0xc261('0x0'));var rimraf=require(_0xc261('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc261('0x2'));var rp=require(_0xc261('0x3'));var moment=require(_0xc261('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc261('0x5'));var util=require('util');var path=require(_0xc261('0x6'));var sox=require('sox');var csv=require(_0xc261('0x7'));var ejs=require(_0xc261('0x8'));var fs=require('fs');var fs_extra=require(_0xc261('0x9'));var _=require(_0xc261('0xa'));var squel=require(_0xc261('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc261('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc261('0xd'));var Redis=require(_0xc261('0xe'));var authService=require(_0xc261('0xf'));var qs=require(_0xc261('0x10'));var as=require(_0xc261('0x11'));var hardwareService=require(_0xc261('0x12'));var logger=require(_0xc261('0x13'))(_0xc261('0x14'));var utils=require('../../config/utils');var config=require(_0xc261('0x15'));var licenseUtil=require(_0xc261('0x16'));var db=require('../../mysqldb')['db'];config[_0xc261('0x17')]=_['defaults'](config[_0xc261('0x17')],{'host':_0xc261('0x18'),'port':0x18eb});var socket=require(_0xc261('0x19'))(new Redis(config[_0xc261('0x17')]));require(_0xc261('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xc261('0x1b')][_0xc261('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x113042,_0x4a39b0,_0x158a5a,_0x26e1e4){return new BPromise(function(_0x1de34f,_0x443407){var _0x593a4b=_0x26e1e4||client;return _0x593a4b[_0xc261('0x1d')](_0x113042,_0x158a5a)[_0xc261('0x1e')](function(_0x170994){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x4a39b0,_0xc261('0x1f'));logger[_0xc261('0x20')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x4a39b0,_0xc261('0x1f'),JSON[_0xc261('0x21')](_0x170994));if(_0x170994[_0xc261('0x22')]){if(_0x170994[_0xc261('0x22')][_0xc261('0x23')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x4a39b0,_0x170994['error'][_0xc261('0x24')]);return _0x443407(_0x170994['error'][_0xc261('0x24')]);}logger[_0xc261('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x4a39b0,_0x170994['error'][_0xc261('0x24')]);return _0x1de34f(_0x170994[_0xc261('0x22')][_0xc261('0x24')]);}else{logger['info'](_0xc261('0x25'),_0x4a39b0,_0xc261('0x1f'));_0x1de34f(_0x170994[_0xc261('0x26')][_0xc261('0x24')]);}})[_0xc261('0x27')](function(_0x90afe2){logger[_0xc261('0x22')]('WhatsappAccount,\x20%s,\x20%s',_0x4a39b0,_0x90afe2);_0x443407(_0x90afe2);});});}function respondWithStatusCode(_0x38f187,_0x3c490e){_0x3c490e=_0x3c490e||0xcc;return function(_0x1fbb08){if(_0x1fbb08){return _0x38f187[_0xc261('0x28')](_0x3c490e);}return _0x38f187[_0xc261('0x29')](_0x3c490e)[_0xc261('0x2a')]();};}function respondWithResult(_0x4dba62,_0x3fd1df){_0x3fd1df=_0x3fd1df||0xc8;return function(_0x9b92fa){if(_0x9b92fa){return _0x4dba62[_0xc261('0x29')](_0x3fd1df)[_0xc261('0x2b')](_0x9b92fa);}};}function respondWithFilteredResult(_0x455559,_0x1a80cd){return function(_0x3e3ed5){if(_0x3e3ed5){var _0x4acebb=typeof _0x1a80cd[_0xc261('0x2c')]===_0xc261('0x2d')&&typeof _0x1a80cd['limit']===_0xc261('0x2d');var _0x5578e9=_0x3e3ed5[_0xc261('0x2e')];var _0x390498=_0x4acebb?0x0:_0x1a80cd[_0xc261('0x2c')];var _0x2c1d86=_0x4acebb?_0x3e3ed5[_0xc261('0x2e')]:_0x1a80cd['offset']+_0x1a80cd[_0xc261('0x2f')];var _0x934c8e;if(_0x2c1d86>=_0x5578e9){_0x2c1d86=_0x5578e9;_0x934c8e=0xc8;}else{_0x934c8e=0xce;}_0x455559['status'](_0x934c8e);return _0x455559['set'](_0xc261('0x30'),_0x390498+'-'+_0x2c1d86+'/'+_0x5578e9)[_0xc261('0x2b')](_0x3e3ed5);}return null;};}function patchUpdates(_0x3392bc){return function(_0x537515){try{jsonpatch[_0xc261('0x31')](_0x537515,_0x3392bc,!![]);}catch(_0xc96e8f){return BPromise[_0xc261('0x32')](_0xc96e8f);}return _0x537515[_0xc261('0x33')]();};}function saveUpdates(_0x102a28,_0xc40816){return function(_0x3402a2){if(_0x3402a2){return _0x3402a2['update'](_0x102a28)[_0xc261('0x1e')](function(_0x4faa97){return _0x4faa97;});}return null;};}function removeEntity(_0x4fbdf4,_0x451125){return function(_0x172583){if(_0x172583){return _0x172583[_0xc261('0x34')]()['then'](function(){var _0x37a163=_0x172583['get']({'plain':!![]});var _0x3c63bd=_0xc261('0x35');return db[_0xc261('0x36')][_0xc261('0x34')]({'where':{'type':_0x3c63bd,'resourceId':_0x37a163['id']}})[_0xc261('0x1e')](function(){return _0x172583;});})[_0xc261('0x1e')](function(){_0x4fbdf4[_0xc261('0x29')](0xcc)[_0xc261('0x2a')]();});}};}function handleEntityNotFound(_0x3dfcad,_0x4426c1){return function(_0x422c67){if(!_0x422c67){_0x3dfcad[_0xc261('0x28')](0x194);}return _0x422c67;};}function handleError(_0x1c5dbe,_0x39ef12){_0x39ef12=_0x39ef12||0x1f4;return function(_0x2e3885){logger[_0xc261('0x22')](_0x2e3885[_0xc261('0x37')]);if(_0x2e3885['name']){delete _0x2e3885['name'];}_0x1c5dbe[_0xc261('0x29')](_0x39ef12)[_0xc261('0x38')](_0x2e3885);};}exports[_0xc261('0x39')]=function(_0x1743ee,_0x49c390){var _0x488f10={'include':[{'model':db[_0xc261('0x3a')],'as':_0xc261('0x3b')}]},_0x504890={},_0x4acc75={'count':0x0,'rows':[]};var _0x42a9a0=_[_0xc261('0x3c')](db[_0xc261('0x3d')][_0xc261('0x3e')],function(_0x678031){return{'name':_0x678031[_0xc261('0x3f')],'type':_0x678031[_0xc261('0x40')]['key']};});_0x504890[_0xc261('0x41')]=_[_0xc261('0x3c')](_0x42a9a0,_0xc261('0x42'));_0x504890['query']=_[_0xc261('0x43')](_0x1743ee[_0xc261('0x44')]);_0x504890['filters']=_[_0xc261('0x45')](_0x504890[_0xc261('0x41')],_0x504890[_0xc261('0x44')]);_0x488f10[_0xc261('0x46')]=_['intersection'](_0x504890['model'],qs[_0xc261('0x47')](_0x1743ee[_0xc261('0x44')]['fields']));_0x488f10[_0xc261('0x46')]=_0x488f10['attributes'][_0xc261('0x48')]?_0x488f10[_0xc261('0x46')]:_0x504890[_0xc261('0x41')];if(!_0x1743ee[_0xc261('0x44')][_0xc261('0x49')]('nolimit')){_0x488f10[_0xc261('0x2f')]=qs[_0xc261('0x2f')](_0x1743ee[_0xc261('0x44')][_0xc261('0x2f')]);_0x488f10['offset']=qs[_0xc261('0x2c')](_0x1743ee['query'][_0xc261('0x2c')]);}_0x488f10[_0xc261('0x4a')]=qs[_0xc261('0x4b')](_0x1743ee[_0xc261('0x44')]['sort']);_0x488f10['where']=qs[_0xc261('0x4c')](_[_0xc261('0x4d')](_0x1743ee['query'],_0x504890[_0xc261('0x4c')]),_0x42a9a0);if(_0x1743ee[_0xc261('0x44')][_0xc261('0x4e')]){_0x488f10['where']=_[_0xc261('0x4f')](_0x488f10[_0xc261('0x50')],{'$or':_[_0xc261('0x3c')](_0x42a9a0,function(_0xbfa746){if(_0xbfa746[_0xc261('0x40')]!==_0xc261('0x51')){var _0x27c6e9={};_0x27c6e9[_0xbfa746[_0xc261('0x42')]]={'$like':'%'+_0x1743ee[_0xc261('0x44')][_0xc261('0x4e')]+'%'};return _0x27c6e9;}})});}_0x488f10=_[_0xc261('0x4f')]({},_0x488f10,_0x1743ee[_0xc261('0x52')]);var _0x31a3eb={'where':_0x488f10[_0xc261('0x50')]};return db[_0xc261('0x3d')][_0xc261('0x2e')](_0x31a3eb)[_0xc261('0x1e')](function(_0x4fa84d){_0x4acc75[_0xc261('0x2e')]=_0x4fa84d;if(_0x1743ee[_0xc261('0x44')]['includeAll']){_0x488f10[_0xc261('0x53')]=[{'all':!![]}];}return db[_0xc261('0x3d')][_0xc261('0x54')](_0x488f10);})['then'](function(_0x4b65c6){_0x4acc75[_0xc261('0x55')]=_0x4b65c6;return _0x4acc75;})[_0xc261('0x1e')](respondWithFilteredResult(_0x49c390,_0x488f10))[_0xc261('0x27')](handleError(_0x49c390,null));};exports[_0xc261('0x56')]=function(_0x4da69e,_0x3ba822){var _0x5268e4={'raw':![],'where':{'id':_0x4da69e[_0xc261('0x57')]['id']},'include':[{'model':db[_0xc261('0x3a')],'as':_0xc261('0x3b')}]},_0x503581={};_0x503581[_0xc261('0x41')]=_[_0xc261('0x43')](db[_0xc261('0x3d')][_0xc261('0x3e')]);_0x503581[_0xc261('0x44')]=_[_0xc261('0x43')](_0x4da69e['query']);_0x503581[_0xc261('0x4c')]=_[_0xc261('0x45')](_0x503581['model'],_0x503581[_0xc261('0x44')]);_0x5268e4['attributes']=_[_0xc261('0x45')](_0x503581[_0xc261('0x41')],qs[_0xc261('0x47')](_0x4da69e['query']['fields']));_0x5268e4[_0xc261('0x46')]=_0x5268e4[_0xc261('0x46')][_0xc261('0x48')]?_0x5268e4[_0xc261('0x46')]:_0x503581[_0xc261('0x41')];if(_0x4da69e[_0xc261('0x44')]['includeAll']){_0x5268e4[_0xc261('0x53')]=[{'all':!![]}];}_0x5268e4=_[_0xc261('0x4f')]({},_0x5268e4,_0x4da69e[_0xc261('0x52')]);return db[_0xc261('0x3d')]['find'](_0x5268e4)[_0xc261('0x1e')](handleEntityNotFound(_0x3ba822,null))[_0xc261('0x1e')](respondWithResult(_0x3ba822,null))[_0xc261('0x27')](handleError(_0x3ba822,null));};exports['create']=function(_0x39b6f5,_0x10bd1e){return db[_0xc261('0x3d')][_0xc261('0x58')](_0x39b6f5[_0xc261('0x59')],{})[_0xc261('0x1e')](function(_0x1bed70){var _0x3297c8=_0x39b6f5[_0xc261('0x5a')][_0xc261('0x5b')]({'plain':!![]});if(!_0x3297c8)throw new Error(_0xc261('0x5c'));if(_0x3297c8[_0xc261('0x5d')]===_0xc261('0x5a')){var _0x2e72b7=_0x1bed70[_0xc261('0x5b')]({'plain':!![]});var _0x2de2f8=_0xc261('0x35');return db[_0xc261('0x5e')][_0xc261('0x5f')]({'where':{'name':_0x2de2f8,'userProfileId':_0x3297c8[_0xc261('0x60')]},'raw':!![]})[_0xc261('0x1e')](function(_0x96c3d1){if(_0x96c3d1&&_0x96c3d1[_0xc261('0x61')]===0x0){return db[_0xc261('0x36')]['create']({'name':_0x2e72b7[_0xc261('0x42')],'resourceId':_0x2e72b7['id'],'type':_0x96c3d1[_0xc261('0x42')],'sectionId':_0x96c3d1['id']},{})[_0xc261('0x1e')](function(){return _0x1bed70;});}else{return _0x1bed70;}})[_0xc261('0x27')](function(_0x705969){logger[_0xc261('0x22')](_0xc261('0x62'),_0x705969);throw _0x705969;});}return _0x1bed70;})['then'](respondWithResult(_0x10bd1e,0xc9))[_0xc261('0x27')](handleError(_0x10bd1e,null));};exports['update']=function(_0x499595,_0x5bf532){if(_0x499595[_0xc261('0x59')]['id']){delete _0x499595[_0xc261('0x59')]['id'];}return db[_0xc261('0x3d')]['find']({'where':{'id':_0x499595[_0xc261('0x57')]['id']},'include':[{'model':db[_0xc261('0x3a')],'as':_0xc261('0x3b')}]})[_0xc261('0x1e')](handleEntityNotFound(_0x5bf532,null))[_0xc261('0x1e')](saveUpdates(_0x499595['body'],null))[_0xc261('0x1e')](respondWithResult(_0x5bf532,null))[_0xc261('0x27')](handleError(_0x5bf532,null));};exports[_0xc261('0x34')]=function(_0x2fd152,_0xf8181a){return db['WhatsappAccount'][_0xc261('0x5f')]({'where':{'id':_0x2fd152[_0xc261('0x57')]['id']}})[_0xc261('0x1e')](handleEntityNotFound(_0xf8181a,null))[_0xc261('0x1e')](removeEntity(_0xf8181a,null))[_0xc261('0x27')](handleError(_0xf8181a,null));};exports[_0xc261('0x63')]=function(_0x13468a,_0x56ec92){return db[_0xc261('0x3d')][_0xc261('0x63')]()['then'](respondWithResult(_0x56ec92,null))['catch'](handleError(_0x56ec92,null));};exports['addDisposition']=function(_0x168532,_0x44a609,_0x2d72b3){if(_0x168532[_0xc261('0x59')]['id']){delete _0x168532[_0xc261('0x59')]['id'];}return db[_0xc261('0x3d')][_0xc261('0x5f')]({'where':{'id':_0x168532['params']['id']}})['then'](handleEntityNotFound(_0x44a609,null))[_0xc261('0x1e')](function(_0x11ced5){if(_0x11ced5){_0x168532[_0xc261('0x59')][_0xc261('0x64')]=_0x11ced5['id'];return db[_0xc261('0x65')][_0xc261('0x58')](_0x168532['body']);}})[_0xc261('0x1e')](respondWithResult(_0x44a609,null))['catch'](handleError(_0x44a609,null));};exports[_0xc261('0x66')]=function(_0x265d03,_0x5d6753,_0x3fa148){var _0x2c5cbe={'raw':![],'where':{}};var _0x453ec6={};var _0x5330eb={'count':0x0,'rows':[]};return db[_0xc261('0x3d')][_0xc261('0x67')]({'where':{'id':_0x265d03[_0xc261('0x57')]['id']}})[_0xc261('0x1e')](handleEntityNotFound(_0x5d6753,null))['then'](function(_0x2381c1){if(_0x2381c1){_0x453ec6['model']=_[_0xc261('0x43')](db['Disposition'][_0xc261('0x3e')]);_0x453ec6[_0xc261('0x44')]=_[_0xc261('0x43')](_0x265d03[_0xc261('0x44')]);_0x453ec6['filters']=_[_0xc261('0x45')](_0x453ec6[_0xc261('0x41')],_0x453ec6[_0xc261('0x44')]);_0x2c5cbe[_0xc261('0x46')]=_['intersection'](_0x453ec6[_0xc261('0x41')],qs['fields'](_0x265d03[_0xc261('0x44')]['fields']));_0x2c5cbe['attributes']=_0x2c5cbe[_0xc261('0x46')][_0xc261('0x48')]?_0x2c5cbe[_0xc261('0x46')]:_0x453ec6['model'];if(!_0x265d03[_0xc261('0x44')]['hasOwnProperty'](_0xc261('0x68'))){_0x2c5cbe[_0xc261('0x2f')]=qs[_0xc261('0x2f')](_0x265d03[_0xc261('0x44')][_0xc261('0x2f')]);_0x2c5cbe[_0xc261('0x2c')]=qs[_0xc261('0x2c')](_0x265d03[_0xc261('0x44')][_0xc261('0x2c')]);}_0x2c5cbe[_0xc261('0x4a')]=qs[_0xc261('0x4b')](_0x265d03[_0xc261('0x44')][_0xc261('0x4b')]);_0x2c5cbe[_0xc261('0x50')]=qs[_0xc261('0x4c')](_[_0xc261('0x4d')](_0x265d03[_0xc261('0x44')],_0x453ec6[_0xc261('0x4c')]));_0x2c5cbe[_0xc261('0x50')]['WhatsappAccountId']=_0x2381c1['id'];if(_0x265d03[_0xc261('0x44')][_0xc261('0x4e')]){_0x2c5cbe[_0xc261('0x50')]=_[_0xc261('0x4f')](_0x2c5cbe['where'],{'$or':_[_0xc261('0x3c')](_0x2c5cbe[_0xc261('0x46')],function(_0x4125cd){var _0x4a4976={};_0x4a4976[_0x4125cd]={'$like':'%'+_0x265d03[_0xc261('0x44')][_0xc261('0x4e')]+'%'};return _0x4a4976;})});}_0x2c5cbe=_['merge']({},_0x2c5cbe,_0x265d03[_0xc261('0x52')]);return db[_0xc261('0x65')][_0xc261('0x2e')]({'where':_0x2c5cbe[_0xc261('0x50')]})['then'](function(_0x5b7dfe){_0x5330eb[_0xc261('0x2e')]=_0x5b7dfe;if(_0x265d03['query'][_0xc261('0x69')]){_0x2c5cbe[_0xc261('0x53')]=[{'all':!![]}];}return db[_0xc261('0x65')]['findAll'](_0x2c5cbe);})[_0xc261('0x1e')](function(_0x245ed6){_0x5330eb[_0xc261('0x55')]=_0x245ed6;return _0x5330eb;});}})['then'](respondWithFilteredResult(_0x5d6753,_0x2c5cbe))[_0xc261('0x27')](handleError(_0x5d6753,null));};exports[_0xc261('0x6a')]=function(_0x4d3e65,_0x1b10f7,_0x1c0b01){return db['WhatsappAccount'][_0xc261('0x5f')]({'where':{'id':_0x4d3e65[_0xc261('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b10f7,null))[_0xc261('0x1e')](function(_0x1a6225){if(_0x1a6225){return _0x1a6225[_0xc261('0x6a')](_0x4d3e65[_0xc261('0x44')]['ids']);}})[_0xc261('0x1e')](respondWithStatusCode(_0x1b10f7,null))[_0xc261('0x27')](handleError(_0x1b10f7,null));};exports[_0xc261('0x6b')]=function(_0x24f1cb,_0x2f5b23,_0x179e11){if(_0x24f1cb['body']['id']){delete _0x24f1cb[_0xc261('0x59')]['id'];}return db['WhatsappAccount'][_0xc261('0x5f')]({'where':{'id':_0x24f1cb[_0xc261('0x57')]['id']}})[_0xc261('0x1e')](handleEntityNotFound(_0x2f5b23,null))[_0xc261('0x1e')](function(_0x565ae6){if(_0x565ae6){_0x24f1cb['body']['WhatsappAccountId']=_0x565ae6['id'];return db[_0xc261('0x6c')][_0xc261('0x58')](_0x24f1cb[_0xc261('0x59')]);}})[_0xc261('0x1e')](respondWithResult(_0x2f5b23,null))[_0xc261('0x27')](handleError(_0x2f5b23,null));};exports['getAnswers']=function(_0x2e90de,_0x1d2552,_0x338d22){var _0x14c75e={'raw':![],'where':{}};var _0x1f928e={};var _0x138b44={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x2e90de['params']['id']}})[_0xc261('0x1e')](handleEntityNotFound(_0x1d2552,null))[_0xc261('0x1e')](function(_0x4b5c7f){if(_0x4b5c7f){_0x1f928e[_0xc261('0x41')]=_[_0xc261('0x43')](db[_0xc261('0x6c')][_0xc261('0x3e')]);_0x1f928e[_0xc261('0x44')]=_[_0xc261('0x43')](_0x2e90de['query']);_0x1f928e[_0xc261('0x4c')]=_['intersection'](_0x1f928e[_0xc261('0x41')],_0x1f928e[_0xc261('0x44')]);_0x14c75e[_0xc261('0x46')]=_[_0xc261('0x45')](_0x1f928e[_0xc261('0x41')],qs[_0xc261('0x47')](_0x2e90de[_0xc261('0x44')][_0xc261('0x47')]));_0x14c75e[_0xc261('0x46')]=_0x14c75e[_0xc261('0x46')]['length']?_0x14c75e[_0xc261('0x46')]:_0x1f928e['model'];if(!_0x2e90de[_0xc261('0x44')][_0xc261('0x49')](_0xc261('0x68'))){_0x14c75e['limit']=qs[_0xc261('0x2f')](_0x2e90de[_0xc261('0x44')][_0xc261('0x2f')]);_0x14c75e[_0xc261('0x2c')]=qs[_0xc261('0x2c')](_0x2e90de[_0xc261('0x44')]['offset']);}_0x14c75e[_0xc261('0x4a')]=qs[_0xc261('0x4b')](_0x2e90de[_0xc261('0x44')][_0xc261('0x4b')]);_0x14c75e[_0xc261('0x50')]=qs[_0xc261('0x4c')](_[_0xc261('0x4d')](_0x2e90de[_0xc261('0x44')],_0x1f928e[_0xc261('0x4c')]));_0x14c75e[_0xc261('0x50')][_0xc261('0x64')]=_0x4b5c7f['id'];if(_0x2e90de[_0xc261('0x44')][_0xc261('0x4e')]){_0x14c75e[_0xc261('0x50')]=_[_0xc261('0x4f')](_0x14c75e[_0xc261('0x50')],{'$or':_[_0xc261('0x3c')](_0x14c75e['attributes'],function(_0x1018cc){var _0x531aeb={};_0x531aeb[_0x1018cc]={'$like':'%'+_0x2e90de['query'][_0xc261('0x4e')]+'%'};return _0x531aeb;})});}_0x14c75e=_[_0xc261('0x4f')]({},_0x14c75e,_0x2e90de[_0xc261('0x52')]);return db[_0xc261('0x6c')]['count']({'where':_0x14c75e[_0xc261('0x50')]})[_0xc261('0x1e')](function(_0x440e9a){_0x138b44[_0xc261('0x2e')]=_0x440e9a;if(_0x2e90de['query'][_0xc261('0x69')]){_0x14c75e[_0xc261('0x53')]=[{'all':!![]}];}return db[_0xc261('0x6c')]['findAll'](_0x14c75e);})['then'](function(_0x15af4d){_0x138b44[_0xc261('0x55')]=_0x15af4d;return _0x138b44;});}})[_0xc261('0x1e')](respondWithFilteredResult(_0x1d2552,_0x14c75e))[_0xc261('0x27')](handleError(_0x1d2552,null));};exports[_0xc261('0x6d')]=function(_0x489c64,_0x3ef350,_0x39e918){return db[_0xc261('0x3d')][_0xc261('0x5f')]({'where':{'id':_0x489c64[_0xc261('0x57')]['id']}})[_0xc261('0x1e')](handleEntityNotFound(_0x3ef350,null))[_0xc261('0x1e')](function(_0x1c86e1){if(_0x1c86e1){return _0x1c86e1[_0xc261('0x6d')](_0x489c64[_0xc261('0x44')][_0xc261('0x6e')]);}})[_0xc261('0x1e')](respondWithStatusCode(_0x3ef350,null))[_0xc261('0x27')](handleError(_0x3ef350,null));};exports[_0xc261('0x6f')]=function(_0x426eee,_0x53c723,_0x367257){return db[_0xc261('0x3d')]['find']({'where':{'id':_0x426eee[_0xc261('0x57')]['id']}})[_0xc261('0x1e')](handleEntityNotFound(_0x53c723,null))[_0xc261('0x1e')](function(_0x4f43f8){if(_0x4f43f8){return _0x4f43f8[_0xc261('0x6f')](_0x426eee[_0xc261('0x59')][_0xc261('0x6e')],_[_0xc261('0x70')](_0x426eee[_0xc261('0x59')],[_0xc261('0x6e'),'id'])||{})['spread'](function(_0x46ecc6){for(var _0x173de0=0x0;_0x173de0<_0x426eee['body'][_0xc261('0x6e')][_0xc261('0x48')];_0x173de0+=0x1){socket[_0xc261('0x71')]('userWhatsappAccount:save',{'UserId':Number(_0x426eee[_0xc261('0x59')][_0xc261('0x6e')][_0x173de0]),'WhatsappAccountId':Number(_0x426eee['params']['id'])});}return _0x46ecc6;});}})['then'](respondWithResult(_0x53c723,null))[_0xc261('0x27')](handleError(_0x53c723,null));};exports[_0xc261('0x72')]=function(_0x199b56,_0x251266,_0x2282d7){return db['WhatsappAccount'][_0xc261('0x5f')]({'where':{'id':_0x199b56['params']['id']}})[_0xc261('0x1e')](handleEntityNotFound(_0x251266,null))[_0xc261('0x1e')](function(_0x244642){if(_0x244642){return _0x244642[_0xc261('0x72')](_0x199b56[_0xc261('0x44')][_0xc261('0x6e')])[_0xc261('0x1e')](function(){if(_['isArray'](_0x199b56[_0xc261('0x44')][_0xc261('0x6e')])){for(var _0x1e3ec4=0x0;_0x1e3ec4<_0x199b56[_0xc261('0x44')][_0xc261('0x6e')][_0xc261('0x48')];_0x1e3ec4+=0x1){socket[_0xc261('0x71')](_0xc261('0x73'),{'UserId':Number(_0x199b56[_0xc261('0x44')][_0xc261('0x6e')][_0x1e3ec4]),'WhatsappAccountId':Number(_0x199b56['params']['id'])});}}else{socket[_0xc261('0x71')](_0xc261('0x73'),{'UserId':Number(_0x199b56[_0xc261('0x44')][_0xc261('0x6e')]),'WhatsappAccountId':Number(_0x199b56[_0xc261('0x57')]['id'])});}});}})[_0xc261('0x1e')](respondWithStatusCode(_0x251266,null))['catch'](handleError(_0x251266,null));};exports['getAgents']=function(_0xeea4b7,_0x489050,_0x47a461){var _0x414a6a={};var _0x2f3766={};var _0x2516e0;var _0x54da18;return db['WhatsappAccount'][_0xc261('0x67')]({'where':{'id':_0xeea4b7['params']['id']}})['then'](handleEntityNotFound(_0x489050,null))[_0xc261('0x1e')](function(_0x5c0c83){if(_0x5c0c83){_0x2516e0=_0x5c0c83;_0x2f3766[_0xc261('0x41')]=_['keys'](db['User'][_0xc261('0x3e')]);_0x2f3766[_0xc261('0x44')]=_[_0xc261('0x43')](_0xeea4b7[_0xc261('0x44')]);_0x2f3766['filters']=_['intersection'](_0x2f3766['model'],_0x2f3766[_0xc261('0x44')]);_0x414a6a[_0xc261('0x46')]=_[_0xc261('0x45')](_0x2f3766[_0xc261('0x41')],qs['fields'](_0xeea4b7[_0xc261('0x44')]['fields']));_0x414a6a[_0xc261('0x46')]=_0x414a6a[_0xc261('0x46')]['length']?_0x414a6a[_0xc261('0x46')]:_0x2f3766[_0xc261('0x41')];_0x414a6a[_0xc261('0x4a')]=qs[_0xc261('0x4b')](_0xeea4b7[_0xc261('0x44')][_0xc261('0x4b')]);_0x414a6a[_0xc261('0x50')]=qs[_0xc261('0x4c')](_[_0xc261('0x4d')](_0xeea4b7[_0xc261('0x44')],_0x2f3766[_0xc261('0x4c')]));if(_0xeea4b7['query'][_0xc261('0x4e')]){_0x414a6a[_0xc261('0x50')]=_['merge'](_0x414a6a[_0xc261('0x50')],{'$or':_['map'](_0x414a6a[_0xc261('0x46')],function(_0x5622cc){var _0x245cae={};_0x245cae[_0x5622cc]={'$like':'%'+_0xeea4b7[_0xc261('0x44')][_0xc261('0x4e')]+'%'};return _0x245cae;})});}_0x414a6a=_[_0xc261('0x4f')]({},_0x414a6a,_0xeea4b7['options']);return _0x2516e0[_0xc261('0x74')](_0x414a6a);}})['then'](function(_0xc0cfe4){if(_0xc0cfe4){_0x54da18=_0xc0cfe4[_0xc261('0x48')];if(!_0xeea4b7['query']['hasOwnProperty']('nolimit')){_0x414a6a[_0xc261('0x2f')]=qs[_0xc261('0x2f')](_0xeea4b7[_0xc261('0x44')]['limit']);_0x414a6a[_0xc261('0x2c')]=qs[_0xc261('0x2c')](_0xeea4b7[_0xc261('0x44')][_0xc261('0x2c')]);}return _0x2516e0[_0xc261('0x74')](_0x414a6a);}})['then'](function(_0x5a068d){if(_0x5a068d){return _0x5a068d?{'count':_0x54da18,'rows':_0x5a068d}:null;}})[_0xc261('0x1e')](respondWithResult(_0x489050,null))[_0xc261('0x27')](handleError(_0x489050,null));};exports['addApplications']=function(_0x26d5c1,_0x348239){var _0x143607=_0x26d5c1['params']['id'];var _0x58a1ed=_0x26d5c1['body'];var _0x103d81=0xc8;var _0x1e434b=null;return db[_0xc261('0x75')][_0xc261('0x76')]({'isolationLevel':db['sequelize'][_0xc261('0x77')]['ISOLATION_LEVELS'][_0xc261('0x78')]},function(_0x1e6d87){return db[_0xc261('0x3d')][_0xc261('0x67')]({'where':{'id':_0x143607},'transaction':_0x1e6d87})[_0xc261('0x1e')](function(_0x10c1e8){if(_0x10c1e8){return db[_0xc261('0x79')][_0xc261('0x34')]({'where':{'WhatsappAccountId':_0x143607},'transaction':_0x1e6d87})[_0xc261('0x1e')](function(){var _0x227ec0=_[_0xc261('0x3c')](_0x58a1ed,function(_0x3ec21c){_0x3ec21c['WhatsappAccountId']=_0x143607;return _0x3ec21c;});return db['WhatsappApplication'][_0xc261('0x7a')](_0x227ec0,{'transaction':_0x1e6d87});});}else{_0x103d81=0x194;_0x1e434b=[];}});})[_0xc261('0x1e')](function(){if(_0x103d81!==0x194){return db[_0xc261('0x79')][_0xc261('0x7b')]({'where':{'WhatsappAccountId':_0x143607},'order':_0xc261('0x7c')})[_0xc261('0x1e')](function(_0x55c834){_0x1e434b=_0x55c834;});}})['catch'](function(_0x5782a2){_0x103d81=0x1f4;logger[_0xc261('0x22')](_0x5782a2[_0xc261('0x37')]);if(_0x5782a2[_0xc261('0x42')]){delete _0x5782a2['name'];}_0x1e434b=_0x5782a2;})[_0xc261('0x7d')](function(){if(_0x1e434b===null){_0x348239[_0xc261('0x28')](_0x103d81);}else{if(_0x103d81===0x1f4){_0x348239[_0xc261('0x29')](_0x103d81)['send'](_0x1e434b);}else{_0x348239[_0xc261('0x29')](_0x103d81)['json'](_0x1e434b);}}});};exports['getApplications']=function(_0xe5a38b,_0x2127c,_0x29308f){var _0x4a0437={};var _0x34fc6d={};var _0x4a2e65;var _0x2761d9;return db[_0xc261('0x3d')][_0xc261('0x67')]({'where':{'id':_0xe5a38b['params']['id']}})[_0xc261('0x1e')](handleEntityNotFound(_0x2127c,null))[_0xc261('0x1e')](function(_0x16b5b7){if(_0x16b5b7){_0x4a2e65=_0x16b5b7;_0x34fc6d['model']=_[_0xc261('0x43')](db[_0xc261('0x79')][_0xc261('0x3e')]);_0x34fc6d['query']=_[_0xc261('0x43')](_0xe5a38b['query']);_0x34fc6d[_0xc261('0x4c')]=_['intersection'](_0x34fc6d[_0xc261('0x41')],_0x34fc6d[_0xc261('0x44')]);_0x4a0437['attributes']=_[_0xc261('0x45')](_0x34fc6d[_0xc261('0x41')],qs['fields'](_0xe5a38b[_0xc261('0x44')][_0xc261('0x47')]));_0x4a0437['attributes']=_0x4a0437['attributes'][_0xc261('0x48')]?_0x4a0437['attributes']:_0x34fc6d[_0xc261('0x41')];_0x4a0437[_0xc261('0x4a')]=qs['sort'](_0xe5a38b[_0xc261('0x44')][_0xc261('0x4b')]);_0x4a0437[_0xc261('0x50')]=qs[_0xc261('0x4c')](_[_0xc261('0x4d')](_0xe5a38b[_0xc261('0x44')],_0x34fc6d[_0xc261('0x4c')]));if(_0xe5a38b[_0xc261('0x44')]['filter']){_0x4a0437[_0xc261('0x50')]=_[_0xc261('0x4f')](_0x4a0437['where'],{'$or':_[_0xc261('0x3c')](_0x4a0437[_0xc261('0x46')],function(_0x534f57){var _0x40ec92={};_0x40ec92[_0x534f57]={'$like':'%'+_0xe5a38b[_0xc261('0x44')][_0xc261('0x4e')]+'%'};return _0x40ec92;})});}_0x4a0437=_[_0xc261('0x4f')]({},_0x4a0437,_0xe5a38b[_0xc261('0x52')]);return _0x4a2e65[_0xc261('0x7e')](_0x4a0437);}})[_0xc261('0x1e')](function(_0x9c2bba){if(_0x9c2bba){_0x2761d9=_0x9c2bba['length'];if(!_0xe5a38b[_0xc261('0x44')][_0xc261('0x49')]('nolimit')){_0x4a0437[_0xc261('0x2f')]=qs[_0xc261('0x2f')](_0xe5a38b[_0xc261('0x44')][_0xc261('0x2f')]);_0x4a0437[_0xc261('0x2c')]=qs[_0xc261('0x2c')](_0xe5a38b[_0xc261('0x44')][_0xc261('0x2c')]);}return _0x4a2e65[_0xc261('0x7e')](_0x4a0437);}})[_0xc261('0x1e')](function(_0x2f37f2){if(_0x2f37f2){return _0x2f37f2?{'count':_0x2761d9,'rows':_0x2f37f2}:null;}})[_0xc261('0x1e')](respondWithResult(_0x2127c,null))[_0xc261('0x27')](handleError(_0x2127c,null));};exports[_0xc261('0x7f')]=function(_0x2e8acc,_0x57dcf5,_0x36e2c7){var _0x28adb0={'channel':_0xc261('0x80')};var _0x52eeca=[];var _0x432a9f=[];var _0x40cf8a={};return db[_0xc261('0x3d')]['find']({'where':{'id':_0x2e8acc[_0xc261('0x57')]['id']},'include':[{'model':db[_0xc261('0x79')],'as':'Applications'}]})[_0xc261('0x1e')](handleEntityNotFound(_0x57dcf5,null))[_0xc261('0x1e')](function(_0x156554){_0x28adb0[_0xc261('0x81')]=_0x156554;if(_0x28adb0[_0xc261('0x81')]&&_0x28adb0['account'][_0xc261('0x40')]===_0xc261('0x82')&&_0x2e8acc['body'][_0xc261('0x83')]){if(_0x2e8acc['body'][_0xc261('0x83')][_0xc261('0x48')]===0x0)return;if(_0x2e8acc[_0xc261('0x59')]['statuses'][0x0][_0xc261('0x84')]!==_0xc261('0x85'))return;return db['WhatsappMessage'][_0xc261('0x86')]({'read':!![],'readAt':_0x2e8acc[_0xc261('0x59')][_0xc261('0x83')][0x0]['timestamp']},{'where':{'messageId':_0x2e8acc[_0xc261('0x59')][_0xc261('0x83')][0x0][_0xc261('0x87')]},'individualHooks':!![]})[_0xc261('0x1e')](function(_0x31fd99){return _0x57dcf5[_0xc261('0x29')](0xc8)[_0xc261('0x2b')](_0x31fd99);});}_0x28adb0[_0xc261('0x88')]=_[_0xc261('0x89')](_0x156554[_0xc261('0x8a')],[_0xc261('0x7c')],[_0xc261('0x8b')]);if(_0x28adb0['account']['Applications']){delete _0x28adb0['account'][_0xc261('0x8a')];}return db[_0xc261('0x8c')]['describe']()[_0xc261('0x1e')](function(_0x204124){if(!_0x204124){throw new db[(_0xc261('0x8d'))][(_0xc261('0x8e'))](_0xc261('0x8f'));}_0x52eeca=_[_0xc261('0x90')](_[_0xc261('0x43')](_0x204124),[_0xc261('0x91'),_0xc261('0x92')]);_0x432a9f=_['difference'](_[_0xc261('0x43')](_0x204124),[_0xc261('0x91'),_0xc261('0x92'),_0xc261('0x93'),_0xc261('0x94')]);_0x28adb0[_0xc261('0x59')]={'mapKey':_0xc261('0x95')};if(_0x28adb0[_0xc261('0x81')]&&_0x28adb0[_0xc261('0x81')]['type']===_0xc261('0x96')){_0x28adb0[_0xc261('0x59')][_0xc261('0x97')]=_0x2e8acc[_0xc261('0x59')][_0xc261('0x98')]['replace'](_0xc261('0x99'),'');_0x28adb0[_0xc261('0x59')][_0xc261('0x59')]=_0x2e8acc['body']['Body'];_0x28adb0[_0xc261('0x59')]['messageId']=_0x2e8acc['body'][_0xc261('0x9a')];}if(_0x28adb0[_0xc261('0x81')]&&_0x28adb0[_0xc261('0x81')][_0xc261('0x40')]===_0xc261('0x82')){_0x28adb0['body'][_0xc261('0x97')]=_0x2e8acc['body'][_0xc261('0x9b')][0x0][_0xc261('0x97')];_0x28adb0[_0xc261('0x59')][_0xc261('0x59')]=_0x2e8acc[_0xc261('0x59')][_0xc261('0x9b')][0x0][_0xc261('0x24')][_0xc261('0x59')];_0x28adb0[_0xc261('0x59')][_0xc261('0x9c')]=_0x2e8acc[_0xc261('0x59')][_0xc261('0x9b')][0x0][_0xc261('0x87')];}if(_0x28adb0[_0xc261('0x59')]['id']){delete _0x28adb0[_0xc261('0x59')]['id'];}if(_[_0xc261('0x9d')](_0x28adb0['body'][_0xc261('0x97')])){throw new db['Sequelize'][(_0xc261('0x8e'))](_0xc261('0x9e'));}if(_[_0xc261('0x9d')](_0x28adb0[_0xc261('0x59')][_0xc261('0x59')])||_0x28adb0['body'][_0xc261('0x59')]===''){throw new db['Sequelize'][(_0xc261('0x8e'))](_0xc261('0x9f'));}if(_[_0xc261('0x9d')](_0x28adb0[_0xc261('0x59')][_0xc261('0xa0')])){throw new db[(_0xc261('0x8d'))]['ValidationError'](_0xc261('0xa1')+_0x432a9f);}if(!_[_0xc261('0xa2')](_0x432a9f,_0x28adb0[_0xc261('0x59')][_0xc261('0xa0')])){throw new db[(_0xc261('0x8d'))][(_0xc261('0x8e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x432a9f);}_0x40cf8a[_0x28adb0['body'][_0xc261('0xa0')]]=_0x28adb0['body'][_0xc261('0x97')];return db[_0xc261('0xa3')][_0xc261('0x5f')]({'where':{'id':_0x28adb0[_0xc261('0x81')]['ListId']},'include':[{'model':db[_0xc261('0x8c')],'as':_0xc261('0xa4'),'where':_0x40cf8a,'limit':0x1,'order':[[_0xc261('0x92'),_0xc261('0xa5')]]}]});})['then'](handleEntityNotFound(_0x57dcf5,null))[_0xc261('0x1e')](function(_0x435c60){if(_0x435c60){_0x28adb0[_0xc261('0xa6')]=_[_0xc261('0x70')](_0x435c60,['Contacts']);if(_0x435c60[_0xc261('0xa4')]['length']){return _0x435c60[_0xc261('0xa4')][0x0];}var _0x56b907=_[_0xc261('0xa7')](_0x28adb0[_0xc261('0x59')],{'firstName':_0x28adb0[_0xc261('0x59')]['from'],'ListId':_0x435c60['id']});_0x56b907[_0x28adb0[_0xc261('0x59')][_0xc261('0xa0')]]=_0x28adb0[_0xc261('0x59')]['from'];return db[_0xc261('0x8c')]['create'](_0x56b907,{'fields':_0x52eeca,'raw':!![]});}})[_0xc261('0x1e')](handleEntityNotFound(_0x57dcf5,null))[_0xc261('0x1e')](function(_0x7e2c00){if(_0x7e2c00){_0x28adb0[_0xc261('0xa8')]=_0x7e2c00;var _0x5c7357={'ContactId':_0x7e2c00['id'],'phone':_0x28adb0['body'][_0xc261('0x97')],'WhatsappAccountId':_0x2e8acc[_0xc261('0x57')]['id']};var _0xe40864={'ContactId':_0x7e2c00['id'],'WhatsappAccountId':_0x2e8acc[_0xc261('0x57')]['id'],'closed':![]};return db[_0xc261('0xa9')][_0xc261('0x5f')]({'where':_0xe40864})[_0xc261('0x1e')](function(_0x22c43a){if(_0x22c43a){return[_0x22c43a,![]];}return db[_0xc261('0xa9')][_0xc261('0x58')](_0x5c7357)[_0xc261('0x1e')](function(_0x4fbdc4){return[_0x4fbdc4,!![]];});});}})['spread'](function(_0x5b2a9e,_0xdee1eb){_0x28adb0['interaction']=_0x5b2a9e['get']({'plain':!![]});_0x28adb0[_0xc261('0xaa')]['created']=![];if(_0xdee1eb){if(_0x28adb0['account']['autoclose']){_0x28adb0[_0xc261('0x88')][_0xc261('0xab')]({'id':0x0,'priority':_0x28adb0[_0xc261('0x88')]['length']+0x1,'app':_0xc261('0xac'),'appdata':_0xc261('0xad'),'interval':_0xc261('0xae')});}_0x28adb0[_0xc261('0xaa')][_0xc261('0xaf')]=!![];}return db[_0xc261('0xb0')][_0xc261('0x58')]({'phone':_0x28adb0[_0xc261('0x59')][_0xc261('0x97')],'messageId':_0x28adb0[_0xc261('0x59')][_0xc261('0x9c')],'body':_0x28adb0[_0xc261('0x59')][_0xc261('0x59')],'WhatsappAccountId':_0x2e8acc[_0xc261('0x57')]['id'],'WhatsappInteractionId':_0x5b2a9e['id'],'direction':'in','ContactId':_0x5b2a9e['ContactId'],'AttachmentId':_0x28adb0[_0xc261('0x59')][_0xc261('0xb1')]});})[_0xc261('0x1e')](function(_0xc0a369){_0x28adb0[_0xc261('0x24')]=_0xc0a369;if(!_0x28adb0[_0xc261('0xaa')][_0xc261('0xb2')])return;return db[_0xc261('0xb3')][_0xc261('0x5f')]({'attributes':['id',_0xc261('0x42')],'where':{'id':_0x28adb0[_0xc261('0xaa')][_0xc261('0xb2')]}});})['then'](function(_0x1a23f4){if(_0x1a23f4){_0x28adb0[_0xc261('0x88')][_0xc261('0xb4')]({'id':0x0,'priority':0x0,'app':_0xc261('0xb5'),'appdata':_0x1a23f4[_0xc261('0x42')]+','+(_0x28adb0[_0xc261('0x81')][_0xc261('0xb6')]||0xa),'interval':'*,*,*,*'});}if(!_0x28adb0['interaction'][_0xc261('0xb7')])return;return db[_0xc261('0xb8')][_0xc261('0x5f')]({'attributes':['id','name'],'where':{'id':_0x28adb0[_0xc261('0xaa')][_0xc261('0xb7')]}});})[_0xc261('0x1e')](function(_0x4fe879){if(_0x4fe879){_0x28adb0[_0xc261('0x88')][_0xc261('0xb4')]({'id':0x0,'priority':0x1,'app':_0xc261('0xb9'),'appdata':_0x4fe879[_0xc261('0x42')]+','+(_0x28adb0[_0xc261('0x81')]['waitForTheAssignedQueue']||0x12c),'interval':_0xc261('0xae')});}return respondWithRpcPromise('Start',_0xc261('0xba'),_0x28adb0);})[_0xc261('0x1e')](function(_0x20626){if(_0x20626){var _0x5e12ac=0xc8;var _0x8f4650='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x8f4650,_0x5e12ac,_0xc261('0xbb'));logger[_0xc261('0x20')](_0xc261('0xbc'),_0x8f4650,_0x5e12ac,_0xc261('0xbb'),JSON[_0xc261('0x21')](_0x20626));if(_0x28adb0['account'][_0xc261('0x40')]===_0xc261('0x96')){return _0x57dcf5[_0xc261('0x29')](_0x5e12ac)[_0xc261('0xbd')](_0xc261('0xbe'),_0xc261('0xbf'))['send'](_0xc261('0xc0'));}else{return _0x57dcf5['status'](_0x5e12ac)['json'](_0x20626);}}});})['catch'](handleError(_0x57dcf5,null));};exports[_0xc261('0x38')]=function(_0x49707a,_0x3fd67e,_0x21d22c){var _0x5297ff,_0x2ce32b,_0x2b6d99;if(_['isNil'](_0x49707a[_0xc261('0x59')][_0xc261('0x59')])||_0x49707a[_0xc261('0x59')][_0xc261('0x59')]===''){throw new db['Sequelize'][(_0xc261('0x8e'))](_0xc261('0x9f'));}if(_[_0xc261('0x9d')](_0x49707a[_0xc261('0x59')]['to'])){throw new db['Sequelize'][(_0xc261('0x8e'))]('to\x20is\x20mandatory');}_0x5297ff=_0x49707a['body']['to'];return db['WhatsappAccount'][_0xc261('0x5f')]({'where':{'id':_0x49707a[_0xc261('0x57')]['id']},'include':[{'model':db[_0xc261('0xa3')],'as':_0xc261('0xc1'),'include':[{'model':db['CmContact'],'as':_0xc261('0xa4'),'where':{'mobile':_0x5297ff},'limit':0x1,'order':[['updatedAt',_0xc261('0xa5')]]}]}]})[_0xc261('0x1e')](handleEntityNotFound(_0x3fd67e,null))['then'](function(_0x3fd389){if(_0x3fd389&&_0x3fd389[_0xc261('0xc1')]){_0x2ce32b=_0x3fd389[_0xc261('0x5b')]({'plain':!![]});if(_0x2ce32b[_0xc261('0xc1')]&&_0x2ce32b[_0xc261('0xc1')][_0xc261('0xa4')][_0xc261('0x48')]){return _0x2ce32b[_0xc261('0xc1')]['Contacts'][0x0];}return db[_0xc261('0x8c')][_0xc261('0x58')](_[_0xc261('0xa7')](_0x49707a['body'],{'firstName':_0x5297ff,'mobile':_0x5297ff,'phone':_0x5297ff,'ListId':_0x2ce32b[_0xc261('0x94')]}));}})[_0xc261('0x1e')](handleEntityNotFound(_0x3fd67e,null))[_0xc261('0x1e')](function(_0x7a8d5){if(_0x7a8d5){_0x2b6d99=_0x7a8d5;return db[_0xc261('0xa9')]['find']({'where':{'ContactId':_0x2b6d99['id'],'closed':![],'WhatsappAccountId':_0x2ce32b['id']}})[_0xc261('0x1e')](function(_0x299178){if(_0x299178){return[_0x299178,![]];}return db[_0xc261('0xa9')][_0xc261('0x58')]({'UserId':_0x49707a[_0xc261('0x5a')]['id'],'ContactId':_0x2b6d99['id'],'WhatsappAccountId':_0x2ce32b['id'],'phone':_0x5297ff,'firstMsgDirection':_0xc261('0xc2'),'Messages':[_['merge'](_0x49707a['body'],{'read':![],'body':_0x49707a[_0xc261('0x59')][_0xc261('0x59')],'phone':_0x5297ff,'WhatsappAccountId':_0x2ce32b['id'],'UserId':_0x49707a[_0xc261('0x5a')]['id'],'ContactId':_0x2b6d99['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0xc261('0xc3')}]})[_0xc261('0x1e')](function(_0x2799e3){return[_0x2799e3,!![]];});});}})[_0xc261('0xc4')](function(_0x4ee98a,_0x23e363){if(_0x23e363){return _0x4ee98a;}return db['WhatsappMessage'][_0xc261('0x58')](_[_0xc261('0x4f')](_0x49707a['body'],{'read':![],'body':_0x49707a[_0xc261('0x59')]['body'],'phone':_0x5297ff,'WhatsappAccountId':_0x2ce32b['id'],'WhatsappInteractionId':_0x4ee98a['id'],'UserId':_0x49707a[_0xc261('0x5a')]['id'],'ContactId':_0x2b6d99['id']}))[_0xc261('0x1e')](function(_0x8eb240){_0x4ee98a['dataValues'][_0xc261('0xc3')]=[];_0x4ee98a['dataValues']['Messages'][_0xc261('0xab')](_0x8eb240['dataValues']);return _0x4ee98a;});})['then'](respondWithResult(_0x3fd67e,null))['catch'](handleError(_0x3fd67e,null));};
\ No newline at end of file
+var _0x22d5=['Disposition','findOne','pick','include','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','CompanyId','ListId','mobile','twilio','from','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','Contacts','contact','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','Content-Type','to\x20is\x20mandatory','List','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','fs-extra','lodash','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','jayson/promise','client','request','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','destroy','WhatsappAccounts','UserProfileResource','then','stack','name','send','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','fieldName','type','key','map','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','findAll','rows','show','length','includeAll','find','catch','create','get','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','params','describe','WhatsappAccountId'];(function(_0x1ad74b,_0x21708e){var _0x5f0992=function(_0x24d37d){while(--_0x24d37d){_0x1ad74b['push'](_0x1ad74b['shift']());}};_0x5f0992(++_0x21708e);}(_0x22d5,0x1e1));var _0x522d=function(_0x3c2c2a,_0x2bce72){_0x3c2c2a=_0x3c2c2a-0x0;var _0xf1156b=_0x22d5[_0x3c2c2a];return _0xf1156b;};'use strict';var emlformat=require(_0x522d('0x0'));var rimraf=require(_0x522d('0x1'));var zipdir=require(_0x522d('0x2'));var jsonpatch=require(_0x522d('0x3'));var rp=require('request-promise');var moment=require(_0x522d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x522d('0x5'));var util=require(_0x522d('0x6'));var path=require(_0x522d('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x522d('0x8'));var fs=require('fs');var fs_extra=require(_0x522d('0x9'));var _=require(_0x522d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x522d('0xb'));var toCsv=require(_0x522d('0xc'));var querystring=require('querystring');var Papa=require(_0x522d('0xd'));var Redis=require(_0x522d('0xe'));var authService=require(_0x522d('0xf'));var qs=require(_0x522d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x522d('0x11'));var logger=require(_0x522d('0x12'))(_0x522d('0x13'));var utils=require('../../config/utils');var config=require(_0x522d('0x14'));var licenseUtil=require(_0x522d('0x15'));var db=require(_0x522d('0x16'))['db'];config['redis']=_[_0x522d('0x17')](config[_0x522d('0x18')],{'host':_0x522d('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x522d('0x18')]));require(_0x522d('0x1a'))['register'](socket);var jayson=require(_0x522d('0x1b'));var client=jayson[_0x522d('0x1c')]['http']({'port':0x232c});function respondWithRpcPromise(_0x188d19,_0xb69956,_0x4339b9,_0x2073e2){return new BPromise(function(_0x14afcd,_0x1becdb){var _0x311abd=_0x2073e2||client;return _0x311abd[_0x522d('0x1d')](_0x188d19,_0x4339b9)['then'](function(_0x38679f){logger['info'](_0x522d('0x1e'),_0xb69956,_0x522d('0x1f'));logger[_0x522d('0x20')](_0x522d('0x21'),_0xb69956,_0x522d('0x1f'),JSON[_0x522d('0x22')](_0x38679f));if(_0x38679f[_0x522d('0x23')]){if(_0x38679f[_0x522d('0x23')][_0x522d('0x24')]===0x1f4){logger[_0x522d('0x23')](_0x522d('0x1e'),_0xb69956,_0x38679f[_0x522d('0x23')]['message']);return _0x1becdb(_0x38679f[_0x522d('0x23')]['message']);}logger[_0x522d('0x23')](_0x522d('0x1e'),_0xb69956,_0x38679f['error'][_0x522d('0x25')]);return _0x14afcd(_0x38679f[_0x522d('0x23')][_0x522d('0x25')]);}else{logger[_0x522d('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0xb69956,_0x522d('0x1f'));_0x14afcd(_0x38679f['result'][_0x522d('0x25')]);}})['catch'](function(_0x3896e5){logger[_0x522d('0x23')](_0x522d('0x1e'),_0xb69956,_0x3896e5);_0x1becdb(_0x3896e5);});});}function respondWithStatusCode(_0x3393d5,_0x39b0de){_0x39b0de=_0x39b0de||0xcc;return function(_0xeb72b6){if(_0xeb72b6){return _0x3393d5[_0x522d('0x27')](_0x39b0de);}return _0x3393d5[_0x522d('0x28')](_0x39b0de)[_0x522d('0x29')]();};}function respondWithResult(_0x4bf368,_0x28024c){_0x28024c=_0x28024c||0xc8;return function(_0x5b2a31){if(_0x5b2a31){return _0x4bf368[_0x522d('0x28')](_0x28024c)[_0x522d('0x2a')](_0x5b2a31);}};}function respondWithFilteredResult(_0x8de694,_0x1e2cef){return function(_0x4c22d5){if(_0x4c22d5){var _0x4f11d8=typeof _0x1e2cef[_0x522d('0x2b')]===_0x522d('0x2c')&&typeof _0x1e2cef['limit']==='undefined';var _0x4ed1a5=_0x4c22d5['count'];var _0x1a70aa=_0x4f11d8?0x0:_0x1e2cef[_0x522d('0x2b')];var _0x1cbb1a=_0x4f11d8?_0x4c22d5[_0x522d('0x2d')]:_0x1e2cef[_0x522d('0x2b')]+_0x1e2cef[_0x522d('0x2e')];var _0x55d922;if(_0x1cbb1a>=_0x4ed1a5){_0x1cbb1a=_0x4ed1a5;_0x55d922=0xc8;}else{_0x55d922=0xce;}_0x8de694[_0x522d('0x28')](_0x55d922);return _0x8de694[_0x522d('0x2f')](_0x522d('0x30'),_0x1a70aa+'-'+_0x1cbb1a+'/'+_0x4ed1a5)['json'](_0x4c22d5);}return null;};}function patchUpdates(_0xb0f930){return function(_0x20dd6e){try{jsonpatch[_0x522d('0x31')](_0x20dd6e,_0xb0f930,!![]);}catch(_0x1ec034){return BPromise[_0x522d('0x32')](_0x1ec034);}return _0x20dd6e['save']();};}function saveUpdates(_0x1aa5ec,_0x1241ce){return function(_0x2e04b5){if(_0x2e04b5){return _0x2e04b5[_0x522d('0x33')](_0x1aa5ec)['then'](function(_0x47fd8f){return _0x47fd8f;});}return null;};}function removeEntity(_0x3148bd,_0x2237df){return function(_0x24718c){if(_0x24718c){return _0x24718c[_0x522d('0x34')]()['then'](function(){var _0x1f3931=_0x24718c['get']({'plain':!![]});var _0xf93bab=_0x522d('0x35');return db[_0x522d('0x36')][_0x522d('0x34')]({'where':{'type':_0xf93bab,'resourceId':_0x1f3931['id']}})[_0x522d('0x37')](function(){return _0x24718c;});})[_0x522d('0x37')](function(){_0x3148bd[_0x522d('0x28')](0xcc)[_0x522d('0x29')]();});}};}function handleEntityNotFound(_0x50006e,_0x30720b){return function(_0xc612d){if(!_0xc612d){_0x50006e[_0x522d('0x27')](0x194);}return _0xc612d;};}function handleError(_0x2b30ee,_0x2b4c9f){_0x2b4c9f=_0x2b4c9f||0x1f4;return function(_0x4a795e){logger[_0x522d('0x23')](_0x4a795e[_0x522d('0x38')]);if(_0x4a795e[_0x522d('0x39')]){delete _0x4a795e['name'];}_0x2b30ee[_0x522d('0x28')](_0x2b4c9f)[_0x522d('0x3a')](_0x4a795e);};}exports[_0x522d('0x3b')]=function(_0x82f47c,_0x49949e){var _0x3b4a9e={'include':[{'model':db['Pause'],'as':_0x522d('0x3c')}]},_0x1a5702={},_0x2c245b={'count':0x0,'rows':[]};var _0x3288f3=_['map'](db[_0x522d('0x3d')][_0x522d('0x3e')],function(_0x46bae1){return{'name':_0x46bae1[_0x522d('0x3f')],'type':_0x46bae1[_0x522d('0x40')][_0x522d('0x41')]};});_0x1a5702['model']=_[_0x522d('0x42')](_0x3288f3,_0x522d('0x39'));_0x1a5702[_0x522d('0x43')]=_[_0x522d('0x44')](_0x82f47c[_0x522d('0x43')]);_0x1a5702[_0x522d('0x45')]=_['intersection'](_0x1a5702[_0x522d('0x46')],_0x1a5702[_0x522d('0x43')]);_0x3b4a9e[_0x522d('0x47')]=_[_0x522d('0x48')](_0x1a5702[_0x522d('0x46')],qs[_0x522d('0x49')](_0x82f47c['query']['fields']));_0x3b4a9e[_0x522d('0x47')]=_0x3b4a9e[_0x522d('0x47')]['length']?_0x3b4a9e['attributes']:_0x1a5702['model'];if(!_0x82f47c['query'][_0x522d('0x4a')](_0x522d('0x4b'))){_0x3b4a9e[_0x522d('0x2e')]=qs[_0x522d('0x2e')](_0x82f47c[_0x522d('0x43')]['limit']);_0x3b4a9e[_0x522d('0x2b')]=qs[_0x522d('0x2b')](_0x82f47c['query']['offset']);}_0x3b4a9e[_0x522d('0x4c')]=qs[_0x522d('0x4d')](_0x82f47c[_0x522d('0x43')]['sort']);_0x3b4a9e['where']=qs['filters'](_['pick'](_0x82f47c[_0x522d('0x43')],_0x1a5702[_0x522d('0x45')]),_0x3288f3);if(_0x82f47c['query'][_0x522d('0x4e')]){_0x3b4a9e[_0x522d('0x4f')]=_[_0x522d('0x50')](_0x3b4a9e[_0x522d('0x4f')],{'$or':_['map'](_0x3288f3,function(_0x3437b7){if(_0x3437b7[_0x522d('0x40')]!=='VIRTUAL'){var _0x4bf26c={};_0x4bf26c[_0x3437b7[_0x522d('0x39')]]={'$like':'%'+_0x82f47c[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x4bf26c;}})});}_0x3b4a9e=_['merge']({},_0x3b4a9e,_0x82f47c[_0x522d('0x51')]);var _0x369cea={'where':_0x3b4a9e[_0x522d('0x4f')]};return db[_0x522d('0x3d')][_0x522d('0x2d')](_0x369cea)[_0x522d('0x37')](function(_0x4b1991){_0x2c245b['count']=_0x4b1991;if(_0x82f47c[_0x522d('0x43')]['includeAll']){_0x3b4a9e['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x522d('0x52')](_0x3b4a9e);})['then'](function(_0xe0bb19){_0x2c245b[_0x522d('0x53')]=_0xe0bb19;return _0x2c245b;})[_0x522d('0x37')](respondWithFilteredResult(_0x49949e,_0x3b4a9e))['catch'](handleError(_0x49949e,null));};exports[_0x522d('0x54')]=function(_0x56bf27,_0x2c6539){var _0x52e406={'raw':![],'where':{'id':_0x56bf27['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x23985a={};_0x23985a[_0x522d('0x46')]=_[_0x522d('0x44')](db[_0x522d('0x3d')][_0x522d('0x3e')]);_0x23985a['query']=_['keys'](_0x56bf27['query']);_0x23985a[_0x522d('0x45')]=_['intersection'](_0x23985a['model'],_0x23985a[_0x522d('0x43')]);_0x52e406[_0x522d('0x47')]=_['intersection'](_0x23985a[_0x522d('0x46')],qs[_0x522d('0x49')](_0x56bf27['query'][_0x522d('0x49')]));_0x52e406['attributes']=_0x52e406[_0x522d('0x47')][_0x522d('0x55')]?_0x52e406[_0x522d('0x47')]:_0x23985a[_0x522d('0x46')];if(_0x56bf27[_0x522d('0x43')][_0x522d('0x56')]){_0x52e406['include']=[{'all':!![]}];}_0x52e406=_[_0x522d('0x50')]({},_0x52e406,_0x56bf27[_0x522d('0x51')]);return db[_0x522d('0x3d')][_0x522d('0x57')](_0x52e406)['then'](handleEntityNotFound(_0x2c6539,null))[_0x522d('0x37')](respondWithResult(_0x2c6539,null))[_0x522d('0x58')](handleError(_0x2c6539,null));};exports[_0x522d('0x59')]=function(_0x3ccc67,_0x290231){return db[_0x522d('0x3d')][_0x522d('0x59')](_0x3ccc67['body'],{})[_0x522d('0x37')](function(_0x4444df){var _0x155f10=_0x3ccc67['user'][_0x522d('0x5a')]({'plain':!![]});if(!_0x155f10)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x155f10[_0x522d('0x5b')]===_0x522d('0x5c')){var _0x358089=_0x4444df[_0x522d('0x5a')]({'plain':!![]});var _0x40802a='WhatsappAccounts';return db[_0x522d('0x5d')][_0x522d('0x57')]({'where':{'name':_0x40802a,'userProfileId':_0x155f10['userProfileId']},'raw':!![]})[_0x522d('0x37')](function(_0x27652c){if(_0x27652c&&_0x27652c[_0x522d('0x5e')]===0x0){return db[_0x522d('0x36')][_0x522d('0x59')]({'name':_0x358089[_0x522d('0x39')],'resourceId':_0x358089['id'],'type':_0x27652c[_0x522d('0x39')],'sectionId':_0x27652c['id']},{})[_0x522d('0x37')](function(){return _0x4444df;});}else{return _0x4444df;}})[_0x522d('0x58')](function(_0x42edd9){logger['error'](_0x522d('0x5f'),_0x42edd9);throw _0x42edd9;});}return _0x4444df;})[_0x522d('0x37')](respondWithResult(_0x290231,0xc9))[_0x522d('0x58')](handleError(_0x290231,null));};exports[_0x522d('0x33')]=function(_0x4c9607,_0x357055){if(_0x4c9607['body']['id']){delete _0x4c9607[_0x522d('0x60')]['id'];}return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x4c9607['params']['id']},'include':[{'model':db[_0x522d('0x61')],'as':'mandatoryDispositionPause'}]})[_0x522d('0x37')](handleEntityNotFound(_0x357055,null))[_0x522d('0x37')](saveUpdates(_0x4c9607[_0x522d('0x60')],null))[_0x522d('0x37')](respondWithResult(_0x357055,null))[_0x522d('0x58')](handleError(_0x357055,null));};exports[_0x522d('0x34')]=function(_0x3394f9,_0xb4acb5){return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x3394f9[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0xb4acb5,null))[_0x522d('0x37')](removeEntity(_0xb4acb5,null))['catch'](handleError(_0xb4acb5,null));};exports['describe']=function(_0x42d601,_0x507b89){return db[_0x522d('0x3d')][_0x522d('0x63')]()[_0x522d('0x37')](respondWithResult(_0x507b89,null))['catch'](handleError(_0x507b89,null));};exports['addDisposition']=function(_0x1907f4,_0x238617,_0x3d20f7){if(_0x1907f4[_0x522d('0x60')]['id']){delete _0x1907f4[_0x522d('0x60')]['id'];}return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x1907f4[_0x522d('0x62')]['id']}})['then'](handleEntityNotFound(_0x238617,null))[_0x522d('0x37')](function(_0x83425a){if(_0x83425a){_0x1907f4[_0x522d('0x60')][_0x522d('0x64')]=_0x83425a['id'];return db[_0x522d('0x65')][_0x522d('0x59')](_0x1907f4['body']);}})[_0x522d('0x37')](respondWithResult(_0x238617,null))['catch'](handleError(_0x238617,null));};exports['getDispositions']=function(_0x6fc387,_0x1fb6b5,_0x210ac6){var _0x53d494={'raw':![],'where':{}};var _0x328da={};var _0x4670f2={'count':0x0,'rows':[]};return db[_0x522d('0x3d')][_0x522d('0x66')]({'where':{'id':_0x6fc387[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x1fb6b5,null))[_0x522d('0x37')](function(_0x31309d){if(_0x31309d){_0x328da[_0x522d('0x46')]=_['keys'](db['Disposition'][_0x522d('0x3e')]);_0x328da['query']=_['keys'](_0x6fc387[_0x522d('0x43')]);_0x328da[_0x522d('0x45')]=_[_0x522d('0x48')](_0x328da[_0x522d('0x46')],_0x328da[_0x522d('0x43')]);_0x53d494['attributes']=_[_0x522d('0x48')](_0x328da['model'],qs[_0x522d('0x49')](_0x6fc387[_0x522d('0x43')][_0x522d('0x49')]));_0x53d494[_0x522d('0x47')]=_0x53d494[_0x522d('0x47')][_0x522d('0x55')]?_0x53d494['attributes']:_0x328da['model'];if(!_0x6fc387[_0x522d('0x43')][_0x522d('0x4a')](_0x522d('0x4b'))){_0x53d494[_0x522d('0x2e')]=qs['limit'](_0x6fc387['query'][_0x522d('0x2e')]);_0x53d494['offset']=qs[_0x522d('0x2b')](_0x6fc387[_0x522d('0x43')]['offset']);}_0x53d494['order']=qs['sort'](_0x6fc387[_0x522d('0x43')][_0x522d('0x4d')]);_0x53d494[_0x522d('0x4f')]=qs[_0x522d('0x45')](_[_0x522d('0x67')](_0x6fc387['query'],_0x328da[_0x522d('0x45')]));_0x53d494[_0x522d('0x4f')][_0x522d('0x64')]=_0x31309d['id'];if(_0x6fc387['query'][_0x522d('0x4e')]){_0x53d494[_0x522d('0x4f')]=_[_0x522d('0x50')](_0x53d494[_0x522d('0x4f')],{'$or':_[_0x522d('0x42')](_0x53d494[_0x522d('0x47')],function(_0x24e0d7){var _0x5dfa50={};_0x5dfa50[_0x24e0d7]={'$like':'%'+_0x6fc387[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x5dfa50;})});}_0x53d494=_[_0x522d('0x50')]({},_0x53d494,_0x6fc387['options']);return db[_0x522d('0x65')]['count']({'where':_0x53d494[_0x522d('0x4f')]})[_0x522d('0x37')](function(_0x4832dc){_0x4670f2[_0x522d('0x2d')]=_0x4832dc;if(_0x6fc387[_0x522d('0x43')][_0x522d('0x56')]){_0x53d494[_0x522d('0x68')]=[{'all':!![]}];}return db['Disposition'][_0x522d('0x52')](_0x53d494);})[_0x522d('0x37')](function(_0x255531){_0x4670f2[_0x522d('0x53')]=_0x255531;return _0x4670f2;});}})['then'](respondWithFilteredResult(_0x1fb6b5,_0x53d494))[_0x522d('0x58')](handleError(_0x1fb6b5,null));};exports[_0x522d('0x69')]=function(_0x1692b8,_0x44e685,_0x39fb49){return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x1692b8[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x44e685,null))['then'](function(_0x7078b7){if(_0x7078b7){return _0x7078b7[_0x522d('0x69')](_0x1692b8[_0x522d('0x43')][_0x522d('0x6a')]);}})[_0x522d('0x37')](respondWithStatusCode(_0x44e685,null))[_0x522d('0x58')](handleError(_0x44e685,null));};exports['addAnswer']=function(_0x2fd544,_0x466ccc,_0x995b64){if(_0x2fd544[_0x522d('0x60')]['id']){delete _0x2fd544['body']['id'];}return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x2fd544[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x466ccc,null))[_0x522d('0x37')](function(_0x13eb7c){if(_0x13eb7c){_0x2fd544[_0x522d('0x60')]['WhatsappAccountId']=_0x13eb7c['id'];return db['CannedAnswer'][_0x522d('0x59')](_0x2fd544[_0x522d('0x60')]);}})[_0x522d('0x37')](respondWithResult(_0x466ccc,null))['catch'](handleError(_0x466ccc,null));};exports[_0x522d('0x6b')]=function(_0xd80b5d,_0x728fa9,_0x512b7c){var _0x50171f={'raw':![],'where':{}};var _0x189527={};var _0xea6ad={'count':0x0,'rows':[]};return db[_0x522d('0x3d')][_0x522d('0x66')]({'where':{'id':_0xd80b5d[_0x522d('0x62')]['id']}})['then'](handleEntityNotFound(_0x728fa9,null))[_0x522d('0x37')](function(_0x145e09){if(_0x145e09){_0x189527[_0x522d('0x46')]=_['keys'](db[_0x522d('0x6c')][_0x522d('0x3e')]);_0x189527['query']=_[_0x522d('0x44')](_0xd80b5d[_0x522d('0x43')]);_0x189527[_0x522d('0x45')]=_['intersection'](_0x189527[_0x522d('0x46')],_0x189527['query']);_0x50171f[_0x522d('0x47')]=_[_0x522d('0x48')](_0x189527[_0x522d('0x46')],qs[_0x522d('0x49')](_0xd80b5d['query'][_0x522d('0x49')]));_0x50171f['attributes']=_0x50171f[_0x522d('0x47')][_0x522d('0x55')]?_0x50171f[_0x522d('0x47')]:_0x189527[_0x522d('0x46')];if(!_0xd80b5d['query'][_0x522d('0x4a')](_0x522d('0x4b'))){_0x50171f[_0x522d('0x2e')]=qs[_0x522d('0x2e')](_0xd80b5d[_0x522d('0x43')][_0x522d('0x2e')]);_0x50171f[_0x522d('0x2b')]=qs[_0x522d('0x2b')](_0xd80b5d[_0x522d('0x43')][_0x522d('0x2b')]);}_0x50171f[_0x522d('0x4c')]=qs[_0x522d('0x4d')](_0xd80b5d[_0x522d('0x43')][_0x522d('0x4d')]);_0x50171f['where']=qs[_0x522d('0x45')](_[_0x522d('0x67')](_0xd80b5d[_0x522d('0x43')],_0x189527[_0x522d('0x45')]));_0x50171f['where']['WhatsappAccountId']=_0x145e09['id'];if(_0xd80b5d['query']['filter']){_0x50171f['where']=_[_0x522d('0x50')](_0x50171f[_0x522d('0x4f')],{'$or':_[_0x522d('0x42')](_0x50171f[_0x522d('0x47')],function(_0x559ea2){var _0x5620ec={};_0x5620ec[_0x559ea2]={'$like':'%'+_0xd80b5d[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x5620ec;})});}_0x50171f=_[_0x522d('0x50')]({},_0x50171f,_0xd80b5d[_0x522d('0x51')]);return db[_0x522d('0x6c')][_0x522d('0x2d')]({'where':_0x50171f['where']})[_0x522d('0x37')](function(_0x1a2878){_0xea6ad['count']=_0x1a2878;if(_0xd80b5d[_0x522d('0x43')][_0x522d('0x56')]){_0x50171f['include']=[{'all':!![]}];}return db[_0x522d('0x6c')]['findAll'](_0x50171f);})[_0x522d('0x37')](function(_0x12b9ad){_0xea6ad[_0x522d('0x53')]=_0x12b9ad;return _0xea6ad;});}})['then'](respondWithFilteredResult(_0x728fa9,_0x50171f))['catch'](handleError(_0x728fa9,null));};exports[_0x522d('0x6d')]=function(_0x2a83c3,_0x19498c,_0x1b0c08){return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x2a83c3[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x19498c,null))[_0x522d('0x37')](function(_0x3e6516){if(_0x3e6516){return _0x3e6516['removeAnswers'](_0x2a83c3[_0x522d('0x43')][_0x522d('0x6a')]);}})[_0x522d('0x37')](respondWithStatusCode(_0x19498c,null))[_0x522d('0x58')](handleError(_0x19498c,null));};exports[_0x522d('0x6e')]=function(_0x5419e7,_0x347ed0,_0xc33770){return db[_0x522d('0x3d')]['find']({'where':{'id':_0x5419e7[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x347ed0,null))['then'](function(_0x1270b4){if(_0x1270b4){return _0x1270b4[_0x522d('0x6e')](_0x5419e7[_0x522d('0x60')][_0x522d('0x6a')],_[_0x522d('0x6f')](_0x5419e7[_0x522d('0x60')],[_0x522d('0x6a'),'id'])||{})[_0x522d('0x70')](function(_0x34b11f){for(var _0x429d72=0x0;_0x429d72<_0x5419e7[_0x522d('0x60')][_0x522d('0x6a')][_0x522d('0x55')];_0x429d72+=0x1){socket[_0x522d('0x71')](_0x522d('0x72'),{'UserId':Number(_0x5419e7['body']['ids'][_0x429d72]),'WhatsappAccountId':Number(_0x5419e7[_0x522d('0x62')]['id'])});}return _0x34b11f;});}})[_0x522d('0x37')](respondWithResult(_0x347ed0,null))['catch'](handleError(_0x347ed0,null));};exports['removeAgents']=function(_0x1d1272,_0x390ba3,_0x1a2248){return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x1d1272[_0x522d('0x62')]['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x390ba3,null))[_0x522d('0x37')](function(_0x2971b9){if(_0x2971b9){return _0x2971b9['removeAgents'](_0x1d1272[_0x522d('0x43')][_0x522d('0x6a')])[_0x522d('0x37')](function(){if(_[_0x522d('0x73')](_0x1d1272[_0x522d('0x43')][_0x522d('0x6a')])){for(var _0x1fcb0d=0x0;_0x1fcb0d<_0x1d1272[_0x522d('0x43')][_0x522d('0x6a')]['length'];_0x1fcb0d+=0x1){socket[_0x522d('0x71')](_0x522d('0x74'),{'UserId':Number(_0x1d1272[_0x522d('0x43')]['ids'][_0x1fcb0d]),'WhatsappAccountId':Number(_0x1d1272[_0x522d('0x62')]['id'])});}}else{socket[_0x522d('0x71')](_0x522d('0x74'),{'UserId':Number(_0x1d1272['query'][_0x522d('0x6a')]),'WhatsappAccountId':Number(_0x1d1272[_0x522d('0x62')]['id'])});}});}})['then'](respondWithStatusCode(_0x390ba3,null))[_0x522d('0x58')](handleError(_0x390ba3,null));};exports[_0x522d('0x75')]=function(_0x5311e6,_0x2c3795,_0x33720d){var _0x52b62d={};var _0x55bbc9={};var _0x21cbc1;var _0x30fd9e;return db['WhatsappAccount'][_0x522d('0x66')]({'where':{'id':_0x5311e6['params']['id']}})[_0x522d('0x37')](handleEntityNotFound(_0x2c3795,null))[_0x522d('0x37')](function(_0x55a803){if(_0x55a803){_0x21cbc1=_0x55a803;_0x55bbc9[_0x522d('0x46')]=_[_0x522d('0x44')](db[_0x522d('0x76')][_0x522d('0x3e')]);_0x55bbc9[_0x522d('0x43')]=_[_0x522d('0x44')](_0x5311e6[_0x522d('0x43')]);_0x55bbc9[_0x522d('0x45')]=_[_0x522d('0x48')](_0x55bbc9['model'],_0x55bbc9[_0x522d('0x43')]);_0x52b62d[_0x522d('0x47')]=_['intersection'](_0x55bbc9[_0x522d('0x46')],qs[_0x522d('0x49')](_0x5311e6[_0x522d('0x43')]['fields']));_0x52b62d['attributes']=_0x52b62d[_0x522d('0x47')][_0x522d('0x55')]?_0x52b62d[_0x522d('0x47')]:_0x55bbc9[_0x522d('0x46')];_0x52b62d['order']=qs['sort'](_0x5311e6[_0x522d('0x43')]['sort']);_0x52b62d[_0x522d('0x4f')]=qs['filters'](_[_0x522d('0x67')](_0x5311e6[_0x522d('0x43')],_0x55bbc9[_0x522d('0x45')]));if(_0x5311e6[_0x522d('0x43')]['filter']){_0x52b62d['where']=_[_0x522d('0x50')](_0x52b62d[_0x522d('0x4f')],{'$or':_[_0x522d('0x42')](_0x52b62d['attributes'],function(_0x49808a){var _0x5e7b85={};_0x5e7b85[_0x49808a]={'$like':'%'+_0x5311e6[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x5e7b85;})});}_0x52b62d=_[_0x522d('0x50')]({},_0x52b62d,_0x5311e6[_0x522d('0x51')]);return _0x21cbc1['getAgents'](_0x52b62d);}})[_0x522d('0x37')](function(_0x18200b){if(_0x18200b){_0x30fd9e=_0x18200b[_0x522d('0x55')];if(!_0x5311e6['query'][_0x522d('0x4a')](_0x522d('0x4b'))){_0x52b62d['limit']=qs[_0x522d('0x2e')](_0x5311e6[_0x522d('0x43')][_0x522d('0x2e')]);_0x52b62d['offset']=qs['offset'](_0x5311e6['query'][_0x522d('0x2b')]);}return _0x21cbc1[_0x522d('0x75')](_0x52b62d);}})['then'](function(_0x241c83){if(_0x241c83){return _0x241c83?{'count':_0x30fd9e,'rows':_0x241c83}:null;}})['then'](respondWithResult(_0x2c3795,null))[_0x522d('0x58')](handleError(_0x2c3795,null));};exports[_0x522d('0x77')]=function(_0x546c27,_0xf78b19){var _0x535bd8=_0x546c27[_0x522d('0x62')]['id'];var _0x1d1be5=_0x546c27['body'];var _0x3e5001=0xc8;var _0x27bd1a=null;return db[_0x522d('0x78')]['transaction']({'isolationLevel':db['sequelize'][_0x522d('0x79')][_0x522d('0x7a')][_0x522d('0x7b')]},function(_0x2b2dc2){return db[_0x522d('0x3d')]['findOne']({'where':{'id':_0x535bd8},'transaction':_0x2b2dc2})['then'](function(_0x71242){if(_0x71242){return db[_0x522d('0x7c')][_0x522d('0x34')]({'where':{'WhatsappAccountId':_0x535bd8},'transaction':_0x2b2dc2})[_0x522d('0x37')](function(){var _0xcbf6cf=_[_0x522d('0x42')](_0x1d1be5,function(_0x3eb3d1){_0x3eb3d1['WhatsappAccountId']=_0x535bd8;return _0x3eb3d1;});return db['WhatsappApplication'][_0x522d('0x7d')](_0xcbf6cf,{'transaction':_0x2b2dc2});});}else{_0x3e5001=0x194;_0x27bd1a=[];}});})[_0x522d('0x37')](function(){if(_0x3e5001!==0x194){return db[_0x522d('0x7c')][_0x522d('0x7e')]({'where':{'WhatsappAccountId':_0x535bd8},'order':'priority'})[_0x522d('0x37')](function(_0x18d414){_0x27bd1a=_0x18d414;});}})['catch'](function(_0x5b5856){_0x3e5001=0x1f4;logger[_0x522d('0x23')](_0x5b5856[_0x522d('0x38')]);if(_0x5b5856[_0x522d('0x39')]){delete _0x5b5856[_0x522d('0x39')];}_0x27bd1a=_0x5b5856;})[_0x522d('0x7f')](function(){if(_0x27bd1a===null){_0xf78b19[_0x522d('0x27')](_0x3e5001);}else{if(_0x3e5001===0x1f4){_0xf78b19[_0x522d('0x28')](_0x3e5001)[_0x522d('0x3a')](_0x27bd1a);}else{_0xf78b19['status'](_0x3e5001)[_0x522d('0x2a')](_0x27bd1a);}}});};exports[_0x522d('0x80')]=function(_0x3200a4,_0x262bc6,_0x2c27bd){var _0x5f10b4={};var _0x16fa92={};var _0x31c089;var _0x5c015d;return db[_0x522d('0x3d')][_0x522d('0x66')]({'where':{'id':_0x3200a4[_0x522d('0x62')]['id']}})['then'](handleEntityNotFound(_0x262bc6,null))[_0x522d('0x37')](function(_0x2cb076){if(_0x2cb076){_0x31c089=_0x2cb076;_0x16fa92[_0x522d('0x46')]=_['keys'](db[_0x522d('0x7c')]['rawAttributes']);_0x16fa92['query']=_[_0x522d('0x44')](_0x3200a4[_0x522d('0x43')]);_0x16fa92[_0x522d('0x45')]=_['intersection'](_0x16fa92['model'],_0x16fa92[_0x522d('0x43')]);_0x5f10b4['attributes']=_['intersection'](_0x16fa92[_0x522d('0x46')],qs[_0x522d('0x49')](_0x3200a4['query'][_0x522d('0x49')]));_0x5f10b4[_0x522d('0x47')]=_0x5f10b4['attributes'][_0x522d('0x55')]?_0x5f10b4[_0x522d('0x47')]:_0x16fa92[_0x522d('0x46')];_0x5f10b4['order']=qs[_0x522d('0x4d')](_0x3200a4[_0x522d('0x43')][_0x522d('0x4d')]);_0x5f10b4[_0x522d('0x4f')]=qs[_0x522d('0x45')](_['pick'](_0x3200a4[_0x522d('0x43')],_0x16fa92[_0x522d('0x45')]));if(_0x3200a4[_0x522d('0x43')][_0x522d('0x4e')]){_0x5f10b4[_0x522d('0x4f')]=_[_0x522d('0x50')](_0x5f10b4[_0x522d('0x4f')],{'$or':_[_0x522d('0x42')](_0x5f10b4[_0x522d('0x47')],function(_0x147efc){var _0x4c0e6e={};_0x4c0e6e[_0x147efc]={'$like':'%'+_0x3200a4[_0x522d('0x43')][_0x522d('0x4e')]+'%'};return _0x4c0e6e;})});}_0x5f10b4=_[_0x522d('0x50')]({},_0x5f10b4,_0x3200a4[_0x522d('0x51')]);return _0x31c089[_0x522d('0x80')](_0x5f10b4);}})[_0x522d('0x37')](function(_0x21ee34){if(_0x21ee34){_0x5c015d=_0x21ee34[_0x522d('0x55')];if(!_0x3200a4[_0x522d('0x43')][_0x522d('0x4a')](_0x522d('0x4b'))){_0x5f10b4[_0x522d('0x2e')]=qs['limit'](_0x3200a4[_0x522d('0x43')][_0x522d('0x2e')]);_0x5f10b4['offset']=qs[_0x522d('0x2b')](_0x3200a4[_0x522d('0x43')][_0x522d('0x2b')]);}return _0x31c089[_0x522d('0x80')](_0x5f10b4);}})[_0x522d('0x37')](function(_0x3618a6){if(_0x3618a6){return _0x3618a6?{'count':_0x5c015d,'rows':_0x3618a6}:null;}})[_0x522d('0x37')](respondWithResult(_0x262bc6,null))[_0x522d('0x58')](handleError(_0x262bc6,null));};exports[_0x522d('0x81')]=function(_0x40d2f3,_0x563763,_0x360236){var _0x374471={'channel':_0x522d('0x82')};var _0xb099d5=[];var _0x22870c=[];var _0x43cc76={};return db[_0x522d('0x3d')][_0x522d('0x57')]({'where':{'id':_0x40d2f3[_0x522d('0x62')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x522d('0x83')}]})[_0x522d('0x37')](handleEntityNotFound(_0x563763,null))['then'](function(_0x1c3d3b){_0x374471['account']=_0x1c3d3b;if(_0x374471[_0x522d('0x84')]&&_0x374471['account'][_0x522d('0x40')]===_0x522d('0x85')&&_0x40d2f3['body'][_0x522d('0x86')]){if(_0x40d2f3[_0x522d('0x60')][_0x522d('0x86')]['length']===0x0)return;if(_0x40d2f3[_0x522d('0x60')][_0x522d('0x86')][0x0][_0x522d('0x87')]!==_0x522d('0x88'))return;return db[_0x522d('0x89')][_0x522d('0x33')]({'read':!![],'readAt':_0x40d2f3[_0x522d('0x60')][_0x522d('0x86')][0x0][_0x522d('0x8a')]},{'where':{'messageId':_0x40d2f3[_0x522d('0x60')][_0x522d('0x86')][0x0][_0x522d('0x8b')]},'individualHooks':!![]})[_0x522d('0x37')](function(_0x33a3ce){return _0x563763['status'](0xc8)['json'](_0x33a3ce);});}_0x374471[_0x522d('0x8c')]=_[_0x522d('0x8d')](_0x1c3d3b[_0x522d('0x83')],[_0x522d('0x8e')],[_0x522d('0x8f')]);if(_0x374471[_0x522d('0x84')][_0x522d('0x83')]){delete _0x374471[_0x522d('0x84')]['Applications'];}return db[_0x522d('0x90')]['describe']()[_0x522d('0x37')](function(_0x6816d9){if(!_0x6816d9){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))](_0x522d('0x93'));}_0xb099d5=_['difference'](_[_0x522d('0x44')](_0x6816d9),['createdAt',_0x522d('0x94')]);_0x22870c=_['difference'](_[_0x522d('0x44')](_0x6816d9),['createdAt',_0x522d('0x94'),_0x522d('0x95'),_0x522d('0x96')]);_0x374471[_0x522d('0x60')]={'mapKey':_0x522d('0x97')};if(_0x374471[_0x522d('0x84')]&&_0x374471[_0x522d('0x84')]['type']===_0x522d('0x98')){_0x374471['body'][_0x522d('0x99')]=_0x40d2f3['body']['From'][_0x522d('0x9a')](_0x522d('0x9b'),'');_0x374471[_0x522d('0x60')][_0x522d('0x60')]=_0x40d2f3[_0x522d('0x60')][_0x522d('0x9c')];_0x374471['body'][_0x522d('0x9d')]=_0x40d2f3[_0x522d('0x60')][_0x522d('0x9e')];}if(_0x374471[_0x522d('0x84')]&&_0x374471[_0x522d('0x84')][_0x522d('0x40')]===_0x522d('0x85')){_0x374471[_0x522d('0x60')][_0x522d('0x99')]=_0x40d2f3[_0x522d('0x60')][_0x522d('0x9f')][0x0][_0x522d('0x99')];_0x374471[_0x522d('0x60')][_0x522d('0x60')]=_0x40d2f3['body'][_0x522d('0x9f')][0x0]['message'][_0x522d('0x60')];_0x374471[_0x522d('0x60')][_0x522d('0x9d')]=_0x40d2f3[_0x522d('0x60')][_0x522d('0x9f')][0x0][_0x522d('0x8b')];}if(_0x374471[_0x522d('0x60')]['id']){delete _0x374471[_0x522d('0x60')]['id'];}if(_[_0x522d('0xa0')](_0x374471['body'][_0x522d('0x99')])){throw new db['Sequelize'][(_0x522d('0x92'))]('from\x20is\x20mandatory');}if(_[_0x522d('0xa0')](_0x374471['body'][_0x522d('0x60')])||_0x374471[_0x522d('0x60')][_0x522d('0x60')]===''){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))](_0x522d('0xa1'));}if(_[_0x522d('0xa0')](_0x374471['body'][_0x522d('0xa2')])){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22870c);}if(!_['includes'](_0x22870c,_0x374471[_0x522d('0x60')][_0x522d('0xa2')])){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))](_0x522d('0xa3')+_0x22870c);}_0x43cc76[_0x374471[_0x522d('0x60')]['mapKey']]=_0x374471[_0x522d('0x60')][_0x522d('0x99')];return db[_0x522d('0xa4')][_0x522d('0x57')]({'where':{'id':_0x374471[_0x522d('0x84')][_0x522d('0x96')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x43cc76,'limit':0x1,'order':[[_0x522d('0x94'),_0x522d('0xa5')]]}]});})[_0x522d('0x37')](handleEntityNotFound(_0x563763,null))['then'](function(_0x43330b){if(_0x43330b){_0x374471[_0x522d('0xa6')]=_['omit'](_0x43330b,[_0x522d('0xa7')]);if(_0x43330b[_0x522d('0xa7')][_0x522d('0x55')]){return _0x43330b[_0x522d('0xa7')][0x0];}var _0x37043b=_[_0x522d('0x17')](_0x374471['body'],{'firstName':_0x374471[_0x522d('0x60')]['from'],'ListId':_0x43330b['id']});_0x37043b[_0x374471[_0x522d('0x60')][_0x522d('0xa2')]]=_0x374471[_0x522d('0x60')][_0x522d('0x99')];return db['CmContact']['create'](_0x37043b,{'fields':_0xb099d5,'raw':!![]});}})['then'](handleEntityNotFound(_0x563763,null))['then'](function(_0x728715){if(_0x728715){_0x374471[_0x522d('0xa8')]=_0x728715;var _0x59b091={'ContactId':_0x728715['id'],'phone':_0x374471[_0x522d('0x60')][_0x522d('0x99')],'WhatsappAccountId':_0x40d2f3['params']['id']};var _0x214736={'ContactId':_0x728715['id'],'WhatsappAccountId':_0x40d2f3[_0x522d('0x62')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x522d('0x57')]({'where':_0x214736})['then'](function(_0x2b25ca){if(_0x2b25ca){return[_0x2b25ca,![]];}return db['WhatsappInteraction'][_0x522d('0x59')](_0x59b091)[_0x522d('0x37')](function(_0x20339e){return[_0x20339e,!![]];});});}})['spread'](function(_0x1dbdee,_0x21bc89){_0x374471[_0x522d('0xa9')]=_0x1dbdee[_0x522d('0x5a')]({'plain':!![]});_0x374471[_0x522d('0xa9')][_0x522d('0xaa')]=![];if(_0x21bc89){if(_0x374471[_0x522d('0x84')][_0x522d('0xab')]){_0x374471['applications'][_0x522d('0xac')]({'id':0x0,'priority':_0x374471[_0x522d('0x8c')][_0x522d('0x55')]+0x1,'app':_0x522d('0xad'),'appdata':_0x522d('0xae'),'interval':_0x522d('0xaf')});}_0x374471[_0x522d('0xa9')][_0x522d('0xaa')]=!![];}return db[_0x522d('0x89')][_0x522d('0x59')]({'phone':_0x374471[_0x522d('0x60')]['from'],'messageId':_0x374471[_0x522d('0x60')][_0x522d('0x9d')],'body':_0x374471[_0x522d('0x60')][_0x522d('0x60')],'WhatsappAccountId':_0x40d2f3['params']['id'],'WhatsappInteractionId':_0x1dbdee['id'],'direction':'in','ContactId':_0x1dbdee[_0x522d('0xb0')],'AttachmentId':_0x374471['body'][_0x522d('0xb1')]});})[_0x522d('0x37')](function(_0x5e3b7d){_0x374471['message']=_0x5e3b7d;if(!_0x374471[_0x522d('0xa9')]['UserId'])return;return db[_0x522d('0x76')][_0x522d('0x57')]({'attributes':['id',_0x522d('0x39')],'where':{'id':_0x374471['interaction']['UserId']}});})[_0x522d('0x37')](function(_0x58a72b){if(_0x58a72b){_0x374471[_0x522d('0x8c')][_0x522d('0xb2')]({'id':0x0,'priority':0x0,'app':_0x522d('0xb3'),'appdata':_0x58a72b['name']+','+(_0x374471[_0x522d('0x84')][_0x522d('0xb4')]||0xa),'interval':_0x522d('0xaf')});}if(!_0x374471[_0x522d('0xa9')][_0x522d('0xb5')])return;return db['WhatsappQueue']['find']({'attributes':['id',_0x522d('0x39')],'where':{'id':_0x374471[_0x522d('0xa9')][_0x522d('0xb5')]}});})['then'](function(_0x4a2698){if(_0x4a2698){_0x374471[_0x522d('0x8c')][_0x522d('0xb2')]({'id':0x0,'priority':0x1,'app':_0x522d('0xb6'),'appdata':_0x4a2698['name']+','+(_0x374471[_0x522d('0x84')][_0x522d('0xb7')]||0x12c),'interval':_0x522d('0xaf')});}return respondWithRpcPromise(_0x522d('0xb8'),'startRouting',_0x374471);})['then'](function(_0x3ace1a){if(_0x3ace1a){var _0x4dc787=0xc8;var _0x5bf9f6=_0x522d('0xb9');logger['info'](_0x522d('0x21'),_0x5bf9f6,_0x4dc787,_0x522d('0xba'));logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x5bf9f6,_0x4dc787,'entity\x20found',JSON[_0x522d('0x22')](_0x3ace1a));if(_0x374471['account'][_0x522d('0x40')]==='twilio'){return _0x563763[_0x522d('0x28')](_0x4dc787)[_0x522d('0x2f')](_0x522d('0xbb'),'text/xml')[_0x522d('0x3a')]('<?xml\x20version=\x221.0\x22\x20encoding=\x22UTF-8\x22?>\x0a<Response></Response>');}else{return _0x563763[_0x522d('0x28')](_0x4dc787)['json'](_0x3ace1a);}}});})[_0x522d('0x58')](handleError(_0x563763,null));};exports[_0x522d('0x3a')]=function(_0x3d87c8,_0x489b4f,_0x5168c3){var _0x560ac3,_0x388bdc,_0x1873e7;if(_['isNil'](_0x3d87c8[_0x522d('0x60')][_0x522d('0x60')])||_0x3d87c8[_0x522d('0x60')][_0x522d('0x60')]===''){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x522d('0xa0')](_0x3d87c8[_0x522d('0x60')]['to'])){throw new db[(_0x522d('0x91'))][(_0x522d('0x92'))](_0x522d('0xbc'));}_0x560ac3=_0x3d87c8[_0x522d('0x60')]['to'];return db['WhatsappAccount'][_0x522d('0x57')]({'where':{'id':_0x3d87c8[_0x522d('0x62')]['id']},'include':[{'model':db['CmList'],'as':_0x522d('0xbd'),'include':[{'model':db[_0x522d('0x90')],'as':_0x522d('0xa7'),'where':{'mobile':_0x560ac3},'limit':0x1,'order':[[_0x522d('0x94'),'DESC']]}]}]})[_0x522d('0x37')](handleEntityNotFound(_0x489b4f,null))['then'](function(_0x3d5955){if(_0x3d5955&&_0x3d5955[_0x522d('0xbd')]){_0x388bdc=_0x3d5955['get']({'plain':!![]});if(_0x388bdc[_0x522d('0xbd')]&&_0x388bdc[_0x522d('0xbd')][_0x522d('0xa7')][_0x522d('0x55')]){return _0x388bdc[_0x522d('0xbd')][_0x522d('0xa7')][0x0];}return db[_0x522d('0x90')][_0x522d('0x59')](_[_0x522d('0x17')](_0x3d87c8['body'],{'firstName':_0x560ac3,'mobile':_0x560ac3,'phone':_0x560ac3,'ListId':_0x388bdc[_0x522d('0x96')]}));}})[_0x522d('0x37')](handleEntityNotFound(_0x489b4f,null))['then'](function(_0x579e38){if(_0x579e38){_0x1873e7=_0x579e38;return db['WhatsappInteraction'][_0x522d('0x57')]({'where':{'ContactId':_0x1873e7['id'],'closed':![],'WhatsappAccountId':_0x388bdc['id']}})[_0x522d('0x37')](function(_0x42113e){if(_0x42113e){return[_0x42113e,![]];}return db[_0x522d('0xbe')][_0x522d('0x59')]({'UserId':_0x3d87c8[_0x522d('0x5c')]['id'],'ContactId':_0x1873e7['id'],'WhatsappAccountId':_0x388bdc['id'],'phone':_0x560ac3,'firstMsgDirection':_0x522d('0xbf'),'Messages':[_[_0x522d('0x50')](_0x3d87c8[_0x522d('0x60')],{'read':![],'body':_0x3d87c8[_0x522d('0x60')]['body'],'phone':_0x560ac3,'WhatsappAccountId':_0x388bdc['id'],'UserId':_0x3d87c8[_0x522d('0x5c')]['id'],'ContactId':_0x1873e7['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x522d('0xc0')}]})[_0x522d('0x37')](function(_0x4bd303){return[_0x4bd303,!![]];});});}})[_0x522d('0x70')](function(_0x47c740,_0x2ddc31){if(_0x2ddc31){return _0x47c740;}return db[_0x522d('0x89')][_0x522d('0x59')](_['merge'](_0x3d87c8['body'],{'read':![],'body':_0x3d87c8[_0x522d('0x60')][_0x522d('0x60')],'phone':_0x560ac3,'WhatsappAccountId':_0x388bdc['id'],'WhatsappInteractionId':_0x47c740['id'],'UserId':_0x3d87c8[_0x522d('0x5c')]['id'],'ContactId':_0x1873e7['id']}))['then'](function(_0x5302fd){_0x47c740[_0x522d('0xc1')]['Messages']=[];_0x47c740[_0x522d('0xc1')][_0x522d('0xc0')]['push'](_0x5302fd[_0x522d('0xc1')]);return _0x47c740;});})[_0x522d('0x37')](respondWithResult(_0x489b4f,null))[_0x522d('0x58')](handleError(_0x489b4f,null));};
\ No newline at end of file
index 9bd8afd..29fe64e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x46ac=['emit','hasOwnProperty','exports','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0x578ec0,_0x5a2900){var _0x5a303f=function(_0x5566a1){while(--_0x5566a1){_0x578ec0['push'](_0x578ec0['shift']());}};_0x5a303f(++_0x5a2900);}(_0x46ac,0xfb));var _0xc46a=function(_0x31a5f7,_0x1babed){_0x31a5f7=_0x31a5f7-0x0;var _0x4ff7d7=_0x46ac[_0x31a5f7];return _0x4ff7d7;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xc46a('0x0'))['db'][_0xc46a('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc46a('0x2'),'afterUpdate':_0xc46a('0x3'),'afterDestroy':_0xc46a('0x4')};function emitEvent(_0x840da0){return function(_0x1377af,_0x2006d5,_0x34d19e){WhatsappAccountEvents['emit'](_0x840da0+':'+_0x1377af['id'],_0x1377af);WhatsappAccountEvents[_0xc46a('0x5')](_0x840da0,_0x1377af);_0x34d19e(null);};}for(var e in events){if(events[_0xc46a('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xc46a('0x7')]=WhatsappAccountEvents;
\ No newline at end of file
+var _0x8848=['hook','events','../../mysqldb','WhatsappAccount','save','remove','emit'];(function(_0x29cb19,_0x547bf1){var _0x21d133=function(_0x4d5246){while(--_0x4d5246){_0x29cb19['push'](_0x29cb19['shift']());}};_0x21d133(++_0x547bf1);}(_0x8848,0x1eb));var _0x8884=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x8848[_0x2a67fe];return _0x57e726;};'use strict';var EventEmitter=require(_0x8884('0x0'));var WhatsappAccount=require(_0x8884('0x1'))['db'][_0x8884('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8884('0x3'),'afterUpdate':'update','afterDestroy':_0x8884('0x4')};function emitEvent(_0x31bcac){return function(_0x3a3410,_0x1fad3c,_0x5e40e6){WhatsappAccountEvents[_0x8884('0x5')](_0x31bcac+':'+_0x3a3410['id'],_0x3a3410);WhatsappAccountEvents[_0x8884('0x5')](_0x31bcac,_0x3a3410);_0x5e40e6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x8884('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents;
\ No newline at end of file
index 8b449ea..4c79437 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0d2b=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','lodash'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0d2b,0x86));var _0xb0d2=function(_0x4e58e3,_0x9c4995){_0x4e58e3=_0x4e58e3-0x0;var _0x11927a=_0x0d2b[_0x4e58e3];return _0x11927a;};'use strict';var _=require(_0xb0d2('0x0'));var util=require('util');var logger=require(_0xb0d2('0x1'))('api');var moment=require(_0xb0d2('0x2'));var BPromise=require('bluebird');var rp=require(_0xb0d2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0d2('0x4'));var config=require(_0xb0d2('0x5'));var attributes=require(_0xb0d2('0x6'));module[_0xb0d2('0x7')]=function(_0x479b54,_0xcc4d8d){return _0x479b54['define'](_0xb0d2('0x8'),attributes,{'tableName':'whatsapp_accounts','paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x6578=['bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','whatsapp_accounts','api'];(function(_0x30dea6,_0x45559f){var _0x1a70bd=function(_0x52a805){while(--_0x52a805){_0x30dea6['push'](_0x30dea6['shift']());}};_0x1a70bd(++_0x45559f);}(_0x6578,0x1e5));var _0x8657=function(_0x269b2e,_0x171faf){_0x269b2e=_0x269b2e-0x0;var _0x2b01af=_0x6578[_0x269b2e];return _0x2b01af;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8657('0x0'));var moment=require('moment');var BPromise=require(_0x8657('0x1'));var rp=require(_0x8657('0x2'));var fs=require('fs');var path=require(_0x8657('0x3'));var rimraf=require(_0x8657('0x4'));var config=require(_0x8657('0x5'));var attributes=require(_0x8657('0x6'));module[_0x8657('0x7')]=function(_0x2ac5ac,_0x1abd0a){return _0x2ac5ac['define']('WhatsappAccount',attributes,{'tableName':_0x8657('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 4aa66dd..c1792b5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x652d=['ShowWhatsappAccount','find','options','raw','attributes','include','map','model','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch'];(function(_0x31faf2,_0x39ecc0){var _0xd0b224=function(_0x46f732){while(--_0x46f732){_0x31faf2['push'](_0x31faf2['shift']());}};_0xd0b224(++_0x39ecc0);}(_0x652d,0x1a0));var _0xd652=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x652d[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0xd652('0x0'));var moment=require(_0xd652('0x1'));var BPromise=require(_0xd652('0x2'));var rs=require(_0xd652('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd652('0x4'))(_0xd652('0x5'));var config=require(_0xd652('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd652('0x7')][_0xd652('0x8')]({'port':0x232a});config[_0xd652('0x9')]=_[_0xd652('0xa')](config['redis'],{'host':_0xd652('0xb'),'port':0x18eb});var socket=require(_0xd652('0xc'))(new Redis(config[_0xd652('0x9')]));require(_0xd652('0xd'))[_0xd652('0xe')](socket);function respondWithRpcPromise(_0x1a6ca1,_0x586558,_0x5be8f4){return new BPromise(function(_0x1cda87,_0x2736d6){return client['request'](_0x1a6ca1,_0x5be8f4)[_0xd652('0xf')](function(_0x4e8f66){logger[_0xd652('0x10')](_0xd652('0x11'),_0x586558,'request\x20sent');logger[_0xd652('0x12')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x586558,_0xd652('0x13'),JSON[_0xd652('0x14')](_0x4e8f66));if(_0x4e8f66[_0xd652('0x15')]){if(_0x4e8f66['error'][_0xd652('0x16')]===0x1f4){logger[_0xd652('0x15')](_0xd652('0x11'),_0x586558,_0x4e8f66['error'][_0xd652('0x17')]);return _0x2736d6(_0x4e8f66['error'][_0xd652('0x17')]);}logger[_0xd652('0x15')](_0xd652('0x11'),_0x586558,_0x4e8f66[_0xd652('0x15')][_0xd652('0x17')]);return _0x1cda87(_0x4e8f66[_0xd652('0x15')]['message']);}else{logger[_0xd652('0x10')]('WhatsappAccount,\x20%s,\x20%s',_0x586558,'request\x20sent');_0x1cda87(_0x4e8f66[_0xd652('0x18')][_0xd652('0x17')]);}})[_0xd652('0x19')](function(_0x535eac){logger[_0xd652('0x15')](_0xd652('0x11'),_0x586558,_0x535eac);_0x2736d6(_0x535eac);});});}exports[_0xd652('0x1a')]=function(_0x2c7024){var _0x3394f7=this;return new Promise(function(_0x1950b4,_0x563ab9){return db['WhatsappAccount'][_0xd652('0x1b')]({'raw':_0x2c7024[_0xd652('0x1c')]?_0x2c7024[_0xd652('0x1c')][_0xd652('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c7024[_0xd652('0x1c')]?_0x2c7024[_0xd652('0x1c')]['where']||null:null,'attributes':_0x2c7024[_0xd652('0x1c')]?_0x2c7024[_0xd652('0x1c')][_0xd652('0x1e')]||null:null,'include':_0x2c7024[_0xd652('0x1c')]?_0x2c7024[_0xd652('0x1c')][_0xd652('0x1f')]?_[_0xd652('0x20')](_0x2c7024['options'][_0xd652('0x1f')],function(_0x246554){return{'model':db[_0x246554[_0xd652('0x21')]],'as':_0x246554['as'],'attributes':_0x246554[_0xd652('0x1e')],'include':_0x246554[_0xd652('0x1f')]?_['map'](_0x246554['include'],function(_0x4914b0){return{'model':db[_0x4914b0[_0xd652('0x21')]],'as':_0x4914b0['as'],'attributes':_0x4914b0[_0xd652('0x1e')],'include':_0x4914b0[_0xd652('0x1f')]?_[_0xd652('0x20')](_0x4914b0['include'],function(_0x5c4d9b){return{'model':db[_0x5c4d9b[_0xd652('0x21')]],'as':_0x5c4d9b['as'],'attributes':_0x5c4d9b[_0xd652('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd652('0xf')](function(_0x36c7a4){logger['info'](_0xd652('0x1a'),_0x2c7024);logger[_0xd652('0x12')](_0xd652('0x1a'),_0x2c7024,JSON['stringify'](_0x36c7a4));_0x1950b4(_0x36c7a4);})[_0xd652('0x19')](function(_0x450905){logger[_0xd652('0x15')](_0xd652('0x1a'),_0x450905['message'],_0x2c7024);_0x563ab9(_0x3394f7[_0xd652('0x15')](0x1f4,_0x450905['message']));});});};
\ No newline at end of file
+var _0x8d41=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','util','moment'];(function(_0x2f0f28,_0x37df9c){var _0x13b38e=function(_0x2602ae){while(--_0x2602ae){_0x2f0f28['push'](_0x2f0f28['shift']());}};_0x13b38e(++_0x37df9c);}(_0x8d41,0x1aa));var _0x18d4=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x8d41[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x18d4('0x0'));var util=require(_0x18d4('0x1'));var moment=require(_0x18d4('0x2'));var BPromise=require(_0x18d4('0x3'));var rs=require(_0x18d4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x18d4('0x5'))['db'];var utils=require(_0x18d4('0x6'));var logger=require(_0x18d4('0x7'))(_0x18d4('0x8'));var config=require(_0x18d4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x18d4('0xa')][_0x18d4('0xb')]({'port':0x232a});config[_0x18d4('0xc')]=_[_0x18d4('0xd')](config['redis'],{'host':_0x18d4('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x18d4('0xc')]));require(_0x18d4('0xf'))[_0x18d4('0x10')](socket);function respondWithRpcPromise(_0x188068,_0x27c70d,_0x174b6c){return new BPromise(function(_0x1f8814,_0x56e294){return client[_0x18d4('0x11')](_0x188068,_0x174b6c)[_0x18d4('0x12')](function(_0x1c4391){logger[_0x18d4('0x13')]('WhatsappAccount,\x20%s,\x20%s',_0x27c70d,_0x18d4('0x14'));logger[_0x18d4('0x15')](_0x18d4('0x16'),_0x27c70d,_0x18d4('0x14'),JSON[_0x18d4('0x17')](_0x1c4391));if(_0x1c4391[_0x18d4('0x18')]){if(_0x1c4391[_0x18d4('0x18')]['code']===0x1f4){logger[_0x18d4('0x18')](_0x18d4('0x19'),_0x27c70d,_0x1c4391[_0x18d4('0x18')][_0x18d4('0x1a')]);return _0x56e294(_0x1c4391[_0x18d4('0x18')][_0x18d4('0x1a')]);}logger[_0x18d4('0x18')](_0x18d4('0x19'),_0x27c70d,_0x1c4391[_0x18d4('0x18')]['message']);return _0x1f8814(_0x1c4391['error'][_0x18d4('0x1a')]);}else{logger['info'](_0x18d4('0x19'),_0x27c70d,_0x18d4('0x14'));_0x1f8814(_0x1c4391[_0x18d4('0x1b')][_0x18d4('0x1a')]);}})[_0x18d4('0x1c')](function(_0x3f8fae){logger[_0x18d4('0x18')](_0x18d4('0x19'),_0x27c70d,_0x3f8fae);_0x56e294(_0x3f8fae);});});}exports[_0x18d4('0x1d')]=function(_0x3e74ff){var _0x393d99=this;return new Promise(function(_0xb619d4,_0x4be1dc){return db[_0x18d4('0x1e')][_0x18d4('0x1f')]({'raw':_0x3e74ff['options']?_0x3e74ff[_0x18d4('0x20')][_0x18d4('0x21')]===undefined?!![]:![]:!![],'where':_0x3e74ff[_0x18d4('0x20')]?_0x3e74ff[_0x18d4('0x20')][_0x18d4('0x22')]||null:null,'attributes':_0x3e74ff[_0x18d4('0x20')]?_0x3e74ff[_0x18d4('0x20')][_0x18d4('0x23')]||null:null,'include':_0x3e74ff[_0x18d4('0x20')]?_0x3e74ff['options'][_0x18d4('0x24')]?_[_0x18d4('0x25')](_0x3e74ff[_0x18d4('0x20')][_0x18d4('0x24')],function(_0x2081f7){return{'model':db[_0x2081f7['model']],'as':_0x2081f7['as'],'attributes':_0x2081f7[_0x18d4('0x23')],'include':_0x2081f7[_0x18d4('0x24')]?_[_0x18d4('0x25')](_0x2081f7['include'],function(_0x587ee3){return{'model':db[_0x587ee3[_0x18d4('0x26')]],'as':_0x587ee3['as'],'attributes':_0x587ee3[_0x18d4('0x23')],'include':_0x587ee3['include']?_['map'](_0x587ee3[_0x18d4('0x24')],function(_0x50762b){return{'model':db[_0x50762b[_0x18d4('0x26')]],'as':_0x50762b['as'],'attributes':_0x50762b[_0x18d4('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ff33a){logger[_0x18d4('0x13')](_0x18d4('0x1d'),_0x3e74ff);logger['debug'](_0x18d4('0x1d'),_0x3e74ff,JSON[_0x18d4('0x17')](_0x1ff33a));_0xb619d4(_0x1ff33a);})['catch'](function(_0xc3f7d8){logger[_0x18d4('0x18')](_0x18d4('0x1d'),_0xc3f7d8['message'],_0x3e74ff);_0x4be1dc(_0x393d99[_0x18d4('0x18')](0x1f4,_0xc3f7d8[_0x18d4('0x1a')]));});});};
\ No newline at end of file
index a351fc9..b77ac0f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6893=['whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x3d73ba,_0x356e23){var _0x47e406=function(_0x90df31){while(--_0x90df31){_0x3d73ba['push'](_0x3d73ba['shift']());}};_0x47e406(++_0x356e23);}(_0x6893,0x1b1));var _0x3689=function(_0x799123,_0x4e7fbc){_0x799123=_0x799123-0x0;var _0x46d7bc=_0x6893[_0x799123];return _0x46d7bc;};'use strict';var WhatsappAccountEvents=require(_0x3689('0x0'));var events=[_0x3689('0x1'),_0x3689('0x2'),_0x3689('0x3')];function createListener(_0x4cee9c,_0x167a4f){return function(_0x59d368){_0x167a4f[_0x3689('0x4')](_0x4cee9c,_0x59d368);};}function removeListener(_0x56281c,_0x5dcbc3){return function(){WhatsappAccountEvents[_0x3689('0x5')](_0x56281c,_0x5dcbc3);};}exports[_0x3689('0x6')]=function(_0x104980){for(var _0x2948d8=0x0,_0x5eec82=events[_0x3689('0x7')];_0x2948d8<_0x5eec82;_0x2948d8++){var _0x47844d=events[_0x2948d8];var _0x5dd62a=createListener(_0x3689('0x8')+_0x47844d,_0x104980);WhatsappAccountEvents['on'](_0x47844d,_0x5dd62a);}};
\ No newline at end of file
+var _0x2ea3=['emit','removeListener','register','length','whatsappAccount:','./whatsappAccount.events','save','remove','update'];(function(_0x47b922,_0x2cd2c2){var _0x307b3c=function(_0x4846f6){while(--_0x4846f6){_0x47b922['push'](_0x47b922['shift']());}};_0x307b3c(++_0x2cd2c2);}(_0x2ea3,0x1d9));var _0x32ea=function(_0x11625f,_0x4e70b1){_0x11625f=_0x11625f-0x0;var _0x2ed309=_0x2ea3[_0x11625f];return _0x2ed309;};'use strict';var WhatsappAccountEvents=require(_0x32ea('0x0'));var events=[_0x32ea('0x1'),_0x32ea('0x2'),_0x32ea('0x3')];function createListener(_0x5d7600,_0x180dd7){return function(_0x10dbd1){_0x180dd7[_0x32ea('0x4')](_0x5d7600,_0x10dbd1);};}function removeListener(_0x206590,_0x4daf4e){return function(){WhatsappAccountEvents[_0x32ea('0x5')](_0x206590,_0x4daf4e);};}exports[_0x32ea('0x6')]=function(_0x5ef0ae){for(var _0x4d3ce6=0x0,_0x1ac971=events[_0x32ea('0x7')];_0x4d3ce6<_0x1ac971;_0x4d3ce6++){var _0x1e3dbd=events[_0x4d3ce6];var _0x182bb6=createListener(_0x32ea('0x8')+_0x1e3dbd,_0x5ef0ae);WhatsappAccountEvents['on'](_0x1e3dbd,_0x182bb6);}};
\ No newline at end of file
index 26a2680..41a8817 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d8b=['../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x373c99,_0x3b3b6d){var _0x1fca30=function(_0x42cf27){while(--_0x42cf27){_0x373c99['push'](_0x373c99['shift']());}};_0x1fca30(++_0x3b3b6d);}(_0x2d8b,0x1b2));var _0xb2d8=function(_0xdbb50a,_0x5c166b){_0xdbb50a=_0xdbb50a-0x0;var _0x2c8c95=_0x2d8b[_0xdbb50a];return _0x2c8c95;};'use strict';var multer=require(_0xb2d8('0x0'));var util=require(_0xb2d8('0x1'));var path=require('path');var timeout=require(_0xb2d8('0x2'));var express=require(_0xb2d8('0x3'));var router=express[_0xb2d8('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb2d8('0x5'));var config=require(_0xb2d8('0x6'));var controller=require(_0xb2d8('0x7'));router[_0xb2d8('0x8')]('/',auth[_0xb2d8('0x9')](),controller[_0xb2d8('0xa')]);router['get']('/:id',auth[_0xb2d8('0x9')](),controller[_0xb2d8('0xb')]);router[_0xb2d8('0xc')]('/',auth['isAuthenticated'](),controller[_0xb2d8('0xd')]);router[_0xb2d8('0xe')](_0xb2d8('0xf'),auth['isAuthenticated'](),controller[_0xb2d8('0x10')]);router[_0xb2d8('0x11')](_0xb2d8('0xf'),auth[_0xb2d8('0x9')](),controller[_0xb2d8('0x12')]);module[_0xb2d8('0x13')]=router;
\ No newline at end of file
+var _0x9780=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','show','post','create','put','delete'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9780,0xf1));var _0x0978=function(_0x32be62,_0x22e6fd){_0x32be62=_0x32be62-0x0;var _0x1a37e9=_0x9780[_0x32be62];return _0x1a37e9;};'use strict';var multer=require(_0x0978('0x0'));var util=require(_0x0978('0x1'));var path=require(_0x0978('0x2'));var timeout=require(_0x0978('0x3'));var express=require('express');var router=express[_0x0978('0x4')]();var fs_extra=require(_0x0978('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0978('0x6'));var controller=require('./whatsappApplication.controller');router['get']('/',auth[_0x0978('0x7')](),controller[_0x0978('0x8')]);router[_0x0978('0x9')]('/:id',auth[_0x0978('0x7')](),controller[_0x0978('0xa')]);router[_0x0978('0xb')]('/',auth[_0x0978('0x7')](),controller[_0x0978('0xc')]);router[_0x0978('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x0978('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x0978('0xf')]);module['exports']=router;
\ No newline at end of file
index 445d77b..e0f8625 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa26e=['noop','sequelize','exports','STRING'];(function(_0x34e752,_0x32e2a2){var _0x7c6347=function(_0x4db671){while(--_0x4db671){_0x34e752['push'](_0x34e752['shift']());}};_0x7c6347(++_0x32e2a2);}(_0xa26e,0x1d9));var _0xea26=function(_0x5171c7,_0x16e528){_0x5171c7=_0x5171c7-0x0;var _0x20e494=_0xa26e[_0x5171c7];return _0x20e494;};'use strict';var Sequelize=require(_0xea26('0x0'));module[_0xea26('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xea26('0x2')],'allowNull':![],'defaultValue':_0xea26('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xea26('0x2')]},'interval':{'type':Sequelize[_0xea26('0x2')],'defaultValue':'*,*,*,*'}};
\ No newline at end of file
+var _0xd157=['INTEGER','STRING','noop','*,*,*,*'];(function(_0x2714ec,_0x36daa4){var _0x2608e5=function(_0x408468){while(--_0x408468){_0x2714ec['push'](_0x2714ec['shift']());}};_0x2608e5(++_0x36daa4);}(_0xd157,0x188));var _0x7d15=function(_0x13b61b,_0x2c1d82){_0x13b61b=_0x13b61b-0x0;var _0x52b4ef=_0xd157[_0x13b61b];return _0x52b4ef;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7d15('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x7d15('0x1')],'allowNull':![],'defaultValue':_0x7d15('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7d15('0x1')]},'interval':{'type':Sequelize[_0x7d15('0x1')],'defaultValue':_0x7d15('0x3')}};
\ No newline at end of file
index d3f6218..942799a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbbdd=['pick','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','destroy','rimraf','fast-json-patch','request-promise','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','stack','name','send','index','map','WhatsappApplication','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x42f46e,_0x1c342d){var _0x213a0d=function(_0x2b5e11){while(--_0x2b5e11){_0x42f46e['push'](_0x42f46e['shift']());}};_0x213a0d(++_0x1c342d);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xbbdd[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdbbd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdbbd('0x1'));var rp=require(_0xdbbd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdbbd('0x3'));var path=require('path');var sox=require('sox');var csv=require(_0xdbbd('0x4'));var ejs=require(_0xdbbd('0x5'));var fs=require('fs');var fs_extra=require(_0xdbbd('0x6'));var _=require(_0xdbbd('0x7'));var squel=require('squel');var crypto=require(_0xdbbd('0x8'));var jsforce=require(_0xdbbd('0x9'));var deskjs=require(_0xdbbd('0xa'));var toCsv=require(_0xdbbd('0x4'));var querystring=require(_0xdbbd('0xb'));var Papa=require(_0xdbbd('0xc'));var Redis=require(_0xdbbd('0xd'));var authService=require(_0xdbbd('0xe'));var qs=require(_0xdbbd('0xf'));var as=require(_0xdbbd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdbbd('0x11'))(_0xdbbd('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x452ca8,_0xac66ed){_0xac66ed=_0xac66ed||0xcc;return function(_0x408ca9){if(_0x408ca9){return _0x452ca8[_0xdbbd('0x13')](_0xac66ed);}return _0x452ca8[_0xdbbd('0x14')](_0xac66ed)[_0xdbbd('0x15')]();};}function respondWithResult(_0x3f4907,_0x56e1b4){_0x56e1b4=_0x56e1b4||0xc8;return function(_0x2e231d){if(_0x2e231d){return _0x3f4907[_0xdbbd('0x14')](_0x56e1b4)['json'](_0x2e231d);}};}function respondWithFilteredResult(_0x38dc82,_0x1a64d9){return function(_0x2c76ad){if(_0x2c76ad){var _0x31a654=typeof _0x1a64d9['offset']===_0xdbbd('0x16')&&typeof _0x1a64d9[_0xdbbd('0x17')]==='undefined';var _0x87438c=_0x2c76ad[_0xdbbd('0x18')];var _0x26eb4c=_0x31a654?0x0:_0x1a64d9[_0xdbbd('0x19')];var _0x322ffc=_0x31a654?_0x2c76ad['count']:_0x1a64d9['offset']+_0x1a64d9['limit'];var _0x397210;if(_0x322ffc>=_0x87438c){_0x322ffc=_0x87438c;_0x397210=0xc8;}else{_0x397210=0xce;}_0x38dc82[_0xdbbd('0x14')](_0x397210);return _0x38dc82[_0xdbbd('0x1a')](_0xdbbd('0x1b'),_0x26eb4c+'-'+_0x322ffc+'/'+_0x87438c)[_0xdbbd('0x1c')](_0x2c76ad);}return null;};}function patchUpdates(_0x5bdddc){return function(_0x20c59b){try{jsonpatch[_0xdbbd('0x1d')](_0x20c59b,_0x5bdddc,!![]);}catch(_0x388209){return BPromise[_0xdbbd('0x1e')](_0x388209);}return _0x20c59b[_0xdbbd('0x1f')]();};}function saveUpdates(_0x3302ac,_0x492cb8){return function(_0x4a8899){if(_0x4a8899){return _0x4a8899[_0xdbbd('0x20')](_0x3302ac)['then'](function(_0x2ec3c2){return _0x2ec3c2;});}return null;};}function removeEntity(_0x1a6759,_0x14eccf){return function(_0x3d1c91){if(_0x3d1c91){return _0x3d1c91['destroy']()[_0xdbbd('0x21')](function(){_0x1a6759[_0xdbbd('0x14')](0xcc)[_0xdbbd('0x15')]();});}};}function handleEntityNotFound(_0x5f3f4d,_0x17d54d){return function(_0x74f84c){if(!_0x74f84c){_0x5f3f4d[_0xdbbd('0x13')](0x194);}return _0x74f84c;};}function handleError(_0x330c63,_0x31f535){_0x31f535=_0x31f535||0x1f4;return function(_0x423ce6){logger['error'](_0x423ce6[_0xdbbd('0x22')]);if(_0x423ce6[_0xdbbd('0x23')]){delete _0x423ce6[_0xdbbd('0x23')];}_0x330c63[_0xdbbd('0x14')](_0x31f535)[_0xdbbd('0x24')](_0x423ce6);};}exports[_0xdbbd('0x25')]=function(_0x22d6cc,_0x5f2a3f){var _0x2d287d={},_0x52e61f={},_0xb9383c={'count':0x0,'rows':[]};var _0x52f1c9=_[_0xdbbd('0x26')](db[_0xdbbd('0x27')]['rawAttributes'],function(_0x24da65){return{'name':_0x24da65[_0xdbbd('0x28')],'type':_0x24da65[_0xdbbd('0x29')][_0xdbbd('0x2a')]};});_0x52e61f[_0xdbbd('0x2b')]=_[_0xdbbd('0x26')](_0x52f1c9,_0xdbbd('0x23'));_0x52e61f[_0xdbbd('0x2c')]=_[_0xdbbd('0x2d')](_0x22d6cc[_0xdbbd('0x2c')]);_0x52e61f['filters']=_[_0xdbbd('0x2e')](_0x52e61f[_0xdbbd('0x2b')],_0x52e61f[_0xdbbd('0x2c')]);_0x2d287d[_0xdbbd('0x2f')]=_[_0xdbbd('0x2e')](_0x52e61f['model'],qs[_0xdbbd('0x30')](_0x22d6cc[_0xdbbd('0x2c')][_0xdbbd('0x30')]));_0x2d287d[_0xdbbd('0x2f')]=_0x2d287d[_0xdbbd('0x2f')]['length']?_0x2d287d[_0xdbbd('0x2f')]:_0x52e61f[_0xdbbd('0x2b')];if(!_0x22d6cc[_0xdbbd('0x2c')][_0xdbbd('0x31')](_0xdbbd('0x32'))){_0x2d287d['limit']=qs[_0xdbbd('0x17')](_0x22d6cc['query'][_0xdbbd('0x17')]);_0x2d287d[_0xdbbd('0x19')]=qs['offset'](_0x22d6cc[_0xdbbd('0x2c')][_0xdbbd('0x19')]);}_0x2d287d[_0xdbbd('0x33')]=qs[_0xdbbd('0x34')](_0x22d6cc['query']['sort']);_0x2d287d[_0xdbbd('0x35')]=qs[_0xdbbd('0x36')](_[_0xdbbd('0x37')](_0x22d6cc[_0xdbbd('0x2c')],_0x52e61f[_0xdbbd('0x36')]),_0x52f1c9);if(_0x22d6cc[_0xdbbd('0x2c')]['filter']){_0x2d287d['where']=_[_0xdbbd('0x38')](_0x2d287d[_0xdbbd('0x35')],{'$or':_['map'](_0x52f1c9,function(_0x3def0f){if(_0x3def0f[_0xdbbd('0x29')]!=='VIRTUAL'){var _0x2ecbb6={};_0x2ecbb6[_0x3def0f[_0xdbbd('0x23')]]={'$like':'%'+_0x22d6cc[_0xdbbd('0x2c')]['filter']+'%'};return _0x2ecbb6;}})});}_0x2d287d=_[_0xdbbd('0x38')]({},_0x2d287d,_0x22d6cc[_0xdbbd('0x39')]);var _0x53da26={'where':_0x2d287d['where']};return db[_0xdbbd('0x27')][_0xdbbd('0x18')](_0x53da26)[_0xdbbd('0x21')](function(_0x9ac24e){_0xb9383c[_0xdbbd('0x18')]=_0x9ac24e;if(_0x22d6cc[_0xdbbd('0x2c')][_0xdbbd('0x3a')]){_0x2d287d[_0xdbbd('0x3b')]=[{'all':!![]}];}return db[_0xdbbd('0x27')][_0xdbbd('0x3c')](_0x2d287d);})[_0xdbbd('0x21')](function(_0x1bf934){_0xb9383c[_0xdbbd('0x3d')]=_0x1bf934;return _0xb9383c;})[_0xdbbd('0x21')](respondWithFilteredResult(_0x5f2a3f,_0x2d287d))[_0xdbbd('0x3e')](handleError(_0x5f2a3f,null));};exports[_0xdbbd('0x3f')]=function(_0x37426d,_0x4c93e0){var _0x1da1e3={'raw':!![],'where':{'id':_0x37426d[_0xdbbd('0x40')]['id']}},_0x5df96c={};_0x5df96c['model']=_[_0xdbbd('0x2d')](db['WhatsappApplication'][_0xdbbd('0x41')]);_0x5df96c[_0xdbbd('0x2c')]=_['keys'](_0x37426d[_0xdbbd('0x2c')]);_0x5df96c[_0xdbbd('0x36')]=_[_0xdbbd('0x2e')](_0x5df96c['model'],_0x5df96c[_0xdbbd('0x2c')]);_0x1da1e3[_0xdbbd('0x2f')]=_[_0xdbbd('0x2e')](_0x5df96c['model'],qs['fields'](_0x37426d[_0xdbbd('0x2c')][_0xdbbd('0x30')]));_0x1da1e3[_0xdbbd('0x2f')]=_0x1da1e3[_0xdbbd('0x2f')][_0xdbbd('0x42')]?_0x1da1e3[_0xdbbd('0x2f')]:_0x5df96c['model'];if(_0x37426d[_0xdbbd('0x2c')][_0xdbbd('0x3a')]){_0x1da1e3[_0xdbbd('0x3b')]=[{'all':!![]}];}_0x1da1e3=_[_0xdbbd('0x38')]({},_0x1da1e3,_0x37426d['options']);return db[_0xdbbd('0x27')]['find'](_0x1da1e3)[_0xdbbd('0x21')](handleEntityNotFound(_0x4c93e0,null))[_0xdbbd('0x21')](respondWithResult(_0x4c93e0,null))['catch'](handleError(_0x4c93e0,null));};exports[_0xdbbd('0x43')]=function(_0x2cd645,_0xfb751b){return db[_0xdbbd('0x27')][_0xdbbd('0x43')](_0x2cd645['body'],{})[_0xdbbd('0x21')](respondWithResult(_0xfb751b,0xc9))[_0xdbbd('0x3e')](handleError(_0xfb751b,null));};exports[_0xdbbd('0x20')]=function(_0x54f75d,_0x23183e){if(_0x54f75d[_0xdbbd('0x44')]['id']){delete _0x54f75d[_0xdbbd('0x44')]['id'];}return db[_0xdbbd('0x27')][_0xdbbd('0x45')]({'where':{'id':_0x54f75d[_0xdbbd('0x40')]['id']}})[_0xdbbd('0x21')](handleEntityNotFound(_0x23183e,null))['then'](saveUpdates(_0x54f75d[_0xdbbd('0x44')],null))[_0xdbbd('0x21')](respondWithResult(_0x23183e,null))[_0xdbbd('0x3e')](handleError(_0x23183e,null));};exports[_0xdbbd('0x46')]=function(_0x52a0d2,_0x4d4792){return db[_0xdbbd('0x27')]['find']({'where':{'id':_0x52a0d2['params']['id']}})['then'](handleEntityNotFound(_0x4d4792,null))['then'](removeEntity(_0x4d4792,null))[_0xdbbd('0x3e')](handleError(_0x4d4792,null));};
\ No newline at end of file
+var _0x6ca3=['Content-Range','apply','save','update','then','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','WhatsappApplication','includeAll','findAll','rows','show','params','options','find','catch','create','body','destroy','zip-dir','fast-json-patch','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set'];(function(_0x788fa0,_0x644ff4){var _0x4f16c7=function(_0x20feb5){while(--_0x20feb5){_0x788fa0['push'](_0x788fa0['shift']());}};_0x4f16c7(++_0x644ff4);}(_0x6ca3,0xba));var _0x36ca=function(_0x34190e,_0x50ecc7){_0x34190e=_0x34190e-0x0;var _0x41a4e6=_0x6ca3[_0x34190e];return _0x41a4e6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x36ca('0x0'));var jsonpatch=require(_0x36ca('0x1'));var rp=require('request-promise');var moment=require(_0x36ca('0x2'));var BPromise=require(_0x36ca('0x3'));var Mustache=require('mustache');var util=require(_0x36ca('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x36ca('0x5'));var ejs=require(_0x36ca('0x6'));var fs=require('fs');var fs_extra=require(_0x36ca('0x7'));var _=require(_0x36ca('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36ca('0x9'));var deskjs=require(_0x36ca('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x36ca('0xb'));var Redis=require(_0x36ca('0xc'));var authService=require(_0x36ca('0xd'));var qs=require(_0x36ca('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x36ca('0xf'));var logger=require('../../config/logger')(_0x36ca('0x10'));var utils=require(_0x36ca('0x11'));var config=require(_0x36ca('0x12'));var licenseUtil=require(_0x36ca('0x13'));var db=require(_0x36ca('0x14'))['db'];function respondWithStatusCode(_0x58ec1a,_0x13d0f4){_0x13d0f4=_0x13d0f4||0xcc;return function(_0x3b0852){if(_0x3b0852){return _0x58ec1a[_0x36ca('0x15')](_0x13d0f4);}return _0x58ec1a['status'](_0x13d0f4)[_0x36ca('0x16')]();};}function respondWithResult(_0x21262a,_0x156111){_0x156111=_0x156111||0xc8;return function(_0x420122){if(_0x420122){return _0x21262a[_0x36ca('0x17')](_0x156111)[_0x36ca('0x18')](_0x420122);}};}function respondWithFilteredResult(_0x3184b3,_0x2b886e){return function(_0x104822){if(_0x104822){var _0x5395d8=typeof _0x2b886e[_0x36ca('0x19')]===_0x36ca('0x1a')&&typeof _0x2b886e[_0x36ca('0x1b')]===_0x36ca('0x1a');var _0x394353=_0x104822['count'];var _0x4d136c=_0x5395d8?0x0:_0x2b886e[_0x36ca('0x19')];var _0xd39461=_0x5395d8?_0x104822[_0x36ca('0x1c')]:_0x2b886e[_0x36ca('0x19')]+_0x2b886e[_0x36ca('0x1b')];var _0x5a7096;if(_0xd39461>=_0x394353){_0xd39461=_0x394353;_0x5a7096=0xc8;}else{_0x5a7096=0xce;}_0x3184b3[_0x36ca('0x17')](_0x5a7096);return _0x3184b3[_0x36ca('0x1d')](_0x36ca('0x1e'),_0x4d136c+'-'+_0xd39461+'/'+_0x394353)[_0x36ca('0x18')](_0x104822);}return null;};}function patchUpdates(_0x5ef372){return function(_0x2937cd){try{jsonpatch[_0x36ca('0x1f')](_0x2937cd,_0x5ef372,!![]);}catch(_0x1a50af){return BPromise['reject'](_0x1a50af);}return _0x2937cd[_0x36ca('0x20')]();};}function saveUpdates(_0x5889a7,_0x1b6134){return function(_0x1b1e87){if(_0x1b1e87){return _0x1b1e87[_0x36ca('0x21')](_0x5889a7)[_0x36ca('0x22')](function(_0x48d3ea){return _0x48d3ea;});}return null;};}function removeEntity(_0x538ce5,_0x136dd3){return function(_0x3507ab){if(_0x3507ab){return _0x3507ab['destroy']()[_0x36ca('0x22')](function(){_0x538ce5[_0x36ca('0x17')](0xcc)[_0x36ca('0x16')]();});}};}function handleEntityNotFound(_0x93430f,_0x137b2e){return function(_0x5d3f35){if(!_0x5d3f35){_0x93430f[_0x36ca('0x15')](0x194);}return _0x5d3f35;};}function handleError(_0x82732d,_0x13870b){_0x13870b=_0x13870b||0x1f4;return function(_0x4a792e){logger[_0x36ca('0x23')](_0x4a792e[_0x36ca('0x24')]);if(_0x4a792e[_0x36ca('0x25')]){delete _0x4a792e[_0x36ca('0x25')];}_0x82732d[_0x36ca('0x17')](_0x13870b)[_0x36ca('0x26')](_0x4a792e);};}exports[_0x36ca('0x27')]=function(_0x291293,_0x51c42b){var _0x2b54ef={},_0x46782f={},_0x2c415e={'count':0x0,'rows':[]};var _0x20f7ae=_[_0x36ca('0x28')](db['WhatsappApplication'][_0x36ca('0x29')],function(_0x2e4dae){return{'name':_0x2e4dae['fieldName'],'type':_0x2e4dae[_0x36ca('0x2a')][_0x36ca('0x2b')]};});_0x46782f[_0x36ca('0x2c')]=_[_0x36ca('0x28')](_0x20f7ae,_0x36ca('0x25'));_0x46782f[_0x36ca('0x2d')]=_[_0x36ca('0x2e')](_0x291293['query']);_0x46782f[_0x36ca('0x2f')]=_[_0x36ca('0x30')](_0x46782f[_0x36ca('0x2c')],_0x46782f[_0x36ca('0x2d')]);_0x2b54ef['attributes']=_['intersection'](_0x46782f['model'],qs[_0x36ca('0x31')](_0x291293[_0x36ca('0x2d')][_0x36ca('0x31')]));_0x2b54ef[_0x36ca('0x32')]=_0x2b54ef[_0x36ca('0x32')][_0x36ca('0x33')]?_0x2b54ef[_0x36ca('0x32')]:_0x46782f[_0x36ca('0x2c')];if(!_0x291293[_0x36ca('0x2d')][_0x36ca('0x34')]('nolimit')){_0x2b54ef[_0x36ca('0x1b')]=qs['limit'](_0x291293[_0x36ca('0x2d')][_0x36ca('0x1b')]);_0x2b54ef[_0x36ca('0x19')]=qs[_0x36ca('0x19')](_0x291293[_0x36ca('0x2d')][_0x36ca('0x19')]);}_0x2b54ef[_0x36ca('0x35')]=qs[_0x36ca('0x36')](_0x291293[_0x36ca('0x2d')]['sort']);_0x2b54ef[_0x36ca('0x37')]=qs['filters'](_[_0x36ca('0x38')](_0x291293[_0x36ca('0x2d')],_0x46782f['filters']),_0x20f7ae);if(_0x291293['query'][_0x36ca('0x39')]){_0x2b54ef['where']=_[_0x36ca('0x3a')](_0x2b54ef[_0x36ca('0x37')],{'$or':_[_0x36ca('0x28')](_0x20f7ae,function(_0x13fdd3){if(_0x13fdd3[_0x36ca('0x2a')]!==_0x36ca('0x3b')){var _0x1020b9={};_0x1020b9[_0x13fdd3[_0x36ca('0x25')]]={'$like':'%'+_0x291293['query'][_0x36ca('0x39')]+'%'};return _0x1020b9;}})});}_0x2b54ef=_[_0x36ca('0x3a')]({},_0x2b54ef,_0x291293['options']);var _0x2b6f4b={'where':_0x2b54ef[_0x36ca('0x37')]};return db[_0x36ca('0x3c')][_0x36ca('0x1c')](_0x2b6f4b)['then'](function(_0x2c3347){_0x2c415e[_0x36ca('0x1c')]=_0x2c3347;if(_0x291293['query'][_0x36ca('0x3d')]){_0x2b54ef['include']=[{'all':!![]}];}return db[_0x36ca('0x3c')][_0x36ca('0x3e')](_0x2b54ef);})[_0x36ca('0x22')](function(_0x2b6198){_0x2c415e[_0x36ca('0x3f')]=_0x2b6198;return _0x2c415e;})[_0x36ca('0x22')](respondWithFilteredResult(_0x51c42b,_0x2b54ef))['catch'](handleError(_0x51c42b,null));};exports[_0x36ca('0x40')]=function(_0x107291,_0x3680cc){var _0x2f6c59={'raw':!![],'where':{'id':_0x107291[_0x36ca('0x41')]['id']}},_0x2df096={};_0x2df096['model']=_[_0x36ca('0x2e')](db[_0x36ca('0x3c')][_0x36ca('0x29')]);_0x2df096[_0x36ca('0x2d')]=_[_0x36ca('0x2e')](_0x107291[_0x36ca('0x2d')]);_0x2df096['filters']=_[_0x36ca('0x30')](_0x2df096[_0x36ca('0x2c')],_0x2df096['query']);_0x2f6c59[_0x36ca('0x32')]=_['intersection'](_0x2df096[_0x36ca('0x2c')],qs['fields'](_0x107291[_0x36ca('0x2d')][_0x36ca('0x31')]));_0x2f6c59[_0x36ca('0x32')]=_0x2f6c59[_0x36ca('0x32')]['length']?_0x2f6c59[_0x36ca('0x32')]:_0x2df096[_0x36ca('0x2c')];if(_0x107291['query'][_0x36ca('0x3d')]){_0x2f6c59['include']=[{'all':!![]}];}_0x2f6c59=_['merge']({},_0x2f6c59,_0x107291[_0x36ca('0x42')]);return db[_0x36ca('0x3c')][_0x36ca('0x43')](_0x2f6c59)[_0x36ca('0x22')](handleEntityNotFound(_0x3680cc,null))['then'](respondWithResult(_0x3680cc,null))[_0x36ca('0x44')](handleError(_0x3680cc,null));};exports[_0x36ca('0x45')]=function(_0x4f322d,_0x20a6ce){return db[_0x36ca('0x3c')][_0x36ca('0x45')](_0x4f322d[_0x36ca('0x46')],{})['then'](respondWithResult(_0x20a6ce,0xc9))[_0x36ca('0x44')](handleError(_0x20a6ce,null));};exports[_0x36ca('0x21')]=function(_0x46bb01,_0x3f0514){if(_0x46bb01[_0x36ca('0x46')]['id']){delete _0x46bb01[_0x36ca('0x46')]['id'];}return db[_0x36ca('0x3c')][_0x36ca('0x43')]({'where':{'id':_0x46bb01[_0x36ca('0x41')]['id']}})[_0x36ca('0x22')](handleEntityNotFound(_0x3f0514,null))[_0x36ca('0x22')](saveUpdates(_0x46bb01[_0x36ca('0x46')],null))[_0x36ca('0x22')](respondWithResult(_0x3f0514,null))[_0x36ca('0x44')](handleError(_0x3f0514,null));};exports[_0x36ca('0x47')]=function(_0x2bcb2e,_0x17ef72){return db[_0x36ca('0x3c')]['find']({'where':{'id':_0x2bcb2e[_0x36ca('0x41')]['id']}})['then'](handleEntityNotFound(_0x17ef72,null))['then'](removeEntity(_0x17ef72,null))[_0x36ca('0x44')](handleError(_0x17ef72,null));};
\ No newline at end of file
index 8d59934..b05fee4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x27c5=['api','moment','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4_unicode_ci','../../config/logger'];(function(_0x5b5a63,_0x2b8159){var _0x337edf=function(_0x381927){while(--_0x381927){_0x5b5a63['push'](_0x5b5a63['shift']());}};_0x337edf(++_0x2b8159);}(_0x27c5,0x173));var _0x527c=function(_0x509b2a,_0xf91802){_0x509b2a=_0x509b2a-0x0;var _0x59ff9e=_0x27c5[_0x509b2a];return _0x59ff9e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x527c('0x0'))(_0x527c('0x1'));var moment=require(_0x527c('0x2'));var BPromise=require('bluebird');var rp=require(_0x527c('0x3'));var fs=require('fs');var path=require(_0x527c('0x4'));var rimraf=require(_0x527c('0x5'));var config=require(_0x527c('0x6'));var attributes=require(_0x527c('0x7'));module[_0x527c('0x8')]=function(_0x37bd95,_0x552d9b){return _0x37bd95[_0x527c('0x9')]('WhatsappApplication',attributes,{'tableName':_0x527c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x527c('0xb')});};
\ No newline at end of file
+var _0x7250=['utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./whatsappApplication.attributes','WhatsappApplication','whatsapp_applications'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7250,0x1b1));var _0x0725=function(_0x536b5a,_0x4c714a){_0x536b5a=_0x536b5a-0x0;var _0x5040ed=_0x7250[_0x536b5a];return _0x5040ed;};'use strict';var _=require(_0x0725('0x0'));var util=require(_0x0725('0x1'));var logger=require('../../config/logger')(_0x0725('0x2'));var moment=require(_0x0725('0x3'));var BPromise=require(_0x0725('0x4'));var rp=require(_0x0725('0x5'));var fs=require('fs');var path=require(_0x0725('0x6'));var rimraf=require(_0x0725('0x7'));var config=require('../../config/environment');var attributes=require(_0x0725('0x8'));module['exports']=function(_0x4e8c6c,_0xa32c3f){return _0x4e8c6c['define'](_0x0725('0x9'),attributes,{'tableName':_0x0725('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0725('0xb')});};
\ No newline at end of file
index 532b145..e7734de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe5b3=['request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','WhatsappApplication,\x20%s,\x20%s'];(function(_0x4de1c3,_0xbe77b9){var _0x26acfe=function(_0x2c9df4){while(--_0x2c9df4){_0x4de1c3['push'](_0x4de1c3['shift']());}};_0x26acfe(++_0xbe77b9);}(_0xe5b3,0x133));var _0x3e5b=function(_0x554129,_0x2c3d20){_0x554129=_0x554129-0x0;var _0x4de573=_0xe5b3[_0x554129];return _0x4de573;};'use strict';var _=require('lodash');var util=require(_0x3e5b('0x0'));var moment=require(_0x3e5b('0x1'));var BPromise=require(_0x3e5b('0x2'));var rs=require(_0x3e5b('0x3'));var fs=require('fs');var Redis=require(_0x3e5b('0x4'));var db=require(_0x3e5b('0x5'))['db'];var utils=require(_0x3e5b('0x6'));var logger=require(_0x3e5b('0x7'))(_0x3e5b('0x8'));var config=require(_0x3e5b('0x9'));var jayson=require(_0x3e5b('0xa'));var client=jayson['client'][_0x3e5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5dcf55,_0x534e7d,_0x41d46f){return new BPromise(function(_0x3901c2,_0x3c7c2e){return client[_0x3e5b('0xc')](_0x5dcf55,_0x41d46f)['then'](function(_0x4ed6bc){logger[_0x3e5b('0xd')](_0x3e5b('0xe'),_0x534e7d,_0x3e5b('0xf'));logger[_0x3e5b('0x10')](_0x3e5b('0x11'),_0x534e7d,'request\x20sent',JSON[_0x3e5b('0x12')](_0x4ed6bc));if(_0x4ed6bc['error']){if(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x14')]===0x1f4){logger[_0x3e5b('0x13')](_0x3e5b('0xe'),_0x534e7d,_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);return _0x3c7c2e(_0x4ed6bc[_0x3e5b('0x13')]['message']);}logger[_0x3e5b('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x4ed6bc['error']['message']);return _0x3901c2(_0x4ed6bc[_0x3e5b('0x13')][_0x3e5b('0x15')]);}else{logger[_0x3e5b('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x534e7d,_0x3e5b('0xf'));_0x3901c2(_0x4ed6bc['result']['message']);}})[_0x3e5b('0x16')](function(_0x11b41b){logger['error'](_0x3e5b('0xe'),_0x534e7d,_0x11b41b);_0x3c7c2e(_0x11b41b);});});}
\ No newline at end of file
+var _0x17ba=['code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x482f97,_0xf56b1d){var _0x17b823=function(_0x4629fa){while(--_0x4629fa){_0x482f97['push'](_0x482f97['shift']());}};_0x17b823(++_0xf56b1d);}(_0x17ba,0xab));var _0xa17b=function(_0x29dd3d,_0x3bad82){_0x29dd3d=_0x29dd3d-0x0;var _0xe2483c=_0x17ba[_0x29dd3d];return _0xe2483c;};'use strict';var _=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var moment=require('moment');var BPromise=require(_0xa17b('0x2'));var rs=require(_0xa17b('0x3'));var fs=require('fs');var Redis=require(_0xa17b('0x4'));var db=require(_0xa17b('0x5'))['db'];var utils=require(_0xa17b('0x6'));var logger=require(_0xa17b('0x7'))(_0xa17b('0x8'));var config=require(_0xa17b('0x9'));var jayson=require(_0xa17b('0xa'));var client=jayson[_0xa17b('0xb')][_0xa17b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e3d43,_0x1957be,_0x57f9cd){return new BPromise(function(_0x2ca4d3,_0x17d1d2){return client[_0xa17b('0xd')](_0x2e3d43,_0x57f9cd)[_0xa17b('0xe')](function(_0x15bdfc){logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));logger[_0xa17b('0x11')](_0xa17b('0x12'),_0x1957be,_0xa17b('0x10'),JSON[_0xa17b('0x13')](_0x15bdfc));if(_0x15bdfc[_0xa17b('0x14')]){if(_0x15bdfc['error'][_0xa17b('0x15')]===0x1f4){logger[_0xa17b('0x14')](_0xa17b('0xf'),_0x1957be,_0x15bdfc['error'][_0xa17b('0x16')]);return _0x17d1d2(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}logger[_0xa17b('0x14')]('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x15bdfc[_0xa17b('0x14')]['message']);return _0x2ca4d3(_0x15bdfc[_0xa17b('0x14')][_0xa17b('0x16')]);}else{logger['info'](_0xa17b('0xf'),_0x1957be,_0xa17b('0x10'));_0x2ca4d3(_0x15bdfc[_0xa17b('0x17')][_0xa17b('0x16')]);}})['catch'](function(_0x98a295){logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x1957be,_0x98a295);_0x17d1d2(_0x98a295);});});}
\ No newline at end of file
index dbf2d85..f303e2b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3c6c=['get','index','/:id','isAuthenticated','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1de66f,_0x2c853e){var _0x4733d1=function(_0x3556ea){while(--_0x3556ea){_0x1de66f['push'](_0x1de66f['shift']());}};_0x4733d1(++_0x2c853e);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x190215,_0xeff28e){_0x190215=_0x190215-0x0;var _0x27f4a3=_0x3c6c[_0x190215];return _0x27f4a3;};'use strict';var multer=require(_0xc3c6('0x0'));var util=require('util');var path=require(_0xc3c6('0x1'));var timeout=require(_0xc3c6('0x2'));var express=require(_0xc3c6('0x3'));var router=express[_0xc3c6('0x4')]();var fs_extra=require(_0xc3c6('0x5'));var auth=require(_0xc3c6('0x6'));var interaction=require(_0xc3c6('0x7'));var config=require(_0xc3c6('0x8'));var controller=require('./whatsappInteraction.controller');router[_0xc3c6('0x9')]('/',auth['isAuthenticated'](),controller[_0xc3c6('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),controller['show']);router[_0xc3c6('0x9')](_0xc3c6('0xd'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0xe')]);router['get'](_0xc3c6('0xf'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc3c6('0x11')]);router[_0xc3c6('0x12')](_0xc3c6('0xd'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0x13')]);router[_0xc3c6('0x12')](_0xc3c6('0x14'),auth[_0xc3c6('0xc')](),interaction[_0xc3c6('0x15')](_0xc3c6('0x16'),_0xc3c6('0x17')),controller[_0xc3c6('0x18')]);router[_0xc3c6('0x19')](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),interaction[_0xc3c6('0x15')](_0xc3c6('0x16'),_0xc3c6('0x1a')),controller[_0xc3c6('0x1b')]);router[_0xc3c6('0x1c')](_0xc3c6('0xb'),auth[_0xc3c6('0xc')](),interaction[_0xc3c6('0x15')](_0xc3c6('0x16'),_0xc3c6('0x1d')),controller[_0xc3c6('0x1e')]);router['delete'](_0xc3c6('0x14'),auth[_0xc3c6('0xc')](),controller[_0xc3c6('0x1f')]);module[_0xc3c6('0x20')]=router;
\ No newline at end of file
+var _0xafdd=['download','post','addMessage','whatsappinteraction:addtags','addTags','put','whatsapp','whatsappinteraction:update','update','whatsappinteraction:destroy','delete','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xafdd,0x19a));var _0xdafd=function(_0x5e43d3,_0x4ac566){_0x5e43d3=_0x5e43d3-0x0;var _0x374f2e=_0xafdd[_0x5e43d3];return _0x374f2e;};'use strict';var multer=require(_0xdafd('0x0'));var util=require(_0xdafd('0x1'));var path=require(_0xdafd('0x2'));var timeout=require(_0xdafd('0x3'));var express=require(_0xdafd('0x4'));var router=express[_0xdafd('0x5')]();var fs_extra=require(_0xdafd('0x6'));var auth=require(_0xdafd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xdafd('0x8'));var controller=require(_0xdafd('0x9'));router[_0xdafd('0xa')]('/',auth[_0xdafd('0xb')](),controller[_0xdafd('0xc')]);router[_0xdafd('0xa')](_0xdafd('0xd'),auth['isAuthenticated'](),controller[_0xdafd('0xe')]);router[_0xdafd('0xa')](_0xdafd('0xf'),auth['isAuthenticated'](),controller[_0xdafd('0x10')]);router[_0xdafd('0xa')](_0xdafd('0x11'),auth[_0xdafd('0xb')](),controller['getMessages']);router[_0xdafd('0xa')](_0xdafd('0x12'),auth[_0xdafd('0xb')](),controller[_0xdafd('0x13')]);router[_0xdafd('0x14')]('/',auth[_0xdafd('0xb')](),controller['create']);router[_0xdafd('0x14')]('/:id/messages',auth['isAuthenticated'](),controller[_0xdafd('0x15')]);router[_0xdafd('0x14')]('/:id/tags',auth[_0xdafd('0xb')](),interaction['tracked']('whatsapp',_0xdafd('0x16')),controller[_0xdafd('0x17')]);router[_0xdafd('0x18')](_0xdafd('0xf'),auth[_0xdafd('0xb')](),interaction['tracked'](_0xdafd('0x19'),_0xdafd('0x1a')),controller[_0xdafd('0x1b')]);router['delete'](_0xdafd('0xf'),auth[_0xdafd('0xb')](),interaction['tracked']('whatsapp',_0xdafd('0x1c')),controller['destroy']);router[_0xdafd('0x1d')](_0xdafd('0x1e'),auth[_0xdafd('0xb')](),controller[_0xdafd('0x1f')]);module[_0xdafd('0x20')]=router;
\ No newline at end of file
index c997d56..5831605 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d4b=['moment','exports','DATE','STRING','ENUM','out','INTEGER','sequelize'];(function(_0x5a6cef,_0x1697df){var _0x37f76f=function(_0x17dc71){while(--_0x17dc71){_0x5a6cef['push'](_0x5a6cef['shift']());}};_0x37f76f(++_0x1697df);}(_0x6d4b,0xbf));var _0xb6d4=function(_0x49b7ab,_0x461e0a){_0x49b7ab=_0x49b7ab-0x0;var _0x307d61=_0x6d4b[_0x49b7ab];return _0x307d61;};'use strict';var Sequelize=require(_0xb6d4('0x0'));var moment=require(_0xb6d4('0x1'));module[_0xb6d4('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb6d4('0x3')]},'disposition':{'type':Sequelize[_0xb6d4('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xb6d4('0x4')]},'phone':{'type':Sequelize[_0xb6d4('0x4')]},'read1stAt':{'type':Sequelize[_0xb6d4('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xb6d4('0x5')]('in',_0xb6d4('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb6d4('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb6d4('0x5')]('in',_0xb6d4('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xb6d4('0x7')]}};
\ No newline at end of file
+var _0xd1ca=['STRING','out','DATE','ENUM','BOOLEAN','sequelize','moment'];(function(_0x3a909c,_0x4ca5c8){var _0x23e38f=function(_0x19abf2){while(--_0x19abf2){_0x3a909c['push'](_0x3a909c['shift']());}};_0x23e38f(++_0x4ca5c8);}(_0xd1ca,0x140));var _0xad1c=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xd1ca[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0xad1c('0x0'));var moment=require(_0xad1c('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xad1c('0x2')]},'secondDisposition':{'type':Sequelize[_0xad1c('0x2')]},'thirdDisposition':{'type':Sequelize[_0xad1c('0x2')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xad1c('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xad1c('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xad1c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xad1c('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xad1c('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}};
\ No newline at end of file
index 559b9ce..ff5ead9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab29=['includeAll','include','rows','addTags','spread','findAll','whatsappInteractionTags:save','removeTags','download','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','CmContact','firstName','lastName','Attachment','createdAt','direction','secret','read','Account','User','Owner','fullname','get','Whatsapp','N.A.','closedAt','Messages','basename','existsSync','createReadStream','pipe','out','System','Contact','renderFile','views','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','json','undefined','offset','count','status','set','Content-Range','update','then','destroy','end','error','name','index','rawAttributes','fieldName','key','getOptions','whatsapp','user','show','params','keys','query','filters','intersection','attributes','model','fields','merge','options','WhatsappInteraction','catch','body','find','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','limit','order','sort','where','pick','WhatsappInteractionId','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1f7673,_0x15ebc3){var _0x4d47bf=function(_0x266745){while(--_0x266745){_0x1f7673['push'](_0x1f7673['shift']());}};_0x4d47bf(++_0x15ebc3);}(_0xab29,0x11f));var _0x9ab2=function(_0x2b0bf9,_0x3abf8a){_0x2b0bf9=_0x2b0bf9-0x0;var _0x1b72f8=_0xab29[_0x2b0bf9];return _0x1b72f8;};'use strict';var rimraf=require(_0x9ab2('0x0'));var zipdir=require(_0x9ab2('0x1'));var moment=require(_0x9ab2('0x2'));var BPromise=require(_0x9ab2('0x3'));var util=require('util');var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9ab2('0x4'));var Redis=require(_0x9ab2('0x5'));var interaction=require(_0x9ab2('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x9ab2('0x7'));var logger=require(_0x9ab2('0x8'))('api');var config=require(_0x9ab2('0x9'));var db=require('../../mysqldb')['db'];config[_0x9ab2('0xa')]=_[_0x9ab2('0xb')](config[_0x9ab2('0xa')],{'host':_0x9ab2('0xc'),'port':0x18eb});var socket=require(_0x9ab2('0xd'))(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x9ab2('0xe')](socket);function respondWithStatusCode(_0x2306eb,_0x7fb25a){_0x7fb25a=_0x7fb25a||0xcc;return function(_0xa2818e){if(_0xa2818e){return _0x2306eb[_0x9ab2('0xf')](_0x7fb25a);}return _0x2306eb['status'](_0x7fb25a)['end']();};}function respondWithResult(_0x5bf360,_0x5c59e1){_0x5c59e1=_0x5c59e1||0xc8;return function(_0x2349c3){if(_0x2349c3){return _0x5bf360['status'](_0x5c59e1)[_0x9ab2('0x10')](_0x2349c3);}};}function respondWithFilteredResult(_0x3d86af,_0x2dd085){return function(_0x5e06a5){if(_0x5e06a5){var _0x429842=typeof _0x2dd085['offset']===_0x9ab2('0x11')&&typeof _0x2dd085['limit']===_0x9ab2('0x11');var _0x2d183d=_0x5e06a5['count'];var _0x4b130c=_0x429842?0x0:_0x2dd085[_0x9ab2('0x12')];var _0x2f9819=_0x429842?_0x5e06a5[_0x9ab2('0x13')]:_0x2dd085[_0x9ab2('0x12')]+_0x2dd085['limit'];var _0x32cb73;if(_0x2f9819>=_0x2d183d){_0x2f9819=_0x2d183d;_0x32cb73=0xc8;}else{_0x32cb73=0xce;}_0x3d86af[_0x9ab2('0x14')](_0x32cb73);return _0x3d86af[_0x9ab2('0x15')](_0x9ab2('0x16'),_0x4b130c+'-'+_0x2f9819+'/'+_0x2d183d)[_0x9ab2('0x10')](_0x5e06a5);}return null;};}function saveUpdates(_0x15477d){return function(_0x58bd5d){if(_0x58bd5d){return _0x58bd5d[_0x9ab2('0x17')](_0x15477d)[_0x9ab2('0x18')](function(_0x10941a){return _0x10941a;});}return null;};}function removeEntity(_0x9733a3){return function(_0x414104){if(_0x414104){return _0x414104[_0x9ab2('0x19')]()[_0x9ab2('0x18')](function(){_0x9733a3[_0x9ab2('0x14')](0xcc)[_0x9ab2('0x1a')]();});}};}function handleEntityNotFound(_0x5c8ecf){return function(_0x13833d){if(!_0x13833d){_0x5c8ecf[_0x9ab2('0xf')](0x194);}return _0x13833d;};}function handleError(_0x3eb91a,_0x59cbb0){_0x59cbb0=_0x59cbb0||0x1f4;return function(_0x39e9ae){logger[_0x9ab2('0x1b')](_0x39e9ae['stack']);if(_0x39e9ae[_0x9ab2('0x1c')]){delete _0x39e9ae[_0x9ab2('0x1c')];}_0x3eb91a['status'](_0x59cbb0)['send'](_0x39e9ae);};}exports[_0x9ab2('0x1d')]=function(_0xc03825,_0x43e6dc){var _0x1b7721={};var _0x31ff47=_['map'](db['WhatsappInteraction'][_0x9ab2('0x1e')],function(_0x20e443){return{'name':_0x20e443[_0x9ab2('0x1f')],'type':_0x20e443['type'][_0x9ab2('0x20')]};});_0x1b7721=qs[_0x9ab2('0x21')](_0x31ff47,_0xc03825);return interaction['findAll'](_0x9ab2('0x22'),_0xc03825['query'],_0xc03825[_0x9ab2('0x23')],_0x1b7721,_0x31ff47)[_0x9ab2('0x18')](respondWithFilteredResult(_0x43e6dc,_0x1b7721))['catch'](handleError(_0x43e6dc,null));};exports[_0x9ab2('0x24')]=function(_0x13117c,_0x45ad1c){var _0x23c2ee={'raw':![],'where':{'id':_0x13117c[_0x9ab2('0x25')]['id']}},_0x5dbc8c={};_0x5dbc8c['model']=_[_0x9ab2('0x26')](db['WhatsappInteraction'][_0x9ab2('0x1e')]);_0x5dbc8c[_0x9ab2('0x27')]=_[_0x9ab2('0x26')](_0x13117c[_0x9ab2('0x27')]);_0x5dbc8c[_0x9ab2('0x28')]=_[_0x9ab2('0x29')](_0x5dbc8c['model'],_0x5dbc8c[_0x9ab2('0x27')]);_0x23c2ee[_0x9ab2('0x2a')]=_['intersection'](_0x5dbc8c[_0x9ab2('0x2b')],qs['fields'](_0x13117c[_0x9ab2('0x27')][_0x9ab2('0x2c')]));_0x23c2ee['attributes']=_0x23c2ee[_0x9ab2('0x2a')]['length']?_0x23c2ee[_0x9ab2('0x2a')]:_0x5dbc8c['model'];if(_0x13117c[_0x9ab2('0x27')]['includeAll']){_0x23c2ee['include']=[{'all':!![]}];}_0x23c2ee=_[_0x9ab2('0x2d')]({},_0x23c2ee,_0x13117c[_0x9ab2('0x2e')]);return db[_0x9ab2('0x2f')]['find'](_0x23c2ee)[_0x9ab2('0x18')](handleEntityNotFound(_0x45ad1c,null))[_0x9ab2('0x18')](respondWithResult(_0x45ad1c,null))['catch'](handleError(_0x45ad1c,null));};exports['create']=function(_0x67c5df,_0x5370bc){return db[_0x9ab2('0x2f')]['create'](_0x67c5df['body'],{})[_0x9ab2('0x18')](respondWithResult(_0x5370bc,0xc9))[_0x9ab2('0x30')](handleError(_0x5370bc,null));};exports[_0x9ab2('0x17')]=function(_0x50e06e,_0x27dcc5){if(_0x50e06e['body']['id']){delete _0x50e06e[_0x9ab2('0x31')]['id'];}return db[_0x9ab2('0x2f')][_0x9ab2('0x32')]({'where':{'id':_0x50e06e[_0x9ab2('0x25')]['id']}})[_0x9ab2('0x18')](handleEntityNotFound(_0x27dcc5,null))[_0x9ab2('0x18')](saveUpdates(_0x50e06e[_0x9ab2('0x31')],null))[_0x9ab2('0x18')](respondWithResult(_0x27dcc5,null))[_0x9ab2('0x30')](handleError(_0x27dcc5,null));};exports[_0x9ab2('0x19')]=function(_0x14e2e1,_0x5348f2){return db['WhatsappInteraction']['find']({'where':{'id':_0x14e2e1['params']['id']}})[_0x9ab2('0x18')](handleEntityNotFound(_0x5348f2,null))['then'](removeEntity(_0x5348f2,null))['catch'](handleError(_0x5348f2,null));};exports[_0x9ab2('0x33')]=function(_0x261f6d,_0x35cc70){return db[_0x9ab2('0x2f')][_0x9ab2('0x33')]()[_0x9ab2('0x18')](respondWithResult(_0x35cc70,null))['catch'](handleError(_0x35cc70,null));};exports[_0x9ab2('0x34')]=function(_0xd5d777,_0x37d7f7){return db[_0x9ab2('0x35')]['find']({'where':{'id':_0xd5d777[_0x9ab2('0x25')]['id']}})['then'](handleEntityNotFound(_0x37d7f7,null))['then'](function(_0x37d320){if(_0x37d320){return _0x37d320[_0x9ab2('0x34')](_0xd5d777[_0x9ab2('0x31')][_0x9ab2('0x36')],_[_0x9ab2('0x37')](_0xd5d777['body'],['ids','id'])||{});}})[_0x9ab2('0x18')](respondWithResult(_0x37d7f7,null))[_0x9ab2('0x30')](handleError(_0x37d7f7,null));};exports[_0x9ab2('0x38')]=function(_0x4f8ab4,_0x31534c){var _0x643bc4={'raw':![],'where':{}};var _0x4ef887={};var _0xa1719d={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0x9ab2('0x39')]({'where':{'id':_0x4f8ab4[_0x9ab2('0x25')]['id']}})[_0x9ab2('0x18')](handleEntityNotFound(_0x31534c,null))[_0x9ab2('0x18')](function(_0x34509d){if(_0x34509d){_0x4ef887[_0x9ab2('0x2b')]=_[_0x9ab2('0x26')](db[_0x9ab2('0x35')][_0x9ab2('0x1e')]);_0x4ef887[_0x9ab2('0x27')]=_[_0x9ab2('0x26')](_0x4f8ab4[_0x9ab2('0x27')]);_0x4ef887['filters']=_[_0x9ab2('0x29')](_0x4ef887[_0x9ab2('0x2b')],_0x4ef887[_0x9ab2('0x27')]);_0x643bc4[_0x9ab2('0x2a')]=_['intersection'](_0x4ef887[_0x9ab2('0x2b')],qs[_0x9ab2('0x2c')](_0x4f8ab4[_0x9ab2('0x27')][_0x9ab2('0x2c')]));_0x643bc4[_0x9ab2('0x2a')]=_0x643bc4[_0x9ab2('0x2a')]['length']?_0x643bc4[_0x9ab2('0x2a')]:_0x4ef887[_0x9ab2('0x2b')];if(!_0x4f8ab4[_0x9ab2('0x27')]['hasOwnProperty']('nolimit')){_0x643bc4[_0x9ab2('0x3a')]=qs['limit'](_0x4f8ab4[_0x9ab2('0x27')][_0x9ab2('0x3a')]);_0x643bc4[_0x9ab2('0x12')]=qs['offset'](_0x4f8ab4[_0x9ab2('0x27')][_0x9ab2('0x12')]);}_0x643bc4[_0x9ab2('0x3b')]=qs[_0x9ab2('0x3c')](_0x4f8ab4[_0x9ab2('0x27')]['sort']);_0x643bc4[_0x9ab2('0x3d')]=qs[_0x9ab2('0x28')](_[_0x9ab2('0x3e')](_0x4f8ab4['query'],_0x4ef887[_0x9ab2('0x28')]));_0x643bc4['where'][_0x9ab2('0x3f')]=_0x34509d['id'];if(_0x4f8ab4[_0x9ab2('0x27')][_0x9ab2('0x40')]){_0x643bc4[_0x9ab2('0x3d')]=_[_0x9ab2('0x2d')](_0x643bc4[_0x9ab2('0x3d')],{'$or':_[_0x9ab2('0x41')](_0x643bc4['attributes'],function(_0x1ada33){var _0x4c402={};_0x4c402[_0x1ada33]={'$like':'%'+_0x4f8ab4['query']['filter']+'%'};return _0x4c402;})});}if(_0x4f8ab4['query']['$gte']){var _0x1ec699=_0x4f8ab4[_0x9ab2('0x27')][_0x9ab2('0x42')][_0x9ab2('0x43')](',');var _0x489f72={};_0x489f72[_0x1ec699[0x0]]={'$gte':moment(_0x1ec699[0x1])[_0x9ab2('0x44')](_0x9ab2('0x45'))};_0x643bc4[_0x9ab2('0x3d')]=_[_0x9ab2('0x2d')](_0x643bc4[_0x9ab2('0x3d')],_0x489f72);}_0x643bc4=_[_0x9ab2('0x2d')]({},_0x643bc4,_0x4f8ab4[_0x9ab2('0x2e')]);return db[_0x9ab2('0x35')][_0x9ab2('0x13')]({'where':_0x643bc4[_0x9ab2('0x3d')]})[_0x9ab2('0x18')](function(_0x155463){_0xa1719d[_0x9ab2('0x13')]=_0x155463;if(_0x4f8ab4[_0x9ab2('0x27')][_0x9ab2('0x46')]){_0x643bc4[_0x9ab2('0x47')]=[{'all':!![]}];}return db[_0x9ab2('0x35')]['findAll'](_0x643bc4);})[_0x9ab2('0x18')](function(_0xf1dea0){_0xa1719d[_0x9ab2('0x48')]=_0xf1dea0;return _0xa1719d;});}})[_0x9ab2('0x18')](respondWithFilteredResult(_0x31534c,_0x643bc4))[_0x9ab2('0x30')](handleError(_0x31534c,null));};exports[_0x9ab2('0x49')]=function(_0x2c76b8,_0x3db97d){return db[_0x9ab2('0x2f')][_0x9ab2('0x32')]({'where':{'id':_0x2c76b8[_0x9ab2('0x25')]['id']}})[_0x9ab2('0x18')](handleEntityNotFound(_0x3db97d,null))['then'](function(_0xa5a6a7){if(_0xa5a6a7){return _0xa5a6a7['setTags'](_0x2c76b8[_0x9ab2('0x31')][_0x9ab2('0x36')],_[_0x9ab2('0x37')](_0x2c76b8[_0x9ab2('0x31')],[_0x9ab2('0x36'),'id'])||{})[_0x9ab2('0x4a')](function(){return db['Tag'][_0x9ab2('0x4b')]({'attributes':['id',_0x9ab2('0x1c'),'color'],'where':{'id':_0x2c76b8[_0x9ab2('0x31')][_0x9ab2('0x36')]}});})[_0x9ab2('0x18')](function(_0x2f15c8){socket['emit'](_0x9ab2('0x4c'),{'id':Number(_0x2c76b8[_0x9ab2('0x25')]['id']),'tags':_0x2f15c8||[]});return{'id':Number(_0x2c76b8[_0x9ab2('0x25')]['id']),'tags':_0x2f15c8||[]};});}})[_0x9ab2('0x18')](respondWithResult(_0x3db97d,null))[_0x9ab2('0x30')](handleError(_0x3db97d,null));};exports[_0x9ab2('0x4d')]=function(_0x2207f4,_0x4c18e6){return db[_0x9ab2('0x2f')][_0x9ab2('0x32')]({'where':{'id':_0x2207f4[_0x9ab2('0x25')]['id']}})['then'](handleEntityNotFound(_0x4c18e6,null))[_0x9ab2('0x18')](function(_0x53625f){if(_0x53625f){return _0x53625f[_0x9ab2('0x4d')](_0x2207f4['query'][_0x9ab2('0x36')]);}})[_0x9ab2('0x18')](respondWithStatusCode(_0x4c18e6,null))[_0x9ab2('0x30')](handleError(_0x4c18e6,null));};exports[_0x9ab2('0x4e')]=function(_0x4ecfb3,_0x38ea1b){var _0xfadd1d=moment()['unix']()[_0x9ab2('0x4f')]();var _0x360397=path['join'](config[_0x9ab2('0x50')],_0x9ab2('0x51'),_0x9ab2('0x52'),_0x9ab2('0x53'));var _0x1888ee=path[_0x9ab2('0x54')](config[_0x9ab2('0x50')],_0x9ab2('0x51'),_0x9ab2('0x52'),_0x9ab2('0x55'));var _0x38bf34=path[_0x9ab2('0x54')](_0x360397,_0xfadd1d);var _0x4c20e2=util[_0x9ab2('0x44')](_0x9ab2('0x56'),_0x4ecfb3[_0x9ab2('0x25')]['id'],_0xfadd1d);var _0x15c6fe=path['join'](_0x360397,_0x4c20e2);var _0x4030f7=[];_0x4030f7[_0x9ab2('0x57')]({'model':db['User'],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x4030f7[_0x9ab2('0x57')]({'model':db[_0x9ab2('0x58')],'as':'Contact','attributes':['id',_0x9ab2('0x59'),_0x9ab2('0x5a')],'raw':!![]});if(_0x4ecfb3['query'][_0x9ab2('0x55')]){_0x4030f7[_0x9ab2('0x57')]({'model':db[_0x9ab2('0x5b')],'as':'Attachment','raw':!![]});}var _0x4907a1=[{'model':db[_0x9ab2('0x35')],'as':'Messages','attributes':['id',_0x9ab2('0x31'),_0x9ab2('0x5c'),_0x9ab2('0x5d'),_0x9ab2('0x5e'),_0x9ab2('0x5f')],'include':_0x4030f7}];_0x4907a1[_0x9ab2('0x57')]({'model':db['WhatsappAccount'],'as':_0x9ab2('0x60'),'attributes':['id','name']});_0x4907a1[_0x9ab2('0x57')]({'model':db[_0x9ab2('0x61')],'as':_0x9ab2('0x62'),'attributes':['id',_0x9ab2('0x63')]});return db[_0x9ab2('0x2f')][_0x9ab2('0x32')]({'where':{'id':_0x4ecfb3[_0x9ab2('0x25')]['id']},'include':_0x4907a1})[_0x9ab2('0x18')](handleEntityNotFound(_0x38ea1b,null))[_0x9ab2('0x18')](function(_0x3c6522){if(_0x3c6522){var _0x3d78e4=_0x3c6522[_0x9ab2('0x64')]({'plain':!![]});fs['mkdirSync'](_0x38bf34);var _0x4e031d={'channel':_0x9ab2('0x65'),'account':_0x3d78e4['Account'][_0x9ab2('0x1c')],'agent':_0x3d78e4[_0x9ab2('0x62')]?_0x3d78e4[_0x9ab2('0x62')][_0x9ab2('0x63')]:_0x9ab2('0x66'),'createdAt':moment(_0x3d78e4[_0x9ab2('0x5c')])[_0x9ab2('0x44')](_0x9ab2('0x45'))[_0x9ab2('0x4f')](),'closedAt':_0x3d78e4['closed']?moment(_0x3d78e4[_0x9ab2('0x67')])[_0x9ab2('0x44')](_0x9ab2('0x45'))[_0x9ab2('0x4f')]():'','disposition':_0x3d78e4['disposition'],'messages':_(_0x3d78e4[_0x9ab2('0x68')])[_0x9ab2('0x40')]({'secret':![]})[_0x9ab2('0x41')](function(_0xcf5223){if(_0xcf5223[_0x9ab2('0x5b')]){var _0xe4f9b=path['join'](_0x1888ee,_0xcf5223[_0x9ab2('0x5b')][_0x9ab2('0x69')]);if(fs[_0x9ab2('0x6a')](_0xe4f9b)){fs[_0x9ab2('0x6b')](_0xe4f9b)[_0x9ab2('0x6c')](fs['createWriteStream'](path[_0x9ab2('0x54')](_0x38bf34,_0xcf5223[_0x9ab2('0x5b')][_0x9ab2('0x69')])));}}return{'date':moment(_0xcf5223[_0x9ab2('0x5c')])[_0x9ab2('0x44')](_0x9ab2('0x45'))[_0x9ab2('0x4f')](),'sender':_0xcf5223['direction']===_0x9ab2('0x6d')?_0xcf5223[_0x9ab2('0x61')]?_0xcf5223['User'][_0x9ab2('0x63')]:_0x9ab2('0x6e'):_0xcf5223['Contact'][_0x9ab2('0x59')]+(_0xcf5223[_0x9ab2('0x6f')]['lastName']?'\x20'+_0xcf5223[_0x9ab2('0x6f')][_0x9ab2('0x5a')]:''),'body':_0xcf5223['Attachment']?_0xcf5223[_0x9ab2('0x5b')][_0x9ab2('0x69')]:_0xcf5223[_0x9ab2('0x31')],'direction':_0xcf5223[_0x9ab2('0x5d')]==='out'?'A':'C','secret':_0xcf5223[_0x9ab2('0x5e')],'read':_0xcf5223[_0x9ab2('0x5f')],'attachment':_0xcf5223[_0x9ab2('0x5b')]};})['value']()};return ejs[_0x9ab2('0x70')](path[_0x9ab2('0x54')](config['root'],_0x9ab2('0x51'),_0x9ab2('0x71'),'downloadInteraction.ejs'),{'interaction':_0x4e031d})[_0x9ab2('0x18')](function(_0x4b30b9){var _0x2fbd77=path[_0x9ab2('0x54')](_0x38bf34,_0x9ab2('0x72')+_0x3d78e4['id']+'-'+_0xfadd1d+'.pdf');var _0x3b083c={'path':_0x2fbd77,'channel':_0x9ab2('0x65'),'interactionId':_0x3d78e4['id']};return pdf[_0x9ab2('0x73')](_0x4b30b9,_0x3b083c);})[_0x9ab2('0x18')](function(){return new BPromise(function(_0x1b40a8,_0x3bf880){zipdir(_0x38bf34,{'saveTo':_0x15c6fe},function(_0x4b0da3,_0x26bbb0){if(_0x4b0da3)return _0x3bf880(_0x4b0da3);return _0x1b40a8(_0x26bbb0);});})[_0x9ab2('0x18')](function(){return new BPromise(function(_0x25af43,_0x102514){rimraf(_0x38bf34,function(_0x5bf22d){if(_0x5bf22d)_0x102514(_0x5bf22d);return _0x25af43();});});})[_0x9ab2('0x18')](function(){return _0x38ea1b['download'](_0x15c6fe,_0x4c20e2,function(_0x7723c6){if(_0x7723c6){console[_0x9ab2('0x74')](_0x9ab2('0x75'),_0x7723c6);}else{fs[_0x9ab2('0x76')](_0x15c6fe);}});});});}else{return _0x38ea1b[_0x9ab2('0xf')](0xc8);}})[_0x9ab2('0x30')](handleError(_0x38ea1b,null));};
\ No newline at end of file
+var _0x19f8=['out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../mysqldb','redis','defaults','./whatsappInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','error','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','include','merge','options','create','body','find','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','length','nolimit','order','sort','where','pick','WhatsappInteractionId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','spread','emit','removeTags','download','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','Account','get','mkdirSync','Owner','createdAt','closed','disposition','filter','basename','existsSync','createReadStream','pipe','createWriteStream','System'];(function(_0x3851a0,_0x547dfe){var _0x525651=function(_0x136edb){while(--_0x136edb){_0x3851a0['push'](_0x3851a0['shift']());}};_0x525651(++_0x547dfe);}(_0x19f8,0x186));var _0x819f=function(_0x2fc6cf,_0x2bb133){_0x2fc6cf=_0x2fc6cf-0x0;var _0xf2ade3=_0x19f8[_0x2fc6cf];return _0xf2ade3;};'use strict';var rimraf=require(_0x819f('0x0'));var zipdir=require(_0x819f('0x1'));var moment=require(_0x819f('0x2'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x819f('0x3'));var ejs=require(_0x819f('0x4'));var fs=require('fs');var _=require(_0x819f('0x5'));var Redis=require(_0x819f('0x6'));var interaction=require(_0x819f('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0x819f('0x8'));var logger=require('../../config/logger')(_0x819f('0x9'));var config=require('../../config/environment');var db=require(_0x819f('0xa'))['db'];config[_0x819f('0xb')]=_[_0x819f('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x819f('0xb')]));require(_0x819f('0xd'))[_0x819f('0xe')](socket);function respondWithStatusCode(_0xedc2f,_0x5a7a9f){_0x5a7a9f=_0x5a7a9f||0xcc;return function(_0xd65b32){if(_0xd65b32){return _0xedc2f[_0x819f('0xf')](_0x5a7a9f);}return _0xedc2f[_0x819f('0x10')](_0x5a7a9f)['end']();};}function respondWithResult(_0x360ba1,_0x4ff1a0){_0x4ff1a0=_0x4ff1a0||0xc8;return function(_0x4ea492){if(_0x4ea492){return _0x360ba1['status'](_0x4ff1a0)[_0x819f('0x11')](_0x4ea492);}};}function respondWithFilteredResult(_0x394a56,_0xe3bb46){return function(_0x1f4fc4){if(_0x1f4fc4){var _0x5e89a1=typeof _0xe3bb46[_0x819f('0x12')]===_0x819f('0x13')&&typeof _0xe3bb46[_0x819f('0x14')]===_0x819f('0x13');var _0x3fa077=_0x1f4fc4[_0x819f('0x15')];var _0x424255=_0x5e89a1?0x0:_0xe3bb46[_0x819f('0x12')];var _0x2b80d4=_0x5e89a1?_0x1f4fc4['count']:_0xe3bb46['offset']+_0xe3bb46[_0x819f('0x14')];var _0x4e35bb;if(_0x2b80d4>=_0x3fa077){_0x2b80d4=_0x3fa077;_0x4e35bb=0xc8;}else{_0x4e35bb=0xce;}_0x394a56[_0x819f('0x10')](_0x4e35bb);return _0x394a56['set'](_0x819f('0x16'),_0x424255+'-'+_0x2b80d4+'/'+_0x3fa077)[_0x819f('0x11')](_0x1f4fc4);}return null;};}function saveUpdates(_0x874a9c){return function(_0x1338a7){if(_0x1338a7){return _0x1338a7[_0x819f('0x17')](_0x874a9c)[_0x819f('0x18')](function(_0x446d2f){return _0x446d2f;});}return null;};}function removeEntity(_0x166aaa){return function(_0x1f9c6b){if(_0x1f9c6b){return _0x1f9c6b[_0x819f('0x19')]()[_0x819f('0x18')](function(){_0x166aaa['status'](0xcc)[_0x819f('0x1a')]();});}};}function handleEntityNotFound(_0x4a88df){return function(_0x45ef9e){if(!_0x45ef9e){_0x4a88df[_0x819f('0xf')](0x194);}return _0x45ef9e;};}function handleError(_0x16b4b4,_0x1284fa){_0x1284fa=_0x1284fa||0x1f4;return function(_0x2742b1){logger[_0x819f('0x1b')](_0x2742b1['stack']);if(_0x2742b1[_0x819f('0x1c')]){delete _0x2742b1[_0x819f('0x1c')];}_0x16b4b4[_0x819f('0x10')](_0x1284fa)[_0x819f('0x1d')](_0x2742b1);};}exports[_0x819f('0x1e')]=function(_0x4fafe3,_0x230890){var _0x32f07f={};var _0x291a61=_[_0x819f('0x1f')](db[_0x819f('0x20')][_0x819f('0x21')],function(_0x331c0d){return{'name':_0x331c0d[_0x819f('0x22')],'type':_0x331c0d['type'][_0x819f('0x23')]};});_0x32f07f=qs[_0x819f('0x24')](_0x291a61,_0x4fafe3);return interaction[_0x819f('0x25')](_0x819f('0x26'),_0x4fafe3[_0x819f('0x27')],_0x4fafe3[_0x819f('0x28')],_0x32f07f,_0x291a61)[_0x819f('0x18')](respondWithFilteredResult(_0x230890,_0x32f07f))[_0x819f('0x29')](handleError(_0x230890,null));};exports[_0x819f('0x2a')]=function(_0x5f0784,_0x582940){var _0x92b7eb={'raw':![],'where':{'id':_0x5f0784[_0x819f('0x2b')]['id']}},_0x148f13={};_0x148f13[_0x819f('0x2c')]=_[_0x819f('0x2d')](db[_0x819f('0x20')][_0x819f('0x21')]);_0x148f13[_0x819f('0x27')]=_['keys'](_0x5f0784[_0x819f('0x27')]);_0x148f13[_0x819f('0x2e')]=_[_0x819f('0x2f')](_0x148f13[_0x819f('0x2c')],_0x148f13[_0x819f('0x27')]);_0x92b7eb[_0x819f('0x30')]=_[_0x819f('0x2f')](_0x148f13[_0x819f('0x2c')],qs[_0x819f('0x31')](_0x5f0784['query'][_0x819f('0x31')]));_0x92b7eb['attributes']=_0x92b7eb['attributes']['length']?_0x92b7eb[_0x819f('0x30')]:_0x148f13[_0x819f('0x2c')];if(_0x5f0784[_0x819f('0x27')]['includeAll']){_0x92b7eb[_0x819f('0x32')]=[{'all':!![]}];}_0x92b7eb=_[_0x819f('0x33')]({},_0x92b7eb,_0x5f0784[_0x819f('0x34')]);return db[_0x819f('0x20')]['find'](_0x92b7eb)['then'](handleEntityNotFound(_0x582940,null))[_0x819f('0x18')](respondWithResult(_0x582940,null))[_0x819f('0x29')](handleError(_0x582940,null));};exports[_0x819f('0x35')]=function(_0x2b82b7,_0x1658a5){return db[_0x819f('0x20')][_0x819f('0x35')](_0x2b82b7['body'],{})[_0x819f('0x18')](respondWithResult(_0x1658a5,0xc9))[_0x819f('0x29')](handleError(_0x1658a5,null));};exports[_0x819f('0x17')]=function(_0x373244,_0x15f559){if(_0x373244[_0x819f('0x36')]['id']){delete _0x373244['body']['id'];}return db[_0x819f('0x20')][_0x819f('0x37')]({'where':{'id':_0x373244[_0x819f('0x2b')]['id']}})[_0x819f('0x18')](handleEntityNotFound(_0x15f559,null))[_0x819f('0x18')](saveUpdates(_0x373244['body'],null))[_0x819f('0x18')](respondWithResult(_0x15f559,null))['catch'](handleError(_0x15f559,null));};exports['destroy']=function(_0x3ebad8,_0x5d1053){return db['WhatsappInteraction']['find']({'where':{'id':_0x3ebad8[_0x819f('0x2b')]['id']}})[_0x819f('0x18')](handleEntityNotFound(_0x5d1053,null))['then'](removeEntity(_0x5d1053,null))[_0x819f('0x29')](handleError(_0x5d1053,null));};exports['describe']=function(_0x16d835,_0x48b5f4){return db[_0x819f('0x20')]['describe']()['then'](respondWithResult(_0x48b5f4,null))[_0x819f('0x29')](handleError(_0x48b5f4,null));};exports['addMessage']=function(_0x308408,_0x49eede){return db[_0x819f('0x38')][_0x819f('0x37')]({'where':{'id':_0x308408[_0x819f('0x2b')]['id']}})[_0x819f('0x18')](handleEntityNotFound(_0x49eede,null))['then'](function(_0x1cdd7b){if(_0x1cdd7b){return _0x1cdd7b[_0x819f('0x39')](_0x308408[_0x819f('0x36')]['ids'],_[_0x819f('0x3a')](_0x308408['body'],[_0x819f('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x49eede,null))[_0x819f('0x29')](handleError(_0x49eede,null));};exports[_0x819f('0x3c')]=function(_0x3324d3,_0x7c4644){var _0x33a1da={'raw':![],'where':{}};var _0xe8eade={};var _0x50fb23={'count':0x0,'rows':[]};return db[_0x819f('0x20')][_0x819f('0x3d')]({'where':{'id':_0x3324d3[_0x819f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x7c4644,null))[_0x819f('0x18')](function(_0x58aef4){if(_0x58aef4){_0xe8eade[_0x819f('0x2c')]=_[_0x819f('0x2d')](db[_0x819f('0x38')]['rawAttributes']);_0xe8eade[_0x819f('0x27')]=_['keys'](_0x3324d3[_0x819f('0x27')]);_0xe8eade['filters']=_[_0x819f('0x2f')](_0xe8eade[_0x819f('0x2c')],_0xe8eade[_0x819f('0x27')]);_0x33a1da[_0x819f('0x30')]=_[_0x819f('0x2f')](_0xe8eade[_0x819f('0x2c')],qs['fields'](_0x3324d3['query']['fields']));_0x33a1da[_0x819f('0x30')]=_0x33a1da[_0x819f('0x30')][_0x819f('0x3e')]?_0x33a1da[_0x819f('0x30')]:_0xe8eade[_0x819f('0x2c')];if(!_0x3324d3[_0x819f('0x27')]['hasOwnProperty'](_0x819f('0x3f'))){_0x33a1da[_0x819f('0x14')]=qs['limit'](_0x3324d3[_0x819f('0x27')][_0x819f('0x14')]);_0x33a1da['offset']=qs[_0x819f('0x12')](_0x3324d3[_0x819f('0x27')]['offset']);}_0x33a1da[_0x819f('0x40')]=qs[_0x819f('0x41')](_0x3324d3[_0x819f('0x27')][_0x819f('0x41')]);_0x33a1da[_0x819f('0x42')]=qs['filters'](_[_0x819f('0x43')](_0x3324d3['query'],_0xe8eade['filters']));_0x33a1da[_0x819f('0x42')][_0x819f('0x44')]=_0x58aef4['id'];if(_0x3324d3['query']['filter']){_0x33a1da[_0x819f('0x42')]=_[_0x819f('0x33')](_0x33a1da[_0x819f('0x42')],{'$or':_[_0x819f('0x1f')](_0x33a1da['attributes'],function(_0x3e6d06){var _0x3b0258={};_0x3b0258[_0x3e6d06]={'$like':'%'+_0x3324d3[_0x819f('0x27')]['filter']+'%'};return _0x3b0258;})});}if(_0x3324d3[_0x819f('0x27')]['$gte']){var _0x16d246=_0x3324d3[_0x819f('0x27')][_0x819f('0x45')][_0x819f('0x46')](',');var _0x7dfcc3={};_0x7dfcc3[_0x16d246[0x0]]={'$gte':moment(_0x16d246[0x1])[_0x819f('0x47')](_0x819f('0x48'))};_0x33a1da['where']=_[_0x819f('0x33')](_0x33a1da[_0x819f('0x42')],_0x7dfcc3);}_0x33a1da=_[_0x819f('0x33')]({},_0x33a1da,_0x3324d3[_0x819f('0x34')]);return db[_0x819f('0x38')][_0x819f('0x15')]({'where':_0x33a1da['where']})[_0x819f('0x18')](function(_0x309485){_0x50fb23['count']=_0x309485;if(_0x3324d3[_0x819f('0x27')][_0x819f('0x49')]){_0x33a1da[_0x819f('0x32')]=[{'all':!![]}];}return db[_0x819f('0x38')][_0x819f('0x25')](_0x33a1da);})['then'](function(_0x510924){_0x50fb23[_0x819f('0x4a')]=_0x510924;return _0x50fb23;});}})[_0x819f('0x18')](respondWithFilteredResult(_0x7c4644,_0x33a1da))['catch'](handleError(_0x7c4644,null));};exports['addTags']=function(_0xd36ec0,_0x5adf97){return db[_0x819f('0x20')][_0x819f('0x37')]({'where':{'id':_0xd36ec0[_0x819f('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5adf97,null))[_0x819f('0x18')](function(_0x17f2b5){if(_0x17f2b5){return _0x17f2b5[_0x819f('0x4b')](_0xd36ec0[_0x819f('0x36')][_0x819f('0x3b')],_[_0x819f('0x3a')](_0xd36ec0['body'],['ids','id'])||{})[_0x819f('0x4c')](function(){return db['Tag'][_0x819f('0x25')]({'attributes':['id','name','color'],'where':{'id':_0xd36ec0['body'][_0x819f('0x3b')]}});})['then'](function(_0x394eb5){socket[_0x819f('0x4d')]('whatsappInteractionTags:save',{'id':Number(_0xd36ec0['params']['id']),'tags':_0x394eb5||[]});return{'id':Number(_0xd36ec0[_0x819f('0x2b')]['id']),'tags':_0x394eb5||[]};});}})[_0x819f('0x18')](respondWithResult(_0x5adf97,null))['catch'](handleError(_0x5adf97,null));};exports[_0x819f('0x4e')]=function(_0x461240,_0x5b2e08){return db[_0x819f('0x20')]['find']({'where':{'id':_0x461240[_0x819f('0x2b')]['id']}})[_0x819f('0x18')](handleEntityNotFound(_0x5b2e08,null))[_0x819f('0x18')](function(_0x2422fe){if(_0x2422fe){return _0x2422fe['removeTags'](_0x461240[_0x819f('0x27')][_0x819f('0x3b')]);}})[_0x819f('0x18')](respondWithStatusCode(_0x5b2e08,null))[_0x819f('0x29')](handleError(_0x5b2e08,null));};exports[_0x819f('0x4f')]=function(_0x2ced09,_0x27c8b1){var _0x3f1894=moment()['unix']()[_0x819f('0x50')]();var _0x150851=path[_0x819f('0x51')](config[_0x819f('0x52')],_0x819f('0x53'),_0x819f('0x54'),_0x819f('0x55'));var _0x25028d=path[_0x819f('0x51')](config[_0x819f('0x52')],_0x819f('0x53'),_0x819f('0x54'),_0x819f('0x56'));var _0x2f54ea=path['join'](_0x150851,_0x3f1894);var _0x336981=util[_0x819f('0x47')](_0x819f('0x57'),_0x2ced09[_0x819f('0x2b')]['id'],_0x3f1894);var _0x3f891c=path['join'](_0x150851,_0x336981);var _0x5a53d7=[];_0x5a53d7[_0x819f('0x58')]({'model':db[_0x819f('0x59')],'as':'User','attributes':['id',_0x819f('0x5a')],'raw':!![]});_0x5a53d7[_0x819f('0x58')]({'model':db[_0x819f('0x5b')],'as':_0x819f('0x5c'),'attributes':['id',_0x819f('0x5d'),_0x819f('0x5e')],'raw':!![]});if(_0x2ced09['query'][_0x819f('0x56')]){_0x5a53d7['push']({'model':db[_0x819f('0x5f')],'as':_0x819f('0x5f'),'raw':!![]});}var _0x4008b5=[{'model':db[_0x819f('0x38')],'as':_0x819f('0x60'),'attributes':['id','body','createdAt',_0x819f('0x61'),_0x819f('0x62'),_0x819f('0x63')],'include':_0x5a53d7}];_0x4008b5[_0x819f('0x58')]({'model':db['WhatsappAccount'],'as':_0x819f('0x64'),'attributes':['id','name']});_0x4008b5[_0x819f('0x58')]({'model':db[_0x819f('0x59')],'as':'Owner','attributes':['id',_0x819f('0x5a')]});return db[_0x819f('0x20')][_0x819f('0x37')]({'where':{'id':_0x2ced09[_0x819f('0x2b')]['id']},'include':_0x4008b5})[_0x819f('0x18')](handleEntityNotFound(_0x27c8b1,null))[_0x819f('0x18')](function(_0x5f1bf2){if(_0x5f1bf2){var _0x393e61=_0x5f1bf2[_0x819f('0x65')]({'plain':!![]});fs[_0x819f('0x66')](_0x2f54ea);var _0x250cb2={'channel':'Whatsapp','account':_0x393e61[_0x819f('0x64')][_0x819f('0x1c')],'agent':_0x393e61[_0x819f('0x67')]?_0x393e61['Owner'][_0x819f('0x5a')]:'N.A.','createdAt':moment(_0x393e61[_0x819f('0x68')])['format'](_0x819f('0x48'))[_0x819f('0x50')](),'closedAt':_0x393e61[_0x819f('0x69')]?moment(_0x393e61['closedAt'])[_0x819f('0x47')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x393e61[_0x819f('0x6a')],'messages':_(_0x393e61[_0x819f('0x60')])[_0x819f('0x6b')]({'secret':![]})[_0x819f('0x1f')](function(_0x3f4ce1){if(_0x3f4ce1[_0x819f('0x5f')]){var _0x246bb8=path[_0x819f('0x51')](_0x25028d,_0x3f4ce1[_0x819f('0x5f')][_0x819f('0x6c')]);if(fs[_0x819f('0x6d')](_0x246bb8)){fs[_0x819f('0x6e')](_0x246bb8)[_0x819f('0x6f')](fs[_0x819f('0x70')](path[_0x819f('0x51')](_0x2f54ea,_0x3f4ce1[_0x819f('0x5f')][_0x819f('0x6c')])));}}return{'date':moment(_0x3f4ce1['createdAt'])[_0x819f('0x47')](_0x819f('0x48'))[_0x819f('0x50')](),'sender':_0x3f4ce1[_0x819f('0x61')]==='out'?_0x3f4ce1[_0x819f('0x59')]?_0x3f4ce1[_0x819f('0x59')]['fullname']:_0x819f('0x71'):_0x3f4ce1[_0x819f('0x5c')]['firstName']+(_0x3f4ce1[_0x819f('0x5c')][_0x819f('0x5e')]?'\x20'+_0x3f4ce1[_0x819f('0x5c')][_0x819f('0x5e')]:''),'body':_0x3f4ce1[_0x819f('0x5f')]?_0x3f4ce1[_0x819f('0x5f')][_0x819f('0x6c')]:_0x3f4ce1[_0x819f('0x36')],'direction':_0x3f4ce1[_0x819f('0x61')]===_0x819f('0x72')?'A':'C','secret':_0x3f4ce1[_0x819f('0x62')],'read':_0x3f4ce1[_0x819f('0x63')],'attachment':_0x3f4ce1[_0x819f('0x5f')]};})[_0x819f('0x73')]()};return ejs[_0x819f('0x74')](path[_0x819f('0x51')](config[_0x819f('0x52')],_0x819f('0x53'),_0x819f('0x75'),_0x819f('0x76')),{'interaction':_0x250cb2})['then'](function(_0x2f154f){var _0x13afac=path[_0x819f('0x51')](_0x2f54ea,_0x819f('0x77')+_0x393e61['id']+'-'+_0x3f1894+_0x819f('0x78'));var _0x2c5efe={'path':_0x13afac,'channel':_0x819f('0x79'),'interactionId':_0x393e61['id']};return pdf[_0x819f('0x7a')](_0x2f154f,_0x2c5efe);})['then'](function(){return new BPromise(function(_0x44cb4c,_0x1b2452){zipdir(_0x2f54ea,{'saveTo':_0x3f891c},function(_0x287ab8,_0x368aba){if(_0x287ab8)return _0x1b2452(_0x287ab8);return _0x44cb4c(_0x368aba);});})[_0x819f('0x18')](function(){return new BPromise(function(_0x44e4e7,_0x36e059){rimraf(_0x2f54ea,function(_0x1ba9d3){if(_0x1ba9d3)_0x36e059(_0x1ba9d3);return _0x44e4e7();});});})[_0x819f('0x18')](function(){return _0x27c8b1['download'](_0x3f891c,_0x336981,function(_0x524234){if(_0x524234){console[_0x819f('0x7b')](_0x819f('0x7c'),_0x524234);}else{fs[_0x819f('0x7d')](_0x3f891c);}});});});}else{return _0x27c8b1[_0x819f('0xf')](0xc8);}})[_0x819f('0x29')](handleError(_0x27c8b1,null));};
\ No newline at end of file
index bee9275..0b74236 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c9f=['hasOwnProperty','exports','events','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch'];(function(_0x41601d,_0x36ad17){var _0x1d5fb2=function(_0x27e1b6){while(--_0x27e1b6){_0x41601d['push'](_0x41601d['shift']());}};_0x1d5fb2(++_0x36ad17);}(_0x6c9f,0x16a));var _0xf6c9=function(_0x2a1dc1,_0x5f34b5){_0x2a1dc1=_0x2a1dc1-0x0;var _0x2465f7=_0x6c9f[_0x2a1dc1];return _0x2465f7;};'use strict';var EventEmitter=require(_0xf6c9('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xf6c9('0x1')];var WhatsappMessage=require('../../mysqldb')['db'][_0xf6c9('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xf6c9('0x3')](0x0);var events={'afterCreate':_0xf6c9('0x4'),'afterUpdate':_0xf6c9('0x5'),'afterDestroy':_0xf6c9('0x6')};function emitEvent(_0x2e5222){return function(_0x519365,_0x1e7f09,_0x1b92e6){_0x519365[_0xf6c9('0x7')]({'attributes':['id'],'raw':!![]})[_0xf6c9('0x8')](function(_0x151322){_0x519365[_0xf6c9('0x9')](_0xf6c9('0xa'),_0x151322[_0xf6c9('0xb')](function(_0x1e16cc){return{'id':_0x1e16cc['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x519365['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf6c9('0x8')](function(_0x2a09aa){_0x519365[_0xf6c9('0x9')](_0xf6c9('0xc'),_0x2a09aa[_0xf6c9('0xd')]);WhatsappInteractionEvents[_0xf6c9('0xe')](_0x2e5222+':'+_0x519365['id'],_0x519365);WhatsappInteractionEvents[_0xf6c9('0xe')](_0x2e5222,_0x519365);_0x1b92e6(null);})[_0xf6c9('0xf')](_0x1b92e6(null));};}for(var e in events){if(events[_0xf6c9('0x10')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xf6c9('0x11')]=WhatsappInteractionEvents;
\ No newline at end of file
+var _0xee5b=['setDataValue','length','emit','catch','hasOwnProperty','hook','exports','events','WhatsappInteraction','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','findAll'];(function(_0x38fcc2,_0x2de700){var _0x423172=function(_0x275565){while(--_0x275565){_0x38fcc2['push'](_0x38fcc2['shift']());}};_0x423172(++_0x2de700);}(_0xee5b,0x1f4));var _0xbee5=function(_0x2e1598,_0x468e99){_0x2e1598=_0x2e1598-0x0;var _0xe93b75=_0xee5b[_0x2e1598];return _0xe93b75;};'use strict';var EventEmitter=require(_0xbee5('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xbee5('0x1')];var WhatsappMessage=require(_0xbee5('0x2'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xbee5('0x3')](0x0);var events={'afterCreate':_0xbee5('0x4'),'afterUpdate':_0xbee5('0x5'),'afterDestroy':_0xbee5('0x6')};function emitEvent(_0x4bd202){return function(_0x5200b1,_0x2e8127,_0x2c0bde){_0x5200b1[_0xbee5('0x7')]({'attributes':['id'],'raw':!![]})[_0xbee5('0x8')](function(_0x4f5065){_0x5200b1['setDataValue']('Users',_0x4f5065['map'](function(_0x5536bd){return{'id':_0x5536bd['id']};}));return WhatsappMessage[_0xbee5('0x9')]({'where':{'WhatsappInteractionId':_0x5200b1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xbee5('0x8')](function(_0x45c2c7){_0x5200b1[_0xbee5('0xa')]('unreadMessages',_0x45c2c7[_0xbee5('0xb')]);WhatsappInteractionEvents[_0xbee5('0xc')](_0x4bd202+':'+_0x5200b1['id'],_0x5200b1);WhatsappInteractionEvents[_0xbee5('0xc')](_0x4bd202,_0x5200b1);_0x2c0bde(null);})[_0xbee5('0xd')](_0x2c0bde(null));};}for(var e in events){if(events[_0xbee5('0xe')](e)){var event=events[e];WhatsappInteraction[_0xbee5('0xf')](e,emitEvent(event));}}module[_0xbee5('0x10')]=WhatsappInteractionEvents;
\ No newline at end of file
index ecf9690..d15843d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeaa5=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x152a6e,_0x4b38c8){var _0x30b76e=function(_0x3d6d2a){while(--_0x3d6d2a){_0x152a6e['push'](_0x152a6e['shift']());}};_0x30b76e(++_0x4b38c8);}(_0xeaa5,0x1cd));var _0x5eaa=function(_0x32d5ff,_0x2b654b){_0x32d5ff=_0x32d5ff-0x0;var _0x4ffb02=_0xeaa5[_0x32d5ff];return _0x4ffb02;};'use strict';var _=require(_0x5eaa('0x0'));var util=require(_0x5eaa('0x1'));var logger=require(_0x5eaa('0x2'))(_0x5eaa('0x3'));var moment=require(_0x5eaa('0x4'));var BPromise=require(_0x5eaa('0x5'));var rp=require(_0x5eaa('0x6'));var fs=require('fs');var path=require(_0x5eaa('0x7'));var rimraf=require(_0x5eaa('0x8'));var config=require(_0x5eaa('0x9'));var attributes=require('./whatsappInteraction.attributes');module[_0x5eaa('0xa')]=function(_0x5a16d1,_0x3b006c){return _0x5a16d1[_0x5eaa('0xb')]('WhatsappInteraction',attributes,{'tableName':_0x5eaa('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x146c46,_0x54ddad,_0xee8744){if(_0x146c46['changed']('closed')){_0x146c46[_0x5eaa('0xd')]=moment()[_0x5eaa('0xe')](_0x5eaa('0xf'));}_0xee8744(null,_0x146c46);}}});};
\ No newline at end of file
+var _0x44da=['define','whatsapp_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','path','rimraf','./whatsappInteraction.attributes','exports'];(function(_0x1d95ca,_0x13c6fb){var _0x4040b3=function(_0x268dff){while(--_0x268dff){_0x1d95ca['push'](_0x1d95ca['shift']());}};_0x4040b3(++_0x13c6fb);}(_0x44da,0xf4));var _0xa44d=function(_0x1aa9ec,_0x2150b8){_0x1aa9ec=_0x1aa9ec-0x0;var _0x476a99=_0x44da[_0x1aa9ec];return _0x476a99;};'use strict';var _=require('lodash');var util=require(_0xa44d('0x0'));var logger=require(_0xa44d('0x1'))('api');var moment=require(_0xa44d('0x2'));var BPromise=require(_0xa44d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa44d('0x4'));var rimraf=require(_0xa44d('0x5'));var config=require('../../config/environment');var attributes=require(_0xa44d('0x6'));module[_0xa44d('0x7')]=function(_0x213345,_0x10e615){return _0x213345[_0xa44d('0x8')]('WhatsappInteraction',attributes,{'tableName':_0xa44d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x168cec,_0x32ac50,_0x5e6f67){if(_0x168cec[_0xa44d('0xa')]('closed')){_0x168cec[_0xa44d('0xb')]=moment()[_0xa44d('0xc')](_0xa44d('0xd'));}_0x5e6f67(null,_0x168cec);}}});};
\ No newline at end of file
index 8d1b6cd..efe1a7a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xacc7=['then','find','addTags','omit','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','register','request','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','where','attributes','limit'];(function(_0x2617e1,_0x5505f1){var _0x2fab4f=function(_0x5b0859){while(--_0x5b0859){_0x2617e1['push'](_0x2617e1['shift']());}};_0x2fab4f(++_0x5505f1);}(_0xacc7,0x1d5));var _0x7acc=function(_0x503ea8,_0x22e391){_0x503ea8=_0x503ea8-0x0;var _0x427e5d=_0xacc7[_0x503ea8];return _0x427e5d;};'use strict';var _=require('lodash');var util=require(_0x7acc('0x0'));var moment=require(_0x7acc('0x1'));var BPromise=require(_0x7acc('0x2'));var rs=require(_0x7acc('0x3'));var fs=require('fs');var Redis=require(_0x7acc('0x4'));var db=require(_0x7acc('0x5'))['db'];var utils=require(_0x7acc('0x6'));var logger=require(_0x7acc('0x7'))(_0x7acc('0x8'));var config=require('../../config/environment');var jayson=require(_0x7acc('0x9'));var client=jayson[_0x7acc('0xa')][_0x7acc('0xb')]({'port':0x232a});config[_0x7acc('0xc')]=_[_0x7acc('0xd')](config[_0x7acc('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappInteraction.socket')[_0x7acc('0xe')](socket);function respondWithRpcPromise(_0x16e7b5,_0x626776,_0x5ca1f0){return new BPromise(function(_0x26c691,_0x1a65fe){return client[_0x7acc('0xf')](_0x16e7b5,_0x5ca1f0)['then'](function(_0x5fdfa3){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x626776,_0x7acc('0x10'));logger[_0x7acc('0x11')](_0x7acc('0x12'),_0x626776,_0x7acc('0x10'),JSON[_0x7acc('0x13')](_0x5fdfa3));if(_0x5fdfa3[_0x7acc('0x14')]){if(_0x5fdfa3['error'][_0x7acc('0x15')]===0x1f4){logger['error'](_0x7acc('0x16'),_0x626776,_0x5fdfa3[_0x7acc('0x14')][_0x7acc('0x17')]);return _0x1a65fe(_0x5fdfa3[_0x7acc('0x14')][_0x7acc('0x17')]);}logger[_0x7acc('0x14')](_0x7acc('0x16'),_0x626776,_0x5fdfa3['error'][_0x7acc('0x17')]);return _0x26c691(_0x5fdfa3[_0x7acc('0x14')][_0x7acc('0x17')]);}else{logger[_0x7acc('0x18')](_0x7acc('0x16'),_0x626776,_0x7acc('0x10'));_0x26c691(_0x5fdfa3[_0x7acc('0x19')][_0x7acc('0x17')]);}})[_0x7acc('0x1a')](function(_0x38d14e){logger['error'](_0x7acc('0x16'),_0x626776,_0x38d14e);_0x1a65fe(_0x38d14e);});});}exports[_0x7acc('0x1b')]=function(_0x1573f7){var _0xddc25d=this;return new Promise(function(_0x1d3ce5,_0x60ce){return db[_0x7acc('0x1c')][_0x7acc('0x1d')](_0x1573f7[_0x7acc('0x1e')],{'raw':_0x1573f7[_0x7acc('0x1f')]?_0x1573f7[_0x7acc('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1573f7[_0x7acc('0x1f')]?_0x1573f7[_0x7acc('0x1f')][_0x7acc('0x20')]||null:null,'attributes':_0x1573f7[_0x7acc('0x1f')]?_0x1573f7['options'][_0x7acc('0x21')]||null:null,'limit':_0x1573f7['options']?_0x1573f7[_0x7acc('0x1f')][_0x7acc('0x22')]||null:null})[_0x7acc('0x23')](function(_0x288ddd){logger[_0x7acc('0x18')]('UpdateWhatsappInteraction',_0x1573f7);logger[_0x7acc('0x11')](_0x7acc('0x1b'),_0x1573f7,JSON[_0x7acc('0x13')](_0x288ddd));_0x1d3ce5(_0x288ddd);})[_0x7acc('0x1a')](function(_0x2a7aa9){logger[_0x7acc('0x14')]('UpdateWhatsappInteraction',_0x2a7aa9[_0x7acc('0x17')],_0x1573f7);_0x60ce(_0xddc25d[_0x7acc('0x14')](0x1f4,_0x2a7aa9['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x18fc83){return new Promise(function(_0xe541f9,_0x40b230){return db[_0x7acc('0x1c')][_0x7acc('0x24')]({'where':_0x18fc83[_0x7acc('0x1f')]?_0x18fc83[_0x7acc('0x1f')][_0x7acc('0x20')]||null:null})[_0x7acc('0x23')](function(_0x339553){if(_0x339553){return _0x339553[_0x7acc('0x25')](_0x18fc83[_0x7acc('0x1e')]['ids'],_[_0x7acc('0x26')](_0x18fc83[_0x7acc('0x1e')],[_0x7acc('0x27'),'id'])||{});}})[_0x7acc('0x28')](function(_0x27da98){logger[_0x7acc('0x18')](_0x7acc('0x29'),_0x18fc83);logger[_0x7acc('0x11')](_0x7acc('0x29'),_0x18fc83,JSON[_0x7acc('0x13')](_0x27da98));_0xe541f9(_0x27da98);})[_0x7acc('0x1a')](function(_0x2a4cc2){logger['error'](_0x7acc('0x29'),_0x2a4cc2[_0x7acc('0x17')],_0x18fc83);_0x40b230(_this[_0x7acc('0x14')](0x1f4,_0x2a4cc2['message']));});});};
\ No newline at end of file
+var _0x9336=['body','options','raw','where','attributes','limit','debug','stringify','catch','AddTagsToWhatsappInteraction','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9336,0x19b));var _0x6933=function(_0x3c1b5f,_0x2295f0){_0x3c1b5f=_0x3c1b5f-0x0;var _0x523918=_0x9336[_0x3c1b5f];return _0x523918;};'use strict';var _=require(_0x6933('0x0'));var util=require(_0x6933('0x1'));var moment=require(_0x6933('0x2'));var BPromise=require(_0x6933('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6933('0x4'));var db=require(_0x6933('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6933('0x6'))(_0x6933('0x7'));var config=require('../../config/environment');var jayson=require(_0x6933('0x8'));var client=jayson[_0x6933('0x9')][_0x6933('0xa')]({'port':0x232a});config[_0x6933('0xb')]=_[_0x6933('0xc')](config['redis'],{'host':_0x6933('0xd'),'port':0x18eb});var socket=require(_0x6933('0xe'))(new Redis(config[_0x6933('0xb')]));require('./whatsappInteraction.socket')[_0x6933('0xf')](socket);function respondWithRpcPromise(_0x13879f,_0x5209e7,_0x38ba76){return new BPromise(function(_0x376da6,_0x1d783d){return client[_0x6933('0x10')](_0x13879f,_0x38ba76)[_0x6933('0x11')](function(_0x154f81){logger[_0x6933('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5209e7,_0x6933('0x13'));logger['debug'](_0x6933('0x14'),_0x5209e7,'request\x20sent',JSON['stringify'](_0x154f81));if(_0x154f81[_0x6933('0x15')]){if(_0x154f81[_0x6933('0x15')][_0x6933('0x16')]===0x1f4){logger[_0x6933('0x15')](_0x6933('0x17'),_0x5209e7,_0x154f81[_0x6933('0x15')]['message']);return _0x1d783d(_0x154f81[_0x6933('0x15')][_0x6933('0x18')]);}logger[_0x6933('0x15')](_0x6933('0x17'),_0x5209e7,_0x154f81['error'][_0x6933('0x18')]);return _0x376da6(_0x154f81[_0x6933('0x15')][_0x6933('0x18')]);}else{logger[_0x6933('0x12')](_0x6933('0x17'),_0x5209e7,_0x6933('0x13'));_0x376da6(_0x154f81[_0x6933('0x19')][_0x6933('0x18')]);}})['catch'](function(_0x2951a6){logger['error'](_0x6933('0x17'),_0x5209e7,_0x2951a6);_0x1d783d(_0x2951a6);});});}exports[_0x6933('0x1a')]=function(_0x4a26e9){var _0x1bfa47=this;return new Promise(function(_0xc277fc,_0xfd353e){return db[_0x6933('0x1b')][_0x6933('0x1c')](_0x4a26e9[_0x6933('0x1d')],{'raw':_0x4a26e9[_0x6933('0x1e')]?_0x4a26e9[_0x6933('0x1e')][_0x6933('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a26e9[_0x6933('0x1e')]?_0x4a26e9[_0x6933('0x1e')][_0x6933('0x20')]||null:null,'attributes':_0x4a26e9[_0x6933('0x1e')]?_0x4a26e9[_0x6933('0x1e')][_0x6933('0x21')]||null:null,'limit':_0x4a26e9['options']?_0x4a26e9[_0x6933('0x1e')][_0x6933('0x22')]||null:null})['then'](function(_0x49e7a7){logger[_0x6933('0x12')](_0x6933('0x1a'),_0x4a26e9);logger[_0x6933('0x23')](_0x6933('0x1a'),_0x4a26e9,JSON[_0x6933('0x24')](_0x49e7a7));_0xc277fc(_0x49e7a7);})[_0x6933('0x25')](function(_0xd2065e){logger[_0x6933('0x15')](_0x6933('0x1a'),_0xd2065e[_0x6933('0x18')],_0x4a26e9);_0xfd353e(_0x1bfa47['error'](0x1f4,_0xd2065e[_0x6933('0x18')]));});});};exports[_0x6933('0x26')]=function(_0x1ce9d4){return new Promise(function(_0x391a2a,_0x5e7339){return db[_0x6933('0x1b')]['find']({'where':_0x1ce9d4[_0x6933('0x1e')]?_0x1ce9d4['options'][_0x6933('0x20')]||null:null})[_0x6933('0x11')](function(_0x36e06d){if(_0x36e06d){return _0x36e06d[_0x6933('0x27')](_0x1ce9d4[_0x6933('0x1d')][_0x6933('0x28')],_[_0x6933('0x29')](_0x1ce9d4[_0x6933('0x1d')],[_0x6933('0x28'),'id'])||{});}})[_0x6933('0x2a')](function(_0x5da64b){logger[_0x6933('0x12')](_0x6933('0x2b'),_0x1ce9d4);logger['debug'](_0x6933('0x2b'),_0x1ce9d4,JSON[_0x6933('0x24')](_0x5da64b));_0x391a2a(_0x5da64b);})['catch'](function(_0x205ef6){logger[_0x6933('0x15')](_0x6933('0x2b'),_0x205ef6[_0x6933('0x18')],_0x1ce9d4);_0x5e7339(_this[_0x6933('0x15')](0x1f4,_0x205ef6[_0x6933('0x18')]));});});};
\ No newline at end of file
index 520c16e..bc88660 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd45b=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x7aa516,_0x3bf79e){var _0x268c65=function(_0x1acc95){while(--_0x1acc95){_0x7aa516['push'](_0x7aa516['shift']());}};_0x268c65(++_0x3bf79e);}(_0xd45b,0x173));var _0xbd45=function(_0x3a0b17,_0x5d2d81){_0x3a0b17=_0x3a0b17-0x0;var _0x4fc88a=_0xd45b[_0x3a0b17];return _0x4fc88a;};'use strict';var WhatsappInteractionEvents=require(_0xbd45('0x0'));var events=[_0xbd45('0x1'),_0xbd45('0x2'),_0xbd45('0x3')];function createListener(_0x2fc671,_0x44b800){return function(_0x330406){_0x44b800[_0xbd45('0x4')](_0x2fc671,_0x330406);};}function removeListener(_0x17a87c,_0x219e53){return function(){WhatsappInteractionEvents[_0xbd45('0x5')](_0x17a87c,_0x219e53);};}exports[_0xbd45('0x6')]=function(_0x31c85c){for(var _0x76085c=0x0,_0x313727=events[_0xbd45('0x7')];_0x76085c<_0x313727;_0x76085c++){var _0x192948=events[_0x76085c];var _0xe46bbc=createListener(_0xbd45('0x8')+_0x192948,_0x31c85c);WhatsappInteractionEvents['on'](_0x192948,_0xe46bbc);}};
\ No newline at end of file
+var _0xa896=['removeListener','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit'];(function(_0x136ed6,_0x1df16d){var _0x3bbfb9=function(_0xfc4332){while(--_0xfc4332){_0x136ed6['push'](_0x136ed6['shift']());}};_0x3bbfb9(++_0x1df16d);}(_0xa896,0xe3));var _0x6a89=function(_0x5810c0,_0x33634c){_0x5810c0=_0x5810c0-0x0;var _0x469eeb=_0xa896[_0x5810c0];return _0x469eeb;};'use strict';var WhatsappInteractionEvents=require(_0x6a89('0x0'));var events=[_0x6a89('0x1'),_0x6a89('0x2'),'update'];function createListener(_0x413423,_0x3fb46d){return function(_0x5e25cb){_0x3fb46d[_0x6a89('0x3')](_0x413423,_0x5e25cb);};}function removeListener(_0x337efb,_0x5e0cf6){return function(){WhatsappInteractionEvents[_0x6a89('0x4')](_0x337efb,_0x5e0cf6);};}exports[_0x6a89('0x5')]=function(_0x4cadfc){for(var _0x42fd97=0x0,_0x13700a=events['length'];_0x42fd97<_0x13700a;_0x42fd97++){var _0x5cb10a=events[_0x42fd97];var _0x1feaef=createListener(_0x6a89('0x6')+_0x5cb10a,_0x4cadfc);WhatsappInteractionEvents['on'](_0x5cb10a,_0x1feaef);}};
\ No newline at end of file
index b37dfd6..111abb5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3368=['update','put','/:id/accept','accept','reject','delete','destroy','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','describe','/:id','whatsapp','create','/:id/status','status'];(function(_0x4e566a,_0xb29bf8){var _0xbbb984=function(_0x1521fa){while(--_0x1521fa){_0x4e566a['push'](_0x4e566a['shift']());}};_0xbbb984(++_0xb29bf8);}(_0x3368,0x18e));var _0x8336=function(_0x486eff,_0x5cb3b0){_0x486eff=_0x486eff-0x0;var _0x95293b=_0x3368[_0x486eff];return _0x95293b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8336('0x0'));var timeout=require('connect-timeout');var express=require(_0x8336('0x1'));var router=express[_0x8336('0x2')]();var fs_extra=require(_0x8336('0x3'));var auth=require(_0x8336('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8336('0x5'));var controller=require(_0x8336('0x6'));router[_0x8336('0x7')]('/',auth[_0x8336('0x8')](),controller[_0x8336('0x9')]);router[_0x8336('0x7')]('/describe',auth[_0x8336('0x8')](),controller[_0x8336('0xa')]);router['get'](_0x8336('0xb'),auth[_0x8336('0x8')](),controller['show']);router['post']('/',auth[_0x8336('0x8')](),interaction['tracked'](_0x8336('0xc'),'whatsappmessage:create'),controller[_0x8336('0xd')]);router['post'](_0x8336('0xe'),controller[_0x8336('0xf')]);router['put'](_0x8336('0xb'),auth[_0x8336('0x8')](),controller[_0x8336('0x10')]);router[_0x8336('0x11')](_0x8336('0x12'),auth[_0x8336('0x8')](),controller[_0x8336('0x13')]);router[_0x8336('0x11')]('/:id/reject',auth['isAuthenticated'](),controller[_0x8336('0x14')]);router[_0x8336('0x15')](_0x8336('0xb'),auth[_0x8336('0x8')](),controller[_0x8336('0x16')]);module['exports']=router;
\ No newline at end of file
+var _0x5fa6=['delete','/:id','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','/:id/accept','/:id/reject','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5fa6,0xa5));var _0x65fa=function(_0x36ba80,_0x284c26){_0x36ba80=_0x36ba80-0x0;var _0x135582=_0x5fa6[_0x36ba80];return _0x135582;};'use strict';var multer=require('multer');var util=require(_0x65fa('0x0'));var path=require(_0x65fa('0x1'));var timeout=require(_0x65fa('0x2'));var express=require('express');var router=express[_0x65fa('0x3')]();var fs_extra=require(_0x65fa('0x4'));var auth=require(_0x65fa('0x5'));var interaction=require(_0x65fa('0x6'));var config=require('../../config/environment');var controller=require(_0x65fa('0x7'));router[_0x65fa('0x8')]('/',auth[_0x65fa('0x9')](),controller[_0x65fa('0xa')]);router[_0x65fa('0x8')](_0x65fa('0xb'),auth[_0x65fa('0x9')](),controller[_0x65fa('0xc')]);router[_0x65fa('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x65fa('0xd')]('/',auth[_0x65fa('0x9')](),interaction[_0x65fa('0xe')](_0x65fa('0xf'),_0x65fa('0x10')),controller[_0x65fa('0x11')]);router[_0x65fa('0xd')](_0x65fa('0x12'),controller[_0x65fa('0x13')]);router[_0x65fa('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x65fa('0x14')](_0x65fa('0x15'),auth[_0x65fa('0x9')](),controller['accept']);router['put'](_0x65fa('0x16'),auth[_0x65fa('0x9')](),controller[_0x65fa('0x17')]);router[_0x65fa('0x18')](_0x65fa('0x19'),auth[_0x65fa('0x9')](),controller['destroy']);module[_0x65fa('0x1a')]=router;
\ No newline at end of file
index c1f6c94..7f32437 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcd2a=['STRING','DATE','sequelize','TEXT','BOOLEAN','ENUM','out'];(function(_0x38baac,_0x2772b3){var _0x47baf1=function(_0x5646a8){while(--_0x5646a8){_0x38baac['push'](_0x38baac['shift']());}};_0x47baf1(++_0x2772b3);}(_0xcd2a,0x1d7));var _0xacd2=function(_0x119d25,_0x588c8){_0x119d25=_0x119d25-0x0;var _0x39cf30=_0xcd2a[_0x119d25];return _0x39cf30;};'use strict';var Sequelize=require(_0xacd2('0x0'));module['exports']={'body':{'type':Sequelize[_0xacd2('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xacd2('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xacd2('0x3')]('in',_0xacd2('0x4')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xacd2('0x5')](0xbe)},'phone':{'type':Sequelize[_0xacd2('0x5')]},'readAt':{'type':Sequelize[_0xacd2('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xacd2('0x5')]},'providerResponse':{'type':Sequelize[_0xacd2('0x1')]}};
\ No newline at end of file
+var _0xd6ec=['medium','BOOLEAN','ENUM','out','STRING','DATE','exports','TEXT'];(function(_0x582dc0,_0x2a7700){var _0x1a8848=function(_0x2792f6){while(--_0x2792f6){_0x582dc0['push'](_0x582dc0['shift']());}};_0x1a8848(++_0x2a7700);}(_0xd6ec,0x6e));var _0xcd6e=function(_0x3b46e6,_0xe959e0){_0x3b46e6=_0x3b46e6-0x0;var _0x24db7a=_0xd6ec[_0x3b46e6];return _0x24db7a;};'use strict';var Sequelize=require('sequelize');module[_0xcd6e('0x0')]={'body':{'type':Sequelize[_0xcd6e('0x1')](_0xcd6e('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xcd6e('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xcd6e('0x4')]('in',_0xcd6e('0x5')),'defaultValue':_0xcd6e('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xcd6e('0x6')](0xbe)},'phone':{'type':Sequelize[_0xcd6e('0x6')]},'readAt':{'type':Sequelize[_0xcd6e('0x7')]},'secret':{'type':Sequelize[_0xcd6e('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xcd6e('0x6')]},'providerResponse':{'type':Sequelize[_0xcd6e('0x1')]}};
\ No newline at end of file
index 1d5c6a2..f4bd5c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6382=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','client','request','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','stack','name','send','index','WhatsappMessage','fieldName','type','model','map','keys','query','filters','attributes','intersection','fields','length','nolimit','limit','sort','where','pick','filter','merge','includeAll','include','findAll','show','params','options','find','create','body','describe','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','WhatsappInteraction','isNil','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','interface','channel','event','EventManager','whatsapp-interactions','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','sequelize','email','SIP/%s','motionChannel','rejectmessage','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format'];(function(_0x3b9d0e,_0x5b2050){var _0x580e92=function(_0x5b3406){while(--_0x5b3406){_0x3b9d0e['push'](_0x3b9d0e['shift']());}};_0x580e92(++_0x5b2050);}(_0x6382,0x10b));var _0x2638=function(_0x543a9d,_0x4200f5){_0x543a9d=_0x543a9d-0x0;var _0x50ff9f=_0x6382[_0x543a9d];return _0x50ff9f;};'use strict';var emlformat=require(_0x2638('0x0'));var rimraf=require(_0x2638('0x1'));var zipdir=require(_0x2638('0x2'));var jsonpatch=require(_0x2638('0x3'));var rp=require(_0x2638('0x4'));var moment=require(_0x2638('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2638('0x6'));var util=require(_0x2638('0x7'));var path=require(_0x2638('0x8'));var sox=require(_0x2638('0x9'));var csv=require(_0x2638('0xa'));var ejs=require(_0x2638('0xb'));var fs=require('fs');var fs_extra=require(_0x2638('0xc'));var _=require(_0x2638('0xd'));var squel=require(_0x2638('0xe'));var crypto=require(_0x2638('0xf'));var jsforce=require(_0x2638('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2638('0xa'));var querystring=require(_0x2638('0x11'));var Papa=require(_0x2638('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2638('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x2638('0x14'));var licenseUtil=require(_0x2638('0x15'));var db=require(_0x2638('0x16'))['db'];config[_0x2638('0x17')]=_[_0x2638('0x18')](config['redis'],{'host':_0x2638('0x19'),'port':0x18eb});var socket=require(_0x2638('0x1a'))(new Redis(config['redis']));require(_0x2638('0x1b'))[_0x2638('0x1c')](socket);var jayson=require('jayson/promise');var client=jayson[_0x2638('0x1d')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xe63d77,_0xeb4e30,_0x23bbb0,_0x6e358c){return new BPromise(function(_0x58f90a,_0xa15ce9){var _0x364a49=_0x6e358c||client;return _0x364a49[_0x2638('0x1e')](_0xe63d77,_0x23bbb0)['then'](function(_0x378a73){logger[_0x2638('0x1f')](_0x2638('0x20'),_0xeb4e30,'request\x20sent');logger[_0x2638('0x21')](_0x2638('0x22'),_0xeb4e30,_0x2638('0x23'),JSON['stringify'](_0x378a73));if(_0x378a73['error']){if(_0x378a73[_0x2638('0x24')]['code']===0x1f4){logger[_0x2638('0x24')](_0x2638('0x20'),_0xeb4e30,_0x378a73[_0x2638('0x24')][_0x2638('0x25')]);return _0xa15ce9(_0x378a73[_0x2638('0x24')]['message']);}logger[_0x2638('0x24')](_0x2638('0x20'),_0xeb4e30,_0x378a73[_0x2638('0x24')][_0x2638('0x25')]);return _0x58f90a(_0x378a73[_0x2638('0x24')][_0x2638('0x25')]);}else{logger[_0x2638('0x1f')](_0x2638('0x20'),_0xeb4e30,_0x2638('0x23'));_0x58f90a(_0x378a73['result'][_0x2638('0x25')]);}})[_0x2638('0x26')](function(_0x593514){logger['error'](_0x2638('0x20'),_0xeb4e30,_0x593514);_0xa15ce9(_0x593514);});});}function respondWithStatusCode(_0x2796c8,_0x3227dd){_0x3227dd=_0x3227dd||0xcc;return function(_0x5deaab){if(_0x5deaab){return _0x2796c8[_0x2638('0x27')](_0x3227dd);}return _0x2796c8[_0x2638('0x28')](_0x3227dd)[_0x2638('0x29')]();};}function respondWithResult(_0x534737,_0x575ae7){_0x575ae7=_0x575ae7||0xc8;return function(_0x942463){if(_0x942463){return _0x534737[_0x2638('0x28')](_0x575ae7)['json'](_0x942463);}};}function respondWithFilteredResult(_0x3494bc,_0x3c2ff2){return function(_0x332882){if(_0x332882){var _0xaff80f=typeof _0x3c2ff2[_0x2638('0x2a')]===_0x2638('0x2b')&&typeof _0x3c2ff2['limit']===_0x2638('0x2b');var _0x454010=_0x332882[_0x2638('0x2c')];var _0x3e21c5=_0xaff80f?0x0:_0x3c2ff2[_0x2638('0x2a')];var _0xdb66e=_0xaff80f?_0x332882[_0x2638('0x2c')]:_0x3c2ff2[_0x2638('0x2a')]+_0x3c2ff2['limit'];var _0x292c74;if(_0xdb66e>=_0x454010){_0xdb66e=_0x454010;_0x292c74=0xc8;}else{_0x292c74=0xce;}_0x3494bc[_0x2638('0x28')](_0x292c74);return _0x3494bc[_0x2638('0x2d')](_0x2638('0x2e'),_0x3e21c5+'-'+_0xdb66e+'/'+_0x454010)[_0x2638('0x2f')](_0x332882);}return null;};}function patchUpdates(_0x1ea202){return function(_0x31db5a){try{jsonpatch[_0x2638('0x30')](_0x31db5a,_0x1ea202,!![]);}catch(_0x44bdb8){return BPromise[_0x2638('0x31')](_0x44bdb8);}return _0x31db5a['save']();};}function saveUpdates(_0x1c2c8e,_0x4f6590){return function(_0x23ace8){if(_0x23ace8){return _0x23ace8[_0x2638('0x32')](_0x1c2c8e)[_0x2638('0x33')](function(_0x504e60){return _0x504e60;});}return null;};}function removeEntity(_0x3268f9,_0x5507c9){return function(_0x17e6da){if(_0x17e6da){return _0x17e6da[_0x2638('0x34')]()[_0x2638('0x33')](function(){_0x3268f9['status'](0xcc)[_0x2638('0x29')]();});}};}function handleEntityNotFound(_0x33cc25,_0x5d47f0){return function(_0x98773d){if(!_0x98773d){_0x33cc25['sendStatus'](0x194);}return _0x98773d;};}function handleError(_0x20d2cc,_0x210fc7){_0x210fc7=_0x210fc7||0x1f4;return function(_0x3fe59b){logger['error'](_0x3fe59b[_0x2638('0x35')]);if(_0x3fe59b[_0x2638('0x36')]){delete _0x3fe59b[_0x2638('0x36')];}_0x20d2cc[_0x2638('0x28')](_0x210fc7)[_0x2638('0x37')](_0x3fe59b);};}exports[_0x2638('0x38')]=function(_0x11c57e,_0x441a07){var _0x5aab9={},_0x5c6de0={},_0x3c1148={'count':0x0,'rows':[]};var _0x2dc4ef=_['map'](db[_0x2638('0x39')]['rawAttributes'],function(_0x3317e3){return{'name':_0x3317e3[_0x2638('0x3a')],'type':_0x3317e3[_0x2638('0x3b')]['key']};});_0x5c6de0[_0x2638('0x3c')]=_[_0x2638('0x3d')](_0x2dc4ef,_0x2638('0x36'));_0x5c6de0['query']=_[_0x2638('0x3e')](_0x11c57e[_0x2638('0x3f')]);_0x5c6de0[_0x2638('0x40')]=_['intersection'](_0x5c6de0['model'],_0x5c6de0[_0x2638('0x3f')]);_0x5aab9[_0x2638('0x41')]=_[_0x2638('0x42')](_0x5c6de0[_0x2638('0x3c')],qs[_0x2638('0x43')](_0x11c57e[_0x2638('0x3f')]['fields']));_0x5aab9['attributes']=_0x5aab9['attributes'][_0x2638('0x44')]?_0x5aab9[_0x2638('0x41')]:_0x5c6de0['model'];if(!_0x11c57e[_0x2638('0x3f')]['hasOwnProperty'](_0x2638('0x45'))){_0x5aab9[_0x2638('0x46')]=qs['limit'](_0x11c57e[_0x2638('0x3f')][_0x2638('0x46')]);_0x5aab9[_0x2638('0x2a')]=qs[_0x2638('0x2a')](_0x11c57e[_0x2638('0x3f')][_0x2638('0x2a')]);}_0x5aab9['order']=qs[_0x2638('0x47')](_0x11c57e[_0x2638('0x3f')][_0x2638('0x47')]);_0x5aab9[_0x2638('0x48')]=qs[_0x2638('0x40')](_[_0x2638('0x49')](_0x11c57e[_0x2638('0x3f')],_0x5c6de0['filters']),_0x2dc4ef);if(_0x11c57e[_0x2638('0x3f')][_0x2638('0x4a')]){_0x5aab9[_0x2638('0x48')]=_[_0x2638('0x4b')](_0x5aab9[_0x2638('0x48')],{'$or':_[_0x2638('0x3d')](_0x2dc4ef,function(_0x5b1c41){if(_0x5b1c41[_0x2638('0x3b')]!=='VIRTUAL'){var _0x10bbc3={};_0x10bbc3[_0x5b1c41['name']]={'$like':'%'+_0x11c57e[_0x2638('0x3f')][_0x2638('0x4a')]+'%'};return _0x10bbc3;}})});}_0x5aab9=_[_0x2638('0x4b')]({},_0x5aab9,_0x11c57e['options']);var _0x17e241={'where':_0x5aab9['where']};return db[_0x2638('0x39')][_0x2638('0x2c')](_0x17e241)[_0x2638('0x33')](function(_0x11d4f6){_0x3c1148[_0x2638('0x2c')]=_0x11d4f6;if(_0x11c57e[_0x2638('0x3f')][_0x2638('0x4c')]){_0x5aab9[_0x2638('0x4d')]=[{'all':!![]}];}return db[_0x2638('0x39')][_0x2638('0x4e')](_0x5aab9);})['then'](function(_0x5c825b){_0x3c1148['rows']=_0x5c825b;return _0x3c1148;})[_0x2638('0x33')](respondWithFilteredResult(_0x441a07,_0x5aab9))['catch'](handleError(_0x441a07,null));};exports[_0x2638('0x4f')]=function(_0x420128,_0x5238b2){var _0x4ea05c={'raw':!![],'where':{'id':_0x420128[_0x2638('0x50')]['id']}},_0x12a1da={};_0x12a1da[_0x2638('0x3c')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x12a1da[_0x2638('0x3f')]=_[_0x2638('0x3e')](_0x420128[_0x2638('0x3f')]);_0x12a1da['filters']=_[_0x2638('0x42')](_0x12a1da[_0x2638('0x3c')],_0x12a1da[_0x2638('0x3f')]);_0x4ea05c[_0x2638('0x41')]=_[_0x2638('0x42')](_0x12a1da[_0x2638('0x3c')],qs[_0x2638('0x43')](_0x420128['query'][_0x2638('0x43')]));_0x4ea05c['attributes']=_0x4ea05c[_0x2638('0x41')]['length']?_0x4ea05c[_0x2638('0x41')]:_0x12a1da[_0x2638('0x3c')];if(_0x420128['query'][_0x2638('0x4c')]){_0x4ea05c[_0x2638('0x4d')]=[{'all':!![]}];}_0x4ea05c=_[_0x2638('0x4b')]({},_0x4ea05c,_0x420128[_0x2638('0x51')]);return db[_0x2638('0x39')][_0x2638('0x52')](_0x4ea05c)[_0x2638('0x33')](handleEntityNotFound(_0x5238b2,null))['then'](respondWithResult(_0x5238b2,null))[_0x2638('0x26')](handleError(_0x5238b2,null));};exports[_0x2638('0x53')]=function(_0x20cc49,_0x3ff4a2){return db[_0x2638('0x39')][_0x2638('0x53')](_0x20cc49['body'],{})[_0x2638('0x33')](respondWithResult(_0x3ff4a2,0xc9))[_0x2638('0x26')](handleError(_0x3ff4a2,null));};exports[_0x2638('0x32')]=function(_0x9367d9,_0x8299a9){if(_0x9367d9[_0x2638('0x54')]['id']){delete _0x9367d9[_0x2638('0x54')]['id'];}return db[_0x2638('0x39')]['find']({'where':{'id':_0x9367d9[_0x2638('0x50')]['id']}})[_0x2638('0x33')](handleEntityNotFound(_0x8299a9,null))[_0x2638('0x33')](saveUpdates(_0x9367d9['body'],null))['then'](respondWithResult(_0x8299a9,null))[_0x2638('0x26')](handleError(_0x8299a9,null));};exports[_0x2638('0x34')]=function(_0x96f419,_0x36edea){return db['WhatsappMessage'][_0x2638('0x52')]({'where':{'id':_0x96f419[_0x2638('0x50')]['id']}})[_0x2638('0x33')](handleEntityNotFound(_0x36edea,null))[_0x2638('0x33')](removeEntity(_0x36edea,null))['catch'](handleError(_0x36edea,null));};exports['describe']=function(_0x86250e,_0x108939){return db[_0x2638('0x39')][_0x2638('0x55')]()[_0x2638('0x33')](respondWithResult(_0x108939,null))[_0x2638('0x26')](handleError(_0x108939,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x2638('0x56')]=function(_0x2780f0,_0x5c40de,_0x4792a6){var _0x3ad06f={'agent':{},'channel':'whatsapp'};if(_0x2780f0[_0x2638('0x54')]['id']){delete _0x2780f0[_0x2638('0x54')]['id'];}_0x2780f0[_0x2638('0x54')][_0x2638('0x57')]=!![];_0x2780f0[_0x2638('0x54')][_0x2638('0x58')]=moment()[_0x2638('0x59')](_0x2638('0x5a'));_0x2780f0[_0x2638('0x54')]['UserId']=_0x2780f0[_0x2638('0x54')][_0x2638('0x5b')]||_0x2780f0['user']['id'];_0x3ad06f[_0x2638('0x5c')]['id']=_0x2780f0[_0x2638('0x54')]['UserId'];return db[_0x2638('0x39')][_0x2638('0x52')]({'where':{'id':_0x2780f0[_0x2638('0x50')]['id'],'UserId':null}})[_0x2638('0x33')](handleEntityNotFound(_0x5c40de,null))[_0x2638('0x33')](saveUpdates(_0x2780f0[_0x2638('0x54')],null))['then'](function(_0x4f5c6e){if(_0x4f5c6e){_0x3ad06f['message']=_0x4f5c6e[_0x2638('0x5d')]({'plain':!![]});return db[_0x2638('0x5e')][_0x2638('0x52')]({'where':{'id':_0x4f5c6e['WhatsappInteractionId']}});}return null;})[_0x2638('0x33')](handleEntityNotFound(_0x5c40de,null))[_0x2638('0x33')](function(_0x2c9880){if(_0x2c9880){return _0x2c9880[_0x2638('0x32')]({'UserId':_0x2780f0[_0x2638('0x54')][_0x2638('0x5b')],'read1stAt':_[_0x2638('0x5f')](_0x2c9880['read1stAt'])?moment()['format'](_0x2638('0x5a')):undefined});}return null;})[_0x2638('0x33')](function(_0x164864){if(_0x164864){_0x3ad06f[_0x2638('0x60')]=_0x164864[_0x2638('0x5d')]({'plain':!![]});interaction_log['info'](_0x2638('0x61'),_0x2780f0[_0x2638('0x62')]['id'],_0x2780f0[_0x2638('0x62')][_0x2638('0x36')],_0x2780f0[_0x2638('0x62')][_0x2638('0x63')],_0x3ad06f[_0x2638('0x60')]['id'],_0x2780f0[_0x2638('0x54')]?JSON[_0x2638('0x64')](_0x2780f0[_0x2638('0x54')]):'null');return respondWithRpcPromise(_0x2638('0x65'),_0x2638('0x66'),_0x3ad06f);}return null;})[_0x2638('0x33')](function(_0x2f9f8a){var _0x425bfe=_0x2638('0x67')+_0x2f9f8a[_0x2638('0x25')][_0x2638('0x68')];return db['sequelize'][_0x2638('0x3f')](_0x425bfe,{'type':db[_0x2638('0x69')][_0x2638('0x6a')][_0x2638('0x6b')],'raw':!![]})[_0x2638('0x33')](function(_0x35b469){return _0x35b469;});})[_0x2638('0x33')](function(_0x48b66a){if(_0x48b66a){_0x3ad06f[_0x2638('0x25')][_0x2638('0x6c')]=_0x48b66a[0x0];if(!_0x2780f0[_0x2638('0x54')][_0x2638('0x5b')])return;return db[_0x2638('0x6d')][_0x2638('0x52')]({'where':{'id':_0x2780f0['body'][_0x2638('0x5b')],'role':_0x2638('0x5c')},'attributes':['id',_0x2638('0x36'),_0x2638('0x6e'),'email',_0x2638('0x6f')],'raw':!![]});}return null;})[_0x2638('0x33')](function(_0x22c2d0){if(!_0x22c2d0)return null;_0x3ad06f[_0x2638('0x25')]['agent']=_0x22c2d0;return _0x3ad06f;})[_0x2638('0x33')](function(_0x38988d){if(_0x38988d){if(_0x2780f0[_0x2638('0x54')]['manual']){_0x3ad06f[_0x2638('0x25')][_0x2638('0x70')]=util[_0x2638('0x59')]('SIP/%s',_0x2780f0[_0x2638('0x62')][_0x2638('0x36')]);_0x3ad06f['message']['channel']=_0x3ad06f[_0x2638('0x71')];_0x3ad06f[_0x2638('0x25')]['motionChannel']=_0x3ad06f[_0x2638('0x71')];_0x3ad06f[_0x2638('0x25')][_0x2638('0x72')]=_0x2638('0x56');return respondWithRpcPromise(_0x2638('0x73'),'EventManager',{'event':'acceptmessage','message':_0x3ad06f['message']},client9002)[_0x2638('0x33')](function(){return _0x3ad06f;});}return _0x3ad06f;}return null;})[_0x2638('0x33')](respondWithResult(_0x5c40de,null))['catch'](handleError(_0x5c40de,null));};var interaction_log=require(_0x2638('0x13'))(_0x2638('0x74'));exports[_0x2638('0x31')]=function(_0x1bc01e,_0x42e115,_0xcefe08){var _0x43c8f8={'agent':{},'channel':'whatsapp'};if(_0x1bc01e[_0x2638('0x54')]['id']){delete _0x1bc01e[_0x2638('0x54')]['id'];}_0x1bc01e[_0x2638('0x54')][_0x2638('0x5b')]=_0x1bc01e['body'][_0x2638('0x5b')]||_0x1bc01e['user']['id'];_0x43c8f8['agent']['id']=_0x1bc01e[_0x2638('0x54')]['UserId'];return db[_0x2638('0x39')]['find']({'where':{'id':_0x1bc01e[_0x2638('0x50')]['id'],'UserId':null}})[_0x2638('0x33')](handleEntityNotFound(_0x42e115,null))[_0x2638('0x33')](function(_0x539045){if(_0x539045){_0x43c8f8['message']=_0x539045['get']({'plain':!![]});return db[_0x2638('0x5e')][_0x2638('0x52')]({'where':{'id':_0x539045[_0x2638('0x75')]}});}return null;})['then'](handleEntityNotFound(_0x42e115,null))[_0x2638('0x33')](function(_0x54f79a){if(_0x54f79a){_0x43c8f8[_0x2638('0x60')]=_0x54f79a[_0x2638('0x5d')]({'plain':!![]});interaction_log[_0x2638('0x1f')](_0x2638('0x76'),_0x1bc01e[_0x2638('0x62')]['id'],_0x1bc01e[_0x2638('0x62')]['name'],_0x1bc01e[_0x2638('0x62')][_0x2638('0x63')],_0x43c8f8['interaction']['id'],_0x1bc01e[_0x2638('0x54')]?JSON[_0x2638('0x64')](_0x1bc01e[_0x2638('0x54')]):_0x2638('0x77'));return respondWithRpcPromise(_0x2638('0x78'),'rejectMessage',_0x43c8f8);}return null;})[_0x2638('0x33')](function(_0x1108b0){var _0x277992=_0x2638('0x67')+_0x1108b0[_0x2638('0x25')][_0x2638('0x68')];return db[_0x2638('0x79')][_0x2638('0x3f')](_0x277992,{'type':db[_0x2638('0x69')][_0x2638('0x6a')]['SELECT'],'raw':!![]})['then'](function(_0x4921b9){return _0x4921b9;});})[_0x2638('0x33')](function(_0x3cf0aa){if(_0x3cf0aa){_0x43c8f8[_0x2638('0x25')][_0x2638('0x6c')]=_0x3cf0aa[0x0];if(!_0x1bc01e['body'][_0x2638('0x5b')])return;return db['User'][_0x2638('0x52')]({'where':{'id':_0x1bc01e[_0x2638('0x54')][_0x2638('0x5b')],'role':_0x2638('0x5c')},'attributes':['id',_0x2638('0x36'),_0x2638('0x6e'),_0x2638('0x7a'),'internal'],'raw':!![]});}return null;})[_0x2638('0x33')](function(_0x5df4cf){if(!_0x5df4cf)return null;_0x43c8f8[_0x2638('0x25')]['agent']=_0x5df4cf;return _0x43c8f8;})[_0x2638('0x33')](function(_0x18c12a){if(_0x18c12a){_0x18c12a[_0x2638('0x25')][_0x2638('0x70')]=util['format'](_0x2638('0x7b'),_0x1bc01e['user'][_0x2638('0x36')]);_0x18c12a['message'][_0x2638('0x71')]=_0x43c8f8[_0x2638('0x71')];_0x18c12a['message'][_0x2638('0x7c')]=_0x43c8f8[_0x2638('0x71')];_0x18c12a['message'][_0x2638('0x72')]=_0x2638('0x31');respondWithRpcPromise(_0x2638('0x73'),_0x2638('0x73'),{'event':_0x2638('0x7d'),'message':_0x18c12a[_0x2638('0x25')]},client9002);return _0x43c8f8;}return null;})[_0x2638('0x33')](respondWithResult(_0x42e115,null))[_0x2638('0x26')](handleError(_0x42e115,null));};exports[_0x2638('0x28')]=function(_0x34f497,_0x2df668,_0x3baca4){if(_0x34f497[_0x2638('0x54')]['id']){delete _0x34f497[_0x2638('0x54')]['id'];}var _0x3fffb5;return db[_0x2638('0x39')][_0x2638('0x52')]({'where':{'id':_0x34f497[_0x2638('0x50')]['id']}})['then'](handleEntityNotFound(_0x2df668,null))['then'](function(_0x1d111f){if(_0x1d111f){_0x3fffb5=_0x1d111f;return db['WhatsappAccount']['find']({'where':{'id':_0x1d111f['WhatsappAccountId']}});}})[_0x2638('0x33')](handleEntityNotFound(_0x2df668,null))[_0x2638('0x33')](function(_0x447b08){if(_0x447b08){logger[_0x2638('0x21')](_0x2638('0x7e'),_0x2638('0x28'),_0x2638('0x7f'),_0x447b08[_0x2638('0x3b')],util[_0x2638('0x80')](_0x34f497[_0x2638('0x54')],{'showHidden':![],'depth':null}));switch(_0x447b08['type']){case _0x2638('0x81'):if(_0x34f497[_0x2638('0x54')]['MessageSid']&&_0x34f497[_0x2638('0x54')][_0x2638('0x82')]===_0x3fffb5[_0x2638('0x83')]&&_0x34f497[_0x2638('0x54')][_0x2638('0x84')]&&_0x34f497[_0x2638('0x54')][_0x2638('0x84')]===_0x2638('0x57')){return _0x3fffb5[_0x2638('0x32')]({'read':!![]});}else{logger['error'](_0x2638('0x85'),_0x2638('0x28'),_0x2638('0x81'),util[_0x2638('0x80')](_0x34f497['body'],{'showHidden':![],'depth':null}));}break;}return _0x3fffb5;}})[_0x2638('0x33')](respondWithResult(_0x2df668,null))[_0x2638('0x26')](handleError(_0x2df668,null));};
\ No newline at end of file
+var _0x9362=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','http','client','request','then','info','request\x20sent','debug','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','result','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','end','stack','name','status','send','index','WhatsappMessage','fieldName','key','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','include','findAll','rows','show','length','includeAll','catch','create','body','params','find','describe','whatsapp-interactions','accept','whatsapp','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','manual','format','SIP/%s','channel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','email','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x66786b,_0x32ca57){var _0x1be62a=function(_0x12880d){while(--_0x12880d){_0x66786b['push'](_0x66786b['shift']());}};_0x1be62a(++_0x32ca57);}(_0x9362,0x7b));var _0x2936=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9362[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x2936('0x0'));var rimraf=require(_0x2936('0x1'));var zipdir=require(_0x2936('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2936('0x3'));var moment=require(_0x2936('0x4'));var BPromise=require(_0x2936('0x5'));var Mustache=require(_0x2936('0x6'));var util=require(_0x2936('0x7'));var path=require(_0x2936('0x8'));var sox=require(_0x2936('0x9'));var csv=require(_0x2936('0xa'));var ejs=require(_0x2936('0xb'));var fs=require('fs');var fs_extra=require(_0x2936('0xc'));var _=require(_0x2936('0xd'));var squel=require(_0x2936('0xe'));var crypto=require(_0x2936('0xf'));var jsforce=require(_0x2936('0x10'));var deskjs=require(_0x2936('0x11'));var toCsv=require(_0x2936('0xa'));var querystring=require(_0x2936('0x12'));var Papa=require('papaparse');var Redis=require(_0x2936('0x13'));var authService=require(_0x2936('0x14'));var qs=require(_0x2936('0x15'));var as=require(_0x2936('0x16'));var hardwareService=require(_0x2936('0x17'));var logger=require(_0x2936('0x18'))(_0x2936('0x19'));var utils=require(_0x2936('0x1a'));var config=require(_0x2936('0x1b'));var licenseUtil=require(_0x2936('0x1c'));var db=require(_0x2936('0x1d'))['db'];config['redis']=_[_0x2936('0x1e')](config[_0x2936('0x1f')],{'host':_0x2936('0x20'),'port':0x18eb});var socket=require(_0x2936('0x21'))(new Redis(config[_0x2936('0x1f')]));require(_0x2936('0x22'))['register'](socket);var jayson=require(_0x2936('0x23'));var client=jayson['client'][_0x2936('0x24')]({'port':0x232c});var client9002=jayson[_0x2936('0x25')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a2a14,_0x281931,_0xa596a2,_0x15af02){return new BPromise(function(_0x561306,_0x5ba5a4){var _0x3701d4=_0x15af02||client;return _0x3701d4[_0x2936('0x26')](_0x3a2a14,_0xa596a2)[_0x2936('0x27')](function(_0x2d7ed1){logger[_0x2936('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x281931,_0x2936('0x29'));logger[_0x2936('0x2a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x281931,_0x2936('0x29'),JSON[_0x2936('0x2b')](_0x2d7ed1));if(_0x2d7ed1[_0x2936('0x2c')]){if(_0x2d7ed1['error']['code']===0x1f4){logger[_0x2936('0x2c')](_0x2936('0x2d'),_0x281931,_0x2d7ed1[_0x2936('0x2c')][_0x2936('0x2e')]);return _0x5ba5a4(_0x2d7ed1[_0x2936('0x2c')][_0x2936('0x2e')]);}logger[_0x2936('0x2c')]('WhatsappMessage,\x20%s,\x20%s',_0x281931,_0x2d7ed1[_0x2936('0x2c')]['message']);return _0x561306(_0x2d7ed1['error'][_0x2936('0x2e')]);}else{logger[_0x2936('0x28')](_0x2936('0x2d'),_0x281931,_0x2936('0x29'));_0x561306(_0x2d7ed1[_0x2936('0x2f')][_0x2936('0x2e')]);}})['catch'](function(_0x96a077){logger[_0x2936('0x2c')]('WhatsappMessage,\x20%s,\x20%s',_0x281931,_0x96a077);_0x5ba5a4(_0x96a077);});});}function respondWithStatusCode(_0x3e5584,_0x1c954b){_0x1c954b=_0x1c954b||0xcc;return function(_0x37d754){if(_0x37d754){return _0x3e5584[_0x2936('0x30')](_0x1c954b);}return _0x3e5584['status'](_0x1c954b)['end']();};}function respondWithResult(_0x5da6f7,_0xcc33e7){_0xcc33e7=_0xcc33e7||0xc8;return function(_0x109d83){if(_0x109d83){return _0x5da6f7['status'](_0xcc33e7)[_0x2936('0x31')](_0x109d83);}};}function respondWithFilteredResult(_0x4faa9b,_0x8faec0){return function(_0x3cf8f5){if(_0x3cf8f5){var _0x1a739b=typeof _0x8faec0[_0x2936('0x32')]===_0x2936('0x33')&&typeof _0x8faec0[_0x2936('0x34')]===_0x2936('0x33');var _0x587774=_0x3cf8f5[_0x2936('0x35')];var _0x3266d6=_0x1a739b?0x0:_0x8faec0[_0x2936('0x32')];var _0x49422d=_0x1a739b?_0x3cf8f5[_0x2936('0x35')]:_0x8faec0[_0x2936('0x32')]+_0x8faec0[_0x2936('0x34')];var _0x53a509;if(_0x49422d>=_0x587774){_0x49422d=_0x587774;_0x53a509=0xc8;}else{_0x53a509=0xce;}_0x4faa9b['status'](_0x53a509);return _0x4faa9b[_0x2936('0x36')](_0x2936('0x37'),_0x3266d6+'-'+_0x49422d+'/'+_0x587774)[_0x2936('0x31')](_0x3cf8f5);}return null;};}function patchUpdates(_0x5cd974){return function(_0x2748a2){try{jsonpatch[_0x2936('0x38')](_0x2748a2,_0x5cd974,!![]);}catch(_0x29aef1){return BPromise['reject'](_0x29aef1);}return _0x2748a2[_0x2936('0x39')]();};}function saveUpdates(_0xacafca,_0x5e09dd){return function(_0x330f8b){if(_0x330f8b){return _0x330f8b[_0x2936('0x3a')](_0xacafca)[_0x2936('0x27')](function(_0x37dbf4){return _0x37dbf4;});}return null;};}function removeEntity(_0x3181c7,_0x555736){return function(_0x109160){if(_0x109160){return _0x109160[_0x2936('0x3b')]()[_0x2936('0x27')](function(){_0x3181c7['status'](0xcc)[_0x2936('0x3c')]();});}};}function handleEntityNotFound(_0x1c4abc,_0x22c5a3){return function(_0x1317e9){if(!_0x1317e9){_0x1c4abc[_0x2936('0x30')](0x194);}return _0x1317e9;};}function handleError(_0x5409a5,_0x464679){_0x464679=_0x464679||0x1f4;return function(_0xd9d01){logger[_0x2936('0x2c')](_0xd9d01[_0x2936('0x3d')]);if(_0xd9d01['name']){delete _0xd9d01[_0x2936('0x3e')];}_0x5409a5[_0x2936('0x3f')](_0x464679)[_0x2936('0x40')](_0xd9d01);};}exports[_0x2936('0x41')]=function(_0x47d4ce,_0x54f9f8){var _0x2b55bf={},_0x384600={},_0x20d9c4={'count':0x0,'rows':[]};var _0xa88762=_['map'](db[_0x2936('0x42')]['rawAttributes'],function(_0x447d4f){return{'name':_0x447d4f[_0x2936('0x43')],'type':_0x447d4f['type'][_0x2936('0x44')]};});_0x384600[_0x2936('0x45')]=_['map'](_0xa88762,_0x2936('0x3e'));_0x384600[_0x2936('0x46')]=_[_0x2936('0x47')](_0x47d4ce[_0x2936('0x46')]);_0x384600[_0x2936('0x48')]=_['intersection'](_0x384600[_0x2936('0x45')],_0x384600[_0x2936('0x46')]);_0x2b55bf[_0x2936('0x49')]=_[_0x2936('0x4a')](_0x384600['model'],qs[_0x2936('0x4b')](_0x47d4ce[_0x2936('0x46')][_0x2936('0x4b')]));_0x2b55bf[_0x2936('0x49')]=_0x2b55bf[_0x2936('0x49')]['length']?_0x2b55bf[_0x2936('0x49')]:_0x384600[_0x2936('0x45')];if(!_0x47d4ce[_0x2936('0x46')][_0x2936('0x4c')](_0x2936('0x4d'))){_0x2b55bf[_0x2936('0x34')]=qs['limit'](_0x47d4ce['query']['limit']);_0x2b55bf[_0x2936('0x32')]=qs['offset'](_0x47d4ce[_0x2936('0x46')]['offset']);}_0x2b55bf[_0x2936('0x4e')]=qs['sort'](_0x47d4ce[_0x2936('0x46')][_0x2936('0x4f')]);_0x2b55bf[_0x2936('0x50')]=qs['filters'](_[_0x2936('0x51')](_0x47d4ce[_0x2936('0x46')],_0x384600[_0x2936('0x48')]),_0xa88762);if(_0x47d4ce[_0x2936('0x46')]['filter']){_0x2b55bf[_0x2936('0x50')]=_[_0x2936('0x52')](_0x2b55bf[_0x2936('0x50')],{'$or':_[_0x2936('0x53')](_0xa88762,function(_0x5c30e8){if(_0x5c30e8[_0x2936('0x54')]!==_0x2936('0x55')){var _0x118f77={};_0x118f77[_0x5c30e8[_0x2936('0x3e')]]={'$like':'%'+_0x47d4ce['query'][_0x2936('0x56')]+'%'};return _0x118f77;}})});}_0x2b55bf=_[_0x2936('0x52')]({},_0x2b55bf,_0x47d4ce[_0x2936('0x57')]);var _0x2343ef={'where':_0x2b55bf[_0x2936('0x50')]};return db[_0x2936('0x42')][_0x2936('0x35')](_0x2343ef)['then'](function(_0xb1ee28){_0x20d9c4[_0x2936('0x35')]=_0xb1ee28;if(_0x47d4ce[_0x2936('0x46')]['includeAll']){_0x2b55bf[_0x2936('0x58')]=[{'all':!![]}];}return db[_0x2936('0x42')][_0x2936('0x59')](_0x2b55bf);})['then'](function(_0x49bd01){_0x20d9c4[_0x2936('0x5a')]=_0x49bd01;return _0x20d9c4;})[_0x2936('0x27')](respondWithFilteredResult(_0x54f9f8,_0x2b55bf))['catch'](handleError(_0x54f9f8,null));};exports[_0x2936('0x5b')]=function(_0x11ffca,_0x5b630f){var _0x567112={'raw':!![],'where':{'id':_0x11ffca['params']['id']}},_0x4eb266={};_0x4eb266[_0x2936('0x45')]=_[_0x2936('0x47')](db[_0x2936('0x42')]['rawAttributes']);_0x4eb266[_0x2936('0x46')]=_[_0x2936('0x47')](_0x11ffca[_0x2936('0x46')]);_0x4eb266['filters']=_[_0x2936('0x4a')](_0x4eb266[_0x2936('0x45')],_0x4eb266['query']);_0x567112[_0x2936('0x49')]=_[_0x2936('0x4a')](_0x4eb266[_0x2936('0x45')],qs[_0x2936('0x4b')](_0x11ffca[_0x2936('0x46')][_0x2936('0x4b')]));_0x567112[_0x2936('0x49')]=_0x567112[_0x2936('0x49')][_0x2936('0x5c')]?_0x567112[_0x2936('0x49')]:_0x4eb266[_0x2936('0x45')];if(_0x11ffca['query'][_0x2936('0x5d')]){_0x567112[_0x2936('0x58')]=[{'all':!![]}];}_0x567112=_[_0x2936('0x52')]({},_0x567112,_0x11ffca[_0x2936('0x57')]);return db[_0x2936('0x42')]['find'](_0x567112)[_0x2936('0x27')](handleEntityNotFound(_0x5b630f,null))[_0x2936('0x27')](respondWithResult(_0x5b630f,null))[_0x2936('0x5e')](handleError(_0x5b630f,null));};exports[_0x2936('0x5f')]=function(_0x232828,_0x215eb4){return db[_0x2936('0x42')]['create'](_0x232828[_0x2936('0x60')],{})[_0x2936('0x27')](respondWithResult(_0x215eb4,0xc9))[_0x2936('0x5e')](handleError(_0x215eb4,null));};exports[_0x2936('0x3a')]=function(_0xd48230,_0x44be9a){if(_0xd48230['body']['id']){delete _0xd48230[_0x2936('0x60')]['id'];}return db[_0x2936('0x42')]['find']({'where':{'id':_0xd48230[_0x2936('0x61')]['id']}})[_0x2936('0x27')](handleEntityNotFound(_0x44be9a,null))['then'](saveUpdates(_0xd48230['body'],null))[_0x2936('0x27')](respondWithResult(_0x44be9a,null))[_0x2936('0x5e')](handleError(_0x44be9a,null));};exports[_0x2936('0x3b')]=function(_0x4f6494,_0x3b9410){return db[_0x2936('0x42')][_0x2936('0x62')]({'where':{'id':_0x4f6494[_0x2936('0x61')]['id']}})[_0x2936('0x27')](handleEntityNotFound(_0x3b9410,null))[_0x2936('0x27')](removeEntity(_0x3b9410,null))[_0x2936('0x5e')](handleError(_0x3b9410,null));};exports[_0x2936('0x63')]=function(_0x27b138,_0x38056b){return db['WhatsappMessage']['describe']()[_0x2936('0x27')](respondWithResult(_0x38056b,null))[_0x2936('0x5e')](handleError(_0x38056b,null));};var interaction_log=require(_0x2936('0x18'))(_0x2936('0x64'));exports[_0x2936('0x65')]=function(_0x31d085,_0x334496,_0x10f28e){var _0x4c3861={'agent':{},'channel':_0x2936('0x66')};if(_0x31d085[_0x2936('0x60')]['id']){delete _0x31d085[_0x2936('0x60')]['id'];}_0x31d085[_0x2936('0x60')][_0x2936('0x67')]=!![];_0x31d085[_0x2936('0x60')]['readAt']=moment()['format'](_0x2936('0x68'));_0x31d085[_0x2936('0x60')][_0x2936('0x69')]=_0x31d085[_0x2936('0x60')][_0x2936('0x69')]||_0x31d085[_0x2936('0x6a')]['id'];_0x4c3861[_0x2936('0x6b')]['id']=_0x31d085[_0x2936('0x60')][_0x2936('0x69')];return db['WhatsappMessage'][_0x2936('0x62')]({'where':{'id':_0x31d085['params']['id'],'UserId':null}})[_0x2936('0x27')](handleEntityNotFound(_0x334496,null))[_0x2936('0x27')](saveUpdates(_0x31d085[_0x2936('0x60')],null))[_0x2936('0x27')](function(_0x372836){if(_0x372836){_0x4c3861[_0x2936('0x2e')]=_0x372836[_0x2936('0x6c')]({'plain':!![]});return db[_0x2936('0x6d')][_0x2936('0x62')]({'where':{'id':_0x372836[_0x2936('0x6e')]}});}return null;})[_0x2936('0x27')](handleEntityNotFound(_0x334496,null))[_0x2936('0x27')](function(_0x296a91){if(_0x296a91){return _0x296a91[_0x2936('0x3a')]({'UserId':_0x31d085[_0x2936('0x60')]['UserId'],'read1stAt':_[_0x2936('0x6f')](_0x296a91[_0x2936('0x70')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x2936('0x27')](function(_0x4364ee){if(_0x4364ee){_0x4c3861['interaction']=_0x4364ee[_0x2936('0x6c')]({'plain':!![]});interaction_log[_0x2936('0x28')](_0x2936('0x71'),_0x31d085[_0x2936('0x6a')]['id'],_0x31d085['user']['name'],_0x31d085[_0x2936('0x6a')][_0x2936('0x72')],_0x4c3861[_0x2936('0x73')]['id'],_0x31d085[_0x2936('0x60')]?JSON[_0x2936('0x2b')](_0x31d085[_0x2936('0x60')]):_0x2936('0x74'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x4c3861);}return null;})[_0x2936('0x27')](function(_0x565a4d){var _0x26797f=_0x2936('0x75')+_0x565a4d['message'][_0x2936('0x76')];return db['sequelize']['query'](_0x26797f,{'type':db[_0x2936('0x77')][_0x2936('0x78')][_0x2936('0x79')],'raw':!![]})[_0x2936('0x27')](function(_0x28f3e5){return _0x28f3e5;});})[_0x2936('0x27')](function(_0x455dfb){if(_0x455dfb){_0x4c3861[_0x2936('0x2e')][_0x2936('0x7a')]=_0x455dfb[0x0];if(!_0x31d085['body'][_0x2936('0x69')])return;return db[_0x2936('0x7b')][_0x2936('0x62')]({'where':{'id':_0x31d085[_0x2936('0x60')][_0x2936('0x69')],'role':_0x2936('0x6b')},'attributes':['id','name',_0x2936('0x7c'),'email','internal'],'raw':!![]});}return null;})[_0x2936('0x27')](function(_0x2c7d64){if(!_0x2c7d64)return null;_0x4c3861[_0x2936('0x2e')][_0x2936('0x6b')]=_0x2c7d64;return _0x4c3861;})[_0x2936('0x27')](function(_0x298ed9){if(_0x298ed9){if(_0x31d085[_0x2936('0x60')][_0x2936('0x7d')]){_0x4c3861[_0x2936('0x2e')]['interface']=util[_0x2936('0x7e')](_0x2936('0x7f'),_0x31d085[_0x2936('0x6a')][_0x2936('0x3e')]);_0x4c3861[_0x2936('0x2e')]['channel']=_0x4c3861[_0x2936('0x80')];_0x4c3861[_0x2936('0x2e')]['motionChannel']=_0x4c3861['channel'];_0x4c3861['message'][_0x2936('0x81')]=_0x2936('0x65');return respondWithRpcPromise(_0x2936('0x82'),_0x2936('0x82'),{'event':_0x2936('0x83'),'message':_0x4c3861['message']},client9002)[_0x2936('0x27')](function(){return _0x4c3861;});}return _0x4c3861;}return null;})[_0x2936('0x27')](respondWithResult(_0x334496,null))[_0x2936('0x5e')](handleError(_0x334496,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports['reject']=function(_0x43f7b4,_0x216e32,_0x166d97){var _0x5698f7={'agent':{},'channel':_0x2936('0x66')};if(_0x43f7b4['body']['id']){delete _0x43f7b4['body']['id'];}_0x43f7b4['body'][_0x2936('0x69')]=_0x43f7b4['body'][_0x2936('0x69')]||_0x43f7b4[_0x2936('0x6a')]['id'];_0x5698f7['agent']['id']=_0x43f7b4[_0x2936('0x60')][_0x2936('0x69')];return db[_0x2936('0x42')][_0x2936('0x62')]({'where':{'id':_0x43f7b4['params']['id'],'UserId':null}})[_0x2936('0x27')](handleEntityNotFound(_0x216e32,null))['then'](function(_0x259d6f){if(_0x259d6f){_0x5698f7['message']=_0x259d6f[_0x2936('0x6c')]({'plain':!![]});return db[_0x2936('0x6d')][_0x2936('0x62')]({'where':{'id':_0x259d6f[_0x2936('0x6e')]}});}return null;})[_0x2936('0x27')](handleEntityNotFound(_0x216e32,null))[_0x2936('0x27')](function(_0x4a81c8){if(_0x4a81c8){_0x5698f7[_0x2936('0x73')]=_0x4a81c8[_0x2936('0x6c')]({'plain':!![]});interaction_log[_0x2936('0x28')](_0x2936('0x84'),_0x43f7b4[_0x2936('0x6a')]['id'],_0x43f7b4[_0x2936('0x6a')]['name'],_0x43f7b4['user']['role'],_0x5698f7[_0x2936('0x73')]['id'],_0x43f7b4[_0x2936('0x60')]?JSON[_0x2936('0x2b')](_0x43f7b4[_0x2936('0x60')]):'null');return respondWithRpcPromise(_0x2936('0x85'),_0x2936('0x86'),_0x5698f7);}return null;})['then'](function(_0x179335){var _0x1bdc98=_0x2936('0x75')+_0x179335[_0x2936('0x2e')][_0x2936('0x76')];return db[_0x2936('0x87')][_0x2936('0x46')](_0x1bdc98,{'type':db[_0x2936('0x77')]['QueryTypes'][_0x2936('0x79')],'raw':!![]})[_0x2936('0x27')](function(_0x540205){return _0x540205;});})['then'](function(_0x27584e){if(_0x27584e){_0x5698f7[_0x2936('0x2e')]['contact']=_0x27584e[0x0];if(!_0x43f7b4[_0x2936('0x60')][_0x2936('0x69')])return;return db[_0x2936('0x7b')][_0x2936('0x62')]({'where':{'id':_0x43f7b4[_0x2936('0x60')][_0x2936('0x69')],'role':_0x2936('0x6b')},'attributes':['id',_0x2936('0x3e'),_0x2936('0x7c'),_0x2936('0x88'),'internal'],'raw':!![]});}return null;})['then'](function(_0x30de64){if(!_0x30de64)return null;_0x5698f7[_0x2936('0x2e')][_0x2936('0x6b')]=_0x30de64;return _0x5698f7;})[_0x2936('0x27')](function(_0x397efa){if(_0x397efa){_0x397efa[_0x2936('0x2e')]['interface']=util[_0x2936('0x7e')](_0x2936('0x7f'),_0x43f7b4[_0x2936('0x6a')]['name']);_0x397efa[_0x2936('0x2e')][_0x2936('0x80')]=_0x5698f7[_0x2936('0x80')];_0x397efa[_0x2936('0x2e')][_0x2936('0x89')]=_0x5698f7['channel'];_0x397efa[_0x2936('0x2e')]['event']='reject';respondWithRpcPromise(_0x2936('0x82'),_0x2936('0x82'),{'event':_0x2936('0x8a'),'message':_0x397efa['message']},client9002);return _0x5698f7;}return null;})[_0x2936('0x27')](respondWithResult(_0x216e32,null))[_0x2936('0x5e')](handleError(_0x216e32,null));};exports[_0x2936('0x3f')]=function(_0x2cb119,_0xcbdd0f,_0x5a6a0c){if(_0x2cb119[_0x2936('0x60')]['id']){delete _0x2cb119['body']['id'];}var _0xab36cb;return db[_0x2936('0x42')][_0x2936('0x62')]({'where':{'id':_0x2cb119[_0x2936('0x61')]['id']}})[_0x2936('0x27')](handleEntityNotFound(_0xcbdd0f,null))[_0x2936('0x27')](function(_0x30563a){if(_0x30563a){_0xab36cb=_0x30563a;return db['WhatsappAccount'][_0x2936('0x62')]({'where':{'id':_0x30563a[_0x2936('0x8b')]}});}})['then'](handleEntityNotFound(_0xcbdd0f,null))[_0x2936('0x27')](function(_0x2b0842){if(_0x2b0842){logger[_0x2936('0x2a')](_0x2936('0x8c'),_0x2936('0x3f'),'received\x20delivery\x20report\x20from',_0x2b0842['type'],util['inspect'](_0x2cb119[_0x2936('0x60')],{'showHidden':![],'depth':null}));switch(_0x2b0842[_0x2936('0x54')]){case _0x2936('0x8d'):if(_0x2cb119[_0x2936('0x60')][_0x2936('0x8e')]&&_0x2cb119[_0x2936('0x60')][_0x2936('0x8e')]===_0xab36cb[_0x2936('0x8f')]&&_0x2cb119['body']['MessageStatus']&&_0x2cb119[_0x2936('0x60')][_0x2936('0x90')]===_0x2936('0x67')){return _0xab36cb[_0x2936('0x3a')]({'read':!![]});}else{logger['error'](_0x2936('0x91'),_0x2936('0x3f'),_0x2936('0x8d'),util[_0x2936('0x92')](_0x2cb119[_0x2936('0x60')],{'showHidden':![],'depth':null}));}break;}return _0xab36cb;}})[_0x2936('0x27')](respondWithResult(_0xcbdd0f,null))[_0x2936('0x5e')](handleError(_0xcbdd0f,null));};
\ No newline at end of file
index 46ff82b..66b7bf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb9be=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xb9be,0xc5));var _0xeb9b=function(_0x4cce65,_0x40021e){_0x4cce65=_0x4cce65-0x0;var _0x4d1b45=_0xb9be[_0x4cce65];return _0x4d1b45;};'use strict';var EventEmitter=require(_0xeb9b('0x0'));var WhatsappMessage=require(_0xeb9b('0x1'))['db'][_0xeb9b('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xeb9b('0x3')](0x0);var events={'afterCreate':_0xeb9b('0x4'),'afterUpdate':_0xeb9b('0x5'),'afterDestroy':_0xeb9b('0x6')};function emitEvent(_0x2003d4){return function(_0x288aaa,_0x579a7e,_0x5006b8){WhatsappMessageEvents[_0xeb9b('0x7')](_0x2003d4+':'+_0x288aaa['id'],_0x288aaa);WhatsappMessageEvents[_0xeb9b('0x7')](_0x2003d4,_0x288aaa);_0x5006b8(null);};}for(var e in events){if(events[_0xeb9b('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xeb9b('0x9')]=WhatsappMessageEvents;
\ No newline at end of file
+var _0x4483=['../../mysqldb','WhatsappMessage','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4483,0x1a3));var _0x3448=function(_0x350c42,_0x4e554c){_0x350c42=_0x350c42-0x0;var _0x3bc033=_0x4483[_0x350c42];return _0x3bc033;};'use strict';var EventEmitter=require(_0x3448('0x0'));var WhatsappMessage=require(_0x3448('0x1'))['db'][_0x3448('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3448('0x3'),'afterUpdate':_0x3448('0x4'),'afterDestroy':_0x3448('0x5')};function emitEvent(_0x3a7178){return function(_0xef1a93,_0x5f5163,_0xeb5b8){WhatsappMessageEvents[_0x3448('0x6')](_0x3a7178+':'+_0xef1a93['id'],_0xef1a93);WhatsappMessageEvents[_0x3448('0x6')](_0x3a7178,_0xef1a93);_0xeb5b8(null);};}for(var e in events){if(events[_0x3448('0x7')](e)){var event=events[e];WhatsappMessage[_0x3448('0x8')](e,emitEvent(event));}}module[_0x3448('0x9')]=WhatsappMessageEvents;
\ No newline at end of file
index 3295838..ba54d00 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x305f=['err','WhatsappMessage,\x20%s','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path','rimraf','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','FULLTEXT','direction','toLowerCase','out','secret','isNil','UserId','findOne','then','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','twilio','accountSid','phone','authToken','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/messages/','text','body','POST','application/json','message_id','statuses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x305f,0xdb));var _0xf305=function(_0x5424cf,_0x9ee6c2){_0x5424cf=_0x5424cf-0x0;var _0x5f4656=_0x305f[_0x5424cf];return _0x5f4656;};'use strict';var _=require(_0xf305('0x0'));var util=require(_0xf305('0x1'));var logger=require(_0xf305('0x2'))(_0xf305('0x3'));var moment=require(_0xf305('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xf305('0x5'));var rimraf=require(_0xf305('0x6'));var config=require('../../config/environment');var attributes=require(_0xf305('0x7'));module[_0xf305('0x8')]=function(_0x1e6b00,_0x439c70){return _0x1e6b00[_0xf305('0x9')](_0xf305('0xa'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0xf305('0xb'),'fields':[_0xf305('0xb')]},{'name':_0xf305('0xc'),'fields':['body'],'type':_0xf305('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x331109,_0x1d6977,_0x2e374e){var _0x1c3f15=_0x1e6b00['models'];var _0x3265e5=_0x331109['get']({'plain':!![]});if(_0x3265e5[_0xf305('0xe')][_0xf305('0xf')]()==='in'||_0x3265e5[_0xf305('0xe')][_0xf305('0xf')]()===_0xf305('0x10')&&!_0x3265e5[_0xf305('0x11')]&&!_[_0xf305('0x12')](_0x3265e5[_0xf305('0x13')])){_0x1c3f15['WhatsappInteraction'][_0xf305('0x14')]({'where':{'id':_0x3265e5['WhatsappInteractionId']}})[_0xf305('0x15')](function(_0x52f24c){if(_0x52f24c){_0x52f24c[_0xf305('0x16')]({'lastMsgAt':_0x3265e5[_0xf305('0x17')],'lastMsgDirection':_0x3265e5[_0xf305('0xe')][_0xf305('0xf')]()});}})[_0xf305('0x18')](function(_0x58216a){console[_0xf305('0x19')](_0x58216a);});}if(_0x3265e5[_0xf305('0xe')]===_0xf305('0x10')&&!_0x3265e5[_0xf305('0x11')]){var _0x15d2b5;_0x1c3f15[_0xf305('0x1a')]['find']({'where':{'id':_0x3265e5[_0xf305('0x1b')]},'raw':!![]})[_0xf305('0x15')](function(_0x4baa86){_0x15d2b5=_0x4baa86;if(_0x15d2b5&&_0x15d2b5['type']){switch(_0x15d2b5['type']){case _0xf305('0x1c'):var _0x5b5393=require(_0xf305('0x1c'));if(_0x15d2b5[_0xf305('0x1d')]&&_0x15d2b5['authToken']&&_0x15d2b5[_0xf305('0x1e')]){var _0x133bcf=new _0x5b5393(_0x15d2b5[_0xf305('0x1d')],_0x15d2b5[_0xf305('0x1f')]);_0x133bcf['messages'][_0xf305('0x20')]({'body':_0x3265e5['body'],'to':_0xf305('0x21')+_0x3265e5[_0xf305('0x1e')],'from':'whatsapp:'+_0x15d2b5[_0xf305('0x1e')],'statusCallback':_0x15d2b5[_0xf305('0x22')]+_0xf305('0x23')+_0x3265e5['id']+_0xf305('0x24')+_0x15d2b5[_0xf305('0x25')]})[_0xf305('0x15')](function(_0x3f7aff){if(_0x3f7aff[_0xf305('0x26')]){return _0x331109[_0xf305('0x16')]({'messageId':_0x3f7aff[_0xf305('0x26')]});}})[_0xf305('0x18')](function(_0x356260){logger[_0xf305('0x19')](_0xf305('0x27'),'afterCreate',_0xf305('0x1c'),util[_0xf305('0x28')](_0x356260,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xf305('0x27'),'afterCreate',_0xf305('0x1c'),_0xf305('0x29'));}break;case _0xf305('0x2a'):var _0x2f224b=_0x15d2b5[_0xf305('0x1d')];var _0xbcda66=_0x15d2b5[_0xf305('0x1f')];var _0x601cb7=_0x15d2b5[_0xf305('0x2b')]+'/whatsapp/v1/'+_0x2f224b+_0xf305('0x2c');var _0x21edd2={'to':[_0x3265e5[_0xf305('0x1e')]],'message':{'type':_0xf305('0x2d'),'text':_0x3265e5[_0xf305('0x2e')]}};var _0x34330b={'method':_0xf305('0x2f'),'uri':_0x601cb7,'headers':{'Authorization':'Bearer\x20'+_0xbcda66,'Content-Type':_0xf305('0x30')},'body':_0x21edd2,'json':!![]};rp(_0x34330b)['then'](function(_0x4c468f){if(_0x4c468f['statuses'][0x0][_0xf305('0x31')]){return _0x331109['update']({'messageId':_0x4c468f[_0xf305('0x32')][0x0][_0xf305('0x31')]});}})[_0xf305('0x18')](function(_0x5d3002){logger[_0xf305('0x33')](_0xf305('0x34'),_0x5d3002);});break;}}})['finally'](function(){_0x2e374e();});}else{_0x2e374e();}}},'charset':'utf8mb4','collate':_0xf305('0x35')});};
\ No newline at end of file
+var _0x56db=['phone','messages','create','whatsapp:','remote','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','text','body','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','moment','bluebird','node-fetch','path','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','catch','error','secret','WhatsappAccount','find','type','twilio','accountSid','authToken'];(function(_0x4d3de7,_0x186573){var _0x2a5500=function(_0x5113d5){while(--_0x5113d5){_0x4d3de7['push'](_0x4d3de7['shift']());}};_0x2a5500(++_0x186573);}(_0x56db,0x92));var _0xb56d=function(_0x40bfc2,_0x538e26){_0x40bfc2=_0x40bfc2-0x0;var _0x14d1db=_0x56db[_0x40bfc2];return _0x14d1db;};'use strict';var _=require(_0xb56d('0x0'));var util=require(_0xb56d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xb56d('0x2'));var BPromise=require(_0xb56d('0x3'));var rp=require('request-promise');var fetch=require(_0xb56d('0x4'));var fs=require('fs');var path=require(_0xb56d('0x5'));var rimraf=require(_0xb56d('0x6'));var config=require(_0xb56d('0x7'));var attributes=require('./whatsappMessage.attributes');module[_0xb56d('0x8')]=function(_0x39a633,_0x3d4dde){return _0x39a633[_0xb56d('0x9')](_0xb56d('0xa'),attributes,{'tableName':_0xb56d('0xb'),'paranoid':![],'indexes':[{'name':_0xb56d('0xc'),'fields':[_0xb56d('0xc')]},{'name':_0xb56d('0xd'),'fields':['body'],'type':_0xb56d('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a1fe8,_0x30a77d,_0x4878b8){var _0xbdfae0=_0x39a633[_0xb56d('0xf')];var _0x91b8c0=_0x5a1fe8[_0xb56d('0x10')]({'plain':!![]});if(_0x91b8c0[_0xb56d('0x11')]['toLowerCase']()==='in'||_0x91b8c0['direction'][_0xb56d('0x12')]()===_0xb56d('0x13')&&!_0x91b8c0['secret']&&!_[_0xb56d('0x14')](_0x91b8c0[_0xb56d('0x15')])){_0xbdfae0[_0xb56d('0x16')][_0xb56d('0x17')]({'where':{'id':_0x91b8c0[_0xb56d('0x18')]}})[_0xb56d('0x19')](function(_0x3175b7){if(_0x3175b7){_0x3175b7[_0xb56d('0x1a')]({'lastMsgAt':_0x91b8c0[_0xb56d('0x1b')],'lastMsgDirection':_0x91b8c0['direction'][_0xb56d('0x12')]()});}})[_0xb56d('0x1c')](function(_0x58315f){console[_0xb56d('0x1d')](_0x58315f);});}if(_0x91b8c0['direction']===_0xb56d('0x13')&&!_0x91b8c0[_0xb56d('0x1e')]){var _0x3ae501;_0xbdfae0[_0xb56d('0x1f')][_0xb56d('0x20')]({'where':{'id':_0x91b8c0['WhatsappAccountId']},'raw':!![]})[_0xb56d('0x19')](function(_0x8e013a){_0x3ae501=_0x8e013a;if(_0x3ae501&&_0x3ae501[_0xb56d('0x21')]){switch(_0x3ae501[_0xb56d('0x21')]){case'twilio':var _0x57a24c=require(_0xb56d('0x22'));if(_0x3ae501[_0xb56d('0x23')]&&_0x3ae501[_0xb56d('0x24')]&&_0x3ae501[_0xb56d('0x25')]){var _0x496db4=new _0x57a24c(_0x3ae501['accountSid'],_0x3ae501[_0xb56d('0x24')]);_0x496db4[_0xb56d('0x26')][_0xb56d('0x27')]({'body':_0x91b8c0['body'],'to':_0xb56d('0x28')+_0x91b8c0[_0xb56d('0x25')],'from':_0xb56d('0x28')+_0x3ae501[_0xb56d('0x25')],'statusCallback':_0x3ae501[_0xb56d('0x29')]+'/api/whatsapp/messages/'+_0x91b8c0['id']+'/status?token='+_0x3ae501[_0xb56d('0x2a')]})[_0xb56d('0x19')](function(_0x4cdf19){if(_0x4cdf19['sid']){return _0x5a1fe8[_0xb56d('0x1a')]({'messageId':_0x4cdf19[_0xb56d('0x2b')]});}})[_0xb56d('0x1c')](function(_0x220375){logger[_0xb56d('0x1d')](_0xb56d('0x2c'),_0xb56d('0x2d'),_0xb56d('0x22'),util['inspect'](_0x220375,{'showHidden':![],'depth':null}));});}else{logger[_0xb56d('0x1d')](_0xb56d('0x2c'),'afterCreate',_0xb56d('0x22'),_0xb56d('0x2e'));}break;case _0xb56d('0x2f'):var _0x3964be=_0x3ae501[_0xb56d('0x23')];var _0x1ac577=_0x3ae501[_0xb56d('0x24')];var _0x59878a=_0x3ae501[_0xb56d('0x30')]+_0xb56d('0x31')+_0x3964be+_0xb56d('0x32');var _0x2bf73c={'to':[_0x91b8c0['phone']],'message':{'type':_0xb56d('0x33'),'text':_0x91b8c0[_0xb56d('0x34')]}};var _0x33de0b={'method':_0xb56d('0x35'),'uri':_0x59878a,'headers':{'Authorization':_0xb56d('0x36')+_0x1ac577,'Content-Type':'application/json'},'body':_0x2bf73c,'json':!![]};rp(_0x33de0b)[_0xb56d('0x19')](function(_0x3f723c){if(_0x3f723c[_0xb56d('0x37')][0x0][_0xb56d('0x38')]){return _0x5a1fe8['update']({'messageId':_0x3f723c['statuses'][0x0]['message_id']});}})['catch'](function(_0x35e5de){logger[_0xb56d('0x39')](_0xb56d('0x3a'),_0x35e5de);});break;}}})[_0xb56d('0x3b')](function(){_0x4878b8();});}else{_0x4878b8();}}},'charset':'utf8mb4','collate':_0xb56d('0x3c')});};
\ No newline at end of file
index 0569dd6..de62c62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x26f1=['debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent'];(function(_0x2ea08a,_0x240f73){var _0x5401ad=function(_0x194c90){while(--_0x194c90){_0x2ea08a['push'](_0x2ea08a['shift']());}};_0x5401ad(++_0x240f73);}(_0x26f1,0x160));var _0x126f=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x26f1[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require(_0x126f('0x0'));var util=require(_0x126f('0x1'));var moment=require('moment');var BPromise=require(_0x126f('0x2'));var rs=require(_0x126f('0x3'));var fs=require('fs');var Redis=require(_0x126f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x126f('0x5'));var logger=require(_0x126f('0x6'))(_0x126f('0x7'));var config=require(_0x126f('0x8'));var jayson=require(_0x126f('0x9'));var client=jayson['client'][_0x126f('0xa')]({'port':0x232a});config[_0x126f('0xb')]=_[_0x126f('0xc')](config[_0x126f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x126f('0xd'))(new Redis(config[_0x126f('0xb')]));require('./whatsappMessage.socket')[_0x126f('0xe')](socket);function respondWithRpcPromise(_0x43e7d2,_0x4fb9d5,_0x381ccc){return new BPromise(function(_0x44cfaf,_0x56b4bd){return client[_0x126f('0xf')](_0x43e7d2,_0x381ccc)[_0x126f('0x10')](function(_0x4a68a5){logger[_0x126f('0x11')](_0x126f('0x12'),_0x4fb9d5,_0x126f('0x13'));logger[_0x126f('0x14')](_0x126f('0x15'),_0x4fb9d5,_0x126f('0x13'),JSON['stringify'](_0x4a68a5));if(_0x4a68a5[_0x126f('0x16')]){if(_0x4a68a5[_0x126f('0x16')]['code']===0x1f4){logger['error'](_0x126f('0x12'),_0x4fb9d5,_0x4a68a5['error'][_0x126f('0x17')]);return _0x56b4bd(_0x4a68a5['error']['message']);}logger[_0x126f('0x16')](_0x126f('0x12'),_0x4fb9d5,_0x4a68a5['error'][_0x126f('0x17')]);return _0x44cfaf(_0x4a68a5['error'][_0x126f('0x17')]);}else{logger['info'](_0x126f('0x12'),_0x4fb9d5,'request\x20sent');_0x44cfaf(_0x4a68a5['result'][_0x126f('0x17')]);}})[_0x126f('0x18')](function(_0x190b19){logger[_0x126f('0x16')]('WhatsappMessage,\x20%s,\x20%s',_0x4fb9d5,_0x190b19);_0x56b4bd(_0x190b19);});});}exports[_0x126f('0x19')]=function(_0xfc0aec){var _0x3775d3=this;return new Promise(function(_0x4afe98,_0x5eed5e){return db[_0x126f('0x1a')][_0x126f('0x1b')](_0xfc0aec[_0x126f('0x1c')],{'raw':_0xfc0aec[_0x126f('0x1d')]?_0xfc0aec[_0x126f('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x126f('0x10')](function(_0x3f3e50){logger[_0x126f('0x11')](_0x126f('0x19'),_0xfc0aec);logger['debug'](_0x126f('0x19'),_0xfc0aec,JSON[_0x126f('0x1e')](_0x3f3e50));_0x4afe98(_0x3f3e50);})['catch'](function(_0x495be5){logger[_0x126f('0x16')](_0x126f('0x19'),_0x495be5['message'],_0xfc0aec);_0x5eed5e(_0x3775d3[_0x126f('0x16')](0x1f4,_0x495be5[_0x126f('0x17')]));});});};
\ No newline at end of file
+var _0x062b=['socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','create','body','options','raw','CreateWhatsappMessage','stringify','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','redis'];(function(_0x503185,_0x20d261){var _0xb29eff=function(_0x15e65e){while(--_0x15e65e){_0x503185['push'](_0x503185['shift']());}};_0xb29eff(++_0x20d261);}(_0x062b,0xb5));var _0xb062=function(_0x509084,_0x43b872){_0x509084=_0x509084-0x0;var _0x29174c=_0x062b[_0x509084];return _0x29174c;};'use strict';var _=require('lodash');var util=require(_0xb062('0x0'));var moment=require('moment');var BPromise=require(_0xb062('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb062('0x2'));var db=require(_0xb062('0x3'))['db'];var utils=require(_0xb062('0x4'));var logger=require(_0xb062('0x5'))(_0xb062('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb062('0x7')][_0xb062('0x8')]({'port':0x232a});config['redis']=_[_0xb062('0x9')](config[_0xb062('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb062('0xb'))(new Redis(config[_0xb062('0xa')]));require(_0xb062('0xc'))[_0xb062('0xd')](socket);function respondWithRpcPromise(_0x1f244a,_0x2cebae,_0x2c4f3d){return new BPromise(function(_0x29481b,_0xd04086){return client[_0xb062('0xe')](_0x1f244a,_0x2c4f3d)[_0xb062('0xf')](function(_0xeaef2d){logger[_0xb062('0x10')](_0xb062('0x11'),_0x2cebae,'request\x20sent');logger[_0xb062('0x12')](_0xb062('0x13'),_0x2cebae,_0xb062('0x14'),JSON['stringify'](_0xeaef2d));if(_0xeaef2d['error']){if(_0xeaef2d[_0xb062('0x15')][_0xb062('0x16')]===0x1f4){logger['error'](_0xb062('0x11'),_0x2cebae,_0xeaef2d[_0xb062('0x15')]['message']);return _0xd04086(_0xeaef2d[_0xb062('0x15')]['message']);}logger[_0xb062('0x15')]('WhatsappMessage,\x20%s,\x20%s',_0x2cebae,_0xeaef2d[_0xb062('0x15')][_0xb062('0x17')]);return _0x29481b(_0xeaef2d['error'][_0xb062('0x17')]);}else{logger['info'](_0xb062('0x11'),_0x2cebae,_0xb062('0x14'));_0x29481b(_0xeaef2d[_0xb062('0x18')]['message']);}})[_0xb062('0x19')](function(_0x25e675){logger['error'](_0xb062('0x11'),_0x2cebae,_0x25e675);_0xd04086(_0x25e675);});});}exports['CreateWhatsappMessage']=function(_0x33b4b0){var _0xca3dbb=this;return new Promise(function(_0x2a5a9e,_0x407d81){return db['WhatsappMessage'][_0xb062('0x1a')](_0x33b4b0[_0xb062('0x1b')],{'raw':_0x33b4b0[_0xb062('0x1c')]?_0x33b4b0['options'][_0xb062('0x1d')]===undefined?!![]:![]:!![]})[_0xb062('0xf')](function(_0x5ae4e9){logger[_0xb062('0x10')](_0xb062('0x1e'),_0x33b4b0);logger[_0xb062('0x12')](_0xb062('0x1e'),_0x33b4b0,JSON[_0xb062('0x1f')](_0x5ae4e9));_0x2a5a9e(_0x5ae4e9);})[_0xb062('0x19')](function(_0x39ce38){logger[_0xb062('0x15')](_0xb062('0x1e'),_0x39ce38[_0xb062('0x17')],_0x33b4b0);_0x407d81(_0xca3dbb[_0xb062('0x15')](0x1f4,_0x39ce38[_0xb062('0x17')]));});});};
\ No newline at end of file
index 733534b..6f379f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9e80=['save','update','removeListener','whatsappMessage:','./whatsappMessage.events'];(function(_0x5345a5,_0x3c08fd){var _0x25fc15=function(_0xc30a15){while(--_0xc30a15){_0x5345a5['push'](_0x5345a5['shift']());}};_0x25fc15(++_0x3c08fd);}(_0x9e80,0x144));var _0x09e8=function(_0x1cacb2,_0x4b8321){_0x1cacb2=_0x1cacb2-0x0;var _0x5414af=_0x9e80[_0x1cacb2];return _0x5414af;};'use strict';var WhatsappMessageEvents=require(_0x09e8('0x0'));var events=[_0x09e8('0x1'),'remove',_0x09e8('0x2')];function createListener(_0x4f5242,_0xa390b){return function(_0x2a954f){_0xa390b['emit'](_0x4f5242,_0x2a954f);};}function removeListener(_0x58eabf,_0x328e53){return function(){WhatsappMessageEvents[_0x09e8('0x3')](_0x58eabf,_0x328e53);};}exports['register']=function(_0x1cf7df){for(var _0x188c24=0x0,_0x41e89b=events['length'];_0x188c24<_0x41e89b;_0x188c24++){var _0x27f360=events[_0x188c24];var _0x18d4ed=createListener(_0x09e8('0x4')+_0x27f360,_0x1cf7df);WhatsappMessageEvents['on'](_0x27f360,_0x18d4ed);}};
\ No newline at end of file
+var _0x218d=['removeListener','register','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0x218d,0x141));var _0xd218=function(_0x46ceb5,_0x4be9d7){_0x46ceb5=_0x46ceb5-0x0;var _0x10adbd=_0x218d[_0x46ceb5];return _0x10adbd;};'use strict';var WhatsappMessageEvents=require(_0xd218('0x0'));var events=['save',_0xd218('0x1'),_0xd218('0x2')];function createListener(_0x460d53,_0x52165b){return function(_0x4aae4f){_0x52165b['emit'](_0x460d53,_0x4aae4f);};}function removeListener(_0x360a8c,_0x4238ad){return function(){WhatsappMessageEvents[_0xd218('0x3')](_0x360a8c,_0x4238ad);};}exports[_0xd218('0x4')]=function(_0xeaf1f9){for(var _0x32adb1=0x0,_0x4364bd=events['length'];_0x32adb1<_0x4364bd;_0x32adb1++){var _0x4c080a=events[_0x32adb1];var _0x33a473=createListener(_0xd218('0x5')+_0x4c080a,_0xeaf1f9);WhatsappMessageEvents['on'](_0x4c080a,_0x33a473);}};
\ No newline at end of file
index 3b6144d..a4cca64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x532c=['put','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','describe','/:id','isAuthenticated','show','/:id/members','getTeams','/:id/users','post','create','/:id/teams','addTeams','addAgents'];(function(_0x2b7584,_0x11953a){var _0x3a84ff=function(_0x1ee5e6){while(--_0x1ee5e6){_0x2b7584['push'](_0x2b7584['shift']());}};_0x3a84ff(++_0x11953a);}(_0x532c,0xbb));var _0xc532=function(_0x5a193b,_0x36cc34){_0x5a193b=_0x5a193b-0x0;var _0x167e8d=_0x532c[_0x5a193b];return _0x167e8d;};'use strict';var multer=require(_0xc532('0x0'));var util=require(_0xc532('0x1'));var path=require('path');var timeout=require(_0xc532('0x2'));var express=require(_0xc532('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc532('0x4'));var interaction=require(_0xc532('0x5'));var config=require(_0xc532('0x6'));var controller=require(_0xc532('0x7'));router[_0xc532('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xc532('0x9')]);router[_0xc532('0x8')](_0xc532('0xa'),auth[_0xc532('0xb')](),controller[_0xc532('0xc')]);router[_0xc532('0x8')](_0xc532('0xd'),auth[_0xc532('0xb')](),controller['getMembers']);router[_0xc532('0x8')]('/:id/teams',auth[_0xc532('0xb')](),controller[_0xc532('0xe')]);router[_0xc532('0x8')](_0xc532('0xf'),auth[_0xc532('0xb')](),controller['getAgents']);router[_0xc532('0x10')]('/',auth[_0xc532('0xb')](),controller[_0xc532('0x11')]);router['post'](_0xc532('0x12'),auth['isAuthenticated'](),controller[_0xc532('0x13')]);router[_0xc532('0x10')](_0xc532('0xf'),auth[_0xc532('0xb')](),controller[_0xc532('0x14')]);router[_0xc532('0x15')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc532('0x16')](_0xc532('0xa'),auth[_0xc532('0xb')](),controller['destroy']);router['delete'](_0xc532('0x12'),auth['isAuthenticated'](),controller[_0xc532('0x17')]);router[_0xc532('0x16')]('/:id/users',auth[_0xc532('0xb')](),controller[_0xc532('0x18')]);module[_0xc532('0x19')]=router;
\ No newline at end of file
+var _0x2713=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','put','update','delete','/:id','destroy','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0xbd6da,_0x45f40a){var _0x2d63f2=function(_0x366e50){while(--_0x366e50){_0xbd6da['push'](_0xbd6da['shift']());}};_0x2d63f2(++_0x45f40a);}(_0x2713,0x164));var _0x3271=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x2713[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x3271('0x0'));var util=require(_0x3271('0x1'));var path=require(_0x3271('0x2'));var timeout=require(_0x3271('0x3'));var express=require(_0x3271('0x4'));var router=express[_0x3271('0x5')]();var fs_extra=require(_0x3271('0x6'));var auth=require(_0x3271('0x7'));var interaction=require(_0x3271('0x8'));var config=require(_0x3271('0x9'));var controller=require(_0x3271('0xa'));router[_0x3271('0xb')]('/',auth[_0x3271('0xc')](),controller[_0x3271('0xd')]);router[_0x3271('0xb')](_0x3271('0xe'),auth[_0x3271('0xc')](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x3271('0xb')](_0x3271('0xf'),auth[_0x3271('0xc')](),controller[_0x3271('0x10')]);router[_0x3271('0xb')](_0x3271('0x11'),auth[_0x3271('0xc')](),controller[_0x3271('0x12')]);router[_0x3271('0xb')](_0x3271('0x13'),auth[_0x3271('0xc')](),controller[_0x3271('0x14')]);router[_0x3271('0x15')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3271('0x15')]('/:id/teams',auth[_0x3271('0xc')](),controller[_0x3271('0x16')]);router[_0x3271('0x15')]('/:id/users',auth[_0x3271('0xc')](),controller['addAgents']);router[_0x3271('0x17')]('/:id',auth[_0x3271('0xc')](),controller[_0x3271('0x18')]);router[_0x3271('0x19')](_0x3271('0x1a'),auth['isAuthenticated'](),controller[_0x3271('0x1b')]);router[_0x3271('0x19')](_0x3271('0x11'),auth['isAuthenticated'](),controller[_0x3271('0x1c')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x3271('0x1d')]=router;
\ No newline at end of file
index ac0b934..b5c3937 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2bb0=['STRING','INTEGER','beepall','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2bb0,0xf3));var _0x02bb=function(_0x3cf36c,_0x323fd5){_0x3cf36c=_0x3cf36c-0x0;var _0x371b06=_0x2bb0[_0x3cf36c];return _0x371b06;};'use strict';var Sequelize=require(_0x02bb('0x0'));module[_0x02bb('0x1')]={'name':{'type':Sequelize[_0x02bb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x02bb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x02bb('0x4'),'roundrobin')},'description':{'type':Sequelize[_0x02bb('0x2')]}};
\ No newline at end of file
+var _0xb010=['STRING','exports','name','ENUM','beepall','roundrobin'];(function(_0x4394e3,_0x36d68b){var _0x3e039a=function(_0x184c8f){while(--_0x184c8f){_0x4394e3['push'](_0x4394e3['shift']());}};_0x3e039a(++_0x36d68b);}(_0xb010,0x8b));var _0x0b01=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb010[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x0b01('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x0b01('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0b01('0x2')]('rrmemory',_0x0b01('0x3'),_0x0b01('0x4'))},'description':{'type':Sequelize[_0x0b01('0x5')]}};
\ No newline at end of file
index ecaf391..72f95a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xffd1=['destroy','WhatsappQueues','UserProfileResource','error','stack','name','index','WhatsappQueue','rawAttributes','fieldName','type','where','include','query','findAll','rows','catch','params','model','keys','filters','attributes','length','includeAll','merge','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','intersection','fields','hasOwnProperty','nolimit','sort','WhatsappQueueId','filter','options','User','findAndCountAll','map','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','findOrCreate','forEach','emit','userWhatsappQueue:save','select','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','compact','value','transaction','removeTeams','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','isArray','pick','getAgents','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','update','then'];(function(_0x59f670,_0x2a34aa){var _0x4ad264=function(_0x4a8709){while(--_0x4a8709){_0x59f670['push'](_0x59f670['shift']());}};_0x4ad264(++_0x2a34aa);}(_0xffd1,0x1c9));var _0x1ffd=function(_0xa80bfb,_0x2df555){_0xa80bfb=_0xa80bfb-0x0;var _0xd05a29=_0xffd1[_0xa80bfb];return _0xd05a29;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1ffd('0x0'));var squel=require('squel');var Redis=require(_0x1ffd('0x1'));var qs=require(_0x1ffd('0x2'));var logger=require(_0x1ffd('0x3'))('api');var config=require(_0x1ffd('0x4'));var db=require(_0x1ffd('0x5'))['db'];config[_0x1ffd('0x6')]=_[_0x1ffd('0x7')](config[_0x1ffd('0x6')],{'host':_0x1ffd('0x8'),'port':0x18eb});var socket=require(_0x1ffd('0x9'))(new Redis(config[_0x1ffd('0x6')]));require('./whatsappQueue.socket')[_0x1ffd('0xa')](socket);function respondWithStatusCode(_0x2e048b,_0x504339){_0x504339=_0x504339||0xcc;return function(_0x166485){if(_0x166485){return _0x2e048b[_0x1ffd('0xb')](_0x504339);}return _0x2e048b['status'](_0x504339)[_0x1ffd('0xc')]();};}function respondWithResult(_0xa5bc1,_0x499ada){_0x499ada=_0x499ada||0xc8;return function(_0x5eac90){if(_0x5eac90){return _0xa5bc1['status'](_0x499ada)[_0x1ffd('0xd')](_0x5eac90);}};}function respondWithFilteredResult(_0x25cd09,_0x3db4fb){return function(_0x179661){if(_0x179661){var _0x15d49a=typeof _0x3db4fb[_0x1ffd('0xe')]===_0x1ffd('0xf')&&typeof _0x3db4fb[_0x1ffd('0x10')]==='undefined';var _0x334c3b=_0x179661[_0x1ffd('0x11')];var _0x124fce=_0x15d49a?0x0:_0x3db4fb[_0x1ffd('0xe')];var _0x30fd00=_0x15d49a?_0x179661[_0x1ffd('0x11')]:_0x3db4fb[_0x1ffd('0xe')]+_0x3db4fb[_0x1ffd('0x10')];var _0x28ab27;if(_0x30fd00>=_0x334c3b){_0x30fd00=_0x334c3b;_0x28ab27=0xc8;}else{_0x28ab27=0xce;}_0x25cd09[_0x1ffd('0x12')](_0x28ab27);return _0x25cd09[_0x1ffd('0x13')](_0x1ffd('0x14'),_0x124fce+'-'+_0x30fd00+'/'+_0x334c3b)[_0x1ffd('0xd')](_0x179661);}return null;};}function saveUpdates(_0x55797c){return function(_0x4c617b){if(_0x4c617b){return _0x4c617b[_0x1ffd('0x15')](_0x55797c)[_0x1ffd('0x16')](function(_0x414a8e){return _0x414a8e;});}return null;};}function removeEntity(_0x393835){return function(_0x7d9b87){if(_0x7d9b87){return _0x7d9b87[_0x1ffd('0x17')]()[_0x1ffd('0x16')](function(){var _0x4ef7d8=_0x7d9b87['get']({'plain':!![]});var _0xa72d2f=_0x1ffd('0x18');return db[_0x1ffd('0x19')][_0x1ffd('0x17')]({'where':{'type':_0xa72d2f,'resourceId':_0x4ef7d8['id']}})[_0x1ffd('0x16')](function(){return _0x7d9b87;});})[_0x1ffd('0x16')](function(){_0x393835[_0x1ffd('0x12')](0xcc)[_0x1ffd('0xc')]();});}};}function handleEntityNotFound(_0x2efad8){return function(_0x559565){if(!_0x559565){_0x2efad8[_0x1ffd('0xb')](0x194);}return _0x559565;};}function handleError(_0x1d974d,_0x550c0c){_0x550c0c=_0x550c0c||0x1f4;return function(_0x36e0c7){logger[_0x1ffd('0x1a')](_0x36e0c7[_0x1ffd('0x1b')]);if(_0x36e0c7[_0x1ffd('0x1c')]){delete _0x36e0c7[_0x1ffd('0x1c')];}_0x1d974d['status'](_0x550c0c)['send'](_0x36e0c7);};}exports[_0x1ffd('0x1d')]=function(_0x5eee33,_0x1de95a){var _0x163e43={};var _0x101f3f={'count':0x0,'rows':[]};var _0x4a6fcd=_['map'](db[_0x1ffd('0x1e')][_0x1ffd('0x1f')],function(_0xb981f0){return{'name':_0xb981f0[_0x1ffd('0x20')],'type':_0xb981f0[_0x1ffd('0x21')]['key']};});_0x163e43=qs['getOptions'](_0x4a6fcd,_0x5eee33);var _0x2a6c28={'where':_0x163e43[_0x1ffd('0x22')]};return db['WhatsappQueue'][_0x1ffd('0x11')](_0x2a6c28)[_0x1ffd('0x16')](function(_0x17d128){_0x101f3f[_0x1ffd('0x11')]=_0x17d128;_0x163e43[_0x1ffd('0x23')]=qs[_0x1ffd('0x23')](_0x5eee33[_0x1ffd('0x24')]);return db[_0x1ffd('0x1e')][_0x1ffd('0x25')](_0x163e43);})[_0x1ffd('0x16')](function(_0x338652){_0x101f3f[_0x1ffd('0x26')]=_0x338652;return _0x101f3f;})['then'](respondWithFilteredResult(_0x1de95a,_0x163e43))[_0x1ffd('0x27')](handleError(_0x1de95a,null));};exports['show']=function(_0x38e15f,_0x57616f){var _0x5b181c={'raw':!![],'where':{'id':_0x38e15f[_0x1ffd('0x28')]['id']}},_0x5d4e63={};_0x5d4e63[_0x1ffd('0x29')]=_['keys'](db[_0x1ffd('0x1e')]['rawAttributes']);_0x5d4e63['query']=_[_0x1ffd('0x2a')](_0x38e15f[_0x1ffd('0x24')]);_0x5d4e63[_0x1ffd('0x2b')]=_['intersection'](_0x5d4e63[_0x1ffd('0x29')],_0x5d4e63[_0x1ffd('0x24')]);_0x5b181c['attributes']=_['intersection'](_0x5d4e63[_0x1ffd('0x29')],qs['fields'](_0x38e15f[_0x1ffd('0x24')]['fields']));_0x5b181c[_0x1ffd('0x2c')]=_0x5b181c[_0x1ffd('0x2c')][_0x1ffd('0x2d')]?_0x5b181c[_0x1ffd('0x2c')]:_0x5d4e63['model'];if(_0x38e15f[_0x1ffd('0x24')][_0x1ffd('0x2e')]){_0x5b181c[_0x1ffd('0x23')]=[{'all':!![]}];}_0x5b181c=_[_0x1ffd('0x2f')]({},_0x5b181c,_0x38e15f['options']);return db[_0x1ffd('0x1e')]['find'](_0x5b181c)['then'](handleEntityNotFound(_0x57616f,null))['then'](respondWithResult(_0x57616f,null))[_0x1ffd('0x27')](handleError(_0x57616f,null));};exports[_0x1ffd('0x30')]=function(_0x8cd62b,_0x40fbf0){return db[_0x1ffd('0x1e')][_0x1ffd('0x30')](_0x8cd62b[_0x1ffd('0x31')],{})[_0x1ffd('0x16')](function(_0x381e99){var _0x66b98=_0x8cd62b[_0x1ffd('0x32')][_0x1ffd('0x33')]({'plain':!![]});if(!_0x66b98)throw new Error(_0x1ffd('0x34'));if(_0x66b98[_0x1ffd('0x35')]===_0x1ffd('0x32')){var _0x432f11=_0x381e99['get']({'plain':!![]});var _0x45b013=_0x1ffd('0x18');return db[_0x1ffd('0x36')][_0x1ffd('0x37')]({'where':{'name':_0x45b013,'userProfileId':_0x66b98[_0x1ffd('0x38')]},'raw':!![]})[_0x1ffd('0x16')](function(_0x11fadc){if(_0x11fadc&&_0x11fadc[_0x1ffd('0x39')]===0x0){return db[_0x1ffd('0x19')][_0x1ffd('0x30')]({'name':_0x432f11['name'],'resourceId':_0x432f11['id'],'type':_0x11fadc[_0x1ffd('0x1c')],'sectionId':_0x11fadc['id']},{})[_0x1ffd('0x16')](function(){return _0x381e99;});}else{return _0x381e99;}})['catch'](function(_0x57266e){logger[_0x1ffd('0x1a')](_0x1ffd('0x3a'),_0x57266e);throw _0x57266e;});}return _0x381e99;})['then'](respondWithResult(_0x40fbf0,0xc9))[_0x1ffd('0x27')](handleError(_0x40fbf0,null));};exports[_0x1ffd('0x15')]=function(_0x326a50,_0x1705c9){if(_0x326a50[_0x1ffd('0x31')]['id']){delete _0x326a50[_0x1ffd('0x31')]['id'];}return db[_0x1ffd('0x1e')]['find']({'where':{'id':_0x326a50[_0x1ffd('0x28')]['id']}})[_0x1ffd('0x16')](handleEntityNotFound(_0x1705c9,null))[_0x1ffd('0x16')](saveUpdates(_0x326a50[_0x1ffd('0x31')],null))['then'](respondWithResult(_0x1705c9,null))['catch'](handleError(_0x1705c9,null));};exports['destroy']=function(_0x2e26db,_0x8c9856){return db[_0x1ffd('0x1e')][_0x1ffd('0x37')]({'where':{'id':_0x2e26db[_0x1ffd('0x28')]['id']}})[_0x1ffd('0x16')](handleEntityNotFound(_0x8c9856,null))[_0x1ffd('0x16')](removeEntity(_0x8c9856,null))[_0x1ffd('0x27')](handleError(_0x8c9856,null));};exports[_0x1ffd('0x3b')]=function(_0x596c22,_0x798dce){return db[_0x1ffd('0x1e')][_0x1ffd('0x3b')]()[_0x1ffd('0x16')](respondWithResult(_0x798dce,null))['catch'](handleError(_0x798dce,null));};exports[_0x1ffd('0x3c')]=function(_0xc5af8e,_0x4fc4d2){var _0x5f06d7={'raw':!![],'where':{}},_0xdafd47={},_0x5a2bbc;return db['WhatsappQueue'][_0x1ffd('0x3d')]({'where':{'id':_0xc5af8e[_0x1ffd('0x28')]['id']}})[_0x1ffd('0x16')](handleEntityNotFound(_0x4fc4d2,null))[_0x1ffd('0x16')](function(_0x492056){if(_0x492056){_0x5a2bbc=_0x492056[_0x1ffd('0x33')]({'plain':!![]});_0xdafd47[_0x1ffd('0x29')]=_['keys'](db[_0x1ffd('0x3e')][_0x1ffd('0x1f')]);_0xdafd47[_0x1ffd('0x24')]=_[_0x1ffd('0x2a')](_0xc5af8e[_0x1ffd('0x24')]);_0xdafd47[_0x1ffd('0x2b')]=_[_0x1ffd('0x3f')](_0xdafd47[_0x1ffd('0x29')],_0xdafd47[_0x1ffd('0x24')]);_0x5f06d7[_0x1ffd('0x2c')]=_[_0x1ffd('0x3f')](_0xdafd47[_0x1ffd('0x29')],qs[_0x1ffd('0x40')](_0xc5af8e[_0x1ffd('0x24')][_0x1ffd('0x40')]));_0x5f06d7['attributes']=_0x5f06d7[_0x1ffd('0x2c')][_0x1ffd('0x2d')]?_0x5f06d7[_0x1ffd('0x2c')]:_0xdafd47[_0x1ffd('0x29')];if(!_0xc5af8e[_0x1ffd('0x24')][_0x1ffd('0x41')](_0x1ffd('0x42'))){_0x5f06d7['limit']=qs[_0x1ffd('0x10')](_0xc5af8e['query'][_0x1ffd('0x10')]);_0x5f06d7['offset']=qs[_0x1ffd('0xe')](_0xc5af8e[_0x1ffd('0x24')][_0x1ffd('0xe')]);}_0x5f06d7['order']=qs[_0x1ffd('0x43')](_0xc5af8e[_0x1ffd('0x24')][_0x1ffd('0x43')]);_0x5f06d7[_0x1ffd('0x22')]=qs[_0x1ffd('0x2b')](_['pick'](_0xc5af8e[_0x1ffd('0x24')],_0xdafd47[_0x1ffd('0x2b')]));_0x5f06d7['where'][_0x1ffd('0x44')]=_0x492056['id'];if(_0xc5af8e[_0x1ffd('0x24')][_0x1ffd('0x45')]){_0x5f06d7[_0x1ffd('0x22')]=_[_0x1ffd('0x2f')](_0x5f06d7[_0x1ffd('0x22')],{'$or':_['map'](_0x5f06d7[_0x1ffd('0x2c')],function(_0x3e6e6e){var _0x434261={};_0x434261[_0x3e6e6e]={'$like':'%'+_0xc5af8e['query'][_0x1ffd('0x45')]+'%'};return _0x434261;})});}_0x5f06d7=_[_0x1ffd('0x2f')]({},_0x5f06d7,_0xc5af8e[_0x1ffd('0x46')]);return db['UserWhatsappQueue'][_0x1ffd('0x25')](_0x5f06d7);}})['then'](function(_0x3b2e5c){if(_0x3b2e5c){return db[_0x1ffd('0x47')][_0x1ffd('0x48')]({'where':{'id':_[_0x1ffd('0x49')](_0x3b2e5c,_0x1ffd('0x4a')),'role':_0x1ffd('0x4b')},'attributes':['id',_0x1ffd('0x1c'),'whatsappPause',_0x1ffd('0x4c'),_0x1ffd('0x4d')]});}})[_0x1ffd('0x16')](function(_0x37d379){if(_0x37d379){return{'count':_0x37d379[_0x1ffd('0x11')],'rows':_[_0x1ffd('0x49')](_0x37d379[_0x1ffd('0x26')],function(_0xeb5940){return{'membername':_0xeb5940[_0x1ffd('0x1c')],'UserId':_0xeb5940['id'],'queue_name':_0x5a2bbc[_0x1ffd('0x1c')],'WhatsappQueueId':_0x5a2bbc['id'],'interface':util[_0x1ffd('0x4e')](_0x1ffd('0x4f'),_0x1ffd('0x50'),_0xeb5940['name']),'penalty':0x0,'paused':_0xeb5940['whatsappPause'],'createdAt':_0xeb5940[_0x1ffd('0x4d')],'updatedAt':_0xeb5940[_0x1ffd('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1ffd('0x16')](respondWithFilteredResult(_0x4fc4d2,_0x5f06d7))[_0x1ffd('0x27')](handleError(_0x4fc4d2,null));};exports[_0x1ffd('0x51')]=function(_0x4ee41c,_0xaf0899){var _0x2a748c={};var _0x30b9e={};var _0x7f0938;var _0x23e474;return db[_0x1ffd('0x1e')][_0x1ffd('0x3d')]({'where':{'id':_0x4ee41c[_0x1ffd('0x28')]['id']}})[_0x1ffd('0x16')](handleEntityNotFound(_0xaf0899,null))[_0x1ffd('0x16')](function(_0x40bdf7){if(_0x40bdf7){_0x7f0938=_0x40bdf7;_0x30b9e[_0x1ffd('0x29')]=_[_0x1ffd('0x2a')](db['Team'][_0x1ffd('0x1f')]);_0x30b9e['query']=_[_0x1ffd('0x2a')](_0x4ee41c[_0x1ffd('0x24')]);_0x30b9e[_0x1ffd('0x2b')]=_[_0x1ffd('0x3f')](_0x30b9e[_0x1ffd('0x29')],_0x30b9e[_0x1ffd('0x24')]);_0x2a748c[_0x1ffd('0x2c')]=_[_0x1ffd('0x3f')](_0x30b9e[_0x1ffd('0x29')],qs[_0x1ffd('0x40')](_0x4ee41c['query'][_0x1ffd('0x40')]));_0x2a748c[_0x1ffd('0x2c')]=_0x2a748c[_0x1ffd('0x2c')][_0x1ffd('0x2d')]?_0x2a748c['attributes']:_0x30b9e[_0x1ffd('0x29')];_0x2a748c['order']=qs[_0x1ffd('0x43')](_0x4ee41c[_0x1ffd('0x24')]['sort']);_0x2a748c[_0x1ffd('0x22')]=qs[_0x1ffd('0x2b')](_['pick'](_0x4ee41c['query'],_0x30b9e[_0x1ffd('0x2b')]));if(_0x4ee41c['query']['filter']){_0x2a748c[_0x1ffd('0x22')]=_[_0x1ffd('0x2f')](_0x2a748c[_0x1ffd('0x22')],{'$or':_[_0x1ffd('0x49')](_0x2a748c[_0x1ffd('0x2c')],function(_0x54a805){var _0x3538fe={};_0x3538fe[_0x54a805]={'$like':'%'+_0x4ee41c[_0x1ffd('0x24')][_0x1ffd('0x45')]+'%'};return _0x3538fe;})});}_0x2a748c=_['merge']({},_0x2a748c,_0x4ee41c[_0x1ffd('0x46')]);return _0x7f0938['getTeams'](_0x2a748c);}})[_0x1ffd('0x16')](function(_0x1f58f7){if(_0x1f58f7){_0x23e474=_0x1f58f7['length'];if(!_0x4ee41c['query'][_0x1ffd('0x41')](_0x1ffd('0x42'))){_0x2a748c[_0x1ffd('0x10')]=qs['limit'](_0x4ee41c[_0x1ffd('0x24')]['limit']);_0x2a748c[_0x1ffd('0xe')]=qs[_0x1ffd('0xe')](_0x4ee41c[_0x1ffd('0x24')][_0x1ffd('0xe')]);}return _0x7f0938[_0x1ffd('0x51')](_0x2a748c);}})['then'](function(_0x5351d1){if(_0x5351d1){return _0x5351d1?{'count':_0x23e474,'rows':_0x5351d1}:null;}})[_0x1ffd('0x16')](respondWithResult(_0xaf0899,null))[_0x1ffd('0x27')](handleError(_0xaf0899,null));};exports[_0x1ffd('0x52')]=function(_0xb1ec91,_0x1be016){var _0x2550cb=_0xb1ec91['body'][_0x1ffd('0x53')];return db[_0x1ffd('0x54')][_0x1ffd('0x25')]({'where':{'id':_0x2550cb},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1ffd('0x55'),'attributes':['id',_0x1ffd('0x1c'),_0x1ffd('0x56'),_0x1ffd('0x57'),_0x1ffd('0x58')],'raw':!![]}]})[_0x1ffd('0x16')](function(_0x465c9e){if(_0x465c9e){var _0x350b42=_[_0x1ffd('0x59')](_0x465c9e,function(_0x1e6d3b){var _0x592abd=_0x1e6d3b[_0x1ffd('0x33')]({'plain':!![]});return _0x592abd['Agents'];});return db[_0x1ffd('0x1e')][_0x1ffd('0x37')]({'where':{'id':_0xb1ec91[_0x1ffd('0x28')]['id']}})[_0x1ffd('0x16')](function(_0x23e6db){return db[_0x1ffd('0x5a')]['transaction'](function(_0x37e623){return _0x23e6db[_0x1ffd('0x52')](_0x2550cb,{'transaction':_0x37e623})[_0x1ffd('0x16')](function(){return BPromise['each'](_0x350b42,function(_0x5af27a){return db['UserWhatsappQueue'][_0x1ffd('0x5b')]({'where':{'UserId':_0x5af27a['id'],'WhatsappQueueId':_0xb1ec91[_0x1ffd('0x28')]['id']},'transaction':_0x37e623});});})[_0x1ffd('0x16')](function(){_0x350b42[_0x1ffd('0x5c')](function(_0x662729){socket[_0x1ffd('0x5d')](_0x1ffd('0x5e'),{'UserId':_0x662729['id'],'WhatsappQueueId':_0x23e6db['id']});});});});});}})[_0x1ffd('0x16')](respondWithStatusCode(_0x1be016,null))[_0x1ffd('0x27')](handleError(_0x1be016,null));};exports['removeTeams']=function(_0x34e001,_0x217c41){return db[_0x1ffd('0x54')][_0x1ffd('0x25')]({'where':{'id':_0x34e001['query'][_0x1ffd('0x53')]},'attributes':['id'],'include':[{'model':db[_0x1ffd('0x47')],'as':_0x1ffd('0x55'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x217c41,null))[_0x1ffd('0x16')](function(_0x46d2c2){var _0x3c6406=_[_0x1ffd('0x49')](_0x46d2c2,'id');var _0x2d62d1=[];var _0x1dae1c=[];var _0x4f8401=squel[_0x1ffd('0x5f')]();_0x4f8401['field'](_0x1ffd('0x60'))['from']('team_has_whatsapp_queues','tq')[_0x1ffd('0x61')](_0x1ffd('0x62'),'ut',_0x1ffd('0x63'))[_0x1ffd('0x22')](_0x1ffd('0x64'),_0x34e001[_0x1ffd('0x28')]['id']);for(var _0x477f64=0x0;_0x477f64<_0x46d2c2[_0x1ffd('0x2d')];_0x477f64+=0x1){let _0x559854=_0x46d2c2[_0x477f64];for(var _0x99d5f0=0x0;_0x99d5f0<_0x559854[_0x1ffd('0x55')]['length'];_0x99d5f0+=0x1){let _0x23db3=_0x559854['Agents'][_0x99d5f0];var _0x2f51bd=_0x4f8401[_0x1ffd('0x65')]();_0x2f51bd[_0x1ffd('0x22')](_0x1ffd('0x66'),_0x23db3['id']);_0x1dae1c[_0x1ffd('0x67')](db[_0x1ffd('0x5a')][_0x1ffd('0x24')](_0x2f51bd[_0x1ffd('0x68')](),{'type':db[_0x1ffd('0x5a')][_0x1ffd('0x69')][_0x1ffd('0x6a')]})[_0x1ffd('0x16')](function(_0x968122){if(_0x968122[_0x1ffd('0x2d')]===0x1){return _0x23db3['id'];}else{var _0x15636b=_[_0x1ffd('0x6b')](_[_0x1ffd('0x49')](_0x968122,'TeamId'),function(_0x3a8cca){return _['includes'](_0x3c6406,_0x3a8cca);});if(_0x15636b){return _0x23db3['id'];}}}));}}return BPromise[_0x1ffd('0x6c')](_0x1dae1c)[_0x1ffd('0x16')](function(_0x48f07){_0x2d62d1=_(_0x2d62d1)['union'](_0x48f07)[_0x1ffd('0x6d')]()[_0x1ffd('0x6e')]();return db[_0x1ffd('0x1e')][_0x1ffd('0x37')]({'where':{'id':_0x34e001[_0x1ffd('0x28')]['id']}})[_0x1ffd('0x16')](function(_0x26775a){return db['sequelize'][_0x1ffd('0x6f')](function(_0x4d0156){return _0x26775a[_0x1ffd('0x70')](_0x34e001[_0x1ffd('0x24')][_0x1ffd('0x53')],{'transaction':_0x4d0156})['then'](function(){if(!_[_0x1ffd('0x71')](_0x2d62d1)){return _0x26775a[_0x1ffd('0x72')](_0x2d62d1,{'transaction':_0x4d0156});}})[_0x1ffd('0x16')](function(){_0x2d62d1['forEach'](function(_0x37067f){socket['emit'](_0x1ffd('0x73'),{'UserId':_0x37067f,'WhatsappQueueId':_0x26775a['id']});});});});});});})[_0x1ffd('0x16')](respondWithStatusCode(_0x217c41,null))[_0x1ffd('0x27')](handleError(_0x217c41,null));};exports[_0x1ffd('0x74')]=function(_0x4f3e77,_0x3c5e94){return db[_0x1ffd('0x1e')][_0x1ffd('0x37')]({'where':{'id':_0x4f3e77['params']['id']}})[_0x1ffd('0x16')](handleEntityNotFound(_0x3c5e94,null))[_0x1ffd('0x16')](function(_0x130597){if(_0x130597){return _0x130597[_0x1ffd('0x74')](_0x4f3e77[_0x1ffd('0x31')]['ids'],_['omit'](_0x4f3e77[_0x1ffd('0x31')],[_0x1ffd('0x53'),'id'])||{})['spread'](function(_0x10b881){for(var _0x51a2d9=0x0;_0x51a2d9<_0x4f3e77['body'][_0x1ffd('0x53')][_0x1ffd('0x2d')];_0x51a2d9+=0x1){socket['emit'](_0x1ffd('0x5e'),{'UserId':Number(_0x4f3e77[_0x1ffd('0x31')]['ids'][_0x51a2d9]),'WhatsappQueueId':Number(_0x4f3e77['params']['id'])});}return _0x10b881;});}})[_0x1ffd('0x16')](respondWithResult(_0x3c5e94,null))[_0x1ffd('0x27')](handleError(_0x3c5e94,null));};exports[_0x1ffd('0x72')]=function(_0x22f944,_0x469820){return db[_0x1ffd('0x1e')]['find']({'where':{'id':_0x22f944[_0x1ffd('0x28')]['id']}})[_0x1ffd('0x16')](handleEntityNotFound(_0x469820,null))['then'](function(_0x37de9d){if(_0x37de9d){return _0x37de9d[_0x1ffd('0x72')](_0x22f944[_0x1ffd('0x24')]['ids'])['then'](function(){if(_[_0x1ffd('0x75')](_0x22f944[_0x1ffd('0x24')][_0x1ffd('0x53')])){for(var _0x48c9fd=0x0;_0x48c9fd<_0x22f944[_0x1ffd('0x24')]['ids'][_0x1ffd('0x2d')];_0x48c9fd+=0x1){socket[_0x1ffd('0x5d')]('userWhatsappQueue:remove',{'UserId':Number(_0x22f944['query'][_0x1ffd('0x53')][_0x48c9fd]),'WhatsappQueueId':Number(_0x22f944[_0x1ffd('0x28')]['id'])});}}else{socket[_0x1ffd('0x5d')](_0x1ffd('0x73'),{'UserId':Number(_0x22f944[_0x1ffd('0x24')][_0x1ffd('0x53')]),'WhatsappQueueId':Number(_0x22f944[_0x1ffd('0x28')]['id'])});}});}})['then'](respondWithStatusCode(_0x469820,null))[_0x1ffd('0x27')](handleError(_0x469820,null));};exports['getAgents']=function(_0x29abab,_0x337fe9){var _0xb3cc0c={};var _0x5b9ff1={};var _0x485cc6;var _0x4b8136;return db[_0x1ffd('0x1e')]['findOne']({'where':{'id':_0x29abab[_0x1ffd('0x28')]['id']}})['then'](handleEntityNotFound(_0x337fe9,null))['then'](function(_0x5942fd){if(_0x5942fd){_0x485cc6=_0x5942fd;_0x5b9ff1[_0x1ffd('0x29')]=_[_0x1ffd('0x2a')](db[_0x1ffd('0x47')][_0x1ffd('0x1f')]);_0x5b9ff1['query']=_[_0x1ffd('0x2a')](_0x29abab[_0x1ffd('0x24')]);_0x5b9ff1['filters']=_['intersection'](_0x5b9ff1[_0x1ffd('0x29')],_0x5b9ff1[_0x1ffd('0x24')]);_0xb3cc0c['attributes']=_['intersection'](_0x5b9ff1[_0x1ffd('0x29')],qs['fields'](_0x29abab[_0x1ffd('0x24')]['fields']));_0xb3cc0c['attributes']=_0xb3cc0c['attributes'][_0x1ffd('0x2d')]?_0xb3cc0c['attributes']:_0x5b9ff1[_0x1ffd('0x29')];_0xb3cc0c['order']=qs[_0x1ffd('0x43')](_0x29abab[_0x1ffd('0x24')][_0x1ffd('0x43')]);_0xb3cc0c[_0x1ffd('0x22')]=qs[_0x1ffd('0x2b')](_[_0x1ffd('0x76')](_0x29abab[_0x1ffd('0x24')],_0x5b9ff1[_0x1ffd('0x2b')]));if(_0x29abab[_0x1ffd('0x24')]['filter']){_0xb3cc0c[_0x1ffd('0x22')]=_[_0x1ffd('0x2f')](_0xb3cc0c[_0x1ffd('0x22')],{'$or':_[_0x1ffd('0x49')](_0xb3cc0c[_0x1ffd('0x2c')],function(_0xe88d38){var _0x16d5e8={};_0x16d5e8[_0xe88d38]={'$like':'%'+_0x29abab[_0x1ffd('0x24')][_0x1ffd('0x45')]+'%'};return _0x16d5e8;})});}_0xb3cc0c=_['merge']({},_0xb3cc0c,_0x29abab[_0x1ffd('0x46')]);return _0x485cc6[_0x1ffd('0x77')](_0xb3cc0c);}})[_0x1ffd('0x16')](function(_0x26447d){if(_0x26447d){_0x4b8136=_0x26447d['length'];if(!_0x29abab[_0x1ffd('0x24')]['hasOwnProperty'](_0x1ffd('0x42'))){_0xb3cc0c[_0x1ffd('0x10')]=qs[_0x1ffd('0x10')](_0x29abab[_0x1ffd('0x24')]['limit']);_0xb3cc0c[_0x1ffd('0xe')]=qs[_0x1ffd('0xe')](_0x29abab[_0x1ffd('0x24')][_0x1ffd('0xe')]);}return _0x485cc6[_0x1ffd('0x77')](_0xb3cc0c);}})[_0x1ffd('0x16')](function(_0x3f0096){if(_0x3f0096){return _0x3f0096?{'count':_0x4b8136,'rows':_0x3f0096}:null;}})['then'](respondWithResult(_0x337fe9,null))[_0x1ffd('0x27')](handleError(_0x337fe9,null));};
\ No newline at end of file
+var _0xa197=['sequelize','transaction','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','from','team_has_whatsapp_queues','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','union','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','emit','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','sendStatus','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','end','error','stack','name','send','map','rawAttributes','type','key','getOptions','where','count','include','WhatsappQueue','catch','show','params','model','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','hasOwnProperty','order','pick','WhatsappQueueId','filter','UserWhatsappQueue','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','rows','format','%s/%s','SIP','whatsappPause','Team','sort','nolimit','getTeams','addTeams','ids','Agents','online','voicePause','interface'];(function(_0xf28721,_0x4b11b1){var _0x3bd163=function(_0x55f43c){while(--_0x55f43c){_0xf28721['push'](_0xf28721['shift']());}};_0x3bd163(++_0x4b11b1);}(_0xa197,0x18f));var _0x7a19=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0xa197[_0x1eda20];return _0x31b953;};'use strict';var BPromise=require(_0x7a19('0x0'));var util=require(_0x7a19('0x1'));var _=require(_0x7a19('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x7a19('0x3'));var logger=require(_0x7a19('0x4'))(_0x7a19('0x5'));var config=require(_0x7a19('0x6'));var db=require(_0x7a19('0x7'))['db'];config[_0x7a19('0x8')]=_[_0x7a19('0x9')](config[_0x7a19('0x8')],{'host':_0x7a19('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7a19('0xb'))['register'](socket);function respondWithStatusCode(_0x296afe,_0x28fef4){_0x28fef4=_0x28fef4||0xcc;return function(_0x4f0b2f){if(_0x4f0b2f){return _0x296afe[_0x7a19('0xc')](_0x28fef4);}return _0x296afe[_0x7a19('0xd')](_0x28fef4)['end']();};}function respondWithResult(_0x18e11f,_0x5c475a){_0x5c475a=_0x5c475a||0xc8;return function(_0x2934b8){if(_0x2934b8){return _0x18e11f[_0x7a19('0xd')](_0x5c475a)[_0x7a19('0xe')](_0x2934b8);}};}function respondWithFilteredResult(_0x438cee,_0x256844){return function(_0x3adaa8){if(_0x3adaa8){var _0x59ed25=typeof _0x256844[_0x7a19('0xf')]===_0x7a19('0x10')&&typeof _0x256844[_0x7a19('0x11')]===_0x7a19('0x10');var _0x22e136=_0x3adaa8['count'];var _0x85c54c=_0x59ed25?0x0:_0x256844[_0x7a19('0xf')];var _0x1fda28=_0x59ed25?_0x3adaa8['count']:_0x256844[_0x7a19('0xf')]+_0x256844[_0x7a19('0x11')];var _0x5c6329;if(_0x1fda28>=_0x22e136){_0x1fda28=_0x22e136;_0x5c6329=0xc8;}else{_0x5c6329=0xce;}_0x438cee[_0x7a19('0xd')](_0x5c6329);return _0x438cee[_0x7a19('0x12')](_0x7a19('0x13'),_0x85c54c+'-'+_0x1fda28+'/'+_0x22e136)[_0x7a19('0xe')](_0x3adaa8);}return null;};}function saveUpdates(_0xfe8827){return function(_0x1c07fa){if(_0x1c07fa){return _0x1c07fa[_0x7a19('0x14')](_0xfe8827)[_0x7a19('0x15')](function(_0x4bf0ce){return _0x4bf0ce;});}return null;};}function removeEntity(_0x5250fa){return function(_0x520c29){if(_0x520c29){return _0x520c29[_0x7a19('0x16')]()[_0x7a19('0x15')](function(){var _0x42e413=_0x520c29[_0x7a19('0x17')]({'plain':!![]});var _0x56fb61=_0x7a19('0x18');return db[_0x7a19('0x19')][_0x7a19('0x16')]({'where':{'type':_0x56fb61,'resourceId':_0x42e413['id']}})[_0x7a19('0x15')](function(){return _0x520c29;});})[_0x7a19('0x15')](function(){_0x5250fa[_0x7a19('0xd')](0xcc)[_0x7a19('0x1a')]();});}};}function handleEntityNotFound(_0x1a8c19){return function(_0x1ba6a3){if(!_0x1ba6a3){_0x1a8c19[_0x7a19('0xc')](0x194);}return _0x1ba6a3;};}function handleError(_0x206e43,_0x45e78d){_0x45e78d=_0x45e78d||0x1f4;return function(_0x345cdf){logger[_0x7a19('0x1b')](_0x345cdf[_0x7a19('0x1c')]);if(_0x345cdf['name']){delete _0x345cdf[_0x7a19('0x1d')];}_0x206e43[_0x7a19('0xd')](_0x45e78d)[_0x7a19('0x1e')](_0x345cdf);};}exports['index']=function(_0x1b7896,_0x4b86a1){var _0x419e33={};var _0x58b840={'count':0x0,'rows':[]};var _0x1037f8=_[_0x7a19('0x1f')](db['WhatsappQueue'][_0x7a19('0x20')],function(_0x110c2c){return{'name':_0x110c2c['fieldName'],'type':_0x110c2c[_0x7a19('0x21')][_0x7a19('0x22')]};});_0x419e33=qs[_0x7a19('0x23')](_0x1037f8,_0x1b7896);var _0x2f5f94={'where':_0x419e33[_0x7a19('0x24')]};return db['WhatsappQueue'][_0x7a19('0x25')](_0x2f5f94)[_0x7a19('0x15')](function(_0x4f0c9b){_0x58b840[_0x7a19('0x25')]=_0x4f0c9b;_0x419e33[_0x7a19('0x26')]=qs[_0x7a19('0x26')](_0x1b7896['query']);return db[_0x7a19('0x27')]['findAll'](_0x419e33);})[_0x7a19('0x15')](function(_0xcffa0a){_0x58b840['rows']=_0xcffa0a;return _0x58b840;})[_0x7a19('0x15')](respondWithFilteredResult(_0x4b86a1,_0x419e33))[_0x7a19('0x28')](handleError(_0x4b86a1,null));};exports[_0x7a19('0x29')]=function(_0x120957,_0x56b262){var _0x2e10af={'raw':!![],'where':{'id':_0x120957[_0x7a19('0x2a')]['id']}},_0x4021fc={};_0x4021fc[_0x7a19('0x2b')]=_['keys'](db['WhatsappQueue'][_0x7a19('0x20')]);_0x4021fc[_0x7a19('0x2c')]=_[_0x7a19('0x2d')](_0x120957[_0x7a19('0x2c')]);_0x4021fc[_0x7a19('0x2e')]=_[_0x7a19('0x2f')](_0x4021fc[_0x7a19('0x2b')],_0x4021fc[_0x7a19('0x2c')]);_0x2e10af[_0x7a19('0x30')]=_['intersection'](_0x4021fc[_0x7a19('0x2b')],qs[_0x7a19('0x31')](_0x120957[_0x7a19('0x2c')][_0x7a19('0x31')]));_0x2e10af[_0x7a19('0x30')]=_0x2e10af['attributes'][_0x7a19('0x32')]?_0x2e10af[_0x7a19('0x30')]:_0x4021fc[_0x7a19('0x2b')];if(_0x120957[_0x7a19('0x2c')][_0x7a19('0x33')]){_0x2e10af[_0x7a19('0x26')]=[{'all':!![]}];}_0x2e10af=_[_0x7a19('0x34')]({},_0x2e10af,_0x120957[_0x7a19('0x35')]);return db[_0x7a19('0x27')][_0x7a19('0x36')](_0x2e10af)[_0x7a19('0x15')](handleEntityNotFound(_0x56b262,null))[_0x7a19('0x15')](respondWithResult(_0x56b262,null))[_0x7a19('0x28')](handleError(_0x56b262,null));};exports[_0x7a19('0x37')]=function(_0x4f1b20,_0x48256c){return db[_0x7a19('0x27')][_0x7a19('0x37')](_0x4f1b20[_0x7a19('0x38')],{})['then'](function(_0x4d4e19){var _0x360082=_0x4f1b20[_0x7a19('0x39')][_0x7a19('0x17')]({'plain':!![]});if(!_0x360082)throw new Error(_0x7a19('0x3a'));if(_0x360082['role']===_0x7a19('0x39')){var _0x28fbc0=_0x4d4e19[_0x7a19('0x17')]({'plain':!![]});var _0x468611=_0x7a19('0x18');return db[_0x7a19('0x3b')][_0x7a19('0x36')]({'where':{'name':_0x468611,'userProfileId':_0x360082[_0x7a19('0x3c')]},'raw':!![]})[_0x7a19('0x15')](function(_0x41e8cc){if(_0x41e8cc&&_0x41e8cc['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x28fbc0['name'],'resourceId':_0x28fbc0['id'],'type':_0x41e8cc[_0x7a19('0x1d')],'sectionId':_0x41e8cc['id']},{})[_0x7a19('0x15')](function(){return _0x4d4e19;});}else{return _0x4d4e19;}})[_0x7a19('0x28')](function(_0x2da5c2){logger[_0x7a19('0x1b')](_0x7a19('0x3d'),_0x2da5c2);throw _0x2da5c2;});}return _0x4d4e19;})[_0x7a19('0x15')](respondWithResult(_0x48256c,0xc9))[_0x7a19('0x28')](handleError(_0x48256c,null));};exports[_0x7a19('0x14')]=function(_0x5586f3,_0x40217e){if(_0x5586f3[_0x7a19('0x38')]['id']){delete _0x5586f3[_0x7a19('0x38')]['id'];}return db[_0x7a19('0x27')]['find']({'where':{'id':_0x5586f3[_0x7a19('0x2a')]['id']}})['then'](handleEntityNotFound(_0x40217e,null))[_0x7a19('0x15')](saveUpdates(_0x5586f3['body'],null))['then'](respondWithResult(_0x40217e,null))[_0x7a19('0x28')](handleError(_0x40217e,null));};exports[_0x7a19('0x16')]=function(_0x93de4e,_0xb7786e){return db[_0x7a19('0x27')][_0x7a19('0x36')]({'where':{'id':_0x93de4e['params']['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0xb7786e,null))['then'](removeEntity(_0xb7786e,null))['catch'](handleError(_0xb7786e,null));};exports[_0x7a19('0x3e')]=function(_0x1065ac,_0x34cd21){return db['WhatsappQueue'][_0x7a19('0x3e')]()['then'](respondWithResult(_0x34cd21,null))[_0x7a19('0x28')](handleError(_0x34cd21,null));};exports[_0x7a19('0x3f')]=function(_0x4289b3,_0x1beafc){var _0x382757={'raw':!![],'where':{}},_0xb0edb3={},_0x13d664;return db[_0x7a19('0x27')][_0x7a19('0x40')]({'where':{'id':_0x4289b3['params']['id']}})['then'](handleEntityNotFound(_0x1beafc,null))[_0x7a19('0x15')](function(_0xf01be6){if(_0xf01be6){_0x13d664=_0xf01be6['get']({'plain':!![]});_0xb0edb3[_0x7a19('0x2b')]=_['keys'](db['UserWhatsappQueue'][_0x7a19('0x20')]);_0xb0edb3[_0x7a19('0x2c')]=_['keys'](_0x4289b3[_0x7a19('0x2c')]);_0xb0edb3['filters']=_[_0x7a19('0x2f')](_0xb0edb3[_0x7a19('0x2b')],_0xb0edb3[_0x7a19('0x2c')]);_0x382757[_0x7a19('0x30')]=_['intersection'](_0xb0edb3['model'],qs[_0x7a19('0x31')](_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x31')]));_0x382757[_0x7a19('0x30')]=_0x382757[_0x7a19('0x30')][_0x7a19('0x32')]?_0x382757['attributes']:_0xb0edb3[_0x7a19('0x2b')];if(!_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x41')]('nolimit')){_0x382757[_0x7a19('0x11')]=qs[_0x7a19('0x11')](_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x11')]);_0x382757[_0x7a19('0xf')]=qs[_0x7a19('0xf')](_0x4289b3[_0x7a19('0x2c')][_0x7a19('0xf')]);}_0x382757[_0x7a19('0x42')]=qs['sort'](_0x4289b3[_0x7a19('0x2c')]['sort']);_0x382757[_0x7a19('0x24')]=qs[_0x7a19('0x2e')](_[_0x7a19('0x43')](_0x4289b3['query'],_0xb0edb3[_0x7a19('0x2e')]));_0x382757['where'][_0x7a19('0x44')]=_0xf01be6['id'];if(_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x45')]){_0x382757['where']=_[_0x7a19('0x34')](_0x382757[_0x7a19('0x24')],{'$or':_[_0x7a19('0x1f')](_0x382757['attributes'],function(_0x47ab93){var _0x5d6c7d={};_0x5d6c7d[_0x47ab93]={'$like':'%'+_0x4289b3[_0x7a19('0x2c')][_0x7a19('0x45')]+'%'};return _0x5d6c7d;})});}_0x382757=_[_0x7a19('0x34')]({},_0x382757,_0x4289b3['options']);return db[_0x7a19('0x46')][_0x7a19('0x47')](_0x382757);}})[_0x7a19('0x15')](function(_0x7f017f){if(_0x7f017f){return db[_0x7a19('0x48')][_0x7a19('0x49')]({'where':{'id':_['map'](_0x7f017f,_0x7a19('0x4a')),'role':_0x7a19('0x4b')},'attributes':['id',_0x7a19('0x1d'),'whatsappPause',_0x7a19('0x4c'),_0x7a19('0x4d')]});}})['then'](function(_0xf24db2){if(_0xf24db2){return{'count':_0xf24db2['count'],'rows':_['map'](_0xf24db2[_0x7a19('0x4e')],function(_0x44797a){return{'membername':_0x44797a[_0x7a19('0x1d')],'UserId':_0x44797a['id'],'queue_name':_0x13d664['name'],'WhatsappQueueId':_0x13d664['id'],'interface':util[_0x7a19('0x4f')](_0x7a19('0x50'),_0x7a19('0x51'),_0x44797a[_0x7a19('0x1d')]),'penalty':0x0,'paused':_0x44797a[_0x7a19('0x52')],'createdAt':_0x44797a[_0x7a19('0x4d')],'updatedAt':_0x44797a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7a19('0x15')](respondWithFilteredResult(_0x1beafc,_0x382757))[_0x7a19('0x28')](handleError(_0x1beafc,null));};exports['getTeams']=function(_0x255461,_0x1f4b80){var _0x1e963f={};var _0x101478={};var _0x493562;var _0x19f065;return db[_0x7a19('0x27')][_0x7a19('0x40')]({'where':{'id':_0x255461[_0x7a19('0x2a')]['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0x1f4b80,null))[_0x7a19('0x15')](function(_0x318531){if(_0x318531){_0x493562=_0x318531;_0x101478[_0x7a19('0x2b')]=_[_0x7a19('0x2d')](db[_0x7a19('0x53')][_0x7a19('0x20')]);_0x101478['query']=_[_0x7a19('0x2d')](_0x255461[_0x7a19('0x2c')]);_0x101478[_0x7a19('0x2e')]=_[_0x7a19('0x2f')](_0x101478['model'],_0x101478[_0x7a19('0x2c')]);_0x1e963f[_0x7a19('0x30')]=_['intersection'](_0x101478[_0x7a19('0x2b')],qs[_0x7a19('0x31')](_0x255461['query'][_0x7a19('0x31')]));_0x1e963f[_0x7a19('0x30')]=_0x1e963f['attributes'][_0x7a19('0x32')]?_0x1e963f[_0x7a19('0x30')]:_0x101478[_0x7a19('0x2b')];_0x1e963f[_0x7a19('0x42')]=qs[_0x7a19('0x54')](_0x255461[_0x7a19('0x2c')]['sort']);_0x1e963f[_0x7a19('0x24')]=qs[_0x7a19('0x2e')](_['pick'](_0x255461[_0x7a19('0x2c')],_0x101478[_0x7a19('0x2e')]));if(_0x255461[_0x7a19('0x2c')]['filter']){_0x1e963f[_0x7a19('0x24')]=_[_0x7a19('0x34')](_0x1e963f[_0x7a19('0x24')],{'$or':_[_0x7a19('0x1f')](_0x1e963f[_0x7a19('0x30')],function(_0x338211){var _0x3da3a2={};_0x3da3a2[_0x338211]={'$like':'%'+_0x255461[_0x7a19('0x2c')][_0x7a19('0x45')]+'%'};return _0x3da3a2;})});}_0x1e963f=_['merge']({},_0x1e963f,_0x255461[_0x7a19('0x35')]);return _0x493562['getTeams'](_0x1e963f);}})['then'](function(_0x624040){if(_0x624040){_0x19f065=_0x624040[_0x7a19('0x32')];if(!_0x255461[_0x7a19('0x2c')]['hasOwnProperty'](_0x7a19('0x55'))){_0x1e963f[_0x7a19('0x11')]=qs['limit'](_0x255461['query'][_0x7a19('0x11')]);_0x1e963f[_0x7a19('0xf')]=qs[_0x7a19('0xf')](_0x255461[_0x7a19('0x2c')]['offset']);}return _0x493562[_0x7a19('0x56')](_0x1e963f);}})[_0x7a19('0x15')](function(_0x420257){if(_0x420257){return _0x420257?{'count':_0x19f065,'rows':_0x420257}:null;}})['then'](respondWithResult(_0x1f4b80,null))[_0x7a19('0x28')](handleError(_0x1f4b80,null));};exports[_0x7a19('0x57')]=function(_0x83d0f1,_0x42ea2e){var _0x4cb76d=_0x83d0f1[_0x7a19('0x38')][_0x7a19('0x58')];return db[_0x7a19('0x53')][_0x7a19('0x47')]({'where':{'id':_0x4cb76d},'attributes':['id'],'include':[{'model':db[_0x7a19('0x48')],'as':_0x7a19('0x59'),'attributes':['id',_0x7a19('0x1d'),_0x7a19('0x5a'),_0x7a19('0x5b'),_0x7a19('0x5c')],'raw':!![]}]})[_0x7a19('0x15')](function(_0x321c08){if(_0x321c08){var _0x45a280=_['flatMap'](_0x321c08,function(_0x18589c){var _0x53e334=_0x18589c['get']({'plain':!![]});return _0x53e334['Agents'];});return db['WhatsappQueue'][_0x7a19('0x36')]({'where':{'id':_0x83d0f1[_0x7a19('0x2a')]['id']}})['then'](function(_0x1cf2a2){return db[_0x7a19('0x5d')][_0x7a19('0x5e')](function(_0x53a337){return _0x1cf2a2[_0x7a19('0x57')](_0x4cb76d,{'transaction':_0x53a337})[_0x7a19('0x15')](function(){return BPromise[_0x7a19('0x5f')](_0x45a280,function(_0x712930){return db['UserWhatsappQueue'][_0x7a19('0x60')]({'where':{'UserId':_0x712930['id'],'WhatsappQueueId':_0x83d0f1['params']['id']},'transaction':_0x53a337});});})[_0x7a19('0x15')](function(){_0x45a280[_0x7a19('0x61')](function(_0x1d37e9){socket['emit'](_0x7a19('0x62'),{'UserId':_0x1d37e9['id'],'WhatsappQueueId':_0x1cf2a2['id']});});});});});}})[_0x7a19('0x15')](respondWithStatusCode(_0x42ea2e,null))[_0x7a19('0x28')](handleError(_0x42ea2e,null));};exports[_0x7a19('0x63')]=function(_0x1b240d,_0x4a782a){return db[_0x7a19('0x53')][_0x7a19('0x47')]({'where':{'id':_0x1b240d['query'][_0x7a19('0x58')]},'attributes':['id'],'include':[{'model':db[_0x7a19('0x48')],'as':_0x7a19('0x59'),'attributes':['id'],'raw':!![]}]})[_0x7a19('0x15')](handleEntityNotFound(_0x4a782a,null))[_0x7a19('0x15')](function(_0x15d0ce){var _0x66c80e=_[_0x7a19('0x1f')](_0x15d0ce,'id');var _0x398c64=[];var _0x423224=[];var _0x2c7172=squel[_0x7a19('0x64')]();_0x2c7172[_0x7a19('0x65')]('tq.TeamId')[_0x7a19('0x66')](_0x7a19('0x67'),'tq')['join']('user_has_teams','ut',_0x7a19('0x68'))['where'](_0x7a19('0x69'),_0x1b240d['params']['id']);for(var _0x533706=0x0;_0x533706<_0x15d0ce[_0x7a19('0x32')];_0x533706+=0x1){let _0x5ca6a3=_0x15d0ce[_0x533706];for(var _0x1f3961=0x0;_0x1f3961<_0x5ca6a3[_0x7a19('0x59')][_0x7a19('0x32')];_0x1f3961+=0x1){let _0x44a200=_0x5ca6a3['Agents'][_0x1f3961];var _0x56c3a3=_0x2c7172[_0x7a19('0x6a')]();_0x56c3a3['where'](_0x7a19('0x6b'),_0x44a200['id']);_0x423224[_0x7a19('0x6c')](db[_0x7a19('0x5d')][_0x7a19('0x2c')](_0x56c3a3['toString'](),{'type':db['sequelize']['QueryTypes'][_0x7a19('0x6d')]})[_0x7a19('0x15')](function(_0x1c058c){if(_0x1c058c[_0x7a19('0x32')]===0x1){return _0x44a200['id'];}else{var _0x1d241a=_[_0x7a19('0x6e')](_[_0x7a19('0x1f')](_0x1c058c,_0x7a19('0x6f')),function(_0xde064e){return _['includes'](_0x66c80e,_0xde064e);});if(_0x1d241a){return _0x44a200['id'];}}}));}}return BPromise['all'](_0x423224)[_0x7a19('0x15')](function(_0x2d70cd){_0x398c64=_(_0x398c64)[_0x7a19('0x70')](_0x2d70cd)[_0x7a19('0x71')]()[_0x7a19('0x72')]();return db[_0x7a19('0x27')][_0x7a19('0x36')]({'where':{'id':_0x1b240d[_0x7a19('0x2a')]['id']}})['then'](function(_0x47e24c){return db[_0x7a19('0x5d')][_0x7a19('0x5e')](function(_0xb36a55){return _0x47e24c['removeTeams'](_0x1b240d['query']['ids'],{'transaction':_0xb36a55})['then'](function(){if(!_[_0x7a19('0x73')](_0x398c64)){return _0x47e24c[_0x7a19('0x74')](_0x398c64,{'transaction':_0xb36a55});}})[_0x7a19('0x15')](function(){_0x398c64[_0x7a19('0x61')](function(_0x28d094){socket['emit'](_0x7a19('0x75'),{'UserId':_0x28d094,'WhatsappQueueId':_0x47e24c['id']});});});});});});})[_0x7a19('0x15')](respondWithStatusCode(_0x4a782a,null))[_0x7a19('0x28')](handleError(_0x4a782a,null));};exports[_0x7a19('0x76')]=function(_0xe85a5b,_0x22be46){return db[_0x7a19('0x27')][_0x7a19('0x36')]({'where':{'id':_0xe85a5b[_0x7a19('0x2a')]['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0x22be46,null))[_0x7a19('0x15')](function(_0x40c811){if(_0x40c811){return _0x40c811[_0x7a19('0x76')](_0xe85a5b['body']['ids'],_['omit'](_0xe85a5b[_0x7a19('0x38')],[_0x7a19('0x58'),'id'])||{})[_0x7a19('0x77')](function(_0x52ea35){for(var _0x17d09b=0x0;_0x17d09b<_0xe85a5b['body'][_0x7a19('0x58')]['length'];_0x17d09b+=0x1){socket[_0x7a19('0x78')](_0x7a19('0x62'),{'UserId':Number(_0xe85a5b[_0x7a19('0x38')][_0x7a19('0x58')][_0x17d09b]),'WhatsappQueueId':Number(_0xe85a5b[_0x7a19('0x2a')]['id'])});}return _0x52ea35;});}})['then'](respondWithResult(_0x22be46,null))['catch'](handleError(_0x22be46,null));};exports[_0x7a19('0x74')]=function(_0x4339ec,_0x15bc09){return db[_0x7a19('0x27')][_0x7a19('0x36')]({'where':{'id':_0x4339ec['params']['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0x15bc09,null))[_0x7a19('0x15')](function(_0x58de18){if(_0x58de18){return _0x58de18[_0x7a19('0x74')](_0x4339ec[_0x7a19('0x2c')][_0x7a19('0x58')])['then'](function(){if(_[_0x7a19('0x79')](_0x4339ec[_0x7a19('0x2c')][_0x7a19('0x58')])){for(var _0x39b09e=0x0;_0x39b09e<_0x4339ec[_0x7a19('0x2c')][_0x7a19('0x58')][_0x7a19('0x32')];_0x39b09e+=0x1){socket[_0x7a19('0x78')]('userWhatsappQueue:remove',{'UserId':Number(_0x4339ec[_0x7a19('0x2c')]['ids'][_0x39b09e]),'WhatsappQueueId':Number(_0x4339ec['params']['id'])});}}else{socket['emit'](_0x7a19('0x75'),{'UserId':Number(_0x4339ec['query'][_0x7a19('0x58')]),'WhatsappQueueId':Number(_0x4339ec[_0x7a19('0x2a')]['id'])});}});}})[_0x7a19('0x15')](respondWithStatusCode(_0x15bc09,null))[_0x7a19('0x28')](handleError(_0x15bc09,null));};exports[_0x7a19('0x7a')]=function(_0x416591,_0x53f860){var _0x4da407={};var _0x4e2b74={};var _0x4d92d2;var _0x35a9d9;return db['WhatsappQueue']['findOne']({'where':{'id':_0x416591[_0x7a19('0x2a')]['id']}})[_0x7a19('0x15')](handleEntityNotFound(_0x53f860,null))[_0x7a19('0x15')](function(_0x2e9dae){if(_0x2e9dae){_0x4d92d2=_0x2e9dae;_0x4e2b74[_0x7a19('0x2b')]=_['keys'](db[_0x7a19('0x48')][_0x7a19('0x20')]);_0x4e2b74[_0x7a19('0x2c')]=_['keys'](_0x416591['query']);_0x4e2b74['filters']=_[_0x7a19('0x2f')](_0x4e2b74[_0x7a19('0x2b')],_0x4e2b74['query']);_0x4da407[_0x7a19('0x30')]=_[_0x7a19('0x2f')](_0x4e2b74[_0x7a19('0x2b')],qs['fields'](_0x416591[_0x7a19('0x2c')][_0x7a19('0x31')]));_0x4da407[_0x7a19('0x30')]=_0x4da407[_0x7a19('0x30')]['length']?_0x4da407['attributes']:_0x4e2b74['model'];_0x4da407['order']=qs[_0x7a19('0x54')](_0x416591[_0x7a19('0x2c')]['sort']);_0x4da407[_0x7a19('0x24')]=qs[_0x7a19('0x2e')](_[_0x7a19('0x43')](_0x416591['query'],_0x4e2b74[_0x7a19('0x2e')]));if(_0x416591[_0x7a19('0x2c')][_0x7a19('0x45')]){_0x4da407[_0x7a19('0x24')]=_[_0x7a19('0x34')](_0x4da407[_0x7a19('0x24')],{'$or':_['map'](_0x4da407[_0x7a19('0x30')],function(_0x2a7f22){var _0x2d5f71={};_0x2d5f71[_0x2a7f22]={'$like':'%'+_0x416591[_0x7a19('0x2c')][_0x7a19('0x45')]+'%'};return _0x2d5f71;})});}_0x4da407=_['merge']({},_0x4da407,_0x416591[_0x7a19('0x35')]);return _0x4d92d2[_0x7a19('0x7a')](_0x4da407);}})['then'](function(_0x581725){if(_0x581725){_0x35a9d9=_0x581725[_0x7a19('0x32')];if(!_0x416591[_0x7a19('0x2c')][_0x7a19('0x41')](_0x7a19('0x55'))){_0x4da407[_0x7a19('0x11')]=qs['limit'](_0x416591['query'][_0x7a19('0x11')]);_0x4da407['offset']=qs[_0x7a19('0xf')](_0x416591[_0x7a19('0x2c')][_0x7a19('0xf')]);}return _0x4d92d2[_0x7a19('0x7a')](_0x4da407);}})[_0x7a19('0x15')](function(_0x2e2ccf){if(_0x2e2ccf){return _0x2e2ccf?{'count':_0x35a9d9,'rows':_0x2e2ccf}:null;}})[_0x7a19('0x15')](respondWithResult(_0x53f860,null))['catch'](handleError(_0x53f860,null));};
\ No newline at end of file
index e759df0..b194141 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d56=['emit','hasOwnProperty','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove'];(function(_0x5283fc,_0x147434){var _0x2bf71a=function(_0x30f94c){while(--_0x30f94c){_0x5283fc['push'](_0x5283fc['shift']());}};_0x2bf71a(++_0x147434);}(_0x6d56,0x1c2));var _0x66d5=function(_0x506d0e,_0x5dbe30){_0x506d0e=_0x506d0e-0x0;var _0x27e1a9=_0x6d56[_0x506d0e];return _0x27e1a9;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x66d5('0x0'))['db'][_0x66d5('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x66d5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x66d5('0x3'),'afterDestroy':_0x66d5('0x4')};function emitEvent(_0x329260){return function(_0xb3bf,_0x56017b,_0x1a1882){WhatsappQueueEvents['emit'](_0x329260+':'+_0xb3bf['id'],_0xb3bf);WhatsappQueueEvents[_0x66d5('0x5')](_0x329260,_0xb3bf);_0x1a1882(null);};}for(var e in events){if(events[_0x66d5('0x6')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents;
\ No newline at end of file
+var _0x8bd2=['exports','../../mysqldb','WhatsappQueue','update','remove','emit','hasOwnProperty'];(function(_0x437b0e,_0x250c23){var _0x386f5e=function(_0x679307){while(--_0x679307){_0x437b0e['push'](_0x437b0e['shift']());}};_0x386f5e(++_0x250c23);}(_0x8bd2,0x135));var _0x28bd=function(_0x51d129,_0x175d7d){_0x51d129=_0x51d129-0x0;var _0x44c377=_0x8bd2[_0x51d129];return _0x44c377;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x28bd('0x0'))['db'][_0x28bd('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x28bd('0x2'),'afterDestroy':_0x28bd('0x3')};function emitEvent(_0x13fd78){return function(_0x5a124b,_0xaf8b78,_0x1554bc){WhatsappQueueEvents[_0x28bd('0x4')](_0x13fd78+':'+_0x5a124b['id'],_0x5a124b);WhatsappQueueEvents[_0x28bd('0x4')](_0x13fd78,_0x5a124b);_0x1554bc(null);};}for(var e in events){if(events[_0x28bd('0x5')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x28bd('0x6')]=WhatsappQueueEvents;
\ No newline at end of file
index b3f9cfd..56f317c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8911=['path','rimraf','../../config/environment','exports','define','WhatsappQueue','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1a9b33,_0x129478){var _0x106a8b=function(_0x165b25){while(--_0x165b25){_0x1a9b33['push'](_0x1a9b33['shift']());}};_0x106a8b(++_0x129478);}(_0x8911,0x19a));var _0x1891=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8911[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x1891('0x0'));var util=require('util');var logger=require(_0x1891('0x1'))(_0x1891('0x2'));var moment=require(_0x1891('0x3'));var BPromise=require(_0x1891('0x4'));var rp=require(_0x1891('0x5'));var fs=require('fs');var path=require(_0x1891('0x6'));var rimraf=require(_0x1891('0x7'));var config=require(_0x1891('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x1891('0x9')]=function(_0x3d9c1d,_0xa8bf0b){return _0x3d9c1d[_0x1891('0xa')](_0x1891('0xb'),attributes,{'tableName':_0x1891('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
+var _0x9003=['./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x48b313,_0x2f5f42){var _0x27e91a=function(_0xd866f0){while(--_0xd866f0){_0x48b313['push'](_0x48b313['shift']());}};_0x27e91a(++_0x2f5f42);}(_0x9003,0xf4));var _0x3900=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x9003[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x3900('0x0'));var util=require('util');var logger=require(_0x3900('0x1'))(_0x3900('0x2'));var moment=require(_0x3900('0x3'));var BPromise=require(_0x3900('0x4'));var rp=require(_0x3900('0x5'));var fs=require('fs');var path=require(_0x3900('0x6'));var rimraf=require(_0x3900('0x7'));var config=require('../../config/environment');var attributes=require(_0x3900('0x8'));module[_0x3900('0x9')]=function(_0x6b0089,_0x535ebd){return _0x6b0089[_0x3900('0xa')]('WhatsappQueue',attributes,{'tableName':_0x3900('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});};
\ No newline at end of file
index 7df8ddb..0882f16 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x127a=['defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','options','where','attributes','limit','include','map','model','catch','GetWhatsappQueue','ShowWhatsappQueue','WhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x388db3,_0x1e71ec){var _0x2b5bd0=function(_0x1ceb37){while(--_0x1ceb37){_0x388db3['push'](_0x388db3['shift']());}};_0x2b5bd0(++_0x1e71ec);}(_0x127a,0x149));var _0xa127=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x127a[_0x2dadb9];return _0x2f0097;};'use strict';var _=require(_0xa127('0x0'));var util=require(_0xa127('0x1'));var moment=require(_0xa127('0x2'));var BPromise=require(_0xa127('0x3'));var rs=require(_0xa127('0x4'));var fs=require('fs');var Redis=require(_0xa127('0x5'));var db=require(_0xa127('0x6'))['db'];var utils=require(_0xa127('0x7'));var logger=require(_0xa127('0x8'))(_0xa127('0x9'));var config=require(_0xa127('0xa'));var jayson=require(_0xa127('0xb'));var client=jayson[_0xa127('0xc')][_0xa127('0xd')]({'port':0x232a});config[_0xa127('0xe')]=_[_0xa127('0xf')](config[_0xa127('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xa127('0x10'))(new Redis(config[_0xa127('0xe')]));require(_0xa127('0x11'))[_0xa127('0x12')](socket);function respondWithRpcPromise(_0x6c1969,_0x2d0fb4,_0x1f46f6){return new BPromise(function(_0x902b8c,_0xcff439){return client[_0xa127('0x13')](_0x6c1969,_0x1f46f6)[_0xa127('0x14')](function(_0x49663e){logger[_0xa127('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x2d0fb4,'request\x20sent');logger[_0xa127('0x16')](_0xa127('0x17'),_0x2d0fb4,_0xa127('0x18'),JSON[_0xa127('0x19')](_0x49663e));if(_0x49663e[_0xa127('0x1a')]){if(_0x49663e['error'][_0xa127('0x1b')]===0x1f4){logger[_0xa127('0x1a')](_0xa127('0x1c'),_0x2d0fb4,_0x49663e[_0xa127('0x1a')][_0xa127('0x1d')]);return _0xcff439(_0x49663e[_0xa127('0x1a')]['message']);}logger[_0xa127('0x1a')](_0xa127('0x1c'),_0x2d0fb4,_0x49663e['error'][_0xa127('0x1d')]);return _0x902b8c(_0x49663e[_0xa127('0x1a')][_0xa127('0x1d')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x2d0fb4,_0xa127('0x18'));_0x902b8c(_0x49663e[_0xa127('0x1e')][_0xa127('0x1d')]);}})['catch'](function(_0xa062e4){logger[_0xa127('0x1a')](_0xa127('0x1c'),_0x2d0fb4,_0xa062e4);_0xcff439(_0xa062e4);});});}exports['GetWhatsappQueue']=function(_0x35ca70){var _0xd31a95=this;return new Promise(function(_0x1ee874,_0x4b4708){return db['WhatsappQueue']['findAll']({'raw':_0x35ca70[_0xa127('0x1f')]?_0x35ca70[_0xa127('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x35ca70[_0xa127('0x1f')]?_0x35ca70[_0xa127('0x1f')][_0xa127('0x20')]||null:null,'attributes':_0x35ca70[_0xa127('0x1f')]?_0x35ca70[_0xa127('0x1f')][_0xa127('0x21')]||null:null,'limit':_0x35ca70[_0xa127('0x1f')]?_0x35ca70['options'][_0xa127('0x22')]||null:null,'include':_0x35ca70[_0xa127('0x1f')]?_0x35ca70[_0xa127('0x1f')][_0xa127('0x23')]?_[_0xa127('0x24')](_0x35ca70[_0xa127('0x1f')][_0xa127('0x23')],function(_0x1ee853){return{'model':db[_0x1ee853['model']],'as':_0x1ee853['as'],'attributes':_0x1ee853[_0xa127('0x21')],'include':_0x1ee853['include']?_['map'](_0x1ee853[_0xa127('0x23')],function(_0x262aca){return{'model':db[_0x262aca[_0xa127('0x25')]],'as':_0x262aca['as'],'attributes':_0x262aca[_0xa127('0x21')],'include':_0x262aca[_0xa127('0x23')]?_[_0xa127('0x24')](_0x262aca[_0xa127('0x23')],function(_0x240cec){return{'model':db[_0x240cec['model']],'as':_0x240cec['as'],'attributes':_0x240cec[_0xa127('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb115f0){logger[_0xa127('0x15')]('GetWhatsappQueue',_0x35ca70);logger['debug']('GetWhatsappQueue',_0x35ca70,JSON[_0xa127('0x19')](_0xb115f0));_0x1ee874(_0xb115f0);})[_0xa127('0x26')](function(_0x169469){logger[_0xa127('0x1a')](_0xa127('0x27'),_0x169469[_0xa127('0x1d')],_0x35ca70);_0x4b4708(_0xd31a95[_0xa127('0x1a')](0x1f4,_0x169469[_0xa127('0x1d')]));});});};exports[_0xa127('0x28')]=function(_0x11aadf){var _0x594361=this;return new Promise(function(_0x2a250d,_0xfa11ab){return db[_0xa127('0x29')][_0xa127('0x2a')]({'raw':_0x11aadf['options']?_0x11aadf[_0xa127('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x11aadf[_0xa127('0x1f')]?_0x11aadf[_0xa127('0x1f')]['where']||null:null,'attributes':_0x11aadf[_0xa127('0x1f')]?_0x11aadf[_0xa127('0x1f')]['attributes']||null:null,'include':_0x11aadf[_0xa127('0x1f')]?_0x11aadf[_0xa127('0x1f')][_0xa127('0x23')]?_[_0xa127('0x24')](_0x11aadf[_0xa127('0x1f')]['include'],function(_0x13f8d1){return{'model':db[_0x13f8d1[_0xa127('0x25')]],'as':_0x13f8d1['as'],'attributes':_0x13f8d1['attributes'],'include':_0x13f8d1['include']?_[_0xa127('0x24')](_0x13f8d1[_0xa127('0x23')],function(_0x1a3059){return{'model':db[_0x1a3059[_0xa127('0x25')]],'as':_0x1a3059['as'],'attributes':_0x1a3059['attributes'],'include':_0x1a3059[_0xa127('0x23')]?_[_0xa127('0x24')](_0x1a3059['include'],function(_0x4a0ae7){return{'model':db[_0x4a0ae7[_0xa127('0x25')]],'as':_0x4a0ae7['as'],'attributes':_0x4a0ae7[_0xa127('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x297a66){logger[_0xa127('0x15')](_0xa127('0x28'),_0x11aadf);logger[_0xa127('0x16')](_0xa127('0x28'),_0x11aadf,JSON[_0xa127('0x19')](_0x297a66));_0x2a250d(_0x297a66);})[_0xa127('0x26')](function(_0x492a04){logger[_0xa127('0x1a')](_0xa127('0x28'),_0x492a04[_0xa127('0x1d')],_0x11aadf);_0xfa11ab(_0x594361[_0xa127('0x1a')](0x1f4,_0x492a04[_0xa127('0x1d')]));});});};
\ No newline at end of file
+var _0x7a44=['map','then','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','WhatsappQueue','findAll','options','raw','where','attributes','limit','model','include'];(function(_0x7c734d,_0x3be458){var _0x4d176b=function(_0x5afffb){while(--_0x5afffb){_0x7c734d['push'](_0x7c734d['shift']());}};_0x4d176b(++_0x3be458);}(_0x7a44,0x195));var _0x47a4=function(_0x5ca3ec,_0x333666){_0x5ca3ec=_0x5ca3ec-0x0;var _0x5dfe63=_0x7a44[_0x5ca3ec];return _0x5dfe63;};'use strict';var _=require(_0x47a4('0x0'));var util=require(_0x47a4('0x1'));var moment=require('moment');var BPromise=require(_0x47a4('0x2'));var rs=require(_0x47a4('0x3'));var fs=require('fs');var Redis=require(_0x47a4('0x4'));var db=require(_0x47a4('0x5'))['db'];var utils=require(_0x47a4('0x6'));var logger=require(_0x47a4('0x7'))(_0x47a4('0x8'));var config=require('../../config/environment');var jayson=require(_0x47a4('0x9'));var client=jayson[_0x47a4('0xa')][_0x47a4('0xb')]({'port':0x232a});config[_0x47a4('0xc')]=_[_0x47a4('0xd')](config[_0x47a4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a4('0xe'))(new Redis(config[_0x47a4('0xc')]));require('./whatsappQueue.socket')[_0x47a4('0xf')](socket);function respondWithRpcPromise(_0x3898c7,_0x4150c1,_0x5da80f){return new BPromise(function(_0x9314f5,_0x5d9458){return client['request'](_0x3898c7,_0x5da80f)['then'](function(_0x4fa61d){logger[_0x47a4('0x10')](_0x47a4('0x11'),_0x4150c1,_0x47a4('0x12'));logger[_0x47a4('0x13')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4150c1,_0x47a4('0x12'),JSON[_0x47a4('0x14')](_0x4fa61d));if(_0x4fa61d['error']){if(_0x4fa61d[_0x47a4('0x15')][_0x47a4('0x16')]===0x1f4){logger[_0x47a4('0x15')](_0x47a4('0x11'),_0x4150c1,_0x4fa61d[_0x47a4('0x15')][_0x47a4('0x17')]);return _0x5d9458(_0x4fa61d[_0x47a4('0x15')][_0x47a4('0x17')]);}logger[_0x47a4('0x15')](_0x47a4('0x11'),_0x4150c1,_0x4fa61d[_0x47a4('0x15')]['message']);return _0x9314f5(_0x4fa61d[_0x47a4('0x15')]['message']);}else{logger[_0x47a4('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x4150c1,_0x47a4('0x12'));_0x9314f5(_0x4fa61d[_0x47a4('0x18')][_0x47a4('0x17')]);}})[_0x47a4('0x19')](function(_0x4bb8d){logger[_0x47a4('0x15')](_0x47a4('0x11'),_0x4150c1,_0x4bb8d);_0x5d9458(_0x4bb8d);});});}exports['GetWhatsappQueue']=function(_0x4d6551){var _0x34b214=this;return new Promise(function(_0x22132d,_0x11bf84){return db[_0x47a4('0x1a')][_0x47a4('0x1b')]({'raw':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551[_0x47a4('0x1c')][_0x47a4('0x1d')]===undefined?!![]:![]:!![],'where':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551[_0x47a4('0x1c')][_0x47a4('0x1e')]||null:null,'attributes':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551[_0x47a4('0x1c')][_0x47a4('0x1f')]||null:null,'limit':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551[_0x47a4('0x1c')][_0x47a4('0x20')]||null:null,'include':_0x4d6551[_0x47a4('0x1c')]?_0x4d6551['options']['include']?_['map'](_0x4d6551[_0x47a4('0x1c')]['include'],function(_0x10f33e){return{'model':db[_0x10f33e[_0x47a4('0x21')]],'as':_0x10f33e['as'],'attributes':_0x10f33e[_0x47a4('0x1f')],'include':_0x10f33e['include']?_['map'](_0x10f33e[_0x47a4('0x22')],function(_0x201f1b){return{'model':db[_0x201f1b[_0x47a4('0x21')]],'as':_0x201f1b['as'],'attributes':_0x201f1b[_0x47a4('0x1f')],'include':_0x201f1b[_0x47a4('0x22')]?_[_0x47a4('0x23')](_0x201f1b[_0x47a4('0x22')],function(_0x2a69fb){return{'model':db[_0x2a69fb['model']],'as':_0x2a69fb['as'],'attributes':_0x2a69fb['attributes']};}):[]};}):[]};}):[]:[]})[_0x47a4('0x24')](function(_0x5107fc){logger[_0x47a4('0x10')](_0x47a4('0x25'),_0x4d6551);logger[_0x47a4('0x13')]('GetWhatsappQueue',_0x4d6551,JSON[_0x47a4('0x14')](_0x5107fc));_0x22132d(_0x5107fc);})['catch'](function(_0x3a8f86){logger[_0x47a4('0x15')](_0x47a4('0x25'),_0x3a8f86['message'],_0x4d6551);_0x11bf84(_0x34b214[_0x47a4('0x15')](0x1f4,_0x3a8f86['message']));});});};exports[_0x47a4('0x26')]=function(_0x3c074d){var _0x52467a=this;return new Promise(function(_0x3a066f,_0x172c55){return db['WhatsappQueue'][_0x47a4('0x27')]({'raw':_0x3c074d['options']?_0x3c074d[_0x47a4('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x3c074d['options']?_0x3c074d[_0x47a4('0x1c')][_0x47a4('0x1e')]||null:null,'attributes':_0x3c074d['options']?_0x3c074d[_0x47a4('0x1c')]['attributes']||null:null,'include':_0x3c074d['options']?_0x3c074d[_0x47a4('0x1c')]['include']?_[_0x47a4('0x23')](_0x3c074d[_0x47a4('0x1c')][_0x47a4('0x22')],function(_0x4c7083){return{'model':db[_0x4c7083[_0x47a4('0x21')]],'as':_0x4c7083['as'],'attributes':_0x4c7083[_0x47a4('0x1f')],'include':_0x4c7083['include']?_[_0x47a4('0x23')](_0x4c7083[_0x47a4('0x22')],function(_0x37263){return{'model':db[_0x37263[_0x47a4('0x21')]],'as':_0x37263['as'],'attributes':_0x37263[_0x47a4('0x1f')],'include':_0x37263[_0x47a4('0x22')]?_[_0x47a4('0x23')](_0x37263[_0x47a4('0x22')],function(_0xbd5b57){return{'model':db[_0xbd5b57['model']],'as':_0xbd5b57['as'],'attributes':_0xbd5b57[_0x47a4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x98380d){logger[_0x47a4('0x10')](_0x47a4('0x26'),_0x3c074d);logger[_0x47a4('0x13')](_0x47a4('0x26'),_0x3c074d,JSON[_0x47a4('0x14')](_0x98380d));_0x3a066f(_0x98380d);})[_0x47a4('0x19')](function(_0x4235f4){logger[_0x47a4('0x15')](_0x47a4('0x26'),_0x4235f4[_0x47a4('0x17')],_0x3c074d);_0x172c55(_0x52467a['error'](0x1f4,_0x4235f4[_0x47a4('0x17')]));});});};
\ No newline at end of file
index a038b67..c844b4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6578=['update','emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove'];(function(_0x30039a,_0x279cc1){var _0x15039f=function(_0x28363c){while(--_0x28363c){_0x30039a['push'](_0x30039a['shift']());}};_0x15039f(++_0x279cc1);}(_0x6578,0x7b));var _0x8657=function(_0x396a44,_0x3557ba){_0x396a44=_0x396a44-0x0;var _0x3fc32b=_0x6578[_0x396a44];return _0x3fc32b;};'use strict';var WhatsappQueueEvents=require(_0x8657('0x0'));var events=[_0x8657('0x1'),_0x8657('0x2'),_0x8657('0x3')];function createListener(_0x2c75eb,_0x3f9871){return function(_0x47978d){_0x3f9871[_0x8657('0x4')](_0x2c75eb,_0x47978d);};}function removeListener(_0x2b566a,_0x134ddf){return function(){WhatsappQueueEvents[_0x8657('0x5')](_0x2b566a,_0x134ddf);};}exports[_0x8657('0x6')]=function(_0xaf1d35){for(var _0x50e8d4=0x0,_0x426c6d=events[_0x8657('0x7')];_0x50e8d4<_0x426c6d;_0x50e8d4++){var _0x35c8cf=events[_0x50e8d4];var _0x34857d=createListener(_0x8657('0x8')+_0x35c8cf,_0xaf1d35);WhatsappQueueEvents['on'](_0x35c8cf,_0x34857d);}};
\ No newline at end of file
+var _0x1d15=['length','whatsappQueue:','save','update','emit','removeListener'];(function(_0xfa9738,_0x5386e4){var _0x54cd58=function(_0x593c7a){while(--_0x593c7a){_0xfa9738['push'](_0xfa9738['shift']());}};_0x54cd58(++_0x5386e4);}(_0x1d15,0x122));var _0x51d1=function(_0x1a7a83,_0xaa70b1){_0x1a7a83=_0x1a7a83-0x0;var _0x10d11c=_0x1d15[_0x1a7a83];return _0x10d11c;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0x51d1('0x0'),'remove',_0x51d1('0x1')];function createListener(_0x4c982f,_0x4d6b83){return function(_0x129387){_0x4d6b83[_0x51d1('0x2')](_0x4c982f,_0x129387);};}function removeListener(_0x134212,_0x1f318e){return function(){WhatsappQueueEvents[_0x51d1('0x3')](_0x134212,_0x1f318e);};}exports['register']=function(_0x4b2281){for(var _0x55bb00=0x0,_0x38e781=events[_0x51d1('0x4')];_0x55bb00<_0x38e781;_0x55bb00++){var _0x3d759a=events[_0x55bb00];var _0x3f97e7=createListener(_0x51d1('0x5')+_0x3d759a,_0x4b2281);WhatsappQueueEvents['on'](_0x3d759a,_0x3f97e7);}};
\ No newline at end of file
index a5d3b37..319bc11 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa40=['update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x3ec0e8,_0x485a9d){var _0x26fd54=function(_0x4df6a5){while(--_0x4df6a5){_0x3ec0e8['push'](_0x3ec0e8['shift']());}};_0x26fd54(++_0x485a9d);}(_0xaa40,0x18f));var _0x0aa4=function(_0x3f76b4,_0x4d04e7){_0x3f76b4=_0x3f76b4-0x0;var _0x3cb077=_0xaa40[_0x3f76b4];return _0x3cb077;};'use strict';var multer=require('multer');var util=require(_0x0aa4('0x0'));var path=require(_0x0aa4('0x1'));var timeout=require(_0x0aa4('0x2'));var express=require(_0x0aa4('0x3'));var router=express[_0x0aa4('0x4')]();var fs_extra=require(_0x0aa4('0x5'));var auth=require(_0x0aa4('0x6'));var interaction=require(_0x0aa4('0x7'));var config=require(_0x0aa4('0x8'));var controller=require(_0x0aa4('0x9'));router[_0x0aa4('0xa')]('/',auth[_0x0aa4('0xb')](),controller[_0x0aa4('0xc')]);router['get'](_0x0aa4('0xd'),auth[_0x0aa4('0xb')](),controller[_0x0aa4('0xe')]);router[_0x0aa4('0xa')](_0x0aa4('0xf'),auth['isAuthenticated'](),controller[_0x0aa4('0x10')]);router[_0x0aa4('0x11')]('/',auth['isAuthenticated'](),controller[_0x0aa4('0x12')]);router['put'](_0x0aa4('0xf'),auth['isAuthenticated'](),controller[_0x0aa4('0x13')]);router[_0x0aa4('0x14')](_0x0aa4('0xf'),auth[_0x0aa4('0xb')](),controller['destroy']);module[_0x0aa4('0x15')]=router;
\ No newline at end of file
+var _0x8bba=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','post','put','destroy','exports'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x8bba,0xdd));var _0xa8bb=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0x8bba[_0x5c9307];return _0x373e29;};'use strict';var multer=require('multer');var util=require(_0xa8bb('0x0'));var path=require(_0xa8bb('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8bb('0x2'));var router=express['Router']();var fs_extra=require(_0xa8bb('0x3'));var auth=require(_0xa8bb('0x4'));var interaction=require(_0xa8bb('0x5'));var config=require(_0xa8bb('0x6'));var controller=require('./whatsappQueueReport.controller');router[_0xa8bb('0x7')]('/',auth[_0xa8bb('0x8')](),controller[_0xa8bb('0x9')]);router[_0xa8bb('0x7')](_0xa8bb('0xa'),auth[_0xa8bb('0x8')](),controller['describe']);router[_0xa8bb('0x7')](_0xa8bb('0xb'),auth[_0xa8bb('0x8')](),controller[_0xa8bb('0xc')]);router[_0xa8bb('0xd')]('/',auth[_0xa8bb('0x8')](),controller['create']);router[_0xa8bb('0xe')](_0xa8bb('0xb'),auth[_0xa8bb('0x8')](),controller['update']);router['delete'](_0xa8bb('0xb'),auth[_0xa8bb('0x8')](),controller[_0xa8bb('0xf')]);module[_0xa8bb('0x10')]=router;
\ No newline at end of file
index 0c75b5f..2189101 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5f5d70,_0x4c40ca){var _0x5a7c90=function(_0x5ce0e5){while(--_0x5ce0e5){_0x5f5d70['push'](_0x5f5d70['shift']());}};_0x5a7c90(++_0x4c40ca);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}};
\ No newline at end of file
+var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x2dfd06,_0x1a856b){var _0x2750d4=function(_0x205467){while(--_0x205467){_0x2dfd06['push'](_0x2dfd06['shift']());}};_0x2750d4(++_0x1a856b);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}};
\ No newline at end of file
index cb89a66..19e873f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7334=['create','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','WhatsappQueueReport','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','length','include','find'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7334,0x184));var _0x4733=function(_0x2738cc,_0x158adf){_0x2738cc=_0x2738cc-0x0;var _0x120440=_0x7334[_0x2738cc];return _0x120440;};'use strict';var emlformat=require(_0x4733('0x0'));var rimraf=require(_0x4733('0x1'));var zipdir=require(_0x4733('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4733('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4733('0x4'));var util=require(_0x4733('0x5'));var path=require(_0x4733('0x6'));var sox=require(_0x4733('0x7'));var csv=require(_0x4733('0x8'));var ejs=require(_0x4733('0x9'));var fs=require('fs');var fs_extra=require(_0x4733('0xa'));var _=require(_0x4733('0xb'));var squel=require(_0x4733('0xc'));var crypto=require(_0x4733('0xd'));var jsforce=require(_0x4733('0xe'));var deskjs=require(_0x4733('0xf'));var toCsv=require(_0x4733('0x8'));var querystring=require(_0x4733('0x10'));var Papa=require(_0x4733('0x11'));var Redis=require(_0x4733('0x12'));var authService=require(_0x4733('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x4733('0x14'));var hardwareService=require(_0x4733('0x15'));var logger=require('../../config/logger')(_0x4733('0x16'));var utils=require('../../config/utils');var config=require(_0x4733('0x17'));var licenseUtil=require(_0x4733('0x18'));var db=require(_0x4733('0x19'))['db'];function respondWithStatusCode(_0x461f74,_0x100ecd){_0x100ecd=_0x100ecd||0xcc;return function(_0x1c146c){if(_0x1c146c){return _0x461f74[_0x4733('0x1a')](_0x100ecd);}return _0x461f74['status'](_0x100ecd)[_0x4733('0x1b')]();};}function respondWithResult(_0x543caf,_0x4327f3){_0x4327f3=_0x4327f3||0xc8;return function(_0x1a22e4){if(_0x1a22e4){return _0x543caf[_0x4733('0x1c')](_0x4327f3)[_0x4733('0x1d')](_0x1a22e4);}};}function respondWithFilteredResult(_0x3813df,_0x167016){return function(_0x12f111){if(_0x12f111){var _0x9fff=typeof _0x167016[_0x4733('0x1e')]==='undefined'&&typeof _0x167016[_0x4733('0x1f')]===_0x4733('0x20');var _0x47b129=_0x12f111[_0x4733('0x21')];var _0x1d2fb6=_0x9fff?0x0:_0x167016[_0x4733('0x1e')];var _0x384e0c=_0x9fff?_0x12f111['count']:_0x167016['offset']+_0x167016[_0x4733('0x1f')];var _0x3b730a;if(_0x384e0c>=_0x47b129){_0x384e0c=_0x47b129;_0x3b730a=0xc8;}else{_0x3b730a=0xce;}_0x3813df['status'](_0x3b730a);return _0x3813df[_0x4733('0x22')](_0x4733('0x23'),_0x1d2fb6+'-'+_0x384e0c+'/'+_0x47b129)[_0x4733('0x1d')](_0x12f111);}return null;};}function patchUpdates(_0x7a4e0){return function(_0x493cd3){try{jsonpatch[_0x4733('0x24')](_0x493cd3,_0x7a4e0,!![]);}catch(_0xb45e1){return BPromise['reject'](_0xb45e1);}return _0x493cd3[_0x4733('0x25')]();};}function saveUpdates(_0x18da47,_0x478e34){return function(_0x15a291){if(_0x15a291){return _0x15a291[_0x4733('0x26')](_0x18da47)[_0x4733('0x27')](function(_0x1a0643){return _0x1a0643;});}return null;};}function removeEntity(_0x3a2542,_0x24db74){return function(_0x180049){if(_0x180049){return _0x180049[_0x4733('0x28')]()['then'](function(){_0x3a2542[_0x4733('0x1c')](0xcc)[_0x4733('0x1b')]();});}};}function handleEntityNotFound(_0x7884e5,_0x2cb247){return function(_0x30ee9b){if(!_0x30ee9b){_0x7884e5[_0x4733('0x1a')](0x194);}return _0x30ee9b;};}function handleError(_0x24fc0d,_0xc3ab0a){_0xc3ab0a=_0xc3ab0a||0x1f4;return function(_0x13bc12){logger[_0x4733('0x29')](_0x13bc12['stack']);if(_0x13bc12[_0x4733('0x2a')]){delete _0x13bc12['name'];}_0x24fc0d['status'](_0xc3ab0a)[_0x4733('0x2b')](_0x13bc12);};}exports['index']=function(_0xcde4f4,_0x479989){var _0x4abc0d={},_0x517c73={},_0x2976b0={'count':0x0,'rows':[]};var _0x3bfe53=_[_0x4733('0x2c')](db[_0x4733('0x2d')]['rawAttributes'],function(_0x538a7c){return{'name':_0x538a7c['fieldName'],'type':_0x538a7c[_0x4733('0x2e')]['key']};});_0x517c73['model']=_[_0x4733('0x2c')](_0x3bfe53,_0x4733('0x2a'));_0x517c73[_0x4733('0x2f')]=_['keys'](_0xcde4f4['query']);_0x517c73[_0x4733('0x30')]=_[_0x4733('0x31')](_0x517c73[_0x4733('0x32')],_0x517c73[_0x4733('0x2f')]);_0x4abc0d[_0x4733('0x33')]=_['intersection'](_0x517c73[_0x4733('0x32')],qs[_0x4733('0x34')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x34')]));_0x4abc0d[_0x4733('0x33')]=_0x4abc0d['attributes']['length']?_0x4abc0d[_0x4733('0x33')]:_0x517c73[_0x4733('0x32')];if(!_0xcde4f4[_0x4733('0x2f')][_0x4733('0x35')](_0x4733('0x36'))){_0x4abc0d['limit']=qs[_0x4733('0x1f')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x1f')]);_0x4abc0d['offset']=qs[_0x4733('0x1e')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x1e')]);}_0x4abc0d[_0x4733('0x37')]=qs[_0x4733('0x38')](_0xcde4f4[_0x4733('0x2f')][_0x4733('0x38')]);_0x4abc0d[_0x4733('0x39')]=qs['filters'](_[_0x4733('0x3a')](_0xcde4f4['query'],_0x517c73[_0x4733('0x30')]),_0x3bfe53);if(_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3b')]){_0x4abc0d[_0x4733('0x39')]=_[_0x4733('0x3c')](_0x4abc0d[_0x4733('0x39')],{'$or':_[_0x4733('0x2c')](_0x3bfe53,function(_0x15ab49){if(_0x15ab49['type']!==_0x4733('0x3d')){var _0x68d682={};_0x68d682[_0x15ab49['name']]={'$like':'%'+_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3b')]+'%'};return _0x68d682;}})});}_0x4abc0d=_['merge']({},_0x4abc0d,_0xcde4f4[_0x4733('0x3e')]);var _0x50849a={'where':_0x4abc0d[_0x4733('0x39')]};return db['WhatsappQueueReport'][_0x4733('0x21')](_0x50849a)[_0x4733('0x27')](function(_0x5d4b95){_0x2976b0['count']=_0x5d4b95;if(_0xcde4f4[_0x4733('0x2f')][_0x4733('0x3f')]){_0x4abc0d['include']=[{'all':!![]}];}return db[_0x4733('0x2d')][_0x4733('0x40')](_0x4abc0d);})[_0x4733('0x27')](function(_0x28ed14){_0x2976b0[_0x4733('0x41')]=_0x28ed14;return _0x2976b0;})[_0x4733('0x27')](respondWithFilteredResult(_0x479989,_0x4abc0d))[_0x4733('0x42')](handleError(_0x479989,null));};exports[_0x4733('0x43')]=function(_0x1f04dd,_0x42e055){var _0x444471={'raw':!![],'where':{'id':_0x1f04dd[_0x4733('0x44')]['id']}},_0x1d32df={};_0x1d32df[_0x4733('0x32')]=_[_0x4733('0x45')](db[_0x4733('0x2d')][_0x4733('0x46')]);_0x1d32df[_0x4733('0x2f')]=_['keys'](_0x1f04dd[_0x4733('0x2f')]);_0x1d32df[_0x4733('0x30')]=_[_0x4733('0x31')](_0x1d32df[_0x4733('0x32')],_0x1d32df[_0x4733('0x2f')]);_0x444471[_0x4733('0x33')]=_[_0x4733('0x31')](_0x1d32df[_0x4733('0x32')],qs[_0x4733('0x34')](_0x1f04dd[_0x4733('0x2f')][_0x4733('0x34')]));_0x444471[_0x4733('0x33')]=_0x444471[_0x4733('0x33')][_0x4733('0x47')]?_0x444471['attributes']:_0x1d32df['model'];if(_0x1f04dd[_0x4733('0x2f')][_0x4733('0x3f')]){_0x444471[_0x4733('0x48')]=[{'all':!![]}];}_0x444471=_[_0x4733('0x3c')]({},_0x444471,_0x1f04dd[_0x4733('0x3e')]);return db[_0x4733('0x2d')][_0x4733('0x49')](_0x444471)[_0x4733('0x27')](handleEntityNotFound(_0x42e055,null))[_0x4733('0x27')](respondWithResult(_0x42e055,null))[_0x4733('0x42')](handleError(_0x42e055,null));};exports['create']=function(_0x4c5f4e,_0x51e201){return db['WhatsappQueueReport'][_0x4733('0x4a')](_0x4c5f4e[_0x4733('0x4b')],{})[_0x4733('0x27')](respondWithResult(_0x51e201,0xc9))[_0x4733('0x42')](handleError(_0x51e201,null));};exports[_0x4733('0x26')]=function(_0x45b9cf,_0x1c6abf){if(_0x45b9cf[_0x4733('0x4b')]['id']){delete _0x45b9cf[_0x4733('0x4b')]['id'];}return db[_0x4733('0x2d')]['find']({'where':{'id':_0x45b9cf['params']['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x1c6abf,null))['then'](saveUpdates(_0x45b9cf[_0x4733('0x4b')],null))[_0x4733('0x27')](respondWithResult(_0x1c6abf,null))[_0x4733('0x42')](handleError(_0x1c6abf,null));};exports['destroy']=function(_0x3f2a78,_0x45c9ad){return db[_0x4733('0x2d')][_0x4733('0x49')]({'where':{'id':_0x3f2a78[_0x4733('0x44')]['id']}})[_0x4733('0x27')](handleEntityNotFound(_0x45c9ad,null))[_0x4733('0x27')](removeEntity(_0x45c9ad,null))[_0x4733('0x42')](handleError(_0x45c9ad,null));};exports[_0x4733('0x4c')]=function(_0x5af8c7,_0x31fb69){return db[_0x4733('0x2d')][_0x4733('0x4c')]()['then'](respondWithResult(_0x31fb69,null))[_0x4733('0x42')](handleError(_0x31fb69,null));};
\ No newline at end of file
+var _0x373d=['order','sort','pick','filter','where','VIRTUAL','merge','include','findAll','rows','show','rawAttributes','includeAll','options','catch','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','WhatsappQueueReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x51bd27,_0x44a315){var _0x5740a0=function(_0x3ce69d){while(--_0x3ce69d){_0x51bd27['push'](_0x51bd27['shift']());}};_0x5740a0(++_0x44a315);}(_0x373d,0x1e2));var _0xd373=function(_0x4bfb87,_0x2ed356){_0x4bfb87=_0x4bfb87-0x0;var _0x2b4e25=_0x373d[_0x4bfb87];return _0x2b4e25;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c7f91,_0x5ab89c){_0x5ab89c=_0x5ab89c||0xcc;return function(_0xcd9b8c){if(_0xcd9b8c){return _0x4c7f91[_0xd373('0x15')](_0x5ab89c);}return _0x4c7f91['status'](_0x5ab89c)[_0xd373('0x16')]();};}function respondWithResult(_0x129475,_0x27c161){_0x27c161=_0x27c161||0xc8;return function(_0x23ed86){if(_0x23ed86){return _0x129475[_0xd373('0x17')](_0x27c161)[_0xd373('0x18')](_0x23ed86);}};}function respondWithFilteredResult(_0x20aca5,_0x2eacb1){return function(_0x5a286a){if(_0x5a286a){var _0x2c5854=typeof _0x2eacb1[_0xd373('0x19')]===_0xd373('0x1a')&&typeof _0x2eacb1[_0xd373('0x1b')]==='undefined';var _0x1e26cf=_0x5a286a['count'];var _0x460259=_0x2c5854?0x0:_0x2eacb1[_0xd373('0x19')];var _0x55c5c7=_0x2c5854?_0x5a286a[_0xd373('0x1c')]:_0x2eacb1['offset']+_0x2eacb1['limit'];var _0x23fada;if(_0x55c5c7>=_0x1e26cf){_0x55c5c7=_0x1e26cf;_0x23fada=0xc8;}else{_0x23fada=0xce;}_0x20aca5[_0xd373('0x17')](_0x23fada);return _0x20aca5[_0xd373('0x1d')](_0xd373('0x1e'),_0x460259+'-'+_0x55c5c7+'/'+_0x1e26cf)[_0xd373('0x18')](_0x5a286a);}return null;};}function patchUpdates(_0x181eb2){return function(_0x4ba510){try{jsonpatch[_0xd373('0x1f')](_0x4ba510,_0x181eb2,!![]);}catch(_0xd808f8){return BPromise[_0xd373('0x20')](_0xd808f8);}return _0x4ba510[_0xd373('0x21')]();};}function saveUpdates(_0x165e21,_0x3aa1c5){return function(_0x4f64bd){if(_0x4f64bd){return _0x4f64bd[_0xd373('0x22')](_0x165e21)[_0xd373('0x23')](function(_0x157f81){return _0x157f81;});}return null;};}function removeEntity(_0x209ca7,_0x217ee7){return function(_0x238ffd){if(_0x238ffd){return _0x238ffd[_0xd373('0x24')]()[_0xd373('0x23')](function(){_0x209ca7[_0xd373('0x17')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x437110,_0x34f05a){return function(_0x388182){if(!_0x388182){_0x437110[_0xd373('0x15')](0x194);}return _0x388182;};}function handleError(_0x18d7ab,_0x38ba50){_0x38ba50=_0x38ba50||0x1f4;return function(_0x50b987){logger[_0xd373('0x25')](_0x50b987[_0xd373('0x26')]);if(_0x50b987[_0xd373('0x27')]){delete _0x50b987[_0xd373('0x27')];}_0x18d7ab[_0xd373('0x17')](_0x38ba50)[_0xd373('0x28')](_0x50b987);};}exports[_0xd373('0x29')]=function(_0xf85ca8,_0x2869e5){var _0x158825={},_0xbc420b={},_0x2ee37c={'count':0x0,'rows':[]};var _0x7dad3e=_['map'](db[_0xd373('0x2a')]['rawAttributes'],function(_0x498aaa){return{'name':_0x498aaa[_0xd373('0x2b')],'type':_0x498aaa[_0xd373('0x2c')][_0xd373('0x2d')]};});_0xbc420b[_0xd373('0x2e')]=_[_0xd373('0x2f')](_0x7dad3e,'name');_0xbc420b[_0xd373('0x30')]=_[_0xd373('0x31')](_0xf85ca8['query']);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],_0xbc420b[_0xd373('0x30')]);_0x158825[_0xd373('0x34')]=_[_0xd373('0x33')](_0xbc420b[_0xd373('0x2e')],qs[_0xd373('0x35')](_0xf85ca8[_0xd373('0x30')]['fields']));_0x158825[_0xd373('0x34')]=_0x158825[_0xd373('0x34')][_0xd373('0x36')]?_0x158825[_0xd373('0x34')]:_0xbc420b[_0xd373('0x2e')];if(!_0xf85ca8[_0xd373('0x30')][_0xd373('0x37')](_0xd373('0x38'))){_0x158825[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x1b')]);_0x158825[_0xd373('0x19')]=qs[_0xd373('0x19')](_0xf85ca8[_0xd373('0x30')]['offset']);}_0x158825[_0xd373('0x39')]=qs[_0xd373('0x3a')](_0xf85ca8[_0xd373('0x30')][_0xd373('0x3a')]);_0x158825['where']=qs[_0xd373('0x32')](_[_0xd373('0x3b')](_0xf85ca8[_0xd373('0x30')],_0xbc420b[_0xd373('0x32')]),_0x7dad3e);if(_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]){_0x158825['where']=_['merge'](_0x158825[_0xd373('0x3d')],{'$or':_['map'](_0x7dad3e,function(_0x37c97e){if(_0x37c97e[_0xd373('0x2c')]!==_0xd373('0x3e')){var _0x51ba69={};_0x51ba69[_0x37c97e[_0xd373('0x27')]]={'$like':'%'+_0xf85ca8[_0xd373('0x30')][_0xd373('0x3c')]+'%'};return _0x51ba69;}})});}_0x158825=_[_0xd373('0x3f')]({},_0x158825,_0xf85ca8['options']);var _0x513038={'where':_0x158825['where']};return db[_0xd373('0x2a')]['count'](_0x513038)[_0xd373('0x23')](function(_0x2fa6c4){_0x2ee37c['count']=_0x2fa6c4;if(_0xf85ca8['query']['includeAll']){_0x158825[_0xd373('0x40')]=[{'all':!![]}];}return db[_0xd373('0x2a')][_0xd373('0x41')](_0x158825);})['then'](function(_0x5c3b22){_0x2ee37c[_0xd373('0x42')]=_0x5c3b22;return _0x2ee37c;})[_0xd373('0x23')](respondWithFilteredResult(_0x2869e5,_0x158825))['catch'](handleError(_0x2869e5,null));};exports[_0xd373('0x43')]=function(_0x2ee75f,_0x1e3de1){var _0x9989e4={'raw':!![],'where':{'id':_0x2ee75f['params']['id']}},_0x2d8c7d={};_0x2d8c7d['model']=_[_0xd373('0x31')](db[_0xd373('0x2a')][_0xd373('0x44')]);_0x2d8c7d[_0xd373('0x30')]=_['keys'](_0x2ee75f[_0xd373('0x30')]);_0x2d8c7d['filters']=_[_0xd373('0x33')](_0x2d8c7d[_0xd373('0x2e')],_0x2d8c7d[_0xd373('0x30')]);_0x9989e4[_0xd373('0x34')]=_[_0xd373('0x33')](_0x2d8c7d['model'],qs[_0xd373('0x35')](_0x2ee75f[_0xd373('0x30')]['fields']));_0x9989e4[_0xd373('0x34')]=_0x9989e4[_0xd373('0x34')][_0xd373('0x36')]?_0x9989e4[_0xd373('0x34')]:_0x2d8c7d[_0xd373('0x2e')];if(_0x2ee75f[_0xd373('0x30')][_0xd373('0x45')]){_0x9989e4[_0xd373('0x40')]=[{'all':!![]}];}_0x9989e4=_[_0xd373('0x3f')]({},_0x9989e4,_0x2ee75f[_0xd373('0x46')]);return db['WhatsappQueueReport']['find'](_0x9989e4)[_0xd373('0x23')](handleEntityNotFound(_0x1e3de1,null))['then'](respondWithResult(_0x1e3de1,null))[_0xd373('0x47')](handleError(_0x1e3de1,null));};exports['create']=function(_0x5e5279,_0x5cbc16){return db[_0xd373('0x2a')][_0xd373('0x48')](_0x5e5279[_0xd373('0x49')],{})[_0xd373('0x23')](respondWithResult(_0x5cbc16,0xc9))[_0xd373('0x47')](handleError(_0x5cbc16,null));};exports[_0xd373('0x22')]=function(_0x1855aa,_0x4d1088){if(_0x1855aa[_0xd373('0x49')]['id']){delete _0x1855aa['body']['id'];}return db[_0xd373('0x2a')][_0xd373('0x4a')]({'where':{'id':_0x1855aa['params']['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4d1088,null))['then'](saveUpdates(_0x1855aa[_0xd373('0x49')],null))[_0xd373('0x23')](respondWithResult(_0x4d1088,null))[_0xd373('0x47')](handleError(_0x4d1088,null));};exports[_0xd373('0x24')]=function(_0xe22cbd,_0x4bc631){return db['WhatsappQueueReport']['find']({'where':{'id':_0xe22cbd[_0xd373('0x4b')]['id']}})[_0xd373('0x23')](handleEntityNotFound(_0x4bc631,null))['then'](removeEntity(_0x4bc631,null))[_0xd373('0x47')](handleError(_0x4bc631,null));};exports[_0xd373('0x4c')]=function(_0x4d7020,_0xae7067){return db[_0xd373('0x2a')][_0xd373('0x4c')]()[_0xd373('0x23')](respondWithResult(_0xae7067,null))[_0xd373('0x47')](handleError(_0xae7067,null));};
\ No newline at end of file
index 816d476..3ee88f4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e79=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e79,0xfa));var _0x94e7=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4e79[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x94e7('0x0'));var util=require(_0x94e7('0x1'));var logger=require('../../config/logger')(_0x94e7('0x2'));var moment=require(_0x94e7('0x3'));var BPromise=require(_0x94e7('0x4'));var rp=require(_0x94e7('0x5'));var fs=require('fs');var path=require(_0x94e7('0x6'));var rimraf=require(_0x94e7('0x7'));var config=require(_0x94e7('0x8'));var attributes=require(_0x94e7('0x9'));module[_0x94e7('0xa')]=function(_0x164f1c,_0x486d6b){return _0x164f1c[_0x94e7('0xb')](_0x94e7('0xc'),attributes,{'tableName':_0x94e7('0xd'),'paranoid':![],'indexes':[{'name':_0x94e7('0xe'),'fields':[_0x94e7('0xe')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0xded4=['request-promise','path','exports','report_whatsapp_queue','uniqueid','lodash','util','api','bluebird'];(function(_0x279754,_0x408a10){var _0x58cc79=function(_0x3df6c1){while(--_0x3df6c1){_0x279754['push'](_0x279754['shift']());}};_0x58cc79(++_0x408a10);}(_0xded4,0xe6));var _0x4ded=function(_0x3c29ab,_0x314ec4){_0x3c29ab=_0x3c29ab-0x0;var _0x52693a=_0xded4[_0x3c29ab];return _0x52693a;};'use strict';var _=require(_0x4ded('0x0'));var util=require(_0x4ded('0x1'));var logger=require('../../config/logger')(_0x4ded('0x2'));var moment=require('moment');var BPromise=require(_0x4ded('0x3'));var rp=require(_0x4ded('0x4'));var fs=require('fs');var path=require(_0x4ded('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0x4ded('0x6')]=function(_0x331f1e,_0xbb3c73){return _0x331f1e['define']('WhatsappQueueReport',attributes,{'tableName':_0x4ded('0x7'),'paranoid':![],'indexes':[{'name':_0x4ded('0x8'),'fields':[_0x4ded('0x8')]}],'timestamps':!![]});};
\ No newline at end of file
index b5365ea..c4d1e78 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf004=['CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','where','limit','lodash','util','moment','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x45b94f,_0x4150f5){var _0x556fb0=function(_0xf99f79){while(--_0xf99f79){_0x45b94f['push'](_0x45b94f['shift']());}};_0x556fb0(++_0x4150f5);}(_0xf004,0x81));var _0x4f00=function(_0x3391a9,_0x1cf51a){_0x3391a9=_0x3391a9-0x0;var _0x5c0cc7=_0xf004[_0x3391a9];return _0x5c0cc7;};'use strict';var _=require(_0x4f00('0x0'));var util=require(_0x4f00('0x1'));var moment=require(_0x4f00('0x2'));var BPromise=require(_0x4f00('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f00('0x4'));var logger=require('../../config/logger')(_0x4f00('0x5'));var config=require(_0x4f00('0x6'));var jayson=require(_0x4f00('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x18c43f,_0x52970c,_0x4ff20d){return new BPromise(function(_0x4f6135,_0x10ead8){return client[_0x4f00('0x8')](_0x18c43f,_0x4ff20d)[_0x4f00('0x9')](function(_0x255995){logger[_0x4f00('0xa')](_0x4f00('0xb'),_0x52970c,_0x4f00('0xc'));logger[_0x4f00('0xd')](_0x4f00('0xe'),_0x52970c,_0x4f00('0xc'),JSON[_0x4f00('0xf')](_0x255995));if(_0x255995['error']){if(_0x255995[_0x4f00('0x10')][_0x4f00('0x11')]===0x1f4){logger[_0x4f00('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x52970c,_0x255995[_0x4f00('0x10')][_0x4f00('0x12')]);return _0x10ead8(_0x255995['error'][_0x4f00('0x12')]);}logger['error'](_0x4f00('0xb'),_0x52970c,_0x255995['error'][_0x4f00('0x12')]);return _0x4f6135(_0x255995[_0x4f00('0x10')][_0x4f00('0x12')]);}else{logger[_0x4f00('0xa')](_0x4f00('0xb'),_0x52970c,_0x4f00('0xc'));_0x4f6135(_0x255995[_0x4f00('0x13')]['message']);}})[_0x4f00('0x14')](function(_0x3c3e12){logger[_0x4f00('0x10')](_0x4f00('0xb'),_0x52970c,_0x3c3e12);_0x10ead8(_0x3c3e12);});});}exports[_0x4f00('0x15')]=function(_0x27b2e4){var _0x582506=this;return new Promise(function(_0x5e2784,_0x215b35){return db[_0x4f00('0x16')][_0x4f00('0x17')](_0x27b2e4[_0x4f00('0x18')],{'raw':_0x27b2e4[_0x4f00('0x19')]?_0x27b2e4[_0x4f00('0x19')][_0x4f00('0x1a')]===undefined?!![]:![]:!![]})[_0x4f00('0x9')](function(_0x14f65c){logger[_0x4f00('0xa')](_0x4f00('0x15'),_0x27b2e4);logger[_0x4f00('0xd')]('CreateWhatsappQueueReport',_0x27b2e4,JSON[_0x4f00('0xf')](_0x14f65c));_0x5e2784(_0x14f65c);})[_0x4f00('0x14')](function(_0xddc5bb){logger[_0x4f00('0x10')](_0x4f00('0x15'),_0xddc5bb[_0x4f00('0x12')],_0x27b2e4);_0x215b35(_0x582506['error'](0x1f4,_0xddc5bb[_0x4f00('0x12')]));});});};exports[_0x4f00('0x1b')]=function(_0x5e015b){var _0x5296bf=this;return new Promise(function(_0x2f5f1c,_0x56060f){return db['WhatsappQueueReport']['update'](_0x5e015b[_0x4f00('0x18')],{'raw':_0x5e015b['options']?_0x5e015b[_0x4f00('0x19')][_0x4f00('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e015b[_0x4f00('0x19')]?_0x5e015b[_0x4f00('0x19')][_0x4f00('0x1c')]||null:null,'attributes':_0x5e015b[_0x4f00('0x19')]?_0x5e015b[_0x4f00('0x19')]['attributes']||null:null,'limit':_0x5e015b['options']?_0x5e015b['options'][_0x4f00('0x1d')]||null:null})[_0x4f00('0x9')](function(_0x181c74){logger[_0x4f00('0xa')](_0x4f00('0x1b'),_0x5e015b);logger[_0x4f00('0xd')](_0x4f00('0x1b'),_0x5e015b,JSON['stringify'](_0x181c74));_0x2f5f1c(_0x181c74);})[_0x4f00('0x14')](function(_0x403548){logger[_0x4f00('0x10')](_0x4f00('0x1b'),_0x403548[_0x4f00('0x12')],_0x5e015b);_0x56060f(_0x5296bf[_0x4f00('0x10')](0x1f4,_0x403548[_0x4f00('0x12')]));});});};
\ No newline at end of file
+var _0xd1f0=['where','attributes','limit','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','body','options','raw','UpdateWhatsappQueueReport','update'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd1f0,0x1b5));var _0x0d1f=function(_0x569c95,_0x54f839){_0x569c95=_0x569c95-0x0;var _0x2749b5=_0xd1f0[_0x569c95];return _0x2749b5;};'use strict';var _=require('lodash');var util=require(_0x0d1f('0x0'));var moment=require('moment');var BPromise=require(_0x0d1f('0x1'));var rs=require(_0x0d1f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d1f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d1f('0x4'))(_0x0d1f('0x5'));var config=require(_0x0d1f('0x6'));var jayson=require(_0x0d1f('0x7'));var client=jayson['client'][_0x0d1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44d2aa,_0xd8ea52,_0x4f27c1){return new BPromise(function(_0x1e0d7c,_0x43e35d){return client[_0x0d1f('0x9')](_0x44d2aa,_0x4f27c1)[_0x0d1f('0xa')](function(_0x294d19){logger[_0x0d1f('0xb')](_0x0d1f('0xc'),_0xd8ea52,_0x0d1f('0xd'));logger[_0x0d1f('0xe')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0xd8ea52,'request\x20sent',JSON[_0x0d1f('0xf')](_0x294d19));if(_0x294d19[_0x0d1f('0x10')]){if(_0x294d19[_0x0d1f('0x10')][_0x0d1f('0x11')]===0x1f4){logger[_0x0d1f('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd8ea52,_0x294d19[_0x0d1f('0x10')][_0x0d1f('0x12')]);return _0x43e35d(_0x294d19[_0x0d1f('0x10')][_0x0d1f('0x12')]);}logger[_0x0d1f('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0xd8ea52,_0x294d19['error']['message']);return _0x1e0d7c(_0x294d19[_0x0d1f('0x10')][_0x0d1f('0x12')]);}else{logger['info'](_0x0d1f('0xc'),_0xd8ea52,'request\x20sent');_0x1e0d7c(_0x294d19[_0x0d1f('0x13')]['message']);}})[_0x0d1f('0x14')](function(_0x50baef){logger[_0x0d1f('0x10')](_0x0d1f('0xc'),_0xd8ea52,_0x50baef);_0x43e35d(_0x50baef);});});}exports[_0x0d1f('0x15')]=function(_0x12b737){var _0x32facb=this;return new Promise(function(_0x28f91a,_0x3f90d2){return db[_0x0d1f('0x16')]['create'](_0x12b737[_0x0d1f('0x17')],{'raw':_0x12b737[_0x0d1f('0x18')]?_0x12b737['options'][_0x0d1f('0x19')]===undefined?!![]:![]:!![]})[_0x0d1f('0xa')](function(_0x50d775){logger[_0x0d1f('0xb')]('CreateWhatsappQueueReport',_0x12b737);logger[_0x0d1f('0xe')](_0x0d1f('0x15'),_0x12b737,JSON[_0x0d1f('0xf')](_0x50d775));_0x28f91a(_0x50d775);})[_0x0d1f('0x14')](function(_0x5ce26b){logger[_0x0d1f('0x10')](_0x0d1f('0x15'),_0x5ce26b[_0x0d1f('0x12')],_0x12b737);_0x3f90d2(_0x32facb[_0x0d1f('0x10')](0x1f4,_0x5ce26b['message']));});});};exports[_0x0d1f('0x1a')]=function(_0x5670f8){var _0x349580=this;return new Promise(function(_0x135a72,_0x499650){return db[_0x0d1f('0x16')][_0x0d1f('0x1b')](_0x5670f8[_0x0d1f('0x17')],{'raw':_0x5670f8['options']?_0x5670f8[_0x0d1f('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5670f8[_0x0d1f('0x18')]?_0x5670f8[_0x0d1f('0x18')][_0x0d1f('0x1c')]||null:null,'attributes':_0x5670f8[_0x0d1f('0x18')]?_0x5670f8[_0x0d1f('0x18')][_0x0d1f('0x1d')]||null:null,'limit':_0x5670f8['options']?_0x5670f8['options'][_0x0d1f('0x1e')]||null:null})[_0x0d1f('0xa')](function(_0x1db9db){logger[_0x0d1f('0xb')](_0x0d1f('0x1a'),_0x5670f8);logger[_0x0d1f('0xe')]('UpdateWhatsappQueueReport',_0x5670f8,JSON['stringify'](_0x1db9db));_0x135a72(_0x1db9db);})[_0x0d1f('0x14')](function(_0x1aa6b3){logger[_0x0d1f('0x10')](_0x0d1f('0x1a'),_0x1aa6b3[_0x0d1f('0x12')],_0x5670f8);_0x499650(_0x349580[_0x0d1f('0x10')](0x1f4,_0x1aa6b3[_0x0d1f('0x12')]));});});};
\ No newline at end of file
index 3d2d909..c9a8d51 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4e61=['../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4be534,_0x45939c){var _0x3f8414=function(_0x108026){while(--_0x108026){_0x4be534['push'](_0x4be534['shift']());}};_0x3f8414(++_0x45939c);}(_0x4e61,0x1f0));var _0x14e6=function(_0x445c98,_0x132bf7){_0x445c98=_0x445c98-0x0;var _0x2fe913=_0x4e61[_0x445c98];return _0x2fe913;};'use strict';var multer=require(_0x14e6('0x0'));var util=require(_0x14e6('0x1'));var path=require(_0x14e6('0x2'));var timeout=require(_0x14e6('0x3'));var express=require(_0x14e6('0x4'));var router=express[_0x14e6('0x5')]();var fs_extra=require(_0x14e6('0x6'));var auth=require(_0x14e6('0x7'));var interaction=require(_0x14e6('0x8'));var config=require('../../config/environment');var controller=require('./whatsappTransferReport.controller');router[_0x14e6('0x9')]('/',auth[_0x14e6('0xa')](),controller[_0x14e6('0xb')]);router[_0x14e6('0x9')](_0x14e6('0xc'),auth[_0x14e6('0xa')](),controller['describe']);router[_0x14e6('0x9')](_0x14e6('0xd'),auth[_0x14e6('0xa')](),controller[_0x14e6('0xe')]);router['post']('/',auth[_0x14e6('0xa')](),controller[_0x14e6('0xf')]);router[_0x14e6('0x10')](_0x14e6('0xd'),auth[_0x14e6('0xa')](),controller['update']);router['delete'](_0x14e6('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x14e6('0x11')]=router;
\ No newline at end of file
+var _0x923a=['show','post','create','put','/:id','update','delete','destroy','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x585526,_0x5887b6){var _0x2e9639=function(_0x20ac27){while(--_0x20ac27){_0x585526['push'](_0x585526['shift']());}};_0x2e9639(++_0x5887b6);}(_0x923a,0x184));var _0xa923=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x923a[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require(_0xa923('0x0'));var util=require(_0xa923('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa923('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa923('0x3'));var interaction=require(_0xa923('0x4'));var config=require(_0xa923('0x5'));var controller=require('./whatsappTransferReport.controller');router[_0xa923('0x6')]('/',auth[_0xa923('0x7')](),controller[_0xa923('0x8')]);router[_0xa923('0x6')](_0xa923('0x9'),auth[_0xa923('0x7')](),controller[_0xa923('0xa')]);router[_0xa923('0x6')]('/:id',auth['isAuthenticated'](),controller[_0xa923('0xb')]);router[_0xa923('0xc')]('/',auth[_0xa923('0x7')](),controller[_0xa923('0xd')]);router[_0xa923('0xe')](_0xa923('0xf'),auth[_0xa923('0x7')](),controller[_0xa923('0x10')]);router[_0xa923('0x11')](_0xa923('0xf'),auth[_0xa923('0x7')](),controller[_0xa923('0x12')]);module['exports']=router;
\ No newline at end of file
index afb96cf..d3b315b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb91a=['DATE','exports','STRING','ENUM','account','queue'];(function(_0x5d6e35,_0x4d1ac0){var _0x5d7ada=function(_0x2f7dd3){while(--_0x2f7dd3){_0x5d6e35['push'](_0x5d6e35['shift']());}};_0x5d7ada(++_0x4d1ac0);}(_0xb91a,0xe5));var _0xab91=function(_0x4effa6,_0x236ca1){_0x4effa6=_0x4effa6-0x0;var _0x51e8de=_0xb91a[_0x4effa6];return _0x51e8de;};'use strict';var Sequelize=require('sequelize');module[_0xab91('0x0')]={'uniqueid':{'type':Sequelize[_0xab91('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xab91('0x2')](_0xab91('0x3'),'agent',_0xab91('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xab91('0x5')]}};
\ No newline at end of file
+var _0x5eed=['queue','DATE','sequelize','exports','STRING','ENUM','account','agent'];(function(_0x5508db,_0x22ecbe){var _0x54ce94=function(_0x389047){while(--_0x389047){_0x5508db['push'](_0x5508db['shift']());}};_0x54ce94(++_0x22ecbe);}(_0x5eed,0x10a));var _0xd5ee=function(_0x3ee438,_0x586213){_0x3ee438=_0x3ee438-0x0;var _0x4ddc00=_0x5eed[_0x3ee438];return _0x4ddc00;};'use strict';var Sequelize=require(_0xd5ee('0x0'));module[_0xd5ee('0x1')]={'uniqueid':{'type':Sequelize[_0xd5ee('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd5ee('0x3')](_0xd5ee('0x4'),_0xd5ee('0x5'),_0xd5ee('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xd5ee('0x7')]}};
\ No newline at end of file
index 97480eb..503c720 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9bb3=['includeAll','include','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','stack','name','send','index','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','rows','catch','show'];(function(_0x30faec,_0x18940b){var _0x29484f=function(_0x169ae8){while(--_0x169ae8){_0x30faec['push'](_0x30faec['shift']());}};_0x29484f(++_0x18940b);}(_0x9bb3,0x134));var _0x39bb=function(_0x2cb2f9,_0x18ccab){_0x2cb2f9=_0x2cb2f9-0x0;var _0x57fec6=_0x9bb3[_0x2cb2f9];return _0x57fec6;};'use strict';var emlformat=require(_0x39bb('0x0'));var rimraf=require(_0x39bb('0x1'));var zipdir=require(_0x39bb('0x2'));var jsonpatch=require(_0x39bb('0x3'));var rp=require(_0x39bb('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x39bb('0x5'));var util=require(_0x39bb('0x6'));var path=require(_0x39bb('0x7'));var sox=require(_0x39bb('0x8'));var csv=require(_0x39bb('0x9'));var ejs=require(_0x39bb('0xa'));var fs=require('fs');var fs_extra=require(_0x39bb('0xb'));var _=require(_0x39bb('0xc'));var squel=require(_0x39bb('0xd'));var crypto=require(_0x39bb('0xe'));var jsforce=require(_0x39bb('0xf'));var deskjs=require(_0x39bb('0x10'));var toCsv=require(_0x39bb('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x39bb('0x11'));var authService=require(_0x39bb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x39bb('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39bb('0x14'))(_0x39bb('0x15'));var utils=require(_0x39bb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x39bb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cec25,_0x986cf){_0x986cf=_0x986cf||0xcc;return function(_0x9856b6){if(_0x9856b6){return _0x5cec25[_0x39bb('0x18')](_0x986cf);}return _0x5cec25[_0x39bb('0x19')](_0x986cf)[_0x39bb('0x1a')]();};}function respondWithResult(_0x16b2f3,_0x2fea51){_0x2fea51=_0x2fea51||0xc8;return function(_0x4a7a94){if(_0x4a7a94){return _0x16b2f3['status'](_0x2fea51)[_0x39bb('0x1b')](_0x4a7a94);}};}function respondWithFilteredResult(_0x4a569c,_0x46e92a){return function(_0x40ee8f){if(_0x40ee8f){var _0x34c794=typeof _0x46e92a[_0x39bb('0x1c')]===_0x39bb('0x1d')&&typeof _0x46e92a[_0x39bb('0x1e')]===_0x39bb('0x1d');var _0x27fa0f=_0x40ee8f[_0x39bb('0x1f')];var _0xde3cf4=_0x34c794?0x0:_0x46e92a['offset'];var _0x802d66=_0x34c794?_0x40ee8f[_0x39bb('0x1f')]:_0x46e92a[_0x39bb('0x1c')]+_0x46e92a['limit'];var _0x12b6a4;if(_0x802d66>=_0x27fa0f){_0x802d66=_0x27fa0f;_0x12b6a4=0xc8;}else{_0x12b6a4=0xce;}_0x4a569c[_0x39bb('0x19')](_0x12b6a4);return _0x4a569c[_0x39bb('0x20')](_0x39bb('0x21'),_0xde3cf4+'-'+_0x802d66+'/'+_0x27fa0f)[_0x39bb('0x1b')](_0x40ee8f);}return null;};}function patchUpdates(_0xfa6090){return function(_0x459580){try{jsonpatch[_0x39bb('0x22')](_0x459580,_0xfa6090,!![]);}catch(_0x50adc6){return BPromise[_0x39bb('0x23')](_0x50adc6);}return _0x459580['save']();};}function saveUpdates(_0x5f14a0,_0xee257d){return function(_0x475768){if(_0x475768){return _0x475768['update'](_0x5f14a0)['then'](function(_0x1f2e4f){return _0x1f2e4f;});}return null;};}function removeEntity(_0x2ee1c9,_0x54509b){return function(_0x2f9390){if(_0x2f9390){return _0x2f9390[_0x39bb('0x24')]()[_0x39bb('0x25')](function(){_0x2ee1c9['status'](0xcc)[_0x39bb('0x1a')]();});}};}function handleEntityNotFound(_0x492eb6,_0x855c98){return function(_0x3d1cef){if(!_0x3d1cef){_0x492eb6[_0x39bb('0x18')](0x194);}return _0x3d1cef;};}function handleError(_0x3ed6f2,_0x91916f){_0x91916f=_0x91916f||0x1f4;return function(_0x5f4acf){logger['error'](_0x5f4acf[_0x39bb('0x26')]);if(_0x5f4acf[_0x39bb('0x27')]){delete _0x5f4acf['name'];}_0x3ed6f2['status'](_0x91916f)[_0x39bb('0x28')](_0x5f4acf);};}exports[_0x39bb('0x29')]=function(_0x14440b,_0x55af04){var _0x68025={},_0x512573={},_0x1f9fe2={'count':0x0,'rows':[]};var _0x187953=_['map'](db[_0x39bb('0x2a')][_0x39bb('0x2b')],function(_0x1abcd3){return{'name':_0x1abcd3[_0x39bb('0x2c')],'type':_0x1abcd3[_0x39bb('0x2d')][_0x39bb('0x2e')]};});_0x512573[_0x39bb('0x2f')]=_[_0x39bb('0x30')](_0x187953,_0x39bb('0x27'));_0x512573[_0x39bb('0x31')]=_[_0x39bb('0x32')](_0x14440b[_0x39bb('0x31')]);_0x512573[_0x39bb('0x33')]=_['intersection'](_0x512573[_0x39bb('0x2f')],_0x512573[_0x39bb('0x31')]);_0x68025['attributes']=_[_0x39bb('0x34')](_0x512573[_0x39bb('0x2f')],qs['fields'](_0x14440b[_0x39bb('0x31')][_0x39bb('0x35')]));_0x68025[_0x39bb('0x36')]=_0x68025['attributes']['length']?_0x68025['attributes']:_0x512573[_0x39bb('0x2f')];if(!_0x14440b[_0x39bb('0x31')][_0x39bb('0x37')](_0x39bb('0x38'))){_0x68025['limit']=qs[_0x39bb('0x1e')](_0x14440b['query'][_0x39bb('0x1e')]);_0x68025['offset']=qs['offset'](_0x14440b['query']['offset']);}_0x68025[_0x39bb('0x39')]=qs[_0x39bb('0x3a')](_0x14440b['query'][_0x39bb('0x3a')]);_0x68025[_0x39bb('0x3b')]=qs['filters'](_['pick'](_0x14440b[_0x39bb('0x31')],_0x512573[_0x39bb('0x33')]),_0x187953);if(_0x14440b[_0x39bb('0x31')][_0x39bb('0x3c')]){_0x68025[_0x39bb('0x3b')]=_[_0x39bb('0x3d')](_0x68025[_0x39bb('0x3b')],{'$or':_[_0x39bb('0x30')](_0x187953,function(_0x36fe77){if(_0x36fe77[_0x39bb('0x2d')]!==_0x39bb('0x3e')){var _0x5cbab9={};_0x5cbab9[_0x36fe77['name']]={'$like':'%'+_0x14440b[_0x39bb('0x31')][_0x39bb('0x3c')]+'%'};return _0x5cbab9;}})});}_0x68025=_[_0x39bb('0x3d')]({},_0x68025,_0x14440b[_0x39bb('0x3f')]);var _0x46e344={'where':_0x68025['where']};return db['WhatsappTransferReport']['count'](_0x46e344)['then'](function(_0x5f459c){_0x1f9fe2['count']=_0x5f459c;if(_0x14440b[_0x39bb('0x31')]['includeAll']){_0x68025['include']=[{'all':!![]}];}return db[_0x39bb('0x2a')]['findAll'](_0x68025);})['then'](function(_0x219ea8){_0x1f9fe2[_0x39bb('0x40')]=_0x219ea8;return _0x1f9fe2;})[_0x39bb('0x25')](respondWithFilteredResult(_0x55af04,_0x68025))[_0x39bb('0x41')](handleError(_0x55af04,null));};exports[_0x39bb('0x42')]=function(_0xaec79d,_0x14a9ae){var _0x2d7afe={'raw':!![],'where':{'id':_0xaec79d['params']['id']}},_0x57d8dc={};_0x57d8dc[_0x39bb('0x2f')]=_[_0x39bb('0x32')](db[_0x39bb('0x2a')][_0x39bb('0x2b')]);_0x57d8dc[_0x39bb('0x31')]=_[_0x39bb('0x32')](_0xaec79d[_0x39bb('0x31')]);_0x57d8dc[_0x39bb('0x33')]=_[_0x39bb('0x34')](_0x57d8dc['model'],_0x57d8dc[_0x39bb('0x31')]);_0x2d7afe['attributes']=_['intersection'](_0x57d8dc[_0x39bb('0x2f')],qs[_0x39bb('0x35')](_0xaec79d['query'][_0x39bb('0x35')]));_0x2d7afe[_0x39bb('0x36')]=_0x2d7afe[_0x39bb('0x36')]['length']?_0x2d7afe[_0x39bb('0x36')]:_0x57d8dc[_0x39bb('0x2f')];if(_0xaec79d[_0x39bb('0x31')][_0x39bb('0x43')]){_0x2d7afe[_0x39bb('0x44')]=[{'all':!![]}];}_0x2d7afe=_[_0x39bb('0x3d')]({},_0x2d7afe,_0xaec79d[_0x39bb('0x3f')]);return db[_0x39bb('0x2a')][_0x39bb('0x45')](_0x2d7afe)[_0x39bb('0x25')](handleEntityNotFound(_0x14a9ae,null))[_0x39bb('0x25')](respondWithResult(_0x14a9ae,null))[_0x39bb('0x41')](handleError(_0x14a9ae,null));};exports[_0x39bb('0x46')]=function(_0x2e7cd7,_0x4458bf){return db['WhatsappTransferReport'][_0x39bb('0x46')](_0x2e7cd7[_0x39bb('0x47')],{})[_0x39bb('0x25')](respondWithResult(_0x4458bf,0xc9))[_0x39bb('0x41')](handleError(_0x4458bf,null));};exports[_0x39bb('0x48')]=function(_0x51dee3,_0x5ee081){if(_0x51dee3[_0x39bb('0x47')]['id']){delete _0x51dee3['body']['id'];}return db[_0x39bb('0x2a')][_0x39bb('0x45')]({'where':{'id':_0x51dee3[_0x39bb('0x49')]['id']}})[_0x39bb('0x25')](handleEntityNotFound(_0x5ee081,null))[_0x39bb('0x25')](saveUpdates(_0x51dee3['body'],null))[_0x39bb('0x25')](respondWithResult(_0x5ee081,null))[_0x39bb('0x41')](handleError(_0x5ee081,null));};exports[_0x39bb('0x24')]=function(_0x29de1f,_0x3947ae){return db[_0x39bb('0x2a')][_0x39bb('0x45')]({'where':{'id':_0x29de1f[_0x39bb('0x49')]['id']}})[_0x39bb('0x25')](handleEntityNotFound(_0x3947ae,null))[_0x39bb('0x25')](removeEntity(_0x3947ae,null))[_0x39bb('0x41')](handleError(_0x3947ae,null));};exports['describe']=function(_0x181a34,_0x3eadcf){return db[_0x39bb('0x2a')][_0x39bb('0x4a')]()[_0x39bb('0x25')](respondWithResult(_0x3eadcf,null))[_0x39bb('0x41')](handleError(_0x3eadcf,null));};
\ No newline at end of file
+var _0xbb68=['sort','pick','filter','where','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','filters','fields','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','error','name','index','map','WhatsappTransferReport','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4c19a1,_0x15197f){var _0x58ac50=function(_0x7c08c1){while(--_0x7c08c1){_0x4c19a1['push'](_0x4c19a1['shift']());}};_0x58ac50(++_0x15197f);}(_0xbb68,0xad));var _0x8bb6=function(_0x4afc24,_0x143a6a){_0x4afc24=_0x4afc24-0x0;var _0x31bcd7=_0xbb68[_0x4afc24];return _0x31bcd7;};'use strict';var emlformat=require(_0x8bb6('0x0'));var rimraf=require(_0x8bb6('0x1'));var zipdir=require(_0x8bb6('0x2'));var jsonpatch=require(_0x8bb6('0x3'));var rp=require(_0x8bb6('0x4'));var moment=require('moment');var BPromise=require(_0x8bb6('0x5'));var Mustache=require(_0x8bb6('0x6'));var util=require(_0x8bb6('0x7'));var path=require('path');var sox=require(_0x8bb6('0x8'));var csv=require('to-csv');var ejs=require(_0x8bb6('0x9'));var fs=require('fs');var fs_extra=require(_0x8bb6('0xa'));var _=require(_0x8bb6('0xb'));var squel=require(_0x8bb6('0xc'));var crypto=require(_0x8bb6('0xd'));var jsforce=require(_0x8bb6('0xe'));var deskjs=require(_0x8bb6('0xf'));var toCsv=require(_0x8bb6('0x10'));var querystring=require(_0x8bb6('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8bb6('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8bb6('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bb6('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x8bb6('0x15'));var licenseUtil=require(_0x8bb6('0x16'));var db=require(_0x8bb6('0x17'))['db'];function respondWithStatusCode(_0x2394d2,_0x21985a){_0x21985a=_0x21985a||0xcc;return function(_0x92b2f){if(_0x92b2f){return _0x2394d2[_0x8bb6('0x18')](_0x21985a);}return _0x2394d2[_0x8bb6('0x19')](_0x21985a)[_0x8bb6('0x1a')]();};}function respondWithResult(_0x599eee,_0x25d1af){_0x25d1af=_0x25d1af||0xc8;return function(_0x4090df){if(_0x4090df){return _0x599eee[_0x8bb6('0x19')](_0x25d1af)[_0x8bb6('0x1b')](_0x4090df);}};}function respondWithFilteredResult(_0xf2a78d,_0x9ca8dd){return function(_0x16e982){if(_0x16e982){var _0x3b2a15=typeof _0x9ca8dd[_0x8bb6('0x1c')]===_0x8bb6('0x1d')&&typeof _0x9ca8dd[_0x8bb6('0x1e')]===_0x8bb6('0x1d');var _0x1e6f71=_0x16e982[_0x8bb6('0x1f')];var _0xd2b8a3=_0x3b2a15?0x0:_0x9ca8dd[_0x8bb6('0x1c')];var _0x379e22=_0x3b2a15?_0x16e982[_0x8bb6('0x1f')]:_0x9ca8dd[_0x8bb6('0x1c')]+_0x9ca8dd[_0x8bb6('0x1e')];var _0x4ed248;if(_0x379e22>=_0x1e6f71){_0x379e22=_0x1e6f71;_0x4ed248=0xc8;}else{_0x4ed248=0xce;}_0xf2a78d[_0x8bb6('0x19')](_0x4ed248);return _0xf2a78d[_0x8bb6('0x20')](_0x8bb6('0x21'),_0xd2b8a3+'-'+_0x379e22+'/'+_0x1e6f71)[_0x8bb6('0x1b')](_0x16e982);}return null;};}function patchUpdates(_0x2b5743){return function(_0x310bc1){try{jsonpatch[_0x8bb6('0x22')](_0x310bc1,_0x2b5743,!![]);}catch(_0x13bbaf){return BPromise[_0x8bb6('0x23')](_0x13bbaf);}return _0x310bc1['save']();};}function saveUpdates(_0x16a395,_0x4d75f8){return function(_0x432d37){if(_0x432d37){return _0x432d37[_0x8bb6('0x24')](_0x16a395)['then'](function(_0xeae0d0){return _0xeae0d0;});}return null;};}function removeEntity(_0x49b72e,_0x334d3b){return function(_0x3818de){if(_0x3818de){return _0x3818de[_0x8bb6('0x25')]()[_0x8bb6('0x26')](function(){_0x49b72e[_0x8bb6('0x19')](0xcc)[_0x8bb6('0x1a')]();});}};}function handleEntityNotFound(_0x5420f5,_0x3e87c5){return function(_0x1f3bd1){if(!_0x1f3bd1){_0x5420f5[_0x8bb6('0x18')](0x194);}return _0x1f3bd1;};}function handleError(_0x3e73b9,_0x39d8bf){_0x39d8bf=_0x39d8bf||0x1f4;return function(_0x1ccdac){logger[_0x8bb6('0x27')](_0x1ccdac['stack']);if(_0x1ccdac[_0x8bb6('0x28')]){delete _0x1ccdac['name'];}_0x3e73b9['status'](_0x39d8bf)['send'](_0x1ccdac);};}exports[_0x8bb6('0x29')]=function(_0x1dcf3b,_0x116d81){var _0x1fa0f2={},_0x2df9d7={},_0x468cb9={'count':0x0,'rows':[]};var _0x3934c0=_[_0x8bb6('0x2a')](db[_0x8bb6('0x2b')]['rawAttributes'],function(_0x29dffb){return{'name':_0x29dffb[_0x8bb6('0x2c')],'type':_0x29dffb['type'][_0x8bb6('0x2d')]};});_0x2df9d7[_0x8bb6('0x2e')]=_['map'](_0x3934c0,'name');_0x2df9d7[_0x8bb6('0x2f')]=_[_0x8bb6('0x30')](_0x1dcf3b[_0x8bb6('0x2f')]);_0x2df9d7['filters']=_[_0x8bb6('0x31')](_0x2df9d7[_0x8bb6('0x2e')],_0x2df9d7[_0x8bb6('0x2f')]);_0x1fa0f2[_0x8bb6('0x32')]=_[_0x8bb6('0x31')](_0x2df9d7['model'],qs['fields'](_0x1dcf3b[_0x8bb6('0x2f')]['fields']));_0x1fa0f2[_0x8bb6('0x32')]=_0x1fa0f2[_0x8bb6('0x32')][_0x8bb6('0x33')]?_0x1fa0f2[_0x8bb6('0x32')]:_0x2df9d7[_0x8bb6('0x2e')];if(!_0x1dcf3b['query'][_0x8bb6('0x34')](_0x8bb6('0x35'))){_0x1fa0f2[_0x8bb6('0x1e')]=qs[_0x8bb6('0x1e')](_0x1dcf3b[_0x8bb6('0x2f')]['limit']);_0x1fa0f2['offset']=qs['offset'](_0x1dcf3b['query'][_0x8bb6('0x1c')]);}_0x1fa0f2[_0x8bb6('0x36')]=qs['sort'](_0x1dcf3b[_0x8bb6('0x2f')][_0x8bb6('0x37')]);_0x1fa0f2['where']=qs['filters'](_[_0x8bb6('0x38')](_0x1dcf3b[_0x8bb6('0x2f')],_0x2df9d7['filters']),_0x3934c0);if(_0x1dcf3b[_0x8bb6('0x2f')][_0x8bb6('0x39')]){_0x1fa0f2[_0x8bb6('0x3a')]=_[_0x8bb6('0x3b')](_0x1fa0f2[_0x8bb6('0x3a')],{'$or':_[_0x8bb6('0x2a')](_0x3934c0,function(_0x5ae4ee){if(_0x5ae4ee[_0x8bb6('0x3c')]!==_0x8bb6('0x3d')){var _0x1f722c={};_0x1f722c[_0x5ae4ee['name']]={'$like':'%'+_0x1dcf3b[_0x8bb6('0x2f')][_0x8bb6('0x39')]+'%'};return _0x1f722c;}})});}_0x1fa0f2=_[_0x8bb6('0x3b')]({},_0x1fa0f2,_0x1dcf3b[_0x8bb6('0x3e')]);var _0x38dfe4={'where':_0x1fa0f2[_0x8bb6('0x3a')]};return db[_0x8bb6('0x2b')][_0x8bb6('0x1f')](_0x38dfe4)[_0x8bb6('0x26')](function(_0x521fbb){_0x468cb9[_0x8bb6('0x1f')]=_0x521fbb;if(_0x1dcf3b[_0x8bb6('0x2f')]['includeAll']){_0x1fa0f2[_0x8bb6('0x3f')]=[{'all':!![]}];}return db[_0x8bb6('0x2b')][_0x8bb6('0x40')](_0x1fa0f2);})[_0x8bb6('0x26')](function(_0x50c4e3){_0x468cb9[_0x8bb6('0x41')]=_0x50c4e3;return _0x468cb9;})[_0x8bb6('0x26')](respondWithFilteredResult(_0x116d81,_0x1fa0f2))[_0x8bb6('0x42')](handleError(_0x116d81,null));};exports[_0x8bb6('0x43')]=function(_0x1eeed1,_0x11128f){var _0x1906d={'raw':!![],'where':{'id':_0x1eeed1['params']['id']}},_0x19d5fc={};_0x19d5fc[_0x8bb6('0x2e')]=_['keys'](db[_0x8bb6('0x2b')][_0x8bb6('0x44')]);_0x19d5fc[_0x8bb6('0x2f')]=_[_0x8bb6('0x30')](_0x1eeed1[_0x8bb6('0x2f')]);_0x19d5fc[_0x8bb6('0x45')]=_[_0x8bb6('0x31')](_0x19d5fc[_0x8bb6('0x2e')],_0x19d5fc['query']);_0x1906d['attributes']=_[_0x8bb6('0x31')](_0x19d5fc[_0x8bb6('0x2e')],qs[_0x8bb6('0x46')](_0x1eeed1[_0x8bb6('0x2f')]['fields']));_0x1906d[_0x8bb6('0x32')]=_0x1906d[_0x8bb6('0x32')][_0x8bb6('0x33')]?_0x1906d[_0x8bb6('0x32')]:_0x19d5fc[_0x8bb6('0x2e')];if(_0x1eeed1['query'][_0x8bb6('0x47')]){_0x1906d[_0x8bb6('0x3f')]=[{'all':!![]}];}_0x1906d=_[_0x8bb6('0x3b')]({},_0x1906d,_0x1eeed1[_0x8bb6('0x3e')]);return db['WhatsappTransferReport'][_0x8bb6('0x48')](_0x1906d)[_0x8bb6('0x26')](handleEntityNotFound(_0x11128f,null))['then'](respondWithResult(_0x11128f,null))[_0x8bb6('0x42')](handleError(_0x11128f,null));};exports[_0x8bb6('0x49')]=function(_0xf77a1b,_0x77a32a){return db[_0x8bb6('0x2b')][_0x8bb6('0x49')](_0xf77a1b[_0x8bb6('0x4a')],{})[_0x8bb6('0x26')](respondWithResult(_0x77a32a,0xc9))[_0x8bb6('0x42')](handleError(_0x77a32a,null));};exports[_0x8bb6('0x24')]=function(_0x47d98d,_0x30f9c9){if(_0x47d98d['body']['id']){delete _0x47d98d[_0x8bb6('0x4a')]['id'];}return db[_0x8bb6('0x2b')][_0x8bb6('0x48')]({'where':{'id':_0x47d98d['params']['id']}})[_0x8bb6('0x26')](handleEntityNotFound(_0x30f9c9,null))[_0x8bb6('0x26')](saveUpdates(_0x47d98d[_0x8bb6('0x4a')],null))[_0x8bb6('0x26')](respondWithResult(_0x30f9c9,null))['catch'](handleError(_0x30f9c9,null));};exports[_0x8bb6('0x25')]=function(_0x42c5a3,_0x3f99f3){return db[_0x8bb6('0x2b')][_0x8bb6('0x48')]({'where':{'id':_0x42c5a3['params']['id']}})[_0x8bb6('0x26')](handleEntityNotFound(_0x3f99f3,null))['then'](removeEntity(_0x3f99f3,null))[_0x8bb6('0x42')](handleError(_0x3f99f3,null));};exports['describe']=function(_0x520378,_0x4a4c20){return db[_0x8bb6('0x2b')][_0x8bb6('0x4b')]()[_0x8bb6('0x26')](respondWithResult(_0x4a4c20,null))['catch'](handleError(_0x4a4c20,null));};
\ No newline at end of file
index 301f4bb..5133d4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcb8d=['moment','bluebird','request-promise','path','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb8d,0x143));var _0xdcb8=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xcb8d[_0x3740fe];return _0x55492b;};'use strict';var _=require(_0xdcb8('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xdcb8('0x1'));var BPromise=require(_0xdcb8('0x2'));var rp=require(_0xdcb8('0x3'));var fs=require('fs');var path=require(_0xdcb8('0x4'));var rimraf=require('rimraf');var config=require(_0xdcb8('0x5'));var attributes=require(_0xdcb8('0x6'));module[_0xdcb8('0x7')]=function(_0x16fedf,_0x153f50){return _0x16fedf[_0xdcb8('0x8')](_0xdcb8('0x9'),attributes,{'tableName':_0xdcb8('0xa'),'paranoid':![],'indexes':[{'name':_0xdcb8('0xb'),'fields':[_0xdcb8('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
+var _0x9895=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','WhatsappTransferReport','uniqueid','lodash'];(function(_0x4d349a,_0x3a4436){var _0x1e6feb=function(_0x251125){while(--_0x251125){_0x4d349a['push'](_0x4d349a['shift']());}};_0x1e6feb(++_0x3a4436);}(_0x9895,0x143));var _0x5989=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9895[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x5989('0x0'));var util=require(_0x5989('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5989('0x2'));var BPromise=require(_0x5989('0x3'));var rp=require(_0x5989('0x4'));var fs=require('fs');var path=require(_0x5989('0x5'));var rimraf=require(_0x5989('0x6'));var config=require(_0x5989('0x7'));var attributes=require(_0x5989('0x8'));module[_0x5989('0x9')]=function(_0x50c37f,_0x34613){return _0x50c37f['define'](_0x5989('0xa'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5989('0xb')]}],'timestamps':!![]});};
\ No newline at end of file
index 81d4049..3f62ec7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf47=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','WhatsappTransferReport,\x20%s,\x20%s','message','result'];(function(_0x3b4699,_0x206469){var _0x4e5af3=function(_0x262990){while(--_0x262990){_0x3b4699['push'](_0x3b4699['shift']());}};_0x4e5af3(++_0x206469);}(_0xcf47,0x18f));var _0x7cf4=function(_0x492c3f,_0x23e3fe){_0x492c3f=_0x492c3f-0x0;var _0x2efb11=_0xcf47[_0x492c3f];return _0x2efb11;};'use strict';var _=require(_0x7cf4('0x0'));var util=require('util');var moment=require(_0x7cf4('0x1'));var BPromise=require('bluebird');var rs=require(_0x7cf4('0x2'));var fs=require('fs');var Redis=require(_0x7cf4('0x3'));var db=require(_0x7cf4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7cf4('0x5'))(_0x7cf4('0x6'));var config=require('../../config/environment');var jayson=require(_0x7cf4('0x7'));var client=jayson[_0x7cf4('0x8')][_0x7cf4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x389630,_0x478931,_0x5a1e0d){return new BPromise(function(_0x4a566b,_0x35f42d){return client[_0x7cf4('0xa')](_0x389630,_0x5a1e0d)[_0x7cf4('0xb')](function(_0x1cf96b){logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x478931,'request\x20sent');logger['debug'](_0x7cf4('0xc'),_0x478931,_0x7cf4('0xd'),JSON['stringify'](_0x1cf96b));if(_0x1cf96b['error']){if(_0x1cf96b[_0x7cf4('0xe')][_0x7cf4('0xf')]===0x1f4){logger[_0x7cf4('0xe')](_0x7cf4('0x10'),_0x478931,_0x1cf96b[_0x7cf4('0xe')][_0x7cf4('0x11')]);return _0x35f42d(_0x1cf96b[_0x7cf4('0xe')][_0x7cf4('0x11')]);}logger[_0x7cf4('0xe')](_0x7cf4('0x10'),_0x478931,_0x1cf96b[_0x7cf4('0xe')][_0x7cf4('0x11')]);return _0x4a566b(_0x1cf96b[_0x7cf4('0xe')][_0x7cf4('0x11')]);}else{logger['info'](_0x7cf4('0x10'),_0x478931,_0x7cf4('0xd'));_0x4a566b(_0x1cf96b[_0x7cf4('0x12')]['message']);}})['catch'](function(_0x183bc9){logger[_0x7cf4('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0x478931,_0x183bc9);_0x35f42d(_0x183bc9);});});}
\ No newline at end of file
+var _0x4331=['message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0x4331,0x1b2));var _0x1433=function(_0x5f36cd,_0x37d4c9){_0x5f36cd=_0x5f36cd-0x0;var _0x49832a=_0x4331[_0x5f36cd];return _0x49832a;};'use strict';var _=require(_0x1433('0x0'));var util=require(_0x1433('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1433('0x2'));var fs=require('fs');var Redis=require(_0x1433('0x3'));var db=require(_0x1433('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1433('0x5'))(_0x1433('0x6'));var config=require(_0x1433('0x7'));var jayson=require(_0x1433('0x8'));var client=jayson['client'][_0x1433('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c19fd,_0x1815a7,_0x217f3e){return new BPromise(function(_0x11a55a,_0x238360){return client[_0x1433('0xa')](_0x2c19fd,_0x217f3e)['then'](function(_0x46524c){logger['info'](_0x1433('0xb'),_0x1815a7,_0x1433('0xc'));logger['debug'](_0x1433('0xd'),_0x1815a7,_0x1433('0xc'),JSON['stringify'](_0x46524c));if(_0x46524c[_0x1433('0xe')]){if(_0x46524c[_0x1433('0xe')][_0x1433('0xf')]===0x1f4){logger[_0x1433('0xe')](_0x1433('0xb'),_0x1815a7,_0x46524c[_0x1433('0xe')][_0x1433('0x10')]);return _0x238360(_0x46524c[_0x1433('0xe')][_0x1433('0x10')]);}logger[_0x1433('0xe')](_0x1433('0xb'),_0x1815a7,_0x46524c[_0x1433('0xe')][_0x1433('0x10')]);return _0x11a55a(_0x46524c['error']['message']);}else{logger['info'](_0x1433('0xb'),_0x1815a7,_0x1433('0xc'));_0x11a55a(_0x46524c['result'][_0x1433('0x10')]);}})[_0x1433('0x11')](function(_0x150b25){logger[_0x1433('0xe')](_0x1433('0xb'),_0x1815a7,_0x150b25);_0x238360(_0x150b25);});});}
\ No newline at end of file
index 653e1b9..baeba26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x15cb=['./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','start','info','filter','exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/license','./config/environment'];(function(_0x434c77,_0x5c14a2){var _0x2b94bd=function(_0xb4cdc0){while(--_0xb4cdc0){_0x434c77['push'](_0x434c77['shift']());}};_0x2b94bd(++_0x5c14a2);}(_0x15cb,0x16f));var _0xb15c=function(_0x8338d7,_0x50616d){_0x8338d7=_0x8338d7-0x0;var _0x12f1a4=_0x15cb[_0x8338d7];return _0x12f1a4;};'use strict';var _=require('lodash');var db=require(_0xb15c('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xb15c('0x1'));var rpc=require('./rpc');var config=require(_0xb15c('0x2'));var logger=require(_0xb15c('0x3'))(_0xb15c('0x4'));var pm2=require(_0xb15c('0x5'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xb15c('0x6'));var chat=require(_0xb15c('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0xb15c('0x8'));function main(){return db[_0xb15c('0x9')][_0xb15c('0xa')]()[_0xb15c('0xb')](function(){if(config[_0xb15c('0xc')]){return seedDb[_0xb15c('0xd')]();}})[_0xb15c('0xb')](function(){return checkLicense[_0xb15c('0xd')]();})['then'](function(){return rpc[_0xb15c('0xe')]();})['then'](function(_0x50389a){logger['info'](_0x50389a);return chat[_0xb15c('0xf')]();})[_0xb15c('0xb')](function(){return whatsapp[_0xb15c('0xf')]();})[_0xb15c('0xb')](function(){return schedule[_0xb15c('0xf')]();})[_0xb15c('0xb')](function(){return transcribe['start']();})['then'](function(){return provider[_0xb15c('0xf')]();})['then'](function(_0xf8031d){logger[_0xb15c('0x10')](_0xf8031d);return pm2[_0xb15c('0xf')](pm2Config);})[_0xb15c('0xb')](function(_0x465c44){var _0x429c89=_0x465c44[_0xb15c('0x11')](function(_0x206377){return typeof _0x206377[_0xb15c('0x12')]===_0xb15c('0x13')&&_0x206377['exitCode']>=0x0;});if(_0x429c89[_0xb15c('0x14')]>0x0){throw new Error(_0x429c89[_0xb15c('0x14')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xb15c('0x15')](_0x429c89,function(_0x4163a7){return'\x22'+_0x4163a7[_0xb15c('0x16')][_0xb15c('0x17')]+'\x22';}));}logger[_0xb15c('0x10')](_0xb15c('0x18'),_[_0xb15c('0x15')](_['filter'](_0x465c44,{'status':_0xb15c('0x19')}),_0xb15c('0x17'))[_0xb15c('0x1a')]());logger['info'](_0xb15c('0x1b'),_['map'](_[_0xb15c('0x11')](_0x465c44,function(_0x201cc7){return _0x201cc7[_0xb15c('0x1c')]!==_0xb15c('0x19');}),_0xb15c('0x17'))[_0xb15c('0x1a')]()||_0xb15c('0x1d'));console[_0xb15c('0x1e')](_0xb15c('0x1f'));})[_0xb15c('0x20')](function(_0x11226d){console[_0xb15c('0x1e')](_0xb15c('0x21'),_0x11226d);logger[_0xb15c('0x22')](_0xb15c('0x23'),_0x11226d);process[_0xb15c('0x24')](0x1);});}main();
\ No newline at end of file
+var _0x2e3b=['./config/schedule/cloud-provider','sync','then','default','listen','start','info','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','name','Online\x20apps:','map','online','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe'];(function(_0x36f066,_0x589ef4){var _0x1f04bd=function(_0x42964d){while(--_0x42964d){_0x36f066['push'](_0x36f066['shift']());}};_0x1f04bd(++_0x589ef4);}(_0x2e3b,0x81));var _0xb2e3=function(_0x37cb5a,_0x40533d){_0x37cb5a=_0x37cb5a-0x0;var _0x444171=_0x2e3b[_0x37cb5a];return _0x444171;};'use strict';var _=require('lodash');var db=require(_0xb2e3('0x0'))['db'];var seedDb=require(_0xb2e3('0x1'));var checkLicense=require(_0xb2e3('0x2'));var rpc=require(_0xb2e3('0x3'));var config=require(_0xb2e3('0x4'));var logger=require(_0xb2e3('0x5'))(_0xb2e3('0x6'));var pm2=require(_0xb2e3('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xb2e3('0x8'));var chat=require(_0xb2e3('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xb2e3('0xa'));var provider=require(_0xb2e3('0xb'));function main(){return db['sequelize'][_0xb2e3('0xc')]()[_0xb2e3('0xd')](function(){if(config['seedDB']){return seedDb[_0xb2e3('0xe')]();}})[_0xb2e3('0xd')](function(){return checkLicense[_0xb2e3('0xe')]();})[_0xb2e3('0xd')](function(){return rpc[_0xb2e3('0xf')]();})['then'](function(_0x146c29){logger['info'](_0x146c29);return chat[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return whatsapp[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return schedule[_0xb2e3('0x10')]();})[_0xb2e3('0xd')](function(){return transcribe[_0xb2e3('0x10')]();})['then'](function(){return provider['start']();})['then'](function(_0x3061ac){logger[_0xb2e3('0x11')](_0x3061ac);return pm2[_0xb2e3('0x10')](pm2Config);})[_0xb2e3('0xd')](function(_0x51e55b){var _0x312210=_0x51e55b[_0xb2e3('0x12')](function(_0x2f40ed){return typeof _0x2f40ed[_0xb2e3('0x13')]===_0xb2e3('0x14')&&_0x2f40ed[_0xb2e3('0x13')]>=0x0;});if(_0x312210[_0xb2e3('0x15')]>0x0){throw new Error(_0x312210[_0xb2e3('0x15')]+_0xb2e3('0x16')+_['map'](_0x312210,function(_0x5e10a9){return'\x22'+_0x5e10a9['pm2_env'][_0xb2e3('0x17')]+'\x22';}));}logger[_0xb2e3('0x11')](_0xb2e3('0x18'),_[_0xb2e3('0x19')](_[_0xb2e3('0x12')](_0x51e55b,{'status':_0xb2e3('0x1a')}),_0xb2e3('0x17'))['join']());logger[_0xb2e3('0x11')]('Offline\x20apps:',_[_0xb2e3('0x19')](_[_0xb2e3('0x12')](_0x51e55b,function(_0x101d96){return _0x101d96[_0xb2e3('0x1b')]!=='online';}),_0xb2e3('0x17'))['join']()||_0xb2e3('0x1c'));console[_0xb2e3('0x1d')](_0xb2e3('0x1e'));})[_0xb2e3('0x1f')](function(_0x59e4a4){console[_0xb2e3('0x1d')](_0xb2e3('0x20'),_0x59e4a4);logger[_0xb2e3('0x21')](_0xb2e3('0x22'),_0x59e4a4);process['exit'](0x1);});}main();
\ No newline at end of file
index 1518323..96e5bb7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5eb8=['Invalid\x20API\x20access\x20key','blockedAt','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','send','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','decryptString','length','splice','encryptString','join','promisify','sign','secret','payload','options','randomBytes','toString','hex','floor','now','HS512','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','util','moment','session','role','fullname','internal','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','hotdesk','interface','userProfileId','privacyEnabled','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','status','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','find','then','pass','json','Wrong\x20credentials.','apikey','getUuid','query','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore'];(function(_0x4c55a3,_0x5bdd07){var _0x5c5e9a=function(_0x33eea0){while(--_0x33eea0){_0x4c55a3['push'](_0x4c55a3['shift']());}};_0x5c5e9a(++_0x5bdd07);}(_0x5eb8,0xb0));var _0x85eb=function(_0x257841,_0x389b4d){_0x257841=_0x257841-0x0;var _0x1b87ed=_0x5eb8[_0x257841];return _0x1b87ed;};'use strict';var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var hardwareConf=require(_0x85eb('0x0'));var licenseUtil=require(_0x85eb('0x1'));var encryptor=require(_0x85eb('0x2'));var _=require(_0x85eb('0x3'));var jwt=require(_0x85eb('0x4'));var expressJwt=require(_0x85eb('0x5'));var compose=require(_0x85eb('0x6'));var basicAuth=require(_0x85eb('0x7'));var crypto=require(_0x85eb('0x8'));var BPromise=require(_0x85eb('0x9'));var util=require(_0x85eb('0xa'));var moment=require(_0x85eb('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x85eb('0xc')]});var userAttributes=['id',_0x85eb('0xd'),_0x85eb('0xe'),'name',_0x85eb('0xf'),'email',_0x85eb('0x10'),_0x85eb('0x11'),_0x85eb('0x12'),_0x85eb('0x13'),_0x85eb('0x14'),_0x85eb('0x15'),_0x85eb('0x16'),'smsPause',_0x85eb('0x17'),_0x85eb('0x18'),'showWebBar',_0x85eb('0x19'),_0x85eb('0x1a'),_0x85eb('0x1b'),_0x85eb('0x1c'),'passwordResetAt','alias',_0x85eb('0x1d'),'phoneBarAutoAnswerDelay',_0x85eb('0x1e'),_0x85eb('0x1f'),_0x85eb('0x20'),_0x85eb('0x21'),_0x85eb('0x22'),'phoneBarPrefixRequired',_0x85eb('0x23'),'phoneBarRemoteControlPort',_0x85eb('0x24'),_0x85eb('0x25'),_0x85eb('0x26'),_0x85eb('0x27'),'settingsEnabled','wssPort','downloadVoiceRecordings',_0x85eb('0x28'),_0x85eb('0x29'),_0x85eb('0x2a'),_0x85eb('0x2b'),_0x85eb('0x2c'),_0x85eb('0x2d'),'emailAutoanswer',_0x85eb('0x2e'),_0x85eb('0x2f'),_0x85eb('0x30'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay',_0x85eb('0x31'),_0x85eb('0x32'),_0x85eb('0x33')];exports[_0x85eb('0x34')]=function(){return this[_0x85eb('0x35')](!![])[_0x85eb('0x36')](function(_0x5c9895,_0x5491d5,_0x5b48d9){if(_0x5c9895[_0x85eb('0x37')]){_0x5b48d9();}else{return db[_0x85eb('0x38')][_0x85eb('0x39')]({'where':{'id':_0x5c9895[_0x85eb('0x3a')]['id']},'attributes':['id',_0x85eb('0x3b'),_0x85eb('0x3c')],'raw':!![]})['then'](function(_0x39d3fe){if(_0x39d3fe&&_0x39d3fe[_0x85eb('0x3b')]){return _0x5491d5[_0x85eb('0x3d')](_0x39d3fe[_0x85eb('0x3c')]===_0x85eb('0x3e')?0x195:0x193)['json']({'message':_0x39d3fe[_0x85eb('0x3c')]===_0x85eb('0x3e')?_0x85eb('0x3f'):_0x85eb('0x40')});}else{_0x5b48d9();}})[_0x85eb('0x41')](function(_0x29d262){_0x5b48d9(_0x29d262);});}});};exports['isAuthenticated']=function isAuthenticated(_0x562792){return compose()[_0x85eb('0x36')](function(_0x585f2a,_0xa9b14f,_0x5255eb){var _0x4229e9;if(_0x585f2a[_0x85eb('0x42')][_0x85eb('0x43')]){if(_[_0x85eb('0x44')](_0x585f2a[_0x85eb('0x42')][_0x85eb('0x43')],_0x85eb('0x45'))){var _0x5decd5=basicAuth(_0x585f2a);db[_0x85eb('0x46')][_0x85eb('0x47')]({'where':{'name':_0x5decd5['name']}})[_0x85eb('0x48')](function(_0x5af2de){if(!_0x5af2de||!_0x5af2de['authenticate'](_0x5decd5[_0x85eb('0x49')])){return _0xa9b14f[_0x85eb('0x3d')](0x191)[_0x85eb('0x4a')]({'message':_0x85eb('0x4b')});}_0x585f2a[_0x85eb('0x37')]={'id':_0x5af2de['id']};_0x5255eb();})[_0x85eb('0x41')](function(_0x39b574){_0x5255eb(_0x39b574);});}else if(_[_0x85eb('0x44')](_0x585f2a[_0x85eb('0x42')][_0x85eb('0x43')],'Bearer')){validateJwt(_0x585f2a,_0xa9b14f,_0x5255eb);}else{if(_0x562792){_0x5255eb();}else{return _0xa9b14f[_0x85eb('0x3d')](0x193)[_0x85eb('0x4a')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x585f2a['query'][_0x85eb('0x4c')]){try{var _0x13f245={'audience':hardwareConf[_0x85eb('0x4d')](),'issuer':hardwareConf[_0x85eb('0x4d')]()};verifyJwt(_0x585f2a[_0x85eb('0x4e')][_0x85eb('0x4c')],_0x13f245)[_0x85eb('0x48')](function(_0x35f092){return db[_0x85eb('0x46')][_0x85eb('0x47')]({'where':{'id':_0x35f092[_0x85eb('0x4f')]}})[_0x85eb('0x48')](function(_0x317d86){_0x4229e9=_0x317d86;return db[_0x85eb('0x50')]['findOne']({'where':{'id':0x1},'attributes':[_0x85eb('0x51'),_0x85eb('0x52')],'raw':!![]});})['then'](function(_0x5b77e5){if(!_0x4229e9||!_[_0x85eb('0x53')](_0x4229e9[_0x85eb('0x54')],_0x35f092['nonce'])){return _0xa9b14f[_0x85eb('0x3d')](0x191)['json']({'message':_0x85eb('0x55')});}if(_0x4229e9['disabled']){return _0xa9b14f[_0x85eb('0x3d')](0x191)['json']({'message':_0x85eb('0x56')});}if(_0x4229e9['blocked']){if(_0x5b77e5[_0x85eb('0x52')]>0x0){if(moment(_0x4229e9[_0x85eb('0x57')])['add'](_0x5b77e5[_0x85eb('0x52')],'minutes')>moment()){return _0xa9b14f[_0x85eb('0x3d')](0x191)[_0x85eb('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0xa9b14f[_0x85eb('0x3d')](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}_0x585f2a[_0x85eb('0x37')]={'id':_0x4229e9['id']};_0x5255eb();});})['catch'](function(){return _0xa9b14f[_0x85eb('0x3d')](0x191)[_0x85eb('0x4a')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x49a0cd){_0x5255eb(_0x49a0cd);}}else if(_0x562792){_0x5255eb();}else{return _0xa9b14f[_0x85eb('0x3d')](0x193)[_0x85eb('0x4a')]({'message':'Unknown\x20authorization\x20format'});}})['use'](function(_0x2864e2,_0x2d1b32,_0x2211f9){if(_0x2864e2[_0x85eb('0x37')]){db[_0x85eb('0x46')]['find']({'where':{'id':_0x2864e2[_0x85eb('0x37')]['id']},'attributes':userAttributes})[_0x85eb('0x48')](function(_0x208c27){if(!_0x208c27){return _0x2d1b32[_0x85eb('0x3d')](0x194)[_0x85eb('0x4a')]({'message':_0x85eb('0x58')});}_0x2864e2[_0x85eb('0x37')]=_0x208c27;_0x2211f9();})[_0x85eb('0x41')](function(_0x469639){_0x2211f9(_0x469639);});}else if(_0x562792){_0x2211f9();}else{return _0x2d1b32['status'](0x194)[_0x85eb('0x4a')]({'message':_0x85eb('0x59')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x85eb('0x36')](function(_0x201aed,_0x2dae5b,_0xecaacc){return licenseUtil[_0x85eb('0x5a')]()[_0x85eb('0x48')](function(_0x589cb1){if(_0x589cb1[_0x85eb('0x5b')]){_0xecaacc();}else{return _0x2dae5b[_0x85eb('0x3d')](0x193)[_0x85eb('0x4a')]({'message':_0x85eb('0x5c')});}})[_0x85eb('0x41')](function(_0x93e074){_0xecaacc(_0x93e074);});});};exports[_0x85eb('0x5d')]=function isWebrtcLicence(){return compose()[_0x85eb('0x36')](function(_0x5ed246,_0x1298d4,_0x26b226){return licenseUtil[_0x85eb('0x5a')]()[_0x85eb('0x48')](function(_0x154399){if(_0x154399[_0x85eb('0x5e')]){_0x26b226();}else{return _0x1298d4[_0x85eb('0x3d')](0x193)[_0x85eb('0x4a')]({'message':_0x85eb('0x5c')});}})[_0x85eb('0x41')](function(_0x32b20f){_0x26b226(_0x32b20f);});});};exports[_0x85eb('0x5f')]=function(_0x528f2b,_0x11da79,_0x2c951b){_0x528f2b[_0x85eb('0x5f')]=!![];return _0x2c951b();};exports['signToken']=function signToken(_0xb3b646){return signJwt(_0xb3b646);};exports[_0x85eb('0x60')]=function(_0x2cf928,_0xd2f302){if(!_0x2cf928[_0x85eb('0x37')]){return _0xd2f302['status'](0x194)[_0x85eb('0x4a')]({'message':_0x85eb('0x61')});}var _0x458e93={'payload':{'id':_0x2cf928['user']['id'],'role':_0x2cf928[_0x85eb('0x37')][_0x85eb('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x458e93)[_0x85eb('0x48')](function(_0x4c06ef){_0xd2f302['cookie'](_0x85eb('0x62'),_0x4c06ef);_0xd2f302['redirect']('/dashboards/general');})[_0x85eb('0x41')](function(_0x593723){return _0xd2f302[_0x85eb('0x3d')](0x1f4)[_0x85eb('0x63')](_0x593723);});};exports['retrieveApiKey']=function(_0x4abe5e){if(_[_0x85eb('0x64')](_0x4abe5e[_0x85eb('0x54')])||_[_0x85eb('0x64')](_0x4abe5e[_0x85eb('0x65')])){return null;}else{return createJwt(_0x4abe5e);}};exports[_0x85eb('0x66')]=function(_0x49cef1){_0x49cef1[_0x85eb('0x54')]=generateNonce();_0x49cef1[_0x85eb('0x65')]=generateIssuedAt();return createJwt(_0x49cef1);};exports[_0x85eb('0x67')]=function(_0x260afd,_0x1614dd){var _0x5318d3=_0x260afd[_0x85eb('0x4e')]['apikey'];if(_0x5318d3){var _0xd2e792={'nonce':_0x1614dd[_0x85eb('0x54')],'iat':_0x1614dd['apiKeyIat'],'audience':hardwareConf[_0x85eb('0x4d')](),'issuer':hardwareConf[_0x85eb('0x4d')]()};return verifyJwt(_0x5318d3,_0xd2e792)[_0x85eb('0x48')](function(){return generateApiKey(_0x1614dd);});}else{throw{'message':_0x85eb('0x68')};}};exports[_0x85eb('0x69')]=function(_0x130fe3){var _0x5a45a0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5a45a0[_0x85eb('0x6a')](_0x130fe3))throw new db['Sequelize'][(_0x85eb('0x6b'))](_0x85eb('0x6c'));return;};exports['validatePasswordHistory']=function(_0x152452,_0x2a0f8b,_0x4a3af9){var _0x41a957=encryptor['decryptString'](_0x2a0f8b)[_0x85eb('0x6d')](',');for(var _0x3f6985=0x0;_0x3f6985<_0x4a3af9;_0x3f6985++){if(!_0x41a957[_0x3f6985])break;if(_0x152452[_0x85eb('0x6e')]()===_0x41a957[_0x3f6985][_0x85eb('0x6e')]()){var _0x45a201=util[_0x85eb('0x6f')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x4a3af9);if(_0x4a3af9===0x1){_0x45a201=_0x85eb('0x70');}throw new db[(_0x85eb('0x71'))][(_0x85eb('0x6b'))](_0x45a201);}}return;};exports[_0x85eb('0x72')]=function(_0x18f739,_0x1529dd){var _0x2024df=_0x1529dd?encryptor[_0x85eb('0x73')](_0x1529dd)[_0x85eb('0x6d')](','):[];if(_0x2024df[_0x85eb('0x74')]===0x5){_0x2024df[_0x85eb('0x75')](-0x1,0x1);}_0x2024df['unshift'](_0x18f739);return encryptor[_0x85eb('0x76')](_0x2024df[_0x85eb('0x77')](','));};function signJwt(_0x46e5d3){var _0xdaf2fe=BPromise[_0x85eb('0x78')](jwt[_0x85eb('0x79')],{'context':jwt});var _0x512f67=_0x46e5d3[_0x85eb('0x7a')]||config['secrets'][_0x85eb('0xc')];return new BPromise(function(_0x36a85e,_0x453f88){_0xdaf2fe(_0x46e5d3[_0x85eb('0x7b')],_0x512f67,_0x46e5d3[_0x85eb('0x7c')])['then'](function(_0x243b9a){_0x36a85e(_0x243b9a);})[_0x85eb('0x41')](function(_0x2575b5){_0x453f88(_0x2575b5);});});}function verifyJwt(_0x2c40f8,_0x10af0e,_0x14cab8){var _0x23fcf9=BPromise[_0x85eb('0x78')](jwt['verify'],{'context':jwt});var _0x3b896a=_0x14cab8||config['secrets'][_0x85eb('0xc')];return new BPromise(function(_0x3ff0f9,_0x2ac293){_0x23fcf9(_0x2c40f8,_0x3b896a,_0x10af0e)[_0x85eb('0x48')](function(_0x259ee3){_0x3ff0f9(_0x259ee3);})['catch'](function(_0x34ecea){_0x2ac293(_0x34ecea);});});}function generateNonce(){return crypto[_0x85eb('0x7d')](0x10)[_0x85eb('0x7e')](_0x85eb('0x7f'));}function generateIssuedAt(){return Math[_0x85eb('0x80')](Date[_0x85eb('0x81')]()/0x3e8)['toString']();}function createJwt(_0x5f4113){var _0x204662={'payload':{'iat':_0x5f4113['apiKeyIat'],'nonce':_0x5f4113[_0x85eb('0x54')]},'options':{'algorithm':_0x85eb('0x82'),'subject':_0x5f4113['id'][_0x85eb('0x7e')](),'issuer':hardwareConf[_0x85eb('0x4d')](),'audience':hardwareConf[_0x85eb('0x4d')]()}};return signJwt(_0x204662)[_0x85eb('0x48')](function(_0x542098){return{'iat':_0x5f4113[_0x85eb('0x65')],'nonce':_0x5f4113[_0x85eb('0x54')],'token':_0x542098};});}
\ No newline at end of file
+var _0xf4f4=['isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','params','closed','disposition','then','status','unmanaged','json','Unmanaged.','catch','headers','authorization','User','find','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','query','sub','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','isNil','apiKeyIat','generateApiKey','regenerateApiKey','validatePasswordPattern','test','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','payload','promisify','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','basic-auth','bluebird','util','moment','secrets','session','role','fullname','name','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','alias','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification'];(function(_0x25d3d0,_0x1bd7f9){var _0x5d6c1f=function(_0x524dd6){while(--_0x524dd6){_0x25d3d0['push'](_0x25d3d0['shift']());}};_0x5d6c1f(++_0x1bd7f9);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x19bfc5,_0x54a988){_0x19bfc5=_0x19bfc5-0x0;var _0x38ebd2=_0xf4f4[_0x19bfc5];return _0x38ebd2;};'use strict';var db=require(_0x4f4f('0x0'))['db'];var config=require(_0x4f4f('0x1'));var hardwareConf=require('../../config/license/hardware');var licenseUtil=require(_0x4f4f('0x2'));var encryptor=require(_0x4f4f('0x3'));var _=require(_0x4f4f('0x4'));var jwt=require(_0x4f4f('0x5'));var expressJwt=require(_0x4f4f('0x6'));var compose=require('composable-middleware');var basicAuth=require(_0x4f4f('0x7'));var crypto=require('crypto');var BPromise=require(_0x4f4f('0x8'));var util=require(_0x4f4f('0x9'));var moment=require(_0x4f4f('0xa'));var validateJwt=expressJwt({'secret':config[_0x4f4f('0xb')][_0x4f4f('0xc')]});var userAttributes=['id',_0x4f4f('0xd'),_0x4f4f('0xe'),_0x4f4f('0xf'),'internal',_0x4f4f('0x10'),_0x4f4f('0x11'),_0x4f4f('0x12'),_0x4f4f('0x13'),_0x4f4f('0x14'),_0x4f4f('0x15'),_0x4f4f('0x16'),_0x4f4f('0x17'),'smsPause','openchannelPause',_0x4f4f('0x18'),_0x4f4f('0x19'),_0x4f4f('0x1a'),_0x4f4f('0x1b'),_0x4f4f('0x1c'),_0x4f4f('0x1d'),'passwordResetAt',_0x4f4f('0x1e'),'phoneBarAutoAnswer',_0x4f4f('0x1f'),_0x4f4f('0x20'),_0x4f4f('0x21'),_0x4f4f('0x22'),'phoneBarEnableSettings',_0x4f4f('0x23'),'phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort',_0x4f4f('0x24'),_0x4f4f('0x25'),_0x4f4f('0x26'),_0x4f4f('0x27'),_0x4f4f('0x28'),_0x4f4f('0x29'),_0x4f4f('0x2a'),_0x4f4f('0x2b'),_0x4f4f('0x2c'),_0x4f4f('0x2d'),_0x4f4f('0x2e'),_0x4f4f('0x2f'),'chatAutoanswerDelay',_0x4f4f('0x30'),_0x4f4f('0x31'),_0x4f4f('0x32'),_0x4f4f('0x33'),_0x4f4f('0x34'),_0x4f4f('0x35'),_0x4f4f('0x36'),_0x4f4f('0x37'),_0x4f4f('0x38'),_0x4f4f('0x39'),_0x4f4f('0x3a')];exports[_0x4f4f('0x3b')]=function(){return this[_0x4f4f('0x3c')](!![])[_0x4f4f('0x3d')](function(_0x5bda88,_0x4f7261,_0x525529){if(_0x5bda88[_0x4f4f('0x3e')]){_0x525529();}else{return db[_0x4f4f('0x3f')]['findOne']({'where':{'id':_0x5bda88[_0x4f4f('0x40')]['id']},'attributes':['id',_0x4f4f('0x41'),_0x4f4f('0x42')],'raw':!![]})[_0x4f4f('0x43')](function(_0x113ff7){if(_0x113ff7&&_0x113ff7[_0x4f4f('0x41')]){return _0x4f7261[_0x4f4f('0x44')](_0x113ff7['disposition']===_0x4f4f('0x45')?0x195:0x193)[_0x4f4f('0x46')]({'message':_0x113ff7[_0x4f4f('0x42')]===_0x4f4f('0x45')?_0x4f4f('0x47'):'Forbidden.'});}else{_0x525529();}})[_0x4f4f('0x48')](function(_0xaf3de1){_0x525529(_0xaf3de1);});}});};exports[_0x4f4f('0x3c')]=function isAuthenticated(_0x5deda9){return compose()['use'](function(_0x4c2490,_0x73b8bb,_0x5b4f6a){var _0x354266;if(_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')]){if(_['startsWith'](_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')],'Basic')){var _0x413b71=basicAuth(_0x4c2490);db[_0x4f4f('0x4b')][_0x4f4f('0x4c')]({'where':{'name':_0x413b71['name']}})[_0x4f4f('0x43')](function(_0x343c75){if(!_0x343c75||!_0x343c75['authenticate'](_0x413b71['pass'])){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x4d')});}_0x4c2490[_0x4f4f('0x3e')]={'id':_0x343c75['id']};_0x5b4f6a();})[_0x4f4f('0x48')](function(_0x8d0f53){_0x5b4f6a(_0x8d0f53);});}else if(_[_0x4f4f('0x4e')](_0x4c2490[_0x4f4f('0x49')][_0x4f4f('0x4a')],_0x4f4f('0x4f'))){validateJwt(_0x4c2490,_0x73b8bb,_0x5b4f6a);}else{if(_0x5deda9){_0x5b4f6a();}else{return _0x73b8bb['status'](0x193)['json']({'message':_0x4f4f('0x50')});}}}else if(_0x4c2490['query'][_0x4f4f('0x51')]){try{var _0x423c89={'audience':hardwareConf[_0x4f4f('0x52')](),'issuer':hardwareConf[_0x4f4f('0x52')]()};verifyJwt(_0x4c2490[_0x4f4f('0x53')][_0x4f4f('0x51')],_0x423c89)[_0x4f4f('0x43')](function(_0x24834a){return db[_0x4f4f('0x4b')][_0x4f4f('0x4c')]({'where':{'id':_0x24834a[_0x4f4f('0x54')]}})[_0x4f4f('0x43')](function(_0x492fac){_0x354266=_0x492fac;return db[_0x4f4f('0x55')][_0x4f4f('0x56')]({'where':{'id':0x1},'attributes':[_0x4f4f('0x57'),_0x4f4f('0x58')],'raw':!![]});})[_0x4f4f('0x43')](function(_0x34fe84){if(!_0x354266||!_[_0x4f4f('0x59')](_0x354266[_0x4f4f('0x5a')],_0x24834a[_0x4f4f('0x5b')])){return _0x73b8bb['status'](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5c')});}if(_0x354266[_0x4f4f('0x5d')]){return _0x73b8bb['status'](0x191)['json']({'message':_0x4f4f('0x5e')});}if(_0x354266[_0x4f4f('0x5f')]){if(_0x34fe84[_0x4f4f('0x58')]>0x0){if(moment(_0x354266[_0x4f4f('0x60')])[_0x4f4f('0x61')](_0x34fe84[_0x4f4f('0x58')],_0x4f4f('0x62'))>moment()){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5e')});}}else{return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x4c2490[_0x4f4f('0x3e')]={'id':_0x354266['id']};_0x5b4f6a();});})[_0x4f4f('0x48')](function(){return _0x73b8bb[_0x4f4f('0x44')](0x191)[_0x4f4f('0x46')]({'message':_0x4f4f('0x5e')});});}catch(_0x598d65){_0x5b4f6a(_0x598d65);}}else if(_0x5deda9){_0x5b4f6a();}else{return _0x73b8bb['status'](0x193)[_0x4f4f('0x46')]({'message':_0x4f4f('0x50')});}})[_0x4f4f('0x3d')](function(_0xa8f1a5,_0x4a4184,_0x1aaf2c){if(_0xa8f1a5['user']){db[_0x4f4f('0x4b')]['find']({'where':{'id':_0xa8f1a5['user']['id']},'attributes':userAttributes})[_0x4f4f('0x43')](function(_0x4f3a0f){if(!_0x4f3a0f){return _0x4a4184[_0x4f4f('0x44')](0x194)[_0x4f4f('0x46')]({'message':'User\x20not\x20found.'});}_0xa8f1a5[_0x4f4f('0x3e')]=_0x4f3a0f;_0x1aaf2c();})[_0x4f4f('0x48')](function(_0x4e782c){_0x1aaf2c(_0x4e782c);});}else if(_0x5deda9){_0x1aaf2c();}else{return _0x4a4184[_0x4f4f('0x44')](0x194)[_0x4f4f('0x46')]({'message':_0x4f4f('0x63')});}});};exports[_0x4f4f('0x64')]=function canUpdate(){return compose()[_0x4f4f('0x3d')](function(_0x62b468,_0xb0d1b2,_0x15f0a1){return licenseUtil[_0x4f4f('0x65')]()[_0x4f4f('0x43')](function(_0x475969){if(_0x475969[_0x4f4f('0x66')]){_0x15f0a1();}else{return _0xb0d1b2[_0x4f4f('0x44')](0x193)[_0x4f4f('0x46')]({'message':_0x4f4f('0x67')});}})['catch'](function(_0x636b63){_0x15f0a1(_0x636b63);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()['use'](function(_0x31349a,_0x4363c9,_0x5cf4da){return licenseUtil[_0x4f4f('0x65')]()[_0x4f4f('0x43')](function(_0xea9617){if(_0xea9617[_0x4f4f('0x68')]){_0x5cf4da();}else{return _0x4363c9[_0x4f4f('0x44')](0x193)['json']({'message':_0x4f4f('0x67')});}})[_0x4f4f('0x48')](function(_0x30674f){_0x5cf4da(_0x30674f);});});};exports[_0x4f4f('0x69')]=function(_0x196426,_0x433787,_0x29314b){_0x196426[_0x4f4f('0x69')]=!![];return _0x29314b();};exports[_0x4f4f('0x6a')]=function signToken(_0x540b3c){return signJwt(_0x540b3c);};exports[_0x4f4f('0x6b')]=function(_0xd3b763,_0x4b33a5){if(!_0xd3b763['user']){return _0x4b33a5['status'](0x194)[_0x4f4f('0x46')]({'message':_0x4f4f('0x6c')});}var _0x3a2ae3={'payload':{'id':_0xd3b763['user']['id'],'role':_0xd3b763[_0x4f4f('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x3a2ae3)[_0x4f4f('0x43')](function(_0x1c181e){_0x4b33a5[_0x4f4f('0x6d')](_0x4f4f('0x6e'),_0x1c181e);_0x4b33a5[_0x4f4f('0x6f')](_0x4f4f('0x70'));})[_0x4f4f('0x48')](function(_0x88054a){return _0x4b33a5[_0x4f4f('0x44')](0x1f4)['send'](_0x88054a);});};exports['retrieveApiKey']=function(_0x36cfcf){if(_[_0x4f4f('0x71')](_0x36cfcf['apiKeyNonce'])||_['isNil'](_0x36cfcf[_0x4f4f('0x72')])){return null;}else{return createJwt(_0x36cfcf);}};exports[_0x4f4f('0x73')]=function(_0x15fd73){_0x15fd73['apiKeyNonce']=generateNonce();_0x15fd73['apiKeyIat']=generateIssuedAt();return createJwt(_0x15fd73);};exports[_0x4f4f('0x74')]=function(_0x3205ef,_0x179998){var _0x3bd569=_0x3205ef[_0x4f4f('0x53')][_0x4f4f('0x51')];if(_0x3bd569){var _0xe66fc={'nonce':_0x179998[_0x4f4f('0x5a')],'iat':_0x179998[_0x4f4f('0x72')],'audience':hardwareConf[_0x4f4f('0x52')](),'issuer':hardwareConf[_0x4f4f('0x52')]()};return verifyJwt(_0x3bd569,_0xe66fc)['then'](function(){return generateApiKey(_0x179998);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0x4f4f('0x75')]=function(_0x136d83){var _0x161943=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x161943[_0x4f4f('0x76')](_0x136d83))throw new db['Sequelize'][(_0x4f4f('0x77'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x4f4f('0x78')]=function(_0x3f57c2,_0x1c6489,_0x4901f5){var _0x550342=encryptor[_0x4f4f('0x79')](_0x1c6489)[_0x4f4f('0x7a')](',');for(var _0x4f26af=0x0;_0x4f26af<_0x4901f5;_0x4f26af++){if(!_0x550342[_0x4f26af])break;if(_0x3f57c2[_0x4f4f('0x7b')]()===_0x550342[_0x4f26af][_0x4f4f('0x7b')]()){var _0x1d48fb=util['format'](_0x4f4f('0x7c'),_0x4901f5);if(_0x4901f5===0x1){_0x1d48fb=_0x4f4f('0x7d');}throw new db[(_0x4f4f('0x7e'))]['ValidationError'](_0x1d48fb);}}return;};exports[_0x4f4f('0x7f')]=function(_0x5418cd,_0x35701d){var _0x3b637d=_0x35701d?encryptor[_0x4f4f('0x79')](_0x35701d)[_0x4f4f('0x7a')](','):[];if(_0x3b637d[_0x4f4f('0x80')]===0x5){_0x3b637d[_0x4f4f('0x81')](-0x1,0x1);}_0x3b637d[_0x4f4f('0x82')](_0x5418cd);return encryptor[_0x4f4f('0x83')](_0x3b637d[_0x4f4f('0x84')](','));};function signJwt(_0x36f369){var _0x269e0d=BPromise['promisify'](jwt[_0x4f4f('0x85')],{'context':jwt});var _0x297c9c=_0x36f369[_0x4f4f('0x86')]||config['secrets'][_0x4f4f('0xc')];return new BPromise(function(_0x43908e,_0x151c75){_0x269e0d(_0x36f369[_0x4f4f('0x87')],_0x297c9c,_0x36f369['options'])[_0x4f4f('0x43')](function(_0x213163){_0x43908e(_0x213163);})[_0x4f4f('0x48')](function(_0x24928a){_0x151c75(_0x24928a);});});}function verifyJwt(_0x157af6,_0x5e2ef4,_0xe105e9){var _0x484ae2=BPromise[_0x4f4f('0x88')](jwt[_0x4f4f('0x89')],{'context':jwt});var _0x2da4ea=_0xe105e9||config[_0x4f4f('0xb')][_0x4f4f('0xc')];return new BPromise(function(_0x23366b,_0x4bbbf6){_0x484ae2(_0x157af6,_0x2da4ea,_0x5e2ef4)['then'](function(_0x15c86f){_0x23366b(_0x15c86f);})['catch'](function(_0x4252fa){_0x4bbbf6(_0x4252fa);});});}function generateNonce(){return crypto[_0x4f4f('0x8a')](0x10)[_0x4f4f('0x8b')](_0x4f4f('0x8c'));}function generateIssuedAt(){return Math[_0x4f4f('0x8d')](Date[_0x4f4f('0x8e')]()/0x3e8)[_0x4f4f('0x8b')]();}function createJwt(_0x346ebb){var _0x356224={'payload':{'iat':_0x346ebb[_0x4f4f('0x72')],'nonce':_0x346ebb[_0x4f4f('0x5a')]},'options':{'algorithm':'HS512','subject':_0x346ebb['id']['toString'](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x4f4f('0x52')]()}};return signJwt(_0x356224)[_0x4f4f('0x43')](function(_0x49c7c4){return{'iat':_0x346ebb[_0x4f4f('0x72')],'nonce':_0x346ebb[_0x4f4f('0x5a')],'token':_0x49c7c4};});}
\ No newline at end of file
index 5cc0bbe..763a196 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa742=['checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','cf_','map','CmCustomField','findOne','slice','all','length','type','lodash','./sql-utils','../../mysqldb','findAll','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','clause','tags','user','skip'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xa742,0xe4));var _0x2a74=function(_0x34229c,_0x11e474){_0x34229c=_0x34229c-0x0;var _0x2cd716=_0xa742[_0x34229c];return _0x2cd716;};'use strict';var _=require(_0x2a74('0x0'));var sqlUtils=require(_0x2a74('0x1'));var db=require(_0x2a74('0x2'))['db'];exports[_0x2a74('0x3')]=function(_0x14cf9b,_0x5dacbc,_0xc37c31,_0x320e36){var _0xb89e65={'count':0x0,'rows':[]};var _0x960588=sqlUtils['skipContactsQuery'](_0x5dacbc,_0x14cf9b);if(_0x960588){return Promise['resolve'](_0xb89e65);}var _0x50499a=sqlUtils[_0x2a74('0x4')]();var _0x5dbe9b={};var _0x58265b=![];var _0x3b8ffa=![];return Promise['resolve']()[_0x2a74('0x5')](function(){if(_0x14cf9b[_0x2a74('0x6')]){return sqlUtils[_0x2a74('0x7')](_0x14cf9b['search'],_0x320e36);}else{return sqlUtils[_0x2a74('0x8')](_0x14cf9b,_0x320e36);}})['then'](function(_0x3ea23d){_0x50499a[_0x2a74('0x9')](_0x3ea23d[_0x2a74('0xa')]);_0x50499a[_0x2a74('0x9')](_0x3ea23d[_0x2a74('0xb')]);_0x50499a[_0x2a74('0x9')](_0x3ea23d[_0x2a74('0xc')]);_0x50499a[_0x2a74('0x9')](_0x3ea23d['user'][_0x2a74('0xd')]);_0x5dbe9b=_0x3ea23d[_0x2a74('0xe')];_0x3b8ffa=_0x3ea23d[_0x2a74('0xf')][_0x2a74('0x10')];return sqlUtils[_0x2a74('0x11')](_0x5dacbc,_0x14cf9b,_0x3b8ffa);})[_0x2a74('0x5')](function(_0x46ef02){_0x50499a[_0x2a74('0x9')](_0x46ef02);var _0x325791=_0x14cf9b[_0x2a74('0x6')]?_0x5dbe9b[_0x2a74('0x12')]:_0x14cf9b['tag'];_0x58265b=_0x325791?!![]:![];return sqlUtils[_0x2a74('0x13')](_0x50499a,_0x325791);})[_0x2a74('0x5')](function(_0x16b593){_0xb89e65[_0x2a74('0x14')]=_0x16b593;if(_0xb89e65[_0x2a74('0x14')]===0x0){return;}if(_0x14cf9b[_0x2a74('0x15')]){_0x3b8ffa=!![];}return sqlUtils[_0x2a74('0x16')](_0x50499a,_0x14cf9b[_0x2a74('0xb')],_0xc37c31,_0x58265b,_0x5dbe9b[_0x2a74('0xd')],_0x3b8ffa);})[_0x2a74('0x5')](function(_0x36b234){if(!_0x36b234){return[];}return sqlUtils[_0x2a74('0x17')](_0x36b234,_0x14cf9b,_0xc37c31);})['then'](function(_0x4c3360){_0xb89e65[_0x2a74('0x18')]=_0x4c3360;return _0xb89e65;})[_0x2a74('0x19')](function(_0x353531){throw _0x353531;});};exports[_0x2a74('0x1a')]=function(){var _0x51d57b={};var _0x14fe1d=[];return db['CmContact'][_0x2a74('0x1a')]()[_0x2a74('0x5')](function(_0x406741){_0x51d57b=_0x406741;var _0xa0db5b=Object['keys'](_0x51d57b)['filter'](function(_0x12d618){return _['startsWith'](_0x12d618,_0x2a74('0x1b'))?_0x12d618:undefined;});var _0x312bbf=_0xa0db5b[_0x2a74('0x1c')](function(_0x13441d){return db[_0x2a74('0x1d')][_0x2a74('0x1e')]({'where':{'id':_0x13441d[_0x2a74('0x1f')](0x3)},'raw':!![]});});return Promise[_0x2a74('0x20')](_0x312bbf);})['then'](function(_0x1ef4d9){for(var _0x15522f=0x0;_0x15522f<_0x1ef4d9[_0x2a74('0x21')];_0x15522f++){if(_0x1ef4d9[_0x15522f]){var _0x1cb85e=_0x2a74('0x1b')+_0x1ef4d9[_0x15522f]['id'];_0x51d57b[_0x1cb85e]['fieldType']=_0x1ef4d9[_0x15522f]['type'];}}_0x14fe1d=_['map'](Object['keys'](_0x51d57b),function(_0x2c160b){return{'name':_0x2c160b,'type':_0x51d57b[_0x2c160b][_0x2a74('0x22')]};});return _0x14fe1d;})['catch'](function(_0xfe6800){throw _0xfe6800;});};
\ No newline at end of file
+var _0xdf01=['buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','keys','startsWith','cf_','CmCustomField','findOne','slice','all','length','fieldType','type','map','./sql-utils','../../mysqldb','skipContactsQuery','resolve','getContactsSubquery','then','search','parseQueryParameters','where','default','filter','clause','tags','user','skip','checkListsRestrictions','ids','tag','count'];(function(_0x38082b,_0x2a434e){var _0x5a76ff=function(_0x2e00b4){while(--_0x2e00b4){_0x38082b['push'](_0x38082b['shift']());}};_0x5a76ff(++_0x2a434e);}(_0xdf01,0xcb));var _0x1df0=function(_0x51b043,_0x1c2931){_0x51b043=_0x51b043-0x0;var _0x1ab4b9=_0xdf01[_0x51b043];return _0x1ab4b9;};'use strict';var _=require('lodash');var sqlUtils=require(_0x1df0('0x0'));var db=require(_0x1df0('0x1'))['db'];exports['findAll']=function(_0x1320c5,_0x2c1f5a,_0xd66c35,_0x4a0495){var _0x25fa25={'count':0x0,'rows':[]};var _0x452b9d=sqlUtils[_0x1df0('0x2')](_0x2c1f5a,_0x1320c5);if(_0x452b9d){return Promise[_0x1df0('0x3')](_0x25fa25);}var _0x3ba12f=sqlUtils[_0x1df0('0x4')]();var _0x2bd60f={};var _0x81421f=![];var _0x50b037=![];return Promise[_0x1df0('0x3')]()[_0x1df0('0x5')](function(){if(_0x1320c5[_0x1df0('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1320c5['search'],_0x4a0495);}else{return sqlUtils[_0x1df0('0x7')](_0x1320c5,_0x4a0495);}})[_0x1df0('0x5')](function(_0x2a20d3){_0x3ba12f[_0x1df0('0x8')](_0x2a20d3[_0x1df0('0x9')]);_0x3ba12f[_0x1df0('0x8')](_0x2a20d3['fields']);_0x3ba12f[_0x1df0('0x8')](_0x2a20d3[_0x1df0('0xa')]);_0x3ba12f[_0x1df0('0x8')](_0x2a20d3['user'][_0x1df0('0xb')]);_0x2bd60f=_0x2a20d3[_0x1df0('0xc')];_0x50b037=_0x2a20d3[_0x1df0('0xd')][_0x1df0('0xe')];return sqlUtils[_0x1df0('0xf')](_0x2c1f5a,_0x1320c5,_0x50b037);})['then'](function(_0x141972){_0x3ba12f[_0x1df0('0x8')](_0x141972);var _0x4f9188=_0x1320c5[_0x1df0('0x6')]?_0x2bd60f[_0x1df0('0x10')]:_0x1320c5[_0x1df0('0x11')];_0x81421f=_0x4f9188?!![]:![];return sqlUtils['countFilteredContacts'](_0x3ba12f,_0x4f9188);})[_0x1df0('0x5')](function(_0x33003b){_0x25fa25['count']=_0x33003b;if(_0x25fa25[_0x1df0('0x12')]===0x0){return;}if(_0x1320c5['User']){_0x50b037=!![];}return sqlUtils[_0x1df0('0x13')](_0x3ba12f,_0x1320c5[_0x1df0('0x14')],_0xd66c35,_0x81421f,_0x2bd60f[_0x1df0('0xb')],_0x50b037);})[_0x1df0('0x5')](function(_0x5b3877){if(!_0x5b3877){return[];}return sqlUtils[_0x1df0('0x15')](_0x5b3877,_0x1320c5,_0xd66c35);})[_0x1df0('0x5')](function(_0x3edb69){_0x25fa25[_0x1df0('0x16')]=_0x3edb69;return _0x25fa25;})[_0x1df0('0x17')](function(_0x1b87ab){throw _0x1b87ab;});};exports[_0x1df0('0x18')]=function(){var _0x9dd5bb={};var _0x281e14=[];return db[_0x1df0('0x19')][_0x1df0('0x18')]()[_0x1df0('0x5')](function(_0x46d9f7){_0x9dd5bb=_0x46d9f7;var _0x51b782=Object[_0x1df0('0x1a')](_0x9dd5bb)[_0x1df0('0xa')](function(_0x21dfa4){return _[_0x1df0('0x1b')](_0x21dfa4,_0x1df0('0x1c'))?_0x21dfa4:undefined;});var _0x44185a=_0x51b782['map'](function(_0x5dabf0){return db[_0x1df0('0x1d')][_0x1df0('0x1e')]({'where':{'id':_0x5dabf0[_0x1df0('0x1f')](0x3)},'raw':!![]});});return Promise[_0x1df0('0x20')](_0x44185a);})[_0x1df0('0x5')](function(_0x11fa8c){for(var _0x382040=0x0;_0x382040<_0x11fa8c[_0x1df0('0x21')];_0x382040++){if(_0x11fa8c[_0x382040]){var _0xfbc720=_0x1df0('0x1c')+_0x11fa8c[_0x382040]['id'];_0x9dd5bb[_0xfbc720][_0x1df0('0x22')]=_0x11fa8c[_0x382040][_0x1df0('0x23')];}}_0x281e14=_[_0x1df0('0x24')](Object[_0x1df0('0x1a')](_0x9dd5bb),function(_0x505ee2){return{'name':_0x505ee2,'type':_0x9dd5bb[_0x505ee2][_0x1df0('0x23')]};});return _0x281e14;})[_0x1df0('0x17')](function(_0x2add43){throw _0x2add43;});};
\ No newline at end of file
index 814f569..d3c58a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd5f=['fieldType','castTo','DATE','type','default','value','start','end','Tag','map','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','keys','some','name','compact','Contact','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','tag','filter','agent','getLists','c.ListId\x20IS\x20NULL','attributes','group','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','SELECT','CmContact','query','toString','clone','COUNT(*)','c.id','isEmpty','t.id\x20IN\x20?','Sequelize','QueryTypes','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','search','ListId','autocomplete','true','select','from','cm_contacts','where','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','deletedAt','TagIds','push','field','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','length','dateOfBirth'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbd5f,0xa7));var _0xfbd5=function(_0x25e722,_0x2bed5c){_0x25e722=_0x25e722-0x0;var _0x3a7d0c=_0xbd5f[_0x25e722];return _0x3a7d0c;};'use strict';var _=require(_0xfbd5('0x0'));var squel=require(_0xfbd5('0x1'));var as=require(_0xfbd5('0x2'));var qs=require(_0xfbd5('0x3'));var utils=require('../interaction/utils');var db=require(_0xfbd5('0x4'))['db'];function skipContactsQuery(_0x2f928b,_0x35803e){var _0x2d77fd=![];if(_0x2f928b[_0xfbd5('0x5')]==='agent'&&!_0x35803e[_0xfbd5('0x6')]&&!_0x35803e[_0xfbd5('0x7')]&&_0x35803e[_0xfbd5('0x8')]!==_0xfbd5('0x9')){_0x2d77fd=!![];}return _0x2d77fd;}function getContactsSubquery(){return squel[_0xfbd5('0xa')]()[_0xfbd5('0xb')](_0xfbd5('0xc'),'c')[_0xfbd5('0xd')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x124886,_0x51a4f1){var _0x18f184=_0x51a4f1?'c':_0xfbd5('0xe');_0x124886['left_join'](_0xfbd5('0xf'),'uc',_0xfbd5('0x10')+_0x18f184+_0xfbd5('0x11'))[_0xfbd5('0x12')](_0xfbd5('0x13'),'ct',_0xfbd5('0x14')+_0x18f184+_0xfbd5('0x11'))[_0xfbd5('0x12')]('tools_tags','t',_0xfbd5('0x15'));return _0x124886;}function addFieldsToQuery(_0x4743a1,_0x4e7f66,_0x5c9318,_0x3e405c,_0x5d9b45){var _0x28e82d=_0x5d9b45?'c':_0xfbd5('0xe');if(!_0x4e7f66){_0x4e7f66=['id',_0xfbd5('0x16'),_0xfbd5('0x17'),_0xfbd5('0x18'),_0xfbd5('0x19'),_0xfbd5('0x1a'),'email','ListId',_0xfbd5('0x1b'),_0xfbd5('0x1c'),'updatedAt',_0xfbd5('0x1d'),_0xfbd5('0x1e')];}else if(!_0x4e7f66['includes']('id')){_0x4e7f66[_0xfbd5('0x1f')]('id');}var _0x1b48c1=_0x5c9318&&_0x5d9b45||!_0x5c9318&&!_0x5d9b45;if(_0x3e405c){_0x1b48c1=_0x3e405c&&_0x5d9b45||!_0x3e405c&&!_0x5d9b45;}_0x4e7f66['forEach'](function(_0x1e40df){if(_0x1e40df==='TagIds'){if(_0x1b48c1){_0x4743a1[_0xfbd5('0x20')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1e40df);}else if(_0x5c9318||_0x3e405c){_0x4743a1['field'](_0x28e82d+'.'+_0x1e40df);}}else{_0x4743a1['field'](_0x28e82d+'.'+_0x1e40df);}});return _0x4743a1;}function getSqlClauses(){var _0x597432={'default':squel[_0xfbd5('0x21')](),'fields':squel[_0xfbd5('0x21')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xfbd5('0x21')](),'ids':null},'user':{'clause':squel[_0xfbd5('0x21')](),'skip':![]}};return _0x597432;}function parseTagParameter(_0x5bfd4b){var _0x131ebf=squel['expr']();if(_0x5bfd4b){var _0x205ced=utils[_0xfbd5('0x22')](_0x5bfd4b);_0x205ced[_0xfbd5('0x23')](function(_0x50cd59){_0x131ebf['or'](_0xfbd5('0x24'),'%,'+_0x50cd59+',%');});}return _0x131ebf;}function parseSearchFilter(_0x2310f7){var _0x1348ee=squel[_0xfbd5('0x21')]();if(_0x2310f7){var _0x40db8d=_0x2310f7[_0xfbd5('0x25')]('\x5c','\x5c\x5c')[_0xfbd5('0x25')](/'/g,'\x27\x27');if(_0x40db8d[_0xfbd5('0x26')]('\x20')['length']>0x1){_0x1348ee['or'](_0xfbd5('0x27'),qs[_0xfbd5('0x28')](_0x40db8d,!![]),null);}else{if(qs['isNumeric'](_0x40db8d)){_0x1348ee['or'](_0xfbd5('0x29'),_0x40db8d+'%');_0x1348ee['or'](_0xfbd5('0x2a'),_0x40db8d+'%');_0x1348ee['or'](_0xfbd5('0x2b'),_0x40db8d+'%');_0x1348ee['or'](_0xfbd5('0x2c'),_0x40db8d+'%');}else if(qs[_0xfbd5('0x2d')](_0x40db8d)){_0x1348ee['or']('c.email\x20LIKE\x20?',_0x40db8d+'%');}else{_0x1348ee['or']('c.firstName\x20LIKE\x20?','%'+_0x40db8d+'%');_0x1348ee['or'](_0xfbd5('0x2e'),'%'+_0x40db8d+'%');_0x1348ee['or'](_0xfbd5('0x2f'),'%'+_0x40db8d+'%');}}}return _0x1348ee;}function parseAdvancedSearchFilter(_0x3d2095,_0x285ee6){var _0x16591e=getSqlClauses();var _0x112f75=as[_0xfbd5('0x30')](_0x3d2095);var _0x4ed6d6=_0x112f75[_0xfbd5('0x31')];for(var _0x2d894d=0x0;_0x2d894d<_0x112f75[_0xfbd5('0x32')][_0xfbd5('0x33')];_0x2d894d++){var _0x332a79=_0x112f75[_0xfbd5('0x32')][_0x2d894d];var _0x287f16='c';var _0x20f8dd=_['find'](_0x285ee6,['name',_0x332a79[_0xfbd5('0x20')]]);if(_0x20f8dd){if(_0x332a79[_0xfbd5('0x20')]===_0xfbd5('0x34')||_0x20f8dd[_0xfbd5('0x35')]==='datetime'){_0x332a79[_0xfbd5('0x36')]=_0xfbd5('0x37');}var _0x543da3=as['buildExpression'](_0x287f16,_0x20f8dd[_0xfbd5('0x38')],_0x332a79);_0x16591e[_0xfbd5('0x39')][_0x4ed6d6](_0x543da3['text'],_0x543da3[_0xfbd5('0x3a')][_0xfbd5('0x3b')],_0x543da3['value'][_0xfbd5('0x3c')]);}else{if(_0x332a79['field']===_0xfbd5('0x3d')){var _0x31bbbc=_0x332a79[_0xfbd5('0x3a')][_0xfbd5('0x26')](',')[_0xfbd5('0x3e')](function(_0x10ed15){return Number(_0x10ed15);});var _0x4a8c87=parseTagParameter(_0x31bbbc);_0x16591e['tags'][_0xfbd5('0x3f')][_0xfbd5('0x40')](_0x4a8c87);_0x16591e['tags'][_0xfbd5('0x41')]=_0x31bbbc;}else if(_0x332a79[_0xfbd5('0x20')]===_0xfbd5('0x42')){_0x16591e[_0xfbd5('0x43')][_0xfbd5('0x3f')]['and'](_0xfbd5('0x44'),_0x332a79[_0xfbd5('0x3a')]);_0x16591e['user'][_0xfbd5('0x45')]=!![];}}}return _0x16591e;}function parseModelFields(_0x463552,_0xad23c2){var _0x76174d=squel[_0xfbd5('0x21')]();var _0x2bb988=_(_0x463552)[_0xfbd5('0x46')]()[_0xfbd5('0x3e')](function(_0x26677d){return _[_0xfbd5('0x47')](_0xad23c2,[_0xfbd5('0x48'),_0x26677d])?_0x26677d:undefined;})[_0xfbd5('0x49')]()[_0xfbd5('0x3a')]();if(_0x463552['Contact']){_0x2bb988['push'](_0xfbd5('0x4a'));}if(_0x463552['User']){_0x2bb988['push'](_0xfbd5('0x42'));}if(_0x2bb988[_0xfbd5('0x33')]>0x0){_0x2bb988['forEach'](function(_0x2b8aed){if(_0x2b8aed===_0xfbd5('0x7')){_0x76174d[_0xfbd5('0x40')](_0xfbd5('0x4b'),[]['concat'](_0x463552[_0x2b8aed]));}else if(_0x2b8aed===_0xfbd5('0x4a')){var _0x4eeabf='%'+_0x463552[_0x2b8aed]+'%';_0x76174d[_0xfbd5('0x40')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x4eeabf);}else if(_0x2b8aed===_0xfbd5('0x42')){_0x76174d[_0xfbd5('0x40')]('uc.UserId\x20=\x20?',_0x463552[_0x2b8aed]);}else{_0x76174d[_0xfbd5('0x40')]('c.'+_0x2b8aed+_0xfbd5('0x4c'),_0x463552[_0x2b8aed]);}});}return _0x76174d;}function parseQueryParameters(_0x234f16,_0x58d9dd){var _0x5e9b53=getSqlClauses();return Promise[_0xfbd5('0x4d')]()['then'](function(){return parseModelFields(_0x234f16,_0x58d9dd);})[_0xfbd5('0x4e')](function(_0x43e113){_0x5e9b53[_0xfbd5('0x4f')]['and'](_0x43e113);return parseTagParameter(_0x234f16[_0xfbd5('0x50')]);})['then'](function(_0x388874){_0x5e9b53['tags']['clause']['and'](_0x388874);return parseSearchFilter(_0x234f16[_0xfbd5('0x51')]);})[_0xfbd5('0x4e')](function(_0x393bbf){_0x5e9b53['filter']=_0x393bbf;return _0x5e9b53;});}function checkListsRestrictions(_0x479ffa,_0x236489,_0x209071){var _0x5bc59e=squel[_0xfbd5('0x21')]();return Promise[_0xfbd5('0x4d')]()['then'](function(){if(_0x236489[_0xfbd5('0x6')]&&_0x479ffa[_0xfbd5('0x5')]===_0xfbd5('0x52')&&!_0x209071){return _0x479ffa[_0xfbd5('0x53')]({'attributes':['id'],'raw':!![]});}})[_0xfbd5('0x4e')](function(_0x367529){if(_0x367529){if(_0x367529['length']===0x0){_0x5bc59e[_0xfbd5('0x40')](_0xfbd5('0x54'));}else{_0x5bc59e[_0xfbd5('0x40')]('c.ListId\x20IN\x20?',_[_0xfbd5('0x3e')](_0x367529,'id'));}}})[_0xfbd5('0x4e')](function(){return _0x5bc59e;});}function buildContactsQuery(_0x4be819,_0x575696,_0x4b55e0,_0x1143fb,_0x1ebebc,_0x181f54){if(_0x575696){_0x575696=_0x4b55e0[_0xfbd5('0x55')];}_0x4be819=addFieldsToQuery(_0x4be819,_0x575696,_0x1143fb,_0x181f54,!![]);var _0x1c15b9=squel['select']();_0x1c15b9=addFieldsToQuery(_0x1c15b9,_0x575696,_0x1143fb,_0x181f54,![]);if(_0x1143fb||_0x181f54){_0x4be819=applyJoinClauses(_0x4be819,!![]);_0x4be819[_0xfbd5('0x56')]('c.id');if(_0x4b55e0[_0xfbd5('0x57')]){_0x1c15b9[_0xfbd5('0x57')](_0x4b55e0[_0xfbd5('0x57')]);}if(_0x4b55e0[_0xfbd5('0x58')]){_0x1c15b9[_0xfbd5('0x58')](_0x4b55e0['offset']);}}else{_0x1c15b9=applyJoinClauses(_0x1c15b9,![]);_0x1c15b9['group'](_0xfbd5('0x59'));if(_0x4b55e0[_0xfbd5('0x57')]){_0x4be819[_0xfbd5('0x57')](_0x4b55e0[_0xfbd5('0x57')]);}if(_0x4b55e0[_0xfbd5('0x58')]){_0x4be819[_0xfbd5('0x58')](_0x4b55e0[_0xfbd5('0x58')]);}}_0x1c15b9[_0xfbd5('0x5a')](_0x1ebebc);if(_0x4b55e0['order']){_0x4b55e0['order'][_0xfbd5('0x23')](function(_0x162930){_0x4be819[_0xfbd5('0x5b')]('c.'+_0x162930[0x0],_0x162930[0x1]===_0xfbd5('0x5c')?![]:!![]);_0x1c15b9[_0xfbd5('0x5b')](_0xfbd5('0x5d')+_0x162930[0x0],_0x162930[0x1]===_0xfbd5('0x5c')?![]:!![]);});}_0x1c15b9['from'](_0x4be819,_0xfbd5('0xe'));return _0x1c15b9;}function getFilteredContacts(_0x49f78b){var _0x11a800=[];return db[_0xfbd5('0x3d')][_0xfbd5('0x5e')]({'attributes':['id',_0xfbd5('0x48'),_0xfbd5('0x5f')],'raw':!![]})[_0xfbd5('0x4e')](function(_0x34ced5){_0x11a800=_[_0xfbd5('0x60')](_0x34ced5,'id');var _0x3a117e={'type':db['Sequelize']['QueryTypes'][_0xfbd5('0x61')],'model':db[_0xfbd5('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0xfbd5('0x63')](_0x49f78b[_0xfbd5('0x64')](),_0x3a117e);})[_0xfbd5('0x4e')](function(_0x5034f1){_0x5034f1[_0xfbd5('0x23')](function(_0x3a6994){if(_0x3a6994['TagIds']){_0x3a6994['Tags']=[];_0x3a6994[_0xfbd5('0x1e')][_0xfbd5('0x26')](',')[_0xfbd5('0x23')](function(_0x2b6f16){_0x3a6994['Tags'][_0xfbd5('0x1f')](_0x11a800[_0x2b6f16]);});}delete _0x3a6994[_0xfbd5('0x1e')];});return _0x5034f1;});}function countFilteredContacts(_0x34ccdb,_0x815d45){var _0x619c73=_0x34ccdb[_0xfbd5('0x65')]();_0x619c73[_0xfbd5('0x20')](_0xfbd5('0x66'));_0x619c73=applyJoinClauses(_0x619c73,!![]);_0x34ccdb[_0xfbd5('0x56')](_0xfbd5('0x67'));var _0x192b67=utils['getSelectedTags'](_0x815d45);if(!_[_0xfbd5('0x68')](_0x192b67)){_0x619c73['where'](_0xfbd5('0x69'),_0x192b67);}var _0x367804={'type':db[_0xfbd5('0x6a')][_0xfbd5('0x6b')][_0xfbd5('0x61')],'raw':!![]};return db[_0xfbd5('0x6c')][_0xfbd5('0x63')](_0x619c73[_0xfbd5('0x64')](),_0x367804)[_0xfbd5('0x4e')](function(_0x50c0fb){return _0x50c0fb[0x0]['COUNT(*)'];});}module[_0xfbd5('0x6d')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery};
\ No newline at end of file
+var _0x57e2=['Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','map','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','filter','resolve','agent','getLists','attributes','c.id','limit','offset','subqry.id','having','DESC','order','subqry.','from','findAll','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','group','isEmpty','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','role','search','ListId','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','uc.CmContactId\x20=\x20','left_join','ct.CmContactId\x20=\x20','.id','firstName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','push','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','type','text','value','end'];(function(_0x5ab63e,_0xbede61){var _0x1366a2=function(_0x3e0083){while(--_0x3e0083){_0x5ab63e['push'](_0x5ab63e['shift']());}};_0x1366a2(++_0xbede61);}(_0x57e2,0x1ce));var _0x257e=function(_0x3f55b2,_0x38357b){_0x3f55b2=_0x3f55b2-0x0;var _0x24767b=_0x57e2[_0x3f55b2];return _0x24767b;};'use strict';var _=require(_0x257e('0x0'));var squel=require(_0x257e('0x1'));var as=require(_0x257e('0x2'));var qs=require(_0x257e('0x3'));var utils=require(_0x257e('0x4'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x2d4430,_0x49eb34){var _0x2d5169=![];if(_0x2d4430[_0x257e('0x5')]==='agent'&&!_0x49eb34[_0x257e('0x6')]&&!_0x49eb34[_0x257e('0x7')]&&_0x49eb34[_0x257e('0x8')]!==_0x257e('0x9')){_0x2d5169=!![];}return _0x2d5169;}function getContactsSubquery(){return squel[_0x257e('0xa')]()['from'](_0x257e('0xb'),'c')[_0x257e('0xc')](_0x257e('0xd'));}function applyJoinClauses(_0x1c110e,_0x34b7bd){var _0x4273ad=_0x34b7bd?'c':_0x257e('0xe');_0x1c110e['left_join']('cm_user_has_contacts','uc',_0x257e('0xf')+_0x4273ad+'.id')[_0x257e('0x10')]('cm_contact_has_tags','ct',_0x257e('0x11')+_0x4273ad+_0x257e('0x12'))[_0x257e('0x10')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x1c110e;}function addFieldsToQuery(_0x571ae2,_0xe1f7f9,_0x2d368c,_0x5c2bb8,_0x4ca42d){var _0x1d11d5=_0x4ca42d?'c':_0x257e('0xe');if(!_0xe1f7f9){_0xe1f7f9=['id',_0x257e('0x13'),'lastName',_0x257e('0x14'),_0x257e('0x15'),_0x257e('0x16'),'email',_0x257e('0x7'),_0x257e('0x17'),_0x257e('0x18'),_0x257e('0x19'),_0x257e('0x1a'),_0x257e('0x1b')];}else if(!_0xe1f7f9[_0x257e('0x1c')]('id')){_0xe1f7f9[_0x257e('0x1d')]('id');}var _0x30acc7=_0x2d368c&&_0x4ca42d||!_0x2d368c&&!_0x4ca42d;if(_0x5c2bb8){_0x30acc7=_0x5c2bb8&&_0x4ca42d||!_0x5c2bb8&&!_0x4ca42d;}_0xe1f7f9[_0x257e('0x1e')](function(_0x2e86ab){if(_0x2e86ab===_0x257e('0x1b')){if(_0x30acc7){_0x571ae2[_0x257e('0x1f')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x2e86ab);}else if(_0x2d368c||_0x5c2bb8){_0x571ae2['field'](_0x1d11d5+'.'+_0x2e86ab);}}else{_0x571ae2[_0x257e('0x1f')](_0x1d11d5+'.'+_0x2e86ab);}});return _0x571ae2;}function getSqlClauses(){var _0x269053={'default':squel[_0x257e('0x20')](),'fields':squel['expr'](),'filter':squel[_0x257e('0x20')](),'tags':{'clause':squel['expr'](),'ids':null},'user':{'clause':squel[_0x257e('0x20')](),'skip':![]}};return _0x269053;}function parseTagParameter(_0xeb1a77){var _0x2a95d9=squel[_0x257e('0x20')]();if(_0xeb1a77){var _0x3f9907=utils[_0x257e('0x21')](_0xeb1a77);_0x3f9907[_0x257e('0x1e')](function(_0x3a6c80){_0x2a95d9['or'](_0x257e('0x22'),'%,'+_0x3a6c80+',%');});}return _0x2a95d9;}function parseSearchFilter(_0x3505bd){var _0x240dea=squel[_0x257e('0x20')]();if(_0x3505bd){var _0x30ae40=_0x3505bd[_0x257e('0x23')]('\x5c','\x5c\x5c')[_0x257e('0x23')](/'/g,'\x27\x27');if(_0x30ae40[_0x257e('0x24')]('\x20')[_0x257e('0x25')]>0x1){_0x240dea['or'](_0x257e('0x26'),qs['getFullTextValue'](_0x30ae40,!![]),null);}else{if(qs[_0x257e('0x27')](_0x30ae40)){_0x240dea['or'](_0x257e('0x28'),_0x30ae40+'%');_0x240dea['or']('c.phone\x20LIKE\x20?',_0x30ae40+'%');_0x240dea['or'](_0x257e('0x29'),_0x30ae40+'%');_0x240dea['or'](_0x257e('0x2a'),_0x30ae40+'%');}else if(qs['isEmail'](_0x30ae40)){_0x240dea['or']('c.email\x20LIKE\x20?',_0x30ae40+'%');}else{_0x240dea['or']('c.firstName\x20LIKE\x20?','%'+_0x30ae40+'%');_0x240dea['or'](_0x257e('0x2b'),'%'+_0x30ae40+'%');_0x240dea['or'](_0x257e('0x2c'),'%'+_0x30ae40+'%');}}}return _0x240dea;}function parseAdvancedSearchFilter(_0x1c0594,_0x1ab054){var _0x180b87=getSqlClauses();var _0x88285f=as[_0x257e('0x2d')](_0x1c0594);var _0x478f00=_0x88285f[_0x257e('0x2e')];for(var _0x2fd003=0x0;_0x2fd003<_0x88285f['conditions'][_0x257e('0x25')];_0x2fd003++){var _0x1b94a4=_0x88285f[_0x257e('0x2f')][_0x2fd003];var _0x4d6f9a='c';var _0x12731f=_[_0x257e('0x30')](_0x1ab054,[_0x257e('0x31'),_0x1b94a4['field']]);if(_0x12731f){if(_0x1b94a4[_0x257e('0x1f')]===_0x257e('0x32')||_0x12731f[_0x257e('0x33')]===_0x257e('0x34')){_0x1b94a4['castTo']=_0x257e('0x35');}var _0x3715f1=as['buildExpression'](_0x4d6f9a,_0x12731f[_0x257e('0x36')],_0x1b94a4);_0x180b87['default'][_0x478f00](_0x3715f1[_0x257e('0x37')],_0x3715f1[_0x257e('0x38')]['start'],_0x3715f1['value'][_0x257e('0x39')]);}else{if(_0x1b94a4[_0x257e('0x1f')]===_0x257e('0x3a')){var _0x5c5c5a=_0x1b94a4['value'][_0x257e('0x24')](',')['map'](function(_0x2d794c){return Number(_0x2d794c);});var _0x4a3c74=parseTagParameter(_0x5c5c5a);_0x180b87[_0x257e('0x3b')][_0x257e('0x3c')][_0x257e('0x3d')](_0x4a3c74);_0x180b87[_0x257e('0x3b')][_0x257e('0x3e')]=_0x5c5c5a;}else if(_0x1b94a4[_0x257e('0x1f')]===_0x257e('0x3f')){_0x180b87[_0x257e('0x40')]['clause']['and'](_0x257e('0x41'),_0x1b94a4[_0x257e('0x38')]);_0x180b87[_0x257e('0x40')][_0x257e('0x42')]=!![];}}}return _0x180b87;}function parseModelFields(_0x31a0ad,_0x19467d){var _0x2f4902=squel['expr']();var _0x286ae9=_(_0x31a0ad)['keys']()[_0x257e('0x43')](function(_0x2d7a79){return _[_0x257e('0x44')](_0x19467d,[_0x257e('0x31'),_0x2d7a79])?_0x2d7a79:undefined;})[_0x257e('0x45')]()[_0x257e('0x38')]();if(_0x31a0ad[_0x257e('0x46')]){_0x286ae9[_0x257e('0x1d')]('Contact');}if(_0x31a0ad[_0x257e('0x3f')]){_0x286ae9[_0x257e('0x1d')](_0x257e('0x3f'));}if(_0x286ae9[_0x257e('0x25')]>0x0){_0x286ae9[_0x257e('0x1e')](function(_0x379b8d){if(_0x379b8d===_0x257e('0x7')){_0x2f4902[_0x257e('0x3d')](_0x257e('0x47'),[][_0x257e('0x48')](_0x31a0ad[_0x379b8d]));}else if(_0x379b8d==='Contact'){var _0x6c86e3='%'+_0x31a0ad[_0x379b8d]+'%';_0x2f4902['and'](_0x257e('0x49'),_0x6c86e3);}else if(_0x379b8d==='User'){_0x2f4902[_0x257e('0x3d')](_0x257e('0x41'),_0x31a0ad[_0x379b8d]);}else{_0x2f4902[_0x257e('0x3d')]('c.'+_0x379b8d+_0x257e('0x4a'),_0x31a0ad[_0x379b8d]);}});}return _0x2f4902;}function parseQueryParameters(_0x10d48c,_0x2afb4f){var _0x126ad0=getSqlClauses();return Promise['resolve']()[_0x257e('0x4b')](function(){return parseModelFields(_0x10d48c,_0x2afb4f);})[_0x257e('0x4b')](function(_0x1f4b10){_0x126ad0[_0x257e('0x4c')][_0x257e('0x3d')](_0x1f4b10);return parseTagParameter(_0x10d48c['tag']);})[_0x257e('0x4b')](function(_0x130bee){_0x126ad0[_0x257e('0x3b')][_0x257e('0x3c')][_0x257e('0x3d')](_0x130bee);return parseSearchFilter(_0x10d48c[_0x257e('0x4d')]);})['then'](function(_0x5850e2){_0x126ad0[_0x257e('0x4d')]=_0x5850e2;return _0x126ad0;});}function checkListsRestrictions(_0xb57a28,_0x2f5c4b,_0x42ae99){var _0xe75213=squel[_0x257e('0x20')]();return Promise[_0x257e('0x4e')]()['then'](function(){if(_0x2f5c4b[_0x257e('0x6')]&&_0xb57a28[_0x257e('0x5')]===_0x257e('0x4f')&&!_0x42ae99){return _0xb57a28[_0x257e('0x50')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xbb574a){if(_0xbb574a){if(_0xbb574a[_0x257e('0x25')]===0x0){_0xe75213['and']('c.ListId\x20IS\x20NULL');}else{_0xe75213[_0x257e('0x3d')](_0x257e('0x47'),_[_0x257e('0x43')](_0xbb574a,'id'));}}})[_0x257e('0x4b')](function(){return _0xe75213;});}function buildContactsQuery(_0x96047e,_0x4e0795,_0x3fcc23,_0x2fa8c1,_0xad8283,_0x4723f6){if(_0x4e0795){_0x4e0795=_0x3fcc23[_0x257e('0x51')];}_0x96047e=addFieldsToQuery(_0x96047e,_0x4e0795,_0x2fa8c1,_0x4723f6,!![]);var _0x5b0dc6=squel['select']();_0x5b0dc6=addFieldsToQuery(_0x5b0dc6,_0x4e0795,_0x2fa8c1,_0x4723f6,![]);if(_0x2fa8c1||_0x4723f6){_0x96047e=applyJoinClauses(_0x96047e,!![]);_0x96047e['group'](_0x257e('0x52'));if(_0x3fcc23['limit']){_0x5b0dc6['limit'](_0x3fcc23[_0x257e('0x53')]);}if(_0x3fcc23[_0x257e('0x54')]){_0x5b0dc6[_0x257e('0x54')](_0x3fcc23[_0x257e('0x54')]);}}else{_0x5b0dc6=applyJoinClauses(_0x5b0dc6,![]);_0x5b0dc6['group'](_0x257e('0x55'));if(_0x3fcc23[_0x257e('0x53')]){_0x96047e[_0x257e('0x53')](_0x3fcc23['limit']);}if(_0x3fcc23['offset']){_0x96047e[_0x257e('0x54')](_0x3fcc23[_0x257e('0x54')]);}}_0x5b0dc6[_0x257e('0x56')](_0xad8283);if(_0x3fcc23['order']){_0x3fcc23['order']['forEach'](function(_0x484d69){_0x96047e['order']('c.'+_0x484d69[0x0],_0x484d69[0x1]===_0x257e('0x57')?![]:!![]);_0x5b0dc6[_0x257e('0x58')](_0x257e('0x59')+_0x484d69[0x0],_0x484d69[0x1]===_0x257e('0x57')?![]:!![]);});}_0x5b0dc6[_0x257e('0x5a')](_0x96047e,_0x257e('0xe'));return _0x5b0dc6;}function getFilteredContacts(_0x592f2a){var _0x4f9247=[];return db[_0x257e('0x3a')][_0x257e('0x5b')]({'attributes':['id',_0x257e('0x31'),'color'],'raw':!![]})[_0x257e('0x4b')](function(_0xa4c2b2){_0x4f9247=_['keyBy'](_0xa4c2b2,'id');var _0x4de7a1={'type':db[_0x257e('0x5c')][_0x257e('0x5d')][_0x257e('0x5e')],'model':db[_0x257e('0x5f')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x257e('0x60')][_0x257e('0x61')](_0x592f2a[_0x257e('0x62')](),_0x4de7a1);})['then'](function(_0x2c520a){_0x2c520a['forEach'](function(_0x3baf72){if(_0x3baf72['TagIds']){_0x3baf72[_0x257e('0x63')]=[];_0x3baf72[_0x257e('0x1b')][_0x257e('0x24')](',')[_0x257e('0x1e')](function(_0x1b3f1e){_0x3baf72[_0x257e('0x63')][_0x257e('0x1d')](_0x4f9247[_0x1b3f1e]);});}delete _0x3baf72['TagIds'];});return _0x2c520a;});}function countFilteredContacts(_0x4b6943,_0x512ab6){var _0x3ae89d=_0x4b6943[_0x257e('0x64')]();_0x3ae89d[_0x257e('0x1f')](_0x257e('0x65'));_0x3ae89d=applyJoinClauses(_0x3ae89d,!![]);_0x4b6943[_0x257e('0x66')](_0x257e('0x52'));var _0x1f5ff7=utils[_0x257e('0x21')](_0x512ab6);if(!_[_0x257e('0x67')](_0x1f5ff7)){_0x3ae89d[_0x257e('0xc')]('t.id\x20IN\x20?',_0x1f5ff7);}var _0x11c261={'type':db[_0x257e('0x5c')][_0x257e('0x5d')]['SELECT'],'raw':!![]};return db[_0x257e('0x60')][_0x257e('0x61')](_0x3ae89d[_0x257e('0x62')](),_0x11c261)[_0x257e('0x4b')](function(_0x3df872){return _0x3df872[0x0][_0x257e('0x65')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery};
\ No newline at end of file
index 94534f4..b165a2e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f8b=['update','close','unlink','encryptString','utf8','base64','decryptString','secret','bluebird','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','join','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','binary','write','end','final','decryptFile','createDecipher'];(function(_0x2bdce3,_0x2e46d3){var _0x5c3e72=function(_0x2795b9){while(--_0x2795b9){_0x2bdce3['push'](_0x2bdce3['shift']());}};_0x5c3e72(++_0x2e46d3);}(_0x5f8b,0x173));var _0xb5f8=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x5f8b[_0x2aea9e];return _0x430b92;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xb5f8('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xb5f8('0x1'))(_0xb5f8('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xb5f8('0x3')]['session'],'algorithm':_0xb5f8('0x4')};const fileOptions={'algorithm':_0xb5f8('0x5')};if(config[_0xb5f8('0x6')]&&config[_0xb5f8('0x6')]['algorithm']){var isSupported=isAlgorithmSupported(config[_0xb5f8('0x6')]['algorithm']);if(isSupported){fileOptions['algorithm']=config['encrypt']['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xb5f8('0x7')](',\x20');logger['error'](config[_0xb5f8('0x6')][_0xb5f8('0x8')],_0xb5f8('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x2ea1d7){return AES_SUPPORTED_RX['test'](_0x2ea1d7);}function getSupportedCiphers(){return crypto[_0xb5f8('0xa')]()[_0xb5f8('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0xaf06ba){return getSupportedCiphers()[_0xb5f8('0xc')](_0xaf06ba)>-0x1;}function combineOptions(_0x29530d){var _0x488132={};for(var _0x54aa8a in fileOptions){if(fileOptions[_0xb5f8('0xd')](_0x54aa8a)){_0x488132[_0x54aa8a]=fileOptions[_0x54aa8a];}}if(_0x29530d){for(var _0x4e8bf7 in _0x29530d){if(_0x29530d['hasOwnProperty'](_0x4e8bf7)){_0x488132[_0x4e8bf7]=_0x29530d[_0x4e8bf7];}}}return _0x488132;}exports[_0xb5f8('0xe')]=function(_0x13999a,_0x110f65,_0x3accb0,_0x22a0f8){return new BPromise(function(_0x33d0eb,_0x4723a9){_0x22a0f8=combineOptions(_0x22a0f8);var _0x46b131=new Buffer(_0x3accb0);var _0x271921=fs[_0xb5f8('0xf')](_0x13999a);var _0x3b0a44=fs[_0xb5f8('0x10')](_0x110f65);var _0xea7a86=crypto[_0xb5f8('0x11')](_0x22a0f8['algorithm'],_0x46b131);_0x271921['on'](_0xb5f8('0x12'),function(_0x5d1e54){var _0x28d9d5=new Buffer(_0xea7a86['update'](_0x5d1e54),_0xb5f8('0x13'));_0x3b0a44[_0xb5f8('0x14')](_0x28d9d5);});_0x271921['on'](_0xb5f8('0x15'),function(){try{var _0x3a5346=new Buffer(_0xea7a86[_0xb5f8('0x16')](_0xb5f8('0x13')),_0xb5f8('0x13'));_0x3b0a44[_0xb5f8('0x14')](_0x3a5346);_0x3b0a44['end']();_0x3b0a44['on']('close',function(){return _0x33d0eb(_0x110f65);});}catch(_0x464175){fs['unlink'](_0x110f65);return _0x4723a9(_0x464175);}});});};exports[_0xb5f8('0x17')]=function(_0x3bf455,_0xb3b8a,_0x50cd99,_0x33db17){return new BPromise(function(_0x3751ec,_0x4b0b77){_0x33db17=combineOptions(_0x33db17);var _0x247f4e=new Buffer(_0x50cd99);var _0x323a04=fs[_0xb5f8('0xf')](_0x3bf455);var _0x11c61e=fs[_0xb5f8('0x10')](_0xb3b8a);var _0x4047c2=crypto[_0xb5f8('0x18')](_0x33db17[_0xb5f8('0x8')],_0x247f4e);_0x323a04['on'](_0xb5f8('0x12'),function(_0xa9664d){var _0x3368f5=new Buffer(_0x4047c2[_0xb5f8('0x19')](_0xa9664d),_0xb5f8('0x13'));_0x11c61e[_0xb5f8('0x14')](_0x3368f5);});_0x323a04['on'](_0xb5f8('0x15'),function(){try{var _0x304ba0=new Buffer(_0x4047c2[_0xb5f8('0x16')](_0xb5f8('0x13')),_0xb5f8('0x13'));_0x11c61e[_0xb5f8('0x14')](_0x304ba0);_0x11c61e[_0xb5f8('0x15')]();_0x11c61e['on'](_0xb5f8('0x1a'),function(){return _0x3751ec(_0xb3b8a);});}catch(_0x55a9f1){fs[_0xb5f8('0x1b')](_0xb3b8a);return _0x4b0b77(_0x55a9f1);}});});};exports[_0xb5f8('0x1c')]=function(_0x6a00bc,_0x3019d4,_0x5035f9){var _0x4595ee=_0x5035f9||stringOptions[_0xb5f8('0x8')];var _0x1e6cd5=_0x3019d4||stringOptions['secret'];var _0x1f45d0=crypto['createCipher'](_0x4595ee,_0x1e6cd5);var _0x349f56=_0x1f45d0[_0xb5f8('0x19')](_0x6a00bc,_0xb5f8('0x1d'),_0xb5f8('0x1e'));_0x349f56+=_0x1f45d0[_0xb5f8('0x16')](_0xb5f8('0x1e'));return _0x349f56;};exports[_0xb5f8('0x1f')]=function(_0x1378bf,_0x5121dc,_0x4b46da){var _0x515e82=_0x4b46da||stringOptions[_0xb5f8('0x8')];var _0x5e6d95=_0x5121dc||stringOptions[_0xb5f8('0x20')];var _0x5847cb=crypto[_0xb5f8('0x18')](_0x515e82,_0x5e6d95);var _0x4a5f69=_0x5847cb['update'](_0x1378bf,'base64','utf8');_0x4a5f69+=_0x5847cb['final'](_0xb5f8('0x1d'));return _0x4a5f69;};
\ No newline at end of file
+var _0x4f17=['lodash','../../config/environment','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','binary','end','final','write','unlink','decryptFile','createDecipher','data','update','encryptString','secret','utf8','base64','crypto','bluebird'];(function(_0x1f0679,_0x53d43c){var _0x3dc3a4=function(_0x49ba8f){while(--_0x49ba8f){_0x1f0679['push'](_0x1f0679['shift']());}};_0x3dc3a4(++_0x53d43c);}(_0x4f17,0xa3));var _0x74f1=function(_0x673722,_0x275d7e){_0x673722=_0x673722-0x0;var _0x21249c=_0x4f17[_0x673722];return _0x21249c;};'use strict';var crypto=require(_0x74f1('0x0'));var fs=require('fs');var BPromise=require(_0x74f1('0x1'));var _=require(_0x74f1('0x2'));var config=require(_0x74f1('0x3'));var logger=require('../../config/logger')(_0x74f1('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x74f1('0x5')]['session'],'algorithm':_0x74f1('0x6')};const fileOptions={'algorithm':_0x74f1('0x7')};if(config[_0x74f1('0x8')]&&config[_0x74f1('0x8')][_0x74f1('0x9')]){var isSupported=isAlgorithmSupported(config[_0x74f1('0x8')][_0x74f1('0x9')]);if(isSupported){fileOptions[_0x74f1('0x9')]=config[_0x74f1('0x8')][_0x74f1('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x74f1('0xa')](',\x20');logger[_0x74f1('0xb')](config[_0x74f1('0x8')]['algorithm'],_0x74f1('0xc'),supportedAlgorithms);}}function isASupportedCipher(_0x2004d8){return AES_SUPPORTED_RX['test'](_0x2004d8);}function getSupportedCiphers(){return crypto[_0x74f1('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x18ec6e){return getSupportedCiphers()[_0x74f1('0xe')](_0x18ec6e)>-0x1;}function combineOptions(_0x26a42f){var _0x18b76f={};for(var _0xa1696c in fileOptions){if(fileOptions[_0x74f1('0xf')](_0xa1696c)){_0x18b76f[_0xa1696c]=fileOptions[_0xa1696c];}}if(_0x26a42f){for(var _0x25852b in _0x26a42f){if(_0x26a42f[_0x74f1('0xf')](_0x25852b)){_0x18b76f[_0x25852b]=_0x26a42f[_0x25852b];}}}return _0x18b76f;}exports[_0x74f1('0x10')]=function(_0x3fab8e,_0x2241aa,_0x4a7be8,_0x1cad80){return new BPromise(function(_0x3b261c,_0x1e6bf8){_0x1cad80=combineOptions(_0x1cad80);var _0x4f284a=new Buffer(_0x4a7be8);var _0x49f5b4=fs[_0x74f1('0x11')](_0x3fab8e);var _0x530fa2=fs[_0x74f1('0x12')](_0x2241aa);var _0x1d69ad=crypto[_0x74f1('0x13')](_0x1cad80['algorithm'],_0x4f284a);_0x49f5b4['on']('data',function(_0x45c84b){var _0x3d8381=new Buffer(_0x1d69ad['update'](_0x45c84b),_0x74f1('0x14'));_0x530fa2['write'](_0x3d8381);});_0x49f5b4['on'](_0x74f1('0x15'),function(){try{var _0x39247c=new Buffer(_0x1d69ad[_0x74f1('0x16')](_0x74f1('0x14')),_0x74f1('0x14'));_0x530fa2[_0x74f1('0x17')](_0x39247c);_0x530fa2[_0x74f1('0x15')]();_0x530fa2['on']('close',function(){return _0x3b261c(_0x2241aa);});}catch(_0x26bc1a){fs[_0x74f1('0x18')](_0x2241aa);return _0x1e6bf8(_0x26bc1a);}});});};exports[_0x74f1('0x19')]=function(_0x11ecb,_0x118026,_0x17cbd4,_0x4c99d5){return new BPromise(function(_0x38dc22,_0x44467d){_0x4c99d5=combineOptions(_0x4c99d5);var _0x2b195e=new Buffer(_0x17cbd4);var _0x3948c2=fs[_0x74f1('0x11')](_0x11ecb);var _0x16ccc0=fs[_0x74f1('0x12')](_0x118026);var _0x3af566=crypto[_0x74f1('0x1a')](_0x4c99d5['algorithm'],_0x2b195e);_0x3948c2['on'](_0x74f1('0x1b'),function(_0x24cf21){var _0x170953=new Buffer(_0x3af566[_0x74f1('0x1c')](_0x24cf21),'binary');_0x16ccc0[_0x74f1('0x17')](_0x170953);});_0x3948c2['on'](_0x74f1('0x15'),function(){try{var _0x520ea3=new Buffer(_0x3af566['final'](_0x74f1('0x14')),_0x74f1('0x14'));_0x16ccc0[_0x74f1('0x17')](_0x520ea3);_0x16ccc0['end']();_0x16ccc0['on']('close',function(){return _0x38dc22(_0x118026);});}catch(_0x2de12b){fs['unlink'](_0x118026);return _0x44467d(_0x2de12b);}});});};exports[_0x74f1('0x1d')]=function(_0x4c8955,_0x32d0ad,_0xd1f523){var _0x255d5e=_0xd1f523||stringOptions['algorithm'];var _0x5a3718=_0x32d0ad||stringOptions[_0x74f1('0x1e')];var _0x41cc85=crypto['createCipher'](_0x255d5e,_0x5a3718);var _0x109bd5=_0x41cc85[_0x74f1('0x1c')](_0x4c8955,_0x74f1('0x1f'),'base64');_0x109bd5+=_0x41cc85['final'](_0x74f1('0x20'));return _0x109bd5;};exports['decryptString']=function(_0x1c691b,_0x32dd4c,_0x37e81f){var _0x294aac=_0x37e81f||stringOptions[_0x74f1('0x9')];var _0x490138=_0x32dd4c||stringOptions[_0x74f1('0x1e')];var _0x1d1e4f=crypto[_0x74f1('0x1a')](_0x294aac,_0x490138);var _0x2bec3d=_0x1d1e4f[_0x74f1('0x1c')](_0x1c691b,_0x74f1('0x20'),_0x74f1('0x1f'));_0x2bec3d+=_0x1d1e4f['final']('utf8');return _0x2bec3d;};
\ No newline at end of file
index 71beb64..7700729 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x13d5=['bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','join','each','%s%d.%s','csv','writeFileSync','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','exit','util','lodash'];(function(_0x31946d,_0x29f0ce){var _0x327778=function(_0xa2557b){while(--_0xa2557b){_0x31946d['push'](_0x31946d['shift']());}};_0x327778(++_0x29f0ce);}(_0x13d5,0x1e8));var _0x513d=function(_0x472bbc,_0x16326b){_0x472bbc=_0x472bbc-0x0;var _0x1f7cdc=_0x13d5[_0x472bbc];return _0x1f7cdc;};'use strict';var util=require(_0x513d('0x0'));var path=require('path');var _=require(_0x513d('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x513d('0x2'));var zipdir=require(_0x513d('0x3'));var rimraf=require(_0x513d('0x4'));var db=require(_0x513d('0x5'))['db'];var dbH=require(_0x513d('0x5'))[_0x513d('0x6')];var logger=require(_0x513d('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x513d('0x8')][0x2]);var QUERY=process[_0x513d('0x8')][0x3];var PATH=process[_0x513d('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5a1f9c,_0x56f831){var _0x2a4fd6={'status':_0x5a1f9c};var _0x15f590={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x56f831){_0x2a4fd6[_0x513d('0x9')]=_0x56f831;}return db[_0x513d('0xa')][_0x513d('0xb')](_0x2a4fd6,_0x15f590);}function main(){var _0x13e1fe=0x1388;var _0x21f70;logger[_0x513d('0xc')](util[_0x513d('0xd')](_0x513d('0xe'),EXTRACTED_REPORT_ID,_0x513d('0xf')));return db[_0x513d('0x10')][_0x513d('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x513d('0x12'),_0x513d('0x13')]})[_0x513d('0x14')](function(_0x28e528){if(_0x28e528){_0x21f70=_0x28e528;_0x13e1fe=_0x21f70[_0x513d('0x13')]||0x1388;}})[_0x513d('0x14')](function(){return dbH[_0x513d('0x15')][_0x513d('0x16')](util[_0x513d('0xd')](_0x513d('0x17'),QUERY),{'type':dbH[_0x513d('0x15')][_0x513d('0x18')][_0x513d('0x19')]});})[_0x513d('0x14')](function(_0x56e545){if(!_0x56e545[0x0][_0x513d('0x1a')]){return analyticExtractedReport('Empty');}var _0x414d12=[];var _0x54fdcc=0x0;if(_0x21f70[_0x513d('0x12')]){if(_0x56e545&&_0x56e545[_0x513d('0x1b')]){var _0x2cf5bf=_[_0x513d('0x1c')](_0x56e545[0x0][_0x513d('0x1a')]/_0x13e1fe);var _0x139cf8=Number[_0x513d('0x1d')](_0x56e545[0x0][_0x513d('0x1a')]/_0x13e1fe)?_0x56e545[0x0][_0x513d('0x1a')]%_0x13e1fe:0x0;_0x2cf5bf[_0x513d('0x1e')](function(_0x4cd453){if(_0x4cd453>0x0){_0x54fdcc+=_0x13e1fe;}_0x414d12[_0x513d('0x1f')](dbH[_0x513d('0x15')][_0x513d('0x16')](util['format'](_0x513d('0x20'),QUERY,_0x13e1fe,_0x54fdcc),{'type':dbH['sequelize'][_0x513d('0x18')]['SELECT']}));});if(_0x139cf8>0x0){_0x54fdcc+=_0x13e1fe;_0x414d12[_0x513d('0x1f')](dbH[_0x513d('0x15')][_0x513d('0x16')](util[_0x513d('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x139cf8,_0x54fdcc),{'type':dbH[_0x513d('0x15')]['QueryTypes'][_0x513d('0x19')]}));}}}else{_0x414d12[_0x513d('0x1f')](dbH[_0x513d('0x15')]['query'](QUERY,{'type':dbH[_0x513d('0x15')]['QueryTypes'][_0x513d('0x19')]}));}var _0x3d0d0a=path[_0x513d('0x21')](PATH);var _0x399597=path[_0x513d('0x22')](PATH,'.csv');var _0x5a2c98=_0x21f70[_0x513d('0x12')]&&_0x414d12[_0x513d('0x1b')]>0x1;var _0x51716e=[];if(!fs['existsSync'](path[_0x513d('0x23')](_0x3d0d0a,_0x399597))&&_0x5a2c98){fs['mkdirSync'](path[_0x513d('0x23')](_0x3d0d0a,_0x399597));}return BPromise[_0x513d('0x24')](_0x414d12,function(_0x70a2b4){_0x51716e[_0x513d('0x1f')](_0x70a2b4);})[_0x513d('0x14')](function(){for(var _0x574621=0x0;_0x574621<_0x51716e[_0x513d('0x1b')];_0x574621+=0x1){var _0x49b85f;var _0x56fe4d=_0x51716e[_0x574621];if(_0x5a2c98){_0x49b85f=path[_0x513d('0x23')](_0x3d0d0a,_0x399597,util[_0x513d('0xd')](_0x513d('0x25'),_0x399597,_0x574621,_0x513d('0x26')));}else{_0x49b85f=path[_0x513d('0x23')](_0x3d0d0a,util[_0x513d('0xd')]('%s.%s',_0x399597,_0x513d('0x26')));}fs[_0x513d('0x27')](_0x49b85f,csv(_0x56fe4d));}})[_0x513d('0x14')](function(){if(_0x5a2c98){return new Promise(function(_0x4aa3f6){zipdir(path[_0x513d('0x23')](_0x3d0d0a,_0x399597),{'saveTo':path[_0x513d('0x23')](_0x3d0d0a,util['format'](_0x513d('0x28'),_0x399597,'zip'))},function(_0x1d0a47,_0x357c5b){rimraf(path[_0x513d('0x23')](_0x3d0d0a,_0x399597),function(){});_0x4aa3f6(_0x513d('0x29'));});});}})[_0x513d('0x14')](function(){logger[_0x513d('0xc')](util[_0x513d('0xd')](_0x513d('0x2a'),EXTRACTED_REPORT_ID,_0x513d('0xf')));return analyticExtractedReport(_0x513d('0x2b'),_0x5a2c98?util[_0x513d('0xd')](_0x513d('0x28'),_0x399597,_0x5a2c98?_0x513d('0x2c'):_0x513d('0x26')):null);});})[_0x513d('0x2d')](function(_0x3d7f36){logger[_0x513d('0xc')](util[_0x513d('0xd')](_0x513d('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0x513d('0x2f')](_0x3d7f36,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x513d('0x30')](EXIT_CODE);});}main();
\ No newline at end of file
+var _0xaedf=['analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','QueryTypes','SELECT','num','Empty','length','forEach','format','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','path','lodash','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger'];(function(_0x31e742,_0x40530f){var _0x5fc6bb=function(_0xf0f5ca){while(--_0xf0f5ca){_0x31e742['push'](_0x31e742['shift']());}};_0x5fc6bb(++_0x40530f);}(_0xaedf,0x156));var _0xfaed=function(_0x177cc4,_0x510867){_0x177cc4=_0x177cc4-0x0;var _0x4cb1fe=_0xaedf[_0x177cc4];return _0x4cb1fe;};'use strict';var util=require('util');var path=require(_0xfaed('0x0'));var _=require(_0xfaed('0x1'));var csv=require(_0xfaed('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xfaed('0x3'));var rimraf=require(_0xfaed('0x4'));var db=require(_0xfaed('0x5'))['db'];var dbH=require(_0xfaed('0x5'))[_0xfaed('0x6')];var logger=require(_0xfaed('0x7'))(_0xfaed('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xfaed('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1b0445,_0x2f1453){var _0x5a40b0={'status':_0x1b0445};var _0x2ef046={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2f1453){_0x5a40b0[_0xfaed('0xa')]=_0x2f1453;}return db[_0xfaed('0xb')][_0xfaed('0xc')](_0x5a40b0,_0x2ef046);}function main(){var _0x313794=0x1388;var _0x43d18e;logger['info'](util['format'](_0xfaed('0xd'),EXTRACTED_REPORT_ID,_0xfaed('0xe')));return db[_0xfaed('0xf')][_0xfaed('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xfaed('0x11'),_0xfaed('0x12')]})['then'](function(_0x4cba47){if(_0x4cba47){_0x43d18e=_0x4cba47;_0x313794=_0x43d18e[_0xfaed('0x12')]||0x1388;}})[_0xfaed('0x13')](function(){return dbH[_0xfaed('0x14')][_0xfaed('0x15')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xfaed('0x14')][_0xfaed('0x16')][_0xfaed('0x17')]});})[_0xfaed('0x13')](function(_0x216f13){if(!_0x216f13[0x0][_0xfaed('0x18')]){return analyticExtractedReport(_0xfaed('0x19'));}var _0x41a928=[];var _0x34b390=0x0;if(_0x43d18e['split']){if(_0x216f13&&_0x216f13[_0xfaed('0x1a')]){var _0x1fb2e0=_['range'](_0x216f13[0x0][_0xfaed('0x18')]/_0x313794);var _0x34d115=Number['isInteger'](_0x216f13[0x0][_0xfaed('0x18')]/_0x313794)?_0x216f13[0x0]['num']%_0x313794:0x0;_0x1fb2e0[_0xfaed('0x1b')](function(_0x3f281b){if(_0x3f281b>0x0){_0x34b390+=_0x313794;}_0x41a928['push'](dbH[_0xfaed('0x14')]['query'](util[_0xfaed('0x1c')](_0xfaed('0x1d'),QUERY,_0x313794,_0x34b390),{'type':dbH[_0xfaed('0x14')][_0xfaed('0x16')][_0xfaed('0x17')]}));});if(_0x34d115>0x0){_0x34b390+=_0x313794;_0x41a928[_0xfaed('0x1e')](dbH[_0xfaed('0x14')][_0xfaed('0x15')](util[_0xfaed('0x1c')](_0xfaed('0x1d'),QUERY,_0x34d115,_0x34b390),{'type':dbH[_0xfaed('0x14')][_0xfaed('0x16')][_0xfaed('0x17')]}));}}}else{_0x41a928[_0xfaed('0x1e')](dbH['sequelize'][_0xfaed('0x15')](QUERY,{'type':dbH[_0xfaed('0x14')]['QueryTypes'][_0xfaed('0x17')]}));}var _0x556821=path[_0xfaed('0x1f')](PATH);var _0x5d1011=path[_0xfaed('0x20')](PATH,_0xfaed('0x21'));var _0x39d72e=_0x43d18e['split']&&_0x41a928[_0xfaed('0x1a')]>0x1;var _0x41fd24=[];if(!fs[_0xfaed('0x22')](path[_0xfaed('0x23')](_0x556821,_0x5d1011))&&_0x39d72e){fs[_0xfaed('0x24')](path['join'](_0x556821,_0x5d1011));}return BPromise[_0xfaed('0x25')](_0x41a928,function(_0x2360c4){_0x41fd24[_0xfaed('0x1e')](_0x2360c4);})[_0xfaed('0x13')](function(){for(var _0xff3b38=0x0;_0xff3b38<_0x41fd24[_0xfaed('0x1a')];_0xff3b38+=0x1){var _0x5f70e1;var _0x4ff344=_0x41fd24[_0xff3b38];if(_0x39d72e){_0x5f70e1=path[_0xfaed('0x23')](_0x556821,_0x5d1011,util[_0xfaed('0x1c')]('%s%d.%s',_0x5d1011,_0xff3b38,_0xfaed('0x26')));}else{_0x5f70e1=path[_0xfaed('0x23')](_0x556821,util[_0xfaed('0x1c')](_0xfaed('0x27'),_0x5d1011,_0xfaed('0x26')));}fs['writeFileSync'](_0x5f70e1,csv(_0x4ff344));}})[_0xfaed('0x13')](function(){if(_0x39d72e){return new Promise(function(_0x372506){zipdir(path['join'](_0x556821,_0x5d1011),{'saveTo':path['join'](_0x556821,util['format'](_0xfaed('0x27'),_0x5d1011,_0xfaed('0x28')))},function(_0x27254b,_0x107e38){rimraf(path[_0xfaed('0x23')](_0x556821,_0x5d1011),function(){});_0x372506(_0xfaed('0x29'));});});}})[_0xfaed('0x13')](function(){logger[_0xfaed('0x2a')](util[_0xfaed('0x1c')](_0xfaed('0x2b'),EXTRACTED_REPORT_ID,_0xfaed('0xe')));return analyticExtractedReport(_0xfaed('0x2c'),_0x39d72e?util[_0xfaed('0x1c')](_0xfaed('0x27'),_0x5d1011,_0x39d72e?_0xfaed('0x28'):_0xfaed('0x26')):null);});})[_0xfaed('0x2d')](function(_0x1f8f38){logger[_0xfaed('0x2a')](util['format'](_0xfaed('0x2e'),EXTRACTED_REPORT_ID,'CSV'),util[_0xfaed('0x2f')](_0x1f8f38,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xfaed('0x30'));})[_0xfaed('0x31')](function(){process['exit'](EXIT_CODE);});}main();
\ No newline at end of file
index 4238f70..c0a931c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe3fc=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','concat','chunk','forEach','startDate','format','endDate','push','header','pageBreak','landscape','footer','Arial','black','right','Empty','find','split','splitSizePdf','range','num','isInteger','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','basename','existsSync','join','mkdirSync','then','flatten','createPdfKitDocument','pdf','%s.%s','all','zip','zip\x20finished','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch'];(function(_0xc0366b,_0x392cdc){var _0x2149e4=function(_0x39ed1a){while(--_0x39ed1a){_0xc0366b['push'](_0xc0366b['shift']());}};_0x2149e4(++_0x392cdc);}(_0xe3fc,0x6f));var _0xce3f=function(_0x295583,_0x4756aa){_0x295583=_0x295583-0x0;var _0x4c2ae6=_0xe3fc[_0x295583];return _0x4c2ae6;};'use strict';var _=require(_0xce3f('0x0'));var fs=require('fs');var util=require(_0xce3f('0x1'));var path=require(_0xce3f('0x2'));var moment=require(_0xce3f('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0xce3f('0x4'));var zipdir=require(_0xce3f('0x5'));var rimraf=require(_0xce3f('0x6'));var JSDOM=require(_0xce3f('0x7'))[_0xce3f('0x8')];var window=new JSDOM('')[_0xce3f('0x9')];var BPromise=require(_0xce3f('0xa'));var db=require(_0xce3f('0xb'))['db'];var dbH=require(_0xce3f('0xb'))[_0xce3f('0xc')];var logger=require(_0xce3f('0xd'))(_0xce3f('0xe'));var EXTRACTED_REPORT_ID=Number(process[_0xce3f('0xf')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xce3f('0xf')][0x4];var NAME=process[_0xce3f('0xf')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3b4780,_0x54c30f){var _0x29ab1c={'status':_0x3b4780};var _0x40502a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x54c30f){_0x29ab1c[_0xce3f('0x10')]=_0x54c30f;}return db[_0xce3f('0x11')][_0xce3f('0x12')](_0x29ab1c,_0x40502a);}function getHeaders(_0x2039ab){return _[_0xce3f('0x13')](_0x2039ab,function(_0x45e9ec){return{'text':_0x45e9ec,'style':_0xce3f('0x14')};});}function getRows(_0x60e1b9,_0x435471){return _[_0xce3f('0x13')](_0x435471,function(_0x26abab){return _(_0x26abab)[_0xce3f('0x15')](_0x60e1b9)[_0xce3f('0x13')](function(_0x1f6811){return _0x1f6811?_[_0xce3f('0x16')](_0x1f6811):'';})[_0xce3f('0x17')]();});}function createTable(_0x43587,_0x1f481d){var _0x37a4cf={'widths':_[_0xce3f('0x18')](Array(_0x43587[_0xce3f('0x19')]),0x91),'heights':function(_0x2425d8){return _0x2425d8===0x0?_0xce3f('0x1a'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x49b98f=getHeaders(_0x43587);_0x37a4cf[_0xce3f('0x1b')]['push'](_0x49b98f);var _0x100241=getRows(_0x43587,_0x1f481d);_0x37a4cf[_0xce3f('0x1b')]=_0x37a4cf['body'][_0xce3f('0x1c')](_0x100241);return _0x37a4cf;}function createTables(_0xabc63){var _0x26e131=[];var _0xfc48b1=_[_0xce3f('0x1d')](Object['keys'](_0xabc63[0x0]),0x5);_0xfc48b1[_0xce3f('0x1e')](function(_0x5a0e95){_0x26e131['push'](createTable(_0x5a0e95,_0xabc63));});return _0x26e131;}function getPDFDocDefinition(_0x1eb6d0){var _0x1d0b63=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0xce3f('0x1f')])[_0xce3f('0x20')](FORMAT),moment(EXTRACTED_REPORT[_0xce3f('0x21')])[_0xce3f('0x20')](FORMAT));var _0x57ddf4=[];for(var _0x52e266=0x0;_0x52e266<_0x1eb6d0[_0xce3f('0x19')];_0x52e266++){var _0x16af03=[];if(_0x52e266===0x0){_0x16af03[_0xce3f('0x22')]({'text':_0x1d0b63,'style':_0xce3f('0x23')});}var _0x3c20b9={'table':_0x1eb6d0[_0x52e266]};if(_0x52e266>0x0){_0x3c20b9[_0xce3f('0x24')]='before';_0x3c20b9['margin']=[0x0,0x46,0x0,0x0];}_0x16af03['push'](_0x3c20b9);_0x57ddf4['push'](_0x16af03);}return{'pageSize':'A4','pageOrientation':_0xce3f('0x25'),'content':_0x57ddf4,'footer':function(_0x3e9369,_0x3db1ab){return{'text':_0x3e9369[_0xce3f('0x16')]()+'\x20/\x20'+_0x3db1ab,'style':_0xce3f('0x26')};},'defaultStyle':{'font':_0xce3f('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xce3f('0x28')},'footer':{'alignment':_0xce3f('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x11421a){var _0x4f2e50=0x1388;var _0x39f87d;if(!_0x11421a[0x0]['num']){return analyticExtractedReport(_0xce3f('0x2a'));}return db['Setting'][_0xce3f('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xce3f('0x2c'),_0xce3f('0x2d')]})['then'](function(_0x4324f7){if(_0x4324f7){_0x39f87d=_0x4324f7;_0x4f2e50=_0x39f87d[_0xce3f('0x2d')]||0x3e8;}})['then'](function(){var _0x582d4c=[];var _0xbfc1ae=0x0;if(_0x39f87d[_0xce3f('0x2c')]){if(_0x11421a&&_0x11421a[_0xce3f('0x19')]){var _0x181bdf=_[_0xce3f('0x2e')](_0x11421a[0x0][_0xce3f('0x2f')]/_0x4f2e50);var _0x1982fa=Number[_0xce3f('0x30')](_0x11421a[0x0][_0xce3f('0x2f')]/_0x4f2e50)?_0x11421a[0x0][_0xce3f('0x2f')]%_0x4f2e50:0x0;_0x181bdf[_0xce3f('0x1e')](function(_0x3d9fc6){if(_0x3d9fc6>0x0){_0xbfc1ae+=_0x4f2e50;}_0x582d4c[_0xce3f('0x22')](dbH['sequelize'][_0xce3f('0x31')](util[_0xce3f('0x20')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4f2e50,_0xbfc1ae),{'type':dbH['sequelize'][_0xce3f('0x32')][_0xce3f('0x33')]}));});if(_0x1982fa>0x0){_0xbfc1ae+=_0x4f2e50;_0x582d4c[_0xce3f('0x22')](dbH['sequelize'][_0xce3f('0x31')](util[_0xce3f('0x20')](_0xce3f('0x34'),QUERY,_0x1982fa,_0xbfc1ae),{'type':dbH[_0xce3f('0x35')][_0xce3f('0x32')][_0xce3f('0x33')]}));}}}else{_0x582d4c[_0xce3f('0x22')](dbH[_0xce3f('0x35')]['query'](QUERY,{'type':dbH[_0xce3f('0x35')]['QueryTypes'][_0xce3f('0x33')]}));}var _0x4d0cb2=path['dirname'](PATH);var _0x1cc8b8=path[_0xce3f('0x36')](PATH,'.pdf');var _0x4d7ae9=_0x39f87d[_0xce3f('0x2c')]&&_0x582d4c['length']>0x1;var _0x593e6a=[];if(!fs[_0xce3f('0x37')](path[_0xce3f('0x38')](_0x4d0cb2,_0x1cc8b8))&&_0x4d7ae9){fs[_0xce3f('0x39')](path[_0xce3f('0x38')](_0x4d0cb2,_0x1cc8b8));}return BPromise['each'](_0x582d4c,function(_0x577d9b){_0x593e6a[_0xce3f('0x22')](_0x577d9b);})[_0xce3f('0x3a')](function(){var _0x51b2b7=[];for(var _0x1e584c=0x0;_0x1e584c<_0x593e6a[_0xce3f('0x19')];_0x1e584c+=0x1){var _0x3b1444=_0x593e6a[_0x1e584c];var _0x463bab=createTables(_[_0xce3f('0x3b')](_0x3b1444));var _0xf47f64;var _0x1ff780=getPDFDocDefinition(_0x463bab);var _0x53151b=getPDFPrinter();var _0xf3ae4b=_0x53151b[_0xce3f('0x3c')](_0x1ff780);if(_0x4d7ae9){_0xf47f64=path['join'](_0x4d0cb2,_0x1cc8b8,util[_0xce3f('0x20')]('%s%d.%s',_0x1cc8b8,_0x1e584c,_0xce3f('0x3d')));}else{_0xf47f64=path[_0xce3f('0x38')](_0x4d0cb2,util['format'](_0xce3f('0x3e'),_0x1cc8b8,_0xce3f('0x3d')));}_0x51b2b7[_0xce3f('0x22')](writePDFDocument(_0xf3ae4b,_0xf47f64));}return Promise[_0xce3f('0x3f')](_0x51b2b7);})[_0xce3f('0x3a')](function(){if(_0x4d7ae9){return new Promise(function(_0x431e00){zipdir(path[_0xce3f('0x38')](_0x4d0cb2,_0x1cc8b8),{'saveTo':path[_0xce3f('0x38')](_0x4d0cb2,util[_0xce3f('0x20')](_0xce3f('0x3e'),_0x1cc8b8,_0xce3f('0x40')))},function(){rimraf(path[_0xce3f('0x38')](_0x4d0cb2,_0x1cc8b8),function(){});_0x431e00(_0xce3f('0x41'));});});}})[_0xce3f('0x3a')](function(){if(!_0x4d7ae9)return;rimraf(path[_0xce3f('0x38')](_0x4d0cb2,_0x1cc8b8),function(){});})['then'](function(){logger['info'](util[_0xce3f('0x20')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0xce3f('0x42'),_0x4d7ae9?util['format'](_0xce3f('0x3e'),_0x1cc8b8,_0x4d7ae9?_0xce3f('0x40'):'pdf'):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xce3f('0x43')](util['format'](_0xce3f('0x44'),EXTRACTED_REPORT_ID,_0xce3f('0x45')));return db[_0xce3f('0x11')][_0xce3f('0x46')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xce3f('0x3a')](function(_0x14b8b4){EXTRACTED_REPORT=_0x14b8b4;return dbH[_0xce3f('0x35')]['query'](util[_0xce3f('0x20')](_0xce3f('0x47'),QUERY),{'type':dbH[_0xce3f('0x35')]['QueryTypes']['SELECT']});})[_0xce3f('0x3a')](extractReport)[_0xce3f('0x48')](function(_0x572fca){logger[_0xce3f('0x43')](util['format'](_0xce3f('0x49'),EXTRACTED_REPORT_ID,_0xce3f('0x45')),util['inspect'](_0x572fca,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xce3f('0x4a'));})[_0xce3f('0x4b')](function(){process[_0xce3f('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4cab77=new PdfPrinter({'Arial':{'normal':__dirname+_0xce3f('0x4d'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0xce3f('0x4e'),'bolditalics':__dirname+_0xce3f('0x4f')}});return _0x4cab77;}function getPDFDocDefinitionFromHTML(_0x1d00a2,_0x303400){var _0x2517cf=util[_0xce3f('0x20')](_0xce3f('0x50'),_0x303400[_0xce3f('0x51')],_0x303400[_0xce3f('0x52')]);var _0x5ea6b6=moment()[_0xce3f('0x20')]('YYYY-MM-DD')['toString']();var _0x5da54f=htmlToPdfmake(_0x1d00a2,{'window':window,'tableAutoSize':!![]});return{'content':[_0x5da54f],'defaultStyle':{'font':_0xce3f('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xce3f('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xce3f('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xce3f('0x53')}},'header':function(){return[{'text':_0xce3f('0x54'),'style':'header'}];},'footer':function(_0x595249,_0x354afd){return[{'text':util[_0xce3f('0x20')](_0xce3f('0x55'),_0x2517cf,_0x595249,_0x354afd,_0x5ea6b6),'style':'footer'}];}};}function writePDFDocument(_0x255f3b,_0x3e529d){return new Promise(function(_0x38011c,_0x224aa9){var _0x4fda77=_0x255f3b[_0xce3f('0x56')](fs[_0xce3f('0x57')](_0x3e529d));_0x4fda77['on'](_0xce3f('0x58'),function(){_0x38011c('finish');});_0x4fda77['on'](_0xce3f('0x59'),function(_0x24109b){_0x224aa9(_0x24109b);});_0x255f3b[_0xce3f('0x5a')]();});}exports[_0xce3f('0x5b')]=function(_0x381beb,_0x211f38){var _0x1f5049=getPDFPrinter();var _0x1980e3=getPDFDocDefinitionFromHTML(_0x381beb,_0x211f38);var _0x546741=_0x1f5049['createPdfKitDocument'](_0x1980e3);return writePDFDocument(_0x546741,_0x211f38[_0xce3f('0x2')])[_0xce3f('0x48')](function(_0x31e7fd){throw _0x31e7fd;});};
\ No newline at end of file
+var _0x1adc=['pick','toString','value','fill','length','body','push','concat','chunk','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','endDate','header','pageBreak','before','margin','footer','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','query','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','mkdirSync','%s%d.%s','pdf','%s.%s','zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','catch','inspect','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','map'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x1adc,0xef));var _0xc1ad=function(_0x38305a,_0xe0994b){_0x38305a=_0x38305a-0x0;var _0x48b3a5=_0x1adc[_0x38305a];return _0x48b3a5;};'use strict';var _=require(_0xc1ad('0x0'));var fs=require('fs');var util=require(_0xc1ad('0x1'));var path=require(_0xc1ad('0x2'));var moment=require(_0xc1ad('0x3'));var htmlToPdfmake=require(_0xc1ad('0x4'));var PdfPrinter=require(_0xc1ad('0x5'));var zipdir=require(_0xc1ad('0x6'));var rimraf=require(_0xc1ad('0x7'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')[_0xc1ad('0x8')];var BPromise=require(_0xc1ad('0x9'));var db=require(_0xc1ad('0xa'))['db'];var dbH=require('../../mysqldb')[_0xc1ad('0xb')];var logger=require(_0xc1ad('0xc'))(_0xc1ad('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0xc1ad('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc1ad('0xe')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1539b6,_0x1f29cc){var _0x1e6a73={'status':_0x1539b6};var _0x6f1cf4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1f29cc){_0x1e6a73[_0xc1ad('0xf')]=_0x1f29cc;}return db[_0xc1ad('0x10')][_0xc1ad('0x11')](_0x1e6a73,_0x6f1cf4);}function getHeaders(_0x1ad921){return _[_0xc1ad('0x12')](_0x1ad921,function(_0x3ac347){return{'text':_0x3ac347,'style':'tableHeader'};});}function getRows(_0x320971,_0x134d8c){return _[_0xc1ad('0x12')](_0x134d8c,function(_0x4b28a4){return _(_0x4b28a4)[_0xc1ad('0x13')](_0x320971)[_0xc1ad('0x12')](function(_0x3ad9c8){return _0x3ad9c8?_[_0xc1ad('0x14')](_0x3ad9c8):'';})[_0xc1ad('0x15')]();});}function createTable(_0x10c9d1,_0x3dc6e4){var _0x3af6c2={'widths':_[_0xc1ad('0x16')](Array(_0x10c9d1[_0xc1ad('0x17')]),0x91),'heights':function(_0x1c5464){return _0x1c5464===0x0?'auto':0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x485411=getHeaders(_0x10c9d1);_0x3af6c2[_0xc1ad('0x18')][_0xc1ad('0x19')](_0x485411);var _0x10d504=getRows(_0x10c9d1,_0x3dc6e4);_0x3af6c2[_0xc1ad('0x18')]=_0x3af6c2[_0xc1ad('0x18')][_0xc1ad('0x1a')](_0x10d504);return _0x3af6c2;}function createTables(_0x13a09d){var _0x3941b6=[];var _0xf99a29=_[_0xc1ad('0x1b')](Object['keys'](_0x13a09d[0x0]),0x5);_0xf99a29[_0xc1ad('0x1c')](function(_0x190e74){_0x3941b6[_0xc1ad('0x19')](createTable(_0x190e74,_0x13a09d));});return _0x3941b6;}function getPDFDocDefinition(_0x4b9bf5){var _0x36cf0a=util[_0xc1ad('0x1d')](_0xc1ad('0x1e'),NAME,EXTRACTED_REPORT[_0xc1ad('0x1f')],moment(EXTRACTED_REPORT['startDate'])[_0xc1ad('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0xc1ad('0x20')])['format'](FORMAT));var _0x1edc88=[];for(var _0x2c4972=0x0;_0x2c4972<_0x4b9bf5[_0xc1ad('0x17')];_0x2c4972++){var _0x181e95=[];if(_0x2c4972===0x0){_0x181e95['push']({'text':_0x36cf0a,'style':_0xc1ad('0x21')});}var _0xc662b9={'table':_0x4b9bf5[_0x2c4972]};if(_0x2c4972>0x0){_0xc662b9[_0xc1ad('0x22')]=_0xc1ad('0x23');_0xc662b9[_0xc1ad('0x24')]=[0x0,0x46,0x0,0x0];}_0x181e95[_0xc1ad('0x19')](_0xc662b9);_0x1edc88['push'](_0x181e95);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x1edc88,'footer':function(_0x1aba85,_0x27c70e){return{'text':_0x1aba85['toString']()+'\x20/\x20'+_0x27c70e,'style':_0xc1ad('0x25')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0xc1ad('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x352e5d){var _0x4363e1=0x1388;var _0x5ee213;if(!_0x352e5d[0x0][_0xc1ad('0x27')]){return analyticExtractedReport(_0xc1ad('0x28'));}return db[_0xc1ad('0x29')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc1ad('0x2a'),_0xc1ad('0x2b')]})['then'](function(_0x2623af){if(_0x2623af){_0x5ee213=_0x2623af;_0x4363e1=_0x5ee213[_0xc1ad('0x2b')]||0x3e8;}})[_0xc1ad('0x2c')](function(){var _0x2d4c74=[];var _0x530d1b=0x0;if(_0x5ee213[_0xc1ad('0x2a')]){if(_0x352e5d&&_0x352e5d[_0xc1ad('0x17')]){var _0x25732c=_[_0xc1ad('0x2d')](_0x352e5d[0x0][_0xc1ad('0x27')]/_0x4363e1);var _0x33b89c=Number[_0xc1ad('0x2e')](_0x352e5d[0x0][_0xc1ad('0x27')]/_0x4363e1)?_0x352e5d[0x0][_0xc1ad('0x27')]%_0x4363e1:0x0;_0x25732c['forEach'](function(_0x4b2b04){if(_0x4b2b04>0x0){_0x530d1b+=_0x4363e1;}_0x2d4c74['push'](dbH['sequelize'][_0xc1ad('0x2f')](util[_0xc1ad('0x1d')](_0xc1ad('0x30'),QUERY,_0x4363e1,_0x530d1b),{'type':dbH[_0xc1ad('0x31')][_0xc1ad('0x32')][_0xc1ad('0x33')]}));});if(_0x33b89c>0x0){_0x530d1b+=_0x4363e1;_0x2d4c74[_0xc1ad('0x19')](dbH[_0xc1ad('0x31')][_0xc1ad('0x2f')](util[_0xc1ad('0x1d')](_0xc1ad('0x30'),QUERY,_0x33b89c,_0x530d1b),{'type':dbH[_0xc1ad('0x31')][_0xc1ad('0x32')][_0xc1ad('0x33')]}));}}}else{_0x2d4c74['push'](dbH[_0xc1ad('0x31')]['query'](QUERY,{'type':dbH[_0xc1ad('0x31')][_0xc1ad('0x32')][_0xc1ad('0x33')]}));}var _0x22a005=path[_0xc1ad('0x34')](PATH);var _0xe0ae65=path[_0xc1ad('0x35')](PATH,_0xc1ad('0x36'));var _0x3ef4f7=_0x5ee213[_0xc1ad('0x2a')]&&_0x2d4c74[_0xc1ad('0x17')]>0x1;var _0x2cd40b=[];if(!fs[_0xc1ad('0x37')](path[_0xc1ad('0x38')](_0x22a005,_0xe0ae65))&&_0x3ef4f7){fs[_0xc1ad('0x39')](path[_0xc1ad('0x38')](_0x22a005,_0xe0ae65));}return BPromise['each'](_0x2d4c74,function(_0x59ed8f){_0x2cd40b[_0xc1ad('0x19')](_0x59ed8f);})[_0xc1ad('0x2c')](function(){var _0x2b0046=[];for(var _0x2b8d6c=0x0;_0x2b8d6c<_0x2cd40b[_0xc1ad('0x17')];_0x2b8d6c+=0x1){var _0x2f13c0=_0x2cd40b[_0x2b8d6c];var _0x400f73=createTables(_['flatten'](_0x2f13c0));var _0x1bb21d;var _0x19fe55=getPDFDocDefinition(_0x400f73);var _0x1a5317=getPDFPrinter();var _0x130caa=_0x1a5317['createPdfKitDocument'](_0x19fe55);if(_0x3ef4f7){_0x1bb21d=path['join'](_0x22a005,_0xe0ae65,util[_0xc1ad('0x1d')](_0xc1ad('0x3a'),_0xe0ae65,_0x2b8d6c,_0xc1ad('0x3b')));}else{_0x1bb21d=path['join'](_0x22a005,util[_0xc1ad('0x1d')](_0xc1ad('0x3c'),_0xe0ae65,_0xc1ad('0x3b')));}_0x2b0046[_0xc1ad('0x19')](writePDFDocument(_0x130caa,_0x1bb21d));}return Promise['all'](_0x2b0046);})[_0xc1ad('0x2c')](function(){if(_0x3ef4f7){return new Promise(function(_0x232282){zipdir(path[_0xc1ad('0x38')](_0x22a005,_0xe0ae65),{'saveTo':path[_0xc1ad('0x38')](_0x22a005,util[_0xc1ad('0x1d')]('%s.%s',_0xe0ae65,_0xc1ad('0x3d')))},function(){rimraf(path[_0xc1ad('0x38')](_0x22a005,_0xe0ae65),function(){});_0x232282(_0xc1ad('0x3e'));});});}})[_0xc1ad('0x2c')](function(){if(!_0x3ef4f7)return;rimraf(path['join'](_0x22a005,_0xe0ae65),function(){});})[_0xc1ad('0x2c')](function(){logger['info'](util['format'](_0xc1ad('0x3f'),EXTRACTED_REPORT_ID,_0xc1ad('0x40')));return analyticExtractedReport(_0xc1ad('0x41'),_0x3ef4f7?util[_0xc1ad('0x1d')](_0xc1ad('0x3c'),_0xe0ae65,_0x3ef4f7?_0xc1ad('0x3d'):_0xc1ad('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc1ad('0x42')](util[_0xc1ad('0x1d')](_0xc1ad('0x43'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport'][_0xc1ad('0x44')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc1ad('0x2c')](function(_0x4c00c5){EXTRACTED_REPORT=_0x4c00c5;return dbH['sequelize'][_0xc1ad('0x2f')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xc1ad('0x31')][_0xc1ad('0x32')][_0xc1ad('0x33')]});})[_0xc1ad('0x2c')](extractReport)[_0xc1ad('0x45')](function(_0x455eda){logger[_0xc1ad('0x42')](util[_0xc1ad('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc1ad('0x40')),util[_0xc1ad('0x46')](_0x455eda,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0xc1ad('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5b678c=new PdfPrinter({'Arial':{'normal':__dirname+_0xc1ad('0x48'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0xc1ad('0x49')}});return _0x5b678c;}function getPDFDocDefinitionFromHTML(_0x47d03b,_0x2640e8){var _0x337a9f=util[_0xc1ad('0x1d')](_0xc1ad('0x4a'),_0x2640e8[_0xc1ad('0x4b')],_0x2640e8[_0xc1ad('0x4c')]);var _0x21f374=moment()[_0xc1ad('0x1d')]('YYYY-MM-DD')['toString']();var _0x46b220=htmlToPdfmake(_0x47d03b,{'window':window,'tableAutoSize':!![]});return{'content':[_0x46b220],'defaultStyle':{'font':_0xc1ad('0x4d')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc1ad('0x4e'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xc1ad('0x4e'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc1ad('0x4e')}},'header':function(){return[{'text':_0xc1ad('0x4f'),'style':_0xc1ad('0x21')}];},'footer':function(_0x3572fe,_0x21a3e1){return[{'text':util['format'](_0xc1ad('0x50'),_0x337a9f,_0x3572fe,_0x21a3e1,_0x21f374),'style':'footer'}];}};}function writePDFDocument(_0x452810,_0x9f263b){return new Promise(function(_0x2d2889,_0x21d551){var _0x91a7ad=_0x452810[_0xc1ad('0x51')](fs[_0xc1ad('0x52')](_0x9f263b));_0x91a7ad['on']('finish',function(){_0x2d2889('finish');});_0x91a7ad['on'](_0xc1ad('0x53'),function(_0x21a321){_0x21d551(_0x21a321);});_0x452810['end']();});}exports[_0xc1ad('0x54')]=function(_0x464297,_0x185863){var _0x510536=getPDFPrinter();var _0x2c6133=getPDFDocDefinitionFromHTML(_0x464297,_0x185863);var _0x34e70b=_0x510536[_0xc1ad('0x55')](_0x2c6133);return writePDFDocument(_0x34e70b,_0x185863[_0xc1ad('0x2')])['catch'](function(_0x4a510b){throw _0x4a510b;});};
\ No newline at end of file
index 835cbf6..fc60064 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdfd9=['info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','path','lodash','json2xls','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','split','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','length','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','zip'];(function(_0x1a3a9c,_0x4d1ad7){var _0xe1dd66=function(_0x1f1940){while(--_0x1f1940){_0x1a3a9c['push'](_0x1a3a9c['shift']());}};_0xe1dd66(++_0x4d1ad7);}(_0xdfd9,0xcc));var _0x9dfd=function(_0x4121bc,_0x4b9038){_0x4121bc=_0x4121bc-0x0;var _0x3bd8ed=_0xdfd9[_0x4121bc];return _0x3bd8ed;};'use strict';var util=require('util');var path=require(_0x9dfd('0x0'));var _=require(_0x9dfd('0x1'));var fs=require('fs');var json2xls=require(_0x9dfd('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x9dfd('0x3'));var rimraf=require(_0x9dfd('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0x9dfd('0x5')];var logger=require(_0x9dfd('0x6'))(_0x9dfd('0x7'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x9dfd('0x8')][0x3];var PATH=process[_0x9dfd('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e8718,_0x4b0fcf){var _0x52cf33={'status':_0x2e8718};var _0x218c0a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b0fcf){_0x52cf33['savename']=_0x4b0fcf;}return db[_0x9dfd('0x9')][_0x9dfd('0xa')](_0x52cf33,_0x218c0a);}function main(){var _0x19959d=0x1388;var _0x1e359f;logger['info'](util[_0x9dfd('0xb')](_0x9dfd('0xc'),EXTRACTED_REPORT_ID,_0x9dfd('0xd')));return db['Setting'][_0x9dfd('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x9dfd('0xf')]})[_0x9dfd('0x10')](function(_0x373e75){if(_0x373e75){_0x1e359f=_0x373e75;_0x19959d=_0x1e359f[_0x9dfd('0xf')]||0x1388;}})[_0x9dfd('0x10')](function(){return dbH['sequelize'][_0x9dfd('0x11')](util[_0x9dfd('0xb')](_0x9dfd('0x12'),QUERY),{'type':dbH[_0x9dfd('0x13')][_0x9dfd('0x14')][_0x9dfd('0x15')]});})[_0x9dfd('0x10')](function(_0x4b7e83){if(!_0x4b7e83[0x0][_0x9dfd('0x16')]){return analyticExtractedReport('Empty');}var _0xbd711a=[];var _0x2eb893=0x0;if(_0x1e359f[_0x9dfd('0x17')]){if(_0x4b7e83&&_0x4b7e83['length']){var _0x1ac180=_[_0x9dfd('0x18')](_0x4b7e83[0x0]['num']/_0x19959d);var _0x43f0de=Number['isInteger'](_0x4b7e83[0x0][_0x9dfd('0x16')]/_0x19959d)?_0x4b7e83[0x0]['num']%_0x19959d:0x0;_0x1ac180[_0x9dfd('0x19')](function(_0xca8923){if(_0xca8923>0x0){_0x2eb893+=_0x19959d;}_0xbd711a[_0x9dfd('0x1a')](dbH['sequelize'][_0x9dfd('0x11')](util[_0x9dfd('0xb')](_0x9dfd('0x1b'),QUERY,_0x19959d,_0x2eb893),{'type':dbH[_0x9dfd('0x13')][_0x9dfd('0x14')][_0x9dfd('0x15')]}));});if(_0x43f0de>0x0){_0x2eb893+=_0x19959d;_0xbd711a['push'](dbH[_0x9dfd('0x13')][_0x9dfd('0x11')](util[_0x9dfd('0xb')](_0x9dfd('0x1b'),QUERY,_0x43f0de,_0x2eb893),{'type':dbH[_0x9dfd('0x13')][_0x9dfd('0x14')][_0x9dfd('0x15')]}));}}}else{_0xbd711a[_0x9dfd('0x1a')](dbH[_0x9dfd('0x13')][_0x9dfd('0x11')](QUERY,{'type':dbH[_0x9dfd('0x13')]['QueryTypes']['SELECT']}));}var _0xd5d155=path[_0x9dfd('0x1c')](PATH);var _0x3f8a8c=path[_0x9dfd('0x1d')](PATH,_0x9dfd('0x1e'));var _0x32c00d=_0x1e359f[_0x9dfd('0x17')]&&_0xbd711a[_0x9dfd('0x1f')]>0x1;var _0x3d0aac=[];if(!fs[_0x9dfd('0x20')](path[_0x9dfd('0x21')](_0xd5d155,_0x3f8a8c))&&_0x32c00d){fs[_0x9dfd('0x22')](path['join'](_0xd5d155,_0x3f8a8c));}return BPromise[_0x9dfd('0x23')](_0xbd711a,function(_0x62237e){_0x3d0aac[_0x9dfd('0x1a')](_0x62237e);})[_0x9dfd('0x10')](function(){for(var _0x4f7225=0x0;_0x4f7225<_0x3d0aac[_0x9dfd('0x1f')];_0x4f7225+=0x1){var _0x293702;var _0x1bac00=_0x3d0aac[_0x4f7225];if(_0x32c00d){_0x293702=path[_0x9dfd('0x21')](_0xd5d155,_0x3f8a8c,util[_0x9dfd('0xb')](_0x9dfd('0x24'),_0x3f8a8c,_0x4f7225,_0x9dfd('0x25')));}else{_0x293702=path[_0x9dfd('0x21')](_0xd5d155,util['format'](_0x9dfd('0x26'),_0x3f8a8c,_0x9dfd('0x25')));}fs[_0x9dfd('0x27')](_0x293702,json2xls(_0x1bac00),'binary');}})['then'](function(){if(_0x32c00d){return new Promise(function(_0xebf750){zipdir(path[_0x9dfd('0x21')](_0xd5d155,_0x3f8a8c),{'saveTo':path[_0x9dfd('0x21')](_0xd5d155,util['format'](_0x9dfd('0x26'),_0x3f8a8c,_0x9dfd('0x28')))},function(_0x1907da,_0x5de4db){rimraf(path[_0x9dfd('0x21')](_0xd5d155,_0x3f8a8c),function(){});_0xebf750('zip\x20finished');});});}})[_0x9dfd('0x10')](function(){logger[_0x9dfd('0x29')](util[_0x9dfd('0xb')](_0x9dfd('0x2a'),EXTRACTED_REPORT_ID,_0x9dfd('0xd')));return analyticExtractedReport(_0x9dfd('0x2b'),_0x32c00d?util['format'](_0x9dfd('0x26'),_0x3f8a8c,_0x32c00d?_0x9dfd('0x28'):_0x9dfd('0x25')):null);});})[_0x9dfd('0x2c')](function(_0x4920bb){logger[_0x9dfd('0x29')](util[_0x9dfd('0xb')](_0x9dfd('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util[_0x9dfd('0x2e')](_0x4920bb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x9dfd('0x2f')](function(){process[_0x9dfd('0x30')](EXIT_CODE);});}main();
\ No newline at end of file
+var _0xce5b=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','query','dirname','basename','existsSync','join','mkdirSync','each','length','%s%d.%s','xlsx','%s.%s','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','argv','update','format','XLSX','find','split','splitSizeXlsx','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','SELECT','Empty','range','num','isInteger'];(function(_0x38591a,_0x57e091){var _0x27a59a=function(_0xc7f6f5){while(--_0xc7f6f5){_0x38591a['push'](_0x38591a['shift']());}};_0x27a59a(++_0x57e091);}(_0xce5b,0x76));var _0xbce5=function(_0x28cb97,_0x47ad16){_0x28cb97=_0x28cb97-0x0;var _0x2d7486=_0xce5b[_0x28cb97];return _0x2d7486;};'use strict';var util=require(_0xbce5('0x0'));var path=require(_0xbce5('0x1'));var _=require(_0xbce5('0x2'));var fs=require('fs');var json2xls=require(_0xbce5('0x3'));var BPromise=require(_0xbce5('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0xbce5('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbce5('0x6'))[_0xbce5('0x7')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xbce5('0x8')][0x2]);var QUERY=process[_0xbce5('0x8')][0x3];var PATH=process[_0xbce5('0x8')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e2d25,_0xbf3f37){var _0x48dabf={'status':_0x2e2d25};var _0x529566={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xbf3f37){_0x48dabf['savename']=_0xbf3f37;}return db['AnalyticExtractedReport'][_0xbce5('0x9')](_0x48dabf,_0x529566);}function main(){var _0x1bc3ef=0x1388;var _0x88194a;logger['info'](util[_0xbce5('0xa')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbce5('0xb')));return db['Setting'][_0xbce5('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xbce5('0xd'),_0xbce5('0xe')]})[_0xbce5('0xf')](function(_0x1b6e71){if(_0x1b6e71){_0x88194a=_0x1b6e71;_0x1bc3ef=_0x88194a[_0xbce5('0xe')]||0x1388;}})[_0xbce5('0xf')](function(){return dbH['sequelize']['query'](util[_0xbce5('0xa')](_0xbce5('0x10'),QUERY),{'type':dbH[_0xbce5('0x11')]['QueryTypes'][_0xbce5('0x12')]});})[_0xbce5('0xf')](function(_0x134207){if(!_0x134207[0x0]['num']){return analyticExtractedReport(_0xbce5('0x13'));}var _0x191e08=[];var _0x251170=0x0;if(_0x88194a['split']){if(_0x134207&&_0x134207['length']){var _0x4a6049=_[_0xbce5('0x14')](_0x134207[0x0][_0xbce5('0x15')]/_0x1bc3ef);var _0x310b51=Number[_0xbce5('0x16')](_0x134207[0x0]['num']/_0x1bc3ef)?_0x134207[0x0][_0xbce5('0x15')]%_0x1bc3ef:0x0;_0x4a6049[_0xbce5('0x17')](function(_0x234d5a){if(_0x234d5a>0x0){_0x251170+=_0x1bc3ef;}_0x191e08[_0xbce5('0x18')](dbH['sequelize']['query'](util[_0xbce5('0xa')](_0xbce5('0x19'),QUERY,_0x1bc3ef,_0x251170),{'type':dbH[_0xbce5('0x11')][_0xbce5('0x1a')][_0xbce5('0x12')]}));});if(_0x310b51>0x0){_0x251170+=_0x1bc3ef;_0x191e08['push'](dbH[_0xbce5('0x11')]['query'](util['format'](_0xbce5('0x19'),QUERY,_0x310b51,_0x251170),{'type':dbH[_0xbce5('0x11')][_0xbce5('0x1a')][_0xbce5('0x12')]}));}}}else{_0x191e08[_0xbce5('0x18')](dbH[_0xbce5('0x11')][_0xbce5('0x1b')](QUERY,{'type':dbH[_0xbce5('0x11')][_0xbce5('0x1a')][_0xbce5('0x12')]}));}var _0x18c7bd=path[_0xbce5('0x1c')](PATH);var _0x13f048=path[_0xbce5('0x1d')](PATH,'.xlsx');var _0x25ce2e=_0x88194a[_0xbce5('0xd')]&&_0x191e08['length']>0x1;var _0xdc2518=[];if(!fs[_0xbce5('0x1e')](path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048))&&_0x25ce2e){fs[_0xbce5('0x20')](path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048));}return BPromise[_0xbce5('0x21')](_0x191e08,function(_0x57a3e1){_0xdc2518[_0xbce5('0x18')](_0x57a3e1);})['then'](function(){for(var _0x2d8747=0x0;_0x2d8747<_0xdc2518[_0xbce5('0x22')];_0x2d8747+=0x1){var _0x74ddff;var _0x3f2be=_0xdc2518[_0x2d8747];if(_0x25ce2e){_0x74ddff=path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048,util[_0xbce5('0xa')](_0xbce5('0x23'),_0x13f048,_0x2d8747,_0xbce5('0x24')));}else{_0x74ddff=path[_0xbce5('0x1f')](_0x18c7bd,util[_0xbce5('0xa')](_0xbce5('0x25'),_0x13f048,'xlsx'));}fs['writeFileSync'](_0x74ddff,json2xls(_0x3f2be),'binary');}})['then'](function(){if(_0x25ce2e){return new Promise(function(_0x4168dd){zipdir(path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048),{'saveTo':path[_0xbce5('0x1f')](_0x18c7bd,util['format']('%s.%s',_0x13f048,_0xbce5('0x26')))},function(_0x5e084d,_0x338015){rimraf(path[_0xbce5('0x1f')](_0x18c7bd,_0x13f048),function(){});_0x4168dd(_0xbce5('0x27'));});});}})[_0xbce5('0xf')](function(){logger[_0xbce5('0x28')](util[_0xbce5('0xa')](_0xbce5('0x29'),EXTRACTED_REPORT_ID,_0xbce5('0xb')));return analyticExtractedReport(_0xbce5('0x2a'),_0x25ce2e?util[_0xbce5('0xa')]('%s.%s',_0x13f048,_0x25ce2e?_0xbce5('0x26'):'xlsx'):null);});})['catch'](function(_0x290ceb){logger['info'](util['format'](_0xbce5('0x2b'),EXTRACTED_REPORT_ID,_0xbce5('0xb')),util[_0xbce5('0x2c')](_0x290ceb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xbce5('0x2d')](function(){process[_0xbce5('0x2e')](EXIT_CODE);});}main();
\ No newline at end of file
index e52c208..2f90ed4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb96f=['*,*,*,*','filter','intervals','tag','length','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','appType','custom','answer','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','lodash','util','Interval','findAll','then','models','IntervalId','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','queue','playback','hasOwnProperty','extension','extensions','push','type','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','CDR(routeid)=','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','toLowerCase','createdAt','updatedAt','interval'];(function(_0x519d0f,_0x2fba83){var _0x27f5d4=function(_0x59815f){while(--_0x59815f){_0x519d0f['push'](_0x519d0f['shift']());}};_0x27f5d4(++_0x2fba83);}(_0xb96f,0xdd));var _0xfb96=function(_0x28da36,_0x1e943f){_0x28da36=_0x28da36-0x0;var _0x3ad6e7=_0xb96f[_0x28da36];return _0x3ad6e7;};'use strict';var _=require(_0xfb96('0x0'));var util=require(_0xfb96('0x1'));function rewrite(_0x165767,_0x320966){var _0x59fe23=this;return _0x165767['models'][_0xfb96('0x2')][_0xfb96('0x3')]({'raw':!![]})[_0xfb96('0x4')](function(_0x32e984){_0x59fe23['intervals']=_0x32e984;return _0x165767[_0xfb96('0x5')]['VoiceExtension']['findAll']({'where':{'IntervalId':_0x320966[_0xfb96('0x6')]},'raw':!![]});})[_0xfb96('0x4')](function(_0x49645d){return _0x165767[_0xfb96('0x5')][_0xfb96('0x7')][_0xfb96('0x3')]({'where':{'exten':{'$in':_[_0xfb96('0x8')](_[_0xfb96('0x9')](_0x49645d,_0xfb96('0xa')))}},'order':[{'raw':_0xfb96('0xb')}],'raw':!![]});})['then'](function(_0x156d44){var _0x365ebc=_['filter'](_0x156d44,{'priority':'1'});var _0x24ab17=_['filter'](_0x156d44,{'isApp':0x1});var _0x46adcd=_['groupBy'](_0x24ab17,_0xfb96('0xa'));var _0x10c602=[_0xfb96('0xc'),_0xfb96('0xd')];var _0x2e211b=[];var _0x1dd0a6=[];for(var _0x4358fa in _0x46adcd){if(_0x46adcd[_0xfb96('0xe')](_0x4358fa)){_0x59fe23['priority']=0x2;_0x59fe23['extensions']=[];_0x59fe23[_0xfb96('0xf')]=_['find'](_0x365ebc,{'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')]});_0x59fe23[_0xfb96('0x10')][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':_0xfb96('0x13'),'appdata':util[_0xfb96('0x14')](_0xfb96('0x15'),_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')]),'context':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x16')],'exten':_0x46adcd[_0x4358fa][0x0]['exten'],'priority':_0x59fe23[_0xfb96('0x17')]++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});if(_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')]===_0xfb96('0x19')){_0x59fe23[_0xfb96('0x10')][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0]['type'],'app':_0xfb96('0x13'),'appdata':_0xfb96('0x1a')+_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')],'context':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x16')],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23['priority']++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});}else if(_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')]==='outbound'){if(_0x59fe23['extension']){_0x59fe23['extensions'][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':_0xfb96('0x13'),'appdata':_0xfb96('0x1b')+(_0x59fe23['extension'][_0xfb96('0x1c')]?'${EXTEN:'+_0x59fe23[_0xfb96('0xf')][_0xfb96('0x1c')]+'}':_0xfb96('0x1d')),'context':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x16')],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23[_0xfb96('0x17')]++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});}_0x59fe23[_0xfb96('0x10')][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':_0xfb96('0x13'),'appdata':_0xfb96('0x1a')+_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')],'context':_0x46adcd[_0x4358fa][0x0]['context'],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23[_0xfb96('0x17')]++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0]['VoiceExtensionId']});var _0x3a29ba=_0x59fe23['priority']++;_0x59fe23[_0xfb96('0x10')]['push']({'type':_0x46adcd[_0x4358fa][0x0]['type'],'app':_0xfb96('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3a29ba+0x2)+'):Goto('+(_0x3a29ba+0x1)+')','context':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x16')],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x3a29ba,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});if(_0x59fe23[_0xfb96('0xf')]){_0x59fe23['extensions'][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':_0xfb96('0x13'),'appdata':_0x59fe23[_0xfb96('0xf')][_0xfb96('0x1c')]?_0xfb96('0x1f')+_0x59fe23[_0xfb96('0xf')][_0xfb96('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x16')],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23['priority']++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});}_0x59fe23[_0xfb96('0x10')]['push']({'type':_0x46adcd[_0x4358fa][0x0]['type'],'app':_0xfb96('0x13'),'appdata':_0xfb96('0x20')+_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')],'context':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x16')],'exten':_0x46adcd[_0x4358fa][0x0]['exten'],'priority':_0x59fe23[_0xfb96('0x17')]++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});if(_0x59fe23[_0xfb96('0xf')]&&_0x59fe23[_0xfb96('0xf')][_0xfb96('0xe')](_0xfb96('0x21'))&&_0x59fe23[_0xfb96('0xf')][_0xfb96('0x21')]!=='none'){_0x59fe23['extensions'][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':_0xfb96('0x13'),'appdata':_0xfb96('0x22'),'context':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x16')],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23['priority']++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0]['VoiceExtensionId']});_0x59fe23['extensions']['push']({'type':_0x46adcd[_0x4358fa][0x0]['type'],'app':_0xfb96('0x13'),'appdata':_0xfb96('0x23')+_0x59fe23[_0xfb96('0xf')]['recordingFormat']||'wav','context':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x16')],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23[_0xfb96('0x17')]++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});}}_0x59fe23[_0xfb96('0x10')][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':'Set','appdata':_0xfb96('0x24'),'context':_0x46adcd[_0x4358fa][0x0]['context'],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23[_0xfb96('0x17')]++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});_0x59fe23[_0xfb96('0x10')][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':_0xfb96('0x13'),'appdata':_0xfb96('0x25'),'context':_0x46adcd[_0x4358fa][0x0]['context'],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23[_0xfb96('0x17')]++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0]['VoiceExtensionId']});_0x59fe23[_0xfb96('0x10')][_0xfb96('0x11')]({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':_0xfb96('0x13'),'appdata':_0xfb96('0x26'),'context':_0x46adcd[_0x4358fa][0x0]['context'],'exten':_0x46adcd[_0x4358fa][0x0][_0xfb96('0xa')],'priority':_0x59fe23['priority']++,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0]['VoiceExtensionId']});for(var _0x154019=0x0,_0x3fcf18=0x0;_0x154019<_0x46adcd[_0x4358fa]['length'];_0x154019+=0x1,_0x3fcf18=0x0){var _0x21b0ef=_0x46adcd[_0x4358fa][_0x154019];if(_0x21b0ef['type']){_0x21b0ef[_0xfb96('0x12')]=_0x21b0ef[_0xfb96('0x12')][_0xfb96('0x27')]();}var _0x222c52=[];var _0x1f7862=[];delete _0x21b0ef['id'];delete _0x21b0ef[_0xfb96('0x28')];delete _0x21b0ef[_0xfb96('0x29')];var _0x55da3f=_0x21b0ef[_0xfb96('0x2a')]!==_0xfb96('0x2b')?[_0x21b0ef[_0xfb96('0x2a')]]:_0x21b0ef[_0xfb96('0x6')]?_[_0xfb96('0x9')](_[_0xfb96('0x2c')](_0x59fe23[_0xfb96('0x2d')],{'IntervalId':_0x21b0ef[_0xfb96('0x6')]}),'interval'):[];if(_0x21b0ef[_0xfb96('0xe')]('tag')){if(_0x21b0ef[_0xfb96('0x2e')]&&_0x21b0ef[_0xfb96('0x2e')]!=='--'){_0x222c52[_0xfb96('0x11')]({'type':_0x21b0ef[_0xfb96('0x12')],'app':'Set','appdata':'CDR(tag)='+_0x21b0ef[_0xfb96('0x2e')],'context':_0x21b0ef[_0xfb96('0x16')],'exten':_0x21b0ef[_0xfb96('0xa')],'priority':_0x55da3f[_0xfb96('0x2f')]+_0x59fe23[_0xfb96('0x17')]+_0x3fcf18++,'VoiceExtensionId':_0x21b0ef['VoiceExtensionId']});}}if(_0x21b0ef[_0xfb96('0x12')]===_0xfb96('0x30')&&_0x21b0ef[_0xfb96('0xe')](_0xfb96('0x31'))){if(_0x21b0ef[_0xfb96('0x31')]){_0x222c52[_0xfb96('0x11')]({'type':_0x21b0ef[_0xfb96('0x12')],'app':_0xfb96('0x1e'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x21b0ef[_0xfb96('0x31')]+')','context':_0x21b0ef['context'],'exten':_0x21b0ef[_0xfb96('0xa')],'priority':_0x55da3f['length']+_0x59fe23[_0xfb96('0x17')]+_0x3fcf18++,'VoiceExtensionId':_0x21b0ef[_0xfb96('0x18')]});}else{_0x222c52['push']({'type':_0x21b0ef['type'],'app':_0xfb96('0x1e'),'appdata':_0xfb96('0x32'),'context':_0x21b0ef[_0xfb96('0x16')],'exten':_0x21b0ef[_0xfb96('0xa')],'priority':_0x55da3f[_0xfb96('0x2f')]+_0x59fe23[_0xfb96('0x17')]+_0x3fcf18++,'VoiceExtensionId':_0x21b0ef[_0xfb96('0x18')]});}}if(_0x21b0ef[_0xfb96('0xe')]('answer')){if(_0x10c602[_0xfb96('0x33')](_0x21b0ef['app']['toLowerCase']())>=0x0&&_0x21b0ef[_0xfb96('0x34')]!==_0xfb96('0x35')){if(_0x21b0ef[_0xfb96('0x36')]){_0x222c52[_0xfb96('0x11')]({'type':_0x21b0ef[_0xfb96('0x12')],'app':_0xfb96('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x21b0ef['context'],'exten':_0x21b0ef[_0xfb96('0xa')],'priority':_0x55da3f[_0xfb96('0x2f')]+_0x59fe23['priority']+_0x3fcf18++,'VoiceExtensionId':_0x21b0ef[_0xfb96('0x18')]});_0x222c52[_0xfb96('0x11')]({'type':_0x21b0ef[_0xfb96('0x12')],'app':_0xfb96('0x13'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x21b0ef[_0xfb96('0x16')],'exten':_0x21b0ef[_0xfb96('0xa')],'priority':_0x55da3f[_0xfb96('0x2f')]+_0x59fe23['priority']+_0x3fcf18++,'VoiceExtensionId':_0x21b0ef[_0xfb96('0x18')]});}else{_0x222c52['push']({'type':_0x21b0ef[_0xfb96('0x12')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x21b0ef['context'],'exten':_0x21b0ef[_0xfb96('0xa')],'priority':_0x55da3f['length']+_0x59fe23[_0xfb96('0x17')]+_0x3fcf18++,'VoiceExtensionId':_0x21b0ef[_0xfb96('0x18')]});_0x222c52[_0xfb96('0x11')]({'type':_0x21b0ef[_0xfb96('0x12')],'app':'Set','appdata':_0xfb96('0x37'),'context':_0x21b0ef[_0xfb96('0x16')],'exten':_0x21b0ef[_0xfb96('0xa')],'priority':_0x55da3f[_0xfb96('0x2f')]+_0x59fe23['priority']+_0x3fcf18++,'VoiceExtensionId':_0x21b0ef[_0xfb96('0x18')]});}}}for(var _0x13ff13=0x0;_0x13ff13<_0x55da3f[_0xfb96('0x2f')];_0x13ff13+=0x1){var _0x3890a1=_0x59fe23[_0xfb96('0x17')]+_0x55da3f[_0xfb96('0x2f')];var _0x3c3489=_0x13ff13===_0x55da3f[_0xfb96('0x2f')]-0x1?_0x59fe23[_0xfb96('0x17')]+_0x222c52['length']+_0x1f7862[_0xfb96('0x2f')]+0x2:_0x59fe23[_0xfb96('0x17')]+_0x13ff13+0x1;_0x222c52['splice'](_0x13ff13,0x0,{'type':_0x21b0ef[_0xfb96('0x12')],'app':_0xfb96('0x38'),'appdata':_0x55da3f[_0x13ff13]+'?'+_0x21b0ef[_0xfb96('0x16')]+',${EXTEN},'+_0x3890a1+':'+_0x21b0ef[_0xfb96('0x16')]+_0xfb96('0x39')+_0x3c3489,'exten':_0x21b0ef['exten'],'context':_0x21b0ef['context'],'priority':_0x59fe23['priority']+_0x13ff13,'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0]['VoiceExtensionId']});}_0x21b0ef[_0xfb96('0x17')]=_0x222c52[_0xfb96('0x2f')]?_[_0xfb96('0x3a')](_0x222c52)[_0xfb96('0x17')]+0x1:_0x59fe23[_0xfb96('0x17')];_0x59fe23[_0xfb96('0x17')]=(_0x1f7862[_0xfb96('0x2f')]?_[_0xfb96('0x3a')](_0x1f7862)[_0xfb96('0x17')]:_0x21b0ef[_0xfb96('0x17')])+0x1;_0x59fe23['extensions']=_['concat'](_0x59fe23[_0xfb96('0x10')],_0x222c52,[_0x21b0ef],_0x1f7862);}_0x59fe23[_0xfb96('0x10')]['push']({'type':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x12')],'app':'Hangup','exten':_0x46adcd[_0x4358fa][0x0]['exten'],'context':_0x46adcd[_0x4358fa][0x0]['context'],'priority':_0x59fe23[_0xfb96('0x17')],'VoiceExtensionId':_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]});_0x2e211b[_0xfb96('0x11')](_0x46adcd[_0x4358fa][0x0][_0xfb96('0x18')]);_0x1dd0a6=_[_0xfb96('0x3b')](_0x1dd0a6,_0x59fe23[_0xfb96('0x10')]);}}return _0x165767[_0xfb96('0x3c')](function(_0x1e64a2){return _0x165767[_0xfb96('0x5')][_0xfb96('0x7')][_0xfb96('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x2e211b}},'transaction':_0x1e64a2})[_0xfb96('0x4')](function(_0xfa7439){return _0x165767[_0xfb96('0x5')][_0xfb96('0x7')][_0xfb96('0x3e')](_[_0xfb96('0x3f')](_0x1dd0a6,_0xfb96('0x17')),{'transaction':_0x1e64a2});});});})[_0xfb96('0x40')](function(_0x19bf11){console['error'](_0x19bf11);});}exports[_0xfb96('0x41')]=rewrite;
\ No newline at end of file
+var _0x5448=['playback','hasOwnProperty','extension','find','extensions','push','type','Set','CDR(type)=%s','context','priority','inbound','CDR(routeid)=','VoiceExtensionId','outbound','cutdigits','${EXTEN:','${EXTEN}','ExecIf','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','MONITOR_OPTIONS=ab','updatedAt','interval','intervals','tag','CDR(tag)=','length','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','toLowerCase','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','rewrite','util','models','Interval','findAll','then','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy'];(function(_0x4ffa03,_0x363a82){var _0x30d661=function(_0x36ba86){while(--_0x36ba86){_0x4ffa03['push'](_0x4ffa03['shift']());}};_0x30d661(++_0x363a82);}(_0x5448,0x1eb));var _0x8544=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x5448[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x8544('0x0'));function rewrite(_0x317d5f,_0x2fb900){var _0x29cbd1=this;return _0x317d5f[_0x8544('0x1')][_0x8544('0x2')][_0x8544('0x3')]({'raw':!![]})[_0x8544('0x4')](function(_0x3dc670){_0x29cbd1['intervals']=_0x3dc670;return _0x317d5f[_0x8544('0x1')][_0x8544('0x5')][_0x8544('0x3')]({'where':{'IntervalId':_0x2fb900[_0x8544('0x6')]},'raw':!![]});})[_0x8544('0x4')](function(_0x3f7ccf){return _0x317d5f[_0x8544('0x1')][_0x8544('0x5')]['findAll']({'where':{'exten':{'$in':_[_0x8544('0x7')](_[_0x8544('0x8')](_0x3f7ccf,_0x8544('0x9')))}},'order':[{'raw':_0x8544('0xa')}],'raw':!![]});})['then'](function(_0x9e59f3){var _0x5e77f1=_[_0x8544('0xb')](_0x9e59f3,{'priority':'1'});var _0x33460e=_[_0x8544('0xb')](_0x9e59f3,{'isApp':0x1});var _0x4a846a=_[_0x8544('0xc')](_0x33460e,_0x8544('0x9'));var _0x10fbb2=['queue',_0x8544('0xd')];var _0x36c18c=[];var _0x24bf89=[];for(var _0x1acfb5 in _0x4a846a){if(_0x4a846a[_0x8544('0xe')](_0x1acfb5)){_0x29cbd1['priority']=0x2;_0x29cbd1['extensions']=[];_0x29cbd1[_0x8544('0xf')]=_[_0x8544('0x10')](_0x5e77f1,{'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')]});_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':util['format'](_0x8544('0x15'),_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')]),'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0]['exten'],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0]['VoiceExtensionId']});if(_0x4a846a[_0x1acfb5][0x0]['type']===_0x8544('0x18')){_0x29cbd1[_0x8544('0x11')]['push']({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':_0x8544('0x19')+_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')],'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1['priority']++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});}else if(_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')]===_0x8544('0x1b')){if(_0x29cbd1[_0x8544('0xf')]){_0x29cbd1[_0x8544('0x11')]['push']({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':'CDR(destination)='+(_0x29cbd1[_0x8544('0xf')][_0x8544('0x1c')]?_0x8544('0x1d')+_0x29cbd1[_0x8544('0xf')]['cutdigits']+'}':_0x8544('0x1e')),'context':_0x4a846a[_0x1acfb5][0x0]['context'],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});}_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':'CDR(routeid)='+_0x4a846a[_0x1acfb5][0x0]['VoiceExtensionId'],'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});var _0x3fec94=_0x29cbd1['priority']++;_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3fec94+0x2)+'):Goto('+(_0x3fec94+0x1)+')','context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x3fec94,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});if(_0x29cbd1[_0x8544('0xf')]){_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':_0x29cbd1[_0x8544('0xf')]['cutdigits']?_0x8544('0x20')+_0x29cbd1[_0x8544('0xf')][_0x8544('0x1c')]+'}':'CDR(prefix)=noprefix','context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});}_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':_0x8544('0x21')+_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')],'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0]['exten'],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});if(_0x29cbd1[_0x8544('0xf')]&&_0x29cbd1['extension'][_0x8544('0xe')](_0x8544('0x22'))&&_0x29cbd1[_0x8544('0xf')][_0x8544('0x22')]!=='none'){_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x4a846a[_0x1acfb5][0x0]['context'],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1['priority']++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});_0x29cbd1[_0x8544('0x11')]['push']({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':_0x8544('0x23')+_0x29cbd1['extension'][_0x8544('0x22')]||_0x8544('0x24'),'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0]['VoiceExtensionId']});}}_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0]['exten'],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4a846a[_0x1acfb5][0x0]['context'],'exten':_0x4a846a[_0x1acfb5][0x0]['exten'],'priority':_0x29cbd1['priority']++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':_0x8544('0x14'),'appdata':_0x8544('0x25'),'context':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x16')],'exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'priority':_0x29cbd1[_0x8544('0x17')]++,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});for(var _0xfa1f2f=0x0,_0x214b6a=0x0;_0xfa1f2f<_0x4a846a[_0x1acfb5]['length'];_0xfa1f2f+=0x1,_0x214b6a=0x0){var _0x93477d=_0x4a846a[_0x1acfb5][_0xfa1f2f];if(_0x93477d['type']){_0x93477d['type']=_0x93477d[_0x8544('0x13')]['toLowerCase']();}var _0x22317c=[];var _0x39004b=[];delete _0x93477d['id'];delete _0x93477d['createdAt'];delete _0x93477d[_0x8544('0x26')];var _0x55e103=_0x93477d[_0x8544('0x27')]!=='*,*,*,*'?[_0x93477d[_0x8544('0x27')]]:_0x93477d[_0x8544('0x6')]?_[_0x8544('0x8')](_[_0x8544('0xb')](_0x29cbd1[_0x8544('0x28')],{'IntervalId':_0x93477d['IntervalId']}),_0x8544('0x27')):[];if(_0x93477d[_0x8544('0xe')](_0x8544('0x29'))){if(_0x93477d['tag']&&_0x93477d['tag']!=='--'){_0x22317c[_0x8544('0x12')]({'type':_0x93477d[_0x8544('0x13')],'app':'Set','appdata':_0x8544('0x2a')+_0x93477d[_0x8544('0x29')],'context':_0x93477d['context'],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103[_0x8544('0x2b')]+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d['VoiceExtensionId']});}}if(_0x93477d[_0x8544('0x13')]==='outbound'&&_0x93477d[_0x8544('0xe')]('callerID')){if(_0x93477d['callerID']){_0x22317c[_0x8544('0x12')]({'type':_0x93477d['type'],'app':_0x8544('0x1f'),'appdata':_0x8544('0x2c')+_0x93477d['callerID']+')','context':_0x93477d['context'],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103[_0x8544('0x2b')]+_0x29cbd1['priority']+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});}else{_0x22317c[_0x8544('0x12')]({'type':_0x93477d[_0x8544('0x13')],'app':_0x8544('0x1f'),'appdata':_0x8544('0x2d'),'context':_0x93477d['context'],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103['length']+_0x29cbd1['priority']+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});}}if(_0x93477d[_0x8544('0xe')](_0x8544('0x2e'))){if(_0x10fbb2[_0x8544('0x2f')](_0x93477d['app'][_0x8544('0x30')]())>=0x0&&_0x93477d['appType']!==_0x8544('0x31')){if(_0x93477d[_0x8544('0x2e')]){_0x22317c[_0x8544('0x12')]({'type':_0x93477d['type'],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x93477d[_0x8544('0x16')],'exten':_0x93477d['exten'],'priority':_0x55e103['length']+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});_0x22317c[_0x8544('0x12')]({'type':_0x93477d[_0x8544('0x13')],'app':_0x8544('0x14'),'appdata':_0x8544('0x32'),'context':_0x93477d['context'],'exten':_0x93477d['exten'],'priority':_0x55e103[_0x8544('0x2b')]+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});}else{_0x22317c[_0x8544('0x12')]({'type':_0x93477d[_0x8544('0x13')],'app':_0x8544('0x1f'),'appdata':_0x8544('0x33'),'context':_0x93477d[_0x8544('0x16')],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103[_0x8544('0x2b')]+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});_0x22317c['push']({'type':_0x93477d[_0x8544('0x13')],'app':'Set','appdata':_0x8544('0x34'),'context':_0x93477d['context'],'exten':_0x93477d[_0x8544('0x9')],'priority':_0x55e103['length']+_0x29cbd1[_0x8544('0x17')]+_0x214b6a++,'VoiceExtensionId':_0x93477d[_0x8544('0x1a')]});}}}for(var _0x1ed2c8=0x0;_0x1ed2c8<_0x55e103[_0x8544('0x2b')];_0x1ed2c8+=0x1){var _0x7ae7db=_0x29cbd1[_0x8544('0x17')]+_0x55e103[_0x8544('0x2b')];var _0x5d0089=_0x1ed2c8===_0x55e103[_0x8544('0x2b')]-0x1?_0x29cbd1[_0x8544('0x17')]+_0x22317c['length']+_0x39004b['length']+0x2:_0x29cbd1[_0x8544('0x17')]+_0x1ed2c8+0x1;_0x22317c[_0x8544('0x35')](_0x1ed2c8,0x0,{'type':_0x93477d[_0x8544('0x13')],'app':'GotoIfTime','appdata':_0x55e103[_0x1ed2c8]+'?'+_0x93477d[_0x8544('0x16')]+_0x8544('0x36')+_0x7ae7db+':'+_0x93477d[_0x8544('0x16')]+_0x8544('0x36')+_0x5d0089,'exten':_0x93477d['exten'],'context':_0x93477d[_0x8544('0x16')],'priority':_0x29cbd1[_0x8544('0x17')]+_0x1ed2c8,'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});}_0x93477d[_0x8544('0x17')]=_0x22317c[_0x8544('0x2b')]?_['last'](_0x22317c)[_0x8544('0x17')]+0x1:_0x29cbd1[_0x8544('0x17')];_0x29cbd1[_0x8544('0x17')]=(_0x39004b[_0x8544('0x2b')]?_[_0x8544('0x37')](_0x39004b)['priority']:_0x93477d[_0x8544('0x17')])+0x1;_0x29cbd1[_0x8544('0x11')]=_[_0x8544('0x38')](_0x29cbd1[_0x8544('0x11')],_0x22317c,[_0x93477d],_0x39004b);}_0x29cbd1[_0x8544('0x11')][_0x8544('0x12')]({'type':_0x4a846a[_0x1acfb5][0x0]['type'],'app':'Hangup','exten':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x9')],'context':_0x4a846a[_0x1acfb5][0x0]['context'],'priority':_0x29cbd1[_0x8544('0x17')],'VoiceExtensionId':_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]});_0x36c18c[_0x8544('0x12')](_0x4a846a[_0x1acfb5][0x0][_0x8544('0x1a')]);_0x24bf89=_[_0x8544('0x38')](_0x24bf89,_0x29cbd1[_0x8544('0x11')]);}}return _0x317d5f[_0x8544('0x39')](function(_0x5dd4ee){return _0x317d5f['models'][_0x8544('0x5')][_0x8544('0x3a')]({'where':{'VoiceExtensionId':{'$in':_0x36c18c}},'transaction':_0x5dd4ee})['then'](function(_0x4b262d){return _0x317d5f[_0x8544('0x1')]['VoiceExtension'][_0x8544('0x3b')](_[_0x8544('0x3c')](_0x24bf89,_0x8544('0x17')),{'transaction':_0x5dd4ee});});});})[_0x8544('0x3d')](function(_0x4c9840){console['error'](_0x4c9840);});}exports[_0x8544('0x3e')]=rewrite;
\ No newline at end of file
index 313ab8c..fb20001 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d8b=['pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','toString','NOW()','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','select','\x20=\x20?','insert','cm_contacts','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','contact:csv_','resolve','unlinkSync','info','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','util','lodash','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','api','defaults','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','CmContact','create','keys','push'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x2d8b,0xa7));var _0xb2d8=function(_0x32c3cf,_0xca3273){_0x32c3cf=_0x32c3cf-0x0;var _0x149a87=_0x2d8b[_0x32c3cf];return _0x149a87;};'use strict';var BPromise=require('bluebird');var util=require(_0xb2d8('0x0'));var _=require(_0xb2d8('0x1'));var fs=require('fs');var squel=require(_0xb2d8('0x2'));var Papa=require(_0xb2d8('0x3'));var Redis=require(_0xb2d8('0x4'));var db=require(_0xb2d8('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xb2d8('0x6'))(_0xb2d8('0x7'));config['redis']=_[_0xb2d8('0x8')](config[_0xb2d8('0x9')],{'host':_0xb2d8('0xa'),'port':0x18eb});var socket=require(_0xb2d8('0xb'))(new Redis(config['redis']));require(_0xb2d8('0xc'))[_0xb2d8('0xd')](socket);try{if(!process['argv'][0x2]||process[_0xb2d8('0xe')][0x2]===_0xb2d8('0xf')||process[_0xb2d8('0xe')][0x2]===_0xb2d8('0x10')){throw new Error(_0xb2d8('0x11'));}var FILEPATH=process[_0xb2d8('0xe')][0x2];if(!process[_0xb2d8('0xe')][0x3]||process[_0xb2d8('0xe')][0x3]==='undefined'||process[_0xb2d8('0xe')][0x3]===_0xb2d8('0x10')||!process['argv'][0x4]||process[_0xb2d8('0xe')][0x4]==='undefined'||process[_0xb2d8('0xe')][0x4]===_0xb2d8('0x10')){throw new Error(_0xb2d8('0x12'));}var FIELDS=_['zipObject'](process[_0xb2d8('0xe')][0x3][_0xb2d8('0x13')](','),process[_0xb2d8('0xe')][0x4]['split'](','));if(!process[_0xb2d8('0xe')][0x5]||process[_0xb2d8('0xe')][0x5]==='undefined'||process[_0xb2d8('0xe')][0x5]===_0xb2d8('0x10')){throw new Error(_0xb2d8('0x14'));}var LISTID=process[_0xb2d8('0xe')][0x5];var COMPANYID=process[_0xb2d8('0xe')][0x6]&&process[_0xb2d8('0xe')][0x6]!==_0xb2d8('0xf')&&process[_0xb2d8('0xe')][0x6]!==_0xb2d8('0x10')?process[_0xb2d8('0xe')][0x6]:null;var DUPLICATES=process[_0xb2d8('0xe')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0xb2d8('0xe')][0x7]!=='null'?process[_0xb2d8('0xe')][0x7]:null;if(!process[_0xb2d8('0xe')][0x8]||process[_0xb2d8('0xe')][0x8]===_0xb2d8('0xf')||process[_0xb2d8('0xe')][0x8]===_0xb2d8('0x10')){throw new Error(_0xb2d8('0x15'));}var SOCKET_TIMESTAMP=process[_0xb2d8('0xe')][0x8];}catch(_0x4e18e3){logger[_0xb2d8('0x16')](_0x4e18e3);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x4036b0,_0x5cb12c,_0x2c6eab,_0xaab06){var _0xe26989={'message':_0x5cb12c};_0xe26989[_0x4036b0]=!![];if(_0x2c6eab){_0xe26989[_0xb2d8('0x17')]=_0x2c6eab;}if(_0xaab06){_0xe26989[_0xb2d8('0x18')]=_0xaab06;}return _0xe26989;}function isEmail(_0x4c023e){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xb2d8('0x19')](_0x4c023e);}function checkRow(_0x3f980e,_0x20f095,_0x5e3550){return new BPromise(function(_0x4afe92,_0x4a6383){if(_[_0xb2d8('0x1a')](_0x3f980e)){return _0x4a6383(handleCheckRowError('error',_0xb2d8('0x1b'),null,_0x5e3550));}if(_0x3f980e[_0xb2d8('0x1c')]&&_0x3f980e[_0xb2d8('0x1c')][_0xb2d8('0x1d')]){var _0x2350f2=_[_0xb2d8('0x1e')](_0x3f980e[_0xb2d8('0x1c')],_0xb2d8('0x1f'))['join'](';');return _0x4a6383(handleCheckRowError(_0xb2d8('0x16'),_0x2350f2,null,_0x5e3550));}var _0x5d9ff2={};for(var _0x5503d0 in FIELDS){if(FIELDS[_0xb2d8('0x20')](_0x5503d0)&&FIELDS[_0x5503d0]){_0x5d9ff2[_0x5503d0]=_0x3f980e[_0xb2d8('0x21')][0x0][FIELDS[_0x5503d0]]||_0x3f980e['data'][0x0]['\ufeff'+FIELDS[_0x5503d0]];}}if(!_0x5d9ff2[_0xb2d8('0x22')]){return _0x4a6383(handleCheckRowError(_0xb2d8('0x16'),_0xb2d8('0x23'),null,_0x5e3550));}if(!_0x5d9ff2[_0xb2d8('0x24')]){return _0x4a6383(handleCheckRowError('error',_0xb2d8('0x25'),null,_0x5e3550));}if(_0x5d9ff2[_0xb2d8('0x26')]){var _0xd58dfd=moment(_0x5d9ff2['birthDate'],_0xb2d8('0x27'));if(!_0xd58dfd['isValid']()){return _0x4a6383(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x5e3550));}}if(_0x5d9ff2['email']){if(!isEmail(_0x5d9ff2['email'])){return _0x4a6383(handleCheckRowError(_0xb2d8('0x16'),_0xb2d8('0x28'),null,_0x5e3550));}}_0x5d9ff2[_0xb2d8('0x29')]=LISTID;_0x5d9ff2[_0xb2d8('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xb2d8('0x1d')]&&_0x20f095){var _0x437b6b={};for(var _0x151c0d=0x0,_0x2bdb49=DUPLICATES[_0xb2d8('0x1d')];_0x151c0d<_0x2bdb49;_0x151c0d+=0x1){_0x437b6b[DUPLICATES[_0x151c0d]]=_0x5d9ff2[DUPLICATES[_0x151c0d]];}var _0x5c9ac4=_[_0xb2d8('0x2b')](_0x20f095,_0x437b6b);if(_0x5c9ac4){return _0x4a6383(handleCheckRowError(_0xb2d8('0x2c'),'Duplicate\x20Contact',_0x5c9ac4,_0x5e3550));}}return db[_0xb2d8('0x2d')][_0xb2d8('0x2e')](_0x5d9ff2,{'raw':!![],'hooks':![],'fields':_[_0xb2d8('0x2f')](_0x5d9ff2)})['then'](function(_0x2f2743){if(DUPLICATES&&DUPLICATES[_0xb2d8('0x1d')]&&_0x20f095){_0x20f095[_0xb2d8('0x30')](_[_0xb2d8('0x31')](_0x5d9ff2,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2f2743['id'];return _0x4afe92();})[_0xb2d8('0x32')](function(_0x5133a8){return _0x4a6383(handleCheckRowError('error',_0xb2d8('0x33')+(_0x5133a8[_0xb2d8('0x1f')]||JSON[_0xb2d8('0x34')](_0x5133a8)),null,_0x5e3550));});});}function checkHopper(){function _0x4731ce(){return function(_0x18084c){logger[_0xb2d8('0x16')](_0xb2d8('0x35'),_0xb2d8('0x36'),util['inspect'](_0x18084c,{'showHidden':![],'depth':null}));};}var _0x3dd463=function(_0x292be5,_0x1c5ad5){var _0x5263a9=squel['insert']()[_0xb2d8('0x37')](_0xb2d8('0x38'))[_0xb2d8('0x39')]([_0xb2d8('0x24'),_0xb2d8('0x3a'),_0xb2d8('0x3b'),'ListId',_0x1c5ad5,_0xb2d8('0x3c'),_0xb2d8('0x3d')],squel['select']()[_0xb2d8('0x3e')](_0xb2d8('0x24'),_0xb2d8('0x24'))[_0xb2d8('0x3e')]('NOW()',_0xb2d8('0x3a'))[_0xb2d8('0x3e')]('id','ContactId')[_0xb2d8('0x3e')](LISTID[_0xb2d8('0x3f')](),_0xb2d8('0x29'))[_0xb2d8('0x3e')](_0x292be5['id'][_0xb2d8('0x3f')](),_0x1c5ad5)[_0xb2d8('0x3e')](_0xb2d8('0x40'),_0xb2d8('0x3c'))[_0xb2d8('0x3e')](_0xb2d8('0x40'),_0xb2d8('0x3d'))[_0xb2d8('0x41')]('cm_contacts')['where'](_0xb2d8('0x42'))['where'](_0xb2d8('0x43'),LISTID[_0xb2d8('0x3f')]())[_0xb2d8('0x44')]('phone\x20IS\x20NOT\x20NULL')[_0xb2d8('0x44')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb2d8('0x45')]()[_0xb2d8('0x3e')](_0xb2d8('0x24'))[_0xb2d8('0x41')](_0xb2d8('0x38'))[_0xb2d8('0x44')](_0x1c5ad5+_0xb2d8('0x46'),_0x292be5['id'][_0xb2d8('0x3f')]())))['toString']();return _0x5263a9;};var _0x29043e=function(_0x2f494b,_0x11764b){var _0x46121d=squel[_0xb2d8('0x47')]()['into'](_0xb2d8('0x38'))['fromQuery']([_0xb2d8('0x24'),_0xb2d8('0x3a'),_0xb2d8('0x3b'),_0xb2d8('0x29'),_0x11764b,'createdAt',_0xb2d8('0x3d')],squel[_0xb2d8('0x45')]()['field'](_0xb2d8('0x24'),'phone')[_0xb2d8('0x3e')](_0xb2d8('0x40'),_0xb2d8('0x3a'))[_0xb2d8('0x3e')]('id',_0xb2d8('0x3b'))[_0xb2d8('0x3e')](LISTID[_0xb2d8('0x3f')](),'ListId')[_0xb2d8('0x3e')](_0x2f494b['id'][_0xb2d8('0x3f')](),_0x11764b)[_0xb2d8('0x3e')](_0xb2d8('0x40'),_0xb2d8('0x3c'))['field']('NOW()',_0xb2d8('0x3d'))[_0xb2d8('0x41')](_0xb2d8('0x48'))[_0xb2d8('0x44')](_0xb2d8('0x42'))[_0xb2d8('0x44')](_0xb2d8('0x43'),LISTID[_0xb2d8('0x3f')]())[_0xb2d8('0x44')](_0xb2d8('0x49'),squel[_0xb2d8('0x4a')](hopperContacts))['where'](_0xb2d8('0x4b'))[_0xb2d8('0x44')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb2d8('0x3e')]('calleridnum')[_0xb2d8('0x41')](_0xb2d8('0x4c'))[_0xb2d8('0x44')](_0x11764b+_0xb2d8('0x46'),_0x2f494b['id']['toString']()))[_0xb2d8('0x44')](_0xb2d8('0x4d'),squel[_0xb2d8('0x45')]()[_0xb2d8('0x3e')](_0xb2d8('0x24'))[_0xb2d8('0x41')](_0xb2d8('0x38'))[_0xb2d8('0x44')](_0x11764b+_0xb2d8('0x46'),_0x2f494b['id'][_0xb2d8('0x3f')]())))[_0xb2d8('0x3f')]();return _0x46121d;};function _0xb7768a(_0x477e11,_0x4e33cc){var _0x1e299e=squel[_0xb2d8('0x47')]()[_0xb2d8('0x37')](_0xb2d8('0x38'))['fromQuery']([_0xb2d8('0x24'),_0xb2d8('0x3a'),_0xb2d8('0x3b'),_0xb2d8('0x29'),_0x4e33cc,'createdAt',_0xb2d8('0x3d')],squel[_0xb2d8('0x45')]()[_0xb2d8('0x3e')](_0xb2d8('0x24'),_0xb2d8('0x24'))[_0xb2d8('0x3e')](_0xb2d8('0x40'),'scheduledAt')['field']('id',_0xb2d8('0x3b'))[_0xb2d8('0x3e')](LISTID[_0xb2d8('0x3f')](),_0xb2d8('0x29'))['field'](_0x477e11['id'][_0xb2d8('0x3f')](),_0x4e33cc)[_0xb2d8('0x3e')](_0xb2d8('0x40'),_0xb2d8('0x3c'))[_0xb2d8('0x3e')](_0xb2d8('0x40'),_0xb2d8('0x3d'))[_0xb2d8('0x41')](_0xb2d8('0x48'))['where'](_0xb2d8('0x42'))[_0xb2d8('0x44')](_0xb2d8('0x43'),LISTID['toString']())[_0xb2d8('0x44')](_0xb2d8('0x49'),squel[_0xb2d8('0x4a')](hopperContacts))[_0xb2d8('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0xb2d8('0x3f')]();return _0x1e299e;}function _0x484949(_0x38375a,_0x171dd8){var _0x4fbc4f=squel[_0xb2d8('0x47')]()[_0xb2d8('0x37')](_0xb2d8('0x4e'))['fromQuery']([_0xb2d8('0x24'),_0xb2d8('0x3b'),'ListId',_0x171dd8,_0xb2d8('0x3c'),_0xb2d8('0x3d')],squel[_0xb2d8('0x45')]()[_0xb2d8('0x3e')](_0xb2d8('0x24'),_0xb2d8('0x24'))[_0xb2d8('0x3e')]('id',_0xb2d8('0x3b'))[_0xb2d8('0x3e')](LISTID[_0xb2d8('0x3f')](),_0xb2d8('0x29'))[_0xb2d8('0x3e')](_0x38375a['id']['toString'](),_0x171dd8)['field'](_0xb2d8('0x40'),_0xb2d8('0x3c'))[_0xb2d8('0x3e')]('NOW()',_0xb2d8('0x3d'))[_0xb2d8('0x41')]('cm_contacts')[_0xb2d8('0x44')](_0xb2d8('0x42'))[_0xb2d8('0x44')](_0xb2d8('0x43'),LISTID[_0xb2d8('0x3f')]())[_0xb2d8('0x44')](_0xb2d8('0x49'),squel['str'](hopperContacts))[_0xb2d8('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0xb2d8('0x3f')]();return _0x4fbc4f;}return db[_0xb2d8('0x4f')][_0xb2d8('0x50')]({'where':{'type':_0xb2d8('0x51')},'attributes':['id',_0xb2d8('0x52')],'include':[{'model':db[_0xb2d8('0x53')],'as':_0xb2d8('0x54'),'where':{'id':LISTID}}]})[_0xb2d8('0x55')](function(_0x9d253b){var _0x5c4270=[];if(_0x9d253b){var _0x58d034;for(var _0x1328e6=0x0,_0x14c788;_0x1328e6<_0x9d253b['length'];_0x1328e6+=0x1){_0x14c788=_0x9d253b[_0x1328e6][_0xb2d8('0x56')]({'plain':!![]});switch(_0x14c788['dialCheckDuplicateType']){case _0xb2d8('0x57'):_0x5c4270[_0xb2d8('0x30')](db[_0xb2d8('0x58')][_0xb2d8('0x59')](_0x29043e(_0x14c788,_0xb2d8('0x5a')))[_0xb2d8('0x55')](function(){})[_0xb2d8('0x32')](_0x4731ce()));break;case _0xb2d8('0x5b'):_0x5c4270[_0xb2d8('0x30')](db[_0xb2d8('0x58')]['query'](_0x3dd463(_0x14c788,'VoiceQueueId'))['then'](function(){})[_0xb2d8('0x32')](_0x4731ce()));break;default:_0x5c4270[_0xb2d8('0x30')](db[_0xb2d8('0x58')]['query'](_0xb7768a(_0x14c788,_0xb2d8('0x5a')))[_0xb2d8('0x55')](function(){})[_0xb2d8('0x32')](_0x4731ce()));}}}return _0x5c4270;})[_0xb2d8('0x5c')]()['then'](function(){return db['VoiceQueue'][_0xb2d8('0x50')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xb2d8('0x5d'),'where':{'id':LISTID}}]})[_0xb2d8('0x55')](function(_0x413a5e){var _0x28ea24=[];if(_0x413a5e){var _0x753ca7;for(var _0x52ff0f=0x0,_0x18a216;_0x52ff0f<_0x413a5e[_0xb2d8('0x1d')];_0x52ff0f+=0x1){_0x18a216=_0x413a5e[_0x52ff0f][_0xb2d8('0x56')]({'plain':!![]});_0x28ea24[_0xb2d8('0x30')](db[_0xb2d8('0x58')][_0xb2d8('0x59')](_0x484949(_0x18a216,'VoiceQueueId'))[_0xb2d8('0x55')](function(){})[_0xb2d8('0x32')](_0x4731ce()));}}return _0x28ea24;})[_0xb2d8('0x5c')]();})[_0xb2d8('0x55')](function(){return db[_0xb2d8('0x5e')][_0xb2d8('0x50')]({'attributes':['id',_0xb2d8('0x52')],'include':[{'model':db['CmList'],'as':_0xb2d8('0x54'),'where':{'id':LISTID}}]})[_0xb2d8('0x55')](function(_0x471004){var _0xcb46df=[];if(_0x471004){for(var _0x433b92=0x0,_0xcf17ae;_0x433b92<_0x471004['length'];_0x433b92+=0x1){_0xcf17ae=_0x471004[_0x433b92][_0xb2d8('0x56')]({'plain':!![]});switch(_0xcf17ae[_0xb2d8('0x52')]){case'always':_0xcb46df[_0xb2d8('0x30')](db[_0xb2d8('0x58')]['query'](_0x29043e(_0xcf17ae,_0xb2d8('0x5f')))[_0xb2d8('0x55')](function(){})[_0xb2d8('0x32')](_0x4731ce()));break;case'onlyIfOpen':_0xcb46df[_0xb2d8('0x30')](db[_0xb2d8('0x58')][_0xb2d8('0x59')](_0x3dd463(_0xcf17ae,_0xb2d8('0x5f')))['then'](function(){})[_0xb2d8('0x32')](_0x4731ce()));break;default:_0xcb46df[_0xb2d8('0x30')](db['sequelize']['query'](_0xb7768a(_0xcf17ae,'CampaignId'))['then'](function(){})[_0xb2d8('0x32')](_0x4731ce()));}}}return _0xcb46df;})[_0xb2d8('0x5c')]();})[_0xb2d8('0x55')](function(){return db[_0xb2d8('0x5e')][_0xb2d8('0x50')]({'attributes':['id'],'include':[{'model':db[_0xb2d8('0x53')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xb2d8('0x55')](function(_0x590daf){var _0x1f2528=[];if(_0x590daf){for(var _0x39d511=0x0,_0x44b8d4;_0x39d511<_0x590daf[_0xb2d8('0x1d')];_0x39d511+=0x1){_0x44b8d4=_0x590daf[_0x39d511][_0xb2d8('0x56')]({'plain':!![]});_0x1f2528[_0xb2d8('0x30')](db[_0xb2d8('0x58')]['query'](_0x484949(_0x44b8d4,_0xb2d8('0x5f')))['then'](function(){})[_0xb2d8('0x32')](_0x4731ce()));}}return _0x1f2528;})[_0xb2d8('0x5c')]();})[_0xb2d8('0x32')](function(_0x500577){logger['error']('cmContact,\x20%s,\x20%s',_0xb2d8('0x60'),_0x500577[_0xb2d8('0x1f')]);});}var processPromises=function(_0x312d6f){return BPromise[_0xb2d8('0x5c')](promises)['then'](function(_0x371a41){})[_0xb2d8('0x32')](function(_0x4f58a2){logger['error'](_0xb2d8('0x61'),JSON[_0xb2d8('0x34')](_0x4f58a2));})[_0xb2d8('0x62')](function(){socket['emit'](_0xb2d8('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x312d6f){return _0x312d6f['resume']();}});};var endCsv=function(){return BPromise[_0xb2d8('0x64')]()[_0xb2d8('0x55')](function(){if(hopperContacts){return checkHopper();}})[_0xb2d8('0x55')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb2d8('0x65')](FILEPATH);}catch(_0xb39b01){logger[_0xb2d8('0x16')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xb2d8('0x34')](_0xb39b01));}finally{process['exit'](0x0);}});};process['on']('SIGINT',function(){logger[_0xb2d8('0x66')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xb2d8('0x55')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db['CmContact'][_0xb2d8('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xb2d8('0x55')](function(_0x69dd63){var _0x69c700=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb2d8('0x67')](_0x69c700,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d72e3,_0x2c5cc8){total+=0x1;var _0x4457db=total;promises[_0xb2d8('0x30')](checkRow(_0x5d72e3,_0x69dd63,_0x4457db)['then'](function(){success+=0x1;})[_0xb2d8('0x32')](function(_0x4846cc){if(_0x4846cc[_0xb2d8('0x16')]){errors+=0x1;delete _0x4846cc[_0xb2d8('0x16')];}else if(_0x4846cc[_0xb2d8('0x2c')]){duplicates+=0x1;delete _0x4846cc['duplicate'];}rows[_0xb2d8('0x30')](_0x4846cc);}));if(total%0xc8===0x0){_0x2c5cc8[_0xb2d8('0x68')]();return processPromises(_0x2c5cc8);}},'complete':function(){return processPromises()[_0xb2d8('0x55')](function(){logger[_0xb2d8('0x66')](_0xb2d8('0x69'));endCsv();});},'error':function(_0x1693e0,_0x4332dc){logger['info'](_0xb2d8('0x6a'),JSON['stringify'](_0x1693e0));endCsv();}});})[_0xb2d8('0x32')](function(_0x5bd1d0){logger[_0xb2d8('0x16')](_0xb2d8('0x6b'),JSON[_0xb2d8('0x34')](_0x5bd1d0));});}main();
\ No newline at end of file
+var _0x8a5e=['outbound','CmList','Lists','get','dialCheckDuplicateType','always','push','sequelize','VoiceQueueId','all','BlackLists','query','Campaign','CampaignId','onlyIfOpen','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash','squel','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','undefined','argv','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','duplicate','Duplicate\x20Contact','create','keys','then','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','insert','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','field','toString','NOW()','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','select','from','cm_hopper','\x20=\x20?','into','id\x20IN\x20?','str','phone\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','deletedAt\x20IS\x20NULL','VoiceQueue','findAll'];(function(_0xa8d84f,_0x512e08){var _0x220939=function(_0x496f6d){while(--_0x496f6d){_0xa8d84f['push'](_0xa8d84f['shift']());}};_0x220939(++_0x512e08);}(_0x8a5e,0x1ed));var _0xe8a5=function(_0x330187,_0x2f1165){_0x330187=_0x330187-0x0;var _0x440c63=_0x8a5e[_0x330187];return _0x440c63;};'use strict';var BPromise=require(_0xe8a5('0x0'));var util=require(_0xe8a5('0x1'));var _=require(_0xe8a5('0x2'));var fs=require('fs');var squel=require(_0xe8a5('0x3'));var Papa=require('papaparse');var Redis=require(_0xe8a5('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0xe8a5('0x5'));var logger=require(_0xe8a5('0x6'))(_0xe8a5('0x7'));config[_0xe8a5('0x8')]=_[_0xe8a5('0x9')](config[_0xe8a5('0x8')],{'host':_0xe8a5('0xa'),'port':0x18eb});var socket=require(_0xe8a5('0xb'))(new Redis(config['redis']));require(_0xe8a5('0xc'))[_0xe8a5('0xd')](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xe8a5('0xe')||process[_0xe8a5('0xf')][0x2]==='null'){throw new Error(_0xe8a5('0x10'));}var FILEPATH=process[_0xe8a5('0xf')][0x2];if(!process[_0xe8a5('0xf')][0x3]||process[_0xe8a5('0xf')][0x3]===_0xe8a5('0xe')||process[_0xe8a5('0xf')][0x3]===_0xe8a5('0x11')||!process['argv'][0x4]||process['argv'][0x4]===_0xe8a5('0xe')||process['argv'][0x4]===_0xe8a5('0x11')){throw new Error(_0xe8a5('0x12'));}var FIELDS=_[_0xe8a5('0x13')](process[_0xe8a5('0xf')][0x3][_0xe8a5('0x14')](','),process[_0xe8a5('0xf')][0x4]['split'](','));if(!process[_0xe8a5('0xf')][0x5]||process[_0xe8a5('0xf')][0x5]===_0xe8a5('0xe')||process[_0xe8a5('0xf')][0x5]===_0xe8a5('0x11')){throw new Error(_0xe8a5('0x15'));}var LISTID=process[_0xe8a5('0xf')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0xe8a5('0xf')][0x6]!==_0xe8a5('0xe')&&process[_0xe8a5('0xf')][0x6]!==_0xe8a5('0x11')?process[_0xe8a5('0xf')][0x6]:null;var DUPLICATES=process[_0xe8a5('0xf')][0x7]&&process[_0xe8a5('0xf')][0x7]!==_0xe8a5('0xe')&&process[_0xe8a5('0xf')][0x7]!==_0xe8a5('0x11')?process[_0xe8a5('0xf')][0x7]:null;if(!process[_0xe8a5('0xf')][0x8]||process[_0xe8a5('0xf')][0x8]===_0xe8a5('0xe')||process[_0xe8a5('0xf')][0x8]===_0xe8a5('0x11')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x321659){logger[_0xe8a5('0x16')](_0x321659);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x23ccef,_0x49ec72,_0xed69aa,_0x4c9025){var _0x445c91={'message':_0x49ec72};_0x445c91[_0x23ccef]=!![];if(_0xed69aa){_0x445c91[_0xe8a5('0x17')]=_0xed69aa;}if(_0x4c9025){_0x445c91[_0xe8a5('0x18')]=_0x4c9025;}return _0x445c91;}function isEmail(_0xbe2fd1){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xe8a5('0x19')](_0xbe2fd1);}function checkRow(_0x2a8a25,_0x51c5b5,_0x1728dc){return new BPromise(function(_0x25449a,_0x2b3e13){if(_[_0xe8a5('0x1a')](_0x2a8a25)){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x1b'),null,_0x1728dc));}if(_0x2a8a25[_0xe8a5('0x1c')]&&_0x2a8a25[_0xe8a5('0x1c')][_0xe8a5('0x1d')]){var _0x3b856f=_[_0xe8a5('0x1e')](_0x2a8a25[_0xe8a5('0x1c')],_0xe8a5('0x1f'))[_0xe8a5('0x20')](';');return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0x3b856f,null,_0x1728dc));}var _0x31708b={};for(var _0x1b1d86 in FIELDS){if(FIELDS[_0xe8a5('0x21')](_0x1b1d86)&&FIELDS[_0x1b1d86]){_0x31708b[_0x1b1d86]=_0x2a8a25[_0xe8a5('0x22')][0x0][FIELDS[_0x1b1d86]]||_0x2a8a25['data'][0x0]['\ufeff'+FIELDS[_0x1b1d86]];}}if(!_0x31708b[_0xe8a5('0x23')]){return _0x2b3e13(handleCheckRowError('error',_0xe8a5('0x24'),null,_0x1728dc));}if(!_0x31708b[_0xe8a5('0x25')]){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x26'),null,_0x1728dc));}if(_0x31708b[_0xe8a5('0x27')]){var _0x5b8336=moment(_0x31708b['birthDate'],_0xe8a5('0x28'));if(!_0x5b8336[_0xe8a5('0x29')]()){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x2a'),null,_0x1728dc));}}if(_0x31708b[_0xe8a5('0x2b')]){if(!isEmail(_0x31708b[_0xe8a5('0x2b')])){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x2c'),null,_0x1728dc));}}_0x31708b[_0xe8a5('0x2d')]=LISTID;_0x31708b['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xe8a5('0x1d')]&&_0x51c5b5){var _0x3acc8e={};for(var _0x392414=0x0,_0x2f832b=DUPLICATES[_0xe8a5('0x1d')];_0x392414<_0x2f832b;_0x392414+=0x1){_0x3acc8e[DUPLICATES[_0x392414]]=_0x31708b[DUPLICATES[_0x392414]];}var _0x12d508=_['find'](_0x51c5b5,_0x3acc8e);if(_0x12d508){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x2e'),_0xe8a5('0x2f'),_0x12d508,_0x1728dc));}}return db['CmContact'][_0xe8a5('0x30')](_0x31708b,{'raw':!![],'hooks':![],'fields':_[_0xe8a5('0x31')](_0x31708b)})[_0xe8a5('0x32')](function(_0x9a7ff4){if(DUPLICATES&&DUPLICATES[_0xe8a5('0x1d')]&&_0x51c5b5){_0x51c5b5['push'](_[_0xe8a5('0x33')](_0x31708b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x9a7ff4['id'];return _0x25449a();})[_0xe8a5('0x34')](function(_0x2aad8f){return _0x2b3e13(handleCheckRowError(_0xe8a5('0x16'),_0xe8a5('0x35')+(_0x2aad8f[_0xe8a5('0x1f')]||JSON[_0xe8a5('0x36')](_0x2aad8f)),null,_0x1728dc));});});}function checkHopper(){function _0x5a5bf2(){return function(_0xce2f6f){logger[_0xe8a5('0x16')](_0xe8a5('0x37'),_0xe8a5('0x38'),util['inspect'](_0xce2f6f,{'showHidden':![],'depth':null}));};}var _0x146176=function(_0x1d804c,_0x2a536d){var _0x53ff80=squel[_0xe8a5('0x39')]()['into']('cm_hopper')[_0xe8a5('0x3a')](['phone',_0xe8a5('0x3b'),_0xe8a5('0x3c'),_0xe8a5('0x2d'),_0x2a536d,_0xe8a5('0x3d'),_0xe8a5('0x3e')],squel['select']()[_0xe8a5('0x3f')](_0xe8a5('0x25'),_0xe8a5('0x25'))[_0xe8a5('0x3f')]('NOW()','scheduledAt')[_0xe8a5('0x3f')]('id',_0xe8a5('0x3c'))[_0xe8a5('0x3f')](LISTID[_0xe8a5('0x40')](),_0xe8a5('0x2d'))[_0xe8a5('0x3f')](_0x1d804c['id'][_0xe8a5('0x40')](),_0x2a536d)['field'](_0xe8a5('0x41'),'createdAt')[_0xe8a5('0x3f')](_0xe8a5('0x41'),'updatedAt')['from']('cm_contacts')[_0xe8a5('0x42')]('deletedAt\x20IS\x20NULL')[_0xe8a5('0x42')](_0xe8a5('0x43'),LISTID[_0xe8a5('0x40')]())[_0xe8a5('0x42')](_0xe8a5('0x44'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xe8a5('0x45')]()[_0xe8a5('0x3f')](_0xe8a5('0x25'))[_0xe8a5('0x46')](_0xe8a5('0x47'))[_0xe8a5('0x42')](_0x2a536d+_0xe8a5('0x48'),_0x1d804c['id'][_0xe8a5('0x40')]())))[_0xe8a5('0x40')]();return _0x53ff80;};var _0x53b4af=function(_0x5046b4,_0xe97d75){var _0x296be1=squel[_0xe8a5('0x39')]()[_0xe8a5('0x49')](_0xe8a5('0x47'))['fromQuery']([_0xe8a5('0x25'),_0xe8a5('0x3b'),_0xe8a5('0x3c'),_0xe8a5('0x2d'),_0xe97d75,_0xe8a5('0x3d'),_0xe8a5('0x3e')],squel['select']()['field'](_0xe8a5('0x25'),_0xe8a5('0x25'))[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3b'))[_0xe8a5('0x3f')]('id',_0xe8a5('0x3c'))['field'](LISTID[_0xe8a5('0x40')](),_0xe8a5('0x2d'))['field'](_0x5046b4['id'][_0xe8a5('0x40')](),_0xe97d75)[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3d'))[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3e'))['from']('cm_contacts')[_0xe8a5('0x42')]('deletedAt\x20IS\x20NULL')[_0xe8a5('0x42')]('ListId\x20=\x20?',LISTID[_0xe8a5('0x40')]())[_0xe8a5('0x42')](_0xe8a5('0x4a'),squel[_0xe8a5('0x4b')](hopperContacts))[_0xe8a5('0x42')](_0xe8a5('0x44'))['where'](_0xe8a5('0x4c'),squel[_0xe8a5('0x45')]()[_0xe8a5('0x3f')](_0xe8a5('0x4d'))['from'](_0xe8a5('0x4e'))[_0xe8a5('0x42')](_0xe97d75+'\x20=\x20?',_0x5046b4['id'][_0xe8a5('0x40')]()))[_0xe8a5('0x42')](_0xe8a5('0x4c'),squel['select']()[_0xe8a5('0x3f')](_0xe8a5('0x25'))[_0xe8a5('0x46')](_0xe8a5('0x47'))[_0xe8a5('0x42')](_0xe97d75+_0xe8a5('0x48'),_0x5046b4['id'][_0xe8a5('0x40')]())))[_0xe8a5('0x40')]();return _0x296be1;};function _0x3055b1(_0x8e9740,_0x1e65ec){var _0x4d0789=squel['insert']()['into'](_0xe8a5('0x47'))[_0xe8a5('0x3a')]([_0xe8a5('0x25'),_0xe8a5('0x3b'),_0xe8a5('0x3c'),_0xe8a5('0x2d'),_0x1e65ec,_0xe8a5('0x3d'),_0xe8a5('0x3e')],squel[_0xe8a5('0x45')]()[_0xe8a5('0x3f')](_0xe8a5('0x25'),_0xe8a5('0x25'))[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3b'))['field']('id',_0xe8a5('0x3c'))[_0xe8a5('0x3f')](LISTID[_0xe8a5('0x40')](),_0xe8a5('0x2d'))[_0xe8a5('0x3f')](_0x8e9740['id'][_0xe8a5('0x40')](),_0x1e65ec)[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3d'))[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3e'))[_0xe8a5('0x46')]('cm_contacts')[_0xe8a5('0x42')](_0xe8a5('0x4f'))['where'](_0xe8a5('0x43'),LISTID[_0xe8a5('0x40')]())[_0xe8a5('0x42')](_0xe8a5('0x4a'),squel[_0xe8a5('0x4b')](hopperContacts))[_0xe8a5('0x42')](_0xe8a5('0x44')))[_0xe8a5('0x40')]();return _0x4d0789;}function _0x76faaa(_0x2b0783,_0x36abc7){var _0x397cc5=squel[_0xe8a5('0x39')]()['into']('cm_hopper_black')[_0xe8a5('0x3a')]([_0xe8a5('0x25'),'ContactId','ListId',_0x36abc7,_0xe8a5('0x3d'),_0xe8a5('0x3e')],squel[_0xe8a5('0x45')]()[_0xe8a5('0x3f')](_0xe8a5('0x25'),'phone')['field']('id',_0xe8a5('0x3c'))[_0xe8a5('0x3f')](LISTID[_0xe8a5('0x40')](),'ListId')['field'](_0x2b0783['id']['toString'](),_0x36abc7)['field'](_0xe8a5('0x41'),'createdAt')[_0xe8a5('0x3f')](_0xe8a5('0x41'),_0xe8a5('0x3e'))[_0xe8a5('0x46')]('cm_contacts')[_0xe8a5('0x42')](_0xe8a5('0x4f'))[_0xe8a5('0x42')](_0xe8a5('0x43'),LISTID[_0xe8a5('0x40')]())[_0xe8a5('0x42')]('id\x20IN\x20?',squel[_0xe8a5('0x4b')](hopperContacts))['where'](_0xe8a5('0x44')))[_0xe8a5('0x40')]();return _0x397cc5;}return db[_0xe8a5('0x50')][_0xe8a5('0x51')]({'where':{'type':_0xe8a5('0x52')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xe8a5('0x53')],'as':_0xe8a5('0x54'),'where':{'id':LISTID}}]})[_0xe8a5('0x32')](function(_0x1660a6){var _0xa1f01e=[];if(_0x1660a6){var _0x1a374b;for(var _0x3c1fee=0x0,_0x169f07;_0x3c1fee<_0x1660a6[_0xe8a5('0x1d')];_0x3c1fee+=0x1){_0x169f07=_0x1660a6[_0x3c1fee][_0xe8a5('0x55')]({'plain':!![]});switch(_0x169f07[_0xe8a5('0x56')]){case _0xe8a5('0x57'):_0xa1f01e[_0xe8a5('0x58')](db[_0xe8a5('0x59')]['query'](_0x53b4af(_0x169f07,_0xe8a5('0x5a')))[_0xe8a5('0x32')](function(){})[_0xe8a5('0x34')](_0x5a5bf2()));break;case'onlyIfOpen':_0xa1f01e[_0xe8a5('0x58')](db['sequelize']['query'](_0x146176(_0x169f07,'VoiceQueueId'))[_0xe8a5('0x32')](function(){})['catch'](_0x5a5bf2()));break;default:_0xa1f01e[_0xe8a5('0x58')](db[_0xe8a5('0x59')]['query'](_0x3055b1(_0x169f07,_0xe8a5('0x5a')))['then'](function(){})[_0xe8a5('0x34')](_0x5a5bf2()));}}}return _0xa1f01e;})[_0xe8a5('0x5b')]()['then'](function(){return db[_0xe8a5('0x50')]['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xe8a5('0x53')],'as':_0xe8a5('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x5228f0){var _0x11870f=[];if(_0x5228f0){var _0x2e6a9c;for(var _0x280b70=0x0,_0x43645c;_0x280b70<_0x5228f0[_0xe8a5('0x1d')];_0x280b70+=0x1){_0x43645c=_0x5228f0[_0x280b70]['get']({'plain':!![]});_0x11870f[_0xe8a5('0x58')](db[_0xe8a5('0x59')][_0xe8a5('0x5d')](_0x76faaa(_0x43645c,_0xe8a5('0x5a')))['then'](function(){})['catch'](_0x5a5bf2()));}}return _0x11870f;})[_0xe8a5('0x5b')]();})['then'](function(){return db[_0xe8a5('0x5e')][_0xe8a5('0x51')]({'attributes':['id',_0xe8a5('0x56')],'include':[{'model':db['CmList'],'as':_0xe8a5('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x1c7d6b){var _0x41b502=[];if(_0x1c7d6b){for(var _0x167297=0x0,_0x3ef7db;_0x167297<_0x1c7d6b[_0xe8a5('0x1d')];_0x167297+=0x1){_0x3ef7db=_0x1c7d6b[_0x167297][_0xe8a5('0x55')]({'plain':!![]});switch(_0x3ef7db['dialCheckDuplicateType']){case _0xe8a5('0x57'):_0x41b502[_0xe8a5('0x58')](db[_0xe8a5('0x59')][_0xe8a5('0x5d')](_0x53b4af(_0x3ef7db,_0xe8a5('0x5f')))[_0xe8a5('0x32')](function(){})['catch'](_0x5a5bf2()));break;case _0xe8a5('0x60'):_0x41b502[_0xe8a5('0x58')](db[_0xe8a5('0x59')][_0xe8a5('0x5d')](_0x146176(_0x3ef7db,_0xe8a5('0x5f')))['then'](function(){})[_0xe8a5('0x34')](_0x5a5bf2()));break;default:_0x41b502['push'](db[_0xe8a5('0x59')]['query'](_0x3055b1(_0x3ef7db,_0xe8a5('0x5f')))[_0xe8a5('0x32')](function(){})[_0xe8a5('0x34')](_0x5a5bf2()));}}}return _0x41b502;})[_0xe8a5('0x5b')]();})[_0xe8a5('0x32')](function(){return db[_0xe8a5('0x5e')][_0xe8a5('0x51')]({'attributes':['id'],'include':[{'model':db[_0xe8a5('0x53')],'as':_0xe8a5('0x5c'),'where':{'id':LISTID}}]})[_0xe8a5('0x32')](function(_0xa34be3){var _0x41f309=[];if(_0xa34be3){for(var _0x1682d1=0x0,_0x5d3fbe;_0x1682d1<_0xa34be3[_0xe8a5('0x1d')];_0x1682d1+=0x1){_0x5d3fbe=_0xa34be3[_0x1682d1][_0xe8a5('0x55')]({'plain':!![]});_0x41f309['push'](db[_0xe8a5('0x59')][_0xe8a5('0x5d')](_0x76faaa(_0x5d3fbe,_0xe8a5('0x5f')))[_0xe8a5('0x32')](function(){})['catch'](_0x5a5bf2()));}}return _0x41f309;})[_0xe8a5('0x5b')]();})[_0xe8a5('0x34')](function(_0x13f0a5){logger[_0xe8a5('0x16')]('cmContact,\x20%s,\x20%s',_0xe8a5('0x61'),_0x13f0a5[_0xe8a5('0x1f')]);});}var processPromises=function(_0x528bd8){return BPromise['all'](promises)[_0xe8a5('0x32')](function(_0x56d10f){})['catch'](function(_0xfce70a){logger[_0xe8a5('0x16')](_0xe8a5('0x62'),JSON['stringify'](_0xfce70a));})[_0xe8a5('0x63')](function(){socket[_0xe8a5('0x64')](_0xe8a5('0x65')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x528bd8){return _0x528bd8[_0xe8a5('0x66')]();}});};var endCsv=function(){return BPromise[_0xe8a5('0x67')]()[_0xe8a5('0x32')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xe8a5('0x64')](_0xe8a5('0x65')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xe8a5('0x68')](FILEPATH);}catch(_0x538525){logger[_0xe8a5('0x16')](_0xe8a5('0x69'),JSON['stringify'](_0x538525));}finally{process['exit'](0x0);}});};process['on'](_0xe8a5('0x6a'),function(){logger[_0xe8a5('0x6b')](_0xe8a5('0x6c'));endCsv();});function main(){return BPromise[_0xe8a5('0x67')]()[_0xe8a5('0x32')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xe8a5('0x14')](',');return db[_0xe8a5('0x6d')][_0xe8a5('0x51')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xe8a5('0x32')](function(_0x224a31){var _0x18f58a=fs[_0xe8a5('0x6e')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xe8a5('0x6f')](_0x18f58a,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1ebf1d,_0x4ff4b5){total+=0x1;var _0x2c2820=total;promises[_0xe8a5('0x58')](checkRow(_0x1ebf1d,_0x224a31,_0x2c2820)[_0xe8a5('0x32')](function(){success+=0x1;})[_0xe8a5('0x34')](function(_0x191b53){if(_0x191b53[_0xe8a5('0x16')]){errors+=0x1;delete _0x191b53['error'];}else if(_0x191b53['duplicate']){duplicates+=0x1;delete _0x191b53[_0xe8a5('0x2e')];}rows['push'](_0x191b53);}));if(total%0xc8===0x0){_0x4ff4b5[_0xe8a5('0x70')]();return processPromises(_0x4ff4b5);}},'complete':function(){return processPromises()[_0xe8a5('0x32')](function(){logger[_0xe8a5('0x6b')](_0xe8a5('0x71'));endCsv();});},'error':function(_0x282338,_0x2aa62c){logger[_0xe8a5('0x6b')](_0xe8a5('0x72'),JSON[_0xe8a5('0x36')](_0x282338));endCsv();}});})['catch'](function(_0x42eb16){logger[_0xe8a5('0x16')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xe8a5('0x36')](_0x42eb16));});}main();
\ No newline at end of file
index 9d8eac1..b46fed5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0357=['root','includes','ContactItemType','name','_description','header','writeFileSync','data','rows','find','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','step','duplicates','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','server/files/tmp','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','parse','No\x20agent\x20available','uncaughtException','path','papaparse','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','length','all','then','AdditionalPhones','split','push','isNil','filter','CmContactHasItem','findOne','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','scheduledat','ContactId','createdAt','updatedAt','priority','UserId','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_contacts.ListId','into','cm_hopper_black','fromQuery','fields','cm_contacts','ListId\x20=\x20?','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ListId','\x22onlyIfOpen\x22','field','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','exit','errors','code','message','sequelize','query','catch','error','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','spread','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','utcOffset','set','offset','dialTimezone','main','stringify','send','binding','socket_timestamp'];(function(_0x126ad6,_0x5380b1){var _0x131e93=function(_0x43bf29){while(--_0x43bf29){_0x126ad6['push'](_0x126ad6['shift']());}};_0x131e93(++_0x5380b1);}(_0x0357,0x1b9));var _0x7035=function(_0x2d7c29,_0x48be56){_0x2d7c29=_0x2d7c29-0x0;var _0x891916=_0x0357[_0x2d7c29];return _0x891916;};'use strict';var fs=require('fs');var path=require(_0x7035('0x0'));var _=require('lodash');var Papa=require(_0x7035('0x1'));var util=require('util');var BPromise=require(_0x7035('0x2'));var moment=require(_0x7035('0x3'));var squel=require(_0x7035('0x4'));var Redis=require(_0x7035('0x5'));var db=require(_0x7035('0x6'))['db'];var config=require(_0x7035('0x7'));var shared=require(_0x7035('0x8'));var logger=require(_0x7035('0x9'))('import');config['redis']=_[_0x7035('0xa')](config[_0x7035('0xb')],{'host':_0x7035('0xc'),'port':0x18eb});var socket=require(_0x7035('0xd'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x7035('0xe')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x7035('0xe')](_0x7035('0xf'));function isEmail(_0x1a4e3f){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x7035('0x10')](_0x1a4e3f);}function selectNotIn(_0x755ea0,_0x19d5bd,_0x4dfc0a,_0x25fe8f,_0x147fc0){return squel[_0x7035('0x11')]()['field'](_0x7035('0x12'))[_0x7035('0x13')](_0x25fe8f)[_0x7035('0x14')](_0x19d5bd,null,_0x19d5bd+_0x7035('0x15')+_0x25fe8f+'.'+_0x4dfc0a)[_0x7035('0x16')](_0x25fe8f+'.'+_0x4dfc0a+_0x7035('0x17')+_0x755ea0+'.'+_0x4dfc0a)[_0x7035('0x16')](_0x19d5bd+_0x7035('0x18')+_0x147fc0['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0xc3c3d4,_0x59dfa5){promisesAdditionalPhones=[];return db[_0x7035('0x19')][_0x7035('0x1a')]({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x372793){if(_0x372793!==null){var _0x3bce35=[];for(var _0x19f836=0x0;_0x19f836<_0x372793[_0x7035('0x1b')];_0x19f836++){var _0x45eae2=_0x372793[_0x19f836];_0x3bce35['push'](insertAdditionalPhones(_0x45eae2));}}Promise[_0x7035('0x1c')](_0x3bce35)[_0x7035('0x1d')](function(){_0xc3c3d4({'val':0x1});});});});}function insertAdditionalPhones(_0x353b54){return new Promise(function(_0x183a68,_0x76b4ac){var _0x4f038b=_0x353b54[_0x7035('0x1e')];var _0x5350cd=_0x4f038b[_0x7035('0x1f')](';');var _0x32a03d=[];orderBy=0x0;for(var _0x154994=0x0;_0x154994<_0x5350cd[_0x7035('0x1b')];_0x154994++){_0x32a03d[_0x7035('0x20')](splitAdditionalPhone(_0x353b54['id'],_0x5350cd[_0x154994]));}Promise['all'](_0x32a03d)[_0x7035('0x1d')](function(){_0x183a68({'val':_0x5350cd['length']});});});}function splitAdditionalPhone(_0x2fb393,_0x552b2a){return new Promise(function(_0x1a0462,_0x141803){var _0x2b0e32=_0x552b2a[_0x7035('0x1f')](':');var _0x1a5113=_0x2b0e32[0x0];var _0x2e8b48=_0x2b0e32[0x1];if(!_[_0x7035('0x21')](_0x2e8b48)){var _0x21ecb4=_0x2e8b48['split']('|');var _0x33bfa0=[];for(var _0x3d704d=0x0;_0x3d704d<_0x21ecb4[_0x7035('0x1b')];_0x3d704d++){if(_0x21ecb4[_0x3d704d]!==''){var _0x29e8c8=_[_0x7035('0x22')](promisesAdditionalPhones,{'contactId':_0x2fb393,'phone':_0x21ecb4[_0x3d704d]});if(_0x29e8c8[_0x7035('0x1b')]==0x0){orderBy++;promisesAdditionalPhones[_0x7035('0x20')]({'contactId':_0x2fb393,'contactTypeId':_0x1a5113,'phone':_0x21ecb4[_0x3d704d],'orderBy':orderBy});}}}_0x1a0462({'ok':0x1});}else _0x1a0462({'res':0x0});});}function createAdditionalPhone(_0x5ddff2,_0x26fa78,_0x5d2603,_0x504b27){var _0x16f94c='';var _0x271578='';var _0x5324da=_0x5d2603[_0x7035('0x1f')]('§');_0x16f94c=_0x5324da[0x0];if(_0x5324da[_0x7035('0x1b')]==0x2)_0x271578=_0x5324da[0x1];return new Promise(function(_0x34a14a,_0x20c693){return db[_0x7035('0x23')][_0x7035('0x24')]({'where':{'CmContactId':_0x5ddff2,'item':_0x16f94c}})['then'](function(_0x3ae2ae){if(_0x3ae2ae){return db['CmContactHasItem']['update']({'ItemTypeId':_0x26fa78,'description':_0x271578,'OrderBy':_0x504b27},{'where':{'CmContactId':_0x5ddff2,'item':_0x16f94c}})['then'](function(_0x1cde3f){_0x34a14a({'res':_0x7035('0x25')});});}else{return db[_0x7035('0x23')][_0x7035('0x26')]({'CmContactId':_0x5ddff2,'item':_0x16f94c,'description':_0x271578,'ItemTypeId':_0x26fa78,'OrderBy':_0x504b27,'ItemClass':_0x7035('0x27')})[_0x7035('0x1d')](function(_0x815aa4){_0x34a14a({'res':_0x7035('0x28')});});}});});}function insertCmHopper(_0x1afa89,_0x11aa9c,_0x17327f,_0x4fed8d,_0xf8ffb){var _0x5dcc91=[_0x7035('0x29'),_0x7035('0x2a'),_0x7035('0x2b'),'cm_contacts.ListId',_0x11aa9c+'.'+_0x4fed8d,_0x7035('0x2c'),_0x7035('0x2d'),_0x7035('0x2e'),_0x7035('0x2f'),'\x22'+_0xf8ffb+'\x22'];return squel[_0x7035('0x30')]()['into'](_0x7035('0x31'))['fromQuery']([_0x7035('0x12'),_0x7035('0x32'),_0x7035('0x33'),'ListId',_0x4fed8d,_0x7035('0x34'),_0x7035('0x35'),_0x7035('0x36'),_0x7035('0x37'),'recallme'],squel[_0x7035('0x11')]()['fields'](_0x5dcc91)[_0x7035('0x13')](_0x11aa9c)[_0x7035('0x14')]('cm_contacts',null,_0x7035('0x38')+_0x11aa9c+_0x7035('0x39'))[_0x7035('0x14')](_0x17327f,null,_0x17327f+_0x7035('0x15')+_0x11aa9c+'.'+_0x4fed8d)[_0x7035('0x16')](_0x11aa9c+_0x7035('0x3a'),_0x1afa89)[_0x7035('0x16')](_0x7035('0x3b'),NOW)[_0x7035('0x16')](_0x7035('0x3c'),selectNotIn(_0x11aa9c,_0x17327f,_0x4fed8d,_0x7035('0x31'),[_0x7035('0x3d'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x11aa9c,_0x17327f,_0x4fed8d,'cm_hopper',['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x3d325a,_0x447264,_0x3f27f6,_0x203eaf){var _0x2b9d5e=[_0x7035('0x29'),'cm_contacts.id',_0x7035('0x3e'),_0x447264+'.'+_0x203eaf,_0x7035('0x2c'),_0x7035('0x2d')];return squel['insert']()[_0x7035('0x3f')](_0x7035('0x40'))[_0x7035('0x41')](['phone',_0x7035('0x33'),'ListId',_0x203eaf,_0x7035('0x34'),_0x7035('0x35')],squel[_0x7035('0x11')]()[_0x7035('0x42')](_0x2b9d5e)[_0x7035('0x13')](_0x447264)[_0x7035('0x14')](_0x7035('0x43'),null,_0x7035('0x38')+_0x447264+_0x7035('0x39'))[_0x7035('0x14')](_0x3f27f6,null,_0x3f27f6+_0x7035('0x15')+_0x447264+'.'+_0x203eaf)[_0x7035('0x16')](_0x447264+_0x7035('0x3a'),_0x3d325a)['where'](_0x7035('0x3b'),NOW)[_0x7035('0x16')](_0x7035('0x3c'),squel['select']()['field'](_0x7035('0x12'))[_0x7035('0x13')]('cm_hopper_black')[_0x7035('0x16')](_0x7035('0x44'),_0x3d325a)[_0x7035('0x16')](_0x203eaf+'\x20=\x20'+_0x447264+'.'+_0x203eaf)))[_0x7035('0x45')]();}function insertTzCmHopper(_0x2de659,_0x1ce7d1,_0x2a9060,_0x29561c,_0x1c1e8c,_0x8122bb){var _0x2e4121=[_0x7035('0x29'),_0x7035('0x46')+_0x8122bb+_0x7035('0x47'),'cm_contacts.id',_0x7035('0x3e'),_0x1ce7d1+'.'+_0x29561c,_0x7035('0x2c'),_0x7035('0x2d'),_0x7035('0x2e'),_0x7035('0x2f'),'\x22'+_0x1c1e8c+'\x22'];var _0xd2be44=squel[_0x7035('0x30')]()[_0x7035('0x3f')]('cm_hopper')['fromQuery']([_0x7035('0x12'),_0x7035('0x32'),'ContactId',_0x7035('0x48'),_0x29561c,_0x7035('0x34'),_0x7035('0x35'),_0x7035('0x36'),_0x7035('0x37'),'recallme'],squel[_0x7035('0x11')]()['fields'](_0x2e4121)[_0x7035('0x13')](_0x1ce7d1)['join']('cm_contacts',null,_0x7035('0x38')+_0x1ce7d1+_0x7035('0x39'))[_0x7035('0x14')](_0x2a9060,null,_0x2a9060+_0x7035('0x15')+_0x1ce7d1+'.'+_0x29561c)[_0x7035('0x14')](_0x8122bb,null,_0x8122bb+_0x7035('0x15')+_0x1ce7d1+'.'+_0x29561c)[_0x7035('0x16')](_0x1ce7d1+_0x7035('0x3a'),_0x2de659)['where'](_0x7035('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1ce7d1,_0x2a9060,_0x29561c,_0x7035('0x31'),[_0x7035('0x3d'),_0x7035('0x49')]))[_0x7035('0x16')](_0x7035('0x3c'),selectNotIn(_0x1ce7d1,_0x2a9060,_0x29561c,_0x7035('0x31'),[_0x7035('0x3d')])))[_0x7035('0x45')]();return _0xd2be44;}function insertTzCmHopperBlack(_0x416f63,_0xce9f42,_0x55151b,_0x34034e){var _0x5dacac=[_0x7035('0x29'),'cm_contacts.id',_0x7035('0x3e'),_0xce9f42+'.'+_0x34034e,_0x7035('0x2c'),_0x7035('0x2d')];return squel[_0x7035('0x30')]()[_0x7035('0x3f')](_0x7035('0x40'))[_0x7035('0x41')](['phone',_0x7035('0x33'),'ListId',_0x34034e,'createdAt',_0x7035('0x35')],squel[_0x7035('0x11')]()[_0x7035('0x42')](_0x5dacac)['from'](_0xce9f42)[_0x7035('0x14')](_0x7035('0x43'),null,_0x7035('0x38')+_0xce9f42+_0x7035('0x39'))[_0x7035('0x14')](_0x55151b,null,_0x55151b+_0x7035('0x15')+_0xce9f42+'.'+_0x34034e)[_0x7035('0x16')](_0xce9f42+'.CmListId\x20=\x20?',_0x416f63)[_0x7035('0x16')](_0x7035('0x3b'),NOW)[_0x7035('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x7035('0x11')]()[_0x7035('0x4a')](_0x7035('0x12'))[_0x7035('0x13')](_0x7035('0x40'))['where'](_0x7035('0x44'),_0x416f63)[_0x7035('0x16')](_0x34034e+_0x7035('0x17')+_0xce9f42+'.'+_0x34034e)))[_0x7035('0x45')]();}function insertCmHopperAdditionalPhones(_0x382c99){var _0x156daf=[_0x7035('0x4b'),_0x7035('0x4c'),_0x7035('0x4d'),_0x7035('0x4e'),_0x7035('0x4f')];return squel['insert']()[_0x7035('0x3f')](_0x7035('0x50'))['fromQuery']([_0x7035('0x51'),'phone',_0x7035('0x52'),_0x7035('0x34'),_0x7035('0x35')],squel['select']()[_0x7035('0x42')](_0x156daf)[_0x7035('0x13')]('cm_hopper')['join'](_0x7035('0x43'),null,_0x7035('0x53'))[_0x7035('0x14')](_0x7035('0x54'),null,_0x7035('0x55'))['where']('cm_hopper.ListId\x20=\x20?',_0x382c99)[_0x7035('0x16')](_0x7035('0x3b'),NOW))['toString']();}function insertCmContact(_0x20f880,_0x2c7541,_0x99369c,_0x4a90e2){var _0x40c4a9=_[_0x7035('0x56')](_[_0x7035('0x57')](_0x4a90e2),[_0x7035('0x48'),_0x7035('0x58'),'createdAt','updatedAt','scheduledAt']);return squel['insert']()[_0x7035('0x3f')](_0x7035('0x43'))[_0x7035('0x41')](_0x40c4a9,squel[_0x7035('0x11')]()[_0x7035('0x42')](_0x40c4a9)[_0x7035('0x13')](_0x2c7541)[_0x7035('0x16')]('('+_0x99369c[_0x7035('0x14')](',')+_0x7035('0x59'),squel[_0x7035('0x11')]()[_0x7035('0x42')](_0x99369c)['from'](_0x7035('0x43'))[_0x7035('0x16')](_0x7035('0x44'),_0x20f880)[_0x7035('0x16')]('deletedAt\x20IS\x20NULL'))['where'](_0x7035('0x5a'),squel[_0x7035('0x11')]()[_0x7035('0x4a')](_0x7035('0x5b'),_0x7035('0x5c'))[_0x7035('0x13')](_0x2c7541)[_0x7035('0x5d')](_0x99369c['join'](','))))[_0x7035('0x45')]();}function handleStop(){logger[_0x7035('0x5e')](_0x7035('0x5f'));stopped=!![];}function handleUncaughtException(_0x54ef4b){logger['error'](_0x54ef4b['message']);process[_0x7035('0x60')](0x1);}function handleError(_0x206392,_0x1e61ef){stats[_0x7035('0x61')][_0x7035('0x20')]({'name':_0x1e61ef[_0x7035('0x62')],'message':_0x1e61ef[_0x7035('0x63')],'row':_0x206392});}function handleQuery(_0x5f5488){logger[_0x7035('0x5e')](_0x5f5488);return db[_0x7035('0x64')][_0x7035('0x65')](_0x5f5488)['spread'](function(_0x14350c){results[_0x7035('0x20')](_0x14350c);})[_0x7035('0x66')](function(_0x46154d){logger[_0x7035('0x67')](_0x46154d[_0x7035('0x63')]);});}function updateTzCampaigns(_0x40f4a2){return new Promise(function(_0x5a9a90,_0x46cdd2){var _0x3d1808=squel['select']()['fields']([_0x7035('0x68'),_0x7035('0x69')])['from'](_0x7035('0x6a'))[_0x7035('0x14')](_0x7035('0x6b'),null,_0x7035('0x6c'))[_0x7035('0x16')](_0x7035('0x6d')+_0x40f4a2);db[_0x7035('0x64')][_0x7035('0x65')](_0x3d1808['toString']())[_0x7035('0x6e')](function(_0x518800){var _0x1a885a=[];for(var _0x27adb4=0x0;_0x27adb4<_0x518800[_0x7035('0x1b')];_0x27adb4++){_0x1a885a['push'](getTimezoneData(_0x518800[_0x27adb4],tmp_campaigns));}BPromise[_0x7035('0x1c')](_0x1a885a)[_0x7035('0x1d')](function(){_0x5a9a90({'val':0x1});});})[_0x7035('0x66')](function(_0x219137){logger[_0x7035('0x67')](_0x219137[_0x7035('0x63')]);_0x5a9a90({'val':0x0});});});}function updateTzVoiceQueues(_0x52b377){return new Promise(function(_0x5383fa,_0x4d5bd6){var _0x453593=squel[_0x7035('0x11')]()[_0x7035('0x42')]([_0x7035('0x6f'),_0x7035('0x70')])[_0x7035('0x13')](_0x7035('0x71'))[_0x7035('0x14')](_0x7035('0x72'),null,_0x7035('0x73'))[_0x7035('0x16')](_0x7035('0x74')+_0x52b377);db[_0x7035('0x64')][_0x7035('0x65')](_0x453593[_0x7035('0x45')]())[_0x7035('0x6e')](function(_0x1c2c36){var _0x2cdab4=[];for(var _0x5eec44=0x0;_0x5eec44<_0x1c2c36[_0x7035('0x1b')];_0x5eec44++){_0x2cdab4[_0x7035('0x20')](getTimezoneData(_0x1c2c36[_0x5eec44],tmp_voice_queues));}BPromise[_0x7035('0x1c')](_0x2cdab4)[_0x7035('0x1d')](function(){_0x5383fa({'val':0x1});});})['catch'](function(_0x563c05){logger[_0x7035('0x67')](_0x563c05[_0x7035('0x63')]);_0x5383fa({'val':0x0});});});}function getTimezoneData(_0xe88f15,_0x2eb3c9){return new Promise(function(_0x583ae,_0x18b830){var _0x1d6287=shared['timezones'];var _0x7d544e=_0x1d6287[_0xe88f15['dialTimezone']];if(_[_0x7035('0x21')](_0x7d544e)){_0x583ae({'ret':0x1});}else{var _0x45fe13=_0x7d544e[_0x7035('0x75')];var _0x1f8c3e=squel[_0x7035('0x30')]()[_0x7035('0x3f')](_0x2eb3c9)[_0x7035('0x76')]('id',_0xe88f15['id'])['set'](_0x7035('0x77'),_0x45fe13)[_0x7035('0x76')](_0x7035('0x78'),_0xe88f15['dialTimezone'])['toString']();return db[_0x7035('0x64')]['query'](_0x1f8c3e)[_0x7035('0x6e')](function(_0xf29bf8){_0x583ae({'ret':0x1});})[_0x7035('0x66')](function(_0x2dba65){logger['error'](_0x2dba65[_0x7035('0x63')]);_0x18b830({'ret':0x1});});}});}function handleTZQuery(_0x5943cf){logger[_0x7035('0x5e')](_0x5943cf);return db['sequelize'][_0x7035('0x65')](_0x5943cf)[_0x7035('0x6e')](function(_0x458fa){})['catch'](function(_0x3533fa){logger[_0x7035('0x67')](_0x3533fa[_0x7035('0x63')]);});}function main(_0x39dd67,_0x4f779e,_0x2385ae,_0x3ab5a4){logger[_0x7035('0x5e')](_0x7035('0x79'),_0x39dd67,JSON[_0x7035('0x7a')](_0x4f779e));process[_0x7035('0x7b')]('start');var _0x1803c1=_0x4f779e[_0x7035('0x7c')];var _0x6fa5ec=_['clone'](_0x1803c1);var _0x39d819=_0x4f779e[_0x7035('0x7d')];var _0x2f25a2=path['join'](config[_0x7035('0x7e')],'server/files/tmp',_0x39d819+'.csv');hasTZ=_['keys'](_0x1803c1)[_0x7035('0x7f')]('dialTimezone');var _0x4e001c=_['keys'](_0x1803c1)[_0x7035('0x14')]();logger[_0x7035('0x5e')]('header',_0x4e001c);db[_0x7035('0x80')][_0x7035('0x1a')]({'raw':!![],'attributes':['id',_0x7035('0x81')]})[_0x7035('0x1d')](function(_0x43ca66){for(var _0x376c97=0x0;_0x376c97<_0x43ca66[_0x7035('0x1b')];_0x376c97++){if(_0x43ca66[_0x376c97]['name']in _0x1803c1){contactItemTypes[_0x7035('0x20')](_0x43ca66[_0x376c97]);delete _0x6fa5ec[_0x43ca66[_0x376c97][_0x7035('0x81')]];hasAdditionalPhones=!![];}for(var _0x46f7e5 in _0x1803c1){if(_0x43ca66[_0x376c97][_0x7035('0x81')]+_0x7035('0x82')===_0x46f7e5){phoneDescriptions[_0x7035('0x20')]({'itemTypeId':_0x43ca66[_0x376c97]['id'],'description':_0x46f7e5});delete _0x6fa5ec[_0x46f7e5];}}}if(hasAdditionalPhones)_0x6fa5ec['AdditionalPhones']='';var _0x189df9=_[_0x7035('0x57')](_0x6fa5ec)[_0x7035('0x14')]();logger[_0x7035('0x5e')](_0x7035('0x83'),_0x189df9);fs[_0x7035('0x84')](_0x2f25a2,_0x189df9+'\x0a');Papa['parse'](fs['createReadStream'](_0x39dd67),{'header':!![],'skipEmptyLines':!![],'step':function(_0x450d37,_0x120e7f){try{for(var _0x4f6ace=0x0,_0x31947c=[];_0x4f6ace<_0x450d37[_0x7035('0x85')][_0x7035('0x1b')];_0x4f6ace++){stats[_0x7035('0x86')]+=0x1;if(_0x450d37[_0x7035('0x61')][_0x4f6ace]){handleError(_0x450d37[_0x7035('0x85')][_0x4f6ace],_0x450d37[_0x7035('0x61')][_0x4f6ace]);}else{var _0x12b09f=[];var _0x1b26cf=[];var _0x4cf0bc={};for(var _0x2f94c0 in _0x1803c1){let _0x2fca06=contactItemTypes['find'](_0x1e8112=>_0x1e8112[_0x7035('0x81')]===_0x2f94c0);let _0x33ef1e=contactItemTypes[_0x7035('0x87')](_0x27807c=>_0x27807c[_0x7035('0x81')]+_0x7035('0x82')===_0x2f94c0);if(_[_0x7035('0x21')](_0x2fca06)&&_[_0x7035('0x21')](_0x33ef1e)){if(_0x1803c1['hasOwnProperty'](_0x2f94c0)){if(_0x450d37[_0x7035('0x85')][_0x4f6ace][_0x1803c1[_0x2f94c0]]){var _0x102d97=_[_0x7035('0x88')](_0x450d37[_0x7035('0x85')][_0x4f6ace][_0x1803c1[_0x2f94c0]]['replace'](/"/g,'\x27'));switch(_0x2f94c0){case _0x7035('0x32'):var _0x1f9330=moment(_0x102d97,_0x7035('0xf'),!![]);if(_0x1f9330[_0x7035('0x89')]()){_0x31947c[_0x7035('0x20')]('\x22'+_0x102d97+'\x22');}else{_0x12b09f['push'](_0x7035('0x8a'));}break;case _0x7035('0x36'):var _0x3a99ea=parseInt(_0x102d97);_0x102d97=_['isNaN'](_0x3a99ea)||_0x3a99ea<0x0||_0x3a99ea>0x4?_0x3ab5a4?0x3:0x2:_0x3a99ea;_0x31947c['push']('\x22'+_0x102d97+'\x22');break;case _0x7035('0x37'):var _0x40ec7a=parseInt(_0x102d97);if(_[_0x7035('0x8b')](_0x40ec7a)&&_['includes'](_0x2385ae,_0x40ec7a)){_0x31947c[_0x7035('0x20')]('\x22'+_0x40ec7a+'\x22');}else{_0x12b09f[_0x7035('0x20')](_0x7035('0x8c'));}break;case'email':if(isEmail(_0x102d97)){_0x31947c[_0x7035('0x20')]('\x22'+_0x102d97+'\x22');}else{_0x12b09f[_0x7035('0x20')](_0x7035('0x8d'));}break;case _0x7035('0x8e'):var _0x271d70=moment(_0x102d97,_0x7035('0x8f'),!![]);if(_0x271d70[_0x7035('0x89')]()){_0x31947c['push']('\x22'+_0x102d97+'\x22');}else{_0x12b09f[_0x7035('0x20')](_0x7035('0x90'));}break;case'dialTimezone':var _0x4f9345=shared['timezones'];var _0x1fcd66=_0x4f9345[_0x102d97];if(!_[_0x7035('0x21')](_0x1fcd66)){var _0x34f7cb=_0x1fcd66[_0x7035('0x75')];_0x31947c[_0x7035('0x20')]('\x22'+_0x102d97+'\x22');_0x31947c[_0x7035('0x20')]('\x22'+_0x34f7cb+'\x22');}break;default:_0x31947c[_0x7035('0x20')]('\x22'+_0x102d97+'\x22');}}else{switch(_0x2f94c0){case _0x7035('0x91'):case'phone':_0x12b09f[_0x7035('0x20')](_0x2f94c0+_0x7035('0x92'));break;default:_0x31947c['push']('\x22\x22');}}}}else{var _0x2b7f7e='';if(!_[_0x7035('0x21')](_0x2fca06)){if(!_0x4cf0bc[_0x7035('0x93')](_0x2fca06['id'])){if(!_[_0x7035('0x21')](_0x450d37[_0x7035('0x85')][_0x4f6ace][_0x1803c1[_0x2f94c0]])){var _0x102d97=_[_0x7035('0x88')](_0x450d37[_0x7035('0x85')][_0x4f6ace][_0x1803c1[_0x2f94c0]][_0x7035('0x94')](/"/g,'\x27'));var _0x277f38=phoneDescriptions[_0x7035('0x87')](_0x25494f=>_0x25494f[_0x7035('0x95')]===_0x2fca06['id']);if(!_[_0x7035('0x21')](_0x277f38)){var _0x55086f=_[_0x7035('0x88')](_0x450d37[_0x7035('0x85')][_0x4f6ace][_0x1803c1[_0x277f38[_0x7035('0x96')]]][_0x7035('0x94')](/"/g,'\x27'));if(!_[_0x7035('0x21')](_0x55086f))_0x102d97=_0x102d97+'§'+_0x55086f;}if(_0x2b7f7e=='')_0x2b7f7e=_0x102d97;else _0x2b7f7e+='|'+_0x102d97;}_0x1b26cf['push'](_0x2fca06['id']+':'+_0x2b7f7e);_0x4cf0bc[_0x2fca06['id']]=0x1;}}}}if(hasAdditionalPhones){_0x31947c[_0x7035('0x20')]('\x22'+_0x1b26cf[_0x7035('0x14')](';')+'\x22');}if(_0x12b09f[_0x7035('0x1b')]){handleError(_0x450d37[_0x7035('0x85')][_0x4f6ace],{'code':_0x7035('0x97'),'message':_0x12b09f['join']()});}else{fs[_0x7035('0x98')](_0x2f25a2,_0x31947c['join']()+'\x0a');}_0x31947c=[];}if(!(stats['rows']%0xc8)){socket[_0x7035('0x99')](_0x7035('0x9a')+_0x39d819,stats);stats['errors']=[];}}if(stopped){logger[_0x7035('0x5e')]('Abort\x20parser');_0x120e7f[_0x7035('0x9b')]();}}catch(_0x14c99d){handleError(_0x450d37[_0x7035('0x85')][_0x4f6ace],{'code':_0x7035('0x9c'),'message':_0x14c99d['message']});logger['error'](_0x7035('0x9d'),_0x14c99d[_0x7035('0x63')]);}},'complete':function(){try{var _0x1a6c90=[];var _0x192fc2=[];var _0x21894c=_0x7035('0x43');if(_0x4f779e[_0x7035('0x9e')]&&_0x4f779e[_0x7035('0x9e')]['length']){_0x21894c='cm_contacts_'+_0x39d819;_0x1a6c90[_0x7035('0x20')]('CREATE\x20TABLE\x20'+_0x21894c+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x7035('0x9f')+_0x39d819;tmp_voice_queues=_0x7035('0xa0')+_0x39d819;_0x192fc2[_0x7035('0x20')]('CREATE\x20TABLE\x20'+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x192fc2[_0x7035('0x20')](_0x7035('0xa1')+tmp_voice_queues+_0x7035('0xa2'));BPromise[_0x7035('0xa3')](_0x192fc2,handleTZQuery)[_0x7035('0x1d')](function(_0x27d8e1){updateTzCampaigns(_0x4f779e[_0x7035('0x48')])['then'](function(_0x1c1e86){updateTzVoiceQueues(_0x4f779e[_0x7035('0x48')])[_0x7035('0x1d')](function(_0x5e632d){if(hasTZ)_0x189df9=_0x189df9[_0x7035('0x94')](_0x7035('0x78'),_0x7035('0xa4'));var _0x34b488=util[_0x7035('0xe')](_0x7035('0xa5'),_0x2f25a2,_0x21894c,_0x189df9,_0x4f779e[_0x7035('0x48')],_0x4f779e[_0x7035('0x58')]||null,NOW,NOW);if(_[_0x7035('0x21')](_0x1803c1[_0x7035('0x32')])){_0x34b488+=',\x20scheduledAt\x20=\x20NOW()';}_0x1a6c90[_0x7035('0x20')](_0x34b488);if(_0x4f779e[_0x7035('0x9e')]&&_0x4f779e[_0x7035('0x9e')]['length']){_0x1a6c90[_0x7035('0x20')](insertCmContact(_0x4f779e[_0x7035('0x48')],_0x21894c,_0x4f779e[_0x7035('0x9e')],_0x1803c1));_0x1a6c90[_0x7035('0x20')]('DROP\x20TABLE\x20'+_0x21894c+';');}BPromise[_0x7035('0xa3')](_0x1a6c90,handleQuery)['then'](function(_0x5f1f89){BPromise[_0x7035('0x1c')]([handleAdditionalPhones()])[_0x7035('0x1d')](function(){_0x1a6c90=[];for(var _0x3fd166=0x0;_0x3fd166<promisesAdditionalPhones[_0x7035('0x1b')];_0x3fd166++){if(promisesAdditionalPhones[_0x3fd166][_0x7035('0x12')]!='§'){_0x1a6c90[_0x7035('0x20')](createAdditionalPhone(promisesAdditionalPhones[_0x3fd166][_0x7035('0xa6')],promisesAdditionalPhones[_0x3fd166][_0x7035('0xa7')],promisesAdditionalPhones[_0x3fd166]['phone'],promisesAdditionalPhones[_0x3fd166][_0x7035('0xa8')]));}}BPromise[_0x7035('0x1c')](_0x1a6c90)[_0x7035('0x1d')](function(){_0x1a6c90=[];if(hasTZ){_0x1a6c90[_0x7035('0x20')](insertTzCmHopper(_0x4f779e[_0x7035('0x48')],'voice_queues_has_cm_lists',_0x7035('0x71'),_0x7035('0xa9'),_0x3ab5a4,tmp_voice_queues));_0x1a6c90[_0x7035('0x20')](insertTzCmHopperBlack(_0x4f779e['ListId'],_0x7035('0xaa'),_0x7035('0x71'),_0x7035('0xa9')));_0x1a6c90['push'](insertTzCmHopper(_0x4f779e[_0x7035('0x48')],_0x7035('0x6b'),_0x7035('0x6a'),_0x7035('0xab'),_0x3ab5a4,tmp_campaigns));_0x1a6c90[_0x7035('0x20')](insertTzCmHopperBlack(_0x4f779e[_0x7035('0x48')],_0x7035('0xac'),'campaigns',_0x7035('0xab')));_0x1a6c90['push'](insertCmHopperAdditionalPhones(_0x4f779e['ListId']));}else{_0x1a6c90[_0x7035('0x20')](insertCmHopper(_0x4f779e[_0x7035('0x48')],_0x7035('0x72'),_0x7035('0x71'),_0x7035('0xa9'),_0x3ab5a4));_0x1a6c90[_0x7035('0x20')](insertCmHopperBlack(_0x4f779e['ListId'],_0x7035('0xaa'),_0x7035('0x71'),_0x7035('0xa9')));_0x1a6c90[_0x7035('0x20')](insertCmHopper(_0x4f779e[_0x7035('0x48')],_0x7035('0x6b'),_0x7035('0x6a'),_0x7035('0xab'),_0x3ab5a4));_0x1a6c90[_0x7035('0x20')](insertCmHopperBlack(_0x4f779e[_0x7035('0x48')],_0x7035('0xac'),_0x7035('0x6a'),_0x7035('0xab')));_0x1a6c90[_0x7035('0x20')](insertCmHopperAdditionalPhones(_0x4f779e['ListId']));}_0x1a6c90['push']('DROP\x20TABLE\x20'+tmp_campaigns+';');_0x1a6c90['push']('DROP\x20TABLE\x20'+tmp_voice_queues+';');BPromise['each'](_0x1a6c90,handleQuery)[_0x7035('0x1d')](function(_0x5e0236){stats[_0x7035('0xad')]=!![];stats[_0x7035('0xae')]=_0x4f779e[_0x7035('0x9e')]&&_0x4f779e[_0x7035('0x9e')][_0x7035('0x1b')]?results[0x2][_0x7035('0xae')]:results[0x0][_0x7035('0xae')];socket[_0x7035('0x99')]('contact:import:'+_0x39d819,stats);fs['unlink'](_0x39dd67);fs[_0x7035('0xaf')](_0x2f25a2);process[_0x7035('0x60')](0x0);})[_0x7035('0x66')](function(_0x4fa0e5){logger['error'](_0x4fa0e5[_0x7035('0x63')]);process[_0x7035('0x60')](0x1);});});});})[_0x7035('0x66')](function(_0x4d02f0){logger[_0x7035('0x67')](_0x4d02f0[_0x7035('0x63')]);process[_0x7035('0x60')](0x1);});});});});}catch(_0x2be254){logger[_0x7035('0x67')](_0x7035('0xb0'),_0x2be254[_0x7035('0x63')]);process['exit'](0x1);}},'error':function(_0x10cf0b,_0x7c85b2,_0x709eb3,_0x1c1b77){throw new Error(_0x1c1b77);}});});}function validate(){if(process['argv']&&process[_0x7035('0xb1')][_0x7035('0x1b')]<0x4){throw new Error(_0x7035('0xb2'));}var _0x52657d=path['join'](config[_0x7035('0x7e')],_0x7035('0xb3'),process[_0x7035('0xb1')][0x2]);if(!fs['existsSync'](_0x52657d)){throw new Error(_0x7035('0xb4'));}var _0x4475dd={};try{_0x4475dd=JSON['parse'](process[_0x7035('0xb1')][0x3]);if(!_0x4475dd['binding']){throw new Error(_0x7035('0xb5'));}if(!_0x4475dd[_0x7035('0x7c')][_0x7035('0x12')]){throw new Error(_0x7035('0xb6'));}if(!_0x4475dd[_0x7035('0x7c')][_0x7035('0x91')]){throw new Error(_0x7035('0xb7'));}var _0x218712=0x0;if(_0x4475dd[_0x7035('0x7c')][_0x7035('0x37')]){_0x218712=0x1;}if(!_0x4475dd[_0x7035('0x48')]){throw new Error(_0x7035('0xb8'));}}catch(_0x27d534){throw new Error('body\x20id\x20mandatory');}var _0x525efb=[];try{_0x525efb=_[_0x7035('0xb9')](JSON[_0x7035('0xba')](process['argv'][0x4]),'id');}catch(_0xbac4d9){logger[_0x7035('0x5e')](_0x7035('0xbb'));}main(_0x52657d,_0x4475dd,_0x525efb,_0x218712);}validate();process['on']('SIGINT',handleStop);process['on'](_0x7035('0xbc'),handleUncaughtException);
\ No newline at end of file
+var _0x0750=['findOne','CmContactHasItem','update','create','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','select','fields','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.id','cm_contacts.updatedAt','cm_hopper_black','from','cm_contacts','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','cm_contacts.ListId','cm_contacts.ListId\x20=\x20','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','exit','errors','code','message','sequelize','query','spread','catch','campaigns.id','campaigns','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','clone','root','server/files/tmp','.csv','keys','includes','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','rows','find','trim','replace','isValid','isNaN','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','DROP\x20TABLE\x20','contactId','contactTypeId','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_lists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','then','push','all','split','length','isNil'];(function(_0x129d38,_0x33eb62){var _0x1e7227=function(_0x44f024){while(--_0x44f024){_0x129d38['push'](_0x129d38['shift']());}};_0x1e7227(++_0x33eb62);}(_0x0750,0x9b));var _0x0075=function(_0x24bcfd,_0x5dec4a){_0x24bcfd=_0x24bcfd-0x0;var _0x2ea592=_0x0750[_0x24bcfd];return _0x2ea592;};'use strict';var fs=require('fs');var path=require(_0x0075('0x0'));var _=require(_0x0075('0x1'));var Papa=require('papaparse');var util=require(_0x0075('0x2'));var BPromise=require(_0x0075('0x3'));var moment=require(_0x0075('0x4'));var squel=require(_0x0075('0x5'));var Redis=require(_0x0075('0x6'));var db=require(_0x0075('0x7'))['db'];var config=require(_0x0075('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x0075('0x9'))(_0x0075('0xa'));config[_0x0075('0xb')]=_[_0x0075('0xc')](config[_0x0075('0xb')],{'host':_0x0075('0xd'),'port':0x18eb});var socket=require(_0x0075('0xe'))(new Redis(config[_0x0075('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x0075('0xf')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x0075('0xf')](_0x0075('0x10'));function isEmail(_0x51c8a7){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x0075('0x11')](_0x51c8a7);}function selectNotIn(_0x16c298,_0x1ac156,_0x16dc19,_0x261d6e,_0x562fc8){return squel['select']()[_0x0075('0x12')](_0x0075('0x13'))['from'](_0x261d6e)[_0x0075('0x14')](_0x1ac156,null,_0x1ac156+_0x0075('0x15')+_0x261d6e+'.'+_0x16dc19)[_0x0075('0x16')](_0x261d6e+'.'+_0x16dc19+_0x0075('0x17')+_0x16c298+'.'+_0x16dc19)[_0x0075('0x16')](_0x1ac156+_0x0075('0x18')+_0x562fc8[_0x0075('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x529a29,_0xeab4de){promisesAdditionalPhones=[];return db['CmContact'][_0x0075('0x19')]({'raw':!![],'attributes':['id',_0x0075('0x1a')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x0075('0x1b')](function(_0x2e2822){if(_0x2e2822!==null){var _0x23312e=[];for(var _0xf4fbaf=0x0;_0xf4fbaf<_0x2e2822['length'];_0xf4fbaf++){var _0x5e2703=_0x2e2822[_0xf4fbaf];_0x23312e[_0x0075('0x1c')](insertAdditionalPhones(_0x5e2703));}}Promise[_0x0075('0x1d')](_0x23312e)[_0x0075('0x1b')](function(){_0x529a29({'val':0x1});});});});}function insertAdditionalPhones(_0x4f647){return new Promise(function(_0x4478c6,_0x2849ca){var _0x372375=_0x4f647[_0x0075('0x1a')];var _0x189821=_0x372375[_0x0075('0x1e')](';');var _0x15340a=[];orderBy=0x0;for(var _0x2cb1d5=0x0;_0x2cb1d5<_0x189821[_0x0075('0x1f')];_0x2cb1d5++){_0x15340a[_0x0075('0x1c')](splitAdditionalPhone(_0x4f647['id'],_0x189821[_0x2cb1d5]));}Promise[_0x0075('0x1d')](_0x15340a)['then'](function(){_0x4478c6({'val':_0x189821[_0x0075('0x1f')]});});});}function splitAdditionalPhone(_0x57a1df,_0x204f59){return new Promise(function(_0x2d4fc4,_0x1b6267){var _0x464000=_0x204f59[_0x0075('0x1e')](':');var _0x338279=_0x464000[0x0];var _0x313113=_0x464000[0x1];if(!_[_0x0075('0x20')](_0x313113)){var _0x336e4b=_0x313113[_0x0075('0x1e')]('|');var _0x33e973=[];for(var _0x596e20=0x0;_0x596e20<_0x336e4b[_0x0075('0x1f')];_0x596e20++){if(_0x336e4b[_0x596e20]!==''){var _0x53f7f8=_['filter'](promisesAdditionalPhones,{'contactId':_0x57a1df,'phone':_0x336e4b[_0x596e20]});if(_0x53f7f8['length']==0x0){orderBy++;promisesAdditionalPhones[_0x0075('0x1c')]({'contactId':_0x57a1df,'contactTypeId':_0x338279,'phone':_0x336e4b[_0x596e20],'orderBy':orderBy});}}}_0x2d4fc4({'ok':0x1});}else _0x2d4fc4({'res':0x0});});}function createAdditionalPhone(_0x582842,_0xa3a74,_0x359592,_0x5db35a){var _0x433b16='';var _0x5f339b='';var _0x1bf1b3=_0x359592[_0x0075('0x1e')]('§');_0x433b16=_0x1bf1b3[0x0];if(_0x1bf1b3[_0x0075('0x1f')]==0x2)_0x5f339b=_0x1bf1b3[0x1];return new Promise(function(_0x12a54b,_0x557503){return db['CmContactHasItem'][_0x0075('0x21')]({'where':{'CmContactId':_0x582842,'item':_0x433b16}})[_0x0075('0x1b')](function(_0x5c860e){if(_0x5c860e){return db[_0x0075('0x22')][_0x0075('0x23')]({'ItemTypeId':_0xa3a74,'description':_0x5f339b,'OrderBy':_0x5db35a},{'where':{'CmContactId':_0x582842,'item':_0x433b16}})['then'](function(_0x56717c){_0x12a54b({'res':'updated'});});}else{return db[_0x0075('0x22')][_0x0075('0x24')]({'CmContactId':_0x582842,'item':_0x433b16,'description':_0x5f339b,'ItemTypeId':_0xa3a74,'OrderBy':_0x5db35a,'ItemClass':'PHONE'})[_0x0075('0x1b')](function(_0x24f4ce){_0x12a54b({'res':_0x0075('0x25')});});}});});}function insertCmHopper(_0x5d7742,_0x9de254,_0x15d2aa,_0x2decb3,_0x5b916e){var _0x5e9915=[_0x0075('0x26'),_0x0075('0x27'),'cm_contacts.id','cm_contacts.ListId',_0x9de254+'.'+_0x2decb3,_0x0075('0x28'),'cm_contacts.updatedAt',_0x0075('0x29'),_0x0075('0x2a'),'\x22'+_0x5b916e+'\x22'];return squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x0075('0x2d'))[_0x0075('0x2e')]([_0x0075('0x13'),_0x0075('0x2f'),_0x0075('0x30'),_0x0075('0x31'),_0x2decb3,_0x0075('0x32'),_0x0075('0x33'),_0x0075('0x34'),_0x0075('0x35'),_0x0075('0x36')],squel[_0x0075('0x37')]()[_0x0075('0x38')](_0x5e9915)['from'](_0x9de254)[_0x0075('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x9de254+_0x0075('0x39'))[_0x0075('0x14')](_0x15d2aa,null,_0x15d2aa+_0x0075('0x15')+_0x9de254+'.'+_0x2decb3)[_0x0075('0x16')](_0x9de254+_0x0075('0x3a'),_0x5d7742)[_0x0075('0x16')](_0x0075('0x3b'),NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x9de254,_0x15d2aa,_0x2decb3,_0x0075('0x2d'),[_0x0075('0x3c'),_0x0075('0x3d')]))[_0x0075('0x16')](_0x0075('0x3e'),selectNotIn(_0x9de254,_0x15d2aa,_0x2decb3,'cm_hopper',[_0x0075('0x3c')])))[_0x0075('0x3f')]();}function insertCmHopperBlack(_0x371419,_0x892163,_0x2fc247,_0x130880){var _0x4ad8e5=[_0x0075('0x26'),_0x0075('0x40'),'cm_contacts.ListId',_0x892163+'.'+_0x130880,_0x0075('0x28'),_0x0075('0x41')];return squel['insert']()[_0x0075('0x2c')](_0x0075('0x42'))[_0x0075('0x2e')]([_0x0075('0x13'),_0x0075('0x30'),_0x0075('0x31'),_0x130880,'createdAt',_0x0075('0x33')],squel[_0x0075('0x37')]()[_0x0075('0x38')](_0x4ad8e5)[_0x0075('0x43')](_0x892163)[_0x0075('0x14')](_0x0075('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x892163+_0x0075('0x39'))[_0x0075('0x14')](_0x2fc247,null,_0x2fc247+_0x0075('0x15')+_0x892163+'.'+_0x130880)[_0x0075('0x16')](_0x892163+_0x0075('0x3a'),_0x371419)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0075('0x16')](_0x0075('0x3e'),squel['select']()[_0x0075('0x12')](_0x0075('0x13'))[_0x0075('0x43')](_0x0075('0x42'))['where'](_0x0075('0x45'),_0x371419)[_0x0075('0x16')](_0x130880+_0x0075('0x17')+_0x892163+'.'+_0x130880)))[_0x0075('0x3f')]();}function insertTzCmHopper(_0x3183b5,_0x4f7dfa,_0x1f2f6a,_0x71def6,_0x137013,_0x48f729){var _0x3cce0e=[_0x0075('0x26'),_0x0075('0x46')+_0x48f729+_0x0075('0x47'),_0x0075('0x40'),_0x0075('0x48'),_0x4f7dfa+'.'+_0x71def6,_0x0075('0x28'),'cm_contacts.updatedAt',_0x0075('0x29'),'cm_contacts.UserId','\x22'+_0x137013+'\x22'];var _0x5beb7c=squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x0075('0x2d'))[_0x0075('0x2e')](['phone','scheduledat',_0x0075('0x30'),_0x0075('0x31'),_0x71def6,_0x0075('0x32'),_0x0075('0x33'),_0x0075('0x34'),_0x0075('0x35'),_0x0075('0x36')],squel[_0x0075('0x37')]()[_0x0075('0x38')](_0x3cce0e)[_0x0075('0x43')](_0x4f7dfa)[_0x0075('0x14')]('cm_contacts',null,_0x0075('0x49')+_0x4f7dfa+_0x0075('0x39'))['join'](_0x1f2f6a,null,_0x1f2f6a+_0x0075('0x15')+_0x4f7dfa+'.'+_0x71def6)['join'](_0x48f729,null,_0x48f729+'.id\x20=\x20'+_0x4f7dfa+'.'+_0x71def6)[_0x0075('0x16')](_0x4f7dfa+_0x0075('0x3a'),_0x3183b5)[_0x0075('0x16')](_0x0075('0x3b'),NOW)[_0x0075('0x16')](_0x0075('0x3e'),selectNotIn(_0x4f7dfa,_0x1f2f6a,_0x71def6,'cm_hopper',[_0x0075('0x3c'),_0x0075('0x3d')]))[_0x0075('0x16')](_0x0075('0x3e'),selectNotIn(_0x4f7dfa,_0x1f2f6a,_0x71def6,_0x0075('0x2d'),[_0x0075('0x3c')])))[_0x0075('0x3f')]();return _0x5beb7c;}function insertTzCmHopperBlack(_0x2a7f5b,_0x599779,_0x3aa889,_0x1ac556){var _0x10c903=[_0x0075('0x26'),'cm_contacts.id',_0x0075('0x48'),_0x599779+'.'+_0x1ac556,'cm_contacts.createdAt',_0x0075('0x41')];return squel['insert']()[_0x0075('0x2c')]('cm_hopper_black')[_0x0075('0x2e')]([_0x0075('0x13'),_0x0075('0x30'),'ListId',_0x1ac556,'createdAt',_0x0075('0x33')],squel['select']()[_0x0075('0x38')](_0x10c903)['from'](_0x599779)[_0x0075('0x14')](_0x0075('0x44'),null,'cm_contacts.ListId\x20=\x20'+_0x599779+'.CmListId')['join'](_0x3aa889,null,_0x3aa889+_0x0075('0x15')+_0x599779+'.'+_0x1ac556)['where'](_0x599779+_0x0075('0x3a'),_0x2a7f5b)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x0075('0x16')](_0x0075('0x3e'),squel[_0x0075('0x37')]()['field'](_0x0075('0x13'))[_0x0075('0x43')](_0x0075('0x42'))[_0x0075('0x16')](_0x0075('0x45'),_0x2a7f5b)[_0x0075('0x16')](_0x1ac556+_0x0075('0x17')+_0x599779+'.'+_0x1ac556)))[_0x0075('0x3f')]();}function insertCmHopperAdditionalPhones(_0x162af1){var _0x40517f=[_0x0075('0x4a'),_0x0075('0x4b'),_0x0075('0x4c'),_0x0075('0x4d'),_0x0075('0x4e')];return squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x0075('0x4f'))['fromQuery']([_0x0075('0x50'),_0x0075('0x13'),_0x0075('0x51'),_0x0075('0x32'),_0x0075('0x33')],squel[_0x0075('0x37')]()['fields'](_0x40517f)[_0x0075('0x43')](_0x0075('0x2d'))[_0x0075('0x14')](_0x0075('0x44'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x0075('0x14')](_0x0075('0x52'),null,_0x0075('0x53'))[_0x0075('0x16')]('cm_hopper.ListId\x20=\x20?',_0x162af1)[_0x0075('0x16')](_0x0075('0x3b'),NOW))[_0x0075('0x3f')]();}function insertCmContact(_0x3af9e7,_0x364d20,_0x1d5f74,_0x3d7def){var _0x435ecc=_[_0x0075('0x54')](_['keys'](_0x3d7def),['ListId',_0x0075('0x55'),_0x0075('0x32'),_0x0075('0x33'),_0x0075('0x56')]);return squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x0075('0x44'))[_0x0075('0x2e')](_0x435ecc,squel[_0x0075('0x37')]()[_0x0075('0x38')](_0x435ecc)[_0x0075('0x43')](_0x364d20)[_0x0075('0x16')]('('+_0x1d5f74['join'](',')+_0x0075('0x57'),squel['select']()[_0x0075('0x38')](_0x1d5f74)[_0x0075('0x43')](_0x0075('0x44'))['where'](_0x0075('0x45'),_0x3af9e7)[_0x0075('0x16')](_0x0075('0x58')))[_0x0075('0x16')](_0x0075('0x59'),squel[_0x0075('0x37')]()[_0x0075('0x12')](_0x0075('0x5a'),_0x0075('0x5b'))[_0x0075('0x43')](_0x364d20)[_0x0075('0x5c')](_0x1d5f74[_0x0075('0x14')](','))))[_0x0075('0x3f')]();}function handleStop(){logger[_0x0075('0x5d')](_0x0075('0x5e'));stopped=!![];}function handleUncaughtException(_0x5be699){logger[_0x0075('0x5f')](_0x5be699['message']);process[_0x0075('0x60')](0x1);}function handleError(_0x38fabb,_0x1331eb){stats[_0x0075('0x61')][_0x0075('0x1c')]({'name':_0x1331eb[_0x0075('0x62')],'message':_0x1331eb[_0x0075('0x63')],'row':_0x38fabb});}function handleQuery(_0xf4e460){logger[_0x0075('0x5d')](_0xf4e460);return db[_0x0075('0x64')][_0x0075('0x65')](_0xf4e460)[_0x0075('0x66')](function(_0x43447c){results[_0x0075('0x1c')](_0x43447c);})[_0x0075('0x67')](function(_0x37fb48){logger[_0x0075('0x5f')](_0x37fb48[_0x0075('0x63')]);});}function updateTzCampaigns(_0x1f538b){return new Promise(function(_0x42cc3a,_0x23c69d){var _0x128991=squel[_0x0075('0x37')]()[_0x0075('0x38')]([_0x0075('0x68'),'campaigns.dialTimezone'])[_0x0075('0x43')](_0x0075('0x69'))['join']('campaigns_has_cm_lists',null,_0x0075('0x6a'))[_0x0075('0x16')](_0x0075('0x6b')+_0x1f538b);db[_0x0075('0x64')]['query'](_0x128991[_0x0075('0x3f')]())[_0x0075('0x66')](function(_0x3eee59){var _0x57e441=[];for(var _0x56fff2=0x0;_0x56fff2<_0x3eee59['length'];_0x56fff2++){_0x57e441['push'](getTimezoneData(_0x3eee59[_0x56fff2],tmp_campaigns));}BPromise[_0x0075('0x1d')](_0x57e441)[_0x0075('0x1b')](function(){_0x42cc3a({'val':0x1});});})[_0x0075('0x67')](function(_0x369a96){logger[_0x0075('0x5f')](_0x369a96['message']);_0x42cc3a({'val':0x0});});});}function updateTzVoiceQueues(_0xd6b88e){return new Promise(function(_0x2ad588,_0x443ced){var _0xed6366=squel['select']()[_0x0075('0x38')]([_0x0075('0x6c'),_0x0075('0x6d')])[_0x0075('0x43')](_0x0075('0x6e'))[_0x0075('0x14')](_0x0075('0x6f'),null,_0x0075('0x70'))[_0x0075('0x16')]('voice_queues_has_cm_lists.CmListId='+_0xd6b88e);db[_0x0075('0x64')][_0x0075('0x65')](_0xed6366['toString']())[_0x0075('0x66')](function(_0x2d45c7){var _0x3b1d66=[];for(var _0x5e6af6=0x0;_0x5e6af6<_0x2d45c7[_0x0075('0x1f')];_0x5e6af6++){_0x3b1d66[_0x0075('0x1c')](getTimezoneData(_0x2d45c7[_0x5e6af6],tmp_voice_queues));}BPromise[_0x0075('0x1d')](_0x3b1d66)[_0x0075('0x1b')](function(){_0x2ad588({'val':0x1});});})['catch'](function(_0x361746){logger[_0x0075('0x5f')](_0x361746[_0x0075('0x63')]);_0x2ad588({'val':0x0});});});}function getTimezoneData(_0x247d24,_0x2e0d1b){return new Promise(function(_0xd98150,_0x2b6bd0){var _0x54e02e=shared[_0x0075('0x71')];var _0x8c9b28=_0x54e02e[_0x247d24[_0x0075('0x72')]];if(_[_0x0075('0x20')](_0x8c9b28)){_0xd98150({'ret':0x1});}else{var _0x16c115=_0x8c9b28[_0x0075('0x73')];var _0x588daf=squel[_0x0075('0x2b')]()[_0x0075('0x2c')](_0x2e0d1b)[_0x0075('0x74')]('id',_0x247d24['id'])['set'](_0x0075('0x75'),_0x16c115)[_0x0075('0x74')]('dialTimezone',_0x247d24[_0x0075('0x72')])[_0x0075('0x3f')]();return db['sequelize']['query'](_0x588daf)[_0x0075('0x66')](function(_0x359e3c){_0xd98150({'ret':0x1});})['catch'](function(_0x5ca46c){logger[_0x0075('0x5f')](_0x5ca46c[_0x0075('0x63')]);_0x2b6bd0({'ret':0x1});});}});}function handleTZQuery(_0x242828){logger['info'](_0x242828);return db[_0x0075('0x64')][_0x0075('0x65')](_0x242828)['spread'](function(_0x98db27){})[_0x0075('0x67')](function(_0x4393c2){logger[_0x0075('0x5f')](_0x4393c2[_0x0075('0x63')]);});}function main(_0x479410,_0x390072,_0x3382ea,_0x491510){logger[_0x0075('0x5d')](_0x0075('0x76'),_0x479410,JSON[_0x0075('0x77')](_0x390072));process[_0x0075('0x78')](_0x0075('0x79'));var _0xd14d5b=_0x390072[_0x0075('0x7a')];var _0x5c42c1=_[_0x0075('0x7b')](_0xd14d5b);var _0xb0d1ce=_0x390072['socket_timestamp'];var _0x2b4eee=path['join'](config[_0x0075('0x7c')],_0x0075('0x7d'),_0xb0d1ce+_0x0075('0x7e'));hasTZ=_[_0x0075('0x7f')](_0xd14d5b)[_0x0075('0x80')](_0x0075('0x72'));var _0x2d8377=_['keys'](_0xd14d5b)[_0x0075('0x14')]();logger[_0x0075('0x5d')]('header',_0x2d8377);db[_0x0075('0x81')]['findAll']({'raw':!![],'attributes':['id','name']})['then'](function(_0x24c269){for(var _0x2efecd=0x0;_0x2efecd<_0x24c269['length'];_0x2efecd++){if(_0x24c269[_0x2efecd][_0x0075('0x82')]in _0xd14d5b){contactItemTypes[_0x0075('0x1c')](_0x24c269[_0x2efecd]);delete _0x5c42c1[_0x24c269[_0x2efecd][_0x0075('0x82')]];hasAdditionalPhones=!![];}for(var _0x49faa4 in _0xd14d5b){if(_0x24c269[_0x2efecd][_0x0075('0x82')]+_0x0075('0x83')===_0x49faa4){phoneDescriptions[_0x0075('0x1c')]({'itemTypeId':_0x24c269[_0x2efecd]['id'],'description':_0x49faa4});delete _0x5c42c1[_0x49faa4];}}}if(hasAdditionalPhones)_0x5c42c1['AdditionalPhones']='';var _0x58e81c=_[_0x0075('0x7f')](_0x5c42c1)[_0x0075('0x14')]();logger[_0x0075('0x5d')]('header',_0x58e81c);fs[_0x0075('0x84')](_0x2b4eee,_0x58e81c+'\x0a');Papa[_0x0075('0x85')](fs[_0x0075('0x86')](_0x479410),{'header':!![],'skipEmptyLines':!![],'step':function(_0x219e07,_0x52c0a1){try{for(var _0x4843cd=0x0,_0x50eaac=[];_0x4843cd<_0x219e07[_0x0075('0x87')]['length'];_0x4843cd++){stats[_0x0075('0x88')]+=0x1;if(_0x219e07['errors'][_0x4843cd]){handleError(_0x219e07['data'][_0x4843cd],_0x219e07[_0x0075('0x61')][_0x4843cd]);}else{var _0x2d9fde=[];var _0x53151c=[];var _0x166172={};for(var _0x27052a in _0xd14d5b){let _0x437310=contactItemTypes[_0x0075('0x89')](_0x485e1c=>_0x485e1c[_0x0075('0x82')]===_0x27052a);let _0x2029c3=contactItemTypes[_0x0075('0x89')](_0x1ca6f8=>_0x1ca6f8[_0x0075('0x82')]+_0x0075('0x83')===_0x27052a);if(_['isNil'](_0x437310)&&_[_0x0075('0x20')](_0x2029c3)){if(_0xd14d5b['hasOwnProperty'](_0x27052a)){if(_0x219e07['data'][_0x4843cd][_0xd14d5b[_0x27052a]]){var _0x2bc268=_[_0x0075('0x8a')](_0x219e07['data'][_0x4843cd][_0xd14d5b[_0x27052a]][_0x0075('0x8b')](/"/g,'\x27'));switch(_0x27052a){case _0x0075('0x2f'):var _0x2a5611=moment(_0x2bc268,_0x0075('0x10'),!![]);if(_0x2a5611[_0x0075('0x8c')]()){_0x50eaac['push']('\x22'+_0x2bc268+'\x22');}else{_0x2d9fde[_0x0075('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0075('0x34'):var _0x496cad=parseInt(_0x2bc268);_0x2bc268=_[_0x0075('0x8d')](_0x496cad)||_0x496cad<0x0||_0x496cad>0x4?_0x491510?0x3:0x2:_0x496cad;_0x50eaac[_0x0075('0x1c')]('\x22'+_0x2bc268+'\x22');break;case'UserId':var _0x57185c=parseInt(_0x2bc268);if(_[_0x0075('0x8e')](_0x57185c)&&_[_0x0075('0x80')](_0x3382ea,_0x57185c)){_0x50eaac[_0x0075('0x1c')]('\x22'+_0x57185c+'\x22');}else{_0x2d9fde[_0x0075('0x1c')](_0x0075('0x8f'));}break;case _0x0075('0x90'):if(isEmail(_0x2bc268)){_0x50eaac[_0x0075('0x1c')]('\x22'+_0x2bc268+'\x22');}else{_0x2d9fde['push'](_0x0075('0x91'));}break;case _0x0075('0x92'):var _0x926316=moment(_0x2bc268,_0x0075('0x93'),!![]);if(_0x926316[_0x0075('0x8c')]()){_0x50eaac[_0x0075('0x1c')]('\x22'+_0x2bc268+'\x22');}else{_0x2d9fde[_0x0075('0x1c')](_0x0075('0x94'));}break;case _0x0075('0x72'):var _0x3cd1b4=shared[_0x0075('0x71')];var _0x2c4c71=_0x3cd1b4[_0x2bc268];if(!_[_0x0075('0x20')](_0x2c4c71)){var _0x37426d=_0x2c4c71[_0x0075('0x73')];_0x50eaac[_0x0075('0x1c')]('\x22'+_0x2bc268+'\x22');_0x50eaac[_0x0075('0x1c')]('\x22'+_0x37426d+'\x22');}break;default:_0x50eaac['push']('\x22'+_0x2bc268+'\x22');}}else{switch(_0x27052a){case _0x0075('0x95'):case _0x0075('0x13'):_0x2d9fde[_0x0075('0x1c')](_0x27052a+'\x20not\x20specified');break;default:_0x50eaac[_0x0075('0x1c')]('\x22\x22');}}}}else{var _0x110aa8='';if(!_[_0x0075('0x20')](_0x437310)){if(!_0x166172['hasOwnProperty'](_0x437310['id'])){if(!_[_0x0075('0x20')](_0x219e07['data'][_0x4843cd][_0xd14d5b[_0x27052a]])){var _0x2bc268=_['trim'](_0x219e07['data'][_0x4843cd][_0xd14d5b[_0x27052a]][_0x0075('0x8b')](/"/g,'\x27'));var _0x5009c0=phoneDescriptions[_0x0075('0x89')](_0x5f5ac4=>_0x5f5ac4[_0x0075('0x96')]===_0x437310['id']);if(!_['isNil'](_0x5009c0)){var _0x135e66=_['trim'](_0x219e07[_0x0075('0x87')][_0x4843cd][_0xd14d5b[_0x5009c0[_0x0075('0x97')]]]['replace'](/"/g,'\x27'));if(!_['isNil'](_0x135e66))_0x2bc268=_0x2bc268+'§'+_0x135e66;}if(_0x110aa8=='')_0x110aa8=_0x2bc268;else _0x110aa8+='|'+_0x2bc268;}_0x53151c[_0x0075('0x1c')](_0x437310['id']+':'+_0x110aa8);_0x166172[_0x437310['id']]=0x1;}}}}if(hasAdditionalPhones){_0x50eaac[_0x0075('0x1c')]('\x22'+_0x53151c[_0x0075('0x14')](';')+'\x22');}if(_0x2d9fde[_0x0075('0x1f')]){handleError(_0x219e07[_0x0075('0x87')][_0x4843cd],{'code':_0x0075('0x98'),'message':_0x2d9fde[_0x0075('0x14')]()});}else{fs[_0x0075('0x99')](_0x2b4eee,_0x50eaac[_0x0075('0x14')]()+'\x0a');}_0x50eaac=[];}if(!(stats['rows']%0xc8)){socket[_0x0075('0x9a')](_0x0075('0x9b')+_0xb0d1ce,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x0075('0x9c'));_0x52c0a1[_0x0075('0x9d')]();}}catch(_0x5a06fe){handleError(_0x219e07[_0x0075('0x87')][_0x4843cd],{'code':_0x0075('0x9e'),'message':_0x5a06fe[_0x0075('0x63')]});logger[_0x0075('0x5f')](_0x0075('0x9f'),_0x5a06fe[_0x0075('0x63')]);}},'complete':function(){try{var _0x3b3977=[];var _0xfd2f46=[];var _0x57936b=_0x0075('0x44');if(_0x390072[_0x0075('0xa0')]&&_0x390072[_0x0075('0xa0')][_0x0075('0x1f')]){_0x57936b='cm_contacts_'+_0xb0d1ce;_0x3b3977[_0x0075('0x1c')](_0x0075('0xa1')+_0x57936b+_0x0075('0xa2'));}tmp_campaigns=_0x0075('0xa3')+_0xb0d1ce;tmp_voice_queues=_0x0075('0xa4')+_0xb0d1ce;_0xfd2f46[_0x0075('0x1c')](_0x0075('0xa1')+tmp_campaigns+_0x0075('0xa5'));_0xfd2f46['push']('CREATE\x20TABLE\x20'+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x0075('0xa6')](_0xfd2f46,handleTZQuery)[_0x0075('0x1b')](function(_0x5de4ee){updateTzCampaigns(_0x390072[_0x0075('0x31')])['then'](function(_0x27cd3f){updateTzVoiceQueues(_0x390072[_0x0075('0x31')])['then'](function(_0x153e7b){if(hasTZ)_0x58e81c=_0x58e81c['replace']('dialTimezone','dialTimezone,utcOffset');var _0x41dd9f=util[_0x0075('0xf')](_0x0075('0xa7'),_0x2b4eee,_0x57936b,_0x58e81c,_0x390072[_0x0075('0x31')],_0x390072[_0x0075('0x55')]||null,NOW,NOW);if(_[_0x0075('0x20')](_0xd14d5b[_0x0075('0x2f')])){_0x41dd9f+=',\x20scheduledAt\x20=\x20NOW()';}_0x3b3977[_0x0075('0x1c')](_0x41dd9f);if(_0x390072[_0x0075('0xa0')]&&_0x390072['duplicates'][_0x0075('0x1f')]){_0x3b3977[_0x0075('0x1c')](insertCmContact(_0x390072['ListId'],_0x57936b,_0x390072[_0x0075('0xa0')],_0xd14d5b));_0x3b3977['push'](_0x0075('0xa8')+_0x57936b+';');}BPromise[_0x0075('0xa6')](_0x3b3977,handleQuery)[_0x0075('0x1b')](function(_0x4a7ed6){BPromise[_0x0075('0x1d')]([handleAdditionalPhones()])[_0x0075('0x1b')](function(){_0x3b3977=[];for(var _0x52d8a0=0x0;_0x52d8a0<promisesAdditionalPhones[_0x0075('0x1f')];_0x52d8a0++){if(promisesAdditionalPhones[_0x52d8a0]['phone']!='§'){_0x3b3977[_0x0075('0x1c')](createAdditionalPhone(promisesAdditionalPhones[_0x52d8a0][_0x0075('0xa9')],promisesAdditionalPhones[_0x52d8a0][_0x0075('0xaa')],promisesAdditionalPhones[_0x52d8a0][_0x0075('0x13')],promisesAdditionalPhones[_0x52d8a0]['orderBy']));}}BPromise[_0x0075('0x1d')](_0x3b3977)['then'](function(){_0x3b3977=[];if(hasTZ){_0x3b3977[_0x0075('0x1c')](insertTzCmHopper(_0x390072['ListId'],_0x0075('0x6f'),_0x0075('0x6e'),'VoiceQueueId',_0x491510,tmp_voice_queues));_0x3b3977['push'](insertTzCmHopperBlack(_0x390072[_0x0075('0x31')],_0x0075('0xab'),_0x0075('0x6e'),_0x0075('0xac')));_0x3b3977[_0x0075('0x1c')](insertTzCmHopper(_0x390072['ListId'],_0x0075('0xad'),_0x0075('0x69'),_0x0075('0xae'),_0x491510,tmp_campaigns));_0x3b3977['push'](insertTzCmHopperBlack(_0x390072['ListId'],'campaigns_has_cm_blacklists',_0x0075('0x69'),'CampaignId'));_0x3b3977[_0x0075('0x1c')](insertCmHopperAdditionalPhones(_0x390072[_0x0075('0x31')]));}else{_0x3b3977[_0x0075('0x1c')](insertCmHopper(_0x390072[_0x0075('0x31')],_0x0075('0x6f'),_0x0075('0x6e'),_0x0075('0xac'),_0x491510));_0x3b3977[_0x0075('0x1c')](insertCmHopperBlack(_0x390072[_0x0075('0x31')],'voice_queues_has_cm_blacklists',_0x0075('0x6e'),_0x0075('0xac')));_0x3b3977[_0x0075('0x1c')](insertCmHopper(_0x390072[_0x0075('0x31')],_0x0075('0xad'),'campaigns',_0x0075('0xae'),_0x491510));_0x3b3977[_0x0075('0x1c')](insertCmHopperBlack(_0x390072[_0x0075('0x31')],'campaigns_has_cm_blacklists',_0x0075('0x69'),_0x0075('0xae')));_0x3b3977[_0x0075('0x1c')](insertCmHopperAdditionalPhones(_0x390072['ListId']));}_0x3b3977['push'](_0x0075('0xa8')+tmp_campaigns+';');_0x3b3977['push'](_0x0075('0xa8')+tmp_voice_queues+';');BPromise[_0x0075('0xa6')](_0x3b3977,handleQuery)['then'](function(_0x2eaebd){stats[_0x0075('0xaf')]=!![];stats[_0x0075('0xb0')]=_0x390072[_0x0075('0xa0')]&&_0x390072[_0x0075('0xa0')]['length']?results[0x2][_0x0075('0xb0')]:results[0x0][_0x0075('0xb0')];socket[_0x0075('0x9a')]('contact:import:'+_0xb0d1ce,stats);fs[_0x0075('0xb1')](_0x479410);fs['unlink'](_0x2b4eee);process[_0x0075('0x60')](0x0);})['catch'](function(_0x586edc){logger[_0x0075('0x5f')](_0x586edc[_0x0075('0x63')]);process[_0x0075('0x60')](0x1);});});});})[_0x0075('0x67')](function(_0x53f4d2){logger['error'](_0x53f4d2['message']);process['exit'](0x1);});});});});}catch(_0x10eb38){logger[_0x0075('0x5f')](_0x0075('0xb2'),_0x10eb38[_0x0075('0x63')]);process['exit'](0x1);}},'error':function(_0x1a7130,_0x50021d,_0x454301,_0x14a3d1){throw new Error(_0x14a3d1);}});});}function validate(){if(process[_0x0075('0xb3')]&&process[_0x0075('0xb3')][_0x0075('0x1f')]<0x4){throw new Error(_0x0075('0xb4'));}var _0xfd5287=path['join'](config[_0x0075('0x7c')],_0x0075('0x7d'),process[_0x0075('0xb3')][0x2]);if(!fs[_0x0075('0xb5')](_0xfd5287)){throw new Error(_0x0075('0xb6'));}var _0x477a6c={};try{_0x477a6c=JSON['parse'](process['argv'][0x3]);if(!_0x477a6c[_0x0075('0x7a')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x477a6c[_0x0075('0x7a')][_0x0075('0x13')]){throw new Error(_0x0075('0xb7'));}if(!_0x477a6c[_0x0075('0x7a')][_0x0075('0x95')]){throw new Error(_0x0075('0xb8'));}var _0x4b2b49=0x0;if(_0x477a6c[_0x0075('0x7a')][_0x0075('0x35')]){_0x4b2b49=0x1;}if(!_0x477a6c['ListId']){throw new Error(_0x0075('0xb9'));}}catch(_0x10a177){throw new Error('body\x20id\x20mandatory');}var _0x51edc2=[];try{_0x51edc2=_['map'](JSON[_0x0075('0x85')](process[_0x0075('0xb3')][0x4]),'id');}catch(_0xeac687){logger[_0x0075('0x5d')](_0x0075('0xba'));}main(_0xfd5287,_0x477a6c,_0x51edc2,_0x4b2b49);}validate();process['on'](_0x0075('0xbb'),handleStop);process['on']('uncaughtException',handleUncaughtException);
\ No newline at end of file
index d35e199..563e570 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49db=['find','trim','replace','scheduledat','isValid','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','\x20not\x20specified','hasOwnProperty','itemTypeId','description','SystemRow','appendFileSync','contact:import:','SystemError','step','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','DROP\x20TABLE\x20','finish','affectedRows','emit','exit','argv','arguments\x20<filename>\x20<parameters>\x20<agents>','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/logger','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','all','then','catch','message','AdditionalPhones','split','length','filter','findOne','CmContactHasItem','update','create','PHONE','inserted','CmContact','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','updatedAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.phone','cm_contacts.ListId','cm_hopper_black','fromQuery','ContactId','createdAt','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','keys','ListId','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','errors','code','error','main','stringify','start','binding','clone','root','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','createReadStream','data','rows'];(function(_0x48e25e,_0x23e98b){var _0x158797=function(_0x178242){while(--_0x178242){_0x48e25e['push'](_0x48e25e['shift']());}};_0x158797(++_0x23e98b);}(_0x49db,0xc5));var _0xb49d=function(_0x566e95,_0x23a4cb){_0x566e95=_0x566e95-0x0;var _0x29c32d=_0x49db[_0x566e95];return _0x29c32d;};'use strict';var fs=require('fs');var path=require(_0xb49d('0x0'));var _=require(_0xb49d('0x1'));var Papa=require(_0xb49d('0x2'));var util=require(_0xb49d('0x3'));var BPromise=require(_0xb49d('0x4'));var moment=require('moment');var squel=require(_0xb49d('0x5'));var Redis=require(_0xb49d('0x6'));var db=require(_0xb49d('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xb49d('0x8'))('import');config['redis']=_[_0xb49d('0x9')](config[_0xb49d('0xa')],{'host':_0xb49d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb49d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xb49d('0xc')](_0xb49d('0xd'));var tempTableName=_0xb49d('0xe')+moment()[_0xb49d('0xc')](_0xb49d('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x54f285){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x54f285);}function selectNotIn(_0x3f21e3,_0x3422e0,_0x3e9e6d,_0x3259e5,_0x2c9c16){return squel[_0xb49d('0x10')]()[_0xb49d('0x11')](_0xb49d('0x12'))[_0xb49d('0x13')](_0x3259e5)['join'](_0x3422e0,null,_0x3422e0+_0xb49d('0x14')+_0x3259e5+'.'+_0x3e9e6d)[_0xb49d('0x15')](_0x3259e5+'.'+_0x3e9e6d+_0xb49d('0x16')+_0x3f21e3+'.'+_0x3e9e6d)[_0xb49d('0x15')](_0x3422e0+'.dialCheckDuplicateType\x20IN\x20('+_0x2c9c16[_0xb49d('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2c0b41,_0x4ddeb5){promisesAdditionalPhones=[];promisesContact=[];return db[_0xb49d('0x18')][_0xb49d('0x19')](_0xb49d('0x1a')+tempTableName)[_0xb49d('0x1b')](function(_0x1491fb){if(_0x1491fb!==null){var _0x270298=[];for(var _0x1dba19=0x0;_0x1dba19<_0x1491fb['length'];_0x1dba19++){var _0x1da77c=_0x1491fb[_0x1dba19];if(!_[_0xb49d('0x1c')](_0x1da77c[_0xb49d('0x12')])){if(!_[_0xb49d('0x1c')](_0x1da77c['AdditionalPhones']))_0x270298['push'](insertAdditionalPhones(_0x1da77c));promisesContact[_0xb49d('0x1d')]({'contact':_0x1da77c});}}}Promise[_0xb49d('0x1e')](_0x270298)[_0xb49d('0x1f')](function(){_0x2c0b41({'val':0x1});});})[_0xb49d('0x20')](function(_0x5b24b9){logger['error'](_0x5b24b9[_0xb49d('0x21')]);});});}function insertAdditionalPhones(_0x47626f){return new Promise(function(_0x3bf7a2,_0x263c62){var _0x22ad15=_0x47626f[_0xb49d('0x22')];if(_[_0xb49d('0x1c')](_0x22ad15))_0x263c62({'val':0x0});else{var _0x35f82b=_0x22ad15[_0xb49d('0x23')](';');var _0x38be04=[];orderBy=0x0;for(var _0x19ead9=0x0;_0x19ead9<_0x35f82b[_0xb49d('0x24')];_0x19ead9++){_0x38be04[_0xb49d('0x1d')](splitAdditionalPhone(_0x47626f['id'],_0x35f82b[_0x19ead9]));}Promise[_0xb49d('0x1e')](_0x38be04)[_0xb49d('0x1f')](function(){_0x3bf7a2({'val':_0x35f82b[_0xb49d('0x24')]});});}});}function splitAdditionalPhone(_0x26db55,_0x21c0e1){return new Promise(function(_0x165ec2,_0x1ae086){var _0xb3d5=_0x21c0e1[_0xb49d('0x23')](':');var _0x5a6cbe=_0xb3d5[0x0];var _0x227305=_0xb3d5[0x1];if(_0x227305!==''){var _0x4b7134=_0x227305[_0xb49d('0x23')]('|');var _0x3b7fee=[];for(var _0x56163c=0x0;_0x56163c<_0x4b7134[_0xb49d('0x24')];_0x56163c++){if(_0x4b7134[_0x56163c]!==''){var _0x1cd841=_[_0xb49d('0x25')](promisesAdditionalPhones,{'contactId':_0x26db55,'phone':_0x4b7134[_0x56163c]});if(_0x1cd841[_0xb49d('0x24')]==0x0){orderBy++;promisesAdditionalPhones[_0xb49d('0x1d')]({'contactId':_0x26db55,'contactTypeId':_0x5a6cbe,'phone':_0x4b7134[_0x56163c],'orderBy':orderBy});}}}_0x165ec2({'ok':0x1});}else _0x165ec2({'res':0x0});});}function createAdditionalPhone(_0x2276ba,_0x5d7323,_0x3930fe,_0xf734e1){var _0x2b5e5d='';var _0x37901b='';var _0x420e63=_0x3930fe[_0xb49d('0x23')]('§');_0x2b5e5d=_0x420e63[0x0];if(_0x420e63[_0xb49d('0x24')]==0x2)_0x37901b=_0x420e63[0x1];return new Promise(function(_0x588529,_0x3f1796){return db['CmContactHasItem'][_0xb49d('0x26')]({'where':{'CmContactId':_0x2276ba,'item':_0x2b5e5d}})[_0xb49d('0x1f')](function(_0x978e19){if(_0x978e19){return db[_0xb49d('0x27')][_0xb49d('0x28')]({'ItemTypeId':_0x5d7323,'description':_0x37901b,'OrderBy':_0xf734e1},{'where':{'CmContactId':_0x2276ba,'item':_0x2b5e5d}})[_0xb49d('0x1f')](function(_0xd6d0b){_0x588529({'res':'updated'});});}else{return db[_0xb49d('0x27')][_0xb49d('0x29')]({'CmContactId':_0x2276ba,'item':_0x2b5e5d,'ItemTypeId':_0x5d7323,'description':_0x37901b,'OrderBy':_0xf734e1,'ItemClass':_0xb49d('0x2a')})['then'](function(_0x5cc4e5){_0x588529({'res':_0xb49d('0x2b')});});}});});}function updateContact(_0x12abb6){return new Promise(function(_0x208967,_0xbb8e0f){var _0x3fd75e=_0x12abb6['id'];delete _0x12abb6['id'];return db[_0xb49d('0x2c')][_0xb49d('0x28')](_0x12abb6,{'where':{'id':_0x3fd75e}})[_0xb49d('0x1f')](function(_0x594dcb){updatedRows+=0x1;return db['CmHopper'][_0xb49d('0x28')]({'phone':_0x12abb6['phone']},{'where':{'ContactId':_0x3fd75e}})['then'](function(_0x4b790e){_0x208967({'ret':'OK'});});});});}function insertCmHopper(_0x423399,_0x4235ad,_0x3964ec,_0x33f922,_0x1e90a7){var _0x2a90ee=['cm_contacts.phone',_0xb49d('0x2d'),_0xb49d('0x2e'),'cm_contacts.ListId',_0x4235ad+'.'+_0x33f922,_0xb49d('0x2f'),_0xb49d('0x30'),_0xb49d('0x31'),'cm_contacts.UserId','\x22'+_0x1e90a7+'\x22'];return squel[_0xb49d('0x32')]()[_0xb49d('0x33')](_0xb49d('0x34'))['fromQuery']([_0xb49d('0x12'),'scheduledat','ContactId','ListId',_0x33f922,'createdAt',_0xb49d('0x35'),_0xb49d('0x36'),_0xb49d('0x37'),_0xb49d('0x38')],squel['select']()['fields'](_0x2a90ee)[_0xb49d('0x13')](_0x4235ad)[_0xb49d('0x17')](_0xb49d('0x39'),null,_0xb49d('0x3a')+_0x4235ad+_0xb49d('0x3b'))['join'](_0x3964ec,null,_0x3964ec+'.id\x20=\x20'+_0x4235ad+'.'+_0x33f922)[_0xb49d('0x15')](_0x4235ad+_0xb49d('0x3c'),_0x423399)[_0xb49d('0x15')](_0xb49d('0x3d'),NOW)[_0xb49d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4235ad,_0x3964ec,_0x33f922,_0xb49d('0x34'),[_0xb49d('0x3e'),_0xb49d('0x3f')]))[_0xb49d('0x15')](_0xb49d('0x40'),selectNotIn(_0x4235ad,_0x3964ec,_0x33f922,_0xb49d('0x34'),[_0xb49d('0x3e')])))['toString']();}function insertCmHopperBlack(_0x2f9481,_0x586968,_0x5db393,_0x3f394f){var _0x308407=[_0xb49d('0x41'),'cm_contacts.id',_0xb49d('0x42'),_0x586968+'.'+_0x3f394f,_0xb49d('0x2f'),_0xb49d('0x30')];return squel['insert']()['into'](_0xb49d('0x43'))[_0xb49d('0x44')]([_0xb49d('0x12'),_0xb49d('0x45'),'ListId',_0x3f394f,_0xb49d('0x46'),_0xb49d('0x35')],squel[_0xb49d('0x10')]()['fields'](_0x308407)[_0xb49d('0x13')](_0x586968)[_0xb49d('0x17')](_0xb49d('0x39'),null,_0xb49d('0x3a')+_0x586968+_0xb49d('0x3b'))[_0xb49d('0x17')](_0x5db393,null,_0x5db393+_0xb49d('0x14')+_0x586968+'.'+_0x3f394f)[_0xb49d('0x15')](_0x586968+'.CmListId\x20=\x20?',_0x2f9481)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb49d('0x15')](_0xb49d('0x40'),squel[_0xb49d('0x10')]()[_0xb49d('0x11')]('phone')['from']('cm_hopper_black')[_0xb49d('0x15')](_0xb49d('0x47'),_0x2f9481)[_0xb49d('0x15')](_0x3f394f+_0xb49d('0x48'),_0x586968+'.'+_0x3f394f)))[_0xb49d('0x49')]();}function insertCmHopperAdditionalPhones(_0x4f58fa){var _0x2de03d=[_0xb49d('0x4a'),_0xb49d('0x4b'),_0xb49d('0x4c'),_0xb49d('0x4d'),'cm_contact_has_items.updatedAt'];return squel[_0xb49d('0x32')]()[_0xb49d('0x33')](_0xb49d('0x4e'))[_0xb49d('0x44')]([_0xb49d('0x4f'),_0xb49d('0x12'),_0xb49d('0x50'),'createdAt',_0xb49d('0x35')],squel['select']()[_0xb49d('0x51')](_0x2de03d)[_0xb49d('0x13')](_0xb49d('0x34'))[_0xb49d('0x17')](_0xb49d('0x39'),null,_0xb49d('0x52'))[_0xb49d('0x17')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xb49d('0x53'),_0x4f58fa)[_0xb49d('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xb49d('0x49')]();}function insertCmContact(_0x14624f,_0x1cfc5a,_0x4057b7,_0x33ba3e){var _0x3ae388=_[_0xb49d('0x54')](_[_0xb49d('0x55')](_0x33ba3e),[_0xb49d('0x56'),_0xb49d('0x57'),'createdAt',_0xb49d('0x35')]);return squel[_0xb49d('0x32')]()[_0xb49d('0x33')](_0xb49d('0x39'))[_0xb49d('0x44')](_0x3ae388,squel[_0xb49d('0x10')]()[_0xb49d('0x51')](_0x3ae388)[_0xb49d('0x13')](_0x1cfc5a)[_0xb49d('0x15')]('('+_0x4057b7[_0xb49d('0x17')](',')+_0xb49d('0x58'),squel[_0xb49d('0x10')]()[_0xb49d('0x51')](_0x4057b7)['from'](_0xb49d('0x39'))[_0xb49d('0x15')](_0xb49d('0x47'),_0x14624f))[_0xb49d('0x15')]('id\x20IN\x20?',squel[_0xb49d('0x10')]()[_0xb49d('0x11')](_0xb49d('0x59'),_0xb49d('0x5a'))[_0xb49d('0x13')](_0x1cfc5a)[_0xb49d('0x5b')](_0x4057b7[_0xb49d('0x17')](','))))['toString']();}function handleStop(){logger[_0xb49d('0x5c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xe81ea2){logger['error'](_0xe81ea2[_0xb49d('0x21')]);process['exit'](0x1);}function handleError(_0x916de2,_0x2da6a1){stats[_0xb49d('0x5d')]['push']({'name':_0x2da6a1[_0xb49d('0x5e')],'message':_0x2da6a1['message'],'row':_0x916de2});}function handleQuery(_0x53c6c4){logger[_0xb49d('0x5c')](_0x53c6c4);return db[_0xb49d('0x18')][_0xb49d('0x19')](_0x53c6c4)[_0xb49d('0x1b')](function(_0x15e06d){results[_0xb49d('0x1d')](_0x15e06d);})['catch'](function(_0x5ac526){logger[_0xb49d('0x5f')](_0x5ac526[_0xb49d('0x21')]);});}function main(_0x16b956,_0x55c75a,_0x280689,_0x314c5d){logger['info'](_0xb49d('0x60'),_0x16b956,JSON[_0xb49d('0x61')](_0x55c75a));process['send'](_0xb49d('0x62'));var _0x2d8271=_0x55c75a[_0xb49d('0x63')];var _0x1201b1=_[_0xb49d('0x64')](_0x2d8271);var _0x264605=_0x55c75a['socket_timestamp'];var _0x24884d=path[_0xb49d('0x17')](config[_0xb49d('0x65')],'server/files/tmp',_0x264605+_0xb49d('0x66'));logger[_0xb49d('0x5c')](_0xb49d('0x67'),_0x55c75a);db[_0xb49d('0x68')][_0xb49d('0x69')]({'raw':!![],'attributes':['id',_0xb49d('0x6a')]})['then'](function(_0x8a266c){for(var _0x10d3cf=0x0;_0x10d3cf<_0x8a266c[_0xb49d('0x24')];_0x10d3cf++){if(_0x8a266c[_0x10d3cf][_0xb49d('0x6a')]in _0x2d8271){contactItemTypes[_0xb49d('0x1d')](_0x8a266c[_0x10d3cf]);delete _0x1201b1[_0x8a266c[_0x10d3cf][_0xb49d('0x6a')]];hasAdditionalPhones=!![];}for(var _0x11934a in _0x2d8271){if(_0x8a266c[_0x10d3cf][_0xb49d('0x6a')]+_0xb49d('0x6b')===_0x11934a){phoneDescriptions[_0xb49d('0x1d')]({'itemTypeId':_0x8a266c[_0x10d3cf]['id'],'description':_0x11934a});delete _0x1201b1[_0x11934a];}}}if(hasAdditionalPhones)_0x1201b1[_0xb49d('0x22')]='';var _0x162c46=_['keys'](_0x1201b1)[_0xb49d('0x17')]();logger['info'](_0xb49d('0x6c'),_0x162c46);fs[_0xb49d('0x6d')](_0x24884d,_0x162c46+'\x0a');Papa['parse'](fs[_0xb49d('0x6e')](_0x16b956),{'header':!![],'skipEmptyLines':!![],'step':function(_0x55603f,_0x2cdcc2){try{for(var _0x595052=0x0,_0x2d2d9c=[];_0x595052<_0x55603f[_0xb49d('0x6f')][_0xb49d('0x24')];_0x595052++){stats[_0xb49d('0x70')]+=0x1;if(_0x55603f[_0xb49d('0x5d')][_0x595052]){handleError(_0x55603f['data'][_0x595052],_0x55603f[_0xb49d('0x5d')][_0x595052]);}else{var _0x5adf36=[];var _0x2d7f16=[];var _0xf0a753={};for(var _0x3ded9a in _0x2d8271){let _0x44f848=contactItemTypes[_0xb49d('0x71')](_0x1c1175=>_0x1c1175[_0xb49d('0x6a')]===_0x3ded9a);let _0x35aa38=contactItemTypes['find'](_0x258ce9=>_0x258ce9[_0xb49d('0x6a')]+'_description'===_0x3ded9a);if(_[_0xb49d('0x1c')](_0x44f848)&&_['isNil'](_0x35aa38)){if(_0x2d8271['hasOwnProperty'](_0x3ded9a)){if(_0x55603f['data'][_0x595052][_0x2d8271[_0x3ded9a]]){var _0x50bb6c=_[_0xb49d('0x72')](_0x55603f[_0xb49d('0x6f')][_0x595052][_0x2d8271[_0x3ded9a]][_0xb49d('0x73')](/"/g,'\x27'));switch(_0x3ded9a){case _0xb49d('0x74'):var _0x59a570=moment(_0x50bb6c,_0xb49d('0xd'),!![]);if(_0x59a570[_0xb49d('0x75')]()){_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x50bb6c+'\x22');}else{_0x5adf36[_0xb49d('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb49d('0x36'):var _0x1463e4=parseInt(_0x50bb6c);_0x50bb6c=_['isNaN'](_0x1463e4)||_0x1463e4<0x0||_0x1463e4>0x4?_0x314c5d?0x3:0x2:_0x1463e4;_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x50bb6c+'\x22');break;case _0xb49d('0x37'):var _0x48accb=parseInt(_0x50bb6c);if(_[_0xb49d('0x76')](_0x48accb)&&_[_0xb49d('0x77')](_0x280689,_0x48accb)){_0x2d2d9c['push']('\x22'+_0x48accb+'\x22');}else{_0x5adf36['push'](_0xb49d('0x78'));}break;case _0xb49d('0x79'):if(isEmail(_0x50bb6c)){_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x50bb6c+'\x22');}else{_0x5adf36[_0xb49d('0x1d')](_0xb49d('0x7a'));}break;case'dateOfBirth':var _0x1ab7e7=moment(_0x50bb6c,_0xb49d('0x7b'),!![]);if(_0x1ab7e7[_0xb49d('0x75')]()){_0x2d2d9c['push']('\x22'+_0x50bb6c+'\x22');}else{_0x5adf36[_0xb49d('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x50bb6c+'\x22');}}else{switch(_0x3ded9a){case'firstName':case _0xb49d('0x12'):_0x5adf36[_0xb49d('0x1d')](_0x3ded9a+_0xb49d('0x7c'));break;default:_0x2d2d9c[_0xb49d('0x1d')]('\x22\x22');}}}}else{var _0x214078='';if(!_['isNil'](_0x44f848)){if(!_0xf0a753[_0xb49d('0x7d')](_0x44f848['id'])){for(var _0x5b98a4=0x0;_0x5b98a4<_0x2d8271[_0x3ded9a][_0xb49d('0x24')];_0x5b98a4++){var _0x50bb6c=_[_0xb49d('0x72')](_0x55603f[_0xb49d('0x6f')][_0x595052][_0x2d8271[_0x3ded9a][_0x5b98a4]][_0xb49d('0x73')](/"/g,'\x27'));var _0x3619e3=phoneDescriptions[_0xb49d('0x71')](_0x39a8ef=>_0x39a8ef[_0xb49d('0x7e')]===_0x44f848['id']);if(!_['isNil'](_0x3619e3)){var _0x4c1dc6=_['trim'](_0x55603f[_0xb49d('0x6f')][_0x595052][_0x2d8271[_0x3619e3[_0xb49d('0x7f')]][0x0]][_0xb49d('0x73')](/"/g,'\x27'));if(!_[_0xb49d('0x1c')](_0x4c1dc6))_0x50bb6c=_0x50bb6c+'§'+_0x4c1dc6;}if(_0x214078=='')_0x214078=_0x50bb6c;else _0x214078+='|'+_0x50bb6c;}_0x2d7f16[_0xb49d('0x1d')](_0x44f848['id']+':'+_0x214078);_0xf0a753[_0x44f848['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x2d7f16[_0xb49d('0x17')](';')+'\x22');}if(_0x5adf36[_0xb49d('0x24')]){handleError(_0x55603f[_0xb49d('0x6f')][_0x595052],{'code':_0xb49d('0x80'),'message':_0x5adf36[_0xb49d('0x17')]()});}else{fs[_0xb49d('0x81')](_0x24884d,_0x2d2d9c[_0xb49d('0x17')]()+'\x0a');}_0x2d2d9c=[];}if(!(stats[_0xb49d('0x70')]%0xc8)){socket['emit'](_0xb49d('0x82')+_0x264605,stats);stats['errors']=[];}}if(stopped){logger[_0xb49d('0x5c')]('Abort\x20parser');_0x2cdcc2['abort']();}}catch(_0x2c29ba){handleError(_0x55603f[_0xb49d('0x6f')][_0x595052],{'code':_0xb49d('0x83'),'message':_0x2c29ba['message']});logger['error'](_0xb49d('0x84'),_0x2c29ba[_0xb49d('0x21')]);}},'complete':function(){try{var _0x212ad0=[];var _0x453694=tempTableName;_0x212ad0[_0xb49d('0x1d')]('CREATE\x20TABLE\x20'+_0x453694+'\x20LIKE\x20cm_contacts;');logger['info'](_0xb49d('0x85'),contactItemTypes[_0xb49d('0x24')]);var _0x70cf7b=util['format'](_0xb49d('0x86'),_0x24884d,_0x453694,_0x162c46,_0x55c75a[_0xb49d('0x56')],_0x55c75a[_0xb49d('0x57')]||null,NOW,NOW);if(_[_0xb49d('0x1c')](_0x2d8271[_0xb49d('0x74')])){_0x70cf7b+=_0xb49d('0x87');}_0x212ad0['push'](_0x70cf7b);BPromise[_0xb49d('0x88')](_0x212ad0,handleQuery)[_0xb49d('0x1f')](function(_0x221092){BPromise[_0xb49d('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x212ad0=[];for(var _0x15cf10=0x0;_0x15cf10<promisesContact[_0xb49d('0x24')];_0x15cf10++){_0x212ad0[_0xb49d('0x1d')](updateContact(promisesContact[_0x15cf10][_0xb49d('0x89')]));}BPromise[_0xb49d('0x1e')](_0x212ad0)[_0xb49d('0x1f')](function(){_0x212ad0=[];for(var _0x33bbb4=0x0;_0x33bbb4<promisesAdditionalPhones[_0xb49d('0x24')];_0x33bbb4++){_0x212ad0['push'](createAdditionalPhone(promisesAdditionalPhones[_0x33bbb4][_0xb49d('0x8a')],promisesAdditionalPhones[_0x33bbb4][_0xb49d('0x8b')],promisesAdditionalPhones[_0x33bbb4][_0xb49d('0x12')],promisesAdditionalPhones[_0x33bbb4]['orderBy']));}BPromise[_0xb49d('0x1e')](_0x212ad0)['then'](function(){_0x212ad0=[];_0x212ad0['push'](insertCmHopperAdditionalPhones(_0x55c75a[_0xb49d('0x56')]));_0x212ad0[_0xb49d('0x1d')](_0xb49d('0x8c')+_0x453694+';');BPromise[_0xb49d('0x88')](_0x212ad0,handleQuery)[_0xb49d('0x1f')](function(_0x4bdf27){stats[_0xb49d('0x8d')]=!![];stats[_0xb49d('0x8e')]=updatedRows;socket[_0xb49d('0x8f')](_0xb49d('0x82')+_0x264605,stats);fs['unlink'](_0x16b956);fs['unlink'](_0x24884d);process[_0xb49d('0x90')](0x0);})[_0xb49d('0x20')](function(_0x361795){logger['error'](_0x361795[_0xb49d('0x21')]);process['exit'](0x1);});});});});})[_0xb49d('0x20')](function(_0x2ddc5d){logger[_0xb49d('0x5f')](_0x2ddc5d[_0xb49d('0x21')]);process[_0xb49d('0x90')](0x1);});}catch(_0x5e8583){logger[_0xb49d('0x5f')]('complete',_0x5e8583['message']);process[_0xb49d('0x90')](0x1);}},'error':function(_0x3c5448,_0xccde3d,_0xdbf39,_0x25c525){throw new Error(_0x25c525);}});});}function validate(){if(process[_0xb49d('0x91')]&&process['argv'][_0xb49d('0x24')]<0x4){throw new Error(_0xb49d('0x92'));}var _0x3aa190=path[_0xb49d('0x17')](config[_0xb49d('0x65')],'server/files/tmp',process[_0xb49d('0x91')][0x2]);if(!fs['existsSync'](_0x3aa190)){throw new Error(_0xb49d('0x93'));}var _0x3edc21={};try{_0x3edc21=JSON[_0xb49d('0x94')](process[_0xb49d('0x91')][0x3]);if(!_0x3edc21['binding']){throw new Error(_0xb49d('0x95'));}var _0x164fb8=0x0;if(_0x3edc21['binding']['UserId']){_0x164fb8=0x1;}if(!_0x3edc21[_0xb49d('0x56')]){throw new Error(_0xb49d('0x96'));}}catch(_0x7a07b4){throw new Error('body\x20id\x20mandatory');}var _0x46ea96=[];try{_0x46ea96=_[_0xb49d('0x97')](JSON[_0xb49d('0x94')](process[_0xb49d('0x91')][0x4]),'id');}catch(_0x57b8c7){logger[_0xb49d('0x5c')](_0xb49d('0x98'));}main(_0x3aa190,_0x3edc21,_0x46ea96,_0x164fb8);}validate();process['on'](_0xb49d('0x99'),handleStop);process['on'](_0xb49d('0x9a'),handleUncaughtException);
\ No newline at end of file
+var _0x416b=['from','.id\x20=\x20','where','join','sequelize','select\x20*\x20from\x20','spread','length','isNil','all','then','catch','error','split','filter','push','CmContactHasItem','update','updated','create','PHONE','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','createdAt','updatedAt','UserId','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.ListId','cm_hopper_black','fields','cm_contacts.createdAt\x20=\x20?','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','info','Received\x20SIGINT','exit','code','message','main','stringify','send','binding','clone','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','parse','data','rows','errors','find','hasOwnProperty','trim','isNaN','isNumber','includes','agent\x20not\x20exists','email\x20wrong\x20format','dateOfBirth','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','replace','itemTypeId','description','SystemRow','emit','Abort\x20parser','abort','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','ListId',',\x20scheduledAt\x20=\x20NOW()','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','each','finish','affectedRows','contact:import:','unlink','complete','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','SIGINT','uncaughtException','path','lodash','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','test','select','field','phone'];(function(_0x546132,_0x36658c){var _0x2732b4=function(_0x3acd72){while(--_0x3acd72){_0x546132['push'](_0x546132['shift']());}};_0x2732b4(++_0x36658c);}(_0x416b,0x1c8));var _0xb416=function(_0x2f48cd,_0x46a75a){_0x2f48cd=_0x2f48cd-0x0;var _0x193ae2=_0x416b[_0x2f48cd];return _0x193ae2;};'use strict';var fs=require('fs');var path=require(_0xb416('0x0'));var _=require(_0xb416('0x1'));var Papa=require('papaparse');var util=require('util');var BPromise=require(_0xb416('0x2'));var moment=require('moment');var squel=require(_0xb416('0x3'));var Redis=require(_0xb416('0x4'));var db=require(_0xb416('0x5'))['db'];var config=require(_0xb416('0x6'));var logger=require(_0xb416('0x7'))(_0xb416('0x8'));config[_0xb416('0x9')]=_[_0xb416('0xa')](config[_0xb416('0x9')],{'host':_0xb416('0xb'),'port':0x18eb});var socket=require(_0xb416('0xc'))(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xb416('0xd')](_0xb416('0xe'));var tempTableName=_0xb416('0xf')+moment()['format'](_0xb416('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x360386){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0xb416('0x11')](_0x360386);}function selectNotIn(_0x43d261,_0x2492a0,_0x4e8849,_0x5ad7db,_0x5d22d2){return squel[_0xb416('0x12')]()[_0xb416('0x13')](_0xb416('0x14'))[_0xb416('0x15')](_0x5ad7db)['join'](_0x2492a0,null,_0x2492a0+_0xb416('0x16')+_0x5ad7db+'.'+_0x4e8849)[_0xb416('0x17')](_0x5ad7db+'.'+_0x4e8849+'\x20=\x20'+_0x43d261+'.'+_0x4e8849)[_0xb416('0x17')](_0x2492a0+'.dialCheckDuplicateType\x20IN\x20('+_0x5d22d2[_0xb416('0x18')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x20f839,_0x42d332){promisesAdditionalPhones=[];promisesContact=[];return db[_0xb416('0x19')]['query'](_0xb416('0x1a')+tempTableName)[_0xb416('0x1b')](function(_0x3eb85c){if(_0x3eb85c!==null){var _0x382978=[];for(var _0x4bca1f=0x0;_0x4bca1f<_0x3eb85c[_0xb416('0x1c')];_0x4bca1f++){var _0x43c95a=_0x3eb85c[_0x4bca1f];if(!_['isNil'](_0x43c95a[_0xb416('0x14')])){if(!_[_0xb416('0x1d')](_0x43c95a['AdditionalPhones']))_0x382978['push'](insertAdditionalPhones(_0x43c95a));promisesContact['push']({'contact':_0x43c95a});}}}Promise[_0xb416('0x1e')](_0x382978)[_0xb416('0x1f')](function(){_0x20f839({'val':0x1});});})[_0xb416('0x20')](function(_0x398024){logger[_0xb416('0x21')](_0x398024['message']);});});}function insertAdditionalPhones(_0xcff4dc){return new Promise(function(_0x3bd34b,_0x1a7dd4){var _0x1f10e8=_0xcff4dc['AdditionalPhones'];if(_[_0xb416('0x1d')](_0x1f10e8))_0x1a7dd4({'val':0x0});else{var _0x27d445=_0x1f10e8[_0xb416('0x22')](';');var _0x22dc03=[];orderBy=0x0;for(var _0x33f5e3=0x0;_0x33f5e3<_0x27d445[_0xb416('0x1c')];_0x33f5e3++){_0x22dc03['push'](splitAdditionalPhone(_0xcff4dc['id'],_0x27d445[_0x33f5e3]));}Promise[_0xb416('0x1e')](_0x22dc03)[_0xb416('0x1f')](function(){_0x3bd34b({'val':_0x27d445['length']});});}});}function splitAdditionalPhone(_0x16d7ce,_0x241c7a){return new Promise(function(_0x607d50,_0x1ec5b0){var _0x3857f0=_0x241c7a[_0xb416('0x22')](':');var _0x516f11=_0x3857f0[0x0];var _0x48f964=_0x3857f0[0x1];if(_0x48f964!==''){var _0x5dcbcf=_0x48f964['split']('|');var _0x227d00=[];for(var _0x584ee3=0x0;_0x584ee3<_0x5dcbcf[_0xb416('0x1c')];_0x584ee3++){if(_0x5dcbcf[_0x584ee3]!==''){var _0x2cd038=_[_0xb416('0x23')](promisesAdditionalPhones,{'contactId':_0x16d7ce,'phone':_0x5dcbcf[_0x584ee3]});if(_0x2cd038['length']==0x0){orderBy++;promisesAdditionalPhones[_0xb416('0x24')]({'contactId':_0x16d7ce,'contactTypeId':_0x516f11,'phone':_0x5dcbcf[_0x584ee3],'orderBy':orderBy});}}}_0x607d50({'ok':0x1});}else _0x607d50({'res':0x0});});}function createAdditionalPhone(_0x3980da,_0x28ad6d,_0x218cd2,_0x450d94){var _0x80d4ce='';var _0x4c9b42='';var _0xb2ae6e=_0x218cd2['split']('§');_0x80d4ce=_0xb2ae6e[0x0];if(_0xb2ae6e['length']==0x2)_0x4c9b42=_0xb2ae6e[0x1];return new Promise(function(_0x1988ea,_0xdd11e9){return db[_0xb416('0x25')]['findOne']({'where':{'CmContactId':_0x3980da,'item':_0x80d4ce}})['then'](function(_0x2c7978){if(_0x2c7978){return db['CmContactHasItem'][_0xb416('0x26')]({'ItemTypeId':_0x28ad6d,'description':_0x4c9b42,'OrderBy':_0x450d94},{'where':{'CmContactId':_0x3980da,'item':_0x80d4ce}})[_0xb416('0x1f')](function(_0x4a3c8a){_0x1988ea({'res':_0xb416('0x27')});});}else{return db[_0xb416('0x25')][_0xb416('0x28')]({'CmContactId':_0x3980da,'item':_0x80d4ce,'ItemTypeId':_0x28ad6d,'description':_0x4c9b42,'OrderBy':_0x450d94,'ItemClass':_0xb416('0x29')})[_0xb416('0x1f')](function(_0x47ac64){_0x1988ea({'res':_0xb416('0x2a')});});}});});}function updateContact(_0x1c0586){return new Promise(function(_0x5cd1ae,_0x232997){var _0x4b30e2=_0x1c0586['id'];delete _0x1c0586['id'];return db[_0xb416('0x2b')][_0xb416('0x26')](_0x1c0586,{'where':{'id':_0x4b30e2}})['then'](function(_0x532c9a){updatedRows+=0x1;return db[_0xb416('0x2c')]['update']({'phone':_0x1c0586['phone']},{'where':{'ContactId':_0x4b30e2}})['then'](function(_0x431cd5){_0x5cd1ae({'ret':'OK'});});});});}function insertCmHopper(_0x36966a,_0x168db3,_0x29efb9,_0x2bec86,_0x107447){var _0x5f06d2=[_0xb416('0x2d'),_0xb416('0x2e'),_0xb416('0x2f'),'cm_contacts.ListId',_0x168db3+'.'+_0x2bec86,_0xb416('0x30'),_0xb416('0x31'),'cm_contacts.priority',_0xb416('0x32'),'\x22'+_0x107447+'\x22'];return squel[_0xb416('0x33')]()[_0xb416('0x34')](_0xb416('0x35'))[_0xb416('0x36')](['phone',_0xb416('0x37'),_0xb416('0x38'),'ListId',_0x2bec86,_0xb416('0x39'),_0xb416('0x3a'),'priority',_0xb416('0x3b'),'recallme'],squel[_0xb416('0x12')]()['fields'](_0x5f06d2)[_0xb416('0x15')](_0x168db3)[_0xb416('0x18')](_0xb416('0x3c'),null,_0xb416('0x3d')+_0x168db3+_0xb416('0x3e'))[_0xb416('0x18')](_0x29efb9,null,_0x29efb9+_0xb416('0x16')+_0x168db3+'.'+_0x2bec86)['where'](_0x168db3+_0xb416('0x3f'),_0x36966a)[_0xb416('0x17')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x168db3,_0x29efb9,_0x2bec86,_0xb416('0x35'),[_0xb416('0x40'),_0xb416('0x41')]))[_0xb416('0x17')](_0xb416('0x42'),selectNotIn(_0x168db3,_0x29efb9,_0x2bec86,_0xb416('0x35'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x111ff8,_0x5a8994,_0x9cc9e5,_0x3363c4){var _0x511011=[_0xb416('0x2d'),_0xb416('0x2f'),_0xb416('0x43'),_0x5a8994+'.'+_0x3363c4,_0xb416('0x30'),'cm_contacts.updatedAt'];return squel['insert']()[_0xb416('0x34')](_0xb416('0x44'))[_0xb416('0x36')]([_0xb416('0x14'),_0xb416('0x38'),'ListId',_0x3363c4,_0xb416('0x39'),'updatedAt'],squel[_0xb416('0x12')]()[_0xb416('0x45')](_0x511011)[_0xb416('0x15')](_0x5a8994)['join'](_0xb416('0x3c'),null,'cm_contacts.ListId\x20=\x20'+_0x5a8994+_0xb416('0x3e'))[_0xb416('0x18')](_0x9cc9e5,null,_0x9cc9e5+_0xb416('0x16')+_0x5a8994+'.'+_0x3363c4)[_0xb416('0x17')](_0x5a8994+_0xb416('0x3f'),_0x111ff8)[_0xb416('0x17')](_0xb416('0x46'),NOW)[_0xb416('0x17')](_0xb416('0x42'),squel[_0xb416('0x12')]()[_0xb416('0x13')]('phone')['from']('cm_hopper_black')[_0xb416('0x17')](_0xb416('0x47'),_0x111ff8)['where'](_0x3363c4+_0xb416('0x48'),_0x5a8994+'.'+_0x3363c4)))[_0xb416('0x49')]();}function insertCmHopperAdditionalPhones(_0x497cd0){var _0x5eafc6=[_0xb416('0x4a'),_0xb416('0x4b'),_0xb416('0x4c'),_0xb416('0x4d'),_0xb416('0x4e')];return squel[_0xb416('0x33')]()[_0xb416('0x34')](_0xb416('0x4f'))[_0xb416('0x36')]([_0xb416('0x50'),_0xb416('0x14'),_0xb416('0x51'),_0xb416('0x39'),_0xb416('0x3a')],squel[_0xb416('0x12')]()[_0xb416('0x45')](_0x5eafc6)[_0xb416('0x15')](_0xb416('0x35'))[_0xb416('0x18')](_0xb416('0x3c'),null,_0xb416('0x52'))[_0xb416('0x18')]('cm_contact_has_items',null,_0xb416('0x53'))[_0xb416('0x17')](_0xb416('0x54'),_0x497cd0)[_0xb416('0x17')](_0xb416('0x46'),NOW))[_0xb416('0x49')]();}function insertCmContact(_0x47730e,_0x331120,_0x3a1390,_0x5a041b){var _0x5b6801=_[_0xb416('0x55')](_[_0xb416('0x56')](_0x5a041b),['ListId',_0xb416('0x57'),'createdAt',_0xb416('0x3a')]);return squel['insert']()[_0xb416('0x34')]('cm_contacts')[_0xb416('0x36')](_0x5b6801,squel[_0xb416('0x12')]()[_0xb416('0x45')](_0x5b6801)[_0xb416('0x15')](_0x331120)[_0xb416('0x17')]('('+_0x3a1390[_0xb416('0x18')](',')+_0xb416('0x58'),squel[_0xb416('0x12')]()[_0xb416('0x45')](_0x3a1390)[_0xb416('0x15')]('cm_contacts')['where'](_0xb416('0x47'),_0x47730e))['where'](_0xb416('0x59'),squel['select']()['field'](_0xb416('0x5a'),_0xb416('0x5b'))[_0xb416('0x15')](_0x331120)['group'](_0x3a1390[_0xb416('0x18')](','))))[_0xb416('0x49')]();}function handleStop(){logger[_0xb416('0x5c')](_0xb416('0x5d'));stopped=!![];}function handleUncaughtException(_0x35d5bc){logger[_0xb416('0x21')](_0x35d5bc['message']);process[_0xb416('0x5e')](0x1);}function handleError(_0x3c5029,_0x4afa61){stats['errors'][_0xb416('0x24')]({'name':_0x4afa61[_0xb416('0x5f')],'message':_0x4afa61[_0xb416('0x60')],'row':_0x3c5029});}function handleQuery(_0x59d923){logger[_0xb416('0x5c')](_0x59d923);return db['sequelize']['query'](_0x59d923)[_0xb416('0x1b')](function(_0x52892d){results['push'](_0x52892d);})[_0xb416('0x20')](function(_0x4d44c0){logger['error'](_0x4d44c0[_0xb416('0x60')]);});}function main(_0x193538,_0x93b30f,_0x429695,_0x302757){logger['info'](_0xb416('0x61'),_0x193538,JSON[_0xb416('0x62')](_0x93b30f));process[_0xb416('0x63')]('start');var _0x3d1767=_0x93b30f[_0xb416('0x64')];var _0x319d30=_[_0xb416('0x65')](_0x3d1767);var _0x43df24=_0x93b30f['socket_timestamp'];var _0x9e5a7b=path[_0xb416('0x18')](config[_0xb416('0x66')],_0xb416('0x67'),_0x43df24+_0xb416('0x68'));logger[_0xb416('0x5c')](_0xb416('0x69'),_0x93b30f);db[_0xb416('0x6a')][_0xb416('0x6b')]({'raw':!![],'attributes':['id',_0xb416('0x6c')]})[_0xb416('0x1f')](function(_0x55f491){for(var _0x40d591=0x0;_0x40d591<_0x55f491['length'];_0x40d591++){if(_0x55f491[_0x40d591][_0xb416('0x6c')]in _0x3d1767){contactItemTypes[_0xb416('0x24')](_0x55f491[_0x40d591]);delete _0x319d30[_0x55f491[_0x40d591][_0xb416('0x6c')]];hasAdditionalPhones=!![];}for(var _0x3d6e80 in _0x3d1767){if(_0x55f491[_0x40d591][_0xb416('0x6c')]+_0xb416('0x6d')===_0x3d6e80){phoneDescriptions[_0xb416('0x24')]({'itemTypeId':_0x55f491[_0x40d591]['id'],'description':_0x3d6e80});delete _0x319d30[_0x3d6e80];}}}if(hasAdditionalPhones)_0x319d30['AdditionalPhones']='';var _0x30da67=_[_0xb416('0x56')](_0x319d30)[_0xb416('0x18')]();logger[_0xb416('0x5c')](_0xb416('0x6e'),_0x30da67);fs[_0xb416('0x6f')](_0x9e5a7b,_0x30da67+'\x0a');Papa[_0xb416('0x70')](fs['createReadStream'](_0x193538),{'header':!![],'skipEmptyLines':!![],'step':function(_0x202db3,_0x6ca368){try{for(var _0x2dec1b=0x0,_0x40927d=[];_0x2dec1b<_0x202db3[_0xb416('0x71')][_0xb416('0x1c')];_0x2dec1b++){stats[_0xb416('0x72')]+=0x1;if(_0x202db3[_0xb416('0x73')][_0x2dec1b]){handleError(_0x202db3[_0xb416('0x71')][_0x2dec1b],_0x202db3[_0xb416('0x73')][_0x2dec1b]);}else{var _0x3a411c=[];var _0x520e02=[];var _0x5c79a8={};for(var _0xc8eb88 in _0x3d1767){let _0x4d8867=contactItemTypes[_0xb416('0x74')](_0x2aed0a=>_0x2aed0a['name']===_0xc8eb88);let _0x2568cf=contactItemTypes[_0xb416('0x74')](_0x1bd0f4=>_0x1bd0f4[_0xb416('0x6c')]+_0xb416('0x6d')===_0xc8eb88);if(_[_0xb416('0x1d')](_0x4d8867)&&_[_0xb416('0x1d')](_0x2568cf)){if(_0x3d1767[_0xb416('0x75')](_0xc8eb88)){if(_0x202db3[_0xb416('0x71')][_0x2dec1b][_0x3d1767[_0xc8eb88]]){var _0x4eed1d=_[_0xb416('0x76')](_0x202db3[_0xb416('0x71')][_0x2dec1b][_0x3d1767[_0xc8eb88]]['replace'](/"/g,'\x27'));switch(_0xc8eb88){case _0xb416('0x37'):var _0x3fbf63=moment(_0x4eed1d,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x3fbf63['isValid']()){_0x40927d[_0xb416('0x24')]('\x22'+_0x4eed1d+'\x22');}else{_0x3a411c[_0xb416('0x24')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x156c1a=parseInt(_0x4eed1d);_0x4eed1d=_[_0xb416('0x77')](_0x156c1a)||_0x156c1a<0x0||_0x156c1a>0x4?_0x302757?0x3:0x2:_0x156c1a;_0x40927d['push']('\x22'+_0x4eed1d+'\x22');break;case _0xb416('0x3b'):var _0x39fcf0=parseInt(_0x4eed1d);if(_[_0xb416('0x78')](_0x39fcf0)&&_[_0xb416('0x79')](_0x429695,_0x39fcf0)){_0x40927d[_0xb416('0x24')]('\x22'+_0x39fcf0+'\x22');}else{_0x3a411c[_0xb416('0x24')](_0xb416('0x7a'));}break;case'email':if(isEmail(_0x4eed1d)){_0x40927d[_0xb416('0x24')]('\x22'+_0x4eed1d+'\x22');}else{_0x3a411c[_0xb416('0x24')](_0xb416('0x7b'));}break;case _0xb416('0x7c'):var _0x4a45b8=moment(_0x4eed1d,'YYYY-MM-DD',!![]);if(_0x4a45b8['isValid']()){_0x40927d[_0xb416('0x24')]('\x22'+_0x4eed1d+'\x22');}else{_0x3a411c[_0xb416('0x24')](_0xb416('0x7d'));}break;default:_0x40927d[_0xb416('0x24')]('\x22'+_0x4eed1d+'\x22');}}else{switch(_0xc8eb88){case _0xb416('0x7e'):case'phone':_0x3a411c[_0xb416('0x24')](_0xc8eb88+_0xb416('0x7f'));break;default:_0x40927d[_0xb416('0x24')]('\x22\x22');}}}}else{var _0xa584a9='';if(!_[_0xb416('0x1d')](_0x4d8867)){if(!_0x5c79a8[_0xb416('0x75')](_0x4d8867['id'])){for(var _0x3d655a=0x0;_0x3d655a<_0x3d1767[_0xc8eb88][_0xb416('0x1c')];_0x3d655a++){var _0x4eed1d=_[_0xb416('0x76')](_0x202db3[_0xb416('0x71')][_0x2dec1b][_0x3d1767[_0xc8eb88][_0x3d655a]][_0xb416('0x80')](/"/g,'\x27'));var _0x43ee66=phoneDescriptions[_0xb416('0x74')](_0xb9d40=>_0xb9d40[_0xb416('0x81')]===_0x4d8867['id']);if(!_[_0xb416('0x1d')](_0x43ee66)){var _0x14a181=_[_0xb416('0x76')](_0x202db3[_0xb416('0x71')][_0x2dec1b][_0x3d1767[_0x43ee66[_0xb416('0x82')]][0x0]][_0xb416('0x80')](/"/g,'\x27'));if(!_['isNil'](_0x14a181))_0x4eed1d=_0x4eed1d+'§'+_0x14a181;}if(_0xa584a9=='')_0xa584a9=_0x4eed1d;else _0xa584a9+='|'+_0x4eed1d;}_0x520e02[_0xb416('0x24')](_0x4d8867['id']+':'+_0xa584a9);_0x5c79a8[_0x4d8867['id']]=0x1;}}}}if(hasAdditionalPhones){_0x40927d[_0xb416('0x24')]('\x22'+_0x520e02[_0xb416('0x18')](';')+'\x22');}if(_0x3a411c[_0xb416('0x1c')]){handleError(_0x202db3[_0xb416('0x71')][_0x2dec1b],{'code':_0xb416('0x83'),'message':_0x3a411c['join']()});}else{fs['appendFileSync'](_0x9e5a7b,_0x40927d[_0xb416('0x18')]()+'\x0a');}_0x40927d=[];}if(!(stats[_0xb416('0x72')]%0xc8)){socket[_0xb416('0x84')]('contact:import:'+_0x43df24,stats);stats['errors']=[];}}if(stopped){logger[_0xb416('0x5c')](_0xb416('0x85'));_0x6ca368[_0xb416('0x86')]();}}catch(_0x31f5be){handleError(_0x202db3[_0xb416('0x71')][_0x2dec1b],{'code':'SystemError','message':_0x31f5be[_0xb416('0x60')]});logger['error'](_0xb416('0x87'),_0x31f5be[_0xb416('0x60')]);}},'complete':function(){try{var _0x4c5d98=[];var _0x1c241c=tempTableName;_0x4c5d98[_0xb416('0x24')](_0xb416('0x88')+_0x1c241c+_0xb416('0x89'));logger[_0xb416('0x5c')](_0xb416('0x8a'),contactItemTypes[_0xb416('0x1c')]);var _0x2744c6=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x9e5a7b,_0x1c241c,_0x30da67,_0x93b30f[_0xb416('0x8b')],_0x93b30f[_0xb416('0x57')]||null,NOW,NOW);if(_['isNil'](_0x3d1767[_0xb416('0x37')])){_0x2744c6+=_0xb416('0x8c');}_0x4c5d98[_0xb416('0x24')](_0x2744c6);BPromise['each'](_0x4c5d98,handleQuery)[_0xb416('0x1f')](function(_0x42dcdd){BPromise[_0xb416('0x1e')]([handleAdditionalPhones()])[_0xb416('0x1f')](function(){_0x4c5d98=[];for(var _0x819df4=0x0;_0x819df4<promisesContact['length'];_0x819df4++){_0x4c5d98[_0xb416('0x24')](updateContact(promisesContact[_0x819df4]['contact']));}BPromise[_0xb416('0x1e')](_0x4c5d98)[_0xb416('0x1f')](function(){_0x4c5d98=[];for(var _0x3ab299=0x0;_0x3ab299<promisesAdditionalPhones[_0xb416('0x1c')];_0x3ab299++){_0x4c5d98[_0xb416('0x24')](createAdditionalPhone(promisesAdditionalPhones[_0x3ab299][_0xb416('0x8d')],promisesAdditionalPhones[_0x3ab299][_0xb416('0x8e')],promisesAdditionalPhones[_0x3ab299][_0xb416('0x14')],promisesAdditionalPhones[_0x3ab299][_0xb416('0x8f')]));}BPromise[_0xb416('0x1e')](_0x4c5d98)[_0xb416('0x1f')](function(){_0x4c5d98=[];_0x4c5d98[_0xb416('0x24')](insertCmHopperAdditionalPhones(_0x93b30f[_0xb416('0x8b')]));_0x4c5d98[_0xb416('0x24')](_0xb416('0x90')+_0x1c241c+';');BPromise[_0xb416('0x91')](_0x4c5d98,handleQuery)[_0xb416('0x1f')](function(_0x5f102f){stats[_0xb416('0x92')]=!![];stats[_0xb416('0x93')]=updatedRows;socket[_0xb416('0x84')](_0xb416('0x94')+_0x43df24,stats);fs[_0xb416('0x95')](_0x193538);fs['unlink'](_0x9e5a7b);process[_0xb416('0x5e')](0x0);})[_0xb416('0x20')](function(_0x54b985){logger[_0xb416('0x21')](_0x54b985[_0xb416('0x60')]);process['exit'](0x1);});});});});})[_0xb416('0x20')](function(_0x441f8e){logger[_0xb416('0x21')](_0x441f8e[_0xb416('0x60')]);process['exit'](0x1);});}catch(_0x4b3ee2){logger[_0xb416('0x21')](_0xb416('0x96'),_0x4b3ee2[_0xb416('0x60')]);process[_0xb416('0x5e')](0x1);}},'error':function(_0x57c295,_0x49ea7a,_0x23dbea,_0x3884a1){throw new Error(_0x3884a1);}});});}function validate(){if(process['argv']&&process[_0xb416('0x97')][_0xb416('0x1c')]<0x4){throw new Error('arguments\x20<filename>\x20<parameters>\x20<agents>');}var _0xf42d9f=path[_0xb416('0x18')](config[_0xb416('0x66')],_0xb416('0x67'),process['argv'][0x2]);if(!fs[_0xb416('0x98')](_0xf42d9f)){throw new Error(_0xb416('0x99'));}var _0x411c33={};try{_0x411c33=JSON[_0xb416('0x70')](process[_0xb416('0x97')][0x3]);if(!_0x411c33['binding']){throw new Error(_0xb416('0x9a'));}var _0x45fefc=0x0;if(_0x411c33[_0xb416('0x64')][_0xb416('0x3b')]){_0x45fefc=0x1;}if(!_0x411c33['ListId']){throw new Error(_0xb416('0x9b'));}}catch(_0x417ad2){throw new Error(_0xb416('0x9c'));}var _0x1e3d90=[];try{_0x1e3d90=_['map'](JSON[_0xb416('0x70')](process['argv'][0x4]),'id');}catch(_0x47eb2f){logger['info']('No\x20agent\x20available');}main(_0xf42d9f,_0x411c33,_0x1e3d90,_0x45fefc);}validate();process['on'](_0xb416('0x9d'),handleStop);process['on'](_0xb416('0x9e'),handleUncaughtException);
\ No newline at end of file
index 956ac40..198de62 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb86e=['Billable\x20Time','billableseconds','getSubjects','string','toLowerCase','voice','queue','push','variable','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To','Queue','UniqueId','uniqueid','Date','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Hold\x20Time','talktime','Member\x20Name','membername','starttime','Answer\x20Time','answertime','endtime','Duration','duration'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb86e,0xa2));var _0xeb86=function(_0x13b65c,_0x1aa36f){_0x13b65c=_0x13b65c-0x0;var _0xb7b670=_0xb86e[_0x13b65c];return _0xb7b670;};'use strict';exports[_0xeb86('0x0')]=function(_0x156151,_0x387561){var _0x28554d=[{'type':_0xeb86('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x156151[_0xeb86('0x2')]()){case _0xeb86('0x3'):switch(_0x387561[_0xeb86('0x2')]()){case'inbound':_0x28554d['push']({'type':'variable','content':'','variableName':_0xeb86('0x4')});_0x28554d[_0xeb86('0x5')]({'type':_0xeb86('0x6'),'content':'','variableName':_0xeb86('0x7')});break;case _0xeb86('0x8'):_0x28554d[_0xeb86('0x5')]({'type':_0xeb86('0x1'),'content':_0xeb86('0x9'),'variableName':null});_0x28554d[_0xeb86('0x5')]({'type':_0xeb86('0x6'),'content':'','variableName':_0xeb86('0xa')});break;}}return _0x28554d;};exports[_0xeb86('0xb')]=function(_0x4031aa,_0x2dea64){var _0x2ee380=[];switch(_0x4031aa['toLowerCase']()){case _0xeb86('0x3'):switch(_0x2dea64[_0xeb86('0x2')]()){case'inbound':_0x2ee380=[{'type':_0xeb86('0x1'),'content':_0xeb86('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb86('0xd'),'content':'','key':'Caller\x20Number','keyType':_0xeb86('0x6'),'variableName':'calleridnum'},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0xe'),'keyType':_0xeb86('0x6'),'variableName':_0xeb86('0xf')},{'type':'keyValue','content':'','key':_0xeb86('0x10'),'keyType':'variable','variableName':'destexten'},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x11'),'keyType':_0xeb86('0x6'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0xeb86('0x12'),'keyType':'variable','variableName':_0xeb86('0x13')},{'type':'keyValue','content':'','key':_0xeb86('0x14'),'keyType':_0xeb86('0x6'),'variableName':_0xeb86('0x15')},{'type':'string','content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xeb86('0x16'),'keyType':_0xeb86('0x6'),'variableName':_0xeb86('0x17')},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x18'),'keyType':_0xeb86('0x6'),'variableName':_0xeb86('0xa')},{'type':'string','content':_0xeb86('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x1a'),'keyType':_0xeb86('0x6'),'variableName':_0xeb86('0x15')},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x1b'),'keyType':_0xeb86('0x6'),'variableName':'agentconnectAt'},{'type':_0xeb86('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0xeb86('0x6'),'variableName':'agentcompleteAt'},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x1c'),'keyType':_0xeb86('0x6'),'variableName':'holdtime'},{'type':'keyValue','content':'','key':'Talk\x20Time','keyType':'variable','variableName':_0xeb86('0x1d')}];break;case _0xeb86('0x8'):_0x2ee380=[{'type':_0xeb86('0x1'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0xeb86('0xd'),'content':'','key':'Called\x20Number','keyType':_0xeb86('0x6'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x1e'),'keyType':_0xeb86('0x6'),'keyContent':'','variableName':_0xeb86('0x1f')},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x12'),'keyType':_0xeb86('0x6'),'keyContent':'','variableName':_0xeb86('0x13')},{'type':_0xeb86('0xd'),'content':'','key':'Date','keyType':_0xeb86('0x6'),'keyContent':'','variableName':_0xeb86('0x20')},{'type':_0xeb86('0x1'),'content':_0xeb86('0x19')},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x21'),'keyType':_0xeb86('0x6'),'keyContent':'','variableName':_0xeb86('0x22')},{'type':_0xeb86('0xd'),'content':'','key':'Complete\x20Time','keyType':_0xeb86('0x6'),'keyContent':'','variableName':_0xeb86('0x23')},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x24'),'keyType':'variable','keyContent':'','variableName':_0xeb86('0x25')},{'type':_0xeb86('0xd'),'content':'','key':_0xeb86('0x26'),'keyType':_0xeb86('0x6'),'keyContent':'','variableName':_0xeb86('0x27')}];break;}}return _0x2ee380;};
\ No newline at end of file
+var _0xa77c=['Agent\x20Ring','agentcalledAt','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','outbound','Called\x20Number','Member\x20Name','starttime','Answer\x20Time','Duration','getSubjects','string','toLowerCase','voice','push','variable','queue','calleridnum','Outbound\x20Call','destcalleridnum','getDescriptions','inbound','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Call\x20To','destexten','Queue','UniqueId','Date','***\x20Agent\x20Info\x20***','***\x20Time\x20Info\x20***'];(function(_0x1f1091,_0x4b201d){var _0x491f7d=function(_0x35e86a){while(--_0x35e86a){_0x1f1091['push'](_0x1f1091['shift']());}};_0x491f7d(++_0x4b201d);}(_0xa77c,0x181));var _0xca77=function(_0xf88f93,_0x56279c){_0xf88f93=_0xf88f93-0x0;var _0x5c7462=_0xa77c[_0xf88f93];return _0x5c7462;};'use strict';exports[_0xca77('0x0')]=function(_0x5f028e,_0x5448fc){var _0x7a32dc=[{'type':_0xca77('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x5f028e[_0xca77('0x2')]()){case _0xca77('0x3'):switch(_0x5448fc[_0xca77('0x2')]()){case'inbound':_0x7a32dc[_0xca77('0x4')]({'type':_0xca77('0x5'),'content':'','variableName':_0xca77('0x6')});_0x7a32dc['push']({'type':'variable','content':'','variableName':_0xca77('0x7')});break;case'outbound':_0x7a32dc[_0xca77('0x4')]({'type':_0xca77('0x1'),'content':_0xca77('0x8'),'variableName':null});_0x7a32dc[_0xca77('0x4')]({'type':_0xca77('0x5'),'content':'','variableName':_0xca77('0x9')});break;}}return _0x7a32dc;};exports[_0xca77('0xa')]=function(_0x21a659,_0x437899){var _0x269b0a=[];switch(_0x21a659['toLowerCase']()){case _0xca77('0x3'):switch(_0x437899[_0xca77('0x2')]()){case _0xca77('0xb'):_0x269b0a=[{'type':'string','content':_0xca77('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0xe'),'keyType':_0xca77('0x5'),'variableName':_0xca77('0x7')},{'type':_0xca77('0xd'),'content':'','key':'Caller\x20Name','keyType':_0xca77('0x5'),'variableName':'calleridname'},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0xf'),'keyType':_0xca77('0x5'),'variableName':_0xca77('0x10')},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x11'),'keyType':_0xca77('0x5'),'variableName':_0xca77('0x6')},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x12'),'keyType':_0xca77('0x5'),'variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0xca77('0x13'),'keyType':_0xca77('0x5'),'variableName':'agentcalledAt'},{'type':_0xca77('0x1'),'content':_0xca77('0x14'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Agent\x20Name','keyType':'variable','variableName':'destcalleridname'},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':_0xca77('0x5'),'variableName':'destcalleridnum'},{'type':_0xca77('0x1'),'content':_0xca77('0x15'),'key':null,'keyType':null,'variableName':null},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x16'),'keyType':_0xca77('0x5'),'variableName':_0xca77('0x17')},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x18'),'keyType':_0xca77('0x5'),'variableName':'agentconnectAt'},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x19'),'keyType':_0xca77('0x5'),'variableName':_0xca77('0x1a')},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x1b'),'keyType':'variable','variableName':_0xca77('0x1c')},{'type':'keyValue','content':'','key':_0xca77('0x1d'),'keyType':_0xca77('0x5'),'variableName':_0xca77('0x1e')}];break;case _0xca77('0x1f'):_0x269b0a=[{'type':_0xca77('0x1'),'content':_0xca77('0xc'),'variableName':null},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x20'),'keyType':'variable','keyContent':'','variableName':_0xca77('0x9')},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x21'),'keyType':_0xca77('0x5'),'keyContent':'','variableName':'membername'},{'type':'keyValue','content':'','key':_0xca77('0x12'),'keyType':_0xca77('0x5'),'keyContent':'','variableName':'uniqueid'},{'type':_0xca77('0xd'),'content':'','key':'Date','keyType':_0xca77('0x5'),'keyContent':'','variableName':_0xca77('0x22')},{'type':_0xca77('0x1'),'content':_0xca77('0x15')},{'type':'keyValue','content':'','key':_0xca77('0x23'),'keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xca77('0xd'),'content':'','key':'Complete\x20Time','keyType':_0xca77('0x5'),'keyContent':'','variableName':'endtime'},{'type':_0xca77('0xd'),'content':'','key':_0xca77('0x24'),'keyType':_0xca77('0x5'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0xca77('0x5'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x269b0a;};
\ No newline at end of file
index 1e8fbd3..2b183db 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d4f=['order','forEach','contactName','closed','DESC','getFilteredInteractions','rows','catch','tracked','query','clone','omit','html','phone','fax','updateUser','lodash','./sql-utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','then','search','parseQueryParameters','where','body','contact','fields','filter','user','read','group','ids','tag','countFilteredInteractions','length','count','having','clause'];(function(_0x30cd7e,_0x4db10a){var _0x462a02=function(_0x157d81){while(--_0x157d81){_0x30cd7e['push'](_0x30cd7e['shift']());}};_0x462a02(++_0x4db10a);}(_0x7d4f,0xb0));var _0xf7d4=function(_0x47f038,_0x68f37b){_0x47f038=_0x47f038-0x0;var _0x211674=_0x7d4f[_0x47f038];return _0x211674;};'use strict';var _=require(_0xf7d4('0x0'));var sqlUtils=require(_0xf7d4('0x1'));var utils=require('./utils');exports[_0xf7d4('0x2')]=function(_0x302f38,_0x17f3ac,_0x499d85,_0x120b03,_0x524eb0){var _0xf82e87={'count':0x0,'rows':[]};var _0x36c5b8=sqlUtils[_0xf7d4('0x3')](_0x302f38,_0x499d85,_0x17f3ac);if(_0x36c5b8){return Promise[_0xf7d4('0x4')](_0xf82e87);}var _0x3d36ce=sqlUtils[_0xf7d4('0x5')](_0x302f38);var _0x44d245={};return Promise['resolve']()[_0xf7d4('0x6')](function(){if(_0x17f3ac['search']){return sqlUtils['parseAdvancedSearchFilter'](_0x17f3ac[_0xf7d4('0x7')],_0x524eb0);}else{return sqlUtils[_0xf7d4('0x8')](_0x302f38,_0x17f3ac,_0x524eb0);}})[_0xf7d4('0x6')](function(_0x15ae0c){_0x3d36ce[_0xf7d4('0x9')](_0x15ae0c[_0xf7d4('0xa')]);_0x3d36ce['where'](_0x15ae0c[_0xf7d4('0xb')]);_0x3d36ce[_0xf7d4('0x9')](_0x15ae0c['default']);_0x3d36ce[_0xf7d4('0x9')](_0x15ae0c[_0xf7d4('0xc')]);_0x3d36ce[_0xf7d4('0x9')](_0x15ae0c[_0xf7d4('0xd')]);_0x3d36ce[_0xf7d4('0x9')](_0x15ae0c[_0xf7d4('0xe')]);_0x3d36ce['having'](_0x15ae0c[_0xf7d4('0xf')]);_0x44d245=_0x15ae0c['tags'];return sqlUtils['checkAccountsRestrictions'](_0x302f38,_0x499d85,_0x17f3ac);})['then'](function(_0xd64d20){_0x3d36ce[_0xf7d4('0x9')](_0xd64d20);_0x3d36ce[_0xf7d4('0x10')]('i.id');var _0x2d141c=_0x17f3ac[_0xf7d4('0x7')]?_0x44d245[_0xf7d4('0x11')]:_0x17f3ac[_0xf7d4('0x12')];return sqlUtils[_0xf7d4('0x13')](_0x3d36ce,_0x2d141c);})['then'](function(_0x29772b){_0xf82e87['count']=_0x29772b[_0xf7d4('0x14')];if(_0xf82e87[_0xf7d4('0x15')]===0x0){return[];}_0x3d36ce[_0xf7d4('0x16')](_0x44d245[_0xf7d4('0x17')]);if(_0x120b03[_0xf7d4('0x18')]){_0x120b03[_0xf7d4('0x18')][_0xf7d4('0x19')](function(_0x2b018e){var _0x5e2814=_0x2b018e[0x0]===_0xf7d4('0x1a')?_0x2b018e[0x0]:'i.'+_0x2b018e[0x0];_0x3d36ce['order'](_0x5e2814,_0x2b018e[0x1]==='DESC'?![]:!![]);if(_0x2b018e[0x0]===_0xf7d4('0x1b')){var _0x568d76=sqlUtils['getClosedOrderClause'](_0x302f38,_0x17f3ac);_0x3d36ce[_0xf7d4('0x18')](_0x568d76,_0x2b018e[0x1]===_0xf7d4('0x1c')?![]:!![]);}});}return sqlUtils[_0xf7d4('0x1d')](_0x302f38,_0x3d36ce,_0x17f3ac,_0x120b03);})[_0xf7d4('0x6')](function(_0x13ac7f){_0xf82e87[_0xf7d4('0x1e')]=_0x13ac7f;return _0xf82e87;})[_0xf7d4('0x1f')](function(_0x43818a){throw _0x43818a;});};exports[_0xf7d4('0x20')]=function(_0x1f346d,_0x1c5e10){return function(_0x4d6781,_0x43fb48,_0x4489be){var _0xe8cfce=_0x4d6781[_0xf7d4('0xe')];var _0x36b447={};var _0x3f66a1=_0x4d6781[_0xf7d4('0x21')];if(_0x36b447){_0x36b447=_[_0xf7d4('0x22')](_0x4d6781[_0xf7d4('0xa')]);_0x36b447=_[_0xf7d4('0x23')](_0x36b447,[_0xf7d4('0xa'),_0xf7d4('0x24'),_0xf7d4('0x25'),_0xf7d4('0x26'),'mobile']);}utils[_0xf7d4('0x27')](_0xe8cfce,_0x36b447,_0x3f66a1,_0x1f346d,_0x1c5e10);_0x4489be(null);};};
\ No newline at end of file
+var _0xb25f=['phone','mobile','lodash','./sql-utils','./utils','findAll','skipInteractionsQuery','resolve','getInteractionsQuery','search','parseAdvancedSearchFilter','then','where','body','contact','default','fields','filter','user','having','read','checkAccountsRestrictions','group','i.id','ids','tag','countFilteredInteractions','count','clause','order','forEach','contactName','DESC','rows','catch','tracked','omit','html'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xb25f,0x9a));var _0xfb25=function(_0x4e53fb,_0x177133){_0x4e53fb=_0x4e53fb-0x0;var _0x123882=_0xb25f[_0x4e53fb];return _0x123882;};'use strict';var _=require(_0xfb25('0x0'));var sqlUtils=require(_0xfb25('0x1'));var utils=require(_0xfb25('0x2'));exports[_0xfb25('0x3')]=function(_0x4ea875,_0xf19b3f,_0xa95688,_0x23be8b,_0x4888bc){var _0x25eea3={'count':0x0,'rows':[]};var _0x424fff=sqlUtils[_0xfb25('0x4')](_0x4ea875,_0xa95688,_0xf19b3f);if(_0x424fff){return Promise[_0xfb25('0x5')](_0x25eea3);}var _0x289dd3=sqlUtils[_0xfb25('0x6')](_0x4ea875);var _0xb3ed7e={};return Promise['resolve']()['then'](function(){if(_0xf19b3f[_0xfb25('0x7')]){return sqlUtils[_0xfb25('0x8')](_0xf19b3f[_0xfb25('0x7')],_0x4888bc);}else{return sqlUtils['parseQueryParameters'](_0x4ea875,_0xf19b3f,_0x4888bc);}})[_0xfb25('0x9')](function(_0x1c7555){_0x289dd3[_0xfb25('0xa')](_0x1c7555[_0xfb25('0xb')]);_0x289dd3[_0xfb25('0xa')](_0x1c7555[_0xfb25('0xc')]);_0x289dd3['where'](_0x1c7555[_0xfb25('0xd')]);_0x289dd3[_0xfb25('0xa')](_0x1c7555[_0xfb25('0xe')]);_0x289dd3[_0xfb25('0xa')](_0x1c7555[_0xfb25('0xf')]);_0x289dd3['where'](_0x1c7555[_0xfb25('0x10')]);_0x289dd3[_0xfb25('0x11')](_0x1c7555[_0xfb25('0x12')]);_0xb3ed7e=_0x1c7555['tags'];return sqlUtils[_0xfb25('0x13')](_0x4ea875,_0xa95688,_0xf19b3f);})[_0xfb25('0x9')](function(_0x48a7bf){_0x289dd3[_0xfb25('0xa')](_0x48a7bf);_0x289dd3[_0xfb25('0x14')](_0xfb25('0x15'));var _0x347b4e=_0xf19b3f[_0xfb25('0x7')]?_0xb3ed7e[_0xfb25('0x16')]:_0xf19b3f[_0xfb25('0x17')];return sqlUtils[_0xfb25('0x18')](_0x289dd3,_0x347b4e);})[_0xfb25('0x9')](function(_0x58d42c){_0x25eea3[_0xfb25('0x19')]=_0x58d42c['length'];if(_0x25eea3['count']===0x0){return[];}_0x289dd3[_0xfb25('0x11')](_0xb3ed7e[_0xfb25('0x1a')]);if(_0x23be8b[_0xfb25('0x1b')]){_0x23be8b[_0xfb25('0x1b')][_0xfb25('0x1c')](function(_0x5c1fe9){var _0x2c6289=_0x5c1fe9[0x0]===_0xfb25('0x1d')?_0x5c1fe9[0x0]:'i.'+_0x5c1fe9[0x0];_0x289dd3['order'](_0x2c6289,_0x5c1fe9[0x1]===_0xfb25('0x1e')?![]:!![]);if(_0x5c1fe9[0x0]==='closed'){var _0xb4592c=sqlUtils['getClosedOrderClause'](_0x4ea875,_0xf19b3f);_0x289dd3[_0xfb25('0x1b')](_0xb4592c,_0x5c1fe9[0x1]===_0xfb25('0x1e')?![]:!![]);}});}return sqlUtils['getFilteredInteractions'](_0x4ea875,_0x289dd3,_0xf19b3f,_0x23be8b);})[_0xfb25('0x9')](function(_0x36e634){_0x25eea3[_0xfb25('0x1f')]=_0x36e634;return _0x25eea3;})[_0xfb25('0x20')](function(_0x65b4f6){throw _0x65b4f6;});};exports[_0xfb25('0x21')]=function(_0x2cfc67,_0x12938b){return function(_0x4a5cd6,_0x9f9749,_0x3da068){var _0x23077e=_0x4a5cd6[_0xfb25('0x10')];var _0x2432a3={};var _0x242863=_0x4a5cd6['query'];if(_0x2432a3){_0x2432a3=_['clone'](_0x4a5cd6['body']);_0x2432a3=_[_0xfb25('0x22')](_0x2432a3,[_0xfb25('0xb'),_0xfb25('0x23'),_0xfb25('0x24'),'fax',_0xfb25('0x25')]);}utils['updateUser'](_0x23077e,_0x2432a3,_0x242863,_0x2cfc67,_0x12938b);_0x3da068(null);};};
\ No newline at end of file
index e6a23d0..7c6a28f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8a12=['role','agent','select','field','from','tools_tags','getInteractionFK','user_has_','_interactions','u.fullname','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','forEach','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','whatsapp','includes','fax','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','mail','isEmail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','name','buildExpression','type','default','text','start','value','end','unreadMessages','and','Contact','operator','$substring','split','contact','ContactId','Tag','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','\x20IN\x20?','createdAt','$gte','parse','$lte','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','read','tag','tags','filter','get','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','join','capitalize','Interaction','Sequelize','QueryTypes','query','toString','keyBy','merge','attributes','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.updatedAt','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.thirdDisposition','i.to','i.ContactId','i.MailAccountId','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','TagIds','limit','offset','sequelize','groupBy','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','getSelectedTags','t.id\x20IN\x20?','SELECT','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK'];(function(_0x4d7116,_0xdb8175){var _0x4593dc=function(_0x51d44e){while(--_0x51d44e){_0x4d7116['push'](_0x4d7116['shift']());}};_0x4593dc(++_0xdb8175);}(_0x8a12,0x1d7));var _0x28a1=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8a12[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x28a1('0x0'));var squel=require(_0x28a1('0x1'));var as=require(_0x28a1('0x2'));var qs=require(_0x28a1('0x3'));var updateInteraction=require(_0x28a1('0x4'))[_0x28a1('0x5')];var utils=require(_0x28a1('0x6'));var db=require(_0x28a1('0x7'))['db'];function skipInteractionsQuery(_0x2f9438,_0x46b12b,_0x14c2c7){var _0x42ed4c=![];var _0xc6463f=utils[_0x28a1('0x8')](_0x2f9438);if(_0x46b12b[_0x28a1('0x9')]===_0x28a1('0xa')&&!_0x14c2c7['search']&&!_0x14c2c7[_0xc6463f]){_0x42ed4c=!![];}return _0x42ed4c;}function getTagsQuery(){return squel[_0x28a1('0xb')]()['field']('id')[_0x28a1('0xc')]('name')[_0x28a1('0xc')]('color')[_0x28a1('0xd')](_0x28a1('0xe'));}function getUsersQuery(_0x21aa23,_0x621bf5){var _0x49c601=utils[_0x28a1('0xf')](_0x21aa23);var _0x44f142=_0x28a1('0x10')+_0x21aa23+_0x28a1('0x11');var _0x9ccc51=squel['select']()[_0x28a1('0xc')]('u.id')[_0x28a1('0xc')](_0x28a1('0x12'))[_0x28a1('0xc')]('ui.'+_0x49c601)['from'](_0x44f142,'ui')[_0x28a1('0x13')](_0x28a1('0x14'),'u',_0x28a1('0x15'));if(_0x621bf5[_0x28a1('0x16')]>0x0){_0x9ccc51[_0x28a1('0x17')]('ui.'+_0x49c601+'\x20IN\x20?',_[_0x28a1('0x18')](_0x621bf5,'id'));}return _0x9ccc51;}function getInteractionsQuery(_0x4b46a5){var _0x137300=utils[_0x28a1('0x19')](_0x4b46a5);var _0x43a96f=utils['getAccountFK'](_0x4b46a5);var _0xede03c=utils[_0x28a1('0xf')](_0x4b46a5);return squel[_0x28a1('0xb')]()[_0x28a1('0xd')](_0x137300[_0x28a1('0x1a')],'i')[_0x28a1('0x13')]('cm_contacts','c',_0x28a1('0x1b'))[_0x28a1('0x13')](_0x28a1('0x14'),'o',_0x28a1('0x1c'))[_0x28a1('0x13')](_0x137300[_0x28a1('0x1d')],'a',_0x28a1('0x1e')+_0x43a96f)[_0x28a1('0x13')](_0x137300[_0x28a1('0x1f')],'me',_0x28a1('0x20')+_0xede03c+'\x20=\x20i.id')[_0x28a1('0x13')](_0x137300['interactionsTags'],'it','it.'+_0xede03c+_0x28a1('0x21'))['left_join'](_0x28a1('0xe'),'t',_0x28a1('0x22'));}function getSqlClauses(){var _0x24263d={'body':squel[_0x28a1('0x23')](),'contact':squel[_0x28a1('0x23')](),'default':squel[_0x28a1('0x23')](),'fields':squel[_0x28a1('0x23')](),'filter':squel[_0x28a1('0x23')](),'read':squel['expr'](),'tags':{'clause':squel[_0x28a1('0x23')](),'ids':null},'user':squel['expr']()};return _0x24263d;}function parseTagParameter(_0x557f44){var _0x3cba9f=squel[_0x28a1('0x23')]();if(_0x557f44){var _0x46b25a=utils['getSelectedTags'](_0x557f44);_0x46b25a[_0x28a1('0x24')](function(_0x14f283){_0x3cba9f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x14f283+',%');});}return _0x3cba9f;}function parseReadParameter(_0x1d0d4b){var _0x1d16c4='';if(_0x1d0d4b){_0x1d16c4='unreadMessages\x20{OPERATOR}\x200';if(_0x1d0d4b==='1'){_0x1d16c4=_0x1d16c4[_0x28a1('0x25')]('{OPERATOR}','=');}else{_0x1d16c4=_0x1d16c4[_0x28a1('0x25')](_0x28a1('0x26'),'>');}}return _0x1d16c4;}function parseSearchFilter(_0x222b4a,_0x411f86){var _0x3eb575=squel[_0x28a1('0x23')]();if(_0x411f86){var _0x1fbe51=_0x411f86[_0x28a1('0x25')]('\x5c','\x5c\x5c')[_0x28a1('0x25')](/'/g,'\x27\x27');if(qs[_0x28a1('0x27')](_0x1fbe51)){_0x3eb575['or'](_0x28a1('0x28'),_0x1fbe51+'%');if(['sms',_0x28a1('0x29')][_0x28a1('0x2a')](_0x222b4a)){_0x3eb575['or']('i.phone\x20LIKE\x20?',_0x1fbe51+'%');}else if(_0x222b4a===_0x28a1('0x2b')){_0x3eb575['or'](_0x28a1('0x2c'),_0x1fbe51+'%');}else if(_0x222b4a==='openchannel'){_0x3eb575['or'](_0x28a1('0x2d'),_0x1fbe51+'%');}}else if(_0x222b4a===_0x28a1('0x2e')&&qs[_0x28a1('0x2f')](_0x1fbe51)){_0x3eb575['or']('c.email\x20LIKE\x20?',_0x1fbe51+'%');}else{if(_0x222b4a===_0x28a1('0x2e')){_0x3eb575['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x28a1('0x30')](_0x1fbe51,!![]))['or'](_0x28a1('0x31'),qs[_0x28a1('0x30')](_0x1fbe51));}else if(_0x222b4a!==_0x28a1('0x2b')){_0x3eb575['or'](_0x28a1('0x32'),qs[_0x28a1('0x30')](_0x1fbe51));}_0x3eb575['or'](_0x28a1('0x33'),qs['getFullTextValue'](_0x1fbe51,!![]),null);}}return _0x3eb575;}function parseAdvancedSearchFilter(_0x25e745,_0x40ecc2){var _0x1cc433=getSqlClauses();var _0xb7d34e=as['parseSearch'](_0x25e745);var _0x3f94c7=_0xb7d34e[_0x28a1('0x34')];for(var _0x50cd6a=0x0;_0x50cd6a<_0xb7d34e[_0x28a1('0x35')][_0x28a1('0x16')];_0x50cd6a++){var _0x455924=_0xb7d34e[_0x28a1('0x35')][_0x50cd6a];var _0x164c09='i';var _0x339290=_[_0x28a1('0x36')](_0x40ecc2,[_0x28a1('0x37'),_0x455924['field']]);if(_0x339290){var _0x6caaef=as[_0x28a1('0x38')](_0x164c09,_0x339290[_0x28a1('0x39')],_0x455924);_0x1cc433[_0x28a1('0x3a')][_0x3f94c7](_0x6caaef[_0x28a1('0x3b')],_0x6caaef['value'][_0x28a1('0x3c')],_0x6caaef[_0x28a1('0x3d')][_0x28a1('0x3e')]);}else{switch(_0x455924[_0x28a1('0xc')]){case _0x28a1('0x3f'):var _0x50f4f2=parseReadParameter(_0x455924[_0x28a1('0x3d')]);_0x1cc433['read'][_0x28a1('0x40')](_0x50f4f2);break;case _0x28a1('0x41'):if(_0x455924[_0x28a1('0x42')]===_0x28a1('0x43')){if(_0x455924[_0x28a1('0x3d')][_0x28a1('0x44')]('\x20')[_0x28a1('0x16')]>0x1){_0x1cc433[_0x28a1('0x45')][_0x3f94c7](_0x28a1('0x33'),qs[_0x28a1('0x30')](_0x455924[_0x28a1('0x3d')],!![]),null);}else{var _0x38287c='%'+_0x455924[_0x28a1('0x3d')]+'%';_0x1cc433[_0x28a1('0x45')][_0x3f94c7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x38287c,_0x38287c,_0x38287c);}}else{_0x339290=_[_0x28a1('0x36')](_0x40ecc2,['name',_0x28a1('0x46')]);_0x455924['field']=_0x28a1('0x46');_0x6caaef=as[_0x28a1('0x38')](_0x164c09,_0x339290[_0x28a1('0x39')],_0x455924);_0x1cc433['contact'][_0x3f94c7](_0x6caaef[_0x28a1('0x3b')],_0x6caaef[_0x28a1('0x3d')]['start'],_0x6caaef[_0x28a1('0x3d')][_0x28a1('0x3e')]);}break;case _0x28a1('0x47'):var _0x1cb121=_0x455924[_0x28a1('0x3d')][_0x28a1('0x44')](',')[_0x28a1('0x18')](function(_0x244bfb){return Number(_0x244bfb);});var _0x40216a=parseTagParameter(_0x1cb121);_0x1cc433['tags'][_0x28a1('0x48')][_0x28a1('0x40')](_0x40216a);_0x1cc433['tags'][_0x28a1('0x49')]=_0x1cb121;break;case _0x28a1('0x4a'):if(_0x455924['operator']===_0x28a1('0x43')){_0x1cc433[_0x28a1('0x4b')][_0x3f94c7](_0x28a1('0x4c'),'%'+_0x455924[_0x28a1('0x3d')]+'%',null);}else{_0x339290=_[_0x28a1('0x36')](_0x40ecc2,[_0x28a1('0x37'),_0x28a1('0x4d')]);_0x455924[_0x28a1('0xc')]=_0x28a1('0x4d');_0x6caaef=as[_0x28a1('0x38')](_0x164c09,_0x339290[_0x28a1('0x39')],_0x455924);_0x1cc433[_0x28a1('0x4b')][_0x3f94c7](_0x6caaef[_0x28a1('0x3b')],_0x6caaef[_0x28a1('0x3d')][_0x28a1('0x3c')],_0x6caaef[_0x28a1('0x3d')][_0x28a1('0x3e')]);}break;case'body':case'plainBody':_0x6caaef=as[_0x28a1('0x38')]('me',null,_0x455924);_0x1cc433[_0x28a1('0x4e')][_0x3f94c7](_0x6caaef[_0x28a1('0x3b')],_0x6caaef[_0x28a1('0x3d')]['start'],_0x6caaef[_0x28a1('0x3d')][_0x28a1('0x3e')]);break;}}}return _0x1cc433;}function parseModelFields(_0x360402,_0x1df448,_0x2165a4){var _0x49dfd6=utils[_0x28a1('0x8')](_0x360402);var _0x31bdac=squel[_0x28a1('0x23')]();var _0x513d23=_(_0x1df448)[_0x28a1('0x4f')]()['map'](function(_0x507880){return _[_0x28a1('0x50')](_0x2165a4,[_0x28a1('0x37'),_0x507880])?_0x507880:undefined;})[_0x28a1('0x51')]()['value']();if(_0x513d23[_0x28a1('0x16')]>0x0){_0x513d23['forEach'](function(_0x125a15){if(_0x125a15===_0x49dfd6){_0x31bdac[_0x28a1('0x40')]('i.'+_0x49dfd6+_0x28a1('0x52'),[]['concat'](_0x1df448[_0x125a15]));}else if(_0x125a15===_0x28a1('0x53')){var _0x2058a3=JSON['parse'](_0x1df448[_0x125a15])[_0x28a1('0x54')];var _0x2f61be=JSON[_0x28a1('0x55')](_0x1df448[_0x125a15])[_0x28a1('0x56')];_0x31bdac[_0x28a1('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2058a3,_0x2f61be);}else{if(_0x1df448[_0x125a15]==='null'){_0x31bdac[_0x28a1('0x40')]('i.'+_0x125a15+_0x28a1('0x57'));}else{_0x31bdac[_0x28a1('0x40')]('i.'+_0x125a15+_0x28a1('0x58'),_0x1df448[_0x125a15]);}}});}return _0x31bdac;}function parseQueryParameters(_0x433440,_0xbed4a9,_0x58130d){var _0x2c6a55=getSqlClauses();return Promise[_0x28a1('0x59')]()[_0x28a1('0x5a')](function(){return parseModelFields(_0x433440,_0xbed4a9,_0x58130d);})[_0x28a1('0x5a')](function(_0x45eac2){_0x2c6a55[_0x28a1('0x5b')][_0x28a1('0x40')](_0x45eac2);return parseReadParameter(_0xbed4a9[_0x28a1('0x5c')]);})['then'](function(_0x37ffe2){_0x2c6a55['read'][_0x28a1('0x40')](_0x37ffe2);return parseTagParameter(_0xbed4a9[_0x28a1('0x5d')]);})[_0x28a1('0x5a')](function(_0x5b5c56){_0x2c6a55[_0x28a1('0x5e')]['clause']['and'](_0x5b5c56);return parseSearchFilter(_0x433440,_0xbed4a9[_0x28a1('0x5f')]);})[_0x28a1('0x5a')](function(_0x332968){_0x2c6a55[_0x28a1('0x5f')]=_0x332968;return _0x2c6a55;});}function checkAccountsRestrictions(_0x58a33d,_0x150296,_0x162893){var _0x5daf8f=utils['getAccountFK'](_0x58a33d);var _0x26f126=_0x28a1('0x60')+_['capitalize'](_0x58a33d)+(_0x58a33d==='chat'?_0x28a1('0x61'):_0x28a1('0x62'));var _0x15424c=squel[_0x28a1('0x23')]();return Promise['resolve']()[_0x28a1('0x5a')](function(){if(_0x162893[_0x28a1('0x63')]&&_0x150296[_0x28a1('0x9')]===_0x28a1('0xa')){return _0x150296[_0x26f126]({'attributes':['id'],'raw':!![]});}})['then'](function(_0xad1c74){if(_0xad1c74){if(_0xad1c74['length']===0x0){_0x15424c['and']('i.'+_0x5daf8f+_0x28a1('0x57'));}else{_0x15424c[_0x28a1('0x40')]('i.'+_0x5daf8f+_0x28a1('0x52'),_[_0x28a1('0x18')](_0xad1c74,'id'));}}else if(!_0x162893[_0x5daf8f]){_0x15424c[_0x28a1('0x40')]('i.'+_0x5daf8f+_0x28a1('0x64'));}})[_0x28a1('0x5a')](function(){return _0x15424c;});}function getClosedOrderClause(_0x405ebe,_0x2d0f42){var _0x799b4e='';var _0x3dfc73=['i.thirdDisposition',_0x28a1('0x65'),_0x28a1('0x66')];if(_0x405ebe===_0x28a1('0x2e')){_0x3dfc73[_0x28a1('0x67')](_0x28a1('0x68'));}if(_0x2d0f42[_0x28a1('0x69')]==='0'&&_0x405ebe===_0x28a1('0x2e')){_0x799b4e=_0x28a1('0x68');}else{if(_0x2d0f42[_0x28a1('0x69')]==='1'){_0x3dfc73[_0x28a1('0x6a')]();}_0x799b4e='CONCAT_WS(\x27\x27,\x20'+_0x3dfc73[_0x28a1('0x6b')](',\x20')+')';}return _0x799b4e;}function getFilteredInteractions(_0x2c967d,_0x1fded0,_0xfdf18e,_0x3f9a22){var _0x30c219=utils['getInteractionFK'](_0x2c967d);var _0x391b02=_[_0x28a1('0x6c')](_0x2c967d)+_0x28a1('0x6d');var _0x2087b8=[];var _0x452976=getTagsQuery();var _0x2e96df={'type':db[_0x28a1('0x6e')][_0x28a1('0x6f')]['SELECT'],'raw':!![]};var _0x26bd33=[];var _0x1a1a0a=[];return db['sequelize'][_0x28a1('0x70')](_0x452976[_0x28a1('0x71')](),_0x2e96df)['then'](function(_0x5a318e){_0x2087b8=_[_0x28a1('0x72')](_0x5a318e,'id');_0x2e96df=_[_0x28a1('0x73')](_0x2e96df,{'model':db[_0x391b02],'mapToModel':!![],'nest':!![]});if(_0xfdf18e[_0x28a1('0x5b')]){_0x3f9a22[_0x28a1('0x74')][_0x28a1('0x24')](function(_0x3865f8){_0x1fded0[_0x28a1('0xc')]('i.'+_0x3865f8);});}else{_0x1fded0[_0x28a1('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x28a1('0x3f'));_0x1fded0[_0x28a1('0xc')]('a.key',_0x28a1('0x75'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x76'),_0x28a1('0x77'));if(_0x2c967d===_0x28a1('0x2e')){_0x1fded0[_0x28a1('0xc')](_0x28a1('0x78'),'Account.email');_0x1fded0[_0x28a1('0xc')](_0x28a1('0x79'),'contactName');_0x1fded0['field'](_0x28a1('0x7a'));_0x1fded0['field']('i.createdAt');_0x1fded0[_0x28a1('0xc')](_0x28a1('0x7b'));_0x1fded0[_0x28a1('0xc')]('i.closed');_0x1fded0[_0x28a1('0xc')](_0x28a1('0x7c'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x7d'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x7e'));_0x1fded0[_0x28a1('0xc')]('i.lastMsgDirection');_0x1fded0[_0x28a1('0xc')](_0x28a1('0x7f'));_0x1fded0[_0x28a1('0xc')]('i.disposition');_0x1fded0['field']('i.secondDisposition');_0x1fded0[_0x28a1('0xc')](_0x28a1('0x80'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x68'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x81'));_0x1fded0['field'](_0x28a1('0x82'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x83'));_0x1fded0['field']('i.UserId');}else if(_0x2c967d==='openchannel'){_0x1fded0[_0x28a1('0xc')]('CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}else{_0x1fded0['field'](_0x28a1('0x84'),_0x28a1('0x85'));}if(_0x2c967d!==_0x28a1('0x2e')){_0x1fded0[_0x28a1('0xc')](_0x28a1('0x86'));}_0x1fded0[_0x28a1('0xc')](_0x28a1('0x87'),_0x28a1('0x88'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x89'),'Contact.lastName');_0x1fded0[_0x28a1('0xc')](_0x28a1('0x8a'),'Contact.email');_0x1fded0[_0x28a1('0xc')](_0x28a1('0x8b'),_0x28a1('0x8c'));_0x1fded0[_0x28a1('0xc')]('c.mobile',_0x28a1('0x8d'));_0x1fded0[_0x28a1('0xc')]('c.fax',_0x28a1('0x8e'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x8f'),_0x28a1('0x90'));_0x1fded0[_0x28a1('0xc')](_0x28a1('0x91'),_0x28a1('0x92'));_0x1fded0[_0x28a1('0xc')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x28a1('0x93'));}if(_0x3f9a22[_0x28a1('0x94')]){_0x1fded0['limit'](_0x3f9a22[_0x28a1('0x94')]);}if(_0x3f9a22[_0x28a1('0x95')]){_0x1fded0['offset'](_0x3f9a22[_0x28a1('0x95')]);}return db[_0x28a1('0x96')]['query'](_0x1fded0[_0x28a1('0x71')](),_0x2e96df);})['then'](function(_0x4e4634){_0x26bd33=_0x4e4634;var _0x1ab453=getUsersQuery(_0x2c967d,_0x26bd33);return db[_0x28a1('0x96')]['query'](_0x1ab453[_0x28a1('0x71')](),_0x2e96df);})[_0x28a1('0x5a')](function(_0x52f4e2){_0x1a1a0a=_[_0x28a1('0x97')](_0x52f4e2,_0x30c219);if(_0x2c967d===_0x28a1('0x2e')){return db['Setting']['findOne']({'attributes':['enableEmailPreview'],'raw':!![]});}})[_0x28a1('0x5a')](function(_0x4727e8){var _0x9bcb6b=_0x4727e8?_0x4727e8['enableEmailPreview']:undefined;var _0x1d01ce=_0x26bd33[_0x28a1('0x18')](function(_0x5cd6a6){return updateInteraction(_0x5cd6a6,_0x2087b8,_0x1a1a0a,_0x9bcb6b);});return Promise[_0x28a1('0x98')](_0x1d01ce);});}function countFilteredInteractions(_0xe8670d,_0x25b2eb){var _0x4696ea=_0xe8670d[_0x28a1('0x99')]();_0x4696ea[_0x28a1('0xc')](_0x28a1('0x9a'));_0x4696ea['field'](_0x28a1('0x9b'),'unreadMessages');var _0x57a1db=utils[_0x28a1('0x9c')](_0x25b2eb);if(!_['isEmpty'](_0x57a1db)){_0x4696ea[_0x28a1('0x17')](_0x28a1('0x9d'),_0x57a1db);}var _0xc6091c={'type':db[_0x28a1('0x6e')][_0x28a1('0x6f')][_0x28a1('0x9e')],'raw':!![]};return db[_0x28a1('0x96')][_0x28a1('0x70')](_0x4696ea['toString'](),_0xc6091c);}module[_0x28a1('0x9f')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery};
\ No newline at end of file
+var _0x1141=['then','fields','read','tag','filter','get','capitalize','chat','Websites','Accounts','resolve','search','\x20IS\x20NULL','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.substatus','i.to','i.ContactId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','enableEmailPreview','all','clone','COUNT(*)','isEmpty','where','t.id\x20IN\x20?','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','select','field','name','color','from','tools_tags','getInteractionFK','user_has_','_interactions','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','\x20IN\x20?','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','me.','interactionsTags','it.','\x20=\x20i.id','expr','getSelectedTags','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','includes','i.phone\x20LIKE\x20?','fax','openchannel','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','find','type','default','text','value','end','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','start','map','tags','clause','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','plainBody','keys','some','compact','forEach','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x1141,0x199));var _0x1114=function(_0x1fc82b,_0x5150a6){_0x1fc82b=_0x1fc82b-0x0;var _0x4c6679=_0x1141[_0x1fc82b];return _0x4c6679;};'use strict';var _=require(_0x1114('0x0'));var squel=require('squel');var as=require(_0x1114('0x1'));var qs=require(_0x1114('0x2'));var updateInteraction=require(_0x1114('0x3'))[_0x1114('0x4')];var utils=require(_0x1114('0x5'));var db=require(_0x1114('0x6'))['db'];function skipInteractionsQuery(_0x3900d7,_0x4a0d8e,_0x57a333){var _0x414f9e=![];var _0x5ba94b=utils[_0x1114('0x7')](_0x3900d7);if(_0x4a0d8e[_0x1114('0x8')]===_0x1114('0x9')&&!_0x57a333['search']&&!_0x57a333[_0x5ba94b]){_0x414f9e=!![];}return _0x414f9e;}function getTagsQuery(){return squel[_0x1114('0xa')]()[_0x1114('0xb')]('id')['field'](_0x1114('0xc'))['field'](_0x1114('0xd'))[_0x1114('0xe')](_0x1114('0xf'));}function getUsersQuery(_0x13ca06,_0x1a1d96){var _0x599960=utils[_0x1114('0x10')](_0x13ca06);var _0x43ac68=_0x1114('0x11')+_0x13ca06+_0x1114('0x12');var _0x12537c=squel['select']()[_0x1114('0xb')](_0x1114('0x13'))[_0x1114('0xb')]('u.fullname')[_0x1114('0xb')](_0x1114('0x14')+_0x599960)[_0x1114('0xe')](_0x43ac68,'ui')[_0x1114('0x15')](_0x1114('0x16'),'u',_0x1114('0x17'));if(_0x1a1d96[_0x1114('0x18')]>0x0){_0x12537c['where'](_0x1114('0x14')+_0x599960+_0x1114('0x19'),_['map'](_0x1a1d96,'id'));}return _0x12537c;}function getInteractionsQuery(_0x5b6f6){var _0x5621a2=utils['getInteractionsTables'](_0x5b6f6);var _0xe410e4=utils[_0x1114('0x7')](_0x5b6f6);var _0x44fa1f=utils[_0x1114('0x10')](_0x5b6f6);return squel[_0x1114('0xa')]()[_0x1114('0xe')](_0x5621a2['interactions'],'i')['left_join'](_0x1114('0x1a'),'c',_0x1114('0x1b'))['left_join'](_0x1114('0x16'),'o',_0x1114('0x1c'))[_0x1114('0x15')](_0x5621a2[_0x1114('0x1d')],'a',_0x1114('0x1e')+_0xe410e4)[_0x1114('0x15')](_0x5621a2['messages'],'me',_0x1114('0x1f')+_0x44fa1f+'\x20=\x20i.id')['left_join'](_0x5621a2[_0x1114('0x20')],'it',_0x1114('0x21')+_0x44fa1f+_0x1114('0x22'))[_0x1114('0x15')]('tools_tags','t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x1e23ad={'body':squel[_0x1114('0x23')](),'contact':squel[_0x1114('0x23')](),'default':squel['expr'](),'fields':squel[_0x1114('0x23')](),'filter':squel[_0x1114('0x23')](),'read':squel[_0x1114('0x23')](),'tags':{'clause':squel[_0x1114('0x23')](),'ids':null},'user':squel[_0x1114('0x23')]()};return _0x1e23ad;}function parseTagParameter(_0x390743){var _0x369789=squel[_0x1114('0x23')]();if(_0x390743){var _0x57ae2f=utils[_0x1114('0x24')](_0x390743);_0x57ae2f['forEach'](function(_0xdae53f){_0x369789['or'](_0x1114('0x25'),'%,'+_0xdae53f+',%');});}return _0x369789;}function parseReadParameter(_0xd6b70d){var _0x211c3a='';if(_0xd6b70d){_0x211c3a='unreadMessages\x20{OPERATOR}\x200';if(_0xd6b70d==='1'){_0x211c3a=_0x211c3a[_0x1114('0x26')](_0x1114('0x27'),'=');}else{_0x211c3a=_0x211c3a[_0x1114('0x26')]('{OPERATOR}','>');}}return _0x211c3a;}function parseSearchFilter(_0x446c23,_0x34d101){var _0x10170c=squel[_0x1114('0x23')]();if(_0x34d101){var _0xb09d31=_0x34d101[_0x1114('0x26')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1114('0x28')](_0xb09d31)){_0x10170c['or'](_0x1114('0x29'),_0xb09d31+'%');if(['sms','whatsapp'][_0x1114('0x2a')](_0x446c23)){_0x10170c['or'](_0x1114('0x2b'),_0xb09d31+'%');}else if(_0x446c23===_0x1114('0x2c')){_0x10170c['or']('i.fax\x20LIKE\x20?',_0xb09d31+'%');}else if(_0x446c23===_0x1114('0x2d')){_0x10170c['or']('i.from\x20LIKE\x20?',_0xb09d31+'%');}}else if(_0x446c23===_0x1114('0x2e')&&qs[_0x1114('0x2f')](_0xb09d31)){_0x10170c['or'](_0x1114('0x30'),_0xb09d31+'%');}else{if(_0x446c23===_0x1114('0x2e')){_0x10170c['or'](_0x1114('0x31'),qs[_0x1114('0x32')](_0xb09d31,!![]))['or'](_0x1114('0x33'),qs['getFullTextValue'](_0xb09d31));}else if(_0x446c23!=='fax'){_0x10170c['or'](_0x1114('0x34'),qs['getFullTextValue'](_0xb09d31));}_0x10170c['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x1114('0x32')](_0xb09d31,!![]),null);}}return _0x10170c;}function parseAdvancedSearchFilter(_0x5091b4,_0x38bcf3){var _0x477cc3=getSqlClauses();var _0x123a3a=as[_0x1114('0x35')](_0x5091b4);var _0xca2d76=_0x123a3a[_0x1114('0x36')];for(var _0x3832ca=0x0;_0x3832ca<_0x123a3a['conditions'][_0x1114('0x18')];_0x3832ca++){var _0x244f7d=_0x123a3a[_0x1114('0x37')][_0x3832ca];var _0x316029='i';var _0x41f92c=_[_0x1114('0x38')](_0x38bcf3,[_0x1114('0xc'),_0x244f7d[_0x1114('0xb')]]);if(_0x41f92c){var _0x3f74e5=as['buildExpression'](_0x316029,_0x41f92c[_0x1114('0x39')],_0x244f7d);_0x477cc3[_0x1114('0x3a')][_0xca2d76](_0x3f74e5[_0x1114('0x3b')],_0x3f74e5[_0x1114('0x3c')]['start'],_0x3f74e5[_0x1114('0x3c')][_0x1114('0x3d')]);}else{switch(_0x244f7d[_0x1114('0xb')]){case'unreadMessages':var _0x3bd930=parseReadParameter(_0x244f7d[_0x1114('0x3c')]);_0x477cc3['read'][_0x1114('0x3e')](_0x3bd930);break;case _0x1114('0x3f'):if(_0x244f7d[_0x1114('0x40')]===_0x1114('0x41')){if(_0x244f7d[_0x1114('0x3c')][_0x1114('0x42')]('\x20')[_0x1114('0x18')]>0x1){_0x477cc3[_0x1114('0x43')][_0xca2d76]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x244f7d[_0x1114('0x3c')],!![]),null);}else{var _0x192c7c='%'+_0x244f7d[_0x1114('0x3c')]+'%';_0x477cc3['contact'][_0xca2d76](_0x1114('0x44'),_0x192c7c,_0x192c7c,_0x192c7c);}}else{_0x41f92c=_[_0x1114('0x38')](_0x38bcf3,[_0x1114('0xc'),_0x1114('0x45')]);_0x244f7d['field']=_0x1114('0x45');_0x3f74e5=as[_0x1114('0x46')](_0x316029,_0x41f92c['type'],_0x244f7d);_0x477cc3[_0x1114('0x43')][_0xca2d76](_0x3f74e5[_0x1114('0x3b')],_0x3f74e5[_0x1114('0x3c')][_0x1114('0x47')],_0x3f74e5['value'][_0x1114('0x3d')]);}break;case'Tag':var _0x51758f=_0x244f7d[_0x1114('0x3c')][_0x1114('0x42')](',')[_0x1114('0x48')](function(_0x4c8584){return Number(_0x4c8584);});var _0x11dfd2=parseTagParameter(_0x51758f);_0x477cc3[_0x1114('0x49')][_0x1114('0x4a')]['and'](_0x11dfd2);_0x477cc3[_0x1114('0x49')]['ids']=_0x51758f;break;case _0x1114('0x4b'):if(_0x244f7d[_0x1114('0x40')]===_0x1114('0x41')){_0x477cc3[_0x1114('0x4c')][_0xca2d76](_0x1114('0x4d'),'%'+_0x244f7d['value']+'%',null);}else{_0x41f92c=_[_0x1114('0x38')](_0x38bcf3,[_0x1114('0xc'),_0x1114('0x4e')]);_0x244f7d[_0x1114('0xb')]=_0x1114('0x4e');_0x3f74e5=as['buildExpression'](_0x316029,_0x41f92c[_0x1114('0x39')],_0x244f7d);_0x477cc3[_0x1114('0x4c')][_0xca2d76](_0x3f74e5[_0x1114('0x3b')],_0x3f74e5[_0x1114('0x3c')]['start'],_0x3f74e5['value'][_0x1114('0x3d')]);}break;case _0x1114('0x4f'):case _0x1114('0x50'):_0x3f74e5=as['buildExpression']('me',null,_0x244f7d);_0x477cc3[_0x1114('0x4f')][_0xca2d76](_0x3f74e5[_0x1114('0x3b')],_0x3f74e5[_0x1114('0x3c')][_0x1114('0x47')],_0x3f74e5['value']['end']);break;}}}return _0x477cc3;}function parseModelFields(_0x54df23,_0x98cec7,_0x343ce5){var _0x98d8fc=utils[_0x1114('0x7')](_0x54df23);var _0x57d3ec=squel[_0x1114('0x23')]();var _0x586227=_(_0x98cec7)[_0x1114('0x51')]()['map'](function(_0x222827){return _[_0x1114('0x52')](_0x343ce5,[_0x1114('0xc'),_0x222827])?_0x222827:undefined;})[_0x1114('0x53')]()[_0x1114('0x3c')]();if(_0x586227['length']>0x0){_0x586227[_0x1114('0x54')](function(_0x1846f5){if(_0x1846f5===_0x98d8fc){_0x57d3ec[_0x1114('0x3e')]('i.'+_0x98d8fc+'\x20IN\x20?',[][_0x1114('0x55')](_0x98cec7[_0x1846f5]));}else if(_0x1846f5===_0x1114('0x56')){var _0x22e3b0=JSON[_0x1114('0x57')](_0x98cec7[_0x1846f5])[_0x1114('0x58')];var _0x41a26f=JSON[_0x1114('0x57')](_0x98cec7[_0x1846f5])[_0x1114('0x59')];_0x57d3ec['and'](_0x1114('0x5a'),_0x22e3b0,_0x41a26f);}else{if(_0x98cec7[_0x1846f5]===_0x1114('0x5b')){_0x57d3ec[_0x1114('0x3e')]('i.'+_0x1846f5+'\x20IS\x20NULL');}else{_0x57d3ec[_0x1114('0x3e')]('i.'+_0x1846f5+'\x20=\x20?',_0x98cec7[_0x1846f5]);}}});}return _0x57d3ec;}function parseQueryParameters(_0x29f001,_0x2f7301,_0x2c15f2){var _0x33c54c=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x29f001,_0x2f7301,_0x2c15f2);})[_0x1114('0x5c')](function(_0x53b951){_0x33c54c[_0x1114('0x5d')][_0x1114('0x3e')](_0x53b951);return parseReadParameter(_0x2f7301[_0x1114('0x5e')]);})[_0x1114('0x5c')](function(_0x3ed611){_0x33c54c[_0x1114('0x5e')][_0x1114('0x3e')](_0x3ed611);return parseTagParameter(_0x2f7301[_0x1114('0x5f')]);})[_0x1114('0x5c')](function(_0x4136de){_0x33c54c[_0x1114('0x49')][_0x1114('0x4a')][_0x1114('0x3e')](_0x4136de);return parseSearchFilter(_0x29f001,_0x2f7301[_0x1114('0x60')]);})['then'](function(_0x2fd442){_0x33c54c['filter']=_0x2fd442;return _0x33c54c;});}function checkAccountsRestrictions(_0x1adbb7,_0x40fd96,_0xe54343){var _0x318a7b=utils[_0x1114('0x7')](_0x1adbb7);var _0x5bf367=_0x1114('0x61')+_[_0x1114('0x62')](_0x1adbb7)+(_0x1adbb7===_0x1114('0x63')?_0x1114('0x64'):_0x1114('0x65'));var _0x438990=squel[_0x1114('0x23')]();return Promise[_0x1114('0x66')]()[_0x1114('0x5c')](function(){if(_0xe54343[_0x1114('0x67')]&&_0x40fd96[_0x1114('0x8')]===_0x1114('0x9')){return _0x40fd96[_0x5bf367]({'attributes':['id'],'raw':!![]});}})[_0x1114('0x5c')](function(_0x3dc4f0){if(_0x3dc4f0){if(_0x3dc4f0['length']===0x0){_0x438990['and']('i.'+_0x318a7b+_0x1114('0x68'));}else{_0x438990['and']('i.'+_0x318a7b+_0x1114('0x19'),_[_0x1114('0x48')](_0x3dc4f0,'id'));}}else if(!_0xe54343[_0x318a7b]){_0x438990[_0x1114('0x3e')]('i.'+_0x318a7b+_0x1114('0x69'));}})[_0x1114('0x5c')](function(){return _0x438990;});}function getClosedOrderClause(_0x1a1ca4,_0x2ea628){var _0x4f9f55='';var _0x41fc07=[_0x1114('0x6a'),_0x1114('0x6b'),_0x1114('0x6c')];if(_0x1a1ca4===_0x1114('0x2e')){_0x41fc07[_0x1114('0x6d')]('i.substatus');}if(_0x2ea628['closed']==='0'&&_0x1a1ca4===_0x1114('0x2e')){_0x4f9f55='i.substatus';}else{if(_0x2ea628[_0x1114('0x6e')]==='1'){_0x41fc07[_0x1114('0x6f')]();}_0x4f9f55=_0x1114('0x70')+_0x41fc07[_0x1114('0x71')](',\x20')+')';}return _0x4f9f55;}function getFilteredInteractions(_0x24346c,_0x1d3adc,_0x3e7eea,_0x593856){var _0x1f4c5f=utils['getInteractionFK'](_0x24346c);var _0x3c2d61=_[_0x1114('0x62')](_0x24346c)+_0x1114('0x72');var _0x3c5c53=[];var _0xc5c9fd=getTagsQuery();var _0x16ac7a={'type':db[_0x1114('0x73')][_0x1114('0x74')][_0x1114('0x75')],'raw':!![]};var _0x202a4e=[];var _0x4fe035=[];return db[_0x1114('0x76')][_0x1114('0x77')](_0xc5c9fd[_0x1114('0x78')](),_0x16ac7a)[_0x1114('0x5c')](function(_0x31afea){_0x3c5c53=_[_0x1114('0x79')](_0x31afea,'id');_0x16ac7a=_[_0x1114('0x7a')](_0x16ac7a,{'model':db[_0x3c2d61],'mapToModel':!![],'nest':!![]});if(_0x3e7eea['fields']){_0x593856['attributes'][_0x1114('0x54')](function(_0x36de19){_0x1d3adc[_0x1114('0xb')]('i.'+_0x36de19);});}else{_0x1d3adc[_0x1114('0xb')](_0x1114('0x7b'),_0x1114('0x7c'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x7d'),_0x1114('0x7e'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x7f'),_0x1114('0x80'));if(_0x24346c===_0x1114('0x2e')){_0x1d3adc['field'](_0x1114('0x81'),_0x1114('0x82'));_0x1d3adc['field'](_0x1114('0x83'),'contactName');_0x1d3adc['field'](_0x1114('0x84'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x85'));_0x1d3adc['field'](_0x1114('0x86'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x87'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x88'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x89'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x8a'));_0x1d3adc['field'](_0x1114('0x8b'));_0x1d3adc[_0x1114('0xb')]('i.subject');_0x1d3adc[_0x1114('0xb')](_0x1114('0x6c'));_0x1d3adc['field'](_0x1114('0x6b'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x6a'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x8c'));_0x1d3adc['field'](_0x1114('0x8d'));_0x1d3adc['field'](_0x1114('0x8e'));_0x1d3adc['field']('i.MailAccountId');_0x1d3adc[_0x1114('0xb')]('i.UserId');}else if(_0x24346c===_0x1114('0x2d')){_0x1d3adc[_0x1114('0xb')](_0x1114('0x8f'),'contactName');}else{_0x1d3adc[_0x1114('0xb')](_0x1114('0x90'),_0x1114('0x91'));}if(_0x24346c!==_0x1114('0x2e')){_0x1d3adc[_0x1114('0xb')]('i.*');}_0x1d3adc[_0x1114('0xb')]('c.firstName','Contact.firstName');_0x1d3adc[_0x1114('0xb')](_0x1114('0x92'),'Contact.lastName');_0x1d3adc[_0x1114('0xb')](_0x1114('0x93'),_0x1114('0x94'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x95'),_0x1114('0x96'));_0x1d3adc[_0x1114('0xb')]('c.mobile','Contact.mobile');_0x1d3adc[_0x1114('0xb')]('c.fax','Contact.fax');_0x1d3adc[_0x1114('0xb')](_0x1114('0x97'),_0x1114('0x98'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x99'),_0x1114('0x9a'));_0x1d3adc[_0x1114('0xb')](_0x1114('0x9b'),'TagIds');}if(_0x593856[_0x1114('0x9c')]){_0x1d3adc['limit'](_0x593856[_0x1114('0x9c')]);}if(_0x593856['offset']){_0x1d3adc[_0x1114('0x9d')](_0x593856[_0x1114('0x9d')]);}return db[_0x1114('0x76')][_0x1114('0x77')](_0x1d3adc[_0x1114('0x78')](),_0x16ac7a);})[_0x1114('0x5c')](function(_0x38fbd0){_0x202a4e=_0x38fbd0;var _0x2b9a77=getUsersQuery(_0x24346c,_0x202a4e);return db['sequelize'][_0x1114('0x77')](_0x2b9a77['toString'](),_0x16ac7a);})[_0x1114('0x5c')](function(_0x4fe0bb){_0x4fe035=_[_0x1114('0x9e')](_0x4fe0bb,_0x1f4c5f);if(_0x24346c===_0x1114('0x2e')){return db[_0x1114('0x9f')]['findOne']({'attributes':[_0x1114('0xa0')],'raw':!![]});}})[_0x1114('0x5c')](function(_0x284ca1){var _0x19ef37=_0x284ca1?_0x284ca1[_0x1114('0xa0')]:undefined;var _0x4bd10a=_0x202a4e[_0x1114('0x48')](function(_0x5a1562){return updateInteraction(_0x5a1562,_0x3c5c53,_0x4fe035,_0x19ef37);});return Promise[_0x1114('0xa1')](_0x4bd10a);});}function countFilteredInteractions(_0x362fe3,_0x18e845){var _0x1bb9c6=_0x362fe3[_0x1114('0xa2')]();_0x1bb9c6['field'](_0x1114('0xa3'));_0x1bb9c6[_0x1114('0xb')](_0x1114('0x7b'),_0x1114('0x7c'));var _0x26cbcf=utils[_0x1114('0x24')](_0x18e845);if(!_[_0x1114('0xa4')](_0x26cbcf)){_0x1bb9c6[_0x1114('0xa5')](_0x1114('0xa6'),_0x26cbcf);}var _0x311912={'type':db[_0x1114('0x73')][_0x1114('0x74')][_0x1114('0x75')],'raw':!![]};return db[_0x1114('0x76')]['query'](_0x1bb9c6[_0x1114('0x78')](),_0x311912);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery};
\ No newline at end of file
index 9093a83..1e697b9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc854=['map','fullname','split','forEach','waiting','talking','unmanaged','total','closed','disposition','abandoned','UserId','answered','out','plainBody','-id','then','lastMsgText','trimStart','updateInteraction','Users','TagIds','catch','../../mysqldb'];(function(_0x52d4ad,_0x25e611){var _0x34a767=function(_0x1f3daa){while(--_0x1f3daa){_0x52d4ad['push'](_0x52d4ad['shift']());}};_0x34a767(++_0x25e611);}(_0xc854,0xef));var _0x4c85=function(_0x33626e,_0x2c1e9a){_0x33626e=_0x33626e-0x0;var _0x254df4=_0xc854[_0x33626e];return _0x254df4;};'use strict';var _=require('lodash');var db=require(_0x4c85('0x0'))['db'];function getInteractionUsers(_0x1b0e7f,_0x3af16b){return new Promise(function(_0x4be001,_0x31abfa){try{var _0x1bdb03=[];if(_0x3af16b[_0x1b0e7f]){_0x1bdb03=_0x3af16b[_0x1b0e7f][_0x4c85('0x1')](function(_0x284f86){return{'id':_0x284f86['id'],'fullname':_0x284f86[_0x4c85('0x2')]};});}return _0x4be001(_0x1bdb03);}catch(_0x3f3ceb){_0x31abfa(_0x3f3ceb);}});}function getInteractionTags(_0xd05e82,_0x1cd095){var _0x437ee3=[];if(_0xd05e82){_0xd05e82[_0x4c85('0x3')](',')[_0x4c85('0x4')](function(_0xaeb0ea){_0x437ee3['push'](_0x1cd095[_0xaeb0ea]);});}return _0x437ee3;}function updateWaitingCounter(_0x45ec6b){if(_0x45ec6b[_0x4c85('0x5')]){_0x45ec6b[_0x4c85('0x5')]-=0x1;}}function updateInteractionCounters(_0x177b6b){_0x177b6b['waiting']=0x0;_0x177b6b[_0x4c85('0x6')]=0x0;_0x177b6b['answered']=0x0;_0x177b6b[_0x4c85('0x7')]=0x0;_0x177b6b['abandoned']=0x0;_0x177b6b[_0x4c85('0x8')]=0x0;if(_0x177b6b[_0x4c85('0x9')]){if(_0x177b6b[_0x4c85('0xa')]===_0x4c85('0xb')){_0x177b6b[_0x4c85('0xb')]+=0x1;updateWaitingCounter(_0x177b6b);}if(_0x177b6b[_0x4c85('0xc')]){_0x177b6b[_0x4c85('0xd')]+=0x1;if(_0x177b6b[_0x4c85('0x6')]){_0x177b6b[_0x4c85('0x6')]-=0x1;}}else{if(_0x177b6b['disposition']){_0x177b6b[_0x4c85('0x7')]+=0x1;updateWaitingCounter(_0x177b6b);}}}else{if(!_0x177b6b[_0x4c85('0xc')]){_0x177b6b['waiting']+=0x1;}if(_0x177b6b[_0x4c85('0xc')]){_0x177b6b[_0x4c85('0x6')]+=0x1;updateWaitingCounter(_0x177b6b);}}_0x177b6b[_0x4c85('0x8')]+=0x1;return _0x177b6b;}function getLastMessageText(_0x3851b5){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x3851b5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4c85('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4c85('0xf')],'order':_0x4c85('0x10'),'raw':!![]})[_0x4c85('0x11')](function(_0x249a5d){if(_0x249a5d&&_0x249a5d[_0x4c85('0xf')]){_0x3851b5[_0x4c85('0x12')]=_[_0x4c85('0x13')](_0x249a5d[_0x4c85('0xf')]);}return _0x3851b5;})['catch'](function(_0x487c2b){throw _0x487c2b;});}exports[_0x4c85('0x14')]=function(_0x412349,_0x414629,_0x569c2c,_0x4037a0){return new Promise(function(_0x3939d8,_0x14724f){return getInteractionUsers(_0x412349['id'],_0x569c2c)[_0x4c85('0x11')](function(_0xb13eba){_0x412349[_0x4c85('0x15')]=_0xb13eba;return getInteractionTags(_0x412349[_0x4c85('0x16')],_0x414629);})[_0x4c85('0x11')](function(_0x1aca3a){_0x412349['Tags']=_0x1aca3a;delete _0x412349[_0x4c85('0x16')];return updateInteractionCounters(_0x412349);})[_0x4c85('0x11')](function(_0xf778d2){if(_0x4037a0){return getLastMessageText(_0xf778d2);}else{return _0xf778d2;}})[_0x4c85('0x11')](function(_0x29484e){_0x3939d8(_0x29484e);})[_0x4c85('0x17')](function(_0xa1820b){_0x14724f(_0xa1820b);});});};
\ No newline at end of file
+var _0x27d6=['abandoned','UserId','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users','Tags','lodash','../../mysqldb','map','fullname','split','push','waiting','talking','answered','unmanaged','total','closed','disposition'];(function(_0x18bdb2,_0x35073d){var _0x127f4e=function(_0x3f3340){while(--_0x3f3340){_0x18bdb2['push'](_0x18bdb2['shift']());}};_0x127f4e(++_0x35073d);}(_0x27d6,0xa2));var _0x627d=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x27d6[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x627d('0x0'));var db=require(_0x627d('0x1'))['db'];function getInteractionUsers(_0x39e33a,_0x5433e2){return new Promise(function(_0x3e18b3,_0x580dbf){try{var _0xaaa24f=[];if(_0x5433e2[_0x39e33a]){_0xaaa24f=_0x5433e2[_0x39e33a][_0x627d('0x2')](function(_0x565e75){return{'id':_0x565e75['id'],'fullname':_0x565e75[_0x627d('0x3')]};});}return _0x3e18b3(_0xaaa24f);}catch(_0x271ba8){_0x580dbf(_0x271ba8);}});}function getInteractionTags(_0x39af5f,_0x46b1af){var _0x18d5ee=[];if(_0x39af5f){_0x39af5f[_0x627d('0x4')](',')['forEach'](function(_0x1f7ba4){_0x18d5ee[_0x627d('0x5')](_0x46b1af[_0x1f7ba4]);});}return _0x18d5ee;}function updateWaitingCounter(_0x365907){if(_0x365907['waiting']){_0x365907[_0x627d('0x6')]-=0x1;}}function updateInteractionCounters(_0x127cbe){_0x127cbe['waiting']=0x0;_0x127cbe[_0x627d('0x7')]=0x0;_0x127cbe[_0x627d('0x8')]=0x0;_0x127cbe[_0x627d('0x9')]=0x0;_0x127cbe['abandoned']=0x0;_0x127cbe[_0x627d('0xa')]=0x0;if(_0x127cbe[_0x627d('0xb')]){if(_0x127cbe[_0x627d('0xc')]===_0x627d('0xd')){_0x127cbe[_0x627d('0xd')]+=0x1;updateWaitingCounter(_0x127cbe);}if(_0x127cbe[_0x627d('0xe')]){_0x127cbe['answered']+=0x1;if(_0x127cbe[_0x627d('0x7')]){_0x127cbe[_0x627d('0x7')]-=0x1;}}else{if(_0x127cbe[_0x627d('0xc')]){_0x127cbe[_0x627d('0x9')]+=0x1;updateWaitingCounter(_0x127cbe);}}}else{if(!_0x127cbe['UserId']){_0x127cbe[_0x627d('0x6')]+=0x1;}if(_0x127cbe[_0x627d('0xe')]){_0x127cbe['talking']+=0x1;updateWaitingCounter(_0x127cbe);}}_0x127cbe[_0x627d('0xa')]+=0x1;return _0x127cbe;}function getLastMessageText(_0x26b454){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x26b454['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x627d('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x627d('0x10')],'order':_0x627d('0x11'),'raw':!![]})[_0x627d('0x12')](function(_0x319164){if(_0x319164&&_0x319164[_0x627d('0x10')]){_0x26b454[_0x627d('0x13')]=_[_0x627d('0x14')](_0x319164[_0x627d('0x10')]);}return _0x26b454;})[_0x627d('0x15')](function(_0x41ce7b){throw _0x41ce7b;});}exports[_0x627d('0x16')]=function(_0x46384a,_0x44ff94,_0x4fee6c,_0x251aa8){return new Promise(function(_0x21f643,_0x4d46d1){return getInteractionUsers(_0x46384a['id'],_0x4fee6c)['then'](function(_0xb4c5df){_0x46384a[_0x627d('0x17')]=_0xb4c5df;return getInteractionTags(_0x46384a['TagIds'],_0x44ff94);})[_0x627d('0x12')](function(_0xf3fd57){_0x46384a[_0x627d('0x18')]=_0xf3fd57;delete _0x46384a['TagIds'];return updateInteractionCounters(_0x46384a);})[_0x627d('0x12')](function(_0x4ba84c){if(_0x251aa8){return getLastMessageText(_0x4ba84c);}else{return _0x4ba84c;}})[_0x627d('0x12')](function(_0x477833){_0x21f643(_0x477833);})[_0x627d('0x15')](function(_0x3fca9c){_0x4d46d1(_0x3fca9c);});});};
\ No newline at end of file
index 1f3cc11..dc65bfa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x90a3=['chat-interactions','whatsapp-interactions','capitalize','Website','Account','InteractionId','unknown','chat','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','upperFirst','Interaction','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions'];(function(_0x55f317,_0x43ade1){var _0x1f834a=function(_0x472425){while(--_0x472425){_0x55f317['push'](_0x55f317['shift']());}};_0x1f834a(++_0x43ade1);}(_0x90a3,0x1aa));var _0x390a=function(_0x36f0b5,_0x34300d){_0x36f0b5=_0x36f0b5-0x0;var _0x463957=_0x90a3[_0x36f0b5];return _0x463957;};'use strict';var _=require(_0x390a('0x0'));var db=require(_0x390a('0x1'))['db'];var loggers={'openchannel':require(_0x390a('0x2'))(_0x390a('0x3')),'mail':require('../../config/logger')(_0x390a('0x4')),'fax':require(_0x390a('0x2'))(_0x390a('0x5')),'sms':require(_0x390a('0x2'))('sms-interactions'),'chat':require('../../config/logger')(_0x390a('0x6')),'whatsapp':require('../../config/logger')(_0x390a('0x7'))};function getAccountFK(_0x2ec22d){return _[_0x390a('0x8')](_0x2ec22d)+(_0x2ec22d==='chat'?_0x390a('0x9'):_0x390a('0xa'))+'Id';}function getInteractionFK(_0x2b0c9a){return _[_0x390a('0x8')](_0x2b0c9a)+_0x390a('0xb');}function getInteractionId(_0x19e0e2,_0x1df1bc,_0x330ccf){if(_0x19e0e2&&_0x19e0e2[_['upperFirst'](_0x330ccf)+'InteractionId']){return _0x19e0e2[_['upperFirst'](_0x330ccf)+_0x390a('0xb')];}else if(_0x19e0e2&&_0x19e0e2['id']){return _0x19e0e2['id'];}else if(_0x1df1bc&&_0x1df1bc['id']){return _0x1df1bc['id'];}else{return _0x390a('0xc');}}function getInteractionsTables(_0x202db6){return{'accounts':_0x202db6+'_'+(_0x202db6===_0x390a('0xd')?_0x390a('0xe'):_0x390a('0xf')),'interactions':_0x202db6+_0x390a('0x10'),'interactionsTags':_0x202db6+_0x390a('0x11'),'messages':_0x202db6+_0x390a('0x12'),'userInteractions':_0x390a('0x13')+_0x202db6+_0x390a('0x10')};}function getSelectedTags(_0x29e8f9){var _0x5d9f15=[];if(_0x29e8f9){_0x5d9f15=Array[_0x390a('0x14')](_0x29e8f9)?_0x29e8f9:[_0x29e8f9];}return _0x5d9f15;}function log(_0x20c2e4,_0x365bb7,_0x21d6c6,_0x2d6313,_0x3a6fb4,_0x79d9ba){loggers[_0x3a6fb4[_0x390a('0x15')]()][_0x20c2e4](_0x390a('0x16'),_0x79d9ba[_0x390a('0x17')](),_0x365bb7?_0x365bb7['id']:null,_0x365bb7?_0x365bb7[_0x390a('0x18')]:null,_0x365bb7?_0x365bb7['role']:null,getInteractionId(_0x21d6c6,_0x2d6313,_0x3a6fb4),_0x21d6c6?JSON[_0x390a('0x19')](_0x21d6c6):_0x390a('0x1a'));}function updateUser(_0x519777,_0x5deb90,_0x28c072,_0x2bca89,_0x38bd5d){db[_[_0x390a('0x1b')](_0x2bca89)+_0x390a('0x1c')][_0x390a('0x1d')]({'where':{'id':getInteractionId(_0x5deb90,_0x28c072,_0x2bca89)}})[_0x390a('0x1e')](function(_0x5831ff){if(_0x5831ff){return _0x5831ff[_0x390a('0x1f')]({'UserId':_0x519777?_0x519777['id']:null});}})[_0x390a('0x1e')](function(_0x3618d6){if(_0x3618d6){log(_0x390a('0x20'),_0x519777,_0x5deb90,_0x28c072,_0x2bca89,_0x38bd5d);}})[_0x390a('0x21')](function(){log(_0x390a('0x22'),_0x519777,_0x5deb90,_0x28c072,_0x2bca89,_0x38bd5d);});}module[_0x390a('0x23')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser};
\ No newline at end of file
+var _0x5ccc=['websites','_interactions','_interaction_has_tags','user_has_','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction','findOne','then','catch','exports','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','chat-interactions','whatsapp-interactions','chat','Website','Account','capitalize','InteractionId','upperFirst','unknown'];(function(_0x3a8ae5,_0x15d936){var _0x4176cf=function(_0x535bdf){while(--_0x535bdf){_0x3a8ae5['push'](_0x3a8ae5['shift']());}};_0x4176cf(++_0x15d936);}(_0x5ccc,0x127));var _0xc5cc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ccc[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require(_0xc5cc('0x0'))['db'];var loggers={'openchannel':require(_0xc5cc('0x1'))(_0xc5cc('0x2')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0xc5cc('0x3')),'sms':require(_0xc5cc('0x1'))('sms-interactions'),'chat':require(_0xc5cc('0x1'))(_0xc5cc('0x4')),'whatsapp':require('../../config/logger')(_0xc5cc('0x5'))};function getAccountFK(_0x126d90){return _['capitalize'](_0x126d90)+(_0x126d90===_0xc5cc('0x6')?_0xc5cc('0x7'):_0xc5cc('0x8'))+'Id';}function getInteractionFK(_0x1ec38b){return _[_0xc5cc('0x9')](_0x1ec38b)+_0xc5cc('0xa');}function getInteractionId(_0x27c32c,_0x1e18d7,_0x3d12e5){if(_0x27c32c&&_0x27c32c[_['upperFirst'](_0x3d12e5)+_0xc5cc('0xa')]){return _0x27c32c[_[_0xc5cc('0xb')](_0x3d12e5)+_0xc5cc('0xa')];}else if(_0x27c32c&&_0x27c32c['id']){return _0x27c32c['id'];}else if(_0x1e18d7&&_0x1e18d7['id']){return _0x1e18d7['id'];}else{return _0xc5cc('0xc');}}function getInteractionsTables(_0x520f6e){return{'accounts':_0x520f6e+'_'+(_0x520f6e===_0xc5cc('0x6')?_0xc5cc('0xd'):'accounts'),'interactions':_0x520f6e+_0xc5cc('0xe'),'interactionsTags':_0x520f6e+_0xc5cc('0xf'),'messages':_0x520f6e+'_messages','userInteractions':_0xc5cc('0x10')+_0x520f6e+'_interactions'};}function getSelectedTags(_0x3acb7a){var _0x1f31f4=[];if(_0x3acb7a){_0x1f31f4=Array['isArray'](_0x3acb7a)?_0x3acb7a:[_0x3acb7a];}return _0x1f31f4;}function log(_0x49d561,_0x4ad1db,_0x2189ad,_0x2ee52f,_0x1332a4,_0x472c39){loggers[_0x1332a4[_0xc5cc('0x11')]()][_0x49d561](_0xc5cc('0x12'),_0x472c39[_0xc5cc('0x13')](),_0x4ad1db?_0x4ad1db['id']:null,_0x4ad1db?_0x4ad1db[_0xc5cc('0x14')]:null,_0x4ad1db?_0x4ad1db['role']:null,getInteractionId(_0x2189ad,_0x2ee52f,_0x1332a4),_0x2189ad?JSON[_0xc5cc('0x15')](_0x2189ad):_0xc5cc('0x16'));}function updateUser(_0x31c655,_0x5e4071,_0x1a77c4,_0x585a86,_0x49b7b1){db[_[_0xc5cc('0xb')](_0x585a86)+_0xc5cc('0x17')][_0xc5cc('0x18')]({'where':{'id':getInteractionId(_0x5e4071,_0x1a77c4,_0x585a86)}})[_0xc5cc('0x19')](function(_0x4c8cbb){if(_0x4c8cbb){return _0x4c8cbb['update']({'UserId':_0x31c655?_0x31c655['id']:null});}})[_0xc5cc('0x19')](function(_0x19ed33){if(_0x19ed33){log('info',_0x31c655,_0x5e4071,_0x1a77c4,_0x585a86,_0x49b7b1);}})[_0xc5cc('0x1a')](function(){log('error',_0x31c655,_0x5e4071,_0x1a77c4,_0x585a86,_0x49b7b1);});}module[_0xc5cc('0x1b')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser};
\ No newline at end of file
index 01e64a5..1c44658 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x85b0=['../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','status','json','catch','users','User','admin','user','isUserLimit','crypto','util','../../mysqldb'];(function(_0x221c0e,_0x1cf4e5){var _0x1ffc3a=function(_0x5acf10){while(--_0x5acf10){_0x221c0e['push'](_0x221c0e['shift']());}};_0x1ffc3a(++_0x1cf4e5);}(_0x85b0,0x7f));var _0x085b=function(_0x3f65ee,_0x3b15c8){_0x3f65ee=_0x3f65ee-0x0;var _0x2f9c47=_0x85b0[_0x3f65ee];return _0x2f9c47;};'use strict';var crypto=require(_0x085b('0x0'));var util=require(_0x085b('0x1'));var compose=require('composable-middleware');var db=require(_0x085b('0x2'))['db'];var config=require(_0x085b('0x3'));function getValueFromLicense(_0x103f4f,_0x19e88b){if(_0x103f4f&&_0x19e88b){if(_0x19e88b[_0x085b('0x4')]&&_0x19e88b[_0x085b('0x5')]){var _0x3ce7dc=_0x19e88b[_0x085b('0x4')];var _0x24aaf3=_0x19e88b['license'];var _0xbd7580=_0x3ce7dc['split']('-')[0x4];var _0x32cba9=_0x3ce7dc[_0x085b('0x6')]('-')[0x0];var _0x208f28=crypto['createDecipher'](_0x085b('0x7'),util[_0x085b('0x8')](_0x085b('0x9'),_0xbd7580,_0x3ce7dc,_0x32cba9));var _0x4c639b=_0x208f28['update'](_0x24aaf3,_0x085b('0xa'),_0x085b('0xb'));_0x4c639b+=_0x208f28[_0x085b('0xc')](_0x085b('0xb'));var _0x2eae03=JSON[_0x085b('0xd')](_0x4c639b);return _0x2eae03[_0x085b('0xe')](_0x103f4f)?_0x2eae03[_0x103f4f]:null;}}return null;}function isLimit(_0x2defdc,_0x49c5cf,_0x1eae2f,_0x3e8acb){var _0x5b9d39=_0x49c5cf;return compose()[_0x085b('0xf')](function(_0x51c82f,_0x494e68,_0x34a834){return db['License'][_0x085b('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x085b('0x11')](function(_0x4b19bf){var _0x2753a6=getValueFromLicense(_0x2defdc,_0x4b19bf);return _0x2753a6?_0x2753a6:_0x5b9d39;})[_0x085b('0x11')](function(_0x2adb28){_0x5b9d39=_0x2adb28;return _0x1eae2f['count'](_0x3e8acb);})[_0x085b('0x11')](function(_0x344f06){if(_0x344f06>=_0x5b9d39){return _0x494e68[_0x085b('0x12')](0x193)[_0x085b('0x13')]({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x2defdc)});}_0x34a834();})[_0x085b('0x14')](function(_0x3b6a63){_0x34a834(_0x3b6a63);});});}function isUserLimit(){return isLimit(_0x085b('0x15'),0x1,db[_0x085b('0x16')],{'where':{'$or':[{'role':_0x085b('0x17')},{'role':_0x085b('0x18')}]}});}exports[_0x085b('0x19')]=isUserLimit;
\ No newline at end of file
+var _0x538f=['../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','isUserLimit','crypto','composable-middleware','../../mysqldb'];(function(_0x55c059,_0x190a59){var _0x5cdcd3=function(_0xc978d7){while(--_0xc978d7){_0x55c059['push'](_0x55c059['shift']());}};_0x5cdcd3(++_0x190a59);}(_0x538f,0x1c8));var _0xf538=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x538f[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require(_0xf538('0x0'));var util=require('util');var compose=require(_0xf538('0x1'));var db=require(_0xf538('0x2'))['db'];var config=require(_0xf538('0x3'));function getValueFromLicense(_0x5d69bd,_0x4179fd){if(_0x5d69bd&&_0x4179fd){if(_0x4179fd[_0xf538('0x4')]&&_0x4179fd[_0xf538('0x5')]){var _0x76d653=_0x4179fd[_0xf538('0x4')];var _0x36c49e=_0x4179fd[_0xf538('0x5')];var _0xc3d68f=_0x76d653[_0xf538('0x6')]('-')[0x4];var _0x1b2cda=_0x76d653[_0xf538('0x6')]('-')[0x0];var _0x259901=crypto['createDecipher'](_0xf538('0x7'),util[_0xf538('0x8')](_0xf538('0x9'),_0xc3d68f,_0x76d653,_0x1b2cda));var _0x275c5d=_0x259901[_0xf538('0xa')](_0x36c49e,_0xf538('0xb'),_0xf538('0xc'));_0x275c5d+=_0x259901[_0xf538('0xd')](_0xf538('0xc'));var _0x526f5=JSON[_0xf538('0xe')](_0x275c5d);return _0x526f5[_0xf538('0xf')](_0x5d69bd)?_0x526f5[_0x5d69bd]:null;}}return null;}function isLimit(_0x5e3037,_0x1bf1bf,_0x2c644e,_0x4105d6){var _0x29bb86=_0x1bf1bf;return compose()[_0xf538('0x10')](function(_0x3ed845,_0x33b9e6,_0x30664a){return db['License'][_0xf538('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x1125d6){var _0x558f28=getValueFromLicense(_0x5e3037,_0x1125d6);return _0x558f28?_0x558f28:_0x29bb86;})[_0xf538('0x12')](function(_0x4290c3){_0x29bb86=_0x4290c3;return _0x2c644e[_0xf538('0x13')](_0x4105d6);})['then'](function(_0x50c7df){if(_0x50c7df>=_0x29bb86){return _0x33b9e6[_0xf538('0x14')](0x193)[_0xf538('0x15')]({'message':util[_0xf538('0x8')](_0xf538('0x16'),_0x5e3037)});}_0x30664a();})[_0xf538('0x17')](function(_0x4921a1){_0x30664a(_0x4921a1);});});}function isUserLimit(){return isLimit(_0xf538('0x18'),0x1,db[_0xf538('0x19')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0xf538('0x1a')]=isUserLimit;
\ No newline at end of file
index 16d5350..2c7bdf4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e95=['[$or]','and','replace','[$and]','split','slice','forEach','shift','match','indexOf','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','includes','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','$notIn','start','pop','utcOffset','hours','minutes','seconds','moment'];(function(_0x13a45f,_0x533e58){var _0x145ef3=function(_0x17127a){while(--_0x17127a){_0x13a45f['push'](_0x13a45f['shift']());}};_0x145ef3(++_0x533e58);}(_0x8e95,0x1a7));var _0x58e9=function(_0x334700,_0x2ce489){_0x334700=_0x334700-0x0;var _0x2b565b=_0x8e95[_0x334700];return _0x2b565b;};'use strict';var _=require('lodash');var moment=require(_0x58e9('0x0'));exports['parseSearch']=function(_0x1778f8){var _0x582597={'conditions':[]};_0x582597['sqlOperator']=_['startsWith'](_0x1778f8,_0x58e9('0x1'))?'or':_0x58e9('0x2');var _0x5f133d=_0x1778f8[_0x58e9('0x3')](_0x58e9('0x4'),'')[_0x58e9('0x3')](_0x58e9('0x1'),'')['split']('||');for(var _0x45048d=0x0;_0x45048d<_0x5f133d['length'];_0x45048d++){var _0x1be626=_0x5f133d[_0x45048d][_0x58e9('0x5')](':=');var _0x42be0f=_0x1be626[0x0];var _0x3dc0a2=_0x1be626[_0x58e9('0x6')](0x1);_0x3dc0a2[_0x58e9('0x7')](function(_0x5f56e6){var _0x47b354=_0x5f56e6[_0x58e9('0x5')]('[')[_0x58e9('0x8')]();var _0x4412ce=_0x5f56e6[_0x58e9('0x9')](/\[(.*?)\]/g);_0x4412ce[_0x58e9('0x7')](function(_0x4bb77a){var _0x4c3487=_0x4bb77a[_0x58e9('0x5')]('[')['filter'](function(_0x5121f4){return _0x5121f4[_0x58e9('0xa')](']')>-0x1;})['map'](function(_0x5cf967){return _0x5cf967[_0x58e9('0x5')](']')[0x0];})[0x0];_0x582597['conditions'][_0x58e9('0xb')]({'field':_0x42be0f,'operator':_0x47b354,'value':_0x4c3487});});});}return _0x582597;};exports[_0x58e9('0xc')]=function(_0x3ff30b,_0xe455e4,_0x30caaf){var _0x341ec5={};if(_0xe455e4===_0x58e9('0xd')){if(_0x30caaf[_0x58e9('0xe')]===_0x58e9('0xf')){_0x30caaf[_0x58e9('0xe')]=_0x58e9('0x10');_0x30caaf[_0x58e9('0x11')]+=','+_0x30caaf[_0x58e9('0x11')];}else if(_['includes']([_0x58e9('0x12'),_0x58e9('0x13')],_0x30caaf[_0x58e9('0xe')])){_0x30caaf['value']=moment(_0x30caaf[_0x58e9('0x11')])[_0x58e9('0x14')](0x1,_0x58e9('0x15'))[_0x58e9('0x16')](_0x58e9('0x17'));}}if(_0x30caaf[_0x58e9('0x18')]){_0xe455e4=_0x30caaf[_0x58e9('0x18')];_0x341ec5[_0x58e9('0x19')]='CAST('+_0x3ff30b+'.'+_0x30caaf[_0x58e9('0x1a')]+_0x58e9('0x1b')+_0x30caaf[_0x58e9('0x18')]+')\x20'+parseOperator(_0x30caaf[_0x58e9('0xe')]);}else{_0x341ec5[_0x58e9('0x19')]=_0x3ff30b+'.'+_0x30caaf[_0x58e9('0x1a')]+'\x20'+parseOperator(_0x30caaf['operator']);}if(_[_0x58e9('0x1c')]([_0x58e9('0x1d'),'$notIn'],_0x30caaf[_0x58e9('0xe')]))_0x341ec5[_0x58e9('0x19')]='('+_0x341ec5[_0x58e9('0x19')]+_0x58e9('0x1e')+_0x3ff30b+'.'+_0x30caaf[_0x58e9('0x1a')]+_0x58e9('0x1f');_0x341ec5[_0x58e9('0x11')]=parseValue(_0xe455e4,_0x30caaf[_0x58e9('0xe')],_0x30caaf[_0x58e9('0x11')]);return _0x341ec5;};function parseOperator(_0x36c9c3){var _0x17e363;switch(_0x36c9c3){case _0x58e9('0x20'):_0x17e363=_0x58e9('0x21');break;case'$notIn':_0x17e363=_0x58e9('0x22');break;case _0x58e9('0xf'):_0x17e363=_0x58e9('0x23');break;case _0x58e9('0x1d'):_0x17e363=_0x58e9('0x24');break;case _0x58e9('0x25'):case _0x58e9('0x26'):case _0x58e9('0x27'):_0x17e363=_0x58e9('0x28');break;case _0x58e9('0x29'):_0x17e363=_0x58e9('0x2a');break;case _0x58e9('0x12'):_0x17e363=_0x58e9('0x2b');break;case _0x58e9('0x13'):_0x17e363='<=\x20?';break;case'$gte':_0x17e363=_0x58e9('0x2c');break;case _0x58e9('0x10'):_0x17e363=_0x58e9('0x2d');break;}return _0x17e363;}function parseValue(_0x135d2a,_0x38d947,_0x5b8790){var _0x53d686={'start':undefined,'end':undefined};switch(_0x38d947){case'$in':case _0x58e9('0x2e'):_0x53d686['start']=_0x5b8790['split'](',');break;case _0x58e9('0x25'):_0x53d686[_0x58e9('0x2f')]='%'+_0x5b8790+'%';break;case'$startsWith':_0x53d686[_0x58e9('0x2f')]=_0x5b8790+'%';break;case'$endsWith':_0x53d686[_0x58e9('0x2f')]='%'+_0x5b8790;break;case'$between':var _0x27f6cf=_0x5b8790[_0x58e9('0x5')](',');var _0x5b8790=_0x27f6cf[_0x58e9('0x8')]();var _0x5f39b0=_0x27f6cf[_0x58e9('0x30')]();if(_0x135d2a===_0x58e9('0xd')){_0x5b8790=moment(_0x5b8790)[_0x58e9('0x31')](0x0,!![])[_0x58e9('0x16')]();_0x5f39b0=moment(_0x5f39b0)[_0x58e9('0x31')](0x0,!![])['add'](0x17,_0x58e9('0x32'))[_0x58e9('0x14')](0x3b,_0x58e9('0x33'))[_0x58e9('0x14')](0x3b,_0x58e9('0x34'))[_0x58e9('0x16')]();}_0x53d686={'start':_0x5b8790,'end':_0x5f39b0};break;default:_0x53d686[_0x58e9('0x2f')]=_0x5b8790;break;}return _0x53d686;}
\ No newline at end of file
+var _0x866a=['lodash','moment','and','[$and]','replace','[$or]','length','split','shift','match','filter','map','push','operator','$eq','$between','value','includes','$lte','add','days','castTo','text','field','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','=\x20?','<>\x20?','$endsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','>=\x20?','start','pop','utcOffset','format'];(function(_0x396616,_0x27bb9b){var _0x5de688=function(_0x5103bd){while(--_0x5103bd){_0x396616['push'](_0x396616['shift']());}};_0x5de688(++_0x27bb9b);}(_0x866a,0x7e));var _0xa866=function(_0x4d8b8e,_0x12fb10){_0x4d8b8e=_0x4d8b8e-0x0;var _0x3103ba=_0x866a[_0x4d8b8e];return _0x3103ba;};'use strict';var _=require(_0xa866('0x0'));var moment=require(_0xa866('0x1'));exports['parseSearch']=function(_0xea14b8){var _0x36ce81={'conditions':[]};_0x36ce81['sqlOperator']=_['startsWith'](_0xea14b8,'[$or]')?'or':_0xa866('0x2');var _0x38aca4=_0xea14b8['replace'](_0xa866('0x3'),'')[_0xa866('0x4')](_0xa866('0x5'),'')['split']('||');for(var _0x23d494=0x0;_0x23d494<_0x38aca4[_0xa866('0x6')];_0x23d494++){var _0x4abb7c=_0x38aca4[_0x23d494][_0xa866('0x7')](':=');var _0x50c1e4=_0x4abb7c[0x0];var _0x2c93a4=_0x4abb7c['slice'](0x1);_0x2c93a4['forEach'](function(_0x36f2c0){var _0x24bbfe=_0x36f2c0[_0xa866('0x7')]('[')[_0xa866('0x8')]();var _0x7875b0=_0x36f2c0[_0xa866('0x9')](/\[(.*?)\]/g);_0x7875b0['forEach'](function(_0x22768d){var _0x3b5925=_0x22768d[_0xa866('0x7')]('[')[_0xa866('0xa')](function(_0x1324e0){return _0x1324e0['indexOf'](']')>-0x1;})[_0xa866('0xb')](function(_0x391cb6){return _0x391cb6[_0xa866('0x7')](']')[0x0];})[0x0];_0x36ce81['conditions'][_0xa866('0xc')]({'field':_0x50c1e4,'operator':_0x24bbfe,'value':_0x3b5925});});});}return _0x36ce81;};exports['buildExpression']=function(_0x58bebd,_0x5cb5b7,_0x3e4ac4){var _0x899e1a={};if(_0x5cb5b7==='DATE'){if(_0x3e4ac4[_0xa866('0xd')]===_0xa866('0xe')){_0x3e4ac4[_0xa866('0xd')]=_0xa866('0xf');_0x3e4ac4['value']+=','+_0x3e4ac4[_0xa866('0x10')];}else if(_[_0xa866('0x11')](['$gt',_0xa866('0x12')],_0x3e4ac4['operator'])){_0x3e4ac4[_0xa866('0x10')]=moment(_0x3e4ac4[_0xa866('0x10')])[_0xa866('0x13')](0x1,_0xa866('0x14'))['format']('YYYY-MM-DD');}}if(_0x3e4ac4[_0xa866('0x15')]){_0x5cb5b7=_0x3e4ac4[_0xa866('0x15')];_0x899e1a[_0xa866('0x16')]='CAST('+_0x58bebd+'.'+_0x3e4ac4[_0xa866('0x17')]+'\x20AS\x20'+_0x3e4ac4[_0xa866('0x15')]+')\x20'+parseOperator(_0x3e4ac4[_0xa866('0xd')]);}else{_0x899e1a[_0xa866('0x16')]=_0x58bebd+'.'+_0x3e4ac4[_0xa866('0x17')]+'\x20'+parseOperator(_0x3e4ac4[_0xa866('0xd')]);}if(_[_0xa866('0x11')]([_0xa866('0x18'),_0xa866('0x19')],_0x3e4ac4['operator']))_0x899e1a['text']='('+_0x899e1a[_0xa866('0x16')]+'\x20OR\x20'+_0x58bebd+'.'+_0x3e4ac4[_0xa866('0x17')]+_0xa866('0x1a');_0x899e1a[_0xa866('0x10')]=parseValue(_0x5cb5b7,_0x3e4ac4[_0xa866('0xd')],_0x3e4ac4[_0xa866('0x10')]);return _0x899e1a;};function parseOperator(_0x5041c9){var _0x158537;switch(_0x5041c9){case _0xa866('0x1b'):_0x158537=_0xa866('0x1c');break;case _0xa866('0x19'):_0x158537='NOT\x20IN\x20?';break;case'$eq':_0x158537=_0xa866('0x1d');break;case'$ne':_0x158537=_0xa866('0x1e');break;case'$substring':case'$startsWith':case _0xa866('0x1f'):_0x158537=_0xa866('0x20');break;case _0xa866('0x21'):_0x158537=_0xa866('0x22');break;case'$gt':_0x158537=_0xa866('0x23');break;case'$lte':_0x158537=_0xa866('0x24');break;case'$gte':_0x158537=_0xa866('0x25');break;case _0xa866('0xf'):_0x158537='BETWEEN\x20?\x20AND\x20?';break;}return _0x158537;}function parseValue(_0x24873c,_0x4c3d67,_0x5110d8){var _0xe33e1a={'start':undefined,'end':undefined};switch(_0x4c3d67){case'$in':case _0xa866('0x19'):_0xe33e1a['start']=_0x5110d8['split'](',');break;case'$substring':_0xe33e1a['start']='%'+_0x5110d8+'%';break;case'$startsWith':_0xe33e1a['start']=_0x5110d8+'%';break;case _0xa866('0x1f'):_0xe33e1a[_0xa866('0x26')]='%'+_0x5110d8;break;case'$between':var _0x4a5f3f=_0x5110d8['split'](',');var _0x5110d8=_0x4a5f3f[_0xa866('0x8')]();var _0x1628ac=_0x4a5f3f[_0xa866('0x27')]();if(_0x24873c==='DATE'){_0x5110d8=moment(_0x5110d8)[_0xa866('0x28')](0x0,!![])[_0xa866('0x29')]();_0x1628ac=moment(_0x1628ac)['utcOffset'](0x0,!![])[_0xa866('0x13')](0x17,'hours')[_0xa866('0x13')](0x3b,'minutes')[_0xa866('0x13')](0x3b,'seconds')[_0xa866('0x29')]();}_0xe33e1a={'start':_0x5110d8,'end':_0x1628ac};break;default:_0xe33e1a[_0xa866('0x26')]=_0x5110d8;break;}return _0xe33e1a;}
\ No newline at end of file
index 71a2796..1dfe8da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd19=['query','$id','intersection','fields','attributes','offset','order','where','filter','object','includes','value','VIRTUAL','lower','merge','options','include','includeAll','../../mysqldb','parse','keys','model','alias','raw','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','$lte','utc','subtract','name','uniqueid','isArray','limit','sort','split','map','priority','cast','col','unsigned','DESC','ASC','omit','length','isObject','isString','unset','isNumeric','^[+]?[0-9]*$','match','getFullTextValue','\x22{EXPR}\x22','{EXPR}','push','replace','join'];(function(_0x15ece6,_0x51a965){var _0x3dc05c=function(_0x43e0c1){while(--_0x43e0c1){_0x15ece6['push'](_0x15ece6['shift']());}};_0x3dc05c(++_0x51a965);}(_0xbd19,0x192));var _0x9bd1=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xbd19[_0x8a969d];return _0x1d8dc7;};'use strict';var _=require('lodash');var sequelize=require('sequelize');var moment=require('moment');var db=require(_0x9bd1('0x0'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3e8243){var _0x5d8da7=['ne'];try{var _0x3a5a08=JSON[_0x9bd1('0x1')](_0x3e8243);var _0x27af80=Object[_0x9bd1('0x2')](_0x3a5a08)[0x0];return _0x5d8da7['includes'](_0x27af80);}catch(_0x537a42){return![];}}function getOperatorValue(_0x53b8c3){var _0x33df34=JSON[_0x9bd1('0x1')](_0x53b8c3);var _0x1e8e27=Object['keys'](_0x33df34)[0x0];var _0x1d0693=_0x33df34[_0x1e8e27];return{['$'+_0x1e8e27]:_0x1d0693};}function parseIncludeModel(_0x32ad6d){var _0x160747=JSON['parse'](_0x32ad6d);return{'model':db[_0x160747[_0x9bd1('0x3')]],'as':_0x160747[_0x9bd1('0x4')],'attributes':_0x160747['fields'],'raw':_0x160747[_0x9bd1('0x5')]};}exports['fields']=function(_0x5b32b6){var _0x4c5862=null;if(_0x5b32b6){_0x4c5862=_0x5b32b6['split'](',');}return _0x4c5862;};exports[_0x9bd1('0x6')]=function(_0x59c761,_0x57f0b5){var _0x4dee17={};if(!_[_0x9bd1('0x7')](_0x59c761)){_[_0x9bd1('0x8')](_0x59c761,function(_0x16bc57,_0x39dd07){try{if(_0x57f0b5){var _0x477d3f=_[_0x9bd1('0x9')](_0x57f0b5,{'name':_0x39dd07})||{};if(hasSequelizeOperator(_0x16bc57)){_0x4dee17[_0x39dd07]=getOperatorValue(_0x16bc57);}else if(_0x477d3f[_0x9bd1('0xa')]===_0x9bd1('0xb')&&_[_0x9bd1('0xc')](_0x16bc57)){var _0x4924df=JSON[_0x9bd1('0x1')](_0x16bc57);var _0x3f0a21={'$gte':moment(moment(_0x4924df[_0x9bd1('0xd')])[_0x9bd1('0xe')](_0x9bd1('0xf')))['utc']()['format'](),'$lte':moment(moment(_0x4924df[_0x9bd1('0x10')])[_0x9bd1('0xe')](_0x9bd1('0xf')))[_0x9bd1('0x11')]()[_0x9bd1('0x12')](0x1,'s')[_0x9bd1('0xe')]()};_0x4dee17[_0x39dd07]=_0x3f0a21;}else if(_0x477d3f[_0x9bd1('0x13')]===_0x9bd1('0x14')){_0x4dee17[_0x39dd07]=_0x16bc57;}else{_0x4dee17[_0x39dd07]=_['isArray'](_0x16bc57)?_0x16bc57:JSON[_0x9bd1('0x1')](_0x16bc57);}}else{_0x4dee17[_0x39dd07]=_[_0x9bd1('0x15')](_0x16bc57)?_0x16bc57:JSON[_0x9bd1('0x1')](_0x16bc57);}}catch(_0x2ade05){_0x4dee17[_0x39dd07]=_0x16bc57['split'](',');}});}return _0x4dee17;};exports[_0x9bd1('0x16')]=function(_0x732e64){_0x732e64=parseInt(_0x732e64,0xa);if(!_0x732e64||_0x732e64<0x0){_0x732e64=LIMIT_VALUE;}return _0x732e64;};exports['offset']=function(_0x3c0188){_0x3c0188=parseInt(_0x3c0188,0xa);if(!_0x3c0188||_0x3c0188<0x0){_0x3c0188=0x0;}return _0x3c0188;};exports[_0x9bd1('0x17')]=function(_0x58597f){var _0x324b36,_0x4d57a9=null;if(_0x58597f){_0x324b36=_0x58597f[_0x9bd1('0x18')](',');_0x4d57a9=_[_0x9bd1('0x19')](_0x324b36,function(_0x2b0911){if(_0x2b0911['indexOf']('-')===0x0){return[_0x2b0911===_0x9bd1('0x1a')?sequelize[_0x9bd1('0x1b')](sequelize[_0x9bd1('0x1c')](_0x9bd1('0x1a')),_0x9bd1('0x1d')):_0x2b0911['substr'](0x1),_0x9bd1('0x1e')];}else{return[_0x2b0911===_0x9bd1('0x1a')?sequelize[_0x9bd1('0x1b')](sequelize[_0x9bd1('0x1c')](_0x9bd1('0x1a')),_0x9bd1('0x1d')):_0x2b0911,_0x9bd1('0x1f')];}});}return _0x4d57a9;};exports[_0x9bd1('0x20')]=function(_0x200112,_0x57eef2){if(_[_0x9bd1('0x7')](_0x200112)){return _0x200112;}if(_[_0x9bd1('0x15')](_0x200112)){for(var _0xd4e064=0x0;_0xd4e064<_0x200112[_0x9bd1('0x21')];_0xd4e064+=0x1){_0x200112[_0xd4e064]=this[_0x9bd1('0x20')](_0x200112[_0xd4e064],_0x57eef2);}return _0x200112;}if(!_[_0x9bd1('0x22')](_0x200112)){return _0x200112;}if(_[_0x9bd1('0x23')](_0x57eef2)){_0x57eef2=[_0x57eef2];}if(!_[_0x9bd1('0x15')](_0x57eef2)){return _0x200112;}for(var _0x3845b2=0x0;_0x3845b2<_0x57eef2[_0x9bd1('0x21')];_0x3845b2+=0x1){_[_0x9bd1('0x24')](_0x200112,_0x57eef2[_0x3845b2]);}for(var _0x4dfb4c in _0x200112){if(_0x200112['hasOwnProperty'](_0x4dfb4c)){_0x200112[_0x4dfb4c]=this[_0x9bd1('0x20')](_0x200112[_0x4dfb4c],_0x57eef2);}}return _0x200112;};exports[_0x9bd1('0x25')]=function(_0x5d0703){return _0x5d0703['match'](RegExp(_0x9bd1('0x26')))?!![]:![];};exports['isEmail']=function(_0x3b6982){return _0x3b6982[_0x9bd1('0x27')](/^\S+@\S+$/)?!![]:![];};exports[_0x9bd1('0x28')]=function(_0x158fee,_0xdbabe3){var _0x5368e8=[];var _0x2d0e2e=/[ `!@#$%^&*()_\-?~]/;var _0x29c9dc=_0xdbabe3?_0x9bd1('0x29'):_0x9bd1('0x2a');_0x158fee['split'](/[ ,]+/)['forEach'](function(_0x399de8){_0x399de8=_0x399de8['replace'](/([^:]")"+/g,'$1');_0x399de8='+'+_0x399de8+'*';var _0x5023fe=_0x399de8[_0x9bd1('0x27')](_0x2d0e2e);if(_0x5023fe){_0x399de8='\x22'+_0x399de8+'\x22';}_0x5368e8[_0x9bd1('0x2b')](_0x399de8);});_0x29c9dc=_0x29c9dc[_0x9bd1('0x2c')](_0x9bd1('0x2a'),_0x5368e8[_0x9bd1('0x2d')]('\x20'));return _0x29c9dc;};exports['getOptions']=function(_0x148de0,_0x318f29,_0x3bab00){var _0x1198a0={},_0x3adba8={};if(_0x318f29[_0x9bd1('0x2e')][_0x9bd1('0x2f')]){_0x318f29[_0x9bd1('0x2e')]['id']=_0x318f29[_0x9bd1('0x2e')][_0x9bd1('0x2f')];delete _0x318f29[_0x9bd1('0x2e')][_0x9bd1('0x2f')];}_0x1198a0[_0x9bd1('0x3')]=_[_0x9bd1('0x19')](_0x148de0,_0x9bd1('0x13'));_0x1198a0[_0x9bd1('0x2e')]=_[_0x9bd1('0x2')](_0x318f29[_0x9bd1('0x2e')]);_0x1198a0[_0x9bd1('0x6')]=_['intersection'](_0x1198a0[_0x9bd1('0x3')],_0x1198a0[_0x9bd1('0x2e')]);_0x3adba8['attributes']=_[_0x9bd1('0x30')](_0x1198a0[_0x9bd1('0x3')],this[_0x9bd1('0x31')](_0x318f29['query'][_0x9bd1('0x31')]));_0x3adba8['attributes']=_0x3adba8[_0x9bd1('0x32')][_0x9bd1('0x21')]?_0x3adba8[_0x9bd1('0x32')]:_0x1198a0[_0x9bd1('0x3')];if(!_0x318f29['query']['hasOwnProperty']('nolimit')){_0x3adba8['limit']=this[_0x9bd1('0x16')](_0x318f29['query'][_0x9bd1('0x16')]);_0x3adba8[_0x9bd1('0x33')]=this['offset'](_0x318f29[_0x9bd1('0x2e')][_0x9bd1('0x33')]);}_0x3adba8[_0x9bd1('0x34')]=this[_0x9bd1('0x17')](_0x318f29[_0x9bd1('0x2e')]['sort']);_0x3adba8[_0x9bd1('0x35')]=this[_0x9bd1('0x6')](_['pick'](_0x318f29[_0x9bd1('0x2e')],_0x1198a0[_0x9bd1('0x6')]),_0x148de0);if(_0x318f29[_0x9bd1('0x2e')][_0x9bd1('0x36')]){var _0x104d09=_0x148de0;var _0x4e9633=_0x318f29[_0x9bd1('0x2e')]['filter'];if(typeof _0x4e9633===_0x9bd1('0x37')){_0x104d09=_['filter'](_0x148de0,function(_0x101696){return _[_0x9bd1('0x38')](_0x4e9633['columns'],_0x101696[_0x9bd1('0x13')]);});_0x4e9633=_0x4e9633[_0x9bd1('0x39')];}_0x3adba8[_0x9bd1('0x35')]=_['merge'](_0x3adba8['where'],{'$or':_[_0x9bd1('0x19')](_0x104d09,function(_0x59dd75){if(_0x59dd75[_0x9bd1('0xa')]!==_0x9bd1('0x3a')){if(_0x3bab00){return sequelize[_0x9bd1('0x35')](sequelize['fn']('lower',sequelize['col'](_0x59dd75[_0x9bd1('0x13')])),{'$like':sequelize['fn'](_0x9bd1('0x3b'),'%'+_0x318f29['query'][_0x9bd1('0x36')]+'%')});}else{var _0x2cd80f={};_0x2cd80f[_0x59dd75['name']]={'$like':'%'+_0x318f29[_0x9bd1('0x2e')][_0x9bd1('0x36')]+'%'};return _0x2cd80f;}}})});}_0x3adba8=_[_0x9bd1('0x3c')]({},_0x3adba8,_0x318f29[_0x9bd1('0x3d')]);return _0x3adba8;};exports[_0x9bd1('0x3e')]=function(_0x6081fc){var _0x3dd4b0=[];if(_0x6081fc[_0x9bd1('0x3f')]){_0x3dd4b0['push']({'all':!![]});}else if(_0x6081fc[_0x9bd1('0x3e')]){if(Array['isArray'](_0x6081fc[_0x9bd1('0x3e')])){_0x3dd4b0=Object[_0x9bd1('0x2')](_0x6081fc['include'])['map'](function(_0xf73794){return parseIncludeModel(_0x6081fc[_0x9bd1('0x3e')][_0xf73794]);});}else{var _0x1ab31c=parseIncludeModel(_0x6081fc[_0x9bd1('0x3e')]);_0x3dd4b0[_0x9bd1('0x2b')](_0x1ab31c);}}return _0x3dd4b0;};
\ No newline at end of file
+var _0xc818=['model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','$gte','format','YYYY-MM-DD','$lte','utc','isArray','limit','sort','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push','join','getOptions','query','$id','map','name','intersection','attributes','nolimit','offset','where','pick','filter','object','columns','value','VIRTUAL','lower','merge','options','include','includeAll','lodash','sequelize','moment','../../mysqldb','parse','keys','includes'];(function(_0x5bdf4d,_0x28351d){var _0x586487=function(_0x1ff8cd){while(--_0x1ff8cd){_0x5bdf4d['push'](_0x5bdf4d['shift']());}};_0x586487(++_0x28351d);}(_0xc818,0x1e3));var _0x8c81=function(_0x23fd1b,_0x469cab){_0x23fd1b=_0x23fd1b-0x0;var _0x304e83=_0xc818[_0x23fd1b];return _0x304e83;};'use strict';var _=require(_0x8c81('0x0'));var sequelize=require(_0x8c81('0x1'));var moment=require(_0x8c81('0x2'));var db=require(_0x8c81('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5e6597){var _0x461c5f=['ne'];try{var _0x7a8137=JSON[_0x8c81('0x4')](_0x5e6597);var _0x7e329f=Object[_0x8c81('0x5')](_0x7a8137)[0x0];return _0x461c5f[_0x8c81('0x6')](_0x7e329f);}catch(_0x377b23){return![];}}function getOperatorValue(_0x4a6e65){var _0x2c5966=JSON[_0x8c81('0x4')](_0x4a6e65);var _0x32cf31=Object[_0x8c81('0x5')](_0x2c5966)[0x0];var _0x501240=_0x2c5966[_0x32cf31];return{['$'+_0x32cf31]:_0x501240};}function parseIncludeModel(_0x1173cf){var _0x448af6=JSON[_0x8c81('0x4')](_0x1173cf);return{'model':db[_0x448af6[_0x8c81('0x7')]],'as':_0x448af6[_0x8c81('0x8')],'attributes':_0x448af6[_0x8c81('0x9')],'raw':_0x448af6[_0x8c81('0xa')]};}exports['fields']=function(_0x3de91f){var _0x37dbb4=null;if(_0x3de91f){_0x37dbb4=_0x3de91f[_0x8c81('0xb')](',');}return _0x37dbb4;};exports[_0x8c81('0xc')]=function(_0x5d7fb6,_0x5a2d9e){var _0x3cdd27={};if(!_[_0x8c81('0xd')](_0x5d7fb6)){_[_0x8c81('0xe')](_0x5d7fb6,function(_0x2a945d,_0x112be6){try{if(_0x5a2d9e){var _0x1b7b1b=_[_0x8c81('0xf')](_0x5a2d9e,{'name':_0x112be6})||{};if(hasSequelizeOperator(_0x2a945d)){_0x3cdd27[_0x112be6]=getOperatorValue(_0x2a945d);}else if(_0x1b7b1b[_0x8c81('0x10')]==='DATE'&&_['isPlainObject'](_0x2a945d)){var _0x1db769=JSON[_0x8c81('0x4')](_0x2a945d);var _0x238ce5={'$gte':moment(moment(_0x1db769[_0x8c81('0x11')])[_0x8c81('0x12')](_0x8c81('0x13')))['utc']()[_0x8c81('0x12')](),'$lte':moment(moment(_0x1db769[_0x8c81('0x14')])[_0x8c81('0x12')](_0x8c81('0x13')))[_0x8c81('0x15')]()['subtract'](0x1,'s')[_0x8c81('0x12')]()};_0x3cdd27[_0x112be6]=_0x238ce5;}else if(_0x1b7b1b['name']==='uniqueid'){_0x3cdd27[_0x112be6]=_0x2a945d;}else{_0x3cdd27[_0x112be6]=_['isArray'](_0x2a945d)?_0x2a945d:JSON[_0x8c81('0x4')](_0x2a945d);}}else{_0x3cdd27[_0x112be6]=_[_0x8c81('0x16')](_0x2a945d)?_0x2a945d:JSON[_0x8c81('0x4')](_0x2a945d);}}catch(_0x4f4014){_0x3cdd27[_0x112be6]=_0x2a945d[_0x8c81('0xb')](',');}});}return _0x3cdd27;};exports[_0x8c81('0x17')]=function(_0x348d79){_0x348d79=parseInt(_0x348d79,0xa);if(!_0x348d79||_0x348d79<0x0){_0x348d79=LIMIT_VALUE;}return _0x348d79;};exports['offset']=function(_0x261832){_0x261832=parseInt(_0x261832,0xa);if(!_0x261832||_0x261832<0x0){_0x261832=0x0;}return _0x261832;};exports[_0x8c81('0x18')]=function(_0x56ca80){var _0x35d61a,_0x31c4a2=null;if(_0x56ca80){_0x35d61a=_0x56ca80['split'](',');_0x31c4a2=_['map'](_0x35d61a,function(_0x39fc0e){if(_0x39fc0e[_0x8c81('0x19')]('-')===0x0){return[_0x39fc0e===_0x8c81('0x1a')?sequelize['cast'](sequelize[_0x8c81('0x1b')](_0x8c81('0x1a')),_0x8c81('0x1c')):_0x39fc0e[_0x8c81('0x1d')](0x1),_0x8c81('0x1e')];}else{return[_0x39fc0e===_0x8c81('0x1a')?sequelize[_0x8c81('0x1f')](sequelize[_0x8c81('0x1b')]('priority'),'unsigned'):_0x39fc0e,_0x8c81('0x20')];}});}return _0x31c4a2;};exports[_0x8c81('0x21')]=function(_0x2b9df6,_0x21bf77){if(_[_0x8c81('0xd')](_0x2b9df6)){return _0x2b9df6;}if(_[_0x8c81('0x16')](_0x2b9df6)){for(var _0x2e7ba2=0x0;_0x2e7ba2<_0x2b9df6[_0x8c81('0x22')];_0x2e7ba2+=0x1){_0x2b9df6[_0x2e7ba2]=this[_0x8c81('0x21')](_0x2b9df6[_0x2e7ba2],_0x21bf77);}return _0x2b9df6;}if(!_[_0x8c81('0x23')](_0x2b9df6)){return _0x2b9df6;}if(_[_0x8c81('0x24')](_0x21bf77)){_0x21bf77=[_0x21bf77];}if(!_[_0x8c81('0x16')](_0x21bf77)){return _0x2b9df6;}for(var _0x34dd6b=0x0;_0x34dd6b<_0x21bf77['length'];_0x34dd6b+=0x1){_[_0x8c81('0x25')](_0x2b9df6,_0x21bf77[_0x34dd6b]);}for(var _0xc9de87 in _0x2b9df6){if(_0x2b9df6[_0x8c81('0x26')](_0xc9de87)){_0x2b9df6[_0xc9de87]=this[_0x8c81('0x21')](_0x2b9df6[_0xc9de87],_0x21bf77);}}return _0x2b9df6;};exports[_0x8c81('0x27')]=function(_0x3b9527){return _0x3b9527[_0x8c81('0x28')](RegExp(_0x8c81('0x29')))?!![]:![];};exports[_0x8c81('0x2a')]=function(_0x54ca62){return _0x54ca62[_0x8c81('0x28')](/^\S+@\S+$/)?!![]:![];};exports[_0x8c81('0x2b')]=function(_0x23c0be,_0x25654d){var _0x1d931f=[];var _0x551f0b=/[ `!@#$%^&*()_\-?~]/;var _0x1497f2=_0x25654d?_0x8c81('0x2c'):_0x8c81('0x2d');_0x23c0be[_0x8c81('0xb')](/[ ,]+/)[_0x8c81('0x2e')](function(_0x48622f){_0x48622f=_0x48622f['replace'](/([^:]")"+/g,'$1');_0x48622f='+'+_0x48622f+'*';var _0x1da1f1=_0x48622f[_0x8c81('0x28')](_0x551f0b);if(_0x1da1f1){_0x48622f='\x22'+_0x48622f+'\x22';}_0x1d931f[_0x8c81('0x2f')](_0x48622f);});_0x1497f2=_0x1497f2['replace'](_0x8c81('0x2d'),_0x1d931f[_0x8c81('0x30')]('\x20'));return _0x1497f2;};exports[_0x8c81('0x31')]=function(_0x1fce32,_0x56160f,_0x3addb9){var _0x32dfaa={},_0x543310={};if(_0x56160f[_0x8c81('0x32')]['$id']){_0x56160f['query']['id']=_0x56160f[_0x8c81('0x32')][_0x8c81('0x33')];delete _0x56160f[_0x8c81('0x32')][_0x8c81('0x33')];}_0x32dfaa['model']=_[_0x8c81('0x34')](_0x1fce32,_0x8c81('0x35'));_0x32dfaa[_0x8c81('0x32')]=_['keys'](_0x56160f['query']);_0x32dfaa[_0x8c81('0xc')]=_[_0x8c81('0x36')](_0x32dfaa[_0x8c81('0x7')],_0x32dfaa['query']);_0x543310[_0x8c81('0x37')]=_['intersection'](_0x32dfaa['model'],this['fields'](_0x56160f[_0x8c81('0x32')]['fields']));_0x543310[_0x8c81('0x37')]=_0x543310['attributes']['length']?_0x543310[_0x8c81('0x37')]:_0x32dfaa[_0x8c81('0x7')];if(!_0x56160f[_0x8c81('0x32')][_0x8c81('0x26')](_0x8c81('0x38'))){_0x543310[_0x8c81('0x17')]=this[_0x8c81('0x17')](_0x56160f['query'][_0x8c81('0x17')]);_0x543310[_0x8c81('0x39')]=this[_0x8c81('0x39')](_0x56160f[_0x8c81('0x32')][_0x8c81('0x39')]);}_0x543310['order']=this[_0x8c81('0x18')](_0x56160f[_0x8c81('0x32')][_0x8c81('0x18')]);_0x543310[_0x8c81('0x3a')]=this[_0x8c81('0xc')](_[_0x8c81('0x3b')](_0x56160f[_0x8c81('0x32')],_0x32dfaa[_0x8c81('0xc')]),_0x1fce32);if(_0x56160f[_0x8c81('0x32')][_0x8c81('0x3c')]){var _0xae952a=_0x1fce32;var _0xc7871=_0x56160f['query']['filter'];if(typeof _0xc7871===_0x8c81('0x3d')){_0xae952a=_[_0x8c81('0x3c')](_0x1fce32,function(_0x9ebabc){return _[_0x8c81('0x6')](_0xc7871[_0x8c81('0x3e')],_0x9ebabc[_0x8c81('0x35')]);});_0xc7871=_0xc7871[_0x8c81('0x3f')];}_0x543310['where']=_['merge'](_0x543310[_0x8c81('0x3a')],{'$or':_[_0x8c81('0x34')](_0xae952a,function(_0x3fe95f){if(_0x3fe95f[_0x8c81('0x10')]!==_0x8c81('0x40')){if(_0x3addb9){return sequelize[_0x8c81('0x3a')](sequelize['fn'](_0x8c81('0x41'),sequelize['col'](_0x3fe95f[_0x8c81('0x35')])),{'$like':sequelize['fn'](_0x8c81('0x41'),'%'+_0x56160f[_0x8c81('0x32')][_0x8c81('0x3c')]+'%')});}else{var _0x4d0093={};_0x4d0093[_0x3fe95f['name']]={'$like':'%'+_0x56160f[_0x8c81('0x32')][_0x8c81('0x3c')]+'%'};return _0x4d0093;}}})});}_0x543310=_[_0x8c81('0x42')]({},_0x543310,_0x56160f[_0x8c81('0x43')]);return _0x543310;};exports[_0x8c81('0x44')]=function(_0x26365f){var _0x192cc2=[];if(_0x26365f[_0x8c81('0x45')]){_0x192cc2[_0x8c81('0x2f')]({'all':!![]});}else if(_0x26365f[_0x8c81('0x44')]){if(Array[_0x8c81('0x16')](_0x26365f[_0x8c81('0x44')])){_0x192cc2=Object[_0x8c81('0x5')](_0x26365f[_0x8c81('0x44')])[_0x8c81('0x34')](function(_0x3ac081){return parseIncludeModel(_0x26365f[_0x8c81('0x44')][_0x3ac081]);});}else{var _0x25b569=parseIncludeModel(_0x26365f[_0x8c81('0x44')]);_0x192cc2[_0x8c81('0x2f')](_0x25b569);}}return _0x192cc2;};
\ No newline at end of file
index 9021652..e38cf7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['fullname','internal','indexOf','validateSortParameter','sort','DESC','pauseType','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','role','whatsappStatus','whatsappStatusTime','mailCapacity','openchannelCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','http','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','length','unavailable','ringing','voiceStatus','idle','pause','every','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','Agents','then','error','result','request','merge','catch','getRealtimeAgents','unknown','*pause','getAgentStatus','isArray','startCase','Queue','map','findOne','getAgents','all','uniq','value','getAgentIdsByQueues','filter','includes','busy','getAgentIdsByStatus','resolve','name','getSortedAgentsIdsByStatus','split','fields','globalStatus','order','startsWith','ASC','getUpdatedSortOptions','fullname,internal'];(function(_0x5ab787,_0x1fc067){var _0x1afe96=function(_0x5e563d){while(--_0x5e563d){_0x5ab787['push'](_0x5ab787['shift']());}};_0x1afe96(++_0x1fc067);}(_0xe14b,0x93));var _0xbe14=function(_0x3ba3c0,_0x42a2e5){_0x3ba3c0=_0x3ba3c0-0x0;var _0x4a5168=_0xe14b[_0x3ba3c0];return _0x4a5168;};'use strict';var _=require(_0xbe14('0x0'));var jayson=require(_0xbe14('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson['client'][_0xbe14('0x2')]({'port':0x232a});var routingClient=jayson[_0xbe14('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x7d3665,_0x5ce8fb){var _0x496c04=[_0x7d3665[_0xbe14('0x4')],_0x7d3665[_0xbe14('0x5')],_0x7d3665[_0xbe14('0x6')],_0x7d3665[_0xbe14('0x7')],_0x7d3665[_0xbe14('0x8')],_0x7d3665[_0xbe14('0x9')],_0x7d3665[_0xbe14('0xa')]];if(!_0x5ce8fb)return _['every'](_0x496c04);var _0x50f909=_['filter'](_0x496c04);return _0x50f909[_0xbe14('0xb')]>0x0&&_0x50f909[_0xbe14('0xb')]<_0x496c04[_0xbe14('0xb')]?!![]:![];}function isIdle(_0x90b4f){return _0x90b4f==='idle'||_0x90b4f==='unknown'||_0x90b4f===_0xbe14('0xc')||_0x90b4f===_0xbe14('0xd')||_['isNil'](_0x90b4f);}function isAgentIdle(_0x254c3b){if(_0x254c3b[_0xbe14('0xe')]!==_0xbe14('0xf')&&_0x254c3b[_0xbe14('0x9')]){_0x254c3b[_0xbe14('0xe')]=_0xbe14('0x10');return![];}return _[_0xbe14('0x11')]([_0x254c3b[_0xbe14('0x12')],_0x254c3b[_0xbe14('0x13')],_0x254c3b[_0xbe14('0x14')],_0x254c3b[_0xbe14('0x15')],_0x254c3b[_0xbe14('0x16')],_0x254c3b[_0xbe14('0xe')],_0x254c3b['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request'](_0xbe14('0x17'),{})[_0xbe14('0x18')](function(_0xf4ac9){if(_0xf4ac9[_0xbe14('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x21c789=_0xf4ac9[_0xbe14('0x1a')];return routingClient[_0xbe14('0x1b')](_0xbe14('0x17'),{})[_0xbe14('0x18')](function(_0x29ab73){if(_0x29ab73[_0xbe14('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x137ee5=_0x29ab73[_0xbe14('0x1a')];return _[_0xbe14('0x1c')]({},_0x21c789,_0x137ee5);});})[_0xbe14('0x1d')](function(_0x3249da){throw _0x3249da;});}exports[_0xbe14('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x59a9e3){var _0x24f820=_0xbe14('0x1f');if(isAgentPaused(_0x59a9e3))_0x24f820=_0xbe14('0x10');else if(isAgentPaused(_0x59a9e3,!![]))_0x24f820=_0xbe14('0x20');else if(isAgentIdle(_0x59a9e3))_0x24f820=_0xbe14('0xf');else _0x24f820='busy';return _0x24f820;}exports[_0xbe14('0x21')]=getAgentStatus;function getAgentIdsByQueues(_0x56d845,_0x3c1c85){var _0x56e80c=_[_0xbe14('0x22')](_0x56d845)?_0x56d845:[_0x56d845];var _0x4a25fa=_[_0xbe14('0x23')](_0x3c1c85)+_0xbe14('0x24');var _0x505dbd=_[_0xbe14('0x25')](_0x56e80c,function(_0x4d4190){return db[_0x4a25fa][_0xbe14('0x26')]({'where':{'id':_0x4d4190}})['then'](function(_0x36a21e){if(!_0x36a21e)return[];return _0x36a21e[_0xbe14('0x27')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xbe14('0x28')](_0x505dbd)[_0xbe14('0x18')](function(_0x15ef02){var _0x2703f5=_(_0x15ef02)['flatten']()[_0xbe14('0x25')]('id')[_0xbe14('0x29')]()[_0xbe14('0x2a')]();return _0x2703f5;});}exports[_0xbe14('0x2b')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5dd475,_0x16f884,_0x29fc64){try{if(_0x16f884['length']>0x0){_0x5dd475=_0x5dd475[_0xbe14('0x2c')](function(_0x3b3e84){return _0x16f884[_0xbe14('0x2d')](_0x3b3e84['id']);});}var _0x19252f=_0x5dd475[_0xbe14('0x2c')](function(_0x36d4b2){var _0x31a664=_0xbe14('0x2e');if(isAgentIdle(_0x36d4b2)){_0x31a664=_0xbe14('0xf');}return _0x31a664===_0x29fc64;});return _[_0xbe14('0x25')](_0x19252f,'id');}catch(_0x40538f){throw _0x40538f;}}exports[_0xbe14('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x39dc0a,_0x10ae36,_0x223f7a){return Promise[_0xbe14('0x30')]()[_0xbe14('0x18')](function(){if(_0x10ae36[_0xbe14('0xb')]>0x0){_0x39dc0a=_0x39dc0a[_0xbe14('0x2c')](function(_0x14e7c4){return _0x10ae36['includes'](_0x14e7c4['id']);});}return _0x39dc0a;})[_0xbe14('0x18')](function(){return db['User']['findAll']({'attributes':['id',_0xbe14('0x31'),'fullname',_0xbe14('0x4'),_0xbe14('0x5'),'mailPause','openchannelPause','smsPause',_0xbe14('0x9'),_0xbe14('0xa'),'pauseType'],'where':{'id':{'$in':_[_0xbe14('0x25')](_0x39dc0a,'id')}},'raw':!![]});})[_0xbe14('0x18')](function(_0x452635){return _0x452635[_0xbe14('0x25')](function(_0x29c23e){var _0x5ef1e5=_['find'](_0x39dc0a,['id',_0x29c23e['id']]);var _0x15a997=filterAgentAttributes(_0x5ef1e5);_['merge'](_0x29c23e,_0x15a997);_0x29c23e['globalStatus']=getAgentStatus(_0x29c23e);return _0x29c23e;});})['then'](function(_0x163ef7){var _0x393f6b=sortAgentsByStatus(_0x163ef7,_0x223f7a);return _[_0xbe14('0x25')](_0x393f6b,'id');})[_0xbe14('0x1d')](function(_0x172e79){throw _0x172e79;});}exports[_0xbe14('0x32')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0xcdc50){var _0x10ec3c={'fields':[],'order':null};var _0x2d9c12=_0xcdc50[_0xbe14('0x33')](',');_0x10ec3c[_0xbe14('0x34')]=_[_0xbe14('0x2c')](_0x2d9c12,function(_0x539c41){if(!_0x539c41['includes'](_0xbe14('0x35'))){return!![];}_0x10ec3c[_0xbe14('0x36')]=_[_0xbe14('0x37')](_0x539c41,'-')?'DESC':_0xbe14('0x38');return![];});return _0x10ec3c;}exports[_0xbe14('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0xeda70e){if(!_0xeda70e){_0xeda70e=_0xbe14('0x3a');}if(_0xeda70e[_0xbe14('0x2d')](_0xbe14('0x3b'))&&!_0xeda70e[_0xbe14('0x2d')](_0xbe14('0x3c'))){var _0x1b2608=_0xeda70e['substring'](0x0,_0xeda70e[_0xbe14('0x3d')](_0xbe14('0x3b')));_0xeda70e+=','+_0x1b2608+_0xbe14('0x3c');}return _0xeda70e;}exports[_0xbe14('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x3287b9,_0x2dd3e3){var _0x548d17=_0x3287b9[_0xbe14('0x3f')](function(_0x1974a4,_0x1220c9){if(_0x1974a4[_0xbe14('0x35')]===_0x1220c9['globalStatus']){if(_0x1974a4['globalStatus']===_0xbe14('0x10')){if(_0x2dd3e3===_0xbe14('0x40')){return(_0x1974a4[_0xbe14('0x41')]||'')<(_0x1220c9['pauseType']||'')||_0x1974a4['fullname'][_0xbe14('0x42')]()>_0x1220c9['fullname']['toLowerCase']()?0x1:-0x1;}else{return(_0x1974a4[_0xbe14('0x41')]||'')<(_0x1220c9[_0xbe14('0x41')]||'')||_0x1974a4[_0xbe14('0x3b')]['toLowerCase']()>_0x1220c9['fullname']['toLowerCase']()?-0x1:0x1;}}else{if(_0x2dd3e3===_0xbe14('0x40')){return _0x1974a4[_0xbe14('0x3b')][_0xbe14('0x42')]()<_0x1220c9['fullname'][_0xbe14('0x42')]()?0x1:-0x1;}else{return _0x1974a4[_0xbe14('0x3b')][_0xbe14('0x42')]()<_0x1220c9[_0xbe14('0x3b')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x2dd3e3==='DESC'){return _0x1974a4[_0xbe14('0x35')]<_0x1220c9[_0xbe14('0x35')]?0x1:-0x1;}else{return _0x1974a4[_0xbe14('0x35')]<_0x1220c9[_0xbe14('0x35')]?-0x1:0x1;}}});return _0x548d17;}exports[_0xbe14('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x4f2d95){var _0x51023a=[_0xbe14('0x44'),_0xbe14('0x45'),_0xbe14('0x46'),_0xbe14('0x47'),'pauseType',_0xbe14('0x47'),_0xbe14('0x3c'),'address',_0xbe14('0x4'),_0xbe14('0x7'),_0xbe14('0x6'),_0xbe14('0x8'),'whatsappPause','faxPause',_0xbe14('0x9'),_0xbe14('0x48'),'openchannelCapacity','mailCapacity',_0xbe14('0x49'),_0xbe14('0x4a'),_0xbe14('0x4b'),_0xbe14('0x4c'),_0xbe14('0x4d'),_0xbe14('0x4e'),_0xbe14('0x4f'),'whatsappCurrentCapacity',_0xbe14('0x50'),_0xbe14('0x12'),_0xbe14('0x15'),_0xbe14('0x14'),_0xbe14('0x16'),'whatsappStatus',_0xbe14('0x13'),_0xbe14('0xe'),_0xbe14('0x51'),_0xbe14('0x52'),_0xbe14('0x53'),_0xbe14('0x54'),'whatsappStatusTime','faxStatusTime',_0xbe14('0x55'),_0xbe14('0x56'),_0xbe14('0x57'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0xbe14('0x58'),_0xbe14('0x59')];var _0x50d78f=[_0xbe14('0x4'),_0xbe14('0x7'),'mailPause',_0xbe14('0x8'),'whatsappPause',_0xbe14('0x5'),_0xbe14('0x9'),_0xbe14('0x45')];var _0x550291=_(_0x4f2d95)[_0xbe14('0x5a')](_0x50d78f)[_0xbe14('0x5b')](_0x51023a)['value']();return _0x550291;}exports[_0xbe14('0x5c')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xbe14('0x31'),_0xbe14('0x3b'),_0xbe14('0x5d'),_0xbe14('0x3c'),'online',_0xbe14('0x35'),_0xbe14('0x44'),_0xbe14('0x46'),_0xbe14('0x41'),_0xbe14('0x47'),_0xbe14('0x5'),_0xbe14('0x4'),'mailPause',_0xbe14('0x7'),_0xbe14('0x8'),_0xbe14('0x9'),_0xbe14('0xa'),_0xbe14('0x12'),_0xbe14('0x13'),_0xbe14('0x14'),_0xbe14('0x15'),_0xbe14('0x16'),_0xbe14('0xe'),_0xbe14('0x5e'),'chatStatusTime','faxStatusTime','mailStatusTime',_0xbe14('0x52'),_0xbe14('0x54'),_0xbe14('0x55'),_0xbe14('0x5f'),_0xbe14('0x48'),_0xbe14('0x4b'),_0xbe14('0x60'),_0xbe14('0x61'),_0xbe14('0x49'),_0xbe14('0x4a'),_0xbe14('0x4c'),_0xbe14('0x50'),_0xbe14('0x4e'),_0xbe14('0x4d'),_0xbe14('0x4f'),_0xbe14('0x62'),_0xbe14('0x63'),_0xbe14('0x58'),_0xbe14('0x57'),_0xbe14('0x64'),'queue',_0xbe14('0x59'),_0xbe14('0x65')];}exports[_0xbe14('0x66')]=getRealtimeAgentsQueryFields;
\ No newline at end of file
+var _0x9957=['sort','toLowerCase','userpic','online','lastPauseAt','address','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatusTime','smsStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','omit','pick','value','filterAgentAttributes','name','role','lastLoginAt','whatsappPause','mailStatus','chatStatusTime','openchannelStatusTime','whatsappStatusTime','chatCapacity','mailCapacity','whatsappCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','every','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','smsStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','getRealtimeAgents','busy','getAgentStatus','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','getAgentIdsByQueues','filter','getAgentIdsByStatus','includes','User','findAll','fullname','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var jayson=require(_0x7995('0x1'));var db=require(_0x7995('0x2'))['db'];var amiClient=jayson[_0x7995('0x3')]['http']({'port':0x232a});var routingClient=jayson[_0x7995('0x3')][_0x7995('0x4')]({'port':0x232c});function isAgentPaused(_0x1902b4,_0x462a03){var _0x576d89=[_0x1902b4[_0x7995('0x5')],_0x1902b4[_0x7995('0x6')],_0x1902b4[_0x7995('0x7')],_0x1902b4[_0x7995('0x8')],_0x1902b4[_0x7995('0x9')],_0x1902b4[_0x7995('0xa')],_0x1902b4['whatsappPause']];if(!_0x462a03)return _[_0x7995('0xb')](_0x576d89);var _0x1cad37=_['filter'](_0x576d89);return _0x1cad37[_0x7995('0xc')]>0x0&&_0x1cad37[_0x7995('0xc')]<_0x576d89[_0x7995('0xc')]?!![]:![];}function isIdle(_0x35b5fe){return _0x35b5fe===_0x7995('0xd')||_0x35b5fe===_0x7995('0xe')||_0x35b5fe===_0x7995('0xf')||_0x35b5fe==='ringing'||_[_0x7995('0x10')](_0x35b5fe);}function isAgentIdle(_0x41c652){if(_0x41c652['voiceStatus']!==_0x7995('0xd')&&_0x41c652[_0x7995('0xa')]){_0x41c652[_0x7995('0x11')]=_0x7995('0x12');return![];}return _[_0x7995('0xb')]([_0x41c652[_0x7995('0x13')],_0x41c652[_0x7995('0x14')],_0x41c652['mailStatus'],_0x41c652['openchannelStatus'],_0x41c652[_0x7995('0x15')],_0x41c652[_0x7995('0x11')],_0x41c652[_0x7995('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x2202ce){if(_0x2202ce[_0x7995('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2eeacc=_0x2202ce['result'];return routingClient[_0x7995('0x17')](_0x7995('0x18'),{})[_0x7995('0x19')](function(_0x291317){if(_0x291317[_0x7995('0x1a')]){throw new Error(_0x7995('0x1b'));}var _0x4faa60=_0x291317['result'];return _[_0x7995('0x1c')]({},_0x2eeacc,_0x4faa60);});})['catch'](function(_0x555f74){throw _0x555f74;});}exports[_0x7995('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3d463e){var _0x4cbe10=_0x7995('0xe');if(isAgentPaused(_0x3d463e))_0x4cbe10='pause';else if(isAgentPaused(_0x3d463e,!![]))_0x4cbe10='*pause';else if(isAgentIdle(_0x3d463e))_0x4cbe10=_0x7995('0xd');else _0x4cbe10=_0x7995('0x1e');return _0x4cbe10;}exports[_0x7995('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x1a8568,_0x460924){var _0x1c278a=_['isArray'](_0x1a8568)?_0x1a8568:[_0x1a8568];var _0x32a09a=_[_0x7995('0x20')](_0x460924)+_0x7995('0x21');var _0x285437=_[_0x7995('0x22')](_0x1c278a,function(_0x13bc35){return db[_0x32a09a][_0x7995('0x23')]({'where':{'id':_0x13bc35}})[_0x7995('0x19')](function(_0x59405a){if(!_0x59405a)return[];return _0x59405a[_0x7995('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x7995('0x25')](_0x285437)[_0x7995('0x19')](function(_0x268ce7){var _0x3a3fcf=_(_0x268ce7)[_0x7995('0x26')]()['map']('id')[_0x7995('0x27')]()['value']();return _0x3a3fcf;});}exports[_0x7995('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x49bc7e,_0xf16cc2,_0x132a42){try{if(_0xf16cc2[_0x7995('0xc')]>0x0){_0x49bc7e=_0x49bc7e['filter'](function(_0x9b2a15){return _0xf16cc2['includes'](_0x9b2a15['id']);});}var _0x456a28=_0x49bc7e[_0x7995('0x29')](function(_0x4253e5){var _0x574574='busy';if(isAgentIdle(_0x4253e5)){_0x574574='idle';}return _0x574574===_0x132a42;});return _[_0x7995('0x22')](_0x456a28,'id');}catch(_0xe6b0b3){throw _0xe6b0b3;}}exports[_0x7995('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2b874d,_0x2e3493,_0x1ca460){return Promise['resolve']()['then'](function(){if(_0x2e3493[_0x7995('0xc')]>0x0){_0x2b874d=_0x2b874d['filter'](function(_0x553671){return _0x2e3493[_0x7995('0x2b')](_0x553671['id']);});}return _0x2b874d;})[_0x7995('0x19')](function(){return db[_0x7995('0x2c')][_0x7995('0x2d')]({'attributes':['id','name',_0x7995('0x2e'),_0x7995('0x5'),'faxPause','mailPause','openchannelPause',_0x7995('0x9'),_0x7995('0xa'),'whatsappPause',_0x7995('0x2f')],'where':{'id':{'$in':_['map'](_0x2b874d,'id')}},'raw':!![]});})[_0x7995('0x19')](function(_0x1cb058){return _0x1cb058[_0x7995('0x22')](function(_0x5014d2){var _0x52d76d=_[_0x7995('0x30')](_0x2b874d,['id',_0x5014d2['id']]);var _0x5e67fe=filterAgentAttributes(_0x52d76d);_['merge'](_0x5014d2,_0x5e67fe);_0x5014d2[_0x7995('0x31')]=getAgentStatus(_0x5014d2);return _0x5014d2;});})[_0x7995('0x19')](function(_0x5212ff){var _0x1baa15=sortAgentsByStatus(_0x5212ff,_0x1ca460);return _[_0x7995('0x22')](_0x1baa15,'id');})[_0x7995('0x32')](function(_0x18667c){throw _0x18667c;});}exports[_0x7995('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x53002a){var _0x2d4285={'fields':[],'order':null};var _0x242713=_0x53002a[_0x7995('0x34')](',');_0x2d4285[_0x7995('0x35')]=_['filter'](_0x242713,function(_0x2be2c0){if(!_0x2be2c0[_0x7995('0x2b')](_0x7995('0x31'))){return!![];}_0x2d4285[_0x7995('0x36')]=_[_0x7995('0x37')](_0x2be2c0,'-')?_0x7995('0x38'):'ASC';return![];});return _0x2d4285;}exports[_0x7995('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x3be298){if(!_0x3be298){_0x3be298=_0x7995('0x3a');}if(_0x3be298[_0x7995('0x2b')](_0x7995('0x2e'))&&!_0x3be298[_0x7995('0x2b')](_0x7995('0x3b'))){var _0x270c0e=_0x3be298[_0x7995('0x3c')](0x0,_0x3be298[_0x7995('0x3d')](_0x7995('0x2e')));_0x3be298+=','+_0x270c0e+_0x7995('0x3b');}return _0x3be298;}exports[_0x7995('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x53cda2,_0x50a98e){var _0x334dff=_0x53cda2[_0x7995('0x3f')](function(_0x58523e,_0x4b0855){if(_0x58523e[_0x7995('0x31')]===_0x4b0855['globalStatus']){if(_0x58523e['globalStatus']===_0x7995('0x12')){if(_0x50a98e===_0x7995('0x38')){return(_0x58523e[_0x7995('0x2f')]||'')<(_0x4b0855['pauseType']||'')||_0x58523e[_0x7995('0x2e')]['toLowerCase']()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x58523e['pauseType']||'')<(_0x4b0855[_0x7995('0x2f')]||'')||_0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()>_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?-0x1:0x1;}}else{if(_0x50a98e===_0x7995('0x38')){return _0x58523e[_0x7995('0x2e')][_0x7995('0x40')]()<_0x4b0855[_0x7995('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return _0x58523e['fullname'][_0x7995('0x40')]()<_0x4b0855['fullname'][_0x7995('0x40')]()?-0x1:0x1;}}}else{if(_0x50a98e==='DESC'){return _0x58523e[_0x7995('0x31')]<_0x4b0855['globalStatus']?0x1:-0x1;}else{return _0x58523e[_0x7995('0x31')]<_0x4b0855[_0x7995('0x31')]?-0x1:0x1;}}});return _0x334dff;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3e9e62){var _0x336ff2=[_0x7995('0x41'),_0x7995('0x42'),'lastLoginAt',_0x7995('0x43'),_0x7995('0x2f'),_0x7995('0x43'),'internal',_0x7995('0x44'),_0x7995('0x5'),_0x7995('0x8'),_0x7995('0x7'),_0x7995('0x9'),'whatsappPause',_0x7995('0x6'),_0x7995('0xa'),'chatCapacity',_0x7995('0x45'),'mailCapacity',_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x48'),_0x7995('0x49'),_0x7995('0x4a'),_0x7995('0x4b'),_0x7995('0x4c'),'whatsappCurrentCapacity',_0x7995('0x4d'),_0x7995('0x13'),_0x7995('0x4e'),'mailStatus',_0x7995('0x15'),_0x7995('0x16'),_0x7995('0x14'),'voiceStatus','chatStatusTime','openchannelStatusTime',_0x7995('0x4f'),_0x7995('0x50'),'whatsappStatusTime',_0x7995('0x51'),_0x7995('0x52'),_0x7995('0x53'),_0x7995('0x54'),_0x7995('0x55'),'phoneBarEnableScreenRecordingByAgent',_0x7995('0x56'),'routealias'];var _0x14fe7f=[_0x7995('0x5'),_0x7995('0x8'),'mailPause','smsPause','whatsappPause','faxPause',_0x7995('0xa'),_0x7995('0x42')];var _0x1a861c=_(_0x3e9e62)[_0x7995('0x57')](_0x14fe7f)[_0x7995('0x58')](_0x336ff2)[_0x7995('0x59')]();return _0x1a861c;}exports[_0x7995('0x5a')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x7995('0x5b'),_0x7995('0x2e'),_0x7995('0x5c'),_0x7995('0x3b'),_0x7995('0x42'),_0x7995('0x31'),_0x7995('0x41'),_0x7995('0x5d'),_0x7995('0x2f'),_0x7995('0x43'),_0x7995('0x6'),_0x7995('0x5'),'mailPause',_0x7995('0x8'),_0x7995('0x9'),_0x7995('0xa'),_0x7995('0x5e'),'chatStatus','faxStatus',_0x7995('0x5f'),_0x7995('0x4e'),_0x7995('0x15'),_0x7995('0x11'),'whatsappStatus',_0x7995('0x60'),_0x7995('0x51'),_0x7995('0x4f'),_0x7995('0x61'),'smsStatusTime','voiceStatusTime',_0x7995('0x62'),_0x7995('0x63'),_0x7995('0x48'),_0x7995('0x64'),_0x7995('0x45'),_0x7995('0x46'),_0x7995('0x47'),_0x7995('0x49'),_0x7995('0x4d'),'mailCurrentCapacity',_0x7995('0x4a'),_0x7995('0x4c'),_0x7995('0x65'),_0x7995('0x66'),'phoneBarEnableAutomaticScreenRecording','destconnectedlinenum',_0x7995('0x67'),_0x7995('0x53'),'routealias',_0x7995('0x55')];}exports[_0x7995('0x68')]=getRealtimeAgentsQueryFields;
\ No newline at end of file
index 96898a0..9809778 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4038=['startPredictive','startProgressive','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','inbound','concat','outbound','get','loggedIn','available','talking','find','merge','pick','jayson/promise','util','client','http','paused','waiting','busy','inUse','invalid','loggedInDb','ringing','unavailable','unknown','pTalking','originated','message','statusMessage','dialActive'];(function(_0x1fc18b,_0x13d27d){var _0x16a351=function(_0x54a799){while(--_0x54a799){_0x1fc18b['push'](_0x1fc18b['shift']());}};_0x16a351(++_0x13d27d);}(_0x4038,0x16e));var _0x8403=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0x4038[_0x12bcf7];return _0x2825a;};'use strict';var _=require('lodash');var jayson=require(_0x8403('0x0'));var util=require(_0x8403('0x1'));var amiClient=jayson[_0x8403('0x2')][_0x8403('0x3')]({'port':0x232a});var routingClient=jayson[_0x8403('0x2')][_0x8403('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn',_0x8403('0x4'),_0x8403('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0x8403('0x6'),_0x8403('0x7'),_0x8403('0x8'),_0x8403('0x9'),'notInUse','onHold',_0x8403('0xa'),'ringInUse','talking',_0x8403('0xb'),_0x8403('0xc')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x8403('0xd'),_0x8403('0xe'),_0x8403('0xf'),_0x8403('0x10'),_0x8403('0x11'),'dialMethod','Trunk',_0x8403('0x12'),_0x8403('0x13'),'erlangCalls','erlangCallToSecond',_0x8403('0x14'),_0x8403('0x15'),'dialPredictiveInterval',_0x8403('0x16'),_0x8403('0x17'),_0x8403('0x18'),_0x8403('0x19'),_0x8403('0x1a'),'predictiveIntervalDroppedCallsTimeout',_0x8403('0x1b'),_0x8403('0x1c'),_0x8403('0x1d')];function getRealtimeQueues(_0x2bad64,_0x867715){var _0xad98d1=_0x867715===_0x8403('0x1e')?amiClient:routingClient;return _0xad98d1[_0x8403('0x1f')](_[_0x8403('0x20')](_0x867715)+_0x8403('0x21'),_0x2bad64)[_0x8403('0x22')](function(_0x4f49b3){if(_0x4f49b3['error'])throw new Error(util[_0x8403('0x23')](_0x8403('0x24'),_0x867715));return _0x4f49b3[_0x8403('0x25')];})['catch'](function(_0x5bd071){throw _0x5bd071;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x20a70c,_0x4a4d74,_0x4bcac1,_0x488fde){var _0xfd80e5=DEFAULT_QUEUE_ATTRIBUTES;if(_0x4bcac1===_0x8403('0x1e')){if(_0x488fde===_0x8403('0x26')){_0xfd80e5=_0xfd80e5[_0x8403('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x488fde===_0x8403('0x28')){_0xfd80e5=_0xfd80e5['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x20a70c['map'](function(_0x252061){var _0x3ce2ed=_0x252061[_0x8403('0x29')]({'plain':!![]});_0x3ce2ed[_0x8403('0x4')]=0x0;_0x3ce2ed['loggedInDb']=0x0;_0x3ce2ed[_0x8403('0x2a')]=0x0;_0x3ce2ed[_0x8403('0x2b')]=0x0;_0x3ce2ed['waiting']=0x0;if(_0x4bcac1==='voice'){_0x3ce2ed[_0x8403('0x2c')]=0x0;_0x3ce2ed[_0x8403('0x6')]=0x0;if(_0x488fde===_0x8403('0x28')){_0x3ce2ed[_0x8403('0xd')]=0x0;_0x3ce2ed[_0x8403('0xe')]=0x0;}}var _0xa397a6=_[_0x8403('0x2d')](_0x4a4d74,['id',_0x3ce2ed['id']]);if(_0xa397a6){_[_0x8403('0x2e')](_0x3ce2ed,_[_0x8403('0x2f')](_0xa397a6,_0xfd80e5));}return _0x3ce2ed;});}exports['initializeQueues']=initializeQueues;
\ No newline at end of file
+var _0x6f73=['message','dialActive','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','concat','outbound','map','find','merge','pick','initializeQueues','lodash','util','client','http','available','loggedIn','paused','waiting','busy','invalid','loggedInDb','ringing','ringInUse','talking','unknown','pTalking','originated'];(function(_0x20a6c5,_0x4aa7ca){var _0x5968e8=function(_0x1c981c){while(--_0x1c981c){_0x20a6c5['push'](_0x20a6c5['shift']());}};_0x5968e8(++_0x4aa7ca);}(_0x6f73,0x109));var _0x36f7=function(_0x29f9d4,_0x3724e4){_0x29f9d4=_0x29f9d4-0x0;var _0x45f9b6=_0x6f73[_0x29f9d4];return _0x45f9b6;};'use strict';var _=require(_0x36f7('0x0'));var jayson=require('jayson/promise');var util=require(_0x36f7('0x1'));var amiClient=jayson[_0x36f7('0x2')][_0x36f7('0x3')]({'port':0x232a});var routingClient=jayson[_0x36f7('0x2')][_0x36f7('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x36f7('0x4'),_0x36f7('0x5'),_0x36f7('0x6'),_0x36f7('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x36f7('0x8'),'inUse',_0x36f7('0x9'),_0x36f7('0xa'),'notInUse','onHold',_0x36f7('0xb'),_0x36f7('0xc'),_0x36f7('0xd'),'unavailable',_0x36f7('0xe')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x36f7('0xf'),_0x36f7('0x10'),_0x36f7('0x11'),'statusMessage',_0x36f7('0x12'),'dialMethod',_0x36f7('0x13'),'startPredictive',_0x36f7('0x14'),_0x36f7('0x15'),_0x36f7('0x16'),'erlangAbandonmentRate',_0x36f7('0x17'),_0x36f7('0x18'),_0x36f7('0x19'),'dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable',_0x36f7('0x1a'),_0x36f7('0x1b'),_0x36f7('0x1c'),'predictiveIntervalDroppedCallsCallersExit',_0x36f7('0x1d'),_0x36f7('0x1e')];function getRealtimeQueues(_0x2ffe42,_0x5554ae){var _0x118406=_0x5554ae===_0x36f7('0x1f')?amiClient:routingClient;return _0x118406['request'](_[_0x36f7('0x20')](_0x5554ae)+'Queues',_0x2ffe42)[_0x36f7('0x21')](function(_0x28c874){if(_0x28c874[_0x36f7('0x22')])throw new Error(util[_0x36f7('0x23')](_0x36f7('0x24'),_0x5554ae));return _0x28c874[_0x36f7('0x25')];})['catch'](function(_0x32dd63){throw _0x32dd63;});}exports[_0x36f7('0x26')]=getRealtimeQueues;function initializeQueues(_0x2f9f6b,_0x2c7212,_0x50b18d,_0x30fa0f){var _0x110c9b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x50b18d==='voice'){if(_0x30fa0f===_0x36f7('0x27')){_0x110c9b=_0x110c9b[_0x36f7('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x30fa0f===_0x36f7('0x29')){_0x110c9b=_0x110c9b[_0x36f7('0x28')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2f9f6b[_0x36f7('0x2a')](function(_0x51b53b){var _0x13bcd1=_0x51b53b['get']({'plain':!![]});_0x13bcd1[_0x36f7('0x6')]=0x0;_0x13bcd1[_0x36f7('0xa')]=0x0;_0x13bcd1[_0x36f7('0x5')]=0x0;_0x13bcd1[_0x36f7('0x4')]=0x0;_0x13bcd1[_0x36f7('0x7')]=0x0;if(_0x50b18d===_0x36f7('0x1f')){_0x13bcd1[_0x36f7('0xd')]=0x0;_0x13bcd1[_0x36f7('0x8')]=0x0;if(_0x30fa0f==='outbound'){_0x13bcd1[_0x36f7('0xf')]=0x0;_0x13bcd1['originated']=0x0;}}var _0x51abc1=_[_0x36f7('0x2b')](_0x2c7212,['id',_0x13bcd1['id']]);if(_0x51abc1){_[_0x36f7('0x2c')](_0x13bcd1,_[_0x36f7('0x2d')](_0x51abc1,_0x110c9b));}return _0x13bcd1;});}exports[_0x36f7('0x2e')]=initializeQueues;
\ No newline at end of file
index 5020ba9..5ca394e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x29bcd1,_0x321aab){var _0xe7f9cb=function(_0x250661){while(--_0x250661){_0x29bcd1['push'](_0x29bcd1['shift']());}};_0xe7f9cb(++_0x321aab);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());};
\ No newline at end of file
+var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x3f00ee,_0x1d1673){var _0x18a07e=function(_0x4dad57){while(--_0x4dad57){_0x3f00ee['push'](_0x3f00ee['shift']());}};_0x18a07e(++_0x1d1673);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());};
\ No newline at end of file
index 53f9bc1..8ca1e99 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1265=['address','127.0.0.1','cpus','createHash','md5','update','digest','hex','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','orderBy','filter','IPv4','internal','head','mac','00:00:00:00:00:00'];(function(_0x46b10d,_0x370055){var _0x1088bc=function(_0x58ade6){while(--_0x58ade6){_0x46b10d['push'](_0x46b10d['shift']());}};_0x1088bc(++_0x370055);}(_0x1265,0x10a));var _0x5126=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1265[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5126('0x0'));var os=require('os');var crypto=require(_0x5126('0x1'));var machine=require(_0x5126('0x2'));var exec=require(_0x5126('0x3'))[_0x5126('0x4')];var config=require(_0x5126('0x5'));function getInterfaces(){var _0x21ae93=[];var _0x9fbe83=os['networkInterfaces']();var _0x34886c=_[_0x5126('0x6')](_['keys'](_0x9fbe83));for(var _0x178648=0x0;_0x178648<_0x34886c['length'];_0x178648++){var _0x48a145=_0x9fbe83[_0x34886c[_0x178648]][_0x5126('0x7')](function(_0x5661b3){return _0x5661b3['family']===_0x5126('0x8')&&_0x5661b3[_0x5126('0x9')]===![];});_0x21ae93=_0x21ae93['concat'](_0x48a145);}return _0x21ae93;}function getFirstInterface(){var _0x57f34e=_[_0x5126('0xa')](getInterfaces());return{'macAddress':_0x57f34e&&_0x57f34e['mac']?_0x57f34e[_0x5126('0xb')]:_0x5126('0xc'),'ipAddress':_0x57f34e&&_0x57f34e[_0x5126('0xd')]?_0x57f34e[_0x5126('0xd')]:_0x5126('0xe')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x5c3a4f=_['orderBy'](os[_0x5126('0xf')]()['map'](function(_0x56e98b){return _0x56e98b['model'];}))['join'](':');return crypto[_0x5126('0x10')](_0x5126('0x11'))[_0x5126('0x12')](_0x5c3a4f)[_0x5126('0x13')](_0x5126('0x14'));}exports['getUuid']=function(){var _0x104f67=os[_0x5126('0x15')]();var _0x222d65=/[0-9a-f-]{36}/;if(config[_0x5126('0x16')]&&_0x222d65[_0x5126('0x17')](config[_0x5126('0x16')])){return config[_0x5126('0x16')];}else if(_0x104f67===_0x5126('0x18')){return exec(_0x5126('0x19'),{'encoding':_0x5126('0x1a')})[_0x5126('0x1b')]('\x0d\x0a','');}else{var _0x1adaaf=getFirstInterface();var _0x3a28d2=getCPUhash();var _0xad0185=_0x3a28d2+'|'+os['hostname']()+'|'+_0x1adaaf[_0x5126('0x1c')]+'|'+_0x1adaaf[_0x5126('0x1d')];var _0x4db5b3=crypto[_0x5126('0x10')](_0x5126('0x11'))[_0x5126('0x12')](_0xad0185)[_0x5126('0x13')](_0x5126('0x14'));return _0x4db5b3[_0x5126('0x1e')](0x0,0x8)+'-'+_0x4db5b3['substring'](0x8,0xc)+'-'+_0x4db5b3['substring'](0xc,0x10)+'-'+_0x4db5b3[_0x5126('0x1e')](0x10,0x14)+'-'+_0x4db5b3[_0x5126('0x1e')](0x14);}};
\ No newline at end of file
+var _0x0f13=['md5','update','digest','getUuid','platform','licenseToken','utf8','hostname','macAddress','ipAddress','substring','lodash','child_process','../environment','networkInterfaces','orderBy','keys','filter','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','model','join','createHash'];(function(_0x5ee507,_0x1cfc9f){var _0x4b2e3b=function(_0x44101b){while(--_0x44101b){_0x5ee507['push'](_0x5ee507['shift']());}};_0x4b2e3b(++_0x1cfc9f);}(_0x0f13,0x12d));var _0x30f1=function(_0x4b4e59,_0xfa9f52){_0x4b4e59=_0x4b4e59-0x0;var _0x2d1e85=_0x0f13[_0x4b4e59];return _0x2d1e85;};'use strict';var _=require(_0x30f1('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x30f1('0x1'))['execSync'];var config=require(_0x30f1('0x2'));function getInterfaces(){var _0x152abc=[];var _0x59f998=os[_0x30f1('0x3')]();var _0x4d8edb=_[_0x30f1('0x4')](_[_0x30f1('0x5')](_0x59f998));for(var _0x3800cd=0x0;_0x3800cd<_0x4d8edb['length'];_0x3800cd++){var _0xd3ec28=_0x59f998[_0x4d8edb[_0x3800cd]][_0x30f1('0x6')](function(_0x304f9b){return _0x304f9b['family']==='IPv4'&&_0x304f9b['internal']===![];});_0x152abc=_0x152abc[_0x30f1('0x7')](_0xd3ec28);}return _0x152abc;}function getFirstInterface(){var _0x1e4912=_[_0x30f1('0x8')](getInterfaces());return{'macAddress':_0x1e4912&&_0x1e4912[_0x30f1('0x9')]?_0x1e4912[_0x30f1('0x9')]:_0x30f1('0xa'),'ipAddress':_0x1e4912&&_0x1e4912[_0x30f1('0xb')]?_0x1e4912['address']:_0x30f1('0xc')};}exports[_0x30f1('0xd')]=getFirstInterface;function getCPUhash(){var _0x43521a=_[_0x30f1('0x4')](os[_0x30f1('0xe')]()['map'](function(_0x49cde2){return _0x49cde2[_0x30f1('0xf')];}))[_0x30f1('0x10')](':');return crypto[_0x30f1('0x11')](_0x30f1('0x12'))[_0x30f1('0x13')](_0x43521a)[_0x30f1('0x14')]('hex');}exports[_0x30f1('0x15')]=function(){var _0x1b590d=os[_0x30f1('0x16')]();var _0x2ec931=/[0-9a-f-]{36}/;if(config[_0x30f1('0x17')]&&_0x2ec931['test'](config[_0x30f1('0x17')])){return config[_0x30f1('0x17')];}else if(_0x1b590d==='win32'){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x30f1('0x18')})['replace']('\x0d\x0a','');}else{var _0x24b524=getFirstInterface();var _0x44ca27=getCPUhash();var _0x310be0=_0x44ca27+'|'+os[_0x30f1('0x19')]()+'|'+_0x24b524[_0x30f1('0x1a')]+'|'+_0x24b524[_0x30f1('0x1b')];var _0xbff3fa=crypto['createHash'](_0x30f1('0x12'))[_0x30f1('0x13')](_0x310be0)[_0x30f1('0x14')]('hex');return _0xbff3fa[_0x30f1('0x1c')](0x0,0x8)+'-'+_0xbff3fa[_0x30f1('0x1c')](0x8,0xc)+'-'+_0xbff3fa[_0x30f1('0x1c')](0xc,0x10)+'-'+_0xbff3fa[_0x30f1('0x1c')](0x10,0x14)+'-'+_0xbff3fa[_0x30f1('0x1c')](0x14);}};
\ No newline at end of file
index 7d74ffc..0086fb9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc0ae=['YYYY-MM-DD\x20HH:mm','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','bluebird','pkginfo','version','../../components/encryptor','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xc0ae,0xd5));var _0xec0a=function(_0x332ac5,_0x429005){_0x332ac5=_0x332ac5-0x0;var _0x330b33=_0xc0ae[_0x332ac5];return _0x330b33;};'use strict';var util=require(_0xec0a('0x0'));var moment=require(_0xec0a('0x1'));var rp=require('request-promise');var BPromise=require(_0xec0a('0x2'));var pkginfo=require(_0xec0a('0x3'))(module,_0xec0a('0x4'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xec0a('0x5'));var hardware=require(_0xec0a('0x6'));var logger=require(_0xec0a('0x7'))(_0xec0a('0x8'));var HOST=_0xec0a('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5cec7a){return new BPromise(function(_0x5ca1cd,_0x261081){var _0x19b0f5=util[_0xec0a('0xa')](_0xec0a('0xb'),HOST,_0x5cec7a,module['exports'][_0xec0a('0x4')]);if(oldToken){_0x19b0f5=util['format'](_0xec0a('0xc'),HOST,_0x5cec7a,module['exports'][_0xec0a('0x4')],oldToken);}var _0x4abc02={'uri':_0x19b0f5,'method':_0xec0a('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x4abc02)[_0xec0a('0xe')](function(_0x2f0620){_0x5ca1cd(_0x2f0620);})[_0xec0a('0xf')](function(_0x16a7bd){_0x261081(_0x16a7bd);});});}function manageLicense(_0x23d45f,_0x4be978){var _0x2af8c8=_0x4be978['get']({'plain':!![]});if(!isOldTokenSent&&_0x2af8c8[_0xec0a('0x10')]!==_0x23d45f&&!_0x2af8c8[_0xec0a('0x11')]){oldToken=_0x2af8c8[_0xec0a('0x10')];}httpRequest(_0x23d45f)[_0xec0a('0xe')](function(_0x3b3858){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x3b3858[_0xec0a('0x12')]){isOldTokenSent=![];if(!_0x2af8c8[_0xec0a('0x8')]&&_0x2af8c8['license']!=_0x3b3858[_0xec0a('0x8')]||_0x2af8c8[_0xec0a('0x8')]&&_0x2af8c8['data2']){logger[_0xec0a('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2af8c8[_0xec0a('0x8')]&&!_0x2af8c8[_0xec0a('0x11')]&&_0x2af8c8['license']!=_0x3b3858[_0xec0a('0x8')]){logger['info'](_0xec0a('0x14'));}if(_0x2af8c8[_0xec0a('0x8')]&&!_0x2af8c8[_0xec0a('0x11')]&&_0x2af8c8[_0xec0a('0x8')]==_0x3b3858[_0xec0a('0x8')]){return _0x4be978;}return _0x4be978[_0xec0a('0x15')]({'data1':_0x23d45f,'data2':null,'license':_0x3b3858[_0xec0a('0x8')]});}else{if(_0x3b3858[_0xec0a('0x8')]||_0x2af8c8[_0xec0a('0x8')]){if(!_0x2af8c8[_0xec0a('0x11')]){if(_0x2af8c8[_0xec0a('0x10')]==_0x23d45f){GRAY_PERIOD_REASON=_0xec0a('0x16');logger['info'](_0xec0a('0x17'));}else{GRAY_PERIOD_REASON='Changed';logger[_0xec0a('0x13')](_0xec0a('0x18'),_0x2af8c8[_0xec0a('0x10')],_0x23d45f);}logger[_0xec0a('0x13')](_0xec0a('0x19'),GRAY_PERIOD_REASON[_0xec0a('0x1a')](),moment()['format'](_0xec0a('0x1b')));return _0x4be978[_0xec0a('0x15')]({'data2':encryptor[_0xec0a('0x1c')](moment()['format'](_0xec0a('0x1b')))});}else{if(moment()['diff'](encryptor[_0xec0a('0x1d')](_0x2af8c8['data2']),_0xec0a('0x1e'))>DAYS){logger['info'](_0xec0a('0x1f'),moment()['format'](_0xec0a('0x1b')));isOldTokenSent=![];return _0x4be978[_0xec0a('0x15')]({'data1':_0x23d45f,'data2':null,'license':null});}}}else{if(_0x2af8c8[_0xec0a('0x10')]!=_0x23d45f){logger[_0xec0a('0x13')](_0xec0a('0x18'),_0x2af8c8[_0xec0a('0x10')],_0x23d45f);return _0x4be978[_0xec0a('0x15')]({'data1':_0x23d45f,'data2':null,'license':null});}}}return _0x4be978;})[_0xec0a('0xe')](function(_0x5b1c70){_0x4be978=_0x5b1c70;})['catch'](function(_0x40db7e){logger['error'](_0x40db7e[_0xec0a('0x20')]);})[_0xec0a('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xec0a('0x22')](),_0x4be978);},TIME);});}function defaultLicense(){var _0x38ac96=hardware[_0xec0a('0x22')]();if(_0x38ac96){return db['License'][_0xec0a('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x38ac96}})[_0xec0a('0x24')](function(_0x1cad2b,_0x582551){logger[_0xec0a('0x13')](_0xec0a('0x25'),_0x38ac96);manageLicense(_0x38ac96,_0x1cad2b);})['catch'](function(_0x5544e0){logger[_0xec0a('0x26')](_0x5544e0[_0xec0a('0x20')]);});}}exports[_0xec0a('0x27')]=defaultLicense;
\ No newline at end of file
+var _0xbcac=['../logger','license','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','data1','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data2','update','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','getUuid','License','findOrCreate','spread','default','util','moment','request-promise','bluebird','../../mysqldb','../../components/encryptor','./hardware'];(function(_0x18f8c1,_0x509d75){var _0x16b26b=function(_0x172330){while(--_0x172330){_0x18f8c1['push'](_0x18f8c1['shift']());}};_0x16b26b(++_0x509d75);}(_0xbcac,0x9d));var _0xcbca=function(_0x39de31,_0x1ff3e1){_0x39de31=_0x39de31-0x0;var _0x9708f=_0xbcac[_0x39de31];return _0x9708f;};'use strict';var util=require(_0xcbca('0x0'));var moment=require(_0xcbca('0x1'));var rp=require(_0xcbca('0x2'));var BPromise=require(_0xcbca('0x3'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xcbca('0x4'))['db'];var encryptor=require(_0xcbca('0x5'));var hardware=require(_0xcbca('0x6'));var logger=require(_0xcbca('0x7'))(_0xcbca('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3e500b){return new BPromise(function(_0x5ce83d,_0x50dae4){var _0x83fbb1=util[_0xcbca('0x9')](_0xcbca('0xa'),HOST,_0x3e500b,module[_0xcbca('0xb')][_0xcbca('0xc')]);if(oldToken){_0x83fbb1=util[_0xcbca('0x9')](_0xcbca('0xd'),HOST,_0x3e500b,module['exports']['version'],oldToken);}var _0x126ab7={'uri':_0x83fbb1,'method':_0xcbca('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x126ab7)[_0xcbca('0xf')](function(_0x2baad5){_0x5ce83d(_0x2baad5);})[_0xcbca('0x10')](function(_0x47595c){_0x50dae4(_0x47595c);});});}function manageLicense(_0x372ae7,_0xbc910b){var _0x5381dd=_0xbc910b['get']({'plain':!![]});if(!isOldTokenSent&&_0x5381dd[_0xcbca('0x11')]!==_0x372ae7&&!_0x5381dd['data2']){oldToken=_0x5381dd[_0xcbca('0x11')];}httpRequest(_0x372ae7)[_0xcbca('0xf')](function(_0xfa9cb1){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0xfa9cb1[_0xcbca('0x12')]){isOldTokenSent=![];if(!_0x5381dd[_0xcbca('0x8')]&&_0x5381dd[_0xcbca('0x8')]!=_0xfa9cb1[_0xcbca('0x8')]||_0x5381dd[_0xcbca('0x8')]&&_0x5381dd['data2']){logger[_0xcbca('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x5381dd['license']&&!_0x5381dd['data2']&&_0x5381dd[_0xcbca('0x8')]!=_0xfa9cb1[_0xcbca('0x8')]){logger[_0xcbca('0x13')](_0xcbca('0x14'));}if(_0x5381dd[_0xcbca('0x8')]&&!_0x5381dd[_0xcbca('0x15')]&&_0x5381dd[_0xcbca('0x8')]==_0xfa9cb1[_0xcbca('0x8')]){return _0xbc910b;}return _0xbc910b[_0xcbca('0x16')]({'data1':_0x372ae7,'data2':null,'license':_0xfa9cb1[_0xcbca('0x8')]});}else{if(_0xfa9cb1['license']||_0x5381dd[_0xcbca('0x8')]){if(!_0x5381dd[_0xcbca('0x15')]){if(_0x5381dd['data1']==_0x372ae7){GRAY_PERIOD_REASON='Disabled';logger[_0xcbca('0x13')](_0xcbca('0x17'));}else{GRAY_PERIOD_REASON=_0xcbca('0x18');logger['info'](_0xcbca('0x19'),_0x5381dd[_0xcbca('0x11')],_0x372ae7);}logger[_0xcbca('0x13')](_0xcbca('0x1a'),GRAY_PERIOD_REASON[_0xcbca('0x1b')](),moment()['format'](_0xcbca('0x1c')));return _0xbc910b[_0xcbca('0x16')]({'data2':encryptor[_0xcbca('0x1d')](moment()[_0xcbca('0x9')](_0xcbca('0x1c')))});}else{if(moment()[_0xcbca('0x1e')](encryptor[_0xcbca('0x1f')](_0x5381dd[_0xcbca('0x15')]),_0xcbca('0x20'))>DAYS){logger[_0xcbca('0x13')](_0xcbca('0x21'),moment()['format'](_0xcbca('0x1c')));isOldTokenSent=![];return _0xbc910b['update']({'data1':_0x372ae7,'data2':null,'license':null});}}}else{if(_0x5381dd[_0xcbca('0x11')]!=_0x372ae7){logger[_0xcbca('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x5381dd[_0xcbca('0x11')],_0x372ae7);return _0xbc910b[_0xcbca('0x16')]({'data1':_0x372ae7,'data2':null,'license':null});}}}return _0xbc910b;})[_0xcbca('0xf')](function(_0x5e5183){_0xbc910b=_0x5e5183;})[_0xcbca('0x10')](function(_0x29bce0){logger[_0xcbca('0x22')](_0x29bce0[_0xcbca('0x23')]);})['finally'](function(){setTimeout(function(){manageLicense(hardware[_0xcbca('0x24')](),_0xbc910b);},TIME);});}function defaultLicense(){var _0x425122=hardware[_0xcbca('0x24')]();if(_0x425122){return db[_0xcbca('0x25')][_0xcbca('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x425122}})[_0xcbca('0x27')](function(_0x9e08fa,_0x574ad3){logger[_0xcbca('0x13')]('SERVICE\x20LICENSE\x20STARTED\x20%s',_0x425122);manageLicense(_0x425122,_0x9e08fa);})[_0xcbca('0x10')](function(_0x1fa2e6){logger[_0xcbca('0x22')](_0x1fa2e6['message']);});}}exports[_0xcbca('0x28')]=defaultLicense;
\ No newline at end of file
index 24f6be1..63cac8f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1523=['license','isEmpty','data2','split','decryptString','format','%s:%s:%s','demo','machineUuid','gray','add','days','changed','disabled','message','findAll','role','sequelize','COUNT','col','count','user','users','telephones','admin','pick','telephone','License\x20limit\x20reached\x20for\x20users','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1'];(function(_0x279349,_0x23bf74){var _0x30b3ad=function(_0x492347){while(--_0x492347){_0x279349['push'](_0x279349['shift']());}};_0x30b3ad(++_0x23bf74);}(_0x1523,0xfd));var _0x3152=function(_0x5bc061,_0x4ce553){_0x5bc061=_0x5bc061-0x0;var _0x294686=_0x1523[_0x5bc061];return _0x294686;};'use strict';var util=require(_0x3152('0x0'));var _=require(_0x3152('0x1'));var moment=require(_0x3152('0x2'));var BPromise=require('bluebird');var hardware=require(_0x3152('0x3'));var encryptor=require(_0x3152('0x4'));var db=require(_0x3152('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3152('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3152('0x7'),'machineUuid':hardware[_0x3152('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3152('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3152('0x9'),'machineUuid':hardware[_0x3152('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5b52ca){return new BPromise(function(_0x266260,_0x445b60){return db[_0x3152('0xa')][_0x3152('0xb')](_[_0x3152('0xc')](_0x5b52ca,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x1afef2){return checkLicense(_0x1afef2,null);})[_0x3152('0xd')](function(_0x17f806){_0x266260(_0x17f806);return;})[_0x3152('0xe')](function(_0x6aee9b){_0x445b60(_0x6aee9b);});});}function checkLicense(_0x26f532,_0x381a80){if(!_0x26f532){demoLicense[_0x3152('0xf')]=_0x26f532[_0x3152('0x10')];return demoLicense;}try{var _0x5c5c39=_0x381a80||_0x26f532[_0x3152('0x11')];if(_[_0x3152('0x12')](_0x5c5c39)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x535861=_0x26f532[_0x3152('0x10')];var _0x375364=_0x26f532[_0x3152('0x13')];var _0x51a2e2=_0x535861[_0x3152('0x14')]('-')[0x4];var _0x3edd8c=_0x535861['split']('-')[0x0];var _0x22c079=encryptor[_0x3152('0x15')](_0x5c5c39,util[_0x3152('0x16')](_0x3152('0x17'),_0x51a2e2,_0x535861,_0x3edd8c));var _0x292cd1=JSON['parse'](_0x22c079);_0x292cd1[_0x3152('0x18')]=![];_0x292cd1[_0x3152('0xf')]=_0x535861;_0x292cd1[_0x3152('0x19')]=hardware[_0x3152('0x8')]();if(_0x375364){var _0x1def5e=encryptor[_0x3152('0x15')](_0x375364);_0x292cd1[_0x3152('0x1a')]=_0x1def5e;_0x292cd1['deadline']=moment(_0x1def5e)[_0x3152('0x1b')](0x7,_0x3152('0x1c'))[_0x3152('0x16')]();_0x292cd1['grayReason']=_0x292cd1[_0x3152('0xf')]!=_0x292cd1[_0x3152('0x19')]?_0x3152('0x1d'):_0x3152('0x1e');}return _0x292cd1;}catch(_0x374f55){breakingLicense[_0x3152('0xf')]=_0x26f532[_0x3152('0x10')];breakingLicense[_0x3152('0x1f')]=_0x374f55[_0x3152('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x5d22b1,_0x4253ac){getLicense()['then'](function(_0xafc4ec){return db['User'][_0x3152('0x20')]({'attributes':[_0x3152('0x21'),[db[_0x3152('0x22')]['fn'](_0x3152('0x23'),db[_0x3152('0x22')][_0x3152('0x24')](_0x3152('0x21'))),_0x3152('0x25')]],'group':_0x3152('0x21'),'where':{'role':{'$or':['admin',_0x3152('0x26'),'telephone']}},'raw':!![]})['then'](function(_0x15c8f0){var _0x2c8a6d={'user':_0xafc4ec[_0x3152('0x27')]||0x0,'telephone':_0xafc4ec[_0x3152('0x28')]||0x0};_0x15c8f0['forEach'](function(_0x52cd4a){var _0x443c82=_0x52cd4a[_0x3152('0x21')]===_0x3152('0x29')?_0x3152('0x26'):_0x52cd4a['role'];_0x2c8a6d[_0x443c82]-=_0x52cd4a[_0x3152('0x25')];if(_0x2c8a6d[_0x443c82]<0x0)_0x2c8a6d[_0x443c82]=0x0;});_0x5d22b1(_0x2c8a6d);return;});})['catch'](function(_0x39b366){_0x4253ac(_0x39b366);});});}function checkUserLimits(_0x3af09a){return new BPromise(function(_0x15ea2a,_0x26f659){getLimits()[_0x3152('0xd')](function(_0x41e85d){var _0x22cfa1=_[_0x3152('0x2a')](_['countBy'](_0x3af09a,'role'),[_0x3152('0x29'),'user','telephone']);var _0x3e49ec=(_0x22cfa1['admin']||0x0)+(_0x22cfa1[_0x3152('0x26')]||0x0);var _0x8633a1=_0x22cfa1[_0x3152('0x2b')]||0x0;if(_0x3e49ec>_0x41e85d[_0x3152('0x26')])return _0x26f659(_0x3152('0x2c'));if(_0x8633a1>_0x41e85d['telephone'])return _0x26f659('License\x20limit\x20reached\x20for\x20telephones');return _0x15ea2a();})['catch'](function(_0x187b7a){_0x26f659(_0x187b7a);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense};
\ No newline at end of file
+var _0x92f9=['%s:%s:%s','parse','uuid','machineUuid','gray','add','format','changed','disabled','message','User','findAll','role','sequelize','COUNT','count','user','telephone','users','telephones','forEach','admin','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','find','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x92f9,0x135));var _0x992f=function(_0x3832f9,_0x59c443){_0x3832f9=_0x3832f9-0x0;var _0x37418c=_0x92f9[_0x3832f9];return _0x37418c;};'use strict';var util=require('util');var _=require(_0x992f('0x0'));var moment=require(_0x992f('0x1'));var BPromise=require(_0x992f('0x2'));var hardware=require(_0x992f('0x3'));var encryptor=require(_0x992f('0x4'));var db=require(_0x992f('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x992f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x992f('0x7'),'machineUuid':hardware[_0x992f('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x992f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x992f('0x9'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xb08b54){return new BPromise(function(_0x215c9c,_0x3cc1d0){return db['License'][_0x992f('0xa')](_['defaults'](_0xb08b54,{'raw':!![],'where':{'id':0x1}}))[_0x992f('0xb')](function(_0x17790b){return checkLicense(_0x17790b,null);})[_0x992f('0xb')](function(_0x557878){_0x215c9c(_0x557878);return;})[_0x992f('0xc')](function(_0x4c995c){_0x3cc1d0(_0x4c995c);});});}function checkLicense(_0x7ea38a,_0x1f2860){if(!_0x7ea38a){demoLicense['uuid']=_0x7ea38a[_0x992f('0xd')];return demoLicense;}try{var _0x352f4e=_0x1f2860||_0x7ea38a[_0x992f('0xe')];if(_[_0x992f('0xf')](_0x352f4e)){throw new Error(_0x992f('0x10'));}var _0x39f75e=_0x7ea38a[_0x992f('0xd')];var _0x3b78dc=_0x7ea38a[_0x992f('0x11')];var _0x2c220d=_0x39f75e[_0x992f('0x12')]('-')[0x4];var _0x4d2c42=_0x39f75e[_0x992f('0x12')]('-')[0x0];var _0xe44ca9=encryptor[_0x992f('0x13')](_0x352f4e,util['format'](_0x992f('0x14'),_0x2c220d,_0x39f75e,_0x4d2c42));var _0x238d59=JSON[_0x992f('0x15')](_0xe44ca9);_0x238d59['demo']=![];_0x238d59[_0x992f('0x16')]=_0x39f75e;_0x238d59[_0x992f('0x17')]=hardware[_0x992f('0x8')]();if(_0x3b78dc){var _0x454d9b=encryptor['decryptString'](_0x3b78dc);_0x238d59[_0x992f('0x18')]=_0x454d9b;_0x238d59['deadline']=moment(_0x454d9b)[_0x992f('0x19')](0x7,'days')[_0x992f('0x1a')]();_0x238d59['grayReason']=_0x238d59['uuid']!=_0x238d59['machineUuid']?_0x992f('0x1b'):_0x992f('0x1c');}return _0x238d59;}catch(_0x1e2663){breakingLicense[_0x992f('0x16')]=_0x7ea38a[_0x992f('0xd')];breakingLicense[_0x992f('0x1d')]=_0x1e2663[_0x992f('0x1d')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x55fcf8,_0x493f7c){getLicense()['then'](function(_0x255022){return db[_0x992f('0x1e')][_0x992f('0x1f')]({'attributes':[_0x992f('0x20'),[db[_0x992f('0x21')]['fn'](_0x992f('0x22'),db[_0x992f('0x21')]['col'](_0x992f('0x20'))),_0x992f('0x23')]],'group':_0x992f('0x20'),'where':{'role':{'$or':['admin',_0x992f('0x24'),_0x992f('0x25')]}},'raw':!![]})[_0x992f('0xb')](function(_0xca1ad9){var _0x2bd945={'user':_0x255022[_0x992f('0x26')]||0x0,'telephone':_0x255022[_0x992f('0x27')]||0x0};_0xca1ad9[_0x992f('0x28')](function(_0x975b57){var _0x535949=_0x975b57['role']===_0x992f('0x29')?_0x992f('0x24'):_0x975b57[_0x992f('0x20')];_0x2bd945[_0x535949]-=_0x975b57[_0x992f('0x23')];if(_0x2bd945[_0x535949]<0x0)_0x2bd945[_0x535949]=0x0;});_0x55fcf8(_0x2bd945);return;});})['catch'](function(_0x59969e){_0x493f7c(_0x59969e);});});}function checkUserLimits(_0x57d438){return new BPromise(function(_0x443bde,_0xa7de56){getLimits()[_0x992f('0xb')](function(_0x2e28fd){var _0x180480=_[_0x992f('0x2a')](_[_0x992f('0x2b')](_0x57d438,_0x992f('0x20')),[_0x992f('0x29'),'user',_0x992f('0x25')]);var _0x38ef35=(_0x180480['admin']||0x0)+(_0x180480[_0x992f('0x24')]||0x0);var _0x1105fc=_0x180480['telephone']||0x0;if(_0x38ef35>_0x2e28fd[_0x992f('0x24')])return _0xa7de56(_0x992f('0x2c'));if(_0x1105fc>_0x2e28fd[_0x992f('0x25')])return _0xa7de56(_0x992f('0x2d'));return _0x443bde();})[_0x992f('0xc')](function(_0x1e3ee6){_0xa7de56(_0x1e3ee6);});});}module[_0x992f('0x2e')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense};
\ No newline at end of file
index cbdf9ce..b21a12a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4fc2=['app-id','exports','http://localhost:9000','myappanuglar-secret'];(function(_0x367735,_0x59cbce){var _0x560310=function(_0x155c22){while(--_0x155c22){_0x367735['push'](_0x367735['shift']());}};_0x560310(++_0x59cbce);}(_0x4fc2,0x111));var _0x24fc=function(_0x41e226,_0x5b6d61){_0x41e226=_0x41e226-0x0;var _0x87089d=_0x4fc2[_0x41e226];return _0x87089d;};'use strict';module[_0x24fc('0x0')]={'DOMAIN':_0x24fc('0x1'),'SESSION_SECRET':_0x24fc('0x2'),'GOOGLE_ID':_0x24fc('0x3'),'GOOGLE_SECRET':'secret','DEBUG':''};
\ No newline at end of file
+var _0xda2d=['app-id','secret','http://localhost:9000','myappanuglar-secret'];(function(_0x5f34f8,_0xb4230b){var _0x28e804=function(_0x416994){while(--_0x416994){_0x5f34f8['push'](_0x5f34f8['shift']());}};_0x28e804(++_0xb4230b);}(_0xda2d,0x102));var _0xdda2=function(_0x3bc0ef,_0x4857bc){_0x3bc0ef=_0x3bc0ef-0x0;var _0x5df446=_0xda2d[_0x3bc0ef];return _0x5df446;};'use strict';module['exports']={'DOMAIN':_0xdda2('0x0'),'SESSION_SECRET':_0xdda2('0x1'),'GOOGLE_ID':_0xdda2('0x2'),'GOOGLE_SECRET':_0xdda2('0x3'),'DEBUG':''};
\ No newline at end of file
index 19e59d2..943de67 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0f84=['exports','../utils/loggers'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x0f84,0xe9));var _0x40f8=function(_0x4b5585,_0x3ed0e2){_0x4b5585=_0x4b5585-0x0;var _0x3c6696=_0x0f84[_0x4b5585];return _0x3c6696;};'use strict';var fileLogger=require(_0x40f8('0x0'))['fileLogger'];module[_0x40f8('0x1')]=fileLogger;
\ No newline at end of file
+var _0x112d=['fileLogger','exports','../utils/loggers'];(function(_0x16ca23,_0x3a2513){var _0x36dc6c=function(_0x41ff95){while(--_0x41ff95){_0x16ca23['push'](_0x16ca23['shift']());}};_0x36dc6c(++_0x3a2513);}(_0x112d,0x16d));var _0xd112=function(_0x8c71d2,_0x429f91){_0x8c71d2=_0x8c71d2-0x0;var _0x3c1bd2=_0x112d[_0x8c71d2];return _0x3c1bd2;};'use strict';var fileLogger=require(_0xd112('0x0'))[_0xd112('0x1')];module[_0xd112('0x2')]=fileLogger;
\ No newline at end of file
index 12ce380..3ea4c59 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7d5a=['resolve','join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','path','../../config/environment'];(function(_0x590941,_0x1981e0){var _0x43c7bc=function(_0x1cd545){while(--_0x1cd545){_0x590941['push'](_0x590941['shift']());}};_0x43c7bc(++_0x1981e0);}(_0x7d5a,0x11c));var _0xa7d5=function(_0x1713bb,_0x57062c){_0x1713bb=_0x1713bb-0x0;var _0x53363f=_0x7d5a[_0x1713bb];return _0x53363f;};'use strict';var path=require(_0xa7d5('0x0'));var cfg=require(_0xa7d5('0x1'));var env={'NODE_PATH':path[_0xa7d5('0x2')](path[_0xa7d5('0x3')](cfg[_0xa7d5('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0xa7d5('0x5'),'script':path[_0xa7d5('0x3')](__dirname,_0xa7d5('0x6')),'env':env},{'name':_0xa7d5('0x7'),'script':path[_0xa7d5('0x3')](__dirname,_0xa7d5('0x8')),'env':env},{'name':'agi','script':path[_0xa7d5('0x3')](__dirname,'../../services/agi/index.js'),'env':env},{'name':'email','script':path[_0xa7d5('0x3')](__dirname,_0xa7d5('0x9')),'env':env},{'name':_0xa7d5('0xa'),'script':path[_0xa7d5('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0xa7d5('0xb'),'script':path[_0xa7d5('0x3')](__dirname,_0xa7d5('0xc')),'env':env}]};module['exports']=pm2config;
\ No newline at end of file
+var _0x9b31=['../../config/environment','resolve','root','legacy-libs','express','join','ami','agi','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','path'];(function(_0x25dcec,_0x250318){var _0x3340c7=function(_0x248127){while(--_0x248127){_0x25dcec['push'](_0x25dcec['shift']());}};_0x3340c7(++_0x250318);}(_0x9b31,0x14f));var _0x19b3=function(_0x1583bb,_0x290e29){_0x1583bb=_0x1583bb-0x0;var _0x3a9ceb=_0x9b31[_0x1583bb];return _0x3a9ceb;};'use strict';var path=require(_0x19b3('0x0'));var cfg=require(_0x19b3('0x1'));var env={'NODE_PATH':path[_0x19b3('0x2')](path['join'](cfg[_0x19b3('0x3')],_0x19b3('0x4')))};var pm2config={'apps':[{'name':_0x19b3('0x5'),'script':path[_0x19b3('0x6')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x19b3('0x7'),'script':path[_0x19b3('0x6')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x19b3('0x8'),'script':path[_0x19b3('0x6')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x19b3('0x9'),'script':path[_0x19b3('0x6')](__dirname,_0x19b3('0xa')),'env':env},{'name':'routing','script':path[_0x19b3('0x6')](__dirname,_0x19b3('0xb')),'env':env},{'name':_0x19b3('0xc'),'script':path[_0x19b3('0x6')](__dirname,_0x19b3('0xd')),'env':env}]};module['exports']=pm2config;
\ No newline at end of file
index 8d4e7ff..83cb733 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf883=['connected','start','then','disconnect','restart','list','describe','delete','dump','saved','./config','connect'];(function(_0x3cf346,_0x1ab6b8){var _0xd1d2f=function(_0x422dc4){while(--_0x422dc4){_0x3cf346['push'](_0x3cf346['shift']());}};_0xd1d2f(++_0x1ab6b8);}(_0xf883,0x14e));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x3f88('0x0'));function connect(){return new BPromise(function(_0x4b8092,_0x121405){return pm2[_0x3f88('0x1')](function(_0x443037){if(_0x443037){return _0x121405(_0x443037);}return _0x4b8092(_0x3f88('0x2'));});});};exports[_0x3f88('0x3')]=function(_0x174126){return connect()[_0x3f88('0x4')](function(){return new BPromise(function(_0x17b95b,_0x291ff0){return pm2['start'](_0x174126,function(_0x5394e6,_0x3aab96){if(_0x5394e6){return _0x291ff0(_0x5394e6);}pm2[_0x3f88('0x5')]();return _0x17b95b(_0x3aab96);});});});};exports['stop']=function(_0x52ea20){return connect()[_0x3f88('0x4')](function(){return new BPromise(function(_0x2948a9,_0x5ad689){return pm2['stop'](_0x52ea20,function(_0x5004fa,_0x1367a0){if(_0x5004fa){return _0x5ad689(_0x5004fa);}pm2[_0x3f88('0x5')]();return _0x2948a9(_0x1367a0);});});});};exports[_0x3f88('0x6')]=function(_0x21286c){return connect()[_0x3f88('0x4')](function(){return new BPromise(function(_0x23ab18,_0x3dc80d){return pm2['restart'](_0x21286c,function(_0x503a89,_0x52e816){if(_0x503a89){return _0x3dc80d(_0x503a89);}pm2[_0x3f88('0x5')]();return _0x23ab18(_0x52e816);});});});};exports[_0x3f88('0x7')]=function(){return connect()[_0x3f88('0x4')](function(){return new BPromise(function(_0x23eb59,_0x1b8bcf){return pm2[_0x3f88('0x7')](function(_0x4d1e1e,_0x350a70){if(_0x4d1e1e){return _0x1b8bcf(_0x4d1e1e);}pm2[_0x3f88('0x5')]();return _0x23eb59(_0x350a70);});});});};exports['describe']=function(_0x4acc76){return connect()[_0x3f88('0x4')](function(){return new BPromise(function(_0x41dde0,_0x434140){return pm2[_0x3f88('0x8')](_0x4acc76,function(_0x2608dc,_0x4c75d9){if(_0x2608dc){return _0x434140(_0x2608dc);}pm2['disconnect']();return _0x41dde0(_0x4c75d9);});});});};exports[_0x3f88('0x9')]=function(_0xebe065){return connect()[_0x3f88('0x4')](function(){return new BPromise(function(_0x410d22,_0x1e8dc7){return pm2['delete'](_0xebe065,function(_0x53182b,_0x1ce58b){if(_0x53182b){return _0x1e8dc7(_0x53182b);}pm2[_0x3f88('0x5')]();return _0x410d22(_0x1ce58b);});});});};exports[_0x3f88('0xa')]=function(){return connect()[_0x3f88('0x4')](function(){return new BPromise(function(_0x1daf38,_0x10fc5c){return pm2['dump'](function(_0x17a81b){if(_0x17a81b){return _0x10fc5c(_0x17a81b);}return _0x1daf38(_0x3f88('0xb'));});});});};
\ No newline at end of file
+var _0xbb44=['stop','restart','list','describe','delete','dump','saved','pm2','bluebird','./config','connect','connected','then','start','disconnect'];(function(_0x350b1c,_0x2534dd){var _0x3f59a5=function(_0x39efa8){while(--_0x39efa8){_0x350b1c['push'](_0x350b1c['shift']());}};_0x3f59a5(++_0x2534dd);}(_0xbb44,0xe8));var _0x4bb4=function(_0xde846f,_0x53c934){_0xde846f=_0xde846f-0x0;var _0x1f743f=_0xbb44[_0xde846f];return _0x1f743f;};'use strict';var pm2=require(_0x4bb4('0x0'));var BPromise=require(_0x4bb4('0x1'));var config=require(_0x4bb4('0x2'));function connect(){return new BPromise(function(_0x1b554a,_0x493fcd){return pm2[_0x4bb4('0x3')](function(_0x5a0280){if(_0x5a0280){return _0x493fcd(_0x5a0280);}return _0x1b554a(_0x4bb4('0x4'));});});};exports['start']=function(_0x4cb05d){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x4e96c7,_0x5e727f){return pm2[_0x4bb4('0x6')](_0x4cb05d,function(_0x1dd86b,_0x135f33){if(_0x1dd86b){return _0x5e727f(_0x1dd86b);}pm2[_0x4bb4('0x7')]();return _0x4e96c7(_0x135f33);});});});};exports[_0x4bb4('0x8')]=function(_0x24f61c){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x39ce8e,_0x2b8730){return pm2[_0x4bb4('0x8')](_0x24f61c,function(_0x3be200,_0x3fa25d){if(_0x3be200){return _0x2b8730(_0x3be200);}pm2[_0x4bb4('0x7')]();return _0x39ce8e(_0x3fa25d);});});});};exports[_0x4bb4('0x9')]=function(_0x18a918){return connect()['then'](function(){return new BPromise(function(_0x4406eb,_0x26ee3f){return pm2[_0x4bb4('0x9')](_0x18a918,function(_0xf3314,_0x5b13a3){if(_0xf3314){return _0x26ee3f(_0xf3314);}pm2[_0x4bb4('0x7')]();return _0x4406eb(_0x5b13a3);});});});};exports[_0x4bb4('0xa')]=function(){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x4a0bd2,_0x4b5946){return pm2['list'](function(_0x7f997f,_0x34a323){if(_0x7f997f){return _0x4b5946(_0x7f997f);}pm2['disconnect']();return _0x4a0bd2(_0x34a323);});});});};exports['describe']=function(_0x4e7361){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x4964d4,_0x2af597){return pm2[_0x4bb4('0xb')](_0x4e7361,function(_0x5605b4,_0x28816c){if(_0x5605b4){return _0x2af597(_0x5605b4);}pm2[_0x4bb4('0x7')]();return _0x4964d4(_0x28816c);});});});};exports[_0x4bb4('0xc')]=function(_0x24ea1e){return connect()['then'](function(){return new BPromise(function(_0x21596a,_0x190eed){return pm2[_0x4bb4('0xc')](_0x24ea1e,function(_0x4ff1c9,_0x5781f9){if(_0x4ff1c9){return _0x190eed(_0x4ff1c9);}pm2['disconnect']();return _0x21596a(_0x5781f9);});});});};exports['dump']=function(){return connect()[_0x4bb4('0x5')](function(){return new BPromise(function(_0x53e0f8,_0x4949b5){return pm2[_0x4bb4('0xd')](function(_0x56015d){if(_0x56015d){return _0x4949b5(_0x56015d);}return _0x53e0f8(_0x4bb4('0xe'));});});});};
\ No newline at end of file
index 4001177..8acbf09 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe322=['ChatInteraction','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','find','chatTimeout','then'];(function(_0x4f9a6f,_0x2da3ae){var _0x1f75c4=function(_0x32e6c8){while(--_0x32e6c8){_0x4f9a6f['push'](_0x4f9a6f['shift']());}};_0x1f75c4(++_0x2da3ae);}(_0xe322,0x1e5));var _0x2e32=function(_0x2e9ba1,_0x345c72){_0x2e9ba1=_0x2e9ba1-0x0;var _0x204461=_0xe322[_0x2e9ba1];return _0x204461;};'use strict';var _=require('lodash');var moment=require(_0x2e32('0x0'));var Redis=require(_0x2e32('0x1'));var util=require(_0x2e32('0x2'));var config=require(_0x2e32('0x3'));var db=require(_0x2e32('0x4'))['db'];var logger=require('../logger')(_0x2e32('0x5'));config[_0x2e32('0x6')]=_['defaults'](config['redis'],{'host':_0x2e32('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2e32('0x6')]));function closeInteractions(){var _0x54af63=0x0;var _0x363306=[];return db['Setting'][_0x2e32('0x8')]({'raw':!![],'attributes':['id',_0x2e32('0x9')],'where':{'id':0x1}})[_0x2e32('0xa')](function(_0x575566){_0x54af63=_0x575566['chatTimeout'];if(_0x54af63){return db[_0x2e32('0xb')]['findAll']({'raw':!![],'attributes':['id',_0x2e32('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x2e32('0xd')](_0x575566[_0x2e32('0x9')],_0x2e32('0xe'))}}});}else{return[];}})[_0x2e32('0xa')](function(_0x52a932){if(_0x52a932&&_0x52a932[_0x2e32('0xf')]){_0x363306=_['map'](_0x52a932||[],'id');logger[_0x2e32('0x10')](_0x2e32('0x11'),_0x363306[_0x2e32('0x12')]());return db['ChatInteraction'][_0x2e32('0x13')]({'closeReason':_0x2e32('0x14'),'disposition':_0x2e32('0x15'),'closed':!![],'closedAt':moment()[_0x2e32('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x363306}});}})[_0x2e32('0xa')](function(){if(_0x363306&&_0x363306[_0x2e32('0xf')]){logger[_0x2e32('0x10')](_0x2e32('0x17'),_0x363306[_0x2e32('0x12')]());for(var _0x46bab3=0x0;_0x46bab3<_0x363306[_0x2e32('0xf')];_0x46bab3++){io[_0x2e32('0x18')](_0x2e32('0x19'),{'id':_0x363306[_0x46bab3],'closed':!![]});}}})[_0x2e32('0x1a')](function(_0x5c448a){logger[_0x2e32('0x1b')](_0x2e32('0x1c'),_0x5c448a?util[_0x2e32('0x1d')](_0x5c448a,{'showHidden':![],'depth':null}):'');});}exports[_0x2e32('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0xe76b=['moment','../../config/environment','../../mysqldb','../logger','schedule','defaults','localhost','socket.io-emitter','redis','Setting','find','chatTimeout','then','ChatInteraction','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','timeout','format','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','[CHAT]\x20Error\x20closing\x20interactions','inspect'];(function(_0x15fe66,_0x3622ea){var _0x52003e=function(_0x20257a){while(--_0x20257a){_0x15fe66['push'](_0x15fe66['shift']());}};_0x52003e(++_0x3622ea);}(_0xe76b,0xfa));var _0xbe76=function(_0x1116ac,_0xcbe059){_0x1116ac=_0x1116ac-0x0;var _0x3e806b=_0xe76b[_0x1116ac];return _0x3e806b;};'use strict';var _=require('lodash');var moment=require(_0xbe76('0x0'));var Redis=require('ioredis');var util=require('util');var config=require(_0xbe76('0x1'));var db=require(_0xbe76('0x2'))['db'];var logger=require(_0xbe76('0x3'))(_0xbe76('0x4'));config['redis']=_[_0xbe76('0x5')](config['redis'],{'host':_0xbe76('0x6'),'port':0x18eb});var io=require(_0xbe76('0x7'))(new Redis(config[_0xbe76('0x8')]));function closeInteractions(){var _0x11935b=0x0;var _0x30704b=[];return db[_0xbe76('0x9')][_0xbe76('0xa')]({'raw':!![],'attributes':['id',_0xbe76('0xb')],'where':{'id':0x1}})[_0xbe76('0xc')](function(_0x54cc1d){_0x11935b=_0x54cc1d[_0xbe76('0xb')];if(_0x11935b){return db[_0xbe76('0xd')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x54cc1d[_0xbe76('0xb')],'minutes')}}});}else{return[];}})[_0xbe76('0xc')](function(_0x37dc78){if(_0x37dc78&&_0x37dc78[_0xbe76('0xe')]){_0x30704b=_['map'](_0x37dc78||[],'id');logger[_0xbe76('0xf')](_0xbe76('0x10'),_0x30704b[_0xbe76('0x11')]());return db[_0xbe76('0xd')][_0xbe76('0x12')]({'closeReason':'system','disposition':_0xbe76('0x13'),'closed':!![],'closedAt':moment()[_0xbe76('0x14')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x30704b}});}})[_0xbe76('0xc')](function(){if(_0x30704b&&_0x30704b['length']){logger[_0xbe76('0xf')](_0xbe76('0x15'),_0x30704b[_0xbe76('0x11')]());for(var _0x223960=0x0;_0x223960<_0x30704b[_0xbe76('0xe')];_0x223960++){io[_0xbe76('0x16')]('chatInteraction:update',{'id':_0x30704b[_0x223960],'closed':!![]});}}})['catch'](function(_0x5104a4){logger['error'](_0xbe76('0x17'),_0x5104a4?util[_0xbe76('0x18')](_0x5104a4,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
index 6a2b4b5..9a93139 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x533f=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x533f,0x190));var _0xf533=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x533f[_0x3718b7];return _0xf8c91e;};'use strict';function start(){var _0x465a90=require(_0xf533('0x0'));return _0x465a90[_0xf533('0x1')]();}module['exports']={'intervals':{},'start':start};
\ No newline at end of file
+var _0xd574=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x4af6a4,_0x35f4d9){var _0x1fed3c=function(_0x142025){while(--_0x142025){_0x4af6a4['push'](_0x4af6a4['shift']());}};_0x1fed3c(++_0x35f4d9);}(_0xd574,0x1e8));var _0x4d57=function(_0x1b0e86,_0x33ec39){_0x1b0e86=_0x1b0e86-0x0;var _0xd85844=_0xd574[_0x1b0e86];return _0xd85844;};'use strict';function start(){var _0x157d70=require(_0x4d57('0x0'));return _0x157d70[_0x4d57('0x1')]();}module[_0x4d57('0x2')]={'intervals':{},'start':start};
\ No newline at end of file
index 25150b8..92c65b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x944e=['Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','email\x20sent','catch','data','isNil','subtractNumber','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','runReport','Schedule','findAll','CloudProvider','keys','jobs','map','toString','difference','intersection','length','exists','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','isBetween','endAt','start','add\x20cron','stop','deleteJob','stop\x20cron','startAt','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','MailAccount','Smtp','user','bcc','subtractUnit','join','savename','%s.%s','basename','existsSync','status','Sent','message','attachments','text'];(function(_0x122a34,_0x1ea0c5){var _0x3b526f=function(_0x3bf5dd){while(--_0x3bf5dd){_0x122a34['push'](_0x122a34['shift']());}};_0x3b526f(++_0x1ea0c5);}(_0x944e,0x89));var _0xe944=function(_0x1472fa,_0x889fe7){_0x1472fa=_0x1472fa-0x0;var _0x5a828e=_0x944e[_0x1472fa];return _0x5a828e;};'use strict';var fs=require('fs');var util=require(_0xe944('0x0'));var path=require(_0xe944('0x1'));var _=require(_0xe944('0x2'));var moment=require(_0xe944('0x3'));var CronJobManager=require(_0xe944('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0xe944('0x5'));var logger=require(_0xe944('0x6'))('schedule');var db=require(_0xe944('0x7'))['db'];var analyticCustomReportController=require(_0xe944('0x8'));var analyticDefaultReportController=require(_0xe944('0x9'));var client=jayson[_0xe944('0xa')][_0xe944('0xb')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4d7a01,_0x497d42){return function(){logger[_0xe944('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4d7a01[_0xe944('0xd')]);var _0x4cee26=!![];var _0x53fad0=_0x4d7a01['MailAccount'][_0xe944('0xe')]();var _0x5025b8={'account':_0x53fad0,'message':{'from':util[_0xe944('0xf')](_0xe944('0x10'),_0x4d7a01['MailAccount'][_0xe944('0x11')],_0x4d7a01[_0xe944('0x12')]['email']||_0x4d7a01[_0xe944('0x12')][_0xe944('0x13')][_0xe944('0x14')]),'to':_0x4d7a01[_0xe944('0xd')],'cc':_0x4d7a01['cc'],'bcc':_0x4d7a01[_0xe944('0x15')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x497d42[_0xe944('0x11')],_0x4d7a01['subtractNumber'],_0x4d7a01[_0xe944('0x16')])}};var _0x1d7412=path[_0xe944('0x17')](__dirname,'../../files/reports');var _0xd62635=_0x497d42[_0xe944('0x18')];var _0x26c046=util['format'](_0xe944('0x19'),path[_0xe944('0x1a')](_0x497d42['savename'],path['extname'](_0x497d42['savename'])),'zip');var _0x25b659=path[_0xe944('0x17')](_0x1d7412,_0xd62635);var _0x4f53e9=path[_0xe944('0x17')](_0x1d7412,_0x26c046);if(fs[_0xe944('0x1b')](_0x25b659)){_0x497d42[_0xe944('0x1c')]=_0xe944('0x1d');_0x5025b8[_0xe944('0x1e')][_0xe944('0x1f')]=[{'filename':_0xd62635,'path':_0x25b659}];_0x5025b8['message'][_0xe944('0x20')]=util[_0xe944('0xf')](_0xe944('0x21'),JSON[_0xe944('0x22')](_0x497d42,null,0x2));}else if(fs[_0xe944('0x1b')](_0x4f53e9)){_0x497d42['status']='Sent';_0x5025b8['message']['attachments']=[{'filename':_0x26c046,'path':_0x4f53e9}];}else{_0x5025b8[_0xe944('0x1e')][_0xe944('0x20')]=_0xe944('0x23');if(!_0x4d7a01[_0xe944('0x24')]){_0x4cee26=![];logger[_0xe944('0xc')](_0xe944('0x25'));}}if(_0x4cee26){return client[_0xe944('0x26')](_0xe944('0x27'),_0x5025b8)[_0xe944('0x28')](function(_0x4d1845){if(_0x4d1845[_0xe944('0x29')]){return logger['error'](_0xe944('0x2a'),JSON[_0xe944('0x22')](_0x4d1845));}return logger[_0xe944('0xc')](_0xe944('0x2b'));})[_0xe944('0x2c')](function(_0x1d0ae){return logger[_0xe944('0x29')]('error\x20mail',JSON[_0xe944('0x22')](_0x1d0ae));});}};}function handleError(){return function(_0x414f57){return logger[_0xe944('0x29')](JSON[_0xe944('0x22')](_0x414f57));};}function handleResult(_0x119f8a){return function(_0x5a3124){logger[_0xe944('0xc')](_0xe944('0x2d'),JSON[_0xe944('0x22')](_0x5a3124));if(_0x119f8a['MailAccount']&&_0x119f8a[_0xe944('0x12')][_0xe944('0x13')]&&!_['isNil'](_0x119f8a[_0xe944('0xd')])){setTimeout(handleSendEmail(_0x119f8a,_0x5a3124),0x3c*0x3e8);}};}function handleJob(_0x3e7df3){return function(){try{if(_[_0xe944('0x2e')](_0x3e7df3[_0xe944('0x2f')])){return logger['info'](_0xe944('0x30'));}if(_[_0xe944('0x2e')](_0x3e7df3['subtractUnit'])){return logger['info'](_0xe944('0x31'));}var _0x239720={'startDate':moment()[_0xe944('0x32')](_0x3e7df3[_0xe944('0x2f')],_0x3e7df3['subtractUnit'])['format'](_0xe944('0x33')),'endDate':moment()[_0xe944('0xf')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0xe944('0x34'),'output':_0x3e7df3[_0xe944('0x35')],'name':_0x3e7df3['name']};if(!_['isNil'](_0x3e7df3[_0xe944('0x36')])){logger[_0xe944('0xc')](_0xe944('0x37'),_0x3e7df3[_0xe944('0x36')]);return analyticDefaultReportController['runReport']({'id':_0x3e7df3['DefaultReportId']},_0x239720)[_0xe944('0x28')](handleResult(_0x3e7df3))['catch'](handleError());}if(!_[_0xe944('0x2e')](_0x3e7df3[_0xe944('0x38')])){logger[_0xe944('0xc')]('exec\x20custom\x20report\x20id:%s',_0x3e7df3[_0xe944('0x38')]);return analyticCustomReportController[_0xe944('0x39')]({'id':_0x3e7df3['CustomReportId']},_0x239720)['then'](handleResult(_0x3e7df3))['catch'](handleError());}}catch(_0x119bff){logger[_0xe944('0x29')](JSON[_0xe944('0x22')](_0x119bff));}return logger[_0xe944('0xc')]('no\x20report\x20id');};}function getJobs(_0x21e6e4){var _0x129580={};if(_0x21e6e4){_0x129580['id']=_0x21e6e4;}return db[_0xe944('0x3a')][_0xe944('0x3b')]({'where':_0x129580,'include':[{'model':db[_0xe944('0x12')],'attributes':['id',_0xe944('0x11'),'email'],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0xe944('0x3c')],'as':_0xe944('0x3c')}]}]}]})[_0xe944('0x28')](function(_0x1cc930){var _0x1f8a8f=_[_0xe944('0x3d')](manager[_0xe944('0x3e')]);var _0x3a70d9=_[_0xe944('0x3f')](_0x1cc930,function(_0x5c3c7e){return _0x5c3c7e['id'][_0xe944('0x40')]();});var _0x290675=_['keyBy'](_0x1cc930,function(_0x1a8a08){return _0x1a8a08['id'][_0xe944('0x40')]();});var _0xf8dc90=_0x21e6e4?_0x3a70d9:_[_0xe944('0x41')](_0x3a70d9,_0x1f8a8f);var _0x3f4d0f=_[_0xe944('0x42')](_0x3a70d9,_0x1f8a8f);var _0x4f598d=_['difference'](_0x1f8a8f,_0x3a70d9);var _0x5d2553;var _0x51b18e;for(_0x5d2553=0x0;_0x5d2553<_0x4f598d[_0xe944('0x43')]&&!_0x21e6e4;_0x5d2553+=0x1){_0x51b18e=_0x4f598d[_0x5d2553]['toString']();if(manager[_0xe944('0x44')](_0x51b18e)){manager['stop'](_0x51b18e);manager['deleteJob'](_0x51b18e);logger[_0xe944('0xc')](_0xe944('0x45'),_0x51b18e);}}logger[_0xe944('0xc')](_0xe944('0x46'),JSON[_0xe944('0x22')](_0xf8dc90));for(_0x5d2553=0x0;_0x5d2553<_0xf8dc90['length'];_0x5d2553+=0x1){_0x51b18e=_0xf8dc90[_0x5d2553][_0xe944('0x40')]();logger[_0xe944('0xc')](_0xe944('0x47'),_0x51b18e);if(_0x21e6e4){logger[_0xe944('0xc')](_0xe944('0x48'),_0x21e6e4);logger['info'](JSON['stringify'](_0x290675[_0x51b18e]));BPromise['resolve']()[_0xe944('0x28')](handleJob(_0x290675[_0x51b18e]));logger[_0xe944('0xc')](_0xe944('0x49'),_0x290675[_0x51b18e]['name'],_0x290675[_0x51b18e]['cron']);}else if(_0x290675[_0x51b18e][_0xe944('0x4a')]&&_0x290675[_0x51b18e]['active']&&moment()[_0xe944('0x4b')](_0x290675[_0x51b18e]['startAt'],_0x290675[_0x51b18e][_0xe944('0x4c')])){manager['add'](_0x51b18e,_0x290675[_0x51b18e][_0xe944('0x4a')],handleJob(_0x290675[_0x51b18e]));manager[_0xe944('0x4d')](_0x51b18e);logger['info'](_0xe944('0x4e'),_0x290675[_0x51b18e]['name'],_0x290675[_0x51b18e][_0xe944('0x4a')]);}else if(manager[_0xe944('0x44')](_0x51b18e)){manager[_0xe944('0x4f')](_0x51b18e);manager[_0xe944('0x50')](_0x51b18e);logger['info'](_0xe944('0x51'),_0x290675[_0x51b18e][_0xe944('0x11')],_0x290675[_0x51b18e][_0xe944('0x4a')]);}}for(_0x5d2553=0x0,_0x51b18e;_0x5d2553<_0x3f4d0f['length']&&!_0x21e6e4;_0x5d2553+=0x1){_0x51b18e=_0x3f4d0f[_0x5d2553][_0xe944('0x40')]();if(manager[_0xe944('0x44')](_0x51b18e)){if(_0x290675[_0x51b18e][_0xe944('0x4a')]&&_0x290675[_0x51b18e]['active']&&moment()[_0xe944('0x4b')](_0x290675[_0x51b18e][_0xe944('0x52')],_0x290675[_0x51b18e][_0xe944('0x4c')])){manager['update'](_0x51b18e,_0x290675[_0x51b18e][_0xe944('0x4a')],handleJob(_0x290675[_0x51b18e]));logger['info'](_0xe944('0x53'),_0x290675[_0x51b18e][_0xe944('0x11')],_0x290675[_0x51b18e][_0xe944('0x4a')]);}else{manager[_0xe944('0x4f')](_0x51b18e);manager[_0xe944('0x50')](_0x51b18e);logger[_0xe944('0xc')](_0xe944('0x51'),_0x290675[_0x51b18e][_0xe944('0x11')],_0x290675[_0x51b18e][_0xe944('0x4a')]);}}}})[_0xe944('0x2c')](function(_0x2f27e5){logger['error'](JSON[_0xe944('0x22')](_0x2f27e5));});}exports[_0xe944('0x54')]=function(_0x2db13b){return getJobs(_0x2db13b);};exports[_0xe944('0x4d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
+var _0x2b06=['MailAccount','\x22%s\x22\x20<%s>','email','Smtp','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','savename','%s.%s','basename','extname','zip','join','existsSync','status','Sent','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','SendMail','then','error','error\x20mail','stringify','email\x20sent','data','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','MailServerOut','CloudProvider','keys','map','keyBy','toString','difference','exists','stop','deleteJob','delete\x20cron','toRun','length','index','my\x20id','resolve','run\x20job','startAt','endAt','add','add\x20cron','stop\x20cron','cron','active','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','info'];(function(_0x2d8e64,_0x4327e8){var _0x38bd9b=function(_0x3e2587){while(--_0x3e2587){_0x2d8e64['push'](_0x2d8e64['shift']());}};_0x38bd9b(++_0x4327e8);}(_0x2b06,0xf8));var _0x62b0=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0x2b06[_0x540160];return _0x476120;};'use strict';var fs=require('fs');var util=require(_0x62b0('0x0'));var path=require(_0x62b0('0x1'));var _=require(_0x62b0('0x2'));var moment=require(_0x62b0('0x3'));var CronJobManager=require(_0x62b0('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x62b0('0x5'));var logger=require(_0x62b0('0x6'))(_0x62b0('0x7'));var db=require(_0x62b0('0x8'))['db'];var analyticCustomReportController=require(_0x62b0('0x9'));var analyticDefaultReportController=require(_0x62b0('0xa'));var client=jayson[_0x62b0('0xb')]['http']({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4527f1,_0x35197b){return function(){logger[_0x62b0('0xc')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x4527f1['email']);var _0x3ebac3=!![];var _0x180b69=_0x4527f1[_0x62b0('0xd')]['getSmtpOptions']();var _0x5276ed={'account':_0x180b69,'message':{'from':util['format'](_0x62b0('0xe'),_0x4527f1['MailAccount']['name'],_0x4527f1['MailAccount'][_0x62b0('0xf')]||_0x4527f1['MailAccount'][_0x62b0('0x10')]['user']),'to':_0x4527f1[_0x62b0('0xf')],'cc':_0x4527f1['cc'],'bcc':_0x4527f1['bcc'],'subject':util[_0x62b0('0x11')](_0x62b0('0x12'),_0x35197b[_0x62b0('0x13')],_0x4527f1[_0x62b0('0x14')],_0x4527f1[_0x62b0('0x15')])}};var _0x466ea5=path['join'](__dirname,'../../files/reports');var _0x3310c8=_0x35197b[_0x62b0('0x16')];var _0x5a614f=util[_0x62b0('0x11')](_0x62b0('0x17'),path[_0x62b0('0x18')](_0x35197b[_0x62b0('0x16')],path[_0x62b0('0x19')](_0x35197b['savename'])),_0x62b0('0x1a'));var _0x3fdd2e=path[_0x62b0('0x1b')](_0x466ea5,_0x3310c8);var _0x3f94c1=path[_0x62b0('0x1b')](_0x466ea5,_0x5a614f);if(fs[_0x62b0('0x1c')](_0x3fdd2e)){_0x35197b[_0x62b0('0x1d')]=_0x62b0('0x1e');_0x5276ed[_0x62b0('0x1f')][_0x62b0('0x20')]=[{'filename':_0x3310c8,'path':_0x3fdd2e}];_0x5276ed[_0x62b0('0x1f')][_0x62b0('0x21')]=util[_0x62b0('0x11')](_0x62b0('0x22'),JSON['stringify'](_0x35197b,null,0x2));}else if(fs[_0x62b0('0x1c')](_0x3f94c1)){_0x35197b[_0x62b0('0x1d')]=_0x62b0('0x1e');_0x5276ed[_0x62b0('0x1f')][_0x62b0('0x20')]=[{'filename':_0x5a614f,'path':_0x3f94c1}];}else{_0x5276ed[_0x62b0('0x1f')]['text']=_0x62b0('0x23');if(!_0x4527f1[_0x62b0('0x24')]){_0x3ebac3=![];logger[_0x62b0('0xc')](_0x62b0('0x25'));}}if(_0x3ebac3){return client['request'](_0x62b0('0x26'),_0x5276ed)[_0x62b0('0x27')](function(_0x1cbf9c){if(_0x1cbf9c[_0x62b0('0x28')]){return logger[_0x62b0('0x28')](_0x62b0('0x29'),JSON[_0x62b0('0x2a')](_0x1cbf9c));}return logger[_0x62b0('0xc')](_0x62b0('0x2b'));})['catch'](function(_0x39895f){return logger[_0x62b0('0x28')](_0x62b0('0x29'),JSON[_0x62b0('0x2a')](_0x39895f));});}};}function handleError(){return function(_0x12ac0e){return logger[_0x62b0('0x28')](JSON[_0x62b0('0x2a')](_0x12ac0e));};}function handleResult(_0x3b985d){return function(_0x4d7c9d){logger['info'](_0x62b0('0x2c'),JSON[_0x62b0('0x2a')](_0x4d7c9d));if(_0x3b985d[_0x62b0('0xd')]&&_0x3b985d[_0x62b0('0xd')][_0x62b0('0x10')]&&!_[_0x62b0('0x2d')](_0x3b985d[_0x62b0('0xf')])){setTimeout(handleSendEmail(_0x3b985d,_0x4d7c9d),0x3c*0x3e8);}};}function handleJob(_0x597dd3){return function(){try{if(_[_0x62b0('0x2d')](_0x597dd3[_0x62b0('0x14')])){return logger[_0x62b0('0xc')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x62b0('0x2d')](_0x597dd3['subtractUnit'])){return logger[_0x62b0('0xc')](_0x62b0('0x2e'));}var _0x4fd546={'startDate':moment()[_0x62b0('0x2f')](_0x597dd3[_0x62b0('0x14')],_0x597dd3[_0x62b0('0x15')])[_0x62b0('0x11')](_0x62b0('0x30')),'endDate':moment()[_0x62b0('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x62b0('0x31'),'output':_0x597dd3[_0x62b0('0x32')],'name':_0x597dd3['name']};if(!_[_0x62b0('0x2d')](_0x597dd3[_0x62b0('0x33')])){logger[_0x62b0('0xc')](_0x62b0('0x34'),_0x597dd3[_0x62b0('0x33')]);return analyticDefaultReportController[_0x62b0('0x35')]({'id':_0x597dd3['DefaultReportId']},_0x4fd546)['then'](handleResult(_0x597dd3))[_0x62b0('0x36')](handleError());}if(!_[_0x62b0('0x2d')](_0x597dd3[_0x62b0('0x37')])){logger[_0x62b0('0xc')](_0x62b0('0x38'),_0x597dd3[_0x62b0('0x37')]);return analyticCustomReportController[_0x62b0('0x35')]({'id':_0x597dd3['CustomReportId']},_0x4fd546)[_0x62b0('0x27')](handleResult(_0x597dd3))[_0x62b0('0x36')](handleError());}}catch(_0x34b97a){logger['error'](JSON[_0x62b0('0x2a')](_0x34b97a));}return logger[_0x62b0('0xc')](_0x62b0('0x39'));};}function getJobs(_0x3801b8){var _0x2a1d24={};if(_0x3801b8){_0x2a1d24['id']=_0x3801b8;}return db[_0x62b0('0x3a')]['findAll']({'where':_0x2a1d24,'include':[{'model':db[_0x62b0('0xd')],'attributes':['id',_0x62b0('0x13'),'email'],'include':[{'model':db[_0x62b0('0x3b')],'as':_0x62b0('0x10'),'include':[{'model':db[_0x62b0('0x3c')],'as':_0x62b0('0x3c')}]}]}]})[_0x62b0('0x27')](function(_0x22f797){var _0x43d88b=_[_0x62b0('0x3d')](manager['jobs']);var _0x5c06bb=_[_0x62b0('0x3e')](_0x22f797,function(_0x3c6e6f){return _0x3c6e6f['id']['toString']();});var _0x2beffc=_[_0x62b0('0x3f')](_0x22f797,function(_0x1acaa5){return _0x1acaa5['id'][_0x62b0('0x40')]();});var _0x21f034=_0x3801b8?_0x5c06bb:_[_0x62b0('0x41')](_0x5c06bb,_0x43d88b);var _0x3388e8=_['intersection'](_0x5c06bb,_0x43d88b);var _0x167331=_[_0x62b0('0x41')](_0x43d88b,_0x5c06bb);var _0x5a4f90;var _0x1035b0;for(_0x5a4f90=0x0;_0x5a4f90<_0x167331['length']&&!_0x3801b8;_0x5a4f90+=0x1){_0x1035b0=_0x167331[_0x5a4f90]['toString']();if(manager[_0x62b0('0x42')](_0x1035b0)){manager[_0x62b0('0x43')](_0x1035b0);manager[_0x62b0('0x44')](_0x1035b0);logger[_0x62b0('0xc')](_0x62b0('0x45'),_0x1035b0);}}logger[_0x62b0('0xc')](_0x62b0('0x46'),JSON['stringify'](_0x21f034));for(_0x5a4f90=0x0;_0x5a4f90<_0x21f034[_0x62b0('0x47')];_0x5a4f90+=0x1){_0x1035b0=_0x21f034[_0x5a4f90][_0x62b0('0x40')]();logger[_0x62b0('0xc')](_0x62b0('0x48'),_0x1035b0);if(_0x3801b8){logger[_0x62b0('0xc')](_0x62b0('0x49'),_0x3801b8);logger[_0x62b0('0xc')](JSON[_0x62b0('0x2a')](_0x2beffc[_0x1035b0]));BPromise[_0x62b0('0x4a')]()[_0x62b0('0x27')](handleJob(_0x2beffc[_0x1035b0]));logger[_0x62b0('0xc')](_0x62b0('0x4b'),_0x2beffc[_0x1035b0][_0x62b0('0x13')],_0x2beffc[_0x1035b0]['cron']);}else if(_0x2beffc[_0x1035b0]['cron']&&_0x2beffc[_0x1035b0]['active']&&moment()['isBetween'](_0x2beffc[_0x1035b0][_0x62b0('0x4c')],_0x2beffc[_0x1035b0][_0x62b0('0x4d')])){manager[_0x62b0('0x4e')](_0x1035b0,_0x2beffc[_0x1035b0]['cron'],handleJob(_0x2beffc[_0x1035b0]));manager['start'](_0x1035b0);logger[_0x62b0('0xc')](_0x62b0('0x4f'),_0x2beffc[_0x1035b0]['name'],_0x2beffc[_0x1035b0]['cron']);}else if(manager[_0x62b0('0x42')](_0x1035b0)){manager['stop'](_0x1035b0);manager[_0x62b0('0x44')](_0x1035b0);logger[_0x62b0('0xc')](_0x62b0('0x50'),_0x2beffc[_0x1035b0][_0x62b0('0x13')],_0x2beffc[_0x1035b0][_0x62b0('0x51')]);}}for(_0x5a4f90=0x0,_0x1035b0;_0x5a4f90<_0x3388e8[_0x62b0('0x47')]&&!_0x3801b8;_0x5a4f90+=0x1){_0x1035b0=_0x3388e8[_0x5a4f90][_0x62b0('0x40')]();if(manager[_0x62b0('0x42')](_0x1035b0)){if(_0x2beffc[_0x1035b0][_0x62b0('0x51')]&&_0x2beffc[_0x1035b0][_0x62b0('0x52')]&&moment()['isBetween'](_0x2beffc[_0x1035b0][_0x62b0('0x4c')],_0x2beffc[_0x1035b0][_0x62b0('0x4d')])){manager[_0x62b0('0x53')](_0x1035b0,_0x2beffc[_0x1035b0][_0x62b0('0x51')],handleJob(_0x2beffc[_0x1035b0]));logger[_0x62b0('0xc')](_0x62b0('0x54'),_0x2beffc[_0x1035b0][_0x62b0('0x13')],_0x2beffc[_0x1035b0]['cron']);}else{manager[_0x62b0('0x43')](_0x1035b0);manager[_0x62b0('0x44')](_0x1035b0);logger['info'](_0x62b0('0x50'),_0x2beffc[_0x1035b0]['name'],_0x2beffc[_0x1035b0][_0x62b0('0x51')]);}}}})[_0x62b0('0x36')](function(_0x1da8a2){logger[_0x62b0('0x28')](JSON['stringify'](_0x1da8a2));});}exports[_0x62b0('0x55')]=function(_0x284aed){return getJobs(_0x284aed);};exports[_0x62b0('0x56')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();};
\ No newline at end of file
index 211354a..eaf0651 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc901=['results','transcripts','length','fileText','transcript','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','language','SentimentScore','Negative','FAILED','update','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Cloud\x20Provider\x20not\x20available','Mixed','Neutral','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','forEach','push','all','catch','start','lodash','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','substring','info','format','transcribeName','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','TranscriptionJob','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded'];(function(_0x26914e,_0x517b77){var _0xb66106=function(_0x5d3845){while(--_0x5d3845){_0x26914e['push'](_0x26914e['shift']());}};_0xb66106(++_0x517b77);}(_0xc901,0x142));var _0x1c90=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc901[_0x42cae2];return _0x5f256f;};var _=require(_0x1c90('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x1c90('0x1'))['db'];var logger=require(_0x1c90('0x2'))('transcribe');function getTranscriptionJob(_0x197c65,_0x317443,_0x3dcf02,_0x2eff92){return new Promise(function(_0x1c9021,_0x14eb4f){var _0x912860=new AWS[(_0x1c90('0x3'))]({'accessKeyId':_0x317443,'secretAccessKey':_0x197c65,'region':_0x3dcf02});_0x912860[_0x1c90('0x4')]({'TranscriptionJobName':_0x2eff92},function(_0x19196f,_0x514386){if(_0x19196f){return _0x14eb4f(_0x19196f);}else{return _0x1c9021(_0x514386);}});});}function sentiment(_0x1edcae,_0x1aa173,_0x38cd18,_0x1f2c61,_0x374852){return new Promise(function(_0x66c02,_0x616ad0){var _0x3890e1=new AWS['Comprehend']({'accessKeyId':_0x1aa173,'secretAccessKey':_0x1edcae,'region':_0x38cd18});_0x3890e1['detectSentiment']({'Text':_0x1f2c61,'LanguageCode':_0x374852[_0x1c90('0x5')](0x0,0x2)},function(_0x35598a,_0x327610){if(_0x35598a){return _0x616ad0(_0x35598a);}else{return _0x66c02(_0x327610);}});});}function checkTranscribeJob(_0x4addeb,_0x4da158,_0x3a38ed){var _0x3353e3;return new BPromise(function(_0x5e0f69,_0x23f69f){logger[_0x1c90('0x6')](util[_0x1c90('0x7')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x4addeb['id'],_0x4addeb[_0x1c90('0x8')]));return getTranscriptionJob(_0x3a38ed['data1'],_0x3a38ed[_0x1c90('0x9')],_0x4da158[_0x1c90('0xa')],_0x4addeb[_0x1c90('0x8')])[_0x1c90('0xb')](function(_0x48bd5e){logger[_0x1c90('0x6')](util['format'](_0x1c90('0xc'),_0x4addeb['id'],_0x4addeb[_0x1c90('0x8')],_0x48bd5e['TranscriptionJob'][_0x1c90('0xd')]));if(!_0x4addeb['fileText']){switch(_0x48bd5e['TranscriptionJob'][_0x1c90('0xd')]){case'COMPLETED':var _0x341228={'transcribeStatus':_0x48bd5e[_0x1c90('0xe')][_0x1c90('0xd')],'fileUri':_0x48bd5e[_0x1c90('0xe')]['Transcript'][_0x1c90('0xf')]};logger['info'](util['format'](_0x1c90('0x10'),_0x4addeb['id']));return rp({'uri':_0x48bd5e[_0x1c90('0xe')]['Transcript'][_0x1c90('0xf')],'json':!![]})[_0x1c90('0xb')](function(_0x445664){logger[_0x1c90('0x6')](util[_0x1c90('0x7')](_0x1c90('0x11'),_0x4addeb['id']));if(_0x445664&&_0x445664['results']&&_0x445664[_0x1c90('0x12')][_0x1c90('0x13')]&&_0x445664[_0x1c90('0x12')][_0x1c90('0x13')][_0x1c90('0x14')]){_0x341228[_0x1c90('0x15')]='';for(var _0x4c3bb0=0x0;_0x4c3bb0<_0x445664['results'][_0x1c90('0x13')][_0x1c90('0x14')];_0x4c3bb0++){_0x341228[_0x1c90('0x15')]+=_0x445664['results'][_0x1c90('0x13')][_0x4c3bb0][_0x1c90('0x16')]+'';}}return _0x4addeb['update'](_0x341228);})[_0x1c90('0xb')](function(){logger[_0x1c90('0x6')](util['format'](_0x1c90('0x17'),_0x4addeb['id']));if(!_0x4addeb[_0x1c90('0x18')]){throw new db[(_0x1c90('0x19'))][(_0x1c90('0x1a'))](_0x1c90('0x1b'));}if(!_0x4da158[_0x1c90('0x1c')]||!_0x4da158[_0x1c90('0x1d')]||!_0x4da158[_0x1c90('0x1e')]||!_0x4da158['language']||!_0x4da158[_0x1c90('0x1f')]){throw new db[(_0x1c90('0x19'))][(_0x1c90('0x1a'))](_0x1c90('0x20'));}if(!_0x341228[_0x1c90('0x15')]){throw new Error(_0x1c90('0x21'));}if(_0x4da158[_0x1c90('0x1d')]===_0x3a38ed['id']){return _0x3a38ed;}else{return db[_0x1c90('0x22')][_0x1c90('0x23')]({'where':{'id':_settings[_0x1c90('0x1d')]}});}})[_0x1c90('0xb')](function(_0x4dbe4a){if(!_0x4dbe4a){throw new db[(_0x1c90('0x19'))][(_0x1c90('0x1a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x4dbe4a[_0x1c90('0x24')]||!_0x4dbe4a['data2']){throw new db[(_0x1c90('0x19'))]['ValidationError'](_0x1c90('0x25'));}_0x3353e3=_0x4dbe4a;logger['info'](util[_0x1c90('0x7')](_0x1c90('0x26'),_0x4addeb['id']));return sentiment(_0x3353e3['data1'],_0x3353e3[_0x1c90('0x9')],_0x4da158[_0x1c90('0x1e')],_0x341228['fileText'],_0x4da158[_0x1c90('0x27')]);})[_0x1c90('0xb')](function(_0x99cda1){logger[_0x1c90('0x6')](util[_0x1c90('0x7')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4addeb['id']));return _0x4addeb['update']({'sentiment':_0x99cda1['Sentiment'],'sPositive':_0x99cda1['SentimentScore']['Positive'],'sNegative':_0x99cda1[_0x1c90('0x28')][_0x1c90('0x29')],'sMixed':_0x99cda1[_0x1c90('0x28')]['Mixed'],'sNeutral':_0x99cda1[_0x1c90('0x28')]['Neutral']});})[_0x1c90('0xb')](function(){logger[_0x1c90('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4addeb['id']));_0x5e0f69();});case _0x1c90('0x2a'):return _0x4addeb[_0x1c90('0x2b')]({'transcribeStatus':_0x1c90('0x2a'),'failureReason':_0x48bd5e[_0x1c90('0xe')][_0x1c90('0x2c')]})[_0x1c90('0xb')](function(){logger[_0x1c90('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4addeb['id']));_0x5e0f69();});default:logger[_0x1c90('0x6')](util[_0x1c90('0x7')](_0x1c90('0x2d'),_0x4addeb['id']));break;}}else{return BPromise[_0x1c90('0x2e')]()[_0x1c90('0xb')](function(){if(!_0x4addeb[_0x1c90('0x18')]){throw new db[(_0x1c90('0x19'))][(_0x1c90('0x1a'))](_0x1c90('0x1b'));}if(!_0x4da158[_0x1c90('0x1c')]||!_0x4da158['sentimentAccountId']||!_0x4da158[_0x1c90('0x1e')]||!_0x4da158['language']||!_0x4da158['bucket']){throw new db[(_0x1c90('0x19'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x4addeb[_0x1c90('0x15')]){throw new Error(_0x1c90('0x21'));}if(_0x4da158['sentimentAccountId']===_0x3a38ed['id']){return _0x3a38ed;}else{return db[_0x1c90('0x22')][_0x1c90('0x23')]({'where':{'id':_settings[_0x1c90('0x1d')]}});}})[_0x1c90('0xb')](function(_0x59ca45){if(!_0x59ca45){throw new db['Sequelize'][(_0x1c90('0x1a'))](_0x1c90('0x2f'));}if(!_0x59ca45['data1']||!_0x59ca45[_0x1c90('0x9')]){throw new db['Sequelize'][(_0x1c90('0x1a'))](_0x1c90('0x25'));}_0x3353e3=_0x59ca45;logger['info'](util[_0x1c90('0x7')](_0x1c90('0x26'),_0x4addeb['id']));return sentiment(_0x3353e3[_0x1c90('0x24')],_0x3353e3[_0x1c90('0x9')],_0x4da158[_0x1c90('0x1e')],_0x4addeb[_0x1c90('0x15')],_0x4da158[_0x1c90('0x27')]);})[_0x1c90('0xb')](function(_0x2f7de7){logger[_0x1c90('0x6')](util[_0x1c90('0x7')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x4addeb['id']));return _0x4addeb[_0x1c90('0x2b')]({'sentiment':_0x2f7de7['Sentiment'],'sPositive':_0x2f7de7[_0x1c90('0x28')]['Positive'],'sNegative':_0x2f7de7['SentimentScore'][_0x1c90('0x29')],'sMixed':_0x2f7de7[_0x1c90('0x28')][_0x1c90('0x30')],'sNeutral':_0x2f7de7[_0x1c90('0x28')][_0x1c90('0x31')],'transcribeStatus':_0x1c90('0x32')});})[_0x1c90('0xb')](function(){logger[_0x1c90('0x6')](util[_0x1c90('0x7')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x4addeb['id']));_0x5e0f69();});}})['catch'](function(_0x20f299){if(_0x20f299){if(!_0x20f299[_0x1c90('0x33')]||_0x20f299[_0x1c90('0x33')]!==_0x1c90('0x34')){logger[_0x1c90('0x35')](util[_0x1c90('0x7')](_0x1c90('0x36'),_0x4addeb['id']),util[_0x1c90('0x37')](_0x20f299,{'showHidden':![],'depth':null}));}}_0x5e0f69();});});}function checkTranscribe(){var _0x5d7cac;var _0x2074d7;var _0x24016a;return db[_0x1c90('0x38')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x1c90('0xb')](function(_0x5e21f9){if(!_0x5e21f9||!_0x5e21f9[_0x1c90('0x14')]){throw new db['Sequelize']['ValidationError'](_0x1c90('0x39'));}_0x5d7cac=_0x5e21f9;return db[_0x1c90('0x3a')]['findOne']({'where':{'id':0x1}});})['then'](function(_0x394177){if(!_0x394177){throw new db['Sequelize'][(_0x1c90('0x1a'))](_0x1c90('0x3b'));}_0x2074d7=_0x394177;if(!_0x2074d7[_0x1c90('0x3c')]||!_0x2074d7[_0x1c90('0x3d')]||!_0x2074d7['transcribeRegion']||!_0x2074d7['language']||!_0x2074d7['bucket']){throw new db[(_0x1c90('0x19'))]['ValidationError'](_0x1c90('0x3e'));}return db[_0x1c90('0x22')]['findOne']({'where':{'id':_0x2074d7[_0x1c90('0x3d')]}});})['then'](function(_0x30ed2a){if(!_0x30ed2a){throw new db['Sequelize'][(_0x1c90('0x1a'))](_0x1c90('0x2f'));}if(!_0x30ed2a[_0x1c90('0x24')]||!_0x30ed2a[_0x1c90('0x9')]){throw new db['Sequelize'][(_0x1c90('0x1a'))](_0x1c90('0x25'));}_0x24016a=_0x30ed2a;var _0x30b293=[];_0x5d7cac[_0x1c90('0x3f')](function(_0x4e170e){_0x30b293[_0x1c90('0x40')](checkTranscribeJob(_0x4e170e,_0x2074d7,_0x24016a));});return BPromise[_0x1c90('0x41')](_0x30b293);})[_0x1c90('0x42')](function(_0x1329cb){if(_0x1329cb){if(!_0x1329cb['name']||_0x1329cb[_0x1c90('0x33')]!==_0x1c90('0x34')){logger['error'](util[_0x1c90('0x37')](_0x1329cb,{'showHidden':![],'depth':null}));}}});}exports[_0x1c90('0x43')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
+var _0x30d3=['inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','catch','start','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','Comprehend','detectSentiment','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeRegion','transcribeName','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','Transcript','TranscriptFileUri','info','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','fileText','length','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','sentimentRegion','update','Sentiment','SentimentScore','Mixed','Neutral','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','Negative','COMPLETED','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30d3,0x9f));var _0x330d=function(_0x3db43e,_0x25c9b9){_0x3db43e=_0x3db43e-0x0;var _0x2d7e82=_0x30d3[_0x3db43e];return _0x2d7e82;};var _=require('lodash');var AWS=require('aws-sdk');var rp=require(_0x330d('0x0'));var util=require(_0x330d('0x1'));var BPromise=require(_0x330d('0x2'));var db=require(_0x330d('0x3'))['db'];var logger=require(_0x330d('0x4'))(_0x330d('0x5'));function getTranscriptionJob(_0x447dbb,_0x51cee8,_0x37fe02,_0x3b3165){return new Promise(function(_0xd8503,_0x2a330f){var _0x5ee451=new AWS['TranscribeService']({'accessKeyId':_0x51cee8,'secretAccessKey':_0x447dbb,'region':_0x37fe02});_0x5ee451[_0x330d('0x6')]({'TranscriptionJobName':_0x3b3165},function(_0x410a37,_0x1342e7){if(_0x410a37){return _0x2a330f(_0x410a37);}else{return _0xd8503(_0x1342e7);}});});}function sentiment(_0x432840,_0x53bc72,_0x5f137f,_0x22a8ba,_0x151f9a){return new Promise(function(_0x39d171,_0x340980){var _0x2eb0bc=new AWS[(_0x330d('0x7'))]({'accessKeyId':_0x53bc72,'secretAccessKey':_0x432840,'region':_0x5f137f});_0x2eb0bc[_0x330d('0x8')]({'Text':_0x22a8ba,'LanguageCode':_0x151f9a['substring'](0x0,0x2)},function(_0x3b8feb,_0x548353){if(_0x3b8feb){return _0x340980(_0x3b8feb);}else{return _0x39d171(_0x548353);}});});}function checkTranscribeJob(_0x1ad0ee,_0x55eb0e,_0x416b93){var _0xb093cd;return new BPromise(function(_0x3a0f89,_0x20c90f){logger['info'](util[_0x330d('0x9')](_0x330d('0xa'),_0x1ad0ee['id'],_0x1ad0ee['transcribeName']));return getTranscriptionJob(_0x416b93[_0x330d('0xb')],_0x416b93['data2'],_0x55eb0e[_0x330d('0xc')],_0x1ad0ee[_0x330d('0xd')])[_0x330d('0xe')](function(_0x5e5baf){logger['info'](util[_0x330d('0x9')](_0x330d('0xf'),_0x1ad0ee['id'],_0x1ad0ee[_0x330d('0xd')],_0x5e5baf['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x1ad0ee['fileText']){switch(_0x5e5baf[_0x330d('0x10')]['TranscriptionJobStatus']){case'COMPLETED':var _0x435083={'transcribeStatus':_0x5e5baf[_0x330d('0x10')]['TranscriptionJobStatus'],'fileUri':_0x5e5baf[_0x330d('0x10')][_0x330d('0x11')][_0x330d('0x12')]};logger[_0x330d('0x13')](util[_0x330d('0x9')]('[RECORDING:%d]\x20Get\x20transcript',_0x1ad0ee['id']));return rp({'uri':_0x5e5baf['TranscriptionJob'][_0x330d('0x11')]['TranscriptFileUri'],'json':!![]})[_0x330d('0xe')](function(_0x2e876b){logger[_0x330d('0x13')](util['format'](_0x330d('0x14'),_0x1ad0ee['id']));if(_0x2e876b&&_0x2e876b[_0x330d('0x15')]&&_0x2e876b['results']['transcripts']&&_0x2e876b[_0x330d('0x15')][_0x330d('0x16')]['length']){_0x435083[_0x330d('0x17')]='';for(var _0x19c2f2=0x0;_0x19c2f2<_0x2e876b['results']['transcripts'][_0x330d('0x18')];_0x19c2f2++){_0x435083[_0x330d('0x17')]+=_0x2e876b[_0x330d('0x15')][_0x330d('0x16')][_0x19c2f2][_0x330d('0x19')]+'';}}return _0x1ad0ee['update'](_0x435083);})['then'](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x1ad0ee['id']));if(!_0x1ad0ee[_0x330d('0x1a')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x1d'));}if(!_0x55eb0e[_0x330d('0x1e')]||!_0x55eb0e[_0x330d('0x1f')]||!_0x55eb0e['sentimentRegion']||!_0x55eb0e[_0x330d('0x20')]||!_0x55eb0e['bucket']){throw new db['Sequelize'][(_0x330d('0x1c'))](_0x330d('0x21'));}if(!_0x435083[_0x330d('0x17')]){throw new Error(_0x330d('0x22'));}if(_0x55eb0e[_0x330d('0x1f')]===_0x416b93['id']){return _0x416b93;}else{return db[_0x330d('0x23')][_0x330d('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x330d('0xe')](function(_0xe071ff){if(!_0xe071ff){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0xe071ff[_0x330d('0xb')]||!_0xe071ff[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0xb093cd=_0xe071ff;logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x28'),_0x1ad0ee['id']));return sentiment(_0xb093cd['data1'],_0xb093cd['data2'],_0x55eb0e[_0x330d('0x29')],_0x435083[_0x330d('0x17')],_0x55eb0e[_0x330d('0x20')]);})[_0x330d('0xe')](function(_0x456431){logger[_0x330d('0x13')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x1ad0ee['id']));return _0x1ad0ee[_0x330d('0x2a')]({'sentiment':_0x456431[_0x330d('0x2b')],'sPositive':_0x456431[_0x330d('0x2c')]['Positive'],'sNegative':_0x456431[_0x330d('0x2c')]['Negative'],'sMixed':_0x456431[_0x330d('0x2c')][_0x330d('0x2d')],'sNeutral':_0x456431[_0x330d('0x2c')][_0x330d('0x2e')]});})[_0x330d('0xe')](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});case _0x330d('0x30'):return _0x1ad0ee[_0x330d('0x2a')]({'transcribeStatus':_0x330d('0x30'),'failureReason':_0x5e5baf[_0x330d('0x10')]['FailureReason']})['then'](function(){logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});default:logger[_0x330d('0x13')](util[_0x330d('0x9')](_0x330d('0x31'),_0x1ad0ee['id']));break;}}else{return BPromise[_0x330d('0x32')]()[_0x330d('0xe')](function(){if(!_0x1ad0ee['tempSentiment']){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x55eb0e[_0x330d('0x1e')]||!_0x55eb0e[_0x330d('0x1f')]||!_0x55eb0e[_0x330d('0x29')]||!_0x55eb0e[_0x330d('0x20')]||!_0x55eb0e[_0x330d('0x33')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x21'));}if(!_0x1ad0ee[_0x330d('0x17')]){throw new Error(_0x330d('0x22'));}if(_0x55eb0e[_0x330d('0x1f')]===_0x416b93['id']){return _0x416b93;}else{return db[_0x330d('0x23')][_0x330d('0x24')]({'where':{'id':_settings['sentimentAccountId']}});}})['then'](function(_0xd0af59){if(!_0xd0af59){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0xd0af59[_0x330d('0xb')]||!_0xd0af59[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0xb093cd=_0xd0af59;logger['info'](util['format'](_0x330d('0x28'),_0x1ad0ee['id']));return sentiment(_0xb093cd[_0x330d('0xb')],_0xb093cd[_0x330d('0x26')],_0x55eb0e[_0x330d('0x29')],_0x1ad0ee[_0x330d('0x17')],_0x55eb0e[_0x330d('0x20')]);})[_0x330d('0xe')](function(_0x5dab16){logger['info'](util[_0x330d('0x9')](_0x330d('0x34'),_0x1ad0ee['id']));return _0x1ad0ee['update']({'sentiment':_0x5dab16[_0x330d('0x2b')],'sPositive':_0x5dab16[_0x330d('0x2c')][_0x330d('0x35')],'sNegative':_0x5dab16[_0x330d('0x2c')][_0x330d('0x36')],'sMixed':_0x5dab16['SentimentScore'][_0x330d('0x2d')],'sNeutral':_0x5dab16[_0x330d('0x2c')][_0x330d('0x2e')],'transcribeStatus':_0x330d('0x37')});})[_0x330d('0xe')](function(){logger['info'](util[_0x330d('0x9')](_0x330d('0x2f'),_0x1ad0ee['id']));_0x3a0f89();});}})['catch'](function(_0x3264d0){if(_0x3264d0){if(!_0x3264d0['name']||_0x3264d0[_0x330d('0x38')]!==_0x330d('0x39')){logger[_0x330d('0x3a')](util[_0x330d('0x9')](_0x330d('0x3b'),_0x1ad0ee['id']),util[_0x330d('0x3c')](_0x3264d0,{'showHidden':![],'depth':null}));}}_0x3a0f89();});});}function checkTranscribe(){var _0xa802b7;var _0x36393b;var _0x460ec4;return db[_0x330d('0x3d')][_0x330d('0x3e')]({'where':{'transcribeStatus':_0x330d('0x3f')}})[_0x330d('0xe')](function(_0xadbd06){if(!_0xadbd06||!_0xadbd06[_0x330d('0x18')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x40'));}_0xa802b7=_0xadbd06;return db[_0x330d('0x41')][_0x330d('0x24')]({'where':{'id':0x1}});})[_0x330d('0xe')](function(_0x46de6d){if(!_0x46de6d){throw new db[(_0x330d('0x1b'))]['ValidationError']('Settings\x20not\x20available');}_0x36393b=_0x46de6d;if(!_0x36393b[_0x330d('0x5')]||!_0x36393b['transcribeAccountId']||!_0x36393b[_0x330d('0xc')]||!_0x36393b[_0x330d('0x20')]||!_0x36393b['bucket']){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x42'));}return db['CloudProvider'][_0x330d('0x24')]({'where':{'id':_0x36393b[_0x330d('0x43')]}});})[_0x330d('0xe')](function(_0x47dc86){if(!_0x47dc86){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x25'));}if(!_0x47dc86[_0x330d('0xb')]||!_0x47dc86[_0x330d('0x26')]){throw new db[(_0x330d('0x1b'))][(_0x330d('0x1c'))](_0x330d('0x27'));}_0x460ec4=_0x47dc86;var _0xc00ee8=[];_0xa802b7[_0x330d('0x44')](function(_0x438d23){_0xc00ee8[_0x330d('0x45')](checkTranscribeJob(_0x438d23,_0x36393b,_0x460ec4));});return BPromise[_0x330d('0x46')](_0xc00ee8);})[_0x330d('0x47')](function(_0x4e1998){if(_0x4e1998){if(!_0x4e1998['name']||_0x4e1998['name']!==_0x330d('0x39')){logger[_0x330d('0x3a')](util[_0x330d('0x3c')](_0x4e1998,{'showHidden':![],'depth':null}));}}});}exports[_0x330d('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();};
\ No newline at end of file
index 2716e34..c9045c6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0bf=['schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','ioredis','util','../../config/environment','../../mysqldb','../logger'];(function(_0x361e9a,_0x45d228){var _0x131e9a=function(_0x4549e4){while(--_0x4549e4){_0x361e9a['push'](_0x361e9a['shift']());}};_0x131e9a(++_0x45d228);}(_0xe0bf,0x123));var _0xfe0b=function(_0x2988dd,_0x592c58){_0x2988dd=_0x2988dd-0x0;var _0x5cb188=_0xe0bf[_0x2988dd];return _0x5cb188;};'use strict';var _=require(_0xfe0b('0x0'));var moment=require('moment');var Redis=require(_0xfe0b('0x1'));var util=require(_0xfe0b('0x2'));var config=require(_0xfe0b('0x3'));var db=require(_0xfe0b('0x4'))['db'];var logger=require(_0xfe0b('0x5'))(_0xfe0b('0x6'));config[_0xfe0b('0x7')]=_[_0xfe0b('0x8')](config[_0xfe0b('0x7')],{'host':_0xfe0b('0x9'),'port':0x18eb});var io=require(_0xfe0b('0xa'))(new Redis(config[_0xfe0b('0x7')]));function closeInteractions(){var _0xf715e9=[];return db[_0xfe0b('0xb')]['findAll']({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,'hours')}}})[_0xfe0b('0xc')](function(_0x386cd6){if(_0x386cd6&&_0x386cd6[_0xfe0b('0xd')]){_0xf715e9=_[_0xfe0b('0xe')](_0x386cd6||[],'id');logger[_0xfe0b('0xf')](_0xfe0b('0x10'),_0xf715e9[_0xfe0b('0x11')]());return db[_0xfe0b('0xb')][_0xfe0b('0x12')]({'closeReason':'system','disposition':'timeout','closed':!![],'closedAt':moment()[_0xfe0b('0x13')](_0xfe0b('0x14'))},{'where':{'id':_0xf715e9}});}})[_0xfe0b('0xc')](function(){if(_0xf715e9&&_0xf715e9[_0xfe0b('0xd')]){logger[_0xfe0b('0xf')](_0xfe0b('0x15'),_0xf715e9[_0xfe0b('0x11')]());for(var _0x4ddc19=0x0;_0x4ddc19<_0xf715e9[_0xfe0b('0xd')];_0x4ddc19++){io[_0xfe0b('0x16')]('whatsappInteraction:update',{'id':_0xf715e9[_0x4ddc19],'closed':!![]});}}})[_0xfe0b('0x17')](function(_0x4bab72){logger[_0xfe0b('0x18')](_0xfe0b('0x19'),_0x4bab72?util['inspect'](_0x4bab72,{'showHidden':![],'depth':null}):'');});}exports[_0xfe0b('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
+var _0x7d4e=['../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','lastMsgAt','subtract','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','format','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','[WHATSAPP]\x20Error\x20closing\x20interactions','start','lodash','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d4e,0xbb));var _0xe7d4=function(_0x1d5d89,_0x37ea8d){_0x1d5d89=_0x1d5d89-0x0;var _0x5d2ab9=_0x7d4e[_0x1d5d89];return _0x5d2ab9;};'use strict';var _=require(_0xe7d4('0x0'));var moment=require('moment');var Redis=require(_0xe7d4('0x1'));var util=require('util');var config=require(_0xe7d4('0x2'));var db=require(_0xe7d4('0x3'))['db'];var logger=require(_0xe7d4('0x4'))(_0xe7d4('0x5'));config[_0xe7d4('0x6')]=_['defaults'](config['redis'],{'host':_0xe7d4('0x7'),'port':0x18eb});var io=require(_0xe7d4('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0xd4e124=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0xe7d4('0x9')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe7d4('0xa')](0x18,'hours')}}})[_0xe7d4('0xb')](function(_0x3a0206){if(_0x3a0206&&_0x3a0206[_0xe7d4('0xc')]){_0xd4e124=_[_0xe7d4('0xd')](_0x3a0206||[],'id');logger['info'](_0xe7d4('0xe'),_0xd4e124[_0xe7d4('0xf')]());return db[_0xe7d4('0x10')][_0xe7d4('0x11')]({'closeReason':_0xe7d4('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xe7d4('0x13')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0xd4e124}});}})['then'](function(){if(_0xd4e124&&_0xd4e124['length']){logger[_0xe7d4('0x14')](_0xe7d4('0x15'),_0xd4e124[_0xe7d4('0xf')]());for(var _0x56f17b=0x0;_0x56f17b<_0xd4e124[_0xe7d4('0xc')];_0x56f17b++){io[_0xe7d4('0x16')](_0xe7d4('0x17'),{'id':_0xd4e124[_0x56f17b],'closed':!![]});}}})[_0xe7d4('0x18')](function(_0x162162){logger['error'](_0xe7d4('0x19'),_0x162162?util['inspect'](_0x162162,{'showHidden':![],'depth':null}):'');});}exports[_0xe7d4('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();};
\ No newline at end of file
index 842b07e..8a69f1b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f61=['now','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','hopper1','contacts2','CmHopper','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo','@xcally.com'];(function(_0x451130,_0x595ee2){var _0x68c08e=function(_0x23fe84){while(--_0x23fe84){_0x451130['push'](_0x451130['shift']());}};_0x68c08e(++_0x595ee2);}(_0x3f61,0x1af));var _0x13f6=function(_0x18c705,_0x487249){_0x18c705=_0x18c705-0x0;var _0x4511c0=_0x3f61[_0x18c705];return _0x4511c0;};'use strict';var util=require(_0x13f6('0x0'));var db=require(_0x13f6('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x13f6('0x2')]({'id':i,'firstName':_0x13f6('0x3')+i,'lastName':_0x13f6('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x13f6('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x13f6('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x13f6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date['now']()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x13f6('0x2')]({'id':i,'firstName':_0x13f6('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x13f6('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x13f6('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x13f6('0x6')](),'updatedAt':Date['now']()});}db[_0x13f6('0x7')][_0x13f6('0x8')]({'where':{}})[_0x13f6('0x9')](function(){return db['CmContact'][_0x13f6('0xa')](contacts);})[_0x13f6('0x9')](function(){console[_0x13f6('0xb')](_0x13f6('0xc'),_0x13f6('0xd'));return db['CmHopper'][_0x13f6('0x8')]({'where':{}});})[_0x13f6('0x9')](function(){return db['CmHopper'][_0x13f6('0xa')](hopper);})[_0x13f6('0x9')](function(){console['log'](_0x13f6('0xc'),_0x13f6('0xe'));return db[_0x13f6('0x7')][_0x13f6('0xa')](contacts2);})[_0x13f6('0x9')](function(){console[_0x13f6('0xb')]('finished\x20populating',_0x13f6('0xf'));return db[_0x13f6('0x10')][_0x13f6('0xa')](hopper2);})[_0x13f6('0x9')](function(){console[_0x13f6('0xb')]('finished\x20populating',_0x13f6('0x11'));})[_0x13f6('0x12')](function(_0x2a09da){console[_0x13f6('0xb')](_0x2a09da);});
\ No newline at end of file
+var _0x9304=['catch','util','../mysqldb','Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','destroy','CmContact','bulkCreate','then','log','finished\x20populating','contacts1','CmHopper'];(function(_0x410d42,_0x4eb035){var _0x25064b=function(_0x4cd53b){while(--_0x4cd53b){_0x410d42['push'](_0x410d42['shift']());}};_0x25064b(++_0x4eb035);}(_0x9304,0x199));var _0x4930=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9304[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x4930('0x0'));var db=require(_0x4930('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x4930('0x2')+i,'lastName':_0x4930('0x3')+i,'phone':0xf879fb460+i,'email':_0x4930('0x4')+i+_0x4930('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x4930('0x6')]({'id':i,'active':![],'scheduledat':Date[_0x4930('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x4930('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x4930('0x6')]({'id':i,'firstName':_0x4930('0x2')+i,'lastName':_0x4930('0x3')+i,'phone':0xf879fb460+i,'email':_0x4930('0x4')+i+_0x4930('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x4930('0x6')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x4930('0x7')](),'updatedAt':Date[_0x4930('0x7')]()});}db['CmContact'][_0x4930('0x8')]({'where':{}})['then'](function(){return db[_0x4930('0x9')][_0x4930('0xa')](contacts);})[_0x4930('0xb')](function(){console[_0x4930('0xc')](_0x4930('0xd'),_0x4930('0xe'));return db[_0x4930('0xf')][_0x4930('0x8')]({'where':{}});})[_0x4930('0xb')](function(){return db[_0x4930('0xf')][_0x4930('0xa')](hopper);})['then'](function(){console[_0x4930('0xc')](_0x4930('0xd'),'hopper1');return db['CmContact']['bulkCreate'](contacts2);})[_0x4930('0xb')](function(){console[_0x4930('0xc')](_0x4930('0xd'),'contacts2');return db[_0x4930('0xf')]['bulkCreate'](hopper2);})[_0x4930('0xb')](function(){console[_0x4930('0xc')](_0x4930('0xd'),'hopper2');})[_0x4930('0x10')](function(_0xb88845){console[_0x4930('0xc')](_0xb88845);});
\ No newline at end of file
index 87328e2..633cecb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x11b3=['%s%s','%s%s@xcally.com','password','udp','wss','all','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','util','../mysqldb','push','format','agent'];(function(_0x52a672,_0xa01ea9){var _0x37e575=function(_0x683fcc){while(--_0x683fcc){_0x52a672['push'](_0x52a672['shift']());}};_0x37e575(++_0xa01ea9);}(_0x11b3,0xf7));var _0x311b=function(_0x3b9d4a,_0x678a48){_0x3b9d4a=_0x3b9d4a-0x0;var _0x1371bb=_0x11b3[_0x3b9d4a];return _0x1371bb;};'use strict';var util=require(_0x311b('0x0'));var db=require(_0x311b('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x311b('0x2')]({'name':util[_0x311b('0x3')]('%s%s',_0x311b('0x4'),i),'fullname':util[_0x311b('0x3')](_0x311b('0x5'),_0x311b('0x4'),i),'email':util['format'](_0x311b('0x6'),_0x311b('0x4'),i),'role':_0x311b('0x4'),'password':_0x311b('0x7'),'internal':0xfa0+i,'type':'friend','transport':[_0x311b('0x8'),'ws',_0x311b('0x9')],'disallow':[_0x311b('0xa')],'allow':['ulaw'],'defaultuser':util[_0x311b('0x3')](_0x311b('0x5'),_0x311b('0x4'),i),'encryption':'yes','avpf':_0x311b('0xb'),'force_avp':'yes','icesupport':_0x311b('0xb'),'dtlsenable':_0x311b('0xb'),'dtlsverify':'no','dtlscertfile':_0x311b('0xc'),'dtlsprivatekey':_0x311b('0xd'),'dtlssetup':_0x311b('0xe'),'callerid':util[_0x311b('0x3')]('\x22%s\x22\x20<%s>',util[_0x311b('0x3')](_0x311b('0x5'),_0x311b('0x4'),i),0xfa0+i)});}db['User'][_0x311b('0xf')](users)[_0x311b('0x10')](function(){console[_0x311b('0x11')]('add\x20user');})['catch'](function(_0x5426d1){console[_0x311b('0x11')](_0x5426d1);});
\ No newline at end of file
+var _0xf462=['%s%s','format','agent','%s%s@xcally.com','friend','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','bulkCreate','then','log','add\x20user','../mysqldb','push'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xf462,0x86));var _0x2f46=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0xf462[_0x52096b];return _0x2b1cc7;};'use strict';var util=require('util');var db=require(_0x2f46('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2f46('0x1')]({'name':util['format'](_0x2f46('0x2'),'agent',i),'fullname':util[_0x2f46('0x3')](_0x2f46('0x2'),_0x2f46('0x4'),i),'email':util[_0x2f46('0x3')](_0x2f46('0x5'),'agent',i),'role':_0x2f46('0x4'),'password':'password','internal':0xfa0+i,'type':_0x2f46('0x6'),'transport':['udp','ws',_0x2f46('0x7')],'disallow':[_0x2f46('0x8')],'allow':[_0x2f46('0x9')],'defaultuser':util[_0x2f46('0x3')](_0x2f46('0x2'),_0x2f46('0x4'),i),'encryption':_0x2f46('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0x2f46('0xa'),'dtlsenable':_0x2f46('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x2f46('0xb'),'dtlssetup':_0x2f46('0xc'),'callerid':util[_0x2f46('0x3')]('\x22%s\x22\x20<%s>',util[_0x2f46('0x3')](_0x2f46('0x2'),_0x2f46('0x4'),i),0xfa0+i)});}db['User'][_0x2f46('0xd')](users)[_0x2f46('0xe')](function(){console[_0x2f46('0xf')](_0x2f46('0x10'));})['catch'](function(_0x4f5824){console[_0x2f46('0xf')](_0x4f5824);});
\ No newline at end of file
index 6eb5de7..7225213 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xed54=['admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','MailQueue','OpenchannelQueue','user','FaxQueues','SmsQueue','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','disconnect','util','bluebird','../mysqldb','./environment','Agents','User','agent','name','telephone','ivr','UserProfileSection','then','autoAssociation','VoiceQueues','ChatQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','role','Campaign','type','format','%s:queue:%s','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','user:%s'];(function(_0x4be730,_0x341fe4){var _0x54bbe5=function(_0x57aba7){while(--_0x57aba7){_0x4be730['push'](_0x4be730['shift']());}};_0x54bbe5(++_0x341fe4);}(_0xed54,0xfc));var _0x4ed5=function(_0x924cbc,_0xd5bca4){_0x924cbc=_0x924cbc-0x0;var _0x1aaab7=_0xed54[_0x924cbc];return _0x1aaab7;};'use strict';var _=require('lodash');var util=require(_0x4ed5('0x0'));var BPromise=require(_0x4ed5('0x1'));var db=require(_0x4ed5('0x2'))['db'];var config=require(_0x4ed5('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x4ed5('0x4'),'model':db[_0x4ed5('0x5')],'attributes':['id','name','role'],'raw':!![],'where':{'role':_0x4ed5('0x6')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x4ed5('0x7')],'where':{'role':_0x4ed5('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x4ed5('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x4ed5('0x7')],'where':{'role':_0x4ed5('0x6')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x4ed5('0x7'),'type'],'where':{'type':_0x4ed5('0x9')}};function getAssociatedResources(_0xde3d51,_0x464a96,_0xb74766){return db[_0x4ed5('0xa')]['findOne']({'where':{'name':_0xde3d51,'userProfileId':_0x464a96},'raw':!![]})[_0x4ed5('0xb')](function(_0x3c027e){if(_0x3c027e){if(_0x3c027e[_0x4ed5('0xc')]){switch(_0xde3d51){case _0x4ed5('0xd'):case _0x4ed5('0xe'):case'FaxQueues':case _0x4ed5('0xf'):case _0x4ed5('0x10'):case _0x4ed5('0x11'):case _0x4ed5('0x12'):return db[_0xb74766][_0x4ed5('0x13')](queryQueues);case _0x4ed5('0x14'):return db[_0xb74766][_0x4ed5('0x13')](queryTelephones);case _0x4ed5('0x15'):return db[_0xb74766]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0xb74766][_0x4ed5('0x13')](queryCampaigns);}}else{return db[_0x4ed5('0x16')][_0x4ed5('0x13')]({'attributes':[_0x4ed5('0x17')],'where':{'sectionId':_0x3c027e['id']},'raw':!![]})[_0x4ed5('0xb')](function(_0x148458){if(_0x148458){var _0x44b770={'where':{'id':_[_0x4ed5('0x18')](_0x148458,_0x4ed5('0x17'))},'raw':!![]};switch(_0xb74766){case _0x4ed5('0x5'):_0x44b770[_0x4ed5('0x19')][_0x4ed5('0x1a')]=_0x4ed5('0x8');break;case _0x4ed5('0x1b'):_0x44b770[_0x4ed5('0x19')][_0x4ed5('0x1c')]='ivr';break;}return db[_0xb74766][_0x4ed5('0x13')](_0x44b770);}else{return[];}});}}else{return[];}})[_0x4ed5('0xb')](function(_0x3bcbc4){return _0x3bcbc4;});}function joinOrLeaveQueues(_0x4cad03,_0x347bda,_0x3fd3ba,_0xa2d24b){_0x4cad03[_0x347bda](util[_0x4ed5('0x1d')](_0x4ed5('0x1e'),_0x3fd3ba,_0xa2d24b[_0x4ed5('0x7')]));if(_0xa2d24b[_0x4ed5('0x4')]){for(var _0x372452=0x0;_0x372452<_0xa2d24b['Agents'][_0x4ed5('0x1f')];_0x372452+=0x1){_0x4cad03[_0x347bda](util[_0x4ed5('0x1d')]('user:%s',_0xa2d24b[_0x4ed5('0x4')][_0x372452]['name']));}}}function joinOrLeave(_0x515769,_0x576458,_0x1377ef){var _0x506906;if(_0x515769[_0x4ed5('0x20')][_0x4ed5('0x21')]['id']){db[_0x4ed5('0x5')][_0x4ed5('0x22')]({'attributes':['id',_0x4ed5('0x7'),_0x4ed5('0x1a'),_0x4ed5('0x23')],'where':{'id':_0x515769['handshake'][_0x4ed5('0x21')]['id']},'include':[{'model':db[_0x4ed5('0x24')],'as':_0x4ed5('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x4ed5('0x26')],'as':_0x4ed5('0x27'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x4ed5('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x4ed5('0x29')],'as':_0x4ed5('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x4ed5('0x2b'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x4ed5('0xb')](function(_0x18d3d0){if(_0x18d3d0){_0x506906=_0x18d3d0;_0x515769[_0x576458](util['format'](_0x4ed5('0x2c'),_0x18d3d0[_0x4ed5('0x7')]));var _0x4ce71c=[];switch(_0x18d3d0['role']){case _0x4ed5('0x2d'):_0x515769[_0x576458](_0x4ed5('0x2e'));_0x515769[_0x576458](_0x4ed5('0x2f'));if(queryQueues[_0x4ed5('0x30')]('include')){delete queryQueues[_0x4ed5('0x31')];}_0x4ce71c[_0x4ed5('0x32')](db[_0x4ed5('0x33')][_0x4ed5('0x13')](queryQueues));_0x4ce71c['push'](db[_0x4ed5('0x34')]['findAll'](queryQueues));_0x4ce71c['push'](db[_0x4ed5('0x35')][_0x4ed5('0x13')](queryQueues));_0x4ce71c['push'](db['SmsQueue'][_0x4ed5('0x13')](queryQueues));_0x4ce71c[_0x4ed5('0x32')](db[_0x4ed5('0x36')]['findAll'](queryQueues));_0x4ce71c[_0x4ed5('0x32')](db[_0x4ed5('0x37')][_0x4ed5('0x13')](queryQueues));_0x4ce71c['push'](db['WhatsappQueue']['findAll'](queryQueues));_0x4ce71c[_0x4ed5('0x32')](db[_0x4ed5('0x5')]['findAll'](queryTelephones));_0x4ce71c[_0x4ed5('0x32')](db['Trunk']['findAll'](queryTrunks));_0x4ce71c[_0x4ed5('0x32')](db['Campaign'][_0x4ed5('0x13')](queryCampaigns));_0x4ce71c[_0x4ed5('0x32')](db[_0x4ed5('0x5')][_0x4ed5('0x13')](queryAgents));break;case _0x4ed5('0x38'):_0x515769[_0x576458](_0x4ed5('0x2e'));_0x515769[_0x576458](_0x4ed5('0x2f'));_0x4ce71c[_0x4ed5('0x32')](getAssociatedResources(_0x4ed5('0xd'),_0x18d3d0['userProfileId'],_0x4ed5('0x33')));_0x4ce71c[_0x4ed5('0x32')](getAssociatedResources(_0x4ed5('0xe'),_0x18d3d0['userProfileId'],'ChatQueue'));_0x4ce71c['push'](getAssociatedResources(_0x4ed5('0x39'),_0x18d3d0['userProfileId'],'FaxQueue'));_0x4ce71c[_0x4ed5('0x32')](getAssociatedResources(_0x4ed5('0xf'),_0x18d3d0[_0x4ed5('0x23')],_0x4ed5('0x3a')));_0x4ce71c[_0x4ed5('0x32')](getAssociatedResources(_0x4ed5('0x10'),_0x18d3d0[_0x4ed5('0x23')],_0x4ed5('0x36')));_0x4ce71c[_0x4ed5('0x32')](getAssociatedResources(_0x4ed5('0x11'),_0x18d3d0[_0x4ed5('0x23')],_0x4ed5('0x37')));_0x4ce71c[_0x4ed5('0x32')](getAssociatedResources('WhatsappQueues',_0x18d3d0['userProfileId'],'WhatsappQueue'));_0x4ce71c[_0x4ed5('0x32')](getAssociatedResources('Telephones',_0x18d3d0[_0x4ed5('0x23')],_0x4ed5('0x5')));_0x4ce71c['push'](getAssociatedResources(_0x4ed5('0x15'),_0x18d3d0[_0x4ed5('0x23')],'Trunk'));_0x4ce71c[_0x4ed5('0x32')](getAssociatedResources('IvrCampaigns',_0x18d3d0[_0x4ed5('0x23')],_0x4ed5('0x1b')));_0x4ce71c[_0x4ed5('0x32')](db[_0x4ed5('0x5')][_0x4ed5('0x13')](queryAgents));break;case _0x4ed5('0x6'):_0x515769[_0x576458](_0x4ed5('0x2e'));_0x515769[_0x576458](_0x4ed5('0x2f'));_0x4ce71c[_0x4ed5('0x32')](_0x18d3d0[_0x4ed5('0x3b')]({'attributes':['id',_0x4ed5('0x7')]}));_0x4ce71c['push'](_0x18d3d0[_0x4ed5('0x3c')]({'attributes':['id','name']}));_0x4ce71c['push'](_0x18d3d0['getFaxQueues']({'attributes':['id',_0x4ed5('0x7')]}));_0x4ce71c[_0x4ed5('0x32')](_0x18d3d0[_0x4ed5('0x3d')]({'attributes':['id',_0x4ed5('0x7')]}));_0x4ce71c[_0x4ed5('0x32')](_0x18d3d0['getMailQueues']({'attributes':['id',_0x4ed5('0x7')]}));_0x4ce71c[_0x4ed5('0x32')](_0x18d3d0[_0x4ed5('0x3e')]({'attributes':['id',_0x4ed5('0x7')]}));_0x4ce71c[_0x4ed5('0x32')](_0x18d3d0[_0x4ed5('0x3f')]({'attributes':['id',_0x4ed5('0x7')]}));break;}return BPromise['all'](_0x4ce71c);}})[_0x4ed5('0xb')](function(_0x1de7e9){if(_0x1de7e9&&_0x1de7e9[_0x4ed5('0x1f')]){for(var _0x5f17b3=0x0;_0x5f17b3<_0x1de7e9[_0x4ed5('0x1f')];_0x5f17b3+=0x1){for(var _0x4bd382=0x0;_0x4bd382<_0x1de7e9[_0x5f17b3][_0x4ed5('0x1f')];_0x4bd382+=0x1){switch(_0x5f17b3){case 0x0:joinOrLeaveQueues(_0x515769,_0x576458,_0x4ed5('0x40'),_0x1de7e9[_0x5f17b3][_0x4bd382]);break;case 0x1:joinOrLeaveQueues(_0x515769,_0x576458,_0x4ed5('0x41'),_0x1de7e9[_0x5f17b3][_0x4bd382]);break;case 0x2:joinOrLeaveQueues(_0x515769,_0x576458,_0x4ed5('0x42'),_0x1de7e9[_0x5f17b3][_0x4bd382]);break;case 0x3:joinOrLeaveQueues(_0x515769,_0x576458,'sms',_0x1de7e9[_0x5f17b3][_0x4bd382]);break;case 0x4:joinOrLeaveQueues(_0x515769,_0x576458,_0x4ed5('0x43'),_0x1de7e9[_0x5f17b3][_0x4bd382]);break;case 0x5:joinOrLeaveQueues(_0x515769,_0x576458,_0x4ed5('0x44'),_0x1de7e9[_0x5f17b3][_0x4bd382]);break;case 0x6:joinOrLeaveQueues(_0x515769,_0x576458,_0x4ed5('0x45'),_0x1de7e9[_0x5f17b3][_0x4bd382]);break;case 0x7:if(_0x506906['role']!==_0x4ed5('0x6'))_0x515769[_0x576458](util[_0x4ed5('0x1d')](_0x4ed5('0x46'),_0x1de7e9[_0x5f17b3][_0x4bd382][_0x4ed5('0x7')]));break;case 0x8:if(_0x506906[_0x4ed5('0x1a')]!==_0x4ed5('0x6'))_0x515769[_0x576458](util[_0x4ed5('0x1d')](_0x4ed5('0x47'),_0x1de7e9[_0x5f17b3][_0x4bd382]['name']));break;case 0x9:if(_0x506906['role']!==_0x4ed5('0x6'))_0x515769[_0x576458](util['format'](_0x4ed5('0x48'),_0x1de7e9[_0x5f17b3][_0x4bd382][_0x4ed5('0x1c')],_0x1de7e9[_0x5f17b3][_0x4bd382][_0x4ed5('0x7')]));break;case 0xa:_0x515769[_0x576458](util[_0x4ed5('0x1d')]('user:%s',_0x1de7e9[_0x5f17b3][_0x4bd382][_0x4ed5('0x7')]));break;}}}}})[_0x4ed5('0xb')](function(){if(_0x576458===_0x4ed5('0x49')){var _0x27be2a=_[_0x4ed5('0x18')](_0x506906[_0x4ed5('0x25')],'id');return _0x506906[_0x4ed5('0x4a')](_0x27be2a)[_0x4ed5('0xb')](function(){for(var _0x4018b4=0x0;_0x4018b4<_0x27be2a[_0x4ed5('0x1f')];_0x4018b4+=0x1){_0x1377ef[_0x4ed5('0x4b')](_0x4ed5('0x4c'),{'ChatInteractionId':Number(_0x27be2a[_0x4018b4]),'UserId':Number(_0x506906['id'])});}});}})[_0x4ed5('0xb')](function(){if(_0x576458===_0x4ed5('0x49')){var _0x17cb75=_[_0x4ed5('0x18')](_0x506906[_0x4ed5('0x27')],'id');return _0x506906[_0x4ed5('0x4d')](_0x17cb75)['then'](function(){for(var _0x17b320=0x0;_0x17b320<_0x17cb75[_0x4ed5('0x1f')];_0x17b320+=0x1){_0x1377ef[_0x4ed5('0x4b')](_0x4ed5('0x4e'),{'MailInteractionId':Number(_0x17cb75[_0x17b320]),'UserId':Number(_0x506906['id'])});}});}})['then'](function(){if(_0x576458===_0x4ed5('0x49')){var _0x478792=_['map'](_0x506906[_0x4ed5('0x28')],'id');return _0x506906['removeFaxInteractions'](_0x478792)['then'](function(){for(var _0x3153d0=0x0;_0x3153d0<_0x478792[_0x4ed5('0x1f')];_0x3153d0+=0x1){_0x1377ef['emit'](_0x4ed5('0x4f'),{'FaxInteractionId':Number(_0x478792[_0x3153d0]),'UserId':Number(_0x506906['id'])});}});}})[_0x4ed5('0xb')](function(){if(_0x576458==='leave'){var _0x343e0d=_['map'](_0x506906['SmsInteractions'],'id');return _0x506906[_0x4ed5('0x50')](_0x343e0d)[_0x4ed5('0xb')](function(){for(var _0x585699=0x0;_0x585699<_0x343e0d['length'];_0x585699+=0x1){_0x1377ef['emit'](_0x4ed5('0x51'),{'SmsInteractionId':Number(_0x343e0d[_0x585699]),'UserId':Number(_0x506906['id'])});}});}})['then'](function(){if(_0x576458==='leave'){var _0x3c3372=_[_0x4ed5('0x18')](_0x506906[_0x4ed5('0x2b')],'id');return _0x506906[_0x4ed5('0x52')](_0x3c3372)[_0x4ed5('0xb')](function(){for(var _0x2e8f52=0x0;_0x2e8f52<_0x3c3372[_0x4ed5('0x1f')];_0x2e8f52+=0x1){_0x1377ef[_0x4ed5('0x4b')](_0x4ed5('0x53'),{'OpenchannelInteractionId':Number(_0x3c3372[_0x2e8f52]),'UserId':Number(_0x506906['id'])});}});}})[_0x4ed5('0xb')](function(){if(_0x576458===_0x4ed5('0x49')){var _0x5b2d06=_[_0x4ed5('0x18')](_0x506906['WhatsappInteractions'],'id');return _0x506906[_0x4ed5('0x54')](_0x5b2d06)['then'](function(){for(var _0x58b548=0x0;_0x58b548<_0x5b2d06[_0x4ed5('0x1f')];_0x58b548+=0x1){_0x1377ef[_0x4ed5('0x4b')](_0x4ed5('0x55'),{'WhatsappInteractionId':Number(_0x5b2d06[_0x58b548]),'UserId':Number(_0x506906['id'])});}});}})[_0x4ed5('0x56')](function(_0x582584){_0x515769['log'](_0x582584);});}}function onDisconnect(_0x250bbb,_0xebe200){joinOrLeave(_0x250bbb,'leave',_0xebe200);}function onConnect(_0x459500){joinOrLeave(_0x459500,_0x4ed5('0x57'));}exports[_0x4ed5('0x58')]=function(_0x5a5ad1){_0x5a5ad1['on'](_0x4ed5('0x59'),function(_0x5da4de){_0x5da4de[_0x4ed5('0x5a')](0x0);_0x5da4de[_0x4ed5('0x5b')]=_0x5da4de[_0x4ed5('0x5c')][_0x4ed5('0x59')][_0x4ed5('0x5d')]+':'+_0x5da4de[_0x4ed5('0x5c')][_0x4ed5('0x59')][_0x4ed5('0x5e')];_0x5da4de[_0x4ed5('0x5f')]=new Date();_0x5da4de[_0x4ed5('0x60')]=function(_0x2a81fd){console[_0x4ed5('0x60')](_0x4ed5('0x61')+_0x5da4de['nsp'][_0x4ed5('0x7')]+'['+_0x5da4de['address']+']',_0x2a81fd);};_0x5da4de['on'](_0x4ed5('0x62'),function(){onDisconnect(_0x5da4de,_0x5a5ad1);_0x5da4de['log']('DISCONNECTED');});onConnect(_0x5da4de);_0x5da4de[_0x4ed5('0x60')]('CONNECTED');});};
\ No newline at end of file
+var _0x6050=['disconnect','DISCONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','User','role','type','ivr','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','where','telephone','Campaign','format','%s:queue:%s','Agents','length','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','user','voice:inbound','agent','getOpenchannelQueues','getWhatsappQueues','all','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','map','removeChatInteractions','emit','leave','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','remotePort','SocketIO\x20','nsp'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x6050,0x196));var _0x0605=function(_0x4a56e5,_0x175b1c){_0x4a56e5=_0x4a56e5-0x0;var _0x367cc9=_0x6050[_0x4a56e5];return _0x367cc9;};'use strict';var _=require(_0x0605('0x0'));var util=require(_0x0605('0x1'));var BPromise=require(_0x0605('0x2'));var db=require(_0x0605('0x3'))['db'];var config=require(_0x0605('0x4'));var queryQueues={'attributes':['id',_0x0605('0x5')],'include':[{'as':'Agents','model':db[_0x0605('0x6')],'attributes':['id',_0x0605('0x5'),_0x0605('0x7')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x0605('0x5')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x0605('0x8')],'where':{'type':_0x0605('0x9')}};function getAssociatedResources(_0xa08eca,_0x5bb96,_0x44fdd3){return db['UserProfileSection'][_0x0605('0xa')]({'where':{'name':_0xa08eca,'userProfileId':_0x5bb96},'raw':!![]})[_0x0605('0xb')](function(_0xe54b22){if(_0xe54b22){if(_0xe54b22[_0x0605('0xc')]){switch(_0xa08eca){case _0x0605('0xd'):case _0x0605('0xe'):case _0x0605('0xf'):case _0x0605('0x10'):case _0x0605('0x11'):case _0x0605('0x12'):case _0x0605('0x13'):return db[_0x44fdd3][_0x0605('0x14')](queryQueues);case _0x0605('0x15'):return db[_0x44fdd3][_0x0605('0x14')](queryTelephones);case _0x0605('0x16'):return db[_0x44fdd3][_0x0605('0x14')](queryTrunks);case _0x0605('0x17'):return db[_0x44fdd3][_0x0605('0x14')](queryCampaigns);}}else{return db[_0x0605('0x18')]['findAll']({'attributes':[_0x0605('0x19')],'where':{'sectionId':_0xe54b22['id']},'raw':!![]})[_0x0605('0xb')](function(_0x4993ab){if(_0x4993ab){var _0x5ce56a={'where':{'id':_['map'](_0x4993ab,_0x0605('0x19'))},'raw':!![]};switch(_0x44fdd3){case _0x0605('0x6'):_0x5ce56a[_0x0605('0x1a')][_0x0605('0x7')]=_0x0605('0x1b');break;case _0x0605('0x1c'):_0x5ce56a[_0x0605('0x1a')][_0x0605('0x8')]=_0x0605('0x9');break;}return db[_0x44fdd3][_0x0605('0x14')](_0x5ce56a);}else{return[];}});}}else{return[];}})[_0x0605('0xb')](function(_0x2fa77e){return _0x2fa77e;});}function joinOrLeaveQueues(_0x2e2204,_0x103952,_0x59bc87,_0x254020){_0x2e2204[_0x103952](util[_0x0605('0x1d')](_0x0605('0x1e'),_0x59bc87,_0x254020[_0x0605('0x5')]));if(_0x254020[_0x0605('0x1f')]){for(var _0x90b2e1=0x0;_0x90b2e1<_0x254020[_0x0605('0x1f')][_0x0605('0x20')];_0x90b2e1+=0x1){_0x2e2204[_0x103952](util[_0x0605('0x1d')]('user:%s',_0x254020[_0x0605('0x1f')][_0x90b2e1]['name']));}}}function joinOrLeave(_0x3efc38,_0x118e9c,_0x110098){var _0xf182c4;if(_0x3efc38[_0x0605('0x21')][_0x0605('0x22')]['id']){db[_0x0605('0x6')][_0x0605('0x23')]({'attributes':['id',_0x0605('0x5'),_0x0605('0x7'),_0x0605('0x24')],'where':{'id':_0x3efc38[_0x0605('0x21')]['query']['id']},'include':[{'model':db[_0x0605('0x25')],'as':_0x0605('0x26'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x0605('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x0605('0x28')],'as':_0x0605('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x0605('0x2a')],'as':_0x0605('0x2b'),'attributes':['id'],'raw':!![]},{'model':db[_0x0605('0x2c')],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x0605('0xb')](function(_0x5daef6){if(_0x5daef6){_0xf182c4=_0x5daef6;_0x3efc38[_0x118e9c](util[_0x0605('0x1d')](_0x0605('0x2d'),_0x5daef6[_0x0605('0x5')]));var _0x9f2980=[];switch(_0x5daef6[_0x0605('0x7')]){case _0x0605('0x2e'):_0x3efc38[_0x118e9c]('voice:inbound');_0x3efc38[_0x118e9c](_0x0605('0x2f'));if(queryQueues[_0x0605('0x30')](_0x0605('0x31'))){delete queryQueues[_0x0605('0x31')];}_0x9f2980[_0x0605('0x32')](db[_0x0605('0x33')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x34')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x35')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x36')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x37')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x38')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x39')][_0x0605('0x14')](queryQueues));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x6')]['findAll'](queryTelephones));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x3a')]['findAll'](queryTrunks));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x1c')]['findAll'](queryCampaigns));_0x9f2980[_0x0605('0x32')](db[_0x0605('0x6')][_0x0605('0x14')](queryAgents));break;case _0x0605('0x3b'):_0x3efc38[_0x118e9c](_0x0605('0x3c'));_0x3efc38[_0x118e9c](_0x0605('0x2f'));_0x9f2980['push'](getAssociatedResources('VoiceQueues',_0x5daef6[_0x0605('0x24')],_0x0605('0x33')));_0x9f2980[_0x0605('0x32')](getAssociatedResources('ChatQueues',_0x5daef6[_0x0605('0x24')],'ChatQueue'));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0xf'),_0x5daef6[_0x0605('0x24')],_0x0605('0x35')));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x10'),_0x5daef6[_0x0605('0x24')],_0x0605('0x36')));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x11'),_0x5daef6['userProfileId'],_0x0605('0x37')));_0x9f2980['push'](getAssociatedResources(_0x0605('0x12'),_0x5daef6[_0x0605('0x24')],_0x0605('0x38')));_0x9f2980['push'](getAssociatedResources('WhatsappQueues',_0x5daef6[_0x0605('0x24')],'WhatsappQueue'));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x15'),_0x5daef6[_0x0605('0x24')],_0x0605('0x6')));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x16'),_0x5daef6[_0x0605('0x24')],_0x0605('0x3a')));_0x9f2980[_0x0605('0x32')](getAssociatedResources(_0x0605('0x17'),_0x5daef6[_0x0605('0x24')],_0x0605('0x1c')));_0x9f2980[_0x0605('0x32')](db['User']['findAll'](queryAgents));break;case _0x0605('0x3d'):_0x3efc38[_0x118e9c]('voice:inbound');_0x3efc38[_0x118e9c](_0x0605('0x2f'));_0x9f2980[_0x0605('0x32')](_0x5daef6['getVoiceQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6['getChatQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6['getFaxQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6['getSmsQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980['push'](_0x5daef6['getMailQueues']({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6[_0x0605('0x3e')]({'attributes':['id',_0x0605('0x5')]}));_0x9f2980[_0x0605('0x32')](_0x5daef6[_0x0605('0x3f')]({'attributes':['id',_0x0605('0x5')]}));break;}return BPromise[_0x0605('0x40')](_0x9f2980);}})['then'](function(_0x337f79){if(_0x337f79&&_0x337f79[_0x0605('0x20')]){for(var _0xbecbe5=0x0;_0xbecbe5<_0x337f79['length'];_0xbecbe5+=0x1){for(var _0x433d4c=0x0;_0x433d4c<_0x337f79[_0xbecbe5][_0x0605('0x20')];_0x433d4c+=0x1){switch(_0xbecbe5){case 0x0:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x41'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x1:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x42'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x2:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x43'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x3:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x44'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x4:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x45'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x5:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x46'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x6:joinOrLeaveQueues(_0x3efc38,_0x118e9c,_0x0605('0x47'),_0x337f79[_0xbecbe5][_0x433d4c]);break;case 0x7:if(_0xf182c4['role']!==_0x0605('0x3d'))_0x3efc38[_0x118e9c](util[_0x0605('0x1d')](_0x0605('0x48'),_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x5')]));break;case 0x8:if(_0xf182c4[_0x0605('0x7')]!==_0x0605('0x3d'))_0x3efc38[_0x118e9c](util[_0x0605('0x1d')](_0x0605('0x49'),_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x5')]));break;case 0x9:if(_0xf182c4[_0x0605('0x7')]!=='agent')_0x3efc38[_0x118e9c](util['format']('campaign:%s:%s',_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x8')],_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x5')]));break;case 0xa:_0x3efc38[_0x118e9c](util[_0x0605('0x1d')](_0x0605('0x2d'),_0x337f79[_0xbecbe5][_0x433d4c][_0x0605('0x5')]));break;}}}}})[_0x0605('0xb')](function(){if(_0x118e9c==='leave'){var _0x37d689=_[_0x0605('0x4a')](_0xf182c4[_0x0605('0x26')],'id');return _0xf182c4[_0x0605('0x4b')](_0x37d689)['then'](function(){for(var _0x2c5709=0x0;_0x2c5709<_0x37d689[_0x0605('0x20')];_0x2c5709+=0x1){_0x110098[_0x0605('0x4c')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x37d689[_0x2c5709]),'UserId':Number(_0xf182c4['id'])});}});}})['then'](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x1a735c=_[_0x0605('0x4a')](_0xf182c4['MailInteractions'],'id');return _0xf182c4['removeMailInteractions'](_0x1a735c)[_0x0605('0xb')](function(){for(var _0x5c817e=0x0;_0x5c817e<_0x1a735c[_0x0605('0x20')];_0x5c817e+=0x1){_0x110098[_0x0605('0x4c')](_0x0605('0x4e'),{'MailInteractionId':Number(_0x1a735c[_0x5c817e]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0xb')](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x3c4b88=_[_0x0605('0x4a')](_0xf182c4['FaxInteractions'],'id');return _0xf182c4[_0x0605('0x4f')](_0x3c4b88)['then'](function(){for(var _0x40dd01=0x0;_0x40dd01<_0x3c4b88['length'];_0x40dd01+=0x1){_0x110098[_0x0605('0x4c')](_0x0605('0x50'),{'FaxInteractionId':Number(_0x3c4b88[_0x40dd01]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0xb')](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x48be2f=_['map'](_0xf182c4[_0x0605('0x29')],'id');return _0xf182c4[_0x0605('0x51')](_0x48be2f)['then'](function(){for(var _0x51d295=0x0;_0x51d295<_0x48be2f['length'];_0x51d295+=0x1){_0x110098[_0x0605('0x4c')](_0x0605('0x52'),{'SmsInteractionId':Number(_0x48be2f[_0x51d295]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0xb')](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x3af2ad=_[_0x0605('0x4a')](_0xf182c4['OpenchannelInteractions'],'id');return _0xf182c4[_0x0605('0x53')](_0x3af2ad)[_0x0605('0xb')](function(){for(var _0x3edced=0x0;_0x3edced<_0x3af2ad[_0x0605('0x20')];_0x3edced+=0x1){_0x110098[_0x0605('0x4c')](_0x0605('0x54'),{'OpenchannelInteractionId':Number(_0x3af2ad[_0x3edced]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0xb')](function(){if(_0x118e9c===_0x0605('0x4d')){var _0x533a9c=_['map'](_0xf182c4['WhatsappInteractions'],'id');return _0xf182c4[_0x0605('0x55')](_0x533a9c)[_0x0605('0xb')](function(){for(var _0xe53cb6=0x0;_0xe53cb6<_0x533a9c['length'];_0xe53cb6+=0x1){_0x110098['emit'](_0x0605('0x56'),{'WhatsappInteractionId':Number(_0x533a9c[_0xe53cb6]),'UserId':Number(_0xf182c4['id'])});}});}})[_0x0605('0x57')](function(_0x8ae474){_0x3efc38[_0x0605('0x58')](_0x8ae474);});}}function onDisconnect(_0x14cc4c,_0x437c90){joinOrLeave(_0x14cc4c,_0x0605('0x4d'),_0x437c90);}function onConnect(_0x19b55e){joinOrLeave(_0x19b55e,_0x0605('0x59'));}exports[_0x0605('0x5a')]=function(_0xac4a33){_0xac4a33['on'](_0x0605('0x5b'),function(_0x5d4e9a){_0x5d4e9a[_0x0605('0x5c')](0x0);_0x5d4e9a[_0x0605('0x5d')]=_0x5d4e9a[_0x0605('0x5e')][_0x0605('0x5b')][_0x0605('0x5f')]+':'+_0x5d4e9a[_0x0605('0x5e')]['connection'][_0x0605('0x60')];_0x5d4e9a['connectedAt']=new Date();_0x5d4e9a['log']=function(_0x3d2414){console[_0x0605('0x58')](_0x0605('0x61')+_0x5d4e9a[_0x0605('0x62')][_0x0605('0x5')]+'['+_0x5d4e9a[_0x0605('0x5d')]+']',_0x3d2414);};_0x5d4e9a['on'](_0x0605('0x63'),function(){onDisconnect(_0x5d4e9a,_0xac4a33);_0x5d4e9a[_0x0605('0x58')](_0x0605('0x64'));});onConnect(_0x5d4e9a);_0x5d4e9a[_0x0605('0x58')]('CONNECTED');});};
\ No newline at end of file
index 39814c0..5b58b05 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x43dd=['outgoingmessage','motionChannel','event','opened','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','name','changed','substatus','closed','SIP/%s','User','internal','default','length','hasOwnProperty','model','hook','../../mysqldb','../logger','triggers','client','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','Chat','newmessage','Sms','SmsInteraction','SmsMessage','WhatsappInteraction','WhatsappMessage','FaxInteraction','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','then','info','Trigger,\x20%s','EventManager','error','catch','get','channel','resolve','ContactId','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','format','agent','incomingmessage'];(function(_0x2d82f7,_0x5b9c5c){var _0x5c9937=function(_0x342dfb){while(--_0x342dfb){_0x2d82f7['push'](_0x2d82f7['shift']());}};_0x5c9937(++_0x5b9c5c);}(_0x43dd,0x18c));var _0xd43d=function(_0x476d07,_0x5a80d5){_0x476d07=_0x476d07-0x0;var _0x39ee99=_0x43dd[_0x476d07];return _0x39ee99;};'use strict';var util=require('util');var db=require(_0xd43d('0x0'))['db'];var jayson=require('jayson/promise');var logger=require(_0xd43d('0x1'))(_0xd43d('0x2'));var client=jayson[_0xd43d('0x3')]['http']({'port':0x232a});var triggers=[{'channel':'Chat','model':_0xd43d('0x4'),'event':_0xd43d('0x5'),'condition':_0xd43d('0x6'),'callback':afterCreate},{'channel':'Chat','model':_0xd43d('0x4'),'event':_0xd43d('0x7'),'condition':_0xd43d('0x8'),'callback':afterUpdate},{'channel':_0xd43d('0x9'),'model':'ChatMessage','event':_0xd43d('0x5'),'condition':_0xd43d('0xa'),'callback':afterCreateMessage},{'channel':_0xd43d('0x9'),'model':'ChatOfflineMessage','event':_0xd43d('0x5'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xd43d('0xb'),'model':'SmsInteraction','event':'afterCreate','condition':_0xd43d('0x6'),'callback':afterCreate},{'channel':_0xd43d('0xb'),'model':_0xd43d('0xc'),'event':_0xd43d('0x7'),'condition':_0xd43d('0x8'),'callback':afterUpdate},{'channel':_0xd43d('0xb'),'model':_0xd43d('0xd'),'event':_0xd43d('0x5'),'condition':_0xd43d('0xa'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xd43d('0xe'),'event':_0xd43d('0x5'),'condition':_0xd43d('0x6'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xd43d('0xe'),'event':_0xd43d('0x7'),'condition':_0xd43d('0x8'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xd43d('0xf'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0xd43d('0x10'),'event':_0xd43d('0x5'),'condition':_0xd43d('0x6'),'callback':afterCreate},{'channel':_0xd43d('0x11'),'model':_0xd43d('0x10'),'event':_0xd43d('0x7'),'condition':_0xd43d('0x8'),'callback':afterUpdate},{'channel':'Fax','model':'FaxMessage','event':_0xd43d('0x5'),'condition':_0xd43d('0xa'),'callback':afterCreateMessage},{'channel':_0xd43d('0x12'),'model':_0xd43d('0x13'),'event':_0xd43d('0x5'),'condition':_0xd43d('0x6'),'callback':afterCreate},{'channel':_0xd43d('0x12'),'model':_0xd43d('0x13'),'event':_0xd43d('0x7'),'condition':_0xd43d('0x8'),'callback':afterUpdate},{'channel':_0xd43d('0x12'),'model':_0xd43d('0x14'),'event':_0xd43d('0x5'),'condition':_0xd43d('0xa'),'callback':afterCreateMessage},{'channel':_0xd43d('0x15'),'model':_0xd43d('0x16'),'event':'afterCreate','condition':_0xd43d('0x6'),'callback':afterCreate},{'channel':_0xd43d('0x15'),'model':_0xd43d('0x16'),'event':_0xd43d('0x7'),'condition':_0xd43d('0x8'),'callback':afterUpdate},{'channel':_0xd43d('0x15'),'model':_0xd43d('0x17'),'event':'afterCreate','condition':_0xd43d('0xa'),'callback':afterCreateMessage}];function request(_0x38b40c){return client['request']('EventManager',_0x38b40c)[_0xd43d('0x18')](function(_0x306c0d){logger[_0xd43d('0x19')](_0xd43d('0x1a'),_0xd43d('0x1b'),_0x306c0d);if(_0x306c0d[_0xd43d('0x1c')]){if(_0x306c0d[_0xd43d('0x1c')]['code']===0x1f4){logger['error'](_0xd43d('0x1a'),_0xd43d('0x1b'),_0x306c0d[_0xd43d('0x1c')]);}}})[_0xd43d('0x1d')](function(_0x40a35d){logger['error'](_0xd43d('0x1a'),_0xd43d('0x1b'),_0x40a35d);});}function afterCreateMessage(_0x2fb2d3){return function(_0x3cecea){_0x3cecea=_0x3cecea[_0xd43d('0x1e')]({'plain':!![]});_0x3cecea[_0xd43d('0x1f')]=_0x2fb2d3;_0x3cecea['motionChannel']=_0x2fb2d3;_0x3cecea['event']=_0x3cecea['direction'];Promise[_0xd43d('0x20')]()[_0xd43d('0x18')](function(){if(typeof _0x3cecea[_0xd43d('0x21')]===_0xd43d('0x22'))return null;var _0x13b6a2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3cecea[_0xd43d('0x21')];return db[_0xd43d('0x23')][_0xd43d('0x24')](_0x13b6a2,{'type':db[_0xd43d('0x25')][_0xd43d('0x26')][_0xd43d('0x27')],'raw':!![]});})[_0xd43d('0x18')](function(_0x2c5ffc){if(_0x2c5ffc){_0x3cecea[_0xd43d('0x28')]=_0x2c5ffc[0x0];}if(typeof _0x3cecea['UserId']===_0xd43d('0x22'))return;return getAgent(_0x3cecea[_0xd43d('0x29')]);})['then'](function(_0x1588a3){if(_0x1588a3){_0x3cecea['interface']=util[_0xd43d('0x2a')]('SIP/%s',_0x1588a3['name']);_0x3cecea[_0xd43d('0x2b')]=_0x1588a3;_0x3cecea[_0xd43d('0x1f')]=_0x2fb2d3;return request({'event':_0xd43d('0x2c'),'message':_0x3cecea});}else{return request({'event':_0xd43d('0x2d'),'message':_0x3cecea});}})['catch'](function(_0x2140be){logger['error'](_0xd43d('0x1a'),'AfterCreateMessage',_0x2140be);});};}function afterCreateOfflineMessage(_0x825b76){return function(_0x595e99){_0x595e99=_0x595e99[_0xd43d('0x1e')]({'plain':!![]});_0x595e99['channel']=_0x825b76;_0x595e99[_0xd43d('0x2e')]=_0x825b76;_0x595e99[_0xd43d('0x2f')]='offlineMessage';return request({'event':_0x595e99[_0xd43d('0x2f')],'message':_0x595e99});};}function afterCreate(_0x56d1a0,_0x45203e){return function(_0x48eca5){_0x48eca5=_0x48eca5[_0xd43d('0x1e')]({'plain':!![]});_0x48eca5[_0xd43d('0x1f')]=_0x56d1a0;_0x48eca5[_0xd43d('0x2e')]=_0x56d1a0;_0x48eca5[_0xd43d('0x2f')]=_0xd43d('0x30');Promise[_0xd43d('0x20')]()[_0xd43d('0x18')](function(){var _0x3da222=_0xd43d('0x31')+_0x48eca5[_0xd43d('0x21')];return db[_0xd43d('0x23')][_0xd43d('0x24')](_0x3da222,{'type':db[_0xd43d('0x25')][_0xd43d('0x26')][_0xd43d('0x27')],'raw':!![]});})[_0xd43d('0x18')](function(_0x5c8efb){if(_0x5c8efb){_0x48eca5['contact']=_0x5c8efb[0x0];}if(typeof _0x48eca5[_0xd43d('0x29')]==='undefined')return;return getAgent(_0x48eca5[_0xd43d('0x29')]);})[_0xd43d('0x18')](function(_0x167720){if(_0x167720){_0x48eca5[_0xd43d('0x32')]=util[_0xd43d('0x2a')]('SIP/%s',_0x167720[_0xd43d('0x33')]);_0x48eca5[_0xd43d('0x2b')]=_0x167720;}return request({'event':_0x45203e,'message':_0x48eca5});})[_0xd43d('0x1d')](function(_0x327929){logger[_0xd43d('0x1c')](_0xd43d('0x1a'),'AfterCreate',_0x327929);});};}function afterUpdate(_0x1e8a16){return function(_0x1fea00){var _0x56cd23=_0x1fea00['changed']('closed')&&_0x1fea00['closed'];var _0x55f5f1=_0x1fea00[_0xd43d('0x34')](_0xd43d('0x35'));if(_0x56cd23||_0x55f5f1){var _0x197ff5=_0x56cd23?_0xd43d('0x8'):'substatus';var _0x56b805=_0x1fea00[_0xd43d('0x1e')]({'plain':!![]});_0x56b805[_0xd43d('0x1f')]=_0x1e8a16;_0x56b805[_0xd43d('0x2e')]=_0x1e8a16;_0x56b805[_0xd43d('0x2f')]=_0x56cd23?_0xd43d('0x36'):_0xd43d('0x35');var _0xac902e=_0xd43d('0x31')+_0x56b805[_0xd43d('0x21')];return db[_0xd43d('0x23')]['query'](_0xac902e,{'type':db[_0xd43d('0x25')][_0xd43d('0x26')]['SELECT'],'raw':!![]})[_0xd43d('0x18')](function(_0x32ef62){if(_0x32ef62){_0x56b805[_0xd43d('0x28')]=_0x32ef62[0x0];}if(typeof _0x56b805[_0xd43d('0x29')]==='undefined')return;return getAgent(_0x56b805[_0xd43d('0x29')]);})[_0xd43d('0x18')](function(_0x368252){if(_0x368252){_0x56b805['interface']=util[_0xd43d('0x2a')](_0xd43d('0x37'),_0x368252[_0xd43d('0x33')]);_0x56b805[_0xd43d('0x2b')]=_0x368252;}return request({'event':_0x197ff5,'message':_0x56b805});})['catch'](function(_0x35f0ae){logger[_0xd43d('0x1c')](_0xd43d('0x1a'),'AfterUpdate',_0x35f0ae);});}};}function getAgent(_0x52cf11){return db[_0xd43d('0x38')]['find']({'where':{'id':_0x52cf11},'attributes':['id',_0xd43d('0x33'),'fullname','email',_0xd43d('0x39')],'raw':!![]})[_0xd43d('0x18')](function(_0x51ca89){return _0x51ca89;});}exports[_0xd43d('0x3a')]=function(){for(var _0x487182=0x0;_0x487182<triggers[_0xd43d('0x3b')];_0x487182+=0x1){if(db[_0xd43d('0x3c')](triggers[_0x487182][_0xd43d('0x3d')])){db[triggers[_0x487182]['model']][_0xd43d('0x3e')](triggers[_0x487182]['event'],triggers[_0x487182]['callback'](triggers[_0x487182][_0xd43d('0x1f')]['toLowerCase'](),triggers[_0x487182]['condition']));}}};
\ No newline at end of file
+var _0xe73c=['closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','MailInteraction','Mail','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','info','error','code','Trigger,\x20%s','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','then','contact','UserId','interface','format','SIP/%s','agent','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened','query','SELECT','AfterCreate','closed','substatus','QueryTypes','name','AfterUpdate','User','fullname','internal','default','length','hasOwnProperty','model','hook','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','client','http','afterCreate','newinteraction','Chat','ChatInteraction','afterUpdate'];(function(_0xf20c6b,_0x581f61){var _0x471eb1=function(_0x2190e4){while(--_0x2190e4){_0xf20c6b['push'](_0xf20c6b['shift']());}};_0x471eb1(++_0x581f61);}(_0xe73c,0xda));var _0xce73=function(_0x27bec4,_0x25d069){_0x27bec4=_0x27bec4-0x0;var _0x28299b=_0xe73c[_0x27bec4];return _0x28299b;};'use strict';var util=require('util');var db=require(_0xce73('0x0'))['db'];var jayson=require(_0xce73('0x1'));var logger=require(_0xce73('0x2'))('triggers');var client=jayson[_0xce73('0x3')][_0xce73('0x4')]({'port':0x232a});var triggers=[{'channel':'Chat','model':'ChatInteraction','event':_0xce73('0x5'),'condition':_0xce73('0x6'),'callback':afterCreate},{'channel':_0xce73('0x7'),'model':_0xce73('0x8'),'event':_0xce73('0x9'),'condition':_0xce73('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0xce73('0xb'),'event':'afterCreate','condition':_0xce73('0xc'),'callback':afterCreateMessage},{'channel':_0xce73('0x7'),'model':_0xce73('0xd'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xce73('0xe'),'model':_0xce73('0xf'),'event':_0xce73('0x5'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xce73('0xe'),'model':_0xce73('0xf'),'event':_0xce73('0x9'),'condition':_0xce73('0xa'),'callback':afterUpdate},{'channel':_0xce73('0xe'),'model':_0xce73('0x10'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateMessage},{'channel':_0xce73('0x11'),'model':_0xce73('0x12'),'event':'afterCreate','condition':_0xce73('0x6'),'callback':afterCreate},{'channel':_0xce73('0x11'),'model':_0xce73('0x12'),'event':_0xce73('0x9'),'condition':_0xce73('0xa'),'callback':afterUpdate},{'channel':_0xce73('0x11'),'model':_0xce73('0x13'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateMessage},{'channel':_0xce73('0x14'),'model':_0xce73('0x15'),'event':_0xce73('0x5'),'condition':_0xce73('0x6'),'callback':afterCreate},{'channel':_0xce73('0x14'),'model':_0xce73('0x15'),'event':_0xce73('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xce73('0x14'),'model':_0xce73('0x16'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xce73('0x17'),'event':_0xce73('0x5'),'condition':_0xce73('0x6'),'callback':afterCreate},{'channel':_0xce73('0x18'),'model':_0xce73('0x17'),'event':_0xce73('0x9'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xce73('0x18'),'model':'MailMessage','event':_0xce73('0x5'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xce73('0x19'),'model':_0xce73('0x1a'),'event':'afterCreate','condition':_0xce73('0x6'),'callback':afterCreate},{'channel':'Openchannel','model':_0xce73('0x1a'),'event':_0xce73('0x9'),'condition':_0xce73('0xa'),'callback':afterUpdate},{'channel':_0xce73('0x19'),'model':_0xce73('0x1b'),'event':_0xce73('0x5'),'condition':_0xce73('0xc'),'callback':afterCreateMessage}];function request(_0x5bbdfa){return client[_0xce73('0x1c')](_0xce73('0x1d'),_0x5bbdfa)['then'](function(_0x38acd0){logger[_0xce73('0x1e')]('Trigger,\x20%s',_0xce73('0x1d'),_0x38acd0);if(_0x38acd0[_0xce73('0x1f')]){if(_0x38acd0[_0xce73('0x1f')][_0xce73('0x20')]===0x1f4){logger['error'](_0xce73('0x21'),_0xce73('0x1d'),_0x38acd0['error']);}}})[_0xce73('0x22')](function(_0x4a9639){logger[_0xce73('0x1f')](_0xce73('0x21'),_0xce73('0x1d'),_0x4a9639);});}function afterCreateMessage(_0x4cd0e3){return function(_0x306e5e){_0x306e5e=_0x306e5e[_0xce73('0x23')]({'plain':!![]});_0x306e5e[_0xce73('0x24')]=_0x4cd0e3;_0x306e5e[_0xce73('0x25')]=_0x4cd0e3;_0x306e5e[_0xce73('0x26')]=_0x306e5e[_0xce73('0x27')];Promise[_0xce73('0x28')]()['then'](function(){if(typeof _0x306e5e[_0xce73('0x29')]===_0xce73('0x2a'))return null;var _0xf708ba=_0xce73('0x2b')+_0x306e5e[_0xce73('0x29')];return db[_0xce73('0x2c')]['query'](_0xf708ba,{'type':db[_0xce73('0x2d')]['QueryTypes']['SELECT'],'raw':!![]});})[_0xce73('0x2e')](function(_0x3a3e32){if(_0x3a3e32){_0x306e5e[_0xce73('0x2f')]=_0x3a3e32[0x0];}if(typeof _0x306e5e['UserId']===_0xce73('0x2a'))return;return getAgent(_0x306e5e[_0xce73('0x30')]);})[_0xce73('0x2e')](function(_0xbb9de0){if(_0xbb9de0){_0x306e5e[_0xce73('0x31')]=util[_0xce73('0x32')](_0xce73('0x33'),_0xbb9de0['name']);_0x306e5e[_0xce73('0x34')]=_0xbb9de0;_0x306e5e[_0xce73('0x24')]=_0x4cd0e3;return request({'event':_0xce73('0x35'),'message':_0x306e5e});}else{return request({'event':_0xce73('0x36'),'message':_0x306e5e});}})[_0xce73('0x22')](function(_0x493280){logger['error'](_0xce73('0x21'),_0xce73('0x37'),_0x493280);});};}function afterCreateOfflineMessage(_0x34fa0b){return function(_0x5ac873){_0x5ac873=_0x5ac873[_0xce73('0x23')]({'plain':!![]});_0x5ac873[_0xce73('0x24')]=_0x34fa0b;_0x5ac873['motionChannel']=_0x34fa0b;_0x5ac873[_0xce73('0x26')]=_0xce73('0x38');return request({'event':_0x5ac873[_0xce73('0x26')],'message':_0x5ac873});};}function afterCreate(_0x3f535d,_0x13898b){return function(_0x54e35d){_0x54e35d=_0x54e35d['get']({'plain':!![]});_0x54e35d[_0xce73('0x24')]=_0x3f535d;_0x54e35d[_0xce73('0x25')]=_0x3f535d;_0x54e35d['event']=_0xce73('0x39');Promise[_0xce73('0x28')]()['then'](function(){var _0x45873d=_0xce73('0x2b')+_0x54e35d[_0xce73('0x29')];return db['sequelize'][_0xce73('0x3a')](_0x45873d,{'type':db['Sequelize']['QueryTypes'][_0xce73('0x3b')],'raw':!![]});})[_0xce73('0x2e')](function(_0x24e184){if(_0x24e184){_0x54e35d[_0xce73('0x2f')]=_0x24e184[0x0];}if(typeof _0x54e35d[_0xce73('0x30')]===_0xce73('0x2a'))return;return getAgent(_0x54e35d['UserId']);})[_0xce73('0x2e')](function(_0x3c0b97){if(_0x3c0b97){_0x54e35d[_0xce73('0x31')]=util[_0xce73('0x32')](_0xce73('0x33'),_0x3c0b97['name']);_0x54e35d[_0xce73('0x34')]=_0x3c0b97;}return request({'event':_0x13898b,'message':_0x54e35d});})['catch'](function(_0x12f533){logger[_0xce73('0x1f')](_0xce73('0x21'),_0xce73('0x3c'),_0x12f533);});};}function afterUpdate(_0x2aa955){return function(_0x5c9f05){var _0x698a4e=_0x5c9f05['changed'](_0xce73('0x3d'))&&_0x5c9f05[_0xce73('0x3d')];var _0xe7535c=_0x5c9f05['changed'](_0xce73('0x3e'));if(_0x698a4e||_0xe7535c){var _0x2e0cf6=_0x698a4e?_0xce73('0xa'):'substatus';var _0xe284fc=_0x5c9f05[_0xce73('0x23')]({'plain':!![]});_0xe284fc['channel']=_0x2aa955;_0xe284fc[_0xce73('0x25')]=_0x2aa955;_0xe284fc[_0xce73('0x26')]=_0x698a4e?'closed':_0xce73('0x3e');var _0x3c8d93=_0xce73('0x2b')+_0xe284fc[_0xce73('0x29')];return db[_0xce73('0x2c')]['query'](_0x3c8d93,{'type':db['Sequelize'][_0xce73('0x3f')][_0xce73('0x3b')],'raw':!![]})[_0xce73('0x2e')](function(_0x2ad862){if(_0x2ad862){_0xe284fc[_0xce73('0x2f')]=_0x2ad862[0x0];}if(typeof _0xe284fc[_0xce73('0x30')]===_0xce73('0x2a'))return;return getAgent(_0xe284fc['UserId']);})[_0xce73('0x2e')](function(_0x4f9db4){if(_0x4f9db4){_0xe284fc['interface']=util[_0xce73('0x32')](_0xce73('0x33'),_0x4f9db4[_0xce73('0x40')]);_0xe284fc[_0xce73('0x34')]=_0x4f9db4;}return request({'event':_0x2e0cf6,'message':_0xe284fc});})[_0xce73('0x22')](function(_0x1ad5bd){logger[_0xce73('0x1f')]('Trigger,\x20%s',_0xce73('0x41'),_0x1ad5bd);});}};}function getAgent(_0x54091a){return db[_0xce73('0x42')]['find']({'where':{'id':_0x54091a},'attributes':['id',_0xce73('0x40'),_0xce73('0x43'),'email',_0xce73('0x44')],'raw':!![]})['then'](function(_0x5c0b48){return _0x5c0b48;});}exports[_0xce73('0x45')]=function(){for(var _0x44de5d=0x0;_0x44de5d<triggers[_0xce73('0x46')];_0x44de5d+=0x1){if(db[_0xce73('0x47')](triggers[_0x44de5d][_0xce73('0x48')])){db[triggers[_0x44de5d][_0xce73('0x48')]][_0xce73('0x49')](triggers[_0x44de5d][_0xce73('0x26')],triggers[_0x44de5d]['callback'](triggers[_0x44de5d]['channel'][_0xce73('0x4a')](),triggers[_0x44de5d][_0xce73('0x4b')]));}}};
\ No newline at end of file
index 9296805..91088b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdb7c=['then','agents','catch','lodash','../mysqldb','./license/util','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xdb7c,0x161));var _0xcdb7=function(_0x231a47,_0x46a963){_0x231a47=_0x231a47-0x0;var _0x48d7c9=_0xdb7c[_0x231a47];return _0x48d7c9;};'use strict';var _=require(_0xcdb7('0x0'));var BPromise=require('bluebird');var db=require(_0xcdb7('0x1'))['db'];var util=require(_0xcdb7('0x2'));var channels=[_0xcdb7('0x3'),_0xcdb7('0x4'),_0xcdb7('0x5'),_0xcdb7('0x6'),_0xcdb7('0x7'),'whatsapp',_0xcdb7('0x8')];exports[_0xcdb7('0x9')]=function(){return channels;};exports[_0xcdb7('0xa')]=function(_0x1ff493){_0x1ff493=_0x1ff493[_0xcdb7('0xb')]();return _[_0xcdb7('0xc')](channels,_0x1ff493);};exports[_0xcdb7('0xd')]=function(_0x34c39a,_0x3b5e83,_0x1ffd2d,_0x161018){var _0x85c9e8={'loginAttempts':_0x3b5e83,'blocked':_0x1ffd2d};if(!_[_0xcdb7('0xe')](_0x161018)){_0x85c9e8[_0xcdb7('0xf')]=_0x161018;}return _0x34c39a[_0xcdb7('0x10')](_0x85c9e8);};exports[_0xcdb7('0x11')]=function(_0x2ae5e9){return new BPromise(function(_0x597f03,_0x3ccb11){var _0x918cfa=0x0;if(_0x2ae5e9[_0xcdb7('0x12')]!==_0xcdb7('0x13')){_0x597f03(_0x2ae5e9);}db[_0xcdb7('0x14')][_0xcdb7('0x15')]({'where':{'role':_0xcdb7('0x13'),'online':!![],'id':{'$ne':_0x2ae5e9['id']}}})[_0xcdb7('0x16')](function(_0x1e2fbe){_0x918cfa=_0x1e2fbe;return util[_0xcdb7('0x11')]();})['then'](function(_0x516fb0){if(_0x516fb0&&_0x516fb0[_0xcdb7('0x17')]&&_0x918cfa>=_0x516fb0[_0xcdb7('0x17')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x597f03(_0x2ae5e9);})[_0xcdb7('0x18')](function(_0x556918){_0x3ccb11(_0x556918);});});};
\ No newline at end of file
+var _0xd319=['voice','mail','chat','fax','whatsapp','getChannels','isValidChannel','toLowerCase','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util'];(function(_0x3bbe88,_0x294d97){var _0x53a583=function(_0x276d58){while(--_0x276d58){_0x3bbe88['push'](_0x3bbe88['shift']());}};_0x53a583(++_0x294d97);}(_0xd319,0x16c));var _0x9d31=function(_0x3512a9,_0xc47d84){_0x3512a9=_0x3512a9-0x0;var _0x1f052a=_0xd319[_0x3512a9];return _0x1f052a;};'use strict';var _=require(_0x9d31('0x0'));var BPromise=require(_0x9d31('0x1'));var db=require(_0x9d31('0x2'))['db'];var util=require(_0x9d31('0x3'));var channels=[_0x9d31('0x4'),_0x9d31('0x5'),_0x9d31('0x6'),_0x9d31('0x7'),'sms',_0x9d31('0x8'),'openchannel'];exports[_0x9d31('0x9')]=function(){return channels;};exports[_0x9d31('0xa')]=function(_0x1d9212){_0x1d9212=_0x1d9212[_0x9d31('0xb')]();return _['includes'](channels,_0x1d9212);};exports['clearBlockUser']=function(_0x4cf6b7,_0x5747c0,_0x15585a,_0xe144ef){var _0x491fc7={'loginAttempts':_0x5747c0,'blocked':_0x15585a};if(!_[_0x9d31('0xc')](_0xe144ef)){_0x491fc7[_0x9d31('0xd')]=_0xe144ef;}return _0x4cf6b7[_0x9d31('0xe')](_0x491fc7);};exports[_0x9d31('0xf')]=function(_0x277e25){return new BPromise(function(_0x52deb3,_0x2890d4){var _0x3540fb=0x0;if(_0x277e25[_0x9d31('0x10')]!==_0x9d31('0x11')){_0x52deb3(_0x277e25);}db[_0x9d31('0x12')][_0x9d31('0x13')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x277e25['id']}}})[_0x9d31('0x14')](function(_0x17900a){_0x3540fb=_0x17900a;return util[_0x9d31('0xf')]();})['then'](function(_0x44d54c){if(_0x44d54c&&_0x44d54c['agents']&&_0x3540fb>=_0x44d54c['agents']){throw Error(_0x9d31('0x15'));}_0x52deb3(_0x277e25);})[_0x9d31('0x16')](function(_0x4436d2){_0x2890d4(_0x4436d2);});});};
\ No newline at end of file
index 975e81e..a458ec0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['statusMessage','status','send','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error','stack'];(function(_0x19c45f,_0x3d8717){var _0x517607=function(_0x2bd7ec){while(--_0x2bd7ec){_0x19c45f['push'](_0x19c45f['shift']());}};_0x517607(++_0x3d8717);}(_0x814b,0x1a2));var _0xb814=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0x814b[_0x2b737c];return _0x466ed5;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var APIError=function(_0x2f4ece,_0xfbb64b){this[_0xb814('0x3')]=_0x2f4ece||'Internal\x20Server\x20Error';this[_0xb814('0x4')]=_0xfbb64b||_0xb814('0x5');util[_0xb814('0x6')](APIError,Error);};var APIBadRequestError=function(_0x4237bc){this[_0xb814('0x3')]=_0x4237bc||_0xb814('0x7');this['name']=_0xb814('0x7');util[_0xb814('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5c8539){this[_0xb814('0x3')]=_0x5c8539||_0xb814('0x8');this[_0xb814('0x4')]=_0xb814('0x9');util[_0xb814('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x21d4a5){this[_0xb814('0x3')]=_0x21d4a5||_0xb814('0xa');this[_0xb814('0x4')]=_0xb814('0xb');util[_0xb814('0x6')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x4b5f14){switch(_0x4b5f14){case _0xb814('0x7'):return 0x190;case'Forbidden',_0xb814('0xb'):return 0x193;case _0xb814('0x9'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x35b10d){if(_0x35b10d===_0xb814('0xb'))return _0x35b10d;return null;}function handleError(_0x2ce718){return function(_0x3bde14){logger[_0xb814('0xc')](_0x3bde14[_0xb814('0xd')]);var _0xa0a2e5=getStatusCode(_0x3bde14[_0xb814('0x4')]);var _0x3f4881=getCustomStatusMessage(_0x3bde14[_0xb814('0x4')]);if(_0x3bde14[_0xb814('0x4')])delete _0x3bde14[_0xb814('0x4')];if(_0x3f4881)_0x2ce718[_0xb814('0xe')]=_0x3f4881;return _0x2ce718[_0xb814('0xf')](_0xa0a2e5)[_0xb814('0x10')](_0x3bde14);};}module[_0xb814('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
+var _0xc4aa=['stack','statusMessage','status','exports','util','../config/logger','api','message','inherits','Bad\x20Request','name','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','error'];(function(_0x3fc589,_0x1e16b6){var _0x59c8b5=function(_0x573bb6){while(--_0x573bb6){_0x3fc589['push'](_0x3fc589['shift']());}};_0x59c8b5(++_0x1e16b6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var APIError=function(_0x351dd5,_0x275161){this[_0xac4a('0x3')]=_0x351dd5||'Internal\x20Server\x20Error';this['name']=_0x275161||'Error';util[_0xac4a('0x4')](APIError,Error);};var APIBadRequestError=function(_0x15b967){this[_0xac4a('0x3')]=_0x15b967||_0xac4a('0x5');this[_0xac4a('0x6')]=_0xac4a('0x5');util[_0xac4a('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x10525b){this['message']=_0x10525b||'Entity\x20not\x20found';this[_0xac4a('0x6')]=_0xac4a('0x7');util[_0xac4a('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x4f4146){this[_0xac4a('0x3')]=_0x4f4146||_0xac4a('0x8');this[_0xac4a('0x6')]='Out\x20Of\x20Interval';util[_0xac4a('0x4')](APIOutOfIntervalError,APIError);};function getStatusCode(_0x488e3c){switch(_0x488e3c){case _0xac4a('0x5'):return 0x190;case'Forbidden',_0xac4a('0x9'):return 0x193;case _0xac4a('0x7'):return 0x194;default:return 0x1f4;}}function getCustomStatusMessage(_0x24291d){if(_0x24291d==='Out\x20Of\x20Interval')return _0x24291d;return null;}function handleError(_0x21a79){return function(_0x68424a){logger[_0xac4a('0xa')](_0x68424a[_0xac4a('0xb')]);var _0x1b4313=getStatusCode(_0x68424a[_0xac4a('0x6')]);var _0x34bc01=getCustomStatusMessage(_0x68424a[_0xac4a('0x6')]);if(_0x68424a[_0xac4a('0x6')])delete _0x68424a[_0xac4a('0x6')];if(_0x34bc01)_0x21a79[_0xac4a('0xc')]=_0x34bc01;return _0x21a79[_0xac4a('0xd')](_0x1b4313)['send'](_0x68424a);};}module[_0xac4a('0xe')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIOutOfIntervalError':APIOutOfIntervalError,'APINotFoundError':APINotFoundError,'handleError':handleError};
\ No newline at end of file
index c92aea6..fbd50fe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc37e=['status','render','json','exports','404'];(function(_0x2c18a8,_0x24eaa5){var _0x1e009a=function(_0x5dea3a){while(--_0x5dea3a){_0x2c18a8['push'](_0x2c18a8['shift']());}};_0x1e009a(++_0x24eaa5);}(_0xc37e,0x152));var _0xec37=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xc37e[_0x46e363];return _0x3fb059;};'use strict';module[_0xec37('0x0')][0x194]=function pageNotFound(_0x12208d,_0x6cf0c0){var _0x105be6=_0xec37('0x1');var _0x346a20=0x194;var _0x9b6de4={'status':_0x346a20};_0x6cf0c0[_0xec37('0x2')](_0x9b6de4[_0xec37('0x2')]);_0x6cf0c0[_0xec37('0x3')](_0x105be6,{},function(_0x5963a2,_0x24edf8){if(_0x5963a2){return _0x6cf0c0[_0xec37('0x2')](_0x9b6de4[_0xec37('0x2')])[_0xec37('0x4')](_0x9b6de4);}_0x6cf0c0['send'](_0x24edf8);});};
\ No newline at end of file
+var _0x5da6=['render','send','exports','404','status'];(function(_0x557fd2,_0x2c0a7a){var _0x1b54a2=function(_0x2e439b){while(--_0x2e439b){_0x557fd2['push'](_0x557fd2['shift']());}};_0x1b54a2(++_0x2c0a7a);}(_0x5da6,0x1ec));var _0x65da=function(_0x3ef025,_0x31f409){_0x3ef025=_0x3ef025-0x0;var _0x32f8aa=_0x5da6[_0x3ef025];return _0x32f8aa;};'use strict';module[_0x65da('0x0')][0x194]=function pageNotFound(_0x2be4f5,_0x446881){var _0x561375=_0x65da('0x1');var _0x125e39=0x194;var _0x549bee={'status':_0x125e39};_0x446881[_0x65da('0x2')](_0x549bee[_0x65da('0x2')]);_0x446881[_0x65da('0x3')](_0x561375,{},function(_0x310b82,_0x56ee19){if(_0x310b82){return _0x446881['status'](_0x549bee[_0x65da('0x2')])['json'](_0x549bee);}_0x446881[_0x65da('0x4')](_0x56ee19);});};
\ No newline at end of file
diff --git a/server/migrations/2.6.23.js b/server/migrations/2.6.23.js
new file mode 100644 (file)
index 0000000..a59425a
--- /dev/null
@@ -0,0 +1,169 @@
+'use strict';
+
+var BPromise = require('bluebird');
+var util = require('util');
+var logger = require('../config/logger')('migration');
+var Sequence = function() {};
+
+Sequence.prototype.enqueue = function(fn) {
+  this.tail = this.tail ? this.tail.finally(fn) : fn();
+};
+
+var Migration = function(queryInterface) {
+  this.queryInterface = queryInterface;
+  this.sequence = new Sequence();
+};
+
+Migration.prototype.changeColumn = function(table, column, type) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .changeColumn(table, column, type)
+      .then(function() {
+        logger.info('Changed column %s in table %s', column, table);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.addColumn = function(table, column, type) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .addColumn(table, column, type)
+      .then(function() {
+        logger.info('Added column %s to %s', column, table);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.dropTable = function(table) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .dropTable(table, {
+        force: true,
+      })
+      .then(function() {
+        logger.info('table dropped %s', table);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.addIndex = function(table, column, indexName) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .addIndex(table, column, {
+        indexName: indexName,
+      })
+      .then(function() {
+        logger.info('addIndex %s %s %s', table, column.join(','), indexName);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.removeIndex = function(table, indexName) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .removeIndex(table, indexName)
+      .then(function() {
+        logger.info('removeIndex %s %s', table, indexName);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.query = function(sql) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface.sequelize
+      .query(sql)
+      .then(function() {
+        logger.info('query %s', sql);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.removeColumn = function(table, column) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .removeColumn(table, column)
+      .then(function() {
+        logger.info('Removed column %s from %s', column, table);
+      })
+      .catch(function(err) {
+        logger.info(
+          util.inspect(err, {
+            showHidden: false,
+            depth: null,
+          })
+        );
+      });
+  });
+};
+
+Migration.prototype.renameColumn = function(table, oldColumn, newColumn) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .renameColumn(table, oldColumn, newColumn)
+      .then(function() {
+        logger.info(
+          'Renamed column from %s to %s on %s',
+          oldColumn,
+          newColumn,
+          table
+        );
+      })
+      .catch(function(err) {
+        logger.info(
+          util.inspect(err, {
+            showHidden: false,
+            depth: null,
+          })
+        );
+      });
+  });
+};
+
+Migration.prototype.final = function(resolve) {
+  this.sequence.enqueue(function() {
+    return resolve();
+  });
+};
+
+module.exports = {
+  up: function(queryInterface /*, Sequelize */) {
+    return new BPromise(function(resolve) {
+      var migration = new Migration(queryInterface);
+      // Add your migration code here
+
+      // START FINAL
+      migration.final(resolve);
+      // END FINAL
+    });
+  },
+
+  down: function( /* queryInterface, Sequelize */ ) {
+    // var migration = new Migration(queryInterface);
+  },
+};
\ No newline at end of file
diff --git a/server/migrations/2.6.24.js b/server/migrations/2.6.24.js
new file mode 100644 (file)
index 0000000..8a6a70b
--- /dev/null
@@ -0,0 +1,172 @@
+'use strict';
+
+var BPromise = require('bluebird');
+var util = require('util');
+var logger = require('../config/logger')('migration');
+var Sequence = function() {};
+
+Sequence.prototype.enqueue = function(fn) {
+  this.tail = this.tail ? this.tail.finally(fn) : fn();
+};
+
+var Migration = function(queryInterface) {
+  this.queryInterface = queryInterface;
+  this.sequence = new Sequence();
+};
+
+Migration.prototype.changeColumn = function(table, column, type) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .changeColumn(table, column, type)
+      .then(function() {
+        logger.info('Changed column %s in table %s', column, table);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.addColumn = function(table, column, type) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .addColumn(table, column, type)
+      .then(function() {
+        logger.info('Added column %s to %s', column, table);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.dropTable = function(table) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .dropTable(table, {
+        force: true,
+      })
+      .then(function() {
+        logger.info('table dropped %s', table);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.addIndex = function(table, column, indexName) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .addIndex(table, column, {
+        indexName: indexName,
+      })
+      .then(function() {
+        logger.info('addIndex %s %s %s', table, column.join(','), indexName);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.removeIndex = function(table, indexName) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .removeIndex(table, indexName)
+      .then(function() {
+        logger.info('removeIndex %s %s', table, indexName);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.query = function(sql) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface.sequelize
+      .query(sql)
+      .then(function() {
+        logger.info('query %s', sql);
+      })
+      .catch(function(err) {
+        logger.info(JSON.stringify(err));
+      });
+  });
+};
+
+Migration.prototype.removeColumn = function(table, column) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .removeColumn(table, column)
+      .then(function() {
+        logger.info('Removed column %s from %s', column, table);
+      })
+      .catch(function(err) {
+        logger.info(
+          util.inspect(err, {
+            showHidden: false,
+            depth: null,
+          })
+        );
+      });
+  });
+};
+
+Migration.prototype.renameColumn = function(table, oldColumn, newColumn) {
+  var _this = this;
+  this.sequence.enqueue(function() {
+    return _this.queryInterface
+      .renameColumn(table, oldColumn, newColumn)
+      .then(function() {
+        logger.info(
+          'Renamed column from %s to %s on %s',
+          oldColumn,
+          newColumn,
+          table
+        );
+      })
+      .catch(function(err) {
+        logger.info(
+          util.inspect(err, {
+            showHidden: false,
+            depth: null,
+          })
+        );
+      });
+  });
+};
+
+Migration.prototype.final = function(resolve) {
+  this.sequence.enqueue(function() {
+    return resolve();
+  });
+};
+
+module.exports = {
+  up: function(queryInterface, Sequelize ) {
+    return new BPromise(function(resolve) {
+      var migration = new Migration(queryInterface);
+      // Add your migration code here
+      migration.addColumn('settings', 'filterFullName', {
+        type: Sequelize.BOOLEAN,
+        defaultValue: false,
+      })
+      // START FINAL
+      migration.final(resolve);
+      // END FINAL
+    });
+  },
+
+  down: function( /* queryInterface, Sequelize */ ) {
+    // var migration = new Migration(queryInterface);
+  },
+};
\ No newline at end of file
index cd745af..00ae539 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x5534fe,_0x43c22e){var _0x3d1dc2=function(_0x9df12){while(--_0x9df12){_0x5534fe['push'](_0x5534fe['shift']());}};_0x3d1dc2(++_0x43c22e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa9e0[_0x55f8b4];return _0x2475f9;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH};
\ No newline at end of file
+var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x4226d6,_0x3864ca){var _0x19655b=function(_0x1d43a1){while(--_0x1d43a1){_0x4226d6['push'](_0x4226d6['shift']());}};_0x19655b(++_0x3864ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH};
\ No newline at end of file
index 060a13d..d31dc8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2746=['/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','./api/squareProject','/api/square/messages','/api/teams','./api/team','/api/campaigns','./api/campaign','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceCallReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','./api/faxInteraction','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/trigger','./api/variable','/api/integrations/reports','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport'];(function(_0xf0bc07,_0x510ebf){var _0x1c50c2=function(_0x2e2bdf){while(--_0x2e2bdf){_0xf0bc07['push'](_0xf0bc07['shift']());}};_0x1c50c2(++_0x510ebf);}(_0x2746,0x19c));var _0x6274=function(_0x3cfd69,_0x3cec9f){_0x3cfd69=_0x3cfd69-0x0;var _0x282fe9=_0x2746[_0x3cfd69];return _0x282fe9;};'use strict';var path=require('path');var express=require('express');var errors=require(_0x6274('0x0'));var config=require(_0x6274('0x1'));var setupLoggers=require(_0x6274('0x2'))[_0x6274('0x3')];var clientSideLogs=require(_0x6274('0x4'));exports[_0x6274('0x5')]=function(_0x4ab07e){return setupLoggers(_0x4ab07e)['then'](function(){_0x4ab07e[_0x6274('0x6')](_0x6274('0x7'),require(_0x6274('0x8')));_0x4ab07e['use'](_0x6274('0x9'),require(_0x6274('0xa')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xb'),require(_0x6274('0xc')));_0x4ab07e['use'](_0x6274('0xd'),require('./api/voiceExtension'));_0x4ab07e[_0x6274('0x6')](_0x6274('0xe'),require(_0x6274('0xf')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x10'),require(_0x6274('0x11')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x12'),require(_0x6274('0x13')));_0x4ab07e['use']('/api/screen/recordings',require('./api/screenRecording'));_0x4ab07e[_0x6274('0x6')]('/api/voice/mails',require(_0x6274('0x14')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x15'),require('./api/voiceMailMessage'));_0x4ab07e[_0x6274('0x6')]('/api/voice/calls/reports',require(_0x6274('0x16')));_0x4ab07e[_0x6274('0x6')]('/api/voice/dials/reports',require('./api/voiceDialReport'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x17'),require(_0x6274('0x18')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x19'),require('./api/voiceQueueReport'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x1a'),require(_0x6274('0x1b')));_0x4ab07e['use']('/api/trunks',require(_0x6274('0x1c')));_0x4ab07e['use']('/api/voice/transfers/reports',require(_0x6274('0x1d')));_0x4ab07e['use'](_0x6274('0x1e'),require(_0x6274('0x1f')));_0x4ab07e['use']('/api/mail/accounts',require(_0x6274('0x20')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x21'),require(_0x6274('0x22')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x23'),require(_0x6274('0x24')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x25'),require(_0x6274('0x26')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x27'),require(_0x6274('0x28')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x29'),require(_0x6274('0x2a')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x2b'),require('./api/mailQueueReport'));_0x4ab07e[_0x6274('0x6')]('/api/dashboards',require(_0x6274('0x2c')));_0x4ab07e['use'](_0x6274('0x2d'),require(_0x6274('0x2e')));_0x4ab07e['use'](_0x6274('0x2f'),require('./api/faxAccount'));_0x4ab07e['use'](_0x6274('0x30'),require(_0x6274('0x31')));_0x4ab07e[_0x6274('0x6')]('/api/fax/interactions',require(_0x6274('0x32')));_0x4ab07e['use']('/api/fax/messages',require('./api/faxMessage'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x33'),require(_0x6274('0x34')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x35'),require(_0x6274('0x36')));_0x4ab07e['use'](_0x6274('0x37'),require(_0x6274('0x38')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x39'),require(_0x6274('0x3a')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x3b'),require('./api/smsInteraction'));_0x4ab07e['use'](_0x6274('0x3c'),require(_0x6274('0x3d')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x3e'),require(_0x6274('0x3f')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x40'),require(_0x6274('0x41')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x42'),require(_0x6274('0x43')));_0x4ab07e[_0x6274('0x6')]('/api/openchannel/interactions',require(_0x6274('0x44')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x45'),require(_0x6274('0x46')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x47'),require('./api/openchannelQueue'));_0x4ab07e['use']('/api/chat/websites',require(_0x6274('0x48')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x49'),require(_0x6274('0x4a')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x4b'),require(_0x6274('0x4c')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x4d'),require(_0x6274('0x4e')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x4f'),require(_0x6274('0x50')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x51'),require(_0x6274('0x52')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x53'),require('./api/chatQueue'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x54'),require(_0x6274('0x55')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x56'),require(_0x6274('0x57')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x58'),require('./api/cmCompany'));_0x4ab07e['use'](_0x6274('0x59'),require(_0x6274('0x5a')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x5b'),require(_0x6274('0x5c')));_0x4ab07e[_0x6274('0x6')]('/api/cm/hopper_black',require('./api/cmHopperBlack'));_0x4ab07e[_0x6274('0x6')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x4ab07e['use'](_0x6274('0x5d'),require('./api/cmHopperHistory'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x5e'),require(_0x6274('0x5f')));_0x4ab07e[_0x6274('0x6')]('/api/actions',require(_0x6274('0x60')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x61'),require('./api/automation'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x62'),require(_0x6274('0x63')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x64'),require(_0x6274('0x65')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x66'),require('./api/condition'));_0x4ab07e['use']('/api/intervals',require(_0x6274('0x67')));_0x4ab07e[_0x6274('0x6')]('/api/pauses',require(_0x6274('0x68')));_0x4ab07e[_0x6274('0x6')]('/api/cdr',require(_0x6274('0x69')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x6a'),require(_0x6274('0x6b')));_0x4ab07e['use'](_0x6274('0x6c'),require(_0x6274('0x6d')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x6e'),require('./api/sound'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x6f'),require('./api/tag'));_0x4ab07e['use'](_0x6274('0x70'),require(_0x6274('0x71')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x72'),require(_0x6274('0x73')));_0x4ab07e['use'](_0x6274('0x74'),require(_0x6274('0x75')));_0x4ab07e['use'](_0x6274('0x76'),require('./api/template'));_0x4ab07e[_0x6274('0x6')]('/api/triggers',require(_0x6274('0x77')));_0x4ab07e[_0x6274('0x6')]('/api/variables',require(_0x6274('0x78')));_0x4ab07e[_0x6274('0x6')]('/api/integrations',require('./api/integration'));_0x4ab07e['use'](_0x6274('0x79'),require('./api/integrationReport'));_0x4ab07e['use'](_0x6274('0x7a'),require(_0x6274('0x7b')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x7c'),require(_0x6274('0x7d')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x7e'),require(_0x6274('0x7f')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x80'),require('./api/analyticMetric'));_0x4ab07e['use'](_0x6274('0x81'),require(_0x6274('0x82')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x83'),require(_0x6274('0x84')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x85'),require(_0x6274('0x86')));_0x4ab07e[_0x6274('0x6')]('/api/integrations/salesforce/configurations',require(_0x6274('0x87')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x88'),require(_0x6274('0x89')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x8a'),require(_0x6274('0x8b')));_0x4ab07e[_0x6274('0x6')]('/api/integrations/sugarcrm/configurations',require(_0x6274('0x8c')));_0x4ab07e['use']('/api/integrations/sugarcrm/fields',require(_0x6274('0x8d')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x8e'),require(_0x6274('0x8f')));_0x4ab07e['use']('/api/integrations/desk/configurations',require(_0x6274('0x90')));_0x4ab07e[_0x6274('0x6')]('/api/integrations/desk/fields',require(_0x6274('0x91')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x92'),require(_0x6274('0x93')));_0x4ab07e[_0x6274('0x6')]('/api/integrations/zoho/configurations',require(_0x6274('0x94')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x95'),require(_0x6274('0x96')));_0x4ab07e[_0x6274('0x6')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x97'),require(_0x6274('0x98')));_0x4ab07e[_0x6274('0x6')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x4ab07e[_0x6274('0x6')](_0x6274('0x99'),require(_0x6274('0x9a')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x9b'),require(_0x6274('0x9c')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x9d'),require(_0x6274('0x9e')));_0x4ab07e[_0x6274('0x6')](_0x6274('0x9f'),require(_0x6274('0xa0')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xa1'),require(_0x6274('0xa2')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xa3'),require(_0x6274('0xa4')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xa5'),require(_0x6274('0xa6')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xa7'),require(_0x6274('0xa8')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xa9'),require(_0x6274('0xaa')));_0x4ab07e[_0x6274('0x6')]('/api/integrations/dynamics365/accounts',require(_0x6274('0xab')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xac'),require(_0x6274('0xad')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xae'),require(_0x6274('0xaf')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xb0'),require(_0x6274('0xb1')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xb2'),require('./api/intFreshsalesConfiguration'));_0x4ab07e[_0x6274('0x6')](_0x6274('0xb3'),require(_0x6274('0xb4')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xb5'),require('./api/network'));_0x4ab07e['use']('/api/chat/reports/queue',require(_0x6274('0xb6')));_0x4ab07e[_0x6274('0x6')]('/api/chat/internal/messages',require(_0x6274('0xb7')));_0x4ab07e['use']('/api/jscripty/answers/reports',require('./api/jscriptyAnswerReport'));_0x4ab07e['use'](_0x6274('0xb8'),require(_0x6274('0xb9')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xba'),require(_0x6274('0xbb')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xbc'),require(_0x6274('0xbd')));_0x4ab07e['use'](_0x6274('0xbe'),require(_0x6274('0xbf')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xc0'),require(_0x6274('0xc1')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xc2'),require(_0x6274('0xc3')));_0x4ab07e['use'](_0x6274('0xc4'),require('./api/setting'));_0x4ab07e[_0x6274('0x6')](_0x6274('0xc5'),require(_0x6274('0xc6')));_0x4ab07e[_0x6274('0x6')]('/api/square/projects',require(_0x6274('0xc7')));_0x4ab07e[_0x6274('0x6')]('/api/square/recordings',require('./api/squareRecording'));_0x4ab07e['use'](_0x6274('0xc8'),require('./api/squareMessage'));_0x4ab07e[_0x6274('0x6')](_0x6274('0xc9'),require(_0x6274('0xca')));_0x4ab07e[_0x6274('0x6')]('/api/license',require('./api/license'));_0x4ab07e['use'](_0x6274('0xcb'),require(_0x6274('0xcc')));_0x4ab07e[_0x6274('0x6')]('/api/migrations',require(_0x6274('0xcd')));_0x4ab07e['use'](_0x6274('0xce'),require(_0x6274('0xcf')));_0x4ab07e[_0x6274('0x6')]('/api/plugins',require(_0x6274('0xd0')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xd1'),require(_0x6274('0xd2')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xd3'),require(_0x6274('0xd4')));_0x4ab07e[_0x6274('0x6')]('/api/fax/reports/transfer',require(_0x6274('0xd5')));_0x4ab07e['use'](_0x6274('0xd6'),require('./api/openchannelTransferReport'));_0x4ab07e[_0x6274('0x6')](_0x6274('0xd7'),require(_0x6274('0xd8')));_0x4ab07e[_0x6274('0x6')]('/api/cm/lists',require(_0x6274('0xd9')));_0x4ab07e['use'](_0x6274('0xda'),require(_0x6274('0xdb')));_0x4ab07e['use']('/api/userProfiles',require(_0x6274('0xdc')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xdd'),require(_0x6274('0xde')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xdf'),require(_0x6274('0xe0')));_0x4ab07e['use'](_0x6274('0xe1'),require(_0x6274('0xe2')));_0x4ab07e[_0x6274('0x6')]('/api/whatsapp/accounts',require(_0x6274('0xe3')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xe4'),require(_0x6274('0xe5')));_0x4ab07e['use'](_0x6274('0xe6'),require(_0x6274('0xe7')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xe8'),require(_0x6274('0xe9')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xea'),require('./api/whatsappQueueReport'));_0x4ab07e[_0x6274('0x6')](_0x6274('0xeb'),require(_0x6274('0xec')));_0x4ab07e[_0x6274('0x6')]('/api/whatsapp/queues',require(_0x6274('0xed')));_0x4ab07e[_0x6274('0x6')]('/api/cloudProviders',require(_0x6274('0xee')));_0x4ab07e[_0x6274('0x6')]('/api/realtime',require(_0x6274('0xef')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xf0'),require(_0x6274('0xf1')));_0x4ab07e['use'](_0x6274('0xf2'),require(_0x6274('0xf3')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xf4'),require(_0x6274('0xf5')));_0x4ab07e[_0x6274('0x6')]('/api/auth/activedirectory',require('./api/authActiveDirectory'));_0x4ab07e[_0x6274('0x6')](_0x6274('0xf6'),require('./api/jira'));_0x4ab07e['use'](_0x6274('0xf7'),require(_0x6274('0xf8')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xf9'),require(_0x6274('0xfa')));_0x4ab07e[_0x6274('0x6')]('/api/system',require(_0x6274('0xfb')));_0x4ab07e[_0x6274('0x6')](_0x6274('0xfc'),require(_0x6274('0xfd')));_0x4ab07e['use'](_0x6274('0xfe'),require(_0x6274('0xff')));_0x4ab07e['use'](_0x6274('0x100'),clientSideLogs);_0x4ab07e['use'](_0x6274('0x101'),express[_0x6274('0x102')](path['join'](config[_0x6274('0x103')],_0x6274('0x101'))));_0x4ab07e[_0x6274('0x6')](_0x6274('0x104'),express[_0x6274('0x102')](path[_0x6274('0x105')](config[_0x6274('0x103')],_0x6274('0x104'))));_0x4ab07e[_0x6274('0x6')]('/demo',express[_0x6274('0x102')](path['join'](config[_0x6274('0x103')],_0x6274('0x106'))));_0x4ab07e[_0x6274('0x6')](_0x6274('0x107'),express[_0x6274('0x102')](path[_0x6274('0x105')](config['root'],'snippet','3.5.0')));_0x4ab07e[_0x6274('0x6')]('/plugins',express[_0x6274('0x102')](path[_0x6274('0x105')](config[_0x6274('0x103')],'/server/files/plugins')));_0x4ab07e[_0x6274('0x108')](_0x6274('0x109'))['get'](errors[0x194]);_0x4ab07e['route']('/*')[_0x6274('0x10a')](function(_0x897397,_0x5ad69b){_0x5ad69b[_0x6274('0x10b')](path[_0x6274('0x10c')](_0x4ab07e[_0x6274('0x10a')]('appPath')+_0x6274('0x10d')));});return _0x4ab07e;});};
\ No newline at end of file
+var _0x57d4=['/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intZohoAccount','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','./api/squareMessage','/api/teams','./api/team','/api/license','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','/api/rpc','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','/index.html','path','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','/api/trunks','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/interactions','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','./api/disposition','/api/conditions','./api/condition','/api/intervals','/api/pauses','./api/pause','/api/cdr','./api/cdr','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount'];(function(_0x17e957,_0x21605a){var _0x5b9136=function(_0x175510){while(--_0x175510){_0x17e957['push'](_0x17e957['shift']());}};_0x5b9136(++_0x21605a);}(_0x57d4,0x78));var _0x457d=function(_0x53a90b,_0x25afdc){_0x53a90b=_0x53a90b-0x0;var _0x250c62=_0x57d4[_0x53a90b];return _0x250c62;};'use strict';var path=require(_0x457d('0x0'));var express=require(_0x457d('0x1'));var errors=require('./errors');var config=require(_0x457d('0x2'));var setupLoggers=require(_0x457d('0x3'))[_0x457d('0x4')];var clientSideLogs=require(_0x457d('0x5'));exports[_0x457d('0x6')]=function(_0x3c89b2){return setupLoggers(_0x3c89b2)[_0x457d('0x7')](function(){_0x3c89b2[_0x457d('0x8')](_0x457d('0x9'),require(_0x457d('0xa')));_0x3c89b2[_0x457d('0x8')]('/api/voice/chanspy',require(_0x457d('0xb')));_0x3c89b2[_0x457d('0x8')]('/api/voice/contexts',require('./api/voiceContext'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc'),require(_0x457d('0xd')));_0x3c89b2['use']('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe'),require(_0x457d('0xf')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x10'),require(_0x457d('0x11')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x12'),require(_0x457d('0x13')));_0x3c89b2['use'](_0x457d('0x14'),require(_0x457d('0x15')));_0x3c89b2['use']('/api/voice/mails/messages',require(_0x457d('0x16')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x17'),require(_0x457d('0x18')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x19'),require(_0x457d('0x1a')));_0x3c89b2[_0x457d('0x8')]('/api/voice/agents/reports',require(_0x457d('0x1b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x1c'),require('./api/voiceQueueReport'));_0x3c89b2['use'](_0x457d('0x1d'),require('./api/memberReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x1e'),require('./api/trunk'));_0x3c89b2[_0x457d('0x8')]('/api/voice/transfers/reports',require('./api/voiceTransferReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x1f'),require(_0x457d('0x20')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x21'),require(_0x457d('0x22')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x23'),require(_0x457d('0x24')));_0x3c89b2[_0x457d('0x8')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x3c89b2['use'](_0x457d('0x25'),require('./api/mailInteraction'));_0x3c89b2['use']('/api/mail/messages',require(_0x457d('0x26')));_0x3c89b2[_0x457d('0x8')]('/api/mail/applications',require(_0x457d('0x27')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x28'),require(_0x457d('0x29')));_0x3c89b2['use']('/api/dashboards',require(_0x457d('0x2a')));_0x3c89b2['use'](_0x457d('0x2b'),require(_0x457d('0x2c')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x2d'),require('./api/faxAccount'));_0x3c89b2[_0x457d('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x2e'),require('./api/faxInteraction'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x2f'),require('./api/faxMessage'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x30'),require(_0x457d('0x31')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x32'),require(_0x457d('0x33')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x34'),require(_0x457d('0x35')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x36'),require(_0x457d('0x37')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x38'),require(_0x457d('0x39')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x3a'),require(_0x457d('0x3b')));_0x3c89b2['use'](_0x457d('0x3c'),require(_0x457d('0x3d')));_0x3c89b2['use']('/api/openchannel/accounts',require(_0x457d('0x3e')));_0x3c89b2[_0x457d('0x8')]('/api/openchannel/applications',require(_0x457d('0x3f')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x40'),require(_0x457d('0x41')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x42'),require(_0x457d('0x43')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x44'),require(_0x457d('0x45')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x46'),require(_0x457d('0x47')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x48'),require('./api/openchannelQueueReport'));_0x3c89b2[_0x457d('0x8')]('/api/chat/applications',require('./api/chatApplication'));_0x3c89b2['use'](_0x457d('0x49'),require('./api/chatInteraction'));_0x3c89b2[_0x457d('0x8')]('/api/chat/messages',require('./api/chatMessage'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x4a'),require(_0x457d('0x4b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x4c'),require(_0x457d('0x4d')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x4e'),require(_0x457d('0x4f')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x50'),require(_0x457d('0x51')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x52'),require(_0x457d('0x53')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x54'),require('./api/cmContact'));_0x3c89b2[_0x457d('0x8')]('/api/cm/hopper',require(_0x457d('0x55')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x56'),require(_0x457d('0x57')));_0x3c89b2[_0x457d('0x8')]('/api/cm/hopper_final',require('./api/cmHopperFinal'));_0x3c89b2[_0x457d('0x8')]('/api/cm/hopper_history',require(_0x457d('0x58')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x59'),require('./api/cmCustomField'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x5a'),require(_0x457d('0x5b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x5c'),require(_0x457d('0x5d')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x5e'),require(_0x457d('0x5f')));_0x3c89b2['use']('/api/dispositions',require(_0x457d('0x60')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x61'),require(_0x457d('0x62')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x63'),require('./api/interval'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x64'),require(_0x457d('0x65')));_0x3c89b2['use'](_0x457d('0x66'),require(_0x457d('0x67')));_0x3c89b2[_0x457d('0x8')]('/api/voiceQueuesLog',require(_0x457d('0x68')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x69'),require(_0x457d('0x6a')));_0x3c89b2['use'](_0x457d('0x6b'),require(_0x457d('0x6c')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x6d'),require(_0x457d('0x6e')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x6f'),require(_0x457d('0x70')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x71'),require('./api/cmContactHasItem'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x72'),require(_0x457d('0x73')));_0x3c89b2[_0x457d('0x8')]('/api/templates',require(_0x457d('0x74')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x75'),require(_0x457d('0x76')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x77'),require(_0x457d('0x78')));_0x3c89b2[_0x457d('0x8')]('/api/integrations',require('./api/integration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x79'),require(_0x457d('0x7a')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x7b'),require(_0x457d('0x7c')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x7d'),require(_0x457d('0x7e')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x7f'),require(_0x457d('0x80')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x81'),require('./api/analyticMetric'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x82'),require(_0x457d('0x83')));_0x3c89b2[_0x457d('0x8')]('/api/analytics/tree_reports',require(_0x457d('0x84')));_0x3c89b2[_0x457d('0x8')]('/api/integrations/salesforce/accounts',require(_0x457d('0x85')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x86'),require('./api/intSalesforceConfiguration'));_0x3c89b2['use'](_0x457d('0x87'),require('./api/intSalesforceField'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x88'),require(_0x457d('0x89')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x8a'),require(_0x457d('0x8b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x8c'),require(_0x457d('0x8d')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x8e'),require(_0x457d('0x8f')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x90'),require('./api/intDeskConfiguration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x91'),require('./api/intDeskField'));_0x3c89b2[_0x457d('0x8')]('/api/integrations/zoho/accounts',require(_0x457d('0x92')));_0x3c89b2[_0x457d('0x8')]('/api/integrations/zoho/configurations',require(_0x457d('0x93')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x94'),require(_0x457d('0x95')));_0x3c89b2['use'](_0x457d('0x96'),require('./api/intZendeskAccount'));_0x3c89b2[_0x457d('0x8')]('/api/integrations/zendesk/configurations',require(_0x457d('0x97')));_0x3c89b2[_0x457d('0x8')]('/api/integrations/zendesk/fields',require(_0x457d('0x98')));_0x3c89b2['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x99'),require('./api/intFreshdeskConfiguration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0x9a'),require(_0x457d('0x9b')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x9c'),require(_0x457d('0x9d')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x9e'),require(_0x457d('0x9f')));_0x3c89b2['use']('/api/integrations/vtiger/fields',require(_0x457d('0xa0')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xa1'),require(_0x457d('0xa2')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xa3'),require(_0x457d('0xa4')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xa5'),require(_0x457d('0xa6')));_0x3c89b2['use']('/api/integrations/dynamics365/accounts',require(_0x457d('0xa7')));_0x3c89b2['use'](_0x457d('0xa8'),require('./api/intDynamics365Configuration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xa9'),require(_0x457d('0xaa')));_0x3c89b2['use']('/api/integrations/freshsales/accounts',require(_0x457d('0xab')));_0x3c89b2[_0x457d('0x8')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xac'),require('./api/intFreshsalesField'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xad'),require(_0x457d('0xae')));_0x3c89b2[_0x457d('0x8')]('/api/chat/reports/queue',require(_0x457d('0xaf')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb0'),require(_0x457d('0xb1')));_0x3c89b2[_0x457d('0x8')]('/api/jscripty/answers/reports',require(_0x457d('0xb2')));_0x3c89b2[_0x457d('0x8')]('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb3'),require(_0x457d('0xb4')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb5'),require(_0x457d('0xb6')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb7'),require('./api/squareReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xb8'),require(_0x457d('0xb9')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xba'),require('./api/jscriptyProject'));_0x3c89b2['use'](_0x457d('0xbb'),require('./api/setting'));_0x3c89b2['use'](_0x457d('0xbc'),require(_0x457d('0xbd')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xbe'),require(_0x457d('0xbf')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc0'),require(_0x457d('0xc1')));_0x3c89b2['use']('/api/square/messages',require(_0x457d('0xc2')));_0x3c89b2['use'](_0x457d('0xc3'),require(_0x457d('0xc4')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc5'),require('./api/license'));_0x3c89b2[_0x457d('0x8')]('/api/campaigns',require('./api/campaign'));_0x3c89b2[_0x457d('0x8')]('/api/migrations',require(_0x457d('0xc6')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc7'),require(_0x457d('0xc8')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xc9'),require(_0x457d('0xca')));_0x3c89b2[_0x457d('0x8')]('/api/mail/reports/transfer',require(_0x457d('0xcb')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xcc'),require(_0x457d('0xcd')));_0x3c89b2['use']('/api/fax/reports/transfer',require('./api/faxTransferReport'));_0x3c89b2['use'](_0x457d('0xce'),require('./api/openchannelTransferReport'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xcf'),require(_0x457d('0xd0')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xd1'),require(_0x457d('0xd2')));_0x3c89b2[_0x457d('0x8')]('/api/voice/prefixes',require(_0x457d('0xd3')));_0x3c89b2[_0x457d('0x8')]('/api/userProfiles',require('./api/userProfile'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xd4'),require(_0x457d('0xd5')));_0x3c89b2['use'](_0x457d('0xd6'),require(_0x457d('0xd7')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xd8'),require(_0x457d('0xd9')));_0x3c89b2['use'](_0x457d('0xda'),require('./api/whatsappAccount'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xdb'),require(_0x457d('0xdc')));_0x3c89b2['use'](_0x457d('0xdd'),require(_0x457d('0xde')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xdf'),require('./api/whatsappMessage'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe0'),require(_0x457d('0xe1')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe2'),require(_0x457d('0xe3')));_0x3c89b2[_0x457d('0x8')]('/api/whatsapp/queues',require(_0x457d('0xe4')));_0x3c89b2['use'](_0x457d('0xe5'),require(_0x457d('0xe6')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe7'),require(_0x457d('0xe8')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xe9'),require('./api/user-setting'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xea'),require(_0x457d('0xeb')));_0x3c89b2[_0x457d('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x3c89b2[_0x457d('0x8')](_0x457d('0xec'),require(_0x457d('0xed')));_0x3c89b2['use']('/api/jira',require(_0x457d('0xee')));_0x3c89b2['use'](_0x457d('0xef'),require(_0x457d('0xf0')));_0x3c89b2[_0x457d('0x8')]('/api/version',require(_0x457d('0xf1')));_0x3c89b2['use'](_0x457d('0xf2'),require(_0x457d('0xf3')));_0x3c89b2['use'](_0x457d('0xf4'),require(_0x457d('0xf5')));_0x3c89b2[_0x457d('0x8')]('/api/webbar',require(_0x457d('0xf6')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xf7'),clientSideLogs);_0x3c89b2[_0x457d('0x8')](_0x457d('0xf8'),express[_0x457d('0xf9')](path[_0x457d('0xfa')](config[_0x457d('0xfb')],'/apidoc')));_0x3c89b2[_0x457d('0x8')](_0x457d('0xfc'),express[_0x457d('0xf9')](path[_0x457d('0xfa')](config[_0x457d('0xfb')],_0x457d('0xfc'))));_0x3c89b2[_0x457d('0x8')](_0x457d('0xfd'),express[_0x457d('0xf9')](path[_0x457d('0xfa')](config[_0x457d('0xfb')],_0x457d('0xfd'))));_0x3c89b2['use'](_0x457d('0xfe'),express[_0x457d('0xf9')](path['join'](config[_0x457d('0xfb')],_0x457d('0xff'),'3.5.0')));_0x3c89b2[_0x457d('0x8')](_0x457d('0x100'),express[_0x457d('0xf9')](path['join'](config['root'],_0x457d('0x101'))));_0x3c89b2[_0x457d('0x102')](_0x457d('0x103'))[_0x457d('0x104')](errors[0x194]);_0x3c89b2[_0x457d('0x102')]('/*')[_0x457d('0x104')](function(_0x8d8653,_0x116cd5){_0x116cd5[_0x457d('0x105')](path[_0x457d('0x106')](_0x3c89b2['get']('appPath')+_0x457d('0x107')));});return _0x3c89b2;});};
\ No newline at end of file
index 054144a..314d524 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4579=['../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x4579,0x164));var _0x9457=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4579[_0x3dd15e];return _0x231fd0;};'use strict';var jayson=require(_0x9457('0x0'));var _=require('lodash');var config=require(_0x9457('0x1'));exports[_0x9457('0x2')]=function(){return new Promise(function(_0x426c0f,_0x8ec356){var _0x13b794={};_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x4')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x5')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/voiceQueue/voiceQueue.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x6')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x7')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x8')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x9')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/memberReport/memberReport.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0xa')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0xb')));_0x13b794=_['merge'](_0x13b794,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0xc')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0xd')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/mailQueue/mailQueue.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0xe')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0xf')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/mailApplication/mailApplication.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x10')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x11')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x12')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x13')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x14')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x15')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x16')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x17')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x18')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/smsMessage/smsMessage.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/smsQueue/smsQueue.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x19')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x1a')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x1b')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x1c')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x1d')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x1e')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/chatMessage/chatMessage.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x1f')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x20')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x21')));_0x13b794=_['merge'](_0x13b794,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x13b794=_['merge'](_0x13b794,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x13b794=_['merge'](_0x13b794,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x22')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x23')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x24')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x25')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x26')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x27')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x28')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x29')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x2a')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x2b')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x2c')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x2d')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x2e')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x2f')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x30')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x31')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x32')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x33')));_0x13b794=_['merge'](_0x13b794,require('../api/setting/setting.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x34')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x35')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x36')));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x37')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x38')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/attachment/attachment.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x39')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x13b794=_[_0x9457('0x3')](_0x13b794,require(_0x9457('0x3a')));_0x13b794=_[_0x9457('0x3')](_0x13b794,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x13b794=_['merge'](_0x13b794,require(_0x9457('0x3b')));var _0x4fb4c8=jayson[_0x9457('0x3c')](_0x13b794)['http']();var _0xe7591d=config[_0x9457('0x3d')]['port']||config[_0x9457('0x3e')]+0x1;var _0x59aa22=config[_0x9457('0x3d')]['ip']||_0x9457('0x3f');_0x4fb4c8['on'](_0x9457('0x40'),function(_0x4ac05f){return _0x8ec356(_0x4ac05f);});_0x4fb4c8['listen'](_0xe7591d,_0x59aa22,function(){console[_0x9457('0x41')](_0x9457('0x42'),_0x59aa22,_0xe7591d);require('../config/triggers')[_0x9457('0x43')]();return _0x426c0f(_0x9457('0x44')+_0x59aa22+':'+_0xe7591d);});});};
\ No newline at end of file
+var _0xeb54=['../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!'];(function(_0x24b53b,_0x57c20d){var _0x3b5c00=function(_0xed1211){while(--_0xed1211){_0x24b53b['push'](_0x24b53b['shift']());}};_0x3b5c00(++_0x57c20d);}(_0xeb54,0x13f));var _0x4eb5=function(_0x22ae68,_0x5c9a00){_0x22ae68=_0x22ae68-0x0;var _0x5555db=_0xeb54[_0x22ae68];return _0x5555db;};'use strict';var jayson=require(_0x4eb5('0x0'));var _=require(_0x4eb5('0x1'));var config=require(_0x4eb5('0x2'));exports[_0x4eb5('0x3')]=function(){return new Promise(function(_0x2e347f,_0x25780c){var _0x5e6c71={};_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x5')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x6')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x7')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x8')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x9')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0xa')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0xb')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0xc')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0xd')));_0x5e6c71=_['merge'](_0x5e6c71,require('../api/trunk/trunk.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0xe')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0xf')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x10')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x11')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x12')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/mailMessage/mailMessage.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x13')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x14')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x15')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x16')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x17')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/faxMessage/faxMessage.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x18')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x19')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1a')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/smsInteraction/smsInteraction.rpc'));_0x5e6c71=_['merge'](_0x5e6c71,require('../api/smsMessage/smsMessage.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/smsQueue/smsQueue.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1b')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/openchannelMessage/openchannelMessage.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1c')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x1d')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1e')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x1f')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x20')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x21')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x22')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x23')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x24')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x25')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x26')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x27')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x28')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x29')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/template/template.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x2a')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x2b')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x2c')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x2d')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x2e')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x2f')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x30')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x31')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x32')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x33')));_0x5e6c71=_['merge'](_0x5e6c71,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x34')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x35')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x36')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x37')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x38')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x39')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x3a')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require('../api/squareRecording/squareRecording.rpc'));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x3b')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x3c')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x3d')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x3e')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x3f')));_0x5e6c71=_['merge'](_0x5e6c71,require(_0x4eb5('0x40')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x41')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x42')));_0x5e6c71=_[_0x4eb5('0x4')](_0x5e6c71,require(_0x4eb5('0x43')));var _0x77bab5=jayson[_0x4eb5('0x44')](_0x5e6c71)[_0x4eb5('0x45')]();var _0x4d64d2=config[_0x4eb5('0x46')][_0x4eb5('0x47')]||config[_0x4eb5('0x47')]+0x1;var _0x39513f=config[_0x4eb5('0x46')]['ip']||_0x4eb5('0x48');_0x77bab5['on'](_0x4eb5('0x49'),function(_0x185d6f){return _0x25780c(_0x185d6f);});_0x77bab5[_0x4eb5('0x3')](_0x4d64d2,_0x39513f,function(){console[_0x4eb5('0x4a')](_0x4eb5('0x4b'),_0x39513f,_0x4d64d2);require(_0x4eb5('0x4c'))[_0x4eb5('0x4d')]();return _0x2e347f(_0x4eb5('0x4e')+_0x39513f+':'+_0x4d64d2);});});};
\ No newline at end of file
index 1b03f1d..7ddaf70 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb8f0=['wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','EventEmitter','./reply','./error','call','setEncoding','setTimeout','utf8','line','toLowerCase','hangup','emit','520-Invalid','search','520\x20End\x20of\x20proper','substring','no\x20code','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','pipe','command','function','write','destroy','inherits','prototype','sendRequest','sync','ANSWER','getData','beep','format','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','replace','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22'];(function(_0x234fb7,_0x5acb2b){var _0x759070=function(_0x20cf24){while(--_0x20cf24){_0x234fb7['push'](_0x234fb7['shift']());}};_0x759070(++_0x5acb2b);}(_0xb8f0,0x16d));var _0x0b8f=function(_0x10247f,_0x3ba864){_0x10247f=_0x10247f-0x0;var _0x4820fd=_0xb8f0[_0x10247f];return _0x4820fd;};'use strict';var util=require(_0x0b8f('0x0'));var _=require(_0x0b8f('0x1'));var EventEmitter=require('events')[_0x0b8f('0x2')];var AGIReply=require(_0x0b8f('0x3'));var AGIError=require(_0x0b8f('0x4'));function AGIChannel(_0x276012){var _0x3563a6=this,_0x40e6f8=new AGIReply(),_0x2574ea=![],_0x38a4e4={};EventEmitter[_0x0b8f('0x5')](_0x3563a6);_0x276012[_0x0b8f('0x6')]('utf8');_0x276012[_0x0b8f('0x7')](0x8*0x3c*0x3c*0x3e8);_0x40e6f8[_0x0b8f('0x6')](_0x0b8f('0x8'));_0x40e6f8['on']('headers',function(_0x3800d9){for(var _0x279084 in _0x3800d9){_0x3563a6[_0x279084]=_0x3800d9[_0x279084];}_0x3563a6['emit']('ready');});_0x40e6f8['on'](_0x0b8f('0x9'),function(_0x4d1823){if(_0x4d1823[_0x0b8f('0xa')]()==_0x0b8f('0xb')){_0x3563a6[_0x0b8f('0xc')](_0x0b8f('0xb'));return;}if(_0x4d1823['substring'](0x0,0xb)==_0x0b8f('0xd')){_0x2574ea=!![];}if(_0x2574ea){_0x38a4e4['rx']+=_0x4d1823+'\x0a';if(_0x4d1823[_0x0b8f('0xe')](_0x0b8f('0xf'))!=-0x1){_0x2574ea=![];}}else{_0x38a4e4['rx']=_0x4d1823;}if(_0x2574ea){return;}if(typeof _0x38a4e4['cb']=='function'){var _0x3ddefe=_0x38a4e4['rx'][_0x0b8f('0x10')](0x0,0x3),_0x357db9=null,_0x55f721=null;_0x3ddefe=parseInt(_0x3ddefe);if(isNaN(_0x3ddefe)){_0x38a4e4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x0b8f('0x11')});return;}if(_0x3ddefe!=0xc8){_0x38a4e4['cb'](null,{'code':_0x3ddefe,'result':-0x1,'extra':'KO'});return;}_0x357db9=_0x38a4e4['rx'][_0x0b8f('0x10')](0x4)['replace']('result=','');if(_0x357db9['indexOf']('\x20')!=-0x1){_0x357db9=_0x357db9[_0x0b8f('0x12')](0x0,_0x357db9[_0x0b8f('0x13')]('\x20'));}if(_[_0x0b8f('0x14')](_0x357db9,'-1')){_0x357db9=parseInt(_0x357db9);}_0x55f721=_0x38a4e4['rx'][_0x0b8f('0x15')]('\x20');if(_0x55f721[_0x0b8f('0x16')]==0x3){_0x55f721=_0x55f721[0x2]['substring'](0x1,_0x55f721[0x2]['length']-0x1);}else if(_0x55f721[_0x0b8f('0x16')]>0x3){var _0x1386e4=/\((.+)\)/;var _0x3b5f0f=_0x38a4e4['rx'][_0x0b8f('0x17')](_0x1386e4);if(_0x3b5f0f){_0x55f721=_0x3b5f0f[0x1];}else{_0x55f721=null;}}else{_0x55f721=null;}_0x38a4e4['cb'](null,{'code':_0x3ddefe,'result':_0x357db9,'extra':_0x55f721});}});_0x276012['on'](_0x0b8f('0x18'),function(_0x50f17a){_0x3563a6['emit'](_0x0b8f('0x18'),new AGIError(_0x0b8f('0x19'),_0x50f17a[_0x0b8f('0x1a')]));});_0x276012['on'](_0x0b8f('0x1b'),function(){_0x3563a6[_0x0b8f('0xc')](_0x0b8f('0x1b'),new AGIError(_0x0b8f('0x1c')));});_0x276012['on']('timeout',function(){_0x3563a6[_0x0b8f('0xc')]('timeout',new AGIError(_0x0b8f('0x1d')));_0x276012['destroy']();});_0x276012[_0x0b8f('0x1e')](_0x40e6f8);this[_0x0b8f('0x1f')]=function(_0x1f3b98,_0x147c2d){var _0x1f3b98=_0x1f3b98||'',_0x147c2d=typeof _0x147c2d==_0x0b8f('0x20')?_0x147c2d:new Function();_0x38a4e4={'tx':_0x1f3b98,'rx':'','cb':_0x147c2d};_0x276012[_0x0b8f('0x21')](_0x1f3b98+'\x0a');},this['close']=function(){_0x276012[_0x0b8f('0x22')]();};}util[_0x0b8f('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x25')]=function(_0x2f72f1){return this[_0x0b8f('0x1f')][_0x0b8f('0x26')](this,_0x2f72f1);};AGIChannel[_0x0b8f('0x24')]['answer']=function(){return this[_0x0b8f('0x25')](_0x0b8f('0x27'));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x28')]=function(_0x57752c,_0x2ecf33,_0x3c8f15){_0x57752c=_0x57752c===undefined?_0x0b8f('0x29'):_0x57752c;_0x2ecf33=_0x2ecf33===undefined?'5':_0x2ecf33;_0x3c8f15=_0x3c8f15===undefined?'1':_0x3c8f15;return this[_0x0b8f('0x25')](util[_0x0b8f('0x2a')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x57752c,_0x2ecf33*0x3e8,_0x3c8f15));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x2b')]=function(_0x4b5fa5){_0x4b5fa5=_0x4b5fa5||'NO\x20MESSAGE';return this[_0x0b8f('0x25')](util['format'](_0x0b8f('0x2c'),_0x4b5fa5));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x2d')]=function(_0x296a01,_0x4944d2){if(_[_0x0b8f('0x2e')](_0x4944d2)){return this['sendRequest'](util[_0x0b8f('0x2a')](_0x0b8f('0x2f'),_0x296a01,_0x4944d2['join'](',')));}return this[_0x0b8f('0x25')](util[_0x0b8f('0x2a')](_0x0b8f('0x2f'),_0x296a01,_0x4944d2));};AGIChannel['prototype'][_0x0b8f('0x30')]=function(_0x5027e1){return this[_0x0b8f('0x25')](util[_0x0b8f('0x2a')]('SET\x20CONTEXT\x20%s',_0x5027e1));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x31')]=function(_0x3f3c7c){return this[_0x0b8f('0x25')](util[_0x0b8f('0x2a')](_0x0b8f('0x32'),_0x3f3c7c));};AGIChannel[_0x0b8f('0x24')]['setPriority']=function(_0x79e7a){return this[_0x0b8f('0x25')](util[_0x0b8f('0x2a')]('SET\x20PRIORITY\x20%s',_0x79e7a));};AGIChannel['prototype'][_0x0b8f('0xb')]=function(){return this[_0x0b8f('0x25')]('HANGUP');};AGIChannel['prototype'][_0x0b8f('0x33')]=function(_0x55c2a5,_0x14b2a7){var _0x5074a7=_[_0x0b8f('0x34')](_0x14b2a7)||_[_0x0b8f('0x35')](_0x14b2a7)?_0x14b2a7[_0x0b8f('0x36')]():_0x14b2a7;return this['sendRequest'](util[_0x0b8f('0x2a')](_0x0b8f('0x37'),_0x55c2a5,_0x5074a7?_0x5074a7['toString']()[_0x0b8f('0x38')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x39')]=function(_0x271ad4,_0x161cd0){return this[_0x0b8f('0x25')](util[_0x0b8f('0x2a')](_0x0b8f('0x3a'),_0x271ad4,_0x161cd0));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x3b')]=function(_0x3f32c1,_0x3a8e03){return this['sendRequest'](util[_0x0b8f('0x2a')]('SAY\x20DIGITS\x20%s\x20%s',_0x3f32c1,_0x3a8e03));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x3c')]=function(_0x5f2e29,_0xea2045){return this['sendRequest'](util['format'](_0x0b8f('0x3d'),_0x5f2e29,_0xea2045));};AGIChannel['prototype'][_0x0b8f('0x3e')]=function(_0x4e7754,_0x162be7,_0x6677ac){_0x162be7=_0x162be7||this[_0x0b8f('0x3f')];_0x6677ac=_0x6677ac||0x1;this[_0x0b8f('0x30')](_0x4e7754);this['setExtension'](_0x162be7);this['setPriority'](_0x6677ac);return this[_0x0b8f('0x2b')](util['format'](_0x0b8f('0x40'),_0x4e7754,_0x162be7,_0x6677ac));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x41')]=function(_0x1a2f4c){return this[_0x0b8f('0x25')](util['format'](_0x0b8f('0x42'),_0x1a2f4c));};AGIChannel['prototype']['recordFile']=function(_0x50ad4d,_0x2b0d87,_0x42d231,_0x23493b,_0x513bf1,_0xf4f021){_0x2b0d87=_0x2b0d87||_0x0b8f('0x43');_0x42d231=_0x42d231||'';_0x23493b=_0x23493b===undefined?-0x1:_0x23493b==='-1'?-0x1:_0x23493b*0x3e8;_0x513bf1=_0x513bf1===undefined?'':'s='+_0x513bf1;_0xf4f021=_0xf4f021?'BEEP':'';return this[_0x0b8f('0x25')](util[_0x0b8f('0x2a')](_0x0b8f('0x44'),_0x50ad4d,_0x2b0d87,_0x42d231,_0x23493b,_0xf4f021,_0x513bf1));};AGIChannel['prototype']['streamFile']=function(_0x55ef88,_0x4d344d){_0x4d344d=_0x4d344d||'';return this[_0x0b8f('0x25')](util[_0x0b8f('0x2a')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x55ef88,_0x4d344d));};AGIChannel[_0x0b8f('0x24')][_0x0b8f('0x45')]=function(_0x1f0a69){return this['exec']('AGI',_0x1f0a69);};AGIChannel['prototype']['wait']=function(_0x5d1e36){return this[_0x0b8f('0x2d')]('WAIT',_0x5d1e36);};AGIChannel[_0x0b8f('0x24')]['error']=function(_0x3d57b7,_0x1b7b5a){this[_0x0b8f('0x2b')](util['format'](_0x0b8f('0x46'),_0x3d57b7['id'],_0x3d57b7[_0x0b8f('0x47')],_0x1b7b5a));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel;
\ No newline at end of file
+var _0x50e5=['setPriority','SET\x20PRIORITY\x20%s','setVariable','isNumber','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setContext','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','error','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','setEncoding','utf8','setTimeout','headers','emit','ready','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','replace','result=','indexOf','substr','startsWith','length','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','write','inherits','prototype','command','sync','answer','sendRequest','ANSWER','getData','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','join','EXEC\x20%s\x20%s','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s'];(function(_0x587b63,_0x383922){var _0x571ad3=function(_0x1916b7){while(--_0x1916b7){_0x587b63['push'](_0x587b63['shift']());}};_0x571ad3(++_0x383922);}(_0x50e5,0xb7));var _0x550e=function(_0x49efba,_0x3a8e9b){_0x49efba=_0x49efba-0x0;var _0x1d394d=_0x50e5[_0x49efba];return _0x1d394d;};'use strict';var util=require(_0x550e('0x0'));var _=require(_0x550e('0x1'));var EventEmitter=require('events')[_0x550e('0x2')];var AGIReply=require(_0x550e('0x3'));var AGIError=require(_0x550e('0x4'));function AGIChannel(_0x88d4bb){var _0x40aee6=this,_0x3f3a13=new AGIReply(),_0x78e6c5=![],_0xafede5={};EventEmitter[_0x550e('0x5')](_0x40aee6);_0x88d4bb[_0x550e('0x6')](_0x550e('0x7'));_0x88d4bb[_0x550e('0x8')](0x8*0x3c*0x3c*0x3e8);_0x3f3a13['setEncoding'](_0x550e('0x7'));_0x3f3a13['on'](_0x550e('0x9'),function(_0x51318e){for(var _0xebedae in _0x51318e){_0x40aee6[_0xebedae]=_0x51318e[_0xebedae];}_0x40aee6[_0x550e('0xa')](_0x550e('0xb'));});_0x3f3a13['on']('line',function(_0x1a1e3e){if(_0x1a1e3e['toLowerCase']()=='hangup'){_0x40aee6[_0x550e('0xa')](_0x550e('0xc'));return;}if(_0x1a1e3e['substring'](0x0,0xb)==_0x550e('0xd')){_0x78e6c5=!![];}if(_0x78e6c5){_0xafede5['rx']+=_0x1a1e3e+'\x0a';if(_0x1a1e3e[_0x550e('0xe')](_0x550e('0xf'))!=-0x1){_0x78e6c5=![];}}else{_0xafede5['rx']=_0x1a1e3e;}if(_0x78e6c5){return;}if(typeof _0xafede5['cb']==_0x550e('0x10')){var _0x518cad=_0xafede5['rx'][_0x550e('0x11')](0x0,0x3),_0x335cba=null,_0x57214a=null;_0x518cad=parseInt(_0x518cad);if(isNaN(_0x518cad)){_0xafede5['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x518cad!=0xc8){_0xafede5['cb'](null,{'code':_0x518cad,'result':-0x1,'extra':'KO'});return;}_0x335cba=_0xafede5['rx'][_0x550e('0x11')](0x4)[_0x550e('0x12')](_0x550e('0x13'),'');if(_0x335cba[_0x550e('0x14')]('\x20')!=-0x1){_0x335cba=_0x335cba[_0x550e('0x15')](0x0,_0x335cba['indexOf']('\x20'));}if(_[_0x550e('0x16')](_0x335cba,'-1')){_0x335cba=parseInt(_0x335cba);}_0x57214a=_0xafede5['rx']['split']('\x20');if(_0x57214a[_0x550e('0x17')]==0x3){_0x57214a=_0x57214a[0x2]['substring'](0x1,_0x57214a[0x2]['length']-0x1);}else if(_0x57214a[_0x550e('0x17')]>0x3){var _0xabb30d=/\((.+)\)/;var _0x557d20=_0xafede5['rx']['match'](_0xabb30d);if(_0x557d20){_0x57214a=_0x557d20[0x1];}else{_0x57214a=null;}}else{_0x57214a=null;}_0xafede5['cb'](null,{'code':_0x518cad,'result':_0x335cba,'extra':_0x57214a});}});_0x88d4bb['on']('error',function(_0x22c264){_0x40aee6['emit']('error',new AGIError(_0x550e('0x18'),_0x22c264[_0x550e('0x19')]));});_0x88d4bb['on'](_0x550e('0x1a'),function(){_0x40aee6[_0x550e('0xa')](_0x550e('0x1a'),new AGIError(_0x550e('0x1b')));});_0x88d4bb['on'](_0x550e('0x1c'),function(){_0x40aee6[_0x550e('0xa')](_0x550e('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x88d4bb[_0x550e('0x1d')]();});_0x88d4bb[_0x550e('0x1e')](_0x3f3a13);this['command']=function(_0x4f70bd,_0x3e9822){var _0x4f70bd=_0x4f70bd||'',_0x3e9822=typeof _0x3e9822==_0x550e('0x10')?_0x3e9822:new Function();_0xafede5={'tx':_0x4f70bd,'rx':'','cb':_0x3e9822};_0x88d4bb[_0x550e('0x1f')](_0x4f70bd+'\x0a');},this[_0x550e('0x1a')]=function(){_0x88d4bb[_0x550e('0x1d')]();};}util[_0x550e('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x550e('0x21')]['sendRequest']=function(_0x707f72){return this[_0x550e('0x22')][_0x550e('0x23')](this,_0x707f72);};AGIChannel[_0x550e('0x21')][_0x550e('0x24')]=function(){return this[_0x550e('0x25')](_0x550e('0x26'));};AGIChannel[_0x550e('0x21')][_0x550e('0x27')]=function(_0x136beb,_0x130bc2,_0x362d21){_0x136beb=_0x136beb===undefined?'beep':_0x136beb;_0x130bc2=_0x130bc2===undefined?'5':_0x130bc2;_0x362d21=_0x362d21===undefined?'1':_0x362d21;return this[_0x550e('0x25')](util[_0x550e('0x28')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0x136beb,_0x130bc2*0x3e8,_0x362d21));};AGIChannel[_0x550e('0x21')][_0x550e('0x29')]=function(_0x7ae242){_0x7ae242=_0x7ae242||_0x550e('0x2a');return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x2b'),_0x7ae242));};AGIChannel[_0x550e('0x21')][_0x550e('0x2c')]=function(_0x43f7b2,_0x25c40a){if(_[_0x550e('0x2d')](_0x25c40a)){return this[_0x550e('0x25')](util[_0x550e('0x28')]('EXEC\x20%s\x20%s',_0x43f7b2,_0x25c40a[_0x550e('0x2e')](',')));}return this[_0x550e('0x25')](util['format'](_0x550e('0x2f'),_0x43f7b2,_0x25c40a));};AGIChannel[_0x550e('0x21')]['setContext']=function(_0x3dd5b1){return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x30'),_0x3dd5b1));};AGIChannel[_0x550e('0x21')][_0x550e('0x31')]=function(_0x6fd332){return this[_0x550e('0x25')](util['format'](_0x550e('0x32'),_0x6fd332));};AGIChannel['prototype'][_0x550e('0x33')]=function(_0x1d94cd){return this['sendRequest'](util[_0x550e('0x28')](_0x550e('0x34'),_0x1d94cd));};AGIChannel['prototype']['hangup']=function(){return this['sendRequest']('HANGUP');};AGIChannel[_0x550e('0x21')][_0x550e('0x35')]=function(_0x6c42c6,_0x57b1b8){var _0x4d6def=_['isBoolean'](_0x57b1b8)||_[_0x550e('0x36')](_0x57b1b8)?_0x57b1b8[_0x550e('0x37')]():_0x57b1b8;return this['sendRequest'](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x6c42c6,_0x4d6def?_0x4d6def[_0x550e('0x37')]()[_0x550e('0x12')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x550e('0x21')]['sayNumber']=function(_0x535185,_0x33a720){return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x38'),_0x535185,_0x33a720));};AGIChannel['prototype'][_0x550e('0x39')]=function(_0x1973ef,_0x4cfde4){return this['sendRequest'](util[_0x550e('0x28')](_0x550e('0x3a'),_0x1973ef,_0x4cfde4));};AGIChannel[_0x550e('0x21')][_0x550e('0x3b')]=function(_0x5badca,_0xb3c314){return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x3c'),_0x5badca,_0xb3c314));};AGIChannel['prototype'][_0x550e('0x3d')]=function(_0x24532e,_0x1e3010,_0x459ca8){_0x1e3010=_0x1e3010||this[_0x550e('0x3e')];_0x459ca8=_0x459ca8||0x1;this[_0x550e('0x3f')](_0x24532e);this['setExtension'](_0x1e3010);this[_0x550e('0x33')](_0x459ca8);return this[_0x550e('0x29')](util[_0x550e('0x28')](_0x550e('0x40'),_0x24532e,_0x1e3010,_0x459ca8));};AGIChannel[_0x550e('0x21')]['getVariable']=function(_0x10f18f){return this[_0x550e('0x25')](util['format'](_0x550e('0x41'),_0x10f18f));};AGIChannel[_0x550e('0x21')][_0x550e('0x42')]=function(_0x5ae528,_0x4c26b4,_0xa5e4e2,_0x254444,_0x50e580,_0x2aa776){_0x4c26b4=_0x4c26b4||_0x550e('0x43');_0xa5e4e2=_0xa5e4e2||'';_0x254444=_0x254444===undefined?-0x1:_0x254444==='-1'?-0x1:_0x254444*0x3e8;_0x50e580=_0x50e580===undefined?'':'s='+_0x50e580;_0x2aa776=_0x2aa776?'BEEP':'';return this[_0x550e('0x25')](util[_0x550e('0x28')](_0x550e('0x44'),_0x5ae528,_0x4c26b4,_0xa5e4e2,_0x254444,_0x2aa776,_0x50e580));};AGIChannel[_0x550e('0x21')][_0x550e('0x45')]=function(_0xff7a68,_0x57e123){_0x57e123=_0x57e123||'';return this[_0x550e('0x25')](util['format'](_0x550e('0x46'),_0xff7a68,_0x57e123));};AGIChannel[_0x550e('0x21')]['agi']=function(_0x1c9d04){return this[_0x550e('0x2c')](_0x550e('0x47'),_0x1c9d04);};AGIChannel[_0x550e('0x21')][_0x550e('0x48')]=function(_0x35881f){return this['exec'](_0x550e('0x49'),_0x35881f);};AGIChannel[_0x550e('0x21')][_0x550e('0x4a')]=function(_0x444c23,_0x5a9ef5){this[_0x550e('0x29')](util[_0x550e('0x28')](_0x550e('0x4b'),_0x444c23['id'],_0x444c23[_0x550e('0x4c')],_0x5a9ef5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x550e('0x4d')]=AGIChannel;
\ No newline at end of file
index ab3c493..675bc3a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfd9a=['Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.'];(function(_0x1e72f4,_0x40a9e9){var _0x19e6a3=function(_0x36f398){while(--_0x36f398){_0x1e72f4['push'](_0x1e72f4['shift']());}};_0x19e6a3(++_0x40a9e9);}(_0xfd9a,0xed));var _0xafd9=function(_0x7530c7,_0x2ed631){_0x7530c7=_0x7530c7-0x0;var _0x32d0f1=_0xfd9a[_0x7530c7];return _0x32d0f1;};'use strict';var util=require(_0xafd9('0x0'));var error={'E_AGI_UNDEFINED':_0xafd9('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0xafd9('0x2'),'E_AGI_SERVER_CLOSE':_0xafd9('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0xafd9('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xafd9('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xafd9('0x6'),'E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xafd9('0x7'),'E_AGI_IVR_ENTRY':_0xafd9('0x8')};function AGIError(_0x540f2b){var _0x540f2b=_0x540f2b||null,_0x550e71=_0x550e71||[],_0x18f9ea=0x1,_0x5a8e68='';if(!error[_0x540f2b]){_0x540f2b=_0xafd9('0x9');}_0x550e71[_0xafd9('0xa')](error[_0x540f2b]);while(arguments[_0x18f9ea]){_0x550e71[_0xafd9('0xa')](arguments[_0x18f9ea]);_0x18f9ea++;}_0x5a8e68=util['format'][_0xafd9('0xb')](util,_0x550e71);this[_0xafd9('0xc')]=_0x5a8e68;this[_0xafd9('0xd')]=_0x540f2b;}module[_0xafd9('0xe')]=AGIError;
\ No newline at end of file
+var _0xadeb=['push','format','apply','message','name','util','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x44c4d1,_0x53c452){var _0x46fdc1=function(_0xc65c17){while(--_0xc65c17){_0x44c4d1['push'](_0x44c4d1['shift']());}};_0x46fdc1(++_0x53c452);}(_0xadeb,0xd5));var _0xbade=function(_0x1ff5e8,_0x3a5609){_0x1ff5e8=_0x1ff5e8-0x0;var _0x1e7046=_0xadeb[_0x1ff5e8];return _0x1e7046;};'use strict';var util=require(_0xbade('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xbade('0x1'),'E_AGI_SERVER_ERROR':_0xbade('0x2'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xbade('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xbade('0x4'),'E_AGI_SOCKET_CLOSE':_0xbade('0x5'),'E_AGI_SOCKET_TIMEOUT':_0xbade('0x6'),'E_AGI_COMMAND_EMPTY':_0xbade('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xbade('0x8'),'E_AGI_IVR_ENTRY':_0xbade('0x9')};function AGIError(_0x24f8f9){var _0x24f8f9=_0x24f8f9||null,_0x502867=_0x502867||[],_0xd8cc73=0x1,_0x297a99='';if(!error[_0x24f8f9]){_0x24f8f9=_0xbade('0xa');}_0x502867[_0xbade('0xb')](error[_0x24f8f9]);while(arguments[_0xd8cc73]){_0x502867['push'](arguments[_0xd8cc73]);_0xd8cc73++;}_0x297a99=util[_0xbade('0xc')][_0xbade('0xd')](util,_0x502867);this[_0xbade('0xe')]=_0x297a99;this[_0xbade('0xf')]=_0x24f8f9;}module['exports']=AGIError;
\ No newline at end of file
index 433419d..60d2b9b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9b56=['redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse','projectUpdate','exports','events','EventEmitter','ioredis','./error'];(function(_0x19b0fc,_0x93c7fe){var _0x5c8fd8=function(_0x41e15a){while(--_0x41e15a){_0x19b0fc['push'](_0x19b0fc['shift']());}};_0x5c8fd8(++_0x93c7fe);}(_0x9b56,0xb0));var _0x69b5=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x9b56[_0x45bf86];return _0x1f02b7;};'use strict';var _=require('lodash');var EventEmitter=require(_0x69b5('0x0'))[_0x69b5('0x1')];var Redis=require(_0x69b5('0x2'));var AGIError=require(_0x69b5('0x3'));var config=require('../../config/environment');config[_0x69b5('0x4')]=_['defaults'](config[_0x69b5('0x4')],{'host':_0x69b5('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x69b5('0x4')]);sub[_0x69b5('0x6')](_0x69b5('0x7'),function(_0xa34c22){if(_0xa34c22)return eventEmitter[_0x69b5('0x8')](_0x69b5('0x9'),new AGIError(_0x69b5('0xa'),_0xa34c22));});sub['on'](_0x69b5('0xb'),function(_0x42f94b,_0x4a4770){if(_0x42f94b!=='agi')return;try{var _0x2c9059=JSON[_0x69b5('0xc')](_0x4a4770);eventEmitter['emit'](_0x69b5('0xd'),_0x2c9059);}catch(_0x2c3a83){eventEmitter[_0x69b5('0x8')](_0x69b5('0x9'),new AGIError(_0x69b5('0xa'),_0x2c3a83));}});module[_0x69b5('0xe')]={'EventEmitter':eventEmitter};
\ No newline at end of file
+var _0x37ad=['redis','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi','parse','projectUpdate','lodash','EventEmitter','ioredis','defaults'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x37ad,0x1ca));var _0xd37a=function(_0x531d04,_0x5646c3){_0x531d04=_0x531d04-0x0;var _0x326a11=_0x37ad[_0x531d04];return _0x326a11;};'use strict';var _=require(_0xd37a('0x0'));var EventEmitter=require('events')[_0xd37a('0x1')];var Redis=require(_0xd37a('0x2'));var AGIError=require('./error');var config=require('../../config/environment');config['redis']=_[_0xd37a('0x3')](config[_0xd37a('0x4')],{'host':_0xd37a('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xd37a('0x4')]);sub[_0xd37a('0x6')]('agi',function(_0x323796){if(_0x323796)return eventEmitter[_0xd37a('0x7')](_0xd37a('0x8'),new AGIError(_0xd37a('0x9'),_0x323796));});sub['on'](_0xd37a('0xa'),function(_0x827e1a,_0xf6cea5){if(_0x827e1a!==_0xd37a('0xb'))return;try{var _0x18909f=JSON[_0xd37a('0xc')](_0xf6cea5);eventEmitter[_0xd37a('0x7')](_0xd37a('0xd'),_0x18909f);}catch(_0x2aa581){eventEmitter[_0xd37a('0x7')](_0xd37a('0x8'),new AGIError(_0xd37a('0x9'),_0x2aa581));}});module['exports']={'EventEmitter':eventEmitter};
\ No newline at end of file
index 6bbb15a..fdaf204 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x385a=['condition\x20not\x20found','lodash','../../../config/logger','agi','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','addEdge','push','size','relations','getVertex','traverseBFS','no\x20vertex\x20found','info','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','target','menu','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach'];(function(_0x3fee63,_0x2ffa79){var _0x3827d7=function(_0x26df22){while(--_0x26df22){_0x3fee63['push'](_0x3fee63['shift']());}};_0x3827d7(++_0x2ffa79);}(_0x385a,0xa1));var _0xa385=function(_0x2d2157,_0x3881ca){_0x2d2157=_0x2d2157-0x0;var _0x1797eb=_0x385a[_0x2d2157];return _0x1797eb;};'use strict';var _=require(_0xa385('0x0'));var logger=require(_0xa385('0x1'))(_0xa385('0x2'));var verticesWithRetry=['menu',_0xa385('0x3'),_0xa385('0x4')];var Graph=function(){this[_0xa385('0x5')]={};this[_0xa385('0x6')]={};this[_0xa385('0x7')]=0x0;};Graph['prototype'][_0xa385('0x8')]=function(_0x421a1a){this[_0xa385('0x5')][_0x421a1a['id']]=_0x421a1a;this['edges'][_0x421a1a['id']]=[];};Graph[_0xa385('0x9')][_0xa385('0xa')]=function(_0x254bd9,_0x12fbcf,_0x4268e0){this[_0xa385('0x6')][_0x254bd9][_0xa385('0xb')]({'target':_0x12fbcf,'condition':_0x4268e0});this['numberOfEdges']+=0x1;};Graph[_0xa385('0x9')][_0xa385('0xc')]=function(){return _[_0xa385('0xc')](this[_0xa385('0x5')]);};Graph[_0xa385('0x9')][_0xa385('0xd')]=function(){return this['numberOfEdges'];};Graph['prototype'][_0xa385('0xe')]=function(_0x539a1e){return this[_0xa385('0x5')][_0x539a1e];};Graph[_0xa385('0x9')][_0xa385('0xf')]=function(_0x7b2821,_0x58715d){if(!this[_0xa385('0x5')][_0x7b2821]){return logger['info'](_0xa385('0x10'));}var _0x149697=_0x58715d(this[_0xa385('0x5')][_0x7b2821]);if(!_0x149697){return logger[_0xa385('0x11')](_0xa385('0x12'));}if(this[_0xa385('0x6')][_0x7b2821][_0xa385('0x13')]===0x0){return logger[_0xa385('0x11')](_0xa385('0x14'));}for(var _0x1164c1=0x0,_0x36a334=[],_0x2e425b=![];_0x1164c1<this[_0xa385('0x6')][_0x7b2821][_0xa385('0x13')];_0x1164c1+=0x1){if(this['edges'][_0x7b2821][_0x1164c1][_0xa385('0x15')]){_0x36a334=this[_0xa385('0x6')][_0x7b2821][_0x1164c1][_0xa385('0x15')][_0xa385('0x16')](',');for(var _0x22bedd=0x0;_0x22bedd<_0x36a334['length'];_0x22bedd+=0x1){if(this[_0xa385('0x5')][_0x7b2821][_0xa385('0x17')]==='vswitch'&&_0x36a334[_0x22bedd]==='-'){_0x2e425b=this[_0xa385('0x6')][_0x7b2821][_0x1164c1]['target'];logger[_0xa385('0x11')]('default',_0x36a334[_0x22bedd],this[_0xa385('0x6')][_0x7b2821][_0x1164c1][_0xa385('0x18')]);}else if(this[_0xa385('0x5')][_0x7b2821][_0xa385('0x17')]===_0xa385('0x19')&&_0x36a334[_0x22bedd]==='i'){_0x2e425b=this[_0xa385('0x6')][_0x7b2821][_0x1164c1][_0xa385('0x18')];logger[_0xa385('0x11')](_0xa385('0x1a'),_0x36a334[_0x22bedd],this[_0xa385('0x6')][_0x7b2821][_0x1164c1][_0xa385('0x18')]);}if(_0x36a334[_0x22bedd]===_0x149697){return this[_0xa385('0xf')](this[_0xa385('0x6')][_0x7b2821][_0x1164c1][_0xa385('0x18')],_0x58715d);}}}else{return this['traverseBFS'](this[_0xa385('0x6')][_0x7b2821][_0x1164c1][_0xa385('0x18')],_0x58715d);}}if(_0x36a334[_0xa385('0x13')]){if(this['vertices'][_0x7b2821]['agicommand']===_0xa385('0x1b')){if(_0x2e425b){return this[_0xa385('0xf')](_0x2e425b,_0x58715d);}return logger[_0xa385('0x11')](_0xa385('0x1c'));}else if(_[_0xa385('0x1d')](verticesWithRetry,this[_0xa385('0x5')][_0x7b2821][_0xa385('0x17')])){if(_0x149697==='-'){return logger[_0xa385('0x11')](_0xa385('0x1e'));}if(_0x2e425b&&_0x149697!=='t'){return this[_0xa385('0xf')](_0x2e425b,_0x58715d);}return this[_0xa385('0xf')](_0x7b2821,_0x58715d);}return logger[_0xa385('0x11')](_0xa385('0x1f'));}};module['exports']=Graph;
\ No newline at end of file
+var _0xd317=['size','relations','getVertex','no\x20vertex\x20found','info','length','no\x20edge/s\x20available','split','vswitch','target','agicommand','traverseBFS','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','addVertex','edges','addEdge','push'];(function(_0x3509d8,_0x5074b5){var _0x4dcedb=function(_0x164ac4){while(--_0x164ac4){_0x3509d8['push'](_0x3509d8['shift']());}};_0x4dcedb(++_0x5074b5);}(_0xd317,0x1ec));var _0x7d31=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xd317[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var logger=require(_0x7d31('0x0'))(_0x7d31('0x1'));var verticesWithRetry=[_0x7d31('0x2'),_0x7d31('0x3'),_0x7d31('0x4')];var Graph=function(){this[_0x7d31('0x5')]={};this['edges']={};this[_0x7d31('0x6')]=0x0;};Graph[_0x7d31('0x7')][_0x7d31('0x8')]=function(_0x5cd665){this[_0x7d31('0x5')][_0x5cd665['id']]=_0x5cd665;this[_0x7d31('0x9')][_0x5cd665['id']]=[];};Graph[_0x7d31('0x7')][_0x7d31('0xa')]=function(_0x4b45a3,_0x42392c,_0x21baa4){this[_0x7d31('0x9')][_0x4b45a3][_0x7d31('0xb')]({'target':_0x42392c,'condition':_0x21baa4});this[_0x7d31('0x6')]+=0x1;};Graph[_0x7d31('0x7')]['size']=function(){return _[_0x7d31('0xc')](this[_0x7d31('0x5')]);};Graph['prototype'][_0x7d31('0xd')]=function(){return this[_0x7d31('0x6')];};Graph[_0x7d31('0x7')][_0x7d31('0xe')]=function(_0x448fca){return this[_0x7d31('0x5')][_0x448fca];};Graph['prototype']['traverseBFS']=function(_0x4df2ca,_0x3ec220){if(!this[_0x7d31('0x5')][_0x4df2ca]){return logger['info'](_0x7d31('0xf'));}var _0x25e5e2=_0x3ec220(this[_0x7d31('0x5')][_0x4df2ca]);if(!_0x25e5e2){return logger[_0x7d31('0x10')]('stop\x20traverse');}if(this['edges'][_0x4df2ca][_0x7d31('0x11')]===0x0){return logger['info'](_0x7d31('0x12'));}for(var _0x3ac6d4=0x0,_0x35fcb6=[],_0x4f6296=![];_0x3ac6d4<this[_0x7d31('0x9')][_0x4df2ca][_0x7d31('0x11')];_0x3ac6d4+=0x1){if(this['edges'][_0x4df2ca][_0x3ac6d4]['condition']){_0x35fcb6=this[_0x7d31('0x9')][_0x4df2ca][_0x3ac6d4]['condition'][_0x7d31('0x13')](',');for(var _0xa5fc9f=0x0;_0xa5fc9f<_0x35fcb6['length'];_0xa5fc9f+=0x1){if(this[_0x7d31('0x5')][_0x4df2ca]['agicommand']===_0x7d31('0x14')&&_0x35fcb6[_0xa5fc9f]==='-'){_0x4f6296=this['edges'][_0x4df2ca][_0x3ac6d4][_0x7d31('0x15')];logger[_0x7d31('0x10')]('default',_0x35fcb6[_0xa5fc9f],this[_0x7d31('0x9')][_0x4df2ca][_0x3ac6d4][_0x7d31('0x15')]);}else if(this[_0x7d31('0x5')][_0x4df2ca][_0x7d31('0x16')]===_0x7d31('0x2')&&_0x35fcb6[_0xa5fc9f]==='i'){_0x4f6296=this[_0x7d31('0x9')][_0x4df2ca][_0x3ac6d4][_0x7d31('0x15')];logger[_0x7d31('0x10')]('invalid',_0x35fcb6[_0xa5fc9f],this['edges'][_0x4df2ca][_0x3ac6d4][_0x7d31('0x15')]);}if(_0x35fcb6[_0xa5fc9f]===_0x25e5e2){return this[_0x7d31('0x17')](this[_0x7d31('0x9')][_0x4df2ca][_0x3ac6d4]['target'],_0x3ec220);}}}else{return this['traverseBFS'](this[_0x7d31('0x9')][_0x4df2ca][_0x3ac6d4]['target'],_0x3ec220);}}if(_0x35fcb6['length']){if(this[_0x7d31('0x5')][_0x4df2ca]['agicommand']===_0x7d31('0x14')){if(_0x4f6296){return this[_0x7d31('0x17')](_0x4f6296,_0x3ec220);}return logger[_0x7d31('0x10')](_0x7d31('0x18'));}else if(_[_0x7d31('0x19')](verticesWithRetry,this[_0x7d31('0x5')][_0x4df2ca][_0x7d31('0x16')])){if(_0x25e5e2==='-'){return logger[_0x7d31('0x10')](_0x7d31('0x1a'));}if(_0x4f6296&&_0x25e5e2!=='t'){return this[_0x7d31('0x17')](_0x4f6296,_0x3ec220);}return this[_0x7d31('0x17')](_0x4df2ca,_0x3ec220);}return logger[_0x7d31('0x10')](_0x7d31('0x1b'));}};module['exports']=Graph;
\ No newline at end of file
index 84012bf..532a52a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa64e=['close','timeout','hangup','handleNotFound','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','getAll','finally','./server','listening','connection','lodash','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','log','port','info','format','name','message','[%s]\x20%s','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','indexOf','agi_','substring','debug','variables','stringify'];(function(_0x32dbf2,_0x39eab0){var _0x63b9d=function(_0x24c9a9){while(--_0x24c9a9){_0x32dbf2['push'](_0x32dbf2['shift']());}};_0x63b9d(++_0x39eab0);}(_0xa64e,0x194));var _0xea64=function(_0x381a79,_0x416316){_0x381a79=_0x381a79-0x0;var _0x5a066f=_0xa64e[_0x381a79];return _0x5a066f;};'use strict';var _=require(_0xea64('0x0'));var syncho=require('syncho');var util=require(_0xea64('0x1'));var config=require(_0xea64('0x2'));var logger=require(_0xea64('0x3'))(_0xea64('0x4'));var utilLicense=require(_0xea64('0x5'));var rpc=require(_0xea64('0x6'));var Project=require('./project');var AGIEmitter=require(_0xea64('0x7'))[_0xea64('0x8')];var projects=[];config[_0xea64('0x4')]=_[_0xea64('0x9')](config['agi'],{'ip':_0xea64('0xa'),'port':0x11dd});AGIEmitter['on'](_0xea64('0xb'),projectUpdateHandler);function connectionHandler(_0x41e9fe){process[_0xea64('0xc')](function(){syncho(function(){try{setChannelVariables(_0x41e9fe);agiHandler(_0x41e9fe);}catch(_0x2e2254){logger[_0xea64('0xd')](_0x2e2254[_0xea64('0xe')]);}});});}function projectUpdateHandler(_0xdd4ea2){try{var _0xdd95a3=_[_0xea64('0xf')](projects,['id',_0xdd4ea2['id']]);if(_0xdd95a3>-0x1){if(_0xdd4ea2[_0xea64('0x10')]===!![]){projects[_0xea64('0x11')](_0xdd95a3,0x1);}else{projects[_0xdd95a3]=_0xdd4ea2;}}else{projects['push'](_0xdd4ea2);}}catch(_0x5e0a40){logger['error'](_0x5e0a40[_0xea64('0xe')]);}}function listeningHandler(){console[_0xea64('0x12')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xea64('0x13')]);logger[_0xea64('0x14')](util[_0xea64('0x15')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xea64('0x4')]['ip'],config['agi'][_0xea64('0x13')]));}function errorHandler(_0x326a01){if(_0x326a01&&_0x326a01[_0xea64('0x16')]&&_0x326a01[_0xea64('0x17')]){logger[_0xea64('0xd')](util[_0xea64('0x15')](_0xea64('0x18'),_0x326a01['name'],_0x326a01[_0xea64('0x17')]));}else{logger['error'](util[_0xea64('0x15')](_0xea64('0x19'),_0x326a01[_0xea64('0xe')]));}}function closeHandler(){logger[_0xea64('0x14')](util[_0xea64('0x15')](_0xea64('0x1a'),this[_0xea64('0x1b')],this[_0xea64('0x1c')],this[_0xea64('0x1d')],this[_0xea64('0x1e')],this[_0xea64('0x1f')]));try{createSquareReport(this);}catch(_0x3e9874){logger['error'](_0x3e9874[_0xea64('0xe')]);}}function timeoutHandler(){logger['info'](util['format'](_0xea64('0x20'),this[_0xea64('0x1b')],this[_0xea64('0x1c')],this[_0xea64('0x1d')],this[_0xea64('0x1e')],this[_0xea64('0x1f')]));}function hangupHandler(){logger[_0xea64('0x14')](util[_0xea64('0x15')](_0xea64('0x21'),this[_0xea64('0x1b')],this[_0xea64('0x1c')],this[_0xea64('0x1d')],this['dnid'],this[_0xea64('0x1f')]));this[_0xea64('0x22')]=!![];}function createSquareReport(_0xb16651,_0x5bac64){rpc[_0xea64('0x23')](_0xb16651)[_0xea64('0x24')](function(_0xe6c3e2){if(_0x5bac64){_0x5bac64(null,_0xe6c3e2);}})[_0xea64('0x25')](function(_0x3caaf8){if(_0x5bac64){_0x5bac64(null,_0x3caaf8);}});}function setChannelVariables(_0x5b5c8b){for(var _0x493d2f in _0x5b5c8b){if(_0x5b5c8b['hasOwnProperty'](_0x493d2f)){if(_0x493d2f[_0xea64('0x26')](_0xea64('0x27'))===0x0){_0x5b5c8b[_0x493d2f[_0xea64('0x28')](0x4)]=_0x5b5c8b[_0x493d2f];delete _0x5b5c8b[_0x493d2f];}}}}function agiHandler(_0x40c671){logger[_0xea64('0x29')](_0xea64('0x2a'),JSON[_0xea64('0x2b')](_0x40c671,null,0x2));logger['info'](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x40c671[_0xea64('0x1b')],_0x40c671[_0xea64('0x1c')],_0x40c671[_0xea64('0x1d')],_0x40c671[_0xea64('0x1e')],_0x40c671[_0xea64('0x1f')]));_0x40c671['on'](_0xea64('0xd'),errorHandler);_0x40c671['on'](_0xea64('0x2c'),closeHandler);_0x40c671['on'](_0xea64('0x2d'),timeoutHandler);_0x40c671[_0xea64('0x22')]=![];_0x40c671['on'](_0xea64('0x2e'),hangupHandler);var _0x4035c5=_['find'](projects,[_0xea64('0x16'),_0x40c671[_0xea64('0x1b')]]);if(!_0x4035c5)return Project[_0xea64('0x2f')](_0x40c671);if(!_0x4035c5['production'])return Project['handleUnpublished'](_0x40c671);return Project['initialize'](_0x4035c5,_0x40c671);}function main(){var _0x5998b0;return utilLicense['getLicense']()[_0xea64('0x24')](function(_0x5a319b){if(!_0x5a319b)return;if(_0x5a319b['voice']){if(_0x5a319b[_0xea64('0x30')]&&_0x5a319b['callysquare']>0x0){logger[_0xea64('0x14')](util[_0xea64('0x15')](_0xea64('0x31'),_0x5a319b[_0xea64('0x30')]));_0x5998b0=_0x5a319b['callysquare'];}else{logger['info'](_0xea64('0x32'));}}else{logger[_0xea64('0x14')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x5998b0=-0x1;}})[_0xea64('0x24')](function(){return Project[_0xea64('0x33')]();})[_0xea64('0x24')](function(_0x4f51e2){projects=_0x4f51e2;return;})[_0xea64('0x25')](function(_0x415b9b){logger[_0xea64('0xd')]('[LICENSE]',_0x415b9b[_0xea64('0xe')]);})[_0xea64('0x34')](function(){var _0x1e0014=require(_0xea64('0x35'))(config['agi'][_0xea64('0x13')],config['agi']['ip'],_0x5998b0);_0x1e0014['on'](_0xea64('0xd'),errorHandler);_0x1e0014['on'](_0xea64('0x36'),listeningHandler);_0x1e0014['on'](_0xea64('0x37'),connectionHandler);_0x1e0014['on']('close',closeHandler);});}main();
\ No newline at end of file
+var _0x0d49=['message','format','[%s]\x20%s','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','agi','../../config/license/util','./project','EventEmitter','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','deleted','splice','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x0d49,0xcc));var _0x90d4=function(_0x14f3f4,_0x38ec0a){_0x14f3f4=_0x14f3f4-0x0;var _0x557da0=_0x0d49[_0x14f3f4];return _0x557da0;};'use strict';var _=require(_0x90d4('0x0'));var syncho=require(_0x90d4('0x1'));var util=require(_0x90d4('0x2'));var config=require(_0x90d4('0x3'));var logger=require('../../config/logger')(_0x90d4('0x4'));var utilLicense=require(_0x90d4('0x5'));var rpc=require('./rpc');var Project=require(_0x90d4('0x6'));var AGIEmitter=require('./events')[_0x90d4('0x7')];var projects=[];config[_0x90d4('0x4')]=_[_0x90d4('0x8')](config[_0x90d4('0x4')],{'ip':_0x90d4('0x9'),'port':0x11dd});AGIEmitter['on'](_0x90d4('0xa'),projectUpdateHandler);function connectionHandler(_0x5525fe){process[_0x90d4('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5525fe);agiHandler(_0x5525fe);}catch(_0x430d97){logger[_0x90d4('0xc')](_0x430d97[_0x90d4('0xd')]);}});});}function projectUpdateHandler(_0x470d17){try{var _0x1928ff=_['findIndex'](projects,['id',_0x470d17['id']]);if(_0x1928ff>-0x1){if(_0x470d17[_0x90d4('0xe')]===!![]){projects[_0x90d4('0xf')](_0x1928ff,0x1);}else{projects[_0x1928ff]=_0x470d17;}}else{projects['push'](_0x470d17);}}catch(_0x8bca10){logger[_0x90d4('0xc')](_0x8bca10['stack']);}}function listeningHandler(){console['log'](_0x90d4('0x10'),config[_0x90d4('0x4')]['port']);logger[_0x90d4('0x11')](util['format'](_0x90d4('0x12'),config[_0x90d4('0x4')]['ip'],config[_0x90d4('0x4')]['port']));}function errorHandler(_0x1697d7){if(_0x1697d7&&_0x1697d7[_0x90d4('0x13')]&&_0x1697d7[_0x90d4('0x14')]){logger[_0x90d4('0xc')](util[_0x90d4('0x15')](_0x90d4('0x16'),_0x1697d7[_0x90d4('0x13')],_0x1697d7[_0x90d4('0x14')]));}else{logger[_0x90d4('0xc')](util['format'](_0x90d4('0x17'),_0x1697d7[_0x90d4('0xd')]));}}function closeHandler(){logger[_0x90d4('0x11')](util[_0x90d4('0x15')]('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x90d4('0x18')],this[_0x90d4('0x19')],this[_0x90d4('0x1a')],this[_0x90d4('0x1b')],this[_0x90d4('0x1c')]));try{createSquareReport(this);}catch(_0x3683f3){logger['error'](_0x3683f3[_0x90d4('0xd')]);}}function timeoutHandler(){logger[_0x90d4('0x11')](util[_0x90d4('0x15')](_0x90d4('0x1d'),this['arg_1'],this[_0x90d4('0x19')],this[_0x90d4('0x1a')],this[_0x90d4('0x1b')],this[_0x90d4('0x1c')]));}function hangupHandler(){logger['info'](util[_0x90d4('0x15')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x90d4('0x18')],this['calleridname'],this['callerid'],this[_0x90d4('0x1b')],this['uniqueid']));this[_0x90d4('0x1e')]=!![];}function createSquareReport(_0xdf6e59,_0x28c694){rpc[_0x90d4('0x1f')](_0xdf6e59)[_0x90d4('0x20')](function(_0x104a53){if(_0x28c694){_0x28c694(null,_0x104a53);}})[_0x90d4('0x21')](function(_0x56c970){if(_0x28c694){_0x28c694(null,_0x56c970);}});}function setChannelVariables(_0x59d407){for(var _0x10a282 in _0x59d407){if(_0x59d407[_0x90d4('0x22')](_0x10a282)){if(_0x10a282['indexOf'](_0x90d4('0x23'))===0x0){_0x59d407[_0x10a282['substring'](0x4)]=_0x59d407[_0x10a282];delete _0x59d407[_0x10a282];}}}}function agiHandler(_0x3c4e50){logger[_0x90d4('0x24')]('variables',JSON['stringify'](_0x3c4e50,null,0x2));logger['info'](util[_0x90d4('0x15')](_0x90d4('0x25'),_0x3c4e50['arg_1'],_0x3c4e50[_0x90d4('0x19')],_0x3c4e50[_0x90d4('0x1a')],_0x3c4e50[_0x90d4('0x1b')],_0x3c4e50['uniqueid']));_0x3c4e50['on'](_0x90d4('0xc'),errorHandler);_0x3c4e50['on'](_0x90d4('0x26'),closeHandler);_0x3c4e50['on'](_0x90d4('0x27'),timeoutHandler);_0x3c4e50[_0x90d4('0x1e')]=![];_0x3c4e50['on'](_0x90d4('0x28'),hangupHandler);var _0x3069c5=_[_0x90d4('0x29')](projects,[_0x90d4('0x13'),_0x3c4e50[_0x90d4('0x18')]]);if(!_0x3069c5)return Project[_0x90d4('0x2a')](_0x3c4e50);if(!_0x3069c5[_0x90d4('0x2b')])return Project[_0x90d4('0x2c')](_0x3c4e50);return Project[_0x90d4('0x2d')](_0x3069c5,_0x3c4e50);}function main(){var _0x166eb6;return utilLicense[_0x90d4('0x2e')]()[_0x90d4('0x20')](function(_0x25b50e){if(!_0x25b50e)return;if(_0x25b50e[_0x90d4('0x2f')]){if(_0x25b50e[_0x90d4('0x30')]&&_0x25b50e['callysquare']>0x0){logger[_0x90d4('0x11')](util[_0x90d4('0x15')]('[LICENSE]\x20CHANNELS:\x20%s',_0x25b50e[_0x90d4('0x30')]));_0x166eb6=_0x25b50e[_0x90d4('0x30')];}else{logger[_0x90d4('0x11')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger['info'](_0x90d4('0x31'));_0x166eb6=-0x1;}})['then'](function(){return Project[_0x90d4('0x32')]();})[_0x90d4('0x20')](function(_0x1f0b36){projects=_0x1f0b36;return;})[_0x90d4('0x21')](function(_0x133e8d){logger[_0x90d4('0xc')](_0x90d4('0x33'),_0x133e8d[_0x90d4('0xd')]);})[_0x90d4('0x34')](function(){var _0x5a8122=require(_0x90d4('0x35'))(config[_0x90d4('0x4')]['port'],config[_0x90d4('0x4')]['ip'],_0x166eb6);_0x5a8122['on'](_0x90d4('0xc'),errorHandler);_0x5a8122['on'](_0x90d4('0x36'),listeningHandler);_0x5a8122['on'](_0x90d4('0x37'),connectionHandler);_0x5a8122['on'](_0x90d4('0x26'),closeHandler);});}main();
\ No newline at end of file
index 6bce600..5cfdb2c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf0e=['error','message','catch','sendMailMessage','SendMail','jayson/promise','client','http','then'];(function(_0x7ee8a7,_0x3df784){var _0x4b2f36=function(_0x5c220d){while(--_0x5c220d){_0x7ee8a7['push'](_0x7ee8a7['shift']());}};_0x4b2f36(++_0x3df784);}(_0xcf0e,0x149));var _0xecf0=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0xcf0e[_0x369151];return _0x4292d5;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xecf0('0x0'));var client=jayson[_0xecf0('0x1')][_0xecf0('0x2')]({'port':0x232b});function request(_0x1ad4d4,_0x41f2e7){return new BPromise(function(_0x26a458,_0x1d1a2e){return client['request'](_0x1ad4d4,_0x41f2e7)[_0xecf0('0x3')](function(_0x46dab6){if(_0x46dab6['error']){return _0x1d1a2e(_0x46dab6[_0xecf0('0x4')][_0xecf0('0x5')]);}else{return _0x26a458(_0x46dab6['result']);}})[_0xecf0('0x6')](function(_0x856896){return _0x1d1a2e(_0x856896);});});}exports[_0xecf0('0x7')]=function(_0x755e7b,_0x50be57){return request(_0xecf0('0x8'),{'account':_0x755e7b,'message':_0x50be57});};
\ No newline at end of file
+var _0xbc9e=['http','then','error','message','result','catch','bluebird','jayson/promise','client'];(function(_0x5a38ce,_0x2b0029){var _0x77f1c9=function(_0x3dae32){while(--_0x3dae32){_0x5a38ce['push'](_0x5a38ce['shift']());}};_0x77f1c9(++_0x2b0029);}(_0xbc9e,0xcc));var _0xebc9=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0xbc9e[_0x1969a7];return _0x3d665f;};'use strict';var BPromise=require(_0xebc9('0x0'));var jayson=require(_0xebc9('0x1'));var client=jayson[_0xebc9('0x2')][_0xebc9('0x3')]({'port':0x232b});function request(_0x33742f,_0x58a71d){return new BPromise(function(_0x299f25,_0x45af82){return client['request'](_0x33742f,_0x58a71d)[_0xebc9('0x4')](function(_0x14970a){if(_0x14970a[_0xebc9('0x5')]){return _0x45af82(_0x14970a[_0xebc9('0x5')][_0xebc9('0x6')]);}else{return _0x299f25(_0x14970a[_0xebc9('0x7')]);}})[_0xebc9('0x8')](function(_0x5473a8){return _0x45af82(_0x5473a8);});});}exports['sendMailMessage']=function(_0xe325a4,_0x104980){return request('SendMail',{'account':_0xe325a4,'message':_0x104980});};
\ No newline at end of file
index d09c594..330675d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4845=['util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','stack','agicommand','hasOwnProperty','maxRetry','addVertex','mxCell','isArray','length','source','addEdge','value','mxGraphModel','inspect','production','debug','stringify','joinAt','format','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','uniqueid','traverseBFS','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','callerid','dnid','calleridname','close','Project\x20%s\x20not\x20found','continueAt','exports','lodash','moment'];(function(_0x3d70da,_0x40b755){var _0x59bdc4=function(_0x544ce3){while(--_0x544ce3){_0x3d70da['push'](_0x3d70da['shift']());}};_0x59bdc4(++_0x40b755);}(_0x4845,0x70));var _0x5484=function(_0x198ae4,_0x2b0dfd){_0x198ae4=_0x198ae4-0x0;var _0x4672e6=_0x4845[_0x198ae4];return _0x4672e6;};'use strict';var _=require(_0x5484('0x0'));var moment=require(_0x5484('0x1'));var parser=require('xml2json');var util=require(_0x5484('0x2'));var logger=require(_0x5484('0x3'))(_0x5484('0x4'));var rpc=require(_0x5484('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x5484('0x6'));var Vertices=require(_0x5484('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x5484('0x8')]()[_0x5484('0x9')](function(_0x7b9ad6){logger[_0x5484('0xa')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x7b9ad6[_0x5484('0xb')]);return[];});}function addVertex(_0x239575,_0x187371,_0x55a89e){_0x187371[_0x5484('0xc')]=_0x55a89e;if(_0x187371[_0x5484('0xd')]('retry')){_0x187371[_0x5484('0xe')]=parseInt(_0x187371['retry'],0xa);}_0x239575[_0x5484('0xf')](_['omit'](_0x187371,_0x5484('0x10')));}function initGraph(_0x4da546,_0xe87747){var _0x4d300b=new Graph();for(var _0x1391cb in _0x4da546){if(_0x4da546[_0x5484('0xd')](_0x1391cb)){if(_[_0x5484('0x11')](_0x4da546[_0x1391cb])){for(var _0x4a21a5=0x0;_0x4a21a5<_0x4da546[_0x1391cb][_0x5484('0x12')];_0x4a21a5+=0x1){addVertex(_0x4d300b,_0x4da546[_0x1391cb][_0x4a21a5],_0x1391cb);}}else{addVertex(_0x4d300b,_0x4da546[_0x1391cb],_0x1391cb);}}}for(var _0xe372e2=0x0;_0xe372e2<_0xe87747[_0x5484('0x12')];_0xe372e2+=0x1){if(_0xe87747[_0xe372e2][_0x5484('0x13')]&&_0xe87747[_0xe372e2]['target']){_0x4d300b[_0x5484('0x14')](_0xe87747[_0xe372e2][_0x5484('0x13')],_0xe87747[_0xe372e2]['target'],_0xe87747[_0xe372e2][_0x5484('0x15')]);}}return _0x4d300b;}function getRoot(_0x39cc6a){return parser['toJson'](_0x39cc6a,{'object':!![]})[_0x5484('0x16')]['root'];}function inspect(_0xfeb808){return util[_0x5484('0x17')](_0xfeb808,{'showHidden':![],'depth':null});}function initialize(_0x31276f,_0x19eeba){var _0x4a53b8=getRoot(_0x31276f[_0x5484('0x18')]);if(!_0x4a53b8||!_0x4a53b8['start'])return;var _0x21dfaa,_0x320420,_0x31cc43;logger[_0x5484('0x19')]('root',JSON[_0x5484('0x1a')](_0x4a53b8,null,0x2));_0x19eeba[_0x5484('0x1b')]=moment()[_0x5484('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');_0x21dfaa=initGraph(_[_0x5484('0x1d')](_0x4a53b8,_0x5484('0x10')),_0x4a53b8[_0x5484('0x10')]);_0x320420=new Vertices(_0x19eeba,rpc,mailRpc);logger['info'](util['format'](_0x5484('0x1e'),_0x19eeba[_0x5484('0x1f')],_0x19eeba['calleridname'],_0x19eeba['callerid'],_0x19eeba['dnid'],_0x19eeba[_0x5484('0x20')]));_0x21dfaa[_0x5484('0x21')](_0x4a53b8['start']['id'],function(_0x1a943c){try{_0x1a943c=_0x320420[_0x5484('0x22')](_0x1a943c);logger['debug'](_0x5484('0x23'),JSON[_0x5484('0x1a')](_0x1a943c,null,0x2));if(_0x1a943c[_0x5484('0xc')]===_0x5484('0x24')){logger[_0x5484('0x25')](_0x5484('0x26'));_0x19eeba[_0x5484('0x27')]=_0x1a943c['context']||_0x19eeba['context'];_0x19eeba[_0x5484('0x28')]=_0x1a943c[_0x5484('0x28')];_0x19eeba[_0x5484('0x29')]=_0x1a943c[_0x5484('0x29')]?_0x1a943c['priority']-0x1:0x1;return null;}else if(_0x1a943c&&_0x320420[_0x1a943c[_0x5484('0xc')]]){_0x31cc43=_0x320420[_0x1a943c[_0x5484('0xc')]](_0x1a943c);logger[_0x5484('0x25')](_0x5484('0x2a'),JSON['stringify'](_0x31cc43,null,0x2));if(_0x31cc43&&_0x31cc43[_0x5484('0x2b')]===AGI_CODE_SUCCESS&&_0x31cc43[_0x5484('0x2c')]!==AGI_RESULT_ERROR&&!_0x19eeba[_0x5484('0x2d')]){logger['debug'](_0x5484('0x2a'),inspect(_0x31cc43));return _[_0x5484('0x2e')](_0x31cc43['result'])?null:_0x31cc43['result'][_0x5484('0x2f')]();}else{logger[_0x5484('0xa')](_0x5484('0x2a'),inspect(_0x31cc43));return null;}}else{logger[_0x5484('0xa')](_0x5484('0x30'));return null;}}catch(_0x4eaa06){logger['error'](_0x4eaa06[_0x5484('0xb')]);return null;}});if(_0x4a53b8[_0x5484('0x31')]){logger[_0x5484('0x25')](util[_0x5484('0x1c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x19eeba[_0x5484('0x1f')],_0x19eeba['calleridname'],_0x19eeba[_0x5484('0x32')],_0x19eeba[_0x5484('0x33')],_0x19eeba[_0x5484('0x20')]));_0x21dfaa[_0x5484('0x21')](_0x4a53b8['finally']['id'],function(_0x508d7e){try{_0x508d7e=_0x320420[_0x5484('0x22')](_0x508d7e);logger['debug'](_0x5484('0x23'),JSON[_0x5484('0x1a')](_0x508d7e,null,0x2));if(_0x508d7e&&_0x320420[_0x508d7e['agicommand']]){_0x31cc43=_0x320420[_0x508d7e[_0x5484('0xc')]](_0x508d7e);if(_0x31cc43){logger[_0x5484('0x19')]('response',inspect(_0x31cc43));return _[_0x5484('0x2e')](_0x31cc43[_0x5484('0x2c')])?null:_0x31cc43['result'][_0x5484('0x2f')]();}else{logger[_0x5484('0xa')]('response',inspect(_0x31cc43));return null;}}else{logger[_0x5484('0xa')](_0x5484('0x30'));return null;}}catch(_0x22f4e1){logger[_0x5484('0xa')](_0x22f4e1[_0x5484('0xb')]);return null;}});}logger[_0x5484('0x25')](util[_0x5484('0x1c')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x19eeba['arg_1'],_0x19eeba[_0x5484('0x34')],_0x19eeba[_0x5484('0x32')],_0x19eeba['dnid'],_0x19eeba['uniqueid']));logger[_0x5484('0x25')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x19eeba[_0x5484('0x27')],_0x19eeba[_0x5484('0x28')],parseInt(_0x19eeba[_0x5484('0x29')],0xa)+0x1));_0x19eeba['continueAt'](_0x19eeba[_0x5484('0x27')],_0x19eeba[_0x5484('0x28')],parseInt(_0x19eeba[_0x5484('0x29')],0xa)+0x1);_0x19eeba[_0x5484('0x35')]();}function handleNotFound(_0xd7e75c){logger[_0x5484('0xa')](util[_0x5484('0x1c')](_0x5484('0x36'),_0xd7e75c[_0x5484('0x1f')]));_0xd7e75c[_0x5484('0x37')](_0xd7e75c[_0x5484('0x27')],_0xd7e75c['extension'],parseInt(_0xd7e75c[_0x5484('0x29')],0xa)+0x1);_0xd7e75c[_0x5484('0x35')]();}function handleUnpublished(_0x591c6a){logger[_0x5484('0xa')](util[_0x5484('0x1c')]('Project\x20%s\x20not\x20published',_0x591c6a[_0x5484('0x1f')]));_0x591c6a[_0x5484('0x37')](_0x591c6a[_0x5484('0x27')],_0x591c6a[_0x5484('0x28')],parseInt(_0x591c6a[_0x5484('0x29')],0xa)+0x1);_0x591c6a[_0x5484('0x35')]();}module[_0x5484('0x38')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
+var _0xe07f=['retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','value','toJson','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','info','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','priority','response','code','evtHangup','result','toString','agicommand\x20not\x20found','traverseBFS','finally','clear','isUndefined','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','extension','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','close','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty'];(function(_0x3aeada,_0x454e90){var _0x5abcec=function(_0x5d248f){while(--_0x5d248f){_0x3aeada['push'](_0x3aeada['shift']());}};_0x5abcec(++_0x454e90);}(_0xe07f,0x19e));var _0xfe07=function(_0x28c04c,_0x50ba77){_0x28c04c=_0x28c04c-0x0;var _0x2ada6b=_0xe07f[_0x28c04c];return _0x2ada6b;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0xfe07('0x0'));var util=require(_0xfe07('0x1'));var logger=require('../../config/logger')(_0xfe07('0x2'));var rpc=require(_0xfe07('0x3'));var mailRpc=require(_0xfe07('0x4'));var Graph=require(_0xfe07('0x5'));var Vertices=require(_0xfe07('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xfe07('0x7')](function(_0x476554){logger[_0xfe07('0x8')](_0xfe07('0x9'),_0x476554[_0xfe07('0xa')]);return[];});}function addVertex(_0x1e0be7,_0x492002,_0x51ec69){_0x492002[_0xfe07('0xb')]=_0x51ec69;if(_0x492002[_0xfe07('0xc')](_0xfe07('0xd'))){_0x492002[_0xfe07('0xe')]=parseInt(_0x492002[_0xfe07('0xd')],0xa);}_0x1e0be7[_0xfe07('0xf')](_[_0xfe07('0x10')](_0x492002,_0xfe07('0x11')));}function initGraph(_0x56cc4c,_0x69b187){var _0x218de3=new Graph();for(var _0x1611bd in _0x56cc4c){if(_0x56cc4c['hasOwnProperty'](_0x1611bd)){if(_[_0xfe07('0x12')](_0x56cc4c[_0x1611bd])){for(var _0x4480cd=0x0;_0x4480cd<_0x56cc4c[_0x1611bd][_0xfe07('0x13')];_0x4480cd+=0x1){addVertex(_0x218de3,_0x56cc4c[_0x1611bd][_0x4480cd],_0x1611bd);}}else{addVertex(_0x218de3,_0x56cc4c[_0x1611bd],_0x1611bd);}}}for(var _0x135f23=0x0;_0x135f23<_0x69b187['length'];_0x135f23+=0x1){if(_0x69b187[_0x135f23][_0xfe07('0x14')]&&_0x69b187[_0x135f23][_0xfe07('0x15')]){_0x218de3[_0xfe07('0x16')](_0x69b187[_0x135f23]['source'],_0x69b187[_0x135f23]['target'],_0x69b187[_0x135f23][_0xfe07('0x17')]);}}return _0x218de3;}function getRoot(_0x2478cb){return parser[_0xfe07('0x18')](_0x2478cb,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x32a389){return util[_0xfe07('0x19')](_0x32a389,{'showHidden':![],'depth':null});}function initialize(_0x29a2b1,_0x5e9594){var _0x3c62e7=getRoot(_0x29a2b1[_0xfe07('0x1a')]);if(!_0x3c62e7||!_0x3c62e7[_0xfe07('0x1b')])return;var _0x364a9c,_0x4ce9d9,_0x334962;logger[_0xfe07('0x1c')]('root',JSON[_0xfe07('0x1d')](_0x3c62e7,null,0x2));_0x5e9594[_0xfe07('0x1e')]=moment()['format'](_0xfe07('0x1f'));_0x364a9c=initGraph(_[_0xfe07('0x10')](_0x3c62e7,_0xfe07('0x11')),_0x3c62e7['mxCell']);_0x4ce9d9=new Vertices(_0x5e9594,rpc,mailRpc);logger[_0xfe07('0x20')](util[_0xfe07('0x21')](_0xfe07('0x22'),_0x5e9594[_0xfe07('0x23')],_0x5e9594[_0xfe07('0x24')],_0x5e9594[_0xfe07('0x25')],_0x5e9594[_0xfe07('0x26')],_0x5e9594[_0xfe07('0x27')]));_0x364a9c['traverseBFS'](_0x3c62e7[_0xfe07('0x1b')]['id'],function(_0x575f8b){try{_0x575f8b=_0x4ce9d9['clear'](_0x575f8b);logger[_0xfe07('0x1c')](_0xfe07('0x28'),JSON[_0xfe07('0x1d')](_0x575f8b,null,0x2));if(_0x575f8b[_0xfe07('0xb')]===_0xfe07('0x29')){logger[_0xfe07('0x20')](_0xfe07('0x2a'));_0x5e9594[_0xfe07('0x2b')]=_0x575f8b['context']||_0x5e9594[_0xfe07('0x2b')];_0x5e9594['extension']=_0x575f8b['extension'];_0x5e9594[_0xfe07('0x2c')]=_0x575f8b['priority']?_0x575f8b[_0xfe07('0x2c')]-0x1:0x1;return null;}else if(_0x575f8b&&_0x4ce9d9[_0x575f8b[_0xfe07('0xb')]]){_0x334962=_0x4ce9d9[_0x575f8b['agicommand']](_0x575f8b);logger[_0xfe07('0x20')](_0xfe07('0x2d'),JSON[_0xfe07('0x1d')](_0x334962,null,0x2));if(_0x334962&&_0x334962[_0xfe07('0x2e')]===AGI_CODE_SUCCESS&&_0x334962['result']!==AGI_RESULT_ERROR&&!_0x5e9594[_0xfe07('0x2f')]){logger[_0xfe07('0x1c')]('response',inspect(_0x334962));return _['isUndefined'](_0x334962[_0xfe07('0x30')])?null:_0x334962[_0xfe07('0x30')][_0xfe07('0x31')]();}else{logger[_0xfe07('0x8')]('response',inspect(_0x334962));return null;}}else{logger[_0xfe07('0x8')](_0xfe07('0x32'));return null;}}catch(_0x3f73e4){logger[_0xfe07('0x8')](_0x3f73e4[_0xfe07('0xa')]);return null;}});if(_0x3c62e7['finally']){logger[_0xfe07('0x20')](util[_0xfe07('0x21')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5e9594[_0xfe07('0x23')],_0x5e9594[_0xfe07('0x24')],_0x5e9594[_0xfe07('0x25')],_0x5e9594[_0xfe07('0x26')],_0x5e9594[_0xfe07('0x27')]));_0x364a9c[_0xfe07('0x33')](_0x3c62e7[_0xfe07('0x34')]['id'],function(_0xe05ff3){try{_0xe05ff3=_0x4ce9d9[_0xfe07('0x35')](_0xe05ff3);logger['debug'](_0xfe07('0x28'),JSON['stringify'](_0xe05ff3,null,0x2));if(_0xe05ff3&&_0x4ce9d9[_0xe05ff3[_0xfe07('0xb')]]){_0x334962=_0x4ce9d9[_0xe05ff3[_0xfe07('0xb')]](_0xe05ff3);if(_0x334962){logger[_0xfe07('0x1c')](_0xfe07('0x2d'),inspect(_0x334962));return _[_0xfe07('0x36')](_0x334962[_0xfe07('0x30')])?null:_0x334962[_0xfe07('0x30')]['toString']();}else{logger[_0xfe07('0x8')](_0xfe07('0x2d'),inspect(_0x334962));return null;}}else{logger[_0xfe07('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x1f1be0){logger[_0xfe07('0x8')](_0x1f1be0[_0xfe07('0xa')]);return null;}});}logger[_0xfe07('0x20')](util[_0xfe07('0x21')](_0xfe07('0x37'),_0x5e9594['arg_1'],_0x5e9594['calleridname'],_0x5e9594[_0xfe07('0x25')],_0x5e9594[_0xfe07('0x26')],_0x5e9594[_0xfe07('0x27')]));logger[_0xfe07('0x20')](util[_0xfe07('0x21')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x5e9594[_0xfe07('0x2b')],_0x5e9594[_0xfe07('0x38')],parseInt(_0x5e9594[_0xfe07('0x2c')],0xa)+0x1));_0x5e9594['continueAt'](_0x5e9594['context'],_0x5e9594[_0xfe07('0x38')],parseInt(_0x5e9594[_0xfe07('0x2c')],0xa)+0x1);_0x5e9594['close']();}function handleNotFound(_0x8469a){logger[_0xfe07('0x8')](util[_0xfe07('0x21')](_0xfe07('0x39'),_0x8469a[_0xfe07('0x23')]));_0x8469a[_0xfe07('0x3a')](_0x8469a[_0xfe07('0x2b')],_0x8469a[_0xfe07('0x38')],parseInt(_0x8469a[_0xfe07('0x2c')],0xa)+0x1);_0x8469a['close']();}function handleUnpublished(_0xc5e707){logger[_0xfe07('0x8')](util[_0xfe07('0x21')](_0xfe07('0x3b'),_0xc5e707[_0xfe07('0x23')]));_0xc5e707['continueAt'](_0xc5e707[_0xfe07('0x2b')],_0xc5e707[_0xfe07('0x38')],parseInt(_0xc5e707[_0xfe07('0x2c')],0xa)+0x1);_0xc5e707[_0xfe07('0x3c')]();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize};
\ No newline at end of file
index 94d72eb..62c6f69 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3a87=['\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','slice','trim','emit','headers','_inBody','line','exports','util','stream','Transform','call','_localBuffer','prototype'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x3a87,0x1f2));var _0x73a8=function(_0x269c42,_0xeed101){_0x269c42=_0x269c42-0x0;var _0x4dad76=_0x3a87[_0x269c42];return _0x4dad76;};'use strict';var util=require(_0x73a8('0x0'));var Transform=require(_0x73a8('0x1'))[_0x73a8('0x2')];function AGIReply(_0x128de6){Transform[_0x73a8('0x3')](this,_0x128de6);this[_0x73a8('0x4')]='';this['_inBody']=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x73a8('0x5')]['_transform']=function(_0x37093a,_0x3924c7,_0x519d2b){var _0x4e03a0='\x0a',_0x386523=['\x0a\x0a',_0x73a8('0x6')],_0xf4166c=-0x1,_0x412c20=-0x1,_0x2f435e='',_0x4eb5fd=0x0,_0xf6ffa0='',_0x1fd96b='';this['_localBuffer']+=_0x37093a[_0x73a8('0x7')]();_0xf6ffa0=this[_0x73a8('0x4')];if(!this['_inBody']){_0x4eb5fd=0x0;while(_0x386523[_0x4eb5fd]){while((_0x412c20=_0xf6ffa0[_0x73a8('0x8')](_0x386523[_0x4eb5fd]))!=-0x1){_0x2f435e=_0x386523[_0x4eb5fd];_0x1fd96b=_0xf6ffa0[_0x73a8('0x9')](0x0,_0x412c20);_0xf6ffa0=_0xf6ffa0['substring'](_0x412c20+_0x2f435e[_0x73a8('0xa')]);var _0x5a0451=_0x1fd96b['split'](_0x4e03a0),_0x198646=0x0,_0x2363e3={},_0xf519f0='',_0x3eaf4e='',_0x4e8ce3=-0x1;while(_0x5a0451[_0x198646]){_0x4e8ce3=_0x5a0451[_0x198646][_0x73a8('0x8')](':');if(_0x4e8ce3!=-0x1){_0xf519f0=_0x5a0451[_0x198646][_0x73a8('0xb')](0x0,_0x4e8ce3)[_0x73a8('0xc')]();_0x3eaf4e=_0x5a0451[_0x198646][_0x73a8('0xb')](_0x4e8ce3+0x1)['trim']();if(_0xf519f0[_0x73a8('0xa')]>0x0){_0x2363e3[_0xf519f0]=_0x3eaf4e;}}else{}_0x198646++;}this[_0x73a8('0xd')](_0x73a8('0xe'),_0x2363e3);this[_0x73a8('0xf')]=!![];}_0x4eb5fd++;}this[_0x73a8('0x4')]=_0xf6ffa0;}else{while((_0xf4166c=_0xf6ffa0['indexOf'](_0x4e03a0))!=-0x1){_0x1fd96b=_0xf6ffa0['substring'](0x0,_0xf4166c);this[_0x73a8('0xd')](_0x73a8('0x10'),_0x1fd96b);_0xf6ffa0=_0xf6ffa0[_0x73a8('0x9')](_0xf4166c+_0x4e03a0[_0x73a8('0xa')]);}this['_localBuffer']=_0xf6ffa0;}_0x519d2b();};module[_0x73a8('0x11')]=AGIReply;
\ No newline at end of file
+var _0x4f6f=['toString','indexOf','substring','length','slice','trim','emit','util','stream','Transform','call','_inBody','inherits','_transform','\x0d\x0a\x0d\x0a','_localBuffer'];(function(_0x4f95d9,_0x516d40){var _0x4a14e9=function(_0x81f869){while(--_0x81f869){_0x4f95d9['push'](_0x4f95d9['shift']());}};_0x4a14e9(++_0x516d40);}(_0x4f6f,0x157));var _0xf4f6=function(_0xf4666e,_0x571140){_0xf4666e=_0xf4666e-0x0;var _0x1853f1=_0x4f6f[_0xf4666e];return _0x1853f1;};'use strict';var util=require(_0xf4f6('0x0'));var Transform=require(_0xf4f6('0x1'))[_0xf4f6('0x2')];function AGIReply(_0x4b6f0f){Transform[_0xf4f6('0x3')](this,_0x4b6f0f);this['_localBuffer']='';this[_0xf4f6('0x4')]=![];}util[_0xf4f6('0x5')](AGIReply,Transform);AGIReply['prototype'][_0xf4f6('0x6')]=function(_0x1a5edc,_0x4eeeb1,_0x31ecb6){var _0x1172a6='\x0a',_0x2dc7b9=['\x0a\x0a',_0xf4f6('0x7')],_0x4fa106=-0x1,_0x106455=-0x1,_0x592fa6='',_0x483c82=0x0,_0x26f82b='',_0x167822='';this[_0xf4f6('0x8')]+=_0x1a5edc[_0xf4f6('0x9')]();_0x26f82b=this[_0xf4f6('0x8')];if(!this['_inBody']){_0x483c82=0x0;while(_0x2dc7b9[_0x483c82]){while((_0x106455=_0x26f82b[_0xf4f6('0xa')](_0x2dc7b9[_0x483c82]))!=-0x1){_0x592fa6=_0x2dc7b9[_0x483c82];_0x167822=_0x26f82b[_0xf4f6('0xb')](0x0,_0x106455);_0x26f82b=_0x26f82b[_0xf4f6('0xb')](_0x106455+_0x592fa6[_0xf4f6('0xc')]);var _0x4450f9=_0x167822['split'](_0x1172a6),_0x9275e3=0x0,_0x4ba77d={},_0x5ea38b='',_0x107046='',_0x4976f5=-0x1;while(_0x4450f9[_0x9275e3]){_0x4976f5=_0x4450f9[_0x9275e3][_0xf4f6('0xa')](':');if(_0x4976f5!=-0x1){_0x5ea38b=_0x4450f9[_0x9275e3][_0xf4f6('0xd')](0x0,_0x4976f5)[_0xf4f6('0xe')]();_0x107046=_0x4450f9[_0x9275e3]['slice'](_0x4976f5+0x1)[_0xf4f6('0xe')]();if(_0x5ea38b[_0xf4f6('0xc')]>0x0){_0x4ba77d[_0x5ea38b]=_0x107046;}}else{}_0x9275e3++;}this[_0xf4f6('0xf')]('headers',_0x4ba77d);this[_0xf4f6('0x4')]=!![];}_0x483c82++;}this['_localBuffer']=_0x26f82b;}else{while((_0x4fa106=_0x26f82b[_0xf4f6('0xa')](_0x1172a6))!=-0x1){_0x167822=_0x26f82b[_0xf4f6('0xb')](0x0,_0x4fa106);this[_0xf4f6('0xf')]('line',_0x167822);_0x26f82b=_0x26f82b[_0xf4f6('0xb')](_0x4fa106+_0x1172a6[_0xf4f6('0xc')]);}this[_0xf4f6('0x8')]=_0x26f82b;}_0x31ecb6();};module['exports']=AGIReply;
\ No newline at end of file
index 866628e..e0661d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb7a8=['LoginUser','PauseUser','UnpauseUser','LogoutUser','moment','jayson/promise','http','request','then','error','message','result','catch','getSquareProjects','GetSquareProjects','production','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getSoundById','ShowSound','save_name','getIntervalById','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact','ShowPause'];(function(_0x515dc5,_0x1b37c3){var _0x261523=function(_0x7b56d4){while(--_0x7b56d4){_0x515dc5['push'](_0x515dc5['shift']());}};_0x261523(++_0x1b37c3);}(_0xb7a8,0xec));var _0x8b7a=function(_0x2a3f7f,_0x423673){_0x2a3f7f=_0x2a3f7f-0x0;var _0x56ad07=_0xb7a8[_0x2a3f7f];return _0x56ad07;};'use strict';var _=require('lodash');var moment=require(_0x8b7a('0x0'));var jayson=require(_0x8b7a('0x1'));var client=jayson['client'][_0x8b7a('0x2')]({'port':0x2329});function request(_0x41d3a7,_0xecdd45){return new Promise(function(_0x5b033a,_0x3847b8){return client[_0x8b7a('0x3')](_0x41d3a7,_0xecdd45)[_0x8b7a('0x4')](function(_0x1d1de7){if(_0x1d1de7[_0x8b7a('0x5')]){return _0x3847b8(_0x1d1de7[_0x8b7a('0x5')][_0x8b7a('0x6')]);}else{return _0x5b033a(_0x1d1de7[_0x8b7a('0x7')]);}})[_0x8b7a('0x8')](function(_0xec0881){return _0x3847b8(_0xec0881);});});}exports[_0x8b7a('0x9')]=function(){return request(_0x8b7a('0xa'),{'options':{'raw':![],'attributes':['id','name',_0x8b7a('0xb')]}});};exports['getSquareProject']=function(_0x456ae9){return request(_0x8b7a('0xc'),{'options':{'raw':![],'where':{'name':_0x456ae9},'attributes':['production']}});};exports[_0x8b7a('0xd')]=function(_0x17f307){return request(_0x8b7a('0xe'),{'options':{'raw':![],'where':{'id':_0x17f307},'include':[{'model':'MailServerOut','as':_0x8b7a('0xf'),'include':[{'model':'CloudProvider','as':_0x8b7a('0x10')}]}],'attributes':['id',_0x8b7a('0x11'),_0x8b7a('0x12')],'smtp':!![]}});};exports[_0x8b7a('0x13')]=function(_0x58a968){return request(_0x8b7a('0xc'),{'options':{'where':{'id':_0x58a968},'attributes':['name']}});};exports[_0x8b7a('0x14')]=function(_0x1ca7fd){return request(_0x8b7a('0x15'),{'options':{'where':{'id':_0x1ca7fd},'attributes':['name']}});};exports['getVariableById']=function(_0x570134){return request(_0x8b7a('0x16'),{'options':{'where':{'id':_0x570134},'attributes':['name']}});};exports[_0x8b7a('0x17')]=function(_0x3f23c4){return request(_0x8b7a('0x18'),{'options':{'where':{'id':_0x3f23c4},'attributes':[_0x8b7a('0x19')]}});};exports[_0x8b7a('0x1a')]=function(_0x5a53a0){return request(_0x8b7a('0x1b'),{'options':{'where':{'id':_0x5a53a0},'attributes':[_0x8b7a('0x11')]}});};exports[_0x8b7a('0x1c')]=function(_0x55acd5){return request(_0x8b7a('0x1d'),{'options':{'where':{'phone':_0x55acd5[_0x8b7a('0x1e')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x48fe65){return request('ShowTrunk',{'options':{'where':{'id':_0x48fe65},'attributes':[_0x8b7a('0x11')]}});};exports[_0x8b7a('0x1f')]=function(_0x1d2759){return request(_0x8b7a('0x20'),{'options':{'where':{'id':_0x1d2759},'attributes':[_0x8b7a('0x21')]}});};exports[_0x8b7a('0x22')]=function(_0x2c64fc){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x2c64fc},'include':[{'model':_0x8b7a('0x23'),'as':_0x8b7a('0x24')}]}});};exports[_0x8b7a('0x25')]=function(_0x31780){return request(_0x8b7a('0x26'),{'options':{'where':{'id':_0x31780},'attributes':['id','name']}});};exports[_0x8b7a('0x27')]=function(_0x3b154d){return request(_0x8b7a('0x28'),{'body':_0x3b154d});};exports[_0x8b7a('0x29')]=function(_0x114a09){return request(_0x8b7a('0x2a'),{'body':_0x114a09});};exports[_0x8b7a('0x2b')]=function(_0x7d295e){return request('CreateSquareReport',{'body':_[_0x8b7a('0x2c')](_0x7d295e,{'project_name':_0x7d295e['arg_1'],'prev_project_name':_0x7d295e[_0x8b7a('0x2d')]||'','is_subproject':_0x7d295e[_0x8b7a('0x2d')]?!![]:![],'leaveAt':moment()['format'](_0x8b7a('0x2e'))})});};exports[_0x8b7a('0x2f')]=function(_0x49f9c7){return request('CreateSquareRecording',{'body':_0x49f9c7});};exports[_0x8b7a('0x30')]=function(_0xfb45bd){return request(_0x8b7a('0x31'),{'body':_0xfb45bd});};exports[_0x8b7a('0x32')]=function(_0x39edd1){return request(_0x8b7a('0x33'),{'options':{'raw':![],'where':{'phone':_0x39edd1[_0x8b7a('0x1e')],'ListId':_0x39edd1['ListId']}}})[_0x8b7a('0x4')](function(_0x31aa1a){if(_0x31aa1a){return _0x31aa1a;}return request(_0x8b7a('0x34'),{'body':_0x39edd1});});};exports['getPauseById']=function(_0xa76402){return request(_0x8b7a('0x35'),{'options':{'where':{'id':_0xa76402},'attributes':[_0x8b7a('0x11')]}});};exports['agentLogin']=function(_0x4085b4,_0x3009db){return request(_0x8b7a('0x36'),{'body':{'interface':_0x3009db},'options':{'where':_0x4085b4}});};exports['agentPause']=function(_0x17788c,_0x3d521c,_0x28d5e5){return request(_0x8b7a('0x37'),{'body':{'type':_0x3d521c,'uniqueid':_0x28d5e5},'options':{'where':_0x17788c}});};exports['agentUnpause']=function(_0x332253){return request(_0x8b7a('0x38'),{'body':{},'options':{'where':_0x332253}});};exports['agentLogout']=function(_0x4174a0){return request(_0x8b7a('0x39'),{'body':{},'options':{'where':_0x4174a0}});};
\ No newline at end of file
+var _0x40b5=['getPauseById','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','catch','GetSquareProjects','production','ShowMailAccount','MailServerOut','CloudProvider','name','email','ShowSquareProject','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','CreateCmContact'];(function(_0x2861e1,_0x12df10){var _0x5e54d3=function(_0x3f2fc4){while(--_0x3f2fc4){_0x2861e1['push'](_0x2861e1['shift']());}};_0x5e54d3(++_0x12df10);}(_0x40b5,0x1d7));var _0x540b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x40b5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x540b('0x0'));var moment=require(_0x540b('0x1'));var jayson=require(_0x540b('0x2'));var client=jayson[_0x540b('0x3')][_0x540b('0x4')]({'port':0x2329});function request(_0x273ac6,_0x424c68){return new Promise(function(_0x4bfe55,_0x39da2c){return client[_0x540b('0x5')](_0x273ac6,_0x424c68)[_0x540b('0x6')](function(_0x239467){if(_0x239467[_0x540b('0x7')]){return _0x39da2c(_0x239467['error'][_0x540b('0x8')]);}else{return _0x4bfe55(_0x239467[_0x540b('0x9')]);}})[_0x540b('0xa')](function(_0x5aeb5f){return _0x39da2c(_0x5aeb5f);});});}exports['getSquareProjects']=function(){return request(_0x540b('0xb'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x13dc02){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x13dc02},'attributes':[_0x540b('0xc')]}});};exports['getMailAccountById']=function(_0x5f23ae){return request(_0x540b('0xd'),{'options':{'raw':![],'where':{'id':_0x5f23ae},'include':[{'model':_0x540b('0xe'),'as':'Smtp','include':[{'model':_0x540b('0xf'),'as':_0x540b('0xf')}]}],'attributes':['id',_0x540b('0x10'),_0x540b('0x11')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0xdf0923){return request(_0x540b('0x12'),{'options':{'where':{'id':_0xdf0923},'attributes':[_0x540b('0x10')]}});};exports[_0x540b('0x13')]=function(_0x498616){return request(_0x540b('0x14'),{'options':{'where':{'id':_0x498616},'attributes':['name']}});};exports['getVariableById']=function(_0x2ab462){return request(_0x540b('0x15'),{'options':{'where':{'id':_0x2ab462},'attributes':[_0x540b('0x10')]}});};exports[_0x540b('0x16')]=function(_0x1efac9){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1efac9},'attributes':[_0x540b('0x17')]}});};exports[_0x540b('0x18')]=function(_0x118e5d){return request(_0x540b('0x19'),{'options':{'where':{'id':_0x118e5d},'attributes':[_0x540b('0x10')]}});};exports[_0x540b('0x1a')]=function(_0x2a3265){return request(_0x540b('0x1b'),{'options':{'where':{'phone':_0x2a3265[_0x540b('0x1c')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x1b9401){return request(_0x540b('0x1d'),{'options':{'where':{'id':_0x1b9401},'attributes':['name']}});};exports[_0x540b('0x1e')]=function(_0x4b3ec6){return request(_0x540b('0x1f'),{'options':{'where':{'id':_0x4b3ec6},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x17674c){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x17674c},'include':[{'model':_0x540b('0x20'),'as':_0x540b('0x21')}]}});};exports[_0x540b('0x22')]=function(_0x4d7422){return request(_0x540b('0x23'),{'options':{'where':{'id':_0x4d7422},'attributes':['id',_0x540b('0x10')]}});};exports[_0x540b('0x24')]=function(_0x1f69d4){return request(_0x540b('0x25'),{'body':_0x1f69d4});};exports[_0x540b('0x26')]=function(_0x3acfef){return request(_0x540b('0x27'),{'body':_0x3acfef});};exports[_0x540b('0x28')]=function(_0xc967f6){return request('CreateSquareReport',{'body':_[_0x540b('0x29')](_0xc967f6,{'project_name':_0xc967f6[_0x540b('0x2a')],'prev_project_name':_0xc967f6['arg_2']||'','is_subproject':_0xc967f6['arg_2']?!![]:![],'leaveAt':moment()[_0x540b('0x2b')](_0x540b('0x2c'))})});};exports[_0x540b('0x2d')]=function(_0x341b22){return request('CreateSquareRecording',{'body':_0x341b22});};exports[_0x540b('0x2e')]=function(_0x399a6e){return request(_0x540b('0x2f'),{'body':_0x399a6e});};exports[_0x540b('0x30')]=function(_0xd3f5f6){return request(_0x540b('0x31'),{'options':{'raw':![],'where':{'phone':_0xd3f5f6[_0x540b('0x1c')],'ListId':_0xd3f5f6['ListId']}}})['then'](function(_0x491eca){if(_0x491eca){return _0x491eca;}return request(_0x540b('0x32'),{'body':_0xd3f5f6});});};exports[_0x540b('0x33')]=function(_0x3eb220){return request('ShowPause',{'options':{'where':{'id':_0x3eb220},'attributes':['name']}});};exports[_0x540b('0x34')]=function(_0x3a9fe4,_0x541b72){return request(_0x540b('0x35'),{'body':{'interface':_0x541b72},'options':{'where':_0x3a9fe4}});};exports[_0x540b('0x36')]=function(_0x2d4922,_0x3179bb,_0x3735ca){return request(_0x540b('0x37'),{'body':{'type':_0x3179bb,'uniqueid':_0x3735ca},'options':{'where':_0x2d4922}});};exports[_0x540b('0x38')]=function(_0x113a93){return request(_0x540b('0x39'),{'body':{},'options':{'where':_0x113a93}});};exports['agentLogout']=function(_0x45a054){return request('LogoutUser',{'body':{},'options':{'where':_0x45a054}});};
\ No newline at end of file
index 7ed0d12..31e1167 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ca0=['./lex','exports','./polly'];(function(_0xbf633,_0x348b55){var _0xe4d6dc=function(_0x292d0c){while(--_0x292d0c){_0xbf633['push'](_0xbf633['shift']());}};_0xe4d6dc(++_0x348b55);}(_0x9ca0,0x65));var _0x09ca=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x9ca0[_0x24259d];return _0x5a701;};var polly=require(_0x09ca('0x0'));var lex=require(_0x09ca('0x1'));module[_0x09ca('0x2')]={'polly':polly,'lex':lex};
\ No newline at end of file
+var _0xb5dd=['exports','./polly','./lex'];(function(_0x43de22,_0x1eced6){var _0x4b15ee=function(_0x6e36da){while(--_0x6e36da){_0x43de22['push'](_0x43de22['shift']());}};_0x4b15ee(++_0x1eced6);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb5dd[_0x4b369d];return _0x571a98;};var polly=require(_0xdb5d('0x0'));var lex=require(_0xdb5d('0x1'));module[_0xdb5d('0x2')]={'polly':polly,'lex':lex};
\ No newline at end of file
index f286c22..5d9137c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4e6=['./lib/api'];(function(_0x12fe32,_0x1d5358){var _0x1701f5=function(_0x236080){while(--_0x236080){_0x12fe32['push'](_0x12fe32['shift']());}};_0x1701f5(++_0x1d5358);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0xb4e6[_0x33032e];return _0x13316b;};'use strict';var lex=require(_0x6b4e('0x0'));module['exports']=function(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad){return lex(_0x2708ca,_0x1afd20,_0x365912,_0x25ffcb,_0x44e781,_0x31e8ad);};
\ No newline at end of file
+'use strict';var lex=require('./lib/api');module['exports']=function(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4){return lex(_0x1c27bb,_0x4a4906,_0x3f643d,_0x306b6e,_0x2221f1,_0x10d2c4);};
\ No newline at end of file
index 50deceb..d150bc1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x1679e9,_0x502445){var _0x2a78aa=function(_0x573d6b){while(--_0x573d6b){_0x1679e9['push'](_0x1679e9['shift']());}};_0x2a78aa(++_0x502445);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);};
\ No newline at end of file
+var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0xeb8b1d,_0x58daaa){var _0x5327ba=function(_0x18cad3){while(--_0x18cad3){_0xeb8b1d['push'](_0xeb8b1d['shift']());}};_0x5327ba(++_0x58daaa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);};
\ No newline at end of file
index ed91447..5186ab5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd1a1=['exports'];(function(_0x3ea7e0,_0x32f7dc){var _0x3aef76=function(_0x33f74b){while(--_0x33f74b){_0x3ea7e0['push'](_0x3ea7e0['shift']());}};_0x3aef76(++_0x32f7dc);}(_0xd1a1,0xf3));var _0x1d1a=function(_0x376dd7,_0x192f2e){_0x376dd7=_0x376dd7-0x0;var _0x4f78e0=_0xd1a1[_0x376dd7];return _0x4f78e0;};'use strict';var polly=require('./lib/api');module[_0x1d1a('0x0')]=function(_0x38e495,_0x58f1c3,_0x56ed3f,_0x36b382,_0x3931ec,_0x2eaade,_0x1dfe45){return polly(_0x38e495,_0x58f1c3,_0x56ed3f,_0x36b382,_0x3931ec,_0x2eaade,_0x1dfe45);};
\ No newline at end of file
+var _0x7a8a=['exports','./lib/api'];(function(_0x2356d3,_0x45c28a){var _0x5b6ec2=function(_0x4e0efb){while(--_0x4e0efb){_0x2356d3['push'](_0x2356d3['shift']());}};_0x5b6ec2(++_0x45c28a);}(_0x7a8a,0xc1));var _0xa7a8=function(_0x59e64f,_0x514b23){_0x59e64f=_0x59e64f-0x0;var _0x17d075=_0x7a8a[_0x59e64f];return _0x17d075;};'use strict';var polly=require(_0xa7a8('0x0'));module[_0xa7a8('0x1')]=function(_0x55e148,_0xb6f278,_0x10444e,_0x38a8cd,_0x15a7d3,_0x44eb39,_0x2e43cc){return polly(_0x55e148,_0xb6f278,_0x10444e,_0x38a8cd,_0x15a7d3,_0x44eb39,_0x2e43cc);};
\ No newline at end of file
index b6c3085..39af1bc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x79f2=['AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','writeFile'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79f2,0x19f));var _0x279f=function(_0x1230aa,_0xdb0187){_0x1230aa=_0x1230aa-0x0;var _0x166f34=_0x79f2[_0x1230aa];return _0x166f34;};'use strict';var fs=require('fs');var path=require(_0x279f('0x0'));var BPromise=require(_0x279f('0x1'));var rs=require(_0x279f('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x5e81e4,_0x5d46f1,_0x14c34d){return new BPromise(function(_0x351787,_0x5b647a){_0x5e81e4[_0x279f('0x3')](_0x5d46f1,function(_0x194b4a,_0x2936e4){if(_0x194b4a){_0x5b647a(_0x194b4a);}else if(_0x2936e4){if(_0x2936e4['AudioStream']instanceof Buffer){fs[_0x279f('0x4')](_0x14c34d,_0x2936e4[_0x279f('0x5')],function(_0x3b7188){if(_0x3b7188){_0x5b647a(_0x3b7188);}else{_0x351787();}});}else{_0x5b647a(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5b647a(new Error(_0x279f('0x6')));}});});}module['exports']=function(_0x416266,_0x4f0440,_0x46770,_0x5a7af6,_0x57ef2b,_0x3d1f1f,_0x9c701){var _0x120d38=new AWS[(_0x279f('0x7'))]({'accessKeyId':_0x416266,'secretAccessKey':_0x4f0440,'region':_0x46770});var _0x51e38f={'Text':_0x57ef2b,'TextType':_0x3d1f1f||_0x279f('0x8'),'OutputFormat':_0x279f('0x9'),'VoiceId':_0x5a7af6};return pollyResult(_0x120d38,_0x51e38f,_0x9c701);};
\ No newline at end of file
+var _0x5555=['Polly','text','mp3','randomstring','aws-sdk','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x5555,0x11a));var _0x5555=function(_0x344e20,_0x127989){_0x344e20=_0x344e20-0x0;var _0x53784b=_0x5555[_0x344e20];return _0x53784b;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require('bluebird');var rs=require(_0x5555('0x0'));var AWS=require(_0x5555('0x1'));function pollyResult(_0x2b0a62,_0x3e64f6,_0x4aa95d){return new BPromise(function(_0x1db0c4,_0x141088){_0x2b0a62['synthesizeSpeech'](_0x3e64f6,function(_0x58372a,_0x6492ae){if(_0x58372a){_0x141088(_0x58372a);}else if(_0x6492ae){if(_0x6492ae[_0x5555('0x2')]instanceof Buffer){fs[_0x5555('0x3')](_0x4aa95d,_0x6492ae[_0x5555('0x2')],function(_0x2e248c){if(_0x2e248c){_0x141088(_0x2e248c);}else{_0x1db0c4();}});}else{_0x141088(new Error(_0x5555('0x4')));}}else{_0x141088(new Error(_0x5555('0x5')));}});});}module['exports']=function(_0xafbc4f,_0x5f5924,_0x3acb79,_0x3686b5,_0xf4ef7d,_0x53cf35,_0x2d1617){var _0x3bb562=new AWS[(_0x5555('0x6'))]({'accessKeyId':_0xafbc4f,'secretAccessKey':_0x5f5924,'region':_0x3acb79});var _0x488245={'Text':_0xf4ef7d,'TextType':_0x53cf35||_0x5555('0x7'),'OutputFormat':_0x5555('0x8'),'VoiceId':_0x3686b5};return pollyResult(_0x3bb562,_0x488245,_0x2d1617);};
\ No newline at end of file
index f885eaf..2531560 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7939=['./lib/api','exports'];(function(_0x48877f,_0x405f8a){var _0xdbdfa6=function(_0x2d45b9){while(--_0x2d45b9){_0x48877f['push'](_0x48877f['shift']());}};_0xdbdfa6(++_0x405f8a);}(_0x7939,0x102));var _0x9793=function(_0x46be9e,_0x2f0bcc){_0x46be9e=_0x46be9e-0x0;var _0x18cb29=_0x7939[_0x46be9e];return _0x18cb29;};'use strict';var asr=require(_0x9793('0x0'));module[_0x9793('0x1')]=function(_0x35ca08,_0x4f19ef,_0x596bd9,_0x3e9b34){return asr(_0x35ca08,_0x4f19ef,_0x596bd9);};
\ No newline at end of file
+var _0x738b=['./lib/api','exports'];(function(_0x5b9a71,_0xc56ff7){var _0x3fec24=function(_0xb6468f){while(--_0xb6468f){_0x5b9a71['push'](_0x5b9a71['shift']());}};_0x3fec24(++_0xc56ff7);}(_0x738b,0x1ba));var _0xb738=function(_0x210574,_0x243237){_0x210574=_0x210574-0x0;var _0x123ad9=_0x738b[_0x210574];return _0x123ad9;};'use strict';var asr=require(_0xb738('0x0'));module[_0xb738('0x1')]=function(_0x1bbc65,_0x39a3f1,_0x48a53d,_0x2ce1fb){return asr(_0x1bbc65,_0x39a3f1,_0x48a53d);};
\ No newline at end of file
index 8847589..26360c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf194=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','lang\x20should\x20be\x20a\x20string','readFileSync','base64','POST','/v1/speech:recognize?key='];(function(_0x6ae4a6,_0x235cce){var _0xc8f484=function(_0x1b42cf){while(--_0x1b42cf){_0x6ae4a6['push'](_0x6ae4a6['shift']());}};_0xc8f484(++_0x235cce);}(_0xf194,0x91));var _0x4f19=function(_0x1c0f43,_0x157212){_0x1c0f43=_0x1c0f43-0x0;var _0x2b4c35=_0xf194[_0x1c0f43];return _0x2b4c35;};'use strict';var url=require(_0x4f19('0x0'));var BPromise=require(_0x4f19('0x1'));var fs=require('fs');var host=_0x4f19('0x2');module[_0x4f19('0x3')]=function(_0x52e2fb,_0x13475c,_0x533c58){return new BPromise(function(_0x5db065,_0x5c0587){var _0x2db75c;if(typeof _0x52e2fb!==_0x4f19('0x4')||_0x52e2fb[_0x4f19('0x5')]===0x0){return _0x5c0587('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x13475c!==_0x4f19('0x4')||_0x13475c[_0x4f19('0x5')]===0x0){return _0x5c0587('key\x20should\x20be\x20a\x20string');}if(typeof _0x533c58!=='undefined'&&(typeof _0x533c58!==_0x4f19('0x4')||_0x533c58[_0x4f19('0x5')]===0x0)){return _0x5c0587(_0x4f19('0x6'));}try{_0x2db75c=fs[_0x4f19('0x7')](_0x52e2fb)['toString'](_0x4f19('0x8'));}catch(_0x9cb3e7){return _0x5c0587(_0x9cb3e7);}return _0x5db065({'method':_0x4f19('0x9'),'uri':host+_0x4f19('0xa')+_0x13475c,'body':{'config':{'encoding':_0x4f19('0xb'),'sampleRateHertz':_0x4f19('0xc'),'languageCode':_0x533c58},'audio':{'content':_0x2db75c}},'json':!![]});});};
\ No newline at end of file
+var _0xaf1d=['/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','readFileSync','toString','base64'];(function(_0x5ae70c,_0x524d9c){var _0xedba92=function(_0x37c669){while(--_0x37c669){_0x5ae70c['push'](_0x5ae70c['shift']());}};_0xedba92(++_0x524d9c);}(_0xaf1d,0x9f));var _0xdaf1=function(_0x44e28f,_0xa22820){_0x44e28f=_0x44e28f-0x0;var _0x1047b9=_0xaf1d[_0x44e28f];return _0x1047b9;};'use strict';var url=require(_0xdaf1('0x0'));var BPromise=require(_0xdaf1('0x1'));var fs=require('fs');var host=_0xdaf1('0x2');module[_0xdaf1('0x3')]=function(_0x5da77c,_0x30f9b1,_0x258708){return new BPromise(function(_0x5e2ffc,_0x159ded){var _0x38059d;if(typeof _0x5da77c!==_0xdaf1('0x4')||_0x5da77c[_0xdaf1('0x5')]===0x0){return _0x159ded(_0xdaf1('0x6'));}if(typeof _0x30f9b1!==_0xdaf1('0x4')||_0x30f9b1['length']===0x0){return _0x159ded('key\x20should\x20be\x20a\x20string');}if(typeof _0x258708!=='undefined'&&(typeof _0x258708!==_0xdaf1('0x4')||_0x258708['length']===0x0)){return _0x159ded('lang\x20should\x20be\x20a\x20string');}try{_0x38059d=fs[_0xdaf1('0x7')](_0x5da77c)[_0xdaf1('0x8')](_0xdaf1('0x9'));}catch(_0x2b42d7){return _0x159ded(_0x2b42d7);}return _0x5e2ffc({'method':'POST','uri':host+_0xdaf1('0xa')+_0x30f9b1,'body':{'config':{'encoding':_0xdaf1('0xb'),'sampleRateHertz':_0xdaf1('0xc'),'languageCode':_0x258708},'audio':{'content':_0x38059d}},'json':!![]});});};
\ No newline at end of file
index 52fc065..cf1b7e8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf05c=['./asr','exports'];(function(_0x4a19f7,_0x34f60a){var _0x11372a=function(_0x119228){while(--_0x119228){_0x4a19f7['push'](_0x4a19f7['shift']());}};_0x11372a(++_0x34f60a);}(_0xf05c,0xfc));var _0xcf05=function(_0xde9b70,_0x1c0d60){_0xde9b70=_0xde9b70-0x0;var _0x38db14=_0xf05c[_0xde9b70];return _0x38db14;};var asr=require(_0xcf05('0x0'));module[_0xcf05('0x1')]={'asr':asr};
\ No newline at end of file
+var _0xdf41=['exports','./asr'];(function(_0x1499c4,_0x57c5c3){var _0x3cf45a=function(_0x4bb7cb){while(--_0x4bb7cb){_0x1499c4['push'](_0x1499c4['shift']());}};_0x3cf45a(++_0x57c5c3);}(_0xdf41,0xeb));var _0x1df4=function(_0x43389e,_0x75efb4){_0x43389e=_0x43389e-0x0;var _0x48e6ca=_0xdf41[_0x43389e];return _0x48e6ca;};var asr=require(_0x1df4('0x0'));module[_0x1df4('0x1')]={'asr':asr};
\ No newline at end of file
index d9f7121..66b23b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8889=['dirName','apiai-promise','http','md5','path','querystring','request-promise','google-tts-api','parse','util','./aws','./google','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','error','pipe','data','end','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','googleCloudTTS','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','.mp3','from','writeFile','info','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','name','message','googleDialogflow','source','result','action','actionIncomplete','fulfillment','speech','score','endConversation','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0x8889,0x105));var _0x9888=function(_0x2c7709,_0x2c7148){_0x2c7709=_0x2c7709-0x0;var _0x5340bb=_0x8889[_0x2c7709];return _0x5340bb;};'use strict';var apiai=require(_0x9888('0x0'));var BPromise=require('bluebird');var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x9888('0x1'));var https=require('https');var md5=require(_0x9888('0x2'));var path=require(_0x9888('0x3'));var querystring=require(_0x9888('0x4'));var rp=require(_0x9888('0x5'));var rs=require('randomstring');var sox=require('sox');var tts=require(_0x9888('0x6'));var urlParse=require('url')[_0x9888('0x7')];var util=require(_0x9888('0x8'));var aws=require(_0x9888('0x9'));var google=require(_0x9888('0xa'));var sestek=require(_0x9888('0xb'));var tilde=require('./tilde');var logger=require(_0x9888('0xc'))(_0x9888('0xd'));var ISPEECH_API=_0x9888('0xe');function downloadFile(_0x24a1d3,_0x11a4a3){return new BPromise(function(_0xac65a,_0x167f1d){var _0x2158d2=urlParse(_0x24a1d3);var _0x2b7d93=_0x2158d2[_0x9888('0xf')]===_0x9888('0x10')?https:http;var _0xb25546={'host':_0x2158d2[_0x9888('0x11')],'path':_0x2158d2[_0x9888('0x3')],'headers':{'user-agent':_0x9888('0x12')}};_0x2b7d93[_0x9888('0x13')](_0xb25546,function(_0x5166f9){if(_0x5166f9[_0x9888('0x14')]!==0xc8){logger['error'](_0x9888('0x15')+_0x24a1d3+_0x9888('0x16')+_0x5166f9[_0x9888('0x14')]+'\x20('+_0x5166f9[_0x9888('0x17')]+')');_0x167f1d(new Error('request\x20to\x20'+_0x24a1d3+'\x20failed,\x20status\x20code\x20=\x20'+_0x5166f9['statusCode']+'\x20('+_0x5166f9[_0x9888('0x17')]+')'));return;}var _0x363abe=fs['createWriteStream'](_0x11a4a3);_0x363abe['on'](_0x9888('0x18'),function(){logger['info'](_0x9888('0x19'));_0x363abe[_0x9888('0x1a')](_0xac65a);});_0x363abe['on'](_0x9888('0x1b'),function(_0x3b570d){fs['unlink'](_0x11a4a3);logger[_0x9888('0x1b')]('download\x20error',_0x3b570d);_0x167f1d(_0x3b570d);});_0x5166f9[_0x9888('0x1c')](_0x363abe);})['on'](_0x9888('0x1b'),function(_0x26fae5){logger['error'](_0x26fae5);_0x167f1d(_0x26fae5);})['end']();});}function uploadFile(_0x46bff1){return new BPromise(function(_0x554e6c,_0x2ae1dc){var _0xada508=urlParse(_0x46bff1);var _0x329264=_0xada508['protocol']==='https:'?https:http;var _0x5563b4={'host':_0xada508['host'],'path':_0xada508['path'],'headers':{'user-agent':_0x9888('0x12')}};_0x329264['get'](_0x5563b4,function(_0x47febb){if(_0x47febb[_0x9888('0x14')]!==0xc8){_0x2ae1dc(new Error(_0x9888('0x15')+_0x46bff1+_0x9888('0x16')+_0x47febb[_0x9888('0x14')]+'\x20('+_0x47febb[_0x9888('0x17')]+')'));return;}var _0x3bcf64='';_0x47febb['on'](_0x9888('0x1d'),function(_0x324369){_0x3bcf64+=_0x324369;});_0x47febb['on'](_0x9888('0x1e'),function(){_0x554e6c(_0x3bcf64);});})['on'](_0x9888('0x1b'),function(_0x4314a3){_0x2ae1dc(_0x4314a3);})[_0x9888('0x1e')]();});}function convertFile(_0x4cac1e,_0x3c07b7){return new BPromise(function(_0x1083a2,_0x5480de){var _0x527b33=sox['transcode'](_0x4cac1e,_0x3c07b7,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x527b33['on']('error',function(_0x1998b5){logger['error'](_0x9888('0x1f'),_0x1998b5);_0x5480de(_0x1998b5);});_0x527b33['on'](_0x9888('0x1e'),function(){logger['info']('finish\x20to\x20convert');_0x1083a2();});_0x527b33[_0x9888('0x20')]();});}function base64Decode(_0x25bea0,_0x2f0c7e){var _0x4af14f=path[_0x9888('0x21')](__dirname,_0x9888('0x22'),rs[_0x9888('0x23')](0x4)+_0x9888('0x24'));fs[_0x9888('0x25')](_0x4af14f,_0x25bea0,_0x9888('0x26'));return convertFile(_0x4af14f,_0x2f0c7e)[_0x9888('0x27')](function(){try{fs[_0x9888('0x28')](_0x4af14f);fs[_0x9888('0x29')](_0x2f0c7e,_0x9888('0x2a'));}catch(_0x54675){logger['error'](_0x54675);}return _0x2f0c7e[_0x9888('0x2b')]('.')[0x0];});}function base64Encode(_0x42b389){var _0x15397e=fs['readFileSync'](_0x42b389);return new Buffer(_0x15397e)['toString']('base64');}exports[_0x9888('0x2c')]=function(_0x49ed20,_0x1abb61,_0xa9e136,_0x5dbc10,_0x1a579b,_0xced44a){var _0x2aee59,_0x276493;var _0x49cf82='https://texttospeech.googleapis.com/v1/';var _0x172ed3=_0x9888('0x2d')+_0x49ed20;var _0x18d0b4={};if(_0x1abb61==='ssml'){_0x18d0b4[_0x9888('0x2e')]={'ssml':_0xa9e136};}else{_0x18d0b4[_0x9888('0x2e')]={'text':_0xa9e136};};_0x18d0b4[_0x9888('0x2f')]={'languageCode':_0x5dbc10,'ssmlGender':_0x1a579b};_0x18d0b4[_0x9888('0x30')]={'audioEncoding':_0x9888('0x31'),'sampleRateHertz':0x1f40};var _0x12068d={'url':_0x49cf82+_0x9888('0x32')+_0x172ed3,'method':_0x9888('0x33'),'json':!![],'body':_0x18d0b4};return rp(_0x12068d)[_0x9888('0x27')](function(_0x434f7d){return new BPromise(function(_0x460ed4,_0x34d6f7){_0x2aee59=path[_0x9888('0x21')](__dirname,_0x9888('0x22'),rs[_0x9888('0x23')](0x4)+_0x9888('0x34'));var _0x434476=Buffer[_0x9888('0x35')](_0x434f7d['audioContent'],_0x9888('0x26'));return fs[_0x9888('0x36')](_0x2aee59,_0x434476,function(_0xe2a282){_0x34d6f7(_0xe2a282);},function(_0x17433c){fs['chmodSync'](_0x2aee59,_0x9888('0x2a'));_0x460ed4(_0x17433c);});});})['then'](function(_0x57e6c3){_0x276493=path[_0x9888('0x21')](__dirname,'tmp',rs[_0x9888('0x23')](0x4)+_0x9888('0x24'));return convertFile(_0x2aee59,_0x276493);})['then'](function(){try{fs['unlink'](_0x2aee59);fs[_0x9888('0x29')](_0x276493,_0x9888('0x2a'));}catch(_0x28b296){logger['error'](_0x28b296);}logger[_0x9888('0x37')](_0x9888('0x38'),_0x276493[_0x9888('0x2b')]('.')[0x0]);return _0x276493[_0x9888('0x2b')]('.')[0x0];});};exports[_0x9888('0x39')]=function(_0x1a21ad,_0x23783c){var _0x1f13d4=_0x9888('0x3a');var _0x3fccd8,_0x409cf0;var _0x13093b;var _0x435293={'encoding':_0x9888('0x3b'),'method':_0x9888('0x33'),'timeout':0x2710,'url':_0x1f13d4,'headers':{'Content-Type':_0x9888('0x3c')},'body':_0x9888('0x3d')+encodeURIComponent(JSON[_0x9888('0x3e')]([[[_0x9888('0x3f'),JSON['stringify']([_0x1a21ad,_0x23783c||'en',![],_0x9888('0x40')]),null,_0x9888('0x41')]]]))};return rp(_0x435293)[_0x9888('0x27')](function(_0x4cb229){try{_0x13093b=eval(_0x4cb229[_0x9888('0x42')](0x5))[0x0][0x2];}catch(_0x4c39c3){throw new Error(_0x9888('0x43')+_0x4cb229[_0x9888('0x1d')]);}if(!_0x13093b){if(_0x1a21ad['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error('lang\x20\x22'+_0x23783c+'\x22\x20might\x20not\x20exist');}}try{_0x13093b=eval(_0x13093b)[0x0];}catch(_0x31a8c0){throw new Error(_0x9888('0x43')+res[_0x9888('0x1d')]);}const _0x248c15=_0x13093b;_0x3fccd8=path[_0x9888('0x21')](__dirname,'tmp',rs[_0x9888('0x23')](0x4)+'.mp3');fs[_0x9888('0x25')](_0x3fccd8,_0x13093b,{'encoding':_0x9888('0x26')});_0x409cf0=path[_0x9888('0x21')](__dirname,_0x9888('0x22'),rs[_0x9888('0x23')](0x4)+_0x9888('0x24'));return convertFile(_0x3fccd8,_0x409cf0);})[_0x9888('0x27')](function(){try{fs[_0x9888('0x28')](_0x3fccd8);fs[_0x9888('0x29')](_0x409cf0,_0x9888('0x2a'));}catch(_0x2f30be){logger[_0x9888('0x1b')](_0x2f30be);}logger[_0x9888('0x37')](_0x9888('0x44'),_0x409cf0[_0x9888('0x2b')]('.')[0x0]);return _0x409cf0[_0x9888('0x2b')]('.')[0x0];});};exports[_0x9888('0x45')]=function(_0xf50ac8,_0x4cb640,_0x423fb9){return google[_0x9888('0x46')](_0xf50ac8,_0x4cb640,_0x423fb9)['then'](function(_0x28b65f){logger['info'](_0x28b65f[_0x9888('0x47')]);return rp(_0x28b65f);})[_0x9888('0x27')](function(_0x591f0f){var _0x3ccaa2='';var _0x48f517=0x0;try{fs[_0x9888('0x28')](_0xf50ac8);}catch(_0x579161){logger[_0x9888('0x1b')](_0x579161);}if(_0x591f0f&&_0x591f0f[_0x9888('0x48')]){_0x3ccaa2=_0x591f0f[_0x9888('0x48')][_0x9888('0x49')](function(_0x27190e){return _0x27190e&&_0x27190e[_0x9888('0x4a')][0x0]&&_0x27190e[_0x9888('0x4a')][0x0][_0x9888('0x4b')]?_0x27190e[_0x9888('0x4a')][0x0][_0x9888('0x4b')]:'';})[_0x9888('0x4c')]('\x0a');_0x48f517=_0x591f0f[_0x9888('0x48')]['map'](function(_0x40fbb0){return _0x40fbb0&&_0x40fbb0[_0x9888('0x4a')][0x0]&&_0x40fbb0[_0x9888('0x4a')][0x0]['confidence']?_0x40fbb0['alternatives'][0x0][_0x9888('0x4d')]:0x0;})[_0x9888('0x4c')]('\x0a');}logger[_0x9888('0x37')](_0x9888('0x4e'),_0x3ccaa2);logger['info']('googleASR\x20confidence',_0x48f517);return{'transcript':_0x3ccaa2,'confidence':_0x48f517};})[_0x9888('0x4f')](function(_0x250834){logger[_0x9888('0x1b')]('[%s]\x20%s:%s',_0x250834[_0x9888('0x14')],_0x250834[_0x9888('0x50')],_0x250834[_0x9888('0x51')]);});};exports[_0x9888('0x52')]=function(_0x3c5f3e,_0x393fc9,_0x357a50,_0x45abe2){var _0x368272=apiai(_0x393fc9,{'language':_0x45abe2||'en'});return _0x368272['textRequest'](_0x357a50,{'sessionId':md5(_0x3c5f3e)})[_0x9888('0x27')](function(_0x21bcd0){logger['info'](JSON[_0x9888('0x3e')](_0x21bcd0));return{'source':_0x21bcd0['result'][_0x9888('0x53')],'resolvedQuery':_0x21bcd0[_0x9888('0x54')]['resolvedQuery'],'action':_0x21bcd0[_0x9888('0x54')][_0x9888('0x55')],'actionIncomplete':_0x21bcd0[_0x9888('0x54')][_0x9888('0x56')],'speech':_0x21bcd0['result'][_0x9888('0x57')][_0x9888('0x58')],'score':_0x21bcd0[_0x9888('0x54')][_0x9888('0x59')],'statusCode':_0x21bcd0['status']['code'],'endConversation':_0x21bcd0['result']['metadata'][_0x9888('0x5a')]||![],'isFallbackIntent':_0x21bcd0[_0x9888('0x54')]['metadata'][_0x9888('0x5b')]};});};exports[_0x9888('0x5c')]=function(_0x219159,_0x952aac,_0x18d637,_0x4ff842,_0x4e859b,_0x3392e3){var _0x3e54de=_0x4ff842['replace'](/\\n/g,'\x0a');var _0x1a206e={'credentials':{'private_key':_0x3e54de,'client_email':_0x18d637}};var _0x237845=new dialogflow[(_0x9888('0x5d'))](_0x1a206e);var _0x5d7956=_0x237845[_0x9888('0x5e')](_0x952aac,md5(_0x219159));var _0x22e5d4={'session':_0x5d7956,'queryInput':{'text':{'text':_0x4e859b,'languageCode':_0x3392e3}}};return _0x237845[_0x9888('0x5f')](_0x22e5d4)['then'](function(_0x5031cc){if(_0x5031cc&&_0x5031cc[_0x9888('0x60')]){logger[_0x9888('0x37')]('Dialogflow\x20V2\x20response:',JSON[_0x9888('0x3e')](_0x5031cc));var _0x2cd319=_0x5031cc[0x0];if(_0x2cd319){var _0x17e877={'action':_0x2cd319[_0x9888('0x61')][_0x9888('0x55')],'allRequiredParamsPresent':_0x2cd319['queryResult'][_0x9888('0x62')],'endConversation':_0x2cd319[_0x9888('0x61')][_0x9888('0x63')]&&_0x2cd319[_0x9888('0x61')][_0x9888('0x63')]['fields']?_0x2cd319[_0x9888('0x61')][_0x9888('0x63')][_0x9888('0x64')][_0x9888('0x65')][_0x9888('0x66')]:![],'fulfillmentText':_0x2cd319['queryResult'][_0x9888('0x67')],'intentName':_0x2cd319[_0x9888('0x61')][_0x9888('0x68')][_0x9888('0x50')],'intentDisplayName':_0x2cd319['queryResult'][_0x9888('0x68')]['displayName'],'isFallbackIntent':_0x2cd319[_0x9888('0x61')][_0x9888('0x68')][_0x9888('0x69')],'languageCode':_0x2cd319[_0x9888('0x61')][_0x9888('0x6a')],'queryText':_0x2cd319[_0x9888('0x61')][_0x9888('0x6b')],'responseId':_0x2cd319['responseId'],'score':_0x2cd319[_0x9888('0x61')][_0x9888('0x6c')],'speech':_0x2cd319['queryResult'][_0x9888('0x67')],'providerResponse':JSON[_0x9888('0x3e')](_0x5031cc)};return _0x17e877;}}});};exports[_0x9888('0x6d')]=function(_0x36d74b,_0x128628,_0x59a847,_0x336f95){return tilde[_0x9888('0x46')](_0x36d74b,_0x128628,_0x59a847,_0x336f95)['then'](function(_0x3ad5ac){try{fs[_0x9888('0x28')](_0x36d74b);}catch(_0x49af86){logger[_0x9888('0x1b')](_0x49af86);}logger[_0x9888('0x37')](_0x9888('0x6e'),_0x3ad5ac[_0x9888('0x4b')]);logger[_0x9888('0x37')]('Tilde\x20ASR\x20confidence',_0x3ad5ac[_0x9888('0x4d')]);return _0x3ad5ac;});};exports[_0x9888('0x6f')]=function(_0x533847,_0x386e60,_0x3bb496,_0x5cd9e8,_0x30a032,_0x958431){var _0xc7bdaa=path[_0x9888('0x21')](__dirname,_0x9888('0x22'),rs[_0x9888('0x23')](0x4)+_0x9888('0x34'));var _0x1c7880;return aws[_0x9888('0x70')](_0x533847,_0x386e60,_0x3bb496,_0x5cd9e8,_0x30a032,_0x958431,_0xc7bdaa)[_0x9888('0x27')](function(){_0x1c7880=path[_0x9888('0x21')](__dirname,_0x9888('0x22'),rs[_0x9888('0x23')](0x4)+_0x9888('0x24'));return convertFile(_0xc7bdaa,_0x1c7880);})[_0x9888('0x27')](function(){try{fs[_0x9888('0x28')](_0xc7bdaa);fs['chmodSync'](_0x1c7880,_0x9888('0x2a'));}catch(_0x590848){logger['error'](_0x590848);}return _0x1c7880[_0x9888('0x2b')]('.')[0x0];});};exports[_0x9888('0x71')]=function(_0x333327,_0xafdf76,_0x296f36,_0x4f98ce,_0x37e2ff,_0x42ac93){return aws[_0x9888('0x72')](_0x333327,_0xafdf76,_0x296f36,_0x4f98ce,_0x37e2ff,_0x42ac93)[_0x9888('0x27')](function(_0x32300f){logger[_0x9888('0x37')](JSON[_0x9888('0x3e')](_0x32300f));return _0x32300f;});};exports[_0x9888('0x73')]=function(_0x31d3f8,_0x5d9b8f,_0x54fdbb,_0xb49a23){var _0x3cc358=util[_0x9888('0x74')](_0x9888('0x75'),ISPEECH_API,_0x31d3f8,encodeURIComponent(_0x5d9b8f),_0x54fdbb,_0xb49a23);var _0x803d6a=path[_0x9888('0x21')](__dirname,'tmp',rs['generate'](0x4)+'.mp3');var _0x1436ca;return downloadFile(_0x3cc358,_0x803d6a)[_0x9888('0x27')](function(){_0x1436ca=path[_0x9888('0x21')](__dirname,_0x9888('0x22'),rs['generate'](0x4)+_0x9888('0x24'));return convertFile(_0x803d6a,_0x1436ca);})[_0x9888('0x27')](function(){try{fs[_0x9888('0x28')](_0x803d6a);fs[_0x9888('0x29')](_0x1436ca,_0x9888('0x2a'));}catch(_0x1662f5){logger[_0x9888('0x1b')](_0x1662f5);}return _0x1436ca[_0x9888('0x2b')]('.')[0x0];});};exports[_0x9888('0x76')]=function(_0x1c00db,_0x5e4b3b,_0x514649,_0x4ff6fa){var _0x2fe33c=util[_0x9888('0x74')](_0x9888('0x77'),ISPEECH_API,_0x5e4b3b,_0x514649,base64Encode(_0x1c00db),_0x4ff6fa?util[_0x9888('0x74')](_0x9888('0x78'),encodeURIComponent(_0x4ff6fa)):_0x9888('0x79'));return uploadFile(_0x2fe33c)[_0x9888('0x27')](function(_0x30e0e1){return querystring['parse'](_0x30e0e1);});};exports['sestekNDA']=function(_0x13104d,_0x212fa2){return sestek[_0x9888('0x7a')](_0x13104d,_0x212fa2)['then'](function(_0x40d7b0){logger['info'](JSON[_0x9888('0x3e')](_0x40d7b0));var _0x3eea1a={'speech':_0x40d7b0['text'],'action':_0x40d7b0[_0x9888('0x7b')]?_0x40d7b0[_0x9888('0x7b')][_0x9888('0x7c')]:undefined,'actiondata':_0x40d7b0['channelData']?_0x40d7b0['channelData'][_0x9888('0x7d')]:undefined};if(_0x40d7b0[_0x9888('0x7b')]&&_0x40d7b0['channelData'][_0x9888('0x7e')]){return base64Decode(_0x40d7b0['channelData'][_0x9888('0x7e')][_0x9888('0x7f')],path[_0x9888('0x21')](__dirname,_0x9888('0x22'),rs[_0x9888('0x23')](0x4)+_0x9888('0x24')))[_0x9888('0x27')](function(_0x568a6a){_0x3eea1a[_0x9888('0x80')]=_0x568a6a;return _0x3eea1a;});}return _0x3eea1a;});};exports[_0x9888('0x81')]=function(){return __dirname;};
\ No newline at end of file
+var _0x2c6a=['.mp3','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','jQ1olc','stringify','generic','parse\x20response\x20failed:\x0a','data','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','catch','[%s]\x20%s:%s','name','message','textRequest','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','status','code','endConversation','metadata','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','parse','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','https','path','request-promise','randomstring','google-tts-api','url','util','./aws','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','finish\x20download\x20file','close','error','unlink','pipe','end','error\x20convert','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','readFileSync','toString','googleCloudTTS','?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST'];(function(_0x2558ee,_0x2a2574){var _0x431306=function(_0x32cb67){while(--_0x32cb67){_0x2558ee['push'](_0x2558ee['shift']());}};_0x431306(++_0x2a2574);}(_0x2c6a,0xd5));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var apiai=require(_0xa2c6('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0xa2c6('0x1'));var fs=require('fs');var http=require('http');var https=require(_0xa2c6('0x2'));var md5=require('md5');var path=require(_0xa2c6('0x3'));var querystring=require('querystring');var rp=require(_0xa2c6('0x4'));var rs=require(_0xa2c6('0x5'));var sox=require('sox');var tts=require(_0xa2c6('0x6'));var urlParse=require(_0xa2c6('0x7'))['parse'];var util=require(_0xa2c6('0x8'));var aws=require(_0xa2c6('0x9'));var google=require(_0xa2c6('0xa'));var sestek=require(_0xa2c6('0xb'));var tilde=require(_0xa2c6('0xc'));var logger=require('../../../config/logger')(_0xa2c6('0xd'));var ISPEECH_API=_0xa2c6('0xe');function downloadFile(_0x338e55,_0x54f261){return new BPromise(function(_0x40ff56,_0xc13f8d){var _0x4116c1=urlParse(_0x338e55);var _0x3ac288=_0x4116c1[_0xa2c6('0xf')]===_0xa2c6('0x10')?https:http;var _0x5c7436={'host':_0x4116c1[_0xa2c6('0x11')],'path':_0x4116c1[_0xa2c6('0x3')],'headers':{'user-agent':_0xa2c6('0x12')}};_0x3ac288[_0xa2c6('0x13')](_0x5c7436,function(_0x53aa05){if(_0x53aa05[_0xa2c6('0x14')]!==0xc8){logger['error'](_0xa2c6('0x15')+_0x338e55+_0xa2c6('0x16')+_0x53aa05['statusCode']+'\x20('+_0x53aa05[_0xa2c6('0x17')]+')');_0xc13f8d(new Error('request\x20to\x20'+_0x338e55+_0xa2c6('0x16')+_0x53aa05['statusCode']+'\x20('+_0x53aa05[_0xa2c6('0x17')]+')'));return;}var _0x4dd0af=fs[_0xa2c6('0x18')](_0x54f261);_0x4dd0af['on'](_0xa2c6('0x19'),function(){logger['info'](_0xa2c6('0x1a'));_0x4dd0af[_0xa2c6('0x1b')](_0x40ff56);});_0x4dd0af['on'](_0xa2c6('0x1c'),function(_0x562a2c){fs[_0xa2c6('0x1d')](_0x54f261);logger[_0xa2c6('0x1c')]('download\x20error',_0x562a2c);_0xc13f8d(_0x562a2c);});_0x53aa05[_0xa2c6('0x1e')](_0x4dd0af);})['on']('error',function(_0x74afc2){logger[_0xa2c6('0x1c')](_0x74afc2);_0xc13f8d(_0x74afc2);})[_0xa2c6('0x1f')]();});}function uploadFile(_0x44f224){return new BPromise(function(_0x51b0b3,_0x33e5a8){var _0x4702be=urlParse(_0x44f224);var _0x2d95bc=_0x4702be[_0xa2c6('0xf')]===_0xa2c6('0x10')?https:http;var _0x565a6c={'host':_0x4702be['host'],'path':_0x4702be[_0xa2c6('0x3')],'headers':{'user-agent':_0xa2c6('0x12')}};_0x2d95bc[_0xa2c6('0x13')](_0x565a6c,function(_0x3e65b){if(_0x3e65b[_0xa2c6('0x14')]!==0xc8){_0x33e5a8(new Error('request\x20to\x20'+_0x44f224+_0xa2c6('0x16')+_0x3e65b[_0xa2c6('0x14')]+'\x20('+_0x3e65b[_0xa2c6('0x17')]+')'));return;}var _0x1cd77e='';_0x3e65b['on']('data',function(_0x471c3d){_0x1cd77e+=_0x471c3d;});_0x3e65b['on'](_0xa2c6('0x1f'),function(){_0x51b0b3(_0x1cd77e);});})['on'](_0xa2c6('0x1c'),function(_0x4dc1b9){_0x33e5a8(_0x4dc1b9);})[_0xa2c6('0x1f')]();});}function convertFile(_0x3842b1,_0x5cc3f3){return new BPromise(function(_0x559276,_0x435a30){var _0x5cf642=sox['transcode'](_0x3842b1,_0x5cc3f3,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5cf642['on'](_0xa2c6('0x1c'),function(_0x2d62dd){logger[_0xa2c6('0x1c')](_0xa2c6('0x20'),_0x2d62dd);_0x435a30(_0x2d62dd);});_0x5cf642['on'](_0xa2c6('0x1f'),function(){logger[_0xa2c6('0x21')](_0xa2c6('0x22'));_0x559276();});_0x5cf642[_0xa2c6('0x23')]();});}function base64Decode(_0x1e58b5,_0x4362e7){var _0xbb47c9=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x27'));fs[_0xa2c6('0x28')](_0xbb47c9,_0x1e58b5,_0xa2c6('0x29'));return convertFile(_0xbb47c9,_0x4362e7)[_0xa2c6('0x2a')](function(){try{fs[_0xa2c6('0x1d')](_0xbb47c9);fs[_0xa2c6('0x2b')](_0x4362e7,_0xa2c6('0x2c'));}catch(_0x2040bb){logger[_0xa2c6('0x1c')](_0x2040bb);}return _0x4362e7[_0xa2c6('0x2d')]('.')[0x0];});}function base64Encode(_0x1e7fcc){var _0x2925d3=fs[_0xa2c6('0x2e')](_0x1e7fcc);return new Buffer(_0x2925d3)[_0xa2c6('0x2f')](_0xa2c6('0x29'));}exports[_0xa2c6('0x30')]=function(_0x4b3d68,_0x3f4828,_0x1d745,_0xbca0db,_0x283a5c,_0x26e02b){var _0x163fe5,_0x4ffbb8;var _0x403522='https://texttospeech.googleapis.com/v1/';var _0x35db03=_0xa2c6('0x31')+_0x4b3d68;var _0x3fb233={};if(_0x3f4828===_0xa2c6('0x32')){_0x3fb233['input']={'ssml':_0x1d745};}else{_0x3fb233[_0xa2c6('0x33')]={'text':_0x1d745};};_0x3fb233[_0xa2c6('0x34')]={'languageCode':_0xbca0db,'ssmlGender':_0x283a5c};_0x3fb233[_0xa2c6('0x35')]={'audioEncoding':_0xa2c6('0x36'),'sampleRateHertz':0x1f40};var _0xcf8bc2={'url':_0x403522+_0xa2c6('0x37')+_0x35db03,'method':_0xa2c6('0x38'),'json':!![],'body':_0x3fb233};return rp(_0xcf8bc2)[_0xa2c6('0x2a')](function(_0x5bb1be){return new BPromise(function(_0x275945,_0x13e824){_0x163fe5=path[_0xa2c6('0x24')](__dirname,'tmp',rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x39'));var _0x13acb9=Buffer['from'](_0x5bb1be[_0xa2c6('0x3a')],_0xa2c6('0x29'));return fs[_0xa2c6('0x3b')](_0x163fe5,_0x13acb9,function(_0x13f62f){_0x13e824(_0x13f62f);},function(_0x128b05){fs[_0xa2c6('0x2b')](_0x163fe5,_0xa2c6('0x2c'));_0x275945(_0x128b05);});});})[_0xa2c6('0x2a')](function(_0x1a0a05){_0x4ffbb8=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs['generate'](0x4)+_0xa2c6('0x27'));return convertFile(_0x163fe5,_0x4ffbb8);})['then'](function(){try{fs[_0xa2c6('0x1d')](_0x163fe5);fs['chmodSync'](_0x4ffbb8,_0xa2c6('0x2c'));}catch(_0x3b6094){logger[_0xa2c6('0x1c')](_0x3b6094);}logger[_0xa2c6('0x21')](_0xa2c6('0x3c'),_0x4ffbb8[_0xa2c6('0x2d')]('.')[0x0]);return _0x4ffbb8[_0xa2c6('0x2d')]('.')[0x0];});};exports[_0xa2c6('0x3d')]=function(_0x5f3c52,_0xee81bf){var _0x473c52=_0xa2c6('0x3e');var _0x15fba4,_0x490a8c;var _0x44c2af;var _0x4cb29f={'encoding':_0xa2c6('0x3f'),'method':'POST','timeout':0x2710,'url':_0x473c52,'headers':{'Content-Type':_0xa2c6('0x40')},'body':_0xa2c6('0x41')+encodeURIComponent(JSON['stringify']([[[_0xa2c6('0x42'),JSON[_0xa2c6('0x43')]([_0x5f3c52,_0xee81bf||'en',![],'null']),null,_0xa2c6('0x44')]]]))};return rp(_0x4cb29f)[_0xa2c6('0x2a')](function(_0x5ef490){try{_0x44c2af=eval(_0x5ef490['slice'](0x5))[0x0][0x2];}catch(_0x34e656){throw new Error(_0xa2c6('0x45')+_0x5ef490[_0xa2c6('0x46')]);}if(!_0x44c2af){if(_0x5f3c52['length']>0xc8){throw new Error(_0xa2c6('0x47'));}else{throw new Error('lang\x20\x22'+_0xee81bf+_0xa2c6('0x48'));}}try{_0x44c2af=eval(_0x44c2af)[0x0];}catch(_0x529e8c){throw new Error(_0xa2c6('0x45')+res['data']);}const _0x215f4c=_0x44c2af;_0x15fba4=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x39'));fs['writeFileSync'](_0x15fba4,_0x44c2af,{'encoding':_0xa2c6('0x29')});_0x490a8c=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x27'));return convertFile(_0x15fba4,_0x490a8c);})[_0xa2c6('0x2a')](function(){try{fs['unlink'](_0x15fba4);fs['chmodSync'](_0x490a8c,_0xa2c6('0x2c'));}catch(_0x4d43e8){logger[_0xa2c6('0x1c')](_0x4d43e8);}logger[_0xa2c6('0x21')](_0xa2c6('0x49'),_0x490a8c[_0xa2c6('0x2d')]('.')[0x0]);return _0x490a8c['split']('.')[0x0];});};exports[_0xa2c6('0x4a')]=function(_0x3f2926,_0x52cd8f,_0xbd18b8){return google[_0xa2c6('0x4b')](_0x3f2926,_0x52cd8f,_0xbd18b8)[_0xa2c6('0x2a')](function(_0x505e84){logger[_0xa2c6('0x21')](_0x505e84[_0xa2c6('0x4c')]);return rp(_0x505e84);})[_0xa2c6('0x2a')](function(_0x1d5ffa){var _0x5e5d98='';var _0x2d09a1=0x0;try{fs['unlink'](_0x3f2926);}catch(_0x107340){logger[_0xa2c6('0x1c')](_0x107340);}if(_0x1d5ffa&&_0x1d5ffa[_0xa2c6('0x4d')]){_0x5e5d98=_0x1d5ffa[_0xa2c6('0x4d')][_0xa2c6('0x4e')](function(_0xbc75f8){return _0xbc75f8&&_0xbc75f8[_0xa2c6('0x4f')][0x0]&&_0xbc75f8[_0xa2c6('0x4f')][0x0][_0xa2c6('0x50')]?_0xbc75f8[_0xa2c6('0x4f')][0x0]['transcript']:'';})[_0xa2c6('0x51')]('\x0a');_0x2d09a1=_0x1d5ffa[_0xa2c6('0x4d')][_0xa2c6('0x4e')](function(_0x2d3965){return _0x2d3965&&_0x2d3965['alternatives'][0x0]&&_0x2d3965['alternatives'][0x0]['confidence']?_0x2d3965[_0xa2c6('0x4f')][0x0][_0xa2c6('0x52')]:0x0;})[_0xa2c6('0x51')]('\x0a');}logger[_0xa2c6('0x21')](_0xa2c6('0x53'),_0x5e5d98);logger[_0xa2c6('0x21')]('googleASR\x20confidence',_0x2d09a1);return{'transcript':_0x5e5d98,'confidence':_0x2d09a1};})[_0xa2c6('0x54')](function(_0x20b160){logger['error'](_0xa2c6('0x55'),_0x20b160[_0xa2c6('0x14')],_0x20b160[_0xa2c6('0x56')],_0x20b160[_0xa2c6('0x57')]);});};exports['googleDialogflow']=function(_0x44f986,_0x4dd56d,_0x15498f,_0x5f2b90){var _0x1c8f54=apiai(_0x4dd56d,{'language':_0x5f2b90||'en'});return _0x1c8f54[_0xa2c6('0x58')](_0x15498f,{'sessionId':md5(_0x44f986)})[_0xa2c6('0x2a')](function(_0x525000){logger[_0xa2c6('0x21')](JSON['stringify'](_0x525000));return{'source':_0x525000[_0xa2c6('0x59')][_0xa2c6('0x5a')],'resolvedQuery':_0x525000[_0xa2c6('0x59')][_0xa2c6('0x5b')],'action':_0x525000[_0xa2c6('0x59')]['action'],'actionIncomplete':_0x525000['result'][_0xa2c6('0x5c')],'speech':_0x525000[_0xa2c6('0x59')][_0xa2c6('0x5d')][_0xa2c6('0x5e')],'score':_0x525000['result']['score'],'statusCode':_0x525000[_0xa2c6('0x5f')][_0xa2c6('0x60')],'endConversation':_0x525000['result']['metadata'][_0xa2c6('0x61')]||![],'isFallbackIntent':_0x525000[_0xa2c6('0x59')][_0xa2c6('0x62')][_0xa2c6('0x63')]};});};exports['googleDialogflowV2']=function(_0x4135cd,_0x47f4ff,_0x4271b7,_0x1d0241,_0x1c152a,_0x25b1fd){var _0x21e505=_0x1d0241[_0xa2c6('0x64')](/\\n/g,'\x0a');var _0x112f62={'credentials':{'private_key':_0x21e505,'client_email':_0x4271b7}};var _0x31d558=new dialogflow[(_0xa2c6('0x65'))](_0x112f62);var _0x1ffb4b=_0x31d558[_0xa2c6('0x66')](_0x47f4ff,md5(_0x4135cd));var _0x391ade={'session':_0x1ffb4b,'queryInput':{'text':{'text':_0x1c152a,'languageCode':_0x25b1fd}}};return _0x31d558['detectIntent'](_0x391ade)['then'](function(_0xb96a19){if(_0xb96a19&&_0xb96a19['length']){logger[_0xa2c6('0x21')](_0xa2c6('0x67'),JSON['stringify'](_0xb96a19));var _0x123dfb=_0xb96a19[0x0];if(_0x123dfb){var _0x13fd54={'action':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x69')],'allRequiredParamsPresent':_0x123dfb[_0xa2c6('0x68')]['allRequiredParamsPresent'],'endConversation':_0x123dfb['queryResult'][_0xa2c6('0x6a')]&&_0x123dfb['queryResult'][_0xa2c6('0x6a')][_0xa2c6('0x6b')]?_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6a')][_0xa2c6('0x6b')][_0xa2c6('0x6c')][_0xa2c6('0x6d')]:![],'fulfillmentText':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6e')],'intentName':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6f')]['name'],'intentDisplayName':_0x123dfb['queryResult'][_0xa2c6('0x6f')][_0xa2c6('0x70')],'isFallbackIntent':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6f')]['isFallback'],'languageCode':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x71')],'queryText':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x72')],'responseId':_0x123dfb[_0xa2c6('0x73')],'score':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x74')],'speech':_0x123dfb[_0xa2c6('0x68')][_0xa2c6('0x6e')],'providerResponse':JSON[_0xa2c6('0x43')](_0xb96a19)};return _0x13fd54;}}});};exports['tildeASR']=function(_0x388bb9,_0x196332,_0x5966a2,_0x2c1541){return tilde[_0xa2c6('0x4b')](_0x388bb9,_0x196332,_0x5966a2,_0x2c1541)[_0xa2c6('0x2a')](function(_0x3aa606){try{fs[_0xa2c6('0x1d')](_0x388bb9);}catch(_0x4f1bcb){logger[_0xa2c6('0x1c')](_0x4f1bcb);}logger['info'](_0xa2c6('0x75'),_0x3aa606[_0xa2c6('0x50')]);logger[_0xa2c6('0x21')](_0xa2c6('0x76'),_0x3aa606[_0xa2c6('0x52')]);return _0x3aa606;});};exports['awsPolly']=function(_0x207ed8,_0x29510b,_0x1a47fe,_0xa12d1,_0x5bc744,_0x492c8d){var _0x104051=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x39'));var _0x1bb1b4;return aws[_0xa2c6('0x77')](_0x207ed8,_0x29510b,_0x1a47fe,_0xa12d1,_0x5bc744,_0x492c8d,_0x104051)[_0xa2c6('0x2a')](function(){_0x1bb1b4=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x27'));return convertFile(_0x104051,_0x1bb1b4);})[_0xa2c6('0x2a')](function(){try{fs[_0xa2c6('0x1d')](_0x104051);fs[_0xa2c6('0x2b')](_0x1bb1b4,_0xa2c6('0x2c'));}catch(_0x188b04){logger[_0xa2c6('0x1c')](_0x188b04);}return _0x1bb1b4[_0xa2c6('0x2d')]('.')[0x0];});};exports[_0xa2c6('0x78')]=function(_0xccb995,_0x38cb44,_0x2e6303,_0x2cdd4c,_0x108fbf,_0x38086f){return aws[_0xa2c6('0x79')](_0xccb995,_0x38cb44,_0x2e6303,_0x2cdd4c,_0x108fbf,_0x38086f)['then'](function(_0xf68566){logger[_0xa2c6('0x21')](JSON['stringify'](_0xf68566));return _0xf68566;});};exports['ispeechTTS']=function(_0x2915ff,_0x2dca2,_0x5f142a,_0x1ad634){var _0x487f57=util[_0xa2c6('0x7a')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2915ff,encodeURIComponent(_0x2dca2),_0x5f142a,_0x1ad634);var _0x21e10c=path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+'.mp3');var _0x145ac9;return downloadFile(_0x487f57,_0x21e10c)['then'](function(){_0x145ac9=path['resolve'](__dirname,_0xa2c6('0x25'),rs[_0xa2c6('0x26')](0x4)+_0xa2c6('0x27'));return convertFile(_0x21e10c,_0x145ac9);})[_0xa2c6('0x2a')](function(){try{fs[_0xa2c6('0x1d')](_0x21e10c);fs[_0xa2c6('0x2b')](_0x145ac9,_0xa2c6('0x2c'));}catch(_0x2ac3e0){logger[_0xa2c6('0x1c')](_0x2ac3e0);}return _0x145ac9[_0xa2c6('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x5d3b09,_0x3b8f6c,_0x1027c9,_0x1aadd7){var _0x310f55=util['format'](_0xa2c6('0x7b'),ISPEECH_API,_0x3b8f6c,_0x1027c9,base64Encode(_0x5d3b09),_0x1aadd7?util[_0xa2c6('0x7a')](_0xa2c6('0x7c'),encodeURIComponent(_0x1aadd7)):_0xa2c6('0x7d'));return uploadFile(_0x310f55)[_0xa2c6('0x2a')](function(_0x5d68a8){return querystring[_0xa2c6('0x7e')](_0x5d68a8);});};exports['sestekNDA']=function(_0x3c6fee,_0x1926cb){return sestek[_0xa2c6('0x7f')](_0x3c6fee,_0x1926cb)[_0xa2c6('0x2a')](function(_0x444551){logger[_0xa2c6('0x21')](JSON[_0xa2c6('0x43')](_0x444551));var _0x4efc4b={'speech':_0x444551[_0xa2c6('0x80')],'action':_0x444551[_0xa2c6('0x81')]?_0x444551[_0xa2c6('0x81')][_0xa2c6('0x82')]:undefined,'actiondata':_0x444551['channelData']?_0x444551[_0xa2c6('0x81')]['CustomActionData']:undefined};if(_0x444551[_0xa2c6('0x81')]&&_0x444551[_0xa2c6('0x81')][_0xa2c6('0x83')]){return base64Decode(_0x444551['channelData'][_0xa2c6('0x83')][_0xa2c6('0x84')],path[_0xa2c6('0x24')](__dirname,_0xa2c6('0x25'),rs['generate'](0x4)+_0xa2c6('0x27')))['then'](function(_0x5a4e5a){_0x4efc4b[_0xa2c6('0x85')]=_0x5a4e5a;return _0x4efc4b;});}return _0x4efc4b;});};exports[_0xa2c6('0x86')]=function(){return __dirname;};
\ No newline at end of file
index 41d017d..ac9b1f2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94e5=['./nda'];(function(_0x56a839,_0x4de5d6){var _0x202e43=function(_0x356304){while(--_0x356304){_0x56a839['push'](_0x56a839['shift']());}};_0x202e43(++_0x4de5d6);}(_0x94e5,0x1d0));var _0x594e=function(_0x11d63f,_0x28885b){_0x11d63f=_0x11d63f-0x0;var _0x342272=_0x94e5[_0x11d63f];return _0x342272;};var nda=require(_0x594e('0x0'));module['exports']={'nda':nda};
\ No newline at end of file
+var _0xda1a=['./nda'];(function(_0x503790,_0x525c78){var _0x388092=function(_0x2ab2b8){while(--_0x2ab2b8){_0x503790['push'](_0x503790['shift']());}};_0x388092(++_0x525c78);}(_0xda1a,0x1ea));var _0xada1=function(_0x1841b7,_0x27bf28){_0x1841b7=_0x1841b7-0x0;var _0x530efc=_0xda1a[_0x1841b7];return _0x530efc;};var nda=require(_0xada1('0x0'));module['exports']={'nda':nda};
\ No newline at end of file
index 9f7e3ac..79d0743 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34b2=['custom_action','CustomAction','custom_action_data','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','project','body','ProjectName','channelData','audio/wav'];(function(_0x55b0a9,_0x49e5e1){var _0x1cf50e=function(_0x40f17b){while(--_0x40f17b){_0x55b0a9['push'](_0x55b0a9['shift']());}};_0x1cf50e(++_0x49e5e1);}(_0x34b2,0x11c));var _0x234b=function(_0x1dd7eb,_0x13b76a){_0x1dd7eb=_0x1dd7eb-0x0;var _0x3e6f1b=_0x34b2[_0x1dd7eb];return _0x3e6f1b;};'use strict';var rp=require(_0x234b('0x0'));var url=require(_0x234b('0x1'));var logger=require(_0x234b('0x2'))(_0x234b('0x3'));module[_0x234b('0x4')]=function(_0x15fe02,_0x1f63a5){var _0x224eb0={'method':_0x234b('0x5'),'uri':url[_0x234b('0x6')](_0x1f63a5[_0x234b('0x7')],_0x234b('0x8')),'form':{'grant_type':_0x234b('0x9'),'username':_0x1f63a5['username'],'password':_0x1f63a5['password']},'json':!![]};return rp(_0x224eb0)['then'](function(_0x2eb07e){var _0x84f1f0={'method':_0x234b('0x5'),'uri':url[_0x234b('0x6')](_0x1f63a5['ndassistant_url'],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1f63a5[_0x234b('0xa')]||_0x234b('0xb'),'channelId':_0x234b('0xc'),'conversation':{'id':_0x15fe02[_0x234b('0xd')]},'from':{'id':_0x15fe02[_0x234b('0xe')],'name':_0x15fe02[_0x234b('0xf')]},'recipient':{'id':_0x15fe02[_0x234b('0x10')],'name':_0x15fe02[_0x234b('0x11')]},'text':_0x1f63a5[_0x234b('0x12')],'channelData':{}},'headers':{'Authorization':_0x234b('0x13')+_0x2eb07e[_0x234b('0x14')]},'json':!![]};if(_0x1f63a5[_0x234b('0x15')]){_0x84f1f0[_0x234b('0x16')]['channelData'][_0x234b('0x17')]=_0x1f63a5[_0x234b('0x15')];}if(_0x1f63a5['ndagenerate_audio']=='1'){_0x84f1f0[_0x234b('0x16')][_0x234b('0x18')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x234b('0x19')};}if(_0x1f63a5[_0x234b('0x1a')]){_0x84f1f0[_0x234b('0x16')][_0x234b('0x18')][_0x234b('0x1b')]=_0x1f63a5[_0x234b('0x1a')];if(_0x1f63a5[_0x234b('0x1c')]){_0x84f1f0[_0x234b('0x16')][_0x234b('0x18')]['CustomActionData']=_0x1f63a5[_0x234b('0x1c')];}}logger[_0x234b('0x1d')](JSON[_0x234b('0x1e')](_0x84f1f0));return rp(_0x84f1f0);});};
\ No newline at end of file
+var _0x94dc=['POST','resolve','ndauth_url','/token','password','username','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','access_token','ProjectName','project','ndagenerate_audio','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','request-promise','../../../../../config/logger','exports'];(function(_0x294747,_0x379ea7){var _0x1a4b30=function(_0xac96e8){while(--_0xac96e8){_0x294747['push'](_0x294747['shift']());}};_0x1a4b30(++_0x379ea7);}(_0x94dc,0xb1));var _0xc94d=function(_0x1d8008,_0x40c7dd){_0x1d8008=_0x1d8008-0x0;var _0x57e0ac=_0x94dc[_0x1d8008];return _0x57e0ac;};'use strict';var rp=require(_0xc94d('0x0'));var url=require('url');var logger=require(_0xc94d('0x1'))('agi');module[_0xc94d('0x2')]=function(_0x1b2070,_0x40e7d8){var _0x4b2dcc={'method':_0xc94d('0x3'),'uri':url[_0xc94d('0x4')](_0x40e7d8[_0xc94d('0x5')],_0xc94d('0x6')),'form':{'grant_type':_0xc94d('0x7'),'username':_0x40e7d8[_0xc94d('0x8')],'password':_0x40e7d8[_0xc94d('0x7')]},'json':!![]};return rp(_0x4b2dcc)['then'](function(_0x2f9757){var _0xbe5904={'method':_0xc94d('0x3'),'uri':url[_0xc94d('0x4')](_0x40e7d8[_0xc94d('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x40e7d8[_0xc94d('0xa')]||_0xc94d('0xb'),'channelId':_0xc94d('0xc'),'conversation':{'id':_0x1b2070[_0xc94d('0xd')]},'from':{'id':_0x1b2070[_0xc94d('0xe')],'name':_0x1b2070[_0xc94d('0xf')]},'recipient':{'id':_0x1b2070['dnid'],'name':_0x1b2070[_0xc94d('0x10')]},'text':_0x40e7d8[_0xc94d('0x11')],'channelData':{}},'headers':{'Authorization':_0xc94d('0x12')+_0x2f9757[_0xc94d('0x13')]},'json':!![]};if(_0x40e7d8['project']){_0xbe5904['body']['channelData'][_0xc94d('0x14')]=_0x40e7d8[_0xc94d('0x15')];}if(_0x40e7d8[_0xc94d('0x16')]=='1'){_0xbe5904[_0xc94d('0x17')][_0xc94d('0x18')][_0xc94d('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xc94d('0x1a')};}if(_0x40e7d8[_0xc94d('0x1b')]){_0xbe5904[_0xc94d('0x17')][_0xc94d('0x18')][_0xc94d('0x1c')]=_0x40e7d8[_0xc94d('0x1b')];if(_0x40e7d8[_0xc94d('0x1d')]){_0xbe5904[_0xc94d('0x17')][_0xc94d('0x18')]['CustomActionData']=_0x40e7d8['custom_action_data'];}}logger['info'](JSON['stringify'](_0xbe5904));return rp(_0xbe5904);});};
\ No newline at end of file
index a2a5b16..227d3ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x728b=['./lib/api','exports'];(function(_0x2af29a,_0x4f44bc){var _0x5ef02f=function(_0x4349ef){while(--_0x4349ef){_0x2af29a['push'](_0x2af29a['shift']());}};_0x5ef02f(++_0x4f44bc);}(_0x728b,0x1a2));var _0xb728=function(_0x5caaf3,_0x277035){_0x5caaf3=_0x5caaf3-0x0;var _0x20b44e=_0x728b[_0x5caaf3];return _0x20b44e;};'use strict';var asr=require(_0xb728('0x0'));module[_0xb728('0x1')]=function(_0x103490,_0x3b687c,_0x7aa641,_0x177e88){return asr(_0x103490,_0x3b687c,_0x7aa641,_0x177e88);};
\ No newline at end of file
+var _0xeb68=['exports','./lib/api'];(function(_0x494b5f,_0x2a0249){var _0x5eae5e=function(_0x250b5d){while(--_0x250b5d){_0x494b5f['push'](_0x494b5f['shift']());}};_0x5eae5e(++_0x2a0249);}(_0xeb68,0x91));var _0x8eb6=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0xeb68[_0x5f3f88];return _0xd08119;};'use strict';var asr=require(_0x8eb6('0x0'));module[_0x8eb6('0x1')]=function(_0x141984,_0x1902a8,_0x5603a7,_0x1c354f){return asr(_0x141984,_0x1902a8,_0x5603a7,_0x1c354f);};
\ No newline at end of file
index 08c311a..710ee70 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1a03=['Open\x20Tilde\x20ASR\x20socket','unix','stringify','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','hypotheses','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','open','message','bluebird','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a03,0x189));var _0x31a0=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x1a03[_0x4a747d];return _0x3a5b5c;};'use strict';var BPromise=require(_0x31a0('0x0'));var _=require(_0x31a0('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x31a0('0x2'));var logger=require(_0x31a0('0x3'))(_0x31a0('0x4'));module[_0x31a0('0x5')]=function(_0x59345d,_0x49e5a2,_0x5a92b5,_0x5d26c3){return new BPromise(function(_0x2cabf7,_0x390f44){logger[_0x31a0('0x6')](_0x31a0('0x7'),_0x5d26c3||_0x31a0('0x8'));var _0x4a16cc=new WebSocket(_0x5d26c3||_0x31a0('0x8'),{'perMessageDeflate':![]});var _0x481bb5='';var _0x2f3341='0';var _0xaeaf54='1';var _0x102ccb=_0x31a0('0x9');function _0x221b6a(_0x2430b5){var _0x53e38c=crypto[_0x31a0('0xa')](_0x31a0('0xb'));_0x53e38c[_0x31a0('0xc')](_0x2430b5);return _0x53e38c[_0x31a0('0xd')]('hex');}function _0x91a93b(){try{logger['info'](_0x31a0('0xe'));var _0x29b447=moment()[_0x31a0('0xf')]();var _0x3ff9d5=_0x221b6a(_0x29b447+_0x49e5a2+_0x5a92b5);_0x4a16cc['send'](JSON[_0x31a0('0x10')]({'appID':_0x49e5a2,'timestamp':_0x29b447,'appKey':_0x3ff9d5}));var _0x34e8e9=fs['createReadStream'](_0x59345d);_0x34e8e9['on'](_0x31a0('0x11'),function(_0x29ae08){_0x4a16cc['send'](_0x29ae08);});_0x34e8e9['on'](_0x31a0('0x12'),function(){_0x4a16cc['send'](_0x31a0('0x13'));});}catch(_0x4a2729){logger[_0x31a0('0x14')](_0x31a0('0x15'),JSON[_0x31a0('0x10')](_0x4a2729));_0x4a16cc[_0x31a0('0x16')]();}}function _0xeae0f5(_0x3b45e3){try{if(_0x3b45e3){var _0x543909=JSON[_0x31a0('0x17')](_0x3b45e3);switch(_0x543909[_0x31a0('0x18')]){case 0x0:if(_0x543909['result']){if(_0x543909[_0x31a0('0x19')]['final']){logger[_0x31a0('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x543909[_0x31a0('0x19')]['hypotheses']));_0x481bb5=_0x543909[_0x31a0('0x19')][_0x31a0('0x1a')][0x0]['transcript'];_0x2f3341=_0x543909[_0x31a0('0x19')]['hypotheses'][0x0][_0x31a0('0x1b')];_0xaeaf54='0';_0x102ccb='Success.';_0x4a16cc[_0x31a0('0x16')]();}}break;case 0x1:logger[_0x31a0('0x6')](_0x31a0('0x9'));_0xaeaf54='1';_0x102ccb=_0x31a0('0x9');break;case 0x2:logger['info'](_0x31a0('0x1c'));_0xaeaf54='2';_0x102ccb=_0x31a0('0x1c');break;case 0x9:logger[_0x31a0('0x6')](_0x31a0('0x1d'));_0xaeaf54='9';_0x102ccb=_0x31a0('0x1d');break;case 0xa:logger[_0x31a0('0x6')]('Authentication\x20failed.');_0xaeaf54='10';_0x102ccb='Authentication\x20failed.';break;case 0xb:logger[_0x31a0('0x6')](_0x31a0('0x1e'));_0xaeaf54='11';_0x102ccb='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x5e7b1e){logger['error'](_0x31a0('0x1f'),JSON['stringify'](_0x5e7b1e));_0x4a16cc[_0x31a0('0x16')]();}}function _0xe8b092(){logger[_0x31a0('0x6')](_0x31a0('0x20'));_0x2cabf7({'transcript':_0x481bb5,'confidence':_0x2f3341,'status':_0xaeaf54,'status_message':_0x102ccb});}function _0x62372a(_0x35b4d1){logger[_0x31a0('0x14')](_0x31a0('0x21'));if(!_[_0x31a0('0x22')](_0x35b4d1)){logger[_0x31a0('0x14')](_['isObject'](_0x35b4d1)?JSON[_0x31a0('0x10')](_0x35b4d1):_0x35b4d1);}}_0x4a16cc['on'](_0x31a0('0x23'),_0x91a93b);_0x4a16cc['on'](_0x31a0('0x24'),_0xeae0f5);_0x4a16cc['on']('close',_0xe8b092);_0x4a16cc['on']('error',_0x62372a);});};
\ No newline at end of file
+var _0xf4d3=['Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','lodash','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','digest','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final'];(function(_0x2c6ec2,_0x13dacf){var _0x581c79=function(_0x57823a){while(--_0x57823a){_0x2c6ec2['push'](_0x2c6ec2['shift']());}};_0x581c79(++_0x13dacf);}(_0xf4d3,0x147));var _0x3f4d=function(_0x543f1a,_0x1dd96a){_0x543f1a=_0x543f1a-0x0;var _0x4d9305=_0xf4d3[_0x543f1a];return _0x4d9305;};'use strict';var BPromise=require('bluebird');var _=require(_0x3f4d('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require(_0x3f4d('0x1'));var logger=require(_0x3f4d('0x2'))(_0x3f4d('0x3'));module[_0x3f4d('0x4')]=function(_0x1c3fa5,_0x442550,_0x7acfcf,_0x3e9438){return new BPromise(function(_0x409d5a,_0x35f353){logger[_0x3f4d('0x5')](_0x3f4d('0x6'),_0x3e9438||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x298391=new WebSocket(_0x3e9438||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x24703b='';var _0x4fc3c0='0';var _0x57a131='1';var _0x152acc=_0x3f4d('0x7');function _0x20a867(_0x375fcc){var _0x3fd32a=crypto[_0x3f4d('0x8')](_0x3f4d('0x9'));_0x3fd32a['update'](_0x375fcc);return _0x3fd32a[_0x3f4d('0xa')]('hex');}function _0x37ec9e(){try{logger[_0x3f4d('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x59bb8a=moment()['unix']();var _0x33bde6=_0x20a867(_0x59bb8a+_0x442550+_0x7acfcf);_0x298391[_0x3f4d('0xb')](JSON[_0x3f4d('0xc')]({'appID':_0x442550,'timestamp':_0x59bb8a,'appKey':_0x33bde6}));var _0x53ec11=fs[_0x3f4d('0xd')](_0x1c3fa5);_0x53ec11['on']('data',function(_0x3f3b3f){_0x298391[_0x3f4d('0xb')](_0x3f3b3f);});_0x53ec11['on'](_0x3f4d('0xe'),function(){_0x298391[_0x3f4d('0xb')](_0x3f4d('0xf'));});}catch(_0x50b4bd){logger[_0x3f4d('0x10')](_0x3f4d('0x11'),JSON[_0x3f4d('0xc')](_0x50b4bd));_0x298391[_0x3f4d('0x12')]();}}function _0x4d3b2f(_0x3a8cf7){try{if(_0x3a8cf7){var _0x2f8d1c=JSON[_0x3f4d('0x13')](_0x3a8cf7);switch(_0x2f8d1c[_0x3f4d('0x14')]){case 0x0:if(_0x2f8d1c[_0x3f4d('0x15')]){if(_0x2f8d1c[_0x3f4d('0x15')][_0x3f4d('0x16')]){logger['info'](_0x3f4d('0x17'),JSON[_0x3f4d('0xc')](_0x2f8d1c[_0x3f4d('0x15')][_0x3f4d('0x18')]));_0x24703b=_0x2f8d1c[_0x3f4d('0x15')][_0x3f4d('0x18')][0x0]['transcript'];_0x4fc3c0=_0x2f8d1c['result'][_0x3f4d('0x18')][0x0]['likelihood'];_0x57a131='0';_0x152acc=_0x3f4d('0x19');_0x298391['terminate']();}}break;case 0x1:logger['info'](_0x3f4d('0x7'));_0x57a131='1';_0x152acc=_0x3f4d('0x7');break;case 0x2:logger[_0x3f4d('0x5')](_0x3f4d('0x1a'));_0x57a131='2';_0x152acc='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0x3f4d('0x5')](_0x3f4d('0x1b'));_0x57a131='9';_0x152acc=_0x3f4d('0x1b');break;case 0xa:logger[_0x3f4d('0x5')]('Authentication\x20failed.');_0x57a131='10';_0x152acc=_0x3f4d('0x1c');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x57a131='11';_0x152acc=_0x3f4d('0x1d');}}}catch(_0x399e7d){logger[_0x3f4d('0x10')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x3f4d('0xc')](_0x399e7d));_0x298391[_0x3f4d('0x12')]();}}function _0x375ef1(){logger[_0x3f4d('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x409d5a({'transcript':_0x24703b,'confidence':_0x4fc3c0,'status':_0x57a131,'status_message':_0x152acc});}function _0x1854bb(_0x526b07){logger['error'](_0x3f4d('0x1e'));if(!_[_0x3f4d('0x1f')](_0x526b07)){logger['error'](_[_0x3f4d('0x20')](_0x526b07)?JSON['stringify'](_0x526b07):_0x526b07);}}_0x298391['on'](_0x3f4d('0x21'),_0x37ec9e);_0x298391['on'](_0x3f4d('0x22'),_0x4d3b2f);_0x298391['on'](_0x3f4d('0xe'),_0x375ef1);_0x298391['on'](_0x3f4d('0x10'),_0x1854bb);});};
\ No newline at end of file
index 78d30ae..d23e6fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f45=['./asr','exports'];(function(_0x1cfc00,_0x117cb5){var _0x243cf5=function(_0x228291){while(--_0x228291){_0x1cfc00['push'](_0x1cfc00['shift']());}};_0x243cf5(++_0x117cb5);}(_0x3f45,0x100));var _0x53f4=function(_0x36e57d,_0x509bde){_0x36e57d=_0x36e57d-0x0;var _0x36213f=_0x3f45[_0x36e57d];return _0x36213f;};var asr=require(_0x53f4('0x0'));module[_0x53f4('0x1')]={'asr':asr};
\ No newline at end of file
+var _0x08f7=['exports'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x08f7,0x1b4));var _0x708f=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x08f7[_0x4226d6];return _0x19655b;};var asr=require('./asr');module[_0x708f('0x0')]={'asr':asr};
\ No newline at end of file
index fe46e1a..e0f9f60 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x695b76,_0x551526){var _0x1dc21f=function(_0x5fdb1c){while(--_0x5fdb1c){_0x695b76['push'](_0x695b76['shift']());}};_0x1dc21f(++_0x551526);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);};
\ No newline at end of file
+var _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x9c44[_0x1d9aa0];return _0x226868;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);};
\ No newline at end of file
index d4ba19c..d1c5639 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ef6=['Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20private_key\x20configured','dialogflowV2_language','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','AWS_LEX_%s','toUpperCase','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','intKey','GoogleASR\x20Result\x20%s','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','wav','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','recordFile','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20selected','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','createSquareRecording','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','Smtp','bcc','subject','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','project_id','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','util','lodash','shelljs','odbc','randomstring','moment','mustache','../../config/logger','agi','../../config/environment','./scripts','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','getSquareOdbcById','then','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','interval','format','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','context','extension','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','audioEncoding','googleTTS','google_tts_language','method','number','timeout','POST','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','render','url','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','message','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','clone','hasOwnProperty','includes','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','%s.%s','saveRestApiResult','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','isConfigured','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','add','delay','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE'];(function(_0x31f433,_0x3026f4){var _0x185f84=function(_0x4dba9f){while(--_0x4dba9f){_0x31f433['push'](_0x31f433['shift']());}};_0x185f84(++_0x3026f4);}(_0x8ef6,0xf2));var _0x68ef=function(_0xbdcc2f,_0x479815){_0xbdcc2f=_0xbdcc2f-0x0;var _0x3dec1a=_0x8ef6[_0xbdcc2f];return _0x3dec1a;};'use strict';var fs=require('fs');var util=require(_0x68ef('0x0'));var _=require(_0x68ef('0x1'));var sh=require(_0x68ef('0x2'));var odbc=require(_0x68ef('0x3'))();var rs=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var Mustache=require(_0x68ef('0x6'));var rp=require('request-promise');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var scripts=require(_0x68ef('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=['rawHeaders',_0x68ef('0xb')];var verticesWithRetry=[_0x68ef('0xc'),_0x68ef('0xd'),'getsecretdigits'];var AGIVertices=function(_0x228967,_0x31007e,_0x1bee73){this[_0x68ef('0xe')]=_0x228967;this[_0x68ef('0xf')]=_0x31007e;this[_0x68ef('0x10')]=_0x1bee73;};AGIVertices[_0x68ef('0x11')][_0x68ef('0x12')]=function(_0x1f6747,_0x255c85){this[_0x68ef('0xf')][_0x68ef('0x13')](_0x1f6747)['then'](function(_0x1aa045){_0x255c85(null,_0x1aa045?_0x1aa045[_0x68ef('0x14')]:![]);})[_0x68ef('0x15')](function(_0x454ef4){_0x255c85(_0x454ef4);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x16')]=function(_0x508671,_0x3b48dd){this[_0x68ef('0xf')][_0x68ef('0x17')](_0x508671)['then'](function(_0x22fe96){_0x3b48dd(null,_0x22fe96?_0x22fe96[_0x68ef('0x14')]:![]);})[_0x68ef('0x15')](function(_0x5005ba){_0x3b48dd(_0x5005ba);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x18')]=function(_0x3d1e90,_0x3780a4){this['rpc'][_0x68ef('0x19')](_0x3d1e90)['then'](function(_0x5cbb78){_0x3780a4(null,_0x5cbb78?_0x5cbb78[_0x68ef('0x14')]:![]);})[_0x68ef('0x15')](function(_0x4ade0d){_0x3780a4(_0x4ade0d);});};AGIVertices['prototype'][_0x68ef('0x1a')]=function(_0x2cd92c,_0x318514){this['rpc'][_0x68ef('0x1b')](_0x2cd92c)[_0x68ef('0x1c')](function(_0x183f5f){_0x318514(null,_0x183f5f?_0x183f5f['dsn']:![]);})[_0x68ef('0x15')](function(_0x3be4c0){_0x318514(_0x3be4c0);});};AGIVertices['prototype'][_0x68ef('0x1d')]=function(_0xf4760f,_0x19aa3d){this['rpc']['getUserById'](_0xf4760f)['then'](function(_0x26018d){_0x19aa3d(null,_0x26018d?_0x26018d[_0x68ef('0x14')]:![]);})[_0x68ef('0x15')](function(_0x2e6e39){_0x19aa3d(_0x2e6e39);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x1e')]=function(_0x258cd5,_0x49374f){this[_0x68ef('0xf')][_0x68ef('0x1f')](_0x258cd5)['then'](function(_0x178460){_0x49374f(null,_0x178460?_0x178460['name']:![]);})['catch'](function(_0x55d8b0){_0x49374f(_0x55d8b0);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x20')]=function(_0x123041,_0x29518e){var _0x52e67e=this;this['rpc'][_0x68ef('0x21')](_0x123041)[_0x68ef('0x1c')](function(_0x7bf96){_0x29518e(null,_0x7bf96?_0x52e67e[_0x68ef('0x22')](_0x7bf96[_0x68ef('0x23')]):![]);})[_0x68ef('0x15')](function(_0x26288a){_0x29518e(_0x26288a);});};AGIVertices[_0x68ef('0x11')]['getMailAccount']=function(_0x3d19bf,_0x4314bd){this[_0x68ef('0xf')]['getMailAccountById'](_0x3d19bf)[_0x68ef('0x1c')](function(_0x523120){_0x4314bd(null,_0x523120?_0x523120:![]);})[_0x68ef('0x15')](function(_0x17588a){_0x4314bd(_0x17588a);});};AGIVertices['prototype']['sendMailMessage']=function(_0x159395,_0x5fa72a,_0x4b8fc8){this[_0x68ef('0x10')][_0x68ef('0x24')](_0x159395,_0x5fa72a)[_0x68ef('0x1c')](function(){_0x4b8fc8(null);})[_0x68ef('0x15')](function(_0x59e9fb){_0x4b8fc8(_0x59e9fb);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x25')]=function(_0x5f137b,_0x2f8de2){this['rpc'][_0x68ef('0x26')](_0x5f137b)[_0x68ef('0x1c')](function(_0x4973c2){if(_0x4973c2){if(_0x4973c2[_0x68ef('0x27')]){_0x2f8de2(null,[_0x4973c2['interval']]);}else{_0x2f8de2(null,_[_0x68ef('0x28')](_0x4973c2['Intervals'],_0x68ef('0x29')));}}else{_0x2f8de2(null,![]);}})[_0x68ef('0x15')](function(_0x798276){_0x2f8de2(_0x798276);});};AGIVertices['prototype'][_0x68ef('0x22')]=function(_0x485dc3){return util[_0x68ef('0x2a')]('%s/sounds/converted/%s',FILES_PATH,_0x485dc3);};AGIVertices[_0x68ef('0x11')][_0x68ef('0x2b')]=function(_0x102df9,_0x136f6b,_0x2181d9){odbc[_0x68ef('0x2c')](_0x102df9,function(_0x51ba3d){if(_0x51ba3d){logger[_0x68ef('0x2d')](_0x68ef('0x2e'),_0x51ba3d);_0x2181d9(_0x51ba3d);}else{logger[_0x68ef('0x2f')]('ODBC\x20connection\x20successfully');odbc[_0x68ef('0x30')](_0x136f6b,function(_0x3c5de6,_0x382ccb){if(_0x3c5de6){logger['info']('Error\x20executing\x20query\x20%s',_0x136f6b);_0x2181d9(_0x3c5de6);}else{logger[_0x68ef('0x2f')](_0x68ef('0x31'),_0x136f6b);odbc[_0x68ef('0x32')](function(_0x42fc8c){if(_0x42fc8c){logger[_0x68ef('0x2d')](_0x68ef('0x33'),_0x42fc8c);}_0x2181d9(null,_0x382ccb);});}});}});};AGIVertices[_0x68ef('0x11')]['getSmsAccount']=function(_0xaf7df1,_0xd7f9ca){this[_0x68ef('0xf')][_0x68ef('0x34')](_0xaf7df1)['then'](function(_0x3cb156){_0xd7f9ca(null,_0x3cb156?_0x3cb156:![]);})[_0x68ef('0x15')](function(_0xcf595d){_0xd7f9ca(_0xcf595d);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x35')]=function(_0x3b00ea,_0x558efb){this[_0x68ef('0xf')][_0x68ef('0x35')](_0x3b00ea)[_0x68ef('0x1c')](function(_0x43796b){_0x558efb(null,_0x43796b);})[_0x68ef('0x15')](function(_0x32d5c3){_0x558efb(_0x32d5c3);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x36')]=function(_0xc687ab,_0x531096,_0xad1a28){this[_0x68ef('0xf')][_0x68ef('0x36')]({'uniqueid':this[_0x68ef('0xe')][_0x68ef('0x37')],'node':_0xc687ab[_0x68ef('0x38')],'application':_0xc687ab[_0x68ef('0x39')],'data':_0x531096||null,'project_name':this['channel'][_0x68ef('0x3a')],'callerid':this['channel'][_0x68ef('0x3b')]})[_0x68ef('0x1c')](function(_0x7470b9){if(_0xad1a28){_0xad1a28(null,_0x7470b9);}})[_0x68ef('0x15')](function(_0x5a1330){if(_0xad1a28){_0xad1a28(_0x5a1330);}});};AGIVertices[_0x68ef('0x11')]['createSquareRecording']=function(_0x17fc30,_0x499423,_0x227e36,_0xa2358b){this[_0x68ef('0xf')]['createSquareRecording']({'uniqueid':this['channel'][_0x68ef('0x37')],'callerid':this[_0x68ef('0xe')]['callerid'],'calleridname':this['channel']['calleridname'],'context':this[_0x68ef('0xe')][_0x68ef('0x3c')],'extension':this[_0x68ef('0xe')][_0x68ef('0x3d')],'priority':this[_0x68ef('0xe')]['priority'],'accountcode':this['channel'][_0x68ef('0x3e')],'dnid':this[_0x68ef('0xe')][_0x68ef('0x3f')],'projectName':this[_0x68ef('0xe')]['arg_1'],'saveName':_0x499423,'filename':_0x17fc30[_0x68ef('0x40')]||_0x499423,'savePath':_0x227e36})[_0x68ef('0x1c')](function(_0x1c9b6f){_0xa2358b(null,_0x1c9b6f);})[_0x68ef('0x15')](function(_0x53880c){_0xa2358b(_0x53880c);});};AGIVertices['prototype'][_0x68ef('0x41')]=function(_0x3c3074,_0x566e7c,_0xfc7a74,_0x12fff3,_0x3a82a0){this[_0x68ef('0xf')][_0x68ef('0x41')]({'uniqueid':this['channel'][_0x68ef('0x37')],'body':_0x3c3074,'direction':_0x566e7c,'providerName':_0xfc7a74,'providerResponse':_0x12fff3})[_0x68ef('0x1c')](function(_0x340bfb){if(_0x3a82a0){_0x3a82a0(null,_0x340bfb);}})['catch'](function(_0x8ef51b){if(_0x3a82a0){_0x3a82a0(_0x8ef51b);}});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x42')]=function(_0x50ef1f,_0x7dce90){this['rpc']['createCmContact']({'firstName':_[_0x68ef('0x43')](_0x50ef1f['name'])||_[_0x68ef('0x44')](_0x50ef1f[_0x68ef('0x14')])?_0x68ef('0x45')+Math[_0x68ef('0x46')]():_0x50ef1f[_0x68ef('0x14')],'lastName':_[_0x68ef('0x43')](_0x50ef1f[_0x68ef('0x47')])||_[_0x68ef('0x44')](_0x50ef1f[_0x68ef('0x47')])?null:_0x50ef1f[_0x68ef('0x47')],'phone':_0x50ef1f['phone'],'ListId':_0x50ef1f['list_id'],'scheduledat':_0x50ef1f[_0x68ef('0x48')],'callbackUniqueid':this[_0x68ef('0xe')][_0x68ef('0x37')],'tags':_0x68ef('0x49'),'description':_0x68ef('0x4a')+_0x50ef1f[_0x68ef('0x48')][_0x68ef('0x4b')](),'priority':_0x50ef1f[_0x68ef('0x4c')]})[_0x68ef('0x1c')](function(_0x4c2e9c){_0x7dce90(null,_0x4c2e9c);})['catch'](function(_0x42a4b2){_0x7dce90(_0x42a4b2);});};AGIVertices['prototype'][_0x68ef('0x4d')]=function(_0x4a5d39,_0x1b2436){this[_0x68ef('0xf')]['getPauseById'](_0x4a5d39)[_0x68ef('0x1c')](function(_0x4e097e){_0x1b2436(null,_0x4e097e?_0x4e097e[_0x68ef('0x14')]:![]);})[_0x68ef('0x15')](function(_0x3319ea){_0x1b2436(_0x3319ea);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x4e')]=function(_0x3d81c8,_0x5c347c,_0x1cdaef){var _0x1f770f={'role':_0x68ef('0x4f')};_0x1f770f[_0x3d81c8]=this[_0x68ef('0xe')][_0x68ef('0x3b')];this[_0x68ef('0xf')]['agentPause'](_0x1f770f,_0x5c347c,this[_0x68ef('0xe')][_0x68ef('0x37')])['then'](function(_0x42fbac){_0x1cdaef(null,_[_0x68ef('0x44')](_0x42fbac)?![]:!![]);})[_0x68ef('0x15')](function(_0x4e53f8){logger[_0x68ef('0x2d')](_0x4e53f8);_0x1cdaef(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x3e5cca,_0x540da5){var _0x3b2837={'role':'agent'};_0x3b2837[_0x3e5cca]=this[_0x68ef('0xe')][_0x68ef('0x3b')];this[_0x68ef('0xf')][_0x68ef('0x50')](_0x3b2837)[_0x68ef('0x1c')](function(_0x19a9c4){_0x540da5(null,_['isNil'](_0x19a9c4)?![]:!![]);})[_0x68ef('0x15')](function(_0x4ed1eb){logger[_0x68ef('0x2d')](_0x4ed1eb);_0x540da5(null,![]);});};AGIVertices['prototype'][_0x68ef('0x51')]=function(_0x17700a,_0x212ec4){var _0xf0a40f={'role':_0x68ef('0x4f')};_0xf0a40f[_0x17700a]=this[_0x68ef('0xe')][_0x68ef('0x3b')];this['rpc'][_0x68ef('0x51')](_0xf0a40f)[_0x68ef('0x1c')](function(_0x43eba8){_0x212ec4(null,_[_0x68ef('0x44')](_0x43eba8)?![]:!![]);})[_0x68ef('0x15')](function(_0x4ff8a6){logger[_0x68ef('0x2d')](_0x4ff8a6);_0x212ec4(null,![]);});};AGIVertices['prototype'][_0x68ef('0x52')]=function(_0x4caa11,_0x490b42){var _0x2a5871={'role':_0x68ef('0x4f')};_0x2a5871[_0x4caa11]=this[_0x68ef('0xe')][_0x68ef('0x3b')];var _0x51f905=_0x4caa11!=_0x68ef('0x53')?util['format'](_0x68ef('0x54'),_0x68ef('0x55'),this[_0x68ef('0xe')]['callerid']):undefined;this['rpc'][_0x68ef('0x52')](_0x2a5871,_0x51f905)[_0x68ef('0x1c')](function(_0x24d7f7){_0x490b42(null,_[_0x68ef('0x44')](_0x24d7f7)?![]:!![]);})['catch'](function(_0x335ba8){logger[_0x68ef('0x2d')](_0x335ba8);_0x490b42(null,![]);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x56')]=function(_0x5089b3,_0x3f56a7){sh['exec'](_[_0x68ef('0x57')](_0x5089b3),function(_0x3998d4,_0x90e1a6){var _0x3193c8=_0x90e1a6[_0x68ef('0x58')](/(\r\n|\n|\r)/gm,'');_0x3f56a7(null,_0x3193c8);});};AGIVertices['prototype'][_0x68ef('0x59')]=function(_0x2caed7,_0x147695){scripts['googleCloudTTS'](_0x2caed7[_0x68ef('0x5a')],_0x2caed7['google_cloud_tts_text_type']||_0x68ef('0x5b'),_0x2caed7['text'],_0x2caed7['languageCode']||_0x68ef('0x5c'),_0x2caed7[_0x68ef('0x5d')]||_0x68ef('0x5e'),_0x2caed7[_0x68ef('0x5f')]||'MP3')[_0x68ef('0x1c')](function(_0x387c1b){_0x147695(null,_0x387c1b);})[_0x68ef('0x15')](function(_0x511178){_0x147695(_0x511178);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x60')]=function(_0xea2a81,_0x1cfb74){scripts[_0x68ef('0x60')](_0xea2a81[_0x68ef('0x5b')],_0xea2a81[_0x68ef('0x61')]||'en',0x1)[_0x68ef('0x1c')](function(_0x156ce3){_0x1cfb74(null,_0x156ce3);})[_0x68ef('0x15')](function(_0x454999){_0x1cfb74(_0x454999);});};AGIVertices[_0x68ef('0x11')]['restAPI']=function(_0x15378c,_0x391a81){var _0x5db443={'uri':_0x15378c['url'],'method':_0x15378c[_0x68ef('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x15378c['timeout'])===_0x68ef('0x63')&&parseInt(_0x15378c[_0x68ef('0x64')])>=0x1?parseInt(_0x15378c['timeout'])*0x3e8:0x5*0x3e8};if(_['includes']([_0x68ef('0x65'),'PUT'],_0x5db443[_0x68ef('0x62')]['toUpperCase']())){try{_0x5db443[_0x68ef('0x66')]=_0x15378c['rawBody']?JSON[_0x68ef('0x67')](_0x15378c[_0x68ef('0xb')]):{};}catch(_0x57e811){logger[_0x68ef('0x2d')](_0x68ef('0x68'),_0x57e811);}}try{_0x5db443[_0x68ef('0x69')]=_0x15378c[_0x68ef('0x6a')]?JSON['parse'](_0x15378c[_0x68ef('0x6a')]):{};}catch(_0x26bda2){logger['error'](_0x68ef('0x6b'),_0x26bda2);}if(_0x15378c[_0x68ef('0x6c')]){try{var _0x21f32b=require(_0x15378c['computedVariables'])[_0x68ef('0x6d')](this,_0x5db443);_0x5db443['uri']=Mustache[_0x68ef('0x6e')](_0x15378c[_0x68ef('0x6f')],_0x21f32b,{},['$$','$$']);if(_0x5db443['headers']){_0x5db443['headers']=JSON['parse'](Mustache['render'](JSON[_0x68ef('0x70')](_0x5db443[_0x68ef('0x69')]),_0x21f32b,{},['$$','$$']));}if(_0x5db443[_0x68ef('0x66')]){_0x5db443[_0x68ef('0x66')]=JSON[_0x68ef('0x67')](Mustache[_0x68ef('0x6e')](JSON[_0x68ef('0x70')](_0x5db443[_0x68ef('0x66')]),_0x21f32b,{},['$$','$$']));}}catch(_0x24ba34){logger[_0x68ef('0x2d')](_0x68ef('0x71'),_0x24ba34);}}rp(_0x5db443)[_0x68ef('0x1c')](function(_0x717d7b){var _0x4bd5c3={'statusCode':_0x717d7b[_0x68ef('0x72')]||0xc8,'statusMessage':_0x717d7b['statusMessage']||'OK','headers':_0x717d7b[_0x68ef('0x69')]||{},'body':_0x717d7b['body']||{}};_0x391a81(null,_0x4bd5c3);})['catch'](function(_0x4532e2){var _0x355d39={'statusCode':_0x4532e2[_0x68ef('0x72')]||0x1f4,'statusMessage':_0x4532e2[_0x68ef('0x73')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x4532e2['options'][_0x68ef('0x69')]||{},'body':_0x4532e2[_0x68ef('0x74')][_0x68ef('0x66')]||{}};_0x391a81(null,_0x355d39);});};AGIVertices['prototype'][_0x68ef('0x75')]=function(_0x23c69e,_0x20c185){scripts[_0x68ef('0x75')](this['channel'][_0x68ef('0x37')],_0x23c69e[_0x68ef('0x76')],_0x23c69e[_0x68ef('0x5b')],_0x23c69e[_0x68ef('0x77')]||'en')[_0x68ef('0x1c')](function(_0x346049){_0x20c185(null,_0x346049);})['catch'](function(_0x2a72e8){_0x20c185(_0x2a72e8);});};AGIVertices['prototype'][_0x68ef('0x78')]=function(_0x9b55f7,_0x37da0a){scripts[_0x68ef('0x78')](this['channel'][_0x68ef('0x37')],_0x9b55f7['dialogflowV2_project_id'],_0x9b55f7[_0x68ef('0x79')],_0x9b55f7[_0x68ef('0x7a')],_0x9b55f7['text'],_0x9b55f7['dialogflowV2_language']||'en')[_0x68ef('0x1c')](function(_0x4c40ea){_0x37da0a(null,_0x4c40ea);})[_0x68ef('0x15')](function(_0x54d37b){_0x37da0a(_0x54d37b);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x7b')]=function(_0x17385b,_0x1cc776){scripts[_0x68ef('0x7b')](this[_0x68ef('0xe')],_0x17385b)['then'](function(_0x17d014){_0x1cc776(null,_0x17d014);})[_0x68ef('0x15')](function(_0x31cf5b){_0x1cc776(_0x31cf5b);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x7c')]=function(_0x1866be,_0x303add){scripts['ispeechTTS'](_0x1866be[_0x68ef('0x76')],_0x1866be[_0x68ef('0x5b')],_0x1866be[_0x68ef('0x7d')]||_0x68ef('0x5c'),_0x1866be[_0x68ef('0x7e')])[_0x68ef('0x1c')](function(_0x3e0d3d){_0x303add(null,_0x3e0d3d);})[_0x68ef('0x15')](function(_0x1bcbbb){_0x303add(_0x1bcbbb);});};AGIVertices['prototype'][_0x68ef('0x7f')]=function(_0x530ae0,_0x5f3b79,_0x573357){scripts[_0x68ef('0x7f')](_0x5f3b79,_0x530ae0[_0x68ef('0x76')],_0x530ae0[_0x68ef('0x80')]||'en-US',this['isConfigured'](_0x530ae0['model'])?_0x530ae0[_0x68ef('0x81')]:undefined)[_0x68ef('0x1c')](function(_0x239d05){_0x573357(null,_0x239d05);})[_0x68ef('0x15')](function(_0x29011d){_0x573357(_0x29011d);});};AGIVertices[_0x68ef('0x11')]['awsPolly']=function(_0x108698,_0x2c7f18){scripts[_0x68ef('0x82')](_0x108698[_0x68ef('0x83')],_0x108698['aws_secret_access_key'],_0x108698[_0x68ef('0x84')],_0x108698[_0x68ef('0x85')]||_0x68ef('0x86'),_0x108698[_0x68ef('0x5b')],_0x108698[_0x68ef('0x87')]||_0x68ef('0x5b'))[_0x68ef('0x1c')](function(_0x1d9f7b){_0x2c7f18(null,_0x1d9f7b);})['catch'](function(_0x16dbaf){_0x2c7f18(_0x16dbaf);});};AGIVertices[_0x68ef('0x11')]['awsLex']=function(_0xdaed94,_0x29864a){scripts[_0x68ef('0x88')](this[_0x68ef('0xe')][_0x68ef('0x37')],_0xdaed94[_0x68ef('0x83')],_0xdaed94[_0x68ef('0x89')],_0xdaed94[_0x68ef('0x8a')],_0xdaed94[_0x68ef('0x5b')],_0xdaed94[_0x68ef('0x8b')])[_0x68ef('0x1c')](function(_0x37bf89){_0x29864a(null,_0x37bf89);})[_0x68ef('0x15')](function(_0xc031af){_0x29864a(_0xc031af);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x8c')]=function(_0x468130,_0x24af15,_0x57086f){scripts[_0x68ef('0x8c')](_0x24af15,_0x468130[_0x68ef('0x76')],_0x468130[_0x68ef('0x8d')]||_0x68ef('0x5c'))[_0x68ef('0x1c')](function(_0x581ce4){_0x57086f(null,_0x581ce4);})[_0x68ef('0x15')](function(_0xfb4a5c){_0x57086f(_0xfb4a5c);});};AGIVertices['prototype'][_0x68ef('0x8e')]=function(_0x4d7cf7,_0x5826b6,_0x5a6148){scripts['tildeASR'](_0x5826b6,_0x4d7cf7[_0x68ef('0x8f')],_0x4d7cf7['appsecret'],_0x4d7cf7[_0x68ef('0x90')])['then'](function(_0x56ecd2){_0x5a6148(null,_0x56ecd2);})['catch'](function(_0xdff66c){_0x5a6148(_0xdff66c);});};AGIVertices[_0x68ef('0x11')][_0x68ef('0x91')]=function(_0x1759d0){var _0x41e8e7=_['includes'](verticesWithRetry,_0x1759d0[_0x68ef('0x39')])?_0x1759d0:_[_0x68ef('0x92')](_0x1759d0);for(var _0x2fcfbe in _0x41e8e7){if(_0x41e8e7[_0x68ef('0x93')](_0x2fcfbe)){if(_0x41e8e7[_0x2fcfbe]&&_['isString'](_0x41e8e7[_0x2fcfbe])){if(_[_0x68ef('0x94')](recursiveMapAttributes,_0x2fcfbe)){_0x41e8e7[_0x2fcfbe]=this['replaceObjectAllVariables'](_0x41e8e7[_0x2fcfbe]);}else{_0x41e8e7[_0x2fcfbe]=this['replaceAllVariables'](_0x41e8e7[_0x2fcfbe]);}}}}return _0x41e8e7;};AGIVertices['prototype'][_0x68ef('0x95')]=function(_0x1909fe){for(var _0x3c86b0 in _0x1909fe){if(_0x1909fe[_0x68ef('0x93')](_0x3c86b0)){if(_[_0x68ef('0x96')](_0x1909fe[_0x3c86b0])){this[_0x68ef('0x95')](_0x1909fe[_0x3c86b0]);}else if(_[_0x68ef('0x97')](_0x1909fe[_0x3c86b0])){for(var _0x4631a7=0x0;_0x4631a7<_0x1909fe[_0x3c86b0][_0x68ef('0x98')];_0x4631a7++){this[_0x68ef('0x95')](_0x1909fe[_0x3c86b0][_0x4631a7]);}}else if(_[_0x68ef('0x99')](_0x1909fe[_0x3c86b0])){_0x1909fe[_0x3c86b0]=this[_0x68ef('0x9a')](_0x1909fe[_0x3c86b0]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x481bec,_0x25e698){for(var _0x1cad59 in _0x481bec){if(_0x481bec[_0x68ef('0x93')](_0x1cad59)){if(_['isPlainObject'](_0x481bec[_0x1cad59])){if(!_[_0x68ef('0x43')](_0x481bec[_0x1cad59])){this['saveRestApiResult'](_0x481bec[_0x1cad59],util[_0x68ef('0x2a')](_0x68ef('0x9b'),_0x25e698,_0x1cad59));}}else if(_[_0x68ef('0x97')](_0x481bec[_0x1cad59])){for(var _0x55f7f1=0x0;_0x55f7f1<_0x481bec[_0x1cad59][_0x68ef('0x98')];_0x55f7f1++){this[_0x68ef('0x9c')](_0x481bec[_0x1cad59][_0x55f7f1],util['format'](_0x68ef('0x9b'),_0x25e698,_0x1cad59+'['+_0x55f7f1+']'));}}else{if(!_[_0x68ef('0x44')](_0x481bec[_0x1cad59])){this[_0x68ef('0xe')][_0x68ef('0x9d')](util[_0x68ef('0x2a')](_0x68ef('0x9b'),_0x25e698,_0x1cad59),_0x481bec[_0x1cad59]);}}}}};AGIVertices[_0x68ef('0x11')]['replaceObjectAllVariables']=function(_0x1a946d){try{var _0x26121d=JSON[_0x68ef('0x67')](_0x1a946d);this[_0x68ef('0x95')](_0x26121d);return JSON[_0x68ef('0x70')](_0x26121d);}catch(_0x46c87e){return this[_0x68ef('0x9a')](_0x1a946d);}};AGIVertices[_0x68ef('0x11')][_0x68ef('0x9a')]=function(_0x1c9f6f){var _0x563f2e=_0x1c9f6f['split']('{');for(var _0x916a2e=0x1;_0x916a2e<_0x563f2e['length'];_0x916a2e+=0x1){var _0x1d04d2=_0x563f2e[_0x916a2e][_0x68ef('0x9e')]('}');if(_0x1d04d2[_0x68ef('0x98')]>0x1){_0x1c9f6f=_0x1c9f6f[_0x68ef('0x9f')]('{'+_0x1d04d2[0x0]+'}',this[_0x68ef('0xe')]['getVariable'](_0x1d04d2[0x0])[_0x68ef('0xa0')]||_0x1d04d2[0x0]);}}if(_0x563f2e[_0x68ef('0x98')]===0x1){return _0x1c9f6f[_0x68ef('0x4b')]();}return this[_0x68ef('0x9a')](_0x1c9f6f);};AGIVertices['prototype']['getAndSetVariable']=function(_0x2ff3d2,_0x1ed249){var _0x50665f=this[_0x68ef('0xe')][_0x68ef('0x12')](_0x2ff3d2);if(_0x50665f[_0x68ef('0xa1')]===-0x1){return _0x50665f;}logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0xa2'),_0x1ed249,_0x50665f[_0x68ef('0xa0')]));return this[_0x68ef('0xe')]['setVariable'](_0x1ed249,_0x50665f[_0x68ef('0xa0')]);};AGIVertices[_0x68ef('0x11')][_0x68ef('0xa3')]=function(_0x391410){return _0x391410&&_0x391410!=='0'&&_0x391410!=='-1'&&_0x391410!=='';};AGIVertices[_0x68ef('0x11')][_0x68ef('0xa4')]=function(_0x11247b){this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x11247b,'-');_0x11247b[_0x68ef('0xa5')]=_0x11247b['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0x68ef('0xa6')]=function(_0x3ddfe0){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0xa7'),_0x3ddfe0[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x3ddfe0['text'])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xa9'));}var _0x15384c='\x22'+_0x3ddfe0['text']+'\x22';if(this[_0x68ef('0xa3')](_0x3ddfe0['options'])){_0x15384c+=','+_0x3ddfe0[_0x68ef('0x74')];}var _0x322733=this[_0x68ef('0xe')]['exec']('MRCPSynth',_0x15384c);if(_0x322733[_0x68ef('0xa1')]===-0x1){return _0x322733;}return this['channel'][_0x68ef('0xa8')](util['format'](_0x68ef('0xaa'),_0x15384c));};AGIVertices[_0x68ef('0x11')]['mrcprecog']=function(_0x4a172f){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x4a172f[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x4a172f[_0x68ef('0xab')])){return this['channel']['noop'](_0x68ef('0xac'));}var _0x4d35de=_0x4a172f[_0x68ef('0xab')];if(this[_0x68ef('0xa3')](_0x4a172f[_0x68ef('0x74')])){_0x4d35de+=','+_0x4a172f[_0x68ef('0x74')];}var _0x15a8f1=this[_0x68ef('0xe')]['exec']('MRCPRecog',_0x4d35de);if(_0x15a8f1[_0x68ef('0xa1')]===-0x1){return _0x15a8f1;}var _0x46e4b7=this[_0x68ef('0xad')](_0x68ef('0xae'),_0x68ef('0xaf'));if(_0x46e4b7['result']===-0x1){return _0x46e4b7;}var _0x3e77b3=this[_0x68ef('0xad')](_0x68ef('0xb0'),_0x68ef('0xb1'));if(_0x3e77b3[_0x68ef('0xa1')]===-0x1){return _0x3e77b3;}var _0x17b1ea=this[_0x68ef('0xad')](_0x68ef('0xb2'),'MRCP_RECOG_INSTANCE');if(_0x17b1ea[_0x68ef('0xa1')]===-0x1){return _0x17b1ea;}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xb3'),_0x4d35de));};AGIVertices[_0x68ef('0x11')]['agi']=function(_0x3cbe21){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0xb4'),_0x3cbe21[_0x68ef('0x38')]));return this['channel'][_0x68ef('0x8')]([_0x3cbe21[_0x68ef('0xb5')],_0x3cbe21['args']]);};AGIVertices['prototype'][_0x68ef('0xb6')]=function(_0x43cf36){logger[_0x68ef('0x2f')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x43cf36[_0x68ef('0x38')]));if(this[_0x68ef('0xa3')](_0x43cf36[_0x68ef('0x64')])){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0xb7'),_0x43cf36[_0x68ef('0x64')]));var _0x1dd16e=this[_0x68ef('0xe')][_0x68ef('0xb8')](_0x43cf36[_0x68ef('0x64')]);if(_0x1dd16e[_0x68ef('0xa1')]===-0x1){return _0x1dd16e;}}return this[_0x68ef('0xe')][_0x68ef('0xb6')]();};AGIVertices['prototype']['callback']=function(_0x503219){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0xb9'),_0x503219['label']));if(!this[_0x68ef('0xa3')](_0x503219[_0x68ef('0xba')])){return this['channel']['error'](_0x503219,_0x68ef('0xbb'));}_0x503219[_0x68ef('0x48')]=moment();if(this[_0x68ef('0xa3')](_0x503219['delay'])){_0x503219[_0x68ef('0x48')]=moment()[_0x68ef('0xbc')](_0x503219[_0x68ef('0xbd')],'minutes');}if(!this[_0x68ef('0xa3')](_0x503219['callback_priority'])){_0x503219[_0x68ef('0x4c')]=0x2;}this[_0x68ef('0x42')]['sync'](this,_0x503219);return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xbe'),_0x503219[_0x68ef('0xbf')],_0x503219[_0x68ef('0xba')],_0x503219[_0x68ef('0x48')]));};AGIVertices[_0x68ef('0x11')][_0x68ef('0xc0')]=function(_0x5c8123){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0xc1'),_0x5c8123[_0x68ef('0x38')]));var _0x3e3775=this[_0x68ef('0xe')][_0x68ef('0xc2')](_0x5c8123['application'],_0x5c8123['options']);if(_0x3e3775[_0x68ef('0xa1')]===-0x1){return _0x3e3775;}return this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xc3'),_0x5c8123[_0x68ef('0xc4')],_0x5c8123['options']));};AGIVertices[_0x68ef('0x11')][_0x68ef('0xc5')]=function(_0xa5cf48){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0xc6'),_0xa5cf48['label']));if(!this[_0x68ef('0xa3')](_0xa5cf48[_0x68ef('0x5b')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x1ace3a='\x22'+_0xa5cf48[_0x68ef('0x5b')]+'\x22';if(this[_0x68ef('0xa3')](_0xa5cf48[_0x68ef('0x74')])){_0x1ace3a+=','+_0xa5cf48[_0x68ef('0x74')];}var _0x42c1ff=this[_0x68ef('0xe')][_0x68ef('0xc2')](_0x68ef('0xc7'),_0x1ace3a);if(_0x42c1ff['result']===-0x1){return _0x42c1ff;}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util['format'](_0x68ef('0xaa'),_0x1ace3a));};AGIVertices[_0x68ef('0x11')][_0x68ef('0xc8')]=function(_0x5f5c40){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0xc9'),_0x5f5c40[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x5f5c40[_0x68ef('0x5b')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xa9'));}var _0x3385ec='\x22'+_0x5f5c40['text']+'\x22';if(this[_0x68ef('0xa3')](_0x5f5c40[_0x68ef('0x74')])){_0x3385ec+=','+_0x5f5c40['options'];}var _0x132b9d=this[_0x68ef('0xe')][_0x68ef('0xc2')](_0x68ef('0xc7'),_0x3385ec);if(_0x132b9d[_0x68ef('0xa1')]===-0x1){return _0x132b9d;}return this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xaa'),_0x3385ec));};AGIVertices[_0x68ef('0x11')][_0x68ef('0xca')]=function(_0x5548b1){logger[_0x68ef('0x2f')](util['format']('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x5548b1[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x5548b1[_0x68ef('0xab')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xac'));}var _0x10d93c=_0x5548b1[_0x68ef('0xab')];if(this['isConfigured'](_0x5548b1[_0x68ef('0x74')])){_0x10d93c+=','+_0x5548b1[_0x68ef('0x74')];}var _0x17d461=this[_0x68ef('0xe')][_0x68ef('0xc2')](_0x68ef('0xcb'),_0x10d93c);if(_0x17d461[_0x68ef('0xa1')]===-0x1){return _0x17d461;}var _0x315717=this[_0x68ef('0xad')](_0x68ef('0xae'),_0x68ef('0xcc'));if(_0x315717[_0x68ef('0xa1')]===-0x1){return _0x315717;}var _0x47e871=this[_0x68ef('0xad')](_0x68ef('0xb0'),_0x68ef('0xcd'));if(_0x47e871[_0x68ef('0xa1')]===-0x1){return _0x47e871;}var _0x5afe6f=this[_0x68ef('0xad')](_0x68ef('0xb2'),_0x68ef('0xce'));if(_0x5afe6f['result']===-0x1){return _0x5afe6f;}return this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0xb3'),_0x10d93c));};AGIVertices[_0x68ef('0x11')][_0x68ef('0xcf')]=function(_0x8913b){logger['info'](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x8913b[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x8913b['grammar'])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xac'));}var _0x25ec32=_0x8913b[_0x68ef('0xab')];if(this[_0x68ef('0xa3')](_0x8913b[_0x68ef('0x74')])){_0x25ec32+=','+_0x8913b[_0x68ef('0x74')];}var _0x328f87=this[_0x68ef('0xe')][_0x68ef('0xc2')](_0x68ef('0xcb'),_0x25ec32);if(_0x328f87[_0x68ef('0xa1')]===-0x1){return _0x328f87;}var _0x31b61d=this[_0x68ef('0xad')](_0x68ef('0xae'),'SESTEK_ASR_CONFIDENCE');if(_0x31b61d[_0x68ef('0xa1')]===-0x1){return _0x31b61d;}var _0x28e24e=this['getAndSetVariable'](_0x68ef('0xb0'),_0x68ef('0xd0'));if(_0x28e24e[_0x68ef('0xa1')]===-0x1){return _0x28e24e;}var _0xe945ae=this[_0x68ef('0xad')](_0x68ef('0xb2'),_0x68ef('0xd1'));if(_0xe945ae['result']===-0x1){return _0xe945ae;}return this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x25ec32));};AGIVertices[_0x68ef('0x11')]['database']=function(_0x2813ea){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0xd2'),_0x2813ea[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x2813ea[_0x68ef('0xd3')])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x2813ea,_0x68ef('0xd4'));}var _0x5abfc3=this[_0x68ef('0x1a')][_0x68ef('0x6d')](this,_0x2813ea[_0x68ef('0xd3')]);if(!_0x5abfc3){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x2813ea,_0x68ef('0xd5'));}if(!this[_0x68ef('0xa3')](_0x2813ea[_0x68ef('0x30')])){return this[_0x68ef('0xe')]['error'](_0x2813ea,_0x68ef('0xd6'));}var _0x343063=_0x2813ea[_0x68ef('0x30')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xd7'),_0x343063));var _0x2adfe7=this[_0x68ef('0x2b')][_0x68ef('0x6d')](this,_0x5abfc3,_0x343063);this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x2813ea,_0x343063);if(!this[_0x68ef('0xa3')](_0x2813ea[_0x68ef('0xd8')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xd9'));}var _0x1f54fb=this['getVariable'][_0x68ef('0x6d')](this,_0x2813ea[_0x68ef('0xd8')]);if(!_0x1f54fb){return this['channel'][_0x68ef('0x2d')](_0x2813ea,'no\x20variable\x20found');}var _0x243070=this;_0x2adfe7[_0x68ef('0xda')](function(_0x461e5d,_0x85a62d){Object[_0x68ef('0xdb')](_0x461e5d)[_0x68ef('0xda')](function(_0x26f969){_0x243070[_0x68ef('0xe')][_0x68ef('0x9d')](util[_0x68ef('0x2a')](_0x68ef('0xdc'),_0x1f54fb,_0x85a62d,_0x26f969),_0x461e5d[_0x26f969]);});});this[_0x68ef('0xe')][_0x68ef('0x9d')](util['format'](_0x68ef('0xdd'),_0x1f54fb),_0x2adfe7[_0x68ef('0x98')]);return this[_0x68ef('0xe')][_0x68ef('0xa8')](util['format'](_0x68ef('0xde'),_0x1f54fb));};AGIVertices[_0x68ef('0x11')][_0x68ef('0xdf')]=function(_0x554601){logger[_0x68ef('0xe0')](util[_0x68ef('0x2a')](_0x68ef('0xe1'),_0x554601[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x554601[_0x68ef('0xe2')])){return this[_0x68ef('0xe')]['error'](_0x554601,'no\x20user\x20selected');}var _0x15a09f=this[_0x68ef('0x1d')]['sync'](this,_0x554601['sip_id']);if(!_0x15a09f){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x554601,_0x68ef('0xe3'));}var _0x1e1738=this[_0x68ef('0xe')][_0x68ef('0xc2')](_0x68ef('0xe4'),[util[_0x68ef('0x2a')]('SIP/%s',_0x15a09f),_0x554601['timeout'],_0x554601[_0x68ef('0xe5')],_0x554601[_0x68ef('0x6f')]]);if(_0x1e1738[_0x68ef('0xa1')]===-0x1){return _0x1e1738;}return this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xe6'),_0x68ef('0xe4')));};AGIVertices['prototype']['dialogflow']=function(_0x3717c4){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x3717c4[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x3717c4[_0x68ef('0x76')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xe7'));}if(!this[_0x68ef('0xa3')](_0x3717c4[_0x68ef('0x5b')])){return this[_0x68ef('0xe')]['noop'](_0x68ef('0xa9'));}this[_0x68ef('0xe')]['bot']=!![];this[_0x68ef('0x36')](_0x3717c4);this[_0x68ef('0x41')](_0x3717c4[_0x68ef('0x5b')],'in','','');this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0xe8'),_0x3717c4[_0x68ef('0x5b')]));var _0x504871=this[_0x68ef('0x75')]['sync'](this,_0x3717c4);if(_0x504871){for(var _0x5d04ff in _0x504871){if(_0x504871['hasOwnProperty'](_0x5d04ff)){this[_0x68ef('0xe')][_0x68ef('0x9d')](util['format'](_0x68ef('0xe9'),_0x5d04ff['toUpperCase']()),_0x504871[_0x5d04ff]);}}this['createSquareMessage'](_0x504871[_0x68ef('0xea')],_0x68ef('0xeb'),_0x68ef('0xec'),'');return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xed'),_0x504871[_0x68ef('0xea')]));}return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x3717c4,_0x68ef('0xee'));};AGIVertices['prototype'][_0x68ef('0xef')]=function(_0x3b67f0){logger['info'](util[_0x68ef('0x2a')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x3b67f0[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x3b67f0[_0x68ef('0xf0')])){return this['channel'][_0x68ef('0xa8')](_0x68ef('0xf1'));}if(!this[_0x68ef('0xa3')](_0x3b67f0[_0x68ef('0x79')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')]('no\x20client_email\x20configured');}if(!this['isConfigured'](_0x3b67f0[_0x68ef('0x7a')])){return this['channel'][_0x68ef('0xa8')](_0x68ef('0xf2'));}if(!this[_0x68ef('0xa3')](_0x3b67f0[_0x68ef('0xf3')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xf4'));}if(!this[_0x68ef('0xa3')](_0x3b67f0['text'])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xa9'));}this['channel'][_0x68ef('0xf5')]=!![];this[_0x68ef('0x36')](_0x3b67f0);this[_0x68ef('0x41')](_0x3b67f0[_0x68ef('0x5b')],'in','','');this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xf6'),_0x3b67f0[_0x68ef('0x5b')]));var _0x4a2461=this['googleDialogflowV2'][_0x68ef('0x6d')](this,_0x3b67f0);if(_0x4a2461){for(var _0x2040a2 in _0x4a2461){if(_0x4a2461['hasOwnProperty'](_0x2040a2)){if(_0x2040a2!==_0x68ef('0xf7')){this[_0x68ef('0xe')]['setVariable'](util['format']('DIALOGFLOW_%s',_0x2040a2['toUpperCase']()),_0x4a2461[_0x2040a2]);}}}this[_0x68ef('0x41')](_0x4a2461['speech'],_0x68ef('0xeb'),'dialogflowV2',_0x4a2461[_0x68ef('0xf7')]);return this[_0x68ef('0xe')]['noop'](util['format']('DialogflowV2\x20Result\x20%s',_0x4a2461[_0x68ef('0xea')]));}return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x3b67f0,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x68ef('0x11')]['sesteknda']=function(_0x22a810){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0xf8'),_0x22a810[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x22a810[_0x68ef('0xf9')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x68ef('0xa3')](_0x22a810[_0x68ef('0xfa')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xfb'));}if(!this[_0x68ef('0xa3')](_0x22a810[_0x68ef('0xfc')])){return this['channel'][_0x68ef('0xa8')](_0x68ef('0xfd'));}if(!this[_0x68ef('0xa3')](_0x22a810[_0x68ef('0xfe')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xa9'));}this[_0x68ef('0xe')][_0x68ef('0xf5')]=!![];this[_0x68ef('0x36')](_0x22a810);this[_0x68ef('0x41')](_0x22a810[_0x68ef('0x5b')],'in','','');this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xff'),_0x22a810[_0x68ef('0x5b')]));var _0x524e0c=this['sestekNDA']['sync'](this,_0x22a810);if(_0x524e0c){for(var _0x2e6bcf in _0x524e0c){if(_0x524e0c[_0x68ef('0x93')](_0x2e6bcf)){this[_0x68ef('0xe')][_0x68ef('0x9d')](util['format']('SESTEK_NDA_%s',_0x2e6bcf['toUpperCase']()),_0x524e0c[_0x2e6bcf]);}}this[_0x68ef('0x41')](_0x524e0c[_0x68ef('0xea')],_0x68ef('0xeb'),'sesteknda','');if(_0x524e0c[_0x68ef('0x100')]){this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x101'),_0x524e0c[_0x68ef('0x100')]));var _0x3d0d0c=this['channel'][_0x68ef('0x102')](_0x524e0c[_0x68ef('0x100')]);try{fs[_0x68ef('0x103')](_0x524e0c[_0x68ef('0x100')]+_0x68ef('0x104'));}catch(_0x585daf){logger[_0x68ef('0x2d')](_0x585daf);}return _0x3d0d0c;}else{return this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0x105'),_0x524e0c[_0x68ef('0xea')]));}}return this[_0x68ef('0xe')]['error'](_0x22a810,_0x68ef('0x106'));};AGIVertices['prototype'][_0x68ef('0x107')]=function(_0x7a3535){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x108'),_0x7a3535[_0x68ef('0x38')]));return this['channel']['noop'](_0x68ef('0x107'));};AGIVertices[_0x68ef('0x11')]['ext_dial']=function(_0x4bb178){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x109'),_0x4bb178[_0x68ef('0x38')]));var _0x377ee6='';if(_0x4bb178[_0x68ef('0x10a')]){if(!this[_0x68ef('0xa3')](_0x4bb178['trunk_id'])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x4bb178,_0x68ef('0x10b'));}else{var _0x72b460=parseInt(_0x4bb178[_0x68ef('0x10a')],0xa);if(isNaN(_0x72b460)){_0x377ee6=_0x4bb178[_0x68ef('0x10a')];}else{_0x377ee6=this[_0x68ef('0x1e')][_0x68ef('0x6d')](this,_0x4bb178[_0x68ef('0x10a')]);if(!_0x377ee6){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x4bb178,_0x68ef('0x10c'));}}}}else if(_0x4bb178[_0x68ef('0x10d')]){_0x377ee6=_0x4bb178[_0x68ef('0x10d')];}else{return this[_0x68ef('0xe')]['error'](_0x4bb178,'no\x20trunk\x20selected');}var _0x3c53d9=this[_0x68ef('0xe')][_0x68ef('0xc2')](_0x68ef('0xe4'),[util['format'](_0x68ef('0x10e'),_0x377ee6,_0x4bb178[_0x68ef('0xbf')]),_0x4bb178['timeout'],_0x4bb178['opts'],_0x4bb178['url']]);if(_0x3c53d9[_0x68ef('0xa1')]===-0x1){return _0x3c53d9;}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util['format'](_0x68ef('0xe6'),'DIAL'));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x10f')]=function(_0x1de2d0){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x110'),_0x1de2d0[_0x68ef('0x38')]));return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x10f'));};AGIVertices[_0x68ef('0x11')][_0x68ef('0xd')]=function(_0x4b5a31){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x111'),_0x4b5a31[_0x68ef('0x38')]));if(_0x4b5a31[_0x68ef('0xa5')]===0x0){return this[_0x68ef('0xa4')](_0x4b5a31);}_0x4b5a31['retry']-=0x1;if(!this[_0x68ef('0xa3')](_0x4b5a31[_0x68ef('0x112')])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x4b5a31,'no\x20file\x20audio\x20selected');}var _0x5c1f5c=this[_0x68ef('0x20')]['sync'](this,_0x4b5a31[_0x68ef('0x112')]);if(!_0x5c1f5c){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x4b5a31,_0x68ef('0x113'));}if(!this[_0x68ef('0xa3')](_0x4b5a31[_0x68ef('0xd8')])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x68ef('0xd9'));}var _0x2a9db2=this[_0x68ef('0xe')][_0x68ef('0x114')](_0x5c1f5c,_0x4b5a31[_0x68ef('0x115')],_0x4b5a31[_0x68ef('0x116')]);var _0x1828c9=_0x2a9db2[_0x68ef('0xa1')]?_0x2a9db2[_0x68ef('0xa1')][_0x68ef('0x4b')]():'';logger[_0x68ef('0x2f')]('test',JSON['stringify'](_0x2a9db2));if(_0x2a9db2[_0x68ef('0xa1')]===-0x1){this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x4b5a31,_0x1828c9);return _0x2a9db2;}else if(_0x2a9db2[_0x68ef('0xa0')]===_0x68ef('0x64')){_0x2a9db2[_0x68ef('0xa1')]=_0x1828c9['length']>=parseInt(_0x4b5a31[_0x68ef('0x117')])?'x':'i';}else{_0x2a9db2[_0x68ef('0xa1')]=_0x1828c9[_0x68ef('0x98')]>=parseInt(_0x4b5a31[_0x68ef('0x117')])&&_0x1828c9[_0x68ef('0x98')]<=parseInt(_0x4b5a31['maxdigit'])?'x':'i';}var _0x51d410=this[_0x68ef('0x12')][_0x68ef('0x6d')](this,_0x4b5a31[_0x68ef('0xd8')]);if(!_0x51d410){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x4b5a31,_0x68ef('0x118'));}this[_0x68ef('0xe')]['setVariable'](_0x51d410,_0x1828c9);if(this['isConfigured'](_0x4b5a31[_0x68ef('0x119')])){var _0x27277d=parseInt(_0x4b5a31[_0x68ef('0x119')],0xa);var _0x4de2eb=rs[_0x68ef('0x11a')]({'charset':'*','length':_0x27277d});var _0x1b88bb=_0x1828c9[_0x68ef('0x98')];if(_0x1b88bb>0x0){if(_0x1b88bb>_0x27277d){this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x4b5a31,_0x4b5a31[_0x68ef('0x11b')]===_0x68ef('0x11c')?_0x4de2eb+_0x1828c9[_0x68ef('0x11d')](_0x27277d):_0x1828c9['substr'](0x0,_0x1b88bb-_0x27277d)+_0x4de2eb);}else{this[_0x68ef('0x36')]['sync'](this,_0x4b5a31,rs[_0x68ef('0x11a')]({'charset':'*','length':_0x1b88bb}));}}else{this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x4b5a31,'');}}else{this['createSquareDetailsReport'][_0x68ef('0x6d')](this,_0x4b5a31,_0x1828c9);}return _0x2a9db2;};AGIVertices[_0x68ef('0x11')][_0x68ef('0x11e')]=function(_0xd7ffe6){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x11f'),_0xd7ffe6[_0x68ef('0x38')]));return this[_0x68ef('0xd')](_0xd7ffe6);};AGIVertices['prototype']['goal']=function(_0x370032){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x370032[_0x68ef('0x38')]));this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x370032,_0x370032['goalname']);return this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x120'),_0x370032[_0x68ef('0x121')]));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x122')]=function(_0x51bd64){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x123'),_0x51bd64[_0x68ef('0x38')]));if(!this['isConfigured'](_0x51bd64[_0x68ef('0x83')])||!this[_0x68ef('0xa3')](_0x51bd64[_0x68ef('0x89')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x68ef('0xa3')](_0x51bd64[_0x68ef('0x5b')])){return this[_0x68ef('0xe')]['noop'](_0x68ef('0xa9'));}this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x124'),_0x51bd64[_0x68ef('0x5b')]));var _0x3b8f19=this[_0x68ef('0x82')]['sync'](this,_0x51bd64);if(_0x3b8f19){this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x125'),_0x3b8f19));var _0x58ed21=this[_0x68ef('0xe')][_0x68ef('0x102')](_0x3b8f19);try{fs[_0x68ef('0x103')](_0x3b8f19+_0x68ef('0x104'));}catch(_0x29079d){logger['error'](_0x29079d);}return _0x58ed21;}return this['channel'][_0x68ef('0x2d')](_0x51bd64,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x68ef('0x126')]=function(_0x1ebd33){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x127'),_0x1ebd33[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x1ebd33['aws_access_key_id'])||!this[_0x68ef('0xa3')](_0x1ebd33[_0x68ef('0x89')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x128'));}if(!this['isConfigured'](_0x1ebd33[_0x68ef('0x8b')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x129'));}if(!this[_0x68ef('0xa3')](_0x1ebd33[_0x68ef('0x5b')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')]('no\x20text\x20configured');}this[_0x68ef('0xe')][_0x68ef('0xf5')]=!![];this[_0x68ef('0x36')](_0x1ebd33);this[_0x68ef('0x41')](_0x1ebd33[_0x68ef('0x5b')],'in','','');this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')]('Trying\x20Amazon\x20Lex:\x20%s',_0x1ebd33[_0x68ef('0x5b')]));var _0x266af9=this[_0x68ef('0x88')][_0x68ef('0x6d')](this,_0x1ebd33);if(_0x266af9){for(var _0x12fed3 in _0x266af9){if(_0x266af9['hasOwnProperty'](_0x12fed3)&&_[_0x68ef('0x99')](_0x266af9[_0x12fed3])){this[_0x68ef('0xe')][_0x68ef('0x9d')](util[_0x68ef('0x2a')](_0x68ef('0x12a'),_0x12fed3[_0x68ef('0x12b')]()),_0x266af9[_0x12fed3]);}}if(_[_0x68ef('0x44')](_0x266af9[_0x68ef('0x73')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x12c'));}else{this[_0x68ef('0x41')](_0x266af9[_0x68ef('0x73')],'out',_0x68ef('0x12d'),'');return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x12e'),_0x266af9['message']));}}return this[_0x68ef('0xe')]['error'](_0x1ebd33,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x68ef('0x11')]['googleasr']=function(_0x4a4564){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x12f'),_0x4a4564[_0x68ef('0x38')],_0x4a4564[_0x68ef('0x64')]));if(!this[_0x68ef('0xa3')](_0x4a4564[_0x68ef('0x76')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xe7'));}var _0x5af158='wav';var _0x11245b=util[_0x68ef('0x2a')](_0x68ef('0x130'),FILES_PATH,rs[_0x68ef('0x11a')](0x4));var _0x422c7f=util[_0x68ef('0x2a')](_0x68ef('0x9b'),_0x11245b,_0x5af158);var _0xcc1765=!![];if(_0x4a4564[_0x68ef('0x131')]===_0x68ef('0x132')){_0xcc1765=![];}var _0x1066a8=this[_0x68ef('0xe')]['recordFile'](_0x11245b,_0x5af158,_0x4a4564[_0x68ef('0x133')],_0x4a4564['timeout'],undefined,_0xcc1765);if(_0x1066a8[_0x68ef('0xa1')]!==-0x1){this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')]('google\x20%s\x20file\x20created',_0x422c7f));var _0x3c883e=this[_0x68ef('0x8c')][_0x68ef('0x6d')](this,_0x4a4564,_0x422c7f);if(_0x3c883e){for(var _0x295b66 in _0x3c883e){if(_0x3c883e[_0x68ef('0x93')](_0x295b66)){this[_0x68ef('0xe')]['setVariable'](util[_0x68ef('0x2a')]('GOOGLE_ASR_%s',_0x295b66[_0x68ef('0x12b')]()),_0x3c883e[_0x295b66]);}}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x134'),JSON[_0x68ef('0x70')](_0x3c883e)));}}return _0x1066a8;};AGIVertices['prototype']['tildeasr']=function(_0x4ce786){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x4ce786[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x4ce786[_0x68ef('0x8f')])){return this[_0x68ef('0xe')]['noop'](_0x68ef('0x135'));}if(!this[_0x68ef('0xa3')](_0x4ce786[_0x68ef('0x136')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x137'));}var _0x2ec497=_0x68ef('0x138');var _0x423531=util[_0x68ef('0x2a')]('%s/recordings/%s',FILES_PATH,rs[_0x68ef('0x11a')](0x4));var _0x2f2a47=util[_0x68ef('0x2a')](_0x68ef('0x9b'),_0x423531,_0x2ec497);var _0x4ad8e5=!![];if(_0x4ce786[_0x68ef('0x131')]===_0x68ef('0x132')){_0x4ad8e5=![];}var _0x1fca99=this[_0x68ef('0xe')]['recordFile'](_0x423531,_0x2ec497,_0x4ce786[_0x68ef('0x133')],_0x4ce786[_0x68ef('0x64')],undefined,_0x4ad8e5);if(_0x1fca99[_0x68ef('0xa1')]!==-0x1){this['channel']['noop'](util['format'](_0x68ef('0x139'),_0x2f2a47));var _0x5c7df3=this['tildeASR'][_0x68ef('0x6d')](this,_0x4ce786,_0x2f2a47);if(_0x5c7df3){for(var _0x55b3bc in _0x5c7df3){if(_0x5c7df3[_0x68ef('0x93')](_0x55b3bc)){this[_0x68ef('0xe')][_0x68ef('0x9d')](util[_0x68ef('0x2a')]('TILDE_ASR_%s',_0x55b3bc[_0x68ef('0x12b')]()),_0x5c7df3[_0x55b3bc]);}}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util['format'](_0x68ef('0x13a'),JSON[_0x68ef('0x70')](_0x5c7df3)));}}return _0x1fca99;};AGIVertices[_0x68ef('0x11')]['gotoc']=function(_0x4c6756){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x13b'),_0x4c6756['label']));return this['channel']['continueAt'](_0x4c6756[_0x68ef('0x3c')],_0x4c6756[_0x68ef('0x3d')],_0x4c6756[_0x68ef('0x13c')]);};AGIVertices[_0x68ef('0x11')][_0x68ef('0x13d')]=function(_0x48ab1c){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x13e'),_0x48ab1c['label']));if(!this[_0x68ef('0xa3')](_0x48ab1c[_0x68ef('0x13f')])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x48ab1c,_0x68ef('0x140'));}try{var _0x2b7d0c=eval(_0x48ab1c['condition'])?_0x68ef('0x141'):_0x68ef('0x142');this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x143'),_0x48ab1c[_0x68ef('0x13f')],_0x2b7d0c));return{'code':0xc8,'result':_0x2b7d0c};}catch(_0x3a4e5d){return{'code':0xc8,'result':_0x68ef('0x142')};}};AGIVertices[_0x68ef('0x11')][_0x68ef('0x144')]=function(_0x5fd998){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x145'),_0x5fd998[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x5fd998['interval_id'])){return this[_0x68ef('0xe')]['error'](_0x5fd998,'no\x20interval\x20configured');}var _0x2ee1d9=this['getIntervals'][_0x68ef('0x6d')](this,_0x5fd998[_0x68ef('0x146')]);if(!_0x2ee1d9){return this['channel'][_0x68ef('0x2d')](_0x5fd998,_0x68ef('0x147'));}for(var _0x563050=0x0;_0x563050<_0x2ee1d9[_0x68ef('0x98')];_0x563050+=0x1){var _0x41779c=this[_0x68ef('0xe')][_0x68ef('0x12')](util[_0x68ef('0x2a')](_0x68ef('0x148'),_0x2ee1d9[_0x563050]));if(_0x41779c[_0x68ef('0xa1')]===-0x1){return _0x41779c;}logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x149'),_0x2ee1d9[_0x563050],_0x41779c['extra']));if(_0x41779c['extra']===_0x68ef('0x141')){logger[_0x68ef('0x2f')](util['format']('IFTIME\x20%s\x20%s',_0x2ee1d9[_0x563050],'true'));this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0x149'),_0x2ee1d9[_0x563050],_0x68ef('0x141')));return{'code':0xc8,'result':_0x68ef('0x141')};}else{logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('IFTIME\x20%s\x20%s',_0x2ee1d9[_0x563050],'false'));this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0x149'),_0x2ee1d9[_0x563050],_0x68ef('0x142')));}}return{'code':0xc8,'result':_0x68ef('0x142')};};AGIVertices['prototype'][_0x68ef('0x14a')]=function(_0x5b406c){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x14b'),_0x5b406c[_0x68ef('0x38')]));return this[_0x68ef('0xe')]['hangup']();};AGIVertices['prototype'][_0x68ef('0x14c')]=function(_0x11c32c){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x14d'),_0x11c32c[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x11c32c[_0x68ef('0x76')])){return this['channel']['noop'](_0x68ef('0xe7'));}var _0x143488=_0x68ef('0x138');var _0x1ba9e9=util[_0x68ef('0x2a')](_0x68ef('0x130'),FILES_PATH,rs[_0x68ef('0x11a')](0x4));var _0x2d10c1=util[_0x68ef('0x2a')](_0x68ef('0x9b'),_0x1ba9e9,_0x143488);var _0x48dea9=!![];if(_0x11c32c['beep']===_0x68ef('0x132')){_0x48dea9=![];}var _0x2c291d=this[_0x68ef('0xe')][_0x68ef('0x14e')](_0x1ba9e9,_0x143488,_0x11c32c[_0x68ef('0x133')],_0x11c32c['timeout'],undefined,_0x48dea9);if(_0x2c291d[_0x68ef('0xa1')]!==-0x1){this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x14f'),_0x2d10c1));var _0x24e1b5=this[_0x68ef('0x7f')]['sync'](this,_0x11c32c,_0x2d10c1);if(_0x24e1b5){for(var _0x2b8b2f in _0x24e1b5){if(_0x24e1b5[_0x68ef('0x93')](_0x2b8b2f)){this[_0x68ef('0xe')][_0x68ef('0x9d')](util[_0x68ef('0x2a')]('ISPEECH_ASR_%s',_0x2b8b2f[_0x68ef('0x12b')]()),_0x24e1b5[_0x2b8b2f]);}}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x150'),JSON[_0x68ef('0x70')](_0x24e1b5)));}}return _0x2c291d;};AGIVertices['prototype'][_0x68ef('0x151')]=function(_0x236a7d){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x152'),_0x236a7d[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x236a7d[_0x68ef('0x76')])){return this['channel'][_0x68ef('0xa8')](_0x68ef('0xe7'));}if(!this[_0x68ef('0xa3')](_0x236a7d[_0x68ef('0x5b')])){return this['channel'][_0x68ef('0xa8')](_0x68ef('0xa9'));}this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')]('Trying\x20ispeech\x20TTS\x20%s',_0x236a7d['text']));var _0x494b67=this['ispeechTTS'][_0x68ef('0x6d')](this,_0x236a7d);if(_0x494b67){this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')]('ispeech\x20%s\x20file\x20created',_0x494b67));var _0x3f13a7=this[_0x68ef('0xe')][_0x68ef('0x102')](_0x494b67,_0x236a7d[_0x68ef('0x133')]);try{fs['unlink'](_0x494b67+_0x68ef('0x104'));}catch(_0x206b52){logger['error'](_0x206b52);}return _0x3f13a7;}return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x236a7d,_0x68ef('0x153'));};AGIVertices['prototype']['login']=function(_0x7749ca){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x154'),_0x7749ca[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x7749ca[_0x68ef('0x155')])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x7749ca,_0x68ef('0x156'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x68ef('0x3b')],_0x7749ca[_0x68ef('0x155')]));var _0x2a45a6=this['agentLogin'][_0x68ef('0x6d')](this,_0x7749ca[_0x68ef('0x155')]);if(_0x2a45a6){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x157'),this[_0x68ef('0xe')]['callerid'],_0x7749ca[_0x68ef('0x155')]));this[_0x68ef('0xe')][_0x68ef('0xa8')](util['format'](_0x68ef('0x157'),this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x7749ca[_0x68ef('0x155')]));return{'code':0xc8,'result':'success'};}else{logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x158'),this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x7749ca[_0x68ef('0x155')]));this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x158'),this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x7749ca['findBy']));return{'code':0xc8,'result':_0x68ef('0x159')};}};AGIVertices[_0x68ef('0x11')][_0x68ef('0x15a')]=function(_0x5bacf5){logger['info'](util[_0x68ef('0x2a')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x5bacf5[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x5bacf5[_0x68ef('0x155')])){return this['channel'][_0x68ef('0x2d')](_0x5bacf5,_0x68ef('0x156'));}logger['info'](util[_0x68ef('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x5bacf5['findBy']));var _0x630c64=this[_0x68ef('0x51')][_0x68ef('0x6d')](this,_0x5bacf5[_0x68ef('0x155')]);if(_0x630c64){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x157'),this[_0x68ef('0xe')]['callerid'],_0x5bacf5[_0x68ef('0x155')]));this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x157'),this[_0x68ef('0xe')]['callerid'],_0x5bacf5[_0x68ef('0x155')]));return{'code':0xc8,'result':_0x68ef('0x15b')};}else{logger['info'](util[_0x68ef('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x68ef('0xe')]['callerid'],_0x5bacf5[_0x68ef('0x155')]));this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x5bacf5[_0x68ef('0x155')]));return{'code':0xc8,'result':_0x68ef('0x159')};}};AGIVertices['prototype'][_0x68ef('0x15c')]=function(_0x1e7aca){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x15d'),_0x1e7aca['label']));if(!this[_0x68ef('0xa3')](_0x1e7aca[_0x68ef('0x15e')])){return this[_0x68ef('0xe')]['error'](_0x1e7aca,_0x68ef('0x15f'));}this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0x160'),_0x1e7aca[_0x68ef('0x15e')]));var _0x283b1e=eval(_0x1e7aca['operation']);if(!this[_0x68ef('0xa3')](_0x1e7aca[_0x68ef('0xd8')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0xd9'));}var _0x54e567=this[_0x68ef('0x12')]['sync'](this,_0x1e7aca[_0x68ef('0xd8')]);if(!_0x54e567){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x1e7aca,'no\x20variable\x20found');}if(_['isArray'](_0x283b1e)){var _0x35f065=this;_0x283b1e[_0x68ef('0xda')](function(_0x41aa43,_0x2bf378){_0x35f065[_0x68ef('0xe')][_0x68ef('0x9d')](util[_0x68ef('0x2a')](_0x68ef('0x161'),_0x54e567,_0x2bf378),_0x41aa43);});return this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0x162'),_0x54e567));}else{return this[_0x68ef('0xe')][_0x68ef('0x9d')](_0x54e567,_0x283b1e);}};AGIVertices['prototype'][_0x68ef('0xc')]=function(_0x2f4ae5){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x163'),_0x2f4ae5[_0x68ef('0x38')]));if(_0x2f4ae5[_0x68ef('0xa5')]===0x0){return this[_0x68ef('0xa4')](_0x2f4ae5);}_0x2f4ae5[_0x68ef('0xa5')]-=0x1;if(!this['isConfigured'](_0x2f4ae5[_0x68ef('0x112')])){return this[_0x68ef('0xe')]['error'](_0x2f4ae5,'no\x20file\x20audio\x20selected');}var _0x6bf3bb=this[_0x68ef('0x20')]['sync'](this,_0x2f4ae5[_0x68ef('0x112')]);if(!_0x6bf3bb){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x2f4ae5,_0x68ef('0x113'));}var _0x598303=this['channel'][_0x68ef('0x114')](_0x6bf3bb,_0x2f4ae5[_0x68ef('0x115')],_0x2f4ae5[_0x68ef('0x164')]);var _0x75a50a=_0x598303['result'];if(_0x598303['result']===-0x1){this['createSquareDetailsReport'][_0x68ef('0x6d')](this,_0x2f4ae5,'-1');return _0x598303;}else if(_0x598303[_0x68ef('0xa0')]===_0x68ef('0x64')){_0x598303[_0x68ef('0xa1')]=_0x598303['result'][_0x68ef('0x98')]>0x0?_0x598303['result']:'t';}else if(_[_0x68ef('0x43')](_0x598303[_0x68ef('0xa1')])){_0x598303[_0x68ef('0xa1')]='#';_0x75a50a='#';}if(!this[_0x68ef('0xa3')](_0x2f4ae5[_0x68ef('0xd8')])){this[_0x68ef('0xe')][_0x68ef('0xa8')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x5a7448=this[_0x68ef('0x12')][_0x68ef('0x6d')](this,_0x2f4ae5[_0x68ef('0xd8')]);if(!_0x5a7448){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x2f4ae5,_0x68ef('0x118'));}this['channel'][_0x68ef('0x9d')](_0x5a7448,_0x75a50a);}this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x2f4ae5,_0x75a50a);return _0x598303;};AGIVertices[_0x68ef('0x11')][_0x68ef('0xa8')]=function(_0x10788b){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x165'),_0x10788b[_0x68ef('0x38')]));return this[_0x68ef('0xe')]['noop'](_0x10788b[_0x68ef('0x166')]||_0x10788b[_0x68ef('0x38')]);};AGIVertices['prototype'][_0x68ef('0x167')]=function(_0x1947c9){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x168'),_0x1947c9[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x1947c9[_0x68ef('0x155')])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x1947c9,'no\x20find\x20by\x20configured');}logger[_0x68ef('0x2f')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x1947c9[_0x68ef('0x155')]));var _0x2b132f=this[_0x68ef('0x4d')][_0x68ef('0x6d')](this,_0x1947c9['pause_id']);var _0x319bcc=this[_0x68ef('0x4e')]['sync'](this,_0x1947c9['findBy'],_0x2b132f);if(_0x319bcc){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x1947c9[_0x68ef('0x155')]));this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x157'),this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x1947c9[_0x68ef('0x155')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x158'),this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x1947c9[_0x68ef('0x155')]));this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x157'),this[_0x68ef('0xe')]['callerid'],_0x1947c9[_0x68ef('0x155')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x68ef('0x11')][_0x68ef('0x169')]=function(_0x129792){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x16a'),_0x129792[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x129792['file_id'])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x129792,_0x68ef('0x16b'));}var _0x4949f9=this[_0x68ef('0x20')][_0x68ef('0x6d')](this,_0x129792[_0x68ef('0x112')]);if(!_0x4949f9){return this['channel']['error'](_0x129792,'no\x20file\x20audio\x20found');}var _0x2a75ea=this[_0x68ef('0xe')]['exec'](_0x68ef('0x16c'),[_0x4949f9,_0x129792[_0x68ef('0xe5')]]);if(_0x2a75ea[_0x68ef('0xa1')]===-0x1){return _0x2a75ea;}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xc3'),'PLAYBACK',_0x4949f9));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x16d')]=function(_0x295453){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x16e'),_0x295453[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x295453[_0x68ef('0x16f')])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x295453,_0x68ef('0x170'));}var _0x3ffa7b='';var _0x4cf843=parseInt(_0x295453['queue_id'],0xa);if(isNaN(_0x4cf843)){_0x3ffa7b=_0x295453[_0x68ef('0x16f')];}else{_0x3ffa7b=this[_0x68ef('0x16')]['sync'](this,_0x295453['queue_id']);if(!_0x3ffa7b){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x295453,_0x68ef('0x171'));}}var _0x235d03='';if(this[_0x68ef('0xa3')](_0x295453[_0x68ef('0x112')])){var _0x1f2006=this[_0x68ef('0x20')][_0x68ef('0x6d')](this,_0x295453[_0x68ef('0x112')]);if(_0x1f2006){_0x235d03=_0x1f2006;}}this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x295453,_0x3ffa7b);if(_0x295453[_0x68ef('0xe5')]['indexOf']('x')<0x0){_0x295453[_0x68ef('0xe5')]+='x';}if(_0x295453[_0x68ef('0xe5')][_0x68ef('0x172')]('X')<0x0){_0x295453[_0x68ef('0xe5')]+='X';}this[_0x68ef('0xe')][_0x68ef('0x9d')](_0x68ef('0x173'),_0x3ffa7b?_0x3ffa7b[_0x68ef('0x174')]():'');var _0x188efb=this['channel'][_0x68ef('0xc2')](_0x68ef('0x175'),[_0x3ffa7b,_0x295453['opts'],_0x295453['url'],_0x235d03,_0x295453['timeout'],_0x295453[_0x68ef('0x8')],_0x295453['macro'],_0x295453['gosub'],'',_0x295453['position']]);if(_0x188efb['result']===-0x1){return _0x188efb;}return this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xc3'),'QUEUE',_0x3ffa7b));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x176')]=function(_0x96ce74){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x177'),_0x96ce74[_0x68ef('0x38')]));var _0x3fd711=_0x96ce74[_0x68ef('0x178')]||_0x68ef('0x138');var _0xd453ae=util['format']('%s_%s',this[_0x68ef('0xe')][_0x68ef('0x37')],rs[_0x68ef('0x11a')](0x5));var _0x392040=util['format'](_0x68ef('0x179'),FILES_PATH,_0xd453ae,_0x3fd711);var _0x960a71=util[_0x68ef('0x2a')]('%s/recordings/%s',FILES_PATH,_0xd453ae);this[_0x68ef('0x17a')]['sync'](this,_0x96ce74,_0xd453ae,_0x392040);this[_0x68ef('0xe')][_0x68ef('0x9d')]('RECORDING_SAVENAME',_0xd453ae);logger[_0x68ef('0x2f')](_0x68ef('0x17b'),_0x960a71,_0x3fd711,_0x96ce74[_0x68ef('0x17c')],_0x96ce74['timeout']);return this[_0x68ef('0xe')][_0x68ef('0x14e')](_0x960a71,_0x3fd711,_0x96ce74[_0x68ef('0x17c')],_0x96ce74[_0x68ef('0x64')],undefined,!![]);};AGIVertices[_0x68ef('0x11')][_0x68ef('0x17d')]=function(_0x3fbeeb){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x17e'),_0x3fbeeb[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x3fbeeb[_0x68ef('0x6f')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')]('no\x20url\x20configured');}var _0x2e2361=this[_0x68ef('0x17f')][_0x68ef('0x6d')](this,_0x3fbeeb);logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x180'),util[_0x68ef('0x181')](_0x2e2361,{'showHidden':![],'depth':null})));if(!this[_0x68ef('0xa3')](_0x3fbeeb[_0x68ef('0xd8')])){return this[_0x68ef('0xe')]['noop'](_0x68ef('0x182'));}var _0x5c26db=this['getVariable'][_0x68ef('0x6d')](this,_0x3fbeeb[_0x68ef('0xd8')]);if(!_0x5c26db){return this[_0x68ef('0xe')]['error'](_0x3fbeeb,'no\x20variable\x20found');}this[_0x68ef('0xe')][_0x68ef('0x9d')](util[_0x68ef('0x2a')](_0x68ef('0x183'),_0x5c26db),_0x2e2361['statusCode']?_0x2e2361[_0x68ef('0x72')]:_0x68ef('0x184'));this[_0x68ef('0xe')][_0x68ef('0x9d')](util[_0x68ef('0x2a')]('%s_STATUS_MESSAGE',_0x5c26db),_0x2e2361[_0x68ef('0x185')]?_0x2e2361['statusMessage']:'OK');if(_0x2e2361[_0x68ef('0x66')]){try{this[_0x68ef('0x9c')](_0x2e2361['body'],_0x5c26db);}catch(_0x29dc07){logger['error'](util[_0x68ef('0x2a')](_0x68ef('0x186'),_0x5c26db));}}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0xde'),_0x5c26db));};AGIVertices[_0x68ef('0x11')]['saydigits']=function(_0x30966c){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x30966c[_0x68ef('0x38')]));return this[_0x68ef('0xe')][_0x68ef('0x187')](_0x30966c['digits'][_0x68ef('0x58')](/\s+/g,''),_0x30966c[_0x68ef('0x17c')]);};AGIVertices[_0x68ef('0x11')]['saynumber']=function(_0x412491){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x188'),_0x412491[_0x68ef('0x38')]));return this[_0x68ef('0xe')]['sayNumber'](_0x412491[_0x68ef('0x63')]['replace'](/\s+/g,''),_0x412491[_0x68ef('0x17c')]);};AGIVertices[_0x68ef('0x11')][_0x68ef('0x189')]=function(_0xe65b78){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x18a'),_0xe65b78[_0x68ef('0x38')]));return this[_0x68ef('0xe')][_0x68ef('0x18b')](_0xe65b78[_0x68ef('0x5b')],_0xe65b78[_0x68ef('0x17c')]);};AGIVertices[_0x68ef('0x11')][_0x68ef('0x18c')]=function(_0x26c89a){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x26c89a[_0x68ef('0x38')]));if(!this['isConfigured'](_0x26c89a[_0x68ef('0x18d')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x18e'));}var _0x23a5e0=this['getMailAccount'][_0x68ef('0x6d')](this,_0x26c89a[_0x68ef('0x18d')]);if(!_0x23a5e0||!_0x23a5e0['Smtp']){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x26c89a,_0x68ef('0x18f'));}var _0x314613={'from':util[_0x68ef('0x2a')](_0x68ef('0x190'),_0x23a5e0[_0x68ef('0x14')],_0x23a5e0[_0x68ef('0x191')]||_0x23a5e0[_0x68ef('0x192')]['user']),'to':_0x26c89a['to']||'','cc':_0x26c89a['cc']||'','bcc':_0x26c89a[_0x68ef('0x193')]||'','subject':_0x26c89a[_0x68ef('0x194')],'html':_0x26c89a[_0x68ef('0x5b')],'text':_0x26c89a[_0x68ef('0x5b')]};if(this[_0x68ef('0xa3')](_0x26c89a[_0x68ef('0x195')])){}logger[_0x68ef('0xe0')]('sendMail\x20message',JSON[_0x68ef('0x70')](_0x314613));this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x26c89a,_0x26c89a[_0x68ef('0x18d')]);this['channel'][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x196'),_0x23a5e0['name']));this[_0x68ef('0x24')][_0x68ef('0x6d')](this,_0x23a5e0[_0x68ef('0x197')],_0x314613);return this[_0x68ef('0xe')]['noop'](_0x68ef('0x198'));};AGIVertices[_0x68ef('0x11')]['sendFax']=function(_0x46292c){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x199'),_0x46292c[_0x68ef('0x38')]));return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x19a'));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x19b')]=function(_0x508bd7){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x19c'),_0x508bd7[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x508bd7[_0x68ef('0x19d')])){return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x19e'));}var _0x21402e=this['getSmsAccount'][_0x68ef('0x6d')](this,_0x508bd7[_0x68ef('0x19d')]);if(!_0x21402e){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x508bd7,_0x68ef('0x19f'));}var _0x434528={'body':_0x508bd7['sms_text'],'phone':_0x508bd7['to']||'','SmsAccountId':_0x21402e['id']};logger[_0x68ef('0xe0')](_0x68ef('0x1a0'),JSON[_0x68ef('0x70')](_0x434528));this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x508bd7,_0x508bd7['sms_account_id']);this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x21402e[_0x68ef('0x14')]));this[_0x68ef('0x35')][_0x68ef('0x6d')](this,_0x434528);return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x1a1'));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x1a2')]=function(_0x14c1c1){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x1a3'),_0x14c1c1['label']));if(!this[_0x68ef('0xa3')](_0x14c1c1['variable_id'])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x14c1c1,_0x68ef('0x1a4'));}var _0x136f76=this[_0x68ef('0x12')][_0x68ef('0x6d')](this,_0x14c1c1[_0x68ef('0xd8')]);if(!_0x136f76){return this[_0x68ef('0xe')]['error'](_0x14c1c1,_0x68ef('0x118'));}return this[_0x68ef('0xe')][_0x68ef('0x9d')](_0x136f76,_0x14c1c1[_0x68ef('0x1a5')]);};AGIVertices[_0x68ef('0x11')][_0x68ef('0x1a6')]=function(_0x1cde7a){logger['info'](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x1cde7a['label']));this['channel'][_0x68ef('0xa8')](_0x68ef('0x1a7'));var _0x192107=this[_0x68ef('0xe')][_0x68ef('0x12')](_0x68ef('0x1a8'));if(!_['isEmpty'](_0x192107['extra'])){this[_0x68ef('0xe')][_0x68ef('0x37')]=_0x192107['extra'];}if(_0x1cde7a['answer']===_0x68ef('0x1a9')){this[_0x68ef('0xe')]['noop'](_0x68ef('0x1aa'));return this[_0x68ef('0xe')]['answer']();}return this[_0x68ef('0xe')][_0x68ef('0xa8')](_0x68ef('0x1ab'));};AGIVertices['prototype']['subproject']=function(_0x4de5f2){logger['info'](util[_0x68ef('0x2a')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x4de5f2[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x4de5f2['project_id'])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x4de5f2,'no\x20subproject\x20selected');}var _0x21ee1b=this[_0x68ef('0x18')]['sync'](this,_0x4de5f2[_0x68ef('0x1ac')]);if(!this[_0x68ef('0xa3')](_0x21ee1b)){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x4de5f2,util[_0x68ef('0x2a')]('no\x20subproject\x20found\x20with\x20id\x20%d',_0x4de5f2['project_id']));}if(_0x21ee1b===this[_0x68ef('0xe')][_0x68ef('0x3a')]){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x4de5f2,_0x68ef('0x1ad'));}this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x4de5f2,_0x21ee1b);var _0x5187ae=this['channel'][_0x68ef('0xc2')](_0x68ef('0x1ae'),util[_0x68ef('0x2a')](_0x68ef('0x1af'),config[_0x68ef('0x8')][_0x68ef('0x1b0')]||'127.0.0.1',_0x21ee1b,this[_0x68ef('0xe')][_0x68ef('0x3a')]));if(_0x5187ae['result']===-0x1){return _0x5187ae;}return this['channel']['noop'](util[_0x68ef('0x2a')](_0x68ef('0xc3'),_0x68ef('0x1ae'),_0x21ee1b));};AGIVertices['prototype'][_0x68ef('0x1b1')]=function(_0x5b90fd){logger[_0x68ef('0x2f')](util['format'](_0x68ef('0x1b2'),_0x5b90fd[_0x68ef('0x38')]));var _0x1d351b=this[_0x68ef('0x56')][_0x68ef('0x6d')](this,_0x5b90fd[_0x68ef('0xb5')]);this[_0x68ef('0x36')][_0x68ef('0x6d')](this,_0x5b90fd,_0x5b90fd[_0x68ef('0xb5')]);if(this[_0x68ef('0xa3')](_0x5b90fd[_0x68ef('0xd8')])){var _0x18bb97=this[_0x68ef('0x12')][_0x68ef('0x6d')](this,_0x5b90fd['variable_id']);if(_0x18bb97){this[_0x68ef('0xe')][_0x68ef('0x9d')](_0x18bb97,_0x1d351b);return this[_0x68ef('0xe')][_0x68ef('0xa8')](util['format'](_0x68ef('0x1b3'),_0x5b90fd['command'],_0x18bb97));}}return this[_0x68ef('0xe')]['noop'](util['format'](_0x68ef('0x1b4'),_0x5b90fd['command']));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x1b5')]=function(_0x2bad8d){logger['info'](util['format'](_0x68ef('0x1b6'),_0x2bad8d[_0x68ef('0x38')]));_0x2bad8d[_0x68ef('0x5b')]=_0x2bad8d[_0x68ef('0x5b')][_0x68ef('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x68ef('0xa3')](_0x2bad8d[_0x68ef('0x5a')])){return this['channel']['noop'](_0x68ef('0x1b7'));}if(!this['isConfigured'](_0x2bad8d[_0x68ef('0x5b')])){return this['channel'][_0x68ef('0xa8')]('no\x20text\x20configured');}this[_0x68ef('0xe')][_0x68ef('0xa8')](util['format']('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x2bad8d['text']));var _0x4c1400=this['googleCloudTTS']['sync'](this,_0x2bad8d);if(_0x4c1400){this['channel'][_0x68ef('0xa8')](util['format'](_0x68ef('0x1b8'),_0x4c1400));var _0x1e5e95=this['channel'][_0x68ef('0x102')](_0x4c1400);try{fs['unlink'](_0x4c1400+_0x68ef('0x104'));}catch(_0x5e6247){logger[_0x68ef('0x2d')](_0x5e6247);}return _0x1e5e95;}return this[_0x68ef('0xe')]['error'](_0x2bad8d,_0x68ef('0x1b9'));};AGIVertices['prototype'][_0x68ef('0x1ba')]=function(_0x18a659){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x18a659['label']));_0x18a659[_0x68ef('0x5b')]=_0x18a659[_0x68ef('0x5b')][_0x68ef('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x68ef('0xa3')](_0x18a659[_0x68ef('0x5b')])){return this[_0x68ef('0xe')]['noop']('no\x20text\x20configured');}this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0x1bb'),_0x18a659['text']));var _0x40a11e=this[_0x68ef('0x60')][_0x68ef('0x6d')](this,_0x18a659);if(_0x40a11e){this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')](_0x68ef('0x1bc'),_0x40a11e));var _0x2ac8e2=this['channel']['streamFile'](_0x40a11e);try{fs[_0x68ef('0x103')](_0x40a11e+_0x68ef('0x104'));}catch(_0x2355ae){logger[_0x68ef('0x2d')](_0x2355ae);}return _0x2ac8e2;}return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x18a659,_0x68ef('0x1bd'));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x1be')]=function(_0x236a78){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')](_0x68ef('0x1bf'),_0x236a78['label']));if(!this['isConfigured'](_0x236a78[_0x68ef('0x155')])){return this[_0x68ef('0xe')][_0x68ef('0x2d')](_0x236a78,_0x68ef('0x156'));}logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x236a78[_0x68ef('0x155')]));var _0x4919ff=this[_0x68ef('0x50')][_0x68ef('0x6d')](this,_0x236a78[_0x68ef('0x155')]);if(_0x4919ff){logger[_0x68ef('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x68ef('0xe')]['callerid'],_0x236a78['findBy']));this[_0x68ef('0xe')]['noop'](util[_0x68ef('0x2a')](_0x68ef('0x157'),this[_0x68ef('0xe')][_0x68ef('0x3b')],_0x236a78[_0x68ef('0x155')]));return{'code':0xc8,'result':_0x68ef('0x15b')};}else{logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x236a78[_0x68ef('0x155')]));this['channel'][_0x68ef('0xa8')](util['format'](_0x68ef('0x158'),this['channel'][_0x68ef('0x3b')],_0x236a78[_0x68ef('0x155')]));return{'code':0xc8,'result':_0x68ef('0x159')};}};AGIVertices[_0x68ef('0x11')]['voicemail']=function(_0x8fc474){logger[_0x68ef('0x2f')](util[_0x68ef('0x2a')]('Enter\x20in\x20VOICEMAIL\x20(%s)\x20block',_0x8fc474['label']));var _0x5cf09e=this['channel']['exec']('VOICEMAIL',[_0x8fc474['mailbox'],_0x8fc474['options']]);if(_0x5cf09e[_0x68ef('0xa1')]===-0x1){return _0x5cf09e;}return this[_0x68ef('0xe')][_0x68ef('0xa8')](util[_0x68ef('0x2a')]('Executed\x20command\x20%s\x20%s',_0x68ef('0x1c0'),_0x8fc474['mailbox']));};AGIVertices[_0x68ef('0x11')][_0x68ef('0x1c1')]=function(_0x28fb68){logger['info'](util[_0x68ef('0x2a')](_0x68ef('0x1c2'),_0x28fb68[_0x68ef('0x38')]));if(!this[_0x68ef('0xa3')](_0x28fb68[_0x68ef('0xd8')])){return this['channel'][_0x68ef('0x2d')](_0x28fb68,_0x68ef('0x1a4'));}var _0x563f66=this[_0x68ef('0x12')][_0x68ef('0x6d')](this,_0x28fb68[_0x68ef('0xd8')]);if(!_0x563f66){return this['channel'][_0x68ef('0x2d')](_0x28fb68,'no\x20variable\x20found');}var _0x3c416c=this[_0x68ef('0xe')]['getVariable'](_0x563f66);return{'code':0xc8,'result':_0x3c416c['extra']?_0x3c416c['extra']:'-'};};String[_0x68ef('0x11')][_0x68ef('0x9f')]=function(_0x1de52e,_0x232d87){return this[_0x68ef('0x9e')](_0x1de52e)[_0x68ef('0x1c3')](_0x232d87);};module['exports']=AGIVertices;
\ No newline at end of file
+var _0x885a=['createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','exec','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','includes','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','computedVariables','uri','render','stringify','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','extra','maxRetry','retry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','delay','minutes','sync','phone','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','no\x20user\x20selected','sip_id','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','bot','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','sesteknda','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','DIAL','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','test','hiddendigitsnum','generate','hiddendigitspos','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','beep','NOBEEP','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','appid','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','recordFile','intKey','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','context','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','condition','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','indexOf','toLowerCase','macro','gosub','position','QUEUE','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','sayPhonetic','no\x20mail\x20account\x20configured','account_id','Smtp','no\x20mail\x20account\x20found','user','bcc','subject','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20is\x20unreachable','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','lodash','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueueById','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getTrunkById','getSound','save_name','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','error','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','extension','dnid','file','createSquareMessage'];(function(_0x47491d,_0x1b05d0){var _0x1af5d4=function(_0x51f93c){while(--_0x51f93c){_0x47491d['push'](_0x47491d['shift']());}};_0x1af5d4(++_0x1b05d0);}(_0x885a,0x180));var _0xa885=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x885a[_0x178e48];return _0x440d7e;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0xa885('0x0'));var sh=require(_0xa885('0x1'));var odbc=require(_0xa885('0x2'))();var rs=require(_0xa885('0x3'));var moment=require('moment');var Mustache=require(_0xa885('0x4'));var rp=require(_0xa885('0x5'));var logger=require(_0xa885('0x6'))(_0xa885('0x7'));var config=require(_0xa885('0x8'));var scripts=require(_0xa885('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xa885('0xa'),_0xa885('0xb')];var verticesWithRetry=[_0xa885('0xc'),'getdigits',_0xa885('0xd')];var AGIVertices=function(_0x2b7916,_0x38df93,_0x5e49d0){this[_0xa885('0xe')]=_0x2b7916;this[_0xa885('0xf')]=_0x38df93;this[_0xa885('0x10')]=_0x5e49d0;};AGIVertices[_0xa885('0x11')][_0xa885('0x12')]=function(_0x11c544,_0xcf5f96){this['rpc'][_0xa885('0x13')](_0x11c544)[_0xa885('0x14')](function(_0x1fb769){_0xcf5f96(null,_0x1fb769?_0x1fb769[_0xa885('0x15')]:![]);})[_0xa885('0x16')](function(_0x3e9c7a){_0xcf5f96(_0x3e9c7a);});};AGIVertices[_0xa885('0x11')]['getVoiceQueue']=function(_0x3a310b,_0x1d789f){this[_0xa885('0xf')][_0xa885('0x17')](_0x3a310b)[_0xa885('0x14')](function(_0x5bdb0c){_0x1d789f(null,_0x5bdb0c?_0x5bdb0c[_0xa885('0x15')]:![]);})[_0xa885('0x16')](function(_0x5296e6){_0x1d789f(_0x5296e6);});};AGIVertices[_0xa885('0x11')][_0xa885('0x18')]=function(_0x4e5ae5,_0x6c6a0b){this[_0xa885('0xf')]['getSquareProjectById'](_0x4e5ae5)[_0xa885('0x14')](function(_0x543e7a){_0x6c6a0b(null,_0x543e7a?_0x543e7a[_0xa885('0x15')]:![]);})[_0xa885('0x16')](function(_0x8c26c){_0x6c6a0b(_0x8c26c);});};AGIVertices['prototype'][_0xa885('0x19')]=function(_0x56a614,_0x127a86){this[_0xa885('0xf')][_0xa885('0x1a')](_0x56a614)['then'](function(_0xbbf56e){_0x127a86(null,_0xbbf56e?_0xbbf56e[_0xa885('0x1b')]:![]);})[_0xa885('0x16')](function(_0x4de770){_0x127a86(_0x4de770);});};AGIVertices[_0xa885('0x11')][_0xa885('0x1c')]=function(_0x94fcac,_0x4ad909){this[_0xa885('0xf')]['getUserById'](_0x94fcac)[_0xa885('0x14')](function(_0x299553){_0x4ad909(null,_0x299553?_0x299553['name']:![]);})[_0xa885('0x16')](function(_0x190a57){_0x4ad909(_0x190a57);});};AGIVertices[_0xa885('0x11')]['getTrunk']=function(_0x35d4c4,_0x14aed1){this['rpc'][_0xa885('0x1d')](_0x35d4c4)['then'](function(_0x15ff4d){_0x14aed1(null,_0x15ff4d?_0x15ff4d['name']:![]);})[_0xa885('0x16')](function(_0x110e63){_0x14aed1(_0x110e63);});};AGIVertices[_0xa885('0x11')][_0xa885('0x1e')]=function(_0x1e0177,_0x410968){var _0x1e13d5=this;this[_0xa885('0xf')]['getSoundById'](_0x1e0177)['then'](function(_0x5c4ca7){_0x410968(null,_0x5c4ca7?_0x1e13d5['getSoundPath'](_0x5c4ca7[_0xa885('0x1f')]):![]);})[_0xa885('0x16')](function(_0x3af5d9){_0x410968(_0x3af5d9);});};AGIVertices[_0xa885('0x11')][_0xa885('0x20')]=function(_0x44f006,_0x5ac39f){this[_0xa885('0xf')]['getMailAccountById'](_0x44f006)[_0xa885('0x14')](function(_0x4a1e54){_0x5ac39f(null,_0x4a1e54?_0x4a1e54:![]);})[_0xa885('0x16')](function(_0x528a71){_0x5ac39f(_0x528a71);});};AGIVertices[_0xa885('0x11')][_0xa885('0x21')]=function(_0x14eb7e,_0x5d62c2,_0x15f3a){this[_0xa885('0x10')]['sendMailMessage'](_0x14eb7e,_0x5d62c2)[_0xa885('0x14')](function(){_0x15f3a(null);})['catch'](function(_0x24365e){_0x15f3a(_0x24365e);});};AGIVertices[_0xa885('0x11')][_0xa885('0x22')]=function(_0x504091,_0xf34189){this[_0xa885('0xf')][_0xa885('0x23')](_0x504091)['then'](function(_0x40150e){if(_0x40150e){if(_0x40150e[_0xa885('0x24')]){_0xf34189(null,[_0x40150e[_0xa885('0x25')]]);}else{_0xf34189(null,_[_0xa885('0x26')](_0x40150e[_0xa885('0x27')],_0xa885('0x25')));}}else{_0xf34189(null,![]);}})[_0xa885('0x16')](function(_0x457b97){_0xf34189(_0x457b97);});};AGIVertices['prototype']['getSoundPath']=function(_0x1a1379){return util[_0xa885('0x28')](_0xa885('0x29'),FILES_PATH,_0x1a1379);};AGIVertices[_0xa885('0x11')][_0xa885('0x2a')]=function(_0x18d083,_0x404afc,_0x337e55){odbc[_0xa885('0x2b')](_0x18d083,function(_0x5a2a27){if(_0x5a2a27){logger['error'](_0xa885('0x2c'),_0x5a2a27);_0x337e55(_0x5a2a27);}else{logger['info']('ODBC\x20connection\x20successfully');odbc[_0xa885('0x2d')](_0x404afc,function(_0x5e82a6,_0x110f75){if(_0x5e82a6){logger[_0xa885('0x2e')](_0xa885('0x2f'),_0x404afc);_0x337e55(_0x5e82a6);}else{logger[_0xa885('0x2e')](_0xa885('0x30'),_0x404afc);odbc[_0xa885('0x31')](function(_0x113298){if(_0x113298){logger[_0xa885('0x32')](_0xa885('0x33'),_0x113298);}_0x337e55(null,_0x110f75);});}});}});};AGIVertices[_0xa885('0x11')]['getSmsAccount']=function(_0x30759d,_0x4012b3){this[_0xa885('0xf')][_0xa885('0x34')](_0x30759d)[_0xa885('0x14')](function(_0x5e327f){_0x4012b3(null,_0x5e327f?_0x5e327f:![]);})['catch'](function(_0x3afe38){_0x4012b3(_0x3afe38);});};AGIVertices[_0xa885('0x11')][_0xa885('0x35')]=function(_0x2a1e90,_0x1cfe71){this['rpc'][_0xa885('0x35')](_0x2a1e90)[_0xa885('0x14')](function(_0x5dced9){_0x1cfe71(null,_0x5dced9);})['catch'](function(_0x113679){_0x1cfe71(_0x113679);});};AGIVertices[_0xa885('0x11')]['createSquareDetailsReport']=function(_0x561bf0,_0x1089e5,_0x12c35f){this[_0xa885('0xf')][_0xa885('0x36')]({'uniqueid':this[_0xa885('0xe')][_0xa885('0x37')],'node':_0x561bf0[_0xa885('0x38')],'application':_0x561bf0[_0xa885('0x39')],'data':_0x1089e5||null,'project_name':this[_0xa885('0xe')][_0xa885('0x3a')],'callerid':this[_0xa885('0xe')]['callerid']})[_0xa885('0x14')](function(_0x1cf063){if(_0x12c35f){_0x12c35f(null,_0x1cf063);}})[_0xa885('0x16')](function(_0x49c6a7){if(_0x12c35f){_0x12c35f(_0x49c6a7);}});};AGIVertices[_0xa885('0x11')][_0xa885('0x3b')]=function(_0x28d79d,_0x3d19f1,_0x5e33be,_0xdb7929){this['rpc'][_0xa885('0x3b')]({'uniqueid':this[_0xa885('0xe')]['uniqueid'],'callerid':this[_0xa885('0xe')][_0xa885('0x3c')],'calleridname':this[_0xa885('0xe')][_0xa885('0x3d')],'context':this[_0xa885('0xe')]['context'],'extension':this[_0xa885('0xe')][_0xa885('0x3e')],'priority':this[_0xa885('0xe')]['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0xa885('0xe')][_0xa885('0x3f')],'projectName':this[_0xa885('0xe')][_0xa885('0x3a')],'saveName':_0x3d19f1,'filename':_0x28d79d[_0xa885('0x40')]||_0x3d19f1,'savePath':_0x5e33be})[_0xa885('0x14')](function(_0x43245c){_0xdb7929(null,_0x43245c);})[_0xa885('0x16')](function(_0x4397d6){_0xdb7929(_0x4397d6);});};AGIVertices[_0xa885('0x11')][_0xa885('0x41')]=function(_0x560a27,_0x5f4856,_0x5c6840,_0x11a272,_0x289716){this[_0xa885('0xf')][_0xa885('0x41')]({'uniqueid':this[_0xa885('0xe')][_0xa885('0x37')],'body':_0x560a27,'direction':_0x5f4856,'providerName':_0x5c6840,'providerResponse':_0x11a272})[_0xa885('0x14')](function(_0x574641){if(_0x289716){_0x289716(null,_0x574641);}})[_0xa885('0x16')](function(_0x40923e){if(_0x289716){_0x289716(_0x40923e);}});};AGIVertices[_0xa885('0x11')][_0xa885('0x42')]=function(_0x8d9479,_0x1bd3a2){this[_0xa885('0xf')]['createCmContact']({'firstName':_[_0xa885('0x43')](_0x8d9479[_0xa885('0x15')])||_[_0xa885('0x44')](_0x8d9479['name'])?_0xa885('0x45')+Math[_0xa885('0x46')]():_0x8d9479[_0xa885('0x15')],'lastName':_[_0xa885('0x43')](_0x8d9479[_0xa885('0x47')])||_[_0xa885('0x44')](_0x8d9479[_0xa885('0x47')])?null:_0x8d9479[_0xa885('0x47')],'phone':_0x8d9479['phone'],'ListId':_0x8d9479[_0xa885('0x48')],'scheduledat':_0x8d9479[_0xa885('0x49')],'callbackUniqueid':this[_0xa885('0xe')]['uniqueid'],'tags':_0xa885('0x4a'),'description':_0xa885('0x4b')+_0x8d9479[_0xa885('0x49')][_0xa885('0x4c')](),'priority':_0x8d9479[_0xa885('0x4d')]})[_0xa885('0x14')](function(_0x5b78d6){_0x1bd3a2(null,_0x5b78d6);})[_0xa885('0x16')](function(_0x2800e8){_0x1bd3a2(_0x2800e8);});};AGIVertices[_0xa885('0x11')]['getPause']=function(_0x1d555f,_0x251323){this[_0xa885('0xf')][_0xa885('0x4e')](_0x1d555f)[_0xa885('0x14')](function(_0x2ee5eb){_0x251323(null,_0x2ee5eb?_0x2ee5eb[_0xa885('0x15')]:![]);})[_0xa885('0x16')](function(_0x3b7805){_0x251323(_0x3b7805);});};AGIVertices['prototype'][_0xa885('0x4f')]=function(_0x333502,_0x5514bb,_0x4dc788){var _0x1bfacb={'role':_0xa885('0x50')};_0x1bfacb[_0x333502]=this['channel'][_0xa885('0x3c')];this[_0xa885('0xf')][_0xa885('0x4f')](_0x1bfacb,_0x5514bb,this[_0xa885('0xe')][_0xa885('0x37')])[_0xa885('0x14')](function(_0x1101c3){_0x4dc788(null,_['isNil'](_0x1101c3)?![]:!![]);})[_0xa885('0x16')](function(_0x318565){logger['error'](_0x318565);_0x4dc788(null,![]);});};AGIVertices[_0xa885('0x11')]['agentUnpause']=function(_0x117cfe,_0x5698d6){var _0x3f5e8f={'role':_0xa885('0x50')};_0x3f5e8f[_0x117cfe]=this[_0xa885('0xe')][_0xa885('0x3c')];this['rpc'][_0xa885('0x51')](_0x3f5e8f)[_0xa885('0x14')](function(_0x2f89df){_0x5698d6(null,_['isNil'](_0x2f89df)?![]:!![]);})[_0xa885('0x16')](function(_0x564029){logger[_0xa885('0x32')](_0x564029);_0x5698d6(null,![]);});};AGIVertices[_0xa885('0x11')]['agentLogout']=function(_0x108ff1,_0x5e4335){var _0x36c7ba={'role':_0xa885('0x50')};_0x36c7ba[_0x108ff1]=this['channel'][_0xa885('0x3c')];this[_0xa885('0xf')][_0xa885('0x52')](_0x36c7ba)[_0xa885('0x14')](function(_0x4d428a){_0x5e4335(null,_['isNil'](_0x4d428a)?![]:!![]);})[_0xa885('0x16')](function(_0x2c23bd){logger['error'](_0x2c23bd);_0x5e4335(null,![]);});};AGIVertices['prototype'][_0xa885('0x53')]=function(_0x214082,_0xe2c8f7){var _0x262a0c={'role':_0xa885('0x50')};_0x262a0c[_0x214082]=this[_0xa885('0xe')][_0xa885('0x3c')];var _0x257632=_0x214082!=_0xa885('0x54')?util[_0xa885('0x28')](_0xa885('0x55'),'LOCAL',this[_0xa885('0xe')][_0xa885('0x3c')]):undefined;this[_0xa885('0xf')][_0xa885('0x53')](_0x262a0c,_0x257632)[_0xa885('0x14')](function(_0x5cc2cf){_0xe2c8f7(null,_[_0xa885('0x44')](_0x5cc2cf)?![]:!![]);})['catch'](function(_0x5d5fba){logger[_0xa885('0x32')](_0x5d5fba);_0xe2c8f7(null,![]);});};AGIVertices[_0xa885('0x11')]['shellCommand']=function(_0x55813c,_0xed114e){sh[_0xa885('0x56')](_[_0xa885('0x57')](_0x55813c),function(_0x5b5684,_0x56f0ef){var _0x2444f2=_0x56f0ef[_0xa885('0x58')](/(\r\n|\n|\r)/gm,'');_0xed114e(null,_0x2444f2);});};AGIVertices[_0xa885('0x11')][_0xa885('0x59')]=function(_0x5ef85e,_0x313c45){scripts[_0xa885('0x59')](_0x5ef85e[_0xa885('0x5a')],_0x5ef85e['google_cloud_tts_text_type']||'text',_0x5ef85e[_0xa885('0x5b')],_0x5ef85e[_0xa885('0x5c')]||_0xa885('0x5d'),_0x5ef85e['ssmlGender']||_0xa885('0x5e'),_0x5ef85e[_0xa885('0x5f')]||_0xa885('0x60'))[_0xa885('0x14')](function(_0x50c4ad){_0x313c45(null,_0x50c4ad);})[_0xa885('0x16')](function(_0x1d7082){_0x313c45(_0x1d7082);});};AGIVertices['prototype'][_0xa885('0x61')]=function(_0x206b22,_0x5a7bde){scripts[_0xa885('0x61')](_0x206b22['text'],_0x206b22[_0xa885('0x62')]||'en',0x1)[_0xa885('0x14')](function(_0x1cb988){_0x5a7bde(null,_0x1cb988);})[_0xa885('0x16')](function(_0x1195d1){_0x5a7bde(_0x1195d1);});};AGIVertices[_0xa885('0x11')][_0xa885('0x63')]=function(_0x3aa8bc,_0x490d15){var _0x55413d={'uri':_0x3aa8bc[_0xa885('0x64')],'method':_0x3aa8bc[_0xa885('0x65')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x3aa8bc['timeout'])===_0xa885('0x66')&&parseInt(_0x3aa8bc[_0xa885('0x67')])>=0x1?parseInt(_0x3aa8bc['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xa885('0x68')](['POST',_0xa885('0x69')],_0x55413d[_0xa885('0x65')][_0xa885('0x6a')]())){try{_0x55413d[_0xa885('0x6b')]=_0x3aa8bc['rawBody']?JSON['parse'](_0x3aa8bc[_0xa885('0xb')]):{};}catch(_0x2c98e4){logger[_0xa885('0x32')](_0xa885('0x6c'),_0x2c98e4);}}try{_0x55413d[_0xa885('0x6d')]=_0x3aa8bc[_0xa885('0xa')]?JSON[_0xa885('0x6e')](_0x3aa8bc[_0xa885('0xa')]):{};}catch(_0x51e961){logger[_0xa885('0x32')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x51e961);}if(_0x3aa8bc[_0xa885('0x6f')]){try{var _0x39e520=require(_0x3aa8bc[_0xa885('0x6f')])['sync'](this,_0x55413d);_0x55413d[_0xa885('0x70')]=Mustache[_0xa885('0x71')](_0x3aa8bc['url'],_0x39e520,{},['$$','$$']);if(_0x55413d['headers']){_0x55413d[_0xa885('0x6d')]=JSON[_0xa885('0x6e')](Mustache[_0xa885('0x71')](JSON[_0xa885('0x72')](_0x55413d[_0xa885('0x6d')]),_0x39e520,{},['$$','$$']));}if(_0x55413d['body']){_0x55413d['body']=JSON[_0xa885('0x6e')](Mustache[_0xa885('0x71')](JSON[_0xa885('0x72')](_0x55413d[_0xa885('0x6b')]),_0x39e520,{},['$$','$$']));}}catch(_0x56bd37){logger['error']('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x56bd37);}}rp(_0x55413d)[_0xa885('0x14')](function(_0x389008){var _0x3a4342={'statusCode':_0x389008[_0xa885('0x73')]||0xc8,'statusMessage':_0x389008[_0xa885('0x74')]||'OK','headers':_0x389008[_0xa885('0x6d')]||{},'body':_0x389008[_0xa885('0x6b')]||{}};_0x490d15(null,_0x3a4342);})['catch'](function(_0x5b0dc2){var _0x34f6cb={'statusCode':_0x5b0dc2['statusCode']||0x1f4,'statusMessage':_0x5b0dc2[_0xa885('0x75')]||_0xa885('0x76'),'headers':_0x5b0dc2[_0xa885('0x77')][_0xa885('0x6d')]||{},'body':_0x5b0dc2['options'][_0xa885('0x6b')]||{}};_0x490d15(null,_0x34f6cb);});};AGIVertices[_0xa885('0x11')][_0xa885('0x78')]=function(_0x5a6f1f,_0xe5881c){scripts[_0xa885('0x78')](this[_0xa885('0xe')]['uniqueid'],_0x5a6f1f[_0xa885('0x79')],_0x5a6f1f[_0xa885('0x5b')],_0x5a6f1f[_0xa885('0x7a')]||'en')[_0xa885('0x14')](function(_0x3b763e){_0xe5881c(null,_0x3b763e);})[_0xa885('0x16')](function(_0x581ef7){_0xe5881c(_0x581ef7);});};AGIVertices[_0xa885('0x11')][_0xa885('0x7b')]=function(_0x3be76a,_0x1689c8){scripts['googleDialogflowV2'](this[_0xa885('0xe')][_0xa885('0x37')],_0x3be76a[_0xa885('0x7c')],_0x3be76a[_0xa885('0x7d')],_0x3be76a[_0xa885('0x7e')],_0x3be76a[_0xa885('0x5b')],_0x3be76a[_0xa885('0x7f')]||'en')[_0xa885('0x14')](function(_0x4902e6){_0x1689c8(null,_0x4902e6);})[_0xa885('0x16')](function(_0x3dd30f){_0x1689c8(_0x3dd30f);});};AGIVertices['prototype'][_0xa885('0x80')]=function(_0x54faa5,_0x454841){scripts[_0xa885('0x80')](this['channel'],_0x54faa5)[_0xa885('0x14')](function(_0x54f651){_0x454841(null,_0x54f651);})[_0xa885('0x16')](function(_0x5a2122){_0x454841(_0x5a2122);});};AGIVertices[_0xa885('0x11')]['ispeechTTS']=function(_0x20c68b,_0x2119c2){scripts[_0xa885('0x81')](_0x20c68b[_0xa885('0x79')],_0x20c68b['text'],_0x20c68b[_0xa885('0x82')]||_0xa885('0x5d'),_0x20c68b[_0xa885('0x83')])['then'](function(_0x144f1b){_0x2119c2(null,_0x144f1b);})[_0xa885('0x16')](function(_0x7eca56){_0x2119c2(_0x7eca56);});};AGIVertices['prototype'][_0xa885('0x84')]=function(_0x1915bd,_0x534151,_0x59eecb){scripts[_0xa885('0x84')](_0x534151,_0x1915bd[_0xa885('0x79')],_0x1915bd[_0xa885('0x85')]||'en-US',this[_0xa885('0x86')](_0x1915bd[_0xa885('0x87')])?_0x1915bd[_0xa885('0x87')]:undefined)[_0xa885('0x14')](function(_0x4060c0){_0x59eecb(null,_0x4060c0);})[_0xa885('0x16')](function(_0x11b660){_0x59eecb(_0x11b660);});};AGIVertices[_0xa885('0x11')][_0xa885('0x88')]=function(_0x41797f,_0x5ecf82){scripts['awsPolly'](_0x41797f[_0xa885('0x89')],_0x41797f['aws_secret_access_key'],_0x41797f[_0xa885('0x8a')],_0x41797f[_0xa885('0x8b')]||_0xa885('0x8c'),_0x41797f['text'],_0x41797f[_0xa885('0x8d')]||_0xa885('0x5b'))[_0xa885('0x14')](function(_0x203cf4){_0x5ecf82(null,_0x203cf4);})[_0xa885('0x16')](function(_0x74a9){_0x5ecf82(_0x74a9);});};AGIVertices[_0xa885('0x11')]['awsLex']=function(_0x1a32cc,_0x15998b){scripts[_0xa885('0x8e')](this[_0xa885('0xe')]['uniqueid'],_0x1a32cc[_0xa885('0x89')],_0x1a32cc[_0xa885('0x8f')],_0x1a32cc['aws_lex_region'],_0x1a32cc['text'],_0x1a32cc[_0xa885('0x90')])[_0xa885('0x14')](function(_0x2197be){_0x15998b(null,_0x2197be);})[_0xa885('0x16')](function(_0x27478a){_0x15998b(_0x27478a);});};AGIVertices[_0xa885('0x11')][_0xa885('0x91')]=function(_0x28faa6,_0x4b1e4e,_0x39cb1d){scripts['googleASR'](_0x4b1e4e,_0x28faa6[_0xa885('0x79')],_0x28faa6[_0xa885('0x92')]||_0xa885('0x5d'))[_0xa885('0x14')](function(_0x4eed26){_0x39cb1d(null,_0x4eed26);})[_0xa885('0x16')](function(_0x14668d){_0x39cb1d(_0x14668d);});};AGIVertices[_0xa885('0x11')][_0xa885('0x93')]=function(_0x48dbb8,_0x452b87,_0x553556){scripts[_0xa885('0x93')](_0x452b87,_0x48dbb8['appid'],_0x48dbb8[_0xa885('0x94')],_0x48dbb8[_0xa885('0x70')])[_0xa885('0x14')](function(_0x52bb2c){_0x553556(null,_0x52bb2c);})[_0xa885('0x16')](function(_0x223a94){_0x553556(_0x223a94);});};AGIVertices[_0xa885('0x11')][_0xa885('0x95')]=function(_0x9adf59){var _0x19ffd5=_[_0xa885('0x68')](verticesWithRetry,_0x9adf59[_0xa885('0x39')])?_0x9adf59:_[_0xa885('0x96')](_0x9adf59);for(var _0x920fda in _0x19ffd5){if(_0x19ffd5[_0xa885('0x97')](_0x920fda)){if(_0x19ffd5[_0x920fda]&&_[_0xa885('0x98')](_0x19ffd5[_0x920fda])){if(_[_0xa885('0x68')](recursiveMapAttributes,_0x920fda)){_0x19ffd5[_0x920fda]=this[_0xa885('0x99')](_0x19ffd5[_0x920fda]);}else{_0x19ffd5[_0x920fda]=this['replaceAllVariables'](_0x19ffd5[_0x920fda]);}}}}return _0x19ffd5;};AGIVertices[_0xa885('0x11')][_0xa885('0x9a')]=function(_0x2fcca4){for(var _0x15ccce in _0x2fcca4){if(_0x2fcca4['hasOwnProperty'](_0x15ccce)){if(_[_0xa885('0x9b')](_0x2fcca4[_0x15ccce])){this[_0xa885('0x9a')](_0x2fcca4[_0x15ccce]);}else if(_[_0xa885('0x9c')](_0x2fcca4[_0x15ccce])){for(var _0x4142a0=0x0;_0x4142a0<_0x2fcca4[_0x15ccce][_0xa885('0x9d')];_0x4142a0++){this[_0xa885('0x9a')](_0x2fcca4[_0x15ccce][_0x4142a0]);}}else if(_[_0xa885('0x98')](_0x2fcca4[_0x15ccce])){_0x2fcca4[_0x15ccce]=this[_0xa885('0x9e')](_0x2fcca4[_0x15ccce]);}}}};AGIVertices[_0xa885('0x11')]['saveRestApiResult']=function(_0x59f79f,_0x43f8a2){for(var _0x3a2bda in _0x59f79f){if(_0x59f79f[_0xa885('0x97')](_0x3a2bda)){if(_[_0xa885('0x9b')](_0x59f79f[_0x3a2bda])){if(!_[_0xa885('0x43')](_0x59f79f[_0x3a2bda])){this[_0xa885('0x9f')](_0x59f79f[_0x3a2bda],util[_0xa885('0x28')](_0xa885('0xa0'),_0x43f8a2,_0x3a2bda));}}else if(_[_0xa885('0x9c')](_0x59f79f[_0x3a2bda])){for(var _0x2473eb=0x0;_0x2473eb<_0x59f79f[_0x3a2bda][_0xa885('0x9d')];_0x2473eb++){this['saveRestApiResult'](_0x59f79f[_0x3a2bda][_0x2473eb],util[_0xa885('0x28')](_0xa885('0xa0'),_0x43f8a2,_0x3a2bda+'['+_0x2473eb+']'));}}else{if(!_[_0xa885('0x44')](_0x59f79f[_0x3a2bda])){this[_0xa885('0xe')][_0xa885('0xa1')](util['format'](_0xa885('0xa0'),_0x43f8a2,_0x3a2bda),_0x59f79f[_0x3a2bda]);}}}}};AGIVertices[_0xa885('0x11')][_0xa885('0x99')]=function(_0x4a0b1d){try{var _0x2b291d=JSON[_0xa885('0x6e')](_0x4a0b1d);this[_0xa885('0x9a')](_0x2b291d);return JSON[_0xa885('0x72')](_0x2b291d);}catch(_0xeeb6f9){return this[_0xa885('0x9e')](_0x4a0b1d);}};AGIVertices[_0xa885('0x11')]['replaceAllVariables']=function(_0x3a5640){var _0x45908a=_0x3a5640[_0xa885('0xa2')]('{');for(var _0x325225=0x1;_0x325225<_0x45908a['length'];_0x325225+=0x1){var _0x49d544=_0x45908a[_0x325225][_0xa885('0xa2')]('}');if(_0x49d544[_0xa885('0x9d')]>0x1){_0x3a5640=_0x3a5640[_0xa885('0xa3')]('{'+_0x49d544[0x0]+'}',this[_0xa885('0xe')][_0xa885('0x12')](_0x49d544[0x0])['extra']||_0x49d544[0x0]);}}if(_0x45908a[_0xa885('0x9d')]===0x1){return _0x3a5640[_0xa885('0x4c')]();}return this[_0xa885('0x9e')](_0x3a5640);};AGIVertices[_0xa885('0x11')][_0xa885('0xa4')]=function(_0x30005a,_0x5c3fd2){var _0x376274=this['channel']['getVariable'](_0x30005a);if(_0x376274[_0xa885('0xa5')]===-0x1){return _0x376274;}logger['info'](util[_0xa885('0x28')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x5c3fd2,_0x376274[_0xa885('0xa6')]));return this[_0xa885('0xe')][_0xa885('0xa1')](_0x5c3fd2,_0x376274[_0xa885('0xa6')]);};AGIVertices[_0xa885('0x11')][_0xa885('0x86')]=function(_0x323741){return _0x323741&&_0x323741!=='0'&&_0x323741!=='-1'&&_0x323741!=='';};AGIVertices[_0xa885('0x11')][_0xa885('0xa7')]=function(_0x226cf1){this[_0xa885('0x36')]['sync'](this,_0x226cf1,'-');_0x226cf1[_0xa885('0xa8')]=_0x226cf1[_0xa885('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xa885('0x11')]['mrcpsynth']=function(_0x464787){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0xa9'),_0x464787[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x464787['text'])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xab'));}var _0x1a829e='\x22'+_0x464787['text']+'\x22';if(this['isConfigured'](_0x464787[_0xa885('0x77')])){_0x1a829e+=','+_0x464787[_0xa885('0x77')];}var _0x2e7e25=this['channel']['exec'](_0xa885('0xac'),_0x1a829e);if(_0x2e7e25[_0xa885('0xa5')]===-0x1){return _0x2e7e25;}return this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0xad'),_0x1a829e));};AGIVertices[_0xa885('0x11')]['mrcprecog']=function(_0x5cf609){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x5cf609[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x5cf609[_0xa885('0xae')])){return this[_0xa885('0xe')][_0xa885('0xaa')]('no\x20grammar\x20configured');}var _0x5dfa9a=_0x5cf609[_0xa885('0xae')];if(this[_0xa885('0x86')](_0x5cf609['options'])){_0x5dfa9a+=','+_0x5cf609[_0xa885('0x77')];}var _0x3dacf0=this['channel'][_0xa885('0x56')](_0xa885('0xaf'),_0x5dfa9a);if(_0x3dacf0[_0xa885('0xa5')]===-0x1){return _0x3dacf0;}var _0x47e3d7=this[_0xa885('0xa4')](_0xa885('0xb0'),_0xa885('0xb1'));if(_0x47e3d7['result']===-0x1){return _0x47e3d7;}var _0x274f9d=this[_0xa885('0xa4')](_0xa885('0xb2'),'MRCP_RECOG_TRANSCRIPT');if(_0x274f9d[_0xa885('0xa5')]===-0x1){return _0x274f9d;}var _0x2dfcad=this[_0xa885('0xa4')](_0xa885('0xb3'),'MRCP_RECOG_INSTANCE');if(_0x2dfcad['result']===-0x1){return _0x2dfcad;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x5dfa9a));};AGIVertices[_0xa885('0x11')][_0xa885('0x7')]=function(_0x5a4b0c){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0xb4'),_0x5a4b0c[_0xa885('0x38')]));return this[_0xa885('0xe')][_0xa885('0x7')]([_0x5a4b0c[_0xa885('0xb5')],_0x5a4b0c[_0xa885('0xb6')]]);};AGIVertices[_0xa885('0x11')][_0xa885('0xb7')]=function(_0x5664d0){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x5664d0['label']));if(this['isConfigured'](_0x5664d0[_0xa885('0x67')])){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0xb8'),_0x5664d0[_0xa885('0x67')]));var _0x5b4ae6=this[_0xa885('0xe')][_0xa885('0xb9')](_0x5664d0[_0xa885('0x67')]);if(_0x5b4ae6[_0xa885('0xa5')]===-0x1){return _0x5b4ae6;}}return this[_0xa885('0xe')][_0xa885('0xb7')]();};AGIVertices['prototype'][_0xa885('0x4a')]=function(_0x81dbb7){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x81dbb7[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x81dbb7[_0xa885('0x48')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x81dbb7,'no\x20list\x20selected');}_0x81dbb7['scheduledAt']=moment();if(this[_0xa885('0x86')](_0x81dbb7[_0xa885('0xba')])){_0x81dbb7[_0xa885('0x49')]=moment()['add'](_0x81dbb7[_0xa885('0xba')],_0xa885('0xbb'));}if(!this['isConfigured'](_0x81dbb7[_0xa885('0x4d')])){_0x81dbb7['callback_priority']=0x2;}this[_0xa885('0x42')][_0xa885('0xbc')](this,_0x81dbb7);return this[_0xa885('0xe')]['noop'](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x81dbb7[_0xa885('0xbd')],_0x81dbb7[_0xa885('0x48')],_0x81dbb7[_0xa885('0x49')]));};AGIVertices['prototype']['custom_app']=function(_0x3710d7){logger[_0xa885('0x2e')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x3710d7[_0xa885('0x38')]));var _0x1a9c6a=this[_0xa885('0xe')][_0xa885('0x56')](_0x3710d7[_0xa885('0xbe')],_0x3710d7['options']);if(_0x1a9c6a[_0xa885('0xa5')]===-0x1){return _0x1a9c6a;}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xbf'),_0x3710d7[_0xa885('0xbe')],_0x3710d7[_0xa885('0x77')]));};AGIVertices[_0xa885('0x11')][_0xa885('0xc0')]=function(_0x1340b6){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1340b6[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x1340b6[_0xa885('0x5b')])){return this[_0xa885('0xe')][_0xa885('0xaa')]('no\x20text\x20configured');}var _0xcdd785='\x22'+_0x1340b6[_0xa885('0x5b')]+'\x22';if(this['isConfigured'](_0x1340b6['options'])){_0xcdd785+=','+_0x1340b6[_0xa885('0x77')];}var _0x4ea4aa=this[_0xa885('0xe')][_0xa885('0x56')](_0xa885('0xac'),_0xcdd785);if(_0x4ea4aa['result']===-0x1){return _0x4ea4aa;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0xcdd785));};AGIVertices[_0xa885('0x11')][_0xa885('0xc1')]=function(_0x49a24f){logger['info'](util[_0xa885('0x28')](_0xa885('0xc2'),_0x49a24f[_0xa885('0x38')]));if(!this['isConfigured'](_0x49a24f[_0xa885('0x5b')])){return this['channel']['noop'](_0xa885('0xab'));}var _0x1d5f01='\x22'+_0x49a24f[_0xa885('0x5b')]+'\x22';if(this[_0xa885('0x86')](_0x49a24f[_0xa885('0x77')])){_0x1d5f01+=','+_0x49a24f['options'];}var _0x5d888f=this[_0xa885('0xe')]['exec'](_0xa885('0xac'),_0x1d5f01);if(_0x5d888f[_0xa885('0xa5')]===-0x1){return _0x5d888f;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x1d5f01));};AGIVertices[_0xa885('0x11')][_0xa885('0xc3')]=function(_0x4d8913){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0xc4'),_0x4d8913['label']));if(!this[_0xa885('0x86')](_0x4d8913[_0xa885('0xae')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xc5'));}var _0x3a8b87=_0x4d8913[_0xa885('0xae')];if(this['isConfigured'](_0x4d8913[_0xa885('0x77')])){_0x3a8b87+=','+_0x4d8913[_0xa885('0x77')];}var _0x35ebaf=this[_0xa885('0xe')][_0xa885('0x56')](_0xa885('0xaf'),_0x3a8b87);if(_0x35ebaf[_0xa885('0xa5')]===-0x1){return _0x35ebaf;}var _0x5973dd=this[_0xa885('0xa4')](_0xa885('0xb0'),_0xa885('0xc6'));if(_0x5973dd[_0xa885('0xa5')]===-0x1){return _0x5973dd;}var _0xa4a02b=this[_0xa885('0xa4')](_0xa885('0xb2'),_0xa885('0xc7'));if(_0xa4a02b[_0xa885('0xa5')]===-0x1){return _0xa4a02b;}var _0x25017e=this['getAndSetVariable'](_0xa885('0xb3'),'LUMENVOX_ASR_INSTANCE');if(_0x25017e[_0xa885('0xa5')]===-0x1){return _0x25017e;}return this[_0xa885('0xe')][_0xa885('0xaa')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x3a8b87));};AGIVertices[_0xa885('0x11')][_0xa885('0xc8')]=function(_0x128ca3){logger['info'](util[_0xa885('0x28')](_0xa885('0xc9'),_0x128ca3['label']));if(!this[_0xa885('0x86')](_0x128ca3[_0xa885('0xae')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xc5'));}var _0x403c6b=_0x128ca3[_0xa885('0xae')];if(this[_0xa885('0x86')](_0x128ca3[_0xa885('0x77')])){_0x403c6b+=','+_0x128ca3[_0xa885('0x77')];}var _0x5e398a=this['channel'][_0xa885('0x56')](_0xa885('0xaf'),_0x403c6b);if(_0x5e398a['result']===-0x1){return _0x5e398a;}var _0x31f0bd=this[_0xa885('0xa4')](_0xa885('0xb0'),'SESTEK_ASR_CONFIDENCE');if(_0x31f0bd['result']===-0x1){return _0x31f0bd;}var _0x1bd43f=this[_0xa885('0xa4')](_0xa885('0xb2'),_0xa885('0xca'));if(_0x1bd43f[_0xa885('0xa5')]===-0x1){return _0x1bd43f;}var _0x5263ed=this['getAndSetVariable'](_0xa885('0xb3'),_0xa885('0xcb'));if(_0x5263ed[_0xa885('0xa5')]===-0x1){return _0x5263ed;}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xcc'),_0x403c6b));};AGIVertices['prototype'][_0xa885('0xcd')]=function(_0x261673){logger[_0xa885('0x2e')](util['format'](_0xa885('0xce'),_0x261673[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x261673['odbc_id'])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x261673,_0xa885('0xcf'));}var _0x3c4f4b=this[_0xa885('0x19')][_0xa885('0xbc')](this,_0x261673[_0xa885('0xd0')]);if(!_0x3c4f4b){return this[_0xa885('0xe')]['error'](_0x261673,_0xa885('0xd1'));}if(!this[_0xa885('0x86')](_0x261673[_0xa885('0x2d')])){return this[_0xa885('0xe')]['error'](_0x261673,_0xa885('0xd2'));}var _0x38f2a7=_0x261673[_0xa885('0x2d')][_0xa885('0x58')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xd3'),_0x38f2a7));var _0x5de8ce=this['getQueryOdbc'][_0xa885('0xbc')](this,_0x3c4f4b,_0x38f2a7);this[_0xa885('0x36')]['sync'](this,_0x261673,_0x38f2a7);if(!this['isConfigured'](_0x261673[_0xa885('0xd4')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xd5'));}var _0x1b88e9=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x261673['variable_id']);if(!_0x1b88e9){return this[_0xa885('0xe')][_0xa885('0x32')](_0x261673,_0xa885('0xd6'));}var _0x2cc267=this;_0x5de8ce[_0xa885('0xd7')](function(_0x20b580,_0xbf3b76){Object[_0xa885('0xd8')](_0x20b580)[_0xa885('0xd7')](function(_0x53d7cd){_0x2cc267['channel'][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0xd9'),_0x1b88e9,_0xbf3b76,_0x53d7cd),_0x20b580[_0x53d7cd]);});});this['channel'][_0xa885('0xa1')](util['format'](_0xa885('0xda'),_0x1b88e9),_0x5de8ce['length']);return this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0xdb'),_0x1b88e9));};AGIVertices[_0xa885('0x11')][_0xa885('0xdc')]=function(_0x1bfb49){logger[_0xa885('0xdd')](util[_0xa885('0x28')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x1bfb49[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x1bfb49['sip_id'])){return this['channel'][_0xa885('0x32')](_0x1bfb49,_0xa885('0xde'));}var _0x47b3bc=this['getUser'][_0xa885('0xbc')](this,_0x1bfb49[_0xa885('0xdf')]);if(!_0x47b3bc){return this['channel'][_0xa885('0x32')](_0x1bfb49,_0xa885('0xe0'));}var _0x33e5dc=this['channel']['exec']('DIAL',[util[_0xa885('0x28')](_0xa885('0xe1'),_0x47b3bc),_0x1bfb49[_0xa885('0x67')],_0x1bfb49[_0xa885('0xe2')],_0x1bfb49['url']]);if(_0x33e5dc[_0xa885('0xa5')]===-0x1){return _0x33e5dc;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xe3'),'DIAL'));};AGIVertices[_0xa885('0x11')][_0xa885('0xe4')]=function(_0x41da7f){logger['info'](util[_0xa885('0x28')](_0xa885('0xe5'),_0x41da7f[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x41da7f['key'])){return this['channel'][_0xa885('0xaa')](_0xa885('0xe6'));}if(!this[_0xa885('0x86')](_0x41da7f[_0xa885('0x5b')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xab'));}this[_0xa885('0xe')]['bot']=!![];this[_0xa885('0x36')](_0x41da7f);this[_0xa885('0x41')](_0x41da7f['text'],'in','','');this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Trying\x20Dialogflow:\x20%s',_0x41da7f[_0xa885('0x5b')]));var _0x41a9d9=this[_0xa885('0x78')]['sync'](this,_0x41da7f);if(_0x41a9d9){for(var _0x1543e7 in _0x41a9d9){if(_0x41a9d9['hasOwnProperty'](_0x1543e7)){this['channel'][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0xe7'),_0x1543e7[_0xa885('0x6a')]()),_0x41a9d9[_0x1543e7]);}}this[_0xa885('0x41')](_0x41a9d9[_0xa885('0xe8')],_0xa885('0xe9'),_0xa885('0xe4'),'');return this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0xea'),_0x41a9d9['speech']));}return this[_0xa885('0xe')][_0xa885('0x32')](_0x41da7f,_0xa885('0xeb'));};AGIVertices[_0xa885('0x11')][_0xa885('0xec')]=function(_0x163c7e){logger['info'](util[_0xa885('0x28')](_0xa885('0xed'),_0x163c7e['label']));if(!this['isConfigured'](_0x163c7e[_0xa885('0x7c')])){return this[_0xa885('0xe')]['noop']('no\x20project_id\x20configured');}if(!this[_0xa885('0x86')](_0x163c7e['client_email'])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xee'));}if(!this[_0xa885('0x86')](_0x163c7e[_0xa885('0x7e')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xef'));}if(!this[_0xa885('0x86')](_0x163c7e[_0xa885('0x7f')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xf0'));}if(!this[_0xa885('0x86')](_0x163c7e[_0xa885('0x5b')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xab'));}this[_0xa885('0xe')][_0xa885('0xf1')]=!![];this[_0xa885('0x36')](_0x163c7e);this['createSquareMessage'](_0x163c7e[_0xa885('0x5b')],'in','','');this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xf2'),_0x163c7e['text']));var _0x10a6ad=this[_0xa885('0x7b')][_0xa885('0xbc')](this,_0x163c7e);if(_0x10a6ad){for(var _0xc2242e in _0x10a6ad){if(_0x10a6ad[_0xa885('0x97')](_0xc2242e)){if(_0xc2242e!==_0xa885('0xf3')){this[_0xa885('0xe')]['setVariable'](util[_0xa885('0x28')](_0xa885('0xe7'),_0xc2242e[_0xa885('0x6a')]()),_0x10a6ad[_0xc2242e]);}}}this['createSquareMessage'](_0x10a6ad[_0xa885('0xe8')],_0xa885('0xe9'),'dialogflowV2',_0x10a6ad[_0xa885('0xf3')]);return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xf4'),_0x10a6ad[_0xa885('0xe8')]));}return this[_0xa885('0xe')][_0xa885('0x32')](_0x163c7e,_0xa885('0xf5'));};AGIVertices[_0xa885('0x11')]['sesteknda']=function(_0x353284){logger[_0xa885('0x2e')](util['format'](_0xa885('0xf6'),_0x353284[_0xa885('0x38')]));if(!this['isConfigured'](_0x353284[_0xa885('0xf7')])){return this[_0xa885('0xe')]['noop'](_0xa885('0xf8'));}if(!this[_0xa885('0x86')](_0x353284[_0xa885('0xf9')])){return this[_0xa885('0xe')][_0xa885('0xaa')]('no\x20username\x20configured');}if(!this[_0xa885('0x86')](_0x353284['password'])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xfa'));}if(!this[_0xa885('0x86')](_0x353284[_0xa885('0xfb')])){return this['channel'][_0xa885('0xaa')](_0xa885('0xab'));}this[_0xa885('0xe')][_0xa885('0xf1')]=!![];this[_0xa885('0x36')](_0x353284);this[_0xa885('0x41')](_0x353284[_0xa885('0x5b')],'in','','');this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0xfc'),_0x353284['text']));var _0x179430=this[_0xa885('0x80')][_0xa885('0xbc')](this,_0x353284);if(_0x179430){for(var _0x439c48 in _0x179430){if(_0x179430[_0xa885('0x97')](_0x439c48)){this[_0xa885('0xe')]['setVariable'](util['format'](_0xa885('0xfd'),_0x439c48[_0xa885('0x6a')]()),_0x179430[_0x439c48]);}}this[_0xa885('0x41')](_0x179430[_0xa885('0xe8')],_0xa885('0xe9'),_0xa885('0xfe'),'');if(_0x179430[_0xa885('0xff')]){this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x179430[_0xa885('0xff')]));var _0x1fd0e4=this['channel'][_0xa885('0x100')](_0x179430['audiofile']);try{fs[_0xa885('0x101')](_0x179430[_0xa885('0xff')]+'.wav');}catch(_0x2128f6){logger[_0xa885('0x32')](_0x2128f6);}return _0x1fd0e4;}else{return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x102'),_0x179430[_0xa885('0xe8')]));}}return this[_0xa885('0xe')][_0xa885('0x32')](_0x353284,_0xa885('0x103'));};AGIVertices[_0xa885('0x11')]['end']=function(_0x2f91cc){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x104'),_0x2f91cc[_0xa885('0x38')]));return this['channel'][_0xa885('0xaa')]('end');};AGIVertices[_0xa885('0x11')]['ext_dial']=function(_0x482fc1){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x105'),_0x482fc1[_0xa885('0x38')]));var _0x45fcfd='';if(_0x482fc1[_0xa885('0x106')]){if(!this[_0xa885('0x86')](_0x482fc1['trunk_id'])){return this['channel'][_0xa885('0x32')](_0x482fc1,_0xa885('0x107'));}else{var _0x4ef239=parseInt(_0x482fc1[_0xa885('0x106')],0xa);if(isNaN(_0x4ef239)){_0x45fcfd=_0x482fc1[_0xa885('0x106')];}else{_0x45fcfd=this['getTrunk'][_0xa885('0xbc')](this,_0x482fc1['trunk_id']);if(!_0x45fcfd){return this[_0xa885('0xe')][_0xa885('0x32')](_0x482fc1,'no\x20trunk\x20found');}}}}else if(_0x482fc1[_0xa885('0x108')]){_0x45fcfd=_0x482fc1[_0xa885('0x108')];}else{return this[_0xa885('0xe')][_0xa885('0x32')](_0x482fc1,'no\x20trunk\x20selected');}var _0x4fd90a=this[_0xa885('0xe')][_0xa885('0x56')]('DIAL',[util[_0xa885('0x28')]('SIP/%s/%s',_0x45fcfd,_0x482fc1['phone']),_0x482fc1[_0xa885('0x67')],_0x482fc1[_0xa885('0xe2')],_0x482fc1[_0xa885('0x64')]]);if(_0x4fd90a['result']===-0x1){return _0x4fd90a;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xe3'),_0xa885('0x109')));};AGIVertices[_0xa885('0x11')][_0xa885('0x10a')]=function(_0x1a9544){logger[_0xa885('0x2e')](util['format'](_0xa885('0x10b'),_0x1a9544[_0xa885('0x38')]));return this['channel'][_0xa885('0xaa')]('finally');};AGIVertices[_0xa885('0x11')][_0xa885('0x10c')]=function(_0x9c2cba){logger['info'](util[_0xa885('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x9c2cba[_0xa885('0x38')]));if(_0x9c2cba[_0xa885('0xa8')]===0x0){return this[_0xa885('0xa7')](_0x9c2cba);}_0x9c2cba[_0xa885('0xa8')]-=0x1;if(!this[_0xa885('0x86')](_0x9c2cba['file_id'])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x9c2cba,_0xa885('0x10d'));}var _0x150c2e=this[_0xa885('0x1e')][_0xa885('0xbc')](this,_0x9c2cba[_0xa885('0x10e')]);if(!_0x150c2e){return this['channel']['error'](_0x9c2cba,_0xa885('0x10f'));}if(!this[_0xa885('0x86')](_0x9c2cba['variable_id'])){return this[_0xa885('0xe')][_0xa885('0x32')](_0xa885('0xd5'));}var _0x340206=this['channel'][_0xa885('0x110')](_0x150c2e,_0x9c2cba['response'],_0x9c2cba[_0xa885('0x111')]);var _0xfb4761=_0x340206[_0xa885('0xa5')]?_0x340206['result'][_0xa885('0x4c')]():'';logger[_0xa885('0x2e')](_0xa885('0x112'),JSON['stringify'](_0x340206));if(_0x340206[_0xa885('0xa5')]===-0x1){this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x9c2cba,_0xfb4761);return _0x340206;}else if(_0x340206['extra']===_0xa885('0x67')){_0x340206[_0xa885('0xa5')]=_0xfb4761[_0xa885('0x9d')]>=parseInt(_0x9c2cba['mindigit'])?'x':'i';}else{_0x340206[_0xa885('0xa5')]=_0xfb4761[_0xa885('0x9d')]>=parseInt(_0x9c2cba['mindigit'])&&_0xfb4761[_0xa885('0x9d')]<=parseInt(_0x9c2cba[_0xa885('0x111')])?'x':'i';}var _0x47c35b=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x9c2cba[_0xa885('0xd4')]);if(!_0x47c35b){return this[_0xa885('0xe')][_0xa885('0x32')](_0x9c2cba,'no\x20variable\x20found');}this[_0xa885('0xe')]['setVariable'](_0x47c35b,_0xfb4761);if(this[_0xa885('0x86')](_0x9c2cba[_0xa885('0x113')])){var _0x5450ab=parseInt(_0x9c2cba['hiddendigitsnum'],0xa);var _0x13d60d=rs[_0xa885('0x114')]({'charset':'*','length':_0x5450ab});var _0xd72c6a=_0xfb4761[_0xa885('0x9d')];if(_0xd72c6a>0x0){if(_0xd72c6a>_0x5450ab){this[_0xa885('0x36')]['sync'](this,_0x9c2cba,_0x9c2cba[_0xa885('0x115')]==='first'?_0x13d60d+_0xfb4761[_0xa885('0x116')](_0x5450ab):_0xfb4761[_0xa885('0x116')](0x0,_0xd72c6a-_0x5450ab)+_0x13d60d);}else{this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x9c2cba,rs[_0xa885('0x114')]({'charset':'*','length':_0xd72c6a}));}}else{this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x9c2cba,'');}}else{this['createSquareDetailsReport'][_0xa885('0xbc')](this,_0x9c2cba,_0xfb4761);}return _0x340206;};AGIVertices[_0xa885('0x11')][_0xa885('0xd')]=function(_0x554539){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x117'),_0x554539[_0xa885('0x38')]));return this[_0xa885('0x10c')](_0x554539);};AGIVertices[_0xa885('0x11')][_0xa885('0x118')]=function(_0x24fb3c){logger['info'](util[_0xa885('0x28')](_0xa885('0x119'),_0x24fb3c[_0xa885('0x38')]));this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x24fb3c,_0x24fb3c['goalname']);return this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x11a'),_0x24fb3c[_0xa885('0x11b')]));};AGIVertices[_0xa885('0x11')][_0xa885('0x11c')]=function(_0x326213){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x11d'),_0x326213['label']));if(!this[_0xa885('0x86')](_0x326213[_0xa885('0x89')])||!this[_0xa885('0x86')](_0x326213[_0xa885('0x8f')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x11e'));}if(!this['isConfigured'](_0x326213['text'])){return this['channel'][_0xa885('0xaa')]('no\x20text\x20configured');}this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x11f'),_0x326213[_0xa885('0x5b')]));var _0x1f96c9=this['awsPolly']['sync'](this,_0x326213);if(_0x1f96c9){this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x1f96c9));var _0x439113=this[_0xa885('0xe')][_0xa885('0x100')](_0x1f96c9);try{fs['unlink'](_0x1f96c9+_0xa885('0x120'));}catch(_0x194401){logger['error'](_0x194401);}return _0x439113;}return this[_0xa885('0xe')][_0xa885('0x32')](_0x326213,_0xa885('0x121'));};AGIVertices[_0xa885('0x11')]['awslex']=function(_0x226b6e){logger['info'](util[_0xa885('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x226b6e[_0xa885('0x38')]));if(!this['isConfigured'](_0x226b6e[_0xa885('0x89')])||!this[_0xa885('0x86')](_0x226b6e[_0xa885('0x8f')])){return this[_0xa885('0xe')]['noop']('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x226b6e[_0xa885('0x90')])){return this[_0xa885('0xe')]['noop'](_0xa885('0x122'));}if(!this[_0xa885('0x86')](_0x226b6e[_0xa885('0x5b')])){return this[_0xa885('0xe')]['noop'](_0xa885('0xab'));}this[_0xa885('0xe')][_0xa885('0xf1')]=!![];this[_0xa885('0x36')](_0x226b6e);this[_0xa885('0x41')](_0x226b6e[_0xa885('0x5b')],'in','','');this[_0xa885('0xe')]['noop'](util['format'](_0xa885('0x123'),_0x226b6e[_0xa885('0x5b')]));var _0x2cd69b=this['awsLex'][_0xa885('0xbc')](this,_0x226b6e);if(_0x2cd69b){for(var _0x2db613 in _0x2cd69b){if(_0x2cd69b[_0xa885('0x97')](_0x2db613)&&_[_0xa885('0x98')](_0x2cd69b[_0x2db613])){this['channel'][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0x124'),_0x2db613[_0xa885('0x6a')]()),_0x2cd69b[_0x2db613]);}}if(_['isNil'](_0x2cd69b[_0xa885('0x75')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x125'));}else{this[_0xa885('0x41')](_0x2cd69b[_0xa885('0x75')],'out',_0xa885('0x126'),'');return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x127'),_0x2cd69b[_0xa885('0x75')]));}}return this[_0xa885('0xe')][_0xa885('0x32')](_0x226b6e,_0xa885('0x128'));};AGIVertices[_0xa885('0x11')][_0xa885('0x129')]=function(_0x5931f3){logger[_0xa885('0x2e')](util['format'](_0xa885('0x12a'),_0x5931f3[_0xa885('0x38')],_0x5931f3[_0xa885('0x67')]));if(!this[_0xa885('0x86')](_0x5931f3[_0xa885('0x79')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0xe6'));}var _0x4a319d=_0xa885('0x12b');var _0xc92468=util[_0xa885('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0xa885('0x114')](0x4));var _0x169b34=util[_0xa885('0x28')](_0xa885('0xa0'),_0xc92468,_0x4a319d);var _0x207855=!![];if(_0x5931f3[_0xa885('0x12c')]===_0xa885('0x12d')){_0x207855=![];}var _0x302950=this[_0xa885('0xe')]['recordFile'](_0xc92468,_0x4a319d,_0x5931f3['intKey'],_0x5931f3['timeout'],undefined,_0x207855);if(_0x302950[_0xa885('0xa5')]!==-0x1){this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0x12e'),_0x169b34));var _0x218f90=this['googleASR'][_0xa885('0xbc')](this,_0x5931f3,_0x169b34);if(_0x218f90){for(var _0x4bb25e in _0x218f90){if(_0x218f90[_0xa885('0x97')](_0x4bb25e)){this['channel']['setVariable'](util[_0xa885('0x28')](_0xa885('0x12f'),_0x4bb25e['toUpperCase']()),_0x218f90[_0x4bb25e]);}}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x130'),JSON[_0xa885('0x72')](_0x218f90)));}}return _0x302950;};AGIVertices[_0xa885('0x11')][_0xa885('0x131')]=function(_0x1ed1bb){logger['info'](util[_0xa885('0x28')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x1ed1bb['label']));if(!this[_0xa885('0x86')](_0x1ed1bb[_0xa885('0x132')])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x133'));}if(!this[_0xa885('0x86')](_0x1ed1bb[_0xa885('0x94')])){return this['channel']['noop'](_0xa885('0x134'));}var _0x2014ae=_0xa885('0x12b');var _0x400d9d=util[_0xa885('0x28')](_0xa885('0x135'),FILES_PATH,rs['generate'](0x4));var _0x56c0b2=util[_0xa885('0x28')](_0xa885('0xa0'),_0x400d9d,_0x2014ae);var _0x2a2464=!![];if(_0x1ed1bb[_0xa885('0x12c')]===_0xa885('0x12d')){_0x2a2464=![];}var _0x311bff=this[_0xa885('0xe')][_0xa885('0x136')](_0x400d9d,_0x2014ae,_0x1ed1bb[_0xa885('0x137')],_0x1ed1bb['timeout'],undefined,_0x2a2464);if(_0x311bff[_0xa885('0xa5')]!==-0x1){this['channel']['noop'](util['format'](_0xa885('0x138'),_0x56c0b2));var _0x3defe3=this[_0xa885('0x93')][_0xa885('0xbc')](this,_0x1ed1bb,_0x56c0b2);if(_0x3defe3){for(var _0x3851ed in _0x3defe3){if(_0x3defe3[_0xa885('0x97')](_0x3851ed)){this[_0xa885('0xe')][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0x139'),_0x3851ed[_0xa885('0x6a')]()),_0x3defe3[_0x3851ed]);}}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x13a'),JSON[_0xa885('0x72')](_0x3defe3)));}}return _0x311bff;};AGIVertices[_0xa885('0x11')][_0xa885('0x13b')]=function(_0x1578bd){logger[_0xa885('0x2e')](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x1578bd['label']));return this['channel'][_0xa885('0x13c')](_0x1578bd[_0xa885('0x13d')],_0x1578bd['extension'],_0x1578bd[_0xa885('0x13e')]);};AGIVertices[_0xa885('0x11')][_0xa885('0x13f')]=function(_0x433aea){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x140'),_0x433aea[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x433aea['condition'])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x433aea,_0xa885('0x141'));}try{var _0x450c36=eval(_0x433aea['condition'])?_0xa885('0x142'):_0xa885('0x143');this['channel'][_0xa885('0xaa')](util['format'](_0xa885('0x144'),_0x433aea[_0xa885('0x145')],_0x450c36));return{'code':0xc8,'result':_0x450c36};}catch(_0x47bacc){return{'code':0xc8,'result':_0xa885('0x143')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x146')]=function(_0x164651){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x147'),_0x164651['label']));if(!this[_0xa885('0x86')](_0x164651['interval_id'])){return this['channel']['error'](_0x164651,_0xa885('0x148'));}var _0x576d4e=this[_0xa885('0x22')][_0xa885('0xbc')](this,_0x164651['interval_id']);if(!_0x576d4e){return this[_0xa885('0xe')]['error'](_0x164651,'no\x20intervals\x20found');}for(var _0x5f5561=0x0;_0x5f5561<_0x576d4e[_0xa885('0x9d')];_0x5f5561+=0x1){var _0x1869b1=this[_0xa885('0xe')][_0xa885('0x12')](util[_0xa885('0x28')](_0xa885('0x149'),_0x576d4e[_0x5f5561]));if(_0x1869b1['result']===-0x1){return _0x1869b1;}logger['info'](util['format'](_0xa885('0x14a'),_0x576d4e[_0x5f5561],_0x1869b1['extra']));if(_0x1869b1[_0xa885('0xa6')]===_0xa885('0x142')){logger[_0xa885('0x2e')](util['format'](_0xa885('0x14a'),_0x576d4e[_0x5f5561],_0xa885('0x142')));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('IFTIME\x20%s\x20%s',_0x576d4e[_0x5f5561],_0xa885('0x142')));return{'code':0xc8,'result':_0xa885('0x142')};}else{logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x14a'),_0x576d4e[_0x5f5561],'false'));this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')]('IFTIME\x20%s\x20%s',_0x576d4e[_0x5f5561],_0xa885('0x143')));}}return{'code':0xc8,'result':_0xa885('0x143')};};AGIVertices[_0xa885('0x11')]['hangup']=function(_0xa0e024){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0xa0e024[_0xa885('0x38')]));return this['channel']['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x3e9ae9){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x14b'),_0x3e9ae9[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x3e9ae9[_0xa885('0x79')])){return this['channel']['noop'](_0xa885('0xe6'));}var _0x5dae57=_0xa885('0x12b');var _0x11b6cd=util['format'](_0xa885('0x135'),FILES_PATH,rs[_0xa885('0x114')](0x4));var _0x3372a0=util[_0xa885('0x28')](_0xa885('0xa0'),_0x11b6cd,_0x5dae57);var _0x4d21ac=!![];if(_0x3e9ae9[_0xa885('0x12c')]===_0xa885('0x12d')){_0x4d21ac=![];}var _0x39539d=this[_0xa885('0xe')]['recordFile'](_0x11b6cd,_0x5dae57,_0x3e9ae9[_0xa885('0x137')],_0x3e9ae9[_0xa885('0x67')],undefined,_0x4d21ac);if(_0x39539d['result']!==-0x1){this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x14c'),_0x3372a0));var _0x1b3c66=this[_0xa885('0x84')]['sync'](this,_0x3e9ae9,_0x3372a0);if(_0x1b3c66){for(var _0x120d96 in _0x1b3c66){if(_0x1b3c66[_0xa885('0x97')](_0x120d96)){this['channel'][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0x14d'),_0x120d96[_0xa885('0x6a')]()),_0x1b3c66[_0x120d96]);}}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x14e'),JSON[_0xa885('0x72')](_0x1b3c66)));}}return _0x39539d;};AGIVertices['prototype']['ispeechtts']=function(_0x1fadfe){logger['info'](util[_0xa885('0x28')](_0xa885('0x14f'),_0x1fadfe[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x1fadfe['key'])){return this[_0xa885('0xe')][_0xa885('0xaa')]('no\x20key\x20configured');}if(!this[_0xa885('0x86')](_0x1fadfe['text'])){return this[_0xa885('0xe')]['noop'](_0xa885('0xab'));}this[_0xa885('0xe')]['noop'](util['format'](_0xa885('0x150'),_0x1fadfe[_0xa885('0x5b')]));var _0x35f504=this[_0xa885('0x81')][_0xa885('0xbc')](this,_0x1fadfe);if(_0x35f504){this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x14c'),_0x35f504));var _0x49a98f=this['channel'][_0xa885('0x100')](_0x35f504,_0x1fadfe['intKey']);try{fs['unlink'](_0x35f504+_0xa885('0x120'));}catch(_0x25f341){logger[_0xa885('0x32')](_0x25f341);}return _0x49a98f;}return this[_0xa885('0xe')][_0xa885('0x32')](_0x1fadfe,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0xa885('0x11')]['login']=function(_0x223916){logger['info'](util[_0xa885('0x28')](_0xa885('0x151'),_0x223916[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x223916[_0xa885('0x152')])){return this['channel'][_0xa885('0x32')](_0x223916,'no\x20find\x20by\x20configured');}logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x153'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x223916['findBy']));var _0x55440b=this[_0xa885('0x53')]['sync'](this,_0x223916[_0xa885('0x152')]);if(_0x55440b){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xa885('0xe')][_0xa885('0x3c')],_0x223916['findBy']));this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x154'),this['channel'][_0xa885('0x3c')],_0x223916[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x155')};}else{logger['info'](util[_0xa885('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa885('0xe')][_0xa885('0x3c')],_0x223916['findBy']));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x156'),this['channel']['callerid'],_0x223916[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x157')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x158')]=function(_0x376a9e){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x159'),_0x376a9e[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x376a9e[_0xa885('0x152')])){return this['channel']['error'](_0x376a9e,_0xa885('0x15a'));}logger['info'](util[_0xa885('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xa885('0xe')][_0xa885('0x3c')],_0x376a9e[_0xa885('0x152')]));var _0x4d3474=this[_0xa885('0x52')]['sync'](this,_0x376a9e[_0xa885('0x152')]);if(_0x4d3474){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x154'),this['channel'][_0xa885('0x3c')],_0x376a9e[_0xa885('0x152')]));this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x376a9e[_0xa885('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa885('0x2e')](util[_0xa885('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa885('0xe')][_0xa885('0x3c')],_0x376a9e[_0xa885('0x152')]));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x156'),this[_0xa885('0xe')]['callerid'],_0x376a9e[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x157')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x15b')]=function(_0x4fddc4){logger['info'](util[_0xa885('0x28')](_0xa885('0x15c'),_0x4fddc4['label']));if(!this['isConfigured'](_0x4fddc4[_0xa885('0x15d')])){return this['channel'][_0xa885('0x32')](_0x4fddc4,_0xa885('0x15e'));}this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x15f'),_0x4fddc4['operation']));var _0xce578b=eval(_0x4fddc4[_0xa885('0x15d')]);if(!this[_0xa885('0x86')](_0x4fddc4[_0xa885('0xd4')])){return this['channel'][_0xa885('0xaa')](_0xa885('0xd5'));}var _0x3c95f9=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x4fddc4['variable_id']);if(!_0x3c95f9){return this['channel'][_0xa885('0x32')](_0x4fddc4,'no\x20variable\x20found');}if(_[_0xa885('0x9c')](_0xce578b)){var _0x45143a=this;_0xce578b[_0xa885('0xd7')](function(_0xc825d4,_0x2e2775){_0x45143a[_0xa885('0xe')]['setVariable'](util[_0xa885('0x28')](_0xa885('0x160'),_0x3c95f9,_0x2e2775),_0xc825d4);});return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x161'),_0x3c95f9));}else{return this['channel'][_0xa885('0xa1')](_0x3c95f9,_0xce578b);}};AGIVertices[_0xa885('0x11')][_0xa885('0xc')]=function(_0x19332c){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x162'),_0x19332c['label']));if(_0x19332c[_0xa885('0xa8')]===0x0){return this[_0xa885('0xa7')](_0x19332c);}_0x19332c[_0xa885('0xa8')]-=0x1;if(!this[_0xa885('0x86')](_0x19332c[_0xa885('0x10e')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x19332c,_0xa885('0x10d'));}var _0x204939=this['getSound']['sync'](this,_0x19332c[_0xa885('0x10e')]);if(!_0x204939){return this[_0xa885('0xe')][_0xa885('0x32')](_0x19332c,_0xa885('0x10f'));}var _0x3d34ae=this[_0xa885('0xe')][_0xa885('0x110')](_0x204939,_0x19332c[_0xa885('0x163')],_0x19332c[_0xa885('0x164')]);var _0x36b7e4=_0x3d34ae[_0xa885('0xa5')];if(_0x3d34ae['result']===-0x1){this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x19332c,'-1');return _0x3d34ae;}else if(_0x3d34ae[_0xa885('0xa6')]===_0xa885('0x67')){_0x3d34ae['result']=_0x3d34ae[_0xa885('0xa5')][_0xa885('0x9d')]>0x0?_0x3d34ae[_0xa885('0xa5')]:'t';}else if(_['isEmpty'](_0x3d34ae[_0xa885('0xa5')])){_0x3d34ae[_0xa885('0xa5')]='#';_0x36b7e4='#';}if(!this[_0xa885('0x86')](_0x19332c[_0xa885('0xd4')])){this['channel'][_0xa885('0xaa')](_0xa885('0xd5'));}else{var _0x134098=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x19332c[_0xa885('0xd4')]);if(!_0x134098){return this[_0xa885('0xe')][_0xa885('0x32')](_0x19332c,'no\x20variable\x20found');}this[_0xa885('0xe')][_0xa885('0xa1')](_0x134098,_0x36b7e4);}this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x19332c,_0x36b7e4);return _0x3d34ae;};AGIVertices['prototype'][_0xa885('0xaa')]=function(_0xd6fac2){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0xd6fac2['label']));return this[_0xa885('0xe')][_0xa885('0xaa')](_0xd6fac2[_0xa885('0x165')]||_0xd6fac2[_0xa885('0x38')]);};AGIVertices[_0xa885('0x11')][_0xa885('0x166')]=function(_0x206881){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x167'),_0x206881[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x206881[_0xa885('0x152')])){return this[_0xa885('0xe')]['error'](_0x206881,_0xa885('0x15a'));}logger[_0xa885('0x2e')](util['format'](_0xa885('0x153'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x206881['findBy']));var _0x584e1e=this['getPause'][_0xa885('0xbc')](this,_0x206881[_0xa885('0x168')]);var _0x3efcba=this[_0xa885('0x4f')]['sync'](this,_0x206881[_0xa885('0x152')],_0x584e1e);if(_0x3efcba){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x206881[_0xa885('0x152')]));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x154'),this['channel']['callerid'],_0x206881[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x155')};}else{logger['info'](util[_0xa885('0x28')](_0xa885('0x156'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x206881[_0xa885('0x152')]));this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x206881[_0xa885('0x152')]));return{'code':0xc8,'result':_0xa885('0x157')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x169')]=function(_0x228210){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x16a'),_0x228210[_0xa885('0x38')]));if(!this['isConfigured'](_0x228210[_0xa885('0x10e')])){return this['channel'][_0xa885('0x32')](_0x228210,'no\x20file\x20audio\x20selected');}var _0x13fcc4=this[_0xa885('0x1e')][_0xa885('0xbc')](this,_0x228210['file_id']);if(!_0x13fcc4){return this['channel']['error'](_0x228210,_0xa885('0x10f'));}var _0x3791a9=this[_0xa885('0xe')]['exec']('PLAYBACK',[_0x13fcc4,_0x228210[_0xa885('0xe2')]]);if(_0x3791a9[_0xa885('0xa5')]===-0x1){return _0x3791a9;}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x13fcc4));};AGIVertices[_0xa885('0x11')][_0xa885('0x16b')]=function(_0x597325){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x16c'),_0x597325[_0xa885('0x38')]));if(!this['isConfigured'](_0x597325[_0xa885('0x16d')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x597325,'no\x20queue\x20selected');}var _0x48d2ff='';var _0x175aee=parseInt(_0x597325['queue_id'],0xa);if(isNaN(_0x175aee)){_0x48d2ff=_0x597325['queue_id'];}else{_0x48d2ff=this[_0xa885('0x16e')]['sync'](this,_0x597325[_0xa885('0x16d')]);if(!_0x48d2ff){return this[_0xa885('0xe')][_0xa885('0x32')](_0x597325,'no\x20queue\x20found');}}var _0x5642dc='';if(this[_0xa885('0x86')](_0x597325[_0xa885('0x10e')])){var _0x24ac56=this[_0xa885('0x1e')][_0xa885('0xbc')](this,_0x597325[_0xa885('0x10e')]);if(_0x24ac56){_0x5642dc=_0x24ac56;}}this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x597325,_0x48d2ff);if(_0x597325[_0xa885('0xe2')][_0xa885('0x16f')]('x')<0x0){_0x597325[_0xa885('0xe2')]+='x';}if(_0x597325['opts']['indexOf']('X')<0x0){_0x597325['opts']+='X';}this[_0xa885('0xe')]['setVariable']('XMCS-QUEUE',_0x48d2ff?_0x48d2ff[_0xa885('0x170')]():'');var _0x524465=this[_0xa885('0xe')][_0xa885('0x56')]('QUEUE',[_0x48d2ff,_0x597325[_0xa885('0xe2')],_0x597325['url'],_0x5642dc,_0x597325['timeout'],_0x597325['agi'],_0x597325[_0xa885('0x171')],_0x597325[_0xa885('0x172')],'',_0x597325[_0xa885('0x173')]]);if(_0x524465[_0xa885('0xa5')]===-0x1){return _0x524465;}return this['channel'][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xbf'),_0xa885('0x174'),_0x48d2ff));};AGIVertices[_0xa885('0x11')]['record']=function(_0x16d6fd){logger[_0xa885('0x2e')](util['format'](_0xa885('0x175'),_0x16d6fd[_0xa885('0x38')]));var _0x4ce84f=_0x16d6fd[_0xa885('0x176')]||_0xa885('0x12b');var _0x30fb34=util[_0xa885('0x28')]('%s_%s',this[_0xa885('0xe')][_0xa885('0x37')],rs[_0xa885('0x114')](0x5));var _0x14bca3=util[_0xa885('0x28')](_0xa885('0x177'),FILES_PATH,_0x30fb34,_0x4ce84f);var _0x19e05a=util[_0xa885('0x28')](_0xa885('0x135'),FILES_PATH,_0x30fb34);this[_0xa885('0x3b')]['sync'](this,_0x16d6fd,_0x30fb34,_0x14bca3);this[_0xa885('0xe')][_0xa885('0xa1')](_0xa885('0x178'),_0x30fb34);logger['info'](_0xa885('0x179'),_0x19e05a,_0x4ce84f,_0x16d6fd[_0xa885('0x17a')],_0x16d6fd[_0xa885('0x67')]);return this[_0xa885('0xe')][_0xa885('0x136')](_0x19e05a,_0x4ce84f,_0x16d6fd[_0xa885('0x17a')],_0x16d6fd[_0xa885('0x67')],undefined,!![]);};AGIVertices[_0xa885('0x11')][_0xa885('0x17b')]=function(_0x2dcfcc){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x17c'),_0x2dcfcc[_0xa885('0x38')]));if(!this['isConfigured'](_0x2dcfcc[_0xa885('0x64')])){return this[_0xa885('0xe')]['noop'](_0xa885('0x17d'));}var _0x168da3=this[_0xa885('0x63')][_0xa885('0xbc')](this,_0x2dcfcc);logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Response:',util[_0xa885('0x17e')](_0x168da3,{'showHidden':![],'depth':null})));if(!this[_0xa885('0x86')](_0x2dcfcc[_0xa885('0xd4')])){return this[_0xa885('0xe')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x262842=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x2dcfcc[_0xa885('0xd4')]);if(!_0x262842){return this[_0xa885('0xe')][_0xa885('0x32')](_0x2dcfcc,_0xa885('0xd6'));}this[_0xa885('0xe')]['setVariable'](util[_0xa885('0x28')](_0xa885('0x17f'),_0x262842),_0x168da3[_0xa885('0x73')]?_0x168da3['statusCode']:_0xa885('0x180'));this[_0xa885('0xe')][_0xa885('0xa1')](util[_0xa885('0x28')](_0xa885('0x181'),_0x262842),_0x168da3[_0xa885('0x74')]?_0x168da3[_0xa885('0x74')]:'OK');if(_0x168da3[_0xa885('0x6b')]){try{this[_0xa885('0x9f')](_0x168da3['body'],_0x262842);}catch(_0x4b31e7){logger[_0xa885('0x32')](util[_0xa885('0x28')](_0xa885('0x182'),_0x262842));}}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('variable\x20%s\x20set',_0x262842));};AGIVertices['prototype']['saydigits']=function(_0x2d19e0){logger['info'](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x2d19e0[_0xa885('0x38')]));return this[_0xa885('0xe')][_0xa885('0x183')](_0x2d19e0['digits'][_0xa885('0x58')](/\s+/g,''),_0x2d19e0[_0xa885('0x17a')]);};AGIVertices[_0xa885('0x11')]['saynumber']=function(_0x32f562){logger[_0xa885('0x2e')](util['format'](_0xa885('0x184'),_0x32f562['label']));return this['channel'][_0xa885('0x185')](_0x32f562[_0xa885('0x66')]['replace'](/\s+/g,''),_0x32f562[_0xa885('0x17a')]);};AGIVertices['prototype'][_0xa885('0x186')]=function(_0x34776b){logger['info'](util[_0xa885('0x28')]('Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block',_0x34776b[_0xa885('0x38')]));return this[_0xa885('0xe')][_0xa885('0x187')](_0x34776b[_0xa885('0x5b')],_0x34776b[_0xa885('0x17a')]);};AGIVertices[_0xa885('0x11')]['sendMail']=function(_0x11feac){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x11feac[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x11feac['account_id'])){return this[_0xa885('0xe')]['noop'](_0xa885('0x188'));}var _0x507050=this[_0xa885('0x20')][_0xa885('0xbc')](this,_0x11feac[_0xa885('0x189')]);if(!_0x507050||!_0x507050[_0xa885('0x18a')]){return this[_0xa885('0xe')][_0xa885('0x32')](_0x11feac,_0xa885('0x18b'));}var _0x2f5acb={'from':util[_0xa885('0x28')]('\x22%s\x22\x20<%s>',_0x507050[_0xa885('0x15')],_0x507050['email']||_0x507050[_0xa885('0x18a')][_0xa885('0x18c')]),'to':_0x11feac['to']||'','cc':_0x11feac['cc']||'','bcc':_0x11feac[_0xa885('0x18d')]||'','subject':_0x11feac[_0xa885('0x18e')],'html':_0x11feac[_0xa885('0x5b')],'text':_0x11feac[_0xa885('0x5b')]};if(this[_0xa885('0x86')](_0x11feac['template_id'])){}logger['debug'](_0xa885('0x18f'),JSON[_0xa885('0x72')](_0x2f5acb));this[_0xa885('0x36')][_0xa885('0xbc')](this,_0x11feac,_0x11feac['account_id']);this[_0xa885('0xe')]['noop'](util['format'](_0xa885('0x190'),_0x507050['name']));this[_0xa885('0x21')][_0xa885('0xbc')](this,_0x507050[_0xa885('0x191')],_0x2f5acb);return this['channel'][_0xa885('0xaa')](_0xa885('0x192'));};AGIVertices['prototype'][_0xa885('0x193')]=function(_0x17f981){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x194'),_0x17f981[_0xa885('0x38')]));return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x195'));};AGIVertices[_0xa885('0x11')][_0xa885('0x196')]=function(_0x25e0a6){logger['info'](util[_0xa885('0x28')](_0xa885('0x197'),_0x25e0a6[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x25e0a6['sms_account_id'])){return this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x198'));}var _0x91a816=this[_0xa885('0x199')][_0xa885('0xbc')](this,_0x25e0a6[_0xa885('0x19a')]);if(!_0x91a816){return this['channel'][_0xa885('0x32')](_0x25e0a6,_0xa885('0x19b'));}var _0x48091f={'body':_0x25e0a6[_0xa885('0x19c')],'phone':_0x25e0a6['to']||'','SmsAccountId':_0x91a816['id']};logger[_0xa885('0xdd')]('sendSMS\x20message',JSON['stringify'](_0x48091f));this[_0xa885('0x36')]['sync'](this,_0x25e0a6,_0x25e0a6['sms_account_id']);this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x19d'),_0x91a816[_0xa885('0x15')]));this[_0xa885('0x35')][_0xa885('0xbc')](this,_0x48091f);return this[_0xa885('0xe')]['noop'](_0xa885('0x19e'));};AGIVertices['prototype'][_0xa885('0x19f')]=function(_0x41d1a4){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x1a0'),_0x41d1a4['label']));if(!this[_0xa885('0x86')](_0x41d1a4[_0xa885('0xd4')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x41d1a4,_0xa885('0x1a1'));}var _0xb72ff2=this[_0xa885('0x12')]['sync'](this,_0x41d1a4['variable_id']);if(!_0xb72ff2){return this['channel']['error'](_0x41d1a4,_0xa885('0xd6'));}return this[_0xa885('0xe')][_0xa885('0xa1')](_0xb72ff2,_0x41d1a4['variable_value']);};AGIVertices[_0xa885('0x11')][_0xa885('0x1a2')]=function(_0x1e129a){logger[_0xa885('0x2e')](util[_0xa885('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1e129a['label']));this[_0xa885('0xe')][_0xa885('0xaa')](_0xa885('0x1a3'));var _0x506d86=this[_0xa885('0xe')][_0xa885('0x12')](_0xa885('0x1a4'));if(!_[_0xa885('0x43')](_0x506d86[_0xa885('0xa6')])){this[_0xa885('0xe')][_0xa885('0x37')]=_0x506d86['extra'];}if(_0x1e129a[_0xa885('0xb7')]===_0xa885('0x1a5')){this[_0xa885('0xe')][_0xa885('0xaa')]('Answer');return this[_0xa885('0xe')]['answer']();}return this[_0xa885('0xe')][_0xa885('0xaa')]('Skipped\x20Answer');};AGIVertices[_0xa885('0x11')]['subproject']=function(_0x90fe5c){logger['info'](util[_0xa885('0x28')](_0xa885('0x1a6'),_0x90fe5c[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x90fe5c[_0xa885('0x1a7')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x90fe5c,_0xa885('0x1a8'));}var _0x207da6=this['getSquareProject'][_0xa885('0xbc')](this,_0x90fe5c['project_id']);if(!this[_0xa885('0x86')](_0x207da6)){return this['channel'][_0xa885('0x32')](_0x90fe5c,util[_0xa885('0x28')](_0xa885('0x1a9'),_0x90fe5c[_0xa885('0x1a7')]));}if(_0x207da6===this['channel'][_0xa885('0x3a')]){return this['channel'][_0xa885('0x32')](_0x90fe5c,_0xa885('0x1aa'));}this['createSquareDetailsReport'][_0xa885('0xbc')](this,_0x90fe5c,_0x207da6);var _0xd4477a=this['channel'][_0xa885('0x56')](_0xa885('0x1ab'),util[_0xa885('0x28')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0xa885('0x7')][_0xa885('0x1ac')]||_0xa885('0x1ad'),_0x207da6,this[_0xa885('0xe')][_0xa885('0x3a')]));if(_0xd4477a[_0xa885('0xa5')]===-0x1){return _0xd4477a;}return this[_0xa885('0xe')]['noop'](util['format'](_0xa885('0xbf'),_0xa885('0x1ab'),_0x207da6));};AGIVertices['prototype'][_0xa885('0x1ae')]=function(_0x39df7){logger['info'](util[_0xa885('0x28')](_0xa885('0x1af'),_0x39df7[_0xa885('0x38')]));var _0x220638=this[_0xa885('0x1b0')][_0xa885('0xbc')](this,_0x39df7['command']);this['createSquareDetailsReport'][_0xa885('0xbc')](this,_0x39df7,_0x39df7['command']);if(this[_0xa885('0x86')](_0x39df7[_0xa885('0xd4')])){var _0x6579e9=this[_0xa885('0x12')]['sync'](this,_0x39df7[_0xa885('0xd4')]);if(_0x6579e9){this['channel'][_0xa885('0xa1')](_0x6579e9,_0x220638);return this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x1b1'),_0x39df7[_0xa885('0xb5')],_0x6579e9));}}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x1b2'),_0x39df7['command']));};AGIVertices[_0xa885('0x11')]['google_cloud_tts']=function(_0x186a99){logger[_0xa885('0x2e')](util['format'](_0xa885('0x1b3'),_0x186a99[_0xa885('0x38')]));_0x186a99['text']=_0x186a99[_0xa885('0x5b')][_0xa885('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa885('0x86')](_0x186a99['apiKey'])){return this[_0xa885('0xe')]['noop'](_0xa885('0x1b4'));}if(!this[_0xa885('0x86')](_0x186a99[_0xa885('0x5b')])){return this[_0xa885('0xe')]['noop'](_0xa885('0xab'));}this[_0xa885('0xe')]['noop'](util[_0xa885('0x28')](_0xa885('0x1b5'),_0x186a99[_0xa885('0x5b')]));var _0x41c384=this['googleCloudTTS'][_0xa885('0xbc')](this,_0x186a99);if(_0x41c384){this[_0xa885('0xe')][_0xa885('0xaa')](util['format'](_0xa885('0x1b6'),_0x41c384));var _0x434059=this['channel']['streamFile'](_0x41c384);try{fs[_0xa885('0x101')](_0x41c384+'.wav');}catch(_0x5d80ea){logger[_0xa885('0x32')](_0x5d80ea);}return _0x434059;}return this[_0xa885('0xe')]['error'](_0x186a99,_0xa885('0x1b7'));};AGIVertices[_0xa885('0x11')][_0xa885('0x1b8')]=function(_0x50226d){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x50226d['label']));_0x50226d[_0xa885('0x5b')]=_0x50226d[_0xa885('0x5b')][_0xa885('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xa885('0x86')](_0x50226d[_0xa885('0x5b')])){return this['channel'][_0xa885('0xaa')](_0xa885('0xab'));}this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x1b9'),_0x50226d[_0xa885('0x5b')]));var _0x42ae93=this[_0xa885('0x61')][_0xa885('0xbc')](this,_0x50226d);if(_0x42ae93){this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('Google\x20TTS\x20%s\x20file\x20created',_0x42ae93));var _0x13fda9=this['channel'][_0xa885('0x100')](_0x42ae93);try{fs[_0xa885('0x101')](_0x42ae93+_0xa885('0x120'));}catch(_0x3faff4){logger['error'](_0x3faff4);}return _0x13fda9;}return this[_0xa885('0xe')]['error'](_0x50226d,_0xa885('0x1ba'));};AGIVertices[_0xa885('0x11')]['unpause']=function(_0x58aaba){logger['info'](util[_0xa885('0x28')](_0xa885('0x1bb'),_0x58aaba[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x58aaba[_0xa885('0x152')])){return this[_0xa885('0xe')][_0xa885('0x32')](_0x58aaba,_0xa885('0x15a'));}logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x153'),this['channel'][_0xa885('0x3c')],_0x58aaba[_0xa885('0x152')]));var _0x4a5ab6=this[_0xa885('0x51')][_0xa885('0xbc')](this,_0x58aaba['findBy']);if(_0x4a5ab6){logger['info'](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x58aaba[_0xa885('0x152')]));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0x154'),this[_0xa885('0xe')][_0xa885('0x3c')],_0x58aaba[_0xa885('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x156'),this[_0xa885('0xe')]['callerid'],_0x58aaba[_0xa885('0x152')]));this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xa885('0xe')][_0xa885('0x3c')],_0x58aaba['findBy']));return{'code':0xc8,'result':_0xa885('0x157')};}};AGIVertices[_0xa885('0x11')][_0xa885('0x1bc')]=function(_0x218a5d){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x1bd'),_0x218a5d[_0xa885('0x38')]));var _0x4570ed=this[_0xa885('0xe')][_0xa885('0x56')]('VOICEMAIL',[_0x218a5d[_0xa885('0x1be')],_0x218a5d[_0xa885('0x77')]]);if(_0x4570ed[_0xa885('0xa5')]===-0x1){return _0x4570ed;}return this[_0xa885('0xe')][_0xa885('0xaa')](util[_0xa885('0x28')](_0xa885('0xbf'),_0xa885('0x1bf'),_0x218a5d[_0xa885('0x1be')]));};AGIVertices[_0xa885('0x11')]['vswitch']=function(_0x39852c){logger[_0xa885('0x2e')](util[_0xa885('0x28')](_0xa885('0x1c0'),_0x39852c[_0xa885('0x38')]));if(!this[_0xa885('0x86')](_0x39852c[_0xa885('0xd4')])){return this[_0xa885('0xe')]['error'](_0x39852c,_0xa885('0x1a1'));}var _0xb2a6af=this[_0xa885('0x12')][_0xa885('0xbc')](this,_0x39852c[_0xa885('0xd4')]);if(!_0xb2a6af){return this[_0xa885('0xe')][_0xa885('0x32')](_0x39852c,_0xa885('0xd6'));}var _0x59fc85=this[_0xa885('0xe')][_0xa885('0x12')](_0xb2a6af);return{'code':0xc8,'result':_0x59fc85[_0xa885('0xa6')]?_0x59fc85[_0xa885('0xa6')]:'-'};};String[_0xa885('0x11')][_0xa885('0xa3')]=function(_0x467539,_0x721d79){return this[_0xa885('0xa2')](_0x467539)[_0xa885('0x1c1')](_0x721d79);};module['exports']=AGIVertices;
\ No newline at end of file
index 7382ab9..0bac53f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa3f=['[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','queue','ACW','mandatoryDispositionPause','name','resolve','getAgent','then','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','message','timer','saveUnpause','update','[ACW][TIMERS]','mandatoryDisposition','interface','destlinkedid','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','syncBlindTransfer','transfereruniqueid'];(function(_0x4cacec,_0x47189e){var _0x34eeb7=function(_0x1e1a47){while(--_0x1e1a47){_0x4cacec['push'](_0x4cacec['shift']());}};_0x34eeb7(++_0x47189e);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x4ad687,_0x44067f){_0x4ad687=_0x4ad687-0x0;var _0x366c2a=_0xaa3f[_0x4ad687];return _0x366c2a;};'use strict';var _=require(_0xfaa3('0x0'));var moment=require(_0xfaa3('0x1'));var ami=require(_0xfaa3('0x2'));var logger=require(_0xfaa3('0x3'))(_0xfaa3('0x4'));var RpcUser=require(_0xfaa3('0x5'));var RpcVoiceAgentReport=require(_0xfaa3('0x6'));function Acw(_0x2b1aaf){this[_0xfaa3('0x7')]=_0x2b1aaf['voiceQueues'];this['agents']=_0x2b1aaf[_0xfaa3('0x8')];this['timers']=_0x2b1aaf[_0xfaa3('0x9')];this[_0xfaa3('0xa')]={};ami['on'](_0xfaa3('0xb'),this[_0xfaa3('0xc')][_0xfaa3('0xd')](this));ami['on'](_0xfaa3('0xe'),this[_0xfaa3('0xf')]['bind'](this));ami['on'](_0xfaa3('0x10'),this[_0xfaa3('0x11')]['bind'](this));ami['on']('agentringnoanswer',this[_0xfaa3('0x12')][_0xfaa3('0xd')](this));ami['on'](_0xfaa3('0x13'),this[_0xfaa3('0x14')][_0xfaa3('0xd')](this));ami['on'](_0xfaa3('0x15'),this['syncBlindTransfer'][_0xfaa3('0xd')](this));ami['on']('custom:agentConnectPreview',this[_0xfaa3('0x16')][_0xfaa3('0xd')](this));}function getDiff(_0x44540f){var _0x58f71b=moment()[_0xfaa3('0x17')](0x0);var _0x5f121b=moment(_0x44540f)[_0xfaa3('0x17')](0x0);return _0x58f71b[_0xfaa3('0x18')](_0x5f121b,_0xfaa3('0x19'));}Acw[_0xfaa3('0x1a')][_0xfaa3('0x1b')]=function(_0x40831f,_0x4da250){var _0x5f47dd=this;var _0x46e112=getDiff(_0x5f47dd[_0xfaa3('0x9')][_0x40831f][_0xfaa3('0x1c')]);clearTimeout(_0x5f47dd[_0xfaa3('0x9')][_0x40831f]['timer']);_0x5f47dd['timers'][_0x40831f]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x46e112},_0x5f47dd['timers'][_0x40831f][_0xfaa3('0x1d')],_0x40831f)['then'](function(_0x2a037c){logger[_0xfaa3('0x1e')](_0xfaa3('0x1f'),_0x4da250,_0x46e112,_0x2a037c);})[_0xfaa3('0x20')](function(_0x1c32dd){logger[_0xfaa3('0x21')](_0xfaa3('0x22'),_0x4da250,_0x1c32dd);})[_0xfaa3('0x23')](function(){delete _0x5f47dd[_0xfaa3('0x9')][_0x40831f];});};Acw[_0xfaa3('0x1a')]['startAcw']=function(_0x434c8b){try{var _0x755038=this;var _0x26d9ef=this[_0xfaa3('0xa')][_0x434c8b]['interface'];var _0x1f7324=this[_0xfaa3('0xa')][_0x434c8b][_0xfaa3('0x24')];var _0x22156a=this[_0xfaa3('0x7')][_0x1f7324];var _0x1fc244=![];var _0x2f2989=_0xfaa3('0x25');if(_0x22156a['mandatoryDisposition']&&_0x22156a[_0xfaa3('0x26')][_0xfaa3('0x27')]){_0x1fc244=!![];_0x2f2989=_0x22156a[_0xfaa3('0x26')][_0xfaa3('0x27')];}if(!_0x755038[_0xfaa3('0x8')][_0x26d9ef]){return Promise[_0xfaa3('0x28')]();}return RpcUser[_0xfaa3('0x29')](_0x755038[_0xfaa3('0x8')][_0x26d9ef]['id'])[_0xfaa3('0x2a')](function(_0x19d319){if(!_0x19d319||_0x19d319[_0xfaa3('0x2b')]){logger[_0xfaa3('0x1e')](_0xfaa3('0x2c'),_0x434c8b,_0x26d9ef,_0x1f7324);return;}logger[_0xfaa3('0x1e')](_0xfaa3('0x2d'),_0x434c8b,_0x26d9ef,_0x1f7324);var _0x5b84cd=_0x755038[_0xfaa3('0xa')][_0x434c8b][_0xfaa3('0x2e')]&&_0x755038[_0xfaa3('0xa')][_0x434c8b]['destlinkedid']?_0x755038[_0xfaa3('0xa')][_0x434c8b]['destlinkedid']:_0x434c8b;return RpcUser[_0xfaa3('0x2f')](_0x755038['agents'][_0x26d9ef],_0x2f2989,_0x5b84cd);})[_0xfaa3('0x2a')](function(_0x1ece24){if(_0x1fc244||!_0x1ece24){return;}_0x755038[_0xfaa3('0x9')][_0x26d9ef]={};logger[_0xfaa3('0x1e')](_0xfaa3('0x30'),_0x434c8b,_0x755038[_0xfaa3('0x7')][_0x1f7324][_0xfaa3('0x31')],_0x26d9ef,_0x1f7324);_0x755038[_0xfaa3('0x9')][_0x26d9ef]['timer']=setTimeout(_0x755038[_0xfaa3('0x32')][_0xfaa3('0xd')](_0x755038,_0x26d9ef),_0x755038[_0xfaa3('0x7')][_0x1f7324][_0xfaa3('0x31')]*0x3e8);_0x755038[_0xfaa3('0x9')][_0x26d9ef][_0xfaa3('0x1c')]=moment()[_0xfaa3('0x33')](_0xfaa3('0x34'));_0x755038[_0xfaa3('0x9')][_0x26d9ef][_0xfaa3('0x1d')]=_0x434c8b;_0x755038[_0xfaa3('0x9')][_0x26d9ef][_0xfaa3('0x24')]=_0x1f7324;_0x755038[_0xfaa3('0x9')][_0x26d9ef][_0xfaa3('0x1b')]=_0x755038[_0xfaa3('0x1b')][_0xfaa3('0xd')](_0x755038,_0x26d9ef,_0x434c8b);})['catch'](function(){logger[_0xfaa3('0x21')](_0xfaa3('0x30'),_0x434c8b,_0x755038[_0xfaa3('0x7')][_0x1f7324][_0xfaa3('0x31')],_0x26d9ef,_0x1f7324);})[_0xfaa3('0x23')](function(){delete _0x755038[_0xfaa3('0xa')][_0x434c8b];});}catch(_0x37d0a4){logger[_0xfaa3('0x21')]('[ACW][START]\x20%s',_0x37d0a4[_0xfaa3('0x35')]);}};Acw[_0xfaa3('0x1a')][_0xfaa3('0x32')]=function(_0x592500){try{var _0x229fc8=this;if(_0x229fc8[_0xfaa3('0x9')][_0x592500]){_0x229fc8['timers'][_0x592500][_0xfaa3('0x36')]=![];var _0x23fc89=_0x229fc8[_0xfaa3('0x9')][_0x592500][_0xfaa3('0x1d')];var _0x24afb4=_0x229fc8[_0xfaa3('0x9')][_0x592500]['queue'];var _0x56c526=_0x229fc8[_0xfaa3('0x7')][_0x24afb4][_0xfaa3('0x31')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x23fc89,_0x592500);RpcUser[_0xfaa3('0x37')](this['agents'][_0x592500]);RpcVoiceAgentReport[_0xfaa3('0x38')]({'acwtime':_0x56c526,'agentacw':!![]},_0x23fc89,_0x592500)[_0xfaa3('0x2a')](function(_0x37e89a){logger[_0xfaa3('0x1e')](_0xfaa3('0x1f'),_0x23fc89,_0x56c526,_0x37e89a);})[_0xfaa3('0x20')](function(_0x44a5cb){logger[_0xfaa3('0x21')]('[%s][UPDATE][ERRORS:%s]',_0x23fc89,_0x44a5cb);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x592500);if(_0x229fc8['timers']){logger[_0xfaa3('0x1e')](_0xfaa3('0x39'),JSON['stringify'](_0x229fc8[_0xfaa3('0x9')]));}}}catch(_0xa83a03){logger[_0xfaa3('0x21')]('[ACW][STOP]\x20%s',_0xa83a03['message']);}};Acw[_0xfaa3('0x1a')]['syncAgentConnect']=function(_0x1701bc){try{if(this['voiceQueues'][_0x1701bc['queue']]&&(this[_0xfaa3('0x7')][_0x1701bc[_0xfaa3('0x24')]]['acw']||this[_0xfaa3('0x7')][_0x1701bc['queue']][_0xfaa3('0x3a')])){if(this['agents'][_0x1701bc[_0xfaa3('0x3b')]]){this[_0xfaa3('0xa')][_0x1701bc[_0xfaa3('0x1d')]]={'queue':_0x1701bc['queue'],'interface':_0x1701bc[_0xfaa3('0x3b')],'destlinkedid':_0x1701bc[_0xfaa3('0x3c')]};}}}catch(_0x5aeeeb){logger[_0xfaa3('0x21')](_0xfaa3('0x3d'),_0x5aeeeb[_0xfaa3('0x35')]);}};Acw[_0xfaa3('0x1a')]['syncAgentConnectPreview']=function(_0x31ad7b){try{if(this[_0xfaa3('0x7')][_0x31ad7b['queue']]&&(this[_0xfaa3('0x7')][_0x31ad7b['queue']][_0xfaa3('0x4')]||this[_0xfaa3('0x7')][_0x31ad7b[_0xfaa3('0x24')]]['mandatoryDisposition'])){if(this[_0xfaa3('0x8')][_0x31ad7b['interface']]){this['channels'][_0x31ad7b[_0xfaa3('0x1d')]]={'queue':_0x31ad7b[_0xfaa3('0x24')],'interface':_0x31ad7b[_0xfaa3('0x3b')]};}}}catch(_0x27feb6){logger[_0xfaa3('0x21')](_0xfaa3('0x3e'),_0x27feb6[_0xfaa3('0x35')]);}};Acw['prototype'][_0xfaa3('0xf')]=function(_0x13dd2b){try{if(this[_0xfaa3('0xa')][_0x13dd2b[_0xfaa3('0x1d')]]&&_[_0xfaa3('0x3f')](this[_0xfaa3('0xa')][_0x13dd2b[_0xfaa3('0x1d')]]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x13dd2b[_0xfaa3('0x1d')]);this[_0xfaa3('0x40')](_0x13dd2b[_0xfaa3('0x1d')]);}else if(this[_0xfaa3('0xa')][_0x13dd2b['linkedid']]&&_[_0xfaa3('0x3f')](this['channels'][_0x13dd2b['linkedid']]['attended'])){logger['info']('[%s][HANGUP:LINKEDID]',_0x13dd2b[_0xfaa3('0x41')]);this[_0xfaa3('0x40')](_0x13dd2b[_0xfaa3('0x41')]);}}catch(_0x15522f){logger[_0xfaa3('0x21')](_0xfaa3('0x42'),_0x15522f[_0xfaa3('0x35')]);}};Acw[_0xfaa3('0x1a')]['syncHangup']=function(_0x3a9c95){try{if(this['channels'][_0x3a9c95['uniqueid']]&&this[_0xfaa3('0xa')][_0x3a9c95[_0xfaa3('0x1d')]][_0xfaa3('0x2e')]){logger[_0xfaa3('0x1e')](_0xfaa3('0x43'),_0x3a9c95[_0xfaa3('0x1d')]);this[_0xfaa3('0x40')](_0x3a9c95[_0xfaa3('0x1d')]);}else if(this[_0xfaa3('0xa')][_0x3a9c95[_0xfaa3('0x41')]]&&this[_0xfaa3('0xa')][_0x3a9c95[_0xfaa3('0x41')]][_0xfaa3('0x2e')]){logger[_0xfaa3('0x1e')](_0xfaa3('0x44'),_0x3a9c95['linkedid']);this[_0xfaa3('0x40')](_0x3a9c95['linkedid']);}}catch(_0x15a40c){logger[_0xfaa3('0x21')](_0xfaa3('0x45'),_0x15a40c[_0xfaa3('0x35')]);}};Acw[_0xfaa3('0x1a')][_0xfaa3('0x14')]=function(_0x1226de){try{if(!_[_0xfaa3('0x46')](this[_0xfaa3('0xa')][_0x1226de['transfereeuniqueid']])){this[_0xfaa3('0x40')](_0x1226de[_0xfaa3('0x47')]);if(this[_0xfaa3('0xa')][_0x1226de[_0xfaa3('0x48')]]){this['channels'][_0x1226de[_0xfaa3('0x48')]][_0xfaa3('0x2e')]=!![];this[_0xfaa3('0xa')][_0x1226de[_0xfaa3('0x49')]]=this[_0xfaa3('0xa')][_0x1226de[_0xfaa3('0x48')]];delete this[_0xfaa3('0xa')][_0x1226de['secondtransfereruniqueid']];}}else if(!_[_0xfaa3('0x46')](this[_0xfaa3('0xa')][_0x1226de[_0xfaa3('0x49')]])){this[_0xfaa3('0x40')](_0x1226de['transfertargetuniqueid']);if(this[_0xfaa3('0xa')][_0x1226de[_0xfaa3('0x4a')]]){this[_0xfaa3('0xa')][_0x1226de[_0xfaa3('0x4a')]][_0xfaa3('0x2e')]=!![];this[_0xfaa3('0xa')][_0x1226de[_0xfaa3('0x47')]]=this[_0xfaa3('0xa')][_0x1226de[_0xfaa3('0x4a')]];delete this['channels'][_0x1226de['origtransfereruniqueid']];}}}catch(_0x118378){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x118378[_0xfaa3('0x35')]);}};Acw[_0xfaa3('0x1a')][_0xfaa3('0x4b')]=function(_0x5e2bf4){try{if(this[_0xfaa3('0xa')][_0x5e2bf4[_0xfaa3('0x4c')]]){logger['info'](_0xfaa3('0x4d'),JSON[_0xfaa3('0x4e')](_0x5e2bf4[_0xfaa3('0x4c')]));this[_0xfaa3('0x40')](_0x5e2bf4['transfereruniqueid']);}else if(this[_0xfaa3('0xa')][_0x5e2bf4[_0xfaa3('0x4f')]]){logger['info'](_0xfaa3('0x50'),JSON[_0xfaa3('0x4e')](_0x5e2bf4[_0xfaa3('0x4f')]));this[_0xfaa3('0x40')](_0x5e2bf4[_0xfaa3('0x4f')]);}}catch(_0x50d9d9){logger[_0xfaa3('0x21')](_0xfaa3('0x51'),_0x50d9d9['message']);}};Acw['prototype']['syncAgentRingNoAnswer']=function(_0x4e1069){try{if(this[_0xfaa3('0x7')][_0x4e1069[_0xfaa3('0x24')]]&&this[_0xfaa3('0x7')][_0x4e1069[_0xfaa3('0x24')]][_0xfaa3('0x52')]===_0xfaa3('0x53')){if(this[_0xfaa3('0x8')][_0x4e1069[_0xfaa3('0x3b')]]){logger[_0xfaa3('0x1e')](_0xfaa3('0x54'),_0x4e1069[_0xfaa3('0x1d')],_0x4e1069['interface'],_0x4e1069[_0xfaa3('0x24')]);return RpcUser['savePause'](this[_0xfaa3('0x8')][_0x4e1069['interface']],_0xfaa3('0x55'),_0x4e1069[_0xfaa3('0x1d')]);}}}catch(_0x485e77){logger['error'](_0xfaa3('0x56'),_0x485e77[_0xfaa3('0x35')]);}};module[_0xfaa3('0x57')]=Acw;
\ No newline at end of file
+var _0x0627=['[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','moment','../ami','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','blindtransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','then','info','catch','error','[%s][UPDATE][ERRORS:%s]','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','resolve','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','uniqueid','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','getAgent','pauseType','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','interface','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','attended','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x0627,0x11b));var _0x7062=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0x0627[_0x432fca];return _0x3adba4;};'use strict';var _=require('lodash');var moment=require(_0x7062('0x0'));var ami=require(_0x7062('0x1'));var logger=require(_0x7062('0x2'))('acw');var RpcUser=require(_0x7062('0x3'));var RpcVoiceAgentReport=require(_0x7062('0x4'));function Acw(_0x5f2538){this[_0x7062('0x5')]=_0x5f2538['voiceQueues'];this[_0x7062('0x6')]=_0x5f2538[_0x7062('0x6')];this['timers']=_0x5f2538[_0x7062('0x7')];this[_0x7062('0x8')]={};ami['on'](_0x7062('0x9'),this[_0x7062('0xa')][_0x7062('0xb')](this));ami['on']('hanguprequest',this[_0x7062('0xc')][_0x7062('0xb')](this));ami['on'](_0x7062('0xd'),this[_0x7062('0xe')]['bind'](this));ami['on'](_0x7062('0xf'),this[_0x7062('0x10')][_0x7062('0xb')](this));ami['on'](_0x7062('0x11'),this['syncAttendedTransfer'][_0x7062('0xb')](this));ami['on'](_0x7062('0x12'),this['syncBlindTransfer']['bind'](this));ami['on'](_0x7062('0x13'),this['syncAgentConnectPreview'][_0x7062('0xb')](this));}function getDiff(_0xfb42b2){var _0x564995=moment()[_0x7062('0x14')](0x0);var _0x5cfaeb=moment(_0xfb42b2)[_0x7062('0x14')](0x0);return _0x564995[_0x7062('0x15')](_0x5cfaeb,_0x7062('0x16'));}Acw[_0x7062('0x17')][_0x7062('0x18')]=function(_0x369f61,_0x4fdff1){var _0x218ed1=this;var _0x1baff6=getDiff(_0x218ed1[_0x7062('0x7')][_0x369f61][_0x7062('0x19')]);clearTimeout(_0x218ed1['timers'][_0x369f61][_0x7062('0x1a')]);_0x218ed1[_0x7062('0x7')][_0x369f61]['timer']=![];return RpcVoiceAgentReport[_0x7062('0x1b')]({'acwtime':_0x1baff6},_0x218ed1[_0x7062('0x7')][_0x369f61]['uniqueid'],_0x369f61)[_0x7062('0x1c')](function(_0x103019){logger[_0x7062('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x4fdff1,_0x1baff6,_0x103019);})[_0x7062('0x1e')](function(_0x9c5ab9){logger[_0x7062('0x1f')](_0x7062('0x20'),_0x4fdff1,_0x9c5ab9);})['finally'](function(){delete _0x218ed1[_0x7062('0x7')][_0x369f61];});};Acw['prototype']['startAcw']=function(_0x262c4b){try{var _0x513d2d=this;var _0xd305fe=this['channels'][_0x262c4b]['interface'];var _0x252c95=this[_0x7062('0x8')][_0x262c4b][_0x7062('0x21')];var _0x3394cc=this[_0x7062('0x5')][_0x252c95];var _0x1aea1b=![];var _0x57fe2b=_0x7062('0x22');if(_0x3394cc[_0x7062('0x23')]&&_0x3394cc['mandatoryDispositionPause']['name']){_0x1aea1b=!![];_0x57fe2b=_0x3394cc[_0x7062('0x24')][_0x7062('0x25')];}if(!_0x513d2d[_0x7062('0x6')][_0xd305fe]){return Promise[_0x7062('0x26')]();}return RpcUser['getAgent'](_0x513d2d['agents'][_0xd305fe]['id'])[_0x7062('0x1c')](function(_0x404a2c){if(!_0x404a2c||_0x404a2c[_0x7062('0x27')]){logger[_0x7062('0x1d')](_0x7062('0x28'),_0x262c4b,_0xd305fe,_0x252c95);return;}logger[_0x7062('0x1d')](_0x7062('0x29'),_0x262c4b,_0xd305fe,_0x252c95);var _0x1da1fb=_0x513d2d[_0x7062('0x8')][_0x262c4b]['attended']&&_0x513d2d['channels'][_0x262c4b][_0x7062('0x2a')]?_0x513d2d[_0x7062('0x8')][_0x262c4b][_0x7062('0x2a')]:_0x262c4b;return RpcUser[_0x7062('0x2b')](_0x513d2d[_0x7062('0x6')][_0xd305fe],_0x57fe2b,_0x1da1fb)[_0x7062('0x1c')](function(_0x2cc35c){_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2c')]-=0x1;_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2d')]+=0x1;return _0x2cc35c;});})[_0x7062('0x1c')](function(_0x35ddd3){if(_0x1aea1b||!_0x35ddd3){return;}_0x513d2d[_0x7062('0x7')][_0xd305fe]={};logger[_0x7062('0x1d')](_0x7062('0x2e'),_0x262c4b,_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2f')],_0xd305fe,_0x252c95);_0x513d2d['timers'][_0xd305fe][_0x7062('0x1a')]=setTimeout(_0x513d2d[_0x7062('0x30')][_0x7062('0xb')](_0x513d2d,_0xd305fe),_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2f')]*0x3e8);_0x513d2d[_0x7062('0x7')][_0xd305fe]['lastPauseAt']=moment()[_0x7062('0x31')]('YYYY-MM-DD\x20HH:mm:ss');_0x513d2d[_0x7062('0x7')][_0xd305fe][_0x7062('0x32')]=_0x262c4b;_0x513d2d['timers'][_0xd305fe][_0x7062('0x21')]=_0x252c95;_0x513d2d[_0x7062('0x7')][_0xd305fe]['updateAcw']=_0x513d2d[_0x7062('0x18')][_0x7062('0xb')](_0x513d2d,_0xd305fe,_0x262c4b);})[_0x7062('0x1e')](function(){logger[_0x7062('0x1f')](_0x7062('0x2e'),_0x262c4b,_0x513d2d[_0x7062('0x5')][_0x252c95][_0x7062('0x2f')],_0xd305fe,_0x252c95);})['finally'](function(){delete _0x513d2d[_0x7062('0x8')][_0x262c4b];});}catch(_0x54f0af){logger[_0x7062('0x1f')](_0x7062('0x33'),_0x54f0af[_0x7062('0x34')]);}};Acw[_0x7062('0x17')][_0x7062('0x30')]=function(_0x369ebf){try{var _0x1a4d97=this;if(_0x1a4d97[_0x7062('0x7')][_0x369ebf]){_0x1a4d97[_0x7062('0x7')][_0x369ebf][_0x7062('0x1a')]=![];var _0x533ec7=_0x1a4d97[_0x7062('0x7')][_0x369ebf][_0x7062('0x32')];var _0x188891=_0x1a4d97[_0x7062('0x7')][_0x369ebf][_0x7062('0x21')];var _0x234dd3=_0x1a4d97['voiceQueues'][_0x188891][_0x7062('0x2f')];logger[_0x7062('0x1d')](_0x7062('0x35'),_0x533ec7,_0x369ebf);RpcUser[_0x7062('0x36')](this['agents'][_0x369ebf]['id'])[_0x7062('0x1c')](function(_0x2500b6){if(_0x2500b6[_0x7062('0x37')]===_0x7062('0x22')){return RpcUser['saveUnpause'](_0x1a4d97[_0x7062('0x6')][_0x369ebf]);}});RpcVoiceAgentReport[_0x7062('0x1b')]({'acwtime':_0x234dd3,'agentacw':!![]},_0x533ec7,_0x369ebf)['then'](function(_0x287e5f){logger[_0x7062('0x1d')](_0x7062('0x38'),_0x533ec7,_0x234dd3,_0x287e5f);})['catch'](function(_0x23cf4c){logger[_0x7062('0x1f')]('[%s][UPDATE][ERRORS:%s]',_0x533ec7,_0x23cf4c);});}else{logger[_0x7062('0x1f')](_0x7062('0x39'),_0x369ebf);if(_0x1a4d97[_0x7062('0x7')]){logger['info'](_0x7062('0x3a'),JSON[_0x7062('0x3b')](_0x1a4d97['timers']));}}}catch(_0x241df2){logger[_0x7062('0x1f')](_0x7062('0x3c'),_0x241df2[_0x7062('0x34')]);}};Acw[_0x7062('0x17')]['syncAgentConnect']=function(_0x50bfbc){try{if(this[_0x7062('0x5')][_0x50bfbc['queue']]&&(this['voiceQueues'][_0x50bfbc[_0x7062('0x21')]][_0x7062('0x3d')]||this[_0x7062('0x5')][_0x50bfbc[_0x7062('0x21')]][_0x7062('0x23')])){if(this['agents'][_0x50bfbc[_0x7062('0x3e')]]){this[_0x7062('0x8')][_0x50bfbc[_0x7062('0x32')]]={'queue':_0x50bfbc['queue'],'interface':_0x50bfbc['interface'],'destlinkedid':_0x50bfbc[_0x7062('0x2a')]};}}}catch(_0x22b74c){logger[_0x7062('0x1f')](_0x7062('0x3f'),_0x22b74c[_0x7062('0x34')]);}};Acw[_0x7062('0x17')][_0x7062('0x40')]=function(_0x2fe4d4){try{if(this[_0x7062('0x5')][_0x2fe4d4[_0x7062('0x21')]]&&(this[_0x7062('0x5')][_0x2fe4d4[_0x7062('0x21')]][_0x7062('0x3d')]||this[_0x7062('0x5')][_0x2fe4d4['queue']][_0x7062('0x23')])){if(this[_0x7062('0x6')][_0x2fe4d4[_0x7062('0x3e')]]){this['channels'][_0x2fe4d4['uniqueid']]={'queue':_0x2fe4d4[_0x7062('0x21')],'interface':_0x2fe4d4['interface']};}}}catch(_0x11671e){logger[_0x7062('0x1f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x11671e[_0x7062('0x34')]);}};Acw[_0x7062('0x17')][_0x7062('0xc')]=function(_0x1a8658){try{if(this[_0x7062('0x8')][_0x1a8658[_0x7062('0x32')]]&&_[_0x7062('0x41')](this[_0x7062('0x8')][_0x1a8658[_0x7062('0x32')]]['attended'])){logger[_0x7062('0x1d')](_0x7062('0x42'),_0x1a8658[_0x7062('0x32')]);this[_0x7062('0x43')](_0x1a8658[_0x7062('0x32')]);}else if(this[_0x7062('0x8')][_0x1a8658[_0x7062('0x44')]]&&_['isUndefined'](this[_0x7062('0x8')][_0x1a8658[_0x7062('0x44')]][_0x7062('0x45')])){logger[_0x7062('0x1d')](_0x7062('0x46'),_0x1a8658[_0x7062('0x44')]);this[_0x7062('0x43')](_0x1a8658[_0x7062('0x44')]);}}catch(_0x22cf21){logger[_0x7062('0x1f')](_0x7062('0x47'),_0x22cf21[_0x7062('0x34')]);}};Acw[_0x7062('0x17')][_0x7062('0xe')]=function(_0x197a62){try{if(this['channels'][_0x197a62[_0x7062('0x32')]]&&this[_0x7062('0x8')][_0x197a62[_0x7062('0x32')]]['attended']){logger[_0x7062('0x1d')](_0x7062('0x48'),_0x197a62[_0x7062('0x32')]);this[_0x7062('0x43')](_0x197a62[_0x7062('0x32')]);}else if(this['channels'][_0x197a62[_0x7062('0x44')]]&&this[_0x7062('0x8')][_0x197a62['linkedid']][_0x7062('0x45')]){logger[_0x7062('0x1d')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x197a62['linkedid']);this[_0x7062('0x43')](_0x197a62[_0x7062('0x44')]);}}catch(_0x3e0a2b){logger['error'](_0x7062('0x49'),_0x3e0a2b[_0x7062('0x34')]);}};Acw[_0x7062('0x17')]['syncAttendedTransfer']=function(_0x2223e7){try{if(!_[_0x7062('0x4a')](this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4b')]])){this['startAcw'](_0x2223e7[_0x7062('0x4b')]);if(this['channels'][_0x2223e7[_0x7062('0x4c')]]){this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4c')]][_0x7062('0x45')]=!![];this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4d')]]=this['channels'][_0x2223e7[_0x7062('0x4c')]];delete this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4c')]];}}else if(!_[_0x7062('0x4a')](this[_0x7062('0x8')][_0x2223e7['transfertargetuniqueid']])){this[_0x7062('0x43')](_0x2223e7['transfertargetuniqueid']);if(this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4e')]]){this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4e')]][_0x7062('0x45')]=!![];this['channels'][_0x2223e7[_0x7062('0x4b')]]=this[_0x7062('0x8')][_0x2223e7[_0x7062('0x4e')]];delete this['channels'][_0x2223e7['origtransfereruniqueid']];}}}catch(_0x46a018){logger[_0x7062('0x1f')](_0x7062('0x4f'),_0x46a018['message']);}};Acw[_0x7062('0x17')]['syncBlindTransfer']=function(_0x48c74e){try{if(this[_0x7062('0x8')][_0x48c74e[_0x7062('0x50')]]){logger[_0x7062('0x1d')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x7062('0x3b')](_0x48c74e[_0x7062('0x50')]));this['startAcw'](_0x48c74e[_0x7062('0x50')]);}else if(this['channels'][_0x48c74e['transfererlinkedid']]){logger['info'](_0x7062('0x51'),JSON[_0x7062('0x3b')](_0x48c74e['transfererlinkedid']));this[_0x7062('0x43')](_0x48c74e[_0x7062('0x52')]);}}catch(_0x10b64f){logger[_0x7062('0x1f')](_0x7062('0x53'),_0x10b64f['message']);}};Acw[_0x7062('0x17')][_0x7062('0x10')]=function(_0x522d04){try{if(this[_0x7062('0x5')][_0x522d04['queue']]&&this['voiceQueues'][_0x522d04['queue']][_0x7062('0x54')]===_0x7062('0x55')){if(this[_0x7062('0x6')][_0x522d04[_0x7062('0x3e')]]){logger['info'](_0x7062('0x56'),_0x522d04[_0x7062('0x32')],_0x522d04[_0x7062('0x3e')],_0x522d04['queue']);return RpcUser[_0x7062('0x2b')](this['agents'][_0x522d04['interface']],_0x7062('0x57'),_0x522d04[_0x7062('0x32')]);}}}catch(_0x35df9d){logger[_0x7062('0x1f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x35df9d[_0x7062('0x34')]);}};module[_0x7062('0x58')]=Acw;
\ No newline at end of file
index 8e0f1fb..7dc0a33 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdec1=['inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','once','close','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0xd336fa,_0x39d1b2){var _0x3370b1=function(_0x41c5cc){while(--_0x41c5cc){_0xd336fa['push'](_0xd336fa['shift']());}};_0x3370b1(++_0x39d1b2);}(_0xdec1,0x1a1));var _0x1dec=function(_0x1b7dc8,_0x1c933c){_0x1b7dc8=_0x1b7dc8-0x0;var _0x300e4b=_0xdec1[_0x1b7dc8];return _0x300e4b;};'use strict';var Manager=require(_0x1dec('0x0'));var BPromise=require(_0x1dec('0x1'));var util=require('util');var logger=require(_0x1dec('0x2'))('ami');var config=require(_0x1dec('0x3'));var ami=new Manager(config['asterisk'][_0x1dec('0x4')],config[_0x1dec('0x5')]['ip'],config['asterisk'][_0x1dec('0x6')],config[_0x1dec('0x5')][_0x1dec('0x7')],!![]);ami[_0x1dec('0x8')]();ami[_0x1dec('0x9')]=BPromise[_0x1dec('0xa')](ami[_0x1dec('0xb')]);function error(_0x144f09){logger[_0x1dec('0xc')](util[_0x1dec('0xd')](_0x1dec('0xe'),config['asterisk'][_0x1dec('0x6')],config['asterisk']['ip'],config[_0x1dec('0x5')][_0x1dec('0x4')],util[_0x1dec('0xf')](_0x144f09,![],null)));}function close(){logger['error'](util[_0x1dec('0xd')](_0x1dec('0x10'),config['asterisk'][_0x1dec('0x6')],config[_0x1dec('0x5')]['ip'],config[_0x1dec('0x5')]['port']));}ami[_0x1dec('0x11')]=function(){return function(){return ami[_0x1dec('0x9')]({'action':_0x1dec('0x12')});};};ami[_0x1dec('0x13')]=function(){return function(){return ami['Action']({'action':_0x1dec('0x14')});};};ami[_0x1dec('0x15')]=function(){return function(){return ami['Action']({'action':_0x1dec('0x16')});};};ami[_0x1dec('0x17')]=function(){return function(){return ami[_0x1dec('0x9')]({'action':_0x1dec('0x18')});};};ami[_0x1dec('0x19')]=function(){return function(){return ami[_0x1dec('0x9')]({'action':_0x1dec('0x1a')});};};function connect(){logger['info'](util[_0x1dec('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config['asterisk']['username'],config[_0x1dec('0x5')]['ip'],config[_0x1dec('0x5')][_0x1dec('0x4')]));ami['once'](_0x1dec('0xc'),error);ami[_0x1dec('0x1b')](_0x1dec('0x1c'),close);}ami['on']('connect',connect);ami['on']('shutdown',function(_0x22bd3c){logger[_0x1dec('0x1d')](util[_0x1dec('0xd')](_0x1dec('0x1e'),config[_0x1dec('0x5')][_0x1dec('0x6')],config['asterisk']['ip'],config[_0x1dec('0x5')][_0x1dec('0x4')],util['inspect'](_0x22bd3c,![],null)));});ami['on']('fullybooted',function(){logger['info'](util['format'](_0x1dec('0x1f'),config['asterisk'][_0x1dec('0x6')],config[_0x1dec('0x5')]['ip'],config[_0x1dec('0x5')][_0x1dec('0x4')]));return Promise['resolve']()['then'](ami[_0x1dec('0x11')]())[_0x1dec('0x20')](ami[_0x1dec('0x13')]())[_0x1dec('0x20')](ami[_0x1dec('0x15')]())['then'](ami[_0x1dec('0x17')]())['then'](ami[_0x1dec('0x19')]())[_0x1dec('0x21')](function(_0x3a8008){logger[_0x1dec('0xc')](_0x1dec('0x22'),util[_0x1dec('0xf')](_0x3a8008,{'showHidden':![],'depth':null}));});});ami[_0x1dec('0x1b')](_0x1dec('0xc'),error);ami['once'](_0x1dec('0x1c'),close);module[_0x1dec('0x23')]=ami;
\ No newline at end of file
+var _0x2e8b=['action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','info','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','actionDeviceStateList','exports','asterisk-manager','util','../../config/logger','../../config/environment','asterisk','port','username','password','Action'];(function(_0x51085f,_0x1cb2f0){var _0x455c86=function(_0x1eae65){while(--_0x1eae65){_0x51085f['push'](_0x51085f['shift']());}};_0x455c86(++_0x1cb2f0);}(_0x2e8b,0x117));var _0xb2e8=function(_0x17d678,_0x826d42){_0x17d678=_0x17d678-0x0;var _0x8f7971=_0x2e8b[_0x17d678];return _0x8f7971;};'use strict';var Manager=require(_0xb2e8('0x0'));var BPromise=require('bluebird');var util=require(_0xb2e8('0x1'));var logger=require(_0xb2e8('0x2'))('ami');var config=require(_0xb2e8('0x3'));var ami=new Manager(config[_0xb2e8('0x4')][_0xb2e8('0x5')],config[_0xb2e8('0x4')]['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x6')],config[_0xb2e8('0x4')][_0xb2e8('0x7')],!![]);ami['keepConnected']();ami[_0xb2e8('0x8')]=BPromise['promisify'](ami[_0xb2e8('0x9')]);function error(_0x5de337){logger['error'](util[_0xb2e8('0xa')](_0xb2e8('0xb'),config[_0xb2e8('0x4')][_0xb2e8('0x6')],config[_0xb2e8('0x4')]['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x5')],util[_0xb2e8('0xc')](_0x5de337,![],null)));}function close(){logger[_0xb2e8('0xd')](util[_0xb2e8('0xa')](_0xb2e8('0xe'),config[_0xb2e8('0x4')][_0xb2e8('0x6')],config[_0xb2e8('0x4')]['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x5')]));}ami[_0xb2e8('0xf')]=function(){return function(){return ami[_0xb2e8('0x8')]({'action':_0xb2e8('0x10')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0xb2e8('0x11')});};};ami[_0xb2e8('0x12')]=function(){return function(){return ami[_0xb2e8('0x8')]({'action':_0xb2e8('0x13')});};};ami[_0xb2e8('0x14')]=function(){return function(){return ami[_0xb2e8('0x8')]({'action':_0xb2e8('0x15')});};};ami[_0xb2e8('0x16')]=function(){return function(){return ami[_0xb2e8('0x8')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util['format'](_0xb2e8('0x17'),config['asterisk'][_0xb2e8('0x6')],config[_0xb2e8('0x4')]['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x5')]));ami['once']('error',error);ami[_0xb2e8('0x18')](_0xb2e8('0x19'),close);}ami['on'](_0xb2e8('0x1a'),connect);ami['on'](_0xb2e8('0x1b'),function(_0x24f3d2){logger['info'](util[_0xb2e8('0xa')](_0xb2e8('0x1c'),config[_0xb2e8('0x4')]['username'],config['asterisk']['ip'],config[_0xb2e8('0x4')][_0xb2e8('0x5')],util['inspect'](_0x24f3d2,![],null)));});ami['on'](_0xb2e8('0x1d'),function(){logger[_0xb2e8('0x1e')](util[_0xb2e8('0xa')](_0xb2e8('0x1f'),config[_0xb2e8('0x4')][_0xb2e8('0x6')],config['asterisk']['ip'],config['asterisk'][_0xb2e8('0x5')]));return Promise[_0xb2e8('0x20')]()[_0xb2e8('0x21')](ami[_0xb2e8('0xf')]())[_0xb2e8('0x21')](ami[_0xb2e8('0x22')]())['then'](ami['actionSipPeerStatus']())['then'](ami['actionQueueSummary']())[_0xb2e8('0x21')](ami[_0xb2e8('0x16')]())['catch'](function(_0x182abd){logger['error']('[ami.js][fullybooted]',util[_0xb2e8('0xc')](_0x182abd,{'showHidden':![],'depth':null}));});});ami[_0xb2e8('0x18')](_0xb2e8('0xd'),error);ami[_0xb2e8('0x18')](_0xb2e8('0x19'),close);module[_0xb2e8('0x23')]=ami;
\ No newline at end of file
index fc3218f..474adff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x4991d6,_0x348deb){var _0x50faf7=function(_0x14c7f8){while(--_0x14c7f8){_0x4991d6['push'](_0x4991d6['shift']());}};_0x50faf7(++_0x348deb);}(_0xac4a,0x13f));var _0xaac4=function(_0x40ebb7,_0x163948){_0x40ebb7=_0x40ebb7-0x0;var _0x298127=_0xac4a[_0x40ebb7];return _0x298127;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client;
\ No newline at end of file
+var _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x70e0,0x17b));var _0x070e=function(_0x2367f3,_0x1fe93f){_0x2367f3=_0x2367f3-0x0;var _0x1edd68=_0x70e0[_0x2367f3];return _0x1edd68;};'use strict';var jayson=require(_0x070e('0x0'));var BPromise=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('ami');var client=jayson['client'][_0x070e('0x3')]({'port':0x2329});client[_0x070e('0x4')]=function(_0x277d32,_0x2593e5){return new BPromise(function(_0x5c90fc,_0x7bce9b){return client['request'](_0x277d32,_0x2593e5)[_0x070e('0x5')](function(_0x4b041d){logger['debug']('rpc',_0x070e('0x6'),_0x277d32,_0x2593e5,_0x4b041d);if(_0x4b041d[_0x070e('0x7')]){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x4b041d[_0x070e('0x7')][_0x070e('0x9')],_0x2593e5);return _0x7bce9b(_0x4b041d['error']['message']);}else{return _0x5c90fc(_0x4b041d[_0x070e('0xa')]);}})[_0x070e('0xb')](function(_0x12bb37){logger[_0x070e('0x7')](_0x070e('0x8'),_0x070e('0x6'),_0x277d32,_0x12bb37,_0x2593e5);return _0x7bce9b(_0x12bb37);});});};module[_0x070e('0xc')]=client;
\ No newline at end of file
index b37f998..c8324c1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xebc0=['[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','congestion','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','reason\x2020\x20agentreject','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','round','erlangCalls','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getDataPredictiveOld','getVoiceQueueRtPauses','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','check\x20failure','floor','checkContactBlack','queueStatusComplete:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','getContactDialerIvr','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','checkContactEmpty','countReScheduled','[countReScheduled]\x20','checkIsBlackList','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','[busyFactor]','Umin\x20=\x20','util','lodash','uuid','../../../config/logger','dialer','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','syncQueueSummaryComplete','hangup','syncHangup','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','temp','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','then','content','iftime\x20%s,%s','indexOf','true','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','resetActiveCalls','syncCampaigns','undefined','dialGlobalInterval','checkIfTimeIntervals','dialTimezone','launchHandleIvr','[syncCampaigns]','predictive','dialMethod','progressive','power','handlePower','dialPowerLevel','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agiafterat','dialQueueProject2','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','dialDropMaxRetry','additional','rescheduleContact','minutes','ContactId','ListId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','queueCallerAbandonCreateState','add','[rescheduleContact][Abandoned]','createHistory','[syncAgentComplete][createHistory][11]','syncNewExten','channel','actionid','strategy','rrmemory','locked','paused','stateinterface','roundrobin','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','isNil','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','VoiceQueueId','[unlock3][syncQueueStatusComplete]','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','Machine','amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','countagentrejectretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','resolve','available','talking','pTalking','ACTIVE','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','throttle','filter','dialPreviewRecallmeReminder','online','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','sequence','enqueue','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handlePreviewRecallNotifications','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-VOICEQUEUEID','setXMDContactVariables','Contact','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0xebc0,0x92));var _0x0ebc=function(_0xd4eafd,_0x21c153){_0xd4eafd=_0xd4eafd-0x0;var _0x8117e2=_0xebc0[_0xd4eafd];return _0x8117e2;};'use strict';var util=require(_0x0ebc('0x0'));var _=require(_0x0ebc('0x1'));var uuid=require(_0x0ebc('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require('../preview/util/util');var config=require('../../../config/environment/');var logger=require(_0x0ebc('0x3'))(_0x0ebc('0x4'));var loggerBooked=require(_0x0ebc('0x3'))(_0x0ebc('0x5'));var loggerPredictive=require(_0x0ebc('0x3'))('predictive');var loggerPredictiveCalls=require(_0x0ebc('0x3'))(_0x0ebc('0x6'));var loggerSyncQueueSummary=require(_0x0ebc('0x3'))(_0x0ebc('0x7'));var ami=require(_0x0ebc('0x8'));config[_0x0ebc('0x9')]=_[_0x0ebc('0xa')](config['redis'],{'host':_0x0ebc('0xb'),'port':0x18eb});var io=require(_0x0ebc('0xc'))(new Redis(config[_0x0ebc('0x9')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x0ebc('0xd'));var Interval=require(_0x0ebc('0xe'));var Action=require(_0x0ebc('0xf'));var History=require(_0x0ebc('0x10'));var Final=require(_0x0ebc('0x11'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x0ebc('0x12'));var Hangup=require(_0x0ebc('0x13'));var ipAgi=process[_0x0ebc('0x14')][_0x0ebc('0x15')]||_0x0ebc('0x16');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x0ebc('0x17')]['enqueue']=function(_0x1c7bfa){this[_0x0ebc('0x18')]=this[_0x0ebc('0x18')]?this[_0x0ebc('0x18')][_0x0ebc('0x19')](_0x1c7bfa):_0x1c7bfa();};function Dialer(_0x2fb899,_0x39f84f){this['sequence']=new Sequence();this[_0x0ebc('0x1a')]=_0x39f84f;this[_0x0ebc('0x1b')]=_0x2fb899[_0x0ebc('0x1b')];this[_0x0ebc('0x1c')]=_0x2fb899[_0x0ebc('0x1c')];this[_0x0ebc('0x1d')]=_0x2fb899[_0x0ebc('0x1d')];this['trunks']=_0x2fb899[_0x0ebc('0x1e')];this[_0x0ebc('0x1f')]=config['maxNumberOriginate']||0x2;this['channels']={};this[_0x0ebc('0x20')]={};this[_0x0ebc('0x21')]={};this[_0x0ebc('0x22')]={};this[_0x0ebc('0x23')]={};this[_0x0ebc('0x24')]={};this[_0x0ebc('0x25')]={};this[_0x0ebc('0x26')]={};this[_0x0ebc('0x27')]={};this[_0x0ebc('0x28')]={};this['queuesSummary']={};ami['on'](_0x0ebc('0x29'),this[_0x0ebc('0x2a')][_0x0ebc('0x2b')](this));ami['on'](_0x0ebc('0x2c'),this[_0x0ebc('0x2d')]['bind'](this));ami['on'](_0x0ebc('0x2e'),this[_0x0ebc('0x2f')]['bind'](this));ami['on'](_0x0ebc('0x30'),this[_0x0ebc('0x31')][_0x0ebc('0x2b')](this));ami['on']('custom:queuesummary',this[_0x0ebc('0x7')][_0x0ebc('0x2b')](this));ami['on']('custom:queuesummarycomplete',this[_0x0ebc('0x32')][_0x0ebc('0x2b')](this));ami['on'](_0x0ebc('0x33'),this[_0x0ebc('0x34')]['bind'](this));ami['on']('newexten',this['syncNewExten'][_0x0ebc('0x2b')](this));ami['on'](_0x0ebc('0x35'),this[_0x0ebc('0x36')][_0x0ebc('0x2b')](this));ami['on'](_0x0ebc('0x37'),this[_0x0ebc('0x38')][_0x0ebc('0x2b')](this));ami['on']('queuestatuscomplete',this[_0x0ebc('0x39')][_0x0ebc('0x2b')](this));this[_0x0ebc('0x3a')]();this[_0x0ebc('0x3b')]();RpcSetting[_0x0ebc('0x3c')]()['then'](function(_0x1fc55a){previewRecallmeReminderInterval=_0x1fc55a[_0x0ebc('0x3d')];});}function isNotNull(_0x227d72){return _0x227d72!==null&&!_['isUndefined'](_0x227d72);}function msgResponse(_0x4505e3,_0x3276e6,_0x1cfa16){return{'action':_0x4505e3,'response':_0x3276e6,'message':_0x1cfa16,'stack':_0x1cfa16};}function emit(_0x364661,_0x25d0ed,_0x2df238){io['to'](_0x364661)[_0x0ebc('0x3e')](_0x25d0ed,_0x2df238);}function emitOutboundVoiceQueueSummary(_0x5a1fff){if(_0x5a1fff[_0x0ebc('0x3f')]===_0x0ebc('0x40')){logger[_0x0ebc('0x41')](_0x0ebc('0x42'),util[_0x0ebc('0x43')](_0x5a1fff,{'showHidden':![],'depth':null}));emit(util[_0x0ebc('0x44')](_0x0ebc('0x45'),_0x5a1fff[_0x0ebc('0x46')]),_0x0ebc('0x47'),_0x5a1fff);}}function checkGetDataPredictive(_0x9157fd){if(isNotNull(_0x9157fd)&&!_[_0x0ebc('0x48')](_0x9157fd)){loggerPredictive[_0x0ebc('0x49')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x4a'),_0x9157fd[_0x0ebc('0x4b')]);loggerPredictive[_0x0ebc('0x49')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x9157fd[_0x0ebc('0x4c')]);loggerPredictive['info'](_0x0ebc('0x4d'),_0x9157fd['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x4e'),_0x9157fd['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x4f'),_0x9157fd[_0x0ebc('0x50')]);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x51'),_0x9157fd[_0x0ebc('0x52')]);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x53'));if(_0x9157fd[_0x0ebc('0x4b')]>0x0){if(!_[_0x0ebc('0x54')](_0x9157fd[_0x0ebc('0x52')])&&_0x9157fd[_0x0ebc('0x52')]>0x0){return!![];}loggerPredictive['info'](_0x0ebc('0x55'));if(!_[_0x0ebc('0x54')](_0x9157fd['predictiveIntervalAvgHoldtime'])&&_0x9157fd[_0x0ebc('0x50')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x0ebc('0x49')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x0ebc('0x49')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x36895f){return function(_0x327eef){loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x56'));loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x57'),_0x327eef['erlangCalls']);loggerPredictive['info'](_0x0ebc('0x58'),_0x327eef[_0x0ebc('0x59')]);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x5a'),_0x327eef[_0x0ebc('0x5b')]);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x5c'),_0x327eef[_0x0ebc('0x5d')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x327eef[_0x0ebc('0x5b')]);loggerPredictive[_0x0ebc('0x49')]('---------------------------');_[_0x0ebc('0x5e')](_0x36895f,_0x327eef);};}function ifInterval(_0x5ed942,_0xcbd345){if(_[_0x0ebc('0x54')](_0xcbd345)){return![];}return utils[_0x0ebc('0x5f')](undefined,_0xcbd345)<_0x5ed942*0x3c;}function clearPredictiveAttributes(_0x259011){if(_0x259011[_0x0ebc('0x25')]){_0x259011[_0x0ebc('0x25')]=undefined;loggerPredictive[_0x0ebc('0x41')](_0x259011['name'],_0x0ebc('0x60'));}if(_0x259011['startPredictive']){_0x259011[_0x0ebc('0x24')]=undefined;loggerPredictive['debug'](_0x259011[_0x0ebc('0x46')],_0x0ebc('0x61'));}if(_0x259011[_0x0ebc('0x62')]){clearInterval(_0x259011[_0x0ebc('0x62')]);_0x259011[_0x0ebc('0x62')]=undefined;loggerPredictive[_0x0ebc('0x41')](_0x259011[_0x0ebc('0x46')],_0x0ebc('0x63'));}}function loggerCatchPredictive(_0x2f706e,_0x170883){return function(_0x16ba80){loggerPredictive[_0x0ebc('0x64')](_0x170883[_0x0ebc('0x46')],_0x2f706e);loggerPredictive[_0x0ebc('0x64')](_0x16ba80['stack']);clearPredictiveAttributes(_0x170883);};}function loggerCatch(_0x10b6bf){return function(_0x12a7ff){logger['error'](_0x10b6bf,util[_0x0ebc('0x43')](_0x12a7ff,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1d11ff,_0x25d196,_0x210aef){return function(_0x231970){utils['checkContactLowerLimitOriginate'](_0x25d196,_0x210aef,0x0);_0x25d196[_0x0ebc('0x65')]=0x0;logger[_0x0ebc('0x64')](_0x1d11ff,util[_0x0ebc('0x43')](_0x231970,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x1193ed){return function(_0x3da92c){if(isNotNull(_0x3da92c)&&isNotNull(_0x3da92c[0x0])){if(_0x3da92c[0x0][_0x0ebc('0x66')]>0x0){_0x1193ed[_0x0ebc('0x67')]=utils['CAMPAIGN_STATUS'][_0x0ebc('0x68')];logger[_0x0ebc('0x49')](_0x0ebc('0x69')+_0x1193ed['name'],_0x3da92c[0x0][_0x0ebc('0x66')],'contacts');}else{_0x1193ed[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x6b')];logger[_0x0ebc('0x49')](_0x0ebc('0x6c')+_0x1193ed[_0x0ebc('0x46')]);}}};}function createObjHistory(_0x27b552,_0x25806c,_0x49e9c5,_0x14e31b,_0x235980){_0x27b552['message']=_0x49e9c5;var _0x13ae69=new Action(_0x27b552,_0x25806c);var _0x4eb56c=new History(_0x13ae69);_0x4eb56c[_0x0ebc('0x6d')]=_0x14e31b;_0x4eb56c['statedesc']=_0x235980;_0x4eb56c[_0x0ebc('0x6e')]=_0x13ae69[_0x0ebc('0x6f')];return _0x4eb56c;}function unlockQueueStatus(_0x469b10,_0x47a46b){setTimeout(function(){if(_[_0x0ebc('0x54')](_0x469b10[_0x0ebc('0x70')])){loggerBooked[_0x0ebc('0x64')](_0x0ebc('0x71'),_0x47a46b);}_0x469b10[_0x0ebc('0x70')]=!![];loggerBooked[_0x0ebc('0x49')]('[booked][unlockQueueStatus]',_0x47a46b,JSON[_0x0ebc('0x72')](_[_0x0ebc('0x73')](_0x469b10,[_0x0ebc('0x46'),_0x0ebc('0x70')])));},0x1f3);}function checkInterval(_0x4a9320){return function(){if(!isNotNull(_0x4a9320[_0x0ebc('0x74')])){_0x4a9320[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x75')];throw _0x4a9320[_0x0ebc('0x46')]+_0x0ebc('0x76');}if(!isNotNull(_0x4a9320[_0x0ebc('0x74')][_0x0ebc('0x77')])){_0x4a9320[_0x0ebc('0x67')]=utils['CAMPAIGN_STATUS'][_0x0ebc('0x75')];throw _0x4a9320[_0x0ebc('0x46')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x0ebc('0x48')](_0x4a9320[_0x0ebc('0x74')]['Intervals']))){_0x4a9320['message']=utils[_0x0ebc('0x6a')][_0x0ebc('0x75')];throw _0x4a9320[_0x0ebc('0x46')]+_0x0ebc('0x76');}};}function checkIsIVRCampaignActive(_0x296fac){return function(){if(!utils[_0x0ebc('0x78')](_0x296fac)){_0x296fac[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x79')];throw _0x296fac['name']+_0x0ebc('0x7a');}};}function emitCampaignSummary(_0x50422b){if(utils[_0x0ebc('0x7b')](_0x50422b)){emit(util['format'](_0x0ebc('0x7c'),_0x50422b[_0x0ebc('0x46')]),'campaign:save',_0x50422b);}}function loggerCatchQueueSummary(_0x1cdaac,_0x5bab70){return function(_0x3b9a0a){clearPredictiveAttributes(_0x5bab70);emitCampaignSummary(_0x5bab70);loggerSyncQueueSummary[_0x0ebc('0x41')](_0x1cdaac,util[_0x0ebc('0x43')](_0x3b9a0a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x10a522){if(_0x10a522[_0x0ebc('0x7d')]){if(_0x10a522[_0x0ebc('0x7e')]===0x0){_0x10a522[_0x0ebc('0x7d')]=![];_0x10a522[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x79')];loggerSyncQueueSummary[_0x0ebc('0x41')](_0x0ebc('0x7f'),_0x10a522[_0x0ebc('0x46')],_0x0ebc('0x80'));}else{_0x10a522[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x81')];loggerSyncQueueSummary[_0x0ebc('0x41')](_0x0ebc('0x7f'),_0x10a522[_0x0ebc('0x46')],_0x0ebc('0x82'));}emitCampaignSummary(_0x10a522);}}function myreject(_0x3d7b83){return function(_0x1647fc){return _0x3d7b83(msgResponse('[ifTime][Action]',_0x0ebc('0x83'),JSON[_0x0ebc('0x72')](_0x1647fc)));};}Dialer[_0x0ebc('0x17')][_0x0ebc('0x84')]=function(_0x46b4ad){return!_[_0x0ebc('0x54')](_0x46b4ad)&&_0x46b4ad&&!_[_0x0ebc('0x54')](_0x46b4ad[_0x0ebc('0x46')])&&!_['isUndefined'](_0x46b4ad[_0x0ebc('0x85')])&&_0x46b4ad[_0x0ebc('0x85')]&&(this[_0x0ebc('0x1e')][util[_0x0ebc('0x44')](_0x0ebc('0x86'),_0x46b4ad[_0x0ebc('0x46')])][_0x0ebc('0x87')]===_0x0ebc('0x88')||this[_0x0ebc('0x1e')][util[_0x0ebc('0x44')](_0x0ebc('0x86'),_0x46b4ad['name'])][_0x0ebc('0x87')]==='unmonitored');};Dialer['prototype'][_0x0ebc('0x89')]=function(_0x3346b8){var _0x25bf3a=this;return function(){if(!_0x25bf3a[_0x0ebc('0x84')](_0x3346b8['Trunk'])){if(!_0x25bf3a[_0x0ebc('0x84')](_0x3346b8[_0x0ebc('0x8a')])){_0x3346b8[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')]['TRUNK_NOT_REACHABLE'];throw _0x3346b8['name']+_0x0ebc('0x8b');}}};};Dialer['prototype'][_0x0ebc('0x8c')]=function(_0x15be95,_0x5428d1,_0x5bad8d,_0x5b6081){var _0x572999=this;return function(){var _0x2df8f9=!![];return _0x572999[_0x0ebc('0x8d')](_0x15be95,_0x5428d1,_0x5bad8d,_0x5b6081,_0x2df8f9);};};Dialer[_0x0ebc('0x17')]['checkIfTimeIntervals']=function(_0x443904,_0x1cbc12,_0x3bd218,_0xb0d415){var _0x3046cc=this;return function(){var _0x459d98=![];return _0x3046cc['ifTimeIvr'](_0x443904[_0x0ebc('0x77')],_0x1cbc12,_0x3bd218,_0xb0d415,_0x459d98);};};Dialer[_0x0ebc('0x17')][_0x0ebc('0x8d')]=function(_0x5f5028,_0x39cfed,_0x37194a,_0x2d4446,_0x2a5880){var _0x1069f5=[];return new Promise(function(_0x14c6e4,_0x5ba45f){if(!isNotNull(_0x5f5028)){_0x2d4446[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x75')];return _0x5ba45f(msgResponse(_0x0ebc('0x8e'),'Failure',_0x37194a+_0x0ebc('0x8f')));}if(_[_0x0ebc('0x48')](_0x5f5028)){_0x2d4446[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x90')];return _0x5ba45f(msgResponse(_0x0ebc('0x8e'),_0x0ebc('0x91'),_0x37194a+_0x0ebc('0x92')));}if(_0x39cfed&&_[_0x0ebc('0x54')](config[_0x0ebc('0x93')][_0x39cfed])){_0x2d4446['message']=utils[_0x0ebc('0x6a')][_0x0ebc('0x94')];return _0x5ba45f(msgResponse(_0x0ebc('0x8e'),'Failure',_0x37194a+_0x0ebc('0x95')+_0x39cfed));}if(_[_0x0ebc('0x96')](_0x5f5028)){for(var _0x194e7c=0x0;_0x194e7c<_0x5f5028[_0x0ebc('0x97')];_0x194e7c+=0x1){_0x1069f5[_0x0ebc('0x98')](ami[_0x0ebc('0x99')]({'action':_0x0ebc('0x9a'),'command':util['format']('iftime\x20%s,%s',_0x5f5028[_0x194e7c][_0x0ebc('0x9b')],!_[_0x0ebc('0x54')](config['timezones'][_0x39cfed])?_0x39cfed:'')})[_0x0ebc('0x9c')](function(_0x28aac4){return _0x28aac4[_0x0ebc('0x9d')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x5ba45f)));}}else{_0x1069f5['push'](ami[_0x0ebc('0x99')]({'action':_0x0ebc('0x9a'),'command':util[_0x0ebc('0x44')](_0x0ebc('0x9e'),_0x5f5028,!_['isUndefined'](config[_0x0ebc('0x93')][_0x39cfed])?_0x39cfed:'')})['then'](function(_0x2c4a7b){return _0x2c4a7b[_0x0ebc('0x9d')][_0x0ebc('0x9f')](_0x0ebc('0xa0'))>=0x0;})[_0x0ebc('0xa1')](myreject(_0x5ba45f)));}Promise[_0x0ebc('0xa2')](_0x1069f5)['then'](function(_0x11c310){var _0x4e24c6=_[_0x0ebc('0xa3')](_0x11c310);if(_0x4e24c6){return _0x14c6e4(_0x4e24c6);}else{_0x2d4446[_0x0ebc('0x67')]=_0x2a5880?utils[_0x0ebc('0x6a')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x0ebc('0x6a')][_0x0ebc('0xa4')];return _0x5ba45f(msgResponse(_0x0ebc('0xa5'),_0x0ebc('0x91'),_0x0ebc('0xa6')+_0x2a5880+'\x20'+_0x37194a+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0ebc('0x43')](_0x5f5028,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x39cfed));}})[_0x0ebc('0xa1')](function(_0x2db98e){return _0x5ba45f(msgResponse('ifTime','Failure',JSON[_0x0ebc('0x72')](_0x2db98e)));});});};Dialer['prototype'][_0x0ebc('0x3a')]=function(){var _0x1f4e5f=this;return cmHopper[_0x0ebc('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0x0ebc('0x9c')](function(){setInterval(function(){_0x1f4e5f[_0x0ebc('0xa8')]();},0x3e8);});};Dialer[_0x0ebc('0x17')]['syncCampaigns']=function(){var _0x3376ff=this;var _0x5b4f0d;for(var _0x56744a in this[_0x0ebc('0x1c')]){if(typeof this['campaigns'][_0x56744a]!==_0x0ebc('0xa9')){_0x5b4f0d=this[_0x0ebc('0x1c')][_0x56744a];if(utils[_0x0ebc('0x7b')](_0x5b4f0d)&&utils[_0x0ebc('0x78')](_0x5b4f0d)){_0x5b4f0d[_0x0ebc('0x7d')]=!![];Promise['resolve']()[_0x0ebc('0x9c')](checkIsIVRCampaignActive(_0x5b4f0d))[_0x0ebc('0x9c')](checkInterval(_0x5b4f0d))[_0x0ebc('0x9c')](_0x3376ff[_0x0ebc('0x89')](_0x5b4f0d))['then'](_0x3376ff[_0x0ebc('0x8c')](_0x5b4f0d[_0x0ebc('0xaa')],_0x5b4f0d['dialTimezone'],_0x5b4f0d['name'],_0x5b4f0d))[_0x0ebc('0x9c')](_0x3376ff[_0x0ebc('0xab')](_0x5b4f0d[_0x0ebc('0x74')],_0x5b4f0d[_0x0ebc('0xac')],_0x5b4f0d[_0x0ebc('0x46')],_0x5b4f0d))[_0x0ebc('0x9c')](_0x3376ff[_0x0ebc('0xad')](_0x5b4f0d))[_0x0ebc('0xa1')](loggerCatchQueueSummary(_0x0ebc('0xae'),_0x5b4f0d));}else{notSendMessagesCampaign(_0x5b4f0d);}}}};Dialer[_0x0ebc('0x17')]['checkDialMethod']=function(_0xa02c6){if(_0xa02c6['dialMethod']!==_0x0ebc('0xaf')){clearPredictiveAttributes(_0xa02c6);}switch(_0xa02c6[_0x0ebc('0xb0')]){case _0x0ebc('0xb1'):this['handlePower'](_0xa02c6,0x1);break;case _0x0ebc('0xb2'):this[_0x0ebc('0xb3')](_0xa02c6,_0xa02c6[_0x0ebc('0xb4')]);break;case _0x0ebc('0xaf'):this['predictive'](_0xa02c6);break;case'booked':this[_0x0ebc('0xb3')](_0xa02c6,0x1);break;default:logger[_0x0ebc('0x64')]('Queue',_0xa02c6[_0x0ebc('0x46')],'method\x20not\x20recognized');}};Dialer[_0x0ebc('0x17')][_0x0ebc('0x8e')]=function(_0x35104b,_0xce1428){var _0x178725=_0x35104b[_0x0ebc('0xac')];var _0x3a2dbc=_0xce1428?_0x35104b[_0x0ebc('0xaa')]:_0x35104b['Interval'][_0x0ebc('0x77')];logger[_0x0ebc('0xb5')](_0x0ebc('0xb6'),_0x3a2dbc,_0x178725,_0x35104b[_0x0ebc('0x46')],util[_0x0ebc('0x44')](_0x0ebc('0xb7'),_0x35104b[_0x0ebc('0x46')],_0x35104b['id']));var _0x1b6b82=null;return Interval[_0x0ebc('0xb8')](_0x3a2dbc,_0x178725)[_0x0ebc('0x9c')](function(_0x151ac1){if(_0x151ac1===!![]){return _0x151ac1;}else{_0x35104b[_0x0ebc('0x67')]=_0xce1428?utils[_0x0ebc('0x6a')][_0x0ebc('0xb9')]:utils[_0x0ebc('0x6a')][_0x0ebc('0xa4')];_0x1b6b82=msgResponse('[ifTime][promiseAll]',_0x0ebc('0x91'),_0x0ebc('0xa6')+_0xce1428+'\x20'+_0x35104b[_0x0ebc('0x46')]+'\x20Interval\x20is\x20overtime:\x20'+util['inspect'](_0x3a2dbc,{'showHidden':![],'depth':null})+_0x0ebc('0xba')+_0x178725);}if(_0x1b6b82!==null){logger['silly'](_0x0ebc('0xbb'),_0x1b6b82);_0x1b6b82[_0x0ebc('0xbc')]=_0xce1428;throw _0x1b6b82;}})[_0x0ebc('0xa1')](function(_0x9087bd){logger['error'](_0x0ebc('0xbd'),_0x9087bd);throw msgResponse(_0x0ebc('0xbe'),'Error',util[_0x0ebc('0x43')](_0x9087bd,{'showHidden':![],'depth':null}));});};Dialer[_0x0ebc('0x17')][_0x0ebc('0x2a')]=function(_0x118eb9){if(this[_0x0ebc('0x1b')][_0x118eb9[_0x0ebc('0xbf')]]){if(this[_0x0ebc('0x22')][_0x118eb9[_0x0ebc('0xc0')]]&&this[_0x0ebc('0x22')][_0x118eb9['uniqueid']][_0x0ebc('0x3f')]!==_0x0ebc('0xc1')){this[_0x0ebc('0xc2')](this[_0x0ebc('0x1b')][_0x118eb9[_0x0ebc('0xbf')]]);this[_0x0ebc('0x22')][_0x118eb9[_0x0ebc('0xc0')]][_0x0ebc('0xc3')]=moment()[_0x0ebc('0x44')](_0x0ebc('0xc4'));}}};Dialer['prototype'][_0x0ebc('0x31')]=function(_0x44908d){var _0x20e7f8=this['uniqueId'][_0x44908d[_0x0ebc('0xc0')]];if(this[_0x0ebc('0x1b')][_0x44908d[_0x0ebc('0xbf')]]){if(_0x20e7f8&&_0x20e7f8['type']!==_0x0ebc('0xc1')){delete this[_0x0ebc('0x22')][_0x44908d['uniqueid']];this[_0x0ebc('0x1b')][_0x44908d[_0x0ebc('0xbf')]][_0x0ebc('0xc5')]+=0x1;var _0xfe9bc1=new AgentComplete(_0x20e7f8,_0x44908d);if(_0x44908d['reason']==='agent'){_0xfe9bc1[_0x0ebc('0xc6')]=this[_0x0ebc('0x1b')][_0x44908d['queue']][_0x0ebc('0xc7')]&&this[_0x0ebc('0x1b')][_0x44908d[_0x0ebc('0xbf')]]['dialAgiAfterHangupAgent']?moment()['format'](_0x0ebc('0xc4')):undefined;}hopperUtils['createHistory'](_0xfe9bc1)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0xc8')));hopperUtils[_0x0ebc('0xc9')](_0xfe9bc1)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0xca')));}}};Dialer['prototype'][_0x0ebc('0x2d')]=function(_0x28a1cd){var _0x3efdbb=this[_0x0ebc('0x22')][_0x28a1cd[_0x0ebc('0xc0')]];var _0x364d4a=this;var _0x308d9c=![];var _0x411254;var _0x44ddf1;if(this[_0x0ebc('0x1b')][_0x28a1cd[_0x0ebc('0xbf')]]){if(_0x3efdbb&&_0x3efdbb[_0x0ebc('0x3f')]!==_0x0ebc('0xc1')){delete this[_0x0ebc('0x22')][_0x28a1cd['uniqueid']];this[_0x0ebc('0xc2')](this[_0x0ebc('0x1b')][_0x28a1cd['queue']]);_0x3efdbb['droptime']=moment()[_0x0ebc('0x44')](_0x0ebc('0xc4'));var _0x4b728d=new QueueCallerAbandon(_0x3efdbb,_0x28a1cd);if(utils['getSeconds'](_0x3efdbb[_0x0ebc('0xcb')],_0x3efdbb[_0x0ebc('0xcc')])>=_0x3efdbb[_0x0ebc('0xcd')]){this[_0x0ebc('0x1b')][_0x28a1cd['queue']][_0x0ebc('0xce')]+=0x1;this['voiceQueues'][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xcf')]+=0x1;this[_0x0ebc('0x1b')][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xd0')]+=0x1;_0x4b728d[_0x0ebc('0x6d')]=0xa;_0x4b728d[_0x0ebc('0xd1')]=_0x0ebc('0xd2');_0x4b728d['dropreason']=_0x0ebc('0xd3');_0x4b728d[_0x0ebc('0xc6')]=this[_0x0ebc('0x1b')][_0x28a1cd[_0x0ebc('0xbf')]]['dialQueueProject2']?moment()[_0x0ebc('0x44')](_0x0ebc('0xc4')):undefined;_0x4b728d[_0x0ebc('0xd4')]+=0x1;_0x4b728d['countglobal']+=0x1;_0x411254=this[_0x0ebc('0x1b')][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xd5')];_0x44ddf1=this['voiceQueues'][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xd6')];hopperUtils[_0x0ebc('0xd7')](_0x4b728d,_0x4b728d[_0x0ebc('0x6d')],_0x3efdbb[_0x0ebc('0xd8')])[_0x0ebc('0x9c')](function(_0x23a068){_0x308d9c=_0x23a068['additional']==0x1;if(_0x4b728d[_0x0ebc('0xd4')]>=_0x364d4a[_0x0ebc('0x1b')][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xd9')]){_0x364d4a['queueCallerAbandonCreateState'](_0x4b728d,_0x23a068[_0x0ebc('0xda')]);}else{hopperUtils[_0x0ebc('0xdb')]({'active':![],'countdropretry':_0x4b728d['countdropretry'],'scheduledat':moment()['add'](_0x364d4a['voiceQueues'][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xd5')],_0x0ebc('0xdc'))[_0x0ebc('0x44')](_0x0ebc('0xc4')),'ContactId':_0x3efdbb[_0x0ebc('0xdd')],'ListId':_0x3efdbb[_0x0ebc('0xde')],'VoiceQueueId':_0x3efdbb['VoiceQueueId']||undefined,'CampaignId':_0x3efdbb[_0x0ebc('0xdf')]||undefined})[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0xe0')));var _0x4844b4=new History(_0x4b728d);_0x4844b4[_0x0ebc('0x6d')]=0xa;_0x4844b4[_0x0ebc('0xd1')]='Drop';_0x4844b4[_0x0ebc('0x6f')]=moment()[_0x0ebc('0x44')](_0x0ebc('0xc4'));_0x4844b4[_0x0ebc('0x6e')]=_0x4844b4[_0x0ebc('0x6f')];_0x4844b4['calleridname']=_0x4b728d[_0x0ebc('0xe1')];_0x4844b4[_0x0ebc('0xe2')]=_0x4b728d[_0x0ebc('0xe2')];hopperUtils['createHistory'](_0x4844b4)[_0x0ebc('0xa1')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x0ebc('0x9c')](function(){if(_0x308d9c)hopperUtils[_0x0ebc('0xe3')](_0x4b728d,_0x411254,_0x44ddf1)[_0x0ebc('0x9c')](function(){return 0x1;});});}else{this[_0x0ebc('0x1b')][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xe4')]+=0x1;this['voiceQueues'][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xe5')]+=0x1;_0x4b728d[_0x0ebc('0x6d')]=0xb;_0x4b728d[_0x0ebc('0xd1')]=_0x0ebc('0xe6');_0x4b728d['dropreason']=_0x0ebc('0xe7');_0x4b728d[_0x0ebc('0xe8')]+=0x1;_0x4b728d[_0x0ebc('0xe9')]+=0x1;_0x411254=this['voiceQueues'][_0x28a1cd['queue']][_0x0ebc('0xea')];_0x44ddf1=this[_0x0ebc('0x1b')][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xd6')];hopperUtils['verifyAdditionalPhones'](_0x4b728d,_0x4b728d[_0x0ebc('0x6d')],_0x3efdbb[_0x0ebc('0xd8')])[_0x0ebc('0x9c')](function(_0x58b56b){if(_0x4b728d[_0x0ebc('0xe8')]>=_0x364d4a[_0x0ebc('0x1b')][_0x28a1cd[_0x0ebc('0xbf')]][_0x0ebc('0xeb')]){_0x364d4a[_0x0ebc('0xec')](_0x4b728d,_0x58b56b[_0x0ebc('0xda')]);}else{hopperUtils[_0x0ebc('0xdb')]({'active':![],'countabandonedretry':_0x4b728d[_0x0ebc('0xe8')],'scheduledat':moment()[_0x0ebc('0xed')](_0x364d4a['voiceQueues'][_0x28a1cd['queue']][_0x0ebc('0xea')],_0x0ebc('0xdc'))[_0x0ebc('0x44')](_0x0ebc('0xc4')),'ContactId':_0x3efdbb[_0x0ebc('0xdd')],'ListId':_0x3efdbb[_0x0ebc('0xde')],'VoiceQueueId':_0x3efdbb['VoiceQueueId']||undefined,'CampaignId':_0x3efdbb[_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch(_0x0ebc('0xee')));var _0x563626=new History(_0x4b728d);_0x563626[_0x0ebc('0x6d')]=0xb;_0x563626['statedesc']=_0x0ebc('0xe6');_0x563626[_0x0ebc('0x6f')]=moment()[_0x0ebc('0x44')](_0x0ebc('0xc4'));_0x563626[_0x0ebc('0x6e')]=_0x563626[_0x0ebc('0x6f')];_0x563626[_0x0ebc('0xe1')]=_0x4b728d[_0x0ebc('0xe1')];_0x563626[_0x0ebc('0xe2')]=_0x4b728d[_0x0ebc('0xe2')];hopperUtils[_0x0ebc('0xef')](_0x563626)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0xf0')));}})[_0x0ebc('0x9c')](function(){if(_0x308d9c)hopperUtils['swapAdditionalPhones'](_0x4b728d,_0x411254,_0x44ddf1)[_0x0ebc('0x9c')](function(){return 0x1;});});}}}};Dialer[_0x0ebc('0x17')][_0x0ebc('0xf1')]=function(_0x57c3a6){if(this[_0x0ebc('0x20')][_0x57c3a6[_0x0ebc('0xc0')]]){this[_0x0ebc('0x20')][_0x57c3a6[_0x0ebc('0xc0')]][_0x0ebc('0xf2')]=_0x57c3a6[_0x0ebc('0xf2')];}if(this[_0x0ebc('0x22')][_0x57c3a6[_0x0ebc('0xc0')]]){this['uniqueId'][_0x57c3a6[_0x0ebc('0xc0')]][_0x0ebc('0xf2')]=_0x57c3a6[_0x0ebc('0xf2')];}};Dialer[_0x0ebc('0x17')][_0x0ebc('0x38')]=function(_0x1df54e){if(!this[_0x0ebc('0x20')][_0x1df54e['actionid']]){return;}var _0x2fca9c=this['voiceQueues'][this[_0x0ebc('0x20')][_0x1df54e[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]][_0x0ebc('0xf4')]||_0x0ebc('0xf5');if(_0x2fca9c==='roundrobin'){if(this['actions'][_0x1df54e[_0x0ebc('0xf3')]]&&_['isNil'](this[_0x0ebc('0x20')][_0x1df54e[_0x0ebc('0xf3')]][_0x0ebc('0xf6')])&&_0x1df54e['status']==='1'&&_0x1df54e[_0x0ebc('0xf7')]==='0'){if(this['agents'][_0x1df54e['stateinterface']]){if(!this[_0x0ebc('0x1d')][_0x1df54e['stateinterface']][_0x0ebc('0xf6')]){this[_0x0ebc('0x1d')][_0x1df54e['stateinterface']][_0x0ebc('0xf6')]=!![];this[_0x0ebc('0x20')][_0x1df54e[_0x0ebc('0xf3')]][_0x0ebc('0xf6')]=!![];this[_0x0ebc('0x20')][_0x1df54e[_0x0ebc('0xf3')]][_0x0ebc('0xf8')]=_0x1df54e[_0x0ebc('0xf8')];}}}}else if(_0x2fca9c===_0x0ebc('0xf5')){if(this['actions'][_0x1df54e[_0x0ebc('0xf3')]]){if(this[_0x0ebc('0x1d')][_0x1df54e[_0x0ebc('0xf8')]]){this[_0x0ebc('0x20')][_0x1df54e[_0x0ebc('0xf3')]][_0x0ebc('0xf8')]=_0x1df54e['stateinterface'];if(_['isNil'](this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x1df54e[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]])){this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x1df54e[_0x0ebc('0xf3')]]['queue']]=[];}this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x1df54e[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]['push'](_[_0x0ebc('0x5e')](_[_0x0ebc('0x73')](this[_0x0ebc('0x20')][_0x1df54e['actionid']],['idHopper',_0x0ebc('0xf8')]),{'status':_0x1df54e[_0x0ebc('0x87')],'paused':_0x1df54e[_0x0ebc('0xf7')]}));}}}};Dialer[_0x0ebc('0x17')]['syncQueueStatusComplete']=function(_0x180d47){if(!this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]]){return;}var _0x133ffe=this;var _0x20c3e4=this[_0x0ebc('0x1b')][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]];var _0x5d1cc3=_0x20c3e4['strategy']||_0x0ebc('0xf5');if(_0x5d1cc3===_0x0ebc('0xf9')){if(this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]]&&this[_0x0ebc('0x20')][_0x180d47['actionid']]['stateinterface']){this[_0x0ebc('0x1a')][_0x0ebc('0xfa')](this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xfb')],this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xf8')])['catch'](function(_0x1d03d2){logger['error'](_0x0ebc('0xfc'),util[_0x0ebc('0x43')](_0x1d03d2,{'showHidden':![],'depth':null}));})[_0x0ebc('0x19')](function(){_0x133ffe['updateOriginated'](_0x133ffe['voiceQueues'][_0x133ffe['actions'][_0x180d47['actionid']][_0x0ebc('0xbf')]]);_0x133ffe[_0x0ebc('0x1d')][_0x133ffe[_0x0ebc('0x20')][_0x180d47['actionid']][_0x0ebc('0xf8')]]['locked']=![];delete _0x133ffe[_0x0ebc('0x20')][_0x180d47['actionid']];unlockQueueStatus(_0x20c3e4);});}else{this[_0x0ebc('0xc2')](this[_0x0ebc('0x1b')][this[_0x0ebc('0x20')][_0x180d47['actionid']][_0x0ebc('0xbf')]]);hopperUtils[_0x0ebc('0xdb')]({'active':![],'ContactId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xdd')],'ListId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xde')],'VoiceQueueId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch(_0x0ebc('0xfd')));delete this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]];unlockQueueStatus(_0x20c3e4);}}else if(_0x5d1cc3===_0x0ebc('0xf5')){var _0x510028;if(this[_0x0ebc('0x20')][_0x180d47['actionid']]&&!_['isEmpty'](this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]])){if(this[_0x0ebc('0x28')][_0x133ffe[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]){this[_0x0ebc('0x28')][_0x133ffe[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]=this['queueBookedRR'][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]?this[_0x0ebc('0x28')][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]:this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x180d47['actionid']][_0x0ebc('0xbf')]]?this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x180d47['actionid']][_0x0ebc('0xbf')]]['_rr']||0x0:0x0;}this[_0x0ebc('0x27')][this['actions'][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]][_0x0ebc('0xfe')]=this[_0x0ebc('0x28')][this['actions'][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]];for(var _0x575d6a=0x0;_0x575d6a<this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]][_0x0ebc('0x97')];_0x575d6a+=0x1){_0x510028=rr(this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]);this['queueBookedRR'][_0x133ffe[_0x0ebc('0x20')][_0x180d47['actionid']]['queue']]=this[_0x0ebc('0x27')][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]][_0x0ebc('0xfe')];if(_0x510028['status']==='1'&&_0x510028[_0x0ebc('0xf7')]==='0'){break;}}if(!_['isNil'](_0x510028)){this[_0x0ebc('0x1d')][_0x510028[_0x0ebc('0xf8')]]['unlockRR']=_['isUndefined'](this[_0x0ebc('0x1d')][_0x510028[_0x0ebc('0xf8')]]['unlockRR'])?!![]:this['agents'][_0x510028[_0x0ebc('0xf8')]][_0x0ebc('0xff')];}loggerBooked[_0x0ebc('0x49')]('[booked][RR]',_0x180d47[_0x0ebc('0xf3')],_0x0ebc('0x100'),JSON[_0x0ebc('0x72')](_[_0x0ebc('0x73')](this[_0x0ebc('0x1d')][_0x510028['stateinterface']],[_0x0ebc('0x46'),_0x0ebc('0xff')])),_0x0ebc('0x101'),JSON[_0x0ebc('0x72')](_0x510028['idHopper']));if(!_[_0x0ebc('0x102')](_0x510028)&&_0x510028[_0x0ebc('0x87')]==='1'&&_0x510028[_0x0ebc('0xf7')]==='0'&&this[_0x0ebc('0x1d')][_0x510028[_0x0ebc('0xf8')]]['unlockRR']){this[_0x0ebc('0x1d')][_0x510028[_0x0ebc('0xf8')]][_0x0ebc('0xff')]=![];this['queueBooked'][_0x133ffe[_0x0ebc('0x20')][_0x180d47['actionid']][_0x0ebc('0xbf')]]=[];this[_0x0ebc('0x1a')][_0x0ebc('0xfa')](_0x510028['idHopper'],_0x510028[_0x0ebc('0xf8')])[_0x0ebc('0xa1')](function(_0x3b7602){logger[_0x0ebc('0x64')](_0x0ebc('0xfc'),util[_0x0ebc('0x43')](_0x3b7602,{'showHidden':![],'depth':null}));})['finally'](function(){_0x133ffe[_0x0ebc('0xc2')](_0x133ffe['voiceQueues'][_0x133ffe[_0x0ebc('0x20')][_0x180d47['actionid']][_0x0ebc('0xbf')]]);setTimeout(function(){_0x133ffe['agents'][_0x510028[_0x0ebc('0xf8')]][_0x0ebc('0xff')]=!![];loggerBooked[_0x0ebc('0x49')]('[booked][RR][finaly]',_0x180d47[_0x0ebc('0xf3')],_0x0ebc('0x100'),JSON[_0x0ebc('0x72')](_[_0x0ebc('0x73')](_0x133ffe[_0x0ebc('0x1d')][_0x510028[_0x0ebc('0xf8')]],[_0x0ebc('0x46'),_0x0ebc('0xff')])),_0x0ebc('0x101'),JSON[_0x0ebc('0x72')](_0x510028[_0x0ebc('0xfb')]));},0xc7);delete _0x133ffe['actions'][_0x180d47[_0x0ebc('0xf3')]];unlockQueueStatus(_0x20c3e4,_0x180d47[_0x0ebc('0xf3')]);});}else{loggerBooked[_0x0ebc('0x49')](_0x0ebc('0x103'));this['updateOriginated'](this[_0x0ebc('0x1b')][this['actions'][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]);hopperUtils[_0x0ebc('0xdb')]({'active':![],'ContactId':this['actions'][_0x180d47['actionid']][_0x0ebc('0xdd')],'ListId':this['actions'][_0x180d47['actionid']][_0x0ebc('0xde')],'VoiceQueueId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]];unlockQueueStatus(_0x20c3e4);}}else{loggerBooked[_0x0ebc('0x49')](_0x0ebc('0x104'));this[_0x0ebc('0xc2')](this['voiceQueues'][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]);hopperUtils[_0x0ebc('0xdb')]({'active':![],'ContactId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xdd')],'ListId':this['actions'][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xde')],'VoiceQueueId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]]['VoiceQueueId']||undefined,'CampaignId':this['actions'][_0x180d47[_0x0ebc('0xf3')]]['CampaignId']||undefined})[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x105')));delete this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]];unlockQueueStatus(_0x20c3e4);}}else{loggerBooked[_0x0ebc('0x49')](_0x0ebc('0x106'));this['updateOriginated'](this['voiceQueues'][this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xbf')]]);hopperUtils[_0x0ebc('0xdb')]({'active':![],'ContactId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xdd')],'ListId':this['actions'][_0x180d47[_0x0ebc('0xf3')]]['ListId'],'VoiceQueueId':this[_0x0ebc('0x20')][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0x107')]||undefined,'CampaignId':this['actions'][_0x180d47[_0x0ebc('0xf3')]][_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch(_0x0ebc('0x108')));delete this[_0x0ebc('0x20')][_0x180d47['actionid']];unlockQueueStatus(_0x20c3e4);}};Dialer[_0x0ebc('0x17')][_0x0ebc('0x2f')]=function(_0x5409ed){var _0x5ebb72=this[_0x0ebc('0x20')][_0x5409ed[_0x0ebc('0xf3')]];if(_0x5ebb72){delete this[_0x0ebc('0x20')][_0x5409ed[_0x0ebc('0xf3')]];_0x5ebb72[_0x0ebc('0xcc')]=moment()[_0x0ebc('0x44')](_0x0ebc('0xc4'));var _0x23aa98=_0x5ebb72[_0x0ebc('0x3f')]===_0x0ebc('0xc1')?this[_0x0ebc('0x1c')][_0x5ebb72['queue']]:this['voiceQueues'][_0x5ebb72[_0x0ebc('0x109')]()];if(_0x5409ed[_0x0ebc('0x10a')]!=='Success'){this['updateOriginated'](_0x23aa98);return this[_0x0ebc('0x10b')](_0x5ebb72,_0x23aa98,_0x5409ed)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x10c')));}this[_0x0ebc('0x22')][_0x5409ed['uniqueid']]=_0x5ebb72;}};Dialer[_0x0ebc('0x17')][_0x0ebc('0x36')]=function(_0x3ff4df){var _0x1f5695=this;var _0x240b77=this['uniqueId'][_0x3ff4df[_0x0ebc('0xc0')]];var _0x40a9f4;if(!_['isNil'](_0x3ff4df)&&!_['isNil'](_0x3ff4df['variable'])&&!_[_0x0ebc('0x102')](_0x3ff4df[_0x0ebc('0x10d')][_0x0ebc('0x10e')])&&_0x3ff4df[_0x0ebc('0x10f')]===_0x0ebc('0x110')&&_0x240b77){if(_0x240b77[_0x0ebc('0x3f')]!==_0x0ebc('0xc1')&&this[_0x0ebc('0x1b')][_0x240b77[_0x0ebc('0xbf')]]['dialAMDActive']&&_0x3ff4df[_0x0ebc('0x111')]===_0x0ebc('0x112')){delete this[_0x0ebc('0x22')][_0x3ff4df['uniqueid']];this[_0x0ebc('0xc2')](this['voiceQueues'][_0x240b77[_0x0ebc('0xbf')]]);this['voiceQueues'][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0xc5')]+=0x1;this[_0x0ebc('0x1b')][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0x113')]+=0x1;_0x40a9f4=new Hangup(_0x240b77,_0x3ff4df);_0x40a9f4[_0x0ebc('0x6d')]=0x12;_0x40a9f4[_0x0ebc('0xd1')]=_0x0ebc('0x114');_0x40a9f4[_0x0ebc('0x115')]=_0x0ebc('0x116');ami['emit'](_0x0ebc('0x117'),ut[_0x0ebc('0x118')](_0x40a9f4,'amd'));this[_0x0ebc('0x119')](_0x40a9f4,_0x0ebc('0x11a'),'[syncHangupInAMD]');}if(_0x240b77[_0x0ebc('0x3f')]!==_0x0ebc('0xc1')&&this[_0x0ebc('0x1b')][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0x11b')]&&_0x3ff4df[_0x0ebc('0x111')]==='MACHINE'){return new Promise(function(_0x27bc39,_0x5577ad){delete _0x1f5695['uniqueId'][_0x3ff4df['uniqueid']];_0x1f5695[_0x0ebc('0xc2')](_0x1f5695['voiceQueues'][_0x240b77[_0x0ebc('0xbf')]]);_0x1f5695['voiceQueues'][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0xc5')]+=0x1;_0x1f5695['voiceQueues'][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0x113')]+=0x1;var _0x5ec3d3=_0x1f5695[_0x0ebc('0x1b')][_0x240b77['queue']];var _0x387cec=new Hangup(_0x240b77,_0x3ff4df);_0x387cec[_0x0ebc('0x6d')]=0x13;_0x387cec['statedesc']=_0x0ebc('0x11c');_0x387cec[_0x0ebc('0x115')]=_0x0ebc('0x116');_0x387cec['countmachineretry']+=0x1;_0x387cec['countglobal']+=0x1;_0x387cec[_0x0ebc('0x11d')]=!![];ami[_0x0ebc('0x3e')](_0x0ebc('0x117'),ut[_0x0ebc('0x118')](_0x387cec,'amd'));hopperUtils[_0x0ebc('0xef')](_0x387cec)['catch'](loggerCatch(_0x0ebc('0x11e')));if(_0x387cec[_0x0ebc('0x11f')]+_0x387cec[_0x0ebc('0x120')]+_0x387cec[_0x0ebc('0x121')]+_0x387cec[_0x0ebc('0x122')]+_0x387cec[_0x0ebc('0xd4')]+_0x387cec['countabandonedretry']+_0x387cec[_0x0ebc('0x123')]+_0x387cec['countagentrejectretry']>=_0x5ec3d3[_0x0ebc('0x124')]){_0x1f5695[_0x0ebc('0x125')](_0x387cec,_0x27bc39,_0x5577ad,_0x0ebc('0x126'));}else{if(_0x387cec[_0x0ebc('0x123')]>=_0x5ec3d3['dialMachineMaxRetry']){_0x1f5695['createStateFinal'](_0x387cec,_0x27bc39,_0x5577ad,'reason\x2019\x20machine....');}else{hopperUtils[_0x0ebc('0xdb')]({'active':![],'countmachineretry':_0x387cec[_0x0ebc('0x123')],'scheduledat':moment()[_0x0ebc('0xed')](_0x5ec3d3[_0x0ebc('0x127')],_0x0ebc('0xdc'))['format'](_0x0ebc('0xc4')),'ContactId':_0x387cec[_0x0ebc('0xdd')],'ListId':_0x387cec[_0x0ebc('0xde')],'VoiceQueueId':_0x387cec['VoiceQueueId']||undefined,'CampaignId':_0x387cec['CampaignId']||undefined})['catch'](loggerCatch(_0x0ebc('0x128')));_0x27bc39({'reschedule':0x1});}}});}if(_0x240b77[_0x0ebc('0x3f')]==='ivr'&&this[_0x0ebc('0x1c')][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0x11b')]&&_0x3ff4df[_0x0ebc('0x111')]===_0x0ebc('0x112')){delete this[_0x0ebc('0x22')][_0x3ff4df['uniqueid']];this[_0x0ebc('0xc2')](this[_0x0ebc('0x1c')][_0x240b77[_0x0ebc('0xbf')]]);_0x40a9f4=new Hangup(_0x240b77,_0x3ff4df);_0x40a9f4[_0x0ebc('0x6d')]=0x12;_0x40a9f4[_0x0ebc('0xd1')]='HangupInAMD';_0x40a9f4[_0x0ebc('0x115')]='AMD';ami[_0x0ebc('0x3e')](_0x0ebc('0x117'),ut[_0x0ebc('0x118')](_0x40a9f4,_0x0ebc('0x11d')));this['saveInDb'](_0x40a9f4,_0x0ebc('0x129'),_0x0ebc('0x12a'));}if(_0x240b77[_0x0ebc('0x3f')]===_0x0ebc('0xc1')&&this[_0x0ebc('0x1c')][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0x11b')]&&_0x3ff4df[_0x0ebc('0x111')]==='MACHINE'){return new Promise(function(_0x2a785b,_0x1a7b6d){delete _0x1f5695[_0x0ebc('0x22')][_0x3ff4df[_0x0ebc('0xc0')]];_0x1f5695['updateOriginated'](_0x1f5695['campaigns'][_0x240b77[_0x0ebc('0xbf')]]);_0x1f5695['campaigns'][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0xc5')]+=0x1;_0x1f5695[_0x0ebc('0x1c')][_0x240b77[_0x0ebc('0xbf')]][_0x0ebc('0x113')]+=0x1;var _0x3bd75a=_0x1f5695['campaigns'][_0x240b77['queue']];var _0x449988=new Hangup(_0x240b77,_0x3ff4df);_0x449988['state']=0x13;_0x449988['statedesc']=_0x0ebc('0x11c');_0x449988['membername']=_0x0ebc('0x116');_0x449988[_0x0ebc('0x123')]+=0x1;_0x449988[_0x0ebc('0xe9')]+=0x1;_0x449988[_0x0ebc('0x11d')]=!![];ami['emit'](_0x0ebc('0x117'),ut[_0x0ebc('0x118')](_0x449988,_0x0ebc('0x11d')));hopperUtils[_0x0ebc('0xef')](_0x449988)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x11e')));if(_0x449988[_0x0ebc('0x11f')]+_0x449988[_0x0ebc('0x120')]+_0x449988[_0x0ebc('0x121')]+_0x449988['countnosuchnumberretry']+_0x449988[_0x0ebc('0xd4')]+_0x449988[_0x0ebc('0xe8')]+_0x449988['countmachineretry']+_0x449988[_0x0ebc('0x12b')]>=_0x3bd75a[_0x0ebc('0x124')]){_0x1f5695[_0x0ebc('0x125')](_0x449988,_0x2a785b,_0x1a7b6d,_0x0ebc('0x126'));}else{if(_0x449988[_0x0ebc('0x123')]>=_0x3bd75a[_0x0ebc('0x12c')]){_0x1f5695[_0x0ebc('0x12d')](_0x449988,_0x2a785b,_0x1a7b6d,_0x0ebc('0x12e'));}else{hopperUtils[_0x0ebc('0xdb')]({'active':![],'countmachineretry':_0x449988['countmachineretry'],'scheduledat':moment()[_0x0ebc('0xed')](_0x3bd75a['dialMachineRetryFrequency'],'minutes')[_0x0ebc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x449988['ContactId'],'ListId':_0x449988['ListId'],'VoiceQueueId':_0x449988[_0x0ebc('0x107')]||undefined,'CampaignId':_0x449988[_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch(_0x0ebc('0x128')));_0x2a785b({'reschedule':0x1});}}});}}};Dialer[_0x0ebc('0x17')][_0x0ebc('0x34')]=function(_0x3e9af6){var _0x64a617=this['uniqueId'][_0x3e9af6[_0x0ebc('0xc0')]];var _0x47afdc;if(_0x64a617&&_0x64a617['type']===_0x0ebc('0xc1')){delete this[_0x0ebc('0x22')][_0x3e9af6[_0x0ebc('0xc0')]];this[_0x0ebc('0xc2')](this[_0x0ebc('0x1c')][_0x64a617[_0x0ebc('0xbf')]]);this['campaigns'][_0x64a617[_0x0ebc('0xbf')]][_0x0ebc('0x12f')]+=0x1;_0x47afdc=new Hangup(_0x64a617,_0x3e9af6);hopperUtils[_0x0ebc('0xef')](_0x47afdc)[_0x0ebc('0xa1')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x0ebc('0xc9')](_0x47afdc)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x130')));}if(_0x64a617&&_0x64a617[_0x0ebc('0x3f')]!==_0x0ebc('0xc1')&&isNotNull(this[_0x0ebc('0x1b')][_0x64a617[_0x0ebc('0xbf')]][_0x0ebc('0x131')])){delete this['uniqueId'][_0x3e9af6['uniqueid']];this[_0x0ebc('0xc2')](this[_0x0ebc('0x1b')][_0x64a617[_0x0ebc('0xbf')]]);this[_0x0ebc('0x1b')][_0x64a617['queue']][_0x0ebc('0xc5')]+=0x1;this[_0x0ebc('0x1b')][_0x64a617['queue']][_0x0ebc('0x113')]+=0x1;_0x47afdc=new Hangup(_0x64a617,_0x3e9af6);_0x47afdc['state']=0x10;_0x47afdc[_0x0ebc('0xd1')]=_0x0ebc('0x132');_0x47afdc[_0x0ebc('0x115')]=_0x0ebc('0x133');hopperUtils[_0x0ebc('0xef')](_0x47afdc)['catch'](loggerCatch(_0x0ebc('0x134')));hopperUtils[_0x0ebc('0xc9')](_0x47afdc)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x130')));}if(_0x64a617&&_0x64a617[_0x0ebc('0x3f')]!==_0x0ebc('0xc1')&&!isNotNull(this['voiceQueues'][_0x64a617[_0x0ebc('0xbf')]][_0x0ebc('0x131')])){delete this[_0x0ebc('0x22')][_0x3e9af6['uniqueid']];this[_0x0ebc('0xc2')](this['voiceQueues'][_0x64a617[_0x0ebc('0xbf')]]);this[_0x0ebc('0x1b')][_0x64a617[_0x0ebc('0xbf')]][_0x0ebc('0x135')]+=0x1;_0x47afdc=new Hangup(_0x64a617,_0x3e9af6);_0x47afdc[_0x0ebc('0x6d')]=0xc;_0x47afdc[_0x0ebc('0xd1')]=_0x3e9af6[_0x0ebc('0x136')];_0x47afdc[_0x0ebc('0x115')]=_0x0ebc('0x137');hopperUtils[_0x0ebc('0xef')](_0x47afdc)['catch'](loggerCatch(_0x0ebc('0x134')));hopperUtils[_0x0ebc('0xc9')](_0x47afdc)['catch'](loggerCatch(_0x0ebc('0x130')));}};Dialer[_0x0ebc('0x17')]['syncQueueSummary']=function(_0x97600f){var _0x53afe3=this;if(!_0x53afe3[_0x0ebc('0x138')][_0x97600f['name']]){_0x53afe3['queuesSummary'][_0x97600f[_0x0ebc('0x46')]]={'running':![]};}else if(_0x53afe3[_0x0ebc('0x138')][_0x97600f['name']]['running']===!![]){return;}else if(_0x53afe3[_0x0ebc('0x138')][_0x97600f[_0x0ebc('0x46')]]['running']===![]){_0x53afe3['queuesSummary'][_0x97600f[_0x0ebc('0x46')]][_0x0ebc('0x139')]=!![];}var _0x38f25e=_0x53afe3[_0x0ebc('0x1b')][_0x97600f[_0x0ebc('0x46')]];var _0x1b278f=_0x38f25e[_0x0ebc('0x67')]!==utils['CAMPAIGN_STATUS'][_0x0ebc('0x79')];var _0x284590=utils[_0x0ebc('0x13a')](_0x38f25e);_0x38f25e[_0x0ebc('0x13b')]=utils['getQueueCampaignStatusMessage'](_0x38f25e,_0x53afe3[_0x0ebc('0x1e')]);Promise[_0x0ebc('0x13c')]()[_0x0ebc('0x9c')](function(){if(_0x38f25e[_0x0ebc('0x13b')]===utils[_0x0ebc('0x6a')][_0x0ebc('0x79')]){if(_0x1b278f){clearPredictiveAttributes(_0x38f25e);_0x97600f['startPredictive']=undefined;_0x97600f[_0x0ebc('0x25')]=undefined;}if(_0x38f25e[_0x0ebc('0x13b')]===utils[_0x0ebc('0x6a')][_0x0ebc('0x79')]){_0x97600f[_0x0ebc('0x13d')]=0x0;_0x97600f[_0x0ebc('0xf7')]=0x0;_0x97600f['inUse']=0x0;_0x97600f[_0x0ebc('0x13e')]=0x0;_0x97600f[_0x0ebc('0x13f')]=0x0;}}else if(_0x38f25e[_0x0ebc('0x13b')]===utils[_0x0ebc('0x6a')][_0x0ebc('0x140')]&&!_0x284590){return _0x53afe3[_0x0ebc('0x8e')](_0x38f25e,!![])[_0x0ebc('0x9c')](function(){return _0x53afe3[_0x0ebc('0x8e')](_0x38f25e,![]);})[_0x0ebc('0x9c')](function(){return _0x53afe3['checkDialMethod'](_0x38f25e);})['catch'](function(_0x5e2922){loggerSyncQueueSummary[_0x0ebc('0x41')]('[syncQueueSummary]',util[_0x0ebc('0x43')](_0x5e2922,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x38f25e);});}else{clearPredictiveAttributes(_0x38f25e);}})[_0x0ebc('0x9c')](function(){var _0x30a4a3=_0x97600f['compareToOutboundQueue'](_0x38f25e);if(_0x30a4a3||_0x38f25e[_0x0ebc('0x141')]){_0x38f25e['queueSummaryCountersUpdated']=![];_0x97600f[_0x0ebc('0x142')](_0x38f25e);Object[_0x0ebc('0x143')](_0x38f25e,_0x97600f);emitOutboundVoiceQueueSummary(_0x97600f);}_0x53afe3[_0x0ebc('0x138')][_0x38f25e[_0x0ebc('0x46')]][_0x0ebc('0x139')]=![];})['catch'](function(_0x50bdc2){logger[_0x0ebc('0x64')](_0x0ebc('0x144'),util['inspect'](_0x50bdc2,{'showHidden':![],'depth':null}));_0x53afe3[_0x0ebc('0x138')][_0x38f25e[_0x0ebc('0x46')]][_0x0ebc('0x139')]=![];});};Dialer[_0x0ebc('0x17')][_0x0ebc('0x32')]=_[_0x0ebc('0x145')](function(){var _0x290d56=_[_0x0ebc('0x146')](this[_0x0ebc('0x1b')],function(_0x3d1819){return _0x3d1819[_0x0ebc('0x147')];});var _0x3895d0=_[_0x0ebc('0x146')](this[_0x0ebc('0x1d')],function(_0x4b0a5d){return _0x4b0a5d[_0x0ebc('0x148')]&&_0x4b0a5d[_0x0ebc('0x87')]===_0x0ebc('0x88');});if(_0x290d56['length']>0x0&&_0x3895d0[_0x0ebc('0x97')]>0x0){return Promise['resolve']()['then'](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x290d56,'id'),previewRecallmeReminderInterval,_['map'](_0x3895d0,'id')))[_0x0ebc('0x9c')](function(_0x2a29b4){for(var _0x5c1f24=0x0;_0x5c1f24<_0x2a29b4['length'];_0x5c1f24++){var _0x182c80=_0x2a29b4[_0x5c1f24][_0x0ebc('0x149')][_0x0ebc('0x46')];if(_0x182c80)io['to'](util[_0x0ebc('0x44')](_0x0ebc('0x14a'),_0x182c80))['emit'](_0x0ebc('0x14b'),{'hopper':_0x2a29b4[_0x5c1f24]});}})[_0x0ebc('0xa1')](function(_0x5839f6){logger[_0x0ebc('0x64')](_0x0ebc('0x14c'),_0x5839f6);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0ebc('0x17')][_0x0ebc('0x3b')]=function(){var _0x8358ba=this;setInterval(function(){_0x8358ba[_0x0ebc('0x14d')](_0x8358ba['uniqueId'],'[uniqueid]');_0x8358ba[_0x0ebc('0x14d')](_0x8358ba[_0x0ebc('0x20')],_0x0ebc('0x14e'));},0x32c8);};Dialer[_0x0ebc('0x17')][_0x0ebc('0x14d')]=function(_0x30dc5f,_0x1b6905){var _0x266239=this;for(var _0x504f23 in _0x30dc5f){if(typeof _0x30dc5f[_0x504f23]!==_0x0ebc('0xa9')){this[_0x0ebc('0x14f')][_0x0ebc('0x150')](function(){if(!_[_0x0ebc('0x102')](_0x30dc5f[_0x504f23])){return ami[_0x0ebc('0x99')]({'action':'status','channel':_0x30dc5f[_0x504f23]['channel']})['catch'](function(_0x26573f){if(_0x26573f[_0x0ebc('0x67')]===_0x0ebc('0x151')){setTimeout(function(){if(_0x30dc5f[_0x504f23]&&_0x30dc5f[_0x504f23][_0x0ebc('0x3f')]!==_0x0ebc('0xc1')){_0x266239[_0x0ebc('0xc2')](_0x266239[_0x0ebc('0x1b')][_0x30dc5f[_0x504f23]['queue']]);logger[_0x0ebc('0x64')](_0x0ebc('0x152'),_0x1b6905,_0x504f23,_0x30dc5f[_0x504f23][_0x0ebc('0xbf')]);delete _0x30dc5f[_0x504f23];}if(_0x30dc5f[_0x504f23]&&_0x30dc5f[_0x504f23][_0x0ebc('0x3f')]===_0x0ebc('0xc1')){_0x266239[_0x0ebc('0xc2')](_0x266239[_0x0ebc('0x1c')][_0x30dc5f[_0x504f23][_0x0ebc('0xbf')]]);logger['error'](_0x0ebc('0x153'),_0x1b6905,_0x504f23,_0x30dc5f[_0x504f23][_0x0ebc('0xbf')]);delete _0x30dc5f[_0x504f23];}},0x2328);}});}});}}};Dialer[_0x0ebc('0x17')]['getVoiceQueueRtPauses']=function(_0x262be9){return Promise['resolve']()[_0x0ebc('0x9c')](voiceQueueRt['getVoiceQueueRtPauses'](_0x262be9))[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x154')));};Dialer[_0x0ebc('0x17')][_0x0ebc('0xc2')]=function(_0x1b7269){if(!_[_0x0ebc('0x54')](_0x1b7269)&&_0x1b7269!==null){if(typeof _0x1b7269[_0x0ebc('0x7e')]!=='undefined'){if(_0x1b7269[_0x0ebc('0x7e')]>0x0){_0x1b7269[_0x0ebc('0x7e')]-=0x1;}else{logger[_0x0ebc('0x64')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x0ebc('0x64')](_0x0ebc('0x155'));}};Dialer[_0x0ebc('0x17')]['loggerHandler']=function(_0x257dec,_0x36dad8){var _0x1f0fee=this;return function(_0x1188d1){_0x1f0fee[_0x0ebc('0xc2')](_0x36dad8);logger[_0x0ebc('0x64')](_0x257dec,util[_0x0ebc('0x43')](_0x1188d1,{'showHidden':![],'depth':null}));};};Dialer[_0x0ebc('0x17')]['emptyContact']=function(_0xfdb496,_0x56b26b,_0x64cc56){var _0x3553d5={'state':0x19,'statedesc':_0x0ebc('0x156')};this[_0x0ebc('0xc2')](_0x56b26b);this[_0x0ebc('0x119')](_['merge'](_0x3553d5,_[_0x0ebc('0x73')](_0x64cc56,[_0x0ebc('0xdd'),_0x0ebc('0xde'),_0x0ebc('0x157'),_0x0ebc('0x107'),'CampaignId'])),_0x0ebc('0x158'),_0x0ebc('0x159'));logger[_0x0ebc('0x64')](_0xfdb496);};Dialer[_0x0ebc('0x17')][_0x0ebc('0x119')]=function(_0x56616f,_0x946a9b,_0x5ccdb5){hopperUtils['createHistory'](_0x56616f)[_0x0ebc('0xa1')](loggerCatch(_0x946a9b));hopperUtils[_0x0ebc('0xc9')](_0x56616f)['catch'](loggerCatch(_0x5ccdb5));};Dialer[_0x0ebc('0x17')][_0x0ebc('0xec')]=function(_0x1400db,_0x1c1450){hopperUtils[_0x0ebc('0xef')](_0x1400db)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0xc8')));if(_0x1c1450==0x0){hopperUtils[_0x0ebc('0xc9')](_0x1400db)['catch'](loggerCatch(_0x0ebc('0x15a')));}};Dialer[_0x0ebc('0x17')][_0x0ebc('0x14c')]=function(_0x430cc8){return Promise[_0x0ebc('0x13c')]()[_0x0ebc('0x9c')](cmHopper[_0x0ebc('0x15b')](_0x430cc8['id'],previewRecallmeReminderInterval))[_0x0ebc('0x9c')](function(_0xd92cbf){for(var _0x3c9009=0x0;_0x3c9009<_0xd92cbf['length'];_0x3c9009++){var _0x313a05=_0xd92cbf[_0x3c9009]['Agent']['name'];if(_0x313a05)io['to'](util[_0x0ebc('0x44')](_0x0ebc('0x14a'),_0x313a05))[_0x0ebc('0x3e')](_0x0ebc('0x14b'),{'hopper':_0xd92cbf[_0x3c9009]});}})[_0x0ebc('0xa1')](function(){});};Dialer[_0x0ebc('0x17')][_0x0ebc('0xad')]=function(_0x14011b){var _0x51d5aa=this;return function(){_0x51d5aa[_0x0ebc('0x15c')](_0x14011b);};};Dialer[_0x0ebc('0x17')][_0x0ebc('0x15d')]=function(_0x394912,_0x165aed){var _0x2ad7ac=this;var _0x2866a9=uuid['v4']();this[_0x0ebc('0x20')][_0x2866a9]=new Action(_0x394912,_0x165aed,_0x2866a9);return new Promise(function(_0x57a61c,_0x366bed){if(_['isUndefined'](_0x394912)&&typeof _0x394912!=='object'){return _0x366bed(msgResponse(_0x0ebc('0x15e'),_0x0ebc('0x91'),_0x0ebc('0x15f')));}if(_[_0x0ebc('0x54')](_0x165aed[_0x0ebc('0x160')])||_0x165aed['phone']===null){return _0x366bed(msgResponse(_0x0ebc('0x15e'),'Failure',_0x0ebc('0x161')));}var _0x1eb769={'XMD-CALLERID':_0x2ad7ac[_0x0ebc('0x20')][_0x2866a9][_0x0ebc('0x162')](),'XMD-AGI':_0x394912[_0x0ebc('0x131')]?util[_0x0ebc('0x44')]('\x22agi://%s/square,%s\x22',ipAgi,_0x394912[_0x0ebc('0x131')]):_0x0ebc('0x163'),'XMD-AGIAFTER':_0x394912['dialQueueProject2']?util[_0x0ebc('0x44')](_0x0ebc('0x164'),ipAgi,_0x394912[_0x0ebc('0xc7')]):'NONE','XMD-QUEUE':utils['isOutboundQueue'](_0x394912)?util['format'](_0x0ebc('0x165'),_0x394912[_0x0ebc('0x46')],_0x394912[_0x0ebc('0x166')]||'',_0x394912[_0x0ebc('0x167')]?'c':'',_0x394912[_0x0ebc('0xcd')]||0x3):'NONE','XMD-CONTACTID':_0x165aed[_0x0ebc('0xdd')],'XMD-CDRTYPE':_0x0ebc('0x4'),'CALLERID(all)':_0x2ad7ac[_0x0ebc('0x20')][_0x2866a9][_0x0ebc('0x162')](),'XMD-AMD':_0x394912['dialAMDActive']?'ACTIVE':_0x0ebc('0x163'),'XMD-DESTINATION':_0x0ebc('0x110')};if(_0x394912['dialAMDActive']){_0x1eb769[_0x0ebc('0x168')]=_0x394912[_0x0ebc('0x169')]||0x9c4;_0x1eb769[_0x0ebc('0x16a')]=_0x394912['dialAMDGreeting']||0x5dc;_0x1eb769['XMD-AMDAFTERGREETINGSILENCE']=_0x394912[_0x0ebc('0x16b')]||0x320;_0x1eb769[_0x0ebc('0x16c')]=_0x394912[_0x0ebc('0x16d')]||0x1388;_0x1eb769['XMD-AMDMINWORDLENGTH']=_0x394912[_0x0ebc('0x16e')]||0x64;_0x1eb769[_0x0ebc('0x16f')]=_0x394912[_0x0ebc('0x170')]||0x32;_0x1eb769[_0x0ebc('0x171')]=_0x394912[_0x0ebc('0x172')]||0x3;_0x1eb769[_0x0ebc('0x173')]=_0x394912['dialAMDSilenceThreshold']||0x100;_0x1eb769[_0x0ebc('0x174')]=_0x394912['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x0ebc('0x175')](_0x394912)){_0x1eb769[_0x0ebc('0x176')]=_0x165aed[_0x0ebc('0x107')];}else{_0x1eb769['XMD-CAMPAIGNID']=_0x165aed['CampaignId'];}var _0x51ab04=utils[_0x0ebc('0x177')](_0x165aed[_0x0ebc('0x178')]);Object[_0x0ebc('0x143')](_0x1eb769,_0x51ab04);var _0x478a51=_0x2ad7ac[_0x0ebc('0x84')](_0x394912[_0x0ebc('0x179')])?utils[_0x0ebc('0x17a')](_0x394912[_0x0ebc('0x179')][_0x0ebc('0x17b')],_0x394912[_0x0ebc('0x17c')],_0x394912[_0x0ebc('0x17d')]>0x0?utils[_0x0ebc('0x17e')](_0x394912['dialOriginateCallerIdNumber'],_0x394912[_0x0ebc('0x17d')]):_0x394912[_0x0ebc('0x17f')]):utils[_0x0ebc('0x17a')](_[_0x0ebc('0x102')](_0x394912[_0x0ebc('0x8a')])?_0x394912[_0x0ebc('0x179')][_0x0ebc('0x17b')]:_0x394912[_0x0ebc('0x8a')]['callerid'],_0x394912[_0x0ebc('0x17c')],_0x394912[_0x0ebc('0x17d')]>0x0?utils[_0x0ebc('0x17e')](_0x394912[_0x0ebc('0x17f')],_0x394912[_0x0ebc('0x17d')]):_0x394912['dialOriginateCallerIdNumber']);if(_0x478a51){_0x1eb769[_0x0ebc('0x180')]=_0x2ad7ac[_0x0ebc('0x20')][_0x2866a9][_0x0ebc('0x181')]=utils[_0x0ebc('0x182')](_0x478a51);_0x1eb769[_0x0ebc('0x183')]=_0x165aed['phone'];}_0x394912[_0x0ebc('0x184')]=_0x1eb769;return ami[_0x0ebc('0x99')]({'actionid':_0x2866a9,'action':_0x0ebc('0x15e'),'channel':_0x2ad7ac['isTrunkReachable'](_0x394912[_0x0ebc('0x179')])?util['format'](_0x0ebc('0x185'),_0x394912['Trunk'][_0x0ebc('0x46')],isNotNull(_0x394912[_0x0ebc('0x186')])?_0x394912['dialPrefix'][_0x0ebc('0x187')]()||'':'',_0x394912[_0x0ebc('0x188')]>0x0?_0x165aed[_0x0ebc('0x160')][_0x0ebc('0x189')](_0x394912[_0x0ebc('0x188')]):_0x165aed[_0x0ebc('0x160')]):util[_0x0ebc('0x44')](_0x0ebc('0x185'),_['isNil'](_0x394912[_0x0ebc('0x8a')])?_0x394912['Trunk']['name']:_0x394912[_0x0ebc('0x8a')][_0x0ebc('0x46')],isNotNull(_0x394912[_0x0ebc('0x186')])?_0x394912['dialPrefix'][_0x0ebc('0x187')]()||'':'',_0x394912[_0x0ebc('0x188')]>0x0?_0x165aed[_0x0ebc('0x160')][_0x0ebc('0x189')](_0x394912[_0x0ebc('0x188')]):_0x165aed['phone']),'callerid':_0x478a51,'Exten':_0x0ebc('0x110'),'Context':_0x0ebc('0x18a'),'Priority':'1','variable':_0x1eb769,'timeout':(_0x394912[_0x0ebc('0x18b')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2866a9})[_0x0ebc('0x9c')](function(_0x3f76c4){return _0x57a61c(_0x3f76c4);})[_0x0ebc('0xa1')](function(_0x451f9e){_0x394912['outboundOriginateFailureCallsDay']+=0x1;var _0x42a9eb=new History(_0x2ad7ac[_0x0ebc('0x20')][_0x2866a9]);logger[_0x0ebc('0x64')](util['format'](_0x0ebc('0x18c'),JSON[_0x0ebc('0x72')](_0x451f9e)));_0x42a9eb[_0x0ebc('0x6d')]=0xe;_0x42a9eb[_0x0ebc('0xd1')]=_0x0ebc('0x18d');_0x42a9eb[_0x0ebc('0x6f')]=moment()[_0x0ebc('0x44')](_0x0ebc('0xc4'));_0x42a9eb[_0x0ebc('0x6e')]=_0x42a9eb[_0x0ebc('0x6f')];hopperUtils[_0x0ebc('0xef')](_0x42a9eb)['catch'](loggerCatch(_0x0ebc('0x18e')));_0x2ad7ac[_0x0ebc('0xc9')](_0x42a9eb)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x18e')))[_0x0ebc('0x19')](function(){delete _0x2ad7ac[_0x0ebc('0x20')][_0x2866a9];return _0x366bed(msgResponse('originate',_0x0ebc('0x83'),_0x0ebc('0x18f')));});});});};Dialer['prototype'][_0x0ebc('0x190')]=function(_0x21edd5,_0x12224f,_0x4a5970){var _0x39be79=new History(_0x12224f);if(_0x39be79[_0x0ebc('0x11f')]+_0x39be79[_0x0ebc('0x120')]+_0x39be79[_0x0ebc('0x121')]+_0x39be79[_0x0ebc('0x122')]+_0x39be79[_0x0ebc('0xd4')]+_0x39be79[_0x0ebc('0xe8')]+_0x39be79[_0x0ebc('0x123')]+_0x39be79[_0x0ebc('0x12b')]>=_0x4a5970[_0x0ebc('0x124')]-0x1){return!![];}switch(_0x21edd5){case 0x3:if(_0x39be79[_0x0ebc('0x121')]>=_0x4a5970['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x39be79[_0x0ebc('0x121')]+=0x1,'scheduledat':moment()[_0x0ebc('0xed')](_0x4a5970[_0x0ebc('0x191')],'minutes')[_0x0ebc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x39be79[_0x0ebc('0xdd')],'ListId':_0x39be79[_0x0ebc('0xde')],'VoiceQueueId':_0x39be79[_0x0ebc('0x107')]||undefined,'CampaignId':_0x39be79[_0x0ebc('0xdf')]||undefined})[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x192')));break;case 0x5:if(_0x39be79[_0x0ebc('0x11f')]>=_0x4a5970[_0x0ebc('0x193')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x39be79[_0x0ebc('0x11f')]+=0x1,'scheduledat':moment()[_0x0ebc('0xed')](_0x4a5970[_0x0ebc('0x194')],_0x0ebc('0xdc'))[_0x0ebc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x39be79['ContactId'],'ListId':_0x39be79[_0x0ebc('0xde')],'VoiceQueueId':_0x39be79[_0x0ebc('0x107')]||undefined,'CampaignId':_0x39be79[_0x0ebc('0xdf')]||undefined})[_0x0ebc('0xa1')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x39be79[_0x0ebc('0x120')]>=_0x4a5970[_0x0ebc('0x195')]-0x1){return!![];}hopperUtils[_0x0ebc('0xdb')]({'active':![],'countcongestionretry':_0x39be79[_0x0ebc('0x120')]+=0x1,'scheduledat':moment()[_0x0ebc('0xed')](_0x4a5970[_0x0ebc('0x196')],_0x0ebc('0xdc'))['format'](_0x0ebc('0xc4')),'ContactId':_0x39be79[_0x0ebc('0xdd')],'ListId':_0x39be79[_0x0ebc('0xde')],'VoiceQueueId':_0x39be79['VoiceQueueId']||undefined,'CampaignId':_0x39be79['CampaignId']||undefined})['catch'](loggerCatch(_0x0ebc('0x197')));break;case 0x0:if(_0x39be79[_0x0ebc('0x122')]>=_0x4a5970[_0x0ebc('0x198')]-0x1){return!![];}else{hopperUtils[_0x0ebc('0xdb')]({'active':![],'countnosuchnumberretry':_0x39be79['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x4a5970[_0x0ebc('0x199')],_0x0ebc('0xdc'))[_0x0ebc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x39be79[_0x0ebc('0xdd')],'ListId':_0x39be79[_0x0ebc('0xde')],'VoiceQueueId':_0x39be79[_0x0ebc('0x107')]||undefined,'CampaignId':_0x39be79[_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch(_0x0ebc('0x19a')));}break;case 0xa:if(_0x39be79[_0x0ebc('0xd4')]>=_0x4a5970[_0x0ebc('0xd9')]-0x1){return!![];}hopperUtils[_0x0ebc('0xdb')]({'active':![],'countdropretry':_0x39be79[_0x0ebc('0xd4')]+=0x1,'scheduledat':moment()['add'](_0x4a5970[_0x0ebc('0xd5')],_0x0ebc('0xdc'))[_0x0ebc('0x44')](_0x0ebc('0xc4')),'ContactId':_0x39be79[_0x0ebc('0xdd')],'ListId':_0x39be79[_0x0ebc('0xde')],'VoiceQueueId':_0x39be79[_0x0ebc('0x107')]||undefined,'CampaignId':_0x39be79[_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch(_0x0ebc('0xe0')));break;case 0xb:if(_0x39be79['countabandonedretry']>=_0x4a5970[_0x0ebc('0xeb')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x39be79[_0x0ebc('0xe8')]+=0x1,'scheduledat':moment()[_0x0ebc('0xed')](_0x4a5970[_0x0ebc('0xea')],_0x0ebc('0xdc'))[_0x0ebc('0x44')](_0x0ebc('0xc4')),'ContactId':_0x39be79['ContactId'],'ListId':_0x39be79[_0x0ebc('0xde')],'VoiceQueueId':_0x39be79[_0x0ebc('0x107')]||undefined,'CampaignId':_0x39be79[_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x39be79[_0x0ebc('0x123')]>=_0x4a5970[_0x0ebc('0x12c')]-0x1){return!![];}hopperUtils[_0x0ebc('0xdb')]({'active':![],'countmachineretry':_0x39be79[_0x0ebc('0x123')]+=0x1,'scheduledat':moment()[_0x0ebc('0xed')](_0x4a5970[_0x0ebc('0x127')],_0x0ebc('0xdc'))[_0x0ebc('0x44')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x39be79[_0x0ebc('0xdd')],'ListId':_0x39be79[_0x0ebc('0xde')],'VoiceQueueId':_0x39be79['VoiceQueueId']||undefined,'CampaignId':_0x39be79['CampaignId']||undefined})[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x128')));break;case 0x14:if(_0x39be79[_0x0ebc('0x12b')]>=_0x4a5970[_0x0ebc('0x19b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x39be79[_0x0ebc('0x12b')]+=0x1,'scheduledat':moment()[_0x0ebc('0xed')](_0x4a5970['dialAgentRejectRetryFrequency'],_0x0ebc('0xdc'))[_0x0ebc('0x44')](_0x0ebc('0xc4')),'ContactId':_0x39be79[_0x0ebc('0xdd')],'ListId':_0x39be79['ListId'],'VoiceQueueId':_0x39be79[_0x0ebc('0x107')]||undefined,'CampaignId':_0x39be79[_0x0ebc('0xdf')]||undefined})['catch'](loggerCatch(_0x0ebc('0x19c')));break;default:return!![];}};Dialer['prototype'][_0x0ebc('0x10b')]=function(_0x3da652,_0xb76fad,_0x1d0cd6){var _0x48610a=this;var _0x2b6e03=new History(_0x3da652);var _0x217a5b=![];var _0x2564c8;var _0xe2fc92;return new Promise(function(_0x8f04d,_0x3906d6){if(_[_0x0ebc('0x54')](_0xb76fad)&&typeof _0xb76fad!==_0x0ebc('0x19d')){return _0x3906d6(msgResponse(_0x0ebc('0x19e'),_0x0ebc('0x91'),_0x0ebc('0x19f')));}if(_[_0x0ebc('0x54')](_0x1d0cd6)&&typeof _0x1d0cd6!==_0x0ebc('0x19d')){return _0x3906d6(msgResponse(_0x0ebc('0x19e'),_0x0ebc('0x91'),_0x0ebc('0x1a0')));}hopperUtils[_0x0ebc('0xd7')](_0x2b6e03,_0x1d0cd6[_0x0ebc('0x1a1')],_0xb76fad)[_0x0ebc('0x9c')](function(_0x478181){if(_0x478181[_0x0ebc('0xda')]==0x1)_0x217a5b=!![];switch(_0x1d0cd6['reason']){case'0':_0xb76fad[_0x0ebc('0x1a2')]+=0x1;_0x2b6e03[_0x0ebc('0x6d')]=0x0;_0x2b6e03[_0x0ebc('0xd1')]=_0x0ebc('0x1a3');_0x2b6e03[_0x0ebc('0x122')]+=0x1;_0x2b6e03['countglobal']+=0x1;ami['emit'](_0x0ebc('0x1a4'),ut[_0x0ebc('0x118')](_0x3da652,_0x0ebc('0x1a5')));_0x2564c8=_0xb76fad[_0x0ebc('0x199')];_0xe2fc92=_0xb76fad['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x2b6e03)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x11e')));if(_0x48610a['checkRetriveMax'](0x0,_0x3da652,_0xb76fad)&&!_0x217a5b){if(_0x2b6e03['countnosuchnumberretry']>=_0xb76fad['dialNoSuchNumberMaxRetry']){_0x48610a[_0x0ebc('0x12d')](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1a6'));}else{_0x48610a[_0x0ebc('0x125')](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1a6'));}}break;case'3':_0xb76fad[_0x0ebc('0x1a7')]+=0x1;_0x2b6e03[_0x0ebc('0x6d')]=0x3;_0x2b6e03[_0x0ebc('0xd1')]=_0x0ebc('0x1a8');_0x2b6e03[_0x0ebc('0x121')]+=0x1;_0x2b6e03[_0x0ebc('0xe9')]+=0x1;var _0x1c32b6=ut['buildNoAnswerEventPayload'](_0x3da652,_0xb76fad);ami[_0x0ebc('0x3e')](_0x0ebc('0x1a9'),_0x1c32b6);_0x2564c8=_0xb76fad[_0x0ebc('0x191')];_0xe2fc92=_0xb76fad[_0x0ebc('0xd6')];hopperUtils[_0x0ebc('0xef')](_0x2b6e03)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x1aa')));if(_0x48610a[_0x0ebc('0x190')](0x3,_0x3da652,_0xb76fad)&&!_0x217a5b){if(_0x2b6e03['countnoanswerretry']>=_0xb76fad['dialNoAnswerMaxRetry']){_0x48610a['createStateFinal'](_0x2b6e03,_0x8f04d,_0x3906d6,'reason\x203\x20ringing\x20no\x20answer');}else{_0x48610a[_0x0ebc('0x125')](_0x2b6e03,_0x8f04d,_0x3906d6,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0xb76fad[_0x0ebc('0x1ab')]+=0x1;_0x2b6e03[_0x0ebc('0x6d')]=0x5;_0x2b6e03[_0x0ebc('0xd1')]=_0x0ebc('0x1ac');_0x2b6e03[_0x0ebc('0x11f')]+=0x1;_0x2b6e03[_0x0ebc('0xe9')]+=0x1;ami[_0x0ebc('0x3e')](_0x0ebc('0x1ad'),ut[_0x0ebc('0x118')](_0x3da652,_0x0ebc('0x1ae')));_0x2564c8=_0xb76fad[_0x0ebc('0x194')];_0xe2fc92=_0xb76fad[_0x0ebc('0xd6')];hopperUtils[_0x0ebc('0xef')](_0x2b6e03)[_0x0ebc('0xa1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x48610a['checkRetriveMax'](0x5,_0x3da652,_0xb76fad)&&!_0x217a5b){if(_0x2b6e03[_0x0ebc('0x11f')]>=_0xb76fad['dialBusyMaxRetry']){_0x48610a[_0x0ebc('0x12d')](_0x2b6e03,_0x8f04d,_0x3906d6,'reason\x205\x20busy');}else{_0x48610a[_0x0ebc('0x125')](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1af'));}}break;case'8':_0xb76fad['outboundCongestionCallsDay']+=0x1;_0x2b6e03[_0x0ebc('0x6d')]=0x8;_0x2b6e03[_0x0ebc('0xd1')]='Congestion';_0x2b6e03[_0x0ebc('0x120')]+=0x1;_0x2b6e03[_0x0ebc('0xe9')]+=0x1;_0x2564c8=_0xb76fad[_0x0ebc('0x196')];_0xe2fc92=_0xb76fad[_0x0ebc('0xd6')];ami[_0x0ebc('0x3e')]('custom:agentcongestion',ut['buildObj'](_0x3da652,_0x0ebc('0x1b0')));hopperUtils[_0x0ebc('0xef')](_0x2b6e03)[_0x0ebc('0xa1')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x48610a[_0x0ebc('0x190')](0x8,_0x3da652,_0xb76fad)&&!_0x217a5b){if(_0x2b6e03[_0x0ebc('0x120')]>=_0xb76fad[_0x0ebc('0x195')]){_0x48610a['createStateFinal'](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1b1'));}else{_0x48610a[_0x0ebc('0x125')](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1b1'));}}break;case'11':_0xb76fad['outboundAbandonedCallsDay']+=0x1;_0x2b6e03[_0x0ebc('0x6d')]=0xb;_0x2b6e03[_0x0ebc('0xd1')]=_0x0ebc('0xe6');_0x2b6e03[_0x0ebc('0xe8')]+=0x1;_0x2b6e03[_0x0ebc('0xe9')]+=0x1;_0x2564c8=_0xb76fad[_0x0ebc('0xea')];_0xe2fc92=_0xb76fad[_0x0ebc('0xd6')];hopperUtils[_0x0ebc('0xef')](_0x2b6e03)[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0xf0')));if(_0x48610a['checkRetriveMax'](0xb,_0x3da652,_0xb76fad)&&!_0x217a5b){if(_0x2b6e03[_0x0ebc('0xe8')]>=_0xb76fad[_0x0ebc('0xeb')]){_0x48610a['createStateFinal'](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1b2'));}else{_0x48610a[_0x0ebc('0x125')](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1b2'));}}break;case'20':_0xb76fad[_0x0ebc('0x1b3')]+=0x1;_0x2b6e03[_0x0ebc('0x6d')]=0x14;_0x2b6e03['statedesc']=_0x0ebc('0x1b4');_0x2b6e03[_0x0ebc('0x12b')]+=0x1;_0x2b6e03[_0x0ebc('0xe9')]+=0x1;_0x2564c8=_0xb76fad[_0x0ebc('0x1b5')];_0xe2fc92=_0xb76fad['callAdditionalPhoneAfterMin'];ami[_0x0ebc('0x3e')](_0x0ebc('0x1b6'),ut[_0x0ebc('0x118')](_0x3da652,_0x0ebc('0x1b7')));hopperUtils['createHistory'](_0x2b6e03)[_0x0ebc('0xa1')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x48610a[_0x0ebc('0x190')](0x14,_0x3da652,_0xb76fad)&&!_0x217a5b){if(_0x2b6e03['countagentrejectretry']>=_0xb76fad['dialAgentRejectMaxRetry']){_0x48610a[_0x0ebc('0x12d')](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1b8'));}else{_0x48610a['stateGlobal'](_0x2b6e03,_0x8f04d,_0x3906d6,_0x0ebc('0x1b8'));}}break;default:_0xb76fad[_0x0ebc('0x135')]+=0x1;_0x2b6e03[_0x0ebc('0x6d')]=0xc;_0x2b6e03[_0x0ebc('0xd1')]=_0x1d0cd6[_0x0ebc('0x1a1')];_0x2564c8=_0xb76fad[_0x0ebc('0x1b5')];_0xe2fc92=_0xb76fad[_0x0ebc('0xd6')];hopperUtils[_0x0ebc('0xef')](_0x2b6e03)[_0x0ebc('0xa1')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x48610a['checkRetriveMax'](_0x1d0cd6['reason'],_0x3da652,_0xb76fad)&&!_0x217a5b){if(_0x2b6e03['countbusyretry']+_0x2b6e03['countcongestionretry']+_0x2b6e03[_0x0ebc('0x121')]+_0x2b6e03[_0x0ebc('0x122')]+_0x2b6e03[_0x0ebc('0xd4')]+_0x2b6e03[_0x0ebc('0xe8')]+_0x2b6e03[_0x0ebc('0x123')]+_0x2b6e03[_0x0ebc('0x12b')]>=_0xb76fad[_0x0ebc('0x124')]){_0x48610a['stateGlobal'](_0x2b6e03,_0x8f04d,_0x3906d6,_0x1d0cd6['reason']);}else{_0x48610a[_0x0ebc('0x12d')](_0x2b6e03,_0x8f04d,_0x3906d6,_0x1d0cd6[_0x0ebc('0x1a1')]);}}}})[_0x0ebc('0x9c')](function(){if(_0x217a5b){hopperUtils['swapAdditionalPhones'](_0x2b6e03,_0x2564c8,_0xe2fc92)[_0x0ebc('0x9c')](function(){return _0x8f04d(0x1);});}});});};Dialer['prototype']['stateGlobal']=function(_0x3b8e6a,_0x40e47d,_0x3147e1,_0x1429da){var _0x116d5b=new Final(_0x3b8e6a);_0x116d5b[_0x0ebc('0x6d')]=0xf;_0x116d5b['statedesc']=_0x0ebc('0x1b9');this['createStateFinal'](_0x116d5b,_0x40e47d,_0x3147e1,_0x1429da);};Dialer[_0x0ebc('0x17')][_0x0ebc('0x12d')]=function(_0x35fc4b,_0x46e472,_0x3381bf,_0x463d60){hopperUtils[_0x0ebc('0xc9')](_0x35fc4b)[_0x0ebc('0x9c')](function(){return _0x46e472(msgResponse(_0x0ebc('0x19e'),_0x0ebc('0x1ba'),_0x463d60));})[_0x0ebc('0xa1')](function(){return _0x3381bf(msgResponse(_0x0ebc('0x1bb'),'Failure','contact\x20not\x20moved'));});};Dialer[_0x0ebc('0x17')][_0x0ebc('0xaf')]=function(_0x98dba3){var _0x4652b9=_0x98dba3[_0x0ebc('0x1bc')]/0x64;var _0x175049=_0x98dba3[_0x0ebc('0xcf')]/(_0x98dba3['outboundDropCallsDayTimeout']+_0x98dba3[_0x0ebc('0xc5')]);var _0xa3429d=Math['round'](_0x98dba3[_0x0ebc('0x1bd')]*(_0x98dba3['predictiveIntervalMaxThreshold']/0x64));var _0x54ebb0=Math[_0x0ebc('0x1be')](_0x98dba3[_0x0ebc('0x1bd')]*(_0x98dba3['predictiveIntervalMinThreshold']/0x64));var _0x2f764e=_0x98dba3[_0x0ebc('0x13d')]+_0x98dba3[_0x0ebc('0x13e')];var _0x109dd9=Math['floor'](_0x98dba3[_0x0ebc('0x1bf')]*_0x98dba3['erlangAbandonmentRate']*_0x98dba3[_0x0ebc('0x1c0')]*_0x98dba3['predictiveIntervalMultiplicativeFactor']);if(_[_0x0ebc('0x54')](_0x98dba3['startProgressive'])){if(!_[_0x0ebc('0x54')](_0x98dba3['startPredictive'])){_0x98dba3[_0x0ebc('0x24')]=undefined;loggerPredictive['error'](_0x0ebc('0x1c1'),_0x0ebc('0x1c2'));}if(!_[_0x0ebc('0x54')](_0x98dba3[_0x0ebc('0x62')])){loggerPredictive[_0x0ebc('0x64')](_0x0ebc('0x1c1'),_0x0ebc('0x1c3'));clearInterval(_0x98dba3[_0x0ebc('0x62')]);_0x98dba3['handlePredictive']=undefined;}_0x98dba3['startProgressive']=moment()[_0x0ebc('0x44')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x98dba3[_0x0ebc('0x46')],'collection\x20data\x20in\x20progressive\x20at',_0x98dba3['startProgressive']);this[_0x0ebc('0xb3')](_0x98dba3,0x1);}else if(ifInterval(_0x98dba3[_0x0ebc('0x1c4')],_0x98dba3[_0x0ebc('0x25')])){this[_0x0ebc('0xb3')](_0x98dba3,0x1);loggerPredictiveCalls[_0x0ebc('0x49')](_0x0ebc('0x1c5'),_0x98dba3[_0x0ebc('0x25')],_0x98dba3[_0x0ebc('0x46')]);_0x98dba3['erlangCalls']=0x0;_0x98dba3[_0x0ebc('0xd0')]=0x0;}else if(_0x4652b9<_0x175049&&_0x98dba3[_0x0ebc('0x1c6')]===_0x0ebc('0x1c7')){clearPredictiveAttributes(_0x98dba3);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x1c8'),_0x0ebc('0x1c9'),_0x175049,_0x0ebc('0x25'),_0x98dba3[_0x0ebc('0x46')]);}else if(_0x109dd9<_0x98dba3[_0x0ebc('0xd0')]&&_0x98dba3[_0x0ebc('0x1c6')]==='dropRate'){clearPredictiveAttributes(_0x98dba3);loggerPredictive[_0x0ebc('0x49')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20',_0x109dd9,'Drop\x20in\x20this\x20interval',_0x98dba3[_0x0ebc('0xd0')],'startProgressive',_0x98dba3[_0x0ebc('0x46')]);}else if(!ifInterval(_0x98dba3[_0x0ebc('0x1c4')],_0x98dba3[_0x0ebc('0x25')])&&_['isUndefined'](_0x98dba3[_0x0ebc('0x24')])&&!_[_0x0ebc('0x54')](_0x98dba3['startProgressive'])){_0x98dba3[_0x0ebc('0x24')]=moment()[_0x0ebc('0x44')](_0x0ebc('0xc4'));loggerPredictive['info'](_0x98dba3[_0x0ebc('0x46')],_0x0ebc('0x1ca'),_0x98dba3[_0x0ebc('0x24')]);hopperUtils[_0x0ebc('0x1cb')](_0x98dba3[_0x0ebc('0x1c4')])['then'](this[_0x0ebc('0x1cc')](_0x98dba3))['then'](mergeDataErlangB(_0x98dba3))[_0x0ebc('0x9c')](this[_0x0ebc('0x1cd')](_0x98dba3))['catch'](loggerCatchPredictive(_0x0ebc('0x1ce'),_0x98dba3));}else if(!ifInterval(_0x98dba3['dialPredictiveInterval'],_0x98dba3[_0x0ebc('0x24')])){_0x98dba3['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x98dba3[_0x0ebc('0x24')]=moment()['format'](_0x0ebc('0xc4'));loggerPredictive[_0x0ebc('0x49')](_0x98dba3[_0x0ebc('0x46')],_0x0ebc('0x1cf'),_0x98dba3[_0x0ebc('0x24')]);clearInterval(_0x98dba3['handlePredictive']);_0x98dba3['handlePredictive']=undefined;hopperUtils[_0x0ebc('0x1cb')](_0x98dba3[_0x0ebc('0x1c4')])['then'](this[_0x0ebc('0x1cc')](_0x98dba3))[_0x0ebc('0x9c')](mergeDataErlangB(_0x98dba3))[_0x0ebc('0x9c')](this[_0x0ebc('0x1cd')](_0x98dba3))[_0x0ebc('0xa1')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x98dba3));}else if(_0x98dba3['predictiveIntervalAvailable']&&_0x2f764e<_0x98dba3[_0x0ebc('0x1bd')]-_0x54ebb0){clearPredictiveAttributes(_0x98dba3);loggerPredictive[_0x0ebc('0x49')](_0x98dba3[_0x0ebc('0x46')],_0x0ebc('0x1d0'),_0x2f764e,_0x0ebc('0x1d1'),_0x98dba3[_0x0ebc('0x1bd')],'-',_0x54ebb0,'=',_0x98dba3['predictiveIntervalAvailable']-_0x54ebb0,')');}else if(_0x98dba3['predictiveIntervalAvailable']&&_0x2f764e>_0x98dba3[_0x0ebc('0x1bd')]+_0xa3429d){clearPredictiveAttributes(_0x98dba3);loggerPredictive[_0x0ebc('0x49')](_0x98dba3[_0x0ebc('0x46')],_0x0ebc('0x1d0'),_0x2f764e,_0x0ebc('0x1d2'),_0x98dba3['predictiveIntervalAvailable'],'+',_0xa3429d,'=',_0x98dba3['predictiveIntervalAvailable']+_0xa3429d,')');}};Dialer[_0x0ebc('0x17')]['getDataPredictive']=function(_0x50b91b){var _0x1cf6f0=this;return function(_0x8621da){return new Promise(function(_0x19fff2,_0x27b46c){_['merge'](_0x50b91b,_0x8621da[0x0]);if(checkGetDataPredictive(_0x8621da[0x0])){var _0x3fb680=_0x50b91b['predictiveIntervalAvailable']=_0x50b91b[_0x0ebc('0x13e')]+_0x50b91b['available'];var _0x4a5b6f=_0x50b91b['dialPredictiveInterval']*0x3c;var _0x2c4754=_0x8621da[0x0]['predictiveIntervalAvgTalktime']+_0x8621da[0x0][_0x0ebc('0x50')];var _0x280699=(_0x8621da[0x0][_0x0ebc('0x4c')]+_0x8621da[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x8621da[0x0][_0x0ebc('0xe4')])/_0x8621da[0x0]['predictiveIntervalTotalCalls'];_0x50b91b[_0x0ebc('0x1c0')]=_0x280699>0x0?_0x280699:0x1;switch(_0x50b91b['dialPredictiveOptimization']){case _0x0ebc('0x1c7'):var _0x27e01f=_0x50b91b['dialPredictiveOptimizationPercentage']/0x64;return _0x1cf6f0[_0x0ebc('0x1d3')](_0x3fb680,_0x4a5b6f,_0x2c4754,_0x280699,_0x27e01f)['then'](function(_0x234e3b){return _0x19fff2(_0x234e3b);});case _0x0ebc('0x1d4'):var _0x43c33c=_0x50b91b[_0x0ebc('0x1bc')]/0x64;return _0x1cf6f0[_0x0ebc('0x1d5')](_0x3fb680,_0x4a5b6f,_0x2c4754,_0x280699,_0x43c33c)[_0x0ebc('0x9c')](function(_0x1d4c01){return _0x19fff2(_0x1d4c01);});default:return _0x27b46c(msgResponse(_0x0ebc('0x1d6'),_0x0ebc('0x91'),_0x0ebc('0x1d7')));}}else{return _0x27b46c(msgResponse(_0x0ebc('0x1d6'),_0x0ebc('0x91'),'check\x20failure'));}});};};Dialer[_0x0ebc('0x17')][_0x0ebc('0x1d8')]=function(_0x3b364e){var _0x4db686=this;return function(_0xbd8c64){return new Promise(function(_0x37b5f5,_0x4d19c6){_[_0x0ebc('0x5e')](_0x3b364e,_0xbd8c64[0x0]);if(checkGetDataPredictive(_0xbd8c64[0x0])){loggerPredictive[_0x0ebc('0x49')](JSON[_0x0ebc('0x72')](_0xbd8c64[0x0]));if(_0x3b364e['dialPredictiveOptimization']===_0x0ebc('0x1c7')){return _0x4db686[_0x0ebc('0x1d9')](_0x3b364e['id'])['then'](function(_0x58207b){var _0x2b9e0f=_0x3b364e['loggedIn']-_0x58207b[0x0][_0x0ebc('0x1da')];var _0x5acf43=_0x3b364e[_0x0ebc('0x1c4')]*0x3c;var _0x25e674=_0xbd8c64[0x0]['predictiveIntervalAvgTalktime']+_0xbd8c64[0x0]['predictiveIntervalAvgHoldtime'];var _0x576084=(_0xbd8c64[0x0][_0x0ebc('0x4c')]+_0xbd8c64[0x0][_0x0ebc('0xce')]+_0xbd8c64[0x0][_0x0ebc('0xe4')])/_0xbd8c64[0x0][_0x0ebc('0x4b')];var _0x364462=_0x3b364e[_0x0ebc('0x1bc')]/0x64;_0x3b364e[_0x0ebc('0x1db')]=_0x58207b[0x0]['outboundQueuePauses']||0x0;_0x3b364e['predictiveIntervalHitRate']=_0x576084>0x0?_0x576084:0x1;return _0x4db686[_0x0ebc('0x1d3')](_0x2b9e0f,_0x5acf43,_0x25e674,_0x576084,_0x364462);})[_0x0ebc('0x9c')](function(_0x13a390){return _0x37b5f5(_0x13a390);})[_0x0ebc('0xa1')](function(_0x3c791b){return _0x4d19c6(msgResponse(_0x0ebc('0x1dc'),'Failure',JSON[_0x0ebc('0x72')](_0x3c791b)));});}if(_0x3b364e[_0x0ebc('0x1c6')]===_0x0ebc('0x1d4')){return _0x4db686[_0x0ebc('0x1d9')](_0x3b364e['id'])[_0x0ebc('0x9c')](function(_0x521ced){var _0x1c686f=_0x3b364e[_0x0ebc('0x1dd')]-_0x521ced[0x0][_0x0ebc('0x1da')];var _0x23d295=_0x3b364e[_0x0ebc('0x1c4')]*0x3c;var _0x5d49cb=_0xbd8c64[0x0]['predictiveIntervalAvgTalktime']+_0xbd8c64[0x0][_0x0ebc('0x50')];var _0x934f3a=(_0xbd8c64[0x0][_0x0ebc('0x4c')]+_0xbd8c64[0x0]['predictiveIntervalDroppedCallsTimeout']+_0xbd8c64[0x0][_0x0ebc('0xe4')])/_0xbd8c64[0x0][_0x0ebc('0x4b')];var _0x590ec2=_0x3b364e[_0x0ebc('0x1bc')]/0x64;_0x3b364e[_0x0ebc('0x1db')]=_0x521ced[0x0]['outboundQueuePauses']||0x0;_0x3b364e[_0x0ebc('0x1c0')]=_0x934f3a>0x0?_0x934f3a:0x1;return _0x4db686[_0x0ebc('0x1d5')](_0x1c686f,_0x23d295,_0x5d49cb,_0x934f3a,_0x590ec2);})['then'](function(_0x7a18e4){return _0x37b5f5(_0x7a18e4);})[_0x0ebc('0xa1')](function(_0x5abbec){return _0x4d19c6(msgResponse(_0x0ebc('0x1dc'),_0x0ebc('0x91'),JSON[_0x0ebc('0x72')](_0x5abbec)));});}}else{return _0x4d19c6(msgResponse('[getDataPredictive]',_0x0ebc('0x91'),_0x0ebc('0x1de')));}});};};Dialer[_0x0ebc('0x17')][_0x0ebc('0x1cd')]=function(_0x137895){var _0x1d375d=this;return function(){var _0x1f2c8e=0x0;var _0x557f2d=Math[_0x0ebc('0x1df')](_0x137895['erlangCallToSecond']*0x3e8);if(_0x557f2d>0x0){_0x557f2d=_0x557f2d<0x64?0x64:_0x557f2d;loggerPredictive[_0x0ebc('0x49')](_0x137895[_0x0ebc('0x46')],'one\x20call\x20every:',_0x557f2d,'milliseconds');_0x137895['handlePredictive']=setInterval(function(){_0x1d375d[_0x0ebc('0x62')](_0x137895);loggerPredictiveCalls[_0x0ebc('0x49')]('[handlePredictive]',_0x1f2c8e+=0x1);},_0x557f2d);}else{loggerPredictive[_0x0ebc('0x49')](_0x137895['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0ebc('0x17')][_0x0ebc('0x1e0')]=function(_0x1e2d00,_0x5e34ba){var _0x40a96c=this;return function(_0x3838e6){if(_[_0x0ebc('0x48')](_0x3838e6)){if(_[_0x0ebc('0x102')](_0x5e34ba[_0x0ebc('0x157')])||!_0x5e34ba['recallme']){if(_0x1e2d00[_0x0ebc('0xb0')]===_0x0ebc('0x5')){_0x1e2d00[_0x0ebc('0x70')]=_[_0x0ebc('0x54')](_0x1e2d00['queueStatusComplete'])?!![]:_0x1e2d00['queueStatusComplete'];var _0x58ae53=uuid['v4']();_0x40a96c[_0x0ebc('0x20')][_0x58ae53]=new Action(_0x1e2d00,_0x5e34ba,_0x58ae53);loggerBooked[_0x0ebc('0x49')]('[booked][checkContactBlack]',_0x58ae53,_0x0ebc('0x1e1'),JSON[_0x0ebc('0x72')](_0x1e2d00[_0x0ebc('0x70')]),'Queue:\x20',_0x1e2d00['name']);if(_0x1e2d00[_0x0ebc('0x70')]){_0x1e2d00['queueStatusComplete']=![];_0x40a96c[_0x0ebc('0x27')][_0x40a96c[_0x0ebc('0x20')][_0x58ae53][_0x0ebc('0xbf')]]=[];ami[_0x0ebc('0x99')]({'actionid':_0x58ae53,'action':_0x0ebc('0x1e2'),'queue':_0x1e2d00[_0x0ebc('0x46')]})[_0x0ebc('0xa1')](function(){_0x40a96c[_0x0ebc('0xc2')](_0x1e2d00);hopperUtils[_0x0ebc('0xdb')]({'active':![],'ContactId':_0x40a96c['actions'][_0x58ae53][_0x0ebc('0xdd')],'ListId':_0x40a96c['actions'][_0x58ae53][_0x0ebc('0xde')],'VoiceQueueId':_0x40a96c[_0x0ebc('0x20')][_0x58ae53]['VoiceQueueId']||undefined,'CampaignId':_0x40a96c['actions'][_0x58ae53][_0x0ebc('0xdf')]||undefined})[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x1e3')));delete _0x40a96c['actions'][_0x58ae53];});}else{loggerBooked[_0x0ebc('0x49')](_0x0ebc('0x1e4'),JSON['stringify'](_0x1e2d00[_0x0ebc('0x70')]),_0x0ebc('0x1e5'),_0x1e2d00['name']);_0x40a96c[_0x0ebc('0xc2')](_0x1e2d00);hopperUtils[_0x0ebc('0xdb')]({'active':![],'ContactId':_0x40a96c[_0x0ebc('0x20')][_0x58ae53][_0x0ebc('0xdd')],'ListId':_0x40a96c[_0x0ebc('0x20')][_0x58ae53]['ListId'],'VoiceQueueId':_0x40a96c[_0x0ebc('0x20')][_0x58ae53]['VoiceQueueId']||undefined,'CampaignId':_0x40a96c[_0x0ebc('0x20')][_0x58ae53][_0x0ebc('0xdf')]||undefined})[_0x0ebc('0xa1')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x40a96c[_0x0ebc('0x20')][_0x58ae53];}}else{return _0x40a96c[_0x0ebc('0x15d')](_0x1e2d00,_0x5e34ba);}}else{if(utils['getSeconds'](undefined,_0x5e34ba[_0x0ebc('0x1e6')])<_0x1e2d00[_0x0ebc('0x1e7')]*0x3c){if(_0x5e34ba[_0x0ebc('0x149')]&&!_0x5e34ba[_0x0ebc('0x149')]['voicePause']){_0x40a96c[_0x0ebc('0x1a')]['run'](_0x5e34ba['id'])[_0x0ebc('0x19')](function(){_0x40a96c[_0x0ebc('0xc2')](_0x1e2d00);});}else{hopperUtils[_0x0ebc('0x1e8')]({'active':![]},_0x5e34ba['id'],0x1)[_0x0ebc('0x19')](function(){_0x40a96c[_0x0ebc('0xc2')](_0x1e2d00);});}}else{_0x1e2d00[_0x0ebc('0x1e9')]+=0x1;_0x40a96c['updateOriginated'](_0x1e2d00);if(_0x1e2d00[_0x0ebc('0x1ea')]){hopperUtils[_0x0ebc('0xdb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e34ba[_0x0ebc('0xdd')],'ListId':_0x5e34ba[_0x0ebc('0xde')],'VoiceQueueId':_0x5e34ba[_0x0ebc('0x107')]||undefined,'CampaignId':_0x5e34ba[_0x0ebc('0xdf')]||undefined})[_0x0ebc('0xa1')](loggerCatch(_0x0ebc('0x1eb')));hopperUtils[_0x0ebc('0xef')](createObjHistory(_0x1e2d00,_0x5e34ba,utils['CAMPAIGN_STATUS'][_0x0ebc('0x1ec')],0x17,_0x0ebc('0x1ed')))['catch'](loggerCatch(_0x0ebc('0x1ee')));}else{_0x40a96c[_0x0ebc('0x119')](createObjHistory(_0x1e2d00,_0x5e34ba,utils[_0x0ebc('0x6a')][_0x0ebc('0x1ef')],0x16,_0x0ebc('0x1f0')),_0x0ebc('0x1f1'),'[Originate][HistoryRecallClose]');}}}}else{_0x1e2d00[_0x0ebc('0x1f2')]+=0x1;_0x40a96c[_0x0ebc('0x119')](createObjHistory(_0x1e2d00,_0x5e34ba,utils['CAMPAIGN_STATUS'][_0x0ebc('0x1f3')],0xd,_0x0ebc('0x1f4')),_0x0ebc('0x1f5'),_0x0ebc('0x1f6'));throw _0x0ebc('0x1f7');}};};Dialer[_0x0ebc('0x17')][_0x0ebc('0x15c')]=function(_0x21b386){var _0x1504a8=this;var _0x13d732=_0x21b386[_0x0ebc('0x1f8')]-_0x21b386[_0x0ebc('0x7e')];emitCampaignSummary(_0x21b386);if(_0x13d732>0x0&&_0x21b386[_0x0ebc('0x65')]==0x0){if(_0x13d732>this[_0x0ebc('0x1f')]){_0x13d732=this[_0x0ebc('0x1f')];}_0x21b386[_0x0ebc('0x65')]=0x1;hopperUtils[_0x0ebc('0x1f9')](_0x21b386,_0x13d732)[_0x0ebc('0x9c')](function(_0x28dfa5){_0x21b386['temp']=0x0;if(_0x28dfa5){if(!utils['checkContactEmpty'](_0x28dfa5)){_0x21b386[_0x0ebc('0x67')]=utils['CAMPAIGN_STATUS'][_0x0ebc('0x6b')];logger['info'](_0x0ebc('0x1fa')+_0x21b386[_0x0ebc('0x46')]);}else{_0x21b386[_0x0ebc('0x7e')]+=_0x28dfa5[_0x0ebc('0x97')];_0x21b386[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x1fb')];for(var _0x444909=0x0;_0x444909<_0x28dfa5['length'];_0x444909+=0x1){_0x21b386[_0x0ebc('0x1fc')]+=0x1;if(_[_0x0ebc('0x102')](_0x28dfa5[_0x444909])||_[_0x0ebc('0x102')](_0x28dfa5[_0x444909]['Contact'])||_[_0x0ebc('0x102')](_0x28dfa5[_0x444909][_0x0ebc('0x160')])){_0x1504a8[_0x0ebc('0x1fd')]('[actionOriginate]\x20',_0x21b386,_0x28dfa5[_0x444909]);}else{hopperUtils[_0x0ebc('0x1fe')](_[_0x0ebc('0x73')](_0x28dfa5[_0x444909],[_0x0ebc('0xdf'),_0x0ebc('0x160')]))[_0x0ebc('0x9c')](_0x1504a8['checkContactBlack'](_0x21b386,_0x28dfa5[_0x444909]))[_0x0ebc('0xa1')](_0x1504a8[_0x0ebc('0x1ff')](_0x0ebc('0x200'),_0x21b386));}}}}})[_0x0ebc('0xa1')](loggerGetContactDialer(_0x0ebc('0x201'),_0x21b386,_0x13d732));}};Dialer[_0x0ebc('0x17')][_0x0ebc('0xb3')]=function(_0x4dbe73,_0x1dc9b5){var _0x46f7a0=this;var _0x43f091=[];if(_0x1dc9b5<0x1||_0x4dbe73[_0x0ebc('0xb0')]===_0x0ebc('0x5')){_0x1dc9b5=0x1;}var _0x2651d7=Math[_0x0ebc('0x1df')](_0x4dbe73[_0x0ebc('0x13d')]*_0x1dc9b5)-_0x4dbe73[_0x0ebc('0x7e')];if(_0x4dbe73[_0x0ebc('0x202')]>0x0){var _0x148dab=_0x4dbe73[_0x0ebc('0x202')]-_0x4dbe73[_0x0ebc('0x7e')]-_0x4dbe73[_0x0ebc('0x13e')]-_0x4dbe73['pTalking'];if(_0x2651d7>_0x148dab){_0x2651d7=_0x148dab;}}if(_0x2651d7>0x0&&_0x4dbe73[_0x0ebc('0x65')]==0x0){if(_0x4dbe73[_0x0ebc('0xb0')]===_0x0ebc('0x5')){_0x2651d7=0x1;}if(_0x2651d7>this[_0x0ebc('0x1f')]){_0x2651d7=this[_0x0ebc('0x1f')];}for(var _0x3f8427 in this[_0x0ebc('0x1d')]){if(typeof this[_0x0ebc('0x1d')][_0x3f8427]!==_0x0ebc('0xa9')){if(this[_0x0ebc('0x1d')][_0x3f8427][_0x0ebc('0x6d')]==='not_inuse'&&this[_0x0ebc('0x1d')][_0x3f8427][_0x0ebc('0x87')]===_0x0ebc('0x88')){_0x43f091[_0x0ebc('0x98')](this[_0x0ebc('0x1d')][_0x3f8427]['id']);}}}_0x4dbe73[_0x0ebc('0x65')]=0x1;hopperUtils['getContactDialer'](_0x4dbe73,_0x43f091,_0x2651d7)[_0x0ebc('0x9c')](function(_0x33e20f){_0x4dbe73[_0x0ebc('0x65')]=0x0;if(_0x33e20f){if(!utils[_0x0ebc('0x203')](_0x33e20f)){hopperUtils[_0x0ebc('0x204')](_0x4dbe73)[_0x0ebc('0x9c')](sendMessageReschedule(_0x4dbe73))['catch'](loggerCatch(_0x0ebc('0x205')));}else{_0x4dbe73[_0x0ebc('0x7e')]+=_0x33e20f[_0x0ebc('0x97')];_0x4dbe73[_0x0ebc('0x67')]=_0x4dbe73['dialMethod']===_0x0ebc('0x5')?utils['CAMPAIGN_STATUS'][_0x0ebc('0x140')]:utils[_0x0ebc('0x6a')][_0x0ebc('0x1fb')];for(var _0x1bd9d1=0x0;_0x1bd9d1<_0x33e20f[_0x0ebc('0x97')];_0x1bd9d1+=0x1){if(_[_0x0ebc('0x102')](_0x33e20f[_0x1bd9d1])||_[_0x0ebc('0x102')](_0x33e20f[_0x1bd9d1][_0x0ebc('0x178')])||_[_0x0ebc('0x102')](_0x33e20f[_0x1bd9d1][_0x0ebc('0x160')])){_0x46f7a0[_0x0ebc('0x1fd')]('[actionOriginate]\x20',_0x4dbe73,_0x33e20f[_0x1bd9d1]);}else{hopperUtils[_0x0ebc('0x206')](_['pick'](_0x33e20f[_0x1bd9d1],[_0x0ebc('0x107'),_0x0ebc('0x160')]))[_0x0ebc('0x9c')](_0x46f7a0[_0x0ebc('0x1e0')](_0x4dbe73,_0x33e20f[_0x1bd9d1]))[_0x0ebc('0xa1')](_0x46f7a0['loggerHandler'](_0x0ebc('0x207'),_0x4dbe73));}}}}})[_0x0ebc('0xa1')](loggerGetContactDialer(_0x0ebc('0x208'),_0x4dbe73,_0x2651d7));}};Dialer[_0x0ebc('0x17')]['handlePredictive']=function(_0x26cf86){if(_0x26cf86[_0x0ebc('0x202')]>0x0){var _0x3b2203=_0x26cf86[_0x0ebc('0x202')]-_0x26cf86[_0x0ebc('0x7e')]-_0x26cf86['talking'];if(_0x3b2203>0x0&&_0x26cf86[_0x0ebc('0x65')]==0x0){this[_0x0ebc('0x209')](_0x26cf86);}else{loggerPredictiveCalls[_0x0ebc('0x49')](_0x0ebc('0x20a'));}}else{this[_0x0ebc('0x209')](_0x26cf86);}};Dialer['prototype'][_0x0ebc('0x209')]=function(_0x50d37c){var _0x112887=this;var _0x4332d7=[];_0x50d37c[_0x0ebc('0x7e')]+=0x1;for(var _0x26adb9 in this[_0x0ebc('0x1d')]){if(typeof this[_0x0ebc('0x1d')][_0x26adb9]!=='undefined'){if(this[_0x0ebc('0x1d')][_0x26adb9][_0x0ebc('0x6d')]===_0x0ebc('0x20b')&&this['agents'][_0x26adb9][_0x0ebc('0x87')]===_0x0ebc('0x88')){_0x4332d7[_0x0ebc('0x98')](this[_0x0ebc('0x1d')][_0x26adb9]['id']);}}}_0x50d37c[_0x0ebc('0x65')]=0x1;return this['getContactDialer'](_0x50d37c['id'],_0x4332d7,0x1,_0x50d37c['dialOrderByScheduledAt'],_0x50d37c)['then'](function(_0x820baa){_0x50d37c[_0x0ebc('0x65')]=0x1;if(_0x820baa){if(!utils[_0x0ebc('0x203')](_0x820baa)){utils[_0x0ebc('0x20c')](_0x50d37c,0x1,0x0);return hopperUtils['countReScheduled'](_0x50d37c)[_0x0ebc('0x9c')](sendMessageReschedule(_0x50d37c))['catch'](loggerCatch(_0x0ebc('0x205')));}else{_0x50d37c[_0x0ebc('0x67')]=utils[_0x0ebc('0x6a')][_0x0ebc('0x1fb')];if(_[_0x0ebc('0x102')](_0x820baa[0x0])||_[_0x0ebc('0x102')](_0x820baa[0x0][_0x0ebc('0x178')])||_[_0x0ebc('0x102')](_0x820baa[0x0][_0x0ebc('0x160')])){_0x112887[_0x0ebc('0x1fd')](_0x0ebc('0x207'),_0x50d37c,_0x820baa[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x0ebc('0x73')](_0x820baa[0x0],[_0x0ebc('0x107'),_0x0ebc('0x160')]))[_0x0ebc('0x9c')](_0x112887[_0x0ebc('0x1e0')](_0x50d37c,_0x820baa[0x0]))[_0x0ebc('0xa1')](_0x112887['loggerHandler'](_0x0ebc('0x20d'),_0x50d37c));}}}})[_0x0ebc('0xa1')](loggerGetContactDialer(_0x0ebc('0x20e'),_0x50d37c,0x1));};Dialer[_0x0ebc('0x17')][_0x0ebc('0x1d3')]=function(_0x536c94,_0x254a73,_0x3dd401,_0x137f18,_0x2afb73,_0x45453d){loggerPredictive['info'](_0x0ebc('0x20f'));loggerPredictive['info'](_0x0ebc('0x210'),_0x536c94);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x211'),_0x254a73);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x212'),_0x3dd401);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x213'),_0x137f18);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x214'),_0x2afb73);loggerPredictive['info']('---------------------------');return new Promise(function(_0x48f583,_0x5b754c){if(_0x536c94<=0x0||isNaN(_0x536c94)){return _0x5b754c(msgResponse(_0x0ebc('0x215'),_0x0ebc('0x83'),'m\x20=\x20'+_0x536c94));}if(_0x3dd401<=0x0||isNaN(_0x3dd401)){return _0x5b754c(msgResponse(_0x0ebc('0x215'),_0x0ebc('0x83'),_0x0ebc('0x216')+_0x3dd401));}if(_0x137f18<=0x0||isNaN(_0x137f18)){return _0x5b754c(msgResponse('[abandonmentRate]',_0x0ebc('0x83'),_0x0ebc('0x217')+_0x137f18));}if(_0x254a73<=0x0||isNaN(_0x254a73)){return _0x5b754c(msgResponse(_0x0ebc('0x215'),_0x0ebc('0x83'),_0x0ebc('0x218')+_0x254a73));}if(_0x2afb73<=0x0||isNaN(_0x2afb73)){return _0x5b754c(msgResponse(_0x0ebc('0x215'),_0x0ebc('0x83'),_0x0ebc('0x219')+_0x2afb73));}_0x45453d=_0x45453d||0x0;var _0xa78f3c=0x1/_0x3dd401;var _0x5edb58=0x0;var _0x2c950a=0x0;var _0x5b727d=0x0;var _0x1fc169=0x0;for(var _0x3c8c54=0x0;_0x5b727d<_0x2afb73;_0x3c8c54+=0x1){_0x2c950a=_0x3c8c54/_0x254a73;_0x5edb58=(_0x137f18*_0x2c950a+_0x45453d)/_0xa78f3c;_0x5b727d=utils['erlangb'](_0x5edb58,_0x536c94);_0x1fc169=_0x5edb58/_0x536c94*(0x1-utils[_0x0ebc('0x21a')](_0x5edb58,_0x536c94));}return _0x48f583({'erlangCalls':_0x3c8c54,'erlangCallToSecond':_0x254a73/_0x3c8c54,'erlangAbandonmentRate':_0x5b727d,'erlangBusyFactor':_0x1fc169});});};Dialer[_0x0ebc('0x17')][_0x0ebc('0x1d5')]=function(_0x4aa4f1,_0x3b046b,_0x46dc5e,_0x154b50,_0x30f81b,_0x17a43d){loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x21b'));loggerPredictive['info'](_0x0ebc('0x210'),_0x4aa4f1);loggerPredictive['info']('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b046b);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x212'),_0x46dc5e);loggerPredictive[_0x0ebc('0x49')](_0x0ebc('0x213'),_0x154b50);loggerPredictive[_0x0ebc('0x49')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x30f81b);loggerPredictive[_0x0ebc('0x49')]('---------------------------');return new Promise(function(_0x350862,_0x1ab8c9){if(_0x4aa4f1<=0x0||isNaN(_0x4aa4f1)){return _0x1ab8c9(msgResponse(_0x0ebc('0x21c'),_0x0ebc('0x83'),'m\x20=\x20'+_0x4aa4f1));}if(_0x46dc5e<=0x0||isNaN(_0x46dc5e)){return _0x1ab8c9(msgResponse(_0x0ebc('0x21c'),_0x0ebc('0x83'),'Ts\x20=\x20'+_0x46dc5e));}if(_0x154b50<=0x0||isNaN(_0x154b50)){return _0x1ab8c9(msgResponse('[busyFactor]','Error','p\x20=\x20'+_0x154b50));}if(_0x3b046b<=0x0||isNaN(_0x3b046b)){return _0x1ab8c9(msgResponse(_0x0ebc('0x21c'),_0x0ebc('0x83'),_0x0ebc('0x218')+_0x3b046b));}if(_0x30f81b<=0x0||isNaN(_0x30f81b)){return _0x1ab8c9(msgResponse(_0x0ebc('0x21c'),_0x0ebc('0x83'),_0x0ebc('0x21d')+_0x30f81b));}_0x17a43d=_0x17a43d||0x0;var _0x411d65=0x1/_0x46dc5e;var _0x3f3eff=0x0;var _0x25d0a0=0x0;var _0x406ff5=0x0;var _0x53616e=0x0;for(var _0x589091=0x0;_0x53616e<_0x30f81b;_0x589091+=0x1){_0x25d0a0=_0x589091/_0x3b046b;_0x3f3eff=(_0x154b50*_0x25d0a0+_0x17a43d)/_0x411d65;_0x406ff5=utils['erlangb'](_0x3f3eff,_0x4aa4f1);_0x53616e=_0x3f3eff/_0x4aa4f1*(0x1-utils[_0x0ebc('0x21a')](_0x3f3eff,_0x4aa4f1));}return _0x350862({'erlangCalls':_0x589091,'erlangCallToSecond':_0x3b046b/_0x589091,'erlangAbandonmentRate':_0x406ff5,'erlangBusyFactor':_0x53616e});});};module['exports']=Dialer;
\ No newline at end of file
+var _0xc3c9=['syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','getSeconds','startProgressive','startPredictive','debug','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','contactsRescheduled','message','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','\x20INTERVAL_IS_NULL','Interval','NULL_INTERVAL','isEmpty','isIVRCampaignActive','INACTIVE','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','isTrunkReachable','active','format','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TrunkBackup','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','command','iftime\x20%s,%s','interval','content','true','catch','indexOf','all','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','dialPowerLevel','booked','Queue','method\x20not\x20recognized','Intervals','silly','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','uniqueid','ivr','updateOriginated','queue','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','outboundDropCallsDayTimeout','Drop','TIMEOUT','agiafterat','countdropretry','countglobal','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','VoiceQueueId','CampaignId','starttime','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','countabandonedretry','voiceQueue','dialAbandonedMaxRetry','ListId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','actionid','rrmemory','roundrobin','locked','paused','stateinterface','isNil','queueBooked','strategy','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','dialGlobalMaxRetry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','outboundUnknownCallsDay','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','online','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','voiceQueue\x20is\x20undefine','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','callerid','XMD-ORIGINATECALLERIDNAME','variables','Action','dialPrefix','trim','dialCutDigit','substring','from-sip','checkRetriveMax','countnoanswerretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][Drop]','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','callAdditionalPhoneAfterMin','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','talking','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','getVoiceQueueRtPauses','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','predictiveIntervalHitRate','check\x20failure','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','voicePause','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','RUNNING','checkIsBlackList','[actionOriginate]\x20','tryOriginatePredictive','getContactDialer','dialOrderByScheduledAt','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','interval\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','ioredis','./utils','../preview/util/util','../../../config/logger','predictive','syncQueueSummary','../ami','redis','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','ivrOriginated','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete'];(function(_0x2140f2,_0x33255f){var _0x590c84=function(_0x3a48dc){while(--_0x3a48dc){_0x2140f2['push'](_0x2140f2['shift']());}};_0x590c84(++_0x33255f);}(_0xc3c9,0x1e6));var _0x9c3c=function(_0xf73c09,_0x4e424e){_0xf73c09=_0xf73c09-0x0;var _0xa8923c=_0xc3c9[_0xf73c09];return _0xa8923c;};'use strict';var util=require(_0x9c3c('0x0'));var _=require(_0x9c3c('0x1'));var uuid=require(_0x9c3c('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x9c3c('0x3'));var utils=require(_0x9c3c('0x4'));var hopperUtils=require('./utils/hopper');var ut=require(_0x9c3c('0x5'));var config=require('../../../config/environment/');var logger=require(_0x9c3c('0x6'))('dialer');var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require(_0x9c3c('0x6'))(_0x9c3c('0x7'));var loggerPredictiveCalls=require(_0x9c3c('0x6'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x9c3c('0x6'))(_0x9c3c('0x8'));var ami=require(_0x9c3c('0x9'));config[_0x9c3c('0xa')]=_['defaults'](config[_0x9c3c('0xa')],{'host':_0x9c3c('0xb'),'port':0x18eb});var io=require(_0x9c3c('0xc'))(new Redis(config[_0x9c3c('0xa')]));var cmHopper=require(_0x9c3c('0xd'));var voiceQueueRt=require(_0x9c3c('0xe'));var RpcSetting=require(_0x9c3c('0xf'));var Interval=require(_0x9c3c('0x10'));var Action=require(_0x9c3c('0x11'));var History=require(_0x9c3c('0x12'));var Final=require(_0x9c3c('0x13'));var AgentComplete=require(_0x9c3c('0x14'));var QueueCallerAbandon=require(_0x9c3c('0x15'));var Hangup=require(_0x9c3c('0x16'));var ipAgi=process[_0x9c3c('0x17')][_0x9c3c('0x18')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x9c3c('0x19')][_0x9c3c('0x1a')]=function(_0x167390){this['tail']=this[_0x9c3c('0x1b')]?this[_0x9c3c('0x1b')][_0x9c3c('0x1c')](_0x167390):_0x167390();};function Dialer(_0x2babb8,_0x5aca8b){this['sequence']=new Sequence();this[_0x9c3c('0x1d')]=_0x5aca8b;this['voiceQueues']=_0x2babb8[_0x9c3c('0x1e')];this[_0x9c3c('0x1f')]=_0x2babb8[_0x9c3c('0x1f')];this[_0x9c3c('0x20')]=_0x2babb8['agents'];this['trunks']=_0x2babb8[_0x9c3c('0x21')];this['maxNumberOriginate']=config[_0x9c3c('0x22')]||0x2;this[_0x9c3c('0x23')]={};this[_0x9c3c('0x24')]={};this['contactsId']={};this[_0x9c3c('0x25')]={};this[_0x9c3c('0x26')]={};this['startPredictive']={};this['startProgressive']={};this[_0x9c3c('0x27')]={};this['queueBooked']={};this[_0x9c3c('0x28')]={};this[_0x9c3c('0x29')]={};ami['on'](_0x9c3c('0x2a'),this[_0x9c3c('0x2b')][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x2d'),this[_0x9c3c('0x2e')][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x2f'),this['syncOriginateResponse'][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x30'),this[_0x9c3c('0x31')]['bind'](this));ami['on'](_0x9c3c('0x32'),this['syncQueueSummary'][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x33'),this[_0x9c3c('0x34')][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x35'),this[_0x9c3c('0x36')]['bind'](this));ami['on'](_0x9c3c('0x37'),this[_0x9c3c('0x38')][_0x9c3c('0x2c')](this));ami['on']('varset',this[_0x9c3c('0x39')][_0x9c3c('0x2c')](this));ami['on'](_0x9c3c('0x3a'),this[_0x9c3c('0x3b')]['bind'](this));ami['on'](_0x9c3c('0x3c'),this[_0x9c3c('0x3d')][_0x9c3c('0x2c')](this));this[_0x9c3c('0x3e')]();this[_0x9c3c('0x3f')]();RpcSetting['getSettings']()[_0x9c3c('0x40')](function(_0x5ea58d){previewRecallmeReminderInterval=_0x5ea58d[_0x9c3c('0x41')];});}function isNotNull(_0x46e41e){return _0x46e41e!==null&&!_[_0x9c3c('0x42')](_0x46e41e);}function msgResponse(_0x2e6743,_0x4f0be2,_0x189b71){return{'action':_0x2e6743,'response':_0x4f0be2,'message':_0x189b71,'stack':_0x189b71};}function emit(_0x4f14ac,_0x6f8f56,_0x164e84){io['to'](_0x4f14ac)[_0x9c3c('0x43')](_0x6f8f56,_0x164e84);}function emitOutboundVoiceQueueSummary(_0x1f5067){if(_0x1f5067[_0x9c3c('0x44')]==='outbound'){logger['debug'](_0x9c3c('0x45'),util[_0x9c3c('0x46')](_0x1f5067,{'showHidden':![],'depth':null}));emit(util['format'](_0x9c3c('0x47'),_0x1f5067[_0x9c3c('0x48')]),_0x9c3c('0x49'),_0x1f5067);}}function checkGetDataPredictive(_0x4ceb82){if(isNotNull(_0x4ceb82)&&!_['isEmpty'](_0x4ceb82)){loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x4b'));loggerPredictive[_0x9c3c('0x4a')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ceb82[_0x9c3c('0x4c')]);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x4d'),_0x4ceb82['predictiveIntervalAnsweredCalls']);loggerPredictive[_0x9c3c('0x4a')]('Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ceb82[_0x9c3c('0x4e')]);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x4f'),_0x4ceb82['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info']('AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4ceb82[_0x9c3c('0x50')]);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x51'),_0x4ceb82[_0x9c3c('0x52')]);loggerPredictive['info'](_0x9c3c('0x53'));if(_0x4ceb82[_0x9c3c('0x4c')]>0x0){if(!_[_0x9c3c('0x42')](_0x4ceb82['predictiveIntervalAvgTalktime'])&&_0x4ceb82[_0x9c3c('0x52')]>0x0){return!![];}loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x54'));if(!_['isUndefined'](_0x4ceb82[_0x9c3c('0x50')])&&_0x4ceb82[_0x9c3c('0x50')]>0x0){return!![];}loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x55'));}else{loggerPredictive['info']('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive['info'](_0x9c3c('0x56'));}return![];}function mergeDataErlangB(_0x2b600e){return function(_0x1590a5){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x57'),_0x1590a5[_0x9c3c('0x58')]);loggerPredictive['info'](_0x9c3c('0x59'),_0x1590a5['erlangCallToSecond']);loggerPredictive['info'](_0x9c3c('0x5a'),_0x1590a5[_0x9c3c('0x5b')]);loggerPredictive['info'](_0x9c3c('0x5c'),_0x1590a5['erlangBusyFactor']);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x5a'),_0x1590a5['erlangAbandonmentRate']);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x53'));_[_0x9c3c('0x5d')](_0x2b600e,_0x1590a5);};}function ifInterval(_0x4c5ae3,_0x1829af){if(_[_0x9c3c('0x42')](_0x1829af)){return![];}return utils[_0x9c3c('0x5e')](undefined,_0x1829af)<_0x4c5ae3*0x3c;}function clearPredictiveAttributes(_0x479ca6){if(_0x479ca6[_0x9c3c('0x5f')]){_0x479ca6['startProgressive']=undefined;loggerPredictive['debug'](_0x479ca6[_0x9c3c('0x48')],'startProgressive\x20value\x20cleared');}if(_0x479ca6[_0x9c3c('0x60')]){_0x479ca6[_0x9c3c('0x60')]=undefined;loggerPredictive[_0x9c3c('0x61')](_0x479ca6[_0x9c3c('0x48')],'startPredictive\x20value\x20cleared');}if(_0x479ca6[_0x9c3c('0x62')]){clearInterval(_0x479ca6[_0x9c3c('0x62')]);_0x479ca6[_0x9c3c('0x62')]=undefined;loggerPredictive[_0x9c3c('0x61')](_0x479ca6[_0x9c3c('0x48')],_0x9c3c('0x63'));}}function loggerCatchPredictive(_0x47ff09,_0x4b8d1a){return function(_0x530e38){loggerPredictive[_0x9c3c('0x64')](_0x4b8d1a[_0x9c3c('0x48')],_0x47ff09);loggerPredictive[_0x9c3c('0x64')](_0x530e38[_0x9c3c('0x65')]);clearPredictiveAttributes(_0x4b8d1a);};}function loggerCatch(_0x5153e8){return function(_0x295912){logger[_0x9c3c('0x64')](_0x5153e8,util[_0x9c3c('0x46')](_0x295912,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x3c71ba,_0x38a3e4,_0x79a107){return function(_0x7d5c23){utils[_0x9c3c('0x66')](_0x38a3e4,_0x79a107,0x0);_0x38a3e4[_0x9c3c('0x67')]=0x0;logger[_0x9c3c('0x64')](_0x3c71ba,util[_0x9c3c('0x46')](_0x7d5c23,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5b7d5e){return function(_0x2a3f62){if(isNotNull(_0x2a3f62)&&isNotNull(_0x2a3f62[0x0])){if(_0x2a3f62[0x0][_0x9c3c('0x68')]>0x0){_0x5b7d5e[_0x9c3c('0x69')]=utils['CAMPAIGN_STATUS']['CONTACTS_RESCHEDULED'];logger[_0x9c3c('0x4a')](_0x9c3c('0x6a')+_0x5b7d5e[_0x9c3c('0x48')],_0x2a3f62[0x0]['contactsRescheduled'],_0x9c3c('0x6b'));}else{_0x5b7d5e[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x6d')];logger[_0x9c3c('0x4a')](_0x9c3c('0x6e')+_0x5b7d5e[_0x9c3c('0x48')]);}}};}function createObjHistory(_0x382844,_0x5ba2cc,_0x279c5a,_0x2e5488,_0x51dcf2){_0x382844[_0x9c3c('0x69')]=_0x279c5a;var _0x1aa831=new Action(_0x382844,_0x5ba2cc);var _0x3b32cd=new History(_0x1aa831);_0x3b32cd[_0x9c3c('0x6f')]=_0x2e5488;_0x3b32cd[_0x9c3c('0x70')]=_0x51dcf2;_0x3b32cd[_0x9c3c('0x71')]=_0x1aa831['starttime'];return _0x3b32cd;}function unlockQueueStatus(_0x5c1005,_0xc7d0c5){setTimeout(function(){if(_[_0x9c3c('0x42')](_0x5c1005[_0x9c3c('0x72')])){loggerBooked['error'](_0x9c3c('0x73'),_0xc7d0c5);}_0x5c1005['queueStatusComplete']=!![];loggerBooked[_0x9c3c('0x4a')](_0x9c3c('0x74'),_0xc7d0c5,JSON[_0x9c3c('0x75')](_[_0x9c3c('0x76')](_0x5c1005,[_0x9c3c('0x48'),_0x9c3c('0x72')])));},0x1f3);}function checkInterval(_0x1f8c87){return function(){if(!isNotNull(_0x1f8c87['Interval'])){_0x1f8c87[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')]['NULL_INTERVAL'];throw _0x1f8c87[_0x9c3c('0x48')]+_0x9c3c('0x77');}if(!isNotNull(_0x1f8c87[_0x9c3c('0x78')]['Intervals'])){_0x1f8c87[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x79')];throw _0x1f8c87[_0x9c3c('0x48')]+_0x9c3c('0x77');}if(!isNotNull(_[_0x9c3c('0x7a')](_0x1f8c87['Interval']['Intervals']))){_0x1f8c87[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')]['NULL_INTERVAL'];throw _0x1f8c87['name']+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x5959af){return function(){if(!utils[_0x9c3c('0x7b')](_0x5959af)){_0x5959af[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x7c')];throw _0x5959af['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x36ec8f){if(utils['isIVRCampaign'](_0x36ec8f)){emit(util['format'](_0x9c3c('0x7d'),_0x36ec8f[_0x9c3c('0x48')]),_0x9c3c('0x7e'),_0x36ec8f);}}function loggerCatchQueueSummary(_0x772003,_0x20d652){return function(_0xfee7ba){clearPredictiveAttributes(_0x20d652);emitCampaignSummary(_0x20d652);loggerSyncQueueSummary[_0x9c3c('0x61')](_0x772003,util[_0x9c3c('0x46')](_0xfee7ba,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x52f499){if(_0x52f499['sendMessageOneNotActive']){if(_0x52f499[_0x9c3c('0x7f')]===0x0){_0x52f499[_0x9c3c('0x80')]=![];_0x52f499[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x7c')];loggerSyncQueueSummary['debug'](_0x9c3c('0x81'),_0x52f499['name'],'is\x20not\x20active');}else{_0x52f499['message']=utils['CAMPAIGN_STATUS'][_0x9c3c('0x82')];loggerSyncQueueSummary[_0x9c3c('0x61')](_0x9c3c('0x81'),_0x52f499[_0x9c3c('0x48')],_0x9c3c('0x83'));}emitCampaignSummary(_0x52f499);}}function myreject(_0x20cd46){return function(_0x5e2727){return _0x20cd46(msgResponse(_0x9c3c('0x84'),_0x9c3c('0x85'),JSON[_0x9c3c('0x75')](_0x5e2727)));};}Dialer[_0x9c3c('0x19')][_0x9c3c('0x86')]=function(_0x39d67b){return!_[_0x9c3c('0x42')](_0x39d67b)&&_0x39d67b&&!_[_0x9c3c('0x42')](_0x39d67b[_0x9c3c('0x48')])&&!_[_0x9c3c('0x42')](_0x39d67b['active'])&&_0x39d67b[_0x9c3c('0x87')]&&(this['trunks'][util[_0x9c3c('0x88')](_0x9c3c('0x89'),_0x39d67b[_0x9c3c('0x48')])][_0x9c3c('0x8a')]===_0x9c3c('0x8b')||this[_0x9c3c('0x21')][util['format']('SIP/%s',_0x39d67b[_0x9c3c('0x48')])][_0x9c3c('0x8a')]===_0x9c3c('0x8c'));};Dialer['prototype'][_0x9c3c('0x8d')]=function(_0x58ff1c){var _0x192b0a=this;return function(){if(!_0x192b0a['isTrunkReachable'](_0x58ff1c[_0x9c3c('0x8e')])){if(!_0x192b0a[_0x9c3c('0x86')](_0x58ff1c[_0x9c3c('0x8f')])){_0x58ff1c[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')]['TRUNK_NOT_REACHABLE'];throw _0x58ff1c[_0x9c3c('0x48')]+_0x9c3c('0x90');}}};};Dialer['prototype'][_0x9c3c('0x91')]=function(_0x483752,_0x12eb1e,_0x124c32,_0x37af47){var _0x291860=this;return function(){var _0x3f89f5=!![];return _0x291860[_0x9c3c('0x92')](_0x483752,_0x12eb1e,_0x124c32,_0x37af47,_0x3f89f5);};};Dialer[_0x9c3c('0x19')][_0x9c3c('0x93')]=function(_0x16ce5a,_0x1ad5d9,_0x12e1e6,_0x2491e1){var _0x14794f=this;return function(){var _0x3dd43e=![];return _0x14794f[_0x9c3c('0x92')](_0x16ce5a['Intervals'],_0x1ad5d9,_0x12e1e6,_0x2491e1,_0x3dd43e);};};Dialer[_0x9c3c('0x19')]['ifTimeIvr']=function(_0x4c9886,_0x17e04e,_0x332ded,_0x14dcd6,_0xca4cd6){var _0x796e12=[];return new Promise(function(_0x28d3ef,_0x521b10){if(!isNotNull(_0x4c9886)){_0x14dcd6[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x79')];return _0x521b10(msgResponse(_0x9c3c('0x94'),_0x9c3c('0x95'),_0x332ded+_0x9c3c('0x96')));}if(_[_0x9c3c('0x7a')](_0x4c9886)){_0x14dcd6['message']=utils['CAMPAIGN_STATUS']['EMPTY_INTERVAL'];return _0x521b10(msgResponse(_0x9c3c('0x94'),_0x9c3c('0x95'),_0x332ded+'\x20Intervals\x20is\x20empty\x20'));}if(_0x17e04e&&_[_0x9c3c('0x42')](config[_0x9c3c('0x97')][_0x17e04e])){_0x14dcd6[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x98')];return _0x521b10(msgResponse(_0x9c3c('0x94'),_0x9c3c('0x95'),_0x332ded+'\x20Timezone\x20unknow\x20'+_0x17e04e));}if(_[_0x9c3c('0x99')](_0x4c9886)){for(var _0x51be34=0x0;_0x51be34<_0x4c9886[_0x9c3c('0x9a')];_0x51be34+=0x1){_0x796e12[_0x9c3c('0x9b')](ami['Action']({'action':_0x9c3c('0x9c'),'command':util[_0x9c3c('0x88')](_0x9c3c('0x9d'),_0x4c9886[_0x51be34][_0x9c3c('0x9e')],!_[_0x9c3c('0x42')](config[_0x9c3c('0x97')][_0x17e04e])?_0x17e04e:'')})[_0x9c3c('0x40')](function(_0x1f4d3e){return _0x1f4d3e[_0x9c3c('0x9f')]['indexOf'](_0x9c3c('0xa0'))>=0x0;})[_0x9c3c('0xa1')](myreject(_0x521b10)));}}else{_0x796e12['push'](ami['Action']({'action':'command','command':util[_0x9c3c('0x88')](_0x9c3c('0x9d'),_0x4c9886,!_[_0x9c3c('0x42')](config[_0x9c3c('0x97')][_0x17e04e])?_0x17e04e:'')})[_0x9c3c('0x40')](function(_0x4c3209){return _0x4c3209[_0x9c3c('0x9f')][_0x9c3c('0xa2')](_0x9c3c('0xa0'))>=0x0;})[_0x9c3c('0xa1')](myreject(_0x521b10)));}Promise[_0x9c3c('0xa3')](_0x796e12)[_0x9c3c('0x40')](function(_0xe80ddd){var _0x505c92=_[_0x9c3c('0xa4')](_0xe80ddd);if(_0x505c92){return _0x28d3ef(_0x505c92);}else{_0x14dcd6[_0x9c3c('0x69')]=_0xca4cd6?utils[_0x9c3c('0x6c')][_0x9c3c('0xa5')]:utils[_0x9c3c('0x6c')][_0x9c3c('0xa6')];return _0x521b10(msgResponse(_0x9c3c('0xa7'),'Failure',_0x9c3c('0xa8')+_0xca4cd6+'\x20'+_0x332ded+_0x9c3c('0xa9')+util[_0x9c3c('0x46')](_0x4c9886,{'showHidden':![],'depth':null})+_0x9c3c('0xaa')+_0x17e04e));}})[_0x9c3c('0xa1')](function(_0x205e6b){return _0x521b10(msgResponse('ifTime',_0x9c3c('0x95'),JSON[_0x9c3c('0x75')](_0x205e6b)));});});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x3e')]=function(){var _0x36c5a0=this;return cmHopper[_0x9c3c('0xab')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x36c5a0[_0x9c3c('0xac')]();},0x3e8);});};Dialer[_0x9c3c('0x19')]['syncCampaigns']=function(){var _0x2aa24e=this;var _0x532941;for(var _0x3e5eb6 in this[_0x9c3c('0x1f')]){if(typeof this['campaigns'][_0x3e5eb6]!==_0x9c3c('0xad')){_0x532941=this['campaigns'][_0x3e5eb6];if(utils[_0x9c3c('0xae')](_0x532941)&&utils['isIVRCampaignActive'](_0x532941)){_0x532941[_0x9c3c('0x80')]=!![];Promise[_0x9c3c('0xaf')]()['then'](checkIsIVRCampaignActive(_0x532941))[_0x9c3c('0x40')](checkInterval(_0x532941))[_0x9c3c('0x40')](_0x2aa24e['checkIsTrunkReachable'](_0x532941))[_0x9c3c('0x40')](_0x2aa24e['checkIfTime'](_0x532941[_0x9c3c('0xb0')],_0x532941['dialTimezone'],_0x532941['name'],_0x532941))[_0x9c3c('0x40')](_0x2aa24e['checkIfTimeIntervals'](_0x532941[_0x9c3c('0x78')],_0x532941[_0x9c3c('0xb1')],_0x532941[_0x9c3c('0x48')],_0x532941))[_0x9c3c('0x40')](_0x2aa24e[_0x9c3c('0xb2')](_0x532941))[_0x9c3c('0xa1')](loggerCatchQueueSummary(_0x9c3c('0xb3'),_0x532941));}else{notSendMessagesCampaign(_0x532941);}}}};Dialer[_0x9c3c('0x19')][_0x9c3c('0xb4')]=function(_0x5b5709){if(_0x5b5709[_0x9c3c('0xb5')]!==_0x9c3c('0x7')){clearPredictiveAttributes(_0x5b5709);}switch(_0x5b5709['dialMethod']){case _0x9c3c('0xb6'):this['handlePower'](_0x5b5709,0x1);break;case'power':this[_0x9c3c('0xb7')](_0x5b5709,_0x5b5709[_0x9c3c('0xb8')]);break;case _0x9c3c('0x7'):this[_0x9c3c('0x7')](_0x5b5709);break;case _0x9c3c('0xb9'):this[_0x9c3c('0xb7')](_0x5b5709,0x1);break;default:logger[_0x9c3c('0x64')](_0x9c3c('0xba'),_0x5b5709['name'],_0x9c3c('0xbb'));}};Dialer[_0x9c3c('0x19')]['ifTime']=function(_0x2b1b85,_0x4c9cbf){var _0x186c9f=_0x2b1b85[_0x9c3c('0xb1')];var _0x17c5c4=_0x4c9cbf?_0x2b1b85[_0x9c3c('0xb0')]:_0x2b1b85[_0x9c3c('0x78')][_0x9c3c('0xbc')];logger[_0x9c3c('0xbd')](_0x9c3c('0xbe'),_0x17c5c4,_0x186c9f,_0x2b1b85['name'],util[_0x9c3c('0x88')](_0x9c3c('0xbf'),_0x2b1b85[_0x9c3c('0x48')],_0x2b1b85['id']));var _0xd039e0=null;return Interval[_0x9c3c('0xc0')](_0x17c5c4,_0x186c9f)[_0x9c3c('0x40')](function(_0x331f86){if(_0x331f86===!![]){return _0x331f86;}else{_0x2b1b85[_0x9c3c('0x69')]=_0x4c9cbf?utils[_0x9c3c('0x6c')][_0x9c3c('0xa5')]:utils[_0x9c3c('0x6c')][_0x9c3c('0xa6')];_0xd039e0=msgResponse(_0x9c3c('0xa7'),'Failure',_0x9c3c('0xa8')+_0x4c9cbf+'\x20'+_0x2b1b85[_0x9c3c('0x48')]+_0x9c3c('0xa9')+util['inspect'](_0x17c5c4,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x186c9f);}if(_0xd039e0!==null){logger[_0x9c3c('0xbd')](_0x9c3c('0xc1'),_0xd039e0);_0xd039e0[_0x9c3c('0xc2')]=_0x4c9cbf;throw _0xd039e0;}})[_0x9c3c('0xa1')](function(_0xbc33b9){logger[_0x9c3c('0x64')]('AMI\x20IfTime',_0xbc33b9);throw msgResponse('[ifTime][Action]',_0x9c3c('0x85'),util[_0x9c3c('0x46')](_0xbc33b9,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x9c3c('0x2b')]=function(_0x1a4138){if(this[_0x9c3c('0x1e')][_0x1a4138['queue']]){if(this[_0x9c3c('0x25')][_0x1a4138['uniqueid']]&&this['uniqueId'][_0x1a4138[_0x9c3c('0xc3')]][_0x9c3c('0x44')]!==_0x9c3c('0xc4')){this[_0x9c3c('0xc5')](this[_0x9c3c('0x1e')][_0x1a4138[_0x9c3c('0xc6')]]);this['uniqueId'][_0x1a4138[_0x9c3c('0xc3')]][_0x9c3c('0xc7')]=moment()[_0x9c3c('0x88')](_0x9c3c('0xc8'));}}};Dialer['prototype'][_0x9c3c('0x31')]=function(_0x31f49f){var _0x585d84=this['uniqueId'][_0x31f49f['uniqueid']];if(this[_0x9c3c('0x1e')][_0x31f49f[_0x9c3c('0xc6')]]){if(_0x585d84&&_0x585d84[_0x9c3c('0x44')]!==_0x9c3c('0xc4')){delete this['uniqueId'][_0x31f49f[_0x9c3c('0xc3')]];this[_0x9c3c('0x1e')][_0x31f49f[_0x9c3c('0xc6')]][_0x9c3c('0xc9')]+=0x1;var _0x3b13e7=new AgentComplete(_0x585d84,_0x31f49f);if(_0x31f49f['reason']==='agent'){_0x3b13e7['agiafterat']=this[_0x9c3c('0x1e')][_0x31f49f[_0x9c3c('0xc6')]][_0x9c3c('0xca')]&&this['voiceQueues'][_0x31f49f['queue']][_0x9c3c('0xcb')]?moment()[_0x9c3c('0x88')](_0x9c3c('0xc8')):undefined;}hopperUtils[_0x9c3c('0xcc')](_0x3b13e7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xcd')));hopperUtils[_0x9c3c('0xce')](_0x3b13e7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xcf')));}}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x2e')]=function(_0x2ada44){var _0x238c4a=this[_0x9c3c('0x25')][_0x2ada44[_0x9c3c('0xc3')]];var _0x307a06=this;var _0x420346=![];var _0x2f6f0e;var _0xde85e8;if(this[_0x9c3c('0x1e')][_0x2ada44['queue']]){if(_0x238c4a&&_0x238c4a[_0x9c3c('0x44')]!==_0x9c3c('0xc4')){delete this[_0x9c3c('0x25')][_0x2ada44['uniqueid']];this['updateOriginated'](this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]]);_0x238c4a[_0x9c3c('0xd0')]=moment()[_0x9c3c('0x88')](_0x9c3c('0xc8'));var _0x52b147=new QueueCallerAbandon(_0x238c4a,_0x2ada44);if(utils[_0x9c3c('0x5e')](_0x238c4a['droptime'],_0x238c4a[_0x9c3c('0xd1')])>=_0x238c4a['dialQueueTimeout']){this['voiceQueues'][_0x2ada44[_0x9c3c('0xc6')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xd2')]+=0x1;this[_0x9c3c('0x1e')][_0x2ada44['queue']]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x52b147[_0x9c3c('0x6f')]=0xa;_0x52b147[_0x9c3c('0x70')]=_0x9c3c('0xd3');_0x52b147['dropreason']=_0x9c3c('0xd4');_0x52b147[_0x9c3c('0xd5')]=this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xca')]?moment()[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x52b147[_0x9c3c('0xd6')]+=0x1;_0x52b147[_0x9c3c('0xd7')]+=0x1;_0x2f6f0e=this[_0x9c3c('0x1e')][_0x2ada44['queue']]['dialDropRetryFrequency'];_0xde85e8=this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x9c3c('0xd8')](_0x52b147,_0x52b147[_0x9c3c('0x6f')],_0x238c4a['voiceQueue'])[_0x9c3c('0x40')](function(_0x822166){_0x420346=_0x822166[_0x9c3c('0xd9')]==0x1;if(_0x52b147[_0x9c3c('0xd6')]>=_0x307a06[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xda')]){_0x307a06[_0x9c3c('0xdb')](_0x52b147,_0x822166[_0x9c3c('0xd9')]);}else{hopperUtils[_0x9c3c('0xdc')]({'active':![],'countdropretry':_0x52b147[_0x9c3c('0xd6')],'scheduledat':moment()[_0x9c3c('0xdd')](_0x307a06[_0x9c3c('0x1e')][_0x2ada44['queue']]['dialDropRetryFrequency'],_0x9c3c('0xde'))[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x238c4a[_0x9c3c('0xdf')],'ListId':_0x238c4a['ListId'],'VoiceQueueId':_0x238c4a[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x238c4a[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch('[rescheduleContact][Drop]'));var _0x338efe=new History(_0x52b147);_0x338efe[_0x9c3c('0x6f')]=0xa;_0x338efe[_0x9c3c('0x70')]=_0x9c3c('0xd3');_0x338efe[_0x9c3c('0xe2')]=moment()[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss');_0x338efe[_0x9c3c('0x71')]=_0x338efe[_0x9c3c('0xe2')];_0x338efe[_0x9c3c('0xe3')]=_0x52b147['calleridname'];_0x338efe[_0x9c3c('0xe4')]=_0x52b147['calleridnum'];hopperUtils[_0x9c3c('0xcc')](_0x338efe)['catch'](loggerCatch(_0x9c3c('0xe5')));}})[_0x9c3c('0x40')](function(){if(_0x420346)hopperUtils[_0x9c3c('0xe6')](_0x52b147,_0x2f6f0e,_0xde85e8)[_0x9c3c('0x40')](function(){return 0x1;});});}else{this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xe7')]+=0x1;this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]][_0x9c3c('0xe8')]+=0x1;_0x52b147[_0x9c3c('0x6f')]=0xb;_0x52b147[_0x9c3c('0x70')]='Abandoned';_0x52b147['dropreason']='CALLEREXIT';_0x52b147[_0x9c3c('0xe9')]+=0x1;_0x52b147[_0x9c3c('0xd7')]+=0x1;_0x2f6f0e=this[_0x9c3c('0x1e')][_0x2ada44['queue']]['dialAbandonedRetryFrequency'];_0xde85e8=this[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x9c3c('0xd8')](_0x52b147,_0x52b147[_0x9c3c('0x6f')],_0x238c4a[_0x9c3c('0xea')])[_0x9c3c('0x40')](function(_0xe75da6){if(_0x52b147[_0x9c3c('0xe9')]>=_0x307a06[_0x9c3c('0x1e')][_0x2ada44['queue']][_0x9c3c('0xeb')]){_0x307a06[_0x9c3c('0xdb')](_0x52b147,_0xe75da6[_0x9c3c('0xd9')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x52b147[_0x9c3c('0xe9')],'scheduledat':moment()[_0x9c3c('0xdd')](_0x307a06[_0x9c3c('0x1e')][_0x2ada44[_0x9c3c('0xc6')]]['dialAbandonedRetryFrequency'],'minutes')[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x238c4a['ContactId'],'ListId':_0x238c4a[_0x9c3c('0xec')],'VoiceQueueId':_0x238c4a[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x238c4a[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xed')));var _0x1d0e31=new History(_0x52b147);_0x1d0e31[_0x9c3c('0x6f')]=0xb;_0x1d0e31[_0x9c3c('0x70')]='Abandoned';_0x1d0e31[_0x9c3c('0xe2')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1d0e31[_0x9c3c('0x71')]=_0x1d0e31['starttime'];_0x1d0e31[_0x9c3c('0xe3')]=_0x52b147[_0x9c3c('0xe3')];_0x1d0e31[_0x9c3c('0xe4')]=_0x52b147[_0x9c3c('0xe4')];hopperUtils[_0x9c3c('0xcc')](_0x1d0e31)['catch'](loggerCatch(_0x9c3c('0xee')));}})[_0x9c3c('0x40')](function(){if(_0x420346)hopperUtils['swapAdditionalPhones'](_0x52b147,_0x2f6f0e,_0xde85e8)[_0x9c3c('0x40')](function(){return 0x1;});});}}}};Dialer[_0x9c3c('0x19')]['syncNewExten']=function(_0x1e0a3f){if(this[_0x9c3c('0x24')][_0x1e0a3f[_0x9c3c('0xc3')]]){this['actions'][_0x1e0a3f['uniqueid']][_0x9c3c('0xef')]=_0x1e0a3f[_0x9c3c('0xef')];}if(this[_0x9c3c('0x25')][_0x1e0a3f['uniqueid']]){this['uniqueId'][_0x1e0a3f[_0x9c3c('0xc3')]][_0x9c3c('0xef')]=_0x1e0a3f[_0x9c3c('0xef')];}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x3b')]=function(_0x2a1f2d){if(!this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]]){return;}var _0xa709c4=this[_0x9c3c('0x1e')][this[_0x9c3c('0x24')][_0x2a1f2d['actionid']][_0x9c3c('0xc6')]]['strategy']||_0x9c3c('0xf1');if(_0xa709c4===_0x9c3c('0xf2')){if(this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]]&&_['isNil'](this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xf3')])&&_0x2a1f2d[_0x9c3c('0x8a')]==='1'&&_0x2a1f2d[_0x9c3c('0xf4')]==='0'){if(this[_0x9c3c('0x20')][_0x2a1f2d['stateinterface']]){if(!this[_0x9c3c('0x20')][_0x2a1f2d[_0x9c3c('0xf5')]][_0x9c3c('0xf3')]){this['agents'][_0x2a1f2d[_0x9c3c('0xf5')]][_0x9c3c('0xf3')]=!![];this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xf3')]=!![];this[_0x9c3c('0x24')][_0x2a1f2d['actionid']][_0x9c3c('0xf5')]=_0x2a1f2d[_0x9c3c('0xf5')];}}}}else if(_0xa709c4===_0x9c3c('0xf1')){if(this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]]){if(this[_0x9c3c('0x20')][_0x2a1f2d[_0x9c3c('0xf5')]]){this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xf5')]=_0x2a1f2d[_0x9c3c('0xf5')];if(_[_0x9c3c('0xf6')](this['queueBooked'][this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]])){this[_0x9c3c('0xf7')][this[_0x9c3c('0x24')][_0x2a1f2d[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]=[];}this[_0x9c3c('0xf7')][this['actions'][_0x2a1f2d[_0x9c3c('0xf0')]]['queue']][_0x9c3c('0x9b')](_[_0x9c3c('0x5d')](_[_0x9c3c('0x76')](this[_0x9c3c('0x24')][_0x2a1f2d['actionid']],['idHopper','stateinterface']),{'status':_0x2a1f2d[_0x9c3c('0x8a')],'paused':_0x2a1f2d[_0x9c3c('0xf4')]}));}}}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x3d')]=function(_0x3ee790){if(!this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]){return;}var _0x215d0a=this;var _0x13dc1f=this[_0x9c3c('0x1e')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]];var _0x18cddb=_0x13dc1f[_0x9c3c('0xf8')]||'rrmemory';if(_0x18cddb===_0x9c3c('0xf2')){if(this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]&&this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xf5')]){this['preview']['run'](this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xf9')],this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xf5')])['catch'](function(_0x30a900){logger[_0x9c3c('0x64')](_0x9c3c('0xfa'),util['inspect'](_0x30a900,{'showHidden':![],'depth':null}));})[_0x9c3c('0x1c')](function(){_0x215d0a[_0x9c3c('0xc5')](_0x215d0a[_0x9c3c('0x1e')][_0x215d0a['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]);_0x215d0a['agents'][_0x215d0a[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xf5')]]['locked']=![];delete _0x215d0a[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]];unlockQueueStatus(_0x13dc1f);});}else{this['updateOriginated'](this[_0x9c3c('0x1e')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['ContactId'],'ListId':this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xec')],'VoiceQueueId':this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xe0')]||undefined,'CampaignId':this[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0xfb')));delete this['actions'][_0x3ee790['actionid']];unlockQueueStatus(_0x13dc1f);}}else if(_0x18cddb===_0x9c3c('0xf1')){var _0x4b9f11;if(this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]&&!_[_0x9c3c('0x7a')](this['queueBooked'][this[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xc6')]])){if(this[_0x9c3c('0x28')][_0x215d0a['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]){this[_0x9c3c('0x28')][_0x215d0a[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]=this[_0x9c3c('0x28')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['queue']]?this[_0x9c3c('0x28')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['queue']]:this['queueBooked'][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]?this[_0x9c3c('0xf7')][this['actions'][_0x3ee790['actionid']][_0x9c3c('0xc6')]]['_rr']||0x0:0x0;}this[_0x9c3c('0xf7')][this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]][_0x9c3c('0xfc')]=this[_0x9c3c('0x28')][this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]];for(var _0x566dfb=0x0;_0x566dfb<this[_0x9c3c('0xf7')][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['queue']][_0x9c3c('0x9a')];_0x566dfb+=0x1){_0x4b9f11=rr(this['queueBooked'][this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]);this[_0x9c3c('0x28')][_0x215d0a[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xc6')]]=this['queueBooked'][this['actions'][_0x3ee790['actionid']][_0x9c3c('0xc6')]][_0x9c3c('0xfc')];if(_0x4b9f11['status']==='1'&&_0x4b9f11[_0x9c3c('0xf4')]==='0'){break;}}if(!_['isNil'](_0x4b9f11)){this[_0x9c3c('0x20')][_0x4b9f11[_0x9c3c('0xf5')]][_0x9c3c('0xfd')]=_[_0x9c3c('0x42')](this[_0x9c3c('0x20')][_0x4b9f11[_0x9c3c('0xf5')]]['unlockRR'])?!![]:this[_0x9c3c('0x20')][_0x4b9f11[_0x9c3c('0xf5')]][_0x9c3c('0xfd')];}loggerBooked[_0x9c3c('0x4a')]('[booked][RR]',_0x3ee790['actionid'],_0x9c3c('0xfe'),JSON['stringify'](_[_0x9c3c('0x76')](this['agents'][_0x4b9f11['stateinterface']],[_0x9c3c('0x48'),_0x9c3c('0xfd')])),_0x9c3c('0xff'),JSON['stringify'](_0x4b9f11[_0x9c3c('0xf9')]));if(!_[_0x9c3c('0xf6')](_0x4b9f11)&&_0x4b9f11[_0x9c3c('0x8a')]==='1'&&_0x4b9f11[_0x9c3c('0xf4')]==='0'&&this[_0x9c3c('0x20')][_0x4b9f11[_0x9c3c('0xf5')]]['unlockRR']){this[_0x9c3c('0x20')][_0x4b9f11[_0x9c3c('0xf5')]][_0x9c3c('0xfd')]=![];this[_0x9c3c('0xf7')][_0x215d0a['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]=[];this['preview'][_0x9c3c('0x100')](_0x4b9f11[_0x9c3c('0xf9')],_0x4b9f11[_0x9c3c('0xf5')])[_0x9c3c('0xa1')](function(_0x3fac1c){logger[_0x9c3c('0x64')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x9c3c('0x46')](_0x3fac1c,{'showHidden':![],'depth':null}));})[_0x9c3c('0x1c')](function(){_0x215d0a[_0x9c3c('0xc5')](_0x215d0a[_0x9c3c('0x1e')][_0x215d0a[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xc6')]]);setTimeout(function(){_0x215d0a[_0x9c3c('0x20')][_0x4b9f11[_0x9c3c('0xf5')]][_0x9c3c('0xfd')]=!![];loggerBooked[_0x9c3c('0x4a')](_0x9c3c('0x101'),_0x3ee790['actionid'],_0x9c3c('0xfe'),JSON[_0x9c3c('0x75')](_['pick'](_0x215d0a[_0x9c3c('0x20')][_0x4b9f11[_0x9c3c('0xf5')]],['name',_0x9c3c('0xfd')])),'contactAgent-idHopper:\x20',JSON[_0x9c3c('0x75')](_0x4b9f11[_0x9c3c('0xf9')]));},0xc7);delete _0x215d0a[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]];unlockQueueStatus(_0x13dc1f,_0x3ee790[_0x9c3c('0xf0')]);});}else{loggerBooked['info']('[booked][unlock]');this['updateOriginated'](this[_0x9c3c('0x1e')][this['actions'][_0x3ee790['actionid']]['queue']]);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xdf')],'ListId':this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['ListId'],'VoiceQueueId':this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xe0')]||undefined,'CampaignId':this['actions'][_0x3ee790['actionid']][_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0xfb')));delete this['actions'][_0x3ee790[_0x9c3c('0xf0')]];unlockQueueStatus(_0x13dc1f);}}else{loggerBooked[_0x9c3c('0x4a')](_0x9c3c('0x102'));this[_0x9c3c('0xc5')](this['voiceQueues'][this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xc6')]]);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':this['actions'][_0x3ee790['actionid']][_0x9c3c('0xdf')],'ListId':this['actions'][_0x3ee790[_0x9c3c('0xf0')]][_0x9c3c('0xec')],'VoiceQueueId':this['actions'][_0x3ee790['actionid']][_0x9c3c('0xe0')]||undefined,'CampaignId':this[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch('[unlock2][syncQueueStatusComplete]'));delete this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]];unlockQueueStatus(_0x13dc1f);}}else{loggerBooked[_0x9c3c('0x4a')](_0x9c3c('0x103'));this['updateOriginated'](this[_0x9c3c('0x1e')][this[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xc6')]]);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':this[_0x9c3c('0x24')][_0x3ee790['actionid']]['ContactId'],'ListId':this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]]['ListId'],'VoiceQueueId':this[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xe0')]||undefined,'CampaignId':this[_0x9c3c('0x24')][_0x3ee790['actionid']][_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x104')));delete this[_0x9c3c('0x24')][_0x3ee790[_0x9c3c('0xf0')]];unlockQueueStatus(_0x13dc1f);}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x105')]=function(_0x4531fb){var _0x170070=this[_0x9c3c('0x24')][_0x4531fb[_0x9c3c('0xf0')]];if(_0x170070){delete this[_0x9c3c('0x24')][_0x4531fb[_0x9c3c('0xf0')]];_0x170070['responsetime']=moment()['format'](_0x9c3c('0xc8'));var _0x128d4f=_0x170070['type']===_0x9c3c('0xc4')?this[_0x9c3c('0x1f')][_0x170070['queue']]:this[_0x9c3c('0x1e')][_0x170070['getQueue']()];if(_0x4531fb[_0x9c3c('0x106')]!==_0x9c3c('0x107')){this['updateOriginated'](_0x128d4f);return this[_0x9c3c('0x108')](_0x170070,_0x128d4f,_0x4531fb)['catch'](loggerCatch(_0x9c3c('0x109')));}this[_0x9c3c('0x25')][_0x4531fb[_0x9c3c('0xc3')]]=_0x170070;}};Dialer[_0x9c3c('0x19')]['syncVarSet']=function(_0x1a57f8){var _0x2fcd21=this;var _0x49096b=this['uniqueId'][_0x1a57f8['uniqueid']];var _0x199b07;if(!_['isNil'](_0x1a57f8)&&!_[_0x9c3c('0xf6')](_0x1a57f8[_0x9c3c('0x10a')])&&!_['isNil'](_0x1a57f8[_0x9c3c('0x10a')]['amdstatus'])&&_0x1a57f8[_0x9c3c('0x10b')]===_0x9c3c('0x10c')&&_0x49096b){if(_0x49096b[_0x9c3c('0x44')]!==_0x9c3c('0xc4')&&this['voiceQueues'][_0x49096b['queue']][_0x9c3c('0x10d')]&&_0x1a57f8[_0x9c3c('0x10e')]===_0x9c3c('0x10f')){delete this['uniqueId'][_0x1a57f8[_0x9c3c('0xc3')]];this[_0x9c3c('0xc5')](this[_0x9c3c('0x1e')][_0x49096b[_0x9c3c('0xc6')]]);this[_0x9c3c('0x1e')][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0xc9')]+=0x1;this[_0x9c3c('0x1e')][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0x110')]+=0x1;_0x199b07=new Hangup(_0x49096b,_0x1a57f8);_0x199b07[_0x9c3c('0x6f')]=0x12;_0x199b07[_0x9c3c('0x70')]='HangupInAMD';_0x199b07[_0x9c3c('0x111')]=_0x9c3c('0x112');ami[_0x9c3c('0x43')]('custom:amd',ut[_0x9c3c('0x113')](_0x199b07,_0x9c3c('0x114')));this[_0x9c3c('0x115')](_0x199b07,_0x9c3c('0x116'),_0x9c3c('0x117'));}if(_0x49096b[_0x9c3c('0x44')]!==_0x9c3c('0xc4')&&this[_0x9c3c('0x1e')][_0x49096b['queue']][_0x9c3c('0x10d')]&&_0x1a57f8[_0x9c3c('0x10e')]===_0x9c3c('0x118')){return new Promise(function(_0x2bfab4,_0x5dd2cb){delete _0x2fcd21['uniqueId'][_0x1a57f8['uniqueid']];_0x2fcd21[_0x9c3c('0xc5')](_0x2fcd21[_0x9c3c('0x1e')][_0x49096b[_0x9c3c('0xc6')]]);_0x2fcd21[_0x9c3c('0x1e')][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0xc9')]+=0x1;_0x2fcd21[_0x9c3c('0x1e')][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0x110')]+=0x1;var _0x50200d=_0x2fcd21[_0x9c3c('0x1e')][_0x49096b[_0x9c3c('0xc6')]];var _0x4ad14f=new Hangup(_0x49096b,_0x1a57f8);_0x4ad14f[_0x9c3c('0x6f')]=0x13;_0x4ad14f['statedesc']='Machine';_0x4ad14f[_0x9c3c('0x111')]=_0x9c3c('0x112');_0x4ad14f[_0x9c3c('0x119')]+=0x1;_0x4ad14f[_0x9c3c('0xd7')]+=0x1;_0x4ad14f['amd']=!![];ami[_0x9c3c('0x43')](_0x9c3c('0x11a'),ut[_0x9c3c('0x113')](_0x4ad14f,'amd'));hopperUtils['createHistory'](_0x4ad14f)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x11b')));if(_0x4ad14f[_0x9c3c('0x11c')]+_0x4ad14f[_0x9c3c('0x11d')]+_0x4ad14f['countnoanswerretry']+_0x4ad14f[_0x9c3c('0x11e')]+_0x4ad14f[_0x9c3c('0xd6')]+_0x4ad14f[_0x9c3c('0xe9')]+_0x4ad14f[_0x9c3c('0x119')]+_0x4ad14f[_0x9c3c('0x11f')]>=_0x50200d['dialGlobalMaxRetry']){_0x2fcd21[_0x9c3c('0x120')](_0x4ad14f,_0x2bfab4,_0x5dd2cb,_0x9c3c('0x121'));}else{if(_0x4ad14f['countmachineretry']>=_0x50200d[_0x9c3c('0x122')]){_0x2fcd21[_0x9c3c('0x123')](_0x4ad14f,_0x2bfab4,_0x5dd2cb,_0x9c3c('0x124'));}else{hopperUtils[_0x9c3c('0xdc')]({'active':![],'countmachineretry':_0x4ad14f[_0x9c3c('0x119')],'scheduledat':moment()[_0x9c3c('0xdd')](_0x50200d[_0x9c3c('0x125')],_0x9c3c('0xde'))[_0x9c3c('0x88')](_0x9c3c('0xc8')),'ContactId':_0x4ad14f['ContactId'],'ListId':_0x4ad14f['ListId'],'VoiceQueueId':_0x4ad14f[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x4ad14f[_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x126')));_0x2bfab4({'reschedule':0x1});}}});}if(_0x49096b[_0x9c3c('0x44')]==='ivr'&&this[_0x9c3c('0x1f')][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0x10d')]&&_0x1a57f8['value']===_0x9c3c('0x10f')){delete this[_0x9c3c('0x25')][_0x1a57f8['uniqueid']];this['updateOriginated'](this[_0x9c3c('0x1f')][_0x49096b['queue']]);_0x199b07=new Hangup(_0x49096b,_0x1a57f8);_0x199b07['state']=0x12;_0x199b07[_0x9c3c('0x70')]=_0x9c3c('0x127');_0x199b07[_0x9c3c('0x111')]=_0x9c3c('0x112');ami[_0x9c3c('0x43')](_0x9c3c('0x11a'),ut['buildObj'](_0x199b07,'amd'));this[_0x9c3c('0x115')](_0x199b07,_0x9c3c('0x128'),_0x9c3c('0x129'));}if(_0x49096b['type']===_0x9c3c('0xc4')&&this['campaigns'][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0x10d')]&&_0x1a57f8[_0x9c3c('0x10e')]===_0x9c3c('0x118')){return new Promise(function(_0x2007df,_0x38e99e){delete _0x2fcd21['uniqueId'][_0x1a57f8[_0x9c3c('0xc3')]];_0x2fcd21[_0x9c3c('0xc5')](_0x2fcd21[_0x9c3c('0x1f')][_0x49096b[_0x9c3c('0xc6')]]);_0x2fcd21['campaigns'][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0xc9')]+=0x1;_0x2fcd21['campaigns'][_0x49096b[_0x9c3c('0xc6')]][_0x9c3c('0x110')]+=0x1;var _0x51a95d=_0x2fcd21[_0x9c3c('0x1f')][_0x49096b[_0x9c3c('0xc6')]];var _0x558b70=new Hangup(_0x49096b,_0x1a57f8);_0x558b70['state']=0x13;_0x558b70[_0x9c3c('0x70')]='Machine';_0x558b70[_0x9c3c('0x111')]='AMD';_0x558b70[_0x9c3c('0x119')]+=0x1;_0x558b70['countglobal']+=0x1;_0x558b70[_0x9c3c('0x114')]=!![];ami[_0x9c3c('0x43')](_0x9c3c('0x11a'),ut[_0x9c3c('0x113')](_0x558b70,_0x9c3c('0x114')));hopperUtils[_0x9c3c('0xcc')](_0x558b70)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x11b')));if(_0x558b70['countbusyretry']+_0x558b70[_0x9c3c('0x11d')]+_0x558b70['countnoanswerretry']+_0x558b70[_0x9c3c('0x11e')]+_0x558b70[_0x9c3c('0xd6')]+_0x558b70[_0x9c3c('0xe9')]+_0x558b70[_0x9c3c('0x119')]+_0x558b70[_0x9c3c('0x11f')]>=_0x51a95d[_0x9c3c('0x12a')]){_0x2fcd21[_0x9c3c('0x120')](_0x558b70,_0x2007df,_0x38e99e,_0x9c3c('0x121'));}else{if(_0x558b70[_0x9c3c('0x119')]>=_0x51a95d[_0x9c3c('0x122')]){_0x2fcd21[_0x9c3c('0x123')](_0x558b70,_0x2007df,_0x38e99e,'reason\x2019\x20machine....');}else{hopperUtils[_0x9c3c('0xdc')]({'active':![],'countmachineretry':_0x558b70[_0x9c3c('0x119')],'scheduledat':moment()[_0x9c3c('0xdd')](_0x51a95d[_0x9c3c('0x125')],_0x9c3c('0xde'))[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x558b70[_0x9c3c('0xdf')],'ListId':_0x558b70[_0x9c3c('0xec')],'VoiceQueueId':_0x558b70[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x558b70['CampaignId']||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x126')));_0x2007df({'reschedule':0x1});}}});}}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x36')]=function(_0x31ace4){var _0x30f761=this[_0x9c3c('0x25')][_0x31ace4[_0x9c3c('0xc3')]];var _0x5e62d7;if(_0x30f761&&_0x30f761[_0x9c3c('0x44')]===_0x9c3c('0xc4')){delete this['uniqueId'][_0x31ace4[_0x9c3c('0xc3')]];this['updateOriginated'](this['campaigns'][_0x30f761['queue']]);this['campaigns'][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0x12b')]+=0x1;_0x5e62d7=new Hangup(_0x30f761,_0x31ace4);hopperUtils[_0x9c3c('0xcc')](_0x5e62d7)['catch'](loggerCatch(_0x9c3c('0x12c')));hopperUtils[_0x9c3c('0xce')](_0x5e62d7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x12d')));}if(_0x30f761&&_0x30f761[_0x9c3c('0x44')]!==_0x9c3c('0xc4')&&isNotNull(this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0x12e')])){delete this['uniqueId'][_0x31ace4[_0x9c3c('0xc3')]];this['updateOriginated'](this['voiceQueues'][_0x30f761[_0x9c3c('0xc6')]]);this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0xc9')]+=0x1;this[_0x9c3c('0x1e')][_0x30f761['queue']][_0x9c3c('0x110')]+=0x1;_0x5e62d7=new Hangup(_0x30f761,_0x31ace4);_0x5e62d7[_0x9c3c('0x6f')]=0x10;_0x5e62d7[_0x9c3c('0x70')]=_0x9c3c('0x12f');_0x5e62d7['membername']='AGI';hopperUtils[_0x9c3c('0xcc')](_0x5e62d7)['catch'](loggerCatch(_0x9c3c('0x12c')));hopperUtils[_0x9c3c('0xce')](_0x5e62d7)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x30f761&&_0x30f761[_0x9c3c('0x44')]!=='ivr'&&!isNotNull(this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0x12e')])){delete this[_0x9c3c('0x25')][_0x31ace4[_0x9c3c('0xc3')]];this[_0x9c3c('0xc5')](this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]]);this[_0x9c3c('0x1e')][_0x30f761[_0x9c3c('0xc6')]][_0x9c3c('0x130')]+=0x1;_0x5e62d7=new Hangup(_0x30f761,_0x31ace4);_0x5e62d7[_0x9c3c('0x6f')]=0xc;_0x5e62d7['statedesc']=_0x31ace4[_0x9c3c('0x131')];_0x5e62d7['membername']=_0x9c3c('0x132');hopperUtils[_0x9c3c('0xcc')](_0x5e62d7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x12c')));hopperUtils[_0x9c3c('0xce')](_0x5e62d7)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x12d')));}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x8')]=function(_0x199f31){var _0x2c3c1a=this;if(!_0x2c3c1a[_0x9c3c('0x29')][_0x199f31[_0x9c3c('0x48')]]){_0x2c3c1a[_0x9c3c('0x29')][_0x199f31[_0x9c3c('0x48')]]={'running':![]};}else if(_0x2c3c1a[_0x9c3c('0x29')][_0x199f31[_0x9c3c('0x48')]]['running']===!![]){return;}else if(_0x2c3c1a[_0x9c3c('0x29')][_0x199f31[_0x9c3c('0x48')]][_0x9c3c('0x133')]===![]){_0x2c3c1a['queuesSummary'][_0x199f31[_0x9c3c('0x48')]][_0x9c3c('0x133')]=!![];}var _0x56989a=_0x2c3c1a[_0x9c3c('0x1e')][_0x199f31[_0x9c3c('0x48')]];var _0x4bf9d5=_0x56989a[_0x9c3c('0x69')]!==utils[_0x9c3c('0x6c')]['INACTIVE'];var _0x58c50e=utils[_0x9c3c('0x134')](_0x56989a);_0x56989a[_0x9c3c('0x135')]=utils[_0x9c3c('0x136')](_0x56989a,_0x2c3c1a[_0x9c3c('0x21')]);Promise[_0x9c3c('0xaf')]()[_0x9c3c('0x40')](function(){if(_0x56989a[_0x9c3c('0x135')]===utils['CAMPAIGN_STATUS'][_0x9c3c('0x7c')]){if(_0x4bf9d5){clearPredictiveAttributes(_0x56989a);_0x199f31[_0x9c3c('0x60')]=undefined;_0x199f31[_0x9c3c('0x5f')]=undefined;}if(_0x56989a[_0x9c3c('0x135')]===utils[_0x9c3c('0x6c')][_0x9c3c('0x7c')]){_0x199f31[_0x9c3c('0x137')]=0x0;_0x199f31[_0x9c3c('0xf4')]=0x0;_0x199f31[_0x9c3c('0x138')]=0x0;_0x199f31['talking']=0x0;_0x199f31['pTalking']=0x0;}}else if(_0x56989a[_0x9c3c('0x135')]===utils[_0x9c3c('0x6c')][_0x9c3c('0x139')]&&!_0x58c50e){return _0x2c3c1a['ifTime'](_0x56989a,!![])[_0x9c3c('0x40')](function(){return _0x2c3c1a[_0x9c3c('0x94')](_0x56989a,![]);})[_0x9c3c('0x40')](function(){return _0x2c3c1a[_0x9c3c('0xb4')](_0x56989a);})[_0x9c3c('0xa1')](function(_0x5cfcf1){loggerSyncQueueSummary['debug'](_0x9c3c('0x13a'),util[_0x9c3c('0x46')](_0x5cfcf1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x56989a);});}else{clearPredictiveAttributes(_0x56989a);}})['then'](function(){var _0x133d81=_0x199f31[_0x9c3c('0x13b')](_0x56989a);if(_0x133d81||_0x56989a['queueSummaryCountersUpdated']){_0x56989a[_0x9c3c('0x13c')]=![];_0x199f31[_0x9c3c('0x13d')](_0x56989a);Object[_0x9c3c('0x13e')](_0x56989a,_0x199f31);emitOutboundVoiceQueueSummary(_0x199f31);}_0x2c3c1a[_0x9c3c('0x29')][_0x56989a[_0x9c3c('0x48')]][_0x9c3c('0x133')]=![];})[_0x9c3c('0xa1')](function(_0x272949){logger[_0x9c3c('0x64')](_0x9c3c('0x13a'),util['inspect'](_0x272949,{'showHidden':![],'depth':null}));_0x2c3c1a[_0x9c3c('0x29')][_0x56989a[_0x9c3c('0x48')]][_0x9c3c('0x133')]=![];});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x34')]=_['throttle'](function(){var _0x5cc9e1=_['filter'](this[_0x9c3c('0x1e')],function(_0x2e9e0d){return _0x2e9e0d['dialPreviewRecallmeReminder'];});var _0x56cbef=_[_0x9c3c('0x13f')](this[_0x9c3c('0x20')],function(_0xd443a4){return _0xd443a4[_0x9c3c('0x140')]&&_0xd443a4[_0x9c3c('0x8a')]===_0x9c3c('0x8b');});if(_0x5cc9e1['length']>0x0&&_0x56cbef[_0x9c3c('0x9a')]>0x0){return Promise[_0x9c3c('0xaf')]()[_0x9c3c('0x40')](cmHopper['handlePreviewRecallNotifications'](_[_0x9c3c('0x141')](_0x5cc9e1,'id'),previewRecallmeReminderInterval,_[_0x9c3c('0x141')](_0x56cbef,'id')))['then'](function(_0x5d493b){for(var _0x4c8940=0x0;_0x4c8940<_0x5d493b[_0x9c3c('0x9a')];_0x4c8940++){var _0x2e7dc0=_0x5d493b[_0x4c8940][_0x9c3c('0x142')][_0x9c3c('0x48')];if(_0x2e7dc0)io['to'](util['format'](_0x9c3c('0x143'),_0x2e7dc0))[_0x9c3c('0x43')](_0x9c3c('0x144'),{'hopper':_0x5d493b[_0x4c8940]});}})['catch'](function(_0x34d6be){logger[_0x9c3c('0x64')](_0x9c3c('0x145'),_0x34d6be);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x9c3c('0x19')][_0x9c3c('0x3f')]=function(){var _0xca0222=this;setInterval(function(){_0xca0222['clearZombieChannels'](_0xca0222[_0x9c3c('0x25')],'[uniqueid]');_0xca0222[_0x9c3c('0x146')](_0xca0222['actions'],_0x9c3c('0x147'));},0x32c8);};Dialer[_0x9c3c('0x19')][_0x9c3c('0x146')]=function(_0x410ae,_0x1ae1cc){var _0x52e12a=this;for(var _0x1a1977 in _0x410ae){if(typeof _0x410ae[_0x1a1977]!==_0x9c3c('0xad')){this['sequence'][_0x9c3c('0x1a')](function(){if(!_['isNil'](_0x410ae[_0x1a1977])){return ami['Action']({'action':_0x9c3c('0x8a'),'channel':_0x410ae[_0x1a1977][_0x9c3c('0xef')]})[_0x9c3c('0xa1')](function(_0x41d029){if(_0x41d029[_0x9c3c('0x69')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x410ae[_0x1a1977]&&_0x410ae[_0x1a1977][_0x9c3c('0x44')]!==_0x9c3c('0xc4')){_0x52e12a[_0x9c3c('0xc5')](_0x52e12a[_0x9c3c('0x1e')][_0x410ae[_0x1a1977][_0x9c3c('0xc6')]]);logger['error'](_0x9c3c('0x148'),_0x1ae1cc,_0x1a1977,_0x410ae[_0x1a1977][_0x9c3c('0xc6')]);delete _0x410ae[_0x1a1977];}if(_0x410ae[_0x1a1977]&&_0x410ae[_0x1a1977][_0x9c3c('0x44')]==='ivr'){_0x52e12a[_0x9c3c('0xc5')](_0x52e12a[_0x9c3c('0x1f')][_0x410ae[_0x1a1977][_0x9c3c('0xc6')]]);logger[_0x9c3c('0x64')](_0x9c3c('0x149'),_0x1ae1cc,_0x1a1977,_0x410ae[_0x1a1977][_0x9c3c('0xc6')]);delete _0x410ae[_0x1a1977];}},0x2328);}});}});}}};Dialer[_0x9c3c('0x19')]['getVoiceQueueRtPauses']=function(_0x3ece19){return Promise['resolve']()[_0x9c3c('0x40')](voiceQueueRt['getVoiceQueueRtPauses'](_0x3ece19))[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x14a')));};Dialer[_0x9c3c('0x19')][_0x9c3c('0xc5')]=function(_0x2cd292){if(!_[_0x9c3c('0x42')](_0x2cd292)&&_0x2cd292!==null){if(typeof _0x2cd292[_0x9c3c('0x7f')]!==_0x9c3c('0xad')){if(_0x2cd292[_0x9c3c('0x7f')]>0x0){_0x2cd292['originated']-=0x1;}else{logger[_0x9c3c('0x64')](_0x9c3c('0x14b'));}}}else{logger['error'](_0x9c3c('0x14c'));}};Dialer['prototype'][_0x9c3c('0x14d')]=function(_0x35034e,_0x3f74bb){var _0x2ac33a=this;return function(_0x4d909f){_0x2ac33a['updateOriginated'](_0x3f74bb);logger['error'](_0x35034e,util[_0x9c3c('0x46')](_0x4d909f,{'showHidden':![],'depth':null}));};};Dialer[_0x9c3c('0x19')][_0x9c3c('0x14e')]=function(_0x5e94da,_0x4e9707,_0x36415f){var _0x32a5d3={'state':0x19,'statedesc':_0x9c3c('0x14f')};this[_0x9c3c('0xc5')](_0x4e9707);this[_0x9c3c('0x115')](_[_0x9c3c('0x5d')](_0x32a5d3,_[_0x9c3c('0x76')](_0x36415f,[_0x9c3c('0xdf'),_0x9c3c('0xec'),_0x9c3c('0x150'),'VoiceQueueId',_0x9c3c('0xe1')])),'[emptyContact][createHistory]',_0x9c3c('0x151'));logger[_0x9c3c('0x64')](_0x5e94da);};Dialer[_0x9c3c('0x19')][_0x9c3c('0x115')]=function(_0xc79748,_0x1cd9bb,_0x3f2830){hopperUtils[_0x9c3c('0xcc')](_0xc79748)['catch'](loggerCatch(_0x1cd9bb));hopperUtils['moveContactManagedDialer'](_0xc79748)[_0x9c3c('0xa1')](loggerCatch(_0x3f2830));};Dialer[_0x9c3c('0x19')]['queueCallerAbandonCreateState']=function(_0x56ccf9,_0x2aa9b6){hopperUtils[_0x9c3c('0xcc')](_0x56ccf9)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xcd')));if(_0x2aa9b6==0x0){hopperUtils[_0x9c3c('0xce')](_0x56ccf9)['catch'](loggerCatch(_0x9c3c('0x152')));}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x145')]=function(_0x54067a){return Promise[_0x9c3c('0xaf')]()['then'](cmHopper['handlePreviewRecallNotifications'](_0x54067a['id'],previewRecallmeReminderInterval))[_0x9c3c('0x40')](function(_0x1506f2){for(var _0x2a2c0d=0x0;_0x2a2c0d<_0x1506f2[_0x9c3c('0x9a')];_0x2a2c0d++){var _0x299e53=_0x1506f2[_0x2a2c0d]['Agent'][_0x9c3c('0x48')];if(_0x299e53)io['to'](util['format'](_0x9c3c('0x143'),_0x299e53))[_0x9c3c('0x43')](_0x9c3c('0x144'),{'hopper':_0x1506f2[_0x2a2c0d]});}})[_0x9c3c('0xa1')](function(){});};Dialer[_0x9c3c('0x19')][_0x9c3c('0xb2')]=function(_0x8923bb){var _0x1def57=this;return function(){_0x1def57['handleIvr'](_0x8923bb);};};Dialer['prototype'][_0x9c3c('0x153')]=function(_0x26bdd7,_0x1c8683){var _0x56b4d9=this;var _0x428627=uuid['v4']();this[_0x9c3c('0x24')][_0x428627]=new Action(_0x26bdd7,_0x1c8683,_0x428627);return new Promise(function(_0xfdb539,_0x14a661){if(_[_0x9c3c('0x42')](_0x26bdd7)&&typeof _0x26bdd7!==_0x9c3c('0x154')){return _0x14a661(msgResponse('originate',_0x9c3c('0x95'),_0x9c3c('0x155')));}if(_[_0x9c3c('0x42')](_0x1c8683[_0x9c3c('0x156')])||_0x1c8683[_0x9c3c('0x156')]===null){return _0x14a661(msgResponse(_0x9c3c('0x157'),_0x9c3c('0x95'),_0x9c3c('0x158')));}var _0x55649b={'XMD-CALLERID':_0x56b4d9[_0x9c3c('0x24')][_0x428627][_0x9c3c('0x159')](),'XMD-AGI':_0x26bdd7[_0x9c3c('0x12e')]?util[_0x9c3c('0x88')](_0x9c3c('0x15a'),ipAgi,_0x26bdd7[_0x9c3c('0x12e')]):_0x9c3c('0x15b'),'XMD-AGIAFTER':_0x26bdd7['dialQueueProject2']?util[_0x9c3c('0x88')](_0x9c3c('0x15a'),ipAgi,_0x26bdd7[_0x9c3c('0xca')]):_0x9c3c('0x15b'),'XMD-QUEUE':utils[_0x9c3c('0x15c')](_0x26bdd7)?util[_0x9c3c('0x88')](_0x9c3c('0x15d'),_0x26bdd7['name'],_0x26bdd7['dialQueueOptions']||'',_0x26bdd7['dialAgiAfterHangupAgent']?'c':'',_0x26bdd7['dialQueueTimeout']||0x3):_0x9c3c('0x15b'),'XMD-CONTACTID':_0x1c8683[_0x9c3c('0xdf')],'XMD-CDRTYPE':_0x9c3c('0x15e'),'CALLERID(all)':_0x56b4d9['actions'][_0x428627][_0x9c3c('0x159')](),'XMD-AMD':_0x26bdd7[_0x9c3c('0x10d')]?_0x9c3c('0x139'):_0x9c3c('0x15b'),'XMD-DESTINATION':_0x9c3c('0x10c')};if(_0x26bdd7[_0x9c3c('0x10d')]){_0x55649b[_0x9c3c('0x15f')]=_0x26bdd7[_0x9c3c('0x160')]||0x9c4;_0x55649b[_0x9c3c('0x161')]=_0x26bdd7['dialAMDGreeting']||0x5dc;_0x55649b[_0x9c3c('0x162')]=_0x26bdd7[_0x9c3c('0x163')]||0x320;_0x55649b[_0x9c3c('0x164')]=_0x26bdd7[_0x9c3c('0x165')]||0x1388;_0x55649b[_0x9c3c('0x166')]=_0x26bdd7[_0x9c3c('0x167')]||0x64;_0x55649b[_0x9c3c('0x168')]=_0x26bdd7[_0x9c3c('0x169')]||0x32;_0x55649b[_0x9c3c('0x16a')]=_0x26bdd7[_0x9c3c('0x16b')]||0x3;_0x55649b[_0x9c3c('0x16c')]=_0x26bdd7[_0x9c3c('0x16d')]||0x100;_0x55649b[_0x9c3c('0x16e')]=_0x26bdd7[_0x9c3c('0x16f')]||0x1388;}if(utils[_0x9c3c('0x15c')](_0x26bdd7)){_0x55649b[_0x9c3c('0x170')]=_0x1c8683[_0x9c3c('0xe0')];}else{_0x55649b[_0x9c3c('0x171')]=_0x1c8683[_0x9c3c('0xe1')];}var _0x38a6d2=utils[_0x9c3c('0x172')](_0x1c8683[_0x9c3c('0x173')]);Object[_0x9c3c('0x13e')](_0x55649b,_0x38a6d2);var _0x5c6b81=_0x56b4d9['isTrunkReachable'](_0x26bdd7[_0x9c3c('0x8e')])?utils[_0x9c3c('0x174')](_0x26bdd7['Trunk']['callerid'],_0x26bdd7[_0x9c3c('0x175')],_0x26bdd7[_0x9c3c('0x176')]>0x0?utils['getCallerIdRandom'](_0x26bdd7[_0x9c3c('0x177')],_0x26bdd7['dialRandomLastDigitCallerIdNumber']):_0x26bdd7['dialOriginateCallerIdNumber']):utils[_0x9c3c('0x174')](_[_0x9c3c('0xf6')](_0x26bdd7[_0x9c3c('0x8f')])?_0x26bdd7['Trunk'][_0x9c3c('0x178')]:_0x26bdd7[_0x9c3c('0x8f')][_0x9c3c('0x178')],_0x26bdd7[_0x9c3c('0x175')],_0x26bdd7[_0x9c3c('0x176')]>0x0?utils['getCallerIdRandom'](_0x26bdd7[_0x9c3c('0x177')],_0x26bdd7[_0x9c3c('0x176')]):_0x26bdd7[_0x9c3c('0x177')]);if(_0x5c6b81){_0x55649b[_0x9c3c('0x179')]=_0x56b4d9[_0x9c3c('0x24')][_0x428627]['originatecalleridname']=utils['extractCalleridName'](_0x5c6b81);_0x55649b['XMD-ORIGINATECALLERIDNUM']=_0x1c8683[_0x9c3c('0x156')];}_0x26bdd7[_0x9c3c('0x17a')]=_0x55649b;return ami[_0x9c3c('0x17b')]({'actionid':_0x428627,'action':'originate','channel':_0x56b4d9[_0x9c3c('0x86')](_0x26bdd7[_0x9c3c('0x8e')])?util[_0x9c3c('0x88')]('SIP/%s/%s%s',_0x26bdd7[_0x9c3c('0x8e')][_0x9c3c('0x48')],isNotNull(_0x26bdd7[_0x9c3c('0x17c')])?_0x26bdd7[_0x9c3c('0x17c')][_0x9c3c('0x17d')]()||'':'',_0x26bdd7[_0x9c3c('0x17e')]>0x0?_0x1c8683[_0x9c3c('0x156')]['substring'](_0x26bdd7['dialCutDigit']):_0x1c8683[_0x9c3c('0x156')]):util['format']('SIP/%s/%s%s',_['isNil'](_0x26bdd7[_0x9c3c('0x8f')])?_0x26bdd7['Trunk']['name']:_0x26bdd7[_0x9c3c('0x8f')][_0x9c3c('0x48')],isNotNull(_0x26bdd7[_0x9c3c('0x17c')])?_0x26bdd7['dialPrefix'][_0x9c3c('0x17d')]()||'':'',_0x26bdd7[_0x9c3c('0x17e')]>0x0?_0x1c8683[_0x9c3c('0x156')][_0x9c3c('0x17f')](_0x26bdd7[_0x9c3c('0x17e')]):_0x1c8683['phone']),'callerid':_0x5c6b81,'Exten':'xcally-motion-dialer','Context':_0x9c3c('0x180'),'Priority':'1','variable':_0x55649b,'timeout':(_0x26bdd7['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x428627})['then'](function(_0x5934e3){return _0xfdb539(_0x5934e3);})[_0x9c3c('0xa1')](function(_0x1d90f0){_0x26bdd7['outboundOriginateFailureCallsDay']+=0x1;var _0x3553f8=new History(_0x56b4d9[_0x9c3c('0x24')][_0x428627]);logger[_0x9c3c('0x64')](util['format']('[originateError]:\x20%s',JSON['stringify'](_0x1d90f0)));_0x3553f8[_0x9c3c('0x6f')]=0xe;_0x3553f8[_0x9c3c('0x70')]='OriginateError';_0x3553f8[_0x9c3c('0xe2')]=moment()['format'](_0x9c3c('0xc8'));_0x3553f8[_0x9c3c('0x71')]=_0x3553f8[_0x9c3c('0xe2')];hopperUtils[_0x9c3c('0xcc')](_0x3553f8)['catch'](loggerCatch('[originate][error]'));_0x56b4d9[_0x9c3c('0xce')](_0x3553f8)['catch'](loggerCatch('[originate][error]'))[_0x9c3c('0x1c')](function(){delete _0x56b4d9[_0x9c3c('0x24')][_0x428627];return _0x14a661(msgResponse(_0x9c3c('0x157'),_0x9c3c('0x85'),'originate\x20action\x20Error'));});});});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x181')]=function(_0x110a31,_0x2d567a,_0x2e2292){var _0x257d27=new History(_0x2d567a);if(_0x257d27['countbusyretry']+_0x257d27[_0x9c3c('0x11d')]+_0x257d27[_0x9c3c('0x182')]+_0x257d27[_0x9c3c('0x11e')]+_0x257d27['countdropretry']+_0x257d27[_0x9c3c('0xe9')]+_0x257d27[_0x9c3c('0x119')]+_0x257d27[_0x9c3c('0x11f')]>=_0x2e2292['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x110a31){case 0x3:if(_0x257d27[_0x9c3c('0x182')]>=_0x2e2292[_0x9c3c('0x183')]-0x1){return!![];}hopperUtils[_0x9c3c('0xdc')]({'active':![],'countnoanswerretry':_0x257d27[_0x9c3c('0x182')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292[_0x9c3c('0x184')],_0x9c3c('0xde'))['format'](_0x9c3c('0xc8')),'ContactId':_0x257d27['ContactId'],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x185')));break;case 0x5:if(_0x257d27[_0x9c3c('0x11c')]>=_0x2e2292['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x9c3c('0xdc')]({'active':![],'countbusyretry':_0x257d27[_0x9c3c('0x11c')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292[_0x9c3c('0x186')],_0x9c3c('0xde'))['format'](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x187')));break;case 0x8:if(_0x257d27['countcongestionretry']>=_0x2e2292[_0x9c3c('0x188')]-0x1){return!![];}hopperUtils[_0x9c3c('0xdc')]({'active':![],'countcongestionretry':_0x257d27['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x2e2292[_0x9c3c('0x189')],'minutes')['format'](_0x9c3c('0xc8')),'ContactId':_0x257d27['ContactId'],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27['CampaignId']||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x18a')));break;case 0x0:if(_0x257d27['countnosuchnumberretry']>=_0x2e2292[_0x9c3c('0x18b')]-0x1){return!![];}else{hopperUtils[_0x9c3c('0xdc')]({'active':![],'countnosuchnumberretry':_0x257d27[_0x9c3c('0x11e')]+=0x1,'scheduledat':moment()['add'](_0x2e2292['dialNoSuchNumberRetryFrequency'],_0x9c3c('0xde'))['format'](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x257d27[_0x9c3c('0xd6')]>=_0x2e2292['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x9c3c('0xdc')]({'active':![],'countdropretry':_0x257d27[_0x9c3c('0xd6')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292['dialDropRetryFrequency'],_0x9c3c('0xde'))[_0x9c3c('0x88')](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27[_0x9c3c('0xec')],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x18c')));break;case 0xb:if(_0x257d27[_0x9c3c('0xe9')]>=_0x2e2292[_0x9c3c('0xeb')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x257d27[_0x9c3c('0xe9')]+=0x1,'scheduledat':moment()['add'](_0x2e2292[_0x9c3c('0x18d')],_0x9c3c('0xde'))[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27['ListId'],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0xed')));break;case 0x13:if(_0x257d27[_0x9c3c('0x119')]>=_0x2e2292['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x257d27[_0x9c3c('0x119')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292[_0x9c3c('0x125')],_0x9c3c('0xde'))[_0x9c3c('0x88')](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27['ListId'],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x126')));break;case 0x14:if(_0x257d27[_0x9c3c('0x11f')]>=_0x2e2292[_0x9c3c('0x18e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x257d27[_0x9c3c('0x11f')]+=0x1,'scheduledat':moment()[_0x9c3c('0xdd')](_0x2e2292[_0x9c3c('0x18f')],_0x9c3c('0xde'))[_0x9c3c('0x88')](_0x9c3c('0xc8')),'ContactId':_0x257d27[_0x9c3c('0xdf')],'ListId':_0x257d27['ListId'],'VoiceQueueId':_0x257d27[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x257d27[_0x9c3c('0xe1')]||undefined})[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x190')));break;default:return!![];}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x108')]=function(_0x5724ec,_0x31113f,_0x521f6d){var _0x2940fe=this;var _0x23ab3e=new History(_0x5724ec);var _0x45a4a5=![];var _0x40166f;var _0x544565;return new Promise(function(_0x306148,_0x38727b){if(_[_0x9c3c('0x42')](_0x31113f)&&typeof _0x31113f!==_0x9c3c('0x154')){return _0x38727b(msgResponse(_0x9c3c('0x191'),'Failure',_0x9c3c('0x192')));}if(_[_0x9c3c('0x42')](_0x521f6d)&&typeof _0x521f6d!==_0x9c3c('0x154')){return _0x38727b(msgResponse('[callProgressDetecting]',_0x9c3c('0x95'),_0x9c3c('0x193')));}hopperUtils[_0x9c3c('0xd8')](_0x23ab3e,_0x521f6d[_0x9c3c('0x194')],_0x31113f)['then'](function(_0x525fc9){if(_0x525fc9[_0x9c3c('0xd9')]==0x1)_0x45a4a5=!![];switch(_0x521f6d[_0x9c3c('0x194')]){case'0':_0x31113f[_0x9c3c('0x195')]+=0x1;_0x23ab3e['state']=0x0;_0x23ab3e['statedesc']=_0x9c3c('0x196');_0x23ab3e[_0x9c3c('0x11e')]+=0x1;_0x23ab3e[_0x9c3c('0xd7')]+=0x1;ami[_0x9c3c('0x43')](_0x9c3c('0x197'),ut[_0x9c3c('0x113')](_0x5724ec,_0x9c3c('0x198')));_0x40166f=_0x31113f['dialNoSuchNumberRetryFrequency'];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x11b')));if(_0x2940fe[_0x9c3c('0x181')](0x0,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0x11e')]>=_0x31113f[_0x9c3c('0x18b')]){_0x2940fe['createStateFinal'](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x19a'));}else{_0x2940fe[_0x9c3c('0x120')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x19a'));}}break;case'3':_0x31113f[_0x9c3c('0x19b')]+=0x1;_0x23ab3e['state']=0x3;_0x23ab3e['statedesc']=_0x9c3c('0x19c');_0x23ab3e[_0x9c3c('0x182')]+=0x1;_0x23ab3e[_0x9c3c('0xd7')]+=0x1;var _0x507576=ut[_0x9c3c('0x19d')](_0x5724ec,_0x31113f);ami['emit']('custom:agentnoanswer',_0x507576);_0x40166f=_0x31113f[_0x9c3c('0x184')];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x19e')));if(_0x2940fe[_0x9c3c('0x181')](0x3,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0x182')]>=_0x31113f[_0x9c3c('0x183')]){_0x2940fe[_0x9c3c('0x123')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x19f'));}else{_0x2940fe[_0x9c3c('0x120')](_0x23ab3e,_0x306148,_0x38727b,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x31113f[_0x9c3c('0x1a0')]+=0x1;_0x23ab3e[_0x9c3c('0x6f')]=0x5;_0x23ab3e['statedesc']='Busy';_0x23ab3e[_0x9c3c('0x11c')]+=0x1;_0x23ab3e['countglobal']+=0x1;ami[_0x9c3c('0x43')](_0x9c3c('0x1a1'),ut[_0x9c3c('0x113')](_0x5724ec,'busy'));_0x40166f=_0x31113f[_0x9c3c('0x186')];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2940fe[_0x9c3c('0x181')](0x5,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0x11c')]>=_0x31113f[_0x9c3c('0x1a2')]){_0x2940fe[_0x9c3c('0x123')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1a3'));}else{_0x2940fe[_0x9c3c('0x120')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1a3'));}}break;case'8':_0x31113f[_0x9c3c('0x1a4')]+=0x1;_0x23ab3e[_0x9c3c('0x6f')]=0x8;_0x23ab3e[_0x9c3c('0x70')]=_0x9c3c('0x1a5');_0x23ab3e[_0x9c3c('0x11d')]+=0x1;_0x23ab3e[_0x9c3c('0xd7')]+=0x1;_0x40166f=_0x31113f['dialCongestionRetryFrequency'];_0x544565=_0x31113f['callAdditionalPhoneAfterMin'];ami[_0x9c3c('0x43')](_0x9c3c('0x1a6'),ut[_0x9c3c('0x113')](_0x5724ec,_0x9c3c('0x1a7')));hopperUtils['createHistory'](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x1a8')));if(_0x2940fe[_0x9c3c('0x181')](0x8,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e['countcongestionretry']>=_0x31113f[_0x9c3c('0x188')]){_0x2940fe[_0x9c3c('0x123')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1a9'));}else{_0x2940fe['stateGlobal'](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1a9'));}}break;case'11':_0x31113f[_0x9c3c('0x1aa')]+=0x1;_0x23ab3e['state']=0xb;_0x23ab3e[_0x9c3c('0x70')]='Abandoned';_0x23ab3e['countabandonedretry']+=0x1;_0x23ab3e['countglobal']+=0x1;_0x40166f=_0x31113f['dialAbandonedRetryFrequency'];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2940fe[_0x9c3c('0x181')](0xb,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0xe9')]>=_0x31113f[_0x9c3c('0xeb')]){_0x2940fe[_0x9c3c('0x123')](_0x23ab3e,_0x306148,_0x38727b,'reason\x2011\x20abandoned');}else{_0x2940fe[_0x9c3c('0x120')](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1ab'));}}break;case'20':_0x31113f[_0x9c3c('0x1ac')]+=0x1;_0x23ab3e[_0x9c3c('0x6f')]=0x14;_0x23ab3e[_0x9c3c('0x70')]=_0x9c3c('0x1ad');_0x23ab3e[_0x9c3c('0x11f')]+=0x1;_0x23ab3e[_0x9c3c('0xd7')]+=0x1;_0x40166f=_0x31113f[_0x9c3c('0x18f')];_0x544565=_0x31113f[_0x9c3c('0x199')];ami[_0x9c3c('0x43')](_0x9c3c('0x1ae'),ut['buildObj'](_0x5724ec,_0x9c3c('0x1af')));hopperUtils['createHistory'](_0x23ab3e)[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x1b0')));if(_0x2940fe[_0x9c3c('0x181')](0x14,_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e[_0x9c3c('0x11f')]>=_0x31113f['dialAgentRejectMaxRetry']){_0x2940fe['createStateFinal'](_0x23ab3e,_0x306148,_0x38727b,_0x9c3c('0x1b1'));}else{_0x2940fe['stateGlobal'](_0x23ab3e,_0x306148,_0x38727b,'reason\x2020\x20agentreject');}}break;default:_0x31113f[_0x9c3c('0x130')]+=0x1;_0x23ab3e['state']=0xc;_0x23ab3e[_0x9c3c('0x70')]=_0x521f6d['reason'];_0x40166f=_0x31113f[_0x9c3c('0x18f')];_0x544565=_0x31113f[_0x9c3c('0x199')];hopperUtils[_0x9c3c('0xcc')](_0x23ab3e)['catch'](loggerCatch(_0x9c3c('0x1b2')));if(_0x2940fe[_0x9c3c('0x181')](_0x521f6d['reason'],_0x5724ec,_0x31113f)&&!_0x45a4a5){if(_0x23ab3e['countbusyretry']+_0x23ab3e[_0x9c3c('0x11d')]+_0x23ab3e[_0x9c3c('0x182')]+_0x23ab3e[_0x9c3c('0x11e')]+_0x23ab3e['countdropretry']+_0x23ab3e['countabandonedretry']+_0x23ab3e[_0x9c3c('0x119')]+_0x23ab3e[_0x9c3c('0x11f')]>=_0x31113f[_0x9c3c('0x12a')]){_0x2940fe['stateGlobal'](_0x23ab3e,_0x306148,_0x38727b,_0x521f6d['reason']);}else{_0x2940fe['createStateFinal'](_0x23ab3e,_0x306148,_0x38727b,_0x521f6d['reason']);}}}})[_0x9c3c('0x40')](function(){if(_0x45a4a5){hopperUtils[_0x9c3c('0xe6')](_0x23ab3e,_0x40166f,_0x544565)[_0x9c3c('0x40')](function(){return _0x306148(0x1);});}});});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x120')]=function(_0x574965,_0x8976dd,_0x169e9f,_0x1b8d1c){var _0x1fb7a2=new Final(_0x574965);_0x1fb7a2['state']=0xf;_0x1fb7a2[_0x9c3c('0x70')]=_0x9c3c('0x1b3');this['createStateFinal'](_0x1fb7a2,_0x8976dd,_0x169e9f,_0x1b8d1c);};Dialer['prototype'][_0x9c3c('0x123')]=function(_0x53a147,_0x7bb5b0,_0x4ca96a,_0x141082){hopperUtils[_0x9c3c('0xce')](_0x53a147)[_0x9c3c('0x40')](function(){return _0x7bb5b0(msgResponse('[callProgressDetecting]',_0x9c3c('0x107'),_0x141082));})['catch'](function(){return _0x4ca96a(msgResponse(_0x9c3c('0x1b4'),_0x9c3c('0x95'),_0x9c3c('0x1b5')));});};Dialer[_0x9c3c('0x19')][_0x9c3c('0x7')]=function(_0x5b24b9){var _0x298bc1=_0x5b24b9['dialPredictiveOptimizationPercentage']/0x64;var _0x545ec0=_0x5b24b9[_0x9c3c('0xd2')]/(_0x5b24b9[_0x9c3c('0xd2')]+_0x5b24b9['outboundAnswerCallsDay']);var _0x1c01ae=Math[_0x9c3c('0x1b6')](_0x5b24b9[_0x9c3c('0x1b7')]*(_0x5b24b9[_0x9c3c('0x1b8')]/0x64));var _0x176bbb=Math[_0x9c3c('0x1b6')](_0x5b24b9[_0x9c3c('0x1b7')]*(_0x5b24b9[_0x9c3c('0x1b9')]/0x64));var _0x156e92=_0x5b24b9[_0x9c3c('0x137')]+_0x5b24b9[_0x9c3c('0x1ba')];var _0x4ee1c4=Math[_0x9c3c('0x1bb')](_0x5b24b9[_0x9c3c('0x58')]*_0x5b24b9[_0x9c3c('0x5b')]*_0x5b24b9['predictiveIntervalHitRate']*_0x5b24b9[_0x9c3c('0x1bc')]);if(_[_0x9c3c('0x42')](_0x5b24b9[_0x9c3c('0x5f')])){if(!_[_0x9c3c('0x42')](_0x5b24b9[_0x9c3c('0x60')])){_0x5b24b9['startPredictive']=undefined;loggerPredictive[_0x9c3c('0x64')](_0x9c3c('0x1bd'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x9c3c('0x42')](_0x5b24b9[_0x9c3c('0x62')])){loggerPredictive[_0x9c3c('0x64')](_0x9c3c('0x1bd'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5b24b9[_0x9c3c('0x62')]);_0x5b24b9[_0x9c3c('0x62')]=undefined;}_0x5b24b9[_0x9c3c('0x5f')]=moment()[_0x9c3c('0x88')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x5b24b9['name'],_0x9c3c('0x1be'),_0x5b24b9['startProgressive']);this['handlePower'](_0x5b24b9,0x1);}else if(ifInterval(_0x5b24b9[_0x9c3c('0x1bf')],_0x5b24b9[_0x9c3c('0x5f')])){this[_0x9c3c('0xb7')](_0x5b24b9,0x1);loggerPredictiveCalls[_0x9c3c('0x4a')]('[startMethodPredictive][StartProgressive][Loop]',_0x5b24b9[_0x9c3c('0x5f')],_0x5b24b9[_0x9c3c('0x48')]);_0x5b24b9[_0x9c3c('0x58')]=0x0;_0x5b24b9[_0x9c3c('0x1c0')]=0x0;}else if(_0x298bc1<_0x545ec0&&_0x5b24b9[_0x9c3c('0x1c1')]===_0x9c3c('0x1c2')){clearPredictiveAttributes(_0x5b24b9);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x1c3'),_0x9c3c('0x1c4'),_0x545ec0,_0x9c3c('0x5f'),_0x5b24b9[_0x9c3c('0x48')]);}else if(_0x4ee1c4<_0x5b24b9[_0x9c3c('0x1c0')]&&_0x5b24b9['dialPredictiveOptimization']===_0x9c3c('0x1c2')){clearPredictiveAttributes(_0x5b24b9);loggerPredictive[_0x9c3c('0x4a')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x9c3c('0x1c5'),_0x4ee1c4,_0x9c3c('0x1c6'),_0x5b24b9[_0x9c3c('0x1c0')],_0x9c3c('0x5f'),_0x5b24b9[_0x9c3c('0x48')]);}else if(!ifInterval(_0x5b24b9[_0x9c3c('0x1bf')],_0x5b24b9[_0x9c3c('0x5f')])&&_[_0x9c3c('0x42')](_0x5b24b9['startPredictive'])&&!_[_0x9c3c('0x42')](_0x5b24b9['startProgressive'])){_0x5b24b9[_0x9c3c('0x60')]=moment()[_0x9c3c('0x88')](_0x9c3c('0xc8'));loggerPredictive[_0x9c3c('0x4a')](_0x5b24b9[_0x9c3c('0x48')],_0x9c3c('0x1c7'),_0x5b24b9['startPredictive']);hopperUtils[_0x9c3c('0x1c8')](_0x5b24b9[_0x9c3c('0x1bf')])['then'](this[_0x9c3c('0x1c9')](_0x5b24b9))[_0x9c3c('0x40')](mergeDataErlangB(_0x5b24b9))[_0x9c3c('0x40')](this[_0x9c3c('0x1ca')](_0x5b24b9))[_0x9c3c('0xa1')](loggerCatchPredictive(_0x9c3c('0x1cb'),_0x5b24b9));}else if(!ifInterval(_0x5b24b9[_0x9c3c('0x1bf')],_0x5b24b9[_0x9c3c('0x60')])){_0x5b24b9[_0x9c3c('0x1c0')]=0x0;_0x5b24b9[_0x9c3c('0x60')]=moment()[_0x9c3c('0x88')](_0x9c3c('0xc8'));loggerPredictive['info'](_0x5b24b9[_0x9c3c('0x48')],_0x9c3c('0x1cc'),_0x5b24b9[_0x9c3c('0x60')]);clearInterval(_0x5b24b9['handlePredictive']);_0x5b24b9[_0x9c3c('0x62')]=undefined;hopperUtils[_0x9c3c('0x1c8')](_0x5b24b9['dialPredictiveInterval'])[_0x9c3c('0x40')](this[_0x9c3c('0x1c9')](_0x5b24b9))['then'](mergeDataErlangB(_0x5b24b9))[_0x9c3c('0x40')](this['startMethodPredictive'](_0x5b24b9))['catch'](loggerCatchPredictive(_0x9c3c('0x1cd'),_0x5b24b9));}else if(_0x5b24b9[_0x9c3c('0x1b7')]&&_0x156e92<_0x5b24b9[_0x9c3c('0x1b7')]-_0x176bbb){clearPredictiveAttributes(_0x5b24b9);loggerPredictive[_0x9c3c('0x4a')](_0x5b24b9[_0x9c3c('0x48')],_0x9c3c('0x1ce'),_0x156e92,')\x20are\x20less\x20than\x20threshold\x20(',_0x5b24b9[_0x9c3c('0x1b7')],'-',_0x176bbb,'=',_0x5b24b9['predictiveIntervalAvailable']-_0x176bbb,')');}else if(_0x5b24b9['predictiveIntervalAvailable']&&_0x156e92>_0x5b24b9[_0x9c3c('0x1b7')]+_0x1c01ae){clearPredictiveAttributes(_0x5b24b9);loggerPredictive[_0x9c3c('0x4a')](_0x5b24b9[_0x9c3c('0x48')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x156e92,_0x9c3c('0x1cf'),_0x5b24b9['predictiveIntervalAvailable'],'+',_0x1c01ae,'=',_0x5b24b9[_0x9c3c('0x1b7')]+_0x1c01ae,')');}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x1c9')]=function(_0x1cd9aa){var _0xcebee0=this;return function(_0x3789e2){return new Promise(function(_0x55909d,_0x40979a){_['merge'](_0x1cd9aa,_0x3789e2[0x0]);if(checkGetDataPredictive(_0x3789e2[0x0])){var _0x4a86c1=_0x1cd9aa[_0x9c3c('0x1b7')]=_0x1cd9aa[_0x9c3c('0x1ba')]+_0x1cd9aa[_0x9c3c('0x137')];var _0x50f9d3=_0x1cd9aa[_0x9c3c('0x1bf')]*0x3c;var _0x1a9120=_0x3789e2[0x0][_0x9c3c('0x52')]+_0x3789e2[0x0][_0x9c3c('0x50')];var _0xc58333=(_0x3789e2[0x0][_0x9c3c('0x1d0')]+_0x3789e2[0x0][_0x9c3c('0x4e')]+_0x3789e2[0x0][_0x9c3c('0xe7')])/_0x3789e2[0x0]['predictiveIntervalTotalCalls'];_0x1cd9aa['predictiveIntervalHitRate']=_0xc58333>0x0?_0xc58333:0x1;switch(_0x1cd9aa[_0x9c3c('0x1c1')]){case _0x9c3c('0x1c2'):var _0x8e2acd=_0x1cd9aa[_0x9c3c('0x1d1')]/0x64;return _0xcebee0[_0x9c3c('0x1d2')](_0x4a86c1,_0x50f9d3,_0x1a9120,_0xc58333,_0x8e2acd)[_0x9c3c('0x40')](function(_0x1edb2c){return _0x55909d(_0x1edb2c);});case'agentBusyFactor':var _0xa026be=_0x1cd9aa['dialPredictiveOptimizationPercentage']/0x64;return _0xcebee0[_0x9c3c('0x1d3')](_0x4a86c1,_0x50f9d3,_0x1a9120,_0xc58333,_0xa026be)[_0x9c3c('0x40')](function(_0xfcbc7f){return _0x55909d(_0xfcbc7f);});default:return _0x40979a(msgResponse(_0x9c3c('0x1d4'),'Failure',_0x9c3c('0x1d5')));}}else{return _0x40979a(msgResponse(_0x9c3c('0x1d4'),_0x9c3c('0x95'),'check\x20failure'));}});};};Dialer[_0x9c3c('0x19')]['getDataPredictiveOld']=function(_0x75b65f){var _0x10a500=this;return function(_0x429e94){return new Promise(function(_0x423875,_0xbbcb64){_[_0x9c3c('0x5d')](_0x75b65f,_0x429e94[0x0]);if(checkGetDataPredictive(_0x429e94[0x0])){loggerPredictive['info'](JSON[_0x9c3c('0x75')](_0x429e94[0x0]));if(_0x75b65f['dialPredictiveOptimization']===_0x9c3c('0x1c2')){return _0x10a500[_0x9c3c('0x1d6')](_0x75b65f['id'])[_0x9c3c('0x40')](function(_0x13fd24){var _0x61f83c=_0x75b65f[_0x9c3c('0x1d7')]-_0x13fd24[0x0][_0x9c3c('0x1d8')];var _0x1a47ed=_0x75b65f['dialPredictiveInterval']*0x3c;var _0x258e82=_0x429e94[0x0][_0x9c3c('0x52')]+_0x429e94[0x0][_0x9c3c('0x50')];var _0x2aa56e=(_0x429e94[0x0][_0x9c3c('0x1d0')]+_0x429e94[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x429e94[0x0][_0x9c3c('0xe7')])/_0x429e94[0x0]['predictiveIntervalTotalCalls'];var _0x2e713d=_0x75b65f[_0x9c3c('0x1d1')]/0x64;_0x75b65f[_0x9c3c('0x1d9')]=_0x13fd24[0x0]['outboundQueuePauses']||0x0;_0x75b65f['predictiveIntervalHitRate']=_0x2aa56e>0x0?_0x2aa56e:0x1;return _0x10a500[_0x9c3c('0x1d2')](_0x61f83c,_0x1a47ed,_0x258e82,_0x2aa56e,_0x2e713d);})['then'](function(_0x12b841){return _0x423875(_0x12b841);})[_0x9c3c('0xa1')](function(_0x4f96ef){return _0xbbcb64(msgResponse(_0x9c3c('0x1da'),_0x9c3c('0x95'),JSON[_0x9c3c('0x75')](_0x4f96ef)));});}if(_0x75b65f[_0x9c3c('0x1c1')]===_0x9c3c('0x1db')){return _0x10a500[_0x9c3c('0x1d6')](_0x75b65f['id'])[_0x9c3c('0x40')](function(_0x533268){var _0x2ab2ab=_0x75b65f[_0x9c3c('0x1d7')]-_0x533268[0x0][_0x9c3c('0x1d8')];var _0xaed33=_0x75b65f[_0x9c3c('0x1bf')]*0x3c;var _0x35da9a=_0x429e94[0x0][_0x9c3c('0x52')]+_0x429e94[0x0][_0x9c3c('0x50')];var _0x56be27=(_0x429e94[0x0][_0x9c3c('0x1d0')]+_0x429e94[0x0][_0x9c3c('0x4e')]+_0x429e94[0x0][_0x9c3c('0xe7')])/_0x429e94[0x0][_0x9c3c('0x4c')];var _0x49b1dd=_0x75b65f['dialPredictiveOptimizationPercentage']/0x64;_0x75b65f[_0x9c3c('0x1d9')]=_0x533268[0x0][_0x9c3c('0x1d8')]||0x0;_0x75b65f[_0x9c3c('0x1dc')]=_0x56be27>0x0?_0x56be27:0x1;return _0x10a500[_0x9c3c('0x1d3')](_0x2ab2ab,_0xaed33,_0x35da9a,_0x56be27,_0x49b1dd);})['then'](function(_0x101f6b){return _0x423875(_0x101f6b);})['catch'](function(_0x263ea5){return _0xbbcb64(msgResponse('[CatchErlangB]',_0x9c3c('0x95'),JSON[_0x9c3c('0x75')](_0x263ea5)));});}}else{return _0xbbcb64(msgResponse(_0x9c3c('0x1d4'),_0x9c3c('0x95'),_0x9c3c('0x1dd')));}});};};Dialer[_0x9c3c('0x19')]['startMethodPredictive']=function(_0x5c0599){var _0xeb5d51=this;return function(){var _0x4c5795=0x0;var _0x7911f2=Math[_0x9c3c('0x1bb')](_0x5c0599[_0x9c3c('0x1de')]*0x3e8);if(_0x7911f2>0x0){_0x7911f2=_0x7911f2<0x64?0x64:_0x7911f2;loggerPredictive['info'](_0x5c0599['name'],_0x9c3c('0x1df'),_0x7911f2,_0x9c3c('0x1e0'));_0x5c0599['handlePredictive']=setInterval(function(){_0xeb5d51[_0x9c3c('0x62')](_0x5c0599);loggerPredictiveCalls['info'](_0x9c3c('0x1e1'),_0x4c5795+=0x1);},_0x7911f2);}else{loggerPredictive[_0x9c3c('0x4a')](_0x5c0599['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x9c3c('0x19')][_0x9c3c('0x1e2')]=function(_0x56e6cc,_0x407934){var _0x153795=this;return function(_0xaa7b0d){if(_[_0x9c3c('0x7a')](_0xaa7b0d)){if(_[_0x9c3c('0xf6')](_0x407934[_0x9c3c('0x150')])||!_0x407934[_0x9c3c('0x1e3')]){if(_0x56e6cc['dialMethod']===_0x9c3c('0xb9')){_0x56e6cc[_0x9c3c('0x72')]=_['isUndefined'](_0x56e6cc[_0x9c3c('0x72')])?!![]:_0x56e6cc[_0x9c3c('0x72')];var _0x32d73d=uuid['v4']();_0x153795['actions'][_0x32d73d]=new Action(_0x56e6cc,_0x407934,_0x32d73d);loggerBooked[_0x9c3c('0x4a')]('[booked][checkContactBlack]',_0x32d73d,_0x9c3c('0x1e4'),JSON['stringify'](_0x56e6cc[_0x9c3c('0x72')]),_0x9c3c('0x1e5'),_0x56e6cc[_0x9c3c('0x48')]);if(_0x56e6cc[_0x9c3c('0x72')]){_0x56e6cc[_0x9c3c('0x72')]=![];_0x153795[_0x9c3c('0xf7')][_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xc6')]]=[];ami[_0x9c3c('0x17b')]({'actionid':_0x32d73d,'action':_0x9c3c('0x1e6'),'queue':_0x56e6cc[_0x9c3c('0x48')]})[_0x9c3c('0xa1')](function(){_0x153795[_0x9c3c('0xc5')](_0x56e6cc);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xdf')],'ListId':_0x153795['actions'][_0x32d73d]['ListId'],'VoiceQueueId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xe0')]||undefined,'CampaignId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x1e7')));delete _0x153795[_0x9c3c('0x24')][_0x32d73d];});}else{loggerBooked[_0x9c3c('0x4a')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x56e6cc['queueStatusComplete']),'Queue:\x20',_0x56e6cc[_0x9c3c('0x48')]);_0x153795[_0x9c3c('0xc5')](_0x56e6cc);hopperUtils[_0x9c3c('0xdc')]({'active':![],'ContactId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xdf')],'ListId':_0x153795[_0x9c3c('0x24')][_0x32d73d][_0x9c3c('0xec')],'VoiceQueueId':_0x153795[_0x9c3c('0x24')][_0x32d73d]['VoiceQueueId']||undefined,'CampaignId':_0x153795[_0x9c3c('0x24')][_0x32d73d]['CampaignId']||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x153795[_0x9c3c('0x24')][_0x32d73d];}}else{return _0x153795[_0x9c3c('0x153')](_0x56e6cc,_0x407934);}}else{if(utils[_0x9c3c('0x5e')](undefined,_0x407934['scheduledat'])<_0x56e6cc[_0x9c3c('0x1e8')]*0x3c){if(_0x407934[_0x9c3c('0x142')]&&!_0x407934[_0x9c3c('0x142')][_0x9c3c('0x1e9')]){_0x153795['preview'][_0x9c3c('0x100')](_0x407934['id'])[_0x9c3c('0x1c')](function(){_0x153795['updateOriginated'](_0x56e6cc);});}else{hopperUtils['unlockContact']({'active':![]},_0x407934['id'],0x1)[_0x9c3c('0x1c')](function(){_0x153795[_0x9c3c('0xc5')](_0x56e6cc);});}}else{_0x56e6cc[_0x9c3c('0x1ea')]+=0x1;_0x153795[_0x9c3c('0xc5')](_0x56e6cc);if(_0x56e6cc['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x407934[_0x9c3c('0xdf')],'ListId':_0x407934['ListId'],'VoiceQueueId':_0x407934[_0x9c3c('0xe0')]||undefined,'CampaignId':_0x407934[_0x9c3c('0xe1')]||undefined})['catch'](loggerCatch(_0x9c3c('0x1eb')));hopperUtils[_0x9c3c('0xcc')](createObjHistory(_0x56e6cc,_0x407934,utils['CAMPAIGN_STATUS'][_0x9c3c('0x1ec')],0x17,_0x9c3c('0x1ed')))['catch'](loggerCatch(_0x9c3c('0x1ee')));}else{_0x153795[_0x9c3c('0x115')](createObjHistory(_0x56e6cc,_0x407934,utils[_0x9c3c('0x6c')]['RECALL_TIMEOUT'],0x16,_0x9c3c('0x1ef')),_0x9c3c('0x1f0'),'[Originate][HistoryRecallClose]');}}}}else{_0x56e6cc[_0x9c3c('0x1f1')]+=0x1;_0x153795[_0x9c3c('0x115')](createObjHistory(_0x56e6cc,_0x407934,utils[_0x9c3c('0x6c')][_0x9c3c('0x1f2')],0xd,_0x9c3c('0x1f3')),'[Originate][historyBlacklist]',_0x9c3c('0x1f4'));throw _0x9c3c('0x1f5');}};};Dialer[_0x9c3c('0x19')][_0x9c3c('0x1f6')]=function(_0x3ebe36){var _0x39a7ee=this;var _0x3879a4=_0x3ebe36[_0x9c3c('0x1f7')]-_0x3ebe36[_0x9c3c('0x7f')];emitCampaignSummary(_0x3ebe36);if(_0x3879a4>0x0&&_0x3ebe36[_0x9c3c('0x67')]==0x0){if(_0x3879a4>this[_0x9c3c('0x22')]){_0x3879a4=this[_0x9c3c('0x22')];}_0x3ebe36[_0x9c3c('0x67')]=0x1;hopperUtils[_0x9c3c('0x1f8')](_0x3ebe36,_0x3879a4)['then'](function(_0x5b5c2b){_0x3ebe36[_0x9c3c('0x67')]=0x0;if(_0x5b5c2b){if(!utils[_0x9c3c('0x1f9')](_0x5b5c2b)){_0x3ebe36[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')][_0x9c3c('0x6d')];logger[_0x9c3c('0x4a')](_0x9c3c('0x1fa')+_0x3ebe36[_0x9c3c('0x48')]);}else{_0x3ebe36[_0x9c3c('0x7f')]+=_0x5b5c2b[_0x9c3c('0x9a')];_0x3ebe36[_0x9c3c('0x69')]=utils[_0x9c3c('0x6c')]['RUNNING'];for(var _0x2504f8=0x0;_0x2504f8<_0x5b5c2b[_0x9c3c('0x9a')];_0x2504f8+=0x1){_0x3ebe36[_0x9c3c('0x1fb')]+=0x1;if(_[_0x9c3c('0xf6')](_0x5b5c2b[_0x2504f8])||_['isNil'](_0x5b5c2b[_0x2504f8][_0x9c3c('0x173')])||_[_0x9c3c('0xf6')](_0x5b5c2b[_0x2504f8]['phone'])){_0x39a7ee[_0x9c3c('0x14e')]('[actionOriginate]\x20',_0x3ebe36,_0x5b5c2b[_0x2504f8]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x9c3c('0x76')](_0x5b5c2b[_0x2504f8],[_0x9c3c('0xe1'),_0x9c3c('0x156')]))[_0x9c3c('0x40')](_0x39a7ee[_0x9c3c('0x1e2')](_0x3ebe36,_0x5b5c2b[_0x2504f8]))[_0x9c3c('0xa1')](_0x39a7ee[_0x9c3c('0x14d')](_0x9c3c('0x1fc'),_0x3ebe36));}}}}})[_0x9c3c('0xa1')](loggerGetContactDialer(_0x9c3c('0x1fd'),_0x3ebe36,_0x3879a4));}};Dialer[_0x9c3c('0x19')]['handlePower']=function(_0xfe3600,_0x1bf203){var _0x240b60=this;var _0xc8e37f=[];if(_0x1bf203<0x1||_0xfe3600['dialMethod']==='booked'){_0x1bf203=0x1;}var _0x4474fa=Math[_0x9c3c('0x1bb')](_0xfe3600[_0x9c3c('0x137')]*_0x1bf203)-_0xfe3600[_0x9c3c('0x7f')];if(_0xfe3600[_0x9c3c('0x1fe')]>0x0){var _0x2f1a67=_0xfe3600['dialLimitQueue']-_0xfe3600['originated']-_0xfe3600['talking']-_0xfe3600['pTalking'];if(_0x4474fa>_0x2f1a67){_0x4474fa=_0x2f1a67;}}if(_0x4474fa>0x0&&_0xfe3600['temp']==0x0){if(_0xfe3600[_0x9c3c('0xb5')]==='booked'){_0x4474fa=0x1;}if(_0x4474fa>this[_0x9c3c('0x22')]){_0x4474fa=this[_0x9c3c('0x22')];}for(var _0xd51d66 in this[_0x9c3c('0x20')]){if(typeof this[_0x9c3c('0x20')][_0xd51d66]!==_0x9c3c('0xad')){if(this[_0x9c3c('0x20')][_0xd51d66][_0x9c3c('0x6f')]===_0x9c3c('0x1ff')&&this['agents'][_0xd51d66]['status']===_0x9c3c('0x8b')){_0xc8e37f['push'](this[_0x9c3c('0x20')][_0xd51d66]['id']);}}}_0xfe3600[_0x9c3c('0x67')]=0x1;hopperUtils['getContactDialer'](_0xfe3600,_0xc8e37f,_0x4474fa)[_0x9c3c('0x40')](function(_0x3a3440){_0xfe3600[_0x9c3c('0x67')]=0x0;if(_0x3a3440){if(!utils[_0x9c3c('0x1f9')](_0x3a3440)){hopperUtils[_0x9c3c('0x200')](_0xfe3600)[_0x9c3c('0x40')](sendMessageReschedule(_0xfe3600))['catch'](loggerCatch(_0x9c3c('0x201')));}else{_0xfe3600['originated']+=_0x3a3440[_0x9c3c('0x9a')];_0xfe3600[_0x9c3c('0x69')]=_0xfe3600[_0x9c3c('0xb5')]==='booked'?utils['CAMPAIGN_STATUS']['ACTIVE']:utils[_0x9c3c('0x6c')][_0x9c3c('0x202')];for(var _0x427677=0x0;_0x427677<_0x3a3440[_0x9c3c('0x9a')];_0x427677+=0x1){if(_[_0x9c3c('0xf6')](_0x3a3440[_0x427677])||_[_0x9c3c('0xf6')](_0x3a3440[_0x427677][_0x9c3c('0x173')])||_[_0x9c3c('0xf6')](_0x3a3440[_0x427677][_0x9c3c('0x156')])){_0x240b60[_0x9c3c('0x14e')]('[actionOriginate]\x20',_0xfe3600,_0x3a3440[_0x427677]);}else{hopperUtils[_0x9c3c('0x203')](_[_0x9c3c('0x76')](_0x3a3440[_0x427677],[_0x9c3c('0xe0'),_0x9c3c('0x156')]))[_0x9c3c('0x40')](_0x240b60[_0x9c3c('0x1e2')](_0xfe3600,_0x3a3440[_0x427677]))['catch'](_0x240b60[_0x9c3c('0x14d')](_0x9c3c('0x204'),_0xfe3600));}}}}})[_0x9c3c('0xa1')](loggerGetContactDialer('[getContactDialer2]',_0xfe3600,_0x4474fa));}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x62')]=function(_0x4a0259){if(_0x4a0259['dialLimitQueue']>0x0){var _0x55b598=_0x4a0259[_0x9c3c('0x1fe')]-_0x4a0259[_0x9c3c('0x7f')]-_0x4a0259[_0x9c3c('0x1ba')];if(_0x55b598>0x0&&_0x4a0259['temp']==0x0){this[_0x9c3c('0x205')](_0x4a0259);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x9c3c('0x205')](_0x4a0259);}};Dialer[_0x9c3c('0x19')][_0x9c3c('0x205')]=function(_0x2fa9e8){var _0x3cbb5d=this;var _0x94aa78=[];_0x2fa9e8[_0x9c3c('0x7f')]+=0x1;for(var _0x51a00e in this[_0x9c3c('0x20')]){if(typeof this[_0x9c3c('0x20')][_0x51a00e]!==_0x9c3c('0xad')){if(this[_0x9c3c('0x20')][_0x51a00e][_0x9c3c('0x6f')]===_0x9c3c('0x1ff')&&this['agents'][_0x51a00e]['status']===_0x9c3c('0x8b')){_0x94aa78[_0x9c3c('0x9b')](this[_0x9c3c('0x20')][_0x51a00e]['id']);}}}_0x2fa9e8['temp']=0x1;return this[_0x9c3c('0x206')](_0x2fa9e8['id'],_0x94aa78,0x1,_0x2fa9e8[_0x9c3c('0x207')],_0x2fa9e8)[_0x9c3c('0x40')](function(_0x2fb941){_0x2fa9e8[_0x9c3c('0x67')]=0x1;if(_0x2fb941){if(!utils['checkContactEmpty'](_0x2fb941)){utils[_0x9c3c('0x66')](_0x2fa9e8,0x1,0x0);return hopperUtils[_0x9c3c('0x200')](_0x2fa9e8)[_0x9c3c('0x40')](sendMessageReschedule(_0x2fa9e8))[_0x9c3c('0xa1')](loggerCatch(_0x9c3c('0x201')));}else{_0x2fa9e8['message']=utils['CAMPAIGN_STATUS'][_0x9c3c('0x202')];if(_[_0x9c3c('0xf6')](_0x2fb941[0x0])||_[_0x9c3c('0xf6')](_0x2fb941[0x0][_0x9c3c('0x173')])||_['isNil'](_0x2fb941[0x0][_0x9c3c('0x156')])){_0x3cbb5d[_0x9c3c('0x14e')](_0x9c3c('0x204'),_0x2fa9e8,_0x2fb941[0x0]);}else{return hopperUtils[_0x9c3c('0x203')](_['pick'](_0x2fb941[0x0],['VoiceQueueId',_0x9c3c('0x156')]))[_0x9c3c('0x40')](_0x3cbb5d[_0x9c3c('0x1e2')](_0x2fa9e8,_0x2fb941[0x0]))[_0x9c3c('0xa1')](_0x3cbb5d[_0x9c3c('0x14d')]('[actionOriginatePredictive]\x20',_0x2fa9e8));}}}})[_0x9c3c('0xa1')](loggerGetContactDialer(_0x9c3c('0x208'),_0x2fa9e8,0x1));};Dialer['prototype'][_0x9c3c('0x1d2')]=function(_0x5bd7c7,_0x408e2d,_0x166d64,_0x5a0581,_0x1ada05,_0x5f2a80){loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x209'));loggerPredictive[_0x9c3c('0x4a')]('M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5bd7c7);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20a'),_0x408e2d);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20b'),_0x166d64);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20c'),_0x5a0581);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20d'),_0x1ada05);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x53'));return new Promise(function(_0x156ce2,_0x30127c){if(_0x5bd7c7<=0x0||isNaN(_0x5bd7c7)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),_0x9c3c('0x20f')+_0x5bd7c7));}if(_0x166d64<=0x0||isNaN(_0x166d64)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),_0x9c3c('0x210')+_0x166d64));}if(_0x5a0581<=0x0||isNaN(_0x5a0581)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),'p\x20=\x20'+_0x5a0581));}if(_0x408e2d<=0x0||isNaN(_0x408e2d)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),'interval\x20=\x20'+_0x408e2d));}if(_0x1ada05<=0x0||isNaN(_0x1ada05)){return _0x30127c(msgResponse(_0x9c3c('0x20e'),_0x9c3c('0x85'),'Amax\x20=\x20'+_0x1ada05));}_0x5f2a80=_0x5f2a80||0x0;var _0x5c2362=0x1/_0x166d64;var _0x57533f=0x0;var _0x233e80=0x0;var _0x4e1f4a=0x0;var _0x1e926b=0x0;for(var _0x3c940f=0x0;_0x4e1f4a<_0x1ada05;_0x3c940f+=0x1){_0x233e80=_0x3c940f/_0x408e2d;_0x57533f=(_0x5a0581*_0x233e80+_0x5f2a80)/_0x5c2362;_0x4e1f4a=utils['erlangb'](_0x57533f,_0x5bd7c7);_0x1e926b=_0x57533f/_0x5bd7c7*(0x1-utils[_0x9c3c('0x211')](_0x57533f,_0x5bd7c7));}return _0x156ce2({'erlangCalls':_0x3c940f,'erlangCallToSecond':_0x408e2d/_0x3c940f,'erlangAbandonmentRate':_0x4e1f4a,'erlangBusyFactor':_0x1e926b});});};Dialer['prototype'][_0x9c3c('0x1d3')]=function(_0x31b151,_0x42f075,_0x3426f5,_0x34a6b5,_0x12f526,_0x589c5b){loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x212'));loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x213'),_0x31b151);loggerPredictive[_0x9c3c('0x4a')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x42f075);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x20b'),_0x3426f5);loggerPredictive['info'](_0x9c3c('0x20c'),_0x34a6b5);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x214'),_0x12f526);loggerPredictive[_0x9c3c('0x4a')](_0x9c3c('0x53'));return new Promise(function(_0x52a22e,_0x497339){if(_0x31b151<=0x0||isNaN(_0x31b151)){return _0x497339(msgResponse(_0x9c3c('0x215'),_0x9c3c('0x85'),_0x9c3c('0x20f')+_0x31b151));}if(_0x3426f5<=0x0||isNaN(_0x3426f5)){return _0x497339(msgResponse(_0x9c3c('0x215'),_0x9c3c('0x85'),_0x9c3c('0x210')+_0x3426f5));}if(_0x34a6b5<=0x0||isNaN(_0x34a6b5)){return _0x497339(msgResponse(_0x9c3c('0x215'),_0x9c3c('0x85'),_0x9c3c('0x216')+_0x34a6b5));}if(_0x42f075<=0x0||isNaN(_0x42f075)){return _0x497339(msgResponse('[busyFactor]',_0x9c3c('0x85'),_0x9c3c('0x217')+_0x42f075));}if(_0x12f526<=0x0||isNaN(_0x12f526)){return _0x497339(msgResponse(_0x9c3c('0x215'),_0x9c3c('0x85'),_0x9c3c('0x218')+_0x12f526));}_0x589c5b=_0x589c5b||0x0;var _0x55ad01=0x1/_0x3426f5;var _0x4bda15=0x0;var _0x14309e=0x0;var _0x35257f=0x0;var _0x42bcbf=0x0;for(var _0x3bdbe9=0x0;_0x42bcbf<_0x12f526;_0x3bdbe9+=0x1){_0x14309e=_0x3bdbe9/_0x42f075;_0x4bda15=(_0x34a6b5*_0x14309e+_0x589c5b)/_0x55ad01;_0x35257f=utils[_0x9c3c('0x211')](_0x4bda15,_0x31b151);_0x42bcbf=_0x4bda15/_0x31b151*(0x1-utils[_0x9c3c('0x211')](_0x4bda15,_0x31b151));}return _0x52a22e({'erlangCalls':_0x3bdbe9,'erlangCallToSecond':_0x42f075/_0x3bdbe9,'erlangAbandonmentRate':_0x35257f,'erlangBusyFactor':_0x42bcbf});});};module[_0x9c3c('0x219')]=Dialer;
\ No newline at end of file
index e4ed8e5..b51f374 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49f4=['starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','substring','getQueue','exports','util','lodash','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName'];(function(_0x1972f4,_0x1231ff){var _0x42159b=function(_0x1f9d6f){while(--_0x1f9d6f){_0x1972f4['push'](_0x1972f4['shift']());}};_0x42159b(++_0x1231ff);}(_0x49f4,0x1c6));var _0x449f=function(_0x15a93a,_0x4822e4){_0x15a93a=_0x15a93a-0x0;var _0x592780=_0x49f4[_0x15a93a];return _0x592780;};'use strict';var util=require(_0x449f('0x0'));var _=require(_0x449f('0x1'));var moment=require('moment');function checkNameSurname(_0x1e09fc,_0xc5c1c8,_0x44ffa6){var _0x442ad1='';if(!_[_0x449f('0x2')](_0xc5c1c8)&&_0x449f('0x3')===typeof _0xc5c1c8){_0x442ad1+=_0xc5c1c8;}if(!_['isNil'](_0x44ffa6)&&_0x449f('0x3')===typeof _0x44ffa6){_0x442ad1+='\x20'+_0x44ffa6;}if(_0x442ad1!==''){return _0x442ad1;}return _0x1e09fc;}function Action(_0x5ef1ff,_0x1d16f7,_0x163f76){this[_0x449f('0x4')]=_0x5ef1ff;this[_0x449f('0x5')]=_0x163f76||undefined;this[_0x449f('0x6')]=checkNameSurname(_0x1d16f7[_0x449f('0x7')][_0x449f('0x8')],_0x1d16f7[_0x449f('0x7')]['firstName'],_0x1d16f7[_0x449f('0x7')][_0x449f('0x9')]);this[_0x449f('0xa')]=_0x1d16f7['phone'];this[_0x449f('0xb')]=_0x5ef1ff[_0x449f('0x6')];this['active']=_0x1d16f7[_0x449f('0xc')]||![];this[_0x449f('0xd')]=_0x5ef1ff[_0x449f('0xd')];this[_0x449f('0xe')]=_0x5ef1ff['dialQueueTimeout']||0x3;this[_0x449f('0xf')]=_0x1d16f7[_0x449f('0xf')];this[_0x449f('0x10')]=_0x1d16f7[_0x449f('0x10')];this[_0x449f('0x11')]=_0x1d16f7[_0x449f('0x11')];this[_0x449f('0x12')]=_0x1d16f7['countnoanswerretry'];this[_0x449f('0x13')]=_0x1d16f7[_0x449f('0x13')];this['countdropretry']=_0x1d16f7['countdropretry'];this[_0x449f('0x14')]=_0x1d16f7[_0x449f('0x14')];this['countmachineretry']=_0x1d16f7['countmachineretry'];this['countagentrejectretry']=_0x1d16f7[_0x449f('0x15')];this['ContactId']=_0x1d16f7[_0x449f('0x16')];this[_0x449f('0x17')]=_0x1d16f7['ListId'];this[_0x449f('0x18')]=_0x1d16f7['UserId'];this[_0x449f('0x19')]=_0x1d16f7[_0x449f('0x19')];this['CampaignId']=_0x1d16f7[_0x449f('0x1a')];this[_0x449f('0x1b')]=_0x1d16f7['id'];this[_0x449f('0x1c')]=_0x1d16f7[_0x449f('0x7')][_0x449f('0x1d')]||'';this[_0x449f('0x1e')]=moment()[_0x449f('0x1f')](_0x449f('0x20'));this['callback']=_0x1d16f7[_0x449f('0x21')];this[_0x449f('0x22')]=_0x1d16f7['callbackuniqueid'];this['callbackat']=_0x1d16f7[_0x449f('0x23')];this['recallme']=_0x1d16f7['recallme'];this[_0x449f('0x24')]='';this[_0x449f('0x25')]='';}Action[_0x449f('0x26')][_0x449f('0x27')]=function(){return util[_0x449f('0x1f')](_0x449f('0x28'),this[_0x449f('0x6')],this[_0x449f('0x4')]['dialCutDigit']>0x0?this[_0x449f('0xa')][_0x449f('0x29')](this['voiceQueue']['dialCutDigit']):this[_0x449f('0xa')]);};Action[_0x449f('0x26')][_0x449f('0x2a')]=function(){return this['queue'];};module[_0x449f('0x2b')]=Action;
\ No newline at end of file
+var _0x2f37=['util','isNil','string','uniqueid','name','Contact','firstName','number','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','voiceQueue','dialCutDigit','substring','prototype','getQueue'];(function(_0x58bd81,_0x47675d){var _0x251f0e=function(_0x46e0f8){while(--_0x46e0f8){_0x58bd81['push'](_0x58bd81['shift']());}};_0x251f0e(++_0x47675d);}(_0x2f37,0x87));var _0x72f3=function(_0x22aa42,_0x2dd15c){_0x22aa42=_0x22aa42-0x0;var _0x2a8efb=_0x2f37[_0x22aa42];return _0x2a8efb;};'use strict';var util=require(_0x72f3('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x34e3db,_0x442ef9,_0xec3a13){var _0x134f10='';if(!_[_0x72f3('0x1')](_0x442ef9)&&_0x72f3('0x2')===typeof _0x442ef9){_0x134f10+=_0x442ef9;}if(!_[_0x72f3('0x1')](_0xec3a13)&&'string'===typeof _0xec3a13){_0x134f10+='\x20'+_0xec3a13;}if(_0x134f10!==''){return _0x134f10;}return _0x34e3db;}function Action(_0x40c433,_0x4770e1,_0x3cc020){this['voiceQueue']=_0x40c433;this[_0x72f3('0x3')]=_0x3cc020||undefined;this[_0x72f3('0x4')]=checkNameSurname(_0x4770e1[_0x72f3('0x5')]['phone'],_0x4770e1['Contact'][_0x72f3('0x6')],_0x4770e1[_0x72f3('0x5')]['lastName']);this[_0x72f3('0x7')]=_0x4770e1[_0x72f3('0x8')];this[_0x72f3('0x9')]=_0x40c433[_0x72f3('0x4')];this[_0x72f3('0xa')]=_0x4770e1[_0x72f3('0xa')]||![];this[_0x72f3('0xb')]=_0x40c433[_0x72f3('0xb')];this[_0x72f3('0xc')]=_0x40c433[_0x72f3('0xc')]||0x3;this[_0x72f3('0xd')]=_0x4770e1['scheduledat'];this['countbusyretry']=_0x4770e1[_0x72f3('0xe')];this[_0x72f3('0xf')]=_0x4770e1[_0x72f3('0xf')];this[_0x72f3('0x10')]=_0x4770e1[_0x72f3('0x10')];this[_0x72f3('0x11')]=_0x4770e1[_0x72f3('0x11')];this[_0x72f3('0x12')]=_0x4770e1[_0x72f3('0x12')];this[_0x72f3('0x13')]=_0x4770e1[_0x72f3('0x13')];this[_0x72f3('0x14')]=_0x4770e1[_0x72f3('0x14')];this[_0x72f3('0x15')]=_0x4770e1[_0x72f3('0x15')];this[_0x72f3('0x16')]=_0x4770e1[_0x72f3('0x16')];this[_0x72f3('0x17')]=_0x4770e1['ListId'];this[_0x72f3('0x18')]=_0x4770e1[_0x72f3('0x18')];this[_0x72f3('0x19')]=_0x4770e1[_0x72f3('0x19')];this[_0x72f3('0x1a')]=_0x4770e1[_0x72f3('0x1a')];this[_0x72f3('0x1b')]=_0x4770e1['id'];this[_0x72f3('0x1c')]=_0x4770e1[_0x72f3('0x5')]['firstName']||'';this[_0x72f3('0x1d')]=moment()[_0x72f3('0x1e')](_0x72f3('0x1f'));this[_0x72f3('0x20')]=_0x4770e1[_0x72f3('0x20')];this[_0x72f3('0x21')]=_0x4770e1['callbackuniqueid'];this[_0x72f3('0x22')]=_0x4770e1['callbackat'];this[_0x72f3('0x23')]=_0x4770e1[_0x72f3('0x23')];this[_0x72f3('0x24')]='';this[_0x72f3('0x25')]='';}Action['prototype'][_0x72f3('0x26')]=function(){return util[_0x72f3('0x1e')](_0x72f3('0x27'),this[_0x72f3('0x4')],this[_0x72f3('0x28')][_0x72f3('0x29')]>0x0?this[_0x72f3('0x7')][_0x72f3('0x2a')](this[_0x72f3('0x28')][_0x72f3('0x29')]):this['number']);};Action[_0x72f3('0x2b')][_0x72f3('0x2c')]=function(){return this[_0x72f3('0x9')];};module['exports']=Action;
\ No newline at end of file
index 88b351d..cdde824 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xadca=['recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0xadca,0xb9));var _0xaadc=function(_0x39abaf,_0x264258){_0x39abaf=_0x39abaf-0x0;var _0x2f7166=_0xadca[_0x39abaf];return _0x2f7166;};'use strict';var moment=require(_0xaadc('0x0'));var utils=require('../utils');function AgentComplete(_0x110fe2,_0x5f2e56){this[_0xaadc('0x1')]=0x4;this[_0xaadc('0x2')]=_0xaadc('0x3');this[_0xaadc('0x4')]=_0x110fe2[_0xaadc('0x4')];this[_0xaadc('0x5')]=_0x110fe2[_0xaadc('0x5')];this[_0xaadc('0x6')]=_0x110fe2[_0xaadc('0x5')]==='outbound'?_0xaadc('0x7'):_0x110fe2[_0xaadc('0x5')];this[_0xaadc('0x8')]=_0x110fe2[_0xaadc('0x8')];this[_0xaadc('0x9')]=_0x110fe2[_0xaadc('0x9')];this[_0xaadc('0xa')]=_0x110fe2[_0xaadc('0xa')];this[_0xaadc('0xb')]=_0x110fe2[_0xaadc('0x8')]+_0x110fe2[_0xaadc('0x9')]+_0x110fe2['countnoanswerretry']+_0x110fe2[_0xaadc('0xc')]+_0x110fe2['countdropretry']+_0x110fe2['countabandonedretry']+_0x110fe2['countmachineretry']+_0x110fe2['countagentrejectretry'];this[_0xaadc('0xc')]=_0x110fe2[_0xaadc('0xc')];this[_0xaadc('0xd')]=_0x110fe2['countdropretry'];this[_0xaadc('0xe')]=_0x110fe2[_0xaadc('0xe')];this[_0xaadc('0xf')]=_0x110fe2[_0xaadc('0xf')];this[_0xaadc('0x10')]=_0x110fe2['countagentrejectretry'];this[_0xaadc('0x11')]=_0x5f2e56[_0xaadc('0x11')];this['calleridname']=_0x110fe2[_0xaadc('0x12')];this[_0xaadc('0x13')]=_0x110fe2[_0xaadc('0x14')];this[_0xaadc('0x15')]=_0x110fe2[_0xaadc('0x15')];this[_0xaadc('0x16')]=_0x110fe2[_0xaadc('0x16')];this['answertime']=_0x110fe2[_0xaadc('0x17')];this[_0xaadc('0x18')]=moment()[_0xaadc('0x19')](_0xaadc('0x1a'));this[_0xaadc('0x1b')]=utils[_0xaadc('0x1c')](_0x110fe2[_0xaadc('0x16')],_0x110fe2['starttime']);this['holdtime']=utils[_0xaadc('0x1c')](_0x110fe2['answertime'],_0x110fe2[_0xaadc('0x16')]);this[_0xaadc('0x1d')]=utils[_0xaadc('0x1c')](this[_0xaadc('0x18')],_0x110fe2[_0xaadc('0x17')]);this[_0xaadc('0x7')]=_0x5f2e56['queue'];this[_0xaadc('0x1e')]=_0x5f2e56[_0xaadc('0x1e')];this[_0xaadc('0x1f')]=_0x5f2e56[_0xaadc('0x1f')];this['callback']=_0x110fe2[_0xaadc('0x20')];this[_0xaadc('0x21')]=_0x110fe2[_0xaadc('0x21')];this['callbackat']=_0x110fe2[_0xaadc('0x22')];this[_0xaadc('0x23')]=_0x110fe2[_0xaadc('0x23')];this[_0xaadc('0x24')]=_0x110fe2['ContactId'];this['ListId']=_0x110fe2['ListId'];this[_0xaadc('0x25')]=_0x110fe2[_0xaadc('0x25')];this[_0xaadc('0x26')]=_0x110fe2[_0xaadc('0x26')];this[_0xaadc('0x27')]=_0x110fe2[_0xaadc('0x27')];this[_0xaadc('0x28')]=_0x110fe2[_0xaadc('0x28')]||'';this[_0xaadc('0x29')]=_0x110fe2[_0xaadc('0x29')]||'';this[_0xaadc('0x2a')]=_0x110fe2[_0xaadc('0x2a')];}module[_0xaadc('0x2b')]=AgentComplete;
\ No newline at end of file
+var _0x2558=['type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','calleridnum','starttime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','responsetime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','state','statedesc','Answer','scheduledat'];(function(_0x3bef79,_0x5b843b){var _0x1b2b20=function(_0x5ac9d9){while(--_0x5ac9d9){_0x3bef79['push'](_0x3bef79['shift']());}};_0x1b2b20(++_0x5b843b);}(_0x2558,0x1a1));var _0x8255=function(_0x2bda6f,_0x2ac96c){_0x2bda6f=_0x2bda6f-0x0;var _0x139a57=_0x2558[_0x2bda6f];return _0x139a57;};'use strict';var moment=require(_0x8255('0x0'));var utils=require(_0x8255('0x1'));function AgentComplete(_0x3d9dab,_0x553b96){this[_0x8255('0x2')]=0x4;this[_0x8255('0x3')]=_0x8255('0x4');this[_0x8255('0x5')]=_0x3d9dab[_0x8255('0x5')];this[_0x8255('0x6')]=_0x3d9dab['type'];this[_0x8255('0x7')]=_0x3d9dab[_0x8255('0x6')]===_0x8255('0x8')?_0x8255('0x9'):_0x3d9dab[_0x8255('0x6')];this[_0x8255('0xa')]=_0x3d9dab[_0x8255('0xa')];this[_0x8255('0xb')]=_0x3d9dab['countcongestionretry'];this[_0x8255('0xc')]=_0x3d9dab[_0x8255('0xc')];this[_0x8255('0xd')]=_0x3d9dab['countbusyretry']+_0x3d9dab['countcongestionretry']+_0x3d9dab[_0x8255('0xc')]+_0x3d9dab[_0x8255('0xe')]+_0x3d9dab['countdropretry']+_0x3d9dab[_0x8255('0xf')]+_0x3d9dab[_0x8255('0x10')]+_0x3d9dab[_0x8255('0x11')];this['countnosuchnumberretry']=_0x3d9dab['countnosuchnumberretry'];this[_0x8255('0x12')]=_0x3d9dab[_0x8255('0x12')];this[_0x8255('0xf')]=_0x3d9dab[_0x8255('0xf')];this[_0x8255('0x10')]=_0x3d9dab['countmachineretry'];this['countagentrejectretry']=_0x3d9dab[_0x8255('0x11')];this[_0x8255('0x13')]=_0x553b96['uniqueid'];this[_0x8255('0x14')]=_0x3d9dab[_0x8255('0x15')];this[_0x8255('0x16')]=_0x3d9dab['number'];this['starttime']=_0x3d9dab[_0x8255('0x17')];this['responsetime']=_0x3d9dab['responsetime'];this['answertime']=_0x3d9dab[_0x8255('0x18')];this[_0x8255('0x19')]=moment()[_0x8255('0x1a')](_0x8255('0x1b'));this[_0x8255('0x1c')]=utils['getSeconds'](_0x3d9dab[_0x8255('0x1d')],_0x3d9dab['starttime']);this[_0x8255('0x1e')]=utils[_0x8255('0x1f')](_0x3d9dab[_0x8255('0x18')],_0x3d9dab['responsetime']);this[_0x8255('0x20')]=utils[_0x8255('0x1f')](this[_0x8255('0x19')],_0x3d9dab[_0x8255('0x18')]);this[_0x8255('0x9')]=_0x553b96[_0x8255('0x9')];this[_0x8255('0x21')]=_0x553b96[_0x8255('0x21')];this[_0x8255('0x22')]=_0x553b96[_0x8255('0x22')];this[_0x8255('0x23')]=_0x3d9dab[_0x8255('0x23')];this[_0x8255('0x24')]=_0x3d9dab[_0x8255('0x24')];this[_0x8255('0x25')]=_0x3d9dab[_0x8255('0x25')];this['recallme']=_0x3d9dab['recallme'];this[_0x8255('0x26')]=_0x3d9dab['ContactId'];this[_0x8255('0x27')]=_0x3d9dab[_0x8255('0x27')];this[_0x8255('0x28')]=_0x3d9dab[_0x8255('0x28')];this[_0x8255('0x29')]=_0x3d9dab[_0x8255('0x29')];this[_0x8255('0x2a')]=_0x3d9dab[_0x8255('0x2a')];this[_0x8255('0x2b')]=_0x3d9dab[_0x8255('0x2b')]||'';this[_0x8255('0x2c')]=_0x3d9dab[_0x8255('0x2c')]||'';this['agiafterat']=_0x3d9dab[_0x8255('0x2d')];}module[_0x8255('0x2e')]=AgentComplete;
\ No newline at end of file
index 5206f68..3c2a2c9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc3be=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xc3be,0x1a6));var _0xec3b=function(_0xbb7e1a,_0x2b103f){_0xbb7e1a=_0xbb7e1a-0x0;var _0x5b9751=_0xc3be[_0xbb7e1a];return _0x5b9751;};'use strict';function Final(_0x593e06){this['uniqueid']=_0x593e06[_0xec3b('0x0')];this[_0xec3b('0x1')]=_0x593e06[_0xec3b('0x1')];this[_0xec3b('0x2')]=_0x593e06[_0xec3b('0x2')];this[_0xec3b('0x3')]=_0x593e06[_0xec3b('0x2')]===_0xec3b('0x4')?_0xec3b('0x5'):_0x593e06[_0xec3b('0x2')];this[_0xec3b('0x6')]=_0x593e06[_0xec3b('0x6')];this['countcongestionretry']=_0x593e06[_0xec3b('0x7')];this[_0xec3b('0x8')]=_0x593e06['countnoanswerretry'];this[_0xec3b('0x9')]=_0x593e06['countbusyretry']+_0x593e06[_0xec3b('0x7')]+_0x593e06[_0xec3b('0x8')]+_0x593e06[_0xec3b('0xa')]+_0x593e06[_0xec3b('0xb')]+_0x593e06[_0xec3b('0xc')]+_0x593e06[_0xec3b('0xd')]+_0x593e06[_0xec3b('0xe')];this[_0xec3b('0xa')]=_0x593e06[_0xec3b('0xa')];this['countdropretry']=_0x593e06[_0xec3b('0xb')];this['countabandonedretry']=_0x593e06[_0xec3b('0xc')];this[_0xec3b('0xd')]=_0x593e06[_0xec3b('0xd')];this['countagentrejectretry']=_0x593e06[_0xec3b('0xe')];this['queue']=_0x593e06['queue'];this[_0xec3b('0xf')]=_0x593e06[_0xec3b('0xf')];this[_0xec3b('0x10')]=_0x593e06[_0xec3b('0x10')];this[_0xec3b('0x11')]=_0x593e06[_0xec3b('0x11')];this['responsetime']=_0x593e06[_0xec3b('0x12')];this[_0xec3b('0x13')]=_0x593e06['responsetime'];this[_0xec3b('0x14')]=_0x593e06['ringtime']||0x0;this[_0xec3b('0x15')]=_0x593e06[_0xec3b('0x15')]||0x0;this[_0xec3b('0x16')]=_0x593e06[_0xec3b('0x16')]||0x0;this[_0xec3b('0x17')]=_0x593e06['callback'];this[_0xec3b('0x18')]=_0x593e06['callbackuniqueid'];this['callbackat']=_0x593e06[_0xec3b('0x19')];this[_0xec3b('0x1a')]=_0x593e06['recallme'];this[_0xec3b('0x1b')]=_0x593e06[_0xec3b('0x1b')];this[_0xec3b('0x1c')]=_0x593e06[_0xec3b('0x1c')];this[_0xec3b('0x1d')]=_0x593e06[_0xec3b('0x1d')];this['VoiceQueueId']=_0x593e06[_0xec3b('0x1e')];this[_0xec3b('0x1f')]=_0x593e06[_0xec3b('0x1f')];this['originatecalleridnum']=_0x593e06[_0xec3b('0x20')]||'';this[_0xec3b('0x21')]=_0x593e06[_0xec3b('0x21')]||'';this[_0xec3b('0x22')]=_0x593e06[_0xec3b('0x22')];this[_0xec3b('0x23')]=_0x593e06[_0xec3b('0x23')];}module['exports']=Final;
\ No newline at end of file
+var _0x2957=['VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','campaigntype','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ListId','UserId'];(function(_0x931081,_0x351467){var _0x5bf54d=function(_0x2bf2ca){while(--_0x2bf2ca){_0x931081['push'](_0x931081['shift']());}};_0x5bf54d(++_0x351467);}(_0x2957,0x1a7));var _0x7295=function(_0xd75802,_0x2145af){_0xd75802=_0xd75802-0x0;var _0x4bdfc5=_0x2957[_0xd75802];return _0x4bdfc5;};'use strict';function Final(_0x456522){this['uniqueid']=_0x456522[_0x7295('0x0')];this[_0x7295('0x1')]=_0x456522['scheduledat'];this['type']=_0x456522['type'];this[_0x7295('0x2')]=_0x456522['type']==='outbound'?_0x7295('0x3'):_0x456522[_0x7295('0x4')];this[_0x7295('0x5')]=_0x456522[_0x7295('0x5')];this[_0x7295('0x6')]=_0x456522[_0x7295('0x6')];this[_0x7295('0x7')]=_0x456522['countnoanswerretry'];this['countglobal']=_0x456522['countbusyretry']+_0x456522[_0x7295('0x6')]+_0x456522[_0x7295('0x7')]+_0x456522[_0x7295('0x8')]+_0x456522[_0x7295('0x9')]+_0x456522[_0x7295('0xa')]+_0x456522['countmachineretry']+_0x456522[_0x7295('0xb')];this[_0x7295('0x8')]=_0x456522[_0x7295('0x8')];this[_0x7295('0x9')]=_0x456522[_0x7295('0x9')];this['countabandonedretry']=_0x456522['countabandonedretry'];this[_0x7295('0xc')]=_0x456522[_0x7295('0xc')];this['countagentrejectretry']=_0x456522[_0x7295('0xb')];this[_0x7295('0x3')]=_0x456522[_0x7295('0x3')];this['calleridname']=_0x456522[_0x7295('0xd')];this['calleridnum']=_0x456522['calleridnum'];this[_0x7295('0xe')]=_0x456522['starttime'];this[_0x7295('0xf')]=_0x456522[_0x7295('0xf')];this['endtime']=_0x456522[_0x7295('0xf')];this[_0x7295('0x10')]=_0x456522[_0x7295('0x10')]||0x0;this[_0x7295('0x11')]=_0x456522[_0x7295('0x11')]||0x0;this[_0x7295('0x12')]=_0x456522['talktime']||0x0;this[_0x7295('0x13')]=_0x456522['callback'];this[_0x7295('0x14')]=_0x456522[_0x7295('0x14')];this[_0x7295('0x15')]=_0x456522[_0x7295('0x15')];this[_0x7295('0x16')]=_0x456522[_0x7295('0x16')];this['ContactId']=_0x456522['ContactId'];this[_0x7295('0x17')]=_0x456522[_0x7295('0x17')];this[_0x7295('0x18')]=_0x456522[_0x7295('0x18')];this[_0x7295('0x19')]=_0x456522[_0x7295('0x19')];this[_0x7295('0x1a')]=_0x456522['CampaignId'];this[_0x7295('0x1b')]=_0x456522['originatecalleridnum']||'';this[_0x7295('0x1c')]=_0x456522['originatecalleridname']||'';this[_0x7295('0x1d')]=_0x456522[_0x7295('0x1d')];this[_0x7295('0x1e')]=_0x456522[_0x7295('0x1e')];}module[_0x7295('0x1f')]=Final;
\ No newline at end of file
index 3a4227b..c251fc4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc06=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countcongestionretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','talktime','getSeconds','membername','IVR','cause-txt','callback','callbackuniqueid','recallme'];(function(_0x242066,_0x3e9c4e){var _0x26e31b=function(_0xa0d542){while(--_0xa0d542){_0x242066['push'](_0x242066['shift']());}};_0x26e31b(++_0x3e9c4e);}(_0xdc06,0x15e));var _0x6dc0=function(_0x3ce39a,_0x204b87){_0x3ce39a=_0x3ce39a-0x0;var _0x4a5896=_0xdc06[_0x3ce39a];return _0x4a5896;};'use strict';var moment=require(_0x6dc0('0x0'));var utils=require(_0x6dc0('0x1'));function Hangup(_0x10ac8e,_0x1be2c1){this[_0x6dc0('0x2')]=0x4;this[_0x6dc0('0x3')]=_0x6dc0('0x4');this['scheduledat']=_0x10ac8e[_0x6dc0('0x5')];this[_0x6dc0('0x6')]=_0x10ac8e[_0x6dc0('0x6')];this[_0x6dc0('0x7')]=_0x10ac8e['type']===_0x6dc0('0x8')?_0x6dc0('0x9'):_0x10ac8e['type'];this[_0x6dc0('0xa')]=_0x10ac8e[_0x6dc0('0xa')]||![];this[_0x6dc0('0xb')]=_0x10ac8e[_0x6dc0('0xb')];this[_0x6dc0('0xc')]=_0x10ac8e[_0x6dc0('0xc')];this['countnoanswerretry']=_0x10ac8e['countnoanswerretry'];this[_0x6dc0('0xd')]=_0x10ac8e['countbusyretry']+_0x10ac8e[_0x6dc0('0xc')]+_0x10ac8e['countnoanswerretry']+_0x10ac8e['countnosuchnumberretry']+_0x10ac8e['countdropretry']+_0x10ac8e[_0x6dc0('0xe')]+_0x10ac8e[_0x6dc0('0xf')]+_0x10ac8e[_0x6dc0('0x10')];this['countnosuchnumberretry']=_0x10ac8e['countnosuchnumberretry'];this['countdropretry']=_0x10ac8e[_0x6dc0('0x11')];this['countabandonedretry']=_0x10ac8e[_0x6dc0('0xe')];this[_0x6dc0('0xf')]=_0x10ac8e[_0x6dc0('0xf')];this['countagentrejectretry']=_0x10ac8e[_0x6dc0('0x10')];this[_0x6dc0('0x12')]=_0x1be2c1[_0x6dc0('0x12')];this[_0x6dc0('0x13')]=_0x10ac8e[_0x6dc0('0x14')];this['calleridnum']=_0x10ac8e[_0x6dc0('0x15')];this[_0x6dc0('0x16')]=_0x10ac8e['starttime'];this[_0x6dc0('0x17')]=_0x10ac8e[_0x6dc0('0x17')];this[_0x6dc0('0x18')]=moment()[_0x6dc0('0x19')](_0x6dc0('0x1a'));this[_0x6dc0('0x1b')]=utils['getSeconds'](_0x10ac8e[_0x6dc0('0x17')],_0x10ac8e[_0x6dc0('0x16')]);this[_0x6dc0('0x1c')]=0x0;this[_0x6dc0('0x1d')]=utils[_0x6dc0('0x1e')](this['endtime'],_0x10ac8e['responsetime']);this[_0x6dc0('0x9')]=_0x10ac8e['queue'];this[_0x6dc0('0x1f')]=_0x6dc0('0x20');this['reason']=_0x1be2c1[_0x6dc0('0x21')];this[_0x6dc0('0x22')]=_0x10ac8e[_0x6dc0('0x22')];this[_0x6dc0('0x23')]=_0x10ac8e['callbackuniqueid'];this['callbackat']=_0x10ac8e['callbackat'];this[_0x6dc0('0x24')]=_0x10ac8e[_0x6dc0('0x24')];this['ContactId']=_0x10ac8e[_0x6dc0('0x25')];this[_0x6dc0('0x26')]=_0x10ac8e[_0x6dc0('0x26')];this[_0x6dc0('0x27')]=_0x10ac8e[_0x6dc0('0x27')];this[_0x6dc0('0x28')]=_0x10ac8e[_0x6dc0('0x28')];this[_0x6dc0('0x29')]=_0x10ac8e['CampaignId'];}module[_0x6dc0('0x2a')]=Hangup;
\ No newline at end of file
+var _0x71b7=['moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','endtime','talktime','getSeconds','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports'];(function(_0x4ca3b4,_0x2450bc){var _0x51ea64=function(_0x1bdfd4){while(--_0x1bdfd4){_0x4ca3b4['push'](_0x4ca3b4['shift']());}};_0x51ea64(++_0x2450bc);}(_0x71b7,0x130));var _0x771b=function(_0x4cacfc,_0x56dfe0){_0x4cacfc=_0x4cacfc-0x0;var _0xffb88c=_0x71b7[_0x4cacfc];return _0xffb88c;};'use strict';var moment=require(_0x771b('0x0'));var utils=require('../utils');function Hangup(_0x4c2029,_0xad9958){this[_0x771b('0x1')]=0x4;this[_0x771b('0x2')]=_0x771b('0x3');this[_0x771b('0x4')]=_0x4c2029[_0x771b('0x4')];this[_0x771b('0x5')]=_0x4c2029[_0x771b('0x5')];this[_0x771b('0x6')]=_0x4c2029[_0x771b('0x5')]===_0x771b('0x7')?'queue':_0x4c2029[_0x771b('0x5')];this[_0x771b('0x8')]=_0x4c2029[_0x771b('0x8')]||![];this[_0x771b('0x9')]=_0x4c2029[_0x771b('0x9')];this[_0x771b('0xa')]=_0x4c2029['countcongestionretry'];this[_0x771b('0xb')]=_0x4c2029[_0x771b('0xb')];this['countglobal']=_0x4c2029['countbusyretry']+_0x4c2029['countcongestionretry']+_0x4c2029[_0x771b('0xb')]+_0x4c2029[_0x771b('0xc')]+_0x4c2029[_0x771b('0xd')]+_0x4c2029[_0x771b('0xe')]+_0x4c2029['countmachineretry']+_0x4c2029['countagentrejectretry'];this[_0x771b('0xc')]=_0x4c2029['countnosuchnumberretry'];this['countdropretry']=_0x4c2029[_0x771b('0xd')];this[_0x771b('0xe')]=_0x4c2029[_0x771b('0xe')];this['countmachineretry']=_0x4c2029['countmachineretry'];this[_0x771b('0xf')]=_0x4c2029[_0x771b('0xf')];this['uniqueid']=_0xad9958[_0x771b('0x10')];this['calleridname']=_0x4c2029[_0x771b('0x11')];this[_0x771b('0x12')]=_0x4c2029[_0x771b('0x13')];this[_0x771b('0x14')]=_0x4c2029[_0x771b('0x14')];this[_0x771b('0x15')]=_0x4c2029['responsetime'];this[_0x771b('0x16')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=utils['getSeconds'](_0x4c2029[_0x771b('0x15')],_0x4c2029[_0x771b('0x14')]);this['holdtime']=0x0;this[_0x771b('0x17')]=utils[_0x771b('0x18')](this[_0x771b('0x16')],_0x4c2029[_0x771b('0x15')]);this['queue']=_0x4c2029[_0x771b('0x19')];this[_0x771b('0x1a')]=_0x771b('0x1b');this[_0x771b('0x1c')]=_0xad9958['cause-txt'];this[_0x771b('0x1d')]=_0x4c2029[_0x771b('0x1d')];this[_0x771b('0x1e')]=_0x4c2029[_0x771b('0x1e')];this[_0x771b('0x1f')]=_0x4c2029[_0x771b('0x1f')];this[_0x771b('0x20')]=_0x4c2029['recallme'];this[_0x771b('0x21')]=_0x4c2029[_0x771b('0x21')];this[_0x771b('0x22')]=_0x4c2029['ListId'];this['UserId']=_0x4c2029['UserId'];this[_0x771b('0x23')]=_0x4c2029[_0x771b('0x23')];this[_0x771b('0x24')]=_0x4c2029[_0x771b('0x24')];}module[_0x771b('0x25')]=Hangup;
\ No newline at end of file
index d3112d4..5e86355 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb1de=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x524502,_0xf29cf8){var _0x1fb2d6=function(_0x1f6683){while(--_0x1f6683){_0x524502['push'](_0x524502['shift']());}};_0x1fb2d6(++_0xf29cf8);}(_0xb1de,0xc8));var _0xeb1d=function(_0xbefd33,_0x568de6){_0xbefd33=_0xbefd33-0x0;var _0x36e9ee=_0xb1de[_0xbefd33];return _0x36e9ee;};'use strict';var utils=require('../utils');function History(_0x2e9130){this['uniqueid']=_0x2e9130[_0xeb1d('0x0')];this[_0xeb1d('0x1')]=_0x2e9130[_0xeb1d('0x1')]||undefined;this[_0xeb1d('0x2')]=_0x2e9130[_0xeb1d('0x2')];this[_0xeb1d('0x3')]=_0x2e9130[_0xeb1d('0x2')]===_0xeb1d('0x4')?_0xeb1d('0x5'):_0x2e9130[_0xeb1d('0x2')];this[_0xeb1d('0x6')]=_0x2e9130[_0xeb1d('0x6')];this[_0xeb1d('0x7')]=_0x2e9130[_0xeb1d('0x7')];this[_0xeb1d('0x8')]=_0x2e9130[_0xeb1d('0x8')];this[_0xeb1d('0x9')]=_0x2e9130['countbusyretry']+_0x2e9130[_0xeb1d('0x7')]+_0x2e9130[_0xeb1d('0x8')]+_0x2e9130[_0xeb1d('0xa')]+_0x2e9130[_0xeb1d('0xb')]+_0x2e9130[_0xeb1d('0xc')]+_0x2e9130[_0xeb1d('0xd')]+_0x2e9130[_0xeb1d('0xe')];this[_0xeb1d('0xa')]=_0x2e9130['countnosuchnumberretry'];this[_0xeb1d('0xb')]=_0x2e9130[_0xeb1d('0xb')];this[_0xeb1d('0xc')]=_0x2e9130['countabandonedretry'];this[_0xeb1d('0xd')]=_0x2e9130[_0xeb1d('0xd')];this[_0xeb1d('0xe')]=_0x2e9130[_0xeb1d('0xe')];this[_0xeb1d('0x5')]=_0x2e9130['queue'];this[_0xeb1d('0xf')]=_0x2e9130[_0xeb1d('0x10')];this[_0xeb1d('0x11')]=_0x2e9130[_0xeb1d('0x12')];this[_0xeb1d('0x13')]=_0x2e9130[_0xeb1d('0x13')];this[_0xeb1d('0x14')]=_0x2e9130[_0xeb1d('0x14')];this[_0xeb1d('0x15')]=_0x2e9130[_0xeb1d('0x14')];this[_0xeb1d('0x16')]=utils[_0xeb1d('0x17')](_0x2e9130['responsetime'],_0x2e9130[_0xeb1d('0x13')]);this[_0xeb1d('0x18')]=0x0;this[_0xeb1d('0x19')]=0x0;this[_0xeb1d('0x1a')]=_0x2e9130['callback'];this[_0xeb1d('0x1b')]=_0x2e9130[_0xeb1d('0x1b')];this[_0xeb1d('0x1c')]=_0x2e9130[_0xeb1d('0x1c')];this[_0xeb1d('0x1d')]=_0x2e9130[_0xeb1d('0x1d')];this[_0xeb1d('0x1e')]=_0x2e9130['ContactId'];this[_0xeb1d('0x1f')]=_0x2e9130[_0xeb1d('0x1f')];this[_0xeb1d('0x20')]=_0x2e9130['UserId'];this['VoiceQueueId']=_0x2e9130[_0xeb1d('0x21')];this[_0xeb1d('0x22')]=_0x2e9130['CampaignId'];this[_0xeb1d('0x23')]=_0x2e9130[_0xeb1d('0x23')]||'';this[_0xeb1d('0x24')]=_0x2e9130['originatecalleridname']||'';this[_0xeb1d('0x25')]=_0x2e9130[_0xeb1d('0x25')];this['statedesc']=_0x2e9130[_0xeb1d('0x26')];}module['exports']=History;
\ No newline at end of file
+var _0x46fa=['CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','name','calleridnum','starttime','responsetime','ringtime','getSeconds','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0xe77e80,_0x40bb60){var _0x56cf8b=function(_0x40b442){while(--_0x40b442){_0xe77e80['push'](_0xe77e80['shift']());}};_0x56cf8b(++_0x40bb60);}(_0x46fa,0x75));var _0xa46f=function(_0x1cd332,_0x4759bd){_0x1cd332=_0x1cd332-0x0;var _0x262483=_0x46fa[_0x1cd332];return _0x262483;};'use strict';var utils=require(_0xa46f('0x0'));function History(_0x3c1978){this[_0xa46f('0x1')]=_0x3c1978['uniqueid'];this[_0xa46f('0x2')]=_0x3c1978[_0xa46f('0x2')]||undefined;this[_0xa46f('0x3')]=_0x3c1978[_0xa46f('0x3')];this[_0xa46f('0x4')]=_0x3c1978['type']===_0xa46f('0x5')?'queue':_0x3c1978[_0xa46f('0x3')];this[_0xa46f('0x6')]=_0x3c1978[_0xa46f('0x6')];this[_0xa46f('0x7')]=_0x3c1978[_0xa46f('0x7')];this['countnoanswerretry']=_0x3c1978[_0xa46f('0x8')];this[_0xa46f('0x9')]=_0x3c1978['countbusyretry']+_0x3c1978[_0xa46f('0x7')]+_0x3c1978[_0xa46f('0x8')]+_0x3c1978[_0xa46f('0xa')]+_0x3c1978['countdropretry']+_0x3c1978[_0xa46f('0xb')]+_0x3c1978[_0xa46f('0xc')]+_0x3c1978[_0xa46f('0xd')];this[_0xa46f('0xa')]=_0x3c1978[_0xa46f('0xa')];this[_0xa46f('0xe')]=_0x3c1978[_0xa46f('0xe')];this['countabandonedretry']=_0x3c1978[_0xa46f('0xb')];this[_0xa46f('0xc')]=_0x3c1978[_0xa46f('0xc')];this['countagentrejectretry']=_0x3c1978[_0xa46f('0xd')];this[_0xa46f('0xf')]=_0x3c1978[_0xa46f('0xf')];this[_0xa46f('0x10')]=_0x3c1978[_0xa46f('0x11')];this[_0xa46f('0x12')]=_0x3c1978['number'];this[_0xa46f('0x13')]=_0x3c1978['starttime'];this[_0xa46f('0x14')]=_0x3c1978['responsetime'];this['endtime']=_0x3c1978[_0xa46f('0x14')];this[_0xa46f('0x15')]=utils[_0xa46f('0x16')](_0x3c1978[_0xa46f('0x14')],_0x3c1978['starttime']);this['holdtime']=0x0;this['talktime']=0x0;this['callback']=_0x3c1978[_0xa46f('0x17')];this['callbackuniqueid']=_0x3c1978[_0xa46f('0x18')];this[_0xa46f('0x19')]=_0x3c1978['callbackat'];this[_0xa46f('0x1a')]=_0x3c1978[_0xa46f('0x1a')];this[_0xa46f('0x1b')]=_0x3c1978[_0xa46f('0x1b')];this[_0xa46f('0x1c')]=_0x3c1978['ListId'];this[_0xa46f('0x1d')]=_0x3c1978[_0xa46f('0x1d')];this['VoiceQueueId']=_0x3c1978[_0xa46f('0x1e')];this[_0xa46f('0x1f')]=_0x3c1978['CampaignId'];this[_0xa46f('0x20')]=_0x3c1978[_0xa46f('0x20')]||'';this[_0xa46f('0x21')]=_0x3c1978[_0xa46f('0x21')]||'';this[_0xa46f('0x22')]=_0x3c1978[_0xa46f('0x22')];this[_0xa46f('0x23')]=_0x3c1978[_0xa46f('0x23')];}module[_0xa46f('0x24')]=History;
\ No newline at end of file
index 5e95545..aae6e4b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6e3c=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','agiafterat','statedesc','exports','../utils','scheduledat','type','campaigntype','queue','countbusyretry','countnoanswerretry','countcongestionretry','countdropretry','countabandonedretry','countmachineretry','countnosuchnumberretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat'];(function(_0x436bc5,_0x47b676){var _0x3795fc=function(_0x12daa5){while(--_0x12daa5){_0x436bc5['push'](_0x436bc5['shift']());}};_0x3795fc(++_0x47b676);}(_0x6e3c,0xb2));var _0xc6e3=function(_0x9a0c2,_0x48a029){_0x9a0c2=_0x9a0c2-0x0;var _0x5d0fad=_0x6e3c[_0x9a0c2];return _0x5d0fad;};'use strict';var utils=require(_0xc6e3('0x0'));function QueueCallerAbandon(_0x227b1b,_0x3f0a20){this[_0xc6e3('0x1')]=_0x227b1b['scheduledat'];this[_0xc6e3('0x2')]=_0x227b1b['type'];this[_0xc6e3('0x3')]=_0x227b1b[_0xc6e3('0x2')]==='outbound'?_0xc6e3('0x4'):_0x227b1b[_0xc6e3('0x2')];this[_0xc6e3('0x5')]=_0x227b1b[_0xc6e3('0x5')];this['countcongestionretry']=_0x227b1b['countcongestionretry'];this[_0xc6e3('0x6')]=_0x227b1b[_0xc6e3('0x6')];this['countglobal']=_0x227b1b[_0xc6e3('0x5')]+_0x227b1b[_0xc6e3('0x7')]+_0x227b1b['countnoanswerretry']+_0x227b1b['countnosuchnumberretry']+_0x227b1b[_0xc6e3('0x8')]+_0x227b1b[_0xc6e3('0x9')]+_0x227b1b[_0xc6e3('0xa')]+_0x227b1b['countagentrejectretry'];this[_0xc6e3('0xb')]=_0x227b1b['countnosuchnumberretry'];this[_0xc6e3('0x8')]=_0x227b1b[_0xc6e3('0x8')];this[_0xc6e3('0x9')]=_0x227b1b[_0xc6e3('0x9')];this['countmachineretry']=_0x227b1b[_0xc6e3('0xa')];this[_0xc6e3('0xc')]=_0x227b1b['countagentrejectretry'];this['uniqueid']=_0x3f0a20[_0xc6e3('0xd')];this[_0xc6e3('0xe')]=_0x227b1b[_0xc6e3('0xf')];this[_0xc6e3('0x10')]=_0x227b1b[_0xc6e3('0x11')];this[_0xc6e3('0x12')]=_0x227b1b[_0xc6e3('0x12')];this[_0xc6e3('0x13')]=_0x227b1b[_0xc6e3('0x13')];this[_0xc6e3('0x14')]=_0x227b1b[_0xc6e3('0x14')];this[_0xc6e3('0x15')]=_0x227b1b[_0xc6e3('0x15')];this['endtime']=this[_0xc6e3('0x14')];this[_0xc6e3('0x16')]=utils[_0xc6e3('0x17')](_0x227b1b['responsetime'],_0x227b1b[_0xc6e3('0x12')]);this[_0xc6e3('0x18')]=utils['getSeconds'](this[_0xc6e3('0x14')],_0x227b1b[_0xc6e3('0x13')]);this[_0xc6e3('0x19')]=0x0;this['queue']=_0x3f0a20[_0xc6e3('0x4')];this[_0xc6e3('0x1a')]=_0x3f0a20[_0xc6e3('0x1b')];this[_0xc6e3('0x1c')]=_0x3f0a20[_0xc6e3('0x1c')];this[_0xc6e3('0x1d')]=_0x227b1b['callback'];this[_0xc6e3('0x1e')]=_0x227b1b[_0xc6e3('0x1e')];this[_0xc6e3('0x1f')]=_0x227b1b[_0xc6e3('0x1f')];this[_0xc6e3('0x20')]=_0x227b1b[_0xc6e3('0x20')];this[_0xc6e3('0x21')]=_0x227b1b[_0xc6e3('0x21')];this['ListId']=_0x227b1b[_0xc6e3('0x22')];this['UserId']=_0x227b1b[_0xc6e3('0x23')];this[_0xc6e3('0x24')]=_0x227b1b['VoiceQueueId'];this[_0xc6e3('0x25')]=_0x227b1b[_0xc6e3('0x25')];this['originatecalleridnum']=_0x227b1b[_0xc6e3('0x26')]||'';this['originatecalleridname']=_0x227b1b['originatecalleridname']||'';this[_0xc6e3('0x27')]=_0x227b1b[_0xc6e3('0x27')];this['state']=_0x227b1b['state'];this[_0xc6e3('0x28')]=_0x227b1b[_0xc6e3('0x28')];}module[_0xc6e3('0x29')]=QueueCallerAbandon;
\ No newline at end of file
+var _0xa677=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','name','calleridnum','starttime','responsetime','droptime','dropreason','endtime','ringtime','holdtime','getSeconds','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','type','outbound','queue','countbusyretry','countcongestionretry','countglobal'];(function(_0x42cf05,_0x3698a7){var _0x4ec407=function(_0x3e4e75){while(--_0x3e4e75){_0x42cf05['push'](_0x42cf05['shift']());}};_0x4ec407(++_0x3698a7);}(_0xa677,0x1f1));var _0x7a67=function(_0x564821,_0x4d037e){_0x564821=_0x564821-0x0;var _0x2b604d=_0xa677[_0x564821];return _0x2b604d;};'use strict';var utils=require(_0x7a67('0x0'));function QueueCallerAbandon(_0x12a21a,_0xce093){this['scheduledat']=_0x12a21a['scheduledat'];this[_0x7a67('0x1')]=_0x12a21a[_0x7a67('0x1')];this['campaigntype']=_0x12a21a[_0x7a67('0x1')]===_0x7a67('0x2')?_0x7a67('0x3'):_0x12a21a[_0x7a67('0x1')];this[_0x7a67('0x4')]=_0x12a21a['countbusyretry'];this[_0x7a67('0x5')]=_0x12a21a[_0x7a67('0x5')];this['countnoanswerretry']=_0x12a21a['countnoanswerretry'];this[_0x7a67('0x6')]=_0x12a21a[_0x7a67('0x4')]+_0x12a21a['countcongestionretry']+_0x12a21a['countnoanswerretry']+_0x12a21a[_0x7a67('0x7')]+_0x12a21a['countdropretry']+_0x12a21a[_0x7a67('0x8')]+_0x12a21a[_0x7a67('0x9')]+_0x12a21a[_0x7a67('0xa')];this['countnosuchnumberretry']=_0x12a21a[_0x7a67('0x7')];this[_0x7a67('0xb')]=_0x12a21a[_0x7a67('0xb')];this['countabandonedretry']=_0x12a21a[_0x7a67('0x8')];this[_0x7a67('0x9')]=_0x12a21a[_0x7a67('0x9')];this['countagentrejectretry']=_0x12a21a[_0x7a67('0xa')];this[_0x7a67('0xc')]=_0xce093[_0x7a67('0xc')];this['calleridname']=_0x12a21a[_0x7a67('0xd')];this[_0x7a67('0xe')]=_0x12a21a['number'];this['starttime']=_0x12a21a[_0x7a67('0xf')];this[_0x7a67('0x10')]=_0x12a21a[_0x7a67('0x10')];this['droptime']=_0x12a21a[_0x7a67('0x11')];this[_0x7a67('0x12')]=_0x12a21a['dropreason'];this[_0x7a67('0x13')]=this[_0x7a67('0x11')];this[_0x7a67('0x14')]=utils['getSeconds'](_0x12a21a['responsetime'],_0x12a21a[_0x7a67('0xf')]);this[_0x7a67('0x15')]=utils[_0x7a67('0x16')](this[_0x7a67('0x11')],_0x12a21a[_0x7a67('0x10')]);this[_0x7a67('0x17')]=0x0;this[_0x7a67('0x3')]=_0xce093['queue'];this[_0x7a67('0x18')]=_0xce093[_0x7a67('0x19')];this[_0x7a67('0x1a')]=_0xce093[_0x7a67('0x1a')];this[_0x7a67('0x1b')]=_0x12a21a['callback'];this['callbackuniqueid']=_0x12a21a[_0x7a67('0x1c')];this[_0x7a67('0x1d')]=_0x12a21a['callbackat'];this[_0x7a67('0x1e')]=_0x12a21a[_0x7a67('0x1e')];this[_0x7a67('0x1f')]=_0x12a21a[_0x7a67('0x1f')];this[_0x7a67('0x20')]=_0x12a21a[_0x7a67('0x20')];this[_0x7a67('0x21')]=_0x12a21a[_0x7a67('0x21')];this[_0x7a67('0x22')]=_0x12a21a[_0x7a67('0x22')];this[_0x7a67('0x23')]=_0x12a21a[_0x7a67('0x23')];this['originatecalleridnum']=_0x12a21a[_0x7a67('0x24')]||'';this[_0x7a67('0x25')]=_0x12a21a[_0x7a67('0x25')]||'';this['agiafterat']=_0x12a21a[_0x7a67('0x26')];this[_0x7a67('0x27')]=_0x12a21a[_0x7a67('0x27')];this[_0x7a67('0x28')]=_0x12a21a['statedesc'];}module[_0x7a67('0x29')]=QueueCallerAbandon;
\ No newline at end of file
index 9d77614..76da0e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x814b=['rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','[checkIsBlackList]','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','getContactDialer','catch','error','[getContactDialer]','getContactDialerIvr','dialOrderByScheduledAt','temp','countReScheduled','[countReScheduled]'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x814b,0x1a2));var _0xb814=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x814b[_0x369151];return _0x4292d5;};'use strict';var util=require(_0xb814('0x0'));var logger=require(_0xb814('0x1'))(_0xb814('0x2'));var cmHopper=require(_0xb814('0x3'));var cmHopperAdditionalPhone=require(_0xb814('0x4'));var cmHopperBlack=require(_0xb814('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x38c21a){return util[_0xb814('0x6')](_0x38c21a,{'showHidden':![],'depth':null});}function getContactDialer(_0x258866,_0x4237bc,_0x44931c){return cmHopper[_0xb814('0x7')](_0x258866['id'],_0x4237bc,_0x44931c,_0x258866['dialOrderByScheduledAt'])[_0xb814('0x8')](function(_0x2e6272){_0x258866['temp']=0x0;logger[_0xb814('0x9')](_0xb814('0xa'),inspectError(_0x2e6272));});}exports[_0xb814('0x7')]=getContactDialer;function getContactDialerIvr(_0x41166c,_0x1fea33){return cmHopper[_0xb814('0xb')](_0x41166c['id'],_0x1fea33,_0x41166c[_0xb814('0xc')])[_0xb814('0x8')](function(_0x207dbc){_0x41166c[_0xb814('0xd')]=0x0;logger[_0xb814('0x9')]('[getContactDialerIvr]',inspectError(_0x207dbc));});}exports[_0xb814('0xb')]=getContactDialerIvr;function countReScheduled(_0x56278f){return cmHopper[_0xb814('0xe')](_0x56278f)[_0xb814('0x8')](function(_0x35b10d){logger[_0xb814('0x9')](_0xb814('0xf'),inspectError(_0x35b10d));});}exports[_0xb814('0xe')]=countReScheduled;function rescheduleContact(_0x1438e7){return cmHopper[_0xb814('0x10')](_0x1438e7)[_0xb814('0x8')](function(_0x2ab627){logger[_0xb814('0x9')](_0xb814('0x11'),inspectError(_0x2ab627));});}exports[_0xb814('0x10')]=rescheduleContact;function unlockContact(_0x39bfcf,_0x303aca,_0x3a71d6){return cmHopper[_0xb814('0x12')](_0x39bfcf,_0x303aca,_0x3a71d6)[_0xb814('0x8')](function(_0x125ce2){logger[_0xb814('0x9')](_0xb814('0x13'),inspectError(_0x125ce2));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x168a48){return cmHopper['moveContactManagedDialer'](_0x168a48)[_0xb814('0x8')](function(_0xfac75b){logger['error']('[moveContactManagedDialer]',inspectError(_0xfac75b));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x399b43){return cmHopperBlack['checkIsBlackList'](_0x399b43)['catch'](function(_0xb684ea){logger[_0xb814('0x9')](_0xb814('0x14'),inspectError(_0xb684ea));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0xf5b8aa){return cmHopperBlack['checkIsBlackListIvr'](_0xf5b8aa)[_0xb814('0x8')](function(_0x1808a3){logger[_0xb814('0x9')](_0xb814('0x15'),inspectError(_0x1808a3));});}exports[_0xb814('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2bd039,_0x1f5d40,_0x594470){return cmHopperAdditionalPhone[_0xb814('0x17')](_0x2bd039,_0x1f5d40,_0x594470)['catch'](function(_0x3f81d0){logger[_0xb814('0x9')](_0xb814('0x18'),inspectError(_0x3f81d0));});}exports[_0xb814('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1c8a2e,_0xb9e57d,_0x3d836c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1c8a2e,_0xb9e57d,_0x3d836c)[_0xb814('0x8')](function(_0xc0ef66){logger[_0xb814('0x9')](_0xb814('0x19'),inspectError(_0xc0ef66));});}exports[_0xb814('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x1d5965){return cmHopperHistory[_0xb814('0x1b')](_0x1d5965)[_0xb814('0x8')](function(_0x5a6291){logger[_0xb814('0x9')](_0xb814('0x1c'),inspectError(_0x5a6291));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x9008b2){return cmHopperHistory[_0xb814('0x1d')](_0x9008b2)[_0xb814('0x8')](function(_0x499f22){logger[_0xb814('0x9')](_0xb814('0x1e'),inspectError(_0x499f22));});}exports['createHistory']=createHistory;
\ No newline at end of file
+var _0x2ef3=['checkIsBlackListIvr','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','inspect','catch','temp','error','[getContactDialer]','getContactDialer','getContactDialerIvr','dialOrderByScheduledAt','[getContactDialerIvr]','countReScheduled','[countReScheduled]','[rescheduleContact]','rescheduleContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','[checkIsBlackListIvr]'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x2ef3,0xba));var _0x32ef=function(_0x21e332,_0x239a2b){_0x21e332=_0x21e332-0x0;var _0x37f3de=_0x2ef3[_0x21e332];return _0x37f3de;};'use strict';var util=require(_0x32ef('0x0'));var logger=require(_0x32ef('0x1'))(_0x32ef('0x2'));var cmHopper=require(_0x32ef('0x3'));var cmHopperAdditionalPhone=require(_0x32ef('0x4'));var cmHopperBlack=require(_0x32ef('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x38f865){return util[_0x32ef('0x6')](_0x38f865,{'showHidden':![],'depth':null});}function getContactDialer(_0x524ab6,_0x402857,_0x37dd1d){return cmHopper['getContactDialer'](_0x524ab6['id'],_0x402857,_0x37dd1d,_0x524ab6['dialOrderByScheduledAt'])[_0x32ef('0x7')](function(_0x4bfcf8){_0x524ab6[_0x32ef('0x8')]=0x0;logger[_0x32ef('0x9')](_0x32ef('0xa'),inspectError(_0x4bfcf8));});}exports[_0x32ef('0xb')]=getContactDialer;function getContactDialerIvr(_0x2484a0,_0x2bbb50){return cmHopper[_0x32ef('0xc')](_0x2484a0['id'],_0x2bbb50,_0x2484a0[_0x32ef('0xd')])['catch'](function(_0x5780e9){_0x2484a0[_0x32ef('0x8')]=0x0;logger[_0x32ef('0x9')](_0x32ef('0xe'),inspectError(_0x5780e9));});}exports[_0x32ef('0xc')]=getContactDialerIvr;function countReScheduled(_0x5af651){return cmHopper[_0x32ef('0xf')](_0x5af651)['catch'](function(_0x1a5106){logger['error'](_0x32ef('0x10'),inspectError(_0x1a5106));});}exports[_0x32ef('0xf')]=countReScheduled;function rescheduleContact(_0x5c3eb9){return cmHopper['rescheduleContact'](_0x5c3eb9)[_0x32ef('0x7')](function(_0x4d8009){logger[_0x32ef('0x9')](_0x32ef('0x11'),inspectError(_0x4d8009));});}exports[_0x32ef('0x12')]=rescheduleContact;function unlockContact(_0x54c7f5,_0x57aff1,_0x55bf0b){return cmHopper['unlockContact'](_0x54c7f5,_0x57aff1,_0x55bf0b)[_0x32ef('0x7')](function(_0x3950e6){logger[_0x32ef('0x9')]('[unlockContact]',inspectError(_0x3950e6));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x1eb468){return cmHopper[_0x32ef('0x13')](_0x1eb468)[_0x32ef('0x7')](function(_0x57863c){logger[_0x32ef('0x9')](_0x32ef('0x14'),inspectError(_0x57863c));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x304505){return cmHopperBlack[_0x32ef('0x15')](_0x304505)[_0x32ef('0x7')](function(_0x251084){logger[_0x32ef('0x9')](_0x32ef('0x16'),inspectError(_0x251084));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x3c5b78){return cmHopperBlack['checkIsBlackListIvr'](_0x3c5b78)[_0x32ef('0x7')](function(_0x3a20ca){logger['error'](_0x32ef('0x17'),inspectError(_0x3a20ca));});}exports[_0x32ef('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5e8898,_0x55f7f2,_0x57f5e5){return cmHopperAdditionalPhone[_0x32ef('0x19')](_0x5e8898,_0x55f7f2,_0x57f5e5)[_0x32ef('0x7')](function(_0x225feb){logger['error']('[verifyAdditionalPhone]',inspectError(_0x225feb));});}exports[_0x32ef('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x4d584b,_0x51a412,_0x278495){return cmHopperAdditionalPhone[_0x32ef('0x1a')](_0x4d584b,_0x51a412,_0x278495)[_0x32ef('0x7')](function(_0x1dbe98){logger[_0x32ef('0x9')](_0x32ef('0x1b'),inspectError(_0x1dbe98));});}exports[_0x32ef('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x38aed5){return cmHopperHistory[_0x32ef('0x1c')](_0x38aed5)[_0x32ef('0x7')](function(_0x1335e2){logger[_0x32ef('0x9')]('[avgHandleTime]',inspectError(_0x1335e2));});}exports[_0x32ef('0x1c')]=avgHandleTime;function createHistory(_0x2f5d06){return cmHopperHistory['createHistory'](_0x2f5d06)[_0x32ef('0x7')](function(_0x3c569d){logger[_0x32ef('0x9')](_0x32ef('0x1d'),inspectError(_0x3c569d));});}exports['createHistory']=createHistory;
\ No newline at end of file
index 06e038e..6486243 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xff4f=['DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','\x22\x22\x20<>','getCallerId','pow','replace','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','description','tags','updatedAt','format','%s%s','XMD-','setXMDContactVariables','moment','util','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','ivr','type','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','dialMethod','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff4f,0x174));var _0xfff4=function(_0x5d39ae,_0x35b18f){_0x5d39ae=_0x5d39ae-0x0;var _0x480398=_0xff4f[_0x5d39ae];return _0x480398;};'use strict';var _=require('lodash');var moment=require(_0xfff4('0x0'));var util=require(_0xfff4('0x1'));var logger=require('../../../../config/logger')(_0xfff4('0x2'));var timezones=require(_0xfff4('0x3'))[_0xfff4('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0xfff4('0x5'),'BLACKLIST':_0xfff4('0x6'),'CONTACTS_RESCHEDULED':_0xfff4('0x7'),'DEACTIVATED':_0xfff4('0x8'),'DISACTIVED':_0xfff4('0x9'),'EMPTY_INTERVAL':_0xfff4('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0xfff4('0xb'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0xfff4('0xc'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xfff4('0xd'),'QUEUE_RECALL':_0xfff4('0xe'),'RECALL_TIMEOUT':_0xfff4('0xf'),'RUNNING':_0xfff4('0x10'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0xfff4('0x11')};exports[_0xfff4('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x50f1ac){return _0x50f1ac['dialMethod']==='preview';}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x3d55b9){return _0x3d55b9['type']===_0xfff4('0x13');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0xc7b24c){return _0xc7b24c[_0xfff4('0x14')]===_0xfff4('0x15');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x1fadf6){return _0x1fadf6[_0xfff4('0x16')];}exports[_0xfff4('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x3119d8){return _0x3119d8[_0xfff4('0x18')];}exports[_0xfff4('0x19')]=isIVRCampaignActive;function getSeconds(_0x8351f7,_0x4e9b70){var _0x89ad8=moment(_0x8351f7)[_0xfff4('0x1a')](0x0);var _0x5b68a4=moment(_0x4e9b70)[_0xfff4('0x1a')](0x0);return _0x89ad8['diff'](_0x5b68a4,_0xfff4('0x1b'));}exports[_0xfff4('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x86d92,_0x31e448){var _0x5ec442=![];var _0x41a666=_0x86d92[_0xfff4('0x1d')]!==_0x31e448[_0xfff4('0x1d')]||_0x86d92[_0xfff4('0x16')]!==_0x31e448[_0xfff4('0x16')]||_0x86d92['message']!==_0x31e448[_0xfff4('0x1e')];var _0x8d8bfb=_0x86d92['available']!==_0x31e448[_0xfff4('0x1f')]||_0x86d92[_0xfff4('0x20')]!==_0x31e448[_0xfff4('0x20')]||_0x86d92['loggedInDb']!==_0x31e448[_0xfff4('0x21')]||_0x86d92[_0xfff4('0x22')]!==_0x31e448[_0xfff4('0x22')]||_0x86d92[_0xfff4('0x23')]!==_0x31e448['talking']||_0x86d92[_0xfff4('0x24')]!==_0x31e448['pTalking']||_0x86d92[_0xfff4('0x25')]!==_0x31e448[_0xfff4('0x25')]||_0x86d92['inUse']!==_0x31e448[_0xfff4('0x26')]||_0x86d92[_0xfff4('0x27')]!==_0x31e448[_0xfff4('0x27')];if(_0x86d92[_0xfff4('0x28')]&&_0x31e448[_0xfff4('0x28')]){_0x5ec442=_0x86d92[_0xfff4('0x28')][_0xfff4('0x29')]!==_0x31e448[_0xfff4('0x28')][_0xfff4('0x29')]||_0x86d92[_0xfff4('0x28')][_0xfff4('0x18')]!==_0x31e448[_0xfff4('0x28')][_0xfff4('0x18')];}return _0x41a666||_0x8d8bfb||_0x5ec442;}exports[_0xfff4('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x245827){var _0x4f463c=null;var _0x897381=_0x245827[_0xfff4('0x2b')];if(_[_0xfff4('0x2c')](_0x245827[_0xfff4('0x2d')])||_[_0xfff4('0x2c')](_0x245827[_0xfff4('0x2e')])||_['isNil'](_0x245827['Interval'][_0xfff4('0x2f')])){_0x4f463c=CAMPAIGN_STATUS[_0xfff4('0x30')];}else if(_[_0xfff4('0x31')](_0x245827['dialGlobalInterval'])||_['isEmpty'](_0x245827[_0xfff4('0x2e')][_0xfff4('0x2f')])){_0x4f463c=CAMPAIGN_STATUS[_0xfff4('0x32')];}else if(_0x897381&&!timezones[_0x897381]){_0x4f463c=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x4f463c;}function checkAnyValidTrunk(_0x119386,_0x1eb90b){var _0x5fa561=null;var _0x3afbb5=_0xfff4('0x33');var _0x503b82=[_0xfff4('0x34'),_0xfff4('0x35')];var _0x820e2a=!![];if(_0x119386['Trunk']&&_0x119386[_0xfff4('0x28')][_0xfff4('0x18')]){_0x3afbb5+=_0x119386['Trunk'][_0xfff4('0x29')];_0x5fa561=_0x1eb90b[_0x3afbb5];_0x820e2a=_0x503b82[_0xfff4('0x36')](_0x5fa561[_0xfff4('0x37')]);}else if(_0x119386[_0xfff4('0x38')]&&_0x119386['TrunkBackup'][_0xfff4('0x18')]){_0x3afbb5+=_0x119386[_0xfff4('0x38')][_0xfff4('0x29')];_0x5fa561=_0x1eb90b[_0x3afbb5];_0x820e2a=_0x503b82['includes'](_0x5fa561['status']);}return _0x820e2a;}function getQueueCampaignStatusMessage(_0x40b1ce,_0x455fb8){var _0x23c37c=CAMPAIGN_STATUS['ACTIVE'];var _0x348984=isPreviewCampaign(_0x40b1ce);if(!isQueueCampaignActive(_0x40b1ce)){if(_0x348984){_0x23c37c=CAMPAIGN_STATUS[_0xfff4('0x39')];}else{if(_0x40b1ce[_0xfff4('0x27')]===0x0&&_0x40b1ce['talking']===0x0&&_0x40b1ce['waiting']===0x0&&(_0x40b1ce[_0xfff4('0x24')]||0x0)===0x0){_0x23c37c=CAMPAIGN_STATUS['INACTIVE'];}else{_0x23c37c=CAMPAIGN_STATUS[_0xfff4('0x3a')];}}}else if(_0x40b1ce[_0xfff4('0x20')]===0x0){_0x23c37c=CAMPAIGN_STATUS[_0xfff4('0x3b')];}else if(!checkAnyValidTrunk(_0x40b1ce,_0x455fb8)){_0x23c37c=CAMPAIGN_STATUS[_0xfff4('0x3c')];}else if(!isPreviewCampaign(_0x40b1ce)){var _0x2089d9=checkAnyValidQueueCampaignInterval(_0x40b1ce);if(_0x2089d9){_0x23c37c=_0x2089d9;}}return _0x23c37c;}exports[_0xfff4('0x3d')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x7838ce){var _0x11dfe5=CAMPAIGN_STATUS[_0xfff4('0x3a')];if(_0x7838ce['originated']===0x0&&_0x7838ce[_0xfff4('0x23')]===0x0&&_0x7838ce['waiting']===0x0&&(_0x7838ce[_0xfff4('0x24')]||0x0)===0x0){_0x11dfe5=CAMPAIGN_STATUS[_0xfff4('0x39')];}return _0x11dfe5;}exports[_0xfff4('0x3e')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2e3b24){var _0xc42093=_0x2e3b24[_0xfff4('0x3f')](/"(.*?)"/);return _0xc42093?_0xc42093[0x1]:_0x2e3b24;}exports[_0xfff4('0x40')]=extractCalleridName;function getCallerId(_0x4e9df7,_0x30d69b,_0x2b316c){if(!_[_0xfff4('0x41')](_0x2b316c)&&typeof _0x2b316c==='string'&&!_[_0xfff4('0x31')](_0x2b316c)){if(!_[_0xfff4('0x41')](_0x30d69b)&&typeof _0x30d69b==='string'&&!_[_0xfff4('0x31')](_0x30d69b)){return util['format']('\x22%s\x22\x20<%s>',_0x30d69b,_0x2b316c);}return util['format']('\x22%s\x22\x20<%s>',_0x2b316c,_0x2b316c);}if(!_['isUndefined'](_0x4e9df7)&&typeof _0x4e9df7===_0xfff4('0x42')&&!_[_0xfff4('0x31')](_0x4e9df7)){return _0x4e9df7;}return _0xfff4('0x43');}exports[_0xfff4('0x44')]=getCallerId;function getCallerIdRandom(_0x1a520c,_0x495694){var _0x5cbfe6;var _0x13051e;var _0x45fb9a;if(_0x495694<=0x0){_0x495694=0x1;}_0x5cbfe6=new RegExp('\x5cw{0,'+_0x495694+'}$');_0x13051e=Math[_0xfff4('0x45')](0xa,_0x495694-0x1);_0x45fb9a=Math['pow'](0xa,_0x495694)-0x1;return util['format']('%s',_[_0xfff4('0x46')](_0x1a520c,_0x5cbfe6,_['random'](_0x13051e,_0x45fb9a)['toString']()));}exports[_0xfff4('0x47')]=getCallerIdRandom;function decrementOriginate(_0x3afe8c){if(_0x3afe8c[_0xfff4('0x27')]&&_0x3afe8c[_0xfff4('0x27')]>0x0){_0x3afe8c['originated']-=0x1;}else{logger['error'](_0xfff4('0x48'));}}exports[_0xfff4('0x49')]=decrementOriginate;function checkContactEmpty(_0xac4410){return _0xac4410&&_0xac4410[_0xfff4('0x4a')]>0x0;}exports[_0xfff4('0x4b')]=checkContactEmpty;function erlangb(_0x410a78,_0x3a8a37){if(_0x3a8a37===0x0){return 0x0;}var _0x5c10aa=0x1;for(var _0x5e95bb=0x1;_0x5e95bb<=_0x3a8a37;_0x5e95bb+=0x1){_0x5c10aa=0x1+_0x5c10aa*_0x5e95bb/_0x410a78;}return 0x1/_0x5c10aa;}exports[_0xfff4('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x302505,_0x40f100,_0x4e0610){if(_0x40f100>_0x4e0610){for(var _0x5cecd9=0x0;_0x5cecd9<_0x40f100-_0x4e0610;_0x5cecd9+=0x1){decrementOriginate(_0x302505);}}}exports[_0xfff4('0x4d')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x55c971){var _0x57459b={};var _0x225be3=['id',_0xfff4('0x4e'),_0xfff4('0x4f'),_0xfff4('0x50'),_0xfff4('0x51')];if(_0x55c971){for(var _0x6db5a5 in _0x55c971){if(typeof _0x55c971[_0x6db5a5]!=='undefined'){if(!_['isNil'](_0x55c971[_0x6db5a5])&&!_0x225be3[_0xfff4('0x36')](_0x6db5a5)){_0x57459b[util[_0xfff4('0x52')](_0xfff4('0x53'),_0xfff4('0x54'),_0x6db5a5['toUpperCase']())]=_0x55c971[_0x6db5a5];}}}}return _0x57459b;}exports[_0xfff4('0x55')]=setXMDContactVariables;
\ No newline at end of file
+var _0xb677=['description','tags','updatedAt','undefined','%s%s','XMD-','lodash','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','dialMethod','preview','isPreviewCampaign','ivr','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','dialGlobalInterval','isEmpty','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','status','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','length','checkContactEmpty','erlangb'];(function(_0x1c0e91,_0xd8625e){var _0x34322c=function(_0x5d9d51){while(--_0x5d9d51){_0x1c0e91['push'](_0x1c0e91['shift']());}};_0x34322c(++_0xd8625e);}(_0xb677,0x15e));var _0x7b67=function(_0xbc1e36,_0x43695a){_0xbc1e36=_0xbc1e36-0x0;var _0x22bb81=_0xb677[_0xbc1e36];return _0x22bb81;};'use strict';var _=require(_0x7b67('0x0'));var moment=require('moment');var util=require(_0x7b67('0x1'));var logger=require(_0x7b67('0x2'))('dialer');var timezones=require(_0x7b67('0x3'))[_0x7b67('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x7b67('0x5'),'BLACKLIST':_0x7b67('0x6'),'CONTACTS_RESCHEDULED':_0x7b67('0x7'),'DEACTIVATED':_0x7b67('0x8'),'DISACTIVED':_0x7b67('0x9'),'EMPTY_INTERVAL':_0x7b67('0xa'),'INACTIVE':'NOT_ACTIVE','NO_AGENTS_LOGGED':_0x7b67('0xb'),'NO_AVAILABLE_CONTACTS':_0x7b67('0xc'),'NULL_INTERVAL':_0x7b67('0xd'),'OVERTIME_INTERVAL':_0x7b67('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0x7b67('0xf'),'QUEUE_RECALL':_0x7b67('0x10'),'RECALL_TIMEOUT':_0x7b67('0x11'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x519e1f){return _0x519e1f[_0x7b67('0x12')]===_0x7b67('0x13');}exports[_0x7b67('0x14')]=isPreviewCampaign;function isIVRCampaign(_0x2dd500){return _0x2dd500['type']===_0x7b67('0x15');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x4bab18){return _0x4bab18[_0x7b67('0x16')]===_0x7b67('0x17');}exports[_0x7b67('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x595e60){return _0x595e60[_0x7b67('0x19')];}exports[_0x7b67('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x1020b3){return _0x1020b3[_0x7b67('0x1b')];}exports[_0x7b67('0x1c')]=isIVRCampaignActive;function getSeconds(_0x10a1cc,_0x4bf981){var _0x3b53dc=moment(_0x10a1cc)[_0x7b67('0x1d')](0x0);var _0x9319e0=moment(_0x4bf981)['milliseconds'](0x0);return _0x3b53dc[_0x7b67('0x1e')](_0x9319e0,_0x7b67('0x1f'));}exports[_0x7b67('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x5b8902,_0x890093){var _0x48114c=![];var _0x1f4fb5=_0x5b8902['dialMethod']!==_0x890093[_0x7b67('0x12')]||_0x5b8902['dialActive']!==_0x890093[_0x7b67('0x19')]||_0x5b8902['message']!==_0x890093[_0x7b67('0x21')];var _0x3c243e=_0x5b8902['available']!==_0x890093[_0x7b67('0x22')]||_0x5b8902['loggedIn']!==_0x890093[_0x7b67('0x23')]||_0x5b8902['loggedInDb']!==_0x890093[_0x7b67('0x24')]||_0x5b8902[_0x7b67('0x25')]!==_0x890093[_0x7b67('0x25')]||_0x5b8902[_0x7b67('0x26')]!==_0x890093[_0x7b67('0x26')]||_0x5b8902[_0x7b67('0x27')]!==_0x890093[_0x7b67('0x27')]||_0x5b8902[_0x7b67('0x28')]!==_0x890093['waiting']||_0x5b8902[_0x7b67('0x29')]!==_0x890093[_0x7b67('0x29')]||_0x5b8902['originated']!==_0x890093[_0x7b67('0x2a')];if(_0x5b8902[_0x7b67('0x2b')]&&_0x890093[_0x7b67('0x2b')]){_0x48114c=_0x5b8902[_0x7b67('0x2b')][_0x7b67('0x2c')]!==_0x890093[_0x7b67('0x2b')][_0x7b67('0x2c')]||_0x5b8902[_0x7b67('0x2b')]['active']!==_0x890093[_0x7b67('0x2b')][_0x7b67('0x1b')];}return _0x1f4fb5||_0x3c243e||_0x48114c;}exports[_0x7b67('0x2d')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x25d9e1){var _0xced056=null;var _0x40e3ee=_0x25d9e1[_0x7b67('0x2e')];if(_[_0x7b67('0x2f')](_0x25d9e1['dialGlobalInterval'])||_['isNil'](_0x25d9e1[_0x7b67('0x30')])||_['isNil'](_0x25d9e1[_0x7b67('0x30')][_0x7b67('0x31')])){_0xced056=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_['isEmpty'](_0x25d9e1[_0x7b67('0x32')])||_[_0x7b67('0x33')](_0x25d9e1[_0x7b67('0x30')]['Intervals'])){_0xced056=CAMPAIGN_STATUS[_0x7b67('0x34')];}else if(_0x40e3ee&&!timezones[_0x40e3ee]){_0xced056=CAMPAIGN_STATUS[_0x7b67('0x35')];}return _0xced056;}function checkAnyValidTrunk(_0x93e60b,_0x2b5101){var _0x1bcc1f=null;var _0x237a89=_0x7b67('0x36');var _0x27d1bd=['reachable',_0x7b67('0x37')];var _0x3324df=!![];if(_0x93e60b[_0x7b67('0x2b')]&&_0x93e60b[_0x7b67('0x2b')][_0x7b67('0x1b')]){_0x237a89+=_0x93e60b[_0x7b67('0x2b')][_0x7b67('0x2c')];_0x1bcc1f=_0x2b5101[_0x237a89];_0x3324df=_0x27d1bd[_0x7b67('0x38')](_0x1bcc1f['status']);}else if(_0x93e60b[_0x7b67('0x39')]&&_0x93e60b['TrunkBackup'][_0x7b67('0x1b')]){_0x237a89+=_0x93e60b[_0x7b67('0x39')][_0x7b67('0x2c')];_0x1bcc1f=_0x2b5101[_0x237a89];_0x3324df=_0x27d1bd[_0x7b67('0x38')](_0x1bcc1f[_0x7b67('0x3a')]);}return _0x3324df;}function getQueueCampaignStatusMessage(_0x454eaa,_0x215bd9){var _0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x5')];var _0x4db1d7=isPreviewCampaign(_0x454eaa);if(!isQueueCampaignActive(_0x454eaa)){if(_0x4db1d7){_0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x3b')];}else{if(_0x454eaa[_0x7b67('0x2a')]===0x0&&_0x454eaa[_0x7b67('0x26')]===0x0&&_0x454eaa[_0x7b67('0x28')]===0x0&&(_0x454eaa['pTalking']||0x0)===0x0){_0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x3b')];}else{_0x2847e4=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x454eaa['loggedIn']===0x0){_0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x3c')];}else if(!checkAnyValidTrunk(_0x454eaa,_0x215bd9)){_0x2847e4=CAMPAIGN_STATUS[_0x7b67('0x3d')];}else if(!isPreviewCampaign(_0x454eaa)){var _0x36a05c=checkAnyValidQueueCampaignInterval(_0x454eaa);if(_0x36a05c){_0x2847e4=_0x36a05c;}}return _0x2847e4;}exports[_0x7b67('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x15b8e5){var _0x1636e0=CAMPAIGN_STATUS[_0x7b67('0x3f')];if(_0x15b8e5[_0x7b67('0x2a')]===0x0&&_0x15b8e5['talking']===0x0&&_0x15b8e5[_0x7b67('0x28')]===0x0&&(_0x15b8e5[_0x7b67('0x27')]||0x0)===0x0){_0x1636e0=CAMPAIGN_STATUS[_0x7b67('0x3b')];}return _0x1636e0;}exports[_0x7b67('0x40')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x10e313){var _0x496d13=_0x10e313['match'](/"(.*?)"/);return _0x496d13?_0x496d13[0x1]:_0x10e313;}exports[_0x7b67('0x41')]=extractCalleridName;function getCallerId(_0x262b05,_0x90535a,_0x453b2f){if(!_[_0x7b67('0x42')](_0x453b2f)&&typeof _0x453b2f===_0x7b67('0x43')&&!_[_0x7b67('0x33')](_0x453b2f)){if(!_['isUndefined'](_0x90535a)&&typeof _0x90535a===_0x7b67('0x43')&&!_[_0x7b67('0x33')](_0x90535a)){return util[_0x7b67('0x44')](_0x7b67('0x45'),_0x90535a,_0x453b2f);}return util[_0x7b67('0x44')]('\x22%s\x22\x20<%s>',_0x453b2f,_0x453b2f);}if(!_[_0x7b67('0x42')](_0x262b05)&&typeof _0x262b05==='string'&&!_[_0x7b67('0x33')](_0x262b05)){return _0x262b05;}return'\x22\x22\x20<>';}exports[_0x7b67('0x46')]=getCallerId;function getCallerIdRandom(_0x371545,_0x24c5a7){var _0x1b44e3;var _0x454800;var _0x4dd57e;if(_0x24c5a7<=0x0){_0x24c5a7=0x1;}_0x1b44e3=new RegExp(_0x7b67('0x47')+_0x24c5a7+'}$');_0x454800=Math[_0x7b67('0x48')](0xa,_0x24c5a7-0x1);_0x4dd57e=Math[_0x7b67('0x48')](0xa,_0x24c5a7)-0x1;return util[_0x7b67('0x44')]('%s',_['replace'](_0x371545,_0x1b44e3,_[_0x7b67('0x49')](_0x454800,_0x4dd57e)[_0x7b67('0x4a')]()));}exports[_0x7b67('0x4b')]=getCallerIdRandom;function decrementOriginate(_0x23ae48){if(_0x23ae48[_0x7b67('0x2a')]&&_0x23ae48[_0x7b67('0x2a')]>0x0){_0x23ae48[_0x7b67('0x2a')]-=0x1;}else{logger[_0x7b67('0x4c')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports['decrementOriginate']=decrementOriginate;function checkContactEmpty(_0x29593b){return _0x29593b&&_0x29593b[_0x7b67('0x4d')]>0x0;}exports[_0x7b67('0x4e')]=checkContactEmpty;function erlangb(_0x5ccb29,_0x1aaeea){if(_0x1aaeea===0x0){return 0x0;}var _0x1ac318=0x1;for(var _0x3501fa=0x1;_0x3501fa<=_0x1aaeea;_0x3501fa+=0x1){_0x1ac318=0x1+_0x1ac318*_0x3501fa/_0x5ccb29;}return 0x1/_0x1ac318;}exports[_0x7b67('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x18e47d,_0x193da9,_0x1cc02b){if(_0x193da9>_0x1cc02b){for(var _0x5eabcd=0x0;_0x5eabcd<_0x193da9-_0x1cc02b;_0x5eabcd+=0x1){decrementOriginate(_0x18e47d);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3d84db){var _0x3c1005={};var _0x497247=['id','createdAt',_0x7b67('0x50'),_0x7b67('0x51'),_0x7b67('0x52')];if(_0x3d84db){for(var _0xa292af in _0x3d84db){if(typeof _0x3d84db[_0xa292af]!==_0x7b67('0x53')){if(!_[_0x7b67('0x2f')](_0x3d84db[_0xa292af])&&!_0x497247['includes'](_0xa292af)){_0x3c1005[util[_0x7b67('0x44')](_0x7b67('0x54'),_0x7b67('0x55'),_0xa292af['toUpperCase']())]=_0x3d84db[_0xa292af];}}}}return _0x3c1005;}exports['setXMDContactVariables']=setXMDContactVariables;
\ No newline at end of file
index 4a3b58f..38302a6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x2e08c9,_0x25f40c){var _0x388000=function(_0x424d16){while(--_0x424d16){_0x2e08c9['push'](_0x2e08c9['shift']());}};_0x388000(++_0x25f40c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action;
\ No newline at end of file
+var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x4ed451,_0x164323){var _0x204936=function(_0x28533b){while(--_0x28533b){_0x4ed451['push'](_0x4ed451['shift']());}};_0x204936(++_0x164323);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action;
\ No newline at end of file
index 44886a4..0080fde 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbfbd=['newchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','channelstate','channelstatedesc','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','SUCCESS','updateStatus','faxstatusstring','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','SIP/%s','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions'];(function(_0xb90353,_0x299cfe){var _0x59678f=function(_0x12386c){while(--_0x12386c){_0xb90353['push'](_0xb90353['shift']());}};_0x59678f(++_0x299cfe);}(_0xbfbd,0xcd));var _0xdbfb=function(_0x19b783,_0x1efb2a){_0x19b783=_0x19b783-0x0;var _0x2f6027=_0xbfbd[_0x19b783];return _0x2f6027;};'use strict';var util=require(_0xdbfb('0x0'));var _=require(_0xdbfb('0x1'));var BPromise=require(_0xdbfb('0x2'));var uuid=require(_0xdbfb('0x3'));var moment=require('moment');var path=require(_0xdbfb('0x4'));var tiff2pdf=require(_0xdbfb('0x5'));var gs=require(_0xdbfb('0x6'));var logger=require(_0xdbfb('0x7'))(_0xdbfb('0x8'));var ami=require(_0xdbfb('0x9'));var rpcDb=require(_0xdbfb('0xa'));var Channel=require('./channel');var ut=require('./util/util');var Action=require(_0xdbfb('0xb'));var faxAccount=require(_0xdbfb('0xc'));var attachment=require(_0xdbfb('0xd'));var faxMessage=require(_0xdbfb('0xe'));function Fax(_0x397ac6){this[_0xdbfb('0xf')]={};this['faxAccounts']=_0x397ac6[_0xdbfb('0x10')];this['trunks']=_0x397ac6[_0xdbfb('0x11')];this[_0xdbfb('0x12')]={};ami['on'](_0xdbfb('0x13'),this['syncNewchannel'][_0xdbfb('0x14')](this));ami['on'](_0xdbfb('0x15'),this[_0xdbfb('0x16')][_0xdbfb('0x14')](this));ami['on'](_0xdbfb('0x17'),this[_0xdbfb('0x18')]['bind'](this));ami['on']('newexten',this[_0xdbfb('0x19')][_0xdbfb('0x14')](this));ami['on'](_0xdbfb('0x1a'),this[_0xdbfb('0x1b')][_0xdbfb('0x14')](this));ami['on'](_0xdbfb('0x1c'),this[_0xdbfb('0x1d')]['bind'](this));ami['on'](_0xdbfb('0x1e'),this[_0xdbfb('0x1f')][_0xdbfb('0x14')](this));ami['on'](_0xdbfb('0x20'),this[_0xdbfb('0x21')]['bind'](this));}Fax[_0xdbfb('0x22')][_0xdbfb('0x23')]=function(_0x149d68){if(_0x149d68[_0xdbfb('0x24')]===_0xdbfb('0x25')){for(var _0x292ebe in this[_0xdbfb('0x10')]){if(this[_0xdbfb('0x10')][_0xdbfb('0x26')](_0x292ebe)){if(_0x149d68[_0xdbfb('0x27')]===this[_0xdbfb('0x10')][_0x292ebe][_0xdbfb('0x28')]){this[_0xdbfb('0xf')][_0x149d68['uniqueid']]={};this[_0xdbfb('0xf')][_0x149d68[_0xdbfb('0x29')]][_0xdbfb('0x2a')]=_0x149d68[_0xdbfb('0x2a')];this[_0xdbfb('0xf')][_0x149d68['uniqueid']]['id']=this['faxAccounts'][_0x292ebe]['id'];this[_0xdbfb('0xf')][_0x149d68[_0xdbfb('0x29')]][_0xdbfb('0x2b')]=this['faxAccounts'][_0x292ebe]['name'];logger[_0xdbfb('0x2c')](_0x149d68['uniqueid'],_0xdbfb('0x2d'));}}}}if(this[_0xdbfb('0x12')][_0x149d68[_0xdbfb('0x29')]]){this[_0xdbfb('0xf')][_0x149d68[_0xdbfb('0x29')]]={};this[_0xdbfb('0xf')][_0x149d68['uniqueid']][_0xdbfb('0x2a')]=_0x149d68[_0xdbfb('0x2a')];logger['info'](_0x149d68[_0xdbfb('0x29')],_0xdbfb('0x2d'));}};Fax['prototype'][_0xdbfb('0x16')]=function(_0x1024dc){if(this['channels'][_0x1024dc[_0xdbfb('0x29')]]){for(var _0x40772b in _0x1024dc[_0xdbfb('0x2e')]){if(_0x1024dc[_0xdbfb('0x2e')][_0xdbfb('0x26')](_0x40772b)){this[_0xdbfb('0xf')][_0x1024dc['uniqueid']][_0x40772b]=_0x1024dc['value'];}}}};Fax[_0xdbfb('0x22')]['syncNewState']=function(_0x1d549c){if(this[_0xdbfb('0xf')][_0x1d549c['uniqueid']]){this[_0xdbfb('0xf')][_0x1d549c[_0xdbfb('0x29')]]['channelstate']=_0x1d549c[_0xdbfb('0x2f')];this['channels'][_0x1d549c['uniqueid']][_0xdbfb('0x30')]=_0x1d549c['channelstatedesc'];}};Fax[_0xdbfb('0x22')]['syncNewExten']=function(_0x28ebe4){if(this['channels'][_0x28ebe4[_0xdbfb('0x29')]]){for(var _0x209374 in _0x28ebe4[_0xdbfb('0x2e')]){if(_0x28ebe4['variable'][_0xdbfb('0x26')](_0x209374)){this[_0xdbfb('0xf')][_0x28ebe4[_0xdbfb('0x29')]][_0x209374]=_0x28ebe4[_0xdbfb('0x31')];}}}};Fax[_0xdbfb('0x22')]['syncFaxStatus']=function(_0x5ec861){if(this[_0xdbfb('0xf')][_0x5ec861[_0xdbfb('0x29')]]){this[_0xdbfb('0xf')][_0x5ec861['uniqueid']][_0xdbfb('0x32')]=_0x5ec861[_0xdbfb('0x32')];this[_0xdbfb('0xf')][_0x5ec861[_0xdbfb('0x29')]][_0xdbfb('0x33')]=_0x5ec861['status'];this[_0xdbfb('0xf')][_0x5ec861[_0xdbfb('0x29')]]['localstationid']=_0x5ec861[_0xdbfb('0x28')];this[_0xdbfb('0xf')][_0x5ec861[_0xdbfb('0x29')]][_0xdbfb('0x34')]=_0x5ec861['filename'];logger[_0xdbfb('0x2c')](_0x5ec861[_0xdbfb('0x29')],_0xdbfb('0x35'));}};Fax['prototype'][_0xdbfb('0x1d')]=function(_0xa34f89){var _0x5a6aee=this;if(this[_0xdbfb('0xf')][_0xa34f89[_0xdbfb('0x29')]]){var _0x20e169=this[_0xdbfb('0xf')][_0xa34f89[_0xdbfb('0x29')]]['id'];this[_0xdbfb('0xf')][_0xa34f89[_0xdbfb('0x29')]][_0xdbfb('0x36')]=_0xa34f89[_0xdbfb('0x36')];this[_0xdbfb('0xf')][_0xa34f89[_0xdbfb('0x29')]]['pagestransferred']=_0xa34f89[_0xdbfb('0x37')];this['channels'][_0xa34f89[_0xdbfb('0x29')]][_0xdbfb('0x28')]=_0xa34f89['localstationid'];this[_0xdbfb('0xf')][_0xa34f89[_0xdbfb('0x29')]][_0xdbfb('0x38')]=_0xa34f89[_0xdbfb('0x38')];this[_0xdbfb('0xf')][_0xa34f89[_0xdbfb('0x29')]][_0xdbfb('0x39')]=_0xa34f89[_0xdbfb('0x39')];this['channels'][_0xa34f89['uniqueid']][_0xdbfb('0x34')]=_0xa34f89[_0xdbfb('0x34')];this[_0xdbfb('0xf')][_0xa34f89[_0xdbfb('0x29')]][_0xdbfb('0x3a')]=_0xa34f89[_0xdbfb('0x3a')];if(this[_0xdbfb('0xf')][_0xa34f89['uniqueid']][_0xdbfb('0x37')]>0x0){tiff2pdf(_0xa34f89[_0xdbfb('0x34')],'/var/opt/motion2/server/files/attachments/',function(_0x5284fa){logger[_0xdbfb('0x2c')](_0xa34f89[_0xdbfb('0x29')],_0xdbfb('0x3b'),_0x5284fa[_0xdbfb('0x3c')]);attachment['create']({'name':path[_0xdbfb('0x3d')](_0xa34f89[_0xdbfb('0x34')])[_0xdbfb('0x2b')],'basename':path['parse'](_0xa34f89[_0xdbfb('0x34')])[_0xdbfb('0x2b')]+_0xdbfb('0x3e'),'type':_0xdbfb('0x3f')})[_0xdbfb('0x40')](function(_0x3c0104){faxAccount[_0xdbfb('0x41')](_0x20e169,{'from':_0xa34f89[_0xdbfb('0x3a')],'mapKey':_0xdbfb('0x8'),'body':path['parse'](_0xa34f89[_0xdbfb('0x34')])[_0xdbfb('0x2b')]+_0xdbfb('0x3e'),'AttachmentId':_0x3c0104['id']})[_0xdbfb('0x42')](function(_0x486e01){logger[_0xdbfb('0x43')](_0xa34f89['uniqueid'],_0xdbfb('0x44'),JSON[_0xdbfb('0x45')](_0x486e01));});})[_0xdbfb('0x42')](function(_0x51a7c1){logger[_0xdbfb('0x43')](_0xa34f89[_0xdbfb('0x29')],_0xdbfb('0x46'),JSON[_0xdbfb('0x45')](_0x51a7c1));});});}logger[_0xdbfb('0x2c')](_0xa34f89[_0xdbfb('0x29')],_0xdbfb('0x46'));}};Fax[_0xdbfb('0x22')][_0xdbfb('0x21')]=function(_0x3a1ae8){if(this[_0xdbfb('0x12')][_0x3a1ae8[_0xdbfb('0x29')]]){_['merge'](this[_0xdbfb('0xf')][_0x3a1ae8[_0xdbfb('0x29')]],_[_0xdbfb('0x47')](_0x3a1ae8,[_0xdbfb('0x48'),_0xdbfb('0x49')]));}};function updateStatus(_0x59e1aa){if(_0x59e1aa['AttachmentId']){faxMessage[_0xdbfb('0x4a')](_0x59e1aa[_0xdbfb('0x4b')],{'failMessage':_0xdbfb('0x4c')})[_0xdbfb('0x40')](function(_0x3ae822){ut[_0xdbfb('0x4d')](_0xdbfb('0x4e'),_0x3ae822);})[_0xdbfb('0x42')](function(_0x52858a){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x52858a);});}else{ut[_0xdbfb('0x4d')]('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype']['updateStatus']=function(_0x588e65,_0x1abcb9,_0x28baae){var _0x5ecbcd=this;var _0x5ba311={};if(_0x1abcb9){_0x5ba311={'read':_0x1abcb9};}else{_0x5ba311={'failMessage':_0x28baae};}if(this[_0xdbfb('0x12')][_0x588e65]['AttachmentId']){faxMessage[_0xdbfb('0x4a')](this[_0xdbfb('0x12')][_0x588e65][_0xdbfb('0x4b')],_0x5ba311)['then'](function(_0x4509ff){ut[_0xdbfb('0x4d')]('[Fax][Message][Updated]',_0x4509ff);})[_0xdbfb('0x42')](function(_0x2ac1e2){ut[_0xdbfb('0x4d')](_0xdbfb('0x4f'),_0x2ac1e2);})[_0xdbfb('0x50')](function(){delete _0x5ecbcd[_0xdbfb('0xf')][_0x588e65];delete _0x5ecbcd[_0xdbfb('0x12')][_0x588e65];});}else{ut[_0xdbfb('0x4d')]('[Fax][Message][NoUpdate2]');delete this['channels'][_0x588e65];delete this['actions'][_0x588e65];}};Fax[_0xdbfb('0x22')][_0xdbfb('0x1f')]=function(_0x4f3dc9){var _0x553cf7=this;if(this[_0xdbfb('0xf')][_0x4f3dc9[_0xdbfb('0x29')]]){if(this['actions'][_0x4f3dc9[_0xdbfb('0x29')]]){this[_0xdbfb('0xf')][_0x4f3dc9[_0xdbfb('0x29')]]['id']=this[_0xdbfb('0x12')][_0x4f3dc9[_0xdbfb('0x29')]]['id'];this[_0xdbfb('0xf')][_0x4f3dc9['uniqueid']][_0xdbfb('0x2b')]=this[_0xdbfb('0x12')][_0x4f3dc9[_0xdbfb('0x29')]][_0xdbfb('0x2b')];}logger[_0xdbfb('0x2c')](_0x4f3dc9['uniqueid'],this[_0xdbfb('0x12')][_0x4f3dc9['uniqueid']]?_0xdbfb('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0xdbfb('0x45')](this[_0xdbfb('0xf')][_0x4f3dc9[_0xdbfb('0x29')]]));if(this[_0xdbfb('0x12')][_0x4f3dc9['uniqueid']]){if(this[_0xdbfb('0xf')][_0x4f3dc9[_0xdbfb('0x29')]]['faxpages']>0x0&&this['channels'][_0x4f3dc9['uniqueid']][_0xdbfb('0x1a')]===_0xdbfb('0x52')){this[_0xdbfb('0x53')](_0x4f3dc9[_0xdbfb('0x29')],!![]);}else{this[_0xdbfb('0x53')](_0x4f3dc9[_0xdbfb('0x29')],![],this[_0xdbfb('0xf')][_0x4f3dc9[_0xdbfb('0x29')]][_0xdbfb('0x54')]?'SENDING\x20FAILED:\x20'+this[_0xdbfb('0xf')][_0x4f3dc9[_0xdbfb('0x29')]][_0xdbfb('0x54')]:'SENDING\x20FAILED');}}}};Fax[_0xdbfb('0x22')]['send']=function(_0x6c2f3d){var _0x14cdcd=this;return new BPromise(function(_0x137e7b,_0x1eca2a){_0x14cdcd[_0xdbfb('0x55')](_0x6c2f3d,_0x14cdcd[_0xdbfb('0x10')][_0x6c2f3d[_0xdbfb('0x56')]])[_0xdbfb('0x40')](function(_0x48dcdc){ut[_0xdbfb('0x4d')](_0xdbfb('0x57'),_0x48dcdc);_0x137e7b(ut[_0xdbfb('0x3c')](_0xdbfb('0x58')));})['catch'](function(_0x470537){ut[_0xdbfb('0x4d')](_0xdbfb('0x59'),_0x470537);updateStatus(_0x6c2f3d);_0x1eca2a(ut[_0xdbfb('0x3c')]('Fax\x20failed'));});});};Fax[_0xdbfb('0x22')][_0xdbfb('0x5a')]=function(_0x296409){var _0x244d92=this;return new BPromise(function(_0x2cb67e,_0x375da7){var _0x445244=_0x244d92[_0xdbfb('0x5b')](_0x244d92[_0xdbfb('0x10')][_0x296409[_0xdbfb('0x56')]]['Trunk'],_0x296409);if(_0x445244['isValid']){_0x2cb67e(ut['message'](_0xdbfb('0x5c')));}else{_0x375da7(ut[_0xdbfb('0x3c')](_0x445244[_0xdbfb('0x3c')]));}});};function originate(_0x5f456f,_0x1f83ed,_0x193c73){return new BPromise(function(_0x5cb376,_0x4018ca){if(_0x193c73){var _0x5217cd=util[_0xdbfb('0x5d')](_0xdbfb('0x5e'),path[_0xdbfb('0x3d')](_0x5f456f[_0xdbfb('0x4')])['name'],_0x5f456f['path']);gs[_0xdbfb('0x5f')](_0x5217cd)['then'](function(){_0x5f456f[_0xdbfb('0x4')]=util[_0xdbfb('0x5d')](_0xdbfb('0x60'),path[_0xdbfb('0x3d')](_0x5f456f[_0xdbfb('0x4')])[_0xdbfb('0x61')],path['parse'](_0x5f456f[_0xdbfb('0x4')])['name']);_0x1f83ed[_0xdbfb('0x62')]=_0x5f456f[_0xdbfb('0x4')];ut[_0xdbfb('0x4d')](_0xdbfb('0x63'),'');ami[_0xdbfb('0x64')](ut['variablesAction'](_0x5f456f,_0x1f83ed))[_0xdbfb('0x40')](function(_0x204f1e){_0x5cb376(_0x204f1e);})[_0xdbfb('0x42')](function(_0x145b37){_0x4018ca(_0x145b37);});})[_0xdbfb('0x42')](function(_0x1c7a23){_0x4018ca(_0x1c7a23);});}else{ami[_0xdbfb('0x64')](ut[_0xdbfb('0x65')](_0x5f456f,_0x1f83ed))[_0xdbfb('0x40')](function(_0x28c76c){_0x5cb376(_0x28c76c);})[_0xdbfb('0x42')](function(_0x215708){_0x4018ca(_0x215708);});}});}Fax[_0xdbfb('0x22')]['execOriginate']=function(_0x54dfa4,_0x1811b9){var _0x602627=this;return new BPromise(function(_0x10ff7f,_0x1b3bd9){var _0x162728=uuid['v4']();var _0xbbf663=ut[_0xdbfb('0x66')](_0x54dfa4,_0x1811b9);_0x602627['actions'][_0x162728]=new Action(_0x162728,_0x1811b9,_0x54dfa4);var _0x2fb5d2=_0x602627[_0xdbfb('0x12')][_0x162728];if(path[_0xdbfb('0x3d')](_0x54dfa4[_0xdbfb('0x4')])['ext']===_0xdbfb('0x3e')){originate(_0x2fb5d2,_0xbbf663,!![])[_0xdbfb('0x40')](function(_0x56243d){_0x10ff7f(_0x56243d);})[_0xdbfb('0x42')](function(_0x4d90c3){_0x1b3bd9(_0x4d90c3);});}else{originate(_0x2fb5d2,_0xbbf663,![])['then'](function(_0x5186){_0x10ff7f(_0x5186);})['catch'](function(_0x3cab12){_0x1b3bd9(_0x3cab12);});}});};Fax[_0xdbfb('0x22')][_0xdbfb('0x67')]=function(_0x1c1cab){return!_[_0xdbfb('0x68')](_0x1c1cab)&&!_[_0xdbfb('0x68')](_0x1c1cab[_0xdbfb('0x2b')])&&!_[_0xdbfb('0x68')](_0x1c1cab['active'])&&_0x1c1cab['active']&&!_[_0xdbfb('0x68')](this[_0xdbfb('0x11')][util[_0xdbfb('0x5d')]('SIP/%s',_0x1c1cab['name'])])&&!_[_0xdbfb('0x68')](this['trunks'][util[_0xdbfb('0x5d')](_0xdbfb('0x69'),_0x1c1cab[_0xdbfb('0x2b')])][_0xdbfb('0x33')])&&(this[_0xdbfb('0x11')][util['format'](_0xdbfb('0x69'),_0x1c1cab[_0xdbfb('0x2b')])][_0xdbfb('0x33')]==='reachable'||this['trunks'][util[_0xdbfb('0x5d')](_0xdbfb('0x69'),_0x1c1cab['name'])]['status']==='unmonitored');};Fax[_0xdbfb('0x22')][_0xdbfb('0x5b')]=function(_0x30b338,_0x41778a){if(!this[_0xdbfb('0x67')](_0x30b338)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]',_[_0xdbfb('0x68')](_0x30b338)?'':_0x30b338[_0xdbfb('0x2b')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xdbfb('0x6a')};}if(_['isNil'](_0x41778a[_0xdbfb('0x8')])){ut['logger'](_0xdbfb('0x6b'),JSON[_0xdbfb('0x45')](_0x41778a));return{'isValid':![],'message':_0xdbfb('0x6c')};}if(_[_0xdbfb('0x68')](_0x41778a[_0xdbfb('0x4')])){ut[_0xdbfb('0x4d')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0xdbfb('0x45')](_0x41778a));return{'isValid':![],'message':_0xdbfb('0x6d')};}return{'isValid':!![],'message':_0xdbfb('0x6e')};};module[_0xdbfb('0x6f')]=Fax;
\ No newline at end of file
+var _0xc3ed=['%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','channels','trunks','actions','newchannel','syncNewchannel','varset','syncVarSet','bind','syncNewState','newexten','syncNewExten','faxstatus','receivefax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','faxAccounts','hasOwnProperty','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','info','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute'];(function(_0x4ede8b,_0x25b7a7){var _0x2c1011=function(_0x110e62){while(--_0x110e62){_0x4ede8b['push'](_0x4ede8b['shift']());}};_0x2c1011(++_0x25b7a7);}(_0xc3ed,0x18c));var _0xdc3e=function(_0xfd5ec6,_0x3c1203){_0xfd5ec6=_0xfd5ec6-0x0;var _0x4c585c=_0xc3ed[_0xfd5ec6];return _0x4c585c;};'use strict';var util=require('util');var _=require(_0xdc3e('0x0'));var BPromise=require(_0xdc3e('0x1'));var uuid=require(_0xdc3e('0x2'));var moment=require(_0xdc3e('0x3'));var path=require(_0xdc3e('0x4'));var tiff2pdf=require(_0xdc3e('0x5'));var gs=require(_0xdc3e('0x6'));var logger=require(_0xdc3e('0x7'))(_0xdc3e('0x8'));var ami=require(_0xdc3e('0x9'));var rpcDb=require(_0xdc3e('0xa'));var Channel=require(_0xdc3e('0xb'));var ut=require(_0xdc3e('0xc'));var Action=require(_0xdc3e('0xd'));var faxAccount=require(_0xdc3e('0xe'));var attachment=require(_0xdc3e('0xf'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2a8072){this[_0xdc3e('0x10')]={};this['faxAccounts']=_0x2a8072['faxAccounts'];this['trunks']=_0x2a8072[_0xdc3e('0x11')];this[_0xdc3e('0x12')]={};ami['on'](_0xdc3e('0x13'),this[_0xdc3e('0x14')]['bind'](this));ami['on'](_0xdc3e('0x15'),this[_0xdc3e('0x16')][_0xdc3e('0x17')](this));ami['on']('newstate',this[_0xdc3e('0x18')][_0xdc3e('0x17')](this));ami['on'](_0xdc3e('0x19'),this[_0xdc3e('0x1a')]['bind'](this));ami['on'](_0xdc3e('0x1b'),this['syncFaxStatus'][_0xdc3e('0x17')](this));ami['on'](_0xdc3e('0x1c'),this['syncReceiveFax'][_0xdc3e('0x17')](this));ami['on'](_0xdc3e('0x1d'),this[_0xdc3e('0x1e')][_0xdc3e('0x17')](this));ami['on'](_0xdc3e('0x1f'),this[_0xdc3e('0x20')][_0xdc3e('0x17')](this));}Fax[_0xdc3e('0x21')][_0xdc3e('0x14')]=function(_0x531e80){if(_0x531e80['context']===_0xdc3e('0x22')){for(var _0x3c9dc2 in this['faxAccounts']){if(this[_0xdc3e('0x23')][_0xdc3e('0x24')](_0x3c9dc2)){if(_0x531e80['exten']===this['faxAccounts'][_0x3c9dc2][_0xdc3e('0x25')]){this['channels'][_0x531e80[_0xdc3e('0x26')]]={};this[_0xdc3e('0x10')][_0x531e80[_0xdc3e('0x26')]][_0xdc3e('0x27')]=_0x531e80['channel'];this['channels'][_0x531e80[_0xdc3e('0x26')]]['id']=this[_0xdc3e('0x23')][_0x3c9dc2]['id'];this[_0xdc3e('0x10')][_0x531e80[_0xdc3e('0x26')]][_0xdc3e('0x28')]=this[_0xdc3e('0x23')][_0x3c9dc2]['name'];logger['info'](_0x531e80['uniqueid'],_0xdc3e('0x29'));}}}}if(this[_0xdc3e('0x12')][_0x531e80[_0xdc3e('0x26')]]){this[_0xdc3e('0x10')][_0x531e80[_0xdc3e('0x26')]]={};this[_0xdc3e('0x10')][_0x531e80['uniqueid']][_0xdc3e('0x27')]=_0x531e80[_0xdc3e('0x27')];logger['info'](_0x531e80['uniqueid'],_0xdc3e('0x29'));}};Fax[_0xdc3e('0x21')]['syncVarSet']=function(_0x46290d){if(this[_0xdc3e('0x10')][_0x46290d[_0xdc3e('0x26')]]){for(var _0x37937b in _0x46290d[_0xdc3e('0x2a')]){if(_0x46290d['variable'][_0xdc3e('0x24')](_0x37937b)){this[_0xdc3e('0x10')][_0x46290d['uniqueid']][_0x37937b]=_0x46290d[_0xdc3e('0x2b')];}}}};Fax[_0xdc3e('0x21')][_0xdc3e('0x18')]=function(_0x16856d){if(this[_0xdc3e('0x10')][_0x16856d[_0xdc3e('0x26')]]){this[_0xdc3e('0x10')][_0x16856d[_0xdc3e('0x26')]][_0xdc3e('0x2c')]=_0x16856d[_0xdc3e('0x2c')];this[_0xdc3e('0x10')][_0x16856d[_0xdc3e('0x26')]][_0xdc3e('0x2d')]=_0x16856d[_0xdc3e('0x2d')];}};Fax['prototype'][_0xdc3e('0x1a')]=function(_0x1047f6){if(this['channels'][_0x1047f6[_0xdc3e('0x26')]]){for(var _0x3fa9a5 in _0x1047f6['variable']){if(_0x1047f6['variable']['hasOwnProperty'](_0x3fa9a5)){this[_0xdc3e('0x10')][_0x1047f6['uniqueid']][_0x3fa9a5]=_0x1047f6['value'];}}}};Fax[_0xdc3e('0x21')][_0xdc3e('0x2e')]=function(_0x12431c){if(this[_0xdc3e('0x10')][_0x12431c[_0xdc3e('0x26')]]){this[_0xdc3e('0x10')][_0x12431c[_0xdc3e('0x26')]][_0xdc3e('0x2f')]=_0x12431c[_0xdc3e('0x2f')];this[_0xdc3e('0x10')][_0x12431c[_0xdc3e('0x26')]][_0xdc3e('0x30')]=_0x12431c[_0xdc3e('0x30')];this[_0xdc3e('0x10')][_0x12431c['uniqueid']]['localstationid']=_0x12431c[_0xdc3e('0x25')];this[_0xdc3e('0x10')][_0x12431c[_0xdc3e('0x26')]][_0xdc3e('0x31')]=_0x12431c[_0xdc3e('0x31')];logger[_0xdc3e('0x32')](_0x12431c[_0xdc3e('0x26')],_0xdc3e('0x33'));}};Fax[_0xdc3e('0x21')][_0xdc3e('0x34')]=function(_0x295bed){var _0x139c4e=this;if(this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]]){var _0x55d75c=this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]]['id'];this['channels'][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x35')]=_0x295bed[_0xdc3e('0x35')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x36')]=_0x295bed[_0xdc3e('0x36')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x25')]=_0x295bed[_0xdc3e('0x25')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x37')]=_0x295bed['resolution'];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]]['transferrate']=_0x295bed[_0xdc3e('0x38')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x31')]=_0x295bed[_0xdc3e('0x31')];this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]][_0xdc3e('0x39')]=_0x295bed[_0xdc3e('0x39')];if(this[_0xdc3e('0x10')][_0x295bed[_0xdc3e('0x26')]]['pagestransferred']>0x0){tiff2pdf(_0x295bed[_0xdc3e('0x31')],_0xdc3e('0x3a'),function(_0x774676){logger[_0xdc3e('0x32')](_0x295bed['uniqueid'],_0xdc3e('0x3b'),_0x774676[_0xdc3e('0x3c')]);attachment[_0xdc3e('0x3d')]({'name':path[_0xdc3e('0x3e')](_0x295bed[_0xdc3e('0x31')])[_0xdc3e('0x28')],'basename':path[_0xdc3e('0x3e')](_0x295bed[_0xdc3e('0x31')])[_0xdc3e('0x28')]+_0xdc3e('0x3f'),'type':_0xdc3e('0x40')})[_0xdc3e('0x41')](function(_0xc1eb66){faxAccount[_0xdc3e('0x42')](_0x55d75c,{'from':_0x295bed[_0xdc3e('0x39')],'mapKey':'fax','body':path['parse'](_0x295bed[_0xdc3e('0x31')])[_0xdc3e('0x28')]+_0xdc3e('0x3f'),'AttachmentId':_0xc1eb66['id']})[_0xdc3e('0x43')](function(_0x5ed554){logger[_0xdc3e('0x44')](_0x295bed['uniqueid'],_0xdc3e('0x45'),JSON['stringify'](_0x5ed554));});})[_0xdc3e('0x43')](function(_0x1f393d){logger[_0xdc3e('0x44')](_0x295bed['uniqueid'],_0xdc3e('0x46'),JSON[_0xdc3e('0x47')](_0x1f393d));});});}logger[_0xdc3e('0x32')](_0x295bed[_0xdc3e('0x26')],_0xdc3e('0x46'));}};Fax[_0xdc3e('0x21')][_0xdc3e('0x20')]=function(_0x5bc97a){if(this['actions'][_0x5bc97a[_0xdc3e('0x26')]]){_[_0xdc3e('0x48')](this[_0xdc3e('0x10')][_0x5bc97a[_0xdc3e('0x26')]],_['pick'](_0x5bc97a,[_0xdc3e('0x49'),_0xdc3e('0x4a')]));}};function updateStatus(_0x375cf0){if(_0x375cf0[_0xdc3e('0x4b')]){faxMessage[_0xdc3e('0x4c')](_0x375cf0['AttachmentId'],{'failMessage':_0xdc3e('0x4d')})[_0xdc3e('0x41')](function(_0x1af654){ut[_0xdc3e('0x4e')](_0xdc3e('0x4f'),_0x1af654);})[_0xdc3e('0x43')](function(_0x1e008b){ut[_0xdc3e('0x4e')](_0xdc3e('0x50'),_0x1e008b);});}else{ut[_0xdc3e('0x4e')](_0xdc3e('0x51'));}}Fax[_0xdc3e('0x21')][_0xdc3e('0x52')]=function(_0x2d98c0,_0x2a664b,_0x2cd565){var _0x60b7a=this;var _0x2ae877={};if(_0x2a664b){_0x2ae877={'read':_0x2a664b};}else{_0x2ae877={'failMessage':_0x2cd565};}if(this[_0xdc3e('0x12')][_0x2d98c0][_0xdc3e('0x4b')]){faxMessage[_0xdc3e('0x4c')](this[_0xdc3e('0x12')][_0x2d98c0][_0xdc3e('0x4b')],_0x2ae877)[_0xdc3e('0x41')](function(_0x4f874d){ut[_0xdc3e('0x4e')]('[Fax][Message][Updated]',_0x4f874d);})[_0xdc3e('0x43')](function(_0x3b5841){ut['logger'](_0xdc3e('0x53'),_0x3b5841);})[_0xdc3e('0x54')](function(){delete _0x60b7a[_0xdc3e('0x10')][_0x2d98c0];delete _0x60b7a['actions'][_0x2d98c0];});}else{ut['logger'](_0xdc3e('0x55'));delete this[_0xdc3e('0x10')][_0x2d98c0];delete this[_0xdc3e('0x12')][_0x2d98c0];}};Fax[_0xdc3e('0x21')][_0xdc3e('0x1e')]=function(_0x196c3d){var _0xe3b913=this;if(this[_0xdc3e('0x10')][_0x196c3d['uniqueid']]){if(this['actions'][_0x196c3d[_0xdc3e('0x26')]]){this[_0xdc3e('0x10')][_0x196c3d[_0xdc3e('0x26')]]['id']=this['actions'][_0x196c3d[_0xdc3e('0x26')]]['id'];this[_0xdc3e('0x10')][_0x196c3d[_0xdc3e('0x26')]][_0xdc3e('0x28')]=this[_0xdc3e('0x12')][_0x196c3d[_0xdc3e('0x26')]][_0xdc3e('0x28')];}logger[_0xdc3e('0x32')](_0x196c3d[_0xdc3e('0x26')],this[_0xdc3e('0x12')][_0x196c3d[_0xdc3e('0x26')]]?_0xdc3e('0x56'):_0xdc3e('0x57'),JSON['stringify'](this[_0xdc3e('0x10')][_0x196c3d['uniqueid']]));if(this[_0xdc3e('0x12')][_0x196c3d[_0xdc3e('0x26')]]){if(this['channels'][_0x196c3d[_0xdc3e('0x26')]][_0xdc3e('0x58')]>0x0&&this[_0xdc3e('0x10')][_0x196c3d['uniqueid']][_0xdc3e('0x1b')]===_0xdc3e('0x59')){this[_0xdc3e('0x52')](_0x196c3d[_0xdc3e('0x26')],!![]);}else{this['updateStatus'](_0x196c3d[_0xdc3e('0x26')],![],this[_0xdc3e('0x10')][_0x196c3d[_0xdc3e('0x26')]][_0xdc3e('0x5a')]?_0xdc3e('0x5b')+this[_0xdc3e('0x10')][_0x196c3d['uniqueid']]['faxstatusstring']:_0xdc3e('0x5c'));}}}};Fax['prototype'][_0xdc3e('0x5d')]=function(_0x7e5e60){var _0xe69457=this;return new BPromise(function(_0xa5c5ec,_0x5d118b){_0xe69457[_0xdc3e('0x5e')](_0x7e5e60,_0xe69457['faxAccounts'][_0x7e5e60['FaxAccountId']])[_0xdc3e('0x41')](function(_0x5e2861){ut[_0xdc3e('0x4e')](_0xdc3e('0x5f'),_0x5e2861);_0xa5c5ec(ut[_0xdc3e('0x3c')](_0xdc3e('0x60')));})['catch'](function(_0x5c2579){ut[_0xdc3e('0x4e')](_0xdc3e('0x61'),_0x5c2579);updateStatus(_0x7e5e60);_0x5d118b(ut['message']('Fax\x20failed'));});});};Fax[_0xdc3e('0x21')]['checkAfterSend']=function(_0x4ea79){var _0x406003=this;return new BPromise(function(_0x3294d1,_0x2512e5){var _0x200301=_0x406003[_0xdc3e('0x62')](_0x406003['faxAccounts'][_0x4ea79['FaxAccountId']][_0xdc3e('0x63')],_0x4ea79);if(_0x200301[_0xdc3e('0x64')]){_0x3294d1(ut[_0xdc3e('0x3c')]('Trunk\x20Reachable'));}else{_0x2512e5(ut[_0xdc3e('0x3c')](_0x200301[_0xdc3e('0x3c')]));}});};function originate(_0x2ad726,_0x11ba29,_0x44a752){return new BPromise(function(_0x41aac6,_0x31314a){if(_0x44a752){var _0x285114=util[_0xdc3e('0x65')](_0xdc3e('0x66'),path[_0xdc3e('0x3e')](_0x2ad726['path'])[_0xdc3e('0x28')],_0x2ad726[_0xdc3e('0x4')]);gs[_0xdc3e('0x67')](_0x285114)[_0xdc3e('0x41')](function(){_0x2ad726['path']=util[_0xdc3e('0x65')](_0xdc3e('0x68'),path[_0xdc3e('0x3e')](_0x2ad726['path'])[_0xdc3e('0x69')],path[_0xdc3e('0x3e')](_0x2ad726[_0xdc3e('0x4')])['name']);_0x11ba29[_0xdc3e('0x6a')]=_0x2ad726['path'];ut['logger'](_0xdc3e('0x6b'),'');ami['Action'](ut[_0xdc3e('0x6c')](_0x2ad726,_0x11ba29))[_0xdc3e('0x41')](function(_0x36c5ea){_0x41aac6(_0x36c5ea);})['catch'](function(_0x5d9338){_0x31314a(_0x5d9338);});})[_0xdc3e('0x43')](function(_0x2b5ab6){_0x31314a(_0x2b5ab6);});}else{ami['Action'](ut['variablesAction'](_0x2ad726,_0x11ba29))[_0xdc3e('0x41')](function(_0x90c7c4){_0x41aac6(_0x90c7c4);})[_0xdc3e('0x43')](function(_0x5c4e10){_0x31314a(_0x5c4e10);});}});}Fax[_0xdc3e('0x21')][_0xdc3e('0x5e')]=function(_0x82971b,_0xe2d71a){var _0x136d15=this;return new BPromise(function(_0x5a8fa0,_0x4a1c1d){var _0x526a08=uuid['v4']();var _0x11fd7f=ut[_0xdc3e('0x6d')](_0x82971b,_0xe2d71a);_0x136d15[_0xdc3e('0x12')][_0x526a08]=new Action(_0x526a08,_0xe2d71a,_0x82971b);var _0x30215e=_0x136d15[_0xdc3e('0x12')][_0x526a08];if(path[_0xdc3e('0x3e')](_0x82971b[_0xdc3e('0x4')])[_0xdc3e('0x6e')]===_0xdc3e('0x3f')){originate(_0x30215e,_0x11fd7f,!![])[_0xdc3e('0x41')](function(_0x4eaff4){_0x5a8fa0(_0x4eaff4);})['catch'](function(_0x1a1b54){_0x4a1c1d(_0x1a1b54);});}else{originate(_0x30215e,_0x11fd7f,![])[_0xdc3e('0x41')](function(_0x2eb61f){_0x5a8fa0(_0x2eb61f);})[_0xdc3e('0x43')](function(_0x4a4d1e){_0x4a1c1d(_0x4a4d1e);});}});};Fax[_0xdc3e('0x21')][_0xdc3e('0x6f')]=function(_0x53fef5){return!_[_0xdc3e('0x70')](_0x53fef5)&&!_[_0xdc3e('0x70')](_0x53fef5[_0xdc3e('0x28')])&&!_[_0xdc3e('0x70')](_0x53fef5[_0xdc3e('0x71')])&&_0x53fef5['active']&&!_[_0xdc3e('0x70')](this['trunks'][util[_0xdc3e('0x65')]('SIP/%s',_0x53fef5[_0xdc3e('0x28')])])&&!_['isNil'](this[_0xdc3e('0x11')][util[_0xdc3e('0x65')](_0xdc3e('0x72'),_0x53fef5[_0xdc3e('0x28')])]['status'])&&(this[_0xdc3e('0x11')][util[_0xdc3e('0x65')](_0xdc3e('0x72'),_0x53fef5[_0xdc3e('0x28')])][_0xdc3e('0x30')]===_0xdc3e('0x73')||this[_0xdc3e('0x11')][util['format']('SIP/%s',_0x53fef5[_0xdc3e('0x28')])]['status']===_0xdc3e('0x74'));};Fax[_0xdc3e('0x21')][_0xdc3e('0x62')]=function(_0x214143,_0x692108){if(!this[_0xdc3e('0x6f')](_0x214143)){ut[_0xdc3e('0x4e')](_0xdc3e('0x75'),_['isNil'](_0x214143)?'':_0x214143[_0xdc3e('0x28')]+_0xdc3e('0x76'));return{'isValid':![],'message':_0xdc3e('0x77')};}if(_['isNil'](_0x692108[_0xdc3e('0x8')])){ut[_0xdc3e('0x4e')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xdc3e('0x47')](_0x692108));return{'isValid':![],'message':_0xdc3e('0x78')};}if(_[_0xdc3e('0x70')](_0x692108['path'])){ut[_0xdc3e('0x4e')](_0xdc3e('0x79'),JSON['stringify'](_0x692108));return{'isValid':![],'message':_0xdc3e('0x7a')};}return{'isValid':!![],'message':_0xdc3e('0x7b')};};module[_0xdc3e('0x7c')]=Fax;
\ No newline at end of file
index fb38a78..f6dc535 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x037e=['notify','resolve','catch','util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','inspect'];(function(_0x17e743,_0x568254){var _0x263c25=function(_0xd4c238){while(--_0xd4c238){_0x17e743['push'](_0x17e743['shift']());}};_0x263c25(++_0x568254);}(_0x037e,0x85));var _0xe037=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x037e[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0xe037('0x0'));var BPromise=require(_0xe037('0x1'));var logger=require(_0xe037('0x2'))(_0xe037('0x3'));var _=require(_0xe037('0x4'));var faxAccount=require(_0xe037('0x5'));function loggerCatch(_0x4b2bc4){return function(_0x443d96){logger['error'](_0x4b2bc4,util[_0xe037('0x6')](_0x443d96,{'showHidden':![],'depth':null}));};}exports[_0xe037('0x7')]=function(_0x3b22a8,_0x553d26){return BPromise[_0xe037('0x8')]()['then'](faxAccount['notify'](_0x3b22a8,_0x553d26))[_0xe037('0x9')](loggerCatch('[Notify]\x20'));};
\ No newline at end of file
+var _0xc25d=['catch','[Notify]\x20','util','bluebird','preview','lodash','../rpc/faxAccount','notify','resolve','then'];(function(_0x2bbe0f,_0x405355){var _0x2e67e9=function(_0xcad8ed){while(--_0xcad8ed){_0x2bbe0f['push'](_0x2bbe0f['shift']());}};_0x2e67e9(++_0x405355);}(_0xc25d,0x110));var _0xdc25=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xc25d[_0x297fd3];return _0x2af381;};'use strict';var util=require(_0xdc25('0x0'));var BPromise=require(_0xdc25('0x1'));var logger=require('../../../config/logger')(_0xdc25('0x2'));var _=require(_0xdc25('0x3'));var faxAccount=require(_0xdc25('0x4'));function loggerCatch(_0x42174b){return function(_0x4409d7){logger['error'](_0x42174b,util['inspect'](_0x4409d7,{'showHidden':![],'depth':null}));};}exports[_0xdc25('0x5')]=function(_0x571fa4,_0x432d38){return BPromise[_0xdc25('0x6')]()[_0xdc25('0x7')](faxAccount[_0xdc25('0x5')](_0x571fa4,_0x432d38))[_0xdc25('0x8')](loggerCatch(_0xdc25('0x9')));};
\ No newline at end of file
index 9d763de..fa72883 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa0f2=['inspect','util','../../../../config/logger','bluebird','child_process','exec','info','Exec\x20gs','\x20Error\x20:'];(function(_0x7dc3e8,_0x55ccd3){var _0x3aa5e5=function(_0x489cc6){while(--_0x489cc6){_0x7dc3e8['push'](_0x7dc3e8['shift']());}};_0x3aa5e5(++_0x55ccd3);}(_0xa0f2,0x91));var _0x2a0f=function(_0x232caf,_0x358822){_0x232caf=_0x232caf-0x0;var _0x4a5781=_0xa0f2[_0x232caf];return _0x4a5781;};'use strict';var util=require(_0x2a0f('0x0'));var logger=require(_0x2a0f('0x1'))('fax');var BPromise=require(_0x2a0f('0x2'));var exec=require(_0x2a0f('0x3'))[_0x2a0f('0x4')];exports['execute']=function(_0xbbfbbd){return new BPromise(function(_0x39c041,_0x3f80f1){exec(_0xbbfbbd,function(_0x4ac0db,_0x5dc3ce,_0x21a2e9){logger[_0x2a0f('0x5')](_0x2a0f('0x6'),_0x5dc3ce);if(_0x4ac0db){logger[_0x2a0f('0x5')](_0x2a0f('0x6'),_0x2a0f('0x7'),util[_0x2a0f('0x8')](_0x4ac0db,{'showHidden':![],'depth':null}),_0x5dc3ce,_0x21a2e9);_0x3f80f1(_0x4ac0db);}_0x39c041(_0x5dc3ce);});});};
\ No newline at end of file
+var _0x46a2=['inspect','util','child_process','Exec\x20gs','info','\x20Error\x20:'];(function(_0x513e60,_0x395eea){var _0x11f441=function(_0x422810){while(--_0x422810){_0x513e60['push'](_0x513e60['shift']());}};_0x11f441(++_0x395eea);}(_0x46a2,0xcd));var _0x246a=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x46a2[_0x2786ea];return _0x5c38e5;};'use strict';var util=require(_0x246a('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require('bluebird');var exec=require(_0x246a('0x1'))['exec'];exports['execute']=function(_0x2c0ad3){return new BPromise(function(_0x36a94f,_0x19ffd8){exec(_0x2c0ad3,function(_0x18e794,_0x2b4129,_0x26c55d){logger['info'](_0x246a('0x2'),_0x2b4129);if(_0x18e794){logger[_0x246a('0x3')](_0x246a('0x2'),_0x246a('0x4'),util[_0x246a('0x5')](_0x18e794,{'showHidden':![],'depth':null}),_0x2b4129,_0x26c55d);_0x19ffd8(_0x18e794);}_0x36a94f(_0x2b4129);});});};
\ No newline at end of file
index 2f8493f..83c503e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x30c1=['xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','moment','info','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','variablesAction','uniqueid','originate','channel'];(function(_0x2c3bd9,_0x45f815){var _0x112e55=function(_0x22de25){while(--_0x22de25){_0x2c3bd9['push'](_0x2c3bd9['shift']());}};_0x112e55(++_0x45f815);}(_0x30c1,0x1e3));var _0x130c=function(_0x5ea211,_0x4da2af){_0x5ea211=_0x5ea211-0x0;var _0x12f9c9=_0x30c1[_0x5ea211];return _0x12f9c9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x130c('0x0'));var logger=require('../../../../config/logger')('fax');exports['message']=function(_0x1f5e6a){return{'message':_0x1f5e6a};};exports['logger']=function(_0x27c637,_0xe2a53e){logger[_0x130c('0x1')](_0x27c637,util['inspect'](_0xe2a53e,{'showHidden':![],'depth':null}));};exports[_0x130c('0x2')]=function(_0x1bf8ad,_0x3464a5){var _0x25f022={'XMF-ECM':_0x3464a5[_0x130c('0x3')],'XMF-HEADERINFO':_0x3464a5[_0x130c('0x4')],'XMF-MINRATE':_0x3464a5[_0x130c('0x5')],'XMF-MAXRATE':_0x3464a5[_0x130c('0x6')],'XMF-MODEM':util[_0x130c('0x7')](_0x130c('0x8'),_0x3464a5['modem']),'XMF-GATEWAY':_0x3464a5[_0x130c('0x9')],'XMF-FAXDETECT':_0x3464a5[_0x130c('0xa')],'XMF-T38TIMEOUT':_0x3464a5[_0x130c('0xb')],'XMF-LOCALSTATIONID':_0x3464a5[_0x130c('0xc')],'XMF-PATH':_0x1bf8ad['path']};return _0x25f022;};exports[_0x130c('0xd')]=function(_0x1231c6,_0x352653){return{'actionid':_0x1231c6[_0x130c('0xe')],'action':_0x130c('0xf'),'channel':_0x1231c6[_0x130c('0x10')],'Exten':_0x130c('0x11'),'Context':_0x130c('0x12'),'Priority':'1','callerid':util[_0x130c('0x7')](_0x130c('0x13'),_0x1231c6[_0x130c('0x4')]?_0x1231c6[_0x130c('0x4')]:'',_0x1231c6['localstationid']),'variable':_0x352653,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1231c6[_0x130c('0xe')]};};
\ No newline at end of file
+var _0x0475=['localstationid','util','lodash','moment','fax','info','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','path','variablesAction','uniqueid','originate','\x22%s\x22\x20<%s>'];(function(_0x44f7c8,_0x1e3fa5){var _0x4505f8=function(_0x428f61){while(--_0x428f61){_0x44f7c8['push'](_0x44f7c8['shift']());}};_0x4505f8(++_0x1e3fa5);}(_0x0475,0xbe));var _0x5047=function(_0x4cccd5,_0x2c1054){_0x4cccd5=_0x4cccd5-0x0;var _0x5f62b9=_0x0475[_0x4cccd5];return _0x5f62b9;};'use strict';var util=require(_0x5047('0x0'));var _=require(_0x5047('0x1'));var moment=require(_0x5047('0x2'));var logger=require('../../../../config/logger')(_0x5047('0x3'));exports['message']=function(_0xdf545c){return{'message':_0xdf545c};};exports['logger']=function(_0x12d414,_0x4eeac3){logger[_0x5047('0x4')](_0x12d414,util['inspect'](_0x4eeac3,{'showHidden':![],'depth':null}));};exports[_0x5047('0x5')]=function(_0x5972b9,_0x56af1a){var _0x4b2453={'XMF-ECM':_0x56af1a[_0x5047('0x6')],'XMF-HEADERINFO':_0x56af1a[_0x5047('0x7')],'XMF-MINRATE':_0x56af1a[_0x5047('0x8')],'XMF-MAXRATE':_0x56af1a[_0x5047('0x9')],'XMF-MODEM':util[_0x5047('0xa')](_0x5047('0xb'),_0x56af1a[_0x5047('0xc')]),'XMF-GATEWAY':_0x56af1a[_0x5047('0xd')],'XMF-FAXDETECT':_0x56af1a['faxdetect'],'XMF-T38TIMEOUT':_0x56af1a[_0x5047('0xe')],'XMF-LOCALSTATIONID':_0x56af1a['localstationid'],'XMF-PATH':_0x5972b9[_0x5047('0xf')]};return _0x4b2453;};exports[_0x5047('0x10')]=function(_0x1ec410,_0x22da6f){return{'actionid':_0x1ec410[_0x5047('0x11')],'action':_0x5047('0x12'),'channel':_0x1ec410['channel'],'Exten':'xcally-motion-fax','Context':'from-sip','Priority':'1','callerid':util[_0x5047('0xa')](_0x5047('0x13'),_0x1ec410[_0x5047('0x7')]?_0x1ec410[_0x5047('0x7')]:'',_0x1ec410[_0x5047('0x14')]),'variable':_0x22da6f,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1ec410['uniqueid']};};
\ No newline at end of file
index d11d1f2..1fda62c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeb24=['./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initCampaigns','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/servicenow'];(function(_0x46728b,_0x376bc6){var _0x5aa8e2=function(_0x111c54){while(--_0x111c54){_0x46728b['push'](_0x46728b['shift']());}};_0x5aa8e2(++_0x376bc6);}(_0xeb24,0x1cc));var _0x4eb2=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xeb24[_0x5d2803];return _0xdcad2c;};'use strict';var util=require(_0x4eb2('0x0'));var moment=require(_0x4eb2('0x1'));var server=require(_0x4eb2('0x2'));var Realtime=require(_0x4eb2('0x3'));var Report=require(_0x4eb2('0x4'));var Acw=require(_0x4eb2('0x5'));var Trigger=require(_0x4eb2('0x6'));var Dialer=require(_0x4eb2('0x7'));var Preview=require(_0x4eb2('0x8'));var Fax=require(_0x4eb2('0x9'));var user=require(_0x4eb2('0xa'));var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require('./rpc/voiceQueueReport');var voiceCallReport=require(_0x4eb2('0xb'));var trunk=require(_0x4eb2('0xc'));var trigger=require(_0x4eb2('0xd'));var template=require(_0x4eb2('0xe'));var cmHopperHistory=require(_0x4eb2('0xf'));var campaign=require(_0x4eb2('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x4eb2('0x11'));var zendesk=require(_0x4eb2('0x12'));var salesforce=require(_0x4eb2('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x4eb2('0x14'));var zoho=require(_0x4eb2('0x15'));var vtiger=require('./rpc/integrations/vtiger');var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x4eb2('0x16'));var dynamics365=require(_0x4eb2('0x17'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x4eb2('0x18'))(_0x4eb2('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x4eb2('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4eb2('0x1b')](_0x4eb2('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4eb2('0x1c')]()['then'](user['getAgents']())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x1e')]())['then'](user[_0x4eb2('0x1f')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x20')]())[_0x4eb2('0x1d')](trunk[_0x4eb2('0x21')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x22')]())[_0x4eb2('0x1d')](voiceQueue[_0x4eb2('0x23')]())['then'](realtime['initVoiceQueues']())['then'](trigger[_0x4eb2('0x24')]())[_0x4eb2('0x1d')](realtime['initTriggers']())[_0x4eb2('0x1d')](template[_0x4eb2('0x25')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x26')]())[_0x4eb2('0x1d')](zendesk[_0x4eb2('0x27')]())['then'](realtime['initZendeskAccounts']())[_0x4eb2('0x1d')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x4eb2('0x28')]())[_0x4eb2('0x1d')](sugarcrm[_0x4eb2('0x29')]())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x4eb2('0x2a')]())[_0x4eb2('0x1d')](realtime['initFreshdeskAccounts']())[_0x4eb2('0x1d')](desk['getDeskAccounts']())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x2b')]())[_0x4eb2('0x1d')](zoho[_0x4eb2('0x2c')]())['then'](realtime[_0x4eb2('0x2d')]())[_0x4eb2('0x1d')](vtiger[_0x4eb2('0x2e')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x2f')]())[_0x4eb2('0x1d')](freshsales[_0x4eb2('0x30')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x31')]())[_0x4eb2('0x1d')](servicenow[_0x4eb2('0x32')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x33')]())[_0x4eb2('0x1d')](dynamics365[_0x4eb2('0x34')]())['then'](realtime['initDynamics365Accounts']())[_0x4eb2('0x1d')](campaign['getCampaigns']())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x35')]())['then'](voiceExtension['getVoiceExtensions']())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x36')]())['then'](faxAccount[_0x4eb2('0x37')]())[_0x4eb2('0x1d')](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise[_0x4eb2('0x1c')]()[_0x4eb2('0x1d')](voiceQueueReport[_0x4eb2('0x38')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x39')]())[_0x4eb2('0x1d')](cmHopperHistory[_0x4eb2('0x3a')]())[_0x4eb2('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0x4eb2('0x1d')](cmHopperHistory[_0x4eb2('0x3b')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x3c')]())[_0x4eb2('0x1d')](voiceCallReport[_0x4eb2('0x3d')]())[_0x4eb2('0x1d')](realtime[_0x4eb2('0x3e')]())[_0x4eb2('0x3f')](function(_0x13425c){logger[_0x4eb2('0x40')](_0x4eb2('0x41'),util[_0x4eb2('0x42')](_0x13425c,{'showHidden':![],'depth':null}));});}function main(){return server[_0x4eb2('0x43')](realtime,preview,fax)[_0x4eb2('0x1d')](function(){return initRealtime();})[_0x4eb2('0x1d')](function(){return initParams();})[_0x4eb2('0x1d')](function(){report['sync']();setInterval(initRealtime,0x1388);})['catch'](function(_0x9d7d37){logger[_0x4eb2('0x40')](_0x4eb2('0x44'),util['inspect'](_0x9d7d37,{'showHidden':![],'depth':null}));});}main();
\ No newline at end of file
+var _0x2866=['./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','getTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2866,0xc8));var _0x6286=function(_0x16629d,_0x492375){_0x16629d=_0x16629d-0x0;var _0x56ccee=_0x2866[_0x16629d];return _0x56ccee;};'use strict';var util=require(_0x6286('0x0'));var moment=require(_0x6286('0x1'));var server=require('./server');var Realtime=require(_0x6286('0x2'));var Report=require(_0x6286('0x3'));var Acw=require(_0x6286('0x4'));var Trigger=require(_0x6286('0x5'));var Dialer=require(_0x6286('0x6'));var Preview=require(_0x6286('0x7'));var Fax=require(_0x6286('0x8'));var user=require(_0x6286('0x9'));var voiceQueue=require(_0x6286('0xa'));var voiceQueueReport=require(_0x6286('0xb'));var voiceCallReport=require(_0x6286('0xc'));var trunk=require('./rpc/trunk');var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require(_0x6286('0xd'));var campaign=require(_0x6286('0xe'));var voiceExtension=require(_0x6286('0xf'));var faxAccount=require(_0x6286('0x10'));var zendesk=require(_0x6286('0x11'));var salesforce=require(_0x6286('0x12'));var sugarcrm=require(_0x6286('0x13'));var freshdesk=require(_0x6286('0x14'));var desk=require(_0x6286('0x15'));var zoho=require(_0x6286('0x16'));var vtiger=require(_0x6286('0x17'));var freshsales=require(_0x6286('0x18'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x6286('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x6286('0x1a'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6286('0x1b')](_0x6286('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6286('0x1b')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x6286('0x1d')]()[_0x6286('0x1e')](user['getAgents']())['then'](realtime['initAgents']())['then'](user[_0x6286('0x1f')]())['then'](realtime[_0x6286('0x20')]())['then'](trunk[_0x6286('0x21')]())['then'](realtime[_0x6286('0x22')]())[_0x6286('0x1e')](voiceQueue['getVoiceQueues']())[_0x6286('0x1e')](realtime[_0x6286('0x23')]())[_0x6286('0x1e')](trigger[_0x6286('0x24')]())[_0x6286('0x1e')](realtime['initTriggers']())[_0x6286('0x1e')](template[_0x6286('0x25')]())[_0x6286('0x1e')](realtime['initTemplates']())[_0x6286('0x1e')](zendesk[_0x6286('0x26')]())['then'](realtime[_0x6286('0x27')]())[_0x6286('0x1e')](salesforce[_0x6286('0x28')]())[_0x6286('0x1e')](realtime[_0x6286('0x29')]())[_0x6286('0x1e')](sugarcrm[_0x6286('0x2a')]())[_0x6286('0x1e')](realtime['initSugarcrmAccounts']())[_0x6286('0x1e')](freshdesk[_0x6286('0x2b')]())[_0x6286('0x1e')](realtime[_0x6286('0x2c')]())[_0x6286('0x1e')](desk[_0x6286('0x2d')]())['then'](realtime[_0x6286('0x2e')]())[_0x6286('0x1e')](zoho[_0x6286('0x2f')]())[_0x6286('0x1e')](realtime[_0x6286('0x30')]())[_0x6286('0x1e')](vtiger[_0x6286('0x31')]())[_0x6286('0x1e')](realtime[_0x6286('0x32')]())[_0x6286('0x1e')](freshsales[_0x6286('0x33')]())[_0x6286('0x1e')](realtime['initFreshsalesAccounts']())[_0x6286('0x1e')](servicenow[_0x6286('0x34')]())['then'](realtime[_0x6286('0x35')]())[_0x6286('0x1e')](dynamics365['getDynamics365Accounts']())['then'](realtime[_0x6286('0x36')]())[_0x6286('0x1e')](campaign[_0x6286('0x37')]())[_0x6286('0x1e')](realtime[_0x6286('0x38')]())[_0x6286('0x1e')](voiceExtension[_0x6286('0x39')]())[_0x6286('0x1e')](realtime[_0x6286('0x3a')]())['then'](faxAccount[_0x6286('0x3b')]())[_0x6286('0x1e')](realtime[_0x6286('0x3c')]())[_0x6286('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x6286('0x1d')]()[_0x6286('0x1e')](voiceQueueReport[_0x6286('0x3d')]())[_0x6286('0x1e')](realtime[_0x6286('0x3e')]())[_0x6286('0x1e')](cmHopperHistory[_0x6286('0x3f')]())[_0x6286('0x1e')](realtime[_0x6286('0x40')]())[_0x6286('0x1e')](cmHopperHistory[_0x6286('0x41')]())[_0x6286('0x1e')](realtime[_0x6286('0x42')]())[_0x6286('0x1e')](voiceCallReport[_0x6286('0x43')]())[_0x6286('0x1e')](realtime[_0x6286('0x44')]())[_0x6286('0x45')](function(_0x118da4){logger['error'](_0x6286('0x46'),util[_0x6286('0x47')](_0x118da4,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6286('0x48')](realtime,preview,fax)[_0x6286('0x1e')](function(){return initRealtime();})[_0x6286('0x1e')](function(){return initParams();})[_0x6286('0x1e')](function(){report[_0x6286('0x49')]();setInterval(initRealtime,0x1388);})[_0x6286('0x45')](function(_0x4f31f1){logger['error'](_0x6286('0x4a'),util[_0x6286('0x47')](_0x4f31f1,{'showHidden':![],'depth':null}));});}main();
\ No newline at end of file
index d511705..1859a32 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39ae=['emit','user:ami:update','user:presence','exports','md5','ioredis','redis','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','phone','mobile','interface','online','voiceStatusTime','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','voiceStatus','address','stringify','user:%s'];(function(_0x51c1ac,_0x5bc935){var _0x5aa9d5=function(_0x1e02b0){while(--_0x1e02b0){_0x51c1ac['push'](_0x51c1ac['shift']());}};_0x5aa9d5(++_0x5bc935);}(_0x39ae,0x98));var _0xe39a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x39ae[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var md5=require(_0xe39a('0x0'));var Redis=require(_0xe39a('0x1'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xe39a('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xe39a('0x3'))(new Redis(config[_0xe39a('0x2')]));function Agent(_0x2d7c64){this['id']=_0x2d7c64['id']||0x0;this[_0xe39a('0x4')]=_0x2d7c64['name']||'';this[_0xe39a('0x5')]=_0x2d7c64['email']||'';this[_0xe39a('0x6')]=_0x2d7c64['accountcode']||'';this[_0xe39a('0x7')]=_0x2d7c64[_0xe39a('0x7')]||'';this[_0xe39a('0x8')]=_0xe39a('0x9');this[_0xe39a('0xa')]=0x0;this[_0xe39a('0xb')]=_0xe39a('0x9');this['address']='';this[_0xe39a('0xc')]='';this[_0xe39a('0xd')]='';this[_0xe39a('0xe')]='';this[_0xe39a('0xf')]=_0x2d7c64[_0xe39a('0xf')]||![];this['voiceStatus']=_0xe39a('0x9');this[_0xe39a('0x10')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xe39a('0x11')]='';this[_0xe39a('0x12')]=![];this['local']=![];this['md5']='';}Agent[_0xe39a('0x13')][_0xe39a('0x14')]=function(_0x5c5fe4){var _0x5f2432;if(_0x5c5fe4&&_0x5c5fe4[_0xe39a('0x8')]){_0x5f2432=_0x5c5fe4['state'][_0xe39a('0x15')]();switch(_0x5f2432){case _0xe39a('0x16'):_0x5f2432=_0xe39a('0x17');break;case _0xe39a('0x18'):_0x5f2432=_0xe39a('0x19');break;}}if(_0x5f2432&&this['voiceStatus']!==_0x5f2432||_0x5c5fe4[_0xe39a('0x1a')]){this['voiceStatusTime']=_[_0xe39a('0x1b')](moment()[_0xe39a('0x1c')]('x'));}if(_0x5f2432){this[_0xe39a('0x1d')]=_0x5f2432;}var _0x2a913d={'id':this['id'],'name':this[_0xe39a('0x4')],'email':this['email'],'accountcode':this[_0xe39a('0x6')],'fullname':this['fullname'],'state':this[_0xe39a('0x8')],'stateTime':this[_0xe39a('0xa')],'status':this['status'],'address':this[_0xe39a('0x1e')],'online':this[_0xe39a('0xf')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0xe39a('0x11')],'interface':this[_0xe39a('0xe')],'onhold':this[_0xe39a('0x12')]};var _0x1f298d=md5(JSON[_0xe39a('0x1f')](_0x2a913d));if(this[_0xe39a('0x0')]!==_0x1f298d){this[_0xe39a('0x0')]=_0x1f298d;io['to'](util['format'](_0xe39a('0x20'),_0x2a913d[_0xe39a('0x4')]))[_0xe39a('0x21')](_0xe39a('0x22'),_['omit'](_0x2a913d,[_0xe39a('0xf')]));io[_0xe39a('0x21')](_0xe39a('0x23'),_0x2a913d);}};module[_0xe39a('0x24')]=Agent;
\ No newline at end of file
+var _0xd891=['online','voiceStatus','prototype','updateStatusRealtime','state','not_inuse','inuse','voiceStatusTime','toNumber','voiceStatusQueue','onhold','stringify','user:%s','user:ami:update','omit','user:presence','lodash','util','md5','ioredis','defaults','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','status','address','mobile','interface'];(function(_0x519c88,_0xb84103){var _0x4668d7=function(_0x596c2c){while(--_0x596c2c){_0x519c88['push'](_0x519c88['shift']());}};_0x4668d7(++_0xb84103);}(_0xd891,0x1a8));var _0x1d89=function(_0x46f8cc,_0x490768){_0x46f8cc=_0x46f8cc-0x0;var _0x53dc3c=_0xd891[_0x46f8cc];return _0x53dc3c;};'use strict';var _=require(_0x1d89('0x0'));var util=require(_0x1d89('0x1'));var moment=require('moment');var md5=require(_0x1d89('0x2'));var Redis=require(_0x1d89('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x1d89('0x4')](config[_0x1d89('0x5')],{'host':_0x1d89('0x6'),'port':0x18eb});var io=require(_0x1d89('0x7'))(new Redis(config[_0x1d89('0x5')]));function Agent(_0x413103){this['id']=_0x413103['id']||0x0;this[_0x1d89('0x8')]=_0x413103[_0x1d89('0x8')]||'';this[_0x1d89('0x9')]=_0x413103[_0x1d89('0x9')]||'';this[_0x1d89('0xa')]=_0x413103[_0x1d89('0xa')]||'';this[_0x1d89('0xb')]=_0x413103[_0x1d89('0xb')]||'';this['state']=_0x1d89('0xc');this[_0x1d89('0xd')]=0x0;this[_0x1d89('0xe')]=_0x1d89('0xc');this[_0x1d89('0xf')]='';this['phone']='';this[_0x1d89('0x10')]='';this[_0x1d89('0x11')]='';this[_0x1d89('0x12')]=_0x413103['online']||![];this[_0x1d89('0x13')]=_0x1d89('0xc');this['voiceStatusTime']=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this['onhold']=![];this['local']=![];this[_0x1d89('0x2')]='';}Agent[_0x1d89('0x14')][_0x1d89('0x15')]=function(_0x49429a){var _0x1dc0c9;if(_0x49429a&&_0x49429a[_0x1d89('0x16')]){_0x1dc0c9=_0x49429a[_0x1d89('0x16')]['toLowerCase']();switch(_0x1dc0c9){case _0x1d89('0x17'):_0x1dc0c9='idle';break;case _0x1d89('0x18'):_0x1dc0c9='talking';break;}}if(_0x1dc0c9&&this['voiceStatus']!==_0x1dc0c9||_0x49429a['statePause']){this[_0x1d89('0x19')]=_[_0x1d89('0x1a')](moment()['format']('x'));}if(_0x1dc0c9){this[_0x1d89('0x13')]=_0x1dc0c9;}var _0x547e31={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0x1d89('0xa')],'fullname':this[_0x1d89('0xb')],'state':this[_0x1d89('0x16')],'stateTime':this[_0x1d89('0xd')],'status':this['status'],'address':this[_0x1d89('0xf')],'online':this[_0x1d89('0x12')],'voiceStatus':this[_0x1d89('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x1d89('0x1b')],'interface':this[_0x1d89('0x11')],'onhold':this[_0x1d89('0x1c')]};var _0x665126=md5(JSON[_0x1d89('0x1d')](_0x547e31));if(this[_0x1d89('0x2')]!==_0x665126){this['md5']=_0x665126;io['to'](util['format'](_0x1d89('0x1e'),_0x547e31['name']))['emit'](_0x1d89('0x1f'),_[_0x1d89('0x20')](_0x547e31,['online']));io['emit'](_0x1d89('0x21'),_0x547e31);}};module['exports']=Agent;
\ No newline at end of file
index c8d540f..41d0543 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x136d=['ivrAnswerCallsDay','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp'];(function(_0x437d7f,_0x1feb46){var _0x31058c=function(_0x49dd1a){while(--_0x49dd1a){_0x437d7f['push'](_0x437d7f['shift']());}};_0x31058c(++_0x1feb46);}(_0x136d,0xc7));var _0xd136=function(_0x1d558c,_0x1e497c){_0x1d558c=_0x1d558c-0x0;var _0x15767d=_0x136d[_0x1d558c];return _0x15767d;};'use strict';function Campaign(_0x20f92b){this['id']=_0x20f92b['id']||0x0;this[_0xd136('0x0')]=_0x20f92b[_0xd136('0x0')]||'';this[_0xd136('0x1')]=_0x20f92b[_0xd136('0x1')]||_0xd136('0x2');this[_0xd136('0x3')]=0x0;this[_0xd136('0x4')]=0x0;this[_0xd136('0x5')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0xd136('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0xd136('0x7')]=_0x20f92b[_0xd136('0x7')];this['limitCalls']=_0x20f92b[_0xd136('0x8')];this[_0xd136('0x9')]=_0x20f92b[_0xd136('0x9')]||null;this[_0xd136('0xa')]=_0x20f92b['dialGlobalInterval']?_0x20f92b['dialGlobalInterval']:null;this[_0xd136('0xb')]=_0x20f92b[_0xd136('0xb')];this[_0xd136('0xc')]=_0x20f92b[_0xd136('0xc')];this[_0xd136('0xd')]=_0x20f92b[_0xd136('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x20f92b[_0xd136('0xe')];this[_0xd136('0xf')]=_0x20f92b[_0xd136('0xf')];this[_0xd136('0x10')]=_0x20f92b['dialBusyMaxRetry'];this[_0xd136('0x11')]=_0x20f92b['dialBusyRetryFrequency'];this[_0xd136('0x12')]=_0x20f92b[_0xd136('0x12')];this[_0xd136('0x13')]=_0x20f92b['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x20f92b[_0xd136('0x14')];this[_0xd136('0x15')]=_0x20f92b[_0xd136('0x15')]||0x3;this[_0xd136('0x16')]=_0x20f92b[_0xd136('0x16')]||0x96;this[_0xd136('0x17')]=_0x20f92b[_0xd136('0x17')]||0x3;this[_0xd136('0x18')]=_0x20f92b['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x20f92b[_0xd136('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x20f92b[_0xd136('0x1a')]||0x96;this[_0xd136('0x1b')]=_0x20f92b[_0xd136('0x1b')]||0x3;this[_0xd136('0x1c')]=_0x20f92b[_0xd136('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x20f92b[_0xd136('0x1d')]||0x3;this[_0xd136('0x1e')]=_0x20f92b[_0xd136('0x1e')]||0x96;this[_0xd136('0x1f')]=_0x20f92b[_0xd136('0x1f')]||_0xd136('0x20');this['dialPrefix']=_0x20f92b[_0xd136('0x21')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x20f92b[_0xd136('0x22')]||undefined;this[_0xd136('0x23')]=_0x20f92b[_0xd136('0x23')]||undefined;this[_0xd136('0x24')]=_0x20f92b[_0xd136('0x24')]?_0x20f92b[_0xd136('0x24')]:undefined;this[_0xd136('0x25')]=_0x20f92b[_0xd136('0x25')]?_0x20f92b['Trunk']:undefined;this['Interval']=_0x20f92b[_0xd136('0x26')]?_0x20f92b[_0xd136('0x26')]:undefined;this[_0xd136('0x27')]=_0x20f92b[_0xd136('0x27')]?_0x20f92b[_0xd136('0x27')]:undefined;this[_0xd136('0x28')]=_0x20f92b['SquareProject']?_0x20f92b[_0xd136('0x27')][_0xd136('0x0')]:undefined;this[_0xd136('0x29')]=_0x20f92b['dialAMDActive']||![];this[_0xd136('0x2a')]=_0x20f92b[_0xd136('0x2a')];this['dialAMDGreeting']=_0x20f92b[_0xd136('0x2b')];this['dialAMDAfterGreetingSilence']=_0x20f92b[_0xd136('0x2c')];this[_0xd136('0x2d')]=_0x20f92b[_0xd136('0x2d')];this['dialAMDMinWordLength']=_0x20f92b[_0xd136('0x2e')];this[_0xd136('0x2f')]=_0x20f92b[_0xd136('0x2f')];this[_0xd136('0x30')]=_0x20f92b[_0xd136('0x30')];this['dialAMDSilenceThreshold']=_0x20f92b[_0xd136('0x31')];this[_0xd136('0x32')]=_0x20f92b[_0xd136('0x32')];}module['exports']=Campaign;
\ No newline at end of file
+var _0x2696=['dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','ivrAnswerCallsDay','ivrTotalCallsDays','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry'];(function(_0x3ffb65,_0xb02c87){var _0x1fce79=function(_0x467370){while(--_0x467370){_0x3ffb65['push'](_0x3ffb65['shift']());}};_0x1fce79(++_0xb02c87);}(_0x2696,0x111));var _0x6269=function(_0x3735d7,_0x4de243){_0x3735d7=_0x3735d7-0x0;var _0x597eab=_0x2696[_0x3735d7];return _0x597eab;};'use strict';function Campaign(_0x43f49a){this['id']=_0x43f49a['id']||0x0;this[_0x6269('0x0')]=_0x43f49a['name']||'';this[_0x6269('0x1')]=_0x43f49a[_0x6269('0x1')]||_0x6269('0x2');this[_0x6269('0x3')]=0x0;this['temp']=0x0;this[_0x6269('0x4')]=0x0;this[_0x6269('0x5')]=0x0;this['message']='';this['sendMessageOneNotActive']=!![];this[_0x6269('0x6')]=_0x43f49a[_0x6269('0x6')];this['limitCalls']=_0x43f49a[_0x6269('0x7')];this[_0x6269('0x8')]=_0x43f49a[_0x6269('0x8')]||null;this[_0x6269('0x9')]=_0x43f49a['dialGlobalInterval']?_0x43f49a[_0x6269('0x9')]:null;this[_0x6269('0xa')]=_0x43f49a['dialOriginateCallerIdName'];this[_0x6269('0xb')]=_0x43f49a[_0x6269('0xb')];this[_0x6269('0xc')]=_0x43f49a[_0x6269('0xc')]||0x1e;this[_0x6269('0xd')]=_0x43f49a[_0x6269('0xd')];this['dialCongestionRetryFrequency']=_0x43f49a[_0x6269('0xe')];this[_0x6269('0xf')]=_0x43f49a[_0x6269('0xf')];this['dialBusyRetryFrequency']=_0x43f49a[_0x6269('0x10')];this[_0x6269('0x11')]=_0x43f49a[_0x6269('0x11')];this[_0x6269('0x12')]=_0x43f49a[_0x6269('0x12')];this['dialGlobalMaxRetry']=_0x43f49a[_0x6269('0x13')];this[_0x6269('0x14')]=_0x43f49a[_0x6269('0x14')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x43f49a[_0x6269('0x15')]||0x96;this[_0x6269('0x16')]=_0x43f49a[_0x6269('0x16')]||0x3;this['dialDropRetryFrequency']=_0x43f49a[_0x6269('0x17')]||0x96;this[_0x6269('0x18')]=_0x43f49a[_0x6269('0x18')]||0x3;this[_0x6269('0x19')]=_0x43f49a['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x43f49a[_0x6269('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x43f49a[_0x6269('0x1b')]||0x96;this[_0x6269('0x1c')]=_0x43f49a[_0x6269('0x1c')]||0x3;this[_0x6269('0x1d')]=_0x43f49a[_0x6269('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x43f49a[_0x6269('0x1e')]||_0x6269('0x1f');this[_0x6269('0x20')]=_0x43f49a[_0x6269('0x20')]||undefined;this[_0x6269('0x21')]=_0x43f49a[_0x6269('0x21')]||undefined;this['dialCutDigit']=_0x43f49a[_0x6269('0x22')]||undefined;this[_0x6269('0x23')]=_0x43f49a[_0x6269('0x23')]?_0x43f49a['TrunkBackup']:undefined;this['Trunk']=_0x43f49a[_0x6269('0x24')]?_0x43f49a[_0x6269('0x24')]:undefined;this['Interval']=_0x43f49a['Interval']?_0x43f49a[_0x6269('0x25')]:undefined;this[_0x6269('0x26')]=_0x43f49a[_0x6269('0x26')]?_0x43f49a[_0x6269('0x26')]:undefined;this[_0x6269('0x27')]=_0x43f49a[_0x6269('0x26')]?_0x43f49a[_0x6269('0x26')][_0x6269('0x0')]:undefined;this[_0x6269('0x28')]=_0x43f49a['dialAMDActive']||![];this[_0x6269('0x29')]=_0x43f49a[_0x6269('0x29')];this[_0x6269('0x2a')]=_0x43f49a[_0x6269('0x2a')];this['dialAMDAfterGreetingSilence']=_0x43f49a['dialAMDAfterGreetingSilence'];this[_0x6269('0x2b')]=_0x43f49a[_0x6269('0x2b')];this[_0x6269('0x2c')]=_0x43f49a[_0x6269('0x2c')];this['dialAMDBetweenWordsSilence']=_0x43f49a['dialAMDBetweenWordsSilence'];this[_0x6269('0x2d')]=_0x43f49a['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x43f49a[_0x6269('0x2e')];this[_0x6269('0x2f')]=_0x43f49a[_0x6269('0x2f')];}module[_0x6269('0x30')]=Campaign;
\ No newline at end of file
index f193641..3ae2895 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9d5b=['disposition','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','lastdata','duration','billableseconds','holdtime','tag'];(function(_0x5684f3,_0x3d88e3){var _0x207e3e=function(_0x25ed49){while(--_0x25ed49){_0x5684f3['push'](_0x5684f3['shift']());}};_0x207e3e(++_0x3d88e3);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x3d101b,_0x4c6452){_0x3d101b=_0x3d101b-0x0;var _0x231a33=_0x9d5b[_0x3d101b];return _0x231a33;};'use strict';function Channel(){this['starttime']=null;this[_0xb9d5('0x0')]='';this[_0xb9d5('0x1')]='';this[_0xb9d5('0x2')]=0x0;this[_0xb9d5('0x3')]='';this[_0xb9d5('0x4')]=undefined;this['connectedlinename']=undefined;this[_0xb9d5('0x5')]=0x0;this['context']='';this[_0xb9d5('0x6')]=0x0;this[_0xb9d5('0x7')]=0x0;this[_0xb9d5('0x8')]=0x0;this[_0xb9d5('0x9')]=![];this[_0xb9d5('0xa')]=null;this['endtime']=null;this[_0xb9d5('0xb')]=![];this[_0xb9d5('0xc')]=![];this['lastapplication']='';this[_0xb9d5('0xd')]='';this[_0xb9d5('0xe')]=0x0;this[_0xb9d5('0xf')]=0x0;this[_0xb9d5('0x10')]=0x0;this['type']=null;this[_0xb9d5('0x11')]=null;this[_0xb9d5('0x12')]=null;this['monitor']=![];this[_0xb9d5('0x13')]=null;this[_0xb9d5('0x14')]=null;this[_0xb9d5('0x15')]=[];this[_0xb9d5('0x16')]=undefined;this[_0xb9d5('0x17')]=undefined;this[_0xb9d5('0x18')]=undefined;this[_0xb9d5('0x19')]=0x0;}module[_0xb9d5('0x1a')]=Channel;
\ No newline at end of file
+var _0x4965=['mohtime','exports','starttime','channel','destinationchannel','connectedlinename','context','uniqueid','linkedid','answered','answertime','endtime','unmanaged','lastapplication','duration','billableseconds','holdtime','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4965,0x16e));var _0x5496=function(_0x91f539,_0x442a0c){_0x91f539=_0x91f539-0x0;var _0x2e3bdd=_0x4965[_0x91f539];return _0x2e3bdd;};'use strict';function Channel(){this[_0x5496('0x0')]=null;this[_0x5496('0x1')]='';this[_0x5496('0x2')]='';this['calleridnum']=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this[_0x5496('0x3')]=undefined;this['accountcode']=0x0;this[_0x5496('0x4')]='';this[_0x5496('0x5')]=0x0;this[_0x5496('0x6')]=0x0;this['exten']=0x0;this[_0x5496('0x7')]=![];this[_0x5496('0x8')]=null;this[_0x5496('0x9')]=null;this[_0x5496('0xa')]=![];this['abandoned']=![];this[_0x5496('0xb')]='';this['lastdata']='';this[_0x5496('0xc')]=0x0;this[_0x5496('0xd')]=0x0;this[_0x5496('0xe')]=0x0;this['type']=null;this[_0x5496('0xf')]=null;this[_0x5496('0x10')]=null;this[_0x5496('0x11')]=![];this[_0x5496('0x12')]=null;this[_0x5496('0x13')]=null;this[_0x5496('0x14')]=[];this[_0x5496('0x15')]=undefined;this[_0x5496('0x16')]=undefined;this[_0x5496('0x17')]=undefined;this[_0x5496('0x18')]=0x0;}module[_0x5496('0x19')]=Channel;
\ No newline at end of file
index b433a50..4aec15a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0129=['password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','name','username','authType'];(function(_0x1d8b0c,_0x147e75){var _0x2e9b51=function(_0x1d2eb0){while(--_0x1d2eb0){_0x1d8b0c['push'](_0x1d8b0c['shift']());}};_0x2e9b51(++_0x147e75);}(_0x0129,0x97));var _0x9012=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0129[_0x3dd15e];return _0x231fd0;};'use strict';function DeskAccount(_0x23a3e0){this['id']=_0x23a3e0['id']||0x0;this[_0x9012('0x0')]=_0x23a3e0['name']||'';this[_0x9012('0x1')]=_0x23a3e0[_0x9012('0x1')]||'';this['remoteUri']=_0x23a3e0['remoteUri']||'';this['authType']=_0x23a3e0[_0x9012('0x2')]||'';this['password']=_0x23a3e0[_0x9012('0x3')]||'';this[_0x9012('0x4')]=_0x23a3e0[_0x9012('0x4')]||'';this[_0x9012('0x5')]=_0x23a3e0[_0x9012('0x5')]||'';this[_0x9012('0x6')]=_0x23a3e0[_0x9012('0x6')]||'';this[_0x9012('0x7')]=_0x23a3e0['tokenSecret']||'';this['type']=_0x23a3e0[_0x9012('0x8')]||'';this[_0x9012('0x9')]=_0x23a3e0[_0x9012('0x9')]||'';this[_0x9012('0xa')]=_0x23a3e0[_0x9012('0xa')]||{};}module['exports']=DeskAccount;
\ No newline at end of file
+var _0xeba7=['token','tokenSecret','type','serverUrl','Configurations','name','username','remoteUri','authType','password','consumerKey','consumerSecret'];(function(_0x145560,_0x14bdfa){var _0x5dd9ae=function(_0x23e857){while(--_0x23e857){_0x145560['push'](_0x145560['shift']());}};_0x5dd9ae(++_0x14bdfa);}(_0xeba7,0xc5));var _0x7eba=function(_0x2feef7,_0x58f8c3){_0x2feef7=_0x2feef7-0x0;var _0xd3406e=_0xeba7[_0x2feef7];return _0xd3406e;};'use strict';function DeskAccount(_0x5f05b3){this['id']=_0x5f05b3['id']||0x0;this[_0x7eba('0x0')]=_0x5f05b3['name']||'';this['username']=_0x5f05b3[_0x7eba('0x1')]||'';this['remoteUri']=_0x5f05b3[_0x7eba('0x2')]||'';this[_0x7eba('0x3')]=_0x5f05b3[_0x7eba('0x3')]||'';this[_0x7eba('0x4')]=_0x5f05b3[_0x7eba('0x4')]||'';this['consumerKey']=_0x5f05b3[_0x7eba('0x5')]||'';this['consumerSecret']=_0x5f05b3[_0x7eba('0x6')]||'';this[_0x7eba('0x7')]=_0x5f05b3[_0x7eba('0x7')]||'';this[_0x7eba('0x8')]=_0x5f05b3['tokenSecret']||'';this[_0x7eba('0x9')]=_0x5f05b3[_0x7eba('0x9')]||'';this[_0x7eba('0xa')]=_0x5f05b3[_0x7eba('0xa')]||'';this['Configurations']=_0x5f05b3[_0x7eba('0xb')]||{};}module['exports']=DeskAccount;
\ No newline at end of file
index 6df9010..2528672 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd319=['CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations'];(function(_0x15a3d3,_0x1fe368){var _0x1fa778=function(_0x3ad80a){while(--_0x3ad80a){_0x15a3d3['push'](_0x15a3d3['shift']());}};_0x1fa778(++_0x1fe368);}(_0xd319,0xb6));var _0x9d31=function(_0x4beb7a,_0x76823f){_0x4beb7a=_0x4beb7a-0x0;var _0x5c81fc=_0xd319[_0x4beb7a];return _0x5c81fc;};'use strict';function Dynamics365Account(_0x14a016){this['id']=_0x14a016['id']||0x0;this[_0x9d31('0x0')]=_0x14a016[_0x9d31('0x0')]||'';this[_0x9d31('0x1')]=_0x14a016['username']||'';this[_0x9d31('0x2')]=_0x14a016[_0x9d31('0x2')]||'';this[_0x9d31('0x3')]=_0x14a016[_0x9d31('0x3')]||'';this[_0x9d31('0x4')]=_0x14a016[_0x9d31('0x4')]||'';this[_0x9d31('0x5')]=_0x14a016[_0x9d31('0x5')]||'';this[_0x9d31('0x6')]=_0x14a016[_0x9d31('0x6')]||{};this[_0x9d31('0x7')]=_0x14a016[_0x9d31('0x7')]||'';this['modernAuthentication']=_0x14a016[_0x9d31('0x8')]||![];this[_0x9d31('0x9')]=_0x14a016[_0x9d31('0x9')]||{};this[_0x9d31('0xa')]=_0x14a016[_0x9d31('0xa')]||{};}module[_0x9d31('0xb')]=Dynamics365Account;
\ No newline at end of file
+var _0xfdd6=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x594f6d,_0x19c939){var _0x2f1332=function(_0x432c42){while(--_0x432c42){_0x594f6d['push'](_0x594f6d['shift']());}};_0x2f1332(++_0x19c939);}(_0xfdd6,0xf8));var _0x6fdd=function(_0x1ff575,_0xdba21f){_0x1ff575=_0x1ff575-0x0;var _0x48fc9e=_0xfdd6[_0x1ff575];return _0x48fc9e;};'use strict';function Dynamics365Account(_0x1779b9){this['id']=_0x1779b9['id']||0x0;this[_0x6fdd('0x0')]=_0x1779b9[_0x6fdd('0x0')]||'';this[_0x6fdd('0x1')]=_0x1779b9[_0x6fdd('0x1')]||'';this[_0x6fdd('0x2')]=_0x1779b9[_0x6fdd('0x2')]||'';this[_0x6fdd('0x3')]=_0x1779b9['remoteUri']||'';this[_0x6fdd('0x4')]=_0x1779b9[_0x6fdd('0x4')]||'';this[_0x6fdd('0x5')]=_0x1779b9['clientId']||'';this[_0x6fdd('0x6')]=_0x1779b9[_0x6fdd('0x6')]||{};this[_0x6fdd('0x7')]=_0x1779b9['serverUrl']||'';this[_0x6fdd('0x8')]=_0x1779b9['modernAuthentication']||![];this[_0x6fdd('0x9')]=_0x1779b9['Configurations']||{};this[_0x6fdd('0xa')]=_0x1779b9[_0x6fdd('0xa')]||{};}module[_0x6fdd('0xb')]=Dynamics365Account;
\ No newline at end of file
index 6bbbe21..b4bdd33 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf03b=['tech','SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect'];(function(_0x286333,_0x3f0219){var _0xb71c52=function(_0xe09c92){while(--_0xe09c92){_0x286333['push'](_0x286333['shift']());}};_0xb71c52(++_0x3f0219);}(_0xf03b,0xc5));var _0xbf03=function(_0x5b6d0a,_0x2fdbf4){_0x5b6d0a=_0x5b6d0a-0x0;var _0x382a58=_0xf03b[_0x5b6d0a];return _0x382a58;};'use strict';function FaxAccount(_0x727e00){this['id']=_0x727e00['id']||0x0;this[_0xbf03('0x0')]=_0x727e00[_0xbf03('0x0')]||'';this[_0xbf03('0x1')]=_0x727e00['description'];this['ecm']=_0x727e00[_0xbf03('0x2')];this[_0xbf03('0x3')]=_0x727e00[_0xbf03('0x3')];this[_0xbf03('0x4')]=_0x727e00[_0xbf03('0x4')];this[_0xbf03('0x5')]=_0x727e00[_0xbf03('0x5')]||0x960;this[_0xbf03('0x6')]=_0x727e00[_0xbf03('0x6')]||0x3840;this[_0xbf03('0x7')]=_0x727e00['modem']||_0xbf03('0x8');this[_0xbf03('0x9')]=_0x727e00[_0xbf03('0x9')]||'no';this[_0xbf03('0xa')]=_0x727e00[_0xbf03('0xa')]||'no';this['t38timeout']=_0x727e00['t38timeout']||0x1388;this[_0xbf03('0xb')]=_0x727e00[_0xbf03('0xb')]||_0xbf03('0xc');this[_0xbf03('0xd')]=_0x727e00[_0xbf03('0xd')]?_0x727e00[_0xbf03('0xd')]:undefined;this['ListId']=_0x727e00[_0xbf03('0xe')];this[_0xbf03('0xf')]=_0x727e00[_0xbf03('0xf')];}module['exports']=FaxAccount;
\ No newline at end of file
+var _0x9a66=['ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','name','description'];(function(_0x39438f,_0x57776c){var _0x115c3e=function(_0x33334f){while(--_0x33334f){_0x39438f['push'](_0x39438f['shift']());}};_0x115c3e(++_0x57776c);}(_0x9a66,0xfd));var _0x69a6=function(_0xf16ebd,_0x1835fa){_0xf16ebd=_0xf16ebd-0x0;var _0x371eac=_0x9a66[_0xf16ebd];return _0x371eac;};'use strict';function FaxAccount(_0x57e33f){this['id']=_0x57e33f['id']||0x0;this['name']=_0x57e33f[_0x69a6('0x0')]||'';this[_0x69a6('0x1')]=_0x57e33f[_0x69a6('0x1')];this['ecm']=_0x57e33f[_0x69a6('0x2')];this[_0x69a6('0x3')]=_0x57e33f[_0x69a6('0x3')];this[_0x69a6('0x4')]=_0x57e33f['localstationid'];this[_0x69a6('0x5')]=_0x57e33f['minrate']||0x960;this[_0x69a6('0x6')]=_0x57e33f['maxrate']||0x3840;this['modem']=_0x57e33f[_0x69a6('0x7')]||_0x69a6('0x8');this[_0x69a6('0x9')]=_0x57e33f['gateway']||'no';this[_0x69a6('0xa')]=_0x57e33f[_0x69a6('0xa')]||'no';this['t38timeout']=_0x57e33f[_0x69a6('0xb')]||0x1388;this['tech']=_0x57e33f[_0x69a6('0xc')]||_0x69a6('0xd');this[_0x69a6('0xe')]=_0x57e33f[_0x69a6('0xe')]?_0x57e33f[_0x69a6('0xe')]:undefined;this['ListId']=_0x57e33f[_0x69a6('0xf')];this[_0x69a6('0x10')]=_0x57e33f[_0x69a6('0x10')];}module['exports']=FaxAccount;
\ No newline at end of file
index 837cf0e..ba5a02e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x74b3=['remoteUri','serverUrl','Configurations','name','username','apiKey'];(function(_0x1edf62,_0x1ccdb6){var _0x64547c=function(_0x5de727){while(--_0x5de727){_0x1edf62['push'](_0x1edf62['shift']());}};_0x64547c(++_0x1ccdb6);}(_0x74b3,0xc9));var _0x374b=function(_0x1e19e6,_0x58454d){_0x1e19e6=_0x1e19e6-0x0;var _0x324419=_0x74b3[_0x1e19e6];return _0x324419;};'use strict';function FreshdeskAccount(_0x1bb597){this['id']=_0x1bb597['id']||0x0;this[_0x374b('0x0')]=_0x1bb597[_0x374b('0x0')]||'';this['username']=_0x1bb597[_0x374b('0x1')]||'';this[_0x374b('0x2')]=_0x1bb597['token']||'';this[_0x374b('0x3')]=_0x1bb597['remoteUri']||'';this[_0x374b('0x4')]=_0x1bb597[_0x374b('0x4')]||'';this[_0x374b('0x5')]=_0x1bb597[_0x374b('0x5')]||{};}module['exports']=FreshdeskAccount;
\ No newline at end of file
+var _0xc766=['name','username','token','remoteUri','serverUrl','Configurations','exports'];(function(_0x13ae9e,_0x30f06c){var _0x1d27eb=function(_0x54b4d3){while(--_0x54b4d3){_0x13ae9e['push'](_0x13ae9e['shift']());}};_0x1d27eb(++_0x30f06c);}(_0xc766,0xd2));var _0x6c76=function(_0x455720,_0x3753d4){_0x455720=_0x455720-0x0;var _0x2b707c=_0xc766[_0x455720];return _0x2b707c;};'use strict';function FreshdeskAccount(_0x5e402d){this['id']=_0x5e402d['id']||0x0;this[_0x6c76('0x0')]=_0x5e402d[_0x6c76('0x0')]||'';this[_0x6c76('0x1')]=_0x5e402d['username']||'';this['apiKey']=_0x5e402d[_0x6c76('0x2')]||'';this[_0x6c76('0x3')]=_0x5e402d[_0x6c76('0x3')]||'';this[_0x6c76('0x4')]=_0x5e402d[_0x6c76('0x4')]||'';this[_0x6c76('0x5')]=_0x5e402d['Configurations']||{};}module[_0x6c76('0x6')]=FreshdeskAccount;
\ No newline at end of file
index db1c5b2..a1200bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x535d=['serverUrl','Configurations','name','username','remoteUri'];(function(_0x2c98f5,_0x3505bd){var _0x1d5794=function(_0x4b511b){while(--_0x4b511b){_0x2c98f5['push'](_0x2c98f5['shift']());}};_0x1d5794(++_0x3505bd);}(_0x535d,0xe8));var _0xd535=function(_0x11b67b,_0x400cea){_0x11b67b=_0x11b67b-0x0;var _0x4ed0aa=_0x535d[_0x11b67b];return _0x4ed0aa;};'use strict';function FreshsalesAccount(_0x28de83){this['id']=_0x28de83['id']||0x0;this[_0xd535('0x0')]=_0x28de83['name']||'';this[_0xd535('0x1')]=_0x28de83[_0xd535('0x1')]||'';this['apiKey']=_0x28de83['token']||'';this[_0xd535('0x2')]=_0x28de83[_0xd535('0x2')]||'';this[_0xd535('0x3')]=_0x28de83[_0xd535('0x3')]||'';this[_0xd535('0x4')]=_0x28de83[_0xd535('0x4')]||{};}module['exports']=FreshsalesAccount;
\ No newline at end of file
+var _0x7412=['exports','username','apiKey','Configurations'];(function(_0xe4d6c6,_0x3bdbf2){var _0x3a8935=function(_0x131483){while(--_0x131483){_0xe4d6c6['push'](_0xe4d6c6['shift']());}};_0x3a8935(++_0x3bdbf2);}(_0x7412,0x161));var _0x2741=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x7412[_0x1da527];return _0x40fc7c;};'use strict';function FreshsalesAccount(_0x2c0b5d){this['id']=_0x2c0b5d['id']||0x0;this['name']=_0x2c0b5d['name']||'';this[_0x2741('0x0')]=_0x2c0b5d['username']||'';this[_0x2741('0x1')]=_0x2c0b5d['token']||'';this['remoteUri']=_0x2c0b5d['remoteUri']||'';this['serverUrl']=_0x2c0b5d['serverUrl']||'';this['Configurations']=_0x2c0b5d[_0x2741('0x2')]||{};}module[_0x2741('0x3')]=FreshsalesAccount;
\ No newline at end of file
index 9133db5..819122a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf1ed=['connectedlinenum','connectedlinename','context','exten','priority','holdtime','motionChannel','voice','routealias','mohtime','exports','inbound','uniqueid','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel'];(function(_0x3cb52a,_0x5a586d){var _0x4e6bab=function(_0xd38f5){while(--_0xd38f5){_0x3cb52a['push'](_0x3cb52a['shift']());}};_0x4e6bab(++_0x5a586d);}(_0xf1ed,0xc1));var _0xdf1e=function(_0xed517f,_0x3a57dd){_0xed517f=_0xed517f-0x0;var _0x4febde=_0xf1ed[_0xed517f];return _0x4febde;};'use strict';function QueueReport(){this['type']=_0xdf1e('0x0');this[_0xdf1e('0x1')]='';this['calleridnum']='';this[_0xdf1e('0x2')]='';this[_0xdf1e('0x3')]='';this[_0xdf1e('0x4')]=null;this[_0xdf1e('0x5')]=null;this[_0xdf1e('0x6')]=0x1;this[_0xdf1e('0x7')]=0x1;this[_0xdf1e('0x8')]=![];this['queuecallerabandonAt']=null;this[_0xdf1e('0x9')]=![];this[_0xdf1e('0xa')]=null;this[_0xdf1e('0xb')]=![];this[_0xdf1e('0xc')]=null;this[_0xdf1e('0xd')]=0x1;this[_0xdf1e('0xe')]='';this[_0xdf1e('0xf')]='';this[_0xdf1e('0x10')]='';this['accountcode']='';this[_0xdf1e('0x11')]='';this[_0xdf1e('0x12')]='';this[_0xdf1e('0x13')]='';this[_0xdf1e('0x14')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0xdf1e('0x15')]=_0xdf1e('0x16');this[_0xdf1e('0x17')]=null;this[_0xdf1e('0x18')]=0x0;this['variables']={};}module[_0xdf1e('0x19')]=QueueReport;
\ No newline at end of file
+var _0x964b=['exten','priority','holdtime','assigned','lastAssignedTo','motionChannel','routealias','mohtime','exports','type','inbound','uniqueid','calleridnum','queue','queuecallerleaveAt','count','queuecallerabandon','queuecallerabandonAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','context'];(function(_0x3efd98,_0x5a231a){var _0x3d99b7=function(_0x5d8a4e){while(--_0x5d8a4e){_0x3efd98['push'](_0x3efd98['shift']());}};_0x3d99b7(++_0x5a231a);}(_0x964b,0xe1));var _0xb964=function(_0x80f1c4,_0x26c78e){_0x80f1c4=_0x80f1c4-0x0;var _0x975c97=_0x964b[_0x80f1c4];return _0x975c97;};'use strict';function QueueReport(){this[_0xb964('0x0')]=_0xb964('0x1');this[_0xb964('0x2')]='';this[_0xb964('0x3')]='';this['calleridname']='';this[_0xb964('0x4')]='';this['queuecallerjoinAt']=null;this[_0xb964('0x5')]=null;this['position']=0x1;this[_0xb964('0x6')]=0x1;this[_0xb964('0x7')]=![];this[_0xb964('0x8')]=null;this['queuecallercomplete']=![];this['queuecallercompleteAt']=null;this[_0xb964('0x9')]=![];this[_0xb964('0xa')]=null;this[_0xb964('0xb')]=0x1;this[_0xb964('0xc')]='';this[_0xb964('0xd')]='';this['connectedlinename']='';this['accountcode']='';this[_0xb964('0xe')]='';this[_0xb964('0xf')]='';this[_0xb964('0x10')]='';this[_0xb964('0x11')]=0x0;this[_0xb964('0x12')]=![];this[_0xb964('0x13')]='';this[_0xb964('0x14')]='voice';this[_0xb964('0x15')]=null;this[_0xb964('0x16')]=0x0;this['variables']={};}module[_0xb964('0x17')]=QueueReport;
\ No newline at end of file
index 622af2a..82f9fa2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x36fe=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password','clientId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x36fe,0x127));var _0xe36f=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x36fe[_0x57486e];return _0x5f110b;};'use strict';function SalesforceAccount(_0x5b6718){this['id']=_0x5b6718['id']||0x0;this[_0xe36f('0x0')]=_0x5b6718[_0xe36f('0x0')]||'';this[_0xe36f('0x1')]=_0x5b6718[_0xe36f('0x1')]||'';this[_0xe36f('0x2')]=_0x5b6718[_0xe36f('0x2')]||'';this[_0xe36f('0x3')]=_0x5b6718[_0xe36f('0x3')]||'';this[_0xe36f('0x4')]=_0x5b6718[_0xe36f('0x4')]||'';this['clientSecret']=_0x5b6718[_0xe36f('0x5')]||'';this['securityToken']=_0x5b6718[_0xe36f('0x6')]||'';this[_0xe36f('0x7')]=_0x5b6718['type']||_0xe36f('0x8');this[_0xe36f('0x9')]=_0x5b6718['serverUrl']||'';this[_0xe36f('0xa')]=_0x5b6718[_0xe36f('0xa')]||{};}module[_0xe36f('0xb')]=SalesforceAccount;
\ No newline at end of file
+var _0x4697=['exports','username','remoteUri','password','clientId','clientSecret','securityToken','type','serverUrl','Configurations'];(function(_0x2885d1,_0x28495c){var _0x36c264=function(_0x35c3a4){while(--_0x35c3a4){_0x2885d1['push'](_0x2885d1['shift']());}};_0x36c264(++_0x28495c);}(_0x4697,0x1e1));var _0x7469=function(_0x1530d0,_0x45a508){_0x1530d0=_0x1530d0-0x0;var _0x307b10=_0x4697[_0x1530d0];return _0x307b10;};'use strict';function SalesforceAccount(_0x2eaa1d){this['id']=_0x2eaa1d['id']||0x0;this['name']=_0x2eaa1d['name']||'';this[_0x7469('0x0')]=_0x2eaa1d[_0x7469('0x0')]||'';this['remoteUri']=_0x2eaa1d[_0x7469('0x1')]||'';this[_0x7469('0x2')]=_0x2eaa1d[_0x7469('0x2')]||'';this[_0x7469('0x3')]=_0x2eaa1d['clientId']||'';this[_0x7469('0x4')]=_0x2eaa1d[_0x7469('0x4')]||'';this[_0x7469('0x5')]=_0x2eaa1d[_0x7469('0x5')]||'';this['type']=_0x2eaa1d[_0x7469('0x6')]||'integrationTab';this['serverUrl']=_0x2eaa1d[_0x7469('0x7')]||'';this[_0x7469('0x8')]=_0x2eaa1d['Configurations']||{};}module[_0x7469('0x9')]=SalesforceAccount;
\ No newline at end of file
index 9ecda16..fd8fe10 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x38e6=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x54a2e4,_0x1ff92c){var _0x4742d0=function(_0x147a6f){while(--_0x147a6f){_0x54a2e4['push'](_0x54a2e4['shift']());}};_0x4742d0(++_0x1ff92c);}(_0x38e6,0x15e));var _0x638e=function(_0x403a83,_0x218ba0){_0x403a83=_0x403a83-0x0;var _0xf0fd56=_0x38e6[_0x403a83];return _0xf0fd56;};'use strict';function ServicenowAccount(_0x4909ab){this['id']=_0x4909ab['id']||0x0;this[_0x638e('0x0')]=_0x4909ab['name']||'';this[_0x638e('0x1')]=_0x4909ab['username']||'';this[_0x638e('0x2')]=_0x4909ab[_0x638e('0x2')]||'';this[_0x638e('0x3')]=_0x4909ab['remoteUri']||'';this[_0x638e('0x4')]=_0x4909ab[_0x638e('0x4')]||'';this[_0x638e('0x5')]=_0x4909ab[_0x638e('0x5')]||{};}module[_0x638e('0x6')]=ServicenowAccount;
\ No newline at end of file
+var _0x25c6=['password','remoteUri','serverUrl','Configurations','name','username'];(function(_0x5830ec,_0x575cb7){var _0x2973c7=function(_0x2a12f9){while(--_0x2a12f9){_0x5830ec['push'](_0x5830ec['shift']());}};_0x2973c7(++_0x575cb7);}(_0x25c6,0x94));var _0x625c=function(_0x1b9e57,_0x11c35b){_0x1b9e57=_0x1b9e57-0x0;var _0x598efc=_0x25c6[_0x1b9e57];return _0x598efc;};'use strict';function ServicenowAccount(_0x109375){this['id']=_0x109375['id']||0x0;this['name']=_0x109375[_0x625c('0x0')]||'';this[_0x625c('0x1')]=_0x109375[_0x625c('0x1')]||'';this[_0x625c('0x2')]=_0x109375[_0x625c('0x2')]||'';this[_0x625c('0x3')]=_0x109375[_0x625c('0x3')]||'';this['serverUrl']=_0x109375[_0x625c('0x4')]||'';this[_0x625c('0x5')]=_0x109375[_0x625c('0x5')]||{};}module['exports']=ServicenowAccount;
\ No newline at end of file
index c8813d2..920686b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb052=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x4da0cd,_0x1b8186){var _0x28b893=function(_0x129e34){while(--_0x129e34){_0x4da0cd['push'](_0x4da0cd['shift']());}};_0x28b893(++_0x1b8186);}(_0xb052,0x19a));var _0x2b05=function(_0x4c9f6a,_0xcb2cb2){_0x4c9f6a=_0x4c9f6a-0x0;var _0x5df5b9=_0xb052[_0x4c9f6a];return _0x5df5b9;};'use strict';function SugarcrmAccount(_0x41a6fb){this['id']=_0x41a6fb['id']||0x0;this['name']=_0x41a6fb[_0x2b05('0x0')]||'';this[_0x2b05('0x1')]=_0x41a6fb[_0x2b05('0x1')]||'';this[_0x2b05('0x2')]=_0x41a6fb[_0x2b05('0x2')]||'';this[_0x2b05('0x3')]=_0x41a6fb[_0x2b05('0x3')]||'';this[_0x2b05('0x4')]=_0x41a6fb[_0x2b05('0x4')]||'';this[_0x2b05('0x5')]=_0x41a6fb[_0x2b05('0x5')]||{};}module[_0x2b05('0x6')]=SugarcrmAccount;
\ No newline at end of file
+var _0xd7b9=['remoteUri','serverUrl','Configurations','name','username','password'];(function(_0x11b0d8,_0x2f9792){var _0x50d3f3=function(_0x4d737e){while(--_0x4d737e){_0x11b0d8['push'](_0x11b0d8['shift']());}};_0x50d3f3(++_0x2f9792);}(_0xd7b9,0x11d));var _0x9d7b=function(_0x58b1fe,_0x14831e){_0x58b1fe=_0x58b1fe-0x0;var _0x552550=_0xd7b9[_0x58b1fe];return _0x552550;};'use strict';function SugarcrmAccount(_0x53f97e){this['id']=_0x53f97e['id']||0x0;this[_0x9d7b('0x0')]=_0x53f97e[_0x9d7b('0x0')]||'';this[_0x9d7b('0x1')]=_0x53f97e[_0x9d7b('0x1')]||'';this[_0x9d7b('0x2')]=_0x53f97e['password']||'';this[_0x9d7b('0x3')]=_0x53f97e[_0x9d7b('0x3')]||'';this[_0x9d7b('0x4')]=_0x53f97e['serverUrl']||'';this[_0x9d7b('0x5')]=_0x53f97e[_0x9d7b('0x5')]||{};}module['exports']=SugarcrmAccount;
\ No newline at end of file
index 217fd2b..4d6fbe5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7582=['unknown','address','name','accountcode','state','stateTime','status'];(function(_0x273d90,_0x36176e){var _0x152afd=function(_0x5aefc5){while(--_0x5aefc5){_0x273d90['push'](_0x273d90['shift']());}};_0x152afd(++_0x36176e);}(_0x7582,0x167));var _0x2758=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x7582[_0xefd519];return _0x4bb882;};'use strict';function Telephone(_0xb20872){this['id']=_0xb20872['id']||0x0;this[_0x2758('0x0')]=_0xb20872[_0x2758('0x0')]||'';this[_0x2758('0x1')]=_0xb20872['accountcode']||'';this[_0x2758('0x2')]='unknown';this[_0x2758('0x3')]=0x0;this[_0x2758('0x4')]=_0x2758('0x5');this[_0x2758('0x6')]='';}module['exports']=Telephone;
\ No newline at end of file
+var _0x4cba=['exports','name','accountcode','state','unknown','stateTime','status'];(function(_0x570d7e,_0xe3075b){var _0x4879ca=function(_0x2d02d7){while(--_0x2d02d7){_0x570d7e['push'](_0x570d7e['shift']());}};_0x4879ca(++_0xe3075b);}(_0x4cba,0x119));var _0xa4cb=function(_0x47a7ce,_0x349b47){_0x47a7ce=_0x47a7ce-0x0;var _0x298f39=_0x4cba[_0x47a7ce];return _0x298f39;};'use strict';function Telephone(_0x107033){this['id']=_0x107033['id']||0x0;this[_0xa4cb('0x0')]=_0x107033[_0xa4cb('0x0')]||'';this['accountcode']=_0x107033[_0xa4cb('0x1')]||'';this[_0xa4cb('0x2')]=_0xa4cb('0x3');this[_0xa4cb('0x4')]=0x0;this[_0xa4cb('0x5')]=_0xa4cb('0x3');this['address']='';}module[_0xa4cb('0x6')]=Telephone;
\ No newline at end of file
index 1dcc165..7f1c6d1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['exports','name'];(function(_0x462303,_0x2b4baa){var _0x1a6f6a=function(_0x361dac){while(--_0x361dac){_0x462303['push'](_0x462303['shift']());}};_0x1a6f6a(++_0x2b4baa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template;
\ No newline at end of file
+var _0xb10b=['name','html'];(function(_0x414682,_0x560738){var _0x3d2eb6=function(_0x3fc0bf){while(--_0x3fc0bf){_0x414682['push'](_0x414682['shift']());}};_0x3d2eb6(++_0x560738);}(_0xb10b,0x12a));var _0xbb10=function(_0x2aaa60,_0x22258f){_0x2aaa60=_0x2aaa60-0x0;var _0x2e3fa5=_0xb10b[_0x2aaa60];return _0x2e3fa5;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template;
\ No newline at end of file
index f0d9491..11f6dc6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x2acf61,_0xea3015){var _0x327165=function(_0x1c0945){while(--_0x1c0945){_0x2acf61['push'](_0x2acf61['shift']());}};_0x327165(++_0xea3015);}(_0xda3f,0xec));var _0xfda3=function(_0x3410e8,_0x5ba7ac){_0x3410e8=_0x3410e8-0x0;var _0x43b05a=_0xda3f[_0x3410e8];return _0x43b05a;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger;
\ No newline at end of file
+var _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0xefc494,_0x214aa7){var _0x1236f9=function(_0x5b0793){while(--_0x5b0793){_0xefc494['push'](_0xefc494['shift']());}};_0x1236f9(++_0x214aa7);}(_0x4fc2,0x111));var _0x24fc=function(_0x5a7da7,_0x4f132a){_0x5a7da7=_0x5a7da7-0x0;var _0x14459e=_0x4fc2[_0x5a7da7];return _0x14459e;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger;
\ No newline at end of file
index 31e1b59..d86e20a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd1cc=['address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry','indexOf','split','port','domain','domainport','refresh','stateRegistry','registrationtime'];(function(_0x44c886,_0x256672){var _0x366d38=function(_0x318dca){while(--_0x318dca){_0x44c886['push'](_0x44c886['shift']());}};_0x366d38(++_0x256672);}(_0xd1cc,0xdb));var _0xcd1c=function(_0x59cd8b,_0x5ee4b1){_0x59cd8b=_0x59cd8b-0x0;var _0x38f6c5=_0xd1cc[_0x59cd8b];return _0x38f6c5;};'use strict';function Trunk(_0x3271ae){this['id']=_0x3271ae['id']||0x0;this[_0xcd1c('0x0')]=_0x3271ae[_0xcd1c('0x0')]||![];this[_0xcd1c('0x1')]=_0x3271ae[_0xcd1c('0x1')]||'';this[_0xcd1c('0x2')]=_0xcd1c('0x3');this[_0xcd1c('0x4')]=0x0;this[_0xcd1c('0x5')]=_0xcd1c('0x3');this[_0xcd1c('0x6')]=_0x3271ae[_0xcd1c('0x6')]&&_0x3271ae[_0xcd1c('0x6')][_0xcd1c('0x7')](':')?_0x3271ae['registry'][_0xcd1c('0x8')](':')[0x0]:'';this['host']='';this[_0xcd1c('0x9')]='';this[_0xcd1c('0xa')]='';this[_0xcd1c('0xb')]='';this[_0xcd1c('0xc')]='';this[_0xcd1c('0xd')]=_0xcd1c('0x3');this[_0xcd1c('0xe')]='';this[_0xcd1c('0xf')]='';this['defaultuser']=_0x3271ae[_0xcd1c('0x10')]||'';}module[_0xcd1c('0x11')]=Trunk;
\ No newline at end of file
+var _0x7195=['stateRegistry','address','exports','active','name','unknown','stateTime','registry','indexOf','port','domain','domainport','refresh'];(function(_0x42cf52,_0x43dad0){var _0x1e1c7e=function(_0x347fca){while(--_0x347fca){_0x42cf52['push'](_0x42cf52['shift']());}};_0x1e1c7e(++_0x43dad0);}(_0x7195,0x13b));var _0x5719=function(_0x16f3ca,_0x2ee349){_0x16f3ca=_0x16f3ca-0x0;var _0xa67245=_0x7195[_0x16f3ca];return _0xa67245;};'use strict';function Trunk(_0x69dcf0){this['id']=_0x69dcf0['id']||0x0;this[_0x5719('0x0')]=_0x69dcf0['active']||![];this[_0x5719('0x1')]=_0x69dcf0[_0x5719('0x1')]||'';this['state']=_0x5719('0x2');this[_0x5719('0x3')]=0x0;this['status']=_0x5719('0x2');this[_0x5719('0x4')]=_0x69dcf0[_0x5719('0x4')]&&_0x69dcf0[_0x5719('0x4')][_0x5719('0x5')](':')?_0x69dcf0['registry']['split'](':')[0x0]:'';this['host']='';this[_0x5719('0x6')]='';this[_0x5719('0x7')]='';this[_0x5719('0x8')]='';this[_0x5719('0x9')]='';this[_0x5719('0xa')]=_0x5719('0x2');this['registrationtime']='';this[_0x5719('0xb')]='';this['defaultuser']=_0x69dcf0['defaultuser']||'';}module[_0x5719('0xc')]=Trunk;
\ No newline at end of file
index ceaf0eb..9e907ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe251=['exten','none','mandatoryDisposition','exports'];(function(_0x138c54,_0x1568a7){var _0x4c2ed1=function(_0x24c793){while(--_0x24c793){_0x138c54['push'](_0x138c54['shift']());}};_0x4c2ed1(++_0x1568a7);}(_0xe251,0x94));var _0x1e25=function(_0x4643da,_0x5939f1){_0x4643da=_0x4643da-0x0;var _0x2f7b89=_0xe251[_0x4643da];return _0x2f7b89;};'use strict';function voiceExtension(_0x89296c){this['id']=_0x89296c['id']||0x0;this['exten']=_0x89296c[_0x1e25('0x0')]||'';this['recordingFormat']=_0x89296c['recordingFormat']||_0x1e25('0x1');this[_0x1e25('0x2')]=_0x89296c[_0x1e25('0x2')]||![];}module[_0x1e25('0x3')]=voiceExtension;
\ No newline at end of file
+var _0x75af=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x1e3c02,_0x5c07a2){var _0x4d26d7=function(_0x367ed9){while(--_0x367ed9){_0x1e3c02['push'](_0x1e3c02['shift']());}};_0x4d26d7(++_0x5c07a2);}(_0x75af,0xc5));var _0xf75a=function(_0x134861,_0x348061){_0x134861=_0x134861-0x0;var _0x1dccfe=_0x75af[_0x134861];return _0x1dccfe;};'use strict';function voiceExtension(_0x343bcc){this['id']=_0x343bcc['id']||0x0;this[_0xf75a('0x0')]=_0x343bcc['exten']||'';this[_0xf75a('0x1')]=_0x343bcc['recordingFormat']||_0xf75a('0x2');this['mandatoryDisposition']=_0x343bcc[_0xf75a('0x3')]||![];}module[_0xf75a('0x4')]=voiceExtension;
\ No newline at end of file
index 7229132..c549faa 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5ff9=['outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','ringall','rrordered','wrandom','name','monitor_format','type','waiting','total','sumDuration','sumHoldTime','sumBillable','abandoned','available','busy','inUse','invalid','loggedIn','paused','ringing','ringInUse','talking','unknown','acw','acwTimeout','sendMessageOneNotActive','message','statusMessage','temp','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0x5ff9,0xa0));var _0x95ff=function(_0x862adc,_0x3da4a7){_0x862adc=_0x862adc-0x0;var _0x5255e5=_0x5ff9[_0x862adc];return _0x5255e5;};'use strict';var monitorFormat={'wav':_0x95ff('0x0'),'wav49':_0x95ff('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0x95ff('0x2'),'leastrecent':_0x95ff('0x3'),'linear':'linear','random':'random','ringall':_0x95ff('0x4'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x95ff('0x5'),'wrandom':_0x95ff('0x6')};function VoiceQueue(_0x4d37f2){this['id']=_0x4d37f2['id']||0x0;this[_0x95ff('0x7')]=_0x4d37f2['name']||'';this[_0x95ff('0x8')]=_0x4d37f2[_0x95ff('0x8')]||'';this['type']=_0x4d37f2[_0x95ff('0x9')]||'inbound';this[_0x95ff('0xa')]=0x0;this[_0x95ff('0xb')]=0x0;this['answered']=0x0;this[_0x95ff('0xc')]=0x0;this[_0x95ff('0xd')]=0x0;this[_0x95ff('0xe')]=0x0;this['unmanaged']=0x0;this[_0x95ff('0xf')]=0x0;this[_0x95ff('0x10')]=0x0;this[_0x95ff('0x11')]=0x0;this[_0x95ff('0x12')]=0x0;this[_0x95ff('0x13')]=0x0;this[_0x95ff('0x14')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x95ff('0x15')]=0x0;this[_0x95ff('0x16')]=0x0;this[_0x95ff('0x17')]=0x0;this[_0x95ff('0x18')]=0x0;this['unavailable']=0x0;this[_0x95ff('0x19')]=0x0;this[_0x95ff('0x1a')]=_0x4d37f2['acw']||![];this[_0x95ff('0x1b')]=_0x4d37f2[_0x95ff('0x1b')]||0xa;this['autopause']=_0x4d37f2['autopause']||'no';this[_0x95ff('0x1c')]=!![];this[_0x95ff('0x1d')]='';this[_0x95ff('0x1e')]='';this['originated']=0x0;this[_0x95ff('0x1f')]=0x0;this['dialTimezone']=_0x4d37f2['dialTimezone']||null;this[_0x95ff('0x20')]=_0x4d37f2[_0x95ff('0x20')]?_0x4d37f2[_0x95ff('0x20')]:null;this[_0x95ff('0x21')]=_0x4d37f2['dialActive'];this[_0x95ff('0x22')]=_0x4d37f2[_0x95ff('0x22')]||_0x95ff('0x23');this[_0x95ff('0x24')]=_0x4d37f2[_0x95ff('0x24')]||0x0;this['dialLimitQueue']=_0x4d37f2[_0x95ff('0x25')]||0x0;this[_0x95ff('0x26')]=_0x4d37f2[_0x95ff('0x26')]||0x1;this[_0x95ff('0x27')]=_0x4d37f2[_0x95ff('0x27')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x4d37f2[_0x95ff('0x28')]||0.03;this[_0x95ff('0x29')]=_0x4d37f2[_0x95ff('0x29')]||0x258;this[_0x95ff('0x2a')]=_0x4d37f2['dialOriginateCallerIdName']||_0x95ff('0x2b');this[_0x95ff('0x2c')]=_0x4d37f2['dialOriginateCallerIdNumber']||'anonymous';this[_0x95ff('0x2d')]=_0x4d37f2['dialOriginateTimeout']||0x1e;this[_0x95ff('0x2e')]=_0x4d37f2[_0x95ff('0x2e')]||_0x95ff('0x2f');this[_0x95ff('0x30')]=_0x4d37f2[_0x95ff('0x30')]||0x3;this[_0x95ff('0x31')]=_0x4d37f2['dialQueueProject']||undefined;this[_0x95ff('0x32')]=_0x4d37f2[_0x95ff('0x32')]||0x3;this[_0x95ff('0x33')]=_0x4d37f2[_0x95ff('0x33')]||0x96;this[_0x95ff('0x34')]=_0x4d37f2[_0x95ff('0x34')]||0x3;this[_0x95ff('0x35')]=_0x4d37f2[_0x95ff('0x35')]||0x96;this[_0x95ff('0x36')]=_0x4d37f2[_0x95ff('0x36')]||0x3;this[_0x95ff('0x37')]=_0x4d37f2[_0x95ff('0x37')]||0x96;this[_0x95ff('0x38')]=_0x4d37f2[_0x95ff('0x38')]||0x3;this[_0x95ff('0x39')]=_0x4d37f2['dialNoSuchNumberRetryFrequency']||0x96;this[_0x95ff('0x3a')]=_0x4d37f2[_0x95ff('0x3a')]||0x3;this[_0x95ff('0x3b')]=_0x4d37f2[_0x95ff('0x3b')]||0x96;this[_0x95ff('0x3c')]=_0x4d37f2[_0x95ff('0x3c')]||0x3;this[_0x95ff('0x3d')]=_0x4d37f2['dialAbandonedRetryFrequency']||0x96;this[_0x95ff('0x3e')]=_0x4d37f2[_0x95ff('0x3e')]||0x3;this[_0x95ff('0x3f')]=_0x4d37f2[_0x95ff('0x3f')]||0x96;this[_0x95ff('0x40')]=_0x4d37f2[_0x95ff('0x40')]||0x3;this['dialAgentRejectRetryFrequency']=_0x4d37f2[_0x95ff('0x41')]||0x96;this[_0x95ff('0x42')]=_0x4d37f2[_0x95ff('0x42')]||0x3;this[_0x95ff('0x43')]=_0x4d37f2[_0x95ff('0x43')]||0x4;this[_0x95ff('0x44')]=_0x4d37f2[_0x95ff('0x44')]?_0x4d37f2['Trunk']:undefined;this[_0x95ff('0x45')]=_0x4d37f2[_0x95ff('0x45')]?_0x4d37f2['TrunkBackup']:undefined;this[_0x95ff('0x46')]=_0x4d37f2[_0x95ff('0x46')]||undefined;this[_0x95ff('0x47')]=_0x4d37f2[_0x95ff('0x47')]?_0x4d37f2[_0x95ff('0x47')]:undefined;this[_0x95ff('0x48')]=_0x4d37f2[_0x95ff('0x48')]||_0x95ff('0x49');this[_0x95ff('0x4a')]=_0x4d37f2['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x95ff('0x4b')]=_0x4d37f2[_0x95ff('0x4b')]||undefined;this[_0x95ff('0x4c')]=strategy[_0x4d37f2[_0x95ff('0x4c')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x4d37f2[_0x95ff('0x4d')]||![];this[_0x95ff('0x4e')]=_0x4d37f2[_0x95ff('0x4e')];this[_0x95ff('0x4f')]=_0x4d37f2['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4d37f2[_0x95ff('0x50')];this['dialAMDTotalAnalysisTime']=_0x4d37f2[_0x95ff('0x51')];this[_0x95ff('0x52')]=_0x4d37f2[_0x95ff('0x52')];this[_0x95ff('0x53')]=_0x4d37f2[_0x95ff('0x53')];this[_0x95ff('0x54')]=_0x4d37f2[_0x95ff('0x54')];this[_0x95ff('0x55')]=_0x4d37f2[_0x95ff('0x55')];this[_0x95ff('0x56')]=_0x4d37f2[_0x95ff('0x56')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x95ff('0x57')]=_0x4d37f2[_0x95ff('0x57')];this[_0x95ff('0x58')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0x95ff('0x59')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x95ff('0x5a')]=0x0;this[_0x95ff('0x5b')]=0x0;this[_0x95ff('0x5c')]=0x0;this[_0x95ff('0x5d')]=0x0;this[_0x95ff('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x95ff('0x5f')]=0x0;this['outboundReCallsDay']=0x0;this[_0x95ff('0x60')]=0x0;this[_0x95ff('0x61')]=undefined;this['startPredictive']=undefined;this[_0x95ff('0x62')]=undefined;this[_0x95ff('0x63')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x95ff('0x64')]=0x0;this[_0x95ff('0x65')]=0x0;this[_0x95ff('0x66')]=0x0;this[_0x95ff('0x67')]=0x0;this[_0x95ff('0x68')]=0x0;this[_0x95ff('0x69')]=0x0;this[_0x95ff('0x6a')]=0x0;this[_0x95ff('0x6b')]=_0x4d37f2['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x95ff('0x6c')]=_0x4d37f2[_0x95ff('0x6d')]||0xa;this[_0x95ff('0x6e')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x95ff('0x6f')]=0x1;this[_0x95ff('0x70')]=0x0;this[_0x95ff('0x71')]=0x0;this[_0x95ff('0x72')]=0x0;this['erlangBusyFactor']=0x0;this[_0x95ff('0x73')]=_0x4d37f2[_0x95ff('0x73')]||0x1e;this[_0x95ff('0x74')]=_0x4d37f2[_0x95ff('0x74')]||![];this[_0x95ff('0x75')]=!!_0x4d37f2[_0x95ff('0x75')]||![];this['dialPreviewRecallmeReminder']=!!_0x4d37f2[_0x95ff('0x76')]||![];this['dialQueueProject2']=_0x4d37f2[_0x95ff('0x77')]||undefined;this[_0x95ff('0x78')]=_0x4d37f2[_0x95ff('0x78')]||![];this['dialAgiAfterHangupAgent']=_0x4d37f2[_0x95ff('0x79')]||![];this[_0x95ff('0x8')]=monitorFormat[_0x4d37f2['monitor_format']]?monitorFormat[_0x4d37f2[_0x95ff('0x8')]]:undefined;this['mandatoryDisposition']=_0x4d37f2[_0x95ff('0x7a')]||![];this[_0x95ff('0x7b')]=_0x4d37f2[_0x95ff('0x7b')]?_0x4d37f2[_0x95ff('0x7b')]:undefined;this[_0x95ff('0x7c')]=![];}module[_0x95ff('0x7d')]=VoiceQueue;
\ No newline at end of file
+var _0x872f=['dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','roundrobin','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','notInUse','paused','ringInUse','talking','unavailable','unknown','acw','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0x872f,0x143));var _0xf872=function(_0x19a173,_0x413f3a){_0x19a173=_0x19a173-0x0;var _0x197b3c=_0x872f[_0x19a173];return _0x197b3c;};'use strict';var monitorFormat={'wav':_0xf872('0x0'),'wav49':_0xf872('0x1'),'gsm':_0xf872('0x2')};var strategy={'fewestcalls':_0xf872('0x3'),'leastrecent':_0xf872('0x4'),'linear':_0xf872('0x5'),'random':_0xf872('0x6'),'ringall':_0xf872('0x7'),'rr':_0xf872('0x8'),'rrmemory':_0xf872('0x9'),'rrordered':'rrordered','wrandom':_0xf872('0xa')};function VoiceQueue(_0x51e579){this['id']=_0x51e579['id']||0x0;this[_0xf872('0xb')]=_0x51e579['name']||'';this['monitor_format']=_0x51e579[_0xf872('0xc')]||'';this[_0xf872('0xd')]=_0x51e579[_0xf872('0xd')]||_0xf872('0xe');this[_0xf872('0xf')]=0x0;this['total']=0x0;this[_0xf872('0x10')]=0x0;this[_0xf872('0x11')]=0x0;this[_0xf872('0x12')]=0x0;this[_0xf872('0x13')]=0x0;this[_0xf872('0x14')]=0x0;this[_0xf872('0x15')]=0x0;this[_0xf872('0x16')]=0x0;this[_0xf872('0x17')]=0x0;this[_0xf872('0x18')]=0x0;this[_0xf872('0x19')]=0x0;this[_0xf872('0x1a')]=0x0;this[_0xf872('0x1b')]=0x0;this['onHold']=0x0;this[_0xf872('0x1c')]=0x0;this['ringing']=0x0;this[_0xf872('0x1d')]=0x0;this[_0xf872('0x1e')]=0x0;this[_0xf872('0x1f')]=0x0;this[_0xf872('0x20')]=0x0;this['acw']=_0x51e579[_0xf872('0x21')]||![];this['acwTimeout']=_0x51e579['acwTimeout']||0xa;this[_0xf872('0x22')]=_0x51e579[_0xf872('0x22')]||'no';this[_0xf872('0x23')]=!![];this[_0xf872('0x24')]='';this[_0xf872('0x25')]='';this[_0xf872('0x26')]=0x0;this[_0xf872('0x27')]=0x0;this[_0xf872('0x28')]=_0x51e579[_0xf872('0x28')]||null;this[_0xf872('0x29')]=_0x51e579[_0xf872('0x29')]?_0x51e579[_0xf872('0x29')]:null;this['dialActive']=_0x51e579['dialActive'];this[_0xf872('0x2a')]=_0x51e579[_0xf872('0x2a')]||_0xf872('0x2b');this['dialLimitChannel']=_0x51e579[_0xf872('0x2c')]||0x0;this['dialLimitQueue']=_0x51e579[_0xf872('0x2d')]||0x0;this[_0xf872('0x2e')]=_0x51e579[_0xf872('0x2e')]||0x1;this[_0xf872('0x2f')]=_0x51e579[_0xf872('0x2f')]||_0xf872('0x30');this[_0xf872('0x31')]=_0x51e579[_0xf872('0x31')]||0.03;this['dialPredictiveInterval']=_0x51e579[_0xf872('0x32')]||0x258;this[_0xf872('0x33')]=_0x51e579[_0xf872('0x33')]||_0xf872('0x34');this[_0xf872('0x35')]=_0x51e579[_0xf872('0x35')]||_0xf872('0x34');this['dialOriginateTimeout']=_0x51e579[_0xf872('0x36')]||0x1e;this['dialQueueOptions']=_0x51e579[_0xf872('0x37')]||_0xf872('0x38');this[_0xf872('0x39')]=_0x51e579[_0xf872('0x39')]||0x3;this[_0xf872('0x3a')]=_0x51e579[_0xf872('0x3a')]||undefined;this['dialCongestionMaxRetry']=_0x51e579['dialCongestionMaxRetry']||0x3;this[_0xf872('0x3b')]=_0x51e579[_0xf872('0x3b')]||0x96;this[_0xf872('0x3c')]=_0x51e579[_0xf872('0x3c')]||0x3;this[_0xf872('0x3d')]=_0x51e579[_0xf872('0x3d')]||0x96;this['dialNoAnswerMaxRetry']=_0x51e579[_0xf872('0x3e')]||0x3;this['dialNoAnswerRetryFrequency']=_0x51e579[_0xf872('0x3f')]||0x96;this[_0xf872('0x40')]=_0x51e579[_0xf872('0x40')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x51e579[_0xf872('0x41')]||0x96;this['dialDropMaxRetry']=_0x51e579[_0xf872('0x42')]||0x3;this[_0xf872('0x43')]=_0x51e579[_0xf872('0x43')]||0x96;this[_0xf872('0x44')]=_0x51e579['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x51e579[_0xf872('0x45')]||0x96;this['dialMachineMaxRetry']=_0x51e579[_0xf872('0x46')]||0x3;this[_0xf872('0x47')]=_0x51e579[_0xf872('0x47')]||0x96;this[_0xf872('0x48')]=_0x51e579['dialAgentRejectMaxRetry']||0x3;this[_0xf872('0x49')]=_0x51e579[_0xf872('0x49')]||0x96;this['callAdditionalPhoneAfterMin']=_0x51e579['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x51e579[_0xf872('0x4a')]||0x4;this[_0xf872('0x4b')]=_0x51e579[_0xf872('0x4b')]?_0x51e579[_0xf872('0x4b')]:undefined;this[_0xf872('0x4c')]=_0x51e579[_0xf872('0x4c')]?_0x51e579['TrunkBackup']:undefined;this[_0xf872('0x4d')]=_0x51e579[_0xf872('0x4d')]||undefined;this[_0xf872('0x4e')]=_0x51e579[_0xf872('0x4e')]?_0x51e579['Interval']:undefined;this[_0xf872('0x4f')]=_0x51e579[_0xf872('0x4f')]||'DESC';this[_0xf872('0x50')]=_0x51e579[_0xf872('0x50')]||undefined;this[_0xf872('0x51')]=_0x51e579[_0xf872('0x51')]||undefined;this[_0xf872('0x52')]=strategy[_0x51e579[_0xf872('0x52')]];this[_0xf872('0x53')]=!![];this[_0xf872('0x54')]=_0x51e579[_0xf872('0x54')]||![];this[_0xf872('0x55')]=_0x51e579['dialAMDInitialSilence'];this[_0xf872('0x56')]=_0x51e579[_0xf872('0x56')];this[_0xf872('0x57')]=_0x51e579['dialAMDAfterGreetingSilence'];this[_0xf872('0x58')]=_0x51e579['dialAMDTotalAnalysisTime'];this[_0xf872('0x59')]=_0x51e579[_0xf872('0x59')];this[_0xf872('0x5a')]=_0x51e579[_0xf872('0x5a')];this['dialAMDMaximumNumberOfWords']=_0x51e579[_0xf872('0x5b')];this[_0xf872('0x5c')]=_0x51e579['dialAMDSilenceThreshold'];this[_0xf872('0x5d')]=_0x51e579[_0xf872('0x5d')];this[_0xf872('0x5e')]=0x0;this[_0xf872('0x5f')]=0x0;this['timeout']=_0x51e579[_0xf872('0x60')];this[_0xf872('0x61')]=0x0;this[_0xf872('0x62')]=0x0;this[_0xf872('0x63')]=0x0;this[_0xf872('0x64')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xf872('0x65')]=0x0;this[_0xf872('0x66')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xf872('0x67')]=0x0;this[_0xf872('0x68')]=0x0;this[_0xf872('0x69')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xf872('0x6a')]=0x0;this[_0xf872('0x6b')]=0x0;this[_0xf872('0x6c')]=undefined;this[_0xf872('0x6d')]=undefined;this[_0xf872('0x6e')]=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0xf872('0x6f')]=0x0;this[_0xf872('0x70')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xf872('0x71')]=0x0;this[_0xf872('0x72')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xf872('0x73')]=0x0;this[_0xf872('0x74')]=_0x51e579[_0xf872('0x75')]||0x14;this['predictiveIntervalMinThreshold']=_0x51e579[_0xf872('0x75')]||0xa;this[_0xf872('0x76')]=0x0;this[_0xf872('0x77')]=0x0;this[_0xf872('0x78')]=0x1;this[_0xf872('0x79')]=0x0;this[_0xf872('0x7a')]=0x0;this[_0xf872('0x7b')]=0x0;this[_0xf872('0x7c')]=0x0;this['dialRecallMeTimeout']=_0x51e579[_0xf872('0x7d')]||0x1e;this[_0xf872('0x7e')]=_0x51e579['dialRecallInQueue']||![];this[_0xf872('0x7f')]=!!_0x51e579[_0xf872('0x7f')]||![];this[_0xf872('0x80')]=!!_0x51e579[_0xf872('0x80')]||![];this[_0xf872('0x81')]=_0x51e579['dialQueueProject2']||undefined;this[_0xf872('0x82')]=_0x51e579[_0xf872('0x82')]||![];this[_0xf872('0x83')]=_0x51e579[_0xf872('0x83')]||![];this['monitor_format']=monitorFormat[_0x51e579[_0xf872('0xc')]]?monitorFormat[_0x51e579[_0xf872('0xc')]]:undefined;this[_0xf872('0x84')]=_0x51e579[_0xf872('0x84')]||![];this['mandatoryDispositionPause']=_0x51e579[_0xf872('0x85')]?_0x51e579[_0xf872('0x85')]:undefined;this[_0xf872('0x86')]=![];}module[_0xf872('0x87')]=VoiceQueue;
\ No newline at end of file
index f807fcd..7a6391f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8ca9=['outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','incall','status','booked','keys','queue','dialer','exten','some','compareToOutboundQueue','exports','available','loggedIn','loggedInDb','paused','ringing','talking','waiting','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay'];(function(_0x4221b2,_0x113a40){var _0x2a3538=function(_0x57ea72){while(--_0x57ea72){_0x4221b2['push'](_0x4221b2['shift']());}};_0x2a3538(++_0x113a40);}(_0x8ca9,0x9c));var _0x98ca=function(_0x4ca245,_0x13d70c){_0x4ca245=_0x4ca245-0x0;var _0x5b40df=_0x8ca9[_0x4ca245];return _0x5b40df;};'use strict';var INBOUND_COUNTERS=[_0x98ca('0x0'),_0x98ca('0x1'),_0x98ca('0x2'),_0x98ca('0x3'),_0x98ca('0x4'),_0x98ca('0x5'),_0x98ca('0x6')];var OUTBOUND_COUNTERS=['available','answered',_0x98ca('0x7'),'loggedIn',_0x98ca('0x2'),'originated',_0x98ca('0x8'),_0x98ca('0x9'),_0x98ca('0xa'),_0x98ca('0xb'),_0x98ca('0xc'),_0x98ca('0xd'),_0x98ca('0xe'),_0x98ca('0xf'),_0x98ca('0x10'),_0x98ca('0x11'),_0x98ca('0x3'),_0x98ca('0x12'),_0x98ca('0x5'),_0x98ca('0x13'),_0x98ca('0x14'),_0x98ca('0x15'),_0x98ca('0x6')];function VoiceQueueSummary(_0x17ee87){this['id']=_0x17ee87['id'];this['name']=_0x17ee87[_0x98ca('0x16')];this[_0x98ca('0x17')]=_0x17ee87[_0x98ca('0x17')];this[_0x98ca('0x18')]=_0x17ee87['abandoned']||0x0;this[_0x98ca('0x19')]=_0x17ee87[_0x98ca('0x19')]||0x0;this[_0x98ca('0x0')]=_0x17ee87[_0x98ca('0x0')]||0x0;this[_0x98ca('0x1a')]=_0x17ee87[_0x98ca('0x1a')]||0x0;this[_0x98ca('0x7')]=_0x17ee87['inUse']||0x0;this[_0x98ca('0x1b')]=_0x17ee87[_0x98ca('0x1b')]||0x0;this[_0x98ca('0x1')]=_0x17ee87[_0x98ca('0x1')]||0x0;this['loggedInDb']=_0x17ee87[_0x98ca('0x2')]||0x0;this[_0x98ca('0x1c')]=_0x17ee87[_0x98ca('0x1c')]||0x0;this[_0x98ca('0x1d')]=_0x17ee87[_0x98ca('0x1d')]||0x0;this[_0x98ca('0x3')]=_0x17ee87[_0x98ca('0x3')]||0x0;this[_0x98ca('0x4')]=_0x17ee87[_0x98ca('0x4')]||0x0;this[_0x98ca('0x1e')]=_0x17ee87[_0x98ca('0x1e')];this['sumBillable']=_0x17ee87[_0x98ca('0x13')];this['sumDuration']=_0x17ee87[_0x98ca('0x14')];this[_0x98ca('0x1f')]=_0x17ee87['sumHoldTime']||0x0;this['talking']=_0x17ee87[_0x98ca('0x5')]||0x0;this[_0x98ca('0x15')]=_0x17ee87[_0x98ca('0x15')]||0x0;this['type']=_0x17ee87[_0x98ca('0x20')];this[_0x98ca('0x21')]=_0x17ee87['unavailable']||0x0;this[_0x98ca('0x22')]=_0x17ee87['unknown']||0x0;this[_0x98ca('0x23')]=_0x17ee87[_0x98ca('0x23')]||0x0;this[_0x98ca('0x6')]=_0x17ee87[_0x98ca('0x6')]||0x0;if(_0x17ee87[_0x98ca('0x20')]===_0x98ca('0x24')){this[_0x98ca('0x12')]=_0x17ee87['pTalking']||0x0;this[_0x98ca('0x25')]=_0x17ee87['dialActive'];this[_0x98ca('0x26')]=_0x17ee87[_0x98ca('0x26')];this['dialOriginateCallerIdName']=_0x17ee87[_0x98ca('0x27')];this['dialOriginateCallerIdNumber']=_0x17ee87[_0x98ca('0x28')];this['dialOriginateTimeout']=_0x17ee87['dialOriginateTimeout'];this[_0x98ca('0x29')]=_0x17ee87['dialPrefix'];this[_0x98ca('0x2a')]=_0x17ee87[_0x98ca('0x2a')];this[_0x98ca('0x2b')]=_0x17ee87[_0x98ca('0x2b')];this[_0x98ca('0x9')]=_0x17ee87[_0x98ca('0x9')];this[_0x98ca('0xa')]=_0x17ee87[_0x98ca('0xa')];this[_0x98ca('0xb')]=_0x17ee87['outboundBusyCallsDay'];this[_0x98ca('0xc')]=_0x17ee87['outboundCongestionCallsDay'];this[_0x98ca('0x2c')]=_0x17ee87[_0x98ca('0x2c')];this['outboundDropCallsDayCallersExit']=_0x17ee87['outboundDropCallsDayCallersExit'];this[_0x98ca('0x2d')]=_0x17ee87['outboundDropCallsDayTimeout'];this[_0x98ca('0xd')]=_0x17ee87['outboundNoAnswerCallsDay'];this[_0x98ca('0xe')]=_0x17ee87['outboundNoSuchCallsDay'];this[_0x98ca('0x2e')]=_0x17ee87[_0x98ca('0x2e')];this['outboundReCallsDay']=_0x17ee87[_0x98ca('0xf')];this[_0x98ca('0x10')]=_0x17ee87['outboundRejectCallsDay'];this[_0x98ca('0x11')]=_0x17ee87[_0x98ca('0x11')];this['predictiveIntervalAnsweredCalls']=_0x17ee87[_0x98ca('0x2f')];this[_0x98ca('0x30')]=_0x17ee87[_0x98ca('0x30')];this[_0x98ca('0x31')]=_0x17ee87[_0x98ca('0x31')];this['predictiveIntervalDroppedCallsCallersExit']=_0x17ee87[_0x98ca('0x32')];this[_0x98ca('0x33')]=_0x17ee87['predictiveIntervalDroppedCallsTimeout'];this[_0x98ca('0x34')]=_0x17ee87[_0x98ca('0x34')];this[_0x98ca('0x35')]=_0x17ee87['predictiveIntervalErlangCallsDroppedCalls'];this[_0x98ca('0x36')]=_0x17ee87[_0x98ca('0x36')];this[_0x98ca('0x37')]=_0x17ee87['predictiveIntervalMultiplicativeFactor'];this[_0x98ca('0x38')]=_0x17ee87[_0x98ca('0x38')];this[_0x98ca('0x39')]=_0x17ee87['predictiveIntervalAvailable'];this['predictiveIntervalTotalCalls']=_0x17ee87[_0x98ca('0x3a')];this[_0x98ca('0x3b')]=_0x17ee87[_0x98ca('0x3b')];this['erlangCalls']=_0x17ee87[_0x98ca('0x3c')];this[_0x98ca('0x3d')]=_0x17ee87[_0x98ca('0x3d')];this['erlangAbandonmentRate']=_0x17ee87[_0x98ca('0x3e')];this[_0x98ca('0x3f')]=_0x17ee87[_0x98ca('0x3f')];this[_0x98ca('0x40')]=_0x17ee87[_0x98ca('0x40')];this['startProgressive']=_0x17ee87['startProgressive'];this['message']=_0x17ee87[_0x98ca('0x41')];this[_0x98ca('0x42')]=_0x17ee87[_0x98ca('0x42')];}if(_0x17ee87[_0x98ca('0x43')]){this[_0x98ca('0x43')]={'id':_0x17ee87[_0x98ca('0x43')]['id'],'name':_0x17ee87[_0x98ca('0x43')]['name'],'active':_0x17ee87['Trunk'][_0x98ca('0x44')],'callerid':_0x17ee87[_0x98ca('0x43')][_0x98ca('0x45')]};}}VoiceQueueSummary[_0x98ca('0x46')][_0x98ca('0x47')]=function(_0x535fdc,_0x55161f,_0x5c0d50,_0x4e71a7){this[_0x98ca('0x2')]=0x0;this[_0x98ca('0x5')]=0x0;this[_0x98ca('0x3')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x98ca('0x7')]=0x0;this[_0x98ca('0x1a')]=0x0;this[_0x98ca('0x1b')]=0x0;this[_0x98ca('0x21')]=0x0;this[_0x98ca('0x4')]=0x0;this[_0x98ca('0x1e')]=0x0;this[_0x98ca('0x1c')]=0x0;if(_0x5c0d50){if(_0x5c0d50[_0x98ca('0x0')]){this[_0x98ca('0x0')]=Number(_0x5c0d50[_0x98ca('0x0')]);}if(_0x5c0d50[_0x98ca('0x48')]){this['loggedIn']=Number(_0x5c0d50[_0x98ca('0x48')]);}if(_0x5c0d50[_0x98ca('0x49')]){this[_0x98ca('0x6')]=Number(_0x5c0d50[_0x98ca('0x49')]);}}for(var _0x3c9837=0x0;_0x3c9837<_0x535fdc[_0x98ca('0x4a')];_0x3c9837++){var _0x167264=_0x55161f[_0x98ca('0x4b')+_0x535fdc[_0x3c9837][_0x98ca('0x16')]];if(_0x167264&&_0x167264['online']){this[_0x98ca('0x2')]+=0x1;}if(_0x535fdc[_0x3c9837][_0x98ca('0x4c')]==='1'){this['talking']+=0x1;}if(_0x535fdc[_0x3c9837][_0x98ca('0x3')]==='1'&&!['2','7','8']['includes'](_0x535fdc[_0x3c9837][_0x98ca('0x4d')])){this[_0x98ca('0x3')]+=0x1;}switch(_0x535fdc[_0x3c9837][_0x98ca('0x4d')]){case'0':this[_0x98ca('0x22')]+=0x1;break;case'1':this[_0x98ca('0x1d')]+=0x1;break;case'2':this[_0x98ca('0x7')]+=0x1;break;case'3':this[_0x98ca('0x1a')]+=0x1;break;case'4':this[_0x98ca('0x1b')]+=0x1;break;case'5':this[_0x98ca('0x21')]+=0x1;break;case'6':this[_0x98ca('0x4')]+=0x1;break;case'7':this[_0x98ca('0x1e')]+=0x1;break;case'8':this[_0x98ca('0x1c')]+=0x1;break;}}if(this['dialMethod']===_0x98ca('0x4e')){var _0x1fa4f8=Object[_0x98ca('0x4f')](_0x4e71a7);for(var _0x19dc39=0x0;_0x19dc39<_0x1fa4f8['length'];_0x19dc39++){var _0xec9f92=_0x1fa4f8[_0x19dc39];var _0x3e4ba8=_0x4e71a7[_0xec9f92];if(_0x3e4ba8[_0x98ca('0x50')]===this[_0x98ca('0x16')]&&_0x3e4ba8[_0x98ca('0x20')]===_0x98ca('0x51')&&_0x3e4ba8[_0x98ca('0x52')]==='xcally-motion-preview'){this['talking']+=0x1;}}if(this['talking']>this[_0x98ca('0x7')]){this[_0x98ca('0x5')]=this[_0x98ca('0x7')];}this[_0x98ca('0x12')]=0x0;}return this;};VoiceQueueSummary['prototype']['compareToInboundQueue']=function(_0x309b96){var _0x385785=![];if(_0x309b96){_0x385785=INBOUND_COUNTERS[_0x98ca('0x53')](function(_0x408266){return this[_0x408266]!==_0x309b96[_0x408266];},this);}return _0x385785;};VoiceQueueSummary[_0x98ca('0x46')][_0x98ca('0x54')]=function(_0x1f2678){var _0x2e4e16=![];var _0x10a31a=![];var _0x314fe9=![];if(_0x1f2678){_0x2e4e16=this[_0x98ca('0x26')]!==_0x1f2678[_0x98ca('0x26')]||this[_0x98ca('0x25')]!==_0x1f2678['dialActive']||this[_0x98ca('0x41')]!==_0x1f2678['message']||this[_0x98ca('0x42')]!==_0x1f2678[_0x98ca('0x42')];_0x10a31a=OUTBOUND_COUNTERS[_0x98ca('0x53')](function(_0xc2b652){return this[_0xc2b652]!==_0x1f2678[_0xc2b652];},this);if(this[_0x98ca('0x43')]&&_0x1f2678['Trunk']){_0x314fe9=this[_0x98ca('0x43')][_0x98ca('0x16')]!==_0x1f2678['Trunk'][_0x98ca('0x16')]||this[_0x98ca('0x43')][_0x98ca('0x44')]!==_0x1f2678['Trunk'][_0x98ca('0x44')];}}return _0x2e4e16||_0x10a31a||_0x314fe9;};VoiceQueueSummary[_0x98ca('0x46')]['updateReportFromOutboundQueue']=function(_0x12f25f){this[_0x98ca('0x19')]=_0x12f25f[_0x98ca('0x19')];this[_0x98ca('0x41')]=_0x12f25f[_0x98ca('0x41')];this[_0x98ca('0x42')]=_0x12f25f[_0x98ca('0x42')];this['originated']=_0x12f25f[_0x98ca('0x3b')];this[_0x98ca('0x8')]=_0x12f25f[_0x98ca('0x8')];this['outboundAnswerCallsDay']=_0x12f25f['outboundAnswerCallsDay'];this[_0x98ca('0xa')]=_0x12f25f[_0x98ca('0xa')];this[_0x98ca('0xb')]=_0x12f25f[_0x98ca('0xb')];this[_0x98ca('0xc')]=_0x12f25f[_0x98ca('0xc')];this[_0x98ca('0xd')]=_0x12f25f[_0x98ca('0xd')];this['outboundNoSuchCallsDay']=_0x12f25f[_0x98ca('0xe')];this['outboundReCallsDay']=_0x12f25f['outboundReCallsDay'];this[_0x98ca('0x10')]=_0x12f25f[_0x98ca('0x10')];this[_0x98ca('0x11')]=_0x12f25f[_0x98ca('0x11')];this[_0x98ca('0x13')]=_0x12f25f[_0x98ca('0x13')];this['sumDuration']=_0x12f25f[_0x98ca('0x14')];this[_0x98ca('0x15')]=_0x12f25f[_0x98ca('0x15')];if(this['dialMethod']==='preview'){this[_0x98ca('0x12')]=_0x12f25f[_0x98ca('0x12')];}};module[_0x98ca('0x55')]=VoiceQueueSummary;
\ No newline at end of file
+var _0x56e7=['predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','invalid','loggedin','callers','length','name','online','includes','booked','keys','dialer','xcally-motion-preview','some','compareToOutboundQueue','updateReportFromOutboundQueue','preview','loggedIn','loggedInDb','ringing','talking','waiting','available','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','strategy','abandoned','busy','onHold','notInUse','paused','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x56e7,0x7b));var _0x756e=function(_0x137c02,_0x2a2175){_0x137c02=_0x137c02-0x0;var _0x6ee5bc=_0x56e7[_0x137c02];return _0x6ee5bc;};'use strict';var INBOUND_COUNTERS=['available',_0x756e('0x0'),_0x756e('0x1'),'paused',_0x756e('0x2'),_0x756e('0x3'),_0x756e('0x4')];var OUTBOUND_COUNTERS=[_0x756e('0x5'),_0x756e('0x6'),_0x756e('0x7'),_0x756e('0x0'),'loggedInDb',_0x756e('0x8'),_0x756e('0x9'),_0x756e('0xa'),_0x756e('0xb'),'outboundBusyCallsDay',_0x756e('0xc'),'outboundNoAnswerCallsDay',_0x756e('0xd'),_0x756e('0xe'),_0x756e('0xf'),_0x756e('0x10'),'paused','pTalking',_0x756e('0x3'),_0x756e('0x11'),_0x756e('0x12'),'total',_0x756e('0x4')];function VoiceQueueSummary(_0x100d3f){this['id']=_0x100d3f['id'];this['name']=_0x100d3f['name'];this[_0x756e('0x13')]=_0x100d3f['strategy'];this[_0x756e('0x14')]=_0x100d3f[_0x756e('0x14')]||0x0;this[_0x756e('0x6')]=_0x100d3f[_0x756e('0x6')]||0x0;this[_0x756e('0x5')]=_0x100d3f['available']||0x0;this['busy']=_0x100d3f[_0x756e('0x15')]||0x0;this[_0x756e('0x7')]=_0x100d3f[_0x756e('0x7')]||0x0;this['invalid']=_0x100d3f['invalid']||0x0;this[_0x756e('0x0')]=_0x100d3f[_0x756e('0x0')]||0x0;this[_0x756e('0x1')]=_0x100d3f[_0x756e('0x1')]||0x0;this[_0x756e('0x16')]=_0x100d3f[_0x756e('0x16')]||0x0;this[_0x756e('0x17')]=_0x100d3f[_0x756e('0x17')]||0x0;this[_0x756e('0x18')]=_0x100d3f['paused']||0x0;this[_0x756e('0x2')]=_0x100d3f['ringing']||0x0;this['ringInUse']=_0x100d3f[_0x756e('0x19')];this[_0x756e('0x11')]=_0x100d3f[_0x756e('0x11')];this[_0x756e('0x12')]=_0x100d3f[_0x756e('0x12')];this[_0x756e('0x1a')]=_0x100d3f[_0x756e('0x1a')]||0x0;this[_0x756e('0x3')]=_0x100d3f[_0x756e('0x3')]||0x0;this[_0x756e('0x1b')]=_0x100d3f[_0x756e('0x1b')]||0x0;this[_0x756e('0x1c')]=_0x100d3f[_0x756e('0x1c')];this[_0x756e('0x1d')]=_0x100d3f[_0x756e('0x1d')]||0x0;this[_0x756e('0x1e')]=_0x100d3f['unknown']||0x0;this[_0x756e('0x1f')]=_0x100d3f['unmanaged']||0x0;this[_0x756e('0x4')]=_0x100d3f[_0x756e('0x4')]||0x0;if(_0x100d3f[_0x756e('0x1c')]===_0x756e('0x20')){this['pTalking']=_0x100d3f[_0x756e('0x21')]||0x0;this[_0x756e('0x22')]=_0x100d3f[_0x756e('0x22')];this['dialMethod']=_0x100d3f[_0x756e('0x23')];this[_0x756e('0x24')]=_0x100d3f[_0x756e('0x24')];this['dialOriginateCallerIdNumber']=_0x100d3f[_0x756e('0x25')];this[_0x756e('0x26')]=_0x100d3f['dialOriginateTimeout'];this[_0x756e('0x27')]=_0x100d3f[_0x756e('0x27')];this[_0x756e('0x28')]=_0x100d3f['temp'];this[_0x756e('0x29')]=_0x100d3f[_0x756e('0x29')];this['outboundAnswerCallsDay']=_0x100d3f[_0x756e('0xa')];this[_0x756e('0xb')]=_0x100d3f['outboundBlacklistCallsDay'];this[_0x756e('0x2a')]=_0x100d3f[_0x756e('0x2a')];this[_0x756e('0xc')]=_0x100d3f[_0x756e('0xc')];this[_0x756e('0x2b')]=_0x100d3f['outboundDropCallsDayACS'];this[_0x756e('0x2c')]=_0x100d3f['outboundDropCallsDayCallersExit'];this['outboundDropCallsDayTimeout']=_0x100d3f[_0x756e('0x2d')];this['outboundNoAnswerCallsDay']=_0x100d3f[_0x756e('0x2e')];this[_0x756e('0xd')]=_0x100d3f[_0x756e('0xd')];this[_0x756e('0x2f')]=_0x100d3f[_0x756e('0x2f')];this[_0x756e('0xe')]=_0x100d3f[_0x756e('0xe')];this[_0x756e('0xf')]=_0x100d3f[_0x756e('0xf')];this[_0x756e('0x10')]=_0x100d3f[_0x756e('0x10')];this[_0x756e('0x30')]=_0x100d3f['predictiveIntervalAnsweredCalls'];this['predictiveIntervalAvgHoldtime']=_0x100d3f[_0x756e('0x31')];this[_0x756e('0x32')]=_0x100d3f[_0x756e('0x32')];this[_0x756e('0x33')]=_0x100d3f[_0x756e('0x33')];this[_0x756e('0x34')]=_0x100d3f[_0x756e('0x34')];this['predictiveIntervalErlangCalls']=_0x100d3f['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x100d3f[_0x756e('0x35')];this[_0x756e('0x36')]=_0x100d3f[_0x756e('0x36')];this['predictiveIntervalMultiplicativeFactor']=_0x100d3f[_0x756e('0x37')];this[_0x756e('0x38')]=_0x100d3f['predictiveIntervalPauses'];this[_0x756e('0x39')]=_0x100d3f[_0x756e('0x39')];this[_0x756e('0x3a')]=_0x100d3f[_0x756e('0x3a')];this[_0x756e('0x8')]=_0x100d3f[_0x756e('0x8')];this[_0x756e('0x3b')]=_0x100d3f[_0x756e('0x3b')];this['erlangCallToSecond']=_0x100d3f[_0x756e('0x3c')];this[_0x756e('0x3d')]=_0x100d3f[_0x756e('0x3d')];this[_0x756e('0x3e')]=_0x100d3f[_0x756e('0x3e')];this[_0x756e('0x3f')]=_0x100d3f[_0x756e('0x3f')];this[_0x756e('0x40')]=_0x100d3f[_0x756e('0x40')];this[_0x756e('0x41')]=_0x100d3f['message'];this[_0x756e('0x42')]=_0x100d3f[_0x756e('0x42')];}if(_0x100d3f['Trunk']){this[_0x756e('0x43')]={'id':_0x100d3f[_0x756e('0x43')]['id'],'name':_0x100d3f[_0x756e('0x43')]['name'],'active':_0x100d3f[_0x756e('0x43')][_0x756e('0x44')],'callerid':_0x100d3f[_0x756e('0x43')]['callerid']};}}VoiceQueueSummary[_0x756e('0x45')][_0x756e('0x46')]=function(_0x5856f,_0x1fc45c,_0x3eece7,_0x252757){this['loggedInDb']=0x0;this[_0x756e('0x3')]=0x0;this[_0x756e('0x18')]=0x0;this['unknown']=0x0;this[_0x756e('0x17')]=0x0;this[_0x756e('0x7')]=0x0;this[_0x756e('0x15')]=0x0;this[_0x756e('0x47')]=0x0;this[_0x756e('0x1d')]=0x0;this[_0x756e('0x2')]=0x0;this[_0x756e('0x19')]=0x0;this[_0x756e('0x16')]=0x0;if(_0x3eece7){if(_0x3eece7[_0x756e('0x5')]){this['available']=Number(_0x3eece7[_0x756e('0x5')]);}if(_0x3eece7['loggedin']){this[_0x756e('0x0')]=Number(_0x3eece7[_0x756e('0x48')]);}if(_0x3eece7[_0x756e('0x49')]){this['waiting']=Number(_0x3eece7[_0x756e('0x49')]);}}for(var _0x184823=0x0;_0x184823<_0x5856f[_0x756e('0x4a')];_0x184823++){var _0x527a62=_0x1fc45c['SIP/'+_0x5856f[_0x184823][_0x756e('0x4b')]];if(_0x527a62&&_0x527a62[_0x756e('0x4c')]){this['loggedInDb']+=0x1;}if(_0x5856f[_0x184823]['incall']==='1'){this[_0x756e('0x3')]+=0x1;}if(_0x5856f[_0x184823][_0x756e('0x18')]==='1'&&!['2','7','8'][_0x756e('0x4d')](_0x5856f[_0x184823]['status'])){this[_0x756e('0x18')]+=0x1;}switch(_0x5856f[_0x184823]['status']){case'0':this[_0x756e('0x1e')]+=0x1;break;case'1':this[_0x756e('0x17')]+=0x1;break;case'2':this[_0x756e('0x7')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x756e('0x47')]+=0x1;break;case'5':this['unavailable']+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x756e('0x19')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x756e('0x23')]===_0x756e('0x4e')){var _0xd6ee1b=Object[_0x756e('0x4f')](_0x252757);for(var _0x95061c=0x0;_0x95061c<_0xd6ee1b[_0x756e('0x4a')];_0x95061c++){var _0x50b86e=_0xd6ee1b[_0x95061c];var _0x42a498=_0x252757[_0x50b86e];if(_0x42a498['queue']===this[_0x756e('0x4b')]&&_0x42a498['type']===_0x756e('0x50')&&_0x42a498['exten']===_0x756e('0x51')){this['talking']+=0x1;}}if(this[_0x756e('0x3')]>this[_0x756e('0x7')]){this[_0x756e('0x3')]=this['inUse'];}this[_0x756e('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x756e('0x45')]['compareToInboundQueue']=function(_0x5768f9){var _0x149a22=![];if(_0x5768f9){_0x149a22=INBOUND_COUNTERS[_0x756e('0x52')](function(_0x34a556){return this[_0x34a556]!==_0x5768f9[_0x34a556];},this);}return _0x149a22;};VoiceQueueSummary[_0x756e('0x45')][_0x756e('0x53')]=function(_0x2197ec){var _0x435729=![];var _0x9e8559=![];var _0x33f923=![];if(_0x2197ec){_0x435729=this['dialMethod']!==_0x2197ec[_0x756e('0x23')]||this[_0x756e('0x22')]!==_0x2197ec[_0x756e('0x22')]||this[_0x756e('0x41')]!==_0x2197ec[_0x756e('0x41')]||this[_0x756e('0x42')]!==_0x2197ec[_0x756e('0x42')];_0x9e8559=OUTBOUND_COUNTERS[_0x756e('0x52')](function(_0x4da157){return this[_0x4da157]!==_0x2197ec[_0x4da157];},this);if(this[_0x756e('0x43')]&&_0x2197ec[_0x756e('0x43')]){_0x33f923=this['Trunk'][_0x756e('0x4b')]!==_0x2197ec['Trunk'][_0x756e('0x4b')]||this[_0x756e('0x43')][_0x756e('0x44')]!==_0x2197ec['Trunk'][_0x756e('0x44')];}}return _0x435729||_0x9e8559||_0x33f923;};VoiceQueueSummary[_0x756e('0x45')][_0x756e('0x54')]=function(_0x571794){this[_0x756e('0x6')]=_0x571794['answered'];this[_0x756e('0x41')]=_0x571794[_0x756e('0x41')];this[_0x756e('0x42')]=_0x571794[_0x756e('0x42')];this[_0x756e('0x8')]=_0x571794[_0x756e('0x8')];this[_0x756e('0x9')]=_0x571794[_0x756e('0x9')];this['outboundAnswerCallsDay']=_0x571794[_0x756e('0xa')];this[_0x756e('0xb')]=_0x571794[_0x756e('0xb')];this[_0x756e('0x2a')]=_0x571794[_0x756e('0x2a')];this[_0x756e('0xc')]=_0x571794[_0x756e('0xc')];this[_0x756e('0x2e')]=_0x571794[_0x756e('0x2e')];this[_0x756e('0xd')]=_0x571794[_0x756e('0xd')];this[_0x756e('0xe')]=_0x571794[_0x756e('0xe')];this[_0x756e('0xf')]=_0x571794['outboundRejectCallsDay'];this[_0x756e('0x10')]=_0x571794[_0x756e('0x10')];this[_0x756e('0x11')]=_0x571794[_0x756e('0x11')];this[_0x756e('0x12')]=_0x571794[_0x756e('0x12')];this['total']=_0x571794[_0x756e('0x1b')];if(this[_0x756e('0x23')]===_0x756e('0x55')){this[_0x756e('0x21')]=_0x571794['pTalking'];}};module['exports']=VoiceQueueSummary;
\ No newline at end of file
index a914ce2..ea782a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4f02=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x2e8806,_0x377c20){var _0x41f595=function(_0x4d6207){while(--_0x4d6207){_0x2e8806['push'](_0x2e8806['shift']());}};_0x41f595(++_0x377c20);}(_0x4f02,0xd1));var _0x24f0=function(_0x44e3da,_0x5cd17c){_0x44e3da=_0x44e3da-0x0;var _0x480e3e=_0x4f02[_0x44e3da];return _0x480e3e;};'use strict';function VtigerAccount(_0x4556f3){this['id']=_0x4556f3['id']||0x0;this[_0x24f0('0x0')]=_0x4556f3[_0x24f0('0x0')]||'';this['username']=_0x4556f3[_0x24f0('0x1')]||'';this[_0x24f0('0x2')]=_0x4556f3[_0x24f0('0x2')]||'';this[_0x24f0('0x3')]=_0x4556f3['remoteUri']||'';this[_0x24f0('0x4')]=_0x4556f3[_0x24f0('0x4')]||'';this['Configurations']=_0x4556f3[_0x24f0('0x5')]||{};}module['exports']=VtigerAccount;
\ No newline at end of file
+var _0xad23=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x2d937b,_0x1e652b){var _0x3628da=function(_0x467a01){while(--_0x467a01){_0x2d937b['push'](_0x2d937b['shift']());}};_0x3628da(++_0x1e652b);}(_0xad23,0x1a5));var _0x3ad2=function(_0x18f340,_0x293a65){_0x18f340=_0x18f340-0x0;var _0x1597a3=_0xad23[_0x18f340];return _0x1597a3;};'use strict';function VtigerAccount(_0x30f68e){this['id']=_0x30f68e['id']||0x0;this[_0x3ad2('0x0')]=_0x30f68e['name']||'';this['username']=_0x30f68e[_0x3ad2('0x1')]||'';this[_0x3ad2('0x2')]=_0x30f68e[_0x3ad2('0x2')]||'';this[_0x3ad2('0x3')]=_0x30f68e['remoteUri']||'';this['serverUrl']=_0x30f68e[_0x3ad2('0x4')]||'';this[_0x3ad2('0x5')]=_0x30f68e[_0x3ad2('0x5')]||{};}module[_0x3ad2('0x6')]=VtigerAccount;
\ No newline at end of file
index bc1dd7e..fcf8cda 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x94df=['name','username','password','token','remoteUri','authType','type','serverUrl','Configurations','exports'];(function(_0x4bc397,_0x1de922){var _0x2cb4ed=function(_0x31007c){while(--_0x31007c){_0x4bc397['push'](_0x4bc397['shift']());}};_0x2cb4ed(++_0x1de922);}(_0x94df,0x10e));var _0xf94d=function(_0x3b8d83,_0x4e93fc){_0x3b8d83=_0x3b8d83-0x0;var _0x11d29c=_0x94df[_0x3b8d83];return _0x11d29c;};'use strict';function ZendeskAccount(_0x48cdf0){this['id']=_0x48cdf0['id']||0x0;this[_0xf94d('0x0')]=_0x48cdf0['name']||'';this['username']=_0x48cdf0[_0xf94d('0x1')]||'';this[_0xf94d('0x2')]=_0x48cdf0[_0xf94d('0x2')]||'';this[_0xf94d('0x3')]=_0x48cdf0['token']||'';this[_0xf94d('0x4')]=_0x48cdf0[_0xf94d('0x4')]||'';this[_0xf94d('0x5')]=_0x48cdf0[_0xf94d('0x5')]||'';this['type']=_0x48cdf0[_0xf94d('0x6')]||'integrationTab';this[_0xf94d('0x7')]=_0x48cdf0[_0xf94d('0x7')]||'';this['Configurations']=_0x48cdf0[_0xf94d('0x8')]||{};}module[_0xf94d('0x9')]=ZendeskAccount;
\ No newline at end of file
+var _0xa395=['username','password','remoteUri','authType','serverUrl','Configurations','exports','name'];(function(_0x2b0d88,_0x5b5ef2){var _0x1c9256=function(_0x1ea041){while(--_0x1ea041){_0x2b0d88['push'](_0x2b0d88['shift']());}};_0x1c9256(++_0x5b5ef2);}(_0xa395,0xef));var _0x5a39=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa395[_0x311c35];return _0x5cc50c;};'use strict';function ZendeskAccount(_0x37f0d8){this['id']=_0x37f0d8['id']||0x0;this[_0x5a39('0x0')]=_0x37f0d8['name']||'';this[_0x5a39('0x1')]=_0x37f0d8['username']||'';this[_0x5a39('0x2')]=_0x37f0d8[_0x5a39('0x2')]||'';this['token']=_0x37f0d8['token']||'';this[_0x5a39('0x3')]=_0x37f0d8[_0x5a39('0x3')]||'';this[_0x5a39('0x4')]=_0x37f0d8[_0x5a39('0x4')]||'';this['type']=_0x37f0d8['type']||'integrationTab';this[_0x5a39('0x5')]=_0x37f0d8[_0x5a39('0x5')]||'';this[_0x5a39('0x6')]=_0x37f0d8[_0x5a39('0x6')]||{};}module[_0x5a39('0x7')]=ZendeskAccount;
\ No newline at end of file
index bcfe4d3..77299b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x557f=['exports','description','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations'];(function(_0x34106a,_0x193f38){var _0xb8303c=function(_0x5be22b){while(--_0x5be22b){_0x34106a['push'](_0x34106a['shift']());}};_0xb8303c(++_0x193f38);}(_0x557f,0x196));var _0xf557=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x557f[_0x3dd15e];return _0x231fd0;};'use strict';function ZohoAccount(_0x549331){this['id']=_0x549331['id']||0x0;this['name']=_0x549331['name']||'';this['description']=_0x549331[_0xf557('0x0')]||'';this['host']=_0x549331['host']||'';this['zone']=_0x549331[_0xf557('0x1')]||'';this[_0xf557('0x2')]=_0x549331[_0xf557('0x2')]||'';this[_0xf557('0x3')]=_0x549331[_0xf557('0x3')]||'';this[_0xf557('0x4')]=_0x549331['serverUrl']||'';this['code']=_0x549331[_0xf557('0x5')]||'';this[_0xf557('0x6')]=_0x549331['refreshToken']||'';this['Configurations']=_0x549331[_0xf557('0x7')]||{};}module[_0xf557('0x8')]=ZohoAccount;
\ No newline at end of file
+var _0xa632=['code','refreshToken','Configurations','exports','name','description','host','zone','clientId','serverUrl'];(function(_0xd0ce9c,_0x44df5b){var _0x1647bc=function(_0x19c16f){while(--_0x19c16f){_0xd0ce9c['push'](_0xd0ce9c['shift']());}};_0x1647bc(++_0x44df5b);}(_0xa632,0x13a));var _0x2a63=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xa632[_0x55f8b4];return _0x2475f9;};'use strict';function ZohoAccount(_0x3a5ea5){this['id']=_0x3a5ea5['id']||0x0;this[_0x2a63('0x0')]=_0x3a5ea5[_0x2a63('0x0')]||'';this[_0x2a63('0x1')]=_0x3a5ea5['description']||'';this[_0x2a63('0x2')]=_0x3a5ea5[_0x2a63('0x2')]||'';this[_0x2a63('0x3')]=_0x3a5ea5['zone']||'';this[_0x2a63('0x4')]=_0x3a5ea5[_0x2a63('0x4')]||'';this['clientSecret']=_0x3a5ea5['clientSecret']||'';this[_0x2a63('0x5')]=_0x3a5ea5[_0x2a63('0x5')]||'';this[_0x2a63('0x6')]=_0x3a5ea5['code']||'';this[_0x2a63('0x7')]=_0x3a5ea5[_0x2a63('0x7')]||'';this[_0x2a63('0x8')]=_0x3a5ea5[_0x2a63('0x8')]||{};}module[_0x2a63('0x9')]=ZohoAccount;
\ No newline at end of file
index 5dfe359..66a36bf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2542=['UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','format','SIP/%s','calleridname','Contact','firstName','lastName','active','calleridnum','phone','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','ContactId','ListId'];(function(_0x24e3b1,_0x27e048){var _0x3e56cb=function(_0xa8f6cb){while(--_0xa8f6cb){_0x24e3b1['push'](_0x24e3b1['shift']());}};_0x3e56cb(++_0x27e048);}(_0x2542,0x169));var _0x2254=function(_0x50ea89,_0xc1b686){_0x50ea89=_0x50ea89-0x0;var _0x4c43fc=_0x2542[_0x50ea89];return _0x4c43fc;};'use strict';var util=require(_0x2254('0x0'));var _=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));function checkNameSurname(_0x20dfee,_0x578407,_0x105910){var _0x47b1da='';if(!_[_0x2254('0x3')](_0x578407)&&_0x2254('0x4')===typeof _0x578407){_0x47b1da+=_0x578407;}if(!_[_0x2254('0x3')](_0x105910)&&_0x2254('0x4')===typeof _0x105910){_0x47b1da+='\x20'+_0x105910;}if(_0x47b1da!==''){return _0x47b1da;}return _0x20dfee;}function Action(_0x76c902,_0x508183,_0x19ad3c,_0xe8ca50,_0x2ee7ee){this[_0x2254('0x5')]=_0x19ad3c||undefined;this[_0x2254('0x6')]=_0x76c902['id'];this[_0x2254('0x7')]=_0x508183[_0x2254('0x8')];this[_0x2254('0x9')]=_0x508183[_0x2254('0x9')];this[_0x2254('0xa')]=_0x2254('0x7');this['dialAnswer']=![];this[_0x2254('0xb')]=_[_0x2254('0x3')](_0x76c902[_0x2254('0xc')])?undefined:_0x76c902[_0x2254('0xc')]['name'];this['channelAgent']=this[_0x2254('0xb')]?util[_0x2254('0xd')](_0x2254('0xe'),this[_0x2254('0xb')]):_0xe8ca50||undefined;this[_0x2254('0xf')]=checkNameSurname(_0x76c902[_0x2254('0x10')]['phone'],_0x76c902[_0x2254('0x10')][_0x2254('0x11')],_0x76c902['Contact'][_0x2254('0x12')]);this[_0x2254('0x13')]=_0x76c902[_0x2254('0x13')]||![];this[_0x2254('0x14')]=_0x76c902[_0x2254('0x15')];this[_0x2254('0x16')]=_0x76c902['scheduledat'];this[_0x2254('0x17')]=_0x76c902['countbusyretry']||0x0;this[_0x2254('0x18')]=_0x76c902[_0x2254('0x18')]||0x0;this[_0x2254('0x19')]=_0x76c902[_0x2254('0x19')]||0x0;this[_0x2254('0x1a')]=(_0x76c902[_0x2254('0x17')]||0x0)+(_0x76c902['countcongestionretry']||0x0)+(_0x76c902['countnoanswerretry']||0x0)+(_0x76c902['countnosuchnumberretry']||0x0)+(_0x76c902[_0x2254('0x1b')]||0x0)+(_0x76c902[_0x2254('0x1c')]||0x0)+(_0x76c902[_0x2254('0x1d')]||0x0)+(_0x76c902[_0x2254('0x1e')]||0x0);this[_0x2254('0x1f')]=_0x76c902[_0x2254('0x1f')]||0x0;this['countdropretry']=_0x76c902[_0x2254('0x1b')]||0x0;this[_0x2254('0x1c')]=_0x76c902[_0x2254('0x1c')]||0x0;this['countmachineretry']=_0x76c902['countmachineretry']||0x0;this['countagentrejectretry']=_0x76c902[_0x2254('0x1e')]||0x0;this[_0x2254('0x20')]=_0x76c902[_0x2254('0x20')];this['callbackuniqueid']=_0x76c902['callbackuniqueid'];this['callbackat']=_0x76c902['callbackat'];this['recallme']=_0x76c902['recallme'];this[_0x2254('0x21')]=_0x76c902[_0x2254('0x21')];this[_0x2254('0x22')]=_0x76c902[_0x2254('0x22')];this[_0x2254('0x23')]=_[_0x2254('0x3')](_0x76c902['Agent'])?_0x76c902['UserId']:_0x76c902[_0x2254('0xc')]['id'];this['VoiceQueueId']=_0x76c902[_0x2254('0x24')];this[_0x2254('0x25')]='';this[_0x2254('0x26')]='';}Action[_0x2254('0x27')][_0x2254('0x28')]=function(){return util['format'](_0x2254('0x29'),this[_0x2254('0xf')],this[_0x2254('0x2a')]);};module[_0x2254('0x2b')]=Action;
\ No newline at end of file
+var _0x5eb8=['callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','number','moment','isNil','string','uniqueid','idContact','name','type','campaigntype','queue','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry'];(function(_0x424497,_0x3a557c){var _0x14a13a=function(_0x45c9fc){while(--_0x45c9fc){_0x424497['push'](_0x424497['shift']());}};_0x14a13a(++_0x3a557c);}(_0x5eb8,0xb0));var _0x85eb=function(_0x188905,_0x398fac){_0x188905=_0x188905-0x0;var _0x2bf735=_0x5eb8[_0x188905];return _0x2bf735;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x85eb('0x0'));function checkNameSurname(_0x2598be,_0x393a8a,_0xd2f5dc){var _0x7e3c0='';if(!_[_0x85eb('0x1')](_0x393a8a)&&_0x85eb('0x2')===typeof _0x393a8a){_0x7e3c0+=_0x393a8a;}if(!_[_0x85eb('0x1')](_0xd2f5dc)&&_0x85eb('0x2')===typeof _0xd2f5dc){_0x7e3c0+='\x20'+_0xd2f5dc;}if(_0x7e3c0!==''){return _0x7e3c0;}return _0x2598be;}function Action(_0x1fde1a,_0x2bf83c,_0x1ba1d8,_0x4a8814,_0x16d7b9){this[_0x85eb('0x3')]=_0x1ba1d8||undefined;this[_0x85eb('0x4')]=_0x1fde1a['id'];this['queue']=_0x2bf83c[_0x85eb('0x5')];this['type']=_0x2bf83c[_0x85eb('0x6')];this[_0x85eb('0x7')]=_0x85eb('0x8');this[_0x85eb('0x9')]=![];this[_0x85eb('0xa')]=_[_0x85eb('0x1')](_0x1fde1a[_0x85eb('0xb')])?undefined:_0x1fde1a['Agent'][_0x85eb('0x5')];this[_0x85eb('0xc')]=this['membername']?util[_0x85eb('0xd')](_0x85eb('0xe'),this[_0x85eb('0xa')]):_0x4a8814||undefined;this[_0x85eb('0xf')]=checkNameSurname(_0x1fde1a['Contact']['phone'],_0x1fde1a[_0x85eb('0x10')]['firstName'],_0x1fde1a[_0x85eb('0x10')][_0x85eb('0x11')]);this[_0x85eb('0x12')]=_0x1fde1a[_0x85eb('0x12')]||![];this[_0x85eb('0x13')]=_0x1fde1a['phone'];this[_0x85eb('0x14')]=_0x1fde1a['scheduledat'];this[_0x85eb('0x15')]=_0x1fde1a[_0x85eb('0x15')]||0x0;this[_0x85eb('0x16')]=_0x1fde1a[_0x85eb('0x16')]||0x0;this['countnoanswerretry']=_0x1fde1a['countnoanswerretry']||0x0;this['countglobal']=(_0x1fde1a[_0x85eb('0x15')]||0x0)+(_0x1fde1a[_0x85eb('0x16')]||0x0)+(_0x1fde1a[_0x85eb('0x17')]||0x0)+(_0x1fde1a[_0x85eb('0x18')]||0x0)+(_0x1fde1a[_0x85eb('0x19')]||0x0)+(_0x1fde1a[_0x85eb('0x1a')]||0x0)+(_0x1fde1a['countmachineretry']||0x0)+(_0x1fde1a[_0x85eb('0x1b')]||0x0);this[_0x85eb('0x18')]=_0x1fde1a[_0x85eb('0x18')]||0x0;this['countdropretry']=_0x1fde1a['countdropretry']||0x0;this['countabandonedretry']=_0x1fde1a['countabandonedretry']||0x0;this[_0x85eb('0x1c')]=_0x1fde1a[_0x85eb('0x1c')]||0x0;this[_0x85eb('0x1b')]=_0x1fde1a[_0x85eb('0x1b')]||0x0;this[_0x85eb('0x1d')]=_0x1fde1a[_0x85eb('0x1d')];this['callbackuniqueid']=_0x1fde1a['callbackuniqueid'];this['callbackat']=_0x1fde1a[_0x85eb('0x1e')];this[_0x85eb('0x1f')]=_0x1fde1a[_0x85eb('0x1f')];this[_0x85eb('0x20')]=_0x1fde1a[_0x85eb('0x20')];this[_0x85eb('0x21')]=_0x1fde1a['ListId'];this[_0x85eb('0x22')]=_[_0x85eb('0x1')](_0x1fde1a[_0x85eb('0xb')])?_0x1fde1a[_0x85eb('0x22')]:_0x1fde1a[_0x85eb('0xb')]['id'];this['VoiceQueueId']=_0x1fde1a[_0x85eb('0x23')];this[_0x85eb('0x24')]='';this[_0x85eb('0x25')]='';}Action[_0x85eb('0x26')][_0x85eb('0x27')]=function(){return util[_0x85eb('0xd')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x85eb('0x28')]);};module['exports']=Action;
\ No newline at end of file
index b6bedfc..ae80150 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4d68=['outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','agentreject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','originated:\x20','ANSWER','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logCongestion]','updateOriginated','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','Queue','execCall','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','active','SIP/%s','unmonitored','execRun','unlockContact','disableContact','getContactPreview','recallme','validateContact','phone','checkInBlack','Call\x20unsuccessful','isEmpty','Agent','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','trim','dialCutDigit','substring','dialPrefix','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','addVariables','assign','merge','toLowerVariables','variables','variablesAction','[originated][increment]','OriginateError','channel','actionid','lookAgent','clone','isFailure','custom:agentringnoanswer','rejected','starttime','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/environment','preview','actionPreview','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','redis','defaults','localhost','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','syncHangupRequest','dialend','syncDialEnd','syncNewExten','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','emit','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','paused','CAMPAIGN_STATUS','INACTIVE','[CampaignPreview]\x20Campaign\x20Queue:\x20','name','logger','\x20is\x20deactivated','prototype','syncCampaigns','dialMethod','booked','type','outbound','hasOwnProperty','dialActive','setMessage','recallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','pTalking:\x20','dialAnswer','pick','UserId','VoiceQueueId','ListId','Action','status','No\x20such\x20channel','[clearZombieChannel]','decrementTalkink','queue','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','getContactRecallMe','agentReadyId','length','getDiff','scheduledat','dialRecallMeTimeout','voicePause','then','[RecallMe]','catch','logger2','format','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','dialRecallInQueue','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','loggedIn','message','NO_AGENTS_LOGGED','isActive','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','logCustomer','custom:agentnosuchnumber','buildObj','nosuchnumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','totalGlobal','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','responsetime','answertime','uniqueid','\x20Queue','custom:agentconnect','connect','acw','custom:agentConnectPreview','buildAcw','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','dialBusyMaxRetry','rescheduleContact','dialBusyRetryFrequency','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry'];(function(_0x50007c,_0x1cbf11){var _0x5c1ec7=function(_0x52d038){while(--_0x52d038){_0x50007c['push'](_0x50007c['shift']());}};_0x5c1ec7(++_0x1cbf11);}(_0x4d68,0x1c3));var _0x84d6=function(_0x5e77db,_0x356d1c){_0x5e77db=_0x5e77db-0x0;var _0x34b675=_0x4d68[_0x5e77db];return _0x34b675;};'use strict';var util=require(_0x84d6('0x0'));var _=require(_0x84d6('0x1'));var uuid=require(_0x84d6('0x2'));var moment=require(_0x84d6('0x3'));var Redis=require(_0x84d6('0x4'));var config=require(_0x84d6('0x5'));var logger=require('../../../config/logger')(_0x84d6('0x6'));var loggerAction=require('../../../config/logger')(_0x84d6('0x7'));var ami=require('../ami');var rpcDb=require(_0x84d6('0x8'));var cmHopperAdditionalPhone=require(_0x84d6('0x9'));var Action=require(_0x84d6('0xa'));var ut=require('./util/util');var utils=require('../dialer/utils');config[_0x84d6('0xb')]=_[_0x84d6('0xc')](config[_0x84d6('0xb')],{'host':_0x84d6('0xd'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x84d6('0xb')]));var Sequence=function(){};Sequence['prototype'][_0x84d6('0xe')]=function(_0x1925c8){this[_0x84d6('0xf')]=this['tail']?this['tail'][_0x84d6('0x10')](_0x1925c8):_0x1925c8();};function Preview(_0x5a7122){this[_0x84d6('0x11')]=new Sequence();this[_0x84d6('0x12')]=_0x5a7122[_0x84d6('0x13')];this[_0x84d6('0x14')]=_0x5a7122[_0x84d6('0x14')];this['actions']={};this[_0x84d6('0x15')]=_0x5a7122['agents'];this[_0x84d6('0x16')]=0x0;ami['on'](_0x84d6('0x17'),this[_0x84d6('0x18')][_0x84d6('0x19')](this));ami['on'](_0x84d6('0x1a'),this[_0x84d6('0x1b')][_0x84d6('0x19')](this));ami['on']('hanguprequest',this[_0x84d6('0x1c')][_0x84d6('0x19')](this));ami['on'](_0x84d6('0x1d'),this[_0x84d6('0x1e')][_0x84d6('0x19')](this));ami['on']('newexten',this[_0x84d6('0x1f')][_0x84d6('0x19')](this));ami['on']('varset',this[_0x84d6('0x20')]['bind'](this));ami['on'](_0x84d6('0x21'),this[_0x84d6('0x22')][_0x84d6('0x19')](this));ami['on'](_0x84d6('0x23'),this[_0x84d6('0x24')]['bind'](this));this[_0x84d6('0x25')](this[_0x84d6('0x12')]);}function emit(_0x50ec59,_0x4e4634,_0xc1c137){io['to'](_0x50ec59)['emit'](_0x4e4634,_0xc1c137);}function emitVoiceQueueChannelRemove(_0x59c74f){logger[_0x84d6('0x26')](_0x84d6('0x27'),JSON[_0x84d6('0x28')](_0x59c74f));emit(util['format'](_0x84d6('0x29'),_0x59c74f['name']),'voice_queue_channel:remove',_0x59c74f);io[_0x84d6('0x2a')](_0x84d6('0x2b'),_0x59c74f);}function notSendMessagesQueue(_0x596b7d){if(_0x596b7d[_0x84d6('0x2c')]){if(_0x596b7d[_0x84d6('0x2d')]===0x0&&_0x596b7d[_0x84d6('0x2e')]===0x0){_0x596b7d[_0x84d6('0x2c')]=![];_0x596b7d['available']=0x0;_0x596b7d[_0x84d6('0x2f')]=0x0;_0x596b7d['message']=utils[_0x84d6('0x30')][_0x84d6('0x31')];ut['logger'](_0x84d6('0x32'),_0x596b7d[_0x84d6('0x33')]+'\x20is\x20not\x20active');}else{_0x596b7d['message']=utils[_0x84d6('0x30')]['DEACTIVATED'];ut[_0x84d6('0x34')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x596b7d[_0x84d6('0x33')]+_0x84d6('0x35'));}}}Preview[_0x84d6('0x36')][_0x84d6('0x25')]=function(){var _0x7c0074=this;setInterval(function(){_0x7c0074[_0x84d6('0x37')]();},0x7cf);};Preview[_0x84d6('0x36')][_0x84d6('0x37')]=function(){var _0x3866d6=this[_0x84d6('0x12')];this[_0x84d6('0x16')]+=0x1;for(var _0x1fa278 in _0x3866d6){if(_0x3866d6['hasOwnProperty'](_0x1fa278)&&(_0x3866d6[_0x1fa278][_0x84d6('0x38')]===_0x84d6('0x6')||_0x3866d6[_0x1fa278][_0x84d6('0x38')]===_0x84d6('0x39'))&&_0x3866d6[_0x1fa278][_0x84d6('0x3a')]===_0x84d6('0x3b')){if(this[_0x84d6('0x16')]>0x7){this[_0x84d6('0x16')]=0x0;this['clearZombieChannels']();}}if(_0x3866d6[_0x84d6('0x3c')](_0x1fa278)&&_0x3866d6[_0x1fa278]['dialMethod']===_0x84d6('0x6')&&_0x3866d6[_0x1fa278][_0x84d6('0x3a')]==='outbound'){if(_0x3866d6[_0x1fa278][_0x84d6('0x3d')]){this[_0x84d6('0x3e')](_0x3866d6[_0x1fa278]);if(_0x3866d6[_0x1fa278]['dialPreviewAutoRecallMe'])this[_0x84d6('0x3f')](_0x3866d6[_0x1fa278]);}else{notSendMessagesQueue(_0x3866d6[_0x1fa278]);}}}};Preview[_0x84d6('0x36')][_0x84d6('0x40')]=function(_0x10470b){var _0x1c29ab=this;this['sequence'][_0x84d6('0xe')](function(){if(!_[_0x84d6('0x41')](_0x1c29ab[_0x84d6('0x42')][_0x10470b])){loggerAction['info'](_0x84d6('0x43'),_0x10470b,'Queue',_0x1c29ab[_0x84d6('0x42')][_0x10470b]['queue'],'originated:\x20',JSON[_0x84d6('0x28')](_0x1c29ab[_0x84d6('0x12')][_0x1c29ab[_0x84d6('0x42')][_0x10470b]['queue']][_0x84d6('0x2d')]),_0x84d6('0x44'),JSON[_0x84d6('0x28')](_0x1c29ab['campaignsPreview'][_0x1c29ab['actions'][_0x10470b]['queue']][_0x84d6('0x2e')]),JSON[_0x84d6('0x28')](_0x1c29ab[_0x84d6('0x42')][_0x10470b][_0x84d6('0x45')]),JSON[_0x84d6('0x28')](_[_0x84d6('0x46')](_0x1c29ab['actions'][_0x10470b],['contactId',_0x84d6('0x47'),_0x84d6('0x48'),_0x84d6('0x49')])));return ami[_0x84d6('0x4a')]({'action':_0x84d6('0x4b'),'channel':_0x1c29ab['actions'][_0x10470b]['channel']})['catch'](function(_0x1edce4){if(_0x1edce4['message']===_0x84d6('0x4c')){setTimeout(function(){if(_0x1c29ab[_0x84d6('0x42')][_0x10470b]){ut['updateOriginated'](_0x1c29ab[_0x84d6('0x12')][_0x1c29ab[_0x84d6('0x42')][_0x10470b]['queue']],_0x84d6('0x4d'));if(_0x1c29ab[_0x84d6('0x42')][_0x10470b][_0x84d6('0x45')]===!![]){ut[_0x84d6('0x4e')](_0x1c29ab[_0x84d6('0x12')][_0x1c29ab['actions'][_0x10470b][_0x84d6('0x4f')]],'[clearZombieChannel]');ut[_0x84d6('0x50')](_0x84d6('0x51')+_0x10470b,_0x1c29ab[_0x84d6('0x42')][_0x10470b]['queue']);}ut[_0x84d6('0x50')](_0x84d6('0x52')+_0x10470b,_0x1c29ab[_0x84d6('0x42')][_0x10470b][_0x84d6('0x4f')]);delete _0x1c29ab[_0x84d6('0x42')][_0x10470b];}},0x2328);}});}});};Preview[_0x84d6('0x36')]['clearZombieChannels']=function(){var _0x3f0029=this;loggerAction['info']('[action]',_['size'](this[_0x84d6('0x42')]));for(var _0x4d05d6 in this['actions']){if(_0x3f0029[_0x84d6('0x42')][_0x84d6('0x3c')](_0x4d05d6)){_0x3f0029['clearZombieChannel'](_0x4d05d6);}}};Preview[_0x84d6('0x36')][_0x84d6('0x3f')]=function(_0x32223a){var _0x2aebf4=this;rpcDb[_0x84d6('0x53')](_0x32223a['id'],ut[_0x84d6('0x54')](this['agents']))['then'](function(_0x37a0e0){if(!_[_0x84d6('0x41')](_0x37a0e0)){for(var _0x24003b=0x0;_0x24003b<_0x37a0e0[_0x84d6('0x55')];_0x24003b+=0x1){if(ut[_0x84d6('0x56')](_0x37a0e0[_0x24003b][_0x84d6('0x57')])<_0x32223a[_0x84d6('0x58')]*0x3c){if(_0x37a0e0[_0x24003b]['Agent']&&!_0x37a0e0[_0x24003b]['Agent'][_0x84d6('0x59')]){_0x2aebf4['run'](_0x37a0e0[_0x24003b]['id'])[_0x84d6('0x5a')](ut['logger2'](_0x84d6('0x5b')))[_0x84d6('0x5c')](ut[_0x84d6('0x5d')](_0x84d6('0x5b')));}else{rpcDb['disableContact'](_0x37a0e0[_0x24003b]['id']);}}else{var _0x1aae95=new Action(_0x37a0e0[_0x24003b],_0x32223a);_0x1aae95['starttime']=moment()[_0x84d6('0x5e')](_0x84d6('0x5f'));_0x32223a[_0x84d6('0x60')]+=0x1;ut['logCustomer'](_0x1aae95,0x17,'RecallInQueue');if(_0x32223a[_0x84d6('0x61')]){rpcDb['rescheduleContactInQueue'](ut['createBody'](_0x37a0e0[_0x24003b]));rpcDb['createCustomerHistory'](_0x1aae95,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x1aae95,0x16,_0x84d6('0x62'));rpcDb['createCustomerHistory'](_0x1aae95,_0x84d6('0x63'));rpcDb[_0x84d6('0x64')](_0x1aae95,_0x84d6('0x63'));}}}}})[_0x84d6('0x5c')](ut[_0x84d6('0x5d')](_0x84d6('0x65')));};Preview[_0x84d6('0x36')][_0x84d6('0x3e')]=function(_0x3e06d9){_0x3e06d9['sendMessageOneNotActive']=!![];if(ut['IsNotLoggedIn'](_0x3e06d9[_0x84d6('0x66')])){_0x3e06d9[_0x84d6('0x67')]=utils[_0x84d6('0x30')][_0x84d6('0x68')];}else if(!ut[_0x84d6('0x69')](_0x3e06d9[_0x84d6('0x3d')])){_0x3e06d9[_0x84d6('0x67')]=utils[_0x84d6('0x30')][_0x84d6('0x31')];}else if(!this[_0x84d6('0x6a')](_0x3e06d9[_0x84d6('0x6b')])){if(!this[_0x84d6('0x6a')](_0x3e06d9[_0x84d6('0x6c')])){_0x3e06d9['message']=utils[_0x84d6('0x30')][_0x84d6('0x6d')];}else{_0x3e06d9['message']=utils['CAMPAIGN_STATUS'][_0x84d6('0x6e')];}}else{_0x3e06d9[_0x84d6('0x67')]=utils[_0x84d6('0x30')]['ACTIVE'];}};Preview[_0x84d6('0x36')][_0x84d6('0x6f')]=function(_0x43a428,_0xce42,_0x28efd0){var _0x56e7b4=this;var _0x496199=this[_0x84d6('0x42')][_0xce42];var _0x3a6566=this[_0x84d6('0x12')][_0x496199[_0x84d6('0x4f')]];var _0x5535e8;var _0x39bb33=![];var _0x472bae=0x2;var _0x4d9b6f=0x3;if(_0x3a6566){switch(_0x28efd0){case'1':_0x3a6566[_0x84d6('0x70')]+=0x1;_0x496199['countnosuchnumberretry']+=0x1;_0x496199[_0x84d6('0x71')]=ut['totalGlobal'](_0x496199);ut[_0x84d6('0x72')](_0x496199,0x0,'NoSuchNumber');ami[_0x84d6('0x2a')](_0x84d6('0x73'),ut[_0x84d6('0x74')](_0x496199,_0x84d6('0x75')));rpcDb[_0x84d6('0x76')](_0x496199,_0x84d6('0x77'));_0x56e7b4[_0x84d6('0x78')](_0x496199,'0',_0x3a6566)[_0x84d6('0x5a')](function(_0x45eced){_0x39bb33=_0x45eced[_0x84d6('0x79')]==0x1;_0x472bae=_0x3a6566[_0x84d6('0x7a')];_0x4d9b6f=_0x3a6566[_0x84d6('0x7b')];if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566['dialGlobalMaxRetry']){_0x5535e8=ut[_0x84d6('0x7d')](_0x496199,0xf,_0x84d6('0x7e'));rpcDb[_0x84d6('0x64')](_0x5535e8,_0x84d6('0x7f'));}else{if(_0x496199[_0x84d6('0x80')]>=_0x3a6566[_0x84d6('0x81')]){rpcDb[_0x84d6('0x64')](_0x496199,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb['rescheduleContact'](ut[_0x84d6('0x82')](_0x496199,_0x84d6('0x80'),_0x3a6566[_0x84d6('0x7a')]),_0x496199[_0x84d6('0x83')],_0x496199[_0x84d6('0x84')]);}}delete this[_0x84d6('0x42')][_0x43a428[_0x84d6('0x85')]];}else{_0x496199[_0x84d6('0x80')]++;logger[_0x84d6('0x26')](_0x84d6('0x86'),_0x496199['countnosuchnumberretry']);logger[_0x84d6('0x26')]('id',_0x496199[_0x84d6('0x87')]);_0x56e7b4[_0x84d6('0x88')]({'id':_0x496199[_0x84d6('0x87')],'field':{'countnosuchnumberretry':_0x496199[_0x84d6('0x80')]}})[_0x84d6('0x5a')](function(){_0x56e7b4[_0x84d6('0x89')](_0x496199,_0x472bae,_0x4d9b6f)[_0x84d6('0x5a')](function(){});});}});break;case'ANSWER':var _0x13af5c=moment()['format'](_0x84d6('0x5f'));_0x496199[_0x84d6('0x8a')]=_0x13af5c;_0x496199[_0x84d6('0x8b')]=_0x13af5c;_0x496199[_0x84d6('0x45')]=!![];_0x3a6566['pTalking']+=0x1;logger[_0x84d6('0x26')]('[syncHangup][talking][increment]',_0x496199[_0x84d6('0x8c')],_0x84d6('0x8d'),_0x3a6566[_0x84d6('0x33')],'pTalking:\x20',_0x3a6566[_0x84d6('0x2e')]);ami[_0x84d6('0x2a')](_0x84d6('0x8e'),ut[_0x84d6('0x74')](_0x496199,_0x84d6('0x8f'),this['campaignsPreview'][_0x496199[_0x84d6('0x4f')]]));if(_0x3a6566[_0x84d6('0x90')]){ami['emit'](_0x84d6('0x91'),ut[_0x84d6('0x92')](_0x496199));}break;case'16':ami[_0x84d6('0x2a')]('custom:agentcomplete',ut[_0x84d6('0x74')](_0x496199,_0x84d6('0x93'),this[_0x84d6('0x12')][_0x496199[_0x84d6('0x4f')]]));emitVoiceQueueChannelRemove(ut[_0x84d6('0x74')](_0x496199,_0x84d6('0x93')));_0x3a6566[_0x84d6('0x94')]+=0x1;_0x3a6566['total']+=0x1;_0x3a6566['answered']+=0x1;ut[_0x84d6('0x4e')](_0x3a6566,_0x84d6('0x95'));_0x496199[_0x84d6('0x71')]=ut[_0x84d6('0x7c')](_0x496199);ut['logCustomer'](_0x496199,0x4,_0x84d6('0x96'));rpcDb[_0x84d6('0x76')](_0x496199,_0x84d6('0x97'));rpcDb['createCustomerFinal'](_0x496199,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x84d6('0x98')](_0x496199);_0x3a6566[_0x84d6('0x99')]+=_0x496199[_0x84d6('0x9a')];_0x3a6566['sumBillable']+=_0x496199['talktime'];logger[_0x84d6('0x26')](_0x84d6('0x9b'),_0x496199[_0x84d6('0x8c')],'\x20Queue',_0x3a6566[_0x84d6('0x33')],_0x84d6('0x44'),_0x3a6566[_0x84d6('0x2e')]);delete this[_0x84d6('0x42')][_0x43a428[_0x84d6('0x85')]];break;case _0x84d6('0x9c'):_0x3a6566[_0x84d6('0x9d')]+=0x1;_0x496199[_0x84d6('0x9e')]+=0x1;_0x496199['countglobal']=ut[_0x84d6('0x7c')](_0x496199);ut['logCustomer'](_0x496199,0x5,_0x84d6('0x9f'));_0x472bae=_0x3a6566['dialBusyRetryFrequency'];_0x4d9b6f=_0x3a6566['callAdditionalPhoneAfterMin'];ami[_0x84d6('0x2a')](_0x84d6('0xa0'),ut[_0x84d6('0x74')](_0x496199,'busy'));rpcDb[_0x84d6('0x76')](_0x496199,_0x84d6('0xa1'));_0x56e7b4[_0x84d6('0x78')](_0x496199,'5',_0x3a6566)[_0x84d6('0x5a')](function(_0x27b368){_0x39bb33=_0x27b368[_0x84d6('0x79')]==0x1;if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566[_0x84d6('0xa2')]){_0x5535e8=ut[_0x84d6('0x7d')](_0x496199,0xf,'Global');rpcDb[_0x84d6('0x64')](_0x5535e8,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x496199[_0x84d6('0x9e')]>=_0x3a6566[_0x84d6('0xa3')]){rpcDb['createCustomerFinal'](_0x496199,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x84d6('0xa4')](ut['scheduledAt'](_0x496199,_0x84d6('0x9e'),_0x3a6566[_0x84d6('0xa5')]),_0x496199['unlockAgent'],_0x496199['activeContact']);}}}else{_0x496199[_0x84d6('0x9e')]++;_0x56e7b4[_0x84d6('0x88')]({'id':_0x496199[_0x84d6('0x87')],'field':{'countbusyretry':_0x496199['countbusyretry']}})[_0x84d6('0x5a')](function(){_0x56e7b4[_0x84d6('0x89')](_0x496199,_0x472bae,_0x4d9b6f)[_0x84d6('0x5a')](function(){});});}});break;case _0x84d6('0xa6'):_0x3a6566[_0x84d6('0xa7')]+=0x1;_0x496199[_0x84d6('0xa8')]+=0x1;_0x496199[_0x84d6('0x71')]=ut['totalGlobal'](_0x496199);ut['logCustomer'](_0x496199,0x3,'NoAnswer');_0x472bae=_0x3a6566[_0x84d6('0xa9')];_0x4d9b6f=_0x3a6566[_0x84d6('0x7b')];var _0x509294=ut[_0x84d6('0xaa')](_0x496199,_0x3a6566);ami['emit']('custom:agentnoanswer',_0x509294);rpcDb[_0x84d6('0x76')](_0x496199,_0x84d6('0xab'));_0x56e7b4[_0x84d6('0x78')](_0x496199,'3',_0x3a6566)[_0x84d6('0x5a')](function(_0x204a23){_0x39bb33=_0x204a23[_0x84d6('0x79')]==0x1;if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566['dialGlobalMaxRetry']){_0x5535e8=ut[_0x84d6('0x7d')](_0x496199,0xf,_0x84d6('0x7e'));rpcDb[_0x84d6('0x64')](_0x5535e8,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x496199[_0x84d6('0xa8')]>=_0x3a6566[_0x84d6('0xac')]){rpcDb[_0x84d6('0x64')](_0x496199,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x84d6('0xa4')](ut[_0x84d6('0x82')](_0x496199,_0x84d6('0xa8'),_0x3a6566[_0x84d6('0xa9')]),_0x496199[_0x84d6('0x83')],_0x496199[_0x84d6('0x84')]);}}}else{_0x496199[_0x84d6('0xa8')]++;_0x56e7b4[_0x84d6('0x88')]({'id':_0x496199[_0x84d6('0x87')],'field':{'countnoanswerretry':_0x496199[_0x84d6('0xa8')]}})[_0x84d6('0x5a')](function(){_0x56e7b4[_0x84d6('0x89')](_0x496199,_0x472bae,_0x4d9b6f)[_0x84d6('0x5a')](function(){});});}});break;case'CONGESTION':_0x3a6566[_0x84d6('0xad')]+=0x1;_0x496199[_0x84d6('0xae')]+=0x1;_0x496199[_0x84d6('0x71')]=ut[_0x84d6('0x7c')](_0x496199);ut[_0x84d6('0x72')](_0x496199,0x8,_0x84d6('0xaf'));_0x472bae=_0x3a6566[_0x84d6('0xb0')];_0x4d9b6f=_0x3a6566[_0x84d6('0x7b')];ami[_0x84d6('0x2a')](_0x84d6('0xb1'),ut[_0x84d6('0x74')](_0x496199,_0x84d6('0xb2')));rpcDb[_0x84d6('0x76')](_0x496199,_0x84d6('0xb3'));_0x56e7b4[_0x84d6('0x78')](_0x496199,'8',_0x3a6566)[_0x84d6('0x5a')](function(_0x153fef){_0x39bb33=_0x153fef[_0x84d6('0x79')]==0x1;if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566[_0x84d6('0xa2')]){_0x5535e8=ut['cloneAction'](_0x496199,0xf,_0x84d6('0x7e'));rpcDb[_0x84d6('0x64')](_0x5535e8,_0x84d6('0xb4'));}else{if(_0x496199['countcongestionretry']>=_0x3a6566[_0x84d6('0xb5')]){rpcDb[_0x84d6('0x64')](_0x496199,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x84d6('0x82')](_0x496199,'countcongestionretry',_0x3a6566[_0x84d6('0xa5')]),_0x496199[_0x84d6('0x83')],_0x496199['activeContact']);}}}else{_0x496199['countcongestionretry']++;_0x56e7b4[_0x84d6('0x88')]({'id':_0x496199[_0x84d6('0x87')],'field':{'countcongestionretry':_0x496199['countcongestionretry']}})[_0x84d6('0x5a')](function(){_0x56e7b4[_0x84d6('0x89')](_0x496199,_0x472bae,_0x4d9b6f)[_0x84d6('0x5a')](function(){});});}});break;case _0x84d6('0xb6'):_0x3a6566[_0x84d6('0xb7')]+=0x1;_0x496199[_0x84d6('0xb8')]+=0x1;_0x496199[_0x84d6('0x71')]=ut[_0x84d6('0x7c')](_0x496199);ut['logCustomer'](_0x496199,0x14,_0x84d6('0xb9'));_0x472bae=_0x3a6566['dialAgentRejectRetryFrequency'];_0x4d9b6f=_0x3a6566[_0x84d6('0x7b')];ami[_0x84d6('0x2a')]('custom:agentreject',ut[_0x84d6('0x74')](_0x496199,_0x84d6('0xba')));rpcDb['createCustomerHistory'](_0x496199,'[syncHangupRequest][logAgentReject]');_0x56e7b4['verifyAdditionalPhones'](_0x496199,'20',_0x3a6566)[_0x84d6('0x5a')](function(_0x2f5ca4){_0x39bb33=_0x2f5ca4[_0x84d6('0x79')]==0x1;if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566['dialGlobalMaxRetry']){_0x5535e8=ut[_0x84d6('0x7d')](_0x496199,0x14,_0x84d6('0xb9'));rpcDb['createCustomerFinal'](_0x5535e8,_0x84d6('0xbb'));}else{if(_0x496199[_0x84d6('0xb8')]>=_0x3a6566['dialAgentRejectMaxRetry']){rpcDb[_0x84d6('0x64')](_0x496199,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x84d6('0xa4')](ut[_0x84d6('0x82')](_0x496199,'countagentrejectretry',_0x3a6566[_0x84d6('0xbc')]),_0x496199[_0x84d6('0x83')],_0x496199[_0x84d6('0x84')]);}}}else{_0x496199[_0x84d6('0xa8')]++;_0x56e7b4[_0x84d6('0x88')]({'id':_0x496199[_0x84d6('0x87')],'field':{'countnoanswerretry':_0x496199[_0x84d6('0xa8')]}})[_0x84d6('0x5a')](function(){_0x56e7b4[_0x84d6('0x89')](_0x496199,_0x472bae,_0x4d9b6f)[_0x84d6('0x5a')](function(){});});}});break;case _0x84d6('0xbd'):_0x3a6566[_0x84d6('0xbe')]+=0x1;_0x496199[_0x84d6('0xbf')]+=0x1;_0x496199[_0x84d6('0x71')]=ut[_0x84d6('0x7c')](_0x496199);ut[_0x84d6('0x72')](_0x496199,0xb,_0x84d6('0xc0'));rpcDb[_0x84d6('0x76')](_0x496199,_0x84d6('0xc1'));_0x56e7b4[_0x84d6('0x78')](_0x496199,'11',_0x3a6566)[_0x84d6('0x5a')](function(_0x15d32f){_0x39bb33=_0x15d32f['additional']==0x1;if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566['dialGlobalMaxRetry']){_0x5535e8=ut[_0x84d6('0x7d')](_0x496199,0xf,_0x84d6('0x7e'));rpcDb[_0x84d6('0x64')](_0x5535e8,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x496199['countabandonedetry']>=_0x3a6566[_0x84d6('0xc2')]){rpcDb[_0x84d6('0x64')](_0x496199,_0x84d6('0xc1'));}else{rpcDb['rescheduleContact'](ut[_0x84d6('0x82')](_0x496199,_0x84d6('0xbf'),_0x3a6566[_0x84d6('0xc3')]),_0x496199[_0x84d6('0x83')],_0x496199['activeContact']);}}}else{_0x496199[_0x84d6('0xa8')]++;_0x56e7b4[_0x84d6('0x88')]({'id':_0x496199[_0x84d6('0x87')],'field':{'countnoanswerretry':_0x496199[_0x84d6('0xa8')]}})[_0x84d6('0x5a')](function(){_0x56e7b4[_0x84d6('0x89')](_0x496199,_0x472bae,_0x4d9b6f)['then'](function(){});});}});break;case'18':_0x3a6566[_0x84d6('0xc4')]+=0x1;_0x496199['countmachineretry']+=0x1;_0x496199[_0x84d6('0x71')]=ut['totalGlobal'](_0x496199);ut[_0x84d6('0x72')](_0x496199,0x12,_0x43a428[_0x84d6('0xc5')]||_0x43a428[_0x84d6('0xc6')]);ami['emit'](_0x84d6('0xc7'),ut[_0x84d6('0x74')](_0x496199,_0x84d6('0xc8')));rpcDb[_0x84d6('0x76')](_0x496199,'[callProgressDetectingCustomer][hangupInAMD]');_0x56e7b4['verifyAdditionalPhones'](_0x496199,'18',_0x3a6566)[_0x84d6('0x5a')](function(_0x5082c5){_0x39bb33=_0x5082c5[_0x84d6('0x79')]==0x1;if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566['dialGlobalMaxRetry']){_0x5535e8=ut[_0x84d6('0x7d')](_0x496199,0x12,_0x84d6('0x7e'));rpcDb[_0x84d6('0x64')](_0x5535e8,_0x84d6('0xc9'));}else{rpcDb['createCustomerFinal'](_0x496199,_0x84d6('0xc9'));}}else{_0x496199['countnoanswerretry']++;_0x56e7b4[_0x84d6('0x88')]({'id':_0x496199[_0x84d6('0x87')],'field':{'countnoanswerretry':_0x496199[_0x84d6('0xa8')]}})[_0x84d6('0x5a')](function(){_0x56e7b4[_0x84d6('0x89')](_0x496199,_0x472bae,_0x4d9b6f)[_0x84d6('0x5a')](function(){});});}});delete this[_0x84d6('0x42')][_0x43a428[_0x84d6('0x85')]];break;case'19':_0x3a6566[_0x84d6('0xc4')]+=0x1;_0x496199[_0x84d6('0x71')]=ut[_0x84d6('0x7c')](_0x496199);ut[_0x84d6('0x72')](_0x496199,0x13,_0x43a428[_0x84d6('0xc5')]||_0x43a428[_0x84d6('0xc6')]);ami[_0x84d6('0x2a')](_0x84d6('0xc7'),ut[_0x84d6('0x74')](_0x496199,_0x84d6('0xc8')));rpcDb['createCustomerHistory'](_0x496199,_0x84d6('0xca'));_0x56e7b4[_0x84d6('0x78')](_0x496199,'18',_0x3a6566)[_0x84d6('0x5a')](function(_0x4d9c73){_0x39bb33=_0x4d9c73[_0x84d6('0x79')]==0x1;if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566['dialGlobalMaxRetry']){_0x5535e8=ut[_0x84d6('0x7d')](_0x496199,0xf,'Global');rpcDb[_0x84d6('0x64')](_0x5535e8,'[callProgressDetectingCustomer][machine]');}else{rpcDb[_0x84d6('0x64')](_0x496199,_0x84d6('0xca'));}}else{_0x496199['countnoanswerretry']++;_0x56e7b4[_0x84d6('0x88')]({'id':_0x496199[_0x84d6('0x87')],'field':{'countnoanswerretry':_0x496199[_0x84d6('0xa8')]}})[_0x84d6('0x5a')](function(){_0x56e7b4[_0x84d6('0x89')](_0x496199,_0x472bae,_0x4d9b6f)[_0x84d6('0x5a')](function(){});});}});delete this[_0x84d6('0x42')][_0x43a428[_0x84d6('0x85')]];break;default:if(_0x496199['dialAnswer']){ut[_0x84d6('0x4e')](_0x3a6566,_0x84d6('0xcb'));ut[_0x84d6('0x50')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x3a6566[_0x84d6('0x33')],_0x43a428);}_0x3a6566[_0x84d6('0xc4')]+=0x1;_0x496199[_0x84d6('0x71')]=ut[_0x84d6('0x7c')](_0x496199);ut[_0x84d6('0x72')](_0x496199,0xc,_0x43a428[_0x84d6('0xc5')]||_0x43a428['dialstatus']);_0x472bae=_0x3a6566[_0x84d6('0xbc')];_0x4d9b6f=_0x3a6566[_0x84d6('0x7b')];rpcDb[_0x84d6('0x76')](_0x496199,_0x84d6('0xcc'));_0x56e7b4['verifyAdditionalPhones'](_0x496199,'20',_0x3a6566)['then'](function(_0x5cf9a2){_0x39bb33=_0x5cf9a2['additional']==0x1;if(!_0x39bb33){if(ut[_0x84d6('0x7c')](_0x496199)>=_0x3a6566['dialGlobalMaxRetry']){_0x5535e8=ut[_0x84d6('0x7d')](_0x496199,0xf,'Global');rpcDb[_0x84d6('0x64')](_0x5535e8,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x84d6('0x64')](_0x496199,_0x84d6('0xcd'));}delete this[_0x84d6('0x42')][_0x43a428[_0x84d6('0x85')]];}else{_0x56e7b4['swapAdditionalPhones'](_0x496199,_0x472bae,_0x4d9b6f)['then'](function(){});}});}if(!(_0x496199['dialAnswer']&&_0x28efd0==='16')){ut['updateOriginated'](_0x3a6566,_0x84d6('0xce'));logger['info']('[originated][decrement][callProgressDetectingCustomer]',_0x496199[_0x84d6('0x8c')],_0x84d6('0x8d'),_0x3a6566[_0x84d6('0x33')],_0x84d6('0xcf'),_0x3a6566[_0x84d6('0x2d')]);}if(_0x28efd0!==_0x84d6('0xd0')){delete this[_0x84d6('0x42')][_0x43a428[_0x84d6('0x85')]];delete this[_0x84d6('0x42')][_0x43a428[_0x84d6('0xd1')]];}_0x3a6566[_0x84d6('0xd2')]=!![];}};Preview['prototype'][_0x84d6('0xd3')]=function(_0x2f3fa8,_0x59e593,_0x175064){if(_[_0x84d6('0xd4')](_0x59e593)&&_0x84d6('0xd5')!==typeof _0x59e593){return;}if(_['isUndefined'](_0x175064)&&_0x84d6('0xd5')!==typeof _0x175064){return;}switch(_0x175064[_0x84d6('0xd6')]){case'0':ut[_0x84d6('0xd7')](_0x2f3fa8,0x0,_0x84d6('0xd8'));rpcDb[_0x84d6('0xd9')](_0x2f3fa8,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x84d6('0xd7')](_0x2f3fa8,0x3,_0x84d6('0xda'));rpcDb['createAgentHistory'](_0x2f3fa8,_0x84d6('0xdb'));break;case'5':ut['logAgent'](_0x2f3fa8,0x5,'Busy');rpcDb[_0x84d6('0xd9')](_0x2f3fa8,'[callProgressDetectingAgent][logBusy]');break;case'8':ut[_0x84d6('0xd7')](_0x2f3fa8,0x8,_0x84d6('0xaf'));rpcDb[_0x84d6('0xd9')](_0x2f3fa8,_0x84d6('0xdc'));break;case'22':ut[_0x84d6('0xd7')](_0x2f3fa8,0x16,'AnswerAGI');rpcDb[_0x84d6('0xd9')](_0x2f3fa8,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x84d6('0xd7')](_0x2f3fa8,0xc,_0x175064['reason']);rpcDb['createAgentHistory'](_0x2f3fa8,_0x84d6('0xdc'));}ut[_0x84d6('0xdd')](_0x59e593,_0x84d6('0xde'));logger['info']('[originated][decrement][callProgressDetectingAgent]',_0x2f3fa8['uniqueid'],_0x84d6('0x8d'),_0x59e593['name'],'originated:\x20',_0x59e593[_0x84d6('0x2d')]);delete this[_0x84d6('0x42')][_0x2f3fa8[_0x84d6('0x8c')]];};Preview[_0x84d6('0x36')]['verifyAdditionalPhones']=function(_0x3c126e,_0xecb52c,_0x37b023){return cmHopperAdditionalPhone[_0x84d6('0x78')](_0x3c126e,_0xecb52c,_0x37b023)[_0x84d6('0x5c')](logger[_0x84d6('0x26')](_0x84d6('0xdf')));};Preview['prototype']['swapAdditionalPhones']=function(_0x298509,_0x33ad48,_0x7fbb69){return cmHopperAdditionalPhone[_0x84d6('0x89')](_0x298509,_0x33ad48,_0x7fbb69)[_0x84d6('0x5c')](logger['info'](_0x84d6('0xe0')));};Preview[_0x84d6('0x36')]['incrementPreviewCounters']=function(_0x48a23f){return Promise[_0x84d6('0xe1')]()[_0x84d6('0x5a')](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x48a23f))['catch'](logger[_0x84d6('0x26')](_0x84d6('0xe2')));};Preview[_0x84d6('0x36')]['checkInBlack']=function(_0xa64d52,_0x5de32e,_0x5f21b2,_0x4213ca,_0x52ef1d){var _0x5e8a2=this;return new Promise(function(_0x40093b,_0x3cfb93){if(_[_0x84d6('0x41')](_0x5de32e)||_['isNil'](_0x5de32e[_0x84d6('0xe3')])||_[_0x84d6('0x41')](_0x5de32e['phone'])||_['isNil'](_0x5de32e[_0x84d6('0x48')])){_0x3cfb93(ut[_0x84d6('0x67')]('Contact\x20is\x20undefined',_0x4213ca,_0x52ef1d));return;}var _0x469aff=uuid['v4']();var _0x5c0148=_0x5e8a2['campaignsPreview'][_0x5de32e[_0x84d6('0xe4')]['name']];var _0x2663dc=_0x5f21b2?_0x5e8a2[_0x84d6('0x15')][_0x5f21b2]['id']:undefined;_0x5e8a2[_0x84d6('0x42')][_0x469aff]=new Action(_0x5de32e,_0x5c0148,_0x469aff,_0x5f21b2,_0x2663dc);var _0x161769=_0x5e8a2['actions'][_0x469aff];_0x161769[_0x84d6('0x83')]=_0x4213ca;_0x161769[_0x84d6('0x84')]=_0x52ef1d;_0x161769['lookAgent']=_0x5f21b2;if(_['isEmpty'](_0xa64d52)){_0x5e8a2[_0x84d6('0xe5')](_0x161769,_0x5c0148,_0x5de32e,_0x5f21b2)['then'](function(_0x64ef28){logger[_0x84d6('0x26')]('[Preview][execCall][success]',_0x84d6('0xe6')+_0x161769['queue']+_0x84d6('0xe7')+_0x161769['idContact'],JSON[_0x84d6('0x28')](_0x64ef28));ami[_0x84d6('0x2a')](_0x84d6('0xe8'),ut[_0x84d6('0x74')](_0x161769,_0x84d6('0xe9'),_0x5e8a2[_0x84d6('0x12')][_0x161769[_0x84d6('0x4f')]]));_0x40093b(ut[_0x84d6('0x67')]('Calling'));})['catch'](function(_0x4ec4a9){ut['logger'](_0x84d6('0xea'),_0x4ec4a9);_0x3cfb93(ut['message']('Call\x20failed',_0x4213ca,_0x52ef1d));});}else{_0x5c0148[_0x84d6('0xeb')]+=0x1;ut[_0x84d6('0xec')](_0x161769);rpcDb[_0x84d6('0xed')](_0x161769,_0x84d6('0xee'));delete _0x5e8a2[_0x84d6('0x42')][_0x469aff];_0x3cfb93(ut[_0x84d6('0x67')]('Contact\x20in\x20black\x20List',_0x4213ca,_0x52ef1d));}});};Preview[_0x84d6('0x36')][_0x84d6('0x6a')]=function(_0x1f88e0){return!_[_0x84d6('0x41')](_0x1f88e0)&&!_['isNil'](_0x1f88e0[_0x84d6('0x33')])&&!_[_0x84d6('0x41')](_0x1f88e0[_0x84d6('0xef')])&&_0x1f88e0[_0x84d6('0xef')]&&!_[_0x84d6('0x41')](this[_0x84d6('0x14')][util['format'](_0x84d6('0xf0'),_0x1f88e0[_0x84d6('0x33')])])&&!_[_0x84d6('0x41')](this['trunks'][util[_0x84d6('0x5e')](_0x84d6('0xf0'),_0x1f88e0[_0x84d6('0x33')])][_0x84d6('0x4b')])&&(this[_0x84d6('0x14')][util['format'](_0x84d6('0xf0'),_0x1f88e0[_0x84d6('0x33')])][_0x84d6('0x4b')]==='reachable'||this[_0x84d6('0x14')][util[_0x84d6('0x5e')](_0x84d6('0xf0'),_0x1f88e0['name'])]['status']===_0x84d6('0xf1'));};Preview[_0x84d6('0x36')]['run']=function(_0x5b0b08,_0xdd6b34){return this[_0x84d6('0xf2')](_0x5b0b08,_0xdd6b34)['then'](function(_0x500918){return _[_0x84d6('0x46')](_0x500918,[_0x84d6('0x67')]);})[_0x84d6('0x5c')](function(_0x3264ba){if(_0x3264ba['unlock']){rpcDb[_0x84d6('0xf3')](_0x5b0b08);}if(_0x3264ba['active']){rpcDb[_0x84d6('0xf4')](_0x5b0b08);}throw _[_0x84d6('0x46')](_0x3264ba,[_0x84d6('0x67')]);});};Preview['prototype']['execRun']=function(_0x399f79,_0x25fdf4){var _0x26c378=this;var _0x41a719,_0x1d21ac;return rpcDb[_0x84d6('0xf5')](_0x399f79)[_0x84d6('0x5a')](function(_0x2adb4a){if(!_[_0x84d6('0x41')](_0x2adb4a[0x0])){_0x1d21ac=_0x2adb4a[0x0]['recallme']?![]:!![];_0x41a719=_0x2adb4a[0x0][_0x84d6('0xf6')]?!![]:![];_0x41a719=_0x25fdf4?!![]:_0x41a719;}var _0x313153=_0x26c378[_0x84d6('0xf7')](_0x2adb4a);if(_0x313153['isValid']){rpcDb['checkIsBlackList'](_[_0x84d6('0x46')](_0x2adb4a[0x0],[_0x84d6('0x48'),_0x84d6('0xf8')]))[_0x84d6('0x5a')](function(_0x360eb1){_0x26c378[_0x84d6('0xf9')](_0x360eb1,_0x2adb4a[0x0],_0x25fdf4,_0x1d21ac,_0x41a719)[_0x84d6('0x5a')](function(_0x160b24){return _0x160b24;})[_0x84d6('0x5c')](function(_0x35c55c){throw _0x35c55c;});})[_0x84d6('0x5c')](function(_0x5ac8c0){ut[_0x84d6('0x34')]('[Preview][checkIsBlackList]',_0x5ac8c0);throw ut['message'](_0x84d6('0xfa'),_0x1d21ac,_0x41a719);});}else{throw ut[_0x84d6('0x67')](_0x313153[_0x84d6('0x67')],_0x1d21ac,_0x41a719);}})['catch'](function(_0x3a0947){ut[_0x84d6('0x34')]('[Preview][getContactPreview]',_0x3a0947);throw ut['message']('Call\x20unsuccessful',![],!![]);});};Preview[_0x84d6('0x36')][_0x84d6('0xf7')]=function(_0x25f9c1){if(_[_0x84d6('0x41')](_0x25f9c1)||_[_0x84d6('0xfb')](_0x25f9c1)||!_[_0x84d6('0x41')](_0x25f9c1[0x0]['Agent'])&&_[_0x84d6('0x41')](_0x25f9c1[0x0][_0x84d6('0xfc')][_0x84d6('0x33')])){ut[_0x84d6('0x34')](_0x84d6('0xfd'),_0x25f9c1);return{'isValid':![],'message':_0x84d6('0xfe')};}var _0x552c1c=this['campaignsPreview'][_0x25f9c1[0x0][_0x84d6('0xe4')][_0x84d6('0x33')]];_0x552c1c[_0x84d6('0x67')]=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x84d6('0x41')](_0x552c1c)){ut[_0x84d6('0x34')](_0x84d6('0xff'),_0x552c1c);return{'isValid':![],'message':_0x84d6('0x100')};}if(!this[_0x84d6('0x6a')](_0x552c1c[_0x84d6('0x6b')])){ut[_0x84d6('0x34')](_0x84d6('0x101'),'campaign\x20Name:\x20'+_0x552c1c[_0x84d6('0x33')]+_0x84d6('0x102'));if(!this[_0x84d6('0x6a')](_0x552c1c[_0x84d6('0x6c')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x552c1c[_0x84d6('0x33')]+_0x84d6('0x103'));return{'isValid':![],'message':_0x84d6('0x104')};}}if(!ut[_0x84d6('0x69')](_0x552c1c['dialActive'])){ut[_0x84d6('0x34')](_0x84d6('0x105'),_0x552c1c['name']+_0x84d6('0x106'));return{'isValid':![],'message':_0x84d6('0x107')+_0x552c1c[_0x84d6('0x33')]+_0x84d6('0x106')};}return{'isValid':!![],'message':_0x84d6('0x108')};};Preview[_0x84d6('0x36')][_0x84d6('0xe5')]=function(_0x384dae,_0xc612,_0xc5737c,_0x568aa9){var _0x29f928=this;return new Promise(function(_0x44d817,_0x32d43e){var _0x1c882f=_0x384dae[_0x84d6('0x8c')];var _0x47f82e=_0x29f928[_0x84d6('0x6a')](_0xc612[_0x84d6('0x6b')])?util['format'](_0x84d6('0x109'),_0xc612['Trunk'][_0x84d6('0x33')],_[_0x84d6('0x41')](_0xc612['dialPrefix'])?'':_0xc612['dialPrefix'][_0x84d6('0x10a')]()||'',_0xc612[_0x84d6('0x10b')]>0x0?_0xc5737c[_0x84d6('0xf8')][_0x84d6('0x10c')](_0xc612[_0x84d6('0x10b')]):_0xc5737c[_0x84d6('0xf8')]):util[_0x84d6('0x5e')](_0x84d6('0x109'),_[_0x84d6('0x41')](_0xc612[_0x84d6('0x6c')])?_0xc612[_0x84d6('0x6b')][_0x84d6('0x33')]:_0xc612[_0x84d6('0x6c')][_0x84d6('0x33')],_['isNil'](_0xc612[_0x84d6('0x10d')])?'':_0xc612[_0x84d6('0x10d')][_0x84d6('0x10a')]()||'',_0xc612[_0x84d6('0x10b')]>0x0?_0xc5737c[_0x84d6('0xf8')][_0x84d6('0x10c')](_0xc612[_0x84d6('0x10b')]):_0xc5737c['phone']);var _0x5771fa=_0x29f928[_0x84d6('0x6a')](_0xc612[_0x84d6('0x6b')])?ut[_0x84d6('0x10e')](_0xc612[_0x84d6('0x6b')]['callerid'],_0xc612[_0x84d6('0x10f')],_0xc612[_0x84d6('0x110')]>0x0?ut[_0x84d6('0x111')](_0xc612[_0x84d6('0x112')],_0xc612[_0x84d6('0x110')]):_0xc612['dialOriginateCallerIdNumber']):ut[_0x84d6('0x10e')](_[_0x84d6('0x41')](_0xc612[_0x84d6('0x6c')])?_0xc612[_0x84d6('0x6b')]['callerid']:_0xc612[_0x84d6('0x6c')]['callerid'],_0xc612[_0x84d6('0x10f')],_0xc612[_0x84d6('0x110')]>0x0?ut[_0x84d6('0x111')](_0xc612[_0x84d6('0x112')],_0xc612[_0x84d6('0x110')]):_0xc612[_0x84d6('0x112')]);if(_0x5771fa){_0x384dae['originatecalleridname']=ut[_0x84d6('0x113')](_0x5771fa);_0x384dae['originatecalleridnum']=ut['extractCalleridNumber'](_0x5771fa);}var _0x56bb3b=ut[_0x84d6('0x114')](_0xc612,_0xc5737c,_0x47f82e,_0x5771fa,_0x1c882f,_0x384dae);var _0xdd381c=utils['setXMDContactVariables'](_0xc5737c[_0x84d6('0xe3')]);Object[_0x84d6('0x115')](_0x56bb3b,_0xdd381c);_[_0x84d6('0x116')](_0x384dae,ut[_0x84d6('0x117')](_0x56bb3b));_0x384dae['starttime']=moment()[_0x84d6('0x5e')](_0x84d6('0x5f'));_0xc612[_0x84d6('0x118')]=_0x56bb3b;var _0x12dc4d=ut[_0x84d6('0x119')](_0x384dae,_0xc612,_0x56bb3b,_0x384dae[_0x84d6('0x84')],_0x568aa9);return ami[_0x84d6('0x4a')](_0x12dc4d)[_0x84d6('0x5a')](function(_0x3bf63b){_0xc612[_0x84d6('0x2d')]+=0x1;logger['info'](_0x84d6('0x11a'),_0x1c882f,_0x84d6('0x8d'),_0xc612[_0x84d6('0x33')],'originated:\x20',_0xc612[_0x84d6('0x2d')]);_0x44d817(_0x3bf63b);})[_0x84d6('0x5c')](function(_0x4810eb){ut[_0x84d6('0xd7')](_0x384dae,0xe,_0x84d6('0x11b'));rpcDb['createAgentHistory'](_0x384dae,'[originateFailure][logOriginateFailure]');_0x32d43e(_0x4810eb);});});};Preview[_0x84d6('0x36')][_0x84d6('0x1f')]=function(_0x4784e5){if(this[_0x84d6('0x42')][_0x4784e5[_0x84d6('0x85')]]){this[_0x84d6('0x42')][_0x4784e5[_0x84d6('0x85')]][_0x84d6('0x11c')]=_0x4784e5[_0x84d6('0x11c')];}};Preview['prototype']['syncOriginateResponse']=function(_0x19fe02){var _0xd81c4=this;var _0x4c91f3=this['actions'][_0x19fe02[_0x84d6('0x11d')]];if(_0x4c91f3){if(_0x4c91f3[_0x84d6('0x11e')]&&this['agents'][_0x4c91f3[_0x84d6('0x11e')]]){ut['logLookAgent'](_0x4c91f3,this[_0x84d6('0x15')][_0x4c91f3[_0x84d6('0x11e')]]['name'],this[_0x84d6('0x15')][_0x4c91f3[_0x84d6('0x11e')]]['id']);}var _0x54a8c6=_[_0x84d6('0x11f')](_0x4c91f3);_0x54a8c6[_0x84d6('0x8a')]=moment()[_0x84d6('0x5e')](_0x84d6('0x5f'));var _0x24e549=_0xd81c4[_0x84d6('0x12')][_0x4c91f3[_0x84d6('0x4f')]];if(ut[_0x84d6('0x120')](_0x19fe02['response'])){if(_0x4c91f3[_0x84d6('0x83')]){rpcDb[_0x84d6('0xf3')](_0x4c91f3[_0x84d6('0x87')]);}if(_0x4c91f3[_0x84d6('0x84')]){rpcDb[_0x84d6('0xf4')](_0x4c91f3[_0x84d6('0x87')]);}ami[_0x84d6('0x2a')](_0x84d6('0x121'),ut[_0x84d6('0x74')](_0x4c91f3,_0x84d6('0x122'),this['campaignsPreview'][_0x4c91f3[_0x84d6('0x4f')]]));this[_0x84d6('0xd3')](_0x54a8c6,_0x24e549,_0x19fe02);}else{_0x4c91f3[_0x84d6('0x123')]=moment()[_0x84d6('0x5e')](_0x84d6('0x5f'));ut[_0x84d6('0xd7')](_0x54a8c6,0x4,_0x84d6('0x96'));rpcDb[_0x84d6('0xd9')](_0x54a8c6,_0x84d6('0x124'));}}};Preview['prototype'][_0x84d6('0x1b')]=function(_0x3942fe){var _0x1bf8ea=this[_0x84d6('0x42')][_0x3942fe[_0x84d6('0x85')]];var _0x2c45e1;if(_0x1bf8ea){_0x2c45e1=this[_0x84d6('0x12')][_0x1bf8ea[_0x84d6('0x4f')]];logger[_0x84d6('0x26')](_0x84d6('0x125'),_0x3942fe[_0x84d6('0x85')],_0x84d6('0x8d'),_0x2c45e1['name'],'pTalking:\x20',_0x2c45e1[_0x84d6('0x2e')]);}if(this['actions'][_0x3942fe[_0x84d6('0x85')]]&&_0x3942fe[_0x84d6('0x85')]!==_0x3942fe['uniqueid']){if(_0x3942fe[_0x84d6('0x126')]==='16'&&this[_0x84d6('0x42')][_0x3942fe[_0x84d6('0x85')]][_0x84d6('0x45')]){this[_0x84d6('0x6f')](_0x3942fe,_0x3942fe['linkedid'],_0x3942fe[_0x84d6('0x126')]);}else if(this[_0x84d6('0x42')][_0x3942fe[_0x84d6('0x85')]][_0x84d6('0x45')]){logger[_0x84d6('0x26')](_0x84d6('0x127'),_0x3942fe[_0x84d6('0x85')],_0x3942fe[_0x84d6('0x126')],_0x84d6('0x8d'),_0x2c45e1[_0x84d6('0x33')],_0x84d6('0x44'),_0x2c45e1[_0x84d6('0x2e')]);this['callProgressDetectingCustomer'](_0x3942fe,_0x3942fe[_0x84d6('0x85')],_0x3942fe[_0x84d6('0x126')]);}}else if(_0x1bf8ea&&_[_0x84d6('0x41')](_0x1bf8ea[_0x84d6('0x128')])&&_0x2c45e1[_0x84d6('0x129')]&&_0x3942fe['linkedid']===_0x3942fe[_0x84d6('0x8c')]&&_[_0x84d6('0x41')](_0x3942fe[_0x84d6('0xd6')])&&_0x3942fe[_0x84d6('0x126')]==='16'&&_0x3942fe['channelstate']==='6'&&_['isUndefined'](_0x1bf8ea[_0x84d6('0x12a')])){if(_0x1bf8ea[_0x84d6('0x83')]){rpcDb[_0x84d6('0xf3')](_0x1bf8ea[_0x84d6('0x87')]);}if(_0x1bf8ea['activeContact']){rpcDb[_0x84d6('0xf4')](_0x1bf8ea['idContact']);}_0x3942fe[_0x84d6('0xd6')]='22';this['callProgressDetectingAgent'](_0x1bf8ea,_0x2c45e1,_0x3942fe);}else if(_0x1bf8ea&&_0x1bf8ea[_0x84d6('0x12a')]){if(_0x3942fe['cause']==='16'&&this['actions'][_0x3942fe['linkedid']][_0x84d6('0x45')]){logger[_0x84d6('0x26')](_0x84d6('0x12b'),_0x3942fe['linkedid'],_0x3942fe[_0x84d6('0x126')],_0x84d6('0x8d'),_0x2c45e1['name'],'pTalking:\x20',_0x2c45e1[_0x84d6('0x2e')]);this[_0x84d6('0x6f')](_0x3942fe,_0x3942fe[_0x84d6('0x85')],_0x3942fe[_0x84d6('0x126')]);}else if(this[_0x84d6('0x42')][_0x3942fe[_0x84d6('0x85')]]['dialAnswer']){logger['info'](_0x84d6('0x127'),_0x3942fe[_0x84d6('0x85')],_0x3942fe[_0x84d6('0x126')],_0x84d6('0x8d'),_0x2c45e1[_0x84d6('0x33')],_0x84d6('0x44'),_0x2c45e1[_0x84d6('0x2e')]);this['callProgressDetectingCustomer'](_0x3942fe,_0x3942fe[_0x84d6('0x85')],_0x3942fe[_0x84d6('0x126')]);}}};Preview[_0x84d6('0x36')][_0x84d6('0x1e')]=function(_0x433e0f){if(this[_0x84d6('0x42')][_0x433e0f[_0x84d6('0xd1')]]&&_0x433e0f[_0x84d6('0xd1')]!==_0x433e0f[_0x84d6('0x12c')]){this['callProgressDetectingCustomer'](_0x433e0f,_0x433e0f[_0x84d6('0xd1')],_0x433e0f['dialstatus']);}};Preview['prototype']['syncHangupRequest']=function(_0x54115d){if(this[_0x84d6('0x42')][_0x54115d[_0x84d6('0x85')]]&&_0x54115d[_0x84d6('0x85')]!==_0x54115d[_0x84d6('0x8c')]&&!this[_0x84d6('0x42')][_0x54115d[_0x84d6('0x85')]][_0x84d6('0x45')]){if(_0x54115d[_0x84d6('0x126')]==='1'){this[_0x84d6('0x6f')](_0x54115d,_0x54115d[_0x84d6('0x85')],_0x54115d[_0x84d6('0x126')]);}}};Preview[_0x84d6('0x36')][_0x84d6('0x12d')]=function(_0xc8f16,_0x38670f,_0x19cc93){if(this['actions'][_0xc8f16]){if(_['isNil'](this['actions'][_0xc8f16][_0x84d6('0x118')])){this[_0x84d6('0x42')][_0xc8f16][_0x84d6('0x118')]={};}this['actions'][_0xc8f16][_0x84d6('0x118')][_0x38670f]=_0x19cc93;}};Preview[_0x84d6('0x36')][_0x84d6('0x20')]=function(_0x30de6a){try{if(!_['isNil'](_0x30de6a)){if(ut[_0x84d6('0x12e')](_[_0x84d6('0x12f')](_0x30de6a[_0x84d6('0x130')])[0x0])){this[_0x84d6('0x12d')](_0x30de6a['uniqueid'],_['keys'](_0x30de6a[_0x84d6('0x130')])[0x0],_0x30de6a[_0x84d6('0x131')]);}}}catch(_0x7d205a){logger[_0x84d6('0x132')](_0x84d6('0x133'),util[_0x84d6('0x134')](_0x7d205a,{'showHidden':![],'depth':null}));}};Preview[_0x84d6('0x36')][_0x84d6('0x22')]=function(_0x457e84){if(_0x457e84){if(this[_0x84d6('0x42')][_0x457e84[_0x84d6('0x135')]]){this['actions'][_0x457e84['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x84d6('0x36')][_0x84d6('0x24')]=function(_0xdbbf2e){if(_0xdbbf2e){if(this[_0x84d6('0x42')][_0xdbbf2e[_0x84d6('0x136')]]){this[_0x84d6('0x42')][_0xdbbf2e[_0x84d6('0x136')]][_0x84d6('0x12a')]=!![];}}};module[_0x84d6('0x137')]=Preview;
\ No newline at end of file
+var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x4b6393,_0x16a365){var _0x28f412=function(_0x393192){while(--_0x393192){_0x4b6393['push'](_0x4b6393['shift']());}};_0x28f412(++_0x16a365);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview;
\ No newline at end of file
index 1584480..e94ba1d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xebba=['queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','assigned','resolve','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x2241f7,_0x431edb){var _0x18726b=function(_0x43fa70){while(--_0x43fa70){_0x2241f7['push'](_0x2241f7['shift']());}};_0x18726b(++_0x431edb);}(_0xebba,0x11a));var _0xaebb=function(_0x46dfce,_0x514cf1){_0x46dfce=_0x46dfce-0x0;var _0x5d81b2=_0xebba[_0x46dfce];return _0x5d81b2;};'use strict';var util=require(_0xaebb('0x0'));var BPromise=require(_0xaebb('0x1'));var logger=require('../../../config/logger')(_0xaebb('0x2'));var cmHopper=require(_0xaebb('0x3'));var cmHopperHistory=require(_0xaebb('0x4'));var cmHopperBlack=require(_0xaebb('0x5'));var agentReportPreview=require(_0xaebb('0x6'));var voiceQueueReport=require(_0xaebb('0x7'));function loggerCatch(_0x304eed){return function(_0x3fbadb){logger[_0xaebb('0x8')](_0x304eed,util[_0xaebb('0x9')](_0x3fbadb,{'showHidden':![],'depth':null}));};}function create(_0x5f255f){return cmHopperHistory[_0xaebb('0xa')](_0x5f255f)[_0xaebb('0xb')](loggerCatch(_0xaebb('0xc')));}function createAgent(_0x2d2b6c){return BPromise['resolve']()[_0xaebb('0xd')](agentReportPreview[_0xaebb('0xa')](_0x2d2b6c))[_0xaebb('0xb')](loggerCatch(_0xaebb('0xc')));}function moveContact(_0x37e436){return cmHopper[_0xaebb('0xe')](_0x37e436,!![])[_0xaebb('0xb')](loggerCatch(_0xaebb('0xf')));}exports['checkIsBlackList']=function(_0x5df197){return cmHopperBlack[_0xaebb('0x10')](_0x5df197)[_0xaebb('0xb')](loggerCatch(_0xaebb('0x11')));};exports['getContactPreview']=function(_0x1be9b1){return BPromise['resolve']()[_0xaebb('0xd')](cmHopper[_0xaebb('0x12')](_0x1be9b1))[_0xaebb('0xb')](loggerCatch(_0xaebb('0x13')));};exports[_0xaebb('0xa')]=function(_0x397016,_0x2caaf8){create(_0x397016)[_0xaebb('0xb')](loggerCatch(_0x2caaf8));moveContact(_0x397016)[_0xaebb('0xb')](loggerCatch(_0x2caaf8));};exports[_0xaebb('0x14')]=function(_0x47a6e7,_0x3534a4){createAgent(_0x47a6e7)[_0xaebb('0xb')](loggerCatch(_0x3534a4));};exports[_0xaebb('0x15')]=function(_0x4e4d4e,_0x3072f4){create(_0x4e4d4e)[_0xaebb('0xb')](loggerCatch(_0x3072f4));};exports[_0xaebb('0x16')]=function(_0x1ac70d,_0xcf989a){moveContact(_0x1ac70d)[_0xaebb('0xb')](loggerCatch(_0xcf989a));};exports[_0xaebb('0x17')]=function(_0x288488,_0x3cbbe6,_0x3150d7){if(_0x3cbbe6){_0x288488['UserId']=null;}if(_0x3150d7){_0x288488[_0xaebb('0x18')]=![];}return cmHopper[_0xaebb('0x17')](_0x288488)[_0xaebb('0xb')](loggerCatch(_0xaebb('0x19')));};exports[_0xaebb('0x1a')]=function(_0x2cab61){return cmHopper[_0xaebb('0x1a')](_0x2cab61)[_0xaebb('0xb')](loggerCatch('[countReScheduled]\x20'));};exports[_0xaebb('0x1b')]=function(_0x50e889){return cmHopper['unlockContact']({'UserId':null},_0x50e889,0x1)[_0xaebb('0xb')](loggerCatch(_0xaebb('0x1c')));};exports[_0xaebb('0x1d')]=function(_0x3c3ee5){return cmHopper[_0xaebb('0x1b')]({'active':![]},_0x3c3ee5,0x1)['catch'](loggerCatch(_0xaebb('0x1e')));};exports['crateCustomerReportQueue']=function(_0x2c479d){var _0x45dece={};_0x45dece[_0xaebb('0x1f')]=_0x2c479d[_0xaebb('0x1f')];_0x45dece[_0xaebb('0x20')]=_0x2c479d[_0xaebb('0x20')];_0x45dece[_0xaebb('0x21')]=_0x2c479d[_0xaebb('0x21')];_0x45dece[_0xaebb('0x22')]=_0x2c479d['calleridname'];_0x45dece[_0xaebb('0x23')]=_0x2c479d['queue'];_0x45dece['queuecallerjoinAt']=_0x2c479d['answertime'];_0x45dece[_0xaebb('0x24')]=_0x2c479d[_0xaebb('0x25')];_0x45dece[_0xaebb('0x26')]=0x1;_0x45dece[_0xaebb('0x27')]=_0x2c479d['endtime'];_0x45dece[_0xaebb('0x28')]=_0x2c479d[_0xaebb('0x29')];_0x45dece[_0xaebb('0x2a')]=_0xaebb('0x2b');_0x45dece[_0xaebb('0x2c')]=_0xaebb('0x2d');_0x45dece['holdtime']=0x0;_0x45dece[_0xaebb('0x2e')]=0x1;_0x45dece['lastAssignedTo']=_0x2c479d['membername'];_0x45dece['queuecallerexitreason']='COMPLETED';return BPromise[_0xaebb('0x2f')]()[_0xaebb('0xd')](voiceQueueReport['create'](_0x45dece))[_0xaebb('0xb')](loggerCatch(_0xaebb('0x30')));};exports[_0xaebb('0x31')]=function(_0xf340aa,_0x243aae){return BPromise[_0xaebb('0x2f')]()[_0xaebb('0xd')](cmHopper['getContactRecallMe'](_0xf340aa,_0x243aae))[_0xaebb('0xb')](loggerCatch(_0xaebb('0x32')));};exports[_0xaebb('0x33')]=function(_0x5e4029){return cmHopper[_0xaebb('0x17')](_0x5e4029,!![],!![])[_0xaebb('0xb')](loggerCatch(_0xaebb('0x34')));};
\ No newline at end of file
+var _0xef06=['[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','endtime','connectedlinename','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','bluebird','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','disableContact'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0xef06,0x17f));var _0x6ef0=function(_0x375325,_0x57a850){_0x375325=_0x375325-0x0;var _0x228f57=_0xef06[_0x375325];return _0x228f57;};'use strict';var util=require('util');var BPromise=require(_0x6ef0('0x0'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0x6ef0('0x1'));var cmHopperHistory=require(_0x6ef0('0x2'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x6ef0('0x3'));function loggerCatch(_0x5adb12){return function(_0x5e3644){logger[_0x6ef0('0x4')](_0x5adb12,util[_0x6ef0('0x5')](_0x5e3644,{'showHidden':![],'depth':null}));};}function create(_0x4d5da6){return cmHopperHistory['createHistory'](_0x4d5da6)[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x7')));}function createAgent(_0x1e3958){return BPromise[_0x6ef0('0x8')]()[_0x6ef0('0x9')](agentReportPreview[_0x6ef0('0xa')](_0x1e3958))[_0x6ef0('0x6')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x165484){return cmHopper[_0x6ef0('0xb')](_0x165484,!![])[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0xc')));}exports[_0x6ef0('0xd')]=function(_0x219a63){return cmHopperBlack[_0x6ef0('0xd')](_0x219a63)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x6ef0('0xe')]=function(_0xd59874){return BPromise[_0x6ef0('0x8')]()[_0x6ef0('0x9')](cmHopper[_0x6ef0('0xe')](_0xd59874))[_0x6ef0('0x6')](loggerCatch('[getContactPreview]\x20'));};exports[_0x6ef0('0xa')]=function(_0x1c700d,_0xc5644f){create(_0x1c700d)[_0x6ef0('0x6')](loggerCatch(_0xc5644f));moveContact(_0x1c700d)[_0x6ef0('0x6')](loggerCatch(_0xc5644f));};exports[_0x6ef0('0xf')]=function(_0x411793,_0x2b8cd5){createAgent(_0x411793)['catch'](loggerCatch(_0x2b8cd5));};exports[_0x6ef0('0x10')]=function(_0x43076b,_0x27a882){create(_0x43076b)[_0x6ef0('0x6')](loggerCatch(_0x27a882));};exports[_0x6ef0('0x11')]=function(_0x39072b,_0x7eb6fc){moveContact(_0x39072b)[_0x6ef0('0x6')](loggerCatch(_0x7eb6fc));};exports[_0x6ef0('0x12')]=function(_0x54763d,_0x4c31aa,_0x892cc7){if(_0x4c31aa){_0x54763d[_0x6ef0('0x13')]=null;}if(_0x892cc7){_0x54763d[_0x6ef0('0x14')]=![];}return cmHopper[_0x6ef0('0x12')](_0x54763d)[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x15')));};exports['countReScheduled']=function(_0x396a72){return cmHopper[_0x6ef0('0x16')](_0x396a72)[_0x6ef0('0x6')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x1f9809){return cmHopper[_0x6ef0('0x17')]({'UserId':null},_0x1f9809,0x1)[_0x6ef0('0x6')](loggerCatch('[unlockContact]\x20'));};exports[_0x6ef0('0x18')]=function(_0x5d8b50){return cmHopper[_0x6ef0('0x17')]({'active':![]},_0x5d8b50,0x1)[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x19')));};exports[_0x6ef0('0x1a')]=function(_0x26140d){var _0x56af1d={};_0x56af1d[_0x6ef0('0x1b')]=_0x26140d[_0x6ef0('0x1b')];_0x56af1d['uniqueid']=_0x26140d[_0x6ef0('0x1c')];_0x56af1d[_0x6ef0('0x1d')]=_0x26140d[_0x6ef0('0x1d')];_0x56af1d['calleridname']=_0x26140d[_0x6ef0('0x1e')];_0x56af1d[_0x6ef0('0x1f')]=_0x26140d[_0x6ef0('0x1f')];_0x56af1d[_0x6ef0('0x20')]=_0x26140d['answertime'];_0x56af1d['queuecallerleaveAt']=_0x26140d[_0x6ef0('0x21')];_0x56af1d[_0x6ef0('0x22')]=0x1;_0x56af1d['queuecallercompleteAt']=_0x26140d[_0x6ef0('0x23')];_0x56af1d[_0x6ef0('0x24')]=_0x26140d['membername'];_0x56af1d[_0x6ef0('0x25')]=_0x6ef0('0x26');_0x56af1d['exten']=_0x6ef0('0x27');_0x56af1d[_0x6ef0('0x28')]=0x0;_0x56af1d[_0x6ef0('0x29')]=0x1;_0x56af1d[_0x6ef0('0x2a')]=_0x26140d[_0x6ef0('0x2b')];_0x56af1d[_0x6ef0('0x2c')]=_0x6ef0('0x2d');return BPromise[_0x6ef0('0x8')]()[_0x6ef0('0x9')](voiceQueueReport[_0x6ef0('0x2e')](_0x56af1d))[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x2f')));};exports[_0x6ef0('0x30')]=function(_0x2ff1ec,_0x120833){return BPromise[_0x6ef0('0x8')]()[_0x6ef0('0x9')](cmHopper[_0x6ef0('0x30')](_0x2ff1ec,_0x120833))[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x31')));};exports['rescheduleContactInQueue']=function(_0x4c2c3d){return cmHopper[_0x6ef0('0x12')](_0x4c2c3d,!![],!![])[_0x6ef0('0x6')](loggerCatch(_0x6ef0('0x32')));};
\ No newline at end of file
index 042d328..cfac30e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x448b=['noanswer','variables','keys','forEach','toLowerCase','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','error','inspect','logger','info','loggerError','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','state','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','statedesc','ringtime','getSeconds','UserId','logCustomer','endtime','talktime','answertime','isFailure','RECALL','uniqueid','originate','channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','Global','scheduledAt','active','add','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','interface','motionChannel','voice','mandatoryDisposition','queue','agentReadyId','not_inuse','reachable','push','getDiff','milliseconds','diff','seconds','createBody','filterKey','idContact','type','dialAnswer','membername','scheduledat','countglobal','callback','callbackuniqueid','callbackat','sipcallid','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosbridged','bridgepeer','pow','replace','random','extractCalleridName','match','extractCalleridNumber'];(function(_0x4907de,_0x5bbdc6){var _0x482054=function(_0x39ecf6){while(--_0x39ecf6){_0x4907de['push'](_0x4907de['shift']());}};_0x482054(++_0x5bbdc6);}(_0x448b,0x117));var _0xb448=function(_0x541e17,_0x361760){_0x541e17=_0x541e17-0x0;var _0x2914e6=_0x448b[_0x541e17];return _0x2914e6;};'use strict';var util=require('util');var _=require(_0xb448('0x0'));var moment=require('moment');var logger=require(_0xb448('0x1'))(_0xb448('0x2'));var ipAgi=process[_0xb448('0x3')][_0xb448('0x4')]||_0xb448('0x5');var utils=require('../../dialer/utils');exports['loggerCatch']=function(_0x3d97d8){return function(_0xd1fa58){logger[_0xb448('0x6')](_0x3d97d8,util[_0xb448('0x7')](_0xd1fa58,{'showHidden':![],'depth':null}));};};exports[_0xb448('0x8')]=function(_0x2b1825,_0x367f62){logger[_0xb448('0x9')](_0x2b1825,util[_0xb448('0x7')](_0x367f62,{'showHidden':![],'depth':null}));};exports[_0xb448('0xa')]=function(_0x2eb9a7,_0x58990a){logger[_0xb448('0x6')](_0x2eb9a7,util[_0xb448('0x7')](_0x58990a,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x275d55){return function(_0x20d9c8){logger['info'](_0x275d55,util[_0xb448('0x7')](_0x20d9c8,{'showHidden':![],'depth':null}));};};exports[_0xb448('0xb')]=function(_0x39c722,_0x447764,_0x3f1fc4){return{'message':_0x39c722,'unlock':_0x447764,'active':_0x3f1fc4};};exports[_0xb448('0xc')]=function(_0x493298,_0x12ac3c,_0x15bcdc){if(!_[_0xb448('0xd')](_0x15bcdc)&&_0xb448('0xe')===typeof _0x15bcdc&&!_[_0xb448('0xf')](_0x15bcdc)){if(!_['isUndefined'](_0x12ac3c)&&_0xb448('0xe')===typeof _0x12ac3c&&!_[_0xb448('0xf')](_0x12ac3c)){return util[_0xb448('0x10')](_0xb448('0x11'),_0x12ac3c,_0x15bcdc);}return util[_0xb448('0x10')](_0xb448('0x11'),_0x15bcdc,_0x15bcdc);}if(!_[_0xb448('0xd')](_0x493298)&&'string'===typeof _0x493298&&!_[_0xb448('0xf')](_0x493298)){return _0x493298;}return _0xb448('0x12');};exports[_0xb448('0x13')]=function(_0x4c272f){if(_[_0xb448('0x14')](_0x4c272f)){return![];}return _0x4c272f;};exports[_0xb448('0x15')]=function(_0x5442df,_0x54c811,_0x2efcef,_0x1a12e5,_0x426bf6,_0x3fe769){var _0x10e5cb={'XMD-QUEUE':_0x54c811['Queue']?_0x54c811[_0xb448('0x16')][_0xb448('0x17')]:'','XMD-CALLERID':_0x1a12e5,'XMD-CALLERID-PREVIEW':_0x3fe769?util['format'](_0xb448('0x11'),_0x3fe769[_0xb448('0x18')],_0x3fe769[_0xb448('0x19')]):_0x1a12e5,'XMD-DIALID':_0x426bf6,'XMD-CONTACTID':_0x54c811[_0xb448('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1a12e5,'XMD-VOICEQUEUEID':_0x54c811['VoiceQueueId'],'XMD-DIALCHANNEL':_0x2efcef,'XMD-DIALTIMEOUT':_0x5442df['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0xb448('0x10')](_0xb448('0x1b'),_0x5442df[_0xb448('0x1c')]?'g':'',_[_0xb448('0xf')](_0x5442df[_0xb448('0x1d')])?'':_0xb448('0x1e')),'XMD-DIALURL':_0x5442df[_0xb448('0x1f')]||'','XMD-AGI':_0x5442df[_0xb448('0x20')]?util[_0xb448('0x10')](_0xb448('0x21'),ipAgi,_0x5442df['dialQueueProject']):_0xb448('0x22'),'XMD-AGIAFTER':_0x5442df[_0xb448('0x1c')]?util[_0xb448('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x5442df['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x3fe769?_0x3fe769[_0xb448('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x3fe769?_0x3fe769[_0xb448('0x24')]:'','XMD-DESTINATION':_0xb448('0x25'),'SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0xb448('0xf')](_0x5442df['monitor_format'])){_0x10e5cb[util[_0xb448('0x10')]('%s',_0xb448('0x26'))]=_0x5442df[_0xb448('0x1d')];_0x10e5cb[util[_0xb448('0x10')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x426bf6;}return _0x10e5cb;};exports['toLowerVariables']=function(_0x5e7e7d){var _0x4f195b={};for(var _0x5c8e89 in _0x5e7e7d){if(_0x5e7e7d[_0xb448('0x27')](_0x5c8e89)){_0x4f195b[util['format']('%s',_[_0xb448('0x28')](_0x5c8e89))]=_0x5e7e7d[_0x5c8e89];}}return{'variables':_0x4f195b};};exports[_0xb448('0x29')]=function(_0x19b9a7,_0x504551){if(!_['isNil'](_0x19b9a7)){if(_0x19b9a7[_0xb448('0x27')]('originated')){if(_0x19b9a7[_0xb448('0x2a')]>0x0){_0x19b9a7['originated']-=0x1;}else{logger['error'](_0xb448('0x2b'),_0x504551);}}}else{logger[_0xb448('0x6')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x504551);}};exports['logBlacklist']=function(_0x340b61){var _0x2b7a83=moment()[_0xb448('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x340b61[_0xb448('0x2c')]=0xd;_0x340b61['statedesc']=_0xb448('0x2d');_0x340b61[_0xb448('0x2e')]=_0x2b7a83;_0x340b61[_0xb448('0x2f')]=_0x2b7a83;_0x340b61['endtime']=_0x2b7a83;};exports[_0xb448('0x30')]=function(_0x274ffa,_0x37cf38,_0xe6343a){var _0x2d89d0=moment()[_0xb448('0x10')](_0xb448('0x31'));_0x274ffa[_0xb448('0x2c')]=_0x37cf38;_0x274ffa[_0xb448('0x32')]=_0xe6343a;_0x274ffa['responsetime']=_0x2d89d0;_0x274ffa[_0xb448('0x33')]=utils[_0xb448('0x34')](_0x274ffa[_0xb448('0x2f')],_0x274ffa[_0xb448('0x2e')]);};exports['logLookAgent']=function(_0x2f59b9,_0x324fae,_0x276913){_0x2f59b9['membername']=_0x324fae;_0x2f59b9[_0xb448('0x35')]=_0x276913;};exports[_0xb448('0x36')]=function(_0x14c5d7,_0x70c836,_0x44e188){var _0x489d32=moment()[_0xb448('0x10')](_0xb448('0x31'));_0x14c5d7[_0xb448('0x2c')]=_0x70c836;_0x14c5d7[_0xb448('0x32')]=_0x44e188;_0x14c5d7['responsetime']=_0x14c5d7[_0xb448('0x2f')]?_0x14c5d7['responsetime']:_0x489d32;_0x14c5d7[_0xb448('0x37')]=_0x14c5d7[_0xb448('0x37')]?_0x14c5d7['endtime']:_0x489d32;_0x14c5d7[_0xb448('0x33')]=utils['getSeconds'](_0x14c5d7[_0xb448('0x2f')]||0x0,_0x14c5d7[_0xb448('0x2e')]||0x0);_0x14c5d7[_0xb448('0x38')]=_0x14c5d7['answertime']?utils['getSeconds'](_0x14c5d7['endtime'],_0x14c5d7[_0xb448('0x39')]):0x0;};exports[_0xb448('0x3a')]=function(_0x592c3f){return _0x592c3f==='Failure';};exports['variablesAction']=function(_0x2a3e30,_0x89df6b,_0x1f5f72,_0x47dd13,_0x39ce3c){var _0x1147e7=_0x47dd13?_0xb448('0x3b'):_0x2a3e30[_0xb448('0x18')];_0x1147e7=_0x39ce3c?'BOOKED':_0x1147e7;return{'actionid':_0x2a3e30[_0xb448('0x3c')],'action':_0xb448('0x3d'),'channel':_0x2a3e30[_0xb448('0x3e')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x1147e7,_0x2a3e30[_0xb448('0x19')]),'Exten':_0xb448('0x25'),'Context':_0xb448('0x3f'),'Priority':'1','variable':_0x1f5f72,'timeout':(_0x89df6b[_0xb448('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2a3e30['uniqueid']};};exports[_0xb448('0x41')]=function(_0x1fd092){return _0x1fd092[_0xb448('0x42')]+_0x1fd092[_0xb448('0x43')]+_0x1fd092[_0xb448('0x44')]+_0x1fd092[_0xb448('0x45')]+_0x1fd092['countnosuchnumberretry'];};exports['cloneAction']=function(_0x240e65){var _0x2bde2f=_['clone'](_0x240e65);_0x2bde2f[_0xb448('0x2c')]=0xf;_0x2bde2f[_0xb448('0x32')]=_0xb448('0x46');return _0x2bde2f;};exports[_0xb448('0x47')]=function(_0x2c9e60,_0x58b914,_0x15a10e){var _0x2fee61={};_0x2fee61[_0x58b914]=_0x2c9e60[_0x58b914];_0x2fee61[_0xb448('0x48')]=![];_0x2fee61['scheduledat']=moment()[_0xb448('0x49')](_0x15a10e,_0xb448('0x4a'))[_0xb448('0x10')](_0xb448('0x31'));_0x2fee61['ContactId']=_0x2c9e60['ContactId'];_0x2fee61[_0xb448('0x4b')]=_0x2c9e60['ListId'];_0x2fee61['VoiceQueueId']=_0x2c9e60[_0xb448('0x4c')]||undefined;return _0x2fee61;};exports[_0xb448('0x4d')]=function(_0xa44e9d,_0x1cff3e){if(!_[_0xb448('0x14')](_0xa44e9d)){if(_0xa44e9d[_0xb448('0x4e')]>0x0){_0xa44e9d[_0xb448('0x4e')]-=0x1;}else{logger[_0xb448('0x6')](_0x1cff3e,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0xb448('0x6')](_0x1cff3e,_0xb448('0x4f'));}};exports[_0xb448('0x50')]=function(_0x494e84){if(_0x494e84<=0x0){return!![];}return![];};function buildObj(_0x3a47b6,_0x47a6e8,_0x1f6e7c){_0x3a47b6['lastevent']=_0x47a6e8;_0x3a47b6['name']=_0x3a47b6['queue'];_0x3a47b6[_0xb448('0x51')]=_0x3a47b6[_0xb448('0x3e')];_0x3a47b6[_0xb448('0x52')]=_0xb448('0x53');if(_0x1f6e7c){_0x3a47b6[_0xb448('0x54')]=_0x1f6e7c[_0xb448('0x54')];}return _0x3a47b6;}exports['buildObj']=buildObj;exports['buildAcw']=function(_0x34851b){var _0x29560e={};_0x29560e[_0xb448('0x55')]=_0x34851b['queue'];_0x29560e[_0xb448('0x51')]=_0x34851b[_0xb448('0x3e')];_0x29560e['uniqueid']=_0x34851b[_0xb448('0x3c')];return _0x29560e;};exports[_0xb448('0x56')]=function(_0xe61808){var _0x1aacf0=[];for(var _0x3dc2df in _0xe61808){if(_0xe61808[_0xb448('0x27')](_0x3dc2df)){if(!_['isNil'](_0xe61808[_0x3dc2df])&&_0xe61808[_0x3dc2df][_0xb448('0x2c')]===_0xb448('0x57')&&_0xe61808[_0x3dc2df]['status']===_0xb448('0x58')){_0x1aacf0[_0xb448('0x59')](_0xe61808[_0x3dc2df]['id']);}}}return _0x1aacf0;};exports[_0xb448('0x5a')]=function(_0x3f45c4){var _0x30b3f2=moment()[_0xb448('0x5b')](0x0);var _0x369550=moment(_0x3f45c4)['milliseconds'](0x0);return _0x30b3f2[_0xb448('0x5c')](_0x369550,_0xb448('0x5d'));};exports[_0xb448('0x5e')]=function(_0x57b932){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x57b932[_0xb448('0x1a')],'ListId':_0x57b932[_0xb448('0x4b')],'VoiceQueueId':_0x57b932[_0xb448('0x4c')]||undefined,'CampaignId':_0x57b932['CampaignId']||undefined};};exports[_0xb448('0x5f')]=function(_0x296087){if(_0x296087==='uniqueid'||_0x296087===_0xb448('0x60')||_0x296087===_0xb448('0x55')||_0x296087===_0xb448('0x61')||_0x296087==='campaigntype'||_0x296087===_0xb448('0x62')||_0x296087===_0xb448('0x63')||_0x296087===_0xb448('0x3e')||_0x296087==='calleridname'||_0x296087===_0xb448('0x48')||_0x296087===_0xb448('0x19')||_0x296087===_0xb448('0x64')||_0x296087===_0xb448('0x42')||_0x296087===_0xb448('0x43')||_0x296087===_0xb448('0x44')||_0x296087===_0xb448('0x65')||_0x296087===_0xb448('0x66')||_0x296087===_0xb448('0x67')||_0x296087===_0xb448('0x68')||_0x296087==='recallme'||_0x296087===_0xb448('0x1a')||_0x296087===_0xb448('0x4b')||_0x296087===_0xb448('0x35')||_0x296087===_0xb448('0x4c')||_0x296087===_0xb448('0x69')||_0x296087==='xmd-voicequeueid'||_0x296087==='xmd-queue'||_0x296087===_0xb448('0x6a')||_0x296087==='xmd-listid'||_0x296087===_0xb448('0x6b')||_0x296087===_0xb448('0x6c')||_0x296087===_0xb448('0x6d')||_0x296087===_0xb448('0x6e')||_0x296087===_0xb448('0x6f')||_0x296087===_0xb448('0x70')||_0x296087===_0xb448('0x71')||_0x296087===_0xb448('0x72')||_0x296087===_0xb448('0x73')||_0x296087===_0xb448('0x74')||_0x296087===_0xb448('0x75')||_0x296087==='rtpaudioqosbridged'||_0x296087===_0xb448('0x76')||_0x296087===_0xb448('0x77')||_0x296087===_0xb448('0x78')||_0x296087===_0xb448('0x79')||_0x296087===_0xb448('0x7a')||_0x296087===_0xb448('0x7b')||_0x296087===_0xb448('0x75')||_0x296087===_0xb448('0x7c')||_0x296087==='rtpaudioqosjitter'||_0x296087===_0xb448('0x77')||_0x296087===_0xb448('0x78')||_0x296087===_0xb448('0x79')||_0x296087===_0xb448('0x7a')||_0x296087===_0xb448('0x7b')||_0x296087===_0xb448('0x7d')||_0x296087==='bridgepvtcallid'||_0x296087===_0xb448('0x2c')||_0x296087==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x49272e,_0x5eb0f2){var _0x5fbbd2,_0x1241bb,_0x3fdc5c;if(_0x5eb0f2<=0x0){_0x5eb0f2=0x1;}_0x5fbbd2=new RegExp('\x5cw{0,'+_0x5eb0f2+'}$');_0x1241bb=Math[_0xb448('0x7e')](0xa,_0x5eb0f2-0x1);_0x3fdc5c=Math[_0xb448('0x7e')](0xa,_0x5eb0f2)-0x1;return util[_0xb448('0x10')]('%s',_[_0xb448('0x7f')](_0x49272e,_0x5fbbd2,_[_0xb448('0x80')](_0x1241bb,_0x3fdc5c)));};exports[_0xb448('0x81')]=function(_0x158644){var _0xda8966=_0x158644[_0xb448('0x82')](/"(.*?)"/);return _0xda8966?_0xda8966[0x1]:_0x158644;};exports[_0xb448('0x83')]=function(_0x4a5e4e){var _0x58574f=_0x4a5e4e[_0xb448('0x82')](/<(.*?)>/);return _0x58574f?_0x58574f[0x1]:_0x4a5e4e;};function buildNoAnswerEventPayload(_0x49afdb,_0x50e100){var _0x5ca917=buildObj(_0x49afdb,_0xb448('0x84'));if(!_[_0xb448('0xf')](_0x50e100[_0xb448('0x85')])){Object[_0xb448('0x86')](_0x50e100[_0xb448('0x85')])[_0xb448('0x87')](function(_0xf42217){_0x5ca917[_0xf42217[_0xb448('0x88')]()]=_0x50e100[_0xb448('0x85')][_0xf42217];});}return _0x5ca917;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload;
\ No newline at end of file
+var _0x7840=['monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','UserId','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','timeout','countbusyretry','countcongestionretry','countnosuchnumberretry','cloneAction','Global','active','scheduledat','add','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','motionChannel','voice','reachable','getDiff','milliseconds','diff','createBody','CampaignId','filterKey','idContact','queue','type','dialAnswer','countnoanswerretry','callback','callbackuniqueid','recallme','ListId','sipcallid','xmd-voicequeueid','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','extractCalleridName','extractCalleridNumber','match','noanswer','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','../../../../config/logger','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','logger','inspect','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22'];(function(_0x221569,_0x411757){var _0x1f6056=function(_0x107dc0){while(--_0x107dc0){_0x221569['push'](_0x221569['shift']());}};_0x1f6056(++_0x411757);}(_0x7840,0x1e4));var _0x0784=function(_0x23ccd6,_0x20225a){_0x23ccd6=_0x23ccd6-0x0;var _0x59e6a7=_0x7840[_0x23ccd6];return _0x59e6a7;};'use strict';var util=require(_0x0784('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x0784('0x1'))('preview');var ipAgi=process[_0x0784('0x2')][_0x0784('0x3')]||_0x0784('0x4');var utils=require(_0x0784('0x5'));exports['loggerCatch']=function(_0x356730){return function(_0x3163df){logger[_0x0784('0x6')](_0x356730,util['inspect'](_0x3163df,{'showHidden':![],'depth':null}));};};exports[_0x0784('0x7')]=function(_0x4c6ec2,_0x470352){logger['info'](_0x4c6ec2,util[_0x0784('0x8')](_0x470352,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x4d651d,_0x4a34a7){logger[_0x0784('0x6')](_0x4d651d,util[_0x0784('0x8')](_0x4a34a7,{'showHidden':![],'depth':null}));};exports[_0x0784('0x9')]=function(_0xbde239){return function(_0x30cb9b){logger['info'](_0xbde239,util['inspect'](_0x30cb9b,{'showHidden':![],'depth':null}));};};exports[_0x0784('0xa')]=function(_0x4cebd0,_0x50c2bb,_0x4f0328){return{'message':_0x4cebd0,'unlock':_0x50c2bb,'active':_0x4f0328};};exports[_0x0784('0xb')]=function(_0x3849eb,_0x1b17ac,_0x54307d){if(!_[_0x0784('0xc')](_0x54307d)&&'string'===typeof _0x54307d&&!_['isEmpty'](_0x54307d)){if(!_[_0x0784('0xc')](_0x1b17ac)&&_0x0784('0xd')===typeof _0x1b17ac&&!_[_0x0784('0xe')](_0x1b17ac)){return util[_0x0784('0xf')](_0x0784('0x10'),_0x1b17ac,_0x54307d);}return util['format'](_0x0784('0x10'),_0x54307d,_0x54307d);}if(!_[_0x0784('0xc')](_0x3849eb)&&_0x0784('0xd')===typeof _0x3849eb&&!_[_0x0784('0xe')](_0x3849eb)){return _0x3849eb;}return'\x22\x22\x20<>';};exports[_0x0784('0x11')]=function(_0x1f9b2c){if(_[_0x0784('0x12')](_0x1f9b2c)){return![];}return _0x1f9b2c;};exports[_0x0784('0x13')]=function(_0x39f3ef,_0x48e65d,_0xcad0f2,_0x23a9e4,_0x213faa,_0x412ee4){var _0x20f05b={'XMD-QUEUE':_0x48e65d[_0x0784('0x14')]?_0x48e65d[_0x0784('0x14')]['name']:'','XMD-CALLERID':_0x23a9e4,'XMD-CALLERID-PREVIEW':_0x412ee4?util[_0x0784('0xf')](_0x0784('0x10'),_0x412ee4[_0x0784('0x15')],_0x412ee4[_0x0784('0x16')]):_0x23a9e4,'XMD-DIALID':_0x213faa,'XMD-CONTACTID':_0x48e65d[_0x0784('0x17')],'XMD-CDRTYPE':_0x0784('0x18'),'CALLERID(all)':_0x23a9e4,'XMD-VOICEQUEUEID':_0x48e65d[_0x0784('0x19')],'XMD-DIALCHANNEL':_0xcad0f2,'XMD-DIALTIMEOUT':_0x39f3ef[_0x0784('0x1a')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x0784('0x1b'),_0x39f3ef['dialQueueProject2']?'g':'',_['isEmpty'](_0x39f3ef[_0x0784('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x39f3ef[_0x0784('0x1d')]||'','XMD-AGI':_0x39f3ef[_0x0784('0x1e')]?util[_0x0784('0xf')](_0x0784('0x1f'),ipAgi,_0x39f3ef['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x39f3ef[_0x0784('0x20')]?util[_0x0784('0xf')](_0x0784('0x1f'),ipAgi,_0x39f3ef[_0x0784('0x20')]):_0x0784('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x412ee4?_0x412ee4[_0x0784('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x412ee4?_0x412ee4[_0x0784('0x23')]:'','XMD-DESTINATION':_0x0784('0x24'),'SIPADDHEADER':_0x0784('0x25')};if(!_[_0x0784('0xe')](_0x39f3ef[_0x0784('0x1c')])){_0x20f05b[util['format']('%s',_0x0784('0x26'))]=_0x39f3ef[_0x0784('0x1c')];_0x20f05b[util[_0x0784('0xf')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x213faa;}return _0x20f05b;};exports['toLowerVariables']=function(_0x2b8b2e){var _0xa1bf01={};for(var _0x3e4d7e in _0x2b8b2e){if(_0x2b8b2e[_0x0784('0x27')](_0x3e4d7e)){_0xa1bf01[util['format']('%s',_['toLower'](_0x3e4d7e))]=_0x2b8b2e[_0x3e4d7e];}}return{'variables':_0xa1bf01};};exports[_0x0784('0x28')]=function(_0x385cec,_0x2ff9e7){if(!_[_0x0784('0x12')](_0x385cec)){if(_0x385cec[_0x0784('0x27')](_0x0784('0x29'))){if(_0x385cec[_0x0784('0x29')]>0x0){_0x385cec['originated']-=0x1;}else{logger[_0x0784('0x6')](_0x0784('0x2a'),_0x2ff9e7);}}}else{logger[_0x0784('0x6')](_0x0784('0x2b'),_0x2ff9e7);}};exports['logBlacklist']=function(_0x12a6c2){var _0x344b3c=moment()[_0x0784('0xf')](_0x0784('0x2c'));_0x12a6c2[_0x0784('0x2d')]=0xd;_0x12a6c2[_0x0784('0x2e')]='Blacklist';_0x12a6c2[_0x0784('0x2f')]=_0x344b3c;_0x12a6c2[_0x0784('0x30')]=_0x344b3c;_0x12a6c2[_0x0784('0x31')]=_0x344b3c;};exports[_0x0784('0x32')]=function(_0x4862ec,_0x40e08a,_0x1ecbfc){var _0x3ff862=moment()[_0x0784('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x4862ec[_0x0784('0x2d')]=_0x40e08a;_0x4862ec[_0x0784('0x2e')]=_0x1ecbfc;_0x4862ec[_0x0784('0x30')]=_0x3ff862;_0x4862ec[_0x0784('0x33')]=utils[_0x0784('0x34')](_0x4862ec['responsetime'],_0x4862ec[_0x0784('0x2f')]);};exports[_0x0784('0x35')]=function(_0x148628,_0xa9393f,_0x49853b){_0x148628[_0x0784('0x36')]=_0xa9393f;_0x148628[_0x0784('0x37')]=_0x49853b;};exports[_0x0784('0x38')]=function(_0x371ed2,_0x1b69bb,_0x12aef7){var _0x5daee7=moment()[_0x0784('0xf')](_0x0784('0x2c'));_0x371ed2[_0x0784('0x2d')]=_0x1b69bb;_0x371ed2[_0x0784('0x2e')]=_0x12aef7;_0x371ed2[_0x0784('0x30')]=_0x371ed2[_0x0784('0x30')]?_0x371ed2[_0x0784('0x30')]:_0x5daee7;_0x371ed2['endtime']=_0x371ed2[_0x0784('0x31')]?_0x371ed2['endtime']:_0x5daee7;_0x371ed2[_0x0784('0x33')]=utils['getSeconds'](_0x371ed2['responsetime']||0x0,_0x371ed2['starttime']||0x0);_0x371ed2[_0x0784('0x39')]=_0x371ed2[_0x0784('0x3a')]?utils[_0x0784('0x34')](_0x371ed2[_0x0784('0x31')],_0x371ed2[_0x0784('0x3a')]):0x0;};exports[_0x0784('0x3b')]=function(_0x2da444){return _0x2da444===_0x0784('0x3c');};exports[_0x0784('0x3d')]=function(_0x2574ac,_0x391ae5,_0x27a092,_0x57eee2,_0x357208){var _0x2d52ec=_0x57eee2?'RECALL':_0x2574ac[_0x0784('0x15')];_0x2d52ec=_0x357208?_0x0784('0x3e'):_0x2d52ec;return{'actionid':_0x2574ac[_0x0784('0x3f')],'action':_0x0784('0x40'),'channel':_0x2574ac[_0x0784('0x41')],'callerid':util[_0x0784('0xf')](_0x0784('0x10'),_0x2d52ec,_0x2574ac[_0x0784('0x16')]),'Exten':_0x0784('0x24'),'Context':_0x0784('0x42'),'Priority':'1','variable':_0x27a092,'timeout':(_0x391ae5[_0x0784('0x43')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2574ac[_0x0784('0x3f')]};};exports['totalGlobal']=function(_0x308f13){return _0x308f13[_0x0784('0x44')]+_0x308f13[_0x0784('0x45')]+_0x308f13['countnoanswerretry']+_0x308f13['countagentrejectretry']+_0x308f13[_0x0784('0x46')];};exports[_0x0784('0x47')]=function(_0x1d580d){var _0x41fe5b=_['clone'](_0x1d580d);_0x41fe5b['state']=0xf;_0x41fe5b['statedesc']=_0x0784('0x48');return _0x41fe5b;};exports['scheduledAt']=function(_0x24f980,_0x4fa2e4,_0x4ed8b7){var _0x45bdb6={};_0x45bdb6[_0x4fa2e4]=_0x24f980[_0x4fa2e4];_0x45bdb6[_0x0784('0x49')]=![];_0x45bdb6[_0x0784('0x4a')]=moment()[_0x0784('0x4b')](_0x4ed8b7,'minutes')[_0x0784('0xf')](_0x0784('0x2c'));_0x45bdb6['ContactId']=_0x24f980['ContactId'];_0x45bdb6['ListId']=_0x24f980['ListId'];_0x45bdb6[_0x0784('0x19')]=_0x24f980['VoiceQueueId']||undefined;return _0x45bdb6;};exports['decrementTalkink']=function(_0xb0292a,_0x15c1b8){if(!_[_0x0784('0x12')](_0xb0292a)){if(_0xb0292a['pTalking']>0x0){_0xb0292a[_0x0784('0x4c')]-=0x1;}else{logger[_0x0784('0x6')](_0x15c1b8,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x15c1b8,_0x0784('0x4d'));}};exports[_0x0784('0x4e')]=function(_0x3636a3){if(_0x3636a3<=0x0){return!![];}return![];};function buildObj(_0x3229a8,_0x5a5523,_0x37b682){_0x3229a8[_0x0784('0x4f')]=_0x5a5523;_0x3229a8[_0x0784('0x50')]=_0x3229a8['queue'];_0x3229a8['interface']=_0x3229a8[_0x0784('0x41')];_0x3229a8[_0x0784('0x51')]=_0x0784('0x52');if(_0x37b682){_0x3229a8['mandatoryDisposition']=_0x37b682['mandatoryDisposition'];}return _0x3229a8;}exports['buildObj']=buildObj;exports['agentReadyId']=function(_0x400aaa){var _0x111e63=[];for(var _0x414602 in _0x400aaa){if(_0x400aaa[_0x0784('0x27')](_0x414602)){if(!_[_0x0784('0x12')](_0x400aaa[_0x414602])&&_0x400aaa[_0x414602][_0x0784('0x2d')]==='not_inuse'&&_0x400aaa[_0x414602]['status']===_0x0784('0x53')){_0x111e63['push'](_0x400aaa[_0x414602]['id']);}}}return _0x111e63;};exports[_0x0784('0x54')]=function(_0x5c856f){var _0x3377c9=moment()[_0x0784('0x55')](0x0);var _0x6f81a4=moment(_0x5c856f)[_0x0784('0x55')](0x0);return _0x3377c9[_0x0784('0x56')](_0x6f81a4,'seconds');};exports[_0x0784('0x57')]=function(_0x1fba24){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x1fba24[_0x0784('0x17')],'ListId':_0x1fba24['ListId'],'VoiceQueueId':_0x1fba24[_0x0784('0x19')]||undefined,'CampaignId':_0x1fba24[_0x0784('0x58')]||undefined};};exports[_0x0784('0x59')]=function(_0x1710e8){if(_0x1710e8===_0x0784('0x3f')||_0x1710e8===_0x0784('0x5a')||_0x1710e8===_0x0784('0x5b')||_0x1710e8===_0x0784('0x5c')||_0x1710e8==='campaigntype'||_0x1710e8===_0x0784('0x5d')||_0x1710e8===_0x0784('0x36')||_0x1710e8==='channelAgent'||_0x1710e8===_0x0784('0x15')||_0x1710e8==='active'||_0x1710e8===_0x0784('0x16')||_0x1710e8===_0x0784('0x4a')||_0x1710e8===_0x0784('0x44')||_0x1710e8===_0x0784('0x45')||_0x1710e8===_0x0784('0x5e')||_0x1710e8==='countglobal'||_0x1710e8===_0x0784('0x5f')||_0x1710e8===_0x0784('0x60')||_0x1710e8==='callbackat'||_0x1710e8===_0x0784('0x61')||_0x1710e8==='ContactId'||_0x1710e8===_0x0784('0x62')||_0x1710e8==='UserId'||_0x1710e8===_0x0784('0x19')||_0x1710e8===_0x0784('0x63')||_0x1710e8===_0x0784('0x64')||_0x1710e8==='xmd-queue'||_0x1710e8==='xmd-phone'||_0x1710e8===_0x0784('0x65')||_0x1710e8===_0x0784('0x66')||_0x1710e8===_0x0784('0x67')||_0x1710e8===_0x0784('0x68')||_0x1710e8===_0x0784('0x69')||_0x1710e8==='xmd-dialchannel'||_0x1710e8===_0x0784('0x6a')||_0x1710e8==='xmd-cdrtype'||_0x1710e8==='xmd-callerid'||_0x1710e8===_0x0784('0x6b')||_0x1710e8==='xmd-agi'||_0x1710e8===_0x0784('0x6c')||_0x1710e8===_0x0784('0x6d')||_0x1710e8===_0x0784('0x6e')||_0x1710e8===_0x0784('0x6f')||_0x1710e8==='rtpaudioqosloss'||_0x1710e8===_0x0784('0x70')||_0x1710e8===_0x0784('0x71')||_0x1710e8==='rtpaudioqosrttbridged'||_0x1710e8===_0x0784('0x6c')||_0x1710e8===_0x0784('0x6d')||_0x1710e8===_0x0784('0x6e')||_0x1710e8===_0x0784('0x6f')||_0x1710e8===_0x0784('0x72')||_0x1710e8===_0x0784('0x70')||_0x1710e8==='rtpaudioqosrtt'||_0x1710e8==='rtpaudioqosrttbridged'||_0x1710e8===_0x0784('0x73')||_0x1710e8===_0x0784('0x74')||_0x1710e8===_0x0784('0x2d')||_0x1710e8===_0x0784('0x2e')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x587e53,_0x4e09c2){var _0x50d9fd,_0x2a0d1e,_0x4a9e94;if(_0x4e09c2<=0x0){_0x4e09c2=0x1;}_0x50d9fd=new RegExp(_0x0784('0x75')+_0x4e09c2+'}$');_0x2a0d1e=Math[_0x0784('0x76')](0xa,_0x4e09c2-0x1);_0x4a9e94=Math[_0x0784('0x76')](0xa,_0x4e09c2)-0x1;return util['format']('%s',_[_0x0784('0x77')](_0x587e53,_0x50d9fd,_['random'](_0x2a0d1e,_0x4a9e94)));};exports[_0x0784('0x78')]=function(_0x425b1c){var _0x48eb91=_0x425b1c['match'](/"(.*?)"/);return _0x48eb91?_0x48eb91[0x1]:_0x425b1c;};exports[_0x0784('0x79')]=function(_0x50e355){var _0x2a5d0e=_0x50e355[_0x0784('0x7a')](/<(.*?)>/);return _0x2a5d0e?_0x2a5d0e[0x1]:_0x50e355;};function buildNoAnswerEventPayload(_0xf529d3,_0x2f5396){var _0x25a26d=buildObj(_0xf529d3,_0x0784('0x7b'));if(!_[_0x0784('0xe')](_0x2f5396[_0x0784('0x7c')])){Object['keys'](_0x2f5396['variables'])[_0x0784('0x7d')](function(_0x279800){_0x25a26d[_0x279800[_0x0784('0x7e')]()]=_0x2f5396[_0x0784('0x7c')][_0x279800];});}return _0x25a26d;}exports[_0x0784('0x7f')]=buildNoAnswerEventPayload;
\ No newline at end of file
index bcddc30..f512833 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x44e5=['voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string','number','boolean','queueremove','reload'];(function(_0x3661be,_0x47f32e){var _0x5d4104=function(_0x5692d1){while(--_0x5692d1){_0x3661be['push'](_0x3661be['shift']());}};_0x5d4104(++_0x47f32e);}(_0x44e5,0x198));var _0x544e=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x44e5[_0x119cd8];return _0x7072a3;};'use strict';exports[_0x544e('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x544e('0x1'),'required':!![]},'membername':{'type':_0x544e('0x1'),'required':!![]},'penalty':{'type':_0x544e('0x2'),'required':![]},'paused':{'type':_0x544e('0x3'),'required':![]}};exports[_0x544e('0x4')]={'queue':{'type':_0x544e('0x1'),'required':!![]},'interface':{'type':_0x544e('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x544e('0x1'),'required':!![]},'paused':{'type':_0x544e('0x3')},'reason':{'type':'string','required':![]}};exports[_0x544e('0x5')]={'module':{'type':'string','required':![]}};exports[_0x544e('0x6')]={'uniqueid':{'type':_0x544e('0x1'),'required':!![]}};exports[_0x544e('0x7')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0x544e('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0x544e('0x1')}};exports[_0x544e('0x8')]={'uniqueid':{'type':_0x544e('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x544e('0x1'),'required':!![]},'exten':{'type':_0x544e('0x1'),'required':!![]},'context':{'type':_0x544e('0x1')}};
\ No newline at end of file
+var _0xaa09=['boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0xaa09,0x105));var _0x9aa0=function(_0x4efc7c,_0x3d0c73){_0x4efc7c=_0x4efc7c-0x0;var _0x4db5f8=_0xaa09[_0x4efc7c];return _0x4db5f8;};'use strict';exports[_0x9aa0('0x0')]={'queue':{'type':_0x9aa0('0x1'),'required':!![]},'interface':{'type':_0x9aa0('0x1'),'required':!![]},'membername':{'type':_0x9aa0('0x1'),'required':!![]},'penalty':{'type':_0x9aa0('0x2'),'required':![]},'paused':{'type':_0x9aa0('0x3'),'required':![]}};exports[_0x9aa0('0x4')]={'queue':{'type':_0x9aa0('0x1'),'required':!![]},'interface':{'type':_0x9aa0('0x1'),'required':!![]}};exports[_0x9aa0('0x5')]={'interface':{'type':_0x9aa0('0x1'),'required':!![]},'paused':{'type':_0x9aa0('0x3')},'reason':{'type':_0x9aa0('0x1'),'required':![]}};exports[_0x9aa0('0x6')]={'module':{'type':_0x9aa0('0x1'),'required':![]}};exports[_0x9aa0('0x7')]={'uniqueid':{'type':_0x9aa0('0x1'),'required':!![]}};exports[_0x9aa0('0x8')]={'uniqueid':{'type':_0x9aa0('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x9aa0('0x1')},'mixmonitorid':{'type':_0x9aa0('0x1')}};exports[_0x9aa0('0x9')]={'uniqueid':{'type':_0x9aa0('0x1'),'required':!![]}};exports[_0x9aa0('0xa')]={'uniqueid':{'type':_0x9aa0('0x1'),'required':!![]},'exten':{'type':_0x9aa0('0x1'),'required':!![]},'context':{'type':_0x9aa0('0x1')}};
\ No newline at end of file
index 763f5be..c784e90 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0x0b0e[_0x32f9ca];return _0x52e083;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime;
\ No newline at end of file
+var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x160df3,_0x3b1589){var _0x3ebadc=function(_0x474b8d){while(--_0x474b8d){_0x160df3['push'](_0x160df3['shift']());}};_0x3ebadc(++_0x3b1589);}(_0xadb5,0xad));var _0x5adb=function(_0x1b5ef0,_0x486b19){_0x1b5ef0=_0x1b5ef0-0x0;var _0x3d25f3=_0xadb5[_0x1b5ef0];return _0x3d25f3;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime;
\ No newline at end of file
index 0b0b4c0..16299ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xda92=['assign','mergeDBDataToRealtime'];(function(_0x6f84d9,_0x8eb631){var _0x3305ad=function(_0x9cf5dd){while(--_0x9cf5dd){_0x6f84d9['push'](_0x6f84d9['shift']());}};_0x3305ad(++_0x8eb631);}(_0xda92,0x12a));var _0x2da9=function(_0x1a14af,_0x1eac50){_0x1a14af=_0x1a14af-0x0;var _0x45af23=_0xda92[_0x1a14af];return _0x45af23;};'use strict';function mergeDBDataToRealtime(_0x2d7790,_0x4c6cc3){var _0x27eb25=Object[_0x2da9('0x0')]({},_0x2d7790);for(var _0x503f1b in _0x4c6cc3){if(_0x27eb25['hasOwnProperty'](_0x503f1b)){_0x27eb25[_0x503f1b]=_0x4c6cc3[_0x503f1b];}}return _0x27eb25;}exports[_0x2da9('0x1')]=mergeDBDataToRealtime;
\ No newline at end of file
+var _0x6df7=['assign','hasOwnProperty'];(function(_0x155ecb,_0x3b700c){var _0x5af94f=function(_0x123d8e){while(--_0x123d8e){_0x155ecb['push'](_0x155ecb['shift']());}};_0x5af94f(++_0x3b700c);}(_0x6df7,0x154));var _0x76df=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6df7[_0x502c7d];return _0x30b7ed;};'use strict';function mergeDBDataToRealtime(_0x4dc23b,_0x54a990){var _0x5b077d=Object[_0x76df('0x0')]({},_0x4dc23b);for(var _0x3047ca in _0x54a990){if(_0x5b077d[_0x76df('0x1')](_0x3047ca)){_0x5b077d[_0x3047ca]=_0x54a990[_0x3047ca];}}return _0x5b077d;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime;
\ No newline at end of file
index 5ee0027..cbcb59f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2886=['membername','monitor','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','indexOf','mobile','phone','substring','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','agents','telephones','realtime','xdr','disabled','voiceQueueReport','bind','custom:voiceAgentReport','voiceAgentReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','findAgent','find','accountcode','name','isNil','interface','length','lastAssignedTo','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','voiceCallReport','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','destinationchannel','calleridpreview','originatecalleridnum','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','transfereelinkedid','uniqueid','linkedid','UserId'];(function(_0x79393f,_0x386b41){var _0x51e638=function(_0x2a33a3){while(--_0x2a33a3){_0x79393f['push'](_0x79393f['shift']());}};_0x51e638(++_0x386b41);}(_0x2886,0x1e8));var _0x6288=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2886[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6288('0x0'));var moment=require(_0x6288('0x1'));var util=require(_0x6288('0x2'));var config=require(_0x6288('0x3'));var ami=require(_0x6288('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x6288('0x5'));var RpcVoiceDialReport=require(_0x6288('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x6288('0x7'));var RpcVoiceTransferReport=require(_0x6288('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0x6288('0x9'));var VoiceAgentReport=require(_0x6288('0xa'));var VoiceDialReport=require(_0x6288('0xb'));var UserReport=require(_0x6288('0xc'));function Report(_0x542079){this['realtime']=_0x542079;this[_0x6288('0xd')]=_0x542079[_0x6288('0xd')];this[_0x6288('0xe')]=_0x542079['telephones'];}Report['prototype']['sync']=function(_0x344f85){var _0x270284=new VoiceQueueReport(this[_0x6288('0xf')]);var _0x597e1=new VoiceAgentReport(this['realtime']);var _0x1eef59=new VoiceDialReport(this['realtime']);var _0x3283b8=new VoiceCallReport(this['realtime']);var _0xfe686=new UserReport(this[_0x6288('0xf')]);if(config['xdr']&&config[_0x6288('0x10')][_0x6288('0x11')]){ami['on']('custom:voiceQueueReport',this[_0x6288('0x12')][_0x6288('0x13')](this));ami['on']('custom:voiceCallReport',this['voiceCallReport'][_0x6288('0x13')](this));ami['on'](_0x6288('0x14'),this[_0x6288('0x15')][_0x6288('0x13')](this));ami['on']('custom:voiceDialReport',this[_0x6288('0x16')][_0x6288('0x13')](this));ami['on'](_0x6288('0x17'),this['blindTransfer'][_0x6288('0x13')](this));ami['on'](_0x6288('0x18'),this[_0x6288('0x19')][_0x6288('0x13')](this));}};Report[_0x6288('0x1a')][_0x6288('0x1b')]=function(_0x54e1dd){var _0x376478;_0x376478=_[_0x6288('0x1c')](this[_0x6288('0xd')],function(_0xd08b8f){return _0xd08b8f[_0x6288('0x1d')]==_0x54e1dd||_0xd08b8f[_0x6288('0x1e')]==_0x54e1dd;});if(_[_0x6288('0x1f')](_0x376478)){var _0x57d911=_[_0x6288('0x1c')](this[_0x6288('0xe')],function(_0x114701){return _0x114701[_0x6288('0x1d')]==_0x54e1dd||_0x114701[_0x6288('0x1e')]==_0x54e1dd;});if(_0x57d911){_0x376478=_[_0x6288('0x1c')](this[_0x6288('0xd')],function(_0x2c0059){return _0x2c0059[_0x6288('0x20')]==util['format']('SIP/%s',_0x57d911[_0x6288('0x1e')]);});}}return _0x376478;};Report[_0x6288('0x1a')][_0x6288('0x12')]=function(_0x26a009){for(var _0xbd680f=0x0;_0xbd680f<_0x26a009[_0x6288('0x21')];_0xbd680f+=0x1){var _0x4e94c0=this[_0x6288('0x1b')](_0x26a009[_0xbd680f]['connectedlinenum']);if(_0x4e94c0){_0x26a009[_0xbd680f][_0x6288('0x1d')]=_0x4e94c0['accountcode'];_0x26a009[_0xbd680f]['assigned']=!![];_0x26a009[_0xbd680f][_0x6288('0x22')]=_0x4e94c0[_0x6288('0x1e')];_0x26a009[_0xbd680f][_0x6288('0x20')]=_[_0x6288('0x1f')](_0x4e94c0[_0x6288('0x20')])?util[_0x6288('0x23')](_0x6288('0x24'),_0x4e94c0[_0x6288('0x1e')]):_0x4e94c0[_0x6288('0x20')];if(_0x26a009[_0xbd680f][_0x6288('0x25')]){_0x26a009[_0xbd680f][_0x6288('0x26')]=moment()[_0x6288('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x26a009[_0xbd680f][_0x6288('0x27')]){_0x26a009[_0xbd680f][_0x6288('0x28')]=moment()[_0x6288('0x23')](_0x6288('0x29'));}RpcMemberReport[_0x6288('0x12')](_0x26a009[_0xbd680f]);}RpcVoiceQueueReport[_0x6288('0x2a')](_0x26a009[_0xbd680f]);}};function extractCalleridNumber(_0x33aae8){var _0xf4492a=_0x33aae8[_0x6288('0x2b')](/<(.*?)>/);return _0xf4492a?_0xf4492a[0x1]:_0x33aae8;}Report[_0x6288('0x1a')][_0x6288('0x2c')]=function(_0x1680b7){for(var _0x57727=0x0;_0x57727<Object['keys'](this['agents'])['length'];_0x57727++){var _0x19709e=Object[_0x6288('0x2d')](this[_0x6288('0xd')])[_0x57727];var _0x10eba1=this[_0x6288('0xd')][_0x19709e];if(_0x10eba1[_0x6288('0x1d')]===Number(_0x1680b7))return _0x10eba1;}return null;};Report[_0x6288('0x1a')][_0x6288('0x2e')]=function(_0x2822cf){var _0x56ee9b=_0x2822cf[_0x6288('0x2f')][_0x6288('0x30')]('-')[0x0];var _0x451220=this[_0x6288('0xd')][_0x56ee9b];if(!_0x451220)_0x451220=this[_0x6288('0x2c')](_0x2822cf[_0x6288('0x31')]);return!_0x451220?_0x6288('0x32'):'internal';};Report[_0x6288('0x1a')][_0x6288('0x33')]=function(_0x497f59){_0x497f59['destination']=_0x497f59[_0x6288('0x34')]||_0x497f59[_0x6288('0x35')];if(_0x497f59[_0x6288('0x36')]==_0x6288('0x37')){_0x497f59[_0x6288('0x38')]=_0x6288('0x39');_0x497f59[_0x6288('0x3a')]=_0x497f59['queue'];if(_0x497f59[_0x6288('0x3b')]==_0x6288('0x3c')){_0x497f59[_0x6288('0x1d')]='';_0x497f59[_0x6288('0x34')]=extractCalleridNumber(_0x497f59[_0x6288('0x3d')]);}else if(_0x497f59['context']==_0x6288('0x3e')){if(_0x497f59['destination']==_0x6288('0x3f')){_0x497f59[_0x6288('0x34')]=extractCalleridNumber(_0x497f59['calleridpreview']);_0x497f59['calleridnum']=_0x497f59['originatecalleridnum'];_0x497f59[_0x6288('0x40')]=[_0x497f59[_0x6288('0x2f')],_0x497f59[_0x6288('0x2f')]=_0x497f59[_0x6288('0x40')]][0x0];_0x497f59[_0x6288('0x3d')]=_0x497f59[_0x6288('0x41')];}else{_0x497f59[_0x6288('0x34')]=_0x497f59[_0x6288('0x31')];_0x497f59[_0x6288('0x31')]=_0x497f59[_0x6288('0x42')];if(_0x497f59['disposition']==_0x6288('0x43')){_0x497f59[_0x6288('0x1d')]=_0x497f59[_0x6288('0x44')];}else{_0x497f59[_0x6288('0x1d')]='';}}}}else{_0x497f59[_0x6288('0x3d')]=util[_0x6288('0x23')](_0x6288('0x45'),_0x497f59[_0x6288('0x46')],_0x497f59['calleridnum']);}if(RpcVoiceTransferReport[_0x6288('0x47')][_0x497f59['linkedid']]){var _0x1c077d=RpcVoiceTransferReport[_0x6288('0x47')][_0x497f59['linkedid']];_0x1c077d[_0x6288('0x48')]=_0x497f59[_0x6288('0x49')];RpcVoiceTransferReport['blindTransfer'](_0x1c077d);delete RpcVoiceTransferReport['transfers'][_0x497f59[_0x6288('0x4a')]];}if(_['isNil'](_0x497f59[_0x6288('0x36')])){_0x497f59[_0x6288('0x36')]=this['getCallType'](_0x497f59);}if(_[_0x6288('0x1f')](_0x497f59['UserId'])){var _0x235e59=_0x497f59[_0x6288('0x2f')][_0x6288('0x30')]('-')[0x0];var _0x4a6228=this['agents'][_0x235e59];if(!_0x4a6228)_0x4a6228=this[_0x6288('0x2c')](_0x497f59[_0x6288('0x1d')]);if(_0x4a6228){_0x497f59[_0x6288('0x4b')]=_0x4a6228['id'];_0x497f59[_0x6288('0x4c')]=_0x4a6228[_0x6288('0x1e')];}}RpcVoiceCallReport[_0x6288('0x2a')](_0x497f59);if(_0x497f59[_0x6288('0x4d')]){for(var _0x36ab2e=0x0;_0x36ab2e<_0x497f59[_0x6288('0x4e')][_0x6288('0x21')];_0x36ab2e+=0x1){_0x497f59['monitorFilename']=_0x497f59[_0x6288('0x4e')][_0x36ab2e][_0x6288('0x4f')];_0x497f59[_0x6288('0x50')]=_0x497f59[_0x6288('0x4e')][_0x36ab2e][_0x6288('0x50')];if(_0x497f59['exten']==_0x6288('0x3f')){_0x497f59[_0x6288('0x31')]=_0x497f59[_0x6288('0x44')];_0x497f59[_0x6288('0x46')]=_0x497f59[_0x6288('0x51')];_0x497f59[_0x6288('0x44')]=_0x497f59[_0x6288('0x1d')];_0x497f59[_0x6288('0x51')]=_0x497f59[_0x6288('0x4c')];_0x497f59[_0x6288('0x35')]=_0x497f59[_0x6288('0x42')];}else if(_0x497f59['exten']==_0x6288('0x52')){_0x497f59[_0x6288('0x31')]=_0x497f59[_0x6288('0x34')];_0x497f59[_0x6288('0x35')]=_0x497f59['originatecalleridnum'];}RpcVoiceRecording[_0x6288('0x2a')](_0x497f59);}}};Report[_0x6288('0x1a')][_0x6288('0x15')]=function(_0x41891c){if(_[_0x6288('0x53')](_0x41891c)){_0x41891c[_0x6288('0x54')](function(_0x25489c){RpcVoiceAgentReport['create'](_0x25489c);});}else{RpcVoiceAgentReport[_0x6288('0x2a')](_0x41891c);}};Report[_0x6288('0x1a')][_0x6288('0x16')]=function(_0x1c3f3d){RpcVoiceDialReport['create'](_0x1c3f3d);var _0x34028e;var _0x4b54e8;var _0x49f92f=_0x1c3f3d['channel'];if(_[_0x6288('0x55')](_0x49f92f,_0x6288('0x56'))){_0x4b54e8=_0x49f92f['substring'](_0x49f92f['indexOf']('/')+0x1,_0x49f92f[_0x6288('0x57')]('@'));_0x34028e=_[_0x6288('0x1c')](this[_0x6288('0xd')],function(_0x5d76bf){return _0x5d76bf[_0x6288('0x58')]==_0x4b54e8||_0x5d76bf[_0x6288('0x59')]==_0x4b54e8||_0x5d76bf[_0x6288('0x1d')]==_0x4b54e8;});}else{_0x4b54e8=_0x49f92f[_0x6288('0x5a')](_0x49f92f[_0x6288('0x57')]('/')+0x1,_0x49f92f[_0x6288('0x5b')]('-'));_0x34028e=this[_0x6288('0x1b')](_0x4b54e8);}if(_0x34028e){_0x1c3f3d[_0x6288('0x20')]=_[_0x6288('0x1f')](_0x34028e['interface'])?util['format'](_0x6288('0x24'),_0x34028e[_0x6288('0x1e')]):_0x34028e[_0x6288('0x20')];_0x1c3f3d[_0x6288('0x4c')]=_0x34028e[_0x6288('0x1e')];_0x1c3f3d[_0x6288('0x1d')]=_0x34028e['accountcode'];RpcMemberReport[_0x6288('0x16')](_0x1c3f3d);}};Report[_0x6288('0x1a')]['blindTransfer']=function(_0x22c09a){RpcVoiceTransferReport['transfers'][_0x22c09a[_0x6288('0x5c')]]=_0x22c09a;};Report['prototype'][_0x6288('0x19')]=function(_0xa41dfc){RpcVoiceTransferReport[_0x6288('0x19')](_0xa41dfc);};module[_0x6288('0x5d')]=Report;
\ No newline at end of file
+var _0xd606=['originatecalleridnum','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','monitor','monitors','monitorFilename','filename','connectedlinename','membername','xcally-motion-dialer','forEach','startsWith','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','./voiceQueueReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','SIP/%s','length','assigned','format','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','calleridnum','outbound','internal','destination','exten','type','dialer','lastapplication','queue','lastdata','context','from-sip','xcally-motion-preview','calleridpreview','destinationchannel','channel','callerid'];(function(_0x541a67,_0x50728d){var _0x45da2a=function(_0x158929){while(--_0x158929){_0x541a67['push'](_0x541a67['shift']());}};_0x45da2a(++_0x50728d);}(_0xd606,0x178));var _0x6d60=function(_0x7da0db,_0x1f1eac){_0x7da0db=_0x7da0db-0x0;var _0xaecdd5=_0xd606[_0x7da0db];return _0xaecdd5;};'use strict';var _=require(_0x6d60('0x0'));var moment=require(_0x6d60('0x1'));var util=require(_0x6d60('0x2'));var config=require('../../../config/environment');var ami=require(_0x6d60('0x3'));var RpcVoiceAgentReport=require(_0x6d60('0x4'));var RpcVoiceCallReport=require(_0x6d60('0x5'));var RpcVoiceDialReport=require(_0x6d60('0x6'));var RpcMemberReport=require(_0x6d60('0x7'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x6d60('0x8'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x6d60('0x9'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x6d60('0xa'));var UserReport=require(_0x6d60('0xb'));function Report(_0x4acf3e){this[_0x6d60('0xc')]=_0x4acf3e;this[_0x6d60('0xd')]=_0x4acf3e['agents'];this['telephones']=_0x4acf3e[_0x6d60('0xe')];}Report[_0x6d60('0xf')]['sync']=function(_0x23fd9e){var _0x5952a9=new VoiceQueueReport(this[_0x6d60('0xc')]);var _0x5a67aa=new VoiceAgentReport(this[_0x6d60('0xc')]);var _0x3bbb92=new VoiceDialReport(this['realtime']);var _0x57f464=new VoiceCallReport(this[_0x6d60('0xc')]);var _0x2da41b=new UserReport(this['realtime']);if(config[_0x6d60('0x10')]&&config['xdr'][_0x6d60('0x11')]){ami['on'](_0x6d60('0x12'),this[_0x6d60('0x13')]['bind'](this));ami['on'](_0x6d60('0x14'),this[_0x6d60('0x15')][_0x6d60('0x16')](this));ami['on'](_0x6d60('0x17'),this[_0x6d60('0x18')][_0x6d60('0x16')](this));ami['on'](_0x6d60('0x19'),this[_0x6d60('0x1a')][_0x6d60('0x16')](this));ami['on']('blindtransfer',this['blindTransfer'][_0x6d60('0x16')](this));ami['on'](_0x6d60('0x1b'),this[_0x6d60('0x1c')][_0x6d60('0x16')](this));}};Report[_0x6d60('0xf')][_0x6d60('0x1d')]=function(_0xd3a492){var _0x458f88;_0x458f88=_[_0x6d60('0x1e')](this[_0x6d60('0xd')],function(_0x15fea7){return _0x15fea7['accountcode']==_0xd3a492||_0x15fea7[_0x6d60('0x1f')]==_0xd3a492;});if(_[_0x6d60('0x20')](_0x458f88)){var _0x913e79=_[_0x6d60('0x1e')](this[_0x6d60('0xe')],function(_0xba43bf){return _0xba43bf[_0x6d60('0x21')]==_0xd3a492||_0xba43bf['name']==_0xd3a492;});if(_0x913e79){_0x458f88=_[_0x6d60('0x1e')](this[_0x6d60('0xd')],function(_0x418481){return _0x418481[_0x6d60('0x22')]==util['format'](_0x6d60('0x23'),_0x913e79[_0x6d60('0x1f')]);});}}return _0x458f88;};Report[_0x6d60('0xf')]['voiceQueueReport']=function(_0x2b8237){for(var _0x522144=0x0;_0x522144<_0x2b8237[_0x6d60('0x24')];_0x522144+=0x1){var _0x1a3a44=this[_0x6d60('0x1d')](_0x2b8237[_0x522144]['connectedlinenum']);if(_0x1a3a44){_0x2b8237[_0x522144]['accountcode']=_0x1a3a44['accountcode'];_0x2b8237[_0x522144][_0x6d60('0x25')]=!![];_0x2b8237[_0x522144]['lastAssignedTo']=_0x1a3a44[_0x6d60('0x1f')];_0x2b8237[_0x522144][_0x6d60('0x22')]=_['isNil'](_0x1a3a44[_0x6d60('0x22')])?util[_0x6d60('0x26')](_0x6d60('0x23'),_0x1a3a44[_0x6d60('0x1f')]):_0x1a3a44[_0x6d60('0x22')];if(_0x2b8237[_0x522144][_0x6d60('0x27')]){_0x2b8237[_0x522144]['queuecallercompleteAt']=moment()[_0x6d60('0x26')](_0x6d60('0x28'));}if(_0x2b8237[_0x522144][_0x6d60('0x29')]){_0x2b8237[_0x522144][_0x6d60('0x2a')]=moment()[_0x6d60('0x26')](_0x6d60('0x28'));}RpcMemberReport[_0x6d60('0x13')](_0x2b8237[_0x522144]);}RpcVoiceQueueReport[_0x6d60('0x2b')](_0x2b8237[_0x522144]);}};function extractCalleridNumber(_0x501e25){var _0x4a7e4f=_0x501e25[_0x6d60('0x2c')](/<(.*?)>/);return _0x4a7e4f?_0x4a7e4f[0x1]:_0x501e25;}Report[_0x6d60('0xf')][_0x6d60('0x2d')]=function(_0x309ca8){for(var _0x20882c=0x0;_0x20882c<Object['keys'](this[_0x6d60('0xd')])['length'];_0x20882c++){var _0x3eedb2=Object[_0x6d60('0x2e')](this[_0x6d60('0xd')])[_0x20882c];var _0x49fb5c=this[_0x6d60('0xd')][_0x3eedb2];if(_0x49fb5c[_0x6d60('0x21')]===Number(_0x309ca8))return _0x49fb5c;}return null;};Report[_0x6d60('0xf')]['getCallType']=function(_0x46933e){var _0x2a6bf6=_0x46933e['channel']['split']('-')[0x0];var _0x3fb49b=this['agents'][_0x2a6bf6];if(!_0x3fb49b)_0x3fb49b=this[_0x6d60('0x2d')](_0x46933e[_0x6d60('0x2f')]);return!_0x3fb49b?_0x6d60('0x30'):_0x6d60('0x31');};Report[_0x6d60('0xf')][_0x6d60('0x15')]=function(_0x1af021){_0x1af021['destination']=_0x1af021[_0x6d60('0x32')]||_0x1af021[_0x6d60('0x33')];if(_0x1af021[_0x6d60('0x34')]==_0x6d60('0x35')){_0x1af021[_0x6d60('0x36')]=_0x6d60('0x37');_0x1af021[_0x6d60('0x38')]=_0x1af021['queue'];if(_0x1af021[_0x6d60('0x39')]=='from-voip-provider'){_0x1af021[_0x6d60('0x21')]='';_0x1af021[_0x6d60('0x32')]=extractCalleridNumber(_0x1af021['callerid']);}else if(_0x1af021[_0x6d60('0x39')]==_0x6d60('0x3a')){if(_0x1af021[_0x6d60('0x32')]==_0x6d60('0x3b')){_0x1af021[_0x6d60('0x32')]=extractCalleridNumber(_0x1af021[_0x6d60('0x3c')]);_0x1af021[_0x6d60('0x2f')]=_0x1af021['originatecalleridnum'];_0x1af021[_0x6d60('0x3d')]=[_0x1af021['channel'],_0x1af021[_0x6d60('0x3e')]=_0x1af021[_0x6d60('0x3d')]][0x0];_0x1af021[_0x6d60('0x3f')]=_0x1af021[_0x6d60('0x3c')];}else{_0x1af021[_0x6d60('0x32')]=_0x1af021[_0x6d60('0x2f')];_0x1af021['calleridnum']=_0x1af021[_0x6d60('0x40')];if(_0x1af021['disposition']=='ANSWERED'){_0x1af021['accountcode']=_0x1af021[_0x6d60('0x41')];}else{_0x1af021['accountcode']='';}}}}else{_0x1af021[_0x6d60('0x3f')]=util[_0x6d60('0x26')](_0x6d60('0x42'),_0x1af021[_0x6d60('0x43')],_0x1af021[_0x6d60('0x2f')]);}if(RpcVoiceTransferReport[_0x6d60('0x44')][_0x1af021[_0x6d60('0x45')]]){var _0x4452a0=RpcVoiceTransferReport[_0x6d60('0x44')][_0x1af021[_0x6d60('0x45')]];_0x4452a0[_0x6d60('0x46')]=_0x1af021[_0x6d60('0x47')];RpcVoiceTransferReport[_0x6d60('0x48')](_0x4452a0);delete RpcVoiceTransferReport[_0x6d60('0x44')][_0x1af021['linkedid']];}if(_[_0x6d60('0x20')](_0x1af021[_0x6d60('0x34')])){_0x1af021[_0x6d60('0x34')]=this['getCallType'](_0x1af021);}if(_[_0x6d60('0x20')](_0x1af021[_0x6d60('0x49')])){var _0x57768d=_0x1af021[_0x6d60('0x3e')]['split']('-')[0x0];var _0x5c5353=this[_0x6d60('0xd')][_0x57768d];if(!_0x5c5353)_0x5c5353=this[_0x6d60('0x2d')](_0x1af021['accountcode']);if(_0x5c5353){_0x1af021[_0x6d60('0x49')]=_0x5c5353['id'];_0x1af021['membername']=_0x5c5353[_0x6d60('0x1f')];}}RpcVoiceCallReport[_0x6d60('0x2b')](_0x1af021);if(_0x1af021[_0x6d60('0x4a')]){for(var _0x4fe08d=0x0;_0x4fe08d<_0x1af021[_0x6d60('0x4b')]['length'];_0x4fe08d+=0x1){_0x1af021[_0x6d60('0x4c')]=_0x1af021[_0x6d60('0x4b')][_0x4fe08d][_0x6d60('0x4d')];_0x1af021['createdAt']=_0x1af021[_0x6d60('0x4b')][_0x4fe08d]['createdAt'];if(_0x1af021[_0x6d60('0x33')]=='xcally-motion-preview'){_0x1af021[_0x6d60('0x2f')]=_0x1af021['connectedlinenum'];_0x1af021['calleridname']=_0x1af021['connectedlinename'];_0x1af021[_0x6d60('0x41')]=_0x1af021[_0x6d60('0x21')];_0x1af021[_0x6d60('0x4e')]=_0x1af021[_0x6d60('0x4f')];_0x1af021[_0x6d60('0x33')]=_0x1af021['originatecalleridnum'];}else if(_0x1af021[_0x6d60('0x33')]==_0x6d60('0x50')){_0x1af021[_0x6d60('0x2f')]=_0x1af021[_0x6d60('0x32')];_0x1af021[_0x6d60('0x33')]=_0x1af021[_0x6d60('0x40')];}RpcVoiceRecording[_0x6d60('0x2b')](_0x1af021);}}};Report['prototype'][_0x6d60('0x18')]=function(_0x583dfa){if(_['isArray'](_0x583dfa)){_0x583dfa[_0x6d60('0x51')](function(_0x13a115){RpcVoiceAgentReport[_0x6d60('0x2b')](_0x13a115);});}else{RpcVoiceAgentReport[_0x6d60('0x2b')](_0x583dfa);}};Report[_0x6d60('0xf')][_0x6d60('0x1a')]=function(_0x5cc640){RpcVoiceDialReport['create'](_0x5cc640);var _0x1a0588;var _0x35faef;var _0x3a632f=_0x5cc640[_0x6d60('0x3e')];if(_[_0x6d60('0x52')](_0x3a632f,'Local')){_0x35faef=_0x3a632f[_0x6d60('0x53')](_0x3a632f[_0x6d60('0x54')]('/')+0x1,_0x3a632f['indexOf']('@'));_0x1a0588=_[_0x6d60('0x1e')](this[_0x6d60('0xd')],function(_0xe3f99){return _0xe3f99[_0x6d60('0x55')]==_0x35faef||_0xe3f99['phone']==_0x35faef||_0xe3f99['accountcode']==_0x35faef;});}else{_0x35faef=_0x3a632f['substring'](_0x3a632f[_0x6d60('0x54')]('/')+0x1,_0x3a632f[_0x6d60('0x56')]('-'));_0x1a0588=this[_0x6d60('0x1d')](_0x35faef);}if(_0x1a0588){_0x5cc640['interface']=_[_0x6d60('0x20')](_0x1a0588[_0x6d60('0x22')])?util['format']('SIP/%s',_0x1a0588[_0x6d60('0x1f')]):_0x1a0588[_0x6d60('0x22')];_0x5cc640[_0x6d60('0x4f')]=_0x1a0588[_0x6d60('0x1f')];_0x5cc640[_0x6d60('0x21')]=_0x1a0588[_0x6d60('0x21')];RpcMemberReport[_0x6d60('0x1a')](_0x5cc640);}};Report['prototype'][_0x6d60('0x48')]=function(_0x181803){RpcVoiceTransferReport[_0x6d60('0x44')][_0x181803[_0x6d60('0x57')]]=_0x181803;};Report[_0x6d60('0xf')][_0x6d60('0x1c')]=function(_0x505fc2){RpcVoiceTransferReport[_0x6d60('0x1c')](_0x505fc2);};module['exports']=Report;
\ No newline at end of file
index 0c74b86..f9ebd28 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b5e=['util','bluebird','../../../config/environment','../../../config/logger','ami','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','then','catch','error','[userReport][sipshowregistry]','inspect','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','name','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','toLowerCase','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','trunk:%s','startsWith','Local','substring','indexOf','mobile','phone','accountcode','peer','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','address','lodash','moment'];(function(_0x51249a,_0x166c31){var _0x392e0c=function(_0x28ecdf){while(--_0x28ecdf){_0x51249a['push'](_0x51249a['shift']());}};_0x392e0c(++_0x166c31);}(_0x8b5e,0x16b));var _0xe8b5=function(_0x1a1dec,_0x4e5a3b){_0x1a1dec=_0x1a1dec-0x0;var _0x4f211d=_0x8b5e[_0x1a1dec];return _0x4f211d;};'use strict';var _=require(_0xe8b5('0x0'));var moment=require(_0xe8b5('0x1'));var util=require(_0xe8b5('0x2'));var Redis=require('ioredis');var BPromise=require(_0xe8b5('0x3'));var config=require(_0xe8b5('0x4'));var logger=require(_0xe8b5('0x5'))(_0xe8b5('0x6'));var ami=require('../ami');config[_0xe8b5('0x7')]=_['defaults'](config[_0xe8b5('0x7')],{'host':_0xe8b5('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe8b5('0x7')]));function UserReport(_0x17de1a){this[_0xe8b5('0x9')]=_0x17de1a[_0xe8b5('0x9')];this[_0xe8b5('0xa')]=_0x17de1a[_0xe8b5('0xa')];this[_0xe8b5('0xb')]=_0x17de1a[_0xe8b5('0xb')];ami['on'](_0xe8b5('0xc'),this[_0xe8b5('0xd')]['bind'](this));ami['on']('registry',this['syncRegistry'][_0xe8b5('0xe')](this));ami['on'](_0xe8b5('0xf'),this[_0xe8b5('0x10')]['bind'](this));ami['on'](_0xe8b5('0x11'),this[_0xe8b5('0x12')][_0xe8b5('0xe')](this));return this[_0xe8b5('0x13')]();}function showSipRegistrations(){Promise[_0xe8b5('0x14')]()[_0xe8b5('0x15')](ami['actionSipShowRegistry']())[_0xe8b5('0x16')](function(_0x41ea81){logger[_0xe8b5('0x17')](_0xe8b5('0x18'),util[_0xe8b5('0x19')](_0x41ea81,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0xe8b5('0x14')]()['then'](ami[_0xe8b5('0x1a')]())['catch'](function(_0x465949){logger['error'](_0xe8b5('0x1b'),util[_0xe8b5('0x19')](_0x465949,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xe8b5('0x14')]()[_0xe8b5('0x15')](ami[_0xe8b5('0x1c')]())[_0xe8b5('0x16')](function(_0x2bb6c4){logger[_0xe8b5('0x17')](_0xe8b5('0x1d'),util[_0xe8b5('0x19')](_0x2bb6c4,{'showHidden':![],'depth':null}));});}UserReport[_0xe8b5('0x1e')][_0xe8b5('0x13')]=function(){setInterval(function(){BPromise[_0xe8b5('0x14')]()[_0xe8b5('0x15')](showSipRegistrations())[_0xe8b5('0x15')](listDeviceStates())[_0xe8b5('0x15')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0xe8b5('0x1f')]=function(_0x2a700c){return _0x2a700c!==null&&!_[_0xe8b5('0x20')](_0x2a700c);};UserReport['prototype'][_0xe8b5('0x21')]=function(_0x56c5e5,_0x9d35aa,_0x43309c){io['to'](_0x56c5e5)[_0xe8b5('0x21')](_0x9d35aa,_0x43309c);};UserReport[_0xe8b5('0x1e')][_0xe8b5('0xd')]=function(_0x115006){try{if(this[_0xe8b5('0x1f')](_0x115006)){logger[_0xe8b5('0x22')](_0xe8b5('0x23'),_0x115006[_0xe8b5('0x24')],_0x115006[_0xe8b5('0x25')]);logger[_0xe8b5('0x26')](_0xe8b5('0x27'),util[_0xe8b5('0x19')](_0x115006,{'showHidden':![],'depth':null}));var _0x187963=_[_0xe8b5('0x28')](this[_0xe8b5('0x9')],{'defaultuser':_0x115006[_0xe8b5('0x24')]});if(_0x187963){_0x115006[_0xe8b5('0x29')]=_0x115006['state'];_[_0xe8b5('0x2a')](_0x187963,_[_0xe8b5('0x2b')](_0x115006,[_0xe8b5('0x2c'),'actionid','username','state']));logger[_0xe8b5('0x26')](_0xe8b5('0x2d'),util[_0xe8b5('0x19')](_0x187963,{'showHidden':![],'depth':null}));this[_0xe8b5('0x21')](util[_0xe8b5('0x2e')]('trunk:%s',_0x187963[_0xe8b5('0x2f')]),_0xe8b5('0x30'),_0x187963);}}}catch(_0xfb5236){logger[_0xe8b5('0x17')](_0xe8b5('0x27'),util[_0xe8b5('0x19')](_0xfb5236,{'showHidden':![],'depth':null}));}};UserReport[_0xe8b5('0x1e')][_0xe8b5('0x10')]=function(_0x3056a1){try{if(this['isNotNull'](_0x3056a1)){logger[_0xe8b5('0x22')](_0xe8b5('0x31'),_0x3056a1[_0xe8b5('0x32')],_0x3056a1[_0xe8b5('0x25')]);logger[_0xe8b5('0x26')](_0xe8b5('0x33'),util[_0xe8b5('0x19')](_0x3056a1,{'showHidden':![],'depth':null}));if(this[_0xe8b5('0xa')][_0x3056a1['device']]){if(!this[_0xe8b5('0xa')][_0x3056a1[_0xe8b5('0x32')]]['local']||_0x3056a1[_0xe8b5('0x25')][_0xe8b5('0x34')]()=='inuse'){this[_0xe8b5('0xa')][_0x3056a1['device']][_0xe8b5('0x35')]=![];if(this[_0xe8b5('0xa')][_0x3056a1['device']][_0xe8b5('0x25')]!==_0x3056a1[_0xe8b5('0x25')][_0xe8b5('0x34')]()){this[_0xe8b5('0xa')][_0x3056a1[_0xe8b5('0x32')]][_0xe8b5('0x36')]=_[_0xe8b5('0x37')](moment()[_0xe8b5('0x2e')]('x'));}this[_0xe8b5('0xa')][_0x3056a1['device']]['state']=_0x3056a1[_0xe8b5('0x25')][_0xe8b5('0x34')]();this[_0xe8b5('0xa')][_0x3056a1[_0xe8b5('0x32')]][_0xe8b5('0x38')](_0x3056a1);}}else if(this['telephones'][_0x3056a1['device']]){if(this[_0xe8b5('0xb')][_0x3056a1[_0xe8b5('0x32')]][_0xe8b5('0x25')]!==_0x3056a1[_0xe8b5('0x25')]['toLowerCase']()){this['telephones'][_0x3056a1[_0xe8b5('0x32')]][_0xe8b5('0x36')]=_['toNumber'](moment()[_0xe8b5('0x2e')]('x'));}this[_0xe8b5('0xb')][_0x3056a1[_0xe8b5('0x32')]][_0xe8b5('0x25')]=_0x3056a1['state'][_0xe8b5('0x34')]();logger[_0xe8b5('0x26')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util['inspect'](this[_0xe8b5('0xb')][_0x3056a1[_0xe8b5('0x32')]],{'showHidden':![],'depth':null}));this[_0xe8b5('0x21')](util[_0xe8b5('0x2e')](_0xe8b5('0x39'),this[_0xe8b5('0xb')][_0x3056a1[_0xe8b5('0x32')]][_0xe8b5('0x2f')]),_0xe8b5('0x3a'),this['telephones'][_0x3056a1['device']]);}else if(this[_0xe8b5('0x9')][_0x3056a1[_0xe8b5('0x32')]]){if(this[_0xe8b5('0x9')][_0x3056a1[_0xe8b5('0x32')]][_0xe8b5('0x25')]!==_0x3056a1[_0xe8b5('0x25')][_0xe8b5('0x34')]()){this[_0xe8b5('0x9')][_0x3056a1[_0xe8b5('0x32')]][_0xe8b5('0x36')]=_['toNumber'](moment()[_0xe8b5('0x2e')]('x'));}this[_0xe8b5('0x9')][_0x3056a1['device']][_0xe8b5('0x25')]=_0x3056a1['state'][_0xe8b5('0x34')]();logger[_0xe8b5('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xe8b5('0x9')][_0x3056a1['device']],{'showHidden':![],'depth':null}));this['emit'](util['format'](_0xe8b5('0x3b'),this['trunks'][_0x3056a1['device']][_0xe8b5('0x2f')]),_0xe8b5('0x30'),this[_0xe8b5('0x9')][_0x3056a1[_0xe8b5('0x32')]]);}else if(_[_0xe8b5('0x3c')](_0x3056a1['device'],_0xe8b5('0x3d'))){var _0x62854d=_0x3056a1['device'];var _0x212db1=_0x62854d[_0xe8b5('0x3e')](_0x62854d[_0xe8b5('0x3f')]('/')+0x1,_0x62854d[_0xe8b5('0x3f')]('@'));var _0x2efb91=_[_0xe8b5('0x28')](this['agents'],function(_0x194704){return _0x194704[_0xe8b5('0x40')]==_0x212db1||_0x194704[_0xe8b5('0x41')]==_0x212db1||_0x194704[_0xe8b5('0x42')]==_0x212db1;});if(_0x2efb91){if(_0x2efb91[_0xe8b5('0x25')]!==_0x3056a1[_0xe8b5('0x25')][_0xe8b5('0x34')]()){_0x2efb91[_0xe8b5('0x36')]=_['toNumber'](moment()[_0xe8b5('0x2e')]('x'));}_0x2efb91[_0xe8b5('0x25')]=_0x3056a1[_0xe8b5('0x25')]['toLowerCase']();_0x2efb91[_0xe8b5('0x35')]=!![];_0x2efb91['updateStatusRealtime'](_0x3056a1);}}}}catch(_0x2e378b){logger['error'](_0xe8b5('0x33'),util[_0xe8b5('0x19')](_0x2e378b,{'showHidden':![],'depth':null}));}};UserReport[_0xe8b5('0x1e')]['syncPeerStatus']=function(_0x5e8652){try{if(this[_0xe8b5('0x1f')](_0x5e8652)&&this['isNotNull'](_0x5e8652['peerstatus'])){logger['info']('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x5e8652[_0xe8b5('0x43')],_0x5e8652['address'],_0x5e8652[_0xe8b5('0x11')]);logger[_0xe8b5('0x26')](_0xe8b5('0x44'),util['inspect'](_0x5e8652,{'showHidden':![],'depth':null}));if(this[_0xe8b5('0xa')][_0x5e8652[_0xe8b5('0x43')]]){if(!this[_0xe8b5('0xa')][_0x5e8652[_0xe8b5('0x43')]]['local']||_0x5e8652[_0xe8b5('0x11')][_0xe8b5('0x34')]()==_0xe8b5('0x45')){this[_0xe8b5('0xa')][_0x5e8652[_0xe8b5('0x43')]][_0xe8b5('0x35')]=![];this[_0xe8b5('0xa')][_0x5e8652[_0xe8b5('0x43')]][_0xe8b5('0x46')]=_0x5e8652[_0xe8b5('0x11')][_0xe8b5('0x34')]();this[_0xe8b5('0xa')][_0x5e8652[_0xe8b5('0x43')]]['address']=_0x5e8652['address'];this[_0xe8b5('0xa')][_0x5e8652[_0xe8b5('0x43')]][_0xe8b5('0x38')](_0x5e8652);}}else if(this[_0xe8b5('0xb')][_0x5e8652['peer']]){this[_0xe8b5('0xb')][_0x5e8652[_0xe8b5('0x43')]]['status']=_0x5e8652[_0xe8b5('0x11')][_0xe8b5('0x34')]();this[_0xe8b5('0xb')][_0x5e8652[_0xe8b5('0x43')]]['address']=_0x5e8652['address'];logger['debug'](_0xe8b5('0x47'),util[_0xe8b5('0x19')](this[_0xe8b5('0xb')][_0x5e8652[_0xe8b5('0x43')]],{'showHidden':![],'depth':null}));this[_0xe8b5('0x21')](util[_0xe8b5('0x2e')](_0xe8b5('0x39'),this[_0xe8b5('0xb')][_0x5e8652[_0xe8b5('0x43')]][_0xe8b5('0x2f')]),_0xe8b5('0x3a'),this[_0xe8b5('0xb')][_0x5e8652[_0xe8b5('0x43')]]);}else if(this[_0xe8b5('0x9')][_0x5e8652[_0xe8b5('0x43')]]){this[_0xe8b5('0x9')][_0x5e8652['peer']][_0xe8b5('0x46')]=_0x5e8652[_0xe8b5('0x11')][_0xe8b5('0x34')]();this['trunks'][_0x5e8652[_0xe8b5('0x43')]][_0xe8b5('0x48')]=_0x5e8652[_0xe8b5('0x48')];logger[_0xe8b5('0x26')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util[_0xe8b5('0x19')](this['trunks'][_0x5e8652['peer']],{'showHidden':![],'depth':null}));this[_0xe8b5('0x21')](util['format'](_0xe8b5('0x3b'),this[_0xe8b5('0x9')][_0x5e8652[_0xe8b5('0x43')]][_0xe8b5('0x2f')]),_0xe8b5('0x30'),this[_0xe8b5('0x9')][_0x5e8652[_0xe8b5('0x43')]]);}}}catch(_0x38f720){logger['error'](_0xe8b5('0x44'),util[_0xe8b5('0x19')](_0x38f720,{'showHidden':![],'depth':null}));}};module['exports']=UserReport;
\ No newline at end of file
+var _0x1e32=['stateRegistry','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','trunk:save','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','debug','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','name','Local','substring','indexOf','find','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','peer','address','peerstatus','[userReport][peerstatus]','registered','status','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','syncRegistry','bind','registry','syncDeviceState','syncPeerStatus','resolve','then','actionSipShowRegistry','catch','error','actionDeviceStateList','[userReport][devicestatelist]','inspect','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','syncRealtimeShow','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','[userReport][registry]'];(function(_0x28e92e,_0x152c93){var _0x39d536=function(_0x1b644e){while(--_0x1b644e){_0x28e92e['push'](_0x28e92e['shift']());}};_0x39d536(++_0x152c93);}(_0x1e32,0x70));var _0x21e3=function(_0x53c81a,_0x372d7f){_0x53c81a=_0x53c81a-0x0;var _0x2e58a7=_0x1e32[_0x53c81a];return _0x2e58a7;};'use strict';var _=require(_0x21e3('0x0'));var moment=require(_0x21e3('0x1'));var util=require(_0x21e3('0x2'));var Redis=require(_0x21e3('0x3'));var BPromise=require(_0x21e3('0x4'));var config=require('../../../config/environment');var logger=require(_0x21e3('0x5'))(_0x21e3('0x6'));var ami=require(_0x21e3('0x7'));config['redis']=_[_0x21e3('0x8')](config[_0x21e3('0x9')],{'host':_0x21e3('0xa'),'port':0x18eb});var io=require(_0x21e3('0xb'))(new Redis(config[_0x21e3('0x9')]));function UserReport(_0x39b91d){this[_0x21e3('0xc')]=_0x39b91d[_0x21e3('0xc')];this[_0x21e3('0xd')]=_0x39b91d[_0x21e3('0xd')];this[_0x21e3('0xe')]=_0x39b91d[_0x21e3('0xe')];ami['on']('registryentry',this[_0x21e3('0xf')][_0x21e3('0x10')](this));ami['on'](_0x21e3('0x11'),this[_0x21e3('0xf')][_0x21e3('0x10')](this));ami['on']('devicestatechange',this[_0x21e3('0x12')][_0x21e3('0x10')](this));ami['on']('peerstatus',this[_0x21e3('0x13')][_0x21e3('0x10')](this));return this['syncRealtimeShow']();}function showSipRegistrations(){Promise[_0x21e3('0x14')]()[_0x21e3('0x15')](ami[_0x21e3('0x16')]())[_0x21e3('0x17')](function(_0x16d0d3){logger[_0x21e3('0x18')]('[userReport][sipshowregistry]',util['inspect'](_0x16d0d3,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x21e3('0x14')]()[_0x21e3('0x15')](ami[_0x21e3('0x19')]())[_0x21e3('0x17')](function(_0x56ab40){logger['error'](_0x21e3('0x1a'),util[_0x21e3('0x1b')](_0x56ab40,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x21e3('0x14')]()[_0x21e3('0x15')](ami[_0x21e3('0x1c')]())[_0x21e3('0x17')](function(_0x4a25a5){logger['error'](_0x21e3('0x1d'),util[_0x21e3('0x1b')](_0x4a25a5,{'showHidden':![],'depth':null}));});}UserReport[_0x21e3('0x1e')][_0x21e3('0x1f')]=function(){setInterval(function(){BPromise[_0x21e3('0x14')]()[_0x21e3('0x15')](showSipRegistrations())[_0x21e3('0x15')](listDeviceStates())[_0x21e3('0x15')](showPeersStatus());},0x32c8);};UserReport['prototype'][_0x21e3('0x20')]=function(_0x2ad87f){return _0x2ad87f!==null&&!_[_0x21e3('0x21')](_0x2ad87f);};UserReport['prototype'][_0x21e3('0x22')]=function(_0x24e623,_0x5b4620,_0x13ba26){io['to'](_0x24e623)[_0x21e3('0x22')](_0x5b4620,_0x13ba26);};UserReport[_0x21e3('0x1e')]['syncRegistry']=function(_0x50bd7f){try{if(this['isNotNull'](_0x50bd7f)){logger[_0x21e3('0x23')](_0x21e3('0x24'),_0x50bd7f[_0x21e3('0x25')],_0x50bd7f[_0x21e3('0x26')]);logger['debug'](_0x21e3('0x27'),util[_0x21e3('0x1b')](_0x50bd7f,{'showHidden':![],'depth':null}));var _0x494d99=_['find'](this[_0x21e3('0xc')],{'defaultuser':_0x50bd7f[_0x21e3('0x25')]});if(_0x494d99){_0x50bd7f[_0x21e3('0x28')]=_0x50bd7f[_0x21e3('0x26')];_['merge'](_0x494d99,_['omit'](_0x50bd7f,[_0x21e3('0x29'),'actionid',_0x21e3('0x25'),_0x21e3('0x26')]));logger['debug'](_0x21e3('0x2a'),util[_0x21e3('0x1b')](_0x494d99,{'showHidden':![],'depth':null}));this[_0x21e3('0x22')](util[_0x21e3('0x2b')](_0x21e3('0x2c'),_0x494d99['name']),_0x21e3('0x2d'),_0x494d99);}}}catch(_0x512805){logger['error'](_0x21e3('0x27'),util[_0x21e3('0x1b')](_0x512805,{'showHidden':![],'depth':null}));}};UserReport[_0x21e3('0x1e')]['syncDeviceState']=function(_0x7bc910){try{if(this['isNotNull'](_0x7bc910)){logger[_0x21e3('0x23')](_0x21e3('0x2e'),_0x7bc910[_0x21e3('0x2f')],_0x7bc910['state']);logger[_0x21e3('0x30')](_0x21e3('0x31'),util[_0x21e3('0x1b')](_0x7bc910,{'showHidden':![],'depth':null}));if(this['agents'][_0x7bc910[_0x21e3('0x2f')]]){if(!this[_0x21e3('0xd')][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x32')]||_0x7bc910['state'][_0x21e3('0x33')]()==_0x21e3('0x34')){this[_0x21e3('0xd')][_0x7bc910['device']][_0x21e3('0x32')]=![];if(this[_0x21e3('0xd')][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x26')]!==_0x7bc910[_0x21e3('0x26')]['toLowerCase']()){this['agents'][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x35')]=_[_0x21e3('0x36')](moment()[_0x21e3('0x2b')]('x'));}this[_0x21e3('0xd')][_0x7bc910[_0x21e3('0x2f')]]['state']=_0x7bc910[_0x21e3('0x26')][_0x21e3('0x33')]();this[_0x21e3('0xd')][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x37')](_0x7bc910);}}else if(this['telephones'][_0x7bc910[_0x21e3('0x2f')]]){if(this['telephones'][_0x7bc910[_0x21e3('0x2f')]]['state']!==_0x7bc910[_0x21e3('0x26')]['toLowerCase']()){this[_0x21e3('0xe')][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x35')]=_[_0x21e3('0x36')](moment()['format']('x'));}this['telephones'][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x26')]=_0x7bc910[_0x21e3('0x26')]['toLowerCase']();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x21e3('0x1b')](this[_0x21e3('0xe')][_0x7bc910['device']],{'showHidden':![],'depth':null}));this['emit'](util[_0x21e3('0x2b')](_0x21e3('0x38'),this[_0x21e3('0xe')][_0x7bc910[_0x21e3('0x2f')]]['name']),_0x21e3('0x39'),this[_0x21e3('0xe')][_0x7bc910[_0x21e3('0x2f')]]);}else if(this[_0x21e3('0xc')][_0x7bc910[_0x21e3('0x2f')]]){if(this[_0x21e3('0xc')][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x26')]!==_0x7bc910[_0x21e3('0x26')][_0x21e3('0x33')]()){this['trunks'][_0x7bc910[_0x21e3('0x2f')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this['trunks'][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x26')]=_0x7bc910[_0x21e3('0x26')][_0x21e3('0x33')]();logger[_0x21e3('0x30')](_0x21e3('0x3a'),util[_0x21e3('0x1b')](this[_0x21e3('0xc')][_0x7bc910[_0x21e3('0x2f')]],{'showHidden':![],'depth':null}));this[_0x21e3('0x22')](util[_0x21e3('0x2b')](_0x21e3('0x2c'),this[_0x21e3('0xc')][_0x7bc910[_0x21e3('0x2f')]][_0x21e3('0x3b')]),_0x21e3('0x2d'),this['trunks'][_0x7bc910[_0x21e3('0x2f')]]);}else if(_['startsWith'](_0x7bc910[_0x21e3('0x2f')],_0x21e3('0x3c'))){var _0x2c48d6=_0x7bc910[_0x21e3('0x2f')];var _0x46460d=_0x2c48d6[_0x21e3('0x3d')](_0x2c48d6[_0x21e3('0x3e')]('/')+0x1,_0x2c48d6[_0x21e3('0x3e')]('@'));var _0x2c7e60=_[_0x21e3('0x3f')](this[_0x21e3('0xd')],function(_0x52adf0){return _0x52adf0['mobile']==_0x46460d||_0x52adf0[_0x21e3('0x40')]==_0x46460d||_0x52adf0[_0x21e3('0x41')]==_0x46460d;});if(_0x2c7e60){if(_0x2c7e60['state']!==_0x7bc910[_0x21e3('0x26')]['toLowerCase']()){_0x2c7e60['stateTime']=_[_0x21e3('0x36')](moment()['format']('x'));}_0x2c7e60[_0x21e3('0x26')]=_0x7bc910[_0x21e3('0x26')][_0x21e3('0x33')]();_0x2c7e60[_0x21e3('0x32')]=!![];_0x2c7e60[_0x21e3('0x37')](_0x7bc910);}}}}catch(_0xfdae25){logger['error'](_0x21e3('0x31'),util['inspect'](_0xfdae25,{'showHidden':![],'depth':null}));}};UserReport[_0x21e3('0x1e')][_0x21e3('0x13')]=function(_0x5b2307){try{if(this[_0x21e3('0x20')](_0x5b2307)&&this[_0x21e3('0x20')](_0x5b2307['peerstatus'])){logger[_0x21e3('0x23')](_0x21e3('0x42'),_0x5b2307[_0x21e3('0x43')],_0x5b2307[_0x21e3('0x44')],_0x5b2307[_0x21e3('0x45')]);logger['debug'](_0x21e3('0x46'),util[_0x21e3('0x1b')](_0x5b2307,{'showHidden':![],'depth':null}));if(this[_0x21e3('0xd')][_0x5b2307[_0x21e3('0x43')]]){if(!this['agents'][_0x5b2307[_0x21e3('0x43')]][_0x21e3('0x32')]||_0x5b2307[_0x21e3('0x45')][_0x21e3('0x33')]()==_0x21e3('0x47')){this[_0x21e3('0xd')][_0x5b2307['peer']][_0x21e3('0x32')]=![];this[_0x21e3('0xd')][_0x5b2307['peer']][_0x21e3('0x48')]=_0x5b2307[_0x21e3('0x45')][_0x21e3('0x33')]();this['agents'][_0x5b2307[_0x21e3('0x43')]][_0x21e3('0x44')]=_0x5b2307[_0x21e3('0x44')];this[_0x21e3('0xd')][_0x5b2307[_0x21e3('0x43')]][_0x21e3('0x37')](_0x5b2307);}}else if(this[_0x21e3('0xe')][_0x5b2307[_0x21e3('0x43')]]){this[_0x21e3('0xe')][_0x5b2307['peer']]['status']=_0x5b2307['peerstatus']['toLowerCase']();this['telephones'][_0x5b2307[_0x21e3('0x43')]][_0x21e3('0x44')]=_0x5b2307[_0x21e3('0x44')];logger['debug'](_0x21e3('0x49'),util[_0x21e3('0x1b')](this[_0x21e3('0xe')][_0x5b2307['peer']],{'showHidden':![],'depth':null}));this[_0x21e3('0x22')](util[_0x21e3('0x2b')](_0x21e3('0x38'),this[_0x21e3('0xe')][_0x5b2307[_0x21e3('0x43')]]['name']),'telephone:save',this[_0x21e3('0xe')][_0x5b2307[_0x21e3('0x43')]]);}else if(this[_0x21e3('0xc')][_0x5b2307[_0x21e3('0x43')]]){this['trunks'][_0x5b2307[_0x21e3('0x43')]]['status']=_0x5b2307[_0x21e3('0x45')]['toLowerCase']();this[_0x21e3('0xc')][_0x5b2307[_0x21e3('0x43')]]['address']=_0x5b2307['address'];logger[_0x21e3('0x30')](_0x21e3('0x4a'),util[_0x21e3('0x1b')](this[_0x21e3('0xc')][_0x5b2307['peer']],{'showHidden':![],'depth':null}));this[_0x21e3('0x22')](util[_0x21e3('0x2b')](_0x21e3('0x2c'),this[_0x21e3('0xc')][_0x5b2307[_0x21e3('0x43')]][_0x21e3('0x3b')]),'trunk:save',this['trunks'][_0x5b2307['peer']]);}}}catch(_0x544722){logger[_0x21e3('0x18')](_0x21e3('0x46'),util['inspect'](_0x544722,{'showHidden':![],'depth':null}));}};module[_0x21e3('0x4b')]=UserReport;
\ No newline at end of file
index 1cfb7fb..a3230a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7387=['prototype','emit','isNotNull','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','interface','queue','variables','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','voice','assign','omit','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','error','[%s][voiceAgentReport][agentcalled]','info','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','connectedlinenum','destchannelstatedesc','holdtime','routealias','merge','destconnectedlinenum','name','accountcode','user:agentconnect','agentringnoanswer','agentringnoanswerAt','lastevent','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','hasOwnProperty','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','util','../../../config/environment','../../../config/logger','ami','../ami','redis','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','syncMusicOnHoldStart','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer'];(function(_0x28b86b,_0x2f16d9){var _0x5214f4=function(_0x460a20){while(--_0x460a20){_0x28b86b['push'](_0x28b86b['shift']());}};_0x5214f4(++_0x2f16d9);}(_0x7387,0x76));var _0x7738=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x7387[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x7738('0x0'));var Redis=require('ioredis');var config=require(_0x7738('0x1'));var logger=require(_0x7738('0x2'))(_0x7738('0x3'));var ami=require(_0x7738('0x4'));config[_0x7738('0x5')]=_['defaults'](config['redis'],{'host':_0x7738('0x6'),'port':0x18eb});var io=require(_0x7738('0x7'))(new Redis(config['redis']));function VoiceAgentReport(_0x127305){this[_0x7738('0x8')]={};this[_0x7738('0x9')]=_0x127305['channels'];this['voiceQueues']=_0x127305[_0x7738('0xa')];this[_0x7738('0xb')]=_0x127305[_0x7738('0xb')];this['variables']={};ami['on'](_0x7738('0xc'),this[_0x7738('0xd')]['bind'](this));ami['on'](_0x7738('0xe'),this[_0x7738('0xf')][_0x7738('0x10')](this));ami['on']('agentringnoanswer',this[_0x7738('0x11')][_0x7738('0x10')](this));ami['on'](_0x7738('0x12'),this[_0x7738('0x13')][_0x7738('0x10')](this));ami['on'](_0x7738('0x14'),this[_0x7738('0x15')]['bind'](this));ami['on'](_0x7738('0x16'),this[_0x7738('0x17')][_0x7738('0x10')](this));ami['on'](_0x7738('0x18'),this[_0x7738('0x19')][_0x7738('0x10')](this));ami['on']('musiconholdstart',this[_0x7738('0x1a')][_0x7738('0x10')](this));ami['on']('musiconholdstop',this[_0x7738('0x1b')][_0x7738('0x10')](this));ami['on'](_0x7738('0x1c'),this[_0x7738('0x1d')][_0x7738('0x10')](this));ami['on'](_0x7738('0x1e'),this[_0x7738('0x1f')][_0x7738('0x10')](this));}VoiceAgentReport[_0x7738('0x20')][_0x7738('0x21')]=function(_0x2a5beb,_0x7d08fa,_0x588592){io['to'](_0x2a5beb)['emit'](_0x7d08fa,_0x588592);};VoiceAgentReport[_0x7738('0x20')]['isNotNull']=function(_0x4fd934){return _0x4fd934!==null&&!_['isUndefined'](_0x4fd934);};VoiceAgentReport[_0x7738('0x20')][_0x7738('0xd')]=function(_0x223bca){try{if(this[_0x7738('0x22')](_0x223bca)){logger['info']('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x223bca[_0x7738('0x23')],_0x223bca[_0x7738('0x24')],_0x223bca[_0x7738('0x25')]);logger[_0x7738('0x26')](_0x7738('0x27'),_0x223bca[_0x7738('0x23')],util[_0x7738('0x28')](_0x223bca,{'showHidden':![],'depth':null}));if(_[_0x7738('0x29')](this[_0x7738('0x8')][_0x223bca['uniqueid']])){this[_0x7738('0x8')][_0x223bca['uniqueid']]={};}var _0x3be322=this[_0x7738('0xb')][_0x223bca[_0x7738('0x2a')]];var _0x2203f2=this['channels'][_0x223bca[_0x7738('0x23')]][_0x223bca['destuniqueid']];var _0xd8093e=this[_0x7738('0xa')][_0x223bca[_0x7738('0x2b')]];var _0x3b3e79=this[_0x7738('0x2c')][_0x223bca[_0x7738('0x23')]];if(_[_0x7738('0x29')](_0x2203f2)){_0x2203f2={'agentcalledAt':moment()[_0x7738('0x2d')](_0x7738('0x2e')),'lastevent':_0x7738('0x2f'),'mandatoryDisposition':_0xd8093e&&_0xd8093e[_0x7738('0x30')]?_0xd8093e['mandatoryDisposition']:![],'type':_0xd8093e&&_0xd8093e[_0x7738('0x31')]?_0xd8093e[_0x7738('0x31')]:'inbound','variables':_0x3b3e79,'motionChannel':_0x7738('0x32')};}Object[_0x7738('0x33')](_0x2203f2,_[_0x7738('0x34')](_0x223bca,['event',_0x7738('0x35')]));this[_0x7738('0x8')][_0x223bca[_0x7738('0x23')]][_0x223bca[_0x7738('0x25')]]=_0x2203f2;logger[_0x7738('0x26')](_0x7738('0x36'),_0x223bca['uniqueid'],util[_0x7738('0x28')](_0x2203f2,{'showHidden':![],'depth':null}));ami[_0x7738('0x21')](_0x7738('0x37'),_0x2203f2);var _0x1273e={'id':_0x3be322['id'],'calleridnum':_0x2203f2['calleridnum'],'queue':_0x2203f2[_0x7738('0x2b')],'variables':_0x2203f2[_0x7738('0x2c')],'uniqueid':_0x223bca['uniqueid']};logger[_0x7738('0x26')](_0x7738('0x38'),_0x223bca[_0x7738('0x23')],util[_0x7738('0x28')](_0x1273e,{'showHidden':![],'depth':null}));this[_0x7738('0x21')](util[_0x7738('0x2d')](_0x7738('0x39'),_0x223bca[_0x7738('0x24')]),'user:called',_0x1273e);}}catch(_0x32da9b){logger[_0x7738('0x3a')](_0x7738('0x3b'),_0x223bca[_0x7738('0x23')],util[_0x7738('0x28')](_0x32da9b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0xf')]=function(_0xac84eb){try{if(this[_0x7738('0x22')](_0xac84eb)){if(this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]]){for(var _0x5dbc0c in this['channels'][_0xac84eb[_0x7738('0x23')]]){if(this['channels'][_0xac84eb[_0x7738('0x23')]]['hasOwnProperty'](_0x5dbc0c)){if(_0xac84eb[_0x7738('0x25')]===_0x5dbc0c){logger[_0x7738('0x3c')](_0x7738('0x3d'),_0xac84eb[_0x7738('0x23')],_0xac84eb[_0x7738('0x24')],_0xac84eb[_0x7738('0x25')]);this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c]['agentconnectAt']=moment()[_0x7738('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c]['connectedlinename']=_0xac84eb[_0x7738('0x3e')];this[_0x7738('0x8')][_0xac84eb['uniqueid']][_0x5dbc0c]['connectedlinenum']=_0xac84eb[_0x7738('0x3f')];this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c]['destchannelstate']=_0xac84eb['destchannelstate'];this['channels'][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c]['destchannelstatedesc']=_0xac84eb[_0x7738('0x40')];this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c][_0x7738('0x41')]=_0xac84eb['holdtime'];this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c]['lastevent']='connect';if(this[_0x7738('0x9')][this[_0x7738('0x8')][_0xac84eb['uniqueid']][_0x5dbc0c][_0x7738('0x23')]]){var _0x394b45=this['voiceChannels'][this['channels'][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c][_0x7738('0x23')]][_0x7738('0x42')];this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c][_0x7738('0x42')]=_0x394b45;_0xac84eb[_0x7738('0x42')]=_0x394b45;}_[_0x7738('0x43')](this[_0x7738('0xb')][_0xac84eb[_0x7738('0x2a')]],_['pick'](_0xac84eb,[_0x7738('0x2b'),_0x7738('0x44'),_0x7738('0x42')]));var _0x426a35=this[_0x7738('0xb')][_0xac84eb['interface']];var _0x5e1725={'id':_0x426a35['id'],'name':_0x426a35[_0x7738('0x45')],'agentconnected':!![],'destaccountcode':_0x426a35[_0x7738('0x46')],'destconnectedlinenum':this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0xac84eb[_0x7738('0x25')]]['exten'],'queue':this['channels'][_0xac84eb[_0x7738('0x23')]][_0xac84eb[_0x7738('0x25')]][_0x7738('0x2b')],'routealias':this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0xac84eb[_0x7738('0x25')]]['routealias'],'uniqueid':this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0xac84eb[_0x7738('0x25')]][_0x7738('0x23')]};ami['emit']('custom:agentconnect',this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0xac84eb[_0x7738('0x25')]]);this[_0x7738('0x21')](util[_0x7738('0x2d')](_0x7738('0x39'),_0xac84eb[_0x7738('0x24')]),_0x7738('0x47'),_0x5e1725);}else if(!this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c][_0x7738('0x48')]&&!this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c][_0x7738('0x14')]){logger[_0x7738('0x3c')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0xac84eb[_0x7738('0x23')],this['channels'][_0xac84eb['uniqueid']][_0x5dbc0c][_0x7738('0x24')],_0x5dbc0c);this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c][_0x7738('0x48')]=!![];this[_0x7738('0x8')][_0xac84eb['uniqueid']][_0x5dbc0c][_0x7738('0x49')]=moment()[_0x7738('0x2d')](_0x7738('0x2e'));this[_0x7738('0x8')][_0xac84eb['uniqueid']][_0x5dbc0c]['answeredelsewheredestinationuniqueid']=_0xac84eb[_0x7738('0x25')];this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c]['answeredelsewheremembername']=_0xac84eb['membername'];this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c][_0x7738('0x4a')]=_0x7738('0x4b');this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c][_0x7738('0x4c')]=_0x7738('0x4b');logger[_0x7738('0x26')](_0x7738('0x4d'),_0xac84eb['uniqueid'],util[_0x7738('0x28')](this[_0x7738('0x8')][_0xac84eb[_0x7738('0x23')]][_0x5dbc0c],{'showHidden':![],'depth':null}));ami[_0x7738('0x21')]('custom:agentansweredelsewhere',this[_0x7738('0x8')][_0xac84eb['uniqueid']][_0x5dbc0c]);}else{logger[_0x7738('0x26')](_0x7738('0x4e'),_0xac84eb[_0x7738('0x23')]);}}}}}}catch(_0x26b866){logger[_0x7738('0x3a')](_0x7738('0x4f'),_0xac84eb[_0x7738('0x23')],util[_0x7738('0x28')](_0x26b866,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0x11')]=function(_0xd67466){try{if(this[_0x7738('0x22')](_0xd67466)){logger[_0x7738('0x26')](_0x7738('0x50'),_0xd67466[_0x7738('0x23')],util[_0x7738('0x28')](_0xd67466,{'showHidden':![],'depth':null}));if(this['channels'][_0xd67466[_0x7738('0x23')]]&&this[_0x7738('0x8')][_0xd67466[_0x7738('0x23')]][_0xd67466[_0x7738('0x25')]]){logger[_0x7738('0x3c')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0xd67466['uniqueid'],_0xd67466['membername'],_0xd67466[_0x7738('0x25')]);var _0x4bd339=this[_0x7738('0xb')][_0xd67466[_0x7738('0x2a')]];var _0x427dce=this['channels'][_0xd67466[_0x7738('0x23')]][_0xd67466[_0x7738('0x25')]];_0x427dce['agentringnoanswer']=!![];_0x427dce[_0x7738('0x49')]=moment()[_0x7738('0x2d')](_0x7738('0x2e'));_0x427dce[_0x7738('0x4a')]=_0x7738('0x51');_0x427dce['reason']='rejected';var _0x13faa6={'id':_0x4bd339['id'],'name':_0x4bd339[_0x7738('0x45')],'queue':_0x427dce[_0x7738('0x2b')],'uniqueid':_0x427dce[_0x7738('0x23')]};logger[_0x7738('0x26')](_0x7738('0x52'),_0xd67466[_0x7738('0x23')],util[_0x7738('0x28')](_0x13faa6,{'showHidden':![],'depth':null}));this[_0x7738('0x21')](util[_0x7738('0x2d')](_0x7738('0x39'),_0x4bd339[_0x7738('0x45')]),_0x7738('0x53'),_0x13faa6);ami[_0x7738('0x21')](_0x7738('0x54'),_0x427dce);this[_0x7738('0x8')][_0xd67466[_0x7738('0x23')]][_0xd67466[_0x7738('0x25')]]=Object[_0x7738('0x33')]({},_0x427dce);}}}catch(_0x341515){logger[_0x7738('0x3a')](_0x7738('0x55'),_0xd67466[_0x7738('0x23')],util[_0x7738('0x28')](_0x341515,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')]['syncQueueCallerAbandon']=function(_0x4a92d9){try{if(this['isNotNull'](_0x4a92d9)){logger['debug'](_0x7738('0x56'),_0x4a92d9['uniqueid'],util[_0x7738('0x28')](_0x4a92d9,{'showHidden':![],'depth':null}));if(this[_0x7738('0x8')][_0x4a92d9[_0x7738('0x23')]]){for(var _0x2e5444 in this[_0x7738('0x8')][_0x4a92d9[_0x7738('0x23')]]){if(this['channels'][_0x4a92d9[_0x7738('0x23')]]['hasOwnProperty'](_0x2e5444)&&!this['channels'][_0x4a92d9[_0x7738('0x23')]][_0x2e5444][_0x7738('0x48')]&&!this[_0x7738('0x8')][_0x4a92d9[_0x7738('0x23')]][_0x2e5444][_0x7738('0x14')]){logger[_0x7738('0x3c')](_0x7738('0x57'),_0x4a92d9[_0x7738('0x23')],this[_0x7738('0x8')][_0x4a92d9[_0x7738('0x23')]][_0x2e5444][_0x7738('0x24')],_0x2e5444);this[_0x7738('0x8')][_0x4a92d9[_0x7738('0x23')]][_0x2e5444][_0x7738('0x48')]=!![];this[_0x7738('0x8')][_0x4a92d9[_0x7738('0x23')]][_0x2e5444][_0x7738('0x49')]=moment()[_0x7738('0x2d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7738('0x8')][_0x4a92d9[_0x7738('0x23')]][_0x2e5444][_0x7738('0x4a')]=_0x7738('0x58');this[_0x7738('0x8')][_0x4a92d9[_0x7738('0x23')]][_0x2e5444][_0x7738('0x4c')]=_0x7738('0x58');logger['debug'](_0x7738('0x59'),_0x4a92d9[_0x7738('0x23')],util[_0x7738('0x28')](this[_0x7738('0x8')][_0x4a92d9['uniqueid']][_0x2e5444],{'showHidden':![],'depth':null}));ami['emit'](_0x7738('0x5a'),this[_0x7738('0x8')][_0x4a92d9['uniqueid']][_0x2e5444]);}}}}}catch(_0x375407){logger[_0x7738('0x3a')](_0x7738('0x5b'),_0x4a92d9['uniqueid'],util['inspect'](_0x375407,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x7738('0x15')]=function(_0x5e7af9){try{if(this[_0x7738('0x22')](_0x5e7af9)){logger[_0x7738('0x26')](_0x7738('0x5c'),_0x5e7af9[_0x7738('0x23')],util[_0x7738('0x28')](_0x5e7af9,{'showHidden':![],'depth':null}));if(this['channels'][_0x5e7af9['uniqueid']]){for(var _0x358ff8 in this['channels'][_0x5e7af9[_0x7738('0x23')]]){if(this['channels'][_0x5e7af9[_0x7738('0x23')]]['hasOwnProperty'](_0x358ff8)){if(this[_0x7738('0x8')][_0x5e7af9[_0x7738('0x23')]][_0x358ff8][_0x7738('0x5d')]&&!this['channels'][_0x5e7af9[_0x7738('0x23')]][_0x358ff8][_0x7738('0x14')]){logger['info'](_0x7738('0x5e'),_0x5e7af9[_0x7738('0x23')],this[_0x7738('0x8')][_0x5e7af9[_0x7738('0x23')]][_0x358ff8][_0x7738('0x24')],_0x358ff8);this[_0x7738('0x8')][_0x5e7af9['uniqueid']][_0x358ff8][_0x7738('0x14')]=!![];this[_0x7738('0x8')][_0x5e7af9[_0x7738('0x23')]][_0x358ff8][_0x7738('0x5f')]=moment()['format'](_0x7738('0x2e'));this[_0x7738('0x8')][_0x5e7af9[_0x7738('0x23')]][_0x358ff8][_0x7738('0x4a')]=_0x7738('0x60');this['channels'][_0x5e7af9[_0x7738('0x23')]][_0x358ff8][_0x7738('0x4c')]=_0x5e7af9['reason']==_0x7738('0x61')?_0x7738('0x62'):_0x5e7af9['reason'];this[_0x7738('0x8')][_0x5e7af9['uniqueid']][_0x358ff8][_0x7738('0x63')]=_0x5e7af9[_0x7738('0x63')];if(this[_0x7738('0xa')][_0x5e7af9[_0x7738('0x2b')]]&&this[_0x7738('0xa')][_0x5e7af9[_0x7738('0x2b')]]['acw']){this[_0x7738('0x8')][_0x5e7af9[_0x7738('0x23')]][_0x358ff8]['acwtime']=this[_0x7738('0xa')][_0x5e7af9[_0x7738('0x2b')]][_0x7738('0x64')];this[_0x7738('0x8')][_0x5e7af9[_0x7738('0x23')]][_0x358ff8]['agentacw']=!![];}this['agents'][_0x5e7af9['interface']]=_[_0x7738('0x34')](this[_0x7738('0xb')][_0x5e7af9[_0x7738('0x2a')]],[_0x7738('0x2b'),_0x7738('0x44')]);logger[_0x7738('0x26')](_0x7738('0x65'),_0x5e7af9['uniqueid'],util[_0x7738('0x28')](this['channels'][_0x5e7af9[_0x7738('0x23')]][_0x358ff8],{'showHidden':![],'depth':null}));ami['emit'](_0x7738('0x66'),this[_0x7738('0x8')][_0x5e7af9[_0x7738('0x23')]][_0x358ff8]);logger['debug'](_0x7738('0x67'),_0x5e7af9[_0x7738('0x23')],util[_0x7738('0x28')]({'id':this['agents'][_0x5e7af9[_0x7738('0x2a')]]['id'],'destaccountcode':_0x5e7af9[_0x7738('0x68')]},{'showHidden':![],'depth':null}));this[_0x7738('0x21')](util['format'](_0x7738('0x39'),_0x5e7af9[_0x7738('0x24')]),'user:agentcomplete',{'id':this[_0x7738('0xb')][_0x5e7af9[_0x7738('0x2a')]]['id'],'destaccountcode':Number(_0x5e7af9['destaccountcode'])});}}}}}}catch(_0xa4e761){logger[_0x7738('0x3a')](_0x7738('0x69'),_0x5e7af9['uniqueid'],util[_0x7738('0x28')](_0xa4e761,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0x17')]=function(_0x2342f7){try{if(this[_0x7738('0x22')](_0x2342f7)){logger['debug'](_0x7738('0x6a'),_0x2342f7['uniqueid'],util[_0x7738('0x28')](_0x2342f7,{'showHidden':![],'depth':null}));this['addVariable'](_0x2342f7[_0x7738('0x23')],_[_0x7738('0x6b')](_0x2342f7[_0x7738('0x6c')])[0x0],_0x2342f7[_0x7738('0x6d')]);if(this['channels'][_0x2342f7[_0x7738('0x23')]]){for(var _0x3a5902 in this[_0x7738('0x8')][_0x2342f7[_0x7738('0x23')]]){if(this[_0x7738('0x8')][_0x2342f7['uniqueid']]['hasOwnProperty'](_0x3a5902)){logger['info'](_0x7738('0x6e'),_0x2342f7[_0x7738('0x23')],_0x3a5902,_[_0x7738('0x6b')](_0x2342f7[_0x7738('0x6c')])[0x0],_0x2342f7['value']);if(_[_0x7738('0x29')](this[_0x7738('0x8')][_0x2342f7[_0x7738('0x23')]][_0x3a5902]['variables'])){this[_0x7738('0x8')][_0x2342f7[_0x7738('0x23')]][_0x3a5902][_0x7738('0x2c')]={};}this['channels'][_0x2342f7[_0x7738('0x23')]][_0x3a5902][_0x7738('0x2c')]=this[_0x7738('0x2c')][_0x2342f7[_0x7738('0x23')]];}}}}}catch(_0x31637d){logger['error'](_0x7738('0x6f'),_0x2342f7[_0x7738('0x23')],util[_0x7738('0x28')](_0x31637d,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0x70')]=function(_0x2b9fe3,_0x5e8044,_0x3c28e0){var _0x5aaeba=['rtpaudioqos',_0x7738('0x71'),_0x7738('0x72'),_0x7738('0x73'),_0x7738('0x74'),_0x7738('0x75'),_0x7738('0x76'),'rtpaudioqosrttbridged',_0x7738('0x77'),_0x7738('0x78'),_0x7738('0x79'),'bridgepvtcallid',_0x7738('0x7a'),_0x7738('0x7b'),_0x7738('0x7c'),_0x7738('0x7d'),_0x7738('0x24'),_0x7738('0x7e'),'memberrealtime'];if(!_[_0x7738('0x7f')](_0x5e8044)&&!_[_0x7738('0x80')](_0x5aaeba,_0x5e8044)){if(_[_0x7738('0x29')](this['variables'][_0x2b9fe3])){this[_0x7738('0x2c')][_0x2b9fe3]={};}this[_0x7738('0x2c')][_0x2b9fe3][_0x5e8044]=_0x3c28e0;}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0x19')]=function(_0x55cc40){try{if(this['isNotNull'](_0x55cc40)){logger[_0x7738('0x26')](_0x7738('0x81'),_0x55cc40[_0x7738('0x23')],util[_0x7738('0x28')](_0x55cc40,{'showHidden':![],'depth':null}));if(this[_0x7738('0x8')][_0x55cc40[_0x7738('0x23')]]){for(var _0x2f7c58 in this[_0x7738('0x8')][_0x55cc40[_0x7738('0x23')]]){if(this[_0x7738('0x8')][_0x55cc40['uniqueid']][_0x7738('0x82')](_0x2f7c58)){if(this[_0x7738('0x8')][_0x55cc40['uniqueid']][_0x2f7c58][_0x7738('0x4c')]=='transfer'&&this[_0x7738('0x8')][_0x55cc40['uniqueid']][_0x2f7c58]['agentcomplete']){logger['info'](_0x7738('0x83'),_0x55cc40[_0x7738('0x23')],_0x2f7c58);this[_0x7738('0x8')][_0x55cc40['uniqueid']][_0x2f7c58]['agentcompleteAt']=moment()[_0x7738('0x2d')](_0x7738('0x2e'));}}}logger[_0x7738('0x26')]('[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:',_0x55cc40['uniqueid'],util[_0x7738('0x28')](_['values'](this['channels'][_0x55cc40['uniqueid']]),{'showHidden':![],'depth':null}));ami[_0x7738('0x21')]('custom:voiceAgentReport',_['values'](this['channels'][_0x55cc40[_0x7738('0x23')]]));delete this[_0x7738('0x8')][_0x55cc40[_0x7738('0x23')]];}if(this[_0x7738('0x2c')][_0x55cc40[_0x7738('0x23')]]){delete this[_0x7738('0x2c')][_0x55cc40[_0x7738('0x23')]];}}}catch(_0x175220){logger[_0x7738('0x3a')](_0x7738('0x84'),_0x55cc40[_0x7738('0x23')],util[_0x7738('0x28')](_0x175220,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0x1d')]=function(_0x22c6f9){try{if(this[_0x7738('0x22')](_0x22c6f9)){logger['debug']('[%s][voiceAgentReport][attendedtransfer]\x20event:',_0x22c6f9[_0x7738('0x23')],util[_0x7738('0x28')](_0x22c6f9,{'showHidden':![],'depth':null}));if(this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x85')]]){for(var _0x5c003f in this[_0x7738('0x8')][_0x22c6f9['transfereeuniqueid']]){if(this['channels'][_0x22c6f9[_0x7738('0x85')]][_0x7738('0x82')](_0x5c003f)){if(_0x22c6f9['origtransfereruniqueid']===_0x5c003f){logger[_0x7738('0x3c')](_0x7738('0x86'),_0x22c6f9[_0x7738('0x23')],this[_0x7738('0x8')][_0x22c6f9['transfereeuniqueid']][_0x5c003f][_0x7738('0x24')],_0x5c003f);var _0x4e30f6=moment();this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x85')]][_0x5c003f]['agentcomplete']=!![];this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x85')]][_0x5c003f][_0x7738('0x5f')]=moment()['format'](_0x7738('0x2e'));this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x85')]][_0x5c003f][_0x7738('0x4a')]=_0x7738('0x60');this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x85')]][_0x5c003f]['reason']=_0x7738('0x61');this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x85')]][_0x5c003f]['talktime']=_0x4e30f6[_0x7738('0x87')](this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x85')]][_0x5c003f][_0x7738('0x5d')],'seconds');}}}}if(this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x88')]]){var _0x601a9c=this['channels'][_0x22c6f9[_0x7738('0x88')]];this['channels'][_0x22c6f9[_0x7738('0x88')]]=this[_0x7738('0x8')][_0x22c6f9['transfereeuniqueid']];this[_0x7738('0x8')][_0x22c6f9[_0x7738('0x85')]]=_0x601a9c;}}}catch(_0xee9437){logger[_0x7738('0x3a')](_0x7738('0x89'),_0x22c6f9[_0x7738('0x23')],util[_0x7738('0x28')](_0xee9437,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0x1f')]=function(_0x5f2c54){try{if(this[_0x7738('0x22')](_0x5f2c54)){logger[_0x7738('0x26')](_0x7738('0x8a'),_0x5f2c54['uniqueid'],util[_0x7738('0x28')](_0x5f2c54,{'showHidden':![],'depth':null}));if(this[_0x7738('0x8')][_0x5f2c54[_0x7738('0x85')]]){for(var _0xa9ee26 in this[_0x7738('0x8')][_0x5f2c54['transfereeuniqueid']]){if(this[_0x7738('0x8')][_0x5f2c54[_0x7738('0x85')]][_0x7738('0x82')](_0xa9ee26)){if(_0x5f2c54[_0x7738('0x8b')]===_0xa9ee26){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5f2c54[_0x7738('0x23')],this[_0x7738('0x8')][_0x5f2c54[_0x7738('0x85')]][_0xa9ee26]['membername'],_0xa9ee26);var _0x4089ed=moment();this['channels'][_0x5f2c54[_0x7738('0x85')]][_0xa9ee26][_0x7738('0x14')]=!![];this['channels'][_0x5f2c54['transfereeuniqueid']][_0xa9ee26][_0x7738('0x5f')]=_0x4089ed;this[_0x7738('0x8')][_0x5f2c54['transfereeuniqueid']][_0xa9ee26][_0x7738('0x4a')]=_0x7738('0x60');this['channels'][_0x5f2c54['transfereeuniqueid']][_0xa9ee26]['reason']=_0x7738('0x61');this[_0x7738('0x8')][_0x5f2c54['transfereeuniqueid']][_0xa9ee26][_0x7738('0x63')]=_0x4089ed['diff'](this[_0x7738('0x8')][_0x5f2c54[_0x7738('0x85')]][_0xa9ee26][_0x7738('0x5d')],'seconds');}}}}}}catch(_0x200587){logger[_0x7738('0x3a')](_0x7738('0x8c'),_0x5f2c54[_0x7738('0x23')],util[_0x7738('0x28')](_0x200587,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0x1a')]=function(_0x3b8945){var _0x520f29='';try{if(this[_0x7738('0x22')](_0x3b8945)){logger[_0x7738('0x26')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x3b8945['uniqueid'],util['inspect'](_0x3b8945,{'showHidden':![],'depth':null}));if(_0x3b8945[_0x7738('0x8d')]){_0x520f29=_0x3b8945['channel'][_0x7738('0x8e')](0x0,_0x3b8945['channel'][_0x7738('0x8f')]('-'));if(this[_0x7738('0xb')][_0x520f29]){logger[_0x7738('0x3c')](_0x7738('0x90'),_0x3b8945[_0x7738('0x23')],_0x520f29);this[_0x7738('0xb')][_0x520f29][_0x7738('0x91')]=!![];}}}}catch(_0xc26057){logger[_0x7738('0x3a')](_0x7738('0x92'),_0x3b8945[_0x7738('0x23')],util['inspect'](_0xc26057,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7738('0x20')][_0x7738('0x1b')]=function(_0xa90d8a){var _0x134e57='';try{if(this[_0x7738('0x22')](_0xa90d8a)){logger[_0x7738('0x26')](_0x7738('0x93'),_0xa90d8a[_0x7738('0x23')],util[_0x7738('0x28')](_0xa90d8a,{'showHidden':![],'depth':null}));if(_0xa90d8a[_0x7738('0x8d')]){_0x134e57=_0xa90d8a['channel'][_0x7738('0x8e')](0x0,_0xa90d8a['channel'][_0x7738('0x8f')]('-'));if(this[_0x7738('0xb')][_0x134e57]){logger['info'](_0x7738('0x94'),_0xa90d8a[_0x7738('0x23')],_0x134e57);this[_0x7738('0xb')][_0x134e57]['onhold']=![];}}}}catch(_0xf993d0){logger['error']('[%s][voiceAgentReport][musiconholdstop]',_0xa90d8a[_0x7738('0x23')],util[_0x7738('0x28')](_0xf993d0,{'showHidden':![],'depth':null}));}};module[_0x7738('0x95')]=VoiceAgentReport;
\ No newline at end of file
+var _0x6dd8=['rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','lastIndexOf','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','ioredis','../../../config/environment','../ami','redis','localhost','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','info','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','interface','destuniqueid','queue','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','routealias','pick','destconnectedlinenum','name','accountcode','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheremembername','reason','answered_elsewhere','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentringnoanswer]\x20event:','rejected','user:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','agentcompleteAt','complete','transfer','agent','talktime','acw','acwTimeout','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','destaccountcode','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter'];(function(_0x39fd7e,_0x17607d){var _0x1d5746=function(_0x11791a){while(--_0x11791a){_0x39fd7e['push'](_0x39fd7e['shift']());}};_0x1d5746(++_0x17607d);}(_0x6dd8,0xc4));var _0x86dd=function(_0x2f7f56,_0xf8f5b){_0x2f7f56=_0x2f7f56-0x0;var _0x1f11b8=_0x6dd8[_0x2f7f56];return _0x1f11b8;};'use strict';var _=require(_0x86dd('0x0'));var moment=require(_0x86dd('0x1'));var util=require(_0x86dd('0x2'));var Redis=require(_0x86dd('0x3'));var config=require(_0x86dd('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0x86dd('0x5'));config[_0x86dd('0x6')]=_['defaults'](config[_0x86dd('0x6')],{'host':_0x86dd('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x86dd('0x6')]));function VoiceAgentReport(_0x3641d9){this[_0x86dd('0x8')]={};this[_0x86dd('0x9')]=_0x3641d9[_0x86dd('0x8')];this['voiceQueues']=_0x3641d9[_0x86dd('0xa')];this[_0x86dd('0xb')]=_0x3641d9[_0x86dd('0xb')];this[_0x86dd('0xc')]={};ami['on'](_0x86dd('0xd'),this[_0x86dd('0xe')][_0x86dd('0xf')](this));ami['on'](_0x86dd('0x10'),this[_0x86dd('0x11')]['bind'](this));ami['on'](_0x86dd('0x12'),this[_0x86dd('0x13')]['bind'](this));ami['on'](_0x86dd('0x14'),this['syncQueueCallerAbandon'][_0x86dd('0xf')](this));ami['on'](_0x86dd('0x15'),this[_0x86dd('0x16')][_0x86dd('0xf')](this));ami['on'](_0x86dd('0x17'),this[_0x86dd('0x18')][_0x86dd('0xf')](this));ami['on']('hangup',this[_0x86dd('0x19')][_0x86dd('0xf')](this));ami['on'](_0x86dd('0x1a'),this['syncMusicOnHoldStart'][_0x86dd('0xf')](this));ami['on'](_0x86dd('0x1b'),this['syncMusicOnHoldStop'][_0x86dd('0xf')](this));ami['on'](_0x86dd('0x1c'),this[_0x86dd('0x1d')][_0x86dd('0xf')](this));ami['on']('blindtransfer',this[_0x86dd('0x1e')][_0x86dd('0xf')](this));}VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x20')]=function(_0x2a9d86,_0x3e1896,_0x3ee1e1){io['to'](_0x2a9d86)[_0x86dd('0x20')](_0x3e1896,_0x3ee1e1);};VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x21')]=function(_0xec1e75){return _0xec1e75!==null&&!_[_0x86dd('0x22')](_0xec1e75);};VoiceAgentReport['prototype'][_0x86dd('0xe')]=function(_0x55f862){try{if(this['isNotNull'](_0x55f862)){logger[_0x86dd('0x23')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x55f862['uniqueid'],_0x55f862[_0x86dd('0x24')],_0x55f862['destuniqueid']);logger[_0x86dd('0x25')](_0x86dd('0x26'),_0x55f862[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x55f862,{'showHidden':![],'depth':null}));if(_[_0x86dd('0x22')](this[_0x86dd('0x8')][_0x55f862[_0x86dd('0x27')]])){this[_0x86dd('0x8')][_0x55f862['uniqueid']]={};}var _0x51de94=this['agents'][_0x55f862[_0x86dd('0x29')]];var _0x354c0d=this[_0x86dd('0x8')][_0x55f862[_0x86dd('0x27')]][_0x55f862[_0x86dd('0x2a')]];var _0x293cad=this['voiceQueues'][_0x55f862[_0x86dd('0x2b')]];var _0x4492aa=this['variables'][_0x55f862['uniqueid']];if(_[_0x86dd('0x22')](_0x354c0d)){_0x354c0d={'agentcalledAt':moment()[_0x86dd('0x2c')](_0x86dd('0x2d')),'lastevent':_0x86dd('0x2e'),'mandatoryDisposition':_0x293cad&&_0x293cad[_0x86dd('0x2f')]?_0x293cad[_0x86dd('0x2f')]:![],'type':_0x293cad&&_0x293cad['type']?_0x293cad[_0x86dd('0x30')]:_0x86dd('0x31'),'variables':_0x4492aa,'motionChannel':_0x86dd('0x32')};}Object['assign'](_0x354c0d,_[_0x86dd('0x33')](_0x55f862,[_0x86dd('0x34'),_0x86dd('0x35')]));this[_0x86dd('0x8')][_0x55f862['uniqueid']][_0x55f862['destuniqueid']]=_0x354c0d;logger['debug'](_0x86dd('0x36'),_0x55f862[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x354c0d,{'showHidden':![],'depth':null}));ami['emit'](_0x86dd('0x37'),_0x354c0d);var _0x51fd89={'id':_0x51de94['id'],'calleridnum':_0x354c0d[_0x86dd('0x38')],'queue':_0x354c0d['queue'],'variables':_0x354c0d[_0x86dd('0xc')],'uniqueid':_0x55f862[_0x86dd('0x27')]};logger[_0x86dd('0x25')](_0x86dd('0x39'),_0x55f862[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x51fd89,{'showHidden':![],'depth':null}));this['emit'](util['format'](_0x86dd('0x3a'),_0x55f862[_0x86dd('0x24')]),_0x86dd('0x3b'),_0x51fd89);}}catch(_0x2ceb84){logger[_0x86dd('0x3c')](_0x86dd('0x3d'),_0x55f862[_0x86dd('0x27')],util['inspect'](_0x2ceb84,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncAgentConnect']=function(_0x1f78f2){try{if(this['isNotNull'](_0x1f78f2)){if(this[_0x86dd('0x8')][_0x1f78f2['uniqueid']]){for(var _0x194edd in this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]]){if(this[_0x86dd('0x8')][_0x1f78f2['uniqueid']][_0x86dd('0x3e')](_0x194edd)){if(_0x1f78f2[_0x86dd('0x2a')]===_0x194edd){logger[_0x86dd('0x23')](_0x86dd('0x3f'),_0x1f78f2[_0x86dd('0x27')],_0x1f78f2[_0x86dd('0x24')],_0x1f78f2[_0x86dd('0x2a')]);this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x40')]=moment()[_0x86dd('0x2c')](_0x86dd('0x2d'));this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x41')]=_0x1f78f2[_0x86dd('0x41')];this['channels'][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x42')]=_0x1f78f2[_0x86dd('0x42')];this['channels'][_0x1f78f2[_0x86dd('0x27')]][_0x194edd]['destchannelstate']=_0x1f78f2[_0x86dd('0x43')];this['channels'][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x44')]=_0x1f78f2['destchannelstatedesc'];this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x45')]=_0x1f78f2[_0x86dd('0x45')];this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x46')]=_0x86dd('0x47');if(this['voiceChannels'][this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x27')]]){var _0x138071=this[_0x86dd('0x9')][this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x27')]][_0x86dd('0x48')];this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x48')]=_0x138071;_0x1f78f2[_0x86dd('0x48')]=_0x138071;}_['merge'](this['agents'][_0x1f78f2['interface']],_[_0x86dd('0x49')](_0x1f78f2,[_0x86dd('0x2b'),_0x86dd('0x4a'),'routealias']));var _0x3d7987=this[_0x86dd('0xb')][_0x1f78f2['interface']];var _0x5afd01={'id':_0x3d7987['id'],'name':_0x3d7987[_0x86dd('0x4b')],'agentconnected':!![],'destaccountcode':_0x3d7987[_0x86dd('0x4c')],'destconnectedlinenum':this['channels'][_0x1f78f2[_0x86dd('0x27')]][_0x1f78f2[_0x86dd('0x2a')]]['exten'],'queue':this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x1f78f2[_0x86dd('0x2a')]][_0x86dd('0x2b')],'routealias':this[_0x86dd('0x8')][_0x1f78f2['uniqueid']][_0x1f78f2['destuniqueid']][_0x86dd('0x48')],'uniqueid':this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x1f78f2['destuniqueid']][_0x86dd('0x27')]};ami[_0x86dd('0x20')](_0x86dd('0x4d'),this['channels'][_0x1f78f2[_0x86dd('0x27')]][_0x1f78f2[_0x86dd('0x2a')]]);this[_0x86dd('0x20')](util[_0x86dd('0x2c')](_0x86dd('0x3a'),_0x1f78f2[_0x86dd('0x24')]),_0x86dd('0x4e'),_0x5afd01);}else if(!this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x12')]&&!this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x15')]){logger[_0x86dd('0x23')](_0x86dd('0x4f'),_0x1f78f2[_0x86dd('0x27')],this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x24')],_0x194edd);this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x12')]=!![];this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x50')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x86dd('0x8')][_0x1f78f2['uniqueid']][_0x194edd]['answeredelsewheredestinationuniqueid']=_0x1f78f2[_0x86dd('0x2a')];this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x51')]=_0x1f78f2['membername'];this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd][_0x86dd('0x46')]='answered_elsewhere';this[_0x86dd('0x8')][_0x1f78f2['uniqueid']][_0x194edd][_0x86dd('0x52')]=_0x86dd('0x53');logger['debug']('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x1f78f2['uniqueid'],util[_0x86dd('0x28')](this[_0x86dd('0x8')][_0x1f78f2[_0x86dd('0x27')]][_0x194edd],{'showHidden':![],'depth':null}));ami[_0x86dd('0x20')](_0x86dd('0x54'),this[_0x86dd('0x8')][_0x1f78f2['uniqueid']][_0x194edd]);}else{logger[_0x86dd('0x25')](_0x86dd('0x55'),_0x1f78f2[_0x86dd('0x27')]);}}}}}}catch(_0x29847f){logger[_0x86dd('0x3c')]('[%s][voiceAgentReport][agentconnect]',_0x1f78f2['uniqueid'],util[_0x86dd('0x28')](_0x29847f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x13')]=function(_0x3c0f75){try{if(this[_0x86dd('0x21')](_0x3c0f75)){logger[_0x86dd('0x25')](_0x86dd('0x56'),_0x3c0f75[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x3c0f75,{'showHidden':![],'depth':null}));if(this[_0x86dd('0x8')][_0x3c0f75['uniqueid']]&&this[_0x86dd('0x8')][_0x3c0f75[_0x86dd('0x27')]][_0x3c0f75['destuniqueid']]){logger[_0x86dd('0x23')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x3c0f75[_0x86dd('0x27')],_0x3c0f75[_0x86dd('0x24')],_0x3c0f75[_0x86dd('0x2a')]);var _0x4f31c9=this[_0x86dd('0xb')][_0x3c0f75[_0x86dd('0x29')]];var _0x58762d=this[_0x86dd('0x8')][_0x3c0f75[_0x86dd('0x27')]][_0x3c0f75[_0x86dd('0x2a')]];_0x58762d['agentringnoanswer']=!![];_0x58762d[_0x86dd('0x50')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x58762d['lastevent']=_0x86dd('0x57');_0x58762d[_0x86dd('0x52')]=_0x86dd('0x57');var _0x1afaf6={'id':_0x4f31c9['id'],'name':_0x4f31c9['name'],'queue':_0x58762d[_0x86dd('0x2b')],'uniqueid':_0x58762d['uniqueid']};logger[_0x86dd('0x25')]('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x3c0f75[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x1afaf6,{'showHidden':![],'depth':null}));this[_0x86dd('0x20')](util[_0x86dd('0x2c')]('user:%s',_0x4f31c9[_0x86dd('0x4b')]),_0x86dd('0x58'),_0x1afaf6);ami['emit']('custom:agentringnoanswer',_0x58762d);this[_0x86dd('0x8')][_0x3c0f75[_0x86dd('0x27')]][_0x3c0f75['destuniqueid']]=Object['assign']({},_0x58762d);}}}catch(_0x17621c){logger[_0x86dd('0x3c')](_0x86dd('0x59'),_0x3c0f75[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x17621c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x5a')]=function(_0x5f319){try{if(this[_0x86dd('0x21')](_0x5f319)){logger[_0x86dd('0x25')](_0x86dd('0x5b'),_0x5f319[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x5f319,{'showHidden':![],'depth':null}));if(this[_0x86dd('0x8')][_0x5f319['uniqueid']]){for(var _0x1d8383 in this['channels'][_0x5f319['uniqueid']]){if(this[_0x86dd('0x8')][_0x5f319[_0x86dd('0x27')]]['hasOwnProperty'](_0x1d8383)&&!this[_0x86dd('0x8')][_0x5f319[_0x86dd('0x27')]][_0x1d8383][_0x86dd('0x12')]&&!this[_0x86dd('0x8')][_0x5f319[_0x86dd('0x27')]][_0x1d8383][_0x86dd('0x15')]){logger[_0x86dd('0x23')](_0x86dd('0x5c'),_0x5f319[_0x86dd('0x27')],this['channels'][_0x5f319['uniqueid']][_0x1d8383][_0x86dd('0x24')],_0x1d8383);this[_0x86dd('0x8')][_0x5f319[_0x86dd('0x27')]][_0x1d8383][_0x86dd('0x12')]=!![];this[_0x86dd('0x8')][_0x5f319[_0x86dd('0x27')]][_0x1d8383][_0x86dd('0x50')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x86dd('0x8')][_0x5f319[_0x86dd('0x27')]][_0x1d8383][_0x86dd('0x46')]=_0x86dd('0x5d');this['channels'][_0x5f319[_0x86dd('0x27')]][_0x1d8383][_0x86dd('0x52')]='abandoned';logger[_0x86dd('0x25')](_0x86dd('0x5e'),_0x5f319[_0x86dd('0x27')],util['inspect'](this[_0x86dd('0x8')][_0x5f319[_0x86dd('0x27')]][_0x1d8383],{'showHidden':![],'depth':null}));ami['emit'](_0x86dd('0x5f'),this['channels'][_0x5f319['uniqueid']][_0x1d8383]);}}}}}catch(_0x28bfee){logger[_0x86dd('0x3c')](_0x86dd('0x60'),_0x5f319[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x28bfee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x16')]=function(_0x17a223){try{if(this[_0x86dd('0x21')](_0x17a223)){logger[_0x86dd('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20event:',_0x17a223[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x17a223,{'showHidden':![],'depth':null}));if(this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]]){for(var _0x8f0277 in this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]]){if(this['channels'][_0x17a223[_0x86dd('0x27')]][_0x86dd('0x3e')](_0x8f0277)){if(this['channels'][_0x17a223[_0x86dd('0x27')]][_0x8f0277][_0x86dd('0x40')]&&!this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277][_0x86dd('0x15')]){logger[_0x86dd('0x23')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x17a223[_0x86dd('0x27')],this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277][_0x86dd('0x24')],_0x8f0277);this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277]['agentcomplete']=!![];this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277][_0x86dd('0x61')]=moment()[_0x86dd('0x2c')](_0x86dd('0x2d'));this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277][_0x86dd('0x46')]=_0x86dd('0x62');this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277][_0x86dd('0x52')]=_0x17a223[_0x86dd('0x52')]==_0x86dd('0x63')?_0x86dd('0x64'):_0x17a223['reason'];this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277][_0x86dd('0x65')]=_0x17a223['talktime'];if(this['voiceQueues'][_0x17a223[_0x86dd('0x2b')]]&&this[_0x86dd('0xa')][_0x17a223[_0x86dd('0x2b')]][_0x86dd('0x66')]){this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277]['acwtime']=this[_0x86dd('0xa')][_0x17a223[_0x86dd('0x2b')]][_0x86dd('0x67')];this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277][_0x86dd('0x68')]=!![];}this[_0x86dd('0xb')][_0x17a223[_0x86dd('0x29')]]=_[_0x86dd('0x33')](this[_0x86dd('0xb')][_0x17a223[_0x86dd('0x29')]],[_0x86dd('0x2b'),_0x86dd('0x4a')]);logger[_0x86dd('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x17a223['uniqueid'],util[_0x86dd('0x28')](this[_0x86dd('0x8')][_0x17a223[_0x86dd('0x27')]][_0x8f0277],{'showHidden':![],'depth':null}));ami[_0x86dd('0x20')](_0x86dd('0x69'),this['channels'][_0x17a223[_0x86dd('0x27')]][_0x8f0277]);logger[_0x86dd('0x25')](_0x86dd('0x6a'),_0x17a223['uniqueid'],util[_0x86dd('0x28')]({'id':this[_0x86dd('0xb')][_0x17a223[_0x86dd('0x29')]]['id'],'destaccountcode':_0x17a223['destaccountcode']},{'showHidden':![],'depth':null}));this[_0x86dd('0x20')](util[_0x86dd('0x2c')](_0x86dd('0x3a'),_0x17a223[_0x86dd('0x24')]),_0x86dd('0x6b'),{'id':this['agents'][_0x17a223[_0x86dd('0x29')]]['id'],'destaccountcode':Number(_0x17a223[_0x86dd('0x6c')])});}}}}}}catch(_0x3fd79e){logger[_0x86dd('0x3c')]('[%s][voiceAgentReport][agentcomplete]',_0x17a223[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x3fd79e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x18')]=function(_0x105f54){try{if(this[_0x86dd('0x21')](_0x105f54)){logger[_0x86dd('0x25')](_0x86dd('0x6d'),_0x105f54[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x105f54,{'showHidden':![],'depth':null}));this[_0x86dd('0x6e')](_0x105f54[_0x86dd('0x27')],_[_0x86dd('0x6f')](_0x105f54[_0x86dd('0x70')])[0x0],_0x105f54[_0x86dd('0x71')]);if(this['channels'][_0x105f54[_0x86dd('0x27')]]){for(var _0x56b05c in this[_0x86dd('0x8')][_0x105f54[_0x86dd('0x27')]]){if(this[_0x86dd('0x8')][_0x105f54[_0x86dd('0x27')]][_0x86dd('0x3e')](_0x56b05c)){logger[_0x86dd('0x23')](_0x86dd('0x72'),_0x105f54[_0x86dd('0x27')],_0x56b05c,_[_0x86dd('0x6f')](_0x105f54[_0x86dd('0x70')])[0x0],_0x105f54[_0x86dd('0x71')]);if(_[_0x86dd('0x22')](this[_0x86dd('0x8')][_0x105f54[_0x86dd('0x27')]][_0x56b05c][_0x86dd('0xc')])){this['channels'][_0x105f54[_0x86dd('0x27')]][_0x56b05c][_0x86dd('0xc')]={};}this[_0x86dd('0x8')][_0x105f54['uniqueid']][_0x56b05c][_0x86dd('0xc')]=this['variables'][_0x105f54[_0x86dd('0x27')]];}}}}}catch(_0x148e35){logger['error']('[%s][voiceAgentReport][varset]',_0x105f54[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x148e35,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x6e')]=function(_0x81530a,_0x167db1,_0x55dbb8){var _0x1167d0=[_0x86dd('0x73'),_0x86dd('0x74'),_0x86dd('0x75'),_0x86dd('0x76'),_0x86dd('0x77'),'rtpaudioqoslossbridged',_0x86dd('0x78'),_0x86dd('0x79'),_0x86dd('0x7a'),_0x86dd('0x7b'),'bridgepeer',_0x86dd('0x7c'),_0x86dd('0x7d'),_0x86dd('0x7e'),_0x86dd('0x7f'),_0x86dd('0x80'),_0x86dd('0x24'),_0x86dd('0x81'),_0x86dd('0x82')];if(!_[_0x86dd('0x83')](_0x167db1)&&!_[_0x86dd('0x84')](_0x1167d0,_0x167db1)){if(_[_0x86dd('0x22')](this['variables'][_0x81530a])){this[_0x86dd('0xc')][_0x81530a]={};}this['variables'][_0x81530a][_0x167db1]=_0x55dbb8;}};VoiceAgentReport['prototype'][_0x86dd('0x19')]=function(_0x493133){try{if(this[_0x86dd('0x21')](_0x493133)){logger[_0x86dd('0x25')](_0x86dd('0x85'),_0x493133['uniqueid'],util[_0x86dd('0x28')](_0x493133,{'showHidden':![],'depth':null}));if(this[_0x86dd('0x8')][_0x493133[_0x86dd('0x27')]]){for(var _0xa32eda in this['channels'][_0x493133[_0x86dd('0x27')]]){if(this[_0x86dd('0x8')][_0x493133[_0x86dd('0x27')]][_0x86dd('0x3e')](_0xa32eda)){if(this[_0x86dd('0x8')][_0x493133[_0x86dd('0x27')]][_0xa32eda][_0x86dd('0x52')]==_0x86dd('0x63')&&this['channels'][_0x493133[_0x86dd('0x27')]][_0xa32eda]['agentcomplete']){logger[_0x86dd('0x23')](_0x86dd('0x86'),_0x493133[_0x86dd('0x27')],_0xa32eda);this[_0x86dd('0x8')][_0x493133[_0x86dd('0x27')]][_0xa32eda][_0x86dd('0x61')]=moment()['format'](_0x86dd('0x2d'));}}}logger[_0x86dd('0x25')](_0x86dd('0x87'),_0x493133[_0x86dd('0x27')],util['inspect'](_[_0x86dd('0x88')](this[_0x86dd('0x8')][_0x493133[_0x86dd('0x27')]]),{'showHidden':![],'depth':null}));ami[_0x86dd('0x20')]('custom:voiceAgentReport',_[_0x86dd('0x88')](this[_0x86dd('0x8')][_0x493133[_0x86dd('0x27')]]));delete this[_0x86dd('0x8')][_0x493133['uniqueid']];}if(this[_0x86dd('0xc')][_0x493133[_0x86dd('0x27')]]){delete this[_0x86dd('0xc')][_0x493133[_0x86dd('0x27')]];}}}catch(_0x5ee780){logger['error'](_0x86dd('0x89'),_0x493133[_0x86dd('0x27')],util['inspect'](_0x5ee780,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x86dd('0x1d')]=function(_0x502b0d){try{if(this['isNotNull'](_0x502b0d)){logger['debug'](_0x86dd('0x8a'),_0x502b0d[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x502b0d,{'showHidden':![],'depth':null}));if(this['channels'][_0x502b0d[_0x86dd('0x8b')]]){for(var _0x307b33 in this[_0x86dd('0x8')][_0x502b0d['transfereeuniqueid']]){if(this[_0x86dd('0x8')][_0x502b0d['transfereeuniqueid']][_0x86dd('0x3e')](_0x307b33)){if(_0x502b0d['origtransfereruniqueid']===_0x307b33){logger[_0x86dd('0x23')]('[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x502b0d['uniqueid'],this['channels'][_0x502b0d[_0x86dd('0x8b')]][_0x307b33]['membername'],_0x307b33);var _0x458023=moment();this[_0x86dd('0x8')][_0x502b0d[_0x86dd('0x8b')]][_0x307b33][_0x86dd('0x15')]=!![];this[_0x86dd('0x8')][_0x502b0d[_0x86dd('0x8b')]][_0x307b33][_0x86dd('0x61')]=moment()['format'](_0x86dd('0x2d'));this['channels'][_0x502b0d[_0x86dd('0x8b')]][_0x307b33][_0x86dd('0x46')]=_0x86dd('0x62');this[_0x86dd('0x8')][_0x502b0d[_0x86dd('0x8b')]][_0x307b33][_0x86dd('0x52')]=_0x86dd('0x63');this['channels'][_0x502b0d['transfereeuniqueid']][_0x307b33][_0x86dd('0x65')]=_0x458023[_0x86dd('0x8c')](this[_0x86dd('0x8')][_0x502b0d['transfereeuniqueid']][_0x307b33][_0x86dd('0x40')],_0x86dd('0x8d'));}}}}if(this[_0x86dd('0x8')][_0x502b0d[_0x86dd('0x8e')]]){var _0xcb78bc=this[_0x86dd('0x8')][_0x502b0d[_0x86dd('0x8e')]];this['channels'][_0x502b0d[_0x86dd('0x8e')]]=this['channels'][_0x502b0d[_0x86dd('0x8b')]];this['channels'][_0x502b0d[_0x86dd('0x8b')]]=_0xcb78bc;}}}catch(_0x46eccd){logger[_0x86dd('0x3c')]('[%s][voiceAgentReport][attendedtransfer]',_0x502b0d[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x46eccd,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x86dd('0x1e')]=function(_0x5033bd){try{if(this[_0x86dd('0x21')](_0x5033bd)){logger['debug'](_0x86dd('0x8f'),_0x5033bd['uniqueid'],util['inspect'](_0x5033bd,{'showHidden':![],'depth':null}));if(this[_0x86dd('0x8')][_0x5033bd['transfereeuniqueid']]){for(var _0x3850fb in this[_0x86dd('0x8')][_0x5033bd[_0x86dd('0x8b')]]){if(this['channels'][_0x5033bd['transfereeuniqueid']][_0x86dd('0x3e')](_0x3850fb)){if(_0x5033bd[_0x86dd('0x90')]===_0x3850fb){logger[_0x86dd('0x23')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5033bd['uniqueid'],this[_0x86dd('0x8')][_0x5033bd[_0x86dd('0x8b')]][_0x3850fb][_0x86dd('0x24')],_0x3850fb);var _0x4bcdc0=moment();this[_0x86dd('0x8')][_0x5033bd[_0x86dd('0x8b')]][_0x3850fb][_0x86dd('0x15')]=!![];this[_0x86dd('0x8')][_0x5033bd[_0x86dd('0x8b')]][_0x3850fb][_0x86dd('0x61')]=_0x4bcdc0;this[_0x86dd('0x8')][_0x5033bd[_0x86dd('0x8b')]][_0x3850fb][_0x86dd('0x46')]=_0x86dd('0x62');this['channels'][_0x5033bd['transfereeuniqueid']][_0x3850fb]['reason']=_0x86dd('0x63');this[_0x86dd('0x8')][_0x5033bd['transfereeuniqueid']][_0x3850fb][_0x86dd('0x65')]=_0x4bcdc0[_0x86dd('0x8c')](this[_0x86dd('0x8')][_0x5033bd[_0x86dd('0x8b')]][_0x3850fb]['agentconnectAt'],_0x86dd('0x8d'));}}}}}}catch(_0xf06a8c){logger[_0x86dd('0x3c')]('[%s][voiceAgentReport][blindtransfer]',_0x5033bd[_0x86dd('0x27')],util['inspect'](_0xf06a8c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x91')]=function(_0x405fd7){var _0x301eaa='';try{if(this[_0x86dd('0x21')](_0x405fd7)){logger[_0x86dd('0x25')](_0x86dd('0x92'),_0x405fd7['uniqueid'],util['inspect'](_0x405fd7,{'showHidden':![],'depth':null}));if(_0x405fd7['channel']){_0x301eaa=_0x405fd7[_0x86dd('0x93')][_0x86dd('0x94')](0x0,_0x405fd7[_0x86dd('0x93')]['lastIndexOf']('-'));if(this['agents'][_0x301eaa]){logger['info'](_0x86dd('0x95'),_0x405fd7[_0x86dd('0x27')],_0x301eaa);this[_0x86dd('0xb')][_0x301eaa][_0x86dd('0x96')]=!![];}}}}catch(_0x10bd30){logger[_0x86dd('0x3c')](_0x86dd('0x97'),_0x405fd7['uniqueid'],util[_0x86dd('0x28')](_0x10bd30,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x86dd('0x1f')][_0x86dd('0x98')]=function(_0x4c753d){var _0x18db22='';try{if(this[_0x86dd('0x21')](_0x4c753d)){logger[_0x86dd('0x25')](_0x86dd('0x99'),_0x4c753d[_0x86dd('0x27')],util[_0x86dd('0x28')](_0x4c753d,{'showHidden':![],'depth':null}));if(_0x4c753d[_0x86dd('0x93')]){_0x18db22=_0x4c753d['channel'][_0x86dd('0x94')](0x0,_0x4c753d[_0x86dd('0x93')][_0x86dd('0x9a')]('-'));if(this[_0x86dd('0xb')][_0x18db22]){logger['info']('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0x4c753d[_0x86dd('0x27')],_0x18db22);this[_0x86dd('0xb')][_0x18db22][_0x86dd('0x96')]=![];}}}}catch(_0x214298){logger[_0x86dd('0x3c')](_0x86dd('0x9b'),_0x4c753d['uniqueid'],util[_0x86dd('0x28')](_0x214298,{'showHidden':![],'depth':null}));}};module[_0x86dd('0x9c')]=VoiceAgentReport;
\ No newline at end of file
index 74b36bb..91440f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd290=['transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transferToInternal','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','[%s][voiceCallReport][blindtransfer]\x20event:','extension','BLIND','BlindTransfer','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','mohtime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','ioredis','../../../config/environment','../../../config/logger','../ami','../model/channel','set','queue','agi','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewState','varset','syncVarSet','hangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','error','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','inspect','linkedid','merge','pick','keys','context','from-sip','split','destconnectedlinenum','connectedlinenum','user:%s','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','blindTransfers','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','undefined','name','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','duration','subtract','seconds','includes','lastapplication','lastdata','cdr(','match','type','calleridnum','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','disposition','UserId','membername','xcally-motion-preview','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','isNil','monitors','[%s][voiceCallReport][mixMonitorFilename]','OutgoingSpoolFailed','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcallid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','length','transferType','resolve','then','isEmpty','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum'];(function(_0x28b2c4,_0x229a74){var _0xf9b5e7=function(_0x48a7de){while(--_0x48a7de){_0x28b2c4['push'](_0x28b2c4['shift']());}};_0xf9b5e7(++_0x229a74);}(_0xd290,0xe4));var _0x0d29=function(_0x3a7cb7,_0x938f37){_0x3a7cb7=_0x3a7cb7-0x0;var _0x3937b6=_0xd290[_0x3a7cb7];return _0x3937b6;};'use strict';var _=require(_0x0d29('0x0'));var moment=require(_0x0d29('0x1'));var util=require(_0x0d29('0x2'));var path=require(_0x0d29('0x3'));var Redis=require(_0x0d29('0x4'));var config=require(_0x0d29('0x5'));var logger=require(_0x0d29('0x6'))('ami');var ami=require(_0x0d29('0x7'));var Channel=require(_0x0d29('0x8'));var RpcSetting=require('../rpc/setting');var applications=[_0x0d29('0x9'),_0x0d29('0xa'),_0x0d29('0xb'),'dial',_0x0d29('0xc'),_0x0d29('0xd')];var dispositions=[_0x0d29('0xe'),_0x0d29('0xf'),_0x0d29('0xf'),_0x0d29('0xe'),_0x0d29('0xe'),_0x0d29('0xe'),_0x0d29('0x10'),_0x0d29('0x11'),_0x0d29('0xf'),_0x0d29('0xf'),'FAILED'];config['redis']=_['defaults'](config[_0x0d29('0x12')],{'host':_0x0d29('0x13'),'port':0x18eb});var io=require(_0x0d29('0x14'))(new Redis(config[_0x0d29('0x12')]));function VoiceCallReport(_0x299c47){this[_0x0d29('0x15')]=_0x299c47[_0x0d29('0x15')];this[_0x0d29('0x16')]=_0x299c47[_0x0d29('0x16')];this['blindTransfers']={};ami['on'](_0x0d29('0x17'),this[_0x0d29('0x18')][_0x0d29('0x19')](this));ami['on'](_0x0d29('0x1a'),this[_0x0d29('0x18')]['bind'](this));ami['on']('newchannel',this['syncNewChannel']['bind'](this));ami['on']('newstate',this[_0x0d29('0x1b')][_0x0d29('0x19')](this));ami['on'](_0x0d29('0x1c'),this[_0x0d29('0x1d')][_0x0d29('0x19')](this));ami['on'](_0x0d29('0x1e'),this['syncHangup'][_0x0d29('0x19')](this));ami['on'](_0x0d29('0x1f'),this[_0x0d29('0x20')][_0x0d29('0x19')](this));ami['on'](_0x0d29('0x21'),this[_0x0d29('0x22')]['bind'](this));ami['on'](_0x0d29('0x23'),this[_0x0d29('0x24')][_0x0d29('0x19')](this));ami['on'](_0x0d29('0x25'),this[_0x0d29('0x26')][_0x0d29('0x19')](this));ami['on'](_0x0d29('0x27'),this[_0x0d29('0x28')][_0x0d29('0x19')](this));try{logger[_0x0d29('0x29')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x51bcd1){logger[_0x0d29('0x2a')]('[voiceCallReport][coreshowchannels]',util['inspect'](_0x51bcd1,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x0d29('0x2b')][_0x0d29('0x2c')]=function(_0x184ec){return _0x184ec!==null&&!_[_0x0d29('0x2d')](_0x184ec);};VoiceCallReport[_0x0d29('0x2b')]['emit']=function(_0x2a2ef6,_0x5d1a3b,_0x2bb19a){io['to'](_0x2a2ef6)[_0x0d29('0x2e')](_0x5d1a3b,_0x2bb19a);};VoiceCallReport[_0x0d29('0x2b')]['syncNewCallerId']=function(_0x16100a){try{if(this[_0x0d29('0x2c')](_0x16100a)){logger['info'](_0x0d29('0x2f'),_0x16100a[_0x0d29('0x30')],_0x16100a[_0x0d29('0x31')],_0x16100a['calleridnum']);logger[_0x0d29('0x32')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x16100a[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x16100a,{'showHidden':![],'depth':null}));if(_0x16100a[_0x0d29('0x30')]===_0x16100a[_0x0d29('0x34')]){if(!_[_0x0d29('0x2d')](this[_0x0d29('0x15')][_0x16100a[_0x0d29('0x30')]])){_[_0x0d29('0x35')](this[_0x0d29('0x15')][_0x16100a[_0x0d29('0x30')]],_[_0x0d29('0x36')](_0x16100a,_[_0x0d29('0x37')](this['channels'][_0x16100a['uniqueid']])));}}if(_0x16100a[_0x0d29('0x38')]===_0x0d29('0x39')){var _0x459811=this['agents'][_0x16100a['channel'][_0x0d29('0x3a')]('-')[0x0]];if(_0x459811){if(_0x16100a['exten']=='xcally-motion-preview'){_0x459811[_0x0d29('0x3b')]=_0x16100a[_0x0d29('0x3c')];this[_0x0d29('0x2e')](util['format'](_0x0d29('0x3d'),_0x459811['name']),_0x0d29('0x3e'),{'id':_0x459811['id'],'destaccountcode':_0x459811[_0x0d29('0x3f')],'destconnectedlinenum':_0x16100a[_0x0d29('0x3c')]});}}}}}catch(_0x33fe1a){logger[_0x0d29('0x2a')](_0x0d29('0x40'),_0x16100a[_0x0d29('0x30')],util['inspect'](_0x33fe1a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d29('0x2b')]['syncNewChannel']=function(_0x5f0a7e){try{if(this['isNotNull'](_0x5f0a7e)){logger[_0x0d29('0x32')](_0x0d29('0x41'),_0x5f0a7e[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x5f0a7e,{'showHidden':![],'depth':null}));if(this['channels'][_0x5f0a7e[_0x0d29('0x30')]]){return;}if(_0x5f0a7e[_0x0d29('0x42')]==='OutgoingSpoolFailed'){return;}if(_0x5f0a7e[_0x0d29('0x30')]!==_0x5f0a7e[_0x0d29('0x34')]&&!this[_0x0d29('0x43')][_0x5f0a7e[_0x0d29('0x34')]]){return;}logger[_0x0d29('0x29')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x5f0a7e[_0x0d29('0x30')],_0x5f0a7e[_0x0d29('0x38')],_0x5f0a7e[_0x0d29('0x44')]);this[_0x0d29('0x15')][_0x5f0a7e[_0x0d29('0x30')]]=new Channel();this['channels'][_0x5f0a7e[_0x0d29('0x30')]][_0x0d29('0x45')]=moment()[_0x0d29('0x46')](_0x0d29('0x47'));this[_0x0d29('0x15')][_0x5f0a7e[_0x0d29('0x30')]]['disposition']=dispositions[_[_0x0d29('0x48')](_0x5f0a7e[_0x0d29('0x49')])];_['merge'](this[_0x0d29('0x15')][_0x5f0a7e[_0x0d29('0x30')]],_['pick'](_0x5f0a7e,_[_0x0d29('0x37')](this[_0x0d29('0x15')][_0x5f0a7e[_0x0d29('0x30')]])));if(_0x5f0a7e[_0x0d29('0x38')]===_0x0d29('0x39')){var _0x19fb77=this[_0x0d29('0x16')][_0x5f0a7e[_0x0d29('0x42')][_0x0d29('0x3a')]('-')[0x0]];if(_0x19fb77&&typeof _0x19fb77['destconnectedlinenum']===_0x0d29('0x4a')){_0x19fb77[_0x0d29('0x3b')]=_0x5f0a7e[_0x0d29('0x44')];logger[_0x0d29('0x32')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x5f0a7e[_0x0d29('0x30')],util[_0x0d29('0x33')]({'id':_0x19fb77['id'],'destaccountcode':_0x19fb77['accountcode'],'destconnectedlinenum':_0x5f0a7e['exten']},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x19fb77[_0x0d29('0x4b')]),_0x0d29('0x3e'),{'id':_0x19fb77['id'],'destaccountcode':_0x19fb77[_0x0d29('0x3f')],'destconnectedlinenum':_0x5f0a7e['exten']});}}}}catch(_0x2c4d34){logger['error']('[%s][voiceCallReport][newchannel]',_0x5f0a7e['uniqueid'],util[_0x0d29('0x33')](_0x2c4d34,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0d29('0x18')]=function(_0x30efb1){try{if(this[_0x0d29('0x2c')](_0x30efb1)){logger[_0x0d29('0x32')](_0x0d29('0x4c'),_0x30efb1[_0x0d29('0x30')],util['inspect'](_0x30efb1,{'showHidden':![],'depth':null}));if(_0x30efb1[_0x0d29('0x42')]==='OutgoingSpoolFailed'||_0x30efb1[_0x0d29('0x44')]==='h')return;if(_0x30efb1[_0x0d29('0x30')]===_0x30efb1[_0x0d29('0x34')]||this[_0x0d29('0x43')][_0x30efb1[_0x0d29('0x34')]]){_0x30efb1[_0x0d29('0x4d')]=_0x30efb1[_0x0d29('0x4d')]?_0x30efb1['application'][_0x0d29('0x4e')]():undefined;_0x30efb1[_0x0d29('0x4f')]=_0x30efb1['appdata']||_0x30efb1[_0x0d29('0x4f')];if(_0x30efb1[_0x0d29('0x50')]&&!_0x30efb1[_0x0d29('0x50')][_0x0d29('0x51')](_0x0d29('0x52'))&&_0x30efb1[_0x0d29('0x4d')]!=='queue'){_0x30efb1['applicationdata']=_0x30efb1['applicationdata']['toLowerCase']();}logger[_0x0d29('0x29')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x30efb1[_0x0d29('0x30')],_0x30efb1[_0x0d29('0x4d')],_0x30efb1[_0x0d29('0x4f')]);if(_[_0x0d29('0x2d')](this[_0x0d29('0x15')][_0x30efb1[_0x0d29('0x30')]])){this[_0x0d29('0x15')][_0x30efb1['uniqueid']]=new Channel();this[_0x0d29('0x15')][_0x30efb1[_0x0d29('0x30')]][_0x0d29('0x45')]=_0x30efb1[_0x0d29('0x53')]?moment()[_0x0d29('0x54')](moment['duration'](_0x30efb1[_0x0d29('0x53')])[_0x0d29('0x55')](),_0x0d29('0x55'))[_0x0d29('0x46')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0x0d29('0x46')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x30efb1['uniqueid']]['disposition']=_0x0d29('0xe');}_[_0x0d29('0x35')](this['channels'][_0x30efb1['uniqueid']],_['pick'](_0x30efb1,_[_0x0d29('0x37')](this['channels'][_0x30efb1[_0x0d29('0x30')]])));if(_[_0x0d29('0x56')](applications,_0x30efb1[_0x0d29('0x4d')])){this[_0x0d29('0x15')][_0x30efb1[_0x0d29('0x30')]][_0x0d29('0x57')]=_0x30efb1['application'];this[_0x0d29('0x15')][_0x30efb1[_0x0d29('0x30')]][_0x0d29('0x58')]=_0x30efb1[_0x0d29('0x4f')];if(_0x30efb1[_0x0d29('0x4d')]===_0x0d29('0x9')&&_[_0x0d29('0x51')](_0x30efb1[_0x0d29('0x4f')][_0x0d29('0x4e')](),_0x0d29('0x59'))){var _0xf4fe7=_0x30efb1[_0x0d29('0x4f')][_0x0d29('0x3a')]('=');var _0x19841d=_0xf4fe7[0x0][_0x0d29('0x4e')]()[_0x0d29('0x5a')](/cdr\((.*)\)/);if(_0x19841d){if(_0x19841d[0x1]===_0x0d29('0x5b')&&!_['isNil'](this[_0x0d29('0x15')][_0x30efb1['uniqueid']][_0x19841d[0x1]]))return;this[_0x0d29('0x15')][_0x30efb1['uniqueid']][_0x19841d[0x1]]=_0xf4fe7[0x1];}}else if(_0x30efb1[_0x0d29('0x4d')]===_0x0d29('0xa')){this[_0x0d29('0x15')][_0x30efb1['uniqueid']][_0x0d29('0xa')]=_0x30efb1['applicationdata']['split'](',')[0x0];}}}}}catch(_0x1d43d3){logger['error']('[%s][voiceCallReport][newexten]',_0x30efb1[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x1d43d3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d29('0x2b')]['syncNewState']=function(_0x1033d0){try{if(this[_0x0d29('0x2c')](_0x1033d0)){logger[_0x0d29('0x29')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x1033d0[_0x0d29('0x30')],_0x1033d0[_0x0d29('0x34')],_0x1033d0[_0x0d29('0x31')],_0x1033d0[_0x0d29('0x5c')]);logger[_0x0d29('0x32')](_0x0d29('0x5d'),_0x1033d0[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x1033d0,{'showHidden':![],'depth':null}));if(_0x1033d0[_0x0d29('0x49')]!=='6')return;var _0x5aedad=this[_0x0d29('0x16')][_0x1033d0['channel'][_0x0d29('0x3a')]('-')[0x0]];if(_0x1033d0[_0x0d29('0x30')]!==_0x1033d0['linkedid']){var _0x45e2fa=moment();if(this['channels'][_0x1033d0[_0x0d29('0x34')]]){if(!this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x34')]][_0x0d29('0x5e')]){this['channels'][_0x1033d0[_0x0d29('0x34')]]['answered']=!![];this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x34')]][_0x0d29('0x5f')]=_0x45e2fa[_0x0d29('0x46')]('YYYY-MM-DD\x20HH:mm:ss');if(this['channels'][_0x1033d0['linkedid']][_0x0d29('0x45')]){this[_0x0d29('0x15')][_0x1033d0['linkedid']][_0x0d29('0x60')]=_0x45e2fa[_0x0d29('0x61')](this[_0x0d29('0x15')][_0x1033d0['linkedid']][_0x0d29('0x45')],_0x0d29('0x55'));}}this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x34')]]['linkedid']=_0x1033d0['uniqueid'];if(_0x1033d0[_0x0d29('0x5c')]!=='xcally-motion-preview'){this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x34')]]['connectedlinenum']=_0x1033d0[_0x0d29('0x5c')];}this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x34')]][_0x0d29('0x62')]=_0x1033d0[_0x0d29('0x31')];this['channels'][_0x1033d0['linkedid']][_0x0d29('0x63')]=_0x1033d0[_0x0d29('0x42')];this['channels'][_0x1033d0[_0x0d29('0x34')]][_0x0d29('0x64')]=dispositions[_[_0x0d29('0x48')](_0x1033d0[_0x0d29('0x49')])];if(_0x5aedad){this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x34')]][_0x0d29('0x65')]=_0x5aedad['id'];this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x34')]][_0x0d29('0x66')]=_0x5aedad[_0x0d29('0x4b')];}}if(this[_0x0d29('0x15')][_0x1033d0['uniqueid']]){if(!this['channels'][_0x1033d0[_0x0d29('0x30')]][_0x0d29('0x5e')]){this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x30')]][_0x0d29('0x5e')]=!![];this['channels'][_0x1033d0['uniqueid']][_0x0d29('0x5f')]=_0x45e2fa[_0x0d29('0x46')]('YYYY-MM-DD\x20HH:mm:ss');if(this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x30')]]['starttime']){this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x30')]][_0x0d29('0x60')]=_0x45e2fa[_0x0d29('0x61')](this['channels'][_0x1033d0['uniqueid']][_0x0d29('0x45')],'seconds');}}if(_0x1033d0[_0x0d29('0x5c')]!==_0x0d29('0x67')){this['channels'][_0x1033d0['uniqueid']]['connectedlinenum']=_0x1033d0[_0x0d29('0x5c')];}this[_0x0d29('0x15')][_0x1033d0['uniqueid']][_0x0d29('0x62')]=_0x1033d0['calleridname'];this[_0x0d29('0x15')][_0x1033d0['uniqueid']][_0x0d29('0x63')]=_0x1033d0[_0x0d29('0x42')];this['channels'][_0x1033d0[_0x0d29('0x30')]][_0x0d29('0x64')]=dispositions[_['toNumber'](_0x1033d0['channelstate'])];}}else{if(this[_0x0d29('0x15')][_0x1033d0['uniqueid']]){if(_0x5aedad){this[_0x0d29('0x15')][_0x1033d0['uniqueid']][_0x0d29('0x65')]=_0x5aedad['id'];this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x30')]][_0x0d29('0x66')]=_0x5aedad['name'];}}}if(_0x1033d0[_0x0d29('0x38')]===_0x0d29('0x39')){if(_0x5aedad){_0x5aedad[_0x0d29('0x3b')]=_0x1033d0[_0x0d29('0x44')];var _0x5c9546,_0x2edf2b;if(this[_0x0d29('0x15')][_0x1033d0['uniqueid']]){_0x5c9546=this['channels'][_0x1033d0[_0x0d29('0x30')]][_0x0d29('0x68')];_0x2edf2b=this[_0x0d29('0x15')][_0x1033d0['uniqueid']][_0x0d29('0xa')];}else if(this['channels'][_0x1033d0[_0x0d29('0x34')]]){_0x5c9546=this[_0x0d29('0x15')][_0x1033d0[_0x0d29('0x34')]][_0x0d29('0x68')];_0x2edf2b=this[_0x0d29('0x15')][_0x1033d0['linkedid']][_0x0d29('0xa')];}_0x5aedad['queue']=_0x2edf2b;_0x5aedad[_0x0d29('0x68')]=_0x5c9546;var _0x57a2b3={'id':_0x5aedad['id'],'name':_0x5aedad['name'],'agentconnected':!![],'destaccountcode':_0x5aedad[_0x0d29('0x3f')],'destconnectedlinenum':_0x1033d0[_0x0d29('0x44')],'queue':_0x2edf2b||undefined,'routealias':_0x5c9546,'uniqueid':_0x1033d0[_0x0d29('0x34')]};logger[_0x0d29('0x32')](_0x0d29('0x69'),_0x1033d0['uniqueid'],util['inspect'](_0x57a2b3,{'showHidden':![],'depth':null}));this[_0x0d29('0x2e')](util[_0x0d29('0x46')]('user:%s',_0x5aedad['name']),_0x0d29('0x3e'),_0x57a2b3);}}}}catch(_0x52bff2){logger[_0x0d29('0x2a')](_0x0d29('0x6a'),_0x1033d0[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x52bff2,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0d29('0x6b')]=function(_0x4b9def,_0x38ab1c){try{if(this[_0x0d29('0x15')][_0x4b9def]){logger['info'](_0x0d29('0x6c'),_0x4b9def,_0x38ab1c);this[_0x0d29('0x15')][_0x4b9def][_0x0d29('0x6d')]=!![];if(_[_0x0d29('0x6e')](_0x38ab1c,_0x0d29('0x6f'))){_0x38ab1c=_0x38ab1c['replace'](_0x0d29('0x6f'),_0x0d29('0x70'));}this[_0x0d29('0x15')][_0x4b9def][_0x0d29('0x71')]=_0x38ab1c;var _0x2dfd35=_[_0x0d29('0x72')](this['channels'][_0x4b9def]['monitors'],{'filename':_0x38ab1c});if(_[_0x0d29('0x73')](_0x2dfd35)){this['channels'][_0x4b9def][_0x0d29('0x74')]['push']({'filename':_0x38ab1c,'createdAt':moment()[_0x0d29('0x46')](_0x0d29('0x47')),'mixmonitorid':'','status':'rec'});}}}catch(_0xba0cd7){logger[_0x0d29('0x2a')](_0x0d29('0x75'),_0x4b9def,util[_0x0d29('0x33')](_0xba0cd7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d29('0x2b')]['syncVarSet']=function(_0x36ae8e){try{if(this['isNotNull'](_0x36ae8e)){logger[_0x0d29('0x32')]('[%s][voiceCallReport][varset]\x20event:',_0x36ae8e[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x36ae8e,{'showHidden':![],'depth':null}));if(this[_0x0d29('0x15')][_0x36ae8e['uniqueid']]&&_0x36ae8e[_0x0d29('0x42')]!=_0x0d29('0x76')){if(this[_0x0d29('0x2c')](_0x36ae8e[_0x0d29('0x77')])){if(this[_0x0d29('0x2c')](_0x36ae8e[_0x0d29('0x77')][_0x0d29('0x78')])){logger[_0x0d29('0x29')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x36ae8e['uniqueid'],_0x36ae8e['value']);this['syncMixMonitorFilename'](_0x36ae8e[_0x0d29('0x30')],_0x36ae8e[_0x0d29('0x79')]);}else if(this[_0x0d29('0x2c')](_0x36ae8e[_0x0d29('0x77')][_0x0d29('0x7a')])){logger[_0x0d29('0x29')](_0x0d29('0x7b'),_0x36ae8e['uniqueid'],_0x36ae8e[_0x0d29('0x79')]);this[_0x0d29('0x15')][_0x36ae8e[_0x0d29('0x30')]]['calleridnum']=_0x36ae8e[_0x0d29('0x79')];}else if(this['isNotNull'](_0x36ae8e[_0x0d29('0x77')]['xmd-callerid'])){logger[_0x0d29('0x29')](_0x0d29('0x7c'),_0x36ae8e[_0x0d29('0x30')],_0x36ae8e[_0x0d29('0x79')]);this[_0x0d29('0x15')][_0x36ae8e[_0x0d29('0x30')]][_0x0d29('0x7d')]=_0x36ae8e['value'];}else if(this[_0x0d29('0x2c')](_0x36ae8e['variable'][_0x0d29('0x7e')])){logger[_0x0d29('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x36ae8e[_0x0d29('0x30')],_0x36ae8e[_0x0d29('0x79')]);this[_0x0d29('0x15')][_0x36ae8e['uniqueid']]['type']=_0x36ae8e['value'];}else if(this[_0x0d29('0x2c')](_0x36ae8e[_0x0d29('0x77')][_0x0d29('0x7f')])){logger['info'](_0x0d29('0x80'),_0x36ae8e[_0x0d29('0x30')],_0x36ae8e[_0x0d29('0x79')][_0x0d29('0x3a')](',')[0x0]);this['channels'][_0x36ae8e[_0x0d29('0x30')]][_0x0d29('0xa')]=_0x36ae8e[_0x0d29('0x79')][_0x0d29('0x3a')](',')[0x0];}else if(this[_0x0d29('0x2c')](_0x36ae8e[_0x0d29('0x77')][_0x0d29('0x81')])){logger[_0x0d29('0x29')](_0x0d29('0x82'),_0x36ae8e[_0x0d29('0x30')],_0x36ae8e[_0x0d29('0x79')]);this[_0x0d29('0x15')][_0x36ae8e['uniqueid']][_0x0d29('0x83')]=_0x36ae8e['value'];}else if(this[_0x0d29('0x2c')](_0x36ae8e[_0x0d29('0x77')][_0x0d29('0x84')])){logger[_0x0d29('0x29')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x36ae8e['uniqueid'],_0x36ae8e['value']);this[_0x0d29('0x15')][_0x36ae8e[_0x0d29('0x30')]]['destination']=_0x36ae8e[_0x0d29('0x79')];}else if(this['isNotNull'](_0x36ae8e[_0x0d29('0x77')]['xmd-callerid-preview'])){logger[_0x0d29('0x29')](_0x0d29('0x85'),_0x36ae8e[_0x0d29('0x30')],_0x36ae8e['value']);this[_0x0d29('0x15')][_0x36ae8e[_0x0d29('0x30')]][_0x0d29('0x86')]=_0x36ae8e[_0x0d29('0x79')];}else if(this[_0x0d29('0x2c')](_0x36ae8e['variable'][_0x0d29('0x87')])){logger[_0x0d29('0x29')](_0x0d29('0x88'),_0x36ae8e[_0x0d29('0x30')],_0x36ae8e[_0x0d29('0x79')]);this[_0x0d29('0x15')][_0x36ae8e[_0x0d29('0x30')]][_0x0d29('0xa')]=_0x36ae8e[_0x0d29('0x79')];}else if(this[_0x0d29('0x2c')](_0x36ae8e['variable']['sipcallid'])){logger[_0x0d29('0x29')](_0x0d29('0x89'),_0x36ae8e['uniqueid'],_0x36ae8e[_0x0d29('0x79')]);this[_0x0d29('0x15')][_0x36ae8e[_0x0d29('0x30')]][_0x0d29('0x8a')]=_0x36ae8e[_0x0d29('0x79')];}}}else if(this[_0x0d29('0x2c')](_0x36ae8e[_0x0d29('0x77')]['mixmonitor_filename'])){if(_0x36ae8e['value']){var _0x1c9dae=path[_0x0d29('0x8b')](_0x36ae8e[_0x0d29('0x79')])[_0x0d29('0x4b')];logger[_0x0d29('0x29')](_0x0d29('0x8c'),_0x1c9dae,_0x36ae8e[_0x0d29('0x79')]);this[_0x0d29('0x6b')](_0x1c9dae,_0x36ae8e[_0x0d29('0x79')]);}}else if(this[_0x0d29('0x15')][_0x36ae8e[_0x0d29('0x34')]]){if(this['isNotNull'](_0x36ae8e['variable'])){if(this[_0x0d29('0x2c')](_0x36ae8e[_0x0d29('0x77')][_0x0d29('0x8d')])){logger['info'](_0x0d29('0x89'),_0x36ae8e['linkedid'],_0x36ae8e[_0x0d29('0x79')]);this['channels'][_0x36ae8e[_0x0d29('0x34')]]['sipcalllinkedid']=_0x36ae8e[_0x0d29('0x79')];}}}}}catch(_0x4bd471){logger['error'](_0x0d29('0x8e'),_0x36ae8e[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x4bd471,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d29('0x2b')][_0x0d29('0x8f')]=function(_0x5aaa9e){try{if(this[_0x0d29('0x2c')](_0x5aaa9e)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x5aaa9e[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x5aaa9e,{'showHidden':![],'depth':null}));if(this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]]){if(this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]]['linkedid']]){this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]]['linkedid']][_0x0d29('0x30')]=_0x5aaa9e[_0x0d29('0x30')];this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e['linkedid']][_0x0d29('0x34')]][_0x0d29('0x5e')]=this[_0x0d29('0x15')][_0x5aaa9e['uniqueid']][_0x0d29('0x5e')];this['channels'][this['blindTransfers'][_0x5aaa9e['linkedid']][_0x0d29('0x34')]]['answertime']=this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x5f')];this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e['linkedid']][_0x0d29('0x34')]]['destinationchannel']=this[_0x0d29('0x15')][this['blindTransfers'][_0x5aaa9e[_0x0d29('0x34')]]['linkedid']]['channel'];this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]]['linkedid']][_0x0d29('0x64')]=this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x64')];this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]]=this['channels'][this['blindTransfers'][_0x5aaa9e[_0x0d29('0x34')]]['linkedid']];delete this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]][_0x0d29('0x34')]];}else if(this[_0x0d29('0x15')][this['blindTransfers'][_0x5aaa9e[_0x0d29('0x34')]][_0x0d29('0x30')]]){this[_0x0d29('0x15')][this['blindTransfers'][_0x5aaa9e[_0x0d29('0x34')]][_0x0d29('0x30')]][_0x0d29('0x30')]=[this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e['linkedid']]['uniqueid']][_0x0d29('0x34')],this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e['linkedid']][_0x0d29('0x30')]]['linkedid']=this['channels'][this['blindTransfers'][_0x5aaa9e[_0x0d29('0x34')]][_0x0d29('0x30')]]['uniqueid']][0x0];this['channels'][this[_0x0d29('0x43')][_0x5aaa9e['linkedid']][_0x0d29('0x30')]]['answered']=this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x5e')];this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]][_0x0d29('0x30')]]['answertime']=this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x5f')];this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e['linkedid']][_0x0d29('0x30')]][_0x0d29('0x63')]=this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]][_0x0d29('0x30')]][_0x0d29('0x42')];this['channels'][this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]][_0x0d29('0x30')]][_0x0d29('0x64')]=this[_0x0d29('0x15')][_0x5aaa9e['uniqueid']][_0x0d29('0x64')];this[_0x0d29('0x15')][_0x5aaa9e['uniqueid']]=this['channels'][this['blindTransfers'][_0x5aaa9e[_0x0d29('0x34')]]['uniqueid']];delete this[_0x0d29('0x15')][this[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x34')]]['uniqueid']];}}if(this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]]){logger[_0x0d29('0x29')](_0x0d29('0x90'),_0x5aaa9e[_0x0d29('0x30')],_0x5aaa9e[_0x0d29('0x91')]);var _0x5937ee=moment();this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x92')]=_0x5937ee['format'](_0x0d29('0x47'));this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x53')]=_0x5937ee[_0x0d29('0x61')](this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x45')],'seconds');if(this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x5e')]){this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x93')]=_0x5937ee[_0x0d29('0x61')](this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x5f')],_0x0d29('0x55'));this[_0x0d29('0x15')][_0x5aaa9e['uniqueid']][_0x0d29('0x60')]=this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x53')]-this[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]]['billableseconds'];}if(_0x5aaa9e['context']===_0x0d29('0x39')){if(this['agents'][_0x5aaa9e[_0x0d29('0x42')][_0x0d29('0x3a')]('-')[0x0]]){this[_0x0d29('0x16')][_0x5aaa9e[_0x0d29('0x42')][_0x0d29('0x3a')]('-')[0x0]]=_[_0x0d29('0x94')](this[_0x0d29('0x16')][_0x5aaa9e[_0x0d29('0x42')]['split']('-')[0x0]],[_0x0d29('0x3b')]);logger[_0x0d29('0x32')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x5aaa9e[_0x0d29('0x30')],util['inspect']({'id':this[_0x0d29('0x16')][_0x5aaa9e['channel'][_0x0d29('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x0d29('0x16')][_0x5aaa9e[_0x0d29('0x42')]['split']('-')[0x0]][_0x0d29('0x3f')]},{'showHidden':![],'depth':null}));this[_0x0d29('0x2e')](util[_0x0d29('0x46')](_0x0d29('0x3d'),this[_0x0d29('0x16')][_0x5aaa9e['channel'][_0x0d29('0x3a')]('-')[0x0]][_0x0d29('0x4b')]),_0x0d29('0x95'),{'id':this[_0x0d29('0x16')][_0x5aaa9e[_0x0d29('0x42')][_0x0d29('0x3a')]('-')[0x0]]['id'],'destaccountcode':this[_0x0d29('0x16')][_0x5aaa9e['channel']['split']('-')[0x0]][_0x0d29('0x3f')]});for(var _0x33ef7c=0x0;_0x33ef7c<Object[_0x0d29('0x37')](this['agents'])[_0x0d29('0x96')];_0x33ef7c++){var _0x4145f5=Object[_0x0d29('0x37')](this[_0x0d29('0x16')])[_0x33ef7c];var _0x261518=this[_0x0d29('0x16')][_0x4145f5];if(_0x261518[_0x0d29('0x3f')]===Number(this['channels'][_0x5aaa9e['uniqueid']][_0x0d29('0x3c')])){this[_0x0d29('0x2e')](util[_0x0d29('0x46')](_0x0d29('0x3d'),_0x261518[_0x0d29('0x4b')]),_0x0d29('0x95'),{'id':_0x261518['id'],'destaccountcode':_0x261518['accountcode'],'transfer':this[_0x0d29('0x15')][_0x5aaa9e['uniqueid']][_0x0d29('0x97')]});break;}}}}var _0x33b202=this;Promise[_0x0d29('0x98')]()[_0x0d29('0x99')](function(){var _0x2015f7=_0x33b202[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]];if(typeof _0x2015f7[_0x0d29('0x97')]===_0x0d29('0x4a')){return;}if(_0x2015f7['transferToInternal']===!![]){return;}if(_[_0x0d29('0x9a')](_0x2015f7[_0x0d29('0x74')])){return;}return RpcSetting['getSettings']()[_0x0d29('0x99')](function(_0x5a98d8){if(!_0x5a98d8[_0x0d29('0x9b')])return;return Promise[_0x0d29('0x98')]()[_0x0d29('0x99')](function(){return ami[_0x0d29('0x9c')]({'action':_0x0d29('0x9d'),'channel':_0x2015f7[_0x0d29('0x42')]})[_0x0d29('0x9e')](function(){});})[_0x0d29('0x99')](function(){return ami[_0x0d29('0x9c')]({'action':_0x0d29('0x9d'),'channel':_0x2015f7[_0x0d29('0x63')]})[_0x0d29('0x9e')](function(){})[_0x0d29('0x9f')](function(){var _0x558f60=_0x33b202[_0x0d29('0x16')][_0x2015f7[_0x0d29('0x63')][_0x0d29('0x3a')]('-')[0x0]];if(!_0x558f60)return;io[_0x0d29('0x2e')](_0x0d29('0xa0'),{'agentId':_0x558f60['id'],'uniqueid':_0x2015f7['uniqueid']});});});});})['then'](function(){if(_0x5aaa9e[_0x0d29('0xa1')]==='BlindTransfer'){_0x33b202[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x30')]]=_0x5aaa9e;}else{if(_0x33b202[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]]&&_0x33b202[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x5b')]===_0x0d29('0xa2')&&_0x33b202[_0x0d29('0x43')][_0x5aaa9e[_0x0d29('0x30')]]){_0x33b202['channels'][_0x5aaa9e[_0x0d29('0x30')]]['uniqueid']=[_0x33b202[_0x0d29('0x15')][_0x5aaa9e['uniqueid']][_0x0d29('0x34')],_0x33b202[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]][_0x0d29('0x34')]=_0x33b202[_0x0d29('0x15')][_0x5aaa9e['uniqueid']]['uniqueid']][0x0];delete _0x33b202['blindTransfers'][_0x5aaa9e[_0x0d29('0x30')]];}}logger[_0x0d29('0x32')](_0x0d29('0xa3'),_0x5aaa9e[_0x0d29('0x30')],util['inspect'](_0x33b202[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]],{'showHidden':![],'depth':null}));ami[_0x0d29('0x2e')](_0x0d29('0xa4'),_0x33b202[_0x0d29('0x15')][_0x5aaa9e[_0x0d29('0x30')]]);delete _0x33b202[_0x0d29('0x15')][_0x5aaa9e['uniqueid']];});}}}catch(_0x5c2bad){logger[_0x0d29('0x2a')](_0x0d29('0xa5'),_0x5aaa9e[_0x0d29('0x30')],util['inspect'](_0x5c2bad,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncAttendedTransfer']=function(_0x1e50c0){try{if(this['isNotNull'](_0x1e50c0)){logger['info'](_0x0d29('0xa6'),_0x1e50c0[_0x0d29('0x30')],_0x1e50c0[_0x0d29('0xa7')],_0x1e50c0[_0x0d29('0xa8')]);logger[_0x0d29('0x32')](_0x0d29('0xa9'),_0x1e50c0['uniqueid'],util[_0x0d29('0x33')](_0x1e50c0,{'showHidden':![],'depth':null}));var _0x1c8e0e;if(this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xaa')]]){this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xaa')]][_0x0d29('0xab')]=_0x1e50c0['origtransferercalleridnum'];this['channels'][_0x1e50c0[_0x0d29('0xaa')]][_0x0d29('0xac')]=_0x1e50c0[_0x0d29('0xa8')];if(this['channels'][_0x1e50c0['secondtransfereruniqueid']]){_0x1c8e0e=this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xad')]];this[_0x0d29('0x15')][_0x1e50c0['secondtransfereruniqueid']]=this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xaa')]];this['channels'][_0x1e50c0['transfereeuniqueid']]=_0x1c8e0e;}this[_0x0d29('0x15')][_0x1e50c0['secondtransfereruniqueid']][_0x0d29('0x97')]=_0x0d29('0xae');}else if(this[_0x0d29('0x15')][_0x1e50c0['transfertargetuniqueid']]){this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xaf')]][_0x0d29('0xab')]=_0x1e50c0[_0x0d29('0xa7')];this[_0x0d29('0x15')][_0x1e50c0['transfertargetuniqueid']]['transferconnectedlinenum']=_0x1e50c0['transfertargetcalleridnum'];if(this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xb0')]]){_0x1c8e0e=this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xb0')]];this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xb0')]]=this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xaf')]];this[_0x0d29('0x15')][_0x1e50c0['transfertargetuniqueid']]=_0x1c8e0e;}this[_0x0d29('0x15')][_0x1e50c0['transfertargetuniqueid']][_0x0d29('0x97')]=_0x0d29('0xae');}if((this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xb0')]]||this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xb1')]])&&this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xad')]]){var _0x12a359=_[_0x0d29('0xb2')]([this[_0x0d29('0x15')][_0x1e50c0['origtransfereruniqueid']],this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xb1')]],this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xad')]]],function(_0x3f965c){return _0x3f965c&&_0x3f965c[_0x0d29('0x5b')]===_0x0d29('0xa2')&&_0x3f965c[_0x0d29('0xb3')];});if(_0x12a359){if(this[_0x0d29('0x15')][_0x1e50c0['origtransfereruniqueid']])this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xb0')]][_0x0d29('0x97')]=_0x0d29('0xae');if(this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xb1')]])this['channels'][_0x1e50c0[_0x0d29('0xb1')]][_0x0d29('0x97')]='ATTENDED';this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xad')]][_0x0d29('0x97')]=_0x0d29('0xae');}else{if(this['channels'][_0x1e50c0[_0x0d29('0xaa')]]){this['channels'][_0x1e50c0[_0x0d29('0xad')]][_0x0d29('0xb4')]=!![];}if(this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xaf')]]){this[_0x0d29('0x15')][_0x1e50c0[_0x0d29('0xaf')]]['transferToInternal']=!![];}}}}}catch(_0x4abb91){logger['error'](_0x0d29('0xb5'),_0x1e50c0[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x4abb91,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d29('0x2b')][_0x0d29('0x24')]=function(_0x373b9f){try{if(this['isNotNull'](_0x373b9f)){logger[_0x0d29('0x29')](_0x0d29('0xb6'),_0x373b9f[_0x0d29('0x30')],_0x373b9f[_0x0d29('0xb7')],_0x373b9f['extension']);logger[_0x0d29('0x32')](_0x0d29('0xb8'),_0x373b9f[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x373b9f,{'showHidden':![],'depth':null}));if(this[_0x0d29('0x15')][_0x373b9f['transfereeuniqueid']]){this[_0x0d29('0x15')][_0x373b9f['transfereeuniqueid']][_0x0d29('0xab')]=_0x373b9f[_0x0d29('0xb7')];this[_0x0d29('0x15')][_0x373b9f[_0x0d29('0xaa')]][_0x0d29('0xac')]=_0x373b9f[_0x0d29('0xb9')];this[_0x0d29('0x15')][_0x373b9f[_0x0d29('0xaa')]][_0x0d29('0x97')]=_0x0d29('0xba');this[_0x0d29('0x8f')]({'event':_0x0d29('0xbb'),'uniqueid':_0x373b9f['transfereeuniqueid'],'linkedid':_0x373b9f[_0x0d29('0xbc')],'context':_0x373b9f[_0x0d29('0x38')],'channel':_0x373b9f[_0x0d29('0xbd')]});}else{this[_0x0d29('0x15')][_0x373b9f[_0x0d29('0xbc')]][_0x0d29('0x97')]=_0x0d29('0xba');this[_0x0d29('0x8f')]({'event':_0x0d29('0xbb'),'uniqueid':_0x373b9f['transfereruniqueid'],'linkedid':_0x373b9f[_0x0d29('0xaa')],'context':_0x373b9f[_0x0d29('0x38')],'channel':_0x373b9f[_0x0d29('0xbd')]});}}}catch(_0x7f271c){logger['error'](_0x0d29('0xbe'),_0x373b9f[_0x0d29('0x30')],util['inspect'](_0x7f271c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d29('0x2b')][_0x0d29('0x26')]=function(_0x55da2b){try{if(this[_0x0d29('0x2c')](_0x55da2b)){logger[_0x0d29('0x32')](_0x0d29('0xbf'),_0x55da2b[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x55da2b,{'showHidden':![],'depth':null}));if(this['channels'][_0x55da2b[_0x0d29('0x30')]]){if(!_[_0x0d29('0x73')](this['channels'][_0x55da2b[_0x0d29('0x30')]]['answertime'])){this[_0x0d29('0x15')][_0x55da2b[_0x0d29('0x30')]]['mohstarttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x0d29('0x29')](_0x0d29('0xc0'),_0x55da2b[_0x0d29('0x30')],this[_0x0d29('0x15')][_0x55da2b[_0x0d29('0x30')]]['mohstarttime']);}}}}catch(_0x55b08c){logger[_0x0d29('0x2a')](_0x0d29('0xc1'),_0x55da2b[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x55b08c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0d29('0x2b')][_0x0d29('0x28')]=function(_0x1e0d4d){try{if(this[_0x0d29('0x2c')](_0x1e0d4d)){logger[_0x0d29('0x32')](_0x0d29('0xc2'),_0x1e0d4d[_0x0d29('0x30')],util[_0x0d29('0x33')](_0x1e0d4d,{'showHidden':![],'depth':null}));if(this[_0x0d29('0x15')][_0x1e0d4d['uniqueid']]){if(!_[_0x0d29('0x73')](this[_0x0d29('0x15')][_0x1e0d4d[_0x0d29('0x30')]][_0x0d29('0xc3')])){this['channels'][_0x1e0d4d[_0x0d29('0x30')]][_0x0d29('0xc4')]+=moment()['milliseconds'](0x0)['diff'](this[_0x0d29('0x15')][_0x1e0d4d[_0x0d29('0x30')]][_0x0d29('0xc3')],_0x0d29('0x55'));logger[_0x0d29('0x29')](_0x0d29('0xc5'),_0x1e0d4d[_0x0d29('0x30')],this[_0x0d29('0x15')][_0x1e0d4d[_0x0d29('0x30')]][_0x0d29('0xc4')]);delete this['channels'][_0x1e0d4d[_0x0d29('0x30')]][_0x0d29('0xc3')];}}}}catch(_0x1cb444){logger[_0x0d29('0x2a')](_0x0d29('0xc6'),_0x1e0d4d['uniqueid'],util[_0x0d29('0x33')](_0x1cb444,{'showHidden':![],'depth':null}));}};module[_0x0d29('0xc7')]=VoiceCallReport;
\ No newline at end of file
+var _0x6150=['pick','keys','from-sip','split','exten','xcally-motion-preview','format','user:%s','name','user:agentconnect','accountcode','connectedlinenum','debug','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','linkedid','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','YYYY-MM-DD\x20HH:mm:ss','destconnectedlinenum','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','application','toLowerCase','applicationdata','appdata','startsWith','CDR(routeAlias)','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','disposition','includes','cdr(','match','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridnum','channelstate','answered','answertime','holdtime','connectedlinename','toNumber','UserId','membername','diff','destinationchannel','routealias','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','endsWith','.wav49','.WAV','find','monitors','push','rec','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcalluniqueid','parse','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','then','undefined','transferToInternal','isEmpty','getSettings','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfertargetcalleridnum','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransferercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','transfereruniqueid','transfererchannel','BlindTransfer','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','mohstarttime','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','set','queue','agi','playback','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','bind','newstate','syncNewState','varset','hangup','syncHangup','syncNewCallerId','attendedtransfer','blindtransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','inspect','isUndefined','prototype','emit','isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','[%s][voiceCallReport][newcallerid]\x20event:','merge'];(function(_0x359e54,_0x29c5e7){var _0x14f179=function(_0x843662){while(--_0x843662){_0x359e54['push'](_0x359e54['shift']());}};_0x14f179(++_0x29c5e7);}(_0x6150,0x90));var _0x0615=function(_0x148b3d,_0x58cbcd){_0x148b3d=_0x148b3d-0x0;var _0x43db68=_0x6150[_0x148b3d];return _0x43db68;};'use strict';var _=require(_0x0615('0x0'));var moment=require(_0x0615('0x1'));var util=require(_0x0615('0x2'));var path=require(_0x0615('0x3'));var Redis=require('ioredis');var config=require(_0x0615('0x4'));var logger=require(_0x0615('0x5'))(_0x0615('0x6'));var ami=require(_0x0615('0x7'));var Channel=require(_0x0615('0x8'));var RpcSetting=require('../rpc/setting');var applications=[_0x0615('0x9'),_0x0615('0xa'),_0x0615('0xb'),'dial',_0x0615('0xc'),'voicemail'];var dispositions=[_0x0615('0xd'),_0x0615('0xe'),'FAILED',_0x0615('0xd'),'NO\x20ANSWER',_0x0615('0xd'),_0x0615('0xf'),_0x0615('0x10'),_0x0615('0xe'),_0x0615('0xe'),_0x0615('0xe')];config[_0x0615('0x11')]=_[_0x0615('0x12')](config[_0x0615('0x11')],{'host':_0x0615('0x13'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0615('0x11')]));function VoiceCallReport(_0x2477d1){this[_0x0615('0x14')]=_0x2477d1['channels'];this[_0x0615('0x15')]=_0x2477d1[_0x0615('0x15')];this[_0x0615('0x16')]={};ami['on'](_0x0615('0x17'),this[_0x0615('0x18')]['bind'](this));ami['on'](_0x0615('0x19'),this[_0x0615('0x18')]['bind'](this));ami['on'](_0x0615('0x1a'),this[_0x0615('0x1b')][_0x0615('0x1c')](this));ami['on'](_0x0615('0x1d'),this[_0x0615('0x1e')]['bind'](this));ami['on'](_0x0615('0x1f'),this['syncVarSet']['bind'](this));ami['on'](_0x0615('0x20'),this[_0x0615('0x21')][_0x0615('0x1c')](this));ami['on']('newcallerid',this[_0x0615('0x22')][_0x0615('0x1c')](this));ami['on'](_0x0615('0x23'),this['syncAttendedTransfer'][_0x0615('0x1c')](this));ami['on'](_0x0615('0x24'),this['syncBlindTransfer'][_0x0615('0x1c')](this));ami['on']('musiconholdstart',this[_0x0615('0x25')][_0x0615('0x1c')](this));ami['on'](_0x0615('0x26'),this[_0x0615('0x27')][_0x0615('0x1c')](this));try{logger[_0x0615('0x28')](_0x0615('0x29'));ami['actionCoreShowChannels']();}catch(_0x48d6de){logger[_0x0615('0x2a')]('[voiceCallReport][coreshowchannels]',util[_0x0615('0x2b')](_0x48d6de,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x4884cb){return _0x4884cb!==null&&!_[_0x0615('0x2c')](_0x4884cb);};VoiceCallReport[_0x0615('0x2d')][_0x0615('0x2e')]=function(_0x40e659,_0x566975,_0x167be2){io['to'](_0x40e659)[_0x0615('0x2e')](_0x566975,_0x167be2);};VoiceCallReport[_0x0615('0x2d')][_0x0615('0x22')]=function(_0x776423){try{if(this[_0x0615('0x2f')](_0x776423)){logger[_0x0615('0x28')](_0x0615('0x30'),_0x776423[_0x0615('0x31')],_0x776423[_0x0615('0x32')],_0x776423['calleridnum']);logger['debug'](_0x0615('0x33'),_0x776423['uniqueid'],util[_0x0615('0x2b')](_0x776423,{'showHidden':![],'depth':null}));if(_0x776423[_0x0615('0x31')]===_0x776423['linkedid']){if(!_[_0x0615('0x2c')](this[_0x0615('0x14')][_0x776423[_0x0615('0x31')]])){_[_0x0615('0x34')](this[_0x0615('0x14')][_0x776423[_0x0615('0x31')]],_[_0x0615('0x35')](_0x776423,_[_0x0615('0x36')](this['channels'][_0x776423[_0x0615('0x31')]])));}}if(_0x776423['context']===_0x0615('0x37')){var _0x39e1c9=this[_0x0615('0x15')][_0x776423['channel'][_0x0615('0x38')]('-')[0x0]];if(_0x39e1c9){if(_0x776423[_0x0615('0x39')]==_0x0615('0x3a')){_0x39e1c9['destconnectedlinenum']=_0x776423['connectedlinenum'];this['emit'](util[_0x0615('0x3b')](_0x0615('0x3c'),_0x39e1c9[_0x0615('0x3d')]),_0x0615('0x3e'),{'id':_0x39e1c9['id'],'destaccountcode':_0x39e1c9[_0x0615('0x3f')],'destconnectedlinenum':_0x776423[_0x0615('0x40')]});}}}}}catch(_0x2d7389){logger[_0x0615('0x2a')]('[%s][voiceCallReport][newcallerid]',_0x776423['uniqueid'],util[_0x0615('0x2b')](_0x2d7389,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0615('0x2d')][_0x0615('0x1b')]=function(_0x461200){try{if(this[_0x0615('0x2f')](_0x461200)){logger[_0x0615('0x41')](_0x0615('0x42'),_0x461200[_0x0615('0x31')],util['inspect'](_0x461200,{'showHidden':![],'depth':null}));if(this['channels'][_0x461200['uniqueid']]){return;}if(_0x461200[_0x0615('0x43')]===_0x0615('0x44')){return;}if(_0x461200[_0x0615('0x31')]!==_0x461200[_0x0615('0x45')]&&!this[_0x0615('0x16')][_0x461200[_0x0615('0x45')]]){return;}logger[_0x0615('0x28')](_0x0615('0x46'),_0x461200[_0x0615('0x31')],_0x461200[_0x0615('0x47')],_0x461200[_0x0615('0x39')]);this[_0x0615('0x14')][_0x461200[_0x0615('0x31')]]=new Channel();this[_0x0615('0x14')][_0x461200[_0x0615('0x31')]][_0x0615('0x48')]=moment()[_0x0615('0x3b')](_0x0615('0x49'));this[_0x0615('0x14')][_0x461200[_0x0615('0x31')]]['disposition']=dispositions[_['toNumber'](_0x461200['channelstate'])];_[_0x0615('0x34')](this[_0x0615('0x14')][_0x461200['uniqueid']],_[_0x0615('0x35')](_0x461200,_[_0x0615('0x36')](this[_0x0615('0x14')][_0x461200[_0x0615('0x31')]])));if(_0x461200['context']===_0x0615('0x37')){var _0x182313=this[_0x0615('0x15')][_0x461200[_0x0615('0x43')]['split']('-')[0x0]];if(_0x182313&&typeof _0x182313[_0x0615('0x4a')]==='undefined'){_0x182313[_0x0615('0x4a')]=_0x461200[_0x0615('0x39')];logger[_0x0615('0x41')](_0x0615('0x4b'),_0x461200[_0x0615('0x31')],util[_0x0615('0x2b')]({'id':_0x182313['id'],'destaccountcode':_0x182313[_0x0615('0x3f')],'destconnectedlinenum':_0x461200[_0x0615('0x39')]},{'showHidden':![],'depth':null}));this[_0x0615('0x2e')](util['format'](_0x0615('0x3c'),_0x182313[_0x0615('0x3d')]),_0x0615('0x3e'),{'id':_0x182313['id'],'destaccountcode':_0x182313[_0x0615('0x3f')],'destconnectedlinenum':_0x461200[_0x0615('0x39')]});}}}}catch(_0x4de187){logger[_0x0615('0x2a')](_0x0615('0x4c'),_0x461200['uniqueid'],util['inspect'](_0x4de187,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0615('0x18')]=function(_0x366b79){try{if(this['isNotNull'](_0x366b79)){logger[_0x0615('0x41')]('[%s][voiceCallReport][newexten]\x20event:',_0x366b79[_0x0615('0x31')],util[_0x0615('0x2b')](_0x366b79,{'showHidden':![],'depth':null}));if(_0x366b79[_0x0615('0x43')]==='OutgoingSpoolFailed'||_0x366b79[_0x0615('0x39')]==='h')return;if(_0x366b79[_0x0615('0x31')]===_0x366b79['linkedid']||this[_0x0615('0x16')][_0x366b79[_0x0615('0x45')]]){_0x366b79[_0x0615('0x4d')]=_0x366b79['application']?_0x366b79[_0x0615('0x4d')][_0x0615('0x4e')]():undefined;_0x366b79[_0x0615('0x4f')]=_0x366b79[_0x0615('0x50')]||_0x366b79[_0x0615('0x4f')];if(_0x366b79[_0x0615('0x50')]&&!_0x366b79[_0x0615('0x50')][_0x0615('0x51')](_0x0615('0x52'))&&_0x366b79[_0x0615('0x4d')]!=='queue'){_0x366b79[_0x0615('0x4f')]=_0x366b79[_0x0615('0x4f')]['toLowerCase']();}logger[_0x0615('0x28')](_0x0615('0x53'),_0x366b79['uniqueid'],_0x366b79[_0x0615('0x4d')],_0x366b79[_0x0615('0x4f')]);if(_[_0x0615('0x2c')](this[_0x0615('0x14')][_0x366b79['uniqueid']])){this[_0x0615('0x14')][_0x366b79[_0x0615('0x31')]]=new Channel();this['channels'][_0x366b79[_0x0615('0x31')]][_0x0615('0x48')]=_0x366b79[_0x0615('0x54')]?moment()[_0x0615('0x55')](moment[_0x0615('0x54')](_0x366b79['duration'])[_0x0615('0x56')](),_0x0615('0x56'))[_0x0615('0x3b')](_0x0615('0x49')):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0615('0x14')][_0x366b79[_0x0615('0x31')]][_0x0615('0x57')]=_0x0615('0xd');}_['merge'](this['channels'][_0x366b79[_0x0615('0x31')]],_[_0x0615('0x35')](_0x366b79,_[_0x0615('0x36')](this['channels'][_0x366b79[_0x0615('0x31')]])));if(_[_0x0615('0x58')](applications,_0x366b79[_0x0615('0x4d')])){this[_0x0615('0x14')][_0x366b79['uniqueid']]['lastapplication']=_0x366b79[_0x0615('0x4d')];this[_0x0615('0x14')][_0x366b79[_0x0615('0x31')]]['lastdata']=_0x366b79[_0x0615('0x4f')];if(_0x366b79[_0x0615('0x4d')]===_0x0615('0x9')&&_[_0x0615('0x51')](_0x366b79['applicationdata'][_0x0615('0x4e')](),_0x0615('0x59'))){var _0x30a783=_0x366b79['applicationdata'][_0x0615('0x38')]('=');var _0x454b69=_0x30a783[0x0][_0x0615('0x4e')]()[_0x0615('0x5a')](/cdr\((.*)\)/);if(_0x454b69){if(_0x454b69[0x1]===_0x0615('0x5b')&&!_[_0x0615('0x5c')](this[_0x0615('0x14')][_0x366b79['uniqueid']][_0x454b69[0x1]]))return;this[_0x0615('0x14')][_0x366b79[_0x0615('0x31')]][_0x454b69[0x1]]=_0x30a783[0x1];}}else if(_0x366b79[_0x0615('0x4d')]==='queue'){this[_0x0615('0x14')][_0x366b79[_0x0615('0x31')]][_0x0615('0xa')]=_0x366b79[_0x0615('0x4f')][_0x0615('0x38')](',')[0x0];}}}}}catch(_0x3466cc){logger[_0x0615('0x2a')](_0x0615('0x5d'),_0x366b79['uniqueid'],util[_0x0615('0x2b')](_0x3466cc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0615('0x2d')][_0x0615('0x1e')]=function(_0x1a154){try{if(this[_0x0615('0x2f')](_0x1a154)){logger[_0x0615('0x28')](_0x0615('0x5e'),_0x1a154[_0x0615('0x31')],_0x1a154[_0x0615('0x45')],_0x1a154[_0x0615('0x32')],_0x1a154[_0x0615('0x5f')]);logger[_0x0615('0x41')]('[%s][voiceCallReport][newstate]\x20event:',_0x1a154[_0x0615('0x31')],util[_0x0615('0x2b')](_0x1a154,{'showHidden':![],'depth':null}));if(_0x1a154[_0x0615('0x60')]!=='6')return;var _0x4e8dc5=this[_0x0615('0x15')][_0x1a154['channel'][_0x0615('0x38')]('-')[0x0]];if(_0x1a154[_0x0615('0x31')]!==_0x1a154[_0x0615('0x45')]){var _0x514887=moment();if(this[_0x0615('0x14')][_0x1a154['linkedid']]){if(!this['channels'][_0x1a154['linkedid']][_0x0615('0x61')]){this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x61')]=!![];this[_0x0615('0x14')][_0x1a154['linkedid']][_0x0615('0x62')]=_0x514887['format'](_0x0615('0x49'));if(this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x48')]){this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x63')]=_0x514887['diff'](this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x48')],_0x0615('0x56'));}}this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x45')]=_0x1a154[_0x0615('0x31')];if(_0x1a154['calleridnum']!==_0x0615('0x3a')){this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x40')]=_0x1a154[_0x0615('0x5f')];}this['channels'][_0x1a154[_0x0615('0x45')]][_0x0615('0x64')]=_0x1a154[_0x0615('0x32')];this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]]['destinationchannel']=_0x1a154[_0x0615('0x43')];this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x57')]=dispositions[_[_0x0615('0x65')](_0x1a154[_0x0615('0x60')])];if(_0x4e8dc5){this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x66')]=_0x4e8dc5['id'];this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x67')]=_0x4e8dc5[_0x0615('0x3d')];}}if(this[_0x0615('0x14')][_0x1a154['uniqueid']]){if(!this['channels'][_0x1a154[_0x0615('0x31')]][_0x0615('0x61')]){this['channels'][_0x1a154[_0x0615('0x31')]][_0x0615('0x61')]=!![];this[_0x0615('0x14')][_0x1a154[_0x0615('0x31')]][_0x0615('0x62')]=_0x514887[_0x0615('0x3b')](_0x0615('0x49'));if(this['channels'][_0x1a154[_0x0615('0x31')]][_0x0615('0x48')]){this[_0x0615('0x14')][_0x1a154['uniqueid']]['holdtime']=_0x514887[_0x0615('0x68')](this['channels'][_0x1a154[_0x0615('0x31')]][_0x0615('0x48')],_0x0615('0x56'));}}if(_0x1a154[_0x0615('0x5f')]!==_0x0615('0x3a')){this[_0x0615('0x14')][_0x1a154[_0x0615('0x31')]][_0x0615('0x40')]=_0x1a154['calleridnum'];}this[_0x0615('0x14')][_0x1a154[_0x0615('0x31')]]['connectedlinename']=_0x1a154[_0x0615('0x32')];this[_0x0615('0x14')][_0x1a154['uniqueid']][_0x0615('0x69')]=_0x1a154[_0x0615('0x43')];this[_0x0615('0x14')][_0x1a154['uniqueid']][_0x0615('0x57')]=dispositions[_['toNumber'](_0x1a154[_0x0615('0x60')])];}}else{if(this[_0x0615('0x14')][_0x1a154['uniqueid']]){if(_0x4e8dc5){this['channels'][_0x1a154[_0x0615('0x31')]][_0x0615('0x66')]=_0x4e8dc5['id'];this[_0x0615('0x14')][_0x1a154['uniqueid']][_0x0615('0x67')]=_0x4e8dc5['name'];}}}if(_0x1a154[_0x0615('0x47')]==='from-sip'){if(_0x4e8dc5){_0x4e8dc5['destconnectedlinenum']=_0x1a154[_0x0615('0x39')];var _0x1b3d8a,_0x1e0184;if(this[_0x0615('0x14')][_0x1a154[_0x0615('0x31')]]){_0x1b3d8a=this[_0x0615('0x14')][_0x1a154[_0x0615('0x31')]][_0x0615('0x6a')];_0x1e0184=this[_0x0615('0x14')][_0x1a154[_0x0615('0x31')]][_0x0615('0xa')];}else if(this[_0x0615('0x14')][_0x1a154['linkedid']]){_0x1b3d8a=this[_0x0615('0x14')][_0x1a154[_0x0615('0x45')]][_0x0615('0x6a')];_0x1e0184=this[_0x0615('0x14')][_0x1a154['linkedid']]['queue'];}_0x4e8dc5[_0x0615('0xa')]=_0x1e0184;_0x4e8dc5[_0x0615('0x6a')]=_0x1b3d8a;var _0x3cb9d4={'id':_0x4e8dc5['id'],'name':_0x4e8dc5[_0x0615('0x3d')],'agentconnected':!![],'destaccountcode':_0x4e8dc5[_0x0615('0x3f')],'destconnectedlinenum':_0x1a154[_0x0615('0x39')],'queue':_0x1e0184||undefined,'routealias':_0x1b3d8a,'uniqueid':_0x1a154[_0x0615('0x45')]};logger[_0x0615('0x41')](_0x0615('0x6b'),_0x1a154[_0x0615('0x31')],util[_0x0615('0x2b')](_0x3cb9d4,{'showHidden':![],'depth':null}));this[_0x0615('0x2e')](util['format']('user:%s',_0x4e8dc5['name']),_0x0615('0x3e'),_0x3cb9d4);}}}}catch(_0x3cda75){logger[_0x0615('0x2a')]('[%s][voiceCallReport][newstate]',_0x1a154[_0x0615('0x31')],util['inspect'](_0x3cda75,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0615('0x2d')][_0x0615('0x6c')]=function(_0x396488,_0x217bde){try{if(this['channels'][_0x396488]){logger[_0x0615('0x28')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x396488,_0x217bde);this[_0x0615('0x14')][_0x396488]['monitor']=!![];if(_[_0x0615('0x6d')](_0x217bde,_0x0615('0x6e'))){_0x217bde=_0x217bde['replace'](_0x0615('0x6e'),_0x0615('0x6f'));}this[_0x0615('0x14')][_0x396488]['monitorFilename']=_0x217bde;var _0x35ce1f=_[_0x0615('0x70')](this[_0x0615('0x14')][_0x396488][_0x0615('0x71')],{'filename':_0x217bde});if(_[_0x0615('0x5c')](_0x35ce1f)){this['channels'][_0x396488][_0x0615('0x71')][_0x0615('0x72')]({'filename':_0x217bde,'createdAt':moment()[_0x0615('0x3b')](_0x0615('0x49')),'mixmonitorid':'','status':_0x0615('0x73')});}}}catch(_0x421b2a){logger['error']('[%s][voiceCallReport][mixMonitorFilename]',_0x396488,util[_0x0615('0x2b')](_0x421b2a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0615('0x2d')][_0x0615('0x74')]=function(_0x1779af){try{if(this[_0x0615('0x2f')](_0x1779af)){logger[_0x0615('0x41')](_0x0615('0x75'),_0x1779af['uniqueid'],util['inspect'](_0x1779af,{'showHidden':![],'depth':null}));if(this[_0x0615('0x14')][_0x1779af[_0x0615('0x31')]]&&_0x1779af[_0x0615('0x43')]!=_0x0615('0x44')){if(this[_0x0615('0x2f')](_0x1779af[_0x0615('0x76')])){if(this['isNotNull'](_0x1779af[_0x0615('0x76')][_0x0615('0x77')])){logger[_0x0615('0x28')](_0x0615('0x78'),_0x1779af[_0x0615('0x31')],_0x1779af[_0x0615('0x79')]);this[_0x0615('0x6c')](_0x1779af[_0x0615('0x31')],_0x1779af[_0x0615('0x79')]);}else if(this[_0x0615('0x2f')](_0x1779af[_0x0615('0x76')][_0x0615('0x7a')])){logger[_0x0615('0x28')](_0x0615('0x7b'),_0x1779af[_0x0615('0x31')],_0x1779af[_0x0615('0x79')]);this['channels'][_0x1779af[_0x0615('0x31')]][_0x0615('0x5f')]=_0x1779af[_0x0615('0x79')];}else if(this[_0x0615('0x2f')](_0x1779af['variable'][_0x0615('0x7c')])){logger[_0x0615('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x1779af[_0x0615('0x31')],_0x1779af['value']);this['channels'][_0x1779af[_0x0615('0x31')]]['callerid']=_0x1779af['value'];}else if(this[_0x0615('0x2f')](_0x1779af['variable'][_0x0615('0x7d')])){logger['info'](_0x0615('0x7e'),_0x1779af[_0x0615('0x31')],_0x1779af[_0x0615('0x79')]);this[_0x0615('0x14')][_0x1779af[_0x0615('0x31')]][_0x0615('0x5b')]=_0x1779af['value'];}else if(this['isNotNull'](_0x1779af[_0x0615('0x76')][_0x0615('0x7f')])){logger[_0x0615('0x28')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x1779af[_0x0615('0x31')],_0x1779af[_0x0615('0x79')]['split'](',')[0x0]);this[_0x0615('0x14')][_0x1779af[_0x0615('0x31')]][_0x0615('0xa')]=_0x1779af[_0x0615('0x79')][_0x0615('0x38')](',')[0x0];}else if(this[_0x0615('0x2f')](_0x1779af[_0x0615('0x76')][_0x0615('0x80')])){logger[_0x0615('0x28')](_0x0615('0x81'),_0x1779af[_0x0615('0x31')],_0x1779af[_0x0615('0x79')]);this[_0x0615('0x14')][_0x1779af[_0x0615('0x31')]][_0x0615('0x82')]=_0x1779af['value'];}else if(this[_0x0615('0x2f')](_0x1779af['variable']['xmd-destination'])){logger[_0x0615('0x28')](_0x0615('0x83'),_0x1779af[_0x0615('0x31')],_0x1779af['value']);this[_0x0615('0x14')][_0x1779af[_0x0615('0x31')]][_0x0615('0x84')]=_0x1779af['value'];}else if(this['isNotNull'](_0x1779af[_0x0615('0x76')][_0x0615('0x85')])){logger[_0x0615('0x28')](_0x0615('0x86'),_0x1779af['uniqueid'],_0x1779af['value']);this[_0x0615('0x14')][_0x1779af['uniqueid']]['calleridpreview']=_0x1779af[_0x0615('0x79')];}else if(this[_0x0615('0x2f')](_0x1779af[_0x0615('0x76')][_0x0615('0x87')])){logger['info'](_0x0615('0x88'),_0x1779af[_0x0615('0x31')],_0x1779af[_0x0615('0x79')]);this[_0x0615('0x14')][_0x1779af[_0x0615('0x31')]][_0x0615('0xa')]=_0x1779af[_0x0615('0x79')];}else if(this[_0x0615('0x2f')](_0x1779af[_0x0615('0x76')]['sipcallid'])){logger[_0x0615('0x28')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1779af[_0x0615('0x31')],_0x1779af['value']);this[_0x0615('0x14')][_0x1779af[_0x0615('0x31')]][_0x0615('0x89')]=_0x1779af[_0x0615('0x79')];}}}else if(this['isNotNull'](_0x1779af[_0x0615('0x76')]['mixmonitor_filename'])){if(_0x1779af[_0x0615('0x79')]){var _0x57ffbf=path[_0x0615('0x8a')](_0x1779af[_0x0615('0x79')])[_0x0615('0x3d')];logger[_0x0615('0x28')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x57ffbf,_0x1779af[_0x0615('0x79')]);this[_0x0615('0x6c')](_0x57ffbf,_0x1779af[_0x0615('0x79')]);}}else if(this[_0x0615('0x14')][_0x1779af['linkedid']]){if(this[_0x0615('0x2f')](_0x1779af['variable'])){if(this[_0x0615('0x2f')](_0x1779af[_0x0615('0x76')][_0x0615('0x8b')])){logger['info'](_0x0615('0x8c'),_0x1779af[_0x0615('0x45')],_0x1779af[_0x0615('0x79')]);this[_0x0615('0x14')][_0x1779af['linkedid']][_0x0615('0x8d')]=_0x1779af[_0x0615('0x79')];}}}}}catch(_0x20a0d1){logger[_0x0615('0x2a')](_0x0615('0x8e'),_0x1779af[_0x0615('0x31')],util[_0x0615('0x2b')](_0x20a0d1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0615('0x2d')][_0x0615('0x21')]=function(_0x1f0256){try{if(this['isNotNull'](_0x1f0256)){logger[_0x0615('0x41')](_0x0615('0x8f'),_0x1f0256[_0x0615('0x31')],util[_0x0615('0x2b')](_0x1f0256,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x1f0256[_0x0615('0x45')]]){if(this['channels'][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x45')]]){this['channels'][this['blindTransfers'][_0x1f0256[_0x0615('0x45')]][_0x0615('0x45')]][_0x0615('0x31')]=_0x1f0256[_0x0615('0x31')];this[_0x0615('0x14')][this['blindTransfers'][_0x1f0256[_0x0615('0x45')]][_0x0615('0x45')]][_0x0615('0x61')]=this[_0x0615('0x14')][_0x1f0256['uniqueid']]['answered'];this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256['linkedid']][_0x0615('0x45')]][_0x0615('0x62')]=this['channels'][_0x1f0256[_0x0615('0x31')]][_0x0615('0x62')];this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x45')]][_0x0615('0x69')]=this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]]['linkedid']][_0x0615('0x43')];this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x45')]][_0x0615('0x57')]=this[_0x0615('0x14')][_0x1f0256['uniqueid']]['disposition'];this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]]=this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x45')]];delete this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]]['linkedid']];}else if(this['channels'][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]]){this['channels'][this[_0x0615('0x16')][_0x1f0256['linkedid']][_0x0615('0x31')]][_0x0615('0x31')]=[this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]][_0x0615('0x45')],this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]][_0x0615('0x45')]=this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256['linkedid']][_0x0615('0x31')]][_0x0615('0x31')]][0x0];this[_0x0615('0x14')][this['blindTransfers'][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]][_0x0615('0x61')]=this['channels'][_0x1f0256[_0x0615('0x31')]]['answered'];this[_0x0615('0x14')][this['blindTransfers'][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]][_0x0615('0x62')]=this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]]['answertime'];this[_0x0615('0x14')][this['blindTransfers'][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]]['destinationchannel']=this[_0x0615('0x14')][this['blindTransfers'][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]][_0x0615('0x43')];this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]]['disposition']=this['channels'][_0x1f0256[_0x0615('0x31')]][_0x0615('0x57')];this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]]=this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]]['uniqueid']];delete this[_0x0615('0x14')][this[_0x0615('0x16')][_0x1f0256[_0x0615('0x45')]][_0x0615('0x31')]];}}if(this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]]){logger[_0x0615('0x28')](_0x0615('0x90'),_0x1f0256[_0x0615('0x31')],_0x1f0256[_0x0615('0x91')]);var _0xe1d855=moment();this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x92')]=_0xe1d855['format'](_0x0615('0x49'));this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x54')]=_0xe1d855[_0x0615('0x68')](this[_0x0615('0x14')][_0x1f0256['uniqueid']][_0x0615('0x48')],_0x0615('0x56'));if(this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x61')]){this[_0x0615('0x14')][_0x1f0256['uniqueid']][_0x0615('0x93')]=_0xe1d855['diff'](this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x62')],'seconds');this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x63')]=this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]]['duration']-this[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x93')];}if(_0x1f0256[_0x0615('0x47')]===_0x0615('0x37')){if(this[_0x0615('0x15')][_0x1f0256[_0x0615('0x43')][_0x0615('0x38')]('-')[0x0]]){this[_0x0615('0x15')][_0x1f0256[_0x0615('0x43')][_0x0615('0x38')]('-')[0x0]]=_[_0x0615('0x94')](this['agents'][_0x1f0256['channel'][_0x0615('0x38')]('-')[0x0]],[_0x0615('0x4a')]);logger['debug'](_0x0615('0x95'),_0x1f0256[_0x0615('0x31')],util['inspect']({'id':this[_0x0615('0x15')][_0x1f0256[_0x0615('0x43')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0x0615('0x15')][_0x1f0256[_0x0615('0x43')][_0x0615('0x38')]('-')[0x0]][_0x0615('0x3f')]},{'showHidden':![],'depth':null}));this[_0x0615('0x2e')](util[_0x0615('0x3b')](_0x0615('0x3c'),this[_0x0615('0x15')][_0x1f0256[_0x0615('0x43')][_0x0615('0x38')]('-')[0x0]][_0x0615('0x3d')]),_0x0615('0x96'),{'id':this[_0x0615('0x15')][_0x1f0256[_0x0615('0x43')][_0x0615('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x0615('0x15')][_0x1f0256['channel'][_0x0615('0x38')]('-')[0x0]]['accountcode']});for(var _0x1e6fce=0x0;_0x1e6fce<Object['keys'](this[_0x0615('0x15')])[_0x0615('0x97')];_0x1e6fce++){var _0x3d8e79=Object[_0x0615('0x36')](this[_0x0615('0x15')])[_0x1e6fce];var _0x3389b3=this[_0x0615('0x15')][_0x3d8e79];if(_0x3389b3['accountcode']===Number(this[_0x0615('0x14')][_0x1f0256['uniqueid']][_0x0615('0x40')])){this[_0x0615('0x2e')](util[_0x0615('0x3b')](_0x0615('0x3c'),_0x3389b3['name']),_0x0615('0x96'),{'id':_0x3389b3['id'],'destaccountcode':_0x3389b3[_0x0615('0x3f')],'transfer':this[_0x0615('0x14')][_0x1f0256['uniqueid']][_0x0615('0x98')]});break;}}}}var _0x2e7a64=this;Promise['resolve']()[_0x0615('0x99')](function(){var _0x53fee0=_0x2e7a64[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]];if(typeof _0x53fee0['transferType']===_0x0615('0x9a')){return;}if(_0x53fee0[_0x0615('0x9b')]===!![]){return;}if(_[_0x0615('0x9c')](_0x53fee0['monitors'])){return;}return RpcSetting[_0x0615('0x9d')]()[_0x0615('0x99')](function(_0x38c720){if(!_0x38c720['stopRecordingOnTransfer'])return;return Promise['resolve']()[_0x0615('0x99')](function(){return ami[_0x0615('0x9e')]({'action':_0x0615('0x9f'),'channel':_0x53fee0[_0x0615('0x43')]})[_0x0615('0xa0')](function(){});})['then'](function(){return ami[_0x0615('0x9e')]({'action':'StopMixMonitor','channel':_0x53fee0[_0x0615('0x69')]})[_0x0615('0xa0')](function(){})[_0x0615('0xa1')](function(){var _0x46d13b=_0x2e7a64[_0x0615('0x15')][_0x53fee0['destinationchannel'][_0x0615('0x38')]('-')[0x0]];if(!_0x46d13b)return;io[_0x0615('0x2e')](_0x0615('0xa2'),{'agentId':_0x46d13b['id'],'uniqueid':_0x53fee0['uniqueid']});});});});})[_0x0615('0x99')](function(){if(_0x1f0256[_0x0615('0xa3')]==='BlindTransfer'){_0x2e7a64[_0x0615('0x16')][_0x1f0256[_0x0615('0x31')]]=_0x1f0256;}else{if(_0x2e7a64[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]]&&_0x2e7a64[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x5b')]===_0x0615('0xa4')&&_0x2e7a64[_0x0615('0x16')][_0x1f0256[_0x0615('0x31')]]){_0x2e7a64['channels'][_0x1f0256[_0x0615('0x31')]][_0x0615('0x31')]=[_0x2e7a64[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]]['linkedid'],_0x2e7a64[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x45')]=_0x2e7a64[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]][_0x0615('0x31')]][0x0];delete _0x2e7a64['blindTransfers'][_0x1f0256[_0x0615('0x31')]];}}logger[_0x0615('0x41')](_0x0615('0xa5'),_0x1f0256[_0x0615('0x31')],util[_0x0615('0x2b')](_0x2e7a64['channels'][_0x1f0256[_0x0615('0x31')]],{'showHidden':![],'depth':null}));ami['emit']('custom:voiceCallReport',_0x2e7a64[_0x0615('0x14')][_0x1f0256['uniqueid']]);delete _0x2e7a64[_0x0615('0x14')][_0x1f0256[_0x0615('0x31')]];});}}}catch(_0x14667c){logger[_0x0615('0x2a')](_0x0615('0xa6'),_0x1f0256[_0x0615('0x31')],util[_0x0615('0x2b')](_0x14667c,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x0615('0xa7')]=function(_0x5e95b9){try{if(this[_0x0615('0x2f')](_0x5e95b9)){logger[_0x0615('0x28')](_0x0615('0xa8'),_0x5e95b9['uniqueid'],_0x5e95b9['origtransferercalleridnum'],_0x5e95b9[_0x0615('0xa9')]);logger[_0x0615('0x41')]('[%s][voiceCallReport][attendedtransfer]\x20event:',_0x5e95b9[_0x0615('0x31')],util[_0x0615('0x2b')](_0x5e95b9,{'showHidden':![],'depth':null}));var _0x134b93;if(this['channels'][_0x5e95b9[_0x0615('0xaa')]]){this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaa')]][_0x0615('0xab')]=_0x5e95b9['origtransferercalleridnum'];this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaa')]][_0x0615('0xac')]=_0x5e95b9[_0x0615('0xa9')];if(this['channels'][_0x5e95b9['secondtransfereruniqueid']]){_0x134b93=this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xad')]];this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xad')]]=this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaa')]];this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaa')]]=_0x134b93;}this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xad')]][_0x0615('0x98')]=_0x0615('0xae');}else if(this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaf')]]){this[_0x0615('0x14')][_0x5e95b9['transfertargetuniqueid']]['transfercalleridnum']=_0x5e95b9[_0x0615('0xb0')];this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaf')]]['transferconnectedlinenum']=_0x5e95b9[_0x0615('0xa9')];if(this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xb1')]]){_0x134b93=this['channels'][_0x5e95b9[_0x0615('0xb1')]];this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xb1')]]=this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaf')]];this['channels'][_0x5e95b9[_0x0615('0xaf')]]=_0x134b93;}this['channels'][_0x5e95b9['transfertargetuniqueid']][_0x0615('0x98')]=_0x0615('0xae');}if((this['channels'][_0x5e95b9[_0x0615('0xb1')]]||this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xb2')]])&&this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xad')]]){var _0x86e1a4=_[_0x0615('0xb3')]([this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xb1')]],this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xb2')]],this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xad')]]],function(_0x8c243b){return _0x8c243b&&_0x8c243b[_0x0615('0x5b')]===_0x0615('0xa4')&&_0x8c243b[_0x0615('0xb4')];});if(_0x86e1a4){if(this[_0x0615('0x14')][_0x5e95b9['origtransfereruniqueid']])this[_0x0615('0x14')][_0x5e95b9['origtransfereruniqueid']][_0x0615('0x98')]=_0x0615('0xae');if(this['channels'][_0x5e95b9[_0x0615('0xb2')]])this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xb2')]][_0x0615('0x98')]='ATTENDED';this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xad')]][_0x0615('0x98')]=_0x0615('0xae');}else{if(this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaa')]]){this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xad')]]['transferToInternal']=!![];}if(this['channels'][_0x5e95b9['transfertargetuniqueid']]){this[_0x0615('0x14')][_0x5e95b9[_0x0615('0xaf')]][_0x0615('0x9b')]=!![];}}}}}catch(_0x211e22){logger[_0x0615('0x2a')]('[%s][voiceCallReport][attendedtransfer]',_0x5e95b9['uniqueid'],util[_0x0615('0x2b')](_0x211e22,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0615('0x2d')][_0x0615('0xb5')]=function(_0x2dd8fa){try{if(this[_0x0615('0x2f')](_0x2dd8fa)){logger[_0x0615('0x28')](_0x0615('0xb6'),_0x2dd8fa[_0x0615('0x31')],_0x2dd8fa[_0x0615('0xb7')],_0x2dd8fa['extension']);logger[_0x0615('0x41')]('[%s][voiceCallReport][blindtransfer]\x20event:',_0x2dd8fa[_0x0615('0x31')],util[_0x0615('0x2b')](_0x2dd8fa,{'showHidden':![],'depth':null}));if(this[_0x0615('0x14')][_0x2dd8fa[_0x0615('0xaa')]]){this[_0x0615('0x14')][_0x2dd8fa[_0x0615('0xaa')]][_0x0615('0xab')]=_0x2dd8fa['transfereecalleridnum'];this[_0x0615('0x14')][_0x2dd8fa[_0x0615('0xaa')]][_0x0615('0xac')]=_0x2dd8fa[_0x0615('0xb8')];this[_0x0615('0x14')][_0x2dd8fa['transfereeuniqueid']]['transferType']='BLIND';this[_0x0615('0x21')]({'event':'BlindTransfer','uniqueid':_0x2dd8fa[_0x0615('0xaa')],'linkedid':_0x2dd8fa[_0x0615('0xb9')],'context':_0x2dd8fa[_0x0615('0x47')],'channel':_0x2dd8fa[_0x0615('0xba')]});}else{this[_0x0615('0x14')][_0x2dd8fa[_0x0615('0xb9')]][_0x0615('0x98')]='BLIND';this[_0x0615('0x21')]({'event':_0x0615('0xbb'),'uniqueid':_0x2dd8fa['transfereruniqueid'],'linkedid':_0x2dd8fa[_0x0615('0xaa')],'context':_0x2dd8fa['context'],'channel':_0x2dd8fa[_0x0615('0xba')]});}}}catch(_0x4a8a22){logger[_0x0615('0x2a')](_0x0615('0xbc'),_0x2dd8fa[_0x0615('0x31')],util[_0x0615('0x2b')](_0x4a8a22,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x0615('0x2d')][_0x0615('0x25')]=function(_0x451825){try{if(this['isNotNull'](_0x451825)){logger[_0x0615('0x41')](_0x0615('0xbd'),_0x451825[_0x0615('0x31')],util[_0x0615('0x2b')](_0x451825,{'showHidden':![],'depth':null}));if(this[_0x0615('0x14')][_0x451825[_0x0615('0x31')]]){if(!_[_0x0615('0x5c')](this[_0x0615('0x14')][_0x451825[_0x0615('0x31')]][_0x0615('0x62')])){this[_0x0615('0x14')][_0x451825[_0x0615('0x31')]]['mohstarttime']=moment()[_0x0615('0x3b')](_0x0615('0x49'));logger['info'](_0x0615('0xbe'),_0x451825['uniqueid'],this[_0x0615('0x14')][_0x451825[_0x0615('0x31')]]['mohstarttime']);}}}}catch(_0x1f9815){logger[_0x0615('0x2a')]('[%s][voiceCallReport][musiconholdstart]',_0x451825[_0x0615('0x31')],util[_0x0615('0x2b')](_0x1f9815,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMusicOnHoldStop']=function(_0x1428de){try{if(this['isNotNull'](_0x1428de)){logger[_0x0615('0x41')](_0x0615('0xbf'),_0x1428de[_0x0615('0x31')],util[_0x0615('0x2b')](_0x1428de,{'showHidden':![],'depth':null}));if(this[_0x0615('0x14')][_0x1428de['uniqueid']]){if(!_[_0x0615('0x5c')](this['channels'][_0x1428de['uniqueid']]['mohstarttime'])){this['channels'][_0x1428de['uniqueid']][_0x0615('0xc0')]+=moment()['milliseconds'](0x0)['diff'](this['channels'][_0x1428de['uniqueid']][_0x0615('0xc1')],_0x0615('0x56'));logger[_0x0615('0x28')](_0x0615('0xc2'),_0x1428de[_0x0615('0x31')],this['channels'][_0x1428de['uniqueid']][_0x0615('0xc0')]);delete this[_0x0615('0x14')][_0x1428de['uniqueid']][_0x0615('0xc1')];}}}}catch(_0x26d760){logger['error'](_0x0615('0xc3'),_0x1428de[_0x0615('0x31')],util[_0x0615('0x2b')](_0x26d760,{'showHidden':![],'depth':null}));}};module[_0x0615('0xc4')]=VoiceCallReport;
\ No newline at end of file
index b8006a6..ae0ccb4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb4c7=['[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','error','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','socket.io-emitter','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncDialEnd','varset','syncVarSet','syncHangup','prototype','isNotNull','isUndefined','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','channels','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','keys','value','variable','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','sipuri','bridgepeer','bridgepvtcallid','memberinterface','memberlastcall','memberrealtime','isNil','includes','cause-txt','duration','endtime','diff','starttime','seconds','complete','total','answertime','answered','holdtime','billableseconds','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x2c5cd4,_0x124d5e){_0x2c5cd4=_0x2c5cd4-0x0;var _0xdd9a88=_0xb4c7[_0x2c5cd4];return _0xdd9a88;};'use strict';var _=require(_0x7b4c('0x0'));var moment=require(_0x7b4c('0x1'));var util=require(_0x7b4c('0x2'));var Redis=require(_0x7b4c('0x3'));var config=require(_0x7b4c('0x4'));var logger=require('../../../config/logger')(_0x7b4c('0x5'));var ami=require(_0x7b4c('0x6'));config[_0x7b4c('0x7')]=_[_0x7b4c('0x8')](config[_0x7b4c('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7b4c('0x9'))(new Redis(config[_0x7b4c('0x7')]));function VoiceDialReport(_0x2dd5c7){this['channels']=_0x2dd5c7[_0x7b4c('0xa')];this[_0x7b4c('0xb')]=_0x2dd5c7['outbound'];this[_0x7b4c('0xc')]={};this[_0x7b4c('0xd')]={};ami['on'](_0x7b4c('0xe'),this[_0x7b4c('0xf')][_0x7b4c('0x10')](this));ami['on'](_0x7b4c('0x11'),this[_0x7b4c('0x12')][_0x7b4c('0x10')](this));ami['on'](_0x7b4c('0x13'),this[_0x7b4c('0x14')]['bind'](this));ami['on']('hangup',this[_0x7b4c('0x15')][_0x7b4c('0x10')](this));}VoiceDialReport[_0x7b4c('0x16')][_0x7b4c('0x17')]=function(_0x3e1558){return _0x3e1558!==null&&!_[_0x7b4c('0x18')](_0x3e1558);};VoiceDialReport[_0x7b4c('0x16')][_0x7b4c('0x19')]=function(_0x25b90b,_0x387488,_0x593a19){io['to'](_0x25b90b)[_0x7b4c('0x19')](_0x387488,_0x593a19);};VoiceDialReport[_0x7b4c('0x16')][_0x7b4c('0xf')]=function(_0x2a0e2f){try{if(this[_0x7b4c('0x17')](_0x2a0e2f)){logger[_0x7b4c('0x1a')](_0x7b4c('0x1b'),_0x2a0e2f[_0x7b4c('0x1c')],util['inspect'](_0x2a0e2f,{'showHidden':![],'depth':null}));if(this[_0x7b4c('0x1d')][_0x2a0e2f[_0x7b4c('0x1c')]]){_[_0x7b4c('0x1e')](this[_0x7b4c('0x1d')][_0x2a0e2f['uniqueid']],{'starttime':moment()[_0x7b4c('0x1f')](_0x7b4c('0x20')),'lastevent':_0x7b4c('0x21'),'interface':_0x2a0e2f[_0x7b4c('0x22')][_0x7b4c('0x23')](0x0,_0x2a0e2f[_0x7b4c('0x22')][_0x7b4c('0x24')]('-')),'membername':_0x2a0e2f[_0x7b4c('0x22')][_0x7b4c('0x23')](_0x2a0e2f['channel'][_0x7b4c('0x24')]('/')+0x1,_0x2a0e2f[_0x7b4c('0x22')][_0x7b4c('0x24')]('-'))},_[_0x7b4c('0x25')](_0x2a0e2f,[_0x7b4c('0x26'),_0x7b4c('0x27')]));logger[_0x7b4c('0x28')](_0x7b4c('0x29'),_0x2a0e2f[_0x7b4c('0x1c')],this[_0x7b4c('0x1d')][_0x2a0e2f['uniqueid']][_0x7b4c('0x2a')],this[_0x7b4c('0x1d')][_0x2a0e2f[_0x7b4c('0x1c')]][_0x7b4c('0x2b')]);logger[_0x7b4c('0x1a')](_0x7b4c('0x2c'),_0x2a0e2f[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](this[_0x7b4c('0x1d')][_0x2a0e2f[_0x7b4c('0x1c')]],{'showHidden':![],'depth':null}));if(this[_0x7b4c('0xc')][_0x2a0e2f[_0x7b4c('0x1c')]])_[_0x7b4c('0x1e')](this['channels'][_0x2a0e2f[_0x7b4c('0x1c')]],this[_0x7b4c('0xc')][_0x2a0e2f[_0x7b4c('0x1c')]]);this[_0x7b4c('0x19')](_0x7b4c('0x2e'),_0x7b4c('0x2f'),this[_0x7b4c('0x1d')][_0x2a0e2f[_0x7b4c('0x1c')]]);logger[_0x7b4c('0x1a')](_0x7b4c('0x30'),_0x2a0e2f[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](this[_0x7b4c('0x1d')][_0x2a0e2f[_0x7b4c('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x7b4c('0x19')](_0x7b4c('0x31'),this[_0x7b4c('0x1d')][_0x2a0e2f[_0x7b4c('0x1c')]]);}}}catch(_0x9d3d31){logger['error']('[%s][voiceDialReport][dialbegin]',_0x2a0e2f['uniqueid'],util[_0x7b4c('0x2d')](_0x9d3d31,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b4c('0x16')][_0x7b4c('0x12')]=function(_0x66e770){try{if(this['isNotNull'](_0x66e770)){logger[_0x7b4c('0x1a')](_0x7b4c('0x32'),_0x66e770['uniqueid'],util[_0x7b4c('0x2d')](_0x66e770,{'showHidden':![],'depth':null}));if(this['channels'][_0x66e770[_0x7b4c('0x1c')]]){this[_0x7b4c('0x1d')][_0x66e770[_0x7b4c('0x1c')]]['dialstatus']=_0x66e770[_0x7b4c('0x33')];if(_0x66e770[_0x7b4c('0x33')]==='ANSWER'){this[_0x7b4c('0x1d')][_0x66e770[_0x7b4c('0x1c')]][_0x7b4c('0x34')]=_0x66e770[_0x7b4c('0x34')];this['channels'][_0x66e770['uniqueid']][_0x7b4c('0x35')]=_0x66e770[_0x7b4c('0x35')];this['channels'][_0x66e770[_0x7b4c('0x1c')]]['answertime']=moment()['format'](_0x7b4c('0x20'));this[_0x7b4c('0x1d')][_0x66e770[_0x7b4c('0x1c')]][_0x7b4c('0x36')]='connect';logger[_0x7b4c('0x28')](_0x7b4c('0x37'),_0x66e770[_0x7b4c('0x1c')],_0x66e770[_0x7b4c('0x22')][_0x7b4c('0x23')](_0x66e770[_0x7b4c('0x22')][_0x7b4c('0x24')]('/')+0x1,_0x66e770['channel']['lastIndexOf']('-')));logger[_0x7b4c('0x1a')](_0x7b4c('0x38'),_0x66e770[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](this[_0x7b4c('0x1d')][_0x66e770['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x7b4c('0x19')](_0x7b4c('0x39'),this[_0x7b4c('0x1d')][_0x66e770[_0x7b4c('0x1c')]]);}logger[_0x7b4c('0x1a')](_0x7b4c('0x3a'),_0x66e770[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](this[_0x7b4c('0x1d')][_0x66e770['uniqueid']],{'showHidden':![],'depth':null}));this[_0x7b4c('0x19')]('voice:outbound',_0x7b4c('0x2f'),this['channels'][_0x66e770[_0x7b4c('0x1c')]]);}}}catch(_0x46a23d){logger['error']('[%s][voiceDialReport][dialend]',_0x66e770[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](_0x46a23d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b4c('0x16')][_0x7b4c('0x14')]=function(_0x57abb5){try{if(this[_0x7b4c('0x17')](_0x57abb5)){logger[_0x7b4c('0x1a')](_0x7b4c('0x3b'),_0x57abb5['uniqueid'],util[_0x7b4c('0x2d')](_0x57abb5,{'showHidden':![],'depth':null}));this['addVariable'](_0x57abb5['uniqueid'],_[_0x7b4c('0x3c')](_0x57abb5['variable'])[0x0],_0x57abb5[_0x7b4c('0x3d')]);if(this[_0x7b4c('0x17')](_0x57abb5[_0x7b4c('0x3e')])&&this[_0x7b4c('0x17')](_0x57abb5[_0x7b4c('0x3e')][_0x7b4c('0x3f')])){if(_[_0x7b4c('0x18')](this[_0x7b4c('0x1d')][_0x57abb5[_0x7b4c('0x1c')]])){this['channels'][_0x57abb5[_0x7b4c('0x1c')]]={'routeId':_0x57abb5['value'],'variables':this['variables'][_0x57abb5[_0x7b4c('0x1c')]],'motionChannel':_0x7b4c('0x40')};logger['info']('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x57abb5[_0x7b4c('0x1c')],_0x57abb5[_0x7b4c('0x3e')][_0x7b4c('0x3f')],_[_0x7b4c('0x3c')](_0x57abb5[_0x7b4c('0x3e')])[0x0],_0x57abb5[_0x7b4c('0x3d')]);logger[_0x7b4c('0x1a')](_0x7b4c('0x41'),_0x57abb5['uniqueid'],util[_0x7b4c('0x2d')](this[_0x7b4c('0x1d')][_0x57abb5[_0x7b4c('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b4c('0x19')](_0x7b4c('0x2e'),_0x7b4c('0x2f'),this[_0x7b4c('0x1d')][_0x57abb5[_0x7b4c('0x1c')]]);}}}}catch(_0x45957d){logger['error']('[%s][voiceDialReport][varset]',_0x57abb5[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](_0x45957d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b4c('0x16')]['addVariable']=function(_0xfd4074,_0x2684e1,_0x5ddf41){var _0x1d82ee=['rtpaudioqos',_0x7b4c('0x42'),'rtpaudioqosjitter',_0x7b4c('0x43'),'rtpaudioqosloss',_0x7b4c('0x44'),_0x7b4c('0x45'),'rtpaudioqosrttbridged','sipcallid',_0x7b4c('0x46'),_0x7b4c('0x47'),_0x7b4c('0x48'),'membercalls','memberdynamic',_0x7b4c('0x49'),_0x7b4c('0x4a'),'membername','memberpenalty',_0x7b4c('0x4b')];if(!_[_0x7b4c('0x4c')](_0x2684e1)&&!_[_0x7b4c('0x4d')](_0x1d82ee,_0x2684e1)){if(_['isUndefined'](this[_0x7b4c('0xd')][_0xfd4074])){this[_0x7b4c('0xd')][_0xfd4074]={};}this['variables'][_0xfd4074][_0x2684e1]=_0x5ddf41;}};VoiceDialReport['prototype'][_0x7b4c('0x15')]=function(_0x4d8491){try{if(this['isNotNull'](_0x4d8491)){logger[_0x7b4c('0x1a')]('[%s][voiceDialReport][hangup]\x20event:',_0x4d8491['uniqueid'],util[_0x7b4c('0x2d')](_0x4d8491,{'showHidden':![],'depth':null}));if(this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]]){logger[_0x7b4c('0x28')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4d8491['uniqueid'],_0x4d8491[_0x7b4c('0x4e')]);this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]]['endtime']=moment()[_0x7b4c('0x1f')](_0x7b4c('0x20'));this[_0x7b4c('0x1d')][_0x4d8491['uniqueid']][_0x7b4c('0x4f')]=moment(this[_0x7b4c('0x1d')][_0x4d8491['uniqueid']][_0x7b4c('0x50')])[_0x7b4c('0x51')](this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]][_0x7b4c('0x52')],_0x7b4c('0x53'));this[_0x7b4c('0x1d')][_0x4d8491['uniqueid']][_0x7b4c('0x36')]=_0x7b4c('0x54');this['outbound'][_0x7b4c('0x55')]+=0x1;if(this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]][_0x7b4c('0x56')]){this['outbound'][_0x7b4c('0x57')]+=0x1;this['channels'][_0x4d8491['uniqueid']][_0x7b4c('0x58')]=moment(this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]][_0x7b4c('0x56')])[_0x7b4c('0x51')](this['channels'][_0x4d8491['uniqueid']][_0x7b4c('0x52')],_0x7b4c('0x53'));this[_0x7b4c('0x1d')][_0x4d8491['uniqueid']][_0x7b4c('0x59')]=moment(this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]]['endtime'])[_0x7b4c('0x51')](this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]]['answertime'],_0x7b4c('0x53'));this[_0x7b4c('0xb')]['sumHoldTime']+=this[_0x7b4c('0x1d')][_0x4d8491['uniqueid']][_0x7b4c('0x58')]||0x0;this[_0x7b4c('0xb')][_0x7b4c('0x5a')]+=this['channels'][_0x4d8491['uniqueid']][_0x7b4c('0x59')];}this[_0x7b4c('0xb')][_0x7b4c('0x5b')]+=this['channels'][_0x4d8491[_0x7b4c('0x1c')]]['duration'];logger[_0x7b4c('0x1a')](_0x7b4c('0x5c'),_0x4d8491[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](this[_0x7b4c('0x1d')][_0x4d8491['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x7b4c('0x19')](_0x7b4c('0x5d'),this['channels'][_0x4d8491[_0x7b4c('0x1c')]]);logger[_0x7b4c('0x1a')](_0x7b4c('0x5e'),_0x4d8491[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]],{'showHidden':![],'depth':null}));ami[_0x7b4c('0x19')]('custom:dialend',this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]]);logger[_0x7b4c('0x1a')](_0x7b4c('0x5f'),_0x4d8491[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b4c('0x19')](_0x7b4c('0x2e'),_0x7b4c('0x60'),this[_0x7b4c('0xb')]);logger[_0x7b4c('0x28')](_0x7b4c('0x61'),JSON[_0x7b4c('0x62')](this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]]));logger[_0x7b4c('0x1a')](_0x7b4c('0x63'),_0x4d8491[_0x7b4c('0x1c')],util['inspect'](this['channels'][_0x4d8491[_0x7b4c('0x1c')]],{'showHidden':![],'depth':null}));this[_0x7b4c('0x19')]('voice:outbound',_0x7b4c('0x64'),this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]]);delete this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x1c')]];}else if(this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x65')]]){this[_0x7b4c('0x1d')][_0x4d8491[_0x7b4c('0x65')]]['uniqueid']=this[_0x7b4c('0x1d')][_0x4d8491['linkedid']][_0x7b4c('0x66')];}if(this['variables'][_0x4d8491['uniqueid']]){delete this[_0x7b4c('0xd')][_0x4d8491['uniqueid']];}}}catch(_0x5d34d9){logger[_0x7b4c('0x67')](_0x7b4c('0x68'),_0x4d8491[_0x7b4c('0x1c')],util['inspect'](_0x5d34d9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x7b4c('0x16')][_0x7b4c('0x69')]=function(_0x10e789){try{if(this[_0x7b4c('0x17')](_0x10e789)){logger[_0x7b4c('0x1a')](_0x7b4c('0x6a'),_0x10e789[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](_0x10e789,{'showHidden':![],'depth':null}));if(_0x10e789[_0x7b4c('0x6b')][_0x7b4c('0x6c')]()===_0x7b4c('0x6d')){_0x10e789[_0x7b4c('0x6e')]=(_0x10e789[_0x7b4c('0x6f')]||_0x10e789[_0x7b4c('0x6e')])['toLowerCase']();if(_[_0x7b4c('0x70')](_0x10e789[_0x7b4c('0x6e')],_0x7b4c('0x71'))){if(_[_0x7b4c('0x18')](this['applications'][_0x10e789[_0x7b4c('0x1c')]]))this[_0x7b4c('0xc')][_0x10e789[_0x7b4c('0x1c')]]={};logger[_0x7b4c('0x28')](_0x7b4c('0x72'),_0x10e789[_0x7b4c('0x1c')],_0x10e789[_0x7b4c('0x6b')],_0x10e789['applicationdata']);var _0x11c809=_0x10e789[_0x7b4c('0x6e')]['split']('=');var _0x4a9cf6=_0x11c809[0x0]['match'](/cdr\((.*)\)/);if(_0x4a9cf6)this[_0x7b4c('0xc')][_0x10e789[_0x7b4c('0x1c')]][_0x4a9cf6[0x1]]=_0x11c809[0x1];}}}}catch(_0x24d4f9){logger[_0x7b4c('0x67')](_0x7b4c('0x73'),_0x10e789[_0x7b4c('0x1c')],util[_0x7b4c('0x2d')](_0x24d4f9,{'showHidden':![],'depth':null}));}};module[_0x7b4c('0x74')]=VoiceDialReport;
\ No newline at end of file
+var _0x71ab=['syncDialBegin','dialend','bind','varset','syncVarSet','hangup','isUndefined','prototype','emit','isNotNull','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','error','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','addVariable','keys','variable','value','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','seconds','total','sumHoldTime','holdtime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','syncNewExten','application','toLowerCase','applicationdata','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin'];(function(_0x4ab0bf,_0x5e1017){var _0x298919=function(_0x388fc9){while(--_0x388fc9){_0x4ab0bf['push'](_0x4ab0bf['shift']());}};_0x298919(++_0x5e1017);}(_0x71ab,0x64));var _0xb71a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x71ab[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require(_0xb71a('0x0'));var util=require('util');var Redis=require(_0xb71a('0x1'));var config=require('../../../config/environment');var logger=require(_0xb71a('0x2'))(_0xb71a('0x3'));var ami=require(_0xb71a('0x4'));config[_0xb71a('0x5')]=_[_0xb71a('0x6')](config[_0xb71a('0x5')],{'host':_0xb71a('0x7'),'port':0x18eb});var io=require(_0xb71a('0x8'))(new Redis(config[_0xb71a('0x5')]));function VoiceDialReport(_0x35a84e){this[_0xb71a('0x9')]=_0x35a84e[_0xb71a('0xa')];this[_0xb71a('0xb')]=_0x35a84e[_0xb71a('0xb')];this[_0xb71a('0xc')]={};this[_0xb71a('0xd')]={};ami['on'](_0xb71a('0xe'),this[_0xb71a('0xf')]['bind'](this));ami['on'](_0xb71a('0x10'),this['syncDialEnd'][_0xb71a('0x11')](this));ami['on'](_0xb71a('0x12'),this[_0xb71a('0x13')]['bind'](this));ami['on'](_0xb71a('0x14'),this['syncHangup'][_0xb71a('0x11')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x3346a5){return _0x3346a5!==null&&!_[_0xb71a('0x15')](_0x3346a5);};VoiceDialReport[_0xb71a('0x16')][_0xb71a('0x17')]=function(_0x483d77,_0x47ee48,_0x5364e3){io['to'](_0x483d77)[_0xb71a('0x17')](_0x47ee48,_0x5364e3);};VoiceDialReport[_0xb71a('0x16')][_0xb71a('0xf')]=function(_0x42fc55){try{if(this[_0xb71a('0x18')](_0x42fc55)){logger[_0xb71a('0x19')](_0xb71a('0x1a'),_0x42fc55[_0xb71a('0x1b')],util[_0xb71a('0x1c')](_0x42fc55,{'showHidden':![],'depth':null}));if(this['channels'][_0x42fc55[_0xb71a('0x1b')]]){_[_0xb71a('0x1d')](this[_0xb71a('0x9')][_0x42fc55[_0xb71a('0x1b')]],{'starttime':moment()[_0xb71a('0x1e')](_0xb71a('0x1f')),'lastevent':_0xb71a('0x20'),'interface':_0x42fc55[_0xb71a('0x21')][_0xb71a('0x22')](0x0,_0x42fc55[_0xb71a('0x21')][_0xb71a('0x23')]('-')),'membername':_0x42fc55['channel']['substring'](_0x42fc55[_0xb71a('0x21')][_0xb71a('0x23')]('/')+0x1,_0x42fc55['channel']['lastIndexOf']('-'))},_[_0xb71a('0x24')](_0x42fc55,['event',_0xb71a('0x25')]));logger[_0xb71a('0x26')](_0xb71a('0x27'),_0x42fc55[_0xb71a('0x1b')],this[_0xb71a('0x9')][_0x42fc55[_0xb71a('0x1b')]][_0xb71a('0x28')],this[_0xb71a('0x9')][_0x42fc55['uniqueid']][_0xb71a('0x29')]);logger[_0xb71a('0x19')](_0xb71a('0x2a'),_0x42fc55[_0xb71a('0x1b')],util[_0xb71a('0x1c')](this[_0xb71a('0x9')][_0x42fc55[_0xb71a('0x1b')]],{'showHidden':![],'depth':null}));if(this[_0xb71a('0xc')][_0x42fc55[_0xb71a('0x1b')]])_[_0xb71a('0x1d')](this[_0xb71a('0x9')][_0x42fc55[_0xb71a('0x1b')]],this[_0xb71a('0xc')][_0x42fc55['uniqueid']]);this[_0xb71a('0x17')](_0xb71a('0x2b'),_0xb71a('0x2c'),this[_0xb71a('0x9')][_0x42fc55[_0xb71a('0x1b')]]);logger[_0xb71a('0x19')](_0xb71a('0x2d'),_0x42fc55[_0xb71a('0x1b')],util[_0xb71a('0x1c')](this[_0xb71a('0x9')][_0x42fc55[_0xb71a('0x1b')]],{'showHidden':![],'depth':null}));ami['emit']('custom:dialbegin',this[_0xb71a('0x9')][_0x42fc55['uniqueid']]);}}}catch(_0x70299a){logger[_0xb71a('0x2e')]('[%s][voiceDialReport][dialbegin]',_0x42fc55[_0xb71a('0x1b')],util[_0xb71a('0x1c')](_0x70299a,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb71a('0x16')][_0xb71a('0x2f')]=function(_0x3d3d81){try{if(this[_0xb71a('0x18')](_0x3d3d81)){logger['debug'](_0xb71a('0x30'),_0x3d3d81[_0xb71a('0x1b')],util[_0xb71a('0x1c')](_0x3d3d81,{'showHidden':![],'depth':null}));if(this[_0xb71a('0x9')][_0x3d3d81['uniqueid']]){this[_0xb71a('0x9')][_0x3d3d81[_0xb71a('0x1b')]][_0xb71a('0x31')]=_0x3d3d81[_0xb71a('0x31')];if(_0x3d3d81[_0xb71a('0x31')]===_0xb71a('0x32')){this[_0xb71a('0x9')][_0x3d3d81[_0xb71a('0x1b')]][_0xb71a('0x33')]=_0x3d3d81[_0xb71a('0x33')];this['channels'][_0x3d3d81['uniqueid']][_0xb71a('0x34')]=_0x3d3d81[_0xb71a('0x34')];this[_0xb71a('0x9')][_0x3d3d81[_0xb71a('0x1b')]][_0xb71a('0x35')]=moment()[_0xb71a('0x1e')](_0xb71a('0x1f'));this['channels'][_0x3d3d81[_0xb71a('0x1b')]]['lastevent']=_0xb71a('0x36');logger[_0xb71a('0x26')](_0xb71a('0x37'),_0x3d3d81[_0xb71a('0x1b')],_0x3d3d81['channel'][_0xb71a('0x22')](_0x3d3d81[_0xb71a('0x21')][_0xb71a('0x23')]('/')+0x1,_0x3d3d81[_0xb71a('0x21')][_0xb71a('0x23')]('-')));logger[_0xb71a('0x19')](_0xb71a('0x38'),_0x3d3d81[_0xb71a('0x1b')],util[_0xb71a('0x1c')](this['channels'][_0x3d3d81[_0xb71a('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0xb71a('0x39'),this[_0xb71a('0x9')][_0x3d3d81[_0xb71a('0x1b')]]);}logger[_0xb71a('0x19')](_0xb71a('0x3a'),_0x3d3d81[_0xb71a('0x1b')],util['inspect'](this['channels'][_0x3d3d81['uniqueid']],{'showHidden':![],'depth':null}));this[_0xb71a('0x17')]('voice:outbound',_0xb71a('0x2c'),this[_0xb71a('0x9')][_0x3d3d81[_0xb71a('0x1b')]]);}}}catch(_0x396d36){logger[_0xb71a('0x2e')](_0xb71a('0x3b'),_0x3d3d81['uniqueid'],util[_0xb71a('0x1c')](_0x396d36,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb71a('0x16')][_0xb71a('0x13')]=function(_0x8bf582){try{if(this[_0xb71a('0x18')](_0x8bf582)){logger[_0xb71a('0x19')]('[%s][voiceDialReport][varset]\x20event:',_0x8bf582[_0xb71a('0x1b')],util[_0xb71a('0x1c')](_0x8bf582,{'showHidden':![],'depth':null}));this[_0xb71a('0x3c')](_0x8bf582[_0xb71a('0x1b')],_[_0xb71a('0x3d')](_0x8bf582[_0xb71a('0x3e')])[0x0],_0x8bf582[_0xb71a('0x3f')]);if(this['isNotNull'](_0x8bf582['variable'])&&this[_0xb71a('0x18')](_0x8bf582[_0xb71a('0x3e')][_0xb71a('0x40')])){if(_[_0xb71a('0x15')](this['channels'][_0x8bf582[_0xb71a('0x1b')]])){this['channels'][_0x8bf582[_0xb71a('0x1b')]]={'routeId':_0x8bf582[_0xb71a('0x3f')],'variables':this['variables'][_0x8bf582[_0xb71a('0x1b')]],'motionChannel':_0xb71a('0x41')};logger[_0xb71a('0x26')](_0xb71a('0x42'),_0x8bf582['uniqueid'],_0x8bf582[_0xb71a('0x3e')][_0xb71a('0x40')],_[_0xb71a('0x3d')](_0x8bf582['variable'])[0x0],_0x8bf582[_0xb71a('0x3f')]);logger[_0xb71a('0x19')](_0xb71a('0x43'),_0x8bf582['uniqueid'],util[_0xb71a('0x1c')](this[_0xb71a('0x9')][_0x8bf582[_0xb71a('0x1b')]],{'showHidden':![],'depth':null}));this[_0xb71a('0x17')](_0xb71a('0x2b'),'voice_outbound_channel:save',this[_0xb71a('0x9')][_0x8bf582[_0xb71a('0x1b')]]);}}}}catch(_0x45e961){logger[_0xb71a('0x2e')]('[%s][voiceDialReport][varset]',_0x8bf582['uniqueid'],util[_0xb71a('0x1c')](_0x45e961,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb71a('0x16')][_0xb71a('0x3c')]=function(_0x170978,_0x174f30,_0x2f2187){var _0x2a7804=[_0xb71a('0x44'),_0xb71a('0x45'),_0xb71a('0x46'),'rtpaudioqosjitterbridged',_0xb71a('0x47'),_0xb71a('0x48'),'rtpaudioqosrtt',_0xb71a('0x49'),'sipcallid',_0xb71a('0x4a'),_0xb71a('0x4b'),_0xb71a('0x4c'),_0xb71a('0x4d'),_0xb71a('0x4e'),'memberinterface',_0xb71a('0x4f'),'membername',_0xb71a('0x50'),_0xb71a('0x51')];if(!_['isNil'](_0x174f30)&&!_['includes'](_0x2a7804,_0x174f30)){if(_[_0xb71a('0x15')](this[_0xb71a('0xd')][_0x170978])){this['variables'][_0x170978]={};}this['variables'][_0x170978][_0x174f30]=_0x2f2187;}};VoiceDialReport['prototype'][_0xb71a('0x52')]=function(_0x57ef8f){try{if(this['isNotNull'](_0x57ef8f)){logger[_0xb71a('0x19')](_0xb71a('0x53'),_0x57ef8f[_0xb71a('0x1b')],util[_0xb71a('0x1c')](_0x57ef8f,{'showHidden':![],'depth':null}));if(this['channels'][_0x57ef8f[_0xb71a('0x1b')]]){logger[_0xb71a('0x26')](_0xb71a('0x54'),_0x57ef8f['uniqueid'],_0x57ef8f[_0xb71a('0x55')]);this[_0xb71a('0x9')][_0x57ef8f['uniqueid']][_0xb71a('0x56')]=moment()[_0xb71a('0x1e')](_0xb71a('0x1f'));this['channels'][_0x57ef8f[_0xb71a('0x1b')]]['duration']=moment(this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]]['endtime'])[_0xb71a('0x57')](this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]][_0xb71a('0x58')],_0xb71a('0x59'));this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]]['lastevent']='complete';this[_0xb71a('0xb')][_0xb71a('0x5a')]+=0x1;if(this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]][_0xb71a('0x35')]){this['outbound']['answered']+=0x1;this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]]['holdtime']=moment(this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]]['answertime'])[_0xb71a('0x57')](this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]][_0xb71a('0x58')],'seconds');this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]]['billableseconds']=moment(this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]][_0xb71a('0x56')])[_0xb71a('0x57')](this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]][_0xb71a('0x35')],_0xb71a('0x59'));this['outbound'][_0xb71a('0x5b')]+=this[_0xb71a('0x9')][_0x57ef8f['uniqueid']][_0xb71a('0x5c')]||0x0;this[_0xb71a('0xb')]['sumBillable']+=this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]][_0xb71a('0x5d')];}this[_0xb71a('0xb')][_0xb71a('0x5e')]+=this[_0xb71a('0x9')][_0x57ef8f['uniqueid']]['duration'];logger[_0xb71a('0x19')](_0xb71a('0x5f'),_0x57ef8f[_0xb71a('0x1b')],util['inspect'](this[_0xb71a('0x9')][_0x57ef8f['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xb71a('0x17')]('custom:voiceDialReport',this['channels'][_0x57ef8f[_0xb71a('0x1b')]]);logger[_0xb71a('0x19')](_0xb71a('0x60'),_0x57ef8f[_0xb71a('0x1b')],util[_0xb71a('0x1c')](this['channels'][_0x57ef8f[_0xb71a('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0xb71a('0x61'),this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x57ef8f[_0xb71a('0x1b')],util[_0xb71a('0x1c')](this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]],{'showHidden':![],'depth':null}));this[_0xb71a('0x17')]('voice:outbound',_0xb71a('0x62'),this[_0xb71a('0xb')]);logger[_0xb71a('0x26')](_0xb71a('0x63'),JSON[_0xb71a('0x64')](this['channels'][_0x57ef8f['uniqueid']]));logger[_0xb71a('0x19')](_0xb71a('0x65'),_0x57ef8f[_0xb71a('0x1b')],util[_0xb71a('0x1c')](this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]],{'showHidden':![],'depth':null}));this[_0xb71a('0x17')]('voice:outbound',_0xb71a('0x66'),this[_0xb71a('0x9')][_0x57ef8f['uniqueid']]);delete this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x1b')]];}else if(this[_0xb71a('0x9')][_0x57ef8f['linkedid']]){this[_0xb71a('0x9')][_0x57ef8f[_0xb71a('0x67')]][_0xb71a('0x1b')]=this['channels'][_0x57ef8f[_0xb71a('0x67')]][_0xb71a('0x68')];}if(this[_0xb71a('0xd')][_0x57ef8f[_0xb71a('0x1b')]]){delete this[_0xb71a('0xd')][_0x57ef8f[_0xb71a('0x1b')]];}}}catch(_0x2cdaf9){logger[_0xb71a('0x2e')]('[%s][voiceDialReport][hangup]',_0x57ef8f[_0xb71a('0x1b')],util[_0xb71a('0x1c')](_0x2cdaf9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xb71a('0x16')][_0xb71a('0x69')]=function(_0x43e4b8){try{if(this[_0xb71a('0x18')](_0x43e4b8)){logger[_0xb71a('0x19')]('[%s][voiceDialReport][newexten]\x20event:',_0x43e4b8[_0xb71a('0x1b')],util['inspect'](_0x43e4b8,{'showHidden':![],'depth':null}));if(_0x43e4b8[_0xb71a('0x6a')][_0xb71a('0x6b')]()==='set'){_0x43e4b8[_0xb71a('0x6c')]=(_0x43e4b8['appdata']||_0x43e4b8[_0xb71a('0x6c')])['toLowerCase']();if(_[_0xb71a('0x6d')](_0x43e4b8[_0xb71a('0x6c')],_0xb71a('0x6e'))){if(_[_0xb71a('0x15')](this['applications'][_0x43e4b8[_0xb71a('0x1b')]]))this[_0xb71a('0xc')][_0x43e4b8['uniqueid']]={};logger[_0xb71a('0x26')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x43e4b8['uniqueid'],_0x43e4b8['application'],_0x43e4b8['applicationdata']);var _0x37a38f=_0x43e4b8[_0xb71a('0x6c')][_0xb71a('0x6f')]('=');var _0x5554e8=_0x37a38f[0x0][_0xb71a('0x70')](/cdr\((.*)\)/);if(_0x5554e8)this[_0xb71a('0xc')][_0x43e4b8['uniqueid']][_0x5554e8[0x1]]=_0x37a38f[0x1];}}}}catch(_0x299349){logger[_0xb71a('0x2e')](_0xb71a('0x71'),_0x43e4b8[_0xb71a('0x1b')],util[_0xb71a('0x1c')](_0x299349,{'showHidden':![],'depth':null}));}};module[_0xb71a('0x72')]=VoiceDialReport;
\ No newline at end of file
index d2f7dfa..5fef3a0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf61f=['transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','channel','toLowerCase','linkedid','queuecallerjoinAt','add','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','variable','value','CONTINUE','TIMEOUT','lastevent','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','emitVoiceQueueChannelRemove','varset','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','handleHangup','length','sumHoldTime','diff','ATTENDEDTRANSFER','COMPLETEDBYAGENT','sumDuration','milliseconds','answered','sumBillable','queuecallercompleteAt','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','syncAttendedTransfer','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','[%s][voiceQueueReport][newexten]','exports','lodash','moment','../../../config/logger','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','tail','finally','queueReports','realtime','agents','channels','campaigns','variables','queuesummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncAgentComplete','agentconnect','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','queuecallerexit','clearZombieChannels','switch','enqueue','Action','status','catch','message','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','prototype','[FullyBooted]\x20clear\x20realtime','voiceQueues','summary','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','format','voice_queue_presence:remove','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','isNotNull','queues','isRunning','then','queuestatus','createQueueSummaryReport','summaryEvent','createReport','compareToInboundQueue','assign','emitInboundVoiceQueueSummary','actionid','type','handleInboundQueueSummaryReport','outbound','custom:queuesummary','completeEvent','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','statusRequests','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','keys','emitVoiceQueueChannelSave','holdtime','originalposition','queuecallerabandonAt','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','last','queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','syncAgentConnect','queuecallercomplete','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','assigned','membername','queuecallerexitAt'];(function(_0x1c7e66,_0x35a3a9){var _0xc8726a=function(_0x4d1b8a){while(--_0x4d1b8a){_0x1c7e66['push'](_0x1c7e66['shift']());}};_0xc8726a(++_0x35a3a9);}(_0xf61f,0x68));var _0xff61=function(_0x108d68,_0x9b39de){_0x108d68=_0x108d68-0x0;var _0x11476a=_0xf61f[_0x108d68];return _0x11476a;};'use strict';var _=require(_0xff61('0x0'));var moment=require(_0xff61('0x1'));var util=require('util');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xff61('0x2'))(_0xff61('0x3'));var ami=require('../ami');var QueueReport=require(_0xff61('0x4'));var VoiceQueueSummary=require(_0xff61('0x5'));config[_0xff61('0x6')]=_[_0xff61('0x7')](config[_0xff61('0x6')],{'host':_0xff61('0x8'),'port':0x18eb});var io=require(_0xff61('0x9'))(new Redis(config[_0xff61('0x6')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x84cae9){this['tail']=this[_0xff61('0xa')]?this[_0xff61('0xa')][_0xff61('0xb')](_0x84cae9):_0x84cae9();};function VoiceQueueReport(_0x40dbc8){this['sequence']=new Sequence();this[_0xff61('0xc')]={};this[_0xff61('0xd')]=_0x40dbc8;this['agents']=_0x40dbc8[_0xff61('0xe')];this[_0xff61('0xf')]=_0x40dbc8['queueChannels'];this['voiceQueues']=_0x40dbc8['voiceQueues'];this[_0xff61('0x10')]=_0x40dbc8['campaigns'];this['summary']=initializeSummary();this[_0xff61('0x11')]={};ami['on'](_0xff61('0x12'),this['syncQueueSummary'][_0xff61('0x13')](this));ami['on']('queuesummarycomplete',this[_0xff61('0x14')][_0xff61('0x13')](this));ami['on'](_0xff61('0x15'),this[_0xff61('0x16')]['bind'](this));ami['on'](_0xff61('0x17'),this[_0xff61('0x18')][_0xff61('0x13')](this));ami['on'](_0xff61('0x19'),this['syncQueueCallerJoin']['bind'](this));ami['on'](_0xff61('0x1a'),this[_0xff61('0x1b')][_0xff61('0x13')](this));ami['on'](_0xff61('0x1c'),this['syncQueueCallerLeave'][_0xff61('0x13')](this));ami['on']('agentcomplete',this[_0xff61('0x1d')][_0xff61('0x13')](this));ami['on'](_0xff61('0x1e'),this['syncAgentConnect']['bind'](this));ami['on']('varset',this[_0xff61('0x1f')]['bind'](this));ami['on'](_0xff61('0x20'),this[_0xff61('0x21')]['bind'](this));ami['on'](_0xff61('0x22'),this[_0xff61('0x23')][_0xff61('0x13')](this));ami['on'](_0xff61('0x24'),this[_0xff61('0x25')][_0xff61('0x13')](this));ami['on'](_0xff61('0x26'),this['syncMusicOnHoldStop'][_0xff61('0x13')](this));ami['on'](_0xff61('0x27'),this['syncAttendedTransfer'][_0xff61('0x13')](this));ami['on']('blindtransfer',this[_0xff61('0x28')]['bind'](this));this[_0xff61('0x29')]();this[_0xff61('0x2a')]();}function clearChannels(_0x4578aa){if(!_[_0xff61('0x2b')](_0x4578aa)){for(var _0x40a5f8 in _0x4578aa){if(_0x4578aa[_0xff61('0x2c')](_0x40a5f8)){delete _0x4578aa[_0x40a5f8];}}}}function clearCampaigns(_0xab56cd){if(!_[_0xff61('0x2b')](_0xab56cd)){for(var _0x23a022 in _0xab56cd){if(_0xab56cd['hasOwnProperty'](_0x23a022)){_0xab56cd[_0x23a022][_0xff61('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x47f331){if(!_['isEmpty'](_0x47f331)){for(var _0xea94f in _0x47f331){if(_0x47f331[_0xff61('0x2c')](_0xea94f)){_0x47f331[_0xea94f]['originated']=0x0;_0x47f331[_0xea94f][_0xff61('0x2e')]=0x0;_0x47f331[_0xea94f][_0xff61('0x2f')]=0x0;_0x47f331[_0xea94f][_0xff61('0x30')]=0x0;_0x47f331[_0xea94f][_0xff61('0x31')]=!![];}}}}function clearAgentBooked(_0x1f0ee0){if(!_[_0xff61('0x2b')](_0x1f0ee0)){for(var _0xc2519d in _0x1f0ee0){if(_0x1f0ee0[_0xff61('0x2c')](_0xc2519d)){_0x1f0ee0[_0xc2519d]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x14a812){return _0x14a812[_0xff61('0x32')]||_0x14a812[_0xff61('0x1a')]||_0x14a812['queuecallercomplete'];}VoiceQueueReport['prototype'][_0xff61('0x33')]=function(){var _0x125f5b=this;for(var _0x2081d5 in this[_0xff61('0xf')]){if(this['channels'][_0xff61('0x2c')](_0x2081d5)&&!this[_0xff61('0xf')][_0x2081d5][_0xff61('0x34')]){this['sequence'][_0xff61('0x35')](function(){if(!_['isNil'](_0x125f5b[_0xff61('0xf')][_0x2081d5])){return ami[_0xff61('0x36')]({'action':_0xff61('0x37'),'channel':_0x125f5b[_0xff61('0xf')][_0x2081d5]['channel']})[_0xff61('0x38')](function(_0x1c63c3){if(_0x1c63c3[_0xff61('0x39')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x125f5b[_0xff61('0xf')][_0x2081d5]){delete _0x125f5b[_0xff61('0xf')][_0x2081d5];logger[_0xff61('0x3a')]('[%s][voiceQueueReport][checkChannel]',_0x2081d5,util[_0xff61('0x3b')](_0x1c63c3,{'showHidden':![],'depth':null}));}if(_0x125f5b['queueReports'][_0x2081d5]){delete _0x125f5b['queueReports'][_0x2081d5];logger['error'](_0xff61('0x3c'),_0x2081d5,util[_0xff61('0x3b')](_0x1c63c3,{'showHidden':![],'depth':null}));}if(_0x125f5b['variables'][_0x2081d5]){delete _0x125f5b[_0xff61('0x11')][_0x2081d5];logger[_0xff61('0x3a')](_0xff61('0x3d'),_0x2081d5,util['inspect'](_0x1c63c3,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x23')]=function(){logger['error'](_0xff61('0x3f'));clearChannels(this[_0xff61('0xf')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0xff61('0x40')]);clearCampaigns(this[_0xff61('0x10')]);this[_0xff61('0x41')]=initializeSummary();};VoiceQueueReport[_0xff61('0x3e')]['clearQueueReport']=function(_0xc54274){var _0xd98674=this;if(!_['isEmpty'](_0xc54274)){for(var _0x1828d0 in _0xc54274){if(_0xc54274[_0xff61('0x2c')](_0x1828d0)){_0xd98674['emitVoiceQueueChannelRemove'](_0xc54274[_0x1828d0],_0xff61('0x42'));delete _0xc54274[_0x1828d0];}}}};VoiceQueueReport['prototype'][_0xff61('0x43')]=function(_0x5852cb,_0x1469d0,_0xbd9599){io['to'](_0x5852cb)[_0xff61('0x43')](_0x1469d0,_0xbd9599);};VoiceQueueReport[_0xff61('0x3e')]['emitVoiceQueueChannelSave']=function(_0x54e529,_0x39ef07){logger[_0xff61('0x44')](_0xff61('0x45')+_0x39ef07+_0xff61('0x46'),_0x54e529[_0xff61('0x47')],util[_0xff61('0x3b')](_0x54e529,{'showHidden':![],'depth':null}));this[_0xff61('0x43')](util['format'](_0xff61('0x48'),_0x54e529[_0xff61('0x49')]),_0xff61('0x4a'),_0x54e529);io[_0xff61('0x43')](_0xff61('0x4b'),_0x54e529);};VoiceQueueReport[_0xff61('0x3e')]['emitVoiceQueueChannelRemove']=function(_0x2e486c,_0x49c454){logger['debug'](_0xff61('0x45')+_0x49c454+_0xff61('0x4c'),_0x2e486c[_0xff61('0x47')],util[_0xff61('0x3b')](_0x2e486c,{'showHidden':![],'depth':null}));if(_0x2e486c[_0xff61('0x4d')]==='ATTENDEDTRANSFER'){return;}this[_0xff61('0x43')](util[_0xff61('0x4e')]('voice:queue:%s',_0x2e486c[_0xff61('0x49')]),'voice_queue_channel:remove',_0x2e486c);io[_0xff61('0x43')](_0xff61('0x4f'),_0x2e486c);};VoiceQueueReport[_0xff61('0x3e')]['emitInboundVoiceQueueSummary']=function(_0x439d0d){if(_0x439d0d['type']===_0xff61('0x50')){logger[_0xff61('0x44')](_0xff61('0x51'),util[_0xff61('0x3b')](_0x439d0d,{'showHidden':![],'depth':null}));this[_0xff61('0x43')](util[_0xff61('0x4e')](_0xff61('0x48'),_0x439d0d[_0xff61('0x52')]),'voice_queue:save',_0x439d0d);}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x53')]=function(_0x39a757){return _0x39a757!==null&&!_['isUndefined'](_0x39a757);};VoiceQueueReport[_0xff61('0x3e')]['loopQueueShow']=function(){var _0x3239e6=this;setInterval(function(){_0x3239e6[_0xff61('0x33')]();ami['Action']({'action':_0xff61('0x54')})[_0xff61('0x38')](function(_0x2b893c){logger[_0xff61('0x3a')]('[voiceQueueReport][queues]',util[_0xff61('0x3b')](_0x2b893c,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x29')]=function(){var _0x5d71e3=this;setInterval(function(){if(!_0x5d71e3['summary'][_0xff61('0x55')]){return ami[_0xff61('0x36')]({'action':_0xff61('0x12')})[_0xff61('0x56')](function(_0x2ca886){_0x5d71e3[_0xff61('0x41')]['id']=_0x2ca886['actionid'];_0x5d71e3['summary']['isRunning']=!![];_0x5d71e3[_0xff61('0x41')][_0xff61('0x57')][_0x2ca886['actionid']]={};})[_0xff61('0x38')](function(_0x528201){logger[_0xff61('0x3a')]('[voiceQueueReport][queuesummary]',util[_0xff61('0x3b')](_0x528201,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0xff61('0x58')]=function(_0x1dd3d3,_0x67ec14){var _0x53db36;if(this[_0xff61('0x41')]&&this[_0xff61('0x41')][_0xff61('0x54')]&&this[_0xff61('0x41')][_0xff61('0x54')][_0x1dd3d3[_0xff61('0x52')]]){_0x53db36=this[_0xff61('0x41')]['queues'][_0x1dd3d3[_0xff61('0x52')]][_0xff61('0x59')];}var _0x1e0770=new VoiceQueueSummary(_0x1dd3d3);return _0x1e0770[_0xff61('0x5a')](_0x67ec14[_0xff61('0xe')],this['agents'],_0x53db36,this['realtime'][_0xff61('0xf')]);};VoiceQueueReport[_0xff61('0x3e')]['handleInboundQueueSummaryReport']=function(_0x35d2ac,_0x57b04b){var _0x220576=this[_0xff61('0x58')](_0x35d2ac,_0x57b04b);var _0x55cacc=![];_0x55cacc=_0x220576[_0xff61('0x5b')](_0x35d2ac);if(_0x55cacc){Object[_0xff61('0x5c')](_0x35d2ac,_0x220576);this['realtime'][_0xff61('0x40')][_0x35d2ac[_0xff61('0x52')]]=_0x35d2ac;this[_0xff61('0x5d')](_0x220576);}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x18')]=function(_0x23a76a){var _0x66e1e0=null;var _0x3feb85=this['summary']['id'];if(this['summary']['queuestatus'][_0x3feb85]){_0x66e1e0=this[_0xff61('0x41')][_0xff61('0x57')][_0x3feb85][_0x23a76a[_0xff61('0x5e')]];}if(!_0x66e1e0){this[_0xff61('0x41')]=initializeSummary();return;}var _0x4b9744=this[_0xff61('0x40')][_0x66e1e0[_0xff61('0x49')]];if(_0x4b9744[_0xff61('0x5f')]===_0xff61('0x50')){this[_0xff61('0x60')](_0x4b9744,_0x66e1e0);}else if(_0x4b9744[_0xff61('0x5f')]===_0xff61('0x61')){var _0x353c0e=this[_0xff61('0x58')](_0x4b9744,_0x66e1e0);ami[_0xff61('0x43')](_0xff61('0x62'),_0x353c0e);}this[_0xff61('0x41')]['statusRequests']-=0x1;var _0x24aff5=this['summary']['statusRequests']>0x0?!![]:![];if(!_0x24aff5){return this[_0xff61('0x14')](this[_0xff61('0x41')][_0xff61('0x63')]);}};VoiceQueueReport['prototype'][_0xff61('0x16')]=function(_0x27d927){var _0x3f1330=this[_0xff61('0x41')]['id'];if(this[_0xff61('0x41')][_0xff61('0x57')][_0x3f1330]&&this[_0xff61('0x41')]['queuestatus'][_0x3f1330][_0x27d927[_0xff61('0x5e')]]){this[_0xff61('0x41')][_0xff61('0x57')][_0x3f1330][_0x27d927['actionid']][_0xff61('0xe')][_0xff61('0x64')](_0x27d927);}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x65')]=function(_0x495c6b){var _0x9df62e=this;try{if(this[_0xff61('0x53')](_0x495c6b)&&this[_0xff61('0x53')](_0x495c6b[_0xff61('0x49')])){logger['debug'](_0xff61('0x66'),util['inspect'](_0x495c6b,{'showHidden':![],'depth':null}));var _0x16c658=this[_0xff61('0x40')][_0x495c6b['queue']];if(_0x16c658){logger[_0xff61('0x44')](_0xff61('0x67'),_0x16c658['name']);this[_0xff61('0x41')][_0xff61('0x54')][_0x16c658[_0xff61('0x52')]]={'summaryEvent':_0x495c6b};this[_0xff61('0x41')][_0xff61('0x68')]+=0x1;return ami['Action']({'action':_0xff61('0x57'),'queue':_0x16c658[_0xff61('0x52')]})['then'](function(_0x40dcd7){if(!_0x9df62e[_0xff61('0x41')]['queuestatus'][_0x495c6b[_0xff61('0x5e')]]){_0x9df62e[_0xff61('0x41')]['queuestatus'][_0x495c6b[_0xff61('0x5e')]]={};}_0x9df62e[_0xff61('0x41')][_0xff61('0x57')][_0x495c6b[_0xff61('0x5e')]][_0x40dcd7[_0xff61('0x5e')]]={'queue':_0x16c658[_0xff61('0x52')],'agents':[]};})[_0xff61('0x38')](function(_0x1882d2){throw _0x1882d2;});}}}catch(_0x341781){logger['error']('[voiceQueueReport][queuesummary]',util['inspect'](_0x341781,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x14')]=function(_0x5e19cb){if(this[_0xff61('0x41')][_0xff61('0x68')]>0x0){this[_0xff61('0x41')][_0xff61('0x63')]=_0x5e19cb;return;}logger['debug'](_0xff61('0x69'),util[_0xff61('0x3b')](_0x5e19cb,{'showHidden':![],'depth':null}));this[_0xff61('0x41')]=initializeSummary();ami[_0xff61('0x43')](_0xff61('0x6a'),{});};VoiceQueueReport[_0xff61('0x3e')]['syncQueueCallerJoin']=function(_0x53f8e3){try{if(this['isNotNull'](_0x53f8e3)){logger['debug'](_0xff61('0x6b'),_0x53f8e3['uniqueid'],util['inspect'](_0x53f8e3,{'showHidden':![],'depth':null}));if(_[_0xff61('0x6c')](this[_0xff61('0xc')][_0x53f8e3[_0xff61('0x47')]])){this['queueReports'][_0x53f8e3[_0xff61('0x47')]]=[];}if(_[_0xff61('0x6c')](this[_0xff61('0xf')][_0x53f8e3[_0xff61('0x47')]])){this[_0xff61('0xf')][_0x53f8e3[_0xff61('0x47')]]={};}var _0x25cd55=new QueueReport();_0x25cd55[_0xff61('0x49')]=_0x53f8e3[_0xff61('0x49')];_0x25cd55[_0xff61('0x5f')]=this['voiceQueues'][_0x25cd55[_0xff61('0x49')]]&&this[_0xff61('0x40')][_0x25cd55['queue']][_0xff61('0x5f')]?this['voiceQueues'][_0x25cd55[_0xff61('0x49')]][_0xff61('0x5f')]||'inbound':'inbound';_0x25cd55['queuecallerjoinAt']=moment()['format'](_0xff61('0x6d'));_0x25cd55['position']=_0x53f8e3[_0xff61('0x6e')];_0x25cd55[_0xff61('0x6f')]=_0x53f8e3['count'];_0x25cd55[_0xff61('0x47')]=_0x53f8e3[_0xff61('0x47')];_0x25cd55['routealias']=this['channels'][_0x53f8e3[_0xff61('0x47')]]['routealias'];logger['info'](_0xff61('0x70'),_0x25cd55[_0xff61('0x49')],_0x25cd55[_0xff61('0x5f')]);Object[_0xff61('0x5c')](_0x25cd55,_[_0xff61('0x71')](_0x53f8e3,_[_0xff61('0x72')](_0x25cd55)));this['queueReports'][_0x53f8e3[_0xff61('0x47')]][_0xff61('0x64')](_0x25cd55);this[_0xff61('0xf')][_0x53f8e3['uniqueid']]=_0x25cd55;this[_0xff61('0x73')](_0x25cd55,_0xff61('0x19'));}}catch(_0x47ffa7){logger[_0xff61('0x3a')](_0xff61('0x6b'),_0x53f8e3[_0xff61('0x47')],util['inspect'](_0x47ffa7,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x1b')]=function(_0x25e38f){try{if(this[_0xff61('0x53')](_0x25e38f)){logger[_0xff61('0x44')]('[%s][voiceQueueReport][queuecallerabandon]',_0x25e38f[_0xff61('0x47')],util['inspect'](_0x25e38f,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x25e38f['uniqueid']]){var _0xc27ed6=_['last'](this[_0xff61('0xc')][_0x25e38f[_0xff61('0x47')]]);_0xc27ed6['queuecallercomplete']=![];_0xc27ed6['queuecallercompleteAt']=null;_0xc27ed6[_0xff61('0x74')]=_0x25e38f[_0xff61('0x74')];_0xc27ed6[_0xff61('0x75')]=_0x25e38f[_0xff61('0x75')];_0xc27ed6[_0xff61('0x1a')]=!![];_0xc27ed6[_0xff61('0x76')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xc27ed6[_0xff61('0x4d')]='ABANDONED';_0xc27ed6[_0xff61('0x77')]=null;logger[_0xff61('0x78')](_0xff61('0x79'),_0xc27ed6[_0xff61('0x49')],_0xc27ed6[_0xff61('0x5f')]);this[_0xff61('0xf')][_0x25e38f[_0xff61('0x47')]]=_0xc27ed6;this['emitVoiceQueueChannelRemove'](_0xc27ed6,'queuecallerabandon');}}}catch(_0x2b955f){logger[_0xff61('0x3a')](_0xff61('0x7a'),_0x25e38f[_0xff61('0x47')],util[_0xff61('0x3b')](_0x2b955f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')]['syncQueueCallerLeave']=function(_0x3c86c6){try{if(this[_0xff61('0x53')](_0x3c86c6)){logger[_0xff61('0x44')](_0xff61('0x7b'),_0x3c86c6[_0xff61('0x47')],util[_0xff61('0x3b')](_0x3c86c6,{'showHidden':![],'depth':null}));if(this[_0xff61('0xc')][_0x3c86c6[_0xff61('0x47')]]){var _0x52d1fa=_[_0xff61('0x7c')](this[_0xff61('0xc')][_0x3c86c6[_0xff61('0x47')]]);_0x52d1fa[_0xff61('0x7d')]=moment()['format'](_0xff61('0x6d'));_0x52d1fa['connectedlinenum']=_0x3c86c6[_0xff61('0x7e')];_0x52d1fa[_0xff61('0x7f')]=_0x3c86c6[_0xff61('0x7f')];logger[_0xff61('0x78')](_0xff61('0x80'),_0x52d1fa[_0xff61('0x49')],_0x52d1fa[_0xff61('0x5f')],_0x3c86c6[_0xff61('0x7e')],_0x3c86c6[_0xff61('0x7f')]);this[_0xff61('0xf')][_0x3c86c6[_0xff61('0x47')]]=_0x52d1fa;this['emitVoiceQueueChannelSave'](_0x52d1fa,_0xff61('0x1c'));}}}catch(_0x4ffb89){logger[_0xff61('0x3a')](_0xff61('0x7b'),_0x3c86c6['uniqueid'],util[_0xff61('0x3b')](_0x4ffb89,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xff61('0x81')]=function(_0x932164){try{if(this[_0xff61('0x53')](_0x932164)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x932164['uniqueid'],util['inspect'](_0x932164,{'showHidden':![],'depth':null}));if(this[_0xff61('0xc')][_0x932164[_0xff61('0x47')]]){var _0x6b1861=_[_0xff61('0x7c')](this['queueReports'][_0x932164[_0xff61('0x47')]]);_0x6b1861[_0xff61('0x82')]=!![];_0x6b1861['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xff61('0x78')](_0xff61('0x83'),_0x6b1861[_0xff61('0x49')],_0x6b1861[_0xff61('0x5f')]);}}}catch(_0x1ca832){logger['error'](_0xff61('0x84'),_0x932164['uniqueid'],util[_0xff61('0x3b')](_0x1ca832,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x1d')]=function(_0x4398bb){try{if(this[_0xff61('0x53')](_0x4398bb)){logger[_0xff61('0x44')]('[%s][voiceQueueReport][agentcomplete]',_0x4398bb['uniqueid'],util[_0xff61('0x3b')](_0x4398bb,{'showHidden':![],'depth':null}));if(this[_0xff61('0xc')][_0x4398bb[_0xff61('0x47')]]){var _0x56af2d=_[_0xff61('0x7c')](this['queueReports'][_0x4398bb[_0xff61('0x47')]]);_0x56af2d['queuecallerabandon']=![];_0x56af2d[_0xff61('0x76')]=null;_0x56af2d[_0xff61('0x85')]=!![];_0x56af2d[_0xff61('0x77')]=_0x4398bb[_0xff61('0x86')];_0x56af2d[_0xff61('0x74')]=_0x4398bb[_0xff61('0x74')];_0x56af2d[_0xff61('0x82')]=!![];_0x56af2d[_0xff61('0x32')]=![];_0x56af2d[_0xff61('0x87')]=null;if(!_0x56af2d[_0xff61('0x88')]){if(_0x4398bb['reason']=='transfer'){_0x56af2d[_0xff61('0x4d')]=_0xff61('0x89');logger[_0xff61('0x78')](_0xff61('0x8a'),_0x56af2d[_0xff61('0x49')],_0x56af2d['type']);}else{if(_[_0xff61('0x8b')](_0x4398bb[_0xff61('0x8c')][_0xff61('0x8d')](),'local/')){if(this[_0xff61('0xc')][_0x4398bb[_0xff61('0x8e')]]){var _0x22e1fa=_[_0xff61('0x7c')](this['queueReports'][_0x4398bb[_0xff61('0x8e')]]);_0x22e1fa[_0xff61('0x82')]=![];_0x22e1fa[_0xff61('0x32')]=!![];_0x22e1fa[_0xff61('0x87')]=moment(_0x56af2d[_0xff61('0x8f')])[_0xff61('0x90')](_0x4398bb[_0xff61('0x74')],_0xff61('0x91'))['format'](_0xff61('0x6d'));_0x22e1fa['queuecallerexitreason']='FORWARDTRANSFER';_0x22e1fa['transfer']=!![];_0x22e1fa[_0xff61('0x92')]=_0xff61('0x93');_0x22e1fa[_0xff61('0x94')]=_0x4398bb[_0xff61('0x95')];_0x22e1fa[_0xff61('0x96')]=_0x4398bb[_0xff61('0x47')];logger['info'](_0xff61('0x97'),_0x22e1fa[_0xff61('0x49')],_0x22e1fa['type']);var _0x51f0f1=this[_0xff61('0xc')][_0x4398bb[_0xff61('0x8e')]];this[_0xff61('0xc')][_0x4398bb[_0xff61('0x8e')]]=this['queueReports'][_0x4398bb[_0xff61('0x47')]];this['queueReports'][_0x4398bb[_0xff61('0x47')]]=_0x51f0f1;}}else{_0x56af2d[_0xff61('0x4d')]=_0xff61('0x98')+_0x4398bb['reason'][_0xff61('0x99')]();logger['info'](_0xff61('0x9a'),_0x56af2d[_0xff61('0x49')],_0x56af2d['type'],_0x56af2d[_0xff61('0x4d')]);}}}this[_0xff61('0xf')][_0x4398bb[_0xff61('0x47')]]=_0x56af2d;}}}catch(_0x2f12cb){logger[_0xff61('0x3a')](_0xff61('0x9b'),_0x4398bb['uniqueid'],util['inspect'](_0x2f12cb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x1f')]=function(_0x4a1775){try{if(this[_0xff61('0x53')](_0x4a1775)){logger[_0xff61('0x44')]('[%s][voiceQueueReport][varset]',_0x4a1775[_0xff61('0x47')],util['inspect'](_0x4a1775,{'showHidden':![],'depth':null}));this['addVariable'](_0x4a1775[_0xff61('0x47')],_[_0xff61('0x72')](_0x4a1775[_0xff61('0x9c')])[0x0],_0x4a1775['value']);if(this[_0xff61('0xc')][_0x4a1775[_0xff61('0x47')]]){var _0x1d0503=_[_0xff61('0x7c')](this[_0xff61('0xc')][_0x4a1775[_0xff61('0x47')]]);if(_0x1d0503){if(this[_0xff61('0x53')](_0x4a1775[_0xff61('0x9c')])&&this['isNotNull'](_0x4a1775['variable'][_0xff61('0x57')])){switch(_0x4a1775[_0xff61('0x9d')]){case _0xff61('0x9e'):_0x1d0503[_0xff61('0x32')]=![];_0x1d0503['queuecallerexitAt']=null;break;case _0xff61('0x9f'):_0x1d0503[_0xff61('0xa0')]='timeout';_0x1d0503[_0xff61('0x32')]=!![];_0x1d0503[_0xff61('0x87')]=moment()[_0xff61('0x4e')](_0xff61('0x6d'));_0x1d0503[_0xff61('0x7d')]=moment()[_0xff61('0x4e')](_0xff61('0x6d'));logger[_0xff61('0x44')](_0xff61('0xa1'),_0x4a1775[_0xff61('0x47')],util[_0xff61('0x3b')](_0x1d0503,{'showHidden':![],'depth':null}));ami[_0xff61('0x43')](_0xff61('0xa2'),_0x1d0503);break;default:_0x1d0503[_0xff61('0x32')]=!![];_0x1d0503['queuecallerexitAt']=moment()[_0xff61('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d0503[_0xff61('0x7d')]=moment()['format'](_0xff61('0x6d'));}_0x1d0503[_0xff61('0x1a')]=![];_0x1d0503[_0xff61('0x76')]=null;_0x1d0503[_0xff61('0x4d')]=_0x4a1775[_0xff61('0x9d')];this[_0xff61('0xf')][_0x4a1775['uniqueid']]=_0x1d0503;this[_0xff61('0xa3')](_0x1d0503,_0xff61('0xa4'));}else if(this[_0xff61('0x53')](_0x4a1775[_0xff61('0x9c')])&&this[_0xff61('0x53')](_0x4a1775['variable'][_0xff61('0xa5')])){if(!_0x1d0503[_0xff61('0x1a')]){_0x1d0503[_0xff61('0x32')]=!![];_0x1d0503[_0xff61('0x87')]=moment()[_0xff61('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x1d0503[_0xff61('0x4d')]=_0xff61('0xa6');_0x1d0503[_0xff61('0x7d')]=moment()[_0xff61('0x4e')](_0xff61('0x6d'));this['channels'][_0x4a1775[_0xff61('0x47')]]=_0x1d0503;}}logger[_0xff61('0x78')](_0xff61('0xa7'),_0x4a1775[_0xff61('0x47')],_0x1d0503[_0xff61('0x49')],_0x1d0503[_0xff61('0x5f')],_[_0xff61('0x72')](_0x4a1775[_0xff61('0x9c')])[0x0],_0x4a1775[_0xff61('0x9d')]);_0x1d0503[_0xff61('0x11')]=this[_0xff61('0x11')][_0x4a1775[_0xff61('0x47')]];}}}}catch(_0x24d23b){logger['error'](_0xff61('0xa8'),_0x4a1775[_0xff61('0x47')],util[_0xff61('0x3b')](_0x24d23b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xff61('0xa9')]=function(_0x11118c,_0x211fb1,_0x1787d5){var _0x4668fc=[_0xff61('0xaa'),_0xff61('0xab'),_0xff61('0xac'),'rtpaudioqosjitterbridged',_0xff61('0xad'),_0xff61('0xae'),_0xff61('0xaf'),_0xff61('0xb0'),_0xff61('0xb1'),_0xff61('0xb2'),_0xff61('0xb3'),_0xff61('0xb4'),_0xff61('0xb5'),_0xff61('0xb6'),_0xff61('0xb7'),_0xff61('0xb8'),_0xff61('0x86'),'memberpenalty',_0xff61('0xb9')];if(!_[_0xff61('0xba')](_0x211fb1)&&!_[_0xff61('0xbb')](_0x4668fc,_0x211fb1)){if(_[_0xff61('0x6c')](this[_0xff61('0x11')][_0x11118c])){this[_0xff61('0x11')][_0x11118c]={};}this[_0xff61('0x11')][_0x11118c][_0x211fb1]=_0x1787d5;}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0xbc')]=function(_0x578cc8,_0x363b1f,_0x301561){try{var _0x37d147={};if(this[_0xff61('0xc')][_0x578cc8]){for(var _0x1595ac=0x0;_0x1595ac<this[_0xff61('0xc')][_0x578cc8][_0xff61('0xbd')];_0x1595ac+=0x1){_0x37d147=this[_0xff61('0xc')][_0x578cc8][_0x1595ac];var _0x442fa6=this[_0xff61('0x40')][_0x37d147['queue']];if(_0x442fa6){_0x442fa6[_0xff61('0xbe')]+=moment(_0x37d147[_0xff61('0x7d')])[_0xff61('0xbf')](_0x37d147['queuecallerjoinAt'],_0xff61('0x91'))||0x0;if(_0x301561&&_0x37d147[_0xff61('0x4d')]===_0xff61('0xc0')){_0x37d147[_0xff61('0x4d')]=_0xff61('0xc1');}if(_0x1595ac===this[_0xff61('0xc')][_0x578cc8]['length']-0x1){_0x442fa6[_0xff61('0xc2')]+=moment()[_0xff61('0xc3')](0x0)[_0xff61('0xbf')](_0x37d147[_0xff61('0x8f')],'seconds');if(hasCallerLeftTheQueue(_0x37d147)&&_0x37d147[_0xff61('0x4d')]!==_0xff61('0xc0')){_0x442fa6['total']+=0x1;}if(_0x37d147[_0xff61('0x82')]){_0x442fa6[_0xff61('0xc4')]+=0x1;_0x442fa6[_0xff61('0xc5')]+=moment()[_0xff61('0xc3')](0x0)['diff'](_0x37d147[_0xff61('0x7d')],_0xff61('0x91'));_0x37d147[_0xff61('0xc6')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37d147['queuecallerexit']=![];_0x37d147['queuecallerexitAt']=null;}if(_0x37d147[_0xff61('0x32')]&&_0x37d147[_0xff61('0x88')]!=!![]){_0x442fa6[_0xff61('0xc7')]+=0x1;_0x37d147[_0xff61('0xa0')]=_0xff61('0xc7');logger['debug'](_0xff61('0xc8'),_0x578cc8,util[_0xff61('0x3b')](_0x37d147,{'showHidden':![],'depth':null}));ami['emit']('custom:queuecallerunmanaged',_0x37d147);}if(_0x37d147['queuecallerabandon']){_0x442fa6[_0xff61('0xc9')]+=0x1;_0x37d147[_0xff61('0xa0')]=_0xff61('0xc9');logger[_0xff61('0x44')](_0xff61('0xca'),_0x578cc8,util[_0xff61('0x3b')](_0x37d147,{'showHidden':![],'depth':null}));ami['emit'](_0xff61('0xcb'),_0x37d147);}}else{_0x442fa6['sumDuration']+=_0x442fa6['sumHoldTime'];}logger[_0xff61('0x78')](_0xff61('0xcc'),_0x578cc8,_0x37d147['queue'],_0x37d147['type'],_0x363b1f);this[_0xff61('0xf')][_0x578cc8]=_0x37d147;Object[_0xff61('0x5c')](this[_0xff61('0x40')][_0x37d147[_0xff61('0x49')]],_0x442fa6);if(_0x37d147['queuecallerleaveAt']){this[_0xff61('0xa3')](_0x37d147,_0xff61('0x20'));}}}logger[_0xff61('0x44')](_0xff61('0xcd'),_0x578cc8,util[_0xff61('0x3b')](this[_0xff61('0xc')][_0x578cc8],{'showHidden':![],'depth':null}));if(hasCallerLeftTheQueue(_0x37d147)&&_0x37d147['queuecallerexitreason']!==_0xff61('0xc0')){ami[_0xff61('0x43')](_0xff61('0xce'),this[_0xff61('0xc')][_0x578cc8]);if(this['queueReports'][_0x578cc8]){delete this['queueReports'][_0x578cc8];}if(this[_0xff61('0xf')][_0x578cc8]){delete this[_0xff61('0xf')][_0x578cc8];}if(this['variables'][_0x578cc8]){delete this[_0xff61('0x11')][_0x578cc8];}}}}catch(_0x442ecf){logger[_0xff61('0x3a')]('[%s][voiceQueueReport][handleHangup]',_0x578cc8,util[_0xff61('0x3b')](_0x442ecf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0x21')]=function(_0x7701ab){try{if(this[_0xff61('0x53')](_0x7701ab)){logger['debug'](_0xff61('0xcf'),_0x7701ab[_0xff61('0x47')],util[_0xff61('0x3b')](_0x7701ab,{'showHidden':![],'depth':null}));if(this[_0xff61('0xc')][_0x7701ab[_0xff61('0x47')]]){return this['handleHangup'](_0x7701ab[_0xff61('0x47')],_0x7701ab[_0xff61('0xd0')],![]);}if(this[_0xff61('0xc')][_0x7701ab['linkedid']]){if(_0x7701ab[_0xff61('0xd1')]==='21'){return;}return this[_0xff61('0xbc')](_0x7701ab[_0xff61('0x8e')],_0x7701ab[_0xff61('0xd0')],!![]);}var _0x973790=Object['keys'](this['queueReports']);for(var _0x236abd=0x0;_0x236abd<_0x973790['length'];_0x236abd++){var _0x467065=_['last'](this[_0xff61('0xc')][_0x973790[_0x236abd]]);if(_0x467065&&_0x467065[_0xff61('0xd2')]===_0x7701ab[_0xff61('0x47')]){return this[_0xff61('0xbc')](_0x467065[_0xff61('0x47')],_0x7701ab[_0xff61('0xd0')],!![]);}}if(!this[_0xff61('0xc')][_0x7701ab[_0xff61('0x47')]]){logger['debug'](_0xff61('0xd3'),_0x7701ab[_0xff61('0x47')]);if(this[_0xff61('0xf')][_0x7701ab[_0xff61('0x47')]]){delete this[_0xff61('0xf')][_0x7701ab[_0xff61('0x47')]];}if(this['variables'][_0x7701ab['uniqueid']]){delete this['variables'][_0x7701ab['uniqueid']];}}}}catch(_0x542add){logger[_0xff61('0x3a')](_0xff61('0xcf'),_0x7701ab['uniqueid'],util[_0xff61('0x3b')](_0x542add,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0xd4')]=function(_0x29877c){try{if(this[_0xff61('0x53')](_0x29877c)){logger[_0xff61('0x44')](_0xff61('0xd5'),_0x29877c[_0xff61('0x47')],util[_0xff61('0x3b')](_0x29877c,{'showHidden':![],'depth':null}));var _0x398d3e;var _0x1e4d45;var _0x27b94d;if(this[_0xff61('0xc')][_0x29877c[_0xff61('0xd6')]]){_0x398d3e=_['last'](this['queueReports'][_0x29877c[_0xff61('0xd6')]]);_0x398d3e['transferexten']=_0x29877c[_0xff61('0xd7')];_0x398d3e[_0xff61('0x96')]=_0x29877c[_0xff61('0xd8')];_0x398d3e[_0xff61('0x4d')]=_0xff61('0xc0');_0x398d3e['transfer']=!![];_0x398d3e[_0xff61('0x92')]=_0xff61('0xd9');if(this[_0xff61('0xc')][_0x29877c['secondtransfereruniqueid']]){_0x27b94d=this[_0xff61('0xc')][_0x29877c[_0xff61('0xd8')]];this[_0xff61('0xc')][_0x29877c[_0xff61('0xd8')]]=this[_0xff61('0xc')][_0x29877c[_0xff61('0xd6')]];this[_0xff61('0xc')][_0x29877c['transfereeuniqueid']]=_0x27b94d;_0x1e4d45=_[_0xff61('0x7c')](this[_0xff61('0xc')][_0x29877c[_0xff61('0xd6')]]);_0x1e4d45[_0xff61('0x34')]=!![];}logger[_0xff61('0x78')](_0xff61('0xda'),_0x29877c['uniqueid'],_0x398d3e['queue'],_0x398d3e[_0xff61('0x5f')],_0x398d3e['transferexten'],_0x398d3e[_0xff61('0x96')]);}else if(this[_0xff61('0xc')][_0x29877c[_0xff61('0xdb')]]){_0x398d3e=_[_0xff61('0x7c')](this['queueReports'][_0x29877c[_0xff61('0xdb')]]);_0x398d3e[_0xff61('0x94')]=_0x29877c[_0xff61('0xdc')];_0x398d3e[_0xff61('0x96')]=_0x29877c[_0xff61('0xdd')];_0x398d3e[_0xff61('0x4d')]=_0xff61('0xc0');_0x398d3e[_0xff61('0x88')]=!![];_0x398d3e[_0xff61('0x92')]=_0xff61('0xd9');if(this[_0xff61('0xc')][_0x29877c[_0xff61('0xdd')]]){_0x27b94d=this[_0xff61('0xc')][_0x29877c[_0xff61('0xdd')]];this[_0xff61('0xc')][_0x29877c['origtransfereruniqueid']]=this[_0xff61('0xc')][_0x29877c[_0xff61('0xdb')]];this['queueReports'][_0x29877c['transfertargetuniqueid']]=_0x27b94d;_0x1e4d45=_[_0xff61('0x7c')](this['queueReports'][_0x29877c['transfertargetuniqueid']]);_0x1e4d45[_0xff61('0x34')]=!![];}logger['info'](_0xff61('0xda'),_0x29877c[_0xff61('0x47')],_0x398d3e[_0xff61('0x49')],_0x398d3e[_0xff61('0x5f')],_0x398d3e['transferexten'],_0x398d3e[_0xff61('0x96')]);}else if(this[_0xff61('0xc')][_0x29877c[_0xff61('0xdd')]]){_0x398d3e=_[_0xff61('0x7c')](this[_0xff61('0xc')][_0x29877c[_0xff61('0xdd')]]);_0x398d3e[_0xff61('0x94')]=_0x29877c[_0xff61('0xdc')];_0x398d3e[_0xff61('0x96')]=_0x29877c[_0xff61('0xdd')];_0x398d3e['queuecallerexitreason']=_0xff61('0xc0');_0x398d3e['transfer']=!![];_0x398d3e[_0xff61('0x92')]=_0xff61('0xd9');_0x398d3e[_0xff61('0x34')]=!![];_0x398d3e['transferid']=_0x29877c[_0xff61('0xd6')];}else if(this['queueReports'][_0x29877c['secondtransfereruniqueid']]){_0x398d3e=_['last'](this[_0xff61('0xc')][_0x29877c[_0xff61('0xd8')]]);_0x398d3e[_0xff61('0x94')]=_0x29877c[_0xff61('0xd7')];_0x398d3e[_0xff61('0x96')]=_0x29877c[_0xff61('0xd8')];_0x398d3e[_0xff61('0x4d')]=_0xff61('0xc0');_0x398d3e[_0xff61('0x88')]=!![];_0x398d3e[_0xff61('0x92')]='ATTENDED';_0x398d3e[_0xff61('0x34')]=!![];_0x398d3e['transferid']=_0x29877c[_0xff61('0xdb')];}}}catch(_0x5a115c){logger[_0xff61('0x3a')](_0xff61('0xd5'),_0x29877c[_0xff61('0x47')],util[_0xff61('0x3b')](_0x5a115c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')]['syncBlindTransfer']=function(_0x2bce5f){try{if(this['isNotNull'](_0x2bce5f)){logger[_0xff61('0x44')]('[%s][voiceQueueReport][blindtransfer]',_0x2bce5f[_0xff61('0x47')],util['inspect'](_0x2bce5f,{'showHidden':![],'depth':null}));if(this[_0xff61('0xc')][_0x2bce5f[_0xff61('0xd6')]]){var _0x26c621=_[_0xff61('0x7c')](this['queueReports'][_0x2bce5f['transfereeuniqueid']]);_0x26c621[_0xff61('0x4d')]='BLINDTRANSFER';_0x26c621[_0xff61('0x88')]=!![];_0x26c621[_0xff61('0x92')]=_0xff61('0xde');_0x26c621[_0xff61('0x94')]=_0x2bce5f['extension'];_0x26c621[_0xff61('0x96')]=_0x2bce5f[_0xff61('0xd6')];logger[_0xff61('0x78')](_0xff61('0xdf'),_0x2bce5f[_0xff61('0x47')],_0x26c621[_0xff61('0x49')],_0x26c621[_0xff61('0x5f')],_0x26c621[_0xff61('0x94')],_0x26c621[_0xff61('0x96')]);this[_0xff61('0x21')]({'event':'BlindTransfer','uniqueid':_0x2bce5f['transfereeuniqueid'],'context':_0x2bce5f['context'],'channel':_0x2bce5f['transfererchannel']});}}}catch(_0x44fe3b){logger[_0xff61('0x3a')]('[%s][voiceQueueReport][blindtransfer]',_0x2bce5f['uniqueid'],util[_0xff61('0x3b')](_0x44fe3b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncMusicOnHoldStart']=function(_0x869c4c){try{if(this[_0xff61('0x53')](_0x869c4c)){logger[_0xff61('0x44')](_0xff61('0xe0'),_0x869c4c[_0xff61('0x47')],util[_0xff61('0x3b')](_0x869c4c,{'showHidden':![],'depth':null}));if(this[_0xff61('0xc')][_0x869c4c['uniqueid']]){var _0x582d67=_[_0xff61('0x7c')](this['queueReports'][_0x869c4c[_0xff61('0x47')]]);if(!_[_0xff61('0xba')](_0x582d67[_0xff61('0x7d')])){_0x582d67[_0xff61('0xe1')]=moment()[_0xff61('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xff61('0x78')](_0xff61('0xe2'),_0x869c4c[_0xff61('0x47')],_0x582d67[_0xff61('0xe1')]);}}}}catch(_0x259ba8){logger[_0xff61('0x3a')](_0xff61('0xe0'),_0x869c4c['uniqueid'],util[_0xff61('0x3b')](_0x259ba8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')]['syncMusicOnHoldStop']=function(_0x2dc41c){try{if(this[_0xff61('0x53')](_0x2dc41c)){logger[_0xff61('0x44')](_0xff61('0xe3'),_0x2dc41c[_0xff61('0x47')],util[_0xff61('0x3b')](_0x2dc41c,{'showHidden':![],'depth':null}));if(this[_0xff61('0xc')][_0x2dc41c[_0xff61('0x47')]]){var _0x530bee=_[_0xff61('0x7c')](this[_0xff61('0xc')][_0x2dc41c[_0xff61('0x47')]]);if(!_[_0xff61('0xba')](_0x530bee[_0xff61('0xe1')])){_0x530bee[_0xff61('0xe4')]+=moment()[_0xff61('0xc3')](0x0)[_0xff61('0xbf')](_0x530bee[_0xff61('0xe1')],_0xff61('0x91'));logger[_0xff61('0x78')](_0xff61('0xe5'),_0x2dc41c['uniqueid'],_0x530bee[_0xff61('0xe4')]);delete _0x530bee['mohstarttime'];}}}}catch(_0x33f61e){logger[_0xff61('0x3a')](_0xff61('0xe3'),_0x2dc41c[_0xff61('0x47')],util[_0xff61('0x3b')](_0x33f61e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xff61('0x3e')][_0xff61('0xe6')]=function(_0x5d4711){try{if(this[_0xff61('0x53')](_0x5d4711)){logger[_0xff61('0x44')](_0xff61('0xe7'),_0x5d4711['uniqueid'],util[_0xff61('0x3b')](_0x5d4711,{'showHidden':![],'depth':null}));if(_0x5d4711[_0xff61('0xe8')][_0xff61('0x8d')]()===_0xff61('0xe9')){_0x5d4711['applicationdata']=_0x5d4711[_0xff61('0xea')]&&_0x5d4711[_0xff61('0xea')]['startsWith']('CDR(routeAlias)')?_0x5d4711['appdata']:(_0x5d4711[_0xff61('0xea')]||_0x5d4711[_0xff61('0xeb')])[_0xff61('0x8d')]();if(_[_0xff61('0x8b')](_0x5d4711[_0xff61('0xeb')][_0xff61('0x8d')](),_0xff61('0xec'))){logger[_0xff61('0x78')](_0xff61('0xed'),_0x5d4711[_0xff61('0x47')],_0x5d4711[_0xff61('0xe8')],_0x5d4711[_0xff61('0xeb')]);if(_['isUndefined'](this['channels'][_0x5d4711['uniqueid']]))this['channels'][_0x5d4711[_0xff61('0x47')]]={};var _0x36cf3f=_0x5d4711[_0xff61('0xeb')]['split']('=');var _0x3acdab=_0x36cf3f[0x0][_0xff61('0x8d')]()['match'](/cdr\((.*)\)/);if(_0x3acdab)this[_0xff61('0xf')][_0x5d4711['uniqueid']][_0x3acdab[0x1]]=_0x36cf3f[0x1];}}}}catch(_0x15f318){logger[_0xff61('0x3a')](_0xff61('0xee'),_0x5d4711[_0xff61('0x47')],util[_0xff61('0x3b')](_0x15f318,{'showHidden':![],'depth':null}));}};module[_0xff61('0xef')]=VoiceQueueReport;
\ No newline at end of file
+var _0x5e0d=['[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallerleave','syncAgentConnect','[%s][voiceQueueReport][agentconnect]','queuecallercomplete','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','last','membername','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','seconds','FORWARDTRANSFER','transfertype','FORWARD','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','syncVarSet','[%s][voiceQueueReport][varset]','variable','CONTINUE','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','value','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','keys','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','includes','COMPLETEDBYAGENT','length','milliseconds','diff','ATTENDEDTRANSFER','total','unmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','sumDuration','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','handleHangup','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transfereeuniqueid','transferexten','secondtransfererexten','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','origtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','syncNewExten','set','applicationdata','appdata','CDR(routeAlias)','cdr(','application','split','match','exports','lodash','moment','ioredis','../../../config/environment','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','localhost','socket.io-emitter','prototype','enqueue','tail','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','queuestatuscomplete','syncQueueStatusComplete','syncQueueCallerJoin','queuecallerabandon','agentcomplete','syncAgentComplete','agentconnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','unlockRR','queuecallerexit','clearZombieChannels','switch','isNil','Action','status','channel','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','summary','clearqueuereport','emit','debug','[%s][voiceQueueReport][','format','voice:queue:%s','queue','voice_queue_presence:save','emitVoiceQueueChannelRemove',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','voice_queue_presence:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','catch','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','queues','summaryEvent','handleInboundQueueSummaryReport','createQueueSummaryReport','compareToInboundQueue','assign','type','outbound','custom:queuesummary','statusRequests','completeEvent','syncQueueMember','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','routealias','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','pick','push','emitVoiceQueueChannelSave','queuecallerjoin','[%s][voiceQueueReport][queuecallerabandon]','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo'];(function(_0x5b7ab6,_0x131209){var _0x2b5c7f=function(_0x4d638e){while(--_0x4d638e){_0x5b7ab6['push'](_0x5b7ab6['shift']());}};_0x2b5c7f(++_0x131209);}(_0x5e0d,0x6d));var _0xd5e0=function(_0x35b18a,_0x6b2fbe){_0x35b18a=_0x35b18a-0x0;var _0x4db1bd=_0x5e0d[_0x35b18a];return _0x4db1bd;};'use strict';var _=require(_0xd5e0('0x0'));var moment=require(_0xd5e0('0x1'));var util=require('util');var Redis=require(_0xd5e0('0x2'));var config=require(_0xd5e0('0x3'));var logger=require('../../../config/logger')(_0xd5e0('0x4'));var ami=require(_0xd5e0('0x5'));var QueueReport=require(_0xd5e0('0x6'));var VoiceQueueSummary=require(_0xd5e0('0x7'));config[_0xd5e0('0x8')]=_['defaults'](config[_0xd5e0('0x8')],{'host':_0xd5e0('0x9'),'port':0x18eb});var io=require(_0xd5e0('0xa'))(new Redis(config[_0xd5e0('0x8')]));var Sequence=function(){};Sequence[_0xd5e0('0xb')][_0xd5e0('0xc')]=function(_0x2a8b0c){this['tail']=this[_0xd5e0('0xd')]?this[_0xd5e0('0xd')]['finally'](_0x2a8b0c):_0x2a8b0c();};function VoiceQueueReport(_0x32a6e9){this[_0xd5e0('0xe')]=new Sequence();this[_0xd5e0('0xf')]={};this[_0xd5e0('0x10')]=_0x32a6e9;this[_0xd5e0('0x11')]=_0x32a6e9[_0xd5e0('0x11')];this[_0xd5e0('0x12')]=_0x32a6e9[_0xd5e0('0x13')];this['voiceQueues']=_0x32a6e9[_0xd5e0('0x14')];this[_0xd5e0('0x15')]=_0x32a6e9['campaigns'];this['summary']=initializeSummary();this[_0xd5e0('0x16')]={};ami['on'](_0xd5e0('0x17'),this[_0xd5e0('0x18')]['bind'](this));ami['on'](_0xd5e0('0x19'),this[_0xd5e0('0x1a')][_0xd5e0('0x1b')](this));ami['on'](_0xd5e0('0x1c'),this['syncQueueMember'][_0xd5e0('0x1b')](this));ami['on'](_0xd5e0('0x1d'),this[_0xd5e0('0x1e')][_0xd5e0('0x1b')](this));ami['on']('queuecallerjoin',this[_0xd5e0('0x1f')]['bind'](this));ami['on'](_0xd5e0('0x20'),this['syncQueueCallerAbandon'][_0xd5e0('0x1b')](this));ami['on']('queuecallerleave',this['syncQueueCallerLeave'][_0xd5e0('0x1b')](this));ami['on'](_0xd5e0('0x21'),this[_0xd5e0('0x22')]['bind'](this));ami['on'](_0xd5e0('0x23'),this['syncAgentConnect'][_0xd5e0('0x1b')](this));ami['on'](_0xd5e0('0x24'),this['syncVarSet'][_0xd5e0('0x1b')](this));ami['on'](_0xd5e0('0x25'),this[_0xd5e0('0x26')]['bind'](this));ami['on'](_0xd5e0('0x27'),this[_0xd5e0('0x28')][_0xd5e0('0x1b')](this));ami['on'](_0xd5e0('0x29'),this[_0xd5e0('0x2a')][_0xd5e0('0x1b')](this));ami['on'](_0xd5e0('0x2b'),this[_0xd5e0('0x2c')]['bind'](this));ami['on']('attendedtransfer',this[_0xd5e0('0x2d')]['bind'](this));ami['on']('blindtransfer',this[_0xd5e0('0x2e')][_0xd5e0('0x1b')](this));this[_0xd5e0('0x2f')]();this[_0xd5e0('0x30')]();}function clearChannels(_0x4329df){if(!_[_0xd5e0('0x31')](_0x4329df)){for(var _0x2342e2 in _0x4329df){if(_0x4329df[_0xd5e0('0x32')](_0x2342e2)){delete _0x4329df[_0x2342e2];}}}}function clearCampaigns(_0x48b81c){if(!_[_0xd5e0('0x31')](_0x48b81c)){for(var _0x281f0c in _0x48b81c){if(_0x48b81c[_0xd5e0('0x32')](_0x281f0c)){_0x48b81c[_0x281f0c][_0xd5e0('0x33')]=0x0;}}}}function clearVoiceQueues(_0x34768e){if(!_['isEmpty'](_0x34768e)){for(var _0xe23135 in _0x34768e){if(_0x34768e['hasOwnProperty'](_0xe23135)){_0x34768e[_0xe23135][_0xd5e0('0x33')]=0x0;_0x34768e[_0xe23135][_0xd5e0('0x34')]=0x0;_0x34768e[_0xe23135][_0xd5e0('0x35')]=0x0;_0x34768e[_0xe23135][_0xd5e0('0x36')]=0x0;_0x34768e[_0xe23135]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x52138a){if(!_[_0xd5e0('0x31')](_0x52138a)){for(var _0x567efa in _0x52138a){if(_0x52138a[_0xd5e0('0x32')](_0x567efa)){_0x52138a[_0x567efa][_0xd5e0('0x37')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x54d521){return _0x54d521[_0xd5e0('0x38')]||_0x54d521[_0xd5e0('0x20')]||_0x54d521['queuecallercomplete'];}VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x39')]=function(){var _0x3a7f1c=this;for(var _0x547afc in this['channels']){if(this[_0xd5e0('0x12')]['hasOwnProperty'](_0x547afc)&&!this[_0xd5e0('0x12')][_0x547afc][_0xd5e0('0x3a')]){this[_0xd5e0('0xe')][_0xd5e0('0xc')](function(){if(!_[_0xd5e0('0x3b')](_0x3a7f1c[_0xd5e0('0x12')][_0x547afc])){return ami[_0xd5e0('0x3c')]({'action':_0xd5e0('0x3d'),'channel':_0x3a7f1c[_0xd5e0('0x12')][_0x547afc][_0xd5e0('0x3e')]})['catch'](function(_0x29895c){if(_0x29895c[_0xd5e0('0x3f')]===_0xd5e0('0x40')){setTimeout(function(){if(_0x3a7f1c[_0xd5e0('0x12')][_0x547afc]){delete _0x3a7f1c[_0xd5e0('0x12')][_0x547afc];logger[_0xd5e0('0x41')]('[%s][voiceQueueReport][checkChannel]',_0x547afc,util[_0xd5e0('0x42')](_0x29895c,{'showHidden':![],'depth':null}));}if(_0x3a7f1c[_0xd5e0('0xf')][_0x547afc]){delete _0x3a7f1c['queueReports'][_0x547afc];logger[_0xd5e0('0x41')](_0xd5e0('0x43'),_0x547afc,util[_0xd5e0('0x42')](_0x29895c,{'showHidden':![],'depth':null}));}if(_0x3a7f1c['variables'][_0x547afc]){delete _0x3a7f1c['variables'][_0x547afc];logger['error'](_0xd5e0('0x44'),_0x547afc,util[_0xd5e0('0x42')](_0x29895c,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x28')]=function(){logger[_0xd5e0('0x41')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this['channels']);this[_0xd5e0('0x45')](this[_0xd5e0('0xf')]);clearAgentBooked(this[_0xd5e0('0x11')]);clearVoiceQueues(this[_0xd5e0('0x14')]);clearCampaigns(this[_0xd5e0('0x15')]);this[_0xd5e0('0x46')]=initializeSummary();};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x45')]=function(_0x294c6d){var _0x53e702=this;if(!_['isEmpty'](_0x294c6d)){for(var _0x15c85d in _0x294c6d){if(_0x294c6d[_0xd5e0('0x32')](_0x15c85d)){_0x53e702['emitVoiceQueueChannelRemove'](_0x294c6d[_0x15c85d],_0xd5e0('0x47'));delete _0x294c6d[_0x15c85d];}}}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x48')]=function(_0x55e7a2,_0x595c6e,_0x168fee){io['to'](_0x55e7a2)['emit'](_0x595c6e,_0x168fee);};VoiceQueueReport[_0xd5e0('0xb')]['emitVoiceQueueChannelSave']=function(_0x2820de,_0x10f19f){logger[_0xd5e0('0x49')](_0xd5e0('0x4a')+_0x10f19f+']\x20sending\x20voice_queue_channel:save\x20event:',_0x2820de['uniqueid'],util['inspect'](_0x2820de,{'showHidden':![],'depth':null}));this[_0xd5e0('0x48')](util[_0xd5e0('0x4b')](_0xd5e0('0x4c'),_0x2820de[_0xd5e0('0x4d')]),'voice_queue_channel:save',_0x2820de);io[_0xd5e0('0x48')](_0xd5e0('0x4e'),_0x2820de);};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x4f')]=function(_0x4b5a6d,_0x3ba35a){logger[_0xd5e0('0x49')](_0xd5e0('0x4a')+_0x3ba35a+_0xd5e0('0x50'),_0x4b5a6d['uniqueid'],util[_0xd5e0('0x42')](_0x4b5a6d,{'showHidden':![],'depth':null}));if(_0x4b5a6d[_0xd5e0('0x51')]==='ATTENDEDTRANSFER'){return;}this[_0xd5e0('0x48')](util[_0xd5e0('0x4b')]('voice:queue:%s',_0x4b5a6d[_0xd5e0('0x4d')]),'voice_queue_channel:remove',_0x4b5a6d);io[_0xd5e0('0x48')](_0xd5e0('0x52'),_0x4b5a6d);};VoiceQueueReport['prototype'][_0xd5e0('0x53')]=function(_0x285d8e){if(_0x285d8e['type']===_0xd5e0('0x54')){logger[_0xd5e0('0x49')](_0xd5e0('0x55'),util[_0xd5e0('0x42')](_0x285d8e,{'showHidden':![],'depth':null}));this[_0xd5e0('0x48')](util[_0xd5e0('0x4b')](_0xd5e0('0x4c'),_0x285d8e[_0xd5e0('0x56')]),_0xd5e0('0x57'),_0x285d8e);}};VoiceQueueReport['prototype'][_0xd5e0('0x58')]=function(_0x43dc3e){return _0x43dc3e!==null&&!_[_0xd5e0('0x59')](_0x43dc3e);};VoiceQueueReport[_0xd5e0('0xb')]['loopQueueShow']=function(){var _0x968132=this;setInterval(function(){_0x968132[_0xd5e0('0x39')]();ami[_0xd5e0('0x3c')]({'action':'queues'})[_0xd5e0('0x5a')](function(_0x2fba5c){logger[_0xd5e0('0x41')]('[voiceQueueReport][queues]',util[_0xd5e0('0x42')](_0x2fba5c,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x2f')]=function(){var _0x35b4f4=this;setInterval(function(){if(!_0x35b4f4['summary'][_0xd5e0('0x5b')]){return ami[_0xd5e0('0x3c')]({'action':_0xd5e0('0x17')})[_0xd5e0('0x5c')](function(_0x536dde){_0x35b4f4[_0xd5e0('0x46')]['id']=_0x536dde[_0xd5e0('0x5d')];_0x35b4f4[_0xd5e0('0x46')][_0xd5e0('0x5b')]=!![];_0x35b4f4['summary'][_0xd5e0('0x5e')][_0x536dde['actionid']]={};})['catch'](function(_0x1dfea9){logger['error'](_0xd5e0('0x5f'),util[_0xd5e0('0x42')](_0x1dfea9,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xd5e0('0xb')]['createQueueSummaryReport']=function(_0x507b54,_0x300262){var _0x2f8c9b;if(this[_0xd5e0('0x46')]&&this[_0xd5e0('0x46')][_0xd5e0('0x60')]&&this[_0xd5e0('0x46')][_0xd5e0('0x60')][_0x507b54[_0xd5e0('0x56')]]){_0x2f8c9b=this[_0xd5e0('0x46')]['queues'][_0x507b54[_0xd5e0('0x56')]][_0xd5e0('0x61')];}var _0x492345=new VoiceQueueSummary(_0x507b54);return _0x492345['createReport'](_0x300262[_0xd5e0('0x11')],this[_0xd5e0('0x11')],_0x2f8c9b,this['realtime']['channels']);};VoiceQueueReport['prototype'][_0xd5e0('0x62')]=function(_0x31d410,_0x3dda6a){var _0x11c259=this[_0xd5e0('0x63')](_0x31d410,_0x3dda6a);var _0x6dad8c=![];_0x6dad8c=_0x11c259[_0xd5e0('0x64')](_0x31d410);if(_0x6dad8c){Object[_0xd5e0('0x65')](_0x31d410,_0x11c259);this[_0xd5e0('0x10')]['voiceQueues'][_0x31d410['name']]=_0x31d410;this[_0xd5e0('0x53')](_0x11c259);}};VoiceQueueReport['prototype'][_0xd5e0('0x1e')]=function(_0x36fdb6){var _0x47cb83=null;var _0xf676f8=this[_0xd5e0('0x46')]['id'];if(this[_0xd5e0('0x46')][_0xd5e0('0x5e')][_0xf676f8]){_0x47cb83=this[_0xd5e0('0x46')][_0xd5e0('0x5e')][_0xf676f8][_0x36fdb6[_0xd5e0('0x5d')]];}if(!_0x47cb83){this['summary']=initializeSummary();return;}var _0x3df148=this[_0xd5e0('0x14')][_0x47cb83['queue']];if(_0x3df148[_0xd5e0('0x66')]==='inbound'){this[_0xd5e0('0x62')](_0x3df148,_0x47cb83);}else if(_0x3df148[_0xd5e0('0x66')]===_0xd5e0('0x67')){var _0xcd73b8=this[_0xd5e0('0x63')](_0x3df148,_0x47cb83);ami[_0xd5e0('0x48')](_0xd5e0('0x68'),_0xcd73b8);}this[_0xd5e0('0x46')][_0xd5e0('0x69')]-=0x1;var _0x54aa96=this[_0xd5e0('0x46')][_0xd5e0('0x69')]>0x0?!![]:![];if(!_0x54aa96){return this[_0xd5e0('0x1a')](this[_0xd5e0('0x46')][_0xd5e0('0x6a')]);}};VoiceQueueReport['prototype'][_0xd5e0('0x6b')]=function(_0x5c05f0){var _0x4f8640=this[_0xd5e0('0x46')]['id'];if(this[_0xd5e0('0x46')]['queuestatus'][_0x4f8640]&&this['summary'][_0xd5e0('0x5e')][_0x4f8640][_0x5c05f0[_0xd5e0('0x5d')]]){this[_0xd5e0('0x46')][_0xd5e0('0x5e')][_0x4f8640][_0x5c05f0[_0xd5e0('0x5d')]][_0xd5e0('0x11')]['push'](_0x5c05f0);}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x18')]=function(_0x4fd7ec){var _0x236f90=this;try{if(this['isNotNull'](_0x4fd7ec)&&this[_0xd5e0('0x58')](_0x4fd7ec['queue'])){logger[_0xd5e0('0x49')](_0xd5e0('0x6c'),util[_0xd5e0('0x42')](_0x4fd7ec,{'showHidden':![],'depth':null}));var _0x2b62b3=this['voiceQueues'][_0x4fd7ec[_0xd5e0('0x4d')]];if(_0x2b62b3){logger[_0xd5e0('0x49')](_0xd5e0('0x6d'),_0x2b62b3[_0xd5e0('0x56')]);this['summary'][_0xd5e0('0x60')][_0x2b62b3[_0xd5e0('0x56')]]={'summaryEvent':_0x4fd7ec};this['summary'][_0xd5e0('0x69')]+=0x1;return ami[_0xd5e0('0x3c')]({'action':_0xd5e0('0x5e'),'queue':_0x2b62b3[_0xd5e0('0x56')]})[_0xd5e0('0x5c')](function(_0x588ff4){if(!_0x236f90[_0xd5e0('0x46')][_0xd5e0('0x5e')][_0x4fd7ec[_0xd5e0('0x5d')]]){_0x236f90['summary'][_0xd5e0('0x5e')][_0x4fd7ec[_0xd5e0('0x5d')]]={};}_0x236f90[_0xd5e0('0x46')]['queuestatus'][_0x4fd7ec[_0xd5e0('0x5d')]][_0x588ff4[_0xd5e0('0x5d')]]={'queue':_0x2b62b3[_0xd5e0('0x56')],'agents':[]};})[_0xd5e0('0x5a')](function(_0x4ced76){throw _0x4ced76;});}}}catch(_0x12c254){logger['error'](_0xd5e0('0x5f'),util['inspect'](_0x12c254,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueSummaryComplete']=function(_0xbd1fe6){if(this[_0xd5e0('0x46')][_0xd5e0('0x69')]>0x0){this[_0xd5e0('0x46')][_0xd5e0('0x6a')]=_0xbd1fe6;return;}logger[_0xd5e0('0x49')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util['inspect'](_0xbd1fe6,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0xd5e0('0x48')](_0xd5e0('0x6e'),{});};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x1f')]=function(_0x4118a2){try{if(this[_0xd5e0('0x58')](_0x4118a2)){logger[_0xd5e0('0x49')](_0xd5e0('0x6f'),_0x4118a2[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x4118a2,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xd5e0('0xf')][_0x4118a2[_0xd5e0('0x70')]])){this[_0xd5e0('0xf')][_0x4118a2[_0xd5e0('0x70')]]=[];}if(_['isUndefined'](this[_0xd5e0('0x12')][_0x4118a2[_0xd5e0('0x70')]])){this[_0xd5e0('0x12')][_0x4118a2[_0xd5e0('0x70')]]={};}var _0x40f7d7=new QueueReport();_0x40f7d7[_0xd5e0('0x4d')]=_0x4118a2[_0xd5e0('0x4d')];_0x40f7d7[_0xd5e0('0x66')]=this[_0xd5e0('0x14')][_0x40f7d7[_0xd5e0('0x4d')]]&&this[_0xd5e0('0x14')][_0x40f7d7[_0xd5e0('0x4d')]][_0xd5e0('0x66')]?this[_0xd5e0('0x14')][_0x40f7d7[_0xd5e0('0x4d')]][_0xd5e0('0x66')]||_0xd5e0('0x54'):_0xd5e0('0x54');_0x40f7d7[_0xd5e0('0x71')]=moment()['format'](_0xd5e0('0x72'));_0x40f7d7['position']=_0x4118a2[_0xd5e0('0x73')];_0x40f7d7[_0xd5e0('0x74')]=_0x4118a2[_0xd5e0('0x74')];_0x40f7d7[_0xd5e0('0x70')]=_0x4118a2['uniqueid'];_0x40f7d7[_0xd5e0('0x75')]=this[_0xd5e0('0x12')][_0x4118a2[_0xd5e0('0x70')]][_0xd5e0('0x75')];logger[_0xd5e0('0x76')](_0xd5e0('0x77'),_0x40f7d7[_0xd5e0('0x4d')],_0x40f7d7['type']);Object[_0xd5e0('0x65')](_0x40f7d7,_[_0xd5e0('0x78')](_0x4118a2,_['keys'](_0x40f7d7)));this[_0xd5e0('0xf')][_0x4118a2[_0xd5e0('0x70')]][_0xd5e0('0x79')](_0x40f7d7);this['channels'][_0x4118a2[_0xd5e0('0x70')]]=_0x40f7d7;this[_0xd5e0('0x7a')](_0x40f7d7,_0xd5e0('0x7b'));}}catch(_0x38a87c){logger[_0xd5e0('0x41')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4118a2[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x38a87c,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')]['syncQueueCallerAbandon']=function(_0x45c65b){try{if(this[_0xd5e0('0x58')](_0x45c65b)){logger[_0xd5e0('0x49')](_0xd5e0('0x7c'),_0x45c65b[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x45c65b,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0x45c65b[_0xd5e0('0x70')]]){var _0x1e3dea=_['last'](this[_0xd5e0('0xf')][_0x45c65b[_0xd5e0('0x70')]]);_0x1e3dea['queuecallercomplete']=![];_0x1e3dea[_0xd5e0('0x7d')]=null;_0x1e3dea[_0xd5e0('0x7e')]=_0x45c65b['holdtime'];_0x1e3dea[_0xd5e0('0x7f')]=_0x45c65b['originalposition'];_0x1e3dea['queuecallerabandon']=!![];_0x1e3dea[_0xd5e0('0x80')]=moment()['format'](_0xd5e0('0x72'));_0x1e3dea[_0xd5e0('0x51')]=_0xd5e0('0x81');_0x1e3dea[_0xd5e0('0x82')]=null;logger['info'](_0xd5e0('0x83'),_0x1e3dea[_0xd5e0('0x4d')],_0x1e3dea[_0xd5e0('0x66')]);this[_0xd5e0('0x12')][_0x45c65b[_0xd5e0('0x70')]]=_0x1e3dea;this[_0xd5e0('0x4f')](_0x1e3dea,_0xd5e0('0x20'));}}}catch(_0x423fcf){logger[_0xd5e0('0x41')](_0xd5e0('0x7c'),_0x45c65b[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x423fcf,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x367927){try{if(this[_0xd5e0('0x58')](_0x367927)){logger[_0xd5e0('0x49')](_0xd5e0('0x84'),_0x367927['uniqueid'],util[_0xd5e0('0x42')](_0x367927,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0x367927[_0xd5e0('0x70')]]){var _0x4962af=_['last'](this[_0xd5e0('0xf')][_0x367927[_0xd5e0('0x70')]]);_0x4962af[_0xd5e0('0x85')]=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));_0x4962af[_0xd5e0('0x86')]=_0x367927[_0xd5e0('0x86')];_0x4962af[_0xd5e0('0x87')]=_0x367927[_0xd5e0('0x87')];logger[_0xd5e0('0x76')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x4962af[_0xd5e0('0x4d')],_0x4962af[_0xd5e0('0x66')],_0x367927['connectedlinenum'],_0x367927[_0xd5e0('0x87')]);this[_0xd5e0('0x12')][_0x367927[_0xd5e0('0x70')]]=_0x4962af;this[_0xd5e0('0x7a')](_0x4962af,_0xd5e0('0x88'));}}}catch(_0x35bcb9){logger[_0xd5e0('0x41')]('[%s][voiceQueueReport][queuecallerleave]',_0x367927['uniqueid'],util['inspect'](_0x35bcb9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x89')]=function(_0x126b18){try{if(this[_0xd5e0('0x58')](_0x126b18)){logger[_0xd5e0('0x49')](_0xd5e0('0x8a'),_0x126b18[_0xd5e0('0x70')],util['inspect'](_0x126b18,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x126b18[_0xd5e0('0x70')]]){var _0x448af1=_['last'](this[_0xd5e0('0xf')][_0x126b18['uniqueid']]);_0x448af1[_0xd5e0('0x8b')]=!![];_0x448af1['queuecallerexitreason']='COMPLETEDBYAGENT';logger[_0xd5e0('0x76')](_0xd5e0('0x8c'),_0x448af1[_0xd5e0('0x4d')],_0x448af1[_0xd5e0('0x66')]);}}}catch(_0x103e1a){logger[_0xd5e0('0x41')](_0xd5e0('0x8a'),_0x126b18['uniqueid'],util['inspect'](_0x103e1a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd5e0('0x22')]=function(_0x3414a7){try{if(this[_0xd5e0('0x58')](_0x3414a7)){logger['debug']('[%s][voiceQueueReport][agentcomplete]',_0x3414a7[_0xd5e0('0x70')],util['inspect'](_0x3414a7,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x70')]]){var _0xd9c05f=_[_0xd5e0('0x8d')](this['queueReports'][_0x3414a7[_0xd5e0('0x70')]]);_0xd9c05f[_0xd5e0('0x20')]=![];_0xd9c05f['queuecallerabandonAt']=null;_0xd9c05f['assigned']=!![];_0xd9c05f[_0xd5e0('0x82')]=_0x3414a7[_0xd5e0('0x8e')];_0xd9c05f['holdtime']=_0x3414a7[_0xd5e0('0x7e')];_0xd9c05f[_0xd5e0('0x8b')]=!![];_0xd9c05f[_0xd5e0('0x38')]=![];_0xd9c05f['queuecallerexitAt']=null;if(!_0xd9c05f[_0xd5e0('0x8f')]){if(_0x3414a7[_0xd5e0('0x90')]==_0xd5e0('0x8f')){_0xd9c05f[_0xd5e0('0x51')]=_0xd5e0('0x91');logger[_0xd5e0('0x76')](_0xd5e0('0x92'),_0xd9c05f[_0xd5e0('0x4d')],_0xd9c05f['type']);}else{if(_[_0xd5e0('0x93')](_0x3414a7[_0xd5e0('0x3e')][_0xd5e0('0x94')](),_0xd5e0('0x95'))){if(this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x96')]]){var _0x36acfd=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x96')]]);_0x36acfd['queuecallercomplete']=![];_0x36acfd[_0xd5e0('0x38')]=!![];_0x36acfd[_0xd5e0('0x97')]=moment(_0xd9c05f[_0xd5e0('0x71')])['add'](_0x3414a7[_0xd5e0('0x7e')],_0xd5e0('0x98'))[_0xd5e0('0x4b')](_0xd5e0('0x72'));_0x36acfd['queuecallerexitreason']=_0xd5e0('0x99');_0x36acfd[_0xd5e0('0x8f')]=!![];_0x36acfd[_0xd5e0('0x9a')]=_0xd5e0('0x9b');_0x36acfd['transferexten']=_0x3414a7[_0xd5e0('0x9c')];_0x36acfd[_0xd5e0('0x9d')]=_0x3414a7[_0xd5e0('0x70')];logger[_0xd5e0('0x76')](_0xd5e0('0x9e'),_0x36acfd[_0xd5e0('0x4d')],_0x36acfd[_0xd5e0('0x66')]);var _0x36dd26=this[_0xd5e0('0xf')][_0x3414a7['linkedid']];this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x96')]]=this[_0xd5e0('0xf')][_0x3414a7[_0xd5e0('0x70')]];this['queueReports'][_0x3414a7[_0xd5e0('0x70')]]=_0x36dd26;}}else{_0xd9c05f['queuecallerexitreason']=_0xd5e0('0x9f')+_0x3414a7['reason'][_0xd5e0('0xa0')]();logger[_0xd5e0('0x76')](_0xd5e0('0xa1'),_0xd9c05f[_0xd5e0('0x4d')],_0xd9c05f[_0xd5e0('0x66')],_0xd9c05f[_0xd5e0('0x51')]);}}}this[_0xd5e0('0x12')][_0x3414a7[_0xd5e0('0x70')]]=_0xd9c05f;}}}catch(_0x53b1ba){logger['error'](_0xd5e0('0xa2'),_0x3414a7[_0xd5e0('0x70')],util['inspect'](_0x53b1ba,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0xa3')]=function(_0xb3adcc){try{if(this['isNotNull'](_0xb3adcc)){logger[_0xd5e0('0x49')](_0xd5e0('0xa4'),_0xb3adcc['uniqueid'],util[_0xd5e0('0x42')](_0xb3adcc,{'showHidden':![],'depth':null}));this['addVariable'](_0xb3adcc[_0xd5e0('0x70')],_['keys'](_0xb3adcc[_0xd5e0('0xa5')])[0x0],_0xb3adcc['value']);if(this[_0xd5e0('0xf')][_0xb3adcc[_0xd5e0('0x70')]]){var _0x518072=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0xb3adcc['uniqueid']]);if(_0x518072){if(this[_0xd5e0('0x58')](_0xb3adcc[_0xd5e0('0xa5')])&&this[_0xd5e0('0x58')](_0xb3adcc[_0xd5e0('0xa5')][_0xd5e0('0x5e')])){switch(_0xb3adcc['value']){case _0xd5e0('0xa6'):_0x518072[_0xd5e0('0x38')]=![];_0x518072['queuecallerexitAt']=null;break;case'TIMEOUT':_0x518072[_0xd5e0('0xa7')]=_0xd5e0('0xa8');_0x518072[_0xd5e0('0x38')]=!![];_0x518072[_0xd5e0('0x97')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x518072[_0xd5e0('0x85')]=moment()[_0xd5e0('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xd5e0('0x49')](_0xd5e0('0xa9'),_0xb3adcc['uniqueid'],util[_0xd5e0('0x42')](_0x518072,{'showHidden':![],'depth':null}));ami[_0xd5e0('0x48')](_0xd5e0('0xaa'),_0x518072);break;default:_0x518072[_0xd5e0('0x38')]=!![];_0x518072['queuecallerexitAt']=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));_0x518072[_0xd5e0('0x85')]=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));}_0x518072[_0xd5e0('0x20')]=![];_0x518072[_0xd5e0('0x80')]=null;_0x518072[_0xd5e0('0x51')]=_0xb3adcc[_0xd5e0('0xab')];this[_0xd5e0('0x12')][_0xb3adcc[_0xd5e0('0x70')]]=_0x518072;this[_0xd5e0('0x4f')](_0x518072,_0xd5e0('0x24'));}else if(this[_0xd5e0('0x58')](_0xb3adcc[_0xd5e0('0xa5')])&&this[_0xd5e0('0x58')](_0xb3adcc[_0xd5e0('0xa5')][_0xd5e0('0xac')])){if(!_0x518072[_0xd5e0('0x20')]){_0x518072[_0xd5e0('0x38')]=!![];_0x518072[_0xd5e0('0x97')]=moment()[_0xd5e0('0x4b')]('YYYY-MM-DD\x20HH:mm:ss');_0x518072['queuecallerexitreason']=_0xd5e0('0xad');_0x518072['queuecallerleaveAt']=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));this[_0xd5e0('0x12')][_0xb3adcc[_0xd5e0('0x70')]]=_0x518072;}}logger[_0xd5e0('0x76')](_0xd5e0('0xae'),_0xb3adcc[_0xd5e0('0x70')],_0x518072[_0xd5e0('0x4d')],_0x518072[_0xd5e0('0x66')],_[_0xd5e0('0xaf')](_0xb3adcc[_0xd5e0('0xa5')])[0x0],_0xb3adcc[_0xd5e0('0xab')]);_0x518072[_0xd5e0('0x16')]=this[_0xd5e0('0x16')][_0xb3adcc['uniqueid']];}}}}catch(_0xd79872){logger[_0xd5e0('0x41')](_0xd5e0('0xa4'),_0xb3adcc[_0xd5e0('0x70')],util['inspect'](_0xd79872,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd5e0('0xb0')]=function(_0x4e33b3,_0x108b6a,_0x1c5e91){var _0x38384a=[_0xd5e0('0xb1'),_0xd5e0('0xb2'),_0xd5e0('0xb3'),_0xd5e0('0xb4'),_0xd5e0('0xb5'),_0xd5e0('0xb6'),_0xd5e0('0xb7'),'rtpaudioqosrttbridged',_0xd5e0('0xb8'),_0xd5e0('0xb9'),_0xd5e0('0xba'),_0xd5e0('0xbb'),_0xd5e0('0xbc'),_0xd5e0('0xbd'),_0xd5e0('0xbe'),'memberlastcall','membername',_0xd5e0('0xbf'),_0xd5e0('0xc0')];if(!_[_0xd5e0('0x3b')](_0x108b6a)&&!_[_0xd5e0('0xc1')](_0x38384a,_0x108b6a)){if(_[_0xd5e0('0x59')](this['variables'][_0x4e33b3])){this[_0xd5e0('0x16')][_0x4e33b3]={};}this[_0xd5e0('0x16')][_0x4e33b3][_0x108b6a]=_0x1c5e91;}};VoiceQueueReport[_0xd5e0('0xb')]['handleHangup']=function(_0x29178e,_0x4ee0db,_0x222e85){try{var _0x20f100={};if(this[_0xd5e0('0xf')][_0x29178e]){for(var _0x1de315=0x0;_0x1de315<this[_0xd5e0('0xf')][_0x29178e]['length'];_0x1de315+=0x1){_0x20f100=this['queueReports'][_0x29178e][_0x1de315];var _0xa0110a=this[_0xd5e0('0x14')][_0x20f100[_0xd5e0('0x4d')]];if(_0xa0110a){_0xa0110a['sumHoldTime']+=moment(_0x20f100[_0xd5e0('0x85')])['diff'](_0x20f100[_0xd5e0('0x71')],_0xd5e0('0x98'))||0x0;if(_0x222e85&&_0x20f100[_0xd5e0('0x51')]==='ATTENDEDTRANSFER'){_0x20f100[_0xd5e0('0x51')]=_0xd5e0('0xc2');}if(_0x1de315===this['queueReports'][_0x29178e][_0xd5e0('0xc3')]-0x1){_0xa0110a['sumDuration']+=moment()[_0xd5e0('0xc4')](0x0)[_0xd5e0('0xc5')](_0x20f100[_0xd5e0('0x71')],_0xd5e0('0x98'));if(hasCallerLeftTheQueue(_0x20f100)&&_0x20f100[_0xd5e0('0x51')]!==_0xd5e0('0xc6')){_0xa0110a[_0xd5e0('0xc7')]+=0x1;}if(_0x20f100['queuecallercomplete']){_0xa0110a['answered']+=0x1;_0xa0110a['sumBillable']+=moment()[_0xd5e0('0xc4')](0x0)['diff'](_0x20f100[_0xd5e0('0x85')],_0xd5e0('0x98'));_0x20f100[_0xd5e0('0x7d')]=moment()[_0xd5e0('0x4b')](_0xd5e0('0x72'));_0x20f100['queuecallerexit']=![];_0x20f100[_0xd5e0('0x97')]=null;}if(_0x20f100[_0xd5e0('0x38')]&&_0x20f100['transfer']!=!![]){_0xa0110a[_0xd5e0('0xc8')]+=0x1;_0x20f100['lastevent']=_0xd5e0('0xc8');logger[_0xd5e0('0x49')]('[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:',_0x29178e,util[_0xd5e0('0x42')](_0x20f100,{'showHidden':![],'depth':null}));ami[_0xd5e0('0x48')]('custom:queuecallerunmanaged',_0x20f100);}if(_0x20f100[_0xd5e0('0x20')]){_0xa0110a[_0xd5e0('0xc9')]+=0x1;_0x20f100[_0xd5e0('0xa7')]='abandoned';logger[_0xd5e0('0x49')](_0xd5e0('0xca'),_0x29178e,util[_0xd5e0('0x42')](_0x20f100,{'showHidden':![],'depth':null}));ami[_0xd5e0('0x48')]('custom:queuecallerabandon',_0x20f100);}}else{_0xa0110a[_0xd5e0('0xcb')]+=_0xa0110a['sumHoldTime'];}logger['info']('[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s',_0x29178e,_0x20f100[_0xd5e0('0x4d')],_0x20f100[_0xd5e0('0x66')],_0x4ee0db);this['channels'][_0x29178e]=_0x20f100;Object[_0xd5e0('0x65')](this['voiceQueues'][_0x20f100['queue']],_0xa0110a);if(_0x20f100['queuecallerleaveAt']){this['emitVoiceQueueChannelRemove'](_0x20f100,'hangup');}}}logger[_0xd5e0('0x49')](_0xd5e0('0xcc'),_0x29178e,util['inspect'](this[_0xd5e0('0xf')][_0x29178e],{'showHidden':![],'depth':null}));if(hasCallerLeftTheQueue(_0x20f100)&&_0x20f100[_0xd5e0('0x51')]!==_0xd5e0('0xc6')){ami['emit'](_0xd5e0('0xcd'),this[_0xd5e0('0xf')][_0x29178e]);if(this[_0xd5e0('0xf')][_0x29178e]){delete this['queueReports'][_0x29178e];}if(this[_0xd5e0('0x12')][_0x29178e]){delete this[_0xd5e0('0x12')][_0x29178e];}if(this[_0xd5e0('0x16')][_0x29178e]){delete this[_0xd5e0('0x16')][_0x29178e];}}}}catch(_0x1454fa){logger[_0xd5e0('0x41')](_0xd5e0('0xce'),_0x29178e,util[_0xd5e0('0x42')](_0x1454fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x26')]=function(_0xc47472){try{if(this[_0xd5e0('0x58')](_0xc47472)){logger[_0xd5e0('0x49')](_0xd5e0('0xcf'),_0xc47472['uniqueid'],util[_0xd5e0('0x42')](_0xc47472,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0xc47472[_0xd5e0('0x70')]]){return this[_0xd5e0('0xd0')](_0xc47472['uniqueid'],_0xc47472[_0xd5e0('0xd1')],![]);}if(this[_0xd5e0('0xf')][_0xc47472['linkedid']]){if(_0xc47472[_0xd5e0('0xd2')]==='21'){return;}return this['handleHangup'](_0xc47472['linkedid'],_0xc47472[_0xd5e0('0xd1')],!![]);}var _0x126519=Object[_0xd5e0('0xaf')](this['queueReports']);for(var _0x52a63d=0x0;_0x52a63d<_0x126519['length'];_0x52a63d++){var _0xe86541=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0x126519[_0x52a63d]]);if(_0xe86541&&_0xe86541[_0xd5e0('0xd3')]===_0xc47472['uniqueid']){return this[_0xd5e0('0xd0')](_0xe86541['uniqueid'],_0xc47472[_0xd5e0('0xd1')],!![]);}}if(!this[_0xd5e0('0xf')][_0xc47472[_0xd5e0('0x70')]]){logger[_0xd5e0('0x49')](_0xd5e0('0xd4'),_0xc47472[_0xd5e0('0x70')]);if(this['channels'][_0xc47472['uniqueid']]){delete this[_0xd5e0('0x12')][_0xc47472['uniqueid']];}if(this[_0xd5e0('0x16')][_0xc47472['uniqueid']]){delete this[_0xd5e0('0x16')][_0xc47472[_0xd5e0('0x70')]];}}}}catch(_0x426f20){logger[_0xd5e0('0x41')]('[%s][voiceQueueReport][hangup]',_0xc47472['uniqueid'],util[_0xd5e0('0x42')](_0x426f20,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x2d')]=function(_0x2c8e75){try{if(this[_0xd5e0('0x58')](_0x2c8e75)){logger[_0xd5e0('0x49')]('[%s][voiceQueueReport][attendedtransfer]',_0x2c8e75[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x2c8e75,{'showHidden':![],'depth':null}));var _0x59a14a;var _0x7a73a1;var _0x4f76b9;if(this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xd5')]]){_0x59a14a=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xd5')]]);_0x59a14a[_0xd5e0('0xd6')]=_0x2c8e75[_0xd5e0('0xd7')];_0x59a14a[_0xd5e0('0x9d')]=_0x2c8e75[_0xd5e0('0xd8')];_0x59a14a[_0xd5e0('0x51')]='ATTENDEDTRANSFER';_0x59a14a[_0xd5e0('0x8f')]=!![];_0x59a14a[_0xd5e0('0x9a')]=_0xd5e0('0xd9');if(this['queueReports'][_0x2c8e75['secondtransfereruniqueid']]){_0x4f76b9=this[_0xd5e0('0xf')][_0x2c8e75['secondtransfereruniqueid']];this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xd8')]]=this['queueReports'][_0x2c8e75[_0xd5e0('0xd5')]];this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xd5')]]=_0x4f76b9;_0x7a73a1=_[_0xd5e0('0x8d')](this['queueReports'][_0x2c8e75[_0xd5e0('0xd5')]]);_0x7a73a1[_0xd5e0('0x3a')]=!![];}logger[_0xd5e0('0x76')](_0xd5e0('0xda'),_0x2c8e75[_0xd5e0('0x70')],_0x59a14a[_0xd5e0('0x4d')],_0x59a14a[_0xd5e0('0x66')],_0x59a14a[_0xd5e0('0xd6')],_0x59a14a[_0xd5e0('0x9d')]);}else if(this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xdb')]]){_0x59a14a=_[_0xd5e0('0x8d')](this['queueReports'][_0x2c8e75[_0xd5e0('0xdb')]]);_0x59a14a[_0xd5e0('0xd6')]=_0x2c8e75['origtransfererexten'];_0x59a14a['transferuniqueid']=_0x2c8e75[_0xd5e0('0xdc')];_0x59a14a[_0xd5e0('0x51')]='ATTENDEDTRANSFER';_0x59a14a[_0xd5e0('0x8f')]=!![];_0x59a14a[_0xd5e0('0x9a')]=_0xd5e0('0xd9');if(this[_0xd5e0('0xf')][_0x2c8e75['origtransfereruniqueid']]){_0x4f76b9=this[_0xd5e0('0xf')][_0x2c8e75['origtransfereruniqueid']];this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xdc')]]=this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xdb')]];this['queueReports'][_0x2c8e75[_0xd5e0('0xdb')]]=_0x4f76b9;_0x7a73a1=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xdb')]]);_0x7a73a1[_0xd5e0('0x3a')]=!![];}logger[_0xd5e0('0x76')](_0xd5e0('0xda'),_0x2c8e75[_0xd5e0('0x70')],_0x59a14a['queue'],_0x59a14a[_0xd5e0('0x66')],_0x59a14a[_0xd5e0('0xd6')],_0x59a14a[_0xd5e0('0x9d')]);}else if(this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xdc')]]){_0x59a14a=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xdc')]]);_0x59a14a['transferexten']=_0x2c8e75[_0xd5e0('0xdd')];_0x59a14a['transferuniqueid']=_0x2c8e75[_0xd5e0('0xdc')];_0x59a14a['queuecallerexitreason']=_0xd5e0('0xc6');_0x59a14a[_0xd5e0('0x8f')]=!![];_0x59a14a[_0xd5e0('0x9a')]='ATTENDED';_0x59a14a[_0xd5e0('0x3a')]=!![];_0x59a14a[_0xd5e0('0xd3')]=_0x2c8e75[_0xd5e0('0xd5')];}else if(this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xd8')]]){_0x59a14a=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0x2c8e75[_0xd5e0('0xd8')]]);_0x59a14a[_0xd5e0('0xd6')]=_0x2c8e75[_0xd5e0('0xd7')];_0x59a14a[_0xd5e0('0x9d')]=_0x2c8e75[_0xd5e0('0xd8')];_0x59a14a[_0xd5e0('0x51')]=_0xd5e0('0xc6');_0x59a14a[_0xd5e0('0x8f')]=!![];_0x59a14a[_0xd5e0('0x9a')]=_0xd5e0('0xd9');_0x59a14a['switch']=!![];_0x59a14a[_0xd5e0('0xd3')]=_0x2c8e75['transfertargetuniqueid'];}}}catch(_0x434a54){logger[_0xd5e0('0x41')]('[%s][voiceQueueReport][attendedtransfer]',_0x2c8e75[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x434a54,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')]['syncBlindTransfer']=function(_0x5ebc95){try{if(this['isNotNull'](_0x5ebc95)){logger[_0xd5e0('0x49')](_0xd5e0('0xde'),_0x5ebc95[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x5ebc95,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x5ebc95[_0xd5e0('0xd5')]]){var _0xa51b6d=_[_0xd5e0('0x8d')](this['queueReports'][_0x5ebc95[_0xd5e0('0xd5')]]);_0xa51b6d['queuecallerexitreason']=_0xd5e0('0xdf');_0xa51b6d['transfer']=!![];_0xa51b6d['transfertype']=_0xd5e0('0xe0');_0xa51b6d[_0xd5e0('0xd6')]=_0x5ebc95['extension'];_0xa51b6d[_0xd5e0('0x9d')]=_0x5ebc95[_0xd5e0('0xd5')];logger['info']('[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s',_0x5ebc95[_0xd5e0('0x70')],_0xa51b6d[_0xd5e0('0x4d')],_0xa51b6d[_0xd5e0('0x66')],_0xa51b6d[_0xd5e0('0xd6')],_0xa51b6d[_0xd5e0('0x9d')]);this['syncHangup']({'event':'BlindTransfer','uniqueid':_0x5ebc95['transfereeuniqueid'],'context':_0x5ebc95['context'],'channel':_0x5ebc95[_0xd5e0('0xe1')]});}}}catch(_0x4454eb){logger[_0xd5e0('0x41')](_0xd5e0('0xde'),_0x5ebc95[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x4454eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd5e0('0x2a')]=function(_0x3e69f9){try{if(this['isNotNull'](_0x3e69f9)){logger[_0xd5e0('0x49')](_0xd5e0('0xe2'),_0x3e69f9[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x3e69f9,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0x3e69f9[_0xd5e0('0x70')]]){var _0x3f82a3=_['last'](this['queueReports'][_0x3e69f9[_0xd5e0('0x70')]]);if(!_[_0xd5e0('0x3b')](_0x3f82a3[_0xd5e0('0x85')])){_0x3f82a3[_0xd5e0('0xe3')]=moment()['format'](_0xd5e0('0x72'));logger[_0xd5e0('0x76')]('[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s',_0x3e69f9[_0xd5e0('0x70')],_0x3f82a3[_0xd5e0('0xe3')]);}}}}catch(_0x50d807){logger[_0xd5e0('0x41')](_0xd5e0('0xe2'),_0x3e69f9[_0xd5e0('0x70')],util['inspect'](_0x50d807,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xd5e0('0xb')][_0xd5e0('0x2c')]=function(_0x5304cb){try{if(this[_0xd5e0('0x58')](_0x5304cb)){logger[_0xd5e0('0x49')](_0xd5e0('0xe4'),_0x5304cb[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x5304cb,{'showHidden':![],'depth':null}));if(this[_0xd5e0('0xf')][_0x5304cb[_0xd5e0('0x70')]]){var _0x54ac88=_[_0xd5e0('0x8d')](this[_0xd5e0('0xf')][_0x5304cb[_0xd5e0('0x70')]]);if(!_[_0xd5e0('0x3b')](_0x54ac88['mohstarttime'])){_0x54ac88[_0xd5e0('0xe5')]+=moment()[_0xd5e0('0xc4')](0x0)[_0xd5e0('0xc5')](_0x54ac88[_0xd5e0('0xe3')],'seconds');logger[_0xd5e0('0x76')]('[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s',_0x5304cb['uniqueid'],_0x54ac88['mohtime']);delete _0x54ac88[_0xd5e0('0xe3')];}}}}catch(_0x50da63){logger[_0xd5e0('0x41')](_0xd5e0('0xe4'),_0x5304cb['uniqueid'],util[_0xd5e0('0x42')](_0x50da63,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xd5e0('0xe6')]=function(_0x3ef27f){try{if(this[_0xd5e0('0x58')](_0x3ef27f)){logger[_0xd5e0('0x49')]('[%s][voiceQueueReport][newexten]\x20event:',_0x3ef27f['uniqueid'],util[_0xd5e0('0x42')](_0x3ef27f,{'showHidden':![],'depth':null}));if(_0x3ef27f['application'][_0xd5e0('0x94')]()===_0xd5e0('0xe7')){_0x3ef27f[_0xd5e0('0xe8')]=_0x3ef27f['appdata']&&_0x3ef27f[_0xd5e0('0xe9')][_0xd5e0('0x93')](_0xd5e0('0xea'))?_0x3ef27f[_0xd5e0('0xe9')]:(_0x3ef27f['appdata']||_0x3ef27f[_0xd5e0('0xe8')])[_0xd5e0('0x94')]();if(_[_0xd5e0('0x93')](_0x3ef27f['applicationdata'][_0xd5e0('0x94')](),_0xd5e0('0xeb'))){logger[_0xd5e0('0x76')]('[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s',_0x3ef27f[_0xd5e0('0x70')],_0x3ef27f[_0xd5e0('0xec')],_0x3ef27f['applicationdata']);if(_[_0xd5e0('0x59')](this[_0xd5e0('0x12')][_0x3ef27f[_0xd5e0('0x70')]]))this[_0xd5e0('0x12')][_0x3ef27f[_0xd5e0('0x70')]]={};var _0xbfb197=_0x3ef27f[_0xd5e0('0xe8')][_0xd5e0('0xed')]('=');var _0x292129=_0xbfb197[0x0][_0xd5e0('0x94')]()[_0xd5e0('0xee')](/cdr\((.*)\)/);if(_0x292129)this[_0xd5e0('0x12')][_0x3ef27f[_0xd5e0('0x70')]][_0x292129[0x1]]=_0xbfb197[0x1];}}}}catch(_0x1a25a3){logger[_0xd5e0('0x41')]('[%s][voiceQueueReport][newexten]',_0x3ef27f[_0xd5e0('0x70')],util[_0xd5e0('0x42')](_0x1a25a3,{'showHidden':![],'depth':null}));}};module[_0xd5e0('0xef')]=VoiceQueueReport;
\ No newline at end of file
index a542799..a75355e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x15c4=['../client','createHistory','campaign','queue','Request','CreateReportAgentPreview'];(function(_0x43556a,_0x5414e7){var _0x235f66=function(_0x2cfc2f){while(--_0x2cfc2f){_0x43556a['push'](_0x43556a['shift']());}};_0x235f66(++_0x5414e7);}(_0x15c4,0xe4));var _0x415c=function(_0x312385,_0x2ee3ef){_0x312385=_0x312385-0x0;var _0x5162bc=_0x15c4[_0x312385];return _0x5162bc;};'use strict';var client=require(_0x415c('0x0'));exports[_0x415c('0x1')]=function(_0x1ab085){return function(){_0x1ab085[_0x415c('0x2')]=_0x1ab085[_0x415c('0x3')];return client[_0x415c('0x4')](_0x415c('0x5'),{'body':_0x1ab085,'log':_0x415c('0x5')});};};
\ No newline at end of file
+var _0xd566=['CreateReportAgentPreview','../client','createHistory','campaign','Request'];(function(_0x3f61d5,_0x124231){var _0x1e0115=function(_0x3973f2){while(--_0x3973f2){_0x3f61d5['push'](_0x3f61d5['shift']());}};_0x1e0115(++_0x124231);}(_0xd566,0x17d));var _0x6d56=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd566[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x6d56('0x0'));exports[_0x6d56('0x1')]=function(_0x25fb0a){return function(){_0x25fb0a[_0x6d56('0x2')]=_0x25fb0a['queue'];return client[_0x6d56('0x3')]('CreateReportAgentPreview',{'body':_0x25fb0a,'log':_0x6d56('0x4')});};};
\ No newline at end of file
index c8915da..97aca1c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x06d9=['../client','create','CreateAttachment'];(function(_0x3e13a2,_0x17530f){var _0x546eac=function(_0x33cdbf){while(--_0x33cdbf){_0x3e13a2['push'](_0x3e13a2['shift']());}};_0x546eac(++_0x17530f);}(_0x06d9,0xab));var _0x906d=function(_0x5ceb45,_0x59919a){_0x5ceb45=_0x5ceb45-0x0;var _0x2eb418=_0x06d9[_0x5ceb45];return _0x2eb418;};'use strict';var client=require(_0x906d('0x0'));exports[_0x906d('0x1')]=function(_0x2e4925){return client['Request'](_0x906d('0x2'),{'body':_0x2e4925,'log':_0x906d('0x2')});};
\ No newline at end of file
+var _0x8135=['Request','../client','create'];(function(_0x5fb240,_0x4c40a4){var _0x25d6ea=function(_0x1a75ca){while(--_0x1a75ca){_0x5fb240['push'](_0x5fb240['shift']());}};_0x25d6ea(++_0x4c40a4);}(_0x8135,0x17b));var _0x5813=function(_0x1447f3,_0x5e4361){_0x1447f3=_0x1447f3-0x0;var _0x3f80d1=_0x8135[_0x1447f3];return _0x3f80d1;};'use strict';var client=require(_0x5813('0x0'));exports[_0x5813('0x1')]=function(_0x3979c1){return client[_0x5813('0x2')]('CreateAttachment',{'body':_0x3979c1,'log':'CreateAttachment'});};
\ No newline at end of file
index 6a2a45f..98ed732 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','callerid','active','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry'];(function(_0x5c266d,_0x4599f3){var _0x35cd0d=function(_0x59cab9){while(--_0x59cab9){_0x5c266d['push'](_0x5c266d['shift']());}};_0x35cd0d(++_0x4599f3);}(_0x7a54,0x106));var _0x47a5=function(_0x1a4893,_0xf9862c){_0x1a4893=_0x1a4893-0x0;var _0x4487f3=_0x7a54[_0x1a4893];return _0x4487f3;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(){return client[_0x47a5('0x2')]('GetCampaign',{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),_0x47a5('0x4'),'active',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'dialCongestionRetryFrequency',_0x47a5('0xa'),'dialBusyRetryFrequency',_0x47a5('0xb'),_0x47a5('0xc'),'dialGlobalMaxRetry',_0x47a5('0xd'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0x47a5('0xe'),_0x47a5('0xf'),'dialMachineMaxRetry',_0x47a5('0x10'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'dialAMDMinWordLength',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f')],'include':[{'model':'Trunk','as':_0x47a5('0x20'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x21'),_0x47a5('0x22')]},{'model':_0x47a5('0x20'),'as':'TrunkBackup','attributes':['id','name',_0x47a5('0x21'),'active']},{'model':'Interval','as':_0x47a5('0x23'),'attributes':['id',_0x47a5('0x3')],'include':[{'model':_0x47a5('0x23'),'as':_0x47a5('0x24'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x25')]}]},{'model':_0x47a5('0x26'),'as':_0x47a5('0x26'),'attributes':['id',_0x47a5('0x3')]}]},'log':'getCampaign'});};};
\ No newline at end of file
+var _0x2ef3=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','active','TrunkBackup','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0x2ef3,0xba));var _0x32ef=function(_0x4a13c1,_0x33d047){_0x4a13c1=_0x4a13c1-0x0;var _0x211df4=_0x2ef3[_0x4a13c1];return _0x211df4;};'use strict';var client=require(_0x32ef('0x0'));exports[_0x32ef('0x1')]=function(){return function(){return client[_0x32ef('0x2')](_0x32ef('0x3'),{'options':{'raw':![],'attributes':['id',_0x32ef('0x4'),_0x32ef('0x5'),'active',_0x32ef('0x6'),_0x32ef('0x7'),'dialOriginateCallerIdNumber',_0x32ef('0x8'),_0x32ef('0x9'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'dialAMDActive',_0x32ef('0x18'),'dialAMDGreeting',_0x32ef('0x19'),'dialAMDTotalAnalysisTime',_0x32ef('0x1a'),_0x32ef('0x1b'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x32ef('0x1c'),'dialOrderByScheduledAt',_0x32ef('0x1d'),_0x32ef('0x1e'),_0x32ef('0x1f')],'include':[{'model':_0x32ef('0x20'),'as':'Trunk','attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x20'),'as':_0x32ef('0x22'),'attributes':['id','name','callerid',_0x32ef('0x21')]},{'model':_0x32ef('0x23'),'as':_0x32ef('0x23'),'attributes':['id','name'],'include':[{'model':_0x32ef('0x23'),'as':_0x32ef('0x24'),'attributes':['id','name',_0x32ef('0x25')]}]},{'model':_0x32ef('0x26'),'as':_0x32ef('0x26'),'attributes':['id',_0x32ef('0x4')]}]},'log':_0x32ef('0x27')});};};
\ No newline at end of file
index 6305e2b..618f2f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb32a=['../client','createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x4947ef,_0x5f31e8){var _0x257d14=function(_0xd8cb6c){while(--_0xd8cb6c){_0x4947ef['push'](_0x4947ef['shift']());}};_0x257d14(++_0x5f31e8);}(_0xb32a,0x1b6));var _0xab32=function(_0x2307ea,_0x3aad48){_0x2307ea=_0x2307ea-0x0;var _0x45d34a=_0xb32a[_0x2307ea];return _0x45d34a;};'use strict';var client=require(_0xab32('0x0'));exports[_0xab32('0x1')]=function(_0x1edb52){return function(){return client[_0xab32('0x2')](_0xab32('0x3'),{'body':_0x1edb52,'log':_0xab32('0x3')});};};exports[_0xab32('0x4')]=function(_0x5757e3){return function(){return client[_0xab32('0x2')](_0xab32('0x5'),{'options':_0x5757e3,'log':_0xab32('0x5')});};};
\ No newline at end of file
+var _0x64cf=['GetCmContact','createContact','Request','CreateCmContact','getContacts'];(function(_0x44b7d6,_0x4a3f3f){var _0x5346f0=function(_0x35ac17){while(--_0x35ac17){_0x44b7d6['push'](_0x44b7d6['shift']());}};_0x5346f0(++_0x4a3f3f);}(_0x64cf,0x6a));var _0xf64c=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x64cf[_0xa464c9];return _0x3d73c4;};'use strict';var client=require('../client');exports[_0xf64c('0x0')]=function(_0x1d002d){return function(){return client[_0xf64c('0x1')]('CreateCmContact',{'body':_0x1d002d,'log':_0xf64c('0x2')});};};exports[_0xf64c('0x3')]=function(_0x26af68){return function(){return client['Request'](_0xf64c('0x4'),{'options':_0x26af68,'log':_0xf64c('0x4')});};};
\ No newline at end of file
index f7cb573..6d9be9e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7c1f=['campaign','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','getContactRecallMe','voicePause','db.CmHopper.UserId','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','GetCmHopper','CmContact','Contact','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','Request','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer'];(function(_0x130883,_0x325146){var _0x132b31=function(_0xfa25ef){while(--_0xfa25ef){_0x130883['push'](_0x130883['shift']());}};_0x132b31(++_0x325146);}(_0x7c1f,0x194));var _0xf7c1=function(_0xd90a5c,_0x34d99d){_0xd90a5c=_0xd90a5c-0x0;var _0x2f6087=_0x7c1f[_0xd90a5c];return _0x2f6087;};'use strict';var client=require(_0xf7c1('0x0'));var moment=require(_0xf7c1('0x1'));exports[_0xf7c1('0x2')]=function(_0x4c0c8e,_0x3ca7b6){return function(){return client['Request'](_0xf7c1('0x3'),{'options':{'where':{'VoiceQueueId':_0x4c0c8e},'include':[{'model':_0xf7c1('0x4'),'as':_0xf7c1('0x5')}],'limit':_0x3ca7b6,'raw':![]},'log':'getCmHopper'});};};exports[_0xf7c1('0x6')]=function(_0x3b02fc,_0x3c21cf,_0x136e1e){return function(){return client['Request'](_0xf7c1('0x7'),{'body':_0x3b02fc,'options':{'where':{'VoiceQueueId':_0x3c21cf,'scheduledat':{'$lte':moment()[_0xf7c1('0x8')](_0xf7c1('0x9'))}},'limit':_0x136e1e},'log':_0xf7c1('0x7')});};};exports[_0xf7c1('0xa')]=function(_0x346575){return client[_0xf7c1('0xb')](_0xf7c1('0x7'),{'body':_0x346575,'options':{'where':{'ContactId':_0x346575[_0xf7c1('0xc')],'ListId':_0x346575[_0xf7c1('0xd')],'VoiceQueueId':_0x346575[_0xf7c1('0xe')],'CampaignId':_0x346575[_0xf7c1('0xf')]}},'log':'rescheduleContact'});};exports[_0xf7c1('0x10')]=function(_0x407fde,_0x1f2f86,_0xd4d9b6){return function(){return client[_0xf7c1('0xb')](_0xf7c1('0x11'),{'options':{'where':{'VoiceQueueId':_0x407fde,'ListId':_0x1f2f86,'ContactId':_0xd4d9b6}},'log':'DestroyCmHopper'});};};exports['getContactDialer']=function(_0x1d92ef,_0x501dde,_0x3e8e23,_0x212791){return client['Request'](_0xf7c1('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1d92ef,'active':![],'scheduledat':{'$lte':moment()['format'](_0xf7c1('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x501dde}}]},'order':[[_0xf7c1('0x13'),_0xf7c1('0x14')],[_0xf7c1('0x15'),_0x212791],['id',_0xf7c1('0x16')]],'raw':!![],'limit':_0x3e8e23},'log':'GetContactDialer'});};exports[_0xf7c1('0x17')]=function(_0x5b5786,_0x298d23,_0x4f0a0a){return client[_0xf7c1('0xb')](_0xf7c1('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5b5786,'active':![],'scheduledat':{'$lte':moment()[_0xf7c1('0x8')](_0xf7c1('0x9'))}},'include':[{'model':_0xf7c1('0x4'),'as':_0xf7c1('0x5')}],'order':[[_0xf7c1('0x13'),_0xf7c1('0x14')],['scheduledat',_0x4f0a0a],['id','ASC']],'raw':!![],'limit':_0x298d23},'log':_0xf7c1('0x18')});};exports[_0xf7c1('0x19')]=function(_0x4ee91e,_0x16d8a1){_0x4ee91e[_0xf7c1('0x1a')]=_0x4ee91e['queue'];return client[_0xf7c1('0xb')]('MoveContactManagedDialer',{'body':_0x4ee91e,'options':{'where':{'ContactId':_0x4ee91e['ContactId'],'ListId':_0x4ee91e['ListId'],'VoiceQueueId':_0x4ee91e[_0xf7c1('0xe')],'CampaignId':_0x4ee91e[_0xf7c1('0xf')],'active':_0x16d8a1?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0xf7c1('0x1b')]=function(_0x18e2b4){return client[_0xf7c1('0xb')](_0xf7c1('0x1c'),{'options':{'where':{'VoiceQueueId':_0x18e2b4['id']?_0x18e2b4['id']||null:null}},'log':_0xf7c1('0x1b')});};exports[_0xf7c1('0x1d')]=function(_0x294c28){return function(){return client[_0xf7c1('0xb')]('GetCmHopperPreview',{'options':{'where':{'id':_0x294c28},'include':[{'model':'CmContact','as':'Contact'},{'model':_0xf7c1('0x1e'),'as':_0xf7c1('0x1f'),'attributes':['id',_0xf7c1('0x20')]},{'model':_0xf7c1('0x21'),'as':_0xf7c1('0x22'),'attributes':['id',_0xf7c1('0x20')]}],'raw':!![]},'log':_0xf7c1('0x23')});};};exports[_0xf7c1('0x24')]=function(_0x457212,_0x549c29,_0x6d74a1){return client[_0xf7c1('0xb')]('UpdateCmHopper',{'body':_0x457212,'options':{'where':{'id':_0x549c29},'limit':_0x6d74a1},'log':_0xf7c1('0x7')});};exports[_0xf7c1('0x25')]=function(_0x410544,_0x636a01){return function(){return client[_0xf7c1('0xb')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x410544,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xf7c1('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x636a01}},'order':[[_0xf7c1('0x13'),_0xf7c1('0x14')],[_0xf7c1('0x15'),'DESC'],['id',_0xf7c1('0x16')]],'include':[{'model':_0xf7c1('0x4'),'as':'Contact'},{'model':'User','as':_0xf7c1('0x1f'),'attributes':['id',_0xf7c1('0x20'),_0xf7c1('0x26')]}],'group':_0xf7c1('0x27'),'raw':!![]},'log':_0xf7c1('0x12')});};};exports['resetActiveCalls']=function(_0x405eaa,_0x1f4b82){return client[_0xf7c1('0xb')](_0xf7c1('0x28'),{'body':_0x405eaa,'options':_0x1f4b82||{},'log':_0xf7c1('0x28')});};exports['handlePreviewRecallNotifications']=function(_0x567f6d,_0xda1e1b,_0x29c050){return function(){return client[_0xf7c1('0xb')](_0xf7c1('0x29'),{'body':{'where':{'voiceQueueIds':_0x567f6d,'interval':_0xda1e1b,'availableAgentsIds':_0x29c050}},'log':_0xf7c1('0x2a')});};};
\ No newline at end of file
+var _0x106f=['name','VoiceQueue','unlockContact','UpdateCmHopper','getContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','GetCmHopper','Contact','getCmHopper','updateContacts','Request','format','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','VoiceQueueId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','ASC','CmContact','scheduledat','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','Agent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x106f,0x162));var _0xf106=function(_0x1c7c44,_0x86bad4){_0x1c7c44=_0x1c7c44-0x0;var _0x8ff5b8=_0x106f[_0x1c7c44];return _0x8ff5b8;};'use strict';var client=require(_0xf106('0x0'));var moment=require(_0xf106('0x1'));exports['getContacts']=function(_0x4014dd,_0x6d8236){return function(){return client['Request'](_0xf106('0x2'),{'options':{'where':{'VoiceQueueId':_0x4014dd},'include':[{'model':'CmContact','as':_0xf106('0x3')}],'limit':_0x6d8236,'raw':![]},'log':_0xf106('0x4')});};};exports[_0xf106('0x5')]=function(_0x318376,_0x253f6d,_0x282fd4){return function(){return client[_0xf106('0x6')]('UpdateCmHopper',{'body':_0x318376,'options':{'where':{'VoiceQueueId':_0x253f6d,'scheduledat':{'$lte':moment()[_0xf106('0x7')](_0xf106('0x8'))}},'limit':_0x282fd4},'log':'UpdateCmHopper'});};};exports['rescheduleContact']=function(_0x507ad9){return client['Request']('UpdateCmHopper',{'body':_0x507ad9,'options':{'where':{'ContactId':_0x507ad9[_0xf106('0x9')],'ListId':_0x507ad9[_0xf106('0xa')],'VoiceQueueId':_0x507ad9[_0xf106('0xb')],'CampaignId':_0x507ad9[_0xf106('0xc')]}},'log':_0xf106('0xd')});};exports[_0xf106('0xe')]=function(_0xf775b4,_0x67f5b0,_0x2ac6ec){return function(){return client[_0xf106('0x6')](_0xf106('0xf'),{'options':{'where':{'VoiceQueueId':_0xf775b4,'ListId':_0x67f5b0,'ContactId':_0x2ac6ec}},'log':'DestroyCmHopper'});};};exports[_0xf106('0x10')]=function(_0xba8a92,_0x52cbb5,_0x59854c,_0x322351){return client[_0xf106('0x6')](_0xf106('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xba8a92,'active':![],'scheduledat':{'$lte':moment()['format'](_0xf106('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x52cbb5}}]},'order':[[_0xf106('0x12'),_0xf106('0x13')],['scheduledat',_0x322351],['id',_0xf106('0x14')]],'raw':!![],'limit':_0x59854c},'log':_0xf106('0x11')});};exports['getContactDialerIvr']=function(_0x134f6d,_0x2bd339,_0x62352){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x134f6d,'active':![],'scheduledat':{'$lte':moment()[_0xf106('0x7')](_0xf106('0x8'))}},'include':[{'model':_0xf106('0x15'),'as':'Contact'}],'order':[[_0xf106('0x12'),_0xf106('0x13')],[_0xf106('0x16'),_0x62352],['id',_0xf106('0x14')]],'raw':!![],'limit':_0x2bd339},'log':_0xf106('0x17')});};exports[_0xf106('0x18')]=function(_0x29ae70,_0x232a54){_0x29ae70[_0xf106('0x19')]=_0x29ae70['queue'];return client['Request'](_0xf106('0x1a'),{'body':_0x29ae70,'options':{'where':{'ContactId':_0x29ae70['ContactId'],'ListId':_0x29ae70[_0xf106('0xa')],'VoiceQueueId':_0x29ae70[_0xf106('0xb')],'CampaignId':_0x29ae70[_0xf106('0xc')],'active':_0x232a54?undefined:!![]}},'log':_0xf106('0x1a')});};exports[_0xf106('0x1b')]=function(_0x4f673f){return client['Request'](_0xf106('0x1c'),{'options':{'where':{'VoiceQueueId':_0x4f673f['id']?_0x4f673f['id']||null:null}},'log':_0xf106('0x1b')});};exports[_0xf106('0x1d')]=function(_0x25d00a){return function(){return client[_0xf106('0x6')](_0xf106('0x1e'),{'options':{'where':{'id':_0x25d00a},'include':[{'model':_0xf106('0x15'),'as':_0xf106('0x3')},{'model':_0xf106('0x1f'),'as':_0xf106('0x20'),'attributes':['id',_0xf106('0x21')]},{'model':_0xf106('0x22'),'as':'Queue','attributes':['id','name']}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xf106('0x23')]=function(_0x2b8d48,_0x27ed68,_0x1e7fce){return client[_0xf106('0x6')](_0xf106('0x24'),{'body':_0x2b8d48,'options':{'where':{'id':_0x27ed68},'limit':_0x1e7fce},'log':'UpdateCmHopper'});};exports[_0xf106('0x25')]=function(_0x269bff,_0x1f8323){return function(){return client[_0xf106('0x6')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x269bff,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xf106('0x7')](_0xf106('0x8'))},'UserId':{'$in':_0x1f8323}},'order':[[_0xf106('0x12'),_0xf106('0x13')],[_0xf106('0x16'),_0xf106('0x13')],['id','ASC']],'include':[{'model':_0xf106('0x15'),'as':_0xf106('0x3')},{'model':_0xf106('0x1f'),'as':_0xf106('0x20'),'attributes':['id','name',_0xf106('0x26')]}],'group':_0xf106('0x27'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0xf106('0x28')]=function(_0x22c0f6,_0x3ede2f){return client[_0xf106('0x6')](_0xf106('0x29'),{'body':_0x22c0f6,'options':_0x3ede2f||{},'log':_0xf106('0x29')});};exports[_0xf106('0x2a')]=function(_0x458f0c,_0x12f8a3,_0x24a26d){return function(){return client[_0xf106('0x6')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x458f0c,'interval':_0x12f8a3,'availableAgentsIds':_0x24a26d}},'log':'handlePreviewRecallNotifications'});};};
\ No newline at end of file
index 9efe378..91191e7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0433=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','Request','IncrementPreviewCounters','verifyAdditionalPhones'];(function(_0x238c7f,_0x58aebf){var _0x4aba9b=function(_0x13be41){while(--_0x13be41){_0x238c7f['push'](_0x238c7f['shift']());}};_0x4aba9b(++_0x58aebf);}(_0x0433,0x14f));var _0x3043=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x0433[_0x4fde08];return _0x12e725;};'use strict';var client=require('../client');exports[_0x3043('0x0')]=function(_0x344ad6,_0x4d60ed,_0x48f7e6){return client['Request'](_0x3043('0x1'),{'body':_0x344ad6,'reason':_0x4d60ed,'entity':_0x48f7e6,'log':_0x3043('0x1')});};exports[_0x3043('0x2')]=function(_0x38f9a1,_0x85fdc0,_0x1fab4f){return client['Request'](_0x3043('0x3'),{'body':_0x38f9a1,'duration':_0x85fdc0,'waitTime':_0x1fab4f,'log':_0x3043('0x3')});};exports[_0x3043('0x4')]=function(_0x414a5f){return function(){return client[_0x3043('0x5')](_0x3043('0x6'),{'body':_0x414a5f,'log':'IncrementPreviewCounters'});};};
\ No newline at end of file
+var _0x8ccc=['../client','verifyAdditionalPhones','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters'];(function(_0x200ebe,_0x43e591){var _0x3249b6=function(_0x286e4b){while(--_0x286e4b){_0x200ebe['push'](_0x200ebe['shift']());}};_0x3249b6(++_0x43e591);}(_0x8ccc,0xf8));var _0xc8cc=function(_0x124a4e,_0x3f0d70){_0x124a4e=_0x124a4e-0x0;var _0x20d88f=_0x8ccc[_0x124a4e];return _0x20d88f;};'use strict';var client=require(_0xc8cc('0x0'));exports[_0xc8cc('0x1')]=function(_0x2bc8a3,_0x5a2a4c,_0x250e9d){return client[_0xc8cc('0x2')](_0xc8cc('0x3'),{'body':_0x2bc8a3,'reason':_0x5a2a4c,'entity':_0x250e9d,'log':_0xc8cc('0x3')});};exports[_0xc8cc('0x4')]=function(_0x2aae9f,_0xe2fac6,_0x51e171){return client[_0xc8cc('0x2')]('SwapAdditionalPhones',{'body':_0x2aae9f,'duration':_0xe2fac6,'waitTime':_0x51e171,'log':_0xc8cc('0x5')});};exports[_0xc8cc('0x6')]=function(_0x37085f){return function(){return client[_0xc8cc('0x2')]('IncrementPreviewCounters',{'body':_0x37085f,'log':_0xc8cc('0x7')});};};
\ No newline at end of file
index 21e6082..f620da3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb32e=['GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone'];(function(_0x492221,_0x9e2521){var _0x398bf9=function(_0x303c5b){while(--_0x303c5b){_0x492221['push'](_0x492221['shift']());}};_0x398bf9(++_0x9e2521);}(_0xb32e,0x135));var _0xeb32=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb32e[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xeb32('0x0'));exports[_0xeb32('0x1')]=function(_0x1af0cb){return client[_0xeb32('0x2')](_0xeb32('0x3'),{'options':{'where':{'VoiceQueueId':_0x1af0cb[_0xeb32('0x4')],'phone':_0x1af0cb['phone']},'raw':![]},'log':'GetCmHopperBlack'});};exports['checkIsBlackListIvr']=function(_0x95a0da){return client[_0xeb32('0x2')](_0xeb32('0x3'),{'options':{'where':{'CampaignId':_0x95a0da['CampaignId'],'phone':_0x95a0da[_0xeb32('0x5')]},'raw':![]},'log':_0xeb32('0x6')});};
\ No newline at end of file
+var _0x377d=['checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone'];(function(_0x55b44e,_0x245616){var _0x1d202a=function(_0xc94e0b){while(--_0xc94e0b){_0x55b44e['push'](_0x55b44e['shift']());}};_0x1d202a(++_0x245616);}(_0x377d,0x1e3));var _0xd377=function(_0x5a80e0,_0x47005c){_0x5a80e0=_0x5a80e0-0x0;var _0x13f209=_0x377d[_0x5a80e0];return _0x13f209;};'use strict';var client=require('../client');exports[_0xd377('0x0')]=function(_0x4357cd){return client[_0xd377('0x1')](_0xd377('0x2'),{'options':{'where':{'VoiceQueueId':_0x4357cd[_0xd377('0x3')],'phone':_0x4357cd[_0xd377('0x4')]},'raw':![]},'log':_0xd377('0x2')});};exports[_0xd377('0x5')]=function(_0x193e7c){return client[_0xd377('0x1')](_0xd377('0x2'),{'options':{'where':{'CampaignId':_0x193e7c[_0xd377('0x6')],'phone':_0x193e7c[_0xd377('0x4')]},'raw':![]},'log':_0xd377('0x7')});};
\ No newline at end of file
index 1a7edb8..935c1bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6bd6=['Request','CreateCmHopperFinal'];(function(_0x325913,_0x162eb0){var _0x3ab364=function(_0x93470f){while(--_0x93470f){_0x325913['push'](_0x325913['shift']());}};_0x3ab364(++_0x162eb0);}(_0x6bd6,0xaa));var _0x66bd=function(_0x568ae7,_0x2b5fa3){_0x568ae7=_0x568ae7-0x0;var _0x257050=_0x6bd6[_0x568ae7];return _0x257050;};'use strict';var client=require('../client');exports['createContact']=function(_0xca9ed4){return function(){_0xca9ed4['campaign']=_0xca9ed4['queue'];return client[_0x66bd('0x0')](_0x66bd('0x1'),{'body':_0xca9ed4,'log':_0x66bd('0x1')});};};
\ No newline at end of file
+var _0xde55=['../client','createContact','campaign','CreateCmHopperFinal'];(function(_0x1f5670,_0x506b36){var _0x140a2f=function(_0x492b37){while(--_0x492b37){_0x1f5670['push'](_0x1f5670['shift']());}};_0x140a2f(++_0x506b36);}(_0xde55,0x9c));var _0x5de5=function(_0x226437,_0x50b014){_0x226437=_0x226437-0x0;var _0x17a16f=_0xde55[_0x226437];return _0x17a16f;};'use strict';var client=require(_0x5de5('0x0'));exports[_0x5de5('0x1')]=function(_0xfba4b5){return function(){_0xfba4b5[_0x5de5('0x2')]=_0xfba4b5['queue'];return client['Request'](_0x5de5('0x3'),{'body':_0xfba4b5,'log':_0x5de5('0x3')});};};
\ No newline at end of file
index f4bfc9e..0d684b7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x400a=['Request','CreateCmHopperHistory','AvgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','day','../client','createHistory','campaign','queue'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0x400a,0x18b));var _0xa400=function(_0x4094c1,_0x22e3ee){_0x4094c1=_0x4094c1-0x0;var _0x317314=_0x400a[_0x4094c1];return _0x317314;};'use strict';var client=require(_0xa400('0x0'));var moment=require('moment');exports[_0xa400('0x1')]=function(_0x2c16ae){_0x2c16ae[_0xa400('0x2')]=_0x2c16ae[_0xa400('0x3')];return client[_0xa400('0x4')](_0xa400('0x5'),{'body':_0x2c16ae,'log':_0xa400('0x5')});};exports['avgHandleTime']=function(_0x104a9c){return client[_0xa400('0x4')](_0xa400('0x6'),{'options':{'where':{'endtime':{'$between':[moment()[_0xa400('0x7')](_0x104a9c,_0xa400('0x8'))[_0xa400('0x9')](_0xa400('0xa')),moment()[_0xa400('0x9')](_0xa400('0xa'))]}},'raw':![]},'log':_0xa400('0xb')});};exports[_0xa400('0xc')]=function(){return function(){return client[_0xa400('0x4')](_0xa400('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xa400('0xe')]('day')[_0xa400('0x9')](_0xa400('0xa')),moment()[_0xa400('0xf')]('day')[_0xa400('0x9')](_0xa400('0xa'))]},'campaigntype':_0xa400('0x3')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0xa400('0x10')]=function(){return function(){return client[_0xa400('0x4')](_0xa400('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0xa400('0x12'))['format'](_0xa400('0xa')),moment()['endOf']('day')[_0xa400('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':'ivr'},'raw':![]},'log':_0xa400('0x11')});};};
\ No newline at end of file
+var _0x90a6=['YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','GetCampaignHopperHistory','ivr','../client','moment','createHistory','campaign','queue','Request','CreateCmHopperHistory','AvgHandleTime','subtract','format'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x90a6,0xaa));var _0x690a=function(_0x44b137,_0x571994){_0x44b137=_0x44b137-0x0;var _0x1648e2=_0x90a6[_0x44b137];return _0x1648e2;};'use strict';var client=require(_0x690a('0x0'));var moment=require(_0x690a('0x1'));exports[_0x690a('0x2')]=function(_0x345bb9){_0x345bb9[_0x690a('0x3')]=_0x345bb9[_0x690a('0x4')];return client[_0x690a('0x5')](_0x690a('0x6'),{'body':_0x345bb9,'log':_0x690a('0x6')});};exports['avgHandleTime']=function(_0x44c4c0){return client['Request'](_0x690a('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0x690a('0x8')](_0x44c4c0,'minutes')[_0x690a('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x690a('0x9')](_0x690a('0xa'))]}},'raw':![]},'log':_0x690a('0xb')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0x690a('0x5')](_0x690a('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x690a('0xd')](_0x690a('0xe'))[_0x690a('0x9')](_0x690a('0xa')),moment()[_0x690a('0xf')](_0x690a('0xe'))['format'](_0x690a('0xa'))]},'campaigntype':_0x690a('0x4')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x690a('0x5')](_0x690a('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x690a('0xd')]('day')['format'](_0x690a('0xa')),moment()[_0x690a('0xf')](_0x690a('0xe'))[_0x690a('0x9')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x690a('0x11')},'raw':![]},'log':_0x690a('0x10')});};};
\ No newline at end of file
index 09ccf8a..a861efd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe39=['callerid','active','NotifyFaxAccount','../client','getFaxAccounts','GetFaxAccount','ecm','headerinfo','maxrate','modem','gateway','faxdetect','t38timeout','tech','TrunkId','key','Trunk','name'];(function(_0x314cca,_0x2550b6){var _0x563169=function(_0x26f0e4){while(--_0x26f0e4){_0x314cca['push'](_0x314cca['shift']());}};_0x563169(++_0x2550b6);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xfe39[_0x819464];return _0x49dcc0;};'use strict';var client=require(_0x9fe3('0x0'));exports[_0x9fe3('0x1')]=function(){return function(){return client['Request'](_0x9fe3('0x2'),{'options':{'raw':![],'attributes':['id','name','description',_0x9fe3('0x3'),_0x9fe3('0x4'),'localstationid','minrate',_0x9fe3('0x5'),_0x9fe3('0x6'),_0x9fe3('0x7'),_0x9fe3('0x8'),_0x9fe3('0x9'),_0x9fe3('0xa'),_0x9fe3('0xb'),'ListId',_0x9fe3('0xc')],'include':[{'model':_0x9fe3('0xd'),'as':_0x9fe3('0xd'),'attributes':['id',_0x9fe3('0xe'),_0x9fe3('0xf'),_0x9fe3('0x10')]}]},'log':'getFaxAccount'});};};exports['notify']=function(_0x14e700,_0x2c8d48){return client['Request'](_0x9fe3('0x11'),{'account':{'id':_0x14e700},'body':_0x2c8d48,'log':_0x9fe3('0x11')});};
\ No newline at end of file
+var _0x8a21=['tech','ListId','key','Trunk','callerid','active','getFaxAccount','notify','Request','NotifyFaxAccount','../client','GetFaxAccount','name','description','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x8a21,0x1d8));var _0x18a2=function(_0x5ba46a,_0x582fe0){_0x5ba46a=_0x5ba46a-0x0;var _0x5cbf4f=_0x8a21[_0x5ba46a];return _0x5cbf4f;};'use strict';var client=require(_0x18a2('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0x18a2('0x1'),{'options':{'raw':![],'attributes':['id',_0x18a2('0x2'),_0x18a2('0x3'),'ecm','headerinfo',_0x18a2('0x4'),_0x18a2('0x5'),_0x18a2('0x6'),_0x18a2('0x7'),_0x18a2('0x8'),_0x18a2('0x9'),_0x18a2('0xa'),_0x18a2('0xb'),'TrunkId',_0x18a2('0xc'),_0x18a2('0xd')],'include':[{'model':_0x18a2('0xe'),'as':'Trunk','attributes':['id',_0x18a2('0x2'),_0x18a2('0xf'),_0x18a2('0x10')]}]},'log':_0x18a2('0x11')});};};exports[_0x18a2('0x12')]=function(_0x54ce08,_0x44c60c){return client[_0x18a2('0x13')]('NotifyFaxAccount',{'account':{'id':_0x54ce08},'body':_0x44c60c,'log':_0x18a2('0x14')});};
\ No newline at end of file
index 7795952..2a4a34a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe043=['update','UpdateFaxMessage','../client'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0xe043,0x13d));var _0x3e04=function(_0x1311fe,_0xbc2ba5){_0x1311fe=_0x1311fe-0x0;var _0x791420=_0xe043[_0x1311fe];return _0x791420;};'use strict';var client=require(_0x3e04('0x0'));exports[_0x3e04('0x1')]=function(_0x42d567,_0x4f7f55){return client['Request']('UpdateFaxMessage',{'body':_0x4f7f55,'options':{'where':{'AttachmentId':_0x42d567}},'log':_0x3e04('0x2')});};
\ No newline at end of file
+var _0x090e=['UpdateFaxMessage','../client'];(function(_0x238049,_0x43e7f7){var _0x5a942c=function(_0x4fcdad){while(--_0x4fcdad){_0x238049['push'](_0x238049['shift']());}};_0x5a942c(++_0x43e7f7);}(_0x090e,0x129));var _0xe090=function(_0x27a1e0,_0x3ff2cb){_0x27a1e0=_0x27a1e0-0x0;var _0x1ca624=_0x090e[_0x27a1e0];return _0x1ca624;};'use strict';var client=require(_0xe090('0x0'));exports['update']=function(_0x38dfed,_0x4cb97a){return client['Request'](_0xe090('0x1'),{'body':_0x4cb97a,'options':{'where':{'AttachmentId':_0x38dfed}},'log':'UpdateFaxMessage'});};
\ No newline at end of file
index e81231a..eefea85 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa26c=['description','username','password','remoteUri','authType','serverUrl','DeskConfiguration','DeskField','type','content','variableName','Variable','keyType','Fields','idField','nameField','customField','Tag','GetDeskAccount','../../client','getDeskAccounts','Request','name'];(function(_0x4d67d3,_0x53dc97){var _0xb3a3dc=function(_0x18fa14){while(--_0x18fa14){_0x4d67d3['push'](_0x4d67d3['shift']());}};_0xb3a3dc(++_0x53dc97);}(_0xa26c,0x127));var _0xca26=function(_0x2f9605,_0x2296b5){_0x2f9605=_0x2f9605-0x0;var _0x10b2ff=_0xa26c[_0x2f9605];return _0x10b2ff;};'use strict';var client=require(_0xca26('0x0'));exports[_0xca26('0x1')]=function(){return function(_0x1e5d24){return client[_0xca26('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0xca26('0x3'),_0xca26('0x4'),_0xca26('0x5'),_0xca26('0x6'),_0xca26('0x7'),_0xca26('0x8'),'type',_0xca26('0x9')],'include':[{'model':_0xca26('0xa'),'as':'Configurations','attributes':['id',_0xca26('0x3')],'include':[{'model':_0xca26('0xb'),'as':'Subjects','attributes':['id',_0xca26('0xc'),_0xca26('0xd'),_0xca26('0xe')],'include':[{'model':_0xca26('0xf'),'as':'Variable','attributes':['id','name']}]},{'model':_0xca26('0xb'),'as':'Descriptions','attributes':['id',_0xca26('0xc'),_0xca26('0xd'),'key',_0xca26('0x10'),'keyContent',_0xca26('0xe')],'include':[{'model':_0xca26('0xf'),'as':_0xca26('0xf'),'attributes':['id',_0xca26('0x3')]}]},{'model':_0xca26('0xb'),'as':_0xca26('0x11'),'attributes':['id','type',_0xca26('0xd'),_0xca26('0x12'),_0xca26('0x13'),_0xca26('0x14'),_0xca26('0xe')],'include':[{'model':_0xca26('0xf'),'as':_0xca26('0xf'),'attributes':['id',_0xca26('0x3')]}]},{'model':_0xca26('0x15'),'as':'Tags','attributes':['id',_0xca26('0x3')]}]}]},'log':_0xca26('0x16')});};};
\ No newline at end of file
+var _0xcb38=['remoteUri','type','DeskConfiguration','Configurations','name','DeskField','Subjects','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','idField','nameField','Tag','Tags','../../client','GetDeskAccount','description'];(function(_0x452522,_0xd1efa5){var _0x8462b1=function(_0x4f17a2){while(--_0x4f17a2){_0x452522['push'](_0x452522['shift']());}};_0x8462b1(++_0xd1efa5);}(_0xcb38,0x1cb));var _0x8cb3=function(_0x51bb16,_0xd530f2){_0x51bb16=_0x51bb16-0x0;var _0xddcf5f=_0xcb38[_0x51bb16];return _0xddcf5f;};'use strict';var client=require(_0x8cb3('0x0'));exports['getDeskAccounts']=function(){return function(_0x9a746d){return client['Request'](_0x8cb3('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x8cb3('0x2'),'username','password',_0x8cb3('0x3'),'authType',_0x8cb3('0x4'),'serverUrl'],'include':[{'model':_0x8cb3('0x5'),'as':_0x8cb3('0x6'),'attributes':['id',_0x8cb3('0x7')],'include':[{'model':_0x8cb3('0x8'),'as':_0x8cb3('0x9'),'attributes':['id',_0x8cb3('0x4'),_0x8cb3('0xa'),_0x8cb3('0xb')],'include':[{'model':_0x8cb3('0xc'),'as':'Variable','attributes':['id',_0x8cb3('0x7')]}]},{'model':_0x8cb3('0x8'),'as':_0x8cb3('0xd'),'attributes':['id',_0x8cb3('0x4'),'content','key',_0x8cb3('0xe'),_0x8cb3('0xf'),'variableName'],'include':[{'model':'Variable','as':_0x8cb3('0xc'),'attributes':['id',_0x8cb3('0x7')]}]},{'model':_0x8cb3('0x8'),'as':_0x8cb3('0x10'),'attributes':['id','type','content',_0x8cb3('0x11'),_0x8cb3('0x12'),'customField',_0x8cb3('0xb')],'include':[{'model':_0x8cb3('0xc'),'as':_0x8cb3('0xc'),'attributes':['id',_0x8cb3('0x7')]}]},{'model':_0x8cb3('0x13'),'as':_0x8cb3('0x14'),'attributes':['id',_0x8cb3('0x7')]}]}]},'log':'GetDeskAccount'});};};
\ No newline at end of file
index f249fb6..90788a7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd4a2=['variableName','Descriptions','key','keyType','keyContent','Variable','idField','nameField','CloudProvider','data2','data5','../../client','Request','name','password','tenantId','clientId','clientSecret','serverUrl','description','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content'];(function(_0x26ec63,_0x1a78e0){var _0x361551=function(_0xafb9f2){while(--_0xafb9f2){_0x26ec63['push'](_0x26ec63['shift']());}};_0x361551(++_0x1a78e0);}(_0xd4a2,0x173));var _0x2d4a=function(_0x279c45,_0x37616e){_0x279c45=_0x279c45-0x0;var _0x580a88=_0xd4a2[_0x279c45];return _0x580a88;};'use strict';var client=require(_0x2d4a('0x0'));exports['getDynamics365Accounts']=function(){return function(_0x4e88a9){return client[_0x2d4a('0x1')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0x2d4a('0x2'),'username',_0x2d4a('0x3'),'remoteUri',_0x2d4a('0x4'),_0x2d4a('0x5'),_0x2d4a('0x6'),_0x2d4a('0x7'),_0x2d4a('0x8'),'modernAuthentication'],'include':[{'model':_0x2d4a('0x9'),'as':_0x2d4a('0xa'),'attributes':['id',_0x2d4a('0x2'),_0x2d4a('0xb'),_0x2d4a('0xc'),_0x2d4a('0xd'),_0x2d4a('0xe')],'include':[{'model':_0x2d4a('0xf'),'as':_0x2d4a('0x10'),'attributes':['id',_0x2d4a('0x11'),_0x2d4a('0x12'),_0x2d4a('0x13')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x2d4a('0x2')]}]},{'model':'Dynamics365Field','as':_0x2d4a('0x14'),'attributes':['id',_0x2d4a('0x11'),_0x2d4a('0x12'),_0x2d4a('0x15'),_0x2d4a('0x16'),_0x2d4a('0x17'),_0x2d4a('0x13')],'include':[{'model':_0x2d4a('0x18'),'as':'Variable','attributes':['id','name']}]},{'model':_0x2d4a('0xf'),'as':'Fields','attributes':['id',_0x2d4a('0x11'),_0x2d4a('0x12'),_0x2d4a('0x19'),_0x2d4a('0x1a'),'customField',_0x2d4a('0x13')],'include':[{'model':'Variable','as':_0x2d4a('0x18'),'attributes':['id','name']}]}]},{'model':_0x2d4a('0x1b'),'as':_0x2d4a('0x1b'),'attributes':['id',_0x2d4a('0x1c'),_0x2d4a('0x1d'),'data7']}]},'log':'GetDynamics365Account'});};};
\ No newline at end of file
+var _0x56bd=['keyType','keyContent','variableName','idField','nameField','customField','CloudProvider','data2','data5','getDynamics365Accounts','Request','name','username','password','remoteUri','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab','type','content','Variable','Dynamics365Field','Descriptions','key'];(function(_0x1cf049,_0x4137f6){var _0x4b10cd=function(_0x10161a){while(--_0x10161a){_0x1cf049['push'](_0x1cf049['shift']());}};_0x4b10cd(++_0x4137f6);}(_0x56bd,0xe9));var _0xd56b=function(_0x2c82d4,_0x5c7517){_0x2c82d4=_0x2c82d4-0x0;var _0x14e88e=_0x56bd[_0x2c82d4];return _0x14e88e;};'use strict';var client=require('../../client');exports[_0xd56b('0x0')]=function(){return function(_0x2535c1){return client[_0xd56b('0x1')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xd56b('0x2'),_0xd56b('0x3'),_0xd56b('0x4'),_0xd56b('0x5'),'tenantId',_0xd56b('0x6'),_0xd56b('0x7'),_0xd56b('0x8'),_0xd56b('0x9'),_0xd56b('0xa')],'include':[{'model':_0xd56b('0xb'),'as':_0xd56b('0xc'),'attributes':['id','name',_0xd56b('0xd'),_0xd56b('0xe'),_0xd56b('0xf'),_0xd56b('0x10')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id',_0xd56b('0x11'),_0xd56b('0x12'),'variableName'],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]},{'model':_0xd56b('0x14'),'as':_0xd56b('0x15'),'attributes':['id',_0xd56b('0x11'),_0xd56b('0x12'),_0xd56b('0x16'),_0xd56b('0x17'),_0xd56b('0x18'),_0xd56b('0x19')],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]},{'model':_0xd56b('0x14'),'as':'Fields','attributes':['id',_0xd56b('0x11'),'content',_0xd56b('0x1a'),_0xd56b('0x1b'),_0xd56b('0x1c'),_0xd56b('0x19')],'include':[{'model':_0xd56b('0x13'),'as':_0xd56b('0x13'),'attributes':['id',_0xd56b('0x2')]}]}]},{'model':_0xd56b('0x1d'),'as':_0xd56b('0x1d'),'attributes':['id',_0xd56b('0x1e'),_0xd56b('0x1f'),'data7']}]},'log':'GetDynamics365Account'});};};
\ No newline at end of file
index 337dcd4..c9f6b56 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x39d0=['serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type','content','variableName','Descriptions','key','keyContent','Variable','Fields','idField','nameField','../../client','Request','GetFreshdeskAccount','name','username','apiKey'];(function(_0x189305,_0x46c43f){var _0xea3406=function(_0x2aa435){while(--_0x2aa435){_0x189305['push'](_0x189305['shift']());}};_0xea3406(++_0x46c43f);}(_0x39d0,0x144));var _0x039d=function(_0xdfb2fd,_0x34b3e9){_0xdfb2fd=_0xdfb2fd-0x0;var _0x3452d5=_0x39d0[_0xdfb2fd];return _0x3452d5;};'use strict';var client=require(_0x039d('0x0'));exports['getFreshdeskAccounts']=function(){return function(_0x504d5e){return client[_0x039d('0x1')](_0x039d('0x2'),{'options':{'raw':![],'attributes':['id',_0x039d('0x3'),_0x039d('0x4'),_0x039d('0x5'),'remoteUri',_0x039d('0x6')],'include':[{'model':_0x039d('0x7'),'as':_0x039d('0x8'),'attributes':['id',_0x039d('0x3')],'include':[{'model':_0x039d('0x9'),'attributes':['id',_0x039d('0x3')]},{'model':_0x039d('0xa'),'as':_0x039d('0xb'),'attributes':['id',_0x039d('0xc'),_0x039d('0xd'),_0x039d('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x039d('0x3')]}]},{'model':'FreshdeskField','as':_0x039d('0xf'),'attributes':['id',_0x039d('0xc'),_0x039d('0xd'),_0x039d('0x10'),'keyType',_0x039d('0x11'),_0x039d('0xe')],'include':[{'model':_0x039d('0x12'),'as':'Variable','attributes':['id',_0x039d('0x3')]}]},{'model':_0x039d('0xa'),'as':_0x039d('0x13'),'attributes':['id',_0x039d('0xc'),_0x039d('0xd'),_0x039d('0x14'),_0x039d('0x15'),'customField','variableName'],'include':[{'model':_0x039d('0x12'),'as':_0x039d('0x12'),'attributes':['id',_0x039d('0x3')]}]}]}]},'log':_0x039d('0x2')});};};
\ No newline at end of file
+var _0x85d3=['../../client','getFreshdeskAccounts','GetFreshdeskAccount','name','username','apiKey','remoteUri','serverUrl','Configurations','Tag','FreshdeskField','Subjects','content','variableName','Variable','type','keyType','keyContent','idField','nameField'];(function(_0x11dee2,_0x1c4b11){var _0x3d11a3=function(_0x310adf){while(--_0x310adf){_0x11dee2['push'](_0x11dee2['shift']());}};_0x3d11a3(++_0x1c4b11);}(_0x85d3,0xc8));var _0x385d=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x85d3[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x385d('0x0'));exports[_0x385d('0x1')]=function(){return function(_0x4cb27a){return client['Request'](_0x385d('0x2'),{'options':{'raw':![],'attributes':['id',_0x385d('0x3'),_0x385d('0x4'),_0x385d('0x5'),_0x385d('0x6'),_0x385d('0x7')],'include':[{'model':'FreshdeskConfiguration','as':_0x385d('0x8'),'attributes':['id','name'],'include':[{'model':_0x385d('0x9'),'attributes':['id',_0x385d('0x3')]},{'model':_0x385d('0xa'),'as':_0x385d('0xb'),'attributes':['id','type',_0x385d('0xc'),_0x385d('0xd')],'include':[{'model':_0x385d('0xe'),'as':_0x385d('0xe'),'attributes':['id',_0x385d('0x3')]}]},{'model':_0x385d('0xa'),'as':'Descriptions','attributes':['id',_0x385d('0xf'),'content','key',_0x385d('0x10'),_0x385d('0x11'),_0x385d('0xd')],'include':[{'model':_0x385d('0xe'),'as':_0x385d('0xe'),'attributes':['id',_0x385d('0x3')]}]},{'model':_0x385d('0xa'),'as':'Fields','attributes':['id','type',_0x385d('0xc'),_0x385d('0x12'),_0x385d('0x13'),'customField',_0x385d('0xd')],'include':[{'model':_0x385d('0xe'),'as':_0x385d('0xe'),'attributes':['id',_0x385d('0x3')]}]}]}]},'log':_0x385d('0x2')});};};
\ No newline at end of file
index 42db388..c36cebe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeff8=['getFreshsalesAccounts','Request','GetFreshsalesAccount','name','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','FreshsalesField','Subjects','type','variableName','Variable','content','key','keyContent','../../client'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0xeff8,0x186));var _0x8eff=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xeff8[_0x2555d0];return _0x3bb486;};'use strict';var client=require(_0x8eff('0x0'));exports[_0x8eff('0x1')]=function(){return function(_0x50e01f){return client[_0x8eff('0x2')](_0x8eff('0x3'),{'options':{'raw':![],'attributes':['id',_0x8eff('0x4'),'username',_0x8eff('0x5'),_0x8eff('0x6'),_0x8eff('0x7')],'include':[{'model':_0x8eff('0x8'),'as':'Configurations','attributes':['id',_0x8eff('0x4')],'include':[{'model':_0x8eff('0x9'),'as':_0x8eff('0xa'),'attributes':['id',_0x8eff('0xb'),'content',_0x8eff('0xc')],'include':[{'model':_0x8eff('0xd'),'as':_0x8eff('0xd'),'attributes':['id',_0x8eff('0x4')]}]},{'model':'FreshsalesField','as':'Descriptions','attributes':['id',_0x8eff('0xb'),_0x8eff('0xe'),_0x8eff('0xf'),'keyType',_0x8eff('0x10'),_0x8eff('0xc')],'include':[{'model':'Variable','as':_0x8eff('0xd'),'attributes':['id',_0x8eff('0x4')]}]}]}]},'log':'GetFreshsalesccount'});};};
\ No newline at end of file
+var _0x5e0e=['GetFreshsalesAccount','name','username','apiKey','serverUrl','Configurations','FreshsalesField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','GetFreshsalesccount','../../client','getFreshsalesAccounts','Request'];(function(_0x3eb4a9,_0x359d73){var _0x48dbad=function(_0x3a3ca6){while(--_0x3a3ca6){_0x3eb4a9['push'](_0x3eb4a9['shift']());}};_0x48dbad(++_0x359d73);}(_0x5e0e,0x89));var _0xe5e0=function(_0x35c8f5,_0x399f44){_0x35c8f5=_0x35c8f5-0x0;var _0xb5c718=_0x5e0e[_0x35c8f5];return _0xb5c718;};'use strict';var client=require(_0xe5e0('0x0'));exports[_0xe5e0('0x1')]=function(){return function(_0x54701a){return client[_0xe5e0('0x2')](_0xe5e0('0x3'),{'options':{'raw':![],'attributes':['id',_0xe5e0('0x4'),_0xe5e0('0x5'),_0xe5e0('0x6'),'remoteUri',_0xe5e0('0x7')],'include':[{'model':'FreshsalesConfiguration','as':_0xe5e0('0x8'),'attributes':['id',_0xe5e0('0x4')],'include':[{'model':_0xe5e0('0x9'),'as':_0xe5e0('0xa'),'attributes':['id',_0xe5e0('0xb'),_0xe5e0('0xc'),'variableName'],'include':[{'model':_0xe5e0('0xd'),'as':_0xe5e0('0xd'),'attributes':['id','name']}]},{'model':_0xe5e0('0x9'),'as':_0xe5e0('0xe'),'attributes':['id',_0xe5e0('0xb'),_0xe5e0('0xc'),_0xe5e0('0xf'),_0xe5e0('0x10'),_0xe5e0('0x11'),_0xe5e0('0x12')],'include':[{'model':_0xe5e0('0xd'),'as':_0xe5e0('0xd'),'attributes':['id',_0xe5e0('0x4')]}]}]}]},'log':_0xe5e0('0x13')});};};
\ No newline at end of file
index c24145d..57e7ea3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb5d1=['moduleCreate','SalesforceField','Subjects','Variable','Descriptions','Fields','GetSalesforceAccount','../../client','getSalesforceAccounts','Request','name','username','password','remoteUri','clientSecret','securityToken','serverUrl','SalesforceConfiguration','Configurations'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb5d1,0x1e2));var _0x1b5d=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xb5d1[_0x13cab0];return _0x38804f;};'use strict';var client=require(_0x1b5d('0x0'));exports[_0x1b5d('0x1')]=function(){return function(_0x5963d2){return client[_0x1b5d('0x2')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id',_0x1b5d('0x3'),_0x1b5d('0x4'),_0x1b5d('0x5'),_0x1b5d('0x6'),'clientId',_0x1b5d('0x7'),_0x1b5d('0x8'),_0x1b5d('0x9'),'type'],'include':[{'model':_0x1b5d('0xa'),'as':_0x1b5d('0xb'),'attributes':['id',_0x1b5d('0x3'),'moduleSearch',_0x1b5d('0xc'),'ticketType','leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':_0x1b5d('0xd'),'as':_0x1b5d('0xe'),'include':[{'model':'Variable','as':_0x1b5d('0xf'),'attributes':['id',_0x1b5d('0x3')]}]},{'model':'SalesforceField','as':_0x1b5d('0x10'),'include':[{'model':_0x1b5d('0xf'),'as':_0x1b5d('0xf'),'attributes':['id',_0x1b5d('0x3')]}]},{'model':_0x1b5d('0xd'),'as':_0x1b5d('0x11'),'include':[{'model':_0x1b5d('0xf'),'as':_0x1b5d('0xf'),'attributes':['id',_0x1b5d('0x3')]}]}]}]},'log':_0x1b5d('0x12')});};};
\ No newline at end of file
+var _0xc23d=['remoteUri','clientId','clientSecret','securityToken','SalesforceConfiguration','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchContact','SalesforceField','Subjects','Variable','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','password'];(function(_0x214b38,_0x2bd3ea){var _0x5a2830=function(_0x4a27f9){while(--_0x4a27f9){_0x214b38['push'](_0x214b38['shift']());}};_0x5a2830(++_0x2bd3ea);}(_0xc23d,0x7f));var _0xdc23=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0xc23d[_0x44dba1];return _0x2fbd3f;};'use strict';var client=require(_0xdc23('0x0'));exports[_0xdc23('0x1')]=function(){return function(_0x3267f0){return client[_0xdc23('0x2')](_0xdc23('0x3'),{'options':{'raw':![],'attributes':['id',_0xdc23('0x4'),'username',_0xdc23('0x5'),_0xdc23('0x6'),_0xdc23('0x7'),_0xdc23('0x8'),_0xdc23('0x9'),'serverUrl','type'],'include':[{'model':_0xdc23('0xa'),'as':'Configurations','attributes':['id',_0xdc23('0x4'),'moduleSearch',_0xdc23('0xb'),_0xdc23('0xc'),_0xdc23('0xd'),_0xdc23('0xe'),_0xdc23('0xf'),'additionalSearchLead'],'include':[{'model':_0xdc23('0x10'),'as':_0xdc23('0x11'),'include':[{'model':_0xdc23('0x12'),'as':_0xdc23('0x12'),'attributes':['id',_0xdc23('0x4')]}]},{'model':_0xdc23('0x10'),'as':'Descriptions','include':[{'model':_0xdc23('0x12'),'as':_0xdc23('0x12'),'attributes':['id',_0xdc23('0x4')]}]},{'model':_0xdc23('0x10'),'as':'Fields','include':[{'model':_0xdc23('0x12'),'as':_0xdc23('0x12'),'attributes':['id',_0xdc23('0x4')]}]}]}]},'log':_0xdc23('0x3')});};};
\ No newline at end of file
index be8871d..3bd9914 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc4aa=['keyContent','Fields','content','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','GetServicenowAccount','name','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','variableName','Variable','Descriptions','type','key'];(function(_0x123831,_0x8fe1d6){var _0x47455b=function(_0x36f9ab){while(--_0x36f9ab){_0x123831['push'](_0x123831['shift']());}};_0x47455b(++_0x8fe1d6);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(_0x40a0d0){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),'description','username','password',_0xac4a('0x5'),_0xac4a('0x6'),_0xac4a('0x7')],'include':[{'model':_0xac4a('0x8'),'as':_0xac4a('0x9'),'attributes':['id',_0xac4a('0x4')],'include':[{'model':_0xac4a('0xa'),'as':_0xac4a('0xb'),'attributes':['id','type','content',_0xac4a('0xc')],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id','name']}]},{'model':_0xac4a('0xa'),'as':_0xac4a('0xe'),'attributes':['id',_0xac4a('0xf'),'content',_0xac4a('0x10'),'keyType',_0xac4a('0x11'),'variableName'],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id',_0xac4a('0x4')]}]},{'model':'ServicenowField','as':_0xac4a('0x12'),'attributes':['id',_0xac4a('0xf'),_0xac4a('0x13'),_0xac4a('0x14'),_0xac4a('0x15'),_0xac4a('0x16'),_0xac4a('0xc')],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id',_0xac4a('0x4')]}]}]}]},'log':_0xac4a('0x17')});};};
\ No newline at end of file
+var _0x1967=['description','username','password','email','remoteUri','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyType','keyContent','Fields','idField','nameField','customField','GetServicenowkAccount','getServicenowAccounts','Request','GetServicenowAccount','name'];(function(_0x285d0b,_0x403a0a){var _0xc344a=function(_0x5f4e90){while(--_0x5f4e90){_0x285d0b['push'](_0x285d0b['shift']());}};_0xc344a(++_0x403a0a);}(_0x1967,0x173));var _0x7196=function(_0x541b73,_0x2ca1f8){_0x541b73=_0x541b73-0x0;var _0x271e67=_0x1967[_0x541b73];return _0x271e67;};'use strict';var client=require('../../client');exports[_0x7196('0x0')]=function(){return function(_0xdb72bb){return client[_0x7196('0x1')](_0x7196('0x2'),{'options':{'raw':![],'attributes':['id',_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),'serverUrl'],'include':[{'model':_0x7196('0x9'),'as':_0x7196('0xa'),'attributes':['id',_0x7196('0x3')],'include':[{'model':_0x7196('0xb'),'as':_0x7196('0xc'),'attributes':['id',_0x7196('0xd'),'content',_0x7196('0xe')],'include':[{'model':_0x7196('0xf'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0xb'),'as':'Descriptions','attributes':['id','type',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0xe')],'include':[{'model':_0x7196('0xf'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0xb'),'as':_0x7196('0x14'),'attributes':['id',_0x7196('0xd'),'content',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0xe')],'include':[{'model':'Variable','as':_0x7196('0xf'),'attributes':['id','name']}]}]}]},'log':_0x7196('0x18')});};};
\ No newline at end of file
index e06120e..4da70d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0b0e=['Configurations','SugarcrmField','Subjects','variableName','Variable','Descriptions','type','key','keyType','Fields','content','idField','customField','../../client','GetSugarcrmAccount','name','username','password','remoteUri','serverUrl','SugarcrmConfiguration'];(function(_0x1d1f80,_0x2c87c0){var _0x380d8b=function(_0x1bb4c8){while(--_0x1bb4c8){_0x1d1f80['push'](_0x1d1f80['shift']());}};_0x380d8b(++_0x2c87c0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x2300c7,_0x255f74){_0x2300c7=_0x2300c7-0x0;var _0x23f720=_0x0b0e[_0x2300c7];return _0x23f720;};'use strict';var client=require(_0xe0b0('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0xc416e3){return client['Request'](_0xe0b0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6')],'include':[{'model':_0xe0b0('0x7'),'as':_0xe0b0('0x8'),'attributes':['id',_0xe0b0('0x2')],'include':[{'model':_0xe0b0('0x9'),'as':_0xe0b0('0xa'),'attributes':['id','type','content',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]},{'model':'SugarcrmField','as':_0xe0b0('0xd'),'attributes':['id',_0xe0b0('0xe'),'content',_0xe0b0('0xf'),_0xe0b0('0x10'),'keyContent',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id','name']}]},{'model':_0xe0b0('0x9'),'as':_0xe0b0('0x11'),'attributes':['id',_0xe0b0('0xe'),_0xe0b0('0x12'),_0xe0b0('0x13'),'nameField',_0xe0b0('0x14'),_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]}]}]},'log':'GetSugarcrmAccount'});};};
\ No newline at end of file
+var _0x5f2f=['username','password','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','variableName','Variable','Descriptions','key','Fields','content','idField','customField','../../client','getSugarcrmAccounts','Request','GetSugarcrmAccount','name'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x5f2f,0x73));var _0xf5f2=function(_0x33163b,_0x1d6506){_0x33163b=_0x33163b-0x0;var _0x3d982a=_0x5f2f[_0x33163b];return _0x3d982a;};'use strict';var client=require(_0xf5f2('0x0'));exports[_0xf5f2('0x1')]=function(){return function(_0x2dcf60){return client[_0xf5f2('0x2')](_0xf5f2('0x3'),{'options':{'raw':![],'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),'remoteUri','serverUrl'],'include':[{'model':_0xf5f2('0x7'),'as':_0xf5f2('0x8'),'attributes':['id',_0xf5f2('0x4')],'include':[{'model':_0xf5f2('0x9'),'as':_0xf5f2('0xa'),'attributes':['id',_0xf5f2('0xb'),'content',_0xf5f2('0xc')],'include':[{'model':_0xf5f2('0xd'),'as':_0xf5f2('0xd'),'attributes':['id','name']}]},{'model':_0xf5f2('0x9'),'as':_0xf5f2('0xe'),'attributes':['id',_0xf5f2('0xb'),'content',_0xf5f2('0xf'),'keyType','keyContent',_0xf5f2('0xc')],'include':[{'model':_0xf5f2('0xd'),'as':'Variable','attributes':['id',_0xf5f2('0x4')]}]},{'model':_0xf5f2('0x9'),'as':_0xf5f2('0x10'),'attributes':['id',_0xf5f2('0xb'),_0xf5f2('0x11'),_0xf5f2('0x12'),'nameField',_0xf5f2('0x13'),_0xf5f2('0xc')],'include':[{'model':_0xf5f2('0xd'),'as':_0xf5f2('0xd'),'attributes':['id',_0xf5f2('0x4')]}]}]}]},'log':'GetSugarcrmAccount'});};};
\ No newline at end of file
index d788076..a967070 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x00cb=['Variable','Descriptions','key','keyType','keyContent','idField','nameField','customField','GetVtigerAccount','getVtigerAccounts','Request','name','description','username','accessKey','remoteUri','serverUrl','Configurations','VtigerField','type','content','variableName'];(function(_0x22f164,_0xaa4f80){var _0x51ab95=function(_0x190b68){while(--_0x190b68){_0x22f164['push'](_0x22f164['shift']());}};_0x51ab95(++_0xaa4f80);}(_0x00cb,0xfb));var _0xb00c=function(_0x26c0c8,_0x272361){_0x26c0c8=_0x26c0c8-0x0;var _0x2c6303=_0x00cb[_0x26c0c8];return _0x2c6303;};'use strict';var client=require('../../client');exports[_0xb00c('0x0')]=function(){return function(_0x26ee32){return client[_0xb00c('0x1')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0xb00c('0x2'),_0xb00c('0x3'),_0xb00c('0x4'),_0xb00c('0x5'),_0xb00c('0x6'),_0xb00c('0x7')],'include':[{'model':'VtigerConfiguration','as':_0xb00c('0x8'),'attributes':['id',_0xb00c('0x2')],'include':[{'model':_0xb00c('0x9'),'as':'Subjects','attributes':['id',_0xb00c('0xa'),_0xb00c('0xb'),_0xb00c('0xc')],'include':[{'model':_0xb00c('0xd'),'as':_0xb00c('0xd'),'attributes':['id',_0xb00c('0x2')]}]},{'model':'VtigerField','as':_0xb00c('0xe'),'attributes':['id',_0xb00c('0xa'),_0xb00c('0xb'),_0xb00c('0xf'),_0xb00c('0x10'),_0xb00c('0x11'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xb00c('0x2')]}]},{'model':_0xb00c('0x9'),'as':'Fields','attributes':['id',_0xb00c('0xa'),_0xb00c('0xb'),_0xb00c('0x12'),_0xb00c('0x13'),_0xb00c('0x14'),_0xb00c('0xc')],'include':[{'model':_0xb00c('0xd'),'as':_0xb00c('0xd'),'attributes':['id',_0xb00c('0x2')]}]}]}]},'log':_0xb00c('0x15')});};};
\ No newline at end of file
+var _0x4cc5=['serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','Variable','key','keyType','keyContent','content','idField','nameField','customField','GetVtigerAccount','../../client','getVtigerAccounts','Request','name','description','accessKey'];(function(_0x268b06,_0x446ed1){var _0x31d48b=function(_0x368c0a){while(--_0x368c0a){_0x268b06['push'](_0x268b06['shift']());}};_0x31d48b(++_0x446ed1);}(_0x4cc5,0x120));var _0x54cc=function(_0x178369,_0x2fe0a5){_0x178369=_0x178369-0x0;var _0x2984e4=_0x4cc5[_0x178369];return _0x2984e4;};'use strict';var client=require(_0x54cc('0x0'));exports[_0x54cc('0x1')]=function(){return function(_0x125866){return client[_0x54cc('0x2')]('GetVtigerAccount',{'options':{'raw':![],'attributes':['id',_0x54cc('0x3'),_0x54cc('0x4'),'username',_0x54cc('0x5'),'remoteUri',_0x54cc('0x6')],'include':[{'model':_0x54cc('0x7'),'as':_0x54cc('0x8'),'attributes':['id',_0x54cc('0x3')],'include':[{'model':_0x54cc('0x9'),'as':_0x54cc('0xa'),'attributes':['id',_0x54cc('0xb'),'content','variableName'],'include':[{'model':_0x54cc('0xc'),'as':_0x54cc('0xc'),'attributes':['id',_0x54cc('0x3')]}]},{'model':_0x54cc('0x9'),'as':'Descriptions','attributes':['id',_0x54cc('0xb'),'content',_0x54cc('0xd'),_0x54cc('0xe'),_0x54cc('0xf'),'variableName'],'include':[{'model':_0x54cc('0xc'),'as':_0x54cc('0xc'),'attributes':['id',_0x54cc('0x3')]}]},{'model':_0x54cc('0x9'),'as':'Fields','attributes':['id',_0x54cc('0xb'),_0x54cc('0x10'),_0x54cc('0x11'),_0x54cc('0x12'),_0x54cc('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x54cc('0xc'),'attributes':['id',_0x54cc('0x3')]}]}]}]},'log':_0x54cc('0x14')});};};
\ No newline at end of file
index 2a2207c..6afd7bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x660b=['token','authType','serverUrl','type','ZendeskConfiguration','Tag','ZendeskField','content','variableName','Descriptions','keyType','keyContent','Variable','idField','nameField','customField','getZendeskAccounts','Request','GetZendeskAccount','name','username','password'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x660b,0x94));var _0xb660=function(_0x10d5c1,_0x114086){_0x10d5c1=_0x10d5c1-0x0;var _0x1054b9=_0x660b[_0x10d5c1];return _0x1054b9;};'use strict';var client=require('../../client');exports[_0xb660('0x0')]=function(){return function(_0x2a97b0){return client[_0xb660('0x1')](_0xb660('0x2'),{'options':{'raw':![],'attributes':['id',_0xb660('0x3'),_0xb660('0x4'),_0xb660('0x5'),_0xb660('0x6'),'remoteUri',_0xb660('0x7'),_0xb660('0x8'),_0xb660('0x9')],'include':[{'model':_0xb660('0xa'),'as':'Configurations','attributes':['id',_0xb660('0x3')],'include':[{'model':_0xb660('0xb'),'attributes':['id',_0xb660('0x3')]},{'model':_0xb660('0xc'),'as':'Subjects','attributes':['id',_0xb660('0x9'),_0xb660('0xd'),_0xb660('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xb660('0x3')]}]},{'model':_0xb660('0xc'),'as':_0xb660('0xf'),'attributes':['id','type','content','key',_0xb660('0x10'),_0xb660('0x11'),'variableName'],'include':[{'model':_0xb660('0x12'),'as':_0xb660('0x12'),'attributes':['id',_0xb660('0x3')]}]},{'model':_0xb660('0xc'),'as':'Fields','attributes':['id',_0xb660('0x9'),_0xb660('0xd'),_0xb660('0x13'),_0xb660('0x14'),_0xb660('0x15'),_0xb660('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xb660('0x3')]}]}]}]},'log':_0xb660('0x2')});};};
\ No newline at end of file
+var _0xccd6=['Descriptions','keyContent','idField','nameField','customField','getZendeskAccounts','Request','GetZendeskAccount','name','token','remoteUri','authType','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','content','variableName','Variable'];(function(_0x3d07f2,_0x19854d){var _0x26052a=function(_0x213834){while(--_0x213834){_0x3d07f2['push'](_0x3d07f2['shift']());}};_0x26052a(++_0x19854d);}(_0xccd6,0x91));var _0x6ccd=function(_0x44f91e,_0x47e2eb){_0x44f91e=_0x44f91e-0x0;var _0x33a0bd=_0xccd6[_0x44f91e];return _0x33a0bd;};'use strict';var client=require('../../client');exports[_0x6ccd('0x0')]=function(){return function(_0x14e30b){return client[_0x6ccd('0x1')](_0x6ccd('0x2'),{'options':{'raw':![],'attributes':['id',_0x6ccd('0x3'),'username','password',_0x6ccd('0x4'),_0x6ccd('0x5'),_0x6ccd('0x6'),'serverUrl',_0x6ccd('0x7')],'include':[{'model':_0x6ccd('0x8'),'as':_0x6ccd('0x9'),'attributes':['id',_0x6ccd('0x3')],'include':[{'model':_0x6ccd('0xa'),'attributes':['id',_0x6ccd('0x3')]},{'model':_0x6ccd('0xb'),'as':'Subjects','attributes':['id',_0x6ccd('0x7'),_0x6ccd('0xc'),_0x6ccd('0xd')],'include':[{'model':_0x6ccd('0xe'),'as':_0x6ccd('0xe'),'attributes':['id',_0x6ccd('0x3')]}]},{'model':_0x6ccd('0xb'),'as':_0x6ccd('0xf'),'attributes':['id',_0x6ccd('0x7'),'content','key','keyType',_0x6ccd('0x10'),_0x6ccd('0xd')],'include':[{'model':_0x6ccd('0xe'),'as':_0x6ccd('0xe'),'attributes':['id',_0x6ccd('0x3')]}]},{'model':_0x6ccd('0xb'),'as':'Fields','attributes':['id','type',_0x6ccd('0xc'),_0x6ccd('0x11'),_0x6ccd('0x12'),_0x6ccd('0x13'),_0x6ccd('0xd')],'include':[{'model':'Variable','as':_0x6ccd('0xe'),'attributes':['id','name']}]}]}]},'log':'GetZendeskAccount'});};};
\ No newline at end of file
index b5d048d..7e1fce9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb72b=['host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleCreate','ZohoField','Subjects','type','content','variableName','Variable','name','Descriptions','keyType','Fields','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','description'];(function(_0x3fea87,_0x5917e4){var _0x5c5a53=function(_0x3b8ceb){while(--_0x3b8ceb){_0x3fea87['push'](_0x3fea87['shift']());}};_0x5c5a53(++_0x5917e4);}(_0xb72b,0xbf));var _0xbb72=function(_0x56857c,_0x4868cb){_0x56857c=_0x56857c-0x0;var _0x4027e7=_0xb72b[_0x56857c];return _0x4027e7;};'use strict';var client=require(_0xbb72('0x0'));exports[_0xbb72('0x1')]=function(){return function(_0x1af102){return client[_0xbb72('0x2')](_0xbb72('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xbb72('0x4'),_0xbb72('0x5'),_0xbb72('0x6'),_0xbb72('0x7'),_0xbb72('0x8'),_0xbb72('0x9'),_0xbb72('0xa'),_0xbb72('0xb')],'include':[{'model':_0xbb72('0xc'),'as':_0xbb72('0xd'),'attributes':['id','name',_0xbb72('0xe'),'moduleSearch',_0xbb72('0x4')],'include':[{'model':_0xbb72('0xf'),'as':_0xbb72('0x10'),'attributes':['id',_0xbb72('0x11'),_0xbb72('0x12'),_0xbb72('0x13')],'include':[{'model':_0xbb72('0x14'),'as':'Variable','attributes':['id',_0xbb72('0x15')]}]},{'model':_0xbb72('0xf'),'as':_0xbb72('0x16'),'attributes':['id',_0xbb72('0x11'),_0xbb72('0x12'),'key',_0xbb72('0x17'),'keyContent',_0xbb72('0x13')],'include':[{'model':'Variable','as':_0xbb72('0x14'),'attributes':['id',_0xbb72('0x15')]}]},{'model':_0xbb72('0xf'),'as':_0xbb72('0x18'),'attributes':['id',_0xbb72('0x11'),_0xbb72('0x12'),_0xbb72('0x19'),_0xbb72('0x1a'),_0xbb72('0x1b'),_0xbb72('0x13')],'include':[{'model':_0xbb72('0x14'),'as':_0xbb72('0x14'),'attributes':['id',_0xbb72('0x15')]}]}]}]},'log':_0xbb72('0x3')});};};
\ No newline at end of file
+var _0xd197=['clientSecret','code','ZohoConfiguration','Configurations','moduleCreate','moduleSearch','type','variableName','Variable','ZohoField','Descriptions','key','keyType','keyContent','Fields','content','idField','nameField','customField','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd197,0xd7));var _0x7d19=function(_0x4af95b,_0x342c7b){_0x4af95b=_0x4af95b-0x0;var _0x269f19=_0xd197[_0x4af95b];return _0x269f19;};'use strict';var client=require(_0x7d19('0x0'));exports[_0x7d19('0x1')]=function(){return function(_0x27c12e){return client[_0x7d19('0x2')](_0x7d19('0x3'),{'options':{'raw':![],'attributes':['id',_0x7d19('0x4'),_0x7d19('0x5'),_0x7d19('0x6'),_0x7d19('0x7'),_0x7d19('0x8'),_0x7d19('0x9'),'serverUrl',_0x7d19('0xa'),'refreshToken'],'include':[{'model':_0x7d19('0xb'),'as':_0x7d19('0xc'),'attributes':['id',_0x7d19('0x4'),_0x7d19('0xd'),_0x7d19('0xe'),_0x7d19('0x5')],'include':[{'model':'ZohoField','as':'Subjects','attributes':['id',_0x7d19('0xf'),'content',_0x7d19('0x10')],'include':[{'model':'Variable','as':_0x7d19('0x11'),'attributes':['id',_0x7d19('0x4')]}]},{'model':_0x7d19('0x12'),'as':_0x7d19('0x13'),'attributes':['id',_0x7d19('0xf'),'content',_0x7d19('0x14'),_0x7d19('0x15'),_0x7d19('0x16'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x7d19('0x4')]}]},{'model':_0x7d19('0x12'),'as':_0x7d19('0x17'),'attributes':['id',_0x7d19('0xf'),_0x7d19('0x18'),_0x7d19('0x19'),_0x7d19('0x1a'),_0x7d19('0x1b'),'variableName'],'include':[{'model':_0x7d19('0x11'),'as':_0x7d19('0x11'),'attributes':['id',_0x7d19('0x4')]}]}]}]},'log':_0x7d19('0x3')});};};
\ No newline at end of file
index 408a356..8d5ecee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe028=['map','interval','concat','Request','IntervalIftime','stack','replace','trim','silly','intervalIftime\x20called\x20with','length','resolve','number','every'];(function(_0x14f80e,_0x8a517b){var _0x5a4738=function(_0xecb281){while(--_0xecb281){_0x14f80e['push'](_0x14f80e['shift']());}};_0x5a4738(++_0x8a517b);}(_0xe028,0x1e1));var _0x8e02=function(_0x381cf9,_0x59f13c){_0x381cf9=_0x381cf9-0x0;var _0x3a97ee=_0xe028[_0x381cf9];return _0x3a97ee;};var logger=require('../../../config/logger')('dialer');var client=require('../client');function intervalIftime(_0x5c4333,_0x178347){const _0x2dc7a2=new Error()[_0x8e02('0x0')][_0x8e02('0x1')](/^Error/,'')[_0x8e02('0x2')]();logger[_0x8e02('0x3')](_0x8e02('0x4'),_0x5c4333,_0x178347,_0x2dc7a2);const _0x2600e2=Array['isArray'](_0x5c4333);if(!_0x5c4333||_0x2600e2&&_0x5c4333[_0x8e02('0x5')]===0x0){return Promise[_0x8e02('0x6')](![]);}else{var _0x403c5f=[];var _0x7d9d15=[];var _0x1219ac=_0x2600e2?_0x5c4333:[_0x5c4333];var _0x4379b5=_0x1219ac['every'](function(_0x45ff3a){return typeof _0x45ff3a===_0x8e02('0x7');});var _0x345b5f=_0x1219ac[_0x8e02('0x8')](function(_0x46b286){return typeof _0x46b286==='string';});if(!_0x4379b5&&!_0x345b5f){_0x403c5f=_0x1219ac['map'](function(_0x22a508){return _0x22a508['id'];});if(_0x403c5f[_0x8e02('0x5')]===0x0){_0x7d9d15=_0x1219ac[_0x8e02('0x9')](function(_0x8baa1a){return _0x8baa1a[_0x8e02('0xa')];});}}else{if(_0x4379b5){_0x403c5f=_0x403c5f['concat'](_0x1219ac);}if(_0x345b5f){_0x7d9d15=_0x7d9d15[_0x8e02('0xb')](_0x1219ac);}}return client[_0x8e02('0xc')](_0x8e02('0xd'),{'intervalIds':_0x403c5f,'intervals':_0x7d9d15,'timezone':_0x178347,'log':'IntervalIftime'});}}exports['intervalIftime']=intervalIftime;
\ No newline at end of file
+var _0x10fc=['map','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','stack','intervalIftime\x20called\x20with','isArray','length','resolve','every','number','string'];(function(_0x40d708,_0x3cee5e){var _0x418671=function(_0x5e0f5f){while(--_0x5e0f5f){_0x40d708['push'](_0x40d708['shift']());}};_0x418671(++_0x3cee5e);}(_0x10fc,0x165));var _0xc10f=function(_0x29d802,_0x559187){_0x29d802=_0x29d802-0x0;var _0x5afb3f=_0x10fc[_0x29d802];return _0x5afb3f;};var logger=require(_0xc10f('0x0'))(_0xc10f('0x1'));var client=require(_0xc10f('0x2'));function intervalIftime(_0x45217c,_0x46974f){const _0xd87a96=new Error()[_0xc10f('0x3')]['replace'](/^Error/,'')['trim']();logger['silly'](_0xc10f('0x4'),_0x45217c,_0x46974f,_0xd87a96);const _0x158154=Array[_0xc10f('0x5')](_0x45217c);if(!_0x45217c||_0x158154&&_0x45217c[_0xc10f('0x6')]===0x0){return Promise[_0xc10f('0x7')](![]);}else{var _0x1c6c73=[];var _0x4980d7=[];var _0x80035e=_0x158154?_0x45217c:[_0x45217c];var _0xb806cb=_0x80035e[_0xc10f('0x8')](function(_0x2a9e22){return typeof _0x2a9e22===_0xc10f('0x9');});var _0x6f6b8c=_0x80035e['every'](function(_0x35cb29){return typeof _0x35cb29===_0xc10f('0xa');});if(!_0xb806cb&&!_0x6f6b8c){_0x1c6c73=_0x80035e[_0xc10f('0xb')](function(_0x3d35be){return _0x3d35be['id'];});if(_0x1c6c73[_0xc10f('0x6')]===0x0){_0x4980d7=_0x80035e[_0xc10f('0xb')](function(_0x88e65d){return _0x88e65d['interval'];});}}else{if(_0xb806cb){_0x1c6c73=_0x1c6c73[_0xc10f('0xc')](_0x80035e);}if(_0x6f6b8c){_0x4980d7=_0x4980d7[_0xc10f('0xc')](_0x80035e);}}return client[_0xc10f('0xd')](_0xc10f('0xe'),{'intervalIds':_0x1c6c73,'intervals':_0x4980d7,'timezone':_0x46974f,'log':'IntervalIftime'});}}exports[_0xc10f('0xf')]=intervalIftime;
\ No newline at end of file
index b7fd528..0414610 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdfdb=['agent','uniqueid','moment','util','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','format','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','toNumber','accountcode','membername','starttime','endtime','diff','dialstring'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xdfdb,0xa4));var _0xbdfd=function(_0x373202,_0x1a1fd4){_0x373202=_0x373202-0x0;var _0x5e90ab=_0xdfdb[_0x373202];return _0x5e90ab;};'use strict';var moment=require(_0xbdfd('0x0'));var _=require('lodash');var util=require(_0xbdfd('0x1'));var client=require('../client');exports[_0xbdfd('0x2')]=function(_0x48779c){var _0x366361=_0x48779c[_0xbdfd('0x3')]||_0x48779c['queuecallerexitAt'];return client[_0xbdfd('0x4')](_0xbdfd('0x5'),{'body':{'channel':_0xbdfd('0x6'),'membername':_0x48779c[_0xbdfd('0x7')],'interface':_['isNil'](_0x48779c[_0xbdfd('0x8')])?util[_0xbdfd('0x9')](_0xbdfd('0xa'),_0x48779c[_0xbdfd('0x7')]):_0x48779c[_0xbdfd('0x8')],'type':_0xbdfd('0xb'),'enterAt':_0x48779c[_0xbdfd('0xc')],'exitAt':_0x366361,'duration':moment(_0x366361)['diff'](_0x48779c[_0xbdfd('0xc')],_0xbdfd('0xd')),'data1':_0xbdfd('0xe'),'data2':_0x48779c[_0xbdfd('0xf')],'data3':_0x48779c[_0xbdfd('0x10')],'data4':null,'data5':_0x48779c[_0xbdfd('0x11')],'role':'agent','internal':_0x48779c['accountcode']?_[_0xbdfd('0x12')](_0x48779c[_0xbdfd('0x13')]):undefined,'uniqueid':_0x48779c['uniqueid']},'log':_0xbdfd('0x5')});};exports['voiceDialReport']=function(_0x887546){return client['Request']('CreateMemberReport',{'body':{'channel':_0xbdfd('0x6'),'membername':_0x887546[_0xbdfd('0x14')],'interface':_0x887546[_0xbdfd('0x8')],'type':'TALKING','enterAt':_0x887546[_0xbdfd('0x15')],'exitAt':_0x887546[_0xbdfd('0x16')],'duration':moment(_0x887546[_0xbdfd('0x16')])[_0xbdfd('0x17')](_0x887546['starttime'],'seconds')>=0x0?moment(_0x887546['endtime'])[_0xbdfd('0x17')](_0x887546[_0xbdfd('0x15')],_0xbdfd('0xd')):null,'data1':'outbound','data2':_0x887546[_0xbdfd('0x13')],'data3':_0x887546[_0xbdfd('0x10')],'data4':_0x887546[_0xbdfd('0x18')]||null,'role':_0xbdfd('0x19'),'internal':_0x887546[_0xbdfd('0x13')]?_['toNumber'](_0x887546[_0xbdfd('0x13')]):undefined,'uniqueid':_0x887546[_0xbdfd('0x1a')]},'log':_0xbdfd('0x5')});};
\ No newline at end of file
+var _0xb1f9=['isNil','interface','format','lastAssignedTo','TALKING','diff','queuecallerleaveAt','seconds','inbound','calleridnum','agent','accountcode','toNumber','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','outbound','dialstring','lodash','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','voice'];(function(_0x21d6d8,_0x361b89){var _0x4124a7=function(_0x2f69f1){while(--_0x2f69f1){_0x21d6d8['push'](_0x21d6d8['shift']());}};_0x4124a7(++_0x361b89);}(_0xb1f9,0x1e0));var _0x9b1f=function(_0x366d31,_0x4833df){_0x366d31=_0x366d31-0x0;var _0x45bcaf=_0xb1f9[_0x366d31];return _0x45bcaf;};'use strict';var moment=require('moment');var _=require(_0x9b1f('0x0'));var util=require('util');var client=require(_0x9b1f('0x1'));exports[_0x9b1f('0x2')]=function(_0x27e97e){var _0x1daf33=_0x27e97e[_0x9b1f('0x3')]||_0x27e97e[_0x9b1f('0x4')];return client['Request']('CreateMemberReport',{'body':{'channel':_0x9b1f('0x5'),'membername':_0x27e97e['lastAssignedTo'],'interface':_[_0x9b1f('0x6')](_0x27e97e[_0x9b1f('0x7')])?util[_0x9b1f('0x8')]('SIP/%s',_0x27e97e[_0x9b1f('0x9')]):_0x27e97e[_0x9b1f('0x7')],'type':_0x9b1f('0xa'),'enterAt':_0x27e97e['queuecallerleaveAt'],'exitAt':_0x1daf33,'duration':moment(_0x1daf33)[_0x9b1f('0xb')](_0x27e97e[_0x9b1f('0xc')],_0x9b1f('0xd')),'data1':_0x9b1f('0xe'),'data2':_0x27e97e[_0x9b1f('0xf')],'data3':_0x27e97e['exten'],'data4':null,'data5':_0x27e97e['queue'],'role':_0x9b1f('0x10'),'internal':_0x27e97e[_0x9b1f('0x11')]?_[_0x9b1f('0x12')](_0x27e97e[_0x9b1f('0x11')]):undefined,'uniqueid':_0x27e97e[_0x9b1f('0x13')]},'log':_0x9b1f('0x14')});};exports[_0x9b1f('0x15')]=function(_0x400a19){return client['Request'](_0x9b1f('0x14'),{'body':{'channel':_0x9b1f('0x5'),'membername':_0x400a19[_0x9b1f('0x16')],'interface':_0x400a19[_0x9b1f('0x7')],'type':_0x9b1f('0xa'),'enterAt':_0x400a19[_0x9b1f('0x17')],'exitAt':_0x400a19[_0x9b1f('0x18')],'duration':moment(_0x400a19['endtime'])[_0x9b1f('0xb')](_0x400a19['starttime'],_0x9b1f('0xd'))>=0x0?moment(_0x400a19[_0x9b1f('0x18')])[_0x9b1f('0xb')](_0x400a19[_0x9b1f('0x17')],_0x9b1f('0xd')):null,'data1':_0x9b1f('0x19'),'data2':_0x400a19[_0x9b1f('0x11')],'data3':_0x400a19['exten'],'data4':_0x400a19[_0x9b1f('0x1a')]||null,'role':_0x9b1f('0x10'),'internal':_0x400a19['accountcode']?_['toNumber'](_0x400a19[_0x9b1f('0x11')]):undefined,'uniqueid':_0x400a19['uniqueid']},'log':_0x9b1f('0x14')});};
\ No newline at end of file
index d9b8e97..69cf83f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8f4c=['getSettings','Request','ShowSetting','stopRecordingOnTransfer','previewRecallmeReminderInterval','../client'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x8f4c,0x113));var _0xc8f4=function(_0x77df1,_0x291f5d){_0x77df1=_0x77df1-0x0;var _0x19e186=_0x8f4c[_0x77df1];return _0x19e186;};'use strict';var client=require(_0xc8f4('0x0'));exports[_0xc8f4('0x1')]=function(){return client[_0xc8f4('0x2')](_0xc8f4('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc8f4('0x4'),_0xc8f4('0x5')]},'log':'GetSettings'});};
\ No newline at end of file
+var _0xd10f=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer','GetSettings'];(function(_0x18abd2,_0x22d4b3){var _0x1dcad6=function(_0xcc08c4){while(--_0xcc08c4){_0x18abd2['push'](_0x18abd2['shift']());}};_0x1dcad6(++_0x22d4b3);}(_0xd10f,0x198));var _0xfd10=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xd10f[_0x167cc1];return _0x10bc4b;};'use strict';var client=require(_0xfd10('0x0'));exports[_0xfd10('0x1')]=function(){return client[_0xfd10('0x2')](_0xfd10('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xfd10('0x4'),'previewRecallmeReminderInterval']},'log':_0xfd10('0x5')});};
\ No newline at end of file
index 96f0ef9..b7062e5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d75=['GetTemplate','html','getTemplates'];(function(_0x29bb08,_0x13eb10){var _0x115afb=function(_0x459308){while(--_0x459308){_0x29bb08['push'](_0x29bb08['shift']());}};_0x115afb(++_0x13eb10);}(_0x2d75,0xa4));var _0x52d7=function(_0x5f4ce2,_0x42c469){_0x5f4ce2=_0x5f4ce2-0x0;var _0x219b5b=_0x2d75[_0x5f4ce2];return _0x219b5b;};'use strict';var client=require('../client');exports[_0x52d7('0x0')]=function(_0x254801){return function(_0x3cb070){return client['Request'](_0x52d7('0x1'),{'options':{'raw':!![],'attributes':['id','name',_0x52d7('0x2')]},'log':_0x52d7('0x1')});};};
\ No newline at end of file
+var _0x2a6f=['name','html','../client','getTemplates','GetTemplate'];(function(_0x2a0bc2,_0x33f79b){var _0x840555=function(_0x1171d3){while(--_0x1171d3){_0x2a0bc2['push'](_0x2a0bc2['shift']());}};_0x840555(++_0x33f79b);}(_0x2a6f,0x15b));var _0xf2a6=function(_0x835403,_0x5849d6){_0x835403=_0x835403-0x0;var _0x4fe54e=_0x2a6f[_0x835403];return _0x4fe54e;};'use strict';var client=require(_0xf2a6('0x0'));exports[_0xf2a6('0x1')]=function(_0x34ea6d){return function(_0x33ae40){return client['Request'](_0xf2a6('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf2a6('0x3'),_0xf2a6('0x4')]},'log':_0xf2a6('0x2')});};};
\ No newline at end of file
index 81bd622..c4d86e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xedf9=['Condition','AllConditions','operator','value','AnyConditions','Actions','action','data1','data3','data4','data5','data7','../client','getTriggers','Request','GetTrigger','name','status'];(function(_0x1bc4d4,_0x10d4be){var _0xc94db5=function(_0x5beac4){while(--_0x5beac4){_0x1bc4d4['push'](_0x1bc4d4['shift']());}};_0xc94db5(++_0x10d4be);}(_0xedf9,0x108));var _0x9edf=function(_0x1b3ed9,_0x23c04){_0x1b3ed9=_0x1b3ed9-0x0;var _0x5a8e35=_0xedf9[_0x1b3ed9];return _0x5a8e35;};'use strict';var client=require(_0x9edf('0x0'));exports[_0x9edf('0x1')]=function(_0x4f9e9b){return function(_0xc11a95){return client[_0x9edf('0x2')](_0x9edf('0x3'),{'options':{'raw':![],'attributes':['id',_0x9edf('0x4'),'channel',_0x9edf('0x5')],'include':[{'model':_0x9edf('0x6'),'as':_0x9edf('0x7'),'attributes':['id','field',_0x9edf('0x8'),_0x9edf('0x9')]},{'model':_0x9edf('0x6'),'as':_0x9edf('0xa'),'attributes':['id','field',_0x9edf('0x8'),_0x9edf('0x9')]},{'model':'Action','as':_0x9edf('0xb'),'attributes':['id',_0x9edf('0xc'),_0x9edf('0xd'),'data2',_0x9edf('0xe'),_0x9edf('0xf'),_0x9edf('0x10'),'data6',_0x9edf('0x11')]}]},'log':_0x9edf('0x3')});};};
\ No newline at end of file
+var _0xd892=['getTriggers','Request','GetTrigger','name','channel','Condition','AllConditions','field','operator','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7'];(function(_0x444cbc,_0x38d135){var _0x270d6e=function(_0x3b2765){while(--_0x3b2765){_0x444cbc['push'](_0x444cbc['shift']());}};_0x270d6e(++_0x38d135);}(_0xd892,0x1f4));var _0x2d89=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0xd892[_0x16d10f];return _0x50c823;};'use strict';var client=require('../client');exports[_0x2d89('0x0')]=function(_0x13527c){return function(_0x5582cb){return client[_0x2d89('0x1')](_0x2d89('0x2'),{'options':{'raw':![],'attributes':['id',_0x2d89('0x3'),_0x2d89('0x4'),'status'],'include':[{'model':_0x2d89('0x5'),'as':_0x2d89('0x6'),'attributes':['id',_0x2d89('0x7'),_0x2d89('0x8'),'value']},{'model':_0x2d89('0x5'),'as':'AnyConditions','attributes':['id',_0x2d89('0x7'),'operator',_0x2d89('0x9')]},{'model':_0x2d89('0xa'),'as':_0x2d89('0xb'),'attributes':['id',_0x2d89('0xc'),_0x2d89('0xd'),_0x2d89('0xe'),_0x2d89('0xf'),_0x2d89('0x10'),_0x2d89('0x11'),_0x2d89('0x12'),_0x2d89('0x13')]}]},'log':'GetTrigger'});};};
\ No newline at end of file
index 977df0b..c538786 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3009=['Request','defaultuser','GetTrunk','../client','getTrunks'];(function(_0xa8d7ef,_0x4b8b3d){var _0x239d5e=function(_0x15150d){while(--_0x15150d){_0xa8d7ef['push'](_0xa8d7ef['shift']());}};_0x239d5e(++_0x4b8b3d);}(_0x3009,0x152));var _0x9300=function(_0x131fd0,_0x3e8729){_0x131fd0=_0x131fd0-0x0;var _0x15c0b9=_0x3009[_0x131fd0];return _0x15c0b9;};'use strict';var client=require(_0x9300('0x0'));exports[_0x9300('0x1')]=function(_0x3bec74){return function(_0x43d7e2){return client[_0x9300('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0x9300('0x3')]},'log':_0x9300('0x4')});};};
\ No newline at end of file
+var _0x1904=['defaultuser','../client','Request','GetTrunk','name','registry'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x1904,0x1b1));var _0x4190=function(_0x1d78a0,_0x17401a){_0x1d78a0=_0x1d78a0-0x0;var _0x5d5615=_0x1904[_0x1d78a0];return _0x5d5615;};'use strict';var client=require(_0x4190('0x0'));exports['getTrunks']=function(_0x59b961){return function(_0x526a6d){return client[_0x4190('0x1')](_0x4190('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x4190('0x3'),_0x4190('0x4'),_0x4190('0x5')]},'log':'GetTrunk'});};};
\ No newline at end of file
index 259ac23..e9be9b8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});};
\ No newline at end of file
+var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x2c9a8e,_0x54d44c){var _0x15942b=function(_0x5b78b3){while(--_0x5b78b3){_0x2c9a8e['push'](_0x2c9a8e['shift']());}};_0x15942b(++_0x54d44c);}(_0x70e0,0x17b));var _0x070e=function(_0x3a9945,_0x5e6d27){_0x3a9945=_0x3a9945-0x0;var _0x3020a4=_0x70e0[_0x3a9945];return _0x3020a4;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});};
\ No newline at end of file
index 7c26eec..7c94e27 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3288=['UpdateVoiceAgentReport','../client','create','Request','update'];(function(_0x2ef16c,_0x21f8ca){var _0xa2841c=function(_0xeb3ebb){while(--_0xeb3ebb){_0x2ef16c['push'](_0x2ef16c['shift']());}};_0xa2841c(++_0x21f8ca);}(_0x3288,0x187));var _0x8328=function(_0x1c35f5,_0x3f5d15){_0x1c35f5=_0x1c35f5-0x0;var _0x4c134d=_0x3288[_0x1c35f5];return _0x4c134d;};'use strict';var client=require(_0x8328('0x0'));exports[_0x8328('0x1')]=function(_0x33ce2b){return client[_0x8328('0x2')]('CreateVoiceAgentReport',{'body':_0x33ce2b,'log':'CreateVoiceAgentReport'});};exports[_0x8328('0x3')]=function(_0x216137,_0x5b63eb,_0x37ca63){return client[_0x8328('0x2')](_0x8328('0x4'),{'body':_0x216137,'options':{'where':{'uniqueid':_0x5b63eb,'interface':_0x37ca63,'agentcomplete':!![]}},'log':_0x8328('0x4')});};
\ No newline at end of file
+var _0xbf6a=['CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create','Request'];(function(_0xd1b591,_0x3332b3){var _0x20c36f=function(_0x1560b4){while(--_0x1560b4){_0xd1b591['push'](_0xd1b591['shift']());}};_0x20c36f(++_0x3332b3);}(_0xbf6a,0x1d8));var _0xabf6=function(_0x54ccd7,_0x3bc3ce){_0x54ccd7=_0x54ccd7-0x0;var _0x4e667b=_0xbf6a[_0x54ccd7];return _0x4e667b;};'use strict';var client=require(_0xabf6('0x0'));exports[_0xabf6('0x1')]=function(_0x134aae){return client[_0xabf6('0x2')](_0xabf6('0x3'),{'body':_0x134aae,'log':_0xabf6('0x3')});};exports['update']=function(_0x586a89,_0x38db5e,_0x40b202){return client[_0xabf6('0x2')](_0xabf6('0x4'),{'body':_0x586a89,'options':{'where':{'uniqueid':_0x38db5e,'interface':_0x40b202,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});};
\ No newline at end of file
index 83d8642..e8cce3c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a33=['duration','billableseconds','lodash','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x50a004,_0x193d84){var _0x5e9992=function(_0x3c8c37){while(--_0x3c8c37){_0x50a004['push'](_0x50a004['shift']());}};_0x5e9992(++_0x193d84);}(_0x7a33,0x79));var _0x37a3=function(_0x2093f1,_0x5cf7a6){_0x2093f1=_0x2093f1-0x0;var _0x21dd3b=_0x7a33[_0x2093f1];return _0x21dd3b;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x37a3('0x0'));var client=require(_0x37a3('0x1'));exports[_0x37a3('0x2')]=function(_0x30ab65){return client[_0x37a3('0x3')](_0x37a3('0x4'),{'body':_[_0x37a3('0x5')](_0x30ab65,{'source':_0x30ab65[_0x37a3('0x6')],'destinationcontext':_0x30ab65[_0x37a3('0x7')],'callerid':_0x30ab65[_0x37a3('0x8')],'amaflags':_0x37a3('0x9')}),'log':'CreateVoiceCallReport'});};exports[_0x37a3('0xa')]=function(){return function(){return client['Request'](_0x37a3('0xb'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()['startOf'](_0x37a3('0xc'))[_0x37a3('0xd')](_0x37a3('0xe')),moment()['endOf']('day')[_0x37a3('0xd')](_0x37a3('0xe'))]}},'attributes':['type','disposition',_0x37a3('0xf'),_0x37a3('0x10')]},'log':'GetVoiceCallReports'});};};
\ No newline at end of file
+var _0xead6=['outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','Request','GetVoiceCallReport'];(function(_0x49e684,_0x5dde79){var _0x2275bc=function(_0x256578){while(--_0x256578){_0x49e684['push'](_0x49e684['shift']());}};_0x2275bc(++_0x5dde79);}(_0xead6,0xb3));var _0x6ead=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xead6[_0x167cc1];return _0x10bc4b;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0x6ead('0x0'));var client=require(_0x6ead('0x1'));exports['create']=function(_0x85180c){return client['Request'](_0x6ead('0x2'),{'body':_[_0x6ead('0x3')](_0x85180c,{'source':_0x85180c[_0x6ead('0x4')],'destinationcontext':_0x85180c[_0x6ead('0x5')],'callerid':_0x85180c['callerid'],'amaflags':_0x6ead('0x6')}),'log':_0x6ead('0x2')});};exports[_0x6ead('0x7')]=function(){return function(){return client[_0x6ead('0x8')](_0x6ead('0x9'),{'options':{'where':{'type':[_0x6ead('0xa')],'createdAt':{'$between':[moment()[_0x6ead('0xb')]('day')[_0x6ead('0xc')](_0x6ead('0xd')),moment()[_0x6ead('0xe')](_0x6ead('0xf'))['format'](_0x6ead('0xd'))]}},'attributes':[_0x6ead('0x10'),_0x6ead('0x11'),_0x6ead('0x12'),_0x6ead('0x13')]},'log':_0x6ead('0x14')});};};
\ No newline at end of file
index f34e517..620916c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x04dd=['CreateVoiceDialReport','../client','create','Request'];(function(_0x362c1f,_0x4fccd9){var _0x32bd2a=function(_0xfe09e5){while(--_0xfe09e5){_0x362c1f['push'](_0x362c1f['shift']());}};_0x32bd2a(++_0x4fccd9);}(_0x04dd,0x75));var _0xd04d=function(_0x296754,_0x5befe9){_0x296754=_0x296754-0x0;var _0x1d9f1d=_0x04dd[_0x296754];return _0x1d9f1d;};'use strict';var client=require(_0xd04d('0x0'));exports[_0xd04d('0x1')]=function(_0x70fc12){return client[_0xd04d('0x2')](_0xd04d('0x3'),{'body':_0x70fc12,'log':_0xd04d('0x3')});};
\ No newline at end of file
+var _0x8666=['CreateVoiceDialReport','../client','create','Request'];(function(_0x16d777,_0x5dc623){var _0x5b388c=function(_0x501219){while(--_0x501219){_0x16d777['push'](_0x16d777['shift']());}};_0x5b388c(++_0x5dc623);}(_0x8666,0x161));var _0x6866=function(_0x458abf,_0x371075){_0x458abf=_0x458abf-0x0;var _0x7396a7=_0x8666[_0x458abf];return _0x7396a7;};'use strict';var client=require(_0x6866('0x0'));exports[_0x6866('0x1')]=function(_0x3a6859){return client[_0x6866('0x2')](_0x6866('0x3'),{'body':_0x3a6859,'log':_0x6866('0x3')});};
\ No newline at end of file
index 586bf73..514a4d4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x38d0=['Request','GetVoiceExtension','recordingFormat','getVoiceExtensions'];(function(_0x3d2b38,_0x1b3625){var _0x35ab6b=function(_0x435b5d){while(--_0x435b5d){_0x3d2b38['push'](_0x3d2b38['shift']());}};_0x35ab6b(++_0x1b3625);}(_0x38d0,0x123));var _0x038d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x38d0[_0x2641f9];return _0x585741;};'use strict';var client=require('../client');exports[_0x038d('0x0')]=function(){return function(){return client[_0x038d('0x1')](_0x038d('0x2'),{'options':{'raw':!![],'attributes':['id','exten',_0x038d('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x038d('0x0')});};};
\ No newline at end of file
+var _0xa571=['Request','GetVoiceExtension','recordingFormat','../client','getVoiceExtensions'];(function(_0x28da10,_0x29470c){var _0x298372=function(_0x4acba9){while(--_0x4acba9){_0x28da10['push'](_0x28da10['shift']());}};_0x298372(++_0x29470c);}(_0xa571,0x107));var _0x1a57=function(_0x559443,_0x4eb8b6){_0x559443=_0x559443-0x0;var _0x246c41=_0xa571[_0x559443];return _0x246c41;};'use strict';var client=require(_0x1a57('0x0'));exports[_0x1a57('0x1')]=function(){return function(){return client[_0x1a57('0x2')](_0x1a57('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x1a57('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1a57('0x1')});};};
\ No newline at end of file
index d92dec4..e70ec9e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbb5f=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','Interval','Intervals','../client','getVoiceQueues','Request','name','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject'];(function(_0xce7c8a,_0x16f4bb){var _0x3322a5=function(_0xeb3688){while(--_0xeb3688){_0xce7c8a['push'](_0xce7c8a['shift']());}};_0x3322a5(++_0x16f4bb);}(_0xbb5f,0x19e));var _0xfbb5=function(_0x15502c,_0x311354){_0x15502c=_0x15502c-0x0;var _0xe8e3fd=_0xbb5f[_0x15502c];return _0xe8e3fd;};'use strict';var client=require(_0xfbb5('0x0'));exports[_0xfbb5('0x1')]=function(){return function(){return client[_0xfbb5('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xfbb5('0x3'),_0xfbb5('0x4'),_0xfbb5('0x5'),_0xfbb5('0x6'),_0xfbb5('0x7'),_0xfbb5('0x8'),'dialActive',_0xfbb5('0x9'),_0xfbb5('0xa'),'dialLimitQueue',_0xfbb5('0xb'),_0xfbb5('0xc'),_0xfbb5('0xd'),'dialPredictiveInterval',_0xfbb5('0xe'),_0xfbb5('0xf'),_0xfbb5('0x10'),_0xfbb5('0x11'),_0xfbb5('0x12'),_0xfbb5('0x13'),_0xfbb5('0x14'),_0xfbb5('0x15'),'dialBusyMaxRetry',_0xfbb5('0x16'),_0xfbb5('0x17'),'dialNoAnswerRetryFrequency',_0xfbb5('0x18'),'dialTimezone','dialGlobalInterval',_0xfbb5('0x19'),_0xfbb5('0x1a'),_0xfbb5('0x1b'),_0xfbb5('0x1c'),_0xfbb5('0x1d'),_0xfbb5('0x1e'),'dialAMDTotalAnalysisTime',_0xfbb5('0x1f'),_0xfbb5('0x20'),_0xfbb5('0x21'),_0xfbb5('0x22'),_0xfbb5('0x23'),_0xfbb5('0x24'),_0xfbb5('0x25'),_0xfbb5('0x26'),_0xfbb5('0x27'),_0xfbb5('0x28'),'dialAgiAfterHangupClient','dialQueueProject2',_0xfbb5('0x7'),_0xfbb5('0x29'),_0xfbb5('0x2a'),'dialCutDigit',_0xfbb5('0x2b'),_0xfbb5('0x2c'),_0xfbb5('0x2d'),_0xfbb5('0x2e'),_0xfbb5('0x2f'),_0xfbb5('0x30'),'dialMachineMaxRetry','dialMachineRetryFrequency',_0xfbb5('0x31'),_0xfbb5('0x32'),_0xfbb5('0x33'),'dialPredictiveIntervalMaxThreshold',_0xfbb5('0x34'),_0xfbb5('0x35'),_0xfbb5('0x36')],'include':[{'model':_0xfbb5('0x37'),'as':'Trunk','attributes':['id','name',_0xfbb5('0x38'),_0xfbb5('0x39')]},{'model':_0xfbb5('0x3a'),'as':_0xfbb5('0x3b'),'attributes':['id','name']},{'model':'Trunk','as':'TrunkBackup','attributes':['id','name',_0xfbb5('0x38'),'active']},{'model':'Interval','as':_0xfbb5('0x3c'),'attributes':['id',_0xfbb5('0x3')],'include':[{'model':'Interval','as':_0xfbb5('0x3d'),'attributes':['id',_0xfbb5('0x3'),'interval']}]}]},'log':_0xfbb5('0x1')});};};
\ No newline at end of file
+var _0x56b8=['dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','TrunkBackup','callerid','active','Interval','Intervals','interval','../client','getVoiceQueues','GetVoiceQueue','name','acw','acwTimeout','monitor_format','type','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout'];(function(_0x5e91d3,_0x5ee68b){var _0x20f6d4=function(_0x62f108){while(--_0x62f108){_0x5e91d3['push'](_0x5e91d3['shift']());}};_0x20f6d4(++_0x5ee68b);}(_0x56b8,0x1dd));var _0x856b=function(_0x1b3715,_0x426234){_0x1b3715=_0x1b3715-0x0;var _0x18bbd5=_0x56b8[_0x1b3715];return _0x18bbd5;};'use strict';var client=require(_0x856b('0x0'));exports[_0x856b('0x1')]=function(){return function(){return client['Request'](_0x856b('0x2'),{'options':{'raw':![],'attributes':['id',_0x856b('0x3'),_0x856b('0x4'),_0x856b('0x5'),'autopause',_0x856b('0x6'),_0x856b('0x7'),'dialActive',_0x856b('0x8'),'dialLimitChannel',_0x856b('0x9'),_0x856b('0xa'),_0x856b('0xb'),_0x856b('0xc'),_0x856b('0xd'),'dialOriginateCallerIdName',_0x856b('0xe'),_0x856b('0xf'),'dialQueueOptions',_0x856b('0x10'),'dialQueueProject',_0x856b('0x11'),'dialCongestionRetryFrequency',_0x856b('0x12'),_0x856b('0x13'),_0x856b('0x14'),_0x856b('0x15'),_0x856b('0x16'),_0x856b('0x17'),_0x856b('0x18'),_0x856b('0x19'),_0x856b('0x1a'),'dialAMDActive',_0x856b('0x1b'),_0x856b('0x1c'),_0x856b('0x1d'),_0x856b('0x1e'),'dialAMDMinWordLength',_0x856b('0x1f'),_0x856b('0x20'),_0x856b('0x21'),'dialAMDMaximumWordLength',_0x856b('0x22'),_0x856b('0x23'),'dialRecallInQueue',_0x856b('0x24'),'dialAgiAfterHangupAgent',_0x856b('0x25'),_0x856b('0x26'),'monitor_format',_0x856b('0x27'),_0x856b('0x28'),_0x856b('0x29'),_0x856b('0x2a'),'dialNoSuchNumberRetryFrequency',_0x856b('0x2b'),_0x856b('0x2c'),_0x856b('0x2d'),'dialAbandonedRetryFrequency',_0x856b('0x2e'),_0x856b('0x2f'),_0x856b('0x30'),_0x856b('0x31'),_0x856b('0x32'),_0x856b('0x33'),_0x856b('0x34'),_0x856b('0x35'),_0x856b('0x36')],'include':[{'model':_0x856b('0x37'),'as':_0x856b('0x37'),'attributes':['id',_0x856b('0x3'),'callerid','active']},{'model':_0x856b('0x38'),'as':_0x856b('0x39'),'attributes':['id','name']},{'model':_0x856b('0x37'),'as':_0x856b('0x3a'),'attributes':['id',_0x856b('0x3'),_0x856b('0x3b'),_0x856b('0x3c')]},{'model':_0x856b('0x3d'),'as':_0x856b('0x3d'),'attributes':['id',_0x856b('0x3')],'include':[{'model':_0x856b('0x3d'),'as':_0x856b('0x3e'),'attributes':['id','name',_0x856b('0x3f')]}]}]},'log':_0x856b('0x1')});};};
\ No newline at end of file
index acac9fa..d8dda73 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x29369d,_0x12e37b){var _0x3096c9=function(_0x30abb6){while(--_0x30abb6){_0x29369d['push'](_0x29369d['shift']());}};_0x3096c9(++_0x12e37b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};};
\ No newline at end of file
+var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x1614bc,_0x363231){var _0x582dda=function(_0x25b1d7){while(--_0x25b1d7){_0x1614bc['push'](_0x1614bc['shift']());}};_0x582dda(++_0x363231);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};};
\ No newline at end of file
index c221b51..37bfe24 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e50=['../client','getVoiceQueueRtPauses','GetVoiceQueueRtPauses'];(function(_0x14c184,_0x1d4b52){var _0x2ba55e=function(_0x1fce59){while(--_0x1fce59){_0x14c184['push'](_0x14c184['shift']());}};_0x2ba55e(++_0x1d4b52);}(_0x8e50,0x6f));var _0x08e5=function(_0x5b4573,_0x5c1865){_0x5b4573=_0x5b4573-0x0;var _0x9b620f=_0x8e50[_0x5b4573];return _0x9b620f;};'use strict';var client=require(_0x08e5('0x0'));exports[_0x08e5('0x1')]=function(_0x51f5b1){return function(){return client['Request'](_0x08e5('0x2'),{'options':{'where':{'VoiceQueueId':_0x51f5b1,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};};
\ No newline at end of file
+var _0x8fdc=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x44f959,_0x4db1f8){var _0x5f0ac5=function(_0x2beccc){while(--_0x2beccc){_0x44f959['push'](_0x44f959['shift']());}};_0x5f0ac5(++_0x4db1f8);}(_0x8fdc,0x172));var _0xc8fd=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x8fdc[_0x51c819];return _0x15c5d2;};'use strict';var client=require(_0xc8fd('0x0'));exports[_0xc8fd('0x1')]=function(_0x4fe7f9){return function(){return client[_0xc8fd('0x2')](_0xc8fd('0x3'),{'options':{'where':{'VoiceQueueId':_0x4fe7f9,'paused':!![]},'raw':!![]},'log':_0xc8fd('0x1')});};};
\ No newline at end of file
index 7b43770..863b57b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x2af121,_0x1a223c){var _0x39b954=function(_0x2d4b19){while(--_0x2d4b19){_0x2af121['push'](_0x2af121['shift']());}};_0x39b954(++_0x1a223c);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});};
\ No newline at end of file
+var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x189f6d,_0xa8b1f1){var _0x5c7994=function(_0x2ca26f){while(--_0x2ca26f){_0x189f6d['push'](_0x189f6d['shift']());}};_0x5c7994(++_0xa8b1f1);}(_0x7a54,0x106));var _0x47a5=function(_0x1b34bc,_0x4715e1){_0x1b34bc=_0x1b34bc-0x0;var _0x4f74ef=_0x7a54[_0x1b34bc];return _0x4f74ef;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});};
\ No newline at end of file
index a35b650..8451d3b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x818b=['transfererconnectedlinename','transfereraccountcode','transfererexten','transfererlinkedid','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','blind','attendedTransfer','result','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','transferercalleridname','transfererconnectedlinenum'];(function(_0x501f7e,_0x4d8bc8){var _0x2d22fd=function(_0x1cdb8d){while(--_0x1cdb8d){_0x501f7e['push'](_0x501f7e['shift']());}};_0x2d22fd(++_0x4d8bc8);}(_0x818b,0x104));var _0xb818=function(_0x490d5a,_0x4a7470){_0x490d5a=_0x490d5a-0x0;var _0x1737bf=_0x818b[_0x490d5a];return _0x1737bf;};'use strict';var client=require(_0xb818('0x0'));exports['transfers']={};exports[_0xb818('0x1')]=function(_0x49d8cf){return client[_0xb818('0x2')](_0xb818('0x3'),{'body':{'result':_0x49d8cf['result'],'transfererchannel':_0x49d8cf['transfererchannel'],'transferercalleridnum':_0x49d8cf['transferercalleridnum'],'transferercalleridname':_0x49d8cf[_0xb818('0x4')],'transfererconnectedlinenum':_0x49d8cf[_0xb818('0x5')],'transfererconnectedlinename':_0x49d8cf[_0xb818('0x6')],'transfereraccountcode':_0x49d8cf[_0xb818('0x7')],'transferercontext':_0x49d8cf['transferercontext'],'transfererexten':_0x49d8cf[_0xb818('0x8')],'transfererlinkedid':_0x49d8cf[_0xb818('0x9')],'transfereechannel':_0x49d8cf['transfereechannel'],'transfereecalleridnum':_0x49d8cf[_0xb818('0xa')],'transfereecalleridname':_0x49d8cf['transfereecalleridname'],'transfereeconnectedlinenum':_0x49d8cf[_0xb818('0xb')],'transfereeconnectedlinename':_0x49d8cf[_0xb818('0xc')],'transfereeaccountcode':_0x49d8cf[_0xb818('0xd')],'transfereecontext':_0x49d8cf[_0xb818('0xe')],'transfereeexten':_0x49d8cf[_0xb818('0xf')],'transfereelinkedid':_0x49d8cf[_0xb818('0x10')],'isexternal':_0x49d8cf[_0xb818('0x11')],'context':_0x49d8cf['context'],'extension':_0x49d8cf[_0xb818('0x12')],'type':_0xb818('0x13')},'log':_0xb818('0x3')});};exports[_0xb818('0x14')]=function(_0x2ee820){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x2ee820[_0xb818('0x15')],'transfererchannel':_0x2ee820[_0xb818('0x16')],'transferercalleridnum':_0x2ee820[_0xb818('0x17')],'transferercalleridname':_0x2ee820['origtransferercalleridname'],'transfererconnectedlinenum':_0x2ee820['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2ee820['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2ee820[_0xb818('0x18')],'transferercontext':_0x2ee820[_0xb818('0x19')],'transfererexten':_0x2ee820[_0xb818('0x1a')],'transfererlinkedid':_0x2ee820[_0xb818('0x1b')],'transfereechannel':_0x2ee820[_0xb818('0x1c')],'transfereecalleridnum':_0x2ee820[_0xb818('0x1d')],'transfereecalleridname':_0x2ee820[_0xb818('0x1e')],'transfereeconnectedlinenum':_0x2ee820['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2ee820[_0xb818('0x1f')],'transfereeaccountcode':_0x2ee820[_0xb818('0x20')],'transfereecontext':_0x2ee820[_0xb818('0x21')],'transfereeexten':_0x2ee820[_0xb818('0x22')],'transfereelinkedid':_0x2ee820[_0xb818('0x23')],'isexternal':_0x2ee820[_0xb818('0x11')],'context':_0x2ee820[_0xb818('0x24')],'extension':_0x2ee820['origtransfererexten'],'type':_0xb818('0x25')},'log':'CreateVoiceTransferReport'});};
\ No newline at end of file
+var _0xb47d=['origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','isexternal','origtransferercontext','origtransfererexten','../client','transfers','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeaccountcode','transfereecontext','context','extension','blind','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0xb47d,0x117));var _0xdb47=function(_0x48289c,_0xc3a45a){_0x48289c=_0x48289c-0x0;var _0x4e215d=_0xb47d[_0x48289c];return _0x4e215d;};'use strict';var client=require(_0xdb47('0x0'));exports[_0xdb47('0x1')]={};exports['blindTransfer']=function(_0x270fe3){return client[_0xdb47('0x2')](_0xdb47('0x3'),{'body':{'result':_0x270fe3[_0xdb47('0x4')],'transfererchannel':_0x270fe3[_0xdb47('0x5')],'transferercalleridnum':_0x270fe3[_0xdb47('0x6')],'transferercalleridname':_0x270fe3[_0xdb47('0x7')],'transfererconnectedlinenum':_0x270fe3['transfererconnectedlinenum'],'transfererconnectedlinename':_0x270fe3[_0xdb47('0x8')],'transfereraccountcode':_0x270fe3[_0xdb47('0x9')],'transferercontext':_0x270fe3[_0xdb47('0xa')],'transfererexten':_0x270fe3['transfererexten'],'transfererlinkedid':_0x270fe3[_0xdb47('0xb')],'transfereechannel':_0x270fe3[_0xdb47('0xc')],'transfereecalleridnum':_0x270fe3[_0xdb47('0xd')],'transfereecalleridname':_0x270fe3[_0xdb47('0xe')],'transfereeconnectedlinenum':_0x270fe3['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x270fe3['transfereeconnectedlinename'],'transfereeaccountcode':_0x270fe3[_0xdb47('0xf')],'transfereecontext':_0x270fe3[_0xdb47('0x10')],'transfereeexten':_0x270fe3['transfereeexten'],'transfereelinkedid':_0x270fe3['transfereelinkedid'],'isexternal':_0x270fe3['isexternal'],'context':_0x270fe3[_0xdb47('0x11')],'extension':_0x270fe3[_0xdb47('0x12')],'type':_0xdb47('0x13')},'log':'CreateVoiceTransferReport'});};exports[_0xdb47('0x14')]=function(_0x4a03ad){return client[_0xdb47('0x2')](_0xdb47('0x3'),{'body':{'result':_0x4a03ad['result'],'transfererchannel':_0x4a03ad[_0xdb47('0x15')],'transferercalleridnum':_0x4a03ad['origtransferercalleridnum'],'transferercalleridname':_0x4a03ad[_0xdb47('0x16')],'transfererconnectedlinenum':_0x4a03ad[_0xdb47('0x17')],'transfererconnectedlinename':_0x4a03ad['secondtransfererconnectedlinename'],'transfereraccountcode':_0x4a03ad[_0xdb47('0x18')],'transferercontext':_0x4a03ad['secondtransferercontext'],'transfererexten':_0x4a03ad['secondtransfererexten'],'transfererlinkedid':_0x4a03ad[_0xdb47('0x19')],'transfereechannel':_0x4a03ad[_0xdb47('0x1a')],'transfereecalleridnum':_0x4a03ad[_0xdb47('0x1b')],'transfereecalleridname':_0x4a03ad[_0xdb47('0x1c')],'transfereeconnectedlinenum':_0x4a03ad[_0xdb47('0x1d')],'transfereeconnectedlinename':_0x4a03ad[_0xdb47('0x1e')],'transfereeaccountcode':_0x4a03ad[_0xdb47('0x1f')],'transfereecontext':_0x4a03ad[_0xdb47('0x20')],'transfereeexten':_0x4a03ad[_0xdb47('0x21')],'transfereelinkedid':_0x4a03ad[_0xdb47('0x22')],'isexternal':_0x4a03ad[_0xdb47('0x23')],'context':_0x4a03ad[_0xdb47('0x24')],'extension':_0x4a03ad[_0xdb47('0x25')],'type':'attended'},'log':_0xdb47('0x3')});};
\ No newline at end of file
index 8ce0dfb..0b3bae4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x15e09d,_0x178c0d){var _0xcc033d=function(_0x2a4509){while(--_0x2a4509){_0x15e09d['push'](_0x15e09d['shift']());}};_0xcc033d(++_0x178c0d);}(_0x7a54,0x106));var _0x47a5=function(_0xef8877,_0x55a745){_0xef8877=_0xef8877-0x0;var _0xcd2777=_0x7a54[_0xef8877];return _0xcd2777;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});};
\ No newline at end of file
+var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x2e807f,_0x4cd305){var _0x4817e6=function(_0x2145a3){while(--_0x2145a3){_0x2e807f['push'](_0x2e807f['shift']());}};_0x4817e6(++_0x4cd305);}(_0x7a54,0x106));var _0x47a5=function(_0x8db9c7,_0x3d2613){_0x8db9c7=_0x8db9c7-0x0;var _0x1f3bb2=_0x7a54[_0x8db9c7];return _0x1f3bb2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});};
\ No newline at end of file
index ba34e05..0bf6fbc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe749=['lodash','bluebird','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','calleridnum','routeId','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','map','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','<unknown>','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','destcalleridnum','format','user:%s','name','action','toLowerCase'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xe749,0x1ef));var _0x9e74=function(_0x6d5292,_0x1b6a64){_0x6d5292=_0x6d5292-0x0;var _0x4d25d2=_0xe749[_0x6d5292];return _0x4d25d2;};'use strict';var _=require(_0x9e74('0x0'));var BPromise=require(_0x9e74('0x1'));var Redis=require('ioredis');var util=require(_0x9e74('0x2'));var config=require(_0x9e74('0x3'));var logger=require('../../../../config/logger')(_0x9e74('0x4'));var cmContactRpc=require(_0x9e74('0x5'));config[_0x9e74('0x6')]=_[_0x9e74('0x7')](config['redis'],{'host':_0x9e74('0x8'),'port':0x18eb});var io=require(_0x9e74('0x9'))(new Redis(config[_0x9e74('0x6')]));function emit(_0x5bbabd,_0x40bb27,_0x16e730,_0xed0e53,_0x174a50){logger[_0x9e74('0xa')](_0x9e74('0xb'),_0x5bbabd,_0x40bb27['id'],_0x16e730,_0xed0e53,JSON['stringify'](_0x174a50));io['to'](_0x16e730)['emit'](_0xed0e53,_0x174a50);}exports[_0x9e74('0xc')]=function(_0x17fdb7,_0x249a16,_0x34831b,_0x588e98){var _0x26e5da,_0x18e896;var _0x1bda64={};var _0x3d3bec;var _0x3b665a=Number(_0x34831b[_0x9e74('0xd')]);var _0x4d53f6=_0x34831b[_0x9e74('0xe')]?Boolean(Number(_0x34831b[_0x9e74('0xe')])):![];var _0x8205f8;var _0x3e49d9=![];if(!_[_0x9e74('0xf')](_0x34831b[_0x9e74('0x10')])){if(_0x34831b['data5']=='1')_0x3e49d9=!![];}if(!_0x3e49d9){if(_0x588e98[_0x9e74('0x11')]){_0x1bda64['id']=_0x588e98['xmd-contactid'];}}if(!_0x1bda64['id']){_0x1bda64[_0x9e74('0x12')]=_0x3b665a;_0x8205f8=_0x34831b[_0x9e74('0x13')]&&_0x34831b['data3']!=='0'?_0x34831b[_0x9e74('0x13')][_0x9e74('0x14')](','):[_0x9e74('0x15')];_0x1bda64['$or']=_['map'](_0x8205f8,function(_0x3513e0){var _0x482f8e={};_0x482f8e[_0x3513e0]=_0x588e98['routeId']?_0x588e98['destcalleridnum']:_0x588e98[_0x9e74('0x16')];return _0x482f8e;});_0x3d3bec=_0x588e98[_0x9e74('0x17')]?_0x588e98['destcalleridnum']:_0x588e98[_0x9e74('0x16')];}var _0x34a81c=['id',_0x9e74('0x18'),_0x9e74('0x19'),_0x9e74('0x15'),_0x9e74('0x1a'),_0x9e74('0x1b'),'ListId',_0x9e74('0x1c'),_0x9e74('0x1d'),_0x9e74('0x1e')];var _0x1f90c2=_['union'](_0x34a81c,_0x8205f8);BPromise[_0x9e74('0x1f')]()[_0x9e74('0x20')](cmContactRpc[_0x9e74('0x21')]({'attributes':_0x1f90c2,'where':_0x1bda64,'phone':_0x3d3bec}))[_0x9e74('0x20')](function(_0xb091ea){_0x18e896=_0xb091ea;if(!_['isEmpty'](_0x18e896)){if(_0x18e896[_0x9e74('0x22')]===0x1){_0x26e5da=_0x18e896[0x0];logger[_0x9e74('0xa')](_0x9e74('0x23'),_0x588e98[_0x9e74('0x24')],_0x249a16['id'],_0x26e5da['id']);}else{logger[_0x9e74('0xa')](_0x9e74('0x25'),_0x588e98[_0x9e74('0x24')],_0x249a16['id'],_[_0x9e74('0x26')](_0x18e896,'id')[_0x9e74('0x27')](','));}return;}else{logger['info']('[CM][%s][%s]\x20Contact\x20not\x20found',_0x588e98['uniqueid'],_0x249a16['id']);var _0x205d59={'ListId':_0x3b665a};var _0x3a5a16=_0x34831b[_0x9e74('0x28')]&&_0x34831b[_0x9e74('0x28')]!=='0'?_0x34831b['data4']:_0x9e74('0x15');if(_0x4d53f6){logger[_0x9e74('0xa')](_0x9e74('0x29'),_0x588e98['uniqueid'],_0x249a16['id']);_0x205d59[_0x3a5a16]=_['isNil'](_0x588e98[_0x9e74('0x17')])?_0x588e98[_0x9e74('0x16')]:_0x588e98['destcalleridnum'];if(_['isNil'](_0x588e98[_0x9e74('0x17')])){_0x205d59[_0x9e74('0x18')]=_0x588e98[_0x9e74('0x2a')]&&_0x588e98['calleridname']!==_0x9e74('0x2b')?_0x588e98['calleridname']:_0x9e74('0x2c');}else{_0x205d59[_0x9e74('0x18')]=_0x588e98[_0x9e74('0x2d')]&&_0x588e98['destcalleridname']!=='<unknown>'?_0x588e98[_0x9e74('0x2d')]:'Unknown';}return BPromise[_0x9e74('0x1f')]()[_0x9e74('0x20')](cmContactRpc[_0x9e74('0x2e')](_0x205d59))[_0x9e74('0x20')](function(_0x327a54){_0x26e5da=_0x327a54;_0x18e896[_0x9e74('0x2f')](_0x327a54);if(_0x26e5da){logger[_0x9e74('0xa')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x588e98[_0x9e74('0x24')],_0x249a16['id'],_0x26e5da['id']);}return;});}else{logger['info'](_0x9e74('0x30'),_0x588e98[_0x9e74('0x24')],_0x249a16['id']);_0x205d59[_0x3a5a16]=_['isNil'](_0x588e98[_0x9e74('0x17')])?_0x588e98[_0x9e74('0x16')]:_0x588e98[_0x9e74('0x31')];if(_['isNil'](_0x588e98['routeId'])){_0x205d59[_0x9e74('0x18')]=_0x588e98['calleridname']&&_0x588e98[_0x9e74('0x2a')]!==_0x9e74('0x2b')?_0x588e98[_0x9e74('0x2a')]:_0x9e74('0x2c');}else{_0x205d59[_0x9e74('0x18')]=_0x588e98[_0x9e74('0x2d')]&&_0x588e98[_0x9e74('0x2d')]!==_0x9e74('0x2b')?_0x588e98[_0x9e74('0x2d')]:_0x9e74('0x2c');}_0x26e5da=_0x205d59;_0x18e896['push'](_0x205d59);return;}}})[_0x9e74('0x20')](function(){if(_0x17fdb7){emit(_0x588e98[_0x9e74('0x24')],_0x249a16,util[_0x9e74('0x32')](_0x9e74('0x33'),_0x17fdb7[_0x9e74('0x34')]),util['format']('trigger:%s',_0x34831b[_0x9e74('0x35')][_0x9e74('0x36')]()),{'evt':_['merge'](_0x588e98,{'autoCreate':_0x4d53f6}),'contact':_0x26e5da===undefined?{}:_0x26e5da,'contacts':_0x18e896['length']===0x0?undefined:_0x18e896});}});};
\ No newline at end of file
+var _0xac0d=['merge','lodash','bluebird','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','destcalleridnum','calleridnum','lastName','mobile','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','<unknown>','user:%s','name','format','trigger:%s','action','toLowerCase'];(function(_0x342981,_0x30d3c1){var _0x2a0445=function(_0x43d7ee){while(--_0x43d7ee){_0x342981['push'](_0x342981['shift']());}};_0x2a0445(++_0x30d3c1);}(_0xac0d,0xb2));var _0xdac0=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xac0d[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0xdac0('0x0'));var BPromise=require(_0xdac0('0x1'));var Redis=require(_0xdac0('0x2'));var util=require('util');var config=require(_0xdac0('0x3'));var logger=require(_0xdac0('0x4'))(_0xdac0('0x5'));var cmContactRpc=require(_0xdac0('0x6'));config[_0xdac0('0x7')]=_[_0xdac0('0x8')](config[_0xdac0('0x7')],{'host':_0xdac0('0x9'),'port':0x18eb});var io=require(_0xdac0('0xa'))(new Redis(config[_0xdac0('0x7')]));function emit(_0xe6cb03,_0x1be30f,_0x154e08,_0x51098d,_0xfc6fa7){logger[_0xdac0('0xb')](_0xdac0('0xc'),_0xe6cb03,_0x1be30f['id'],_0x154e08,_0x51098d,JSON['stringify'](_0xfc6fa7));io['to'](_0x154e08)[_0xdac0('0xd')](_0x51098d,_0xfc6fa7);}exports[_0xdac0('0xe')]=function(_0x4fcc01,_0x21be7f,_0x1d12ee,_0x383db9){var _0x44ba61,_0x5e47a8;var _0x22c80b={};var _0x48c47e;var _0x461948=Number(_0x1d12ee[_0xdac0('0xf')]);var _0x4f2dc7=_0x1d12ee[_0xdac0('0x10')]?Boolean(Number(_0x1d12ee[_0xdac0('0x10')])):![];var _0xbb1cd3;var _0x41c39d=![];if(!_[_0xdac0('0x11')](_0x1d12ee['data5'])){if(_0x1d12ee[_0xdac0('0x12')]=='1')_0x41c39d=!![];}if(!_0x41c39d){if(_0x383db9['xmd-contactid']){_0x22c80b['id']=_0x383db9[_0xdac0('0x13')];}}if(!_0x22c80b['id']){_0x22c80b[_0xdac0('0x14')]=_0x461948;_0xbb1cd3=_0x1d12ee[_0xdac0('0x15')]&&_0x1d12ee[_0xdac0('0x15')]!=='0'?_0x1d12ee[_0xdac0('0x15')][_0xdac0('0x16')](','):[_0xdac0('0x17')];_0x22c80b[_0xdac0('0x18')]=_[_0xdac0('0x19')](_0xbb1cd3,function(_0x42f19a){var _0x5a2b5d={};_0x5a2b5d[_0x42f19a]=_0x383db9[_0xdac0('0x1a')]?_0x383db9[_0xdac0('0x1b')]:_0x383db9[_0xdac0('0x1c')];return _0x5a2b5d;});_0x48c47e=_0x383db9['routeId']?_0x383db9['destcalleridnum']:_0x383db9[_0xdac0('0x1c')];}var _0x4d7901=['id','firstName',_0xdac0('0x1d'),_0xdac0('0x17'),_0xdac0('0x1e'),'fax',_0xdac0('0x14'),_0xdac0('0x1f'),'scheduledAt',_0xdac0('0x20')];var _0x496880=_[_0xdac0('0x21')](_0x4d7901,_0xbb1cd3);BPromise[_0xdac0('0x22')]()[_0xdac0('0x23')](cmContactRpc[_0xdac0('0x24')]({'attributes':_0x496880,'where':_0x22c80b,'phone':_0x48c47e}))[_0xdac0('0x23')](function(_0x51482c){_0x5e47a8=_0x51482c;if(!_[_0xdac0('0x25')](_0x5e47a8)){if(_0x5e47a8[_0xdac0('0x26')]===0x1){_0x44ba61=_0x5e47a8[0x0];logger[_0xdac0('0xb')](_0xdac0('0x27'),_0x383db9['uniqueid'],_0x21be7f['id'],_0x44ba61['id']);}else{logger['info'](_0xdac0('0x28'),_0x383db9['uniqueid'],_0x21be7f['id'],_[_0xdac0('0x19')](_0x5e47a8,'id')['join'](','));}return;}else{logger[_0xdac0('0xb')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x383db9[_0xdac0('0x29')],_0x21be7f['id']);var _0x56990a={'ListId':_0x461948};var _0x3052f1=_0x1d12ee[_0xdac0('0x2a')]&&_0x1d12ee[_0xdac0('0x2a')]!=='0'?_0x1d12ee[_0xdac0('0x2a')]:'phone';if(_0x4f2dc7){logger[_0xdac0('0xb')](_0xdac0('0x2b'),_0x383db9[_0xdac0('0x29')],_0x21be7f['id']);_0x56990a[_0x3052f1]=_['isNil'](_0x383db9[_0xdac0('0x1a')])?_0x383db9[_0xdac0('0x1c')]:_0x383db9[_0xdac0('0x1b')];if(_[_0xdac0('0x11')](_0x383db9[_0xdac0('0x1a')])){_0x56990a[_0xdac0('0x2c')]=_0x383db9[_0xdac0('0x2d')]&&_0x383db9['calleridname']!=='<unknown>'?_0x383db9['calleridname']:_0xdac0('0x2e');}else{_0x56990a[_0xdac0('0x2c')]=_0x383db9[_0xdac0('0x2f')]&&_0x383db9[_0xdac0('0x2f')]!=='<unknown>'?_0x383db9['destcalleridname']:_0xdac0('0x2e');}return BPromise['resolve']()['then'](cmContactRpc[_0xdac0('0x30')](_0x56990a))['then'](function(_0x4b48e4){_0x44ba61=_0x4b48e4;_0x5e47a8[_0xdac0('0x31')](_0x4b48e4);if(_0x44ba61){logger[_0xdac0('0xb')](_0xdac0('0x32'),_0x383db9[_0xdac0('0x29')],_0x21be7f['id'],_0x44ba61['id']);}return;});}else{logger[_0xdac0('0xb')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x383db9[_0xdac0('0x29')],_0x21be7f['id']);_0x56990a[_0x3052f1]=_[_0xdac0('0x11')](_0x383db9[_0xdac0('0x1a')])?_0x383db9['calleridnum']:_0x383db9[_0xdac0('0x1b')];if(_['isNil'](_0x383db9[_0xdac0('0x1a')])){_0x56990a[_0xdac0('0x2c')]=_0x383db9['calleridname']&&_0x383db9['calleridname']!=='<unknown>'?_0x383db9[_0xdac0('0x2d')]:_0xdac0('0x2e');}else{_0x56990a[_0xdac0('0x2c')]=_0x383db9[_0xdac0('0x2f')]&&_0x383db9[_0xdac0('0x2f')]!==_0xdac0('0x33')?_0x383db9[_0xdac0('0x2f')]:_0xdac0('0x2e');}_0x44ba61=_0x56990a;_0x5e47a8[_0xdac0('0x31')](_0x56990a);return;}}})[_0xdac0('0x23')](function(){if(_0x4fcc01){emit(_0x383db9[_0xdac0('0x29')],_0x21be7f,util['format'](_0xdac0('0x34'),_0x4fcc01[_0xdac0('0x35')]),util[_0xdac0('0x36')](_0xdac0('0x37'),_0x1d12ee[_0xdac0('0x38')][_0xdac0('0x39')]()),{'evt':_[_0xdac0('0x3a')](_0x383db9,{'autoCreate':_0x4f2dc7}),'contact':_0x44ba61===undefined?{}:_0x44ba61,'contacts':_0x5e47a8[_0xdac0('0x26')]===0x0?undefined:_0x5e47a8});}});};
\ No newline at end of file
index f6548c2..6bac010 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1485=['redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','sugarcrmAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','stringify','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','prototype','interface','hasOwnProperty','status','checkTrigger','merge','length','Actions','toLowerCase','motionbar','data2','html','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','data5','windowHeight','data6','winApplication','user:%s','name','trigger:%s:%s','data1','jscripty','format','trigger:%s','action','contactmanager','integration','exec','accounts','routeId','urlforward','script','parse','query','search','replace','channel','every','AllConditions','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','value','upperFirst','AccountId','message','event','operator','queue','agent','membername','mailSubstatus','offlineMessage','created','exports','lodash','url','mustache','./urlforward','./cmContact','./script','../../../config/environment','../../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1485,0x77));var _0x5148=function(_0x2b1db9,_0x38e07a){_0x2b1db9=_0x2b1db9-0x0;var _0xca2870=_0x1485[_0x2b1db9];return _0xca2870;};'use strict';var util=require('util');var _=require(_0x5148('0x0'));var url=require(_0x5148('0x1'));var Mustache=require(_0x5148('0x2'));var Redis=require('ioredis');var urlforward=require(_0x5148('0x3'));var integration=require('./integration');var cmContact=require(_0x5148('0x4'));var script=require(_0x5148('0x5'));var config=require(_0x5148('0x6'));var logger=require(_0x5148('0x7'))('trigger');var ami=require('../ami');config[_0x5148('0x8')]=_[_0x5148('0x9')](config[_0x5148('0x8')],{'host':_0x5148('0xa'),'port':0x18eb});var io=require(_0x5148('0xb'))(new Redis(config['redis']));var operators={'equals':function(_0x1d6ddc,_0x29ed6c){return _0x1d6ddc==_0x29ed6c;},'not_equals':function(_0x46a6a4,_0x418bd1){return _0x46a6a4!=_0x418bd1;}};var barAndWebActions=['popup',_0x5148('0x1'),_0x5148('0xc')];function Trigger(_0x43d15f){this[_0x5148('0xd')]=_0x43d15f['triggers'];this[_0x5148('0xe')]=_0x43d15f[_0x5148('0xe')];this[_0x5148('0xf')]=_0x43d15f[_0x5148('0xf')];this[_0x5148('0x10')]=_0x43d15f[_0x5148('0x10')];this[_0x5148('0x11')]=_0x43d15f[_0x5148('0x11')];this['zendeskAccounts']=_0x43d15f['zendeskAccounts'];this[_0x5148('0x12')]=_0x43d15f[_0x5148('0x12')];this[_0x5148('0x13')]=_0x43d15f[_0x5148('0x13')];this['sugarcrmAccounts']=_0x43d15f['sugarcrmAccounts'];this[_0x5148('0x14')]=_0x43d15f[_0x5148('0x14')];this[_0x5148('0x15')]=_0x43d15f[_0x5148('0x15')];this[_0x5148('0x16')]=_0x43d15f['vtigerAccounts'];this[_0x5148('0x17')]=_0x43d15f[_0x5148('0x17')];this[_0x5148('0x18')]=_0x43d15f['dynamics365Accounts'];this['freshsalesAccounts']=_0x43d15f[_0x5148('0x19')];this['accounts']={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x5148('0x13')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x5148('0x1a')],'zoho':this['zohoAccounts'],'desk':this[_0x5148('0x15')],'vtiger':this[_0x5148('0x16')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0x5148('0x19')],'servicenow':this[_0x5148('0x17')]};ami['on'](_0x5148('0x1b'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x1e'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x1f'),this['syncCustomEvent'][_0x5148('0x1d')](this));ami['on'](_0x5148('0x20'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x21'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x22'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x23'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x24'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x25'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x26'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x27'),this['syncCustomEvent'][_0x5148('0x1d')](this));ami['on'](_0x5148('0x28'),this['syncCustomEvent'][_0x5148('0x1d')](this));ami['on'](_0x5148('0x29'),this[_0x5148('0x2a')][_0x5148('0x1d')](this));ami['on']('custom:dialconnect',this[_0x5148('0x2a')][_0x5148('0x1d')](this));ami['on']('custom:dialend',this[_0x5148('0x2a')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x2b'),this['syncCustomEvent'][_0x5148('0x1d')](this));ami['on'](_0x5148('0x2c'),this[_0x5148('0x1c')]['bind'](this));ami['on'](_0x5148('0x2d'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x2e'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x2f'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x30'),this[_0x5148('0x1c')][_0x5148('0x1d')](this));ami['on'](_0x5148('0x31'),this[_0x5148('0x1c')]['bind'](this));ami['on'](_0x5148('0x32'),this[_0x5148('0x1c')]['bind'](this));}Trigger['prototype'][_0x5148('0x33')]=function(_0x220748,_0x3c6460,_0x5453ac){logger['info'](_0x220748,_0x3c6460,JSON[_0x5148('0x34')](_0x5453ac));io['to'](_0x220748)['emit'](_0x3c6460,_0x5453ac);};Trigger['prototype'][_0x5148('0x1c')]=function(_0x1ee6d0){var _0x3ef3d7=_[_0x5148('0x35')](_0x1ee6d0);if(typeof _0x3ef3d7[_0x5148('0x36')]===_0x5148('0x37')){_0x3ef3d7[_0x5148('0x36')]=_0x5148('0x38');}logger[_0x5148('0x39')](_0x5148('0x1c'),util[_0x5148('0x3a')](_0x3ef3d7,{'showHidden':!![],'depth':null}));this[_0x5148('0x3b')](_0x3ef3d7);};Trigger[_0x5148('0x3c')][_0x5148('0x2a')]=function(_0x924c76){if(this[_0x5148('0xe')][_0x924c76[_0x5148('0x3d')]]){this[_0x5148('0x1c')](_0x924c76);}};Trigger['prototype'][_0x5148('0x3b')]=function(_0x5e4fc6){var _0x340b82;for(var _0x2e7602 in this['triggers']){if(this['triggers'][_0x5148('0x3e')](_0x2e7602)){if(this[_0x5148('0xd')][_0x2e7602][_0x5148('0x3f')]){_0x340b82=this[_0x5148('0x40')](this['triggers'][_0x2e7602],_0x5e4fc6);if(_0x340b82){_[_0x5148('0x41')](_0x5e4fc6,_0x5e4fc6['variables']);for(var _0x336d85=0x0,_0x23b60b,_0x39df91,_0x235783;_0x336d85<this[_0x5148('0xd')][_0x2e7602]['Actions'][_0x5148('0x42')];_0x336d85+=0x1){_0x23b60b=this['triggers'][_0x2e7602][_0x5148('0x43')][_0x336d85];if(this[_0x5148('0xe')][_0x5e4fc6[_0x5148('0x3d')]]){switch(_0x23b60b['action'][_0x5148('0x44')]()){case'contactmanager':break;case _0x5148('0x45'):case'browser':var _0x5deff4={};switch(barAndWebActions[_0x23b60b['data1']]){case'popup':_0x5deff4['TemplateId']=_0x23b60b[_0x5148('0x46')];_0x5deff4[_0x5148('0x47')]=this[_0x5148('0x10')][_0x23b60b['data2']]?Mustache[_0x5148('0x48')](this[_0x5148('0x10')][_0x23b60b[_0x5148('0x46')]][_0x5148('0x47')],_0x5e4fc6):_0x5148('0x49');break;case _0x5148('0x1'):_0x5deff4[_0x5148('0x4a')]=this[_0x5148('0x4b')](_0x23b60b[_0x5148('0x46')],_0x5e4fc6,_[_0x5148('0x4c')](_0x23b60b['data3'])?!![]:parseInt(_0x23b60b[_0x5148('0x4d')],0xa));if(_[_0x5148('0x4c')](_0x23b60b[_0x5148('0x4e')])){_0x5deff4['location']='0';}else{_0x5deff4['uriLocation']=_0x23b60b[_0x5148('0x4e')];_0x5deff4['windowWidth']=_[_0x5148('0x4c')](_0x23b60b[_0x5148('0x4f')])?'800':_0x23b60b[_0x5148('0x4f')];_0x5deff4[_0x5148('0x50')]=_[_0x5148('0x4c')](_0x23b60b[_0x5148('0x51')])?'600':_0x23b60b['data6'];}break;case'winapp':_0x5deff4[_0x5148('0x52')]=_0x23b60b[_0x5148('0x46')]?Mustache[_0x5148('0x48')](_0x23b60b['data2'],_0x5e4fc6):'';_0x5deff4['winArguments']=_0x23b60b['data3']?Mustache[_0x5148('0x48')](_0x23b60b[_0x5148('0x4d')],_0x5e4fc6):'';break;}this[_0x5148('0x33')](util['format'](_0x5148('0x53'),this[_0x5148('0xe')][_0x5e4fc6[_0x5148('0x3d')]][_0x5148('0x54')]),util['format'](_0x5148('0x55'),_0x23b60b['action'][_0x5148('0x44')](),barAndWebActions[_0x23b60b[_0x5148('0x56')]]),_[_0x5148('0x41')](_0x5deff4,_0x5e4fc6));break;case _0x5148('0x57'):this[_0x5148('0x33')](util['format'](_0x5148('0x53'),this[_0x5148('0xe')][_0x5e4fc6[_0x5148('0x3d')]][_0x5148('0x54')]),util[_0x5148('0x58')](_0x5148('0x59'),_0x23b60b[_0x5148('0x5a')][_0x5148('0x44')]()),_[_0x5148('0x41')]({'ProjectId':parseInt(_0x23b60b[_0x5148('0x56')],0xa)},_0x5e4fc6));break;default:this[_0x5148('0x33')](util['format']('user:%s',this[_0x5148('0xe')][_0x5e4fc6[_0x5148('0x3d')]][_0x5148('0x54')]),util[_0x5148('0x58')](_0x5148('0x59'),_0x23b60b[_0x5148('0x5a')]['toLowerCase']()),_[_0x5148('0x41')]({},_0x23b60b,_0x5e4fc6));}}switch(_0x23b60b[_0x5148('0x5a')][_0x5148('0x44')]()){case _0x5148('0x5b'):cmContact['exec'](this[_0x5148('0xe')][_0x5e4fc6[_0x5148('0x3d')]],this[_0x5148('0xd')][_0x2e7602],_0x23b60b,_0x5e4fc6);break;case _0x5148('0x5c'):integration[_0x5148('0x5d')](_0x23b60b,_0x5e4fc6,this[_0x5148('0x5e')],this[_0x5148('0xe')][_0x5e4fc6['interface']],this[_0x5148('0xf')][_0x5e4fc6['queue']],this['voiceExtensions'][_0x5e4fc6[_0x5148('0x5f')]]);break;case _0x5148('0x60'):urlforward[_0x5148('0x5d')](_0x23b60b,_0x5e4fc6);break;case _0x5148('0x61'):script[_0x5148('0x5d')](_0x23b60b,_0x5e4fc6);break;}}}}}}};Trigger[_0x5148('0x3c')][_0x5148('0x4b')]=function(_0x23cfd5,_0x3177e8,_0x5e753e){var _0x2f858c=url[_0x5148('0x62')](Mustache[_0x5148('0x48')](_0x23cfd5,_0x3177e8),!![]);if(_0x5e753e){_[_0x5148('0x41')](_0x2f858c[_0x5148('0x63')],_0x3177e8);}delete _0x2f858c[_0x5148('0x64')];var _0xd40447=url[_0x5148('0x58')](_0x2f858c);_0xd40447=_0xd40447[_0x5148('0x65')](/\/\?/g,'?');return _0xd40447;};Trigger[_0x5148('0x3c')][_0x5148('0x40')]=function(_0x2ab32c,_0x108994){var _0x5afe1c=!![];var _0x1d2b7d=!![];var _0x2e01e2=![];if(_0x2ab32c[_0x5148('0x66')]===_0x108994[_0x5148('0x36')]){_0x2e01e2=!![];}if(_0x2ab32c['AllConditions']['length']){_0x5afe1c=_[_0x5148('0x67')](_0x2ab32c[_0x5148('0x68')],this[_0x5148('0x69')](_0x108994,_0x2ab32c[_0x5148('0x66')]));}if(_0x2ab32c[_0x5148('0x6a')][_0x5148('0x42')]){_0x1d2b7d=_[_0x5148('0x6b')](_0x2ab32c[_0x5148('0x6a')],this[_0x5148('0x69')](_0x108994,_0x2ab32c[_0x5148('0x66')]));}var _0x484f5e=_0x2e01e2&&_0x5afe1c&&_0x1d2b7d;logger[_0x5148('0x39')](_0x5148('0x6c'),util['inspect'](_0x2ab32c,{'showHidden':!![],'depth':null}),_0x5148('0x6d'),util[_0x5148('0x3a')](_0x108994,{'showHidden':!![],'depth':null}),_0x2e01e2,_0x5afe1c,_0x1d2b7d);return _0x484f5e;};Trigger[_0x5148('0x3c')]['checkConditions']=function(_0x4ef9f8,_0x51fbe6){return function(_0x8615a3){switch(_0x8615a3[_0x5148('0x6e')]){case _0x5148('0x6f'):if(_0x4ef9f8[_0x5148('0x66')]===_0x51fbe6){if(_0x51fbe6===_0x5148('0x70')){return _0x4ef9f8[_0x5148('0x71')]?operators[_0x8615a3['operator']](Number(_0x8615a3[_0x5148('0x72')]),_0x4ef9f8[_0x5148('0x71')]):![];}else{return _0x4ef9f8[_[_0x5148('0x73')](_0x51fbe6)+_0x5148('0x74')]?operators[_0x8615a3['operator']](Number(_0x8615a3[_0x5148('0x72')]),_0x4ef9f8[_[_0x5148('0x73')](_0x51fbe6)+_0x5148('0x74')]):![];}}break;case'interaction':case _0x5148('0x75'):if(_0x4ef9f8['channel']===_0x51fbe6){return _0x4ef9f8[_0x5148('0x76')]?operators[_0x8615a3[_0x5148('0x77')]](_0x8615a3[_0x5148('0x72')],_0x4ef9f8[_0x5148('0x76')]):![];}break;case _0x5148('0x78'):return _0x4ef9f8['queue']?operators[_0x8615a3[_0x5148('0x77')]](_0x8615a3['value'],_0x4ef9f8['queue']):![];case _0x5148('0x79'):return _0x4ef9f8[_0x5148('0x7a')]?operators[_0x8615a3[_0x5148('0x77')]](_0x8615a3['value'],_0x4ef9f8['membername']):![];case'lastevent':return _0x4ef9f8['lastevent']?operators[_0x8615a3[_0x5148('0x77')]](_0x8615a3['value'],_0x4ef9f8['lastevent']):![];case _0x5148('0x5f'):return _0x4ef9f8['routeId']?operators[_0x8615a3[_0x5148('0x77')]](_0x8615a3[_0x5148('0x72')],_0x4ef9f8[_0x5148('0x5f')]):![];case _0x5148('0x7b'):if(_0x8615a3[_0x5148('0x72')]==='null')_0x8615a3['value']=null;return typeof _0x4ef9f8['substatus']!==_0x5148('0x37')?operators[_0x8615a3[_0x5148('0x77')]](_0x8615a3['value'],_0x4ef9f8['substatus']):![];case _0x5148('0x7c'):if(_0x4ef9f8[_0x5148('0x66')]===_0x51fbe6){return _0x8615a3['value']===_0x5148('0x7d')&&_0x8615a3[_0x5148('0x77')]==='equals'?!![]:![];}break;}return![];};};module[_0x5148('0x7e')]=Trigger;
\ No newline at end of file
+var _0x2a2d=['length','interface','contactmanager','motionbar','browser','data1','popup','TemplateId','data2','render','html','template\x20not\x20found','uri','buildUri','data3','isNil','data4','location','windowWidth','windowHeight','data6','winApplication','winArguments','format','user:%s','merge','trigger:%s','action','toLowerCase','name','exec','integration','queue','script','parse','search','channel','AllConditions','every','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','account','chat','ChatWebsiteId','value','upperFirst','AccountId','operator','interaction','message','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','offlineMessage','created','equals','exports','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','sugarcrmAccounts','custom:agentcalled','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:substatus','custom:rejectmessage','custom:offlineMessage','prototype','emit','info','clone','undefined','motionChannel','voice','debug','inspect','checkTriggers','status','checkTrigger','Actions'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2a2d,0x1c7));var _0xd2a2=function(_0x10548e,_0x80eaff){_0x10548e=_0x10548e-0x0;var _0x540aa4=_0x2a2d[_0x10548e];return _0x540aa4;};'use strict';var util=require('util');var _=require(_0xd2a2('0x0'));var url=require(_0xd2a2('0x1'));var Mustache=require(_0xd2a2('0x2'));var Redis=require(_0xd2a2('0x3'));var urlforward=require(_0xd2a2('0x4'));var integration=require(_0xd2a2('0x5'));var cmContact=require(_0xd2a2('0x6'));var script=require(_0xd2a2('0x7'));var config=require(_0xd2a2('0x8'));var logger=require(_0xd2a2('0x9'))(_0xd2a2('0xa'));var ami=require(_0xd2a2('0xb'));config[_0xd2a2('0xc')]=_[_0xd2a2('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xd2a2('0xe'))(new Redis(config[_0xd2a2('0xc')]));var operators={'equals':function(_0x3cd3cf,_0x1d7bef){return _0x3cd3cf==_0x1d7bef;},'not_equals':function(_0x4d4eba,_0x36e934){return _0x4d4eba!=_0x36e934;}};var barAndWebActions=['popup',_0xd2a2('0x1'),_0xd2a2('0xf')];function Trigger(_0x2d5d56){this[_0xd2a2('0x10')]=_0x2d5d56[_0xd2a2('0x10')];this[_0xd2a2('0x11')]=_0x2d5d56[_0xd2a2('0x11')];this[_0xd2a2('0x12')]=_0x2d5d56['voiceQueues'];this['templates']=_0x2d5d56[_0xd2a2('0x13')];this['voiceExtensions']=_0x2d5d56[_0xd2a2('0x14')];this[_0xd2a2('0x15')]=_0x2d5d56[_0xd2a2('0x15')];this[_0xd2a2('0x16')]=_0x2d5d56['freshdeskAccounts'];this[_0xd2a2('0x17')]=_0x2d5d56['salesforceAccounts'];this['sugarcrmAccounts']=_0x2d5d56['sugarcrmAccounts'];this[_0xd2a2('0x18')]=_0x2d5d56[_0xd2a2('0x18')];this[_0xd2a2('0x19')]=_0x2d5d56[_0xd2a2('0x19')];this[_0xd2a2('0x1a')]=_0x2d5d56[_0xd2a2('0x1a')];this[_0xd2a2('0x1b')]=_0x2d5d56['servicenowAccounts'];this[_0xd2a2('0x1c')]=_0x2d5d56[_0xd2a2('0x1c')];this[_0xd2a2('0x1d')]=_0x2d5d56[_0xd2a2('0x1d')];this[_0xd2a2('0x1e')]={'zendesk':this[_0xd2a2('0x15')],'salesforce':this[_0xd2a2('0x17')],'freshdesk':this[_0xd2a2('0x16')],'sugarcrm':this[_0xd2a2('0x1f')],'zoho':this['zohoAccounts'],'desk':this[_0xd2a2('0x19')],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0xd2a2('0x1c')],'freshsales':this[_0xd2a2('0x1d')],'servicenow':this[_0xd2a2('0x1b')]};ami['on'](_0xd2a2('0x20'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x23'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x24'),this[_0xd2a2('0x21')]['bind'](this));ami['on'](_0xd2a2('0x25'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x26'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x27'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x28'),this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x29'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2a'),this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2b'),this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2c'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2d'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x2e'),this[_0xd2a2('0x2f')][_0xd2a2('0x22')](this));ami['on']('custom:dialconnect',this[_0xd2a2('0x2f')][_0xd2a2('0x22')](this));ami['on']('custom:dialend',this[_0xd2a2('0x2f')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x30'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on']('custom:closedinteraction',this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x31'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on']('custom:outgoingmessage',this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on']('custom:acceptmessage',this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x32'),this['syncCustomEvent'][_0xd2a2('0x22')](this));ami['on'](_0xd2a2('0x33'),this[_0xd2a2('0x21')][_0xd2a2('0x22')](this));}Trigger[_0xd2a2('0x34')][_0xd2a2('0x35')]=function(_0x3e3ca9,_0x36f278,_0x2c4f5b){logger[_0xd2a2('0x36')](_0x3e3ca9,_0x36f278,JSON['stringify'](_0x2c4f5b));io['to'](_0x3e3ca9)[_0xd2a2('0x35')](_0x36f278,_0x2c4f5b);};Trigger[_0xd2a2('0x34')][_0xd2a2('0x21')]=function(_0x31334d){var _0x2acad7=_[_0xd2a2('0x37')](_0x31334d);if(typeof _0x2acad7['motionChannel']===_0xd2a2('0x38')){_0x2acad7[_0xd2a2('0x39')]=_0xd2a2('0x3a');}logger[_0xd2a2('0x3b')](_0xd2a2('0x21'),util[_0xd2a2('0x3c')](_0x2acad7,{'showHidden':!![],'depth':null}));this[_0xd2a2('0x3d')](_0x2acad7);};Trigger[_0xd2a2('0x34')][_0xd2a2('0x2f')]=function(_0x4ba779){if(this['agents'][_0x4ba779['interface']]){this[_0xd2a2('0x21')](_0x4ba779);}};Trigger['prototype']['checkTriggers']=function(_0x2ea424){var _0x4da2ef;for(var _0x262dd1 in this[_0xd2a2('0x10')]){if(this['triggers']['hasOwnProperty'](_0x262dd1)){if(this[_0xd2a2('0x10')][_0x262dd1][_0xd2a2('0x3e')]){_0x4da2ef=this[_0xd2a2('0x3f')](this['triggers'][_0x262dd1],_0x2ea424);if(_0x4da2ef){_['merge'](_0x2ea424,_0x2ea424['variables']);for(var _0x15a747=0x0,_0x4c381e,_0x5a79b9,_0x461449;_0x15a747<this[_0xd2a2('0x10')][_0x262dd1][_0xd2a2('0x40')][_0xd2a2('0x41')];_0x15a747+=0x1){_0x4c381e=this[_0xd2a2('0x10')][_0x262dd1][_0xd2a2('0x40')][_0x15a747];if(this['agents'][_0x2ea424[_0xd2a2('0x42')]]){switch(_0x4c381e['action']['toLowerCase']()){case _0xd2a2('0x43'):break;case _0xd2a2('0x44'):case _0xd2a2('0x45'):var _0x279cc3={};switch(barAndWebActions[_0x4c381e[_0xd2a2('0x46')]]){case _0xd2a2('0x47'):_0x279cc3[_0xd2a2('0x48')]=_0x4c381e[_0xd2a2('0x49')];_0x279cc3['html']=this[_0xd2a2('0x13')][_0x4c381e[_0xd2a2('0x49')]]?Mustache[_0xd2a2('0x4a')](this[_0xd2a2('0x13')][_0x4c381e[_0xd2a2('0x49')]][_0xd2a2('0x4b')],_0x2ea424):_0xd2a2('0x4c');break;case _0xd2a2('0x1'):_0x279cc3[_0xd2a2('0x4d')]=this[_0xd2a2('0x4e')](_0x4c381e[_0xd2a2('0x49')],_0x2ea424,_['isNil'](_0x4c381e['data3'])?!![]:parseInt(_0x4c381e[_0xd2a2('0x4f')],0xa));if(_[_0xd2a2('0x50')](_0x4c381e[_0xd2a2('0x51')])){_0x279cc3[_0xd2a2('0x52')]='0';}else{_0x279cc3['uriLocation']=_0x4c381e[_0xd2a2('0x51')];_0x279cc3[_0xd2a2('0x53')]=_[_0xd2a2('0x50')](_0x4c381e['data5'])?'800':_0x4c381e['data5'];_0x279cc3[_0xd2a2('0x54')]=_[_0xd2a2('0x50')](_0x4c381e['data6'])?'600':_0x4c381e[_0xd2a2('0x55')];}break;case'winapp':_0x279cc3[_0xd2a2('0x56')]=_0x4c381e['data2']?Mustache['render'](_0x4c381e[_0xd2a2('0x49')],_0x2ea424):'';_0x279cc3[_0xd2a2('0x57')]=_0x4c381e['data3']?Mustache[_0xd2a2('0x4a')](_0x4c381e[_0xd2a2('0x4f')],_0x2ea424):'';break;}this[_0xd2a2('0x35')](util[_0xd2a2('0x58')](_0xd2a2('0x59'),this[_0xd2a2('0x11')][_0x2ea424['interface']]['name']),util[_0xd2a2('0x58')]('trigger:%s:%s',_0x4c381e['action']['toLowerCase'](),barAndWebActions[_0x4c381e[_0xd2a2('0x46')]]),_[_0xd2a2('0x5a')](_0x279cc3,_0x2ea424));break;case'jscripty':this[_0xd2a2('0x35')](util['format']('user:%s',this[_0xd2a2('0x11')][_0x2ea424[_0xd2a2('0x42')]]['name']),util[_0xd2a2('0x58')](_0xd2a2('0x5b'),_0x4c381e[_0xd2a2('0x5c')][_0xd2a2('0x5d')]()),_['merge']({'ProjectId':parseInt(_0x4c381e['data1'],0xa)},_0x2ea424));break;default:this['emit'](util[_0xd2a2('0x58')](_0xd2a2('0x59'),this[_0xd2a2('0x11')][_0x2ea424[_0xd2a2('0x42')]][_0xd2a2('0x5e')]),util['format'](_0xd2a2('0x5b'),_0x4c381e[_0xd2a2('0x5c')][_0xd2a2('0x5d')]()),_['merge']({},_0x4c381e,_0x2ea424));}}switch(_0x4c381e[_0xd2a2('0x5c')][_0xd2a2('0x5d')]()){case _0xd2a2('0x43'):cmContact[_0xd2a2('0x5f')](this['agents'][_0x2ea424['interface']],this[_0xd2a2('0x10')][_0x262dd1],_0x4c381e,_0x2ea424);break;case _0xd2a2('0x60'):integration['exec'](_0x4c381e,_0x2ea424,this[_0xd2a2('0x1e')],this[_0xd2a2('0x11')][_0x2ea424[_0xd2a2('0x42')]],this[_0xd2a2('0x12')][_0x2ea424[_0xd2a2('0x61')]],this[_0xd2a2('0x14')][_0x2ea424['routeId']]);break;case'urlforward':urlforward['exec'](_0x4c381e,_0x2ea424);break;case _0xd2a2('0x62'):script['exec'](_0x4c381e,_0x2ea424);break;}}}}}}};Trigger[_0xd2a2('0x34')]['buildUri']=function(_0x18aec2,_0x5efb7b,_0x5c5526){var _0x315a72=url[_0xd2a2('0x63')](Mustache[_0xd2a2('0x4a')](_0x18aec2,_0x5efb7b),!![]);if(_0x5c5526){_[_0xd2a2('0x5a')](_0x315a72['query'],_0x5efb7b);}delete _0x315a72[_0xd2a2('0x64')];var _0x1bd6b5=url[_0xd2a2('0x58')](_0x315a72);_0x1bd6b5=_0x1bd6b5['replace'](/\/\?/g,'?');return _0x1bd6b5;};Trigger[_0xd2a2('0x34')][_0xd2a2('0x3f')]=function(_0x46e44c,_0x4433a1){var _0x16efa7=!![];var _0xd39dba=!![];var _0xe2c275=![];if(_0x46e44c[_0xd2a2('0x65')]===_0x4433a1['motionChannel']){_0xe2c275=!![];}if(_0x46e44c[_0xd2a2('0x66')][_0xd2a2('0x41')]){_0x16efa7=_[_0xd2a2('0x67')](_0x46e44c[_0xd2a2('0x66')],this[_0xd2a2('0x68')](_0x4433a1,_0x46e44c[_0xd2a2('0x65')]));}if(_0x46e44c[_0xd2a2('0x69')][_0xd2a2('0x41')]){_0xd39dba=_[_0xd2a2('0x6a')](_0x46e44c['AnyConditions'],this['checkConditions'](_0x4433a1,_0x46e44c['channel']));}var _0x12c3de=_0xe2c275&&_0x16efa7&&_0xd39dba;logger[_0xd2a2('0x3b')](_0xd2a2('0x6b'),util[_0xd2a2('0x3c')](_0x46e44c,{'showHidden':!![],'depth':null}),_0xd2a2('0x6c'),util[_0xd2a2('0x3c')](_0x4433a1,{'showHidden':!![],'depth':null}),_0xe2c275,_0x16efa7,_0xd39dba);return _0x12c3de;};Trigger['prototype'][_0xd2a2('0x68')]=function(_0x58aade,_0x240ba8){return function(_0x52b3f5){switch(_0x52b3f5['field']){case _0xd2a2('0x6d'):if(_0x58aade['channel']===_0x240ba8){if(_0x240ba8===_0xd2a2('0x6e')){return _0x58aade[_0xd2a2('0x6f')]?operators[_0x52b3f5['operator']](Number(_0x52b3f5[_0xd2a2('0x70')]),_0x58aade[_0xd2a2('0x6f')]):![];}else{return _0x58aade[_[_0xd2a2('0x71')](_0x240ba8)+_0xd2a2('0x72')]?operators[_0x52b3f5[_0xd2a2('0x73')]](Number(_0x52b3f5['value']),_0x58aade[_[_0xd2a2('0x71')](_0x240ba8)+_0xd2a2('0x72')]):![];}}break;case _0xd2a2('0x74'):case _0xd2a2('0x75'):if(_0x58aade[_0xd2a2('0x65')]===_0x240ba8){return _0x58aade[_0xd2a2('0x76')]?operators[_0x52b3f5[_0xd2a2('0x73')]](_0x52b3f5[_0xd2a2('0x70')],_0x58aade[_0xd2a2('0x76')]):![];}break;case _0xd2a2('0x61'):return _0x58aade['queue']?operators[_0x52b3f5['operator']](_0x52b3f5[_0xd2a2('0x70')],_0x58aade[_0xd2a2('0x61')]):![];case _0xd2a2('0x77'):return _0x58aade[_0xd2a2('0x78')]?operators[_0x52b3f5[_0xd2a2('0x73')]](_0x52b3f5[_0xd2a2('0x70')],_0x58aade[_0xd2a2('0x78')]):![];case _0xd2a2('0x79'):return _0x58aade[_0xd2a2('0x79')]?operators[_0x52b3f5[_0xd2a2('0x73')]](_0x52b3f5['value'],_0x58aade['lastevent']):![];case'routeId':return _0x58aade[_0xd2a2('0x7a')]?operators[_0x52b3f5[_0xd2a2('0x73')]](_0x52b3f5[_0xd2a2('0x70')],_0x58aade['routeId']):![];case _0xd2a2('0x7b'):if(_0x52b3f5[_0xd2a2('0x70')]===_0xd2a2('0x7c'))_0x52b3f5['value']=null;return typeof _0x58aade[_0xd2a2('0x7d')]!==_0xd2a2('0x38')?operators[_0x52b3f5[_0xd2a2('0x73')]](_0x52b3f5['value'],_0x58aade[_0xd2a2('0x7d')]):![];case _0xd2a2('0x7e'):if(_0x58aade[_0xd2a2('0x65')]===_0x240ba8){return _0x52b3f5[_0xd2a2('0x70')]===_0xd2a2('0x7f')&&_0x52b3f5['operator']===_0xd2a2('0x80')?!![]:![];}break;}return![];};};module[_0xd2a2('0x81')]=Trigger;
\ No newline at end of file
index b5c8ef1..013adcf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['CTI','concat','Tags','Descriptions','/api/v2/users/%d','user','%s/customers/%d/cases','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','integrationTab','newTab','catch','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','application/json','validateEmail','format','%s/users','then','total_entries','find','_embedded','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','%s/customers','remoteUri','POST','length','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variableName','custom_fields','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe14b,0x93));var _0xbe14=function(_0x5021b4,_0x4db4ae){_0x5021b4=_0x5021b4-0x0;var _0x488a02=_0xe14b[_0x5021b4];return _0x488a02;};'use strict';var _=require(_0xbe14('0x0'));var rp=require(_0xbe14('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0xbe14('0x2'));var intUtil=require(_0xbe14('0x3'));var config=require('../../../../config/environment');var logger=require(_0xbe14('0x4'))('desk');config['redis']=_[_0xbe14('0x5')](config[_0xbe14('0x6')],{'host':_0xbe14('0x7'),'port':0x18eb});var io=require(_0xbe14('0x8'))(new Redis(config[_0xbe14('0x6')]));function emit(_0x39387e,_0x196fca,_0x566ae7){io['to'](_0x39387e)['emit'](_0x196fca,_0x566ae7);}var headers={'Content-Type':'application/json','Accept':_0xbe14('0x9')};function getUser(_0x6fceff,_0xd68cd7){if(intUtil[_0xbe14('0xa')](_0xd68cd7)===!![]){logger['info']('Getting\x20agent\x20with\x20email',_0xd68cd7);return request({'uri':util[_0xbe14('0xb')](_0xbe14('0xc'),_0x6fceff['remoteUri'])})[_0xbe14('0xd')](function(_0x35aa19){if(_0x35aa19[_0xbe14('0xe')]){return _[_0xbe14('0xf')](_0x35aa19[_0xbe14('0x10')][_0xbe14('0x11')],{'email':_0xd68cd7});}})[_0xbe14('0xd')](function(_0x2850cb){if(_0x2850cb){logger[_0xbe14('0x12')](_0xbe14('0x13'));return _0x2850cb;}else{logger[_0xbe14('0x12')](_0xbe14('0x14'));return request({'uri':util[_0xbe14('0xb')]('%s/users/me',_0x6fceff['remoteUri'])});}});}else{logger[_0xbe14('0x12')](_0xbe14('0x15'));return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x16'),_0x6fceff['remoteUri'])});}}function request(_0x21c789){logger[_0xbe14('0x17')](_0xbe14('0x18'),JSON[_0xbe14('0x19')](_0x21c789));return rp(_[_0xbe14('0x5')](_0x21c789,{'method':_0xbe14('0x1a'),'headers':headers,'json':!![]}));}function getAuth(_0x17ae86){var _0x5ea1f8;if(_0x17ae86[_0xbe14('0x1b')]===_0xbe14('0x1c')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x1d'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x1f')]);}else if(_0x17ae86['authType']===_0xbe14('0x20')){_0x5ea1f8=util[_0xbe14('0xb')](_0xbe14('0x21'),_0x17ae86[_0xbe14('0x1e')],_0x17ae86[_0xbe14('0x20')]);}return util['format'](_0xbe14('0x22'),new Buffer(_0x5ea1f8)['toString'](_0xbe14('0x23')));}function getEndUser(_0x56e80c,_0x32e8eb,_0x4a25fa){logger[_0xbe14('0x12')](_0xbe14('0x24'),_0x4a25fa);return request({'uri':util['format'](_0xbe14('0x25'),_0x56e80c['remoteUri']),'qs':{'phone':_0x4a25fa}})[_0xbe14('0xd')](function(_0x4851f8){if(_0x4851f8[_0xbe14('0xe')]){logger[_0xbe14('0x12')](_0xbe14('0x26'));return _0x4851f8[_0xbe14('0x10')][_0xbe14('0x11')][0x0];}else{logger[_0xbe14('0x12')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xbe14('0xb')](_0xbe14('0x27'),_0x56e80c[_0xbe14('0x28')]),'method':_0xbe14('0x29'),'body':{'first_name':_0x32e8eb,'title':_0x32e8eb,'phone_numbers':[{'type':'work','value':_0x4a25fa}]}});}});}function getTags(_0x16f884,_0x29fc64){var _0x59bf34=[];if(_0x16f884&&_0x16f884[_0xbe14('0x2a')]>0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});};
\ No newline at end of file
+var _0x55ca=['debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','token','%s/token:%s','toString','base64','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','_embedded','entries','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','length','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','string','idField','custom_fields','variable','variableName','customVariable','Variable','name','priority','merge','xCALLY','Motion','CTI','concat','Tags','getString','Descriptions','/api/v2/users/%d','user','Fields','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','error','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','./util','../../../../config/environment','desk','redis','defaults','localhost','socket.io-emitter','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','%s/users','remoteUri','then','total_entries','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me'];(function(_0x44e917,_0x5439f9){var _0x30570f=function(_0x2cb29a){while(--_0x2cb29a){_0x44e917['push'](_0x44e917['shift']());}};_0x30570f(++_0x5439f9);}(_0x55ca,0x126));var _0xa55c=function(_0x6b4e41,_0x3ed208){_0x6b4e41=_0x6b4e41-0x0;var _0x346877=_0x55ca[_0x6b4e41];return _0x346877;};'use strict';var _=require(_0xa55c('0x0'));var rp=require(_0xa55c('0x1'));var md5=require('md5');var util=require('util');var Redis=require('ioredis');var intUtil=require(_0xa55c('0x2'));var config=require(_0xa55c('0x3'));var logger=require('../../../../config/logger')(_0xa55c('0x4'));config[_0xa55c('0x5')]=_[_0xa55c('0x6')](config[_0xa55c('0x5')],{'host':_0xa55c('0x7'),'port':0x18eb});var io=require(_0xa55c('0x8'))(new Redis(config[_0xa55c('0x5')]));function emit(_0x4d0624,_0x2121fd,_0x2537f0){io['to'](_0x4d0624)['emit'](_0x2121fd,_0x2537f0);}var headers={'Content-Type':_0xa55c('0x9'),'Accept':_0xa55c('0x9')};function getUser(_0x52a3bc,_0x5849ad){if(intUtil[_0xa55c('0xa')](_0x5849ad)===!![]){logger[_0xa55c('0xb')](_0xa55c('0xc'),_0x5849ad);return request({'uri':util[_0xa55c('0xd')](_0xa55c('0xe'),_0x52a3bc[_0xa55c('0xf')])})[_0xa55c('0x10')](function(_0x70c2de){if(_0x70c2de[_0xa55c('0x11')]){return _[_0xa55c('0x12')](_0x70c2de['_embedded']['entries'],{'email':_0x5849ad});}})[_0xa55c('0x10')](function(_0x576044){if(_0x576044){logger['info']('Agent\x20found!');return _0x576044;}else{logger[_0xa55c('0xb')](_0xa55c('0x13'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}});}else{logger[_0xa55c('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x14'),_0x52a3bc[_0xa55c('0xf')])});}}function request(_0x31e10d){logger[_0xa55c('0x15')](_0xa55c('0x16'),JSON[_0xa55c('0x17')](_0x31e10d));return rp(_[_0xa55c('0x6')](_0x31e10d,{'method':_0xa55c('0x18'),'headers':headers,'json':!![]}));}function getAuth(_0x4cee3c){var _0x3d4c9e;if(_0x4cee3c[_0xa55c('0x19')]===_0xa55c('0x1a')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1b'),_0x4cee3c[_0xa55c('0x1c')],_0x4cee3c['password']);}else if(_0x4cee3c['authType']===_0xa55c('0x1d')){_0x3d4c9e=util[_0xa55c('0xd')](_0xa55c('0x1e'),_0x4cee3c['username'],_0x4cee3c[_0xa55c('0x1d')]);}return util[_0xa55c('0xd')]('Basic\x20%s',new Buffer(_0x3d4c9e)[_0xa55c('0x1f')](_0xa55c('0x20')));}function getEndUser(_0x940f28,_0x1965f1,_0x234372){logger['info'](_0xa55c('0x21'),_0x234372);return request({'uri':util['format']('%s/customers/search',_0x940f28['remoteUri']),'qs':{'phone':_0x234372}})[_0xa55c('0x10')](function(_0x54b038){if(_0x54b038[_0xa55c('0x11')]){logger[_0xa55c('0xb')](_0xa55c('0x22'));return _0x54b038[_0xa55c('0x23')][_0xa55c('0x24')][0x0];}else{logger[_0xa55c('0xb')](_0xa55c('0x25'));return request({'uri':util[_0xa55c('0xd')](_0xa55c('0x26'),_0x940f28[_0xa55c('0xf')]),'method':_0xa55c('0x27'),'body':{'first_name':_0x1965f1,'title':_0x1965f1,'phone_numbers':[{'type':'work','value':_0x234372}]}});}});}function getTags(_0x430d55,_0x28814f){var _0x1c9f6b=[];if(_0x430d55&&_0x430d55[_0xa55c('0x28')]>0x0){_0x1c9f6b=_['map'](_0x430d55,_0x28814f);}return _0x1c9f6b;}function getCustomFields(_0x1377b0,_0x22f6b6){var _0x1b8388=[];var _0x201941={'custom_fields':{}};if(_0x1377b0[_0xa55c('0x28')]>0x0){_[_0xa55c('0x29')](_0x1377b0,function(_0x52d37f){if(_[_0xa55c('0x2a')](['string',_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x2d')]&&!_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0x52d37f['nameField'][_0xa55c('0x2f')]()]=_0x52d37f[_0xa55c('0x30')][_0xa55c('0x1f')]();}else if(_[_0xa55c('0x2a')]([_0xa55c('0x31'),_0xa55c('0x2b')],_0x52d37f[_0xa55c('0x2c')])&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x52d37f['content']['toString']();}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x34')&&_0x52d37f['variableName']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x35')]]&&(_0x201941[_0xa55c('0x33')][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f[_0xa55c('0x35')]][_0xa55c('0x1f')]());}else if(_0x52d37f[_0xa55c('0x2c')]===_0xa55c('0x36')&&_0x52d37f['Variable']&&_0x52d37f['Variable']['name']&&_0x52d37f[_0xa55c('0x32')]&&_0x52d37f[_0xa55c('0x2e')]){_0x22f6b6[_0x52d37f[_0xa55c('0x37')]['name'][_0xa55c('0x2f')]()]&&(_0x201941['custom_fields'][_0x52d37f[_0xa55c('0x32')]]=_0x22f6b6[_0x52d37f['Variable'][_0xa55c('0x38')][_0xa55c('0x2f')]()][_0xa55c('0x1f')]());}});}if(_0x201941['priority']){_0x201941[_0xa55c('0x39')]=Number(_0x201941[_0xa55c('0x39')]);}return _0x201941;}function getTicket(_0x47e93c,_0x6f9c4c,_0x194e78,_0x4d9083,_0x529ff8){logger[_0xa55c('0xb')]('Creating\x20new\x20ticket...');var _0x1e75dc=_[_0xa55c('0x3a')]({'subject':intUtil['getString'](_0x4d9083['Subjects'],_0x529ff8,'\x20'),'type':'phone','status':'new','labels':[_0xa55c('0x3b'),_0xa55c('0x3c'),_0xa55c('0x3d')][_0xa55c('0x3e')](getTags(_0x4d9083[_0xa55c('0x3f')],'name')),'description':intUtil[_0xa55c('0x40')](_0x4d9083[_0xa55c('0x41')],_0x529ff8,'\x0a'),'_links':{'assigned_user':{'href':util[_0xa55c('0xd')](_0xa55c('0x42'),_0x6f9c4c['id']),'class':_0xa55c('0x43')}},'message':{'direction':'in','body':intUtil[_0xa55c('0x40')](_0x4d9083['Descriptions'],_0x529ff8,'\x0a')}},getCustomFields(_0x4d9083[_0xa55c('0x44')],_0x529ff8));return request({'uri':util['format']('%s/customers/%d/cases',_0x47e93c[_0xa55c('0xf')],_0x194e78['id']),'method':_0xa55c('0x27'),'body':_0x1e75dc});}exports['queue']=function(_0x2bd98b,_0x508bd3,_0x5f25f7,_0x2f8449,_0x3fea03,_0x1630ac){var _0x540337,_0x1b2708;_0x1630ac[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1630ac[_0xa55c('0xf')]);_0x1630ac['serverUrl']=intUtil[_0xa55c('0x45')](_0x1630ac[_0xa55c('0x46')]);if(_0x3fea03&&_0x3fea03['monitor_format']){logger[_0xa55c('0xb')](_0xa55c('0x47'),'Recording\x20is\x20enabled!');_0x508bd3[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1630ac['serverUrl'],_0x508bd3[_0xa55c('0x4a')],md5(_0x508bd3['uniqueid']));}else{_0x508bd3[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1630ac);return getUser(_0x1630ac,_0x2f8449[_0xa55c('0x4c')])['then'](function(_0x41eab1){_0x540337=_0x41eab1;logger[_0xa55c('0xb')]('The\x20User\x20ID\x20is:',_0x540337['id']);return getEndUser(_0x1630ac,_0x508bd3[_0xa55c('0x4d')],_0x508bd3[_0xa55c('0x4e')]);})['then'](function(_0x11ff1d){_0x1b2708=_0x11ff1d;logger[_0xa55c('0xb')]('The\x20Enduser\x20ID\x20is:',_0x1b2708['id']);return getTicket(_0x1630ac,_0x540337,_0x1b2708,_0x5f25f7,_0x508bd3);})[_0xa55c('0x10')](function(_0x81cee8){if(_0x81cee8){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger['info'](_0xa55c('0x50'),_0x81cee8['id']);switch(_0x1630ac['type']){case _0xa55c('0x51'):logger[_0xa55c('0xb')](_0xa55c('0x47'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449['name']),_0xa55c('0x53'),{'recordId':_0x81cee8['id']});break;case _0xa55c('0x54'):logger[_0xa55c('0xb')](_0xa55c('0x47'),_0xa55c('0x55'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2f8449[_0xa55c('0x38')]),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')]('https://xcally.desk.com/web/agent/case/%d',_0x81cee8['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x47'),_0xa55c('0x58'));}}})['catch'](function(_0x4c3095){console[_0xa55c('0x57')](_0x4c3095);logger['error'](_0xa55c('0x47'),JSON['stringify'](_0x4c3095));});};exports[_0xa55c('0x59')]=function(_0x228df4,_0x181802,_0x3f9313,_0x2ecf79,_0x5b1cf3,_0x44b7c1,_0x4607ca){var _0x4b85cc,_0x3929a6;_0x44b7c1[_0xa55c('0xf')]=intUtil[_0xa55c('0x45')](_0x44b7c1[_0xa55c('0xf')]);_0x44b7c1['serverUrl']=intUtil['stripTrailingSlash'](_0x44b7c1[_0xa55c('0x46')]);if(_0x4607ca&&_0x4607ca[_0xa55c('0x5a')]&&_0x4607ca[_0xa55c('0x5a')]!==_0xa55c('0x5b')){logger['info'](_0xa55c('0x5c'),'Recording\x20is\x20enabled!');_0x181802[_0xa55c('0x48')]=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x44b7c1[_0xa55c('0x46')],_0x181802[_0xa55c('0x4a')],md5(_0x181802['uniqueid']));}headers[_0xa55c('0x4b')]=getAuth(_0x44b7c1);return getUser(_0x44b7c1,_0x2ecf79['email'])[_0xa55c('0x10')](function(_0x157afe){_0x4b85cc=_0x157afe;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0x4b85cc['id']);return getEndUser(_0x44b7c1,_0x181802[_0xa55c('0x5e')],_0x181802[_0xa55c('0x5f')]);})[_0xa55c('0x10')](function(_0x53e2be){_0x3929a6=_0x53e2be;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3929a6['id']);return getTicket(_0x44b7c1,_0x4b85cc,_0x3929a6,_0x3f9313,_0x181802);})[_0xa55c('0x10')](function(_0x23a30e){if(_0x23a30e){logger[_0xa55c('0xb')]('Ticket\x20created!');logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x23a30e['id']);switch(_0x44b7c1[_0xa55c('0x2c')]){case _0xa55c('0x51'):logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x61'));emit(util[_0xa55c('0xd')](_0xa55c('0x52'),_0x2ecf79[_0xa55c('0x38')]),_0xa55c('0x53'),{'recordId':_0x23a30e['id']});break;case'newTab':logger[_0xa55c('0xb')]('[QUEUE]',_0xa55c('0x55'));emit(util['format'](_0xa55c('0x52'),_0x2ecf79['name']),_0xa55c('0x56'),{'uri':util[_0xa55c('0xd')](_0xa55c('0x62'),_0x44b7c1[_0xa55c('0xf')],_0x23a30e['id'])});break;default:logger[_0xa55c('0x57')](_0xa55c('0x5c'),_0xa55c('0x58'));}}})[_0xa55c('0x63')](function(_0x14b515){logger[_0xa55c('0x57')]('[OUTBOUND]',JSON[_0xa55c('0x17')](_0x14b515));});};exports[_0xa55c('0x64')]=function(_0x4ef914,_0x18b928,_0x2b8b88,_0x3e3b4b,_0x9fe234,_0x1b8b06){var _0xa38271,_0x3cef1f;_0x1b8b06[_0xa55c('0xf')]=intUtil['stripTrailingSlash'](_0x1b8b06[_0xa55c('0xf')]);_0x1b8b06[_0xa55c('0x46')]=intUtil[_0xa55c('0x45')](_0x1b8b06[_0xa55c('0x46')]);if(_0x9fe234&&_0x9fe234[_0xa55c('0x65')]){logger[_0xa55c('0xb')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',_0xa55c('0x68'));_0x18b928['recordingURL']=util[_0xa55c('0xd')](_0xa55c('0x49'),_0x1b8b06[_0xa55c('0x46')],_0x18b928[_0xa55c('0x4a')],md5(_0x18b928[_0xa55c('0x4a')]));}else{_0x18b928[_0xa55c('0x48')]='';}headers[_0xa55c('0x4b')]=getAuth(_0x1b8b06);return getUser(_0x1b8b06)[_0xa55c('0x10')](function(_0x2e4cf7){_0xa38271=_0x2e4cf7;logger[_0xa55c('0xb')](_0xa55c('0x5d'),_0xa38271['id']);return getEndUser(_0x1b8b06,_0x18b928['calleridname'],_0x18b928[_0xa55c('0x4e')]);})['then'](function(_0x1228a4){_0x3cef1f=_0x1228a4;logger[_0xa55c('0xb')](_0xa55c('0x60'),_0x3cef1f['id']);return getTicket(_0x1b8b06,_0xa38271,_0x3cef1f,_0x2b8b88,_0x18b928);})['then'](function(_0x4d9722){if(_0x4d9722){logger[_0xa55c('0xb')](_0xa55c('0x4f'));logger[_0xa55c('0xb')](_0xa55c('0x50'),_0x4d9722['id']);}})['catch'](function(_0x149cb9){logger[_0xa55c('0x57')]('['+_0x18b928[_0xa55c('0x66')][_0xa55c('0x67')]()+']',JSON[_0xa55c('0x17')](_0x149cb9));});};
\ No newline at end of file
index 9d7b817..7622ac8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdc1c=['validateEmail','email','userEmail','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','length','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','headers','substring','lastIndexOf','enduserId','telephone1','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','Bearer\x20','4.0','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','type','customField','idField','toLowerCase','indexOf','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','callDirection','queue','phonecalls','odata-entityid','ticketId','catch','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','modernAuthentication','remoteUri','CloudProvider','data7','data5','POST','clientId','username','password','clientSecret','then','error','toUpperCase','message','value'];(function(_0x385cba,_0x2e3e04){var _0x58d410=function(_0x44c3bf){while(--_0x44c3bf){_0x385cba['push'](_0x385cba['shift']());}};_0x58d410(++_0x2e3e04);}(_0xdc1c,0x18b));var _0xcdc1=function(_0x3ee432,_0x54805b){_0x3ee432=_0x3ee432-0x0;var _0x50af4e=_0xdc1c[_0x3ee432];return _0x50af4e;};'use strict';var _=require(_0xcdc1('0x0'));var rp=require(_0xcdc1('0x1'));var util=require(_0xcdc1('0x2'));var intUtil=require(_0xcdc1('0x3'));var md5=require('md5');var Redis=require(_0xcdc1('0x4'));var logger=require(_0xcdc1('0x5'))(_0xcdc1('0x6'));var config=require(_0xcdc1('0x7'));config[_0xcdc1('0x8')]=_['defaults'](config[_0xcdc1('0x8')],{'host':_0xcdc1('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x23d2a4,_0x56c162,_0x8f5a3a){if(_0x23d2a4[_0xcdc1('0xa')]){_0x23d2a4[_0xcdc1('0xb')]=_0x23d2a4[_0xcdc1('0xc')][_0xcdc1('0xd')];_0x23d2a4['tenantId']=_0x23d2a4[_0xcdc1('0xc')]['data2'];return Promise['resolve'](_0x23d2a4[_0xcdc1('0xc')][_0xcdc1('0xe')]);}var _0x20a66d={'method':_0xcdc1('0xf'),'uri':_0x56c162,'form':{'client_id':_0x23d2a4[_0xcdc1('0x10')],'resource':_0x23d2a4['remoteUri'],'username':_0x23d2a4[_0xcdc1('0x11')],'password':_0x23d2a4[_0xcdc1('0x12')],'grant_type':_0xcdc1('0x12'),'client_secret':_0x23d2a4[_0xcdc1('0x13')]},'json':!![]};return rp(_0x20a66d)[_0xcdc1('0x14')](function(_0x561bd8){return _0x561bd8['access_token'];})['catch'](function(_0x992785){logger[_0xcdc1('0x15')]('['+[_0x8f5a3a[_0xcdc1('0x16')]()]+']\x20Wrong\x20credentials!');return _0x992785[_0xcdc1('0x17')];});}function getUser(_0x3d01fa,_0x38e520,_0xa81962,_0x537405,_0xd4170b,_0x45ddbb){return new Promise(function(_0x65c063,_0x272bb2){return getAuthToken(_0x38e520,_0x537405,_0x45ddbb)[_0xcdc1('0x14')](function(_0x36d7f5){var _0x424237={'method':'GET','uri':_0xd4170b+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x36d7f5,'OData-Version':'4.0'},'json':!![]};return rp(_0x424237);})['then'](function(_0x582c3f){var _0x898325=_0x582c3f[_0xcdc1('0x18')];var _0x544f1b=![];var _0x25b008=null;if(!_['isNil'](_0xa81962)){if(intUtil[_0xcdc1('0x19')](_0xa81962[_0xcdc1('0x1a')])){_0x3d01fa[_0xcdc1('0x1b')]=_0xa81962[_0xcdc1('0x1a')];for(_0x25b008=0x0;_0x25b008<_0x898325['length'];_0x25b008++){if(_0x898325[_0x25b008][_0xcdc1('0x1c')]===_0xa81962[_0xcdc1('0x1a')]&&!_0x898325[_0x25b008][_0xcdc1('0x1d')]){_0x544f1b=!![];logger[_0xcdc1('0x1e')]('['+[_0x45ddbb[_0xcdc1('0x16')]()]+_0xcdc1('0x1f')+_0x898325[_0x25b008][_0xcdc1('0x20')]+'!');_0x3d01fa[_0xcdc1('0x21')]=_0x898325[_0x25b008][_0xcdc1('0x20')];}}}}if(!_0x544f1b){logger['info']('['+[_0x45ddbb[_0xcdc1('0x16')]()]+_0xcdc1('0x22'));_0x3d01fa[_0xcdc1('0x1b')]=_0x38e520[_0xcdc1('0x11')];for(_0x25b008=0x0;_0x25b008<_0x898325[_0xcdc1('0x23')];_0x25b008++){if(_0x898325[_0x25b008][_0xcdc1('0x1c')]===_0x38e520['username']){_0x3d01fa[_0xcdc1('0x21')]=_0x898325[_0x25b008][_0xcdc1('0x20')];}}}_0x65c063(_0x3d01fa);})['catch'](function(_0x4e08bf){_0x272bb2(_0x4e08bf[_0xcdc1('0x17')]);});});}function createEndUser(_0x3e9647,_0x5df7a8,_0x1446d9,_0x19f6e7,_0x46f2cd,_0x11058b,_0x534564){return new Promise(function(_0x43ec6d,_0x5f1a86){return getAuthToken(_0x5df7a8,_0x1446d9,_0x11058b)[_0xcdc1('0x14')](function(_0x590e53){var _0x510b96=_0x11058b['toLowerCase']()===_0xcdc1('0x24')?_0x46f2cd[_0xcdc1('0x25')]:_0x46f2cd[_0xcdc1('0x26')];var _0x6583a8={'method':_0xcdc1('0xf'),'uri':_0x19f6e7+_0xcdc1('0x27'),'body':{'fullname':_0x510b96,'firstname':_0x510b96,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xcdc1('0x28')+_0x3e9647['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x590e53,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x6583a8['body'][_0x534564]=_0x510b96;return rp(_0x6583a8);})[_0xcdc1('0x14')](function(_0x4866c3){var _0x5e236f=_0x4866c3[_0xcdc1('0x29')]['odata-entityid'];var _0x1e1c0e=_0x5e236f[_0xcdc1('0x2a')](_0x5e236f['lastIndexOf']('(')+0x1,_0x5e236f[_0xcdc1('0x2b')](')'));_0x3e9647[_0xcdc1('0x2c')]=_0x1e1c0e;_0x43ec6d(_0x3e9647);})['catch'](function(_0x32aad5){_0x5f1a86(_0x32aad5[_0xcdc1('0x17')]);});});}function getEndUser(_0x44d9ad,_0x8d15f0,_0x1c8d58,_0x302cb7,_0x4eb411,_0x366bd2,_0x13f8d0,_0x55d0f7){var _0x29c85f=_0x366bd2['toLowerCase']()==='outbound'?_0x4eb411[_0xcdc1('0x25')]:_0x4eb411[_0xcdc1('0x26')];return getAuthToken(_0x8d15f0,_0x1c8d58,_0x366bd2)[_0xcdc1('0x14')](function(_0x3eb8d0){_0x55d0f7=_0x55d0f7?_0x55d0f7:_0xcdc1('0x2d');var _0x516ba3={'method':_0xcdc1('0x2e'),'uri':_0x302cb7+_0xcdc1('0x2f')+_0x55d0f7+_0xcdc1('0x30')+_0x55d0f7+_0xcdc1('0x31')+_0x29c85f[_0xcdc1('0x32')]('+','%2b')+'\x27','headers':{'Authorization':_0xcdc1('0x33')+_0x3eb8d0,'If-None-Match':null,'OData-Version':_0xcdc1('0x34')},'json':!![]};return rp(_0x516ba3);})['then'](function(_0x46a9a0){var _0x3bda2c=![];if(!_0x46a9a0)return _0x3bda2c;var _0x55856c=_0x46a9a0[_0xcdc1('0x18')];for(var _0x58021d=0x0;_0x58021d<_0x55856c[_0xcdc1('0x23')];_0x58021d++){if(_0x55856c[_0x58021d][_0x55d0f7]===_0x29c85f){_0x3bda2c=!![];_0x44d9ad[_0xcdc1('0x2c')]=_0x55856c[_0x58021d][_0xcdc1('0x35')];}}return _0x3bda2c;})[_0xcdc1('0x14')](function(_0x525a06){if(_0x525a06)return _0x44d9ad;if(_0x13f8d0===_0xcdc1('0x36')){logger[_0xcdc1('0x1e')]('['+[_0x366bd2[_0xcdc1('0x16')]()]+_0xcdc1('0x37'));return _0x44d9ad;}return createEndUser(_0x44d9ad,_0x8d15f0,_0x1c8d58,_0x302cb7,_0x4eb411,_0x366bd2,_0x55d0f7)[_0xcdc1('0x14')](function(_0x51941e){logger[_0xcdc1('0x1e')]('['+[_0x366bd2[_0xcdc1('0x16')]()]+_0xcdc1('0x38'),_0x51941e[_0xcdc1('0x2c')]);return _0x51941e;});});}function getCustomFields(_0x38416d,_0x24ede1,_0xa0a61b){var _0x2ad9c1={};if(_0x38416d[_0xcdc1('0x23')]>0x0){_[_0xcdc1('0x39')](_0x38416d,function(_0x34b495){if(_[_0xcdc1('0x3a')]([_0xcdc1('0x3b'),'picklist'],_0x34b495[_0xcdc1('0x3c')])&&_0x34b495['nameField']&&!_0x34b495[_0xcdc1('0x3d')]){var _0xa96f8b=_0x34b495[_0xcdc1('0x3e')][_0xcdc1('0x3f')]();var _0x4f067e=_0xa96f8b['substring'](0x0,_0xa96f8b[_0xcdc1('0x40')]('_'));var _0x4d8b9d=_0xa96f8b[_0xcdc1('0x2a')](_0xa96f8b[_0xcdc1('0x40')]('_')+0x1);if(_0x4f067e===_0xa0a61b){_0x2ad9c1[_0x4d8b9d]=_0x34b495['content'];}}});}return _0x2ad9c1;}function getTicket(_0x167aa7,_0x36d9c8,_0x3a0f1f,_0x2bb9d5,_0x471b6b,_0x33302e,_0x281590){return new Promise(function(_0x5d764b,_0x3c6f1d){var _0x1cb20d;return getAuthToken(_0x36d9c8,_0x3a0f1f,_0x281590)['then'](function(_0x109cbc){if(_0x33302e[_0xcdc1('0x41')]===_0xcdc1('0x42')){_0x1cb20d={'method':_0xcdc1('0xf'),'uri':_0x2bb9d5+_0xcdc1('0x43'),'body':Object[_0xcdc1('0x44')]({},{'title':intUtil[_0xcdc1('0x45')](_0x33302e[_0xcdc1('0x46')],_0x471b6b,'\x20'),'description':intUtil[_0xcdc1('0x45')](_0x33302e[_0xcdc1('0x47')],_0x471b6b,'\x0a'),'customerid_contact@odata.bind':_0x167aa7[_0xcdc1('0x2c')]?_0xcdc1('0x48')+_0x167aa7[_0xcdc1('0x2c')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x167aa7[_0xcdc1('0x21')]+')','caseorigincode':'1'},getCustomFields(_0x33302e[_0xcdc1('0x49')],_0x471b6b,_0x33302e['ticketType'])),'headers':{'Authorization':_0xcdc1('0x33')+_0x109cbc,'OData-Version':_0xcdc1('0x34')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x33302e[_0xcdc1('0x41')]==='phonecall'){var _0x504c29=_0x167aa7[_0xcdc1('0x2c')]?[{'partyid_systemuser@odata.bind':_0xcdc1('0x28')+_0x167aa7['userId']+')','participationtypemask':_0x167aa7[_0xcdc1('0x4a')]===_0xcdc1('0x4b')?0x2:0x1},{'partyid_contact@odata.bind':_0xcdc1('0x48')+_0x167aa7[_0xcdc1('0x2c')]+')','participationtypemask':_0x167aa7[_0xcdc1('0x4a')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xcdc1('0x28')+_0x167aa7[_0xcdc1('0x21')]+')','participationtypemask':_0x167aa7[_0xcdc1('0x4a')]===_0xcdc1('0x4b')?0x2:0x1}];_0x1cb20d={'method':_0xcdc1('0xf'),'uri':_0x2bb9d5+_0xcdc1('0x4c'),'body':Object[_0xcdc1('0x44')]({},{'subject':intUtil['getString'](_0x33302e[_0xcdc1('0x46')],_0x471b6b,'\x20'),'phonenumber':String(_0x471b6b[_0xcdc1('0x26')]),'description':intUtil['getString'](_0x33302e[_0xcdc1('0x47')],_0x471b6b,'\x0a'),'regardingobjectid_contact@odata.bind':_0x167aa7[_0xcdc1('0x2c')]?'/contacts('+_0x167aa7[_0xcdc1('0x2c')]+')':undefined,'ownerid@odata.bind':_0xcdc1('0x28')+_0x167aa7[_0xcdc1('0x21')]+')','directioncode':_0x167aa7['callDirection']===_0xcdc1('0x4b')?![]:!![],'phonecall_activity_parties':_0x504c29},getCustomFields(_0x33302e[_0xcdc1('0x49')],_0x471b6b,_0x33302e[_0xcdc1('0x41')])),'headers':{'Authorization':_0xcdc1('0x33')+_0x109cbc,'OData-Version':_0xcdc1('0x34')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1cb20d);})[_0xcdc1('0x14')](function(_0x58c83e){var _0x41fe65=_0x58c83e[_0xcdc1('0x29')][_0xcdc1('0x4d')];var _0x5530c3=_0x41fe65[_0xcdc1('0x2a')](_0x41fe65['lastIndexOf']('(')+0x1,_0x41fe65[_0xcdc1('0x2b')](')'));_0x167aa7[_0xcdc1('0x4e')]=_0x5530c3;_0x5d764b(_0x167aa7);})[_0xcdc1('0x4f')](function(_0x283eed){_0x3c6f1d(_0x283eed[_0xcdc1('0x17')]);});});}function emit(_0x5ee88f,_0x2f1e3e,_0x1fd25f,_0x3fc520){var _0x11ea38={'uri':util[_0xcdc1('0x50')](_0xcdc1('0x51'),_0x5ee88f,_0x1fd25f,_0x3fc520)};io['to'](util[_0xcdc1('0x50')](_0xcdc1('0x52'),_0x2f1e3e))['emit'](_0xcdc1('0x53'),_0x11ea38);}exports['cs']=function(_0x388cb5,_0x367a41,_0x5aedee,_0x309030,_0x5796a3,_0x55668d,_0x18b994,_0x4ee875){var _0x182f62={};_0x55668d[_0xcdc1('0xb')]=_0x55668d['modernAuthentication']?intUtil[_0xcdc1('0x54')](_0x55668d[_0xcdc1('0xc')][_0xcdc1('0xd')]):intUtil[_0xcdc1('0x54')](_0x55668d[_0xcdc1('0xb')]);_0x55668d[_0xcdc1('0x55')]=intUtil[_0xcdc1('0x54')](_0x55668d['serverUrl']);_0x182f62[_0xcdc1('0x4a')]=_0x4ee875===_0xcdc1('0x4b')||_0x4ee875===_0xcdc1('0x56')?_0xcdc1('0x4b'):_0xcdc1('0x24');var _0x4a096e=_0x55668d[_0xcdc1('0xa')]?util['format']('%s/api/data/v9.0/',_0x55668d[_0xcdc1('0xc')]['data7']):util['format']('%s/api/data/v9.0/',_0x55668d['remoteUri']);var _0x26ab4b=util[_0xcdc1('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x55668d[_0xcdc1('0x57')]);var _0x137620=util[_0xcdc1('0x50')](_0xcdc1('0x58'),_0x55668d['serverUrl'],_0x367a41[_0xcdc1('0x59')],md5(_0x367a41[_0xcdc1('0x59')]));if(_0x5796a3&&_0x5796a3[_0xcdc1('0x5a')]){logger[_0xcdc1('0x1e')](_0xcdc1('0x5b'),_0xcdc1('0x5c'));_0x367a41[_0xcdc1('0x5d')]=_0x137620;}else if(_0x18b994&&_0x18b994[_0xcdc1('0x5e')]&&_0x18b994[_0xcdc1('0x5e')]!==_0xcdc1('0x5f')){logger[_0xcdc1('0x1e')]('[OUTBOUND]',_0xcdc1('0x5c'));_0x367a41[_0xcdc1('0x5d')]=_0x137620;}else{_0x367a41[_0xcdc1('0x5d')]='';}return getUser(_0x182f62,_0x55668d,_0x309030,_0x26ab4b,_0x4a096e,_0x4ee875)[_0xcdc1('0x14')](function(_0x2372e4){logger[_0xcdc1('0x1e')]('['+_0x4ee875[_0xcdc1('0x16')]()+_0xcdc1('0x60'),_0x2372e4[_0xcdc1('0x21')]);logger[_0xcdc1('0x1e')]('['+_0x4ee875[_0xcdc1('0x16')]()+_0xcdc1('0x61'),_0x2372e4[_0xcdc1('0x1b')]);return getEndUser(_0x2372e4,_0x55668d,_0x26ab4b,_0x4a096e,_0x367a41,_0x4ee875,_0x5aedee['moduleCreate'],_0x5aedee[_0xcdc1('0x62')]);})['then'](function(_0x4491fd){logger[_0xcdc1('0x1e')]('['+_0x4ee875[_0xcdc1('0x16')]()+_0xcdc1('0x63'),_0x4491fd['enduserId']);logger[_0xcdc1('0x1e')]('['+_0x4ee875['toUpperCase']()+_0xcdc1('0x64'),_0x367a41[_0xcdc1('0x26')]);return getTicket(_0x4491fd,_0x55668d,_0x26ab4b,_0x4a096e,_0x367a41,_0x5aedee,_0x4ee875);})[_0xcdc1('0x14')](function(_0x1d5bd0){logger[_0xcdc1('0x1e')](util[_0xcdc1('0x50')]('['+_0x4ee875[_0xcdc1('0x16')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x5aedee[_0xcdc1('0x41')],_0x1d5bd0[_0xcdc1('0x4e')]));logger[_0xcdc1('0x1e')](util[_0xcdc1('0x50')]('['+_0x4ee875[_0xcdc1('0x16')]()+_0xcdc1('0x65'),_0x4ee875));if(_0x4ee875!==_0xcdc1('0x56')&&_0x5aedee[_0xcdc1('0x66')]){logger['info']('['+_0x4ee875[_0xcdc1('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x55668d[_0xcdc1('0xb')],_0x309030['name'],_0x5aedee[_0xcdc1('0x41')],_0x1d5bd0[_0xcdc1('0x4e')]);}})[_0xcdc1('0x4f')](function(_0x1cd67d){logger[_0xcdc1('0x15')]('['+_0x4ee875[_0xcdc1('0x16')]()+_0xcdc1('0x67'),_0x1cd67d[_0xcdc1('0x17')]);console[_0xcdc1('0x15')](_0xcdc1('0x68'),_0x1cd67d);});};
\ No newline at end of file
+var _0x1f44=['length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','outbound','destcalleridnum','calleridnum','POST','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','toLowerCase','telephone1','contacts?$select=','%2b','contactid','nothing',']\x20Enduser\x20created!','forEach','string','customField','idField','incident','incidents','assign','Descriptions','/contacts(','Fields','ticketType','phonecall','queue','callDirection','getString','Subjects','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','trigger:browser:url','modernAuthentication','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','CloudProvider','data2','resolve','data5','clientId','username','password','then','access_token','catch','error','message','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail'];(function(_0x480d03,_0x32060d){var _0x235a96=function(_0xd5826e){while(--_0xd5826e){_0x480d03['push'](_0x480d03['shift']());}};_0x235a96(++_0x32060d);}(_0x1f44,0xba));var _0x41f4=function(_0x13e2a4,_0x245fa6){_0x13e2a4=_0x13e2a4-0x0;var _0x4baa21=_0x1f44[_0x13e2a4];return _0x4baa21;};'use strict';var _=require(_0x41f4('0x0'));var rp=require(_0x41f4('0x1'));var util=require('util');var intUtil=require(_0x41f4('0x2'));var md5=require(_0x41f4('0x3'));var Redis=require(_0x41f4('0x4'));var logger=require(_0x41f4('0x5'))('dynamics365');var config=require(_0x41f4('0x6'));config[_0x41f4('0x7')]=_[_0x41f4('0x8')](config[_0x41f4('0x7')],{'host':_0x41f4('0x9'),'port':0x18eb});var io=require(_0x41f4('0xa'))(new Redis(config[_0x41f4('0x7')]));function getAuthToken(_0x41b3f0,_0x204ad2,_0x15ff9f){if(_0x41b3f0['modernAuthentication']){_0x41b3f0[_0x41f4('0xb')]=_0x41b3f0[_0x41f4('0xc')]['data7'];_0x41b3f0['tenantId']=_0x41b3f0['CloudProvider'][_0x41f4('0xd')];return Promise[_0x41f4('0xe')](_0x41b3f0[_0x41f4('0xc')][_0x41f4('0xf')]);}var _0x1087b1={'method':'POST','uri':_0x204ad2,'form':{'client_id':_0x41b3f0[_0x41f4('0x10')],'resource':_0x41b3f0[_0x41f4('0xb')],'username':_0x41b3f0[_0x41f4('0x11')],'password':_0x41b3f0[_0x41f4('0x12')],'grant_type':'password','client_secret':_0x41b3f0['clientSecret']},'json':!![]};return rp(_0x1087b1)[_0x41f4('0x13')](function(_0x45b860){return _0x45b860[_0x41f4('0x14')];})[_0x41f4('0x15')](function(_0x295194){logger[_0x41f4('0x16')]('['+[_0x15ff9f['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x295194[_0x41f4('0x17')];});}function getUser(_0x2a6e01,_0x51dc93,_0x268fd8,_0x4f680c,_0x253882,_0x496f06){return new Promise(function(_0x52564e,_0x200983){return getAuthToken(_0x51dc93,_0x4f680c,_0x496f06)[_0x41f4('0x13')](function(_0x68f641){var _0x597d4f={'method':_0x41f4('0x18'),'uri':_0x253882+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0x41f4('0x19')+_0x68f641,'OData-Version':_0x41f4('0x1a')},'json':!![]};return rp(_0x597d4f);})[_0x41f4('0x13')](function(_0x5b0391){var _0x39da32=_0x5b0391[_0x41f4('0x1b')];var _0x2c84b4=![];var _0x4b7f5f=null;if(!_[_0x41f4('0x1c')](_0x268fd8)){if(intUtil[_0x41f4('0x1d')](_0x268fd8[_0x41f4('0x1e')])){_0x2a6e01[_0x41f4('0x1f')]=_0x268fd8[_0x41f4('0x1e')];for(_0x4b7f5f=0x0;_0x4b7f5f<_0x39da32[_0x41f4('0x20')];_0x4b7f5f++){if(_0x39da32[_0x4b7f5f][_0x41f4('0x21')]===_0x268fd8[_0x41f4('0x1e')]&&!_0x39da32[_0x4b7f5f]['isdisabled']){_0x2c84b4=!![];logger[_0x41f4('0x22')]('['+[_0x496f06[_0x41f4('0x23')]()]+_0x41f4('0x24')+_0x39da32[_0x4b7f5f][_0x41f4('0x25')]+'!');_0x2a6e01[_0x41f4('0x26')]=_0x39da32[_0x4b7f5f]['systemuserid'];}}}}if(!_0x2c84b4){logger[_0x41f4('0x22')]('['+[_0x496f06[_0x41f4('0x23')]()]+_0x41f4('0x27'));_0x2a6e01['userEmail']=_0x51dc93[_0x41f4('0x11')];for(_0x4b7f5f=0x0;_0x4b7f5f<_0x39da32[_0x41f4('0x20')];_0x4b7f5f++){if(_0x39da32[_0x4b7f5f][_0x41f4('0x21')]===_0x51dc93['username']){_0x2a6e01['userId']=_0x39da32[_0x4b7f5f]['systemuserid'];}}}_0x52564e(_0x2a6e01);})[_0x41f4('0x15')](function(_0x41918c){_0x200983(_0x41918c[_0x41f4('0x17')]);});});}function createEndUser(_0x445259,_0x2797ff,_0xdfc8c6,_0x56f86c,_0x17e3c3,_0x1b7b3f,_0x52925a){return new Promise(function(_0x46e5de,_0xd5b160){return getAuthToken(_0x2797ff,_0xdfc8c6,_0x1b7b3f)[_0x41f4('0x13')](function(_0x12970d){var _0x411d3c=_0x1b7b3f['toLowerCase']()===_0x41f4('0x28')?_0x17e3c3[_0x41f4('0x29')]:_0x17e3c3[_0x41f4('0x2a')];var _0x304058={'method':_0x41f4('0x2b'),'uri':_0x56f86c+'contacts','body':{'fullname':_0x411d3c,'firstname':_0x411d3c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x41f4('0x2c')+_0x445259[_0x41f4('0x26')]+')'},'headers':{'Authorization':_0x41f4('0x19')+_0x12970d,'OData-Version':_0x41f4('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x304058[_0x41f4('0x2d')][_0x52925a]=_0x411d3c;return rp(_0x304058);})[_0x41f4('0x13')](function(_0x27f87b){var _0x23fbe5=_0x27f87b[_0x41f4('0x2e')][_0x41f4('0x2f')];var _0x4ca921=_0x23fbe5[_0x41f4('0x30')](_0x23fbe5[_0x41f4('0x31')]('(')+0x1,_0x23fbe5['lastIndexOf'](')'));_0x445259[_0x41f4('0x32')]=_0x4ca921;_0x46e5de(_0x445259);})[_0x41f4('0x15')](function(_0xee3b6c){_0xd5b160(_0xee3b6c[_0x41f4('0x17')]);});});}function getEndUser(_0xd9ebf7,_0x5c2930,_0x235a85,_0x4ddb3c,_0x2f7438,_0x3bdd3d,_0x362fb2,_0x3f70c4){var _0x37fe4a=_0x3bdd3d[_0x41f4('0x33')]()===_0x41f4('0x28')?_0x2f7438[_0x41f4('0x29')]:_0x2f7438[_0x41f4('0x2a')];return getAuthToken(_0x5c2930,_0x235a85,_0x3bdd3d)[_0x41f4('0x13')](function(_0x431629){_0x3f70c4=_0x3f70c4?_0x3f70c4:_0x41f4('0x34');var _0x4e59be={'method':_0x41f4('0x18'),'uri':_0x4ddb3c+_0x41f4('0x35')+_0x3f70c4+'&$filter='+_0x3f70c4+'\x20eq\x20\x27'+_0x37fe4a['replace']('+',_0x41f4('0x36'))+'\x27','headers':{'Authorization':_0x41f4('0x19')+_0x431629,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4e59be);})['then'](function(_0x238516){var _0x293d95=![];if(!_0x238516)return _0x293d95;var _0x24548e=_0x238516['value'];for(var _0x14089a=0x0;_0x14089a<_0x24548e['length'];_0x14089a++){if(_0x24548e[_0x14089a][_0x3f70c4]===_0x37fe4a){_0x293d95=!![];_0xd9ebf7[_0x41f4('0x32')]=_0x24548e[_0x14089a][_0x41f4('0x37')];}}return _0x293d95;})[_0x41f4('0x13')](function(_0x4d29ec){if(_0x4d29ec)return _0xd9ebf7;if(_0x362fb2===_0x41f4('0x38')){logger['info']('['+[_0x3bdd3d['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0xd9ebf7;}return createEndUser(_0xd9ebf7,_0x5c2930,_0x235a85,_0x4ddb3c,_0x2f7438,_0x3bdd3d,_0x3f70c4)[_0x41f4('0x13')](function(_0xda6893){logger[_0x41f4('0x22')]('['+[_0x3bdd3d[_0x41f4('0x23')]()]+_0x41f4('0x39'),_0xda6893['enduserId']);return _0xda6893;});});}function getCustomFields(_0x3d818e,_0x11abce,_0x2a8cf0){var _0x4449c0={};if(_0x3d818e['length']>0x0){_[_0x41f4('0x3a')](_0x3d818e,function(_0x3a560a){if(_['includes']([_0x41f4('0x3b'),'picklist'],_0x3a560a['type'])&&_0x3a560a['nameField']&&!_0x3a560a[_0x41f4('0x3c')]){var _0x2bcf8e=_0x3a560a[_0x41f4('0x3d')][_0x41f4('0x33')]();var _0x474011=_0x2bcf8e['substring'](0x0,_0x2bcf8e['indexOf']('_'));var _0x3c3cd4=_0x2bcf8e[_0x41f4('0x30')](_0x2bcf8e['indexOf']('_')+0x1);if(_0x474011===_0x2a8cf0){_0x4449c0[_0x3c3cd4]=_0x3a560a['content'];}}});}return _0x4449c0;}function getTicket(_0x32afd5,_0x12a6b7,_0x3c1aa9,_0x28b27d,_0x2edbf7,_0x1c138c,_0x2d882b){return new Promise(function(_0x572a8e,_0x5614e9){var _0x430ed5;return getAuthToken(_0x12a6b7,_0x3c1aa9,_0x2d882b)[_0x41f4('0x13')](function(_0x256811){if(_0x1c138c['ticketType']===_0x41f4('0x3e')){_0x430ed5={'method':_0x41f4('0x2b'),'uri':_0x28b27d+_0x41f4('0x3f'),'body':Object[_0x41f4('0x40')]({},{'title':intUtil['getString'](_0x1c138c['Subjects'],_0x2edbf7,'\x20'),'description':intUtil['getString'](_0x1c138c[_0x41f4('0x41')],_0x2edbf7,'\x0a'),'customerid_contact@odata.bind':_0x32afd5[_0x41f4('0x32')]?_0x41f4('0x42')+_0x32afd5['enduserId']+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x32afd5[_0x41f4('0x26')]+')','caseorigincode':'1'},getCustomFields(_0x1c138c[_0x41f4('0x43')],_0x2edbf7,_0x1c138c[_0x41f4('0x44')])),'headers':{'Authorization':_0x41f4('0x19')+_0x256811,'OData-Version':_0x41f4('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x1c138c[_0x41f4('0x44')]===_0x41f4('0x45')){var _0x4a0b7e=_0x32afd5[_0x41f4('0x32')]?[{'partyid_systemuser@odata.bind':_0x41f4('0x2c')+_0x32afd5[_0x41f4('0x26')]+')','participationtypemask':_0x32afd5['callDirection']===_0x41f4('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x41f4('0x42')+_0x32afd5[_0x41f4('0x32')]+')','participationtypemask':_0x32afd5[_0x41f4('0x47')]===_0x41f4('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x41f4('0x2c')+_0x32afd5[_0x41f4('0x26')]+')','participationtypemask':_0x32afd5[_0x41f4('0x47')]===_0x41f4('0x46')?0x2:0x1}];_0x430ed5={'method':_0x41f4('0x2b'),'uri':_0x28b27d+'phonecalls','body':Object['assign']({},{'subject':intUtil[_0x41f4('0x48')](_0x1c138c[_0x41f4('0x49')],_0x2edbf7,'\x20'),'phonenumber':String(_0x2edbf7[_0x41f4('0x2a')]),'description':intUtil[_0x41f4('0x48')](_0x1c138c[_0x41f4('0x41')],_0x2edbf7,'\x0a'),'regardingobjectid_contact@odata.bind':_0x32afd5['enduserId']?_0x41f4('0x42')+_0x32afd5[_0x41f4('0x32')]+')':undefined,'ownerid@odata.bind':_0x41f4('0x2c')+_0x32afd5[_0x41f4('0x26')]+')','directioncode':_0x32afd5['callDirection']===_0x41f4('0x46')?![]:!![],'phonecall_activity_parties':_0x4a0b7e},getCustomFields(_0x1c138c[_0x41f4('0x43')],_0x2edbf7,_0x1c138c[_0x41f4('0x44')])),'headers':{'Authorization':_0x41f4('0x19')+_0x256811,'OData-Version':_0x41f4('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x430ed5);})[_0x41f4('0x13')](function(_0x1bc618){var _0x533cea=_0x1bc618[_0x41f4('0x2e')]['odata-entityid'];var _0x2beec7=_0x533cea[_0x41f4('0x30')](_0x533cea[_0x41f4('0x31')]('(')+0x1,_0x533cea['lastIndexOf'](')'));_0x32afd5[_0x41f4('0x4a')]=_0x2beec7;_0x572a8e(_0x32afd5);})[_0x41f4('0x15')](function(_0x35f3b5){_0x5614e9(_0x35f3b5['message']);});});}function emit(_0x526ce9,_0x5ba63a,_0x417f56,_0x57e308){var _0x47bd9c={'uri':util[_0x41f4('0x4b')](_0x41f4('0x4c'),_0x526ce9,_0x417f56,_0x57e308)};io['to'](util['format'](_0x41f4('0x4d'),_0x5ba63a))['emit'](_0x41f4('0x4e'),_0x47bd9c);}exports['cs']=function(_0x2954fb,_0x4a628d,_0x49e06b,_0xf09952,_0x8db9b6,_0x38e481,_0x7b1e69,_0x2523bd){var _0x11fa4e={};_0x38e481[_0x41f4('0xb')]=_0x38e481[_0x41f4('0x4f')]?intUtil[_0x41f4('0x50')](_0x38e481['CloudProvider'][_0x41f4('0x51')]):intUtil['stripTrailingSlash'](_0x38e481['remoteUri']);_0x38e481['serverUrl']=intUtil[_0x41f4('0x50')](_0x38e481[_0x41f4('0x52')]);_0x11fa4e[_0x41f4('0x47')]=_0x2523bd==='queue'||_0x2523bd===_0x41f4('0x53')?_0x41f4('0x46'):_0x41f4('0x28');var _0x5eff9a=_0x38e481['modernAuthentication']?util[_0x41f4('0x4b')](_0x41f4('0x54'),_0x38e481['CloudProvider']['data7']):util[_0x41f4('0x4b')](_0x41f4('0x54'),_0x38e481[_0x41f4('0xb')]);var _0x2cb9f8=util[_0x41f4('0x4b')](_0x41f4('0x55'),_0x38e481[_0x41f4('0x56')]);var _0x3455e8=util[_0x41f4('0x4b')](_0x41f4('0x57'),_0x38e481['serverUrl'],_0x4a628d['uniqueid'],md5(_0x4a628d[_0x41f4('0x58')]));if(_0x8db9b6&&_0x8db9b6[_0x41f4('0x59')]){logger[_0x41f4('0x22')](_0x41f4('0x5a'),_0x41f4('0x5b'));_0x4a628d['recordingURL']=_0x3455e8;}else if(_0x7b1e69&&_0x7b1e69['recordingFormat']&&_0x7b1e69[_0x41f4('0x5c')]!==_0x41f4('0x5d')){logger['info'](_0x41f4('0x5e'),_0x41f4('0x5b'));_0x4a628d[_0x41f4('0x5f')]=_0x3455e8;}else{_0x4a628d['recordingURL']='';}return getUser(_0x11fa4e,_0x38e481,_0xf09952,_0x2cb9f8,_0x5eff9a,_0x2523bd)[_0x41f4('0x13')](function(_0xcff57a){logger['info']('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x60'),_0xcff57a[_0x41f4('0x26')]);logger[_0x41f4('0x22')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x61'),_0xcff57a['userEmail']);return getEndUser(_0xcff57a,_0x38e481,_0x2cb9f8,_0x5eff9a,_0x4a628d,_0x2523bd,_0x49e06b[_0x41f4('0x62')],_0x49e06b[_0x41f4('0x63')]);})['then'](function(_0x337d3d){logger[_0x41f4('0x22')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x64'),_0x337d3d['enduserId']);logger[_0x41f4('0x22')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x65'),_0x4a628d['calleridnum']);return getTicket(_0x337d3d,_0x38e481,_0x2cb9f8,_0x5eff9a,_0x4a628d,_0x49e06b,_0x2523bd);})[_0x41f4('0x13')](function(_0xe29ba3){logger[_0x41f4('0x22')](util[_0x41f4('0x4b')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x66'),_0x49e06b['ticketType'],_0xe29ba3[_0x41f4('0x4a')]));logger[_0x41f4('0x22')](util[_0x41f4('0x4b')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x67'),_0x2523bd));if(_0x2523bd!==_0x41f4('0x53')&&_0x49e06b[_0x41f4('0x68')]){logger[_0x41f4('0x22')]('['+_0x2523bd[_0x41f4('0x23')]()+']',_0x41f4('0x69'));emit(_0x38e481[_0x41f4('0xb')],_0xf09952[_0x41f4('0x6a')],_0x49e06b[_0x41f4('0x44')],_0xe29ba3[_0x41f4('0x4a')]);}})['catch'](function(_0x2e8201){logger[_0x41f4('0x16')]('['+_0x2523bd[_0x41f4('0x23')]()+_0x41f4('0x6b'),_0x2e8201[_0x41f4('0x17')]);console[_0x41f4('0x16')](_0x41f4('0x6c'),_0x2e8201);});};
\ No newline at end of file
index 874c2a9..1e5611b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f45=['GET','includes','string','picklist','nameField','type','idField','customField','content','variableName','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','recordingFormat','none','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridnum','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','lastevent','toUpperCase','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','<br>','Tags','name','custom_fields','mapValues','keyBy','value','POST','then','validateEmail','%s/api/v2/agents','remoteUri','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','find','Enduser\x20created.','apiKey','toString','base64','debug','[HTTP]'];(function(_0x484cac,_0x30ad3a){var _0x1d6e77=function(_0x4f5f16){while(--_0x4f5f16){_0x484cac['push'](_0x484cac['shift']());}};_0x1d6e77(++_0x30ad3a);}(_0x3f45,0x12d));var _0x53f4=function(_0x42693d,_0x434c1c){_0x42693d=_0x42693d-0x0;var _0x57f95f=_0x3f45[_0x42693d];return _0x57f95f;};'use strict';var _=require('lodash');var rp=require(_0x53f4('0x0'));var md5=require(_0x53f4('0x1'));var util=require(_0x53f4('0x2'));var Redis=require('ioredis');var intUtil=require(_0x53f4('0x3'));var config=require(_0x53f4('0x4'));var logger=require(_0x53f4('0x5'))('freshdesk');config[_0x53f4('0x6')]=_[_0x53f4('0x7')](config[_0x53f4('0x6')],{'host':_0x53f4('0x8'),'port':0x18eb});var io=require(_0x53f4('0x9'))(new Redis(config[_0x53f4('0x6')]));var headers={'Content-Type':_0x53f4('0xa'),'Accept':'application/json'};function emit(_0x983584,_0x338b49,_0x457d06){io['to'](_0x983584)[_0x53f4('0xb')](_0x338b49,_0x457d06);}function getTicket(_0x2adad5,_0x349067,_0x4de992,_0x20b97c,_0x5b7b23){logger[_0x53f4('0xc')](_0x53f4('0xd'));var _0xdfe7fb=_[_0x53f4('0xe')]({'responder_id':_0x349067['id'],'requester_id':_0x4de992['id'],'name':util[_0x53f4('0xf')](_0x53f4('0x10'),_0x5b7b23['calleridname']),'phone':_0x5b7b23['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x20b97c['Subjects'],_0x5b7b23,'\x20'),'description':intUtil['getString'](_0x20b97c['Descriptions'],_0x5b7b23,_0x53f4('0x11')),'tags':getTags(_0x20b97c[_0x53f4('0x12')],_0x53f4('0x13'))},getCustomFields(_0x20b97c['Fields'],_0x5b7b23));_0xdfe7fb[_0x53f4('0x14')]=_[_0x53f4('0x15')](_[_0x53f4('0x16')](_0xdfe7fb[_0x53f4('0x14')],'id'),_0x53f4('0x17'));return request({'uri':util['format']('%s/api/v2/tickets',_0x2adad5['remoteUri']),'method':_0x53f4('0x18'),'body':_0xdfe7fb})[_0x53f4('0x19')](function(_0x15f54a){logger[_0x53f4('0xc')]('Ticket\x20created!');return _0x15f54a;});}function getUser(_0x3f63d4,_0xbe32c){if(intUtil[_0x53f4('0x1a')](_0xbe32c)){return request({'uri':util['format'](_0x53f4('0x1b'),_0x3f63d4[_0x53f4('0x1c')]),'qs':{'email':_0xbe32c}})[_0x53f4('0x19')](function(_0x4fa3cc){if(_0x4fa3cc[_0x53f4('0x1d')]){logger[_0x53f4('0xc')](_0x53f4('0x1e'));return _['find'](_0x4fa3cc,function(_0x996984){return _0x996984[_0x53f4('0x1f')][_0x53f4('0x20')]===_0xbe32c;});}else{logger[_0x53f4('0xc')](_0x53f4('0x21'));return request({'uri':util['format'](_0x53f4('0x22'),_0x3f63d4['remoteUri'])})[_0x53f4('0x19')](function(_0x111ffc){logger[_0x53f4('0xc')](_0x53f4('0x23'));return _0x111ffc;});}});}else{logger[_0x53f4('0xc')](_0x53f4('0x24'));return request({'uri':util[_0x53f4('0xf')]('%s/api/v2/agents/me',_0x3f63d4[_0x53f4('0x1c')])})[_0x53f4('0x19')](function(_0x54050b){logger['info'](_0x53f4('0x23'));return _0x54050b;});}}function getEndUser(_0x2ebb45,_0x2d8f7a,_0x2cef80){logger[_0x53f4('0xc')](_0x53f4('0x25'),_0x2cef80);return request({'uri':util[_0x53f4('0xf')](_0x53f4('0x26'),_0x2ebb45[_0x53f4('0x1c')]),'qs':{'phone':_0x2cef80}})['then'](function(_0x363212){if(_0x363212['length']){logger[_0x53f4('0xc')](_0x53f4('0x27'));return _[_0x53f4('0x28')](_0x363212,{'phone':_0x2cef80});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x53f4('0xf')](_0x53f4('0x26'),_0x2ebb45[_0x53f4('0x1c')]),'method':_0x53f4('0x18'),'body':{'name':_0x2d8f7a,'phone':_0x2cef80}})[_0x53f4('0x19')](function(_0x4316a9){logger[_0x53f4('0xc')](_0x53f4('0x29'));return _0x4316a9;});}});}function getAuth(_0x46bd05){return util['format']('Basic\x20%s',new Buffer(_0x46bd05[_0x53f4('0x2a')]+':X')[_0x53f4('0x2b')](_0x53f4('0x2c')));}function request(_0xd3d355){logger[_0x53f4('0x2d')](_0x53f4('0x2e'),JSON['stringify'](_0xd3d355));return rp(_[_0x53f4('0x7')](_0xd3d355,{'method':_0x53f4('0x2f'),'headers':headers,'json':!![]}));}function getTags(_0x1aaf8a,_0x17fed7){var _0x25f503=[];if(_0x1aaf8a&&_0x1aaf8a[_0x53f4('0x1d')]>0x0){_0x25f503=_['map'](_0x1aaf8a,_0x17fed7);}return _0x25f503;}function getCustomFields(_0x3842b2,_0xa8ddb4){var _0x371d53=[];var _0x2738e7={'custom_fields':[]};if(_0x3842b2[_0x53f4('0x1d')]>0x0){_['forEach'](_0x3842b2,function(_0x496f84){if(_[_0x53f4('0x30')]([_0x53f4('0x31'),_0x53f4('0x32')],_0x496f84['type'])&&_0x496f84[_0x53f4('0x33')]&&!_0x496f84['customField']){_0x2738e7[_0x496f84[_0x53f4('0x33')]['toLowerCase']()]=_0x496f84['content'][_0x53f4('0x2b')]();}else if(_[_0x53f4('0x30')]([_0x53f4('0x31'),_0x53f4('0x32')],_0x496f84[_0x53f4('0x34')])&&_0x496f84[_0x53f4('0x35')]&&_0x496f84[_0x53f4('0x36')]){_0x2738e7[_0x53f4('0x14')]['push']({'id':_0x496f84[_0x53f4('0x35')],'value':_0x496f84[_0x53f4('0x37')][_0x53f4('0x2b')]()});}else if(_0x496f84[_0x53f4('0x34')]==='variable'&&_0x496f84[_0x53f4('0x38')]&&_0x496f84['idField']&&_0x496f84['customField']){_0xa8ddb4[_0x496f84[_0x53f4('0x38')]]&&_0x2738e7[_0x53f4('0x14')]['push']({'id':_0x496f84[_0x53f4('0x35')],'value':_0xa8ddb4[_0x496f84[_0x53f4('0x38')]]['toString']()});}else if(_0x496f84[_0x53f4('0x34')]==='customVariable'&&_0x496f84[_0x53f4('0x39')]&&_0x496f84[_0x53f4('0x39')]['name']&&_0x496f84[_0x53f4('0x35')]&&_0x496f84[_0x53f4('0x36')]){_0xa8ddb4[_0x496f84[_0x53f4('0x39')][_0x53f4('0x13')][_0x53f4('0x3a')]()]&&_0x2738e7[_0x53f4('0x14')]['push']({'id':_0x496f84[_0x53f4('0x35')],'value':_0xa8ddb4[_0x496f84[_0x53f4('0x39')][_0x53f4('0x13')][_0x53f4('0x3a')]()][_0x53f4('0x2b')]()});}});}return _0x2738e7;}exports[_0x53f4('0x3b')]=function(_0x139efb,_0x5a22ea,_0x36d8fc,_0xddf458,_0x1c67ae,_0x200be3){var _0x271976,_0x44d0f7;_0x200be3[_0x53f4('0x1c')]=intUtil[_0x53f4('0x3c')](_0x200be3[_0x53f4('0x1c')]);_0x200be3['serverUrl']=intUtil[_0x53f4('0x3c')](_0x200be3[_0x53f4('0x3d')]);if(_0x1c67ae&&_0x1c67ae['monitor_format']){logger[_0x53f4('0xc')](_0x53f4('0x3e'),_0x53f4('0x3f'));_0x5a22ea[_0x53f4('0x40')]=util[_0x53f4('0xf')](_0x53f4('0x41'),_0x200be3[_0x53f4('0x3d')],_0x5a22ea[_0x53f4('0x42')],md5(_0x5a22ea[_0x53f4('0x42')]));}else{_0x5a22ea[_0x53f4('0x40')]='';}headers[_0x53f4('0x43')]=getAuth(_0x200be3);return getUser(_0x200be3,_0xddf458[_0x53f4('0x20')])[_0x53f4('0x19')](function(_0x1f6c04){_0x271976=_0x1f6c04;logger[_0x53f4('0xc')]('The\x20User\x20ID\x20is:',_0x271976['id']);return getEndUser(_0x200be3,_0x5a22ea[_0x53f4('0x44')],_0x5a22ea[_0x53f4('0x45')]);})[_0x53f4('0x19')](function(_0x334922){_0x44d0f7=_0x334922;logger[_0x53f4('0xc')](_0x53f4('0x46'),_0x44d0f7['id']);return getTicket(_0x200be3,_0x271976,_0x44d0f7,_0x36d8fc,_0x5a22ea);})['then'](function(_0x489329){if(_0x489329&&_0x489329['id']){logger[_0x53f4('0xc')](_0x53f4('0x47'));logger[_0x53f4('0xc')](_0x53f4('0x48'),_0x489329['id']);logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x53f4('0x49'),_0xddf458[_0x53f4('0x13')]),_0x53f4('0x4a'),{'uri':util[_0x53f4('0xf')](_0x53f4('0x4b'),_0x200be3[_0x53f4('0x1c')],_0x489329['id'])});}})[_0x53f4('0x4c')](function(_0x20f24d){logger[_0x53f4('0x4d')](_0x53f4('0x3e'),JSON[_0x53f4('0x4e')](_0x20f24d));});};exports['outbound']=function(_0xa29b9a,_0x4e1af0,_0x4ce5da,_0x4ad22,_0x238fc9,_0x5b6150,_0x5b57ee){var _0x33daca,_0x5878ff;_0x5b6150['remoteUri']=intUtil[_0x53f4('0x3c')](_0x5b6150[_0x53f4('0x1c')]);_0x5b6150['serverUrl']=intUtil[_0x53f4('0x3c')](_0x5b6150['serverUrl']);if(_0x5b57ee&&_0x5b57ee[_0x53f4('0x4f')]&&_0x5b57ee['recordingFormat']!==_0x53f4('0x50')){logger[_0x53f4('0xc')](_0x53f4('0x51'),_0x53f4('0x3f'));_0x4e1af0[_0x53f4('0x40')]=util[_0x53f4('0xf')](_0x53f4('0x41'),_0x5b6150[_0x53f4('0x3d')],_0x4e1af0[_0x53f4('0x42')],md5(_0x4e1af0[_0x53f4('0x42')]));}headers[_0x53f4('0x43')]=getAuth(_0x5b6150);return getUser(_0x5b6150,_0x4ad22[_0x53f4('0x20')])['then'](function(_0x45ab72){_0x33daca=_0x45ab72;logger[_0x53f4('0xc')](_0x53f4('0x52'),_0x33daca['id']);return getEndUser(_0x5b6150,_0x4e1af0['destcalleridname'],_0x4e1af0[_0x53f4('0x53')]);})[_0x53f4('0x19')](function(_0x29b996){_0x5878ff=_0x29b996;logger['info'](_0x53f4('0x46'),_0x5878ff['id']);return getTicket(_0x5b6150,_0x33daca,_0x5878ff,_0x4ce5da,_0x4e1af0);})[_0x53f4('0x19')](function(_0x53f3c4){if(_0x53f3c4&&_0x53f3c4['id']){logger[_0x53f4('0xc')]('Ticket\x20created!');logger[_0x53f4('0xc')]('The\x20Ticket\x20ID\x20is:',_0x53f3c4['id']);logger[_0x53f4('0xc')]('[OUTBOUND]',_0x53f4('0x54'));emit(util[_0x53f4('0xf')](_0x53f4('0x49'),_0x4ad22['name']),_0x53f4('0x4a'),{'uri':util['format'](_0x53f4('0x4b'),_0x5b6150['remoteUri'],_0x53f3c4['id'])});}})[_0x53f4('0x4c')](function(_0x311e98){logger['error']('[OUTBOUND]',JSON['stringify'](_0x311e98));});};exports['unmanaged']=function(_0x2a2ff2,_0x263d93,_0x22c8a0,_0x11bbd1,_0x36b411,_0x1063d8){var _0x1a954a,_0x35593b;_0x1063d8[_0x53f4('0x1c')]=intUtil[_0x53f4('0x3c')](_0x1063d8[_0x53f4('0x1c')]);_0x1063d8[_0x53f4('0x3d')]=intUtil[_0x53f4('0x3c')](_0x1063d8[_0x53f4('0x3d')]);if(_0x36b411&&_0x36b411['monitor_format']){logger['info']('['+_0x263d93[_0x53f4('0x55')]['toUpperCase']()+']',_0x53f4('0x3f'));_0x263d93['recordingURL']=util[_0x53f4('0xf')](_0x53f4('0x41'),_0x1063d8['serverUrl'],_0x263d93[_0x53f4('0x42')],md5(_0x263d93['uniqueid']));}else{_0x263d93['recordingURL']='';}headers['Authorization']=getAuth(_0x1063d8);return getUser(_0x1063d8,'')['then'](function(_0x625fa0){_0x1a954a=_0x625fa0;logger[_0x53f4('0xc')](_0x53f4('0x52'),_0x1a954a['id']);return getEndUser(_0x1063d8,_0x263d93[_0x53f4('0x44')],_0x263d93[_0x53f4('0x45')]);})[_0x53f4('0x19')](function(_0x17152c){_0x35593b=_0x17152c;logger[_0x53f4('0xc')](_0x53f4('0x46'),_0x35593b['id']);return getTicket(_0x1063d8,_0x1a954a,_0x35593b,_0x22c8a0,_0x263d93);})[_0x53f4('0x19')](function(_0x5b80bc){if(_0x5b80bc){logger[_0x53f4('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5b80bc['id']);}})[_0x53f4('0x4c')](function(_0x5c1cd5){logger[_0x53f4('0x4d')]('['+_0x263d93[_0x53f4('0x55')][_0x53f4('0x56')]()+']',JSON[_0x53f4('0x4e')](_0x5c1cd5));});};
\ No newline at end of file
+var _0x61f9=['Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Basic\x20%s','apiKey','toString','debug','[HTTP]','GET','includes','picklist','type','nameField','customField','toLowerCase','idField','content','variable','variableName','customVariable','Variable','push','queue','serverUrl','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','stripTrailingSlash','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','unmanaged','lastevent','toUpperCase','lodash','md5','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','application/json','emit','info','merge','format','calleridname','calleridnum','getString','Subjects','<br>','name','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.'];(function(_0x439894,_0xc0f818){var _0x27be8c=function(_0x5a1ff7){while(--_0x5a1ff7){_0x439894['push'](_0x439894['shift']());}};_0x27be8c(++_0xc0f818);}(_0x61f9,0x18c));var _0x961f=function(_0x30cfb6,_0x48b8e6){_0x30cfb6=_0x30cfb6-0x0;var _0x294e46=_0x61f9[_0x30cfb6];return _0x294e46;};'use strict';var _=require(_0x961f('0x0'));var rp=require('request-promise');var md5=require(_0x961f('0x1'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x961f('0x2'));var config=require(_0x961f('0x3'));var logger=require(_0x961f('0x4'))(_0x961f('0x5'));config[_0x961f('0x6')]=_[_0x961f('0x7')](config[_0x961f('0x6')],{'host':_0x961f('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var headers={'Content-Type':_0x961f('0x9'),'Accept':_0x961f('0x9')};function emit(_0x5a45f3,_0x25e0a0,_0x33547a){io['to'](_0x5a45f3)[_0x961f('0xa')](_0x25e0a0,_0x33547a);}function getTicket(_0x5e8d7e,_0x18d371,_0x97dc25,_0x32bfd3,_0x491317){logger[_0x961f('0xb')]('Creating\x20new\x20ticket...');var _0x309ade=_[_0x961f('0xc')]({'responder_id':_0x18d371['id'],'requester_id':_0x97dc25['id'],'name':util[_0x961f('0xd')]('Caller\x20-\x20%s',_0x491317[_0x961f('0xe')]),'phone':_0x491317[_0x961f('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x961f('0x10')](_0x32bfd3[_0x961f('0x11')],_0x491317,'\x20'),'description':intUtil[_0x961f('0x10')](_0x32bfd3['Descriptions'],_0x491317,_0x961f('0x12')),'tags':getTags(_0x32bfd3['Tags'],_0x961f('0x13'))},getCustomFields(_0x32bfd3[_0x961f('0x14')],_0x491317));_0x309ade[_0x961f('0x15')]=_[_0x961f('0x16')](_[_0x961f('0x17')](_0x309ade[_0x961f('0x15')],'id'),_0x961f('0x18'));return request({'uri':util[_0x961f('0xd')](_0x961f('0x19'),_0x5e8d7e[_0x961f('0x1a')]),'method':_0x961f('0x1b'),'body':_0x309ade})[_0x961f('0x1c')](function(_0x19f797){logger[_0x961f('0xb')](_0x961f('0x1d'));return _0x19f797;});}function getUser(_0xfa8464,_0x2d9a0e){if(intUtil[_0x961f('0x1e')](_0x2d9a0e)){return request({'uri':util[_0x961f('0xd')](_0x961f('0x1f'),_0xfa8464[_0x961f('0x1a')]),'qs':{'email':_0x2d9a0e}})[_0x961f('0x1c')](function(_0xb7304a){if(_0xb7304a[_0x961f('0x20')]){logger[_0x961f('0xb')](_0x961f('0x21'));return _['find'](_0xb7304a,function(_0x56a36d){return _0x56a36d[_0x961f('0x22')][_0x961f('0x23')]===_0x2d9a0e;});}else{logger[_0x961f('0xb')](_0x961f('0x24'));return request({'uri':util['format'](_0x961f('0x25'),_0xfa8464['remoteUri'])})[_0x961f('0x1c')](function(_0x36872c){logger['info']('Admin\x20account\x20selected.');return _0x36872c;});}});}else{logger[_0x961f('0xb')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x961f('0xd')](_0x961f('0x25'),_0xfa8464['remoteUri'])})['then'](function(_0x48be35){logger['info'](_0x961f('0x26'));return _0x48be35;});}}function getEndUser(_0xfd605a,_0x365eb5,_0x557902){logger['info']('Searching\x20enduser\x20with\x20phone',_0x557902);return request({'uri':util[_0x961f('0xd')]('%s/api/v2/contacts',_0xfd605a['remoteUri']),'qs':{'phone':_0x557902}})[_0x961f('0x1c')](function(_0x4a2a95){if(_0x4a2a95['length']){logger[_0x961f('0xb')](_0x961f('0x27'));return _[_0x961f('0x28')](_0x4a2a95,{'phone':_0x557902});}else{logger[_0x961f('0xb')](_0x961f('0x29'));return request({'uri':util[_0x961f('0xd')](_0x961f('0x2a'),_0xfd605a[_0x961f('0x1a')]),'method':_0x961f('0x1b'),'body':{'name':_0x365eb5,'phone':_0x557902}})[_0x961f('0x1c')](function(_0x360209){logger[_0x961f('0xb')]('Enduser\x20created.');return _0x360209;});}});}function getAuth(_0x2d3138){return util[_0x961f('0xd')](_0x961f('0x2b'),new Buffer(_0x2d3138[_0x961f('0x2c')]+':X')[_0x961f('0x2d')]('base64'));}function request(_0x18cc29){logger[_0x961f('0x2e')](_0x961f('0x2f'),JSON['stringify'](_0x18cc29));return rp(_['defaults'](_0x18cc29,{'method':_0x961f('0x30'),'headers':headers,'json':!![]}));}function getTags(_0xe7cf61,_0x20379a){var _0x10629f=[];if(_0xe7cf61&&_0xe7cf61[_0x961f('0x20')]>0x0){_0x10629f=_['map'](_0xe7cf61,_0x20379a);}return _0x10629f;}function getCustomFields(_0xf9030e,_0x10f968){var _0x400385=[];var _0x56f3e8={'custom_fields':[]};if(_0xf9030e['length']>0x0){_['forEach'](_0xf9030e,function(_0x116c00){if(_[_0x961f('0x31')](['string',_0x961f('0x32')],_0x116c00[_0x961f('0x33')])&&_0x116c00[_0x961f('0x34')]&&!_0x116c00[_0x961f('0x35')]){_0x56f3e8[_0x116c00[_0x961f('0x34')][_0x961f('0x36')]()]=_0x116c00['content'][_0x961f('0x2d')]();}else if(_[_0x961f('0x31')](['string','picklist'],_0x116c00[_0x961f('0x33')])&&_0x116c00['idField']&&_0x116c00['customField']){_0x56f3e8[_0x961f('0x15')]['push']({'id':_0x116c00[_0x961f('0x37')],'value':_0x116c00[_0x961f('0x38')][_0x961f('0x2d')]()});}else if(_0x116c00['type']===_0x961f('0x39')&&_0x116c00[_0x961f('0x3a')]&&_0x116c00[_0x961f('0x37')]&&_0x116c00[_0x961f('0x35')]){_0x10f968[_0x116c00['variableName']]&&_0x56f3e8[_0x961f('0x15')]['push']({'id':_0x116c00[_0x961f('0x37')],'value':_0x10f968[_0x116c00[_0x961f('0x3a')]][_0x961f('0x2d')]()});}else if(_0x116c00[_0x961f('0x33')]===_0x961f('0x3b')&&_0x116c00[_0x961f('0x3c')]&&_0x116c00['Variable'][_0x961f('0x13')]&&_0x116c00[_0x961f('0x37')]&&_0x116c00[_0x961f('0x35')]){_0x10f968[_0x116c00['Variable'][_0x961f('0x13')][_0x961f('0x36')]()]&&_0x56f3e8[_0x961f('0x15')][_0x961f('0x3d')]({'id':_0x116c00[_0x961f('0x37')],'value':_0x10f968[_0x116c00[_0x961f('0x3c')][_0x961f('0x13')][_0x961f('0x36')]()][_0x961f('0x2d')]()});}});}return _0x56f3e8;}exports[_0x961f('0x3e')]=function(_0x56369d,_0x9c3fba,_0x565e57,_0x2e3e75,_0x5ec970,_0x36267b){var _0x2b14f8,_0x8c29d5;_0x36267b[_0x961f('0x1a')]=intUtil['stripTrailingSlash'](_0x36267b[_0x961f('0x1a')]);_0x36267b[_0x961f('0x3f')]=intUtil['stripTrailingSlash'](_0x36267b[_0x961f('0x3f')]);if(_0x5ec970&&_0x5ec970[_0x961f('0x40')]){logger[_0x961f('0xb')](_0x961f('0x41'),'Recording\x20is\x20enabled!');_0x9c3fba[_0x961f('0x42')]=util['format'](_0x961f('0x43'),_0x36267b['serverUrl'],_0x9c3fba[_0x961f('0x44')],md5(_0x9c3fba[_0x961f('0x44')]));}else{_0x9c3fba[_0x961f('0x42')]='';}headers[_0x961f('0x45')]=getAuth(_0x36267b);return getUser(_0x36267b,_0x2e3e75[_0x961f('0x23')])[_0x961f('0x1c')](function(_0x15a5c4){_0x2b14f8=_0x15a5c4;logger[_0x961f('0xb')]('The\x20User\x20ID\x20is:',_0x2b14f8['id']);return getEndUser(_0x36267b,_0x9c3fba['calleridname'],_0x9c3fba[_0x961f('0xf')]);})[_0x961f('0x1c')](function(_0x1ef2d7){_0x8c29d5=_0x1ef2d7;logger[_0x961f('0xb')](_0x961f('0x46'),_0x8c29d5['id']);return getTicket(_0x36267b,_0x2b14f8,_0x8c29d5,_0x565e57,_0x9c3fba);})[_0x961f('0x1c')](function(_0x4ac3c2){if(_0x4ac3c2&&_0x4ac3c2['id']){logger[_0x961f('0xb')](_0x961f('0x1d'));logger[_0x961f('0xb')](_0x961f('0x47'),_0x4ac3c2['id']);logger[_0x961f('0xb')](_0x961f('0x41'),_0x961f('0x48'));emit(util[_0x961f('0xd')](_0x961f('0x49'),_0x2e3e75[_0x961f('0x13')]),_0x961f('0x4a'),{'uri':util['format'](_0x961f('0x4b'),_0x36267b[_0x961f('0x1a')],_0x4ac3c2['id'])});}})[_0x961f('0x4c')](function(_0x191114){logger[_0x961f('0x4d')](_0x961f('0x41'),JSON[_0x961f('0x4e')](_0x191114));});};exports['outbound']=function(_0x1d9e59,_0x5e7455,_0x322dc5,_0x51cee3,_0x4afcc8,_0x3eb052,_0x12746b){var _0x1ac223,_0x30787b;_0x3eb052[_0x961f('0x1a')]=intUtil[_0x961f('0x4f')](_0x3eb052[_0x961f('0x1a')]);_0x3eb052['serverUrl']=intUtil[_0x961f('0x4f')](_0x3eb052[_0x961f('0x3f')]);if(_0x12746b&&_0x12746b[_0x961f('0x50')]&&_0x12746b[_0x961f('0x50')]!=='none'){logger[_0x961f('0xb')](_0x961f('0x51'),'Recording\x20is\x20enabled!');_0x5e7455[_0x961f('0x42')]=util[_0x961f('0xd')](_0x961f('0x43'),_0x3eb052['serverUrl'],_0x5e7455[_0x961f('0x44')],md5(_0x5e7455[_0x961f('0x44')]));}headers[_0x961f('0x45')]=getAuth(_0x3eb052);return getUser(_0x3eb052,_0x51cee3[_0x961f('0x23')])['then'](function(_0x1b0ffe){_0x1ac223=_0x1b0ffe;logger[_0x961f('0xb')](_0x961f('0x52'),_0x1ac223['id']);return getEndUser(_0x3eb052,_0x5e7455[_0x961f('0x53')],_0x5e7455['destcalleridnum']);})[_0x961f('0x1c')](function(_0x758193){_0x30787b=_0x758193;logger[_0x961f('0xb')](_0x961f('0x46'),_0x30787b['id']);return getTicket(_0x3eb052,_0x1ac223,_0x30787b,_0x322dc5,_0x5e7455);})['then'](function(_0x409720){if(_0x409720&&_0x409720['id']){logger[_0x961f('0xb')](_0x961f('0x1d'));logger[_0x961f('0xb')](_0x961f('0x47'),_0x409720['id']);logger[_0x961f('0xb')]('[OUTBOUND]',_0x961f('0x48'));emit(util['format'](_0x961f('0x49'),_0x51cee3[_0x961f('0x13')]),_0x961f('0x4a'),{'uri':util[_0x961f('0xd')](_0x961f('0x4b'),_0x3eb052[_0x961f('0x1a')],_0x409720['id'])});}})[_0x961f('0x4c')](function(_0x52aef7){logger['error']('[OUTBOUND]',JSON[_0x961f('0x4e')](_0x52aef7));});};exports[_0x961f('0x54')]=function(_0x5ae361,_0x3087c0,_0x1aba4e,_0x349344,_0x44f128,_0x3dbdd0){var _0x311a66,_0x283092;_0x3dbdd0[_0x961f('0x1a')]=intUtil['stripTrailingSlash'](_0x3dbdd0[_0x961f('0x1a')]);_0x3dbdd0[_0x961f('0x3f')]=intUtil[_0x961f('0x4f')](_0x3dbdd0[_0x961f('0x3f')]);if(_0x44f128&&_0x44f128[_0x961f('0x40')]){logger['info']('['+_0x3087c0[_0x961f('0x55')][_0x961f('0x56')]()+']','Recording\x20is\x20enabled!');_0x3087c0[_0x961f('0x42')]=util[_0x961f('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3dbdd0[_0x961f('0x3f')],_0x3087c0[_0x961f('0x44')],md5(_0x3087c0[_0x961f('0x44')]));}else{_0x3087c0[_0x961f('0x42')]='';}headers[_0x961f('0x45')]=getAuth(_0x3dbdd0);return getUser(_0x3dbdd0,'')[_0x961f('0x1c')](function(_0x5598c6){_0x311a66=_0x5598c6;logger[_0x961f('0xb')](_0x961f('0x52'),_0x311a66['id']);return getEndUser(_0x3dbdd0,_0x3087c0[_0x961f('0xe')],_0x3087c0[_0x961f('0xf')]);})[_0x961f('0x1c')](function(_0x4fc697){_0x283092=_0x4fc697;logger[_0x961f('0xb')](_0x961f('0x46'),_0x283092['id']);return getTicket(_0x3dbdd0,_0x311a66,_0x283092,_0x1aba4e,_0x3087c0);})[_0x961f('0x1c')](function(_0x26ef6f){if(_0x26ef6f){logger[_0x961f('0xb')](_0x961f('0x1d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x26ef6f['id']);}})[_0x961f('0x4c')](function(_0x20e327){logger[_0x961f('0x4d')]('['+_0x3087c0[_0x961f('0x55')]['toUpperCase']()+']',JSON[_0x961f('0x4e')](_0x20e327));});};
\ No newline at end of file
index 20d1b6d..870c43f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9ecc=['contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','userId','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Subjects','Descriptions','Contact','format','add','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','destcalleridnum','callDirection','unmanaged','queue','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','GET','headers','info','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','message','/api/selector/owners','Getting\x20user\x20list','then','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s'];(function(_0x7ad478,_0x2e89ef){var _0x1c660c=function(_0x1191c2){while(--_0x1191c2){_0x7ad478['push'](_0x7ad478['shift']());}};_0x1c660c(++_0x2e89ef);}(_0x9ecc,0xe6));var _0xc9ec=function(_0x3e9ec6,_0x694640){_0x3e9ec6=_0x3e9ec6-0x0;var _0x29e452=_0x9ecc[_0x3e9ec6];return _0x29e452;};'use strict';var _=require(_0xc9ec('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0xc9ec('0x1'));var moment=require(_0xc9ec('0x2'));var Promise=require('bluebird');var Redis=require(_0xc9ec('0x3'));var intUtil=require(_0xc9ec('0x4'));var config=require(_0xc9ec('0x5'));var logger=require(_0xc9ec('0x6'))(_0xc9ec('0x7'));config[_0xc9ec('0x8')]=_[_0xc9ec('0x9')](config[_0xc9ec('0x8')],{'host':_0xc9ec('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc9ec('0x8')]));function getAdminId(_0x57793e,_0x43d67f,_0x114661,_0xa45bad){return new Promise(function(_0x36e251,_0x18c8e7){var _0x56d6f1=![];var _0x3b2dda={'method':_0xc9ec('0xb'),'uri':_0xa45bad+'/api/selector/owners','json':!![]};_0x3b2dda[_0xc9ec('0xc')]=_0x114661;logger[_0xc9ec('0xd')]('Getting\x20admin\x20information');return rp(_0x3b2dda)['then'](function(_0x356283){if(_0x356283){var _0x325ecd=_0x356283['users'];var _0x34004f=null;for(_0x34004f=0x0;_0x34004f<_0x325ecd[_0xc9ec('0xe')];_0x34004f++){if(_0x325ecd[_0x34004f][_0xc9ec('0xf')]===_0x57793e[_0xc9ec('0x10')]){_0x57793e[_0xc9ec('0x11')]=_0x325ecd[_0x34004f]['id'];_0x56d6f1=!![];}}if(_0x56d6f1){logger[_0xc9ec('0xd')]('Admin\x20found:',_0x57793e[_0xc9ec('0x11')]);_0x36e251(_0x57793e);}else{_0x18c8e7({'statusCode':0x194,'message':_0xc9ec('0x12')});}}else{_0x18c8e7({'statusCode':0x194,'message':_0xc9ec('0x12')});}})[_0xc9ec('0x13')](function(_0x10fc5e){logger[_0xc9ec('0x14')]('['+[_0x43d67f['toUpperCase']()]+']',_0x10fc5e[_0xc9ec('0x15')]);_0x18c8e7(_0x10fc5e);});});}function getUser(_0x59062d,_0x2c4300,_0x456870){return function(_0x31a060){return new Promise(function(_0x10a5b1,_0x554609){var _0x31e92a={'method':'GET','uri':_0x456870+_0xc9ec('0x16'),'json':!![]};_0x31e92a['headers']=_0x2c4300;logger[_0xc9ec('0xd')](_0xc9ec('0x17'));return rp(_0x31e92a)[_0xc9ec('0x18')](function(_0x2d2b62){if(_0x2d2b62){var _0x16cc91=_0x2d2b62[_0xc9ec('0x19')];var _0xc26f16=![];var _0x1c99f8=null;if(_0x31a060[_0xc9ec('0x1a')]!==null){logger[_0xc9ec('0xd')](_0xc9ec('0x1b'),_0x31a060[_0xc9ec('0x1a')]);_0x31a060[_0xc9ec('0x1c')]=_0x31a060[_0xc9ec('0x1a')];for(_0x1c99f8=0x0;_0x1c99f8<_0x16cc91[_0xc9ec('0xe')];_0x1c99f8++){if(_0x16cc91[_0x1c99f8][_0xc9ec('0xf')]===_0x31a060[_0xc9ec('0x1a')]){_0xc26f16=!![];_0x31a060['userId']=_0x16cc91[_0x1c99f8]['id'];logger['info'](_0xc9ec('0x1d'),_0x31a060['userId']);}}}if(!_0xc26f16){logger[_0xc9ec('0xd')]('Admin\x20selected');_0x31a060[_0xc9ec('0x1c')]=_0x31a060[_0xc9ec('0x10')];_0x31a060['userId']=_0x31a060[_0xc9ec('0x11')];_0xc26f16=!![];}if(_0xc26f16){_0x10a5b1(_0x31a060);}else{_0x554609({'statusCode':0x194,'message':_0xc9ec('0x12')});}}else{_0x554609({'statusCode':0x194,'message':_0xc9ec('0x12')});}})[_0xc9ec('0x13')](function(_0x4404f1){logger['error']('['+[_0x59062d[_0xc9ec('0x1e')]()]+']',_0x4404f1[_0xc9ec('0x15')]);_0x554609(_0x4404f1);});});};}function searchContact(_0x3a6221,_0x1caae3,_0xa031d0,_0xcb0dd5){return new Promise(function(_0x2b09c8,_0x4f6ad6){var _0x2d983f={'method':'GET','headers':_0x1caae3,'uri':_0x3a6221+_0xc9ec('0x1f')+_0xcb0dd5+_0xc9ec('0x20')+_0xa031d0+_0xc9ec('0x21'),'json':!![]};rp(_0x2d983f)['then'](function(_0x2f2b9e){var _0x4f22d6=_[_0xc9ec('0x22')](_0x2f2b9e[_0xc9ec('0x23')][_0xc9ec('0x23')],[_0xa031d0,_0xcb0dd5]);_0x2b09c8(_0x4f22d6);})[_0xc9ec('0x13')](function(_0x262e8c){_0x4f6ad6(_0x262e8c);});});}function getEndUser(_0x48b64f,_0x4b7e58,_0x58dbbb){return function(_0x362b68){return new Promise(function(_0x175219,_0x137af9){logger[_0xc9ec('0xd')](util['format'](_0xc9ec('0x24'),_0x362b68[_0xc9ec('0x25')]));searchContact(_0x58dbbb,_0x4b7e58,_0xc9ec('0x26'),_0x362b68[_0xc9ec('0x25')])[_0xc9ec('0x18')](function(_0x107264){if(_0x107264){_0x362b68[_0xc9ec('0x27')]=_0x107264['id'];logger['info'](_0xc9ec('0x28'),_0x362b68[_0xc9ec('0x27')]);return _0x175219(_0x362b68);}searchContact(_0x58dbbb,_0x4b7e58,_0xc9ec('0x29'),_0x362b68['contactNumber'])[_0xc9ec('0x18')](function(_0x41e83c){if(_0x41e83c){_0x362b68['endUserId']=_0x41e83c['id'];logger[_0xc9ec('0xd')](_0xc9ec('0x2a'),_0x362b68[_0xc9ec('0x27')]);return _0x175219(_0x362b68);}createEndUser(_0x362b68,_0x48b64f,_0x4b7e58,_0x58dbbb)[_0xc9ec('0x18')](function(_0x21a127){logger[_0xc9ec('0xd')](_0xc9ec('0x2b'),_0x21a127['endUserId']);return _0x175219(_0x21a127);});});})[_0xc9ec('0x13')](function(_0x251362){_0x137af9(_0x251362);});});};}function createEndUser(_0xdfa0b4,_0x3905d3,_0x45da51,_0x4483dc){return new Promise(function(_0x121ab6,_0x564ce0){var _0x388f7f=moment();var _0x3bff8e={'method':'POST','uri':_0x4483dc+_0xc9ec('0x2c'),'body':{'contact':{'last_name':_0xdfa0b4[_0xc9ec('0x25')],'work_number':_0xdfa0b4[_0xc9ec('0x25')],'mobile_number':_0xdfa0b4[_0xc9ec('0x25')],'owner_id':_0xdfa0b4[_0xc9ec('0x2d')],'created_at':_0x388f7f['format'](_0xc9ec('0x2e'))}},'json':!![]};_0x3bff8e[_0xc9ec('0xc')]=_0x45da51;logger[_0xc9ec('0xd')](_0xc9ec('0x2f'));return rp(_0x3bff8e)['then'](function(_0x3f3011){_0xdfa0b4[_0xc9ec('0x27')]=_0x3f3011[_0xc9ec('0x30')]['id'];_0x121ab6(_0xdfa0b4);})[_0xc9ec('0x13')](function(_0x4c5c03){logger[_0xc9ec('0x14')]('['+[_0x3905d3[_0xc9ec('0x1e')]()]+']',_0x4c5c03[_0xc9ec('0x15')]);_0x564ce0(_0x4c5c03[_0xc9ec('0x15')]);});});}function getTicket(_0x3cc167,_0x1d0a52,_0x3fa667,_0x248390,_0x34cf28){return function(_0x44a6be){logger[_0xc9ec('0xd')]('Creating\x20new\x20task');return new Promise(function(_0x2ff20f,_0x4921e5){var _0x46a1eb=moment();var _0x3c182c={'method':_0xc9ec('0x31'),'uri':_0x3fa667+_0xc9ec('0x32'),'body':{'title':intUtil[_0xc9ec('0x33')](_0x248390[_0xc9ec('0x34')],_0x34cf28,'\x20'),'description':intUtil['getString'](_0x248390[_0xc9ec('0x35')],_0x34cf28,'\x0a'),'owner_id':_0x44a6be[_0xc9ec('0x2d')],'creater_id':_0x44a6be[_0xc9ec('0x11')],'targetable_id':_0x44a6be[_0xc9ec('0x27')],'targetable_type':_0xc9ec('0x36'),'created_at':_0x46a1eb[_0xc9ec('0x37')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x46a1eb[_0xc9ec('0x38')](0x1e,'m')[_0xc9ec('0x37')](_0xc9ec('0x2e'))},'json':!![]};_0x3c182c['headers']=_0x1d0a52;return rp(_0x3c182c)[_0xc9ec('0x18')](function(_0x159d93){_0x44a6be[_0xc9ec('0x39')]=_0x159d93[_0xc9ec('0x3a')]['id'];logger[_0xc9ec('0xd')](_0xc9ec('0x3b'),_0x44a6be[_0xc9ec('0x39')]);_0x2ff20f(_0x44a6be);})[_0xc9ec('0x13')](function(_0x35254e){logger[_0xc9ec('0x14')]('['+[_0x3cc167[_0xc9ec('0x1e')]()]+']',_0x35254e['message']);_0x4921e5(_0x35254e[_0xc9ec('0x15')]);});});};}function emit(_0x47685f,_0x29cde9,_0x3bc8c6){var _0x31b61d={'uri':_0x47685f+_0xc9ec('0x3c')+_0x3bc8c6};io['to'](util[_0xc9ec('0x37')](_0xc9ec('0x3d'),_0x29cde9))['emit'](_0xc9ec('0x3e'),_0x31b61d);}exports['cs']=function(_0x3a63da,_0x21b22f,_0x28a656,_0x317e0a,_0x13d517,_0x5c4ef1,_0x116e29,_0x3b04bb){var _0x3d3b8b={};var _0x52b88e={'Authorization':_0xc9ec('0x3f')+_0x5c4ef1[_0xc9ec('0x40')]};_0x5c4ef1[_0xc9ec('0x41')]=intUtil[_0xc9ec('0x42')](_0x5c4ef1['remoteUri']);_0x5c4ef1[_0xc9ec('0x43')]=intUtil[_0xc9ec('0x42')](_0x5c4ef1['serverUrl']);var _0x496128=_0x5c4ef1['remoteUri'];_0x3d3b8b[_0xc9ec('0x10')]=_0x5c4ef1[_0xc9ec('0x44')];_0x3d3b8b[_0xc9ec('0x25')]=_0x3b04bb[_0xc9ec('0x45')]()==='outbound'?_0x21b22f[_0xc9ec('0x46')]:_0x21b22f['calleridnum'];_0x3d3b8b[_0xc9ec('0x47')]=_0x3b04bb==='queue'||_0x3b04bb===_0xc9ec('0x48')?_0xc9ec('0x49'):_0xc9ec('0x4a');if(_0x317e0a){_0x3d3b8b[_0xc9ec('0x1a')]=_0x317e0a[_0xc9ec('0xf')];}var _0x293911=util['format'](_0xc9ec('0x4b'),_0x5c4ef1[_0xc9ec('0x43')],_0x21b22f[_0xc9ec('0x4c')],md5(_0x21b22f['uniqueid']));if(_0x13d517&&_0x13d517[_0xc9ec('0x4d')]){logger[_0xc9ec('0xd')](_0xc9ec('0x4e'),_0xc9ec('0x4f'));_0x21b22f[_0xc9ec('0x50')]=_0x293911;}else if(_0x116e29&&_0x116e29[_0xc9ec('0x51')]&&_0x116e29[_0xc9ec('0x51')]!==_0xc9ec('0x52')){logger[_0xc9ec('0xd')](_0xc9ec('0x53'),_0xc9ec('0x4f'));_0x21b22f[_0xc9ec('0x50')]=_0x293911;}else{_0x21b22f[_0xc9ec('0x50')]='';}return getAdminId(_0x3d3b8b,_0x3b04bb,_0x52b88e,_0x496128)[_0xc9ec('0x18')](getUser(_0x3b04bb,_0x52b88e,_0x496128))[_0xc9ec('0x18')](getEndUser(_0x3b04bb,_0x52b88e,_0x496128))[_0xc9ec('0x18')](getTicket(_0x3b04bb,_0x52b88e,_0x496128,_0x28a656,_0x21b22f))[_0xc9ec('0x18')](function(_0x16262c){logger[_0xc9ec('0xd')](util[_0xc9ec('0x37')](_0xc9ec('0x54'),_0x16262c['ticketId']));if(_0x3b04bb!==_0xc9ec('0x48')){logger[_0xc9ec('0xd')]('['+[_0x3b04bb['toUpperCase']()]+']',_0xc9ec('0x55'));emit(_0x496128,_0x317e0a[_0xc9ec('0x56')],_0x16262c[_0xc9ec('0x27')]);}})[_0xc9ec('0x13')](function(_0xc484a6){logger['error']('['+[_0x3b04bb['toUpperCase']()]+_0xc9ec('0x57'),util[_0xc9ec('0x58')](_0xc484a6,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0xb099=['remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','util','moment','bluebird','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','length','email','adminEmail','adminId','Admin\x20found:','catch','message','/api/selector/owners','users','Getting\x20user\x20with\x20email','userEmail','agentEmail','userId','User\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','/api/lookup?q=','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','add','ticketId','/contacts/','user:%s','emit','Token\x20token=','apiKey'];(function(_0x5c78d4,_0x48a719){var _0x39ef49=function(_0x459e2a){while(--_0x459e2a){_0x5c78d4['push'](_0x5c78d4['shift']());}};_0x39ef49(++_0x48a719);}(_0xb099,0x166));var _0x9b09=function(_0x38b1ea,_0x287c70){_0x38b1ea=_0x38b1ea-0x0;var _0x212a2a=_0xb099[_0x38b1ea];return _0x212a2a;};'use strict';var _=require(_0x9b09('0x0'));var rp=require('request-promise');var md5=require('md5');var util=require(_0x9b09('0x1'));var moment=require(_0x9b09('0x2'));var Promise=require(_0x9b09('0x3'));var Redis=require(_0x9b09('0x4'));var intUtil=require('./util');var config=require(_0x9b09('0x5'));var logger=require('../../../../config/logger')('freshsales');config[_0x9b09('0x6')]=_[_0x9b09('0x7')](config['redis'],{'host':_0x9b09('0x8'),'port':0x18eb});var io=require(_0x9b09('0x9'))(new Redis(config[_0x9b09('0x6')]));function getAdminId(_0x2ba3ca,_0x23a25a,_0x3f76df,_0x3442c2){return new Promise(function(_0x51c020,_0x332e96){var _0x7ebe01=![];var _0x20e8c5={'method':_0x9b09('0xa'),'uri':_0x3442c2+'/api/selector/owners','json':!![]};_0x20e8c5[_0x9b09('0xb')]=_0x3f76df;logger[_0x9b09('0xc')](_0x9b09('0xd'));return rp(_0x20e8c5)[_0x9b09('0xe')](function(_0x4f6fc5){if(_0x4f6fc5){var _0x100410=_0x4f6fc5['users'];var _0x5e26cb=null;for(_0x5e26cb=0x0;_0x5e26cb<_0x100410[_0x9b09('0xf')];_0x5e26cb++){if(_0x100410[_0x5e26cb][_0x9b09('0x10')]===_0x2ba3ca[_0x9b09('0x11')]){_0x2ba3ca[_0x9b09('0x12')]=_0x100410[_0x5e26cb]['id'];_0x7ebe01=!![];}}if(_0x7ebe01){logger['info'](_0x9b09('0x13'),_0x2ba3ca['adminId']);_0x51c020(_0x2ba3ca);}else{_0x332e96({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x332e96({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x9b09('0x14')](function(_0x57f449){logger['error']('['+[_0x23a25a['toUpperCase']()]+']',_0x57f449[_0x9b09('0x15')]);_0x332e96(_0x57f449);});});}function getUser(_0x5bc468,_0x62e220,_0x150aa2){return function(_0x5355a4){return new Promise(function(_0x202806,_0x15fd85){var _0x21ea0d={'method':_0x9b09('0xa'),'uri':_0x150aa2+_0x9b09('0x16'),'json':!![]};_0x21ea0d[_0x9b09('0xb')]=_0x62e220;logger['info']('Getting\x20user\x20list');return rp(_0x21ea0d)[_0x9b09('0xe')](function(_0x5cf860){if(_0x5cf860){var _0x49ebbe=_0x5cf860[_0x9b09('0x17')];var _0x128f36=![];var _0x4f85ec=null;if(_0x5355a4['agentEmail']!==null){logger[_0x9b09('0xc')](_0x9b09('0x18'),_0x5355a4['agentEmail']);_0x5355a4[_0x9b09('0x19')]=_0x5355a4['agentEmail'];for(_0x4f85ec=0x0;_0x4f85ec<_0x49ebbe['length'];_0x4f85ec++){if(_0x49ebbe[_0x4f85ec][_0x9b09('0x10')]===_0x5355a4[_0x9b09('0x1a')]){_0x128f36=!![];_0x5355a4[_0x9b09('0x1b')]=_0x49ebbe[_0x4f85ec]['id'];logger['info'](_0x9b09('0x1c'),_0x5355a4[_0x9b09('0x1b')]);}}}if(!_0x128f36){logger[_0x9b09('0xc')]('Admin\x20selected');_0x5355a4[_0x9b09('0x19')]=_0x5355a4[_0x9b09('0x11')];_0x5355a4[_0x9b09('0x1b')]=_0x5355a4[_0x9b09('0x12')];_0x128f36=!![];}if(_0x128f36){_0x202806(_0x5355a4);}else{_0x15fd85({'statusCode':0x194,'message':_0x9b09('0x1d')});}}else{_0x15fd85({'statusCode':0x194,'message':_0x9b09('0x1d')});}})[_0x9b09('0x14')](function(_0x4bec2e){logger[_0x9b09('0x1e')]('['+[_0x5bc468[_0x9b09('0x1f')]()]+']',_0x4bec2e[_0x9b09('0x15')]);_0x15fd85(_0x4bec2e);});});};}function searchContact(_0x346f04,_0x363687,_0x261555,_0x55f26f){return new Promise(function(_0x3e9f97,_0x381e87){var _0x462887={'method':_0x9b09('0xa'),'headers':_0x363687,'uri':_0x346f04+_0x9b09('0x20')+_0x55f26f+_0x9b09('0x21')+_0x261555+_0x9b09('0x22'),'json':!![]};rp(_0x462887)[_0x9b09('0xe')](function(_0x3316a8){var _0x530bb1=_[_0x9b09('0x23')](_0x3316a8[_0x9b09('0x24')][_0x9b09('0x24')],[_0x261555,_0x55f26f]);_0x3e9f97(_0x530bb1);})[_0x9b09('0x14')](function(_0x16fb6a){_0x381e87(_0x16fb6a);});});}function getEndUser(_0x557db0,_0x5f32c5,_0xafd28b){return function(_0x37aa50){return new Promise(function(_0x202a24,_0x4541e1){logger[_0x9b09('0xc')](util['format'](_0x9b09('0x25'),_0x37aa50[_0x9b09('0x26')]));searchContact(_0xafd28b,_0x5f32c5,_0x9b09('0x27'),_0x37aa50[_0x9b09('0x26')])['then'](function(_0xb4a9e9){if(_0xb4a9e9){_0x37aa50[_0x9b09('0x28')]=_0xb4a9e9['id'];logger[_0x9b09('0xc')](_0x9b09('0x29'),_0x37aa50['endUserId']);return _0x202a24(_0x37aa50);}searchContact(_0xafd28b,_0x5f32c5,_0x9b09('0x2a'),_0x37aa50['contactNumber'])['then'](function(_0x536312){if(_0x536312){_0x37aa50[_0x9b09('0x28')]=_0x536312['id'];logger['info'](_0x9b09('0x2b'),_0x37aa50[_0x9b09('0x28')]);return _0x202a24(_0x37aa50);}createEndUser(_0x37aa50,_0x557db0,_0x5f32c5,_0xafd28b)[_0x9b09('0xe')](function(_0x4545ad){logger[_0x9b09('0xc')](_0x9b09('0x2c'),_0x4545ad[_0x9b09('0x28')]);return _0x202a24(_0x4545ad);});});})[_0x9b09('0x14')](function(_0x319586){_0x4541e1(_0x319586);});});};}function createEndUser(_0x101796,_0x6b61bb,_0x244058,_0x5f176a){return new Promise(function(_0x459074,_0x3b5791){var _0x70640d=moment();var _0x1f5812={'method':_0x9b09('0x2d'),'uri':_0x5f176a+_0x9b09('0x2e'),'body':{'contact':{'last_name':_0x101796['contactNumber'],'work_number':_0x101796[_0x9b09('0x26')],'mobile_number':_0x101796[_0x9b09('0x26')],'owner_id':_0x101796[_0x9b09('0x1b')],'created_at':_0x70640d[_0x9b09('0x2f')](_0x9b09('0x30'))}},'json':!![]};_0x1f5812[_0x9b09('0xb')]=_0x244058;logger['info'](_0x9b09('0x31'));return rp(_0x1f5812)['then'](function(_0x46d9b8){_0x101796[_0x9b09('0x28')]=_0x46d9b8[_0x9b09('0x32')]['id'];_0x459074(_0x101796);})[_0x9b09('0x14')](function(_0x24bdc0){logger[_0x9b09('0x1e')]('['+[_0x6b61bb[_0x9b09('0x1f')]()]+']',_0x24bdc0[_0x9b09('0x15')]);_0x3b5791(_0x24bdc0[_0x9b09('0x15')]);});});}function getTicket(_0x250166,_0x5877c3,_0x42e329,_0x555a8d,_0x2e2118){return function(_0xa1d568){logger[_0x9b09('0xc')](_0x9b09('0x33'));return new Promise(function(_0x5090a1,_0x264f64){var _0x38edb5=moment();var _0x5c1e8b={'method':_0x9b09('0x2d'),'uri':_0x42e329+_0x9b09('0x34'),'body':{'title':intUtil[_0x9b09('0x35')](_0x555a8d[_0x9b09('0x36')],_0x2e2118,'\x20'),'description':intUtil[_0x9b09('0x35')](_0x555a8d['Descriptions'],_0x2e2118,'\x0a'),'owner_id':_0xa1d568[_0x9b09('0x1b')],'creater_id':_0xa1d568[_0x9b09('0x12')],'targetable_id':_0xa1d568[_0x9b09('0x28')],'targetable_type':'Contact','created_at':_0x38edb5['format'](_0x9b09('0x30')),'due_date':_0x38edb5[_0x9b09('0x37')](0x1e,'m')[_0x9b09('0x2f')](_0x9b09('0x30'))},'json':!![]};_0x5c1e8b[_0x9b09('0xb')]=_0x5877c3;return rp(_0x5c1e8b)[_0x9b09('0xe')](function(_0x110907){_0xa1d568[_0x9b09('0x38')]=_0x110907['task']['id'];logger[_0x9b09('0xc')]('Task\x20created:',_0xa1d568['ticketId']);_0x5090a1(_0xa1d568);})[_0x9b09('0x14')](function(_0xff122e){logger[_0x9b09('0x1e')]('['+[_0x250166[_0x9b09('0x1f')]()]+']',_0xff122e['message']);_0x264f64(_0xff122e[_0x9b09('0x15')]);});});};}function emit(_0xa3ed64,_0xc860f2,_0x19e06d){var _0x54f4f3={'uri':_0xa3ed64+_0x9b09('0x39')+_0x19e06d};io['to'](util[_0x9b09('0x2f')](_0x9b09('0x3a'),_0xc860f2))[_0x9b09('0x3b')]('trigger:browser:url',_0x54f4f3);}exports['cs']=function(_0x317e2c,_0x2f7b96,_0xcbd9f7,_0x26c382,_0x324deb,_0x22c1b0,_0x5a31e8,_0x2437e0){var _0x542eef={};var _0x4993bc={'Authorization':_0x9b09('0x3c')+_0x22c1b0[_0x9b09('0x3d')]};_0x22c1b0[_0x9b09('0x3e')]=intUtil[_0x9b09('0x3f')](_0x22c1b0[_0x9b09('0x3e')]);_0x22c1b0[_0x9b09('0x40')]=intUtil[_0x9b09('0x3f')](_0x22c1b0['serverUrl']);var _0x43bbbe=_0x22c1b0['remoteUri'];_0x542eef[_0x9b09('0x11')]=_0x22c1b0[_0x9b09('0x41')];_0x542eef[_0x9b09('0x26')]=_0x2437e0[_0x9b09('0x42')]()===_0x9b09('0x43')?_0x2f7b96[_0x9b09('0x44')]:_0x2f7b96[_0x9b09('0x45')];_0x542eef[_0x9b09('0x46')]=_0x2437e0==='queue'||_0x2437e0==='unmanaged'?_0x9b09('0x47'):_0x9b09('0x43');if(_0x26c382){_0x542eef['agentEmail']=_0x26c382[_0x9b09('0x10')];}var _0x388d19=util[_0x9b09('0x2f')](_0x9b09('0x48'),_0x22c1b0[_0x9b09('0x40')],_0x2f7b96['uniqueid'],md5(_0x2f7b96[_0x9b09('0x49')]));if(_0x324deb&&_0x324deb[_0x9b09('0x4a')]){logger[_0x9b09('0xc')](_0x9b09('0x4b'),_0x9b09('0x4c'));_0x2f7b96['recordingURL']=_0x388d19;}else if(_0x5a31e8&&_0x5a31e8[_0x9b09('0x4d')]&&_0x5a31e8[_0x9b09('0x4d')]!==_0x9b09('0x4e')){logger[_0x9b09('0xc')](_0x9b09('0x4f'),_0x9b09('0x4c'));_0x2f7b96[_0x9b09('0x50')]=_0x388d19;}else{_0x2f7b96[_0x9b09('0x50')]='';}return getAdminId(_0x542eef,_0x2437e0,_0x4993bc,_0x43bbbe)[_0x9b09('0xe')](getUser(_0x2437e0,_0x4993bc,_0x43bbbe))[_0x9b09('0xe')](getEndUser(_0x2437e0,_0x4993bc,_0x43bbbe))[_0x9b09('0xe')](getTicket(_0x2437e0,_0x4993bc,_0x43bbbe,_0xcbd9f7,_0x2f7b96))[_0x9b09('0xe')](function(_0x4bff01){logger[_0x9b09('0xc')](util[_0x9b09('0x2f')](_0x9b09('0x51'),_0x4bff01[_0x9b09('0x38')]));if(_0x2437e0!=='unmanaged'){logger['info']('['+[_0x2437e0[_0x9b09('0x1f')]()]+']',_0x9b09('0x52'));emit(_0x43bbbe,_0x26c382[_0x9b09('0x53')],_0x4bff01[_0x9b09('0x28')]);}})[_0x9b09('0x14')](function(_0x2de786){logger[_0x9b09('0x1e')]('['+[_0x2437e0[_0x9b09('0x1f')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x2de786,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 9c27693..28970ce 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe66c=['%s\x20configuration\x20#%s\x20not\x20found','data3','format','util','./zendesk','./salesforce','./freshdesk','./desk','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data2','find','Configurations','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','data1','zoho','unknown\x20integration','../../../../config/logger','error','[EXEC]'];(function(_0x1b27ff,_0x34070b){var _0x1ff114=function(_0xb5b137){while(--_0xb5b137){_0x1b27ff['push'](_0x1b27ff['shift']());}};_0x1ff114(++_0x34070b);}(_0xe66c,0x12b));var _0xce66=function(_0x5591c6,_0xc2adf0){_0x5591c6=_0x5591c6-0x0;var _0x4ad7da=_0xe66c[_0x5591c6];return _0x4ad7da;};'use strict';var _=require('lodash');var util=require(_0xce66('0x0'));var zendesk=require(_0xce66('0x1'));var salesforce=require(_0xce66('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xce66('0x3'));var zoho=require('./zoho');var desk=require(_0xce66('0x4'));var vtiger=require('./vtiger');var servicenow=require(_0xce66('0x5'));var dynamics365=require('./dynamics365');var freshsales=require(_0xce66('0x6'));var integrations=[_0xce66('0x7'),_0xce66('0x8'),_0xce66('0x9'),_0xce66('0xa'),'zoho',_0xce66('0xb'),_0xce66('0xc'),_0xce66('0xd'),_0xce66('0xe'),_0xce66('0xf')];exports[_0xce66('0x10')]=function(_0xa77c71,_0x44ca0f,_0x24b152,_0x5f1c7c,_0x168eac,_0x1e3f36){if(_0x24b152){if(_[_0xce66('0x11')](integrations,_0xa77c71['data1'][_0xce66('0x12')]())){try{var _0x1af310=null;var _0x5eba0a='';var _0x32568a=_0x24b152[_0xa77c71['data1'][_0xce66('0x12')]()];if(_0x32568a){var _0x3dfee7=_0x32568a[_0xa77c71[_0xce66('0x13')]];if(_0x3dfee7){var _0x28183f=_[_0xce66('0x14')](_0x3dfee7[_0xce66('0x15')],{'id':parseInt(_0xa77c71['data3'],0xa)});if(_0x28183f){if(_0x5f1c7c){if(_0x168eac&&_0x44ca0f[_0xce66('0x16')]){_0x5eba0a=_0xce66('0x16');}else if(_0x44ca0f[_0xce66('0x17')]){_0x5eba0a=_0xce66('0x18');}else{console[_0xce66('0x19')](_0xce66('0x1a'),_0x44ca0f);}}else{_0x5eba0a=_0xce66('0x1b');}switch(_0xa77c71[_0xce66('0x1c')][_0xce66('0x12')]()){case _0xce66('0x7'):zendesk[_0x5eba0a](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36);break;case _0xce66('0x8'):salesforce[_0x5eba0a](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36);break;case'sugarcrm':sugarcrm[_0x5eba0a](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36);break;case _0xce66('0xa'):freshdesk[_0x5eba0a](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36);break;case _0xce66('0x1d'):zoho[_0x5eba0a](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36);break;case _0xce66('0xb'):desk[_0x5eba0a](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36);break;case _0xce66('0xc'):vtiger[_0x5eba0a](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36);break;case _0xce66('0xe'):freshsales['cs'](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36,_0x5eba0a);break;case'servicenow':servicenow['cs'](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36,_0x5eba0a);break;case'dynamics365':dynamics365['cs'](_0xa77c71,_0x44ca0f,_0x28183f,_0x5f1c7c,_0x168eac,_0x3dfee7,_0x1e3f36,_0x5eba0a);break;default:console[_0xce66('0x19')](_0xce66('0x1e'));}}else{_0x1af310=require(_0xce66('0x1f'))(_0xa77c71['data1'][_0xce66('0x12')]());_0x1af310[_0xce66('0x20')](_0xce66('0x21'),util['format'](_0xce66('0x22'),_0xa77c71[_0xce66('0x1c')][_0xce66('0x12')](),_0xa77c71[_0xce66('0x23')]));}}else{_0x1af310=require(_0xce66('0x1f'))(_0xa77c71[_0xce66('0x1c')][_0xce66('0x12')]());_0x1af310['error'](_0xce66('0x21'),util[_0xce66('0x24')]('%s\x20account\x20#%s\x20not\x20found',_0xa77c71[_0xce66('0x1c')]['toLowerCase'](),_0xa77c71['data2']));}}else{}}catch(_0x553adb){console['error'](_0x553adb);}}}};
\ No newline at end of file
+var _0x4dd2=['[EXEC]','format','data3','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./sugarcrm','./freshdesk','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','desk','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','Configurations','queue','outbound','unmanaged','zoho','vtiger','dynamics365','unknown\x20integration','error'];(function(_0x2d9dae,_0x591a01){var _0x45ef28=function(_0x175b1a){while(--_0x175b1a){_0x2d9dae['push'](_0x2d9dae['shift']());}};_0x45ef28(++_0x591a01);}(_0x4dd2,0x19d));var _0x24dd=function(_0x4990d5,_0xe2c486){_0x4990d5=_0x4990d5-0x0;var _0x275e25=_0x4dd2[_0x4990d5];return _0x275e25;};'use strict';var _=require(_0x24dd('0x0'));var util=require(_0x24dd('0x1'));var zendesk=require(_0x24dd('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x24dd('0x3'));var freshdesk=require(_0x24dd('0x4'));var zoho=require('./zoho');var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x24dd('0x5'));var dynamics365=require(_0x24dd('0x6'));var freshsales=require(_0x24dd('0x7'));var integrations=[_0x24dd('0x8'),_0x24dd('0x9'),'sugarcrm',_0x24dd('0xa'),'zoho',_0x24dd('0xb'),'vtiger','dynamics365',_0x24dd('0xc'),_0x24dd('0xd')];exports[_0x24dd('0xe')]=function(_0x36801e,_0x5dc1c1,_0x150dbe,_0x214a4f,_0x16287c,_0x1f4220){if(_0x150dbe){if(_[_0x24dd('0xf')](integrations,_0x36801e[_0x24dd('0x10')][_0x24dd('0x11')]())){try{var _0x3e8360=null;var _0x46deb7='';var _0x1cd1b0=_0x150dbe[_0x36801e[_0x24dd('0x10')]['toLowerCase']()];if(_0x1cd1b0){var _0xf00d85=_0x1cd1b0[_0x36801e[_0x24dd('0x12')]];if(_0xf00d85){var _0x5e4289=_[_0x24dd('0x13')](_0xf00d85[_0x24dd('0x14')],{'id':parseInt(_0x36801e['data3'],0xa)});if(_0x5e4289){if(_0x214a4f){if(_0x16287c&&_0x5dc1c1[_0x24dd('0x15')]){_0x46deb7=_0x24dd('0x15');}else if(_0x5dc1c1['routeId']){_0x46deb7=_0x24dd('0x16');}else{console['log']('EVENT\x20UNKNOWN',_0x5dc1c1);}}else{_0x46deb7=_0x24dd('0x17');}switch(_0x36801e['data1'][_0x24dd('0x11')]()){case'zendesk':zendesk[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case _0x24dd('0x9'):salesforce[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case'sugarcrm':sugarcrm[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case'freshdesk':freshdesk[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case _0x24dd('0x18'):zoho[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case'desk':desk[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case _0x24dd('0x19'):vtiger[_0x46deb7](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220);break;case _0x24dd('0xc'):freshsales['cs'](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220,_0x46deb7);break;case'servicenow':servicenow['cs'](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220,_0x46deb7);break;case _0x24dd('0x1a'):dynamics365['cs'](_0x36801e,_0x5dc1c1,_0x5e4289,_0x214a4f,_0x16287c,_0xf00d85,_0x1f4220,_0x46deb7);break;default:console['log'](_0x24dd('0x1b'));}}else{_0x3e8360=require('../../../../config/logger')(_0x36801e[_0x24dd('0x10')][_0x24dd('0x11')]());_0x3e8360[_0x24dd('0x1c')](_0x24dd('0x1d'),util[_0x24dd('0x1e')]('%s\x20configuration\x20#%s\x20not\x20found',_0x36801e[_0x24dd('0x10')]['toLowerCase'](),_0x36801e[_0x24dd('0x1f')]));}}else{_0x3e8360=require(_0x24dd('0x20'))(_0x36801e[_0x24dd('0x10')][_0x24dd('0x11')]());_0x3e8360['error']('[EXEC]',util[_0x24dd('0x1e')](_0x24dd('0x21'),_0x36801e[_0x24dd('0x10')][_0x24dd('0x11')](),_0x36801e['data2']));}}else{}}catch(_0x4857b4){console[_0x24dd('0x1c')](_0x4857b4);}}}};
\ No newline at end of file
index 1d1f3b3..0c01811 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0668=['password','concat','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','calleridnum',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','moment','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','emit','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','lead','WhoId','account','Case','ContactId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','then','length','Agent\x20%s\x20found.','resolve','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','moduleSearch','contact_lead','additionalSearchContact','merge','$or','Contact','Lead','additionalSearchAccount','Account','cloneDeep','additionalSearchLead','Name','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','<unknown>','format','Caller\x20-\x20%s','Company','No\x20Company','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name'];(function(_0x3f6a6f,_0x473c25){var _0x2cf157=function(_0x4c8d66){while(--_0x4c8d66){_0x3f6a6f['push'](_0x3f6a6f['shift']());}};_0x2cf157(++_0x473c25);}(_0x0668,0x1b0));var _0x8066=function(_0x3c95bd,_0x14ef6d){_0x3c95bd=_0x3c95bd-0x0;var _0x5a67f5=_0x0668[_0x3c95bd];return _0x5a67f5;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0x8066('0x0'));var BPromise=require(_0x8066('0x1'));var md5=require(_0x8066('0x2'));var jsforce=require('jsforce');var util=require(_0x8066('0x3'));var Redis=require(_0x8066('0x4'));var intUtil=require(_0x8066('0x5'));var config=require(_0x8066('0x6'));var logger=require(_0x8066('0x7'))(_0x8066('0x8'));config[_0x8066('0x9')]=_[_0x8066('0xa')](config[_0x8066('0x9')],{'host':_0x8066('0xb'),'port':0x18eb});var io=require(_0x8066('0xc'))(new Redis(config[_0x8066('0x9')]));function emit(_0xd30c6f,_0x1ee5f0,_0x21b328){io['to'](_0xd30c6f)[_0x8066('0xd')](_0x1ee5f0,_0x21b328);}function getTicket(_0x1ea342,_0xd0cd14,_0x1cdb1c,_0x133af7,_0x191652,_0x3cd992,_0x3a3e71,_0x5666a5){var _0x49b14d=Object['assign']({},{'OwnerId':_0xd0cd14['id'],'Subject':intUtil[_0x8066('0xe')](_0x133af7[_0x8066('0xf')],_0x191652,'\x20'),'Description':intUtil[_0x8066('0xe')](_0x133af7[_0x8066('0x10')],_0x191652,'\x0a')},getCustomFields(_0x3cd992,_0x191652));if(_0x1cdb1c){if(_0x133af7[_0x8066('0x11')]===_0x8066('0x12')){_0x49b14d[_0x8066('0x13')]=moment[_0x8066('0x14')]();_0x49b14d[_0x8066('0x15')]=![];_0x49b14d[_0x8066('0x16')]=![];if(_0x1cdb1c['endUserType']===_0x8066('0x17')||_0x1cdb1c[_0x8066('0x18')]===_0x8066('0x19')){_0x49b14d[_0x8066('0x1a')]=_0x1cdb1c['id'];}else if(_0x1cdb1c['endUserType']===_0x8066('0x1b')){_0x49b14d['WhatId']=_0x1cdb1c['id'];}}else if(_0x133af7[_0x8066('0x11')]===_0x8066('0x1c')){if(_0x1cdb1c[_0x8066('0x18')]===_0x8066('0x17')){_0x49b14d[_0x8066('0x1d')]=_0x1cdb1c['id'];}else if(_0x1cdb1c[_0x8066('0x18')]===_0x8066('0x1b')){_0x49b14d['AccountId']=_0x1cdb1c['id'];}else if(_0x1cdb1c[_0x8066('0x18')]===_0x8066('0x19')&&_0x133af7[_0x8066('0x1e')]){_0x49b14d[_0x133af7[_0x8066('0x1e')]]=_0x1cdb1c['id'];}else{logger[_0x8066('0x1f')](_0x8066('0x20'));}}}return _0x3a3e71[_0x8066('0x21')](_0x133af7[_0x8066('0x11')])[_0x8066('0x22')](_0x49b14d);}function getUser(_0x550a2f,_0x38ec5b,_0xe8fe7d){if(!_[_0x8066('0x23')](_0x38ec5b)&&intUtil[_0x8066('0x24')](_0x38ec5b)){var _0x309e76={'Email':_0x38ec5b};var _0x1621a1={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xe8fe7d[_0x8066('0x21')](_0x8066('0x25'))[_0x8066('0x26')](_0x309e76,_0x1621a1)[_0x8066('0x27')]()[_0x8066('0x28')](function(_0x42a2d1){if(_0x42a2d1[_0x8066('0x29')]){var _0x5f6f23=_['find'](_0x42a2d1,function(_0x592ffa){return _0x592ffa['Email']===_0x38ec5b;});if(_0x5f6f23){logger[_0x8066('0x1f')](_0x8066('0x2a'),_0x38ec5b);return BPromise[_0x8066('0x2b')]({'id':_0x5f6f23['Id'],'name':_0x5f6f23['Name']});}}else{logger[_0x8066('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x38ec5b);return _0xe8fe7d['identity']()['then'](function(_0x1b02a4){return BPromise['resolve']({'id':_0x1b02a4[_0x8066('0x2c')],'name':_0x1b02a4[_0x8066('0x2d')]});});}});}else{logger[_0x8066('0x1f')](_0x8066('0x2e'),_0x38ec5b);return _0xe8fe7d[_0x8066('0x2f')]()[_0x8066('0x28')](function(_0x548ff7){return BPromise[_0x8066('0x2b')]({'id':_0x548ff7[_0x8066('0x2c')],'name':_0x548ff7[_0x8066('0x2d')]});});}}function getEndUser(_0x35ebd2,_0x1a87b1,_0x3ad9df,_0x31ac33,_0x577616){var _0x5516bf={'$or':{'Phone':_0x31ac33}};var _0x517319={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x8066('0x2b')]()[_0x8066('0x28')](function(){logger[_0x8066('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x31ac33,_0x1a87b1[_0x8066('0x30')]);switch(_0x1a87b1[_0x8066('0x30')]){case _0x8066('0x31'):var _0x1c74a4=_['cloneDeep'](_0x5516bf);if(_0x1a87b1[_0x8066('0x32')]){var _0x9ecf57={};_0x9ecf57[_0x1a87b1[_0x8066('0x32')]]=_0x31ac33;_[_0x8066('0x33')](_0x1c74a4[_0x8066('0x34')],_0x9ecf57);}return _0x577616[_0x8066('0x21')](_0x8066('0x35'))['find'](_0x1c74a4,_0x517319)[_0x8066('0x27')]()['then'](function(_0x10b477){if(_0x10b477&&_0x10b477[_0x8066('0x29')]){return _0x10b477;}else{var _0x336c70=_['cloneDeep'](_0x5516bf);if(_0x1a87b1['additionalSearchLead']){var _0x44327b={};_0x44327b[_0x1a87b1['additionalSearchLead']]=_0x31ac33;_[_0x8066('0x33')](_0x336c70['$or'],_0x44327b);}return _0x577616[_0x8066('0x21')](_0x8066('0x36'))[_0x8066('0x26')](_0x336c70,_0x517319);}});case'account_contact_lead':var _0x3819e0=_['cloneDeep'](_0x5516bf);if(_0x1a87b1['additionalSearchAccount']){var _0x9ecf57={};_0x9ecf57[_0x1a87b1[_0x8066('0x37')]]=_0x31ac33;_[_0x8066('0x33')](_0x3819e0[_0x8066('0x34')],_0x9ecf57);}return _0x577616[_0x8066('0x21')](_0x8066('0x38'))[_0x8066('0x26')](_0x3819e0,_0x517319)[_0x8066('0x27')]()[_0x8066('0x28')](function(_0x47f6b0){if(_0x47f6b0&&_0x47f6b0[_0x8066('0x29')]){return _0x47f6b0;}else{var _0x3029cf=_['cloneDeep'](_0x5516bf);if(_0x1a87b1[_0x8066('0x32')]){var _0x5b5778={};_0x5b5778[_0x1a87b1[_0x8066('0x32')]]=_0x31ac33;_['merge'](_0x3029cf[_0x8066('0x34')],_0x5b5778);}return _0x577616[_0x8066('0x21')](_0x8066('0x35'))[_0x8066('0x26')](_0x3029cf,_0x517319)[_0x8066('0x28')](function(_0xea1a05){if(_0xea1a05&&_0xea1a05[_0x8066('0x29')]){return _0xea1a05;}else{var _0x4cf8db=_[_0x8066('0x39')](_0x5516bf);if(_0x1a87b1['additionalSearchLead']){var _0x3831bf={};_0x3831bf[_0x1a87b1[_0x8066('0x3a')]]=_0x31ac33;_['merge'](_0x4cf8db[_0x8066('0x34')],_0x3831bf);}return _0x577616[_0x8066('0x21')](_0x8066('0x36'))[_0x8066('0x26')](_0x4cf8db,_0x517319);}});}});case _0x8066('0x17'):var _0x1c74a4=_[_0x8066('0x39')](_0x5516bf);if(_0x1a87b1[_0x8066('0x32')]){var _0x9ecf57={};_0x9ecf57[_0x1a87b1[_0x8066('0x32')]]=_0x31ac33;_[_0x8066('0x33')](_0x1c74a4['$or'],_0x9ecf57);}return _0x577616['sobject']('Contact')[_0x8066('0x26')](_0x1c74a4,_0x517319)[_0x8066('0x27')]();case _0x8066('0x19'):var _0x52e1e4=_[_0x8066('0x39')](_0x5516bf);if(_0x1a87b1[_0x8066('0x3a')]){var _0x9ecf57={};_0x9ecf57[_0x1a87b1[_0x8066('0x3a')]]=_0x31ac33;_[_0x8066('0x33')](_0x52e1e4[_0x8066('0x34')],_0x9ecf57);}return _0x577616[_0x8066('0x21')](_0x8066('0x36'))[_0x8066('0x26')](_0x52e1e4,_0x517319);case _0x8066('0x1b'):var _0x3819e0=_[_0x8066('0x39')](_0x5516bf);if(_0x1a87b1[_0x8066('0x37')]){var _0x9ecf57={};_0x9ecf57[_0x1a87b1[_0x8066('0x37')]]=_0x31ac33;_['merge'](_0x3819e0['$or'],_0x9ecf57);}return _0x577616['sobject']('Account')[_0x8066('0x26')](_0x3819e0,_0x517319);default:return null;}})[_0x8066('0x28')](function(_0x2138c3){if(_0x2138c3&&_0x2138c3['length']){var _0x363812=_['first'](_0x2138c3);if(_0x363812){return BPromise['resolve']({'id':_0x363812['Id'],'name':_0x363812[_0x8066('0x3b')],'phone':_0x363812['Phone'],'endUserType':_0x363812['attributes'][_0x8066('0x3c')][_0x8066('0x3d')]()});}}})['then'](function(_0x439d1f){if(_0x439d1f){logger[_0x8066('0x1f')](_0x8066('0x3e'),_0x439d1f[_0x8066('0x18')],_0x31ac33);return BPromise[_0x8066('0x2b')](_0x439d1f);}else{logger[_0x8066('0x1f')](_0x8066('0x3f'),_0x31ac33);var _0x308b8c={'Phone':_0x31ac33};if(_0x1a87b1[_0x8066('0x40')]){if(_0x1a87b1[_0x8066('0x40')]===_0x8066('0x17')){logger[_0x8066('0x1f')](_0x8066('0x41'),_0x31ac33,_0x1a87b1['moduleCreate']);_0x308b8c[_0x8066('0x42')]=_0x3ad9df!==_0x8066('0x43')?_0x3ad9df:util[_0x8066('0x44')](_0x8066('0x45'),_0x31ac33);}else if(_0x1a87b1[_0x8066('0x40')]===_0x8066('0x19')){logger[_0x8066('0x1f')](_0x8066('0x41'),_0x31ac33,_0x1a87b1[_0x8066('0x40')]);_0x308b8c['LastName']=_0x3ad9df!==_0x8066('0x43')?_0x3ad9df:util[_0x8066('0x44')]('Caller\x20-\x20%s',_0x31ac33);_0x308b8c[_0x8066('0x46')]=_0x8066('0x47');}else if(_0x1a87b1['moduleCreate']===_0x8066('0x1b')){logger[_0x8066('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x31ac33,_0x1a87b1[_0x8066('0x40')]);_0x308b8c['Name']=_0x3ad9df!=='<unknown>'?_0x3ad9df:util['format'](_0x8066('0x45'),_0x31ac33);}else{return null;}}return _0x577616[_0x8066('0x21')](_['upperFirst'](_0x1a87b1['moduleCreate']))['create'](_0x308b8c)['then'](function(_0x337424){return BPromise[_0x8066('0x2b')]({'id':_0x337424['id'],'endUserType':_0x1a87b1[_0x8066('0x40')]});});}});}function getCustomFields(_0x2d361a,_0x2905c6){var _0x5ace78={};if(_0x2d361a[_0x8066('0x29')]>0x0){_[_0x8066('0x48')](_0x2d361a,function(_0x2134db){if(_[_0x8066('0x49')]([_0x8066('0x4a'),_0x8066('0x4b')],_0x2134db[_0x8066('0x3c')])&&_0x2134db['idField']){_0x5ace78[_0x2134db[_0x8066('0x4c')]]=_0x2134db[_0x8066('0x4d')][_0x8066('0x4e')]();}else if(_0x2134db['type']===_0x8066('0x4f')&&_0x2134db[_0x8066('0x50')]&&_0x2134db[_0x8066('0x4c')]){_0x2905c6[_0x2134db[_0x8066('0x50')]]&&(_0x5ace78[_0x2134db[_0x8066('0x4c')]]=_0x2905c6[_0x2134db[_0x8066('0x50')]][_0x8066('0x4e')]());}else if(_0x2134db[_0x8066('0x3c')]===_0x8066('0x51')&&_0x2134db[_0x8066('0x52')]&&_0x2134db[_0x8066('0x52')][_0x8066('0x53')]&&_0x2134db[_0x8066('0x4c')]){_0x2905c6[_0x2134db[_0x8066('0x52')][_0x8066('0x53')]['toLowerCase']()]&&(_0x5ace78[_0x2134db[_0x8066('0x4c')]]=_0x2905c6[_0x2134db[_0x8066('0x52')][_0x8066('0x53')][_0x8066('0x3d')]()]['toString']());}});}return _0x5ace78;}function getConnection(_0x415018){var _0x233844=_0x415018[_0x8066('0x54')][_0x8066('0x55')](_0x415018['securityToken']);var _0x4ba87b=new jsforce['Connection']({'oauth2':{'loginUrl':_0x415018[_0x8066('0x56')]||_0x8066('0x57'),'clientId':_0x415018[_0x8066('0x58')],'clientSecret':_0x415018['clientSecret']}});return _0x4ba87b[_0x8066('0x59')](_0x415018[_0x8066('0x5a')],_0x233844)['then'](function(){logger[_0x8066('0x1f')](_0x8066('0x5b'));return _0x4ba87b;});}exports[_0x8066('0x5c')]=function(_0x2b378b,_0x1f3e86,_0x40f78a,_0xebfefc,_0x182a96,_0x1ebbfa){var _0x37e9fe,_0x592b92,_0x25e2d3,_0x2eb9fc;_0x1ebbfa[_0x8066('0x5d')]=intUtil[_0x8066('0x5e')](_0x1ebbfa[_0x8066('0x5d')]);_0x1ebbfa[_0x8066('0x56')]=intUtil[_0x8066('0x5e')](_0x1ebbfa['remoteUri']);if(_0x182a96&&_0x182a96[_0x8066('0x5f')]){logger['info'](_0x8066('0x60'),'Recording\x20is\x20enabled!');_0x1f3e86['recordingURL']=util[_0x8066('0x44')](_0x8066('0x61'),_0x1ebbfa['serverUrl'],_0x1f3e86[_0x8066('0x62')],md5(_0x1f3e86['uniqueid']));}else{_0x1f3e86[_0x8066('0x63')]='';}return getConnection(_0x1ebbfa)[_0x8066('0x28')](function(_0x4429bc){_0x2eb9fc=_0x4429bc;return getUser(_0x1ebbfa,_0xebfefc[_0x8066('0x64')],_0x2eb9fc);})['then'](function(_0x4d8d62){_0x37e9fe=_0x4d8d62;return getEndUser(_0x1ebbfa,_0x40f78a,_0x1f3e86[_0x8066('0x65')],_0x1f3e86['calleridnum'],_0x2eb9fc);})[_0x8066('0x28')](function(_0xb0e4c){_0x592b92=_0xb0e4c;return getTicket(_0x1ebbfa,_0x37e9fe,_0x592b92,_0x40f78a,_0x1f3e86,_0x40f78a[_0x8066('0x66')],_0x2eb9fc,_0x8066('0x5c'));})[_0x8066('0x28')](function(_0x4d30b2){_0x25e2d3=_0x4d30b2;logger[_0x8066('0x1f')](_0x8066('0x67'),_0x25e2d3['id']);logger['info'](_0x8066('0x68'),_0x25e2d3['id'],_0xebfefc['name'],_0x1ebbfa[_0x8066('0x3c')]);switch(_0x1ebbfa[_0x8066('0x3c')]){case _0x8066('0x69'):emit(util['format'](_0x8066('0x6a'),_0xebfefc['name']),_0x8066('0x6b'),{'recordId':_0x25e2d3['id']});break;case'newTab':emit(util[_0x8066('0x44')]('user:%s',_0xebfefc[_0x8066('0x53')]),_0x8066('0x6c'),{'uri':util[_0x8066('0x44')](_0x8066('0x6d'),_0x2eb9fc[_0x8066('0x6e')],_0x25e2d3['id'])});break;default:logger['error'](_0x8066('0x6f'));}})[_0x8066('0x70')](function(_0x1d404a){logger[_0x8066('0x71')](_0x8066('0x60'),_0x1d404a);});};exports[_0x8066('0x72')]=function(_0x5d33af,_0x3695fa,_0x3d1800,_0xc262eb,_0x4f760c,_0x572a2b,_0xb15849){var _0x14816e,_0x5e3546,_0x20d00,_0x1b10ff;_0x572a2b[_0x8066('0x5d')]=intUtil[_0x8066('0x5e')](_0x572a2b[_0x8066('0x5d')]);_0x572a2b[_0x8066('0x56')]=intUtil['stripTrailingSlash'](_0x572a2b['remoteUri']);if(_0xb15849&&_0xb15849[_0x8066('0x73')]&&_0xb15849['recordingFormat']!=='none'){logger[_0x8066('0x1f')](_0x8066('0x74'),_0x8066('0x75'));_0x3695fa[_0x8066('0x63')]=util[_0x8066('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x572a2b[_0x8066('0x5d')],_0x3695fa[_0x8066('0x62')],md5(_0x3695fa[_0x8066('0x62')]));}return getConnection(_0x572a2b)['then'](function(_0x40bbb0){_0x1b10ff=_0x40bbb0;return getUser(_0x572a2b,_0xc262eb['email'],_0x1b10ff);})[_0x8066('0x28')](function(_0x19668a){_0x14816e=_0x19668a;return getEndUser(_0x572a2b,_0x3d1800,_0x3695fa['destcalleridname'],_0x3695fa[_0x8066('0x76')],_0x1b10ff);})['then'](function(_0x1a43ad){_0x5e3546=_0x1a43ad;return getTicket(_0x572a2b,_0x14816e,_0x5e3546,_0x3d1800,_0x3695fa,_0x3d1800[_0x8066('0x66')],_0x1b10ff,_0x8066('0x72'));})['then'](function(_0x423575){_0x20d00=_0x423575;logger['info'](_0x8066('0x77'),_0x20d00['id']);logger['info'](_0x8066('0x78'),_0x20d00['id'],_0xc262eb['name'],_0x572a2b[_0x8066('0x3c')]);switch(_0x572a2b[_0x8066('0x3c')]){case _0x8066('0x69'):emit(util[_0x8066('0x44')](_0x8066('0x6a'),_0xc262eb[_0x8066('0x53')]),'trigger:salesforce:display',{'recordId':_0x20d00['id']});break;case _0x8066('0x79'):emit(util[_0x8066('0x44')](_0x8066('0x6a'),_0xc262eb[_0x8066('0x53')]),_0x8066('0x6c'),{'uri':util[_0x8066('0x44')](_0x8066('0x6d'),_0x1b10ff[_0x8066('0x6e')],_0x20d00['id'])});break;default:logger['error'](_0x8066('0x74'),_0x8066('0x7a'));}})[_0x8066('0x70')](function(_0x20db4a){logger['error'](_0x8066('0x74'),_0x20db4a);});};exports[_0x8066('0x7b')]=function(_0x4bc39b,_0x2acd92,_0x24cd89,_0x41f570,_0x4a0050,_0x252372){var _0x3a2412,_0x560abb,_0x1eae1e,_0x541d2e;_0x252372[_0x8066('0x5d')]=intUtil[_0x8066('0x5e')](_0x252372[_0x8066('0x5d')]);_0x252372[_0x8066('0x56')]=intUtil[_0x8066('0x5e')](_0x252372[_0x8066('0x56')]);if(_0x4a0050&&_0x4a0050[_0x8066('0x5f')]){logger[_0x8066('0x1f')]('['+_0x2acd92[_0x8066('0x7c')][_0x8066('0x7d')]()+']',_0x8066('0x75'));_0x2acd92['recordingURL']=util['format'](_0x8066('0x61'),_0x252372[_0x8066('0x5d')],_0x2acd92['uniqueid'],md5(_0x2acd92[_0x8066('0x62')]));}else{_0x2acd92[_0x8066('0x63')]='';}return getConnection(_0x252372)[_0x8066('0x28')](function(_0x28528f){_0x541d2e=_0x28528f;if(!_[_0x8066('0x23')](_0x41f570)){return getUser(_0x252372,_0x41f570[_0x8066('0x53')],_0x541d2e);}else{return getUser(_0x252372,null,_0x541d2e);}})[_0x8066('0x28')](function(_0x3ad7a0){_0x3a2412=_0x3ad7a0;return getEndUser(_0x252372,_0x24cd89,_0x2acd92['calleridname'],_0x2acd92[_0x8066('0x7e')],_0x541d2e);})[_0x8066('0x28')](function(_0x3235b9){_0x560abb=_0x3235b9;return getTicket(_0x252372,_0x3a2412,_0x560abb,_0x24cd89,_0x2acd92,_0x24cd89['Fields'],_0x541d2e);})['then'](function(_0x4646c8){_0x1eae1e=_0x4646c8;logger[_0x8066('0x1f')]('['+_0x2acd92['lastevent'][_0x8066('0x7d')]()+_0x8066('0x7f'),_0x1eae1e['id']);logger[_0x8066('0x1f')]('['+_0x2acd92[_0x8066('0x7c')][_0x8066('0x7d')]()+_0x8066('0x80'),_0x252372['type']);})[_0x8066('0x70')](function(_0x53df16){logger[_0x8066('0x71')]('['+_0x2acd92['lastevent'][_0x8066('0x7d')]()+']',_0x53df16);});};
\ No newline at end of file
+var _0xbdc7=['Contact','length','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','first','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','<unknown>','format','Caller\x20-\x20%s','LastName','Company','No\x20Company','forEach','includes','string','picklist','idField','toString','variable','variableName','customVariable','Variable','name','password','concat','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','outbound','recordingFormat','none','destcalleridname','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','instanceUrl','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','ActivityDate','utc','IsReminderSet','IsRecurrence','contact','endUserType','WhoId','account','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','execute','then','find','Email','Agent\x20%s\x20found.','resolve','Name','identity','user_id','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or'];(function(_0x215a50,_0x1297b7){var _0x4baf0c=function(_0x1b2858){while(--_0x1b2858){_0x215a50['push'](_0x215a50['shift']());}};_0x4baf0c(++_0x1297b7);}(_0xbdc7,0xca));var _0x7bdc=function(_0x425d62,_0x3a4fce){_0x425d62=_0x425d62-0x0;var _0x26767e=_0xbdc7[_0x425d62];return _0x26767e;};'use strict';var _=require(_0x7bdc('0x0'));var rp=require(_0x7bdc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x7bdc('0x2'));var jsforce=require('jsforce');var util=require(_0x7bdc('0x3'));var Redis=require(_0x7bdc('0x4'));var intUtil=require(_0x7bdc('0x5'));var config=require(_0x7bdc('0x6'));var logger=require(_0x7bdc('0x7'))(_0x7bdc('0x8'));config[_0x7bdc('0x9')]=_['defaults'](config[_0x7bdc('0x9')],{'host':_0x7bdc('0xa'),'port':0x18eb});var io=require(_0x7bdc('0xb'))(new Redis(config[_0x7bdc('0x9')]));function emit(_0x38928b,_0x44c6e8,_0x1f0801){io['to'](_0x38928b)[_0x7bdc('0xc')](_0x44c6e8,_0x1f0801);}function getTicket(_0x2e5dcd,_0x4c0ff7,_0x3056a8,_0x24834f,_0xe7e4bf,_0x2df508,_0x356664,_0x40a870){var _0x9acd47=Object[_0x7bdc('0xd')]({},{'OwnerId':_0x4c0ff7['id'],'Subject':intUtil[_0x7bdc('0xe')](_0x24834f[_0x7bdc('0xf')],_0xe7e4bf,'\x20'),'Description':intUtil[_0x7bdc('0xe')](_0x24834f[_0x7bdc('0x10')],_0xe7e4bf,'\x0a')},getCustomFields(_0x2df508,_0xe7e4bf));if(_0x3056a8){if(_0x24834f[_0x7bdc('0x11')]==='Task'){_0x9acd47[_0x7bdc('0x12')]=moment[_0x7bdc('0x13')]();_0x9acd47[_0x7bdc('0x14')]=![];_0x9acd47[_0x7bdc('0x15')]=![];if(_0x3056a8['endUserType']===_0x7bdc('0x16')||_0x3056a8[_0x7bdc('0x17')]==='lead'){_0x9acd47[_0x7bdc('0x18')]=_0x3056a8['id'];}else if(_0x3056a8[_0x7bdc('0x17')]===_0x7bdc('0x19')){_0x9acd47['WhatId']=_0x3056a8['id'];}}else if(_0x24834f[_0x7bdc('0x11')]==='Case'){if(_0x3056a8[_0x7bdc('0x17')]===_0x7bdc('0x16')){_0x9acd47[_0x7bdc('0x1a')]=_0x3056a8['id'];}else if(_0x3056a8[_0x7bdc('0x17')]===_0x7bdc('0x19')){_0x9acd47[_0x7bdc('0x1b')]=_0x3056a8['id'];}else if(_0x3056a8['endUserType']===_0x7bdc('0x1c')&&_0x24834f[_0x7bdc('0x1d')]){_0x9acd47[_0x24834f[_0x7bdc('0x1d')]]=_0x3056a8['id'];}else{logger[_0x7bdc('0x1e')](_0x7bdc('0x1f'));}}}return _0x356664[_0x7bdc('0x20')](_0x24834f[_0x7bdc('0x11')])[_0x7bdc('0x21')](_0x9acd47);}function getUser(_0x53eb55,_0x4d24ff,_0x3149b8){if(!_[_0x7bdc('0x22')](_0x4d24ff)&&intUtil[_0x7bdc('0x23')](_0x4d24ff)){var _0x16074c={'Email':_0x4d24ff};var _0x29d690={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3149b8[_0x7bdc('0x20')](_0x7bdc('0x24'))['find'](_0x16074c,_0x29d690)[_0x7bdc('0x25')]()[_0x7bdc('0x26')](function(_0x32a517){if(_0x32a517['length']){var _0x50dd50=_[_0x7bdc('0x27')](_0x32a517,function(_0x4a2322){return _0x4a2322[_0x7bdc('0x28')]===_0x4d24ff;});if(_0x50dd50){logger[_0x7bdc('0x1e')](_0x7bdc('0x29'),_0x4d24ff);return BPromise[_0x7bdc('0x2a')]({'id':_0x50dd50['Id'],'name':_0x50dd50[_0x7bdc('0x2b')]});}}else{logger[_0x7bdc('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x4d24ff);return _0x3149b8[_0x7bdc('0x2c')]()[_0x7bdc('0x26')](function(_0x3d0d18){return BPromise[_0x7bdc('0x2a')]({'id':_0x3d0d18[_0x7bdc('0x2d')],'name':_0x3d0d18['display_name']});});}});}else{logger[_0x7bdc('0x1e')](_0x7bdc('0x2e'),_0x4d24ff);return _0x3149b8[_0x7bdc('0x2c')]()[_0x7bdc('0x26')](function(_0x4ef2e5){return BPromise['resolve']({'id':_0x4ef2e5['user_id'],'name':_0x4ef2e5[_0x7bdc('0x2f')]});});}}function getEndUser(_0x223659,_0x171e89,_0x4f798d,_0x1f9b11,_0xcb6924){var _0x2566a={'$or':{'Phone':_0x1f9b11}};var _0xe5b7f9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0x7bdc('0x26')](function(){logger[_0x7bdc('0x1e')](_0x7bdc('0x30'),_0x1f9b11,_0x171e89[_0x7bdc('0x31')]);switch(_0x171e89[_0x7bdc('0x31')]){case'contact_lead':var _0x9d3643=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89[_0x7bdc('0x33')]){var _0x2e355d={};_0x2e355d[_0x171e89[_0x7bdc('0x33')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0x9d3643[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924[_0x7bdc('0x20')](_0x7bdc('0x36'))[_0x7bdc('0x27')](_0x9d3643,_0xe5b7f9)[_0x7bdc('0x25')]()[_0x7bdc('0x26')](function(_0x555b12){if(_0x555b12&&_0x555b12[_0x7bdc('0x37')]){return _0x555b12;}else{var _0x756504=_['cloneDeep'](_0x2566a);if(_0x171e89['additionalSearchLead']){var _0x16bb35={};_0x16bb35[_0x171e89[_0x7bdc('0x38')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0x756504[_0x7bdc('0x35')],_0x16bb35);}return _0xcb6924['sobject'](_0x7bdc('0x39'))[_0x7bdc('0x27')](_0x756504,_0xe5b7f9);}});case _0x7bdc('0x3a'):var _0xf02718=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89[_0x7bdc('0x3b')]){var _0x2e355d={};_0x2e355d[_0x171e89[_0x7bdc('0x3b')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0xf02718[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924[_0x7bdc('0x20')]('Account')['find'](_0xf02718,_0xe5b7f9)[_0x7bdc('0x25')]()[_0x7bdc('0x26')](function(_0x43abf5){if(_0x43abf5&&_0x43abf5[_0x7bdc('0x37')]){return _0x43abf5;}else{var _0x442ea9=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89['additionalSearchContact']){var _0x3d91d6={};_0x3d91d6[_0x171e89[_0x7bdc('0x33')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0x442ea9[_0x7bdc('0x35')],_0x3d91d6);}return _0xcb6924['sobject'](_0x7bdc('0x36'))[_0x7bdc('0x27')](_0x442ea9,_0xe5b7f9)['then'](function(_0x47fd49){if(_0x47fd49&&_0x47fd49[_0x7bdc('0x37')]){return _0x47fd49;}else{var _0x224006=_['cloneDeep'](_0x2566a);if(_0x171e89[_0x7bdc('0x38')]){var _0x50c620={};_0x50c620[_0x171e89[_0x7bdc('0x38')]]=_0x1f9b11;_[_0x7bdc('0x34')](_0x224006[_0x7bdc('0x35')],_0x50c620);}return _0xcb6924[_0x7bdc('0x20')](_0x7bdc('0x39'))[_0x7bdc('0x27')](_0x224006,_0xe5b7f9);}});}});case _0x7bdc('0x16'):var _0x9d3643=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89[_0x7bdc('0x33')]){var _0x2e355d={};_0x2e355d[_0x171e89['additionalSearchContact']]=_0x1f9b11;_['merge'](_0x9d3643[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924[_0x7bdc('0x20')](_0x7bdc('0x36'))[_0x7bdc('0x27')](_0x9d3643,_0xe5b7f9)[_0x7bdc('0x25')]();case _0x7bdc('0x1c'):var _0x123b2d=_['cloneDeep'](_0x2566a);if(_0x171e89['additionalSearchLead']){var _0x2e355d={};_0x2e355d[_0x171e89[_0x7bdc('0x38')]]=_0x1f9b11;_['merge'](_0x123b2d[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924['sobject'](_0x7bdc('0x39'))[_0x7bdc('0x27')](_0x123b2d,_0xe5b7f9);case _0x7bdc('0x19'):var _0xf02718=_[_0x7bdc('0x32')](_0x2566a);if(_0x171e89[_0x7bdc('0x3b')]){var _0x2e355d={};_0x2e355d[_0x171e89[_0x7bdc('0x3b')]]=_0x1f9b11;_['merge'](_0xf02718[_0x7bdc('0x35')],_0x2e355d);}return _0xcb6924['sobject']('Account')[_0x7bdc('0x27')](_0xf02718,_0xe5b7f9);default:return null;}})[_0x7bdc('0x26')](function(_0x4dbfdc){if(_0x4dbfdc&&_0x4dbfdc[_0x7bdc('0x37')]){var _0x1f6b13=_[_0x7bdc('0x3c')](_0x4dbfdc);if(_0x1f6b13){return BPromise[_0x7bdc('0x2a')]({'id':_0x1f6b13['Id'],'name':_0x1f6b13[_0x7bdc('0x2b')],'phone':_0x1f6b13['Phone'],'endUserType':_0x1f6b13['attributes'][_0x7bdc('0x3d')][_0x7bdc('0x3e')]()});}}})['then'](function(_0x4ff7ba){if(_0x4ff7ba){logger[_0x7bdc('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x4ff7ba[_0x7bdc('0x17')],_0x1f9b11);return BPromise['resolve'](_0x4ff7ba);}else{logger[_0x7bdc('0x1e')](_0x7bdc('0x3f'),_0x1f9b11);var _0x40c6bf={'Phone':_0x1f9b11};if(_0x171e89[_0x7bdc('0x40')]){if(_0x171e89[_0x7bdc('0x40')]===_0x7bdc('0x16')){logger[_0x7bdc('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1f9b11,_0x171e89[_0x7bdc('0x40')]);_0x40c6bf['LastName']=_0x4f798d!==_0x7bdc('0x41')?_0x4f798d:util[_0x7bdc('0x42')](_0x7bdc('0x43'),_0x1f9b11);}else if(_0x171e89[_0x7bdc('0x40')]===_0x7bdc('0x1c')){logger[_0x7bdc('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1f9b11,_0x171e89[_0x7bdc('0x40')]);_0x40c6bf[_0x7bdc('0x44')]=_0x4f798d!=='<unknown>'?_0x4f798d:util[_0x7bdc('0x42')](_0x7bdc('0x43'),_0x1f9b11);_0x40c6bf[_0x7bdc('0x45')]=_0x7bdc('0x46');}else if(_0x171e89[_0x7bdc('0x40')]===_0x7bdc('0x19')){logger[_0x7bdc('0x1e')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1f9b11,_0x171e89[_0x7bdc('0x40')]);_0x40c6bf[_0x7bdc('0x2b')]=_0x4f798d!==_0x7bdc('0x41')?_0x4f798d:util[_0x7bdc('0x42')]('Caller\x20-\x20%s',_0x1f9b11);}else{return null;}}return _0xcb6924[_0x7bdc('0x20')](_['upperFirst'](_0x171e89['moduleCreate']))[_0x7bdc('0x21')](_0x40c6bf)[_0x7bdc('0x26')](function(_0x4d5b56){return BPromise['resolve']({'id':_0x4d5b56['id'],'endUserType':_0x171e89[_0x7bdc('0x40')]});});}});}function getCustomFields(_0x2c5743,_0x4b416d){var _0x246a59={};if(_0x2c5743[_0x7bdc('0x37')]>0x0){_[_0x7bdc('0x47')](_0x2c5743,function(_0x3c7dd2){if(_[_0x7bdc('0x48')]([_0x7bdc('0x49'),_0x7bdc('0x4a')],_0x3c7dd2[_0x7bdc('0x3d')])&&_0x3c7dd2[_0x7bdc('0x4b')]){_0x246a59[_0x3c7dd2[_0x7bdc('0x4b')]]=_0x3c7dd2['content'][_0x7bdc('0x4c')]();}else if(_0x3c7dd2['type']===_0x7bdc('0x4d')&&_0x3c7dd2['variableName']&&_0x3c7dd2[_0x7bdc('0x4b')]){_0x4b416d[_0x3c7dd2[_0x7bdc('0x4e')]]&&(_0x246a59[_0x3c7dd2[_0x7bdc('0x4b')]]=_0x4b416d[_0x3c7dd2[_0x7bdc('0x4e')]][_0x7bdc('0x4c')]());}else if(_0x3c7dd2[_0x7bdc('0x3d')]===_0x7bdc('0x4f')&&_0x3c7dd2[_0x7bdc('0x50')]&&_0x3c7dd2[_0x7bdc('0x50')][_0x7bdc('0x51')]&&_0x3c7dd2[_0x7bdc('0x4b')]){_0x4b416d[_0x3c7dd2['Variable'][_0x7bdc('0x51')][_0x7bdc('0x3e')]()]&&(_0x246a59[_0x3c7dd2[_0x7bdc('0x4b')]]=_0x4b416d[_0x3c7dd2[_0x7bdc('0x50')][_0x7bdc('0x51')][_0x7bdc('0x3e')]()]['toString']());}});}return _0x246a59;}function getConnection(_0xd47095){var _0x2238be=_0xd47095[_0x7bdc('0x52')][_0x7bdc('0x53')](_0xd47095['securityToken']);var _0x36af6a=new jsforce['Connection']({'oauth2':{'loginUrl':_0xd47095[_0x7bdc('0x54')]||_0x7bdc('0x55'),'clientId':_0xd47095[_0x7bdc('0x56')],'clientSecret':_0xd47095['clientSecret']}});return _0x36af6a[_0x7bdc('0x57')](_0xd47095[_0x7bdc('0x58')],_0x2238be)[_0x7bdc('0x26')](function(){logger[_0x7bdc('0x1e')](_0x7bdc('0x59'));return _0x36af6a;});}exports['queue']=function(_0x9ca43e,_0xb5bbfc,_0x37d72f,_0x2cd6b7,_0x670230,_0x5d5020){var _0x406837,_0xde22fb,_0x2c652d,_0x3a6466;_0x5d5020[_0x7bdc('0x5a')]=intUtil[_0x7bdc('0x5b')](_0x5d5020[_0x7bdc('0x5a')]);_0x5d5020[_0x7bdc('0x54')]=intUtil['stripTrailingSlash'](_0x5d5020[_0x7bdc('0x54')]);if(_0x670230&&_0x670230[_0x7bdc('0x5c')]){logger['info'](_0x7bdc('0x5d'),_0x7bdc('0x5e'));_0xb5bbfc[_0x7bdc('0x5f')]=util[_0x7bdc('0x42')](_0x7bdc('0x60'),_0x5d5020[_0x7bdc('0x5a')],_0xb5bbfc[_0x7bdc('0x61')],md5(_0xb5bbfc[_0x7bdc('0x61')]));}else{_0xb5bbfc[_0x7bdc('0x5f')]='';}return getConnection(_0x5d5020)[_0x7bdc('0x26')](function(_0x2eb0a7){_0x3a6466=_0x2eb0a7;return getUser(_0x5d5020,_0x2cd6b7[_0x7bdc('0x62')],_0x3a6466);})[_0x7bdc('0x26')](function(_0x122bd2){_0x406837=_0x122bd2;return getEndUser(_0x5d5020,_0x37d72f,_0xb5bbfc[_0x7bdc('0x63')],_0xb5bbfc[_0x7bdc('0x64')],_0x3a6466);})['then'](function(_0x2f05b9){_0xde22fb=_0x2f05b9;return getTicket(_0x5d5020,_0x406837,_0xde22fb,_0x37d72f,_0xb5bbfc,_0x37d72f[_0x7bdc('0x65')],_0x3a6466,_0x7bdc('0x66'));})[_0x7bdc('0x26')](function(_0x142f71){_0x2c652d=_0x142f71;logger[_0x7bdc('0x1e')](_0x7bdc('0x67'),_0x2c652d['id']);logger[_0x7bdc('0x1e')](_0x7bdc('0x68'),_0x2c652d['id'],_0x2cd6b7['name'],_0x5d5020[_0x7bdc('0x3d')]);switch(_0x5d5020[_0x7bdc('0x3d')]){case _0x7bdc('0x69'):emit(util[_0x7bdc('0x42')](_0x7bdc('0x6a'),_0x2cd6b7[_0x7bdc('0x51')]),_0x7bdc('0x6b'),{'recordId':_0x2c652d['id']});break;case _0x7bdc('0x6c'):emit(util['format'](_0x7bdc('0x6a'),_0x2cd6b7[_0x7bdc('0x51')]),_0x7bdc('0x6d'),{'uri':util[_0x7bdc('0x42')](_0x7bdc('0x6e'),_0x3a6466['instanceUrl'],_0x2c652d['id'])});break;default:logger['error'](_0x7bdc('0x6f'));}})[_0x7bdc('0x70')](function(_0x3da902){logger[_0x7bdc('0x71')](_0x7bdc('0x5d'),_0x3da902);});};exports[_0x7bdc('0x72')]=function(_0x2cb2ec,_0x5c6191,_0x18db57,_0x1d44cf,_0x15b4da,_0x404c5a,_0x460ed1){var _0x2bd4a3,_0x4c0ef2,_0x12242a,_0xf7563e;_0x404c5a['serverUrl']=intUtil['stripTrailingSlash'](_0x404c5a['serverUrl']);_0x404c5a['remoteUri']=intUtil[_0x7bdc('0x5b')](_0x404c5a[_0x7bdc('0x54')]);if(_0x460ed1&&_0x460ed1[_0x7bdc('0x73')]&&_0x460ed1[_0x7bdc('0x73')]!==_0x7bdc('0x74')){logger[_0x7bdc('0x1e')]('[OUTBOUND]',_0x7bdc('0x5e'));_0x5c6191[_0x7bdc('0x5f')]=util['format'](_0x7bdc('0x60'),_0x404c5a[_0x7bdc('0x5a')],_0x5c6191[_0x7bdc('0x61')],md5(_0x5c6191[_0x7bdc('0x61')]));}return getConnection(_0x404c5a)[_0x7bdc('0x26')](function(_0x167a40){_0xf7563e=_0x167a40;return getUser(_0x404c5a,_0x1d44cf[_0x7bdc('0x62')],_0xf7563e);})['then'](function(_0x39d8f6){_0x2bd4a3=_0x39d8f6;return getEndUser(_0x404c5a,_0x18db57,_0x5c6191[_0x7bdc('0x75')],_0x5c6191['destcalleridnum'],_0xf7563e);})[_0x7bdc('0x26')](function(_0x5a1afb){_0x4c0ef2=_0x5a1afb;return getTicket(_0x404c5a,_0x2bd4a3,_0x4c0ef2,_0x18db57,_0x5c6191,_0x18db57[_0x7bdc('0x65')],_0xf7563e,_0x7bdc('0x72'));})[_0x7bdc('0x26')](function(_0x234604){_0x12242a=_0x234604;logger['info'](_0x7bdc('0x76'),_0x12242a['id']);logger[_0x7bdc('0x1e')](_0x7bdc('0x77'),_0x12242a['id'],_0x1d44cf[_0x7bdc('0x51')],_0x404c5a[_0x7bdc('0x3d')]);switch(_0x404c5a[_0x7bdc('0x3d')]){case _0x7bdc('0x69'):emit(util[_0x7bdc('0x42')](_0x7bdc('0x6a'),_0x1d44cf[_0x7bdc('0x51')]),_0x7bdc('0x6b'),{'recordId':_0x12242a['id']});break;case _0x7bdc('0x6c'):emit(util[_0x7bdc('0x42')]('user:%s',_0x1d44cf[_0x7bdc('0x51')]),'trigger:browser:url',{'uri':util['format'](_0x7bdc('0x6e'),_0xf7563e[_0x7bdc('0x78')],_0x12242a['id'])});break;default:logger[_0x7bdc('0x71')](_0x7bdc('0x79'),_0x7bdc('0x7a'));}})[_0x7bdc('0x70')](function(_0x145542){logger[_0x7bdc('0x71')](_0x7bdc('0x79'),_0x145542);});};exports[_0x7bdc('0x7b')]=function(_0x854cf0,_0xd20836,_0x5dab4d,_0x2e0d99,_0x1ce29e,_0x328326){var _0x23a8f8,_0x39ce64,_0x296500,_0x2abc0e;_0x328326[_0x7bdc('0x5a')]=intUtil[_0x7bdc('0x5b')](_0x328326[_0x7bdc('0x5a')]);_0x328326['remoteUri']=intUtil[_0x7bdc('0x5b')](_0x328326['remoteUri']);if(_0x1ce29e&&_0x1ce29e[_0x7bdc('0x5c')]){logger['info']('['+_0xd20836[_0x7bdc('0x7c')][_0x7bdc('0x7d')]()+']','Recording\x20is\x20enabled!');_0xd20836['recordingURL']=util[_0x7bdc('0x42')](_0x7bdc('0x60'),_0x328326[_0x7bdc('0x5a')],_0xd20836['uniqueid'],md5(_0xd20836[_0x7bdc('0x61')]));}else{_0xd20836['recordingURL']='';}return getConnection(_0x328326)[_0x7bdc('0x26')](function(_0x904bc8){_0x2abc0e=_0x904bc8;if(!_['isNil'](_0x2e0d99)){return getUser(_0x328326,_0x2e0d99['name'],_0x2abc0e);}else{return getUser(_0x328326,null,_0x2abc0e);}})[_0x7bdc('0x26')](function(_0x42c31d){_0x23a8f8=_0x42c31d;return getEndUser(_0x328326,_0x5dab4d,_0xd20836['calleridname'],_0xd20836[_0x7bdc('0x64')],_0x2abc0e);})[_0x7bdc('0x26')](function(_0x580ea8){_0x39ce64=_0x580ea8;return getTicket(_0x328326,_0x23a8f8,_0x39ce64,_0x5dab4d,_0xd20836,_0x5dab4d[_0x7bdc('0x65')],_0x2abc0e);})[_0x7bdc('0x26')](function(_0x5c4ee8){_0x296500=_0x5c4ee8;logger[_0x7bdc('0x1e')]('['+_0xd20836[_0x7bdc('0x7c')][_0x7bdc('0x7d')]()+_0x7bdc('0x7e'),_0x296500['id']);logger['info']('['+_0xd20836['lastevent'][_0x7bdc('0x7d')]()+_0x7bdc('0x7f'),_0x328326[_0x7bdc('0x3d')]);})[_0x7bdc('0x70')](function(_0x15b3d3){logger[_0x7bdc('0x71')]('['+_0xd20836[_0x7bdc('0x7c')][_0x7bdc('0x7d')]()+']',_0x15b3d3);});};
\ No newline at end of file
index 3ba474d..c563909 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xab9b=['userEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','content','toString','type','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Subjects','Fields','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','ticketNumber','push','all','Tags','map','%26sysparm_record_target%3Dincident','/nav_to.do?uri=incident.do?sys_id%3D','format','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','email','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','call\x20direction:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','util','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','sys_user?sysparm_query=email%3D'];(function(_0x4cf5c4,_0x3197e9){var _0x440108=function(_0x3becb5){while(--_0x3becb5){_0x4cf5c4['push'](_0x4cf5c4['shift']());}};_0x440108(++_0x3197e9);}(_0xab9b,0x129));var _0xbab9=function(_0x32f9e6,_0x55ed80){_0x32f9e6=_0x32f9e6-0x0;var _0x11a5ea=_0xab9b[_0x32f9e6];return _0x11a5ea;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xbab9('0x0'));var md5=require('md5');var Redis=require(_0xbab9('0x1'));var intUtil=require(_0xbab9('0x2'));var config=require(_0xbab9('0x3'));var logger=require(_0xbab9('0x4'))(_0xbab9('0x5'));config[_0xbab9('0x6')]=_[_0xbab9('0x7')](config[_0xbab9('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xbab9('0x6')]));function getAdminUser(_0x40ebb2,_0x44f0a1,_0x333525,_0x558803,_0x453189,_0x4dce94){return new Promise(function(_0x594cd6,_0x56238e){var _0x20d1de={'method':_0xbab9('0x8'),'uri':_0x558803+_0xbab9('0x9')+'&'+_0x453189+'&'+_0x4dce94,'auth':_0x44f0a1,'json':!![]};return rp(_0x20d1de)[_0xbab9('0xa')](function(_0x1353e2){if(_0x1353e2[_0xbab9('0xb')][_0xbab9('0xc')]>0x0){_0x333525[_0xbab9('0xd')]=_0x1353e2[_0xbab9('0xb')][0x0][_0xbab9('0xe')];}logger[_0xbab9('0xf')]('['+[_0x40ebb2[_0xbab9('0x10')]()]+_0xbab9('0x11'),_0x333525);_0x594cd6(_0x333525);})[_0xbab9('0x12')](function(_0x1e8cf0){logger[_0xbab9('0x13')]('['+[_0x40ebb2['toUpperCase']()]+']',_0x1e8cf0[_0xbab9('0x14')]);_0x56238e(_0x1e8cf0[_0xbab9('0x14')]);});});}function getUser(_0x367325,_0x118ddf,_0x5af226,_0x489b32,_0x505165){return function(_0x58cd14){logger[_0xbab9('0xf')]('['+[_0x367325['toUpperCase']()]+_0xbab9('0x15'),_0x58cd14);return new Promise(function(_0x3af470,_0xdea767){if(intUtil[_0xbab9('0x16')](_0x58cd14['userEmail'])){var _0x3b59c2={'method':_0xbab9('0x8'),'uri':_0x5af226+_0xbab9('0x17')+_0x58cd14[_0xbab9('0x18')]+'&'+_0x489b32+'&'+_0x505165,'auth':_0x118ddf,'json':!![]};logger[_0xbab9('0xf')]('['+[_0x367325['toUpperCase']()]+_0xbab9('0x19'),_0x3b59c2);return rp(_0x3b59c2)[_0xbab9('0xa')](function(_0x26bfe9){logger[_0xbab9('0xf')]('['+[_0x367325[_0xbab9('0x10')]()]+_0xbab9('0x1a'),_0x26bfe9);if(_0x26bfe9['result']['length']>0x0&&String(_0x26bfe9['result'][0x0][_0xbab9('0x1b')])===_0xbab9('0x1c')){_0x58cd14[_0xbab9('0x1d')]=_0x26bfe9[_0xbab9('0xb')][0x0]['sys_id'];}else{_0x58cd14[_0xbab9('0x1d')]=_0x58cd14[_0xbab9('0xd')];_0x58cd14['userEmail']=_0x58cd14['adminEmail'];}logger['info']('['+[_0x367325[_0xbab9('0x10')]()]+_0xbab9('0x1e'),_0x58cd14);_0x3af470(_0x58cd14);})[_0xbab9('0x12')](function(_0x556ef5){logger[_0xbab9('0x13')]('['+[_0x367325[_0xbab9('0x10')]()]+']',_0x556ef5['message']);_0xdea767(_0x556ef5['message']);});}else{logger[_0xbab9('0xf')]('['+[_0x367325[_0xbab9('0x10')]()]+_0xbab9('0x1f'));_0x58cd14[_0xbab9('0x1d')]=_0x58cd14[_0xbab9('0xd')];_0x58cd14['userEmail']=_0x58cd14[_0xbab9('0x20')];_0x3af470(_0x58cd14);}});};}function createEndUser(_0x5e3ee4,_0x2bd723,_0x1fdff5,_0x3c51f2,_0xa0fa9f){logger[_0xbab9('0xf')]('['+[_0x5e3ee4[_0xbab9('0x10')]()]+_0xbab9('0x21'),_0x1fdff5);return new Promise(function(_0x3be3ae,_0x246062){var _0x2661a1={'method':'POST','uri':_0x3c51f2+_0xbab9('0x22')+_0xa0fa9f,'body':{'user_name':_0x1fdff5[_0xbab9('0x23')],'roles':_0xbab9('0x24'),'first_name':_0x1fdff5[_0xbab9('0x23')],'active':_0xbab9('0x1c'),'date_format':_0xbab9('0x25'),'phone':_0x1fdff5[_0xbab9('0x23')]},'auth':_0x2bd723,'json':!![]};return rp(_0x2661a1)['then'](function(_0x48ef9b){logger[_0xbab9('0xf')]('['+[_0x5e3ee4[_0xbab9('0x10')]()]+_0xbab9('0x26'),_0x48ef9b[_0xbab9('0xb')]);_0x1fdff5[_0xbab9('0x27')]=_0x48ef9b[_0xbab9('0xb')]['sys_id'];_0x3be3ae(_0x1fdff5);})[_0xbab9('0x12')](function(_0x39644e){logger[_0xbab9('0x13')]('['+[_0x5e3ee4[_0xbab9('0x10')]()]+']',_0x39644e['message']);_0x246062(_0x39644e[_0xbab9('0x14')]);});});}function getEndUser(_0x5a8a51,_0x3a6fec,_0x540e4e,_0x30273c,_0x5a1e45){return function(_0x5c96f3){logger[_0xbab9('0xf')]('['+[_0x5a8a51[_0xbab9('0x10')]()]+_0xbab9('0x28'),_0x5c96f3);return new Promise(function(_0x32f99b,_0x473ee1){var _0x240fce={'method':_0xbab9('0x8'),'uri':_0x540e4e+_0xbab9('0x29')+_0x5c96f3[_0xbab9('0x23')]+'&'+_0x30273c+'&'+_0x5a1e45,'auth':_0x3a6fec,'json':!![]};return rp(_0x240fce)[_0xbab9('0xa')](function(_0x32f64b){if(_0x32f64b[_0xbab9('0xb')][_0xbab9('0xc')]>0x0){_0x5c96f3[_0xbab9('0x27')]=_0x32f64b[_0xbab9('0xb')][0x0][_0xbab9('0xe')];logger[_0xbab9('0xf')]('['+[_0x5a8a51[_0xbab9('0x10')]()]+_0xbab9('0x2a'),_0x5c96f3);_0x32f99b(_0x5c96f3);}else{return createEndUser(_0x5a8a51,_0x3a6fec,_0x5c96f3,_0x540e4e,_0x30273c)[_0xbab9('0xa')](function(_0x27fe78){logger[_0xbab9('0xf')]('['+[_0x5a8a51[_0xbab9('0x10')]()]+_0xbab9('0x2b'),_0x27fe78);_0x32f99b(_0x27fe78);});}})['catch'](function(_0x40d439){logger[_0xbab9('0x13')]('['+[_0x5a8a51['toUpperCase']()]+']',_0x40d439[_0xbab9('0x14')]);_0x473ee1(_0x40d439[_0xbab9('0x14')]);});});};}function getCustomFields(_0x512175,_0x3adb5e){var _0x1fbe1d={};if(_0x512175[_0xbab9('0xc')]>0x0){_[_0xbab9('0x2c')](_0x512175,function(_0x3c2d84){if(_[_0xbab9('0x2d')]([_0xbab9('0x2e'),_0xbab9('0x2f')],_0x3c2d84['type'])&&_0x3c2d84[_0xbab9('0x30')]&&!_0x3c2d84[_0xbab9('0x31')]){_0x1fbe1d[_0x3c2d84[_0xbab9('0x30')]['toLowerCase']()]=_0x3c2d84[_0xbab9('0x32')][_0xbab9('0x33')]();}else if(_['includes'](['string',_0xbab9('0x2f')],_0x3c2d84[_0xbab9('0x34')])&&_0x3c2d84[_0xbab9('0x35')]&&_0x3c2d84[_0xbab9('0x31')]){_0x1fbe1d[_0x3c2d84[_0xbab9('0x35')][_0xbab9('0x36')]()]=_0x3c2d84['content'][_0xbab9('0x33')]();}else if(_0x3c2d84['type']===_0xbab9('0x37')&&_0x3c2d84['variableName']&&_0x3c2d84[_0xbab9('0x35')]&&_0x3c2d84['customField']){_0x1fbe1d[_0x3c2d84['idField']['toLowerCase']()]=_0x3adb5e[_0x3c2d84[_0xbab9('0x38')]][_0xbab9('0x33')]();}else if(_0x3c2d84[_0xbab9('0x34')]===_0xbab9('0x39')&&_0x3c2d84[_0xbab9('0x3a')]&&_0x3c2d84[_0xbab9('0x3a')]['name']&&_0x3c2d84[_0xbab9('0x35')]&&_0x3c2d84[_0xbab9('0x31')]){_0x1fbe1d[_0x3c2d84[_0xbab9('0x35')][_0xbab9('0x36')]()]=_0x3adb5e[_0x3c2d84[_0xbab9('0x3a')][_0xbab9('0x3b')][_0xbab9('0x36')]()][_0xbab9('0x33')]();}});}return _0x1fbe1d;}function getTicket(_0x4bc06d,_0x283052,_0x392f8b,_0x12f310,_0x5c228e,_0x447970){return function(_0x282ece){logger[_0xbab9('0xf')]('['+[_0x4bc06d['toUpperCase']()]+_0xbab9('0x3c'),_0x282ece);return new Promise(function(_0x3a40a3,_0x18965c){var _0x13360f=_0x4bc06d[_0xbab9('0x36')]()===_0xbab9('0x3d')?_0x282ece['userId']:_0x282ece[_0xbab9('0x27')];var _0x364ed6={'method':_0xbab9('0x3e'),'uri':_0x392f8b+'incident'+'?'+_0x447970,'body':Object[_0xbab9('0x3f')]({},{'active':'true','caller_id':_0x13360f,'assigned_to':_0x282ece[_0xbab9('0x1d')],'short_description':intUtil[_0xbab9('0x40')](_0x12f310[_0xbab9('0x41')],_0x5c228e,'\x20'),'description':intUtil[_0xbab9('0x40')](_0x12f310['Descriptions'],_0x5c228e,'\x0a')},getCustomFields(_0x12f310[_0xbab9('0x42')],_0x5c228e)),'auth':_0x283052,'json':!![]};return rp(_0x364ed6)[_0xbab9('0xa')](function(_0x32f1b4){logger[_0xbab9('0xf')]('['+[_0x4bc06d['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x32f1b4[_0xbab9('0xb')]);_0x282ece[_0xbab9('0x43')]=_0x32f1b4[_0xbab9('0xb')]['sys_id'];_0x282ece['ticketNumber']=_0x32f1b4[_0xbab9('0xb')][_0xbab9('0x44')];logger['info']('['+[_0x4bc06d[_0xbab9('0x10')]()]+_0xbab9('0x45'),_0x282ece);_0x3a40a3(_0x282ece);})[_0xbab9('0x12')](function(_0x9762b4){logger[_0xbab9('0x13')]('['+[_0x4bc06d['toUpperCase']()]+']',_0x9762b4[_0xbab9('0x14')]);_0x18965c(_0x9762b4['message']);});});};}function createRemoteTag(_0x4105ed,_0x291616,_0x2a4a41,_0x5a2b39){return new Promise(function(_0x1074d6,_0x4d17d5){var _0x10e4d6={'method':_0xbab9('0x3e'),'uri':_0x2a4a41+_0xbab9('0x46')+'?'+_0x5a2b39,'body':{'short_description':_0x4105ed,'global':!![],'active':!![],'name':_0x4105ed},'auth':_0x291616,'json':!![]};return rp(_0x10e4d6)[_0xbab9('0xa')](function(_0x4b3762){var _0x4a92e5=_0x4b3762['result']['sys_id'];_0x1074d6(_0x4a92e5);});});}function getRemoteTag(_0x4a22de,_0x221315,_0x4e3a59,_0x201e2d,_0x29a0df){return new Promise(function(_0x2fd849,_0x2a1af3){var _0x4d7442={'method':_0xbab9('0x8'),'uri':_0x4e3a59+_0xbab9('0x46')+_0xbab9('0x47')+_0x4a22de+'&'+_0x201e2d,'auth':_0x221315,'json':!![]};return rp(_0x4d7442)[_0xbab9('0xa')](function(_0x24ea05){if(_0x24ea05[_0xbab9('0xb')][_0xbab9('0xc')]>0x0){var _0x4c322f=_0x24ea05[_0xbab9('0xb')][0x0][_0xbab9('0xe')];_0x2fd849(_0x4c322f);}else{return createRemoteTag(_0x4a22de,_0x221315,_0x4e3a59,_0x201e2d)[_0xbab9('0xa')](function(_0x1c0099){_0x2fd849(_0x1c0099);});}});});}function assignTagToIncident(_0x344d21,_0x3bb56f,_0x2cb777,_0x5bbfdb,_0x1b9333){return new Promise(function(_0x217bca,_0x52c215){var _0x4a5130={'method':_0xbab9('0x3e'),'uri':_0x2cb777+_0xbab9('0x48')+'?'+_0x1b9333,'body':{'label':_0x344d21,'table':'incident','id_type':_0xbab9('0x49'),'table_key':_0x5bbfdb[_0xbab9('0x43')],'title':'Incident\x20-\x20'+_0x5bbfdb[_0xbab9('0x4a')],'id_display':_0x5bbfdb[_0xbab9('0x4a')]},'auth':_0x3bb56f,'json':!![]};return rp(_0x4a5130)['then'](function(_0x4967f7){_0x217bca();})['catch'](function(){_0x217bca();});});}function manageTags(_0x33f6e9,_0x33568e,_0x53809b,_0x4d8dca,_0x438773,_0x3ebf99,_0x5237b5){return new Promise(function(_0xb5b2b2,_0x3457ee){var _0x58353f=[];_0x33568e[_0xbab9('0x2c')](function(_0x2df153){_0x58353f[_0xbab9('0x4b')](getRemoteTag(_0x2df153,_0x53809b,_0x4d8dca,_0x3ebf99,_0x5237b5));});return Promise[_0xbab9('0x4c')](_0x58353f)[_0xbab9('0xa')](function(_0x59a853){if(_0x59a853[_0xbab9('0xc')]){logger[_0xbab9('0xf')]('['+[_0x33f6e9[_0xbab9('0x10')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x59a853);var _0x4ec782=[];_0x59a853[_0xbab9('0x2c')](function(_0x1846e6){_0x4ec782['push'](assignTagToIncident(_0x1846e6,_0x53809b,_0x4d8dca,_0x438773,_0x3ebf99));});return Promise['all'](_0x4ec782)['then'](function(){_0xb5b2b2();})['catch'](function(){_0xb5b2b2();});}else{_0xb5b2b2();}});});}function getTags(_0x34d129,_0x3194a2,_0xca848f,_0x301375,_0x3009c7,_0x42b7b4){return function(_0x32400f){return new Promise(function(_0x176327,_0x431327){var _0x8bbf23=[];var _0x18b20d=_0x301375[_0xbab9('0x4d')];if(_0x18b20d&&_0x18b20d[_0xbab9('0xc')]>0x0){_0x8bbf23=_[_0xbab9('0x4e')](_0x18b20d,_0xbab9('0x3b'));}if(_0x8bbf23[_0xbab9('0xc')]>0x0){return manageTags(_0x34d129,_0x8bbf23,_0x3194a2,_0xca848f,_0x32400f,_0x3009c7,_0x42b7b4)[_0xbab9('0xa')](function(){_0x176327(_0x32400f);});}else{_0x176327(_0x32400f);}});};}function emit(_0x20c3ff,_0x5e338f,_0x45dfa1){var _0x226901=_0xbab9('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+'%26sysparm_record_list%3Dactive%253Dtrue'+'%255EORDERBYDESCnumber';var _0x4e2f35={'uri':_0x20c3ff+_0xbab9('0x50')+_0x45dfa1+_0x226901};io['to'](util[_0xbab9('0x51')]('user:%s',_0x5e338f))['emit'](_0xbab9('0x52'),_0x4e2f35);}exports['cs']=function(_0x5a6c34,_0x574bcb,_0x46cbb5,_0x5ad130,_0x2f0506,_0x50aded,_0x22ac9a,_0x43f26c){var _0x5bc912={};var _0x18a0b8={'user':_0x50aded[_0xbab9('0x53')],'pass':_0x50aded['password']};var _0x43eede=_0xbab9('0x54');var _0x4840f0=_0xbab9('0x55');_0x50aded[_0xbab9('0x56')]=intUtil['stripTrailingSlash'](_0x50aded['remoteUri']);_0x50aded['serverUrl']=intUtil['stripTrailingSlash'](_0x50aded[_0xbab9('0x57')]);var _0x5bf4e3=util[_0xbab9('0x51')](_0xbab9('0x58'),_0x50aded['remoteUri']);_0x5bc912['userEmail']=!_['isNil'](_0x5ad130)?_0x5ad130[_0xbab9('0x59')]:null;_0x5bc912[_0xbab9('0x20')]=_0x50aded[_0xbab9('0x59')];_0x5bc912[_0xbab9('0x23')]=_0x43f26c[_0xbab9('0x36')]()===_0xbab9('0x3d')?_0x574bcb[_0xbab9('0x5a')]:_0x574bcb[_0xbab9('0x5b')];_0x5bc912[_0xbab9('0x5c')]=_0x43f26c===_0xbab9('0x5d')||_0x43f26c==='unmanaged'?_0xbab9('0x5d'):'outbound';var _0x3573b6=util[_0xbab9('0x51')](_0xbab9('0x5e'),_0x50aded['serverUrl'],_0x574bcb[_0xbab9('0x5f')],md5(_0x574bcb[_0xbab9('0x5f')]));if(_0x2f0506&&_0x2f0506[_0xbab9('0x60')]){logger[_0xbab9('0xf')](_0xbab9('0x61'),_0xbab9('0x62'));_0x574bcb['recordingURL']=_0x3573b6;}else if(_0x22ac9a&&_0x22ac9a[_0xbab9('0x63')]&&_0x22ac9a[_0xbab9('0x63')]!==_0xbab9('0x64')){logger[_0xbab9('0xf')]('[OUTBOUND]',_0xbab9('0x62'));_0x574bcb[_0xbab9('0x65')]=_0x3573b6;}else{_0x574bcb[_0xbab9('0x65')]='';}return getAdminUser(_0x43f26c,_0x18a0b8,_0x5bc912,_0x5bf4e3,_0x4840f0,_0x43eede)[_0xbab9('0xa')](getUser(_0x43f26c,_0x18a0b8,_0x5bf4e3,_0x4840f0,_0x43eede))['then'](getEndUser(_0x43f26c,_0x18a0b8,_0x5bf4e3,_0x4840f0,_0x43eede))['then'](getTicket(_0x43f26c,_0x18a0b8,_0x5bf4e3,_0x46cbb5,_0x574bcb,_0x4840f0))[_0xbab9('0xa')](function(_0x1e7037){logger[_0xbab9('0xf')](util['format']('The\x20ticket\x20ID\x20is:\x20%s',_0x1e7037[_0xbab9('0x43')]));logger[_0xbab9('0xf')](util[_0xbab9('0x51')](_0xbab9('0x66'),_0x43f26c));if(_0x43f26c!==_0xbab9('0x67')){logger[_0xbab9('0xf')]('['+[_0x43f26c[_0xbab9('0x10')]()]+']',_0xbab9('0x68'));emit(_0x50aded[_0xbab9('0x56')],_0x5ad130['name'],_0x1e7037['ticketId']);}})['catch'](function(_0x4248ea){logger[_0xbab9('0x13')]('['+[_0x43f26c[_0xbab9('0x10')]()]+_0xbab9('0x69'),util[_0xbab9('0x6a')](_0x4248ea,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0x5ddf=['endUserNumber','endUserId','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','type','nameField','customField','toLowerCase','content','toString','picklist','idField','variableName','Variable','name',']\x20getTicket\x20input\x20crm','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','all','push','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','username','sysparm_display_value=true','remoteUri','serverUrl','isNil','email','outbound','destcalleridnum','calleridnum','callDirection','queue','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','length','adminId','result','],\x20getAdminUser\x20crm','catch','error','toUpperCase','message','info','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','true','sys_id','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0x5ddf,0x111));var _0xf5dd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5ddf[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf5dd('0x0'));var Promise=require(_0xf5dd('0x1'));var rp=require(_0xf5dd('0x2'));var util=require(_0xf5dd('0x3'));var md5=require(_0xf5dd('0x4'));var Redis=require(_0xf5dd('0x5'));var intUtil=require(_0xf5dd('0x6'));var config=require(_0xf5dd('0x7'));var logger=require(_0xf5dd('0x8'))(_0xf5dd('0x9'));config[_0xf5dd('0xa')]=_[_0xf5dd('0xb')](config[_0xf5dd('0xa')],{'host':_0xf5dd('0xc'),'port':0x18eb});var io=require(_0xf5dd('0xd'))(new Redis(config[_0xf5dd('0xa')]));function getAdminUser(_0x4e9dde,_0x389b6a,_0x14d2b2,_0x45e859,_0x5caca5,_0x45afa7){return new Promise(function(_0x482871,_0x12e2b7){var _0x99f1bb={'method':_0xf5dd('0xe'),'uri':_0x45e859+_0xf5dd('0xf')+'&'+_0x5caca5+'&'+_0x45afa7,'auth':_0x389b6a,'json':!![]};return rp(_0x99f1bb)[_0xf5dd('0x10')](function(_0x46a5dc){if(_0x46a5dc['result'][_0xf5dd('0x11')]>0x0){_0x14d2b2[_0xf5dd('0x12')]=_0x46a5dc[_0xf5dd('0x13')][0x0]['sys_id'];}logger['info']('['+[_0x4e9dde['toUpperCase']()]+_0xf5dd('0x14'),_0x14d2b2);_0x482871(_0x14d2b2);})[_0xf5dd('0x15')](function(_0x303282){logger[_0xf5dd('0x16')]('['+[_0x4e9dde[_0xf5dd('0x17')]()]+']',_0x303282[_0xf5dd('0x18')]);_0x12e2b7(_0x303282['message']);});});}function getUser(_0x27b7ab,_0xfe97e7,_0x54b53a,_0x474b2b,_0xc20f50){return function(_0x6093ab){logger[_0xf5dd('0x19')]('['+[_0x27b7ab[_0xf5dd('0x17')]()]+'],\x20getUser\x20input\x20crm',_0x6093ab);return new Promise(function(_0x320b2e,_0x13f8d9){if(intUtil['validateEmail'](_0x6093ab[_0xf5dd('0x1a')])){var _0x53083b={'method':_0xf5dd('0xe'),'uri':_0x54b53a+_0xf5dd('0x1b')+_0x6093ab['userEmail']+'&'+_0x474b2b+'&'+_0xc20f50,'auth':_0xfe97e7,'json':!![]};logger[_0xf5dd('0x19')]('['+[_0x27b7ab['toUpperCase']()]+_0xf5dd('0x1c'),_0x53083b);return rp(_0x53083b)[_0xf5dd('0x10')](function(_0x3bb608){logger['info']('['+[_0x27b7ab['toUpperCase']()]+_0xf5dd('0x1d'),_0x3bb608);if(_0x3bb608['result'][_0xf5dd('0x11')]>0x0&&String(_0x3bb608[_0xf5dd('0x13')][0x0]['active'])===_0xf5dd('0x1e')){_0x6093ab['userId']=_0x3bb608[_0xf5dd('0x13')][0x0][_0xf5dd('0x1f')];}else{_0x6093ab[_0xf5dd('0x20')]=_0x6093ab[_0xf5dd('0x12')];_0x6093ab['userEmail']=_0x6093ab[_0xf5dd('0x21')];}logger[_0xf5dd('0x19')]('['+[_0x27b7ab['toUpperCase']()]+_0xf5dd('0x22'),_0x6093ab);_0x320b2e(_0x6093ab);})[_0xf5dd('0x15')](function(_0x141dfa){logger[_0xf5dd('0x16')]('['+[_0x27b7ab[_0xf5dd('0x17')]()]+']',_0x141dfa[_0xf5dd('0x18')]);_0x13f8d9(_0x141dfa[_0xf5dd('0x18')]);});}else{logger[_0xf5dd('0x19')]('['+[_0x27b7ab['toUpperCase']()]+_0xf5dd('0x23'));_0x6093ab[_0xf5dd('0x20')]=_0x6093ab[_0xf5dd('0x12')];_0x6093ab[_0xf5dd('0x1a')]=_0x6093ab[_0xf5dd('0x21')];_0x320b2e(_0x6093ab);}});};}function createEndUser(_0x48721a,_0x1b1113,_0x1a5580,_0xa7e6a2,_0x1af3d5){logger['info']('['+[_0x48721a[_0xf5dd('0x17')]()]+_0xf5dd('0x24'),_0x1a5580);return new Promise(function(_0x3a2d79,_0x15f0e7){var _0x23c8c7={'method':_0xf5dd('0x25'),'uri':_0xa7e6a2+'sys_user?'+_0x1af3d5,'body':{'user_name':_0x1a5580['endUserNumber'],'roles':_0xf5dd('0x26'),'first_name':_0x1a5580[_0xf5dd('0x27')],'active':'true','date_format':'System','phone':_0x1a5580[_0xf5dd('0x27')]},'auth':_0x1b1113,'json':!![]};return rp(_0x23c8c7)[_0xf5dd('0x10')](function(_0x30d693){logger[_0xf5dd('0x19')]('['+[_0x48721a[_0xf5dd('0x17')]()]+'],\x20EndUser\x20schema',_0x30d693['result']);_0x1a5580[_0xf5dd('0x28')]=_0x30d693['result'][_0xf5dd('0x1f')];_0x3a2d79(_0x1a5580);})[_0xf5dd('0x15')](function(_0x2ae1ea){logger[_0xf5dd('0x16')]('['+[_0x48721a[_0xf5dd('0x17')]()]+']',_0x2ae1ea[_0xf5dd('0x18')]);_0x15f0e7(_0x2ae1ea[_0xf5dd('0x18')]);});});}function getEndUser(_0xb4d239,_0x24c6fe,_0x46a45d,_0xcb1cdc,_0x3547d4){return function(_0x7d38bf){logger[_0xf5dd('0x19')]('['+[_0xb4d239[_0xf5dd('0x17')]()]+'],\x20getEndUser\x20input\x20crm',_0x7d38bf);return new Promise(function(_0x8378da,_0x1e51b1){var _0x41a350={'method':_0xf5dd('0xe'),'uri':_0x46a45d+'sys_user?sysparm_query=phone%3D'+_0x7d38bf[_0xf5dd('0x27')]+'&'+_0xcb1cdc+'&'+_0x3547d4,'auth':_0x24c6fe,'json':!![]};return rp(_0x41a350)[_0xf5dd('0x10')](function(_0x14c2f3){if(_0x14c2f3[_0xf5dd('0x13')][_0xf5dd('0x11')]>0x0){_0x7d38bf[_0xf5dd('0x28')]=_0x14c2f3[_0xf5dd('0x13')][0x0]['sys_id'];logger[_0xf5dd('0x19')]('['+[_0xb4d239[_0xf5dd('0x17')]()]+_0xf5dd('0x29'),_0x7d38bf);_0x8378da(_0x7d38bf);}else{return createEndUser(_0xb4d239,_0x24c6fe,_0x7d38bf,_0x46a45d,_0xcb1cdc)[_0xf5dd('0x10')](function(_0x544aff){logger['info']('['+[_0xb4d239[_0xf5dd('0x17')]()]+_0xf5dd('0x2a'),_0x544aff);_0x8378da(_0x544aff);});}})[_0xf5dd('0x15')](function(_0x3afd4a){logger[_0xf5dd('0x16')]('['+[_0xb4d239[_0xf5dd('0x17')]()]+']',_0x3afd4a[_0xf5dd('0x18')]);_0x1e51b1(_0x3afd4a['message']);});});};}function getCustomFields(_0x27ed05,_0x14a54b){var _0x1ce06c={};if(_0x27ed05[_0xf5dd('0x11')]>0x0){_[_0xf5dd('0x2b')](_0x27ed05,function(_0x26fbe9){if(_[_0xf5dd('0x2c')](['string','picklist'],_0x26fbe9[_0xf5dd('0x2d')])&&_0x26fbe9[_0xf5dd('0x2e')]&&!_0x26fbe9[_0xf5dd('0x2f')]){_0x1ce06c[_0x26fbe9[_0xf5dd('0x2e')][_0xf5dd('0x30')]()]=_0x26fbe9[_0xf5dd('0x31')][_0xf5dd('0x32')]();}else if(_[_0xf5dd('0x2c')](['string',_0xf5dd('0x33')],_0x26fbe9['type'])&&_0x26fbe9['idField']&&_0x26fbe9['customField']){_0x1ce06c[_0x26fbe9[_0xf5dd('0x34')]['toLowerCase']()]=_0x26fbe9[_0xf5dd('0x31')][_0xf5dd('0x32')]();}else if(_0x26fbe9['type']==='variable'&&_0x26fbe9[_0xf5dd('0x35')]&&_0x26fbe9[_0xf5dd('0x34')]&&_0x26fbe9[_0xf5dd('0x2f')]){_0x1ce06c[_0x26fbe9[_0xf5dd('0x34')][_0xf5dd('0x30')]()]=_0x14a54b[_0x26fbe9[_0xf5dd('0x35')]][_0xf5dd('0x32')]();}else if(_0x26fbe9[_0xf5dd('0x2d')]==='customVariable'&&_0x26fbe9[_0xf5dd('0x36')]&&_0x26fbe9['Variable'][_0xf5dd('0x37')]&&_0x26fbe9[_0xf5dd('0x34')]&&_0x26fbe9[_0xf5dd('0x2f')]){_0x1ce06c[_0x26fbe9[_0xf5dd('0x34')][_0xf5dd('0x30')]()]=_0x14a54b[_0x26fbe9[_0xf5dd('0x36')][_0xf5dd('0x37')][_0xf5dd('0x30')]()][_0xf5dd('0x32')]();}});}return _0x1ce06c;}function getTicket(_0xec280c,_0x1080a7,_0x2ad13e,_0x264afd,_0x5b1dfa,_0x160976){return function(_0x403ed8){logger[_0xf5dd('0x19')]('['+[_0xec280c[_0xf5dd('0x17')]()]+_0xf5dd('0x38'),_0x403ed8);return new Promise(function(_0x7edd17,_0x13c763){var _0x5c6ff5=_0xec280c[_0xf5dd('0x30')]()==='outbound'?_0x403ed8[_0xf5dd('0x20')]:_0x403ed8[_0xf5dd('0x28')];var _0x1e5da8={'method':_0xf5dd('0x25'),'uri':_0x2ad13e+_0xf5dd('0x39')+'?'+_0x160976,'body':Object[_0xf5dd('0x3a')]({},{'active':_0xf5dd('0x1e'),'caller_id':_0x5c6ff5,'assigned_to':_0x403ed8['userId'],'short_description':intUtil[_0xf5dd('0x3b')](_0x264afd['Subjects'],_0x5b1dfa,'\x20'),'description':intUtil['getString'](_0x264afd[_0xf5dd('0x3c')],_0x5b1dfa,'\x0a')},getCustomFields(_0x264afd[_0xf5dd('0x3d')],_0x5b1dfa)),'auth':_0x1080a7,'json':!![]};return rp(_0x1e5da8)[_0xf5dd('0x10')](function(_0x5b09c7){logger[_0xf5dd('0x19')]('['+[_0xec280c[_0xf5dd('0x17')]()]+_0xf5dd('0x3e'),_0x5b09c7[_0xf5dd('0x13')]);_0x403ed8[_0xf5dd('0x3f')]=_0x5b09c7[_0xf5dd('0x13')][_0xf5dd('0x1f')];_0x403ed8['ticketNumber']=_0x5b09c7[_0xf5dd('0x13')]['number'];logger[_0xf5dd('0x19')]('['+[_0xec280c[_0xf5dd('0x17')]()]+_0xf5dd('0x40'),_0x403ed8);_0x7edd17(_0x403ed8);})[_0xf5dd('0x15')](function(_0x217a46){logger[_0xf5dd('0x16')]('['+[_0xec280c[_0xf5dd('0x17')]()]+']',_0x217a46['message']);_0x13c763(_0x217a46[_0xf5dd('0x18')]);});});};}function createRemoteTag(_0x6c8f4b,_0x3044a0,_0x48e897,_0x338b85){return new Promise(function(_0x299189,_0x32fd9c){var _0x3f9c4c={'method':'POST','uri':_0x48e897+_0xf5dd('0x41')+'?'+_0x338b85,'body':{'short_description':_0x6c8f4b,'global':!![],'active':!![],'name':_0x6c8f4b},'auth':_0x3044a0,'json':!![]};return rp(_0x3f9c4c)[_0xf5dd('0x10')](function(_0x243b3a){var _0x37b209=_0x243b3a[_0xf5dd('0x13')][_0xf5dd('0x1f')];_0x299189(_0x37b209);});});}function getRemoteTag(_0x346917,_0x32092f,_0x3ac898,_0x497fef,_0x522ab9){return new Promise(function(_0x43ae20,_0x20dcf2){var _0x15dcf7={'method':_0xf5dd('0xe'),'uri':_0x3ac898+_0xf5dd('0x41')+_0xf5dd('0x42')+_0x346917+'&'+_0x497fef,'auth':_0x32092f,'json':!![]};return rp(_0x15dcf7)[_0xf5dd('0x10')](function(_0x47ebdd){if(_0x47ebdd[_0xf5dd('0x13')][_0xf5dd('0x11')]>0x0){var _0x55eda0=_0x47ebdd[_0xf5dd('0x13')][0x0]['sys_id'];_0x43ae20(_0x55eda0);}else{return createRemoteTag(_0x346917,_0x32092f,_0x3ac898,_0x497fef)['then'](function(_0x365bfe){_0x43ae20(_0x365bfe);});}});});}function assignTagToIncident(_0x448cb3,_0x5e0e45,_0x12ee45,_0xfc44a,_0x28be1e){return new Promise(function(_0xf256b,_0x5c609d){var _0x40484a={'method':_0xf5dd('0x25'),'uri':_0x12ee45+_0xf5dd('0x43')+'?'+_0x28be1e,'body':{'label':_0x448cb3,'table':'incident','id_type':_0xf5dd('0x44'),'table_key':_0xfc44a['ticketId'],'title':_0xf5dd('0x45')+_0xfc44a[_0xf5dd('0x46')],'id_display':_0xfc44a[_0xf5dd('0x46')]},'auth':_0x5e0e45,'json':!![]};return rp(_0x40484a)[_0xf5dd('0x10')](function(_0x5013e7){_0xf256b();})[_0xf5dd('0x15')](function(){_0xf256b();});});}function manageTags(_0x13bc4f,_0x5347f0,_0x1ad28e,_0x4f80a1,_0x624c14,_0x2eff65,_0x1d6006){return new Promise(function(_0x41b3e8,_0x426418){var _0x4b9aea=[];_0x5347f0[_0xf5dd('0x2b')](function(_0x11ef06){_0x4b9aea['push'](getRemoteTag(_0x11ef06,_0x1ad28e,_0x4f80a1,_0x2eff65,_0x1d6006));});return Promise[_0xf5dd('0x47')](_0x4b9aea)['then'](function(_0x146e14){if(_0x146e14[_0xf5dd('0x11')]){logger['info']('['+[_0x13bc4f[_0xf5dd('0x17')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x146e14);var _0xae43ca=[];_0x146e14['forEach'](function(_0x3df0b5){_0xae43ca[_0xf5dd('0x48')](assignTagToIncident(_0x3df0b5,_0x1ad28e,_0x4f80a1,_0x624c14,_0x2eff65));});return Promise[_0xf5dd('0x47')](_0xae43ca)[_0xf5dd('0x10')](function(){_0x41b3e8();})['catch'](function(){_0x41b3e8();});}else{_0x41b3e8();}});});}function getTags(_0x459b47,_0x5b1cdd,_0x17b908,_0x25935c,_0x1ae267,_0x32ab7f){return function(_0x5b179a){return new Promise(function(_0x5f534b,_0x4d664b){var _0x1be3e8=[];var _0x2b6a05=_0x25935c[_0xf5dd('0x49')];if(_0x2b6a05&&_0x2b6a05[_0xf5dd('0x11')]>0x0){_0x1be3e8=_[_0xf5dd('0x4a')](_0x2b6a05,_0xf5dd('0x37'));}if(_0x1be3e8[_0xf5dd('0x11')]>0x0){return manageTags(_0x459b47,_0x1be3e8,_0x5b1cdd,_0x17b908,_0x5b179a,_0x1ae267,_0x32ab7f)[_0xf5dd('0x10')](function(){_0x5f534b(_0x5b179a);});}else{_0x5f534b(_0x5b179a);}});};}function emit(_0x4b4c7e,_0x2d8bb5,_0x30112b){var _0xf6719=_0xf5dd('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xf5dd('0x4c')+_0xf5dd('0x4d');var _0xe260b7={'uri':_0x4b4c7e+_0xf5dd('0x4e')+_0x30112b+_0xf6719};io['to'](util['format'](_0xf5dd('0x4f'),_0x2d8bb5))['emit'](_0xf5dd('0x50'),_0xe260b7);}exports['cs']=function(_0xce808f,_0x3ebb62,_0x18880d,_0x24b171,_0x533a7c,_0x4927da,_0xf8e246,_0x4f2090){var _0x3bfa46={};var _0x436022={'user':_0x4927da[_0xf5dd('0x51')],'pass':_0x4927da['password']};var _0x22ff93='sysparm_limit=1';var _0x469d7c=_0xf5dd('0x52');_0x4927da['remoteUri']=intUtil['stripTrailingSlash'](_0x4927da[_0xf5dd('0x53')]);_0x4927da[_0xf5dd('0x54')]=intUtil['stripTrailingSlash'](_0x4927da[_0xf5dd('0x54')]);var _0x1b1161=util['format']('%s/api/now/table/',_0x4927da[_0xf5dd('0x53')]);_0x3bfa46[_0xf5dd('0x1a')]=!_[_0xf5dd('0x55')](_0x24b171)?_0x24b171[_0xf5dd('0x56')]:null;_0x3bfa46['adminEmail']=_0x4927da[_0xf5dd('0x56')];_0x3bfa46[_0xf5dd('0x27')]=_0x4f2090['toLowerCase']()===_0xf5dd('0x57')?_0x3ebb62[_0xf5dd('0x58')]:_0x3ebb62[_0xf5dd('0x59')];_0x3bfa46[_0xf5dd('0x5a')]=_0x4f2090===_0xf5dd('0x5b')||_0x4f2090==='unmanaged'?'queue':_0xf5dd('0x57');var _0x5dafba=util[_0xf5dd('0x5c')](_0xf5dd('0x5d'),_0x4927da[_0xf5dd('0x54')],_0x3ebb62[_0xf5dd('0x5e')],md5(_0x3ebb62[_0xf5dd('0x5e')]));if(_0x533a7c&&_0x533a7c['monitor_format']){logger[_0xf5dd('0x19')](_0xf5dd('0x5f'),_0xf5dd('0x60'));_0x3ebb62[_0xf5dd('0x61')]=_0x5dafba;}else if(_0xf8e246&&_0xf8e246['recordingFormat']&&_0xf8e246[_0xf5dd('0x62')]!=='none'){logger[_0xf5dd('0x19')](_0xf5dd('0x63'),_0xf5dd('0x60'));_0x3ebb62['recordingURL']=_0x5dafba;}else{_0x3ebb62[_0xf5dd('0x61')]='';}return getAdminUser(_0x4f2090,_0x436022,_0x3bfa46,_0x1b1161,_0x469d7c,_0x22ff93)[_0xf5dd('0x10')](getUser(_0x4f2090,_0x436022,_0x1b1161,_0x469d7c,_0x22ff93))['then'](getEndUser(_0x4f2090,_0x436022,_0x1b1161,_0x469d7c,_0x22ff93))[_0xf5dd('0x10')](getTicket(_0x4f2090,_0x436022,_0x1b1161,_0x18880d,_0x3ebb62,_0x469d7c))[_0xf5dd('0x10')](function(_0x3c67f7){logger[_0xf5dd('0x19')](util[_0xf5dd('0x5c')](_0xf5dd('0x64'),_0x3c67f7['ticketId']));logger[_0xf5dd('0x19')](util[_0xf5dd('0x5c')]('call\x20direction:\x20%s',_0x4f2090));if(_0x4f2090!==_0xf5dd('0x65')){logger[_0xf5dd('0x19')]('['+[_0x4f2090[_0xf5dd('0x17')]()]+']',_0xf5dd('0x66'));emit(_0x4927da['remoteUri'],_0x24b171['name'],_0x3c67f7[_0xf5dd('0x3f')]);}})[_0xf5dd('0x15')](function(_0x46ff0d){logger[_0xf5dd('0x16')]('['+[_0x4f2090[_0xf5dd('0x17')]()]+_0xf5dd('0x67'),util['inspect'](_0x46ff0d,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index c0b093a..e8bf79d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70a7=['./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','description','Descriptions','date_start','toISOString','slice','replace','duration_hours','parent_id','parent_type','parent_name','direction','length','forEach','variableName','push','idField','JSON','stringify','Calls','format','toString','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','then','entry_list','find','name_value_list','value','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','user_id','user_name','Searching\x20enduser\x20with\x20phone','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','<unknown>','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','nameField','customField','content','string','custom_fields','type','variable','Variable','toLowerCase','login','username','PLAIN','Account\x20%d\x20is\x20not\x20valid','queue','stripTrailingSlash','remoteUri','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','trigger:browser:url','catch','unmanaged','lastevent','toUpperCase','calleridname','Inbound','lodash','request-promise','bluebird','md5','util','ioredis'];(function(_0x3915ff,_0x33ef75){var _0x507740=function(_0x2ea8aa){while(--_0x2ea8aa){_0x3915ff['push'](_0x3915ff['shift']());}};_0x507740(++_0x33ef75);}(_0x70a7,0xee));var _0x770a=function(_0x4c4037,_0x15054b){_0x4c4037=_0x4c4037-0x0;var _0x357862=_0x70a7[_0x4c4037];return _0x357862;};'use strict';var _=require(_0x770a('0x0'));var rp=require(_0x770a('0x1'));var BPromise=require(_0x770a('0x2'));var md5=require(_0x770a('0x3'));var util=require(_0x770a('0x4'));var Redis=require(_0x770a('0x5'));var intUtil=require(_0x770a('0x6'));var config=require(_0x770a('0x7'));var logger=require(_0x770a('0x8'))(_0x770a('0x9'));config[_0x770a('0xa')]=_[_0x770a('0xb')](config[_0x770a('0xa')],{'host':_0x770a('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x770a('0xa')]));var def={'method':_0x770a('0xd'),'json':!![]};function emit(_0x4e06f7,_0x459e4c,_0x71ead9){io['to'](_0x4e06f7)[_0x770a('0xe')](_0x459e4c,_0x71ead9);}function getTicket(_0x23e5d2,_0x4df094,_0x3e055c,_0x2ea110,_0x36c202,_0x2b2190,_0x2d6f3c,_0x5a24cc){logger[_0x770a('0xf')](_0x770a('0x10'));var _0x1e4638=new Date();var _0x348a63=[{'name':_0x770a('0x11'),'value':intUtil[_0x770a('0x12')](_0x2ea110[_0x770a('0x13')],_0x36c202,'\x20')},{'name':_0x770a('0x14'),'value':_0x4df094['id']},{'name':'created_by','value':_0x4df094['id']},{'name':_0x770a('0x15'),'value':intUtil['getString'](_0x2ea110[_0x770a('0x16')],_0x36c202,'\x0a')},{'name':_0x770a('0x17'),'value':_0x1e4638[_0x770a('0x18')]()[_0x770a('0x19')](0x0,0x13)[_0x770a('0x1a')]('T','\x20')},{'name':_0x770a('0x1b'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x770a('0x1c'),'value':_0x3e055c['id']},{'name':_0x770a('0x1d'),'value':'Contacts'},{'name':_0x770a('0x1e'),'value':_0x3e055c[_0x770a('0x11')]},{'name':_0x770a('0x1f'),'value':_0x5a24cc}];if(_0x2b2190[_0x770a('0x20')]){_[_0x770a('0x21')](_0x2b2190,function(_0x341099){if(_0x36c202[_0x341099[_0x770a('0x22')]]){_0x348a63[_0x770a('0x23')]({'name':_0x341099[_0x770a('0x24')],'value':_0x36c202[_0x341099[_0x770a('0x22')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x770a('0x25'),'response_type':_0x770a('0x25'),'rest_data':JSON[_0x770a('0x26')]({'session':_0x2d6f3c['id'],'module_name':_0x770a('0x27'),'name_value_list':_0x348a63})}});}function getAuth(_0x5d732a){return util[_0x770a('0x28')]('Basic\x20%s',new Buffer(_0x5d732a['apiKey']+':X')[_0x770a('0x29')]('base64'));}function getServerInfo(_0x548b5e){return request({'form':{'method':_0x770a('0x2a'),'input_type':_0x770a('0x25'),'response_type':_0x770a('0x25'),'rest_data':JSON[_0x770a('0x26')]({'session':_0x548b5e['id']})}});}function getUser(_0x4cf3dc,_0x391bf0,_0x5e0061){if(!_['isNil'](_0x391bf0)){logger[_0x770a('0xf')](_0x770a('0x2b'),_0x391bf0);return request({'form':{'method':_0x770a('0x2c'),'input_type':_0x770a('0x25'),'response_type':_0x770a('0x25'),'rest_data':JSON['stringify']({'session':_0x5e0061['id'],'module_name':_0x770a('0x2d'),'query':util[_0x770a('0x28')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x391bf0),'order_by':'','offset':'0','select_fields':['id',_0x770a('0x11'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x770a('0x2e')](function(_0x27fd8e){if(_0x27fd8e[_0x770a('0x2f')]['length']){var _0x5a9a88=_[_0x770a('0x30')](_0x27fd8e[_0x770a('0x2f')],function(_0x187b04){return _0x187b04[_0x770a('0x31')]['user_name'][_0x770a('0x32')]===_0x391bf0;});if(_0x5a9a88){logger[_0x770a('0xf')](_0x770a('0x33'));return BPromise['resolve']({'id':_0x5a9a88['name_value_list']['id'][_0x770a('0x32')],'name':_0x5a9a88[_0x770a('0x31')][_0x770a('0x11')][_0x770a('0x32')]});}}logger['info'](_0x770a('0x34'));return BPromise[_0x770a('0x35')]({'id':_0x5e0061['name_value_list'][_0x770a('0x36')][_0x770a('0x32')],'name':_0x5e0061['name_value_list'][_0x770a('0x37')][_0x770a('0x32')]});});}else{logger[_0x770a('0xf')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x770a('0x35')]({'id':_0x5e0061[_0x770a('0x31')]['user_id'][_0x770a('0x32')],'name':_0x5e0061[_0x770a('0x31')][_0x770a('0x37')][_0x770a('0x32')]});}}function getEndUser(_0x3fa56f,_0x49abba,_0x13531f,_0x2e6bfd){logger[_0x770a('0xf')](_0x770a('0x38'),_0x13531f);return request({'form':{'method':_0x770a('0x2c'),'input_type':_0x770a('0x25'),'response_type':_0x770a('0x25'),'rest_data':JSON[_0x770a('0x26')]({'session':_0x2e6bfd['id'],'module_name':_0x770a('0x39'),'query':util[_0x770a('0x28')](_0x770a('0x3a'),_0x13531f),'order_by':'','offset':'0','select_fields':['id',_0x770a('0x11'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x770a('0x2e')](function(_0x127524){if(_0x127524[_0x770a('0x2f')]['length']){var _0x4a8191=_[_0x770a('0x30')](_0x127524[_0x770a('0x2f')],function(_0xd9a13){return _0xd9a13['name_value_list'][_0x770a('0x3b')][_0x770a('0x32')]===_0x13531f;});if(_0x4a8191){logger[_0x770a('0xf')](_0x770a('0x3c'));return BPromise[_0x770a('0x35')]({'id':_0x4a8191[_0x770a('0x31')]['id']['value'],'name':_0x4a8191[_0x770a('0x31')][_0x770a('0x11')][_0x770a('0x32')],'phone':_0x4a8191['name_value_list'][_0x770a('0x3b')]['value']});}}else{logger[_0x770a('0xf')](_0x770a('0x3d'));return request({'form':{'method':_0x770a('0x3e'),'input_type':_0x770a('0x25'),'response_type':_0x770a('0x25'),'rest_data':JSON[_0x770a('0x26')]({'session':_0x2e6bfd['id'],'module_name':_0x770a('0x39'),'name_value_list':[{'name':_0x770a('0x3f'),'value':_0x49abba!==_0x770a('0x40')?_0x49abba:util[_0x770a('0x28')](_0x770a('0x41'),_0x13531f)},{'name':'phone_home','value':_0x13531f}]})}})['then'](function(_0x216830){logger['info'](_0x770a('0x42'));return BPromise[_0x770a('0x35')]({'id':_0x216830['id'],'name':_0x216830['entry_list'][_0x770a('0x3f')][_0x770a('0x32')],'phone':_0x216830[_0x770a('0x2f')]['phone_home']['value']});});}});}function request(_0x43647f){logger[_0x770a('0x43')](_0x770a('0x44'),JSON[_0x770a('0x26')](_0x43647f));return rp(_['merge'](def,_0x43647f));}function getTags(_0x5865f9,_0x145bd2){var _0x343dd3=[];if(_0x5865f9&&_0x5865f9[_0x770a('0x20')]>0x0){_0x343dd3=_['map'](_0x5865f9,_0x145bd2);}return _0x343dd3;}function getCustomFields(_0x41a4f5,_0x592deb){var _0x749f86=[];var _0x2ac17b={'custom_fields':[]};if(_0x41a4f5[_0x770a('0x20')]>0x0){_['forEach'](_0x41a4f5,function(_0x50097e){if(_0x50097e['type']==='string'&&_0x50097e[_0x770a('0x45')]&&!_0x50097e[_0x770a('0x46')]){_0x2ac17b[_0x50097e[_0x770a('0x45')]['toLowerCase']()]=_0x50097e[_0x770a('0x47')][_0x770a('0x29')]();}else if(_0x50097e['type']===_0x770a('0x48')&&_0x50097e[_0x770a('0x24')]&&_0x50097e[_0x770a('0x46')]){_0x2ac17b[_0x770a('0x49')][_0x770a('0x23')]({'id':_0x50097e[_0x770a('0x24')],'value':_0x50097e[_0x770a('0x47')][_0x770a('0x29')]()});}else if(_0x50097e[_0x770a('0x4a')]===_0x770a('0x4b')&&_0x50097e['variableName']&&_0x50097e['idField']&&_0x50097e['customField']){_0x592deb[_0x50097e[_0x770a('0x22')]]&&_0x2ac17b[_0x770a('0x49')][_0x770a('0x23')]({'id':_0x50097e[_0x770a('0x24')],'value':_0x592deb[_0x50097e[_0x770a('0x22')]]['toString']()});}else if(_0x50097e[_0x770a('0x4a')]==='customVariable'&&_0x50097e[_0x770a('0x4c')]&&_0x50097e[_0x770a('0x4c')][_0x770a('0x11')]&&_0x50097e[_0x770a('0x24')]&&_0x50097e[_0x770a('0x46')]){_0x592deb[_0x50097e[_0x770a('0x4c')][_0x770a('0x11')][_0x770a('0x4d')]()]&&_0x2ac17b[_0x770a('0x49')][_0x770a('0x23')]({'id':_0x50097e[_0x770a('0x24')],'value':_0x592deb[_0x50097e[_0x770a('0x4c')][_0x770a('0x11')][_0x770a('0x4d')]()]['toString']()});}});}return _0x2ac17b;}function getConnection(_0x466b7d){return request({'method':_0x770a('0xd'),'form':{'method':_0x770a('0x4e'),'input_type':_0x770a('0x25'),'response_type':_0x770a('0x25'),'rest_data':JSON[_0x770a('0x26')]({'user_auth':{'user_name':_0x466b7d[_0x770a('0x4f')],'password':_0x466b7d['password'],'encryption':_0x770a('0x50')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x770a('0x2e')](function(_0x774643){var _0x1e664c=_0x774643;if(_0x1e664c['id']){def['sessionID']=_0x1e664c['id'];return BPromise[_0x770a('0x35')](_0x1e664c);}else{throw new Error(util[_0x770a('0x28')](_0x770a('0x51'),_0x466b7d['id']));}});}function setRelationship(_0x4228d6,_0x44c55b,_0x23eafc,_0x53aebb){return request({'form':{'method':'set_relationship','input_type':_0x770a('0x25'),'response_type':_0x770a('0x25'),'rest_data':JSON[_0x770a('0x26')]({'session':_0x4228d6['id'],'module_name':_0x770a('0x27'),'module_id':_0x23eafc['id'],'link_field_name':_0x53aebb,'related_ids':[_0x44c55b['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x770a('0x52')]=function(_0x3cd668,_0xd5c6d,_0x44ab3f,_0x2ce3b9,_0x57ebdf,_0x504d4c){var _0x30b470,_0x5f3884,_0x55a318,_0x3db7c1;_0x504d4c['remoteUri']=intUtil[_0x770a('0x53')](_0x504d4c[_0x770a('0x54')]);_0x504d4c[_0x770a('0x55')]=intUtil[_0x770a('0x53')](_0x504d4c[_0x770a('0x55')]);def[_0x770a('0x56')]=util[_0x770a('0x28')](_0x770a('0x57'),_0x504d4c[_0x770a('0x54')]);if(_0x57ebdf&&_0x57ebdf[_0x770a('0x58')]){logger[_0x770a('0xf')](_0x770a('0x59'),'Recording\x20is\x20enabled!');_0xd5c6d[_0x770a('0x5a')]=util['format'](_0x770a('0x5b'),_0x504d4c[_0x770a('0x55')],_0xd5c6d[_0x770a('0x5c')],md5(_0xd5c6d[_0x770a('0x5c')]));}else{_0xd5c6d['recordingURL']='';}return getConnection(_0x504d4c)[_0x770a('0x2e')](function(_0x5eae94){_0x3db7c1=_0x5eae94;return getUser(_0x504d4c,_0x2ce3b9[_0x770a('0x11')],_0x3db7c1);})[_0x770a('0x2e')](function(_0x58f2b4){_0x30b470=_0x58f2b4;logger['info']('The\x20User\x20ID\x20is:',_0x30b470['id']);return getEndUser(_0x504d4c,_0xd5c6d['calleridname'],_0xd5c6d[_0x770a('0x5d')],_0x3db7c1);})['then'](function(_0x1de9dc){_0x5f3884=_0x1de9dc;logger[_0x770a('0xf')](_0x770a('0x5e'),_0x5f3884['id']);return getTicket(_0x504d4c,_0x30b470,_0x5f3884,_0x44ab3f,_0xd5c6d,_0x44ab3f[_0x770a('0x5f')],_0x3db7c1,'Inbound');})[_0x770a('0x2e')](function(_0x48b34a){_0x55a318=_0x48b34a;logger[_0x770a('0xf')](_0x770a('0x60'));logger['info'](_0x770a('0x61'),_0x55a318['id']);return setRelationship(_0x3db7c1,_0x30b470,_0x55a318,_0x770a('0x62'));})[_0x770a('0x2e')](function(){return setRelationship(_0x3db7c1,_0x5f3884,_0x55a318,_0x770a('0x63'));})['then'](function(){return getServerInfo(_0x3db7c1);})[_0x770a('0x2e')](function(_0xefeeb5){var _0x3836f9=parseInt(_0xefeeb5[_0x770a('0x64')][_0x770a('0x65')](0x0));var _0x229cb0=util['format'](_0x770a('0x66'),_0x504d4c[_0x770a('0x54')],_0x55a318['id']);if(_0x3836f9>0x6){_0x229cb0=util['format'](_0x770a('0x67'),_0x504d4c[_0x770a('0x54')],_0x55a318['id']);}logger[_0x770a('0xf')](_0x770a('0x59'),_0x770a('0x68'));emit(util[_0x770a('0x28')](_0x770a('0x69'),_0x2ce3b9[_0x770a('0x11')]),'trigger:browser:url',{'uri':_0x229cb0});})['catch'](function(_0x2fbe46){logger[_0x770a('0x6a')](_0x770a('0x59'),JSON[_0x770a('0x26')](_0x2fbe46));});};exports[_0x770a('0x6b')]=function(_0x3e71d4,_0x1e7cec,_0x182dae,_0x1f8069,_0x42add4,_0x10ee72,_0x2c69fe){var _0x547809,_0x13fb80,_0x37d123,_0x360c77;_0x10ee72[_0x770a('0x54')]=intUtil[_0x770a('0x53')](_0x10ee72[_0x770a('0x54')]);_0x10ee72['serverUrl']=intUtil[_0x770a('0x53')](_0x10ee72[_0x770a('0x55')]);def[_0x770a('0x56')]=util[_0x770a('0x28')](_0x770a('0x57'),_0x10ee72[_0x770a('0x54')]);if(_0x2c69fe&&_0x2c69fe['recordingFormat']&&_0x2c69fe[_0x770a('0x6c')]!==_0x770a('0x6d')){logger[_0x770a('0xf')](_0x770a('0x6e'),_0x770a('0x6f'));_0x1e7cec[_0x770a('0x5a')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x10ee72[_0x770a('0x55')],_0x1e7cec[_0x770a('0x5c')],md5(_0x1e7cec['uniqueid']));}return getConnection(_0x10ee72)[_0x770a('0x2e')](function(_0x5e4e9e){_0x360c77=_0x5e4e9e;return getUser(_0x10ee72,_0x1f8069[_0x770a('0x11')],_0x360c77);})[_0x770a('0x2e')](function(_0x4321da){_0x547809=_0x4321da;logger[_0x770a('0xf')](_0x770a('0x70'),_0x547809['id']);return getEndUser(_0x10ee72,_0x1e7cec[_0x770a('0x71')],_0x1e7cec[_0x770a('0x72')],_0x360c77);})['then'](function(_0x570fe9){_0x13fb80=_0x570fe9;logger['info'](_0x770a('0x5e'),_0x13fb80['id']);return getTicket(_0x10ee72,_0x547809,_0x13fb80,_0x182dae,_0x1e7cec,_0x182dae[_0x770a('0x5f')],_0x360c77,'Outbound');})[_0x770a('0x2e')](function(_0xbe2791){_0x37d123=_0xbe2791;logger[_0x770a('0xf')](_0x770a('0x60'));logger[_0x770a('0xf')](_0x770a('0x61'),_0x37d123['id']);return setRelationship(_0x360c77,_0x547809,_0x37d123,'users');})[_0x770a('0x2e')](function(){return setRelationship(_0x360c77,_0x13fb80,_0x37d123,_0x770a('0x63'));})[_0x770a('0x2e')](function(){return getServerInfo(_0x360c77);})[_0x770a('0x2e')](function(_0x19999f){var _0x59b60e=parseInt(_0x19999f[_0x770a('0x64')][_0x770a('0x65')](0x0));var _0x3cee8e=util['format'](_0x770a('0x66'),_0x10ee72[_0x770a('0x54')],_0x37d123['id']);if(_0x59b60e>0x6){_0x3cee8e=util[_0x770a('0x28')](_0x770a('0x67'),_0x10ee72['remoteUri'],_0x37d123['id']);}logger['info'](_0x770a('0x6e'),_0x770a('0x68'));emit(util['format']('user:%s',_0x1f8069[_0x770a('0x11')]),_0x770a('0x73'),{'uri':_0x3cee8e});})[_0x770a('0x74')](function(_0x5c0c92){logger[_0x770a('0x6a')](_0x770a('0x6e'),JSON[_0x770a('0x26')](_0x5c0c92));});};exports[_0x770a('0x75')]=function(_0x1cf1ab,_0x327624,_0x390457,_0xd6d639,_0x3e4083,_0x36fa6e){var _0x529b26,_0x1d7e99,_0x522fe5,_0x3f5b5b;_0x36fa6e[_0x770a('0x54')]=intUtil[_0x770a('0x53')](_0x36fa6e[_0x770a('0x54')]);_0x36fa6e[_0x770a('0x55')]=intUtil[_0x770a('0x53')](_0x36fa6e[_0x770a('0x55')]);def[_0x770a('0x56')]=util[_0x770a('0x28')](_0x770a('0x57'),_0x36fa6e[_0x770a('0x54')]);if(_0x3e4083&&_0x3e4083[_0x770a('0x58')]){logger['info']('['+_0x327624[_0x770a('0x76')][_0x770a('0x77')]()+']',_0x770a('0x6f'));_0x327624['recordingURL']=util[_0x770a('0x28')](_0x770a('0x5b'),_0x36fa6e[_0x770a('0x55')],_0x327624[_0x770a('0x5c')],md5(_0x327624['uniqueid']));}else{_0x327624['recordingURL']='';}return getConnection(_0x36fa6e)['then'](function(_0x39c60f){_0x3f5b5b=_0x39c60f;if(!_['isNil'](_0xd6d639)){return getUser(_0x36fa6e,_0xd6d639[_0x770a('0x11')],_0x3f5b5b);}else{return getUser(_0x36fa6e,null,_0x3f5b5b);}})[_0x770a('0x2e')](function(_0x57c3f4){_0x529b26=_0x57c3f4;logger['info']('The\x20User\x20ID\x20is:',_0x529b26['id']);return getEndUser(_0x36fa6e,_0x327624[_0x770a('0x78')],_0x327624[_0x770a('0x5d')],_0x3f5b5b);})[_0x770a('0x2e')](function(_0x1b7e3f){_0x1d7e99=_0x1b7e3f;logger[_0x770a('0xf')](_0x770a('0x5e'),_0x1d7e99['id']);return getTicket(_0x36fa6e,_0x529b26,_0x1d7e99,_0x390457,_0x327624,_0x390457[_0x770a('0x5f')],_0x3f5b5b,_0x770a('0x79'));})[_0x770a('0x2e')](function(_0xa8f197){_0x522fe5=_0xa8f197;logger['info'](_0x770a('0x60'));logger[_0x770a('0xf')](_0x770a('0x61'),_0x522fe5['id']);return setRelationship(_0x3f5b5b,_0x529b26,_0x522fe5,_0x770a('0x62'));})[_0x770a('0x2e')](function(){return setRelationship(_0x3f5b5b,_0x1d7e99,_0x522fe5,_0x770a('0x63'));})[_0x770a('0x2e')](function(){return getServerInfo(_0x3f5b5b);})['catch'](function(_0x3bf91d){logger[_0x770a('0x6a')]('['+_0x327624['lastevent']['toUpperCase']()+']',JSON[_0x770a('0x26')](_0x3bf91d));});};
\ No newline at end of file
+var _0x5474=['getString','Subjects','created_by','description','date_start','toISOString','slice','replace','duration_minutes','parent_id','parent_type','Contacts','parent_name','direction','length','forEach','variableName','push','set_entry','JSON','stringify','format','Basic\x20%s','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','name_value_list','user_name','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','merge','type','nameField','customField','toLowerCase','string','idField','custom_fields','customVariable','Variable','login','username','password','PLAIN','Account\x20%d\x20is\x20not\x20valid','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','users','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','error','unmanaged','lastevent','calleridname','catch','toUpperCase','lodash','request-promise','md5','./util','../../../../config/environment','sugarcrm','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','name'];(function(_0x2ec4bf,_0x402cff){var _0x5b965f=function(_0x2c62d6){while(--_0x2c62d6){_0x2ec4bf['push'](_0x2ec4bf['shift']());}};_0x5b965f(++_0x402cff);}(_0x5474,0x1ce));var _0x4547=function(_0x59c4e0,_0x5c4520){_0x59c4e0=_0x59c4e0-0x0;var _0x418d9b=_0x5474[_0x59c4e0];return _0x418d9b;};'use strict';var _=require(_0x4547('0x0'));var rp=require(_0x4547('0x1'));var BPromise=require('bluebird');var md5=require(_0x4547('0x2'));var util=require('util');var Redis=require('ioredis');var intUtil=require(_0x4547('0x3'));var config=require(_0x4547('0x4'));var logger=require('../../../../config/logger')(_0x4547('0x5'));config[_0x4547('0x6')]=_[_0x4547('0x7')](config[_0x4547('0x6')],{'host':_0x4547('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4547('0x6')]));var def={'method':_0x4547('0x9'),'json':!![]};function emit(_0x26017a,_0x38e048,_0x3dfa3d){io['to'](_0x26017a)[_0x4547('0xa')](_0x38e048,_0x3dfa3d);}function getTicket(_0xddd869,_0x26816e,_0x19f9db,_0x4c06f9,_0x5daa91,_0x34dfbd,_0x1c4638,_0xe07bd2){logger[_0x4547('0xb')](_0x4547('0xc'));var _0x5a90d5=new Date();var _0x25f541=[{'name':_0x4547('0xd'),'value':intUtil[_0x4547('0xe')](_0x4c06f9[_0x4547('0xf')],_0x5daa91,'\x20')},{'name':'assigned_user_id','value':_0x26816e['id']},{'name':_0x4547('0x10'),'value':_0x26816e['id']},{'name':_0x4547('0x11'),'value':intUtil['getString'](_0x4c06f9['Descriptions'],_0x5daa91,'\x0a')},{'name':_0x4547('0x12'),'value':_0x5a90d5[_0x4547('0x13')]()[_0x4547('0x14')](0x0,0x13)[_0x4547('0x15')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x4547('0x16'),'value':'15'},{'name':_0x4547('0x17'),'value':_0x19f9db['id']},{'name':_0x4547('0x18'),'value':_0x4547('0x19')},{'name':_0x4547('0x1a'),'value':_0x19f9db['name']},{'name':_0x4547('0x1b'),'value':_0xe07bd2}];if(_0x34dfbd[_0x4547('0x1c')]){_[_0x4547('0x1d')](_0x34dfbd,function(_0x30d7be){if(_0x5daa91[_0x30d7be[_0x4547('0x1e')]]){_0x25f541[_0x4547('0x1f')]({'name':_0x30d7be['idField'],'value':_0x5daa91[_0x30d7be['variableName']]});}});}return request({'form':{'method':_0x4547('0x20'),'input_type':_0x4547('0x21'),'response_type':_0x4547('0x21'),'rest_data':JSON[_0x4547('0x22')]({'session':_0x1c4638['id'],'module_name':'Calls','name_value_list':_0x25f541})}});}function getAuth(_0xed3e32){return util[_0x4547('0x23')](_0x4547('0x24'),new Buffer(_0xed3e32[_0x4547('0x25')]+':X')[_0x4547('0x26')](_0x4547('0x27')));}function getServerInfo(_0x498576){return request({'form':{'method':_0x4547('0x28'),'input_type':_0x4547('0x21'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x498576['id']})}});}function getUser(_0x666f4a,_0x24485d,_0x12e3d){if(!_[_0x4547('0x29')](_0x24485d)){logger[_0x4547('0xb')](_0x4547('0x2a'),_0x24485d);return request({'form':{'method':_0x4547('0x2b'),'input_type':_0x4547('0x21'),'response_type':_0x4547('0x21'),'rest_data':JSON[_0x4547('0x22')]({'session':_0x12e3d['id'],'module_name':'Employees','query':util[_0x4547('0x23')](_0x4547('0x2c'),_0x24485d),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x4a753d){if(_0x4a753d['entry_list'][_0x4547('0x1c')]){var _0x220eb2=_['find'](_0x4a753d[_0x4547('0x2d')],function(_0x4c7603){return _0x4c7603[_0x4547('0x2e')][_0x4547('0x2f')][_0x4547('0x30')]===_0x24485d;});if(_0x220eb2){logger[_0x4547('0xb')]('Agent\x20found!');return BPromise[_0x4547('0x31')]({'id':_0x220eb2[_0x4547('0x2e')]['id']['value'],'name':_0x220eb2[_0x4547('0x2e')][_0x4547('0xd')][_0x4547('0x30')]});}}logger[_0x4547('0xb')](_0x4547('0x32'));return BPromise['resolve']({'id':_0x12e3d[_0x4547('0x2e')][_0x4547('0x33')][_0x4547('0x30')],'name':_0x12e3d[_0x4547('0x2e')][_0x4547('0x2f')][_0x4547('0x30')]});});}else{logger[_0x4547('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4547('0x31')]({'id':_0x12e3d[_0x4547('0x2e')][_0x4547('0x33')][_0x4547('0x30')],'name':_0x12e3d[_0x4547('0x2e')]['user_name'][_0x4547('0x30')]});}}function getEndUser(_0x29d313,_0x43e7e5,_0x3e03d5,_0x5f5c34){logger[_0x4547('0xb')](_0x4547('0x34'),_0x3e03d5);return request({'form':{'method':_0x4547('0x2b'),'input_type':'JSON','response_type':_0x4547('0x21'),'rest_data':JSON[_0x4547('0x22')]({'session':_0x5f5c34['id'],'module_name':_0x4547('0x19'),'query':util[_0x4547('0x23')](_0x4547('0x35'),_0x3e03d5),'order_by':'','offset':'0','select_fields':['id',_0x4547('0xd'),_0x4547('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4547('0x37')](function(_0x1eead0){if(_0x1eead0[_0x4547('0x2d')]['length']){var _0x16056a=_[_0x4547('0x38')](_0x1eead0[_0x4547('0x2d')],function(_0x51dff0){return _0x51dff0[_0x4547('0x2e')]['phone_home'][_0x4547('0x30')]===_0x3e03d5;});if(_0x16056a){logger[_0x4547('0xb')](_0x4547('0x39'));return BPromise[_0x4547('0x31')]({'id':_0x16056a[_0x4547('0x2e')]['id'][_0x4547('0x30')],'name':_0x16056a[_0x4547('0x2e')]['name'][_0x4547('0x30')],'phone':_0x16056a[_0x4547('0x2e')][_0x4547('0x36')][_0x4547('0x30')]});}}else{logger['info'](_0x4547('0x3a'));return request({'form':{'method':_0x4547('0x20'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x5f5c34['id'],'module_name':_0x4547('0x19'),'name_value_list':[{'name':_0x4547('0x3b'),'value':_0x43e7e5!=='<unknown>'?_0x43e7e5:util[_0x4547('0x23')]('Caller\x20-\x20%s',_0x3e03d5)},{'name':_0x4547('0x36'),'value':_0x3e03d5}]})}})[_0x4547('0x37')](function(_0x1ba81d){logger[_0x4547('0xb')](_0x4547('0x3c'));return BPromise[_0x4547('0x31')]({'id':_0x1ba81d['id'],'name':_0x1ba81d['entry_list'][_0x4547('0x3b')][_0x4547('0x30')],'phone':_0x1ba81d[_0x4547('0x2d')]['phone_home'][_0x4547('0x30')]});});}});}function request(_0x16dd17){logger[_0x4547('0x3d')](_0x4547('0x3e'),JSON[_0x4547('0x22')](_0x16dd17));return rp(_[_0x4547('0x3f')](def,_0x16dd17));}function getTags(_0x3ad3aa,_0x125bdf){var _0x53f523=[];if(_0x3ad3aa&&_0x3ad3aa[_0x4547('0x1c')]>0x0){_0x53f523=_['map'](_0x3ad3aa,_0x125bdf);}return _0x53f523;}function getCustomFields(_0x1d1eec,_0x2f5a2d){var _0x2e9e70=[];var _0x1b8f34={'custom_fields':[]};if(_0x1d1eec[_0x4547('0x1c')]>0x0){_[_0x4547('0x1d')](_0x1d1eec,function(_0x44598b){if(_0x44598b[_0x4547('0x40')]==='string'&&_0x44598b[_0x4547('0x41')]&&!_0x44598b[_0x4547('0x42')]){_0x1b8f34[_0x44598b[_0x4547('0x41')][_0x4547('0x43')]()]=_0x44598b['content'][_0x4547('0x26')]();}else if(_0x44598b['type']===_0x4547('0x44')&&_0x44598b[_0x4547('0x45')]&&_0x44598b['customField']){_0x1b8f34[_0x4547('0x46')][_0x4547('0x1f')]({'id':_0x44598b[_0x4547('0x45')],'value':_0x44598b['content'][_0x4547('0x26')]()});}else if(_0x44598b[_0x4547('0x40')]==='variable'&&_0x44598b['variableName']&&_0x44598b['idField']&&_0x44598b[_0x4547('0x42')]){_0x2f5a2d[_0x44598b[_0x4547('0x1e')]]&&_0x1b8f34[_0x4547('0x46')]['push']({'id':_0x44598b['idField'],'value':_0x2f5a2d[_0x44598b[_0x4547('0x1e')]]['toString']()});}else if(_0x44598b[_0x4547('0x40')]===_0x4547('0x47')&&_0x44598b[_0x4547('0x48')]&&_0x44598b[_0x4547('0x48')]['name']&&_0x44598b[_0x4547('0x45')]&&_0x44598b['customField']){_0x2f5a2d[_0x44598b[_0x4547('0x48')][_0x4547('0xd')][_0x4547('0x43')]()]&&_0x1b8f34[_0x4547('0x46')]['push']({'id':_0x44598b[_0x4547('0x45')],'value':_0x2f5a2d[_0x44598b[_0x4547('0x48')][_0x4547('0xd')]['toLowerCase']()][_0x4547('0x26')]()});}});}return _0x1b8f34;}function getConnection(_0x18a0ce){return request({'method':_0x4547('0x9'),'form':{'method':_0x4547('0x49'),'input_type':_0x4547('0x21'),'response_type':_0x4547('0x21'),'rest_data':JSON[_0x4547('0x22')]({'user_auth':{'user_name':_0x18a0ce[_0x4547('0x4a')],'password':_0x18a0ce[_0x4547('0x4b')],'encryption':_0x4547('0x4c')},'application':'xCALLY\x20Motion\x20integration'})}})['then'](function(_0x5d33c4){var _0x42a689=_0x5d33c4;if(_0x42a689['id']){def['sessionID']=_0x42a689['id'];return BPromise[_0x4547('0x31')](_0x42a689);}else{throw new Error(util['format'](_0x4547('0x4d'),_0x18a0ce['id']));}});}function setRelationship(_0x3fa950,_0x1cdd26,_0x487a0d,_0x36e297){return request({'form':{'method':_0x4547('0x4e'),'input_type':'JSON','response_type':_0x4547('0x21'),'rest_data':JSON['stringify']({'session':_0x3fa950['id'],'module_name':_0x4547('0x4f'),'module_id':_0x487a0d['id'],'link_field_name':_0x36e297,'related_ids':[_0x1cdd26['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4547('0x50')]=function(_0xc51d62,_0x9fd303,_0x2eac63,_0x5be536,_0x1a10af,_0x422e9e){var _0x56d244,_0x4b5e23,_0x11baa3,_0x169b3c;_0x422e9e[_0x4547('0x51')]=intUtil['stripTrailingSlash'](_0x422e9e['remoteUri']);_0x422e9e['serverUrl']=intUtil[_0x4547('0x52')](_0x422e9e[_0x4547('0x53')]);def[_0x4547('0x54')]=util['format'](_0x4547('0x55'),_0x422e9e[_0x4547('0x51')]);if(_0x1a10af&&_0x1a10af[_0x4547('0x56')]){logger['info'](_0x4547('0x57'),_0x4547('0x58'));_0x9fd303[_0x4547('0x59')]=util[_0x4547('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x422e9e[_0x4547('0x53')],_0x9fd303[_0x4547('0x5a')],md5(_0x9fd303[_0x4547('0x5a')]));}else{_0x9fd303[_0x4547('0x59')]='';}return getConnection(_0x422e9e)[_0x4547('0x37')](function(_0x277704){_0x169b3c=_0x277704;return getUser(_0x422e9e,_0x5be536[_0x4547('0xd')],_0x169b3c);})['then'](function(_0x4b0f1c){_0x56d244=_0x4b0f1c;logger[_0x4547('0xb')](_0x4547('0x5b'),_0x56d244['id']);return getEndUser(_0x422e9e,_0x9fd303['calleridname'],_0x9fd303[_0x4547('0x5c')],_0x169b3c);})[_0x4547('0x37')](function(_0x50857f){_0x4b5e23=_0x50857f;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4b5e23['id']);return getTicket(_0x422e9e,_0x56d244,_0x4b5e23,_0x2eac63,_0x9fd303,_0x2eac63[_0x4547('0x5d')],_0x169b3c,_0x4547('0x5e'));})[_0x4547('0x37')](function(_0x27d76d){_0x11baa3=_0x27d76d;logger[_0x4547('0xb')](_0x4547('0x5f'));logger['info'](_0x4547('0x60'),_0x11baa3['id']);return setRelationship(_0x169b3c,_0x56d244,_0x11baa3,'users');})['then'](function(){return setRelationship(_0x169b3c,_0x4b5e23,_0x11baa3,_0x4547('0x61'));})[_0x4547('0x37')](function(){return getServerInfo(_0x169b3c);})[_0x4547('0x37')](function(_0x3b41bb){var _0x40b7c5=parseInt(_0x3b41bb[_0x4547('0x62')][_0x4547('0x63')](0x0));var _0x15b031=util[_0x4547('0x23')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x422e9e[_0x4547('0x51')],_0x11baa3['id']);if(_0x40b7c5>0x6){_0x15b031=util[_0x4547('0x23')](_0x4547('0x64'),_0x422e9e[_0x4547('0x51')],_0x11baa3['id']);}logger[_0x4547('0xb')](_0x4547('0x57'),_0x4547('0x65'));emit(util[_0x4547('0x23')]('user:%s',_0x5be536[_0x4547('0xd')]),_0x4547('0x66'),{'uri':_0x15b031});})['catch'](function(_0xac3f2e){logger['error']('[QUEUE]',JSON['stringify'](_0xac3f2e));});};exports[_0x4547('0x67')]=function(_0x5e04c0,_0x1c44a5,_0x5d38d6,_0x4f17a3,_0x2907db,_0x20eea0,_0x207807){var _0x5ad2e8,_0x58c4ec,_0x5ab21f,_0x1731bb;_0x20eea0[_0x4547('0x51')]=intUtil['stripTrailingSlash'](_0x20eea0[_0x4547('0x51')]);_0x20eea0[_0x4547('0x53')]=intUtil[_0x4547('0x52')](_0x20eea0[_0x4547('0x53')]);def[_0x4547('0x54')]=util['format'](_0x4547('0x55'),_0x20eea0[_0x4547('0x51')]);if(_0x207807&&_0x207807[_0x4547('0x68')]&&_0x207807['recordingFormat']!==_0x4547('0x69')){logger['info'](_0x4547('0x6a'),_0x4547('0x58'));_0x1c44a5[_0x4547('0x59')]=util[_0x4547('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x20eea0[_0x4547('0x53')],_0x1c44a5['uniqueid'],md5(_0x1c44a5[_0x4547('0x5a')]));}return getConnection(_0x20eea0)[_0x4547('0x37')](function(_0x194a09){_0x1731bb=_0x194a09;return getUser(_0x20eea0,_0x4f17a3[_0x4547('0xd')],_0x1731bb);})['then'](function(_0xd5e9d0){_0x5ad2e8=_0xd5e9d0;logger[_0x4547('0xb')](_0x4547('0x5b'),_0x5ad2e8['id']);return getEndUser(_0x20eea0,_0x1c44a5[_0x4547('0x6b')],_0x1c44a5[_0x4547('0x6c')],_0x1731bb);})[_0x4547('0x37')](function(_0x3fb407){_0x58c4ec=_0x3fb407;logger[_0x4547('0xb')](_0x4547('0x6d'),_0x58c4ec['id']);return getTicket(_0x20eea0,_0x5ad2e8,_0x58c4ec,_0x5d38d6,_0x1c44a5,_0x5d38d6[_0x4547('0x5d')],_0x1731bb,'Outbound');})[_0x4547('0x37')](function(_0x3551d0){_0x5ab21f=_0x3551d0;logger[_0x4547('0xb')](_0x4547('0x5f'));logger['info'](_0x4547('0x60'),_0x5ab21f['id']);return setRelationship(_0x1731bb,_0x5ad2e8,_0x5ab21f,_0x4547('0x6e'));})[_0x4547('0x37')](function(){return setRelationship(_0x1731bb,_0x58c4ec,_0x5ab21f,_0x4547('0x61'));})['then'](function(){return getServerInfo(_0x1731bb);})[_0x4547('0x37')](function(_0xbb4b31){var _0x509123=parseInt(_0xbb4b31['version'][_0x4547('0x63')](0x0));var _0x54c130=util[_0x4547('0x23')](_0x4547('0x6f'),_0x20eea0['remoteUri'],_0x5ab21f['id']);if(_0x509123>0x6){_0x54c130=util[_0x4547('0x23')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x20eea0[_0x4547('0x51')],_0x5ab21f['id']);}logger['info'](_0x4547('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x4547('0x70'),_0x4f17a3[_0x4547('0xd')]),_0x4547('0x66'),{'uri':_0x54c130});})['catch'](function(_0x5e5c4b){logger[_0x4547('0x71')](_0x4547('0x6a'),JSON[_0x4547('0x22')](_0x5e5c4b));});};exports[_0x4547('0x72')]=function(_0x3bdbae,_0x10835c,_0xa45abf,_0x4eb2c4,_0x458097,_0x42fcd1){var _0x4f7fee,_0x8124bb,_0x5b176e,_0x1ca8af;_0x42fcd1[_0x4547('0x51')]=intUtil[_0x4547('0x52')](_0x42fcd1[_0x4547('0x51')]);_0x42fcd1[_0x4547('0x53')]=intUtil[_0x4547('0x52')](_0x42fcd1[_0x4547('0x53')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x42fcd1[_0x4547('0x51')]);if(_0x458097&&_0x458097[_0x4547('0x56')]){logger[_0x4547('0xb')]('['+_0x10835c[_0x4547('0x73')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x10835c[_0x4547('0x59')]=util[_0x4547('0x23')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x42fcd1['serverUrl'],_0x10835c[_0x4547('0x5a')],md5(_0x10835c['uniqueid']));}else{_0x10835c['recordingURL']='';}return getConnection(_0x42fcd1)[_0x4547('0x37')](function(_0x2a9449){_0x1ca8af=_0x2a9449;if(!_['isNil'](_0x4eb2c4)){return getUser(_0x42fcd1,_0x4eb2c4['name'],_0x1ca8af);}else{return getUser(_0x42fcd1,null,_0x1ca8af);}})[_0x4547('0x37')](function(_0xc24c56){_0x4f7fee=_0xc24c56;logger['info'](_0x4547('0x5b'),_0x4f7fee['id']);return getEndUser(_0x42fcd1,_0x10835c[_0x4547('0x74')],_0x10835c[_0x4547('0x5c')],_0x1ca8af);})[_0x4547('0x37')](function(_0x203879){_0x8124bb=_0x203879;logger[_0x4547('0xb')](_0x4547('0x6d'),_0x8124bb['id']);return getTicket(_0x42fcd1,_0x4f7fee,_0x8124bb,_0xa45abf,_0x10835c,_0xa45abf[_0x4547('0x5d')],_0x1ca8af,_0x4547('0x5e'));})[_0x4547('0x37')](function(_0x1283d1){_0x5b176e=_0x1283d1;logger[_0x4547('0xb')](_0x4547('0x5f'));logger[_0x4547('0xb')](_0x4547('0x60'),_0x5b176e['id']);return setRelationship(_0x1ca8af,_0x4f7fee,_0x5b176e,_0x4547('0x6e'));})['then'](function(){return setRelationship(_0x1ca8af,_0x8124bb,_0x5b176e,_0x4547('0x61'));})[_0x4547('0x37')](function(){return getServerInfo(_0x1ca8af);})[_0x4547('0x75')](function(_0x5578b2){logger[_0x4547('0x71')]('['+_0x10835c['lastevent'][_0x4547('0x76')]()+']',JSON[_0x4547('0x22')](_0x5578b2));});};
\ No newline at end of file
index 8a095dc..74acd0c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3137=['type','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','variable','format','join','stripTrailingSlash','substring','validateEmail','isNil','getString','length','sortBy'];(function(_0x52c8e8,_0x5ee20d){var _0x31bb1a=function(_0x47233a){while(--_0x47233a){_0x52c8e8['push'](_0x52c8e8['shift']());}};_0x31bb1a(++_0x5ee20d);}(_0x3137,0x1dd));var _0x7313=function(_0x4e7f89,_0x128d45){_0x4e7f89=_0x4e7f89-0x0;var _0x512524=_0x3137[_0x4e7f89];return _0x512524;};'use strict';var _=require('lodash');var util=require('util');exports[_0x7313('0x0')]=function(_0x57e5ca,_0x27a1b0,_0x453c24){var _0x7a8793=[];if(_0x57e5ca[_0x7313('0x1')]>0x0){var _0x474fda=_[_0x7313('0x2')](_0x57e5ca,['id']);for(var _0x4fcc26=0x0;_0x4fcc26<_0x474fda[_0x7313('0x1')];_0x4fcc26++){var _0x47f803=_0x474fda[_0x4fcc26];if(_0x47f803[_0x7313('0x3')]==='string'){_0x7a8793[_0x7313('0x4')](_0x47f803[_0x7313('0x5')]);}else if(_0x47f803[_0x7313('0x3')]==='variable'&&_0x47f803[_0x7313('0x6')]){_0x27a1b0[_0x47f803[_0x7313('0x6')]]&&_0x7a8793[_0x7313('0x4')](_0x27a1b0[_0x47f803[_0x7313('0x6')]][_0x7313('0x7')]());}else if(_0x47f803[_0x7313('0x3')]===_0x7313('0x8')&&_0x47f803['Variable']&&_0x47f803[_0x7313('0x9')][_0x7313('0xa')]){_0x27a1b0[_0x47f803[_0x7313('0x9')]['name'][_0x7313('0xb')]()]&&_0x7a8793[_0x7313('0x4')](_0x27a1b0[_0x47f803[_0x7313('0x9')]['name']['toLowerCase']()][_0x7313('0x7')]());}else if(_0x47f803[_0x7313('0x3')]===_0x7313('0xc')){if(_0x47f803[_0x7313('0xd')]==='string'&&_0x47f803[_0x7313('0xe')]){_0x7a8793[_0x7313('0x4')](util['format'](_0x7313('0xf'),_0x47f803['key'],_0x47f803[_0x7313('0x10')]));}else if(_0x47f803[_0x7313('0xd')]===_0x7313('0x11')&&_0x47f803[_0x7313('0x6')]&&_0x47f803[_0x7313('0xe')]){_0x27a1b0[_0x47f803['variableName']]&&_0x7a8793['push'](util[_0x7313('0x12')](_0x7313('0xf'),_0x47f803['key'],_0x27a1b0[_0x47f803[_0x7313('0x6')]]));}else if(_0x47f803[_0x7313('0xd')]===_0x7313('0x8')&&_0x47f803[_0x7313('0x9')]&&_0x47f803[_0x7313('0x9')][_0x7313('0xa')]&&_0x47f803[_0x7313('0xe')]){_0x27a1b0[_0x47f803[_0x7313('0x9')][_0x7313('0xa')]['toLowerCase']()]&&_0x7a8793[_0x7313('0x4')](util[_0x7313('0x12')](_0x7313('0xf'),_0x47f803[_0x7313('0xe')],_0x27a1b0[_0x47f803[_0x7313('0x9')][_0x7313('0xa')]['toLowerCase']()]));}}}}return _0x7a8793[_0x7313('0x13')](_0x453c24);};exports[_0x7313('0x14')]=function(_0xafb335){var _0x5b52a0=_0xafb335['slice'](-0x1);if(_0x5b52a0==='/'){_0xafb335=_0xafb335[_0x7313('0x15')](0x0,_0xafb335['lastIndexOf'](_0x5b52a0));}return _0xafb335;};exports[_0x7313('0x16')]=function(_0x55a5e9){if(!_[_0x7313('0x17')](_0x55a5e9)&&_0x55a5e9!==''){var _0x4e38ee=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x4e38ee['test'](String(_0x55a5e9)['toLowerCase']());}else{return![];}};
\ No newline at end of file
+var _0x3e0f=['join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','test','lodash','util','getString','sortBy','length','type','string','push','content','variableName','toString','customVariable','Variable','name','toLowerCase','keyType','key','format','%s:\x20%s','keyContent','variable'];(function(_0x3c150f,_0x5c6752){var _0xd5e88e=function(_0x23b91f){while(--_0x23b91f){_0x3c150f['push'](_0x3c150f['shift']());}};_0xd5e88e(++_0x5c6752);}(_0x3e0f,0x93));var _0xf3e0=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x3e0f[_0x34843e];return _0x598f7f;};'use strict';var _=require(_0xf3e0('0x0'));var util=require(_0xf3e0('0x1'));exports[_0xf3e0('0x2')]=function(_0x4df860,_0x2e6448,_0x62afcc){var _0x1ac1e1=[];if(_0x4df860['length']>0x0){var _0x28cd61=_[_0xf3e0('0x3')](_0x4df860,['id']);for(var _0x2fdc33=0x0;_0x2fdc33<_0x28cd61[_0xf3e0('0x4')];_0x2fdc33++){var _0x18d71f=_0x28cd61[_0x2fdc33];if(_0x18d71f[_0xf3e0('0x5')]===_0xf3e0('0x6')){_0x1ac1e1[_0xf3e0('0x7')](_0x18d71f[_0xf3e0('0x8')]);}else if(_0x18d71f[_0xf3e0('0x5')]==='variable'&&_0x18d71f[_0xf3e0('0x9')]){_0x2e6448[_0x18d71f[_0xf3e0('0x9')]]&&_0x1ac1e1[_0xf3e0('0x7')](_0x2e6448[_0x18d71f[_0xf3e0('0x9')]][_0xf3e0('0xa')]());}else if(_0x18d71f['type']===_0xf3e0('0xb')&&_0x18d71f[_0xf3e0('0xc')]&&_0x18d71f[_0xf3e0('0xc')][_0xf3e0('0xd')]){_0x2e6448[_0x18d71f[_0xf3e0('0xc')][_0xf3e0('0xd')][_0xf3e0('0xe')]()]&&_0x1ac1e1[_0xf3e0('0x7')](_0x2e6448[_0x18d71f['Variable'][_0xf3e0('0xd')]['toLowerCase']()][_0xf3e0('0xa')]());}else if(_0x18d71f[_0xf3e0('0x5')]==='keyValue'){if(_0x18d71f[_0xf3e0('0xf')]===_0xf3e0('0x6')&&_0x18d71f[_0xf3e0('0x10')]){_0x1ac1e1['push'](util[_0xf3e0('0x11')](_0xf3e0('0x12'),_0x18d71f[_0xf3e0('0x10')],_0x18d71f[_0xf3e0('0x13')]));}else if(_0x18d71f[_0xf3e0('0xf')]===_0xf3e0('0x14')&&_0x18d71f['variableName']&&_0x18d71f['key']){_0x2e6448[_0x18d71f[_0xf3e0('0x9')]]&&_0x1ac1e1[_0xf3e0('0x7')](util['format'](_0xf3e0('0x12'),_0x18d71f[_0xf3e0('0x10')],_0x2e6448[_0x18d71f[_0xf3e0('0x9')]]));}else if(_0x18d71f[_0xf3e0('0xf')]===_0xf3e0('0xb')&&_0x18d71f[_0xf3e0('0xc')]&&_0x18d71f[_0xf3e0('0xc')][_0xf3e0('0xd')]&&_0x18d71f['key']){_0x2e6448[_0x18d71f[_0xf3e0('0xc')][_0xf3e0('0xd')][_0xf3e0('0xe')]()]&&_0x1ac1e1[_0xf3e0('0x7')](util[_0xf3e0('0x11')](_0xf3e0('0x12'),_0x18d71f['key'],_0x2e6448[_0x18d71f['Variable']['name']['toLowerCase']()]));}}}}return _0x1ac1e1[_0xf3e0('0x15')](_0x62afcc);};exports[_0xf3e0('0x16')]=function(_0x14a792){var _0x3e7c07=_0x14a792[_0xf3e0('0x17')](-0x1);if(_0x3e7c07==='/'){_0x14a792=_0x14a792[_0xf3e0('0x18')](0x0,_0x14a792[_0xf3e0('0x19')](_0x3e7c07));}return _0x14a792;};exports[_0xf3e0('0x1a')]=function(_0x5b3ea0){if(!_['isNil'](_0x5b3ea0)&&_0x5b3ea0!==''){var _0x5bcdf0=/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return _0x5bcdf0[_0xf3e0('0x1b')](String(_0x5b3ea0)['toLowerCase']());}else{return![];}};
\ No newline at end of file
index e1cb735..6308dc8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x37c59d,_0x451a9b){var _0x5abe2e=function(_0x564728){while(--_0x564728){_0x37c59d['push'](_0x37c59d['shift']());}};_0x5abe2e(++_0x451a9b);}(_0xe706,0xa3));var _0x6e70=function(_0x3cf5c7,_0x1eb319){_0x3cf5c7=_0x3cf5c7-0x0;var _0xf3d981=_0xe706[_0x3cf5c7];return _0xf3d981;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});};
\ No newline at end of file
+var _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x49b6a3,_0x24d972){var _0x472e10=function(_0x3ce211){while(--_0x3ce211){_0x49b6a3['push'](_0x49b6a3['shift']());}};_0x472e10(++_0x24d972);}(_0x34e8,0x12c));var _0x834e=function(_0x5bc4fc,_0x2c8df3){_0x5bc4fc=_0x5bc4fc-0x0;var _0x5b0868=_0x34e8[_0x5bc4fc];return _0x5b0868;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});};
\ No newline at end of file
index 4fda30e..61c84a2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d03=['Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','type:user\x20role:end-user\x20phone:%s','results','length','filter','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Caller\x20-\x20%s','authType','%s:%s','token','toString','base64','debug','[HTTP]','GET','map','string','picklist','type','nameField','customField','toLowerCase','content','idField','custom_fields','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','toUpperCase','calleridnum','lastevent','lodash','request-promise','md5','util','./util','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','getString','Descriptions','ticket','format','%s/search.json','then','count'];(function(_0x9bcc0b,_0x120f6c){var _0x195399=function(_0x5be8b9){while(--_0x5be8b9){_0x9bcc0b['push'](_0x9bcc0b['shift']());}};_0x195399(++_0x120f6c);}(_0x8d03,0x186));var _0x38d0=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8d03[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x38d0('0x0'));var rp=require(_0x38d0('0x1'));var md5=require(_0x38d0('0x2'));var util=require(_0x38d0('0x3'));var Redis=require('ioredis');var intUtil=require(_0x38d0('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x38d0('0x5'));config[_0x38d0('0x6')]=_[_0x38d0('0x7')](config[_0x38d0('0x6')],{'host':_0x38d0('0x8'),'port':0x18eb});var io=require(_0x38d0('0x9'))(new Redis(config[_0x38d0('0x6')]));function emit(_0x16b30e,_0x34ab2d,_0x50f381){io['to'](_0x16b30e)[_0x38d0('0xa')](_0x34ab2d,_0x50f381);}var headers={'Content-Type':'application/json','Accept':_0x38d0('0xb')};function getTicket(_0x184225,_0x1932e2,_0x26eca1,_0x3eb0fe,_0x42ad5e){logger[_0x38d0('0xc')](_0x38d0('0xd'));return request({'uri':util['format'](_0x38d0('0xe'),_0x184225[_0x38d0('0xf')]),'method':_0x38d0('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x26eca1['id'],'submitter_id':_0x1932e2?_0x1932e2['id']:undefined,'assignee_id':_0x1932e2?_0x1932e2['id']:undefined,'tags':getTags(_0x3eb0fe[_0x38d0('0x11')],_0x38d0('0x12')),'subject':intUtil[_0x38d0('0x13')](_0x3eb0fe['Subjects'],_0x42ad5e,'\x20'),'description':intUtil[_0x38d0('0x13')](_0x3eb0fe[_0x38d0('0x14')],_0x42ad5e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x38d0('0x13')](_0x3eb0fe[_0x38d0('0x14')],_0x42ad5e,'\x0a')}},getCustomFields(_0x3eb0fe['Fields'],_0x42ad5e))}})['then'](function(_0x518cb7){logger[_0x38d0('0xc')]('Ticket\x20created!');return _0x518cb7[_0x38d0('0x15')];});}function getUser(_0x56a1ef,_0x21e024){if(intUtil['validateEmail'](_0x21e024)){logger[_0x38d0('0xc')]('Getting\x20agent\x20with\x20email',_0x21e024);return request({'uri':util[_0x38d0('0x16')](_0x38d0('0x17'),_0x56a1ef[_0x38d0('0xf')]),'qs':{'query':util[_0x38d0('0x16')]('type:user\x20role:agent\x20email:%s',_0x21e024)}})[_0x38d0('0x18')](function(_0x5c10b2){if(_0x5c10b2[_0x38d0('0x19')]){logger[_0x38d0('0xc')](_0x38d0('0x1a'));return _[_0x38d0('0x1b')](_0x5c10b2['results'],{'email':_0x21e024,'role':_0x38d0('0x1c')});}else{logger['info'](_0x38d0('0x1d'));return request({'uri':util[_0x38d0('0x16')](_0x38d0('0x1e'),_0x56a1ef[_0x38d0('0xf')])})[_0x38d0('0x18')](function(_0x12e32d){logger[_0x38d0('0xc')](_0x38d0('0x1f'));return _0x12e32d[_0x38d0('0x20')];});}});}else{logger['info'](_0x38d0('0x1d'));return request({'uri':util[_0x38d0('0x16')](_0x38d0('0x1e'),_0x56a1ef[_0x38d0('0xf')])})[_0x38d0('0x18')](function(_0x2218d6){logger['info'](_0x38d0('0x1f'));return _0x2218d6[_0x38d0('0x20')];});}}function getEndUser(_0x1ba27b,_0xe30ac7,_0x57e730){logger[_0x38d0('0xc')]('Searching\x20enduser\x20with\x20phone',_0x57e730);return request({'uri':util[_0x38d0('0x16')](_0x38d0('0x17'),_0x1ba27b[_0x38d0('0xf')]),'qs':{'query':util[_0x38d0('0x16')](_0x38d0('0x21'),_0x57e730)}})['then'](function(_0x2d7081){var _0x1a9e52;if(_0x2d7081[_0x38d0('0x22')][_0x38d0('0x23')]){_0x2d7081['results']=_[_0x38d0('0x24')](_0x2d7081[_0x38d0('0x22')],{'suspended':![],'role':'end-user'});if(_0x2d7081['results'][_0x38d0('0x23')]){_0x1a9e52=_[_0x38d0('0x25')](_0x2d7081[_0x38d0('0x22')]);}}if(_0x1a9e52){logger[_0x38d0('0xc')]('Enduser\x20found!');return _0x1a9e52;}else{logger[_0x38d0('0xc')](_0x38d0('0x26'));return request({'uri':util['format'](_0x38d0('0x27'),_0x1ba27b['remoteUri']),'method':_0x38d0('0x10'),'body':{'user':{'role':_0x38d0('0x28'),'name':util['format'](_0x38d0('0x29'),_0xe30ac7||_0x57e730),'phone':_0x57e730}}})['then'](function(_0x3ef0bf){logger[_0x38d0('0xc')]('Enduser\x20created.');return _0x3ef0bf['user'];});}});}function getAuth(_0x4ca501){var _0x33ee56;if(_0x4ca501[_0x38d0('0x2a')]==='password'){_0x33ee56=util[_0x38d0('0x16')](_0x38d0('0x2b'),_0x4ca501['username'],_0x4ca501['password']);}else if(_0x4ca501['authType']===_0x38d0('0x2c')){_0x33ee56=util['format']('%s/token:%s',_0x4ca501['username'],_0x4ca501[_0x38d0('0x2c')]);}return util[_0x38d0('0x16')]('Basic\x20%s',new Buffer(_0x33ee56)[_0x38d0('0x2d')](_0x38d0('0x2e')));}function request(_0x28cb22){logger[_0x38d0('0x2f')](_0x38d0('0x30'),JSON['stringify'](_0x28cb22));return rp(_[_0x38d0('0x7')](_0x28cb22,{'method':_0x38d0('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x31e3e9,_0x35f16d){var _0x3fa77e=[];if(_0x31e3e9&&_0x31e3e9['length']>0x0){_0x3fa77e=_[_0x38d0('0x32')](_0x31e3e9,_0x35f16d);}return _0x3fa77e;}function getCustomFields(_0x19d5dd,_0x53294d){var _0x4b3572=[];var _0x1bac2e={'custom_fields':[]};if(_0x19d5dd[_0x38d0('0x23')]>0x0){_['forEach'](_0x19d5dd,function(_0x26cd81){if(_['includes']([_0x38d0('0x33'),_0x38d0('0x34')],_0x26cd81[_0x38d0('0x35')])&&_0x26cd81[_0x38d0('0x36')]&&!_0x26cd81[_0x38d0('0x37')]){_0x1bac2e[_0x26cd81['nameField'][_0x38d0('0x38')]()]=_0x26cd81[_0x38d0('0x39')][_0x38d0('0x2d')]();}else if(_['includes']([_0x38d0('0x33'),_0x38d0('0x34')],_0x26cd81[_0x38d0('0x35')])&&_0x26cd81[_0x38d0('0x3a')]&&_0x26cd81[_0x38d0('0x37')]){_0x1bac2e[_0x38d0('0x3b')]['push']({'id':_0x26cd81[_0x38d0('0x3a')],'value':_0x26cd81[_0x38d0('0x39')]['toString']()});}else if(_0x26cd81[_0x38d0('0x35')]===_0x38d0('0x3c')&&_0x26cd81[_0x38d0('0x3d')]&&_0x26cd81[_0x38d0('0x3a')]&&_0x26cd81[_0x38d0('0x37')]){_0x53294d[_0x26cd81[_0x38d0('0x3d')]]&&_0x1bac2e['custom_fields'][_0x38d0('0x3e')]({'id':_0x26cd81['idField'],'value':_0x53294d[_0x26cd81[_0x38d0('0x3d')]][_0x38d0('0x2d')]()});}else if(_0x26cd81[_0x38d0('0x35')]===_0x38d0('0x3f')&&_0x26cd81[_0x38d0('0x40')]&&_0x26cd81[_0x38d0('0x40')]['name']&&_0x26cd81[_0x38d0('0x3a')]&&_0x26cd81[_0x38d0('0x37')]){_0x53294d[_0x26cd81['Variable'][_0x38d0('0x12')][_0x38d0('0x38')]()]&&_0x1bac2e[_0x38d0('0x3b')][_0x38d0('0x3e')]({'id':_0x26cd81[_0x38d0('0x3a')],'value':_0x53294d[_0x26cd81[_0x38d0('0x40')][_0x38d0('0x12')][_0x38d0('0x38')]()][_0x38d0('0x2d')]()});}});}return _0x1bac2e;}exports[_0x38d0('0x41')]=function(_0x21fe3b,_0x3f8907,_0x9978e6,_0x1b8c7c,_0x466643,_0x538c56){var _0x62047f,_0x22204c;_0x538c56[_0x38d0('0xf')]=intUtil[_0x38d0('0x42')](_0x538c56[_0x38d0('0xf')]);_0x538c56[_0x38d0('0x43')]=intUtil['stripTrailingSlash'](_0x538c56[_0x38d0('0x43')]);if(_0x466643&&_0x466643[_0x38d0('0x44')]){logger['info'](_0x38d0('0x45'),_0x38d0('0x46'));_0x3f8907[_0x38d0('0x47')]=util[_0x38d0('0x16')](_0x38d0('0x48'),_0x538c56[_0x38d0('0x43')],_0x3f8907['uniqueid'],md5(_0x3f8907[_0x38d0('0x49')]));}else{_0x3f8907[_0x38d0('0x47')]='';}headers[_0x38d0('0x4a')]=getAuth(_0x538c56);return getUser(_0x538c56,_0x1b8c7c[_0x38d0('0x4b')])[_0x38d0('0x18')](function(_0x5ab64a){_0x62047f=_0x5ab64a;logger[_0x38d0('0xc')](_0x38d0('0x4c'),_0x62047f['id']);return getEndUser(_0x538c56,_0x3f8907[_0x38d0('0x4d')],_0x3f8907['calleridnum']);})[_0x38d0('0x18')](function(_0x43b386){_0x22204c=_0x43b386;logger['info'](_0x38d0('0x4e'),_0x22204c['id']);return getTicket(_0x538c56,_0x62047f,_0x22204c,_0x9978e6,_0x3f8907);})['then'](function(_0x1a94c5){if(_0x1a94c5){logger[_0x38d0('0xc')](_0x38d0('0x4f'),_0x1a94c5['id']);switch(_0x538c56['type']){case _0x38d0('0x50'):logger[_0x38d0('0xc')]('[QUEUE]',_0x38d0('0x51'));return request({'uri':util[_0x38d0('0x16')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x538c56[_0x38d0('0xf')],_0x62047f['id'],_0x1a94c5['id']),'method':'POST'});case _0x38d0('0x52'):logger[_0x38d0('0xc')](_0x38d0('0x45'),_0x38d0('0x53'));emit(util[_0x38d0('0x16')](_0x38d0('0x54'),_0x1b8c7c[_0x38d0('0x12')]),_0x38d0('0x55'),{'uri':util[_0x38d0('0x16')](_0x38d0('0x56'),_0x538c56[_0x38d0('0xf')][_0x38d0('0x57')]('/api/v2',''),_0x1a94c5['id'])});break;default:logger[_0x38d0('0x58')](_0x38d0('0x45'),_0x38d0('0x59'));}}})[_0x38d0('0x5a')](function(_0x9dacb4){logger[_0x38d0('0x58')](_0x38d0('0x5b'),util[_0x38d0('0x5c')](_0x9dacb4,{'showHidden':!![],'depth':null}));});};exports[_0x38d0('0x5d')]=function(_0x3508cc,_0x4b5478,_0x3c9f69,_0xfae466,_0xde0c24,_0x130d99,_0x3eb3c7){var _0x5b2d3f,_0x487723;_0x130d99[_0x38d0('0xf')]=intUtil[_0x38d0('0x42')](_0x130d99[_0x38d0('0xf')]);_0x130d99[_0x38d0('0x43')]=intUtil['stripTrailingSlash'](_0x130d99[_0x38d0('0x43')]);if(_0x3eb3c7&&_0x3eb3c7[_0x38d0('0x5e')]&&_0x3eb3c7[_0x38d0('0x5e')]!==_0x38d0('0x5f')){logger[_0x38d0('0xc')](_0x38d0('0x60'),'Recording\x20is\x20enabled!');_0x4b5478[_0x38d0('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x130d99[_0x38d0('0x43')],_0x4b5478[_0x38d0('0x49')],md5(_0x4b5478[_0x38d0('0x49')]));}headers[_0x38d0('0x4a')]=getAuth(_0x130d99);return getUser(_0x130d99,_0xfae466['email'])['then'](function(_0x552b57){_0x5b2d3f=_0x552b57;logger[_0x38d0('0xc')](_0x38d0('0x4c'),_0x5b2d3f['id']);return getEndUser(_0x130d99,_0x4b5478[_0x38d0('0x61')],_0x4b5478[_0x38d0('0x62')]);})['then'](function(_0x61cc36){_0x487723=_0x61cc36;logger[_0x38d0('0xc')](_0x38d0('0x4e'),_0x487723['id']);return getTicket(_0x130d99,_0x5b2d3f,_0x487723,_0x3c9f69,_0x4b5478);})['then'](function(_0x177f39){if(_0x177f39){logger[_0x38d0('0xc')](_0x38d0('0x4f'),_0x177f39['id']);switch(_0x130d99['type']){case'integrationTab':logger[_0x38d0('0xc')]('[OUTBOUND]',_0x38d0('0x51'));return request({'uri':util['format'](_0x38d0('0x63'),_0x130d99[_0x38d0('0xf')],_0x5b2d3f['id'],_0x177f39['id']),'method':'POST'});case _0x38d0('0x52'):logger['info']('[OUTBOUND]',_0x38d0('0x53'));emit(util['format']('user:%s',_0xfae466[_0x38d0('0x12')]),'trigger:browser:url',{'uri':util[_0x38d0('0x16')](_0x38d0('0x56'),_0x130d99[_0x38d0('0xf')][_0x38d0('0x57')](_0x38d0('0x64'),''),_0x177f39['id'])});break;default:logger[_0x38d0('0x58')](_0x38d0('0x60'),_0x38d0('0x59'));}}})['catch'](function(_0x27c2c3){logger[_0x38d0('0x58')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x38d0('0x5c')](_0x27c2c3,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x24b2d6,_0x2f8999,_0x3555fe,_0x522fee,_0x6cc7d7,_0x1e9c3c){var _0x2c8b1a,_0xdb1a84;_0x1e9c3c[_0x38d0('0xf')]=intUtil[_0x38d0('0x42')](_0x1e9c3c[_0x38d0('0xf')]);_0x1e9c3c[_0x38d0('0x43')]=intUtil[_0x38d0('0x42')](_0x1e9c3c['serverUrl']);if(_0x6cc7d7&&_0x6cc7d7['monitor_format']){logger[_0x38d0('0xc')]('['+_0x2f8999['lastevent'][_0x38d0('0x65')]()+']',_0x38d0('0x46'));_0x2f8999['recordingURL']=util[_0x38d0('0x16')](_0x38d0('0x48'),_0x1e9c3c['serverUrl'],_0x2f8999[_0x38d0('0x49')],md5(_0x2f8999['uniqueid']));}else{_0x2f8999[_0x38d0('0x47')]='';}headers['Authorization']=getAuth(_0x1e9c3c);return getUser(_0x1e9c3c)['then'](function(_0x2bac86){_0x2c8b1a=_0x2bac86;logger[_0x38d0('0xc')]('The\x20User\x20ID\x20is:',_0x2c8b1a['id']);return getEndUser(_0x1e9c3c,_0x2f8999[_0x38d0('0x4d')],_0x2f8999[_0x38d0('0x66')]);})[_0x38d0('0x18')](function(_0xe83ee5){_0xdb1a84=_0xe83ee5;logger[_0x38d0('0xc')](_0x38d0('0x4e'),_0xdb1a84['id']);return getTicket(_0x1e9c3c,_0x2c8b1a,_0xdb1a84,_0x3555fe,_0x2f8999);})[_0x38d0('0x18')](function(_0x32c84e){if(_0x32c84e){logger[_0x38d0('0xc')](_0x38d0('0x4f'),_0x32c84e['id']);}})[_0x38d0('0x5a')](function(_0x403483){logger['error']('['+_0x2f8999[_0x38d0('0x67')][_0x38d0('0x65')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x38d0('0x5c')](_0x403483,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
+var _0x4fca=['catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','outbound','recordingFormat','none','[OUTBOUND]','Authorization','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','replace','inspect','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','./util','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','name','Subjects','getString','Descriptions','then','Ticket\x20created!','validateEmail','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','%s/search.json','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','end-user','Enduser\x20created.','password','%s:%s','username','authType','token','%s/token:%s','toString','base64','debug','stringify','GET','map','forEach','includes','string','picklist','customField','toLowerCase','content','type','idField','custom_fields','push','variable','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','integrationTab','Displaying\x20ticket\x20to\x20agent...','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized'];(function(_0x4291e3,_0x2484d5){var _0x41e4f9=function(_0x3f0865){while(--_0x3f0865){_0x4291e3['push'](_0x4291e3['shift']());}};_0x41e4f9(++_0x2484d5);}(_0x4fca,0x7e));var _0xa4fc=function(_0x47752f,_0xa970c5){_0x47752f=_0x47752f-0x0;var _0x42c202=_0x4fca[_0x47752f];return _0x42c202;};'use strict';var _=require(_0xa4fc('0x0'));var rp=require(_0xa4fc('0x1'));var md5=require(_0xa4fc('0x2'));var util=require('util');var Redis=require(_0xa4fc('0x3'));var intUtil=require(_0xa4fc('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xa4fc('0x5'));config[_0xa4fc('0x6')]=_[_0xa4fc('0x7')](config[_0xa4fc('0x6')],{'host':_0xa4fc('0x8'),'port':0x18eb});var io=require(_0xa4fc('0x9'))(new Redis(config[_0xa4fc('0x6')]));function emit(_0x2aba9f,_0x4c9e43,_0x478ab0){io['to'](_0x2aba9f)[_0xa4fc('0xa')](_0x4c9e43,_0x478ab0);}var headers={'Content-Type':_0xa4fc('0xb'),'Accept':_0xa4fc('0xb')};function getTicket(_0x177c94,_0x4a2bb1,_0x17461e,_0x54a390,_0x2fc4e0){logger[_0xa4fc('0xc')](_0xa4fc('0xd'));return request({'uri':util['format'](_0xa4fc('0xe'),_0x177c94[_0xa4fc('0xf')]),'method':_0xa4fc('0x10'),'body':{'ticket':_['merge']({'requester_id':_0x17461e['id'],'submitter_id':_0x4a2bb1?_0x4a2bb1['id']:undefined,'assignee_id':_0x4a2bb1?_0x4a2bb1['id']:undefined,'tags':getTags(_0x54a390[_0xa4fc('0x11')],_0xa4fc('0x12')),'subject':intUtil['getString'](_0x54a390[_0xa4fc('0x13')],_0x2fc4e0,'\x20'),'description':intUtil[_0xa4fc('0x14')](_0x54a390[_0xa4fc('0x15')],_0x2fc4e0,'\x0a'),'comment':{'public':![],'body':intUtil[_0xa4fc('0x14')](_0x54a390[_0xa4fc('0x15')],_0x2fc4e0,'\x0a')}},getCustomFields(_0x54a390['Fields'],_0x2fc4e0))}})[_0xa4fc('0x16')](function(_0x36e870){logger['info'](_0xa4fc('0x17'));return _0x36e870['ticket'];});}function getUser(_0x307c13,_0x475f7a){if(intUtil[_0xa4fc('0x18')](_0x475f7a)){logger[_0xa4fc('0xc')]('Getting\x20agent\x20with\x20email',_0x475f7a);return request({'uri':util[_0xa4fc('0x19')]('%s/search.json',_0x307c13[_0xa4fc('0xf')]),'qs':{'query':util[_0xa4fc('0x19')](_0xa4fc('0x1a'),_0x475f7a)}})['then'](function(_0x353084){if(_0x353084[_0xa4fc('0x1b')]){logger[_0xa4fc('0xc')](_0xa4fc('0x1c'));return _[_0xa4fc('0x1d')](_0x353084[_0xa4fc('0x1e')],{'email':_0x475f7a,'role':_0xa4fc('0x1f')});}else{logger[_0xa4fc('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa4fc('0x19')]('%s/users/me.json',_0x307c13['remoteUri'])})[_0xa4fc('0x16')](function(_0x35babb){logger[_0xa4fc('0xc')](_0xa4fc('0x20'));return _0x35babb[_0xa4fc('0x21')];});}});}else{logger[_0xa4fc('0xc')](_0xa4fc('0x22'));return request({'uri':util[_0xa4fc('0x19')](_0xa4fc('0x23'),_0x307c13[_0xa4fc('0xf')])})[_0xa4fc('0x16')](function(_0x4e6935){logger[_0xa4fc('0xc')](_0xa4fc('0x20'));return _0x4e6935[_0xa4fc('0x21')];});}}function getEndUser(_0x3ab090,_0x356cc6,_0x41baee){logger[_0xa4fc('0xc')]('Searching\x20enduser\x20with\x20phone',_0x41baee);return request({'uri':util['format'](_0xa4fc('0x24'),_0x3ab090[_0xa4fc('0xf')]),'qs':{'query':util[_0xa4fc('0x19')]('type:user\x20role:end-user\x20phone:%s',_0x41baee)}})[_0xa4fc('0x16')](function(_0x351089){var _0x550bc0;if(_0x351089[_0xa4fc('0x1e')][_0xa4fc('0x25')]){_0x351089[_0xa4fc('0x1e')]=_[_0xa4fc('0x26')](_0x351089['results'],{'suspended':![],'role':'end-user'});if(_0x351089[_0xa4fc('0x1e')][_0xa4fc('0x25')]){_0x550bc0=_[_0xa4fc('0x27')](_0x351089[_0xa4fc('0x1e')]);}}if(_0x550bc0){logger[_0xa4fc('0xc')](_0xa4fc('0x28'));return _0x550bc0;}else{logger[_0xa4fc('0xc')](_0xa4fc('0x29'));return request({'uri':util['format'](_0xa4fc('0x2a'),_0x3ab090[_0xa4fc('0xf')]),'method':_0xa4fc('0x10'),'body':{'user':{'role':_0xa4fc('0x2b'),'name':util['format']('Caller\x20-\x20%s',_0x356cc6||_0x41baee),'phone':_0x41baee}}})[_0xa4fc('0x16')](function(_0x526dd4){logger[_0xa4fc('0xc')](_0xa4fc('0x2c'));return _0x526dd4[_0xa4fc('0x21')];});}});}function getAuth(_0x51e0ac){var _0x57f3e6;if(_0x51e0ac['authType']===_0xa4fc('0x2d')){_0x57f3e6=util[_0xa4fc('0x19')](_0xa4fc('0x2e'),_0x51e0ac[_0xa4fc('0x2f')],_0x51e0ac[_0xa4fc('0x2d')]);}else if(_0x51e0ac[_0xa4fc('0x30')]===_0xa4fc('0x31')){_0x57f3e6=util[_0xa4fc('0x19')](_0xa4fc('0x32'),_0x51e0ac[_0xa4fc('0x2f')],_0x51e0ac[_0xa4fc('0x31')]);}return util['format']('Basic\x20%s',new Buffer(_0x57f3e6)[_0xa4fc('0x33')](_0xa4fc('0x34')));}function request(_0x44eaef){logger[_0xa4fc('0x35')]('[HTTP]',JSON[_0xa4fc('0x36')](_0x44eaef));return rp(_[_0xa4fc('0x7')](_0x44eaef,{'method':_0xa4fc('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x487c82,_0x551c96){var _0x34ddf1=[];if(_0x487c82&&_0x487c82[_0xa4fc('0x25')]>0x0){_0x34ddf1=_[_0xa4fc('0x38')](_0x487c82,_0x551c96);}return _0x34ddf1;}function getCustomFields(_0x1a4832,_0x594bb2){var _0x157886=[];var _0x507242={'custom_fields':[]};if(_0x1a4832[_0xa4fc('0x25')]>0x0){_[_0xa4fc('0x39')](_0x1a4832,function(_0x2048d3){if(_[_0xa4fc('0x3a')]([_0xa4fc('0x3b'),_0xa4fc('0x3c')],_0x2048d3['type'])&&_0x2048d3['nameField']&&!_0x2048d3[_0xa4fc('0x3d')]){_0x507242[_0x2048d3['nameField'][_0xa4fc('0x3e')]()]=_0x2048d3[_0xa4fc('0x3f')][_0xa4fc('0x33')]();}else if(_[_0xa4fc('0x3a')]([_0xa4fc('0x3b'),'picklist'],_0x2048d3[_0xa4fc('0x40')])&&_0x2048d3[_0xa4fc('0x41')]&&_0x2048d3['customField']){_0x507242[_0xa4fc('0x42')][_0xa4fc('0x43')]({'id':_0x2048d3[_0xa4fc('0x41')],'value':_0x2048d3[_0xa4fc('0x3f')]['toString']()});}else if(_0x2048d3['type']===_0xa4fc('0x44')&&_0x2048d3[_0xa4fc('0x45')]&&_0x2048d3['idField']&&_0x2048d3[_0xa4fc('0x3d')]){_0x594bb2[_0x2048d3[_0xa4fc('0x45')]]&&_0x507242[_0xa4fc('0x42')]['push']({'id':_0x2048d3[_0xa4fc('0x41')],'value':_0x594bb2[_0x2048d3[_0xa4fc('0x45')]][_0xa4fc('0x33')]()});}else if(_0x2048d3[_0xa4fc('0x40')]===_0xa4fc('0x46')&&_0x2048d3[_0xa4fc('0x47')]&&_0x2048d3['Variable'][_0xa4fc('0x12')]&&_0x2048d3[_0xa4fc('0x41')]&&_0x2048d3[_0xa4fc('0x3d')]){_0x594bb2[_0x2048d3['Variable'][_0xa4fc('0x12')][_0xa4fc('0x3e')]()]&&_0x507242[_0xa4fc('0x42')]['push']({'id':_0x2048d3[_0xa4fc('0x41')],'value':_0x594bb2[_0x2048d3['Variable'][_0xa4fc('0x12')]['toLowerCase']()][_0xa4fc('0x33')]()});}});}return _0x507242;}exports[_0xa4fc('0x48')]=function(_0xcbf2b4,_0x4d9dc4,_0x1611b5,_0x303cee,_0x1264c1,_0x3dbc74){var _0x29096d,_0x264bf9;_0x3dbc74[_0xa4fc('0xf')]=intUtil[_0xa4fc('0x49')](_0x3dbc74[_0xa4fc('0xf')]);_0x3dbc74[_0xa4fc('0x4a')]=intUtil[_0xa4fc('0x49')](_0x3dbc74[_0xa4fc('0x4a')]);if(_0x1264c1&&_0x1264c1['monitor_format']){logger[_0xa4fc('0xc')](_0xa4fc('0x4b'),_0xa4fc('0x4c'));_0x4d9dc4['recordingURL']=util[_0xa4fc('0x19')](_0xa4fc('0x4d'),_0x3dbc74[_0xa4fc('0x4a')],_0x4d9dc4[_0xa4fc('0x4e')],md5(_0x4d9dc4[_0xa4fc('0x4e')]));}else{_0x4d9dc4[_0xa4fc('0x4f')]='';}headers['Authorization']=getAuth(_0x3dbc74);return getUser(_0x3dbc74,_0x303cee['email'])[_0xa4fc('0x16')](function(_0x555793){_0x29096d=_0x555793;logger[_0xa4fc('0xc')](_0xa4fc('0x50'),_0x29096d['id']);return getEndUser(_0x3dbc74,_0x4d9dc4[_0xa4fc('0x51')],_0x4d9dc4[_0xa4fc('0x52')]);})['then'](function(_0x37f1b9){_0x264bf9=_0x37f1b9;logger['info']('The\x20Enduser\x20ID\x20is:',_0x264bf9['id']);return getTicket(_0x3dbc74,_0x29096d,_0x264bf9,_0x1611b5,_0x4d9dc4);})[_0xa4fc('0x16')](function(_0x3b4617){if(_0x3b4617){logger['info']('The\x20Ticket\x20ID\x20is:',_0x3b4617['id']);switch(_0x3dbc74[_0xa4fc('0x40')]){case _0xa4fc('0x53'):logger['info'](_0xa4fc('0x4b'),_0xa4fc('0x54'));return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x3dbc74['remoteUri'],_0x29096d['id'],_0x3b4617['id']),'method':_0xa4fc('0x10')});case'newTab':logger[_0xa4fc('0xc')](_0xa4fc('0x4b'),_0xa4fc('0x55'));emit(util[_0xa4fc('0x19')](_0xa4fc('0x56'),_0x303cee[_0xa4fc('0x12')]),_0xa4fc('0x57'),{'uri':util[_0xa4fc('0x19')](_0xa4fc('0x58'),_0x3dbc74[_0xa4fc('0xf')]['replace'](_0xa4fc('0x59'),''),_0x3b4617['id'])});break;default:logger[_0xa4fc('0x5a')](_0xa4fc('0x4b'),_0xa4fc('0x5b'));}}})[_0xa4fc('0x5c')](function(_0x4b6b88){logger[_0xa4fc('0x5a')](_0xa4fc('0x5d'),util['inspect'](_0x4b6b88,{'showHidden':!![],'depth':null}));});};exports[_0xa4fc('0x5e')]=function(_0x5916f7,_0xecfae4,_0x17a301,_0x34d565,_0x4dc38f,_0x3d4b1b,_0x567015){var _0x289f47,_0x1328a9;_0x3d4b1b[_0xa4fc('0xf')]=intUtil['stripTrailingSlash'](_0x3d4b1b[_0xa4fc('0xf')]);_0x3d4b1b[_0xa4fc('0x4a')]=intUtil[_0xa4fc('0x49')](_0x3d4b1b[_0xa4fc('0x4a')]);if(_0x567015&&_0x567015['recordingFormat']&&_0x567015[_0xa4fc('0x5f')]!==_0xa4fc('0x60')){logger[_0xa4fc('0xc')](_0xa4fc('0x61'),'Recording\x20is\x20enabled!');_0xecfae4[_0xa4fc('0x4f')]=util['format'](_0xa4fc('0x4d'),_0x3d4b1b[_0xa4fc('0x4a')],_0xecfae4[_0xa4fc('0x4e')],md5(_0xecfae4['uniqueid']));}headers[_0xa4fc('0x62')]=getAuth(_0x3d4b1b);return getUser(_0x3d4b1b,_0x34d565['email'])['then'](function(_0x1ddabe){_0x289f47=_0x1ddabe;logger[_0xa4fc('0xc')](_0xa4fc('0x50'),_0x289f47['id']);return getEndUser(_0x3d4b1b,_0xecfae4[_0xa4fc('0x63')],_0xecfae4[_0xa4fc('0x64')]);})[_0xa4fc('0x16')](function(_0x396ff0){_0x1328a9=_0x396ff0;logger['info'](_0xa4fc('0x65'),_0x1328a9['id']);return getTicket(_0x3d4b1b,_0x289f47,_0x1328a9,_0x17a301,_0xecfae4);})[_0xa4fc('0x16')](function(_0xe9cdf7){if(_0xe9cdf7){logger[_0xa4fc('0xc')](_0xa4fc('0x66'),_0xe9cdf7['id']);switch(_0x3d4b1b[_0xa4fc('0x40')]){case _0xa4fc('0x53'):logger[_0xa4fc('0xc')](_0xa4fc('0x61'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xa4fc('0x19')](_0xa4fc('0x67'),_0x3d4b1b[_0xa4fc('0xf')],_0x289f47['id'],_0xe9cdf7['id']),'method':'POST'});case _0xa4fc('0x68'):logger[_0xa4fc('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xa4fc('0x56'),_0x34d565['name']),'trigger:browser:url',{'uri':util[_0xa4fc('0x19')](_0xa4fc('0x58'),_0x3d4b1b['remoteUri'][_0xa4fc('0x69')](_0xa4fc('0x59'),''),_0xe9cdf7['id'])});break;default:logger[_0xa4fc('0x5a')](_0xa4fc('0x61'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0xa4fc('0x5c')](function(_0x32b4ce){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xa4fc('0x6a')](_0x32b4ce,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x210ab2,_0x85bba4,_0x1fad6c,_0x5f3489,_0x564c59,_0x5e63ec){var _0x34a78d,_0x3f333e;_0x5e63ec[_0xa4fc('0xf')]=intUtil['stripTrailingSlash'](_0x5e63ec[_0xa4fc('0xf')]);_0x5e63ec[_0xa4fc('0x4a')]=intUtil['stripTrailingSlash'](_0x5e63ec[_0xa4fc('0x4a')]);if(_0x564c59&&_0x564c59['monitor_format']){logger[_0xa4fc('0xc')]('['+_0x85bba4[_0xa4fc('0x6b')][_0xa4fc('0x6c')]()+']','Recording\x20is\x20enabled!');_0x85bba4[_0xa4fc('0x4f')]=util[_0xa4fc('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5e63ec[_0xa4fc('0x4a')],_0x85bba4[_0xa4fc('0x4e')],md5(_0x85bba4[_0xa4fc('0x4e')]));}else{_0x85bba4[_0xa4fc('0x4f')]='';}headers['Authorization']=getAuth(_0x5e63ec);return getUser(_0x5e63ec)[_0xa4fc('0x16')](function(_0x30a060){_0x34a78d=_0x30a060;logger[_0xa4fc('0xc')](_0xa4fc('0x50'),_0x34a78d['id']);return getEndUser(_0x5e63ec,_0x85bba4[_0xa4fc('0x51')],_0x85bba4[_0xa4fc('0x52')]);})[_0xa4fc('0x16')](function(_0x2b883b){_0x3f333e=_0x2b883b;logger[_0xa4fc('0xc')]('The\x20Enduser\x20ID\x20is:',_0x3f333e['id']);return getTicket(_0x5e63ec,_0x34a78d,_0x3f333e,_0x1fad6c,_0x85bba4);})[_0xa4fc('0x16')](function(_0x2778ed){if(_0x2778ed){logger[_0xa4fc('0xc')](_0xa4fc('0x66'),_0x2778ed['id']);}})['catch'](function(_0x368be3){logger[_0xa4fc('0x5a')]('['+_0x85bba4[_0xa4fc('0x6b')]['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x368be3,{'showHidden':!![],'depth':null}));});};
\ No newline at end of file
index 76b16fe..1eab8b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb845=['first_name','last_name','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subject','getString','Description','Who_Id','Full_Name','First_Name','What_Id','Last_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','Answered','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','Call_Type','Fields','/crm/v2/Calls','code','err','queue','host','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','serverUrl','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','https://crm.','stripTrailingSlash','recordingFormat','none','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','toUpperCase','Inbound','request-promise','md5','util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','string','picklist','type','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','expires_in','seconds','catch','error','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role'];(function(_0x598cbc,_0x1fe068){var _0x359a3f=function(_0x22eb8d){while(--_0x22eb8d){_0x598cbc['push'](_0x598cbc['shift']());}};_0x359a3f(++_0x1fe068);}(_0xb845,0x18b));var _0x5b84=function(_0x26cbf5,_0x507741){_0x26cbf5=_0x26cbf5-0x0;var _0x4bbe4c=_0xb845[_0x26cbf5];return _0x4bbe4c;};'use strict';var _=require('lodash');var rp=require(_0x5b84('0x0'));var md5=require(_0x5b84('0x1'));var util=require(_0x5b84('0x2'));var intUtil=require('./util');var moment=require(_0x5b84('0x3'));var Redis=require(_0x5b84('0x4'));var BPromise=require(_0x5b84('0x5'));var config=require(_0x5b84('0x6'));var logger=require(_0x5b84('0x7'))(_0x5b84('0x8'));config[_0x5b84('0x9')]=_[_0x5b84('0xa')](config[_0x5b84('0x9')],{'host':_0x5b84('0xb'),'port':0x18eb});var io=require(_0x5b84('0xc'))(new Redis(config[_0x5b84('0x9')]));function emit(_0x2d97a8,_0x2e3929,_0x37cc01){io['to'](_0x2d97a8)[_0x5b84('0xd')](_0x2e3929,_0x37cc01);}function request(_0x1e8b88){logger[_0x5b84('0xe')](_0x5b84('0xf'),JSON[_0x5b84('0x10')](_0x1e8b88));return rp(_0x1e8b88);}function getCustomFields(_0xfabbb1,_0x4a0d21){var _0x11b20d={};if(_0xfabbb1[_0x5b84('0x11')]>0x0){_[_0x5b84('0x12')](_0xfabbb1,function(_0x5217e8){if(_[_0x5b84('0x13')]([_0x5b84('0x14'),_0x5b84('0x15')],_0x5217e8[_0x5b84('0x16')])&&_0x5217e8[_0x5b84('0x17')]){_0x11b20d[_0x5217e8[_0x5b84('0x17')]]=_0x5217e8[_0x5b84('0x18')][_0x5b84('0x19')]();}else if(_0x5217e8[_0x5b84('0x16')]==='variable'&&_0x5217e8['variableName']&&_0x5217e8[_0x5b84('0x17')]&&_0x4a0d21[_0x5217e8[_0x5b84('0x1a')]]){_0x11b20d[_0x5217e8[_0x5b84('0x17')]]=_0x4a0d21[_0x5217e8[_0x5b84('0x1a')]][_0x5b84('0x19')]();}else if(_0x5217e8[_0x5b84('0x16')]===_0x5b84('0x1b')&&_0x5217e8[_0x5b84('0x1c')]&&_0x5217e8[_0x5b84('0x1c')][_0x5b84('0x1d')]&&_0x5217e8[_0x5b84('0x17')]&&_0x4a0d21[_0x5217e8[_0x5b84('0x1c')][_0x5b84('0x1d')][_0x5b84('0x1e')]()]){_0x11b20d[_0x5217e8['idField']]=_0x4a0d21[_0x5217e8['Variable']['name'][_0x5b84('0x1e')]()][_0x5b84('0x19')]();}});}return _0x11b20d;}function getName(_0x319c20){if(_0x319c20['indexOf']('\x20')>0x0){var _0x22bb1a=_0x319c20['split'](/ (.+)/);if(_0x22bb1a[0x1]){return _0x22bb1a;}}return[_0x319c20,_0x319c20];}var accountsTokens={};function getAccessToken(_0x2bebf0){return new Promise(function(_0x211b9f,_0x30779b){if(!_[_0x5b84('0x1f')](accountsTokens[_0x2bebf0['id']])&&!_[_0x5b84('0x1f')](accountsTokens[_0x2bebf0['id']][_0x5b84('0x20')])){if(moment()[_0x5b84('0x21')](accountsTokens[_0x2bebf0['id']]['expires_in'])){_0x211b9f(accountsTokens[_0x2bebf0['id']]['access_token']);}}var _0x58e3c6;switch(_0x2bebf0['zone']){case'US':_0x58e3c6=_0x5b84('0x22');break;case'AU':_0x58e3c6='https://accounts.zoho.com.au';break;case'EU':_0x58e3c6=_0x5b84('0x23');break;case'IN':_0x58e3c6=_0x5b84('0x24');break;case'CN':_0x58e3c6=_0x5b84('0x25');break;default:_0x58e3c6='https://accounts.zoho.eu';break;}var _0x2e09ff={'method':_0x5b84('0x26'),'uri':_0x58e3c6+_0x5b84('0x27'),'qs':{'refresh_token':_0x2bebf0[_0x5b84('0x28')],'client_id':_0x2bebf0[_0x5b84('0x29')],'client_secret':_0x2bebf0[_0x5b84('0x2a')],'grant_type':_0x5b84('0x2b')},'json':!![]};return rp(_0x2e09ff)[_0x5b84('0x2c')](function(_0x23d99f){accountsTokens[_0x2bebf0['id']]={'access_token':_0x23d99f['access_token'],'expires_in':moment()['add'](_0x23d99f[_0x5b84('0x2d')],_0x5b84('0x2e'))};_0x211b9f(_0x23d99f[_0x5b84('0x20')]);})[_0x5b84('0x2f')](function(_0x3d899e){logger[_0x5b84('0x30')]('Failing\x20creating\x20the\x20access_token',_0x3d899e['stack']);_0x30779b(_0x3d899e);});});}function getUser(_0x3b21c9,_0x15590c,_0x1396af,_0xe63f8f){logger[_0x5b84('0x31')](_0x5b84('0x32'));return request({'method':_0x5b84('0x33'),'uri':util[_0x5b84('0x34')](_0x5b84('0x35'),_0x15590c),'qs':{'type':_0x5b84('0x36')},'headers':{'Authorization':_0x5b84('0x37')+_0x3b21c9},'json':!![]})[_0x5b84('0x2c')](function(_0x999108){if(_0x999108[_0x5b84('0x38')]){var _0x47716d=-0x1;if(_[_0x5b84('0x39')](_0x999108['users'])){if(!_['isNil'](_0xe63f8f)){_0x47716d=_['findIndex'](_0x999108['users'],function(_0x10e421){return _0x10e421[_0x5b84('0x3a')]===_0xe63f8f;});}if(_0x47716d>=0x0){logger[_0x5b84('0x31')](_0x5b84('0x3b'));}else{logger[_0x5b84('0x31')](_0x5b84('0x3c'));_0x47716d=_[_0x5b84('0x3d')](_0x999108['users'],function(_0x5b2d3c){return _0x5b2d3c[_0x5b84('0x3e')]['name']==='Administrator';});}return _0x999108[_0x5b84('0x38')][_0x47716d];}else{if(_0x999108[_0x5b84('0x3f')][_0x5b84('0x3e')][_0x5b84('0x1d')]==='Administrator'){logger['info']('Using\x20the\x20admin\x20account!');user=_0x999108[_0x5b84('0x3f')];return user;}else{logger[_0x5b84('0x30')](_0x5b84('0x40'),JSON[_0x5b84('0x10')](_0x999108));throw new Error(_0x5b84('0x41')+JSON[_0x5b84('0x10')](_0x999108));}}}else{logger[_0x5b84('0x30')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x999108));throw new Error(_0x5b84('0x41')+JSON[_0x5b84('0x10')](_0x999108));}})['catch'](function(_0x5b5202){console[_0x5b84('0x30')](_0x5b5202);});}function getZohoUser(_0x22d048,_0x289547){return new BPromise(function(_0x4754a9,_0x2f86ae){request(_0x22d048)[_0x5b84('0x2c')](function(_0x17e2ff){var _0x3b9e06=null;if(_0x17e2ff){_0x3b9e06=_0x17e2ff[_0x5b84('0x42')][0x0];_0x3b9e06[_0x5b84('0x43')]=_0x289547;}_0x4754a9(_0x3b9e06);})[_0x5b84('0x2f')](function(_0xdb3a51){_0x2f86ae(_0xdb3a51);});});}function createEndUser(_0x440a6f,_0x563dd0,_0x13664c,_0x2503c1,_0x535741,_0x5411c5){var _0x13664c=getName(_0x13664c);return request({'method':'POST','uri':_0x5b84('0x44')+_0x563dd0+_0x5b84('0x45')+_[_0x5b84('0x46')](_0x5411c5[_0x5b84('0x47')])+'s','body':{'data':[{'Last_Name':_0x13664c[0x1],'First_Name':_0x13664c[0x0],'Phone':_0x2503c1,'Owner':{'name':!_['isNil'](_0x535741[_0x5b84('0x48')][_0x5b84('0x1d')])?_0x535741['role'][_0x5b84('0x1d')]:!_[_0x5b84('0x1f')](_0x535741[_0x5b84('0x49')])?_0x535741[_0x5b84('0x49')]+'\x20'+_0x535741[_0x5b84('0x4a')]:_0x535741[_0x5b84('0x4a')],'id':_0x535741['id']}}]},'headers':{'Authorization':_0x5b84('0x37')+_0x440a6f},'json':!![]})[_0x5b84('0x2c')](function(_0x45d086){if(_0x45d086&&_0x45d086[_0x5b84('0x42')][0x0]['code']===_0x5b84('0x4b')){var _0x2ceed9=_0x45d086[_0x5b84('0x42')][0x0][_0x5b84('0x4c')];_0x2ceed9[_0x5b84('0x43')]=_['startCase'](_0x5411c5[_0x5b84('0x47')])+'s';return _0x2ceed9;}logger[_0x5b84('0x30')]('The\x20failing\x20result\x20is',JSON[_0x5b84('0x10')](data));throw new Error(_0x5b84('0x4d')+JSON[_0x5b84('0x10')](data));})['catch'](function(_0x838600){console[_0x5b84('0x4e')](_0x5b84('0x4f'),_0x838600);});}function getEndUser(_0x329335,_0x3cc4d7,_0x7eeff,_0x541844,_0x17d26c,_0x4c44ab,_0x16c85e){var _0x49b5b9={'method':_0x5b84('0x33'),'uri':'','headers':{'Authorization':_0x5b84('0x37')+_0x329335},'json':!![]};switch(_0x16c85e[_0x5b84('0x50')]){case _0x5b84('0x51'):_0x49b5b9['uri']=_0x5b84('0x44')+_0x3cc4d7+_0x5b84('0x52')+_0x17d26c+'))';return getZohoUser(_0x49b5b9,_0x5b84('0x53'))['then'](function(_0x531181){if(_0x531181)return _0x531181;_0x49b5b9[_0x5b84('0x54')]=_0x5b84('0x44')+_0x3cc4d7+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x17d26c+'))';return getZohoUser(_0x49b5b9,_0x5b84('0x55'))['then'](function(_0x50a657){if(_0x50a657)return _0x50a657;if(_0x16c85e[_0x5b84('0x47')]!=_0x5b84('0x56')){return createEndUser(_0x329335,_0x3cc4d7,_0x541844,_0x17d26c,_0x4c44ab,_0x16c85e);}else{return{};}});});break;case _0x5b84('0x57'):_0x49b5b9[_0x5b84('0x54')]='https://www.zohoapis.'+_0x3cc4d7+_0x5b84('0x52')+_0x17d26c+'))';return getZohoUser(_0x49b5b9,_0x5b84('0x53'))[_0x5b84('0x2c')](function(_0x5040dd){if(_0x5040dd)return _0x5040dd;if(_0x16c85e[_0x5b84('0x47')]!=_0x5b84('0x56')){return createEndUser(_0x329335,_0x3cc4d7,_0x541844,_0x17d26c,_0x4c44ab,_0x16c85e);}else{return{};}});break;case _0x5b84('0x58'):_0x49b5b9['uri']=_0x5b84('0x44')+_0x3cc4d7+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x17d26c+'))';return getZohoUser(_0x49b5b9,_0x5b84('0x55'))[_0x5b84('0x2c')](function(_0x2ecf4a){if(_0x2ecf4a)return _0x2ecf4a;if(_0x16c85e[_0x5b84('0x47')]!='nothing'){return createEndUser(_0x329335,_0x3cc4d7,_0x541844,_0x17d26c,_0x4c44ab,_0x16c85e);}else{return{};}});break;}}function getCall(_0x197183,_0x1847ee,_0x43240d,_0xb0dea7,_0xd2539e,_0x31f1a1,_0x12aebe,_0x3a5010){logger[_0x5b84('0x31')](_0x5b84('0x59'));var _0x23b8ea={};_0x23b8ea['Owner']={'name':!_['isNil'](_0xb0dea7[_0x5b84('0x48')][_0x5b84('0x1d')])&&!_[_0x5b84('0x1f')](_0xb0dea7[_0x5b84('0x3e')]['name'])&&_0xb0dea7[_0x5b84('0x3e')][_0x5b84('0x1d')]===_0x5b84('0x5a')?_0xb0dea7[_0x5b84('0x48')][_0x5b84('0x1d')]:!_['isNil'](_0xb0dea7[_0x5b84('0x49')])?_0xb0dea7[_0x5b84('0x49')]+'\x20'+_0xb0dea7[_0x5b84('0x4a')]:_0xb0dea7[_0x5b84('0x4a')],'id':_0xb0dea7['id']};_0x23b8ea[_0x5b84('0x5b')]=intUtil[_0x5b84('0x5c')](_0x31f1a1['Subjects'],_0x12aebe,'\x20');_0x23b8ea[_0x5b84('0x5d')]=intUtil['getString'](_0x31f1a1['Descriptions'],_0x12aebe,'\x0a');if(_0xd2539e[_0x5b84('0x43')]===_0x5b84('0x53')){_0x23b8ea[_0x5b84('0x5e')]={'name':!_[_0x5b84('0x1f')](_0xd2539e[_0x5b84('0x5f')])?_0xd2539e[_0x5b84('0x5f')]:!_[_0x5b84('0x1f')](_0xd2539e[_0x5b84('0x60')])?_0xd2539e[_0x5b84('0x60')]+'\x20'+_0xd2539e['Last_Name']:_0xd2539e['Last_Name'],'id':_0xd2539e['id']};}if(_0xd2539e[_0x5b84('0x43')]===_0x5b84('0x55')){_0x23b8ea[_0x5b84('0x61')]={'name':!_[_0x5b84('0x1f')](_0xd2539e[_0x5b84('0x5f')])?_0xd2539e[_0x5b84('0x5f')]:!_[_0x5b84('0x1f')](_0xd2539e['First_Name'])?_0xd2539e[_0x5b84('0x60')]+'\x20'+_0xd2539e['Last_Name']:_0xd2539e[_0x5b84('0x62')],'id':_0xd2539e['id']};_0x23b8ea[_0x5b84('0x63')]=_[_0x5b84('0x46')](_0xd2539e['enduserType']);}if(_0x12aebe[_0x5b84('0x64')]){_0x23b8ea['Call_Duration']=moment[_0x5b84('0x65')](parseInt(_0x12aebe[_0x5b84('0x64')])*0x3e8)[_0x5b84('0x34')](_0x5b84('0x66'));}else if(_0x12aebe[_0x5b84('0x67')]&&_0x12aebe[_0x5b84('0x68')]){_0x23b8ea[_0x5b84('0x69')]=moment[_0x5b84('0x65')](moment(_0x12aebe['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0x5b84('0x6a')](moment(_0x12aebe[_0x5b84('0x6b')],_0x5b84('0x6c'))))[_0x5b84('0x34')](_0x5b84('0x66'));}switch(_0x12aebe[_0x5b84('0x6d')]){case _0x5b84('0x6e'):_0x23b8ea[_0x5b84('0x6f')]=_0x5b84('0x70');break;case'complete':case'connect':_0x23b8ea['Call_Result']=_0x5b84('0x71');break;case'rejected':_0x23b8ea[_0x5b84('0x6f')]=_0x5b84('0x72');break;case _0x5b84('0x73'):_0x23b8ea['Call_Result']=_0x5b84('0x74');break;case'timeout':_0x23b8ea[_0x5b84('0x6f')]=_0x5b84('0x75');default:}_0x23b8ea[_0x5b84('0x76')]=(_0x3a5010===_0x5b84('0x77')?moment(_0x12aebe[_0x5b84('0x6b')])[_0x5b84('0x34')](_0x5b84('0x6c')):moment(_0x12aebe['agentcalledAt'])[_0x5b84('0x34')](_0x5b84('0x6c')))||moment()[_0x5b84('0x34')](_0x5b84('0x6c'));_0x23b8ea[_0x5b84('0x78')]=_0x3a5010||'Inbound';_0x23b8ea=_['merge'](_0x23b8ea,getCustomFields(_0x31f1a1[_0x5b84('0x79')],_0x12aebe));return request({'method':_0x5b84('0x26'),'uri':'https://www.zohoapis.'+_0x1847ee+_0x5b84('0x7a'),'headers':{'Authorization':_0x5b84('0x37')+_0x197183},'body':{'data':[_0x23b8ea]},'json':!![]})[_0x5b84('0x2c')](function(_0x347ee0){if(_0x347ee0&&_0x347ee0['data'][0x0][_0x5b84('0x7b')]==='SUCCESS'){logger['info']('Call\x20created!');return{'id':_0x347ee0['data'][0x0][_0x5b84('0x4c')]['id']};}})[_0x5b84('0x2f')](function(_0x22f0b5){logger[_0x5b84('0x31')](_0x5b84('0x7c'),_0x22f0b5['stack']);console[_0x5b84('0x4e')](_0x5b84('0x7c'),_0x22f0b5);});}exports[_0x5b84('0x7d')]=function(_0xdf4bb5,_0x5c2969,_0x358ddd,_0x28e838,_0x376648,_0x2e1a09){var _0x3a8e1f,_0xd43edb,_0x2b9ade;_0x2e1a09[_0x5b84('0x7e')]=intUtil['stripTrailingSlash'](_0x2e1a09[_0x5b84('0x7e')]);_0x2e1a09['serverUrl']=intUtil['stripTrailingSlash'](_0x2e1a09['serverUrl']);if(_0x376648&&_0x376648[_0x5b84('0x7f')]){logger[_0x5b84('0x31')](_0x5b84('0x80'),_0x5b84('0x81'));_0x5c2969[_0x5b84('0x82')]=_0x2e1a09[_0x5b84('0x83')]+_0x5b84('0x84')+_0x5c2969[_0x5b84('0x85')]+_0x5b84('0x86')+md5(_0x5c2969[_0x5b84('0x85')]);}else{_0x5c2969[_0x5b84('0x82')]='';}var _0x56e147=_0x2e1a09['host']===_0x5b84('0x87')?'eu':_0x5b84('0x88');return getAccessToken(_0x2e1a09)[_0x5b84('0x2c')](function(_0x1034ba){_0x2b9ade=_0x1034ba;return getUser(_0x2b9ade,_0x56e147,_0x2e1a09,_0x28e838[_0x5b84('0x3a')]);})[_0x5b84('0x2c')](function(_0x2e41b0){_0x3a8e1f=_0x2e41b0;logger[_0x5b84('0x31')](_0x5b84('0x89'),_0x3a8e1f['id']);return getEndUser(_0x2b9ade,_0x56e147,_0x2e1a09,_0x5c2969[_0x5b84('0x8a')],_0x5c2969[_0x5b84('0x8b')],_0x3a8e1f,_0x358ddd);})[_0x5b84('0x2c')](function(_0x435f12){_0xd43edb=_0x435f12;return getCall(_0x2b9ade,_0x56e147,_0x2e1a09,_0x3a8e1f,_0xd43edb,_0x358ddd,_0x5c2969,'Inbound');})[_0x5b84('0x2c')](function(_0x2fa7bf){if(_0x2fa7bf){logger[_0x5b84('0x31')](_0x5b84('0x8c'),_0x2fa7bf['id']);logger[_0x5b84('0x31')](_0x5b84('0x80'),_0x5b84('0x8d'));emit(util[_0x5b84('0x34')](_0x5b84('0x8e'),_0x28e838[_0x5b84('0x1d')]),'trigger:browser:url',{'uri':_0x5b84('0x8f')+_0x2e1a09[_0x5b84('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x2fa7bf['id']});}})[_0x5b84('0x2f')](function(_0x5962ce){logger[_0x5b84('0x30')](_0x5b84('0x80'),JSON[_0x5b84('0x10')](_0x5962ce));});};exports[_0x5b84('0x77')]=function(_0x290b1a,_0x1af2d2,_0x486274,_0x51885c,_0x1b225e,_0x4d8610,_0x467071){var _0x2ea52a,_0x1a10d4,_0x5a6e09;_0x4d8610[_0x5b84('0x7e')]=intUtil[_0x5b84('0x90')](_0x4d8610['host']);_0x4d8610[_0x5b84('0x83')]=intUtil[_0x5b84('0x90')](_0x4d8610['serverUrl']);if(_0x467071&&_0x467071[_0x5b84('0x91')]&&_0x467071[_0x5b84('0x91')]!==_0x5b84('0x92')){logger[_0x5b84('0x31')]('[OUTBOUND]',_0x5b84('0x81'));_0x1af2d2[_0x5b84('0x82')]=_0x4d8610[_0x5b84('0x83')]+_0x5b84('0x84')+_0x1af2d2['uniqueid']+_0x5b84('0x86')+md5(_0x1af2d2[_0x5b84('0x85')]);}var _0x23c098=_0x4d8610['host']===_0x5b84('0x87')?'eu':_0x5b84('0x88');return getAccessToken(_0x4d8610)[_0x5b84('0x2c')](function(_0x556fa6){_0x5a6e09=_0x556fa6;return getUser(_0x5a6e09,_0x23c098,_0x4d8610,_0x51885c[_0x5b84('0x3a')]);})[_0x5b84('0x2c')](function(_0xd31e44){_0x2ea52a=_0xd31e44;logger['info']('The\x20User\x20ID\x20is:',_0x2ea52a['id']);return getEndUser(_0x5a6e09,_0x23c098,_0x4d8610,_0x1af2d2[_0x5b84('0x93')],_0x1af2d2[_0x5b84('0x94')],_0x2ea52a,_0x486274);})[_0x5b84('0x2c')](function(_0x2b83e8){_0x1a10d4=_0x2b83e8;return getCall(_0x5a6e09,_0x23c098,_0x4d8610,_0x2ea52a,_0x1a10d4,_0x486274,_0x1af2d2,_0x5b84('0x95'));})[_0x5b84('0x2c')](function(_0x1d8a75){if(_0x1d8a75){logger['info'](_0x5b84('0x8c'),_0x1d8a75['id']);logger[_0x5b84('0x31')](_0x5b84('0x96'),_0x5b84('0x8d'));emit(util[_0x5b84('0x34')](_0x5b84('0x8e'),_0x51885c[_0x5b84('0x1d')]),_0x5b84('0x97'),{'uri':_0x5b84('0x8f')+_0x4d8610[_0x5b84('0x7e')]+_0x5b84('0x98')+_0x1d8a75['id']});}})[_0x5b84('0x2f')](function(_0x26a2bc){logger[_0x5b84('0x30')](_0x5b84('0x96'),JSON[_0x5b84('0x10')](_0x26a2bc));});};exports[_0x5b84('0x99')]=function(_0x81b779,_0x423797,_0x38619a,_0x534283,_0x547236,_0x3b6137){var _0x39b794,_0x4b94d7,_0x4becfa;_0x3b6137[_0x5b84('0x7e')]=intUtil[_0x5b84('0x90')](_0x3b6137[_0x5b84('0x7e')]);_0x3b6137[_0x5b84('0x83')]=intUtil['stripTrailingSlash'](_0x3b6137[_0x5b84('0x83')]);if(_0x547236&&_0x547236[_0x5b84('0x7f')]){logger[_0x5b84('0x31')]('['+_0x423797[_0x5b84('0x6d')][_0x5b84('0x9a')]()+']','Recording\x20is\x20enabled!');_0x423797['recordingURL']=_0x3b6137['serverUrl']+'/api/voice/recordings/'+_0x423797[_0x5b84('0x85')]+_0x5b84('0x86')+md5(_0x423797['uniqueid']);}else{_0x423797[_0x5b84('0x82')]='';}var _0x5038f3=_0x3b6137[_0x5b84('0x7e')]==='zoho.eu'?'eu':_0x5b84('0x88');return getAccessToken(_0x3b6137)[_0x5b84('0x2c')](function(_0x112388){_0x4becfa=_0x112388;return getUser(_0x4becfa,_0x5038f3,_0x3b6137);})[_0x5b84('0x2c')](function(_0x4eaf72){_0x39b794=_0x4eaf72;logger[_0x5b84('0x31')](_0x5b84('0x89'),_0x39b794['id']);return getEndUser(_0x4becfa,_0x5038f3,_0x3b6137,_0x423797[_0x5b84('0x8a')],_0x423797[_0x5b84('0x8b')],_0x39b794,_0x38619a);})[_0x5b84('0x2c')](function(_0x5136ac){_0x4b94d7=_0x5136ac;return getCall(_0x4becfa,_0x5038f3,_0x3b6137,_0x39b794,_0x4b94d7,_0x38619a,_0x423797,_0x5b84('0x9b'));})[_0x5b84('0x2c')](function(_0x31646c){if(_0x31646c){logger[_0x5b84('0x31')](_0x5b84('0x8c'),_0x31646c['id']);}})[_0x5b84('0x2f')](function(_0x3ff431){logger[_0x5b84('0x30')]('['+_0x423797[_0x5b84('0x6d')][_0x5b84('0x9a')]()+']',JSON[_0x5b84('0x10')](_0x3ff431));});};
\ No newline at end of file
+var _0xb2e3=['data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','Error:\x20','CREATE\x20ERROR','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','nothing','contact','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','profile','administrator','getString','Description','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','lastevent','Call_Result','Called','complete','Answered','rejected','Rejected','abandoned','timeout','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','[QUEUE]','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','toUpperCase','/api/voice/recordings/','lodash','request-promise','md5','util','./util','moment','ioredis','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','[HTTP]','stringify','length','forEach','string','picklist','type','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','refresh_token','then','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb2e3,0xf9));var _0x3b2e=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0xb2e3[_0x18ab2a];return _0x16dcee;};'use strict';var _=require(_0x3b2e('0x0'));var rp=require(_0x3b2e('0x1'));var md5=require(_0x3b2e('0x2'));var util=require(_0x3b2e('0x3'));var intUtil=require(_0x3b2e('0x4'));var moment=require(_0x3b2e('0x5'));var Redis=require(_0x3b2e('0x6'));var BPromise=require('bluebird');var config=require(_0x3b2e('0x7'));var logger=require(_0x3b2e('0x8'))(_0x3b2e('0x9'));config[_0x3b2e('0xa')]=_[_0x3b2e('0xb')](config[_0x3b2e('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x3b2e('0xc'))(new Redis(config[_0x3b2e('0xa')]));function emit(_0x1191c4,_0x3f8b69,_0x27f4e6){io['to'](_0x1191c4)[_0x3b2e('0xd')](_0x3f8b69,_0x27f4e6);}function request(_0x37d788){logger['debug'](_0x3b2e('0xe'),JSON[_0x3b2e('0xf')](_0x37d788));return rp(_0x37d788);}function getCustomFields(_0x1b056a,_0x18cdda){var _0x355586={};if(_0x1b056a[_0x3b2e('0x10')]>0x0){_[_0x3b2e('0x11')](_0x1b056a,function(_0x1e4a16){if(_['includes']([_0x3b2e('0x12'),_0x3b2e('0x13')],_0x1e4a16[_0x3b2e('0x14')])&&_0x1e4a16[_0x3b2e('0x15')]){_0x355586[_0x1e4a16[_0x3b2e('0x15')]]=_0x1e4a16[_0x3b2e('0x16')]['toString']();}else if(_0x1e4a16[_0x3b2e('0x14')]===_0x3b2e('0x17')&&_0x1e4a16[_0x3b2e('0x18')]&&_0x1e4a16['idField']&&_0x18cdda[_0x1e4a16[_0x3b2e('0x18')]]){_0x355586[_0x1e4a16[_0x3b2e('0x15')]]=_0x18cdda[_0x1e4a16[_0x3b2e('0x18')]]['toString']();}else if(_0x1e4a16[_0x3b2e('0x14')]===_0x3b2e('0x19')&&_0x1e4a16[_0x3b2e('0x1a')]&&_0x1e4a16['Variable'][_0x3b2e('0x1b')]&&_0x1e4a16[_0x3b2e('0x15')]&&_0x18cdda[_0x1e4a16['Variable']['name']['toLowerCase']()]){_0x355586[_0x1e4a16[_0x3b2e('0x15')]]=_0x18cdda[_0x1e4a16[_0x3b2e('0x1a')]['name'][_0x3b2e('0x1c')]()]['toString']();}});}return _0x355586;}function getName(_0x3b6ecc){if(_0x3b6ecc[_0x3b2e('0x1d')]('\x20')>0x0){var _0x45d3d8=_0x3b6ecc[_0x3b2e('0x1e')](/ (.+)/);if(_0x45d3d8[0x1]){return _0x45d3d8;}}return[_0x3b6ecc,_0x3b6ecc];}var accountsTokens={};function getAccessToken(_0x2aaf28){return new Promise(function(_0x347f1d,_0x1b0ae4){if(!_[_0x3b2e('0x1f')](accountsTokens[_0x2aaf28['id']])&&!_['isNil'](accountsTokens[_0x2aaf28['id']][_0x3b2e('0x20')])){if(moment()['isBefore'](accountsTokens[_0x2aaf28['id']][_0x3b2e('0x21')])){_0x347f1d(accountsTokens[_0x2aaf28['id']][_0x3b2e('0x20')]);}}var _0x1f8831;switch(_0x2aaf28['zone']){case'US':_0x1f8831=_0x3b2e('0x22');break;case'AU':_0x1f8831=_0x3b2e('0x23');break;case'EU':_0x1f8831=_0x3b2e('0x24');break;case'IN':_0x1f8831=_0x3b2e('0x25');break;case'CN':_0x1f8831=_0x3b2e('0x26');break;default:_0x1f8831=_0x3b2e('0x24');break;}var _0x1bd421={'method':'POST','uri':_0x1f8831+_0x3b2e('0x27'),'qs':{'refresh_token':_0x2aaf28['refreshToken'],'client_id':_0x2aaf28[_0x3b2e('0x28')],'client_secret':_0x2aaf28['clientSecret'],'grant_type':_0x3b2e('0x29')},'json':!![]};return rp(_0x1bd421)[_0x3b2e('0x2a')](function(_0x2c1d27){accountsTokens[_0x2aaf28['id']]={'access_token':_0x2c1d27[_0x3b2e('0x20')],'expires_in':moment()[_0x3b2e('0x2b')](_0x2c1d27[_0x3b2e('0x21')],_0x3b2e('0x2c'))};_0x347f1d(_0x2c1d27[_0x3b2e('0x20')]);})[_0x3b2e('0x2d')](function(_0x1843e6){logger[_0x3b2e('0x2e')](_0x3b2e('0x2f'),_0x1843e6[_0x3b2e('0x30')]);_0x1b0ae4(_0x1843e6);});});}function getUser(_0xd94722,_0x4cdc90,_0x40c5e0,_0xf2a6f7){logger[_0x3b2e('0x31')](_0x3b2e('0x32'));return request({'method':_0x3b2e('0x33'),'uri':util[_0x3b2e('0x34')](_0x3b2e('0x35'),_0x4cdc90),'qs':{'type':_0x3b2e('0x36')},'headers':{'Authorization':_0x3b2e('0x37')+_0xd94722},'json':!![]})[_0x3b2e('0x2a')](function(_0x38a541){if(_0x38a541[_0x3b2e('0x38')]){var _0x20a080=-0x1;if(_['isArrayLikeObject'](_0x38a541[_0x3b2e('0x38')])){if(!_[_0x3b2e('0x1f')](_0xf2a6f7)){_0x20a080=_[_0x3b2e('0x39')](_0x38a541[_0x3b2e('0x38')],function(_0x23aa09){return _0x23aa09[_0x3b2e('0x3a')]===_0xf2a6f7;});}if(_0x20a080>=0x0){logger[_0x3b2e('0x31')](_0x3b2e('0x3b'));}else{logger[_0x3b2e('0x31')](_0x3b2e('0x3c'));_0x20a080=_[_0x3b2e('0x39')](_0x38a541[_0x3b2e('0x38')],function(_0x51c5c9){return _0x51c5c9['profile'][_0x3b2e('0x1b')]===_0x3b2e('0x3d');});}return _0x38a541[_0x3b2e('0x38')][_0x20a080];}else{if(_0x38a541[_0x3b2e('0x3e')]['profile']['name']==='Administrator'){logger[_0x3b2e('0x31')](_0x3b2e('0x3c'));user=_0x38a541[_0x3b2e('0x3e')];return user;}else{logger['error'](_0x3b2e('0x3f'),JSON[_0x3b2e('0xf')](_0x38a541));throw new Error(_0x3b2e('0x40')+JSON['stringify'](_0x38a541));}}}else{logger[_0x3b2e('0x2e')](_0x3b2e('0x3f'),JSON[_0x3b2e('0xf')](_0x38a541));throw new Error(_0x3b2e('0x40')+JSON['stringify'](_0x38a541));}})[_0x3b2e('0x2d')](function(_0x3bbb13){console['error'](_0x3bbb13);});}function getZohoUser(_0x57bf73,_0x487db1){return new BPromise(function(_0x383bd1,_0x34fadd){request(_0x57bf73)['then'](function(_0x3a281f){var _0x58f05d=null;if(_0x3a281f){_0x58f05d=_0x3a281f[_0x3b2e('0x41')][0x0];_0x58f05d['enduserType']=_0x487db1;}_0x383bd1(_0x58f05d);})[_0x3b2e('0x2d')](function(_0x899523){_0x34fadd(_0x899523);});});}function createEndUser(_0x2d8e17,_0xbb972d,_0x2c11b0,_0x18808a,_0x567fc6,_0x6946fc){var _0x2c11b0=getName(_0x2c11b0);return request({'method':_0x3b2e('0x42'),'uri':_0x3b2e('0x43')+_0xbb972d+_0x3b2e('0x44')+_[_0x3b2e('0x45')](_0x6946fc[_0x3b2e('0x46')])+'s','body':{'data':[{'Last_Name':_0x2c11b0[0x1],'First_Name':_0x2c11b0[0x0],'Phone':_0x18808a,'Owner':{'name':!_[_0x3b2e('0x1f')](_0x567fc6[_0x3b2e('0x47')][_0x3b2e('0x1b')])?_0x567fc6['role'][_0x3b2e('0x1b')]:!_['isNil'](_0x567fc6[_0x3b2e('0x48')])?_0x567fc6[_0x3b2e('0x48')]+'\x20'+_0x567fc6[_0x3b2e('0x49')]:_0x567fc6[_0x3b2e('0x49')],'id':_0x567fc6['id']}}]},'headers':{'Authorization':_0x3b2e('0x37')+_0x2d8e17},'json':!![]})[_0x3b2e('0x2a')](function(_0x3b4a48){if(_0x3b4a48&&_0x3b4a48['data'][0x0][_0x3b2e('0x4a')]===_0x3b2e('0x4b')){var _0x219bf5=_0x3b4a48[_0x3b2e('0x41')][0x0][_0x3b2e('0x4c')];_0x219bf5[_0x3b2e('0x4d')]=_['startCase'](_0x6946fc[_0x3b2e('0x46')])+'s';return _0x219bf5;}logger[_0x3b2e('0x2e')](_0x3b2e('0x3f'),JSON[_0x3b2e('0xf')](data));throw new Error(_0x3b2e('0x4e')+JSON['stringify'](data));})[_0x3b2e('0x2d')](function(_0x3d3dfa){console['log'](_0x3b2e('0x4f'),_0x3d3dfa);});}function getEndUser(_0x401b61,_0xf0f096,_0x379b8e,_0x2c2cf5,_0x56f7c1,_0x5b575f,_0x35a58d){var _0x2df30f={'method':'GET','uri':'','headers':{'Authorization':_0x3b2e('0x37')+_0x401b61},'json':!![]};switch(_0x35a58d[_0x3b2e('0x50')]){case _0x3b2e('0x51'):_0x2df30f[_0x3b2e('0x52')]=_0x3b2e('0x43')+_0xf0f096+_0x3b2e('0x53')+_0x56f7c1+'))';return getZohoUser(_0x2df30f,_0x3b2e('0x54'))[_0x3b2e('0x2a')](function(_0x5ea58c){if(_0x5ea58c)return _0x5ea58c;_0x2df30f[_0x3b2e('0x52')]=_0x3b2e('0x43')+_0xf0f096+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x56f7c1+'))';return getZohoUser(_0x2df30f,'Leads')[_0x3b2e('0x2a')](function(_0x5de99f){if(_0x5de99f)return _0x5de99f;if(_0x35a58d[_0x3b2e('0x46')]!=_0x3b2e('0x55')){return createEndUser(_0x401b61,_0xf0f096,_0x2c2cf5,_0x56f7c1,_0x5b575f,_0x35a58d);}else{return{};}});});break;case _0x3b2e('0x56'):_0x2df30f[_0x3b2e('0x52')]=_0x3b2e('0x43')+_0xf0f096+_0x3b2e('0x53')+_0x56f7c1+'))';return getZohoUser(_0x2df30f,_0x3b2e('0x54'))[_0x3b2e('0x2a')](function(_0x1b814a){if(_0x1b814a)return _0x1b814a;if(_0x35a58d['moduleCreate']!='nothing'){return createEndUser(_0x401b61,_0xf0f096,_0x2c2cf5,_0x56f7c1,_0x5b575f,_0x35a58d);}else{return{};}});break;case _0x3b2e('0x57'):_0x2df30f[_0x3b2e('0x52')]=_0x3b2e('0x43')+_0xf0f096+_0x3b2e('0x58')+_0x56f7c1+'))';return getZohoUser(_0x2df30f,_0x3b2e('0x59'))[_0x3b2e('0x2a')](function(_0x1f05b2){if(_0x1f05b2)return _0x1f05b2;if(_0x35a58d[_0x3b2e('0x46')]!=_0x3b2e('0x55')){return createEndUser(_0x401b61,_0xf0f096,_0x2c2cf5,_0x56f7c1,_0x5b575f,_0x35a58d);}else{return{};}});break;}}function getCall(_0x1eaf85,_0x53a565,_0x4a3c31,_0x3114f8,_0x12e321,_0x42ced0,_0x882b37,_0xdbfff1){logger['info'](_0x3b2e('0x5a'));var _0x16ff0f={};_0x16ff0f[_0x3b2e('0x5b')]={'name':!_[_0x3b2e('0x1f')](_0x3114f8[_0x3b2e('0x47')][_0x3b2e('0x1b')])&&!_[_0x3b2e('0x1f')](_0x3114f8[_0x3b2e('0x5c')][_0x3b2e('0x1b')])&&_0x3114f8[_0x3b2e('0x5c')][_0x3b2e('0x1b')]===_0x3b2e('0x5d')?_0x3114f8[_0x3b2e('0x47')][_0x3b2e('0x1b')]:!_[_0x3b2e('0x1f')](_0x3114f8[_0x3b2e('0x48')])?_0x3114f8['first_name']+'\x20'+_0x3114f8[_0x3b2e('0x49')]:_0x3114f8['last_name'],'id':_0x3114f8['id']};_0x16ff0f['Subject']=intUtil[_0x3b2e('0x5e')](_0x42ced0['Subjects'],_0x882b37,'\x20');_0x16ff0f[_0x3b2e('0x5f')]=intUtil[_0x3b2e('0x5e')](_0x42ced0[_0x3b2e('0x60')],_0x882b37,'\x0a');if(_0x12e321[_0x3b2e('0x4d')]===_0x3b2e('0x54')){_0x16ff0f[_0x3b2e('0x61')]={'name':!_['isNil'](_0x12e321[_0x3b2e('0x62')])?_0x12e321[_0x3b2e('0x62')]:!_[_0x3b2e('0x1f')](_0x12e321[_0x3b2e('0x63')])?_0x12e321[_0x3b2e('0x63')]+'\x20'+_0x12e321[_0x3b2e('0x64')]:_0x12e321['Last_Name'],'id':_0x12e321['id']};}if(_0x12e321['enduserType']===_0x3b2e('0x59')){_0x16ff0f[_0x3b2e('0x65')]={'name':!_[_0x3b2e('0x1f')](_0x12e321[_0x3b2e('0x62')])?_0x12e321[_0x3b2e('0x62')]:!_[_0x3b2e('0x1f')](_0x12e321[_0x3b2e('0x63')])?_0x12e321[_0x3b2e('0x63')]+'\x20'+_0x12e321[_0x3b2e('0x64')]:_0x12e321[_0x3b2e('0x64')],'id':_0x12e321['id']};_0x16ff0f[_0x3b2e('0x66')]=_[_0x3b2e('0x45')](_0x12e321['enduserType']);}if(_0x882b37[_0x3b2e('0x67')]){_0x16ff0f[_0x3b2e('0x68')]=moment[_0x3b2e('0x69')](parseInt(_0x882b37['talktime'])*0x3e8)[_0x3b2e('0x34')]('mm:ss');}else if(_0x882b37[_0x3b2e('0x6a')]&&_0x882b37[_0x3b2e('0x6b')]){_0x16ff0f[_0x3b2e('0x68')]=moment[_0x3b2e('0x69')](moment(_0x882b37['endtime'],_0x3b2e('0x6c'))[_0x3b2e('0x6d')](moment(_0x882b37['starttime'],_0x3b2e('0x6c'))))[_0x3b2e('0x34')]('mm:ss');}switch(_0x882b37[_0x3b2e('0x6e')]){case'called':_0x16ff0f[_0x3b2e('0x6f')]=_0x3b2e('0x70');break;case _0x3b2e('0x71'):case'connect':_0x16ff0f[_0x3b2e('0x6f')]=_0x3b2e('0x72');break;case _0x3b2e('0x73'):_0x16ff0f[_0x3b2e('0x6f')]=_0x3b2e('0x74');break;case _0x3b2e('0x75'):_0x16ff0f['Call_Result']='Abandoned';break;case _0x3b2e('0x76'):_0x16ff0f[_0x3b2e('0x6f')]=_0x3b2e('0x77');default:}_0x16ff0f[_0x3b2e('0x78')]=(_0xdbfff1===_0x3b2e('0x79')?moment(_0x882b37[_0x3b2e('0x7a')])['format']('YYYY-MM-DDTHH:mm:ss'):moment(_0x882b37[_0x3b2e('0x7b')])[_0x3b2e('0x34')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3b2e('0x34')]('YYYY-MM-DDTHH:mm:ss');_0x16ff0f[_0x3b2e('0x7c')]=_0xdbfff1||_0x3b2e('0x7d');_0x16ff0f=_[_0x3b2e('0x7e')](_0x16ff0f,getCustomFields(_0x42ced0['Fields'],_0x882b37));return request({'method':_0x3b2e('0x42'),'uri':_0x3b2e('0x43')+_0x53a565+_0x3b2e('0x7f'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x1eaf85},'body':{'data':[_0x16ff0f]},'json':!![]})[_0x3b2e('0x2a')](function(_0x3087fc){if(_0x3087fc&&_0x3087fc[_0x3b2e('0x41')][0x0][_0x3b2e('0x4a')]===_0x3b2e('0x4b')){logger[_0x3b2e('0x31')]('Call\x20created!');return{'id':_0x3087fc[_0x3b2e('0x41')][0x0][_0x3b2e('0x4c')]['id']};}})[_0x3b2e('0x2d')](function(_0x432e0b){logger[_0x3b2e('0x31')](_0x3b2e('0x80'),_0x432e0b[_0x3b2e('0x30')]);console[_0x3b2e('0x81')](_0x3b2e('0x80'),_0x432e0b);});}exports[_0x3b2e('0x82')]=function(_0x534cba,_0x3be11c,_0x4ab8e2,_0x3c5866,_0x1466be,_0x1fb31d){var _0x3fbce3,_0x45492c,_0x544547;_0x1fb31d[_0x3b2e('0x83')]=intUtil[_0x3b2e('0x84')](_0x1fb31d[_0x3b2e('0x83')]);_0x1fb31d[_0x3b2e('0x85')]=intUtil[_0x3b2e('0x84')](_0x1fb31d[_0x3b2e('0x85')]);if(_0x1466be&&_0x1466be[_0x3b2e('0x86')]){logger[_0x3b2e('0x31')]('[QUEUE]',_0x3b2e('0x87'));_0x3be11c[_0x3b2e('0x88')]=_0x1fb31d[_0x3b2e('0x85')]+'/api/voice/recordings/'+_0x3be11c['uniqueid']+_0x3b2e('0x89')+md5(_0x3be11c['uniqueid']);}else{_0x3be11c[_0x3b2e('0x88')]='';}var _0x24e102=_0x1fb31d[_0x3b2e('0x83')]===_0x3b2e('0x8a')?'eu':_0x3b2e('0x8b');return getAccessToken(_0x1fb31d)[_0x3b2e('0x2a')](function(_0x4e18e4){_0x544547=_0x4e18e4;return getUser(_0x544547,_0x24e102,_0x1fb31d,_0x3c5866[_0x3b2e('0x3a')]);})['then'](function(_0x659965){_0x3fbce3=_0x659965;logger['info'](_0x3b2e('0x8c'),_0x3fbce3['id']);return getEndUser(_0x544547,_0x24e102,_0x1fb31d,_0x3be11c[_0x3b2e('0x8d')],_0x3be11c[_0x3b2e('0x8e')],_0x3fbce3,_0x4ab8e2);})[_0x3b2e('0x2a')](function(_0x4f8e09){_0x45492c=_0x4f8e09;return getCall(_0x544547,_0x24e102,_0x1fb31d,_0x3fbce3,_0x45492c,_0x4ab8e2,_0x3be11c,_0x3b2e('0x7d'));})['then'](function(_0x2916ab){if(_0x2916ab){logger[_0x3b2e('0x31')]('The\x20Call\x20ID\x20is:',_0x2916ab['id']);logger[_0x3b2e('0x31')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3b2e('0x8f'),_0x3c5866[_0x3b2e('0x1b')]),_0x3b2e('0x90'),{'uri':_0x3b2e('0x91')+_0x1fb31d[_0x3b2e('0x83')]+_0x3b2e('0x92')+_0x2916ab['id']});}})[_0x3b2e('0x2d')](function(_0xd21f7b){logger[_0x3b2e('0x2e')](_0x3b2e('0x93'),JSON[_0x3b2e('0xf')](_0xd21f7b));});};exports[_0x3b2e('0x79')]=function(_0xc5ee4e,_0x19e3bd,_0xca0a77,_0x2d4ecf,_0x48a767,_0x3e6770,_0x303d94){var _0x3194c9,_0x48e392,_0x2a0a5b;_0x3e6770[_0x3b2e('0x83')]=intUtil['stripTrailingSlash'](_0x3e6770['host']);_0x3e6770[_0x3b2e('0x85')]=intUtil[_0x3b2e('0x84')](_0x3e6770[_0x3b2e('0x85')]);if(_0x303d94&&_0x303d94[_0x3b2e('0x94')]&&_0x303d94[_0x3b2e('0x94')]!==_0x3b2e('0x95')){logger[_0x3b2e('0x31')](_0x3b2e('0x96'),_0x3b2e('0x87'));_0x19e3bd[_0x3b2e('0x88')]=_0x3e6770[_0x3b2e('0x85')]+'/api/voice/recordings/'+_0x19e3bd[_0x3b2e('0x97')]+_0x3b2e('0x89')+md5(_0x19e3bd[_0x3b2e('0x97')]);}var _0x3e2838=_0x3e6770['host']==='zoho.eu'?'eu':_0x3b2e('0x8b');return getAccessToken(_0x3e6770)[_0x3b2e('0x2a')](function(_0x4dca59){_0x2a0a5b=_0x4dca59;return getUser(_0x2a0a5b,_0x3e2838,_0x3e6770,_0x2d4ecf[_0x3b2e('0x3a')]);})[_0x3b2e('0x2a')](function(_0x1b07aa){_0x3194c9=_0x1b07aa;logger['info'](_0x3b2e('0x8c'),_0x3194c9['id']);return getEndUser(_0x2a0a5b,_0x3e2838,_0x3e6770,_0x19e3bd['destcalleridname'],_0x19e3bd[_0x3b2e('0x98')],_0x3194c9,_0xca0a77);})[_0x3b2e('0x2a')](function(_0x5b45d4){_0x48e392=_0x5b45d4;return getCall(_0x2a0a5b,_0x3e2838,_0x3e6770,_0x3194c9,_0x48e392,_0xca0a77,_0x19e3bd,'Outbound');})[_0x3b2e('0x2a')](function(_0x23589d){if(_0x23589d){logger[_0x3b2e('0x31')](_0x3b2e('0x99'),_0x23589d['id']);logger[_0x3b2e('0x31')](_0x3b2e('0x96'),_0x3b2e('0x9a'));emit(util[_0x3b2e('0x34')](_0x3b2e('0x8f'),_0x2d4ecf[_0x3b2e('0x1b')]),_0x3b2e('0x90'),{'uri':_0x3b2e('0x91')+_0x3e6770[_0x3b2e('0x83')]+'/crm/EntityInfo.do?module=Calls&id='+_0x23589d['id']});}})[_0x3b2e('0x2d')](function(_0x203348){logger[_0x3b2e('0x2e')]('[OUTBOUND]',JSON[_0x3b2e('0xf')](_0x203348));});};exports['unmanaged']=function(_0x478960,_0x438a42,_0x383ab7,_0x36c03a,_0x2995d8,_0x31506c){var _0x245af6,_0x3856e3,_0x3b0e3d;_0x31506c[_0x3b2e('0x83')]=intUtil[_0x3b2e('0x84')](_0x31506c[_0x3b2e('0x83')]);_0x31506c[_0x3b2e('0x85')]=intUtil[_0x3b2e('0x84')](_0x31506c['serverUrl']);if(_0x2995d8&&_0x2995d8[_0x3b2e('0x86')]){logger[_0x3b2e('0x31')]('['+_0x438a42[_0x3b2e('0x6e')][_0x3b2e('0x9b')]()+']','Recording\x20is\x20enabled!');_0x438a42[_0x3b2e('0x88')]=_0x31506c[_0x3b2e('0x85')]+_0x3b2e('0x9c')+_0x438a42['uniqueid']+_0x3b2e('0x89')+md5(_0x438a42[_0x3b2e('0x97')]);}else{_0x438a42[_0x3b2e('0x88')]='';}var _0x58c71a=_0x31506c['host']===_0x3b2e('0x8a')?'eu':_0x3b2e('0x8b');return getAccessToken(_0x31506c)[_0x3b2e('0x2a')](function(_0x5e1c07){_0x3b0e3d=_0x5e1c07;return getUser(_0x3b0e3d,_0x58c71a,_0x31506c);})[_0x3b2e('0x2a')](function(_0x428f33){_0x245af6=_0x428f33;logger['info'](_0x3b2e('0x8c'),_0x245af6['id']);return getEndUser(_0x3b0e3d,_0x58c71a,_0x31506c,_0x438a42[_0x3b2e('0x8d')],_0x438a42[_0x3b2e('0x8e')],_0x245af6,_0x383ab7);})['then'](function(_0x7ae9cd){_0x3856e3=_0x7ae9cd;return getCall(_0x3b0e3d,_0x58c71a,_0x31506c,_0x245af6,_0x3856e3,_0x383ab7,_0x438a42,'Inbound');})['then'](function(_0x2a3991){if(_0x2a3991){logger[_0x3b2e('0x31')](_0x3b2e('0x99'),_0x2a3991['id']);}})[_0x3b2e('0x2d')](function(_0x1ea0a3){logger[_0x3b2e('0x2e')]('['+_0x438a42[_0x3b2e('0x6e')]['toUpperCase']()+']',JSON[_0x3b2e('0xf')](_0x1ea0a3));});};
\ No newline at end of file
index 5cc45d3..e2d1394 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc712=['exec','data2','Script','data3','render','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','../../../../config/logger','trigger'];(function(_0x3d6b1,_0x4e401e){var _0x2479e7=function(_0x2c0f7b){while(--_0x2c0f7b){_0x3d6b1['push'](_0x3d6b1['shift']());}};_0x2479e7(++_0x4e401e);}(_0xc712,0x1d0));var _0x2c71=function(_0x28664f,_0x466414){_0x28664f=_0x28664f-0x0;var _0x373276=_0xc712[_0x28664f];return _0x373276;};'use strict';var util=require(_0x2c71('0x0'));var sh=require(_0x2c71('0x1'));var Mustache=require('mustache');var logger=require(_0x2c71('0x2'))(_0x2c71('0x3'));exports[_0x2c71('0x4')]=function(_0x5532bc,_0x1693e1){var _0x19ef65=_0x5532bc['data2']?_0x5532bc[_0x2c71('0x5')]:_0x2c71('0x6');var _0x266790=_0x5532bc[_0x2c71('0x7')]?Mustache[_0x2c71('0x8')](_0x5532bc[_0x2c71('0x7')],_0x1693e1):_0x1693e1;sh['exec'](_0x266790,function(_0x1e7391,_0x1451cf,_0x5486c4){if(_0x1e7391!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x19ef65,_0x266790,_0x1e7391,_0x5486c4));}else{logger[_0x2c71('0x9')](util[_0x2c71('0xa')](_0x2c71('0xb'),_0x19ef65,_0x266790,_0x1451cf));}});};
\ No newline at end of file
+var _0xed12=['trigger','exec','data2','data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xed12,0x142));var _0x2ed1=function(_0x4ecc8e,_0x395a7b){_0x4ecc8e=_0x4ecc8e-0x0;var _0x4300ce=_0xed12[_0x4ecc8e];return _0x4300ce;};'use strict';var util=require('util');var sh=require(_0x2ed1('0x0'));var Mustache=require(_0x2ed1('0x1'));var logger=require(_0x2ed1('0x2'))(_0x2ed1('0x3'));exports[_0x2ed1('0x4')]=function(_0x1e120b,_0x27760f){var _0x327a9e=_0x1e120b[_0x2ed1('0x5')]?_0x1e120b['data2']:'Script';var _0x480dcc=_0x1e120b[_0x2ed1('0x6')]?Mustache[_0x2ed1('0x7')](_0x1e120b['data3'],_0x27760f):_0x27760f;sh[_0x2ed1('0x4')](_0x480dcc,function(_0x543cbe,_0x2618fa,_0x446c48){if(_0x543cbe!==0x0){logger[_0x2ed1('0x8')](util[_0x2ed1('0x9')](_0x2ed1('0xa'),_0x327a9e,_0x480dcc,_0x543cbe,_0x446c48));}else{logger[_0x2ed1('0xb')](util['format'](_0x2ed1('0xc'),_0x327a9e,_0x480dcc,_0x2618fa));}});};
\ No newline at end of file
index ad49422..cf1ce74 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd259=['data5','number','headers','data6','parse','error','stack','GET','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','format','stringify','then','isNil','object','info','statusCode','catch','name','message','request-promise','util','lodash','mustache','trigger','exec','data1','toUpperCase','render','data2'];(function(_0x1bc27a,_0x5a905b){var _0x53a6c9=function(_0x118515){while(--_0x118515){_0x1bc27a['push'](_0x1bc27a['shift']());}};_0x53a6c9(++_0x5a905b);}(_0xd259,0x106));var _0x9d25=function(_0x3de3b8,_0x46ded4){_0x3de3b8=_0x3de3b8-0x0;var _0x32c6e7=_0xd259[_0x3de3b8];return _0x32c6e7;};'use strict';var rp=require(_0x9d25('0x0'));var util=require(_0x9d25('0x1'));var _=require(_0x9d25('0x2'));var Mustache=require(_0x9d25('0x3'));var logger=require('../../../../config/logger')(_0x9d25('0x4'));exports[_0x9d25('0x5')]=function(_0xcf2796,_0x4adadf){var _0xe145d6,_0x310fc7;var _0x1406b4={'method':_0xcf2796[_0x9d25('0x6')][_0x9d25('0x7')](),'uri':Mustache[_0x9d25('0x8')](_0xcf2796[_0x9d25('0x9')],_0x4adadf),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xcf2796[_0x9d25('0xa')])===_0x9d25('0xb')&&parseInt(_0xcf2796[_0x9d25('0xa')])>=0x1&&parseInt(_0xcf2796[_0x9d25('0xa')])<=0xa?parseInt(_0xcf2796[_0x9d25('0xa')])*0x3e8:0x5*0x3e8};try{_0x1406b4[_0x9d25('0xc')]=_0xcf2796[_0x9d25('0xd')]?JSON[_0x9d25('0xe')](Mustache[_0x9d25('0x8')](_0xcf2796[_0x9d25('0xd')],_0x4adadf)):{};}catch(_0xb0e7df){logger[_0x9d25('0xf')](_0xb0e7df[_0x9d25('0x10')]);}switch(_0xcf2796[_0x9d25('0x6')]['toUpperCase']()){case _0x9d25('0x11'):case _0x9d25('0x12'):_0xe145d6=null;_0x1406b4['qs']=_0x4adadf;break;case _0x9d25('0x13'):case _0x9d25('0x14'):if(_0xcf2796[_0x9d25('0x15')]){try{_0xe145d6=JSON['parse'](Mustache[_0x9d25('0x8')](_0xcf2796[_0x9d25('0x15')],_0x4adadf));_0x1406b4[_0x9d25('0x16')]=_0xe145d6;}catch(_0x1a8dcf){logger[_0x9d25('0xf')](_0x1a8dcf[_0x9d25('0x10')]);logger['error'](_0x9d25('0x17'));}}else{_0xe145d6=_0x4adadf;_0x1406b4[_0x9d25('0x16')]=_0xe145d6;}break;}logger['info'](util[_0x9d25('0x18')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0xcf2796[_0x9d25('0x6')],_0xcf2796[_0x9d25('0x9')],JSON[_0x9d25('0x19')](_0x1406b4)));rp(_0x1406b4)[_0x9d25('0x1a')](function(_0x2bdc83){_0xe145d6=!_[_0x9d25('0x1b')](_0xe145d6)?',\x20request\x20body:\x20'+_0xe145d6:'';_0x310fc7=typeof _0x2bdc83[_0x9d25('0x16')]===_0x9d25('0x1c')?JSON['stringify'](_0x2bdc83['body']):_0x2bdc83[_0x9d25('0x16')];logger[_0x9d25('0x1d')](util[_0x9d25('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0xcf2796[_0x9d25('0x6')],_0xcf2796[_0x9d25('0x9')],_0x2bdc83[_0x9d25('0x1e')],_0x310fc7));})[_0x9d25('0x1f')](function(_0x16e467){logger[_0x9d25('0xf')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0xcf2796['data1'],_0xcf2796[_0x9d25('0x9')],_0x16e467[_0x9d25('0x1e')],_0x16e467[_0x9d25('0x20')],_0x16e467[_0x9d25('0x21')]));});};
\ No newline at end of file
+var _0x42d6=[',\x20request\x20body:\x20','stringify','info','format','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data2','data5','number','data6','parse','GET','DELETE','POST','data7','body','error','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','then','isNil'];(function(_0x1cef3c,_0x4173c4){var _0x5decf7=function(_0x14a523){while(--_0x14a523){_0x1cef3c['push'](_0x1cef3c['shift']());}};_0x5decf7(++_0x4173c4);}(_0x42d6,0x173));var _0x642d=function(_0x2b4328,_0xf02580){_0x2b4328=_0x2b4328-0x0;var _0x2d3835=_0x42d6[_0x2b4328];return _0x2d3835;};'use strict';var rp=require(_0x642d('0x0'));var util=require(_0x642d('0x1'));var _=require(_0x642d('0x2'));var Mustache=require(_0x642d('0x3'));var logger=require(_0x642d('0x4'))(_0x642d('0x5'));exports['exec']=function(_0x4000ba,_0x52dc3e){var _0x57bb21,_0x195667;var _0x19584c={'method':_0x4000ba[_0x642d('0x6')][_0x642d('0x7')](),'uri':Mustache[_0x642d('0x8')](_0x4000ba[_0x642d('0x9')],_0x52dc3e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4000ba[_0x642d('0xa')])===_0x642d('0xb')&&parseInt(_0x4000ba[_0x642d('0xa')])>=0x1&&parseInt(_0x4000ba[_0x642d('0xa')])<=0xa?parseInt(_0x4000ba[_0x642d('0xa')])*0x3e8:0x5*0x3e8};try{_0x19584c['headers']=_0x4000ba[_0x642d('0xc')]?JSON[_0x642d('0xd')](Mustache[_0x642d('0x8')](_0x4000ba[_0x642d('0xc')],_0x52dc3e)):{};}catch(_0x29e78e){logger['error'](_0x29e78e['stack']);}switch(_0x4000ba[_0x642d('0x6')][_0x642d('0x7')]()){case _0x642d('0xe'):case _0x642d('0xf'):_0x57bb21=null;_0x19584c['qs']=_0x52dc3e;break;case _0x642d('0x10'):case'PUT':if(_0x4000ba[_0x642d('0x11')]){try{_0x57bb21=JSON['parse'](Mustache[_0x642d('0x8')](_0x4000ba[_0x642d('0x11')],_0x52dc3e));_0x19584c[_0x642d('0x12')]=_0x57bb21;}catch(_0x2412f7){logger[_0x642d('0x13')](_0x2412f7[_0x642d('0x14')]);logger[_0x642d('0x13')](_0x642d('0x15'));}}else{_0x57bb21=_0x52dc3e;_0x19584c['body']=_0x57bb21;}break;}logger['info'](util['format'](_0x642d('0x16'),_0x4000ba[_0x642d('0x6')],_0x4000ba[_0x642d('0x9')],JSON['stringify'](_0x19584c)));rp(_0x19584c)[_0x642d('0x17')](function(_0xf0dc6e){_0x57bb21=!_[_0x642d('0x18')](_0x57bb21)?_0x642d('0x19')+_0x57bb21:'';_0x195667=typeof _0xf0dc6e[_0x642d('0x12')]==='object'?JSON[_0x642d('0x1a')](_0xf0dc6e[_0x642d('0x12')]):_0xf0dc6e[_0x642d('0x12')];logger[_0x642d('0x1b')](util[_0x642d('0x1c')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x4000ba[_0x642d('0x6')],_0x4000ba['data2'],_0xf0dc6e[_0x642d('0x1d')],_0x195667));})[_0x642d('0x1e')](function(_0x51427b){logger[_0x642d('0x13')](util[_0x642d('0x1c')](_0x642d('0x1f'),_0x4000ba['data1'],_0x4000ba[_0x642d('0x9')],_0x51427b[_0x642d('0x1d')],_0x51427b['name'],_0x51427b[_0x642d('0x20')]));});};
\ No newline at end of file
index bbed61b..31a561e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6702=['message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','then','debug','rpc','error'];(function(_0x3e0660,_0xaeaff7){var _0x45a239=function(_0x37d38d){while(--_0x37d38d){_0x3e0660['push'](_0x3e0660['shift']());}};_0x45a239(++_0xaeaff7);}(_0x6702,0x1c4));var _0x2670=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x6702[_0x25d386];return _0x857f4a;};'use strict';var jayson=require(_0x2670('0x0'));var BPromise=require(_0x2670('0x1'));var logger=require(_0x2670('0x2'))(_0x2670('0x3'));var client=jayson[_0x2670('0x4')][_0x2670('0x5')]({'port':0x2329});client['Request']=function(_0x5943f0,_0x55be75){return new BPromise(function(_0x568dd3,_0x19af7a){return client['request'](_0x5943f0,_0x55be75)[_0x2670('0x6')](function(_0x245bec){logger[_0x2670('0x7')](_0x2670('0x8'),'routing',_0x5943f0,_0x55be75,_0x245bec);if(_0x245bec[_0x2670('0x9')]){logger[_0x2670('0x9')]('rpc','routing',_0x5943f0,_0x245bec[_0x2670('0x9')][_0x2670('0xa')],_0x55be75);return _0x19af7a(_0x245bec[_0x2670('0x9')]['message']);}else{return _0x568dd3(_0x245bec[_0x2670('0xb')]);}})[_0x2670('0xc')](function(_0x5d366d){logger[_0x2670('0x9')](_0x2670('0x8'),'routing',_0x5943f0,_0x5d366d,_0x55be75);return _0x19af7a(_0x5d366d);});});};module[_0x2670('0xd')]=client;
\ No newline at end of file
+var _0xe9bc=['catch','rpc','exports','jayson/promise','bluebird','../../config/logger','routing','Request','request','then','debug','error','message','result'];(function(_0x543f87,_0x568d27){var _0x3e85ad=function(_0x1d60d1){while(--_0x1d60d1){_0x543f87['push'](_0x543f87['shift']());}};_0x3e85ad(++_0x568d27);}(_0xe9bc,0x16f));var _0xce9b=function(_0x54c655,_0x3682b7){_0x54c655=_0x54c655-0x0;var _0x2ac4d5=_0xe9bc[_0x54c655];return _0x2ac4d5;};'use strict';var jayson=require(_0xce9b('0x0'));var BPromise=require(_0xce9b('0x1'));var logger=require(_0xce9b('0x2'))(_0xce9b('0x3'));var client=jayson['client']['http']({'port':0x2329});client[_0xce9b('0x4')]=function(_0x1ae68b,_0x35734c){return new BPromise(function(_0x332915,_0x16b625){return client[_0xce9b('0x5')](_0x1ae68b,_0x35734c)[_0xce9b('0x6')](function(_0x5162c6){logger[_0xce9b('0x7')]('rpc',_0xce9b('0x3'),_0x1ae68b,_0x35734c,_0x5162c6);if(_0x5162c6[_0xce9b('0x8')]){logger[_0xce9b('0x8')]('rpc',_0xce9b('0x3'),_0x1ae68b,_0x5162c6['error'][_0xce9b('0x9')],_0x35734c);return _0x16b625(_0x5162c6[_0xce9b('0x8')][_0xce9b('0x9')]);}else{return _0x332915(_0x5162c6[_0xce9b('0xa')]);}})[_0xce9b('0xb')](function(_0x41c6c9){logger[_0xce9b('0x8')](_0xce9b('0xc'),_0xce9b('0x3'),_0x1ae68b,_0x41c6c9,_0x35734c);return _0x16b625(_0x41c6c9);});});};module[_0xce9b('0xd')]=client;
\ No newline at end of file
index daff5de..9cff47b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc36b=['./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','getSettings','loginMailFrequency','catch','error','Email\x20service\x20initialization','./server','./lib/email'];(function(_0x124101,_0x5912b9){var _0x3d444d=function(_0x418ae7){while(--_0x418ae7){_0x124101['push'](_0x124101['shift']());}};_0x3d444d(++_0x5912b9);}(_0xc36b,0x1c0));var _0xbc36=function(_0x4566db,_0x5da9a1){_0x4566db=_0x4566db-0x0;var _0x3167e6=_0xc36b[_0x4566db];return _0x3167e6;};'use strict';var server=require(_0xbc36('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xbc36('0x1'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0xbc36('0x2'));var logger=require(_0xbc36('0x3'))(_0xbc36('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xbc36('0x5')]()[_0xbc36('0x6')](mailAccount[_0xbc36('0x7')]())['then'](realtime[_0xbc36('0x8')]())['then'](function(){email[_0xbc36('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0xbc36('0x6')](function(){return setting[_0xbc36('0xa')]();})['then'](function(_0x543d00){return setInterval(initRealtime,_0x543d00[_0xbc36('0xb')]*0x3e8);})[_0xbc36('0xc')](function(_0x16ee03){logger[_0xbc36('0xd')](_0xbc36('0xe'),_0x16ee03);});}main();
\ No newline at end of file
+var _0x0846=['./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','then','getMailAccounts','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization'];(function(_0x30fa9d,_0x88c6ee){var _0x5ef4e8=function(_0x4bf428){while(--_0x4bf428){_0x30fa9d['push'](_0x30fa9d['shift']());}};_0x5ef4e8(++_0x88c6ee);}(_0x0846,0xff));var _0x6084=function(_0x559e55,_0xc7956e){_0x559e55=_0x559e55-0x0;var _0x3d39e9=_0x0846[_0x559e55];return _0x3d39e9;};'use strict';var server=require(_0x6084('0x0'));var Realtime=require(_0x6084('0x1'));var EmailChannel=require(_0x6084('0x2'));var mailAccount=require(_0x6084('0x3'));var setting=require(_0x6084('0x4'));var logger=require(_0x6084('0x5'))(_0x6084('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()[_0x6084('0x7')](mailAccount[_0x6084('0x8')]())[_0x6084('0x7')](realtime[_0x6084('0x9')]())[_0x6084('0x7')](function(){email['refresh'](realtime[_0x6084('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})[_0x6084('0x7')](function(){return setting[_0x6084('0xb')]();})[_0x6084('0x7')](function(_0x5a6220){return setInterval(initRealtime,_0x5a6220[_0x6084('0xc')]*0x3e8);})[_0x6084('0xd')](function(_0x2e7167){logger['error'](_0x6084('0xe'),_0x2e7167);});}main();
\ No newline at end of file
index 4aab1a4..dbf9912 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xae44=['New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','key','active','Imap','total','mailAccount:update','refresh','hasOwnProperty','service','custom','box','handleImapBox','handleImapEmail','bind','end','error','handleImapError','isNil','status','messageStatus','connected','messages','info'];(function(_0x370b3c,_0x1a9ed1){var _0x2cdfa8=function(_0x9d31f7){while(--_0x9d31f7){_0x370b3c['push'](_0x370b3c['shift']());}};_0x2cdfa8(++_0x1a9ed1);}(_0xae44,0x143));var _0x4ae4=function(_0xd02923,_0x7d3515){_0xd02923=_0xd02923-0x0;var _0x10ff2f=_0xae44[_0xd02923];return _0x10ff2f;};'use strict';var _=require(_0x4ae4('0x0'));var moment=require(_0x4ae4('0x1'));var BPromise=require(_0x4ae4('0x2'));var md5=require(_0x4ae4('0x3'));var Redis=require(_0x4ae4('0x4'));var config=require(_0x4ae4('0x5'));var logger=require(_0x4ae4('0x6'))(_0x4ae4('0x7'));config['redis']=_['defaults'](config[_0x4ae4('0x8')],{'host':_0x4ae4('0x9'),'port':0x18eb});var io=require(_0x4ae4('0xa'))(new Redis(config[_0x4ae4('0x8')]));var EmailImap=require(_0x4ae4('0xb'));var EmailSmtp=require(_0x4ae4('0xc'));var mailAccount=require(_0x4ae4('0xd'));var md5Accounts={};function EmailChannel(_0xb89fd8){logger['info'](_0x4ae4('0xe'));this[_0x4ae4('0xf')]=_0xb89fd8['mailAccounts'];this[_0x4ae4('0x10')]={};this[_0x4ae4('0x11')]=new EmailSmtp();}EmailChannel[_0x4ae4('0x12')][_0x4ae4('0x13')]=function(_0x5c2df7){var _0xa7f1d7=this['mailAccounts'][_0x5c2df7];var _0x3c23b9={'id':_0xa7f1d7['id'],'name':_0xa7f1d7[_0x4ae4('0x14')],'key':_0xa7f1d7[_0x4ae4('0x15')],'active':_0xa7f1d7[_0x4ae4('0x16')],'Imap':{'status':_0xa7f1d7['Imap']['status'],'messageStatus':_0xa7f1d7[_0x4ae4('0x17')]['messageStatus'],'total':_0xa7f1d7['Imap'][_0x4ae4('0x18')]}};if(_['isNil'](md5Accounts[_0x5c2df7])){md5Accounts[_0x5c2df7]={};}var _0x4f25e1=md5(JSON['stringify'](_0x3c23b9));if(md5Accounts[_0x5c2df7][_0x4ae4('0x3')]!==_0x4f25e1){md5Accounts[_0x5c2df7][_0x4ae4('0x3')]=_0x4f25e1;io[_0x4ae4('0x13')](_0x4ae4('0x19'),_0x3c23b9);}};EmailChannel[_0x4ae4('0x12')][_0x4ae4('0x1a')]=function(_0x5d2c45){for(var _0x5ac3bf in _0x5d2c45){if(_0x5d2c45[_0x4ae4('0x1b')](_0x5ac3bf)){if(_0x5d2c45[_0x5ac3bf][_0x4ae4('0x17')]&&_0x5d2c45[_0x5ac3bf][_0x4ae4('0x16')]){var _0xda6ea7=_0x5d2c45[_0x5ac3bf]['Imap'];if(!_0xda6ea7[_0x4ae4('0x1c')]&&_0x5d2c45[_0x5ac3bf]['provider']!==_0x4ae4('0x1d'))_0xda6ea7[_0x4ae4('0x1c')]=_0x5d2c45[_0x5ac3bf]['provider'];if(!this[_0x4ae4('0x10')][_0x4ae4('0x1b')](_0xda6ea7['id'])){this[_0x4ae4('0x10')][_0xda6ea7['id']]=new EmailImap(_0xda6ea7,_0x5d2c45[_0x5ac3bf][_0x4ae4('0x7')]);this[_0x4ae4('0x10')][_0xda6ea7['id']]['on'](_0x4ae4('0x1e'),this[_0x4ae4('0x1f')]['bind'](this,_0x5ac3bf));this['imapAccounts'][_0xda6ea7['id']]['on'](_0x4ae4('0x7'),this[_0x4ae4('0x20')][_0x4ae4('0x21')](this,_0x5ac3bf));this[_0x4ae4('0x10')][_0xda6ea7['id']]['on'](_0x4ae4('0x22'),this['handleImapEnd'][_0x4ae4('0x21')](this,_0x5ac3bf));this['imapAccounts'][_0xda6ea7['id']]['on'](_0x4ae4('0x23'),this[_0x4ae4('0x24')]['bind'](this,_0x5ac3bf));}}else{if(_[_0x4ae4('0x25')](this['mailAccounts'][_0x5ac3bf]['Imap'])){this[_0x4ae4('0xf')][_0x5ac3bf]['Imap']={};}this[_0x4ae4('0xf')][_0x5ac3bf][_0x4ae4('0x17')][_0x4ae4('0x26')]='disabled';this[_0x4ae4('0xf')][_0x5ac3bf]['Imap'][_0x4ae4('0x27')]='';this[_0x4ae4('0x13')](_0x5ac3bf);}}}};EmailChannel[_0x4ae4('0x12')]['handleImapBox']=function(_0x5257e2,_0x18b7fa){if(this[_0x4ae4('0xf')][_0x5257e2]){this[_0x4ae4('0xf')][_0x5257e2][_0x4ae4('0x17')][_0x4ae4('0x26')]=_0x4ae4('0x28');this[_0x4ae4('0xf')][_0x5257e2][_0x4ae4('0x17')][_0x4ae4('0x27')]=_0x18b7fa['name'];if(_0x18b7fa['messages']){this[_0x4ae4('0xf')][_0x5257e2][_0x4ae4('0x17')][_0x4ae4('0x18')]=_0x18b7fa[_0x4ae4('0x29')]['total'];}return this['emit'](_0x5257e2);}};EmailChannel[_0x4ae4('0x12')][_0x4ae4('0x20')]=function(_0x3b89b3,_0xa315ae){logger[_0x4ae4('0x2a')](_0x4ae4('0x2b'),_0xa315ae['firstName'],_0xa315ae[_0x4ae4('0x2c')],_0xa315ae[_0x4ae4('0x2d')],_0x3b89b3);if(this[_0x4ae4('0xf')][_0x3b89b3]){return mailAccount[_0x4ae4('0x2e')](_0x3b89b3,_0xa315ae)['then'](function(_0xa80cb9){if(_0xa80cb9){logger[_0x4ae4('0x2a')](_0x4ae4('0x2f'));}})[_0x4ae4('0x30')](function(_0x3c0143){logger['error'](_0x4ae4('0x31'),JSON[_0x4ae4('0x32')](_0x3c0143));});}};EmailChannel[_0x4ae4('0x12')][_0x4ae4('0x33')]=function(_0x422481){if(this[_0x4ae4('0xf')][_0x422481]&&this[_0x4ae4('0xf')][_0x422481][_0x4ae4('0x17')]){if(this[_0x4ae4('0x10')][this['mailAccounts'][_0x422481]['Imap']['id']]){delete this[_0x4ae4('0x10')][this[_0x4ae4('0xf')][_0x422481]['Imap']['id']];}this[_0x4ae4('0xf')][_0x422481][_0x4ae4('0x17')][_0x4ae4('0x34')]=moment();this[_0x4ae4('0x13')](_0x422481);}};EmailChannel[_0x4ae4('0x12')][_0x4ae4('0x24')]=function(_0x5db802,_0x1ea800){if(this['mailAccounts'][_0x5db802]){this['mailAccounts'][_0x5db802]['Imap'][_0x4ae4('0x26')]=_0x4ae4('0x23');this[_0x4ae4('0xf')][_0x5db802][_0x4ae4('0x17')][_0x4ae4('0x27')]=_0x1ea800;return this[_0x4ae4('0x13')](_0x5db802);}};EmailChannel[_0x4ae4('0x12')][_0x4ae4('0x35')]=function(_0x386234,_0x3de661){return this[_0x4ae4('0x11')][_0x4ae4('0x36')](_0x386234,_0x3de661);};EmailChannel['prototype'][_0x4ae4('0x37')]=function(_0x57d6b1){var _0x4f91e1=this;if(this[_0x4ae4('0xf')][_0x57d6b1['id']]){if(_[_0x4ae4('0x25')](this[_0x4ae4('0xf')][_0x57d6b1['id']]['Smtp'])){this[_0x4ae4('0xf')][_0x57d6b1['id']][_0x4ae4('0x38')]={};}this[_0x4ae4('0xf')][_0x57d6b1['id']][_0x4ae4('0x38')][_0x4ae4('0x34')]=moment();return new BPromise(function(_0x3157fe,_0x3d8aa6){return _0x4f91e1['smtp'][_0x4ae4('0x39')](_0x57d6b1)[_0x4ae4('0x3a')](function(_0x28b0f5){_0x4f91e1[_0x4ae4('0xf')][_0x57d6b1['id']]['Smtp'][_0x4ae4('0x26')]=_0x4ae4('0x3b');_0x4f91e1[_0x4ae4('0xf')][_0x57d6b1['id']][_0x4ae4('0x38')][_0x4ae4('0x27')]='';_0x4f91e1['emit'](_0x57d6b1['id']);_0x3157fe(_0x28b0f5);})[_0x4ae4('0x30')](function(_0x171f7d){_0x4f91e1[_0x4ae4('0xf')][_0x57d6b1['id']]['Smtp'][_0x4ae4('0x26')]=_0x4ae4('0x23');_0x4f91e1[_0x4ae4('0xf')][_0x57d6b1['id']][_0x4ae4('0x38')][_0x4ae4('0x27')]=_0x171f7d;_0x4f91e1['emit'](_0x57d6b1['id']);_0x3d8aa6(_0x171f7d);});});}return this[_0x4ae4('0x11')][_0x4ae4('0x39')](_0x57d6b1);};module[_0x4ae4('0x3c')]=EmailChannel;
\ No newline at end of file
+var _0x3473=['../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','key','active','Imap','messageStatus','total','isNil','stringify','emit','hasOwnProperty','service','provider','custom','imapAccounts','box','bind','handleImapEmail','end','handleImapEnd','status','disabled','handleImapBox','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verify','then','verified','exports','lodash','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','defaults','localhost','socket.io-emitter','redis','./imap','./smtp'];(function(_0x48a5f5,_0x4328b9){var _0x18586a=function(_0x282c43){while(--_0x282c43){_0x48a5f5['push'](_0x48a5f5['shift']());}};_0x18586a(++_0x4328b9);}(_0x3473,0x19e));var _0x3347=function(_0xd5584e,_0x251c06){_0xd5584e=_0xd5584e-0x0;var _0xdc594e=_0x3473[_0xd5584e];return _0xdc594e;};'use strict';var _=require(_0x3347('0x0'));var moment=require(_0x3347('0x1'));var BPromise=require(_0x3347('0x2'));var md5=require(_0x3347('0x3'));var Redis=require('ioredis');var config=require(_0x3347('0x4'));var logger=require(_0x3347('0x5'))(_0x3347('0x6'));config['redis']=_[_0x3347('0x7')](config['redis'],{'host':_0x3347('0x8'),'port':0x18eb});var io=require(_0x3347('0x9'))(new Redis(config[_0x3347('0xa')]));var EmailImap=require(_0x3347('0xb'));var EmailSmtp=require(_0x3347('0xc'));var mailAccount=require(_0x3347('0xd'));var md5Accounts={};function EmailChannel(_0x1cc776){logger[_0x3347('0xe')](_0x3347('0xf'));this[_0x3347('0x10')]=_0x1cc776[_0x3347('0x10')];this['imapAccounts']={};this[_0x3347('0x11')]=new EmailSmtp();}EmailChannel[_0x3347('0x12')]['emit']=function(_0x29257b){var _0x3decea=this[_0x3347('0x10')][_0x29257b];var _0x2ca0b9={'id':_0x3decea['id'],'name':_0x3decea[_0x3347('0x13')],'key':_0x3decea[_0x3347('0x14')],'active':_0x3decea[_0x3347('0x15')],'Imap':{'status':_0x3decea[_0x3347('0x16')]['status'],'messageStatus':_0x3decea[_0x3347('0x16')][_0x3347('0x17')],'total':_0x3decea[_0x3347('0x16')][_0x3347('0x18')]}};if(_[_0x3347('0x19')](md5Accounts[_0x29257b])){md5Accounts[_0x29257b]={};}var _0x530f7c=md5(JSON[_0x3347('0x1a')](_0x2ca0b9));if(md5Accounts[_0x29257b]['md5']!==_0x530f7c){md5Accounts[_0x29257b][_0x3347('0x3')]=_0x530f7c;io[_0x3347('0x1b')]('mailAccount:update',_0x2ca0b9);}};EmailChannel['prototype']['refresh']=function(_0xaab373){for(var _0x8ddbe9 in _0xaab373){if(_0xaab373[_0x3347('0x1c')](_0x8ddbe9)){if(_0xaab373[_0x8ddbe9][_0x3347('0x16')]&&_0xaab373[_0x8ddbe9][_0x3347('0x15')]){var _0x3a52f5=_0xaab373[_0x8ddbe9][_0x3347('0x16')];if(!_0x3a52f5[_0x3347('0x1d')]&&_0xaab373[_0x8ddbe9][_0x3347('0x1e')]!==_0x3347('0x1f'))_0x3a52f5[_0x3347('0x1d')]=_0xaab373[_0x8ddbe9]['provider'];if(!this[_0x3347('0x20')][_0x3347('0x1c')](_0x3a52f5['id'])){this['imapAccounts'][_0x3a52f5['id']]=new EmailImap(_0x3a52f5,_0xaab373[_0x8ddbe9][_0x3347('0x6')]);this[_0x3347('0x20')][_0x3a52f5['id']]['on'](_0x3347('0x21'),this['handleImapBox'][_0x3347('0x22')](this,_0x8ddbe9));this['imapAccounts'][_0x3a52f5['id']]['on'](_0x3347('0x6'),this[_0x3347('0x23')][_0x3347('0x22')](this,_0x8ddbe9));this['imapAccounts'][_0x3a52f5['id']]['on'](_0x3347('0x24'),this[_0x3347('0x25')][_0x3347('0x22')](this,_0x8ddbe9));this[_0x3347('0x20')][_0x3a52f5['id']]['on']('error',this['handleImapError'][_0x3347('0x22')](this,_0x8ddbe9));}}else{if(_['isNil'](this['mailAccounts'][_0x8ddbe9][_0x3347('0x16')])){this[_0x3347('0x10')][_0x8ddbe9][_0x3347('0x16')]={};}this[_0x3347('0x10')][_0x8ddbe9]['Imap'][_0x3347('0x26')]=_0x3347('0x27');this[_0x3347('0x10')][_0x8ddbe9][_0x3347('0x16')]['messageStatus']='';this[_0x3347('0x1b')](_0x8ddbe9);}}}};EmailChannel[_0x3347('0x12')][_0x3347('0x28')]=function(_0x4a1414,_0x12b24e){if(this[_0x3347('0x10')][_0x4a1414]){this[_0x3347('0x10')][_0x4a1414][_0x3347('0x16')][_0x3347('0x26')]=_0x3347('0x29');this[_0x3347('0x10')][_0x4a1414][_0x3347('0x16')][_0x3347('0x17')]=_0x12b24e['name'];if(_0x12b24e[_0x3347('0x2a')]){this[_0x3347('0x10')][_0x4a1414][_0x3347('0x16')][_0x3347('0x18')]=_0x12b24e['messages'][_0x3347('0x18')];}return this['emit'](_0x4a1414);}};EmailChannel[_0x3347('0x12')][_0x3347('0x23')]=function(_0x523bd2,_0x406ad7){logger[_0x3347('0xe')](_0x3347('0x2b'),_0x406ad7['firstName'],_0x406ad7[_0x3347('0x2c')],_0x406ad7[_0x3347('0x2d')],_0x523bd2);if(this[_0x3347('0x10')][_0x523bd2]){return mailAccount[_0x3347('0x2e')](_0x523bd2,_0x406ad7)['then'](function(_0x4f0e36){if(_0x4f0e36){logger['info'](_0x3347('0x2f'));}})[_0x3347('0x30')](function(_0x137fc9){logger[_0x3347('0x31')](_0x3347('0x32'),JSON[_0x3347('0x1a')](_0x137fc9));});}};EmailChannel[_0x3347('0x12')][_0x3347('0x25')]=function(_0x229c8e){if(this[_0x3347('0x10')][_0x229c8e]&&this[_0x3347('0x10')][_0x229c8e][_0x3347('0x16')]){if(this[_0x3347('0x20')][this[_0x3347('0x10')][_0x229c8e][_0x3347('0x16')]['id']]){delete this[_0x3347('0x20')][this['mailAccounts'][_0x229c8e][_0x3347('0x16')]['id']];}this['mailAccounts'][_0x229c8e]['Imap'][_0x3347('0x33')]=moment();this[_0x3347('0x1b')](_0x229c8e);}};EmailChannel['prototype'][_0x3347('0x34')]=function(_0x2ada0d,_0x42f5ee){if(this['mailAccounts'][_0x2ada0d]){this['mailAccounts'][_0x2ada0d][_0x3347('0x16')][_0x3347('0x26')]='error';this['mailAccounts'][_0x2ada0d]['Imap'][_0x3347('0x17')]=_0x42f5ee;return this['emit'](_0x2ada0d);}};EmailChannel[_0x3347('0x12')][_0x3347('0x35')]=function(_0x4fae28,_0x40b933){return this['smtp'][_0x3347('0x36')](_0x4fae28,_0x40b933);};EmailChannel['prototype'][_0x3347('0x37')]=function(_0x54f478){var _0x25585e=this;if(this[_0x3347('0x10')][_0x54f478['id']]){if(_[_0x3347('0x19')](this[_0x3347('0x10')][_0x54f478['id']]['Smtp'])){this[_0x3347('0x10')][_0x54f478['id']][_0x3347('0x38')]={};}this['mailAccounts'][_0x54f478['id']][_0x3347('0x38')][_0x3347('0x33')]=moment();return new BPromise(function(_0x1c1421,_0x5231ce){return _0x25585e['smtp'][_0x3347('0x39')](_0x54f478)[_0x3347('0x3a')](function(_0x21e6f0){_0x25585e[_0x3347('0x10')][_0x54f478['id']]['Smtp'][_0x3347('0x26')]=_0x3347('0x3b');_0x25585e[_0x3347('0x10')][_0x54f478['id']][_0x3347('0x38')]['messageStatus']='';_0x25585e[_0x3347('0x1b')](_0x54f478['id']);_0x1c1421(_0x21e6f0);})['catch'](function(_0x466949){_0x25585e['mailAccounts'][_0x54f478['id']][_0x3347('0x38')][_0x3347('0x26')]='error';_0x25585e[_0x3347('0x10')][_0x54f478['id']][_0x3347('0x38')][_0x3347('0x17')]=_0x466949;_0x25585e['emit'](_0x54f478['id']);_0x5231ce(_0x466949);});});}return this[_0x3347('0x11')][_0x3347('0x39')](_0x54f478);};module[_0x3347('0x3c')]=EmailChannel;
\ No newline at end of file
index 7540e34..f8b701b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x307f=['handleReadUnseen','length','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','body','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','email','stringify','textCode','hasOwnProperty','upperFirst','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','mailbox','account','getAccount','once','ready','bind','end','handleEnd','error','handleError','connect','connTimeout','service','user','modernAuthentication','generateXOAuth2Token','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls','required','prototype','handleReady','handleOpenBox','emit','box','readUnseen','handleCloseBox','search'];(function(_0x131034,_0x114afd){var _0x1db1c4=function(_0x7ea96){while(--_0x7ea96){_0x131034['push'](_0x131034['shift']());}};_0x1db1c4(++_0x114afd);}(_0x307f,0xf9));var _0xf307=function(_0xd11ada,_0x4244e5){_0xd11ada=_0xd11ada-0x0;var _0x199e5d=_0x307f[_0xd11ada];return _0x199e5d;};'use strict';var _=require('lodash');var util=require('util');var Imap=require(_0xf307('0x0'));var simpleParser=require(_0xf307('0x1'))[_0xf307('0x2')];var Iconv=require(_0xf307('0x3'))[_0xf307('0x4')];var EventEmitter=require(_0xf307('0x5'))['EventEmitter'];var utils=require(_0xf307('0x6'));var logger=require(_0xf307('0x7'))('email');function EmailImap(_0x36227e,_0x16c768){this[_0xf307('0x8')]=_0x36227e[_0xf307('0x8')];this[_0xf307('0x9')]=this[_0xf307('0xa')](_0x36227e,_0x16c768);this['imap']=new Imap(this['account']);this[_0xf307('0x0')][_0xf307('0xb')](_0xf307('0xc'),this['handleReady'][_0xf307('0xd')](this));this[_0xf307('0x0')][_0xf307('0xb')](_0xf307('0xe'),this[_0xf307('0xf')][_0xf307('0xd')](this));this['imap']['on'](_0xf307('0x10'),this[_0xf307('0x11')]['bind'](this));this[_0xf307('0x0')][_0xf307('0x12')]();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xf307('0xa')]=function(_0x1fbed5,_0x1b1fa2){var _0x30e3be={'connTimeout':_0x1fbed5[_0xf307('0x13')]?_0x1fbed5[_0xf307('0x13')]*0x3e8:0x2710,'authTimeout':_0x1fbed5['authTimeout']?_0x1fbed5['authTimeout']*0x3e8:0x1388};if(_0x1fbed5[_0xf307('0x14')]){_0x30e3be[_0xf307('0x15')]=_0x1fbed5['user'];if(_0x1fbed5[_0xf307('0x16')]){_0x30e3be['xoauth2']=utils[_0xf307('0x17')](_0x1fbed5['CloudProvider'][_0xf307('0x18')],_0x1fbed5[_0xf307('0x15')]);}else{_0x30e3be[_0xf307('0x19')]=_0x1fbed5[_0xf307('0x19')];}}else{if(_0x1fbed5[_0xf307('0x1a')]){_0x30e3be[_0xf307('0x15')]=_0x1fbed5[_0xf307('0x15')];_0x30e3be[_0xf307('0x19')]=_0x1fbed5[_0xf307('0x19')];}}_0x30e3be['email']=_0x1b1fa2||_0x1fbed5[_0xf307('0x15')]||_0xf307('0x1b');_0x30e3be[_0xf307('0x1c')]=_0x1fbed5[_0xf307('0x1c')];_0x30e3be[_0xf307('0x1d')]=_0x1fbed5['port']||0x3e1;if(_0x1fbed5[_0xf307('0x1e')]){_0x30e3be[_0xf307('0x1e')]=!![];}else{_0x30e3be[_0xf307('0x1e')]=![];_0x30e3be[_0xf307('0x1f')]=_0xf307('0x20');}return _0x30e3be;};EmailImap[_0xf307('0x21')][_0xf307('0x22')]=function(){this[_0xf307('0x0')]['openBox'](this[_0xf307('0x8')],![],this[_0xf307('0x23')]['bind'](this));};EmailImap['prototype'][_0xf307('0x23')]=function(_0x274667,_0x5b77a2){if(_0x274667){this[_0xf307('0x11')](_0x274667,!![]);}else{this[_0xf307('0x24')](_0xf307('0x25'),_0x5b77a2);this[_0xf307('0x26')]();}};EmailImap[_0xf307('0x21')][_0xf307('0x27')]=function(_0x33ad05){if(_0x33ad05){this[_0xf307('0x11')](_0x33ad05,!![]);}else{this[_0xf307('0x0')][_0xf307('0xe')]();}};EmailImap[_0xf307('0x21')][_0xf307('0x26')]=function(){this[_0xf307('0x0')][_0xf307('0x28')](['UNSEEN'],this['handleReadUnseen'][_0xf307('0xd')](this));};EmailImap['prototype'][_0xf307('0x29')]=function(_0x35e554,_0xffc0f8){if(_0x35e554){this[_0xf307('0x11')](_0x35e554,!![]);}else{if(_0xffc0f8[_0xf307('0x2a')]){try{var _0x31ad4b=this[_0xf307('0x0')][_0xf307('0x2b')](_0xffc0f8,{'bodies':'','markSeen':!![]});_0x31ad4b['on']('message',this[_0xf307('0x2c')][_0xf307('0xd')](this));_0x31ad4b[_0xf307('0xb')]('error',this[_0xf307('0x2d')]['bind'](this));_0x31ad4b[_0xf307('0xb')](_0xf307('0xe'),this[_0xf307('0x2e')]['bind'](this));}catch(_0x3285d9){logger[_0xf307('0x10')](_0x3285d9);}}else{this[_0xf307('0x0')][_0xf307('0x2f')](!![],this['handleCloseBox'][_0xf307('0xd')](this));}}};EmailImap[_0xf307('0x21')][_0xf307('0x2c')]=function(_0xa8ca64){_0xa8ca64['on'](_0xf307('0x30'),this['handleMessageBody'][_0xf307('0xd')](this));_0xa8ca64[_0xf307('0xb')](_0xf307('0x31'),this[_0xf307('0x32')][_0xf307('0xd')](this));_0xa8ca64['once'](_0xf307('0xe'),this[_0xf307('0x33')][_0xf307('0xd')](this));};EmailImap['prototype']['handleMessageBody']=function(_0x256edc){simpleParser(_0x256edc,{'Iconv':Iconv},this[_0xf307('0x34')][_0xf307('0xd')](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0xf307('0x21')][_0xf307('0x33')]=function(){};EmailImap['prototype']['handleSimpleParser']=function(_0x1d6170,_0x55be8d){if(_0x1d6170){logger['error'](_0x1d6170);}else{var _0x4dda1e=this;utils['parser'](this['account'],_0x55be8d,function(_0xfa0726){_0x4dda1e['emit'](_0xf307('0x35'),_0xfa0726);});}};EmailImap[_0xf307('0x21')][_0xf307('0x2e')]=function(){this[_0xf307('0x0')][_0xf307('0x2f')](!![],this['handleCloseBox'][_0xf307('0xd')](this));};EmailImap[_0xf307('0x21')][_0xf307('0x2d')]=function(_0x12990f){this['handleError'](_0x12990f);this[_0xf307('0x0')][_0xf307('0x2f')](!![],this[_0xf307('0x27')][_0xf307('0xd')](this));};EmailImap['prototype'][_0xf307('0xf')]=function(){this[_0xf307('0x24')](_0xf307('0xe'));};EmailImap['prototype'][_0xf307('0x11')]=function(_0x3dd327,_0x30fc8e){logger[_0xf307('0x10')](_0xf307('0x11'),this[_0xf307('0x9')]['email'],JSON[_0xf307('0x36')](_0x3dd327));var _0x357f6d='';if(_0x3dd327){if(_0x3dd327[_0xf307('0x37')]){_0x357f6d=_0x3dd327[_0xf307('0x37')];}else{for(var _0x11269a in _0x3dd327){if(_0x3dd327[_0xf307('0x38')](_0x11269a)){_0x357f6d+=_[_0xf307('0x39')](_0x11269a)+':\x20'+_0x3dd327[_0x11269a]+'\x0a';}}}}if(_0x30fc8e){this['imap'][_0xf307('0xe')]();}else{this[_0xf307('0x24')](_0xf307('0x10'),_0x357f6d);this[_0xf307('0x24')]('end');}};module['exports']=EmailImap;
\ No newline at end of file
+var _0xba39=['handleSimpleParser','handleMessageEnd','parser','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','data5','password','authentication','email','anonymous@xcally.com','host','tls','autotls','required','emit','box','readUnseen','handleCloseBox','search','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','error','closeBox','body','attributes','handleMessageAttributes','handleMessageBody'];(function(_0x270bda,_0x1993ed){var _0x594eb0=function(_0x35f7ea){while(--_0x35f7ea){_0x270bda['push'](_0x270bda['shift']());}};_0x594eb0(++_0x1993ed);}(_0xba39,0xfb));var _0x9ba3=function(_0x27355e,_0x33f2fa){_0x27355e=_0x27355e-0x0;var _0x3d40d8=_0xba39[_0x27355e];return _0x3d40d8;};'use strict';var _=require(_0x9ba3('0x0'));var util=require(_0x9ba3('0x1'));var Imap=require(_0x9ba3('0x2'));var simpleParser=require(_0x9ba3('0x3'))[_0x9ba3('0x4')];var Iconv=require('iconv')[_0x9ba3('0x5')];var EventEmitter=require(_0x9ba3('0x6'))[_0x9ba3('0x7')];var utils=require(_0x9ba3('0x8'));var logger=require(_0x9ba3('0x9'))('email');function EmailImap(_0x4551f6,_0x19e166){this['mailbox']=_0x4551f6[_0x9ba3('0xa')];this[_0x9ba3('0xb')]=this[_0x9ba3('0xc')](_0x4551f6,_0x19e166);this['imap']=new Imap(this[_0x9ba3('0xb')]);this[_0x9ba3('0x2')]['once'](_0x9ba3('0xd'),this[_0x9ba3('0xe')][_0x9ba3('0xf')](this));this['imap'][_0x9ba3('0x10')](_0x9ba3('0x11'),this[_0x9ba3('0x12')][_0x9ba3('0xf')](this));this['imap']['on']('error',this[_0x9ba3('0x13')][_0x9ba3('0xf')](this));this[_0x9ba3('0x2')]['connect']();}util[_0x9ba3('0x14')](EmailImap,EventEmitter);EmailImap[_0x9ba3('0x15')][_0x9ba3('0xc')]=function(_0x5ac382,_0x40c0bf){var _0x24740c={'connTimeout':_0x5ac382[_0x9ba3('0x16')]?_0x5ac382[_0x9ba3('0x16')]*0x3e8:0x2710,'authTimeout':_0x5ac382['authTimeout']?_0x5ac382[_0x9ba3('0x17')]*0x3e8:0x1388};if(_0x5ac382[_0x9ba3('0x18')]){_0x24740c[_0x9ba3('0x19')]=_0x5ac382[_0x9ba3('0x19')];if(_0x5ac382[_0x9ba3('0x1a')]){_0x24740c[_0x9ba3('0x1b')]=utils['generateXOAuth2Token'](_0x5ac382[_0x9ba3('0x1c')][_0x9ba3('0x1d')],_0x5ac382[_0x9ba3('0x19')]);}else{_0x24740c[_0x9ba3('0x1e')]=_0x5ac382[_0x9ba3('0x1e')];}}else{if(_0x5ac382[_0x9ba3('0x1f')]){_0x24740c[_0x9ba3('0x19')]=_0x5ac382[_0x9ba3('0x19')];_0x24740c[_0x9ba3('0x1e')]=_0x5ac382[_0x9ba3('0x1e')];}}_0x24740c[_0x9ba3('0x20')]=_0x40c0bf||_0x5ac382['user']||_0x9ba3('0x21');_0x24740c[_0x9ba3('0x22')]=_0x5ac382['host'];_0x24740c['port']=_0x5ac382['port']||0x3e1;if(_0x5ac382[_0x9ba3('0x23')]){_0x24740c[_0x9ba3('0x23')]=!![];}else{_0x24740c[_0x9ba3('0x23')]=![];_0x24740c[_0x9ba3('0x24')]=_0x9ba3('0x25');}return _0x24740c;};EmailImap[_0x9ba3('0x15')][_0x9ba3('0xe')]=function(){this[_0x9ba3('0x2')]['openBox'](this['mailbox'],![],this['handleOpenBox']['bind'](this));};EmailImap[_0x9ba3('0x15')]['handleOpenBox']=function(_0x36ea30,_0x167d1e){if(_0x36ea30){this[_0x9ba3('0x13')](_0x36ea30,!![]);}else{this[_0x9ba3('0x26')](_0x9ba3('0x27'),_0x167d1e);this[_0x9ba3('0x28')]();}};EmailImap['prototype'][_0x9ba3('0x29')]=function(_0x4d017b){if(_0x4d017b){this['handleError'](_0x4d017b,!![]);}else{this[_0x9ba3('0x2')][_0x9ba3('0x11')]();}};EmailImap[_0x9ba3('0x15')]['readUnseen']=function(){this[_0x9ba3('0x2')][_0x9ba3('0x2a')](['UNSEEN'],this['handleReadUnseen']['bind'](this));};EmailImap[_0x9ba3('0x15')]['handleReadUnseen']=function(_0x304951,_0x51464a){if(_0x304951){this[_0x9ba3('0x13')](_0x304951,!![]);}else{if(_0x51464a[_0x9ba3('0x2b')]){try{var _0x2a2b72=this[_0x9ba3('0x2')]['fetch'](_0x51464a,{'bodies':'','markSeen':!![]});_0x2a2b72['on'](_0x9ba3('0x2c'),this[_0x9ba3('0x2d')][_0x9ba3('0xf')](this));_0x2a2b72[_0x9ba3('0x10')]('error',this[_0x9ba3('0x2e')]['bind'](this));_0x2a2b72[_0x9ba3('0x10')](_0x9ba3('0x11'),this[_0x9ba3('0x2f')]['bind'](this));}catch(_0x239a53){logger[_0x9ba3('0x30')](_0x239a53);}}else{this['imap'][_0x9ba3('0x31')](!![],this[_0x9ba3('0x29')][_0x9ba3('0xf')](this));}}};EmailImap['prototype'][_0x9ba3('0x2d')]=function(_0x886e0c){_0x886e0c['on'](_0x9ba3('0x32'),this['handleMessageBody']['bind'](this));_0x886e0c[_0x9ba3('0x10')](_0x9ba3('0x33'),this[_0x9ba3('0x34')][_0x9ba3('0xf')](this));_0x886e0c[_0x9ba3('0x10')](_0x9ba3('0x11'),this['handleMessageEnd']['bind'](this));};EmailImap[_0x9ba3('0x15')][_0x9ba3('0x35')]=function(_0x2d4c01){simpleParser(_0x2d4c01,{'Iconv':Iconv},this[_0x9ba3('0x36')][_0x9ba3('0xf')](this));};EmailImap[_0x9ba3('0x15')][_0x9ba3('0x34')]=function(){};EmailImap['prototype'][_0x9ba3('0x37')]=function(){};EmailImap[_0x9ba3('0x15')][_0x9ba3('0x36')]=function(_0x5bb73c,_0x5a8903){if(_0x5bb73c){logger['error'](_0x5bb73c);}else{var _0x3aa197=this;utils[_0x9ba3('0x38')](this[_0x9ba3('0xb')],_0x5a8903,function(_0x5481b4){_0x3aa197[_0x9ba3('0x26')](_0x9ba3('0x20'),_0x5481b4);});}};EmailImap[_0x9ba3('0x15')]['handleFetchEnd']=function(){this[_0x9ba3('0x2')][_0x9ba3('0x31')](!![],this[_0x9ba3('0x29')][_0x9ba3('0xf')](this));};EmailImap[_0x9ba3('0x15')]['handleFetchError']=function(_0x20e12d){this[_0x9ba3('0x13')](_0x20e12d);this[_0x9ba3('0x2')][_0x9ba3('0x31')](!![],this['handleCloseBox'][_0x9ba3('0xf')](this));};EmailImap[_0x9ba3('0x15')]['handleEnd']=function(){this[_0x9ba3('0x26')](_0x9ba3('0x11'));};EmailImap[_0x9ba3('0x15')][_0x9ba3('0x13')]=function(_0x460f09,_0x1a9a0a){logger['error'](_0x9ba3('0x13'),this['account'][_0x9ba3('0x20')],JSON[_0x9ba3('0x39')](_0x460f09));var _0x5c8f29='';if(_0x460f09){if(_0x460f09[_0x9ba3('0x3a')]){_0x5c8f29=_0x460f09[_0x9ba3('0x3a')];}else{for(var _0x43a010 in _0x460f09){if(_0x460f09[_0x9ba3('0x3b')](_0x43a010)){_0x5c8f29+=_['upperFirst'](_0x43a010)+':\x20'+_0x460f09[_0x43a010]+'\x0a';}}}}if(_0x1a9a0a){this[_0x9ba3('0x2')][_0x9ba3('0x11')]();}else{this[_0x9ba3('0x26')](_0x9ba3('0x30'),_0x5c8f29);this[_0x9ba3('0x26')]('end');}};module[_0x9ba3('0x3c')]=EmailImap;
\ No newline at end of file
index a68e9c6..8b74940 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0cc2=['toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype','send','use','compile','sendMail'];(function(_0x41ed58,_0x38d9bd){var _0x24c55f=function(_0x32948d){while(--_0x32948d){_0x41ed58['push'](_0x41ed58['shift']());}};_0x24c55f(++_0x38d9bd);}(_0x0cc2,0x1cf));var _0x20cc=function(_0x33a52a,_0x1688da){_0x33a52a=_0x33a52a-0x0;var _0x28e1f6=_0x0cc2[_0x33a52a];return _0x28e1f6;};'use strict';var nodemailer=require(_0x20cc('0x0'));var inlineBase64=require(_0x20cc('0x1'));function EmailSmtp(){}EmailSmtp[_0x20cc('0x2')][_0x20cc('0x3')]=function(_0x2002a0,_0x74de68){return new Promise(function(_0x3ce57a,_0x51e2b6){var _0x2fcf32=nodemailer['createTransport'](_0x2002a0);_0x2fcf32[_0x20cc('0x4')](_0x20cc('0x5'),inlineBase64());_0x2fcf32[_0x20cc('0x6')](_0x74de68,function(_0x3d622d,_0x4ae3d3){if(_0x3d622d){_0x51e2b6(_0x3d622d[_0x20cc('0x7')]());}else{_0x3ce57a(_0x4ae3d3);}});});};EmailSmtp[_0x20cc('0x2')][_0x20cc('0x8')]=function(_0x37405e){return new Promise(function(_0x2a501f,_0x556282){var _0x41cc1a=nodemailer['createTransport'](_0x37405e);_0x41cc1a['verify'](function(_0xd3b18f,_0x46cc60){if(_0xd3b18f){_0x556282(_0xd3b18f[_0x20cc('0x7')]());}else{if(_0x46cc60){_0x2a501f(_0x46cc60);}else{_0x556282(_0x20cc('0x9'));}}});});};module['exports']=EmailSmtp;
\ No newline at end of file
+var _0xe8a7=['send','createTransport','use','compile','sendMail','verify','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x388d01,_0x490fca){var _0x59b425=function(_0x5ccad6){while(--_0x5ccad6){_0x388d01['push'](_0x388d01['shift']());}};_0x59b425(++_0x490fca);}(_0xe8a7,0x110));var _0x7e8a=function(_0x4f6a8e,_0x2ca44b){_0x4f6a8e=_0x4f6a8e-0x0;var _0xdc60ce=_0xe8a7[_0x4f6a8e];return _0xdc60ce;};'use strict';var nodemailer=require(_0x7e8a('0x0'));var inlineBase64=require(_0x7e8a('0x1'));function EmailSmtp(){}EmailSmtp[_0x7e8a('0x2')][_0x7e8a('0x3')]=function(_0x389401,_0x3161c7){return new Promise(function(_0x38a64a,_0x489a34){var _0x2c73d5=nodemailer[_0x7e8a('0x4')](_0x389401);_0x2c73d5[_0x7e8a('0x5')](_0x7e8a('0x6'),inlineBase64());_0x2c73d5[_0x7e8a('0x7')](_0x3161c7,function(_0x287a21,_0x27c0d2){if(_0x287a21){_0x489a34(_0x287a21['toString']());}else{_0x38a64a(_0x27c0d2);}});});};EmailSmtp[_0x7e8a('0x2')]['verify']=function(_0xd528e1){return new Promise(function(_0x2baf9d,_0x5a2e90){var _0x2cd870=nodemailer['createTransport'](_0xd528e1);_0x2cd870[_0x7e8a('0x8')](function(_0x9210cc,_0x196e35){if(_0x9210cc){_0x5a2e90(_0x9210cc['toString']());}else{if(_0x196e35){_0x2baf9d(_0x196e35);}else{_0x5a2e90(_0x7e8a('0x9'));}}});});};module[_0x7e8a('0xa')]=EmailSmtp;
\ No newline at end of file
index 6e07498..65fb8ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6639=['\x20]</span>','body','textAsHtml','<a\x20target=\x22_blank\x22\x20','message','originCc','bcc','attachments','attach','type','attachment','%s-%s','now','join','root','server/files/attachments/','writeFileSync','content','push','contentType','headerLines','X-Auto-Response-Suppress:\x20All','indexOf','line','isAutoreply','parser','from','subject','messageId','date','format','YYYY-MM-DD\x20HH:mm:ss','filter','info','first','BodyHTML','<p>Empty\x20message</p>','Attachments','Data','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','Anonymous','pop','isEmpty','test','html','replace','includes','<img','forEach','filename','_SRC','_IMG','<span\x20style=font-weight:bold>\x20[Attachment:\x20'];(function(_0xe7f2c0,_0xe6b85e){var _0x50cd12=function(_0x319063){while(--_0x319063){_0xe7f2c0['push'](_0xe7f2c0['shift']());}};_0x50cd12(++_0xe6b85e);}(_0x6639,0x77));var _0x9663=function(_0x392ca7,_0x414fda){_0x392ca7=_0x392ca7-0x0;var _0x437b50=_0x6639[_0x392ca7];return _0x437b50;};'use strict';var _=require(_0x9663('0x0'));var moment=require(_0x9663('0x1'));var random=require(_0x9663('0x2'));var fs=require('fs');var path=require(_0x9663('0x3'));var util=require(_0x9663('0x4'));var tnef=require(_0x9663('0x5'));var logger=require(_0x9663('0x6'))(_0x9663('0x7'));var config=require('../../../config/environment');function getAddress(_0x3761c0){var _0x274bf6=_[_0x9663('0x8')](_0x3761c0[_0x9663('0x9')]);return _0x274bf6&&_0x274bf6['address']?_0x274bf6[_0x9663('0xa')]:_0x9663('0xb')+random[_0x9663('0xc')](0x6)+_0x9663('0xd');}function getFirstName(_0x35481a){var _0x15969a=_[_0x9663('0x8')](_0x35481a[_0x9663('0x9')]);if(_0x15969a&&_0x15969a[_0x9663('0xe')]){if(_0x15969a[_0x9663('0xe')]==_0x15969a[_0x9663('0xa')]){return _0x15969a[_0x9663('0xe')][_0x9663('0xf')](0x0,_0x15969a[_0x9663('0xe')]['indexOf']('@'));}var _0x2af60d=_0x15969a[_0x9663('0xe')][_0x9663('0x10')](/\s+/);return _0x2af60d[_0x9663('0x11')]>0x1?_0x2af60d['slice'](0x0,-0x1)['join']('\x20'):_0x15969a[_0x9663('0xe')];}return _0x9663('0x12');}function getLastName(_0x34f90c){var _0x591b2f=_['head'](_0x34f90c['value']);if(_0x591b2f&&_0x591b2f['name']){var _0x303a65=_0x591b2f[_0x9663('0xe')][_0x9663('0x10')](/\s+/);return _0x303a65[_0x9663('0x11')]>0x1?_0x303a65[_0x9663('0x13')]():'';}return'';}function getMails(_0x524708,_0x421dd9){var _0x5919f5='';for(var _0xebc566=0x0;_0xebc566<_0x421dd9[_0x9663('0x9')][_0x9663('0x11')];_0xebc566+=0x1){if(_0x421dd9[_0x9663('0x9')][_0xebc566]['address']!==_0x524708){if(!_[_0x9663('0x14')](_0x5919f5)){_0x5919f5+=',';}_0x5919f5+=_0x421dd9[_0x9663('0x9')][_0xebc566]['name']||_0x421dd9[_0x9663('0x9')][_0xebc566]['address']||'';_0x5919f5+='\x20<';_0x5919f5+=_0x421dd9[_0x9663('0x9')][_0xebc566]['address']?_0x421dd9[_0x9663('0x9')][_0xebc566][_0x9663('0xa')]:_0x9663('0xb')+random['generate'](0x6)+_0x9663('0xd');_0x5919f5+='>';}}return _0x5919f5;}function parseEmail(_0x21443d,_0xdfa985,_0x460dc6){if(_0xdfa985['html']){var _0x4472da=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;while(_0x4472da[_0x9663('0x15')](_0xdfa985[_0x9663('0x16')])){_0xdfa985[_0x9663('0x16')]=_0xdfa985[_0x9663('0x16')][_0x9663('0x17')](_0x4472da,'');}if(_0xdfa985[_0x9663('0x16')][_0x9663('0x18')](_0x9663('0x19'))){var _0x40f96a=[];_0xdfa985['attachments'][_0x9663('0x1a')](_0x405b9f=>{_0x40f96a['push'](_0x405b9f[_0x9663('0x1b')]);});var _0x17a21d=/<img.*? _SRC(.*?)[^>]+>/g;var _0x302359=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x800b0f=_0xdfa985[_0x9663('0x16')][_0x9663('0x17')](_0x302359,_0x9663('0x1c'));var _0x59978a=_0x800b0f[_0x9663('0x17')](_0x17a21d,_0x9663('0x1d'));for(let _0x5933cc=0x0;_0x5933cc<_0x40f96a[_0x9663('0x11')];_0x5933cc++){var _0x1987fa=_0x59978a[_0x9663('0x17')](_0x9663('0x1d'),_0x9663('0x1e')+_0x40f96a[_0x5933cc]+_0x9663('0x1f'));_0x59978a=_0x1987fa;}_0xdfa985[_0x9663('0x16')]=_0x59978a;}_0x460dc6['body']=_0xdfa985[_0x9663('0x16')];}else{_0x460dc6[_0x9663('0x20')]=_0xdfa985[_0x9663('0x21')];}if(_0x460dc6['body']){_0x460dc6[_0x9663('0x20')]=_0x460dc6['body']['replace'](/<a\s+/gi,_0x9663('0x22'));}if(_0xdfa985['to']){_0x460dc6['message']['originTo']=getMails(null,_0xdfa985['to']);var _0x559b32=getMails(_0x21443d[_0x9663('0x7')],_0xdfa985['to']);if(!_[_0x9663('0x14')](_0x559b32)){_0x460dc6[_0x9663('0x23')]['cc']+=_0x559b32;}}if(_0xdfa985['cc']){_0x460dc6[_0x9663('0x23')][_0x9663('0x24')]=getMails(null,_0xdfa985['cc']);var _0x44d259=getMails(_0x21443d['email'],_0xdfa985['cc']);if(!_[_0x9663('0x14')](_0x44d259)){if(!_[_0x9663('0x14')](_0x460dc6[_0x9663('0x23')]['cc'])){_0x460dc6['message']['cc']+=',';}_0x460dc6[_0x9663('0x23')]['cc']+=_0x44d259;}}if(!_[_0x9663('0x18')](_0x460dc6['message']['originTo'],_0x21443d[_0x9663('0x7')])&&!_['includes'](_0x460dc6['message'][_0x9663('0x24')],_0x21443d[_0x9663('0x7')])){_0x460dc6[_0x9663('0x23')][_0x9663('0x25')]=_0x21443d[_0x9663('0x7')];}if(_0xdfa985[_0x9663('0x26')]&&_0xdfa985[_0x9663('0x26')]['length']){_0x460dc6[_0x9663('0x23')][_0x9663('0x27')]=_0xdfa985['attachments']['length'];for(var _0x5afe8e=0x0,_0x2756ed,_0x5b6402,_0x4ea06e;_0x5afe8e<_0xdfa985['attachments'][_0x9663('0x11')];_0x5afe8e+=0x1){if(_0xdfa985['attachments'][_0x5afe8e][_0x9663('0x28')]===_0x9663('0x29')){_0x4ea06e=_0xdfa985[_0x9663('0x26')][_0x5afe8e]['filename']||'attachment-'+_0x5afe8e;_0x2756ed=util['format'](_0x9663('0x2a'),Date[_0x9663('0x2b')](),_0x4ea06e);_0x5b6402=path[_0x9663('0x2c')](config[_0x9663('0x2d')],_0x9663('0x2e'),_0x2756ed);fs[_0x9663('0x2f')](_0x5b6402,_0xdfa985[_0x9663('0x26')][_0x5afe8e][_0x9663('0x30')]);_0x460dc6['message'][_0x9663('0x26')][_0x9663('0x31')]({'name':_0x4ea06e,'basename':_0x2756ed,'type':_0xdfa985[_0x9663('0x26')][_0x5afe8e][_0x9663('0x32')],'filepath':_0x5b6402});}}}if(_0xdfa985[_0x9663('0x33')]&&_0xdfa985[_0x9663('0x33')][_0x9663('0x11')]>0x0){var _0x36610c=['Auto-Submitted:\x20auto-replied',_0x9663('0x34'),'Precedence:\x20auto_reply'];for(var _0x1c7771=0x0;_0x1c7771<_0xdfa985[_0x9663('0x33')]['length'];_0x1c7771++){var _0x2765e1=_[_0x9663('0x35')](_0x36610c,_0xdfa985['headerLines'][_0x1c7771][_0x9663('0x36')]);if(_0x2765e1>=0x0){_0x460dc6[_0x9663('0x37')]=!![];}}}return _0x460dc6;}exports[_0x9663('0x38')]=function(_0x27c193,_0x477c42,_0x252b17){var _0x4cc2c2={'from':getAddress(_0x477c42[_0x9663('0x39')]),'firstName':getFirstName(_0x477c42['from']),'lastName':getLastName(_0x477c42[_0x9663('0x39')]),'mapKey':_0x9663('0x7'),'message':{'from':getMails(_0x27c193['email'],_0x477c42['from']),'to':_0x27c193['email'],'cc':'','subject':_0x477c42[_0x9663('0x3a')]||'','messageId':_0x477c42[_0x9663('0x3b')],'inReplyTo':_0x477c42['inReplyTo'],'sentAt':moment(_0x477c42[_0x9663('0x3c')])[_0x9663('0x3d')](_0x9663('0x3e')),'attach':![],'attachments':[]}};if(!_0x477c42[_0x9663('0x16')]&&!_0x477c42['textAsHtml']){var _0x478c9f=_[_0x9663('0x3f')](_0x477c42['attachments'],{'contentType':'application/ms-tnef'});if(_0x478c9f[_0x9663('0x11')]){logger[_0x9663('0x40')](util[_0x9663('0x3d')]('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x477c42[_0x9663('0x3b')]));tnef['parseBuffer'](_[_0x9663('0x41')](_0x478c9f)[_0x9663('0x30')],function(_0x276b54,_0x17b23b){if(_0x17b23b){_0x477c42[_0x9663('0x16')]=_0x17b23b[_0x9663('0x42')]||_0x9663('0x43');if(_0x17b23b[_0x9663('0x44')]){for(var _0x2830f5=0x0;_0x2830f5<_0x17b23b['Attachments']['length'];_0x2830f5++){var _0x39a955=_0x17b23b[_0x9663('0x44')][_0x2830f5];_0x4cc2c2['message'][_0x9663('0x26')][_0x9663('0x31')]({'filename':_0x39a955['Title'],'content':Buffer['from'](_0x39a955[_0x9663('0x45')])});}}}_0x252b17(parseEmail(_0x27c193,_0x477c42,_0x4cc2c2));});}else{_0x477c42['html']=_0x9663('0x43');_0x252b17(parseEmail(_0x27c193,_0x477c42,_0x4cc2c2));}}else{_0x252b17(parseEmail(_0x27c193,_0x477c42,_0x4cc2c2));}};exports['generateXOAuth2Token']=function(_0x506380,_0x11195e){var _0x4ec92=[_0x9663('0x46')+(_0x11195e||''),_0x9663('0x47')+_0x506380,'',''];return Buffer[_0x9663('0x39')](_0x4ec92[_0x9663('0x2c')]('\ 1'),_0x9663('0x48'))[_0x9663('0x49')](_0x9663('0x4a'));};
\ No newline at end of file
+var _0xe603=['%s-%s','root','server/files/attachments/','writeFileSync','content','headerLines','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','from','subject','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','BodyHTML','<p>Empty\x20message</p>','Attachments','Data','user=','utf-8','lodash','moment','path','node-tnef','../../../config/logger','email','../../../config/environment','value','@xcally.com','head','name','address','substring','indexOf','split','length','slice','join','Anonymous','anonymous','generate','html','replace','includes','<img','forEach','filename','_SRC','_IMG','<span\x20style=font-weight:bold>\x20[Attachment:\x20','body','<a\x20target=\x22_blank\x22\x20','message','originTo','originCc','isEmpty','bcc','attachments','type','format'];(function(_0x253318,_0xf1b779){var _0x459f53=function(_0x1f7499){while(--_0x1f7499){_0x253318['push'](_0x253318['shift']());}};_0x459f53(++_0xf1b779);}(_0xe603,0x1ad));var _0x3e60=function(_0x430cc8,_0x21c252){_0x430cc8=_0x430cc8-0x0;var _0x1f84ae=_0xe603[_0x430cc8];return _0x1f84ae;};'use strict';var _=require(_0x3e60('0x0'));var moment=require(_0x3e60('0x1'));var random=require('randomstring');var fs=require('fs');var path=require(_0x3e60('0x2'));var util=require('util');var tnef=require(_0x3e60('0x3'));var logger=require(_0x3e60('0x4'))(_0x3e60('0x5'));var config=require(_0x3e60('0x6'));function getAddress(_0x1b76dc){var _0x3f52a6=_['head'](_0x1b76dc[_0x3e60('0x7')]);return _0x3f52a6&&_0x3f52a6['address']?_0x3f52a6['address']:'anonymous'+random['generate'](0x6)+_0x3e60('0x8');}function getFirstName(_0x359ef2){var _0xe9d6b8=_[_0x3e60('0x9')](_0x359ef2['value']);if(_0xe9d6b8&&_0xe9d6b8['name']){if(_0xe9d6b8[_0x3e60('0xa')]==_0xe9d6b8[_0x3e60('0xb')]){return _0xe9d6b8[_0x3e60('0xa')][_0x3e60('0xc')](0x0,_0xe9d6b8[_0x3e60('0xa')][_0x3e60('0xd')]('@'));}var _0x323064=_0xe9d6b8[_0x3e60('0xa')][_0x3e60('0xe')](/\s+/);return _0x323064[_0x3e60('0xf')]>0x1?_0x323064[_0x3e60('0x10')](0x0,-0x1)[_0x3e60('0x11')]('\x20'):_0xe9d6b8[_0x3e60('0xa')];}return _0x3e60('0x12');}function getLastName(_0x41bdd6){var _0x489780=_['head'](_0x41bdd6[_0x3e60('0x7')]);if(_0x489780&&_0x489780[_0x3e60('0xa')]){var _0x317b99=_0x489780[_0x3e60('0xa')][_0x3e60('0xe')](/\s+/);return _0x317b99[_0x3e60('0xf')]>0x1?_0x317b99['pop']():'';}return'';}function getMails(_0x4dd2f0,_0x337bd5){var _0x4c3711='';for(var _0x23021b=0x0;_0x23021b<_0x337bd5['value'][_0x3e60('0xf')];_0x23021b+=0x1){if(_0x337bd5['value'][_0x23021b][_0x3e60('0xb')]!==_0x4dd2f0){if(!_['isEmpty'](_0x4c3711)){_0x4c3711+=',';}_0x4c3711+=_0x337bd5[_0x3e60('0x7')][_0x23021b][_0x3e60('0xa')]||_0x337bd5[_0x3e60('0x7')][_0x23021b][_0x3e60('0xb')]||'';_0x4c3711+='\x20<';_0x4c3711+=_0x337bd5['value'][_0x23021b][_0x3e60('0xb')]?_0x337bd5[_0x3e60('0x7')][_0x23021b][_0x3e60('0xb')]:_0x3e60('0x13')+random[_0x3e60('0x14')](0x6)+_0x3e60('0x8');_0x4c3711+='>';}}return _0x4c3711;}function parseEmail(_0x2e6133,_0x2db4cf,_0x621602){if(_0x2db4cf[_0x3e60('0x15')]){var _0xca672f=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;while(_0xca672f['test'](_0x2db4cf[_0x3e60('0x15')])){_0x2db4cf[_0x3e60('0x15')]=_0x2db4cf[_0x3e60('0x15')][_0x3e60('0x16')](_0xca672f,'');}if(_0x2db4cf[_0x3e60('0x15')][_0x3e60('0x17')](_0x3e60('0x18'))){var _0x22a742=[];_0x2db4cf['attachments'][_0x3e60('0x19')](_0x3d3f95=>{_0x22a742['push'](_0x3d3f95[_0x3e60('0x1a')]);});var _0x215630=/<img.*? _SRC(.*?)[^>]+>/g;var _0x15c33b=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x185891=_0x2db4cf[_0x3e60('0x15')][_0x3e60('0x16')](_0x15c33b,_0x3e60('0x1b'));var _0x18fa39=_0x185891[_0x3e60('0x16')](_0x215630,_0x3e60('0x1c'));for(let _0x46d6f8=0x0;_0x46d6f8<_0x22a742['length'];_0x46d6f8++){var _0x13d9c5=_0x18fa39[_0x3e60('0x16')](_0x3e60('0x1c'),_0x3e60('0x1d')+_0x22a742[_0x46d6f8]+'\x20]</span>');_0x18fa39=_0x13d9c5;}_0x2db4cf['html']=_0x18fa39;}_0x621602[_0x3e60('0x1e')]=_0x2db4cf[_0x3e60('0x15')];}else{_0x621602['body']=_0x2db4cf['textAsHtml'];}if(_0x621602['body']){_0x621602[_0x3e60('0x1e')]=_0x621602[_0x3e60('0x1e')][_0x3e60('0x16')](/<a\s+/gi,_0x3e60('0x1f'));}if(_0x2db4cf['to']){_0x621602[_0x3e60('0x20')][_0x3e60('0x21')]=getMails(null,_0x2db4cf['to']);var _0x2d2a5e=getMails(_0x2e6133[_0x3e60('0x5')],_0x2db4cf['to']);if(!_['isEmpty'](_0x2d2a5e)){_0x621602[_0x3e60('0x20')]['cc']+=_0x2d2a5e;}}if(_0x2db4cf['cc']){_0x621602['message'][_0x3e60('0x22')]=getMails(null,_0x2db4cf['cc']);var _0x35789b=getMails(_0x2e6133['email'],_0x2db4cf['cc']);if(!_['isEmpty'](_0x35789b)){if(!_[_0x3e60('0x23')](_0x621602[_0x3e60('0x20')]['cc'])){_0x621602[_0x3e60('0x20')]['cc']+=',';}_0x621602[_0x3e60('0x20')]['cc']+=_0x35789b;}}if(!_[_0x3e60('0x17')](_0x621602[_0x3e60('0x20')]['originTo'],_0x2e6133['email'])&&!_[_0x3e60('0x17')](_0x621602['message'][_0x3e60('0x22')],_0x2e6133['email'])){_0x621602['message'][_0x3e60('0x24')]=_0x2e6133[_0x3e60('0x5')];}if(_0x2db4cf[_0x3e60('0x25')]&&_0x2db4cf[_0x3e60('0x25')][_0x3e60('0xf')]){_0x621602[_0x3e60('0x20')]['attach']=_0x2db4cf[_0x3e60('0x25')][_0x3e60('0xf')];for(var _0x5e9f3f=0x0,_0x243c01,_0xe4e6e7,_0x5b818b;_0x5e9f3f<_0x2db4cf['attachments'][_0x3e60('0xf')];_0x5e9f3f+=0x1){if(_0x2db4cf[_0x3e60('0x25')][_0x5e9f3f][_0x3e60('0x26')]==='attachment'){_0x5b818b=_0x2db4cf[_0x3e60('0x25')][_0x5e9f3f][_0x3e60('0x1a')]||'attachment-'+_0x5e9f3f;_0x243c01=util[_0x3e60('0x27')](_0x3e60('0x28'),Date['now'](),_0x5b818b);_0xe4e6e7=path[_0x3e60('0x11')](config[_0x3e60('0x29')],_0x3e60('0x2a'),_0x243c01);fs[_0x3e60('0x2b')](_0xe4e6e7,_0x2db4cf[_0x3e60('0x25')][_0x5e9f3f][_0x3e60('0x2c')]);_0x621602[_0x3e60('0x20')][_0x3e60('0x25')]['push']({'name':_0x5b818b,'basename':_0x243c01,'type':_0x2db4cf['attachments'][_0x5e9f3f]['contentType'],'filepath':_0xe4e6e7});}}}if(_0x2db4cf[_0x3e60('0x2d')]&&_0x2db4cf[_0x3e60('0x2d')][_0x3e60('0xf')]>0x0){var _0x293589=['Auto-Submitted:\x20auto-replied',_0x3e60('0x2e'),_0x3e60('0x2f')];for(var _0x497a4e=0x0;_0x497a4e<_0x2db4cf['headerLines'][_0x3e60('0xf')];_0x497a4e++){var _0x140db5=_['indexOf'](_0x293589,_0x2db4cf[_0x3e60('0x2d')][_0x497a4e][_0x3e60('0x30')]);if(_0x140db5>=0x0){_0x621602[_0x3e60('0x31')]=!![];}}}return _0x621602;}exports['parser']=function(_0x5b10b9,_0x468985,_0x1949fc){var _0x10f64b={'from':getAddress(_0x468985['from']),'firstName':getFirstName(_0x468985[_0x3e60('0x32')]),'lastName':getLastName(_0x468985[_0x3e60('0x32')]),'mapKey':'email','message':{'from':getMails(_0x5b10b9[_0x3e60('0x5')],_0x468985[_0x3e60('0x32')]),'to':_0x5b10b9[_0x3e60('0x5')],'cc':'','subject':_0x468985[_0x3e60('0x33')]||'','messageId':_0x468985['messageId'],'inReplyTo':_0x468985[_0x3e60('0x34')],'sentAt':moment(_0x468985[_0x3e60('0x35')])[_0x3e60('0x27')](_0x3e60('0x36')),'attach':![],'attachments':[]}};if(!_0x468985[_0x3e60('0x15')]&&!_0x468985[_0x3e60('0x37')]){var _0x3e50b5=_['filter'](_0x468985[_0x3e60('0x25')],{'contentType':'application/ms-tnef'});if(_0x3e50b5[_0x3e60('0xf')]){logger[_0x3e60('0x38')](util['format'](_0x3e60('0x39'),_0x468985[_0x3e60('0x3a')]));tnef[_0x3e60('0x3b')](_[_0x3e60('0x3c')](_0x3e50b5)['content'],function(_0x48d176,_0x2ec321){if(_0x2ec321){_0x468985[_0x3e60('0x15')]=_0x2ec321[_0x3e60('0x3d')]||_0x3e60('0x3e');if(_0x2ec321['Attachments']){for(var _0x33b4fe=0x0;_0x33b4fe<_0x2ec321[_0x3e60('0x3f')][_0x3e60('0xf')];_0x33b4fe++){var _0xe30ed1=_0x2ec321[_0x3e60('0x3f')][_0x33b4fe];_0x10f64b[_0x3e60('0x20')][_0x3e60('0x25')]['push']({'filename':_0xe30ed1['Title'],'content':Buffer[_0x3e60('0x32')](_0xe30ed1[_0x3e60('0x40')])});}}}_0x1949fc(parseEmail(_0x5b10b9,_0x468985,_0x10f64b));});}else{_0x468985[_0x3e60('0x15')]=_0x3e60('0x3e');_0x1949fc(parseEmail(_0x5b10b9,_0x468985,_0x10f64b));}}else{_0x1949fc(parseEmail(_0x5b10b9,_0x468985,_0x10f64b));}};exports['generateXOAuth2Token']=function(_0x4c4c41,_0x58ec4b){var _0x531dc2=[_0x3e60('0x41')+(_0x58ec4b||''),'auth=Bearer\x20'+_0x4c4c41,'',''];return Buffer[_0x3e60('0x32')](_0x531dc2[_0x3e60('0x11')]('\ 1'),_0x3e60('0x42'))['toString']('base64');};
\ No newline at end of file
index 66efe99..97c20de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf7c5=['lodash','name','Service','key','SERV','active','Imap','Smtp','exports'];(function(_0x4fde20,_0x553824){var _0x4272fc=function(_0x467e52){while(--_0x467e52){_0x4fde20['push'](_0x4fde20['shift']());}};_0x4272fc(++_0x553824);}(_0xf7c5,0xfc));var _0x5f7c=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xf7c5[_0x3635ce];return _0x97ecd0;};'use strict';var _=require(_0x5f7c('0x0'));function MailAccount(_0x216012){this['id']=_0x216012['id']||0x0;this[_0x5f7c('0x1')]=_0x216012[_0x5f7c('0x1')]||_0x5f7c('0x2');this[_0x5f7c('0x3')]=_0x216012['key']||_0x5f7c('0x4');this[_0x5f7c('0x5')]=_0x216012[_0x5f7c('0x5')]||![];this['Imap']=_0x216012[_0x5f7c('0x6')]||[];this[_0x5f7c('0x7')]=_0x216012[_0x5f7c('0x7')]||[];}module[_0x5f7c('0x8')]=MailAccount;
\ No newline at end of file
+var _0x6e13=['name','key','SERV','active','Imap','Smtp','exports'];(function(_0x28a180,_0x5bb5b0){var _0x1161d3=function(_0x2bb4cf){while(--_0x2bb4cf){_0x28a180['push'](_0x28a180['shift']());}};_0x1161d3(++_0x5bb5b0);}(_0x6e13,0x93));var _0x36e1=function(_0x4a297d,_0x388c74){_0x4a297d=_0x4a297d-0x0;var _0x3ea325=_0x6e13[_0x4a297d];return _0x3ea325;};'use strict';var _=require('lodash');function MailAccount(_0x5acbec){this['id']=_0x5acbec['id']||0x0;this[_0x36e1('0x0')]=_0x5acbec[_0x36e1('0x0')]||'Service';this[_0x36e1('0x1')]=_0x5acbec[_0x36e1('0x1')]||_0x36e1('0x2');this['active']=_0x5acbec[_0x36e1('0x3')]||![];this[_0x36e1('0x4')]=_0x5acbec['Imap']||[];this[_0x36e1('0x5')]=_0x5acbec[_0x36e1('0x5')]||[];}module[_0x36e1('0x6')]=MailAccount;
\ No newline at end of file
index ae0a8fb..d06eb8a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x93e9=['merge','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length'];(function(_0x1f8fbe,_0x1aea78){var _0x3942f2=function(_0x22203c){while(--_0x22203c){_0x1f8fbe['push'](_0x1f8fbe['shift']());}};_0x3942f2(++_0x1aea78);}(_0x93e9,0x160));var _0x993e=function(_0x402845,_0x34addd){_0x402845=_0x402845-0x0;var _0x47fd8f=_0x93e9[_0x402845];return _0x47fd8f;};'use strict';var _=require('lodash');var MailAccount=require(_0x993e('0x0'));var Realtime=function(){this[_0x993e('0x1')]={};};function freeIsNotKey(_0x584c60,_0x552531,_0x152d2e){var _0x35c218=_[_0x993e('0x2')](_0x584c60,function(_0x49eb19,_0xfef016){return _0x49eb19[_0x152d2e];});for(var _0x1a2419 in _0x552531){if(_0x552531[_0x993e('0x3')](_0x1a2419)){if(!_0x35c218[_0x1a2419]){delete _0x552531[_0x1a2419];}}}}Realtime[_0x993e('0x4')][_0x993e('0x5')]=function(_0x5d21ba,_0x41c7cf){for(var _0x229786 in _0x41c7cf){if(_0x5d21ba['hasOwnProperty'](_0x229786)){_0x5d21ba[_0x229786]=_0x41c7cf[_0x229786];}}};Realtime[_0x993e('0x4')][_0x993e('0x6')]=function(){var _0x35d44c=this;return function(_0x599471){if(_0x599471){freeIsNotKey(_0x599471,_0x35d44c[_0x993e('0x1')],'id');for(var _0x26a523=0x0,_0x56afa6={},_0x5577fc={};_0x26a523<_0x599471[_0x993e('0x7')];_0x26a523+=0x1){_0x56afa6=_0x599471[_0x26a523];if(_['isUndefined'](_0x35d44c[_0x993e('0x1')][_0x56afa6['id']])){_0x35d44c['mailAccounts'][_0x56afa6['id']]=new MailAccount(_0x56afa6);}else{_[_0x993e('0x8')](_0x35d44c[_0x993e('0x1')][_0x56afa6['id']],_0x56afa6);}}}return _0x35d44c['mailAccounts'];};};module[_0x993e('0x9')]=Realtime;
\ No newline at end of file
+var _0x6931=['mergeFromDatabase','prototype','initMailAccounts','isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','hasOwnProperty'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6931,0x18d));var _0x1693=function(_0x54125b,_0x3a1c36){_0x54125b=_0x54125b-0x0;var _0x2a5308=_0x6931[_0x54125b];return _0x2a5308;};'use strict';var _=require(_0x1693('0x0'));var MailAccount=require(_0x1693('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x3940f0,_0x20cd25,_0x2f537b){var _0x9ee9f5=_['mapKeys'](_0x3940f0,function(_0x56e664,_0x484b20){return _0x56e664[_0x2f537b];});for(var _0x5058ba in _0x20cd25){if(_0x20cd25[_0x1693('0x2')](_0x5058ba)){if(!_0x9ee9f5[_0x5058ba]){delete _0x20cd25[_0x5058ba];}}}}Realtime['prototype'][_0x1693('0x3')]=function(_0x370439,_0x5de005){for(var _0x51d0b3 in _0x5de005){if(_0x370439['hasOwnProperty'](_0x51d0b3)){_0x370439[_0x51d0b3]=_0x5de005[_0x51d0b3];}}};Realtime[_0x1693('0x4')][_0x1693('0x5')]=function(){var _0x54439e=this;return function(_0x356af5){if(_0x356af5){freeIsNotKey(_0x356af5,_0x54439e['mailAccounts'],'id');for(var _0x5e6775=0x0,_0x8865fe={},_0x313355={};_0x5e6775<_0x356af5['length'];_0x5e6775+=0x1){_0x8865fe=_0x356af5[_0x5e6775];if(_[_0x1693('0x6')](_0x54439e[_0x1693('0x7')][_0x8865fe['id']])){_0x54439e[_0x1693('0x7')][_0x8865fe['id']]=new MailAccount(_0x8865fe);}else{_[_0x1693('0x8')](_0x54439e['mailAccounts'][_0x8865fe['id']],_0x8865fe);}}}return _0x54439e[_0x1693('0x7')];};};module[_0x1693('0x9')]=Realtime;
\ No newline at end of file
index 3bac033..b138c65 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x554e=['active','key','TemplateId','MailServerIn','Imap','type','data5','MailServerOut','Smtp','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x554e,0xb6));var _0xe554=function(_0x38f3e9,_0x53ce92){_0x38f3e9=_0x38f3e9-0x0;var _0xe8ee0a=_0x554e[_0x38f3e9];return _0xe8ee0a;};'use strict';var client=require(_0xe554('0x0'));exports[_0xe554('0x1')]=function(){return function(){return client[_0xe554('0x2')](_0xe554('0x3'),{'options':{'attributes':['id',_0xe554('0x4'),_0xe554('0x5'),_0xe554('0x6'),_0xe554('0x7'),_0xe554('0x8'),_0xe554('0x9'),'ListId',_0xe554('0xa')],'raw':![],'include':[{'model':_0xe554('0xb'),'as':_0xe554('0xc'),'include':[{'model':'CloudProvider','attributes':['id',_0xe554('0x4'),_0xe554('0x6'),_0xe554('0xd'),_0xe554('0xe')],'as':'CloudProvider'}]},{'model':_0xe554('0xf'),'as':_0xe554('0x10'),'include':[{'model':'CloudProvider','attributes':['id',_0xe554('0x4'),_0xe554('0x6'),_0xe554('0xd'),_0xe554('0xe')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0xe554('0x11')]=function(_0xd6fe70,_0x108e5f){return client['Request'](_0xe554('0x12'),{'account':{'id':_0xd6fe70},'body':_0x108e5f,'log':_0xe554('0x12')});};
\ No newline at end of file
+var _0xa965=['Request','NotifyMailAccount','GetMailAccount','name','provider','service','key','TemplateId','MailServerIn','Imap','CloudProvider','type','data5','Smtp','getMailAccount','notify'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa965,0x172));var _0x5a96=function(_0x2170e4,_0x5b969e){_0x2170e4=_0x2170e4-0x0;var _0xec86f5=_0xa965[_0x2170e4];return _0xec86f5;};'use strict';var client=require('../client');exports['getMailAccounts']=function(){return function(){return client['Request'](_0x5a96('0x0'),{'options':{'attributes':['id',_0x5a96('0x1'),_0x5a96('0x2'),_0x5a96('0x3'),'email','active',_0x5a96('0x4'),'ListId',_0x5a96('0x5')],'raw':![],'include':[{'model':_0x5a96('0x6'),'as':_0x5a96('0x7'),'include':[{'model':_0x5a96('0x8'),'attributes':['id','name',_0x5a96('0x3'),_0x5a96('0x9'),_0x5a96('0xa')],'as':_0x5a96('0x8')}]},{'model':'MailServerOut','as':_0x5a96('0xb'),'include':[{'model':_0x5a96('0x8'),'attributes':['id',_0x5a96('0x1'),'service',_0x5a96('0x9'),_0x5a96('0xa')],'as':_0x5a96('0x8')}]}]},'log':_0x5a96('0xc')});};};exports[_0x5a96('0xd')]=function(_0x37ada8,_0x33faf3){return client[_0x5a96('0xe')](_0x5a96('0xf'),{'account':{'id':_0x37ada8},'body':_0x33faf3,'log':_0x5a96('0xf')});};
\ No newline at end of file
index 01427ea..b154e94 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe3db=['GetSettings','../client','getSettings','Request','ShowSetting','loginMailFrequency'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe3db,0x11b));var _0xbe3d=function(_0x57b591,_0x2e068b){_0x57b591=_0x57b591-0x0;var _0x18141f=_0xe3db[_0x57b591];return _0x18141f;};'use strict';var client=require(_0xbe3d('0x0'));exports[_0xbe3d('0x1')]=function(){return client[_0xbe3d('0x2')](_0xbe3d('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbe3d('0x4')]},'log':_0xbe3d('0x5')});};
\ No newline at end of file
+var _0xdc7e=['Request','GetSettings','../client','getSettings'];(function(_0x2d76ce,_0x1c9756){var _0x429705=function(_0x5a6817){while(--_0x5a6817){_0x2d76ce['push'](_0x2d76ce['shift']());}};_0x429705(++_0x1c9756);}(_0xdc7e,0xbe));var _0xedc7=function(_0x277e8c,_0x1d91e7){_0x277e8c=_0x277e8c-0x0;var _0x4acc8b=_0xdc7e[_0x277e8c];return _0x4acc8b;};'use strict';var client=require(_0xedc7('0x0'));exports[_0xedc7('0x1')]=function(){return client[_0xedc7('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xedc7('0x3')});};
\ No newline at end of file
index 3c82576..271e71f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});};
\ No newline at end of file
+var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});};
\ No newline at end of file
index 32d5464..82ff1b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x028b=['Express\x20server\x20listening\x20on\x20port\x20%d!','port','http','sticky-session','ioredis','../../config/environment','createServer','timeout','socket.io','websocket','redis','defaults','localhost','socket.io-redis','../../config/socketio','default','../../config/express','../../routes','once','listening','log'];(function(_0x2b9798,_0x2f7ed8){var _0x25a032=function(_0xbdd71c){while(--_0xbdd71c){_0x2b9798['push'](_0x2b9798['shift']());}};_0x25a032(++_0x2f7ed8);}(_0x028b,0xe9));var _0xb028=function(_0x4058c6,_0x3134cb){_0x4058c6=_0x4058c6-0x0;var _0xb50c33=_0x028b[_0x4058c6];return _0xb50c33;};'use strict';var _=require('lodash');var http=require(_0xb028('0x0'));var express=require('express');var sticky=require(_0xb028('0x1'));var Redis=require(_0xb028('0x2'));var config=require(_0xb028('0x3'));var app=express();var server=http[_0xb028('0x4')](app);server[_0xb028('0x5')]=0xdbba0;if(sticky['listen'](server,config['port'])){var socketio=require(_0xb028('0x6'))(server,{'transports':[_0xb028('0x7'),'polling']});config[_0xb028('0x8')]=_[_0xb028('0x9')](config[_0xb028('0x8')],{'host':_0xb028('0xa'),'port':0x18eb});socketio['adapter'](require(_0xb028('0xb'))({'pubClient':new Redis(config[_0xb028('0x8')]),'subClient':new Redis(config[_0xb028('0x8')])}));require('../../config/triggers')['default']();require(_0xb028('0xc'))[_0xb028('0xd')](socketio);require(_0xb028('0xe'))['default'](app);require(_0xb028('0xf'))[_0xb028('0xd')](app);}else{server[_0xb028('0x10')](_0xb028('0x11'),function(){console[_0xb028('0x12')](_0xb028('0x13'),config[_0xb028('0x14')]);});}exports=module['exports']=app;
\ No newline at end of file
+var _0x9c05=['express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','socket.io','websocket','polling','defaults','localhost','adapter','socket.io-redis','redis','default','../../config/socketio','../../config/express','../../routes','once','listening','exports','lodash','http'];(function(_0xcb48df,_0x2760e2){var _0x52d5ff=function(_0x2e1365){while(--_0x2e1365){_0xcb48df['push'](_0xcb48df['shift']());}};_0x52d5ff(++_0x2760e2);}(_0x9c05,0x18e));var _0x59c0=function(_0xda6af4,_0x5b9b42){_0xda6af4=_0xda6af4-0x0;var _0x35a4a8=_0x9c05[_0xda6af4];return _0x35a4a8;};'use strict';var _=require(_0x59c0('0x0'));var http=require(_0x59c0('0x1'));var express=require(_0x59c0('0x2'));var sticky=require(_0x59c0('0x3'));var Redis=require(_0x59c0('0x4'));var config=require(_0x59c0('0x5'));var app=express();var server=http[_0x59c0('0x6')](app);server[_0x59c0('0x7')]=0xdbba0;if(sticky[_0x59c0('0x8')](server,config[_0x59c0('0x9')])){var socketio=require(_0x59c0('0xa'))(server,{'transports':[_0x59c0('0xb'),_0x59c0('0xc')]});config['redis']=_[_0x59c0('0xd')](config['redis'],{'host':_0x59c0('0xe'),'port':0x18eb});socketio[_0x59c0('0xf')](require(_0x59c0('0x10'))({'pubClient':new Redis(config[_0x59c0('0x11')]),'subClient':new Redis(config[_0x59c0('0x11')])}));require('../../config/triggers')[_0x59c0('0x12')]();require(_0x59c0('0x13'))['default'](socketio);require(_0x59c0('0x14'))['default'](app);require(_0x59c0('0x15'))[_0x59c0('0x12')](app);}else{server[_0x59c0('0x16')](_0x59c0('0x17'),function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x59c0('0x9')]);});}exports=module[_0x59c0('0x18')]=app;
\ No newline at end of file
index a2b67c1..6644a11 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd181=['catch','exports','jayson/promise','bluebird','client','http','request','then','rpc','routing','error','message','result'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0xd181,0x9e));var _0x1d18=function(_0x5acfa7,_0x48996a){_0x5acfa7=_0x5acfa7-0x0;var _0x33ed8f=_0xd181[_0x5acfa7];return _0x33ed8f;};'use strict';var jayson=require(_0x1d18('0x0'));var BPromise=require(_0x1d18('0x1'));var logger=require('../../config/logger')('routing');var client=jayson[_0x1d18('0x2')][_0x1d18('0x3')]({'port':0x2329});client['Request']=function(_0x55798f,_0x4e140e){return new BPromise(function(_0x376b65,_0x41bc2a){return client[_0x1d18('0x4')](_0x55798f,_0x4e140e)[_0x1d18('0x5')](function(_0x42d1c8){logger['debug'](_0x1d18('0x6'),_0x1d18('0x7'),_0x55798f,_0x4e140e,_0x42d1c8);if(_0x42d1c8[_0x1d18('0x8')]){logger[_0x1d18('0x8')]('rpc',_0x1d18('0x7'),_0x55798f,_0x42d1c8[_0x1d18('0x8')][_0x1d18('0x9')],_0x4e140e);return _0x41bc2a(_0x42d1c8[_0x1d18('0x8')][_0x1d18('0x9')]);}else{return _0x376b65(_0x42d1c8[_0x1d18('0xa')]);}})[_0x1d18('0xb')](function(_0x1fde30){logger['error'](_0x1d18('0x6'),_0x1d18('0x7'),_0x55798f,_0x1fde30,_0x4e140e);return _0x41bc2a(_0x1fde30);});});};module[_0x1d18('0xc')]=client;
\ No newline at end of file
+var _0x77b5=['error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','Request','request','then','debug','rpc'];(function(_0x1ec445,_0x11b1d7){var _0x435c5b=function(_0x4966b3){while(--_0x4966b3){_0x1ec445['push'](_0x1ec445['shift']());}};_0x435c5b(++_0x11b1d7);}(_0x77b5,0xaa));var _0x577b=function(_0x500cd5,_0x5ef1f9){_0x500cd5=_0x500cd5-0x0;var _0x4db92a=_0x77b5[_0x500cd5];return _0x4db92a;};'use strict';var jayson=require(_0x577b('0x0'));var BPromise=require(_0x577b('0x1'));var logger=require(_0x577b('0x2'))(_0x577b('0x3'));var client=jayson[_0x577b('0x4')]['http']({'port':0x2329});client[_0x577b('0x5')]=function(_0x9536b,_0x195f10){return new BPromise(function(_0x1fe377,_0x4eb7c5){return client[_0x577b('0x6')](_0x9536b,_0x195f10)[_0x577b('0x7')](function(_0x5da10a){logger[_0x577b('0x8')](_0x577b('0x9'),_0x577b('0x3'),_0x9536b,_0x195f10,_0x5da10a);if(_0x5da10a['error']){logger[_0x577b('0xa')](_0x577b('0x9'),_0x577b('0x3'),_0x9536b,_0x5da10a['error'][_0x577b('0xb')],_0x195f10);return _0x4eb7c5(_0x5da10a[_0x577b('0xa')][_0x577b('0xb')]);}else{return _0x1fe377(_0x5da10a[_0x577b('0xc')]);}})[_0x577b('0xd')](function(_0x2aaaa5){logger[_0x577b('0xa')](_0x577b('0x9'),_0x577b('0x3'),_0x9536b,_0x2aaaa5,_0x195f10);return _0x4eb7c5(_0x2aaaa5);});});};module[_0x577b('0xe')]=client;
\ No newline at end of file
index d7988e5..b6aaf91 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c52=['getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./rpc/user','./rpc/chatQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','initIntervals'];(function(_0x36fdbf,_0x57b0d0){var _0x3fb41a=function(_0x480cf3){while(--_0x480cf3){_0x36fdbf['push'](_0x36fdbf['shift']());}};_0x3fb41a(++_0x57b0d0);}(_0x4c52,0xa0));var _0x24c5=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0x4c52[_0x21aec3];return _0x288bbc;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require(_0x24c5('0x0'));var interval=require('./rpc/interval');var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x24c5('0x1'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require('./rpc/mailQueue');var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0x24c5('0x2'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x24c5('0x3')]()[_0x24c5('0x4')](user[_0x24c5('0x5')]())[_0x24c5('0x4')](realtime[_0x24c5('0x6')]())['then'](interval['getIntervals']())[_0x24c5('0x4')](realtime[_0x24c5('0x7')]())[_0x24c5('0x4')](openchannelQueue[_0x24c5('0x8')]())[_0x24c5('0x4')](realtime[_0x24c5('0x9')]())[_0x24c5('0x4')](chatQueue[_0x24c5('0xa')]())[_0x24c5('0x4')](realtime[_0x24c5('0xb')]())[_0x24c5('0x4')](smsQueue['getSmsQueues']())[_0x24c5('0x4')](realtime[_0x24c5('0xc')]())[_0x24c5('0x4')](mailQueue[_0x24c5('0xd')]())[_0x24c5('0x4')](realtime[_0x24c5('0xe')]())[_0x24c5('0x4')](faxQueue[_0x24c5('0xf')]())[_0x24c5('0x4')](realtime['initFaxQueues']())[_0x24c5('0x4')](whatsappQueue[_0x24c5('0x10')]())[_0x24c5('0x4')](realtime[_0x24c5('0x11')]())[_0x24c5('0x4')](function(){return realtime;});}function main(){return server[_0x24c5('0x12')](realtime)[_0x24c5('0x4')](function(_0x1cebdc){return initRealtime();})[_0x24c5('0x4')](function(_0x37b92d){return setInterval(initRealtime,0x1388);})[_0x24c5('0x13')](function(_0x16ad8f){console[_0x24c5('0x14')](_0x16ad8f);});}main();
\ No newline at end of file
+var _0x51ad=['then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getMailQueues','initMailQueues','getFaxQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve'];(function(_0x3cfad3,_0x359b0e){var _0x17977c=function(_0x16b757){while(--_0x16b757){_0x3cfad3['push'](_0x3cfad3['shift']());}};_0x17977c(++_0x359b0e);}(_0x51ad,0x161));var _0xd51a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x51ad[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0xd51a('0x0'));var server=require(_0xd51a('0x1'));var Realtime=require(_0xd51a('0x2'));var user=require(_0xd51a('0x3'));var interval=require(_0xd51a('0x4'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0xd51a('0x5'));var smsQueue=require(_0xd51a('0x6'));var mailQueue=require(_0xd51a('0x7'));var faxQueue=require(_0xd51a('0x8'));var whatsappQueue=require(_0xd51a('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd51a('0xa')]()[_0xd51a('0xb')](user[_0xd51a('0xc')]())[_0xd51a('0xb')](realtime[_0xd51a('0xd')]())['then'](interval[_0xd51a('0xe')]())[_0xd51a('0xb')](realtime[_0xd51a('0xf')]())['then'](openchannelQueue[_0xd51a('0x10')]())[_0xd51a('0xb')](realtime[_0xd51a('0x11')]())[_0xd51a('0xb')](chatQueue['getChatQueues']())[_0xd51a('0xb')](realtime[_0xd51a('0x12')]())['then'](smsQueue['getSmsQueues']())[_0xd51a('0xb')](realtime['initSmsQueues']())['then'](mailQueue[_0xd51a('0x13')]())[_0xd51a('0xb')](realtime[_0xd51a('0x14')]())[_0xd51a('0xb')](faxQueue[_0xd51a('0x15')]())[_0xd51a('0xb')](realtime['initFaxQueues']())[_0xd51a('0xb')](whatsappQueue['getWhatsappQueues']())[_0xd51a('0xb')](realtime[_0xd51a('0x16')]())[_0xd51a('0xb')](function(){return realtime;});}function main(){return server[_0xd51a('0x17')](realtime)[_0xd51a('0xb')](function(_0x1b6a23){return initRealtime();})[_0xd51a('0xb')](function(_0x7cfd1f){return setInterval(initRealtime,0x1388);})[_0xd51a('0x18')](function(_0x2a0f1b){console[_0xd51a('0x19')](_0x2a0f1b);});}main();
\ No newline at end of file
index 2d45e01..116249a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe14b=['next','restart','condition','noop','findRules','matches','turn','length','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','register','exports','lodash','util','isNil','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','push','sync','filter','orderBy','asc','execute','result','clone','consequence','ruleRef','name','index_','nextTick','call'];(function(_0x11f891,_0x44b67c){var _0x5b075c=function(_0x496c79){while(--_0x496c79){_0x11f891['push'](_0x11f891['shift']());}};_0x5b075c(++_0x44b67c);}(_0xe14b,0x93));var _0xbe14=function(_0x29036b,_0x3e87ef){_0x29036b=_0x29036b-0x0;var _0x431bc6=_0xe14b[_0x29036b];return _0x431bc6;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var EventEmitter=require('events')['EventEmitter'];function RuleEngine(_0x11c3a0,_0x36393a){this['init']();if(!_[_0xbe14('0x2')](_0x11c3a0)){this['register'](_0x11c3a0);}if(_0x36393a){this['ignoreFactChanges']=_0x36393a[_0xbe14('0x3')];}return this;}util[_0xbe14('0x4')](RuleEngine,EventEmitter);RuleEngine[_0xbe14('0x5')][_0xbe14('0x6')]=function(_0x1d9ade){this[_0xbe14('0x7')]=[];this[_0xbe14('0x8')]=[];};RuleEngine['prototype']['register']=function(_0x496063){if(Array[_0xbe14('0x9')](_0x496063)){this[_0xbe14('0x7')]=this[_0xbe14('0x7')][_0xbe14('0xa')](_0x496063);}else if(_0x496063!==null&&_['isObject'](_0x496063)){this['rules'][_0xbe14('0xb')](_0x496063);}this[_0xbe14('0xc')]();};RuleEngine['prototype'][_0xbe14('0xc')]=function(){this[_0xbe14('0x8')]=this[_0xbe14('0x7')][_0xbe14('0xd')](function(_0x27792f){if(_[_0xbe14('0x2')](_0x27792f['on'])){_0x27792f['on']=!![];}if(_0x27792f['on']===!![]){return _0x27792f;}});this[_0xbe14('0x8')]=_[_0xbe14('0xe')](this[_0xbe14('0x8')],['p'],[_0xbe14('0xf')]);};RuleEngine[_0xbe14('0x5')][_0xbe14('0x10')]=function(_0x813399,_0x530538){var _0x55b3a7=![];_0x813399[_0xbe14('0x11')]=!![];var _0x3dc4a9=_[_0xbe14('0x12')](_0x813399);var _0x37ce4e=_['clone'](_0x813399);var _0x21c789=this[_0xbe14('0x8')];var _0xfd7b8f=[];var _0x123ede=this[_0xbe14('0x3')];(function FnRuleLoop(_0x29ab73){var _0x17ae86={'rules':function(){return _0x21c789;},'rule':function(){return _0x21c789[_0x29ab73];},'when':function(_0x5ea1f8){if(_0x5ea1f8){var _0x137ee5=_0x21c789[_0x29ab73][_0xbe14('0x13')];_0x137ee5[_0xbe14('0x14')]=_0x21c789[_0x29ab73]['id']||_0x21c789[_0x29ab73][_0xbe14('0x15')]||_0xbe14('0x16')+_0x29ab73;process[_0xbe14('0x17')](function(){_0xfd7b8f['push'](_0x137ee5[_0xbe14('0x14')]);_0x137ee5[_0xbe14('0x18')](_0x3dc4a9,_0x17ae86);});}else{process[_0xbe14('0x17')](function(){_0x17ae86[_0xbe14('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x55b3a7=!![];return FnRuleLoop(0x0);},'next':function(_0x188ec4){if(!_0x123ede&&!_['isEqual'](_0x37ce4e,_0x3dc4a9)){_0x37ce4e=_[_0xbe14('0x12')](_0x3dc4a9);process['nextTick'](function(){_0x17ae86[_0xbe14('0x1a')]();});}else{process['nextTick'](function(){if(_[_0xbe14('0x2')](_0x188ec4)){return FnRuleLoop(_0x29ab73+0x1);}else{return FnRuleLoop(_0x188ec4);}});}}};if(_0x29ab73<_0x21c789['length']&&_0x55b3a7===![]){var _0x274018=_0x21c789[_0x29ab73][_0xbe14('0x1b')];_0x274018['call'](_0x3dc4a9,_0x17ae86);}else{process[_0xbe14('0x17')](function(){_0x3dc4a9['matchPath']=_0xfd7b8f;return _0x530538?_0x530538(_0x3dc4a9):_[_0xbe14('0x1c')]();});}}(0x0));};RuleEngine['prototype'][_0xbe14('0x1d')]=function(_0x5fa043){if(_[_0xbe14('0x2')](_0x5fa043)){return this[_0xbe14('0x7')];}else{var _0x15ef02=_[_0xbe14('0x1e')](_0x5fa043);return _['filter'](this[_0xbe14('0x7')],_0x15ef02);}};RuleEngine[_0xbe14('0x5')][_0xbe14('0x1f')]=function(_0x169369,_0x5dd475){var _0x16f884=_0x169369==='on'||_0x169369==='ON'?!![]:![];var _0x29fc64=this['findRules'](_0x5dd475);for(var _0x3c3613=0x0,_0x3b3e84=_0x29fc64[_0xbe14('0x20')];_0x3c3613<_0x3b3e84;_0x3c3613+=0x1){_0x29fc64[_0x3c3613]['on']=_0x16f884;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x21')]=function(_0x31a664,_0x2b05cb){_0x31a664=parseInt(_0x31a664,0xa);var _0x4168c8=this[_0xbe14('0x1d')](_0x2b05cb);for(var _0x40538f=0x0,_0x3bf43c=_0x4168c8[_0xbe14('0x20')];_0x40538f<_0x3bf43c;_0x40538f+=0x1){_0x4168c8[_0x40538f][_0xbe14('0x22')]=_0x31a664;}this[_0xbe14('0xc')]();};RuleEngine[_0xbe14('0x5')][_0xbe14('0x23')]=function(){var _0x2ff48e=this[_0xbe14('0x7')];if(_0x2ff48e instanceof Array){_0x2ff48e=_0x2ff48e[_0xbe14('0x24')](function(_0x581e86){_0x581e86[_0xbe14('0x1b')]=_0x581e86['condition']['toString']();_0x581e86[_0xbe14('0x13')]=_0x581e86['consequence'][_0xbe14('0x25')]();return _0x581e86;});}else if(!_[_0xbe14('0x2')](_0x2ff48e)){_0x2ff48e['condition']=_0x2ff48e['condition']['toString']();_0x2ff48e[_0xbe14('0x13')]=_0x2ff48e[_0xbe14('0x13')]['toString']();}return _0x2ff48e;};RuleEngine[_0xbe14('0x5')][_0xbe14('0x26')]=function(_0x452635){this[_0xbe14('0x6')]();if(_[_0xbe14('0x27')](_0x452635)){_0x452635=JSON['parse'](_0x452635);}if(_0x452635 instanceof Array){_0x452635=_0x452635['map'](function(_0x15a997){_0x15a997['condition']=eval('('+_0x15a997['condition']+')');_0x15a997['consequence']=eval('('+_0x15a997[_0xbe14('0x13')]+')');return _0x15a997;});}else if(_0x452635!==null&&typeof _0x452635==_0xbe14('0x28')){_0x452635[_0xbe14('0x1b')]=eval('('+_0x452635[_0xbe14('0x1b')]+')');_0x452635[_0xbe14('0x13')]=eval('('+_0x452635[_0xbe14('0x13')]+')');}this[_0xbe14('0x29')](_0x452635);};module[_0xbe14('0x2a')]=RuleEngine;
\ No newline at end of file
+var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x23ab07,_0x2d2848){var _0x2396f1=function(_0x222612){while(--_0x222612){_0x23ab07['push'](_0x23ab07['shift']());}};_0x2396f1(++_0x2d2848);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc4aa[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine;
\ No newline at end of file
index 4f16750..2920e52 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xbd44=['message','result','catch','sendMailMessage','SendMail','client','http','request','then','error'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xbd44,0x87));var _0x4bd4=function(_0x17531c,_0x2caa6c){_0x17531c=_0x17531c-0x0;var _0xf53468=_0xbd44[_0x17531c];return _0xf53468;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x4bd4('0x0')][_0x4bd4('0x1')]({'port':0x232b});function request(_0x3dd8c8,_0x466789){return new BPromise(function(_0x5e541f,_0xfb7bc4){return client[_0x4bd4('0x2')](_0x3dd8c8,_0x466789)[_0x4bd4('0x3')](function(_0x571ce3){if(_0x571ce3[_0x4bd4('0x4')]){return _0xfb7bc4(_0x571ce3['error'][_0x4bd4('0x5')]);}else{return _0x5e541f(_0x571ce3[_0x4bd4('0x6')]);}})[_0x4bd4('0x7')](function(_0x2df303){return _0xfb7bc4(_0x2df303);});});}exports[_0x4bd4('0x8')]=function(_0x139333,_0x2450e4){return request(_0x4bd4('0x9'),{'account':_0x139333,'message':_0x2450e4});};
\ No newline at end of file
+var _0x510c=['request','then','error','message','catch','sendMailMessage','SendMail','bluebird','http'];(function(_0x59dc02,_0x120477){var _0x556178=function(_0x583273){while(--_0x583273){_0x59dc02['push'](_0x59dc02['shift']());}};_0x556178(++_0x120477);}(_0x510c,0x181));var _0xc510=function(_0x8ee164,_0x157434){_0x8ee164=_0x8ee164-0x0;var _0x56b5aa=_0x510c[_0x8ee164];return _0x56b5aa;};'use strict';var BPromise=require(_0xc510('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc510('0x1')]({'port':0x232b});function request(_0x353d90,_0x37168c){return new BPromise(function(_0x1effe5,_0x16dc48){return client[_0xc510('0x2')](_0x353d90,_0x37168c)[_0xc510('0x3')](function(_0x1c479e){if(_0x1c479e[_0xc510('0x4')]){return _0x16dc48(_0x1c479e[_0xc510('0x4')][_0xc510('0x5')]);}else{return _0x1effe5(_0x1c479e['result']);}})[_0xc510('0x6')](function(_0x519139){return _0x16dc48(_0x519139);});});}exports[_0xc510('0x7')]=function(_0x1e6b78,_0x5782fe){return request(_0xc510('0x8'),{'account':_0x1e6b78,'message':_0x5782fe});};
\ No newline at end of file
index c2dcd57..5b59e1b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb44a=['online','voicePause','chatPause','mailPause','faxPause','smsPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','md5','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','openchannel','fax','sms','whatsapp','StatusTime','toNumber','format','Status','openchannelPause','mailStatus','mailCurrentCapacity','smsStatus','busyQueue','chatWaitingInteractions','whatsappWaitingInteractions','stringify','emit','user:routing:update','omit','exports','moment','../../../config/environment','redis','socket.io-emitter','name'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xb44a,0x1c2));var _0xab44=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0xb44a[_0x132558];return _0x34f138;};'use strict';var _=require('lodash');var md5=require('md5');var moment=require(_0xab44('0x0'));var Redis=require('ioredis');var config=require(_0xab44('0x1'));config['redis']=_['defaults'](config[_0xab44('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xab44('0x3'))(new Redis(config[_0xab44('0x2')]));function Agent(_0x2e3662){this['id']=_0x2e3662['id']||0x0;this[_0xab44('0x4')]=_0x2e3662[_0xab44('0x4')]||'';this[_0xab44('0x5')]=_0x2e3662[_0xab44('0x5')]||!![];this[_0xab44('0x6')]=_0x2e3662[_0xab44('0x6')]||![];this[_0xab44('0x7')]=_0x2e3662[_0xab44('0x7')]||![];this[_0xab44('0x8')]=_0x2e3662[_0xab44('0x8')]||![];this['faxPause']=_0x2e3662[_0xab44('0x9')]||![];this['smsPause']=_0x2e3662[_0xab44('0xa')]||![];this['openchannelPause']=_0x2e3662['openchannelPause']||![];this[_0xab44('0xb')]=_0xab44('0xc');this[_0xab44('0xd')]=0x0;this[_0xab44('0xe')]=_0x2e3662[_0xab44('0xe')]||0x0;this[_0xab44('0xf')]=0x0;this['mailStatus']='unknown';this[_0xab44('0x10')]=0x0;this['mailCapacity']=_0x2e3662[_0xab44('0x11')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xab44('0x12')]=_0xab44('0xc');this[_0xab44('0x13')]=0x0;this[_0xab44('0x14')]=_0x2e3662[_0xab44('0x14')]||0x0;this[_0xab44('0x15')]=0x0;this['smsStatus']='unknown';this[_0xab44('0x16')]=0x0;this[_0xab44('0x17')]=_0x2e3662[_0xab44('0x17')]||0x0;this[_0xab44('0x18')]=0x0;this[_0xab44('0x19')]=_0xab44('0xc');this[_0xab44('0x1a')]=0x0;this[_0xab44('0x1b')]=_0x2e3662[_0xab44('0x1b')]||0x0;this[_0xab44('0x1c')]=0x0;this[_0xab44('0x1d')]='unknown';this[_0xab44('0x1e')]=0x0;this[_0xab44('0x1f')]=_0x2e3662[_0xab44('0x1f')]||0x0;this[_0xab44('0x20')]=0x0;this[_0xab44('0x21')]=![];this['busyQueue']=undefined;this[_0xab44('0x22')]='';this['chatWaitingInteractions']={};this[_0xab44('0x23')]={};this[_0xab44('0x24')]={};this[_0xab44('0x25')]={};this[_0xab44('0x26')]={};this['whatsappWaitingInteractions']={};this[_0xab44('0x27')]();}Agent[_0xab44('0x28')][_0xab44('0x29')]=function(_0x3b17d5){if(this[_0x3b17d5+_0xab44('0x2a')]>0x0){if(this[_0x3b17d5+_0xab44('0x2b')]>0x0&&this[_0x3b17d5+_0xab44('0x2a')]>=this[_0x3b17d5+'Capacity']){return'maxcapacity';}else{return _0xab44('0x2c');}}else{return'idle';}};Agent[_0xab44('0x28')]['updateRealtime']=function(){var _0x2a1bbc=['mail','chat',_0xab44('0x2d'),_0xab44('0x2e'),_0xab44('0x2f'),_0xab44('0x30')];for(var _0x132bf6=0x0;_0x132bf6<_0x2a1bbc['length'];_0x132bf6+=0x1){var _0x2f86ac=this[_0xab44('0x29')](_0x2a1bbc[_0x132bf6]);if(this[_0x2a1bbc[_0x132bf6]+'Status']!==_0x2f86ac){this[_0x2a1bbc[_0x132bf6]+_0xab44('0x31')]=_[_0xab44('0x32')](moment()[_0xab44('0x33')]('x'));}this[_0x2a1bbc[_0x132bf6]+_0xab44('0x34')]=_0x2f86ac;}var _0x4550c8={'id':this['id'],'name':this[_0xab44('0x4')],'online':this['online'],'voicePause':this[_0xab44('0x6')],'chatPause':this[_0xab44('0x7')],'mailPause':this[_0xab44('0x8')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xab44('0x35')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xab44('0xe')],'chatCurrentCapacity':this[_0xab44('0xf')],'mailStatus':this[_0xab44('0x36')],'mailStatusTime':this[_0xab44('0x10')],'mailCapacity':this[_0xab44('0x11')],'mailCurrentCapacity':this[_0xab44('0x37')],'faxStatus':this[_0xab44('0x12')],'faxStatusTime':this[_0xab44('0x13')],'faxCapacity':this[_0xab44('0x14')],'faxCurrentCapacity':this[_0xab44('0x15')],'smsStatus':this[_0xab44('0x38')],'smsStatusTime':this[_0xab44('0x16')],'smsCapacity':this[_0xab44('0x17')],'smsCurrentCapacity':this[_0xab44('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xab44('0x1b')],'whatsappCurrentCapacity':this[_0xab44('0x1c')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xab44('0x1e')],'openchannelCapacity':this[_0xab44('0x1f')],'openchannelCurrentCapacity':this[_0xab44('0x20')],'busy':this[_0xab44('0x21')],'busyQueue':this[_0xab44('0x39')],'chatWaitingInteractions':this[_0xab44('0x3a')],'faxWaitingInteractions':this[_0xab44('0x23')],'mailWaitingInteractions':this[_0xab44('0x24')],'openchannelWaitingInteractions':this[_0xab44('0x25')],'smsWaitingInteractions':this[_0xab44('0x26')],'whatsappWaitingInteractions':this[_0xab44('0x3b')]};var _0x398269=md5(JSON[_0xab44('0x3c')](_0x4550c8));if(this[_0xab44('0x22')]!==_0x398269){this[_0xab44('0x22')]=_0x398269;io[_0xab44('0x3d')](_0xab44('0x3e'),_[_0xab44('0x3f')](_0x4550c8,['online']));}};module[_0xab44('0x40')]=Agent;
\ No newline at end of file
+var _0x77d4=['toNumber','chatPause','chatStatusTime','chatCurrentCapacity','mailStatus','faxStatus','whatsappStatusTime','openchannelCurrentCapacity','stringify','user:routing:update','omit','exports','md5','ioredis','redis','defaults','socket.io-emitter','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','maxcapacity','working','idle','mail','chat','sms','whatsapp','Status','StatusTime'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x77d4,0x108));var _0x477d=function(_0x5e163f,_0x5343c8){_0x5e163f=_0x5e163f-0x0;var _0x282a35=_0x77d4[_0x5e163f];return _0x282a35;};'use strict';var _=require('lodash');var md5=require(_0x477d('0x0'));var moment=require('moment');var Redis=require(_0x477d('0x1'));var config=require('../../../config/environment');config[_0x477d('0x2')]=_[_0x477d('0x3')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x477d('0x4'))(new Redis(config[_0x477d('0x2')]));function Agent(_0x3d2f8d){this['id']=_0x3d2f8d['id']||0x0;this[_0x477d('0x5')]=_0x3d2f8d[_0x477d('0x5')]||'';this[_0x477d('0x6')]=_0x3d2f8d['online']||!![];this['voicePause']=_0x3d2f8d[_0x477d('0x7')]||![];this['chatPause']=_0x3d2f8d['chatPause']||![];this[_0x477d('0x8')]=_0x3d2f8d[_0x477d('0x8')]||![];this[_0x477d('0x9')]=_0x3d2f8d[_0x477d('0x9')]||![];this[_0x477d('0xa')]=_0x3d2f8d['smsPause']||![];this[_0x477d('0xb')]=_0x3d2f8d['openchannelPause']||![];this[_0x477d('0xc')]=_0x477d('0xd');this['chatStatusTime']=0x0;this[_0x477d('0xe')]=_0x3d2f8d[_0x477d('0xe')]||0x0;this['chatCurrentCapacity']=0x0;this['mailStatus']=_0x477d('0xd');this[_0x477d('0xf')]=0x0;this['mailCapacity']=_0x3d2f8d[_0x477d('0x10')]||0x0;this[_0x477d('0x11')]=0x0;this['faxStatus']='unknown';this[_0x477d('0x12')]=0x0;this['faxCapacity']=_0x3d2f8d[_0x477d('0x13')]||0x0;this[_0x477d('0x14')]=0x0;this[_0x477d('0x15')]='unknown';this[_0x477d('0x16')]=0x0;this[_0x477d('0x17')]=_0x3d2f8d[_0x477d('0x17')]||0x0;this[_0x477d('0x18')]=0x0;this['whatsappStatus']=_0x477d('0xd');this['whatsappStatusTime']=0x0;this[_0x477d('0x19')]=_0x3d2f8d[_0x477d('0x19')]||0x0;this[_0x477d('0x1a')]=0x0;this[_0x477d('0x1b')]=_0x477d('0xd');this[_0x477d('0x1c')]=0x0;this['openchannelCapacity']=_0x3d2f8d[_0x477d('0x1d')]||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x477d('0x1e')]=![];this[_0x477d('0x1f')]=undefined;this[_0x477d('0x0')]='';this[_0x477d('0x20')]={};this[_0x477d('0x21')]={};this[_0x477d('0x22')]={};this[_0x477d('0x23')]={};this[_0x477d('0x24')]={};this[_0x477d('0x25')]={};this[_0x477d('0x26')]();}Agent[_0x477d('0x27')][_0x477d('0x28')]=function(_0x43c845){if(this[_0x43c845+_0x477d('0x29')]>0x0){if(this[_0x43c845+'Capacity']>0x0&&this[_0x43c845+_0x477d('0x29')]>=this[_0x43c845+'Capacity']){return _0x477d('0x2a');}else{return _0x477d('0x2b');}}else{return _0x477d('0x2c');}};Agent[_0x477d('0x27')]['updateRealtime']=function(){var _0xd6dca5=[_0x477d('0x2d'),_0x477d('0x2e'),'openchannel','fax',_0x477d('0x2f'),_0x477d('0x30')];for(var _0x386df5=0x0;_0x386df5<_0xd6dca5['length'];_0x386df5+=0x1){var _0x254141=this[_0x477d('0x28')](_0xd6dca5[_0x386df5]);if(this[_0xd6dca5[_0x386df5]+_0x477d('0x31')]!==_0x254141){this[_0xd6dca5[_0x386df5]+_0x477d('0x32')]=_[_0x477d('0x33')](moment()['format']('x'));}this[_0xd6dca5[_0x386df5]+_0x477d('0x31')]=_0x254141;}var _0xeb02f5={'id':this['id'],'name':this[_0x477d('0x5')],'online':this[_0x477d('0x6')],'voicePause':this[_0x477d('0x7')],'chatPause':this[_0x477d('0x34')],'mailPause':this[_0x477d('0x8')],'smsPause':this[_0x477d('0xa')],'faxPause':this[_0x477d('0x9')],'openchannelPause':this[_0x477d('0xb')],'chatStatus':this[_0x477d('0xc')],'chatStatusTime':this[_0x477d('0x35')],'chatCapacity':this[_0x477d('0xe')],'chatCurrentCapacity':this[_0x477d('0x36')],'mailStatus':this[_0x477d('0x37')],'mailStatusTime':this[_0x477d('0xf')],'mailCapacity':this[_0x477d('0x10')],'mailCurrentCapacity':this[_0x477d('0x11')],'faxStatus':this[_0x477d('0x38')],'faxStatusTime':this[_0x477d('0x12')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0x477d('0x14')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x477d('0x16')],'smsCapacity':this[_0x477d('0x17')],'smsCurrentCapacity':this[_0x477d('0x18')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x477d('0x39')],'whatsappCapacity':this[_0x477d('0x19')],'whatsappCurrentCapacity':this[_0x477d('0x1a')],'openchannelStatus':this[_0x477d('0x1b')],'openchannelStatusTime':this[_0x477d('0x1c')],'openchannelCapacity':this[_0x477d('0x1d')],'openchannelCurrentCapacity':this[_0x477d('0x3a')],'busy':this[_0x477d('0x1e')],'busyQueue':this[_0x477d('0x1f')],'chatWaitingInteractions':this[_0x477d('0x20')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x477d('0x22')],'openchannelWaitingInteractions':this[_0x477d('0x23')],'smsWaitingInteractions':this[_0x477d('0x24')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x50b3f7=md5(JSON[_0x477d('0x3b')](_0xeb02f5));if(this[_0x477d('0x0')]!==_0x50b3f7){this['md5']=_0x50b3f7;io['emit'](_0x477d('0x3c'),_[_0x477d('0x3d')](_0xeb02f5,[_0x477d('0x6')]));}};module[_0x477d('0x3e')]=Agent;
\ No newline at end of file
index c7ec688..fb8c677 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe174=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','online','available','format','emit','chat_queue:save','exports','md5','util','../../../config/environment','redis','defaults','localhost','name'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xe174,0x101));var _0x4e17=function(_0x1dd7c7,_0x3da176){_0x1dd7c7=_0x1dd7c7-0x0;var _0x178278=_0xe174[_0x1dd7c7];return _0x178278;};'use strict';var _=require('lodash');var md5=require(_0x4e17('0x0'));var util=require(_0x4e17('0x1'));var Redis=require('ioredis');var config=require(_0x4e17('0x2'));config[_0x4e17('0x3')]=_[_0x4e17('0x4')](config[_0x4e17('0x3')],{'host':_0x4e17('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4e17('0x3')]));function ChatQueue(_0x119415){this['id']=_0x119415['id']||0x0;this[_0x4e17('0x6')]=_0x119415[_0x4e17('0x6')]||'';this['timeout']=_0x119415['timeout']||0xa;this[_0x4e17('0x7')]=_0x119415[_0x4e17('0x7')]||'beepall';this[_0x4e17('0x8')]=_0x119415[_0x4e17('0x8')];this[_0x4e17('0x9')]={};this[_0x4e17('0xa')]=0x0;this['md5']='';this[_0x4e17('0xb')]();this[_0x4e17('0xc')]();}ChatQueue['prototype'][_0x4e17('0xb')]=function(){var _0x4f3c9c=this['mapAgentsId']['_rr'];this[_0x4e17('0x9')]=_[_0x4e17('0xd')](this[_0x4e17('0x8')],'id');this['mapAgentsId'][_0x4e17('0xe')]=_0x4f3c9c;};ChatQueue[_0x4e17('0xf')]['updateRealtime']=function(){this[_0x4e17('0x10')]=0x0;this[_0x4e17('0x11')]=0x0;for(var _0x1b5835=0x0;_0x1b5835<this[_0x4e17('0x8')]['length'];_0x1b5835+=0x1){if(this['Agents'][_0x1b5835][_0x4e17('0x12')]){this['loggedIn']+=0x1;}if(this[_0x4e17('0x8')][_0x1b5835]['chatPause']){this[_0x4e17('0x11')]+=0x1;}}this[_0x4e17('0x13')]=this[_0x4e17('0x10')]-this[_0x4e17('0x11')];this[_0x4e17('0x13')]=this[_0x4e17('0x13')]>=0x0?this[_0x4e17('0x13')]:0x0;var _0x41955f={'id':this['id'],'available':this[_0x4e17('0x13')],'loggedIn':this[_0x4e17('0x10')],'name':this[_0x4e17('0x6')],'paused':this[_0x4e17('0x11')],'waiting':this[_0x4e17('0xa')]};var _0x2f2ff6=md5(JSON['stringify'](_0x41955f));if(this['md5']!==_0x2f2ff6){this['md5']=_0x2f2ff6;io['to'](util[_0x4e17('0x14')]('chat:queue:%s',_0x41955f[_0x4e17('0x6')]))[_0x4e17('0x15')](_0x4e17('0x16'),_0x41955f);}};module[_0x4e17('0x17')]=ChatQueue;
\ No newline at end of file
+var _0x2c7d=['beepall','Agents','waiting','md5','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','paused','length','online','loggedIn','available','format','emit','chat_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','name','timeout','strategy'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x2c7d,0x198));var _0xd2c7=function(_0x59c015,_0x47cde5){_0x59c015=_0x59c015-0x0;var _0x40c234=_0x2c7d[_0x59c015];return _0x40c234;};'use strict';var _=require(_0xd2c7('0x0'));var md5=require('md5');var util=require(_0xd2c7('0x1'));var Redis=require(_0xd2c7('0x2'));var config=require(_0xd2c7('0x3'));config[_0xd2c7('0x4')]=_['defaults'](config[_0xd2c7('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd2c7('0x4')]));function ChatQueue(_0x29e4e2){this['id']=_0x29e4e2['id']||0x0;this[_0xd2c7('0x5')]=_0x29e4e2['name']||'';this['timeout']=_0x29e4e2[_0xd2c7('0x6')]||0xa;this[_0xd2c7('0x7')]=_0x29e4e2['strategy']||_0xd2c7('0x8');this[_0xd2c7('0x9')]=_0x29e4e2[_0xd2c7('0x9')];this['mapAgentsId']={};this[_0xd2c7('0xa')]=0x0;this[_0xd2c7('0xb')]='';this[_0xd2c7('0xc')]();this[_0xd2c7('0xd')]();}ChatQueue[_0xd2c7('0xe')][_0xd2c7('0xc')]=function(){var _0x9b91bb=this[_0xd2c7('0xf')][_0xd2c7('0x10')];this['mapAgentsId']=_['map'](this[_0xd2c7('0x9')],'id');this[_0xd2c7('0xf')][_0xd2c7('0x10')]=_0x9b91bb;};ChatQueue[_0xd2c7('0xe')][_0xd2c7('0xd')]=function(){this['loggedIn']=0x0;this[_0xd2c7('0x11')]=0x0;for(var _0x1db3ab=0x0;_0x1db3ab<this['Agents'][_0xd2c7('0x12')];_0x1db3ab+=0x1){if(this[_0xd2c7('0x9')][_0x1db3ab][_0xd2c7('0x13')]){this[_0xd2c7('0x14')]+=0x1;}if(this['Agents'][_0x1db3ab]['chatPause']){this['paused']+=0x1;}}this[_0xd2c7('0x15')]=this['loggedIn']-this['paused'];this['available']=this[_0xd2c7('0x15')]>=0x0?this[_0xd2c7('0x15')]:0x0;var _0x36e2a5={'id':this['id'],'available':this[_0xd2c7('0x15')],'loggedIn':this[_0xd2c7('0x14')],'name':this[_0xd2c7('0x5')],'paused':this[_0xd2c7('0x11')],'waiting':this[_0xd2c7('0xa')]};var _0x467b35=md5(JSON['stringify'](_0x36e2a5));if(this[_0xd2c7('0xb')]!==_0x467b35){this[_0xd2c7('0xb')]=_0x467b35;io['to'](util[_0xd2c7('0x16')]('chat:queue:%s',_0x36e2a5[_0xd2c7('0x5')]))[_0xd2c7('0x17')](_0xd2c7('0x18'),_0x36e2a5);}};module[_0xd2c7('0x19')]=ChatQueue;
\ No newline at end of file
index f977a42..05b379c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf403=['updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','length','faxPause','paused','available','waiting','stringify','format','emit','fax_queue:save','lodash','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','updateRealtime'];(function(_0x213d8e,_0x43190e){var _0x6d74cc=function(_0x46edfb){while(--_0x46edfb){_0x213d8e['push'](_0x213d8e['shift']());}};_0x6d74cc(++_0x43190e);}(_0xf403,0x143));var _0x3f40=function(_0x3813b8,_0x44db5a){_0x3813b8=_0x3813b8-0x0;var _0xf68e3a=_0xf403[_0x3813b8];return _0xf68e3a;};'use strict';var _=require(_0x3f40('0x0'));var md5=require(_0x3f40('0x1'));var util=require(_0x3f40('0x2'));var Redis=require('ioredis');var config=require(_0x3f40('0x3'));config[_0x3f40('0x4')]=_[_0x3f40('0x5')](config[_0x3f40('0x4')],{'host':_0x3f40('0x6'),'port':0x18eb});var io=require(_0x3f40('0x7'))(new Redis(config[_0x3f40('0x4')]));function FaxQueue(_0x1429d5){this['id']=_0x1429d5['id']||0x0;this[_0x3f40('0x8')]=_0x1429d5['name']||'';this['timeout']=_0x1429d5['timeout']||0xa;this[_0x3f40('0x9')]=_0x1429d5[_0x3f40('0x9')]||_0x3f40('0xa');this['Agents']=_0x1429d5[_0x3f40('0xb')];this['mapAgentsId']={};this['waiting']=0x0;this['md5']='';this['updateRouting']();this[_0x3f40('0xc')]();}FaxQueue['prototype'][_0x3f40('0xd')]=function(){var _0x2b93ae=this[_0x3f40('0xe')][_0x3f40('0xf')];this['mapAgentsId']=_[_0x3f40('0x10')](this[_0x3f40('0xb')],'id');this[_0x3f40('0xe')]['_rr']=_0x2b93ae;};FaxQueue[_0x3f40('0x11')][_0x3f40('0xc')]=function(){this[_0x3f40('0x12')]=0x0;this['paused']=0x0;for(var _0xb0dd8e=0x0;_0xb0dd8e<this[_0x3f40('0xb')][_0x3f40('0x13')];_0xb0dd8e+=0x1){if(this[_0x3f40('0xb')][_0xb0dd8e]['online']){this[_0x3f40('0x12')]+=0x1;}if(this[_0x3f40('0xb')][_0xb0dd8e][_0x3f40('0x14')]){this[_0x3f40('0x15')]+=0x1;}}this[_0x3f40('0x16')]=this['loggedIn']-this[_0x3f40('0x15')];this[_0x3f40('0x16')]=this[_0x3f40('0x16')]>=0x0?this[_0x3f40('0x16')]:0x0;var _0x5d3e23={'id':this['id'],'available':this[_0x3f40('0x16')],'loggedIn':this[_0x3f40('0x12')],'name':this[_0x3f40('0x8')],'paused':this['paused'],'waiting':this[_0x3f40('0x17')]};var _0x1ce244=md5(JSON[_0x3f40('0x18')](_0x5d3e23));if(this[_0x3f40('0x1')]!==_0x1ce244){this[_0x3f40('0x1')]=_0x1ce244;io['to'](util[_0x3f40('0x19')]('fax:queue:%s',_0x5d3e23['name']))[_0x3f40('0x1a')](_0x3f40('0x1b'),_0x5d3e23);}};module['exports']=FaxQueue;
\ No newline at end of file
+var _0x923b=['waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','online','available','stringify','fax:queue:%s','emit','exports','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x923b,0x83));var _0xb923=function(_0x15ca1a,_0x30fc82){_0x15ca1a=_0x15ca1a-0x0;var _0x507626=_0x923b[_0x15ca1a];return _0x507626;};'use strict';var _=require(_0xb923('0x0'));var md5=require(_0xb923('0x1'));var util=require(_0xb923('0x2'));var Redis=require(_0xb923('0x3'));var config=require('../../../config/environment');config[_0xb923('0x4')]=_[_0xb923('0x5')](config[_0xb923('0x4')],{'host':_0xb923('0x6'),'port':0x18eb});var io=require(_0xb923('0x7'))(new Redis(config[_0xb923('0x4')]));function FaxQueue(_0xf78f30){this['id']=_0xf78f30['id']||0x0;this[_0xb923('0x8')]=_0xf78f30['name']||'';this[_0xb923('0x9')]=_0xf78f30[_0xb923('0x9')]||0xa;this[_0xb923('0xa')]=_0xf78f30[_0xb923('0xa')]||_0xb923('0xb');this['Agents']=_0xf78f30[_0xb923('0xc')];this[_0xb923('0xd')]={};this[_0xb923('0xe')]=0x0;this['md5']='';this[_0xb923('0xf')]();this[_0xb923('0x10')]();}FaxQueue['prototype'][_0xb923('0xf')]=function(){var _0x478a7c=this[_0xb923('0xd')][_0xb923('0x11')];this[_0xb923('0xd')]=_[_0xb923('0x12')](this[_0xb923('0xc')],'id');this[_0xb923('0xd')][_0xb923('0x11')]=_0x478a7c;};FaxQueue[_0xb923('0x13')][_0xb923('0x10')]=function(){this[_0xb923('0x14')]=0x0;this[_0xb923('0x15')]=0x0;for(var _0x576664=0x0;_0x576664<this[_0xb923('0xc')][_0xb923('0x16')];_0x576664+=0x1){if(this[_0xb923('0xc')][_0x576664][_0xb923('0x17')]){this[_0xb923('0x14')]+=0x1;}if(this[_0xb923('0xc')][_0x576664]['faxPause']){this['paused']+=0x1;}}this[_0xb923('0x18')]=this[_0xb923('0x14')]-this[_0xb923('0x15')];this[_0xb923('0x18')]=this[_0xb923('0x18')]>=0x0?this[_0xb923('0x18')]:0x0;var _0x629b05={'id':this['id'],'available':this[_0xb923('0x18')],'loggedIn':this[_0xb923('0x14')],'name':this[_0xb923('0x8')],'paused':this['paused'],'waiting':this[_0xb923('0xe')]};var _0x3a8118=md5(JSON[_0xb923('0x19')](_0x629b05));if(this[_0xb923('0x1')]!==_0x3a8118){this['md5']=_0x3a8118;io['to'](util['format'](_0xb923('0x1a'),_0x629b05[_0xb923('0x8')]))[_0xb923('0x1b')]('fax_queue:save',_0x629b05);}};module[_0xb923('0x1c')]=FaxQueue;
\ No newline at end of file
index 42f66d3..db9a3da 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde41=['Intervals','exports','name'];(function(_0x41fe94,_0x2125b9){var _0x3a5cf1=function(_0x5aa8b6){while(--_0x5aa8b6){_0x41fe94['push'](_0x41fe94['shift']());}};_0x3a5cf1(++_0x2125b9);}(_0xde41,0xe3));var _0x1de4=function(_0x38ad4b,_0x55cd37){_0x38ad4b=_0x38ad4b-0x0;var _0x1c2378=_0xde41[_0x38ad4b];return _0x1c2378;};'use strict';function Interval(_0x267958){this['id']=_0x267958['id']||0x0;this[_0x1de4('0x0')]=_0x267958[_0x1de4('0x0')]||'';this['Intervals']=_0x267958[_0x1de4('0x1')]||{};}module[_0x1de4('0x2')]=Interval;
\ No newline at end of file
+var _0x45da=['name','Intervals','exports'];(function(_0x183534,_0xac3e09){var _0x459384=function(_0x4bbcc5){while(--_0x4bbcc5){_0x183534['push'](_0x183534['shift']());}};_0x459384(++_0xac3e09);}(_0x45da,0x132));var _0xa45d=function(_0x283c81,_0xcc39d1){_0x283c81=_0x283c81-0x0;var _0xdc8b07=_0x45da[_0x283c81];return _0xdc8b07;};'use strict';function Interval(_0x713ec6){this['id']=_0x713ec6['id']||0x0;this[_0xa45d('0x0')]=_0x713ec6[_0xa45d('0x0')]||'';this[_0xa45d('0x1')]=_0x713ec6['Intervals']||{};}module[_0xa45d('0x2')]=Interval;
\ No newline at end of file
index e461ecd..273da5c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x47a1=['md5','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime','paused','online','mailPause','available','loggedIn','format','mail:queue:%s','mail_queue:save','exports','lodash'];(function(_0x2ccc23,_0x293455){var _0x4b9c76=function(_0x59ff31){while(--_0x59ff31){_0x2ccc23['push'](_0x2ccc23['shift']());}};_0x4b9c76(++_0x293455);}(_0x47a1,0x13e));var _0x147a=function(_0x2ee1d9,_0x57133d){_0x2ee1d9=_0x2ee1d9-0x0;var _0xc0c34a=_0x47a1[_0x2ee1d9];return _0xc0c34a;};'use strict';var _=require(_0x147a('0x0'));var md5=require(_0x147a('0x1'));var util=require(_0x147a('0x2'));var Redis=require(_0x147a('0x3'));var config=require(_0x147a('0x4'));config['redis']=_[_0x147a('0x5')](config['redis'],{'host':_0x147a('0x6'),'port':0x18eb});var io=require(_0x147a('0x7'))(new Redis(config[_0x147a('0x8')]));function MailQueue(_0x3defad){this['id']=_0x3defad['id']||0x0;this[_0x147a('0x9')]=_0x3defad['name']||'';this[_0x147a('0xa')]=_0x3defad['timeout']||0xa;this['strategy']=_0x3defad[_0x147a('0xb')]||'beepall';this['Agents']=_0x3defad[_0x147a('0xc')];this['mapAgentsId']={};this[_0x147a('0xd')]=0x0;this[_0x147a('0x1')]='';this[_0x147a('0xe')]();this['updateRealtime']();}MailQueue[_0x147a('0xf')][_0x147a('0xe')]=function(){var _0x165075=this[_0x147a('0x10')][_0x147a('0x11')];this[_0x147a('0x10')]=_[_0x147a('0x12')](this[_0x147a('0xc')],'id');this[_0x147a('0x10')][_0x147a('0x11')]=_0x165075;};MailQueue[_0x147a('0xf')][_0x147a('0x13')]=function(){this['loggedIn']=0x0;this[_0x147a('0x14')]=0x0;for(var _0x28791f=0x0;_0x28791f<this[_0x147a('0xc')]['length'];_0x28791f+=0x1){if(this['Agents'][_0x28791f][_0x147a('0x15')]){this['loggedIn']+=0x1;}if(this[_0x147a('0xc')][_0x28791f][_0x147a('0x16')]){this['paused']+=0x1;}}this[_0x147a('0x17')]=this[_0x147a('0x18')]-this['paused'];this[_0x147a('0x17')]=this[_0x147a('0x17')]>=0x0?this['available']:0x0;var _0x20a4ab={'id':this['id'],'available':this['available'],'loggedIn':this[_0x147a('0x18')],'name':this['name'],'paused':this[_0x147a('0x14')],'waiting':this[_0x147a('0xd')]};var _0x3568b3=md5(JSON['stringify'](_0x20a4ab));if(this['md5']!==_0x3568b3){this['md5']=_0x3568b3;io['to'](util[_0x147a('0x19')](_0x147a('0x1a'),_0x20a4ab[_0x147a('0x9')]))['emit'](_0x147a('0x1b'),_0x20a4ab);}};module[_0x147a('0x1c')]=MailQueue;
\ No newline at end of file
+var _0xc136=['socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc136,0x110));var _0x6c13=function(_0x23f302,_0xf2e57c){_0x23f302=_0x23f302-0x0;var _0x4df716=_0xc136[_0x23f302];return _0x4df716;};'use strict';var _=require(_0x6c13('0x0'));var md5=require(_0x6c13('0x1'));var util=require(_0x6c13('0x2'));var Redis=require(_0x6c13('0x3'));var config=require(_0x6c13('0x4'));config[_0x6c13('0x5')]=_[_0x6c13('0x6')](config['redis'],{'host':_0x6c13('0x7'),'port':0x18eb});var io=require(_0x6c13('0x8'))(new Redis(config['redis']));function MailQueue(_0x35ea15){this['id']=_0x35ea15['id']||0x0;this[_0x6c13('0x9')]=_0x35ea15[_0x6c13('0x9')]||'';this['timeout']=_0x35ea15['timeout']||0xa;this[_0x6c13('0xa')]=_0x35ea15[_0x6c13('0xa')]||_0x6c13('0xb');this[_0x6c13('0xc')]=_0x35ea15['Agents'];this[_0x6c13('0xd')]={};this[_0x6c13('0xe')]=0x0;this[_0x6c13('0x1')]='';this[_0x6c13('0xf')]();this['updateRealtime']();}MailQueue[_0x6c13('0x10')][_0x6c13('0xf')]=function(){var _0x9c2f1a=this[_0x6c13('0xd')][_0x6c13('0x11')];this[_0x6c13('0xd')]=_[_0x6c13('0x12')](this[_0x6c13('0xc')],'id');this[_0x6c13('0xd')][_0x6c13('0x11')]=_0x9c2f1a;};MailQueue[_0x6c13('0x10')][_0x6c13('0x13')]=function(){this[_0x6c13('0x14')]=0x0;this[_0x6c13('0x15')]=0x0;for(var _0x53aee7=0x0;_0x53aee7<this[_0x6c13('0xc')][_0x6c13('0x16')];_0x53aee7+=0x1){if(this[_0x6c13('0xc')][_0x53aee7][_0x6c13('0x17')]){this['loggedIn']+=0x1;}if(this[_0x6c13('0xc')][_0x53aee7]['mailPause']){this[_0x6c13('0x15')]+=0x1;}}this[_0x6c13('0x18')]=this[_0x6c13('0x14')]-this[_0x6c13('0x15')];this[_0x6c13('0x18')]=this[_0x6c13('0x18')]>=0x0?this[_0x6c13('0x18')]:0x0;var _0xff6235={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6c13('0x14')],'name':this[_0x6c13('0x9')],'paused':this[_0x6c13('0x15')],'waiting':this['waiting']};var _0x48c006=md5(JSON['stringify'](_0xff6235));if(this[_0x6c13('0x1')]!==_0x48c006){this['md5']=_0x48c006;io['to'](util['format']('mail:queue:%s',_0xff6235[_0x6c13('0x9')]))[_0x6c13('0x19')](_0x6c13('0x1a'),_0xff6235);}};module[_0x6c13('0x1b')]=MailQueue;
\ No newline at end of file
index dbc5d5e..f6c2821 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x326f,0xd1));var _0xf326=function(_0x16b333,_0x344c00){_0x16b333=_0x16b333-0x0;var _0x54fc31=_0x326f[_0x16b333];return _0x54fc31;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483<this[_0xf326('0xf')]['length'];_0x5c8483+=0x1){if(this['Agents'][_0x5c8483][_0xf326('0x13')]){this[_0xf326('0x11')]+=0x1;}if(this[_0xf326('0xf')][_0x5c8483][_0xf326('0x14')]){this[_0xf326('0x12')]+=0x1;}}this[_0xf326('0x15')]=this[_0xf326('0x11')]-this[_0xf326('0x12')];this['available']=this[_0xf326('0x15')]>=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue;
\ No newline at end of file
+var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xc4aa[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0<this[_0xac4a('0xa')][_0xac4a('0x13')];_0x3b71c0+=0x1){if(this[_0xac4a('0xa')][_0x3b71c0][_0xac4a('0x14')]){this[_0xac4a('0x11')]+=0x1;}if(this[_0xac4a('0xa')][_0x3b71c0]['openchannelPause']){this[_0xac4a('0x12')]+=0x1;}}this[_0xac4a('0x15')]=this[_0xac4a('0x11')]-this[_0xac4a('0x12')];this[_0xac4a('0x15')]=this[_0xac4a('0x15')]>=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue;
\ No newline at end of file
index b6ea075..66e6fa5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaa88=['map','loggedIn','online','smsPause','paused','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','md5','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr'];(function(_0x1778df,_0x1ae849){var _0x26ae1c=function(_0x3c2353){while(--_0x3c2353){_0x1778df['push'](_0x1778df['shift']());}};_0x26ae1c(++_0x1ae849);}(_0xaa88,0x137));var _0x8aa8=function(_0x1505e5,_0x5cc291){_0x1505e5=_0x1505e5-0x0;var _0x5b1dcd=_0xaa88[_0x1505e5];return _0x5b1dcd;};'use strict';var _=require(_0x8aa8('0x0'));var md5=require(_0x8aa8('0x1'));var util=require(_0x8aa8('0x2'));var Redis=require(_0x8aa8('0x3'));var config=require('../../../config/environment');config[_0x8aa8('0x4')]=_[_0x8aa8('0x5')](config[_0x8aa8('0x4')],{'host':_0x8aa8('0x6'),'port':0x18eb});var io=require(_0x8aa8('0x7'))(new Redis(config[_0x8aa8('0x4')]));function SmsQueue(_0x5e2595){this['id']=_0x5e2595['id']||0x0;this['name']=_0x5e2595[_0x8aa8('0x8')]||'';this['timeout']=_0x5e2595[_0x8aa8('0x9')]||0xa;this[_0x8aa8('0xa')]=_0x5e2595[_0x8aa8('0xa')]||_0x8aa8('0xb');this['Agents']=_0x5e2595[_0x8aa8('0xc')];this[_0x8aa8('0xd')]={};this[_0x8aa8('0xe')]=0x0;this['md5']='';this[_0x8aa8('0xf')]();this[_0x8aa8('0x10')]();}SmsQueue[_0x8aa8('0x11')][_0x8aa8('0xf')]=function(){var _0x583688=this[_0x8aa8('0xd')][_0x8aa8('0x12')];this['mapAgentsId']=_[_0x8aa8('0x13')](this[_0x8aa8('0xc')],'id');this[_0x8aa8('0xd')]['_rr']=_0x583688;};SmsQueue[_0x8aa8('0x11')][_0x8aa8('0x10')]=function(){this[_0x8aa8('0x14')]=0x0;this['paused']=0x0;for(var _0x391642=0x0;_0x391642<this['Agents']['length'];_0x391642+=0x1){if(this[_0x8aa8('0xc')][_0x391642][_0x8aa8('0x15')]){this[_0x8aa8('0x14')]+=0x1;}if(this[_0x8aa8('0xc')][_0x391642][_0x8aa8('0x16')]){this[_0x8aa8('0x17')]+=0x1;}}this[_0x8aa8('0x18')]=this[_0x8aa8('0x14')]-this[_0x8aa8('0x17')];this['available']=this['available']>=0x0?this[_0x8aa8('0x18')]:0x0;var _0x49d80d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x8aa8('0x14')],'name':this['name'],'paused':this[_0x8aa8('0x17')],'waiting':this[_0x8aa8('0xe')]};var _0x2a9f56=md5(JSON[_0x8aa8('0x19')](_0x49d80d));if(this['md5']!==_0x2a9f56){this[_0x8aa8('0x1')]=_0x2a9f56;io['to'](util[_0x8aa8('0x1a')](_0x8aa8('0x1b'),_0x49d80d[_0x8aa8('0x8')]))[_0x8aa8('0x1c')](_0x8aa8('0x1d'),_0x49d80d);}};module['exports']=SmsQueue;
\ No newline at end of file
+var _0x0b78=['socket.io-emitter','redis','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','defaults','localhost'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x80b7('0x0'));var md5=require(_0x80b7('0x1'));var util=require('util');var Redis=require(_0x80b7('0x2'));var config=require(_0x80b7('0x3'));config['redis']=_[_0x80b7('0x4')](config['redis'],{'host':_0x80b7('0x5'),'port':0x18eb});var io=require(_0x80b7('0x6'))(new Redis(config[_0x80b7('0x7')]));function SmsQueue(_0x5d4a96){this['id']=_0x5d4a96['id']||0x0;this['name']=_0x5d4a96[_0x80b7('0x8')]||'';this['timeout']=_0x5d4a96[_0x80b7('0x9')]||0xa;this[_0x80b7('0xa')]=_0x5d4a96[_0x80b7('0xa')]||_0x80b7('0xb');this['Agents']=_0x5d4a96[_0x80b7('0xc')];this[_0x80b7('0xd')]={};this[_0x80b7('0xe')]=0x0;this['md5']='';this[_0x80b7('0xf')]();this['updateRealtime']();}SmsQueue[_0x80b7('0x10')][_0x80b7('0xf')]=function(){var _0x3b19da=this[_0x80b7('0xd')][_0x80b7('0x11')];this[_0x80b7('0xd')]=_[_0x80b7('0x12')](this[_0x80b7('0xc')],'id');this[_0x80b7('0xd')][_0x80b7('0x11')]=_0x3b19da;};SmsQueue[_0x80b7('0x10')]['updateRealtime']=function(){this[_0x80b7('0x13')]=0x0;this[_0x80b7('0x14')]=0x0;for(var _0x527c5b=0x0;_0x527c5b<this[_0x80b7('0xc')][_0x80b7('0x15')];_0x527c5b+=0x1){if(this['Agents'][_0x527c5b][_0x80b7('0x16')]){this[_0x80b7('0x13')]+=0x1;}if(this[_0x80b7('0xc')][_0x527c5b][_0x80b7('0x17')]){this[_0x80b7('0x14')]+=0x1;}}this[_0x80b7('0x18')]=this[_0x80b7('0x13')]-this[_0x80b7('0x14')];this[_0x80b7('0x18')]=this[_0x80b7('0x18')]>=0x0?this['available']:0x0;var _0x3bb691={'id':this['id'],'available':this[_0x80b7('0x18')],'loggedIn':this[_0x80b7('0x13')],'name':this[_0x80b7('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x45be23=md5(JSON[_0x80b7('0x19')](_0x3bb691));if(this[_0x80b7('0x1')]!==_0x45be23){this[_0x80b7('0x1')]=_0x45be23;io['to'](util['format']('sms:queue:%s',_0x3bb691[_0x80b7('0x8')]))[_0x80b7('0x1a')](_0x80b7('0x1b'),_0x3bb691);}};module[_0x80b7('0x1c')]=SmsQueue;
\ No newline at end of file
index 024ef65..fee840d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x67b8=['paused','available','waiting','emit','whatsapp_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','name','strategy','beepall','Agents','updateRealtime','prototype','mapAgentsId','_rr','loggedIn','length','online','whatsappPause'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x67b8,0x176));var _0x867b=function(_0x6f432e,_0x23b287){_0x6f432e=_0x6f432e-0x0;var _0xb2cfe0=_0x67b8[_0x6f432e];return _0xb2cfe0;};'use strict';var _=require(_0x867b('0x0'));var md5=require(_0x867b('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x867b('0x2'));config['redis']=_[_0x867b('0x3')](config[_0x867b('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x867b('0x4')]));function WhatsappQueue(_0x38e2fc){this['id']=_0x38e2fc['id']||0x0;this[_0x867b('0x5')]=_0x38e2fc[_0x867b('0x5')]||'';this['timeout']=_0x38e2fc['timeout']||0xa;this['strategy']=_0x38e2fc[_0x867b('0x6')]||_0x867b('0x7');this[_0x867b('0x8')]=_0x38e2fc['Agents'];this['mapAgentsId']={};this['waiting']=0x0;this[_0x867b('0x1')]='';this['updateRouting']();this[_0x867b('0x9')]();}WhatsappQueue[_0x867b('0xa')]['updateRouting']=function(){var _0x2e7684=this[_0x867b('0xb')]['_rr'];this[_0x867b('0xb')]=_['map'](this[_0x867b('0x8')],'id');this['mapAgentsId'][_0x867b('0xc')]=_0x2e7684;};WhatsappQueue[_0x867b('0xa')][_0x867b('0x9')]=function(){this[_0x867b('0xd')]=0x0;this['paused']=0x0;for(var _0x556223=0x0;_0x556223<this[_0x867b('0x8')][_0x867b('0xe')];_0x556223+=0x1){if(this[_0x867b('0x8')][_0x556223][_0x867b('0xf')]){this[_0x867b('0xd')]+=0x1;}if(this[_0x867b('0x8')][_0x556223][_0x867b('0x10')]){this[_0x867b('0x11')]+=0x1;}}this[_0x867b('0x12')]=this[_0x867b('0xd')]-this[_0x867b('0x11')];this[_0x867b('0x12')]=this[_0x867b('0x12')]>=0x0?this['available']:0x0;var _0x248252={'id':this['id'],'available':this[_0x867b('0x12')],'loggedIn':this['loggedIn'],'name':this[_0x867b('0x5')],'paused':this['paused'],'waiting':this[_0x867b('0x13')]};var _0x4f3193=md5(JSON['stringify'](_0x248252));if(this[_0x867b('0x1')]!==_0x4f3193){this['md5']=_0x4f3193;io['to'](util['format']('whatsapp:queue:%s',_0x248252[_0x867b('0x5')]))[_0x867b('0x14')](_0x867b('0x15'),_0x248252);}};module[_0x867b('0x16')]=WhatsappQueue;
\ No newline at end of file
+var _0xe7f2=['mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','online','whatsappPause','available','paused','stringify','md5','format','emit','whatsapp_queue:save','exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0xe7f2,0x151));var _0x2e7f=function(_0x410506,_0x3410c4){_0x410506=_0x410506-0x0;var _0x5b2230=_0xe7f2[_0x410506];return _0x5b2230;};'use strict';var _=require(_0x2e7f('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x2e7f('0x1'));var config=require(_0x2e7f('0x2'));config[_0x2e7f('0x3')]=_[_0x2e7f('0x4')](config[_0x2e7f('0x3')],{'host':_0x2e7f('0x5'),'port':0x18eb});var io=require(_0x2e7f('0x6'))(new Redis(config[_0x2e7f('0x3')]));function WhatsappQueue(_0x1afea5){this['id']=_0x1afea5['id']||0x0;this[_0x2e7f('0x7')]=_0x1afea5[_0x2e7f('0x7')]||'';this[_0x2e7f('0x8')]=_0x1afea5[_0x2e7f('0x8')]||0xa;this['strategy']=_0x1afea5[_0x2e7f('0x9')]||'beepall';this[_0x2e7f('0xa')]=_0x1afea5[_0x2e7f('0xa')];this[_0x2e7f('0xb')]={};this[_0x2e7f('0xc')]=0x0;this['md5']='';this[_0x2e7f('0xd')]();this[_0x2e7f('0xe')]();}WhatsappQueue[_0x2e7f('0xf')][_0x2e7f('0xd')]=function(){var _0x7c19f8=this[_0x2e7f('0xb')][_0x2e7f('0x10')];this['mapAgentsId']=_[_0x2e7f('0x11')](this[_0x2e7f('0xa')],'id');this[_0x2e7f('0xb')][_0x2e7f('0x10')]=_0x7c19f8;};WhatsappQueue['prototype'][_0x2e7f('0xe')]=function(){this[_0x2e7f('0x12')]=0x0;this['paused']=0x0;for(var _0x26840d=0x0;_0x26840d<this[_0x2e7f('0xa')]['length'];_0x26840d+=0x1){if(this[_0x2e7f('0xa')][_0x26840d][_0x2e7f('0x13')]){this[_0x2e7f('0x12')]+=0x1;}if(this[_0x2e7f('0xa')][_0x26840d][_0x2e7f('0x14')]){this['paused']+=0x1;}}this[_0x2e7f('0x15')]=this[_0x2e7f('0x12')]-this[_0x2e7f('0x16')];this[_0x2e7f('0x15')]=this[_0x2e7f('0x15')]>=0x0?this[_0x2e7f('0x15')]:0x0;var _0x33e904={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2e7f('0x12')],'name':this[_0x2e7f('0x7')],'paused':this[_0x2e7f('0x16')],'waiting':this[_0x2e7f('0xc')]};var _0xdfcf1e=md5(JSON[_0x2e7f('0x17')](_0x33e904));if(this[_0x2e7f('0x18')]!==_0xdfcf1e){this[_0x2e7f('0x18')]=_0xdfcf1e;io['to'](util[_0x2e7f('0x19')]('whatsapp:queue:%s',_0x33e904[_0x2e7f('0x7')]))[_0x2e7f('0x1a')](_0x2e7f('0x1b'),_0x33e904);}};module[_0x2e7f('0x1c')]=WhatsappQueue;
\ No newline at end of file
index ff47b88..28cd7ff 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x29edb9,_0x4aace9){var _0x43a5ce=function(_0x321763){while(--_0x321763){_0x29edb9['push'](_0x29edb9['shift']());}};_0x43a5ce(++_0x4aace9);}(_0xb10b,0x12a));var _0xbb10=function(_0xc8069a,_0x2968fc){_0xc8069a=_0xc8069a-0x0;var _0x16bc69=_0xb10b[_0xc8069a];return _0x16bc69;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime;
\ No newline at end of file
+var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x48a0a7,_0x27aaa3){var _0x1d2ea9=function(_0x1a41dc){while(--_0x1a41dc){_0x48a0a7['push'](_0x48a0a7['shift']());}};_0x1d2ea9(++_0x27aaa3);}(_0xb10b,0x12a));var _0xbb10=function(_0x4efdfd,_0x4a27df){_0x4efdfd=_0x4efdfd-0x0;var _0x2b413=_0xb10b[_0x4efdfd];return _0x2b413;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime;
\ No newline at end of file
index 8f651b3..b3a1196 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfe06=['updateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction'];(function(_0x30bb30,_0x564af1){var _0xce44e7=function(_0x5b96aa){while(--_0x5b96aa){_0x30bb30['push'](_0x30bb30['shift']());}};_0xce44e7(++_0x564af1);}(_0xfe06,0x1e9));var _0x6fe0=function(_0x9af17c,_0x34486f){_0x9af17c=_0x9af17c-0x0;var _0x3572f1=_0xfe06[_0x9af17c];return _0x3572f1;};'use strict';var client=require(_0x6fe0('0x0'));exports['update']=function(_0x2ac6d3,_0x5dc53a){return client[_0x6fe0('0x1')](_0x6fe0('0x2'),{'body':_0x5dc53a,'options':{'where':{'id':_0x2ac6d3}},'log':_0x6fe0('0x3')});};exports['addTags']=function(_0x5b454e,_0x1bf7ea){return client[_0x6fe0('0x1')](_0x6fe0('0x4'),{'body':_0x1bf7ea,'options':{'where':{'id':_0x5b454e}},'log':_0x6fe0('0x5')});};
\ No newline at end of file
+var _0x55bc=['updateChatInteraction','addTags','AddTagsToChatInteraction','../client','Request'];(function(_0x41cc1f,_0x30cd37){var _0x11c2e1=function(_0x30b8c8){while(--_0x30b8c8){_0x41cc1f['push'](_0x41cc1f['shift']());}};_0x11c2e1(++_0x30cd37);}(_0x55bc,0xc1));var _0xc55b=function(_0x2a8547,_0xfe3e55){_0x2a8547=_0x2a8547-0x0;var _0x190d24=_0x55bc[_0x2a8547];return _0x190d24;};'use strict';var client=require(_0xc55b('0x0'));exports['update']=function(_0x285d19,_0x441379){return client[_0xc55b('0x1')]('UpdateChatInteraction',{'body':_0x441379,'options':{'where':{'id':_0x285d19}},'log':_0xc55b('0x2')});};exports[_0xc55b('0x3')]=function(_0x280840,_0x377430){return client[_0xc55b('0x1')](_0xc55b('0x4'),{'body':_0x377430,'options':{'where':{'id':_0x280840}},'log':'addTagsToChatInteraction'});};
\ No newline at end of file
index 9417c11..181990b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc5af=['Request','CreateChatMessage','createChatMessage','create'];(function(_0x34f026,_0xc2deae){var _0x5ad316=function(_0x2d988e){while(--_0x2d988e){_0x34f026['push'](_0x34f026['shift']());}};_0x5ad316(++_0xc2deae);}(_0xc5af,0x1ab));var _0xfc5a=function(_0x4b5d08,_0x106fea){_0x4b5d08=_0x4b5d08-0x0;var _0x5a827b=_0xc5af[_0x4b5d08];return _0x5a827b;};'use strict';var client=require('../client');exports[_0xfc5a('0x0')]=function(_0x419205){return client[_0xfc5a('0x1')](_0xfc5a('0x2'),{'body':_0x419205,'log':_0xfc5a('0x3')});};
\ No newline at end of file
+var _0xdaf2=['createChatMessage','../client','Request'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xdaf2,0x18d));var _0x2daf=function(_0xdd2bfa,_0x5bd304){_0xdd2bfa=_0xdd2bfa-0x0;var _0x55397e=_0xdaf2[_0xdd2bfa];return _0x55397e;};'use strict';var client=require(_0x2daf('0x0'));exports['create']=function(_0x4e2518){return client[_0x2daf('0x1')]('CreateChatMessage',{'body':_0x4e2518,'log':_0x2daf('0x2')});};
\ No newline at end of file
index 995f5b8..6b4f70c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x61a5=['name','timeout','strategy','Agents','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x5b0f92,_0x5308d3){var _0x17a3a0=function(_0x3ad42d){while(--_0x3ad42d){_0x5b0f92['push'](_0x5b0f92['shift']());}};_0x17a3a0(++_0x5308d3);}(_0x61a5,0xf0));var _0x561a=function(_0x33bcdb,_0x11846b){_0x33bcdb=_0x33bcdb-0x0;var _0x18a9bf=_0x61a5[_0x33bcdb];return _0x18a9bf;};'use strict';var client=require(_0x561a('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x561a('0x1')](_0x561a('0x2'),{'options':{'raw':![],'attributes':['id',_0x561a('0x3'),_0x561a('0x4'),_0x561a('0x5')],'include':[{'model':'User','as':_0x561a('0x6'),'attributes':['id',_0x561a('0x3'),'online',_0x561a('0x7')]}]},'log':_0x561a('0x8')});};};
\ No newline at end of file
+var _0x34aa=['Request','GetChatQueue','name','timeout','User','Agents','online','chatPause','getChatQueues','../client'];(function(_0x238671,_0x18f9c2){var _0x35f245=function(_0x6273cc){while(--_0x6273cc){_0x238671['push'](_0x238671['shift']());}};_0x35f245(++_0x18f9c2);}(_0x34aa,0x171));var _0xa34a=function(_0x154940,_0x4a448a){_0x154940=_0x154940-0x0;var _0x401409=_0x34aa[_0x154940];return _0x401409;};'use strict';var client=require(_0xa34a('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa34a('0x1')](_0xa34a('0x2'),{'options':{'raw':![],'attributes':['id',_0xa34a('0x3'),_0xa34a('0x4'),'strategy'],'include':[{'model':_0xa34a('0x5'),'as':_0xa34a('0x6'),'attributes':['id',_0xa34a('0x3'),_0xa34a('0x7'),_0xa34a('0x8')]}]},'log':_0xa34a('0x9')});};};
\ No newline at end of file
index 4a79bc0..be0ad87 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc7b4=['DESC','UpdateChatQueueReport','../client','Request','CreateChatQueueReport','update'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc7b4,0x15e));var _0x4c7b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc7b4[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x4c7b('0x0'));exports['create']=function(_0x6edfa6){return client[_0x4c7b('0x1')]('CreateChatQueueReport',{'body':_0x6edfa6,'log':_0x4c7b('0x2')});};exports[_0x4c7b('0x3')]=function(_0x279c21,_0x2a8b1d){return client[_0x4c7b('0x1')]('UpdateChatQueueReport',{'body':_0x2a8b1d,'options':{'where':{'uniqueid':_0x279c21},'order':[['id',_0x4c7b('0x4')]],'limit':0x1},'log':_0x4c7b('0x5')});};
\ No newline at end of file
+var _0xcf1c=['UpdateChatQueueReport','../client','create','Request','CreateChatQueueReport','update'];(function(_0x5a5b0f,_0x3f9c45){var _0x5d0a93=function(_0x2b34c8){while(--_0x2b34c8){_0x5a5b0f['push'](_0x5a5b0f['shift']());}};_0x5d0a93(++_0x3f9c45);}(_0xcf1c,0x18d));var _0xccf1=function(_0x1cc8a2,_0x5dce88){_0x1cc8a2=_0x1cc8a2-0x0;var _0xadb7a6=_0xcf1c[_0x1cc8a2];return _0xadb7a6;};'use strict';var client=require(_0xccf1('0x0'));exports[_0xccf1('0x1')]=function(_0x54253e){return client[_0xccf1('0x2')](_0xccf1('0x3'),{'body':_0x54253e,'log':_0xccf1('0x3')});};exports[_0xccf1('0x4')]=function(_0x5670d0,_0x5d3e85){return client['Request'](_0xccf1('0x5'),{'body':_0x5d3e85,'options':{'where':{'uniqueid':_0x5670d0},'order':[['id','DESC']],'limit':0x1},'log':_0xccf1('0x5')});};
\ No newline at end of file
index eb9fd2b..b78fdaf 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1d0499,_0x23e22f){var _0x153fb3=function(_0x40c19c){while(--_0x40c19c){_0x1d0499['push'](_0x1d0499['shift']());}};_0x153fb3(++_0x23e22f);}(_0x7a54,0x106));var _0x47a5=function(_0x239d1f,_0x3ad22f){_0x239d1f=_0x239d1f-0x0;var _0x27c58c=_0x7a54[_0x239d1f];return _0x27c58c;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});};
\ No newline at end of file
+var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x526770,_0x3da843){var _0x120f0e=function(_0x2737c8){while(--_0x2737c8){_0x526770['push'](_0x526770['shift']());}};_0x120f0e(++_0x3da843);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});};
\ No newline at end of file
index 35d699f..90d6f2a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4a40=['createFaxMessage','../client','create'];(function(_0x2698a4,_0x5eef5b){var _0x2668b3=function(_0x11c56c){while(--_0x11c56c){_0x2698a4['push'](_0x2698a4['shift']());}};_0x2668b3(++_0x5eef5b);}(_0x4a40,0x1bd));var _0x04a4=function(_0x5470c4,_0x5dddc1){_0x5470c4=_0x5470c4-0x0;var _0x418ee2=_0x4a40[_0x5470c4];return _0x418ee2;};'use strict';var client=require(_0x04a4('0x0'));exports[_0x04a4('0x1')]=function(_0x49b6b4){return client['Request']('CreateFaxMessage',{'body':_0x49b6b4,'log':_0x04a4('0x2')});};
\ No newline at end of file
+var _0x300d=['CreateFaxMessage','create','Request'];(function(_0x37f2f9,_0x662e94){var _0x1b3e97=function(_0x2a1ac3){while(--_0x2a1ac3){_0x37f2f9['push'](_0x37f2f9['shift']());}};_0x1b3e97(++_0x662e94);}(_0x300d,0x100));var _0xd300=function(_0x30ae89,_0x290a8f){_0x30ae89=_0x30ae89-0x0;var _0x4ece62=_0x300d[_0x30ae89];return _0x4ece62;};'use strict';var client=require('../client');exports[_0xd300('0x0')]=function(_0x373507){return client[_0xd300('0x1')](_0xd300('0x2'),{'body':_0x373507,'log':'createFaxMessage'});};
\ No newline at end of file
index caffdff..b81de70 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7281=['User','Agents','online','faxPause','getFaxQueues','../client','GetFaxQueue','timeout','strategy'];(function(_0x4b285c,_0x20ad52){var _0x139355=function(_0x96f2ec){while(--_0x96f2ec){_0x4b285c['push'](_0x4b285c['shift']());}};_0x139355(++_0x20ad52);}(_0x7281,0x7a));var _0x1728=function(_0x53d181,_0x38a7d9){_0x53d181=_0x53d181-0x0;var _0x8893d=_0x7281[_0x53d181];return _0x8893d;};'use strict';var client=require(_0x1728('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request'](_0x1728('0x1'),{'options':{'raw':![],'attributes':['id','name',_0x1728('0x2'),_0x1728('0x3')],'include':[{'model':_0x1728('0x4'),'as':_0x1728('0x5'),'attributes':['id','name',_0x1728('0x6'),_0x1728('0x7')]}]},'log':_0x1728('0x8')});};};
\ No newline at end of file
+var _0xf67e=['../client','getFaxQueues','Request','GetFaxQueue','timeout','User','Agents','online','faxPause'];(function(_0x476861,_0x3f4655){var _0xc8abb1=function(_0x29d04d){while(--_0x29d04d){_0x476861['push'](_0x476861['shift']());}};_0xc8abb1(++_0x3f4655);}(_0xf67e,0x129));var _0xef67=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xf67e[_0x42cae2];return _0x5f256f;};'use strict';var client=require(_0xef67('0x0'));exports[_0xef67('0x1')]=function(){return function(){return client[_0xef67('0x2')](_0xef67('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xef67('0x4'),'strategy'],'include':[{'model':_0xef67('0x5'),'as':_0xef67('0x6'),'attributes':['id','name',_0xef67('0x7'),_0xef67('0x8')]}]},'log':_0xef67('0x1')});};};
\ No newline at end of file
index fc9869a..86a542d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c1a=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','../client'];(function(_0x30a31e,_0x31f766){var _0x170879=function(_0x313ee7){while(--_0x313ee7){_0x30a31e['push'](_0x30a31e['shift']());}};_0x170879(++_0x31f766);}(_0x4c1a,0x1cd));var _0xa4c1=function(_0x3e1413,_0x1cabc5){_0x3e1413=_0x3e1413-0x0;var _0x285d31=_0x4c1a[_0x3e1413];return _0x285d31;};'use strict';var client=require(_0xa4c1('0x0'));exports[_0xa4c1('0x1')]=function(_0xa4d284){return client[_0xa4c1('0x2')](_0xa4c1('0x3'),{'body':_0xa4d284,'log':_0xa4c1('0x3')});};exports[_0xa4c1('0x4')]=function(_0x5862ac,_0x170df0){return client['Request'](_0xa4c1('0x5'),{'body':_0x170df0,'options':{'where':{'uniqueid':_0x5862ac},'order':[['id','DESC']],'limit':0x1},'log':_0xa4c1('0x5')});};
\ No newline at end of file
+var _0x8089=['CreateFaxQueueReport','UpdateFaxQueueReport','DESC','../client','Request'];(function(_0x439248,_0xfaecf7){var _0x1d2a87=function(_0x1edfcb){while(--_0x1edfcb){_0x439248['push'](_0x439248['shift']());}};_0x1d2a87(++_0xfaecf7);}(_0x8089,0x1de));var _0x9808=function(_0x6d810c,_0x5b19b6){_0x6d810c=_0x6d810c-0x0;var _0x52baaf=_0x8089[_0x6d810c];return _0x52baaf;};'use strict';var client=require(_0x9808('0x0'));exports['create']=function(_0x5560de){return client[_0x9808('0x1')]('CreateFaxQueueReport',{'body':_0x5560de,'log':_0x9808('0x2')});};exports['update']=function(_0x15d5da,_0x31d4e1){return client['Request'](_0x9808('0x3'),{'body':_0x31d4e1,'options':{'where':{'uniqueid':_0x15d5da},'order':[['id',_0x9808('0x4')]],'limit':0x1},'log':_0x9808('0x3')});};
\ No newline at end of file
index 778aa89..8f7fd9f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf6f8=['Request','GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x32d90a,_0x4ef47f){var _0x37e587=function(_0x2a2c63){while(--_0x2a2c63){_0x32d90a['push'](_0x32d90a['shift']());}};_0x37e587(++_0x4ef47f);}(_0xf6f8,0xe6));var _0x8f6f=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xf6f8[_0x21549c];return _0x426cbd;};'use strict';var client=require('../client');exports[_0x8f6f('0x0')]=function(){return function(){return client[_0x8f6f('0x1')](_0x8f6f('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x8f6f('0x3')],'include':[{'model':_0x8f6f('0x4'),'as':_0x8f6f('0x5'),'attributes':['id',_0x8f6f('0x3'),_0x8f6f('0x6')]}]},'log':'getIntervals'});};};
\ No newline at end of file
+var _0x2c2d=['Request','GetInterval','name','Interval','Intervals','interval','../client','getIntervals'];(function(_0x39a400,_0x153dfd){var _0x5a159f=function(_0x386fc7){while(--_0x386fc7){_0x39a400['push'](_0x39a400['shift']());}};_0x5a159f(++_0x153dfd);}(_0x2c2d,0x1e6));var _0xd2c2=function(_0x166742,_0x55520c){_0x166742=_0x166742-0x0;var _0xb7814a=_0x2c2d[_0x166742];return _0xb7814a;};'use strict';var client=require(_0xd2c2('0x0'));exports[_0xd2c2('0x1')]=function(){return function(){return client[_0xd2c2('0x2')](_0xd2c2('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xd2c2('0x4')],'include':[{'model':_0xd2c2('0x5'),'as':_0xd2c2('0x6'),'attributes':['id','name',_0xd2c2('0x7')]}]},'log':_0xd2c2('0x1')});};};
\ No newline at end of file
index 7e377a6..49bb872 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1c7c=['update','UpdateMailInteraction','addTags','Request','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0xe7281f,_0x2d77c3){var _0x90dc99=function(_0x1e335b){while(--_0x1e335b){_0xe7281f['push'](_0xe7281f['shift']());}};_0x90dc99(++_0x2d77c3);}(_0x1c7c,0x164));var _0xc1c7=function(_0x4054c6,_0x1de8fe){_0x4054c6=_0x4054c6-0x0;var _0x38a828=_0x1c7c[_0x4054c6];return _0x38a828;};'use strict';var client=require(_0xc1c7('0x0'));exports[_0xc1c7('0x1')]=function(_0x38fc99,_0x3a93f0){return client['Request'](_0xc1c7('0x2'),{'body':_0x3a93f0,'options':{'where':{'id':_0x38fc99}},'log':'updateMailInteraction'});};exports[_0xc1c7('0x3')]=function(_0x20dad3,_0xbb9da0){return client[_0xc1c7('0x4')](_0xc1c7('0x5'),{'body':_0xbb9da0,'options':{'where':{'id':_0x20dad3}},'log':_0xc1c7('0x6')});};
\ No newline at end of file
+var _0x5430=['Request','UpdateMailInteraction','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5430,0x10c));var _0x0543=function(_0x3acf57,_0x1543de){_0x3acf57=_0x3acf57-0x0;var _0x3f24a6=_0x5430[_0x3acf57];return _0x3f24a6;};'use strict';var client=require(_0x0543('0x0'));exports[_0x0543('0x1')]=function(_0xa1b1a7,_0x4078bf){return client[_0x0543('0x2')](_0x0543('0x3'),{'body':_0x4078bf,'options':{'where':{'id':_0xa1b1a7}},'log':'updateMailInteraction'});};exports['addTags']=function(_0x1c5ab7,_0x4ee416){return client['Request'](_0x0543('0x4'),{'body':_0x4ee416,'options':{'where':{'id':_0x1c5ab7}},'log':_0x0543('0x5')});};
\ No newline at end of file
index dce7c30..ab6ac41 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3299=['CreateMailMessage','../client','create'];(function(_0xf9fbc8,_0x2447fb){var _0x50dd39=function(_0x2f0e7e){while(--_0x2f0e7e){_0xf9fbc8['push'](_0xf9fbc8['shift']());}};_0x50dd39(++_0x2447fb);}(_0x3299,0x1e4));var _0x9329=function(_0x5b887a,_0x33d559){_0x5b887a=_0x5b887a-0x0;var _0x5144e3=_0x3299[_0x5b887a];return _0x5144e3;};'use strict';var client=require(_0x9329('0x0'));exports[_0x9329('0x1')]=function(_0x593ab5){return client['Request'](_0x9329('0x2'),{'body':_0x593ab5,'log':'createMailMessage'});};
\ No newline at end of file
+var _0x285a=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x285a,0x1ef));var _0xa285=function(_0x554533,_0x6dc719){_0x554533=_0x554533-0x0;var _0x10f931=_0x285a[_0x554533];return _0x10f931;};'use strict';var client=require(_0xa285('0x0'));exports[_0xa285('0x1')]=function(_0x2e69c7){return client[_0xa285('0x2')](_0xa285('0x3'),{'body':_0x2e69c7,'log':_0xa285('0x4')});};
\ No newline at end of file
index 4fce833..c920cd4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9d3=['Request','GetMailQueue','timeout','strategy','Agents','name','online','mailPause','../client','getMailQueues'];(function(_0x1b869f,_0x10915c){var _0x191f36=function(_0x4830ad){while(--_0x4830ad){_0x1b869f['push'](_0x1b869f['shift']());}};_0x191f36(++_0x10915c);}(_0xa9d3,0x198));var _0x3a9d=function(_0xbbcd66,_0x472be6){_0xbbcd66=_0xbbcd66-0x0;var _0x21b53e=_0xa9d3[_0xbbcd66];return _0x21b53e;};'use strict';var client=require(_0x3a9d('0x0'));exports[_0x3a9d('0x1')]=function(){return function(){return client[_0x3a9d('0x2')](_0x3a9d('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x3a9d('0x4'),_0x3a9d('0x5')],'include':[{'model':'User','as':_0x3a9d('0x6'),'attributes':['id',_0x3a9d('0x7'),_0x3a9d('0x8'),_0x3a9d('0x9')]}]},'log':_0x3a9d('0x1')});};};
\ No newline at end of file
+var _0x60a5=['../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents','online','mailPause'];(function(_0x36d28d,_0x5a9e25){var _0x361848=function(_0x569326){while(--_0x569326){_0x36d28d['push'](_0x36d28d['shift']());}};_0x361848(++_0x5a9e25);}(_0x60a5,0x113));var _0x560a=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x60a5[_0x160c73];return _0xd9302;};'use strict';var client=require(_0x560a('0x0'));exports[_0x560a('0x1')]=function(){return function(){return client[_0x560a('0x2')](_0x560a('0x3'),{'options':{'raw':![],'attributes':['id',_0x560a('0x4'),_0x560a('0x5'),_0x560a('0x6')],'include':[{'model':_0x560a('0x7'),'as':_0x560a('0x8'),'attributes':['id',_0x560a('0x4'),_0x560a('0x9'),_0x560a('0xa')]}]},'log':_0x560a('0x1')});};};
\ No newline at end of file
index 268f7d0..263e04b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcea2=['DESC','create','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x31ead0,_0x52887b){var _0x272e6e=function(_0x79a245){while(--_0x79a245){_0x31ead0['push'](_0x31ead0['shift']());}};_0x272e6e(++_0x52887b);}(_0xcea2,0xc4));var _0x2cea=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0xcea2[_0x243b2f];return _0xcb3c2d;};'use strict';var client=require('../client');exports[_0x2cea('0x0')]=function(_0x233268){return client[_0x2cea('0x1')](_0x2cea('0x2'),{'body':_0x233268,'log':_0x2cea('0x2')});};exports['update']=function(_0x26a236,_0x4c0944){return client[_0x2cea('0x1')](_0x2cea('0x3'),{'body':_0x4c0944,'options':{'where':{'uniqueid':_0x26a236},'order':[['id',_0x2cea('0x4')]],'limit':0x1},'log':'UpdateMailQueueReport'});};
\ No newline at end of file
+var _0xfd7c=['UpdateMailQueueReport','../client','Request','CreateMailQueueReport','update'];(function(_0x57549a,_0x408aee){var _0x19591b=function(_0x1cb265){while(--_0x1cb265){_0x57549a['push'](_0x57549a['shift']());}};_0x19591b(++_0x408aee);}(_0xfd7c,0xe2));var _0xcfd7=function(_0x2171c1,_0x43b7fa){_0x2171c1=_0x2171c1-0x0;var _0x32fc80=_0xfd7c[_0x2171c1];return _0x32fc80;};'use strict';var client=require(_0xcfd7('0x0'));exports['create']=function(_0x3fa9c3){return client[_0xcfd7('0x1')](_0xcfd7('0x2'),{'body':_0x3fa9c3,'log':_0xcfd7('0x2')});};exports[_0xcfd7('0x3')]=function(_0x233a66,_0x2f0709){return client[_0xcfd7('0x1')](_0xcfd7('0x4'),{'body':_0x2f0709,'options':{'where':{'uniqueid':_0x233a66},'order':[['id','DESC']],'limit':0x1},'log':'UpdateMailQueueReport'});};
\ No newline at end of file
index ba8c35e..1ecfb26 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3689=['update','Request','UpdateOpenchannelInteraction','addTags','addTagsToChatInteraction'];(function(_0x5c73ff,_0x552906){var _0x554d08=function(_0x3035aa){while(--_0x3035aa){_0x5c73ff['push'](_0x5c73ff['shift']());}};_0x554d08(++_0x552906);}(_0x3689,0xf0));var _0x9368=function(_0x50ba23,_0x57835c){_0x50ba23=_0x50ba23-0x0;var _0x3d95ce=_0x3689[_0x50ba23];return _0x3d95ce;};'use strict';var client=require('../client');exports[_0x9368('0x0')]=function(_0x12019d,_0x22cdc1){return client[_0x9368('0x1')](_0x9368('0x2'),{'body':_0x22cdc1,'options':{'where':{'id':_0x12019d}},'log':'updateOpenchannelInteraction'});};exports[_0x9368('0x3')]=function(_0x4db7f5,_0x247ea3){return client[_0x9368('0x1')]('AddTagsToOpenchannelInteraction',{'body':_0x247ea3,'options':{'where':{'id':_0x4db7f5}},'log':_0x9368('0x4')});};
\ No newline at end of file
+var _0x7f0a=['addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','addTags'];(function(_0x5d4afe,_0x523a4f){var _0x185ab8=function(_0x358e43){while(--_0x358e43){_0x5d4afe['push'](_0x5d4afe['shift']());}};_0x185ab8(++_0x523a4f);}(_0x7f0a,0xfd));var _0xa7f0=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x7f0a[_0x5bd426];return _0x23a7eb;};'use strict';var client=require(_0xa7f0('0x0'));exports[_0xa7f0('0x1')]=function(_0x1411ab,_0x544307){return client[_0xa7f0('0x2')](_0xa7f0('0x3'),{'body':_0x544307,'options':{'where':{'id':_0x1411ab}},'log':'updateOpenchannelInteraction'});};exports[_0xa7f0('0x4')]=function(_0x1a52ce,_0x26b033){return client[_0xa7f0('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x26b033,'options':{'where':{'id':_0x1a52ce}},'log':_0xa7f0('0x5')});};
\ No newline at end of file
index c165cd2..31bcdd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f2c=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0xb4407e,_0x44380b){var _0x11fe27=function(_0x53563b){while(--_0x53563b){_0xb4407e['push'](_0xb4407e['shift']());}};_0x11fe27(++_0x44380b);}(_0x3f2c,0x1af));var _0xc3f2=function(_0x3f074a,_0x3c5b7c){_0x3f074a=_0x3f074a-0x0;var _0x2723ce=_0x3f2c[_0x3f074a];return _0x2723ce;};'use strict';var client=require(_0xc3f2('0x0'));exports[_0xc3f2('0x1')]=function(_0x5809d8){return client[_0xc3f2('0x2')](_0xc3f2('0x3'),{'body':_0x5809d8,'log':_0xc3f2('0x4')});};
\ No newline at end of file
+var _0x2eff=['CreateOpenchannelMessage','../client','create','Request'];(function(_0x2253f5,_0xf3ef1a){var _0x491cc1=function(_0x11b05a){while(--_0x11b05a){_0x2253f5['push'](_0x2253f5['shift']());}};_0x491cc1(++_0xf3ef1a);}(_0x2eff,0x15d));var _0xf2ef=function(_0x3eb578,_0x59e0af){_0x3eb578=_0x3eb578-0x0;var _0x7f3c90=_0x2eff[_0x3eb578];return _0x7f3c90;};'use strict';var client=require(_0xf2ef('0x0'));exports[_0xf2ef('0x1')]=function(_0x1c9d97){return client[_0xf2ef('0x2')](_0xf2ef('0x3'),{'body':_0x1c9d97,'log':'createOpenchannelMessage'});};
\ No newline at end of file
index f73bdf3..dadd6eb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x54af=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x54af,0xb9));var _0xf54a=function(_0x2c4cb3,_0x1db7ed){_0x2c4cb3=_0x2c4cb3-0x0;var _0x386466=_0x54af[_0x2c4cb3];return _0x386466;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client[_0xf54a('0x0')](_0xf54a('0x1'),{'options':{'raw':![],'attributes':['id',_0xf54a('0x2'),_0xf54a('0x3'),_0xf54a('0x4')],'include':[{'model':_0xf54a('0x5'),'as':_0xf54a('0x6'),'attributes':['id',_0xf54a('0x2'),'online','openchannelPause']}]},'log':_0xf54a('0x7')});};};
\ No newline at end of file
+var _0x8a16=['User','Agents','name','openchannelPause','../client','getOpenchannelQueues','GetOpenchannelQueue','timeout','strategy'];(function(_0x583ae2,_0x413a09){var _0xfaa340=function(_0xe53e6a){while(--_0xe53e6a){_0x583ae2['push'](_0x583ae2['shift']());}};_0xfaa340(++_0x413a09);}(_0x8a16,0xdc));var _0x68a1=function(_0x4e4d10,_0x30d69a){_0x4e4d10=_0x4e4d10-0x0;var _0x46285d=_0x8a16[_0x4e4d10];return _0x46285d;};'use strict';var client=require(_0x68a1('0x0'));exports[_0x68a1('0x1')]=function(){return function(){return client['Request'](_0x68a1('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x68a1('0x3'),_0x68a1('0x4')],'include':[{'model':_0x68a1('0x5'),'as':_0x68a1('0x6'),'attributes':['id',_0x68a1('0x7'),'online',_0x68a1('0x8')]}]},'log':_0x68a1('0x1')});};};
\ No newline at end of file
index 99adf68..f12f1e3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4cdf=['../client','create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC'];(function(_0x4680e9,_0x146f27){var _0x81faa8=function(_0xdd0baa){while(--_0xdd0baa){_0x4680e9['push'](_0x4680e9['shift']());}};_0x81faa8(++_0x146f27);}(_0x4cdf,0x180));var _0xf4cd=function(_0x97b6b8,_0x1d9874){_0x97b6b8=_0x97b6b8-0x0;var _0x12d70b=_0x4cdf[_0x97b6b8];return _0x12d70b;};'use strict';var client=require(_0xf4cd('0x0'));exports[_0xf4cd('0x1')]=function(_0x1b6407){return client[_0xf4cd('0x2')](_0xf4cd('0x3'),{'body':_0x1b6407,'log':_0xf4cd('0x3')});};exports['update']=function(_0x346702,_0x20b32a){return client['Request'](_0xf4cd('0x4'),{'body':_0x20b32a,'options':{'where':{'uniqueid':_0x346702},'order':[['id',_0xf4cd('0x5')]],'limit':0x1},'log':_0xf4cd('0x4')});};
\ No newline at end of file
+var _0xc2df=['create','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','../client'];(function(_0x4a94b1,_0x4f2518){var _0x20949f=function(_0x1c4aa6){while(--_0x1c4aa6){_0x4a94b1['push'](_0x4a94b1['shift']());}};_0x20949f(++_0x4f2518);}(_0xc2df,0x197));var _0xfc2d=function(_0x22e4f4,_0x1ba707){_0x22e4f4=_0x22e4f4-0x0;var _0x650eaf=_0xc2df[_0x22e4f4];return _0x650eaf;};'use strict';var client=require(_0xfc2d('0x0'));exports[_0xfc2d('0x1')]=function(_0x510311){return client[_0xfc2d('0x2')](_0xfc2d('0x3'),{'body':_0x510311,'log':_0xfc2d('0x3')});};exports[_0xfc2d('0x4')]=function(_0x5ba6dd,_0x13739c){return client[_0xfc2d('0x2')](_0xfc2d('0x5'),{'body':_0x13739c,'options':{'where':{'uniqueid':_0x5ba6dd},'order':[['id','DESC']],'limit':0x1},'log':_0xfc2d('0x5')});};
\ No newline at end of file
index 2cb5bcb..97cd233 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6183=['updateSmsInteraction','addTags','Request','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','UpdateSmsInteraction'];(function(_0x493236,_0x820033){var _0x342f7b=function(_0x4535f2){while(--_0x4535f2){_0x493236['push'](_0x493236['shift']());}};_0x342f7b(++_0x820033);}(_0x6183,0x19b));var _0x3618=function(_0xf6e75d,_0xc70967){_0xf6e75d=_0xf6e75d-0x0;var _0x27514d=_0x6183[_0xf6e75d];return _0x27514d;};'use strict';var client=require('../client');exports[_0x3618('0x0')]=function(_0x3a9324,_0x340e83){return client['Request'](_0x3618('0x1'),{'body':_0x340e83,'options':{'where':{'id':_0x3a9324}},'log':_0x3618('0x2')});};exports[_0x3618('0x3')]=function(_0x2d62a7,_0x21af62){return client[_0x3618('0x4')](_0x3618('0x5'),{'body':_0x21af62,'options':{'where':{'id':_0x2d62a7}},'log':_0x3618('0x6')});};
\ No newline at end of file
+var _0x1e69=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x1e69,0x85));var _0x91e6=function(_0x4be3f3,_0x20efd7){_0x4be3f3=_0x4be3f3-0x0;var _0x5278b3=_0x1e69[_0x4be3f3];return _0x5278b3;};'use strict';var client=require('../client');exports[_0x91e6('0x0')]=function(_0x28561c,_0x6605eb){return client[_0x91e6('0x1')]('UpdateSmsInteraction',{'body':_0x6605eb,'options':{'where':{'id':_0x28561c}},'log':'updateSmsInteraction'});};exports[_0x91e6('0x2')]=function(_0x351c1d,_0x2b53b6){return client[_0x91e6('0x1')](_0x91e6('0x3'),{'body':_0x2b53b6,'options':{'where':{'id':_0x351c1d}},'log':_0x91e6('0x4')});};
\ No newline at end of file
index 8662205..d8d2d5a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa024=['create','CreateSmsMessage','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa024,0x71));var _0x4a02=function(_0x6ff109,_0x5c59a2){_0x6ff109=_0x6ff109-0x0;var _0x9f1b67=_0xa024[_0x6ff109];return _0x9f1b67;};'use strict';var client=require(_0x4a02('0x0'));exports[_0x4a02('0x1')]=function(_0x31b87d){return client['Request'](_0x4a02('0x2'),{'body':_0x31b87d,'log':'createSmsMessage'});};
\ No newline at end of file
+var _0x6d23=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x34f619,_0x38c23a){var _0x9836c8=function(_0xcc7a3c){while(--_0xcc7a3c){_0x34f619['push'](_0x34f619['shift']());}};_0x9836c8(++_0x38c23a);}(_0x6d23,0x1b8));var _0x36d2=function(_0x12ddbd,_0x58ffe4){_0x12ddbd=_0x12ddbd-0x0;var _0x53cc8a=_0x6d23[_0x12ddbd];return _0x53cc8a;};'use strict';var client=require(_0x36d2('0x0'));exports[_0x36d2('0x1')]=function(_0x370924){return client[_0x36d2('0x2')](_0x36d2('0x3'),{'body':_0x370924,'log':_0x36d2('0x4')});};
\ No newline at end of file
index d714646..015e0e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x39c44f,_0x2de452){var _0xf1cf65=function(_0x439a37){while(--_0x439a37){_0x39c44f['push'](_0x39c44f['shift']());}};_0xf1cf65(++_0x2de452);}(_0xe706,0xa3));var _0x6e70=function(_0x5bf840,_0x9fc2ab){_0x5bf840=_0x5bf840-0x0;var _0x4f4355=_0xe706[_0x5bf840];return _0x4f4355;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};};
\ No newline at end of file
+var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x562839,_0x31e05f){var _0x568917=function(_0x4ab900){while(--_0x4ab900){_0x562839['push'](_0x562839['shift']());}};_0x568917(++_0x31e05f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};};
\ No newline at end of file
index b8c5599..f832fcc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x54bd9e,_0x4ab29b){var _0x5dd8a1=function(_0x55f571){while(--_0x55f571){_0x54bd9e['push'](_0x54bd9e['shift']());}};_0x5dd8a1(++_0x4ab29b);}(_0x70e0,0x17b));var _0x070e=function(_0x447dd4,_0xf8954e){_0x447dd4=_0x447dd4-0x0;var _0x1041ce=_0x70e0[_0x447dd4];return _0x1041ce;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});};
\ No newline at end of file
+var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x6fcc6e,_0x5d1c4e){var _0x234cee=function(_0x298e0e){while(--_0x298e0e){_0x6fcc6e['push'](_0x6fcc6e['shift']());}};_0x234cee(++_0x5d1c4e);}(_0x008c,0x188));var _0xc008=function(_0x545672,_0x589128){_0x545672=_0x545672-0x0;var _0x57920d=_0x008c[_0x545672];return _0x57920d;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});};
\ No newline at end of file
index c0d113b..ed8dcf0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x497bd3,_0x3d231b){var _0x7fd879=function(_0x624984){while(--_0x624984){_0x497bd3['push'](_0x497bd3['shift']());}};_0x7fd879(++_0x3d231b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};};
\ No newline at end of file
+var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x3d0653,_0x158842){var _0x432596=function(_0x2dc8e4){while(--_0x2dc8e4){_0x3d0653['push'](_0x3d0653['shift']());}};_0x432596(++_0x158842);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};};
\ No newline at end of file
index 53ce87d..f54d4a8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf562=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x5dd347,_0x2a0cd1){var _0x5e6afb=function(_0xde0e8b){while(--_0xde0e8b){_0x5dd347['push'](_0x5dd347['shift']());}};_0x5e6afb(++_0x2a0cd1);}(_0xf562,0x100));var _0x2f56=function(_0x210baf,_0x447c17){_0x210baf=_0x210baf-0x0;var _0x49f464=_0xf562[_0x210baf];return _0x49f464;};'use strict';var client=require(_0x2f56('0x0'));exports[_0x2f56('0x1')]=function(_0x453b45,_0x25d2fd){return client[_0x2f56('0x2')](_0x2f56('0x3'),{'body':_0x25d2fd,'options':{'where':{'id':_0x453b45}},'log':_0x2f56('0x4')});};exports[_0x2f56('0x5')]=function(_0x38a249,_0x55a78f){return client[_0x2f56('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x55a78f,'options':{'where':{'id':_0x38a249}},'log':_0x2f56('0x6')});};
\ No newline at end of file
+var _0x4975=['addTags','AddTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4975,0x86));var _0x5497=function(_0x4ce892,_0x460c9f){_0x4ce892=_0x4ce892-0x0;var _0x1c4887=_0x4975[_0x4ce892];return _0x1c4887;};'use strict';var client=require(_0x5497('0x0'));exports['update']=function(_0x474989,_0x3f9e37){return client[_0x5497('0x1')](_0x5497('0x2'),{'body':_0x3f9e37,'options':{'where':{'id':_0x474989}},'log':_0x5497('0x3')});};exports[_0x5497('0x4')]=function(_0x14cecb,_0xeb31af){return client[_0x5497('0x1')](_0x5497('0x5'),{'body':_0xeb31af,'options':{'where':{'id':_0x14cecb}},'log':'addTagsToWhatsappInteraction'});};
\ No newline at end of file
index d2fdc3a..b07e8b3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcae8=['../client','create','Request','createWhatsappMessage'];(function(_0x3a177b,_0x10d9fe){var _0x205959=function(_0x39f5fe){while(--_0x39f5fe){_0x3a177b['push'](_0x3a177b['shift']());}};_0x205959(++_0x10d9fe);}(_0xcae8,0x78));var _0x8cae=function(_0x4ccf96,_0x34978e){_0x4ccf96=_0x4ccf96-0x0;var _0xd103b7=_0xcae8[_0x4ccf96];return _0xd103b7;};'use strict';var client=require(_0x8cae('0x0'));exports[_0x8cae('0x1')]=function(_0x47ad2e){return client[_0x8cae('0x2')]('CreateWhatsappMessage',{'body':_0x47ad2e,'log':_0x8cae('0x3')});};
\ No newline at end of file
+var _0xb413=['create','../client'];(function(_0x3fcb52,_0x132fb2){var _0x17c2d6=function(_0x76732a){while(--_0x76732a){_0x3fcb52['push'](_0x3fcb52['shift']());}};_0x17c2d6(++_0x132fb2);}(_0xb413,0x9d));var _0x3b41=function(_0x2c518f,_0x28642d){_0x2c518f=_0x2c518f-0x0;var _0x1ea7ab=_0xb413[_0x2c518f];return _0x1ea7ab;};'use strict';var client=require(_0x3b41('0x0'));exports[_0x3b41('0x1')]=function(_0x10688d){return client['Request']('CreateWhatsappMessage',{'body':_0x10688d,'log':'createWhatsappMessage'});};
\ No newline at end of file
index ee6e26e..ab57315 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe482=['online','whatsappPause','../client','getWhatsappQueues','name','timeout','Agents'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xe482,0xe2));var _0x2e48=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xe482[_0x13b02f];return _0x12e9a6;};'use strict';var client=require(_0x2e48('0x0'));exports[_0x2e48('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x2e48('0x2'),_0x2e48('0x3'),'strategy'],'include':[{'model':'User','as':_0x2e48('0x4'),'attributes':['id',_0x2e48('0x2'),_0x2e48('0x5'),_0x2e48('0x6')]}]},'log':_0x2e48('0x1')});};};
\ No newline at end of file
+var _0xa0b2=['timeout','User','Agents','online','whatsappPause','getWhatsappQueues','../client','name'];(function(_0x560448,_0x2c1082){var _0x550276=function(_0x37e949){while(--_0x37e949){_0x560448['push'](_0x560448['shift']());}};_0x550276(++_0x2c1082);}(_0xa0b2,0x156));var _0x2a0b=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0xa0b2[_0x4ea6af];return _0x4cb1e6;};'use strict';var client=require(_0x2a0b('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x2a0b('0x1'),_0x2a0b('0x2'),'strategy'],'include':[{'model':_0x2a0b('0x3'),'as':_0x2a0b('0x4'),'attributes':['id','name',_0x2a0b('0x5'),_0x2a0b('0x6')]}]},'log':_0x2a0b('0x7')});};};
\ No newline at end of file
index bea0e32..9cd4373 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0072=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','../client'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x0072,0xb3));var _0x2007=function(_0x178e02,_0x5664ef){_0x178e02=_0x178e02-0x0;var _0x488495=_0x0072[_0x178e02];return _0x488495;};'use strict';var client=require(_0x2007('0x0'));exports[_0x2007('0x1')]=function(_0x8e35a8){return client[_0x2007('0x2')]('CreateWhatsappQueueReport',{'body':_0x8e35a8,'log':_0x2007('0x3')});};exports[_0x2007('0x4')]=function(_0x3ff0c2,_0x55df03){return client[_0x2007('0x2')](_0x2007('0x5'),{'body':_0x55df03,'options':{'where':{'uniqueid':_0x3ff0c2},'order':[['id','DESC']],'limit':0x1},'log':'UpdateWhatsappQueueReport'});};
\ No newline at end of file
+var _0xa99e=['../client','create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC'];(function(_0x5443fb,_0x1ee52d){var _0x14d7dd=function(_0x37b842){while(--_0x37b842){_0x5443fb['push'](_0x5443fb['shift']());}};_0x14d7dd(++_0x1ee52d);}(_0xa99e,0x90));var _0xea99=function(_0x3de3ed,_0x13a022){_0x3de3ed=_0x3de3ed-0x0;var _0x32c6b2=_0xa99e[_0x3de3ed];return _0x32c6b2;};'use strict';var client=require(_0xea99('0x0'));exports[_0xea99('0x1')]=function(_0x44ace){return client[_0xea99('0x2')](_0xea99('0x3'),{'body':_0x44ace,'log':_0xea99('0x3')});};exports['update']=function(_0x515805,_0x2f849a){return client[_0xea99('0x2')](_0xea99('0x4'),{'body':_0x2f849a,'options':{'where':{'uniqueid':_0x515805},'order':[['id',_0xea99('0x5')]],'limit':0x1},'log':'UpdateWhatsappQueueReport'});};
\ No newline at end of file
index fc84622..8784101 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf4e8=['[%s][AGENT]\x20ROUTING\x20END','close','agent','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','map','message','join','stop','find','timeout','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED'];(function(_0x29224f,_0x177db0){var _0x560630=function(_0x4930d2){while(--_0x4930d2){_0x29224f['push'](_0x29224f['shift']());}};_0x560630(++_0x177db0);}(_0xf4e8,0x102));var _0x8f4e=function(_0x29c728,_0x5aed0d){_0x29c728=_0x29c728-0x0;var _0x17be77=_0xf4e8[_0x29c728];return _0x17be77;};'use strict';var schema=require(_0x8f4e('0x0'));var _=require(_0x8f4e('0x1'));var util=require(_0x8f4e('0x2'));var seqqueue=require(_0x8f4e('0x3'));var logger=require(_0x8f4e('0x4'))(_0x8f4e('0x5'));var strategy=require(_0x8f4e('0x6'));var queue=schema({'name':{'type':_0x8f4e('0x7'),'required':!![],'message':_0x8f4e('0x8')},'timeout':{'type':_0x8f4e('0x9'),'message':_0x8f4e('0xa')}});function writeLog(_0x1d62a1,_0x11938c,_0x237c53){return logger[_0x8f4e('0xb')](util[_0x8f4e('0xc')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x1d62a1,_0x11938c[_0x8f4e('0xd')],_0x237c53));}function handleFindAgent(_0x177c80){return function(_0x2152ef){return _0x2152ef[_0x8f4e('0xd')][_0x8f4e('0xe')]()===_0x177c80['toLowerCase']();};}exports[_0x8f4e('0xf')]=function(_0x301aba,_0xd2d05a,_0x2de342,_0x27a965){return function(_0x952e88){try{var _0x43ddb4={'name':_0xd2d05a[0x0],'timeout':_0xd2d05a[0x1]};var _0x272de1=queue['validate'](_0x43ddb4,{'typecast':!![]});if(_0x272de1[_0x8f4e('0x10')]){logger[_0x8f4e('0x11')]('[%s][AGENT]\x20%s',_0x301aba,_[_0x8f4e('0x12')](_0x272de1,_0x8f4e('0x13'))[_0x8f4e('0x14')](',\x20'));_0x952e88[_0x8f4e('0x15')]();}else{var _0x29c654=_[_0x8f4e('0x16')](_0x2de342['agents'],handleFindAgent(_0x43ddb4[_0x8f4e('0xd')]));if(_0x29c654){var _0x2b6180=(_0x43ddb4[_0x8f4e('0x17')]||0xa)*0x3e8;var _0x200d79,_0x3f34ed;var _0x2e42f5=seqqueue[_0x8f4e('0x18')](_0x2b6180);_0x2e42f5['id']=_0x301aba;_0x2e42f5[_0x8f4e('0x19')]=_0x2b6180;_0x2e42f5['channel']=_0x27a965[_0x8f4e('0x1a')];writeLog(_0x301aba,_0x29c654,util[_0x8f4e('0xc')]('START:%s',_0x2b6180));_0x2de342[_0x8f4e('0x1b')][_0x301aba]['on'](_0x8f4e('0x1c'),function(){logger['info'](_0x8f4e('0x1d'),_0x301aba);clearTimeout(_0x3f34ed);_0x3f34ed=undefined;_0x2e42f5['close']();if(_0x2de342[_0x8f4e('0x1b')][_0x301aba]){delete _0x2de342[_0x8f4e('0x1b')][_0x301aba];}_0x952e88[_0x8f4e('0x15')]();});_0x2de342[_0x8f4e('0x1b')][_0x301aba]['on']('complete',function(){if(_0x2de342[_0x8f4e('0x1b')][_0x301aba]){delete _0x2de342[_0x8f4e('0x1b')][_0x301aba];}});_0x3f34ed=setTimeout(function(){logger[_0x8f4e('0xb')](_0x8f4e('0x1e'),_0x301aba);clearTimeout(_0x3f34ed);_0x2e42f5[_0x8f4e('0x1f')]();_0x952e88['next']();},_0x2b6180);strategy[_0x8f4e('0x20')](_0x2e42f5,_0x29c654,_0x2de342,_0x27a965);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x301aba,_0x43ddb4[_0x8f4e('0xd')]);_0x952e88[_0x8f4e('0x15')]();}}}catch(_0x3bca49){console[_0x8f4e('0x21')](_0x3bca49);logger[_0x8f4e('0x11')](_0x8f4e('0x22'),_0x301aba,_0x3bca49[_0x8f4e('0x23')]);_0x952e88[_0x8f4e('0x15')]();}};};
\ No newline at end of file
+var _0x5687=['validate','lodash','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','length','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','info','[%s][AGENT]\x20ROUTING\x20END','close','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','error'];(function(_0x1ce8a1,_0x360c9d){var _0x405107=function(_0x391e63){while(--_0x391e63){_0x1ce8a1['push'](_0x1ce8a1['shift']());}};_0x405107(++_0x360c9d);}(_0x5687,0x155));var _0x7568=function(_0x26f70b,_0x26b72d){_0x26f70b=_0x26f70b-0x0;var _0x39d043=_0x5687[_0x26f70b];return _0x39d043;};'use strict';var schema=require(_0x7568('0x0'));var _=require(_0x7568('0x1'));var util=require('util');var seqqueue=require(_0x7568('0x2'));var logger=require(_0x7568('0x3'))(_0x7568('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x7568('0x5'),'required':!![],'message':_0x7568('0x6')},'timeout':{'type':_0x7568('0x7'),'message':_0x7568('0x8')}});function writeLog(_0x3fc46f,_0x21138b,_0x4c45ec){return logger['info'](util[_0x7568('0x9')](_0x7568('0xa'),_0x3fc46f,_0x21138b[_0x7568('0xb')],_0x4c45ec));}function handleFindAgent(_0x33ce54){return function(_0xef438a){return _0xef438a[_0x7568('0xb')][_0x7568('0xc')]()===_0x33ce54[_0x7568('0xc')]();};}exports['consequence']=function(_0x5b0cc5,_0x411a43,_0x2cb0f1,_0x316e29){return function(_0x5eba95){try{var _0x32715c={'name':_0x411a43[0x0],'timeout':_0x411a43[0x1]};var _0x19c028=queue[_0x7568('0x0')](_0x32715c,{'typecast':!![]});if(_0x19c028[_0x7568('0xd')]){logger['error']('[%s][AGENT]\x20%s',_0x5b0cc5,_['map'](_0x19c028,'message')[_0x7568('0xe')](',\x20'));_0x5eba95[_0x7568('0xf')]();}else{var _0x4b3d48=_['find'](_0x2cb0f1[_0x7568('0x10')],handleFindAgent(_0x32715c[_0x7568('0xb')]));if(_0x4b3d48){var _0x3d4c48=(_0x32715c[_0x7568('0x11')]||0xa)*0x3e8;var _0x2248e3,_0x299095;var _0x50b7bd=seqqueue[_0x7568('0x12')](_0x3d4c48);_0x50b7bd['id']=_0x5b0cc5;_0x50b7bd[_0x7568('0x13')]=_0x3d4c48;_0x50b7bd[_0x7568('0x14')]=_0x316e29[_0x7568('0x14')];writeLog(_0x5b0cc5,_0x4b3d48,util['format'](_0x7568('0x15'),_0x3d4c48));_0x2cb0f1[_0x7568('0x16')][_0x5b0cc5]['on'](_0x7568('0x17'),function(){logger[_0x7568('0x18')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x5b0cc5);clearTimeout(_0x299095);_0x299095=undefined;_0x50b7bd['close']();if(_0x2cb0f1[_0x7568('0x16')][_0x5b0cc5]){delete _0x2cb0f1[_0x7568('0x16')][_0x5b0cc5];}_0x5eba95[_0x7568('0xf')]();});_0x2cb0f1['rules'][_0x5b0cc5]['on']('complete',function(){if(_0x2cb0f1[_0x7568('0x16')][_0x5b0cc5]){delete _0x2cb0f1[_0x7568('0x16')][_0x5b0cc5];}});_0x299095=setTimeout(function(){logger[_0x7568('0x18')](_0x7568('0x19'),_0x5b0cc5);clearTimeout(_0x299095);_0x50b7bd[_0x7568('0x1a')]();_0x5eba95['next']();},_0x3d4c48);strategy[_0x7568('0x1b')](_0x50b7bd,_0x4b3d48,_0x2cb0f1,_0x316e29);}else{logger['error'](_0x7568('0x1c'),_0x5b0cc5,_0x32715c[_0x7568('0xb')]);_0x5eba95[_0x7568('0xf')]();}}}catch(_0x39d230){console[_0x7568('0x1d')](_0x39d230);logger[_0x7568('0x1e')]('[%s][QUEUE]\x20%s',_0x5b0cc5,_0x39d230['stack']);_0x5eba95[_0x7568('0xf')]();}};};
\ No newline at end of file
index 5dda004..dcd7a7d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd3e2=['create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','postText','message','amazonlex','Failed','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xd3e2,0xdf));var _0x2d3e=function(_0x48328d,_0x486b46){_0x48328d=_0x48328d-0x0;var _0x62e08b=_0xd3e2[_0x48328d];return _0x62e08b;};'use strict';var _=require('lodash');var moment=require(_0x2d3e('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0x2d3e('0x1'))(_0x2d3e('0x2'));var rpc={'chatMessage':require(_0x2d3e('0x3')),'openchannelMessage':require(_0x2d3e('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x2d3e('0x5')),'whatsappMessage':require(_0x2d3e('0x6'))};exports[_0x2d3e('0x7')]=function(_0x38a7fb,_0x2ec186){return function(_0x1a80af){try{if(!_[_0x2d3e('0x8')](this[_0x2d3e('0x9')][_0x2d3e('0xa')])){logger[_0x2d3e('0xb')]('[%s][AMAZONLEX]\x20%s',_0x38a7fb,_0x2d3e('0xc'));return _0x1a80af[_0x2d3e('0xd')]();}var _0x2d9870={'ContactId':this['contact']['id'],'sentAt':moment()[_0x2d3e('0xe')](_0x2d3e('0xf')),'direction':'out'};if(this[_0x2d3e('0x10')]==='sms'||this[_0x2d3e('0x10')]===_0x2d3e('0x11')){_0x2d9870[_0x2d3e('0x12')]=this[_0x2d3e('0x9')][_0x2d3e('0x12')];}var _0x4a3fd6=this['channel'];if(_0x4a3fd6==='chat'){_0x2d9870[_0x2d3e('0x13')]=this['account']['id'];}else{_0x2d9870[_['upperFirst'](_0x4a3fd6)+_0x2d3e('0x14')]=this[_0x2d3e('0x15')]['id'];}_0x2d9870[_[_0x2d3e('0x16')](_0x4a3fd6)+_0x2d3e('0x17')]=this[_0x2d3e('0x9')]['id'];if(this[_0x2d3e('0x9')][_0x2d3e('0x18')]){var _0x1cc87c=_0x2ec186[0x4];if(!_[_0x2d3e('0x19')](_0x1cc87c)){_0x2d9870[_0x2d3e('0x1a')]=utils[_0x2d3e('0x1b')](_0x1cc87c,this);return rpc[_0x4a3fd6+_0x2d3e('0x1c')][_0x2d3e('0x1d')](_0x2d9870)[_0x2d3e('0x1e')](function(_0x457c7f){logger[_0x2d3e('0xb')](_0x2d3e('0x1f'),_0x38a7fb,_0x2d9870[_0x2d3e('0x1a')]);})[_0x2d3e('0x20')](function(_0x16c5df){logger[_0x2d3e('0x21')](_0x2d3e('0x1f'),_0x38a7fb,JSON[_0x2d3e('0x22')](_0x16c5df));})[_0x2d3e('0x23')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x38a7fb);_0x1a80af[_0x2d3e('0x24')]();});}else{logger[_0x2d3e('0xb')](_0x2d3e('0x25'),_0x38a7fb);_0x1a80af['stop']();}}else{var _0x2a83f6=this;var _0x9bc3ca=new AWS['LexRuntime']({'accessKeyId':_0x2ec186[0x0],'secretAccessKey':_0x2ec186[0x1],'region':_0x2ec186[0x2]});var _0x2d47a0={'botAlias':'$LATEST','botName':_0x2ec186[0x3],'inputText':this['message'][_0x2d3e('0x1a')],'userId':this[_0x2d3e('0x10')]+':'+this[_0x2d3e('0x9')]['id']['toString']()};_0x9bc3ca[_0x2d3e('0x26')](_0x2d47a0,function(_0x41b7b2,_0x686055){if(_0x41b7b2){logger[_0x2d3e('0x21')](_0x2d3e('0x1f'),_0x38a7fb,_0x41b7b2[_0x2d3e('0x27')]);_0x1a80af[_0x2d3e('0xd')]();}else if(_0x686055&&_0x686055[_0x2d3e('0x27')]){_0x2a83f6[_0x2d3e('0x1a')][_0x2d3e('0x28')]=_0x686055;_0x2d9870[_0x2d3e('0x1a')]=_0x686055[_0x2d3e('0x27')];_0x2d9870['providerName']=_0x2d3e('0x28');_0x2d9870['providerResponse']=JSON['stringify'](_0x686055);return rpc[_0x4a3fd6+_0x2d3e('0x1c')]['create'](_0x2d9870)[_0x2d3e('0x1e')](function(_0x1edd35){logger[_0x2d3e('0xb')](_0x2d3e('0x1f'),_0x38a7fb,_0x2d9870['body']);if(_0x686055['dialogState']==_0x2d3e('0x29')){_0x1a80af['next']();}else{_0x1a80af['stop']();}})['catch'](function(_0x34d3c3){logger[_0x2d3e('0x21')](_0x2d3e('0x1f'),_0x38a7fb,JSON['stringify'](_0x34d3c3));_0x1a80af[_0x2d3e('0xd')]();});}else{_0x1a80af['next']();}});}}catch(_0x58364e){logger[_0x2d3e('0x21')](_0x2d3e('0x1f'),_0x38a7fb,JSON[_0x2d3e('0x22')](_0x58364e));_0x1a80af['stop']();}};};
\ No newline at end of file
+var _0xe2d7=['account','upperFirst','InteractionId','isEmpty','body','create','then','catch','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','message','postText','amazonlex','Message','dialogState','Failed','lodash','moment','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','interaction','chat','ChatWebsiteId'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0xe2d7,0x165));var _0x7e2d=function(_0x2a5887,_0x7afc64){_0x2a5887=_0x2a5887-0x0;var _0x5a3603=_0xe2d7[_0x2a5887];return _0x5a3603;};'use strict';var _=require(_0x7e2d('0x0'));var moment=require(_0x7e2d('0x1'));var AWS=require(_0x7e2d('0x2'));var utils=require(_0x7e2d('0x3'));var logger=require(_0x7e2d('0x4'))(_0x7e2d('0x5'));var rpc={'chatMessage':require(_0x7e2d('0x6')),'openchannelMessage':require(_0x7e2d('0x7')),'mailMessage':require(_0x7e2d('0x8')),'smsMessage':require(_0x7e2d('0x9')),'faxMessage':require(_0x7e2d('0xa')),'whatsappMessage':require(_0x7e2d('0xb'))};exports[_0x7e2d('0xc')]=function(_0x2cb807,_0x4983b5){return function(_0x289862){try{if(!_['isNil'](this['interaction'][_0x7e2d('0xd')])){logger['info'](_0x7e2d('0xe'),_0x2cb807,_0x7e2d('0xf'));return _0x289862[_0x7e2d('0x10')]();}var _0x48a420={'ContactId':this['contact']['id'],'sentAt':moment()[_0x7e2d('0x11')](_0x7e2d('0x12')),'direction':_0x7e2d('0x13')};if(this[_0x7e2d('0x14')]===_0x7e2d('0x15')||this['channel']===_0x7e2d('0x16')){_0x48a420[_0x7e2d('0x17')]=this[_0x7e2d('0x18')][_0x7e2d('0x17')];}var _0x4b5148=this[_0x7e2d('0x14')];if(_0x4b5148===_0x7e2d('0x19')){_0x48a420[_0x7e2d('0x1a')]=this[_0x7e2d('0x1b')]['id'];}else{_0x48a420[_[_0x7e2d('0x1c')](_0x4b5148)+'AccountId']=this['account']['id'];}_0x48a420[_[_0x7e2d('0x1c')](_0x4b5148)+_0x7e2d('0x1d')]=this['interaction']['id'];if(this[_0x7e2d('0x18')]['created']){var _0x212651=_0x4983b5[0x4];if(!_[_0x7e2d('0x1e')](_0x212651)){_0x48a420[_0x7e2d('0x1f')]=utils['getMustacheRender'](_0x212651,this);return rpc[_0x4b5148+'Message'][_0x7e2d('0x20')](_0x48a420)[_0x7e2d('0x21')](function(_0x51ff88){logger['info'](_0x7e2d('0xe'),_0x2cb807,_0x48a420[_0x7e2d('0x1f')]);})[_0x7e2d('0x22')](function(_0xe97bc8){logger[_0x7e2d('0x23')](_0x7e2d('0xe'),_0x2cb807,JSON[_0x7e2d('0x24')](_0xe97bc8));})[_0x7e2d('0x25')](function(){logger[_0x7e2d('0x26')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x2cb807);_0x289862['stop']();});}else{logger['info'](_0x7e2d('0x27'),_0x2cb807);_0x289862[_0x7e2d('0x28')]();}}else{var _0x3b8290=this;var _0x50627e=new AWS[(_0x7e2d('0x29'))]({'accessKeyId':_0x4983b5[0x0],'secretAccessKey':_0x4983b5[0x1],'region':_0x4983b5[0x2]});var _0x32f902={'botAlias':'$LATEST','botName':_0x4983b5[0x3],'inputText':this[_0x7e2d('0x2a')][_0x7e2d('0x1f')],'userId':this[_0x7e2d('0x14')]+':'+this[_0x7e2d('0x18')]['id']['toString']()};_0x50627e[_0x7e2d('0x2b')](_0x32f902,function(_0x183470,_0x10f614){if(_0x183470){logger['error'](_0x7e2d('0xe'),_0x2cb807,_0x183470[_0x7e2d('0x2a')]);_0x289862[_0x7e2d('0x10')]();}else if(_0x10f614&&_0x10f614[_0x7e2d('0x2a')]){_0x3b8290[_0x7e2d('0x1f')][_0x7e2d('0x2c')]=_0x10f614;_0x48a420[_0x7e2d('0x1f')]=_0x10f614[_0x7e2d('0x2a')];_0x48a420['providerName']=_0x7e2d('0x2c');_0x48a420['providerResponse']=JSON[_0x7e2d('0x24')](_0x10f614);return rpc[_0x4b5148+_0x7e2d('0x2d')][_0x7e2d('0x20')](_0x48a420)[_0x7e2d('0x21')](function(_0x571190){logger[_0x7e2d('0x26')](_0x7e2d('0xe'),_0x2cb807,_0x48a420[_0x7e2d('0x1f')]);if(_0x10f614[_0x7e2d('0x2e')]==_0x7e2d('0x2f')){_0x289862[_0x7e2d('0x10')]();}else{_0x289862[_0x7e2d('0x28')]();}})[_0x7e2d('0x22')](function(_0x24fbed){logger[_0x7e2d('0x23')](_0x7e2d('0xe'),_0x2cb807,JSON['stringify'](_0x24fbed));_0x289862[_0x7e2d('0x10')]();});}else{_0x289862[_0x7e2d('0x10')]();}});}}catch(_0x2e2ee5){logger[_0x7e2d('0x23')]('[%s][AMAZONLEX]\x20%s',_0x2cb807,JSON[_0x7e2d('0x24')](_0x2e2ee5));_0x289862[_0x7e2d('0x28')]();}};};
\ No newline at end of file
index 18ce691..50d26ba 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa30f=['moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','created','Autoreply\x20already\x20sent','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','phone','subject','startsWith','Re:','chat','AccountId','account','InteractionId','Message','messageId','html','<div\x20id=\x22xm-mail-content\x22>','replace','<div\x20id=\x22xm-mail-content\x22','</div>','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','finally','resolve','update','error','Interaction','lodash'];(function(_0x4ae97d,_0x3afaed){var _0x4ed1d6=function(_0x3b4996){while(--_0x3b4996){_0x4ae97d['push'](_0x4ae97d['shift']());}};_0x4ed1d6(++_0x3afaed);}(_0xa30f,0x7f));var _0xfa30=function(_0x38a8f2,_0x791530){_0x38a8f2=_0x38a8f2-0x0;var _0x373083=_0xa30f[_0x38a8f2];return _0x373083;};'use strict';var _=require(_0xfa30('0x0'));var moment=require(_0xfa30('0x1'));var utils=require(_0xfa30('0x2'));var logger=require(_0xfa30('0x3'))(_0xfa30('0x4'));var rpc={'chatMessage':require(_0xfa30('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xfa30('0x6')),'smsMessage':require(_0xfa30('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfa30('0x8')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0xfa30('0x9')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0xfa30('0xa'))};var mailRpc=require(_0xfa30('0xb'));exports[_0xfa30('0xc')]=function(_0x253328,_0x3ea1ea,_0x2122a1,_0x984407){return function(_0x159c62){try{var _0x1fa1d9=this[_0xfa30('0xd')];if(_0x1fa1d9===_0xfa30('0xe')&&_0x984407[_0xfa30('0xf')][_0xfa30('0x10')]){logger[_0xfa30('0x11')](_0xfa30('0x12'),_0x253328,_0xfa30('0x13'));return _0x159c62[_0xfa30('0x14')]();}if(_0x3ea1ea[0x0]==='1'&&(_['isNil'](this['interaction'][_0xfa30('0x15')])||!this['interaction'][_0xfa30('0x15')])){logger[_0xfa30('0x11')]('[%s][AUTOREPLY]\x20%s',_0x253328,_0xfa30('0x16'));return _0x159c62[_0xfa30('0x14')]();}if(_0x3ea1ea[0x0]==='2'&&this[_0xfa30('0x17')][_0xfa30('0x18')]){logger[_0xfa30('0x11')](_0xfa30('0x19'),_0x253328,_0xfa30('0x1a'));return _0x159c62[_0xfa30('0x14')]();}var _0x556d21={'ContactId':this[_0xfa30('0x1b')]['id'],'sentAt':moment()[_0xfa30('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xfa30('0x1d')};if(this[_0xfa30('0xd')]==='mail'){_0x556d21[_0xfa30('0xf')]=utils[_0xfa30('0x1e')](_0x3ea1ea[0x2],this);}else{_0x556d21['body']=utils['getMustacheRender'](_0x3ea1ea[0x1],this);}if(this[_0xfa30('0x1f')]){_0x556d21['to']=this['message'][_0xfa30('0x20')]||'';if(this['channel']===_0xfa30('0xe')&&_0x3ea1ea[0x1]==='1'){_0x556d21['cc']=this[_0xfa30('0x1f')]['cc']||'';}_0x556d21[_0xfa30('0x20')]=this[_0xfa30('0x1f')]['to']||'';_0x556d21['phone']=this[_0xfa30('0x1f')][_0xfa30('0x21')]||'';_0x556d21['read']=!![];if(this[_0xfa30('0x1f')][_0xfa30('0x22')]){_0x556d21[_0xfa30('0x22')]='';_0x556d21[_0xfa30('0x22')]+=_[_0xfa30('0x23')](this[_0xfa30('0x1f')][_0xfa30('0x22')],_0xfa30('0x24'))?'':'Re:\x20';_0x556d21['subject']+=this['message']['subject'];}}if(this[_0xfa30('0xd')]===_0xfa30('0x25')){_0x556d21['ChatWebsiteId']=this['account']['id'];}else{_0x556d21[_['upperFirst'](this[_0xfa30('0xd')])+_0xfa30('0x26')]=this[_0xfa30('0x27')]['id'];}_0x556d21[_['upperFirst'](this['channel'])+_0xfa30('0x28')]=this[_0xfa30('0x17')]['id'];var _0x4133ae=this['interaction'];if(rpc[this[_0xfa30('0xd')]+_0xfa30('0x29')]){if(this[_0xfa30('0xd')]===_0xfa30('0xe')){_0x556d21['inReplyTo']=this['message'][_0xfa30('0x2a')];_0x556d21[_0xfa30('0x2b')]=_0xfa30('0x2c')+_[_0xfa30('0x2d')](_0x556d21[_0xfa30('0xf')],_0xfa30('0x2e'),'<div')+_0xfa30('0x2f');_0x556d21[_0xfa30('0x30')]={'Auto-Submitted':_0xfa30('0x31'),'X-Auto-Response-Suppress':_0xfa30('0x32'),'Precedence':_0xfa30('0x33')};return mailRpc[_0xfa30('0x34')](this[_0xfa30('0x27')][_0xfa30('0x35')],_0x556d21)[_0xfa30('0x36')](function(_0x222545){logger[_0xfa30('0x11')](_0xfa30('0x37'),_0x253328);_0x556d21[_0xfa30('0x2a')]=_0x222545['message'][_0xfa30('0x2a')];return rpc[_0x1fa1d9+_0xfa30('0x29')][_0xfa30('0x38')](_0x556d21);})[_0xfa30('0x36')](function(_0x3d9998){logger[_0xfa30('0x11')](_0xfa30('0x12'),_0x253328,JSON[_0xfa30('0x39')](_0x3d9998));})[_0xfa30('0x3a')](function(_0x5d3069){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x253328,JSON[_0xfa30('0x39')](_0x5d3069));})[_0xfa30('0x3b')](function(){Promise[_0xfa30('0x3c')]()[_0xfa30('0x36')](function(){if(_0x3ea1ea[0x0]!=='2'||_0x4133ae[_0xfa30('0x18')])return;return rpc[_0x1fa1d9+'Interaction'][_0xfa30('0x3d')](_0x4133ae['id'],{'autoreplyExecuted':!![]})[_0xfa30('0x36')](function(_0x413478){logger[_0xfa30('0x11')](_0xfa30('0x19'),_0x253328,JSON[_0xfa30('0x39')](_0x413478));})[_0xfa30('0x3a')](function(_0x358034){logger[_0xfa30('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x253328,JSON[_0xfa30('0x39')](_0x358034));});})[_0xfa30('0x36')](function(){_0x159c62[_0xfa30('0x14')]();});});}else{return rpc[this['channel']+_0xfa30('0x29')][_0xfa30('0x38')](_0x556d21)[_0xfa30('0x36')](function(){logger[_0xfa30('0x11')](_0xfa30('0x12'),_0x253328,_0x556d21['body']);})[_0xfa30('0x3a')](function(_0x499e6b){logger[_0xfa30('0x3e')](_0xfa30('0x12'),_0x253328,JSON[_0xfa30('0x39')](_0x499e6b));})[_0xfa30('0x3b')](function(){Promise[_0xfa30('0x3c')]()[_0xfa30('0x36')](function(){if(_0x3ea1ea[0x0]!=='2'||_0x4133ae[_0xfa30('0x18')])return;return rpc[_0x1fa1d9+_0xfa30('0x3f')][_0xfa30('0x3d')](_0x4133ae['id'],{'autoreplyExecuted':!![]})[_0xfa30('0x36')](function(_0x44d053){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x253328,JSON[_0xfa30('0x39')](_0x44d053));})[_0xfa30('0x3a')](function(_0x34723b){logger[_0xfa30('0x3e')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x253328,JSON[_0xfa30('0x39')](_0x34723b));});})['then'](function(){_0x159c62['next']();});});}}}catch(_0xe3a897){logger[_0xfa30('0x3e')]('[%s][AUTOREPLY]\x20%s',_0x253328,JSON[_0xfa30('0x39')](_0xe3a897));_0x159c62['stop']();}};};
\ No newline at end of file
+var _0x1a64=['read','subject','startsWith','Re:','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','inReplyTo','html','replace','<div\x20id=\x22xm-mail-content\x22','<div','headers','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','autoreplyExecuted','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','mail','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','body','getMustacheRender','message','from','channel'];(function(_0x301982,_0x58ecc6){var _0x3e36cf=function(_0x3815a4){while(--_0x3815a4){_0x301982['push'](_0x301982['shift']());}};_0x3e36cf(++_0x58ecc6);}(_0x1a64,0x65));var _0x41a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a64[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x41a6('0x0'));var moment=require(_0x41a6('0x1'));var utils=require(_0x41a6('0x2'));var logger=require(_0x41a6('0x3'))(_0x41a6('0x4'));var rpc={'chatMessage':require(_0x41a6('0x5')),'openchannelMessage':require(_0x41a6('0x6')),'mailMessage':require(_0x41a6('0x7')),'smsMessage':require(_0x41a6('0x8')),'faxMessage':require(_0x41a6('0x9')),'whatsappMessage':require(_0x41a6('0xa')),'chatInteraction':require(_0x41a6('0xb')),'openchannelInteraction':require(_0x41a6('0xc')),'mailInteraction':require(_0x41a6('0xd')),'smsInteraction':require(_0x41a6('0xe')),'faxInteraction':require(_0x41a6('0xf')),'whatsappInteraction':require(_0x41a6('0x10'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x5b4c99,_0x1a229a,_0x267f7c,_0x13ccc5){return function(_0x16b411){try{var _0x43c415=this['channel'];if(_0x43c415===_0x41a6('0x11')&&_0x13ccc5['body'][_0x41a6('0x12')]){logger[_0x41a6('0x13')](_0x41a6('0x14'),_0x5b4c99,_0x41a6('0x15'));return _0x16b411[_0x41a6('0x16')]();}if(_0x1a229a[0x0]==='1'&&(_['isNil'](this['interaction']['created'])||!this[_0x41a6('0x17')][_0x41a6('0x18')])){logger[_0x41a6('0x13')](_0x41a6('0x14'),_0x5b4c99,'Autoreply\x20already\x20sent');return _0x16b411[_0x41a6('0x16')]();}if(_0x1a229a[0x0]==='2'&&this['interaction']['autoreplyExecuted']){logger['info'](_0x41a6('0x19'),_0x5b4c99,_0x41a6('0x1a'));return _0x16b411['next']();}var _0x2664bc={'ContactId':this['contact']['id'],'sentAt':moment()[_0x41a6('0x1b')](_0x41a6('0x1c')),'direction':_0x41a6('0x1d')};if(this['channel']===_0x41a6('0x11')){_0x2664bc[_0x41a6('0x1e')]=utils[_0x41a6('0x1f')](_0x1a229a[0x2],this);}else{_0x2664bc[_0x41a6('0x1e')]=utils[_0x41a6('0x1f')](_0x1a229a[0x1],this);}if(this[_0x41a6('0x20')]){_0x2664bc['to']=this['message'][_0x41a6('0x21')]||'';if(this[_0x41a6('0x22')]===_0x41a6('0x11')&&_0x1a229a[0x1]==='1'){_0x2664bc['cc']=this[_0x41a6('0x20')]['cc']||'';}_0x2664bc['from']=this[_0x41a6('0x20')]['to']||'';_0x2664bc['phone']=this[_0x41a6('0x20')]['phone']||'';_0x2664bc[_0x41a6('0x23')]=!![];if(this['message']['subject']){_0x2664bc[_0x41a6('0x24')]='';_0x2664bc[_0x41a6('0x24')]+=_[_0x41a6('0x25')](this[_0x41a6('0x20')][_0x41a6('0x24')],_0x41a6('0x26'))?'':'Re:\x20';_0x2664bc['subject']+=this[_0x41a6('0x20')][_0x41a6('0x24')];}}if(this['channel']===_0x41a6('0x27')){_0x2664bc[_0x41a6('0x28')]=this[_0x41a6('0x29')]['id'];}else{_0x2664bc[_[_0x41a6('0x2a')](this[_0x41a6('0x22')])+_0x41a6('0x2b')]=this[_0x41a6('0x29')]['id'];}_0x2664bc[_[_0x41a6('0x2a')](this[_0x41a6('0x22')])+'InteractionId']=this[_0x41a6('0x17')]['id'];var _0x4cdc4d=this[_0x41a6('0x17')];if(rpc[this[_0x41a6('0x22')]+_0x41a6('0x2c')]){if(this['channel']===_0x41a6('0x11')){_0x2664bc[_0x41a6('0x2d')]=this[_0x41a6('0x20')]['messageId'];_0x2664bc[_0x41a6('0x2e')]='<div\x20id=\x22xm-mail-content\x22>'+_[_0x41a6('0x2f')](_0x2664bc[_0x41a6('0x1e')],_0x41a6('0x30'),_0x41a6('0x31'))+'</div>';_0x2664bc[_0x41a6('0x32')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x41a6('0x33'),'Precedence':_0x41a6('0x34')};return mailRpc[_0x41a6('0x35')](this[_0x41a6('0x29')][_0x41a6('0x36')],_0x2664bc)[_0x41a6('0x37')](function(_0x233876){logger[_0x41a6('0x13')](_0x41a6('0x38'),_0x5b4c99);_0x2664bc[_0x41a6('0x39')]=_0x233876[_0x41a6('0x20')]['messageId'];return rpc[_0x43c415+'Message'][_0x41a6('0x3a')](_0x2664bc);})['then'](function(_0x43a130){logger[_0x41a6('0x13')](_0x41a6('0x14'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x43a130));})[_0x41a6('0x3c')](function(_0x14160f){logger[_0x41a6('0x3d')](_0x41a6('0x3e'),_0x5b4c99,JSON['stringify'](_0x14160f));})['finally'](function(){Promise['resolve']()['then'](function(){if(_0x1a229a[0x0]!=='2'||_0x4cdc4d[_0x41a6('0x3f')])return;return rpc[_0x43c415+_0x41a6('0x40')][_0x41a6('0x41')](_0x4cdc4d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x82890b){logger[_0x41a6('0x13')](_0x41a6('0x19'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x82890b));})[_0x41a6('0x3c')](function(_0x295436){logger[_0x41a6('0x3d')](_0x41a6('0x42'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x295436));});})[_0x41a6('0x37')](function(){_0x16b411[_0x41a6('0x16')]();});});}else{return rpc[this[_0x41a6('0x22')]+_0x41a6('0x2c')][_0x41a6('0x3a')](_0x2664bc)['then'](function(){logger['info'](_0x41a6('0x14'),_0x5b4c99,_0x2664bc[_0x41a6('0x1e')]);})[_0x41a6('0x3c')](function(_0x33c8cb){logger[_0x41a6('0x3d')](_0x41a6('0x14'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x33c8cb));})['finally'](function(){Promise['resolve']()[_0x41a6('0x37')](function(){if(_0x1a229a[0x0]!=='2'||_0x4cdc4d[_0x41a6('0x3f')])return;return rpc[_0x43c415+_0x41a6('0x40')]['update'](_0x4cdc4d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x140d0a){logger['info'](_0x41a6('0x19'),_0x5b4c99,JSON[_0x41a6('0x3b')](_0x140d0a));})[_0x41a6('0x3c')](function(_0x261d63){logger[_0x41a6('0x3d')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5b4c99,JSON[_0x41a6('0x3b')](_0x261d63));});})[_0x41a6('0x37')](function(){_0x16b411[_0x41a6('0x16')]();});});}}}catch(_0x4cdf23){logger[_0x41a6('0x3d')]('[%s][AUTOREPLY]\x20%s',_0x5b4c99,JSON[_0x41a6('0x3b')](_0x4cdf23));_0x16b411[_0x41a6('0x43')]();}};};
\ No newline at end of file
index 8737c8b..ecde9e2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe34f=['stop','error','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xe34f,0xca));var _0xfe34=function(_0x1c37c3,_0x106f03){_0x1c37c3=_0x1c37c3-0x0;var _0x233e4c=_0xe34f[_0x1c37c3];return _0x233e4c;};'use strict';var moment=require(_0xfe34('0x0'));var logger=require(_0xfe34('0x1'))('routing');var rpc={'chatInteraction':require(_0xfe34('0x2')),'openchannelInteraction':require(_0xfe34('0x3')),'smsInteraction':require(_0xfe34('0x4')),'mailInteraction':require(_0xfe34('0x5')),'faxInteraction':require(_0xfe34('0x6')),'whatsappInteraction':require(_0xfe34('0x7'))};exports[_0xfe34('0x8')]=function(_0x320a77,_0x21c885,_0x1673c8,_0x25ea88){return function(_0x9d9c95){try{logger[_0xfe34('0x9')](_0xfe34('0xa'),_0x320a77,_0x21c885[0x0]);var _0x541c19={'closed':0x1,'closedAt':moment()[_0xfe34('0xb')](_0xfe34('0xc')),'closeReason':_0xfe34('0xd'),'disposition':_0x21c885[0x0]};if(rpc[_0x25ea88[_0xfe34('0xe')]+_0xfe34('0xf')]){rpc[_0x25ea88[_0xfe34('0xe')]+'Interaction'][_0xfe34('0x10')](_0x25ea88[_0xfe34('0x11')]['id'],_0x541c19)[_0xfe34('0x12')](function(_0x38fe4c){logger[_0xfe34('0x9')](_0xfe34('0x13'),_0x320a77,_0x25ea88[_0xfe34('0x11')]['id']);})[_0xfe34('0x14')](function(_0x1a214e){logger['error'](_0xfe34('0x15'),_0x320a77,JSON[_0xfe34('0x16')](_0x1a214e));})['finally'](function(){_0x9d9c95[_0xfe34('0x17')]();});}}catch(_0x250917){logger[_0xfe34('0x18')](_0xfe34('0x15'),_0x320a77,JSON[_0xfe34('0x16')](_0x250917));_0x9d9c95[_0xfe34('0x17')]();}};};
\ No newline at end of file
+var _0x4f3d=['[%s][CLOSE]\x20%s','finally','stop','stringify','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','channel','Interaction','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x4f3d,0x1b9));var _0xd4f3=function(_0x24f548,_0x3c6edf){_0x24f548=_0x24f548-0x0;var _0x1cf1c7=_0x4f3d[_0x24f548];return _0x1cf1c7;};'use strict';var moment=require(_0xd4f3('0x0'));var logger=require(_0xd4f3('0x1'))(_0xd4f3('0x2'));var rpc={'chatInteraction':require(_0xd4f3('0x3')),'openchannelInteraction':require(_0xd4f3('0x4')),'smsInteraction':require(_0xd4f3('0x5')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0xd4f3('0x6')),'whatsappInteraction':require(_0xd4f3('0x7'))};exports[_0xd4f3('0x8')]=function(_0x5a8415,_0x4ab414,_0xa5726c,_0x48d6bd){return function(_0x515b90){try{logger['info'](_0xd4f3('0x9'),_0x5a8415,_0x4ab414[0x0]);var _0x2808ca={'closed':0x1,'closedAt':moment()[_0xd4f3('0xa')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x4ab414[0x0]};if(rpc[_0x48d6bd[_0xd4f3('0xb')]+'Interaction']){rpc[_0x48d6bd[_0xd4f3('0xb')]+_0xd4f3('0xc')]['update'](_0x48d6bd[_0xd4f3('0xd')]['id'],_0x2808ca)[_0xd4f3('0xe')](function(_0x2c89e1){logger[_0xd4f3('0xf')](_0xd4f3('0x10'),_0x5a8415,_0x48d6bd[_0xd4f3('0xd')]['id']);})[_0xd4f3('0x11')](function(_0x4374df){logger[_0xd4f3('0x12')](_0xd4f3('0x13'),_0x5a8415,JSON['stringify'](_0x4374df));})[_0xd4f3('0x14')](function(){_0x515b90[_0xd4f3('0x15')]();});}}catch(_0x5bbf8e){logger[_0xd4f3('0x12')]('[%s][CLOSE]\x20%s',_0x5a8415,JSON[_0xd4f3('0x16')](_0x5bbf8e));_0x515b90[_0xd4f3('0x15')]();}};};
\ No newline at end of file
index 94f0f40..0b2f626 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a3e=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','isEmpty','body','Message','error','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','then','dialogflow','fulfillment','speech','providerName','providerResponse','create','result','metadata','catch','stringify','lodash','moment','apiai-promise','./utils','../../../../config/logger','../../rpc/openchannelMessage'];(function(_0x5594ed,_0x4e034f){var _0x26fa9a=function(_0x13278f){while(--_0x13278f){_0x5594ed['push'](_0x5594ed['shift']());}};_0x26fa9a(++_0x4e034f);}(_0x7a3e,0x18a));var _0xe7a3=function(_0x597d99,_0xa9fdff){_0x597d99=_0x597d99-0x0;var _0x91fcad=_0x7a3e[_0x597d99];return _0x91fcad;};'use strict';var _=require(_0xe7a3('0x0'));var moment=require(_0xe7a3('0x1'));var apiai=require(_0xe7a3('0x2'));var md5=require('md5');var utils=require(_0xe7a3('0x3'));var logger=require(_0xe7a3('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe7a3('0x5')),'mailMessage':require(_0xe7a3('0x6')),'smsMessage':require(_0xe7a3('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe7a3('0x8'))};exports[_0xe7a3('0x9')]=function(_0x46ecf7,_0x1b6226){return function(_0x1a7627){try{if(!_['isNil'](this[_0xe7a3('0xa')][_0xe7a3('0xb')])){logger[_0xe7a3('0xc')](_0xe7a3('0xd'),_0x46ecf7,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x1a7627[_0xe7a3('0xe')]();}var _0x42c82c={'ContactId':this[_0xe7a3('0xf')]['id'],'sentAt':moment()[_0xe7a3('0x10')](_0xe7a3('0x11')),'direction':_0xe7a3('0x12')};if(this[_0xe7a3('0x13')]===_0xe7a3('0x14')||this[_0xe7a3('0x13')]===_0xe7a3('0x15')){_0x42c82c[_0xe7a3('0x16')]=this[_0xe7a3('0xa')]['phone'];}var _0x2edf67=this[_0xe7a3('0x13')];if(_0x2edf67===_0xe7a3('0x17')){_0x42c82c[_0xe7a3('0x18')]=this['account']['id'];}else{_0x42c82c[_['upperFirst'](_0x2edf67)+_0xe7a3('0x19')]=this[_0xe7a3('0x1a')]['id'];}_0x42c82c[_[_0xe7a3('0x1b')](_0x2edf67)+_0xe7a3('0x1c')]=this[_0xe7a3('0xa')]['id'];if(this[_0xe7a3('0xa')][_0xe7a3('0x1d')]){var _0x6e2615=_0x1b6226[0x2];if(!_[_0xe7a3('0x1e')](_0x6e2615)){_0x42c82c[_0xe7a3('0x1f')]=utils['getMustacheRender'](_0x6e2615,this);return rpc[_0x2edf67+_0xe7a3('0x20')]['create'](_0x42c82c)['then'](function(_0xd74816){logger['info'](_0xe7a3('0xd'),_0x46ecf7,_0x42c82c[_0xe7a3('0x1f')]);})['catch'](function(_0x9df971){logger[_0xe7a3('0x21')](_0xe7a3('0xd'),_0x46ecf7,JSON['stringify'](_0x9df971));})[_0xe7a3('0x22')](function(){logger[_0xe7a3('0xc')](_0xe7a3('0x23'),_0x46ecf7);_0x1a7627['stop']();});}else{logger[_0xe7a3('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x46ecf7);_0x1a7627[_0xe7a3('0x24')]();}}else{var _0x440852=this;var _0x64a86b=apiai(_0x1b6226[0x0],{'language':_0x1b6226[0x1]||'en'});return _0x64a86b[_0xe7a3('0x25')](this[_0xe7a3('0x26')][_0xe7a3('0x1f')],{'sessionId':md5(this[_0xe7a3('0xa')]['id'])})[_0xe7a3('0x27')](function(_0x585af8){_0x440852[_0xe7a3('0x1f')][_0xe7a3('0x28')]=_0x585af8;_0x42c82c[_0xe7a3('0x1f')]=_0x585af8['result'][_0xe7a3('0x29')][_0xe7a3('0x2a')];_0x42c82c[_0xe7a3('0x2b')]=_0xe7a3('0x28');_0x42c82c[_0xe7a3('0x2c')]=JSON['stringify'](_0x585af8);return rpc[_0x2edf67+_0xe7a3('0x20')][_0xe7a3('0x2d')](_0x42c82c)['then'](function(_0x42d035){logger['info'](_0xe7a3('0xd'),_0x46ecf7,_0x42c82c[_0xe7a3('0x1f')]);if(_0x585af8[_0xe7a3('0x2e')][_0xe7a3('0x2f')]['endConversation']){_0x1a7627[_0xe7a3('0xe')]();}else{_0x1a7627[_0xe7a3('0x24')]();}})[_0xe7a3('0x30')](function(_0x3a4253){logger[_0xe7a3('0x21')](_0xe7a3('0xd'),_0x46ecf7,JSON[_0xe7a3('0x31')](_0x3a4253));_0x1a7627[_0xe7a3('0xe')]();});})[_0xe7a3('0x30')](function(_0x109e81){logger[_0xe7a3('0x21')](_0xe7a3('0xd'),_0x46ecf7,_0x109e81['message']);_0x1a7627[_0xe7a3('0xe')]();});}}catch(_0x444618){logger['error'](_0xe7a3('0xd'),_0x46ecf7,JSON['stringify'](_0x444618));_0x1a7627['stop']();}};};
\ No newline at end of file
+var _0x2709=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','channel','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','created','isEmpty','body','getMustacheRender','then','catch','error','stringify','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','message','dialogflow','result','fulfillment','speech','providerName','providerResponse','Message','create','endConversation','lodash','apiai-promise','md5','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x2709,0x189));var _0x9270=function(_0x4578b6,_0x277f24){_0x4578b6=_0x4578b6-0x0;var _0x1551ca=_0x2709[_0x4578b6];return _0x1551ca;};'use strict';var _=require(_0x9270('0x0'));var moment=require('moment');var apiai=require(_0x9270('0x1'));var md5=require(_0x9270('0x2'));var utils=require('./utils');var logger=require(_0x9270('0x3'))('routing');var rpc={'chatMessage':require(_0x9270('0x4')),'openchannelMessage':require(_0x9270('0x5')),'mailMessage':require(_0x9270('0x6')),'smsMessage':require(_0x9270('0x7')),'faxMessage':require(_0x9270('0x8')),'whatsappMessage':require(_0x9270('0x9'))};exports['consequence']=function(_0x421b84,_0xc9dee5){return function(_0x1927c){try{if(!_[_0x9270('0xa')](this['interaction'][_0x9270('0xb')])){logger[_0x9270('0xc')](_0x9270('0xd'),_0x421b84,_0x9270('0xe'));return _0x1927c[_0x9270('0xf')]();}var _0x78d773={'ContactId':this[_0x9270('0x10')]['id'],'sentAt':moment()[_0x9270('0x11')](_0x9270('0x12')),'direction':_0x9270('0x13')};if(this['channel']===_0x9270('0x14')||this[_0x9270('0x15')]===_0x9270('0x16')){_0x78d773['phone']=this['interaction'][_0x9270('0x17')];}var _0x28f5bf=this[_0x9270('0x15')];if(_0x28f5bf==='chat'){_0x78d773[_0x9270('0x18')]=this[_0x9270('0x19')]['id'];}else{_0x78d773[_[_0x9270('0x1a')](_0x28f5bf)+_0x9270('0x1b')]=this['account']['id'];}_0x78d773[_['upperFirst'](_0x28f5bf)+_0x9270('0x1c')]=this[_0x9270('0x1d')]['id'];if(this['interaction'][_0x9270('0x1e')]){var _0x4ecf89=_0xc9dee5[0x2];if(!_[_0x9270('0x1f')](_0x4ecf89)){_0x78d773[_0x9270('0x20')]=utils[_0x9270('0x21')](_0x4ecf89,this);return rpc[_0x28f5bf+'Message']['create'](_0x78d773)[_0x9270('0x22')](function(_0x1af93b){logger[_0x9270('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x421b84,_0x78d773[_0x9270('0x20')]);})[_0x9270('0x23')](function(_0x187466){logger[_0x9270('0x24')](_0x9270('0xd'),_0x421b84,JSON[_0x9270('0x25')](_0x187466));})['finally'](function(){logger[_0x9270('0xc')](_0x9270('0x26'),_0x421b84);_0x1927c[_0x9270('0x27')]();});}else{logger[_0x9270('0xc')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x421b84);_0x1927c[_0x9270('0x27')]();}}else{var _0x1aa87=this;var _0x121eb5=apiai(_0xc9dee5[0x0],{'language':_0xc9dee5[0x1]||'en'});return _0x121eb5[_0x9270('0x28')](this[_0x9270('0x29')]['body'],{'sessionId':md5(this[_0x9270('0x1d')]['id'])})[_0x9270('0x22')](function(_0x555d09){_0x1aa87[_0x9270('0x20')][_0x9270('0x2a')]=_0x555d09;_0x78d773[_0x9270('0x20')]=_0x555d09[_0x9270('0x2b')][_0x9270('0x2c')][_0x9270('0x2d')];_0x78d773[_0x9270('0x2e')]=_0x9270('0x2a');_0x78d773[_0x9270('0x2f')]=JSON[_0x9270('0x25')](_0x555d09);return rpc[_0x28f5bf+_0x9270('0x30')][_0x9270('0x31')](_0x78d773)['then'](function(_0xff5276){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x421b84,_0x78d773[_0x9270('0x20')]);if(_0x555d09[_0x9270('0x2b')]['metadata'][_0x9270('0x32')]){_0x1927c[_0x9270('0xf')]();}else{_0x1927c[_0x9270('0x27')]();}})[_0x9270('0x23')](function(_0x4a7cb2){logger[_0x9270('0x24')](_0x9270('0xd'),_0x421b84,JSON['stringify'](_0x4a7cb2));_0x1927c[_0x9270('0xf')]();});})[_0x9270('0x23')](function(_0x38f17f){logger[_0x9270('0x24')](_0x9270('0xd'),_0x421b84,_0x38f17f[_0x9270('0x29')]);_0x1927c['next']();});}}catch(_0x28029d){logger['error'](_0x9270('0xd'),_0x421b84,JSON['stringify'](_0x28029d));_0x1927c['stop']();}};};
\ No newline at end of file
index 5227ccf..bbc1fe4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x161e=['allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','push','fulfillmentText','message','stack','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','body','Message','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','channel','sms','phone','chat','account','upperFirst','AccountId','created','isEmpty','getMustacheRender','create','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT'];(function(_0x22233a,_0x2cbae0){var _0x538bfb=function(_0x1046bc){while(--_0x1046bc){_0x22233a['push'](_0x22233a['shift']());}};_0x538bfb(++_0x2cbae0);}(_0x161e,0x132));var _0xe161=function(_0xf41625,_0x3380b7){_0xf41625=_0xf41625-0x0;var _0x20ff4f=_0x161e[_0xf41625];return _0x20ff4f;};'use strict';var _=require('lodash');var dialogflow=require(_0xe161('0x0'));var md5=require(_0xe161('0x1'));var moment=require(_0xe161('0x2'));var Promise=require('bluebird');var logger=require(_0xe161('0x3'))(_0xe161('0x4'));var utils=require(_0xe161('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xe161('0x6')),'mailMessage':require(_0xe161('0x7')),'smsMessage':require(_0xe161('0x8')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe161('0x9'))};function createMessage(_0x5dc2f3,_0x13c70f,_0x340a5a,_0x1ec97f){return new Promise(function(_0x35e227,_0x403372){var _0x3438e2=_['clone'](_0x340a5a);_0x3438e2[_0xe161('0xa')]=_0x1ec97f;return rpc[_0x13c70f+_0xe161('0xb')]['create'](_0x3438e2)[_0xe161('0xc')](function(){logger[_0xe161('0xd')](_0xe161('0xe'),_0x5dc2f3,_0x3438e2[_0xe161('0xa')]);_0x35e227();})[_0xe161('0xf')](function(_0x2b308b){logger[_0xe161('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x5dc2f3,JSON[_0xe161('0x11')](_0x2b308b));_0x403372(_0x2b308b);});});}exports[_0xe161('0x12')]=function(_0x59ca19,_0x5ad91a){return function(_0x25d924){try{if(!_[_0xe161('0x13')](this[_0xe161('0x14')][_0xe161('0x15')])){logger[_0xe161('0xd')](_0xe161('0xe'),_0x59ca19,_0xe161('0x16'));return _0x25d924[_0xe161('0x17')]();}var _0x2e2122={'ContactId':this[_0xe161('0x18')]['id'],'sentAt':moment()['format'](_0xe161('0x19')),'direction':'out'};if(this[_0xe161('0x1a')]===_0xe161('0x1b')||this[_0xe161('0x1a')]==='whatsapp'){_0x2e2122[_0xe161('0x1c')]=this[_0xe161('0x14')][_0xe161('0x1c')];}var _0x59ff16=this[_0xe161('0x1a')];if(_0x59ff16===_0xe161('0x1d')){_0x2e2122['ChatWebsiteId']=this[_0xe161('0x1e')]['id'];}else{_0x2e2122[_[_0xe161('0x1f')](_0x59ff16)+_0xe161('0x20')]=this[_0xe161('0x1e')]['id'];}_0x2e2122[_[_0xe161('0x1f')](_0x59ff16)+'InteractionId']=this[_0xe161('0x14')]['id'];if(this[_0xe161('0x14')][_0xe161('0x21')]){var _0x47b14e=_0x5ad91a[0x4];if(!_[_0xe161('0x22')](_0x47b14e)){_0x2e2122['body']=utils[_0xe161('0x23')](_0x47b14e,this);return rpc[_0x59ff16+_0xe161('0xb')][_0xe161('0x24')](_0x2e2122)[_0xe161('0xc')](function(_0x3c0e4a){logger[_0xe161('0xd')](_0xe161('0xe'),_0x59ca19,_0x2e2122['body']);})[_0xe161('0xf')](function(_0x53090a){logger['error'](_0xe161('0xe'),_0x59ca19,JSON[_0xe161('0x11')](_0x53090a));})[_0xe161('0x25')](function(){logger['info'](_0xe161('0x26'),_0x59ca19);_0x25d924[_0xe161('0x27')]();});}else{logger[_0xe161('0xd')](_0xe161('0x28'),_0x59ca19);_0x25d924[_0xe161('0x27')]();}}else{var _0x28164e=this;var _0x4ce3ec=_0x5ad91a[0x2][_0xe161('0x29')](/\\n/g,'\x0a');var _0x5dee7a={'credentials':{'private_key':_0x4ce3ec,'client_email':_0x5ad91a[0x1]}};var _0x579b21=new dialogflow[(_0xe161('0x2a'))](_0x5dee7a);var _0x1a604f=_0x579b21[_0xe161('0x2b')](_0x5ad91a[0x0],md5(_0x28164e[_0xe161('0x14')]['id']));var _0x4934f5={'session':_0x1a604f,'queryInput':{'text':{'text':_0x28164e['message'][_0xe161('0xa')],'languageCode':_0x5ad91a[0x3]||'en'}}};return _0x579b21[_0xe161('0x2c')](_0x4934f5)[_0xe161('0xc')](function(_0x522967){if(_0x522967&&_0x522967[_0xe161('0x2d')]){_0x28164e[_0xe161('0xa')][_0xe161('0x2e')]=_0x522967;var _0x369152=_0x522967[0x0];var _0xdb1940=_0x369152[_0xe161('0x2f')]['diagnosticInfo']&&_0x369152[_0xe161('0x2f')][_0xe161('0x30')][_0xe161('0x31')]?_0x369152['queryResult'][_0xe161('0x30')][_0xe161('0x31')][_0xe161('0x32')][_0xe161('0x33')]:![];_0x28164e[_0xe161('0xa')][_0xe161('0x34')]=_0x369152[_0xe161('0x2f')]['action'];_0x28164e[_0xe161('0xa')][_0xe161('0x35')]=_0x369152[_0xe161('0x2f')][_0xe161('0x36')];_0x28164e[_0xe161('0xa')][_0xe161('0x37')]=_0x369152[_0xe161('0x2f')][_0xe161('0x30')]&&_0x369152['queryResult'][_0xe161('0x30')][_0xe161('0x31')]?_0x369152[_0xe161('0x2f')][_0xe161('0x30')][_0xe161('0x31')][_0xe161('0x32')][_0xe161('0x33')]:![];_0x28164e['body']['DIALOGFLOWV2_INTENTNAME']=_0x369152[_0xe161('0x2f')][_0xe161('0x38')][_0xe161('0x39')];_0x28164e[_0xe161('0xa')][_0xe161('0x3a')]=_0x369152['queryResult']['intent'][_0xe161('0x3b')];_0x28164e[_0xe161('0xa')][_0xe161('0x3c')]=_0x369152[_0xe161('0x2f')][_0xe161('0x38')][_0xe161('0x3d')];_0x28164e[_0xe161('0xa')][_0xe161('0x3e')]=_0x369152[_0xe161('0x2f')]['languageCode'];_0x28164e[_0xe161('0xa')][_0xe161('0x3f')]=_0x369152[_0xe161('0x2f')][_0xe161('0x40')];_0x28164e[_0xe161('0xa')][_0xe161('0x41')]=_0x369152['queryResult']['intentDetectionConfidence'];_0x2e2122[_0xe161('0x42')]='dialogflowV2';_0x2e2122[_0xe161('0x43')]=JSON[_0xe161('0x11')](_0x522967);var _0x26e63e=[];for(var _0x507448=0x0;_0x507448<_0x522967[_0xe161('0x2d')];_0x507448++){var _0x251b5c=_0x522967[_0x507448];if(_0x251b5c&&_0x251b5c[_0xe161('0x2f')]&&_0x251b5c[_0xe161('0x2f')]['fulfillmentText']){_0x26e63e[_0xe161('0x44')](createMessage(_0x59ca19,_0x59ff16,_0x2e2122,_0x251b5c[_0xe161('0x2f')][_0xe161('0x45')]));}}return Promise['all'](_0x26e63e)[_0xe161('0xc')](function(){if(_0xdb1940){_0x25d924[_0xe161('0x17')]();}else{_0x25d924['stop']();}})['catch'](function(_0x10eeb1){logger['error'](_0xe161('0xe'),_0x59ca19,JSON[_0xe161('0x11')](_0x10eeb1));_0x25d924[_0xe161('0x17')]();});}})[_0xe161('0xf')](function(_0x1c78c1){logger[_0xe161('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0x59ca19,_0x1c78c1[_0xe161('0x46')],_0x1c78c1[_0xe161('0x47')]);_0x25d924['next']();});}}catch(_0x3657ad){logger['error'](_0xe161('0xe'),_0x59ca19,JSON['stringify'](_0x3657ad));_0x25d924[_0xe161('0x27')]();}};};
\ No newline at end of file
+var _0xcb4a=['isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','providerName','providerResponse','fulfillmentText','push','all','stack','lodash','dialogflow','moment','bluebird','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','out','channel','sms','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','isEmpty','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','SessionsClient','sessionPath','message','length','dialogflowV2','queryResult','fields','diagnosticInfo','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','displayName','DIALOGFLOWV2_ISFALLBACKINTENT'];(function(_0x20845e,_0x211e78){var _0x28cf2b=function(_0x31d613){while(--_0x31d613){_0x20845e['push'](_0x20845e['shift']());}};_0x28cf2b(++_0x211e78);}(_0xcb4a,0x177));var _0xacb4=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xcb4a[_0x411add];return _0x238242;};'use strict';var _=require(_0xacb4('0x0'));var dialogflow=require(_0xacb4('0x1'));var md5=require('md5');var moment=require(_0xacb4('0x2'));var Promise=require(_0xacb4('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require(_0xacb4('0x4'));var rpc={'chatMessage':require(_0xacb4('0x5')),'openchannelMessage':require(_0xacb4('0x6')),'mailMessage':require(_0xacb4('0x7')),'smsMessage':require(_0xacb4('0x8')),'faxMessage':require(_0xacb4('0x9')),'whatsappMessage':require(_0xacb4('0xa'))};function createMessage(_0x1c1f4c,_0x17ca0b,_0x87487f,_0x179184){return new Promise(function(_0x29f318,_0x492fb2){var _0x4d397f=_[_0xacb4('0xb')](_0x87487f);_0x4d397f[_0xacb4('0xc')]=_0x179184;return rpc[_0x17ca0b+_0xacb4('0xd')][_0xacb4('0xe')](_0x4d397f)[_0xacb4('0xf')](function(){logger[_0xacb4('0x10')](_0xacb4('0x11'),_0x1c1f4c,_0x4d397f[_0xacb4('0xc')]);_0x29f318();})[_0xacb4('0x12')](function(_0x248064){logger[_0xacb4('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x1c1f4c,JSON[_0xacb4('0x14')](_0x248064));_0x492fb2(_0x248064);});});}exports['consequence']=function(_0x2c4c4f,_0x19de3c){return function(_0x57b914){try{if(!_[_0xacb4('0x15')](this[_0xacb4('0x16')][_0xacb4('0x17')])){logger[_0xacb4('0x10')](_0xacb4('0x11'),_0x2c4c4f,_0xacb4('0x18'));return _0x57b914[_0xacb4('0x19')]();}var _0x17208e={'ContactId':this[_0xacb4('0x1a')]['id'],'sentAt':moment()[_0xacb4('0x1b')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0xacb4('0x1c')};if(this[_0xacb4('0x1d')]===_0xacb4('0x1e')||this[_0xacb4('0x1d')]==='whatsapp'){_0x17208e['phone']=this['interaction'][_0xacb4('0x1f')];}var _0x301608=this[_0xacb4('0x1d')];if(_0x301608===_0xacb4('0x20')){_0x17208e[_0xacb4('0x21')]=this[_0xacb4('0x22')]['id'];}else{_0x17208e[_[_0xacb4('0x23')](_0x301608)+_0xacb4('0x24')]=this['account']['id'];}_0x17208e[_['upperFirst'](_0x301608)+_0xacb4('0x25')]=this[_0xacb4('0x16')]['id'];if(this['interaction']['created']){var _0x2619a0=_0x19de3c[0x4];if(!_[_0xacb4('0x26')](_0x2619a0)){_0x17208e[_0xacb4('0xc')]=utils['getMustacheRender'](_0x2619a0,this);return rpc[_0x301608+'Message']['create'](_0x17208e)[_0xacb4('0xf')](function(_0x35e1a6){logger[_0xacb4('0x10')](_0xacb4('0x11'),_0x2c4c4f,_0x17208e['body']);})[_0xacb4('0x12')](function(_0x48136e){logger[_0xacb4('0x13')](_0xacb4('0x11'),_0x2c4c4f,JSON[_0xacb4('0x14')](_0x48136e));})[_0xacb4('0x27')](function(){logger[_0xacb4('0x10')](_0xacb4('0x28'),_0x2c4c4f);_0x57b914[_0xacb4('0x29')]();});}else{logger[_0xacb4('0x10')](_0xacb4('0x2a'),_0x2c4c4f);_0x57b914['stop']();}}else{var _0x39e154=this;var _0xfb7bf8=_0x19de3c[0x2]['replace'](/\\n/g,'\x0a');var _0x3ea706={'credentials':{'private_key':_0xfb7bf8,'client_email':_0x19de3c[0x1]}};var _0x45eb29=new dialogflow[(_0xacb4('0x2b'))](_0x3ea706);var _0x391020=_0x45eb29[_0xacb4('0x2c')](_0x19de3c[0x0],md5(_0x39e154[_0xacb4('0x16')]['id']));var _0xb4d931={'session':_0x391020,'queryInput':{'text':{'text':_0x39e154[_0xacb4('0x2d')][_0xacb4('0xc')],'languageCode':_0x19de3c[0x3]||'en'}}};return _0x45eb29['detectIntent'](_0xb4d931)[_0xacb4('0xf')](function(_0x4d324c){if(_0x4d324c&&_0x4d324c[_0xacb4('0x2e')]){_0x39e154[_0xacb4('0xc')][_0xacb4('0x2f')]=_0x4d324c;var _0x15c8fe=_0x4d324c[0x0];var _0x5d236e=_0x15c8fe[_0xacb4('0x30')]['diagnosticInfo']&&_0x15c8fe['queryResult']['diagnosticInfo'][_0xacb4('0x31')]?_0x15c8fe[_0xacb4('0x30')][_0xacb4('0x32')][_0xacb4('0x31')][_0xacb4('0x33')]['boolValue']:![];_0x39e154[_0xacb4('0xc')][_0xacb4('0x34')]=_0x15c8fe[_0xacb4('0x30')][_0xacb4('0x35')];_0x39e154[_0xacb4('0xc')][_0xacb4('0x36')]=_0x15c8fe[_0xacb4('0x30')][_0xacb4('0x37')];_0x39e154[_0xacb4('0xc')][_0xacb4('0x38')]=_0x15c8fe[_0xacb4('0x30')]['diagnosticInfo']&&_0x15c8fe[_0xacb4('0x30')][_0xacb4('0x32')]['fields']?_0x15c8fe['queryResult'][_0xacb4('0x32')][_0xacb4('0x31')][_0xacb4('0x33')][_0xacb4('0x39')]:![];_0x39e154['body'][_0xacb4('0x3a')]=_0x15c8fe[_0xacb4('0x30')][_0xacb4('0x3b')][_0xacb4('0x3c')];_0x39e154[_0xacb4('0xc')]['DIALOGFLOWV2_INTENTDISPLAYNAME']=_0x15c8fe[_0xacb4('0x30')][_0xacb4('0x3b')][_0xacb4('0x3d')];_0x39e154[_0xacb4('0xc')][_0xacb4('0x3e')]=_0x15c8fe[_0xacb4('0x30')]['intent'][_0xacb4('0x3f')];_0x39e154['body'][_0xacb4('0x40')]=_0x15c8fe['queryResult'][_0xacb4('0x41')];_0x39e154[_0xacb4('0xc')][_0xacb4('0x42')]=_0x15c8fe['queryResult']['queryText'];_0x39e154[_0xacb4('0xc')]['DIALOGFLOWV2_SCORE']=_0x15c8fe[_0xacb4('0x30')]['intentDetectionConfidence'];_0x17208e[_0xacb4('0x43')]=_0xacb4('0x2f');_0x17208e[_0xacb4('0x44')]=JSON['stringify'](_0x4d324c);var _0x25f2b2=[];for(var _0x35b55d=0x0;_0x35b55d<_0x4d324c[_0xacb4('0x2e')];_0x35b55d++){var _0x38a48e=_0x4d324c[_0x35b55d];if(_0x38a48e&&_0x38a48e['queryResult']&&_0x38a48e[_0xacb4('0x30')][_0xacb4('0x45')]){_0x25f2b2[_0xacb4('0x46')](createMessage(_0x2c4c4f,_0x301608,_0x17208e,_0x38a48e[_0xacb4('0x30')][_0xacb4('0x45')]));}}return Promise[_0xacb4('0x47')](_0x25f2b2)[_0xacb4('0xf')](function(){if(_0x5d236e){_0x57b914[_0xacb4('0x19')]();}else{_0x57b914['stop']();}})[_0xacb4('0x12')](function(_0x58f52b){logger[_0xacb4('0x13')](_0xacb4('0x11'),_0x2c4c4f,JSON['stringify'](_0x58f52b));_0x57b914[_0xacb4('0x19')]();});}})[_0xacb4('0x12')](function(_0x594ebd){logger[_0xacb4('0x13')](_0xacb4('0x11'),_0x2c4c4f,_0x594ebd['message'],_0x594ebd[_0xacb4('0x48')]);_0x57b914[_0xacb4('0x19')]();});}}catch(_0x5412d4){logger[_0xacb4('0x13')](_0xacb4('0x11'),_0x2c4c4f,JSON['stringify'](_0x5412d4));_0x57b914[_0xacb4('0x29')]();}};};
\ No newline at end of file
index 0e164b9..8998ff9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe0d0=['message','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','length','error','[%s][GOTOIF]\x20%s'];(function(_0x19a77e,_0x420392){var _0x1d8967=function(_0x5a2102){while(--_0x5a2102){_0x19a77e['push'](_0x19a77e['shift']());}};_0x1d8967(++_0x420392);}(_0xe0d0,0xfe));var _0x0e0d=function(_0x4c3454,_0x1880bd){_0x4c3454=_0x4c3454-0x0;var _0x247346=_0xe0d0[_0x4c3454];return _0x247346;};'use strict';var schema=require(_0x0e0d('0x0'));var _=require(_0x0e0d('0x1'));var htmlToText=require(_0x0e0d('0x2'));var utils=require(_0x0e0d('0x3'));var logger=require(_0x0e0d('0x4'))(_0x0e0d('0x5'));var gotoif=schema({'condition':{'type':_0x0e0d('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x0e0d('0x7'),'message':_0x0e0d('0x8')},'priorityFalse':{'type':_0x0e0d('0x7'),'message':_0x0e0d('0x9')}});exports[_0x0e0d('0xa')]=function(_0x45a1f1,_0x249d89){return function(_0x3e248c){try{var _0x1c201a={'condition':htmlToText[_0x0e0d('0xb')](utils[_0x0e0d('0xc')](_0x249d89[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x249d89[0x1],'priorityFalse':_0x249d89[0x2]};var _0x3ac89e=gotoif[_0x0e0d('0x0')](_0x1c201a,{'typecast':!![]});if(_0x3ac89e[_0x0e0d('0xd')]){logger[_0x0e0d('0xe')](_0x0e0d('0xf'),_0x45a1f1,_['map'](_0x3ac89e,_0x0e0d('0x10'))[_0x0e0d('0x11')](',\x20'));_0x3e248c[_0x0e0d('0x12')]();}else{try{var _0x1f8ab2=eval('('+_0x1c201a[_0x0e0d('0x13')]+')');var _0x9f9c0=_0x1f8ab2?_0x1c201a[_0x0e0d('0x14')]:_0x1c201a[_0x0e0d('0x15')];logger[_0x0e0d('0x16')](_0x0e0d('0x17'),_0x45a1f1,_0x1c201a['condition'],_0x1f8ab2,_0x9f9c0||_0x0e0d('0x18'));if(_0x9f9c0){var _0x365294=_[_0x0e0d('0x19')](_0x3e248c['rules'](),{'p':_0x9f9c0});if(_0x365294>=0x0){logger[_0x0e0d('0x16')](_0x0e0d('0x1a'),_0x45a1f1,_0x9f9c0||'next',_0x365294);_0x3e248c[_0x0e0d('0x18')](_0x365294);}else{logger[_0x0e0d('0x16')](_0x0e0d('0x1b'),_0x45a1f1,_0x9f9c0||'next');_0x3e248c[_0x0e0d('0x12')]();}}else{_0x3e248c[_0x0e0d('0x18')]();}}catch(_0x26bf25){logger[_0x0e0d('0xe')](_0x0e0d('0x1c'),_0x45a1f1,_0x26bf25['message']);_0x3e248c[_0x0e0d('0x12')]();}}}catch(_0x178036){logger[_0x0e0d('0xe')]('[%s][GOTOIF]\x20%s',_0x45a1f1,JSON[_0x0e0d('0x1d')](_0x178036));_0x3e248c['stop']();}};};
\ No newline at end of file
+var _0xdb63=['[%s][GOTOIF]\x20%s','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','string','priority\x20true\x20is\x20a\x20number','number','consequence','fromString','getMustacheRender','replace','error','map','message','join','stop','condition','priorityTrue','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOIF]\x20eval\x20error:\x20%s'];(function(_0x31ad86,_0x2fce0e){var _0x5e3989=function(_0x5bc82c){while(--_0x5bc82c){_0x31ad86['push'](_0x31ad86['shift']());}};_0x5e3989(++_0x2fce0e);}(_0xdb63,0x89));var _0x3db6=function(_0x1887f4,_0x370eea){_0x1887f4=_0x1887f4-0x0;var _0x20723a=_0xdb63[_0x1887f4];return _0x20723a;};'use strict';var schema=require(_0x3db6('0x0'));var _=require(_0x3db6('0x1'));var htmlToText=require(_0x3db6('0x2'));var utils=require(_0x3db6('0x3'));var logger=require(_0x3db6('0x4'))(_0x3db6('0x5'));var gotoif=schema({'condition':{'type':_0x3db6('0x6'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':'number','message':_0x3db6('0x7')},'priorityFalse':{'type':_0x3db6('0x8'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x3db6('0x9')]=function(_0x4ab40a,_0x4ce05a){return function(_0x56ef06){try{var _0x332480={'condition':htmlToText[_0x3db6('0xa')](utils[_0x3db6('0xb')](_0x4ce05a[0x0],this),{'wordwrap':![]})[_0x3db6('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4ce05a[0x1],'priorityFalse':_0x4ce05a[0x2]};var _0x5d5c3b=gotoif['validate'](_0x332480,{'typecast':!![]});if(_0x5d5c3b['length']){logger[_0x3db6('0xd')]('[%s][GOTOIF]\x20%s',_0x4ab40a,_[_0x3db6('0xe')](_0x5d5c3b,_0x3db6('0xf'))[_0x3db6('0x10')](',\x20'));_0x56ef06[_0x3db6('0x11')]();}else{try{var _0x72e58d=eval('('+_0x332480[_0x3db6('0x12')]+')');var _0x571a30=_0x72e58d?_0x332480[_0x3db6('0x13')]:_0x332480['priorityFalse'];logger['info'](_0x3db6('0x14'),_0x4ab40a,_0x332480[_0x3db6('0x12')],_0x72e58d,_0x571a30||'next');if(_0x571a30){var _0x56b8dd=_['findIndex'](_0x56ef06['rules'](),{'p':_0x571a30});if(_0x56b8dd>=0x0){logger[_0x3db6('0x15')](_0x3db6('0x16'),_0x4ab40a,_0x571a30||_0x3db6('0x17'),_0x56b8dd);_0x56ef06['next'](_0x56b8dd);}else{logger[_0x3db6('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x4ab40a,_0x571a30||_0x3db6('0x17'));_0x56ef06[_0x3db6('0x11')]();}}else{_0x56ef06[_0x3db6('0x17')]();}}catch(_0xf09c97){logger[_0x3db6('0xd')](_0x3db6('0x18'),_0x4ab40a,_0xf09c97['message']);_0x56ef06[_0x3db6('0x11')]();}}}catch(_0x1136be){logger['error'](_0x3db6('0x19'),_0x4ab40a,JSON[_0x3db6('0x1a')](_0x1136be));_0x56ef06[_0x3db6('0x11')]();}};};
\ No newline at end of file
index 58f2adf..42d740b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcab0=['[%s][GOTOP]\x20%s','map','message','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error'];(function(_0x4f0ba1,_0x1652d1){var _0x4e232a=function(_0x1414a4){while(--_0x1414a4){_0x4f0ba1['push'](_0x4f0ba1['shift']());}};_0x4e232a(++_0x1652d1);}(_0xcab0,0x71));var _0x0cab=function(_0x43f093,_0x15d5f2){_0x43f093=_0x43f093-0x0;var _0x2c2489=_0xcab0[_0x43f093];return _0x2c2489;};'use strict';var schema=require(_0x0cab('0x0'));var _=require(_0x0cab('0x1'));var logger=require(_0x0cab('0x2'))(_0x0cab('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x0cab('0x4')}});exports[_0x0cab('0x5')]=function(_0x3d999e,_0x1eb986){return function(_0x5ebcef){try{var _0x8694b={'priority':_0x1eb986[0x0]};var _0x389454=gotop[_0x0cab('0x0')](_0x8694b,{'typecast':!![]});if(_0x389454['length']){logger[_0x0cab('0x6')](_0x0cab('0x7'),_0x3d999e,_[_0x0cab('0x8')](_0x389454,_0x0cab('0x9'))[_0x0cab('0xa')](',\x20'));_0x5ebcef[_0x0cab('0xb')]();}else{logger['info'](_0x0cab('0xc'),_0x3d999e,_0x8694b[_0x0cab('0xd')]);if(_0x8694b['priority']){var _0x5a523a=_['findIndex'](_0x5ebcef[_0x0cab('0xe')](),{'p':_0x8694b[_0x0cab('0xd')]});if(_0x5a523a>=0x0){logger[_0x0cab('0xf')](_0x0cab('0x10'),_0x3d999e,_0x8694b[_0x0cab('0xd')]||_0x0cab('0x11'),_0x5a523a);_0x5ebcef['next'](_0x5a523a);}else{logger[_0x0cab('0xf')](_0x0cab('0x12'),_0x3d999e,_0x8694b[_0x0cab('0xd')]||'next');_0x5ebcef['stop']();}}else{_0x5ebcef[_0x0cab('0x11')]();}}}catch(_0x508d7f){logger[_0x0cab('0x6')](_0x0cab('0x7'),_0x3d999e,JSON[_0x0cab('0x13')](_0x508d7f));_0x5ebcef[_0x0cab('0xb')]();}};};
\ No newline at end of file
+var _0x1570=['priority','rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s'];(function(_0x1db831,_0x42b7b5){var _0x39ba56=function(_0x2c2dd3){while(--_0x2c2dd3){_0x1db831['push'](_0x1db831['shift']());}};_0x39ba56(++_0x42b7b5);}(_0x1570,0xd6));var _0x0157=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x1570[_0x37bd26];return _0xe83dc4;};'use strict';var schema=require(_0x0157('0x0'));var _=require(_0x0157('0x1'));var logger=require(_0x0157('0x2'))(_0x0157('0x3'));var gotop=schema({'priority':{'type':_0x0157('0x4'),'required':!![],'message':_0x0157('0x5')}});exports[_0x0157('0x6')]=function(_0x3c55d3,_0x3d4ac8){return function(_0xf5075d){try{var _0x2b128d={'priority':_0x3d4ac8[0x0]};var _0x36e5ff=gotop['validate'](_0x2b128d,{'typecast':!![]});if(_0x36e5ff[_0x0157('0x7')]){logger['error'](_0x0157('0x8'),_0x3c55d3,_[_0x0157('0x9')](_0x36e5ff,_0x0157('0xa'))['join'](',\x20'));_0xf5075d[_0x0157('0xb')]();}else{logger[_0x0157('0xc')](_0x0157('0xd'),_0x3c55d3,_0x2b128d[_0x0157('0xe')]);if(_0x2b128d[_0x0157('0xe')]){var _0xf8e1e8=_['findIndex'](_0xf5075d[_0x0157('0xf')](),{'p':_0x2b128d[_0x0157('0xe')]});if(_0xf8e1e8>=0x0){logger[_0x0157('0xc')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x3c55d3,_0x2b128d[_0x0157('0xe')]||_0x0157('0x10'),_0xf8e1e8);_0xf5075d[_0x0157('0x10')](_0xf8e1e8);}else{logger['info'](_0x0157('0x11'),_0x3c55d3,_0x2b128d[_0x0157('0xe')]||_0x0157('0x10'));_0xf5075d[_0x0157('0xb')]();}}else{_0xf5075d[_0x0157('0x10')]();}}}catch(_0x4e56b7){logger[_0x0157('0x12')](_0x0157('0x8'),_0x3c55d3,JSON['stringify'](_0x4e56b7));_0xf5075d[_0x0157('0xb')]();}};};
\ No newline at end of file
index d96b56d..9d064f7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7462=['../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','catch','error','stop','stringify','lodash','./utils','../../rpc/chatMessage'];(function(_0x729dbb,_0x4cb834){var _0x227ef7=function(_0xaba7e5){while(--_0xaba7e5){_0x729dbb['push'](_0x729dbb['shift']());}};_0x227ef7(++_0x4cb834);}(_0x7462,0x165));var _0x2746=function(_0x1d39f6,_0x146f4a){_0x1d39f6=_0x1d39f6-0x0;var _0x3dbd7a=_0x7462[_0x1d39f6];return _0x3dbd7a;};'use strict';var _=require(_0x2746('0x0'));var utils=require(_0x2746('0x1'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x2746('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2746('0x3')),'faxMessage':require(_0x2746('0x4')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x2746('0x5')]=function(_0x2b4606,_0x1c3371){return function(_0x280dfb){try{var _0x2a2f42={'body':utils[_0x2746('0x6')](_0x1c3371[0x0],this),'ContactId':this[_0x2746('0x7')]['id']};if(this[_0x2746('0x8')]===_0x2746('0x9')){_0x2a2f42['ChatWebsiteId']=this[_0x2746('0xa')]['id'];}else{_0x2a2f42[_[_0x2746('0xb')](this['channel'])+_0x2746('0xc')]=this[_0x2746('0xa')]['id'];}_0x2a2f42[_[_0x2746('0xb')](this['channel'])+_0x2746('0xd')]=this[_0x2746('0xe')]['id'];if(rpc[this[_0x2746('0x8')]+_0x2746('0xf')]){return rpc[this[_0x2746('0x8')]+_0x2746('0xf')][_0x2746('0x10')](_0x2a2f42)[_0x2746('0x11')](function(_0x10c17d){logger[_0x2746('0x12')](_0x2746('0x13'),_0x2b4606,_0x2a2f42['body']);_0x280dfb['next']();})[_0x2746('0x14')](function(_0x38c1b3){logger[_0x2746('0x15')](_0x2746('0x13'),_0x2b4606,JSON['stringify'](_0x38c1b3));_0x280dfb[_0x2746('0x16')]();});}}catch(_0x1a1e02){logger['error']('[%s][MESSAGE]\x20%s',_0x2b4606,JSON[_0x2746('0x17')](_0x1a1e02));_0x280dfb[_0x2746('0x16')]();}};};
\ No newline at end of file
+var _0x35d4=['then','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','channel','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create'];(function(_0x54c536,_0x17c283){var _0x5eab53=function(_0x49c94e){while(--_0x49c94e){_0x54c536['push'](_0x54c536['shift']());}};_0x5eab53(++_0x17c283);}(_0x35d4,0x1e7));var _0x435d=function(_0xd354,_0x35b31b){_0xd354=_0xd354-0x0;var _0xb82a29=_0x35d4[_0xd354];return _0xb82a29;};'use strict';var _=require(_0x435d('0x0'));var utils=require('./utils');var logger=require(_0x435d('0x1'))(_0x435d('0x2'));var rpc={'chatMessage':require(_0x435d('0x3')),'openchannelMessage':require(_0x435d('0x4')),'mailMessage':require(_0x435d('0x5')),'smsMessage':require(_0x435d('0x6')),'faxMessage':require(_0x435d('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x435d('0x8')]=function(_0x1f63d8,_0x550c5d){return function(_0x539a8d){try{var _0x2b1cc7={'body':utils['getMustacheRender'](_0x550c5d[0x0],this),'ContactId':this['contact']['id']};if(this[_0x435d('0x9')]==='chat'){_0x2b1cc7[_0x435d('0xa')]=this[_0x435d('0xb')]['id'];}else{_0x2b1cc7[_[_0x435d('0xc')](this[_0x435d('0x9')])+_0x435d('0xd')]=this[_0x435d('0xb')]['id'];}_0x2b1cc7[_[_0x435d('0xc')](this[_0x435d('0x9')])+'InteractionId']=this[_0x435d('0xe')]['id'];if(rpc[this[_0x435d('0x9')]+_0x435d('0xf')]){return rpc[this['channel']+_0x435d('0xf')][_0x435d('0x10')](_0x2b1cc7)[_0x435d('0x11')](function(_0xbc1db4){logger['info'](_0x435d('0x12'),_0x1f63d8,_0x2b1cc7['body']);_0x539a8d[_0x435d('0x13')]();})[_0x435d('0x14')](function(_0x512911){logger[_0x435d('0x15')](_0x435d('0x12'),_0x1f63d8,JSON[_0x435d('0x16')](_0x512911));_0x539a8d['stop']();});}}catch(_0x505ebe){logger['error'](_0x435d('0x12'),_0x1f63d8,JSON['stringify'](_0x505ebe));_0x539a8d[_0x435d('0x17')]();}};};
\ No newline at end of file
index 681f3b9..cd0b9ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc153=['stop','../../../../config/logger','routing','consequence','[%s][NOOP]\x20%s','getMustacheRender','error','stringify'];(function(_0x206b03,_0x30729c){var _0x33f3bf=function(_0x1183f7){while(--_0x1183f7){_0x206b03['push'](_0x206b03['shift']());}};_0x33f3bf(++_0x30729c);}(_0xc153,0x191));var _0x3c15=function(_0x16c2af,_0x11689){_0x16c2af=_0x16c2af-0x0;var _0x1ea542=_0xc153[_0x16c2af];return _0x1ea542;};'use strict';var utils=require('./utils');var logger=require(_0x3c15('0x0'))(_0x3c15('0x1'));exports[_0x3c15('0x2')]=function(_0x219d0b,_0x368beb){return function(_0x5df838){try{logger['info'](_0x3c15('0x3'),_0x219d0b,utils[_0x3c15('0x4')](_0x368beb[0x0],this));_0x5df838['next']();}catch(_0x349438){logger[_0x3c15('0x5')](_0x3c15('0x3'),_0x219d0b,JSON[_0x3c15('0x6')](_0x349438));_0x5df838[_0x3c15('0x7')]();}};};
\ No newline at end of file
+var _0x16ec=['./utils','../../../../config/logger','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop'];(function(_0x49c139,_0x8a930e){var _0x374309=function(_0x4568b9){while(--_0x4568b9){_0x49c139['push'](_0x49c139['shift']());}};_0x374309(++_0x8a930e);}(_0x16ec,0x17a));var _0xc16e=function(_0x16692e,_0x3232a5){_0x16692e=_0x16692e-0x0;var _0x5b2edd=_0x16ec[_0x16692e];return _0x5b2edd;};'use strict';var utils=require(_0xc16e('0x0'));var logger=require(_0xc16e('0x1'))('routing');exports['consequence']=function(_0x41a288,_0x354fc1){return function(_0xae536c){try{logger[_0xc16e('0x2')](_0xc16e('0x3'),_0x41a288,utils[_0xc16e('0x4')](_0x354fc1[0x0],this));_0xae536c[_0xc16e('0x5')]();}catch(_0x144af0){logger[_0xc16e('0x6')]('[%s][NOOP]\x20%s',_0x41a288,JSON[_0xc16e('0x7')](_0x144af0));_0xae536c[_0xc16e('0x8')]();}};};
\ No newline at end of file
index 1a8ae0d..96ba920 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa00b=['../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','accepted','body','Interaction','update','interaction','then','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','routing','./strategy','defaults','redis','localhost','socket.io-emitter','queue_id','account','from','clone','queue','push','InteractionId','format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/chatInteraction'];(function(_0x29b8e9,_0x39eabe){var _0x5babba=function(_0x32b1e6){while(--_0x32b1e6){_0x29b8e9['push'](_0x29b8e9['shift']());}};_0x5babba(++_0x39eabe);}(_0xa00b,0x1da));var _0xba00=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa00b[_0x321bb2];return _0x9c12ed;};'use strict';var schema=require(_0xba00('0x0'));var _=require('lodash');var util=require(_0xba00('0x1'));var seqqueue=require(_0xba00('0x2'));var moment=require(_0xba00('0x3'));var Redis=require(_0xba00('0x4'));var config=require(_0xba00('0x5'));var logger=require('../../../../config/logger')(_0xba00('0x6'));var strategy=require(_0xba00('0x7'));config['redis']=_[_0xba00('0x8')](config[_0xba00('0x9')],{'host':_0xba00('0xa'),'port':0x18eb});var io=require(_0xba00('0xb'))(new Redis(config[_0xba00('0x9')]));var attributes=['id',_0xba00('0xc'),_0xba00('0xd'),'queue',_0xba00('0xe'),'joinAt'];function emit(_0x3a1b8a,_0x239d12,_0x4e9af5){io['to'](_0x3a1b8a)['emit'](_0x239d12,_0x4e9af5);}function emitChannelQueueInteraction(_0x18cf2d,_0x115eca,_0x136fc6,_0x52d514,_0x537e49,_0x1e3f4e,_0x41dbec,_0x8ed27c){var _0x18449b=_[_0xba00('0xf')](_0x136fc6);_0x18449b[_0xba00('0xc')]=_0x8ed27c;_0x18449b[_0xba00('0x10')]=_0x115eca;_0x18449b['account']=_0x52d514;_0x18449b['id']=_0x537e49;if(_0x1e3f4e){attributes[_0xba00('0x11')](_['capitalize'](_0x18cf2d)+_0xba00('0x12'));_0x41dbec[util[_0xba00('0x13')](_0xba00('0x14'),_0x18cf2d)][_0x537e49]=_[_0xba00('0x15')](_0x18449b,attributes);}else{delete _0x41dbec[util[_0xba00('0x13')]('%sQueuesWaitingInteractions',_0x18cf2d)][_0x537e49];}emit(util[_0xba00('0x13')]('%s:queue:%s',_0x18cf2d,_0x115eca),util[_0xba00('0x13')](_0xba00('0x16'),_0x18cf2d,_0x1e3f4e?_0xba00('0x17'):_0xba00('0x18')),_['pick'](_0x18449b,attributes));}var rpc={'openchannelQueueReport':require(_0xba00('0x19')),'mailQueueReport':require(_0xba00('0x1a')),'chatQueueReport':require(_0xba00('0x1b')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0xba00('0x1c')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require(_0xba00('0x1d')),'faxInteraction':require(_0xba00('0x1e')),'mailInteraction':require(_0xba00('0x1f')),'openchannelInteraction':require(_0xba00('0x20')),'smsInteraction':require(_0xba00('0x21')),'whatsappInteraction':require(_0xba00('0x22'))};var queue=schema({'name':{'type':_0xba00('0x23'),'required':!![],'message':_0xba00('0x24')},'timeout':{'type':_0xba00('0x25'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x208bfa,_0x142da9,_0x120bf9,_0x56bf45){if(_0x208bfa&&_0x142da9&&_0x120bf9){_0x142da9[_0xba00('0x26')]+=0x1;var _0x338da2={'uniqueid':_0x208bfa,'from':_0x120bf9['body']?_0x120bf9['body']['from']:'','joinAt':moment()[_0xba00('0x13')](_0xba00('0x27')),'ContactId':_0x120bf9['contact']?_0x120bf9[_0xba00('0x28')]['id']:null,'ListId':_0x120bf9[_0xba00('0x29')]?_0x120bf9[_0xba00('0x29')]['id']:null};_0x338da2[_[_0xba00('0x2a')](_0x120bf9[_0xba00('0x2b')])+'QueueId']=_0x142da9['id']||null;_0x338da2[_[_0xba00('0x2a')](_0x120bf9[_0xba00('0x2b')])+_0xba00('0x12')]=_0x120bf9['interaction']?_0x120bf9['interaction']['id']:null;_0x338da2[_[_0xba00('0x2a')](_0x120bf9['channel'])+'MessageId']=_0x120bf9[_0xba00('0x2c')]?_0x120bf9[_0xba00('0x2c')]['id']:null;_0x338da2[_[_0xba00('0x2a')](_0x120bf9[_0xba00('0x2b')])+(_0x120bf9[_0xba00('0x2b')]!==_0xba00('0x2d')?_0xba00('0x2e'):_0xba00('0x2f'))]=_0x120bf9[_0xba00('0xd')]?_0x120bf9[_0xba00('0xd')]['id']:null;logger['info'](util['format'](_0xba00('0x30'),_0x208bfa,_0x142da9['name']));emitChannelQueueInteraction(_0x120bf9[_0xba00('0x2b')],_0x142da9[_0xba00('0x31')],_0x338da2,_0x120bf9[_0xba00('0xd')]['name'],_0x120bf9[_0xba00('0x2c')]['id'],!![],_0x56bf45,_0x142da9['id']);if(rpc[_0x120bf9[_0xba00('0x2b')]+_0xba00('0x32')]){return rpc[_0x120bf9[_0xba00('0x2b')]+'QueueReport'][_0xba00('0x33')](_0x338da2)['catch'](function(_0x4da63f){logger[_0xba00('0x34')]('create\x20queue\x20report',_0x4da63f);});}}}function stopRouting(_0x160d2b,_0x5afaba,_0x43c5fd,_0x1f0d4b){if(_0x160d2b&&_0x5afaba){_0x5afaba[_0xba00('0x26')]-=0x1;var _0x576068={'leaveAt':moment()[_0xba00('0x13')](_0xba00('0x27')),'acceptAt':moment()[_0xba00('0x13')](_0xba00('0x27')),'reason':_0xba00('0x35')};logger['info'](util['format']('[%s][STOP:QUEUE][NAME:%s]',_0x160d2b,_0x5afaba[_0xba00('0x31')]));emitChannelQueueInteraction(_0x43c5fd[_0xba00('0x2b')],_0x5afaba[_0xba00('0x31')],_0x43c5fd[_0xba00('0x36')],_0x43c5fd['account'][_0xba00('0x31')],_0x43c5fd[_0xba00('0x2c')]['id'],![],_0x1f0d4b,_0x5afaba['id']);return rpc[_0x43c5fd['channel']+_0xba00('0x37')][_0xba00('0x38')](_0x43c5fd[_0xba00('0x39')]['id'],{'queueId':_0x5afaba['id']})[_0xba00('0x3a')](function(){if(rpc[_0x43c5fd['channel']+_0xba00('0x32')]){return rpc[_0x43c5fd[_0xba00('0x2b')]+_0xba00('0x32')][_0xba00('0x38')](_0x160d2b,_0x576068)['catch'](function(_0x33da5b){logger['error'](_0xba00('0x3b'),_0x33da5b);});}});}}function endRouting(_0x175abe,_0x2a00ff,_0x40fb15,_0x305331){if(_0x175abe&&_0x2a00ff){_0x2a00ff[_0xba00('0x26')]-=0x1;var _0x433e95={'leaveAt':moment()[_0xba00('0x13')](_0xba00('0x27')),'exitAt':moment()[_0xba00('0x13')](_0xba00('0x27')),'reason':_0xba00('0x3c')};logger[_0xba00('0x3d')](util[_0xba00('0x13')](_0xba00('0x3e'),_0x175abe,_0x2a00ff[_0xba00('0x31')]));emitChannelQueueInteraction(_0x40fb15[_0xba00('0x2b')],_0x2a00ff[_0xba00('0x31')],_0x40fb15[_0xba00('0x36')],_0x40fb15['account']['name'],_0x40fb15[_0xba00('0x2c')]['id'],![],_0x305331);if(rpc[_0x40fb15[_0xba00('0x2b')]+_0xba00('0x32')]){return rpc[_0x40fb15[_0xba00('0x2b')]+_0xba00('0x32')]['update'](_0x175abe,_0x433e95)['catch'](function(_0x4672de){logger['error']('update\x20queue\x20report',_0x4672de);});}}}function handleFindQueue(_0x56a5ae){return function(_0x273cb2){return _0x273cb2[_0xba00('0x31')][_0xba00('0x3f')]()===_0x56a5ae[_0xba00('0x3f')]();};}exports[_0xba00('0x40')]=function(_0x1f7351,_0x4c8b12,_0x4f6013,_0xa02c49){return function(_0x12138e){try{var _0x39c07e={'name':_0x4c8b12[0x0],'timeout':_0x4c8b12[0x1]};var _0x16fa8c=queue[_0xba00('0x0')](_0x39c07e,{'typecast':!![]});if(_0x16fa8c[_0xba00('0x41')]){logger[_0xba00('0x34')](_0xba00('0x42'),_0x1f7351,_[_0xba00('0x43')](_0x16fa8c,_0xba00('0x2c'))[_0xba00('0x44')](',\x20'));_0x12138e[_0xba00('0x45')]();}else{var _0x1eb9a9=_['find'](_0x4f6013[_0xa02c49[_0xba00('0x2b')]+_0xba00('0x46')],handleFindQueue(_0x39c07e['name']));if(_0x1eb9a9){startRouting(_0x1f7351,_0x1eb9a9,_0xa02c49,_0x4f6013);var _0x38bba9=(_0x1eb9a9[_0xba00('0x3c')]||0xa)*0x3e8;var _0x5554a6=(_0x39c07e[_0xba00('0x3c')]||0x14)*0x3e8;var _0xf4ae37;if(_0x38bba9>_0x5554a6){_0x5554a6=_0x38bba9;}var _0x444bf7=seqqueue[_0xba00('0x47')](_0x38bba9);_0x444bf7['id']=_0x1f7351;_0x444bf7[_0xba00('0x48')]=_0x38bba9;_0x444bf7[_0xba00('0x49')]=_0x5554a6;_0x444bf7[_0xba00('0x2b')]=_0xa02c49[_0xba00('0x2b')];_0x4f6013[_0xba00('0x4a')][_0x1f7351]['on'](_0xba00('0x4b'),function(){logger[_0xba00('0x3d')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x1f7351);stopRouting(_0x1f7351,_0x1eb9a9,_0xa02c49,_0x4f6013);clearTimeout(_0xf4ae37);_0xf4ae37=undefined;_0x444bf7[_0xba00('0x4c')](!![]);if(_0x4f6013[_0xba00('0x4a')][_0x1f7351]){delete _0x4f6013[_0xba00('0x4a')][_0x1f7351];}_0x12138e[_0xba00('0x45')]();});_0x4f6013['rules'][_0x1f7351]['on'](_0xba00('0x4d'),function(){if(_0x4f6013[_0xba00('0x4a')][_0x1f7351]){delete _0x4f6013[_0xba00('0x4a')][_0x1f7351];}});_0xf4ae37=setTimeout(function(){logger['info'](_0xba00('0x4e'),_0x1f7351);endRouting(_0x1f7351,_0x1eb9a9,_0xa02c49,_0x4f6013);clearTimeout(_0xf4ae37);_0x444bf7[_0xba00('0x4c')](!![]);_0x12138e['next']();},_0x5554a6);switch(_0x1eb9a9[_0xba00('0x4f')]){case _0xba00('0x50'):strategy[_0xba00('0x50')](_0x444bf7,_0x1eb9a9,_0x4f6013,_0xa02c49);break;default:strategy[_0xba00('0x51')](_0x444bf7,_0x1eb9a9,_0x4f6013,_0xa02c49);}}else{logger['error'](_0xba00('0x52'),_0x1f7351,_0x39c07e['name']);_0x12138e['stop']();}}}catch(_0x78c342){logger[_0xba00('0x34')](_0xba00('0x42'),_0x1f7351,_0x78c342[_0xba00('0x53')]);_0x12138e[_0xba00('0x45')]();}};};
\ No newline at end of file
+var _0x06e0=['beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','lodash','util','moment','ioredis','../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','queue','from','joinAt','emit','account','push','InteractionId','format','%sQueuesWaitingInteractions','%s:queue:%s','save','remove','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','info','name','QueueReport','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','error','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','map','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','complete','strategy','rrmemory'];(function(_0x114ff6,_0x19e80d){var _0x4d3a58=function(_0x351ee1){while(--_0x351ee1){_0x114ff6['push'](_0x114ff6['shift']());}};_0x4d3a58(++_0x19e80d);}(_0x06e0,0x198));var _0x006e=function(_0x3b45e8,_0x628af6){_0x3b45e8=_0x3b45e8-0x0;var _0x370099=_0x06e0[_0x3b45e8];return _0x370099;};'use strict';var schema=require('validate');var _=require(_0x006e('0x0'));var util=require(_0x006e('0x1'));var seqqueue=require('seq-queue');var moment=require(_0x006e('0x2'));var Redis=require(_0x006e('0x3'));var config=require('../../../../config/environment');var logger=require(_0x006e('0x4'))(_0x006e('0x5'));var strategy=require('./strategy');config[_0x006e('0x6')]=_[_0x006e('0x7')](config['redis'],{'host':_0x006e('0x8'),'port':0x18eb});var io=require(_0x006e('0x9'))(new Redis(config[_0x006e('0x6')]));var attributes=['id','queue_id','account',_0x006e('0xa'),_0x006e('0xb'),_0x006e('0xc')];function emit(_0x22c4e0,_0x100d7e,_0x51484f){io['to'](_0x22c4e0)[_0x006e('0xd')](_0x100d7e,_0x51484f);}function emitChannelQueueInteraction(_0x3e74ae,_0x7c39ce,_0x4f03f2,_0x288b56,_0x3b08ed,_0xda2646,_0x6ce0d7,_0xa7b593){var _0x3fb65=_['clone'](_0x4f03f2);_0x3fb65['queue_id']=_0xa7b593;_0x3fb65[_0x006e('0xa')]=_0x7c39ce;_0x3fb65[_0x006e('0xe')]=_0x288b56;_0x3fb65['id']=_0x3b08ed;if(_0xda2646){attributes[_0x006e('0xf')](_['capitalize'](_0x3e74ae)+_0x006e('0x10'));_0x6ce0d7[util[_0x006e('0x11')](_0x006e('0x12'),_0x3e74ae)][_0x3b08ed]=_['pick'](_0x3fb65,attributes);}else{delete _0x6ce0d7[util[_0x006e('0x11')](_0x006e('0x12'),_0x3e74ae)][_0x3b08ed];}emit(util[_0x006e('0x11')](_0x006e('0x13'),_0x3e74ae,_0x7c39ce),util[_0x006e('0x11')]('%s_queue_waiting_interaction:%s',_0x3e74ae,_0xda2646?_0x006e('0x14'):_0x006e('0x15')),_[_0x006e('0x16')](_0x3fb65,attributes));}var rpc={'openchannelQueueReport':require(_0x006e('0x17')),'mailQueueReport':require(_0x006e('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x006e('0x19')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require(_0x006e('0x1a')),'chatInteraction':require(_0x006e('0x1b')),'faxInteraction':require(_0x006e('0x1c')),'mailInteraction':require(_0x006e('0x1d')),'openchannelInteraction':require(_0x006e('0x1e')),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0x006e('0x1f'))};var queue=schema({'name':{'type':_0x006e('0x20'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x006e('0x21'),'message':_0x006e('0x22')}});function startRouting(_0x53c435,_0x2f6223,_0x58bde7,_0x1840d8){if(_0x53c435&&_0x2f6223&&_0x58bde7){_0x2f6223[_0x006e('0x23')]+=0x1;var _0x33a166={'uniqueid':_0x53c435,'from':_0x58bde7[_0x006e('0x24')]?_0x58bde7[_0x006e('0x24')][_0x006e('0xb')]:'','joinAt':moment()['format'](_0x006e('0x25')),'ContactId':_0x58bde7[_0x006e('0x26')]?_0x58bde7[_0x006e('0x26')]['id']:null,'ListId':_0x58bde7[_0x006e('0x27')]?_0x58bde7[_0x006e('0x27')]['id']:null};_0x33a166[_[_0x006e('0x28')](_0x58bde7[_0x006e('0x29')])+_0x006e('0x2a')]=_0x2f6223['id']||null;_0x33a166[_[_0x006e('0x28')](_0x58bde7[_0x006e('0x29')])+'InteractionId']=_0x58bde7[_0x006e('0x2b')]?_0x58bde7[_0x006e('0x2b')]['id']:null;_0x33a166[_[_0x006e('0x28')](_0x58bde7['channel'])+'MessageId']=_0x58bde7[_0x006e('0x2c')]?_0x58bde7[_0x006e('0x2c')]['id']:null;_0x33a166[_[_0x006e('0x28')](_0x58bde7['channel'])+(_0x58bde7['channel']!==_0x006e('0x2d')?'AccountId':'WebsiteId')]=_0x58bde7[_0x006e('0xe')]?_0x58bde7[_0x006e('0xe')]['id']:null;logger[_0x006e('0x2e')](util[_0x006e('0x11')]('[%s][START:QUEUE][NAME:%s]',_0x53c435,_0x2f6223['name']));emitChannelQueueInteraction(_0x58bde7['channel'],_0x2f6223[_0x006e('0x2f')],_0x33a166,_0x58bde7['account'][_0x006e('0x2f')],_0x58bde7[_0x006e('0x2c')]['id'],!![],_0x1840d8,_0x2f6223['id']);if(rpc[_0x58bde7[_0x006e('0x29')]+_0x006e('0x30')]){return rpc[_0x58bde7[_0x006e('0x29')]+_0x006e('0x30')]['create'](_0x33a166)['catch'](function(_0x52a80b){logger['error'](_0x006e('0x31'),_0x52a80b);});}}}function stopRouting(_0x1dd629,_0x3f5771,_0x22bf3b,_0xc7f7f3){if(_0x1dd629&&_0x3f5771){_0x3f5771['waiting']-=0x1;var _0x5a41e6={'leaveAt':moment()[_0x006e('0x11')](_0x006e('0x25')),'acceptAt':moment()[_0x006e('0x11')](_0x006e('0x25')),'reason':_0x006e('0x32')};logger['info'](util[_0x006e('0x11')](_0x006e('0x33'),_0x1dd629,_0x3f5771[_0x006e('0x2f')]));emitChannelQueueInteraction(_0x22bf3b['channel'],_0x3f5771[_0x006e('0x2f')],_0x22bf3b[_0x006e('0x24')],_0x22bf3b[_0x006e('0xe')][_0x006e('0x2f')],_0x22bf3b[_0x006e('0x2c')]['id'],![],_0xc7f7f3,_0x3f5771['id']);return rpc[_0x22bf3b[_0x006e('0x29')]+_0x006e('0x34')][_0x006e('0x35')](_0x22bf3b[_0x006e('0x2b')]['id'],{'queueId':_0x3f5771['id']})[_0x006e('0x36')](function(){if(rpc[_0x22bf3b[_0x006e('0x29')]+_0x006e('0x30')]){return rpc[_0x22bf3b['channel']+_0x006e('0x30')][_0x006e('0x35')](_0x1dd629,_0x5a41e6)[_0x006e('0x37')](function(_0x3137c7){logger['error'](_0x006e('0x38'),_0x3137c7);});}});}}function endRouting(_0x76b316,_0x58a48b,_0x61f36c,_0x31a2bb){if(_0x76b316&&_0x58a48b){_0x58a48b['waiting']-=0x1;var _0x55035f={'leaveAt':moment()['format'](_0x006e('0x25')),'exitAt':moment()[_0x006e('0x11')](_0x006e('0x25')),'reason':'timeout'};logger['info'](util['format'](_0x006e('0x39'),_0x76b316,_0x58a48b[_0x006e('0x2f')]));emitChannelQueueInteraction(_0x61f36c[_0x006e('0x29')],_0x58a48b[_0x006e('0x2f')],_0x61f36c['body'],_0x61f36c['account'][_0x006e('0x2f')],_0x61f36c[_0x006e('0x2c')]['id'],![],_0x31a2bb);if(rpc[_0x61f36c[_0x006e('0x29')]+_0x006e('0x30')]){return rpc[_0x61f36c[_0x006e('0x29')]+_0x006e('0x30')][_0x006e('0x35')](_0x76b316,_0x55035f)[_0x006e('0x37')](function(_0x5e1752){logger[_0x006e('0x3a')](_0x006e('0x38'),_0x5e1752);});}}}function handleFindQueue(_0x54862a){return function(_0x490792){return _0x490792[_0x006e('0x2f')][_0x006e('0x3b')]()===_0x54862a['toLowerCase']();};}exports[_0x006e('0x3c')]=function(_0x2083e7,_0x227e02,_0x50190d,_0x52aed6){return function(_0x276f55){try{var _0x3277d3={'name':_0x227e02[0x0],'timeout':_0x227e02[0x1]};var _0x4ebfce=queue[_0x006e('0x3d')](_0x3277d3,{'typecast':!![]});if(_0x4ebfce[_0x006e('0x3e')]){logger['error'](_0x006e('0x3f'),_0x2083e7,_[_0x006e('0x40')](_0x4ebfce,_0x006e('0x2c'))['join'](',\x20'));_0x276f55[_0x006e('0x41')]();}else{var _0x595376=_[_0x006e('0x42')](_0x50190d[_0x52aed6[_0x006e('0x29')]+_0x006e('0x43')],handleFindQueue(_0x3277d3[_0x006e('0x2f')]));if(_0x595376){startRouting(_0x2083e7,_0x595376,_0x52aed6,_0x50190d);var _0x9b7484=(_0x595376[_0x006e('0x44')]||0xa)*0x3e8;var _0x11b678=(_0x3277d3[_0x006e('0x44')]||0x14)*0x3e8;var _0x2dc0b6;if(_0x9b7484>_0x11b678){_0x11b678=_0x9b7484;}var _0x1ac35c=seqqueue[_0x006e('0x45')](_0x9b7484);_0x1ac35c['id']=_0x2083e7;_0x1ac35c[_0x006e('0x46')]=_0x9b7484;_0x1ac35c[_0x006e('0x47')]=_0x11b678;_0x1ac35c[_0x006e('0x29')]=_0x52aed6[_0x006e('0x29')];_0x50190d['rules'][_0x2083e7]['on'](_0x006e('0x48'),function(){logger[_0x006e('0x2e')](_0x006e('0x49'),_0x2083e7);stopRouting(_0x2083e7,_0x595376,_0x52aed6,_0x50190d);clearTimeout(_0x2dc0b6);_0x2dc0b6=undefined;_0x1ac35c['close'](!![]);if(_0x50190d[_0x006e('0x4a')][_0x2083e7]){delete _0x50190d[_0x006e('0x4a')][_0x2083e7];}_0x276f55['stop']();});_0x50190d['rules'][_0x2083e7]['on'](_0x006e('0x4b'),function(){if(_0x50190d['rules'][_0x2083e7]){delete _0x50190d['rules'][_0x2083e7];}});_0x2dc0b6=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x2083e7);endRouting(_0x2083e7,_0x595376,_0x52aed6,_0x50190d);clearTimeout(_0x2dc0b6);_0x1ac35c['close'](!![]);_0x276f55['next']();},_0x11b678);switch(_0x595376[_0x006e('0x4c')]){case _0x006e('0x4d'):strategy['rrmemory'](_0x1ac35c,_0x595376,_0x50190d,_0x52aed6);break;default:strategy[_0x006e('0x4e')](_0x1ac35c,_0x595376,_0x50190d,_0x52aed6);}}else{logger[_0x006e('0x3a')](_0x006e('0x4f'),_0x2083e7,_0x3277d3[_0x006e('0x2f')]);_0x276f55[_0x006e('0x41')]();}}}catch(_0x2aac8b){logger[_0x006e('0x3a')](_0x006e('0x3f'),_0x2083e7,_0x2aac8b[_0x006e('0x50')]);_0x276f55['stop']();}};};
\ No newline at end of file
index 1c7a191..efcb3be 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24ca=['bind','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','STOP','TIMEOUT','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout'];(function(_0x498d43,_0x1d68fa){var _0x52fbd9=function(_0x1f2324){while(--_0x1f2324){_0x498d43['push'](_0x498d43['shift']());}};_0x52fbd9(++_0x1d68fa);}(_0x24ca,0x1bc));var _0xa24c=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x24ca[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0xa24c('0x0'));var uuid=require('uuid');var util=require(_0xa24c('0x1'));var logger=require(_0xa24c('0x2'))(_0xa24c('0x3'));var Agent=function(_0x5876d6,_0x18497e,_0x8a54a0,_0x195e60){this[_0xa24c('0x4')]=uuid['v4']();this[_0xa24c('0x5')]=_0x5876d6;this[_0xa24c('0x6')]=_0x18497e;this[_0xa24c('0x7')]=_0x8a54a0;this[_0xa24c('0x3')]=_0x195e60;this[_0xa24c('0x5')][_0xa24c('0x8')](this[_0xa24c('0x9')]['bind'](this),this[_0xa24c('0xa')][_0xa24c('0xb')](this));this[_0xa24c('0x5')]['on']('timeout',this[_0xa24c('0xa')][_0xa24c('0xb')](this));this[_0xa24c('0x5')]['on'](_0xa24c('0xc'),this[_0xa24c('0xd')][_0xa24c('0xb')](this));};Agent[_0xa24c('0xe')][_0xa24c('0x8')]=function(){this[_0xa24c('0x5')]['push'](this[_0xa24c('0x9')][_0xa24c('0xb')](this),this[_0xa24c('0xa')][_0xa24c('0xb')](this));};Agent['prototype'][_0xa24c('0xd')]=function(){this[_0xa24c('0xa')](!![]);};Agent[_0xa24c('0xe')][_0xa24c('0x9')]=function(){logger[_0xa24c('0xf')](_0xa24c('0x10'),this[_0xa24c('0x5')]['id'],this['agent']['id']);if(_['isNil'](this[_0xa24c('0x7')][_0xa24c('0x11')][this['agent']['id']])){logger['debug'](_0xa24c('0x12'),this[_0xa24c('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa24c('0x8')]['bind'](this),0x3e8);}else{if(this[_0xa24c('0x3')][_0xa24c('0x13')]||util[_0xa24c('0x14')](this[_0xa24c('0x5')]['id'],this['realtime'][_0xa24c('0x11')][this[_0xa24c('0x6')]['id']],this[_0xa24c('0x5')]['channel'],![])){this['realtime']['agents'][this['agent']['id']][_0xa24c('0x15')]=!![];this[_0xa24c('0x7')][_0xa24c('0x11')][this[_0xa24c('0x6')]['id']]['busyQueue']=undefined;util[_0xa24c('0x16')](this['realtime'],this[_0xa24c('0x3')],this[_0xa24c('0x6')],this['squeue'][_0xa24c('0x17')]);util[_0xa24c('0x18')](this[_0xa24c('0x4')],this[_0xa24c('0x5')]['id'],this[_0xa24c('0x7')]['agents'][this[_0xa24c('0x6')]['id']],null,this['routing']);util[_0xa24c('0x19')](this[_0xa24c('0x5')]['id'],this[_0xa24c('0x7')]['agents'][this[_0xa24c('0x6')]['id']],_0xa24c('0x1a')+(this[_0xa24c('0x3')][_0xa24c('0x13')]?_0xa24c('0x1b'):''));}else{logger[_0xa24c('0xf')](_0xa24c('0x1c'),this['squeue']['id'],this[_0xa24c('0x6')]['id']);setTimeout(this[_0xa24c('0x8')][_0xa24c('0xb')](this),0x3e8);}}};Agent[_0xa24c('0xe')]['handleTimeout']=function(_0x21d2a8){if(_[_0xa24c('0x1d')](this[_0xa24c('0x7')]['agents'][this[_0xa24c('0x6')]['id']])){return logger[_0xa24c('0xf')](_0xa24c('0x12'),this['squeue']['id'],this[_0xa24c('0x6')]['id']);}else{logger['debug'](_0xa24c('0x1e'),this[_0xa24c('0x5')]['id'],this[_0xa24c('0x6')]['id']);util['hideNotification'](this[_0xa24c('0x4')],this[_0xa24c('0x5')]['id'],this[_0xa24c('0x7')]['agents'][this[_0xa24c('0x6')]['id']],null,this['routing']);this[_0xa24c('0x7')][_0xa24c('0x11')][this['agent']['id']]['busy']=![];this[_0xa24c('0x7')][_0xa24c('0x11')][this[_0xa24c('0x6')]['id']][_0xa24c('0x1f')]=undefined;util[_0xa24c('0x20')](this[_0xa24c('0x7')],this[_0xa24c('0x3')],this['agent'],this[_0xa24c('0x5')][_0xa24c('0x17')]);util[_0xa24c('0x19')](this[_0xa24c('0x5')]['id'],this[_0xa24c('0x7')][_0xa24c('0x11')][this[_0xa24c('0x6')]['id']],_0x21d2a8?_0xa24c('0x21'):_0xa24c('0x22'));}if(!_0x21d2a8){setTimeout(this[_0xa24c('0x8')]['bind'](this),0x3e8);}};function agent(_0x70a957,_0x66f5a6,_0x2b362d,_0x1b0757){return new Agent(_0x70a957,_0x66f5a6,_0x2b362d,_0x1b0757);}module['exports']=agent;
\ No newline at end of file
+var _0x0fda=['lodash','./util','../../../../../config/logger','routing','agent','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','busy','STOP','exports'];(function(_0x216b30,_0x10e3f3){var _0x473ad0=function(_0x44f39d){while(--_0x44f39d){_0x216b30['push'](_0x216b30['shift']());}};_0x473ad0(++_0x10e3f3);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x3b8728,_0x3e87b4){_0x3b8728=_0x3b8728-0x0;var _0x404ccd=_0x0fda[_0x3b8728];return _0x404ccd;};'use strict';var _=require(_0xa0fd('0x0'));var uuid=require('uuid');var util=require(_0xa0fd('0x1'));var logger=require(_0xa0fd('0x2'))(_0xa0fd('0x3'));var Agent=function(_0x2f71f3,_0x426242,_0xd8e73a,_0x13c734){this['notificationId']=uuid['v4']();this['squeue']=_0x2f71f3;this[_0xa0fd('0x4')]=_0x426242;this['realtime']=_0xd8e73a;this['routing']=_0x13c734;this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')][_0xa0fd('0x8')](this),this['handleTimeout'][_0xa0fd('0x8')](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0x9'),this[_0xa0fd('0xa')]['bind'](this));this[_0xa0fd('0x5')]['on'](_0xa0fd('0xb'),this[_0xa0fd('0xc')]['bind'](this));};Agent[_0xa0fd('0xd')][_0xa0fd('0x6')]=function(){this[_0xa0fd('0x5')][_0xa0fd('0x6')](this[_0xa0fd('0x7')]['bind'](this),this['handleTimeout'][_0xa0fd('0x8')](this));};Agent[_0xa0fd('0xd')]['handleDrained']=function(){this[_0xa0fd('0xa')](!![]);};Agent[_0xa0fd('0xd')][_0xa0fd('0x7')]=function(){logger[_0xa0fd('0xe')](_0xa0fd('0xf'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);if(_['isNil'](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){logger['debug'](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}else{if(this[_0xa0fd('0x3')]['forcedOwnership']||util['isAgentAvailable'](this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],this[_0xa0fd('0x5')][_0xa0fd('0x13')],![])){this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']]['busy']=!![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util[_0xa0fd('0x15')](this[_0xa0fd('0x10')],this[_0xa0fd('0x3')],this[_0xa0fd('0x4')],this[_0xa0fd('0x5')][_0xa0fd('0x13')]);util[_0xa0fd('0x16')](this[_0xa0fd('0x17')],this[_0xa0fd('0x5')]['id'],this['realtime'][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],null,this['routing']);util[_0xa0fd('0x18')](this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],_0xa0fd('0x19')+(this['routing']['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xa0fd('0x1a'),this['squeue']['id'],this[_0xa0fd('0x4')]['id']);setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}}};Agent['prototype'][_0xa0fd('0xa')]=function(_0x19c352){if(_[_0xa0fd('0x1b')](this[_0xa0fd('0x10')][_0xa0fd('0x11')][this['agent']['id']])){return logger[_0xa0fd('0xe')](_0xa0fd('0x12'),this[_0xa0fd('0x5')]['id'],this[_0xa0fd('0x4')]['id']);}else{logger['debug'](_0xa0fd('0x1c'),this[_0xa0fd('0x5')]['id'],this['agent']['id']);util['hideNotification'](this['notificationId'],this[_0xa0fd('0x5')]['id'],this['realtime']['agents'][this[_0xa0fd('0x4')]['id']],null,this['routing']);this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x1d')]=![];this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']][_0xa0fd('0x14')]=undefined;util['removeWaitingNotification'](this[_0xa0fd('0x10')],this['routing'],this[_0xa0fd('0x4')],this['squeue']['channel']);util[_0xa0fd('0x18')](this['squeue']['id'],this[_0xa0fd('0x10')][_0xa0fd('0x11')][this[_0xa0fd('0x4')]['id']],_0x19c352?_0xa0fd('0x1e'):'TIMEOUT');}if(!_0x19c352){setTimeout(this[_0xa0fd('0x6')][_0xa0fd('0x8')](this),0x3e8);}};function agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2){return new Agent(_0x3b06ef,_0x3f6146,_0x2e3cfa,_0x31f1e2);}module[_0xa0fd('0x1f')]=agent;
\ No newline at end of file
index ddf8671..1deb0d7 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1e41=['Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','busyQueue','saveWaitingNotification','showNotification','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','isNil'];(function(_0x365056,_0x5afa4f){var _0x412743=function(_0x224968){while(--_0x224968){_0x365056['push'](_0x365056['shift']());}};_0x412743(++_0x5afa4f);}(_0x1e41,0x88));var _0x11e4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1e41[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var uuid=require(_0x11e4('0x0'));var util=require('./util');var logger=require(_0x11e4('0x1'))(_0x11e4('0x2'));var Beepall=function(_0x510253,_0x59db8a,_0x39b1e9,_0x4b4b45){this[_0x11e4('0x3')]=uuid['v4']();this[_0x11e4('0x4')]=_0x510253;this[_0x11e4('0x5')]=_0x59db8a;this[_0x11e4('0x6')]=_0x39b1e9;this['routing']=_0x4b4b45;this[_0x11e4('0x4')][_0x11e4('0x7')](this[_0x11e4('0x8')][_0x11e4('0x9')](this),this[_0x11e4('0xa')][_0x11e4('0x9')](this));this[_0x11e4('0x4')]['on'](_0x11e4('0xb'),this[_0x11e4('0xa')]['bind'](this));this[_0x11e4('0x4')]['on']('drained',this['handleDrained'][_0x11e4('0x9')](this));};Beepall[_0x11e4('0xc')][_0x11e4('0x7')]=function(){this[_0x11e4('0x4')][_0x11e4('0x7')](this['handleRun'][_0x11e4('0x9')](this),this[_0x11e4('0xa')]['bind'](this));};Beepall['prototype']['handleDrained']=function(){this[_0x11e4('0xa')](!![]);};Beepall[_0x11e4('0xc')][_0x11e4('0x8')]=function(){var _0x2ce123=!![];if(!_[_0x11e4('0xd')](this['queue'])&&!_[_0x11e4('0xd')](this[_0x11e4('0x5')][_0x11e4('0xe')])&&this['queue'][_0x11e4('0xe')][_0x11e4('0xf')]>0x0){for(var _0x319030=0x0,_0x525ccb;_0x319030<this[_0x11e4('0x5')][_0x11e4('0xe')][_0x11e4('0xf')];_0x319030+=0x1){_0x525ccb=this[_0x11e4('0x5')]['Agents'][_0x319030]['id'];if(_[_0x11e4('0xd')](this[_0x11e4('0x6')][_0x11e4('0x10')][_0x525ccb])){logger[_0x11e4('0x11')](_0x11e4('0x12'),this['squeue']['id'],_0x525ccb);}else{if(util['isAgentAvailable'](this[_0x11e4('0x4')]['id'],this[_0x11e4('0x6')][_0x11e4('0x10')][_0x525ccb],this[_0x11e4('0x4')][_0x11e4('0x13')],!![])){_0x2ce123=![];util[_0x11e4('0x14')](this[_0x11e4('0x4')]['id'],this['realtime']['agents'][_0x525ccb],_0x11e4('0x15'));this['realtime'][_0x11e4('0x10')][_0x525ccb][_0x11e4('0x16')]=!![];this[_0x11e4('0x6')][_0x11e4('0x10')][_0x525ccb][_0x11e4('0x17')]=this[_0x11e4('0x5')]['name'];util[_0x11e4('0x18')](this['realtime'],this[_0x11e4('0x2')],this[_0x11e4('0x5')][_0x11e4('0xe')][_0x319030],this['squeue']['channel']);util[_0x11e4('0x19')](this[_0x11e4('0x3')],this[_0x11e4('0x4')]['id'],this[_0x11e4('0x6')][_0x11e4('0x10')][_0x525ccb],this[_0x11e4('0x5')],this[_0x11e4('0x2')]);}}}if(_0x2ce123){logger[_0x11e4('0x11')]('[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY',this[_0x11e4('0x4')]['id']);setTimeout(this[_0x11e4('0x7')][_0x11e4('0x9')](this),0x3e8);}}else{logger[_0x11e4('0x11')](_0x11e4('0x1a'),this[_0x11e4('0x4')]['id']);setTimeout(this[_0x11e4('0x7')]['bind'](this),0x3e8);}};Beepall[_0x11e4('0xc')][_0x11e4('0xa')]=function(_0x4c76ff){if(!_['isNil'](this[_0x11e4('0x5')])&&!_[_0x11e4('0xd')](this[_0x11e4('0x5')][_0x11e4('0xe')])){for(var _0x190461=0x0,_0x44ea9c;_0x190461<this['queue'][_0x11e4('0xe')][_0x11e4('0xf')];_0x190461+=0x1){_0x44ea9c=this[_0x11e4('0x5')][_0x11e4('0xe')][_0x190461]['id'];if(_[_0x11e4('0xd')](this[_0x11e4('0x6')][_0x11e4('0x10')][_0x44ea9c])){logger[_0x11e4('0x11')](_0x11e4('0x12'),this[_0x11e4('0x4')]['id'],_0x44ea9c);}else{util[_0x11e4('0x1b')](this[_0x11e4('0x3')],this[_0x11e4('0x4')]['id'],this['realtime'][_0x11e4('0x10')][_0x44ea9c],this[_0x11e4('0x5')],this[_0x11e4('0x2')]);util[_0x11e4('0x14')](this[_0x11e4('0x4')]['id'],this[_0x11e4('0x6')][_0x11e4('0x10')][_0x44ea9c],_0x4c76ff?_0x11e4('0x1c'):'TIMEOUT');this[_0x11e4('0x6')][_0x11e4('0x10')][_0x44ea9c][_0x11e4('0x16')]=![];this[_0x11e4('0x6')]['agents'][_0x44ea9c][_0x11e4('0x17')]=undefined;util['removeWaitingNotification'](this[_0x11e4('0x6')],this['routing'],this['realtime'][_0x11e4('0x10')][_0x44ea9c],this['squeue'][_0x11e4('0x13')]);}}}if(!_0x4c76ff){setTimeout(this['push'][_0x11e4('0x9')](this),0x3e8);}};function beepall(_0x4e229e,_0x980ca5,_0x2b6e53,_0x19fd93){return new Beepall(_0x4e229e,_0x980ca5,_0x2b6e53,_0x19fd93);}module[_0x11e4('0x1d')]=beepall;
\ No newline at end of file
+var _0x0f4a=['lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','prototype','isNil','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','busy','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','STOP','busyQueue','removeWaitingNotification','exports'];(function(_0x8abd64,_0x539570){var _0xd2511e=function(_0x9fef7d){while(--_0x9fef7d){_0x8abd64['push'](_0x8abd64['shift']());}};_0xd2511e(++_0x539570);}(_0x0f4a,0x14a));var _0xa0f4=function(_0x43b387,_0x157deb){_0x43b387=_0x43b387-0x0;var _0x147c22=_0x0f4a[_0x43b387];return _0x147c22;};'use strict';var _=require(_0xa0f4('0x0'));var uuid=require('uuid');var util=require(_0xa0f4('0x1'));var logger=require(_0xa0f4('0x2'))(_0xa0f4('0x3'));var Beepall=function(_0x11512f,_0x216e7b,_0x30df7d,_0x5b269f){this[_0xa0f4('0x4')]=uuid['v4']();this[_0xa0f4('0x5')]=_0x11512f;this[_0xa0f4('0x6')]=_0x216e7b;this[_0xa0f4('0x7')]=_0x30df7d;this['routing']=_0x5b269f;this[_0xa0f4('0x5')][_0xa0f4('0x8')](this[_0xa0f4('0x9')][_0xa0f4('0xa')](this),this[_0xa0f4('0xb')][_0xa0f4('0xa')](this));this[_0xa0f4('0x5')]['on'](_0xa0f4('0xc'),this[_0xa0f4('0xb')][_0xa0f4('0xa')](this));this[_0xa0f4('0x5')]['on'](_0xa0f4('0xd'),this['handleDrained'][_0xa0f4('0xa')](this));};Beepall[_0xa0f4('0xe')][_0xa0f4('0x8')]=function(){this['squeue'][_0xa0f4('0x8')](this['handleRun'][_0xa0f4('0xa')](this),this[_0xa0f4('0xb')][_0xa0f4('0xa')](this));};Beepall['prototype']['handleDrained']=function(){this[_0xa0f4('0xb')](!![]);};Beepall['prototype'][_0xa0f4('0x9')]=function(){var _0x4079b1=!![];if(!_[_0xa0f4('0xf')](this[_0xa0f4('0x6')])&&!_[_0xa0f4('0xf')](this[_0xa0f4('0x6')][_0xa0f4('0x10')])&&this[_0xa0f4('0x6')][_0xa0f4('0x10')][_0xa0f4('0x11')]>0x0){for(var _0x541f8e=0x0,_0xb5d8c;_0x541f8e<this[_0xa0f4('0x6')][_0xa0f4('0x10')][_0xa0f4('0x11')];_0x541f8e+=0x1){_0xb5d8c=this['queue']['Agents'][_0x541f8e]['id'];if(_['isNil'](this[_0xa0f4('0x7')][_0xa0f4('0x12')][_0xb5d8c])){logger[_0xa0f4('0x13')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],_0xb5d8c);}else{if(util[_0xa0f4('0x14')](this[_0xa0f4('0x5')]['id'],this[_0xa0f4('0x7')]['agents'][_0xb5d8c],this[_0xa0f4('0x5')][_0xa0f4('0x15')],!![])){_0x4079b1=![];util[_0xa0f4('0x16')](this[_0xa0f4('0x5')]['id'],this[_0xa0f4('0x7')]['agents'][_0xb5d8c],'RINGING');this['realtime'][_0xa0f4('0x12')][_0xb5d8c][_0xa0f4('0x17')]=!![];this['realtime'][_0xa0f4('0x12')][_0xb5d8c]['busyQueue']=this['queue'][_0xa0f4('0x18')];util['saveWaitingNotification'](this[_0xa0f4('0x7')],this['routing'],this[_0xa0f4('0x6')][_0xa0f4('0x10')][_0x541f8e],this['squeue'][_0xa0f4('0x15')]);util[_0xa0f4('0x19')](this[_0xa0f4('0x4')],this['squeue']['id'],this['realtime'][_0xa0f4('0x12')][_0xb5d8c],this[_0xa0f4('0x6')],this['routing']);}}}if(_0x4079b1){logger[_0xa0f4('0x13')](_0xa0f4('0x1a'),this['squeue']['id']);setTimeout(this[_0xa0f4('0x8')]['bind'](this),0x3e8);}}else{logger[_0xa0f4('0x13')](_0xa0f4('0x1b'),this['squeue']['id']);setTimeout(this[_0xa0f4('0x8')][_0xa0f4('0xa')](this),0x3e8);}};Beepall[_0xa0f4('0xe')][_0xa0f4('0xb')]=function(_0x5f2de6){if(!_[_0xa0f4('0xf')](this[_0xa0f4('0x6')])&&!_['isNil'](this[_0xa0f4('0x6')][_0xa0f4('0x10')])){for(var _0x2b26a7=0x0,_0x2d72dc;_0x2b26a7<this['queue'][_0xa0f4('0x10')]['length'];_0x2b26a7+=0x1){_0x2d72dc=this[_0xa0f4('0x6')][_0xa0f4('0x10')][_0x2b26a7]['id'];if(_[_0xa0f4('0xf')](this['realtime'][_0xa0f4('0x12')][_0x2d72dc])){logger[_0xa0f4('0x13')](_0xa0f4('0x1c'),this[_0xa0f4('0x5')]['id'],_0x2d72dc);}else{util['hideNotification'](this[_0xa0f4('0x4')],this[_0xa0f4('0x5')]['id'],this[_0xa0f4('0x7')][_0xa0f4('0x12')][_0x2d72dc],this[_0xa0f4('0x6')],this[_0xa0f4('0x3')]);util[_0xa0f4('0x16')](this[_0xa0f4('0x5')]['id'],this[_0xa0f4('0x7')][_0xa0f4('0x12')][_0x2d72dc],_0x5f2de6?_0xa0f4('0x1d'):'TIMEOUT');this['realtime'][_0xa0f4('0x12')][_0x2d72dc][_0xa0f4('0x17')]=![];this[_0xa0f4('0x7')]['agents'][_0x2d72dc][_0xa0f4('0x1e')]=undefined;util[_0xa0f4('0x1f')](this['realtime'],this[_0xa0f4('0x3')],this[_0xa0f4('0x7')][_0xa0f4('0x12')][_0x2d72dc],this[_0xa0f4('0x5')][_0xa0f4('0x15')]);}}}if(!_0x5f2de6){setTimeout(this[_0xa0f4('0x8')][_0xa0f4('0xa')](this),0x3e8);}};function beepall(_0x5e672e,_0x2777f3,_0x36ea2f,_0xf91a3b){return new Beepall(_0x5e672e,_0x2777f3,_0x36ea2f,_0xf91a3b);}module[_0xa0f4('0x20')]=beepall;
\ No newline at end of file
index 9d97cb4..fa707de 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6c89=['./agent','./beepall'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x6c89,0x8b));var _0x96c8=function(_0x2ba3c3,_0x48e35e){_0x2ba3c3=_0x2ba3c3-0x0;var _0x148c40=_0x6c89[_0x2ba3c3];return _0x148c40;};'use strict';module['exports']={'rrmemory':require('./rrmemory'),'beepall':require(_0x96c8('0x0')),'agent':require(_0x96c8('0x1'))};
\ No newline at end of file
+var _0xf71c=['./rrmemory','./beepall'];(function(_0x1970ea,_0x515084){var _0x9e0bdf=function(_0x1b7014){while(--_0x1b7014){_0x1970ea['push'](_0x1970ea['shift']());}};_0x9e0bdf(++_0x515084);}(_0xf71c,0x150));var _0xcf71=function(_0x2f54e8,_0x160806){_0x2f54e8=_0x2f54e8-0x0;var _0x52df8a=_0xf71c[_0x2f54e8];return _0x52df8a;};'use strict';module['exports']={'rrmemory':require(_0xcf71('0x0')),'beepall':require(_0xcf71('0x1')),'agent':require('./agent')};
\ No newline at end of file
index 73fb4d0..be76887 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8e91=['intervals','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','handleCheckReject','isAgentAvailable','agentId','[%s][QUEUE]\x20available\x20again\x20%s','mapAgentsId','debug','[%s][QUEUE]\x20try\x20with\x20%s','isNil','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','busy','busyQueue','name','saveWaitingNotification','showNotification','notificationId','writeLog','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','done','[%s][QUEUE]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','routing','queue','realtime'];(function(_0x59b48b,_0x584733){var _0x4c3f79=function(_0x3f2e94){while(--_0x3f2e94){_0x59b48b['push'](_0x59b48b['shift']());}};_0x4c3f79(++_0x584733);}(_0x8e91,0x1a8));var _0x18e9=function(_0x45bf86,_0x75586e){_0x45bf86=_0x45bf86-0x0;var _0x1f02b7=_0x8e91[_0x45bf86];return _0x1f02b7;};'use strict';var rr=require('rr');var _=require(_0x18e9('0x0'));var uuid=require(_0x18e9('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0x18e9('0x2'));var RRMemory=function(_0x47362d,_0x15a630,_0x17ba34,_0x454cde){this['notificationId']=uuid['v4']();this['squeue']=_0x47362d;this[_0x18e9('0x3')]=_0x15a630;this[_0x18e9('0x4')]=_0x17ba34;this[_0x18e9('0x2')]=_0x454cde;this[_0x18e9('0x5')]={};this[_0x18e9('0x6')][_0x18e9('0x7')](this[_0x18e9('0x8')][_0x18e9('0x9')](this),this[_0x18e9('0xa')][_0x18e9('0x9')](this),this['module']);this['squeue']['on']('timeout',this['handleTimeout'][_0x18e9('0x9')](this));this[_0x18e9('0x6')]['on'](_0x18e9('0xb'),this[_0x18e9('0xc')][_0x18e9('0x9')](this));};RRMemory[_0x18e9('0xd')][_0x18e9('0x7')]=function(){this[_0x18e9('0x6')][_0x18e9('0x7')](this[_0x18e9('0x8')][_0x18e9('0x9')](this),this[_0x18e9('0xa')]['bind'](this));};RRMemory['prototype']['handleDrained']=function(){this[_0x18e9('0xa')](!![]);};RRMemory[_0x18e9('0xd')][_0x18e9('0xe')]=function(_0x45cd9a){if(util[_0x18e9('0xf')](this['squeue']['id'],this[_0x18e9('0x4')]['agents'][this[_0x18e9('0x10')]],this[_0x18e9('0x6')]['channel'],!![])){logger['debug'](_0x18e9('0x11'),this[_0x18e9('0x6')]['id'],this[_0x18e9('0x10')]);clearInterval(this[_0x18e9('0x5')][this['agentId']]);_0x45cd9a['done']();setTimeout(this[_0x18e9('0x7')][_0x18e9('0x9')](this),0x3e8);}};RRMemory['prototype'][_0x18e9('0x8')]=function(_0x1bc97a){this['agentId']=rr(this[_0x18e9('0x3')][_0x18e9('0x12')]);logger[_0x18e9('0x13')](_0x18e9('0x14'),this[_0x18e9('0x6')]['id'],this['agentId']);if(_[_0x18e9('0x15')](this[_0x18e9('0x4')][_0x18e9('0x16')][this[_0x18e9('0x10')]])){logger[_0x18e9('0x13')](_0x18e9('0x17'),this['squeue']['id'],this['agentId']);_0x1bc97a['done']();setTimeout(this[_0x18e9('0x7')][_0x18e9('0x9')](this),0x3e8);}else{if(util[_0x18e9('0xf')](this[_0x18e9('0x6')]['id'],this['realtime'][_0x18e9('0x16')][this[_0x18e9('0x10')]],this['squeue'][_0x18e9('0x18')],!![])){this[_0x18e9('0x4')][_0x18e9('0x16')][this[_0x18e9('0x10')]][_0x18e9('0x19')]=!![];this[_0x18e9('0x4')][_0x18e9('0x16')][this[_0x18e9('0x10')]][_0x18e9('0x1a')]=this[_0x18e9('0x3')][_0x18e9('0x1b')];util[_0x18e9('0x1c')](this['realtime'],this[_0x18e9('0x2')],this[_0x18e9('0x4')][_0x18e9('0x16')][this[_0x18e9('0x10')]],this['squeue'][_0x18e9('0x18')]);util[_0x18e9('0x1d')](this[_0x18e9('0x1e')],this[_0x18e9('0x6')]['id'],this[_0x18e9('0x4')]['agents'][this[_0x18e9('0x10')]],this[_0x18e9('0x3')],this['routing']);util[_0x18e9('0x1f')](this[_0x18e9('0x6')]['id'],this[_0x18e9('0x4')][_0x18e9('0x16')][this[_0x18e9('0x10')]],'RINGING');this[_0x18e9('0x5')][this[_0x18e9('0x10')]]=setInterval(this[_0x18e9('0xe')][_0x18e9('0x9')](this,_0x1bc97a),0x3e8);}else{logger[_0x18e9('0x13')](_0x18e9('0x20'),this[_0x18e9('0x6')]['id'],this[_0x18e9('0x10')]);_0x1bc97a[_0x18e9('0x21')]();setTimeout(this[_0x18e9('0x7')][_0x18e9('0x9')](this),0x3e8);}}};RRMemory[_0x18e9('0xd')][_0x18e9('0xa')]=function(_0x31062c){logger['debug'](_0x18e9('0x22'),this[_0x18e9('0x6')]['id'],this[_0x18e9('0x10')]);if(_[_0x18e9('0x15')](this[_0x18e9('0x4')][_0x18e9('0x16')][this[_0x18e9('0x10')]])){logger[_0x18e9('0x13')](_0x18e9('0x17'),this[_0x18e9('0x6')]['id'],this['agentId']);}else{clearInterval(this['intervals'][this[_0x18e9('0x10')]]);util[_0x18e9('0x23')](this[_0x18e9('0x1e')],this['squeue']['id'],this[_0x18e9('0x4')]['agents'][this[_0x18e9('0x10')]],this[_0x18e9('0x3')],this[_0x18e9('0x2')]);util[_0x18e9('0x1f')](this[_0x18e9('0x6')]['id'],this[_0x18e9('0x4')][_0x18e9('0x16')][this[_0x18e9('0x10')]],_0x18e9('0x24'));this[_0x18e9('0x4')][_0x18e9('0x16')][this['agentId']][_0x18e9('0x19')]=![];this['realtime'][_0x18e9('0x16')][this[_0x18e9('0x10')]][_0x18e9('0x1a')]=undefined;util[_0x18e9('0x25')](this[_0x18e9('0x4')],this['routing'],this[_0x18e9('0x4')][_0x18e9('0x16')][this[_0x18e9('0x10')]],this[_0x18e9('0x6')][_0x18e9('0x18')]);}if(!_0x31062c){setTimeout(this[_0x18e9('0x7')][_0x18e9('0x9')](this),0x3e8);}};function rrmemory(_0x2828ee,_0x2c8901,_0x4b5f66,_0x3ccfc4){return new RRMemory(_0x2828ee,_0x2c8901,_0x4b5f66,_0x3ccfc4);}module[_0x18e9('0x26')]=rrmemory;
\ No newline at end of file
+var _0xff1d=['lodash','uuid','./util','routing','notificationId','squeue','queue','realtime','handleRun','bind','handleTimeout','module','handleDrained','push','prototype','handleCheckReject','debug','agentId','intervals','done','mapAgentsId','agents','busy','busyQueue','name','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','[%s][QUEUE]\x20timeout\x20with\x20%s','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','removeWaitingNotification','exports'];(function(_0x720509,_0x3b0711){var _0xf39d77=function(_0x513ce7){while(--_0x513ce7){_0x720509['push'](_0x720509['shift']());}};_0xf39d77(++_0x3b0711);}(_0xff1d,0x197));var _0xdff1=function(_0x3d1520,_0x4a74df){_0x3d1520=_0x3d1520-0x0;var _0x177de7=_0xff1d[_0x3d1520];return _0x177de7;};'use strict';var rr=require('rr');var _=require(_0xdff1('0x0'));var uuid=require(_0xdff1('0x1'));var util=require(_0xdff1('0x2'));var logger=require('../../../../../config/logger')(_0xdff1('0x3'));var RRMemory=function(_0x40fb18,_0x3a7ba9,_0x271a82,_0x29ee9f){this[_0xdff1('0x4')]=uuid['v4']();this[_0xdff1('0x5')]=_0x40fb18;this[_0xdff1('0x6')]=_0x3a7ba9;this[_0xdff1('0x7')]=_0x271a82;this[_0xdff1('0x3')]=_0x29ee9f;this['intervals']={};this['squeue']['push'](this[_0xdff1('0x8')][_0xdff1('0x9')](this),this[_0xdff1('0xa')][_0xdff1('0x9')](this),this[_0xdff1('0xb')]);this['squeue']['on']('timeout',this[_0xdff1('0xa')][_0xdff1('0x9')](this));this[_0xdff1('0x5')]['on']('drained',this[_0xdff1('0xc')][_0xdff1('0x9')](this));};RRMemory['prototype'][_0xdff1('0xd')]=function(){this[_0xdff1('0x5')][_0xdff1('0xd')](this['handleRun'][_0xdff1('0x9')](this),this[_0xdff1('0xa')][_0xdff1('0x9')](this));};RRMemory['prototype'][_0xdff1('0xc')]=function(){this[_0xdff1('0xa')](!![]);};RRMemory[_0xdff1('0xe')][_0xdff1('0xf')]=function(_0x1742de){if(util['isAgentAvailable'](this[_0xdff1('0x5')]['id'],this['realtime']['agents'][this['agentId']],this[_0xdff1('0x5')]['channel'],!![])){logger[_0xdff1('0x10')]('[%s][QUEUE]\x20available\x20again\x20%s',this[_0xdff1('0x5')]['id'],this[_0xdff1('0x11')]);clearInterval(this[_0xdff1('0x12')][this[_0xdff1('0x11')]]);_0x1742de[_0xdff1('0x13')]();setTimeout(this[_0xdff1('0xd')]['bind'](this),0x3e8);}};RRMemory['prototype'][_0xdff1('0x8')]=function(_0x4f5326){this[_0xdff1('0x11')]=rr(this[_0xdff1('0x6')][_0xdff1('0x14')]);logger['debug']('[%s][QUEUE]\x20try\x20with\x20%s',this[_0xdff1('0x5')]['id'],this['agentId']);if(_['isNil'](this[_0xdff1('0x7')]['agents'][this['agentId']])){logger['debug']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xdff1('0x5')]['id'],this[_0xdff1('0x11')]);_0x4f5326[_0xdff1('0x13')]();setTimeout(this[_0xdff1('0xd')]['bind'](this),0x3e8);}else{if(util['isAgentAvailable'](this[_0xdff1('0x5')]['id'],this['realtime'][_0xdff1('0x15')][this['agentId']],this[_0xdff1('0x5')]['channel'],!![])){this[_0xdff1('0x7')][_0xdff1('0x15')][this['agentId']][_0xdff1('0x16')]=!![];this['realtime'][_0xdff1('0x15')][this[_0xdff1('0x11')]][_0xdff1('0x17')]=this[_0xdff1('0x6')][_0xdff1('0x18')];util[_0xdff1('0x19')](this[_0xdff1('0x7')],this[_0xdff1('0x3')],this['realtime'][_0xdff1('0x15')][this[_0xdff1('0x11')]],this[_0xdff1('0x5')][_0xdff1('0x1a')]);util[_0xdff1('0x1b')](this[_0xdff1('0x4')],this[_0xdff1('0x5')]['id'],this[_0xdff1('0x7')]['agents'][this[_0xdff1('0x11')]],this[_0xdff1('0x6')],this[_0xdff1('0x3')]);util[_0xdff1('0x1c')](this[_0xdff1('0x5')]['id'],this[_0xdff1('0x7')][_0xdff1('0x15')][this[_0xdff1('0x11')]],_0xdff1('0x1d'));this[_0xdff1('0x12')][this[_0xdff1('0x11')]]=setInterval(this[_0xdff1('0xf')][_0xdff1('0x9')](this,_0x4f5326),0x3e8);}else{logger[_0xdff1('0x10')](_0xdff1('0x1e'),this[_0xdff1('0x5')]['id'],this['agentId']);_0x4f5326[_0xdff1('0x13')]();setTimeout(this[_0xdff1('0xd')][_0xdff1('0x9')](this),0x3e8);}}};RRMemory[_0xdff1('0xe')][_0xdff1('0xa')]=function(_0x41c6ef){logger[_0xdff1('0x10')](_0xdff1('0x1f'),this[_0xdff1('0x5')]['id'],this[_0xdff1('0x11')]);if(_['isNil'](this[_0xdff1('0x7')][_0xdff1('0x15')][this['agentId']])){logger[_0xdff1('0x10')](_0xdff1('0x20'),this[_0xdff1('0x5')]['id'],this[_0xdff1('0x11')]);}else{clearInterval(this[_0xdff1('0x12')][this[_0xdff1('0x11')]]);util[_0xdff1('0x21')](this[_0xdff1('0x4')],this[_0xdff1('0x5')]['id'],this['realtime'][_0xdff1('0x15')][this[_0xdff1('0x11')]],this['queue'],this[_0xdff1('0x3')]);util[_0xdff1('0x1c')](this[_0xdff1('0x5')]['id'],this[_0xdff1('0x7')][_0xdff1('0x15')][this[_0xdff1('0x11')]],_0xdff1('0x22'));this[_0xdff1('0x7')][_0xdff1('0x15')][this[_0xdff1('0x11')]][_0xdff1('0x16')]=![];this[_0xdff1('0x7')]['agents'][this['agentId']]['busyQueue']=undefined;util[_0xdff1('0x23')](this[_0xdff1('0x7')],this['routing'],this[_0xdff1('0x7')]['agents'][this[_0xdff1('0x11')]],this['squeue']['channel']);}if(!_0x41c6ef){setTimeout(this[_0xdff1('0xd')][_0xdff1('0x9')](this),0x3e8);}};function rrmemory(_0x2bb556,_0x180e4f,_0x32ef47,_0x1d55c8){return new RRMemory(_0x2bb556,_0x180e4f,_0x32ef47,_0x1d55c8);}module[_0xdff1('0x24')]=rrmemory;
\ No newline at end of file
index 4146468..0e48651 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb0cf=['format','[%s][QUEUE]\x20%s','message','user:%s','emit','notification:%s','save','remove','debug','isAgentAvailable','busy','BUSY','online','Pause','PAUSE','hasOwnProperty','CurrentCapacity','Capacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','UserId','some','capitalize','agents','channel','WaitingInteractions','interaction','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','redis','split','\x20interaction','name','notificationSound','account','notificationShake','queue','body','msg','getMustacheRender','notificationTemplate','error'];(function(_0xdf6cfb,_0x4ddfdc){var _0x23a668=function(_0x3b0c0e){while(--_0x3b0c0e){_0xdf6cfb['push'](_0xdf6cfb['shift']());}};_0x23a668(++_0x4ddfdc);}(_0xb0cf,0xc3));var _0xfb0c=function(_0x4fa2c8,_0x23227d){_0x4fa2c8=_0x4fa2c8-0x0;var _0x5bc5e9=_0xb0cf[_0x4fa2c8];return _0x5bc5e9;};'use strict';var _=require(_0xfb0c('0x0'));var util=require(_0xfb0c('0x1'));var utils=require(_0xfb0c('0x2'));var Redis=require(_0xfb0c('0x3'));var config=require(_0xfb0c('0x4'));var logger=require(_0xfb0c('0x5'))(_0xfb0c('0x6'));config['redis']=_[_0xfb0c('0x7')](config[_0xfb0c('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xfb0c('0x8')]));function sendNotification(_0x53f161,_0x3742ef,_0x381120,_0x130370,_0x974d28,_0x107858){var _0x50e329=_0x107858||{};var _0x137ed9=_0x381120[_0xfb0c('0x9')]('.');var _0x2f46f1={'uniqueid':_0x3742ef,'channel':_0x137ed9[0x0],'id':_0x137ed9[0x1],'title':_0x137ed9[0x0]+_0xfb0c('0xa'),'interactionId':_0x137ed9[0x2],'queue':_0x974d28?_0x974d28[_0xfb0c('0xb')]:null,'sound':_0x50e329['account'][_0xfb0c('0xc')],'shake':_0x50e329[_0xfb0c('0xd')][_0xfb0c('0xe')]};try{if(!_0x50e329['body']){_0x50e329['body']={};}if(_0x974d28){_0x50e329['body'][_0xfb0c('0xf')]=_0x974d28;}else if(_0x50e329[_0xfb0c('0x10')][_0xfb0c('0xf')]){delete _0x50e329['body'][_0xfb0c('0xf')];}_0x2f46f1[_0xfb0c('0x11')]=utils[_0xfb0c('0x12')](_0x50e329[_0xfb0c('0xd')][_0xfb0c('0x13')],_0x50e329);}catch(_0x4960f9){_0x2f46f1[_0xfb0c('0x11')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xfb0c('0x14')](util[_0xfb0c('0x15')](_0xfb0c('0x16'),_0x3742ef,_0x4960f9[_0xfb0c('0x17')]));}io['to'](util[_0xfb0c('0x15')](_0xfb0c('0x18'),_0x130370[_0xfb0c('0xb')]))[_0xfb0c('0x19')](util[_0xfb0c('0x15')](_0xfb0c('0x1a'),_0x53f161?_0xfb0c('0x1b'):_0xfb0c('0x1c')),_0x2f46f1);}function writeLog(_0x1b66ed,_0x576cd1,_0x2cdfba){return logger[_0xfb0c('0x1d')](util['format']('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x1b66ed,_0x576cd1[_0xfb0c('0xb')],_0x2cdfba));}exports[_0xfb0c('0x1e')]=function(_0x4206ea,_0x110659,_0x187378,_0x1bf94d){if(_0x110659[_0xfb0c('0x1f')]){writeLog(_0x4206ea,_0x110659,_0xfb0c('0x20'));return![];}if(!_0x110659[_0xfb0c('0x21')]){writeLog(_0x4206ea,_0x110659,'OFFLINE');return![];}if(_0x110659[_0x187378+_0xfb0c('0x22')]){writeLog(_0x4206ea,_0x110659,_0xfb0c('0x23'));return![];}if(_0x1bf94d&&_0x110659[_0xfb0c('0x24')](_0x187378+'Capacity')&&_0x110659['hasOwnProperty'](_0x187378+_0xfb0c('0x25'))){if(_0x110659[_0x187378+_0xfb0c('0x26')]>0x0&&_0x110659[_0x187378+_0xfb0c('0x25')]>=_0x110659[_0x187378+_0xfb0c('0x26')]){writeLog(_0x4206ea,_0x110659,_0x187378[_0xfb0c('0x27')]()+_0xfb0c('0x28'));return![];}}return!![];};exports[_0xfb0c('0x29')]=function(_0x17ac8f,_0x338b0b,_0x2509ef,_0x2fbc59,_0x2f8fbf){return sendNotification(!![],_0x17ac8f,_0x338b0b,_0x2509ef,_0x2fbc59,_0x2f8fbf);};exports[_0xfb0c('0x2a')]=function(_0x5d9d48,_0x105969,_0x2165d3,_0x27a46b,_0x33e927){return sendNotification(![],_0x5d9d48,_0x105969,_0x2165d3,_0x27a46b,_0x33e927);};exports[_0xfb0c('0x2b')]=function(_0x163341,_0x4df9be,_0x368e24){var _0x43459f=_0x4df9be['interaction'][_0xfb0c('0x2c')];if(!_0x43459f&&_0x368e24){_0x43459f=_0x368e24['id'];}var _0x3a8db5=_[_0xfb0c('0x2d')](_0x163341[_0x4df9be['channel']+'QueuesWaitingInteractions'],function(_0x443862){var _0x41cfbd=_[_0xfb0c('0x2e')](_0x4df9be['channel'])+'InteractionId';return _0x443862[_0x41cfbd]===_0x4df9be['interaction']['id'];});if(!_0x3a8db5&&_0x43459f&&_0x163341[_0xfb0c('0x2f')][_0x43459f]){_0x3a8db5=_['some'](_0x163341['agents'][_0x43459f][_0x4df9be[_0xfb0c('0x30')]+_0xfb0c('0x31')],function(_0xd17ad5){return _0xd17ad5['id']===_0x4df9be[_0xfb0c('0x32')]['id'];});}return _0x3a8db5;};exports[_0xfb0c('0x33')]=function(_0x419c3d,_0x5232e6,_0x207932,_0x33b8c1){if(_0x207932&&_0x207932['id']&&_0x419c3d[_0xfb0c('0x2f')]&&_0x419c3d[_0xfb0c('0x2f')][_0x207932['id']]){_0x419c3d['agents'][_0x207932['id']][_0x33b8c1+_0xfb0c('0x31')][_0x5232e6[_0xfb0c('0x17')]['id']]={'id':_0x5232e6[_0xfb0c('0x32')]['id']};}};exports[_0xfb0c('0x34')]=function(_0x1aa580,_0x3e73b4,_0x4c7c61,_0x2e1db7){if(_0x4c7c61&&_0x4c7c61['id']&&_0x1aa580['agents']&&_0x1aa580[_0xfb0c('0x2f')][_0x4c7c61['id']]){delete _0x1aa580[_0xfb0c('0x2f')][_0x4c7c61['id']][_0x2e1db7+'WaitingInteractions'][_0x3e73b4[_0xfb0c('0x17')]['id']];}};exports[_0xfb0c('0x35')]=writeLog;
\ No newline at end of file
+var _0x4732=['user:%s','name','emit','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','channel','QueuesWaitingInteractions','capitalize','agents','some','saveWaitingNotification','WaitingInteractions','removeWaitingNotification','message','writeLog','lodash','../utils','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','split','\x20interaction','account','notificationSound','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s'];(function(_0x118a0c,_0x29da08){var _0x3dd3c4=function(_0x581793){while(--_0x581793){_0x118a0c['push'](_0x118a0c['shift']());}};_0x3dd3c4(++_0x29da08);}(_0x4732,0x17d));var _0x2473=function(_0x2c6fb9,_0xc7d7c0){_0x2c6fb9=_0x2c6fb9-0x0;var _0x49fd5e=_0x4732[_0x2c6fb9];return _0x49fd5e;};'use strict';var _=require(_0x2473('0x0'));var util=require('util');var utils=require(_0x2473('0x1'));var Redis=require('ioredis');var config=require(_0x2473('0x2'));var logger=require(_0x2473('0x3'))(_0x2473('0x4'));config[_0x2473('0x5')]=_[_0x2473('0x6')](config[_0x2473('0x5')],{'host':_0x2473('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2473('0x5')]));function sendNotification(_0x442204,_0x50e340,_0x4be81c,_0x593eba,_0x10da0a,_0x29765a){var _0x13e2a0=_0x29765a||{};var _0x194c00=_0x4be81c[_0x2473('0x8')]('.');var _0x4900a5={'uniqueid':_0x50e340,'channel':_0x194c00[0x0],'id':_0x194c00[0x1],'title':_0x194c00[0x0]+_0x2473('0x9'),'interactionId':_0x194c00[0x2],'queue':_0x10da0a?_0x10da0a['name']:null,'sound':_0x13e2a0[_0x2473('0xa')][_0x2473('0xb')],'shake':_0x13e2a0['account']['notificationShake']};try{if(!_0x13e2a0[_0x2473('0xc')]){_0x13e2a0[_0x2473('0xc')]={};}if(_0x10da0a){_0x13e2a0[_0x2473('0xc')][_0x2473('0xd')]=_0x10da0a;}else if(_0x13e2a0['body'][_0x2473('0xd')]){delete _0x13e2a0[_0x2473('0xc')][_0x2473('0xd')];}_0x4900a5[_0x2473('0xe')]=utils['getMustacheRender'](_0x13e2a0['account']['notificationTemplate'],_0x13e2a0);}catch(_0x2737b6){_0x4900a5[_0x2473('0xe')]=_0x2473('0xf');logger[_0x2473('0x10')](util[_0x2473('0x11')](_0x2473('0x12'),_0x50e340,_0x2737b6['message']));}io['to'](util[_0x2473('0x11')](_0x2473('0x13'),_0x593eba[_0x2473('0x14')]))[_0x2473('0x15')](util[_0x2473('0x11')](_0x2473('0x16'),_0x442204?_0x2473('0x17'):'remove'),_0x4900a5);}function writeLog(_0x2dcaf1,_0x3c5b55,_0x31de9b){return logger[_0x2473('0x18')](util[_0x2473('0x11')](_0x2473('0x19'),_0x2dcaf1,_0x3c5b55[_0x2473('0x14')],_0x31de9b));}exports['isAgentAvailable']=function(_0x398ddc,_0x3a8111,_0xc4b4d3,_0x485a52){if(_0x3a8111[_0x2473('0x1a')]){writeLog(_0x398ddc,_0x3a8111,_0x2473('0x1b'));return![];}if(!_0x3a8111[_0x2473('0x1c')]){writeLog(_0x398ddc,_0x3a8111,'OFFLINE');return![];}if(_0x3a8111[_0xc4b4d3+_0x2473('0x1d')]){writeLog(_0x398ddc,_0x3a8111,_0x2473('0x1e'));return![];}if(_0x485a52&&_0x3a8111['hasOwnProperty'](_0xc4b4d3+_0x2473('0x1f'))&&_0x3a8111[_0x2473('0x20')](_0xc4b4d3+_0x2473('0x21'))){if(_0x3a8111[_0xc4b4d3+_0x2473('0x1f')]>0x0&&_0x3a8111[_0xc4b4d3+'CurrentCapacity']>=_0x3a8111[_0xc4b4d3+'Capacity']){writeLog(_0x398ddc,_0x3a8111,_0xc4b4d3[_0x2473('0x22')]()+_0x2473('0x23'));return![];}}return!![];};exports[_0x2473('0x24')]=function(_0x3c4df9,_0x2d5e60,_0x803ab8,_0x41ec99,_0x41cc48){return sendNotification(!![],_0x3c4df9,_0x2d5e60,_0x803ab8,_0x41ec99,_0x41cc48);};exports[_0x2473('0x25')]=function(_0x5d9aaf,_0x26fb45,_0x12b146,_0x4d4359,_0x2cfda0){return sendNotification(![],_0x5d9aaf,_0x26fb45,_0x12b146,_0x4d4359,_0x2cfda0);};exports[_0x2473('0x26')]=function(_0x15b311,_0x5f1896,_0x433e9d){var _0x29444d=_0x5f1896[_0x2473('0x27')]['UserId'];if(!_0x29444d&&_0x433e9d){_0x29444d=_0x433e9d['id'];}var _0x249afb=_['some'](_0x15b311[_0x5f1896[_0x2473('0x28')]+_0x2473('0x29')],function(_0x5595d6){var _0x46c595=_[_0x2473('0x2a')](_0x5f1896['channel'])+'InteractionId';return _0x5595d6[_0x46c595]===_0x5f1896[_0x2473('0x27')]['id'];});if(!_0x249afb&&_0x29444d&&_0x15b311[_0x2473('0x2b')][_0x29444d]){_0x249afb=_[_0x2473('0x2c')](_0x15b311[_0x2473('0x2b')][_0x29444d][_0x5f1896[_0x2473('0x28')]+'WaitingInteractions'],function(_0x24bc61){return _0x24bc61['id']===_0x5f1896[_0x2473('0x27')]['id'];});}return _0x249afb;};exports[_0x2473('0x2d')]=function(_0xf518b9,_0x18eb56,_0x286ce1,_0x1fffb5){if(_0x286ce1&&_0x286ce1['id']&&_0xf518b9['agents']&&_0xf518b9[_0x2473('0x2b')][_0x286ce1['id']]){_0xf518b9[_0x2473('0x2b')][_0x286ce1['id']][_0x1fffb5+_0x2473('0x2e')][_0x18eb56['message']['id']]={'id':_0x18eb56[_0x2473('0x27')]['id']};}};exports[_0x2473('0x2f')]=function(_0x3314ae,_0x5b2581,_0x2fbfa3,_0x439b57){if(_0x2fbfa3&&_0x2fbfa3['id']&&_0x3314ae[_0x2473('0x2b')]&&_0x3314ae[_0x2473('0x2b')][_0x2fbfa3['id']]){delete _0x3314ae[_0x2473('0x2b')][_0x2fbfa3['id']][_0x439b57+'WaitingInteractions'][_0x5b2581[_0x2473('0x30')]['id']];}};exports[_0x2473('0x31')]=writeLog;
\ No newline at end of file
index 87308e4..c0c080a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x009f=['string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','body','isObject','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','validate','shelljs','lodash','../../../../config/logger'];(function(_0x307022,_0x3a7b4f){var _0x535534=function(_0x1ca7a5){while(--_0x1ca7a5){_0x307022['push'](_0x307022['shift']());}};_0x535534(++_0x3a7b4f);}(_0x009f,0x194));var _0xf009=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x009f[_0x247fa1];return _0x244f35;};'use strict';var schema=require(_0xf009('0x0'));var sh=require(_0xf009('0x1'));var _=require(_0xf009('0x2'));var utils=require('./utils');var logger=require(_0xf009('0x3'))('routing');var system=schema({'command':{'type':_0xf009('0x4'),'required':!![],'message':_0xf009('0x5')}});exports[_0xf009('0x6')]=function(_0x22ecc5,_0x555a03){return function(_0x2d73b0){try{var _0x42e0ea={'command':_0x555a03[0x0]};var _0xad16ce=system[_0xf009('0x0')](_0x42e0ea,{'typecast':!![]});if(_0xad16ce[_0xf009('0x7')]){logger[_0xf009('0x8')](_0xf009('0x9'),_0x22ecc5,_[_0xf009('0xa')](_0xad16ce,_0xf009('0xb'))['join'](',\x20'));logger[_0xf009('0xc')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x22ecc5);_0x2d73b0[_0xf009('0xd')]();}else{var _0x175804=this;var _0x1798cf=utils[_0xf009('0xe')](_0x555a03[0x0],this);logger['info'](_0xf009('0xf'),_0x22ecc5,_0x1798cf);sh[_0xf009('0x10')](_[_0xf009('0x11')](_0x1798cf),function(_0x530883,_0x59a67b){logger[_0xf009('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x22ecc5,_0x530883);if(_0x530883==0x0){var _0x3f4f26=_0x59a67b['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xf009('0x12')](_0x555a03[0x1])||_[_0xf009('0x13')](_0x555a03[0x1])){logger[_0xf009('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x22ecc5);_0x175804['body'][_0x555a03[0x1]]=_0x3f4f26;}else{logger[_0xf009('0xc')](_0xf009('0x14'),_0x22ecc5,_0x555a03[0x1],_0x3f4f26);_0x175804[_0xf009('0x15')][_0x555a03[0x1]]=_0x3f4f26;}}_0x2d73b0[_0xf009('0xd')]();});}}catch(_0xfe12e9){logger[_0xf009('0x8')](_0xf009('0x9'),_0x22ecc5,_[_0xf009('0x16')](_0xfe12e9)?JSON['stringify'](_0xfe12e9):_0xfe12e9);logger[_0xf009('0xc')](_0xf009('0x17'),_0x22ecc5);_0x2d73b0[_0xf009('0xd')]();}};};
\ No newline at end of file
+var _0x6a27=['message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','validate','shelljs','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map'];(function(_0x5b9c66,_0x2149db){var _0x475b71=function(_0x278b7a){while(--_0x278b7a){_0x5b9c66['push'](_0x5b9c66['shift']());}};_0x475b71(++_0x2149db);}(_0x6a27,0x152));var _0x76a2=function(_0x568177,_0x5b31dc){_0x568177=_0x568177-0x0;var _0x5c1dd0=_0x6a27[_0x568177];return _0x5c1dd0;};'use strict';var schema=require(_0x76a2('0x0'));var sh=require(_0x76a2('0x1'));var _=require(_0x76a2('0x2'));var utils=require(_0x76a2('0x3'));var logger=require(_0x76a2('0x4'))(_0x76a2('0x5'));var system=schema({'command':{'type':'string','required':!![],'message':_0x76a2('0x6')}});exports[_0x76a2('0x7')]=function(_0x304ce8,_0x5c8259){return function(_0x3e4c62){try{var _0x1f9f18={'command':_0x5c8259[0x0]};var _0x52cacf=system[_0x76a2('0x0')](_0x1f9f18,{'typecast':!![]});if(_0x52cacf[_0x76a2('0x8')]){logger[_0x76a2('0x9')](_0x76a2('0xa'),_0x304ce8,_[_0x76a2('0xb')](_0x52cacf,_0x76a2('0xc'))['join'](',\x20'));logger[_0x76a2('0xd')](_0x76a2('0xe'),_0x304ce8);_0x3e4c62[_0x76a2('0xf')]();}else{var _0x4ffa31=this;var _0x302a07=utils[_0x76a2('0x10')](_0x5c8259[0x0],this);logger[_0x76a2('0xd')](_0x76a2('0x11'),_0x304ce8,_0x302a07);sh[_0x76a2('0x12')](_[_0x76a2('0x13')](_0x302a07),function(_0x2ae621,_0x413305){logger[_0x76a2('0xd')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x304ce8,_0x2ae621);if(_0x2ae621==0x0){var _0x44c923=_0x413305['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x76a2('0x14')](_0x5c8259[0x1])||_[_0x76a2('0x15')](_0x5c8259[0x1])){logger[_0x76a2('0xd')](_0x76a2('0x16'),_0x304ce8);_0x4ffa31['body'][_0x5c8259[0x1]]=_0x44c923;}else{logger['info'](_0x76a2('0x17'),_0x304ce8,_0x5c8259[0x1],_0x44c923);_0x4ffa31['body'][_0x5c8259[0x1]]=_0x44c923;}}_0x3e4c62[_0x76a2('0xf')]();});}}catch(_0x34f472){logger[_0x76a2('0x9')](_0x76a2('0xa'),_0x304ce8,_[_0x76a2('0x18')](_0x34f472)?JSON['stringify'](_0x34f472):_0x34f472);logger[_0x76a2('0xd')](_0x76a2('0xe'),_0x304ce8);_0x3e4c62[_0x76a2('0xf')]();}};};
\ No newline at end of file
index fa929db..fe55c20 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd732=['number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','finally','isObject','validate','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xd732,0x18b));var _0x2d73=function(_0x4ae0c1,_0x1092d1){_0x4ae0c1=_0x4ae0c1-0x0;var _0x587f64=_0xd732[_0x4ae0c1];return _0x587f64;};'use strict';var schema=require(_0x2d73('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x2d73('0x1')),'smsInteraction':require(_0x2d73('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x2d73('0x3'))};var logger=require(_0x2d73('0x4'))('routing');var tag=schema({'tag':{'type':_0x2d73('0x5'),'required':!![],'message':_0x2d73('0x6')}});exports[_0x2d73('0x7')]=function(_0x32472e,_0x156343,_0x2f890b,_0x22529a){return function(_0xd1470){try{var _0x2547e7={'tag':_0x156343[0x0]};var _0xfc20f5=tag[_0x2d73('0x0')](_0x2547e7,{'typecast':!![]});if(_0xfc20f5['length']){logger[_0x2d73('0x8')](_0x2d73('0x9'),_0x32472e,_[_0x2d73('0xa')](_0xfc20f5,_0x2d73('0xb'))[_0x2d73('0xc')](',\x20'));logger[_0x2d73('0xd')](_0x2d73('0xe'),_0x32472e);_0xd1470[_0x2d73('0xf')]();}else{var _0x5f1b84={'ids':[_0x156343[0x0]]};if(rpc[_0x22529a[_0x2d73('0x10')]+_0x2d73('0x11')]){rpc[_0x22529a[_0x2d73('0x10')]+_0x2d73('0x11')][_0x2d73('0x12')](_0x22529a['interaction']['id'],_0x5f1b84)['then'](function(_0x1fd322){logger['info'](_0x2d73('0x13'),_0x32472e,_0x156343[0x1],_0x22529a[_0x2d73('0x10')],_0x22529a[_0x2d73('0x14')]['id']);})[_0x2d73('0x15')](function(_0x351bfc){logger[_0x2d73('0x8')](_0x2d73('0x9'),_0x32472e,JSON[_0x2d73('0x16')](_0x351bfc));logger[_0x2d73('0xd')](_0x2d73('0xe'),_0x32472e);})[_0x2d73('0x17')](function(){_0xd1470['next']();});}}}catch(_0x2bfa47){logger[_0x2d73('0x8')](_0x2d73('0x9'),_0x32472e,_[_0x2d73('0x18')](_0x2bfa47)?JSON[_0x2d73('0x16')](_0x2bfa47):_0x2bfa47);logger[_0x2d73('0xd')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x32472e);_0xd1470[_0x2d73('0xf')]();}};};
\ No newline at end of file
+var _0xd921=['then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','message','next','Interaction','channel','addTags','interaction'];(function(_0x5eb84a,_0x13fdb2){var _0x3dea81=function(_0x15da30){while(--_0x15da30){_0x5eb84a['push'](_0x5eb84a['shift']());}};_0x3dea81(++_0x13fdb2);}(_0xd921,0x16f));var _0x1d92=function(_0xf3a17a,_0x4ce4dd){_0xf3a17a=_0xf3a17a-0x0;var _0x128a9f=_0xd921[_0xf3a17a];return _0x128a9f;};'use strict';var schema=require(_0x1d92('0x0'));var _=require(_0x1d92('0x1'));var rpc={'chatInteraction':require(_0x1d92('0x2')),'openchannelInteraction':require(_0x1d92('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x1d92('0x4')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1d92('0x5'))};var logger=require(_0x1d92('0x6'))(_0x1d92('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x1d92('0x8')}});exports['consequence']=function(_0x31db0d,_0x220629,_0x1dc6d1,_0x2f205b){return function(_0x3846d2){try{var _0x46ced0={'tag':_0x220629[0x0]};var _0x519c25=tag[_0x1d92('0x0')](_0x46ced0,{'typecast':!![]});if(_0x519c25[_0x1d92('0x9')]){logger['error'](_0x1d92('0xa'),_0x31db0d,_['map'](_0x519c25,_0x1d92('0xb'))['join'](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x31db0d);_0x3846d2[_0x1d92('0xc')]();}else{var _0x405a82={'ids':[_0x220629[0x0]]};if(rpc[_0x2f205b['channel']+_0x1d92('0xd')]){rpc[_0x2f205b[_0x1d92('0xe')]+_0x1d92('0xd')][_0x1d92('0xf')](_0x2f205b[_0x1d92('0x10')]['id'],_0x405a82)[_0x1d92('0x11')](function(_0x50cc4e){logger[_0x1d92('0x12')](_0x1d92('0x13'),_0x31db0d,_0x220629[0x1],_0x2f205b[_0x1d92('0xe')],_0x2f205b['interaction']['id']);})[_0x1d92('0x14')](function(_0x2b3f3d){logger[_0x1d92('0x15')](_0x1d92('0xa'),_0x31db0d,JSON['stringify'](_0x2b3f3d));logger[_0x1d92('0x12')](_0x1d92('0x16'),_0x31db0d);})[_0x1d92('0x17')](function(){_0x3846d2[_0x1d92('0xc')]();});}}}catch(_0x261f3b){logger[_0x1d92('0x15')](_0x1d92('0xa'),_0x31db0d,_['isObject'](_0x261f3b)?JSON['stringify'](_0x261f3b):_0x261f3b);logger['info'](_0x1d92('0x16'),_0x31db0d);_0x3846d2[_0x1d92('0xc')]();}};};
\ No newline at end of file
index 9e613b0..7fe3563 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6418=['&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','includes','urlOnRing','?params=','title','2.0','method','login','push','params','stringify','utf8','POST','application/json-rpc','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId=','&sessionId='];(function(_0xc628cb,_0x58b10c){var _0x39c039=function(_0x2441d7){while(--_0x2441d7){_0xc628cb['push'](_0xc628cb['shift']());}};_0x39c039(++_0x58b10c);}(_0x6418,0x144));var _0x8641=function(_0x363770,_0x2453d0){_0x363770=_0x363770-0x0;var _0xc710f9=_0x6418[_0x363770];return _0xc710f9;};'use strict';var rp=require('request-promise');var logger=require(_0x8641('0x0'))(_0x8641('0x1'));var _=require(_0x8641('0x2'));var arr=[];exports[_0x8641('0x3')]=function(_0x184b7a,_0x42e955){return function(_0x42ec33){var _0x40a750=_0x42e955[0xa];var _0x4aac85=_0x42e955[0xb];var _0x304ea6=_0x42e955[0xc];var _0x5d28e6=_0x42e955[0xd];var _0x3afd3e=_0x42e955[0xe];var _0x837c26=_0x42e955[0xf]['replace'](/\n/g,_0x8641('0x4'));var _0x2b02c5=_0x42e955[0x10][_0x8641('0x5')](/\n/g,'\x20');if(!arr[_0x8641('0x6')](_0x4aac85)){arr['push'](_0x4aac85);var _0x1d0332=_0x42e955[0x3];var _0xe1efbf=_0x42e955[0x4];var _0x3137e7=_0x42e955[0x1];var _0x2b3067=_0x42e955[0x0];var _0x302415={};_0x302415['urlOnAnswer']=_0x42e955[0x8]+'?params='+_0x304ea6+'|'+_0x40a750+'|'+_0x5d28e6+'|'+_0x4aac85+'|'+_0x3afd3e;_0x302415[_0x8641('0x7')]=_0x42e955[0x7]+_0x8641('0x8')+_0x304ea6+'|'+_0x40a750+'|'+_0x5d28e6+'|'+_0x4aac85+'|'+_0x3afd3e+'|'+_0x837c26+'|'+_0x2b02c5;_0x302415[_0x8641('0x9')]=_0x42e955[0x9];var _0x1adb10={};_0x1adb10['jsonrpc']=_0x8641('0xa');_0x1adb10[_0x8641('0xb')]=_0x8641('0xc');var _0x3103a4=[];_0x3103a4[_0x8641('0xd')](_0x42e955[0x2]);_0x3103a4['push'](_0x42e955[0x5]);_0x3103a4[_0x8641('0xd')](_0x42e955[0x6]);_0x1adb10[_0x8641('0xe')]=_0x3103a4;_0x1adb10['id']=0x1;var _0x406d71=JSON[_0x8641('0xf')](_0x1adb10);var _0x2af9ea={'encoding':_0x8641('0x10'),'method':_0x8641('0x11'),'timeout':0x2710,'url':_0x1d0332,'headers':{'Content-Type':_0x8641('0x12')},'body':_0x406d71};return rp(_0x2af9ea)[_0x8641('0x13')](function(_0x22be74){const _0xfddfc0=JSON[_0x8641('0x14')](_0x22be74);if(!_0xfddfc0[_0x8641('0x15')][_0x8641('0x16')]){throw new Error(_0x8641('0x17'));}var _0x5ce5ea=_0x4aac85;var _0x130f6c='channelId='+_0x3137e7+_0x8641('0x18')+_0x2b3067+_0x8641('0x19')+_0x5ce5ea+_0x8641('0x1a')+JSON[_0x8641('0xf')](_0x302415);var _0x168b1d=_0xe1efbf+'?'+_0x130f6c;return rp(_0x168b1d);})[_0x8641('0x13')](function(_0x3f9f6e){logger[_0x8641('0x1b')](_0x8641('0x1c'),_0x184b7a,_0x3f9f6e);_0x42ec33['stop']();})['catch'](function(_0x2c6367){logger[_0x8641('0x1d')](_0x8641('0x1e'),_0x184b7a,_[_0x8641('0x1f')](_0x2c6367)?JSON[_0x8641('0xf')](_0x2c6367):_0x2c6367);_0x42ec33[_0x8641('0x20')]();});}else{logger['info'](_0x8641('0x21'),_0x184b7a);_0x42ec33[_0x8641('0x22')]();}};};
\ No newline at end of file
+var _0x63e9=['2.0','login','stringify','utf8','POST','application/json-rpc','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','urlOnRing','?params=','title'];(function(_0x1ae1e3,_0x589ad0){var _0x36c712=function(_0x2cd1af){while(--_0x2cd1af){_0x1ae1e3['push'](_0x1ae1e3['shift']());}};_0x36c712(++_0x589ad0);}(_0x63e9,0xd4));var _0x963e=function(_0x10dfdf,_0x36b623){_0x10dfdf=_0x10dfdf-0x0;var _0x4d857d=_0x63e9[_0x10dfdf];return _0x4d857d;};'use strict';var rp=require(_0x963e('0x0'));var logger=require(_0x963e('0x1'))(_0x963e('0x2'));var _=require(_0x963e('0x3'));var arr=[];exports[_0x963e('0x4')]=function(_0x381a76,_0x5dca71){return function(_0x358092){var _0x21dd1a=_0x5dca71[0xa];var _0x3206a7=_0x5dca71[0xb];var _0x13bfe4=_0x5dca71[0xc];var _0x5eac17=_0x5dca71[0xd];var _0x3ed7fa=_0x5dca71[0xe];var _0x1f0efe=_0x5dca71[0xf][_0x963e('0x5')](/\n/g,'\x20-\x20');var _0x3fac6a=_0x5dca71[0x10][_0x963e('0x5')](/\n/g,'\x20');if(!arr[_0x963e('0x6')](_0x3206a7)){arr[_0x963e('0x7')](_0x3206a7);var _0x35698f=_0x5dca71[0x3];var _0x7cfb91=_0x5dca71[0x4];var _0x448228=_0x5dca71[0x1];var _0x5897cc=_0x5dca71[0x0];var _0x2afaef={};_0x2afaef[_0x963e('0x8')]=_0x5dca71[0x8]+'?params='+_0x13bfe4+'|'+_0x21dd1a+'|'+_0x5eac17+'|'+_0x3206a7+'|'+_0x3ed7fa;_0x2afaef[_0x963e('0x9')]=_0x5dca71[0x7]+_0x963e('0xa')+_0x13bfe4+'|'+_0x21dd1a+'|'+_0x5eac17+'|'+_0x3206a7+'|'+_0x3ed7fa+'|'+_0x1f0efe+'|'+_0x3fac6a;_0x2afaef[_0x963e('0xb')]=_0x5dca71[0x9];var _0x2bbdad={};_0x2bbdad['jsonrpc']=_0x963e('0xc');_0x2bbdad['method']=_0x963e('0xd');var _0x3b0bbc=[];_0x3b0bbc[_0x963e('0x7')](_0x5dca71[0x2]);_0x3b0bbc[_0x963e('0x7')](_0x5dca71[0x5]);_0x3b0bbc['push'](_0x5dca71[0x6]);_0x2bbdad['params']=_0x3b0bbc;_0x2bbdad['id']=0x1;var _0x519d0c=JSON[_0x963e('0xe')](_0x2bbdad);var _0x4df400={'encoding':_0x963e('0xf'),'method':_0x963e('0x10'),'timeout':0x2710,'url':_0x35698f,'headers':{'Content-Type':_0x963e('0x11')},'body':_0x519d0c};return rp(_0x4df400)[_0x963e('0x12')](function(_0x34cf77){const _0x42e739=JSON[_0x963e('0x13')](_0x34cf77);if(!_0x42e739['result']['logged']){throw new Error(_0x963e('0x14'));}var _0x374df4=_0x3206a7;var _0x188fef=_0x963e('0x15')+_0x448228+'&serviceId='+_0x5897cc+_0x963e('0x16')+_0x374df4+_0x963e('0x17')+JSON[_0x963e('0xe')](_0x2afaef);var _0x55ab3b=_0x7cfb91+'?'+_0x188fef;return rp(_0x55ab3b);})[_0x963e('0x12')](function(_0x5df6c9){logger[_0x963e('0x18')](_0x963e('0x19'),_0x381a76,_0x5df6c9);_0x358092[_0x963e('0x1a')]();})[_0x963e('0x1b')](function(_0x437253){logger[_0x963e('0x1c')](_0x963e('0x1d'),_0x381a76,_[_0x963e('0x1e')](_0x437253)?JSON[_0x963e('0xe')](_0x437253):_0x437253);_0x358092['stop']();});}else{logger[_0x963e('0x18')](_0x963e('0x1f'),_0x381a76);_0x358092['next']();}};};
\ No newline at end of file
index 05aec94..c14c52d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x341053,_0x1453b0){var _0x47ee21=function(_0x5b1903){while(--_0x5b1903){_0x341053['push'](_0x341053['shift']());}};_0x47ee21(++_0x1453b0);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}};
\ No newline at end of file
+var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x352f20,_0x405275){var _0x3f1267=function(_0x2b6288){while(--_0x2b6288){_0x352f20['push'](_0x352f20['shift']());}};_0x3f1267(++_0x405275);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}};
\ No newline at end of file
index 851662a..c8e8ed1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x084b=['agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','bluebird','./applications/utils','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','toLowerCase','autoreply','split','push','slice','dialogflow','dialogflowv2','appdata','tag','TagId','tvox','account','notificationTemplate','ChatWebsiteId','ContactId','body','./interval','./applications/','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','.js','rules','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busy','busyQueue','end','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity'];(function(_0x45ee03,_0x2f5319){var _0x13d535=function(_0x391904){while(--_0x391904){_0x45ee03['push'](_0x45ee03['shift']());}};_0x13d535(++_0x2f5319);}(_0x084b,0xd5));var _0xb084=function(_0x159e29,_0x53d9ca){_0x159e29=_0x159e29-0x0;var _0x429903=_0x084b[_0x159e29];return _0x429903;};'use strict';var _=require(_0xb084('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xb084('0x1'));var utils=require(_0xb084('0x2'));var sUtils=require('./applications/strategy/util');var logger=require(_0xb084('0x3'))(_0xb084('0x4'));var rpc={'openchannelQueueReport':require(_0xb084('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0xb084('0x6')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xb084('0x7')),'whatsappQueueReport':require(_0xb084('0x8'))};var RuleEngine=require(_0xb084('0x9'));function getId(_0x4b69ad,_0x4f45d2,_0x18a300){return util[_0xb084('0xa')](_0xb084('0xb'),_0x4b69ad,_0x4f45d2||0x0,_0x18a300||0x0);}function getIntervals(_0xec1e0d,_0xebe5ee){var _0x4542bd=[];if(!_[_0xb084('0xc')](_0xebe5ee[_0xb084('0xd')])&&!_[_0xb084('0xc')](_0xec1e0d[_0xebe5ee[_0xb084('0xd')]])&&!_[_0xb084('0xc')](_0xec1e0d[_0xebe5ee[_0xb084('0xd')]][_0xb084('0xe')])){_0x4542bd=_[_0xb084('0xf')](_0xec1e0d[_0xebe5ee['IntervalId']]['Intervals'],_0xb084('0x10'));}else if(!_['isNil'](_0xebe5ee['interval'])){_0x4542bd=[_0xebe5ee[_0xb084('0x10')]];}return _0x4542bd;}exports[_0xb084('0x11')]=function(_0x5bae3a){_0x5bae3a['rules']={};return new BPromise(function(_0x44be03,_0x412651){var _0x41a367={'Start':function(_0x28ad2d){var _0xc6df71=this;return new Promise(function(_0x5a5d11,_0x240838){if(_0x28ad2d){try{var _0x357391=[];var _0x17bd4e=getId(_0x28ad2d[_0xb084('0x12')],_0x28ad2d[_0xb084('0x13')]?_0x28ad2d[_0xb084('0x13')]['id']:0x0,_0x28ad2d[_0xb084('0x14')]?_0x28ad2d[_0xb084('0x14')]['id']:0x0);var _0x13b3e4=sUtils[_0xb084('0x15')](_0x5bae3a,_0x28ad2d);if(_0x28ad2d['transfer']||!_0x13b3e4&&_0x28ad2d['applications']&&_['isArray'](_0x28ad2d['applications'])&&_0x28ad2d[_0xb084('0x16')]['length']){for(var _0x3aff96=0x0;_0x3aff96<_0x28ad2d[_0xb084('0x16')][_0xb084('0x17')];_0x3aff96+=0x1){var _0x2e8789=_0x28ad2d[_0xb084('0x16')][_0x3aff96];if(fs[_0xb084('0x18')](path[_0xb084('0x19')](__dirname,_0xb084('0x16'),_0x2e8789['app']+'.js'))){var _0x171dd5=[];switch(_0x2e8789[_0xb084('0x1a')][_0xb084('0x1b')]()){case _0xb084('0x1c'):var _0x5dced1=_0x2e8789['appdata'][_0xb084('0x1d')](',');if(_0x28ad2d[_0xb084('0x12')]==='mail'){_0x171dd5[_0xb084('0x1e')](_0x5dced1[0x0]);_0x171dd5['push'](_0x5dced1[0x1]);_0x171dd5[_0xb084('0x1e')](_0x5dced1[_0xb084('0x1f')](0x2,_0x5dced1['length'])[_0xb084('0x19')](','));}else{_0x171dd5[_0xb084('0x1e')](_0x5dced1[0x0]);_0x171dd5[_0xb084('0x1e')](_0x5dced1['slice'](0x1,_0x5dced1[_0xb084('0x17')])['join'](','));}break;case _0xb084('0x20'):var _0x623fe8=_0x2e8789['appdata'][_0xb084('0x1d')](',');_0x171dd5[_0xb084('0x1e')](_0x623fe8[0x0]);_0x171dd5['push'](_0x623fe8[0x1]);_0x171dd5[_0xb084('0x1e')](_0x623fe8[_0xb084('0x1f')](0x2,_0x623fe8['length'])[_0xb084('0x19')](','));break;case _0xb084('0x21'):var _0x4a56c0=_0x2e8789[_0xb084('0x22')][_0xb084('0x1d')](',');_0x171dd5[_0xb084('0x1e')](_0x4a56c0[0x0]);_0x171dd5[_0xb084('0x1e')](_0x4a56c0[0x1]);_0x171dd5[_0xb084('0x1e')](_0x4a56c0[0x2]);_0x171dd5['push'](_0x4a56c0[0x3]);_0x171dd5[_0xb084('0x1e')](_0x4a56c0[_0xb084('0x1f')](0x4,_0x4a56c0[_0xb084('0x17')])[_0xb084('0x19')](','));break;case'amazonlex':var _0x455763=_0x2e8789[_0xb084('0x22')][_0xb084('0x1d')](',');_0x171dd5[_0xb084('0x1e')](_0x455763[0x0]);_0x171dd5[_0xb084('0x1e')](_0x455763[0x1]);_0x171dd5['push'](_0x455763[0x2]);_0x171dd5['push'](_0x455763[0x3]);_0x171dd5[_0xb084('0x1e')](_0x455763['slice'](0x4,_0x455763[_0xb084('0x17')])['join'](','));break;case _0xb084('0x13'):_0x171dd5[_0xb084('0x1e')](_0x2e8789[_0xb084('0x22')]);break;case _0xb084('0x23'):_0x171dd5['push'](_0x2e8789[_0xb084('0x24')]);_0x171dd5[_0xb084('0x1e')](_0x2e8789[_0xb084('0x22')]);break;case _0xb084('0x25'):var _0x3d27cf=utils['getMustacheRender'](_0x28ad2d[_0xb084('0x26')][_0xb084('0x27')],_0x28ad2d);var _0x4a29d7=_0x2e8789['appdata'][_0xb084('0x1d')](',');_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x0]);_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x1]);_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x2]);_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x3]);_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x4]);_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x5]);_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x6]);_0x171dd5['push'](_0x4a29d7[0x7]);_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x8]);_0x171dd5[_0xb084('0x1e')](_0x4a29d7[0x9]);_0x171dd5['push'](_0x4a29d7[0xa]);_0x171dd5[_0xb084('0x1e')](_0x28ad2d['interaction']['id']);_0x171dd5[_0xb084('0x1e')](_0x28ad2d[_0xb084('0x13')]['id']);_0x171dd5[_0xb084('0x1e')](_0x2e8789[_0xb084('0x28')]);_0x171dd5[_0xb084('0x1e')](_0x28ad2d[_0xb084('0x14')][_0xb084('0x29')]);_0x171dd5[_0xb084('0x1e')](_0x28ad2d[_0xb084('0x2a')][_0xb084('0x2a')]);_0x171dd5[_0xb084('0x1e')](_0x3d27cf);break;default:_0x171dd5=_[_0xb084('0xc')](_0x2e8789[_0xb084('0x22')])?[]:_0x2e8789[_0xb084('0x22')][_0xb084('0x1d')](',');}var _0x2147ff={'id':util['format']('%s:%s:%s',_0x17bd4e,_0x2e8789['id'],_0x2e8789[_0xb084('0x1a')]),'condition':require(_0xb084('0x2b'))['condition'](_0x17bd4e,getIntervals(_0x5bae3a['intervals'],_0x2e8789),_0x5bae3a),'consequence':require(_0xb084('0x2c')+_0x2e8789[_0xb084('0x1a')])[_0xb084('0x2d')](_0x17bd4e,_0x171dd5,_0x5bae3a,_0x28ad2d),'p':_0x2e8789['priority']||0x0};logger[_0xb084('0x2e')](_0xb084('0x2f'),_0x2147ff['id'],_0xb084('0x30'),getIntervals(_0x5bae3a['intervals'],_0x2e8789)[_0xb084('0x19')](_0xb084('0x31')));_0x357391[_0xb084('0x1e')](_0x2147ff);}else{logger[_0xb084('0x32')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xb084('0x19')](__dirname,_0xb084('0x16'),_0x2e8789[_0xb084('0x1a')]+_0xb084('0x33')));}}_0x5bae3a['rules'][_0x17bd4e]=new RuleEngine(_0x357391);_0x5bae3a[_0xb084('0x34')][_0x17bd4e][_0xb084('0x35')](_0x28ad2d,function(_0x1ee3de){logger[_0xb084('0x2e')](_0xb084('0x36'),JSON[_0xb084('0x37')](_0x1ee3de[_0xb084('0x38')]));if(_0x5bae3a[_0xb084('0x34')][_0x17bd4e]){_0x5bae3a[_0xb084('0x34')][_0x17bd4e][_0xb084('0x39')](_0xb084('0x3a'));}});return _0x5a5d11({'code':0xc8,'message':_0x28ad2d});}else{if(_0x13b3e4){logger[_0xb084('0x2e')](util[_0xb084('0xa')](_0xb084('0x3b'),_0x17bd4e));}else{logger[_0xb084('0x2e')]('No\x20applications\x20to\x20execute');}return _0x5a5d11({'code':0xc8,'message':_0x28ad2d});}}catch(_0x2126bc){logger[_0xb084('0x32')](_0x2126bc[_0xb084('0x3c')]);return _0x240838(_0xc6df71[_0xb084('0x32')](0x1f4,_0x2126bc));}}return _0x240838(_0xb084('0x3d'));});},'AcceptMessage':function(_0x1503be){var _0x5298fb=this;return new Promise(function(_0x328e3c,_0x3442c0){if(_0x1503be[_0xb084('0x3e')]&&_0x1503be[_0xb084('0x3e')]['id']){if(_0x5bae3a[_0xb084('0x3f')][_0x1503be[_0xb084('0x3e')]['id']]){_0x5bae3a[_0xb084('0x3f')][_0x1503be['agent']['id']][_0xb084('0x40')]=![];_0x5bae3a[_0xb084('0x3f')][_0x1503be[_0xb084('0x3e')]['id']][_0xb084('0x41')]=undefined;}}if(_0x1503be[_0xb084('0x13')]&&_0x1503be[_0xb084('0x13')]['id']){try{var _0x8bf851=getId(_0x1503be[_0xb084('0x12')],_0x1503be['message']?_0x1503be[_0xb084('0x13')]['id']:0x0,_0x1503be[_0xb084('0x14')]?_0x1503be['interaction']['id']:0x0);if(_0x5bae3a[_0xb084('0x34')][_0x8bf851]){_0x5bae3a[_0xb084('0x34')][_0x8bf851][_0xb084('0x39')](_0xb084('0x42'));if(rpc[_0x1503be[_0xb084('0x12')]+'QueueReport']){rpc[_0x1503be[_0xb084('0x12')]+'QueueReport'][_0xb084('0x43')](_0x8bf851,{'UserId':_0x1503be[_0xb084('0x13')][_0xb084('0x44')]})[_0xb084('0x45')](function(){logger[_0xb084('0x32')](_0xb084('0x46'));});}}return _0x328e3c({'code':0xc8,'message':_0x1503be});}catch(_0x2d9239){logger['error'](_0x2d9239['stack']);return _0x3442c0(_0x5298fb['error'](0x1f4,_0x2d9239));}}logger[_0xb084('0x32')](_0xb084('0x47'));return _0x3442c0(_0x5298fb[_0xb084('0x32')](0x1f4,_0xb084('0x47')));});},'RejectMessage':function(_0x95330e){var _0xccbb54=this;return new Promise(function(_0xfaf976,_0x3aa90a){if(_0x95330e[_0xb084('0x3e')]&&_0x95330e[_0xb084('0x3e')]['id']){try{if(_0x5bae3a[_0xb084('0x3f')][_0x95330e['agent']['id']]){_0x5bae3a[_0xb084('0x3f')][_0x95330e[_0xb084('0x3e')]['id']][_0xb084('0x40')]=![];_0x5bae3a[_0xb084('0x3f')][_0x95330e[_0xb084('0x3e')]['id']][_0xb084('0x41')]=undefined;}return _0xfaf976({'code':0xc8,'message':_0x95330e});}catch(_0x3e83d3){logger[_0xb084('0x32')](_0x3e83d3['stack']);return _0x3aa90a(_0xccbb54[_0xb084('0x32')](0x1f4,_0x3e83d3));}}logger['error']('message\x20is\x20empty');return _0x3aa90a(_0xccbb54[_0xb084('0x32')](0x1f4,_0xb084('0x47')));});},'AbandonInteraction':function(_0x124a06){var _0xc954e6=this;return new Promise(function(_0x4bee98,_0x2e4833){if(_0x124a06['channel']&&_0x124a06[_0xb084('0x14')]&&_0x124a06[_0xb084('0x14')]['id']){try{var _0x63315e=getId(_0x124a06['channel'],_0x124a06[_0xb084('0x13')]?_0x124a06[_0xb084('0x13')]['id']:0x0,_0x124a06['interaction']?_0x124a06[_0xb084('0x14')]['id']:0x0);if(_0x5bae3a[_0xb084('0x34')][_0x63315e]){_0x5bae3a[_0xb084('0x34')][_0x63315e][_0xb084('0x39')](_0xb084('0x42'));}return _0x4bee98({'code':0xc8,'message':_0x124a06});}catch(_0x172056){logger['error'](_0x172056[_0xb084('0x3c')]);return _0x2e4833(_0xc954e6[_0xb084('0x32')](0x1f4,_0x172056));}}logger[_0xb084('0x32')](_0xb084('0x47'));return _0x2e4833(_0xc954e6['error'](0x1f4,_0xb084('0x47')));});},'AgentCapacity':function(_0x22d1e0){var _0x3c32ac=this;return new Promise(function(_0x56e4a4,_0x441d48){if(_0x5bae3a['agents'][_0xb084('0x48')](_0x22d1e0['id'])){for(var _0x2488ab in _0x22d1e0[_0xb084('0x49')]){if(_0x22d1e0['capacity']['hasOwnProperty'](_0x2488ab)){if(_0x5bae3a[_0xb084('0x3f')][_0x22d1e0['id']]['hasOwnProperty'](_0x2488ab+_0xb084('0x4a'))){_0x5bae3a[_0xb084('0x3f')][_0x22d1e0['id']][_0x2488ab+_0xb084('0x4a')]=parseInt(_0x22d1e0[_0xb084('0x49')][_0x2488ab],0xa);}}}_0x5bae3a['agents'][_0x22d1e0['id']]['updateRealtime']();return _0x56e4a4({'code':0xc8,'message':_0x5bae3a['agents'][_0x22d1e0['id']]});}else{return _0x441d48(_0x3c32ac[_0xb084('0x32')](0x1f4,_0xb084('0x4b')));}});},'Agents':function(_0x339de8){return new Promise(function(_0x22e0be){var _0x8cbfea=_[_0xb084('0x4c')](_0x5bae3a[_0xb084('0x3f')]);if(_0x339de8&&_0x339de8['id']){var _0x49cf45=_[_0xb084('0x4d')](_0x8cbfea,function(_0x1c1616){return _0x1c1616['id']===_0x339de8['id'];});_0x22e0be(_0x49cf45);}else{_0x22e0be({'count':_0x8cbfea[_0xb084('0x17')],'rows':_0x8cbfea});}});},'ChatQueues':function(){return new Promise(function(_0x1c5c9e){var _0x40d372=[];for(var _0x13453e in _0x5bae3a[_0xb084('0x4e')]){if(_0x5bae3a['chatQueues'][_0xb084('0x48')](_0x13453e)){var _0xbfde66=_0x5bae3a[_0xb084('0x4e')][_0x13453e];var _0xaa081={'id':_0xbfde66['id'],'available':_0xbfde66[_0xb084('0x4f')],'loggedIn':_0xbfde66[_0xb084('0x50')],'name':_0xbfde66[_0xb084('0x51')],'paused':_0xbfde66[_0xb084('0x52')],'waiting':_0xbfde66['waiting']};_0x40d372[_0xb084('0x1e')](_0xaa081);}}_0x1c5c9e({'count':_0x40d372[_0xb084('0x17')],'rows':_0x40d372});});},'MailQueues':function(){return new Promise(function(_0x49d387){var _0x240fff=[];for(var _0x39af66 in _0x5bae3a['mailQueues']){if(_0x5bae3a['mailQueues'][_0xb084('0x48')](_0x39af66)){var _0x36b0b9=_0x5bae3a['mailQueues'][_0x39af66];var _0x5603df={'id':_0x36b0b9['id'],'available':_0x36b0b9[_0xb084('0x4f')],'loggedIn':_0x36b0b9['loggedIn'],'name':_0x36b0b9['name'],'paused':_0x36b0b9[_0xb084('0x52')],'waiting':_0x36b0b9[_0xb084('0x53')]};_0x240fff[_0xb084('0x1e')](_0x5603df);}}_0x49d387({'count':_0x240fff[_0xb084('0x17')],'rows':_0x240fff});});},'OpenchannelQueues':function(){return new Promise(function(_0x46ccd6){var _0x514fdb=[];for(var _0x3429b6 in _0x5bae3a[_0xb084('0x54')]){if(_0x5bae3a[_0xb084('0x54')][_0xb084('0x48')](_0x3429b6)){var _0x582c85=_0x5bae3a[_0xb084('0x54')][_0x3429b6];var _0x40a7c7={'id':_0x582c85['id'],'available':_0x582c85[_0xb084('0x4f')],'loggedIn':_0x582c85[_0xb084('0x50')],'name':_0x582c85[_0xb084('0x51')],'paused':_0x582c85['paused'],'waiting':_0x582c85['waiting']};_0x514fdb[_0xb084('0x1e')](_0x40a7c7);}}_0x46ccd6({'count':_0x514fdb[_0xb084('0x17')],'rows':_0x514fdb});});},'SmsQueues':function(){return new Promise(function(_0x13f6ca){var _0x20963d=[];for(var _0x5e5624 in _0x5bae3a[_0xb084('0x55')]){if(_0x5bae3a[_0xb084('0x55')][_0xb084('0x48')](_0x5e5624)){var _0x162f28=_0x5bae3a['smsQueues'][_0x5e5624];var _0x22ff37={'id':_0x162f28['id'],'available':_0x162f28[_0xb084('0x4f')],'loggedIn':_0x162f28[_0xb084('0x50')],'name':_0x162f28[_0xb084('0x51')],'paused':_0x162f28[_0xb084('0x52')],'waiting':_0x162f28['waiting']};_0x20963d[_0xb084('0x1e')](_0x22ff37);}}_0x13f6ca({'count':_0x20963d[_0xb084('0x17')],'rows':_0x20963d});});},'FaxQueues':function(){return new Promise(function(_0x5d48d8){var _0x379c11=[];for(var _0xfdb0ba in _0x5bae3a[_0xb084('0x56')]){if(_0x5bae3a[_0xb084('0x56')][_0xb084('0x48')](_0xfdb0ba)){var _0xa85938=_0x5bae3a['faxQueues'][_0xfdb0ba];var _0x1fff99={'id':_0xa85938['id'],'available':_0xa85938[_0xb084('0x4f')],'loggedIn':_0xa85938[_0xb084('0x50')],'name':_0xa85938[_0xb084('0x51')],'paused':_0xa85938['paused'],'waiting':_0xa85938[_0xb084('0x53')]};_0x379c11[_0xb084('0x1e')](_0x1fff99);}}_0x5d48d8({'count':_0x379c11['length'],'rows':_0x379c11});});},'WhatsappQueues':function(){return new Promise(function(_0x230ee3){var _0x9cd5e9=[];for(var _0xbad10e in _0x5bae3a[_0xb084('0x57')]){if(_0x5bae3a[_0xb084('0x57')][_0xb084('0x48')](_0xbad10e)){var _0x13e60e=_0x5bae3a[_0xb084('0x57')][_0xbad10e];var _0x26c5e1={'id':_0x13e60e['id'],'available':_0x13e60e[_0xb084('0x4f')],'loggedIn':_0x13e60e[_0xb084('0x50')],'name':_0x13e60e[_0xb084('0x51')],'paused':_0x13e60e[_0xb084('0x52')],'waiting':_0x13e60e[_0xb084('0x53')]};_0x9cd5e9[_0xb084('0x1e')](_0x26c5e1);}}_0x230ee3({'count':_0x9cd5e9[_0xb084('0x17')],'rows':_0x9cd5e9});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x543589){var _0x39bd5c=_[_0xb084('0x4c')](_0x5bae3a['chatQueuesWaitingInteractions']);_0x543589({'count':_0x39bd5c[_0xb084('0x17')],'rows':_0x39bd5c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x3dba8e){var _0x9e14ef=_[_0xb084('0x4c')](_0x5bae3a[_0xb084('0x58')]);_0x3dba8e({'count':_0x9e14ef['length'],'rows':_0x9e14ef});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4d68d1){var _0x36d433=_[_0xb084('0x4c')](_0x5bae3a[_0xb084('0x59')]);_0x4d68d1({'count':_0x36d433[_0xb084('0x17')],'rows':_0x36d433});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2bcb95){var _0x54127a=_[_0xb084('0x4c')](_0x5bae3a['smsQueuesWaitingInteractions']);_0x2bcb95({'count':_0x54127a[_0xb084('0x17')],'rows':_0x54127a});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x41e359){var _0x2cfed0=_['values'](_0x5bae3a[_0xb084('0x5a')]);_0x41e359({'count':_0x2cfed0['length'],'rows':_0x2cfed0});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x344f84){var _0x17bb39=_[_0xb084('0x4c')](_0x5bae3a[_0xb084('0x5b')]);_0x344f84({'count':_0x17bb39[_0xb084('0x17')],'rows':_0x17bb39});});}};var _0x40807b=jayson[_0xb084('0x5c')](_0x41a367)['http']();_0x40807b['on'](_0xb084('0x32'),function(_0x5406d8){logger['error'](JSON[_0xb084('0x37')](_0x5406d8));return _0x412651(_0x5406d8);});_0x40807b[_0xb084('0x11')](0x232c,'127.0.0.1',function(){console[_0xb084('0x5d')](_0xb084('0x5e'),0x232c);return _0x44be03(_0xb084('0x5f')+0x232c);});});};
\ No newline at end of file
+var _0x2b47=['tvox','getMustacheRender','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','app','./interval','condition','./applications/','consequence','priority','info','intervals','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','error','stack','routing\x20is\x20empty','agent','agents','busy','emit','QueueReport','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','find','chatQueues','waiting','mailQueues','available','loggedIn','paused','openchannelQueues','name','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','listen','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','existsSync','toLowerCase','autoreply','split','mail','push','slice','join','dialogflow','appdata','dialogflowv2','amazonlex','tag','TagId'];(function(_0x375d69,_0x276d75){var _0x40d16c=function(_0xa7dd1){while(--_0xa7dd1){_0x375d69['push'](_0x375d69['shift']());}};_0x40d16c(++_0x276d75);}(_0x2b47,0x177));var _0x72b4=function(_0x267805,_0x90b8a8){_0x267805=_0x267805-0x0;var _0x1d0a54=_0x2b47[_0x267805];return _0x1d0a54;};'use strict';var _=require(_0x72b4('0x0'));var util=require('util');var path=require(_0x72b4('0x1'));var fs=require('fs');var jayson=require(_0x72b4('0x2'));var BPromise=require(_0x72b4('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x72b4('0x4'));var logger=require(_0x72b4('0x5'))(_0x72b4('0x6'));var rpc={'openchannelQueueReport':require(_0x72b4('0x7')),'mailQueueReport':require(_0x72b4('0x8')),'chatQueueReport':require(_0x72b4('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x72b4('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0x72b4('0xb'));function getId(_0x1c90aa,_0xb1e42f,_0x1bdf7f){return util[_0x72b4('0xc')](_0x72b4('0xd'),_0x1c90aa,_0xb1e42f||0x0,_0x1bdf7f||0x0);}function getIntervals(_0x114a98,_0x165537){var _0x3d2504=[];if(!_[_0x72b4('0xe')](_0x165537[_0x72b4('0xf')])&&!_['isNil'](_0x114a98[_0x165537[_0x72b4('0xf')]])&&!_[_0x72b4('0xe')](_0x114a98[_0x165537[_0x72b4('0xf')]][_0x72b4('0x10')])){_0x3d2504=_[_0x72b4('0x11')](_0x114a98[_0x165537[_0x72b4('0xf')]][_0x72b4('0x10')],_0x72b4('0x12'));}else if(!_[_0x72b4('0xe')](_0x165537[_0x72b4('0x12')])){_0x3d2504=[_0x165537[_0x72b4('0x12')]];}return _0x3d2504;}exports['listen']=function(_0x3ae95d){_0x3ae95d[_0x72b4('0x13')]={};return new BPromise(function(_0x28ae3c,_0x46eb8f){var _0x5cd685={'Start':function(_0x5c6303){var _0x3eff87=this;return new Promise(function(_0x5c7c36,_0x21ff7d){if(_0x5c6303){try{var _0x2d4fd0=[];var _0x5ac4fc=getId(_0x5c6303[_0x72b4('0x14')],_0x5c6303[_0x72b4('0x15')]?_0x5c6303[_0x72b4('0x15')]['id']:0x0,_0x5c6303[_0x72b4('0x16')]?_0x5c6303[_0x72b4('0x16')]['id']:0x0);var _0x334910=sUtils[_0x72b4('0x17')](_0x3ae95d,_0x5c6303);if(_0x5c6303[_0x72b4('0x18')]||!_0x334910&&_0x5c6303[_0x72b4('0x19')]&&_['isArray'](_0x5c6303[_0x72b4('0x19')])&&_0x5c6303['applications'][_0x72b4('0x1a')]){for(var _0x161e90=0x0;_0x161e90<_0x5c6303['applications'][_0x72b4('0x1a')];_0x161e90+=0x1){var _0xc74320=_0x5c6303['applications'][_0x161e90];if(fs[_0x72b4('0x1b')](path['join'](__dirname,_0x72b4('0x19'),_0xc74320['app']+'.js'))){var _0x1f0986=[];switch(_0xc74320['app'][_0x72b4('0x1c')]()){case _0x72b4('0x1d'):var _0x1da2a5=_0xc74320['appdata'][_0x72b4('0x1e')](',');if(_0x5c6303[_0x72b4('0x14')]===_0x72b4('0x1f')){_0x1f0986['push'](_0x1da2a5[0x0]);_0x1f0986[_0x72b4('0x20')](_0x1da2a5[0x1]);_0x1f0986[_0x72b4('0x20')](_0x1da2a5[_0x72b4('0x21')](0x2,_0x1da2a5[_0x72b4('0x1a')])[_0x72b4('0x22')](','));}else{_0x1f0986[_0x72b4('0x20')](_0x1da2a5[0x0]);_0x1f0986[_0x72b4('0x20')](_0x1da2a5['slice'](0x1,_0x1da2a5[_0x72b4('0x1a')])['join'](','));}break;case _0x72b4('0x23'):var _0x20bcb0=_0xc74320[_0x72b4('0x24')][_0x72b4('0x1e')](',');_0x1f0986[_0x72b4('0x20')](_0x20bcb0[0x0]);_0x1f0986[_0x72b4('0x20')](_0x20bcb0[0x1]);_0x1f0986['push'](_0x20bcb0[_0x72b4('0x21')](0x2,_0x20bcb0[_0x72b4('0x1a')])[_0x72b4('0x22')](','));break;case _0x72b4('0x25'):var _0x2387f2=_0xc74320[_0x72b4('0x24')][_0x72b4('0x1e')](',');_0x1f0986[_0x72b4('0x20')](_0x2387f2[0x0]);_0x1f0986['push'](_0x2387f2[0x1]);_0x1f0986[_0x72b4('0x20')](_0x2387f2[0x2]);_0x1f0986[_0x72b4('0x20')](_0x2387f2[0x3]);_0x1f0986['push'](_0x2387f2[_0x72b4('0x21')](0x4,_0x2387f2[_0x72b4('0x1a')])[_0x72b4('0x22')](','));break;case _0x72b4('0x26'):var _0xdaf4fd=_0xc74320[_0x72b4('0x24')][_0x72b4('0x1e')](',');_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[0x0]);_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[0x1]);_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[0x2]);_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[0x3]);_0x1f0986[_0x72b4('0x20')](_0xdaf4fd[_0x72b4('0x21')](0x4,_0xdaf4fd[_0x72b4('0x1a')])[_0x72b4('0x22')](','));break;case _0x72b4('0x15'):_0x1f0986['push'](_0xc74320['appdata']);break;case _0x72b4('0x27'):_0x1f0986['push'](_0xc74320[_0x72b4('0x28')]);_0x1f0986['push'](_0xc74320[_0x72b4('0x24')]);break;case _0x72b4('0x29'):var _0x1b7b74=utils[_0x72b4('0x2a')](_0x5c6303['account'][_0x72b4('0x2b')],_0x5c6303);var _0xfb8f0b=_0xc74320[_0x72b4('0x24')][_0x72b4('0x1e')](',');_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x0]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x1]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x2]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x3]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x4]);_0x1f0986['push'](_0xfb8f0b[0x5]);_0x1f0986['push'](_0xfb8f0b[0x6]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0x7]);_0x1f0986['push'](_0xfb8f0b[0x8]);_0x1f0986['push'](_0xfb8f0b[0x9]);_0x1f0986[_0x72b4('0x20')](_0xfb8f0b[0xa]);_0x1f0986['push'](_0x5c6303[_0x72b4('0x16')]['id']);_0x1f0986[_0x72b4('0x20')](_0x5c6303[_0x72b4('0x15')]['id']);_0x1f0986[_0x72b4('0x20')](_0xc74320[_0x72b4('0x2c')]);_0x1f0986[_0x72b4('0x20')](_0x5c6303[_0x72b4('0x16')][_0x72b4('0x2d')]);_0x1f0986[_0x72b4('0x20')](_0x5c6303[_0x72b4('0x2e')][_0x72b4('0x2e')]);_0x1f0986[_0x72b4('0x20')](_0x1b7b74);break;default:_0x1f0986=_[_0x72b4('0xe')](_0xc74320[_0x72b4('0x24')])?[]:_0xc74320['appdata'][_0x72b4('0x1e')](',');}var _0x37c40d={'id':util['format'](_0x72b4('0x2f'),_0x5ac4fc,_0xc74320['id'],_0xc74320[_0x72b4('0x30')]),'condition':require(_0x72b4('0x31'))[_0x72b4('0x32')](_0x5ac4fc,getIntervals(_0x3ae95d['intervals'],_0xc74320),_0x3ae95d),'consequence':require(_0x72b4('0x33')+_0xc74320[_0x72b4('0x30')])[_0x72b4('0x34')](_0x5ac4fc,_0x1f0986,_0x3ae95d,_0x5c6303),'p':_0xc74320[_0x72b4('0x35')]||0x0};logger[_0x72b4('0x36')]('Push\x20new\x20rule',_0x37c40d['id'],'on\x20interval',getIntervals(_0x3ae95d[_0x72b4('0x37')],_0xc74320)[_0x72b4('0x22')]('\x20|\x20'));_0x2d4fd0[_0x72b4('0x20')](_0x37c40d);}else{logger['error'](_0x72b4('0x38'),path['join'](__dirname,'applications',_0xc74320[_0x72b4('0x30')]+_0x72b4('0x39')));}}_0x3ae95d['rules'][_0x5ac4fc]=new RuleEngine(_0x2d4fd0);_0x3ae95d[_0x72b4('0x13')][_0x5ac4fc][_0x72b4('0x3a')](_0x5c6303,function(_0x5b8f8f){logger[_0x72b4('0x36')](_0x72b4('0x3b'),JSON[_0x72b4('0x3c')](_0x5b8f8f[_0x72b4('0x3d')]));if(_0x3ae95d[_0x72b4('0x13')][_0x5ac4fc]){_0x3ae95d['rules'][_0x5ac4fc]['emit'](_0x72b4('0x3e'));}});return _0x5c7c36({'code':0xc8,'message':_0x5c6303});}else{if(_0x334910){logger[_0x72b4('0x36')](util[_0x72b4('0xc')](_0x72b4('0x3f'),_0x5ac4fc));}else{logger[_0x72b4('0x36')]('No\x20applications\x20to\x20execute');}return _0x5c7c36({'code':0xc8,'message':_0x5c6303});}}catch(_0x585ac0){logger[_0x72b4('0x40')](_0x585ac0[_0x72b4('0x41')]);return _0x21ff7d(_0x3eff87[_0x72b4('0x40')](0x1f4,_0x585ac0));}}return _0x21ff7d(_0x72b4('0x42'));});},'AcceptMessage':function(_0x4caeba){var _0x35af71=this;return new Promise(function(_0x2ff377,_0x3907fe){if(_0x4caeba[_0x72b4('0x43')]&&_0x4caeba['agent']['id']){if(_0x3ae95d[_0x72b4('0x44')][_0x4caeba[_0x72b4('0x43')]['id']]){_0x3ae95d[_0x72b4('0x44')][_0x4caeba['agent']['id']][_0x72b4('0x45')]=![];_0x3ae95d[_0x72b4('0x44')][_0x4caeba[_0x72b4('0x43')]['id']]['busyQueue']=undefined;}}if(_0x4caeba['message']&&_0x4caeba[_0x72b4('0x15')]['id']){try{var _0xd374c7=getId(_0x4caeba['channel'],_0x4caeba[_0x72b4('0x15')]?_0x4caeba[_0x72b4('0x15')]['id']:0x0,_0x4caeba[_0x72b4('0x16')]?_0x4caeba[_0x72b4('0x16')]['id']:0x0);if(_0x3ae95d[_0x72b4('0x13')][_0xd374c7]){_0x3ae95d['rules'][_0xd374c7][_0x72b4('0x46')]('end');if(rpc[_0x4caeba[_0x72b4('0x14')]+'QueueReport']){rpc[_0x4caeba['channel']+_0x72b4('0x47')]['update'](_0xd374c7,{'UserId':_0x4caeba[_0x72b4('0x15')]['UserId']})[_0x72b4('0x48')](function(){logger[_0x72b4('0x40')](_0x72b4('0x49'));});}}return _0x2ff377({'code':0xc8,'message':_0x4caeba});}catch(_0x28ec6c){logger[_0x72b4('0x40')](_0x28ec6c[_0x72b4('0x41')]);return _0x3907fe(_0x35af71[_0x72b4('0x40')](0x1f4,_0x28ec6c));}}logger['error'](_0x72b4('0x4a'));return _0x3907fe(_0x35af71[_0x72b4('0x40')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x136c7d){var _0x4c76a6=this;return new Promise(function(_0x3c8438,_0x58266d){if(_0x136c7d['agent']&&_0x136c7d['agent']['id']){try{if(_0x3ae95d[_0x72b4('0x44')][_0x136c7d['agent']['id']]){_0x3ae95d[_0x72b4('0x44')][_0x136c7d['agent']['id']]['busy']=![];_0x3ae95d[_0x72b4('0x44')][_0x136c7d[_0x72b4('0x43')]['id']]['busyQueue']=undefined;}return _0x3c8438({'code':0xc8,'message':_0x136c7d});}catch(_0x3e1e21){logger[_0x72b4('0x40')](_0x3e1e21[_0x72b4('0x41')]);return _0x58266d(_0x4c76a6[_0x72b4('0x40')](0x1f4,_0x3e1e21));}}logger[_0x72b4('0x40')](_0x72b4('0x4a'));return _0x58266d(_0x4c76a6[_0x72b4('0x40')](0x1f4,_0x72b4('0x4a')));});},'AbandonInteraction':function(_0x467b8c){var _0x4705fd=this;return new Promise(function(_0x4843b2,_0x532b95){if(_0x467b8c[_0x72b4('0x14')]&&_0x467b8c[_0x72b4('0x16')]&&_0x467b8c['interaction']['id']){try{var _0x18760e=getId(_0x467b8c['channel'],_0x467b8c[_0x72b4('0x15')]?_0x467b8c[_0x72b4('0x15')]['id']:0x0,_0x467b8c[_0x72b4('0x16')]?_0x467b8c[_0x72b4('0x16')]['id']:0x0);if(_0x3ae95d[_0x72b4('0x13')][_0x18760e]){_0x3ae95d[_0x72b4('0x13')][_0x18760e]['emit'](_0x72b4('0x4b'));}return _0x4843b2({'code':0xc8,'message':_0x467b8c});}catch(_0x3cebc1){logger[_0x72b4('0x40')](_0x3cebc1[_0x72b4('0x41')]);return _0x532b95(_0x4705fd[_0x72b4('0x40')](0x1f4,_0x3cebc1));}}logger[_0x72b4('0x40')](_0x72b4('0x4a'));return _0x532b95(_0x4705fd[_0x72b4('0x40')](0x1f4,_0x72b4('0x4a')));});},'AgentCapacity':function(_0x1f48d2){var _0x148db0=this;return new Promise(function(_0x10a6ec,_0x436186){if(_0x3ae95d['agents'][_0x72b4('0x4c')](_0x1f48d2['id'])){for(var _0x50ccfb in _0x1f48d2[_0x72b4('0x4d')]){if(_0x1f48d2['capacity']['hasOwnProperty'](_0x50ccfb)){if(_0x3ae95d[_0x72b4('0x44')][_0x1f48d2['id']][_0x72b4('0x4c')](_0x50ccfb+'CurrentCapacity')){_0x3ae95d[_0x72b4('0x44')][_0x1f48d2['id']][_0x50ccfb+_0x72b4('0x4e')]=parseInt(_0x1f48d2[_0x72b4('0x4d')][_0x50ccfb],0xa);}}}_0x3ae95d[_0x72b4('0x44')][_0x1f48d2['id']][_0x72b4('0x4f')]();return _0x10a6ec({'code':0xc8,'message':_0x3ae95d[_0x72b4('0x44')][_0x1f48d2['id']]});}else{return _0x436186(_0x148db0[_0x72b4('0x40')](0x1f4,_0x72b4('0x50')));}});},'Agents':function(_0x12e558){return new Promise(function(_0x1c5480){var _0x59b499=_['values'](_0x3ae95d[_0x72b4('0x44')]);if(_0x12e558&&_0x12e558['id']){var _0x1874f2=_[_0x72b4('0x51')](_0x59b499,function(_0x309db6){return _0x309db6['id']===_0x12e558['id'];});_0x1c5480(_0x1874f2);}else{_0x1c5480({'count':_0x59b499[_0x72b4('0x1a')],'rows':_0x59b499});}});},'ChatQueues':function(){return new Promise(function(_0x3f0d2d){var _0x565783=[];for(var _0x4d2f73 in _0x3ae95d['chatQueues']){if(_0x3ae95d[_0x72b4('0x52')]['hasOwnProperty'](_0x4d2f73)){var _0x1f9f9b=_0x3ae95d[_0x72b4('0x52')][_0x4d2f73];var _0x125f93={'id':_0x1f9f9b['id'],'available':_0x1f9f9b['available'],'loggedIn':_0x1f9f9b['loggedIn'],'name':_0x1f9f9b['name'],'paused':_0x1f9f9b['paused'],'waiting':_0x1f9f9b[_0x72b4('0x53')]};_0x565783[_0x72b4('0x20')](_0x125f93);}}_0x3f0d2d({'count':_0x565783[_0x72b4('0x1a')],'rows':_0x565783});});},'MailQueues':function(){return new Promise(function(_0x4288a9){var _0xa4d969=[];for(var _0x31a90e in _0x3ae95d[_0x72b4('0x54')]){if(_0x3ae95d['mailQueues'][_0x72b4('0x4c')](_0x31a90e)){var _0x991275=_0x3ae95d[_0x72b4('0x54')][_0x31a90e];var _0x240d3a={'id':_0x991275['id'],'available':_0x991275[_0x72b4('0x55')],'loggedIn':_0x991275[_0x72b4('0x56')],'name':_0x991275['name'],'paused':_0x991275[_0x72b4('0x57')],'waiting':_0x991275[_0x72b4('0x53')]};_0xa4d969['push'](_0x240d3a);}}_0x4288a9({'count':_0xa4d969['length'],'rows':_0xa4d969});});},'OpenchannelQueues':function(){return new Promise(function(_0xe693d3){var _0x3dccba=[];for(var _0x2dbf1b in _0x3ae95d['openchannelQueues']){if(_0x3ae95d[_0x72b4('0x58')][_0x72b4('0x4c')](_0x2dbf1b)){var _0x18aa05=_0x3ae95d[_0x72b4('0x58')][_0x2dbf1b];var _0x1dd69a={'id':_0x18aa05['id'],'available':_0x18aa05['available'],'loggedIn':_0x18aa05[_0x72b4('0x56')],'name':_0x18aa05[_0x72b4('0x59')],'paused':_0x18aa05['paused'],'waiting':_0x18aa05[_0x72b4('0x53')]};_0x3dccba[_0x72b4('0x20')](_0x1dd69a);}}_0xe693d3({'count':_0x3dccba[_0x72b4('0x1a')],'rows':_0x3dccba});});},'SmsQueues':function(){return new Promise(function(_0x75c77c){var _0x2d0bd2=[];for(var _0x244b76 in _0x3ae95d[_0x72b4('0x5a')]){if(_0x3ae95d[_0x72b4('0x5a')]['hasOwnProperty'](_0x244b76)){var _0x3f69d0=_0x3ae95d[_0x72b4('0x5a')][_0x244b76];var _0x4da8be={'id':_0x3f69d0['id'],'available':_0x3f69d0[_0x72b4('0x55')],'loggedIn':_0x3f69d0[_0x72b4('0x56')],'name':_0x3f69d0['name'],'paused':_0x3f69d0[_0x72b4('0x57')],'waiting':_0x3f69d0[_0x72b4('0x53')]};_0x2d0bd2[_0x72b4('0x20')](_0x4da8be);}}_0x75c77c({'count':_0x2d0bd2[_0x72b4('0x1a')],'rows':_0x2d0bd2});});},'FaxQueues':function(){return new Promise(function(_0x51f331){var _0x2558f3=[];for(var _0x4c767d in _0x3ae95d[_0x72b4('0x5b')]){if(_0x3ae95d['faxQueues']['hasOwnProperty'](_0x4c767d)){var _0x43e064=_0x3ae95d[_0x72b4('0x5b')][_0x4c767d];var _0x2260ac={'id':_0x43e064['id'],'available':_0x43e064[_0x72b4('0x55')],'loggedIn':_0x43e064[_0x72b4('0x56')],'name':_0x43e064['name'],'paused':_0x43e064[_0x72b4('0x57')],'waiting':_0x43e064[_0x72b4('0x53')]};_0x2558f3[_0x72b4('0x20')](_0x2260ac);}}_0x51f331({'count':_0x2558f3[_0x72b4('0x1a')],'rows':_0x2558f3});});},'WhatsappQueues':function(){return new Promise(function(_0x4f6a2a){var _0x16cd2c=[];for(var _0xa1dddb in _0x3ae95d[_0x72b4('0x5c')]){if(_0x3ae95d[_0x72b4('0x5c')]['hasOwnProperty'](_0xa1dddb)){var _0x463538=_0x3ae95d[_0x72b4('0x5c')][_0xa1dddb];var _0x4d4133={'id':_0x463538['id'],'available':_0x463538[_0x72b4('0x55')],'loggedIn':_0x463538[_0x72b4('0x56')],'name':_0x463538['name'],'paused':_0x463538[_0x72b4('0x57')],'waiting':_0x463538[_0x72b4('0x53')]};_0x16cd2c[_0x72b4('0x20')](_0x4d4133);}}_0x4f6a2a({'count':_0x16cd2c[_0x72b4('0x1a')],'rows':_0x16cd2c});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0xbf148c){var _0x4249ca=_['values'](_0x3ae95d['chatQueuesWaitingInteractions']);_0xbf148c({'count':_0x4249ca[_0x72b4('0x1a')],'rows':_0x4249ca});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x4cdd06){var _0xcc9db6=_[_0x72b4('0x5d')](_0x3ae95d[_0x72b4('0x5e')]);_0x4cdd06({'count':_0xcc9db6[_0x72b4('0x1a')],'rows':_0xcc9db6});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xd48642){var _0x59c1fe=_[_0x72b4('0x5d')](_0x3ae95d[_0x72b4('0x5f')]);_0xd48642({'count':_0x59c1fe[_0x72b4('0x1a')],'rows':_0x59c1fe});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x38111f){var _0x405c02=_['values'](_0x3ae95d[_0x72b4('0x60')]);_0x38111f({'count':_0x405c02[_0x72b4('0x1a')],'rows':_0x405c02});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x37fab4){var _0x8e633b=_[_0x72b4('0x5d')](_0x3ae95d['faxQueuesWaitingInteractions']);_0x37fab4({'count':_0x8e633b[_0x72b4('0x1a')],'rows':_0x8e633b});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x35463d){var _0x20462b=_['values'](_0x3ae95d[_0x72b4('0x61')]);_0x35463d({'count':_0x20462b[_0x72b4('0x1a')],'rows':_0x20462b});});}};var _0x27b7c4=jayson[_0x72b4('0x62')](_0x5cd685)[_0x72b4('0x63')]();_0x27b7c4['on'](_0x72b4('0x40'),function(_0xc99cc6){logger[_0x72b4('0x40')](JSON[_0x72b4('0x3c')](_0xc99cc6));return _0x46eb8f(_0xc99cc6);});_0x27b7c4[_0x72b4('0x64')](0x232c,'127.0.0.1',function(){console[_0x72b4('0x65')](_0x72b4('0x66'),0x232c);return _0x28ae3c(_0x72b4('0x67')+0x232c);});});};
\ No newline at end of file
index bec9b20..c12182c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x414c=['[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','join','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s','\x20|\x20','../../../utils/iftime','iftime','../../../config/logger','routing','condition','rules','info'];(function(_0x5150ff,_0x6bd6a4){var _0x5379dd=function(_0x544987){while(--_0x544987){_0x5150ff['push'](_0x5150ff['shift']());}};_0x5379dd(++_0x6bd6a4);}(_0x414c,0xda));var _0xc414=function(_0x306332,_0x1fec10){_0x306332=_0x306332-0x0;var _0x4fbdc8=_0x414c[_0x306332];return _0x4fbdc8;};'use strict';var _=require('lodash');var iftime=require(_0xc414('0x0'))[_0xc414('0x1')];var logger=require(_0xc414('0x2'))(_0xc414('0x3'));exports[_0xc414('0x4')]=function(_0x33d23f,_0x2cbd7b,_0x4b7bc9){return function(_0x39f0ab){if(_0x4b7bc9[_0xc414('0x5')]&&!_0x4b7bc9[_0xc414('0x5')][_0x33d23f]){logger[_0xc414('0x6')](_0xc414('0x7'),_0x33d23f);return _0x39f0ab[_0xc414('0x8')]();}var _0x54d415=_0x2cbd7b[_0xc414('0x9')](function(_0x1fe8aa){return iftime(_0x1fe8aa);});var _0x55bcfa=_[_0xc414('0xa')](_0x54d415);if(_0x55bcfa){logger['info']('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x33d23f,_0x2cbd7b[_0xc414('0xb')]('\x20|\x20'),_0x55bcfa);_0x39f0ab[_0xc414('0xc')](_0x55bcfa);}else{logger[_0xc414('0x6')](_0xc414('0xd'),_0x33d23f,_0x2cbd7b[_0xc414('0xb')](_0xc414('0xe')));_0x39f0ab[_0xc414('0x8')]();}};};
\ No newline at end of file
+var _0xfefb=['lodash','../../../utils/iftime','iftime','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','map','some','join','\x20|\x20','when','[%s][INTERVAL\x20NOT\x20VALID]\x20%s\x20%s'];(function(_0x60b323,_0x50cf68){var _0x434847=function(_0x3274a0){while(--_0x3274a0){_0x60b323['push'](_0x60b323['shift']());}};_0x434847(++_0x50cf68);}(_0xfefb,0x17a));var _0xbfef=function(_0x219bfb,_0x31add2){_0x219bfb=_0x219bfb-0x0;var _0x4f9949=_0xfefb[_0x219bfb];return _0x4f9949;};'use strict';var _=require(_0xbfef('0x0'));var iftime=require(_0xbfef('0x1'))[_0xbfef('0x2')];var logger=require('../../../config/logger')('routing');exports[_0xbfef('0x3')]=function(_0x9cc4f5,_0xf74375,_0x5bad5d){return function(_0xc4f580){if(_0x5bad5d['rules']&&!_0x5bad5d[_0xbfef('0x4')][_0x9cc4f5]){logger[_0xbfef('0x5')](_0xbfef('0x6'),_0x9cc4f5);return _0xc4f580[_0xbfef('0x7')]();}var _0x397e3e=_0xf74375[_0xbfef('0x8')](function(_0x2a7ab0){return iftime(_0x2a7ab0);});var _0x4c0a6b=_[_0xbfef('0x9')](_0x397e3e);if(_0x4c0a6b){logger[_0xbfef('0x5')]('[%s][INTERVAL\x20VALID]\x20%s\x20%s',_0x9cc4f5,_0xf74375[_0xbfef('0xa')](_0xbfef('0xb')),_0x4c0a6b);_0xc4f580[_0xbfef('0xc')](_0x4c0a6b);}else{logger[_0xbfef('0x5')](_0xbfef('0xd'),_0x9cc4f5,_0xf74375['join'](_0xbfef('0xb')));_0xc4f580['stop']();}};};
\ No newline at end of file
index a8ef195..7c9c3c4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x84a0=['transferexten','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','diffTime','complete','lodash','util','./utils','info','format','channel','queue','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','reason','timeout','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0x84a0,0x66));var _0x084a=function(_0x150e26,_0x2daa22){_0x150e26=_0x150e26-0x0;var _0x50dfbd=_0x84a0[_0x150e26];return _0x50dfbd;};'use strict';var _=require(_0x084a('0x0'));var util=require(_0x084a('0x1'));var utils=require(_0x084a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fff7f,_0x483bfa){utils[_0x084a('0x3')](util[_0x084a('0x4')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1fff7f['uniqueid'],_0x1fff7f[_0x084a('0x5')],_0x1fff7f[_0x084a('0x6')],_0x1fff7f['membername'],_0x1fff7f[_0x084a('0x7')],_0x1fff7f[_0x084a('0x8')],_0x1fff7f[_0x084a('0x9')],_0x1fff7f[_0x084a('0xa')]));if(_0x1fff7f[_0x084a('0x6')]){utils['getVoiceQueueByName'](_0x1fff7f[_0x084a('0x6')])[_0x084a('0xb')](function(_0x8198ad){if(_0x8198ad){_0x1fff7f[_0x084a('0xc')]=_0x8198ad[_0x084a('0xc')];_0x1fff7f['agentacw']=_0x1fff7f['agentcomplete']?_0x8198ad[_0x084a('0xd')]:![];_0x1fff7f[_0x084a('0xe')]=_0x1fff7f[_0x084a('0xf')]?_0x8198ad[_0x084a('0x10')]:0x0;}utils[_0x084a('0x11')]('CreateVoiceAgentReport',_0x1fff7f);});}else{utils['request'](_0x084a('0x12'),_0x1fff7f);}if(_0x483bfa){delete transfers[_0x1fff7f[_0x084a('0x13')]];}else{delete agents[_0x1fff7f[_0x084a('0x14')]];}}exports[_0x084a('0x15')]=function(_0x1bdfb8){try{utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8['uniqueid']),_0x1bdfb8);agents[_0x1bdfb8[_0x084a('0x14')]]=_0x1bdfb8;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x18')]=utils[_0x084a('0x19')]();agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x1a');agents[_0x1bdfb8['destuniqueid']][_0x084a('0x9')]=null;agents[_0x1bdfb8['destuniqueid']][_0x084a('0x1b')]=null;utils[_0x084a('0x3')](util['format'](_0x084a('0x1c'),_0x1bdfb8[_0x084a('0x13')],agents[_0x1bdfb8[_0x084a('0x14')]][_0x084a('0x1d')],_0x1bdfb8[_0x084a('0x14')]));}catch(_0x145636){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x17'),_0x1bdfb8[_0x084a('0x13')]),_0x145636);}};exports[_0x084a('0x1f')]=function(_0x279e25){try{if(!_[_0x084a('0x20')](agents[_0x279e25[_0x084a('0x14')]])){utils[_0x084a('0x16')](util['format'](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x279e25);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x22'),_0x279e25['uniqueid'],agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1d')],_0x279e25[_0x084a('0x14')]));agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x1f')]=!![];agents[_0x279e25[_0x084a('0x14')]]['agentringnoanswerAt']=utils[_0x084a('0x19')]();agents[_0x279e25[_0x084a('0x14')]][_0x084a('0xa')]='timeout';agents[_0x279e25[_0x084a('0x14')]][_0x084a('0x23')]=_0x084a('0x24');agents[_0x279e25['destuniqueid']]['holdtime']=_0x279e25['ringtime']?parseInt(_0x279e25['ringtime'])/0x3e8:0x0;agents[_0x279e25[_0x084a('0x14')]]['talktime']=0x0;unanswered['push'](_0x279e25['destuniqueid']);}}catch(_0x3b8176){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x21'),_0x279e25[_0x084a('0x13')]),_0x3b8176);}};exports[_0x084a('0x25')]=function(_0x378de6){try{_[_0x084a('0x26')](agents,function(_0x5e6ea8,_0x2ed3cd){if(_0x5e6ea8[_0x084a('0x13')]==_0x378de6['uniqueid']&&!_[_0x084a('0x27')](unanswered,_0x5e6ea8[_0x084a('0x14')])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x378de6);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x29'),_0x378de6[_0x084a('0x13')],_0x5e6ea8[_0x084a('0x1d')],_0x5e6ea8[_0x084a('0x14')]));_0x5e6ea8[_0x084a('0x1f')]=!![];_0x5e6ea8['agentringnoanswerAt']=utils['now']();_0x5e6ea8[_0x084a('0xa')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x23')]=_0x084a('0x2a');_0x5e6ea8[_0x084a('0x2b')]=_0x378de6['holdtime'];_0x5e6ea8[_0x084a('0x2c')]=0x0;writeDB(_0x5e6ea8);}});}catch(_0x1b56ad){utils[_0x084a('0x1e')](util['format'](_0x084a('0x28'),_0x378de6[_0x084a('0x13')]),_0x1b56ad);}};exports[_0x084a('0x2d')]=function(_0x4c4c90){try{if(agents[_0x4c4c90['destuniqueid']]){utils['debug'](util[_0x084a('0x4')](_0x084a('0x2e'),_0x4c4c90[_0x084a('0x13')]),_0x4c4c90);utils['info'](util[_0x084a('0x4')](_0x084a('0x2f'),_0x4c4c90[_0x084a('0x13')],agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1d')],_0x4c4c90[_0x084a('0x14')]));agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x9')]=_0x4c4c90[_0x084a('0x9')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0x1b')]=_0x4c4c90[_0x084a('0x1b')];agents[_0x4c4c90['destuniqueid']][_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];agents[_0x4c4c90[_0x084a('0x14')]][_0x084a('0xa')]=_0x084a('0x32');_[_0x084a('0x26')](agents,function(_0xa7b652,_0x183e10){if(_0xa7b652[_0x084a('0x14')]!=_0x4c4c90['destuniqueid']&&_0xa7b652[_0x084a('0x13')]==_0x4c4c90[_0x084a('0x13')]){_0xa7b652[_0x084a('0x2c')]=0x0;_0xa7b652[_0x084a('0x2b')]=_0x4c4c90[_0x084a('0x31')];_0xa7b652[_0x084a('0x1f')]=!![];_0xa7b652['agentringnoanswerAt']=utils[_0x084a('0x19')]();_0xa7b652[_0x084a('0xa')]='answered_elsewhere';_0xa7b652[_0x084a('0x23')]=_0x084a('0x33');_0xa7b652[_0x084a('0x34')]=_0x4c4c90['destuniqueid'];_0xa7b652[_0x084a('0x35')]=_0x4c4c90[_0x084a('0x1d')];writeDB(_0xa7b652);}});}}catch(_0x4fe9c2){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentconnect]',_0x4c4c90['uniqueid']),_0x4fe9c2);}};exports[_0x084a('0x36')]=function(_0x17a8d4){try{if(!_[_0x084a('0x20')](agents[_0x17a8d4[_0x084a('0x14')]])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x37'),_0x17a8d4[_0x084a('0x13')]),_0x17a8d4);utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x38'),_0x17a8d4['uniqueid'],agents[_0x17a8d4['destuniqueid']][_0x084a('0x1d')],_0x17a8d4[_0x084a('0x14')]));agents[_0x17a8d4[_0x084a('0x14')]]['agentcomplete']=!![];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x2c')]=utils['diffTime'](agents[_0x17a8d4[_0x084a('0x14')]]['agentcompleteAt'],agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0x30')]);agents[_0x17a8d4[_0x084a('0x14')]]['reason']=_0x17a8d4['reason'];agents[_0x17a8d4[_0x084a('0x14')]][_0x084a('0xa')]='complete';writeDB(agents[_0x17a8d4[_0x084a('0x14')]]);}}catch(_0x2c2c2e){utils[_0x084a('0x1e')](util[_0x084a('0x4')]('[%s][agents][agentcomplete]',_0x17a8d4[_0x084a('0x13')]),_0x2c2c2e);}};exports[_0x084a('0x3a')]=function(_0x31677b){try{if(!_[_0x084a('0x20')](agents[_0x31677b['transfereruniqueid']])){utils[_0x084a('0x16')](util[_0x084a('0x4')](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x31677b);utils['info'](util['format'](_0x084a('0x3c'),_0x31677b[_0x084a('0x13')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x1d')],agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')]));agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3e')]=!![];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x3f')]=_0x084a('0x40');agents[_0x31677b[_0x084a('0x3d')]]['transferexten']=_0x31677b[_0x084a('0x41')];agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x42')]=agents[_0x31677b[_0x084a('0x3d')]][_0x084a('0x13')];}}catch(_0x1c972c){utils[_0x084a('0x1e')](util['format'](_0x084a('0x3b'),_0x31677b[_0x084a('0x13')]),_0x1c972c);}};exports[_0x084a('0x43')]=function(_0x54aa6c){try{utils['debug'](util[_0x084a('0x4')]('[%s][agents][attendedtransfer]',_0x54aa6c[_0x084a('0x44')]),_0x54aa6c);if(_0x54aa6c[_0x084a('0x44')]==_0x54aa6c['origtransfererlinkedid']){if(!_[_0x084a('0x20')](agents[_0x54aa6c['secondtransfereruniqueid']])){utils['info'](util[_0x084a('0x4')](_0x084a('0x45'),_0x54aa6c[_0x084a('0x44')],agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x1d')]));agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x3e')]=!![];agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c[_0x084a('0x46')]]['transferexten']=_0x54aa6c[_0x084a('0x48')];agents[_0x54aa6c[_0x084a('0x46')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x44')];}if(_0x54aa6c['transfereeuniqueid']&&agents[_0x54aa6c[_0x084a('0x49')]]){agents[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x1;transfers[_0x54aa6c[_0x084a('0x49')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfereeuniqueid']]);transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x46')]]['calleridnum'];transfers[_0x54aa6c[_0x084a('0x49')]]['calleridname']=agents[_0x54aa6c['secondtransfereruniqueid']][_0x084a('0x4c')];transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x18')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x49')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c['transfereeuniqueid']][_0x084a('0x4a')]=0x2;}}else if(_0x54aa6c[_0x084a('0x46')]==_0x54aa6c[_0x084a('0x4d')]){if(!_['isNil'](agents[_0x54aa6c[_0x084a('0x44')]])){utils[_0x084a('0x3')](util['format'](_0x084a('0x45'),_0x54aa6c['origtransfereruniqueid'],agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x1d')]));agents[_0x54aa6c['origtransfereruniqueid']]['transfer']=!![];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x3f')]=_0x084a('0x47');agents[_0x54aa6c['origtransfereruniqueid']][_0x084a('0x4e')]=_0x54aa6c[_0x084a('0x4f')];agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x42')]=_0x54aa6c[_0x084a('0x46')];}if(_0x54aa6c[_0x084a('0x50')]&&agents[_0x54aa6c[_0x084a('0x50')]]){agents[_0x54aa6c['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x54aa6c[_0x084a('0x50')]]=_[_0x084a('0x4b')](agents[_0x54aa6c['transfertargetuniqueid']]);transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x8')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x8')];transfers[_0x54aa6c['transfertargetuniqueid']][_0x084a('0x4c')]=agents[_0x54aa6c[_0x084a('0x44')]][_0x084a('0x4c')];transfers[_0x54aa6c['transfertargetuniqueid']]['agentcalledAt']=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x30')]=utils[_0x084a('0x19')]();transfers[_0x54aa6c[_0x084a('0x50')]][_0x084a('0x2b')]=0x0;transfers[_0x54aa6c[_0x084a('0x50')]]['agententerreason']=0x2;}}}catch(_0x22efb6){utils['error'](util['format'](_0x084a('0x51'),_0x54aa6c[_0x084a('0x44')]),_0x22efb6);}};exports[_0x084a('0x52')]=function(_0x4a2745){try{utils[_0x084a('0x16')](util['format'](_0x084a('0x53'),_0x4a2745[_0x084a('0x13')]),_0x4a2745);if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]===_0x084a('0x24')){if(_0x4a2745['cause']==='21'){agents[_0x4a2745['uniqueid']][_0x084a('0x23')]=_0x084a('0x54');agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]=_0x084a('0x54');}utils[_0x084a('0x3')](util['format'](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]]['lastevent']));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);var _0x38b5b6=unanswered[_0x084a('0x56')](_0x4a2745[_0x084a('0x13')]);if(_0x38b5b6>-0x1){unanswered[_0x084a('0x57')](_0x38b5b6,0x1);}}if(transfers[_0x4a2745[_0x084a('0x13')]]){transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils['now']();transfers[_0x4a2745['uniqueid']]['talktime']=utils[_0x084a('0x58')](transfers[_0x4a2745[_0x084a('0x13')]]['agentcompleteAt'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x30')]);transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]='agent';transfers[_0x4a2745['uniqueid']][_0x084a('0xa')]=_0x084a('0x59');utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],transfers[_0x4a2745[_0x084a('0x13')]]['membername'],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],transfers[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(transfers[_0x4a2745[_0x084a('0x13')]],!![]);}if(agents[_0x4a2745[_0x084a('0x13')]]&&agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']){agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x36')]=!![];agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')]=utils[_0x084a('0x19')]();agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x2c')]=utils[_0x084a('0x58')](agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x39')],agents[_0x4a2745[_0x084a('0x13')]]['agentconnectAt']);agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')]=agents[_0x4a2745['uniqueid']][_0x084a('0x3e')]?'transfer':'agent';agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]='complete';utils[_0x084a('0x3')](util[_0x084a('0x4')](_0x084a('0x55'),_0x4a2745[_0x084a('0x13')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x1d')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0x23')],agents[_0x4a2745[_0x084a('0x13')]][_0x084a('0xa')]));writeDB(agents[_0x4a2745[_0x084a('0x13')]]);}}catch(_0x7c85e3){utils[_0x084a('0x1e')](util[_0x084a('0x4')](_0x084a('0x53'),_0x4a2745['uniqueid']),_0x7c85e3);}};
\ No newline at end of file
+var _0xb49a=['[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','acw','acwtime','agentacw','acwTimeout','request','CreateVoiceAgentReport','uniqueid','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','info','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','push','reason','abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agentcomplete','agent','lodash','util','./utils','format'];(function(_0x4f05e6,_0x260d97){var _0x4f44af=function(_0x4d7f02){while(--_0x4d7f02){_0x4f05e6['push'](_0x4f05e6['shift']());}};_0x4f44af(++_0x260d97);}(_0xb49a,0xfb));var _0xab49=function(_0x1a6a4c,_0x1488f2){_0x1a6a4c=_0x1a6a4c-0x0;var _0x1b9e0f=_0xb49a[_0x1a6a4c];return _0x1b9e0f;};'use strict';var _=require(_0xab49('0x0'));var util=require(_0xab49('0x1'));var utils=require(_0xab49('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1d512a,_0x8db649){utils['info'](util[_0xab49('0x3')](_0xab49('0x4'),_0x1d512a['uniqueid'],_0x1d512a['channel'],_0x1d512a[_0xab49('0x5')],_0x1d512a[_0xab49('0x6')],_0x1d512a[_0xab49('0x7')],_0x1d512a[_0xab49('0x8')],_0x1d512a[_0xab49('0x9')],_0x1d512a[_0xab49('0xa')]));if(_0x1d512a[_0xab49('0x5')]){utils['getVoiceQueueByName'](_0x1d512a[_0xab49('0x5')])[_0xab49('0xb')](function(_0xf12653){if(_0xf12653){_0x1d512a[_0xab49('0xc')]=_0xf12653[_0xab49('0xc')];_0x1d512a['agentacw']=_0x1d512a['agentcomplete']?_0xf12653[_0xab49('0xd')]:![];_0x1d512a[_0xab49('0xe')]=_0x1d512a[_0xab49('0xf')]?_0xf12653[_0xab49('0x10')]:0x0;}utils[_0xab49('0x11')]('CreateVoiceAgentReport',_0x1d512a);});}else{utils[_0xab49('0x11')](_0xab49('0x12'),_0x1d512a);}if(_0x8db649){delete transfers[_0x1d512a[_0xab49('0x13')]];}else{delete agents[_0x1d512a[_0xab49('0x14')]];}}exports[_0xab49('0x15')]=function(_0x36091a){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x17'),_0x36091a[_0xab49('0x13')]),_0x36091a);agents[_0x36091a[_0xab49('0x14')]]=_0x36091a;agents[_0x36091a['destuniqueid']][_0xab49('0x18')]=utils[_0xab49('0x19')]();agents[_0x36091a[_0xab49('0x14')]][_0xab49('0xa')]=_0xab49('0x1a');agents[_0x36091a['destuniqueid']][_0xab49('0x9')]=null;agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x1b')]=null;utils[_0xab49('0x1c')](util[_0xab49('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x36091a[_0xab49('0x13')],agents[_0x36091a[_0xab49('0x14')]][_0xab49('0x6')],_0x36091a['destuniqueid']));}catch(_0x4c22cd){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][agentcalled]',_0x36091a[_0xab49('0x13')]),_0x4c22cd);}};exports[_0xab49('0x1e')]=function(_0x49b716){try{if(!_[_0xab49('0x1f')](agents[_0x49b716['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716['uniqueid']),_0x49b716);utils[_0xab49('0x1c')](util['format'](_0xab49('0x20'),_0x49b716['uniqueid'],agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x6')],_0x49b716[_0xab49('0x14')]));agents[_0x49b716['destuniqueid']][_0xab49('0x1e')]=!![];agents[_0x49b716['destuniqueid']][_0xab49('0x21')]=utils[_0xab49('0x19')]();agents[_0x49b716['destuniqueid']][_0xab49('0xa')]=_0xab49('0x22');agents[_0x49b716['destuniqueid']]['reason']=_0xab49('0x22');agents[_0x49b716[_0xab49('0x14')]][_0xab49('0x23')]=_0x49b716['ringtime']?parseInt(_0x49b716[_0xab49('0x24')])/0x3e8:0x0;agents[_0x49b716[_0xab49('0x14')]]['talktime']=0x0;unanswered[_0xab49('0x25')](_0x49b716[_0xab49('0x14')]);}}catch(_0x342fdf){utils['error'](util[_0xab49('0x3')]('[%s][agents][agentringnoanswer]',_0x49b716[_0xab49('0x13')]),_0x342fdf);}};exports['queuecallerabandon']=function(_0x19f094){try{_['forIn'](agents,function(_0x134a03,_0x24bd0f){if(_0x134a03[_0xab49('0x13')]==_0x19f094[_0xab49('0x13')]&&!_['includes'](unanswered,_0x134a03[_0xab49('0x14')])){utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094[_0xab49('0x13')]),_0x19f094);utils['info'](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x19f094['uniqueid'],_0x134a03['membername'],_0x134a03[_0xab49('0x14')]));_0x134a03['agentringnoanswer']=!![];_0x134a03[_0xab49('0x21')]=utils[_0xab49('0x19')]();_0x134a03[_0xab49('0xa')]='abandoned';_0x134a03[_0xab49('0x26')]=_0xab49('0x27');_0x134a03[_0xab49('0x23')]=_0x19f094[_0xab49('0x23')];_0x134a03[_0xab49('0x28')]=0x0;writeDB(_0x134a03);}});}catch(_0x56b768){utils[_0xab49('0x1d')](util[_0xab49('0x3')]('[%s][agents][queuecallerabandon]',_0x19f094['uniqueid']),_0x56b768);}};exports[_0xab49('0x29')]=function(_0x29c6cf){try{if(agents[_0x29c6cf[_0xab49('0x14')]]){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x29c6cf);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x2b'),_0x29c6cf[_0xab49('0x13')],agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x6')],_0x29c6cf['destuniqueid']));agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x9')]=_0x29c6cf['connectedlinenum'];agents[_0x29c6cf[_0xab49('0x14')]]['connectedlinename']=_0x29c6cf['connectedlinename'];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];agents[_0x29c6cf[_0xab49('0x14')]][_0xab49('0xa')]='connect';_[_0xab49('0x2d')](agents,function(_0x2cdcbf,_0x2016a9){if(_0x2cdcbf[_0xab49('0x14')]!=_0x29c6cf[_0xab49('0x14')]&&_0x2cdcbf['uniqueid']==_0x29c6cf['uniqueid']){_0x2cdcbf[_0xab49('0x28')]=0x0;_0x2cdcbf[_0xab49('0x23')]=_0x29c6cf[_0xab49('0x24')];_0x2cdcbf['agentringnoanswer']=!![];_0x2cdcbf[_0xab49('0x21')]=utils['now']();_0x2cdcbf['lastevent']='answered_elsewhere';_0x2cdcbf['reason']=_0xab49('0x2e');_0x2cdcbf[_0xab49('0x2f')]=_0x29c6cf[_0xab49('0x14')];_0x2cdcbf[_0xab49('0x30')]=_0x29c6cf[_0xab49('0x6')];writeDB(_0x2cdcbf);}});}}catch(_0x3f3776){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x2a'),_0x29c6cf[_0xab49('0x13')]),_0x3f3776);}};exports['agentcomplete']=function(_0x158042){try{if(!_[_0xab49('0x1f')](agents[_0x158042['destuniqueid']])){utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0x158042);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x32'),_0x158042[_0xab49('0x13')],agents[_0x158042['destuniqueid']][_0xab49('0x6')],_0x158042[_0xab49('0x14')]));agents[_0x158042[_0xab49('0x14')]]['agentcomplete']=!![];agents[_0x158042[_0xab49('0x14')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x158042[_0xab49('0x14')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x158042['destuniqueid']][_0xab49('0x33')],agents[_0x158042[_0xab49('0x14')]][_0xab49('0x2c')]);agents[_0x158042[_0xab49('0x14')]][_0xab49('0x26')]=_0x158042[_0xab49('0x26')];agents[_0x158042['destuniqueid']][_0xab49('0xa')]=_0xab49('0x35');writeDB(agents[_0x158042[_0xab49('0x14')]]);}}catch(_0xca56ce){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x31'),_0x158042[_0xab49('0x13')]),_0xca56ce);}};exports[_0xab49('0x36')]=function(_0xfb7d69){try{if(!_[_0xab49('0x1f')](agents[_0xfb7d69[_0xab49('0x37')]])){utils['debug'](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0xfb7d69);utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x39'),_0xfb7d69[_0xab49('0x13')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x6')],agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x13')]));agents[_0xfb7d69['transfereruniqueid']][_0xab49('0x3a')]=!![];agents[_0xfb7d69[_0xab49('0x37')]]['transfertype']=_0xab49('0x3b');agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3c')]=_0xfb7d69[_0xab49('0x3d')];agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x3e')]=agents[_0xfb7d69[_0xab49('0x37')]][_0xab49('0x13')];}}catch(_0x37cf42){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x38'),_0xfb7d69[_0xab49('0x13')]),_0x37cf42);}};exports[_0xab49('0x3f')]=function(_0x235ba8){try{utils[_0xab49('0x16')](util[_0xab49('0x3')]('[%s][agents][attendedtransfer]',_0x235ba8[_0xab49('0x40')]),_0x235ba8);if(_0x235ba8[_0xab49('0x40')]==_0x235ba8[_0xab49('0x41')]){if(!_[_0xab49('0x1f')](agents[_0x235ba8[_0xab49('0x42')]])){utils['info'](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x42')]]['transfer']=!![];agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x44')]=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x42')]]['transferexten']=_0x235ba8['origtransfererexten'];agents[_0x235ba8[_0xab49('0x42')]]['transferuniqueid']=_0x235ba8[_0xab49('0x40')];}if(_0x235ba8[_0xab49('0x46')]&&agents[_0x235ba8[_0xab49('0x46')]]){agents[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x1;transfers[_0x235ba8[_0xab49('0x46')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x46')]]);transfers[_0x235ba8['transfereeuniqueid']][_0xab49('0x8')]=agents[_0x235ba8[_0xab49('0x42')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x49')]=agents[_0x235ba8['secondtransfereruniqueid']][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x18')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x46')]][_0xab49('0x47')]=0x2;}}else if(_0x235ba8[_0xab49('0x42')]==_0x235ba8[_0xab49('0x4a')]){if(!_['isNil'](agents[_0x235ba8[_0xab49('0x40')]])){utils[_0xab49('0x1c')](util[_0xab49('0x3')](_0xab49('0x43'),_0x235ba8[_0xab49('0x40')],agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x6')]));agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3a')]=!![];agents[_0x235ba8[_0xab49('0x40')]]['transfertype']=_0xab49('0x45');agents[_0x235ba8[_0xab49('0x40')]]['transferexten']=_0x235ba8[_0xab49('0x4b')];agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x3e')]=_0x235ba8['secondtransfereruniqueid'];}if(_0x235ba8[_0xab49('0x4c')]&&agents[_0x235ba8[_0xab49('0x4c')]]){agents[_0x235ba8['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x235ba8[_0xab49('0x4c')]]=_[_0xab49('0x48')](agents[_0x235ba8[_0xab49('0x4c')]]);transfers[_0x235ba8['transfertargetuniqueid']]['calleridnum']=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x8')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x49')]=agents[_0x235ba8[_0xab49('0x40')]][_0xab49('0x49')];transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x18')]=utils['now']();transfers[_0x235ba8['transfertargetuniqueid']][_0xab49('0x2c')]=utils[_0xab49('0x19')]();transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x23')]=0x0;transfers[_0x235ba8[_0xab49('0x4c')]][_0xab49('0x47')]=0x2;}}}catch(_0x108755){utils[_0xab49('0x1d')](util[_0xab49('0x3')](_0xab49('0x4d'),_0x235ba8['origtransfereruniqueid']),_0x108755);}};exports[_0xab49('0x4e')]=function(_0x24fb84){try{utils[_0xab49('0x16')](util[_0xab49('0x3')](_0xab49('0x4f'),_0x24fb84[_0xab49('0x13')]),_0x24fb84);if(agents[_0x24fb84[_0xab49('0x13')]]&&agents[_0x24fb84[_0xab49('0x13')]]['reason']===_0xab49('0x22')){if(_0x24fb84['cause']==='21'){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x50');agents[_0x24fb84['uniqueid']][_0xab49('0xa')]=_0xab49('0x50');}utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);var _0x366a3c=unanswered[_0xab49('0x52')](_0x24fb84[_0xab49('0x13')]);if(_0x366a3c>-0x1){unanswered['splice'](_0x366a3c,0x1);}}if(transfers[_0x24fb84[_0xab49('0x13')]]){transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];transfers[_0x24fb84['uniqueid']][_0xab49('0x33')]=utils[_0xab49('0x19')]();transfers[_0x24fb84['uniqueid']][_0xab49('0x28')]=utils[_0xab49('0x34')](transfers[_0x24fb84['uniqueid']][_0xab49('0x33')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=_0xab49('0x54');transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]='complete';utils['info'](util[_0xab49('0x3')](_0xab49('0x51'),_0x24fb84[_0xab49('0x13')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x6')],transfers[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')],transfers[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(transfers[_0x24fb84[_0xab49('0x13')]],!![]);}if(agents[_0x24fb84['uniqueid']]&&agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]){agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x53')]=!![];agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')]=utils[_0xab49('0x19')]();agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x28')]=utils[_0xab49('0x34')](agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x33')],agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x2c')]);agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0x26')]=agents[_0x24fb84['uniqueid']]['transfer']?_0xab49('0x3a'):_0xab49('0x54');agents[_0x24fb84[_0xab49('0x13')]][_0xab49('0xa')]=_0xab49('0x35');utils[_0xab49('0x1c')](util['format'](_0xab49('0x51'),_0x24fb84['uniqueid'],agents[_0x24fb84['uniqueid']][_0xab49('0x6')],agents[_0x24fb84['uniqueid']][_0xab49('0x26')],agents[_0x24fb84[_0xab49('0x13')]]['lastevent']));writeDB(agents[_0x24fb84[_0xab49('0x13')]]);}}catch(_0x271ee4){utils[_0xab49('0x1d')](util['format']('[%s][agents][hangup]',_0x24fb84[_0xab49('0x13')]),_0x271ee4);}};
\ No newline at end of file
index af25d1f..c1119af 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5f9e=['starttime','billableseconds','error','[%s][calls][hangup]','attendedtransfer','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','Queue','lastdata','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','execif','gotoif','lastapplication','lodash','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','uniqueid','newchannel','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','transfer','destinationchannel','answertime','now','disposition','toNumber','ANSWERED','hangup','debug','callerid','cause-txt','endtime','diffTime'];(function(_0x3c60cc,_0x362436){var _0x17d6f3=function(_0x105c2d){while(--_0x105c2d){_0x3c60cc['push'](_0x3c60cc['shift']());}};_0x17d6f3(++_0x362436);}(_0x5f9e,0x172));var _0xe5f9=function(_0xc1263e,_0x56d738){_0xc1263e=_0xc1263e-0x0;var _0x471f07=_0x5f9e[_0xc1263e];return _0x471f07;};'use strict';var _=require(_0xe5f9('0x0'));var util=require('util');var utils=require('./utils');var dispositions=[_0xe5f9('0x1'),_0xe5f9('0x2'),_0xe5f9('0x2'),_0xe5f9('0x1'),_0xe5f9('0x1'),_0xe5f9('0x1'),'ANSWERED',_0xe5f9('0x3'),'FAILED',_0xe5f9('0x2'),'FAILED'];var channels={};function writeDB(_0x9e16d9){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x6'),_0x9e16d9['uniqueid'],_0x9e16d9[_0xe5f9('0x7')],_0x9e16d9[_0xe5f9('0x8')],_0x9e16d9[_0xe5f9('0x9')],_0x9e16d9['interface'],_0x9e16d9[_0xe5f9('0xa')],_0x9e16d9[_0xe5f9('0xb')],_0x9e16d9['lastevent']));if(_0x9e16d9[_0xe5f9('0xc')]){utils[_0xe5f9('0xd')](_0x9e16d9[_0xe5f9('0xc')])[_0xe5f9('0xe')](function(_0x2ae79a){if(_0x2ae79a){_0x9e16d9[_0xe5f9('0xf')]=_0x2ae79a['id'];}utils[_0xe5f9('0x10')](_0xe5f9('0x11'),_0x9e16d9);});}else{utils[_0xe5f9('0x10')]('CreateVoiceCallReport',_0x9e16d9);}if(channels[_0x9e16d9[_0xe5f9('0x12')]]){delete channels[_0x9e16d9['uniqueid']];}}exports[_0xe5f9('0x13')]=function(_0x391434){try{utils['debug'](util[_0xe5f9('0x5')](_0xe5f9('0x14'),_0x391434[_0xe5f9('0x12')]),_0x391434);if(_0x391434[_0xe5f9('0x12')]==_0x391434['linkedid']&&_0x391434[_0xe5f9('0x7')]!=_0xe5f9('0x15')){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x16'),_0x391434[_0xe5f9('0x12')],_0x391434[_0xe5f9('0x17')],_0x391434[_0xe5f9('0x18')]));channels[_0x391434[_0xe5f9('0x12')]]={'uniqueid':_0x391434[_0xe5f9('0x12')],'accountcode':_0x391434['accountcode'],'source':_0x391434[_0xe5f9('0xa')],'destination':_0x391434[_0xe5f9('0x18')],'destinationcontext':_0x391434[_0xe5f9('0x17')],'channel':_0x391434[_0xe5f9('0x7')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xe5f9('0x1'),'amaflags':_0xe5f9('0x19')};}}catch(_0x4f8580){utils['error'](util[_0xe5f9('0x5')](_0xe5f9('0x14'),_0x391434[_0xe5f9('0x12')]),_0x4f8580);}};exports[_0xe5f9('0x1a')]=function(_0x2dd07e){try{utils['debug'](util[_0xe5f9('0x5')](_0xe5f9('0x1b'),_0x2dd07e['uniqueid']),_0x2dd07e);if(!_[_0xe5f9('0x1c')](channels[_0x2dd07e[_0xe5f9('0x12')]])&&_0x2dd07e[_0xe5f9('0x1d')]==0x6){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x1e'),_0x2dd07e['uniqueid'],_0x2dd07e['context'],_0x2dd07e[_0xe5f9('0x7')]));if(_[_0xe5f9('0x1c')](channels[_0x2dd07e[_0xe5f9('0x12')]][_0xe5f9('0x1f')])){channels[_0x2dd07e[_0xe5f9('0x12')]][_0xe5f9('0x1f')]=utils['now']();}}else if(!_[_0xe5f9('0x1c')](channels[_0x2dd07e[_0xe5f9('0x20')]])&&_0x2dd07e['channelstate']==0x6&&_0x2dd07e[_0xe5f9('0x17')]!=_0xe5f9('0x21')){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2dd07e[_0xe5f9('0x12')],_0x2dd07e[_0xe5f9('0x20')],_0x2dd07e[_0xe5f9('0x17')],_0x2dd07e[_0xe5f9('0x7')]));channels[_0x2dd07e['linkedid']][_0xe5f9('0xc')]=_0x2dd07e['accountcode'];channels[_0x2dd07e['linkedid']][_0xe5f9('0x22')]=_0x2dd07e[_0xe5f9('0x7')];if(_[_0xe5f9('0x1c')](channels[_0x2dd07e['linkedid']][_0xe5f9('0x23')])){channels[_0x2dd07e[_0xe5f9('0x20')]][_0xe5f9('0x23')]=utils[_0xe5f9('0x24')]();}channels[_0x2dd07e[_0xe5f9('0x20')]][_0xe5f9('0x25')]=dispositions[_[_0xe5f9('0x26')](_0x2dd07e[_0xe5f9('0x1d')])]||_0xe5f9('0x27');}}catch(_0x19c338){utils['error'](util['format'](_0xe5f9('0x1b'),_0x2dd07e[_0xe5f9('0x12')]),_0x19c338);}};exports[_0xe5f9('0x28')]=function(_0x196dd2){try{if(!_['isNil'](channels[_0x196dd2['uniqueid']])){utils[_0xe5f9('0x29')](util[_0xe5f9('0x5')]('[%s][calls][hangup]',_0x196dd2[_0xe5f9('0x12')]),_0x196dd2);if(_['isNil'](channels[_0x196dd2[_0xe5f9('0x12')]][_0xe5f9('0x2a')])){channels[_0x196dd2['uniqueid']][_0xe5f9('0x2a')]=_0x196dd2['calleridname']+'\x20<'+_0x196dd2[_0xe5f9('0xa')]+'>';}utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x196dd2[_0xe5f9('0x12')],channels[_0x196dd2[_0xe5f9('0x12')]]['callerid'],_0x196dd2[_0xe5f9('0x2b')]));channels[_0x196dd2[_0xe5f9('0x12')]][_0xe5f9('0x2c')]=utils['now']();channels[_0x196dd2[_0xe5f9('0x12')]]['duration']=utils[_0xe5f9('0x2d')](channels[_0x196dd2[_0xe5f9('0x12')]][_0xe5f9('0x2c')],channels[_0x196dd2[_0xe5f9('0x12')]][_0xe5f9('0x2e')]);channels[_0x196dd2[_0xe5f9('0x12')]][_0xe5f9('0x2f')]=channels[_0x196dd2[_0xe5f9('0x12')]][_0xe5f9('0x23')]?utils['diffTime'](channels[_0x196dd2[_0xe5f9('0x12')]][_0xe5f9('0x2c')],channels[_0x196dd2[_0xe5f9('0x12')]][_0xe5f9('0x23')]):0x0;writeDB(channels[_0x196dd2[_0xe5f9('0x12')]]);}}catch(_0x14def8){utils[_0xe5f9('0x30')](util[_0xe5f9('0x5')](_0xe5f9('0x31'),_0x196dd2[_0xe5f9('0x12')]),_0x14def8);}};exports[_0xe5f9('0x32')]=function(_0x57ef18){try{if(!_[_0xe5f9('0x1c')](channels[_0x57ef18['localtwolinkedid']])){utils[_0xe5f9('0x29')](util['format']('[%s][calls][attendedtransfer]',_0x57ef18[_0xe5f9('0x33')]),_0x57ef18);if(channels[_0x57ef18[_0xe5f9('0x34')]][_0xe5f9('0x7')]==_0x57ef18[_0xe5f9('0x35')]){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x36'),_0x57ef18[_0xe5f9('0x33')],_0x57ef18['localtwolinkedid'],_0x57ef18[_0xe5f9('0x37')]));channels[_0x57ef18[_0xe5f9('0x34')]][_0xe5f9('0x22')]=_0x57ef18['secondtransfererchannel'];channels[_0x57ef18['localtwolinkedid']][_0xe5f9('0x38')]='_attended';}else if(channels[_0x57ef18[_0xe5f9('0x34')]]['channel']=_0x57ef18[_0xe5f9('0x39')]){utils[_0xe5f9('0x4')](util['format'](_0xe5f9('0x36'),_0x57ef18['origtransfereruniqueid'],_0x57ef18[_0xe5f9('0x34')],_0x57ef18[_0xe5f9('0x3a')]));channels[_0x57ef18['localtwolinkedid']]['destinationchannel']=_0x57ef18[_0xe5f9('0x3a')];channels[_0x57ef18['localtwolinkedid']][_0xe5f9('0x38')]='_attended';}}}catch(_0x193357){utils[_0xe5f9('0x30')](util[_0xe5f9('0x5')](_0xe5f9('0x3b'),_0x57ef18['origtransfereruniqueid']),_0x193357);}};exports['musiconholdstart']=function(_0x48a50f){try{if(!_[_0xe5f9('0x1c')](channels[_0x48a50f[_0xe5f9('0x12')]])){utils['debug'](util[_0xe5f9('0x5')](_0xe5f9('0x3c'),_0x48a50f[_0xe5f9('0x12')]),_0x48a50f);channels[_0x48a50f[_0xe5f9('0x12')]][_0xe5f9('0x3d')]=utils[_0xe5f9('0x24')]();utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x48a50f[_0xe5f9('0x12')],channels[_0x48a50f[_0xe5f9('0x12')]][_0xe5f9('0x3d')]));}}catch(_0x30faa4){utils[_0xe5f9('0x30')](util['format'](_0xe5f9('0x3c'),_0x48a50f[_0xe5f9('0x12')]),_0x30faa4);}};exports['musiconholdstop']=function(_0x5d3440){try{if(!_['isNil'](channels[_0x5d3440[_0xe5f9('0x12')]])){utils[_0xe5f9('0x29')](util[_0xe5f9('0x5')](_0xe5f9('0x3e'),_0x5d3440['uniqueid']),_0x5d3440);if(!_[_0xe5f9('0x1c')](channels[_0x5d3440[_0xe5f9('0x12')]]['musiconholdstartAt'])){channels[_0x5d3440[_0xe5f9('0x12')]]['mohtime']+=utils[_0xe5f9('0x2d')](utils[_0xe5f9('0x24')](),channels[_0x5d3440[_0xe5f9('0x12')]][_0xe5f9('0x3d')]);utils['info'](util[_0xe5f9('0x5')](_0xe5f9('0x3f'),_0x5d3440[_0xe5f9('0x12')],channels[_0x5d3440[_0xe5f9('0x12')]]['mohtime']));delete channels[_0x5d3440[_0xe5f9('0x12')]][_0xe5f9('0x3d')];}}}catch(_0x1b0f42){utils[_0xe5f9('0x30')](util[_0xe5f9('0x5')](_0xe5f9('0x3e'),_0x5d3440[_0xe5f9('0x12')]),_0x1b0f42);}};exports[_0xe5f9('0x40')]=function(_0x4180fc){try{if(!_[_0xe5f9('0x1c')](channels[_0x4180fc[_0xe5f9('0x12')]])){utils[_0xe5f9('0x29')](util['format']('[%s][calls][varset]',_0x4180fc[_0xe5f9('0x12')]),_0x4180fc);if(!_['isNil'](_0x4180fc['variable'][_0xe5f9('0x41')])){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x42'),_0x4180fc[_0xe5f9('0x12')],_0x4180fc[_0xe5f9('0x43')]));channels[_0x4180fc['uniqueid']][_0xe5f9('0x44')]=_0x4180fc[_0xe5f9('0x43')];}if(!_[_0xe5f9('0x1c')](_0x4180fc[_0xe5f9('0x45')]['xmd-phone'])){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x46'),_0x4180fc[_0xe5f9('0x12')],_0x4180fc['value']));channels[_0x4180fc[_0xe5f9('0x12')]][_0xe5f9('0x47')]=_0x4180fc[_0xe5f9('0x43')];channels[_0x4180fc[_0xe5f9('0x12')]]['callerid']='\x22'+_0x4180fc[_0xe5f9('0x43')]+_0xe5f9('0x48')+_0x4180fc['value']+'>';}if(!_['isNil'](_0x4180fc[_0xe5f9('0x45')][_0xe5f9('0x49')])||!_[_0xe5f9('0x1c')](_0x4180fc[_0xe5f9('0x45')][_0xe5f9('0x4a')])){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x4180fc[_0xe5f9('0x12')],!_[_0xe5f9('0x1c')](_0x4180fc['variable'][_0xe5f9('0x49')])?_0xe5f9('0x49'):_0xe5f9('0x4a'),_0x4180fc[_0xe5f9('0x43')]));channels[_0x4180fc['uniqueid']][_0xe5f9('0x2a')]=_0x4180fc[_0xe5f9('0x43')];}if(!_[_0xe5f9('0x1c')](_0x4180fc[_0xe5f9('0x45')]['xmd-queue'])||!_[_0xe5f9('0x1c')](_0x4180fc[_0xe5f9('0x45')][_0xe5f9('0x4b')])){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x4c'),_0x4180fc['uniqueid'],!_[_0xe5f9('0x1c')](_0x4180fc[_0xe5f9('0x45')][_0xe5f9('0x4d')])?_0xe5f9('0x4d'):_0xe5f9('0x4b'),_0x4180fc[_0xe5f9('0x43')]));channels[_0x4180fc['uniqueid']]['lastapplication']=_0xe5f9('0x4e');channels[_0x4180fc[_0xe5f9('0x12')]][_0xe5f9('0x4f')]=_0x4180fc[_0xe5f9('0x43')];channels[_0x4180fc[_0xe5f9('0x12')]][_0xe5f9('0x8')]=!![];}if(!_[_0xe5f9('0x1c')](_0x4180fc['variable'][_0xe5f9('0x50')])){utils[_0xe5f9('0x4')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4180fc[_0xe5f9('0x12')],_0x4180fc['value']));channels[_0x4180fc[_0xe5f9('0x12')]][_0xe5f9('0x51')]=_0x4180fc[_0xe5f9('0x43')];}if(!_[_0xe5f9('0x1c')](_0x4180fc[_0xe5f9('0x45')]['xmd-cdrtype'])){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x52'),_0x4180fc[_0xe5f9('0x12')],_0x4180fc['value']));channels[_0x4180fc[_0xe5f9('0x12')]]['type']=_0x4180fc[_0xe5f9('0x43')];}if(!_[_0xe5f9('0x1c')](_0x4180fc[_0xe5f9('0x45')][_0xe5f9('0x53')])){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x54'),_0x4180fc[_0xe5f9('0x12')],_0x4180fc[_0xe5f9('0x43')]));channels[_0x4180fc[_0xe5f9('0x12')]][_0xe5f9('0x55')]=_0x4180fc[_0xe5f9('0x43')];}if(!_['isNil'](_0x4180fc[_0xe5f9('0x45')][_0xe5f9('0x56')])){utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x57'),_0x4180fc[_0xe5f9('0x12')],_0x4180fc[_0xe5f9('0x43')]));channels[_0x4180fc[_0xe5f9('0x12')]][_0xe5f9('0x56')]=_0x4180fc[_0xe5f9('0x43')];}}}catch(_0x1f8593){utils[_0xe5f9('0x30')](util[_0xe5f9('0x5')](_0xe5f9('0x58'),_0x4180fc['uniqueid']),_0x1f8593);}};exports['newexten']=function(_0x26fd08){try{if(!_['isNil'](channels[_0x26fd08[_0xe5f9('0x12')]])){utils[_0xe5f9('0x29')](util[_0xe5f9('0x5')](_0xe5f9('0x59'),_0x26fd08[_0xe5f9('0x12')]),_0x26fd08);utils[_0xe5f9('0x4')](util[_0xe5f9('0x5')](_0xe5f9('0x5a'),_0x26fd08[_0xe5f9('0x12')],_0x26fd08[_0xe5f9('0x5b')],_0x26fd08[_0xe5f9('0x5c')]));if(_0x26fd08[_0xe5f9('0x5b')][_0xe5f9('0x5d')]()==_0xe5f9('0x5e')&&_[_0xe5f9('0x5f')](_0x26fd08['appdata'][_0xe5f9('0x5d')](),_0xe5f9('0x60'))){var _0x463923=_0x26fd08[_0xe5f9('0x5c')]['split']('=');var _0x221aa6=_0x463923[0x0][_0xe5f9('0x61')](_0x463923[0x0][_0xe5f9('0x62')]('(')+0x1,_0x463923[0x0][_0xe5f9('0x62')](')'));var _0x4434cb=_0x463923[0x1];channels[_0x26fd08[_0xe5f9('0x12')]][_0x221aa6]=_0x4434cb;}if(!_[_0xe5f9('0x63')]([_0xe5f9('0x28'),_0xe5f9('0x64'),_0xe5f9('0x65'),_0xe5f9('0x5e'),_0xe5f9('0x66')],_0x26fd08['application'][_0xe5f9('0x5d')]())){channels[_0x26fd08[_0xe5f9('0x12')]][_0xe5f9('0x67')]=_0x26fd08[_0xe5f9('0x5b')];channels[_0x26fd08[_0xe5f9('0x12')]]['lastdata']=_0x26fd08[_0xe5f9('0x5c')];}}}catch(_0x26f3f0){utils[_0xe5f9('0x30')](util[_0xe5f9('0x5')]('[%s][calls][newexten]',_0x26fd08['uniqueid']),_0x26f3f0);}};
\ No newline at end of file
+var _0xb51f=['attendedtransfer','[%s][calls][attendedtransfer]','origtransfereruniqueid','localtwolinkedid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','split','substring','lastIndexOf','includes','gotoif','lastapplication','[%s][calls][newexten]','lodash','util','./utils','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','connectedlinenum','lastevent','accountcode','getUserByInternal','request','CreateVoiceCallReport','newchannel','debug','format','[%s][calls][newchannel]','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','exten','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','cause-txt','endtime','starttime','billableseconds','diffTime'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xb51f,0xfb));var _0xfb51=function(_0x53e3fa,_0x50c5f2){_0x53e3fa=_0x53e3fa-0x0;var _0xe8584a=_0xb51f[_0x53e3fa];return _0xe8584a;};'use strict';var _=require(_0xfb51('0x0'));var util=require(_0xfb51('0x1'));var utils=require(_0xfb51('0x2'));var dispositions=[_0xfb51('0x3'),_0xfb51('0x4'),_0xfb51('0x4'),'NO\x20ANSWER',_0xfb51('0x3'),_0xfb51('0x3'),_0xfb51('0x5'),_0xfb51('0x6'),_0xfb51('0x4'),_0xfb51('0x4'),_0xfb51('0x4')];var channels={};function writeDB(_0x5c1609){utils[_0xfb51('0x7')](util['format'](_0xfb51('0x8'),_0x5c1609[_0xfb51('0x9')],_0x5c1609[_0xfb51('0xa')],_0x5c1609[_0xfb51('0xb')],_0x5c1609[_0xfb51('0xc')],_0x5c1609['interface'],_0x5c1609['calleridnum'],_0x5c1609[_0xfb51('0xd')],_0x5c1609[_0xfb51('0xe')]));if(_0x5c1609[_0xfb51('0xf')]){utils[_0xfb51('0x10')](_0x5c1609[_0xfb51('0xf')])['then'](function(_0x2a73d8){if(_0x2a73d8){_0x5c1609['UserId']=_0x2a73d8['id'];}utils[_0xfb51('0x11')](_0xfb51('0x12'),_0x5c1609);});}else{utils[_0xfb51('0x11')](_0xfb51('0x12'),_0x5c1609);}if(channels[_0x5c1609[_0xfb51('0x9')]]){delete channels[_0x5c1609['uniqueid']];}}exports[_0xfb51('0x13')]=function(_0x1c16ae){try{utils[_0xfb51('0x14')](util[_0xfb51('0x15')](_0xfb51('0x16'),_0x1c16ae['uniqueid']),_0x1c16ae);if(_0x1c16ae['uniqueid']==_0x1c16ae[_0xfb51('0x17')]&&_0x1c16ae[_0xfb51('0xa')]!='OutgoingSpoolFailed'){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x18'),_0x1c16ae[_0xfb51('0x9')],_0x1c16ae[_0xfb51('0x19')],_0x1c16ae['exten']));channels[_0x1c16ae[_0xfb51('0x9')]]={'uniqueid':_0x1c16ae[_0xfb51('0x9')],'accountcode':_0x1c16ae[_0xfb51('0xf')],'source':_0x1c16ae[_0xfb51('0x1a')],'destination':_0x1c16ae[_0xfb51('0x1b')],'destinationcontext':_0x1c16ae['context'],'channel':_0x1c16ae[_0xfb51('0xa')],'starttime':utils[_0xfb51('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xfb51('0x3'),'amaflags':_0xfb51('0x1d')};}}catch(_0x5c08d5){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')]('[%s][calls][newchannel]',_0x1c16ae['uniqueid']),_0x5c08d5);}};exports['newstate']=function(_0x49feac){try{utils['debug'](util[_0xfb51('0x15')](_0xfb51('0x1f'),_0x49feac[_0xfb51('0x9')]),_0x49feac);if(!_[_0xfb51('0x20')](channels[_0x49feac['uniqueid']])&&_0x49feac[_0xfb51('0x21')]==0x6){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x22'),_0x49feac[_0xfb51('0x9')],_0x49feac[_0xfb51('0x19')],_0x49feac['channel']));if(_[_0xfb51('0x20')](channels[_0x49feac['uniqueid']][_0xfb51('0x23')])){channels[_0x49feac['uniqueid']][_0xfb51('0x23')]=utils[_0xfb51('0x1c')]();}}else if(!_['isNil'](channels[_0x49feac[_0xfb51('0x17')]])&&_0x49feac['channelstate']==0x6&&_0x49feac[_0xfb51('0x19')]!=_0xfb51('0x24')){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x25'),_0x49feac[_0xfb51('0x9')],_0x49feac[_0xfb51('0x17')],_0x49feac[_0xfb51('0x19')],_0x49feac[_0xfb51('0xa')]));channels[_0x49feac['linkedid']][_0xfb51('0xf')]=_0x49feac[_0xfb51('0xf')];channels[_0x49feac[_0xfb51('0x17')]][_0xfb51('0x26')]=_0x49feac[_0xfb51('0xa')];if(_[_0xfb51('0x20')](channels[_0x49feac[_0xfb51('0x17')]]['answertime'])){channels[_0x49feac[_0xfb51('0x17')]][_0xfb51('0x27')]=utils[_0xfb51('0x1c')]();}channels[_0x49feac[_0xfb51('0x17')]][_0xfb51('0x28')]=dispositions[_[_0xfb51('0x29')](_0x49feac[_0xfb51('0x21')])]||_0xfb51('0x5');}}catch(_0x3a326d){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')](_0xfb51('0x1f'),_0x49feac[_0xfb51('0x9')]),_0x3a326d);}};exports[_0xfb51('0x2a')]=function(_0x1358ba){try{if(!_[_0xfb51('0x20')](channels[_0x1358ba[_0xfb51('0x9')]])){utils[_0xfb51('0x14')](util[_0xfb51('0x15')]('[%s][calls][hangup]',_0x1358ba[_0xfb51('0x9')]),_0x1358ba);if(_['isNil'](channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2b')])){channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2b')]=_0x1358ba['calleridname']+'\x20<'+_0x1358ba[_0xfb51('0x1a')]+'>';}utils[_0xfb51('0x7')](util[_0xfb51('0x15')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x1358ba[_0xfb51('0x9')],channels[_0x1358ba[_0xfb51('0x9')]]['callerid'],_0x1358ba[_0xfb51('0x2c')]));channels[_0x1358ba['uniqueid']][_0xfb51('0x2d')]=utils[_0xfb51('0x1c')]();channels[_0x1358ba['uniqueid']]['duration']=utils['diffTime'](channels[_0x1358ba[_0xfb51('0x9')]]['endtime'],channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2e')]);channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2f')]=channels[_0x1358ba['uniqueid']][_0xfb51('0x27')]?utils[_0xfb51('0x30')](channels[_0x1358ba[_0xfb51('0x9')]][_0xfb51('0x2d')],channels[_0x1358ba[_0xfb51('0x9')]]['answertime']):0x0;writeDB(channels[_0x1358ba[_0xfb51('0x9')]]);}}catch(_0x5b823f){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')]('[%s][calls][hangup]',_0x1358ba['uniqueid']),_0x5b823f);}};exports[_0xfb51('0x31')]=function(_0x1a47ca){try{if(!_[_0xfb51('0x20')](channels[_0x1a47ca['localtwolinkedid']])){utils['debug'](util[_0xfb51('0x15')](_0xfb51('0x32'),_0x1a47ca[_0xfb51('0x33')]),_0x1a47ca);if(channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0xa')]==_0x1a47ca[_0xfb51('0x35')]){utils['info'](util[_0xfb51('0x15')](_0xfb51('0x36'),_0x1a47ca[_0xfb51('0x33')],_0x1a47ca[_0xfb51('0x34')],_0x1a47ca[_0xfb51('0x37')]));channels[_0x1a47ca[_0xfb51('0x34')]]['destinationchannel']=_0x1a47ca[_0xfb51('0x37')];channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0x38')]='_attended';}else if(channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0xa')]=_0x1a47ca['transfertargetchannel']){utils[_0xfb51('0x7')](util[_0xfb51('0x15')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x1a47ca['origtransfereruniqueid'],_0x1a47ca['localtwolinkedid'],_0x1a47ca[_0xfb51('0x39')]));channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0x26')]=_0x1a47ca[_0xfb51('0x39')];channels[_0x1a47ca[_0xfb51('0x34')]][_0xfb51('0x38')]='_attended';}}}catch(_0xf2fb15){utils[_0xfb51('0x1e')](util['format'](_0xfb51('0x32'),_0x1a47ca[_0xfb51('0x33')]),_0xf2fb15);}};exports[_0xfb51('0x3a')]=function(_0x46fecf){try{if(!_[_0xfb51('0x20')](channels[_0x46fecf[_0xfb51('0x9')]])){utils[_0xfb51('0x14')](util['format'](_0xfb51('0x3b'),_0x46fecf['uniqueid']),_0x46fecf);channels[_0x46fecf[_0xfb51('0x9')]][_0xfb51('0x3c')]=utils[_0xfb51('0x1c')]();utils['info'](util[_0xfb51('0x15')](_0xfb51('0x3d'),_0x46fecf[_0xfb51('0x9')],channels[_0x46fecf[_0xfb51('0x9')]][_0xfb51('0x3c')]));}}catch(_0x267653){utils['error'](util[_0xfb51('0x15')](_0xfb51('0x3b'),_0x46fecf[_0xfb51('0x9')]),_0x267653);}};exports[_0xfb51('0x3e')]=function(_0x23aea1){try{if(!_['isNil'](channels[_0x23aea1['uniqueid']])){utils[_0xfb51('0x14')](util[_0xfb51('0x15')](_0xfb51('0x3f'),_0x23aea1['uniqueid']),_0x23aea1);if(!_[_0xfb51('0x20')](channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x3c')])){channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x40')]+=utils['diffTime'](utils[_0xfb51('0x1c')](),channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x3c')]);utils['info'](util[_0xfb51('0x15')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x23aea1[_0xfb51('0x9')],channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x40')]));delete channels[_0x23aea1[_0xfb51('0x9')]][_0xfb51('0x3c')];}}}catch(_0x18c503){utils['error'](util['format']('[%s][calls][musiconholdstop]',_0x23aea1[_0xfb51('0x9')]),_0x18c503);}};exports[_0xfb51('0x41')]=function(_0x5014a0){try{if(!_[_0xfb51('0x20')](channels[_0x5014a0[_0xfb51('0x9')]])){utils['debug'](util[_0xfb51('0x15')]('[%s][calls][varset]',_0x5014a0['uniqueid']),_0x5014a0);if(!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')]['xmd-originatecalleridnum'])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x43'),_0x5014a0['uniqueid'],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x45')]=_0x5014a0[_0xfb51('0x44')];}if(!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')]['xmd-phone'])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5014a0[_0xfb51('0x9')],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]]['destination']=_0x5014a0[_0xfb51('0x44')];channels[_0x5014a0['uniqueid']]['callerid']='\x22'+_0x5014a0[_0xfb51('0x44')]+_0xfb51('0x46')+_0x5014a0[_0xfb51('0x44')]+'>';}if(!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')]['xmd-callerid-preview'])||!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')][_0xfb51('0x47')])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x48'),_0x5014a0[_0xfb51('0x9')],!_[_0xfb51('0x20')](_0x5014a0['variable'][_0xfb51('0x49')])?_0xfb51('0x49'):'xmd-callerid',_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]]['callerid']=_0x5014a0[_0xfb51('0x44')];}if(!_['isNil'](_0x5014a0['variable']['xmd-queue'])||!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')][_0xfb51('0x4a')])){utils[_0xfb51('0x7')](util['format']('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5014a0['uniqueid'],!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')][_0xfb51('0x4b')])?_0xfb51('0x4b'):'xmcs-queue',_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0['uniqueid']]['lastapplication']='Queue';channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x4c')]=_0x5014a0['value'];channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0xb')]=!![];}if(!_['isNil'](_0x5014a0['variable'][_0xfb51('0x4d')])){utils[_0xfb51('0x7')](util['format'](_0xfb51('0x4e'),_0x5014a0[_0xfb51('0x9')],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0['uniqueid']][_0xfb51('0x4f')]=_0x5014a0[_0xfb51('0x44')];}if(!_[_0xfb51('0x20')](_0x5014a0[_0xfb51('0x42')]['xmd-cdrtype'])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x50'),_0x5014a0[_0xfb51('0x9')],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x51')]=_0x5014a0[_0xfb51('0x44')];}if(!_[_0xfb51('0x20')](_0x5014a0['variable'][_0xfb51('0x52')])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x5014a0['uniqueid'],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x53')]=_0x5014a0[_0xfb51('0x44')];}if(!_['isNil'](_0x5014a0['variable'][_0xfb51('0x54')])){utils[_0xfb51('0x7')](util[_0xfb51('0x15')](_0xfb51('0x55'),_0x5014a0[_0xfb51('0x9')],_0x5014a0[_0xfb51('0x44')]));channels[_0x5014a0[_0xfb51('0x9')]][_0xfb51('0x54')]=_0x5014a0[_0xfb51('0x44')];}}}catch(_0x486270){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')]('[%s][calls][varset]',_0x5014a0[_0xfb51('0x9')]),_0x486270);}};exports[_0xfb51('0x56')]=function(_0x3e308b){try{if(!_['isNil'](channels[_0x3e308b['uniqueid']])){utils[_0xfb51('0x14')](util[_0xfb51('0x15')]('[%s][calls][newexten]',_0x3e308b['uniqueid']),_0x3e308b);utils['info'](util[_0xfb51('0x15')](_0xfb51('0x57'),_0x3e308b[_0xfb51('0x9')],_0x3e308b[_0xfb51('0x58')],_0x3e308b[_0xfb51('0x59')]));if(_0x3e308b[_0xfb51('0x58')][_0xfb51('0x5a')]()==_0xfb51('0x5b')&&_['startsWith'](_0x3e308b[_0xfb51('0x59')]['toLowerCase'](),_0xfb51('0x5c'))){var _0x1c364f=_0x3e308b[_0xfb51('0x59')][_0xfb51('0x5d')]('=');var _0x36c41b=_0x1c364f[0x0][_0xfb51('0x5e')](_0x1c364f[0x0][_0xfb51('0x5f')]('(')+0x1,_0x1c364f[0x0][_0xfb51('0x5f')](')'));var _0x2a9452=_0x1c364f[0x1];channels[_0x3e308b[_0xfb51('0x9')]][_0x36c41b]=_0x2a9452;}if(!_[_0xfb51('0x60')]([_0xfb51('0x2a'),'noop','execif',_0xfb51('0x5b'),_0xfb51('0x61')],_0x3e308b[_0xfb51('0x58')][_0xfb51('0x5a')]())){channels[_0x3e308b['uniqueid']][_0xfb51('0x62')]=_0x3e308b[_0xfb51('0x58')];channels[_0x3e308b[_0xfb51('0x9')]][_0xfb51('0x4c')]=_0x3e308b[_0xfb51('0x59')];}}}catch(_0x5975f3){utils[_0xfb51('0x1e')](util[_0xfb51('0x15')](_0xfb51('0x63'),_0x3e308b[_0xfb51('0x9')]),_0x5975f3);}};
\ No newline at end of file
index 0f14f8d..60d39c5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xeebc=['error','[core]\x20error','[core]\x20close','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','[core]\x20fullybooted'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0xeebc,0x6f));var _0xceeb=function(_0x10897a,_0x408abb){_0x10897a=_0x10897a-0x0;var _0xad0cfc=_0xeebc[_0x10897a];return _0xad0cfc;};'use strict';var utils=require(_0xceeb('0x0'));exports[_0xceeb('0x1')]=function(){utils[_0xceeb('0x2')](_0xceeb('0x3'));};exports['shutdown']=function(){utils[_0xceeb('0x2')](_0xceeb('0x4'));};exports['fullybooted']=function(){utils[_0xceeb('0x2')](_0xceeb('0x5'));};exports['error']=function(_0x400e10){utils[_0xceeb('0x6')](_0xceeb('0x7'),_0x400e10);};exports['close']=function(){utils['info'](_0xceeb('0x8'));};exports['managerevent']=function(_0x364eb5){};
\ No newline at end of file
+var _0xb59f=['shutdown','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','connect','info'];(function(_0x70a7bc,_0x8cccc0){var _0x379a84=function(_0x217cdb){while(--_0x217cdb){_0x70a7bc['push'](_0x70a7bc['shift']());}};_0x379a84(++_0x8cccc0);}(_0xb59f,0x126));var _0xfb59=function(_0x280861,_0x17e5fc){_0x280861=_0x280861-0x0;var _0x22256a=_0xb59f[_0x280861];return _0x22256a;};'use strict';var utils=require('./utils');exports[_0xfb59('0x0')]=function(){utils[_0xfb59('0x1')]('[core]\x20connected');};exports[_0xfb59('0x2')]=function(){utils[_0xfb59('0x1')](_0xfb59('0x3'));};exports[_0xfb59('0x4')]=function(){utils[_0xfb59('0x1')]('[core]\x20fullybooted');};exports[_0xfb59('0x5')]=function(_0x5333b2){utils[_0xfb59('0x5')](_0xfb59('0x6'),_0x5333b2);};exports[_0xfb59('0x7')]=function(){utils[_0xfb59('0x1')]('[core]\x20close');};exports['managerevent']=function(_0x51668a){};
\ No newline at end of file
index eb9a260..cf998ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xebce=['dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][hangup]','calleridname','cause-txt','complete','duration','endtime','holdtime','diffTime','billableseconds','info','format','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','appdata','cdr(routeid)','split','error','varset','[%s][dials][varset]','variable','outboundrouteid','value','dialbegin','isNil','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called'];(function(_0x12d6de,_0xccc040){var _0x32923b=function(_0x1b150f){while(--_0x1b150f){_0x12d6de['push'](_0x12d6de['shift']());}};_0x32923b(++_0xccc040);}(_0xebce,0xfb));var _0xeebc=function(_0x3e9942,_0x12e0e6){_0x3e9942=_0x3e9942-0x0;var _0x2f7e3f=_0xebce[_0x3e9942];return _0x2f7e3f;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x36e4cb){utils[_0xeebc('0x0')](util[_0xeebc('0x1')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x36e4cb[_0xeebc('0x2')],_0x36e4cb[_0xeebc('0x3')],_0x36e4cb[_0xeebc('0x4')],_0x36e4cb[_0xeebc('0x5')],_0x36e4cb[_0xeebc('0x6')],_0x36e4cb[_0xeebc('0x7')]));utils[_0xeebc('0x8')]('CreateVoiceDialReport',_0x36e4cb);delete dials[_0x36e4cb[_0xeebc('0x2')]];}exports['newexten']=function(_0x1b34b2){try{utils[_0xeebc('0x9')](util['format'](_0xeebc('0xa'),_0x1b34b2[_0xeebc('0x2')]),_0x1b34b2);utils[_0xeebc('0x0')](util[_0xeebc('0x1')](_0xeebc('0xb'),_0x1b34b2[_0xeebc('0x2')],_0x1b34b2[_0xeebc('0xc')],_0x1b34b2['appdata']));if(_0x1b34b2[_0xeebc('0xc')][_0xeebc('0xd')]()==_0xeebc('0xe')&&_[_0xeebc('0xf')](_0x1b34b2[_0xeebc('0x10')][_0xeebc('0xd')](),_0xeebc('0x11'))){var _0x2b2514=_0x1b34b2[_0xeebc('0x10')][_0xeebc('0x12')]('=');dials[_0x1b34b2[_0xeebc('0x2')]]={'routeId':_0x2b2514[0x1]};}}catch(_0xaf454d){utils[_0xeebc('0x13')](util[_0xeebc('0x1')]('[%s][dials][newexten]',_0x1b34b2[_0xeebc('0x2')]),_0xaf454d);}};exports[_0xeebc('0x14')]=function(_0x429ccb){try{utils[_0xeebc('0x9')](util[_0xeebc('0x1')](_0xeebc('0x15'),_0x429ccb[_0xeebc('0x2')]),_0x429ccb);if(!_['isNil'](_0x429ccb[_0xeebc('0x16')][_0xeebc('0x17')])){utils['info'](util[_0xeebc('0x1')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x429ccb[_0xeebc('0x2')],_0x429ccb[_0xeebc('0x18')]));dials[_0x429ccb[_0xeebc('0x2')]]={'routeId':_0x429ccb[_0xeebc('0x18')]};}}catch(_0x5a5afb){utils[_0xeebc('0x13')](util[_0xeebc('0x1')](_0xeebc('0x15'),_0x429ccb[_0xeebc('0x2')]),_0x5a5afb);}};exports[_0xeebc('0x19')]=function(_0xfe2733){try{if(!_[_0xeebc('0x1a')](dials[_0xfe2733[_0xeebc('0x2')]])){utils[_0xeebc('0x9')](util['format']('[%s][dials][dialbegin]',_0xfe2733[_0xeebc('0x2')]),_0xfe2733);dials[_0xfe2733[_0xeebc('0x2')]]=_['assign'](dials[_0xfe2733[_0xeebc('0x2')]],_0xfe2733);dials[_0xfe2733['uniqueid']][_0xeebc('0x1b')]=utils[_0xeebc('0x1c')]();dials[_0xfe2733[_0xeebc('0x2')]][_0xeebc('0x1d')]='called';utils[_0xeebc('0x0')](util['format'](_0xeebc('0x1e'),_0xfe2733[_0xeebc('0x2')],dials[_0xfe2733[_0xeebc('0x2')]][_0xeebc('0x1b')]));}}catch(_0x2e25c8){utils['error'](util[_0xeebc('0x1')]('[%s][dials][dialbegin]',_0xfe2733[_0xeebc('0x2')]),_0x2e25c8);}};exports[_0xeebc('0x1f')]=function(_0x333efb){try{if(!_['isNil'](dials[_0x333efb[_0xeebc('0x2')]])){utils['debug'](util[_0xeebc('0x1')](_0xeebc('0x20'),_0x333efb['uniqueid']),_0x333efb);dials[_0x333efb[_0xeebc('0x2')]][_0xeebc('0x7')]=_0x333efb[_0xeebc('0x7')];if(_0x333efb['dialstatus']==_0xeebc('0x21')){dials[_0x333efb[_0xeebc('0x2')]]=_[_0xeebc('0x22')](dials[_0x333efb['uniqueid']],_0x333efb);dials[_0x333efb[_0xeebc('0x2')]][_0xeebc('0x23')]=utils[_0xeebc('0x1c')]();dials[_0x333efb[_0xeebc('0x2')]]['lastevent']=_0xeebc('0x24');utils[_0xeebc('0x0')](util['format'](_0xeebc('0x25'),_0x333efb[_0xeebc('0x2')],_0x333efb['dialstatus'],dials[_0x333efb[_0xeebc('0x2')]][_0xeebc('0x23')]));}else{utils[_0xeebc('0x0')](util[_0xeebc('0x1')]('[%s][dials][dialend]\x20dialstatus:%s',_0x333efb[_0xeebc('0x2')],_0x333efb['dialstatus']));}}}catch(_0x38e54c){utils[_0xeebc('0x13')](util[_0xeebc('0x1')]('[%s][dials][dialend]',_0x333efb['uniqueid']),_0x38e54c);}};exports['hangup']=function(_0x37f642){try{if(!_[_0xeebc('0x1a')](dials[_0x37f642[_0xeebc('0x2')]])){utils[_0xeebc('0x9')](util[_0xeebc('0x1')](_0xeebc('0x26'),_0x37f642[_0xeebc('0x2')]),_0x37f642);utils['info'](util[_0xeebc('0x1')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x37f642[_0xeebc('0x2')],_0x37f642[_0xeebc('0x5')],_0x37f642[_0xeebc('0x27')],_0x37f642[_0xeebc('0x28')]));dials[_0x37f642[_0xeebc('0x2')]]=_[_0xeebc('0x22')](dials[_0x37f642['uniqueid']],{'endtime':utils[_0xeebc('0x1c')](),'lastevent':_0xeebc('0x29')});dials[_0x37f642[_0xeebc('0x2')]][_0xeebc('0x2a')]=utils['diffTime'](dials[_0x37f642[_0xeebc('0x2')]][_0xeebc('0x2b')],dials[_0x37f642[_0xeebc('0x2')]]['starttime']);dials[_0x37f642[_0xeebc('0x2')]][_0xeebc('0x2c')]=utils[_0xeebc('0x2d')](dials[_0x37f642['uniqueid']]['answertime']||dials[_0x37f642[_0xeebc('0x2')]][_0xeebc('0x2b')],dials[_0x37f642['uniqueid']][_0xeebc('0x1b')]);dials[_0x37f642[_0xeebc('0x2')]][_0xeebc('0x2e')]=dials[_0x37f642[_0xeebc('0x2')]]['answertime']?utils[_0xeebc('0x2d')](dials[_0x37f642[_0xeebc('0x2')]][_0xeebc('0x2b')],dials[_0x37f642[_0xeebc('0x2')]]['answertime']):0x0;writeDB(dials[_0x37f642['uniqueid']]);}}catch(_0xb0cd7a){utils[_0xeebc('0x13')](util['format'](_0xeebc('0x26'),_0x37f642['uniqueid']),_0xb0cd7a);}};
\ No newline at end of file
+var _0x0a4d=['[%s][dials][dialbegin]','assign','starttime','now','called','dialend','[%s][dials][dialend]','ANSWER','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','diffTime','endtime','holdtime','billableseconds','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstatus','request','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr(routeid)','split','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','error'];(function(_0x133277,_0xb1d6b2){var _0x5b4a22=function(_0x484c26){while(--_0x484c26){_0x133277['push'](_0x133277['shift']());}};_0x5b4a22(++_0xb1d6b2);}(_0x0a4d,0xd6));var _0xd0a4=function(_0x4e29cf,_0x38f059){_0x4e29cf=_0x4e29cf-0x0;var _0x4e8941=_0x0a4d[_0x4e29cf];return _0x4e8941;};'use strict';var _=require(_0xd0a4('0x0'));var util=require('util');var utils=require(_0xd0a4('0x1'));var dials={};function writeDB(_0x2e33a){utils['info'](util[_0xd0a4('0x2')](_0xd0a4('0x3'),_0x2e33a[_0xd0a4('0x4')],_0x2e33a[_0xd0a4('0x5')],_0x2e33a['dialstring'],_0x2e33a['calleridnum'],_0x2e33a['connectedlinenum'],_0x2e33a[_0xd0a4('0x6')]));utils[_0xd0a4('0x7')]('CreateVoiceDialReport',_0x2e33a);delete dials[_0x2e33a['uniqueid']];}exports[_0xd0a4('0x8')]=function(_0x40989c){try{utils[_0xd0a4('0x9')](util[_0xd0a4('0x2')](_0xd0a4('0xa'),_0x40989c[_0xd0a4('0x4')]),_0x40989c);utils[_0xd0a4('0xb')](util['format'](_0xd0a4('0xc'),_0x40989c[_0xd0a4('0x4')],_0x40989c[_0xd0a4('0xd')],_0x40989c[_0xd0a4('0xe')]));if(_0x40989c[_0xd0a4('0xd')]['toLowerCase']()==_0xd0a4('0xf')&&_[_0xd0a4('0x10')](_0x40989c[_0xd0a4('0xe')]['toLowerCase'](),_0xd0a4('0x11'))){var _0x389e27=_0x40989c[_0xd0a4('0xe')][_0xd0a4('0x12')]('=');dials[_0x40989c['uniqueid']]={'routeId':_0x389e27[0x1]};}}catch(_0x54b297){utils['error'](util[_0xd0a4('0x2')](_0xd0a4('0xa'),_0x40989c[_0xd0a4('0x4')]),_0x54b297);}};exports[_0xd0a4('0x13')]=function(_0xc11aa7){try{utils[_0xd0a4('0x9')](util[_0xd0a4('0x2')](_0xd0a4('0x14'),_0xc11aa7['uniqueid']),_0xc11aa7);if(!_[_0xd0a4('0x15')](_0xc11aa7[_0xd0a4('0x16')][_0xd0a4('0x17')])){utils[_0xd0a4('0xb')](util[_0xd0a4('0x2')](_0xd0a4('0x18'),_0xc11aa7[_0xd0a4('0x4')],_0xc11aa7['value']));dials[_0xc11aa7['uniqueid']]={'routeId':_0xc11aa7['value']};}}catch(_0x26e72d){utils[_0xd0a4('0x19')](util[_0xd0a4('0x2')](_0xd0a4('0x14'),_0xc11aa7[_0xd0a4('0x4')]),_0x26e72d);}};exports['dialbegin']=function(_0x3b196e){try{if(!_[_0xd0a4('0x15')](dials[_0x3b196e['uniqueid']])){utils[_0xd0a4('0x9')](util[_0xd0a4('0x2')](_0xd0a4('0x1a'),_0x3b196e[_0xd0a4('0x4')]),_0x3b196e);dials[_0x3b196e['uniqueid']]=_[_0xd0a4('0x1b')](dials[_0x3b196e[_0xd0a4('0x4')]],_0x3b196e);dials[_0x3b196e[_0xd0a4('0x4')]][_0xd0a4('0x1c')]=utils[_0xd0a4('0x1d')]();dials[_0x3b196e['uniqueid']]['lastevent']=_0xd0a4('0x1e');utils[_0xd0a4('0xb')](util[_0xd0a4('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x3b196e[_0xd0a4('0x4')],dials[_0x3b196e['uniqueid']][_0xd0a4('0x1c')]));}}catch(_0x17270c){utils[_0xd0a4('0x19')](util[_0xd0a4('0x2')](_0xd0a4('0x1a'),_0x3b196e[_0xd0a4('0x4')]),_0x17270c);}};exports[_0xd0a4('0x1f')]=function(_0x5cffa1){try{if(!_[_0xd0a4('0x15')](dials[_0x5cffa1[_0xd0a4('0x4')]])){utils[_0xd0a4('0x9')](util[_0xd0a4('0x2')](_0xd0a4('0x20'),_0x5cffa1[_0xd0a4('0x4')]),_0x5cffa1);dials[_0x5cffa1[_0xd0a4('0x4')]][_0xd0a4('0x6')]=_0x5cffa1[_0xd0a4('0x6')];if(_0x5cffa1[_0xd0a4('0x6')]==_0xd0a4('0x21')){dials[_0x5cffa1['uniqueid']]=_[_0xd0a4('0x1b')](dials[_0x5cffa1[_0xd0a4('0x4')]],_0x5cffa1);dials[_0x5cffa1[_0xd0a4('0x4')]]['answertime']=utils[_0xd0a4('0x1d')]();dials[_0x5cffa1['uniqueid']][_0xd0a4('0x22')]=_0xd0a4('0x23');utils['info'](util['format'](_0xd0a4('0x24'),_0x5cffa1[_0xd0a4('0x4')],_0x5cffa1[_0xd0a4('0x6')],dials[_0x5cffa1[_0xd0a4('0x4')]][_0xd0a4('0x25')]));}else{utils[_0xd0a4('0xb')](util[_0xd0a4('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x5cffa1[_0xd0a4('0x4')],_0x5cffa1[_0xd0a4('0x6')]));}}}catch(_0x194f0b){utils[_0xd0a4('0x19')](util[_0xd0a4('0x2')]('[%s][dials][dialend]',_0x5cffa1['uniqueid']),_0x194f0b);}};exports[_0xd0a4('0x26')]=function(_0x4d2dec){try{if(!_['isNil'](dials[_0x4d2dec[_0xd0a4('0x4')]])){utils[_0xd0a4('0x9')](util['format'](_0xd0a4('0x27'),_0x4d2dec[_0xd0a4('0x4')]),_0x4d2dec);utils[_0xd0a4('0xb')](util[_0xd0a4('0x2')](_0xd0a4('0x28'),_0x4d2dec[_0xd0a4('0x4')],_0x4d2dec[_0xd0a4('0x29')],_0x4d2dec['calleridname'],_0x4d2dec[_0xd0a4('0x2a')]));dials[_0x4d2dec[_0xd0a4('0x4')]]=_[_0xd0a4('0x1b')](dials[_0x4d2dec[_0xd0a4('0x4')]],{'endtime':utils[_0xd0a4('0x1d')](),'lastevent':_0xd0a4('0x2b')});dials[_0x4d2dec[_0xd0a4('0x4')]]['duration']=utils[_0xd0a4('0x2c')](dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x2d')],dials[_0x4d2dec[_0xd0a4('0x4')]]['starttime']);dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x2e')]=utils['diffTime'](dials[_0x4d2dec[_0xd0a4('0x4')]]['answertime']||dials[_0x4d2dec[_0xd0a4('0x4')]]['endtime'],dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x1c')]);dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x2f')]=dials[_0x4d2dec['uniqueid']]['answertime']?utils['diffTime'](dials[_0x4d2dec[_0xd0a4('0x4')]][_0xd0a4('0x2d')],dials[_0x4d2dec['uniqueid']][_0xd0a4('0x25')]):0x0;writeDB(dials[_0x4d2dec[_0xd0a4('0x4')]]);}}catch(_0x471b55){utils[_0xd0a4('0x19')](util[_0xd0a4('0x2')](_0xd0a4('0x27'),_0x4d2dec[_0xd0a4('0x4')]),_0x471b55);}};
\ No newline at end of file
index fa5c9cd..54b4d61 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3665=['[%s][index][newstate]','newstate','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3665,0xf3));var _0x5366=function(_0x409d64,_0x50e21c){_0x409d64=_0x409d64-0x0;var _0x2cefa2=_0x3665[_0x409d64];return _0x2cefa2;};var AsteriskManager=require(_0x5366('0x0'));var config=require(_0x5366('0x1'));var utils=require(_0x5366('0x2'));var util=require(_0x5366('0x3'));var isXDREnabled=config[_0x5366('0x4')]&&config[_0x5366('0x4')][_0x5366('0x5')]?!config[_0x5366('0x4')][_0x5366('0x5')]:!![];var isProduction=config[_0x5366('0x6')]===_0x5366('0x7')||![];var isLocalAsterisk=config[_0x5366('0x4')]&&config[_0x5366('0x4')][_0x5366('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0x5366('0x9')][_0x5366('0xa')],config[_0x5366('0x9')]['ip'],config[_0x5366('0x9')][_0x5366('0xb')],config[_0x5366('0x9')][_0x5366('0xc')],!![]);ami[_0x5366('0xd')]();if(!isXDREnabled){utils[_0x5366('0xe')](_0x5366('0xf'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5366('0xe')](_0x5366('0x10'));}else{var agents=require('./agents.controller');var calls=require(_0x5366('0x11'));var queues=require(_0x5366('0x12'));var recordings=require(_0x5366('0x13'));var members=require(_0x5366('0x14'));var dials=require(_0x5366('0x15'));var transfers=require('./transfers.controller');var core=require(_0x5366('0x16'));ami['on'](_0x5366('0x17'),core[_0x5366('0x17')]);ami['on'](_0x5366('0x18'),core[_0x5366('0x18')]);ami['on'](_0x5366('0x19'),core['fullybooted']);ami['on']('error',core[_0x5366('0x1a')]);ami['on'](_0x5366('0x1b'),core[_0x5366('0x1b')]);ami['on'](_0x5366('0x1c'),core[_0x5366('0x1c')]);ami['on'](_0x5366('0x1d'),function(_0x5b6559){try{utils[_0x5366('0x1e')](util['format'](_0x5366('0x1f'),_0x5b6559[_0x5366('0x20')]),_0x5b6559);members[_0x5366('0x1d')](_0x5b6559);}catch(_0x2e6575){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x1f'),_0x5b6559['device']),_0x2e6575);}});ami['on'](_0x5366('0x22'),function(_0x5cf9be){try{utils[_0x5366('0x1e')](util['format'](_0x5366('0x23'),_0x5cf9be[_0x5366('0x24')]),_0x5cf9be);agents[_0x5366('0x22')](_0x5cf9be);}catch(_0x187d9a){utils['error'](util[_0x5366('0x21')](_0x5366('0x23'),_0x5cf9be[_0x5366('0x24')]),_0x187d9a);}});ami['on']('agentringnoanswer',function(_0x313a30){try{utils['debug'](util[_0x5366('0x21')](_0x5366('0x25'),_0x313a30[_0x5366('0x24')]),_0x313a30);agents[_0x5366('0x26')](_0x313a30);}catch(_0x3afa42){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x25'),_0x313a30['uniqueid']),_0x3afa42);}});ami['on'](_0x5366('0x27'),function(_0x43a448){try{utils[_0x5366('0x1e')](util['format']('[%s][index][agentconnect]',_0x43a448[_0x5366('0x24')]),_0x43a448);agents[_0x5366('0x27')](_0x43a448);queues[_0x5366('0x27')](_0x43a448);}catch(_0x4d62c4){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x28'),_0x43a448[_0x5366('0x24')]),_0x4d62c4);}});ami['on'](_0x5366('0x29'),function(_0x17c40f){try{utils['debug'](util[_0x5366('0x21')](_0x5366('0x2a'),_0x17c40f['uniqueid']),_0x17c40f);agents[_0x5366('0x29')](_0x17c40f);queues[_0x5366('0x29')](_0x17c40f);members[_0x5366('0x29')](_0x17c40f);}catch(_0x52f2f0){utils[_0x5366('0x1a')](util[_0x5366('0x21')]('[%s][index][agentcomplete]',_0x17c40f['uniqueid']),_0x52f2f0);}});ami['on'](_0x5366('0x2b'),function(_0x5959b0){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')]('[%s][index][queuecallerabandon]',_0x5959b0[_0x5366('0x24')]),_0x5959b0);agents['queuecallerabandon'](_0x5959b0);queues[_0x5366('0x2b')](_0x5959b0);}catch(_0x43fc61){utils[_0x5366('0x1a')](util['format'](_0x5366('0x2c'),_0x5959b0[_0x5366('0x24')]),_0x43fc61);}});ami['on'](_0x5366('0x2d'),function(_0x5a69d0){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')](_0x5366('0x2e'),_0x5a69d0['uniqueid']),_0x5a69d0);queues[_0x5366('0x2d')](_0x5a69d0);recordings[_0x5366('0x2d')](_0x5a69d0);}catch(_0x4efde8){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x2e'),_0x5a69d0[_0x5366('0x24')]),_0x4efde8);}});ami['on'](_0x5366('0x2f'),function(_0x4114a1){try{utils['debug'](util['format'](_0x5366('0x30'),_0x4114a1[_0x5366('0x24')]),_0x4114a1);queues[_0x5366('0x2f')](_0x4114a1);}catch(_0x397ac6){utils[_0x5366('0x1a')](util['format']('[%s][index][queuecallerleave]',_0x4114a1[_0x5366('0x24')]),_0x397ac6);}});ami['on'](_0x5366('0x31'),function(_0x492db8){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')](_0x5366('0x32'),_0x492db8[_0x5366('0x24')]),_0x492db8);queues[_0x5366('0x31')](_0x492db8);calls[_0x5366('0x31')](_0x492db8);}catch(_0x8c5eac){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x32'),_0x492db8[_0x5366('0x24')]),_0x8c5eac);}});ami['on']('musiconholdstop',function(_0x6b20f){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')](_0x5366('0x33'),_0x6b20f['uniqueid']),_0x6b20f);queues[_0x5366('0x34')](_0x6b20f);calls[_0x5366('0x34')](_0x6b20f);}catch(_0x2c5d5f){utils['error'](util[_0x5366('0x21')](_0x5366('0x33'),_0x6b20f[_0x5366('0x24')]),_0x2c5d5f);}});ami['on']('newstate',function(_0x5a01fd){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')](_0x5366('0x35'),_0x5a01fd[_0x5366('0x24')]),_0x5a01fd);calls['newstate'](_0x5a01fd);recordings[_0x5366('0x36')](_0x5a01fd);}catch(_0x418165){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x35'),_0x5a01fd[_0x5366('0x24')]),_0x418165);}});ami['on'](_0x5366('0x37'),function(_0x1db8c1){try{utils['debug'](util[_0x5366('0x21')](_0x5366('0x38'),_0x1db8c1[_0x5366('0x24')]),_0x1db8c1);calls['hangup'](_0x1db8c1);recordings[_0x5366('0x37')](_0x1db8c1);dials[_0x5366('0x37')](_0x1db8c1);agents[_0x5366('0x37')](_0x1db8c1);queues[_0x5366('0x37')](_0x1db8c1);}catch(_0x5bd8f1){utils['error'](util[_0x5366('0x21')]('[%s][index][hangup]',_0x1db8c1[_0x5366('0x24')]),_0x5bd8f1);}});ami['on'](_0x5366('0x39'),function(_0x4da159){try{utils['debug'](util[_0x5366('0x21')](_0x5366('0x3a'),_0x4da159['uniqueid']),_0x4da159);members[_0x5366('0x39')](_0x4da159);}catch(_0x49a301){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x3a'),_0x4da159[_0x5366('0x24')]),_0x49a301);}});ami['on'](_0x5366('0x3b'),function(_0x281f56){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')]('[%s][index][blindtransfer]',_0x281f56['uniqueid']),_0x281f56);queues['blindtransfer'](_0x281f56);agents['blindtransfer'](_0x281f56);transfers[_0x5366('0x3b')](_0x281f56);}catch(_0x4aa330){utils[_0x5366('0x1a')](util['format'](_0x5366('0x3c'),_0x281f56[_0x5366('0x24')]),_0x4aa330);}});ami['on'](_0x5366('0x3d'),function(_0x5c3e60){try{utils['debug'](util[_0x5366('0x21')]('[%s][index][attendedtransfer]',_0x5c3e60[_0x5366('0x3e')]),_0x5c3e60);queues[_0x5366('0x3d')](_0x5c3e60);transfers[_0x5366('0x3d')](_0x5c3e60);agents[_0x5366('0x3d')](_0x5c3e60);calls[_0x5366('0x3d')](_0x5c3e60);}catch(_0x24ad3d){utils[_0x5366('0x1a')](util['format'](_0x5366('0x3f'),_0x5c3e60[_0x5366('0x3e')]),_0x24ad3d);}});ami['on']('varset',function(_0x334837){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')](_0x5366('0x40'),_0x334837[_0x5366('0x24')]),_0x334837);queues[_0x5366('0x41')](_0x334837);recordings['varset'](_0x334837);calls[_0x5366('0x41')](_0x334837);dials['varset'](_0x334837);}catch(_0x5adfb8){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x40'),_0x334837[_0x5366('0x24')]),_0x5adfb8);}});ami['on']('newexten',function(_0x129074){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')](_0x5366('0x42'),_0x129074[_0x5366('0x24')]),_0x129074);calls[_0x5366('0x43')](_0x129074);recordings[_0x5366('0x43')](_0x129074);dials[_0x5366('0x43')](_0x129074);}catch(_0x3032ba){utils['error'](util[_0x5366('0x21')]('[%s][index][newexten]',_0x129074[_0x5366('0x24')]),_0x3032ba);}});ami['on'](_0x5366('0x44'),function(_0x531ca7){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')](_0x5366('0x45'),_0x531ca7['uniqueid']),_0x531ca7);calls['newchannel'](_0x531ca7);recordings['newchannel'](_0x531ca7);}catch(_0x28cfb5){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x45'),_0x531ca7['uniqueid']),_0x28cfb5);}});ami['on'](_0x5366('0x46'),function(_0x58b375){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')](_0x5366('0x47'),_0x58b375[_0x5366('0x24')]),_0x58b375);dials[_0x5366('0x46')](_0x58b375);}catch(_0x30a0fa){utils[_0x5366('0x1a')](util[_0x5366('0x21')](_0x5366('0x48'),_0x58b375[_0x5366('0x24')]),_0x30a0fa);}});ami['on'](_0x5366('0x49'),function(_0x10eb6b){try{utils[_0x5366('0x1e')](util[_0x5366('0x21')]('[%s][index][dialend]',_0x10eb6b['uniqueid']),_0x10eb6b);dials['dialend'](_0x10eb6b);}catch(_0x159e44){utils[_0x5366('0x1a')](util[_0x5366('0x21')]('[%s][index][dialend]',_0x10eb6b['uniqueid']),_0x159e44);}});}
\ No newline at end of file
+var _0x4415=['connect','shutdown','error','close','managerevent','devicestatechange','[%s][index][devicestatechange]','device','format','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','[%s][index][cdr]','cdr','blindtransfer','[%s][index][blindtransfer]','[%s][index][attendedtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','env','production','local','asterisk','port','username','password','XDR\x20DISABLED','info','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./transfers.controller','./core.controller'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x4415,0x1d5));var _0x5441=function(_0x2dd390,_0x1bc894){_0x2dd390=_0x2dd390-0x0;var _0x3afe47=_0x4415[_0x2dd390];return _0x3afe47;};var AsteriskManager=require(_0x5441('0x0'));var config=require(_0x5441('0x1'));var utils=require('./utils');var util=require(_0x5441('0x2'));var isXDREnabled=config[_0x5441('0x3')]&&config[_0x5441('0x3')][_0x5441('0x4')]?!config['xdr'][_0x5441('0x4')]:!![];var isProduction=config[_0x5441('0x5')]===_0x5441('0x6')||![];var isLocalAsterisk=config[_0x5441('0x3')]&&config[_0x5441('0x3')][_0x5441('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0x5441('0x8')][_0x5441('0x9')],config[_0x5441('0x8')]['ip'],config['asterisk'][_0x5441('0xa')],config[_0x5441('0x8')][_0x5441('0xb')],!![]);ami['keepConnected']();if(!isXDREnabled){utils['info'](_0x5441('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x5441('0xd')](_0x5441('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0x5441('0xf'));var queues=require(_0x5441('0x10'));var recordings=require(_0x5441('0x11'));var members=require(_0x5441('0x12'));var dials=require('./dials.controller');var transfers=require(_0x5441('0x13'));var core=require(_0x5441('0x14'));ami['on'](_0x5441('0x15'),core['connect']);ami['on'](_0x5441('0x16'),core['shutdown']);ami['on']('fullybooted',core['fullybooted']);ami['on'](_0x5441('0x17'),core[_0x5441('0x17')]);ami['on'](_0x5441('0x18'),core['close']);ami['on'](_0x5441('0x19'),core[_0x5441('0x19')]);ami['on'](_0x5441('0x1a'),function(_0x4ed298){try{utils['debug'](util['format'](_0x5441('0x1b'),_0x4ed298[_0x5441('0x1c')]),_0x4ed298);members['devicestatechange'](_0x4ed298);}catch(_0xc4f6e1){utils['error'](util[_0x5441('0x1d')](_0x5441('0x1b'),_0x4ed298[_0x5441('0x1c')]),_0xc4f6e1);}});ami['on'](_0x5441('0x1e'),function(_0x5557f2){try{utils['debug'](util[_0x5441('0x1d')](_0x5441('0x1f'),_0x5557f2['uniqueid']),_0x5557f2);agents[_0x5441('0x1e')](_0x5557f2);}catch(_0xd6062f){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x1f'),_0x5557f2[_0x5441('0x20')]),_0xd6062f);}});ami['on'](_0x5441('0x21'),function(_0x55bff0){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x23'),_0x55bff0[_0x5441('0x20')]),_0x55bff0);agents['agentringnoanswer'](_0x55bff0);}catch(_0x226353){utils['error'](util['format'](_0x5441('0x23'),_0x55bff0['uniqueid']),_0x226353);}});ami['on'](_0x5441('0x24'),function(_0x5458bb){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x25'),_0x5458bb[_0x5441('0x20')]),_0x5458bb);agents['agentconnect'](_0x5458bb);queues[_0x5441('0x24')](_0x5458bb);}catch(_0x5af2e0){utils[_0x5441('0x17')](util['format'](_0x5441('0x25'),_0x5458bb['uniqueid']),_0x5af2e0);}});ami['on'](_0x5441('0x26'),function(_0x28066b){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x27'),_0x28066b[_0x5441('0x20')]),_0x28066b);agents[_0x5441('0x26')](_0x28066b);queues[_0x5441('0x26')](_0x28066b);members['agentcomplete'](_0x28066b);}catch(_0x3ec093){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x27'),_0x28066b['uniqueid']),_0x3ec093);}});ami['on'](_0x5441('0x28'),function(_0x2ae7f4){try{utils[_0x5441('0x22')](util['format']('[%s][index][queuecallerabandon]',_0x2ae7f4[_0x5441('0x20')]),_0x2ae7f4);agents[_0x5441('0x28')](_0x2ae7f4);queues[_0x5441('0x28')](_0x2ae7f4);}catch(_0x240b76){utils['error'](util[_0x5441('0x1d')](_0x5441('0x29'),_0x2ae7f4[_0x5441('0x20')]),_0x240b76);}});ami['on'](_0x5441('0x2a'),function(_0x14ee75){try{utils['debug'](util['format']('[%s][index][queuecallerjoin]',_0x14ee75[_0x5441('0x20')]),_0x14ee75);queues[_0x5441('0x2a')](_0x14ee75);recordings[_0x5441('0x2a')](_0x14ee75);}catch(_0x579d1e){utils['error'](util[_0x5441('0x1d')]('[%s][index][queuecallerjoin]',_0x14ee75['uniqueid']),_0x579d1e);}});ami['on'](_0x5441('0x2b'),function(_0x375939){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x2c'),_0x375939[_0x5441('0x20')]),_0x375939);queues[_0x5441('0x2b')](_0x375939);}catch(_0x473066){utils[_0x5441('0x17')](util[_0x5441('0x1d')]('[%s][index][queuecallerleave]',_0x375939[_0x5441('0x20')]),_0x473066);}});ami['on']('musiconholdstart',function(_0x202093){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')]('[%s][index][musiconholdstart]',_0x202093[_0x5441('0x20')]),_0x202093);queues[_0x5441('0x2d')](_0x202093);calls[_0x5441('0x2d')](_0x202093);}catch(_0x1c850e){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x2e'),_0x202093[_0x5441('0x20')]),_0x1c850e);}});ami['on'](_0x5441('0x2f'),function(_0xb50b0){try{utils['debug'](util[_0x5441('0x1d')](_0x5441('0x30'),_0xb50b0[_0x5441('0x20')]),_0xb50b0);queues[_0x5441('0x2f')](_0xb50b0);calls[_0x5441('0x2f')](_0xb50b0);}catch(_0x3d844b){utils[_0x5441('0x17')](util[_0x5441('0x1d')]('[%s][index][musiconholdstop]',_0xb50b0[_0x5441('0x20')]),_0x3d844b);}});ami['on'](_0x5441('0x31'),function(_0x39e989){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x32'),_0x39e989[_0x5441('0x20')]),_0x39e989);calls[_0x5441('0x31')](_0x39e989);recordings['newstate'](_0x39e989);}catch(_0xe15902){utils['error'](util[_0x5441('0x1d')]('[%s][index][newstate]',_0x39e989[_0x5441('0x20')]),_0xe15902);}});ami['on'](_0x5441('0x33'),function(_0x30b283){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x34'),_0x30b283[_0x5441('0x20')]),_0x30b283);calls[_0x5441('0x33')](_0x30b283);recordings[_0x5441('0x33')](_0x30b283);dials[_0x5441('0x33')](_0x30b283);agents[_0x5441('0x33')](_0x30b283);queues['hangup'](_0x30b283);}catch(_0x364e37){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x34'),_0x30b283[_0x5441('0x20')]),_0x364e37);}});ami['on']('cdr',function(_0x93c161){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x35'),_0x93c161['uniqueid']),_0x93c161);members[_0x5441('0x36')](_0x93c161);}catch(_0x4f11f6){utils[_0x5441('0x17')](util['format'](_0x5441('0x35'),_0x93c161[_0x5441('0x20')]),_0x4f11f6);}});ami['on'](_0x5441('0x37'),function(_0x57d0e6){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x38'),_0x57d0e6[_0x5441('0x20')]),_0x57d0e6);queues[_0x5441('0x37')](_0x57d0e6);agents[_0x5441('0x37')](_0x57d0e6);transfers[_0x5441('0x37')](_0x57d0e6);}catch(_0x2e0a17){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x38'),_0x57d0e6['uniqueid']),_0x2e0a17);}});ami['on']('attendedtransfer',function(_0x412723){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x39'),_0x412723['origtransfereruniqueid']),_0x412723);queues['attendedtransfer'](_0x412723);transfers[_0x5441('0x3a')](_0x412723);agents[_0x5441('0x3a')](_0x412723);calls[_0x5441('0x3a')](_0x412723);}catch(_0x2eee7f){utils[_0x5441('0x17')](util['format'](_0x5441('0x39'),_0x412723[_0x5441('0x3b')]),_0x2eee7f);}});ami['on']('varset',function(_0x393b9e){try{utils[_0x5441('0x22')](util['format'](_0x5441('0x3c'),_0x393b9e[_0x5441('0x20')]),_0x393b9e);queues[_0x5441('0x3d')](_0x393b9e);recordings[_0x5441('0x3d')](_0x393b9e);calls[_0x5441('0x3d')](_0x393b9e);dials[_0x5441('0x3d')](_0x393b9e);}catch(_0x495840){utils['error'](util[_0x5441('0x1d')](_0x5441('0x3c'),_0x393b9e[_0x5441('0x20')]),_0x495840);}});ami['on']('newexten',function(_0x3ba05f){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x3e'),_0x3ba05f[_0x5441('0x20')]),_0x3ba05f);calls['newexten'](_0x3ba05f);recordings[_0x5441('0x3f')](_0x3ba05f);dials['newexten'](_0x3ba05f);}catch(_0x276008){utils[_0x5441('0x17')](util[_0x5441('0x1d')](_0x5441('0x3e'),_0x3ba05f[_0x5441('0x20')]),_0x276008);}});ami['on'](_0x5441('0x40'),function(_0x4c4c7f){try{utils['debug'](util[_0x5441('0x1d')]('[%s][index][newchannel]',_0x4c4c7f[_0x5441('0x20')]),_0x4c4c7f);calls[_0x5441('0x40')](_0x4c4c7f);recordings[_0x5441('0x40')](_0x4c4c7f);}catch(_0x193929){utils[_0x5441('0x17')](util['format']('[%s][index][newchannel]',_0x4c4c7f[_0x5441('0x20')]),_0x193929);}});ami['on'](_0x5441('0x41'),function(_0x1944b0){try{utils['debug'](util['format'](_0x5441('0x42'),_0x1944b0[_0x5441('0x20')]),_0x1944b0);dials['dialbegin'](_0x1944b0);}catch(_0x24668e){utils[_0x5441('0x17')](util['format'](_0x5441('0x43'),_0x1944b0[_0x5441('0x20')]),_0x24668e);}});ami['on'](_0x5441('0x44'),function(_0x164791){try{utils[_0x5441('0x22')](util[_0x5441('0x1d')](_0x5441('0x45'),_0x164791[_0x5441('0x20')]),_0x164791);dials['dialend'](_0x164791);}catch(_0x5c249f){utils['error'](util[_0x5441('0x1d')](_0x5441('0x45'),_0x164791['uniqueid']),_0x5c249f);}});}
\ No newline at end of file
index 30a6017..9af9113 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x500f=['membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','split','then','catch','error','[%s][members][writeDB]','uniqueid','some','devicestatechange','debug','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','now','agent','NOT_INUSE','exitAt','duration','diffTime','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','channel','data1','source','data3','destination','data2','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x500f,0x1d5));var _0xf500=function(_0x102977,_0x3a99a6){_0x102977=_0x102977-0x0;var _0x15c466=_0x500f[_0x102977];return _0x15c466;};'use strict';var _=require(_0xf500('0x0'));var util=require(_0xf500('0x1'));var utils=require('./utils');var members={};var exclude=[_0xf500('0x2'),_0xf500('0x3')];function writeDB(_0x8cb0d3){utils[_0xf500('0x4')](util[_0xf500('0x5')](_0xf500('0x6'),_0x8cb0d3['uniqueid'],_0x8cb0d3[_0xf500('0x7')],_0x8cb0d3['channel'],_0x8cb0d3['data2'],_0x8cb0d3[_0xf500('0x8')],_0x8cb0d3[_0xf500('0x9')]));if(_0x8cb0d3[_0xf500('0x7')]){utils[_0xf500('0xa')](_0x8cb0d3[_0xf500('0x7')])['then'](function(_0x4dfb1d){if(_0x4dfb1d){_0x8cb0d3[_0xf500('0x8')]=_0x4dfb1d[_0xf500('0xb')];_0x8cb0d3[_0xf500('0xc')]=_0x4dfb1d['internal'];utils[_0xf500('0xd')](_0xf500('0xe'),_0x8cb0d3);}else{utils[_0xf500('0xf')](_0x8cb0d3[_0xf500('0x7')][_0xf500('0x10')]('/')[0x1])[_0xf500('0x11')](function(_0x2313e0){if(_0x2313e0){_0x8cb0d3[_0xf500('0x8')]=_0x2313e0['name'];_0x8cb0d3['internal']=_0x2313e0['internal'];utils[_0xf500('0xd')](_0xf500('0xe'),_0x8cb0d3);}});}})[_0xf500('0x12')](function(_0x3c7d87){utils[_0xf500('0x13')](util[_0xf500('0x5')](_0xf500('0x14'),_0x8cb0d3[_0xf500('0x15')]),_0x3c7d87);});}delete members[_0x8cb0d3['interface']];}function startsWith(_0x25fae8,_0x1c293f){return _[_0xf500('0x16')](_0x25fae8,function(_0x788563){return _['startsWith'](_0x1c293f,_0x788563);});}exports[_0xf500('0x17')]=function(_0x453ed3){try{utils[_0xf500('0x18')](util['format'](_0xf500('0x19'),members[_0x453ed3[_0xf500('0x1a')]]?members[_0x453ed3[_0xf500('0x1a')]]['uniqueid']:_0x453ed3[_0xf500('0x1a')]),_0x453ed3);utils[_0xf500('0x4')](util[_0xf500('0x5')](_0xf500('0x1b'),members[_0x453ed3[_0xf500('0x1a')]]?members[_0x453ed3['device']][_0xf500('0x15')]:_0x453ed3['device'],_0x453ed3[_0xf500('0x1c')],_0x453ed3[_0xf500('0x1a')]));switch(_0x453ed3['state']){case _0xf500('0x1d'):case'BUSY':if(!startsWith(exclude,_0x453ed3[_0xf500('0x1a')])){members[_0x453ed3['device']]={'channel':'voice','interface':_0x453ed3[_0xf500('0x1a')],'type':_0xf500('0x1e'),'enterAt':utils[_0xf500('0x1f')](),'role':_0xf500('0x20')};}break;case _0xf500('0x21'):if(!_['isNil'](members[_0x453ed3[_0xf500('0x1a')]])){members[_0x453ed3[_0xf500('0x1a')]][_0xf500('0x22')]=utils[_0xf500('0x1f')]();members[_0x453ed3['device']][_0xf500('0x23')]=utils[_0xf500('0x24')](members[_0x453ed3[_0xf500('0x1a')]][_0xf500('0x22')],members[_0x453ed3[_0xf500('0x1a')]]['enterAt']);if(members[_0x453ed3['device']][_0xf500('0x15')]){writeDB(members[_0x453ed3['device']]);}}break;default:break;}}catch(_0x57513f){utils['error'](util[_0xf500('0x5')](_0xf500('0x19'),members[_0x453ed3[_0xf500('0x1a')]]?members[_0x453ed3[_0xf500('0x1a')]][_0xf500('0x15')]:_0x453ed3[_0xf500('0x1a')]),_0x57513f);}};exports[_0xf500('0x25')]=function(_0x2c9de7){try{if(!_[_0xf500('0x26')](members[_0x2c9de7[_0xf500('0x7')]])){utils[_0xf500('0x18')](util[_0xf500('0x5')](_0xf500('0x27'),_0x2c9de7[_0xf500('0x15')]),_0x2c9de7);utils[_0xf500('0x4')](util['format'](_0xf500('0x28'),_0x2c9de7[_0xf500('0x15')],_0x2c9de7[_0xf500('0x7')],_0x2c9de7['queue']));members[_0x2c9de7[_0xf500('0x7')]]=_[_0xf500('0x29')](members[_0x2c9de7[_0xf500('0x7')]],{'data4':_0x2c9de7[_0xf500('0x2a')],'uniqueid':_0x2c9de7[_0xf500('0x15')]});}}catch(_0x32321e){utils[_0xf500('0x13')](util[_0xf500('0x5')](_0xf500('0x27'),_0x2c9de7[_0xf500('0x15')]),_0x32321e);}};exports[_0xf500('0x2b')]=function(_0x18a0e7){try{utils[_0xf500('0x18')](util[_0xf500('0x5')](_0xf500('0x2c'),_0x18a0e7[_0xf500('0x15')]),_0x18a0e7);if(_0x18a0e7[_0xf500('0x2d')]){var _0x1766c6=_0x18a0e7['channel']['split']('-')[0x0];if(!_[_0xf500('0x26')](members[_0x1766c6])){members[_0x1766c6]=_[_0xf500('0x29')](members[_0x1766c6],{'data1':members[_0x1766c6][_0xf500('0x2e')]||_0x18a0e7['type'],'data2':members[_0x1766c6]['data2']||_0x18a0e7[_0xf500('0x2f')],'data3':members[_0x1766c6][_0xf500('0x30')]||_0x18a0e7[_0xf500('0x31')],'uniqueid':members[_0x1766c6][_0xf500('0x15')]||_0x18a0e7[_0xf500('0x15')]});utils[_0xf500('0x4')](util[_0xf500('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x18a0e7['uniqueid'],members[_0x1766c6]['data1'],members[_0x1766c6][_0xf500('0x32')],members[_0x1766c6]['data3']));if(members[_0x1766c6]['exitAt']){writeDB(members[_0x1766c6]);}}}if(_0x18a0e7[_0xf500('0x33')]){var _0x41ece4=_0x18a0e7[_0xf500('0x33')][_0xf500('0x10')]('-')[0x0];if(!_[_0xf500('0x26')](members[_0x41ece4])){members[_0x41ece4]=_[_0xf500('0x29')](members[_0x41ece4],{'data1':members[_0x41ece4]['data1']||_0x18a0e7[_0xf500('0x9')],'data2':members[_0x41ece4][_0xf500('0x32')]||_0x18a0e7[_0xf500('0x2f')],'data3':members[_0x41ece4][_0xf500('0x30')]||_0x18a0e7[_0xf500('0x31')],'uniqueid':members[_0x41ece4][_0xf500('0x15')]||_0x18a0e7['uniqueid']});utils[_0xf500('0x4')](util[_0xf500('0x5')](_0xf500('0x34'),_0x18a0e7[_0xf500('0x15')],members[_0x41ece4][_0xf500('0x2e')],members[_0x41ece4][_0xf500('0x32')],members[_0x41ece4]['data3']));if(members[_0x41ece4][_0xf500('0x22')]){writeDB(members[_0x41ece4]);}}}}catch(_0x28d265){utils[_0xf500('0x13')](util[_0xf500('0x5')](_0xf500('0x2c'),_0x18a0e7['uniqueid']),_0x28d265);}};
\ No newline at end of file
+var _0xc7e9=['debug','[%s][members][cdr]','data1','data2','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','channel','membername','type','interface','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','catch','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','info','state','INUSE','BUSY','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','enterAt','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xc7e9[_0x5a776b];return _0xbbef59;};'use strict';var _=require(_0x9c7e('0x0'));var util=require(_0x9c7e('0x1'));var utils=require('./utils');var members={};var exclude=[_0x9c7e('0x2'),_0x9c7e('0x3')];function writeDB(_0x2acedf){utils['info'](util[_0x9c7e('0x4')](_0x9c7e('0x5'),_0x2acedf['uniqueid'],_0x2acedf['interface'],_0x2acedf[_0x9c7e('0x6')],_0x2acedf['data2'],_0x2acedf[_0x9c7e('0x7')],_0x2acedf[_0x9c7e('0x8')]));if(_0x2acedf[_0x9c7e('0x9')]){utils[_0x9c7e('0xa')](_0x2acedf['interface'])[_0x9c7e('0xb')](function(_0x5f265d){if(_0x5f265d){_0x2acedf[_0x9c7e('0x7')]=_0x5f265d[_0x9c7e('0xc')];_0x2acedf['internal']=_0x5f265d[_0x9c7e('0xd')];utils[_0x9c7e('0xe')]('CreateMemberReport',_0x2acedf);}else{utils[_0x9c7e('0xf')](_0x2acedf['interface'][_0x9c7e('0x10')]('/')[0x1])[_0x9c7e('0xb')](function(_0x5a9657){if(_0x5a9657){_0x2acedf[_0x9c7e('0x7')]=_0x5a9657['name'];_0x2acedf[_0x9c7e('0xd')]=_0x5a9657[_0x9c7e('0xd')];utils[_0x9c7e('0xe')](_0x9c7e('0x11'),_0x2acedf);}});}})[_0x9c7e('0x12')](function(_0x5b66a8){utils[_0x9c7e('0x13')](util[_0x9c7e('0x4')](_0x9c7e('0x14'),_0x2acedf[_0x9c7e('0x15')]),_0x5b66a8);});}delete members[_0x2acedf[_0x9c7e('0x9')]];}function startsWith(_0x1dc25b,_0x4b26a8){return _[_0x9c7e('0x16')](_0x1dc25b,function(_0x161f74){return _[_0x9c7e('0x17')](_0x4b26a8,_0x161f74);});}exports[_0x9c7e('0x18')]=function(_0x26871f){try{utils['debug'](util[_0x9c7e('0x4')](_0x9c7e('0x19'),members[_0x26871f['device']]?members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x15')]:_0x26871f[_0x9c7e('0x1a')]),_0x26871f);utils[_0x9c7e('0x1b')](util[_0x9c7e('0x4')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x26871f[_0x9c7e('0x1a')]]?members[_0x26871f['device']][_0x9c7e('0x15')]:_0x26871f['device'],_0x26871f['state'],_0x26871f[_0x9c7e('0x1a')]));switch(_0x26871f[_0x9c7e('0x1c')]){case _0x9c7e('0x1d'):case _0x9c7e('0x1e'):if(!startsWith(exclude,_0x26871f[_0x9c7e('0x1a')])){members[_0x26871f['device']]={'channel':_0x9c7e('0x1f'),'interface':_0x26871f[_0x9c7e('0x1a')],'type':_0x9c7e('0x20'),'enterAt':utils[_0x9c7e('0x21')](),'role':_0x9c7e('0x22')};}break;case _0x9c7e('0x23'):if(!_[_0x9c7e('0x24')](members[_0x26871f[_0x9c7e('0x1a')]])){members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x25')]=utils[_0x9c7e('0x21')]();members[_0x26871f[_0x9c7e('0x1a')]]['duration']=utils[_0x9c7e('0x26')](members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x25')],members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x27')]);if(members[_0x26871f[_0x9c7e('0x1a')]]['uniqueid']){writeDB(members[_0x26871f['device']]);}}break;default:break;}}catch(_0x1c8736){utils[_0x9c7e('0x13')](util[_0x9c7e('0x4')](_0x9c7e('0x19'),members[_0x26871f[_0x9c7e('0x1a')]]?members[_0x26871f[_0x9c7e('0x1a')]][_0x9c7e('0x15')]:_0x26871f[_0x9c7e('0x1a')]),_0x1c8736);}};exports['agentcomplete']=function(_0x339e21){try{if(!_['isNil'](members[_0x339e21[_0x9c7e('0x9')]])){utils['debug'](util['format'](_0x9c7e('0x28'),_0x339e21[_0x9c7e('0x15')]),_0x339e21);utils[_0x9c7e('0x1b')](util[_0x9c7e('0x4')](_0x9c7e('0x29'),_0x339e21[_0x9c7e('0x15')],_0x339e21[_0x9c7e('0x9')],_0x339e21[_0x9c7e('0x2a')]));members[_0x339e21[_0x9c7e('0x9')]]=_[_0x9c7e('0x2b')](members[_0x339e21[_0x9c7e('0x9')]],{'data4':_0x339e21[_0x9c7e('0x2a')],'uniqueid':_0x339e21[_0x9c7e('0x15')]});}}catch(_0x52ed0e){utils[_0x9c7e('0x13')](util[_0x9c7e('0x4')]('[%s][members][agentcomplete]',_0x339e21[_0x9c7e('0x15')]),_0x52ed0e);}};exports[_0x9c7e('0x2c')]=function(_0x5af71b){try{utils[_0x9c7e('0x2d')](util[_0x9c7e('0x4')](_0x9c7e('0x2e'),_0x5af71b['uniqueid']),_0x5af71b);if(_0x5af71b[_0x9c7e('0x6')]){var _0x7b9649=_0x5af71b[_0x9c7e('0x6')][_0x9c7e('0x10')]('-')[0x0];if(!_[_0x9c7e('0x24')](members[_0x7b9649])){members[_0x7b9649]=_[_0x9c7e('0x2b')](members[_0x7b9649],{'data1':members[_0x7b9649][_0x9c7e('0x2f')]||_0x5af71b['type'],'data2':members[_0x7b9649][_0x9c7e('0x30')]||_0x5af71b[_0x9c7e('0x31')],'data3':members[_0x7b9649]['data3']||_0x5af71b[_0x9c7e('0x32')],'uniqueid':members[_0x7b9649]['uniqueid']||_0x5af71b[_0x9c7e('0x15')]});utils[_0x9c7e('0x1b')](util[_0x9c7e('0x4')](_0x9c7e('0x33'),_0x5af71b[_0x9c7e('0x15')],members[_0x7b9649]['data1'],members[_0x7b9649]['data2'],members[_0x7b9649][_0x9c7e('0x34')]));if(members[_0x7b9649][_0x9c7e('0x25')]){writeDB(members[_0x7b9649]);}}}if(_0x5af71b[_0x9c7e('0x35')]){var _0x342d46=_0x5af71b[_0x9c7e('0x35')]['split']('-')[0x0];if(!_['isNil'](members[_0x342d46])){members[_0x342d46]=_[_0x9c7e('0x2b')](members[_0x342d46],{'data1':members[_0x342d46][_0x9c7e('0x2f')]||_0x5af71b[_0x9c7e('0x8')],'data2':members[_0x342d46][_0x9c7e('0x30')]||_0x5af71b[_0x9c7e('0x31')],'data3':members[_0x342d46][_0x9c7e('0x34')]||_0x5af71b[_0x9c7e('0x32')],'uniqueid':members[_0x342d46]['uniqueid']||_0x5af71b['uniqueid']});utils[_0x9c7e('0x1b')](util['format'](_0x9c7e('0x33'),_0x5af71b[_0x9c7e('0x15')],members[_0x342d46][_0x9c7e('0x2f')],members[_0x342d46][_0x9c7e('0x30')],members[_0x342d46]['data3']));if(members[_0x342d46][_0x9c7e('0x25')]){writeDB(members[_0x342d46]);}}}}catch(_0x4d89b2){utils[_0x9c7e('0x13')](util[_0x9c7e('0x4')](_0x9c7e('0x2e'),_0x5af71b[_0x9c7e('0x15')]),_0x4d89b2);}};
\ No newline at end of file
index 8a8e3a2..3d5dd35 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7df5=['diffTime','queuecallerjoinAt','position','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','assigned','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','transfereelinkedid','queuecallerenterreason','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','clone','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','then','type','CreateVoiceQueueReport','request','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime'];(function(_0x33554b,_0x48162b){var _0x256954=function(_0x185f66){while(--_0x185f66){_0x33554b['push'](_0x33554b['shift']());}};_0x256954(++_0x48162b);}(_0x7df5,0x1ca));var _0x57df=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x7df5[_0x4dc7b9];return _0x3ab114;};'use strict';var _=require('lodash');var util=require(_0x57df('0x0'));var utils=require(_0x57df('0x1'));var queues={};function writeDB(_0x1d23b4){utils[_0x57df('0x2')](util[_0x57df('0x3')](_0x57df('0x4'),_0x1d23b4[_0x57df('0x5')],_0x1d23b4[_0x57df('0x6')],_0x1d23b4[_0x57df('0x7')],_0x1d23b4[_0x57df('0x8')],_0x1d23b4[_0x57df('0x9')],_0x1d23b4[_0x57df('0xa')],_0x1d23b4[_0x57df('0xb')]));if(_0x1d23b4[_0x57df('0x7')]){utils['getVoiceQueueByName'](_0x1d23b4[_0x57df('0x7')])[_0x57df('0xc')](function(_0x4ba707){if(_0x4ba707){_0x1d23b4[_0x57df('0xd')]=_0x4ba707[_0x57df('0xd')];}utils['request'](_0x57df('0xe'),_0x1d23b4);});}else{utils[_0x57df('0xf')](_0x57df('0xe'),_0x1d23b4);}if(_0x1d23b4[_0x57df('0x10')]){delete queues[_0x1d23b4[_0x57df('0x10')]];}else{delete queues[_0x1d23b4[_0x57df('0x5')]];}}exports[_0x57df('0x11')]=function(_0x1dfbab){try{utils[_0x57df('0x12')](util[_0x57df('0x3')](_0x57df('0x13'),_0x1dfbab[_0x57df('0x5')]),_0x1dfbab);utils[_0x57df('0x2')](util[_0x57df('0x3')](_0x57df('0x14'),_0x1dfbab['uniqueid'],_0x1dfbab[_0x57df('0x7')],_0x1dfbab['position']));queues[_0x1dfbab[_0x57df('0x5')]]=_[_0x57df('0x15')](_0x1dfbab,{'originalposition':_0x1dfbab['position'],'queuecallerjoinAt':utils[_0x57df('0x16')](),'mohtime':0x0});}catch(_0x47de58){utils[_0x57df('0x17')](util[_0x57df('0x3')](_0x57df('0x13'),_0x1dfbab['uniqueid']),_0x47de58);}};exports[_0x57df('0x18')]=function(_0x18436f){try{if(!_[_0x57df('0x19')](queues[_0x18436f[_0x57df('0x5')]])){utils[_0x57df('0x12')](util[_0x57df('0x3')](_0x57df('0x1a'),_0x18436f[_0x57df('0x5')]),_0x18436f);if(queues[_0x18436f[_0x57df('0x5')]][_0x57df('0x1b')]){if(!queues[_0x18436f[_0x57df('0x5')]][_0x57df('0x1c')]&&!queues[_0x18436f[_0x57df('0x5')]][_0x57df('0x1d')]){queues[_0x18436f['uniqueid']]['queuecallercomplete']=!![];queues[_0x18436f[_0x57df('0x5')]]['queuecallercompleteAt']=utils[_0x57df('0x16')]();queues[_0x18436f['uniqueid']][_0x57df('0xb')]='COMPLETEDBYAGENT';}utils['info'](util['format'](_0x57df('0x1e'),_0x18436f[_0x57df('0x5')],queues[_0x18436f['uniqueid']][_0x57df('0x1f')],queues[_0x18436f[_0x57df('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x18436f[_0x57df('0x5')]]);}else if(queues[_0x18436f['uniqueid']][_0x57df('0x10')]){utils[_0x57df('0x2')](util[_0x57df('0x3')](_0x57df('0x20'),_0x18436f[_0x57df('0x5')],queues[_0x18436f[_0x57df('0x5')]][_0x57df('0x1f')],queues[_0x18436f['uniqueid']]['transfereduniqueid']));queues[queues[_0x18436f['uniqueid']]['transfereduniqueid']]=queues[_0x18436f['uniqueid']];queues[queues[_0x18436f[_0x57df('0x5')]][_0x57df('0x10')]]['queuecallerenterreason']=0x2;delete queues[_0x18436f[_0x57df('0x5')]];}}}catch(_0x2334c7){utils[_0x57df('0x17')](util[_0x57df('0x3')](_0x57df('0x1a'),_0x18436f[_0x57df('0x5')]),_0x2334c7);}};exports[_0x57df('0x21')]=function(_0x2058a8){try{utils['debug'](util[_0x57df('0x3')](_0x57df('0x22'),_0x2058a8[_0x57df('0x5')]),_0x2058a8);if(!_[_0x57df('0x19')](_0x2058a8[_0x57df('0x23')]['queuestatus'])&&_0x2058a8[_0x57df('0x24')][_0x57df('0x25')]()!==_0x57df('0x26')){if(!_[_0x57df('0x19')](queues[_0x2058a8[_0x57df('0x5')]])){queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x1c')]=![];queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x27')]=null;queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x1d')]=!![];queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x28')]=utils['now']();queues[_0x2058a8['uniqueid']][_0x57df('0xb')]=_0x2058a8[_0x57df('0x24')][_0x57df('0x25')]();utils['info'](util['format'](_0x57df('0x29'),_0x2058a8[_0x57df('0x5')],queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x1f')],_0x2058a8[_0x57df('0x24')],queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0xb')]));writeDB(queues[_0x2058a8['uniqueid']]);}}else if(!_[_0x57df('0x19')](_0x2058a8['variable'][_0x57df('0x2a')])){if(!_['isNil'](queues[_0x2058a8['uniqueid']])&&!queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x1c')]){queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x1c')]=![];queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x27')]=null;queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0x1d')]=!![];queues[_0x2058a8['uniqueid']][_0x57df('0x28')]=utils[_0x57df('0x16')]();queues[_0x2058a8[_0x57df('0x5')]][_0x57df('0xb')]='EXITWITHKEY';utils['info'](util[_0x57df('0x3')](_0x57df('0x2b'),_0x2058a8[_0x57df('0x5')],queues[_0x2058a8['uniqueid']]['name'],_0x2058a8['value'],queues[_0x2058a8['uniqueid']][_0x57df('0xb')]));}}}catch(_0x54f675){utils[_0x57df('0x17')](util['format'](_0x57df('0x22'),_0x2058a8[_0x57df('0x5')]),_0x54f675);}};exports[_0x57df('0x1c')]=function(_0x45fe36){try{if(!_[_0x57df('0x19')](queues[_0x45fe36[_0x57df('0x5')]])){utils[_0x57df('0x12')](util[_0x57df('0x3')](_0x57df('0x2c'),_0x45fe36['uniqueid']),_0x45fe36);queues[_0x45fe36['uniqueid']]['queuecallerexit']=![];queues[_0x45fe36[_0x57df('0x5')]]['queuecallerexitAt']=null;queues[_0x45fe36[_0x57df('0x5')]][_0x57df('0x1c')]=!![];queues[_0x45fe36[_0x57df('0x5')]][_0x57df('0x27')]=utils['now']();queues[_0x45fe36['uniqueid']]['queuecallerexitreason']=_0x57df('0x2d');utils['info'](util[_0x57df('0x3')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x45fe36[_0x57df('0x5')],queues[_0x45fe36[_0x57df('0x5')]][_0x57df('0x1f')],queues[_0x45fe36[_0x57df('0x5')]][_0x57df('0xb')]));}}catch(_0x48d655){utils[_0x57df('0x17')](util[_0x57df('0x3')](_0x57df('0x2c'),_0x45fe36[_0x57df('0x5')]),_0x48d655);}};exports[_0x57df('0x2e')]=function(_0x3e7719){try{if(!_[_0x57df('0x19')](queues[_0x3e7719['uniqueid']])){utils[_0x57df('0x12')](util[_0x57df('0x3')](_0x57df('0x2f'),_0x3e7719[_0x57df('0x5')]),_0x3e7719);utils[_0x57df('0x2')](util[_0x57df('0x3')](_0x57df('0x30'),_0x3e7719[_0x57df('0x5')],queues[_0x3e7719['uniqueid']]['name'],_0x3e7719[_0x57df('0x31')],_0x3e7719[_0x57df('0x32')]));queues[_0x3e7719[_0x57df('0x5')]][_0x57df('0x2e')]=!![];queues[_0x3e7719['uniqueid']][_0x57df('0x1b')]=utils[_0x57df('0x16')]();queues[_0x3e7719[_0x57df('0x5')]][_0x57df('0x33')]=utils[_0x57df('0x34')](queues[_0x3e7719[_0x57df('0x5')]][_0x57df('0x1b')],queues[_0x3e7719[_0x57df('0x5')]][_0x57df('0x35')]);queues[_0x3e7719[_0x57df('0x5')]][_0x57df('0x36')]=_0x3e7719['position'];queues[_0x3e7719[_0x57df('0x5')]][_0x57df('0x37')]=_0x3e7719[_0x57df('0x37')];queues[_0x3e7719[_0x57df('0x5')]][_0x57df('0x31')]=_0x3e7719[_0x57df('0x31')];queues[_0x3e7719[_0x57df('0x5')]][_0x57df('0x32')]=_0x3e7719[_0x57df('0x32')];}}catch(_0x597cc3){utils[_0x57df('0x17')](util[_0x57df('0x3')](_0x57df('0x2f'),_0x3e7719[_0x57df('0x5')]),_0x597cc3);}};exports[_0x57df('0x38')]=function(_0x5af3fb){try{if(!_[_0x57df('0x19')](queues[_0x5af3fb['uniqueid']])){utils['debug'](util[_0x57df('0x3')](_0x57df('0x39'),_0x5af3fb[_0x57df('0x5')]),_0x5af3fb);utils['info'](util['format'](_0x57df('0x3a'),_0x5af3fb[_0x57df('0x5')],queues[_0x5af3fb[_0x57df('0x5')]][_0x57df('0x1f')],_0x5af3fb[_0x57df('0x3b')],_0x5af3fb[_0x57df('0x3c')]));queues[_0x5af3fb[_0x57df('0x5')]][_0x57df('0x1c')]=![];queues[_0x5af3fb['uniqueid']]['queuecallerabandon']=![];queues[_0x5af3fb[_0x57df('0x5')]]['queuecallerabandonAt']=null;queues[_0x5af3fb['uniqueid']][_0x57df('0x1d')]=![];queues[_0x5af3fb[_0x57df('0x5')]][_0x57df('0xb')]=null;queues[_0x5af3fb['uniqueid']][_0x57df('0x28')]=null;queues[_0x5af3fb[_0x57df('0x5')]]['assigned']=!![];queues[_0x5af3fb['uniqueid']][_0x57df('0xa')]=_0x5af3fb[_0x57df('0x3c')];queues[_0x5af3fb[_0x57df('0x5')]][_0x57df('0x8')]=_0x5af3fb[_0x57df('0x3b')];}}catch(_0x186549){utils[_0x57df('0x17')](util[_0x57df('0x3')](_0x57df('0x39'),_0x5af3fb['uniqueid']),_0x186549);}};exports[_0x57df('0x3d')]=function(_0x40f252){try{if(!_[_0x57df('0x19')](queues[_0x40f252[_0x57df('0x5')]])){if(queues[_0x40f252[_0x57df('0x5')]]['queuecallerleaveAt']){utils[_0x57df('0x12')](util[_0x57df('0x3')](_0x57df('0x3e'),_0x40f252['uniqueid']),_0x40f252);queues[_0x40f252[_0x57df('0x5')]]['queuecallerabandon']=![];queues[_0x40f252[_0x57df('0x5')]][_0x57df('0x1c')]=![];queues[_0x40f252[_0x57df('0x5')]]['queuecallerabandonAt']=null;queues[_0x40f252[_0x57df('0x5')]]['queuecallerexit']=![];queues[_0x40f252[_0x57df('0x5')]][_0x57df('0x28')]=null;queues[_0x40f252[_0x57df('0x5')]][_0x57df('0x3f')]=!![];queues[_0x40f252[_0x57df('0x5')]][_0x57df('0x8')]=_0x40f252[_0x57df('0x3b')];queues[_0x40f252[_0x57df('0x5')]][_0x57df('0x40')]=!![];queues[_0x40f252[_0x57df('0x5')]][_0x57df('0x41')]=utils[_0x57df('0x16')]();if(_0x40f252[_0x57df('0x42')]==_0x57df('0x43')){if(!queues[_0x40f252[_0x57df('0x5')]][_0x57df('0x43')]){queues[_0x40f252['uniqueid']][_0x57df('0xb')]=_0x57df('0x44');}}else{queues[_0x40f252[_0x57df('0x5')]][_0x57df('0xb')]=_0x57df('0x45')+_0x40f252[_0x57df('0x42')][_0x57df('0x25')]();}utils[_0x57df('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x40f252[_0x57df('0x5')],queues[_0x40f252['uniqueid']][_0x57df('0x1f')],_0x40f252[_0x57df('0x3b')],queues[_0x40f252[_0x57df('0x5')]][_0x57df('0xb')]));writeDB(queues[_0x40f252[_0x57df('0x5')]]);}}}catch(_0x1a6497){utils[_0x57df('0x17')](util['format']('[%s][queues][agentcomplete]',_0x40f252[_0x57df('0x5')]),_0x1a6497);}};exports[_0x57df('0x46')]=function(_0xf14d7){try{if(!_['isNil'](queues[_0xf14d7['transfereeuniqueid']])){utils[_0x57df('0x12')](util[_0x57df('0x3')]('[%s][queues][blindtransfer]',_0xf14d7['uniqueid']),_0xf14d7);queues[_0xf14d7[_0x57df('0x47')]][_0x57df('0x43')]=!![];queues[_0xf14d7['transfereeuniqueid']]['transfertype']='BLIND';queues[_0xf14d7['transfereeuniqueid']][_0x57df('0x48')]=_0xf14d7[_0x57df('0x49')];queues[_0xf14d7['transfereeuniqueid']][_0x57df('0x4a')]=_0xf14d7['transfereeuniqueid'];queues[_0xf14d7[_0x57df('0x47')]][_0x57df('0xb')]=_0x57df('0x4b');utils['info'](util[_0x57df('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0xf14d7[_0x57df('0x5')],queues[_0xf14d7[_0x57df('0x47')]][_0x57df('0x1f')],_0xf14d7[_0x57df('0x47')],_0xf14d7[_0x57df('0x49')]));}}catch(_0x3cf9af){utils[_0x57df('0x17')](util[_0x57df('0x3')](_0x57df('0x4c'),_0xf14d7['uniqueid']),_0x3cf9af);}};exports['attendedtransfer']=function(_0x46f93c){try{utils[_0x57df('0x12')](util[_0x57df('0x3')](_0x57df('0x4d'),_0x46f93c['origtransfereruniqueid']),_0x46f93c);if(_0x46f93c[_0x57df('0x4e')]==_0x46f93c[_0x57df('0x4f')]){if(!_[_0x57df('0x19')](queues[_0x46f93c['secondtransfererlinkedid']])){utils[_0x57df('0x2')](util[_0x57df('0x3')](_0x57df('0x50'),_0x46f93c['origtransfereruniqueid'],queues[_0x46f93c[_0x57df('0x51')]][_0x57df('0x1f')],_0x46f93c[_0x57df('0x52')]));queues[_0x46f93c[_0x57df('0x51')]][_0x57df('0x43')]=!![];queues[_0x46f93c['secondtransfererlinkedid']]['transfertype']=_0x57df('0x53');queues[_0x46f93c[_0x57df('0x51')]][_0x57df('0x48')]=_0x46f93c[_0x57df('0x52')];queues[_0x46f93c[_0x57df('0x51')]][_0x57df('0x4a')]=_0x46f93c[_0x57df('0x4e')];queues[_0x46f93c[_0x57df('0x51')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x46f93c['origtransfererlinkedid']])){if(_0x46f93c[_0x57df('0x54')]&&queues[_0x46f93c[_0x57df('0x54')]]){queues[_0x46f93c[_0x57df('0x54')]]['queuecallerenterreason']=0x1;queues[_0x46f93c[_0x57df('0x47')]]=_['clone'](queues[_0x46f93c[_0x57df('0x54')]]);queues[_0x46f93c[_0x57df('0x47')]]['transfereduniqueid']=_0x46f93c['transfertargetuniqueid'];queues[_0x46f93c[_0x57df('0x47')]][_0x57df('0x55')]=0x2;queues[_0x46f93c[_0x57df('0x47')]][_0x57df('0x9')]=queues[_0x46f93c[_0x57df('0x51')]]['calleridnum'];queues[_0x46f93c[_0x57df('0x47')]][_0x57df('0x56')]=queues[_0x46f93c[_0x57df('0x51')]][_0x57df('0x56')];queues[_0x46f93c[_0x57df('0x47')]][_0x57df('0x35')]=utils[_0x57df('0x16')]();queues[_0x46f93c[_0x57df('0x47')]][_0x57df('0x1b')]=utils['now']();queues[_0x46f93c['transfereeuniqueid']][_0x57df('0x33')]=0x0;queues[_0x46f93c[_0x57df('0x47')]][_0x57df('0x57')]=0x0;utils[_0x57df('0x2')](util['format'](_0x57df('0x58'),_0x46f93c[_0x57df('0x4e')],queues[_0x46f93c[_0x57df('0x47')]][_0x57df('0x1f')],queues[_0x46f93c['transfereeuniqueid']][_0x57df('0x9')],queues[_0x46f93c[_0x57df('0x47')]][_0x57df('0x56')]));}else{utils[_0x57df('0x2')](util[_0x57df('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x46f93c['origtransfereruniqueid'],queues[_0x46f93c[_0x57df('0x4f')]][_0x57df('0x1f')],_0x46f93c[_0x57df('0x51')]));queues[_0x46f93c['origtransfererlinkedid']][_0x57df('0x10')]=_0x46f93c[_0x57df('0x51')];}}}else if(_0x46f93c[_0x57df('0x59')]==_0x46f93c[_0x57df('0x51')]){if(!_[_0x57df('0x19')](queues[_0x46f93c[_0x57df('0x4f')]])){utils['info'](util[_0x57df('0x3')](_0x57df('0x5a'),_0x46f93c[_0x57df('0x4e')],queues[_0x46f93c[_0x57df('0x4f')]][_0x57df('0x1f')],_0x46f93c['secondtransfereruniqueid'],_0x46f93c['secondtransfererexten']));queues[_0x46f93c['origtransfererlinkedid']][_0x57df('0x43')]=!![];queues[_0x46f93c['origtransfererlinkedid']]['transfertype']=_0x57df('0x53');queues[_0x46f93c[_0x57df('0x4f')]][_0x57df('0x48')]=_0x46f93c[_0x57df('0x5b')];queues[_0x46f93c[_0x57df('0x4f')]][_0x57df('0x4a')]=_0x46f93c['secondtransfereruniqueid'];queues[_0x46f93c[_0x57df('0x4f')]][_0x57df('0xb')]='ATTENDEDTRANSFER';}if(!_[_0x57df('0x19')](queues[_0x46f93c[_0x57df('0x51')]])){if(_0x46f93c[_0x57df('0x5c')]&&queues[_0x46f93c['transfertargetlinkedid']]){queues[_0x46f93c[_0x57df('0x5c')]][_0x57df('0x55')]=0x1;queues[_0x46f93c[_0x57df('0x5d')]]=_[_0x57df('0x5e')](queues[_0x46f93c['transfertargetlinkedid']]);queues[_0x46f93c[_0x57df('0x5d')]]['transfereduniqueid']=_0x46f93c['transfertargetuniqueid'];queues[_0x46f93c[_0x57df('0x5d')]][_0x57df('0x55')]=0x2;queues[_0x46f93c[_0x57df('0x5d')]][_0x57df('0x9')]=queues[_0x46f93c[_0x57df('0x4f')]]['calleridnum'];queues[_0x46f93c[_0x57df('0x5d')]][_0x57df('0x56')]=queues[_0x46f93c['origtransfererlinkedid']][_0x57df('0x56')];queues[_0x46f93c[_0x57df('0x5d')]]['queuecallerjoinAt']=utils[_0x57df('0x16')]();queues[_0x46f93c[_0x57df('0x5d')]]['queuecallerleaveAt']=utils[_0x57df('0x16')]();queues[_0x46f93c[_0x57df('0x5d')]]['holdtime']=0x0;queues[_0x46f93c[_0x57df('0x5d')]]['mohtime']=0x0;utils['info'](util[_0x57df('0x3')](_0x57df('0x5f'),_0x46f93c['origtransfereruniqueid'],queues[_0x46f93c[_0x57df('0x5d')]][_0x57df('0x1f')],queues[_0x46f93c[_0x57df('0x5d')]][_0x57df('0x10')],queues[_0x46f93c[_0x57df('0x5d')]][_0x57df('0x9')],queues[_0x46f93c['transfertargetuniqueid']][_0x57df('0x56')]));}else{utils[_0x57df('0x2')](util[_0x57df('0x3')](_0x57df('0x60'),_0x46f93c[_0x57df('0x4e')],queues[_0x46f93c[_0x57df('0x51')]][_0x57df('0x1f')],_0x46f93c[_0x57df('0x4f')]));queues[_0x46f93c[_0x57df('0x51')]][_0x57df('0x10')]=_0x46f93c[_0x57df('0x4f')];}}}}catch(_0x4e5258){utils[_0x57df('0x17')](util['format'](_0x57df('0x4d'),_0x46f93c[_0x57df('0x4e')]),_0x4e5258);}};exports[_0x57df('0x61')]=function(_0x34656f){try{if(!_[_0x57df('0x19')](queues[_0x34656f[_0x57df('0x5')]])){utils[_0x57df('0x12')](util[_0x57df('0x3')]('[%s][queues][musiconholdstart]',_0x34656f[_0x57df('0x5')]),_0x34656f);queues[_0x34656f['uniqueid']][_0x57df('0x62')]=utils[_0x57df('0x16')]();utils[_0x57df('0x2')](util[_0x57df('0x3')](_0x57df('0x63'),_0x34656f[_0x57df('0x5')],queues[_0x34656f[_0x57df('0x5')]]['name'],queues[_0x34656f[_0x57df('0x5')]][_0x57df('0x62')]));}}catch(_0x198bb3){utils[_0x57df('0x17')](util[_0x57df('0x3')](_0x57df('0x64'),_0x34656f[_0x57df('0x5')]),_0x198bb3);}};exports[_0x57df('0x65')]=function(_0x25764f){try{if(!_['isNil'](queues[_0x25764f['uniqueid']])){if(!_['isNil'](queues[_0x25764f['uniqueid']][_0x57df('0x62')])){utils['debug'](util[_0x57df('0x3')]('[%s][queues][musiconholdstop]',_0x25764f[_0x57df('0x5')]),_0x25764f);queues[_0x25764f[_0x57df('0x5')]]['mohtime']+=utils['diffTime'](utils[_0x57df('0x16')](),queues[_0x25764f[_0x57df('0x5')]][_0x57df('0x62')]);utils['info'](util[_0x57df('0x3')]('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x25764f[_0x57df('0x5')],queues[_0x25764f['uniqueid']]['name'],queues[_0x25764f[_0x57df('0x5')]]['mohtime']));delete queues[_0x25764f[_0x57df('0x5')]][_0x57df('0x62')];}}}catch(_0x35345a){utils[_0x57df('0x17')](util[_0x57df('0x3')]('[%s][queues][musiconholdstop]',_0x25764f[_0x57df('0x5')]),_0x35345a);}};
\ No newline at end of file
+var _0xf02e=['[%s][queues][varset]','isNil','variable','value','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','queueposition','[%s][queues][queuecallerabandon]','ABANDONED','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','accountcode','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','toUpperCase','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','extension','BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','transferexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][queuecallerjoin]','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset'];(function(_0x1c1ae5,_0x2eaccf){var _0x15bf42=function(_0x122796){while(--_0x122796){_0x1c1ae5['push'](_0x1c1ae5['shift']());}};_0x15bf42(++_0x2eaccf);}(_0xf02e,0x113));var _0xef02=function(_0x20aedc,_0xaf0c2b){_0x20aedc=_0x20aedc-0x0;var _0x489ad6=_0xf02e[_0x20aedc];return _0x489ad6;};'use strict';var _=require(_0xef02('0x0'));var util=require(_0xef02('0x1'));var utils=require(_0xef02('0x2'));var queues={};function writeDB(_0x344268){utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x5'),_0x344268[_0xef02('0x6')],_0x344268[_0xef02('0x7')],_0x344268[_0xef02('0x8')],_0x344268[_0xef02('0x9')],_0x344268[_0xef02('0xa')],_0x344268['accountcode'],_0x344268['queuecallerexitreason']));if(_0x344268[_0xef02('0x8')]){utils['getVoiceQueueByName'](_0x344268[_0xef02('0x8')])['then'](function(_0x173b8b){if(_0x173b8b){_0x344268[_0xef02('0xb')]=_0x173b8b[_0xef02('0xb')];}utils[_0xef02('0xc')]('CreateVoiceQueueReport',_0x344268);});}else{utils[_0xef02('0xc')](_0xef02('0xd'),_0x344268);}if(_0x344268['transfereduniqueid']){delete queues[_0x344268[_0xef02('0xe')]];}else{delete queues[_0x344268['uniqueid']];}}exports[_0xef02('0xf')]=function(_0x3c4d11){try{utils[_0xef02('0x10')](util[_0xef02('0x4')]('[%s][queues][queuecallerjoin]',_0x3c4d11[_0xef02('0x6')]),_0x3c4d11);utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x11'),_0x3c4d11['uniqueid'],_0x3c4d11[_0xef02('0x8')],_0x3c4d11[_0xef02('0x12')]));queues[_0x3c4d11['uniqueid']]=_[_0xef02('0x13')](_0x3c4d11,{'originalposition':_0x3c4d11[_0xef02('0x12')],'queuecallerjoinAt':utils[_0xef02('0x14')](),'mohtime':0x0});}catch(_0x2bea22){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x16'),_0x3c4d11[_0xef02('0x6')]),_0x2bea22);}};exports[_0xef02('0x17')]=function(_0x60b3aa){try{if(!_['isNil'](queues[_0x60b3aa[_0xef02('0x6')]])){utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x18'),_0x60b3aa[_0xef02('0x6')]),_0x60b3aa);if(queues[_0x60b3aa['uniqueid']][_0xef02('0x19')]){if(!queues[_0x60b3aa['uniqueid']]['queuecallerabandon']&&!queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0x1a')]){queues[_0x60b3aa[_0xef02('0x6')]]['queuecallercomplete']=!![];queues[_0x60b3aa[_0xef02('0x6')]]['queuecallercompleteAt']=utils[_0xef02('0x14')]();queues[_0x60b3aa[_0xef02('0x6')]]['queuecallerexitreason']=_0xef02('0x1b');}utils['info'](util[_0xef02('0x4')](_0xef02('0x1c'),_0x60b3aa[_0xef02('0x6')],queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0x1d')],queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0x1e')]));writeDB(queues[_0x60b3aa[_0xef02('0x6')]]);}else if(queues[_0x60b3aa[_0xef02('0x6')]]['transfereduniqueid']){utils['info'](util[_0xef02('0x4')](_0xef02('0x1f'),_0x60b3aa[_0xef02('0x6')],queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0x1d')],queues[_0x60b3aa[_0xef02('0x6')]][_0xef02('0xe')]));queues[queues[_0x60b3aa[_0xef02('0x6')]]['transfereduniqueid']]=queues[_0x60b3aa['uniqueid']];queues[queues[_0x60b3aa['uniqueid']]['transfereduniqueid']][_0xef02('0x20')]=0x2;delete queues[_0x60b3aa[_0xef02('0x6')]];}}}catch(_0x5f25f9){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x18'),_0x60b3aa[_0xef02('0x6')]),_0x5f25f9);}};exports[_0xef02('0x21')]=function(_0x3d2310){try{utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x22'),_0x3d2310[_0xef02('0x6')]),_0x3d2310);if(!_[_0xef02('0x23')](_0x3d2310[_0xef02('0x24')]['queuestatus'])&&_0x3d2310[_0xef02('0x25')]['toUpperCase']()!==_0xef02('0x26')){if(!_[_0xef02('0x23')](queues[_0x3d2310[_0xef02('0x6')]])){queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x27')]=![];queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x28')]=null;queues[_0x3d2310['uniqueid']][_0xef02('0x1a')]=!![];queues[_0x3d2310['uniqueid']][_0xef02('0x29')]=utils[_0xef02('0x14')]();queues[_0x3d2310[_0xef02('0x6')]]['queuecallerexitreason']=_0x3d2310[_0xef02('0x25')]['toUpperCase']();utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x3d2310[_0xef02('0x6')],queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x1d')],_0x3d2310['value'],queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x1e')]));writeDB(queues[_0x3d2310[_0xef02('0x6')]]);}}else if(!_['isNil'](_0x3d2310[_0xef02('0x24')][_0xef02('0x2a')])){if(!_['isNil'](queues[_0x3d2310[_0xef02('0x6')]])&&!queues[_0x3d2310[_0xef02('0x6')]]['queuecallerabandon']){queues[_0x3d2310[_0xef02('0x6')]]['queuecallerabandon']=![];queues[_0x3d2310['uniqueid']]['queuecallerabandonAt']=null;queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x1a')]=!![];queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x29')]=utils[_0xef02('0x14')]();queues[_0x3d2310['uniqueid']]['queuecallerexitreason']='EXITWITHKEY';utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s',_0x3d2310[_0xef02('0x6')],queues[_0x3d2310[_0xef02('0x6')]][_0xef02('0x1d')],_0x3d2310[_0xef02('0x25')],queues[_0x3d2310[_0xef02('0x6')]]['queuecallerexitreason']));}}}catch(_0x5d6ccd){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x22'),_0x3d2310[_0xef02('0x6')]),_0x5d6ccd);}};exports[_0xef02('0x27')]=function(_0x1ba4fc){try{if(!_[_0xef02('0x23')](queues[_0x1ba4fc[_0xef02('0x6')]])){utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x2b'),_0x1ba4fc[_0xef02('0x6')]),_0x1ba4fc);queues[_0x1ba4fc[_0xef02('0x6')]][_0xef02('0x1a')]=![];queues[_0x1ba4fc['uniqueid']][_0xef02('0x29')]=null;queues[_0x1ba4fc['uniqueid']]['queuecallerabandon']=!![];queues[_0x1ba4fc['uniqueid']][_0xef02('0x28')]=utils['now']();queues[_0x1ba4fc[_0xef02('0x6')]][_0xef02('0x1e')]=_0xef02('0x2c');utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x1ba4fc[_0xef02('0x6')],queues[_0x1ba4fc['uniqueid']][_0xef02('0x1d')],queues[_0x1ba4fc[_0xef02('0x6')]][_0xef02('0x1e')]));}}catch(_0x195e98){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x2b'),_0x1ba4fc['uniqueid']),_0x195e98);}};exports[_0xef02('0x2d')]=function(_0x45d630){try{if(!_[_0xef02('0x23')](queues[_0x45d630[_0xef02('0x6')]])){utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x2e'),_0x45d630[_0xef02('0x6')]),_0x45d630);utils[_0xef02('0x3')](util['format'](_0xef02('0x2f'),_0x45d630[_0xef02('0x6')],queues[_0x45d630['uniqueid']][_0xef02('0x1d')],_0x45d630[_0xef02('0x30')],_0x45d630[_0xef02('0x31')]));queues[_0x45d630['uniqueid']][_0xef02('0x2d')]=!![];queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x19')]=utils[_0xef02('0x14')]();queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x32')]=utils['diffTime'](queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x19')],queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x33')]);queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x12')]=_0x45d630[_0xef02('0x12')];queues[_0x45d630['uniqueid']][_0xef02('0x34')]=_0x45d630[_0xef02('0x34')];queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x30')]=_0x45d630[_0xef02('0x30')];queues[_0x45d630[_0xef02('0x6')]][_0xef02('0x31')]=_0x45d630['connectedlinename'];}}catch(_0x550b2f){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x2e'),_0x45d630[_0xef02('0x6')]),_0x550b2f);}};exports[_0xef02('0x35')]=function(_0x2e0f4e){try{if(!_[_0xef02('0x23')](queues[_0x2e0f4e[_0xef02('0x6')]])){utils['debug'](util[_0xef02('0x4')](_0xef02('0x36'),_0x2e0f4e[_0xef02('0x6')]),_0x2e0f4e);utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x37'),_0x2e0f4e[_0xef02('0x6')],queues[_0x2e0f4e[_0xef02('0x6')]]['name'],_0x2e0f4e[_0xef02('0x38')],_0x2e0f4e[_0xef02('0x39')]));queues[_0x2e0f4e[_0xef02('0x6')]]['queuecallerabandon']=![];queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x27')]=![];queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x28')]=null;queues[_0x2e0f4e[_0xef02('0x6')]]['queuecallerexit']=![];queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x1e')]=null;queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x29')]=null;queues[_0x2e0f4e[_0xef02('0x6')]]['assigned']=!![];queues[_0x2e0f4e[_0xef02('0x6')]][_0xef02('0x3a')]=_0x2e0f4e[_0xef02('0x39')];queues[_0x2e0f4e['uniqueid']][_0xef02('0x9')]=_0x2e0f4e[_0xef02('0x38')];}}catch(_0x3c2f4e){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x36'),_0x2e0f4e['uniqueid']),_0x3c2f4e);}};exports[_0xef02('0x3b')]=function(_0x22ca06){try{if(!_[_0xef02('0x23')](queues[_0x22ca06[_0xef02('0x6')]])){if(queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x19')]){utils['debug'](util[_0xef02('0x4')](_0xef02('0x3c'),_0x22ca06['uniqueid']),_0x22ca06);queues[_0x22ca06['uniqueid']][_0xef02('0x27')]=![];queues[_0x22ca06['uniqueid']][_0xef02('0x27')]=![];queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x28')]=null;queues[_0x22ca06['uniqueid']][_0xef02('0x1a')]=![];queues[_0x22ca06[_0xef02('0x6')]]['queuecallerexitAt']=null;queues[_0x22ca06[_0xef02('0x6')]]['assigned']=!![];queues[_0x22ca06[_0xef02('0x6')]]['lastAssignedTo']=_0x22ca06[_0xef02('0x38')];queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x3d')]=!![];queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x3e')]=utils['now']();if(_0x22ca06[_0xef02('0x3f')]==_0xef02('0x40')){if(!queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x40')]){queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x1e')]=_0xef02('0x41');}}else{queues[_0x22ca06[_0xef02('0x6')]][_0xef02('0x1e')]=_0xef02('0x42')+_0x22ca06[_0xef02('0x3f')][_0xef02('0x43')]();}utils[_0xef02('0x3')](util['format'](_0xef02('0x44'),_0x22ca06[_0xef02('0x6')],queues[_0x22ca06['uniqueid']]['name'],_0x22ca06[_0xef02('0x38')],queues[_0x22ca06[_0xef02('0x6')]]['queuecallerexitreason']));writeDB(queues[_0x22ca06[_0xef02('0x6')]]);}}}catch(_0x1305a3){utils[_0xef02('0x15')](util['format'](_0xef02('0x3c'),_0x22ca06['uniqueid']),_0x1305a3);}};exports[_0xef02('0x45')]=function(_0x1b5c9b){try{if(!_['isNil'](queues[_0x1b5c9b['transfereeuniqueid']])){utils['debug'](util[_0xef02('0x4')](_0xef02('0x46'),_0x1b5c9b[_0xef02('0x6')]),_0x1b5c9b);queues[_0x1b5c9b[_0xef02('0x47')]][_0xef02('0x40')]=!![];queues[_0x1b5c9b[_0xef02('0x47')]][_0xef02('0x48')]='BLIND';queues[_0x1b5c9b[_0xef02('0x47')]]['transferexten']=_0x1b5c9b[_0xef02('0x49')];queues[_0x1b5c9b[_0xef02('0x47')]]['transferuniqueid']=_0x1b5c9b[_0xef02('0x47')];queues[_0x1b5c9b[_0xef02('0x47')]][_0xef02('0x1e')]=_0xef02('0x4a');utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x1b5c9b[_0xef02('0x6')],queues[_0x1b5c9b['transfereeuniqueid']][_0xef02('0x1d')],_0x1b5c9b[_0xef02('0x47')],_0x1b5c9b[_0xef02('0x49')]));}}catch(_0x1bb4e0){utils[_0xef02('0x15')](util[_0xef02('0x4')]('[%s][queues][blindtransfer]',_0x1b5c9b[_0xef02('0x6')]),_0x1bb4e0);}};exports[_0xef02('0x4b')]=function(_0x29a909){try{utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x4c'),_0x29a909[_0xef02('0x4d')]),_0x29a909);if(_0x29a909['origtransfereruniqueid']==_0x29a909[_0xef02('0x4e')]){if(!_[_0xef02('0x23')](queues[_0x29a909[_0xef02('0x4f')]])){utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x50'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x1d')],_0x29a909[_0xef02('0x51')]));queues[_0x29a909['secondtransfererlinkedid']][_0xef02('0x40')]=!![];queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x48')]='ATTENDED';queues[_0x29a909['secondtransfererlinkedid']][_0xef02('0x52')]=_0x29a909[_0xef02('0x51')];queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x53')]=_0x29a909[_0xef02('0x4d')];queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x1e')]=_0xef02('0x54');}if(!_[_0xef02('0x23')](queues[_0x29a909[_0xef02('0x4e')]])){if(_0x29a909[_0xef02('0x55')]&&queues[_0x29a909[_0xef02('0x55')]]){queues[_0x29a909[_0xef02('0x55')]][_0xef02('0x20')]=0x1;queues[_0x29a909[_0xef02('0x47')]]=_[_0xef02('0x56')](queues[_0x29a909[_0xef02('0x55')]]);queues[_0x29a909[_0xef02('0x47')]][_0xef02('0xe')]=_0x29a909['transfertargetuniqueid'];queues[_0x29a909['transfereeuniqueid']][_0xef02('0x20')]=0x2;queues[_0x29a909[_0xef02('0x47')]][_0xef02('0xa')]=queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0xa')];queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x57')]=queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x57')];queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x33')]=utils['now']();queues[_0x29a909[_0xef02('0x47')]]['queuecallerleaveAt']=utils[_0xef02('0x14')]();queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x32')]=0x0;queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x58')]=0x0;utils['info'](util[_0xef02('0x4')](_0xef02('0x59'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x47')]]['name'],queues[_0x29a909[_0xef02('0x47')]][_0xef02('0xa')],queues[_0x29a909[_0xef02('0x47')]][_0xef02('0x57')]));}else{utils['info'](util[_0xef02('0x4')](_0xef02('0x5a'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x4e')]]['name'],_0x29a909[_0xef02('0x4f')]));queues[_0x29a909[_0xef02('0x4e')]][_0xef02('0xe')]=_0x29a909[_0xef02('0x4f')];}}}else if(_0x29a909[_0xef02('0x5b')]==_0x29a909[_0xef02('0x4f')]){if(!_[_0xef02('0x23')](queues[_0x29a909[_0xef02('0x4e')]])){utils[_0xef02('0x3')](util[_0xef02('0x4')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x29a909[_0xef02('0x4d')],queues[_0x29a909['origtransfererlinkedid']][_0xef02('0x1d')],_0x29a909['secondtransfereruniqueid'],_0x29a909[_0xef02('0x5c')]));queues[_0x29a909[_0xef02('0x4e')]]['transfer']=!![];queues[_0x29a909['origtransfererlinkedid']][_0xef02('0x48')]='ATTENDED';queues[_0x29a909[_0xef02('0x4e')]]['transferexten']=_0x29a909[_0xef02('0x5c')];queues[_0x29a909[_0xef02('0x4e')]][_0xef02('0x53')]=_0x29a909[_0xef02('0x5b')];queues[_0x29a909[_0xef02('0x4e')]]['queuecallerexitreason']=_0xef02('0x54');}if(!_[_0xef02('0x23')](queues[_0x29a909['secondtransfererlinkedid']])){if(_0x29a909['transfertargetlinkedid']&&queues[_0x29a909['transfertargetlinkedid']]){queues[_0x29a909[_0xef02('0x5d')]][_0xef02('0x20')]=0x1;queues[_0x29a909['transfertargetuniqueid']]=_[_0xef02('0x56')](queues[_0x29a909[_0xef02('0x5d')]]);queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0xe')]=_0x29a909[_0xef02('0x5e')];queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x20')]=0x2;queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0xa')]=queues[_0x29a909[_0xef02('0x4e')]][_0xef02('0xa')];queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x57')]=queues[_0x29a909[_0xef02('0x4e')]][_0xef02('0x57')];queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x33')]=utils[_0xef02('0x14')]();queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x19')]=utils['now']();queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x32')]=0x0;queues[_0x29a909[_0xef02('0x5e')]]['mohtime']=0x0;utils['info'](util[_0xef02('0x4')](_0xef02('0x5f'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0x1d')],queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0xe')],queues[_0x29a909[_0xef02('0x5e')]][_0xef02('0xa')],queues[_0x29a909['transfertargetuniqueid']][_0xef02('0x57')]));}else{utils[_0xef02('0x3')](util['format'](_0xef02('0x5a'),_0x29a909[_0xef02('0x4d')],queues[_0x29a909[_0xef02('0x4f')]][_0xef02('0x1d')],_0x29a909[_0xef02('0x4e')]));queues[_0x29a909['secondtransfererlinkedid']][_0xef02('0xe')]=_0x29a909[_0xef02('0x4e')];}}}}catch(_0x3735e1){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x4c'),_0x29a909[_0xef02('0x4d')]),_0x3735e1);}};exports[_0xef02('0x60')]=function(_0x500f6c){try{if(!_[_0xef02('0x23')](queues[_0x500f6c[_0xef02('0x6')]])){utils[_0xef02('0x10')](util[_0xef02('0x4')](_0xef02('0x61'),_0x500f6c[_0xef02('0x6')]),_0x500f6c);queues[_0x500f6c[_0xef02('0x6')]][_0xef02('0x62')]=utils[_0xef02('0x14')]();utils[_0xef02('0x3')](util[_0xef02('0x4')](_0xef02('0x63'),_0x500f6c[_0xef02('0x6')],queues[_0x500f6c[_0xef02('0x6')]][_0xef02('0x1d')],queues[_0x500f6c['uniqueid']][_0xef02('0x62')]));}}catch(_0x28fb4e){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x61'),_0x500f6c[_0xef02('0x6')]),_0x28fb4e);}};exports[_0xef02('0x64')]=function(_0x8ba316){try{if(!_[_0xef02('0x23')](queues[_0x8ba316[_0xef02('0x6')]])){if(!_[_0xef02('0x23')](queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x62')])){utils[_0xef02('0x10')](util[_0xef02('0x4')]('[%s][queues][musiconholdstop]',_0x8ba316[_0xef02('0x6')]),_0x8ba316);queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x58')]+=utils['diffTime'](utils[_0xef02('0x14')](),queues[_0x8ba316['uniqueid']][_0xef02('0x62')]);utils[_0xef02('0x3')](util['format'](_0xef02('0x65'),_0x8ba316[_0xef02('0x6')],queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x1d')],queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x58')]));delete queues[_0x8ba316[_0xef02('0x6')]][_0xef02('0x62')];}}}catch(_0x3a1fb9){utils[_0xef02('0x15')](util[_0xef02('0x4')](_0xef02('0x66'),_0x8ba316['uniqueid']),_0x3a1fb9);}};
\ No newline at end of file
index 3405045..49ddc6f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x9fac=['push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','outbound','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','membername','UserId','CreateVoiceRecording','newchannel','linkedid','context','channel','[%s][recordings][newchannel]','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','[%s][recordings][newstate]','variable','mixmonitor_filename','debug','[%s][recordings][varset]','value','endsWith','.wav49','replace','.WAV','find','monitors'];(function(_0x26f758,_0x10494d){var _0x23c47e=function(_0xbcba27){while(--_0xbcba27){_0x26f758['push'](_0x26f758['shift']());}};_0x23c47e(++_0x10494d);}(_0x9fac,0x190));var _0xc9fa=function(_0x1d4694,_0x41200b){_0x1d4694=_0x1d4694-0x0;var _0x2d953d=_0x9fac[_0x1d4694];return _0x2d953d;};'use strict';var _=require('lodash');var util=require(_0xc9fa('0x0'));var utils=require(_0xc9fa('0x1'));var recordings={};function writeDB(_0x4198c3){utils[_0xc9fa('0x2')](util[_0xc9fa('0x3')](_0xc9fa('0x4'),_0x4198c3[_0xc9fa('0x5')]));if(_0x4198c3[_0xc9fa('0x6')]){utils['getUserByInternal'](_0x4198c3[_0xc9fa('0x6')])['then'](function(_0x301e5e){if(_0x301e5e){_0x4198c3[_0xc9fa('0x7')]=_0x301e5e['name'];_0x4198c3[_0xc9fa('0x8')]=_0x301e5e['id'];}utils['request'](_0xc9fa('0x9'),_0x4198c3);});}else{utils['request'](_0xc9fa('0x9'),_0x4198c3);}}exports[_0xc9fa('0xa')]=function(_0x5f55d3){try{utils['debug'](util[_0xc9fa('0x3')]('[%s][recordings][newchannel]',_0x5f55d3[_0xc9fa('0x5')]),_0x5f55d3);if(_0x5f55d3['uniqueid']==_0x5f55d3[_0xc9fa('0xb')]){utils['info'](util[_0xc9fa('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x5f55d3[_0xc9fa('0x5')],_0x5f55d3[_0xc9fa('0xc')],_0x5f55d3['exten']));recordings[_0x5f55d3[_0xc9fa('0x5')]]={'uniqueid':_0x5f55d3[_0xc9fa('0x5')],'accountcode':_0x5f55d3[_0xc9fa('0x6')],'exten':_0x5f55d3['exten'],'context':_0x5f55d3['context'],'channel':_0x5f55d3[_0xc9fa('0xd')],'monitors':[]};}}catch(_0x475551){utils['error'](util[_0xc9fa('0x3')](_0xc9fa('0xe'),_0x5f55d3[_0xc9fa('0x5')]),_0x475551);}};exports[_0xc9fa('0xf')]=function(_0x4d63c5){try{utils['debug'](util['format']('[%s][recordings][newstate]',_0x4d63c5[_0xc9fa('0x5')]),_0x4d63c5);if(!_[_0xc9fa('0x10')](recordings[_0x4d63c5[_0xc9fa('0x5')]])&&_0x4d63c5[_0xc9fa('0x11')]==0x6){utils[_0xc9fa('0x2')](util['format'](_0xc9fa('0x12'),_0x4d63c5[_0xc9fa('0x5')],_0x4d63c5[_0xc9fa('0xc')],_0x4d63c5[_0xc9fa('0xd')]));}else if(!_[_0xc9fa('0x10')](recordings[_0x4d63c5['linkedid']])&&_0x4d63c5[_0xc9fa('0x11')]==0x6&&_0x4d63c5[_0xc9fa('0xc')]!=_0xc9fa('0x13')){utils[_0xc9fa('0x2')](util['format'](_0xc9fa('0x14'),_0x4d63c5[_0xc9fa('0x5')],_0x4d63c5[_0xc9fa('0xb')],_0x4d63c5[_0xc9fa('0xc')],_0x4d63c5[_0xc9fa('0xd')]));recordings[_0x4d63c5['linkedid']][_0xc9fa('0x6')]=_0x4d63c5[_0xc9fa('0x6')];}}catch(_0x535080){utils[_0xc9fa('0x15')](util[_0xc9fa('0x3')](_0xc9fa('0x16'),_0x4d63c5['uniqueid']),_0x535080);}};exports['varset']=function(_0x2a29f5){try{if(!_[_0xc9fa('0x10')](_0x2a29f5[_0xc9fa('0x17')])&&!_[_0xc9fa('0x10')](_0x2a29f5['variable'][_0xc9fa('0x18')])){utils[_0xc9fa('0x19')](util[_0xc9fa('0x3')](_0xc9fa('0x1a'),_0x2a29f5[_0xc9fa('0x5')]),_0x2a29f5);utils[_0xc9fa('0x2')](util['format']('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x2a29f5[_0xc9fa('0x5')],_0x2a29f5[_0xc9fa('0x17')],_0x2a29f5[_0xc9fa('0x1b')]));if(_[_0xc9fa('0x1c')](_0x2a29f5[_0xc9fa('0x1b')],_0xc9fa('0x1d'))){_0x2a29f5[_0xc9fa('0x1b')]=_0x2a29f5[_0xc9fa('0x1b')][_0xc9fa('0x1e')](_0xc9fa('0x1d'),_0xc9fa('0x1f'));}if(recordings[_0x2a29f5['linkedid']]){var _0x4f12b2=_[_0xc9fa('0x20')](recordings[_0x2a29f5[_0xc9fa('0xb')]][_0xc9fa('0x21')],{'value':_0x2a29f5[_0xc9fa('0x1b')]});if(_[_0xc9fa('0x10')](_0x4f12b2)){recordings[_0x2a29f5[_0xc9fa('0xb')]][_0xc9fa('0x21')][_0xc9fa('0x22')]({'value':_0x2a29f5['value']});}}}}catch(_0x2e5cc0){utils[_0xc9fa('0x15')](util[_0xc9fa('0x3')](_0xc9fa('0x1a'),_0x2a29f5['uniqueid']),_0x2e5cc0);}};exports[_0xc9fa('0x23')]=function(_0x12e83c){try{if(!_['isNil'](recordings[_0x12e83c['uniqueid']])){utils[_0xc9fa('0x19')](util[_0xc9fa('0x3')](_0xc9fa('0x24'),_0x12e83c[_0xc9fa('0x5')]),_0x12e83c);utils[_0xc9fa('0x2')](util[_0xc9fa('0x3')](_0xc9fa('0x25'),_0x12e83c['uniqueid'],_0x12e83c[_0xc9fa('0x26')],_0x12e83c['calleridname'],_0x12e83c[_0xc9fa('0x27')]));recordings[_0x12e83c[_0xc9fa('0x5')]][_0xc9fa('0x26')]=_0x12e83c[_0xc9fa('0x26')];recordings[_0x12e83c[_0xc9fa('0x5')]][_0xc9fa('0x28')]=_0x12e83c[_0xc9fa('0x28')];recordings[_0x12e83c[_0xc9fa('0x5')]][_0xc9fa('0x29')]=_0x12e83c[_0xc9fa('0x29')];recordings[_0x12e83c[_0xc9fa('0x5')]][_0xc9fa('0x2a')]=_0x12e83c['connectedlinename'];if(recordings[_0x12e83c[_0xc9fa('0x5')]][_0xc9fa('0x2b')]==_0xc9fa('0x2c')&&recordings[_0x12e83c[_0xc9fa('0x5')]][_0xc9fa('0x6')]){recordings[_0x12e83c['uniqueid']][_0xc9fa('0x29')]=recordings[_0x12e83c['uniqueid']]['accountcode'];recordings[_0x12e83c[_0xc9fa('0x5')]]['connectedlinename']='';}recordings[_0x12e83c[_0xc9fa('0x5')]][_0xc9fa('0x21')]['forEach'](function(_0x53e42e){var _0x58e25a=_[_0xc9fa('0x2d')](recordings[_0x12e83c[_0xc9fa('0x5')]]);_0x58e25a[_0xc9fa('0x1b')]=_0x53e42e[_0xc9fa('0x1b')];writeDB(_0x58e25a);});delete recordings[_0x12e83c['uniqueid']];}}catch(_0x3df3b7){utils['error'](util['format'](_0xc9fa('0x24'),_0x12e83c['uniqueid']),_0x3df3b7);}};exports[_0xc9fa('0x2e')]=function(_0x36e9e0){try{if(!_[_0xc9fa('0x10')](recordings[_0x36e9e0['uniqueid']])){utils[_0xc9fa('0x19')](util[_0xc9fa('0x3')](_0xc9fa('0x2f'),_0x36e9e0[_0xc9fa('0x5')]),_0x36e9e0);utils['info'](util['format'](_0xc9fa('0x30'),_0x36e9e0[_0xc9fa('0x5')],_0x36e9e0[_0xc9fa('0x31')],_0x36e9e0[_0xc9fa('0x32')]));if(_0x36e9e0['application'][_0xc9fa('0x33')]()==_0xc9fa('0x34')&&_[_0xc9fa('0x35')](_0x36e9e0[_0xc9fa('0x32')][_0xc9fa('0x33')](),_0xc9fa('0x36'))){var _0x6fb571=_0x36e9e0[_0xc9fa('0x32')][_0xc9fa('0x37')]('=');var _0x2da8cc=_0x6fb571[0x0][_0xc9fa('0x38')](_0x6fb571[0x0][_0xc9fa('0x39')]('(')+0x1,_0x6fb571[0x0][_0xc9fa('0x39')](')'));var _0x20db86=_0x6fb571[0x1];recordings[_0x36e9e0[_0xc9fa('0x5')]][_0x2da8cc]=_0x20db86;}}}catch(_0x27f89f){utils['error'](util[_0xc9fa('0x3')](_0xc9fa('0x2f'),_0x36e9e0[_0xc9fa('0x5')]),_0x27f89f);}};exports[_0xc9fa('0x3a')]=function(_0x4d69fa){try{if(!_['isNil'](recordings[_0x4d69fa['uniqueid']])){utils[_0xc9fa('0x19')](util[_0xc9fa('0x3')](_0xc9fa('0x3b'),_0x4d69fa['uniqueid']),_0x4d69fa);utils[_0xc9fa('0x2')](util[_0xc9fa('0x3')](_0xc9fa('0x3c'),_0x4d69fa[_0xc9fa('0x5')],_0x4d69fa[_0xc9fa('0x3d')]));recordings[_0x4d69fa[_0xc9fa('0x5')]][_0xc9fa('0x3d')]=_0x4d69fa[_0xc9fa('0x3d')];}}catch(_0x1e7cf5){utils[_0xc9fa('0x15')](util[_0xc9fa('0x3')](_0xc9fa('0x3b'),_0x4d69fa['uniqueid']),_0x1e7cf5);}};
\ No newline at end of file
+var _0x62cc=['request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','debug','isNil','channelstate','channel','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','replace','.wav49','.WAV','find','monitors','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','appdata','application','toLowerCase','set','startsWith','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x62cc,0xf4));var _0xc62c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc62c('0x0'));var util=require(_0xc62c('0x1'));var utils=require(_0xc62c('0x2'));var recordings={};function writeDB(_0x131ca5){utils[_0xc62c('0x3')](util[_0xc62c('0x4')](_0xc62c('0x5'),_0x131ca5[_0xc62c('0x6')]));if(_0x131ca5[_0xc62c('0x7')]){utils[_0xc62c('0x8')](_0x131ca5['accountcode'])[_0xc62c('0x9')](function(_0x13191d){if(_0x13191d){_0x131ca5['membername']=_0x13191d[_0xc62c('0xa')];_0x131ca5[_0xc62c('0xb')]=_0x13191d['id'];}utils[_0xc62c('0xc')](_0xc62c('0xd'),_0x131ca5);});}else{utils[_0xc62c('0xc')]('CreateVoiceRecording',_0x131ca5);}}exports[_0xc62c('0xe')]=function(_0x40d0a0){try{utils['debug'](util[_0xc62c('0x4')](_0xc62c('0xf'),_0x40d0a0[_0xc62c('0x6')]),_0x40d0a0);if(_0x40d0a0[_0xc62c('0x6')]==_0x40d0a0['linkedid']){utils[_0xc62c('0x3')](util[_0xc62c('0x4')](_0xc62c('0x10'),_0x40d0a0[_0xc62c('0x6')],_0x40d0a0[_0xc62c('0x11')],_0x40d0a0[_0xc62c('0x12')]));recordings[_0x40d0a0[_0xc62c('0x6')]]={'uniqueid':_0x40d0a0[_0xc62c('0x6')],'accountcode':_0x40d0a0[_0xc62c('0x7')],'exten':_0x40d0a0['exten'],'context':_0x40d0a0[_0xc62c('0x11')],'channel':_0x40d0a0['channel'],'monitors':[]};}}catch(_0x42f577){utils[_0xc62c('0x13')](util[_0xc62c('0x4')]('[%s][recordings][newchannel]',_0x40d0a0[_0xc62c('0x6')]),_0x42f577);}};exports['newstate']=function(_0x3b8c73){try{utils[_0xc62c('0x14')](util[_0xc62c('0x4')]('[%s][recordings][newstate]',_0x3b8c73[_0xc62c('0x6')]),_0x3b8c73);if(!_[_0xc62c('0x15')](recordings[_0x3b8c73[_0xc62c('0x6')]])&&_0x3b8c73[_0xc62c('0x16')]==0x6){utils['info'](util[_0xc62c('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x3b8c73[_0xc62c('0x6')],_0x3b8c73['context'],_0x3b8c73[_0xc62c('0x17')]));}else if(!_[_0xc62c('0x15')](recordings[_0x3b8c73[_0xc62c('0x18')]])&&_0x3b8c73['channelstate']==0x6&&_0x3b8c73['context']!=_0xc62c('0x19')){utils['info'](util[_0xc62c('0x4')](_0xc62c('0x1a'),_0x3b8c73[_0xc62c('0x6')],_0x3b8c73[_0xc62c('0x18')],_0x3b8c73['context'],_0x3b8c73['channel']));recordings[_0x3b8c73[_0xc62c('0x18')]][_0xc62c('0x7')]=_0x3b8c73[_0xc62c('0x7')];}}catch(_0x5e398f){utils['error'](util['format'](_0xc62c('0x1b'),_0x3b8c73[_0xc62c('0x6')]),_0x5e398f);}};exports['varset']=function(_0x4583f9){try{if(!_['isNil'](_0x4583f9[_0xc62c('0x1c')])&&!_[_0xc62c('0x15')](_0x4583f9['variable'][_0xc62c('0x1d')])){utils[_0xc62c('0x14')](util[_0xc62c('0x4')](_0xc62c('0x1e'),_0x4583f9[_0xc62c('0x6')]),_0x4583f9);utils[_0xc62c('0x3')](util[_0xc62c('0x4')](_0xc62c('0x1f'),_0x4583f9[_0xc62c('0x6')],_0x4583f9[_0xc62c('0x1c')],_0x4583f9[_0xc62c('0x20')]));if(_[_0xc62c('0x21')](_0x4583f9[_0xc62c('0x20')],'.wav49')){_0x4583f9[_0xc62c('0x20')]=_0x4583f9[_0xc62c('0x20')][_0xc62c('0x22')](_0xc62c('0x23'),_0xc62c('0x24'));}if(recordings[_0x4583f9[_0xc62c('0x18')]]){var _0x4343f9=_[_0xc62c('0x25')](recordings[_0x4583f9['linkedid']]['monitors'],{'value':_0x4583f9[_0xc62c('0x20')]});if(_[_0xc62c('0x15')](_0x4343f9)){recordings[_0x4583f9[_0xc62c('0x18')]][_0xc62c('0x26')]['push']({'value':_0x4583f9[_0xc62c('0x20')]});}}}}catch(_0x2184aa){utils[_0xc62c('0x13')](util['format'](_0xc62c('0x1e'),_0x4583f9[_0xc62c('0x6')]),_0x2184aa);}};exports[_0xc62c('0x27')]=function(_0x283ef1){try{if(!_[_0xc62c('0x15')](recordings[_0x283ef1[_0xc62c('0x6')]])){utils['debug'](util[_0xc62c('0x4')](_0xc62c('0x28'),_0x283ef1[_0xc62c('0x6')]),_0x283ef1);utils['info'](util['format'](_0xc62c('0x29'),_0x283ef1[_0xc62c('0x6')],_0x283ef1[_0xc62c('0x2a')],_0x283ef1[_0xc62c('0x2b')],_0x283ef1[_0xc62c('0x2c')]));recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2a')]=_0x283ef1['calleridnum'];recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2b')]=_0x283ef1[_0xc62c('0x2b')];recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2d')]=_0x283ef1[_0xc62c('0x2d')];recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2e')]=_0x283ef1['connectedlinename'];if(recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2f')]==_0xc62c('0x30')&&recordings[_0x283ef1[_0xc62c('0x6')]]['accountcode']){recordings[_0x283ef1[_0xc62c('0x6')]]['connectedlinenum']=recordings[_0x283ef1[_0xc62c('0x6')]]['accountcode'];recordings[_0x283ef1[_0xc62c('0x6')]][_0xc62c('0x2e')]='';}recordings[_0x283ef1[_0xc62c('0x6')]]['monitors'][_0xc62c('0x31')](function(_0x20c86f){var _0x8a15c8=_[_0xc62c('0x32')](recordings[_0x283ef1['uniqueid']]);_0x8a15c8[_0xc62c('0x20')]=_0x20c86f[_0xc62c('0x20')];writeDB(_0x8a15c8);});delete recordings[_0x283ef1[_0xc62c('0x6')]];}}catch(_0x1f9e13){utils[_0xc62c('0x13')](util[_0xc62c('0x4')](_0xc62c('0x28'),_0x283ef1['uniqueid']),_0x1f9e13);}};exports[_0xc62c('0x33')]=function(_0x24a4e5){try{if(!_[_0xc62c('0x15')](recordings[_0x24a4e5[_0xc62c('0x6')]])){utils[_0xc62c('0x14')](util[_0xc62c('0x4')](_0xc62c('0x34'),_0x24a4e5[_0xc62c('0x6')]),_0x24a4e5);utils[_0xc62c('0x3')](util[_0xc62c('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x24a4e5[_0xc62c('0x6')],_0x24a4e5['application'],_0x24a4e5[_0xc62c('0x35')]));if(_0x24a4e5[_0xc62c('0x36')][_0xc62c('0x37')]()==_0xc62c('0x38')&&_[_0xc62c('0x39')](_0x24a4e5[_0xc62c('0x35')][_0xc62c('0x37')](),_0xc62c('0x3a'))){var _0x2bea5a=_0x24a4e5[_0xc62c('0x35')][_0xc62c('0x3b')]('=');var _0x45b6dc=_0x2bea5a[0x0]['substring'](_0x2bea5a[0x0][_0xc62c('0x3c')]('(')+0x1,_0x2bea5a[0x0][_0xc62c('0x3c')](')'));var _0x74f803=_0x2bea5a[0x1];recordings[_0x24a4e5[_0xc62c('0x6')]][_0x45b6dc]=_0x74f803;}}}catch(_0x364383){utils[_0xc62c('0x13')](util[_0xc62c('0x4')](_0xc62c('0x34'),_0x24a4e5[_0xc62c('0x6')]),_0x364383);}};exports[_0xc62c('0x3d')]=function(_0x28b31c){try{if(!_['isNil'](recordings[_0x28b31c['uniqueid']])){utils[_0xc62c('0x14')](util[_0xc62c('0x4')](_0xc62c('0x3e'),_0x28b31c[_0xc62c('0x6')]),_0x28b31c);utils[_0xc62c('0x3')](util[_0xc62c('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x28b31c[_0xc62c('0x6')],_0x28b31c[_0xc62c('0x3f')]));recordings[_0x28b31c['uniqueid']][_0xc62c('0x3f')]=_0x28b31c[_0xc62c('0x3f')];}}catch(_0x455cfb){utils[_0xc62c('0x13')](util[_0xc62c('0x4')](_0xc62c('0x3e'),_0x28b31c[_0xc62c('0x6')]),_0x455cfb);}};
\ No newline at end of file
index df000ac..7dae9d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6d12=['CreateVoiceTransferReport','blindtransfer','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','debug','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererexten','transfereechannel','assign','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request'];(function(_0x4fa916,_0x3ec36a){var _0x576439=function(_0x5692e0){while(--_0x5692e0){_0x4fa916['push'](_0x4fa916['shift']());}};_0x576439(++_0x3ec36a);}(_0x6d12,0x1ef));var _0x26d1=function(_0xdeab51,_0x5cb7ca){_0xdeab51=_0xdeab51-0x0;var _0x597a97=_0x6d12[_0xdeab51];return _0x597a97;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x26d1('0x0'));function writeDB(_0x48c4e3){utils[_0x26d1('0x1')](util[_0x26d1('0x2')](_0x26d1('0x3'),_0x48c4e3[_0x26d1('0x4')]===_0x26d1('0x5')?_0x48c4e3[_0x26d1('0x6')]:_0x48c4e3[_0x26d1('0x7')],_0x48c4e3[_0x26d1('0x4')]));utils[_0x26d1('0x8')](_0x26d1('0x9'),_0x48c4e3);}exports[_0x26d1('0xa')]=function(_0x1308de){try{utils['debug'](util[_0x26d1('0x2')]('[%s][transfers][blindtransfer]',_0x1308de[_0x26d1('0x7')]),_0x1308de);utils['info'](util[_0x26d1('0x2')](_0x26d1('0xb'),_0x1308de[_0x26d1('0x7')],_0x1308de['transferercalleridnum'],_0x1308de[_0x26d1('0xc')],_0x1308de[_0x26d1('0xd')],_0x1308de['transfereecalleridname']));_0x1308de[_0x26d1('0x4')]=_0x26d1('0xe');writeDB(_0x1308de);}catch(_0x6329c8){utils[_0x26d1('0xf')](util[_0x26d1('0x2')](_0x26d1('0x10'),_0x1308de[_0x26d1('0x7')]),_0x6329c8);}};exports[_0x26d1('0x11')]=function(_0x76c364){try{utils[_0x26d1('0x12')](util['format']('[%s][transfers][attendedtransfer]',_0x76c364[_0x26d1('0x6')]),_0x76c364);utils[_0x26d1('0x1')](util[_0x26d1('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x76c364[_0x26d1('0x6')],_0x76c364[_0x26d1('0x13')],_0x76c364[_0x26d1('0x14')],_0x76c364['transfertargetcalleridnum'],_0x76c364[_0x26d1('0x15')]));_0x76c364=_['assign'](_0x76c364,{'transfererchannel':_0x76c364[_0x26d1('0x16')],'transferercalleridnum':_0x76c364['origtransferercalleridnum'],'transferercalleridname':_0x76c364[_0x26d1('0x14')],'transfererconnectedlinenum':_0x76c364[_0x26d1('0x17')],'transfererconnectedlinename':_0x76c364[_0x26d1('0x18')],'transfereraccountcode':_0x76c364[_0x26d1('0x19')],'transferercontext':_0x76c364['secondtransferercontext'],'transfererexten':_0x76c364[_0x26d1('0x1a')],'transfererlinkedid':_0x76c364['origtransfererlinkedid'],'context':_0x76c364['origtransferercontext'],'extension':_0x76c364[_0x26d1('0x1b')],'type':_0x26d1('0x5')});if(_['isNil'](_0x76c364[_0x26d1('0x1c')])){_0x76c364=_[_0x26d1('0x1d')](_0x76c364,{'transfereechannel':_0x76c364[_0x26d1('0x1e')],'transfereecalleridnum':_0x76c364[_0x26d1('0x1f')],'transfereecalleridname':_0x76c364['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x76c364['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x76c364[_0x26d1('0x20')],'transfereeaccountcode':_0x76c364['transfertargetaccountcode'],'transfereecontext':_0x76c364[_0x26d1('0x21')],'transfereeexten':_0x76c364[_0x26d1('0x22')],'transfereelinkedid':_0x76c364[_0x26d1('0x23')]});}writeDB(_0x76c364);}catch(_0x4e0347){utils['error'](util[_0x26d1('0x2')]('[%s][transfers][attendedtransfer]',_0x76c364['origtransfereruniqueid']),_0x4e0347);}};
\ No newline at end of file
+var _0xf253=['isNil','transfereechannel','assign','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','util','./utils','info','format','type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','error','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','origtransferercontext','origtransfererexten'];(function(_0x936117,_0x562953){var _0xb57208=function(_0x4a1c11){while(--_0x4a1c11){_0x936117['push'](_0x936117['shift']());}};_0xb57208(++_0x562953);}(_0xf253,0x139));var _0x3f25=function(_0x4e6eb2,_0x16a451){_0x4e6eb2=_0x4e6eb2-0x0;var _0x4e0c1c=_0xf253[_0x4e6eb2];return _0x4e0c1c;};'use strict';var _=require('lodash');var util=require(_0x3f25('0x0'));var utils=require(_0x3f25('0x1'));function writeDB(_0x24860c){utils[_0x3f25('0x2')](util[_0x3f25('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x24860c[_0x3f25('0x4')]==='attended'?_0x24860c[_0x3f25('0x5')]:_0x24860c[_0x3f25('0x6')],_0x24860c[_0x3f25('0x4')]));utils[_0x3f25('0x7')](_0x3f25('0x8'),_0x24860c);}exports[_0x3f25('0x9')]=function(_0x3f4c8f){try{utils[_0x3f25('0xa')](util['format'](_0x3f25('0xb'),_0x3f4c8f[_0x3f25('0x6')]),_0x3f4c8f);utils[_0x3f25('0x2')](util[_0x3f25('0x3')](_0x3f25('0xc'),_0x3f4c8f[_0x3f25('0x6')],_0x3f4c8f['transferercalleridnum'],_0x3f4c8f[_0x3f25('0xd')],_0x3f4c8f[_0x3f25('0xe')],_0x3f4c8f[_0x3f25('0xf')]));_0x3f4c8f[_0x3f25('0x4')]='blind';writeDB(_0x3f4c8f);}catch(_0x22c7f8){utils[_0x3f25('0x10')](util['format'](_0x3f25('0xb'),_0x3f4c8f['uniqueid']),_0x22c7f8);}};exports[_0x3f25('0x11')]=function(_0x1d2a69){try{utils['debug'](util[_0x3f25('0x3')](_0x3f25('0x12'),_0x1d2a69[_0x3f25('0x5')]),_0x1d2a69);utils[_0x3f25('0x2')](util[_0x3f25('0x3')](_0x3f25('0x13'),_0x1d2a69['origtransfereruniqueid'],_0x1d2a69[_0x3f25('0x14')],_0x1d2a69[_0x3f25('0x15')],_0x1d2a69[_0x3f25('0x16')],_0x1d2a69['transfertargetcalleridname']));_0x1d2a69=_['assign'](_0x1d2a69,{'transfererchannel':_0x1d2a69[_0x3f25('0x17')],'transferercalleridnum':_0x1d2a69[_0x3f25('0x14')],'transferercalleridname':_0x1d2a69['origtransferercalleridname'],'transfererconnectedlinenum':_0x1d2a69[_0x3f25('0x18')],'transfererconnectedlinename':_0x1d2a69[_0x3f25('0x19')],'transfereraccountcode':_0x1d2a69['origtransfereraccountcode'],'transferercontext':_0x1d2a69['secondtransferercontext'],'transfererexten':_0x1d2a69['secondtransfererexten'],'transfererlinkedid':_0x1d2a69[_0x3f25('0x1a')],'context':_0x1d2a69[_0x3f25('0x1b')],'extension':_0x1d2a69[_0x3f25('0x1c')],'type':'attended'});if(_[_0x3f25('0x1d')](_0x1d2a69[_0x3f25('0x1e')])){_0x1d2a69=_[_0x3f25('0x1f')](_0x1d2a69,{'transfereechannel':_0x1d2a69[_0x3f25('0x20')],'transfereecalleridnum':_0x1d2a69[_0x3f25('0x16')],'transfereecalleridname':_0x1d2a69[_0x3f25('0x21')],'transfereeconnectedlinenum':_0x1d2a69[_0x3f25('0x22')],'transfereeconnectedlinename':_0x1d2a69['transfertargetconnectedlinename'],'transfereeaccountcode':_0x1d2a69[_0x3f25('0x23')],'transfereecontext':_0x1d2a69[_0x3f25('0x24')],'transfereeexten':_0x1d2a69['transfertargetexten'],'transfereelinkedid':_0x1d2a69[_0x3f25('0x25')]});}writeDB(_0x1d2a69);}catch(_0x128820){utils[_0x3f25('0x10')](util[_0x3f25('0x3')](_0x3f25('0x12'),_0x1d2a69[_0x3f25('0x5')]),_0x128820);}};
\ No newline at end of file
index 04e6ae2..dfcb6d0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7299=['notfound','[utils][getUserByInterface]\x20interface:%s\x20%s','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','request','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','format','diffTime','diff','isAfter','isBefore','bluebird','jayson/promise','util','client','../../config/logger','xdr','info','debug','error','inspect','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal'];(function(_0x2a3e06,_0x2af542){var _0xcf59c1=function(_0x5da0a7){while(--_0x5da0a7){_0x2a3e06['push'](_0x2a3e06['shift']());}};_0xcf59c1(++_0x2af542);}(_0x7299,0x1ac));var _0x9729=function(_0x1413b5,_0xbfdb9){_0x1413b5=_0x1413b5-0x0;var _0x36e5eb=_0x7299[_0x1413b5];return _0x36e5eb;};'use strict';var BPromise=require(_0x9729('0x0'));var jayson=require(_0x9729('0x1'));var moment=require('moment');var util=require(_0x9729('0x2'));var client=jayson[_0x9729('0x3')]['http']({'port':0x2329});var logger=require(_0x9729('0x4'))(_0x9729('0x5'));exports[_0x9729('0x6')]=function(_0x1ef177,_0x583d5e){logger[_0x9729('0x6')](_0x1ef177,_0x583d5e?util['inspect'](_0x583d5e,{'showHidden':![],'depth':null}):'');};exports[_0x9729('0x7')]=function(_0x588681,_0x1f0278){logger[_0x9729('0x7')](_0x588681,_0x1f0278?util['inspect'](_0x1f0278,{'showHidden':![],'depth':null}):'');};exports[_0x9729('0x8')]=function(_0x84bd2c,_0x279f1a){logger[_0x9729('0x8')](_0x84bd2c,_0x279f1a?util[_0x9729('0x9')](_0x279f1a,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x196e29,_0x452efb){return client['request'](_0x196e29,{'body':_0x452efb})[_0x9729('0xa')](function(_0xbd7fc){logger[_0x9729('0x7')](_0x9729('0xb'),_0x196e29,_0xbd7fc?util['inspect'](_0xbd7fc,{'showHidden':![],'depth':null}):'');})[_0x9729('0xc')](function(_0x4405e4){logger[_0x9729('0x8')](_0x9729('0xb'),_0x196e29,_0x4405e4?util['inspect'](_0x4405e4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x363abe){return client['request'](_0x9729('0xd'),{'options':{'raw':!![],'attributes':['id',_0x9729('0xe'),_0x9729('0xf'),_0x9729('0x10')],'where':_0x363abe,'limit':0x1}})[_0x9729('0xa')](function(_0x304faf){logger[_0x9729('0x7')](_0x9729('0x11'),JSON[_0x9729('0x12')](_0x363abe),_0x304faf?util['inspect'](_0x304faf,{'showHidden':![],'depth':null}):'');return _0x304faf[_0x9729('0x13')][_0x9729('0x14')]?_0x304faf['result'][0x0]:null;});}exports[_0x9729('0x15')]=function(_0x2eac24){return new BPromise(function(_0x4c74ee,_0x1f73ed){if(_0x2eac24){return getUser({'internal':_0x2eac24})[_0x9729('0xa')](function(_0x3a4ed7){logger[_0x9729('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x2eac24,_0x3a4ed7?'found':_0x9729('0x16'));return _0x4c74ee(_0x3a4ed7);})[_0x9729('0xc')](function(_0x3aa995){logger['error']('[utils][getUserByInternal]',_0x3aa995?util[_0x9729('0x9')](_0x3aa995,{'showHidden':![],'depth':null}):'');return _0x4c74ee(null);});}return _0x4c74ee(null);});};exports['getUserByInterface']=function(_0x5c7eb1){return new BPromise(function(_0x5ee365,_0x502d98){if(_0x5c7eb1){return getUser({'interface':_0x5c7eb1})[_0x9729('0xa')](function(_0x24a158){logger[_0x9729('0x6')](_0x9729('0x17'),_0x5c7eb1,_0x24a158?_0x9729('0x18'):'notfound');return _0x5ee365(_0x24a158);})[_0x9729('0xc')](function(_0x54864b){logger[_0x9729('0x8')](_0x9729('0x19'),_0x54864b?util[_0x9729('0x9')](_0x54864b,{'showHidden':![],'depth':null}):'');return _0x5ee365(null);});}return _0x5ee365(null);});};exports[_0x9729('0x1a')]=function(_0x17f6ba){return new BPromise(function(_0x381a11,_0x33e6c1){if(_0x17f6ba){return getUser({'name':_0x17f6ba})[_0x9729('0xa')](function(_0x2094ac){logger[_0x9729('0x6')](_0x9729('0x1b'),_0x17f6ba,_0x2094ac?_0x9729('0x18'):_0x9729('0x16'));return _0x381a11(_0x2094ac);})[_0x9729('0xc')](function(_0x3688c7){logger['error'](_0x9729('0x1c'),_0x3688c7?util[_0x9729('0x9')](_0x3688c7,{'showHidden':![],'depth':null}):'');return _0x381a11(null);});}return _0x381a11(null);});};exports[_0x9729('0x1d')]=function(_0x4ea8de){return new BPromise(function(_0x219ec2,_0x1e5da0){if(_0x4ea8de){return client[_0x9729('0x1e')](_0x9729('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x9729('0xf'),_0x9729('0x20'),_0x9729('0x21'),'acwTimeout'],'where':{'name':_0x4ea8de},'limit':0x1}})[_0x9729('0xa')](function(_0x3a7bf1){logger[_0x9729('0x7')](_0x9729('0x22'),_0x4ea8de,_0x3a7bf1?util[_0x9729('0x9')](_0x3a7bf1,{'showHidden':![],'depth':null}):'');logger['info']('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x4ea8de,_0x3a7bf1?_0x9729('0x18'):_0x9729('0x16'));return _0x219ec2(_0x3a7bf1[_0x9729('0x13')][_0x9729('0x14')]?_0x3a7bf1['result'][0x0]:null);})[_0x9729('0xc')](function(_0x1267d3){logger[_0x9729('0x8')]('[utils][getVoiceQueueByName]',_0x1267d3?util[_0x9729('0x9')](_0x1267d3,{'showHidden':![],'depth':null}):'');return _0x219ec2(null);});}return _0x219ec2(null);});};exports[_0x9729('0x23')]=function(_0x6ff302,_0x163eb6){return moment(_0x6ff302)[_0x9729('0x24')](_0x163eb6,_0x9729('0x25'))['format'](_0x9729('0x26'));};exports[_0x9729('0x27')]=function(_0x1951fb,_0x31bd03){return moment(_0x1951fb)['subtract'](_0x31bd03,'seconds')[_0x9729('0x28')](_0x9729('0x26'));};exports[_0x9729('0x29')]=function(_0xb51de0,_0xe29ee6){return moment(_0xb51de0)[_0x9729('0x2a')](moment(_0xe29ee6),_0x9729('0x25'));};exports['sumTime']=function(_0x3141a6,_0x10bec6){return parseInt(_0x3141a6,0xa)+parseInt(_0x10bec6,0xa);};exports['now']=function(){return moment()[_0x9729('0x28')](_0x9729('0x26'));};exports[_0x9729('0x2b')]=function(_0x30f301,_0x58324d){if(_0x58324d){return moment(_0x30f301)[_0x9729('0x2b')](_0x58324d);}return!![];};exports[_0x9729('0x2c')]=function(_0x11e4cd,_0x3aece8){if(_0x3aece8){return moment(_0x11e4cd)['isBefore'](_0x3aece8);}else if(_0x11e4cd){return!![];}return![];};
\ No newline at end of file
+var _0x29ce=['isBefore','bluebird','jayson/promise','util','client','xdr','info','inspect','error','request','then','debug','[utils][request]\x20name:%s','GetUser','internal','interface','[utils][getUser]\x20where:%s','stringify','result','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','catch','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','addTime','add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','now','isAfter'];(function(_0x4adb09,_0x24f71b){var _0x308abd=function(_0x4c2e7c){while(--_0x4c2e7c){_0x4adb09['push'](_0x4adb09['shift']());}};_0x308abd(++_0x24f71b);}(_0x29ce,0xec));var _0xe29c=function(_0x16e441,_0x533809){_0x16e441=_0x16e441-0x0;var _0x1be398=_0x29ce[_0x16e441];return _0x1be398;};'use strict';var BPromise=require(_0xe29c('0x0'));var jayson=require(_0xe29c('0x1'));var moment=require('moment');var util=require(_0xe29c('0x2'));var client=jayson[_0xe29c('0x3')]['http']({'port':0x2329});var logger=require('../../config/logger')(_0xe29c('0x4'));exports[_0xe29c('0x5')]=function(_0x4cf192,_0x79200){logger[_0xe29c('0x5')](_0x4cf192,_0x79200?util[_0xe29c('0x6')](_0x79200,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0x43c640,_0x254082){logger['debug'](_0x43c640,_0x254082?util[_0xe29c('0x6')](_0x254082,{'showHidden':![],'depth':null}):'');};exports[_0xe29c('0x7')]=function(_0x31462b,_0x96d90b){logger[_0xe29c('0x7')](_0x31462b,_0x96d90b?util['inspect'](_0x96d90b,{'showHidden':![],'depth':null}):'');};exports[_0xe29c('0x8')]=function(_0x5ca2bf,_0x15dd8f){return client[_0xe29c('0x8')](_0x5ca2bf,{'body':_0x15dd8f})[_0xe29c('0x9')](function(_0x1f69a5){logger[_0xe29c('0xa')](_0xe29c('0xb'),_0x5ca2bf,_0x1f69a5?util[_0xe29c('0x6')](_0x1f69a5,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x4b3c6c){logger[_0xe29c('0x7')](_0xe29c('0xb'),_0x5ca2bf,_0x4b3c6c?util['inspect'](_0x4b3c6c,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3cb306){return client['request'](_0xe29c('0xc'),{'options':{'raw':!![],'attributes':['id',_0xe29c('0xd'),'name',_0xe29c('0xe')],'where':_0x3cb306,'limit':0x1}})[_0xe29c('0x9')](function(_0x64cc0a){logger['debug'](_0xe29c('0xf'),JSON[_0xe29c('0x10')](_0x3cb306),_0x64cc0a?util[_0xe29c('0x6')](_0x64cc0a,{'showHidden':![],'depth':null}):'');return _0x64cc0a[_0xe29c('0x11')]['length']?_0x64cc0a[_0xe29c('0x11')][0x0]:null;});}exports[_0xe29c('0x12')]=function(_0x304bef){return new BPromise(function(_0x311636,_0x1fe57d){if(_0x304bef){return getUser({'internal':_0x304bef})[_0xe29c('0x9')](function(_0x4399dd){logger['info'](_0xe29c('0x13'),_0x304bef,_0x4399dd?_0xe29c('0x14'):_0xe29c('0x15'));return _0x311636(_0x4399dd);})[_0xe29c('0x16')](function(_0x579458){logger[_0xe29c('0x7')]('[utils][getUserByInternal]',_0x579458?util['inspect'](_0x579458,{'showHidden':![],'depth':null}):'');return _0x311636(null);});}return _0x311636(null);});};exports['getUserByInterface']=function(_0x49794f){return new BPromise(function(_0x4c4bf8,_0xbe026){if(_0x49794f){return getUser({'interface':_0x49794f})[_0xe29c('0x9')](function(_0x5a350c){logger[_0xe29c('0x5')](_0xe29c('0x17'),_0x49794f,_0x5a350c?_0xe29c('0x14'):'notfound');return _0x4c4bf8(_0x5a350c);})['catch'](function(_0x142ca8){logger[_0xe29c('0x7')](_0xe29c('0x18'),_0x142ca8?util[_0xe29c('0x6')](_0x142ca8,{'showHidden':![],'depth':null}):'');return _0x4c4bf8(null);});}return _0x4c4bf8(null);});};exports[_0xe29c('0x19')]=function(_0x2c9a3d){return new BPromise(function(_0x3a7632,_0x4f4066){if(_0x2c9a3d){return getUser({'name':_0x2c9a3d})[_0xe29c('0x9')](function(_0x3ef0ce){logger[_0xe29c('0x5')](_0xe29c('0x1a'),_0x2c9a3d,_0x3ef0ce?_0xe29c('0x14'):_0xe29c('0x15'));return _0x3a7632(_0x3ef0ce);})[_0xe29c('0x16')](function(_0x1c00cf){logger[_0xe29c('0x7')](_0xe29c('0x1b'),_0x1c00cf?util['inspect'](_0x1c00cf,{'showHidden':![],'depth':null}):'');return _0x3a7632(null);});}return _0x3a7632(null);});};exports[_0xe29c('0x1c')]=function(_0x832e42){return new BPromise(function(_0x4d3010,_0x4ea72c){if(_0x832e42){return client[_0xe29c('0x8')](_0xe29c('0x1d'),{'options':{'raw':!![],'attributes':['id','name',_0xe29c('0x1e'),'acw','acwTimeout'],'where':{'name':_0x832e42},'limit':0x1}})[_0xe29c('0x9')](function(_0x468042){logger['debug'](_0xe29c('0x1f'),_0x832e42,_0x468042?util[_0xe29c('0x6')](_0x468042,{'showHidden':![],'depth':null}):'');logger[_0xe29c('0x5')](_0xe29c('0x20'),_0x832e42,_0x468042?_0xe29c('0x14'):_0xe29c('0x15'));return _0x4d3010(_0x468042[_0xe29c('0x11')][_0xe29c('0x21')]?_0x468042[_0xe29c('0x11')][0x0]:null);})[_0xe29c('0x16')](function(_0x4b2082){logger[_0xe29c('0x7')](_0xe29c('0x22'),_0x4b2082?util[_0xe29c('0x6')](_0x4b2082,{'showHidden':![],'depth':null}):'');return _0x4d3010(null);});}return _0x4d3010(null);});};exports[_0xe29c('0x23')]=function(_0x5b87a0,_0x37d21c){return moment(_0x5b87a0)[_0xe29c('0x24')](_0x37d21c,'seconds')[_0xe29c('0x25')](_0xe29c('0x26'));};exports[_0xe29c('0x27')]=function(_0x5e33a0,_0x28d063){return moment(_0x5e33a0)[_0xe29c('0x28')](_0x28d063,_0xe29c('0x29'))[_0xe29c('0x25')](_0xe29c('0x26'));};exports[_0xe29c('0x2a')]=function(_0x413286,_0x555680){return moment(_0x413286)[_0xe29c('0x2b')](moment(_0x555680),_0xe29c('0x29'));};exports['sumTime']=function(_0x2058fa,_0x21f02){return parseInt(_0x2058fa,0xa)+parseInt(_0x21f02,0xa);};exports[_0xe29c('0x2c')]=function(){return moment()[_0xe29c('0x25')](_0xe29c('0x26'));};exports[_0xe29c('0x2d')]=function(_0x133ed3,_0x4f62f2){if(_0x4f62f2){return moment(_0x133ed3)[_0xe29c('0x2d')](_0x4f62f2);}return!![];};exports[_0xe29c('0x2e')]=function(_0x21c6a8,_0x4f0fa9){if(_0x4f0fa9){return moment(_0x21c6a8)[_0xe29c('0x2e')](_0x4f0fa9);}else if(_0x21c6a8){return!![];}return![];};
\ No newline at end of file
index 43e081e..78fe396 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc89d=['remoteAddress','url','statusCode','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','other','agent_name','test','fs-extra','express-winston','path','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','name','ensureDir','then','log','user','data','catch','error','api','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for'];(function(_0x3797a4,_0x452ff8){var _0x2eed11=function(_0x2d9b3a){while(--_0x2d9b3a){_0x3797a4['push'](_0x3797a4['shift']());}};_0x2eed11(++_0x452ff8);}(_0xc89d,0xf4));var _0xdc89=function(_0x2a4987,_0x293e14){_0x2a4987=_0x2a4987-0x0;var _0x172cc8=_0xc89d[_0x2a4987];return _0x172cc8;};var fs=require(_0xdc89('0x0'));var _=require('lodash');var ewinston=require(_0xdc89('0x1'));var path=require(_0xdc89('0x2'));var util=require(_0xdc89('0x3'));var fileLogger=require(_0xdc89('0x4'))[_0xdc89('0x5')];var safeTemplate=require(_0xdc89('0x6'))[_0xdc89('0x7')];var maskSensitiveData=require(_0xdc89('0x8'))[_0xdc89('0x9')];function ClientSideLogger(){function _0xa3dbbb(_0xea2553){var _0x1b4ad9=path[_0xdc89('0xa')](_0xdc89('0xb'),'log',_0xdc89('0xc'));var _0x586466=path[_0xdc89('0xa')](_0xdc89('0xd'),_0xea2553['role']+'-'+_0xea2553[_0xdc89('0xe')]);return fs[_0xdc89('0xf')](path['join'](_0x1b4ad9,_0x586466))[_0xdc89('0x10')](function(){var _0x4f47d2=fileLogger(_0xdc89('0xd'),path[_0xdc89('0xa')](_0x1b4ad9,_0x586466));return _0x4f47d2;})['catch'](function(_0x388858){throw _0x388858;});}this[_0xdc89('0x11')]=function(_0x58dd51,_0x45001f,_0x27a12c,_0x5dcdc7){return _0xa3dbbb(_0x58dd51[_0xdc89('0x12')])[_0xdc89('0x10')](function(_0x5b82f8){var _0x4c5c7c=_0x5b82f8[_0x45001f];return _0x4c5c7c;})[_0xdc89('0x10')](function(_0x469696){var _0x5d5d4e=_0x58dd51['user']?_0x58dd51[_0xdc89('0x12')]['id']:'no-user';var _0x4aa594=_0x5dcdc7[_0xdc89('0x13')];var _0x1f5856=_0x5dcdc7['timestamp'];var _0xff21ad=new Date(Number(_0x1f5856));return _0x469696(_0x5d5d4e,_0xff21ad,_0x27a12c,_0x4aa594);})[_0xdc89('0x14')](function(_0xdee889){fileLogger(_0xdc89('0xd'))[_0xdc89('0x15')](_0xdee889);});};}function setupLoggers(_0x472251){return new Promise(function(_0x18dc61){var _0x2e10ec=new ClientSideLogger();var _0x534466=fileLogger(_0xdc89('0x16'));var _0x2dfa21=fileLogger('auth');_0x472251['set']('client-side-logger',_0x2e10ec);_0x472251[_0xdc89('0x17')](ewinston['logger']({'winstonInstance':_0x534466,'meta':![],'statusLevels':!![],'msg':function(_0x56257c,_0x23aca8){var _0x541da1=_0xdc89('0x18');if(!_[_0xdc89('0x19')](_0x56257c[_0xdc89('0x1a')])){_0x541da1+=_0xdc89('0x1b');var _0xed9ba3=_0x56257c[_0xdc89('0x1a')];maskSensitiveData(_0xed9ba3);}return safeTemplate(util[_0xdc89('0x1c')](_0x541da1,_0x56257c[_0xdc89('0x1d')],_0x56257c[_0xdc89('0x1e')][_0xdc89('0x1f')]?_0x56257c[_0xdc89('0x1e')][_0xdc89('0x1f')]:_0x56257c['connection'][_0xdc89('0x20')]||_0x56257c['ip'],_0x56257c[_0xdc89('0x21')],_0x23aca8[_0xdc89('0x22')],_0x23aca8[_0xdc89('0x23')],_0x56257c['user']?_0x56257c[_0xdc89('0x12')]['id']:null,_0x56257c['user']?_0x56257c['user'][_0xdc89('0xe')]:null,_0x56257c[_0xdc89('0x12')]?_0x56257c[_0xdc89('0x12')]['role']:null,_0xed9ba3?util[_0xdc89('0x24')](_0xed9ba3,![],null):''));}}));_0x472251['use'](ewinston[_0xdc89('0x25')]({'winstonInstance':_0x2dfa21,'meta':![],'statusLevels':!![],'msg':function(_0x4a90c1,_0x33364d){var _0xb75e69=_0xdc89('0x26');if(_0x4a90c1[_0xdc89('0x1a')]&&_0x4a90c1[_0xdc89('0x1a')][_0xdc89('0x27')]&&_0x4a90c1[_0xdc89('0x1a')][_0xdc89('0x28')]){_0xb75e69=_0xdc89('0x29');}return util[_0xdc89('0x1c')](_0xb75e69,_0x4a90c1[_0xdc89('0x1d')],_0x4a90c1[_0xdc89('0x1e')][_0xdc89('0x1f')]?_0x4a90c1['headers'][_0xdc89('0x1f')]:_0x4a90c1[_0xdc89('0x2a')][_0xdc89('0x20')]||_0x4a90c1['ip'],_0x4a90c1[_0xdc89('0x21')],_0x33364d[_0xdc89('0x22')],_0x33364d[_0xdc89('0x23')],_0x4a90c1[_0xdc89('0x12')]?_0x4a90c1[_0xdc89('0x12')]['id']:null,_0x4a90c1[_0xdc89('0x12')]?_0x4a90c1['user'][_0xdc89('0xe')]:null,_0x4a90c1[_0xdc89('0x12')]?_0x4a90c1[_0xdc89('0x12')]['role']:null,_0x4a90c1['body']&&_0x4a90c1[_0xdc89('0x1a')][_0xdc89('0x27')]?_0x4a90c1[_0xdc89('0x1a')]['device']:_0xdc89('0x2b'),_0x4a90c1[_0xdc89('0x1a')]&&_0x4a90c1[_0xdc89('0x1a')][_0xdc89('0x28')]?_0x4a90c1[_0xdc89('0x1a')][_0xdc89('0x28')]:'',_0x4a90c1['body']&&_0x4a90c1[_0xdc89('0x1a')][_0xdc89('0x2c')]?_0x4a90c1['body']['agent_name']:'');},'ignoreRoute':function(_0x457244){var _0x24897a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x24897a[_0xdc89('0x2d')](_0x457244[_0xdc89('0x21')]);}}));return _0x18dc61();});}exports['setupLoggers']=setupLoggers;
\ No newline at end of file
+var _0x509f=['url','statusCode','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','responseTime','other','agent_id','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','./loggers','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','data','timestamp','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress'];(function(_0x598713,_0x37a3b6){var _0x2aef5a=function(_0x38469f){while(--_0x38469f){_0x598713['push'](_0x598713['shift']());}};_0x2aef5a(++_0x37a3b6);}(_0x509f,0x15b));var _0xf509=function(_0x42c23b,_0x2041fe){_0x42c23b=_0x42c23b-0x0;var _0x2143d7=_0x509f[_0x42c23b];return _0x2143d7;};var fs=require(_0xf509('0x0'));var _=require(_0xf509('0x1'));var ewinston=require(_0xf509('0x2'));var path=require(_0xf509('0x3'));var util=require(_0xf509('0x4'));var fileLogger=require(_0xf509('0x5'))[_0xf509('0x6')];var safeTemplate=require('./safe-template')[_0xf509('0x7')];var maskSensitiveData=require(_0xf509('0x8'))[_0xf509('0x9')];function ClientSideLogger(){function _0x2b22a7(_0x19c525){var _0x36e1d7=path[_0xf509('0xa')](_0xf509('0xb'),_0xf509('0xc'),_0xf509('0xd'));var _0x14fd0d=path[_0xf509('0xa')](_0xf509('0xe'),_0x19c525[_0xf509('0xf')]+'-'+_0x19c525[_0xf509('0x10')]);return fs[_0xf509('0x11')](path[_0xf509('0xa')](_0x36e1d7,_0x14fd0d))[_0xf509('0x12')](function(){var _0x5c6fc0=fileLogger('client',path[_0xf509('0xa')](_0x36e1d7,_0x14fd0d));return _0x5c6fc0;})[_0xf509('0x13')](function(_0xa3bfce){throw _0xa3bfce;});}this[_0xf509('0xc')]=function(_0xf2a67f,_0x1ac618,_0x455647,_0x78108f){return _0x2b22a7(_0xf2a67f[_0xf509('0x14')])[_0xf509('0x12')](function(_0x46271c){var _0x29f462=_0x46271c[_0x1ac618];return _0x29f462;})['then'](function(_0x4f97b5){var _0x25e9c6=_0xf2a67f[_0xf509('0x14')]?_0xf2a67f[_0xf509('0x14')]['id']:'no-user';var _0x145fc7=_0x78108f[_0xf509('0x15')];var _0x29af4c=_0x78108f[_0xf509('0x16')];var _0x1a10f5=new Date(Number(_0x29af4c));return _0x4f97b5(_0x25e9c6,_0x1a10f5,_0x455647,_0x145fc7);})['catch'](function(_0x4694f3){fileLogger(_0xf509('0xe'))['error'](_0x4694f3);});};}function setupLoggers(_0x5cf945){return new Promise(function(_0xc79801){var _0x5c0982=new ClientSideLogger();var _0x42c157=fileLogger(_0xf509('0x17'));var _0x442d61=fileLogger('auth');_0x5cf945[_0xf509('0x18')](_0xf509('0x19'),_0x5c0982);_0x5cf945[_0xf509('0x1a')](ewinston[_0xf509('0x1b')]({'winstonInstance':_0x42c157,'meta':![],'statusLevels':!![],'msg':function(_0x37c8a2,_0x486a69){var _0x4583c9=_0xf509('0x1c');if(!_['isEmpty'](_0x37c8a2[_0xf509('0x1d')])){_0x4583c9+=_0xf509('0x1e');var _0x22b3cf=_0x37c8a2[_0xf509('0x1d')];maskSensitiveData(_0x22b3cf);}return safeTemplate(util[_0xf509('0x1f')](_0x4583c9,_0x37c8a2[_0xf509('0x20')],_0x37c8a2[_0xf509('0x21')][_0xf509('0x22')]?_0x37c8a2[_0xf509('0x21')]['x-forwarded-for']:_0x37c8a2[_0xf509('0x23')][_0xf509('0x24')]||_0x37c8a2['ip'],_0x37c8a2[_0xf509('0x25')],_0x486a69[_0xf509('0x26')],_0x486a69['responseTime'],_0x37c8a2['user']?_0x37c8a2[_0xf509('0x14')]['id']:null,_0x37c8a2[_0xf509('0x14')]?_0x37c8a2['user'][_0xf509('0x10')]:null,_0x37c8a2['user']?_0x37c8a2[_0xf509('0x14')]['role']:null,_0x22b3cf?util[_0xf509('0x27')](_0x22b3cf,![],null):''));}}));_0x5cf945[_0xf509('0x1a')](ewinston[_0xf509('0x1b')]({'winstonInstance':_0x442d61,'meta':![],'statusLevels':!![],'msg':function(_0x461bae,_0x15c174){var _0x2d9c98=_0xf509('0x28');if(_0x461bae[_0xf509('0x1d')]&&_0x461bae[_0xf509('0x1d')][_0xf509('0x29')]&&_0x461bae[_0xf509('0x1d')]['agent_id']){_0x2d9c98='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x2d9c98,_0x461bae[_0xf509('0x20')],_0x461bae['headers'][_0xf509('0x22')]?_0x461bae['headers'][_0xf509('0x22')]:_0x461bae['connection'][_0xf509('0x24')]||_0x461bae['ip'],_0x461bae[_0xf509('0x25')],_0x15c174[_0xf509('0x26')],_0x15c174[_0xf509('0x2a')],_0x461bae['user']?_0x461bae[_0xf509('0x14')]['id']:null,_0x461bae[_0xf509('0x14')]?_0x461bae[_0xf509('0x14')]['name']:null,_0x461bae['user']?_0x461bae['user'][_0xf509('0xf')]:null,_0x461bae['body']&&_0x461bae[_0xf509('0x1d')][_0xf509('0x29')]?_0x461bae[_0xf509('0x1d')][_0xf509('0x29')]:_0xf509('0x2b'),_0x461bae['body']&&_0x461bae[_0xf509('0x1d')]['agent_id']?_0x461bae['body'][_0xf509('0x2c')]:'',_0x461bae[_0xf509('0x1d')]&&_0x461bae[_0xf509('0x1d')][_0xf509('0x2d')]?_0x461bae[_0xf509('0x1d')][_0xf509('0x2d')]:'');},'ignoreRoute':function(_0x4c9019){var _0x3dcd12=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3dcd12[_0xf509('0x2e')](_0x4c9019['url']);}}));return _0xc79801();});}exports[_0xf509('0x2f')]=setupLoggers;
\ No newline at end of file
index 34818ea..732d339 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd783=['split','locale','weekdaysShort','map','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','format','ddd','dowCompare','daysInMonth','max','min','domCompare','MMM','includes','monthCompare','guess','test','isMoment','length','iftime','lodash','moment-timezone','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid'];(function(_0x4174ed,_0x313335){var _0x2c5404=function(_0x53d5d8){while(--_0x53d5d8){_0x4174ed['push'](_0x4174ed['shift']());}};_0x2c5404(++_0x313335);}(_0xd783,0x13b));var _0x3d78=function(_0x8567ae,_0x118fcf){_0x8567ae=_0x8567ae-0x0;var _0x2f9e9b=_0xd783[_0x8567ae];return _0x2f9e9b;};var _=require(_0x3d78('0x0'));var moment=require(_0x3d78('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x5795b5){return _0x5795b5['source'];})[_0x3d78('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x3d78('0x3');var EINVALID_DATE=_0x3d78('0x4');function throwIfDateNotValid(_0xdca3c7){if(!_0xdca3c7['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x372bcc){var _0x19f04e=_0x372bcc[_0x3d78('0x5')](':')['map'](function(_0x4cbd94){return parseInt(_0x4cbd94,0xa);});var _0x1a319a=_0x19f04e[0x0];var _0x4db9de=_0x19f04e[0x1];if(_0x1a319a<0x0||_0x1a319a>0x17||_0x4db9de<0x0||_0x4db9de>0x3b){throw new Error(EINVALID_DATE);}return[_0x1a319a,_0x4db9de];}function circularDoWInterval(_0x321ede,_0x58f8b6){if(_0x321ede===_0x58f8b6){return[_0x321ede];}else{var _0x15ad75=moment['locale']();moment[_0x3d78('0x6')]('en');var _0x4d066c=moment[_0x3d78('0x7')]()[_0x3d78('0x8')](function(_0x5dc6ee){return _0x5dc6ee[_0x3d78('0x9')]();});moment[_0x3d78('0x6')](_0x15ad75);var _0x3d9b29=_0x4d066c[_0x3d78('0xa')](_0x321ede);var _0x2cdabf=_0x4d066c[_0x3d78('0xa')](_0x58f8b6);if(_0x2cdabf>_0x3d9b29){return _0x4d066c[_0x3d78('0xb')](_0x3d9b29,_0x2cdabf+0x1);}else{var _0x397712=_0x4d066c[_0x3d78('0xb')](0x0,_0x2cdabf+0x1);var _0x215285=_0x4d066c['slice'](_0x3d9b29);return _0x215285[_0x3d78('0xc')](_0x397712);}}}module[_0x3d78('0xd')][_0x3d78('0xe')]=circularDoWInterval;function circularMonthInterval(_0x12b1de,_0x478a7c){if(_0x12b1de===_0x478a7c){return[_0x12b1de];}else{var _0x33ede3=moment[_0x3d78('0x6')]();moment['locale']('en');var _0x31c9b8=moment[_0x3d78('0xf')]()['map'](function(_0x5203bf){return _0x5203bf[_0x3d78('0x9')]();});moment[_0x3d78('0x6')](_0x33ede3);var _0xda80d3=_0x31c9b8[_0x3d78('0xa')](_0x12b1de);var _0x397362=_0x31c9b8[_0x3d78('0xa')](_0x478a7c);if(_0x397362>_0xda80d3){return _0x31c9b8['slice'](_0xda80d3,_0x397362+0x1);}else{var _0x3406f4=_0x31c9b8['slice'](0x0,_0x397362+0x1);var _0x205eb3=_0x31c9b8[_0x3d78('0xb')](_0xda80d3);return _0x205eb3[_0x3d78('0xc')](_0x3406f4);}}}module[_0x3d78('0xd')][_0x3d78('0x10')]=circularMonthInterval;function parseDom(_0x246b55){var _0xfd5288=parseInt(_0x246b55,0xa);if(_0xfd5288<0x1||_0xfd5288>0x1f){throw new Error(EINVALID_DATE);}return _0xfd5288;}function timeCompare(_0x5dac34,_0x86a8fb,_0x3f1d46){var _0x3bfc9f=_0x5dac34['clone']();var _0x4bd1a8=extractTime(_0x86a8fb);var _0x1c7813=_0x4bd1a8[0x0];var _0x43fd1b=_0x4bd1a8[0x1];var _0x393fa2=_0x5dac34[_0x3d78('0x11')]()[_0x3d78('0x12')](_0x1c7813)['minutes'](_0x43fd1b);throwIfDateNotValid(_0x393fa2);var _0xee27be=extractTime(_0x3f1d46);var _0x4258c5=_0xee27be[0x0];var _0x70194a=_0xee27be[0x1];var _0xfb11ae=_0x5dac34[_0x3d78('0x11')]()['hours'](_0x4258c5)[_0x3d78('0x13')](_0x70194a);throwIfDateNotValid(_0xfb11ae);if(_0xfb11ae['isBefore'](_0x393fa2)){var _0x567070=_0x3bfc9f[_0x3d78('0x11')]()[_0x3d78('0x14')](_0x3d78('0x15'));var _0x268fde=_0x3bfc9f['clone']()[_0x3d78('0x16')](_0x3d78('0x15'));return _0x3bfc9f[_0x3d78('0x17')](_0x393fa2,_0x268fde,undefined,'[]')||_0x3bfc9f[_0x3d78('0x17')](_0x567070,_0xfb11ae,undefined,'[]');}else{return _0x3bfc9f['isBetween'](_0x393fa2,_0xfb11ae,undefined,'[]');}}module[_0x3d78('0xd')][_0x3d78('0x18')]=timeCompare;function dowCompare(_0x22abd6,_0x13313e,_0x54b0e3){var _0x357dde=_0x22abd6[_0x3d78('0x6')]('en')[_0x3d78('0x19')](_0x3d78('0x1a'))[_0x3d78('0x9')]();return circularDoWInterval(_0x13313e,_0x54b0e3)['includes'](_0x357dde);}module[_0x3d78('0xd')][_0x3d78('0x1b')]=dowCompare;function domCompare(_0xab82e7,_0x4421f0,_0x475753){var _0x2572e2=_0xab82e7['date']();if(_0x4421f0===_0x475753){return _0x2572e2===_0x4421f0;}else{var _0x1340f1=_0xab82e7[_0x3d78('0x1c')]();var _0x2e31fd=_0x4421f0<_0x475753;let _0x52c592=![];var _0x2f49f7=0x0;var _0x1377ee=0x0;if(_0x2e31fd){_0x2f49f7=Math[_0x3d78('0x1d')](0x1,_0x4421f0);_0x1377ee=Math[_0x3d78('0x1e')](_0x475753,_0x1340f1);_0x52c592=_0x2572e2>=_0x2f49f7&&_0x2572e2<=_0x1377ee;}else{_0x2f49f7=Math[_0x3d78('0x1e')](_0x4421f0,_0x1340f1);_0x1377ee=Math[_0x3d78('0x1d')](0x1,_0x475753);_0x52c592=_0x2572e2>=_0x2f49f7||_0x2572e2<=_0x1377ee;}return _0x52c592;}}module[_0x3d78('0xd')][_0x3d78('0x1f')]=domCompare;function monthCompare(_0x35dffd,_0x587118,_0x21194b){var _0x54b69b=_0x35dffd[_0x3d78('0x6')]('en')[_0x3d78('0x19')](_0x3d78('0x20'))[_0x3d78('0x9')]();return circularMonthInterval(_0x587118,_0x21194b)[_0x3d78('0x21')](_0x54b69b);}module[_0x3d78('0xd')][_0x3d78('0x22')]=monthCompare;function iftime(_0x259fd8,_0x37ee8e=moment['tz'][_0x3d78('0x23')](),_0x5b6ab9=moment()){if(!validateRx[_0x3d78('0x24')](_0x259fd8)){throw new Error(EINVALID_STRING);}else{var _0x479b6b=(moment[_0x3d78('0x25')](_0x5b6ab9)?_0x5b6ab9[_0x3d78('0x11')]():moment(_0x5b6ab9))['tz'](_0x37ee8e)[_0x3d78('0x6')]('en');throwIfDateNotValid(_0x479b6b);var _0x5b0a98=_0x259fd8['split'](',');var _0x29031f=_0x5b0a98[0x0];var _0x571b7e=_0x5b0a98[0x1];var _0x45c140=_0x5b0a98[0x2];var _0x1f2119=_0x5b0a98[0x3];let _0x4a84b9=!![];if(_0x29031f!=='*'){var _0x1b9491=_0x29031f[_0x3d78('0x5')]('-');var _0x57eb23=_['padStart'](_0x1b9491[0x0],0x5,'0');var _0x5e4f7c=_0x1b9491[_0x3d78('0x26')]===0x2?_['padStart'](_0x1b9491[0x1],0x5,'0'):_0x57eb23;_0x4a84b9=timeCompare(_0x479b6b,_0x57eb23,_0x5e4f7c);}let _0x1a53c9=!![];if(_0x571b7e!=='*'){var _0x1bf3d9=_0x571b7e[_0x3d78('0x5')]('-');var _0x2ed606=_0x1bf3d9[0x0];var _0x3a66be=_0x1bf3d9[_0x3d78('0x26')]===0x2?_0x1bf3d9[0x1]:_0x2ed606;_0x1a53c9=dowCompare(_0x479b6b,_0x2ed606,_0x3a66be);}let _0x11834b=!![];if(_0x45c140!=='*'){var _0x100f49=_0x45c140[_0x3d78('0x5')]('-');var _0x46721c=parseDom(_0x100f49[0x0]);var _0x59c48b=_0x100f49[_0x3d78('0x26')]===0x2?parseDom(_0x100f49[0x1]):_0x46721c;_0x11834b=domCompare(_0x479b6b,_0x46721c,_0x59c48b);}let _0x231fee=!![];if(_0x1f2119!=='*'){var _0x45e4b5=_0x1f2119[_0x3d78('0x5')]('-');var _0x1c01e8=_0x45e4b5[0x0];var _0x82d317=_0x45e4b5[_0x3d78('0x26')]===0x2?_0x45e4b5[0x1]:_0x45e4b5[0x0];_0x231fee=monthCompare(_0x479b6b,_0x1c01e8,_0x82d317);}return _0x4a84b9&&_0x1a53c9&&_0x11834b&&_0x231fee;}}module['exports'][_0x3d78('0x27')]=iftime;
\ No newline at end of file
+var _0xa907=['date','daysInMonth','max','min','domCompare','format','MMM','monthCompare','guess','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','join','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularMonthInterval','clone','hours','minutes','startOf','day','endOf','isBetween','timeCompare','ddd','includes'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa907,0xc7));var _0x7a90=function(_0x56f576,_0x39fa12){_0x56f576=_0x56f576-0x0;var _0x13e293=_0xa907[_0x56f576];return _0x13e293;};var _=require(_0x7a90('0x0'));var moment=require(_0x7a90('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x7a90('0x2')](function(_0x3b0017){return _0x3b0017['source'];})[_0x7a90('0x3')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x16079e){if(!_0x16079e['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5827db){var _0x2ec524=_0x5827db[_0x7a90('0x4')](':')['map'](function(_0x4dea24){return parseInt(_0x4dea24,0xa);});var _0x3bc572=_0x2ec524[0x0];var _0x360848=_0x2ec524[0x1];if(_0x3bc572<0x0||_0x3bc572>0x17||_0x360848<0x0||_0x360848>0x3b){throw new Error(EINVALID_DATE);}return[_0x3bc572,_0x360848];}function circularDoWInterval(_0x1088e7,_0xee9805){if(_0x1088e7===_0xee9805){return[_0x1088e7];}else{var _0x5f4718=moment['locale']();moment[_0x7a90('0x5')]('en');var _0x2437aa=moment[_0x7a90('0x6')]()[_0x7a90('0x2')](function(_0x582811){return _0x582811[_0x7a90('0x7')]();});moment[_0x7a90('0x5')](_0x5f4718);var _0x446e38=_0x2437aa[_0x7a90('0x8')](_0x1088e7);var _0x433baf=_0x2437aa[_0x7a90('0x8')](_0xee9805);if(_0x433baf>_0x446e38){return _0x2437aa[_0x7a90('0x9')](_0x446e38,_0x433baf+0x1);}else{var _0x4614b0=_0x2437aa[_0x7a90('0x9')](0x0,_0x433baf+0x1);var _0x5ef796=_0x2437aa[_0x7a90('0x9')](_0x446e38);return _0x5ef796[_0x7a90('0xa')](_0x4614b0);}}}module[_0x7a90('0xb')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x2b61b8,_0x6dc0f1){if(_0x2b61b8===_0x6dc0f1){return[_0x2b61b8];}else{var _0x5381d2=moment[_0x7a90('0x5')]();moment[_0x7a90('0x5')]('en');var _0x310d5c=moment['monthsShort']()['map'](function(_0xf1a1cd){return _0xf1a1cd[_0x7a90('0x7')]();});moment['locale'](_0x5381d2);var _0x38d335=_0x310d5c[_0x7a90('0x8')](_0x2b61b8);var _0x2e976a=_0x310d5c[_0x7a90('0x8')](_0x6dc0f1);if(_0x2e976a>_0x38d335){return _0x310d5c[_0x7a90('0x9')](_0x38d335,_0x2e976a+0x1);}else{var _0xb758b7=_0x310d5c['slice'](0x0,_0x2e976a+0x1);var _0x4ffd52=_0x310d5c[_0x7a90('0x9')](_0x38d335);return _0x4ffd52[_0x7a90('0xa')](_0xb758b7);}}}module[_0x7a90('0xb')][_0x7a90('0xc')]=circularMonthInterval;function parseDom(_0x147b64){var _0x3c6237=parseInt(_0x147b64,0xa);if(_0x3c6237<0x1||_0x3c6237>0x1f){throw new Error(EINVALID_DATE);}return _0x3c6237;}function timeCompare(_0x328905,_0x532d55,_0x177e21){var _0x14cafc=_0x328905[_0x7a90('0xd')]();var _0x44487a=extractTime(_0x532d55);var _0x20cc4e=_0x44487a[0x0];var _0x59ed1c=_0x44487a[0x1];var _0x2093da=_0x328905['clone']()[_0x7a90('0xe')](_0x20cc4e)['minutes'](_0x59ed1c);throwIfDateNotValid(_0x2093da);var _0x5a5215=extractTime(_0x177e21);var _0x31adea=_0x5a5215[0x0];var _0x32349d=_0x5a5215[0x1];var _0x27605f=_0x328905[_0x7a90('0xd')]()[_0x7a90('0xe')](_0x31adea)[_0x7a90('0xf')](_0x32349d);throwIfDateNotValid(_0x27605f);if(_0x27605f['isBefore'](_0x2093da)){var _0x19ceb3=_0x14cafc[_0x7a90('0xd')]()[_0x7a90('0x10')](_0x7a90('0x11'));var _0x2da31b=_0x14cafc[_0x7a90('0xd')]()[_0x7a90('0x12')](_0x7a90('0x11'));return _0x14cafc[_0x7a90('0x13')](_0x2093da,_0x2da31b,undefined,'[]')||_0x14cafc[_0x7a90('0x13')](_0x19ceb3,_0x27605f,undefined,'[]');}else{return _0x14cafc['isBetween'](_0x2093da,_0x27605f,undefined,'[]');}}module[_0x7a90('0xb')][_0x7a90('0x14')]=timeCompare;function dowCompare(_0x4d5b6c,_0x17e7e4,_0x21320d){var _0x2b2382=_0x4d5b6c[_0x7a90('0x5')]('en')['format'](_0x7a90('0x15'))[_0x7a90('0x7')]();return circularDoWInterval(_0x17e7e4,_0x21320d)[_0x7a90('0x16')](_0x2b2382);}module[_0x7a90('0xb')]['dowCompare']=dowCompare;function domCompare(_0x387cc5,_0x3a9dd3,_0xb73922){var _0x3fc15e=_0x387cc5[_0x7a90('0x17')]();if(_0x3a9dd3===_0xb73922){return _0x3fc15e===_0x3a9dd3;}else{var _0x5d9cd5=_0x387cc5[_0x7a90('0x18')]();var _0x264c55=_0x3a9dd3<_0xb73922;let _0x10c357=![];var _0x3cc05f=0x0;var _0x39756c=0x0;if(_0x264c55){_0x3cc05f=Math[_0x7a90('0x19')](0x1,_0x3a9dd3);_0x39756c=Math['min'](_0xb73922,_0x5d9cd5);_0x10c357=_0x3fc15e>=_0x3cc05f&&_0x3fc15e<=_0x39756c;}else{_0x3cc05f=Math[_0x7a90('0x1a')](_0x3a9dd3,_0x5d9cd5);_0x39756c=Math[_0x7a90('0x19')](0x1,_0xb73922);_0x10c357=_0x3fc15e>=_0x3cc05f||_0x3fc15e<=_0x39756c;}return _0x10c357;}}module[_0x7a90('0xb')][_0x7a90('0x1b')]=domCompare;function monthCompare(_0x40e570,_0x5c3301,_0x3fcd3b){var _0x198de5=_0x40e570['locale']('en')[_0x7a90('0x1c')](_0x7a90('0x1d'))[_0x7a90('0x7')]();return circularMonthInterval(_0x5c3301,_0x3fcd3b)['includes'](_0x198de5);}module[_0x7a90('0xb')][_0x7a90('0x1e')]=monthCompare;function iftime(_0x1f53ed,_0x44bd29=moment['tz'][_0x7a90('0x1f')](),_0x1fefa7=moment()){if(!validateRx[_0x7a90('0x20')](_0x1f53ed)){throw new Error(EINVALID_STRING);}else{var _0x3eb3f7=(moment[_0x7a90('0x21')](_0x1fefa7)?_0x1fefa7[_0x7a90('0xd')]():moment(_0x1fefa7))['tz'](_0x44bd29)['locale']('en');throwIfDateNotValid(_0x3eb3f7);var _0x54ab92=_0x1f53ed[_0x7a90('0x4')](',');var _0x1b5ead=_0x54ab92[0x0];var _0xca5d8b=_0x54ab92[0x1];var _0x4dcd30=_0x54ab92[0x2];var _0x23498f=_0x54ab92[0x3];let _0x4519b0=!![];if(_0x1b5ead!=='*'){var _0x52aa12=_0x1b5ead[_0x7a90('0x4')]('-');var _0x3a160a=_[_0x7a90('0x22')](_0x52aa12[0x0],0x5,'0');var _0x2a2089=_0x52aa12[_0x7a90('0x23')]===0x2?_[_0x7a90('0x22')](_0x52aa12[0x1],0x5,'0'):_0x3a160a;_0x4519b0=timeCompare(_0x3eb3f7,_0x3a160a,_0x2a2089);}let _0x55768f=!![];if(_0xca5d8b!=='*'){var _0x3635c5=_0xca5d8b[_0x7a90('0x4')]('-');var _0x3cbf39=_0x3635c5[0x0];var _0x2de5c8=_0x3635c5[_0x7a90('0x23')]===0x2?_0x3635c5[0x1]:_0x3cbf39;_0x55768f=dowCompare(_0x3eb3f7,_0x3cbf39,_0x2de5c8);}let _0x5ce94f=!![];if(_0x4dcd30!=='*'){var _0x281157=_0x4dcd30[_0x7a90('0x4')]('-');var _0x16c7b5=parseDom(_0x281157[0x0]);var _0xfb007e=_0x281157[_0x7a90('0x23')]===0x2?parseDom(_0x281157[0x1]):_0x16c7b5;_0x5ce94f=domCompare(_0x3eb3f7,_0x16c7b5,_0xfb007e);}let _0x53d85f=!![];if(_0x23498f!=='*'){var _0xc48308=_0x23498f['split']('-');var _0x35487d=_0xc48308[0x0];var _0x431293=_0xc48308[_0x7a90('0x23')]===0x2?_0xc48308[0x1]:_0xc48308[0x0];_0x53d85f=monthCompare(_0x3eb3f7,_0x35487d,_0x431293);}return _0x4519b0&&_0x55768f&&_0x5ce94f&&_0x53d85f;}}module[_0x7a90('0xb')][_0x7a90('0x24')]=iftime;
\ No newline at end of file
index 0dee04d..92c69b6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x24b8=['[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','Logger','error','File','%s-%s','warn','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20blue','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','stringify'];(function(_0x158da6,_0x3cb06d){var _0x429c30=function(_0x2d5895){while(--_0x2d5895){_0x158da6['push'](_0x158da6['shift']());}};_0x429c30(++_0x3cb06d);}(_0x24b8,0x1ac));var _0x824b=function(_0x1335a4,_0x38fbad){_0x1335a4=_0x1335a4-0x0;var _0x8b933c=_0x24b8[_0x1335a4];return _0x8b933c;};'use strict';var path=require(_0x824b('0x0'));var util=require(_0x824b('0x1'));var moment=require(_0x824b('0x2'));var winston=require(_0x824b('0x3'));var config=require(_0x824b('0x4'));var debugLevel=config['debugLevel']?config[_0x824b('0x5')][_0x824b('0x6')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x824b('0x7'),'error':_0x824b('0x8'),'warn':'bold\x20yellow','info':_0x824b('0x9'),'print':_0x824b('0xa'),'success':_0x824b('0xb'),'http':_0x824b('0xc'),'verbose':'bold\x20magenta','debug':_0x824b('0xd'),'silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4fe903,_0x2ef5b4,_0x3d1f52){var _0x30510f=_0x4fe903||'/var/log/xcally';return path[_0x824b('0xe')](_0x30510f,util[_0x824b('0xf')](_0x824b('0x10'),_0x2ef5b4,_0x3d1f52));}function formatter(_0x461461,_0x424445){_0x424445[_0x824b('0x11')]=_0x424445[_0x824b('0x11')][_0x824b('0x12')](/@@{/g,_0x824b('0x13'))[_0x824b('0x12')](/}@@/g,_0x824b('0x14'))[_0x824b('0x12')](/@{/g,'{{')[_0x824b('0x12')](/}@/g,'}}');return util[_0x824b('0xf')](_0x824b('0x15'),moment()[_0x824b('0xf')](_0x824b('0x16')),_0x424445[_0x824b('0x17')][_0x824b('0x18')](),_0x461461,_0x424445[_0x824b('0x11')]);}function fileFormat(_0x2ff418,_0x5d4203){_0x5d4203[_0x824b('0x11')]=_0x5d4203[_0x824b('0x11')][_0x824b('0x12')](/@@{/g,_0x824b('0x13'))[_0x824b('0x12')](/}@@/g,_0x824b('0x14'))[_0x824b('0x12')](/@{/g,'{{')[_0x824b('0x12')](/}@/g,'}}');var _0x1d3fee=_0x5d4203[_0x824b('0x19')]&&Object[_0x824b('0x1a')](_0x5d4203[_0x824b('0x19')])['length']?'\x0a\x09'+JSON[_0x824b('0x1b')](_0x5d4203[_0x824b('0x19')]):'';return util[_0x824b('0xf')](_0x824b('0x1c'),moment()[_0x824b('0xf')](_0x824b('0x16')),_0x5d4203[_0x824b('0x17')][_0x824b('0x18')](),_0x2ff418,_0x5d4203[_0x824b('0x11')],_0x1d3fee);}function consoleLogger(){var _0x5f1150=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x824b('0x1d'))][(_0x824b('0x1e'))]({'level':'warn','json':![],'formatter':function(_0x5e4f49){return formatter('',_0x5e4f49);}})]});return _0x5f1150;}function fileLogger(_0x40a1b4,_0xc936a2){var _0x28ad35=new winston[(_0x824b('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x824b('0x1d'))]['File']({'name':util['format']('%s-%s',_0x40a1b4,_0x824b('0x20')),'filename':getLogFileName(_0xc936a2,_0x40a1b4,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3b616f){return fileFormat(_0x40a1b4,_0x3b616f);}}),new winston[(_0x824b('0x1d'))][(_0x824b('0x21'))]({'name':util[_0x824b('0xf')](_0x824b('0x22'),_0x40a1b4,debugLevel),'filename':getLogFileName(_0xc936a2,_0x40a1b4,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x56f6a9){return fileFormat(_0x40a1b4,_0x56f6a9);}}),new winston[(_0x824b('0x1d'))][(_0x824b('0x1e'))]({'level':_0x824b('0x23'),'json':![],'formatter':function(_0x246bb2){return fileFormat(_0x40a1b4,_0x246bb2);}})]});return _0x28ad35;}exports[_0x824b('0x24')]=consoleLogger;exports[_0x824b('0x25')]=fileLogger;
\ No newline at end of file
+var _0x381a=['%s-%s','error','consoleLogger','fileLogger','path','util','moment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20cyan','addColors','/var/log/xcally','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','File'];(function(_0x146837,_0x2aa6a2){var _0x3d7e60=function(_0x1301ac){while(--_0x1301ac){_0x146837['push'](_0x146837['shift']());}};_0x3d7e60(++_0x2aa6a2);}(_0x381a,0x163));var _0xa381=function(_0x372fd9,_0x6e14cd){_0x372fd9=_0x372fd9-0x0;var _0x3b7a22=_0x381a[_0x372fd9];return _0x3b7a22;};'use strict';var path=require(_0xa381('0x0'));var util=require(_0xa381('0x1'));var moment=require(_0xa381('0x2'));var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0xa381('0x3')]?config[_0xa381('0x3')]['toLowerCase']():_0xa381('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xa381('0x5'),'error':_0xa381('0x6'),'warn':_0xa381('0x7'),'info':_0xa381('0x8'),'print':_0xa381('0x9'),'success':_0xa381('0xa'),'http':_0xa381('0xb'),'verbose':_0xa381('0xc'),'debug':'bold\x20blue','silly':_0xa381('0xd')};winston[_0xa381('0xe')](XC_LOG_COLORS);function getLogFileName(_0x4ce883,_0x456553,_0x2a31ca){var _0x4d9bbf=_0x4ce883||_0xa381('0xf');return path['join'](_0x4d9bbf,util[_0xa381('0x10')](_0xa381('0x11'),_0x456553,_0x2a31ca));}function formatter(_0x1b193f,_0x4a6f27){_0x4a6f27[_0xa381('0x12')]=_0x4a6f27[_0xa381('0x12')][_0xa381('0x13')](/@@{/g,_0xa381('0x14'))[_0xa381('0x13')](/}@@/g,_0xa381('0x15'))[_0xa381('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');return util[_0xa381('0x10')](_0xa381('0x16'),moment()['format'](_0xa381('0x17')),_0x4a6f27[_0xa381('0x18')]['toUpperCase'](),_0x1b193f,_0x4a6f27[_0xa381('0x12')]);}function fileFormat(_0x2bdbc6,_0x26bc60){_0x26bc60[_0xa381('0x12')]=_0x26bc60[_0xa381('0x12')][_0xa381('0x13')](/@@{/g,_0xa381('0x14'))[_0xa381('0x13')](/}@@/g,_0xa381('0x15'))[_0xa381('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x2234ba=_0x26bc60[_0xa381('0x19')]&&Object['keys'](_0x26bc60[_0xa381('0x19')])[_0xa381('0x1a')]?'\x0a\x09'+JSON[_0xa381('0x1b')](_0x26bc60[_0xa381('0x19')]):'';return util[_0xa381('0x10')](_0xa381('0x1c'),moment()[_0xa381('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),_0x26bc60['level'][_0xa381('0x1d')](),_0x2bdbc6,_0x26bc60['message'],_0x2234ba);}function consoleLogger(){var _0x11b426=new winston[(_0xa381('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa381('0x1f'))][(_0xa381('0x20'))]({'level':_0xa381('0x21'),'json':![],'formatter':function(_0x7ecece){return formatter('',_0x7ecece);}})]});return _0x11b426;}function fileLogger(_0x3d3179,_0x32a2a4){var _0x4e2c11=new winston[(_0xa381('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xa381('0x1f'))][(_0xa381('0x22'))]({'name':util[_0xa381('0x10')](_0xa381('0x23'),_0x3d3179,_0xa381('0x24')),'filename':getLogFileName(_0x32a2a4,_0x3d3179,_0xa381('0x24')),'level':_0xa381('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2ae6b7){return fileFormat(_0x3d3179,_0x2ae6b7);}}),new winston['transports']['File']({'name':util[_0xa381('0x10')](_0xa381('0x23'),_0x3d3179,debugLevel),'filename':getLogFileName(_0x32a2a4,_0x3d3179,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x121e42){return fileFormat(_0x3d3179,_0x121e42);}}),new winston[(_0xa381('0x1f'))][(_0xa381('0x20'))]({'level':_0xa381('0x21'),'json':![],'formatter':function(_0xbdec4a){return fileFormat(_0x3d3179,_0xbdec4a);}})]});return _0x4e2c11;}exports[_0xa381('0x25')]=consoleLogger;exports[_0xa381('0x26')]=fileLogger;
\ No newline at end of file
index 25ccbc9..e83b4ad 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x2d51cc,_0x2ca3e2){var _0x3dc46b=function(_0x14bc3b){while(--_0x14bc3b){_0x2d51cc['push'](_0x2d51cc['shift']());}};_0x3dc46b(++_0x2ca3e2);}(_0x2ef3,0xba));var _0x32ef=function(_0x5f1bb3,_0x465817){_0x5f1bb3=_0x5f1bb3-0x0;var _0x367650=_0x2ef3[_0x5f1bb3];return _0x367650;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData;
\ No newline at end of file
+var _0x0295=['length','isString','replace','}@@','includes','exports','lodash','newPassword','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','token','accessToken','authToken','consumerSecret','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray'];(function(_0x57486e,_0x32283b){var _0x5f110b=function(_0xa18fc3){while(--_0xa18fc3){_0x57486e['push'](_0x57486e['shift']());}};_0x5f110b(++_0x32283b);}(_0x0295,0x1f0));var _0x5029=function(_0x54e631,_0x3b8396){_0x54e631=_0x54e631-0x0;var _0x3c6b6a=_0x0295[_0x54e631];return _0x3c6b6a;};var _=require(_0x5029('0x0'));var sensitiveFields=['username','password',_0x5029('0x1'),'apiKey','firstName',_0x5029('0x2'),_0x5029('0x3'),_0x5029('0x4'),_0x5029('0x5'),_0x5029('0x6'),_0x5029('0x7'),_0x5029('0x8'),_0x5029('0x9'),_0x5029('0xa'),'code','accessKey','tenantId',_0x5029('0xb'),'channelSecret',_0x5029('0xc'),'accessTokenSecret',_0x5029('0xd'),'consumerKey',_0x5029('0xe'),_0x5029('0xf'),_0x5029('0x10'),'calleridnum',_0x5029('0x11'),_0x5029('0x12'),_0x5029('0x13'),'privateKey',_0x5029('0x14'),_0x5029('0x15'),'key','user','pass','accountSid',_0x5029('0x16'),_0x5029('0x17'),_0x5029('0x18'),_0x5029('0x19'),_0x5029('0x1a')];function maskSensitiveData(_0x11c24b){const _0xe278b7=/(?!^)[\s\S](?!$)/g;if(_[_0x5029('0x1b')](_0x11c24b)){for(const _0x10bf55 in _0x11c24b){if(_[_0x5029('0x1c')](_0x11c24b[_0x10bf55])){for(let _0x457c73=0x0;_0x457c73<_0x11c24b[_0x10bf55][_0x5029('0x1d')];_0x457c73++){maskSensitiveData(_0x11c24b[_0x10bf55][_0x457c73]);}}else if(_[_0x5029('0x1b')](_0x11c24b[_0x10bf55])){maskSensitiveData(_0x11c24b[_0x10bf55]);}else if(_[_0x5029('0x1e')](_0x11c24b[_0x10bf55])){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](/{{{/g,'@@{')[_0x5029('0x1f')](/}}}/g,_0x5029('0x20'))[_0x5029('0x1f')](/{{/g,'@{')[_0x5029('0x1f')](/}}/g,'}@');if(_[_0x5029('0x21')](sensitiveFields,_0x10bf55)){_0x11c24b[_0x10bf55]=_0x11c24b[_0x10bf55][_0x5029('0x1f')](_0xe278b7,'*');}}}}}module[_0x5029('0x22')]['maskSensitiveData']=maskSensitiveData;
\ No newline at end of file
index 5b08a3d..7130765 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x0abf=['safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','keys','reduce','exports'];(function(_0x2c10b8,_0x13194f){var _0x15fba6=function(_0x4d7681){while(--_0x4d7681){_0x2c10b8['push'](_0x2c10b8['shift']());}};_0x15fba6(++_0x13194f);}(_0x0abf,0xe8));var _0xf0ab=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x0abf[_0x19e35c];return _0x3e1fe8;};var _=require(_0xf0ab('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x4d04cc){return _0x4d04cc==='{{'?_0xf0ab('0x1'):_0xf0ab('0x2');}function safeTemplate(_0x528ef7){var _0x598001=_0x528ef7;if(typeof _0x528ef7===_0xf0ab('0x3')){_0x598001=_0x528ef7['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xf0ab('0x4')](_0x528ef7)){_0x598001=_0x528ef7[_0xf0ab('0x5')](function(_0x2efe43){return safeTemplate(_0x2efe43);});}else if(_[_0xf0ab('0x6')](_0x528ef7)){_0x598001=Object[_0xf0ab('0x7')](_0x528ef7)[_0xf0ab('0x8')](function(_0x233afe,_0x57ff3b){_0x233afe[_0x57ff3b]=safeTemplate(_0x528ef7[_0x57ff3b]);return _0x233afe;},{});}return _0x598001;}module[_0xf0ab('0x9')][_0xf0ab('0xa')]=safeTemplate;
\ No newline at end of file
+var _0xda3f=['isPlainObject','keys','exports','safeTemplate','{\x20{\x20','string','isArray','map'];(function(_0x49237d,_0xbe0b7f){var _0x487149=function(_0x12a677){while(--_0x12a677){_0x49237d['push'](_0x49237d['shift']());}};_0x487149(++_0xbe0b7f);}(_0xda3f,0xec));var _0xfda3=function(_0x1c4450,_0x44edd4){_0x1c4450=_0x1c4450-0x0;var _0x54ab92=_0xda3f[_0x1c4450];return _0x54ab92;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x89912f){return _0x89912f==='{{'?_0xfda3('0x0'):'\x20}\x20}';}function safeTemplate(_0x5299b0){var _0x5d7071=_0x5299b0;if(typeof _0x5299b0===_0xfda3('0x1')){_0x5d7071=_0x5299b0['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfda3('0x2')](_0x5299b0)){_0x5d7071=_0x5299b0[_0xfda3('0x3')](function(_0x516500){return safeTemplate(_0x516500);});}else if(_[_0xfda3('0x4')](_0x5299b0)){_0x5d7071=Object[_0xfda3('0x5')](_0x5299b0)['reduce'](function(_0x4e72d1,_0x316792){_0x4e72d1[_0x316792]=safeTemplate(_0x5299b0[_0x316792]);return _0x4e72d1;},{});}return _0x5d7071;}module[_0xfda3('0x6')][_0xfda3('0x7')]=safeTemplate;
\ No newline at end of file
index 982bb8c..174c53c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x99aa=['fs-extra','path','../config/environment','resolve','server/app.json','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','string','then','readJSON','updated','Updating\x20app.json','writeJSON','exports'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0x99aa,0x8c));var _0xa99a=function(_0x1ca385,_0x168653){_0x1ca385=_0x1ca385-0x0;var _0x1ea84e=_0x99aa[_0x1ca385];return _0x1ea84e;};var fs=require(_0xa99a('0x0'));var path=require(_0xa99a('0x1'));var config=require(_0xa99a('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0xa99a('0x3')](root,_0xa99a('0x4'));var NODEPATH=path['resolve'](root,_0xa99a('0x5'));function setLegacyLibsNodeEnvPath(_0x45395a){let _0x45be2c=![];if(Array[_0xa99a('0x6')](_0x45395a[_0xa99a('0x7')])){var _0x49bd04=_0x45395a[_0xa99a('0x7')][_0xa99a('0x8')](function(_0x145a53){return _0x145a53[_0xa99a('0x9')]===_0xa99a('0xa');});if(_0x49bd04>-0x1){var _0x2f4f31=_0x45395a[_0xa99a('0x7')][_0x49bd04];if(typeof _0x2f4f31[_0xa99a('0xb')][_0xa99a('0xc')]!==_0xa99a('0xd')){_0x2f4f31[_0xa99a('0xb')][_0xa99a('0xc')]=NODEPATH;_0x45be2c=!![];}}return{'appConfig':_0x45395a,'updated':_0x45be2c};}}function updateAppConfig(_0x55e1d6){return fs['pathExists'](APP_JSON_PATH)[_0xa99a('0xe')](function(_0x8ba245){if(_0x8ba245){return fs[_0xa99a('0xf')](APP_JSON_PATH)[_0xa99a('0xe')](function(_0x1b2d18){var _0xd937b9=setLegacyLibsNodeEnvPath(_0x1b2d18);if(_0xd937b9[_0xa99a('0x10')]){_0x55e1d6['info'](_0xa99a('0x11'));return fs[_0xa99a('0x12')](APP_JSON_PATH,_0x1b2d18,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise['resolve']();}});}module[_0xa99a('0x13')]=updateAppConfig;
\ No newline at end of file
+var _0xd5a1=['isArray','apps','findIndex','motion2','env','NODE_PATH','pathExists','readJSON','then','info','Updating\x20app.json','writeJSON','fs-extra','path','resolve','legacy-libs'];(function(_0x599e60,_0x5b6519){var _0x468e19=function(_0xcdfd97){while(--_0xcdfd97){_0x599e60['push'](_0x599e60['shift']());}};_0x468e19(++_0x5b6519);}(_0xd5a1,0x11c));var _0x1d5a=function(_0x809f1e,_0x1e8d37){_0x809f1e=_0x809f1e-0x0;var _0x1afc76=_0xd5a1[_0x809f1e];return _0x1afc76;};var fs=require(_0x1d5a('0x0'));var path=require(_0x1d5a('0x1'));var config=require('../config/environment');var root=config['root'];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path[_0x1d5a('0x2')](root,_0x1d5a('0x3'));function setLegacyLibsNodeEnvPath(_0x33987d){let _0x1429ab=![];if(Array[_0x1d5a('0x4')](_0x33987d[_0x1d5a('0x5')])){var _0x189437=_0x33987d[_0x1d5a('0x5')][_0x1d5a('0x6')](function(_0x366fdf){return _0x366fdf['name']===_0x1d5a('0x7');});if(_0x189437>-0x1){var _0x3fbd84=_0x33987d[_0x1d5a('0x5')][_0x189437];if(typeof _0x3fbd84[_0x1d5a('0x8')][_0x1d5a('0x9')]!=='string'){_0x3fbd84[_0x1d5a('0x8')]['NODE_PATH']=NODEPATH;_0x1429ab=!![];}}return{'appConfig':_0x33987d,'updated':_0x1429ab};}}function updateAppConfig(_0x2edee6){return fs[_0x1d5a('0xa')](APP_JSON_PATH)['then'](function(_0x3dcb11){if(_0x3dcb11){return fs[_0x1d5a('0xb')](APP_JSON_PATH)[_0x1d5a('0xc')](function(_0xefa20f){var _0x3db312=setLegacyLibsNodeEnvPath(_0xefa20f);if(_0x3db312['updated']){_0x2edee6[_0x1d5a('0xd')](_0x1d5a('0xe'));return fs[_0x1d5a('0xf')](APP_JSON_PATH,_0xefa20f,{'spaces':0x2});}else{return Promise[_0x1d5a('0x2')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig;
\ No newline at end of file